From 29f4b093ccbb2d3d29505705bfb200215d0b6b17 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 22 Aug 2026 10:06:21 -0400 Subject: [PATCH 1/6] Update three.js --- three.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/three.js b/three.js index d83c8c78e..00ea66ecb 160000 --- a/three.js +++ b/three.js @@ -1 +1 @@ -Subproject commit d83c8c78ede00e5c2dff8c806fc04e03dff01c2d +Subproject commit 00ea66ecb4b253c78e65b5f5a558af4696ba88a7 From 6d44946549f73ba83516867b1520c84a8b57286b Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 22 Aug 2026 10:06:55 -0400 Subject: [PATCH 2/6] Add jsdoc --- jsdoc-testing/jsdoc/build/three.module.d.ts | 1868 + jsdoc-testing/jsdoc/build/three.webgpu.d.ts | 24365 +++++++++++ jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts | 275 + .../jsm/animation/AnimationClipCreator.d.ts | 62 + .../examples/jsm/animation/CCDIKSolver.d.ts | 147 + .../examples/jsm/capabilities/WebGL.d.ts | 31 + .../examples/jsm/capabilities/WebGPU.d.ts | 22 + .../jsm/controls/ArcballControls.d.ts | 676 + .../examples/jsm/controls/DragControls.d.ts | 93 + .../jsm/controls/FirstPersonControls.d.ts | 199 + .../examples/jsm/controls/FlyControls.d.ts | 101 + .../examples/jsm/controls/MapControls.d.ts | 18 + .../examples/jsm/controls/OrbitControls.d.ts | 458 + .../jsm/controls/PointerLockControls.d.ts | 105 + .../jsm/controls/TrackballControls.d.ts | 234 + .../jsm/controls/TransformControls.d.ts | 191 + jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts | 214 + .../jsdoc/examples/jsm/csm/CSMFrustum.d.ts | 81 + .../jsdoc/examples/jsm/csm/CSMHelper.d.ts | 55 + .../jsdoc/examples/jsm/csm/CSMShader.d.ts | 11 + .../jsdoc/examples/jsm/csm/CSMShadowNode.d.ts | 176 + .../examples/jsm/curves/CurveExtras.d.ts | 378 + .../jsdoc/examples/jsm/curves/NURBSCurve.d.ts | 70 + .../examples/jsm/curves/NURBSSurface.d.ts | 58 + .../jsdoc/examples/jsm/curves/NURBSUtils.d.ts | 112 + .../examples/jsm/curves/NURBSVolume.d.ts | 38 + .../examples/jsm/effects/AnaglyphEffect.d.ts | 68 + .../examples/jsm/effects/AsciiEffect.d.ts | 72 + .../examples/jsm/effects/OutlineEffect.d.ts | 89 + .../jsm/effects/ParallaxBarrierEffect.d.ts | 36 + .../examples/jsm/effects/StereoEffect.d.ts | 37 + .../jsm/environments/ColorEnvironment.d.ts | 26 + .../jsm/environments/DebugEnvironment.d.ts | 23 + .../jsm/environments/RoomEnvironment.d.ts | 23 + .../examples/jsm/exporters/DRACOExporter.d.ts | 86 + .../examples/jsm/exporters/EXRExporter.d.ts | 45 + .../examples/jsm/exporters/GLTFExporter.d.ts | 135 + .../examples/jsm/exporters/KTX2Exporter.d.ts | 26 + .../examples/jsm/exporters/OBJExporter.d.ts | 23 + .../examples/jsm/exporters/PLYExporter.d.ts | 56 + .../examples/jsm/exporters/STLExporter.d.ts | 36 + .../examples/jsm/exporters/USDZExporter.d.ts | 82 + .../jsm/generators/CityGenerator.d.ts | 72 + .../jsm/generators/ForestGenerator.d.ts | 87 + .../jsm/generators/TerrainGenerator.d.ts | 76 + .../jsm/generators/TreeGenerator.d.ts | 66 + .../generators/city/SidewalkGenerator.d.ts | 43 + .../generators/city/SkyscraperGenerator.d.ts | 65 + .../jsm/geometries/BoxLineGeometry.d.ts | 27 + .../jsm/geometries/ConvexGeometry.d.ts | 23 + .../jsm/geometries/DecalGeometry.d.ts | 40 + .../examples/jsm/geometries/LoftGeometry.d.ts | 75 + .../jsm/geometries/ParametricFunctions.d.ts | 36 + .../jsm/geometries/ParametricGeometry.d.ts | 40 + .../jsm/geometries/RoundedBoxGeometry.d.ts | 26 + .../jsm/geometries/TeapotGeometry.d.ts | 37 + .../examples/jsm/geometries/TextGeometry.d.ts | 92 + .../jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts | 263 + .../examples/jsm/gpgpu/CountingSort.d.ts | 141 + .../jsm/helpers/AnimationPathHelper.d.ts | 130 + .../jsm/helpers/LightProbeGridHelper.d.ts | 41 + .../helpers/LightProbeGridHelperWebGL.d.ts | 35 + .../jsm/helpers/LightProbeHelper.d.ts | 37 + .../jsm/helpers/LightProbeHelperGPU.d.ts | 40 + .../examples/jsm/helpers/OctreeHelper.d.ts | 38 + .../jsm/helpers/PositionalAudioHelper.d.ts | 61 + .../examples/jsm/helpers/RapierHelper.d.ts | 27 + .../jsm/helpers/RectAreaLightHelper.d.ts | 38 + .../examples/jsm/helpers/TextureHelper.d.ts | 29 + .../jsm/helpers/TextureHelperGPU.d.ts | 30 + .../jsm/helpers/VertexNormalsHelper.d.ts | 54 + .../jsm/helpers/VertexTangentsHelper.d.ts | 41 + .../examples/jsm/inspector/Extension.d.ts | 12 + .../examples/jsm/inspector/Inspector.d.ts | 88 + .../jsm/inspector/RendererInspector.d.ts | 44 + .../color-grading/ColorGrading.d.ts | 168 + .../extensions/color-grading/ColorWheel.d.ts | 27 + .../extensions/color-grading/CurveEditor.d.ts | 37 + .../extensions/color-grading/LUT3DStyle.d.ts | 6 + .../extensions/color-grading/LUTMath.d.ts | 505 + .../modules/BrightnessModule.d.ts | 6 + .../modules/ColorWheelModule.d.ts | 9 + .../color-grading/modules/ContrastModule.d.ts | 7 + .../color-grading/modules/CurvesModule.d.ts | 7 + .../modules/ExposureHueModule.d.ts | 7 + .../color-grading/modules/ExposureModule.d.ts | 6 + .../color-grading/modules/HueModule.d.ts | 6 + .../modules/ImportedCubeModule.d.ts | 7 + .../color-grading/modules/Module.d.ts | 48 + .../color-grading/modules/OutputModule.d.ts | 7 + .../color-grading/modules/RendererModule.d.ts | 11 + .../modules/SatVibranceModule.d.ts | 7 + .../modules/SaturationModule.d.ts | 6 + .../color-grading/modules/VibranceModule.d.ts | 6 + .../modules/WhiteBalanceModule.d.ts | 7 + .../extensions/tsl-graph/TSLGraphEditor.d.ts | 43 + .../extensions/tsl-graph/TSLGraphLoader.d.ts | 24 + .../examples/jsm/inspector/tabs/Console.d.ts | 31 + .../examples/jsm/inspector/tabs/Memory.d.ts | 20 + .../jsm/inspector/tabs/Parameters.d.ts | 39 + .../jsm/inspector/tabs/Performance.d.ts | 20 + .../examples/jsm/inspector/tabs/Settings.d.ts | 13 + .../examples/jsm/inspector/tabs/Timeline.d.ts | 153 + .../examples/jsm/inspector/tabs/Viewer.d.ts | 53 + .../examples/jsm/inspector/ui/Graph.d.ts | 23 + .../jsdoc/examples/jsm/inspector/ui/Item.d.ts | 23 + .../jsdoc/examples/jsm/inspector/ui/List.d.ts | 12 + .../examples/jsm/inspector/ui/Profiler.d.ts | 72 + .../examples/jsm/inspector/ui/Style.d.ts | 3 + .../jsdoc/examples/jsm/inspector/ui/Tab.d.ts | 54 + .../examples/jsm/inspector/ui/Values.d.ts | 82 + .../examples/jsm/inspector/ui/utils.d.ts | 10 + .../jsm/interaction/InteractionManager.d.ts | 77 + .../examples/jsm/interactive/HTMLMesh.d.ts | 26 + .../jsm/interactive/InteractiveGroup.d.ts | 81 + .../jsm/interactive/SelectionBox.d.ts | 83 + .../jsm/libs/basis/basis_transcoder.d.ts | 2 + .../jsm/libs/chevrotain.module.min.d.ts | 2 + .../jsdoc/examples/jsm/libs/demuxer_mp4.d.ts | 8 + .../jsm/libs/draco/draco_decoder.d.ts | 5 + .../jsm/libs/draco/draco_wasm_wrapper.d.ts | 5 + .../jsm/libs/draco/gltf/draco_decoder.d.ts | 5 + .../libs/draco/gltf/draco_wasm_wrapper.d.ts | 5 + .../jsdoc/examples/jsm/libs/ecsy.module.d.ts | 344 + .../examples/jsm/libs/ktx-parse.module.d.ts | 299 + .../jsm/libs/meshopt_clusterizer.module.d.ts | 77 + .../jsm/libs/meshopt_decoder.module.d.ts | 19 + .../jsm/libs/meshopt_simplifier.module.d.ts | 25 + .../examples/jsm/libs/mikktspace.module.d.ts | 16 + .../jsm/libs/motion-controllers.module.d.ts | 64 + .../examples/jsm/libs/potpack.module.d.ts | 34 + .../jsdoc/examples/jsm/libs/stats.module.d.ts | 18 + .../jsdoc/examples/jsm/libs/surfaceNet.d.ts | 15 + .../jsdoc/examples/jsm/libs/utif.module.d.ts | 156 + .../examples/jsm/libs/zstddec.module.d.ts | 6 + .../jsm/lighting/ClusteredLighting.d.ts | 42 + .../jsm/lighting/DynamicLighting.d.ts | 54 + .../examples/jsm/lighting/LightProbeGrid.d.ts | 143 + .../jsm/lighting/LightProbeGridWebGL.d.ts | 147 + .../jsm/lights/LightProbeGenerator.d.ts | 30 + .../jsm/lights/RectAreaLightTexturesLib.d.ts | 32 + .../jsm/lights/RectAreaLightUniformsLib.d.ts | 19 + .../jsdoc/examples/jsm/lines/Line2.d.ts | 44 + .../examples/jsm/lines/LineGeometry.d.ts | 58 + .../examples/jsm/lines/LineMaterial.d.ts | 98 + .../examples/jsm/lines/LineSegments2.d.ts | 60 + .../jsm/lines/LineSegmentsGeometry.d.ts | 73 + .../jsdoc/examples/jsm/lines/Wireframe.d.ts | 46 + .../jsm/lines/WireframeGeometry2.d.ts | 30 + .../examples/jsm/lines/webgpu/Line2.d.ts | 33 + .../jsm/lines/webgpu/LineSegments2.d.ts | 51 + .../examples/jsm/lines/webgpu/Wireframe.d.ts | 37 + .../jsdoc/examples/jsm/loaders/3DMLoader.d.ts | 135 + .../jsdoc/examples/jsm/loaders/3MFLoader.d.ts | 67 + .../jsdoc/examples/jsm/loaders/AMFLoader.d.ts | 43 + .../jsdoc/examples/jsm/loaders/BVHLoader.d.ts | 71 + .../examples/jsm/loaders/ColladaLoader.d.ts | 49 + .../jsdoc/examples/jsm/loaders/DDSLoader.d.ts | 30 + .../examples/jsm/loaders/DRACOLoader.d.ts | 125 + .../jsdoc/examples/jsm/loaders/EXRLoader.d.ts | 72 + .../jsdoc/examples/jsm/loaders/FBXLoader.d.ts | 61 + .../examples/jsm/loaders/FontLoader.d.ts | 75 + .../examples/jsm/loaders/GCodeLoader.d.ts | 48 + .../GLTFGaussianSplatLoaderExtension.d.ts | 36 + .../examples/jsm/loaders/GLTFLoader.d.ts | 396 + .../jsm/loaders/GaussianSplatPLYLoader.d.ts | 52 + .../jsm/loaders/HDRCubeTextureLoader.d.ts | 58 + .../jsdoc/examples/jsm/loaders/HDRLoader.d.ts | 44 + .../jsdoc/examples/jsm/loaders/IESLoader.d.ts | 51 + .../jsdoc/examples/jsm/loaders/KMZLoader.d.ts | 38 + .../examples/jsm/loaders/KSPLATLoader.d.ts | 44 + .../examples/jsm/loaders/KTX2Loader.d.ts | 188 + .../jsdoc/examples/jsm/loaders/KTXLoader.d.ts | 34 + .../examples/jsm/loaders/LDrawLoader.d.ts | 256 + .../examples/jsm/loaders/LUT3dlLoader.d.ts | 62 + .../examples/jsm/loaders/LUTCubeLoader.d.ts | 68 + .../examples/jsm/loaders/LUTImageLoader.d.ts | 58 + .../jsdoc/examples/jsm/loaders/LWOLoader.d.ts | 57 + .../jsdoc/examples/jsm/loaders/MD2Loader.d.ts | 43 + .../jsdoc/examples/jsm/loaders/MDDLoader.d.ts | 71 + .../jsdoc/examples/jsm/loaders/MTLLoader.d.ts | 107 + .../examples/jsm/loaders/MaterialXLoader.d.ts | 20 + .../examples/jsm/loaders/NRRDLoader.d.ts | 46 + .../jsdoc/examples/jsm/loaders/OBJLoader.d.ts | 58 + .../jsdoc/examples/jsm/loaders/PCDLoader.d.ts | 67 + .../jsdoc/examples/jsm/loaders/PDBLoader.d.ts | 45 + .../jsdoc/examples/jsm/loaders/PLYLoader.d.ts | 76 + .../jsdoc/examples/jsm/loaders/PVRLoader.d.ts | 30 + .../examples/jsm/loaders/RGBELoader.d.ts | 3 + .../examples/jsm/loaders/SPLATLoader.d.ts | 42 + .../jsdoc/examples/jsm/loaders/SPZLoader.d.ts | 62 + .../jsdoc/examples/jsm/loaders/STLLoader.d.ts | 69 + .../jsdoc/examples/jsm/loaders/SVGLoader.d.ts | 150 + .../jsdoc/examples/jsm/loaders/TDSLoader.d.ts | 141 + .../jsdoc/examples/jsm/loaders/TGALoader.d.ts | 28 + .../examples/jsm/loaders/TIFFLoader.d.ts | 28 + .../jsdoc/examples/jsm/loaders/TTFLoader.d.ts | 48 + .../jsdoc/examples/jsm/loaders/USDLoader.d.ts | 48 + .../examples/jsm/loaders/USDZLoader.d.ts | 3 + .../examples/jsm/loaders/UltraHDRLoader.d.ts | 82 + .../jsdoc/examples/jsm/loaders/VOXLoader.d.ts | 54 + .../examples/jsm/loaders/VRMLLoader.d.ts | 40 + .../jsdoc/examples/jsm/loaders/VTKLoader.d.ts | 48 + .../jsdoc/examples/jsm/loaders/XYZLoader.d.ts | 42 + .../jsm/loaders/collada/ColladaComposer.d.ts | 154 + .../jsm/loaders/collada/ColladaParser.d.ts | 234 + .../examples/jsm/loaders/lwo/IFFParser.d.ts | 121 + .../examples/jsm/loaders/lwo/LWO2Parser.d.ts | 5 + .../examples/jsm/loaders/lwo/LWO3Parser.d.ts | 5 + .../loaders/materialx/MaterialXArchive.d.ts | 10 + .../loaders/materialx/MaterialXDocument.d.ts | 41 + .../loaders/materialx/MaterialXHextile.d.ts | 7 + .../MaterialXInterfaceValidation.d.ts | 1 + .../jsm/loaders/materialx/MaterialXLog.d.ts | 54 + .../MaterialXNodeInterfaceRegistry.d.ts | 33497 ++++++++++++++++ .../materialx/MaterialXNodeLibrary.d.ts | 1 + .../materialx/MaterialXSurfaceMappings.d.ts | 20 + .../jsm/loaders/materialx/MaterialXUtils.d.ts | 5 + .../compile/MaterialXCompileRegistry.d.ts | 2 + .../materialx/parse/MaterialXParser.d.ts | 2 + .../examples/jsm/loaders/usd/USDAParser.d.ts | 31 + .../examples/jsm/loaders/usd/USDCParser.d.ts | 70 + .../examples/jsm/loaders/usd/USDComposer.d.ts | 238 + .../LDrawConditionalLineMaterial.d.ts | 21 + .../LDrawConditionalLineNodeMaterial.d.ts | 34 + .../jsm/materials/WoodNodeMaterial.d.ts | 38 + .../jsdoc/examples/jsm/math/Capsule.d.ts | 82 + .../examples/jsm/math/ColorConverter.d.ts | 34 + .../jsdoc/examples/jsm/math/ColorSpaces.d.ts | 94 + .../jsdoc/examples/jsm/math/ConvexHull.d.ts | 533 + .../examples/jsm/math/ImprovedNoise.d.ts | 19 + .../jsdoc/examples/jsm/math/Lut.d.ts | 133 + .../examples/jsm/math/MeshSurfaceSampler.d.ts | 95 + .../jsdoc/examples/jsm/math/OBB.d.ts | 150 + .../jsdoc/examples/jsm/math/Octree.d.ts | 195 + .../jsdoc/examples/jsm/math/SimplexNoise.d.ts | 52 + .../jsm/misc/ConvexObjectBreaker.d.ts | 93 + .../jsdoc/examples/jsm/misc/Gyroscope.d.ts | 13 + .../jsdoc/examples/jsm/misc/MD2Character.d.ts | 133 + .../jsm/misc/MD2CharacterComplex.d.ts | 210 + .../examples/jsm/misc/MorphAnimMesh.d.ts | 55 + .../examples/jsm/misc/MorphBlendMesh.d.ts | 124 + .../jsm/misc/ProgressiveLightMap.d.ts | 87 + .../jsm/misc/ProgressiveLightMapGPU.d.ts | 83 + .../examples/jsm/misc/RollerCoaster.d.ts | 69 + .../jsm/misc/TileCreasedNormalsPlugin.d.ts | 49 + .../jsdoc/examples/jsm/misc/TubePainter.d.ts | 68 + .../jsdoc/examples/jsm/misc/Volume.d.ts | 163 + .../jsdoc/examples/jsm/misc/VolumeSlice.d.ts | 99 + .../examples/jsm/modifiers/CurveModifier.d.ts | 79 + .../jsm/modifiers/CurveModifierGPU.d.ts | 37 + .../jsm/modifiers/EdgeSplitModifier.d.ts | 24 + .../jsm/modifiers/SimplifyModifier.d.ts | 27 + .../jsm/modifiers/TessellateModifier.d.ts | 43 + .../examples/jsm/objects/GaussianSplat.d.ts | 126 + .../examples/jsm/objects/GroundedSkybox.d.ts | 30 + .../jsdoc/examples/jsm/objects/Lensflare.d.ts | 120 + .../examples/jsm/objects/LensflareMesh.d.ts | 54 + .../jsm/objects/ReflectorForSSRPass.d.ts | 134 + .../jsdoc/examples/jsm/objects/Refractor.d.ts | 107 + .../examples/jsm/objects/ShadowMesh.d.ts | 48 + .../jsdoc/examples/jsm/objects/Sky.d.ts | 108 + .../jsdoc/examples/jsm/objects/SkyMesh.d.ts | 127 + .../jsdoc/examples/jsm/objects/Water.d.ts | 92 + .../jsdoc/examples/jsm/objects/Water2.d.ts | 145 + .../examples/jsm/objects/Water2Mesh.d.ts | 72 + .../jsdoc/examples/jsm/objects/WaterMesh.d.ts | 127 + .../jsdoc/examples/jsm/offscreen/jank.d.ts | 2 + .../examples/jsm/offscreen/offscreen.d.ts | 1 + .../jsdoc/examples/jsm/offscreen/scene.d.ts | 2 + .../examples/jsm/physics/AmmoPhysics.d.ts | 52 + .../examples/jsm/physics/JoltPhysics.d.ts | 53 + .../examples/jsm/physics/RapierPhysics.d.ts | 98 + .../jsm/postprocessing/AfterimagePass.d.ts | 75 + .../jsm/postprocessing/BloomPass.d.ts | 79 + .../jsm/postprocessing/BokehPass.d.ts | 102 + .../jsm/postprocessing/ClearPass.d.ts | 50 + .../jsm/postprocessing/CubeTexturePass.d.ts | 61 + .../jsm/postprocessing/DotScreenPass.d.ts | 55 + .../jsm/postprocessing/EffectComposer.d.ts | 158 + .../examples/jsm/postprocessing/FXAAPass.d.ts | 25 + .../examples/jsm/postprocessing/FilmPass.d.ts | 53 + .../examples/jsm/postprocessing/GTAOPass.d.ts | 184 + .../jsm/postprocessing/GlitchPass.d.ts | 61 + .../jsm/postprocessing/HalftonePass.d.ts | 66 + .../examples/jsm/postprocessing/LUTPass.d.ts | 27 + .../examples/jsm/postprocessing/MaskPass.d.ts | 79 + .../jsm/postprocessing/OutlinePass.d.ts | 177 + .../jsm/postprocessing/OutputPass.d.ts | 56 + .../examples/jsm/postprocessing/Pass.d.ts | 115 + .../jsm/postprocessing/RenderPass.d.ts | 89 + .../postprocessing/RenderPixelatedPass.d.ts | 101 + .../postprocessing/RenderTransitionPass.d.ts | 107 + .../examples/jsm/postprocessing/SAOPass.d.ts | 97 + .../examples/jsm/postprocessing/SMAAPass.d.ts | 51 + .../jsm/postprocessing/SSAARenderPass.d.ts | 105 + .../examples/jsm/postprocessing/SSAOPass.d.ts | 137 + .../examples/jsm/postprocessing/SSRPass.d.ts | 218 + .../examples/jsm/postprocessing/SavePass.d.ts | 62 + .../jsm/postprocessing/ShaderPass.d.ts | 59 + .../jsm/postprocessing/TAARenderPass.d.ts | 59 + .../jsm/postprocessing/TexturePass.d.ts | 64 + .../jsm/postprocessing/UnrealBloomPass.d.ts | 112 + .../examples/jsm/renderers/CSS2DRenderer.d.ts | 117 + .../examples/jsm/renderers/CSS3DRenderer.d.ts | 121 + .../examples/jsm/renderers/Projector.d.ts | 75 + .../examples/jsm/renderers/SVGRenderer.d.ts | 150 + .../shaders/ACESFilmicToneMappingShader.d.ts | 15 + .../jsm/shaders/AfterimageShader.d.ts | 11 + .../examples/jsm/shaders/BasicShader.d.ts | 11 + .../jsm/shaders/BleachBypassShader.d.ts | 12 + .../examples/jsm/shaders/BlendShader.d.ts | 11 + .../examples/jsm/shaders/BokehShader.d.ts | 12 + .../examples/jsm/shaders/BokehShader2.d.ts | 28 + .../jsm/shaders/BrightnessContrastShader.d.ts | 13 + .../jsm/shaders/ColorCorrectionShader.d.ts | 11 + .../examples/jsm/shaders/ColorifyShader.d.ts | 11 + .../jsm/shaders/ConvolutionShader.d.ts | 11 + .../examples/jsm/shaders/CopyShader.d.ts | 11 + .../examples/jsm/shaders/DOFMipMapShader.d.ts | 13 + .../jsm/shaders/DepthLimitedBlurShader.d.ts | 21 + .../examples/jsm/shaders/DigitalGlitch.d.ts | 11 + .../examples/jsm/shaders/DotScreenShader.d.ts | 11 + .../examples/jsm/shaders/ExposureShader.d.ts | 11 + .../examples/jsm/shaders/FXAAShader.d.ts | 15 + .../examples/jsm/shaders/FilmShader.d.ts | 14 + .../examples/jsm/shaders/FocusShader.d.ts | 11 + .../examples/jsm/shaders/FreiChenShader.d.ts | 14 + .../examples/jsm/shaders/GTAOShader.d.ts | 31 + .../jsm/shaders/GammaCorrectionShader.d.ts | 14 + .../examples/jsm/shaders/HalftoneShader.d.ts | 16 + .../jsm/shaders/HorizontalBlurShader.d.ts | 18 + .../shaders/HorizontalTiltShiftShader.d.ts | 16 + .../jsm/shaders/HueSaturationShader.d.ts | 14 + .../examples/jsm/shaders/KaleidoShader.d.ts | 17 + .../jsm/shaders/LuminosityHighPassShader.d.ts | 11 + .../jsm/shaders/LuminosityShader.d.ts | 11 + .../examples/jsm/shaders/MirrorShader.d.ts | 13 + .../examples/jsm/shaders/NormalMapShader.d.ts | 10 + .../examples/jsm/shaders/OutputShader.d.ts | 14 + .../jsm/shaders/PoissonDenoiseShader.d.ts | 16 + .../examples/jsm/shaders/RGBShiftShader.d.ts | 17 + .../jsdoc/examples/jsm/shaders/SAOShader.d.ts | 13 + .../examples/jsm/shaders/SMAAShader.d.ts | 31 + .../examples/jsm/shaders/SSAOShader.d.ts | 30 + .../jsdoc/examples/jsm/shaders/SSRShader.d.ts | 30 + .../examples/jsm/shaders/SepiaShader.d.ts | 11 + .../jsm/shaders/SobelOperatorShader.d.ts | 13 + .../shaders/SubsurfaceScatteringShader.d.ts | 13 + .../jsm/shaders/TechnicolorShader.d.ts | 13 + .../examples/jsm/shaders/ToonShader.d.ts | 34 + .../jsm/shaders/TriangleBlurShader.d.ts | 15 + .../jsm/shaders/UnpackDepthRGBAShader.d.ts | 11 + .../examples/jsm/shaders/VelocityShader.d.ts | 11 + .../jsm/shaders/VerticalBlurShader.d.ts | 16 + .../jsm/shaders/VerticalTiltShiftShader.d.ts | 16 + .../examples/jsm/shaders/VignetteShader.d.ts | 11 + .../examples/jsm/shaders/VolumeShader.d.ts | 13 + .../jsm/shaders/WaterRefractionShader.d.ts | 11 + .../examples/jsm/textures/FlakesTexture.d.ts | 17 + .../jsdoc/examples/jsm/transpiler/AST.d.ts | 191 + .../examples/jsm/transpiler/GLSLDecoder.d.ts | 76 + .../jsdoc/examples/jsm/transpiler/Linker.d.ts | 17 + .../jsm/transpiler/ShaderToyDecoder.d.ts | 4 + .../examples/jsm/transpiler/TSLEncoder.d.ts | 31 + .../examples/jsm/transpiler/Transpiler.d.ts | 48 + .../jsm/transpiler/TranspilerUtils.d.ts | 4 + .../examples/jsm/transpiler/WGSLEncoder.d.ts | 24 + .../jsm/tsl/display/AfterImageNode.d.ts | 93 + .../jsm/tsl/display/AnaglyphPassNode.d.ts | 135 + .../jsm/tsl/display/BilateralBlurNode.d.ts | 138 + .../jsm/tsl/display/BleachBypass.d.ts | 10 + .../examples/jsm/tsl/display/BloomNode.d.ts | 247 + .../jsdoc/examples/jsm/tsl/display/CRT.d.ts | 58 + .../tsl/display/ChromaticAberrationNode.d.ts | 53 + .../examples/jsm/tsl/display/DenoiseNode.d.ts | 115 + .../jsm/tsl/display/DepthOfFieldNode.d.ts | 212 + .../jsm/tsl/display/DotScreenNode.d.ts | 44 + .../examples/jsm/tsl/display/FSR1Node.d.ts | 112 + .../examples/jsm/tsl/display/FXAANode.d.ts | 44 + .../examples/jsm/tsl/display/FilmNode.d.ts | 56 + .../examples/jsm/tsl/display/GTAONode.d.ts | 259 + .../jsm/tsl/display/GaussianBlurNode.d.ts | 168 + .../examples/jsm/tsl/display/GodraysNode.d.ts | 201 + .../display/ImportanceSampledEnvironment.d.ts | 102 + .../jsm/tsl/display/LensflareNode.d.ts | 132 + .../examples/jsm/tsl/display/Lut3DNode.d.ts | 51 + .../examples/jsm/tsl/display/MotionBlur.d.ts | 11 + .../examples/jsm/tsl/display/OITPassNode.d.ts | 105 + .../examples/jsm/tsl/display/OutlineNode.d.ts | 351 + .../tsl/display/ParallaxBarrierPassNode.d.ts | 26 + .../jsm/tsl/display/PixelationPassNode.d.ts | 134 + .../jsm/tsl/display/RGBShiftNode.d.ts | 45 + .../jsm/tsl/display/RetroPassNode.d.ts | 40 + .../examples/jsm/tsl/display/SMAANode.d.ts | 166 + .../jsm/tsl/display/SSAAPassNode.d.ts | 83 + .../examples/jsm/tsl/display/SSAONode.d.ts | 213 + .../examples/jsm/tsl/display/SSGINode.d.ts | 277 + .../examples/jsm/tsl/display/SSRNode.d.ts | 507 + .../examples/jsm/tsl/display/SSSNode.d.ts | 226 + .../jsdoc/examples/jsm/tsl/display/Sepia.d.ts | 9 + .../jsdoc/examples/jsm/tsl/display/Shape.d.ts | 12 + .../examples/jsm/tsl/display/SharpenNode.d.ts | 96 + .../jsm/tsl/display/SobelOperatorNode.d.ts | 45 + .../tsl/display/StereoCompositePassNode.d.ts | 87 + .../jsm/tsl/display/StereoPassNode.d.ts | 40 + .../examples/jsm/tsl/display/TAAUNode.d.ts | 275 + .../examples/jsm/tsl/display/TRAANode.d.ts | 239 + .../jsm/tsl/display/TransitionNode.d.ts | 65 + .../examples/jsm/tsl/display/boxBlur.d.ts | 24 + .../jsm/tsl/display/depthAwareBlend.d.ts | 17 + .../jsm/tsl/display/depthAwareBlur.d.ts | 20 + .../examples/jsm/tsl/display/hashBlur.d.ts | 22 + .../examples/jsm/tsl/display/radialBlur.d.ts | 20 + .../jsm/tsl/lighting/ClusteredLightsNode.d.ts | 80 + .../jsm/tsl/lighting/DynamicLightsNode.d.ts | 38 + .../jsm/tsl/lighting/LightProbeGridNode.d.ts | 21 + .../lighting/data/AmbientLightDataNode.d.ts | 17 + .../data/DirectionalLightDataNode.d.ts | 24 + .../data/HemisphereLightDataNode.d.ts | 24 + .../tsl/lighting/data/PointLightDataNode.d.ts | 26 + .../tsl/lighting/data/SpotLightDataNode.d.ts | 30 + .../jsdoc/examples/jsm/tsl/math/Bayer.d.ts | 29 + .../examples/jsm/tsl/math/curlNoise.d.ts | 36 + .../examples/jsm/tsl/math/voronoiNoise.d.ts | 50 + .../jsm/tsl/shadows/TileShadowNode.d.ts | 115 + .../jsm/tsl/shadows/TileShadowNodeHelper.d.ts | 29 + .../jsm/tsl/utils/GroundedSkybox.d.ts | 15 + .../jsdoc/examples/jsm/tsl/utils/RNoise.d.ts | 10 + .../examples/jsm/tsl/utils/Raymarching.d.ts | 1 + .../examples/jsm/tsl/utils/SoftParticles.d.ts | 19 + .../jsm/tsl/utils/SpecularHelpers.d.ts | 65 + .../jsm/utils/BufferGeometryUtils.d.ts | 124 + .../jsdoc/examples/jsm/utils/CameraUtils.d.ts | 14 + .../jsdoc/examples/jsm/utils/ColorUtils.d.ts | 20 + .../jsm/utils/GaussianSplatUtils.d.ts | 28 + .../jsm/utils/GeometryCompressionUtils.d.ts | 23 + .../examples/jsm/utils/GeometryUtils.d.ts | 48 + .../jsdoc/examples/jsm/utils/LDrawUtils.d.ts | 17 + .../examples/jsm/utils/SceneOptimizer.d.ts | 72 + .../jsdoc/examples/jsm/utils/SceneUtils.d.ts | 72 + .../examples/jsm/utils/ShadowMapViewer.d.ts | 72 + .../jsm/utils/ShadowMapViewerGPU.d.ts | 71 + .../examples/jsm/utils/SkeletonUtils.d.ts | 97 + .../jsdoc/examples/jsm/utils/SortUtils.d.ts | 1 + .../jsdoc/examples/jsm/utils/UVsDebug.d.ts | 16 + .../examples/jsm/utils/WebGLTextureUtils.d.ts | 14 + .../jsm/utils/WebGPUTextureUtils.d.ts | 15 + .../jsdoc/examples/jsm/utils/WorkerPool.d.ts | 79 + .../jsdoc/examples/jsm/webxr/ARButton.d.ts | 22 + .../examples/jsm/webxr/OculusHandModel.d.ts | 87 + .../jsm/webxr/OculusHandPointerModel.d.ts | 146 + .../jsdoc/examples/jsm/webxr/Text2D.d.ts | 15 + .../jsdoc/examples/jsm/webxr/VRButton.d.ts | 31 + .../examples/jsm/webxr/WebGLXRFallback.d.ts | 8 + .../jsdoc/examples/jsm/webxr/XRButton.d.ts | 26 + .../jsm/webxr/XRControllerModelFactory.d.ts | 96 + .../examples/jsm/webxr/XREstimatedLight.d.ts | 39 + .../examples/jsm/webxr/XRHandMeshModel.d.ts | 44 + .../jsm/webxr/XRHandModelFactory.d.ts | 102 + .../jsm/webxr/XRHandPrimitiveModel.d.ts | 54 + .../jsdoc/examples/jsm/webxr/XRPlanes.d.ts | 22 + jsdoc-testing/jsdoc/src/Three.Core.d.ts | 163 + jsdoc-testing/jsdoc/src/Three.Legacy.d.ts | 1 + .../jsdoc/src/Three.WebGPU.Nodes.d.ts | 30 + jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts | 40 + jsdoc-testing/jsdoc/src/Three.d.ts | 9 + .../jsdoc/src/animation/AnimationAction.d.ts | 311 + .../jsdoc/src/animation/AnimationClip.d.ts | 154 + .../jsdoc/src/animation/AnimationMixer.d.ts | 152 + .../src/animation/AnimationObjectGroup.d.ts | 77 + .../jsdoc/src/animation/AnimationUtils.d.ts | 131 + .../jsdoc/src/animation/KeyframeTrack.d.ts | 178 + .../jsdoc/src/animation/PropertyBinding.d.ts | 144 + .../jsdoc/src/animation/PropertyMixer.d.ts | 95 + .../tracks/BooleanKeyframeTrack.d.ts | 28 + .../animation/tracks/ColorKeyframeTrack.d.ts | 17 + .../animation/tracks/NumberKeyframeTrack.d.ts | 17 + .../tracks/QuaternionKeyframeTrack.d.ts | 18 + .../animation/tracks/StringKeyframeTrack.d.ts | 28 + .../animation/tracks/VectorKeyframeTrack.d.ts | 17 + jsdoc-testing/jsdoc/src/audio/Audio.d.ts | 379 + .../jsdoc/src/audio/AudioAnalyser.d.ts | 65 + .../jsdoc/src/audio/AudioContext.d.ts | 19 + .../jsdoc/src/audio/AudioListener.d.ts | 91 + .../jsdoc/src/audio/PositionalAudio.d.ts | 115 + .../jsdoc/src/cameras/ArrayCamera.d.ts | 42 + jsdoc-testing/jsdoc/src/cameras/Camera.d.ts | 56 + .../jsdoc/src/cameras/CubeCamera.d.ts | 74 + .../jsdoc/src/cameras/OrthographicCamera.d.ts | 122 + .../jsdoc/src/cameras/PerspectiveCamera.d.ts | 216 + .../jsdoc/src/cameras/StereoCamera.d.ts | 61 + jsdoc-testing/jsdoc/src/constants.d.ts | 1617 + .../jsdoc/src/core/BufferAttribute.d.ts | 487 + .../jsdoc/src/core/BufferGeometry.d.ts | 403 + jsdoc-testing/jsdoc/src/core/Clock.d.ts | 73 + .../jsdoc/src/core/EventDispatcher.d.ts | 53 + .../jsdoc/src/core/GLBufferAttribute.d.ts | 122 + .../src/core/InstancedBufferAttribute.d.ts | 36 + .../src/core/InstancedBufferGeometry.d.ts | 22 + .../src/core/InstancedInterleavedBuffer.d.ts | 35 + .../jsdoc/src/core/InterleavedBuffer.d.ts | 153 + .../src/core/InterleavedBufferAttribute.d.ts | 226 + jsdoc-testing/jsdoc/src/core/Layers.d.ts | 68 + jsdoc-testing/jsdoc/src/core/Object3D.d.ts | 606 + jsdoc-testing/jsdoc/src/core/Raycaster.d.ts | 149 + .../jsdoc/src/core/RenderTarget.d.ts | 269 + .../jsdoc/src/core/RenderTarget3D.d.ts | 25 + jsdoc-testing/jsdoc/src/core/Timer.d.ts | 86 + jsdoc-testing/jsdoc/src/core/Uniform.d.ts | 34 + .../jsdoc/src/core/UniformsGroup.d.ts | 87 + jsdoc-testing/jsdoc/src/extras/Controls.d.ts | 93 + jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts | 39 + jsdoc-testing/jsdoc/src/extras/Earcut.d.ts | 18 + .../jsdoc/src/extras/ImageUtils.d.ts | 22 + .../jsdoc/src/extras/PMREMGenerator.d.ts | 520 + .../jsdoc/src/extras/ShapeUtils.d.ts | 29 + .../jsdoc/src/extras/TextureUtils.d.ts | 81 + .../jsdoc/src/extras/core/Curve.d.ts | 170 + .../jsdoc/src/extras/core/CurvePath.d.ts | 56 + .../jsdoc/src/extras/core/Interpolations.d.ts | 39 + jsdoc-testing/jsdoc/src/extras/core/Path.d.ts | 151 + .../jsdoc/src/extras/core/Shape.d.ts | 76 + .../jsdoc/src/extras/core/ShapePath.d.ts | 93 + .../jsdoc/src/extras/curves/ArcCurve.d.ts | 27 + .../src/extras/curves/CatmullRomCurve3.d.ts | 83 + .../src/extras/curves/CubicBezierCurve.d.ts | 78 + .../src/extras/curves/CubicBezierCurve3.d.ts | 61 + .../jsdoc/src/extras/curves/Curves.d.ts | 10 + .../jsdoc/src/extras/curves/EllipseCurve.d.ts | 117 + .../jsdoc/src/extras/curves/LineCurve.d.ts | 50 + .../jsdoc/src/extras/curves/LineCurve3.d.ts | 50 + .../extras/curves/QuadraticBezierCurve.d.ts | 70 + .../extras/curves/QuadraticBezierCurve3.d.ts | 54 + .../jsdoc/src/extras/curves/SplineCurve.d.ts | 59 + .../jsdoc/src/extras/lib/earcut.d.ts | 7 + .../jsdoc/src/geometries/BoxGeometry.d.ts | 46 + .../jsdoc/src/geometries/CapsuleGeometry.d.ts | 43 + .../jsdoc/src/geometries/CircleGeometry.d.ts | 48 + .../jsdoc/src/geometries/ConeGeometry.d.ts | 29 + .../src/geometries/CylinderGeometry.d.ts | 47 + .../src/geometries/DodecahedronGeometry.d.ts | 23 + .../jsdoc/src/geometries/EdgesGeometry.d.ts | 34 + .../jsdoc/src/geometries/ExtrudeGeometry.d.ts | 97 + .../jsdoc/src/geometries/Geometries.d.ts | 21 + .../src/geometries/IcosahedronGeometry.d.ts | 23 + .../jsdoc/src/geometries/LatheGeometry.d.ts | 50 + .../src/geometries/OctahedronGeometry.d.ts | 23 + .../jsdoc/src/geometries/PlaneGeometry.d.ts | 42 + .../src/geometries/PolyhedronGeometry.d.ts | 36 + .../jsdoc/src/geometries/RingGeometry.d.ts | 44 + .../jsdoc/src/geometries/ShapeGeometry.d.ts | 47 + .../jsdoc/src/geometries/SphereGeometry.d.ts | 45 + .../src/geometries/TetrahedronGeometry.d.ts | 23 + .../jsdoc/src/geometries/TorusGeometry.d.ts | 45 + .../src/geometries/TorusKnotGeometry.d.ts | 46 + .../jsdoc/src/geometries/TubeGeometry.d.ts | 60 + .../src/geometries/WireframeGeometry.d.ts | 38 + .../jsdoc/src/helpers/ArrowHelper.d.ts | 70 + .../jsdoc/src/helpers/AxesHelper.d.ts | 30 + .../jsdoc/src/helpers/Box3Helper.d.ts | 30 + .../jsdoc/src/helpers/BoxHelper.d.ts | 39 + .../jsdoc/src/helpers/CameraHelper.d.ts | 59 + .../src/helpers/DirectionalLightHelper.d.ts | 63 + .../jsdoc/src/helpers/GridHelper.d.ts | 27 + .../src/helpers/HemisphereLightHelper.d.ts | 50 + .../jsdoc/src/helpers/PlaneHelper.d.ts | 36 + .../jsdoc/src/helpers/PointLightHelper.d.ts | 47 + .../jsdoc/src/helpers/PolarGridHelper.d.ts | 31 + .../jsdoc/src/helpers/SkeletonHelper.d.ts | 51 + .../jsdoc/src/helpers/SpotLightHelper.d.ts | 49 + .../jsdoc/src/lights/AmbientLight.d.ts | 30 + .../jsdoc/src/lights/DirectionalLight.d.ts | 67 + .../src/lights/DirectionalLightShadow.d.ts | 20 + .../jsdoc/src/lights/HemisphereLight.d.ts | 40 + jsdoc-testing/jsdoc/src/lights/Light.d.ts | 42 + .../jsdoc/src/lights/LightProbe.d.ts | 45 + .../jsdoc/src/lights/LightShadow.d.ts | 215 + .../jsdoc/src/lights/PointLight.d.ts | 70 + .../jsdoc/src/lights/PointLightShadow.d.ts | 20 + .../jsdoc/src/lights/RectAreaLight.d.ts | 68 + jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts | 116 + .../jsdoc/src/lights/SpotLightShadow.d.ts | 37 + jsdoc-testing/jsdoc/src/lights/SunLight.d.ts | 48 + .../jsdoc/src/lights/SunLightShadow.d.ts | 67 + .../jsdoc/src/lights/webgpu/IESSpotLight.d.ts | 18 + .../src/lights/webgpu/ProjectorLight.d.ts | 17 + .../jsdoc/src/loaders/AnimationLoader.d.ts | 32 + .../jsdoc/src/loaders/AudioLoader.d.ts | 30 + .../src/loaders/BufferGeometryLoader.d.ts | 35 + .../src/loaders/CompressedTextureLoader.d.ts | 61 + .../jsdoc/src/loaders/CubeTextureLoader.d.ts | 45 + .../jsdoc/src/loaders/DataTextureLoader.d.ts | 109 + .../jsdoc/src/loaders/FileLoader.d.ts | 68 + .../jsdoc/src/loaders/ImageBitmapLoader.d.ts | 79 + .../jsdoc/src/loaders/ImageLoader.d.ts | 29 + jsdoc-testing/jsdoc/src/loaders/Loader.d.ts | 141 + .../jsdoc/src/loaders/LoaderUtils.d.ts | 22 + .../jsdoc/src/loaders/MaterialLoader.d.ts | 72 + .../jsdoc/src/loaders/ObjectLoader.d.ts | 91 + .../jsdoc/src/loaders/TextureLoader.d.ts | 33 + .../jsdoc/src/loaders/nodes/NodeLoader.d.ts | 84 + .../src/loaders/nodes/NodeMaterialLoader.d.ts | 57 + .../src/loaders/nodes/NodeObjectLoader.d.ts | 96 + .../src/materials/LineBasicMaterial.d.ts | 90 + .../src/materials/LineDashedMaterial.d.ts | 49 + .../jsdoc/src/materials/Material.d.ts | 508 + .../jsdoc/src/materials/Materials.d.ts | 19 + .../src/materials/MeshBasicMaterial.d.ts | 208 + .../src/materials/MeshDepthMaterial.d.ts | 116 + .../src/materials/MeshDistanceMaterial.d.ts | 96 + .../src/materials/MeshLambertMaterial.d.ts | 344 + .../src/materials/MeshMatcapMaterial.d.ts | 204 + .../src/materials/MeshNormalMaterial.d.ts | 135 + .../src/materials/MeshPhongMaterial.d.ts | 359 + .../src/materials/MeshPhysicalMaterial.d.ts | 362 + .../src/materials/MeshStandardMaterial.d.ts | 367 + .../jsdoc/src/materials/MeshToonMaterial.d.ts | 275 + .../jsdoc/src/materials/PointsMaterial.d.ts | 109 + .../src/materials/RawShaderMaterial.d.ts | 111 + .../jsdoc/src/materials/ShaderMaterial.d.ts | 266 + .../jsdoc/src/materials/ShadowMaterial.d.ts | 56 + .../jsdoc/src/materials/SpriteMaterial.d.ts | 96 + .../materials/nodes/Line2NodeMaterial.d.ts | 87 + .../nodes/LineBasicNodeMaterial.d.ts | 23 + .../nodes/LineDashedNodeMaterial.d.ts | 78 + .../nodes/MeshBasicNodeMaterial.d.ts | 39 + .../nodes/MeshLambertNodeMaterial.d.ts | 39 + .../nodes/MeshMatcapNodeMaterial.d.ts | 29 + .../nodes/MeshNormalNodeMaterial.d.ts | 28 + .../nodes/MeshPhongNodeMaterial.d.ts | 63 + .../nodes/MeshPhysicalNodeMaterial.d.ts | 295 + .../materials/nodes/MeshSSSNodeMaterial.d.ts | 84 + .../nodes/MeshStandardNodeMaterial.d.ts | 80 + .../materials/nodes/MeshToonNodeMaterial.d.ts | 30 + .../src/materials/nodes/NodeMaterial.d.ts | 524 + .../src/materials/nodes/NodeMaterials.d.ts | 18 + .../materials/nodes/PointsNodeMaterial.d.ts | 49 + .../materials/nodes/ShadowNodeMaterial.d.ts | 30 + .../materials/nodes/SpriteNodeMaterial.d.ts | 61 + .../materials/nodes/VolumeNodeMaterial.d.ts | 48 + .../nodes/manager/NodeMaterialObserver.d.ts | 147 + jsdoc-testing/jsdoc/src/math/Box2.d.ts | 205 + jsdoc-testing/jsdoc/src/math/Box3.d.ts | 298 + jsdoc-testing/jsdoc/src/math/Color.d.ts | 538 + .../jsdoc/src/math/ColorManagement.d.ts | 21 + jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts | 74 + jsdoc-testing/jsdoc/src/math/Euler.d.ts | 164 + jsdoc-testing/jsdoc/src/math/Frustum.d.ts | 109 + .../jsdoc/src/math/FrustumArray.d.ts | 96 + jsdoc-testing/jsdoc/src/math/Interpolant.d.ts | 114 + jsdoc-testing/jsdoc/src/math/Line3.d.ts | 120 + jsdoc-testing/jsdoc/src/math/MathUtils.d.ts | 224 + jsdoc-testing/jsdoc/src/math/Matrix2.d.ts | 70 + jsdoc-testing/jsdoc/src/math/Matrix3.d.ts | 254 + jsdoc-testing/jsdoc/src/math/Matrix4.d.ts | 411 + jsdoc-testing/jsdoc/src/math/Plane.d.ts | 203 + jsdoc-testing/jsdoc/src/math/Quaternion.d.ts | 310 + jsdoc-testing/jsdoc/src/math/Ray.d.ts | 185 + jsdoc-testing/jsdoc/src/math/Sphere.d.ts | 185 + jsdoc-testing/jsdoc/src/math/Spherical.d.ts | 81 + .../jsdoc/src/math/SphericalHarmonics3.d.ts | 131 + jsdoc-testing/jsdoc/src/math/Triangle.d.ts | 231 + jsdoc-testing/jsdoc/src/math/Vector2.d.ts | 440 + jsdoc-testing/jsdoc/src/math/Vector3.d.ts | 613 + jsdoc-testing/jsdoc/src/math/Vector4.d.ts | 443 + .../math/interpolants/BezierInterpolant.d.ts | 21 + .../math/interpolants/CubicInterpolant.d.ts | 22 + .../interpolants/DiscreteInterpolant.d.ts | 10 + .../math/interpolants/LinearInterpolant.d.ts | 9 + .../QuaternionLinearInterpolant.d.ts | 9 + jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts | 138 + jsdoc-testing/jsdoc/src/nodes/TSL.d.ts | 144 + .../src/nodes/accessors/AccessorsUtils.d.ts | 23 + .../jsdoc/src/nodes/accessors/Arrays.d.ts | 2 + .../jsdoc/src/nodes/accessors/Batch.d.ts | 22 + .../jsdoc/src/nodes/accessors/Bitangent.d.ts | 28 + .../nodes/accessors/BufferAttributeNode.d.ts | 143 + .../jsdoc/src/nodes/accessors/BufferNode.d.ts | 75 + .../src/nodes/accessors/BuiltinNode.d.ts | 40 + .../jsdoc/src/nodes/accessors/Camera.d.ts | 70 + .../src/nodes/accessors/ClippingNode.d.ts | 65 + .../src/nodes/accessors/CubeTextureNode.d.ts | 48 + .../jsdoc/src/nodes/accessors/Instance.d.ts | 24 + .../jsdoc/src/nodes/accessors/Lights.d.ts | 48 + .../src/nodes/accessors/MaterialNode.d.ts | 392 + .../nodes/accessors/MaterialProperties.d.ts | 24 + .../accessors/MaterialReferenceNode.d.ts | 41 + .../jsdoc/src/nodes/accessors/ModelNode.d.ts | 104 + .../accessors/ModelViewProjectionNode.d.ts | 7 + .../jsdoc/src/nodes/accessors/Morph.d.ts | 9 + .../jsdoc/src/nodes/accessors/Normal.d.ts | 100 + .../src/nodes/accessors/Object3DNode.d.ts | 128 + .../src/nodes/accessors/PointUVNode.d.ts | 33 + .../jsdoc/src/nodes/accessors/Position.d.ts | 61 + .../nodes/accessors/ReferenceBaseNode.d.ts | 141 + .../nodes/accessors/ReferenceElementNode.d.ts | 42 + .../src/nodes/accessors/ReferenceNode.d.ts | 157 + .../src/nodes/accessors/ReflectVector.d.ts | 28 + .../accessors/RendererReferenceNode.d.ts | 33 + .../src/nodes/accessors/SceneProperties.d.ts | 21 + .../jsdoc/src/nodes/accessors/Skinning.d.ts | 19 + .../nodes/accessors/StorageBufferNode.d.ts | 183 + .../nodes/accessors/StorageTexture3DNode.d.ts | 36 + .../nodes/accessors/StorageTextureNode.d.ts | 146 + .../jsdoc/src/nodes/accessors/Tangent.d.ts | 28 + .../src/nodes/accessors/TangentUtils.d.ts | 20 + .../src/nodes/accessors/Texture3DNode.d.ts | 54 + .../src/nodes/accessors/TextureBicubic.d.ts | 20 + .../src/nodes/accessors/TextureNode.d.ts | 369 + .../src/nodes/accessors/TextureSizeNode.d.ts | 50 + .../jsdoc/src/nodes/accessors/UV.d.ts | 1 + .../src/nodes/accessors/UniformArrayNode.d.ts | 132 + .../src/nodes/accessors/UserDataNode.d.ts | 35 + .../src/nodes/accessors/VelocityNode.d.ts | 79 + .../src/nodes/accessors/VertexColorNode.d.ts | 31 + .../jsdoc/src/nodes/code/CodeNode.d.ts | 79 + .../jsdoc/src/nodes/code/ExpressionNode.d.ts | 35 + .../src/nodes/code/FunctionCallNode.d.ts | 70 + .../jsdoc/src/nodes/code/FunctionNode.d.ts | 70 + .../jsdoc/src/nodes/core/ArrayNode.d.ts | 76 + .../jsdoc/src/nodes/core/AssignNode.d.ts | 65 + .../jsdoc/src/nodes/core/AttributeNode.d.ts | 41 + .../jsdoc/src/nodes/core/BypassNode.d.ts | 54 + .../jsdoc/src/nodes/core/ConstNode.d.ts | 25 + .../jsdoc/src/nodes/core/ContextNode.d.ts | 107 + .../jsdoc/src/nodes/core/IndexNode.d.ts | 88 + .../jsdoc/src/nodes/core/InputNode.d.ts | 61 + .../jsdoc/src/nodes/core/InspectorNode.d.ts | 57 + .../jsdoc/src/nodes/core/IsolateNode.d.ts | 55 + .../jsdoc/src/nodes/core/LightingModel.d.ts | 59 + .../jsdoc/src/nodes/core/MRTNode.d.ts | 132 + jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts | 438 + .../jsdoc/src/nodes/core/NodeAttribute.d.ts | 44 + .../jsdoc/src/nodes/core/NodeBuilder.d.ts | 1380 + .../jsdoc/src/nodes/core/NodeCache.d.ts | 47 + .../jsdoc/src/nodes/core/NodeCode.d.ts | 36 + .../jsdoc/src/nodes/core/NodeError.d.ts | 13 + .../jsdoc/src/nodes/core/NodeFrame.d.ts | 133 + .../jsdoc/src/nodes/core/NodeFunction.d.ts | 55 + .../src/nodes/core/NodeFunctionInput.d.ts | 52 + .../jsdoc/src/nodes/core/NodeParser.d.ts | 15 + .../jsdoc/src/nodes/core/NodeUniform.d.ts | 62 + .../jsdoc/src/nodes/core/NodeUtils.d.ts | 103 + .../jsdoc/src/nodes/core/NodeVar.d.ts | 50 + .../jsdoc/src/nodes/core/NodeVarying.d.ts | 51 + .../src/nodes/core/OutputStructNode.d.ts | 41 + .../src/nodes/core/OverrideContextNode.d.ts | 67 + .../jsdoc/src/nodes/core/ParameterNode.d.ts | 35 + .../jsdoc/src/nodes/core/PropertyNode.d.ts | 277 + .../jsdoc/src/nodes/core/StackNode.d.ts | 150 + .../jsdoc/src/nodes/core/StackTrace.d.ts | 44 + .../jsdoc/src/nodes/core/StructNode.d.ts | 33 + .../jsdoc/src/nodes/core/StructType.d.ts | 7 + .../jsdoc/src/nodes/core/StructTypeNode.d.ts | 49 + .../jsdoc/src/nodes/core/SubBuildNode.d.ts | 30 + .../jsdoc/src/nodes/core/TempNode.d.ts | 28 + .../src/nodes/core/UniformGroupNode.d.ts | 78 + .../jsdoc/src/nodes/core/UniformNode.d.ts | 73 + .../jsdoc/src/nodes/core/VarNode.d.ts | 88 + .../jsdoc/src/nodes/core/VaryingNode.d.ts | 80 + .../jsdoc/src/nodes/core/constants.d.ts | 30 + .../jsdoc/src/nodes/display/BlendModes.d.ts | 67 + .../jsdoc/src/nodes/display/BumpMapNode.d.ts | 44 + .../src/nodes/display/ColorAdjustment.d.ts | 76 + .../nodes/display/ColorSpaceFunctions.d.ts | 18 + .../src/nodes/display/ColorSpaceNode.d.ts | 50 + .../src/nodes/display/FrontFacingNode.d.ts | 53 + .../src/nodes/display/NormalMapNode.d.ts | 58 + .../jsdoc/src/nodes/display/PassNode.d.ts | 432 + .../display/PremultiplyAlphaFunctions.d.ts | 28 + .../src/nodes/display/RenderOutputNode.d.ts | 79 + .../jsdoc/src/nodes/display/ScreenNode.d.ts | 113 + .../nodes/display/ToneMappingFunctions.d.ts | 68 + .../src/nodes/display/ToneMappingNode.d.ts | 60 + .../nodes/display/ToonOutlinePassNode.d.ts | 71 + .../src/nodes/display/ViewportDepthNode.d.ts | 105 + .../display/ViewportDepthTextureNode.d.ts | 31 + .../display/ViewportSharedTextureNode.d.ts | 37 + .../nodes/display/ViewportTextureNode.d.ts | 89 + jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts | 38 + .../src/nodes/functions/BSDF/BRDF_GGX.d.ts | 2 + .../nodes/functions/BSDF/BRDF_Lambert.d.ts | 2 + .../src/nodes/functions/BSDF/BRDF_Sheen.d.ts | 2 + .../src/nodes/functions/BSDF/DFGLUT.d.ts | 2 + .../jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts | 2 + .../functions/BSDF/D_GGX_Anisotropic.d.ts | 2 + .../nodes/functions/BSDF/EnvironmentBRDF.d.ts | 2 + .../src/nodes/functions/BSDF/F_Schlick.d.ts | 2 + .../jsdoc/src/nodes/functions/BSDF/LTC.d.ts | 3 + .../nodes/functions/BSDF/Schlick_to_F0.d.ts | 2 + .../functions/BSDF/V_GGX_SmithCorrelated.d.ts | 2 + .../V_GGX_SmithCorrelated_Anisotropic.d.ts | 2 + .../nodes/functions/BasicLightingModel.d.ts | 23 + .../nodes/functions/PhongLightingModel.d.ts | 31 + .../functions/PhysicalLightingModel.d.ts | 186 + .../src/nodes/functions/ShadowMaskModel.d.ts | 27 + .../nodes/functions/ToonLightingModel.d.ts | 23 + .../functions/VolumetricLightingModel.d.ts | 25 + .../material/getAlphaHashThreshold.d.ts | 2 + .../material/getGeometryRoughness.d.ts | 2 + .../material/getParallaxCorrectNormal.d.ts | 19 + .../functions/material/getRoughness.d.ts | 2 + .../functions/material/getShIrradianceAt.d.ts | 2 + .../jsdoc/src/nodes/geometry/RangeNode.d.ts | 68 + .../src/nodes/gpgpu/AtomicFunctionNode.d.ts | 78 + .../jsdoc/src/nodes/gpgpu/BarrierNode.d.ts | 24 + .../src/nodes/gpgpu/ComputeBuiltinNode.d.ts | 135 + .../jsdoc/src/nodes/gpgpu/ComputeNode.d.ts | 96 + .../src/nodes/gpgpu/SubgroupFunctionNode.d.ts | 303 + .../src/nodes/gpgpu/WorkgroupInfoNode.d.ts | 119 + .../jsdoc/src/nodes/lighting/AONode.d.ts | 25 + .../src/nodes/lighting/AmbientLightNode.d.ts | 12 + .../src/nodes/lighting/AnalyticLightNode.d.ts | 127 + .../nodes/lighting/BasicEnvironmentNode.d.ts | 26 + .../src/nodes/lighting/BasicLightMapNode.d.ts | 24 + .../nodes/lighting/DirectionalLightNode.d.ts | 13 + .../src/nodes/lighting/EnvironmentNode.d.ts | 33 + .../nodes/lighting/HemisphereLightNode.d.ts | 34 + .../src/nodes/lighting/IESSpotLightNode.d.ts | 16 + .../src/nodes/lighting/IrradianceNode.d.ts | 24 + .../src/nodes/lighting/LightProbeNode.d.ts | 22 + .../jsdoc/src/nodes/lighting/LightUtils.d.ts | 11 + .../nodes/lighting/LightingContextNode.d.ts | 89 + .../src/nodes/lighting/LightingNode.d.ts | 21 + .../jsdoc/src/nodes/lighting/LightsNode.d.ts | 125 + .../src/nodes/lighting/PointLightNode.d.ts | 40 + .../src/nodes/lighting/PointShadowNode.d.ts | 52 + .../nodes/lighting/ProjectorLightNode.d.ts | 17 + .../src/nodes/lighting/RectAreaLightNode.d.ts | 41 + .../src/nodes/lighting/ShadowBaseNode.d.ts | 68 + .../src/nodes/lighting/ShadowFilterNode.d.ts | 36 + .../jsdoc/src/nodes/lighting/ShadowNode.d.ts | 192 + .../src/nodes/lighting/SpotLightNode.d.ts | 52 + .../src/nodes/materialx/MaterialXColor.d.ts | 2 + .../materialx/MaterialXColorTransform.d.ts | 1 + .../src/nodes/materialx/MaterialXCore.d.ts | 2 + .../src/nodes/materialx/MaterialXNodes.d.ts | 50 + .../src/nodes/materialx/MaterialXNoise.d.ts | 74 + .../jsdoc/src/nodes/math/BitcastNode.d.ts | 62 + .../jsdoc/src/nodes/math/BitcountNode.d.ts | 111 + .../jsdoc/src/nodes/math/ConditionalNode.d.ts | 65 + jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts | 9 + .../jsdoc/src/nodes/math/MathNode.d.ts | 703 + .../jsdoc/src/nodes/math/MathUtils.d.ts | 4 + .../jsdoc/src/nodes/math/OperatorNode.d.ts | 312 + .../jsdoc/src/nodes/math/PackFloatNode.d.ts | 91 + .../jsdoc/src/nodes/math/TriNoise3D.d.ts | 11 + .../jsdoc/src/nodes/math/UnpackFloatNode.d.ts | 89 + .../src/nodes/parsers/GLSLNodeFunction.d.ts | 25 + .../src/nodes/parsers/GLSLNodeParser.d.ts | 17 + .../jsdoc/src/nodes/pmrem/PMREMNode.d.ts | 113 + .../jsdoc/src/nodes/pmrem/PMREMUtils.d.ts | 3 + .../jsdoc/src/nodes/procedural/Checker.d.ts | 9 + .../jsdoc/src/nodes/shapes/Shapes.d.ts | 9 + .../jsdoc/src/nodes/tsl/TSLBase.d.ts | 26 + .../jsdoc/src/nodes/tsl/TSLCore.d.ts | 74 + .../src/nodes/utils/ArrayElementNode.d.ts | 53 + .../jsdoc/src/nodes/utils/ConvertNode.d.ts | 41 + .../jsdoc/src/nodes/utils/CubeMapNode.d.ts | 57 + .../jsdoc/src/nodes/utils/DebugNode.d.ts | 12 + .../jsdoc/src/nodes/utils/Discard.d.ts | 2 + .../jsdoc/src/nodes/utils/EquirectUV.d.ts | 29 + .../jsdoc/src/nodes/utils/EventNode.d.ts | 42 + .../jsdoc/src/nodes/utils/FlipNode.d.ts | 46 + .../nodes/utils/FunctionOverloadingNode.d.ts | 60 + .../jsdoc/src/nodes/utils/JoinNode.d.ts | 33 + .../jsdoc/src/nodes/utils/LoopNode.d.ts | 68 + .../jsdoc/src/nodes/utils/MatcapUV.d.ts | 11 + .../src/nodes/utils/MaxMipLevelNode.d.ts | 51 + .../jsdoc/src/nodes/utils/MemberNode.d.ts | 41 + .../jsdoc/src/nodes/utils/Oscillators.d.ts | 4 + .../jsdoc/src/nodes/utils/Packing.d.ts | 5 + .../src/nodes/utils/PostProcessingUtils.d.ts | 75 + .../jsdoc/src/nodes/utils/RTTNode.d.ts | 128 + .../jsdoc/src/nodes/utils/ReflectorNode.d.ts | 237 + .../jsdoc/src/nodes/utils/Remap.d.ts | 30 + .../jsdoc/src/nodes/utils/RotateNode.d.ts | 49 + .../jsdoc/src/nodes/utils/SampleNode.d.ts | 46 + .../jsdoc/src/nodes/utils/SetNode.d.ts | 49 + .../jsdoc/src/nodes/utils/SplitNode.d.ts | 65 + .../jsdoc/src/nodes/utils/SpriteSheetUV.d.ts | 17 + .../jsdoc/src/nodes/utils/SpriteUtils.d.ts | 19 + .../nodes/utils/StorageArrayElementNode.d.ts | 51 + .../jsdoc/src/nodes/utils/Timer.d.ts | 21 + .../src/nodes/utils/TriplanarTextures.d.ts | 21 + .../jsdoc/src/nodes/utils/UVUtils.d.ts | 42 + .../jsdoc/src/nodes/utils/ViewportUtils.d.ts | 13 + .../jsdoc/src/objects/BatchedMesh.d.ts | 362 + jsdoc-testing/jsdoc/src/objects/Bone.d.ts | 26 + .../jsdoc/src/objects/ClippingGroup.d.ts | 50 + jsdoc-testing/jsdoc/src/objects/Group.d.ts | 29 + .../jsdoc/src/objects/InstancedMesh.d.ts | 138 + jsdoc-testing/jsdoc/src/objects/LOD.d.ts | 103 + jsdoc-testing/jsdoc/src/objects/Line.d.ts | 101 + jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts | 25 + .../jsdoc/src/objects/LineSegments.d.ts | 24 + jsdoc-testing/jsdoc/src/objects/Mesh.d.ts | 104 + jsdoc-testing/jsdoc/src/objects/Points.d.ts | 78 + jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts | 126 + .../jsdoc/src/objects/SkinnedMesh.d.ts | 118 + jsdoc-testing/jsdoc/src/objects/Sprite.d.ts | 82 + .../src/renderers/WebGL3DRenderTarget.d.ts | 25 + .../src/renderers/WebGLArrayRenderTarget.d.ts | 25 + .../src/renderers/WebGLCubeRenderTarget.d.ts | 40 + .../src/renderers/WebGLRenderTarget.d.ts | 16 + .../jsdoc/src/renderers/WebGLRenderer.d.ts | 580 + .../jsdoc/src/renderers/common/Animation.d.ts | 92 + .../src/renderers/common/Attributes.d.ts | 52 + .../jsdoc/src/renderers/common/Backend.d.ts | 573 + .../src/renderers/common/Background.d.ts | 40 + .../jsdoc/src/renderers/common/BindGroup.d.ts | 35 + .../jsdoc/src/renderers/common/Binding.d.ts | 49 + .../jsdoc/src/renderers/common/Bindings.d.ts | 126 + .../jsdoc/src/renderers/common/BlendMode.d.ts | 109 + .../jsdoc/src/renderers/common/Buffer.d.ts | 91 + .../src/renderers/common/BufferUtils.d.ts | 28 + .../src/renderers/common/BundleGroup.d.ts | 44 + .../src/renderers/common/CanvasTarget.d.ts | 189 + .../jsdoc/src/renderers/common/ChainMap.d.ts | 48 + .../src/renderers/common/ClippingContext.d.ts | 129 + .../jsdoc/src/renderers/common/Color4.d.ts | 49 + .../src/renderers/common/ComputePipeline.d.ts | 31 + .../jsdoc/src/renderers/common/Constants.d.ts | 7 + .../renderers/common/CubeRenderTarget.d.ts | 42 + .../jsdoc/src/renderers/common/DataMap.d.ts | 41 + .../common/DirectRenderPipeline.d.ts | 66 + .../src/renderers/common/Geometries.d.ts | 103 + .../IndirectStorageBufferAttribute.d.ts | 29 + .../jsdoc/src/renderers/common/Info.d.ts | 211 + .../src/renderers/common/InspectorBase.d.ts | 122 + .../jsdoc/src/renderers/common/Lighting.d.ts | 65 + .../jsdoc/src/renderers/common/Pipeline.d.ts | 28 + .../jsdoc/src/renderers/common/Pipelines.d.ts | 176 + .../src/renderers/common/PostProcessing.d.ts | 17 + .../renderers/common/ProgrammableStage.d.ts | 64 + .../jsdoc/src/renderers/common/QuadMesh.d.ts | 52 + .../src/renderers/common/ReadbackBuffer.d.ts | 55 + .../src/renderers/common/RenderBundle.d.ts | 20 + .../src/renderers/common/RenderBundles.d.ts | 29 + .../src/renderers/common/RenderContext.d.ts | 228 + .../src/renderers/common/RenderContexts.d.ts | 42 + .../src/renderers/common/RenderList.d.ts | 197 + .../src/renderers/common/RenderLists.d.ts | 51 + .../src/renderers/common/RenderObject.d.ts | 425 + .../common/RenderObjectPipeline.d.ts | 30 + .../src/renderers/common/RenderObjects.d.ts | 108 + .../src/renderers/common/RenderPipeline.d.ts | 133 + .../jsdoc/src/renderers/common/Renderer.d.ts | 1491 + .../src/renderers/common/RendererUtils.d.ts | 105 + .../src/renderers/common/SampledTexture.d.ts | 85 + .../jsdoc/src/renderers/common/Sampler.d.ts | 80 + .../renderers/common/Storage3DTexture.d.ts | 59 + .../renderers/common/StorageArrayTexture.d.ts | 38 + .../src/renderers/common/StorageBuffer.d.ts | 38 + .../common/StorageBufferAttribute.d.ts | 35 + .../StorageInstancedBufferAttribute.d.ts | 35 + .../src/renderers/common/StorageTexture.d.ts | 43 + .../jsdoc/src/renderers/common/Textures.d.ts | 116 + .../renderers/common/TimestampQueryPool.d.ts | 119 + .../jsdoc/src/renderers/common/Uniform.d.ts | 260 + .../src/renderers/common/UniformBuffer.d.ts | 18 + .../src/renderers/common/UniformsGroup.d.ts | 147 + .../jsdoc/src/renderers/common/XRManager.d.ts | 602 + .../src/renderers/common/XRRenderTarget.d.ts | 66 + .../common/extras/PMREMGenerator.d.ts | 194 + .../common/nodes/NodeBuilderState.d.ts | 112 + .../renderers/common/nodes/NodeLibrary.d.ts | 99 + .../renderers/common/nodes/NodeManager.d.ts | 296 + .../common/nodes/NodeSampledTexture.d.ts | 72 + .../renderers/common/nodes/NodeSampler.d.ts | 31 + .../common/nodes/NodeStorageBuffer.d.ts | 36 + .../renderers/common/nodes/NodeUniform.d.ts | 230 + .../common/nodes/NodeUniformBuffer.d.ts | 56 + .../common/nodes/NodeUniformsGroup.d.ts | 38 + .../src/renderers/shaders/DFGLUTData.d.ts | 1 + .../src/renderers/shaders/ShaderChunk.d.ts | 252 + .../ShaderChunk/alphahash_fragment.glsl.d.ts | 2 + .../alphahash_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/alphamap_fragment.glsl.d.ts | 2 + .../alphamap_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/alphatest_fragment.glsl.d.ts | 2 + .../alphatest_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/aomap_fragment.glsl.d.ts | 2 + .../ShaderChunk/aomap_pars_fragment.glsl.d.ts | 2 + .../batching_pars_vertex.glsl.d.ts | 2 + .../ShaderChunk/batching_vertex.glsl.d.ts | 2 + .../ShaderChunk/begin_vertex.glsl.d.ts | 2 + .../ShaderChunk/beginnormal_vertex.glsl.d.ts | 2 + .../shaders/ShaderChunk/bsdfs.glsl.d.ts | 2 + .../bumpmap_pars_fragment.glsl.d.ts | 2 + .../clearcoat_normal_fragment_begin.glsl.d.ts | 2 + .../clearcoat_normal_fragment_maps.glsl.d.ts | 2 + .../clearcoat_pars_fragment.glsl.d.ts | 2 + .../clipping_planes_fragment.glsl.d.ts | 2 + .../clipping_planes_pars_fragment.glsl.d.ts | 2 + .../clipping_planes_pars_vertex.glsl.d.ts | 2 + .../clipping_planes_vertex.glsl.d.ts | 2 + .../ShaderChunk/color_fragment.glsl.d.ts | 2 + .../ShaderChunk/color_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/color_pars_vertex.glsl.d.ts | 2 + .../ShaderChunk/color_vertex.glsl.d.ts | 2 + .../ShaderChunk/colorspace_fragment.glsl.d.ts | 2 + .../colorspace_pars_fragment.glsl.d.ts | 2 + .../shaders/ShaderChunk/common.glsl.d.ts | 2 + .../cube_uv_reflection_fragment.glsl.d.ts | 2 + .../ShaderChunk/default_fragment.glsl.d.ts | 2 + .../ShaderChunk/default_vertex.glsl.d.ts | 2 + .../defaultnormal_vertex.glsl.d.ts | 2 + .../displacementmap_pars_vertex.glsl.d.ts | 2 + .../displacementmap_vertex.glsl.d.ts | 2 + .../ShaderChunk/dithering_fragment.glsl.d.ts | 2 + .../dithering_pars_fragment.glsl.d.ts | 2 + .../emissivemap_fragment.glsl.d.ts | 2 + .../emissivemap_pars_fragment.glsl.d.ts | 2 + .../envmap_common_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/envmap_fragment.glsl.d.ts | 2 + .../envmap_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/envmap_pars_vertex.glsl.d.ts | 2 + .../envmap_physical_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/envmap_vertex.glsl.d.ts | 2 + .../ShaderChunk/fog_fragment.glsl.d.ts | 2 + .../ShaderChunk/fog_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/fog_pars_vertex.glsl.d.ts | 2 + .../shaders/ShaderChunk/fog_vertex.glsl.d.ts | 2 + .../gradientmap_pars_fragment.glsl.d.ts | 2 + .../iridescence_fragment.glsl.d.ts | 2 + .../iridescence_pars_fragment.glsl.d.ts | 2 + .../lightmap_pars_fragment.glsl.d.ts | 2 + .../lightprobes_pars_fragment.glsl.d.ts | 2 + .../lights_fragment_begin.glsl.d.ts | 2 + .../ShaderChunk/lights_fragment_end.glsl.d.ts | 2 + .../lights_fragment_maps.glsl.d.ts | 2 + .../lights_lambert_fragment.glsl.d.ts | 2 + .../lights_lambert_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/lights_pars_begin.glsl.d.ts | 2 + .../lights_phong_fragment.glsl.d.ts | 2 + .../lights_phong_pars_fragment.glsl.d.ts | 2 + .../lights_physical_fragment.glsl.d.ts | 2 + .../lights_physical_pars_fragment.glsl.d.ts | 2 + .../lights_toon_fragment.glsl.d.ts | 2 + .../lights_toon_pars_fragment.glsl.d.ts | 2 + .../logdepthbuf_fragment.glsl.d.ts | 2 + .../logdepthbuf_pars_fragment.glsl.d.ts | 2 + .../logdepthbuf_pars_vertex.glsl.d.ts | 2 + .../ShaderChunk/logdepthbuf_vertex.glsl.d.ts | 2 + .../ShaderChunk/map_fragment.glsl.d.ts | 2 + .../ShaderChunk/map_pars_fragment.glsl.d.ts | 2 + .../map_particle_fragment.glsl.d.ts | 2 + .../map_particle_pars_fragment.glsl.d.ts | 2 + .../metalnessmap_fragment.glsl.d.ts | 2 + .../metalnessmap_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/morphcolor_vertex.glsl.d.ts | 2 + .../morphinstance_vertex.glsl.d.ts | 2 + .../ShaderChunk/morphnormal_vertex.glsl.d.ts | 2 + .../morphtarget_pars_vertex.glsl.d.ts | 2 + .../ShaderChunk/morphtarget_vertex.glsl.d.ts | 2 + .../normal_fragment_begin.glsl.d.ts | 2 + .../normal_fragment_maps.glsl.d.ts | 2 + .../normal_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/normal_pars_vertex.glsl.d.ts | 2 + .../ShaderChunk/normal_vertex.glsl.d.ts | 2 + .../normalmap_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/opaque_fragment.glsl.d.ts | 2 + .../shaders/ShaderChunk/packing.glsl.d.ts | 2 + .../premultiplied_alpha_fragment.glsl.d.ts | 2 + .../ShaderChunk/project_vertex.glsl.d.ts | 2 + .../roughnessmap_fragment.glsl.d.ts | 2 + .../roughnessmap_pars_fragment.glsl.d.ts | 2 + .../shadowmap_pars_fragment.glsl.d.ts | 2 + .../shadowmap_pars_vertex.glsl.d.ts | 2 + .../ShaderChunk/shadowmap_vertex.glsl.d.ts | 2 + .../shadowmask_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/skinbase_vertex.glsl.d.ts | 2 + .../skinning_pars_vertex.glsl.d.ts | 2 + .../ShaderChunk/skinning_vertex.glsl.d.ts | 2 + .../ShaderChunk/skinnormal_vertex.glsl.d.ts | 2 + .../specularmap_fragment.glsl.d.ts | 2 + .../specularmap_pars_fragment.glsl.d.ts | 2 + .../tonemapping_fragment.glsl.d.ts | 2 + .../tonemapping_pars_fragment.glsl.d.ts | 2 + .../transmission_fragment.glsl.d.ts | 2 + .../transmission_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/uv_pars_fragment.glsl.d.ts | 2 + .../ShaderChunk/uv_pars_vertex.glsl.d.ts | 2 + .../shaders/ShaderChunk/uv_vertex.glsl.d.ts | 2 + .../ShaderChunk/worldpos_vertex.glsl.d.ts | 2 + .../src/renderers/shaders/ShaderLib.d.ts | 7 + .../shaders/ShaderLib/background.glsl.d.ts | 2 + .../ShaderLib/backgroundCube.glsl.d.ts | 2 + .../shaders/ShaderLib/cube.glsl.d.ts | 2 + .../shaders/ShaderLib/depth.glsl.d.ts | 2 + .../shaders/ShaderLib/distance.glsl.d.ts | 2 + .../shaders/ShaderLib/equirect.glsl.d.ts | 2 + .../shaders/ShaderLib/linedashed.glsl.d.ts | 2 + .../shaders/ShaderLib/meshbasic.glsl.d.ts | 2 + .../shaders/ShaderLib/meshlambert.glsl.d.ts | 2 + .../shaders/ShaderLib/meshmatcap.glsl.d.ts | 2 + .../shaders/ShaderLib/meshnormal.glsl.d.ts | 2 + .../shaders/ShaderLib/meshphong.glsl.d.ts | 2 + .../shaders/ShaderLib/meshphysical.glsl.d.ts | 2 + .../shaders/ShaderLib/meshtoon.glsl.d.ts | 2 + .../shaders/ShaderLib/points.glsl.d.ts | 2 + .../shaders/ShaderLib/shadow.glsl.d.ts | 2 + .../shaders/ShaderLib/sprite.glsl.d.ts | 2 + .../renderers/shaders/ShaderLib/vsm.glsl.d.ts | 2 + .../src/renderers/shaders/UniformsLib.d.ts | 485 + .../src/renderers/shaders/UniformsUtils.d.ts | 29 + .../webgl-fallback/WebGLBackend.d.ts | 657 + .../webgl-fallback/WebGLBufferRenderer.d.ts | 13 + .../webgl-fallback/nodes/GLSLNodeBuilder.d.ts | 402 + .../utils/WebGLAttributeUtils.d.ts | 64 + .../utils/WebGLCapabilities.d.ts | 48 + .../webgl-fallback/utils/WebGLConstants.d.ts | 11 + .../webgl-fallback/utils/WebGLExtensions.d.ts | 56 + .../webgl-fallback/utils/WebGLState.d.ts | 382 + .../utils/WebGLTextureUtils.d.ts | 197 + .../utils/WebGLTimestampQueryPool.d.ts | 58 + .../webgl-fallback/utils/WebGLUtils.d.ts | 51 + .../src/renderers/webgl/WebGLAnimation.d.ts | 6 + .../src/renderers/webgl/WebGLAttributes.d.ts | 5 + .../src/renderers/webgl/WebGLBackground.d.ts | 10 + .../renderers/webgl/WebGLBindingStates.d.ts | 12 + .../renderers/webgl/WebGLBufferRenderer.d.ts | 8 + .../renderers/webgl/WebGLCapabilities.d.ts | 20 + .../renderers/webgl/WebGLEnvironments.d.ts | 4 + .../src/renderers/webgl/WebGLExtensions.d.ts | 5 + .../src/renderers/webgl/WebGLGeometries.d.ts | 5 + .../webgl/WebGLIndexedBufferRenderer.d.ts | 9 + .../jsdoc/src/renderers/webgl/WebGLInfo.d.ts | 17 + .../src/renderers/webgl/WebGLLights.d.ts | 47 + .../src/renderers/webgl/WebGLMaterials.d.ts | 4 + .../renderers/webgl/WebGLMorphtargets.d.ts | 3 + .../src/renderers/webgl/WebGLObjects.d.ts | 4 + .../src/renderers/webgl/WebGLOutput.d.ts | 11 + .../src/renderers/webgl/WebGLPrograms.d.ts | 145 + .../src/renderers/webgl/WebGLProperties.d.ts | 7 + .../src/renderers/webgl/WebGLRenderLists.d.ts | 14 + .../renderers/webgl/WebGLRenderStates.d.ts | 4 + .../src/renderers/webgl/WebGLShader.d.ts | 1 + .../src/renderers/webgl/WebGLShaderCache.d.ts | 11 + .../jsdoc/src/renderers/webgl/WebGLState.d.ts | 39 + .../src/renderers/webgl/WebGLTextures.d.ts | 20 + .../src/renderers/webgl/WebGLUniforms.d.ts | 9 + .../renderers/webgl/WebGLUniformsGroups.d.ts | 5 + .../jsdoc/src/renderers/webgl/WebGLUtils.d.ts | 3 + .../src/renderers/webgpu/WebGPUBackend.d.ts | 637 + .../webgpu/WebGPURenderer.Nodes.d.ts | 25 + .../src/renderers/webgpu/WebGPURenderer.d.ts | 42 + .../descriptors/GPUBindGroupDescriptor.d.ts | 32 + .../descriptors/GPUBufferDescriptor.d.ts | 39 + .../GPUCommandEncoderDescriptor.d.ts | 18 + .../descriptors/GPUComputePassDescriptor.d.ts | 24 + .../GPUComputePipelineDescriptor.d.ts | 32 + .../GPUCopyExternalImageDestInfo.d.ts | 25 + .../GPUCopyExternalImageSourceInfo.d.ts | 36 + .../webgpu/descriptors/GPUExtent3D.d.ts | 35 + .../GPUPipelineLayoutDescriptor.d.ts | 25 + .../descriptors/GPUQuerySetDescriptor.d.ts | 31 + .../GPURenderBundleEncoderDescriptor.d.ts | 52 + .../GPURenderPassColorAttachment.d.ts | 50 + .../GPURenderPassDepthStencilAttachment.d.ts | 71 + .../descriptors/GPURenderPassDescriptor.d.ts | 50 + .../GPURenderPassTimestampWrites.d.ts | 33 + .../GPURenderPipelineDescriptor.d.ts | 90 + .../descriptors/GPUSamplerDescriptor.d.ts | 87 + .../GPUShaderModuleDescriptor.d.ts | 30 + .../descriptors/GPUTexelCopyBufferInfo.d.ts | 39 + .../descriptors/GPUTexelCopyBufferLayout.d.ts | 32 + .../descriptors/GPUTexelCopyTextureInfo.d.ts | 45 + .../descriptors/GPUTextureDescriptor.d.ts | 73 + .../descriptors/GPUTextureViewDescriptor.d.ts | 78 + .../webgpu/nodes/BasicNodeLibrary.d.ts | 11 + .../webgpu/nodes/StandardNodeLibrary.d.ts | 11 + .../webgpu/nodes/WGSLNodeBuilder.d.ts | 648 + .../webgpu/nodes/WGSLNodeFunction.d.ts | 25 + .../webgpu/nodes/WGSLNodeParser.d.ts | 17 + .../webgpu/utils/WebGPUAttributeUtils.d.ts | 78 + .../webgpu/utils/WebGPUBindingUtils.d.ts | 88 + .../webgpu/utils/WebGPUCapabilities.d.ts | 32 + .../webgpu/utils/WebGPUConstants.d.ts | 301 + .../webgpu/utils/WebGPUPipelineUtils.d.ts | 130 + .../webgpu/utils/WebGPUTexturePassUtils.d.ts | 84 + .../webgpu/utils/WebGPUTextureUtils.d.ts | 302 + .../utils/WebGPUTimestampQueryPool.d.ts | 53 + .../renderers/webgpu/utils/WebGPUUtils.d.ts | 112 + .../src/renderers/webxr/WebXRController.d.ts | 96 + .../renderers/webxr/WebXRDepthSensing.d.ts | 55 + .../src/renderers/webxr/WebXRManager.d.ts | 220 + jsdoc-testing/jsdoc/src/scenes/Fog.d.ts | 70 + jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts | 60 + jsdoc-testing/jsdoc/src/scenes/Scene.d.ts | 97 + .../jsdoc/src/textures/CanvasTexture.d.ts | 33 + .../src/textures/CompressedArrayTexture.d.ts | 65 + .../src/textures/CompressedCubeTexture.d.ts | 35 + .../jsdoc/src/textures/CompressedTexture.d.ts | 36 + .../jsdoc/src/textures/CubeDepthTexture.d.ts | 51 + .../jsdoc/src/textures/CubeTexture.d.ts | 49 + .../jsdoc/src/textures/Data3DTexture.d.ts | 41 + .../jsdoc/src/textures/DataArrayTexture.d.ts | 60 + .../jsdoc/src/textures/DataTexture.d.ts | 38 + .../jsdoc/src/textures/DepthTexture.d.ts | 42 + .../jsdoc/src/textures/ExternalTexture.d.ts | 33 + .../src/textures/FramebufferTexture.d.ts | 42 + .../jsdoc/src/textures/HTMLTexture.d.ts | 33 + jsdoc-testing/jsdoc/src/textures/Texture.d.ts | 413 + .../jsdoc/src/textures/TextureSource.d.ts | 92 + .../jsdoc/src/textures/VideoFrameTexture.d.ts | 44 + .../jsdoc/src/textures/VideoTexture.d.ts | 59 + jsdoc-testing/jsdoc/src/utils.d.ts | 185 + 1210 files changed, 149981 insertions(+) create mode 100644 jsdoc-testing/jsdoc/build/three.module.d.ts create mode 100644 jsdoc-testing/jsdoc/build/three.webgpu.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts create mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/Three.Core.d.ts create mode 100644 jsdoc-testing/jsdoc/src/Three.Legacy.d.ts create mode 100644 jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts create mode 100644 jsdoc-testing/jsdoc/src/Three.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts create mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts create mode 100644 jsdoc-testing/jsdoc/src/audio/Audio.d.ts create mode 100644 jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts create mode 100644 jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts create mode 100644 jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts create mode 100644 jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts create mode 100644 jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts create mode 100644 jsdoc-testing/jsdoc/src/cameras/Camera.d.ts create mode 100644 jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts create mode 100644 jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts create mode 100644 jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts create mode 100644 jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts create mode 100644 jsdoc-testing/jsdoc/src/constants.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/Clock.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/Layers.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/Object3D.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/Raycaster.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/Timer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/Uniform.d.ts create mode 100644 jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/Controls.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/Earcut.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/core/Path.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts create mode 100644 jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/Light.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/PointLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/SunLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/Loader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/Material.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/Materials.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts create mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Box2.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Box3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Color.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Euler.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Frustum.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Interpolant.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Line3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/MathUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Matrix2.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Matrix3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Matrix4.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Plane.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Quaternion.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Ray.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Sphere.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Spherical.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Triangle.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Vector2.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Vector3.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/Vector4.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts create mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/TSL.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/Bone.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/Group.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/LOD.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/Line.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/Mesh.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/Points.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/src/objects/Sprite.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts create mode 100644 jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts create mode 100644 jsdoc-testing/jsdoc/src/scenes/Fog.d.ts create mode 100644 jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts create mode 100644 jsdoc-testing/jsdoc/src/scenes/Scene.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/Texture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts create mode 100644 jsdoc-testing/jsdoc/src/utils.d.ts diff --git a/jsdoc-testing/jsdoc/build/three.module.d.ts b/jsdoc-testing/jsdoc/build/three.module.d.ts new file mode 100644 index 000000000..89418a42b --- /dev/null +++ b/jsdoc-testing/jsdoc/build/three.module.d.ts @@ -0,0 +1,1868 @@ +import { ACESFilmicToneMapping } from './three.core.js'; +import { AddEquation } from './three.core.js'; +import { AddOperation } from './three.core.js'; +import { AdditiveBlending } from './three.core.js'; +import { AgXToneMapping } from './three.core.js'; +import { AlphaFormat } from './three.core.js'; +import { AlwaysCompare } from './three.core.js'; +import { AlwaysDepth } from './three.core.js'; +import { ArrayCamera } from './three.core.js'; +import { BackSide } from './three.core.js'; +import { BoxGeometry } from './three.core.js'; +import { BufferAttribute } from './three.core.js'; +import { BufferGeometry } from './three.core.js'; +import { ByteType } from './three.core.js'; +import { CineonToneMapping } from './three.core.js'; +import { ClampToEdgeWrapping } from './three.core.js'; +import { Color } from './three.core.js'; +import { ColorManagement } from './three.core.js'; +import { ConstantAlphaFactor } from './three.core.js'; +import { ConstantColorFactor } from './three.core.js'; +import { CubeCamera } from './three.core.js'; +import { CubeDepthTexture } from './three.core.js'; +import { CubeReflectionMapping } from './three.core.js'; +import { CubeRefractionMapping } from './three.core.js'; +import { CubeTexture } from './three.core.js'; +import { CubeUVReflectionMapping } from './three.core.js'; +import { CullFaceBack } from './three.core.js'; +import { CullFaceFront } from './three.core.js'; +import { CullFaceNone } from './three.core.js'; +import { CustomBlending } from './three.core.js'; +import { CustomToneMapping } from './three.core.js'; +import { Data3DTexture } from './three.core.js'; +import { DataArrayTexture } from './three.core.js'; +import { DataTexture } from './three.core.js'; +import { DepthFormat } from './three.core.js'; +import { DepthStencilFormat } from './three.core.js'; +import { DepthTexture } from './three.core.js'; +import { DoubleSide } from './three.core.js'; +import { DstAlphaFactor } from './three.core.js'; +import { DstColorFactor } from './three.core.js'; +import { EqualCompare } from './three.core.js'; +import { EqualDepth } from './three.core.js'; +import { EquirectangularReflectionMapping } from './three.core.js'; +import { EquirectangularRefractionMapping } from './three.core.js'; +import { EventDispatcher } from './three.core.js'; +import { ExternalTexture } from './three.core.js'; +import { Float32BufferAttribute } from './three.core.js'; +import { FloatType } from './three.core.js'; +import { FrontSide } from './three.core.js'; +import { Frustum } from './three.core.js'; +import { GLSL3 } from './three.core.js'; +import { GreaterCompare } from './three.core.js'; +import { GreaterDepth } from './three.core.js'; +import { GreaterEqualCompare } from './three.core.js'; +import { GreaterEqualDepth } from './three.core.js'; +import { HalfFloatType } from './three.core.js'; +import { IntType } from './three.core.js'; +import { Layers } from './three.core.js'; +import { LessCompare } from './three.core.js'; +import { LessDepth } from './three.core.js'; +import { LessEqualCompare } from './three.core.js'; +import { LessEqualDepth } from './three.core.js'; +import { LinearFilter } from './three.core.js'; +import { LinearMipmapLinearFilter } from './three.core.js'; +import { LinearMipmapNearestFilter } from './three.core.js'; +import { LinearSRGBColorSpace } from './three.core.js'; +import { LinearToneMapping } from './three.core.js'; +import { LinearTransfer } from './three.core.js'; +import { Matrix3 } from './three.core.js'; +import { Matrix4 } from './three.core.js'; +import { MaxEquation } from './three.core.js'; +import { Mesh } from './three.core.js'; +import { MeshBasicMaterial } from './three.core.js'; +import { MeshDepthMaterial } from './three.core.js'; +import { MeshDistanceMaterial } from './three.core.js'; +import { MinEquation } from './three.core.js'; +import { MirroredRepeatWrapping } from './three.core.js'; +import { MixOperation } from './three.core.js'; +import { MultiplyBlending } from './three.core.js'; +import { MultiplyOperation } from './three.core.js'; +import { NearestFilter } from './three.core.js'; +import { NearestMipmapLinearFilter } from './three.core.js'; +import { NearestMipmapNearestFilter } from './three.core.js'; +import { NeutralToneMapping } from './three.core.js'; +import { NeverCompare } from './three.core.js'; +import { NeverDepth } from './three.core.js'; +import { NoBlending } from './three.core.js'; +import { NoColorSpace } from './three.core.js'; +import { NoToneMapping } from './three.core.js'; +import { NormalBlending } from './three.core.js'; +import { NotEqualCompare } from './three.core.js'; +import { NotEqualDepth } from './three.core.js'; +import { ObjectSpaceNormalMap } from './three.core.js'; +import { OneFactor } from './three.core.js'; +import { OneMinusConstantAlphaFactor } from './three.core.js'; +import { OneMinusConstantColorFactor } from './three.core.js'; +import { OneMinusDstAlphaFactor } from './three.core.js'; +import { OneMinusDstColorFactor } from './three.core.js'; +import { OneMinusSrcAlphaFactor } from './three.core.js'; +import { OneMinusSrcColorFactor } from './three.core.js'; +import { OrthographicCamera } from './three.core.js'; +import { PCFShadowMap } from './three.core.js'; +import { PCFSoftShadowMap } from './three.core.js'; +/** + * This class generates a Prefiltered, Mipmapped Radiance Environment Map + * (PMREM) from a cubeMap environment texture. This allows different levels of + * blur to be quickly accessed based on material roughness. It is packed into a + * special CubeUV format that allows us to perform custom interpolation so that + * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap + * chain, it only goes down to the LOD_MIN level (above), and then creates extra + * even more filtered 'mips' at the same LOD_MIN resolution, associated with + * higher roughness levels. In this way we maintain resolution to smoothly + * interpolate diffuse lighting while limiting sampling computation. + * + * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) + * importance sampling based on "Sampling the GGX Distribution of Visible Normals" + * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF + * used in material rendering for physically-based image-based lighting. + */ +export class PMREMGenerator { + /** + * Constructs a new PMREM generator. + * + * @param {WebGLRenderer} renderer - The renderer. + */ + constructor(renderer: WebGLRenderer); + _renderer: WebGLRenderer; + _pingPongRenderTarget: any; + _lodMax: number; + _cubeSize: number; + _sizeLods: any[]; + _lodMeshes: any[]; + _backgroundBox: Mesh | null; + _cubemapMaterial: ShaderMaterial | null; + _equirectMaterial: ShaderMaterial | null; + _blurMaterial: ShaderMaterial | null; + _ggxMaterial: ShaderMaterial | null; + /** + * Generates a PMREM from a supplied Scene, which can be faster than using an + * image if networking bandwidth is low. Optional sigma specifies a blur radius + * in radians to be applied to the scene before PMREM generation. Optional near + * and far planes ensure the scene is rendered in its entirety. + * + * @param {Scene} scene - The scene to be captured. + * @param {number} [sigma=0] - The blur radius in radians. + * @param {number} [near=0.1] - The near plane distance. + * @param {number} [far=100] - The far plane distance. + * @param {Object} [options={}] - The configuration options. + * @param {number} [options.size=256] - The texture size of the PMREM. + * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. + * @return {WebGLRenderTarget} The resulting PMREM. + */ + fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { + size?: number | undefined; + position?: Vector3 | undefined; + }): WebGLRenderTarget; + /** + * Generates a PMREM from an equirectangular texture, which can be either LDR + * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best + * with the 256 x 256 cubemap output. The minimum supported input image size + * is 64 x 32. + * + * @param {Texture} equirectangular - The equirectangular texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ + fromEquirectangular(equirectangular: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; + /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ + fromCubemap(cubemap: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; + /** + * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + */ + compileCubemapShader(): void; + /** + * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + */ + compileEquirectangularShader(): void; + /** + * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, + * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on + * one of them will cause any others to also become unusable. + */ + dispose(): void; + _setSize(cubeSize: any): void; + _dispose(): void; + _cleanup(outputTarget: any): void; + _fromTexture(texture: any, renderTarget: any): any; + _allocateTargets(): WebGLRenderTarget; + _compileMaterial(material: any): void; + _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; + _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; + _applyPMREM(cubeUVRenderTarget: any): void; + /** + * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. + * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the + * GGX BRDF for physically-based rendering. Reads from the previous LOD level and + * applies incremental roughness filtering to avoid over-blurring. + * + * @private + * @param {WebGLRenderTarget} cubeUVRenderTarget + * @param {number} lodIn - Source LOD level to read from + * @param {number} lodOut - Target LOD level to write to + */ + private _applyGGXFilter; + /** + * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples + * the Gaussian along a spiral kernel (Golden Angle), which distributes samples + * isotropically on the sphere (no pole artifacts). + * + * Used for initial scene blur in fromScene() method when sigma > 0. + * + * @private + * @param {WebGLRenderTarget} cubeUVRenderTarget + * @param {number} lodIn + * @param {number} lodOut + * @param {number} sigma + */ + private _blur; + _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; +} +import { PerspectiveCamera } from './three.core.js'; +import { Plane } from './three.core.js'; +import { PlaneGeometry } from './three.core.js'; +import { R11_EAC_Format } from './three.core.js'; +import { RED_GREEN_RGTC2_Format } from './three.core.js'; +import { RED_RGTC1_Format } from './three.core.js'; +import { REVISION } from './three.core.js'; +import { RG11_EAC_Format } from './three.core.js'; +import { RGBAFormat } from './three.core.js'; +import { RGBAIntegerFormat } from './three.core.js'; +import { RGBA_ASTC_10x10_Format } from './three.core.js'; +import { RGBA_ASTC_10x5_Format } from './three.core.js'; +import { RGBA_ASTC_10x6_Format } from './three.core.js'; +import { RGBA_ASTC_10x8_Format } from './three.core.js'; +import { RGBA_ASTC_12x10_Format } from './three.core.js'; +import { RGBA_ASTC_12x12_Format } from './three.core.js'; +import { RGBA_ASTC_4x4_Format } from './three.core.js'; +import { RGBA_ASTC_5x4_Format } from './three.core.js'; +import { RGBA_ASTC_5x5_Format } from './three.core.js'; +import { RGBA_ASTC_6x5_Format } from './three.core.js'; +import { RGBA_ASTC_6x6_Format } from './three.core.js'; +import { RGBA_ASTC_8x5_Format } from './three.core.js'; +import { RGBA_ASTC_8x6_Format } from './three.core.js'; +import { RGBA_ASTC_8x8_Format } from './three.core.js'; +import { RGBA_BPTC_Format } from './three.core.js'; +import { RGBA_ETC2_EAC_Format } from './three.core.js'; +import { RGBA_PVRTC_2BPPV1_Format } from './three.core.js'; +import { RGBA_PVRTC_4BPPV1_Format } from './three.core.js'; +import { RGBA_S3TC_DXT1_Format } from './three.core.js'; +import { RGBA_S3TC_DXT3_Format } from './three.core.js'; +import { RGBA_S3TC_DXT5_Format } from './three.core.js'; +import { RGBFormat } from './three.core.js'; +import { RGB_BPTC_SIGNED_Format } from './three.core.js'; +import { RGB_BPTC_UNSIGNED_Format } from './three.core.js'; +import { RGB_ETC1_Format } from './three.core.js'; +import { RGB_ETC2_Format } from './three.core.js'; +import { RGB_PVRTC_2BPPV1_Format } from './three.core.js'; +import { RGB_PVRTC_4BPPV1_Format } from './three.core.js'; +import { RGB_S3TC_DXT1_Format } from './three.core.js'; +import { RGFormat } from './three.core.js'; +import { RGIntegerFormat } from './three.core.js'; +import { RawShaderMaterial } from './three.core.js'; +import { RedFormat } from './three.core.js'; +import { RedIntegerFormat } from './three.core.js'; +import { ReinhardToneMapping } from './three.core.js'; +import { RepeatWrapping } from './three.core.js'; +import { ReverseSubtractEquation } from './three.core.js'; +import { SIGNED_R11_EAC_Format } from './three.core.js'; +import { SIGNED_RED_GREEN_RGTC2_Format } from './three.core.js'; +import { SIGNED_RED_RGTC1_Format } from './three.core.js'; +import { SIGNED_RG11_EAC_Format } from './three.core.js'; +import { SRGBColorSpace } from './three.core.js'; +import { SRGBTransfer } from './three.core.js'; +export namespace ShaderChunk { + export { alphahash_fragment }; + export { alphahash_pars_fragment }; + export { alphamap_fragment }; + export { alphamap_pars_fragment }; + export { alphatest_fragment }; + export { alphatest_pars_fragment }; + export { aomap_fragment }; + export { aomap_pars_fragment }; + export { batching_pars_vertex }; + export { batching_vertex }; + export { begin_vertex }; + export { beginnormal_vertex }; + export { bsdfs }; + export { iridescence_fragment }; + export { bumpmap_pars_fragment }; + export { clipping_planes_fragment }; + export { clipping_planes_pars_fragment }; + export { clipping_planes_pars_vertex }; + export { clipping_planes_vertex }; + export { color_fragment }; + export { color_pars_fragment }; + export { color_pars_vertex }; + export { color_vertex }; + export { common }; + export { cube_uv_reflection_fragment }; + export { defaultnormal_vertex }; + export { displacementmap_pars_vertex }; + export { displacementmap_vertex }; + export { emissivemap_fragment }; + export { emissivemap_pars_fragment }; + export { colorspace_fragment }; + export { colorspace_pars_fragment }; + export { envmap_fragment }; + export { envmap_common_pars_fragment }; + export { envmap_pars_fragment }; + export { envmap_pars_vertex }; + export { envmap_physical_pars_fragment }; + export { envmap_vertex }; + export { fog_vertex }; + export { fog_pars_vertex }; + export { fog_fragment }; + export { fog_pars_fragment }; + export { gradientmap_pars_fragment }; + export { lightmap_pars_fragment }; + export { lights_lambert_fragment }; + export { lights_lambert_pars_fragment }; + export { lights_pars_begin }; + export { lights_toon_fragment }; + export { lights_toon_pars_fragment }; + export { lights_phong_fragment }; + export { lights_phong_pars_fragment }; + export { lights_physical_fragment }; + export { lights_physical_pars_fragment }; + export { lights_fragment_begin }; + export { lights_fragment_maps }; + export { lights_fragment_end }; + export { lightprobes_pars_fragment }; + export { logdepthbuf_fragment }; + export { logdepthbuf_pars_fragment }; + export { logdepthbuf_pars_vertex }; + export { logdepthbuf_vertex }; + export { map_fragment }; + export { map_pars_fragment }; + export { map_particle_fragment }; + export { map_particle_pars_fragment }; + export { metalnessmap_fragment }; + export { metalnessmap_pars_fragment }; + export { morphinstance_vertex }; + export { morphcolor_vertex }; + export { morphnormal_vertex }; + export { morphtarget_pars_vertex }; + export { morphtarget_vertex }; + export { normal_fragment_begin }; + export { normal_fragment_maps }; + export { normal_pars_fragment }; + export { normal_pars_vertex }; + export { normal_vertex }; + export { normalmap_pars_fragment }; + export { clearcoat_normal_fragment_begin }; + export { clearcoat_normal_fragment_maps }; + export { clearcoat_pars_fragment }; + export { iridescence_pars_fragment }; + export { opaque_fragment }; + export { packing }; + export { premultiplied_alpha_fragment }; + export { project_vertex }; + export { dithering_fragment }; + export { dithering_pars_fragment }; + export { roughnessmap_fragment }; + export { roughnessmap_pars_fragment }; + export { shadowmap_pars_fragment }; + export { shadowmap_pars_vertex }; + export { shadowmap_vertex }; + export { shadowmask_pars_fragment }; + export { skinbase_vertex }; + export { skinning_pars_vertex }; + export { skinning_vertex }; + export { skinnormal_vertex }; + export { specularmap_fragment }; + export { specularmap_pars_fragment }; + export { tonemapping_fragment }; + export { tonemapping_pars_fragment }; + export { transmission_fragment }; + export { transmission_pars_fragment }; + export { uv_pars_fragment }; + export { uv_pars_vertex }; + export { uv_vertex }; + export { worldpos_vertex }; + export { vertex$h as background_vert }; + export { fragment$h as background_frag }; + export { vertex$g as backgroundCube_vert }; + export { fragment$g as backgroundCube_frag }; + export { vertex$f as cube_vert }; + export { fragment$f as cube_frag }; + export { vertex$e as depth_vert }; + export { fragment$e as depth_frag }; + export { vertex$d as distance_vert }; + export { fragment$d as distance_frag }; + export { vertex$c as equirect_vert }; + export { fragment$c as equirect_frag }; + export { vertex$b as linedashed_vert }; + export { fragment$b as linedashed_frag }; + export { vertex$a as meshbasic_vert }; + export { fragment$a as meshbasic_frag }; + export { vertex$9 as meshlambert_vert }; + export { fragment$9 as meshlambert_frag }; + export { vertex$8 as meshmatcap_vert }; + export { fragment$8 as meshmatcap_frag }; + export { vertex$7 as meshnormal_vert }; + export { fragment$7 as meshnormal_frag }; + export { vertex$6 as meshphong_vert }; + export { fragment$6 as meshphong_frag }; + export { vertex$5 as meshphysical_vert }; + export { fragment$5 as meshphysical_frag }; + export { vertex$4 as meshtoon_vert }; + export { fragment$4 as meshtoon_frag }; + export { vertex$3 as points_vert }; + export { fragment$3 as points_frag }; + export { vertex$2 as shadow_vert }; + export { fragment$2 as shadow_frag }; + export { vertex$1 as sprite_vert }; + export { fragment$1 as sprite_frag }; +} +export namespace ShaderLib { + namespace physical { + export let uniforms: Object; + import vertexShader = ShaderChunk.meshphysical_vert; + export { vertexShader }; + import fragmentShader = ShaderChunk.meshphysical_frag; + export { fragmentShader }; + } +} +import { ShaderMaterial } from './three.core.js'; +import { ShortType } from './three.core.js'; +import { SrcAlphaFactor } from './three.core.js'; +import { SrcAlphaSaturateFactor } from './three.core.js'; +import { SrcColorFactor } from './three.core.js'; +import { SubtractEquation } from './three.core.js'; +import { SubtractiveBlending } from './three.core.js'; +import { TangentSpaceNormalMap } from './three.core.js'; +import { Texture } from './three.core.js'; +import { Uint16BufferAttribute } from './three.core.js'; +import { Uint32BufferAttribute } from './three.core.js'; +export namespace UniformsLib { + export namespace common_1 { + namespace diffuse { + let value: Color; + } + namespace opacity { + let value_1: number; + export { value_1 as value }; + } + namespace map { + let value_2: null; + export { value_2 as value }; + } + namespace mapTransform { + let value_3: Matrix3; + export { value_3 as value }; + } + namespace alphaMap { + let value_4: null; + export { value_4 as value }; + } + namespace alphaMapTransform { + let value_5: Matrix3; + export { value_5 as value }; + } + namespace alphaTest { + let value_6: number; + export { value_6 as value }; + } + } + export { common_1 as common }; + export namespace specularmap { + namespace specularMap { + let value_7: null; + export { value_7 as value }; + } + namespace specularMapTransform { + let value_8: Matrix3; + export { value_8 as value }; + } + } + export namespace envmap { + namespace envMap { + let value_9: null; + export { value_9 as value }; + } + namespace envMapRotation { + let value_10: Matrix3; + export { value_10 as value }; + } + namespace reflectivity { + let value_11: number; + export { value_11 as value }; + } + namespace ior { + let value_12: number; + export { value_12 as value }; + } + namespace refractionRatio { + let value_13: number; + export { value_13 as value }; + } + namespace dfgLUT { + let value_14: null; + export { value_14 as value }; + } + } + export namespace aomap { + namespace aoMap { + let value_15: null; + export { value_15 as value }; + } + namespace aoMapIntensity { + let value_16: number; + export { value_16 as value }; + } + namespace aoMapTransform { + let value_17: Matrix3; + export { value_17 as value }; + } + } + export namespace lightmap { + namespace lightMap { + let value_18: null; + export { value_18 as value }; + } + namespace lightMapIntensity { + let value_19: number; + export { value_19 as value }; + } + namespace lightMapTransform { + let value_20: Matrix3; + export { value_20 as value }; + } + } + export namespace bumpmap { + namespace bumpMap { + let value_21: null; + export { value_21 as value }; + } + namespace bumpMapTransform { + let value_22: Matrix3; + export { value_22 as value }; + } + namespace bumpScale { + let value_23: number; + export { value_23 as value }; + } + } + export namespace normalmap { + namespace normalMap { + let value_24: null; + export { value_24 as value }; + } + namespace normalMapTransform { + let value_25: Matrix3; + export { value_25 as value }; + } + namespace normalScale { + let value_26: Vector2; + export { value_26 as value }; + } + } + export namespace displacementmap { + namespace displacementMap { + let value_27: null; + export { value_27 as value }; + } + namespace displacementMapTransform { + let value_28: Matrix3; + export { value_28 as value }; + } + namespace displacementScale { + let value_29: number; + export { value_29 as value }; + } + namespace displacementBias { + let value_30: number; + export { value_30 as value }; + } + } + export namespace emissivemap { + namespace emissiveMap { + let value_31: null; + export { value_31 as value }; + } + namespace emissiveMapTransform { + let value_32: Matrix3; + export { value_32 as value }; + } + } + export namespace metalnessmap { + namespace metalnessMap { + let value_33: null; + export { value_33 as value }; + } + namespace metalnessMapTransform { + let value_34: Matrix3; + export { value_34 as value }; + } + } + export namespace roughnessmap { + namespace roughnessMap { + let value_35: null; + export { value_35 as value }; + } + namespace roughnessMapTransform { + let value_36: Matrix3; + export { value_36 as value }; + } + } + export namespace gradientmap { + namespace gradientMap { + let value_37: null; + export { value_37 as value }; + } + } + export namespace fog { + namespace fogDensity { + let value_38: number; + export { value_38 as value }; + } + namespace fogNear { + let value_39: number; + export { value_39 as value }; + } + namespace fogFar { + let value_40: number; + export { value_40 as value }; + } + namespace fogColor { + let value_41: Color; + export { value_41 as value }; + } + } + export namespace lights { + namespace ambientLightColor { + let value_42: never[]; + export { value_42 as value }; + } + namespace lightProbe { + let value_43: never[]; + export { value_43 as value }; + } + namespace sunLights { + let value_44: never[]; + export { value_44 as value }; + export namespace properties { + let direction: {}; + let color: {}; + } + } + namespace sunLightShadows { + let value_45: never[]; + export { value_45 as value }; + export namespace properties_1 { + let shadowIntensity: number; + let shadowBias: {}; + let shadowNormalBias: {}; + let shadowRadius: {}; + let shadowMapSize: {}; + } + export { properties_1 as properties }; + } + namespace sunShadowMatrix { + let value_46: never[]; + export { value_46 as value }; + } + namespace sunShadowCascade { + let value_47: never[]; + export { value_47 as value }; + } + namespace directionalLights { + let value_48: never[]; + export { value_48 as value }; + export namespace properties_2 { + let direction_1: {}; + export { direction_1 as direction }; + let color_1: {}; + export { color_1 as color }; + } + export { properties_2 as properties }; + } + namespace directionalLightShadows { + let value_49: never[]; + export { value_49 as value }; + export namespace properties_3 { + let shadowIntensity_1: number; + export { shadowIntensity_1 as shadowIntensity }; + let shadowBias_1: {}; + export { shadowBias_1 as shadowBias }; + let shadowNormalBias_1: {}; + export { shadowNormalBias_1 as shadowNormalBias }; + let shadowRadius_1: {}; + export { shadowRadius_1 as shadowRadius }; + let shadowMapSize_1: {}; + export { shadowMapSize_1 as shadowMapSize }; + } + export { properties_3 as properties }; + } + namespace directionalShadowMatrix { + let value_50: never[]; + export { value_50 as value }; + } + namespace spotLights { + let value_51: never[]; + export { value_51 as value }; + export namespace properties_4 { + let color_2: {}; + export { color_2 as color }; + export let position: {}; + let direction_2: {}; + export { direction_2 as direction }; + export let distance: {}; + export let coneCos: {}; + export let penumbraCos: {}; + export let decay: {}; + } + export { properties_4 as properties }; + } + namespace spotLightShadows { + let value_52: never[]; + export { value_52 as value }; + export namespace properties_5 { + let shadowIntensity_2: number; + export { shadowIntensity_2 as shadowIntensity }; + let shadowBias_2: {}; + export { shadowBias_2 as shadowBias }; + let shadowNormalBias_2: {}; + export { shadowNormalBias_2 as shadowNormalBias }; + let shadowRadius_2: {}; + export { shadowRadius_2 as shadowRadius }; + let shadowMapSize_2: {}; + export { shadowMapSize_2 as shadowMapSize }; + } + export { properties_5 as properties }; + } + namespace spotLightMap { + let value_53: never[]; + export { value_53 as value }; + } + namespace spotLightMatrix { + let value_54: never[]; + export { value_54 as value }; + } + namespace pointLights { + let value_55: never[]; + export { value_55 as value }; + export namespace properties_6 { + let color_3: {}; + export { color_3 as color }; + let position_1: {}; + export { position_1 as position }; + let decay_1: {}; + export { decay_1 as decay }; + let distance_1: {}; + export { distance_1 as distance }; + } + export { properties_6 as properties }; + } + namespace pointLightShadows { + let value_56: never[]; + export { value_56 as value }; + export namespace properties_7 { + let shadowIntensity_3: number; + export { shadowIntensity_3 as shadowIntensity }; + let shadowBias_3: {}; + export { shadowBias_3 as shadowBias }; + let shadowNormalBias_3: {}; + export { shadowNormalBias_3 as shadowNormalBias }; + let shadowRadius_3: {}; + export { shadowRadius_3 as shadowRadius }; + let shadowMapSize_3: {}; + export { shadowMapSize_3 as shadowMapSize }; + export let shadowCameraNear: {}; + export let shadowCameraFar: {}; + } + export { properties_7 as properties }; + } + namespace pointShadowMatrix { + let value_57: never[]; + export { value_57 as value }; + } + namespace hemisphereLights { + let value_58: never[]; + export { value_58 as value }; + export namespace properties_8 { + let direction_3: {}; + export { direction_3 as direction }; + export let skyColor: {}; + export let groundColor: {}; + } + export { properties_8 as properties }; + } + namespace rectAreaLights { + let value_59: never[]; + export { value_59 as value }; + export namespace properties_9 { + let color_4: {}; + export { color_4 as color }; + let position_2: {}; + export { position_2 as position }; + export let width: {}; + export let height: {}; + } + export { properties_9 as properties }; + } + namespace ltc_1 { + let value_60: null; + export { value_60 as value }; + } + namespace ltc_2 { + let value_61: null; + export { value_61 as value }; + } + namespace probesSH { + let value_62: null; + export { value_62 as value }; + } + namespace probesMin { + let value_63: Vector3; + export { value_63 as value }; + } + namespace probesMax { + let value_64: Vector3; + export { value_64 as value }; + } + namespace probesResolution { + let value_65: Vector3; + export { value_65 as value }; + } + } + export namespace points { + export namespace diffuse_1 { + let value_66: Color; + export { value_66 as value }; + } + export { diffuse_1 as diffuse }; + export namespace opacity_1 { + let value_67: number; + export { value_67 as value }; + } + export { opacity_1 as opacity }; + export namespace size { + let value_68: number; + export { value_68 as value }; + } + export namespace scale { + let value_69: number; + export { value_69 as value }; + } + export namespace map_1 { + let value_70: null; + export { value_70 as value }; + } + export { map_1 as map }; + export namespace alphaMap_1 { + let value_71: null; + export { value_71 as value }; + } + export { alphaMap_1 as alphaMap }; + export namespace alphaMapTransform_1 { + let value_72: Matrix3; + export { value_72 as value }; + } + export { alphaMapTransform_1 as alphaMapTransform }; + export namespace alphaTest_1 { + let value_73: number; + export { value_73 as value }; + } + export { alphaTest_1 as alphaTest }; + export namespace uvTransform { + let value_74: Matrix3; + export { value_74 as value }; + } + } + export namespace sprite { + export namespace diffuse_2 { + let value_75: Color; + export { value_75 as value }; + } + export { diffuse_2 as diffuse }; + export namespace opacity_2 { + let value_76: number; + export { value_76 as value }; + } + export { opacity_2 as opacity }; + export namespace center { + let value_77: Vector2; + export { value_77 as value }; + } + export namespace rotation { + let value_78: number; + export { value_78 as value }; + } + export namespace map_2 { + let value_79: null; + export { value_79 as value }; + } + export { map_2 as map }; + export namespace mapTransform_1 { + let value_80: Matrix3; + export { value_80 as value }; + } + export { mapTransform_1 as mapTransform }; + export namespace alphaMap_2 { + let value_81: null; + export { value_81 as value }; + } + export { alphaMap_2 as alphaMap }; + export namespace alphaMapTransform_2 { + let value_82: Matrix3; + export { value_82 as value }; + } + export { alphaMapTransform_2 as alphaMapTransform }; + export namespace alphaTest_2 { + let value_83: number; + export { value_83 as value }; + } + export { alphaTest_2 as alphaTest }; + } +} +import { UniformsUtils } from './three.core.js'; +import { UnsignedByteType } from './three.core.js'; +import { UnsignedInt101111Type } from './three.core.js'; +import { UnsignedInt248Type } from './three.core.js'; +import { UnsignedInt5999Type } from './three.core.js'; +import { UnsignedIntType } from './three.core.js'; +import { UnsignedShort4444Type } from './three.core.js'; +import { UnsignedShort5551Type } from './three.core.js'; +import { UnsignedShortType } from './three.core.js'; +import { VSMShadowMap } from './three.core.js'; +import { Vector2 } from './three.core.js'; +import { Vector3 } from './three.core.js'; +import { Vector4 } from './three.core.js'; +import { WebGLCoordinateSystem } from './three.core.js'; +/** + * A cube render target used in context of {@link WebGLRenderer}. + * + * @augments WebGLRenderTarget + */ +export class WebGLCubeRenderTarget extends WebGLRenderTarget { + /** + * Constructs a new cube render target. + * + * @param {number} [size=1] - The size of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(size?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLCubeRenderTarget: boolean; + /** + * Converts the given equirectangular texture to a cube map. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {Texture} texture - The equirectangular texture. + * @return {WebGLCubeRenderTarget} A reference to this cube render target. + */ + fromEquirectangularTexture(renderer: WebGLRenderer, texture: Texture): WebGLCubeRenderTarget; + /** + * Clears this cube render target. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear(renderer: WebGLRenderer, color?: boolean, depth?: boolean, stencil?: boolean): void; +} +import { WebGLRenderTarget } from './three.core.js'; +/** + * This renderer uses WebGL 2 to display scenes. + * + * WebGL 1 is not supported since `r163`. + */ +export class WebGLRenderer { + /** + * Constructs a new WebGL renderer. + * + * @param {WebGLRenderer~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLRenderer: boolean; + /** + * A canvas where the renderer draws its output. This is automatically created by the renderer + * in the constructor (if not provided already); you just need to add it to your page like so: + * ```js + * document.body.appendChild( renderer.domElement ); + * ``` + * + * @type {HTMLCanvasElement|OffscreenCanvas} + */ + domElement: HTMLCanvasElement | OffscreenCanvas; + /** + * A object with debug configuration settings. + * + * - `checkShaderErrors`: If it is `true`, defines whether material shader programs are + * checked for errors during compilation and linkage process. It may be useful to disable + * this check in production for performance gain. It is strongly recommended to keep these + * checks enabled during development. If the shader does not compile and link, it will not + * work and associated material will not render. + * - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that + * can be used for custom error reporting. The callback receives the WebGL context, an instance + * of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader. + * Assigning a custom function disables the default error reporting. + * + * @type {Object} + */ + debug: Object; + /** + * Whether the renderer should automatically clear its output before rendering a frame or not. + * + * @type {boolean} + * @default true + */ + autoClear: boolean; + /** + * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear + * the color buffer or not. + * + * @type {boolean} + * @default true + */ + autoClearColor: boolean; + /** + * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear + * the depth buffer or not. + * + * @type {boolean} + * @default true + */ + autoClearDepth: boolean; + /** + * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear + * the stencil buffer or not. + * + * @type {boolean} + * @default true + */ + autoClearStencil: boolean; + /** + * Whether the renderer should sort objects or not. + * + * Note: Sorting is used to attempt to properly render objects that have some + * degree of transparency. By definition, sorting objects may not work in all + * cases. Depending on the needs of application, it may be necessary to turn + * off sorting and use other methods to deal with transparency rendering e.g. + * manually determining each object's rendering order. + * + * @type {boolean} + * @default true + */ + sortObjects: boolean; + /** + * User-defined clipping planes specified in world space. These planes apply globally. + * Points in space whose dot product with the plane is negative are cut away. + * + * @type {Array} + */ + clippingPlanes: Array; + /** + * Whether the renderer respects object-level clipping planes or not. + * + * @type {boolean} + * @default false + */ + localClippingEnabled: boolean; + /** + * The tone mapping technique of the renderer. + * + * @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)} + * @default NoToneMapping + */ + toneMapping: (number | number | number | number | number | number | number | number); + /** + * Exposure level of tone mapping. + * + * @type {number} + * @default 1 + */ + toneMappingExposure: number; + /** + * The normalized resolution scale for the transmission render target, measured in percentage + * of viewport dimensions. Lowering this value can result in significant performance improvements + * when using {@link MeshPhysicalMaterial#transmission}. + * + * @type {number} + * @default 1 + */ + transmissionResolutionScale: number; + _outputColorSpace: string; + /** + * A reference to the XR manager. + * + * @type {WebXRManager} + */ + xr: WebXRManager; + /** + * Returns the rendering context. + * + * @return {WebGL2RenderingContext} The rendering context. + */ + getContext: () => WebGL2RenderingContext; + /** + * Returns the rendering context attributes. + * + * @return {WebGLContextAttributes} The rendering context attributes. + */ + getContextAttributes: () => WebGLContextAttributes; + /** + * Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension. + */ + forceContextLoss: () => void; + /** + * Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension. + */ + forceContextRestore: () => void; + /** + * Returns the pixel ratio. + * + * @return {number} The pixel ratio. + */ + getPixelRatio: () => number; + /** + * Sets the given pixel ratio and resizes the canvas if necessary. + * + * @param {number} value - The pixel ratio. + */ + setPixelRatio: (value: number) => void; + /** + * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The renderer's size in logical pixels. + */ + getSize: (target: Vector2) => Vector2; + /** + * Resizes the output canvas to (width, height) with device pixel ratio taken + * into account, and also sets the viewport to fit that size, starting in (0, + * 0). Setting `updateStyle` to false prevents any style changes to the output canvas. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. + */ + setSize: (width: number, height: number, updateStyle?: boolean) => void; + /** + * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize: (target: Vector2) => Vector2; + /** + * This method allows to define the drawing buffer size by specifying + * width, height and pixel ratio all at once. The size of the drawing + * buffer is computed with this formula: + * ```js + * size.x = width * pixelRatio; + * size.y = height * pixelRatio; + * ``` + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {number} pixelRatio - The pixel ratio. + */ + setDrawingBufferSize: (width: number, height: number, pixelRatio: number) => void; + /** + * Sets the post-processing effects to be applied after rendering. + * + * @param {Array} effects - An array of post-processing effects. + */ + setEffects: (effects: any[]) => void; + /** + * Returns the current viewport definition. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The current viewport definition. + */ + getCurrentViewport: (target: Vector2) => Vector2; + /** + * Returns the viewport definition. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The viewport definition. + */ + getViewport: (target: Vector4) => Vector4; + /** + * Sets the viewport to render from `(x, y)` to `(x + width, y + height)`. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + * Or alternatively a four-component vector specifying all the parameters of the viewport. + * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + */ + setViewport: (x: number | Vector4, y: number, width: number, height: number) => void; + /** + * Returns the scissor region. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The scissor region. + */ + getScissor: (target: Vector4) => Vector4; + /** + * Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit. + * Or alternatively a four-component vector specifying all the parameters of the scissor region. + * @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit. + * @param {number} width - The width of the scissor region in logical pixel unit. + * @param {number} height - The height of the scissor region in logical pixel unit. + */ + setScissor: (x: number | Vector4, y: number, width: number, height: number) => void; + /** + * Returns `true` if the scissor test is enabled. + * + * @return {boolean} Whether the scissor test is enabled or not. + */ + getScissorTest: () => boolean; + /** + * Enable or disable the scissor test. When this is enabled, only the pixels + * within the defined scissor area will be affected by further renderer + * actions. + * + * @param {boolean} boolean - Whether the scissor test is enabled or not. + */ + setScissorTest: (boolean: boolean) => void; + /** + * Sets a custom opaque sort function for the render lists. Pass `null` + * to use the default `painterSortStable` function. + * + * @param {?Function} method - The opaque sort function. + */ + setOpaqueSort: (method: Function | null) => void; + /** + * Sets a custom transparent sort function for the render lists. Pass `null` + * to use the default `reversePainterSortStable` function. + * + * @param {?Function} method - The opaque sort function. + */ + setTransparentSort: (method: Function | null) => void; + /** + * Returns the clear color. + * + * @param {Color} target - The method writes the result in this target object. + * @return {Color} The clear color. + */ + getClearColor: (target: Color) => Color; + /** + * Sets the clear color and alpha. + * + * @param {Color} color - The clear color. + * @param {number} [alpha=1] - The clear alpha. + */ + setClearColor: (...args: any[]) => void; + /** + * Returns the clear alpha. Ranges within `[0,1]`. + * + * @return {number} The clear alpha. + */ + getClearAlpha: () => number; + /** + * Sets the clear alpha. + * + * @param {number} alpha - The clear alpha. + */ + setClearAlpha: (...args: any[]) => void; + /** + * Tells the renderer to clear its color, depth or stencil drawing buffer(s). + * This method initializes the buffers to the current clear color values. + * + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear: (color?: boolean, depth?: boolean, stencil?: boolean) => void; + /** + * Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`. + */ + clearColor: () => void; + /** + * Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`. + */ + clearDepth: () => void; + /** + * Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`. + */ + clearStencil: () => void; + /** + * Sets a compatibility node builder for rendering node materials with WebGLRenderer. + * This enables using TSL (Three.js Shading Language) node materials to prepare + * for migration to WebGPURenderer. + * + * @param {WebGLNodesHandler} nodesHandler - The node builder instance. + */ + setNodesHandler: (nodesHandler: WebGLNodesHandler) => void; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + */ + dispose: () => void; + renderBufferDirect: (camera: any, scene: any, geometry: any, material: any, object: any, group: any) => void; + /** + * Compiles all materials in the scene with the camera. This is useful to precompile shaders + * before the first rendering. If you want to add a 3D object to an existing scene, use the third + * optional parameter for applying the target scene. + * + * Note that the (target) scene's lighting and environment must be configured before calling this method. + * + * @param {Object3D} scene - The scene or another type of 3D object to precompile. + * @param {Camera} camera - The camera. + * @param {?Scene} [targetScene=null] - The target scene. + * @return {Set} The precompiled materials. + */ + compile: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Set; + /** + * Asynchronous version of {@link WebGLRenderer#compile}. + * + * This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence, + * it is recommended to use this version of `compile()` whenever possible. + * + * @async + * @param {Object3D} scene - The scene or another type of 3D object to precompile. + * @param {Camera} camera - The camera. + * @param {?Scene} [targetScene=null] - The target scene. + * @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation. + */ + compileAsync: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise; + /** + * Applications are advised to always define the animation loop + * with this method and not manually with `requestAnimationFrame()` + * for best compatibility. + * + * @param {?onAnimationCallback} callback - The application's animation loop. + */ + setAnimationLoop: (callback: onAnimationCallback | null) => void; + /** + * Renders the given scene (or other type of 3D object) using the given camera. + * + * The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget} + * or to the canvas as usual. + * + * By default render buffers are cleared before rendering but you can prevent + * this by setting the property `autoClear` to `false`. If you want to prevent + * only certain buffers being cleared you can `autoClearColor`, `autoClearDepth` + * or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}. + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * Returns the active cube face. + * + * @return {number} The active cube face. + */ + getActiveCubeFace: () => number; + /** + * Returns the active mipmap level. + * + * @return {number} The active mipmap level. + */ + getActiveMipmapLevel: () => number; + /** + * Returns the active render target. + * + * @return {?WebGLRenderTarget} The active render target. Returns `null` if no render target + * is currently set. + */ + getRenderTarget: () => WebGLRenderTarget | null; + setRenderTargetTextures: (renderTarget: any, colorTexture: any, depthTexture: any) => void; + setRenderTargetFramebuffer: (renderTarget: any, defaultFramebuffer: any) => void; + /** + * Sets the active rendertarget. + * + * @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given, + * the canvas is set as the active render target instead. + * @param {number} [activeCubeFace=0] - The active cube face when using a cube render target. + * Indicates the z layer to render in to when using 3D or array render targets. + * @param {number} [activeMipmapLevel=0] - The active mipmap level. + */ + setRenderTarget: (renderTarget: WebGLRenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number) => void; + /** + * Reads the pixel data from the given render target into the given buffer. + * + * @param {WebGLRenderTarget} renderTarget - The render target to read from. + * @param {number} x - The `x` coordinate of the copy region's origin. + * @param {number} y - The `y` coordinate of the copy region's origin. + * @param {number} width - The width of the copy region. + * @param {number} height - The height of the copy region. + * @param {TypedArray} buffer - The result buffer. + * @param {number} [activeCubeFaceIndex] - The active cube face index. + * @param {number} [textureIndex=0] - The texture index of an MRT render target. + */ + readRenderTargetPixels: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => void; + /** + * Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}. + * + * It is recommended to use this version of `readRenderTargetPixels()` whenever possible. + * + * @async + * @param {WebGLRenderTarget} renderTarget - The render target to read from. + * @param {number} x - The `x` coordinate of the copy region's origin. + * @param {number} y - The `y` coordinate of the copy region's origin. + * @param {number} width - The width of the copy region. + * @param {number} height - The height of the copy region. + * @param {TypedArray} buffer - The result buffer. + * @param {number} [activeCubeFaceIndex] - The active cube face index. + * @param {number} [textureIndex=0] - The texture index of an MRT render target. + * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. + */ + readRenderTargetPixelsAsync: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => Promise; + /** + * Copies pixels from the current bound framebuffer into the given texture. + * + * @param {FramebufferTexture} texture - The texture. + * @param {?Vector2} [position=null] - The start position of the copy operation. + * @param {number} [level=0] - The mip level. The default represents the base mip. + */ + copyFramebufferToTexture: (texture: FramebufferTexture, position?: Vector2 | null, level?: number) => void; + /** + * Copies data of the given source texture into a destination texture. + * + * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized + * {@link WebGLRenderer#initRenderTarget}. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. + * @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. + * @param {number} [srcLevel=0] - The source mipmap level to copy. + * @param {?number} [dstLevel=0] - The destination mipmap level. + */ + copyTextureToTexture: (srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box2 | Box3) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number | null) => void; + /** + * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data + * can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been + * rendered to. + * + * @param {WebGLRenderTarget} target - The render target. + */ + initRenderTarget: (target: WebGLRenderTarget) => void; + /** + * Initializes the given texture. Useful for preloading a texture rather than waiting until first + * render (which can cause noticeable lags due to decode and GPU upload overhead). + * + * @param {Texture} texture - The texture. + */ + initTexture: (texture: Texture) => void; + /** + * Can be used to reset the internal WebGL state. This method is mostly + * relevant for applications which share a single WebGL context across + * multiple WebGL libraries. + */ + resetState: () => void; + /** + * Defines the coordinate system of the renderer. + * + * In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`. + * + * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem} + * @default WebGLCoordinateSystem + * @readonly + */ + readonly get coordinateSystem(): number | WebGPUCoordinateSystem; + set outputColorSpace(colorSpace: string | string); + /** + * Defines the output color space of the renderer. + * + * @type {SRGBColorSpace|LinearSRGBColorSpace} + * @default SRGBColorSpace + */ + get outputColorSpace(): string | string; +} +export function WebGLUtils(gl: any, extensions: any): { + convert: (p: any, colorSpace?: string) => any; +}; +import { WebXRController } from './three.core.js'; +import { ZeroFactor } from './three.core.js'; +import { createCanvasElement } from './three.core.js'; +import { error } from './three.core.js'; +import { log } from './three.core.js'; +import { warn } from './three.core.js'; +import { warnOnce } from './three.core.js'; +declare var alphahash_fragment: string; +declare var alphahash_pars_fragment: string; +declare var alphamap_fragment: string; +declare var alphamap_pars_fragment: string; +declare var alphatest_fragment: string; +declare var alphatest_pars_fragment: string; +declare var aomap_fragment: string; +declare var aomap_pars_fragment: string; +declare var batching_pars_vertex: string; +declare var batching_vertex: string; +declare var begin_vertex: string; +declare var beginnormal_vertex: string; +declare var bsdfs: string; +declare var iridescence_fragment: string; +declare var bumpmap_pars_fragment: string; +declare var clipping_planes_fragment: string; +declare var clipping_planes_pars_fragment: string; +declare var clipping_planes_pars_vertex: string; +declare var clipping_planes_vertex: string; +declare var color_fragment: string; +declare var color_pars_fragment: string; +declare var color_pars_vertex: string; +declare var color_vertex: string; +declare var common: string; +declare var cube_uv_reflection_fragment: string; +declare var defaultnormal_vertex: string; +declare var displacementmap_pars_vertex: string; +declare var displacementmap_vertex: string; +declare var emissivemap_fragment: string; +declare var emissivemap_pars_fragment: string; +declare var colorspace_fragment: string; +declare var colorspace_pars_fragment: string; +declare var envmap_fragment: string; +declare var envmap_common_pars_fragment: string; +declare var envmap_pars_fragment: string; +declare var envmap_pars_vertex: string; +declare var envmap_physical_pars_fragment: string; +declare var envmap_vertex: string; +declare var fog_vertex: string; +declare var fog_pars_vertex: string; +declare var fog_fragment: string; +declare var fog_pars_fragment: string; +declare var gradientmap_pars_fragment: string; +declare var lightmap_pars_fragment: string; +declare var lights_lambert_fragment: string; +declare var lights_lambert_pars_fragment: string; +declare var lights_pars_begin: string; +declare var lights_toon_fragment: string; +declare var lights_toon_pars_fragment: string; +declare var lights_phong_fragment: string; +declare var lights_phong_pars_fragment: string; +declare var lights_physical_fragment: string; +declare var lights_physical_pars_fragment: string; +declare var lights_fragment_begin: string; +declare var lights_fragment_maps: string; +declare var lights_fragment_end: string; +declare var lightprobes_pars_fragment: string; +declare var logdepthbuf_fragment: string; +declare var logdepthbuf_pars_fragment: string; +declare var logdepthbuf_pars_vertex: string; +declare var logdepthbuf_vertex: string; +declare var map_fragment: string; +declare var map_pars_fragment: string; +declare var map_particle_fragment: string; +declare var map_particle_pars_fragment: string; +declare var metalnessmap_fragment: string; +declare var metalnessmap_pars_fragment: string; +declare var morphinstance_vertex: string; +declare var morphcolor_vertex: string; +declare var morphnormal_vertex: string; +declare var morphtarget_pars_vertex: string; +declare var morphtarget_vertex: string; +declare var normal_fragment_begin: string; +declare var normal_fragment_maps: string; +declare var normal_pars_fragment: string; +declare var normal_pars_vertex: string; +declare var normal_vertex: string; +declare var normalmap_pars_fragment: string; +declare var clearcoat_normal_fragment_begin: string; +declare var clearcoat_normal_fragment_maps: string; +declare var clearcoat_pars_fragment: string; +declare var iridescence_pars_fragment: string; +declare var opaque_fragment: string; +declare var packing: string; +declare var premultiplied_alpha_fragment: string; +declare var project_vertex: string; +declare var dithering_fragment: string; +declare var dithering_pars_fragment: string; +declare var roughnessmap_fragment: string; +declare var roughnessmap_pars_fragment: string; +declare var shadowmap_pars_fragment: string; +declare var shadowmap_pars_vertex: string; +declare var shadowmap_vertex: string; +declare var shadowmask_pars_fragment: string; +declare var skinbase_vertex: string; +declare var skinning_pars_vertex: string; +declare var skinning_vertex: string; +declare var skinnormal_vertex: string; +declare var specularmap_fragment: string; +declare var specularmap_pars_fragment: string; +declare var tonemapping_fragment: string; +declare var tonemapping_pars_fragment: string; +declare var transmission_fragment: string; +declare var transmission_pars_fragment: string; +declare var uv_pars_fragment: string; +declare var uv_pars_vertex: string; +declare var uv_vertex: string; +declare var worldpos_vertex: string; +declare const vertex$h: "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}"; +declare const fragment$h: "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}"; +declare const vertex$g: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}"; +declare const fragment$g: "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}"; +declare const vertex$f: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}"; +declare const fragment$f: "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}"; +declare const vertex$e: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}"; +declare const fragment$e: "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}"; +declare const vertex$d: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}"; +declare const fragment$d: "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}"; +declare const vertex$c: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}"; +declare const fragment$c: "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}"; +declare const vertex$b: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$b: "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$a: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$a: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$9: "#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$9: "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$8: "#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}"; +declare const fragment$8: "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$7: "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}"; +declare const fragment$7: "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}"; +declare const vertex$6: "#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$6: "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$5: "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}"; +declare const fragment$5: "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n\tuniform float retroreflectivity;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$4: "#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$4: "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$3: "uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$3: "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$2: "#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$2: "uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n\t#include \n}"; +declare const vertex$1: "uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"; +declare const fragment$1: "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"; +/** + * This class represents an abstraction of the WebXR Device API and is + * internally used by {@link WebGLRenderer}. `WebXRManager` also provides a public + * interface that allows users to enable/disable XR and perform XR related + * tasks like for instance retrieving controllers. + * + * @augments EventDispatcher + * @hideconstructor + */ +declare class WebXRManager extends EventDispatcher { + /** + * Constructs a new WebGL renderer. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGL2RenderingContext} gl - The rendering context. + */ + constructor(renderer: WebGLRenderer, gl: WebGL2RenderingContext); + /** + * Whether the manager's XR camera should be automatically updated or not. + * + * @type {boolean} + * @default true + */ + cameraAutoUpdate: boolean; + /** + * This flag notifies the renderer to be ready for XR rendering. Set it to `true` + * if you are going to use XR in your app. + * + * @type {boolean} + * @default false + */ + enabled: boolean; + /** + * Whether XR presentation is active or not. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly isPresenting: boolean; + /** + * Returns a group representing the `target ray` space of the XR controller. + * Use this space for visualizing 3D objects that support the user in pointing + * tasks like UI interaction. + * + * @param {number} index - The index of the controller. + * @return {Group} A group representing the `target ray` space. + */ + getController: (index: number) => Group; + /** + * Returns a group representing the `grip` space of the XR controller. + * Use this space for visualizing 3D objects that support the user in pointing + * tasks like UI interaction. + * + * Note: If you want to show something in the user's hand AND offer a + * pointing ray at the same time, you'll want to attached the handheld object + * to the group returned by `getControllerGrip()` and the ray to the + * group returned by `getController()`. The idea is to have two + * different groups in two different coordinate spaces for the same WebXR + * controller. + * + * @param {number} index - The index of the controller. + * @return {Group} A group representing the `grip` space. + */ + getControllerGrip: (index: number) => Group; + /** + * Returns a group representing the `hand` space of the XR controller. + * Use this space for visualizing 3D objects that support the user in pointing + * tasks like UI interaction. + * + * @param {number} index - The index of the controller. + * @return {Group} A group representing the `hand` space. + */ + getHand: (index: number) => Group; + /** + * Sets the framebuffer scale factor. + * + * This method can not be used during a XR session. + * + * @param {number} value - The framebuffer scale factor. + */ + setFramebufferScaleFactor: (value: number) => void; + /** + * Sets the reference space type. Can be used to configure a spatial relationship with the user's physical + * environment. Depending on how the user moves in 3D space, setting an appropriate reference space can + * improve tracking. Default is `local-floor`. Valid values can be found here + * https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types. + * + * This method can not be used during a XR session. + * + * @param {string} value - The reference space type. + */ + setReferenceSpaceType: (value: string) => void; + /** + * Returns the XR reference space. + * + * @return {XRReferenceSpace} The XR reference space. + */ + getReferenceSpace: () => XRReferenceSpace; + /** + * Sets a custom XR reference space. + * + * @param {XRReferenceSpace} space - The XR reference space. + */ + setReferenceSpace: (space: XRReferenceSpace) => void; + /** + * Returns the current base layer. + * + * This is an `XRProjectionLayer` when the targeted XR device supports the + * WebXR Layers API, or an `XRWebGLLayer` otherwise. + * + * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. + */ + getBaseLayer: () => (XRWebGLLayer | XRProjectionLayer) | null; + /** + * Returns the current XR binding. + * + * Creates a new binding if needed and the browser is + * capable of doing so. + * + * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. + */ + getBinding: () => XRWebGLBinding | null; + /** + * Returns the current XR frame. + * + * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. + */ + getFrame: () => XRFrame | null; + /** + * Returns the current XR session. + * + * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. + */ + getSession: () => XRSession | null; + /** + * After a XR session has been requested usually with one of the `*Button` modules, it + * is injected into the renderer with this method. This method triggers the start of + * the actual XR rendering. + * + * @async + * @param {XRSession} value - The XR session to set. + * @return {Promise} A Promise that resolves when the session has been set. + */ + setSession: (value: XRSession) => Promise; + /** + * Returns the environment blend mode from the current XR session. + * + * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. + */ + getEnvironmentBlendMode: () => "opaque" | "additive" | "alpha-blend" | undefined; + /** + * Returns the current depth texture computed via depth sensing. + * + * See {@link WebXRDepthSensing#getDepthTexture}. + * + * @return {?Texture} The depth texture. + */ + getDepthTexture: () => Texture | null; + /** + * Updates the state of the XR camera. Use this method on app level if you + * set `cameraAutoUpdate` to `false`. The method requires the non-XR + * camera of the scene as a parameter. The passed in camera's transformation + * is automatically adjusted to the position of the XR camera when calling + * this method. + * + * @param {Camera} camera - The camera. + */ + updateCamera: (camera: Camera) => void; + /** + * Returns an instance of {@link ArrayCamera} which represents the XR camera + * of the active XR session. For each view it holds a separate camera object. + * + * The camera's `fov` is currently not used and does not reflect the fov of + * the XR camera. If you need the fov on app level, you have to compute in + * manually from the XR camera's projection matrices. + * + * @return {ArrayCamera} The XR camera. + */ + getCamera: () => ArrayCamera; + /** + * Returns the amount of foveation used by the XR compositor for the projection layer. + * + * @return {number|undefined} The amount of foveation. + */ + getFoveation: () => number | undefined; + /** + * Sets the foveation value. + * + * @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution) + * and `1` means maximum foveation (the edges render at lower resolution). + */ + setFoveation: (value: number) => void; + /** + * Returns `true` if depth sensing is supported. + * + * @return {boolean} Whether depth sensing is supported or not. + */ + hasDepthSensing: () => boolean; + /** + * Returns the depth sensing mesh. + * + * See {@link WebXRDepthSensing#getMesh}. + * + * @return {Mesh} The depth sensing mesh. + */ + getDepthSensingMesh: () => Mesh; + /** + * Retrieves an opaque texture from the view-aligned {@link XRCamera}. + * Only available during the current animation loop. + * + * @param {XRCamera} xrCamera - The camera to query. + * @return {?Texture} An opaque texture representing the current raw camera frame. + */ + getCameraTexture: (xrCamera: XRCamera) => Texture | null; + setAnimationLoop: (callback: any) => void; + dispose: () => void; +} +export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DataTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, ExternalTexture, Float32BufferAttribute, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PerspectiveCamera, Plane, PlaneGeometry, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLRenderTarget, WebXRController, ZeroFactor, createCanvasElement, error, log, warn, warnOnce }; +export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderObjectRefreshType, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SunLight, TOUCH, TetrahedronGeometry, TextureLoader, TextureSource, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from "./three.core.js"; diff --git a/jsdoc-testing/jsdoc/build/three.webgpu.d.ts b/jsdoc-testing/jsdoc/build/three.webgpu.d.ts new file mode 100644 index 000000000..5ffcc04aa --- /dev/null +++ b/jsdoc-testing/jsdoc/build/three.webgpu.d.ts @@ -0,0 +1,24365 @@ +import { ACESFilmicToneMapping } from './three.core.js'; +/** + * A generic class that can be used by nodes which contribute + * ambient occlusion to the scene. E.g. an ambient occlusion map + * node can be used as input for this module. Used in {@link NodeMaterial}. + * + * @augments LightingNode + */ +export class AONode extends LightingNode { + /** + * Constructs a new AO node. + * + * @param {?Node} [aoNode=null] - The ambient occlusion node. + */ + constructor(aoNode?: Node | null); + /** + * The ambient occlusion node. + * + * @type {?Node} + * @default null + */ + aoNode: Node | null; + setup(builder: any): void; +} +import { AddEquation } from './three.core.js'; +import { AddOperation } from './three.core.js'; +import { AdditiveBlending } from './three.core.js'; +import { AgXToneMapping } from './three.core.js'; +import { AlphaFormat } from './three.core.js'; +import { AlwaysCompare } from './three.core.js'; +import { AlwaysDepth } from './three.core.js'; +import { AlwaysStencilFunc } from './three.core.js'; +import { AmbientLight } from './three.core.js'; +/** + * Module for representing ambient lights as nodes. + * + * @augments AnalyticLightNode + */ +export class AmbientLightNode extends AnalyticLightNode { + /** + * Constructs a new ambient light node. + * + * @param {?AmbientLight} [light=null] - The ambient light source. + */ + constructor(light?: AmbientLight | null); + setup({ context }: { + context: any; + }): void; +} +/** + * Base class for analytic light nodes. + * + * @augments LightingNode + */ +export class AnalyticLightNode extends LightingNode { + /** + * Constructs a new analytic light node. + * + * @param {?Light} [light=null] - The light source. + */ + constructor(light?: Light | null); + /** + * The light source. + * + * @type {?Light} + * @default null + */ + light: Light | null; + /** + * The light's color value. + * + * @type {Color} + */ + color: Color; + /** + * The light's color node. Points to `colorNode` of the light source, if set. Otherwise + * it creates a uniform node based on {@link AnalyticLightNode#color}. + * + * @type {Node} + */ + colorNode: Node; + /** + * This property is used to retain a reference to the original value of {@link AnalyticLightNode#colorNode}. + * The final color node is represented by a different node when using shadows. + * + * @type {?Node} + * @default null + */ + baseColorNode: Node | null; + /** + * Represents the light's shadow. + * + * @type {?ShadowNode} + * @default null + */ + shadowNode: ShadowNode | null; + /** + * Represents the light's shadow color. + * + * @type {?Node} + * @default null + */ + shadowColorNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAnalyticLightNode: boolean; + _shadowDisposeListener: (() => void) | undefined; + /** + * Frees internal resources related to shadows. + */ + disposeShadow(): void; + getHash(): any; + /** + * Returns a node representing a direction vector which points from the current + * position in view space to the light's position in view space. + * + * @param {NodeBuilder} builder - The builder object used for setting up the light. + * @return {Node} The light vector node. + */ + getLightVector(builder: NodeBuilder): Node; + /** + * Sets up the direct lighting for the analytic light node. + * + * @abstract + * @param {NodeBuilder} builder - The builder object used for setting up the light. + * @return {Object|undefined} The direct light data (color and direction). + */ + setupDirect(): Object | undefined; + /** + * Sets up the direct rect area lighting for the analytic light node. + * + * @abstract + * @param {NodeBuilder} builder - The builder object used for setting up the light. + * @return {Object|undefined} The direct rect area light data. + */ + setupDirectRectArea(): Object | undefined; + /** + * Setups the shadow node for this light. The method exists so concrete light classes + * can setup different types of shadow nodes. + * + * @return {ShadowNode} The created shadow node. + */ + setupShadowNode(): ShadowNode; + /** + * Setups the shadow for this light. This method is only executed if the light + * cast shadows and the current build object receives shadows. It incorporates + * shadows into the lighting computation. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupShadow(builder: NodeBuilder): void; + /** + * Unlike most other nodes, lighting nodes do not return a output node in {@link Node#setup}. + * The main purpose of lighting nodes is to configure the current {@link LightingModel} and/or + * invocate the respective interface methods. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * The update method is used to update light uniforms per frame. + * Potentially overwritten in concrete light nodes to update light + * specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(): void; +} +import { ArrayCamera } from './three.core.js'; +/** + * Base class for representing element access on an array-like + * node data structures. + * + * @augments Node + */ +export class ArrayElementNode extends Node { + /** + * Constructs an array element node. + * + * @param {Node} node - The array-like node. + * @param {Node} indexNode - The index node that defines the element access. + */ + constructor(node: Node, indexNode: Node); + /** + * The array-like node. + * + * @type {Node} + */ + node: Node; + /** + * The index node that defines the element access. + * + * @type {Node} + */ + indexNode: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayElementNode: boolean; + /** + * This method is overwritten since the node type is inferred from the array-like node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * This method is overwritten since the member type is inferred from the array-like node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The member name. + * @return {string} The member type. + */ + getMemberType(builder: NodeBuilder, name: string): string; + generate(builder: any): string; +} +/** + * ArrayNode represents a collection of nodes, typically created using the {@link array} function. + * ```js + * const colors = array( [ + * vec3( 1, 0, 0 ), + * vec3( 0, 1, 0 ), + * vec3( 0, 0, 1 ) + * ] ); + * + * const redColor = tintColors.element( 0 ); + * ``` + * + * @augments TempNode + */ +export class ArrayNode extends TempNode { + /** + * Constructs a new array node. + * + * @param {?string} nodeType - The data type of the elements. + * @param {number} count - Size of the array. + * @param {?Array} [values=null] - Array default values. + */ + constructor(nodeType: string | null, count: number, values?: Array | null); + /** + * Array size. + * + * @type {number} + */ + count: number; + /** + * Array default values. + * + * @type {?Array} + */ + values: Array | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayNode: boolean; + /** + * Returns the number of elements in the node array. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {number} The number of elements in the node array. + */ + getArrayCount(): number; + /** + * Returns the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The type of the node. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the type of a member variable. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member variable. + * @return {string} The type of the member variable. + */ + getMemberType(builder: NodeBuilder, name: string): string; + /** + * This method builds the output node and returns the resulting array as a shader string. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated shader string. + */ + generate(builder: NodeBuilder): string; +} +/** + * These node represents an assign operation. Meaning a node is assigned + * to another node. + * + * @augments TempNode + */ +export class AssignNode extends TempNode { + /** + * Constructs a new assign node. + * + * @param {Node} targetNode - The target node. + * @param {Node} sourceNode - The source type. + */ + constructor(targetNode: Node, sourceNode: Node); + /** + * The target node. + * + * @type {Node} + */ + targetNode: Node; + /** + * The source node. + * + * @type {Node} + */ + sourceNode: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAssignNode: boolean; + /** + * Whether this node is used more than once in context of other nodes. This method + * is overwritten since it always returns `false` (assigns are unique). + * + * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. Always `false`. + */ + hasDependencies(): boolean; + generateNodeType(builder: any, output: any): string; + /** + * Whether a split is required when assigning source to target. This can happen when the component length of + * target and source data type does not match. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether a split is required when assigning source to target. + */ + needsSplitAssign(builder: NodeBuilder): boolean; + setup(builder: any): void; + generate(builder: any, output: any): any; +} +/** + * `AtomicFunctionNode` represents any function that can operate on atomic variable types + * within a shader. In an atomic function, any modification to an atomic variable will + * occur as an indivisible step with a defined order relative to other modifications. + * Accordingly, even if multiple atomic functions are modifying an atomic variable at once + * atomic operations will not interfere with each other. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +export class AtomicFunctionNode extends Node { + /** + * Constructs a new atomic function node. + * + * @param {string} method - The signature of the atomic function to construct. + * @param {Node} pointerNode - An atomic variable or element of an atomic buffer. + * @param {Node} valueNode - The value that mutates the atomic variable. + */ + constructor(method: string, pointerNode: Node, valueNode: Node); + /** + * The signature of the atomic function to construct. + * + * @type {string} + */ + method: string; + /** + * An atomic variable or element of an atomic buffer. + * + * @type {Node} + */ + pointerNode: Node; + /** + * A value that modifies the atomic variable. + * + * @type {Node} + */ + valueNode: Node; + /** + * Overwrites the default implementation to return the type of + * the pointer node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(builder: NodeBuilder): string; + /** + * Overwritten since the node type is inferred from the input type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any): any; +} +export namespace AtomicFunctionNode { + let ATOMIC_LOAD: string; + let ATOMIC_STORE: string; + let ATOMIC_ADD: string; + let ATOMIC_SUB: string; + let ATOMIC_MAX: string; + let ATOMIC_MIN: string; + let ATOMIC_AND: string; + let ATOMIC_OR: string; + let ATOMIC_XOR: string; +} +/** + * Base class for representing shader attributes as nodes. + * + * @augments Node + */ +export class AttributeNode extends Node { + /** + * Constructs a new attribute node. + * + * @param {string} attributeName - The name of the attribute. + * @param {?string} nodeType - The node type. + */ + constructor(attributeName: string, nodeType?: string | null); + _attributeName: string; + getHash(builder: any): string; + generateNodeType(builder: any): string | null; + /** + * Sets the attribute name to the given value. The method can be + * overwritten in derived classes if the final name must be computed + * analytically. + * + * @param {string} attributeName - The name of the attribute. + * @return {AttributeNode} A reference to this node. + */ + setAttributeName(attributeName: string): AttributeNode; + /** + * Returns the attribute name of this node. The method can be + * overwritten in derived classes if the final name must be computed + * analytically. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The attribute name. + */ + getAttributeName(): string; + generate(builder: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import { BackSide } from './three.core.js'; +/** + * Most of the rendering related logic is implemented in the + * {@link Renderer} module and related management components. + * Sometimes it is required though to execute commands which are + * specific to the current 3D backend (which is WebGPU or WebGL 2). + * This abstract base class defines an interface that encapsulates + * all backend-related logic. Derived classes for each backend must + * implement the interface. + * + * @abstract + */ +export class Backend { + /** + * Constructs a new backend. + * + * @param {Object} parameters - An object holding parameters for the backend. + */ + constructor(parameters?: Object); + /** + * The parameters of the backend. + * + * @type {Object} + */ + parameters: Object; + /** + * This weak map holds backend-specific data of objects + * like textures, attributes or render targets. + * + * @type {WeakMap} + */ + data: WeakMap; + /** + * A reference to the renderer. + * + * @type {?Renderer} + * @default null + */ + renderer: Renderer | null; + /** + * A reference to the canvas element the renderer is drawing to. + * + * @type {?(HTMLCanvasElement|OffscreenCanvas)} + * @default null + */ + domElement: (HTMLCanvasElement | OffscreenCanvas) | null; + /** + * A reference to the timestamp query pool. + * + * @type {{render: ?TimestampQueryPool, compute: ?TimestampQueryPool}} + */ + timestampQueryPool: { + render: TimestampQueryPool | null; + compute: TimestampQueryPool | null; + }; + /** + * Whether to track timestamps with a Timestamp Query API or not. + * + * @type {boolean} + * @default false + */ + trackTimestamp: boolean; + /** + * Initializes the backend so it is ready for usage. Concrete backends + * are supposed to implement their rendering context creation and related + * operations in this method. + * + * @async + * @param {Renderer} renderer - The renderer. + * @return {Promise} A Promise that resolves when the backend has been initialized. + */ + init(renderer: Renderer): Promise; + /** + * The coordinate system of the backend. + * + * @abstract + * @type {number} + * @readonly + */ + readonly get coordinateSystem(): number; + /** + * This method is executed at the beginning of a render call and + * can be used by the backend to prepare the state for upcoming + * draw calls. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + beginRender(): void; + /** + * This method is executed at the end of a render call and + * can be used by the backend to finalize work after draw + * calls. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + finishRender(): void; + /** + * Sets the XR rendering destination. + * + * Backends that render directly into XR framebuffers can override this hook. + * + * @param {?Object} xrTarget - The XR rendering destination. + */ + setXRTarget(): void; + /** + * This method is executed at the beginning of a compute call and + * can be used by the backend to prepare the state for upcoming + * compute tasks. + * + * @abstract + * @param {Node|Array} computeGroup - The compute node(s). + */ + beginCompute(): void; + /** + * This method is executed at the end of a compute call and + * can be used by the backend to finalize work after compute + * tasks. + * + * @abstract + * @param {Node|Array} computeGroup - The compute node(s). + */ + finishCompute(): void; + /** + * Executes a draw command for the given render object. + * + * @abstract + * @param {RenderObject} renderObject - The render object to draw. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + */ + draw(): void; + /** + * Executes a compute command for the given compute node. + * + * @abstract + * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. + * @param {Node} computeNode - The compute node. + * @param {Array} bindings - The bindings. + * @param {ComputePipeline} computePipeline - The compute pipeline. + */ + compute(): void; + /** + * Creates a shader program from the given programmable stage. + * + * @abstract + * @param {ProgrammableStage} program - The programmable stage. + */ + createProgram(): void; + /** + * Destroys the shader program of the given programmable stage. + * + * @abstract + * @param {ProgrammableStage} program - The programmable stage. + */ + destroyProgram(): void; + /** + * Creates bindings from the given bind group definition. + * + * @abstract + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(): void; + /** + * Updates the given bind group definition. + * + * @abstract + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + updateBindings(): void; + /** + * Updates a buffer binding. + * + * @abstract + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(): void; + /** + * Creates a render pipeline for the given render object. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(): void; + /** + * Creates a compute pipeline for the given compute node. + * + * @abstract + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(): void; + /** + * Returns `true` if the render pipeline requires an update. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether the render pipeline requires an update or not. + */ + needsRenderUpdate(): boolean; + /** + * Returns a cache key that is used to identify render pipelines. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @return {string} The cache key. + */ + getRenderCacheKey(): string; + /** + * Returns a node builder for the given render object. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @param {Renderer} renderer - The renderer. + * @return {NodeBuilder} The node builder. + */ + createNodeBuilder(): NodeBuilder; + /** + * Updates a GPU sampler for the given texture. + * + * @abstract + * @param {Sampler} binding - The sampler binding to update. + * @return {string} The current sampler key. + */ + updateSampler(): string; + /** + * Frees the GPU sampler for the given sampler binding. + * + * @abstract + * @param {Sampler} binding - The sampler binding to free. + */ + destroySampler(): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @abstract + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(): void; + /** + * Uploads the updated texture data to the GPU. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(): void; + /** + * Generates mipmaps for the given texture. + * + * @abstract + * @param {Texture} texture - The texture. + */ + generateMipmaps(): void; + /** + * Destroys the GPU data for the given texture object. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(): void; + /** + * Returns texture data as a typed array. + * + * @abstract + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(): Promise; + /** + * Copies data of the given source texture to the given destination texture. + * + * @abstract + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @abstract + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(): void; + /** + * Creates the GPU buffer of a shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createAttribute(): void; + /** + * Creates the GPU buffer of an indexed shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The indexed buffer attribute. + */ + createIndexAttribute(): void; + /** + * Creates the GPU buffer of a storage attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createStorageAttribute(): void; + /** + * Creates a uniform buffer. + * + * @abstract + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + createUniformBuffer(): void; + /** + * Destroys a uniform buffer. + * + * @abstract + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + destroyUniformBuffer(): void; + /** + * Updates the GPU buffer of a shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute to update. + */ + updateAttribute(): void; + /** + * Destroys the GPU buffer of a shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute to destroy. + */ + destroyAttribute(): void; + /** + * Returns the backend's rendering context. + * + * @abstract + * @return {Object} The rendering context. + */ + getContext(): Object; + /** + * Backends can use this method if they have to run + * logic when the renderer gets resized. + * + * @abstract + */ + updateSize(): void; + /** + * Updates the viewport with the values from the given render context. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + updateViewport(): void; + /** + * Updates a unique identifier for the given render context that can be used + * to allocate resources like occlusion queries or timestamp queries. + * + * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. + */ + updateTimeStampUID(abstractRenderContext: RenderContext | ComputeNode): void; + /** + * Returns a unique identifier for the given render context that can be used + * to allocate resources like occlusion queries or timestamp queries. + * + * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. + * @return {string} The unique identifier. + */ + getTimestampUID(abstractRenderContext: RenderContext | ComputeNode): string; + /** + * Returns all timestamp frames for the given type. + * + * @param {string} type - The type of the time stamp. + * @return {Array} The timestamp frames. + */ + getTimestampFrames(type: string): Array; + /** + * Returns the query pool for the given uid. + * + * @param {string} uid - The unique identifier. + * @return {TimestampQueryPool} The query pool. + */ + _getQueryPool(uid: string): TimestampQueryPool; + /** + * Returns the timestamp for the given uid. + * + * @param {string} uid - The unique identifier. + * @return {number} The timestamp. + */ + getTimestamp(uid: string): number; + /** + * Whether the backend supports query timestamps or not. + * + * @type {boolean} + * @readonly + */ + readonly get hasTimestamp(): boolean; + /** + * Returns `true` if a timestamp for the given uid is available. + * + * @param {string} uid - The unique identifier. + * @return {boolean} Whether the timestamp is available or not. + */ + hasTimestampQuery(uid: string): boolean; + /** + * Returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. Backends must implement this method by using + * a Occlusion Query API. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(): boolean; + /** + * Resolves the time stamp for the given render context and type. + * + * @async + * @abstract + * @param {string} [type='render'] - The type of the time stamp. + * @return {Promise} A Promise that resolves with the time stamp. + */ + resolveTimestampsAsync(type?: string): Promise; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. + * + * @async + * @param {StorageBufferAttribute} attribute - The storage buffer attribute. + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(): Promise; + /** + * Checks if the given feature is supported by the backend. + * + * @async + * @abstract + * @param {string} name - The feature's name. + * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. + */ + hasFeatureAsync(): Promise; + /** + * Checks if the given feature is supported by the backend. + * + * @abstract + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(): boolean; + /** + * Returns the drawing buffer size. + * + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize(): Vector2; + /** + * Defines the scissor test. + * + * @abstract + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(): void; + /** + * Resets the backend's internal state. A no-op for backends without a state cache (e.g. WebGPU). + * + * @abstract + */ + resetState(): void; + /** + * Returns the clear color and alpha into a single + * color object. + * + * @return {Color4} The clear color. + */ + getClearColor(): Color4; + /** + * Returns the DOM element. If no DOM element exists, the backend + * creates a new one. + * + * @return {HTMLCanvasElement} The DOM element. + */ + getDomElement(): HTMLCanvasElement; + /** + * Checks if the backend has the given compatibility. + * + * @abstract + * @param {string} name - The compatibility. + * @return {boolean} Whether the backend has the given compatibility or not. + */ + hasCompatibility(): boolean; + /** + * Initializes the render target defined in the given render context. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + initRenderTarget(): void; + /** + * Sets a dictionary for the given object into the + * internal data structure. + * + * @param {Object} object - The object. + * @param {Object} value - The dictionary to set. + */ + set(object: Object, value: Object): void; + /** + * Returns the dictionary for the given object. + * + * @param {Object} object - The object. + * @return {Object} The object's dictionary. + */ + get(object: Object): Object; + /** + * Checks if the given object has a dictionary + * with data defined. + * + * @param {Object} object - The object. + * @return {boolean} Whether a dictionary for the given object as been defined or not. + */ + has(object: Object): boolean; + /** + * Deletes an object from the internal data structure. + * + * @param {Object} object - The object to delete. + */ + delete(object: Object): void; + /** + * Delete GPU data associated with a bind group. + * + * @abstract + * @param {BindGroup} bindGroup - The bind group. + */ + deleteBindGroupData(): void; + /** + * Frees internal resources. + * + * @abstract + */ + dispose(): void; +} +/** + * Represents a GPU control barrier that synchronizes compute operations within a given scope. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +export class BarrierNode extends Node { + /** + * Constructs a new barrier node. + * + * @param {string} scope - The scope defines the behavior of the node. + */ + constructor(scope: string); + scope: string; + isBarrierNode: boolean; + setup(builder: any): void; + generate(builder: any): void; +} +/** + * Represents a basic model for Image-based lighting (IBL). The environment + * is defined via environment maps in the equirectangular or cube map format. + * `BasicEnvironmentNode` is intended for non-PBR materials like {@link MeshBasicNodeMaterial} + * or {@link MeshPhongNodeMaterial}. + * + * @augments LightingNode + */ +export class BasicEnvironmentNode extends LightingNode { + /** + * Constructs a new basic environment node. + * + * @param {Node} [envNode=null] - A node representing the environment. + */ + constructor(envNode?: Node); + /** + * A node representing the environment. + * + * @type {Node} + * @default null + */ + envNode: Node; + setup(builder: any): void; +} +/** + * A specific version of {@link IrradianceNode} that is only relevant + * for {@link MeshBasicNodeMaterial}. Since the material is unlit, it + * requires a special scaling factor for the light map. + * + * @augments LightingNode + */ +export class BasicLightMapNode extends LightingNode { + /** + * Constructs a new basic light map node. + * + * @param {?Node} [lightMapNode=null] - The light map node. + */ + constructor(lightMapNode?: Node | null); + /** + * The light map node. + * + * @type {?Node} + */ + lightMapNode: Node | null; + setup(builder: any): void; +} +/** + * This version of a node library represents a basic version + * just focusing on lights and tone mapping techniques. + * + * @private + * @augments NodeLibrary + */ +export class BasicNodeLibrary extends NodeLibrary { +} +import { BasicShadowMap } from './three.core.js'; +/** + * This node represents an operation that reinterprets the bit representation of a value + * in one type as a value in another type. + * + * @augments TempNode + */ +export class BitcastNode extends TempNode { + /** + * Constructs a new bitcast node. + * + * @param {Node} valueNode - The value to convert. + * @param {string} conversionType - The type to convert to. + * @param {?string} [inputType = null] - The expected input data type of the bitcast operation. + */ + constructor(valueNode: Node, conversionType: string, inputType?: string | null); + /** + * The data to bitcast to a new type. + * + * @type {Node} + */ + valueNode: Node; + /** + * The type the value will be converted to. + * + * @type {string} + */ + conversionType: string; + /** + * The expected input data type of the bitcast operation. + * + * + * @type {string} + * @default null + */ + inputType: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBitcastNode: boolean; + generateNodeType(builder: any): any; + generate(builder: any): string; +} +/** + * This node represents an operation that counts the bits of a piece of shader data. + * + * @augments MathNode + */ +export class BitcountNode extends MathNode { + /** + * Constructs a new math node. + * + * @param {'countTrailingZeros'|'countLeadingZeros'|'countOneBits'} method - The method name. + * @param {Node} aNode - The first input. + */ + constructor(method: "countTrailingZeros" | "countLeadingZeros" | "countOneBits", aNode: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBitcountNode: boolean; + /** + * Casts the input value of the function to an integer if necessary. + * + * @private + * @param {Node|Node} inputNode - The input value. + * @param {Node} outputNode - The output value. + * @param {string} elementType - The type of the input value. + */ + private _resolveElementType; + _returnDataNode(inputType: any): any; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of countTrailingZeros. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} elementType - The type of the input value. + * @returns {Function} - The generated function + */ + private _createTrailingZerosBaseLayout; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of countLeadingZeros. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} elementType - The type of the input value. + * @returns {Function} - The generated function + */ + private _createLeadingZerosBaseLayout; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of countOneBits. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} elementType - The type of the input value. + * @returns {Function} - The generated function + */ + private _createOneBitsBaseLayout; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of the specified bitcount function. + * including considerations for component-wise bitcounts on vector type inputs. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} inputType - The type of the input value. + * @param {number} typeLength - The vec length of the input value. + * @param {Function} baseFn - The base function that operates on an individual component of the vector. + * @returns {Function} - The alias function for the specified bitcount method. + */ + private _createMainLayout; +} +export namespace BitcountNode { + let COUNT_TRAILING_ZEROS: string; + let COUNT_LEADING_ZEROS: string; + let COUNT_ONE_BITS: string; +} +/** + * Represents blending configuration. + * + * This class encapsulates all blending-related properties that control how + * a material's colors are combined with the colors already in the frame buffer. + */ +export class BlendMode { + /** + * Constructs a new blending configuration. + * + * @param {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} [blending=NormalBlending] - The blending mode. + */ + constructor(blending?: (number | number | number | number | number | number | number)); + /** + * Defines the blending type. + * + * It must be set to `CustomBlending` if custom blending properties like + * {@link BlendMode#blendSrc}, {@link BlendMode#blendDst} or {@link BlendMode#blendEquation} + * should have any effect. + * + * @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} + * @default NormalBlending + */ + blending: (number | number | number | number | number | number | number); + /** + * Defines the blending source factor. + * + * This determines how the source (incoming) fragment color is factored before being added + * to the destination (existing) fragment color in the frame buffer. + * + * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default SrcAlphaFactor + */ + blendSrc: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number); + /** + * Defines the blending destination factor. + * + * This determines how the destination (existing) fragment color in the frame buffer + * is factored before being combined with the source (incoming) fragment color. + * + * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default OneMinusSrcAlphaFactor + */ + blendDst: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number); + /** + * Defines the blending equation. + * + * This determines how the source and destination colors are combined. + * + * @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} + * @default AddEquation + */ + blendEquation: (number | number | number | number | number); + /** + * Defines the blending source alpha factor. + * + * When set, this allows separate control of the alpha channel's source blending factor. + * If `null`, {@link BlendMode#blendSrc} is used for the alpha channel as well. + * + * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default null + */ + blendSrcAlpha: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number) | null; + /** + * Defines the blending destination alpha factor. + * + * When set, this allows separate control of the alpha channel's destination blending factor. + * If `null`, {@link BlendMode#blendDst} is used for the alpha channel as well. + * + * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default null + */ + blendDstAlpha: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number) | null; + /** + * Defines the blending equation of the alpha channel. + * + * When set, this allows separate control of the alpha channel's blending equation. + * If `null`, {@link BlendMode#blendEquation} is used for the alpha channel as well. + * + * @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} + * @default null + */ + blendEquationAlpha: (number | number | number | number | number) | null; + /** + * Defines whether to premultiply the alpha (transparency) value. + * + * If `true`, the RGB color of the texture or material is multiplied by its alpha value. + * This is useful for transparent textures/materials where the color data + * should already include the transparency information. + * + * @type {boolean} + * @default false + */ + premultiplyAlpha: boolean; + /** + * Copies the blending properties from the given source to this instance. + * + * @param {BlendMode} source - The blending configuration to copy from. + * @return {BlendMode} A reference to this instance. + */ + copy(source: BlendMode): BlendMode; + /** + * Returns a clone of this blending configuration. + * + * @return {BlendMode} A new Blending instance with the same properties. + */ + clone(): BlendMode; +} +import { BoxGeometry } from './three.core.js'; +import { BufferAttribute } from './three.core.js'; +/** + * In earlier `three.js` versions it was only possible to define attribute data + * on geometry level. With `BufferAttributeNode`, it is also possible to do this + * on the node level. + * ```js + * const geometry = new THREE.PlaneGeometry(); + * const positionAttribute = geometry.getAttribute( 'position' ); + * + * const colors = []; + * for ( let i = 0; i < position.count; i ++ ) { + * colors.push( 1, 0, 0 ); + * } + * + * material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) ); + * ``` + * This new approach is especially interesting when geometry data are generated via + * compute shaders. The below line converts a storage buffer into an attribute node. + * ```js + * material.positionNode = positionBuffer.toAttribute(); + * ``` + * @augments InputNode + */ +export class BufferAttributeNode extends InputNode { + /** + * Constructs a new buffer attribute node. + * + * @param {BufferAttribute|InterleavedBuffer|TypedArray} value - The attribute data. + * @param {?string} [bufferType=null] - The buffer type (e.g. `'vec3'`). + * @param {number} [bufferStride=0] - The buffer stride. + * @param {number} [bufferOffset=0] - The buffer offset. + */ + constructor(value: BufferAttribute | InterleavedBuffer | TypedArray, bufferType?: string | null, bufferStride?: number, bufferOffset?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBufferNode: boolean; + /** + * The buffer type (e.g. `'vec3'`). + * + * @type {?string} + * @default null + */ + bufferType: string | null; + /** + * The buffer stride. + * + * @type {number} + * @default 0 + */ + bufferStride: number; + /** + * The buffer offset. + * + * @type {number} + * @default 0 + */ + bufferOffset: number; + /** + * The usage property. Set this to `THREE.DynamicDrawUsage` via `.setUsage()`, + * if you are planning to update the attribute data per frame. + * + * @type {number} + * @default StaticDrawUsage + */ + usage: number; + /** + * Whether the attribute is instanced or not. + * + * @type {boolean} + * @default false + */ + instanced: boolean; + /** + * A reference to the buffer attribute. + * + * @type {?BufferAttribute} + * @default null + */ + attribute: BufferAttribute | null; + /** + * This method is overwritten since the attribute data might be shared + * and thus the hash should be shared as well. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(builder: NodeBuilder): string; + /** + * This method is overwritten since the node type is inferred from + * the buffer attribute. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Depending on which value was passed to the node, `setup()` behaves + * differently. If no instance of `BufferAttribute` was passed, the method + * creates an internal attribute and configures it respectively. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * Generates the code snippet of the buffer attribute node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder): string; + /** + * Overwrites the default implementation to return a fixed value `'bufferAttribute'`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; + /** + * Sets the `usage` property to the given value. + * + * @param {number} value - The usage to set. + * @return {BufferAttributeNode} A reference to this node. + */ + setUsage(value: number): BufferAttributeNode; + /** + * Sets the `instanced` property to the given value. + * + * @param {boolean} value - The value to set. + * @return {BufferAttributeNode} A reference to this node. + */ + setInstanced(value: boolean): BufferAttributeNode; +} +import { BufferGeometry } from './three.core.js'; +/** + * A special type of uniform node which represents array-like data + * as uniform buffers. The access usually happens via `element()` + * which returns an instance of {@link ArrayElementNode}. For example: + * + * ```js + * const bufferNode = buffer( array, 'mat4', count ); + * const matrixNode = bufferNode.element( index ); // access a matrix from the buffer + * ``` + * In general, it is recommended to use the more managed {@link UniformArrayNode} + * since it handles more input types and automatically cares about buffer paddings. + * + * @augments UniformNode + */ +export class BufferNode extends UniformNode { + /** + * Constructs a new buffer node. + * + * @param {Array} value - Array-like buffer data. + * @param {string} bufferType - The data type of the buffer. + * @param {number} [bufferCount=0] - The count of buffer elements. + */ + constructor(value: Array, bufferType: string, bufferCount?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBufferNode: boolean; + /** + * The data type of the buffer. + * + * @type {string} + */ + bufferType: string; + /** + * The uniform node that holds the value of the reference node. + * + * @type {number} + * @default 0 + */ + bufferCount: number; + /** + * An array of update ranges. + * + * @type {Array<{start: number, count: number}>} + */ + updateRanges: Array<{ + start: number; + count: number; + }>; + /** + * Adds a range of data in the data array to be updated on the GPU. + * + * @param {number} start - Position at which to start update. + * @param {number} count - The number of components to update. + */ + addUpdateRange(start: number, count: number): void; + /** + * Clears the update ranges. + */ + clearUpdateRanges(): void; + /** + * Overwrites the default implementation to return a fixed value `'buffer'`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; +} +/** + * The node allows to set values for built-in shader variables. That is + * required for features like hardware-accelerated vertex clipping. + * + * @augments Node + */ +export class BuiltinNode extends Node { + /** + * Constructs a new builtin node. + * + * @param {string} name - The name of the built-in shader variable. + */ + constructor(name: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBuiltinNode: boolean; + /** + * Generates the code snippet of the builtin node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(): string; +} +/** + * This class can be used for applying bump maps to materials. + * + * ```js + * material.normalNode = bumpMap( texture( bumpTex ) ); + * ``` + * + * @augments TempNode + */ +export class BumpMapNode extends TempNode { + /** + * Constructs a new bump map node. + * + * @param {Node} textureNode - Represents the bump map data. + * @param {?Node} [scaleNode=null] - Controls the intensity of the bump effect. + */ + constructor(textureNode: Node, scaleNode?: Node | null); + /** + * Represents the bump map data. + * + * @type {Node} + */ + textureNode: Node; + /** + * Controls the intensity of the bump effect. + * + * @type {?Node} + * @default null + */ + scaleNode: Node | null; + setup(builder: any): any; +} +/** + * A specialized group which enables applications access to the + * Render Bundle API of WebGPU. The group with all its descendant nodes + * are considered as one render bundle and processed as such by + * the renderer. + * + * Only renderable 3D objects are allowed in a bundle group. Other + * types like lights are not supported and must be added to the scene + * outside of the group. + * + * This module is only fully supported by `WebGPURenderer` with a WebGPU backend. + * With a WebGL backend, the group can technically be rendered but without + * any performance improvements. + * + * @augments Group + */ +export class BundleGroup extends Group { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBundleGroup: boolean; + /** + * The bundle group's version. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly version: number; + /** + * Set this property to `true` when the bundle group has changed. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); +} +/** + * The class generates the code of a given node but returns another node in the output. + * This can be used to call a method or node that does not return a value, i.e. + * type `void` on an input where returning a value is required. Example: + * + * ```js + * material.colorNode = myColor.bypass( runVoidFn() ) + *``` + * + * @augments Node + */ +export class BypassNode extends Node { + /** + * Constructs a new bypass node. + * + * @param {Node} outputNode - The output node. + * @param {Node} callNode - The call node. + */ + constructor(outputNode: Node, callNode: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBypassNode: boolean; + /** + * The output node. + * + * @type {Node} + */ + outputNode: Node; + /** + * The call node. + * + * @type {Node} + */ + callNode: Node; + generateNodeType(builder: any): string; + generate(builder: any): string | Node | null; +} +import { ByteType } from './three.core.js'; +/** + * CanvasTarget is a class that represents the final output destination of the renderer. + * + * @augments EventDispatcher + */ +export class CanvasTarget extends EventDispatcher { + /** + * Constructs a new CanvasTarget. + * + * @param {HTMLCanvasElement|OffscreenCanvas} domElement - The canvas element to render to. + */ + constructor(domElement: HTMLCanvasElement | OffscreenCanvas); + /** + * A reference to the canvas element the renderer is drawing to. + * This value of this property will automatically be created by + * the renderer. + * + * @type {HTMLCanvasElement|OffscreenCanvas} + */ + domElement: HTMLCanvasElement | OffscreenCanvas; + /** + * The renderer's pixel ratio. + * + * @private + * @type {number} + * @default 1 + */ + private _pixelRatio; + /** + * The width of the renderer's default framebuffer in logical pixel unit. + * + * @private + * @type {number} + */ + private _width; + /** + * The height of the renderer's default framebuffer in logical pixel unit. + * + * @private + * @type {number} + */ + private _height; + /** + * The viewport of the renderer in logical pixel unit. + * + * @private + * @type {Vector4} + */ + private _viewport; + /** + * The scissor rectangle of the renderer in logical pixel unit. + * + * @private + * @type {Vector4} + */ + private _scissor; + /** + * Whether the scissor test should be enabled or not. + * + * @private + * @type {boolean} + */ + private _scissorTest; + /** + * The color texture of the default framebuffer. + * + * @type {FramebufferTexture} + */ + colorTexture: FramebufferTexture; + /** + * The depth texture of the default framebuffer. + * + * @type {DepthTexture} + */ + depthTexture: DepthTexture; + /** + * Returns the pixel ratio. + * + * @return {number} The pixel ratio. + */ + getPixelRatio(): number; + /** + * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize(target: Vector2): Vector2; + /** + * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The renderer's size in logical pixels. + */ + getSize(target: Vector2): Vector2; + /** + * Sets the given pixel ratio and resizes the canvas if necessary. + * + * @param {number} [value=1] - The pixel ratio. + */ + setPixelRatio(value?: number): void; + /** + * This method allows to define the drawing buffer size by specifying + * width, height and pixel ratio all at once. The size of the drawing + * buffer is computed with this formula: + * ```js + * size.x = width * pixelRatio; + * size.y = height * pixelRatio; + * ``` + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {number} pixelRatio - The pixel ratio. + */ + setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; + /** + * Sets the size of the renderer. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. + */ + setSize(width: number, height: number, updateStyle?: boolean): void; + /** + * Returns the scissor rectangle. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The scissor rectangle. + */ + getScissor(target: Vector4): Vector4; + /** + * Defines the scissor rectangle. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. + * Instead of passing four arguments, the method also works with a single four-dimensional vector. + * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. + * @param {number} width - The width of the scissor box in logical pixel unit. + * @param {number} height - The height of the scissor box in logical pixel unit. + */ + setScissor(x: number | Vector4, y: number, width: number, height: number): void; + /** + * Returns the scissor test value. + * + * @return {boolean} Whether the scissor test should be enabled or not. + */ + getScissorTest(): boolean; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Returns the viewport definition. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The viewport definition. + */ + getViewport(target: Vector4): Vector4; + /** + * Defines the viewport. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. + * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. + */ + setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; + /** + * Dispatches the resize event. + * + * @private + */ + private _dispatchResize; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires RenderTarget#dispose + */ + dispose(): void; +} +import { CineonToneMapping } from './three.core.js'; +import { ClampToEdgeWrapping } from './three.core.js'; +/** + * In earlier three.js versions, clipping was defined globally + * on the renderer or on material level. This special version of + * `THREE.Group` allows to encode the clipping state into the scene + * graph. Meaning if you create an instance of this group, all + * descendant 3D objects will be affected by the respective clipping + * planes. + * + * Note: `ClippingGroup` can only be used with `WebGPURenderer`. + * + * @augments Group + */ +export class ClippingGroup extends Group { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isClippingGroup: boolean; + /** + * An array with clipping planes. + * + * @type {Array} + */ + clippingPlanes: Array; + /** + * Whether clipping should be enabled or not. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * Whether the intersection of the clipping planes is used to clip objects, rather than their union. + * + * @type {boolean} + * @default false + */ + clipIntersection: boolean; + /** + * Whether shadows should be clipped or not. + * + * @type {boolean} + * @default false + */ + clipShadows: boolean; +} +/** + * This node is used in {@link NodeMaterial} to setup the clipping + * which can happen hardware-accelerated (if supported) and optionally + * use alpha-to-coverage for anti-aliasing clipped edges. + * + * @augments Node + */ +export class ClippingNode extends Node { + /** + * Constructs a new clipping node. + * + * @param {('default'|'hardware'|'alphaToCoverage')} [scope='default'] - The node's scope. Similar to other nodes, + * the selected scope influences the behavior of the node and what type of code is generated. + */ + constructor(scope?: ("default" | "hardware" | "alphaToCoverage")); + /** + * The node's scope. Similar to other nodes, the selected scope influences + * the behavior of the node and what type of code is generated. + * + * @type {('default'|'hardware'|'alphaToCoverage')} + */ + scope: ("default" | "hardware" | "alphaToCoverage"); + /** + * Setups the node depending on the selected scope. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The result node. + */ + setup(builder: NodeBuilder): Node; + hardwareClipping: boolean | undefined; + /** + * Setups alpha to coverage. + * + * @param {Array} intersectionPlanes - The intersection planes. + * @param {Array} unionPlanes - The union planes. + * @return {Node} The result node. + */ + setupAlphaToCoverage(intersectionPlanes: Array, unionPlanes: Array): Node; + /** + * Setups the default clipping. + * + * @param {Array} intersectionPlanes - The intersection planes. + * @param {Array} unionPlanes - The union planes. + * @return {Node} The result node. + */ + setupDefault(intersectionPlanes: Array, unionPlanes: Array): Node; + /** + * Setups hardware clipping. + * + * @param {Array} unionPlanes - The union planes. + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The result node. + */ + setupHardwareClipping(unionPlanes: Array, builder: NodeBuilder): Node; +} +export namespace ClippingNode { + let ALPHA_TO_COVERAGE: string; + let DEFAULT: string; + let HARDWARE: string; +} +/** + * This class represents native code sections. It is the base + * class for modules like {@link FunctionNode} which allows to implement + * functions with native shader languages. + * + * @augments Node + */ +export class CodeNode extends Node { + /** + * Constructs a new code node. + * + * @param {string} [code=''] - The native code. + * @param {Array} [includes=[]] - An array of includes. + * @param {('js'|'wgsl'|'glsl')} [language=''] - The used language. + */ + constructor(code?: string, includes?: Array, language?: ("js" | "wgsl" | "glsl")); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCodeNode: boolean; + /** + * The native code. + * + * @type {string} + * @default '' + */ + code: string; + /** + * An array of includes + * + * @type {Array} + * @default [] + */ + includes: Array; + /** + * The used language. + * + * @type {('js'|'wgsl'|'glsl')} + * @default '' + */ + language: ("js" | "wgsl" | "glsl"); + /** + * Sets the includes of this code node. + * + * @param {Array} includes - The includes to set. + * @return {CodeNode} A reference to this node. + */ + setIncludes(includes: Array): CodeNode; + /** + * Returns the includes of this code node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Array} The includes. + */ + getIncludes(): Array; + generate(builder: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import { Color } from './three.core.js'; +import { ColorManagement } from './three.core.js'; +/** + * This node represents a color space conversion. Meaning it converts + * a color value from a source to a target color space. + * + * @augments TempNode + */ +export class ColorSpaceNode extends TempNode { + /** + * Constructs a new color space node. + * + * @param {Node} colorNode - Represents the color to convert. + * @param {string} source - The source color space. + * @param {string} target - The target color space. + */ + constructor(colorNode: Node, source: string, target: string); + /** + * Represents the color to convert. + * + * @type {Node} + */ + colorNode: Node; + /** + * The source color space. + * + * @type {string} + */ + source: string; + /** + * The target color space. + * + * @type {string} + */ + target: string; + /** + * This method resolves the constants `WORKING_COLOR_SPACE` and + * `OUTPUT_COLOR_SPACE` based on the current configuration of the + * color management and renderer. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} colorSpace - The color space to resolve. + * @return {string} The resolved color space. + */ + resolveColorSpace(builder: NodeBuilder, colorSpace: string): string; + setup(builder: any): Node; +} +import { Compatibility } from './three.core.js'; +/** + * `ComputeBuiltinNode` represents a compute-scope builtin value that expose information + * about the currently running dispatch and/or the device it is running on. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +export class ComputeBuiltinNode extends Node { + /** + * Constructs a new compute builtin node. + * + * @param {string} builtinName - The built-in name. + * @param {string} nodeType - The node type. + */ + constructor(builtinName: string, nodeType: string); + /** + * The built-in name. + * + * @private + * @type {string} + */ + private _builtinName; + /** + * This method is overwritten since hash is derived from the built-in name. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(builder: NodeBuilder): string; + /** + * This method is overwritten since the node type is simply derived from `nodeType`.. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(): string; + /** + * Sets the builtin name. + * + * @param {string} builtinName - The built-in name. + * @return {ComputeBuiltinNode} A reference to this node. + */ + setBuiltinName(builtinName: string): ComputeBuiltinNode; + /** + * Returns the builtin name. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The builtin name. + */ + getBuiltinName(): string; + /** + * Whether the current node builder has the builtin or not. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether the builder has the builtin or not. + */ + hasBuiltin(builder: NodeBuilder): boolean; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +/** + * Represents a compute shader node. + * + * @augments Node + */ +export class ComputeNode extends Node { + /** + * Constructs a new compute node. + * + * @param {Node} computeNode - The node that defines the compute shader logic. + * @param {Array} workgroupSize - An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. + */ + constructor(computeNode: Node, workgroupSize: Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isComputeNode: boolean; + /** + * The node that defines the compute shader logic. + * + * @type {Node} + */ + computeNode: Node; + /** + * An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. + * + * @type {Array} + * @default [ 64 ] + */ + workgroupSize: Array; + /** + * The total number of threads (invocations) to execute. If it is a number, it will be used + * to automatically generate bounds checking against `instanceIndex`. + * + * @type {number|Array} + */ + count: number | Array; + /** + * The dispatch size for workgroups on X, Y, and Z axes. + * Used directly if `count` is not provided. + * + * @type {number|Array} + */ + dispatchSize: number | Array; + /** + * A callback executed when the compute node finishes initialization. + * + * @type {?Function} + */ + onInitFunction: Function | null; + /** + * A uniform node holding the dispatch count for bounds checking. + * Created automatically when `count` is a number. + * + * @type {?UniformNode} + */ + countNode: UniformNode | null; + /** + * Sets the {@link ComputeNode#name} property. + * + * @param {string} name - The name of the uniform. + * @return {ComputeNode} A reference to this node. + */ + setName(name: string): ComputeNode; + /** + * Sets the {@link ComputeNode#name} property. + * + * @deprecated + * @param {string} name - The name of the uniform. + * @return {ComputeNode} A reference to this node. + */ + label(name: string): ComputeNode; + /** + * Sets the callback to run during initialization. + * + * @param {Function} callback - The callback function. + * @return {ComputeNode} A reference to this node. + */ + onInit(callback: Function): ComputeNode; + /** + * The method execute the compute for this node. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateBefore({ renderer }: NodeFrame): void; + setup(builder: any): string | Node | null; + generate(builder: any, output: any): any; +} +/** + * Represents a logical `if/else` statement. Can be used as an alternative + * to the `If()`/`Else()` syntax. + * + * The `select()` method is called in a chaining fashion on a condition. The parameter nodes of `select()` + * determine the outcome of the entire statement. + * + * ```js + * velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity ); + * ``` + * + * @augments Node + */ +export class ConditionalNode extends Node { + /** + * Constructs a new conditional node. + * + * @param {Node} condNode - The node that defines the condition. + * @param {Node} ifNode - The node that is evaluate when the condition ends up `true`. + * @param {?Node} [elseNode=null] - The node that is evaluate when the condition ends up `false`. + */ + constructor(condNode: Node, ifNode: Node, elseNode?: Node | null); + /** + * The node that defines the condition. + * + * @type {Node} + */ + condNode: Node; + /** + * The node that is evaluate when the condition ends up `true`. + * + * @type {Node} + */ + ifNode: Node; + /** + * The node that is evaluate when the condition ends up `false`. + * + * @type {?Node} + * @default null + */ + elseNode: Node | null; + /** + * This method is overwritten since the node type is inferred from the if/else + * nodes. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + setup(builder: any): void; + generate(builder: any, output: any): any; +} +/** + * Class for representing a constant value in the shader. + * + * @augments InputNode + */ +export class ConstNode extends InputNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isConstNode: boolean; + /** + * Generates the shader string of the value with the current node builder. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated value as a shader string. + */ + generateConst(builder: NodeBuilder): string; + generate(builder: any, output: any): any; +} +import { ConstantAlphaFactor } from './three.core.js'; +import { ConstantColorFactor } from './three.core.js'; +/** + * This node can be used as a context management component for another node. + * {@link NodeBuilder} performs its node building process in a specific context and + * this node allows the modify the context. A typical use case is to overwrite `getUV()` e.g.: + * + * ```js + *node.context( { getUV: () => customCoord } ); + *\// or + *material.contextNode = context( { getUV: () => customCoord } ); + *\// or + *renderer.contextNode = context( { getUV: () => customCoord } ); + *\// or + *scenePass.contextNode = context( { getUV: () => customCoord } ); + *``` + * @augments Node + */ +export class ContextNode extends Node { + /** + * Constructs a new context node. + * + * @param {Node} node - The node whose context should be modified. + * @param {Object} [value={}] - The modified context data. + */ + constructor(node?: Node, value?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isContextNode: boolean; + /** + * The node whose context should be modified. + * + * @type {Node} + */ + node: Node; + /** + * The modified context data. + * + * @type {Object} + * @default {} + */ + value: Object; + /** + * This method is overwritten to ensure it returns the type of {@link ContextNode#node}. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Gathers the context data from all parent context nodes. + * + * @return {Object} The gathered context data. + */ + getFlowContextData(): Object; + /** + * This method is overwritten to ensure it returns the member type of {@link ContextNode#node}. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The member name. + * @returns {string} The member type. + */ + getMemberType(builder: NodeBuilder, name: string): string; + analyze(builder: any): void; + setup(builder: any): string | Node | null; + generate(builder: any, output: any): string | Node | null; +} +/** + * This module is part of the TSL core and usually not used in app level code. + * It represents a convert operation during the shader generation process + * meaning it converts the data type of a node to a target data type. + * + * @augments Node + */ +export class ConvertNode extends Node { + /** + * Constructs a new convert node. + * + * @param {Node} node - The node which type should be converted. + * @param {string} convertTo - The target node type. Multiple types can be defined by separating them with a `|` sign. + */ + constructor(node: Node, convertTo: string); + /** + * The node which type should be converted. + * + * @type {Node} + */ + node: Node; + /** + * The target node type. Multiple types can be defined by separating them with a `|` sign. + * + * @type {string} + */ + convertTo: string; + /** + * This method is overwritten since the implementation tries to infer the best + * matching type from the {@link ConvertNode#convertTo} property. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + serialize(data: any): void; + deserialize(data: any): void; + generate(builder: any, output: any): any; +} +import { CubeCamera } from './three.core.js'; +import { CubeDepthTexture } from './three.core.js'; +/** + * This node can be used to automatically convert environment maps in the + * equirectangular format into the cube map format. + * + * @augments TempNode + */ +export class CubeMapNode extends TempNode { + /** + * Constructs a new cube map node. + * + * @param {Node} envNode - The node representing the environment map. + */ + constructor(envNode: Node); + /** + * The node representing the environment map. + * + * @type {Node} + */ + envNode: Node; + /** + * A reference to the internal cube texture. + * + * @private + * @type {?CubeTexture} + * @default null + */ + private _cubeTexture; + /** + * A reference to the internal cube texture node. + * + * @private + * @type {CubeTextureNode} + */ + private _cubeTextureNode; + /** + * A default cube texture that acts as a placeholder. + * It is used when the conversion from equirectangular to cube + * map has not finished yet for a given texture. + * + * @private + * @type {CubeTexture} + */ + private _defaultTexture; + updateBefore(frame: any): void; + setup(builder: any): CubeTextureNode; +} +import { CubeReflectionMapping } from './three.core.js'; +import { CubeRefractionMapping } from './three.core.js'; +/** + * This class represents a cube render target. It is a special version + * of `WebGLCubeRenderTarget` which is compatible with `WebGPURenderer`. + * + * @augments RenderTarget + */ +export class CubeRenderTarget extends RenderTarget { + /** + * Constructs a new cube render target. + * + * @param {number} [size=1] - The size of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(size?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeRenderTarget: boolean; + /** + * Converts the given equirectangular texture to a cube map. + * + * @param {Renderer} renderer - The renderer. + * @param {Texture} texture - The equirectangular texture. + * @return {CubeRenderTarget} A reference to this cube render target. + */ + fromEquirectangularTexture(renderer: Renderer, texture$1: any): CubeRenderTarget; + /** + * Clears this cube render target. + * + * @param {Renderer} renderer - The renderer. + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear(renderer: Renderer, color?: boolean, depth?: boolean, stencil?: boolean): void; +} +import { CubeTexture } from './three.core.js'; +/** + * This type of uniform node represents a cube texture. + * + * @augments TextureNode + */ +export class CubeTextureNode extends TextureNode { + /** + * Constructs a new cube texture node. + * + * @param {CubeTexture} value - The cube texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Node} [biasNode=null] - The bias node. + */ + constructor(value: CubeTexture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeTextureNode: boolean; + /** + * Overwritten with an empty implementation since the `updateMatrix` flag is ignored + * for cube textures. The uv transformation matrix is not applied to cube textures. + * + * @param {boolean} value - The update toggle. + */ + setUpdateMatrix(): void; +} +import { CubeUVReflectionMapping } from './three.core.js'; +import { CullFaceBack } from './three.core.js'; +import { CullFaceFront } from './three.core.js'; +import { CullFaceNone } from './three.core.js'; +import { CustomBlending } from './three.core.js'; +import { CylinderGeometry } from './three.core.js'; +import { DataArrayTexture } from './three.core.js'; +import { DataTexture } from './three.core.js'; +export class DebugNode extends TempNode { + constructor(node: any, callback?: null); + node: any; + callback: any; + generateNodeType(builder: any): any; + setup(builder: any): any; + analyze(builder: any): any; + generate(builder: any): any; +} +import { DecrementStencilOp } from './three.core.js'; +import { DecrementWrapStencilOp } from './three.core.js'; +import { DepthFormat } from './three.core.js'; +import { DepthStencilFormat } from './three.core.js'; +import { DepthTexture } from './three.core.js'; +/** + * An alternative render pipeline that applies output processing directly in + * material shaders. This avoids the intermediate framebuffer and output pass + * used by {@link Renderer}, but changes blending and is not compatible with + * materials that sample the framebuffer, such as transmissive materials. + * + * ```js + * const renderPipeline = new DirectRenderPipeline( renderer ); + * renderPipeline.render( scene, camera ); + * ``` + * + * Note: This module can only be used with `WebGPURenderer`. + * + * @augments RenderPipeline + */ +export class DirectRenderPipeline extends RenderPipeline { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isDirectRenderPipeline: boolean; + /** + * The context node used to apply output processing in material shaders. + * + * @private + * @type {?ContextNode} + * @default null + */ + private _contextNode; + /** + * The renderer context node wrapped by this pipeline. + * + * @private + * @type {?ContextNode} + * @default null + */ + private _rendererContextNode; + /** + * Cached node representations of solid scene backgrounds. + * + * @private + * @type {WeakMap} + */ + private _backgroundNodes; + /** + * Renders the scene with output processing applied directly in material shaders. + * + * @param {Object3D} scene - The scene or object to render. + * @param {Camera} camera - The camera. + */ + render(scene: Object3D, camera: Camera): void; + /** + * Returns a node representation of a solid scene background so it receives + * the same inline output processing as material fragments. + * + * @private + * @param {Object3D} scene - The scene or object to render. + * @return {?UniformNode} The background node. + */ + private _getBackgroundNode; +} +import { DirectionalLight } from './three.core.js'; +/** + * Module for representing directional lights as nodes. + * + * @augments AnalyticLightNode + */ +export class DirectionalLightNode extends AnalyticLightNode { + /** + * Constructs a new directional light node. + * + * @param {?DirectionalLight} [light=null] - The directional light source. + */ + constructor(light?: DirectionalLight | null); + setupDirect(): { + lightDirection: any; + lightColor: Node; + }; +} +import { DoubleSide } from './three.core.js'; +import { DstAlphaFactor } from './three.core.js'; +import { DstColorFactor } from './three.core.js'; +import { DynamicDrawUsage } from './three.core.js'; +/** + * Represents a physical model for Image-based lighting (IBL). The environment + * is defined via environment maps in the equirectangular, cube map or cubeUV (PMREM) format. + * `EnvironmentNode` is intended for PBR materials like {@link MeshStandardNodeMaterial}. + * + * @augments LightingNode + */ +export class EnvironmentNode extends LightingNode { + /** + * Constructs a new environment node. + * + * @param {Node} [envNode=null] - A node representing the environment. + */ + constructor(envNode?: Node); + /** + * A node representing the environment. + * + * @type {?Node} + * @default null + */ + envNode: Node | null; + setup(builder: any): void; + /** + * Returns the PMREM node cache of the current renderer. + * + * @private + * @param {Renderer} renderer - The current renderer. + * @return {WeakMap} The node cache. + */ + private _getPMREMNodeCache; +} +import { EqualCompare } from './three.core.js'; +import { EqualDepth } from './three.core.js'; +import { EqualStencilFunc } from './three.core.js'; +import { EquirectangularReflectionMapping } from './three.core.js'; +import { EquirectangularRefractionMapping } from './three.core.js'; +import { EventDispatcher } from './three.core.js'; +/** + * EventNode is a node that executes a callback during specific update phases. + * + * @augments Node + */ +export class EventNode extends Node { + /** + * Creates an EventNode. + * + * @param {string} eventType - The type of event + * @param {Function} callback - The callback to execute on update. + */ + constructor(eventType: string, callback: Function); + eventType: string; + callback: Function; + setup(builder: any): Node | null; + update(frame: any): void; + updateBefore(frame: any): void; + updateAfter(frame: any): void; +} +export namespace EventNode { + let OBJECT: string; + let MATERIAL: string; + let FRAME: string; + let AFTER_OBJECT: string; + let BEFORE_OBJECT: string; + let BEFORE_MATERIAL: string; + let BEFORE_FRAME: string; + let BEFORE_RENDER_PIPELINE: string; + let AFTER_RENDER_PIPELINE: string; +} +/** + * This class can be used to implement basic expressions in shader code. + * Basic examples for that are `return`, `continue` or `discard` statements. + * + * @augments Node + */ +export class ExpressionNode extends Node { + /** + * Constructs a new expression node. + * + * @param {string} [snippet=''] - The native code snippet. + * @param {string} [nodeType='void'] - The node type. + */ + constructor(snippet?: string, nodeType?: string); + /** + * The native code snippet. + * + * @type {string} + * @default '' + */ + snippet: string; + generate(builder: any, output: any): any; +} +import { FileLoader } from './three.core.js'; +/** + * This module is part of the TSL core and usually not used in app level code. + * It represents a flip operation during the shader generation process + * meaning it flips normalized values with the following formula: + * ``` + * x = 1 - x; + * ``` + * `FlipNode` is internally used to implement any `flipXYZW()`, `flipRGBA()` and + * `flipSTPQ()` method invocations on node objects. For example: + * ```js + * uvNode = uvNode.flipY(); + * ``` + * + * @augments TempNode + */ +export class FlipNode extends TempNode { + /** + * Constructs a new flip node. + * + * @param {Node} sourceNode - The node which component(s) should be flipped. + * @param {string} components - The components that should be flipped e.g. `'x'` or `'xy'`. + */ + constructor(sourceNode: Node, components: string); + /** + * The node which component(s) should be flipped. + * + * @type {Node} + */ + sourceNode: Node; + /** + * The components that should be flipped e.g. `'x'` or `'xy'`. + * + * @type {string} + */ + components: string; + /** + * This method is overwritten since the node type is inferred from the source node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any): string; +} +import { Float16BufferAttribute } from './three.core.js'; +import { Float32BufferAttribute } from './three.core.js'; +import { FloatType } from './three.core.js'; +import { FramebufferTexture } from './three.core.js'; +/** + * This node can be used to evaluate whether a primitive is front or back facing. + * + * @augments Node + */ +export class FrontFacingNode extends Node { + /** + * Constructs a new front facing node. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isFrontFacingNode: boolean; + generate(builder: any): any; +} +import { FrontSide } from './three.core.js'; +import { Frustum } from './three.core.js'; +import { FrustumArray } from './three.core.js'; +/** + * This module represents the call of a {@link FunctionNode}. Developers are usually not confronted + * with this module since they use the predefined TSL syntax `wgslFn` and `glslFn` which encapsulate + * this logic. + * + * @augments TempNode + */ +export class FunctionCallNode extends TempNode { + /** + * Constructs a new function call node. + * + * @param {?FunctionNode} functionNode - The function node. + * @param {Object} [parameters={}] - The parameters for the function call. + */ + constructor(functionNode?: FunctionNode | null, parameters?: { + [x: string]: Node; + }); + /** + * The function node. + * + * @type {?FunctionNode} + * @default null + */ + functionNode: FunctionNode | null; + /** + * The parameters of the function call. + * + * @type {Object} + * @default {} + */ + parameters: { + [x: string]: Node; + }; + /** + * Sets the parameters of the function call node. + * + * @param {Object} parameters - The parameters to set. + * @return {FunctionCallNode} A reference to this node. + */ + setParameters(parameters: { + [x: string]: Node; + }): FunctionCallNode; + /** + * Returns the parameters of the function call node. + * + * @return {Object} The parameters of this node. + */ + getParameters(): { + [x: string]: Node; + }; + /** + * Returns the type of this function call node. + * + * @param {NodeBuilder} builder - The current node builder. + * @returns {string} The type of this node. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the function node of this function call node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} [name] - The name of the member. + * @returns {string} The type of the member. + */ + getMemberType(builder: NodeBuilder, name?: string): string; + generate(builder: any): string; +} +/** + * This class represents a native shader function. It can be used to implement + * certain aspects of a node material with native shader code. There are two predefined + * TSL functions for easier usage. + * + * - `wgslFn`: Creates a WGSL function node. + * - `glslFn`: Creates a GLSL function node. + * + * A basic example with one include looks like so: + * + * ```js + * const desaturateWGSLFn = wgslFn( ` + * fn desaturate( color:vec3 ) -> vec3 { + * let lum = vec3( 0.299, 0.587, 0.114 ); + * return vec3( dot( lum, color ) ); + * }` + *); + * const someWGSLFn = wgslFn( ` + * fn someFn( color:vec3 ) -> vec3 { + * return desaturate( color ); + * } + * `, [ desaturateWGSLFn ] ); + * material.colorNode = someWGSLFn( { color: texture( map ) } ); + *``` + * @augments CodeNode + */ +export class FunctionNode extends CodeNode { + /** + * Returns the type of this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the type of a member of this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member. + * @return {string} The type of the member. + */ + getMemberType(builder: NodeBuilder, name: string): string; + /** + * Returns the inputs of this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Array} The inputs. + */ + getInputs(builder: NodeBuilder): Array; + /** + * Returns the node function for this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {NodeFunction} The node function. + */ + getNodeFunction(builder: NodeBuilder): NodeFunction; + generate(builder: any, output: any): any; +} +/** + * This class allows to define multiple overloaded versions + * of the same function. Depending on the parameters of the function + * call, the node picks the best-fit overloaded version. + * + * @augments Node + */ +export class FunctionOverloadingNode extends Node { + /** + * Constructs a new function overloading node. + * + * @param {Array} functionNodes - Array of `Fn` function definitions. + * @param {...Node} parametersNodes - A list of parameter nodes. + */ + constructor(functionNodes?: Array, ...parametersNodes: Node[]); + /** + * Array of `Fn` function definitions. + * + * @type {Array} + */ + functionNodes: Array; + /** + * A list of parameter nodes. + * + * @type {Array} + */ + parametersNodes: Array; + /** + * The selected overloaded function call. + * + * @private + * @type {ShaderCallNodeInternal} + */ + private _candidateFn; + /** + * This method is overwritten since the node type is inferred from + * the function's return type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the candidate function for the current parameters. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {FunctionNode} The candidate function. + */ + getCandidateFn(builder: NodeBuilder): FunctionNode; + /** + * Sets up the node for the current parameters. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The setup node. + */ + setup(builder: NodeBuilder): Node; +} +/** + * A node builder targeting GLSL. + * + * This module generates GLSL shader code from node materials and also + * generates the respective bindings and vertex buffer definitions. These + * data are later used by the renderer to create render and compute pipelines + * for render objects. + * + * @augments NodeBuilder + */ +export class GLSLNodeBuilder extends NodeBuilder { + /** + * Constructs a new GLSL node builder renderer. + * + * @param {Object3D} object - The 3D object. + * @param {Renderer} renderer - The renderer. + */ + constructor(object: Object3D, renderer: Renderer); + /** + * A dictionary holds for each shader stage ('vertex', 'fragment', 'compute') + * another dictionary which manages UBOs per group ('render','frame','object'). + * + * @type {Object>} + */ + uniformGroups: { + [x: string]: { + [x: string]: NodeUniformsGroup; + }; + }; + /** + * An array that holds objects defining the varying and attribute data in + * context of Transform Feedback. + * + * @type {Array>} + */ + transforms: Array<{ + [x: string]: AttributeNode | string; + }>; + /** + * A dictionary that holds for each shader stage a Map of used extensions. + * + * @type {Object>} + */ + extensions: { + [x: string]: Map; + }; + /** + * A dictionary that holds for each shader stage an Array of used builtins. + * + * @type {Object>} + */ + builtins: { + [x: string]: string[]; + }; + /** + * Checks if the given texture requires a manual conversion to the working color space. + * + * @param {Texture} texture - The texture to check. + * @return {boolean} Whether the given texture requires a conversion to working color space or not. + */ + needsToWorkingColorSpace(texture: Texture): boolean; + /** + * Includes the given method name into the current + * function node. + * + * @private + * @param {string} name - The method name to include. + * @return {CodeNode} The respective code node. + */ + private _include; + /** + * Returns the bitcast method name for a given input and outputType. + * + * @param {string} type - The output type to bitcast to. + * @param {string} inputType - The input type of the. + * @return {string} The resolved GLSL bitcast invocation. + */ + getBitcastMethod(type: string, inputType: string): string; + /** + * Returns the float packing method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolved GLSL float packing method name. + */ + getFloatPackingMethod(encoding: string, layout?: string): string; + /** + * Returns the float unpacking method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolved GLSL float unpacking method name. + */ + getFloatUnpackingMethod(encoding: string, layout?: string): string; + /** + * Returns the native snippet for a ternary operation. + * + * @param {string} condSnippet - The condition determining which expression gets resolved. + * @param {string} ifSnippet - The expression to resolve to if the condition is true. + * @param {string} elseSnippet - The expression to resolve to if the condition is false. + * @return {string} The resolved method name. + */ + getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; + /** + * Builds the given shader node. + * + * @param {ShaderNodeInternal} shaderNode - The shader node. + * @return {string} The GLSL function code. + */ + buildFunctionCode(shaderNode: ShaderNodeInternal): string; + /** + * Setups the Pixel Buffer Object (PBO) for the given storage + * buffer node. + * + * @param {StorageBufferNode} storageBufferNode - The storage buffer node. + */ + setupPBO(storageBufferNode: StorageBufferNode): void; + /** + * Returns a GLSL snippet that represents the property name of the given node. + * + * @param {Node} node - The node. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The property name. + */ + getPropertyName(node: Node, shaderStage?: string): string; + /** + * Returns whether the given name is a reserved keyword of GLSL. + * + * @param {string} name - The name to test. + * @return {boolean} Whether the name is a reserved keyword or not. + */ + isReservedKeyword(name: string): boolean; + /** + * Setups the Pixel Buffer Object (PBO) for the given storage + * buffer node. + * + * @param {StorageArrayElementNode} storageArrayElementNode - The storage array element node. + * @return {string} The property name. + */ + generatePBO(storageArrayElementNode: StorageArrayElementNode): string; + /** + * Generates the GLSL snippet that reads a single texel from a texture without sampling or filtering. + * + * @param {?Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {?string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureLoad(texture: Texture | null, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet for sampling/loading the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet that resolves the dimensions of the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} levelSnippet - A GLSL snippet that represents the mip level. + * @return {string} The GLSL snippet. + */ + generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; + /** + * Generates the GLSL snippet when sampling textures with explicit mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet when sampling textures with a bias to the mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} biasSnippet - A GLSL snippet that represents the bias to apply to the mip level before sampling. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet for sampling/loading the given texture using explicit gradients. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {Array} gradSnippet - An array holding both gradient GLSL snippets. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet for sampling a depth texture and comparing the sampled depth values + * against a reference value. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A GLSL snippet that represents the reference value. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The GLSL snippet. + */ + generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the GLSL snippet for gathering four texels from the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} gatherSnippet - A GLSL snippet that represents the index of the channel to read. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. + * @return {string} The GLSL snippet. + */ + generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; + /** + * Generates the GLSL snippet for performing a depth comparison on four texels in the given depth texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A GLSL snippet that represents the reference value. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. + * @return {string} The GLSL snippet. + */ + generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; + /** + * Returns the uniforms of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the uniforms. + */ + getUniforms(shaderStage: string): string; + /** + * Returns the shader attributes of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the shader attributes. + */ + getAttributes(shaderStage: string): string; + /** + * Returns the members of the given struct type node as a GLSL string. + * + * @param {StructTypeNode} struct - The struct type node. + * @return {string} The GLSL snippet that defines the struct members. + */ + getStructMembers(struct: StructTypeNode): string; + /** + * Returns the structs of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the structs. + */ + getStructs(shaderStage: string): string; + /** + * Returns the varyings of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the varyings. + */ + getVaryings(shaderStage: string): string; + /** + * Returns a builtin representing the index of an invocation within its workgroup. + * + * @return {string} The invocation local index. + */ + getInvocationLocalIndex(): string; + /** + * Returns a builtin representing the size of a subgroup within the current shader. + */ + getSubgroupSize(): void; + /** + * Returns a builtin representing the index of an invocation within its subgroup. + */ + getInvocationSubgroupIndex(): void; + /** + * Returns a builtin representing the index of the current invocation's subgroup within its workgroup. + */ + getSubgroupIndex(): void; + /** + * Returns the frag depth builtin. + * + * @return {string} The frag depth builtin. + */ + getFragDepth(): string; + /** + * Enables the given extension. + * + * @param {string} name - The extension name. + * @param {string} behavior - The extension behavior. + * @param {string} [shaderStage=this.shaderStage] - The shader stage. + */ + enableExtension(name: string, behavior: string, shaderStage?: string): void; + /** + * Returns the enabled extensions of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the enabled extensions. + */ + getExtensions(shaderStage: string): string; + /** + * Returns the clip distances builtin. + * + * @return {string} The clip distances builtin. + */ + getClipDistance(): string; + /** + * Whether the requested feature is available or not. + * + * @param {string} name - The requested feature. + * @return {boolean} Whether the requested feature is supported or not. + */ + isAvailable(name: string): boolean; + /** + * Enables hardware clipping. + * + * @param {string} planeCount - The clipping plane count. + */ + enableHardwareClipping(planeCount: string): void; + /** + * Enables multiview. + */ + enableMultiview(): void; + /** + * Registers a transform in context of Transform Feedback. + * + * @param {string} varyingName - The varying name. + * @param {AttributeNode} attributeNode - The attribute node. + */ + registerTransform(varyingName: string, attributeNode: AttributeNode): void; + /** + * Returns the transforms of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the transforms. + */ + getTransforms(): string; + /** + * Returns a GLSL struct based on the given name and variables. + * + * @private + * @param {string} name - The struct name. + * @param {string} vars - The struct variables. + * @return {string} The GLSL snippet representing a struct. + */ + private _getGLSLUniformStruct; + /** + * Returns a GLSL vertex shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getGLSLVertexCode; + /** + * Returns a GLSL fragment shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getGLSLFragmentCode; + /** + * This method is one of the more important ones since it's responsible + * for generating a matching binding instance for the given uniform node. + * + * These bindings are later used in the renderer to create bind groups + * and layouts. + * + * @param {UniformNode} node - The uniform node. + * @param {string} type - The node data type. + * @param {string} shaderStage - The shader stage. + * @param {?string} [name=null] - An optional uniform name. + * @return {NodeUniform} The node uniform object. + */ + getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; +} +/** + * A GLSL node parser. + * + * @augments NodeParser + */ +export class GLSLNodeParser extends NodeParser { + /** + * The method parses the given GLSL code an returns a node function. + * + * @param {string} source - The GLSL code. + * @return {GLSLNodeFunction} A node function. + */ + parseFunction(source: string): GLSLNodeFunction; +} +import { GreaterCompare } from './three.core.js'; +import { GreaterDepth } from './three.core.js'; +import { GreaterEqualCompare } from './three.core.js'; +import { GreaterEqualDepth } from './three.core.js'; +import { GreaterEqualStencilFunc } from './three.core.js'; +import { GreaterStencilFunc } from './three.core.js'; +import { Group } from './three.core.js'; +import { HalfFloatType } from './three.core.js'; +import { HemisphereLight } from './three.core.js'; +/** + * Module for representing hemisphere lights as nodes. + * + * @augments AnalyticLightNode + */ +export class HemisphereLightNode extends AnalyticLightNode { + /** + * Constructs a new hemisphere light node. + * + * @param {?HemisphereLight} [light=null] - The hemisphere light source. + */ + constructor(light?: HemisphereLight | null); + /** + * Uniform node representing the light's position. + * + * @type {UniformNode} + */ + lightPositionNode: UniformNode; + /** + * A node representing the light's direction. + * + * @type {Node} + */ + lightDirectionNode: Node; + /** + * Uniform node representing the light's ground color. + * + * @type {UniformNode} + */ + groundColorNode: UniformNode; + /** + * Overwritten to updated hemisphere light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + setup(builder: any): void; +} +/** + * A IES version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. + * + * @augments SpotLight + */ +export class IESSpotLight extends SpotLight { + /** + * The IES map. It's a lookup table that stores normalized attenuation factors + * (0.0 to 1.0) that represent the light's intensity at a specific angle. + * + * @type {?Texture} + * @default null + */ + iesMap: Texture | null; + copy(source: any, recursive: any): this; +} +/** + * An IES version of the default spot light node. + * + * @augments SpotLightNode + */ +export class IESSpotLightNode extends SpotLightNode { + /** + * The texture node representing the IES texture. + * + * @type {?TextureNode} + * @default null + */ + _iesTextureNode: TextureNode | null; +} +import { IncrementStencilOp } from './three.core.js'; +import { IncrementWrapStencilOp } from './three.core.js'; +/** + * This class represents shader indices of different types. The following predefined node + * objects cover frequent use cases: + * + * - `vertexIndex`: The index of a vertex within a mesh. + * - `instanceIndex`: The index of either a mesh instance or an invocation of a compute shader. + * - `drawIndex`: The index of a draw call. + * - `invocationLocalIndex`: The index of a compute invocation within the scope of a workgroup load. + * - `invocationSubgroupIndex`: The index of a compute invocation within the scope of a subgroup. + * - `subgroupIndex`: The index of a compute invocation's subgroup within its workgroup. + * + * @augments Node + */ +export class IndexNode extends Node { + /** + * Constructs a new index node. + * + * @param {('vertex'|'instance'|'subgroup'|'invocationLocal'|'invocationGlobal'|'invocationSubgroup'|'draw')} scope - The scope of the index node. + */ + constructor(scope: ("vertex" | "instance" | "subgroup" | "invocationLocal" | "invocationGlobal" | "invocationSubgroup" | "draw")); + /** + * The scope of the index node. + * + * @type {string} + */ + scope: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isIndexNode: boolean; + generate(builder: any): any; +} +export namespace IndexNode { + let VERTEX: string; + let INSTANCE: string; + let SUBGROUP: string; + let INVOCATION_LOCAL: string; + let INVOCATION_SUBGROUP: string; + let DRAW: string; +} +/** + * This special type of buffer attribute is intended for compute shaders. + * It can be used to encode draw parameters for indirect draw calls. + * + * Note: This type of buffer attribute can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments StorageBufferAttribute + */ +export class IndirectStorageBufferAttribute extends StorageBufferAttribute { + /** + * Constructs a new storage buffer attribute. + * + * @param {number|Uint32Array} count - The item count. It is also valid to pass a `Uint32Array` as an argument. + * The subsequent parameter is then obsolete. + * @param {number} itemSize - The item size. + */ + constructor(count: number | Uint32Array, itemSize: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isIndirectStorageBufferAttribute: boolean; +} +/** + * Base class for representing data input nodes. + * + * @augments Node + */ +export class InputNode extends Node { + /** + * Constructs a new input node. + * + * @param {any} value - The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). + * @param {?string} nodeType - The node type. If no explicit type is defined, the node tries to derive the type from its value. + */ + constructor(value: any, nodeType?: string | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInputNode: boolean; + /** + * The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). + * + * @type {any} + */ + value: any; + /** + * The precision of the value in the shader. + * + * @type {?('low'|'medium'|'high')} + * @default null + */ + precision: ("low" | "medium" | "high") | null; + generateNodeType(): string | null; + /** + * Returns the input type of the node which is by default the node type. Derived modules + * might overwrite this method and use a fixed type or compute one analytically. + * + * A typical example for different input and node types are textures. The input type of a + * normal RGBA texture is `texture` whereas its node type is `vec4`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(builder: NodeBuilder): string; + /** + * Sets the precision to the given value. The method can be + * overwritten in derived classes if the final precision must be computed + * analytically. + * + * @param {('low'|'medium'|'high')} precision - The precision of the input value in the shader. + * @return {InputNode} A reference to this node. + */ + setPrecision(precision: ("low" | "medium" | "high")): InputNode; + serialize(data: any): void; + deserialize(data: any): void; + generate(): void; +} +/** + * InspectorBase is the base class for all inspectors. + * + * @augments EventDispatcher + */ +export class InspectorBase extends EventDispatcher { + /** + * The renderer associated with this inspector. + * + * @type {WebGLRenderer} + * @private + */ + private _renderer; + /** + * The current frame being processed. + * + * @type {Object} + */ + currentFrame: Object; + /** + * Indicates whether the inspector is running. + * + * @type {boolean} + * @default false + */ + isRunning: boolean; + /** + * Indicates whether the inspector is enabled. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * Returns the node frame for the current renderer. + * + * @return {Object} The node frame. + */ + get nodeFrame(): Object; + /** + * Sets the renderer for this inspector. + * + * @param {WebGLRenderer} renderer - The renderer to associate with this inspector. + * @return {InspectorBase} This inspector instance. + */ + setRenderer(renderer: WebGLRenderer): InspectorBase; + /** + * Returns the renderer associated with this inspector. + * + * @return {WebGLRenderer} The associated renderer. + */ + getRenderer(): WebGLRenderer; + /** + * Initializes the inspector. + */ + init(): void; + /** + * Called when a frame begins. + */ + begin(): void; + /** + * Called when a frame ends. + */ + finish(): void; + /** + * Inspects a node. + * + * @param {Node} node - The node to inspect. + */ + inspect(): void; + /** + * When a compute operation is performed. + * + * @param {ComputeNode} computeNode - The compute node being executed. + * @param {number|Array} dispatchSizeOrCount - The dispatch size or count. + */ + computeAsync(): void; + /** + * Called when a compute operation begins. + * + * @param {string} uid - A unique identifier for the render context. + * @param {ComputeNode} computeNode - The compute node being executed. + */ + beginCompute(): void; + /** + * Called when a compute operation ends. + * + * @param {string} uid - A unique identifier for the render context. + * @param {ComputeNode} computeNode - The compute node being executed. + */ + finishCompute(): void; + /** + * Called when a render operation begins. + * + * @param {string} uid - A unique identifier for the render context. + * @param {Scene} scene - The scene being rendered. + * @param {Camera} camera - The camera being used for rendering. + * @param {?WebGLRenderTarget} renderTarget - The render target, if any. + */ + beginRender(): void; + /** + * Called when an animation loop ends. + * + * @param {string} uid - A unique identifier for the render context. + */ + finishRender(): void; + /** + * Called when a texture copy operation is performed. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + */ + copyTextureToTexture(): void; + /** + * Called when a framebuffer copy operation is performed. + * + * @param {Texture} framebufferTexture - The texture associated with the framebuffer. + */ + copyFramebufferToTexture(): void; +} +/** + * InspectorNode is a wrapper node that allows inspection of node values during rendering. + * It can be used to debug or analyze node outputs in the rendering pipeline. + * + * @augments Node + */ +export class InspectorNode extends Node { + /** + * Creates an InspectorNode. + * + * @param {Node} node - The node to inspect. + * @param {string} [name=''] - Optional name for the inspector node. + * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. + */ + constructor(node: Node, name?: string, callback?: Function | null); + node: Node; + callback: Function | null; + isInspectorNode: boolean; + /** + * Returns the name of the inspector node. + * + * @returns {string} + */ + getName(): string; + /** + * Updates the inspector node, allowing inspection of the wrapped node. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + /** + * Returns the type of the wrapped node. + * + * @param {NodeBuilder} builder - The node builder. + * @returns {string} + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Sets up the inspector node. + * + * @param {NodeBuilder} builder - The node builder. + * @returns {Node} The setup node. + */ + setup(builder: NodeBuilder): Node; +} +import { InstancedBufferAttribute } from './three.core.js'; +import { InstancedInterleavedBuffer } from './three.core.js'; +import { IntType } from './three.core.js'; +import { InterleavedBuffer } from './three.core.js'; +import { InterleavedBufferAttribute } from './three.core.js'; +import { InvertStencilOp } from './three.core.js'; +/** + * A generic class that can be used by nodes which contribute + * irradiance to the scene. E.g. a light map node can be used + * as input for this module. Used in {@link NodeMaterial}. + * + * @augments LightingNode + */ +export class IrradianceNode extends LightingNode { + /** + * Constructs a new irradiance node. + * + * @param {Node} node - A node contributing irradiance. + */ + constructor(node: Node); + /** + * A node contributing irradiance. + * + * @type {Node} + */ + node: Node; + setup(builder: any): void; +} +/** + * This node can be used as a cache management component for another node. + * Caching is in general used by default in {@link NodeBuilder} but this node + * allows the usage of a shared parent cache during the build process. + * + * @augments Node + */ +export class IsolateNode extends Node { + /** + * Constructs a new cache node. + * + * @param {Node} node - The node that should be cached. + * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. + */ + constructor(node: Node, parent?: boolean); + /** + * The node that should be cached. + * + * @type {Node} + */ + node: Node; + /** + * Whether this node refers to a shared parent cache or not. + * + * @type {boolean} + * @default true + */ + parent: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isIsolateNode: boolean; + generateNodeType(builder: any): string; + build(builder: any, ...params: any[]): string | Node | null; + setParent(parent: any): this; + getParent(): boolean; +} +/** + * This module is part of the TSL core and usually not used in app level code. + * It represents a join operation during the shader generation process. + * For example in can compose/join two single floats into a `vec2` type. + * + * @augments TempNode + */ +export class JoinNode extends TempNode { + /** + * Constructs a new join node. + * + * @param {Array} nodes - An array of nodes that should be joined. + * @param {?string} [nodeType=null] - The node type. + */ + constructor(nodes?: Array, nodeType?: string | null); + /** + * An array of nodes that should be joined. + * + * @type {Array} + */ + nodes: Array; + /** + * This method is overwritten since the node type must be inferred from the + * joined data length if not explicitly defined. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any, output: any): any; +} +import { KeepStencilOp } from './three.core.js'; +import { LessCompare } from './three.core.js'; +import { LessDepth } from './three.core.js'; +import { LessEqualCompare } from './three.core.js'; +import { LessEqualDepth } from './three.core.js'; +import { LessEqualStencilFunc } from './three.core.js'; +import { LessStencilFunc } from './three.core.js'; +import { LightProbe } from './three.core.js'; +/** + * Module for representing light probes as nodes. + * + * @augments AnalyticLightNode + */ +export class LightProbeNode extends AnalyticLightNode { + /** + * Constructs a new light probe node. + * + * @param {?LightProbe} [light=null] - The light probe. + */ + constructor(light?: LightProbe | null); + /** + * Light probe represented as a uniform of spherical harmonics. + * + * @type {UniformArrayNode} + */ + lightProbe: UniformArrayNode; + /** + * Overwritten to updated light probe specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + setup(builder: any): void; +} +/** + * This renderer module manages the lights nodes which are unique + * per scene + camera + lighting combination. + * + * The lights node itself is later configured in the render list + * with the actual lights from the scene. + * + * @private + */ +export class Lighting { + /** + * Whether this lighting manager is enabled or not. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * A stack of light arrays saved per render via {@link Lighting#beginRender}. + * + * @private + * @type {Array>} + */ + private _cache; + /** + * A map of lights nodes per scene. + * + * @private + * @type {WeakMap} + */ + private _lightsNodeMap; + /** + * Creates a new lights node for the given array of lights. + * + * @param {Array} lights - The render object. + * @return {LightsNode} The lights node. + */ + createNode(lights?: Array): LightsNode; + /** + * Returns a lights node for the given scene. + * + * @param {Scene} scene - The scene. + * @return {LightsNode} The lights node. + */ + getNode(scene: Scene): LightsNode; + /** + * Saves the current lights of the scene's lights node so they can be restored + * in {@link Lighting#finishRender}. Must be paired with a `finishRender()` call + * to avoid memory leaks. + * + * Nested render calls might mutate the lights array so a save/restore is required + * for each render call. + * + * @param {Scene} scene - The scene. + */ + beginRender(scene: Scene): void; + /** + * Restores the lights saved by the matching {@link Lighting#beginRender} call. + * + * @param {Scene} scene - The scene. + */ + finishRender(scene: Scene): void; +} +/** + * `LightingContextNode` represents an extension of the {@link ContextNode} module + * by adding lighting specific context data. It represents the runtime context of + * {@link LightsNode}. + * + * @augments ContextNode + */ +export class LightingContextNode extends ContextNode { + /** + * Constructs a new lighting context node. + * + * @param {LightsNode} lightsNode - The lights node. + * @param {?LightingModel} [lightingModel=null] - The current lighting model. + * @param {?Array} materialLightings - The material lightings nodes. + * @param {?Node} [backdropNode=null] - A backdrop node. + * @param {?Node} [backdropAlphaNode=null] - A backdrop alpha node. + */ + constructor(lightsNode: LightsNode, lightingModel?: LightingModel | null, materialLightings?: Array | null, backdropNode?: Node | null, backdropAlphaNode?: Node | null); + /** + * The current lighting model. + * + * @type {?LightingModel} + * @default null + */ + lightingModel: LightingModel | null; + /** + * @type {?Array} + * @default [] + */ + materialLightings: Array | null; + /** + * A backdrop node. + * + * @type {?Node} + * @default null + */ + backdropNode: Node | null; + /** + * A backdrop alpha node. + * + * @type {?Node} + * @default null + */ + backdropAlphaNode: Node | null; + _value: { + radiance: Node; + irradiance: Node; + iblIrradiance: Node; + ambientOcclusion: Node; + reflectedLight: { + directDiffuse: Node; + directSpecular: Node; + indirectDiffuse: Node; + indirectSpecular: Node; + }; + backdrop: Node; + backdropAlpha: Node; + } | null; + /** + * Returns a lighting context object. + * + * @return {{ + * radiance: Node, + * irradiance: Node, + * iblIrradiance: Node, + * ambientOcclusion: Node, + * reflectedLight: {directDiffuse: Node, directSpecular: Node, indirectDiffuse: Node, indirectSpecular: Node}, + * backdrop: Node, + * backdropAlpha: Node + * }} The lighting context object. + */ + getContext(): { + radiance: Node; + irradiance: Node; + iblIrradiance: Node; + ambientOcclusion: Node; + reflectedLight: { + directDiffuse: Node; + directSpecular: Node; + indirectDiffuse: Node; + indirectSpecular: Node; + }; + backdrop: Node; + backdropAlpha: Node; + }; +} +/** + * Abstract class for implementing lighting models. The module defines + * multiple methods that concrete lighting models can implement. These + * methods are executed at different points during the light evaluation + * process. + */ +export class LightingModel { + /** + * This method is intended for setting up lighting model and context data + * which are later used in the evaluation process. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + start(builder: NodeBuilder): void; + /** + * This method is intended for executing final tasks like final updates + * to the outgoing light. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + finish(): void; + /** + * This method is intended for implementing the direct light term and + * executed during the build process of directional, point and spot light nodes. + * + * @abstract + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct(): void; + /** + * This method is intended for implementing the direct light term for + * rect area light nodes. + * + * @abstract + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + directRectArea(): void; + /** + * This method is intended for implementing the indirect light term. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + indirect(): void; + /** + * This method is intended for implementing the ambient occlusion term. + * Unlike other methods, this method must be called manually by the lighting + * model in its indirect term. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + ambientOcclusion(): void; +} +/** + * Base class for lighting nodes. + * + * @augments Node + */ +export class LightingNode extends Node { + /** + * Constructs a new lighting node. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLightingNode: boolean; +} +/** + * This node represents the scene's lighting and manages the lighting model's life cycle + * for the current build 3D object. It is responsible for computing the total outgoing + * light in a given lighting context. + * + * @augments Node + */ +export class LightsNode extends Node { + /** + * Constructs a new lights node. + */ + constructor(); + /** + * A node representing the total diffuse light. + * + * @type {Node} + */ + totalDiffuseNode: Node; + /** + * A node representing the total specular light. + * + * @type {Node} + */ + totalSpecularNode: Node; + /** + * A node representing the outgoing light. + * + * @type {Node} + */ + outgoingLightNode: Node; + /** + * An array representing the lights in the scene. + * + * @private + * @type {Array} + */ + private _lights; + /** + * Computes a hash value for identifying the current light nodes setup. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {string} The computed hash. + */ + getHash(builder: NodeBuilder): string; + /** + * Analyzes the node's dependencies by building all nested light nodes + * and the output node. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + */ + analyze(builder: NodeBuilder): void; + /** + * Creates lighting nodes for each scene light. This makes it possible to further + * process lights in the node system. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Array} The array of lighting nodes. + */ + setupLightsNode(builder: NodeBuilder): Array; + /** + * Sets up a direct light in the lighting model. + * + * @param {Object} builder - The builder object containing the context and stack. + * @param {Object} lightNode - The light node. + * @param {Object} lightData - The light object containing color and direction properties. + */ + setupDirectLight(builder: Object, lightNode: Object, lightData: Object): void; + /** + * Sets up a direct rect area light in the lighting model. + * + * @param {Object} builder - The builder object containing the context and stack. + * @param {Object} lightNode - The light node. + * @param {Object} lightData - The light object containing color and area light properties. + */ + setupDirectRectAreaLight(builder: Object, lightNode: Object, lightData: Object): void; + /** + * Setups the internal lights by building all respective + * light nodes. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @param {Array} lightNodes - An array of lighting nodes. + */ + setupLights(builder: NodeBuilder, lightNodes: Array): void; + getLightNodes(builder: any): any; + /** + * The implementation makes sure that for each light in the scene + * there is a corresponding light node. By building the light nodes + * and evaluating the lighting model the outgoing light is computed. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Node} A node representing the outgoing light. + */ + setup(builder: NodeBuilder): Node; + /** + * Configures this node with an array of lights. + * + * @param {Array} lights - An array of lights. + * @return {LightsNode} A reference to this node. + */ + setLights(lights: Array): LightsNode; + /** + * Returns an array of the scene's lights. + * + * @return {Array} The scene's lights. + */ + getLights(): Array; + /** + * Returns an array of the scene's lights. + * + * The light variations are shader-dependent; + * if this array changes, the shader needs to be recreated. + * + * @return {Array} The scene's lights. + */ + getBuiltinLights(): Array; + /** + * Whether the scene has lights or not. + * + * @type {boolean} + */ + get hasLights(): boolean; +} +/** + * This node material can be used to render lines with a size larger than one + * by representing them as instanced meshes. + * + * @augments NodeMaterial + */ +export class Line2NodeMaterial extends NodeMaterial { + /** + * Constructs a new node material for wide line rendering. + * + * @param {Object} [parameters={}] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLine2NodeMaterial: boolean; + /** + * The dash offset. + * + * @type {number} + * @default 0 + */ + dashOffset: number; + /** + * Defines the offset. + * + * @type {?Node} + * @default null + */ + offsetNode: Node | null; + /** + * Defines the dash scale. + * + * @type {?Node} + * @default null + */ + dashScaleNode: Node | null; + /** + * Defines the dash size. + * + * @type {?Node} + * @default null + */ + dashSizeNode: Node | null; + /** + * Defines the gap size. + * + * @type {?Node} + * @default null + */ + gapSizeNode: Node | null; + _useDash: any; + _useAlphaToCoverage: boolean; + _useWorldUnits: boolean; + set lineColorNode(value: Node | null); + /** + * Defines the lines color. + * + * @deprecated since r185. Use {@link NodeMaterial#colorNode} instead. + * @type {?Node} + */ + get lineColorNode(): Node | null; + set worldUnits(value: boolean); + /** + * Whether the lines should sized in world units or not. + * When set to `false` the unit is pixel. + * + * @type {boolean} + * @default false + */ + get worldUnits(): boolean; + set dashed(value: boolean); + /** + * Whether the lines should be dashed or not. + * + * @type {boolean} + * @default false + */ + get dashed(): boolean; +} +import { LineBasicMaterial } from './three.core.js'; +/** + * Node material version of {@link LineBasicMaterial}. + * + * @augments NodeMaterial + */ +export class LineBasicNodeMaterial extends NodeMaterial { + /** + * Constructs a new line basic node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineBasicNodeMaterial: boolean; +} +import { LineDashedMaterial } from './three.core.js'; +/** + * Node material version of {@link LineDashedMaterial}. + * + * @augments NodeMaterial + */ +export class LineDashedNodeMaterial extends NodeMaterial { + /** + * Constructs a new line dashed node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineDashedNodeMaterial: boolean; + /** + * The dash offset. + * + * @type {number} + * @default 0 + */ + dashOffset: number; + /** + * The offset of dash materials is by default inferred from the `dashOffset` + * property. This node property allows to overwrite the default + * and define the offset with a node instead. + * + * If you don't want to overwrite the offset but modify the existing + * value instead, use {@link materialLineDashOffset}. + * + * @type {?Node} + * @default null + */ + offsetNode: Node | null; + /** + * The scale of dash materials is by default inferred from the `scale` + * property. This node property allows to overwrite the default + * and define the scale with a node instead. + * + * If you don't want to overwrite the scale but modify the existing + * value instead, use {@link materialLineScale}. + * + * @type {?Node} + * @default null + */ + dashScaleNode: Node | null; + /** + * The dash size of dash materials is by default inferred from the `dashSize` + * property. This node property allows to overwrite the default + * and define the dash size with a node instead. + * + * If you don't want to overwrite the dash size but modify the existing + * value instead, use {@link materialLineDashSize}. + * + * @type {?Node} + * @default null + */ + dashSizeNode: Node | null; + /** + * The gap size of dash materials is by default inferred from the `gapSize` + * property. This node property allows to overwrite the default + * and define the gap size with a node instead. + * + * If you don't want to overwrite the gap size but modify the existing + * value instead, use {@link materialLineGapSize}. + * + * @type {?Node} + * @default null + */ + gapSizeNode: Node | null; +} +import { LinearFilter } from './three.core.js'; +import { LinearMipMapLinearFilter } from './three.core.js'; +import { LinearMipmapLinearFilter } from './three.core.js'; +import { LinearMipmapNearestFilter } from './three.core.js'; +import { LinearSRGBColorSpace } from './three.core.js'; +import { LinearToneMapping } from './three.core.js'; +import { LinearTransfer } from './three.core.js'; +import { Loader } from './three.core.js'; +/** + * This module offers a variety of ways to implement loops in TSL. In it's basic form it's: + * ```js + * Loop( count, ( { i } ) => { + * + * } ); + * ``` + * However, it is also possible to define a start and end ranges, data types and loop conditions: + * ```js + * Loop( { start: int( 0 ), end: int( 10 ), type: 'int', condition: '<' }, ( { i } ) => { + * + * } ); + *``` + * Nested loops can be defined in a compacted form: + * ```js + * Loop( 10, 5, ( { i, j } ) => { + * + * } ); + * ``` + * Loops that should run backwards can be defined like so: + * ```js + * Loop( { start: 10 }, () => {} ); + * ``` + * It is possible to execute with boolean values, similar to the `while` syntax. + * ```js + * const value = float( 0 ).toVar(); + * + * Loop( value.lessThan( 10 ), () => { + * + * value.addAssign( 1 ); + * + * } ); + * ``` + * The module also provides `Break()` and `Continue()` TSL expression for loop control. + * @augments Node + */ +export class LoopNode extends Node { + /** + * Constructs a new loop node. + * + * @param {Array} params - Depending on the loop type, array holds different parameterization values for the loop. + */ + constructor(params?: Array); + params: any[]; + /** + * Returns a loop variable name based on an index. The pattern is + * `0` = `i`, `1`= `j`, `2`= `k` and so on. + * + * @param {number} index - The index. + * @return {string} The loop variable name. + */ + getVarName(index: number): string; + /** + * Returns properties about this node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Object} The node properties. + */ + getProperties(builder: NodeBuilder): Object; + _getInternalParams(): any[]; + setup(builder: any): void; + generate(builder: any): void; +} +/** + * This node can be used setup a MRT context for rendering. A typical MRT setup for + * post-processing is shown below: + * ```js + * const mrtNode = mrt( { + * output: output, + * normal: normalView + * } ) ; + * ``` + * The MRT output is defined as a dictionary. + * + * @augments OutputStructNode + */ +export class MRTNode extends OutputStructNode { + /** + * Constructs a new output struct node. + * + * @param {Object} outputNodes - The MRT outputs. + */ + constructor(outputNodes: { + [x: string]: Node; + }); + /** + * A dictionary representing the MRT outputs. The key + * is the name of the output, the value the node which produces + * the output result. + * + * @type {Object} + */ + outputNodes: { + [x: string]: Node; + }; + /** + * A dictionary storing the blend modes for each output. + * + * @type {Object} + */ + blendModes: { + [x: string]: BlendMode; + }; + /** + * A dictionary storing the clear colors for each output. + * + * @type {Object} + */ + clearColors: { + [x: string]: Color4; + }; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMRTNode: boolean; + /** + * Sets the blend mode for the given output name. + * + * @param {string} name - The name of the output. + * @param {BlendMode} blend - The blending mode. + * @return {MRTNode} The current MRT node. + */ + setBlendMode(name: string, blend: BlendMode): MRTNode; + /** + * Returns the blend mode for the given output name. + * + * @param {string} name - The name of the output. + * @return {BlendMode} The blend mode. + */ + getBlendMode(name: string): BlendMode; + /** + * Sets the clear color for the given output name. + * + * @param {string} name - The name of the output. + * @param {number|string|Color} color - The clear color. + * @param {number} [alpha=1] - The clear alpha. + * @return {MRTNode} The current MRT node. + */ + setClearColor(name: string, color: number | string | Color, alpha?: number): MRTNode; + /** + * Returns the clear color for the given output name. + * + * @param {string} name - The name of the output. + * @return {?Color4} The clear color. Returns `null` if no clear color is defined + * which means the renderer's default clear policy is applied. + */ + getClearColor(name: string): Color4 | null; + /** + * Returns `true` if the MRT node has an output with the given name. + * + * @param {string} name - The name of the output. + * @return {NodeBuilder} Whether the MRT node has an output for the given name or not. + */ + has(name: string): NodeBuilder; + /** + * Returns the output node for the given name. + * + * @param {string} name - The name of the output. + * @return {Node} The output node. + */ + get(name: string): Node; + /** + * Merges the outputs of the given MRT node with the outputs of this node. + * + * @param {MRTNode} mrtNode - The MRT to merge. + * @return {MRTNode} A new MRT node with merged outputs.. + */ + merge(mrtNode: MRTNode): MRTNode; + setup(builder: any): Node | null; +} +import { Material } from './three.core.js'; +import { MaterialBlending } from './three.core.js'; +import { MaterialLoader } from './three.core.js'; +/** + * This class should simplify the node access to material properties. + * It internal uses reference nodes to make sure changes to material + * properties are automatically reflected to predefined TSL objects + * like e.g. `materialColor`. + * + * @augments Node + */ +export class MaterialNode extends Node { + /** + * Constructs a new material node. + * + * @param {string} scope - The scope defines what kind of material property is referred by the node. + */ + constructor(scope: string); + /** + * The scope defines what material property is referred by the node. + * + * @type {string} + */ + scope: string; + /** + * Returns a cached reference node for the given property and type. + * + * @param {string} property - The name of the material property. + * @param {string} type - The uniform type of the property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getCache(property: string, type: string): MaterialReferenceNode; + /** + * Returns a float-typed material reference node for the given property name. + * + * @param {string} property - The name of the material property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getFloat(property: string): MaterialReferenceNode; + /** + * Returns a color-typed material reference node for the given property name. + * + * @param {string} property - The name of the material property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getColor(property: string): MaterialReferenceNode; + /** + * Returns a texture-typed material reference node for the given property name. + * + * @param {string} property - The name of the material property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getTexture(property: string): MaterialReferenceNode; + /** + * The node setup is done depending on the selected scope. Multiple material properties + * might be grouped into a single node composition if they logically belong together. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The node representing the selected scope. + */ + setup(builder: NodeBuilder): Node; +} +export namespace MaterialNode { + let ALPHA_TEST: string; + let COLOR: string; + let OPACITY: string; + let SHININESS: string; + let SPECULAR: string; + let SPECULAR_STRENGTH: string; + let SPECULAR_INTENSITY: string; + let SPECULAR_COLOR: string; + let REFLECTIVITY: string; + let ROUGHNESS: string; + let METALNESS: string; + let NORMAL: string; + let CLEARCOAT: string; + let CLEARCOAT_ROUGHNESS: string; + let CLEARCOAT_NORMAL: string; + let EMISSIVE: string; + let ROTATION: string; + let SHEEN: string; + let SHEEN_ROUGHNESS: string; + let ANISOTROPY: string; + let IRIDESCENCE: string; + let IRIDESCENCE_IOR: string; + let IRIDESCENCE_THICKNESS: string; + let IOR: string; + let TRANSMISSION: string; + let THICKNESS: string; + let ATTENUATION_DISTANCE: string; + let ATTENUATION_COLOR: string; + let LINE_SCALE: string; + let LINE_DASH_SIZE: string; + let LINE_GAP_SIZE: string; + let LINE_WIDTH: string; + let LINE_DASH_OFFSET: string; + let POINT_SIZE: string; + let DISPERSION: string; + let RETROREFLECTIVITY: string; + let LIGHT_MAP: string; + let AO: string; +} +/** + * This node is a special type of reference node which is intended + * for linking material properties with node values. + * ```js + * const opacityNode = materialReference( 'opacity', 'float', material ); + * ``` + * When changing `material.opacity`, the node value of `opacityNode` will + * automatically be updated. + * + * @augments ReferenceNode + */ +export class MaterialReferenceNode extends ReferenceNode { + /** + * Constructs a new material reference node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} inputType - The uniform type that should be used to represent the property value. + * @param {?Material} [material=null] - The material the property belongs to. When no material is set, + * the node refers to the material of the current rendered object. + */ + constructor(property: string, inputType: string, material?: Material | null); + /** + * The material the property belongs to. When no material is set, + * the node refers to the material of the current rendered object. + * + * @type {?Material} + * @default null + */ + material: Material | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMaterialReferenceNode: boolean; +} +/** + * This node represents a variety of mathematical methods available in shaders. + * They are divided into three categories: + * + * - Methods with one input like `sin`, `cos` or `normalize`. + * - Methods with two inputs like `dot`, `cross` or `pow`. + * - Methods with three inputs like `mix`, `clamp` or `smoothstep`. + * + * @augments TempNode + */ +export class MathNode extends TempNode { + /** + * Constructs a new math node. + * + * @param {string} method - The method name. + * @param {Node} aNode - The first input. + * @param {?Node} [bNode=null] - The second input. + * @param {?Node} [cNode=null] - The third input. + */ + constructor(method: string, aNode: Node, bNode?: Node | null, cNode?: Node | null, ...args: any[]); + /** + * The method name. + * + * @type {string} + */ + method: string; + /** + * The first input. + * + * @type {Node} + */ + aNode: Node; + /** + * The second input. + * + * @type {?Node} + * @default null + */ + bNode: Node | null; + /** + * The third input. + * + * @type {?Node} + * @default null + */ + cNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMathNode: boolean; + /** + * The input type is inferred from the node types of the input nodes. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(builder: NodeBuilder): string; + /** + * The selected method as well as the input type determine the node type of this node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + setup(builder: any): any; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +export namespace MathNode { + let ALL: string; + let ANY: string; + let RADIANS: string; + let DEGREES: string; + let EXP: string; + let EXP2: string; + let LOG: string; + let LOG2: string; + let SQRT: string; + let INVERSE_SQRT: string; + let FLOOR: string; + let CEIL: string; + let NORMALIZE: string; + let FRACT: string; + let SIN: string; + let SINH: string; + let COS: string; + let COSH: string; + let TAN: string; + let TANH: string; + let ASIN: string; + let ASINH: string; + let ACOS: string; + let ACOSH: string; + let ATAN: string; + let ATANH: string; + let ABS: string; + let SIGN: string; + let LENGTH: string; + let NEGATE: string; + let ONE_MINUS: string; + let DFDX: string; + let DFDY: string; + let ROUND: string; + let RECIPROCAL: string; + let TRUNC: string; + let FWIDTH: string; + let TRANSPOSE: string; + let DETERMINANT: string; + let INVERSE: string; + let EQUALS: string; + let MIN: string; + let MAX: string; + let STEP: string; + let REFLECT: string; + let DISTANCE: string; + let DIFFERENCE: string; + let DOT: string; + let CROSS: string; + let POW: string; + let TRANSFORM_DIRECTION: string; + let MIX: string; + let CLAMP: string; + let REFRACT: string; + let SMOOTHSTEP: string; + let FACEFORWARD: string; +} +import { MathUtils } from './three.core.js'; +import { Matrix2 } from './three.core.js'; +import { Matrix3 } from './three.core.js'; +import { Matrix4 } from './three.core.js'; +import { MaxEquation } from './three.core.js'; +/** + * A special type of uniform node that computes the + * maximum mipmap level for a given texture node. + * + * ```js + * const level = maxMipLevel( textureNode ); + * ``` + * + * @augments UniformNode + */ +export class MaxMipLevelNode extends UniformNode { + /** + * Constructs a new max mip level node. + * + * @param {TextureNode} textureNode - The texture node to compute the max mip level for. + */ + constructor(textureNode: TextureNode); + /** + * The texture node to compute the max mip level for. + * + * @private + * @type {TextureNode} + */ + private _textureNode; + /** + * The texture node to compute the max mip level for. + * + * @readonly + * @type {TextureNode} + */ + readonly get textureNode(): TextureNode; + /** + * The texture. + * + * @readonly + * @type {Texture} + */ + readonly get texture(): Texture; + update(): void; +} +/** + * Base class for representing member access on an object-like + * node data structures. + * + * @augments Node + */ +export class MemberNode extends Node { + /** + * Constructs a member node. + * + * @param {Node} structNode - The struct node. + * @param {string} property - The property name. + */ + constructor(structNode: Node, property: string); + /** + * The struct node. + * + * @type {Node} + */ + structNode: Node; + /** + * The property name. + * + * @type {Node} + */ + property: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMemberNode: boolean; + hasMember(builder: any): boolean; + generateNodeType(builder: any): string; + getMemberType(builder: any, name: any): any; + generate(builder: any): any; +} +import { Mesh } from './three.core.js'; +import { MeshBasicMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshBasicMaterial}. + * + * @augments NodeMaterial + */ +export class MeshBasicNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh basic node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshBasicNodeMaterial: boolean; + /** + * Overwritten since this type of material uses {@link BasicEnvironmentNode} + * to implement the default environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?BasicEnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {BasicLightingModel} The lighting model. + */ + setupLightingModel(): BasicLightingModel; +} +import { MeshLambertMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshLambertMaterial}. + * + * @augments NodeMaterial + */ +export class MeshLambertNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh lambert node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshLambertNodeMaterial: boolean; + /** + * Overwritten since this type of material uses {@link BasicEnvironmentNode} + * to implement the default environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?BasicEnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {PhongLightingModel} The lighting model. + */ + setupLightingModel(): PhongLightingModel; +} +import { MeshMatcapMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshMatcapMaterial}. + * + * @augments NodeMaterial + */ +export class MeshMatcapNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh normal node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshMatcapNodeMaterial: boolean; + /** + * Setups the matcap specific node variables. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupVariants(builder: NodeBuilder): void; +} +import { MeshNormalMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshNormalMaterial}. + * + * @augments NodeMaterial + */ +export class MeshNormalNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh normal node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshNormalNodeMaterial: boolean; + /** + * Overwrites the default implementation by computing the diffuse color + * based on the normal data. + */ + setupDiffuseColor(): void; +} +import { MeshPhongMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshPhongMaterial}. + * + * @augments NodeMaterial + */ +export class MeshPhongNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh lambert node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshPhongNodeMaterial: boolean; + /** + * The shininess of phong materials is by default inferred from the `shininess` + * property. This node property allows to overwrite the default + * and define the shininess with a node instead. + * + * If you don't want to overwrite the shininess but modify the existing + * value instead, use {@link materialShininess}. + * + * @type {?Node} + * @default null + */ + shininessNode: Node | null; + /** + * The specular color of phong materials is by default inferred from the + * `specular` property. This node property allows to overwrite the default + * and define the specular color with a node instead. + * + * If you don't want to overwrite the specular color but modify the existing + * value instead, use {@link materialSpecular}. + * + * @type {?Node} + * @default null + */ + specularNode: Node | null; + /** + * Overwritten since this type of material uses {@link BasicEnvironmentNode} + * to implement the default environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?BasicEnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {PhongLightingModel} The lighting model. + */ + setupLightingModel(): PhongLightingModel; +} +import { MeshPhysicalMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshPhysicalMaterial}. + * + * @augments MeshStandardNodeMaterial + */ +export class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshPhysicalNodeMaterial: boolean; + /** + * The clearcoat of physical materials is by default inferred from the `clearcoat` + * and `clearcoatMap` properties. This node property allows to overwrite the default + * and define the clearcoat with a node instead. + * + * If you don't want to overwrite the clearcoat but modify the existing + * value instead, use {@link materialClearcoat}. + * + * @type {?Node} + * @default null + */ + clearcoatNode: Node | null; + /** + * The clearcoat roughness of physical materials is by default inferred from the `clearcoatRoughness` + * and `clearcoatRoughnessMap` properties. This node property allows to overwrite the default + * and define the clearcoat roughness with a node instead. + * + * If you don't want to overwrite the clearcoat roughness but modify the existing + * value instead, use {@link materialClearcoatRoughness}. + * + * @type {?Node} + * @default null + */ + clearcoatRoughnessNode: Node | null; + /** + * The clearcoat normal of physical materials is by default inferred from the `clearcoatNormalMap` + * property. This node property allows to overwrite the default + * and define the clearcoat normal with a node instead. + * + * If you don't want to overwrite the clearcoat normal but modify the existing + * value instead, use {@link materialClearcoatNormal}. + * + * @type {?Node} + * @default null + */ + clearcoatNormalNode: Node | null; + /** + * The sheen of physical materials is by default inferred from the `sheen`, `sheenColor` + * and `sheenColorMap` properties. This node property allows to overwrite the default + * and define the sheen with a node instead. + * + * If you don't want to overwrite the sheen but modify the existing + * value instead, use {@link materialSheen}. + * + * @type {?Node} + * @default null + */ + sheenNode: Node | null; + /** + * The sheen roughness of physical materials is by default inferred from the `sheenRoughness` and + * `sheenRoughnessMap` properties. This node property allows to overwrite the default + * and define the sheen roughness with a node instead. + * + * If you don't want to overwrite the sheen roughness but modify the existing + * value instead, use {@link materialSheenRoughness}. + * + * @type {?Node} + * @default null + */ + sheenRoughnessNode: Node | null; + /** + * The iridescence of physical materials is by default inferred from the `iridescence` + * property. This node property allows to overwrite the default + * and define the iridescence with a node instead. + * + * If you don't want to overwrite the iridescence but modify the existing + * value instead, use {@link materialIridescence}. + * + * @type {?Node} + * @default null + */ + iridescenceNode: Node | null; + /** + * The iridescence IOR of physical materials is by default inferred from the `iridescenceIOR` + * property. This node property allows to overwrite the default + * and define the iridescence IOR with a node instead. + * + * If you don't want to overwrite the iridescence IOR but modify the existing + * value instead, use {@link materialIridescenceIOR}. + * + * @type {?Node} + * @default null + */ + iridescenceIORNode: Node | null; + /** + * The iridescence thickness of physical materials is by default inferred from the `iridescenceThicknessRange` + * and `iridescenceThicknessMap` properties. This node property allows to overwrite the default + * and define the iridescence thickness with a node instead. + * + * If you don't want to overwrite the iridescence thickness but modify the existing + * value instead, use {@link materialIridescenceThickness}. + * + * @type {?Node} + * @default null + */ + iridescenceThicknessNode: Node | null; + /** + * The specular intensity of physical materials is by default inferred from the `specularIntensity` + * and `specularIntensityMap` properties. This node property allows to overwrite the default + * and define the specular intensity with a node instead. + * + * If you don't want to overwrite the specular intensity but modify the existing + * value instead, use {@link materialSpecularIntensity}. + * + * @type {?Node} + * @default null + */ + specularIntensityNode: Node | null; + /** + * The specular color of physical materials is by default inferred from the `specularColor` + * and `specularColorMap` properties. This node property allows to overwrite the default + * and define the specular color with a node instead. + * + * If you don't want to overwrite the specular color but modify the existing + * value instead, use {@link materialSpecularColor}. + * + * @type {?Node} + * @default null + */ + specularColorNode: Node | null; + /** + * The ior of physical materials is by default inferred from the `ior` + * property. This node property allows to overwrite the default + * and define the ior with a node instead. + * + * If you don't want to overwrite the ior but modify the existing + * value instead, use {@link materialIOR}. + * + * @type {?Node} + * @default null + */ + iorNode: Node | null; + /** + * The transmission of physical materials is by default inferred from the `transmission` and + * `transmissionMap` properties. This node property allows to overwrite the default + * and define the transmission with a node instead. + * + * If you don't want to overwrite the transmission but modify the existing + * value instead, use {@link materialTransmission}. + * + * @type {?Node} + * @default null + */ + transmissionNode: Node | null; + /** + * The thickness of physical materials is by default inferred from the `thickness` and + * `thicknessMap` properties. This node property allows to overwrite the default + * and define the thickness with a node instead. + * + * If you don't want to overwrite the thickness but modify the existing + * value instead, use {@link materialThickness}. + * + * @type {?Node} + * @default null + */ + thicknessNode: Node | null; + /** + * The attenuation distance of physical materials is by default inferred from the + * `attenuationDistance` property. This node property allows to overwrite the default + * and define the attenuation distance with a node instead. + * + * If you don't want to overwrite the attenuation distance but modify the existing + * value instead, use {@link materialAttenuationDistance}. + * + * @type {?Node} + * @default null + */ + attenuationDistanceNode: Node | null; + /** + * The attenuation color of physical materials is by default inferred from the + * `attenuationColor` property. This node property allows to overwrite the default + * and define the attenuation color with a node instead. + * + * If you don't want to overwrite the attenuation color but modify the existing + * value instead, use {@link materialAttenuationColor}. + * + * @type {?Node} + * @default null + */ + attenuationColorNode: Node | null; + /** + * The dispersion of physical materials is by default inferred from the + * `dispersion` property. This node property allows to overwrite the default + * and define the dispersion with a node instead. + * + * If you don't want to overwrite the dispersion but modify the existing + * value instead, use {@link materialDispersion}. + * + * @type {?Node} + * @default null + */ + dispersionNode: Node | null; + /** + * The retroreflective strength of physical materials is by default inferred from the + * `retroreflectivity` property. This node property allows to overwrite the default + * and define the retroreflective strength with a node instead. + * + * If you don't want to overwrite the retroreflective strength but modify the existing + * value instead, use {@link materialRetroreflectivity}. + * + * @type {?Node} + * @default null + */ + retroreflectivityNode: Node | null; + /** + * The anisotropy of physical materials is by default inferred from the + * `anisotropy` property. This node property allows to overwrite the default + * and define the anisotropy with a node instead. + * + * If you don't want to overwrite the anisotropy but modify the existing + * value instead, use {@link materialAnisotropy}. + * + * @type {?Node} + * @default null + */ + anisotropyNode: Node | null; + /** + * Whether the lighting model should use clearcoat or not. + * + * @type {boolean} + * @default true + */ + get useClearcoat(): boolean; + /** + * Whether the lighting model should use iridescence or not. + * + * @type {boolean} + * @default true + */ + get useIridescence(): boolean; + /** + * Whether the lighting model should use sheen or not. + * + * @type {boolean} + * @default true + */ + get useSheen(): boolean; + /** + * Whether the lighting model should use anisotropy or not. + * + * @type {boolean} + * @default true + */ + get useAnisotropy(): boolean; + /** + * Whether the lighting model should use transmission or not. + * + * @type {boolean} + * @default true + */ + get useTransmission(): boolean; + /** + * Whether the lighting model should use dispersion or not. + * + * @type {boolean} + * @default true + */ + get useDispersion(): boolean; + /** + * Whether the lighting model should use retroreflection or not. + * + * @type {boolean} + * @default true + */ + get useRetroreflection(): boolean; + /** + * Setups the physical specific node variables. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupVariants(builder: NodeBuilder): void; + /** + * Setups the clearcoat normal node. + * + * @return {Node} The clearcoat normal. + */ + setupClearcoatNormal(): Node; + setup(builder: any): void; +} +/** + * This node material is an experimental extension of {@link MeshPhysicalNodeMaterial} + * that implements a Subsurface scattering (SSS) term. + * + * @augments MeshPhysicalNodeMaterial + */ +export class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial { + /** + * Represents the thickness color. + * + * @type {?Node} + * @default null + */ + thicknessColorNode: Node | null; + /** + * Represents the distortion factor. + * + * @type {?Node} + */ + thicknessDistortionNode: Node | null; + /** + * Represents the thickness ambient factor. + * + * @type {?Node} + */ + thicknessAmbientNode: Node | null; + /** + * Represents the thickness attenuation. + * + * @type {?Node} + */ + thicknessAttenuationNode: Node | null; + /** + * Represents the thickness power. + * + * @type {?Node} + */ + thicknessPowerNode: Node | null; + /** + * Represents the thickness scale. + * + * @type {?Node} + */ + thicknessScaleNode: Node | null; + /** + * Whether the lighting model should use SSS or not. + * + * @type {boolean} + * @default true + */ + get useSSS(): boolean; + /** + * Setups the lighting model. + * + * @return {SSSLightingModel} The lighting model. + */ + setupLightingModel(): SSSLightingModel; +} +import { MeshStandardMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshStandardMaterial}. + * + * @augments NodeMaterial + */ +export class MeshStandardNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh standard node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshStandardNodeMaterial: boolean; + /** + * The emissive color of standard materials is by default inferred from the `emissive`, + * `emissiveIntensity` and `emissiveMap` properties. This node property allows to + * overwrite the default and define the emissive color with a node instead. + * + * If you don't want to overwrite the emissive color but modify the existing + * value instead, use {@link materialEmissive}. + * + * @type {?Node} + * @default null + */ + emissiveNode: Node | null; + /** + * The metalness of standard materials is by default inferred from the `metalness`, + * and `metalnessMap` properties. This node property allows to + * overwrite the default and define the metalness with a node instead. + * + * If you don't want to overwrite the metalness but modify the existing + * value instead, use {@link materialMetalness}. + * + * @type {?Node} + * @default null + */ + metalnessNode: Node | null; + /** + * The roughness of standard materials is by default inferred from the `roughness`, + * and `roughnessMap` properties. This node property allows to + * overwrite the default and define the roughness with a node instead. + * + * If you don't want to overwrite the roughness but modify the existing + * value instead, use {@link materialRoughness}. + * + * @type {?Node} + * @default null + */ + roughnessNode: Node | null; + /** + * Overwritten since this type of material uses {@link EnvironmentNode} + * to implement the PBR (PMREM based) environment mapping. Besides, the + * method honors `Scene.environment`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?EnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): EnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {PhysicalLightingModel} The lighting model. + */ + setupLightingModel(): PhysicalLightingModel; + /** + * Setups the specular related node variables. + */ + setupSpecular(): void; +} +import { MeshToonMaterial } from './three.core.js'; +/** + * Node material version of {@link MeshToonMaterial}. + * + * @augments NodeMaterial + */ +export class MeshToonNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh toon node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshToonNodeMaterial: boolean; + /** + * Setups the lighting model. + * + * @return {ToonLightingModel} The lighting model. + */ + setupLightingModel(): ToonLightingModel; +} +import { MinEquation } from './three.core.js'; +import { MirroredRepeatWrapping } from './three.core.js'; +import { MixOperation } from './three.core.js'; +/** + * This type of node is a specialized version of `Object3DNode` + * with larger set of model related metrics. Unlike `Object3DNode`, + * `ModelNode` extracts the reference to the 3D object from the + * current node frame state. + * + * @augments Object3DNode + */ +export class ModelNode extends Object3DNode { + /** + * Constructs a new object model node. + * + * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. + */ + constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix")); +} +import { MultiplyBlending } from './three.core.js'; +import { MultiplyOperation } from './three.core.js'; +import { NearestFilter } from './three.core.js'; +import { NearestMipmapLinearFilter } from './three.core.js'; +import { NearestMipmapNearestFilter } from './three.core.js'; +import { NeutralToneMapping } from './three.core.js'; +import { NeverCompare } from './three.core.js'; +import { NeverDepth } from './three.core.js'; +import { NeverStencilFunc } from './three.core.js'; +import { NoBlending } from './three.core.js'; +import { NoColorSpace } from './three.core.js'; +import { NoNormalPacking } from './three.core.js'; +import { NoToneMapping } from './three.core.js'; +/** + * Base class for all nodes. + * + * @augments EventDispatcher + */ +export class Node extends EventDispatcher { + static get type(): string; + /** + * Constructs a new node. + * + * @param {?string} nodeType - The node type. + */ + constructor(nodeType?: string | null); + /** + * The node type. This represents the result type of the node (e.g. `float` or `vec3`). + * + * @type {?string} + * @default null + */ + nodeType: string | null; + /** + * The update type of the node's {@link Node#update} method. Possible values are listed in {@link NodeUpdateType}. + * + * @type {string} + * @default 'none' + */ + updateType: string; + /** + * The update type of the node's {@link Node#updateBefore} method. Possible values are listed in {@link NodeUpdateType}. + * + * @type {string} + * @default 'none' + */ + updateBeforeType: string; + /** + * The update type of the node's {@link Node#updateAfter} method. Possible values are listed in {@link NodeUpdateType}. + * + * @type {string} + * @default 'none' + */ + updateAfterType: string; + /** + * The version of the node. The version automatically is increased when {@link Node#needsUpdate} is set to `true`. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly version: number; + /** + * The name of the node. + * + * @type {string} + * @default '' + */ + name: string; + /** + * Whether this node is global or not. This property is relevant for the internal + * node caching system. All nodes which should be declared just once should + * set this flag to `true` (a typical example is {@link AttributeNode}). + * + * @type {boolean} + * @default false + */ + global: boolean; + /** + * Create a list of parents for this node during the build process. + * + * @type {boolean} + * @default false + */ + parents: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNode: boolean; + _beforeNodes: any; + /** + * The cache key of this node. + * + * @private + * @type {?number} + * @default null + */ + private _cacheKey; + /** + * The UUID of the node. + * + * @type {string} + * @default null + * @private + */ + private _uuid; + /** + * The cache key's version. + * + * @private + * @type {number} + * @default 0 + */ + private _cacheKeyVersion; + /** + * The unique ID of the node. + * + * @type {number} + * @readonly + */ + readonly id: number; + /** + * The stack trace of the node for debugging purposes. + * + * @type {?string} + * @default null + */ + stackTrace: string | null; + /** + * Set this property to `true` when the node should be regenerated. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * The UUID of the node. + * + * @type {string} + * @readonly + */ + readonly get uuid(): string; + /** + * The type of the class. The value is usually the constructor name. + * + * @type {string} + * @readonly + */ + readonly get type(): string; + /** + * Convenient method for defining {@link Node#update}. + * + * @param {Function} callback - The update method. + * @param {string} updateType - The update type. + * @return {Node} A reference to this node. + */ + onUpdate(callback: Function, updateType: string): Node; + /** + * The method can be implemented to update the node's internal state when it is used to render an object. + * The {@link Node#updateType} property defines how often the update is executed. + * + * @abstract + * @param {NodeFrame} frame - A reference to the current node frame. + * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + */ + update(): boolean | null; + /** + * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but + * this method automatically sets the update type to `FRAME`. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onFrameUpdate(callback: Function): Node; + /** + * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but + * this method automatically sets the update type to `RENDER`. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onRenderUpdate(callback: Function): Node; + /** + * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but + * this method automatically sets the update type to `OBJECT`. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onObjectUpdate(callback: Function): Node; + /** + * Convenient method for defining {@link Node#updateReference}. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onReference(callback: Function): Node; + /** + * Nodes might refer to other objects like materials. This method allows to dynamically update the reference + * to such objects based on a given state (e.g. the current node frame or builder). + * + * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. + * @return {any} The updated reference. + */ + updateReference(): any; + /** + * By default this method returns the value of the {@link Node#global} flag. This method + * can be overwritten in derived classes if an analytical way is required to determine the + * global cache referring to the current shader-stage. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether this node is global or not. + */ + isGlobal(): boolean; + /** + * Generator function that can be used to iterate over the child nodes. + * + * @generator + * @yields {Node} A child node. + */ + getChildren(): Generator; + /** + * Calling this method dispatches the `dispose` event. This event can be used + * to register event listeners for clean up tasks. + */ + dispose(): void; + /** + * Callback for {@link Node#traverse}. + * + * @callback traverseCallback + * @param {Node} node - The current node. + */ + /** + * Can be used to traverse through the node's hierarchy. + * + * @param {traverseCallback} callback - A callback that is executed per node. + */ + traverse(callback: (node: Node) => any): void; + /** + * Returns the child nodes of this node. + * + * @private + * @param {Set} [ignores=new Set()] - A set of nodes to ignore during the search to avoid circular references. + * @returns {Array} An array of objects describing the child nodes. + */ + private _getChildren; + /** + * Returns the cache key for this node. + * + * @param {boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced. + * @param {Set} [ignores=null] - A set of nodes to ignore during the computation of the cache key. + * @return {number} The cache key of the node. + */ + getCacheKey(force?: boolean, ignores?: Set): number; + /** + * Generate a custom cache key for this node. + * + * @return {number} The cache key of the node. + */ + customCacheKey(): number; + /** + * Returns the references to this node which is by default `this`. + * + * @return {Node} A reference to this node. + */ + getScope(): Node; + /** + * Returns the hash of the node which is used to identify the node. By default it's + * the {@link Node#uuid} however derived node classes might have to overwrite this method + * depending on their implementation. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(): string; + /** + * Returns the update type of {@link Node#update}. + * + * @return {NodeUpdateType} The update type. + */ + getUpdateType(): { + NONE: string; + FRAME: string; + RENDER: string; + OBJECT: string; + }; + /** + * Returns the update type of {@link Node#updateBefore}. + * + * @return {NodeUpdateType} The update type. + */ + getUpdateBeforeType(): { + NONE: string; + FRAME: string; + RENDER: string; + OBJECT: string; + }; + /** + * Returns the update type of {@link Node#updateAfter}. + * + * @return {NodeUpdateType} The update type. + */ + getUpdateAfterType(): { + NONE: string; + FRAME: string; + RENDER: string; + OBJECT: string; + }; + /** + * Certain types are composed of multiple elements. For example a `vec3` + * is composed of three `float` values. This method returns the type of + * these elements. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The type of the node. + */ + getElementType(builder: NodeBuilder): string; + /** + * Returns the node member type for the given name. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member. + * @return {string} The type of the node. + */ + getMemberType(): string; + /** + * Returns the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} [output=null] - The output of the node. + * @return {string} The type of the node. + */ + getNodeType(builder: NodeBuilder, output?: string): string; + /** + * Returns the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} [output=null] - The output of the node. + * @return {string} The type of the node. + */ + generateNodeType(builder: NodeBuilder, output?: string): string; + /** + * This method is used during the build process of a node and ensures + * equal nodes are not built multiple times but just once. For example if + * `attribute( 'uv' )` is used multiple times by the user, the build + * process makes sure to process just the first node. It also handles + * node overrides if an override context is set. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The shared node if possible. Otherwise `this` is returned. + */ + getShared(builder: NodeBuilder): Node; + /** + * Returns the number of elements in the node array. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?number} The number of elements in the node array. + */ + getArrayCount(): number | null; + /** + * Represents the setup stage which is the first step of the build process, see {@link Node#build} method. + * This method is often overwritten in derived modules to prepare the node which is used as a node's output/result. + * If an output node is prepared, then it must be returned in the `return` statement of the derived module's setup function. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?Node} The output node. + */ + setup(builder: NodeBuilder): Node | null; + /** + * Represents the analyze stage which is the second step of the build process, see {@link Node#build} method. + * This stage analyzes the node hierarchy and ensures descendent nodes are built. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?Node} output - The target output node. + */ + analyze(builder: NodeBuilder, output?: Node | null): void; + /** + * Represents the generate stage which is the third step of the build process, see {@link Node#build} method. + * This state builds the output node and returns the resulting shader string. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?string} [output] - Can be used to define the output type. + * @return {?string} The generated shader string. + */ + generate(builder: NodeBuilder, output?: string | null): string | null; + /** + * The method can be implemented to update the node's internal state before it is used to render an object. + * The {@link Node#updateBeforeType} property defines how often the update is executed. + * + * @abstract + * @param {NodeFrame} frame - A reference to the current node frame. + * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + */ + updateBefore(): boolean | null; + /** + * The method can be implemented to update the node's internal state after it was used to render an object. + * The {@link Node#updateAfterType} property defines how often the update is executed. + * + * @abstract + * @param {NodeFrame} frame - A reference to the current node frame. + * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + */ + updateAfter(): boolean | null; + before(node: any): this; + /** + * This method performs the build of a node. The behavior and return value depend on the current build stage: + * - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant. + * - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`. + * - **generate**: Generates the shader code for the node. Returns the generated shader string. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?(string|Node)} [output=null] - Can be used to define the output type. + * @return {?(Node|string)} The result of the build process, depending on the build stage. + */ + build(builder: NodeBuilder, output?: (string | Node) | null): (Node | string) | null; + /** + * Returns the child nodes as a JSON object. + * + * @return {Generator} An iterable list of serialized child objects as JSON. + */ + getSerializeChildren(): Generator; + /** + * Serializes the node to JSON. + * + * @param {Object} json - The output JSON object. + */ + serialize(json: Object): void; + /** + * Deserializes the node from the given JSON. + * + * @param {Object} json - The JSON object. + */ + deserialize(json: Object): void; + /** + * Serializes the node into the three.js JSON Object/Scene format. + * + * @param {?Object} meta - An optional JSON object that already holds serialized data from other scene objects. + * @return {Object} The serialized node. + */ + toJSON(meta: Object | null): Object; + assign(...params: any[]): any; + toVarIntent(): Node; + get(value: any): MemberNode; +} +export namespace Node { + let captureStackTrace: boolean; +} +export namespace NodeAccess { + let READ_ONLY: string; + let WRITE_ONLY: string; + let READ_WRITE: string; +} +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader attributes that are going to be generated + * by the builder. Arrays of node attributes is maintained in {@link NodeBuilder#attributes} + * and {@link NodeBuilder#bufferAttributes} for this purpose. + */ +export class NodeAttribute { + /** + * Constructs a new node attribute. + * + * @param {string} name - The name of the attribute. + * @param {string} type - The type of the attribute. + * @param {?Node} node - An optional reference to the node. + */ + constructor(name: string, type: string, node?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeAttribute: boolean; + /** + * The name of the attribute. + * + * @type {string} + */ + name: string; + /** + * The type of the attribute. + * + * @type {string} + */ + type: string; + /** + * An optional reference to the node. + * + * @type {?Node} + * @default null + */ + node: Node | null; +} +/** + * Base class for builders which generate a shader program based + * on a 3D object and its node material definition. + */ +export class NodeBuilder { + /** + * Constructs a new node builder. + * + * @param {Object3D} object - The 3D object. + * @param {Renderer} renderer - The current renderer. + * @param {NodeParser} parser - A reference to a node parser. + */ + constructor(object: Object3D, renderer: Renderer, parser: NodeParser); + /** + * The 3D object. + * + * @type {Object3D} + */ + object: Object3D; + /** + * The material of the 3D object. + * + * @type {?Material} + */ + material: Material | null; + /** + * The geometry of the 3D object. + * + * @type {?BufferGeometry} + */ + geometry: BufferGeometry | null; + /** + * The current renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * A reference to a node parser. + * + * @type {NodeParser} + */ + parser: NodeParser; + /** + * The scene the 3D object belongs to. + * + * @type {?Scene} + * @default null + */ + scene: Scene | null; + /** + * The camera the 3D object is rendered with. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * A list of all nodes the builder is processing + * for this 3D object. + * + * @type {Set} + */ + nodes: Set; + /** + * A list of all nodes the builder is processing in sequential order. + * + * This is used to determine the update order of nodes, which is important for + * {@link NodeUpdateType#UPDATE_BEFORE} and {@link NodeUpdateType#UPDATE_AFTER}. + * + * @type {Set} + */ + sequentialNodes: Set; + /** + * A list of all nodes which {@link Node#update} method should be executed. + * + * @type {Array} + */ + updateNodes: Array; + /** + * A list of all nodes which {@link Node#updateBefore} method should be executed. + * + * @type {Array} + */ + updateBeforeNodes: Array; + /** + * A list of all nodes which {@link Node#updateAfter} method should be executed. + * + * @type {Array} + */ + updateAfterNodes: Array; + /** + * A dictionary that assigns each node to a unique hash. + * + * @type {Object} + */ + hashNodes: { + [x: number]: Node; + }; + /** + * A reference to a node material observer. + * + * @type {?NodeMaterialObserver} + * @default null + */ + observer: NodeMaterialObserver | null; + /** + * A reference to the current lights node. + * + * @type {?LightsNode} + * @default null + */ + lightsNode: LightsNode | null; + /** + * A reference to the current environment node. + * + * @type {?Node} + * @default null + */ + environmentNode: Node | null; + /** + * A reference to the current fog node. + * + * @type {?Node} + * @default null + */ + fogNode: Node | null; + /** + * The current clipping context. + * + * @type {?ClippingContext} + */ + clippingContext: ClippingContext | null; + /** + * Whether the built material uses hardware clipping or not. + * + * @type {boolean} + * @default false + */ + hardwareClipping: boolean; + /** + * The generated vertex shader. + * + * @type {?string} + */ + vertexShader: string | null; + /** + * The generated fragment shader. + * + * @type {?string} + */ + fragmentShader: string | null; + /** + * The generated compute shader. + * + * @type {?string} + */ + computeShader: string | null; + /** + * Nodes used in the primary flow of code generation. + * + * @type {Object>} + */ + flowNodes: { + [x: string]: Node[]; + }; + /** + * Nodes code from `.flowNodes`. + * + * @type {Object} + */ + flowCode: { + [x: string]: string; + }; + /** + * This dictionary holds the node uniforms of the builder. + * The uniforms are maintained in an array for each shader stage. + * + * @type {Object} + */ + uniforms: Object; + /** + * This dictionary holds the output structs of the builder. + * The structs are maintained in an array for each shader stage. + * + * @type {Object} + */ + structs: Object; + /** + * This dictionary holds the types of the builder. + * + * @type {Object} + */ + types: Object; + /** + * This dictionary holds the bindings for each shader stage. + * + * @type {Object} + */ + bindings: Object; + /** + * This dictionary maintains the binding indices per bind group. + * + * @type {Object} + */ + bindingsIndexes: Object; + /** + * Reference to the array of bind groups. + * + * @type {?Array} + */ + bindGroups: Array | null; + /** + * This array holds the node attributes of this builder + * created via {@link AttributeNode}. + * + * @type {Array} + */ + attributes: Array; + /** + * This array holds the node attributes of this builder + * created via {@link BufferAttributeNode}. + * + * @type {Array} + */ + bufferAttributes: Array; + /** + * This array holds the node varyings of this builder. + * + * @type {Array} + */ + varyings: Array; + /** + * This dictionary holds the (native) node codes of this builder. + * The codes are maintained in an array for each shader stage. + * + * @type {Object>} + */ + codes: { + [x: string]: NodeCode[]; + }; + /** + * This dictionary holds the node variables of this builder. + * The variables are maintained in an array for each shader stage. + * This dictionary is also used to count the number of variables + * according to their type (const, vars). + * + * @type {Object|number>} + */ + vars: { + [x: string]: number | NodeVar[]; + }; + /** + * This dictionary holds the declarations for each shader stage. + * + * @type {Object} + */ + declarations: Object; + /** + * Current code flow. + * All code generated in this stack will be stored in `.flow`. + * + * @type {{code: string}} + */ + flow: { + code: string; + }; + /** + * A chain of nodes. + * Used to check recursive calls in node-graph. + * + * @type {Array} + */ + chaining: Array; + /** + * The current stack. + * This reflects the current process in the code block hierarchy, + * it is useful to know if the current process is inside a conditional for example. + * + * @type {StackNode} + */ + stack: StackNode; + /** + * List of stack nodes. + * The current stack hierarchy is stored in an array. + * + * @type {Array} + */ + stacks: Array; + /** + * A tab value. Used for shader string generation. + * + * @type {string} + * @default '\t' + */ + tab: string; + /** + * Reference to the current function node. + * + * @type {?FunctionNode} + * @default null + */ + currentFunctionNode: FunctionNode | null; + /** + * The builder's context. + * + * @type {Object} + */ + context: Object; + /** + * The builder's cache. + * + * @type {NodeCache} + */ + cache: NodeCache; + /** + * Since the {@link NodeBuilder#cache} might be temporarily + * overwritten by other caches, this member retains the reference + * to the builder's own cache. + * + * @type {NodeCache} + * @default this.cache + */ + globalCache: NodeCache; + flowsData: WeakMap; + /** + * The current shader stage. + * + * @type {?('vertex'|'fragment'|'compute'|'any')} + */ + shaderStage: ("vertex" | "fragment" | "compute" | "any") | null; + /** + * The current build stage. + * + * @type {?('setup'|'analyze'|'generate')} + */ + buildStage: ("setup" | "analyze" | "generate") | null; + /** + * The sub-build layers. + * + * @type {Array} + * @default [] + */ + subBuildLayers: Array; + /** + * The active stack nodes. + * + * @type {Array} + */ + activeStacks: Array; + /** + * The current sub-build TSL function(Fn). + * + * @type {?string} + * @default null + */ + subBuildFn: string | null; + /** + * The current TSL function(Fn) call node. + * + * @type {?Node} + * @default null + */ + fnCall: Node | null; + /** + * Whether the material is using flat shading or not. + * + * @returns {boolean} Whether the material is using flat shading or not. + */ + isFlatShading(): boolean; + /** + * Whether the material is opaque or not. + * + * @return {boolean} Whether the material is opaque or not. + */ + isOpaque(): boolean; + /** + * Factory method for creating an instance of {@link RenderTarget} with the given + * dimensions and options. + * + * @param {number} width - The width of the render target. + * @param {number} height - The height of the render target. + * @param {Object} options - The options of the render target. + * @return {RenderTarget} The render target. + */ + createRenderTarget(width: number, height: number, options: Object): RenderTarget; + /** + * Factory method for creating an instance of {@link CubeRenderTarget} with the given + * dimensions and options. + * + * @param {number} size - The size of the cube render target. + * @param {Object} options - The options of the cube render target. + * @return {CubeRenderTarget} The cube render target. + */ + createCubeRenderTarget(size: number, options: Object): CubeRenderTarget; + /** + * Whether the given node is included in the internal array of nodes or not. + * + * @param {Node} node - The node to test. + * @return {boolean} Whether the given node is included in the internal array of nodes or not. + */ + includes(node: Node): boolean; + /** + * Returns the type of the color output based on the renderer's render target. + * + * @param {number} [index=0] - The index of the render target texture. + * @return {string} The type. + */ + getOutputType(index?: number): string; + /** + * Returns the output struct name which is required by + * {@link OutputStructNode}. + * + * @abstract + * @return {string} The name of the output struct. + */ + getOutputStructName(): string; + /** + * Returns a bind group for the given group name and binding. + * + * @private + * @param {string} groupName - The group name. + * @param {Array} bindings - List of bindings. + * @return {BindGroup} The bind group + */ + private _getBindGroup; + /** + * Returns an array of node uniform groups for the given group name and shader stage. + * + * @param {string} groupName - The group name. + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {Array} The array of node uniform groups. + */ + getBindGroupArray(groupName: string, shaderStage: ("vertex" | "fragment" | "compute" | "any")): Array; + /** + * Returns a list bindings of all shader stages separated by groups. + * + * @return {Array} The list of bindings. + */ + getBindings(): Array; + /** + * Sorts the bind groups and updates {@link NodeBuilder#bindingsIndexes}. + */ + sortBindingGroups(): void; + /** + * The builder maintains each node in a hash-based dictionary. + * This method sets the given node (value) with the given hash (key) into this dictionary. + * + * @param {Node} node - The node to add. + * @param {number} hash - The hash of the node. + */ + setHashNode(node: Node, hash: number): void; + /** + * Adds a node to this builder. + * + * @param {Node} node - The node to add. + */ + addNode(node: Node): void; + /** + * It is used to add Nodes that will be used as FRAME and RENDER events, + * and need to follow a certain sequence in the calls to work correctly. + * This function should be called after 'setup()' in the 'build()' process to ensure that the child nodes are processed first. + * + * @param {Node} node - The node to add. + */ + addSequentialNode(node: Node): void; + /** + * Checks the update types of nodes + */ + buildUpdateNodes(): void; + /** + * A reference the current node which is the + * last node in the chain of nodes. + * + * @type {Node} + */ + get currentNode(): Node; + /** + * A reference to the render pipeline. + * + * @type {RenderPipeline} + */ + get renderPipeline(): RenderPipeline; + /** + * Whether the given texture is filtered or not. + * + * @param {Texture} texture - The texture to check. + * @return {boolean} Whether the given texture is filtered or not. + */ + isFilteredTexture(texture: Texture): boolean; + /** + * Returns the maximum number of bytes available for uniform buffers. + * + * @return {number} The maximum number of bytes available for uniform buffers. + */ + getUniformBufferLimit(): number; + /** + * Adds the given node to the internal node chain. + * This is used to check recursive calls in node-graph. + * + * @param {Node} node - The node to add. + */ + addChain(node: Node): void; + /** + * Removes the given node from the internal node chain. + * + * @param {Node} node - The node to remove. + */ + removeChain(node: Node): void; + /** + * Returns the native shader method name for a given generic name. E.g. + * the method name `textureDimensions` matches the WGSL name but must be + * resolved to `textureSize` in GLSL. + * + * @abstract + * @param {string} method - The method name to resolve. + * @return {string} The resolved method name. + */ + getMethod(method: string): string; + /** + * Returns the native snippet for a ternary operation. E.g. GLSL would output + * a ternary op as `cond ? x : y` whereas WGSL would output it as `select(y, x, cond)` + * + * @abstract + * @param {string} condSnippet - The condition determining which expression gets resolved. + * @param {string} ifSnippet - The expression to resolve to if the condition is true. + * @param {string} elseSnippet - The expression to resolve to if the condition is false. + * @return {string} The resolved method name. + */ + getTernary(): string; + /** + * Returns a node for the given hash, see {@link NodeBuilder#setHashNode}. + * + * @param {number} hash - The hash of the node. + * @return {Node} The found node. + */ + getNodeFromHash(hash: number): Node; + /** + * Adds the Node to a target flow so that it can generate code in the 'generate' process. + * + * @param {('vertex'|'fragment'|'compute')} shaderStage - The shader stage. + * @param {Node} node - The node to add. + * @return {Node} The node. + */ + addFlow(shaderStage: ("vertex" | "fragment" | "compute"), node: Node): Node; + /** + * Sets builder's context. + * + * @param {Object} context - The context to set. + */ + setContext(context: Object): void; + /** + * Returns the builder's current context. + * + * @return {Object} The builder's current context. + */ + getContext(): Object; + /** + * Adds context data to the builder's current context. + * + * @param {Object} context - The context to add. + * @return {Object} The previous context. + */ + addContext(context: Object): Object; + /** + * Gets a context used in shader construction that can be shared across different materials. + * This is necessary since the renderer cache can reuse shaders generated in one material and use them in another. + * + * @return {Object} The builder's current context without material. + */ + getSharedContext(): Object; + /** + * Sets builder's cache. + * + * @param {NodeCache} cache - The cache to set. + */ + setCache(cache: NodeCache): void; + /** + * Returns the builder's current cache. + * + * @return {NodeCache} The builder's current cache. + */ + getCache(): NodeCache; + /** + * Returns a cache for the given node. + * + * @param {Node} node - The node. + * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. + * @return {NodeCache} The cache. + */ + getCacheFromNode(node: Node, parent?: boolean): NodeCache; + /** + * Whether the requested feature is available or not. + * + * @abstract + * @param {string} name - The requested feature. + * @return {boolean} Whether the requested feature is supported or not. + */ + isAvailable(): boolean; + /** + * Returns the vertexIndex input variable as a native shader string. + * + * @abstract + * @return {string} The instanceIndex shader string. + */ + getVertexIndex(): string; + /** + * Contextually returns either the vertex stage instance index builtin + * or the linearized index of an compute invocation within a grid of workgroups. + * + * @abstract + * @return {string} The instanceIndex shader string. + */ + getInstanceIndex(): string; + /** + * Returns the drawIndex input variable as a native shader string. + * Only relevant for WebGL and its `WEBGL_multi_draw` extension. + * + * @abstract + * @return {?string} The drawIndex shader string. + */ + getDrawIndex(): string | null; + /** + * Returns the frontFacing input variable as a native shader string. + * + * @abstract + * @return {string} The frontFacing shader string. + */ + getFrontFacing(): string; + /** + * Returns the fragCoord input variable as a native shader string. + * + * @abstract + * @return {string} The fragCoord shader string. + */ + getFragCoord(): string; + /** + * Whether to flip texture data along its vertical axis or not. WebGL needs + * this method evaluate to `true`, WebGPU to `false`. + * + * @abstract + * @return {boolean} Whether to flip texture data along its vertical axis or not. + */ + isFlipY(): boolean; + /** + * Returns whether the builder is currently in an assignment context. + * + * @return {boolean} Whether the builder is in an assignment context. + */ + isContextAssign(): boolean; + /** + * Calling this method increases the usage count for the given node by one. + * + * @param {Node} node - The node to increase the usage count for. + * @return {number} The updated usage count. + */ + increaseUsage(node: Node): number; + /** + * Returns whether the given node has been written to in any shader stage. + * + * @param {Node} node - The node to check. + * @return {boolean} Whether the node has been written to. + */ + hasWriteUsage(node: Node): boolean; + /** + * Generates a texture sample shader string for the given texture data. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The texture property name. + * @param {string} uvSnippet - Snippet defining the texture coordinates. + * @return {string} The generated shader string. + */ + generateTexture(): string; + /** + * Generates a texture LOD shader string for the given texture data. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The texture property name. + * @param {string} uvSnippet - Snippet defining the texture coordinates. + * @param {?string} depthSnippet - Snippet defining the 0-based texture array index to sample. + * @param {string} levelSnippet - Snippet defining the mip level. + * @return {string} The generated shader string. + */ + generateTextureLod(): string; + /** + * Generates a texture size shader string for the given texture data. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The texture property name. + * @param {string} levelSnippet - Snippet defining the mip level. + * @return {string} The generated shader string. + */ + generateTextureSize(): string; + /** + * Generates the array declaration string. + * + * @param {string} type - The type. + * @param {?number} [count] - The count. + * @return {string} The generated value as a shader string. + */ + generateArrayDeclaration(type: string, count?: number | null): string; + /** + * Generates the array shader string for the given type and value. + * + * @param {string} type - The type. + * @param {?number} [count] - The count. + * @param {?Array} [values=null] - The default values. + * @return {string} The generated value as a shader string. + */ + generateArray(type: string, count?: number | null, values?: Array | null): string; + /** + * Generates the struct shader string. + * + * @param {string} type - The type. + * @param {Array} [membersLayout] - The count. + * @param {?Array} [values=null] - The default values. + * @return {string} The generated value as a shader string. + */ + generateStruct(type: string, membersLayout?: Array, values?: Array | null): string; + /** + * Generates the shader string for the given type and value. + * + * @param {string} type - The type. + * @param {?any} [value=null] - The value. + * @return {string} The generated value as a shader string. + */ + generateConst(type: string, value?: any | null): string; + /** + * It might be necessary to convert certain data types to different ones + * so this method can be used to hide the conversion. + * + * @param {string} type - The type. + * @return {string} The updated type. + */ + getType(type: string): string; + /** + * Whether the given attribute name is defined in the geometry or not. + * + * @param {string} name - The attribute name. + * @return {boolean} Whether the given attribute name is defined in the geometry. + */ + hasGeometryAttribute(name: string): boolean; + /** + * Returns a node attribute for the given name and type. + * + * @param {string} name - The attribute's name. + * @param {string} type - The attribute's type. + * @return {NodeAttribute} The node attribute. + */ + getAttribute(name: string, type: string): NodeAttribute; + /** + * Returns for the given node and shader stage the property name for the shader. + * + * @param {Node} node - The node. + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The property name. + */ + getPropertyName(node: Node): string; + /** + * Returns whether the given name is a reserved keyword of the backend's + * shading language. Backends override this method to provide their + * language-specific keywords. + * + * @param {string} name - The name to test. + * @return {boolean} Whether the name is a reserved keyword or not. + */ + isReservedKeyword(): boolean; + /** + * Whether the given type is a vector type or not. + * + * @param {string} type - The type to check. + * @return {boolean} Whether the given type is a vector type or not. + */ + isVector(type: string): boolean; + /** + * Whether the given type is a matrix type or not. + * + * @param {string} type - The type to check. + * @return {boolean} Whether the given type is a matrix type or not. + */ + isMatrix(type: string): boolean; + /** + * Whether the given type is a reference type or not. + * + * @param {string} type - The type to check. + * @return {boolean} Whether the given type is a reference type or not. + */ + isReference(type: string): boolean; + /** + * Checks if the given texture requires a manual conversion to the working color space. + * + * @abstract + * @param {Texture} texture - The texture to check. + * @return {boolean} Whether the given texture requires a conversion to working color space or not. + */ + needsToWorkingColorSpace(): boolean; + /** + * Returns the component type of a given texture. + * + * @param {Texture} texture - The texture. + * @return {string} The component type. + */ + getComponentTypeFromTexture(texture: Texture): string; + /** + * Returns the element type for a given type. + * + * @param {string} type - The type. + * @return {string} The element type. + */ + getElementType(type: string): string; + /** + * Returns the component type for a given type. + * + * @param {string} type - The type. + * @return {string} The component type. + */ + getComponentType(type: string): string; + /** + * Returns the vector type for a given type. + * + * @param {string} type - The type. + * @return {string} The vector type. + */ + getVectorType(type: string): string; + /** + * Returns the data type for the given the length and component type. + * + * @param {number} length - The length. + * @param {string} [componentType='float'] - The component type. + * @return {string} The type. + */ + getTypeFromLength(length: number, componentType?: string): string; + /** + * Returns the type for a given typed array. + * + * @param {TypedArray} array - The typed array. + * @return {string} The type. + */ + getTypeFromArray(array: TypedArray): string; + /** + * Returns the type is an integer type. + * + * @param {string} type - The type. + * @return {boolean} Whether the type is an integer type or not. + */ + isInteger(type: string): boolean; + /** + * Returns the type for a given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + * @return {string} The type. + */ + getTypeFromAttribute(attribute: BufferAttribute): string; + /** + * Returns the length for the given data type. + * + * @param {string} type - The data type. + * @return {number} The length. + */ + getTypeLength(type: string): number; + /** + * Returns the vector type for a given matrix type. + * + * @param {string} type - The matrix type. + * @return {string} The vector type. + */ + getVectorFromMatrix(type: string): string; + /** + * For a given type this method changes the component type to the + * given value. E.g. `vec4` should be changed to the new component type + * `uint` which results in `uvec4`. + * + * @param {string} type - The type. + * @param {string} newComponentType - The new component type. + * @return {string} The new type. + */ + changeComponentType(type: string, newComponentType: string): string; + /** + * Returns the integer type pendant for the given type. + * + * @param {string} type - The type. + * @return {string} The integer type. + */ + getIntegerType(type: string): string; + /** + * Adds an active stack to the internal stack. + * + * @param {StackNode} stack - The stack node to add. + */ + setActiveStack(stack: StackNode): void; + /** + * Removes the active stack from the internal stack. + * + * @param {StackNode} stack - The stack node to remove. + */ + removeActiveStack(stack: StackNode): void; + /** + * Returns the active stack. + * + * @return {StackNode} The active stack. + */ + getActiveStack(): StackNode; + /** + * Returns the base stack. + * + * @return {StackNode} The base stack. + */ + getBaseStack(): StackNode; + /** + * Adds a stack node to the internal stack. + * + * @return {StackNode} The added stack node. + */ + addStack(): StackNode; + /** + * Removes the last stack node from the internal stack. + * + * @return {StackNode} The removed stack node. + */ + removeStack(): StackNode; + /** + * The builder maintains (cached) data for each node during the building process. This method + * can be used to get these data for a specific shader stage and cache. + * + * @param {Node} node - The node to get the data for. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @param {?NodeCache} cache - An optional cache. + * @return {Object} The node data. + */ + getDataFromNode(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), cache?: NodeCache | null): Object; + /** + * Returns the properties for the given node and shader stage. + * + * Properties are typically used within a build stage to reference a node's + * child node or nodes manually assigned to the properties in a separate build stage. + * A typical usage pattern for defining nodes manually would be assigning dependency nodes + * to the current node's properties in the setup stage and building those properties in the generate stage. + * + * @param {Node} node - The node to get the properties for. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage='any'] - The shader stage. + * @return {Object} The node properties. + */ + getNodeProperties(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): Object; + /** + * Returns an instance of {@link NodeAttribute} for the given buffer attribute node. + * + * @param {BufferAttributeNode} node - The buffer attribute node. + * @param {string} type - The node type. + * @param {?string} [name=null] - The name of the buffer attribute. + * @return {NodeAttribute} The node attribute. + */ + getBufferAttributeFromNode(node: BufferAttributeNode, type: string, name?: string | null): NodeAttribute; + /** + * Returns an instance of {@link StructType} for the given struct name and shader stage + * or null if not found. + * + * @param {string} name - The name of the struct. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @return {?StructType} The struct type or null if not found. + */ + getStructTypeNode(name: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType | null; + /** + * Returns an instance of {@link StructType} for the given output struct node. + * + * @param {OutputStructNode} node - The output struct node. + * @param {Array} membersLayout - The output struct types. + * @param {?string} [name=null] - The name of the struct. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @return {StructType} The struct type attribute. + */ + getStructTypeFromNode(node: OutputStructNode, membersLayout: Array, name?: string | null, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType; + /** + * Returns an instance of {@link StructType} for the given output struct node. + * + * @param {OutputStructNode} node - The output struct node. + * @param {Array} membersLayout - The output struct types. + * @return {StructType} The struct type attribute. + */ + getOutputStructTypeFromNode(node: OutputStructNode, membersLayout: Array): StructType; + /** + * Returns an instance of {@link NodeUniform} for the given uniform node. + * + * @param {UniformNode} node - The uniform node. + * @param {string} type - The uniform type. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @param {?string} name - The name of the uniform. + * @return {NodeUniform} The node uniform. + */ + getUniformFromNode(node: UniformNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), name?: string | null): NodeUniform; + /** + * Returns an instance of {@link NodeVar} for the given variable node. + * + * @param {VarNode} node - The variable node. + * @param {?string} name - The variable's name. + * @param {string} [type=node.getNodeType( this )] - The variable's type. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @param {boolean} [readOnly=false] - Whether the variable is read-only or not. + * + * @return {NodeVar} The node variable. + */ + getVarFromNode(node: VarNode, name?: string | null, type?: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), readOnly?: boolean): NodeVar; + /** + * Returns whether a Node or its flow is deterministic, useful for use in `const`. + * + * @param {Node} node - The varying node. + * @return {boolean} Returns true if deterministic. + */ + isDeterministic(node: Node): boolean; + /** + * Returns an instance of {@link NodeVarying} for the given varying node. + * + * @param {(VaryingNode|PropertyNode)} node - The varying node. + * @param {?string} name - The varying's name. + * @param {string} [type=node.getNodeType( this )] - The varying's type. + * @param {?string} interpolationType - The interpolation type of the varying. + * @param {?string} interpolationSampling - The interpolation sampling type of the varying. + * @return {NodeVar} The node varying. + */ + getVaryingFromNode(node: (VaryingNode | PropertyNode), name?: string | null, type?: string, interpolationType?: string | null, interpolationSampling?: string | null): NodeVar; + /** + * Registers a node declaration in the current shader stage. + * + * @param {Object} node - The node to be registered. + */ + registerDeclaration(node: Object): void; + /** + * Returns an instance of {@link NodeCode} for the given code node. + * + * @param {CodeNode} node - The code node. + * @param {string} type - The node type. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @return {NodeCode} The node code. + */ + getCodeFromNode(node: CodeNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): NodeCode; + /** + * Adds a code flow based on the code-block hierarchy. + + * This is used so that code-blocks like If,Else create their variables locally if the Node + * is only used inside one of these conditionals in the current shader stage. + * + * @param {Node} node - The node to add. + * @param {Node} nodeBlock - Node-based code-block. Usually 'ConditionalNode'. + */ + addFlowCodeHierarchy(node: Node, nodeBlock: Node): void; + /** + * Add a inline-code to the current flow code-block. + * + * @param {Node} node - The node to add. + * @param {string} code - The code to add. + * @param {Node} nodeBlock - Current ConditionalNode + */ + addLineFlowCodeBlock(node: Node, code: string, nodeBlock: Node): void; + /** + * Add a inline-code to the current flow. + * + * @param {string} code - The code to add. + * @param {?Node} [node= null] - Optional Node, can help the system understand if the Node is part of a code-block. + * @return {NodeBuilder} A reference to this node builder. + */ + addLineFlowCode(code: string, node?: Node | null): NodeBuilder; + /** + * Adds a code to the current code flow. + * + * @param {string} code - Shader code. + * @return {NodeBuilder} A reference to this node builder. + */ + addFlowCode(code: string): NodeBuilder; + /** + * Add tab in the code that will be generated so that other snippets respect the current tabulation. + * Typically used in codes with If,Else. + * + * @return {NodeBuilder} A reference to this node builder. + */ + addFlowTab(): NodeBuilder; + /** + * Removes a tab. + * + * @return {NodeBuilder} A reference to this node builder. + */ + removeFlowTab(): NodeBuilder; + /** + * Gets the current flow data based on a Node. + * + * @param {Node} node - Node that the flow was started. + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {Object} The flow data. + */ + getFlowData(node: Node): Object; + /** + * Executes the node flow based on a root node to generate the final shader code. + * + * @param {Node} node - The node to execute. + * @return {Object} The code flow. + */ + flowNode(node: Node): Object; + /** + * Includes a node in the current function node. + * + * @param {Node} node - The node to include. + * @returns {void} + */ + addInclude(node: Node): void; + /** + * Returns the native shader operator name for a given generic name. + * It is a similar type of method like {@link NodeBuilder#getMethod}. + * + * @param {ShaderNodeInternal} shaderNode - The shader node to build the function node with. + * @return {FunctionNode} The build function node. + */ + buildFunctionNode(shaderNode: ShaderNodeInternal): FunctionNode; + /** + * Generates a code flow based on a TSL function: Fn(). + * + * @param {ShaderNodeInternal} shaderNode - A function code will be generated based on the input. + * @return {Object} + */ + flowShaderNode(shaderNode: ShaderNodeInternal): Object; + /** + * Executes the node in a specific build stage. + * + * This function can be used to arbitrarily execute the specified build stage + * outside of the standard build process. For instance, if a node's type depends + * on properties created by the 'setup' stage, then flowBuildStage(node, 'setup') + * can be used to execute the setup build stage and access its generated nodes + * before the standard build process begins. + * + * @param {Node} node - The node to execute. + * @param {string} buildStage - The build stage to execute the node in. + * @param {?(Node|string)} [output=null] - Expected output type. For example 'vec3'. + * @return {?(Node|string)} The result of the node build. + */ + flowBuildStage(node: Node, buildStage: string, output?: (Node | string) | null): (Node | string) | null; + /** + * Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'. + * + * @param {Node} node - The node to execute. + * @param {?string} output - Expected output type. For example 'vec3'. + * @return {Object} + */ + flowStagesNode(node: Node, output?: string | null): Object; + /** + * Returns the native shader operator name for a given generic name. + * It is a similar type of method like {@link NodeBuilder#getMethod}. + * + * @abstract + * @param {string} op - The operator name to resolve. + * @return {?string} The resolved operator name. + */ + getFunctionOperator(): string | null; + /** + * Builds the given shader node. + * + * @abstract + * @param {ShaderNodeInternal} shaderNode - The shader node. + * @return {string} The function code. + */ + buildFunctionCode(): string; + /** + * Generates a code flow based on a child Node. + * + * @param {Node} node - The node to execute. + * @param {?string} output - Expected output type. For example 'vec3'. + * @return {Object} The code flow. + */ + flowChildNode(node: Node, output?: string | null): Object; + /** + * Executes a flow of code in a different stage. + * + * Some nodes like `varying()` have the ability to compute code in vertex-stage and + * return the value in fragment-stage even if it is being executed in an input fragment. + * + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @param {Node} node - The node to execute. + * @param {?string} output - Expected output type. For example 'vec3'. + * @param {?string} propertyName - The property name to assign the result. + * @return {?(Object|Node)} The code flow or node.build() result. + */ + flowNodeFromShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any"), node: Node, output?: string | null, propertyName?: string | null): (Object | Node) | null; + /** + * Returns an array holding all node attributes of this node builder. + * + * @return {Array} The node attributes of this builder. + */ + getAttributesArray(): Array; + /** + * Returns the attribute definitions as a shader string for the given shader stage. + * + * @abstract + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The attribute code section. + */ + getAttributes(): string; + /** + * Returns the varying definitions as a shader string for the given shader stage. + * + * @abstract + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The varying code section. + */ + getVaryings(): string; + /** + * Returns a single variable definition as a shader string for the given variable type and name. + * + * @param {string} type - The variable's type. + * @param {string} name - The variable's name. + * @param {?number} [count=null] - The array length. + * @return {string} The shader string. + */ + getVar(type: string, name: string, count?: number | null): string; + /** + * Returns the variable definitions as a shader string for the given shader stage. + * + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @param {boolean} [global=false] - Whether the variables are global. + * @return {string} The variable code section. + */ + getVars(shaderStage: ("vertex" | "fragment" | "compute" | "any"), global?: boolean): string; + /** + * Returns the uniform definitions as a shader string for the given shader stage. + * + * @abstract + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The uniform code section. + */ + getUniforms(): string; + /** + * Returns the native code definitions as a shader string for the given shader stage. + * + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The native code section. + */ + getCodes(shaderStage: ("vertex" | "fragment" | "compute" | "any")): string; + /** + * Returns the hash of this node builder. + * + * @return {string} The hash. + */ + getHash(): string; + /** + * Sets the current shader stage. + * + * @param {?('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage to set. + */ + setShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any") | null): void; + /** + * Returns the current shader stage. + * + * @return {?('vertex'|'fragment'|'compute'|'any')} The current shader stage. + */ + getShaderStage(): ("vertex" | "fragment" | "compute" | "any") | null; + /** + * Sets the current build stage. + * + * @param {?('setup'|'analyze'|'generate')} buildStage - The build stage to set. + */ + setBuildStage(buildStage: ("setup" | "analyze" | "generate") | null): void; + /** + * Returns the current build stage. + * + * @return {?('setup'|'analyze'|'generate')} The current build stage. + */ + getBuildStage(): ("setup" | "analyze" | "generate") | null; + /** + * Controls the code build of the shader stages. + * + * @abstract + */ + buildCode(): void; + /** + * Returns the current sub-build layer. + * + * @return {SubBuildNode} The current sub-build layers. + */ + get subBuild(): SubBuildNode; + /** + * Adds a sub-build layer to the node builder. + * + * @param {SubBuildNode} subBuild - The sub-build layer to add. + */ + addSubBuild(subBuild: SubBuildNode): void; + /** + * Removes the last sub-build layer from the node builder. + * + * @return {SubBuildNode} The removed sub-build layer. + */ + removeSubBuild(): SubBuildNode; + /** + * Returns the closest sub-build layer for the given data. + * + * @param {Node|Set|Array} data - The data to get the closest sub-build layer from. + * @return {?string} The closest sub-build name or null if none found. + */ + getClosestSubBuild(data: Node | Set | Array): string | null; + /** + * Returns the output node of a sub-build layer. + * + * @param {Node} node - The node to get the output from. + * @return {string} The output node name. + */ + getSubBuildOutput(node: Node): string; + /** + * Returns the sub-build property name for the given property and node. + * + * @param {string} [property=''] - The property name. + * @param {?Node} [node=null] - The node to get the sub-build from. + * @return {string} The sub-build property name. + */ + getSubBuildProperty(property?: string, node?: Node | null): string; + /** + * Prebuild the node builder. + */ + prebuild(): void; + /** + * Central build method which controls the build for the given object. + * + * @return {NodeBuilder} A reference to this node builder. + */ + build(): NodeBuilder; + /** + * Async version of build() that yields to main thread between shader stages. + * Use this in compileAsync() to prevent blocking the main thread. + * + * @return {Promise} A promise that resolves to this node builder. + */ + buildAsync(): Promise; + /** + * Returns shared data object for the given node. + * + * @param {Node} node - The node to get shared data from. + * @return {Object} The shared data. + */ + getSharedDataFromNode(node: Node): Object; + /** + * Returns a uniform representation which is later used for UBO generation and rendering. + * + * @param {NodeUniform} uniformNode - The uniform node. + * @param {string} type - The requested type. + * @return {Uniform} The uniform. + */ + getNodeUniform(uniformNode: NodeUniform, type: string): Uniform; + /** + * Formats the given shader snippet from a given type into another one. E.g. + * this method might be used to convert a simple float string `"1.0"` into a + * `vec3` representation: `"vec3( 1.0 )"`. + * + * @param {string} snippet - The shader snippet. + * @param {string} fromType - The source type. + * @param {string} toType - The target type. + * @return {string} The updated shader string. + */ + format(snippet: string, fromType: string, toType: string): string; + /** + * Returns a signature with the engine's current revision. + * + * @return {string} The signature. + */ + getSignature(): string; + /** + * Returns `true` if data from the previous frame are required. Relevant + * when computing motion vectors with {@link VelocityNode}. + * + * @return {boolean} Whether data from the previous frame are required or not. + */ + needsPreviousData(): boolean; +} +/** + * This utility class is used in {@link NodeBuilder} as an internal + * cache data structure for node data. + */ +export class NodeCache { + /** + * Constructs a new node cache. + * + * @param {?NodeCache} parent - A reference to a parent cache. + */ + constructor(parent?: NodeCache | null); + /** + * The id of the cache. + * + * @type {number} + * @readonly + */ + readonly id: number; + /** + * A weak map for managing node data. + * + * @type {WeakMap} + */ + nodesData: WeakMap; + /** + * Reference to a parent node cache. + * + * @type {?NodeCache} + * @default null + */ + parent: NodeCache | null; + /** + * Returns the data for the given node. + * + * @param {Node} node - The node. + * @return {?Object} The data for the node. + */ + getData(node: Node): Object | null; + /** + * Sets the data for a given node. + * + * @param {Node} node - The node. + * @param {Object} data - The data that should be cached. + */ + setData(node: Node, data: Object): void; +} +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent user-defined, native shader code portions that are going to be + * injected by the builder. A dictionary of node codes is maintained in {@link NodeBuilder#codes} + * for this purpose. + */ +export class NodeCode { + /** + * Constructs a new code node. + * + * @param {string} name - The name of the code. + * @param {string} type - The node type. + * @param {string} [code=''] - The native shader code. + */ + constructor(name: string, type: string, code?: string); + /** + * The name of the code. + * + * @type {string} + */ + name: string; + /** + * The node type. + * + * @type {string} + */ + type: string; + /** + * The native shader code. + * + * @type {string} + * @default '' + */ + code: string; +} +/** + * Custom error class for node-related errors, including stack trace information. + */ +export class NodeError extends Error { + constructor(message: any, stackTrace?: null); + /** + * The stack trace associated with the error. + * + * @type {?StackTrace} + */ + stackTrace: StackTrace | null; +} +/** + * Management class for updating nodes. The module tracks metrics like + * the elapsed time, delta time, the render and frame ID to correctly + * call the node update methods {@link Node#updateBefore}, {@link Node#update} + * and {@link Node#updateAfter} depending on the node's configuration. + */ +export class NodeFrame { + /** + * The elapsed time in seconds. + * + * @type {number} + * @default 0 + */ + time: number; + /** + * The delta time in seconds. + * + * @type {number} + * @default 0 + */ + deltaTime: number; + /** + * The frame ID. + * + * @type {number} + * @default 0 + */ + frameId: number; + /** + * The render ID. + * + * @type {number} + * @default 0 + */ + renderId: number; + /** + * Used to control the {@link Node#update} call. + * + * @type {WeakMap} + */ + updateMap: WeakMap; + /** + * Used to control the {@link Node#updateBefore} call. + * + * @type {WeakMap} + */ + updateBeforeMap: WeakMap; + /** + * Used to control the {@link Node#updateAfter} call. + * + * @type {WeakMap} + */ + updateAfterMap: WeakMap; + /** + * A reference to the current renderer. + * + * @type {?Renderer} + * @default null + */ + renderer: Renderer | null; + /** + * A reference to the current material. + * + * @type {?Material} + * @default null + */ + material: Material | null; + /** + * A reference to the current camera. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * A reference to the current 3D object. + * + * @type {?Object3D} + * @default null + */ + object: Object3D | null; + /** + * A reference to the current scene. + * + * @type {?Scene} + * @default null + */ + scene: Scene | null; + /** + * Returns a dictionary for a given node and update map which + * is used to correctly call node update methods per frame or render. + * + * @private + * @param {WeakMap} referenceMap - The reference weak map. + * @param {Node} nodeRef - The reference to the current node. + * @return {Object>} The dictionary. + */ + private _getMaps; + /** + * This method executes the {@link Node#updateBefore} for the given node. + * It makes sure {@link Node#updateBeforeType} is honored meaning the update + * is only executed once per frame, render or object depending on the update + * type. + * + * @param {Node} node - The node that should be updated. + */ + updateBeforeNode(node: Node): void; + /** + * This method executes the {@link Node#updateAfter} for the given node. + * It makes sure {@link Node#updateAfterType} is honored meaning the update + * is only executed once per frame, render or object depending on the update + * type. + * + * @param {Node} node - The node that should be updated. + */ + updateAfterNode(node: Node): void; + /** + * This method executes the {@link Node#update} for the given node. + * It makes sure {@link Node#updateType} is honored meaning the update + * is only executed once per frame, render or object depending on the update + * type. + * + * @param {Node} node - The node that should be updated. + */ + updateNode(node: Node): void; + /** + * Updates the internal state of the node frame. This method is + * called by the renderer in its internal animation loop. + */ + update(): void; + lastTime: number | undefined; +} +/** + * Describes the input of a {@link NodeFunction}. + */ +export class NodeFunctionInput { + /** + * Constructs a new node function input. + * + * @param {string} type - The input type. + * @param {string} name - The input name. + * @param {?number} [count=null] - If the input is an Array, count will be the length. + * @param {('in'|'out'|'inout')} [qualifier=''] - The parameter qualifier (only relevant for GLSL). + * @param {boolean} [isConst=false] - Whether the input uses a const qualifier or not (only relevant for GLSL). + */ + constructor(type: string, name: string, count?: number | null, qualifier?: ("in" | "out" | "inout"), isConst?: boolean); + /** + * The input type. + * + * @type {string} + */ + type: string; + /** + * The input name. + * + * @type {string} + */ + name: string; + /** + * If the input is an Array, count will be the length. + * + * @type {?number} + * @default null + */ + count: number | null; + /** + *The parameter qualifier (only relevant for GLSL). + * + * @type {('in'|'out'|'inout')} + * @default '' + */ + qualifier: ("in" | "out" | "inout"); + /** + * Whether the input uses a const qualifier or not (only relevant for GLSL). + * + * @type {boolean} + * @default false + */ + isConst: boolean; +} +export namespace NodeFunctionInput { + let isNodeFunctionInput: boolean; +} +/** + * A loader for loading node objects in the three.js JSON Object/Scene format. + * + * @augments Loader + */ +export class NodeLoader extends Loader { + /** + * Constructs a new node loader. + * + * @param {LoadingManager} [manager] - A reference to a loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Represents a dictionary of textures. + * + * @type {Object} + */ + textures: { + [x: string]: Texture; + }; + /** + * Represents a dictionary of node types. + * + * @type {Object} + */ + nodes: { + [x: string]: Node.constructor; + }; + /** + * Loads the node definitions from the given URL. + * + * @param {string} url - The path/URL of the file to be loaded. + * @param {Function} onLoad - Will be called when load completes. + * @param {Function} onProgress - Will be called while load progresses. + * @param {Function} onError - Will be called when errors are thrown during the loading process. + */ + load(url: string, onLoad: Function, onProgress: Function, onError: Function): void; + /** + * Parse the node dependencies for the loaded node. + * + * @param {Array} [json] - The JSON definition + * @return {Object} A dictionary with node dependencies. + */ + parseNodes(json?: Array): { + [x: string]: Node; + }; + /** + * Parses the node from the given JSON. + * + * @param {Object} json - The JSON definition + * @param {string} json.type - The node type. + * @param {string} json.uuid - The node UUID. + * @param {Array} [json.nodes] - The node dependencies. + * @param {Object} [json.meta] - The meta data. + * @return {Node} The parsed node. + */ + parse(json: { + type: string; + uuid: string; + nodes?: Object[] | undefined; + meta?: Object | undefined; + }): Node; + /** + * Defines the dictionary of textures. + * + * @param {Object} value - The texture library defines as ``. + * @return {NodeLoader} A reference to this loader. + */ + setTextures(value: { + [x: string]: Texture; + }): NodeLoader; + /** + * Defines the dictionary of node types. + * + * @param {Object} value - The node library defined as ``. + * @return {NodeLoader} A reference to this loader. + */ + setNodes(value: { + [x: string]: Node.constructor; + }): NodeLoader; + /** + * Creates a node object from the given type. + * + * @param {string} type - The node type. + * @return {Node} The created node instance. + */ + createNodeFromType(type: string): Node; +} +/** + * Base class for all node materials. + * + * @augments Material + */ +export class NodeMaterial extends Material { + static get type(): string; + set type(_value: string); + /** + * Represents the type of the node material. + * + * @type {string} + */ + get type(): string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeMaterial: boolean; + /** + * Whether this material is affected by lights or not. + * + * @type {boolean} + * @default false + */ + lights: boolean; + /** + * Node materials which set their `lights` property to `true` + * are affected by all lights of the scene. Sometimes selective + * lighting is wanted which means only _some_ lights in the scene + * affect a material. This can be achieved by creating an instance + * of {@link LightsNode} with a list of selective + * lights and assign the node to this property. + * + * ```js + * const customLightsNode = lights( [ light1, light2 ] ); + * material.lightsNode = customLightsNode; + * ``` + * + * @type {?LightsNode} + * @default null + */ + lightsNode: LightsNode | null; + /** + * The environment of node materials can be defined by an environment + * map assigned to the `envMap` property or by `Scene.environment` + * if the node material is a PBR material. This node property allows to overwrite + * the default behavior and define the environment with a custom node. + * + * ```js + * material.envNode = pmremTexture( renderTarget.texture ); + * ``` + * + * @type {?Node} + * @default null + */ + envNode: Node | null; + /** + * The lighting of node materials might be influenced by ambient occlusion. + * The default AO is inferred from an ambient occlusion map assigned to `aoMap` + * and the respective `aoMapIntensity`. This node property allows to overwrite + * the default and define the ambient occlusion with a custom node instead. + * + * If you don't want to overwrite the diffuse color but modify the existing + * values instead, use {@link materialAO}. + * + * @type {?Node} + * @default null + */ + aoNode: Node | null; + /** + * The diffuse color of node materials is by default inferred from the + * `color` and `map` properties. This node property allows to overwrite the default + * and define the diffuse color with a node instead. + * + * ```js + * material.colorNode = color( 0xff0000 ); // define red color + * ``` + * + * If you don't want to overwrite the diffuse color but modify the existing + * values instead, use {@link materialColor}. + * + * ```js + * material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint + * ``` + * + * @type {?Node} + * @default null + */ + colorNode: Node | null; + /** + * The normals of node materials are by default inferred from the `normalMap`/`normalScale` + * or `bumpMap`/`bumpScale` properties. This node property allows to overwrite the default + * and define the normals with a node instead. + * + * If you don't want to overwrite the normals but modify the existing values instead, + * use {@link materialNormal}. + * + * @type {?Node} + * @default null + */ + normalNode: Node | null; + /** + * The opacity of node materials is by default inferred from the `opacity` + * and `alphaMap` properties. This node property allows to overwrite the default + * and define the opacity with a node instead. + * + * If you don't want to overwrite the opacity but modify the existing + * value instead, use {@link materialOpacity}. + * + * @type {?Node} + * @default null + */ + opacityNode: Node | null; + /** + * This node can be used to implement a variety of filter-like effects. The idea is + * to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it + * to create an arbitrary effect and then assign the node composition to this property. + * Everything behind the object using this material will now be affected by a filter. + * + * ```js + * const material = new NodeMaterial() + * material.transparent = true; + * + * // everything behind the object will be monochromatic + * material.backdropNode = saturation( viewportSharedTexture().rgb, 0 ); + * ``` + * + * Backdrop computations are part of the lighting so only lit materials can use this property. + * + * @type {?Node} + * @default null + */ + backdropNode: Node | null; + /** + * This node allows to modulate the influence of `backdropNode` to the outgoing light. + * + * @type {?Node} + * @default null + */ + backdropAlphaNode: Node | null; + /** + * The alpha test of node materials is by default inferred from the `alphaTest` + * property. This node property allows to overwrite the default and define the + * alpha test with a node instead. + * + * If you don't want to overwrite the alpha test but modify the existing + * value instead, use {@link materialAlphaTest}. + * + * @type {?Node} + * @default null + */ + alphaTestNode: Node | null; + /** + * Discards the fragment if the mask value is `false`. + * + * @type {?Node} + * @default null + */ + maskNode: Node | null; + /** + * This node can be used to implement a shadow mask for the material. + * + * @type {?Node} + * @default null + */ + maskShadowNode: Node | null; + /** + * The local vertex positions are computed based on multiple factors like the + * attribute data, morphing or skinning. This node property allows to overwrite + * the default and define local vertex positions with nodes instead. + * + * If you don't want to overwrite the vertex positions but modify the existing + * values instead, use {@link positionLocal}. + * + *```js + * material.positionNode = positionLocal.add( displace ); + * ``` + * + * @type {?Node} + * @default null + */ + positionNode: Node | null; + /** + * This node property is intended for logic which modifies geometry data once or per animation step. + * Apps usually place such logic randomly in initialization routines or in the animation loop. + * `geometryNode` is intended as a dedicated API so there is an intended spot where geometry modifications + * can be implemented. + * + * The idea is to assign a `Fn` definition that holds the geometry modification logic. A typical example + * would be a GPU based particle system that provides a node material for usage on app level. The particle + * simulation would be implemented as compute shaders and managed inside a `Fn` function. This function is + * eventually assigned to `geometryNode`. + * + * @type {?Function} + * @default null + */ + geometryNode: Function | null; + /** + * Allows to overwrite depth values in the fragment shader. + * + * @type {?Node} + * @default null + */ + depthNode: Node | null; + /** + * Allows to overwrite the position used for shadow map rendering which + * is by default {@link positionWorld}, the vertex position + * in world space. + * + * @type {?Node} + * @default null + */ + receivedShadowPositionNode: Node | null; + /** + * Allows to overwrite the geometry position used for shadow map projection which + * is by default {@link positionLocal}, the vertex position in local space. + * + * @type {?Node} + * @default null + */ + castShadowPositionNode: Node | null; + /** + * This node can be used to influence how an object using this node material + * receive shadows. + * + * ```js + * const totalShadows = float( 1 ).toVar(); + * material.receivedShadowNode = Fn( ( [ shadow ] ) => { + * totalShadows.mulAssign( shadow ); + * //return float( 1 ); // bypass received shadows + * return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color + * } ); + * + * @type {?(Function|FunctionNode)} + * @default null + */ + receivedShadowNode: (Function | FunctionNode) | null; + /** + * This node can be used to influence how an object using this node material + * casts shadows. To apply a color to shadows, you can simply do: + * + * ```js + * material.castShadowNode = vec4( 1, 0, 0, 1 ); + * ``` + * + * Which can be nice to fake colored shadows of semi-transparent objects. It + * is also common to use the property with `Fn` function so checks are performed + * per fragment. + * + * ```js + * materialCustomShadow.castShadowNode = Fn( () => { + * hash( vertexIndex ).greaterThan( 0.5 ).discard(); + * return materialColor; + * } )(); + * ``` + * + * @type {?Node} + * @default null + */ + castShadowNode: Node | null; + /** + * This node can be used to overwrite the final output of the material. + * + * Unlike {@link NodeMaterial#fragmentNode}, the built-in material logic + * (diffuse color, lighting, etc.) is still evaluated; assigning a node + * only replaces the resulting output color. + * + * @type {?Node} + * @default null + */ + outputNode: Node | null; + /** + * MRT configuration is done on renderer or pass level. This node allows to + * overwrite what values are written into MRT targets on material level. This + * can be useful for implementing selective FX features that should only affect + * specific objects. + * + * @type {?MRTNode} + * @default null + */ + mrtNode: MRTNode | null; + /** + * This node property can be used if you need complete freedom in implementing + * the fragment shader. Assigning a node will replace the built-in material + * logic used in the fragment stage. + * + * @type {?Node} + * @default null + */ + fragmentNode: Node | null; + /** + * This node property can be used if you need complete freedom in implementing + * the vertex shader. Assigning a node will replace the built-in material logic + * used in the vertex stage. + * + * @type {?Node} + * @default null + */ + vertexNode: Node | null; + /** + * This node can be used as a global context management component for this material. + * + * @type {?ContextNode} + * @default null + */ + contextNode: ContextNode | null; + /** + * Returns an array of child nodes for this material. + * + * @private + * @returns {Array<{property: string, childNode: Node}>} + */ + private _getNodeChildren; + /** + * Builds this material with the given node builder. + * + * @param {NodeBuilder} builder - The current node builder. + */ + build(builder: NodeBuilder): void; + /** + * Setups a node material observer with the given builder. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {NodeMaterialObserver} The node material observer. + */ + setupObserver(builder: NodeBuilder): NodeMaterialObserver; + /** + * Setups the vertex and fragment stage of this node material. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * Setups the clipping node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ClippingNode} The clipping node. + */ + setupClipping(builder: NodeBuilder): ClippingNode; + /** + * Setups the hardware clipping if available on the current device. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupHardwareClipping(builder: NodeBuilder): void; + /** + * Setups the depth of this material. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupDepth(builder: NodeBuilder): void; + /** + * Setups the position node in view space. This method exists + * so derived node materials can modify the implementation e.g. sprite materials. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in view space. + */ + setupPositionView(): Node; + /** + * Setups the position in clip space. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in view space. + */ + setupModelViewProjection(): Node; + /** + * Setups the logic for the vertex stage. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in clip space. + */ + setupVertex(builder: NodeBuilder): Node; + /** + * Setups the computation of the position in local space. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in local space. + */ + setupPosition(builder: NodeBuilder): Node; + /** + * Setups the computation of the material's diffuse color. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupDiffuseColor(builder: NodeBuilder): void; + /** + * Abstract interface method that can be implemented by derived materials + * to setup material-specific node variables. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + setupVariants(): void; + /** + * Setups the outgoing light node variable + * + * @return {Node} The outgoing light node. + */ + setupOutgoingLight(): Node; + /** + * Setups the normal node from the material. + * + * @return {Node} The normal node. + */ + setupNormal(): Node; + /** + * Setups the environment node from the material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The environment node. + */ + setupEnvironment(): Node; + /** + * Setups the light map node from the material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The light map node. + */ + setupLightMap(builder: NodeBuilder): Node; + /** + * Setups the lights node based on the scene, environment and material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {LightingNode} The lights node. + */ + setupMaterialLightings(builder: NodeBuilder): LightingNode; + /** + * Setups the ambient occlusion node from the material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The ambient occlusion node. + */ + setupAmbientOcclusion(builder: NodeBuilder): Node; + /** + * This method should be implemented by most derived materials + * since it defines the material's lighting model. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + * @return {LightingModel} The lighting model. + */ + setupLightingModel(): LightingModel; + /** + * Setups the outgoing light node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The outgoing light node. + */ + setupLighting(builder: NodeBuilder): Node; + /** + * Setup the fog. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} outputNode - The existing output node. + * @return {Node} The output node. + */ + setupFog(builder: NodeBuilder, outputNode: Node): Node; + /** + * Setups premultiplied alpha. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} outputNode - The existing output node. + * @return {Node} The output node. + */ + setupPremultipliedAlpha(builder: NodeBuilder, outputNode: Node): Node; + /** + * Setups the output node. + * + * This method can be implemented by derived materials to extend the functionality + * of the material's output or replace it altogether. + * + * ```js + * class ColoredShadowMaterial extends MeshPhongNodeMaterial { + * constructor( parameters ) { + * super( parameters ); + * this._shadeColor = uniform( new Color( parameters.shadeColor ?? 0xff0000 ) ); + * } + * + * setupOutput( builder, outputNode ) { + * // Modify the native output of the MeshPhongNodeMaterial fragment shader + * const brightness = min( outputNode.r, 1.0 ); + * const mixedColor = mix( this._shadeColor, diffuseColor.rgb, brightness ); + * // Return new output back into NodeMaterial flow + * return super.setupOutput( builder, vec4( mixedColor, outputNode.a ) ); + * } + * } + * ``` + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} outputNode - The existing output node. + * @return {Node} The output node. + */ + setupOutput(builder: NodeBuilder, outputNode: Node): Node; + /** + * Most classic material types have a node pendant e.g. for `MeshBasicMaterial` + * there is `MeshBasicNodeMaterial`. This utility method is intended for + * defining all material properties of the classic type in the node type. + * + * @param {Material} material - The material to copy properties with their values to this node material. + */ + setDefaultValues(material: Material): void; + /** + * Copies the common properties of the given material to this instance. + * + * @param {Material} source - The material to copy. + * @return {NodeMaterial} A reference to this node material. + */ + copy(source: Material): NodeMaterial; +} +/** + * A special type of material loader for loading node materials. + * + * @augments MaterialLoader + */ +export class NodeMaterialLoader extends MaterialLoader { + /** + * Constructs a new node material loader. + * + * @param {LoadingManager} [manager] - A reference to a loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Represents a dictionary of node types. + * + * @type {Object} + */ + nodes: { + [x: string]: Node.constructor; + }; + /** + * Represents a dictionary of node material types. + * + * @type {Object} + */ + nodeMaterials: { + [x: string]: NodeMaterial.constructor; + }; + /** + * Parses the node material from the given JSON. + * + * @param {Object} json - The JSON definition + * @return {NodeMaterial}. The parsed material. + */ + parse(json: Object): NodeMaterial; + /** + * Defines the dictionary of node types. + * + * @param {Object} value - The node library defined as ``. + * @return {NodeLoader} A reference to this loader. + */ + setNodes(value: { + [x: string]: Node.constructor; + }): NodeLoader; + /** + * Defines the dictionary of node material types. + * + * @param {Object} value - The node material library defined as ``. + * @return {NodeLoader} A reference to this loader. + */ + setNodeMaterials(value: { + [x: string]: NodeMaterial.constructor; + }): NodeLoader; + /** + * Creates a node material from the given type. + * + * @param {string} type - The node material type. + * @return {Node} The created node material instance. + */ + createMaterialFromType(type: string): Node; +} +/** + * This class is used by {@link WebGPURenderer} as management component. + * It's primary purpose is to determine whether render objects require a + * refresh right before they are going to be rendered or not. + */ +export class NodeMaterialObserver { + /** + * Constructs a new node material observer. + * + * @param {NodeBuilder} builder - The node builder. + */ + constructor(builder: NodeBuilder); + /** + * A node material can be used by more than one render object so the + * monitor must maintain a list of render objects. + * + * @type {WeakMap} + */ + renderObjects: WeakMap; + /** + * Whether the material uses node objects or not. + * + * @type {boolean} + */ + hasNode: boolean; + /** + * Whether the node builder's 3D object is animated or not. + * + * @type {boolean} + */ + hasAnimation: boolean; + /** + * A list of all possible material uniforms + * + * @type {Array} + */ + refreshUniforms: Array; + /** + * Holds the current render ID from the node frame. + * + * @type {number} + * @default 0 + */ + renderId: number; + /** + * Returns `true` if the given render object is verified for the first time of this observer. + * + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether the given render object is verified for the first time of this observer. + */ + firstInitialization(renderObject: RenderObject): boolean; + /** + * Returns `true` if the given 3D object uses instance buffers with dynamic draw usage. + * Such buffers must be uploaded once per render so the render object requires a full refresh. + * + * @param {Object3D} object - The 3D object. + * @return {boolean} Whether the given 3D object uses instance buffers with dynamic draw usage or not. + */ + hasDynamicInstancing(object: Object3D): boolean; + /** + * Returns `true` if the current rendering produces motion vectors. + * + * @param {Renderer} renderer - The renderer. + * @return {boolean} Whether the current rendering produces motion vectors or not. + */ + needsVelocity(renderer: Renderer): boolean; + /** + * Returns monitoring data for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {Object} The monitoring data. + */ + getRenderObjectData(renderObject: RenderObject): Object; + /** + * Returns an attribute data structure holding the attributes versions for + * monitoring. + * + * @param {Object} attributes - The geometry attributes. + * @return {Object} An object for monitoring the versions of attributes. + */ + getAttributesData(attributes: Object): Object; + /** + * Returns `true` if the node builder's material uses + * node properties. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether the node builder's material uses node properties or not. + */ + containsNode(builder: NodeBuilder): boolean; + /** + * Returns a geometry data structure holding the geometry property values for + * monitoring. + * + * @param {BufferGeometry} geometry - The geometry. + * @return {Object} An object for monitoring geometry properties. + */ + getGeometryData(geometry: BufferGeometry): Object; + /** + * Returns a texture data structure holding the texture state for + * monitoring. + * + * @param {Texture} texture - The texture. + * @return {Object} An object for monitoring the texture. + */ + getTextureData(texture: Texture): Object; + /** + * Returns a material data structure holding the material property values for + * monitoring. + * + * @param {Material} material - The material. + * @return {Object} An object for monitoring material properties. + */ + getMaterialData(material: Material): Object; + /** + * Returns `true` if the given render object has not changed its state. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} lightsData - The current material lights. + * @param {number} renderId - The current render ID. + * @return {boolean} Whether the given render object is equal to its cached state or not. + */ + equals(renderObject: RenderObject, lightsData: Array, renderId: number): boolean; + /** + * Returns the lights data for the given material lights. + * + * @param {Array} materialLights - The material lights. + * @return {Array} The lights data for the given material lights. + */ + getLightsData(materialLights: Array, lights: any): Array; + /** + * Returns the lights for the given lights node and render ID. + * + * @param {LightsNode} lightsNode - The lights node. + * @param {number} renderId - The render ID. + * @return {Array} The lights for the given lights node and render ID. + */ + getLights(lightsNode: LightsNode, renderId: number): Array; + /** + * Checks if the given render object requires a refresh. + * + * @param {RenderObject} renderObject - The render object. + * @param {NodeFrame} nodeFrame - The current node frame. + * @return {number} The refresh type, see {@link RenderObjectRefreshType}. + */ + needsRefresh(renderObject: RenderObject, nodeFrame: NodeFrame): number; +} +/** + * A special type of object loader for loading 3D objects using + * node materials. + * + * @augments ObjectLoader + */ +export class NodeObjectLoader extends ObjectLoader { + /** + * Constructs a new node object loader. + * + * @param {LoadingManager} [manager] - A reference to a loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Represents a dictionary of node types. + * + * @type {Object} + */ + nodes: { + [x: string]: Node.constructor; + }; + /** + * Represents a dictionary of node material types. + * + * @type {Object} + */ + nodeMaterials: { + [x: string]: NodeMaterial.constructor; + }; + /** + * A reference to hold the `nodes` JSON property. + * + * @private + * @type {?Object[]} + */ + private _nodesJSON; + /** + * Defines the dictionary of node types. + * + * @param {Object} value - The node library defined as ``. + * @return {NodeObjectLoader} A reference to this loader. + */ + setNodes(value: { + [x: string]: Node.constructor; + }): NodeObjectLoader; + /** + * Defines the dictionary of node material types. + * + * @param {Object} value - The node material library defined as ``. + * @return {NodeObjectLoader} A reference to this loader. + */ + setNodeMaterials(value: { + [x: string]: NodeMaterial.constructor; + }): NodeObjectLoader; + /** + * Parses the node objects from the given JSON. + * + * @param {Object} json - The JSON definition + * @param {Function} onLoad - The onLoad callback function. + * @return {Object3D}. The parsed 3D object. + */ + parse(json: Object, onLoad: Function): Object3D; + /** + * Parses the node objects from the given JSON and textures. + * + * @param {Object[]} json - The JSON definition + * @param {Object} textures - The texture library. + * @return {Object}. The parsed nodes. + */ + parseNodes(json: Object[], textures: { + [x: string]: Texture; + }): { + [x: string]: Node; + }; + /** + * Parses the node objects from the given JSON and textures. + * + * @param {Object} json - The JSON definition + * @param {Object} textures - The texture library. + * @return {Object}. The parsed materials. + */ + parseMaterials(json: Object, textures: { + [x: string]: Texture; + }): { + [x: string]: NodeMaterial; + }; +} +export namespace NodeShaderStage { + let VERTEX_1: string; + export { VERTEX_1 as VERTEX }; + export let FRAGMENT: string; +} +export namespace NodeType { + let BOOLEAN: string; + let INTEGER: string; + let FLOAT: string; + let VECTOR2: string; + let VECTOR3: string; + let VECTOR4: string; + let MATRIX2: string; + let MATRIX3: string; + let MATRIX4: string; +} +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader uniforms that are going to be generated + * by the builder. A dictionary of node uniforms is maintained in {@link NodeBuilder#uniforms} + * for this purpose. + */ +export class NodeUniform { + /** + * Constructs a new node uniform. + * + * @param {string} name - The name of the uniform. + * @param {string} type - The type of the uniform. + * @param {UniformNode} node - An reference to the node. + */ + constructor(name: string, type: string, node: UniformNode); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeUniform: boolean; + /** + * The name of the uniform. + * + * @type {string} + */ + name: string; + /** + * The type of the uniform. + * + * @type {string} + */ + type: string; + /** + * An reference to the node. + * + * @type {UniformNode} + */ + node: UniformNode; + set value(val: any); + /** + * The value of the uniform node. + * + * @type {any} + */ + get value(): any; + /** + * The id of the uniform node. + * + * @type {number} + */ + get id(): number; + /** + * The uniform node's group. + * + * @type {UniformGroupNode} + */ + get groupNode(): UniformGroupNode; +} +export namespace NodeUpdateType { + export let NONE: string; + let FRAME_1: string; + export { FRAME_1 as FRAME }; + export let RENDER: string; + let OBJECT_1: string; + export { OBJECT_1 as OBJECT }; +} +export var NodeUtils: Readonly<{ + __proto__: null; + arrayBufferToBase64: typeof arrayBufferToBase64; + base64ToArrayBuffer: typeof base64ToArrayBuffer; + getAlignmentFromType: typeof getAlignmentFromType; + getDataFromObject: typeof getDataFromObject; + getLengthFromType: typeof getLengthFromType; + getMemoryLengthFromType: typeof getMemoryLengthFromType; + getTextureType: typeof getTextureType; + getTypeFromLength: typeof getTypeFromLength; + getTypedArrayFromType: typeof getTypedArrayFromType; + getValueFromType: typeof getValueFromType; + getValueType: typeof getValueType; + hash: (...params: number[]) => number; + hashArray: (array: Array) => number; + hashString: (str: string) => number; + isArrayAsParameter: typeof isArrayAsParameter; +}>; +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader variables that are going to be generated + * by the builder. A dictionary of node variables is maintained in {@link NodeBuilder#vars} for + * this purpose. + */ +export class NodeVar { + /** + * Constructs a new node variable. + * + * @param {string} name - The name of the variable. + * @param {string} type - The type of the variable. + * @param {boolean} [readOnly=false] - The read-only flag. + * @param {?number} [count=null] - The size. + */ + constructor(name: string, type: string, readOnly?: boolean, count?: number | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeVar: boolean; + /** + * The name of the variable. + * + * @type {string} + */ + name: string; + /** + * The type of the variable. + * + * @type {string} + */ + type: string; + /** + * The read-only flag. + * + * @type {boolean} + */ + readOnly: boolean; + /** + * The size. + * + * @type {?number} + */ + count: number | null; +} +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader varyings that are going to be generated + * by the builder. An array of node varyings is maintained in {@link NodeBuilder#varyings} for + * this purpose. + * + * @augments NodeVar + */ +export class NodeVarying extends NodeVar { + /** + * Constructs a new node varying. + * + * @param {string} name - The name of the varying. + * @param {string} type - The type of the varying. + * @param {?string} interpolationType - The interpolation type of the varying. + * @param {?string} interpolationSampling - The interpolation sampling type of the varying. + */ + constructor(name: string, type: string, interpolationType?: string | null, interpolationSampling?: string | null); + /** + * Whether this varying requires interpolation or not. This property can be used + * to check if the varying can be optimized for a variable. + * + * @type {boolean} + * @default false + */ + needsInterpolation: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeVarying: boolean; + /** + * The interpolation type of the varying data. + * + * @type {?string} + * @default null + */ + interpolationType: string | null; + /** + * The interpolation sampling type of varying data. + * + * @type {?string} + * @default null + */ + interpolationSampling: string | null; +} +import { NormalBlending } from './three.core.js'; +import { NormalGAPacking } from './three.core.js'; +/** + * This class can be used for applying normals maps to materials. + * + * ```js + * material.normalNode = normalMap( texture( normalTex ) ); + * ``` + * + * @augments TempNode + */ +export class NormalMapNode extends TempNode { + /** + * Constructs a new normal map node. + * + * @param {Node} node - Represents the normal map data. + * @param {?Node} [scaleNode=null] - Controls the intensity of the effect. + */ + constructor(node: Node, scaleNode?: Node | null); + /** + * Represents the normal map data. + * + * @type {Node} + */ + node: Node; + /** + * Controls the intensity of the effect. + * + * @type {?Node} + * @default null + */ + scaleNode: Node | null; + /** + * The normal map type. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | number); + /** + * Controls how to unpack the sampled normal map values. + * + * @type {string} + * @default NoNormalPacking + */ + unpackNormalMode: string; + setup(builder: any): any; +} +import { NormalRGPacking } from './three.core.js'; +import { NotEqualCompare } from './three.core.js'; +import { NotEqualDepth } from './three.core.js'; +import { NotEqualStencilFunc } from './three.core.js'; +import { Object3D } from './three.core.js'; +/** + * This node can be used to access transformation related metrics of 3D objects. + * Depending on the selected scope, a different metric is represented as a uniform + * in the shader. The following scopes are supported: + * + * - `POSITION`: The object's position in world space. + * - `VIEW_POSITION`: The object's position in view/camera space. + * - `DIRECTION`: The object's direction in world space. + * - `SCALE`: The object's scale in world space. + * - `WORLD_MATRIX`: The object's matrix in world space. + * + * @augments Node + */ +export class Object3DNode extends Node { + /** + * Constructs a new object 3D node. + * + * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. + * @param {?Object3D} [object3d=null] - The 3D object. + */ + constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"), object3d?: Object3D | null); + /** + * The node reports a different type of transformation depending on the scope. + * + * @type {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} + */ + scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"); + /** + * The 3D object. + * + * @type {?Object3D} + * @default null + */ + object3d: Object3D | null; + /** + * Holds the value of the node as a uniform. + * + * @type {UniformNode} + */ + uniformNode: UniformNode; + /** + * Overwritten since the node type is inferred from the scope. + * + * @return {('mat4'|'vec3'|'float')} The node type. + */ + generateNodeType(): ("mat4" | "vec3" | "float"); + /** + * Updates the uniform value depending on the scope. + * + * @param {NodeFrame} frame - The current node frame. + */ + update(frame: NodeFrame): void; + /** + * Generates the code snippet of the uniform node. The node type of the uniform + * node also depends on the selected scope. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder): string; + serialize(data: any): void; + deserialize(data: any): void; +} +export namespace Object3DNode { + let WORLD_MATRIX: string; + let POSITION: string; + let SCALE: string; + let VIEW_POSITION: string; + let DIRECTION: string; + let RADIUS: string; +} +import { ObjectLoader } from './three.core.js'; +import { ObjectSpaceNormalMap } from './three.core.js'; +import { OneFactor } from './three.core.js'; +import { OneMinusConstantAlphaFactor } from './three.core.js'; +import { OneMinusConstantColorFactor } from './three.core.js'; +import { OneMinusDstAlphaFactor } from './three.core.js'; +import { OneMinusDstColorFactor } from './three.core.js'; +import { OneMinusSrcAlphaFactor } from './three.core.js'; +import { OneMinusSrcColorFactor } from './three.core.js'; +/** + * This node represents basic mathematical and logical operations like addition, + * subtraction or comparisons (e.g. `equal()`). + * + * @augments TempNode + */ +export class OperatorNode extends TempNode { + /** + * Constructs a new operator node. + * + * @param {string} op - The operator. + * @param {Node} aNode - The first input. + * @param {Node} bNode - The second input. + * @param {...Node} params - Additional input parameters. + */ + constructor(op: string, aNode: Node, bNode: Node, ...params: Node[]); + /** + * The operator. + * + * @type {string} + */ + op: string; + /** + * The first input. + * + * @type {Node} + */ + aNode: Node; + /** + * The second input. + * + * @type {Node} + */ + bNode: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOperatorNode: boolean; + /** + * Returns the operator method name. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} output - The output type. + * @returns {string} The operator method name. + */ + getOperatorMethod(builder: NodeBuilder, output: string): string; + /** + * This method is overwritten since the node type is inferred from the operator + * and the input node types. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?string} [output=null] - The output type. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder, output?: string | null): string; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import { OrthographicCamera } from './three.core.js'; +/** + * This node can be used to define multiple outputs in a shader programs. + * + * @augments Node + */ +export class OutputStructNode extends Node { + /** + * Constructs a new output struct node. The constructor can be invoked with an + * arbitrary number of nodes representing the members. + * + * @param {...Node} members - A parameter list of nodes. + */ + constructor(...members: Node[]); + /** + * An array of nodes which defines the output. + * + * @type {Array} + */ + members: Array; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOutputStructNode: boolean; + generateNodeType(): string; + generate(builder: any): any; +} +/** + * A specialized context node designed to override specific target nodes within a + * node sub-graph or flow. This allows replacing specific inputs (e.g., normal + * and position vectors) dynamically during compilation for a specific flow node, + * without having to reconstruct or duplicate the source nodes. + * + * ```js + * // Method chaining example: + * node.overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); + * + * // Context assignment example: + * material.contextNode = overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); + * ``` + * + * @augments ContextNode + */ +export class OverrideContextNode extends ContextNode { + /** + * Constructs a new override context node. + * + * @param {Map} overrideNodes - A map mapping target nodes to their respective override callback functions. + * @param {Node|null} [flowNode=null] - The node whose context should be modified. + */ + constructor(overrideNodes: Map, flowNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOverrideContextNode: boolean; +} +import { PCFShadowMap } from './three.core.js'; +import { PCFSoftShadowMap } from './three.core.js'; +/** + * This class generates a Prefiltered, Mipmapped Radiance Environment Map + * (PMREM) from a cubeMap environment texture. This allows different levels of + * blur to be quickly accessed based on material roughness. It is packed into a + * special CubeUV format that allows us to perform custom interpolation so that + * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap + * chain, it only goes down to the LOD_MIN level (above), and then creates extra + * even more filtered 'mips' at the same LOD_MIN resolution, associated with + * higher roughness levels. In this way we maintain resolution to smoothly + * interpolate diffuse lighting while limiting sampling computation. + * + * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) + * importance sampling based on "Sampling the GGX Distribution of Visible Normals" + * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF + * used in material rendering for physically-based image-based lighting. + */ +export class PMREMGenerator { + /** + * Constructs a new PMREM generator. + * + * @param {Renderer} renderer - The renderer. + */ + constructor(renderer: Renderer); + _renderer: Renderer; + _pingPongRenderTarget: RenderTarget | null; + _lodMax: number; + _cubeSize: number; + _sizeLods: any[]; + _lodMeshes: any[]; + _blurMaterial: NodeMaterial | null; + _ggxMaterial: NodeMaterial | null; + _cubemapMaterial: NodeMaterial | null; + _equirectMaterial: NodeMaterial | null; + _backgroundBox: Mesh | null; + get _hasInitialized(): boolean; + /** + * Generates a PMREM from a supplied Scene, which can be faster than using an + * image if networking bandwidth is low. Optional sigma specifies a blur radius + * in radians to be applied to the scene before PMREM generation. Optional near + * and far planes ensure the scene is rendered in its entirety. + * + * @param {Scene} scene - The scene to be captured. + * @param {number} [sigma=0] - The blur radius in radians. + * @param {number} [near=0.1] - The near plane distance. + * @param {number} [far=100] - The far plane distance. + * @param {Object} [options={}] - The configuration options. + * @param {number} [options.size=256] - The texture size of the PMREM. + * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. + * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. + * @return {RenderTarget} The resulting PMREM. + * @see {@link PMREMGenerator#fromScene} + */ + fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { + size?: number | undefined; + position?: Vector3 | undefined; + renderTarget?: RenderTarget | null | undefined; + }): RenderTarget; + /** + * Generates a PMREM from a supplied Scene, which can be faster than using an + * image if networking bandwidth is low. Optional sigma specifies a blur radius + * in radians to be applied to the scene before PMREM generation. Optional near + * and far planes ensure the scene is rendered in its entirety (the cubeCamera + * is placed at the origin). + * + * @deprecated + * @param {Scene} scene - The scene to be captured. + * @param {number} [sigma=0] - The blur radius in radians. + * @param {number} [near=0.1] - The near plane distance. + * @param {number} [far=100] - The far plane distance. + * @param {Object} [options={}] - The configuration options. + * @param {number} [options.size=256] - The texture size of the PMREM. + * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. + * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. + * @return {Promise} A Promise that resolve with the PMREM when the generation has been finished. + * @see {@link PMREMGenerator#fromScene} + */ + fromSceneAsync(scene: Scene, sigma?: number, near?: number, far?: number, options?: { + size?: number | undefined; + position?: Vector3 | undefined; + renderTarget?: RenderTarget | null | undefined; + }): Promise; + /** + * Generates a PMREM from an equirectangular texture, which can be either LDR + * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best + * with the 256 x 256 cubemap output. The minimum supported input image size + * is 64 x 32. + * + * @param {Texture} equirectangular - The equirectangular texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {RenderTarget} The resulting PMREM. + * @see {@link PMREMGenerator#fromEquirectangularAsync} + */ + fromEquirectangular(equirectangular: Texture, renderTarget?: RenderTarget | null): RenderTarget; + /** + * Generates a PMREM from an equirectangular texture, which can be either LDR + * or HDR. The ideal input image size is 1k (1024 x 512), + * as this matches best with the 256 x 256 cubemap output. + * + * @deprecated + * @param {Texture} equirectangular - The equirectangular texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {Promise} The resulting PMREM. + * @see {@link PMREMGenerator#fromEquirectangular} + */ + fromEquirectangularAsync(equirectangular: Texture, renderTarget?: RenderTarget | null): Promise; + /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {RenderTarget} The resulting PMREM. + * @see {@link PMREMGenerator#fromCubemapAsync} + */ + fromCubemap(cubemap: Texture, renderTarget?: RenderTarget | null): RenderTarget; + /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, + * with the 256 x 256 cubemap output. + * + * @deprecated + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {Promise} The resulting PMREM. + * @see {@link PMREMGenerator#fromCubemap} + */ + fromCubemapAsync(cubemap: Texture, renderTarget?: RenderTarget | null): Promise; + /** + * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + * + * @returns {Promise} + */ + compileCubemapShader(): Promise; + /** + * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + * + * @returns {Promise} + */ + compileEquirectangularShader(): Promise; + /** + * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, + * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on + * one of them will cause any others to also become unusable. + */ + dispose(): void; + _setSizeFromTexture(texture: any): void; + _setSize(cubeSize: any): void; + _dispose(): void; + _cleanup(outputTarget: any): void; + _fromTexture(texture: any, renderTarget: any): any; + _allocateTarget(depthBuffer: any): RenderTarget; + _init(renderTarget: any): void; + _compileMaterial(material: any): Promise; + _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; + _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; + _applyPMREM(cubeUVRenderTarget: any): void; + /** + * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. + * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the + * GGX BRDF for physically-based rendering. Reads from the previous LOD level and + * applies incremental roughness filtering to avoid over-blurring. + * + * @private + * @param {RenderTarget} cubeUVRenderTarget + * @param {number} lodIn - Source LOD level to read from + * @param {number} lodOut - Target LOD level to write to + */ + private _applyGGXFilter; + /** + * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples + * the Gaussian along a spiral kernel (Golden Angle), which distributes samples + * isotropically on the sphere (no pole artifacts). + * + * Used for initial scene blur in fromScene() method when sigma > 0. + * + * @private + * @param {RenderTarget} cubeUVRenderTarget - The cubemap render target. + * @param {number} lodIn - The input level-of-detail. + * @param {number} lodOut - The output level-of-detail. + * @param {number} sigma - The blur radius in radians. + */ + private _blur; + _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; + _setViewport(target: any, x: any, y: any, width: any, height: any): void; +} +/** + * This node represents a PMREM which is a special type of preprocessed + * environment map intended for PBR materials. + * + * ```js + * const material = new MeshStandardNodeMaterial(); + * material.envNode = pmremTexture( envMap ); + * ``` + * + * @augments TempNode + */ +export class PMREMNode extends TempNode { + /** + * Constructs a new function overloading node. + * + * @param {Texture} value - The input texture. + * @param {Node} [uvNode=null] - The uv node. + * @param {Node} [levelNode=null] - The level node. + */ + constructor(value: Texture, uvNode?: Node, levelNode?: Node); + /** + * Reference to the input texture. + * + * @private + * @type {Texture} + */ + private _value; + /** + * Reference to the generated PMREM. + * + * @private + * @type {Texture | null} + * @default null + */ + private _pmrem; + /** + * The uv node. + * + * @type {Node} + */ + uvNode: Node; + /** + * The level node. + * + * @type {Node} + */ + levelNode: Node; + /** + * Reference to a PMREM generator. + * + * @private + * @type {?PMREMGenerator} + * @default null + */ + private _generator; + /** + * The texture node holding the generated PMREM. + * + * @private + * @type {TextureNode} + */ + private _texture; + /** + * A uniform representing the PMREM's width. + * + * @private + * @type {UniformNode} + */ + private _width; + /** + * A uniform representing the PMREM's height. + * + * @private + * @type {UniformNode} + */ + private _height; + /** + * A uniform representing the PMREM's max Mip. + * + * @private + * @type {UniformNode} + */ + private _maxMip; + set value(value: Texture); + /** + * The node's texture value. + * + * @type {Texture} + */ + get value(): Texture; + /** + * Uses the given PMREM texture to update internal values. + * + * @param {Texture} texture - The PMREM texture. + */ + updateFromTexture(texture: Texture): void; + updateBefore(frame: any): void; + setup(builder: any): void; +} +/** + * This node represents an operation that packs floating-point values of a vector into an unsigned 32-bit integer + * + * @augments TempNode + */ +export class PackFloatNode extends TempNode { + /** + * + * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the float values are mapped to the integer range. + * @param {Node} vectorNode - The vector node to be packed + */ + constructor(encoding: "snorm" | "unorm" | "float16", vectorNode: Node); + /** + * The vector to be packed. + * + * @type {Node} + */ + vectorNode: Node; + /** + * The numeric encoding. + * + * @type {string} + */ + encoding: string; + /** + * The component layout of the packed integer. + * + * @type {'2x16' | '4x8'} + * @default '2x16' + */ + layout: "2x16" | "4x8"; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPackFloatNode: boolean; + generateNodeType(): string; + generate(builder: any): string; +} +/** + * Special version of {@link PropertyNode} which is used for parameters. + * + * @augments PropertyNode + */ +export class ParameterNode extends PropertyNode { + /** + * Constructs a new parameter node. + * + * @param {string} nodeType - The type of the node. + * @param {?string} [name=null] - The name of the parameter in the shader. + */ + constructor(nodeType: string, name?: string | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isParameterNode: boolean; + /** + * Gets the type of a member variable in the parameter node. + * + * @param {NodeBuilder} builder - The node builder. + * @param {string} name - The name of the member variable. + * @returns {string} + */ + getMemberType(builder: NodeBuilder, name: string): string; + getHash(): string; + generate(): string; +} +/** + * Represents a render pass (sometimes called beauty pass) in context of post processing. + * This pass produces a render for the given scene and camera and can provide multiple outputs + * via MRT for further processing. + * + * ```js + * const postProcessing = new RenderPipeline( renderer ); + * + * const scenePass = pass( scene, camera ); + * + * postProcessing.outputNode = scenePass; + * ``` + * + * @augments TempNode + */ +export class PassNode extends TempNode { + /** + * Constructs a new pass node. + * + * @param {('color'|'depth')} scope - The scope of the pass. The scope determines whether the node outputs color or depth. + * @param {Scene} scene - A reference to the scene. + * @param {Camera} camera - A reference to the camera. + * @param {Object} options - Options for the internal render target. + */ + constructor(scope: ("color" | "depth"), scene: Scene, camera: Camera, options?: Object); + /** + * The scope of the pass. The scope determines whether the node outputs color or depth. + * + * @type {('color'|'depth')} + */ + scope: ("color" | "depth"); + /** + * A reference to the scene. + * + * @type {Scene} + */ + scene: Scene; + /** + * A reference to the camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * Options for the internal render target. + * + * @type {Object} + */ + options: Object; + /** + * The pass's pixel width. Will be kept automatically kept in sync with the renderer's width. + * @private + * @type {number} + * @default 1 + */ + private _width; + /** + * The pass's pixel height. Will be kept automatically kept in sync with the renderer's height. + * @private + * @type {number} + * @default 1 + */ + private _height; + /** + * The pass's render target. + * + * @type {RenderTarget} + */ + renderTarget: RenderTarget; + /** + * An optional override material for the pass. + * + * @type {Material|null} + */ + overrideMaterial: Material | null; + /** + * Whether the pass is transparent. + * + * @type {boolean} + * @default false + */ + transparent: boolean; + /** + * Whether the pass is opaque. + * + * @type {boolean} + * @default true + */ + opaque: boolean; + lighting: any; + /** + * Whether the renderer should automatically clear before rendering the pass. + * + * @type {boolean} + * @default true + */ + autoClear: boolean; + /** + * Whether the color buffer should be cleared. + * + * @type {boolean} + * @default true + */ + autoClearColor: boolean; + /** + * Whether the depth buffer should be cleared. + * + * @type {boolean} + * @default true + */ + autoClearDepth: boolean; + /** + * Whether the stencil buffer should be cleared. + * + * @type {boolean} + * @default true + */ + autoClearStencil: boolean; + /** + * An optional global context for the pass. + * + * @type {ContextNode|null} + */ + contextNode: ContextNode | null; + /** + * A cache for the context node. + * + * @private + * @type {?Object} + * @default null + */ + private _contextNodeCache; + /** + * A dictionary holding the internal result textures. + * + * @private + * @type {{ output: Texture, depth: ?DepthTexture }} + */ + private _textures; + /** + * A dictionary holding the internal texture nodes. + * + * @private + * @type {Object} + */ + private _textureNodes; + /** + * A dictionary holding the internal depth nodes. + * + * @private + * @type {Object} + */ + private _linearDepthNodes; + /** + * A dictionary holding the internal viewZ nodes. + * + * @private + * @type {Object} + */ + private _viewZNodes; + /** + * A dictionary holding the texture data of the previous frame. + * Used for computing velocity/motion vectors. + * + * @private + * @type {Object} + */ + private _previousTextures; + /** + * A dictionary holding the texture nodes of the previous frame. + * Used for computing velocity/motion vectors. + * + * @private + * @type {Object} + */ + private _previousTextureNodes; + /** + * The `near` property of the camera as a uniform. + * + * @private + * @type {UniformNode} + */ + private _cameraNear; + /** + * The `far` property of the camera as a uniform. + * + * @private + * @type {UniformNode} + */ + private _cameraFar; + /** + * A MRT node configuring the MRT settings. + * + * @private + * @type {?MRTNode} + * @default null + */ + private _mrt; + /** + * Layer object for configuring the camera that is used + * to produce the pass. + * + * @private + * @type {?Layers} + * @default null + */ + private _layers; + /** + * Scales the resolution of the internal render target. + * + * @private + * @type {number} + * @default 1 + */ + private _resolutionScale; + /** + * Custom viewport definition. + * + * @private + * @type {?Vector4} + * @default null + */ + private _viewport; + /** + * Custom scissor definition. + * + * @private + * @type {?Vector4} + * @default null + */ + private _scissor; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPassNode: boolean; + /** + * Sets the resolution scale for the pass. + * The resolution scale is a factor that is multiplied with the renderer's width and height. + * + * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. + * @return {PassNode} A reference to this pass. + */ + setResolutionScale(resolutionScale: number): PassNode; + /** + * Gets the current resolution scale of the pass. + * + * @return {number} The current resolution scale. A value of `1` means full resolution. + */ + getResolutionScale(): number; + /** + * Sets the resolution for the pass. + * The resolution is a factor that is multiplied with the renderer's width and height. + * + * @param {number} resolution - The resolution to set. A value of `1` means full resolution. + * @return {PassNode} A reference to this pass. + * @deprecated since r181. Use {@link PassNode#setResolutionScale `setResolutionScale()`} instead. + */ + setResolution(resolution: number): PassNode; + /** + * Gets the current resolution of the pass. + * + * @return {number} The current resolution. A value of `1` means full resolution. + * @deprecated since r181. Use {@link PassNode#getResolutionScale `getResolutionScale()`} instead. + */ + getResolution(): number; + /** + * Sets the layer configuration that should be used when rendering the pass. + * + * @param {Layers} layers - The layers object to set. + * @return {PassNode} A reference to this pass. + */ + setLayers(layers: Layers): PassNode; + /** + * Gets the current layer configuration of the pass. + * + * @return {?Layers} . + */ + getLayers(): Layers | null; + /** + * Sets the given MRT node to setup MRT for this pass. + * + * @param {MRTNode} mrt - The MRT object. + * @return {PassNode} A reference to this pass. + */ + setMRT(mrt: MRTNode): PassNode; + /** + * Returns the current MRT node. + * + * @return {MRTNode} The current MRT node. + */ + getMRT(): MRTNode; + /** + * Returns the texture for the given output name. + * + * @param {string} name - The output name to get the texture for. + * @return {Texture} The texture. + */ + getTexture(name: string): Texture; + /** + * Returns the texture holding the data of the previous frame for the given output name. + * + * @param {string} name - The output name to get the texture for. + * @return {Texture} The texture holding the data of the previous frame. + */ + getPreviousTexture(name: string): Texture; + /** + * Switches current and previous textures for the given output name. + * + * @param {string} name - The output name. + */ + toggleTexture(name: string): void; + /** + * Returns the texture node for the given output name. + * + * @param {string} [name='output'] - The output name to get the texture node for. + * @return {TextureNode} The texture node. + */ + getTextureNode(name?: string): TextureNode; + /** + * Returns the previous texture node for the given output name. + * + * @param {string} [name='output'] - The output name to get the previous texture node for. + * @return {TextureNode} The previous texture node. + */ + getPreviousTextureNode(name?: string): TextureNode; + /** + * Returns a viewZ node of this pass. + * + * @param {string} [name='depth'] - The output name to get the viewZ node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. + * @return {Node} The viewZ node. + */ + getViewZNode(name?: string): Node; + /** + * Returns a linear depth node of this pass. + * + * @param {string} [name='depth'] - The output name to get the linear depth node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. + * @return {Node} The linear depth node. + */ + getLinearDepthNode(name?: string): Node; + /** + * Precompiles the pass. + * + * Note that this method must be called after the pass configuration is complete. + * So calls like `setMRT()` and `getTextureNode()` must proceed the precompilation. + * + * @async + * @param {Renderer} renderer - The renderer. + * @return {Promise} A Promise that resolves when the compile has been finished. + * @see {@link Renderer#compileAsync} + */ + compileAsync(renderer: Renderer): Promise; + setup({ renderer }: { + renderer: any; + }): Node | TextureNode; + updateBefore(frame: any): void; + /** + * Sets the size of the pass's render target. Honors the pixel ratio. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * This method allows to define the pass's scissor rectangle. By default, the scissor rectangle is kept + * in sync with the pass's dimensions. To reverse the process and use auto-sizing again, call the method + * with `null` as the single argument. + * + * @param {?(number | Vector4)} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. + * Instead of passing four arguments, the method also works with a single four-dimensional vector. + * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. + * @param {number} width - The width of the scissor box in logical pixel unit. + * @param {number} height - The height of the scissor box in logical pixel unit. + */ + setScissor(x: (number | Vector4) | null, y: number, width: number, height: number): void; + /** + * This method allows to define the pass's viewport. By default, the viewport is kept in sync + * with the pass's dimensions. To reverse the process and use auto-sizing again, call the method + * with `null` as the single argument. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + */ + setViewport(x: number | Vector4, y: number, width: number, height: number): void; +} +export namespace PassNode { + let COLOR_1: "color"; + export { COLOR_1 as COLOR }; + export let DEPTH: "depth"; +} +import { PerspectiveCamera } from './three.core.js'; +/** + * Represents the lighting model for a phong material. Used in {@link MeshPhongNodeMaterial}. + * + * @augments BasicLightingModel + */ +export class PhongLightingModel extends BasicLightingModel { + /** + * Constructs a new phong lighting model. + * + * @param {boolean} [specular=true] - Whether specular is supported or not. + */ + constructor(specular?: boolean); + /** + * Whether specular is supported or not. Set this to `false` if you are + * looking for a Lambert-like material meaning a material for non-shiny + * surfaces, without specular highlights. + * + * @type {boolean} + * @default true + */ + specular: boolean; + /** + * Implements the direct lighting. The specular portion is optional and can be controlled + * with the {@link PhongLightingModel#specular} flag. + * + * @param {Object} lightData - The light data. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object): void; +} +/** + * Represents the lighting model for a PBR material. + * + * @augments LightingModel + */ +export class PhysicalLightingModel extends LightingModel { + /** + * Constructs a new physical lighting model. + * + * @param {boolean} [clearcoat=false] - Whether clearcoat is supported or not. + * @param {boolean} [sheen=false] - Whether sheen is supported or not. + * @param {boolean} [iridescence=false] - Whether iridescence is supported or not. + * @param {boolean} [anisotropy=false] - Whether anisotropy is supported or not. + * @param {boolean} [transmission=false] - Whether transmission is supported or not. + * @param {boolean} [dispersion=false] - Whether dispersion is supported or not. + * @param {boolean} [retroreflection=false] - Whether retroreflection is supported or not. + */ + constructor(clearcoat?: boolean, sheen?: boolean, iridescence?: boolean, anisotropy?: boolean, transmission?: boolean, dispersion?: boolean, retroreflection?: boolean); + /** + * Whether clearcoat is supported or not. + * + * @type {boolean} + * @default false + */ + clearcoat: boolean; + /** + * Whether sheen is supported or not. + * + * @type {boolean} + * @default false + */ + sheen: boolean; + /** + * Whether iridescence is supported or not. + * + * @type {boolean} + * @default false + */ + iridescence: boolean; + /** + * Whether anisotropy is supported or not. + * + * @type {boolean} + * @default false + */ + anisotropy: boolean; + /** + * Whether transmission is supported or not. + * + * @type {boolean} + * @default false + */ + transmission: boolean; + /** + * Whether dispersion is supported or not. + * + * @type {boolean} + * @default false + */ + dispersion: boolean; + /** + * Whether retroreflection is supported or not. + * + * @type {boolean} + * @default false + */ + retroreflection: boolean; + /** + * The clear coat radiance. + * + * @type {?Node} + * @default null + */ + clearcoatRadiance: Node | null; + /** + * The clear coat specular direct. + * + * @type {?Node} + * @default null + */ + clearcoatSpecularDirect: Node | null; + /** + * The clear coat specular indirect. + * + * @type {?Node} + * @default null + */ + clearcoatSpecularIndirect: Node | null; + /** + * The sheen specular direct. + * + * @type {?Node} + * @default null + */ + sheenSpecularDirect: Node | null; + /** + * The sheen specular indirect. + * + * @type {?Node} + * @default null + */ + sheenSpecularIndirect: Node | null; + /** + * The iridescence Fresnel. + * + * @type {?Node} + * @default null + */ + iridescenceFresnel: Node | null; + /** + * The iridescence F0 dielectric. + * + * @type {?Node} + * @default null + */ + iridescenceF0Dielectric: Node | null; + /** + * The iridescence F0 metallic. + * + * @type {?Node} + * @default null + */ + iridescenceF0Metallic: Node | null; + /** + * The sampled DFG LUT value, shared by the direct and indirect lighting paths. + * + * @type {?Node} + * @default null + */ + dfg: Node | null; + /** + * The multi-scattering energy compensation for direct lighting. + * + * @type {?Node} + * @default null + */ + multiScatteringCompensation: Node | null; + computeMultiscattering(singleScatter: any, multiScatter: any, specularF90: any, f0: any, iridescenceF0?: null): void; + /** + * Implements the direct light. + * + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object): void; + /** + * This method is intended for implementing the direct light term for + * rect area light nodes. + * + * @param {Object} input - The input data. + * @param {NodeBuilder} builder - The current node builder. + */ + directRectArea({ lightColor, lightPosition, halfWidth, halfHeight, reflectedLight, ltc_1, ltc_2 }: Object): void; + /** + * Implements the indirect lighting. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirect(builder: NodeBuilder): void; + /** + * Implements the indirect diffuse term. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirectDiffuse(builder: NodeBuilder): void; + /** + * Implements the indirect specular term. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirectSpecular(builder: NodeBuilder): void; + /** + * Implements the ambient occlusion term. + * + * @param {NodeBuilder} builder - The current node builder. + */ + ambientOcclusion(builder: NodeBuilder): void; + /** + * Used for final lighting accumulations depending on the requested features. + * + * @param {NodeBuilder} builder - The current node builder. + */ + finish({ context }: NodeBuilder): void; +} +import { Plane } from './three.core.js'; +import { PlaneGeometry } from './three.core.js'; +import { PointLight } from './three.core.js'; +/** + * Module for representing point lights as nodes. + * + * @augments AnalyticLightNode + */ +export class PointLightNode extends AnalyticLightNode { + /** + * Constructs a new point light node. + * + * @param {?PointLight} [light=null] - The point light source. + */ + constructor(light?: PointLight | null); + /** + * Uniform node representing the cutoff distance. + * + * @type {UniformNode} + */ + cutoffDistanceNode: UniformNode; + /** + * Uniform node representing the decay exponent. + * + * @type {UniformNode} + */ + decayExponentNode: UniformNode; + /** + * Overwritten to updated point light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + /** + * Overwritten to setup point light specific shadow. + * + * @return {PointShadowNode} + */ + setupShadowNode(): PointShadowNode; + setupDirect(builder: any): { + lightDirection: any; + lightColor: any; + }; +} +/** + * Represents the shadow implementation for point light nodes. + * + * @augments ShadowNode + */ +export class PointShadowNode extends ShadowNode { + /** + * Constructs a new point shadow node. + * + * @param {PointLight} light - The shadow casting point light. + * @param {?PointLightShadow} [shadow=null] - An optional point light shadow. + */ + constructor(light: PointLight, shadow?: PointLightShadow | null); + /** + * Overwrites the default implementation to create a CubeRenderTarget with CubeDepthTexture. + * + * @param {LightShadow} shadow - The light shadow object. + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Object} An object containing the shadow map and depth texture. + */ + setupRenderTarget(shadow: LightShadow, builder: NodeBuilder): Object; +} +/** + * A node for representing the uv coordinates of points. + * + * Can only be used with a WebGL backend. In WebGPU, point + * primitives always have the size of one pixel and can thus + * can't be used as sprite-like objects that display textures. + * + * @augments Node + */ +export class PointUVNode extends Node { + /** + * Constructs a new point uv node. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPointUVNode: boolean; + generate(): string; +} +import { PointsMaterial } from './three.core.js'; +/** + * Node material version of {@link PointsMaterial}. + * + * This material can be used in two ways: + * + * - By rendering point primitives with {@link Points}. Since WebGPU only supports point primitives + * with a pixel size of `1`, it's not possible to define a size. + * + * ```js + * const pointCloud = new THREE.Points( geometry, new THREE.PointsNodeMaterial() ); + * ``` + * + * - By rendering point primitives with {@link Sprites}. In this case, size is honored, + * see {@link PointsNodeMaterial#sizeNode}. + * + * ```js + * const instancedPoints = new THREE.Sprite( new THREE.PointsNodeMaterial( { positionNode: instancedBufferAttribute( positionAttribute ) } ) ); + * ``` + * + * @augments SpriteNodeMaterial + */ +export class PointsNodeMaterial extends SpriteNodeMaterial { + /** + * This node property provides an additional way to set the point size. + * + * Note that WebGPU only supports point primitives with 1 pixel size. Consequently, + * this node has no effect when the material is used with {@link Points} and a WebGPU + * backend. If an application wants to render points with a size larger than 1 pixel, + * the material should be used with {@link Sprite} and instancing. + * + * @type {?Node} + * @default null + */ + sizeNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPointsNodeMaterial: boolean; + setupPositionView(): any; + setupVertexSprite(builder: any): any; + setupVertex(builder: any): any; + _useAlphaToCoverage: any; +} +/** + * @deprecated since r183. Use {@link RenderPipeline} instead. PostProcessing has been renamed to RenderPipeline. + * + * This class is a wrapper for backward compatibility and will be removed in a future version. + */ +export class PostProcessing extends RenderPipeline { + /** + * Constructs a new post processing management module. + * + * @param {Renderer} renderer - A reference to the renderer. + * @param {Node} outputNode - An optional output node. + * @deprecated since r183. Use {@link RenderPipeline} instead. + */ + constructor(renderer: Renderer, outputNode: Node); +} +/** + * A projector light version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. + * + * @augments SpotLight + */ +export class ProjectorLight extends SpotLight { + /** + * Aspect ratio of the light. Set to `null` to use the texture aspect ratio. + * + * @type {?number} + * @default null + */ + aspect: number | null; + copy(source: any, recursive: any): this; +} +/** + * An implementation of a projector light node. + * + * @augments SpotLightNode + */ +export class ProjectorLightNode extends SpotLightNode { + update(frame: any): void; + /** + * Overwrites the default implementation to compute projection attenuation. + * + * @param {NodeBuilder} builder - The node builder. + * @return {Node} The spot attenuation. + */ + getSpotAttenuation(builder: NodeBuilder): Node; +} +/** + * This class represents a shader property. It can be used + * to explicitly define a property and assign a value to it. + * + * ```js + * const threshold = property( 'float', 'threshold' ).assign( THRESHOLD ); + *``` + * `PropertyNode` is used by the engine to predefined common material properties + * for TSL code. + * + * @augments Node + */ +export class PropertyNode extends Node { + /** + * Constructs a new property node. + * + * @param {string} nodeType - The type of the node. + * @param {?string} [name=null] - The name of the property in the shader. + * @param {boolean} [varying=false] - Whether this property is a varying or not. + * @param {?Node} [placeholderNode=null] - The placeholder node if not assigned. + */ + constructor(nodeType: string, name?: string | null, varying?: boolean, placeholderNode?: Node | null); + /** + * Whether this property is a varying or not. + * + * @type {boolean} + * @default false + */ + varying: boolean; + /** + * The placeholder node of the property if it is not assigned. + * + * @type {?Node} + * @default null + */ + placeholderNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPropertyNode: boolean; + getNodeType(builder: any): any; + getHash(builder: any): string; + generate(builder: any): any; +} +/** + * This module is a helper for passes which need to render a full + * screen effect which is quite common in context of post processing. + * + * The intended usage is to reuse a single quad mesh for rendering + * subsequent passes by just reassigning the `material` reference. + * + * Note: This module can only be used with `WebGPURenderer`. + * + * @augments Mesh + */ +export class QuadMesh extends Mesh { + /** + * Constructs a new quad mesh. + * + * @param {NodeMaterial} material - The material to render the quad mesh with. + */ + constructor(material: NodeMaterial); + /** + * The camera to render the quad mesh with. + * + * @type {OrthographicCamera} + * @readonly + */ + readonly camera: OrthographicCamera; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isQuadMesh: boolean; + /** + * Async version of `render()`. + * + * @async + * @deprecated + * @param {Renderer} renderer - The renderer. + * @return {Promise} A Promise that resolves when the render has been finished. + */ + renderAsync(renderer: Renderer): Promise; + /** + * Renders the quad mesh + * + * @param {Renderer} renderer - The renderer. + */ + render(renderer: Renderer): void; +} +import { Quaternion } from './three.core.js'; +import { R11_EAC_Format } from './three.core.js'; +import { RED_GREEN_RGTC2_Format } from './three.core.js'; +import { RED_RGTC1_Format } from './three.core.js'; +import { REVISION } from './three.core.js'; +import { RG11_EAC_Format } from './three.core.js'; +import { RGBAFormat } from './three.core.js'; +import { RGBAIntegerFormat } from './three.core.js'; +import { RGBA_ASTC_10x10_Format } from './three.core.js'; +import { RGBA_ASTC_10x5_Format } from './three.core.js'; +import { RGBA_ASTC_10x6_Format } from './three.core.js'; +import { RGBA_ASTC_10x8_Format } from './three.core.js'; +import { RGBA_ASTC_12x10_Format } from './three.core.js'; +import { RGBA_ASTC_12x12_Format } from './three.core.js'; +import { RGBA_ASTC_4x4_Format } from './three.core.js'; +import { RGBA_ASTC_5x4_Format } from './three.core.js'; +import { RGBA_ASTC_5x5_Format } from './three.core.js'; +import { RGBA_ASTC_6x5_Format } from './three.core.js'; +import { RGBA_ASTC_6x6_Format } from './three.core.js'; +import { RGBA_ASTC_8x5_Format } from './three.core.js'; +import { RGBA_ASTC_8x6_Format } from './three.core.js'; +import { RGBA_ASTC_8x8_Format } from './three.core.js'; +import { RGBA_BPTC_Format } from './three.core.js'; +import { RGBA_ETC2_EAC_Format } from './three.core.js'; +import { RGBA_PVRTC_2BPPV1_Format } from './three.core.js'; +import { RGBA_PVRTC_4BPPV1_Format } from './three.core.js'; +import { RGBA_S3TC_DXT1_Format } from './three.core.js'; +import { RGBA_S3TC_DXT3_Format } from './three.core.js'; +import { RGBA_S3TC_DXT5_Format } from './three.core.js'; +import { RGBFormat } from './three.core.js'; +import { RGBIntegerFormat } from './three.core.js'; +import { RGB_BPTC_SIGNED_Format } from './three.core.js'; +import { RGB_BPTC_UNSIGNED_Format } from './three.core.js'; +import { RGB_ETC1_Format } from './three.core.js'; +import { RGB_ETC2_Format } from './three.core.js'; +import { RGB_PVRTC_2BPPV1_Format } from './three.core.js'; +import { RGB_PVRTC_4BPPV1_Format } from './three.core.js'; +import { RGB_S3TC_DXT1_Format } from './three.core.js'; +import { RGFormat } from './three.core.js'; +import { RGIntegerFormat } from './three.core.js'; +/** + * `RTTNode` takes another node and uses it with a `QuadMesh` to render into a texture (RTT). + * This module is especially relevant in context of post processing where certain nodes require + * texture input for their effects. With the helper function `convertToTexture()` which is based + * on this module, the node system can automatically ensure texture input if required. + * + * @augments TextureNode + */ +export class RTTNode extends TextureNode { + /** + * Constructs a new RTT node. + * + * @param {Node} node - The node to render a texture with. + * @param {?number} [width=null] - The width of the internal render target. If not width is applied, the render target is automatically resized. + * @param {?number} [height=null] - The height of the internal render target. + * @param {Object} [options={}] - The options for the internal render target. + * @param {number} [options.type=HalfFloatType] - The texture type. + * @param {boolean} [options.autoUpdate=true] - Whether the texture should automatically be updated or not. + * @param {number} [options.resolutionScale=1] - The resolution scale. + */ + constructor(node: Node, width?: number | null, height?: number | null, options?: { + type?: number | undefined; + autoUpdate?: boolean | undefined; + resolutionScale?: number | undefined; + }); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRTTNode: boolean; + /** + * The node to render a texture with. + * + * @type {Node} + */ + node: Node; + /** + * The width of the internal render target. + * If not width is applied, the render target is automatically resized. + * + * @type {?number} + * @default null + */ + width: number | null; + /** + * The height of the internal render target. + * + * @type {?number} + * @default null + */ + height: number | null; + /** + * The render target + * + * @type {RenderTarget} + */ + renderTarget: RenderTarget; + /** + * Whether the texture requires an update or not. + * + * @type {boolean} + * @default true + */ + textureNeedsUpdate: boolean; + /** + * Whether the texture should automatically be updated or not. + * + * @type {boolean} + * @default true + */ + autoUpdate: boolean; + /** + * The resolution scale + * + * @private + * @type {number} + * @default 1 + */ + private _resolutionScale; + /** + * The internal quad mesh for RTT. + * + * @private + * @type {QuadMesh} + */ + private _quadMesh; + /** + * Whether the internal render target should automatically be resized or not. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly get autoResize(): boolean; + setup(builder: any): void; + /** + * Sets the size of the internal render target + * + * @param {number} width - The width to set. + * @param {number} height - The width to set. + */ + setSize(width: number, height: number): void; + /** + * Sets the resolution scale. + * The resolution scale is a factor that is multiplied with the renderer's width and height. + * + * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. + * @returns {RTTNode} A reference to this node. + */ + setResolutionScale(resolutionScale: number): RTTNode; + /** + * Gets the resolution scale. + * + * @returns {number} The resolution scale. + */ + getResolutionScale(): number; + updateBefore({ renderer }: { + renderer: any; + }): void; +} +/** + * `RangeNode` generates random instanced attribute data in a defined range. + * An exemplary use case for this utility node is to generate random per-instance + * colors: + * ```js + * const material = new MeshBasicNodeMaterial(); + * material.colorNode = range( new Color( 0x000000 ), new Color( 0xFFFFFF ) ); + * const mesh = new InstancedMesh( geometry, material, count ); + * ``` + * @augments Node + */ +export class RangeNode extends Node { + /** + * Constructs a new range node. + * + * @param {Node} [minNode=float()] - A node defining the lower bound of the range. + * @param {Node} [maxNode=float()] - A node defining the upper bound of the range. + */ + constructor(minNode?: Node, maxNode?: Node); + /** + * A node defining the lower bound of the range. + * + * @type {Node} + * @default float() + */ + minNode: Node; + /** + * A node defining the upper bound of the range. + * + * @type {Node} + * @default float() + */ + maxNode: Node; + /** + * Returns the vector length which is computed based on the range definition. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {number} The vector length. + */ + getVectorLength(builder: NodeBuilder): number; + /** + * This method is overwritten since the node type is inferred from range definition. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns a constant node from the given node by traversing it. + * + * @param {Node} node - The node to traverse. + * @returns {Node} The constant node, if found. + */ + getConstNode(node: Node): Node; + setup(builder: any): any; +} +/** + * A readback buffer is used to transfer data from the GPU to the CPU. + * It is primarily used to read back compute shader results. + * + * @augments EventDispatcher + */ +export class ReadbackBuffer extends EventDispatcher { + /** + * Constructs a new readback buffer. + * + * @param {number} maxByteLength - The maximum size of the buffer to be read back. + */ + constructor(maxByteLength: number); + /** + * Name used for debugging purposes. + * + * @type {string} + */ + name: string; + /** + * The mapped, read back array buffer. + * + * @type {ArrayBuffer|null} + */ + buffer: ArrayBuffer | null; + /** + * The maximum size of the buffer to be read back. + * + * @type {number} + */ + maxByteLength: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isReadbackBuffer: boolean; + _mapped: boolean; + /** + * Releases the mapped buffer data so the GPU buffer can be + * used by the GPU again. + * + * Note: Any `ArrayBuffer` data associated with this readback buffer + * are removed and no longer accessible after calling this method. + */ + release(): void; + /** + * Frees internal resources. + */ + dispose(): void; +} +import { RectAreaLight } from './three.core.js'; +/** + * Module for representing rect area lights as nodes. + * + * @augments AnalyticLightNode + */ +export class RectAreaLightNode extends AnalyticLightNode { + /** + * Used to configure the internal BRDF approximation texture data. + * + * @param {RectAreaLightTexturesLib} ltc - The BRDF approximation texture data. + */ + static setLTC(ltc: RectAreaLightTexturesLib): void; + /** + * Constructs a new rect area light node. + * + * @param {?RectAreaLight} [light=null] - The rect area light source. + */ + constructor(light?: RectAreaLight | null); + /** + * Uniform node representing the half height of the are light. + * + * @type {UniformNode} + */ + halfHeight: UniformNode; + /** + * Uniform node representing the half width of the are light. + * + * @type {UniformNode} + */ + halfWidth: UniformNode; + /** + * Overwritten to updated rect area light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + setupDirectRectArea(builder: any): { + lightColor: Node; + lightPosition: any; + halfWidth: any; + halfHeight: any; + ltc_1: TextureNode; + ltc_2: TextureNode; + }; +} +import { RedFormat } from './three.core.js'; +import { RedIntegerFormat } from './three.core.js'; +/** + * Base class for nodes which establishes a reference to a property of another object. + * In this way, the value of the node is automatically linked to the value of + * referenced object. Reference nodes internally represent the linked value + * as a uniform. + * + * @augments Node + */ +export class ReferenceBaseNode extends Node { + /** + * Constructs a new reference base node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} uniformType - The uniform type that should be used to represent the property value. + * @param {?Object} [object=null] - The object the property belongs to. + * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. + */ + constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); + /** + * The name of the property the node refers to. + * + * @type {string} + */ + property: string; + /** + * The uniform type that should be used to represent the property value. + * + * @type {string} + */ + uniformType: string; + /** + * The object the property belongs to. + * + * @type {?Object} + * @default null + */ + object: Object | null; + /** + * When the linked property is an array, this parameter defines its length. + * + * @type {?number} + * @default null + */ + count: number | null; + /** + * The property name might have dots so nested properties can be referred. + * The hierarchy of the names is stored inside this array. + * + * @type {Array} + */ + properties: Array; + /** + * Points to the current referred object. This property exists next to {@link ReferenceNode#object} + * since the final reference might be updated from calling code. + * + * @type {?Object} + * @default null + */ + reference: Object | null; + /** + * The uniform node that holds the value of the reference node. + * + * @type {UniformNode} + * @default null + */ + node: UniformNode; + /** + * The uniform group of the internal uniform. + * + * @type {UniformGroupNode} + * @default null + */ + group: UniformGroupNode; + /** + * Sets the uniform group for this reference node. + * + * @param {UniformGroupNode} group - The uniform group to set. + * @return {ReferenceBaseNode} A reference to this node. + */ + setGroup(group: UniformGroupNode): ReferenceBaseNode; + /** + * When the referred property is array-like, this method can be used + * to access elements via an index node. + * + * @param {IndexNode} indexNode - indexNode. + * @return {ReferenceElementNode} A reference to an element. + */ + element(indexNode: IndexNode): ReferenceElementNode; + /** + * Sets the node type which automatically defines the internal + * uniform type. + * + * @param {string} uniformType - The type to set. + */ + setNodeType(uniformType: string): void; + /** + * This method is overwritten since the node type is inferred from + * the type of the reference node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the property value from the given referred object. + * + * @param {Object} [object=this.reference] - The object to retrieve the property value from. + * @return {any} The value. + */ + getValueFromReference(object?: Object): any; + /** + * Allows to update the reference based on the given state. The state is only + * evaluated {@link ReferenceBaseNode#object} is not set. + * + * @param {(NodeFrame|NodeBuilder)} state - The current state. + * @return {Object} The updated reference. + */ + updateReference(state: (NodeFrame | NodeBuilder)): Object; + /** + * The output of the reference node is the internal uniform node. + * + * @return {UniformNode} The output node. + */ + setup(): UniformNode; + /** + * Overwritten to update the internal uniform value. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(): void; + /** + * Retrieves the value from the referred object property and uses it + * to updated the internal uniform. + */ + updateValue(): void; +} +/** + * This class is only relevant if the referenced property is array-like. + * In this case, `ReferenceElementNode` allows to refer to a specific + * element inside the data structure via an index. + * + * @augments ArrayElementNode + */ +export class ReferenceElementNode extends ArrayElementNode { + /** + * Constructs a new reference element node. + * + * @param {(ReferenceBaseNode|ReferenceNode)} referenceNode - The reference node. + * @param {Node} indexNode - The index node that defines the element access. + */ + constructor(referenceNode: (ReferenceBaseNode | ReferenceNode), indexNode: Node); + /** + * Similar to {@link ReferenceNode#reference}, an additional + * property references to the current node. + * + * @type {?(ReferenceBaseNode|ReferenceNode)} + * @default null + */ + referenceNode: (ReferenceBaseNode | ReferenceNode) | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isReferenceElementNode: boolean; + /** + * This method is overwritten since the node type is inferred from + * the uniform type of the reference node. + * + * @return {string} The node type. + */ + generateNodeType(): string; + generate(builder: any): any; +} +/** + * This type of node establishes a reference to a property of another object. + * In this way, the value of the node is automatically linked to the value of + * referenced object. Reference nodes internally represent the linked value + * as a uniform. + * + * @augments Node + */ +export class ReferenceNode extends Node { + /** + * Constructs a new reference node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} uniformType - The uniform type that should be used to represent the property value. + * @param {?Object} [object=null] - The object the property belongs to. + * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. + */ + constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); + /** + * The name of the property the node refers to. + * + * @type {string} + */ + property: string; + /** + * The uniform type that should be used to represent the property value. + * + * @type {string} + */ + uniformType: string; + /** + * The object the property belongs to. + * + * @type {?Object} + * @default null + */ + object: Object | null; + /** + * When the linked property is an array, this parameter defines its length. + * + * @type {?number} + * @default null + */ + count: number | null; + /** + * The property name might have dots so nested properties can be referred. + * The hierarchy of the names is stored inside this array. + * + * @type {Array} + */ + properties: Array; + /** + * Points to the current referred object. This property exists next to {@link ReferenceNode#object} + * since the final reference might be updated from calling code. + * + * @type {?Object} + * @default null + */ + reference: Object | null; + /** + * The uniform node that holds the value of the reference node. + * + * @type {UniformNode} + * @default null + */ + node: UniformNode; + /** + * The uniform group of the internal uniform. + * + * @type {UniformGroupNode} + * @default null + */ + group: UniformGroupNode; + /** + * When the referred property is array-like, this method can be used + * to access elements via an index node. + * + * @param {IndexNode} indexNode - indexNode. + * @return {ReferenceElementNode} A reference to an element. + */ + element(indexNode: IndexNode): ReferenceElementNode; + /** + * Sets the uniform group for this reference node. + * + * @param {UniformGroupNode} group - The uniform group to set. + * @return {ReferenceNode} A reference to this node. + */ + setGroup(group: UniformGroupNode): ReferenceNode; + /** + * Sets the name for the internal uniform. + * + * @param {string} name - The label to set. + * @return {ReferenceNode} A reference to this node. + */ + setName(name: string): ReferenceNode; + /** + * Sets the label for the internal uniform. + * + * @deprecated + * @param {string} name - The label to set. + * @return {ReferenceNode} A reference to this node. + */ + label(name: string): ReferenceNode; + /** + * Sets the node type which automatically defines the internal + * uniform type. + * + * @param {string} uniformType - The type to set. + */ + setNodeType(uniformType: string): void; + /** + * This method is overwritten since the node type is inferred from + * the type of the reference node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the property value from the given referred object. + * + * @param {Object} [object=this.reference] - The object to retrieve the property value from. + * @return {any} The value. + */ + getValueFromReference(object?: Object): any; + /** + * Allows to update the reference based on the given state. The state is only + * evaluated {@link ReferenceNode#object} is not set. + * + * @param {(NodeFrame|NodeBuilder)} state - The current state. + * @return {Object} The updated reference. + */ + updateReference(state: (NodeFrame | NodeBuilder)): Object; + /** + * The output of the reference node is the internal uniform node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {UniformNode} The output node. + */ + setup(): UniformNode; + /** + * Overwritten to update the internal uniform value. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(): void; + /** + * Retrieves the value from the referred object property and uses it + * to updated the internal uniform. + */ + updateValue(): void; +} +/** + * This node can be used to implement mirror-like flat reflective surfaces. + * + * ```js + * const groundReflector = reflector(); + * material.colorNode = groundReflector; + * + * const plane = new Mesh( geometry, material ); + * plane.add( groundReflector.target ); + * ``` + * + * @augments TextureNode + */ +export class ReflectorNode extends TextureNode { + /** + * Constructs a new reflector node. + * + * @param {Object} [parameters={}] - An object holding configuration parameters. + * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. + * @param {number} [parameters.resolutionScale=1] - The resolution scale. + * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. + * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. + * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. + * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. + * @param {TextureNode} [parameters.defaultTexture] - The default texture node. + * @param {ReflectorBaseNode} [parameters.reflector] - The reflector base node. + */ + constructor(parameters?: { + target?: Object3D | undefined; + resolutionScale?: number | undefined; + generateMipmaps?: boolean | undefined; + bounces?: boolean | undefined; + depth?: boolean | undefined; + samples?: number | undefined; + defaultTexture?: TextureNode | undefined; + reflector?: ReflectorBaseNode | undefined; + }); + /** + * A reference to the internal reflector base node which holds the actual implementation. + * + * @private + * @type {ReflectorBaseNode} + * @default ReflectorBaseNode + */ + private _reflectorBaseNode; + /** + * A reference to the internal depth node. + * + * @private + * @type {?Node} + * @default null + */ + private _depthNode; + /** + * A reference to the internal reflector node. + * + * @type {ReflectorBaseNode} + */ + get reflector(): ReflectorBaseNode; + /** + * A reference to 3D object the reflector is linked to. + * + * @type {Object3D} + */ + get target(): Object3D; + /** + * Returns a node representing the mirror's depth. That can be used + * to implement more advanced reflection effects like distance attenuation. + * + * @return {Node} The depth node. + */ + getDepthNode(): Node; + setup(builder: any): void; + clone(): any; +} +import { ReinhardToneMapping } from './three.core.js'; +import { RenderObjectRefreshType } from './three.core.js'; +/** + * Normally, tone mapping and color conversion happens automatically just + * before outputting a pixel to the default (screen) framebuffer. In certain + * post processing setups this is too late because some effects such as FXAA + * require e.g. sRGB input. For such scenarios, `RenderOutputNode` can be used + * to apply tone mapping and color space conversion at an arbitrary point + * in the effect chain. + * + * When applying tone mapping and color space conversion manually with this node, + * you have to set {@link RenderPipeline#outputColorTransform} to `false`. + * + * ```js + * const postProcessing = new RenderPipeline( renderer ); + * postProcessing.outputColorTransform = false; + * + * const scenePass = pass( scene, camera ); + * const outputPass = renderOutput( scenePass ); + * + * postProcessing.outputNode = outputPass; + * ``` + * + * @augments TempNode + */ +export class RenderOutputNode extends TempNode { + /** + * Constructs a new render output node. + * + * @param {Node} colorNode - The color node to process. + * @param {?number} toneMapping - The tone mapping type. + * @param {?string} outputColorSpace - The output color space. + */ + constructor(colorNode: Node, toneMapping: number | null, outputColorSpace: string | null); + /** + * The color node to process. + * + * @type {Node} + */ + colorNode: Node; + /** + * The tone mapping type. + * + * @private + * @type {?number} + */ + private _toneMapping; + /** + * The output color space. + * + * @type {?string} + */ + outputColorSpace: string | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderOutputNode: boolean; + /** + * Sets the tone mapping type. + * + * @param {number} value - The tone mapping type. + * @return {ToneMappingNode} A reference to this node. + */ + setToneMapping(value: number): ToneMappingNode; + /** + * Gets the tone mapping type. + * + * @returns {number} The tone mapping type. + */ + getToneMapping(): number; + setup({ context }: { + context: any; + }): Node; +} +/** + * This module is responsible to manage the rendering pipeline setups in apps. + * You usually create a single instance of this class and use it to define + * the output of your render pipeline and post processing effect chain. + * ```js + * const renderPipeline = new RenderPipeline( renderer ); + * + * const scenePass = pass( scene, camera ); + * + * renderPipeline.outputNode = scenePass; + * ``` + * + * Note: This module can only be used with `WebGPURenderer`. + */ +export class RenderPipeline { + /** + * Constructs a new render pipeline management module. + * + * @param {Renderer} renderer - A reference to the renderer. + * @param {Node} outputNode - An optional output node. + */ + constructor(renderer: Renderer, outputNode?: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderPipeline: boolean; + /** + * A reference to the renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * A node which defines the final output of the rendering + * pipeline. This is usually the last node in a chain + * of effect nodes. + * + * @type {Node} + */ + outputNode: Node; + /** + * Whether the default output tone mapping and color + * space transformation should be enabled or not. + * + * This is enabled by default but it must be disabled for + * effects that expect to be executed after tone mapping and color + * space conversion. A typical example is FXAA which + * requires sRGB input. + * + * When set to `false`, the app must control the output + * transformation with `RenderOutputNode`. + * + * ```js + * const outputPass = renderOutput( scenePass ); + * ``` + * + * @type {boolean} + */ + outputColorTransform: boolean; + /** + * Must be set to `true` when the output node changes. + * + * @type {Node} + */ + needsUpdate: Node; + /** + * The full screen quad that is used to render + * the effects. + * + * @private + * @type {QuadMesh} + */ + private _quadMesh; + /** + * The context data for the render pipeline. + * + * @private + * @type {?Object} + * @default null + */ + private _contextData; + /** + * The current tone mapping. + * + * @private + * @type {ToneMapping} + */ + private _toneMapping; + /** + * The current output color space. + * + * @private + * @type {ColorSpace} + */ + private _outputColorSpace; + /** + * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, + * the application must use this version of `render()` inside + * its animation loop (not the one from the renderer). + */ + render(): void; + /** + * Frees internal resources. + */ + dispose(): void; + /** + * Updates the context data. + * + * @private + */ + private _updateContext; + /** + * Updates the state of the module. + * + * @private + */ + private _update; + /** + * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, + * the application must use this version of `renderAsync()` inside + * its animation loop (not the one from the renderer). + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the render has been finished. + */ + renderAsync(): Promise; +} +import { RenderTarget } from './three.core.js'; +/** + * Base class for renderers. + */ +export class Renderer { + /** + * Renderer options. + * + * @typedef {Object} Renderer~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0 + * to overwrite the default. + * @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. + * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best + * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. + * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. + */ + /** + * Constructs a new renderer. + * + * @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2). + * @param {Renderer~Options} [parameters] - The configuration parameter. + + */ + constructor(backend: Backend, parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderer: boolean; + /** + * A reference to the current backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * Whether the renderer should automatically clear the current rendering target + * before execute a `render()` call. The target can be the canvas (default framebuffer) + * or the current bound render target (custom framebuffer). + * + * @type {boolean} + * @default true + */ + autoClear: boolean; + /** + * When `autoClear` is set to `true`, this property defines whether the renderer + * should clear the color buffer. + * + * @type {boolean} + * @default true + */ + autoClearColor: boolean; + /** + * When `autoClear` is set to `true`, this property defines whether the renderer + * should clear the depth buffer. + * + * @type {boolean} + * @default true + */ + autoClearDepth: boolean; + /** + * When `autoClear` is set to `true`, this property defines whether the renderer + * should clear the stencil buffer. + * + * @type {boolean} + * @default true + */ + autoClearStencil: boolean; + /** + * Whether the default framebuffer should be transparent or opaque. + * + * @type {boolean} + * @default true + */ + alpha: boolean; + /** + * Whether logarithmic depth buffer is enabled or not. + * + * @type {boolean} + * @default false + * @readonly + */ + readonly logarithmicDepthBuffer: boolean; + /** + * Whether reversed depth buffer is enabled or not. + * + * @type {boolean} + * @default false + * @readonly + */ + readonly reversedDepthBuffer: boolean; + /** + * Defines the output color space of the renderer. + * + * @type {string} + * @default SRGBColorSpace + */ + outputColorSpace: string; + /** + * Defines the tone mapping of the renderer. + * + * @type {number} + * @default NoToneMapping + */ + toneMapping: number; + /** + * Defines the tone mapping exposure. + * + * @type {number} + * @default 1 + */ + toneMappingExposure: number; + /** + * Whether the renderer should sort its render lists or not. + * + * Note: Sorting is used to attempt to properly render objects that have some degree of transparency. + * By definition, sorting objects may not work in all cases. Depending on the needs of application, + * it may be necessary to turn off sorting and use other methods to deal with transparency rendering + * e.g. manually determining each object's rendering order. + * + * @type {boolean} + * @default true + */ + sortObjects: boolean; + /** + * Whether the default framebuffer should have a depth buffer or not. + * + * @type {boolean} + * @default true + */ + depth: boolean; + /** + * Whether the default framebuffer should have a stencil buffer or not. + * + * @type {boolean} + * @default false + */ + stencil: boolean; + /** + * Holds a series of statistical information about the GPU memory + * and the rendering process. Useful for debugging and monitoring. + * + * @type {Info} + */ + info: Info; + /** + * A global context node that stores override nodes for specific transformations or calculations. + * These nodes can be used to replace default behavior in the rendering pipeline. + * + * @type {ContextNode} + * @property {Object} value - The context value object. + */ + contextNode: ContextNode; + /** + * The node library defines how certain library objects like materials, lights + * or tone mapping functions are mapped to node types. This is required since + * although instances of classes like `MeshBasicMaterial` or `PointLight` can + * be part of the scene graph, they are internally represented as nodes for + * further processing. + * + * @type {NodeLibrary} + */ + library: NodeLibrary; + /** + * A map-like data structure for managing lights. + * + * @type {Lighting} + */ + lighting: Lighting; + /** + * The number of MSAA samples. + * + * @private + * @type {number} + * @default 0 + */ + private _samples; + /** + * Callback when the canvas has been resized. + * + * @private + */ + private _onCanvasTargetResize; + /** + * The canvas target for rendering. + * + * @private + * @type {CanvasTarget} + */ + private _canvasTarget; + /** + * The inspector provides information about the internal renderer state. + * + * @private + * @type {InspectorBase} + */ + private _inspector; + /** + * This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. + * + * @private + * @type {?Function} + */ + private _getFallback; + /** + * A reference to a renderer module for managing shader attributes. + * + * @private + * @type {?Attributes} + * @default null + */ + private _attributes; + /** + * A reference to a renderer module for managing geometries. + * + * @private + * @type {?Geometries} + * @default null + */ + private _geometries; + /** + * A reference to a renderer module for managing node related logic. + * + * @private + * @type {?NodeManager} + * @default null + */ + private _nodes; + /** + * A reference to a renderer module for managing the internal animation loop. + * + * @private + * @type {?Animation} + * @default null + */ + private _animation; + /** + * A reference to a renderer module for managing shader program bindings. + * + * @private + * @type {?Bindings} + * @default null + */ + private _bindings; + /** + * A reference to a renderer module for managing render objects. + * + * @private + * @type {?RenderObjects} + * @default null + */ + private _objects; + /** + * A reference to a renderer module for managing render and compute pipelines. + * + * @private + * @type {?Pipelines} + * @default null + */ + private _pipelines; + /** + * A reference to a renderer module for managing render bundles. + * + * @private + * @type {?RenderBundles} + * @default null + */ + private _bundles; + /** + * A reference to a renderer module for managing render lists. + * + * @private + * @type {?RenderLists} + * @default null + */ + private _renderLists; + /** + * A reference to a renderer module for managing render contexts. + * + * @private + * @type {?RenderContexts} + * @default null + */ + private _renderContexts; + /** + * A reference to a renderer module for managing textures. + * + * @private + * @type {?Textures} + * @default null + */ + private _textures; + /** + * A reference to a renderer module for backgrounds. + * + * @private + * @type {?Background} + * @default null + */ + private _background; + /** + * Cache for the fullscreen quad. + * This fullscreen quad is used for internal render passes + * like the tone mapping and color space output pass. + * + * @private + * @type {Map} + */ + private _quadCache; + /** + * A reference to the current render context. + * + * @private + * @type {?RenderContext} + * @default null + */ + private _currentRenderContext; + /** + * A custom sort function for the opaque render list. + * + * @private + * @type {?Function} + * @default null + */ + private _opaqueSort; + /** + * A custom sort function for the transparent render list. + * + * @private + * @type {?Function} + * @default null + */ + private _transparentSort; + /** + * Cache of framebuffer targets per canvas target. + * + * @private + * @type {Map} + */ + private _frameBufferTargets; + /** + * The clear color value. + * + * @private + * @type {Color4} + */ + private _clearColor; + /** + * The clear depth value. + * + * @private + * @type {number} + * @default 1 + */ + private _clearDepth; + /** + * The clear stencil value. + * + * @private + * @type {number} + * @default 0 + */ + private _clearStencil; + /** + * The current render target. + * + * @private + * @type {?RenderTarget} + * @default null + */ + private _renderTarget; + /** + * The active cube face. + * + * @private + * @type {number} + * @default 0 + */ + private _activeCubeFace; + /** + * The active mipmap level. + * + * @private + * @type {number} + * @default 0 + */ + private _activeMipmapLevel; + /** + * The current output render target. + * + * @private + * @type {?RenderTarget} + * @default null + */ + private _outputRenderTarget; + /** + * The MRT setting. + * + * @private + * @type {?MRTNode} + * @default null + */ + private _mrt; + /** + * This function defines how a render object is going + * to be rendered. + * + * @private + * @type {?Function} + * @default null + */ + private _renderObjectFunction; + /** + * Used to keep track of the current render object function. + * + * @private + * @type {?Function} + * @default null + */ + private _currentRenderObjectFunction; + /** + * Used to keep track of the current render bundle. + * + * @private + * @type {?RenderBundle} + * @default null + */ + private _currentRenderBundle; + /** + * Next to `_renderObjectFunction()`, this function provides another hook + * for influencing the render process of a render object. It is meant for internal + * use and only relevant for `compileAsync()` right now. Instead of using + * the default logic of `_renderObjectDirect()` which actually draws the render object, + * a different function might be used which performs no draw but just the node + * and pipeline updates. + * + * @private + * @type {Function} + */ + private _handleObjectFunction; + /** + * Indicates whether the device has been lost or not. In WebGL terms, the device + * lost is considered as a context lost. When this is set to `true`, rendering + * isn't possible anymore. + * + * @private + * @type {boolean} + * @default false + */ + private _isDeviceLost; + /** + * A callback function that defines what should happen when a device/context lost occurs. + * + * @type {Function} + */ + onDeviceLost: Function; + /** + * A callback function that defines what should happen when an uncaptured + * backend error is reported (e.g. a WebGPU validation/out-of-memory/internal + * error raised outside an error scope). Applications can override this to + * surface errors in their own UI without letting them escalate to a device + * loss. The default implementation logs to the console. + * + * @type {Function} + */ + onError: Function; + /** + * Defines the type of output buffers. The default `HalfFloatType` is recommend for + * best quality. To save memory and bandwidth, `UnsignedByteType` might be used. + * This will reduce rendering quality though. + * + * @private + * @type {number} + * @default HalfFloatType + */ + private _outputBufferType; + /** + * A cache for shadow nodes per material + * + * @private + * @type {WeakMap} + */ + private _cacheShadowNodes; + /** + * Whether the renderer has been initialized or not. + * + * @private + * @type {boolean} + * @default false + */ + private _initialized; + /** + * The call depth of the renderer. Counts the number of + * nested render calls. + * + * @private + * @type {number} + * @default - 1 + */ + private _callDepth; + /** + * A reference to the promise which initializes the renderer. + * + * @private + * @type {?Promise} + * @default null + */ + private _initPromise; + /** + * An array of compilation promises which are used in `compileAsync()`. + * + * @private + * @type {?Array} + * @default null + */ + private _compilationPromises; + /** + * Whether the renderer is currently precompiling a render object in + * `compileAsync()`. + * + * @private + * @type {boolean} + * @default false + */ + private _isPreCompiling; + /** + * When an override material is in use, this property points to the current + * source material during the rendering of a render object. + * + * @private + * @type {?Material} + * @default null + */ + private _currentSourceMaterial; + /** + * Whether the renderer should render transparent render objects or not. + * + * @type {boolean} + * @default true + */ + transparent: boolean; + /** + * Whether the renderer should render opaque render objects or not. + * + * @type {boolean} + * @default true + */ + opaque: boolean; + /** + * Shadow map configuration + * @typedef {Object} ShadowMapConfig + * @property {boolean} enabled - Whether to globally enable shadows or not. + * @property {boolean} transmitted - Whether to enable light transmission through non-opaque materials. + * @property {number} type - The shadow map type. + */ + /** + * The renderer's shadow configuration. + * + * @type {ShadowMapConfig} + */ + shadowMap: { + /** + * - Whether to globally enable shadows or not. + */ + enabled: boolean; + /** + * - Whether to enable light transmission through non-opaque materials. + */ + transmitted: boolean; + /** + * - The shadow map type. + */ + type: number; + }; + /** + * XR configuration. + * @typedef {Object} XRConfig + * @property {boolean} enabled - Whether to globally enable XR or not. + */ + /** + * The renderer's XR manager. + * + * @type {XRManager} + */ + xr: XRManager; + /** + * Debug configuration. + * @typedef {Object} DebugConfig + * @property {boolean} checkShaderErrors - Whether shader errors should be checked or not. + * @property {Object} diagnostics - Diagnostics configuration for the shader generation. + * @property {boolean} diagnostics.keywords - Whether declaration names that collide with reserved keywords should be renamed or not. + * @property {?Function} onNodeBuilderCreated - A callback function that is executed after a node builder has been created and before it is built. + * @property {?Function} onShaderError - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. + * @property {Function} getShaderAsync - Allows the get the raw shader code for the given scene, camera and 3D object. + */ + /** + * The renderer's debug configuration. + * + * @type {DebugConfig} + */ + debug: { + /** + * - Whether shader errors should be checked or not. + */ + checkShaderErrors: boolean; + /** + * - Diagnostics configuration for the shader generation. + */ + diagnostics: { + keywords: boolean; + }; + /** + * - A callback function that is executed after a node builder has been created and before it is built. + */ + onNodeBuilderCreated: Function | null; + /** + * - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. + */ + onShaderError: Function | null; + /** + * - Allows the get the raw shader code for the given scene, camera and 3D object. + */ + getShaderAsync: Function; + }; + /** + * Initializes the renderer so it is ready for usage. + * + * @async + * @return {Promise} A Promise that resolves when the renderer has been initialized. + */ + init(): Promise; + /** + * A reference to the canvas element the renderer is drawing to. + * This value of this property will automatically be created by + * the renderer. + * + * @type {HTMLCanvasElement|OffscreenCanvas} + */ + get domElement(): HTMLCanvasElement | OffscreenCanvas; + /** + * The coordinate system of the renderer. The value of this property + * depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or + * `THREE.WebGPUCoordinateSystem`. + * + * @readonly + * @type {number} + */ + readonly get coordinateSystem(): number; + /** + * Compiles all materials in the given scene. This can be useful to avoid a + * phenomenon which is called "shader compilation stutter", which occurs when + * rendering an object with a new shader for the first time. + * + * If you want to add a 3D object to an existing scene, use the third optional + * parameter for applying the target scene. Note that the (target) scene's lighting + * and environment must be configured before calling this method. + * + * @async + * @param {Object3D} scene - The scene or 3D object to precompile. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {?Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. + * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. + * @return {Promise} A Promise that resolves when the compile has been finished. + */ + compileAsync(scene: Object3D, camera: Camera, targetScene?: Scene | null, onProgress?: onProgressCallback): Promise; + /** + * Compile compute programs. This can be useful to avoid a + * phenomenon which is called "shader compilation stutter", which occurs when + * rendering an object with a new shader for the first time. + * + * @async + * @param {Node|Array} computeNodes - The compute node(s). + * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. + * @return {Promise} A Promise that resolves when the compile has been finished. + */ + compileComputeAsync(computeNodes: Node | Array, onProgress?: onProgressCallback): Promise; + /** + * Renders the scene in an async fashion. + * + * @async + * @deprecated + * @param {Object3D} scene - The scene or 3D object to render. + * @param {Camera} camera - The camera. + * @return {Promise} A Promise that resolves when the render has been finished. + */ + renderAsync(scene: Object3D, camera: Camera): Promise; + /** + * Can be used to synchronize CPU operations with GPU tasks. So when this method is called, + * the CPU waits for the GPU to complete its operation (e.g. a compute task). + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when synchronization has been finished. + */ + waitForGPU(): Promise; + set inspector(value: InspectorBase); + /** + * The inspector instance. The inspector can be any class that extends from `InspectorBase`. + * + * @type {InspectorBase} + */ + get inspector(): InspectorBase; + /** + * Enables or disables high precision for model-view and normal-view matrices. + * When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance. + * + * NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`. + * + * @param {boolean} value - Whether to enable or disable high precision. + * @type {boolean} + */ + set highPrecision(value: boolean); + /** + * Returns whether high precision is enabled or not. + * + * @return {boolean} Whether high precision is enabled or not. + * @type {boolean} + */ + get highPrecision(): boolean; + /** + * Sets the given MRT configuration. + * + * @param {MRTNode} mrt - The MRT node to set. + * @return {Renderer} A reference to this renderer. + */ + setMRT(mrt: MRTNode): Renderer; + /** + * Returns the MRT configuration. + * + * @return {MRTNode} The MRT configuration. + */ + getMRT(): MRTNode; + /** + * Returns the output buffer type. + * + * @return {number} The output buffer type. + */ + getOutputBufferType(): number; + /** + * Returns the output buffer type. + * + * @deprecated since r182. Use `.getOutputBufferType()` instead. + * @return {number} The output buffer type. + */ + getColorBufferType(): number; + /** + * Default implementation of the device lost callback. + * + * @private + * @param {Object} info - Information about the context lost. + */ + private _onDeviceLost; + /** + * Default implementation of the uncaptured backend error callback. + * + * @private + * @param {Object} info - Information about the uncaptured error. + */ + private _onError; + /** + * Returns `true` if the cached GPU render bundle for the given bundle group is + * out-of-date and must be recorded again. + * + * @private + * @param {BundleGroup} bundleGroup - The bundle group. + * @param {Object} renderBundleData - The backend data of the render bundle. + * @return {boolean} Whether the cached render bundle needs an update. + */ + private _bundleNeedsUpdate; + /** + * Renders the given render bundle. + * + * @private + * @param {Object} bundle - Render bundle data. + * @param {Scene} sceneRef - The scene the render bundle belongs to. + * @param {LightsNode} lightsNode - The lights node. + */ + private _renderBundle; + /** + * Renders the scene or 3D object with the given camera. This method can only be called + * if the renderer has been initialized. When using `render()` inside an animation loop, + * it's guaranteed the renderer will be initialized. The animation loop must be defined + * with {@link Renderer#setAnimationLoop} though. + * + * For all other use cases (like when using on-demand rendering), you must call + * {@link Renderer#init} before rendering. + * + * The target of the method is the default framebuffer (meaning the canvas) + * or alternatively a render target when specified via `setRenderTarget()`. + * + * @param {Object3D} scene - The scene or 3D object to render. + * @param {Camera} camera - The camera to render the scene with. + */ + render(scene: Object3D, camera: Camera): void; + /** + * Returns whether the renderer has been initialized or not. + * + * @readonly + * @return {boolean} Whether the renderer has been initialized or not. + */ + readonly get initialized(): boolean; + _renderOutputLayers(quad: any, renderTarget: any): void; + /** + * Returns an internal render target which is used when computing the output tone mapping + * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render + * pass and not inline to achieve more correct results. + * + * @private + * @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied. + */ + private _getFrameBufferTarget; + /** + * Renders the scene or 3D object with the given camera. + * + * @private + * @param {Object3D} scene - The scene or 3D object to render. + * @param {Camera} camera - The camera to render the scene with. + * @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not. + * @return {RenderContext} The current render context. + */ + private _renderScene; + _setXRLayerSize(width: any, height: any): void; + /** + * The output pass performs tone mapping and color space conversion. + * + * @private + * @param {RenderTarget} renderTarget - The current render target. + */ + private _renderOutput; + /** + * Returns the maximum available anisotropy for texture filtering. + * + * @return {number} The maximum available anisotropy. + */ + getMaxAnisotropy(): number; + /** + * Returns the active cube face. + * + * @return {number} The active cube face. + */ + getActiveCubeFace(): number; + /** + * Returns the active mipmap level. + * + * @return {number} The active mipmap level. + */ + getActiveMipmapLevel(): number; + /** + * Applications are advised to always define the animation loop + * with this method and not manually with `requestAnimationFrame()` + * for best compatibility. + * + * @async + * @param {?onAnimationCallback} callback - The application's animation loop. + * @return {Promise} A Promise that resolves when the set has been executed. + */ + setAnimationLoop(callback: onAnimationCallback | null): Promise; + /** + * Returns the current animation loop callback. + * + * @return {?Function} The current animation loop callback. + */ + getAnimationLoop(): Function | null; + /** + * Can be used to transfer buffer data from a storage buffer attribute + * from the GPU to the CPU in context of compute shaders. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @param {number} offset - The storage buffer attribute. + * @param {number} count - The offset from which to start reading the + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Returns the rendering context. + * + * @return {GPUCanvasContext|WebGL2RenderingContext} The rendering context. + */ + getContext(): GPUCanvasContext | WebGL2RenderingContext; + /** + * Returns the pixel ratio. + * + * @return {number} The pixel ratio. + */ + getPixelRatio(): number; + /** + * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize(target: Vector2): Vector2; + /** + * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The renderer's size in logical pixels. + */ + getSize(target: Vector2): Vector2; + /** + * Sets the given pixel ratio and resizes the canvas if necessary. + * + * @param {number} [value=1] - The pixel ratio. + */ + setPixelRatio(value?: number): void; + /** + * This method allows to define the drawing buffer size by specifying + * width, height and pixel ratio all at once. The size of the drawing + * buffer is computed with this formula: + * ```js + * size.x = width * pixelRatio; + * size.y = height * pixelRatio; + * ``` + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {number} pixelRatio - The pixel ratio. + */ + setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; + /** + * Sets the size of the renderer. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. + */ + setSize(width: number, height: number, updateStyle?: boolean): void; + /** + * Defines a manual sort function for the opaque render list. + * Pass `null` to use the default sort. + * + * @param {Function} method - The sort function. + */ + setOpaqueSort(method: Function): void; + /** + * Defines a manual sort function for the transparent render list. + * Pass `null` to use the default sort. + * + * @param {Function} method - The sort function. + */ + setTransparentSort(method: Function): void; + /** + * Returns the scissor rectangle. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The scissor rectangle. + */ + getScissor(target: Vector4): Vector4; + /** + * Defines the scissor rectangle. + * + * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the box in logical pixel unit. + * Instead of passing four arguments, the method also works with a single four-dimensional vector. + * @param {number} y - The vertical coordinate for the upper left corner of the box in logical pixel unit. + * @param {number} width - The width of the scissor box in logical pixel unit. + * @param {number} height - The height of the scissor box in logical pixel unit. + */ + setScissor(x: number | Vector4, y: number, width: number, height: number): void; + /** + * Returns the scissor test value. + * + * @return {boolean} Whether the scissor test should be enabled or not. + */ + getScissorTest(): boolean; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Resets the backend's internal state cache. Useful when the rendering context is shared with + * other libraries that change the state. A no-op for the WebGPU backend. + */ + resetState(): void; + /** + * Returns the viewport definition. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The viewport definition. + */ + getViewport(target: Vector4): Vector4; + /** + * Defines the viewport. + * + * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the viewport origin in logical pixel unit. + * @param {number} y - The vertical coordinate for the upper left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. + * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. + */ + setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; + /** + * Returns the clear color. + * + * @param {Color} target - The method writes the result in this target object. + * @return {Color} The clear color. + */ + getClearColor(target: Color): Color; + /** + * Defines the clear color and optionally the clear alpha. + * + * @param {Color} color - The clear color. + * @param {number} [alpha=1] - The clear alpha. + */ + setClearColor(color: Color, alpha?: number): void; + /** + * Returns the clear alpha. + * + * @return {number} The clear alpha. + */ + getClearAlpha(): number; + /** + * Defines the clear alpha. + * + * @param {number} alpha - The clear alpha. + */ + setClearAlpha(alpha: number): void; + /** + * Returns the clear depth. + * + * @return {number} The clear depth. + */ + getClearDepth(): number; + /** + * Defines the clear depth. + * + * @param {number} depth - The clear depth. + */ + setClearDepth(depth: number): void; + /** + * Returns the clear stencil. + * + * @return {number} The clear stencil. + */ + getClearStencil(): number; + /** + * Defines the clear stencil. + * + * @param {number} stencil - The clear stencil. + */ + setClearStencil(stencil: number): void; + /** + * This method performs an occlusion query for the given 3D object. + * It returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. + * + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(object: Object3D): boolean; + /** + * Performs a manual clear operation. This method ignores `autoClear` properties. + * + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear(color?: boolean, depth?: boolean, stencil?: boolean): void; + /** + * Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties. + */ + clearColor(): void; + /** + * Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties. + */ + clearDepth(): void; + /** + * Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties. + */ + clearStencil(): void; + /** + * Async version of {@link Renderer#clear}. + * + * @async + * @deprecated + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise; + /** + * Async version of {@link Renderer#clearColor}. + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearColorAsync(): Promise; + /** + * Async version of {@link Renderer#clearDepth}. + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearDepthAsync(): Promise; + /** + * Async version of {@link Renderer#clearStencil}. + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearStencilAsync(): Promise; + /** + * Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion. + * If this is the case, the renderer allocates an internal render target for that purpose. + * + * @type {boolean} + */ + get needsFrameBufferTarget(): boolean; + /** + * The number of samples used for multi-sample anti-aliasing (MSAA). + * + * @type {number} + * @default 0 + */ + get samples(): number; + /** + * The current number of samples used for multi-sample anti-aliasing (MSAA). + * + * When rendering to a custom render target, the number of samples of that render target is used. + * The number of samples is set to 0 when the renderer needs an internal framebuffer target for + * tone mapping or color space conversion, or when rendering a fullscreen quad to screen. + * + * @type {number} + */ + get currentSamples(): number; + /** + * The current tone mapping of the renderer. When not producing screen output, + * the tone mapping is always `NoToneMapping`. + * + * @type {number} + */ + get currentToneMapping(): number; + /** + * The current color space of the renderer. When not producing screen output, + * the color space is always the working color space. + * + * @type {string} + */ + get currentColorSpace(): string; + /** + * Returns `true` if the rendering settings are set to screen output. + * + * @returns {boolean} True if the current render target is the same of output render target or `null`, otherwise false. + */ + get isOutputTarget(): boolean; + /** + * Frees all internal resources of the renderer. Call this method if the renderer + * is no longer in use by your app. + */ + dispose(): void; + /** + * Sets the given render target. Calling this method means the renderer does not + * target the default framebuffer (meaning the canvas) anymore but a custom framebuffer. + * Use `null` as the first argument to reset the state. + * + * @param {?RenderTarget} renderTarget - The render target to set. + * @param {number} [activeCubeFace=0] - The active cube face. + * @param {number} [activeMipmapLevel=0] - The active mipmap level. + */ + setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void; + /** + * Returns the current render target. + * + * @return {?RenderTarget} The render target. Returns `null` if no render target is set. + */ + getRenderTarget(): RenderTarget | null; + /** + * Sets the output render target for the renderer. + * + * @param {?RenderTarget} renderTarget - The render target to set as the output target. + */ + setOutputRenderTarget(renderTarget: RenderTarget | null): void; + /** + * Returns the current output target. + * + * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set. + */ + getOutputRenderTarget(): RenderTarget | null; + /** + * Sets the canvas target. The canvas target manages the HTML canvas + * or the offscreen canvas the renderer draws into. + * + * @param {CanvasTarget} canvasTarget - The canvas target. + */ + setCanvasTarget(canvasTarget: CanvasTarget): void; + /** + * Returns the current canvas target. + * + * @return {CanvasTarget} The current canvas target. + */ + getCanvasTarget(): CanvasTarget; + /** + * Resets the renderer to the initial state before WebXR started. + * + * @private + */ + private _resetXRState; + /** + * Callback for {@link Renderer#setRenderObjectFunction}. + * + * @callback renderObjectFunction + * @param {Object3D} object - The 3D object. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {BufferGeometry} geometry - The object's geometry. + * @param {Material} material - The object's material. + * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {LightsNode} lightsNode - The current lights node. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {?string} [passId=null] - An optional ID for identifying the pass. + */ + /** + * Sets the given render object function. Calling this method overwrites the default implementation + * which is {@link Renderer#renderObject}. Defining a custom function can be useful + * if you want to modify the way objects are rendered. For example you can define things like "every + * object that has material of a certain type should perform a pre-pass with a special overwrite material". + * The custom function must always call `renderObject()` in its implementation. + * + * Use `null` as the first argument to reset the state. + * + * @param {?renderObjectFunction} renderObjectFunction - The render object function. + */ + setRenderObjectFunction(renderObjectFunction: ((object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext: ClippingContext, passId?: string | null | undefined) => any) | null): void; + /** + * Returns the current render object function. + * + * @return {?Function} The current render object function. Returns `null` if no function is set. + */ + getRenderObjectFunction(): Function | null; + /** + * Execute a single or an array of compute nodes. This method can only be called + * if the renderer has been initialized. + * + * @param {Node|Array} computeNodes - The compute node(s). + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. + * @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized. + */ + compute(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise | undefined; + /** + * Execute a single or an array of compute nodes. + * + * @async + * @param {Node|Array} computeNodes - The compute node(s). + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. + * @return {Promise} A Promise that resolve when the compute has finished. + */ + computeAsync(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise; + /** + * Checks if the given feature is supported by the selected backend. + * + * @async + * @deprecated + * @param {string} name - The feature's name. + * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. + */ + hasFeatureAsync(name: string): Promise; + resolveTimestampsAsync(type?: string): Promise; + /** + * Checks if the given feature is supported by the selected backend. If the + * renderer has not been initialized, this method always returns `false`. + * + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(name: string): boolean; + /** + * Returns `true` when the renderer has been initialized. + * + * @return {boolean} Whether the renderer has been initialized or not. + */ + hasInitialized(): boolean; + /** + * Initializes the given textures. Useful for preloading a texture rather than waiting until first render + * (which can cause noticeable lags due to decode and GPU upload overhead). + * + * @async + * @deprecated + * @param {Texture} texture - The texture. + * @return {Promise} A Promise that resolves when the texture has been initialized. + */ + initTextureAsync(texture: Texture): Promise; + /** + * Initializes the given texture. Useful for preloading a texture rather than waiting until first render + * (which can cause noticeable lags due to decode and GPU upload overhead). + * + * This method can only be used if the renderer has been initialized. + * + * @param {Texture} texture - The texture. + */ + initTexture(texture: Texture): void; + /** + * Initializes the given render target. + * + * @param {RenderTarget} renderTarget - The render target to intialize. + */ + initRenderTarget(renderTarget: RenderTarget): void; + /** + * Copies the current bound framebuffer into the given texture. + * + * @param {FramebufferTexture} framebufferTexture - The texture. + * @param {?(Vector2|Vector4)} [rectangle=null] - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied. + */ + copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: (Vector2 | Vector4) | null): void; + /** + * Copies data of the given source texture into a destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. + * @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: Box2 | Box3, dstPosition?: Vector2 | Vector3, srcLevel?: number, dstLevel?: number): void; + /** + * Reads pixel data from the given render target. + * + * @async + * @param {RenderTarget} renderTarget - The render target to read from. + * @param {number} x - The `x` coordinate of the copy region's origin. + * @param {number} y - The `y` coordinate of the copy region's origin. + * @param {number} width - The width of the copy region. + * @param {number} height - The height of the copy region. + * @param {number} [textureIndex=0] - The texture index of a MRT render target. + * @param {number} [faceIndex=0] - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. + */ + readRenderTargetPixelsAsync(renderTarget: RenderTarget, x: number, y: number, width: number, height: number, textureIndex?: number, faceIndex?: number): Promise; + /** + * Analyzes the given 3D object's hierarchy and builds render lists from the + * processed hierarchy. + * + * @private + * @param {Object3D} object - The 3D object to process (usually a scene). + * @param {Camera} camera - The camera the object is rendered with. + * @param {number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups. + * @param {RenderList} renderList - The current render list. + * @param {ClippingContext} clippingContext - The current clipping context. + */ + private _projectObject; + /** + * Renders the given render bundles. + * + * @private + * @param {Array} bundles - Array with render bundle data. + * @param {Scene} sceneRef - The scene the render bundles belong to. + * @param {LightsNode} lightsNode - The current lights node. + */ + private _renderBundles; + /** + * Renders the transparent objects from the given render lists. + * + * @private + * @param {Array} renderList - The transparent render list. + * @param {Array} doublePassList - The list of transparent objects which require a double pass (e.g. because of transmission). + * @param {Camera} camera - The camera the render list should be rendered with. + * @param {Scene} scene - The scene the render list belongs to. + * @param {LightsNode} lightsNode - The current lights node. + */ + private _renderTransparents; + /** + * Renders the objects from the given render list. + * + * @private + * @param {Array} renderList - The render list. + * @param {Camera} camera - The camera the render list should be rendered with. + * @param {Scene} scene - The scene the render list belongs to. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?string} [passId=null] - An optional ID for identifying the pass. + */ + private _renderObjects; + /** + * Retrieves shadow nodes for the given material. This is used to setup shadow passes. + * The result is cached per material and updated when the material's version changes. + * + * @private + * @param {Material} material + * @returns {Object} - The shadow nodes for the material. + */ + private _getShadowNodes; + /** + * Updates the camera so it's prepared for rendering operations. + * + * @private + * @param {Camera} camera - The camera to update. + * @param {boolean} useXRCamera - Whether the XR camera should be used when presenting. + * @return {Camera} The returned camera might be different depending on whether XR is used or not. + */ + private _updateCamera; + /** + * This method represents the default render object function that manages the render lifecycle + * of the object. + * + * @param {Object3D} object - The 3D object. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {BufferGeometry} geometry - The object's geometry. + * @param {Material} material - The object's material. + * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?ClippingContext} clippingContext - The clipping context. + * @param {?string} [passId=null] - An optional ID for identifying the pass. + */ + renderObject(object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext?: ClippingContext | null, passId?: string | null): void; + /** + * Checks if the given compatibility is supported by the selected backend. + * + * @param {string} name - The compatibility's name. + * @return {boolean} Whether the compatibility is supported or not. + */ + hasCompatibility(name: string): boolean; + /** + * This method represents the default `_handleObjectFunction` implementation which creates + * a render object from the given data and performs the draw command with the selected backend. + * + * @private + * @param {Object3D} object - The 3D object. + * @param {Material} material - The object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {string} [passId] - An optional ID for identifying the pass. + */ + private _renderObjectDirect; + /** + * A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering. + * Used in `compileAsync()`. + * + * @private + * @param {Object3D} object - The 3D object. + * @param {Material} material - The object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {string} [passId] - An optional ID for identifying the pass. + */ + private _createObjectPipeline; + /** + * Alias for `compileAsync()`. + * + * @method + * @param {Object3D} scene - The scene or 3D object to precompile. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. + * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. + * @return {function(Object3D, Camera, ?Scene, ?onProgressCallback): Promise|undefined} A Promise that resolves when the compile has been finished. + */ + get compile(): (arg0: Object3D, arg1: Camera, arg2: Scene | null, arg3: onProgressCallback | null) => Promise | undefined; +} +/** + * This node is a special type of reference node which is intended + * for linking renderer properties with node values. + * ```js + * const exposureNode = rendererReference( 'toneMappingExposure', 'float', renderer ); + * ``` + * When changing `renderer.toneMappingExposure`, the node value of `exposureNode` will + * automatically be updated. + * + * @augments ReferenceBaseNode + */ +export class RendererReferenceNode extends ReferenceBaseNode { + /** + * Constructs a new renderer reference node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} inputType - The uniform type that should be used to represent the property value. + * @param {?Renderer} [renderer=null] - The renderer the property belongs to. When no renderer is set, + * the node refers to the renderer of the current state. + */ + constructor(property: string, inputType: string, renderer?: Renderer | null); + /** + * The renderer the property belongs to. When no renderer is set, + * the node refers to the renderer of the current state. + * + * @type {?Renderer} + * @default null + */ + renderer: Renderer | null; +} +export var RendererUtils: Readonly<{ + __proto__: null; + resetRendererAndSceneState: typeof resetRendererAndSceneState; + resetRendererState: typeof resetRendererState; + resetSceneState: typeof resetSceneState; + restoreRendererAndSceneState: typeof restoreRendererAndSceneState; + restoreRendererState: typeof restoreRendererState; + restoreSceneState: typeof restoreSceneState; + saveRendererAndSceneState: typeof saveRendererAndSceneState; + saveRendererState: typeof saveRendererState; + saveSceneState: typeof saveSceneState; +}>; +import { RepeatWrapping } from './three.core.js'; +import { ReplaceStencilOp } from './three.core.js'; +import { ReverseSubtractEquation } from './three.core.js'; +/** + * Applies a rotation to the given position node. + * + * @augments TempNode + */ +export class RotateNode extends TempNode { + /** + * Constructs a new rotate node. + * + * @param {Node} positionNode - The position node. + * @param {Node} rotationNode - Represents the rotation that is applied to the position node. Depending + * on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + */ + constructor(positionNode: Node, rotationNode: Node); + /** + * The position node. + * + * @type {Node} + */ + positionNode: Node; + /** + * Represents the rotation that is applied to the position node. + * Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + * + * @type {Node} + */ + rotationNode: Node; + /** + * The type of the {@link RotateNode#positionNode} defines the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node's type. + */ + generateNodeType(builder: NodeBuilder): string; + setup(builder: any): any; +} +import { SIGNED_R11_EAC_Format } from './three.core.js'; +import { SIGNED_RED_GREEN_RGTC2_Format } from './three.core.js'; +import { SIGNED_RED_RGTC1_Format } from './three.core.js'; +import { SIGNED_RG11_EAC_Format } from './three.core.js'; +import { SRGBColorSpace } from './three.core.js'; +import { SRGBTransfer } from './three.core.js'; +/** + * Class representing a node that samples a value using a provided callback function. + * + * @extends Node + */ +export class SampleNode extends Node { + /** + * Creates an instance of SampleNode. + * + * @param {Function} callback - The function to be called when sampling. Should accept a UV node and return a value. + * @param {?Node} [uvNode=null] - The UV node to be used in the texture sampling. + */ + constructor(callback: Function, uvNode?: Node | null); + callback: Function; + /** + * Represents the texture coordinates. + * + * @type {?Node} + * @default null + */ + uvNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampleNode: boolean; + /** + * Sets up the node by sampling with the default UV accessor. + * + * @returns {Node} The result of the callback function when called with the UV node. + */ + setup(): Node; + /** + * Calls the callback function with the provided UV node. + * + * @param {Node} uv - The UV node or value to be passed to the callback. + * @returns {Node} The result of the callback function. + */ + sample(uv: Node): Node; +} +import { Scene } from './three.core.js'; +/** + * This node provides a collection of screen related metrics. + * Depending on {@link ScreenNode#scope}, the nodes can represent + * resolution or viewport data as well as fragment or uv coordinates. + * + * @augments Node + */ +export class ScreenNode extends Node { + /** + * Constructs a new screen node. + * + * @param {('coordinate'|'viewport'|'size'|'uv')} scope - The node's scope. + */ + constructor(scope: ("coordinate" | "viewport" | "size" | "uv")); + /** + * The node represents different metric depending on which scope is selected. + * + * - `ScreenNode.COORDINATE`: Window-relative coordinates of the current fragment according to WebGPU standards. + * - `ScreenNode.VIEWPORT`: The current viewport defined as a four-dimensional vector. + * - `ScreenNode.SIZE`: The dimensions of the current bound framebuffer. + * - `ScreenNode.UV`: Normalized coordinates. + * + * @type {('coordinate'|'viewport'|'size'|'uv')} + */ + scope: ("coordinate" | "viewport" | "size" | "uv"); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isViewportNode: boolean; + /** + * This method is overwritten since the node type depends on the selected scope. + * + * @return {('vec2'|'vec4')} The node type. + */ + generateNodeType(): ("vec2" | "vec4"); + /** + * `ScreenNode` implements {@link Node#update} to retrieve viewport and size information + * from the current renderer. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update({ renderer }: NodeFrame): void; + setup(): any; + generate(builder: any): any; +} +export namespace ScreenNode { + let COORDINATE: string; + let VIEWPORT: string; + let SIZE: string; + let UV: string; +} +/** + * This module is part of the TSL core and usually not used in app level code. + * `SetNode` represents a set operation which means it is used to implement any + * `setXYZW()`, `setRGBA()` and `setSTPQ()` method invocations on node objects. + * For example: + * ```js + * materialLine.colorNode = color( 0, 0, 0 ).setR( float( 1 ) ); + * ``` + * + * @augments TempNode + */ +export class SetNode extends TempNode { + /** + * Constructs a new set node. + * + * @param {Node} sourceNode - The node that should be updated. + * @param {string} components - The components that should be updated. + * @param {Node} targetNode - The value node. + */ + constructor(sourceNode: Node, components: string, targetNode: Node); + /** + * The node that should be updated. + * + * @type {Node} + */ + sourceNode: Node; + /** + * The components that should be updated. + * + * @type {string} + */ + components: string; + /** + * The value node. + * + * @type {Node} + */ + targetNode: Node; + /** + * This method is overwritten since the node type is inferred from {@link SetNode#sourceNode}. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any): string; +} +/** + * Base class for all shadow nodes. + * + * Shadow nodes encapsulate shadow related logic and are always coupled to lighting nodes. + * Lighting nodes might share the same shadow node type or use specific ones depending on + * their requirements. + * + * @augments Node + */ +export class ShadowBaseNode extends Node { + /** + * Constructs a new shadow base node. + * + * @param {Light} light - The shadow casting light. + */ + constructor(light: Light); + /** + * The shadow casting light. + * + * @type {Light} + */ + light: Light; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowBaseNode: boolean; + /** + * Retrieves or creates a shadow material for the shadow casting light source. + * + * This method checks if a shadow material already exists for the provided light in the internal library. + * If not, it creates a new `NodeMaterial` configured for shadow rendering and stores it for future use. + * + * @return {NodeMaterial} The shadow material associated with the given light. + */ + getShadowMaterial(): NodeMaterial; + /** + * Disposes the shadow material for the shadow casting light source. + */ + disposeShadowMaterial(): void; + /** + * Returns a function to render shadow objects in a scene for the given light shadow and renderer. + * + * @param {Renderer} renderer - The renderer. + * @param {LightShadow} [shadow=this.light.shadow] - The light shadow object containing shadow properties. + * @return {Function} A function that renders shadow objects. + */ + getShadowRenderObjectFunction(renderer: Renderer, shadow?: LightShadow): Function; + /** + * Setups the shadow position node which is by default the predefined TSL node object `shadowPositionWorld`. + * + * @param {NodeBuilder} object - A configuration object that must at least hold a material reference. + */ + setupShadowPosition({ context, material }: NodeBuilder): void; +} +import { ShadowMaterial } from './three.core.js'; +/** + * Represents the default shadow implementation for lighting nodes. + * + * @augments ShadowBaseNode + */ +export class ShadowNode extends ShadowBaseNode { + /** + * Constructs a new shadow node. + * + * @param {Light} light - The shadow casting light. + * @param {?LightShadow} [shadow=null] - An optional light shadow. + */ + constructor(light: Light, shadow?: LightShadow | null); + /** + * The light shadow which defines the properties light's + * shadow. + * + * @type {?LightShadow} + * @default null + */ + shadow: LightShadow | null; + /** + * A reference to the shadow map which is a render target. + * + * @type {?RenderTarget} + * @default null + */ + shadowMap: RenderTarget | null; + /** + * Only relevant for VSM shadows. Render target for the + * first VSM render pass. + * + * @type {?RenderTarget} + * @default null + */ + vsmShadowMapVertical: RenderTarget | null; + /** + * Only relevant for VSM shadows. Render target for the + * second VSM render pass. + * + * @type {?RenderTarget} + * @default null + */ + vsmShadowMapHorizontal: RenderTarget | null; + /** + * Only relevant for VSM shadows. Node material which + * is used to render the first VSM pass. + * + * @type {?NodeMaterial} + * @default null + */ + vsmMaterialVertical: NodeMaterial | null; + /** + * Only relevant for VSM shadows. Node material which + * is used to render the second VSM pass. + * + * @type {?NodeMaterial} + * @default null + */ + vsmMaterialHorizontal: NodeMaterial | null; + /** + * A reference to the output node which defines the + * final result of this shadow node. + * + * @type {?Node} + * @private + * @default null + */ + private _node; + /** + * The current shadow map type of this shadow node. + * + * @type {?number} + * @private + * @default null + */ + private _currentShadowType; + /** + * A Weak Map holding the current frame ID per camera. Used + * to control the update of shadow maps. + * + * @type {WeakMap} + * @private + */ + private _cameraFrameId; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowNode: boolean; + /** + * This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer. + * + * @type {number} + * @readonly + * @default true + */ + readonly depthLayer: number; + /** + * Setups the shadow filtering. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @param {Object} inputs - A configuration object that defines the shadow filtering. + * @param {Function} inputs.filterFn - This function defines the filtering type of the shadow map e.g. PCF. + * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. + * @param {Node} inputs.shadowCoord - Shadow coordinates which are used to sample from the shadow map. + * @param {LightShadow} inputs.shadow - The light shadow. + * @return {Node} The result node of the shadow filtering. + */ + setupShadowFilter(builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow, depthLayer }: { + filterFn: Function; + depthTexture: DepthTexture; + shadowCoord: Node; + shadow: LightShadow; + }): Node; + /** + * Setups the shadow coordinates. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @param {Node} shadowPosition - A node representing the shadow position. + * @return {Node} The shadow coordinates. + */ + setupShadowCoord(builder: NodeBuilder, shadowPosition: Node): Node; + /** + * Returns the shadow filtering function for the given shadow type. + * + * @param {number} type - The shadow type. + * @return {Function} The filtering function. + */ + getShadowFilterFn(type: number): Function; + setupRenderTarget(shadow: any, builder: any): { + shadowMap: any; + depthTexture: DepthTexture; + }; + /** + * Setups the shadow output node. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Node} The shadow output node. + */ + setupShadow(builder: NodeBuilder): Node; + /** + * The implementation performs the setup of the output node. An output is only + * produces if shadow mapping is globally enabled in the renderer. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {ShaderCallNodeInternal} The output node. + */ + setup(builder: NodeBuilder): ShaderCallNodeInternal; + /** + * Renders the shadow. The logic of this function could be included + * into {@link ShadowNode#updateShadow} however more specialized shadow + * nodes might require a custom shadow map rendering. By having a + * dedicated method, it's easier to overwrite the default behavior. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + renderShadow(frame: NodeFrame): void; + /** + * Updates the shadow. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateShadow(frame: NodeFrame): void; + _depthVersionCached: number | undefined; + /** + * For VSM additional render passes are required. + * + * @param {Renderer} renderer - A reference to the current renderer. + */ + vsmPass(renderer: Renderer): void; + /** + * Resets the resouce state of this shadow node. + * + * @private + */ + private _reset; + /** + * The implementation performs the update of the shadow map if necessary. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateBefore(frame: NodeFrame): void; +} +/** + * Node material version of {@link ShadowMaterial}. + * + * @augments NodeMaterial + */ +export class ShadowNodeMaterial extends NodeMaterial { + /** + * Constructs a new shadow node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowNodeMaterial: boolean; + /** + * Setups the lighting model. + * + * @return {ShadowMaskModel} The lighting model. + */ + setupLightingModel(): ShadowMaskModel; +} +import { ShortType } from './three.core.js'; +import { Sphere } from './three.core.js'; +import { SphereGeometry } from './three.core.js'; +/** + * This module is part of the TSL core and usually not used in app level code. + * `SplitNode` represents a property access operation which means it is + * used to implement any `.xyzw`, `.rgba` and `stpq` usage on node objects. + * For example: + * ```js + * const redValue = color.r; + * ``` + * + * @augments Node + */ +export class SplitNode extends Node { + /** + * Constructs a new split node. + * + * @param {Node} node - The node that should be accessed. + * @param {string} [components='x'] - The components that should be accessed. + */ + constructor(node: Node, components?: string); + /** + * The node that should be accessed. + * + * @type {Node} + */ + node: Node; + /** + * The components that should be accessed. + * + * @type {string} + */ + components: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSplitNode: boolean; + /** + * Returns the vector length which is computed based on the requested components. + * + * @return {number} The vector length. + */ + getVectorLength(): number; + /** + * Returns the component type of the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The component type. + */ + getComponentType(builder: NodeBuilder): string; + /** + * This method is overwritten since the node type is inferred from requested components. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import { SpotLight } from './three.core.js'; +/** + * Module for representing spot lights as nodes. + * + * @augments AnalyticLightNode + */ +export class SpotLightNode extends AnalyticLightNode { + /** + * Constructs a new spot light node. + * + * @param {?SpotLight} [light=null] - The spot light source. + */ + constructor(light?: SpotLight | null); + /** + * Uniform node representing the cone cosine. + * + * @type {UniformNode} + */ + coneCosNode: UniformNode; + /** + * Uniform node representing the penumbra cosine. + * + * @type {UniformNode} + */ + penumbraCosNode: UniformNode; + /** + * Uniform node representing the cutoff distance. + * + * @type {UniformNode} + */ + cutoffDistanceNode: UniformNode; + /** + * Uniform node representing the decay exponent. + * + * @type {UniformNode} + */ + decayExponentNode: UniformNode; + /** + * Overwritten to updated spot light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + /** + * Computes the spot attenuation for the given angle. + * + * @param {NodeBuilder} builder - The node builder. + * @param {Node} angleCosine - The angle to compute the spot attenuation for. + * @return {Node} The spot attenuation. + */ + getSpotAttenuation(builder: NodeBuilder, angleCosine: Node): Node; + getLightCoord(builder: any): any; + setupDirect(builder: any): { + lightColor: any; + lightDirection: any; + }; +} +import { SpriteMaterial } from './three.core.js'; +/** + * Node material version of {@link SpriteMaterial}. + * + * @augments NodeMaterial + */ +export class SpriteNodeMaterial extends NodeMaterial { + /** + * Constructs a new sprite node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSpriteNodeMaterial: boolean; + _useSizeAttenuation: boolean; + /** + * The rotation of sprite materials is by default inferred from the `rotation`, + * property. This node property allows to overwrite the default and define + * the rotation with a node instead. + * + * If you don't want to overwrite the rotation but modify the existing + * value instead, use {@link materialRotation}. + * + * @type {?Node} + * @default null + */ + rotationNode: Node | null; + /** + * This node property provides an additional way to scale sprites next to + * `Object3D.scale`. The scale transformation based in `Object3D.scale` + * is multiplied with the scale value of this node in the vertex shader. + * + * @type {?Node} + * @default null + */ + scaleNode: Node | null; + /** + * Setups the position node in view space. This method implements + * the sprite specific vertex shader. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in view space. + */ + setupPositionView(builder: NodeBuilder): Node; + set sizeAttenuation(value: boolean); + /** + * Whether to use size attenuation or not. + * + * @type {boolean} + * @default true + */ + get sizeAttenuation(): boolean; +} +import { SrcAlphaFactor } from './three.core.js'; +import { SrcAlphaSaturateFactor } from './three.core.js'; +import { SrcColorFactor } from './three.core.js'; +/** + * Stack is a helper for Nodes that need to produce stack-based code instead of continuous flow. + * They are usually needed in cases like `If`, `Else`. + * + * @augments Node + */ +export class StackNode extends Node { + /** + * Constructs a new stack node. + * + * @param {?StackNode} [parent=null] - The parent stack node. + */ + constructor(parent?: StackNode | null); + /** + * List of nodes. + * + * @type {Array} + */ + nodes: Array; + /** + * The output node. + * + * @type {?Node} + * @default null + */ + outputNode: Node | null; + /** + * The parent stack node. + * + * @type {?StackNode} + * @default null + */ + parent: StackNode | null; + /** + * The current conditional node. + * + * @private + * @type {ConditionalNode} + * @default null + */ + private _currentCond; + /** + * The expression node. Only + * relevant for Switch/Case. + * + * @private + * @type {Node} + * @default null + */ + private _expressionNode; + /** + * The current node being processed. + * + * @private + * @type {Node} + * @default null + */ + private _currentNode; + /** + * Stores additional data for nodes that are added to the stack. + * + * @private + * @type {Map} + */ + private _nodeDataLibrary; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStackNode: boolean; + getElementType(builder: any): string; + generateNodeType(builder: any): string; + getMemberType(builder: any, name: any): string; + /** + * Adds a node to this stack. + * + * @param {Node} node - The node to add. + * @param {number} [index=-1] - The index of the node. If not specified, the node will be added to the end of the stack. + * @return {StackNode} A reference to this stack node. + */ + addToStack(node: Node, index?: number): StackNode; + /** + * Adds a node to the stack before the current node. + * + * @param {Node} node - The node to add. + * @return {StackNode} A reference to this stack node. + */ + addToStackBefore(node: Node): StackNode; + /** + * Represent an `if` statement in TSL. + * + * @param {Node} boolNode - Represents the condition. + * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. + * @return {StackNode} A reference to this stack node. + */ + If(boolNode: Node, method: Function): StackNode; + /** + * Represent an `elseif` statement in TSL. + * + * @param {Node} boolNode - Represents the condition. + * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. + * @return {StackNode} A reference to this stack node. + */ + ElseIf(boolNode: Node, method: Function): StackNode; + /** + * Represent an `else` statement in TSL. + * + * @param {Function} method - TSL code which is executed in the `else` case. + * @return {StackNode} A reference to this stack node. + */ + Else(method: Function): StackNode; + /** + * Represents a `switch` statement in TSL. + * + * @param {any} expression - Represents the expression. + * @return {StackNode} A reference to this stack node. + */ + Switch(expression: any): StackNode; + /** + * Represents a `case` statement in TSL. The TSL version accepts an arbitrary numbers of values. + * The last parameter must be the callback method that should be executed in the `true` case. + * + * @param {...any} params - The values of the `Case()` statement as well as the callback method. + * @return {StackNode} A reference to this stack node. + */ + Case(...params: any[]): StackNode; + /** + * Represents the default code block of a Switch/Case statement. + * + * @param {Function} method - TSL code which is executed in the `else` case. + * @return {StackNode} A reference to this stack node. + */ + Default(method: Function): StackNode; + setup(builder: any): any; + build(builder: any, ...params: any[]): string | Node | null | undefined; +} +/** + * Class representing a stack trace for debugging purposes. + */ +export class StackTrace { + /** + * Creates a StackTrace instance by capturing and filtering the current stack trace. + * + * @param {Error|string|null} stackMessage - An optional stack trace to use instead of capturing a new one. + */ + constructor(stackMessage?: Error | string | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStackTrace: boolean; + /** + * The stack trace. + * + * @type {Array<{fn: string, file: string, line: number, column: number}>} + */ + stack: Array<{ + fn: string; + file: string; + line: number; + column: number; + }>; + /** + * Returns a formatted location string of the top stack frame. + * + * @returns {string} The formatted stack trace message. + */ + getLocation(): string; + /** + * Returns the full error message including the stack trace. + * + * @param {string} message - The error message. + * @returns {string} The full error message with stack trace. + */ + getError(message: string): string; +} +/** + * This version of a node library represents the standard version + * used in {@link WebGPURenderer}. It maps lights, tone mapping + * techniques and materials to node-based implementations. + * + * @augments NodeLibrary + */ +export class StandardNodeLibrary extends NodeLibrary { +} +import { StaticDrawUsage } from './three.core.js'; +/** + * This special type of texture is intended for compute shaders. + * It can be used to compute the data of a texture with a compute shader. + * + * Note: This type of texture can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments Texture + */ +export class Storage3DTexture extends Texture { + /** + * Constructs a new storage texture. + * + * @param {number} [width=1] - The storage texture's width. + * @param {number} [height=1] - The storage texture's height. + * @param {number} [depth=1] - The storage texture's depth. + */ + constructor(width?: number, height?: number, depth?: number); + isArrayTexture: boolean; + /** + * This defines how the texture is wrapped in the depth direction and corresponds to + * *W* in UVW mapping. + * + * @type {number} + */ + wrapR: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture: boolean; + /** + * Indicates whether this texture is a 3D texture. + * + * @type {boolean} + * + */ + is3DTexture: boolean; + /** + * Copies the values of the given texture to this instance. + * + * @param {Storage3DTexture} source - The texture to copy. + * @return {Storage3DTexture} A reference to this instance. + */ + copy(source: Storage3DTexture): Storage3DTexture; + /** + * Sets the size of the storage 3d texture. + * + * @param {number} width - The new width of the storage texture. + * @param {number} height - The new height of the storage texture. + * @param {number} depth - The new depth of the storage texture. + */ + setSize(width: number, height: number, depth: number): void; +} +/** + * This class enables element access on instances of {@link StorageBufferNode}. + * In most cases, it is indirectly used when accessing elements with the + * {@link StorageBufferNode#element} method. + * + * ```js + * const position = positionStorage.element( instanceIndex ); + * ``` + * + * @augments ArrayElementNode + */ +export class StorageArrayElementNode extends ArrayElementNode { + /** + * Constructs storage buffer element node. + * + * @param {StorageBufferNode} storageBufferNode - The storage buffer node. + * @param {Node} indexNode - The index node that defines the element access. + */ + constructor(storageBufferNode: StorageBufferNode, indexNode: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageArrayElementNode: boolean; + /** + * The storage buffer node. + * + * @param {Node} value + * @type {StorageBufferNode} + */ + set storageBufferNode(value: Node); + get storageBufferNode(): Node; + getMemberType(builder: any, name: any): any; + setup(builder: any): Node | null; + generate(builder: any, output: any): any; +} +/** + * This special type of texture is intended for compute shaders. + * It can be used to compute the data of a texture with a compute shader. + * + * Note: This type of texture can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments Texture + */ +export class StorageArrayTexture extends Texture { + /** + * Constructs a new storage texture. + * + * @param {number} [width=1] - The storage texture's width. + * @param {number} [height=1] - The storage texture's height. + * @param {number} [depth=1] - The storage texture's depth. + */ + constructor(width?: number, height?: number, depth?: number); + isArrayTexture: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture: boolean; + /** + * Sets the size of the storage array texture. + * + * @param {number} width - The new width of the storage texture. + * @param {number} height - The new height of the storage texture. + * @param {number} depth - The new depth of the storage texture. + */ + setSize(width: number, height: number, depth: number): void; +} +/** + * This special type of buffer attribute is intended for compute shaders. + * In earlier three.js versions it was only possible to update attribute data + * on the CPU via JavaScript and then upload the data to the GPU. With the + * new material system and renderer it is now possible to use compute shaders + * to compute the data for an attribute more efficiently on the GPU. + * + * The idea is to create an instance of this class and provide it as an input + * to {@link StorageBufferNode}. + * + * Note: This type of buffer attribute can only be used with `WebGPURenderer`. + * + * @augments BufferAttribute + */ +export class StorageBufferAttribute extends BufferAttribute { + /** + * Constructs a new storage buffer attribute. + * + * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. + * The subsequent parameters are then obsolete. + * @param {number} itemSize - The item size. + * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. + */ + constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageBufferAttribute: boolean; +} +/** + * This node is used in context of compute shaders and allows to define a + * storage buffer for data. A typical workflow is to create instances of + * this node with the convenience functions `attributeArray()` or `instancedArray()`, + * setup up a compute shader that writes into the buffers and then convert + * the storage buffers to attribute nodes for rendering. + * + * ```js + * const positionBuffer = instancedArray( particleCount, 'vec3' ); // the storage buffer node + * + * const computeInit = Fn( () => { // the compute shader + * + * const position = positionBuffer.element( instanceIndex ); + * + * // compute position data + * + * position.x = 1; + * position.y = 1; + * position.z = 1; + * + * } )().compute( particleCount ); + * + * const particleMaterial = new THREE.SpriteNodeMaterial(); + * particleMaterial.positionNode = positionBuffer.toAttribute(); + * + * renderer.computeAsync( computeInit ); + * + * ``` + * + * @augments BufferNode + */ +export class StorageBufferNode extends BufferNode { + /** + * Constructs a new storage buffer node. + * + * @param {StorageBufferAttribute|StorageInstancedBufferAttribute|BufferAttribute} value - The buffer data. + * @param {?(string|Struct)} [bufferType=null] - The buffer type (e.g. `'vec3'`). + * @param {number} [bufferCount=0] - The buffer count. + */ + constructor(value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, bufferType?: (string | Struct) | null, bufferCount?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageBufferNode: boolean; + /** + * The buffer struct type. + * + * @type {?StructTypeNode} + * @default null + */ + structTypeNode: StructTypeNode | null; + /** + * The access type of the texture node. + * + * @type {string} + * @default 'readWrite' + */ + access: string; + /** + * Whether the node is atomic or not. + * + * @type {boolean} + * @default false + */ + isAtomic: boolean; + /** + * Whether the node represents a PBO or not. + * Only relevant for WebGL. + * + * @type {boolean} + * @default false + */ + isPBO: boolean; + /** + * A reference to the internal buffer attribute node. + * + * @private + * @type {?BufferAttributeNode} + * @default null + */ + private _attribute; + /** + * A reference to the internal varying node. + * + * @private + * @type {?VaryingNode} + * @default null + */ + private _varying; + /** + * This method is overwritten since the buffer data might be shared + * and thus the hash should be shared as well. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(builder: NodeBuilder): string; + /** + * Enables element access with the given index node. + * + * @param {IndexNode} indexNode - The index node. + * @return {StorageArrayElementNode} A node representing the element access. + */ + element(indexNode: IndexNode): StorageArrayElementNode; + /** + * Defines whether this node is a PBO or not. Only relevant for WebGL. + * + * @param {boolean} value - The value so set. + * @return {StorageBufferNode} A reference to this node. + */ + setPBO(value: boolean): StorageBufferNode; + /** + * Returns the `isPBO` value. + * + * @return {boolean} Whether the node represents a PBO or not. + */ + getPBO(): boolean; + /** + * Defines the node access. + * + * @param {string} value - The node access. + * @return {StorageBufferNode} A reference to this node. + */ + setAccess(value: string): StorageBufferNode; + /** + * Convenience method for configuring a read-only node access. + * + * @return {StorageBufferNode} A reference to this node. + */ + toReadOnly(): StorageBufferNode; + /** + * Defines whether the node is atomic or not. + * + * @param {boolean} value - The atomic flag. + * @return {StorageBufferNode} A reference to this node. + */ + setAtomic(value: boolean): StorageBufferNode; + /** + * Convenience method for making this node atomic. + * + * @return {StorageBufferNode} A reference to this node. + */ + toAtomic(): StorageBufferNode; + /** + * Returns attribute data for this storage buffer node. + * + * @return {{attribute: BufferAttributeNode, varying: VaryingNode}} The attribute data. + */ + getAttributeData(): { + attribute: BufferAttributeNode; + varying: VaryingNode; + }; + /** + * This method is overwritten since the node type from the availability of storage buffers + * and the attribute data. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the type of a member of the struct. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member. + * @return {string} The type of the member. + */ + getMemberType(builder: NodeBuilder, name: string): string; + /** + * Generates the code snippet of the storage buffer node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder): string; +} +/** + * This special type of instanced buffer attribute is intended for compute shaders. + * In earlier three.js versions it was only possible to update attribute data + * on the CPU via JavaScript and then upload the data to the GPU. With the + * new material system and renderer it is now possible to use compute shaders + * to compute the data for an attribute more efficiently on the GPU. + * + * The idea is to create an instance of this class and provide it as an input + * to {@link StorageBufferNode}. + * + * Note: This type of buffer attribute can only be used with `WebGPURenderer`. + * + * @augments InstancedBufferAttribute + */ +export class StorageInstancedBufferAttribute extends InstancedBufferAttribute { + /** + * Constructs a new storage instanced buffer attribute. + * + * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. + * The subsequent parameters are then obsolete. + * @param {number} itemSize - The item size. + * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. + */ + constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageInstancedBufferAttribute: boolean; +} +/** + * This special type of texture is intended for compute shaders. + * It can be used to compute the data of a texture with a compute shader. + * + * Note: This type of texture can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments Texture + */ +export class StorageTexture extends Texture { + /** + * Constructs a new storage texture. + * + * @param {number} [width=1] - The storage texture's width. + * @param {number} [height=1] - The storage texture's height. + */ + constructor(width?: number, height?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture: boolean; + /** + * When `true`, mipmaps will be auto-generated after compute writes. + * When `false`, mipmaps must be written manually via compute shaders. + * + * @type {boolean} + * @default true + */ + mipmapsAutoUpdate: boolean; + /** + * Sets the size of the storage texture. + * + * @param {number} width - The new width of the storage texture. + * @param {number} height - The new height of the storage texture. + */ + setSize(width: number, height: number): void; +} +/** + * This special version of a texture node can be used to + * write data into a 3D storage texture with a compute shader. + * + * @augments StorageTextureNode + */ +export class StorageTexture3DNode extends StorageTextureNode { + /** + * Constructs a new 3D storage texture node. + * + * @param {Storage3DTexture} value - The 3D storage texture. + * @param {Node} uvNode - The uv node. + * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. + */ + constructor(value: Storage3DTexture, uvNode: Node, storeNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture3DNode: boolean; + /** + * Overwritten with an empty implementation since the `updateMatrix` flag is ignored + * for 3D textures. The uv transformation matrix is not applied to 3D textures. + * + * @param {boolean} value - The update toggle. + */ + setUpdateMatrix(): void; +} +/** + * This special version of a texture node can be used to + * write data into a storage texture with a compute shader. + * + * ```js + * const storageTexture = new THREE.StorageTexture( width, height ); + * + * const computeTexture = Fn( ( { storageTexture } ) => { + * + * const posX = instanceIndex.mod( width ); + * const posY = instanceIndex.div( width ); + * const indexUV = uvec2( posX, posY ); + * + * // generate RGB values + * + * const r = 1; + * const g = 1; + * const b = 1; + * + * textureStore( storageTexture, indexUV, vec4( r, g, b, 1 ) ).toWriteOnly(); + * + * } ); + * + * const computeNode = computeTexture( { storageTexture } ).compute( width * height ); + * renderer.computeAsync( computeNode ); + * ``` + * + * This node can only be used with a WebGPU backend. + * + * @augments TextureNode + */ +export class StorageTextureNode extends TextureNode { + /** + * Constructs a new storage texture node. + * + * @param {StorageTexture} value - The storage texture. + * @param {Node} uvNode - The uv node. + * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. + */ + constructor(value: StorageTexture, uvNode: Node, storeNode?: Node | null); + /** + * The value node that should be stored in the texture. + * + * @type {?Node} + * @default null + */ + storeNode: Node | null; + /** + * The mip level to write to for storage textures. + * + * @type {number} + * @default 0 + */ + mipLevel: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTextureNode: boolean; + /** + * The access type of the texture node. + * + * @type {string} + * @default 'writeOnly' + */ + access: string; + setup(builder: any): any; + /** + * Defines the node access. + * + * @param {string} value - The node access. + * @return {StorageTextureNode} A reference to this node. + */ + setAccess(value: string): StorageTextureNode; + /** + * Sets the mip level to write to. + * + * @param {number} level - The mip level. + * @return {StorageTextureNode} A reference to this node. + */ + setMipLevel(level: number): StorageTextureNode; + /** + * Generates the snippet for the storage texture. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} textureProperty - The texture property. + * @param {string} uvSnippet - The uv snippet. + * @param {?string} levelSnippet - The level snippet. + * @param {?string} biasSnippet - The bias snippet. + * @param {?string} depthSnippet - The depth snippet. + * @param {?string} compareSnippet - The compare snippet. + * @param {?Array} gradSnippet - The grad snippet. + * @param {?string} offsetSnippet - The offset snippet. + * @return {string} The generated code snippet. + */ + generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, offsetSnippet: string | null): string; + /** + * Convenience method for configuring a read/write node access. + * + * @return {StorageTextureNode} A reference to this node. + */ + toReadWrite(): StorageTextureNode; + /** + * Convenience method for configuring a read-only node access. + * + * @return {StorageTextureNode} A reference to this node. + */ + toReadOnly(): StorageTextureNode; + /** + * Convenience method for configuring a write-only node access. + * + * @return {StorageTextureNode} A reference to this node. + */ + toWriteOnly(): StorageTextureNode; + /** + * Stores a value in this storage texture at the given coordinates. + * + * @param {Node} uvNode - The storage texture coordinates. + * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. + * @return {StorageTextureNode} A storage texture node representing the store operation. + */ + store(uvNode: Node, storeNode?: Node | null): StorageTextureNode; + /** + * Generates the code snippet of the storage texture node. + * + * @param {NodeBuilder} builder - The current node builder. + */ + generateStore(builder: NodeBuilder): void; +} +/** + * StructNode allows to create custom structures with multiple members. + * This can also be used to define structures in attribute and uniform data. + * + * ```js + * // Define a custom struct + * const BoundingBox = struct( { min: 'vec3', max: 'vec3' } ); + * + * // Create a new instance of the struct + * const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1 + * const bb = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2 + * + * // Access the struct members + * const min = bb.get( 'min' ); + * + * // Assign a new value to a member + * min.assign( vec3() ); + * ``` + * @augments Node + */ +export class StructNode extends Node { + constructor(structTypeNode: any, values: any); + structTypeNode: any; + values: any; + isStructNode: boolean; + generateNodeType(builder: any): any; + getMemberType(builder: any, name: any): any; + _getChildren(): Object[]; + generate(builder: any): any; +} +/** + * Represents a struct type node in the node-based system. + * This class is used to define and manage the layout and types of struct members. + * It extends the base Node class and provides methods to get the length of the struct, + * retrieve member types, and generate the struct type for a builder. + * + * @augments Node + */ +export class StructTypeNode extends Node { + /** + * Creates an instance of StructTypeNode. + * + * @param {Object} membersLayout - The layout of the members for the struct. + * @param {?string} [name=null] - The optional name of the struct. + */ + constructor(membersLayout: Object, name?: string | null); + /** + * The layout of the members for the struct + * + * @type {Array.<{name: string, type: string, atomic: boolean}>} + */ + membersLayout: Array<{ + name: string; + type: string; + atomic: boolean; + }>; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStructTypeNode: boolean; + /** + * Returns the length of the struct in 4-byte elements (e.g. float or int components). + * The length is calculated by summing the lengths of the struct's members, accounting for memory alignment. + * To get the size in bytes, multiply the returned value by 4. + * + * @returns {number} The length of the struct in 4-byte elements. + */ + getLength(): number; + getMemberType(builder: any, name: any): string; + generateNodeType(builder: any): any; + setup(builder: any): void; + generate(builder: any): string; +} +/** + * This node is used to build a sub-build in the node system. + * + * @augments Node + * @param {Node} node - The node to be built in the sub-build. + * @param {string} name - The name of the sub-build. + * @param {?string} [nodeType=null] - The type of the node, if known. + */ +export class SubBuildNode extends Node { + constructor(node: any, name: any, nodeType?: null); + /** + * The node to be built in the sub-build. + * + * @type {Node} + */ + node: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSubBuildNode: boolean; + generateNodeType(builder: any): string; + build(builder: any, ...params: any[]): string | Node | null; +} +/** + * This class represents a set of built in WGSL shader functions that sync + * synchronously execute an operation across a subgroup, or 'warp', of compute + * or fragment shader invocations within a workgroup. Typically, these functions + * will synchronously execute an operation using data from all active invocations + * within the subgroup, then broadcast that result to all active invocations. In + * other graphics APIs, subgroup functions are also referred to as wave intrinsics + * (DirectX/HLSL) or warp intrinsics (CUDA). + * + * @augments TempNode + */ +export class SubgroupFunctionNode extends TempNode { + /** + * Constructs a new function node. + * + * @param {string} method - The subgroup/wave intrinsic method to construct. + * @param {Node} [aNode=null] - The method's first argument. + * @param {Node} [bNode=null] - The method's second argument. + */ + constructor(method: string, aNode?: Node, bNode?: Node); + /** + * The subgroup/wave intrinsic method to construct. + * + * @type {string} + */ + method: string; + /** + * The method's first argument. + * + * @type {Node} + */ + aNode: Node; + /** + * The method's second argument. + * + * @type {Node} + */ + bNode: Node; + getInputType(builder: any): string | null; + generateNodeType(builder: any): string | null; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +export namespace SubgroupFunctionNode { + let SUBGROUP_ELECT: string; + let SUBGROUP_BALLOT: string; + let SUBGROUP_ADD: string; + let SUBGROUP_INCLUSIVE_ADD: string; + let SUBGROUP_EXCLUSIVE_AND: string; + let SUBGROUP_MUL: string; + let SUBGROUP_INCLUSIVE_MUL: string; + let SUBGROUP_EXCLUSIVE_MUL: string; + let SUBGROUP_AND: string; + let SUBGROUP_OR: string; + let SUBGROUP_XOR: string; + let SUBGROUP_MIN: string; + let SUBGROUP_MAX: string; + let SUBGROUP_ALL: string; + let SUBGROUP_ANY: string; + let SUBGROUP_BROADCAST_FIRST: string; + let QUAD_SWAP_X: string; + let QUAD_SWAP_Y: string; + let QUAD_SWAP_DIAGONAL: string; + let SUBGROUP_BROADCAST: string; + let SUBGROUP_SHUFFLE: string; + let SUBGROUP_SHUFFLE_XOR: string; + let SUBGROUP_SHUFFLE_UP: string; + let SUBGROUP_SHUFFLE_DOWN: string; + let QUAD_BROADCAST: string; +} +import { SubtractEquation } from './three.core.js'; +import { SubtractiveBlending } from './three.core.js'; +export var TSL: Readonly<{ + __proto__: null; + BRDF_GGX: () => void; + BRDF_Lambert: () => void; + BasicPointShadowFilter: () => void; + BasicShadowFilter: () => void; + Break: () => ExpressionNode; + Const: (node: Node, name?: string | null) => VarNode; + Continue: () => ExpressionNode; + DFGLUT: () => void; + D_GGX: any; + Discard: (conditional: ConditionalNode | null) => Node; + EPSILON: any; + F_Schlick: () => void; + Fn: typeof Fn; + HALF_PI: any; + INFINITY: any; + If: (...params: any[]) => StackNode; + Loop: (...params: any[]) => LoopNode; + NodeAccess: { + READ_ONLY: string; + WRITE_ONLY: string; + READ_WRITE: string; + }; + NodeShaderStage: { + VERTEX: string; + FRAGMENT: string; + }; + NodeType: { + BOOLEAN: string; + INTEGER: string; + FLOAT: string; + VECTOR2: string; + VECTOR3: string; + VECTOR4: string; + MATRIX2: string; + MATRIX3: string; + MATRIX4: string; + }; + NodeUpdateType: { + NONE: string; + FRAME: string; + RENDER: string; + OBJECT: string; + }; + OnAfterObjectUpdate: (callback: Function) => EventNode; + OnAfterRenderPipeline: (callback: Function) => EventNode; + OnBeforeFrameUpdate: (callback: Function) => EventNode; + OnBeforeMaterialUpdate: (callback: Function) => EventNode; + OnBeforeObjectUpdate: (callback: Function) => EventNode; + OnBeforeRenderPipeline: (callback: Function) => EventNode; + OnFrameUpdate: (callback: Function) => EventNode; + OnMaterialUpdate: (callback: Function) => EventNode; + OnObjectUpdate: (callback: Function) => EventNode; + PCFShadowFilter: () => void; + PI: any; + PI2: any; + PointShadowFilter: () => void; + Return: () => ExpressionNode; + Schlick_to_F0: any; + ShaderNode: typeof ShaderNode; + Stack: typeof Stack; + Switch: (...params: any[]) => StackNode; + TBNViewMatrix: any; + TWO_PI: any; + VSMShadowFilter: () => void; + V_GGX_SmithCorrelated: any; + Var: (node: Node, name?: string | null) => VarNode; + VarIntent: (node: Node) => VarNode; + abs: any; + acesFilmicToneMapping: any; + acos: any; + acosh: any; + add: any; + addMethodChaining: typeof addMethodChaining; + addNodeElement: typeof addNodeElement; + agxToneMapping: any; + all: any; + alphaT: any; + ambientOcclusion: any; + and: any; + anisotropy: any; + anisotropyB: any; + anisotropyT: any; + any: any; + array: (...params: any[]) => ArrayNode; + asin: any; + asinh: any; + assign: any; + atan: any; + atanh: any; + atomicAdd: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicAnd: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicFunc: (method: string, pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicLoad: (pointerNode: Node) => AtomicFunctionNode; + atomicMax: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicMin: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicOr: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicStore: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicSub: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + atomicXor: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; + attenuationColor: any; + attenuationDistance: any; + attribute: (name: string, nodeType?: string | null) => AttributeNode; + attributeArray: (count: number | TypedArray, type?: string | Struct) => StorageBufferNode; + backgroundBlurriness: any; + backgroundIntensity: any; + backgroundRotation: any; + batch: () => void; + batchColor: any; + batchIndirectIndex: any; + bentNormalView: any; + billboarding: () => void; + bitAnd: any; + bitNot: any; + bitOr: any; + bitXor: any; + bitangentGeometry: any; + bitangentLocal: any; + bitangentView: any; + bitangentWorld: any; + bitcast: any; + blendBurn: any; + blendColor: any; + blendDodge: any; + blendOverlay: any; + blendScreen: any; + bool: any; + buffer: (value: Array, type: string, count: number) => BufferNode; + bufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; + builtin: any; + builtinAOContext: typeof builtinAOContext; + builtinShadowContext: typeof builtinShadowContext; + bumpMap: any; + bvec2: any; + bvec3: any; + bvec4: any; + bypass: any; + cache: typeof cache; + call: (func: any, ...params: any[]) => FunctionCallNode; + cameraFar: any; + cameraIndex: any; + cameraNear: any; + cameraNormalMatrix: any; + cameraPosition: any; + cameraProjectionMatrix: any; + cameraProjectionMatrixInverse: any; + cameraViewMatrix: any; + cameraViewport: any; + cameraWorldMatrix: any; + cbrt: (a: Node | number) => Node; + cdl: () => void; + ceil: any; + checker: () => void; + cineonToneMapping: any; + clamp: (value: Node | number, low?: Node | number, high?: Node | number) => Node; + clearcoat: any; + clearcoatNormalView: any; + clearcoatRoughness: any; + clipSpace: any; + code: any; + color: any; + colorSpaceToWorking: (node: Node, sourceColorSpace: string) => ColorSpaceNode; + colorToDirection: (node: Node) => Node; + compute: (node: Node, count: number | Array, workgroupSize?: Array) => ComputeNode; + computeKernel: (node: Node, workgroupSize?: Array) => ComputeNode; + computeSkinning: () => void; + context: (nodeOrValue?: Node | Object, value?: Object) => ContextNode; + convert: (node: any, types: any) => ConvertNode; + convertColorSpace: (node: Node, sourceColorSpace: string, targetColorSpace: string) => ColorSpaceNode; + convertToTexture: (node: Node, ...params: any[]) => RTTNode; + cos: any; + cosh: any; + countLeadingZeros: any; + countOneBits: any; + countTrailingZeros: any; + cross: any; + cubeTexture: (value?: (CubeTexture | CubeTextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null) => CubeTextureNode; + cubeTextureBase: any; + dFdx: any; + dFdy: any; + dashSize: any; + debug: (node: Node, callback?: Function | null) => DebugNode; + decrement: () => void; + decrementBefore: () => void; + defaultBuildStages: string[]; + defaultShaderStages: string[]; + defined: typeof defined; + degrees: any; + deltaTime: any; + densityFogFactor: () => void; + depth: ViewportDepthNode; + depthPass: (scene: Scene, camera: Camera, options: Object) => PassNode; + determinant: any; + difference: any; + diffuseColor: any; + diffuseContribution: any; + directPointLight: ({ color, lightVector, cutoffDistance, decayExponent }: { + color: any; + lightVector: any; + cutoffDistance: any; + decayExponent: any; + }) => { + lightDirection: any; + lightColor: any; + }; + directionToColor: (node: Node) => Node; + directionToFaceDirection: (vector: Node) => Node; + dispersion: any; + distance: any; + div: any; + dot: any; + drawIndex: IndexNode; + dynamicBufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; + element: any; + emissive: any; + equal: any; + equirectDirection: () => void; + equirectUV: () => void; + exp: any; + exp2: any; + exponentialHeightFogFactor: () => void; + expression: any; + faceDirection: any; + faceForward: any; + faceforward: any; + float: any; + floatBitsToInt: (value: Node) => BitcastNode; + floatBitsToUint: (value: Node) => BitcastNode; + floor: any; + fog: () => void; + fract: any; + frameGroup: UniformGroupNode; + frameId: any; + frontFacing: any; + fwidth: any; + gain: (x: Node, k: Node) => Node; + gapSize: any; + getConstNodeType: (value: any) => any; + getCurrentStack: () => any; + getDistanceAttenuation: () => void; + getGeometryRoughness: () => void; + getNormalFromDepth: () => void; + getParallaxCorrectNormal: () => void; + getRoughness: () => void; + getScreenPosition: () => void; + getScreenPositionFromClip: any; + getShIrradianceAt: () => void; + getTextureIndex: typeof getTextureIndex; + getViewPosition: () => void; + globalId: any; + glsl: (src: string, includes: Array) => CodeNode; + glslFn: (code: any, includes: any) => any; + grayscale: () => void; + greaterThan: any; + greaterThanEqual: any; + hash: () => void; + highpModelNormalViewMatrix: any; + highpModelViewMatrix: any; + hue: () => void; + increment: () => void; + incrementBefore: () => void; + inspector: typeof inspector; + instance: () => void; + instanceColor: any; + instanceIndex: IndexNode; + instancedArray: (count: number | TypedArray, type?: string | Struct) => StorageBufferNode; + instancedBufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; + instancedDynamicBufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; + instancedMesh: () => void; + int: any; + intBitsToFloat: (value: Node) => BitcastNode; + interleavedGradientNoise: any; + inverse: any; + inverseSqrt: any; + inversesqrt: any; + invocationLocalIndex: IndexNode; + invocationSubgroupIndex: IndexNode; + ior: any; + iridescence: any; + iridescenceIOR: any; + iridescenceThickness: any; + isolate: (node: Node) => IsolateNode; + ivec2: any; + ivec3: any; + ivec4: any; + js: (src: string, includes: Array) => CodeNode; + label: typeof label; + length: any; + lengthSq: (a: Node) => Node; + lessThan: any; + lessThanEqual: any; + lightPosition: typeof lightPosition; + lightProjectionUV: typeof lightProjectionUV; + lightShadowMatrix: typeof lightShadowMatrix; + lightTargetDirection: (light: Light) => Node; + lightTargetPosition: typeof lightTargetPosition; + lightViewPosition: typeof lightViewPosition; + lightingContext: any; + lights: (lights?: Array) => LightsNode; + linearDepth: any; + linearToneMapping: any; + localId: any; + log: any; + log2: any; + logarithmicDepthToViewZ: (depth: Node, near: Node, far: Node) => Node; + luminance: (color: Node, luminanceCoefficients?: Node | null) => Node; + mat2: any; + mat3: any; + mat4: any; + matcapUV: any; + materialAO: any; + materialAlphaTest: any; + materialAnisotropy: any; + materialAnisotropyVector: any; + materialAttenuationColor: any; + materialAttenuationDistance: any; + materialClearcoat: any; + materialClearcoatNormal: any; + materialClearcoatRoughness: any; + materialColor: any; + materialDispersion: any; + materialEmissive: any; + materialEnvIntensity: any; + materialEnvRotation: any; + materialIOR: any; + materialIridescence: any; + materialIridescenceIOR: any; + materialIridescenceThickness: any; + materialLightMap: any; + materialLineDashOffset: any; + materialLineDashSize: any; + materialLineGapSize: any; + materialLineScale: any; + materialLineWidth: any; + materialMetalness: any; + materialNormal: any; + materialOpacity: any; + materialPointSize: any; + materialReference: (name: string, type: string, material?: Material | null) => MaterialReferenceNode; + materialReflectivity: any; + materialRefractionRatio: any; + materialRetroreflectivity: any; + materialRotation: any; + materialRoughness: any; + materialSheen: any; + materialSheenRoughness: any; + materialShininess: any; + materialSpecular: any; + materialSpecularColor: any; + materialSpecularIntensity: any; + materialSpecularStrength: any; + materialThickness: any; + materialTransmission: any; + max: any; + maxMipLevel: any; + mediumpModelViewMatrix: any; + metalness: any; + min: any; + mix: any; + mixElement: (t: Node | number, e1: Node | number, e2: Node | number) => Node; + mod: any; + modelDirection: any; + modelNormalMatrix: any; + modelPosition: any; + modelRadius: any; + modelScale: any; + modelViewMatrix: any; + modelViewPosition: any; + modelViewProjection: any; + modelWorldMatrix: any; + modelWorldMatrixInverse: any; + morphReference: () => void; + mrt: any; + mul: any; + mx_aastep: (threshold: any, value: any) => any; + mx_add: (in1: any, in2?: any) => any; + mx_atan2: (in1?: any, in2?: any) => any; + mx_cell_noise_float: (texcoord?: any) => any; + mx_cell_noise_vec3: (texcoord?: any) => any; + mx_contrast: (input: any, amount?: number, pivot?: number) => any; + mx_divide: (in1: any, in2?: any) => any; + mx_fractal_noise_float: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; + mx_fractal_noise_float_2d: (texcoord?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; + mx_fractal_noise_vec2: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; + mx_fractal_noise_vec3: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; + mx_fractal_noise_vec4: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; + mx_frame: () => any; + mx_heighttonormal: (input: any, scale?: number, texcoord?: any) => any; + mx_hsvtorgb: any; + mx_ifequal: (value1: any, value2: any, in1: any, in2: any) => any; + mx_ifgreater: (value1: any, value2: any, in1: any, in2: any) => any; + mx_ifgreatereq: (value1: any, value2: any, in1: any, in2: any) => any; + mx_invert: (in1: any, amount?: any) => any; + mx_modulo: (in1: any, in2?: any) => any; + mx_multiply: (in1: any, in2?: any) => any; + mx_noise_float: (texcoord?: any, amplitude?: number, pivot?: number) => any; + mx_noise_vec3: (texcoord?: any, amplitude?: number, pivot?: number) => any; + mx_noise_vec4: (texcoord?: any, amplitude?: number, pivot?: number) => any; + mx_place2d: (texcoord: any, pivot?: any, scale?: any, rotate?: any, offset?: any, operationorder?: any) => any; + mx_power: (in1: any, in2?: any) => any; + mx_ramp4: (valuetl: any, valuetr: any, valuebl: any, valuebr: any, texcoord?: any) => any; + mx_ramplr: (valuel: any, valuer: any, texcoord?: any) => any; + mx_ramptb: (valueb: any, valuet: any, texcoord?: any) => any; + mx_rgbtohsv: any; + mx_rotate2d: (input: any, amount?: number) => any; + mx_rotate3d: (input: any, amount?: number, axis?: any) => any; + mx_safepower: (in1: any, in2?: number) => any; + mx_separate: (in1: any, channelOrOut?: null) => any; + mx_smoothstep: (inNode: any, low?: number, high?: number) => any; + mx_splitlr: (valuel: any, valuer: any, center: any, texcoord?: any) => any; + mx_splittb: (valueb: any, valuet: any, center: any, texcoord?: any) => any; + mx_srgb_texture_to_lin_rec709: any; + mx_subtract: (in1: any, in2?: any) => any; + mx_timer: () => any; + mx_transform_uv: (uv_scale?: number, uv_offset?: number, uv_geo?: any) => any; + mx_unifiednoise2d: (noiseType: any, texcoord?: any, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number) => void; + mx_unifiednoise3d: (noiseType: any, texcoord?: any, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number) => void; + mx_worley_noise_float: (texcoord?: any, jitter?: number, style?: number) => void; + mx_worley_noise_float_2d: (texcoord?: any, jitter?: number, style?: number) => void; + mx_worley_noise_float_3d: (texcoord?: any, jitter?: number, style?: number) => void; + mx_worley_noise_vec2: (texcoord?: any, jitter?: number) => any; + mx_worley_noise_vec3: (texcoord?: any, jitter?: number, metric?: number) => any; + mx_worley_noise_vec3_style: (texcoord?: any, jitter?: number, style?: number, metric?: number) => any; + negate: any; + negateOnBackSide: () => void; + neutralToneMapping: any; + nodeArray: (val: any, altType?: null) => any; + nodeImmutable: (NodeClass: any, ...params: any[]) => any; + nodeObject: (val: any, altType?: null) => any; + nodeObjectIntent: (val: any, altType?: null) => any; + nodeObjects: (val: any, altType?: null) => any; + nodeProxy: (NodeClass: any, scope?: null, factor?: null, settings?: null) => any; + nodeProxyConstructor: (constructorFunction: any, nodeInstance: any) => any; + nodeProxyIntent: (NodeClass: any, scope?: null, factor?: null, settings?: {}) => any; + normalFlat: any; + normalGeometry: any; + normalLocal: any; + normalMap: any; + normalView: any; + normalViewGeometry: any; + normalWorld: any; + normalWorldGeometry: any; + normalize: any; + not: any; + notEqual: any; + numWorkgroups: any; + objectDirection: any; + objectGroup: UniformGroupNode; + objectPosition: any; + objectRadius: any; + objectScale: any; + objectViewPosition: any; + objectWorldMatrix: any; + oneMinus: any; + or: any; + orthographicDepthToViewZ: () => void; + oscSawtooth: (t?: Node) => Node; + oscSine: (t?: Node) => Node; + oscSquare: (t?: Node) => Node; + oscTriangle: (t?: Node) => Node; + output: any; + outputStruct: any; + overloadingFn: (functionNodes: Array) => FunctionOverloadingNode; + overrideNode: typeof overrideNode; + overrideNodes: typeof overrideNodes; + packHalf2x16: any; + packNormalToRGB: (node: Node) => Node; + packSnorm2x16: any; + packSnorm4x8: any; + packUnorm2x16: any; + packUnorm4x8: any; + parabola: (x: Node, k: Node) => Node; + parallaxDirection: any; + parallaxUV: (uv: Node, scale: Node) => Node; + parameter: (type: string, name: string | null) => ParameterNode; + pass: (scene: Scene, camera: Camera, options: Object) => PassNode; + passTexture: (pass: PassNode, texture: Texture) => PassTextureNode; + pcurve: (x: Node, a: Node, b: Node) => Node; + perspectiveDepthToViewZ: () => void; + pmremTexture: any; + pointShadow: (light: PointLight, shadow?: PointLightShadow | null) => PointShadowNode; + pointUV: PointUVNode; + pointWidth: any; + positionGeometry: any; + positionLocal: any; + positionPrevious: any; + positionView: any; + positionViewDirection: any; + positionWorld: any; + positionWorldDirection: any; + posterize: () => void; + pow: any; + pow2: (x: Node | number) => Node; + pow3: (x: Node | number) => Node; + pow4: (x: Node | number) => Node; + premultiplyAlpha: () => void; + property: (type: string, name?: string | null, placeholderNode?: Node | null) => PropertyNode; + quadBroadcast: any; + quadSwapDiagonal: any; + quadSwapX: any; + quadSwapY: any; + radians: any; + rand: () => void; + range: any; + rangeFogFactor: () => void; + reciprocal: any; + reference: (name: string, type: string, object?: Object | null) => ReferenceNode; + referenceBuffer: (name: string, type: string, count: number, object: Object) => ReferenceNode; + reflect: any; + reflectVector: any; + reflectView: any; + reflector: (parameters?: { + target?: Object3D | undefined; + resolution?: number | undefined; + generateMipmaps?: boolean | undefined; + bounces?: boolean | undefined; + depth?: boolean | undefined; + samples?: number | undefined; + defaultTexture?: TextureNode | undefined; + reflector?: ReflectorBaseNode | undefined; + }) => ReflectorNode; + refract: any; + refractVector: any; + refractView: any; + reinhardToneMapping: any; + remap: () => void; + remapClamp: typeof remapClamp; + renderGroup: UniformGroupNode; + renderOutput: (color: Node, toneMapping?: number | null, outputColorSpace?: string | null) => RenderOutputNode; + rendererReference: (name: string, type: string, renderer?: Renderer | null) => RendererReferenceNode; + replaceDefaultUV: typeof replaceDefaultUV; + retroreflectivity: any; + rotate: any; + rotateUV: () => void; + roughness: any; + round: any; + rtt: (node: Node, ...params: any[]) => RTTNode; + sRGBTransferEOTF: any; + sRGBTransferOETF: any; + sample: (callback: Function, uv?: Node | null) => SampleNode; + sampler: (value: TextureNode | Texture) => Node; + samplerComparison: (value: TextureNode | Texture) => Node; + saturate: (value: Node | number) => Node; + saturation: () => void; + screenCoordinate: any; + screenDPR: any; + screenSize: any; + screenUV: any; + select: any; + setCurrentStack: (stack: any) => void; + setName: (node: Node, name: string) => ContextNode; + shaderStages: string[]; + shadow: (light: Light, shadow?: LightShadow | null) => ShadowNode; + shadowPositionWorld: any; + shapeCircle: () => void; + sharedUniformGroup: (name: string, order?: number, updateType?: null) => UniformGroupNode; + sheen: any; + sheenRoughness: any; + shiftLeft: any; + shiftRight: any; + shininess: any; + sign: any; + sin: any; + sinc: (x: Node, k: Node) => Node; + sinh: any; + skinning: () => void; + smoothstep: any; + smoothstepElement: (x: Node | number, low: Node | number, high: Node | number) => Node; + specularColor: any; + specularColorBlended: any; + specularF90: any; + spherizeUV: () => void; + split: (node: any, channels: any) => SplitNode; + spritesheetUV: () => void; + sqrt: any; + stack: any; + step: any; + stepElement: (x: Node | number, edge: Node | number) => Node; + storage: (value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, type?: (string | Struct) | null, count?: number) => StorageBufferNode; + storageBarrier: () => BarrierNode; + storageTexture: any; + storageTexture3D: any; + struct: (membersLayout: Object, name?: string | null) => Function; + sub: any; + subBuild: (node: Node, name: string, type?: string | null) => Node; + subgroupAdd: any; + subgroupAll: any; + subgroupAnd: any; + subgroupAny: any; + subgroupBallot: any; + subgroupBroadcast: any; + subgroupBroadcastFirst: any; + subgroupElect: any; + subgroupExclusiveAdd: any; + subgroupExclusiveMul: any; + subgroupInclusiveAdd: any; + subgroupInclusiveMul: any; + subgroupIndex: IndexNode; + subgroupMax: any; + subgroupMin: any; + subgroupMul: any; + subgroupOr: any; + subgroupShuffle: any; + subgroupShuffleDown: any; + subgroupShuffleUp: any; + subgroupShuffleXor: any; + subgroupSize: any; + subgroupXor: any; + tan: any; + tangentGeometry: any; + tangentLocal: any; + tangentView: any; + tangentWorld: any; + tanh: any; + texture: (value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null) => TextureNode; + texture3D: any; + texture3DLevel: (value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null) => TextureNode; + texture3DLoad: (...params: any[]) => TextureNode; + textureBarrier: () => BarrierNode; + textureBicubic: () => void; + textureBicubicLevel: () => void; + textureLevel: (value: any, uv: any, level: any) => TextureNode; + textureLoad: (...params: any[]) => TextureNode; + textureSize: any; + textureStore: (value: StorageTexture | StorageTextureNode, uvNode: Node, storeNode?: Node | null) => StorageTextureNode; + thickness: any; + time: any; + toneMapping: (mapping: number, exposure: Node | number, color: Node | Color) => ToneMappingNode; + toneMappingExposure: any; + toonOutlinePass: (scene: Scene, camera: Camera, color?: Color, thickness?: number, alpha?: number) => ToonOutlinePassNode; + transformDirection: any; + transformNormal: () => void; + transformNormalByInverseViewMatrix: (normal: Node, viewMatrix: Node) => Node; + transformNormalByViewMatrix: (normal: Node, viewMatrix: Node) => Node; + transformNormalToView: () => void; + transformedClearcoatNormalView: any; + transformedNormalView: any; + transformedNormalWorld: any; + transmission: any; + transpose: any; + triNoise3D: any; + triplanarTexture: (...params: any[]) => Node; + triplanarTextures: () => void; + trunc: any; + uint: any; + uintBitsToFloat: (value: Node) => BitcastNode; + uniform: (value: any | string, type?: string) => UniformNode; + uniformArray: (values: Array, nodeType?: string | null) => UniformArrayNode; + uniformCubeTexture: (value?: CubeTexture | null) => CubeTextureNode; + uniformFlow: (node: Node) => ContextNode; + uniformGroup: (name: string, order?: number, updateType?: null) => UniformGroupNode; + uniformTexture: (value?: Texture | null) => TextureNode; + unpackHalf2x16: any; + unpackNormal: (xy: Node) => Node; + unpackRGBToNormal: (node: Node) => Node; + unpackSnorm2x16: any; + unpackSnorm4x8: any; + unpackUnorm2x16: any; + unpackUnorm4x8: any; + unpremultiplyAlpha: () => void; + userData: (name: string, inputType: string, userData: Object | null) => UserDataNode; + uv: (index?: number) => AttributeNode; + uvec2: any; + uvec3: any; + uvec4: any; + varying: any; + varyingProperty: (type: string, name?: string | null, placeholderNode?: Node | null) => PropertyNode; + vec2: any; + vec3: any; + vec4: any; + vectorComponents: string[]; + velocity: VelocityNode; + vertexColor: (index?: number) => VertexColorNode; + vertexIndex: IndexNode; + vertexStage: (node: Node) => VaryingNode; + vibrance: () => void; + viewZToLogarithmicDepth: (viewZ: Node, near: Node, far: Node) => Node; + viewZToOrthographicDepth: (viewZ: Node, near: Node, far: Node) => Node; + viewZToPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => Node; + viewZToReversedOrthographicDepth: (viewZ: Node, near: Node, far: Node) => Node; + viewZToReversedPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => Node; + viewport: any; + viewportCoordinate: any; + viewportDepthTexture: any; + viewportLinearDepth: ViewportDepthNode; + viewportMipTexture: any; + viewportOpaqueMipTexture: (uv?: Node | null, level?: Node | null) => ViewportTextureNode; + viewportSafeUV: () => void; + viewportSharedTexture: any; + viewportSize: any; + viewportTexture: any; + viewportUV: any; + vogelDiskSample: any; + wgsl: (src: string, includes: Array) => CodeNode; + wgslFn: (code: any, includes: any) => any; + workgroupArray: (type: string, count?: number) => WorkgroupInfoNode; + workgroupBarrier: () => BarrierNode; + workgroupId: any; + workingToColorSpace: (node: Node, targetColorSpace: string) => ColorSpaceNode; + xor: any; +}>; +import { TangentSpaceNormalMap } from './three.core.js'; +/** + * This module uses cache management to create temporary variables + * if the node is used more than once to prevent duplicate calculations. + * + * The class acts as a base class for many other nodes types. + * + * @augments Node + */ +export class TempNode extends Node { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTempNode: boolean; + /** + * Whether this node is used more than once in context of other nodes. + * + * @param {NodeBuilder} builder - The node builder. + * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. + */ + hasDependencies(builder: NodeBuilder): boolean; + build(builder: any, output: any): any; +} +import { Texture } from './three.core.js'; +/** + * This type of uniform node represents a 3D texture. + * + * @augments TextureNode + */ +export class Texture3DNode extends TextureNode { + /** + * Constructs a new 3D texture node. + * + * @param {Data3DTexture} value - The 3D texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + */ + constructor(value: Data3DTexture, uvNode?: Node | null, levelNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTexture3DNode: boolean; + /** + * Overwritten with an empty implementation since the `updateMatrix` flag is ignored + * for 3D textures. The uv transformation matrix is not applied to 3D textures. + * + * @param {boolean} value - The update toggle. + */ + setUpdateMatrix(): void; + /** + * Computes the normal for the given uv. These texture coordiantes represent a + * position inside the 3D texture. Unlike geometric normals, this normal + * represents a slope or gradient of scalar data inside the 3D texture. + * + * @param {Node} uvNode - The uv node that defines a position in the 3D texture. + * @return {Node} The normal representing the slope/gradient in the data. + */ + normal(uvNode: Node): Node; +} +/** + * This type of uniform node represents a 2D texture. + * + * @augments UniformNode + */ +export class TextureNode extends UniformNode { + /** + * Constructs a new texture node. + * + * @param {Texture} [value=EmptyTexture] - The texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Node} [biasNode=null] - The bias node. + */ + constructor(value?: Texture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTextureNode: boolean; + /** + * Represents the texture coordinates. + * + * @type {?Node} + * @default null + */ + uvNode: Node | null; + /** + * Represents the mip level that should be selected. + * + * @type {?Node} + * @default null + */ + levelNode: Node | null; + /** + * Represents the bias to be applied during level-of-detail computation. + * + * @type {?Node} + * @default null + */ + biasNode: Node | null; + /** + * Represents a reference value a texture sample is compared to. + * + * @type {?Node} + * @default null + */ + compareNode: Node | null; + /** + * When using texture arrays, the depth node defines the layer to select. + * + * @type {?Node} + * @default null + */ + depthNode: Node | null; + /** + * When defined, a texture is sampled using explicit gradients. + * + * @type {?Array>} + * @default null + */ + gradNode: Array> | null; + /** + * Represents the optional index constant of the channel to gather. + * This must be in range [0, 3] and a compile-time constant. + * + * @type {?Node} + * @default null + */ + gatherNode: Node | null; + /** + * Represents the optional texel offset applied to the unnormalized texture + * coordinate before sampling the texture. + * + * @type {?Node} + * @default null + */ + offsetNode: Node | null; + /** + * Whether texture values should be sampled or fetched. + * + * @type {boolean} + * @default true + */ + sampler: boolean; + /** + * Whether the uv transformation matrix should be + * automatically updated or not. Use `setUpdateMatrix()` + * if you want to change the value of the property. + * + * @type {boolean} + * @default false + */ + updateMatrix: boolean; + /** + * The reference node. + * + * @type {?Node} + * @default null + */ + referenceNode: Node | null; + /** + * The texture value is stored in a private property. + * + * @private + * @type {Texture} + */ + private _value; + /** + * The uniform node that represents the uv transformation matrix. + * + * @private + * @type {?UniformNode} + * @default null + */ + private _matrixUniform; + /** + * The uniform node that represents the y-flip. Only required for WebGL. + * + * @private + * @type {?UniformNode} + * @default null + */ + private _flipYUniform; + /** + * Whether the node is used as a comparison sampler, e.g. via `samplerComparison()`. + * + * @private + * @type {boolean} + * @default false + */ + private _samplerComparison; + set value(value: Texture); + /** + * The texture value. + * + * @type {Texture} + */ + get value(): Texture; + /** + * Overwritten since the uniform hash is defined by the texture's UUID. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The uniform hash. + */ + getUniformHash(): string; + /** + * Overwritten since the node type is inferred from the texture type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(): string; + /** + * Overwrites the default implementation to return a fixed value `'texture'`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; + /** + * Returns a default uvs based on the current texture's channel. + * + * @return {AttributeNode} The default uvs. + */ + getDefaultUV(): AttributeNode; + /** + * Overwritten to always return the texture reference of the node. + * + * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. + * @return {Texture} The texture reference. + */ + updateReference(): Texture; + /** + * Transforms the given uv node with the texture transformation matrix. + * + * @param {Node} uvNode - The uv node to transform. + * @return {Node} The transformed uv node. + */ + getTransformedUV(uvNode: Node): Node; + /** + * Defines whether the uv transformation matrix should automatically be updated or not. + * + * @param {boolean} value - The update toggle. + * @return {TextureNode} A reference to this node. + */ + setUpdateMatrix(value: boolean): TextureNode; + /** + * Setups the uv node. Depending on the backend as well as texture's image and type, it might be necessary + * to modify the uv node for correct sampling. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} uvNode - The uv node to setup. + * @return {Node} The updated uv node. + */ + setupUV(builder: NodeBuilder, uvNode: Node): Node; + /** + * Setups texture node by preparing the internal nodes for code generation. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * Generates the uv code snippet. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} uvNode - The uv node to generate code for. + * @return {string} The generated code snippet. + */ + generateUV(builder: NodeBuilder, uvNode: Node): string; + /** + * Generates the offset code snippet. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} offsetNode - The offset node to generate code for. + * @return {string} The generated code snippet. + */ + generateOffset(builder: NodeBuilder, offsetNode: Node): string; + /** + * Generates the snippet for the texture sampling. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} textureProperty - The texture property. + * @param {string} uvSnippet - The uv snippet. + * @param {?string} levelSnippet - The level snippet. + * @param {?string} biasSnippet - The bias snippet. + * @param {?string} depthSnippet - The depth snippet. + * @param {?string} compareSnippet - The compare snippet. + * @param {?Array} gradSnippet - The grad snippet. + * @param {?string} gatherSnippet - The gather snippet. + * @param {?string} offsetSnippet - The offset snippet. + * @param {?string} flipYSnippet - The y-flip snippet. Only used for WebGL. + * @return {string} The generated code snippet. + */ + generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, gatherSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; + /** + * Generates the code snippet of the texture node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} output - The current output. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder, output: string): string; + /** + * Sets the sampler value. + * + * @param {boolean} value - The sampler value to set. + * @return {TextureNode} A reference to this texture node. + */ + setSampler(value: boolean): TextureNode; + /** + * Returns the sampler value. + * + * @return {boolean} The sampler value. + */ + getSampler(): boolean; + /** + * Samples the texture with the given uv node. + * + * @param {Node} uvNode - The uv node. + * @return {TextureNode} A texture node representing the texture sample. + */ + sample(uvNode: Node): TextureNode; + /** + * TSL function for creating a texture node that fetches/loads texels without interpolation. + * + * @param {Node} uvNode - The uv node. + * @returns {TextureNode} A texture node representing the texture load. + */ + load(uvNode: Node): TextureNode; + /** + * Samples a blurred version of the texture by defining an internal bias. + * + * @param {Node} amountNode - How blurred the texture should be. + * @return {TextureNode} A texture node representing the texture sample. + */ + blur(amountNode: Node): TextureNode; + /** + * Samples a specific mip of the texture. + * + * @param {Node} levelNode - The mip level to sample. + * @return {TextureNode} A texture node representing the texture sample. + */ + level(levelNode: Node): TextureNode; + /** + * Returns the texture size of the requested level. + * + * @param {Node} levelNode - The level to compute the size for. + * @return {TextureSizeNode} The texture size. + */ + size(levelNode: Node): TextureSizeNode; + /** + * Samples the texture with the given bias. + * + * @param {Node} biasNode - The bias node. + * @return {TextureNode} A texture node representing the texture sample. + */ + bias(biasNode: Node): TextureNode; + /** + * Returns the base texture of this node. + * @return {TextureNode} The base texture node. + */ + getBase(): TextureNode; + /** + * Samples the texture by executing a compare operation. + * + * @param {Node} compareNode - The node that defines the compare value. + * @return {TextureNode} A texture node representing the texture sample. + */ + compare(compareNode: Node): TextureNode; + /** + * Samples the texture using an explicit gradient. + * + * @param {Node} gradNodeX - The gradX node. + * @param {Node} gradNodeY - The gradY node. + * @return {TextureNode} A texture node representing the texture sample. + */ + grad(gradNodeX: Node, gradNodeY: Node): TextureNode; + /** + * Gathers four texels from the texture. + * + * @param {Node} gatherNode - The index of the channel to read. This must be in range [0, 3] and a compile-time constant. + * @return {TextureNode} A texture node representing the texture sample. + */ + gather(gatherNode?: Node): TextureNode; + /** + * Returns `true` if the texture is sampled with a depth comparison, + * meaning the node must be bound with a comparison sampler. + * + * @return {boolean} Whether comparison sampling is used or not. + */ + isSampleCompare(): boolean; + /** + * Samples the texture by defining a depth node. + * + * @param {Node} depthNode - The depth node. + * @return {TextureNode} A texture node representing the texture sample. + */ + depth(depthNode: Node): TextureNode; + /** + * Samples the texture by defining an offset node. + * + * @param {Node} offsetNode - The offset node. + * @return {TextureNode} A texture node representing the texture sample. + */ + offset(offsetNode: Node): TextureNode; + /** + * The update is used to implement the update of the uv transformation matrix. + */ + update(): void; + /** + * Clones the texture node. + * + * @return {TextureNode} The cloned texture node. + */ + clone(): TextureNode; +} +/** + * A node that represents the dimensions of a texture. The texture size is + * retrieved in the shader via built-in shader functions like `textureDimensions()` + * or `textureSize()`. + * + * @augments Node + */ +export class TextureSizeNode extends Node { + /** + * Constructs a new texture size node. + * + * @param {TextureNode} textureNode - A texture node which size should be retrieved. + * @param {?Node} [levelNode=null] - A level node which defines the requested mip. + */ + constructor(textureNode: TextureNode, levelNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTextureSizeNode: boolean; + /** + * A texture node which size should be retrieved. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * A level node which defines the requested mip. + * + * @type {Node} + * @default null + */ + levelNode: Node; + generate(builder: any): any; +} +import { TimestampQuery } from './three.core.js'; +/** + * This node represents a tone mapping operation. + * + * @augments TempNode + */ +export class ToneMappingNode extends TempNode { + /** + * Constructs a new tone mapping node. + * + * @param {number} toneMapping - The tone mapping type. + * @param {Node} exposureNode - The tone mapping exposure. + * @param {Node} [colorNode=null] - The color node to process. + */ + constructor(toneMapping: number, exposureNode?: Node, colorNode?: Node); + /** + * The tone mapping type. + * + * @private + * @type {number} + */ + private _toneMapping; + /** + * The tone mapping exposure. + * + * @type {Node} + * @default null + */ + exposureNode: Node; + /** + * Represents the color to process. + * + * @type {?Node} + * @default null + */ + colorNode: Node | null; + /** + * Sets the tone mapping type. + * + * @param {number} value - The tone mapping type. + * @return {ToneMappingNode} A reference to this node. + */ + setToneMapping(value: number): ToneMappingNode; + /** + * Gets the tone mapping type. + * + * @returns {number} The tone mapping type. + */ + getToneMapping(): number; + setup(builder: any): any; +} +/** + * Represents a render pass for producing a toon outline effect on compatible objects. + * Only 3D objects with materials of type `MeshToonMaterial` and `MeshToonNodeMaterial` + * will receive the outline. + * + * ```js + * const postProcessing = new RenderPipeline( renderer ); + * + * const scenePass = toonOutlinePass( scene, camera ); + * + * postProcessing.outputNode = scenePass; + * ``` + * @augments PassNode + */ +export class ToonOutlinePassNode extends PassNode { + /** + * Constructs a new outline pass node. + * + * @param {Scene} scene - A reference to the scene. + * @param {Camera} camera - A reference to the camera. + * @param {Node} colorNode - Defines the outline's color. + * @param {Node} thicknessNode - Defines the outline's thickness. + * @param {Node} alphaNode - Defines the outline's alpha. + */ + constructor(scene: Scene, camera: Camera, colorNode: Node, thicknessNode: Node, alphaNode: Node); + /** + * Defines the outline's color. + * + * @type {Node} + */ + colorNode: Node; + /** + * Defines the outline's thickness. + * + * @type {Node} + */ + thicknessNode: Node; + /** + * Defines the outline's alpha. + * + * @type {Node} + */ + alphaNode: Node; + /** + * An internal material cache. + * + * @private + * @type {WeakMap} + */ + private _materialCache; + /** + * Creates the material used for outline rendering. + * + * @private + * @return {NodeMaterial} The outline material. + */ + private _createMaterial; + /** + * For the given toon material, this method returns a corresponding + * outline material. + * + * @private + * @param {(MeshToonMaterial|MeshToonNodeMaterial)} originalMaterial - The toon material. + * @return {NodeMaterial} The outline material. + */ + private _getOutlineMaterial; +} +import { UVMapping } from './three.core.js'; +import { Uint16BufferAttribute } from './three.core.js'; +import { Uint32BufferAttribute } from './three.core.js'; +/** + * Similar to {@link BufferNode} this module represents array-like data as + * uniform buffers. Unlike {@link BufferNode}, it can handle more common + * data types in the array (e.g `three.js` primitives) and automatically + * manage buffer padding. It should be the first choice when working with + * uniforms buffers. + * ```js + * const tintColors = uniformArray( [ + * new Color( 1, 0, 0 ), + * new Color( 0, 1, 0 ), + * new Color( 0, 0, 1 ) + * ], 'color' ); + * + * const redColor = tintColors.element( 0 ); + * + * @augments BufferNode + */ +export class UniformArrayNode extends BufferNode { + /** + * Constructs a new uniform array node. + * + * @param {Array} value - Array holding the buffer data. + * @param {?string} [elementType=null] - The data type of a buffer element. + */ + constructor(value: Array, elementType?: string | null); + /** + * Array holding the buffer data. Unlike {@link BufferNode}, the array can + * hold number primitives as well as three.js objects like vectors, matrices + * or colors. + * + * @type {Array} + */ + array: Array; + /** + * The data type of an array element. + * + * @type {string} + */ + elementType: string; + /** + * The padded type. Uniform buffers must conform to a certain buffer layout + * so a separate type is computed to ensure correct buffer size. + * + * @type {string} + */ + paddedType: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayBufferNode: boolean; + /** + * This method is overwritten since the node type is inferred from the + * {@link UniformArrayNode#paddedType}. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(): string; + /** + * The data type of the array elements. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The element type. + */ + getElementType(): string; + /** + * Returns the padded type based on the element type. + * + * @return {string} The padded type. + */ + getPaddedType(): string; + update(): void; + /** + * Composes a user-defined update with the buffer transfer. + * + * @param {Function} callback - The update function. + * @param {string} updateType - The update type. + * @return {UniformArrayNode} A reference to this node. + */ + onUpdate(callback: Function, updateType: string): UniformArrayNode; + /** + * The method makes sure to correctly transfer the data from the (complex) objects + * in the array to the internal, correctly padded value buffer. + */ + updateBuffer(): void; + /** + * Implement the value buffer creation based on the array data. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {null} + */ + setup(builder: NodeBuilder): null; + /** + * Overwrites the default `element()` method to provide element access + * based on {@link UniformArrayNode}. + * + * @param {IndexNode} indexNode - The index node. + * @return {UniformArrayElementNode} + */ + element(indexNode: IndexNode): UniformArrayElementNode; +} +/** + * This node can be used to group single instances of {@link UniformNode} + * and manage them as a uniform buffer. + * + * In most cases, the predefined nodes `objectGroup`, `renderGroup` and `frameGroup` + * will be used when defining the {@link UniformNode#groupNode} property. + * + * - `objectGroup`: Uniform buffer per object. + * - `renderGroup`: Shared uniform buffer, updated once per render call. + * - `frameGroup`: Shared uniform buffer, updated once per frame. + * + * @augments Node + */ +export class UniformGroupNode extends Node { + /** + * Constructs a new uniform group node. + * + * @param {string} name - The name of the uniform group node. + * @param {boolean} [shared=false] - Whether this uniform group node is shared or not. + * @param {number} [order=1] - Influences the internal sorting. + * @param {string|null} [updateType=null] - The update type of the uniform group node. + */ + constructor(name: string, shared?: boolean, order?: number, updateType?: string | null); + /** + * Whether this uniform group node is shared or not. + * + * @type {boolean} + * @default false + */ + shared: boolean; + /** + * The sort key that determines the order of this group relative to other + * uniform groups. Groups with a lower order are placed first. Shared groups + * typically use a lower order so they precede regular per-object groups. + * + * @type {number} + * @default 1 + */ + order: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformGroup: boolean; + /** + * Marks the uniform group node as needing an update. + * This will trigger the necessary updates in the rendering process. + */ + update(): void; +} +/** + * Class for representing a uniform. + * + * @augments InputNode + */ +export class UniformNode extends InputNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformNode: boolean; + /** + * The uniform group of this uniform. By default, uniforms are + * managed per object but they might belong to a shared group + * which is updated per frame or render call. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; + /** + * Sets the {@link UniformNode#name} property. + * + * @param {string} name - The name of the uniform. + * @return {UniformNode} A reference to this node. + */ + setName(name: string): UniformNode; + /** + * Sets the {@link UniformNode#name} property. + * + * @deprecated + * @param {string} name - The name of the uniform. + * @return {UniformNode} A reference to this node. + */ + label(name: string): UniformNode; + /** + * Sets the {@link UniformNode#groupNode} property. + * + * @param {UniformGroupNode} group - The uniform group. + * @return {UniformNode} A reference to this node. + */ + setGroup(group: UniformGroupNode): UniformNode; + /** + * Returns the {@link UniformNode#groupNode}. + * + * @return {UniformGroupNode} The uniform group. + */ + getGroup(): UniformGroupNode; + /** + * By default, this method returns the result of {@link Node#getHash} but derived + * classes might overwrite this method with a different implementation. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The uniform hash. + */ + getUniformHash(builder: NodeBuilder): string; + /** + * Uniform nodes with the same hash share a single uniform. This method returns the node + * the shared uniform refers to which is the first node registered for the hash. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {UniformNode} The node the shared uniform refers to. + */ + getSharedNode(builder: NodeBuilder): UniformNode; + onUpdate(callback: any, updateType: any): Node; + getInputType(builder: any): string; + generate(builder: any, output: any): any; +} +/** + * This node represents an operation that unpacks values from a 32-bit unsigned integer, reinterpreting the results as a floating-point vector + * + * @augments TempNode + */ +export class UnpackFloatNode extends TempNode { + /** + * + * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the integer values are mapped to the float range + * @param {Node} uintNode - The uint node to be unpacked + */ + constructor(encoding: "snorm" | "unorm" | "float16", uintNode: Node); + /** + * The unsigned integer to be unpacked. + * + * @type {Node} + */ + uintNode: Node; + /** + * The numeric encoding. + * + * @type {string} + */ + encoding: string; + /** + * The component layout of the packed integer. + * + * @type {'2x16' | '4x8'} + * @default '2x16' + */ + layout: "2x16" | "4x8"; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUnpackFloatNode: boolean; + generateNodeType(): "vec2" | "vec4"; + generate(builder: any): string; +} +import { UnsignedByteType } from './three.core.js'; +import { UnsignedInt101111Type } from './three.core.js'; +import { UnsignedInt248Type } from './three.core.js'; +import { UnsignedInt5999Type } from './three.core.js'; +import { UnsignedIntType } from './three.core.js'; +import { UnsignedShort4444Type } from './three.core.js'; +import { UnsignedShort5551Type } from './three.core.js'; +import { UnsignedShortType } from './three.core.js'; +/** + * A special type of reference node that allows to link values in + * `userData` fields to node objects. + * ```js + * sprite.userData.rotation = 1; // stores individual rotation per sprite + * + * const material = new THREE.SpriteNodeMaterial(); + * material.rotationNode = userData( 'rotation', 'float' ); + * ``` + * Since `UserDataNode` is extended from {@link ReferenceNode}, the node value + * will automatically be updated when the `rotation` user data field changes. + * + * @augments ReferenceNode + */ +export class UserDataNode extends ReferenceNode { + /** + * Constructs a new user data node. + * + * @param {string} property - The property name that should be referenced by the node. + * @param {string} inputType - The node data type of the reference. + * @param {?Object} [userData=null] - A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated. + */ + constructor(property: string, inputType: string, userData?: Object | null); + /** + * A reference to the `userData` object. If not provided, the `userData` + * property of the 3D object that uses the node material is evaluated. + * + * @type {?Object} + * @default null + */ + userData: Object | null; +} +import { VSMShadowMap } from './three.core.js'; +/** + * Class for representing shader variables as nodes. Variables are created from + * existing nodes like the following: + * + * ```js + * const depth = sampleDepth( uvNode ).toVar( 'depth' ); + * ``` + * + * @augments Node + */ +export class VarNode extends Node { + /** + * Constructs a new variable node. + * + * @param {Node} node - The node for which a variable should be created. + * @param {?string} [name=null] - The name of the variable in the shader. + * @param {boolean} [readOnly=false] - The read-only flag. + */ + constructor(node: Node, name?: string | null, readOnly?: boolean); + /** + * The node for which a variable should be created. + * + * @type {Node} + */ + node: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVarNode: boolean; + /** + * + * The read-only flag. + * + * @type {boolean} + * @default false + */ + readOnly: boolean; + /** + * This flag is used to indicate that this node is used for intent. + * + * @type {boolean} + * @default false + */ + intent: boolean; + /** + * Sets the intent flag for this node. + * + * This flag is used to indicate that this node is used for intent + * and should not be built directly. Instead, it is used to indicate that + * the node should be treated as a variable intent. + * + * It's useful for assigning variables without needing creating a new variable node. + * + * @param {boolean} value - The value to set for the intent flag. + * @returns {VarNode} This node. + */ + setIntent(value: boolean): VarNode; + /** + * Checks if this node is used for intent. + * + * @param {NodeBuilder} builder - The node builder. + * @returns {boolean} Whether this node is used for intent. + */ + isIntent(builder: NodeBuilder): boolean; + /** + * Returns the intent flag of this node. + * + * @return {boolean} The intent flag. + */ + getIntent(): boolean; + getMemberType(builder: any, name: any): string; + getElementType(builder: any): string; + generateNodeType(builder: any): string; + getArrayCount(builder: any): number | null; + isAssign(builder: any): any; + build(...params: any[]): string | Node | null; + generate(builder: any): any; + _hasStack(builder: any): boolean; +} +/** + * Class for representing shader varyings as nodes. Varyings are create from + * existing nodes like the following: + * + * ```js + * const positionLocal = positionGeometry.toVarying( 'vPositionLocal' ); + * ``` + * + * @augments Node + */ +export class VaryingNode extends Node { + /** + * Constructs a new varying node. + * + * @param {Node} node - The node for which a varying should be created. + * @param {?string} name - The name of the varying in the shader. + */ + constructor(node: Node, name?: string | null); + /** + * The node for which a varying should be created. + * + * @type {Node} + */ + node: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVaryingNode: boolean; + /** + * The interpolation type of the varying data. + * + * @type {?string} + * @default null + */ + interpolationType: string | null; + /** + * The interpolation sampling type of varying data. + * + * @type {?string} + * @default null + */ + interpolationSampling: string | null; + /** + * Defines the interpolation type of the varying. + * + * @param {string} type - The interpolation type. + * @param {?string} sampling - The interpolation sampling type + * @return {VaryingNode} A reference to this node. + */ + setInterpolation(type: string, sampling?: string | null): VaryingNode; + getHash(builder: any): string; + generateNodeType(builder: any): string; + /** + * This method performs the setup of a varying node with the current node builder. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {NodeVarying} The node varying from the node builder. + */ + setupVarying(builder: NodeBuilder): NodeVarying; + setup(builder: any): void; + analyze(builder: any): void; + generate(builder: any): any; +} +import { Vector2 } from './three.core.js'; +import { Vector3 } from './three.core.js'; +import { Vector4 } from './three.core.js'; +/** + * A node for representing motion or velocity vectors. Foundation + * for advanced post processing effects like motion blur or TRAA. + * + * The node keeps track of the model, view and projection matrices + * of the previous frame and uses them to compute offsets in NDC space. + * These offsets represent the final velocity. + * + * @augments TempNode + */ +export class VelocityNode extends TempNode { + /** + * Constructs a new vertex color node. + */ + constructor(); + /** + * The current projection matrix. + * + * @type {?Matrix4} + * @default null + */ + projectionMatrix: Matrix4 | null; + /** + * Uniform node representing the previous model matrix in world space. + * + * @type {UniformNode} + * @default null + */ + previousModelWorldMatrix: UniformNode; + /** + * Uniform node representing the previous projection matrix. + * + * @type {UniformNode} + * @default null + */ + previousProjectionMatrix: UniformNode; + /** + * Uniform node representing the previous view matrix. + * + * @type {UniformNode} + * @default null + */ + previousCameraViewMatrix: UniformNode; + /** + * Sets the given projection matrix. + * + * @param {Matrix4} projectionMatrix - The projection matrix to set. + */ + setProjectionMatrix(projectionMatrix: Matrix4): void; + /** + * Updates velocity specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update({ frameId, camera, object }: NodeFrame): void; + /** + * Overwritten to updated velocity specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateAfter({ object }: NodeFrame): void; + /** + * Implements the velocity computation based on the previous and current vertex data. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Node} The motion vector. + */ + setup(): Node; +} +/** + * An attribute node for representing vertex colors. + * + * @augments AttributeNode + */ +export class VertexColorNode extends AttributeNode { + /** + * Constructs a new vertex color node. + * + * @param {number} index - The attribute index. + */ + constructor(index: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVertexColorNode: boolean; + /** + * The attribute index to enable more than one sets of vertex colors. + * + * @type {number} + * @default 0 + */ + index: number; +} +/** + * This node offers a collection of features in context of the depth logic in the fragment shader. + * Depending on {@link ViewportDepthNode#scope}, it can be used to define a depth value for the current + * fragment or for depth evaluation purposes. + * + * @augments Node + */ +export class ViewportDepthNode extends Node { + /** + * Constructs a new viewport depth node. + * + * @param {('depth'|'depthBase'|'linearDepth')} scope - The node's scope. + * @param {?Node} [valueNode=null] - The value node. + */ + constructor(scope: ("depth" | "depthBase" | "linearDepth"), valueNode?: Node | null); + /** + * The node behaves differently depending on which scope is selected. + * + * - `ViewportDepthNode.DEPTH_BASE`: Allows to define a value for the current fragment's depth. + * - `ViewportDepthNode.DEPTH`: Represents the depth value for the current fragment (`valueNode` is ignored). + * - `ViewportDepthNode.LINEAR_DEPTH`: Represents the linear (orthographic) depth value of the current fragment. + * If a `valueNode` is set, the scope can be used to convert perspective depth data to linear data. + * + * @type {('depth'|'depthBase'|'linearDepth')} + */ + scope: ("depth" | "depthBase" | "linearDepth"); + /** + * Can be used to define a custom depth value. + * The property is ignored in the `ViewportDepthNode.DEPTH` scope. + * + * @type {?Node} + * @default null + */ + valueNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isViewportDepthNode: boolean; + generate(builder: any): any; + setup({ camera }: { + camera: any; + }): any; +} +export namespace ViewportDepthNode { + export let DEPTH_BASE: string; + let DEPTH_1: string; + export { DEPTH_1 as DEPTH }; + export let LINEAR_DEPTH: string; +} +/** + * Represents the depth of the current viewport as a texture. This module + * can be used in combination with viewport texture to achieve effects + * that require depth evaluation. + * + * @augments ViewportTextureNode + */ +export class ViewportDepthTextureNode extends ViewportTextureNode { + /** + * Constructs a new viewport depth texture node. + * + * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, uses a shared depth texture. + */ + constructor(uvNode?: Node, levelNode?: Node | null, depthTexture?: DepthTexture | null); +} +/** + * `ViewportTextureNode` creates an internal texture for each node instance. This module + * shares a texture across all instances of `ViewportSharedTextureNode`. It should + * be the first choice when using data of the default/screen framebuffer for performance reasons. + * + * @augments ViewportTextureNode + */ +export class ViewportSharedTextureNode extends ViewportTextureNode { + /** + * Constructs a new viewport shared texture node. + * + * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + */ + constructor(uvNode?: Node, levelNode?: Node | null); + /** + * Overwritten so the method always returns the unique shared + * framebuffer texture. + * + * @return {FramebufferTexture} The shared framebuffer texture. + */ + getTextureForReference(): FramebufferTexture; + updateReference(): this; +} +/** + * A special type of texture node which represents the data of the current viewport + * as a texture. The module extracts data from the current bound framebuffer with + * a copy operation so no extra render pass is required to produce the texture data + * (which is good for performance). `ViewportTextureNode` can be used as an input for a + * variety of effects like refractive or transmissive materials. + * + * @augments TextureNode + */ +export class ViewportTextureNode extends TextureNode { + /** + * Constructs a new viewport texture node. + * + * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. + */ + constructor(uvNode?: Node, levelNode?: Node | null, framebufferTexture?: Texture | null); + /** + * Whether to generate mipmaps or not. + * + * @type {boolean} + * @default false + */ + generateMipmaps: boolean; + /** + * The reference framebuffer texture. This is used to store the framebuffer texture + * for the current render target. If the render target changes, a new framebuffer texture + * is created automatically. + * + * @type {FramebufferTexture} + * @default null + */ + defaultFramebuffer: FramebufferTexture; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOutputTextureNode: boolean; + /** + * The framebuffer texture for the current renderer context. + * + * @type {WeakMap} + * @private + */ + private _cacheTextures; + /** + * This methods returns a texture for the given render target or canvas target reference. + * + * To avoid rendering errors, `ViewportTextureNode` must use unique framebuffer textures + * for different render contexts. + * + * @param {?(RenderTarget|CanvasTarget)} [reference=null] - The render target or canvas target reference. + * @return {Texture} The framebuffer texture. + */ + getTextureForReference(reference?: (RenderTarget | CanvasTarget) | null): Texture; + updateReference(frame: any): Texture; + updateBefore(frame: any): void; + clone(): any; +} +/** + * Volume node material. + * + * @augments NodeMaterial + */ +export class VolumeNodeMaterial extends NodeMaterial { + /** + * Constructs a new volume node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVolumeNodeMaterial: boolean; + /** + * Number of steps used for raymarching. + * + * @type {number} + * @default 25 + */ + steps: number; + /** + * Offsets the distance a ray has been traveled through a volume. + * Can be used to implement dithering to reduce banding. + * + * @type {Node} + * @default null + */ + offsetNode: Node; + /** + * Node used for scattering calculations. + * + * @type {Function|FunctionNode} + * @default null + */ + scatteringNode: Function | FunctionNode; + setupLightingModel(): VolumetricLightingModel; +} +/** + * A node builder targeting WGSL. + * + * This module generates WGSL shader code from node materials and also + * generates the respective bindings and vertex buffer definitions. These + * data are later used by the renderer to create render and compute pipelines + * for render objects. + * + * @augments NodeBuilder + */ +export class WGSLNodeBuilder extends NodeBuilder { + /** + * Constructs a new WGSL node builder renderer. + * + * @param {Object3D} object - The 3D object. + * @param {Renderer} renderer - The renderer. + */ + constructor(object: Object3D, renderer: Renderer); + /** + * A dictionary that holds for each shader stage ('vertex', 'fragment', 'compute') + * another dictionary which manages UBOs per group ('render','frame','object'). + * + * @type {Object>} + */ + uniformGroups: { + [x: string]: { + [x: string]: NodeUniformsGroup; + }; + }; + /** + * A dictionary that holds the assigned binding indices for each uniform group. + * This ensures the same binding index is used across all shader stages. + * + * @type {Object} + */ + uniformGroupsBindings: { + [x: string]: { + index: number; + id: number; + }; + }; + /** + * A dictionary that holds for each shader stage a Map of builtins. + * + * @type {Object>} + */ + builtins: { + [x: string]: Map; + }; + /** + * A dictionary that holds for each shader stage a Set of directives. + * + * @type {Object>} + */ + directives: { + [x: string]: Set; + }; + /** + * A map for managing scope arrays. Only relevant for when using + * {@link WorkgroupInfoNode} in context of compute shaders. + * + * @type {Map} + */ + scopedArrays: Map; + /** + * A flag that indicates that early returns are allowed. + * + * @type {boolean} + * @default true + */ + allowEarlyReturns: boolean; + /** + * A flag that indicates that global variables are allowed. + * + * @type {boolean} + * @default true + */ + allowGlobalVariables: boolean; + /** + * Generates the WGSL snippet for sampled textures. + * + * @private + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + private _generateTextureSample; + /** + * Generates the WGSL snippet when sampling textures with explicit mip level. + * + * @private + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + private generateTextureSampleLevel; + /** + * Generates a wrap function used in context of textures. + * + * @param {Texture} texture - The texture to generate the function for. + * @return {string} The name of the generated function. + */ + generateWrapFunction(texture: Texture): string; + /** + * Generates a WGSL variable that holds the texture dimension of the given texture. + * It also returns information about the number of layers (elements) of an arrayed + * texture as well as the cube face count of cube textures. + * + * @param {Texture} texture - The texture to generate the function for. + * @param {string} textureProperty - The name of the video texture uniform in the shader. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @return {string} The name of the dimension variable. + */ + generateTextureDimension(texture: Texture, textureProperty: string, levelSnippet: string): string; + /** + * Generates the WGSL snippet that resolves the dimensions of the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level. + * @return {string} The WGSL snippet. + */ + generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; + /** + * Generates the WGSL snippet for a manual filtered texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @return {string} The WGSL snippet. + */ + generateFilteredTexture(texture: Texture, textureProperty: string, uvSnippet: string, offsetSnippet: string | null, levelSnippet?: string, depthSnippet: string | null): string; + /** + * Generates the WGSL snippet for a texture lookup with explicit level-of-detail. + * Since it's a lookup, no sampling or filtering is applied. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @return {string} The WGSL snippet. + */ + generateTextureLod(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, levelSnippet?: string): string; + /** + * Generates the WGSL snippet that reads a single texel from a storage texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateStorageTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet that writes a single texel to a texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {string} valueSnippet - A WGSL snippet that represent the new texel value. + * @return {string} The WGSL snippet. + */ + generateTextureStore(texture: Texture, textureProperty: string, uvIndexSnippet: string, depthSnippet: string | null, valueSnippet: string): string; + /** + * Returns `true` if the sampled values of the given texture should be compared against a reference value. + * + * @param {Texture} texture - The texture. + * @return {boolean} Whether the sampled values of the given texture should be compared against a reference value or not. + */ + isSampleCompare(texture: Texture): boolean; + /** + * Returns `true` if the given texture is unfilterable. + * + * @param {Texture} texture - The texture. + * @return {boolean} Whether the given texture is unfilterable or not. + */ + isUnfilterable(texture: Texture): boolean; + /** + * Generates the WGSL snippet for sampling/loading the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the WGSL snippet for sampling/loading the given texture using explicit gradients. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {Array} gradSnippet - An array holding both gradient WGSL snippets. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values + * against a reference value. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A WGSL snippet that represents the reference value. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the WGSL snippet for gathering four texels from the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} gatherSnippet - A WGSL snippet that represents the index of the channel to read. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet for performing a depth comparison on four texels in the given depth texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A WGSL snippet that represents the reference value. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet when sampling textures with explicit mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet when sampling textures with a bias to the mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} biasSnippet - A WGSL snippet that represents the bias to apply to the mip level before sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Returns a WGSL snippet that represents the property name of the given node. + * + * @param {Node} node - The node. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The property name. + */ + getPropertyName(node: Node, shaderStage?: string): string; + /** + * Returns whether the given name is a reserved keyword of WGSL. + * + * @param {string} name - The name to test. + * @return {boolean} Whether the name is a reserved keyword or not. + */ + isReservedKeyword(name: string): boolean; + /** + * Returns the native shader operator name for a given generic name. + * + * @param {string} op - The operator name to resolve. + * @return {?string} The resolved operator name. + */ + getFunctionOperator(op: string): string | null; + /** + * Returns the node access for the given node and shader stage. + * + * @param {StorageTextureNode|StorageBufferNode} node - The storage node. + * @param {string} shaderStage - The shader stage. + * @return {string} The node access. + */ + getNodeAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; + /** + * Returns A WGSL snippet representing the storage access. + * + * @param {StorageTextureNode|StorageBufferNode} node - The storage node. + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet representing the storage access. + */ + getStorageAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; + /** + * This method is one of the more important ones since it's responsible + * for generating a matching binding instance for the given uniform node. + * + * These bindings are later used in the renderer to create bind groups + * and layouts. + * + * @param {UniformNode} node - The uniform node. + * @param {string} type - The node data type. + * @param {string} shaderStage - The shader stage. + * @param {?string} [name=null] - An optional uniform name. + * @return {NodeUniform} The node uniform object. + */ + getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; + /** + * This method should be used whenever builtins are required in nodes. + * The internal builtins data structure will make sure builtins are + * defined in the WGSL source. + * + * @param {string} name - The builtin name. + * @param {string} property - The property name. + * @param {string} type - The node data type. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The property name. + */ + getBuiltin(name: string, property: string, type: string, shaderStage?: string): string; + /** + * Returns `true` if the given builtin is defined in the given shader stage. + * + * @param {string} name - The builtin name. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {boolean} Whether the given builtin is defined in the given shader stage or not. + */ + hasBuiltin(name: string, shaderStage?: string): boolean; + /** + * Builds the given shader node. + * + * @param {ShaderNodeInternal} shaderNode - The shader node. + * @return {string} The WGSL function code. + */ + buildFunctionCode(shaderNode: ShaderNodeInternal): string; + /** + * Returns a builtin representing the index of a compute invocation within the scope of a workgroup load. + * + * @return {string} The invocation local index. + */ + getInvocationLocalIndex(): string; + /** + * Returns a builtin representing the size of a subgroup within the current shader. + * + * @return {string} The subgroup size. + */ + getSubgroupSize(): string; + /** + * Returns a builtin representing the index of a compute invocation within the scope of a subgroup. + * + * @return {string} The invocation subgroup index. + */ + getInvocationSubgroupIndex(): string; + /** + * Returns a builtin representing the index of a compute invocation's subgroup within its workgroup. + * + * @return {string} The subgroup index. + */ + getSubgroupIndex(): string; + /** + * Overwritten as a NOP since this method is intended for the WebGL 2 backend. + * + * @return {null} Null. + */ + getDrawIndex(): null; + /** + * Returns the frag depth builtin. + * + * @return {string} The frag depth builtin. + */ + getFragDepth(): string; + /** + * Returns the clip distances builtin. + * + * @return {string} The clip distances builtin. + */ + getClipDistance(): string; + /** + * Enables the given directive for the given shader stage. + * + * @param {string} name - The directive name. + * @param {string} [shaderStage=this.shaderStage] - The shader stage to enable the directive for. + */ + enableDirective(name: string, shaderStage?: string): void; + /** + * Returns the directives of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} A WGSL snippet that enables the directives of the given stage. + */ + getDirectives(shaderStage: string): string; + /** + * Enables the 'subgroups' directive. + */ + enableSubGroups(): void; + /** + * Enables the 'subgroups-f16' directive. + */ + enableSubgroupsF16(): void; + /** + * Enables the 'clip_distances' directive. + */ + enableClipDistances(): void; + /** + * Enables the 'f16' directive. + */ + enableShaderF16(): void; + /** + * Enables the 'dual_source_blending' directive. + */ + enableDualSourceBlending(): void; + /** + * Enables hardware clipping. + * + * @param {string} planeCount - The clipping plane count. + */ + enableHardwareClipping(planeCount: string): void; + /** + * Returns the builtins of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} A WGSL snippet that represents the builtins of the given stage. + */ + getBuiltins(shaderStage: string): string; + /** + * This method should be used when a new scoped buffer is used in context of + * compute shaders. It adds the array to the internal data structure which is + * later used to generate the respective WGSL. + * + * @param {string} name - The array name. + * @param {string} scope - The scope. + * @param {string} bufferType - The buffer type. + * @param {string} bufferCount - The buffer count. + * @return {string} The array name. + */ + getScopedArray(name: string, scope: string, bufferType: string, bufferCount: string): string; + /** + * Returns the scoped arrays of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string|undefined} The WGSL snippet that defines the scoped arrays. + * Returns `undefined` when used in the vertex or fragment stage. + */ + getScopedArrays(shaderStage: string): string | undefined; + /** + * Returns the shader attributes of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the shader attributes. + */ + getAttributes(shaderStage: string): string; + /** + * Returns the members of the given struct type node as a WGSL string. + * + * @param {StructTypeNode} struct - The struct type node. + * @return {string} The WGSL snippet that defines the struct members. + */ + getStructMembers(struct: StructTypeNode): string; + /** + * Returns the structs of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the structs. + */ + getStructs(shaderStage: string): string; + /** + * Returns a WGSL string representing a variable. + * + * @param {string} type - The variable's type. + * @param {string} name - The variable's name. + * @param {?number} [count=null] - The array length. + * @param {string} [qualifier=''] - The variable's qualifier. + * @return {string} The WGSL snippet that defines a variable. + */ + getVar(type: string, name: string, count?: number | null, qualifier?: string): string; + /** + * Returns the variables of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the variables. + */ + getVars(shaderStage: string, global?: boolean): string; + /** + * Returns the varyings of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the varyings. + */ + getVaryings(shaderStage: string): string; + isCustomStruct(nodeUniform: any): any; + /** + * Returns the uniforms of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the uniforms. + */ + getUniforms(shaderStage: string): string; + /** + * Returns the native shader method name for a given generic name. + * + * @param {string} method - The method name to resolve. + * @param {?string} [output=null] - An optional output. + * @return {string} The resolved WGSL method name. + */ + getMethod(method: string, output?: string | null): string; + /** + * Returns the bitcast method name for a given input and outputType. + * + * @param {string} type - The output type to bitcast to. + * @return {string} The resolved WGSL bitcast invocation. + */ + getBitcastMethod(type: string): string; + /** + * Returns the float packing method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolve WGSL float packing method name. + */ + getFloatPackingMethod(encoding: string, layout?: string): string; + /** + * Returns the float unpacking method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolve WGSL float unpacking method name. + */ + getFloatUnpackingMethod(encoding: string, layout?: string): string; + /** + * Returns the native snippet for a ternary operation. + * + * @param {string} condSnippet - The condition determining which expression gets resolved. + * @param {string} ifSnippet - The expression to resolve to if the condition is true. + * @param {string} elseSnippet - The expression to resolve to if the condition is false. + * @return {string} The resolved method name. + */ + getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; + /** + * Whether the requested feature is available or not. + * + * @param {string} name - The requested feature. + * @return {boolean} Whether the requested feature is supported or not. + */ + isAvailable(name: string): boolean; + /** + * Returns the native shader method name for a given generic name. + * + * @private + * @param {string} method - The method name to resolve. + * @return {string} The resolved WGSL method name. + */ + private _getWGSLMethod; + /** + * Includes the given method name into the current + * function node. + * + * @private + * @param {string} name - The method name to include. + * @return {CodeNode} The respective code node. + */ + private _include; + /** + * Returns a WGSL vertex shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getWGSLVertexCode; + /** + * Returns a WGSL fragment shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getWGSLFragmentCode; + /** + * Returns a WGSL compute shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @param {string} workgroupSize - The workgroup size. + * @return {string} The vertex shader. + */ + private _getWGSLComputeCode; + /** + * Returns a WGSL struct based on the given name and variables. + * + * @private + * @param {string} name - The struct name. + * @param {string} vars - The struct variables. + * @return {string} The WGSL snippet representing a struct. + */ + private _getWGSLStruct; + /** + * Returns a WGSL struct binding. + * + * @private + * @param {string} name - The struct name. + * @param {string} vars - The struct variables. + * @param {string} access - The access. + * @param {number} [binding=0] - The binding index. + * @param {number} [group=0] - The group index. + * @return {string} The WGSL snippet representing a struct binding. + */ + private _getWGSLStructBinding; +} +/** + * A backend implementation targeting WebGL 2. + * + * @private + * @augments Backend + */ +export class WebGLBackend extends Backend { + /** + * WebGLBackend options. + * + * @typedef {Object} WebGLBackend~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. + * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. + * @property {WebGL2RenderingContext} [context=undefined] - A WebGL 2 rendering context. + */ + /** + * Constructs a new WebGPU backend. + * + * @param {WebGLBackend~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLBackend: boolean; + /** + * A reference to a backend module holding shader attribute-related + * utility functions. + * + * @type {?WebGLAttributeUtils} + * @default null + */ + attributeUtils: WebGLAttributeUtils | null; + /** + * A reference to a backend module holding extension-related + * utility functions. + * + * @type {?WebGLExtensions} + * @default null + */ + extensions: WebGLExtensions | null; + /** + * A reference to a backend module holding capability-related + * utility functions. + * + * @type {?WebGLCapabilities} + * @default null + */ + capabilities: WebGLCapabilities | null; + /** + * A reference to a backend module holding texture-related + * utility functions. + * + * @type {?WebGLTextureUtils} + * @default null + */ + textureUtils: WebGLTextureUtils | null; + /** + * A reference to a backend module holding renderer-related + * utility functions. + * + * @type {?WebGLBufferRenderer} + * @default null + */ + bufferRenderer: WebGLBufferRenderer | null; + /** + * A reference to the rendering context. + * + * @type {?WebGL2RenderingContext} + * @default null + */ + gl: WebGL2RenderingContext | null; + /** + * A reference to a backend module holding state-related + * utility functions. + * + * @type {?WebGLState} + * @default null + */ + state: WebGLState | null; + /** + * A reference to a backend module holding common + * utility functions. + * + * @type {?WebGLUtils} + * @default null + */ + utils: WebGLUtils | null; + /** + * Dictionary for caching VAOs. + * + * @type {Object} + */ + vaoCache: { + [x: string]: WebGLVertexArrayObject; + }; + /** + * Dictionary for caching transform feedback objects. + * + * @type {Object} + */ + transformFeedbackCache: { + [x: string]: WebGLTransformFeedback; + }; + /** + * Controls if `gl.RASTERIZER_DISCARD` should be enabled or not. + * Only relevant when using compute shaders. + * + * @type {boolean} + * @default false + */ + discard: boolean; + /** + * A reference to the `EXT_disjoint_timer_query_webgl2` extension. `null` if the + * device does not support the extension. + * + * @type {?EXTDisjointTimerQueryWebGL2} + * @default null + */ + disjoint: EXTDisjointTimerQueryWebGL2 | null; + /** + * A reference to the `KHR_parallel_shader_compile` extension. `null` if the + * device does not support the extension. + * + * @type {?KHRParallelShaderCompile} + * @default null + */ + parallel: KHRParallelShaderCompile | null; + /** + * A reference to the current render context. + * + * @private + * @type {RenderContext} + * @default null + */ + private _currentContext; + /** + * A unique collection of bindings. + * + * @private + * @type {WeakSet>} + */ + private _knownBindings; + /** + * Whether the device supports framebuffers invalidation or not. + * + * @private + * @type {boolean} + */ + private _supportsInvalidateFramebuffer; + /** + * The target framebuffer when rendering with + * the WebXR device API. + * + * @private + * @type {?WebGLFramebuffer} + * @default null + */ + private _xrFramebuffer; + /** + * Initializes the backend so it is ready for usage. + * + * @param {Renderer} renderer - The renderer. + */ + init(renderer: Renderer): void; + _onContextLost: ((event: any) => void) | undefined; + drawBuffersIndexedExt: Object | undefined; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @param {number} offset - The storage buffer attribute. + * @param {number} count - The offset from which to start reading the + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Ensures the backend is XR compatible. + * + * @async + * @return {Promise} A Promise that resolve when the renderer is XR compatible. + */ + makeXRCompatible(): Promise; + /** + * Sets the XR rendering destination. + * + * @param {WebGLFramebuffer} xrFramebuffer - The XR framebuffer. + */ + setXRTarget(xrFramebuffer: WebGLFramebuffer): void; + /** + * Configures the given XR render target with external textures. + * + * This method is only relevant when using the WebXR Layers API. + * + * @param {XRRenderTarget} renderTarget - The XR render target. + * @param {WebGLTexture} colorTexture - A native color texture. + * @param {?WebGLTexture} [depthTexture=null] - A native depth texture. + */ + setXRRenderTargetTextures(renderTarget: XRRenderTarget, colorTexture: WebGLTexture, depthTexture?: WebGLTexture | null): void; + /** + * Inits a time stamp query for the given render context. + * + * @param {string} type - The type of the timestamp query. + * @param {string} uid - A unique identifier for the timestamp query. + */ + initTimestampQuery(type: string, uid: string): void; + /** + * Prepares the timestamp buffer. + * + * @param {string} type - The type of the timestamp query. + * @param {string} uid - A unique identifier for the timestamp query. + */ + prepareTimestampBuffer(type: string, uid: string): void; + /** + * Returns the backend's rendering context. + * + * @return {WebGL2RenderingContext} The rendering context. + */ + getContext(): WebGL2RenderingContext; + /** + * This method is executed at the beginning of a render call and prepares + * the WebGL state for upcoming render calls + * + * @param {RenderContext} renderContext - The render context. + */ + beginRender(renderContext: RenderContext): void; + /** + * This method is executed at the end of a render call and finalizes work + * after draw calls. + * + * @param {RenderContext} renderContext - The render context. + */ + finishRender(renderContext: RenderContext): void; + /** + * This method processes the result of occlusion queries and writes it + * into render context data. + * + * @async + * @param {RenderContext} renderContext - The render context. + */ + resolveOccludedAsync(renderContext: RenderContext): void; + /** + * Returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(renderContext: RenderContext, object: Object3D): boolean; + /** + * Updates the viewport with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateViewport(renderContext: RenderContext): void; + /** + * Updates the scissor with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateScissor(renderContext: RenderContext): void; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Performs a clear operation. + * + * @param {boolean} color - Whether the color buffer should be cleared or not. + * @param {boolean} depth - Whether the depth buffer should be cleared or not. + * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. + * @param {?Object} [descriptor=null] - The render context of the current set render target. + * @param {boolean} [setFrameBuffer=true] - Controls whether the intermediate framebuffer should be set or not. + * @param {boolean} [resolveRenderTarget=true] - Controls whether an active render target should be resolved + * or not. Only relevant for explicit clears. + */ + clear(color: boolean, depth: boolean, stencil: boolean, descriptor?: Object | null, setFrameBuffer?: boolean, resolveRenderTarget?: boolean): void; + /** + * This method is executed at the beginning of a compute call and + * prepares the state for upcoming compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + beginCompute(computeGroup: Node | Array): void; + /** + * Executes a compute command for the given compute node. + * + * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. + * @param {Node} computeNode - The compute node. + * @param {Array} bindings - The bindings. + * @param {ComputePipeline} pipeline - The compute pipeline. + * @param {?number} [count=null] - The count of compute invocations. If `null`, the count is determined by the compute node. + */ + compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, count?: number | null): void; + /** + * This method is executed at the end of a compute call and + * finalizes work after compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + finishCompute(computeGroup: Node | Array): void; + /** + * Internal to determine if the current render target is a render target array with depth 2D array texture. + * + * @param {RenderContext} renderContext - The render context. + * @return {boolean} Whether the render target is a render target array with depth 2D array texture. + * + * @private + */ + private _isRenderCameraDepthArray; + /** + * Internal draw function. + * + * @private + * @param {Object3D} object - The object to render. + * @param {WebGLBufferRenderer} renderer - The internal renderer. + * @param {number} firstVertex - The first vertex to render. + * @param {number} vertexCount - The vertex count. + * @param {number} instanceCount - The intance count. + * @param {WebGLProgram} programGPU - The raw WebGL shader program. + */ + private _draw; + /** + * Executes a draw command for the given render object. + * + * @param {RenderObject} renderObject - The render object to draw. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + */ + draw(renderObject: RenderObject): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(texture: Texture): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(texture: Texture, options?: Object): void; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + */ + generateMipmaps(texture: Texture): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Returns a node builder for the given render object. + * + * @param {RenderObject} object - The render object. + * @param {Renderer} renderer - The renderer. + * @return {GLSLNodeBuilder} The node builder. + */ + createNodeBuilder(object: RenderObject, renderer: Renderer): GLSLNodeBuilder; + /** + * Creates a shader program from the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + createProgram(program: ProgrammableStage): void; + /** + * Destroys the shader program of the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + destroyProgram(program: ProgrammableStage): void; + /** + * Creates a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(renderObject: RenderObject, promises: Array>): void; + /** + * Formats the source code of error messages. + * + * @private + * @param {string} string - The code. + * @param {number} errorLine - The error line. + * @return {string} The formatted code. + */ + private _handleSource; + /** + * Gets the shader compilation errors from the info log. + * + * @private + * @param {WebGL2RenderingContext} gl - The rendering context. + * @param {WebGLShader} shader - The WebGL shader object. + * @param {string} type - The shader type. + * @return {string} The shader errors. + */ + private _getShaderErrors; + /** + * Logs shader compilation errors. + * + * @private + * @param {WebGLProgram} programGPU - The WebGL program. + * @param {WebGLShader} glFragmentShader - The fragment shader as a native WebGL shader object. + * @param {WebGLShader} glVertexShader - The vertex shader as a native WebGL shader object. + */ + private _logProgramError; + /** + * Completes the shader program setup for the given render object. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {RenderPipeline} pipeline - The render pipeline. + */ + private _completeCompile; + /** + * Creates a compute pipeline for the given compute node. + * + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; + /** + * Completes the compute pipeline setup for the given compute pipeline. + * + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - Array of bind groups. + */ + _completeComputeCompile(computePipeline: ComputePipeline, bindings: Array): void; + /** + * Creates bindings from the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(bindGroup: BindGroup, bindings: Array): void; + /** + * Updates the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + updateBindings(bindGroup: BindGroup): void; + /** + * Updates a buffer binding. + * + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(binding: Buffer): void; + /** + * Creates a uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + createUniformBuffer(uniformBuffer: Buffer): void; + /** + * Destroys the GPU data for the given uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + destroyUniformBuffer(uniformBuffer: Buffer): void; + /** + * Creates the GPU buffer of an indexed shader attribute. + * + * @param {BufferAttribute} attribute - The indexed buffer attribute. + */ + createIndexAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a storage attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createStorageAttribute(attribute: BufferAttribute): void; + /** + * Updates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to update. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * Destroys the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to destroy. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * Checks if the given feature is supported by the backend. + * + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(name: string): boolean; + /** + * Copies data of the given source texture to the given destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; + /** + * Checks if the given compatibility is supported by the backend. + * + * @param {string} name - The compatibility name. + * @return {boolean} Whether the compatibility is supported or not. + */ + hasCompatibility(name: string): boolean; + /** + * Initializes the render target defined in the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + initRenderTarget(renderContext: RenderContext): void; + /** + * Configures the active framebuffer from the given render context. + * + * @private + * @param {RenderContext} descriptor - The render context. + */ + private _setFramebuffer; + /** + * Computes the VAO key for the given index and attributes. + * + * @private + * @param {Array} attributes - An array of buffer attributes. + * @return {string} The VAO key. + */ + private _getVaoKey; + /** + * Creates a VAO from the index and attributes. + * + * @private + * @param {Array} attributes - An array of buffer attributes. + * @return {Object} The VAO data. + */ + private _createVao; + /** + * Creates a transform feedback from the given transform buffers. + * + * @private + * @param {Array} transformBuffers - The transform buffers. + * @return {WebGLTransformFeedback} The transform feedback. + */ + private _getTransformFeedback; + /** + * Setups the given bindings. + * + * @private + * @param {Array} bindings - The bindings. + * @param {WebGLProgram} programGPU - The WebGL program. + */ + private _setupBindings; + /** + * Binds the given uniforms. + * + * @private + * @param {Array} bindings - The bindings. + */ + private _bindUniforms; + /** + * The method ensures multisampled render targets are resolved. + * + * @private + * @param {RenderContext} renderContext - The render context. + */ + private _resolveRenderTarget; + /** + * Returns `true` if the `WEBGL_multisampled_render_to_texture` extension + * should be used when MSAA is enabled. + * + * @private + * @param {RenderTarget} renderTarget - The render target that should be multisampled. + * @return {boolean} Whether to use the `WEBGL_multisampled_render_to_texture` extension for MSAA or not. + */ + private _useMultisampledExtension; +} +/** + * A WebGL 2 backend utility module for managing the device's capabilities. + * + * @private + */ +export class WebGLCapabilities { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * This value holds the cached max anisotropy value. + * + * @type {?number} + * @default null + */ + maxAnisotropy: number | null; + /** + * This value holds the cached max uniform block size value. + * + * @type {?number} + * @default null + */ + maxUniformBlockSize: number | null; + /** + * Returns the maximum anisotropy texture filtering value. This value + * depends on the device and is reported by the `EXT_texture_filter_anisotropic` + * WebGL extension. + * + * @return {number} The maximum anisotropy texture filtering value. + */ + getMaxAnisotropy(): number; + /** + * Returns the maximum number of bytes available for uniform buffers. + * + * @return {number} The maximum number of bytes available for uniform buffers. + */ + getUniformBufferLimit(): number; +} +import { WebGLCoordinateSystem } from './three.core.js'; +/** + * A backend implementation targeting WebGPU. + * + * @private + * @augments Backend + */ +export class WebGPUBackend extends Backend { + /** + * WebGPUBackend options. + * + * @typedef {Object} WebGPUBackend~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. + * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. + * @property {boolean} [trackTimestamp=false] - Whether to track timestamps with a Timestamp Query API or not. + * @property {string} [powerPreference=undefined] - The power preference. + * @property {Object} [requiredLimits=undefined] - Specifies the limits that are required by the device request. The request will fail if the adapter cannot provide these limits. + * @property {GPUDevice} [device=undefined] - If there is an existing GPU device on app level, it can be passed to the renderer as a parameter. + * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. + */ + /** + * Constructs a new WebGPU backend. + * + * @param {WebGPUBackend~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGPUBackend: boolean; + /** + * Indicates whether the backend is in WebGPU compatibility mode or not. + * The backend must be initialized before the property can be evaluated. + * + * @type {?boolean} + * @readonly + * @default null + */ + readonly compatibilityMode: boolean | null; + /** + * A reference to the device. + * + * @type {?GPUDevice} + * @default null + */ + device: GPUDevice | null; + /** + * A reference to the default render pass descriptor. + * + * @type {?Object} + * @default null + */ + defaultRenderPassdescriptor: Object | null; + /** + * A reference to a backend module holding common utility functions. + * + * @type {WebGPUUtils} + */ + utils: WebGPUUtils; + /** + * A reference to a backend module holding shader attribute-related + * utility functions. + * + * @type {WebGPUAttributeUtils} + */ + attributeUtils: WebGPUAttributeUtils; + /** + * A reference to a backend module holding shader binding-related + * utility functions. + * + * @type {WebGPUBindingUtils} + */ + bindingUtils: WebGPUBindingUtils; + /** + * A reference to a backend module holding device capability related + * utility functions. + * + * @type {WebGPUCapabilities} + */ + capabilities: WebGPUCapabilities; + /** + * A reference to a backend module holding shader pipeline-related + * utility functions. + * + * @type {WebGPUPipelineUtils} + */ + pipelineUtils: WebGPUPipelineUtils; + /** + * A reference to a backend module holding shader texture-related + * utility functions. + * + * @type {WebGPUTextureUtils} + */ + textureUtils: WebGPUTextureUtils; + /** + * A map that manages the resolve buffers for occlusion queries. + * + * @type {Map} + */ + occludedResolveCache: Map; + /** + * A map of compatibility checks. + * + * @type {Object} + */ + _compatibility: Object; + /** + * Registers external GPU textures from `XRGPUBinding` for use in rendering. + * + * @param {RenderTarget} renderTarget - The render target to register the textures for. + * @param {GPUTexture} colorTexture - The shared XR color GPUTexture. + * @param {?Array} [viewDescriptors=null] - Optional view descriptors, one per XR view. + */ + setXRRenderTargetTextures(renderTarget: RenderTarget, colorTexture: GPUTexture, viewDescriptors?: Array | null): void; + /** + * A reference to the context. + * + * @type {?GPUCanvasContext} + * @default null + */ + get context(): GPUCanvasContext | null; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {number} count - The offset from which to start reading the + * @param {number} offset - The storage buffer attribute. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Returns the backend's rendering context. + * + * @return {GPUCanvasContext} The rendering context. + */ + getContext(): GPUCanvasContext; + /** + * Returns the default render pass descriptor. + * + * In WebGPU, the default framebuffer must be configured + * like custom framebuffers so the backend needs a render + * pass descriptor even when rendering directly to screen. + * + * @private + * @return {GPURenderPassDescriptor} The render pass descriptor. + */ + private _getDefaultRenderPassDescriptor; + /** + * Returns whether the render target is a render target array with depth 2D array texture. + * + * @param {RenderContext} renderContext - The render context. + * @return {boolean} Whether the render target is a render target array with depth 2D array texture. + * + * @private + */ + private _isRenderCameraDepthArray; + /** + * Returns whether the current render context references external textures. + * + * External textures can change every frame, so their descriptors must not be cached. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @return {boolean} Whether the render context uses external textures. + */ + private _hasExternalTexture; + /** + * Returns multisampled color textures for an external render target. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @param {Object} textureData - The backend data for the external texture. + * @param {number} count - The number of textures to create. + * @return {?Array} The multisampled textures. + */ + private _getExternalMSAATextures; + /** + * Creates attachment views for an external texture render target. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @param {Object} textureData - The backend data for the texture. + * @return {Array} The attachment view descriptors. + */ + private _createExternalTextureViews; + /** + * Returns the render pass descriptor for the given render context. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @param {Object} colorAttachmentsConfig - Configuration object for the color attachments. + * @return {Object} The render pass descriptor. + */ + private _getRenderPassDescriptor; + /** + * This method is executed at the beginning of a render call and prepares + * the WebGPU state for upcoming render calls + * + * @param {RenderContext} renderContext - The render context. + */ + beginRender(renderContext: RenderContext): void; + /** + * Resets the state cache of the given render context data. + * + * A new render pass encoder starts with a blend constant and a stencil reference + * of zero so the cached values must be reset as well. + * + * @private + * @param {Object} renderContextData - The render context data. + */ + private _resetRenderContextData; + /** + * Creates a render bundle encoder and state cache for each camera layer. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object} renderContextData - The render context data. + * @private + */ + private _createArrayCameraBundleEncoders; + /** + * Finishes the render bundle encoders for all camera layers. + * + * @param {Object} renderContextData - The render context data. + * @return {Array} The completed render bundles. + * @private + */ + private _finishArrayCameraBundleEncoders; + /** + * Creates render pass descriptors for each camera in an array camera. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object} renderContextData - The render context data. + * @param {Object} descriptor - The render pass descriptor. + * @param {ArrayCamera} cameras - The array camera. + * + * @private + */ + private _createArrayCameraLayerDescriptors; + /** + * Updates render pass descriptors for each camera in an array camera. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object} renderContextData - The render context data. + * @param {Object} descriptor - The render pass descriptor. + * @param {ArrayCamera} cameras - The array camera. + * + */ + _updateArrayCameraLayerDescriptors(renderContext: RenderContext, renderContextData: Object, descriptor: Object, cameras: ArrayCamera): void; + /** + * This method is executed at the end of a render call and finalizes work + * after draw calls. + * + * @param {RenderContext} renderContext - The render context. + */ + finishRender(renderContext: RenderContext): void; + /** + * Returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(renderContext: RenderContext, object: Object3D): boolean; + /** + * This method processes the result of occlusion queries and writes it + * into render context data. + * + * @async + * @param {RenderContext} renderContext - The render context. + * @return {Promise} A Promise that resolves when the occlusion query results have been processed. + */ + resolveOccludedAsync(renderContext: RenderContext): Promise; + /** + * Updates the viewport with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateViewport(renderContext: RenderContext): void; + /** + * Updates the scissor with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateScissor(renderContext: RenderContext): void; + /** + * Performs a clear operation. + * + * @param {boolean} color - Whether the color buffer should be cleared or not. + * @param {boolean} depth - Whether the depth buffer should be cleared or not. + * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. + * @param {?RenderContext} [renderTargetContext=null] - The render context of the current set render target. + */ + clear(color: boolean, depth: boolean, stencil: boolean, renderTargetContext?: RenderContext | null): void; + /** + * This method is executed at the beginning of a compute call and + * prepares the state for upcoming compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + beginCompute(computeGroup: Node | Array): void; + /** + * Executes a compute command for the given compute node. + * + * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. + * @param {Node} computeNode - The compute node. + * @param {Array} bindings - The bindings. + * @param {ComputePipeline} pipeline - The compute pipeline. + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. + */ + compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, dispatchSize?: number | Array | IndirectStorageBufferAttribute): void; + /** + * This method is executed at the end of a compute call and + * finalizes work after compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + finishCompute(computeGroup: Node | Array): void; + /** + * Internal draw function that performs the draw with the given pass encoder. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + * @param {Object} renderContextData - The render context data object, holding current pass state and occlusion query tracking. + * @param {GPURenderPipeline} pipelineGPU - The GPU render pipeline. + * @param {Array} bindings - The bind groups. + * @param {Array} vertexBuffers - The vertex buffers. + * @param {{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} drawParams - The draw parameters. + * @param {GPURenderPassEncoder|GPURenderBundleEncoder} passEncoderGPU - The GPU pass encoder used for recording draw commands. + * @param {Object} currentSets - Tracking object for currently set pipeline, attributes, bind groups, and index state. + * @param {number} [cameraIndexSlot=-1] - Index of the binding slot holding the camera index bind group. + */ + private _draw; + /** + * Executes a draw command for the given render object. + * + * @param {RenderObject} renderObject - The render object to draw. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + */ + draw(renderObject: RenderObject, info: Info): void; + /** + * Returns `true` if the render pipeline requires an update. + * + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether the render pipeline requires an update or not. + */ + needsRenderUpdate(renderObject: RenderObject): boolean; + /** + * Returns a cache key that is used to identify render pipelines. + * + * @param {RenderObject} renderObject - The render object. + * @return {string} The cache key. + */ + getRenderCacheKey(renderObject: RenderObject): string; + /** + * Updates a GPU sampler for the given texture. + * + * @param {Sampler} binding - The sampler binding to update. + * @return {string} The current sampler key. + */ + updateSampler(binding: Sampler): string; + /** + * Frees the GPU sampler for the given sampler binding. + * + * @param {Sampler} binding - The sampler binding to free. + */ + destroySampler(binding: Sampler): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + * @return {boolean} Whether the sampler has been updated or not. + */ + createDefaultTexture(texture: Texture): boolean; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(texture: Texture, options?: Object): void; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + */ + generateMipmaps(texture: Texture): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Inits a time stamp query for the given render context. + * + * @param {string} type - The type of the timestamp query (e.g. 'render', 'compute'). + * @param {number} uid - Unique id for the context (e.g. render context id). + * @param {Object} descriptor - The query descriptor. + */ + initTimestampQuery(type: string, uid: number, descriptor: Object): void; + /** + * Returns a node builder for the given render object. + * + * @param {RenderObject} object - The render object. + * @param {Renderer} renderer - The renderer. + * @return {WGSLNodeBuilder} The node builder. + */ + createNodeBuilder(object: RenderObject, renderer: Renderer): WGSLNodeBuilder; + /** + * Creates a shader program from the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + createProgram(program: ProgrammableStage): void; + /** + * Destroys the shader program of the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + destroyProgram(program: ProgrammableStage): void; + /** + * Creates a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(renderObject: RenderObject, promises: Array>): void; + /** + * Creates a compute pipeline for the given compute node. + * + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; + /** + * Prepares the state for encoding render bundles. + * + * @param {RenderContext} renderContext - The render context. + */ + beginBundle(renderContext: RenderContext): void; + /** + * After processing render bundles this method finalizes related work. + * + * @param {RenderContext} renderContext - The render context. + * @param {RenderBundle} bundle - The render bundle. + */ + finishBundle(renderContext: RenderContext, bundle: RenderBundle): void; + /** + * Adds a render bundle to the render context data. + * + * @param {RenderContext} renderContext - The render context. + * @param {RenderBundle} bundle - The render bundle to add. + */ + addBundle(renderContext: RenderContext, bundle: RenderBundle): void; + /** + * Creates a uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + createUniformBuffer(uniformBuffer: Buffer): void; + /** + * Destroys the GPU data for the given uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + destroyUniformBuffer(uniformBuffer: Buffer): void; + /** + * Creates bindings from the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; + /** + * Updates the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + updateBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; + /** + * Updates a buffer binding. + * + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(binding: Buffer): void; + /** + * Delete data associated with the current bind group. + * + * @param {BindGroup} bindGroup - The bind group. + */ + deleteBindGroupData(bindGroup: BindGroup): void; + /** + * Creates the buffer of an indexed shader attribute. + * + * @param {BufferAttribute} attribute - The indexed buffer attribute. + */ + createIndexAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a storage attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createStorageAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of an indirect storage attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createIndirectStorageAttribute(attribute: BufferAttribute): void; + /** + * Updates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to update. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * Destroys the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to destroy. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * Checks if the given feature is supported by the backend. + * + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(name: string): boolean; + /** + * Copies data of the given source texture to the given destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The mipmap level to copy. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; + /** + * Encodes a framebuffer copy from a specific texture-array layer. + * + * @param {GPUCommandEncoder} encoder - The command encoder. + * @param {Texture} texture - The destination texture. + * @param {GPUTexture} sourceGPU - The source GPU texture. + * @param {GPUTexture} destinationGPU - The destination GPU texture. + * @param {Object} rectangle - The source rectangle. + * @param {number} [sourceLayer=0] - The source array layer. + * @param {boolean} [generateMipmaps=texture.generateMipmaps] - Whether mipmaps should be generated. + * @private + */ + private _copyFramebufferToTexture; + /** + * Checks if the given compatibility is supported by the backend. + * + * @param {string} name - The compatibility name. + * @return {boolean} Whether the compatibility is supported or not. + */ + hasCompatibility(name: string): boolean; +} +import { WebGPUCoordinateSystem } from './three.core.js'; +/** + * This renderer is the new alternative of `WebGLRenderer`. `WebGPURenderer` has the ability + * to target different backends. By default, the renderer tries to use a WebGPU backend if the + * browser supports WebGPU. If not, `WebGPURenderer` falls backs to a WebGL 2 backend. + * + * @augments Renderer + */ +export class WebGPURenderer extends Renderer { + /** + * WebGPURenderer options. + * + * @typedef {Object} WebGPURenderer~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. + * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. + * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. + * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. + * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best + * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. + */ + /** + * Constructs a new WebGPU renderer. + * + * @param {WebGPURenderer~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGPURenderer: boolean; +} +import { WebXRController } from './three.core.js'; +/** + * A node allowing the user to create a 'workgroup' scoped buffer within the + * context of a compute shader. Typically, workgroup scoped buffers are + * created to hold data that is transferred from a global storage scope into + * a local workgroup scope. For invocations within a workgroup, data + * access speeds on 'workgroup' scoped buffers can be significantly faster + * than similar access operations on globally accessible storage buffers. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +export class WorkgroupInfoNode extends Node { + /** + * Constructs a new workgroup info node. + * + * @param {string} scope - The address space the buffer is scoped to. Currently only `'Workgroup'` is used. + * @param {string} bufferType - The data type of a 'workgroup' scoped buffer element. + * @param {number} [bufferCount=0] - The number of elements in the buffer. + */ + constructor(scope: string, bufferType: string, bufferCount?: number); + /** + * The buffer type. + * + * @type {string} + */ + bufferType: string; + /** + * The buffer count. + * + * @type {number} + * @default 0 + */ + bufferCount: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWorkgroupInfoNode: boolean; + /** + * The data type of the array buffer. + * + * @type {string} + */ + elementType: string; + /** + * The address space the buffer is scoped to. Currently only `'Workgroup'` is used. + * + * @type {string} + */ + scope: string; + /** + * Sets the name of this node. + * + * @param {string} name - The name to set. + * @return {WorkgroupInfoNode} A reference to this node. + */ + setName(name: string): WorkgroupInfoNode; + /** + * Sets the name/label of this node. + * + * @deprecated + * @param {string} name - The name to set. + * @return {WorkgroupInfoNode} A reference to this node. + */ + label(name: string): WorkgroupInfoNode; + /** + * Sets the scope of this node. + * + * @param {string} scope - The scope to set. + * @return {WorkgroupInfoNode} A reference to this node. + */ + setScope(scope: string): WorkgroupInfoNode; + /** + * The data type of the array buffer. + * + * @return {string} The element type. + */ + getElementType(): string; + /** + * Overwrites the default implementation since the input type + * is inferred from the scope. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; + /** + * This method can be used to access elements via an index node. + * + * @param {IndexNode} indexNode - indexNode. + * @return {WorkgroupInfoElementNode} A reference to an element. + */ + element(indexNode: IndexNode): WorkgroupInfoElementNode; + generate(builder: any): any; +} +import { ZeroFactor } from './three.core.js'; +import { ZeroStencilOp } from './three.core.js'; +import { createCanvasElement } from './three.core.js'; +export const defaultBuildStages: string[]; +export const defaultShaderStages: string[]; +import { error } from './three.core.js'; +import { log as log$1 } from './three.core.js'; +export const shaderStages: string[]; +export const vectorComponents: string[]; +import { warn } from './three.core.js'; +import { warnOnce } from './three.core.js'; +/** + * Abstract base class of a timestamp query pool. + * + * @abstract + */ +declare class TimestampQueryPool { + /** + * Creates a new timestamp query pool. + * + * @param {number} [maxQueries=256] - Maximum number of queries this pool can hold. + */ + constructor(maxQueries?: number); + /** + * Whether to track timestamps or not. + * + * @type {boolean} + * @default true + */ + trackTimestamp: boolean; + /** + * Maximum number of queries this pool can hold. + * + * @type {number} + * @default 256 + */ + maxQueries: number; + /** + * How many queries allocated so far. + * + * @type {number} + * @default 0 + */ + currentQueryIndex: number; + /** + * Tracks offsets for different contexts. + * + * @type {Map} + */ + queryOffsets: Map; + /** + * Whether the pool has been disposed or not. + * + * @type {boolean} + * @default false + */ + isDisposed: boolean; + /** + * The total frame duration until the next update. + * + * @type {number} + * @default 0 + */ + lastValue: number; + /** + * Stores all timestamp frames. + * + * @type {Array} + */ + frames: Array; + /** + * This property is used to avoid multiple concurrent resolve operations. + * The WebGL backend uses it as a boolean flag. In context of WebGPU, it holds + * the promise of the current resolve operation. + * + * @type {boolean|Promise} + * @default false + */ + pendingResolve: boolean | Promise; + /** + * Stores the latest timestamp for each render context. + * + * @type {Map} + */ + timestamps: Map; + /** + * Returns all timestamp frames. + * + * @return {Array} The timestamp frames. + */ + getTimestampFrames(): Array; + /** + * Returns the timestamp for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @return {?number} The timestamp, or undefined if not available. + */ + getTimestamp(uid: string): number | null; + /** + * Returns whether a timestamp is available for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @return {boolean} True if a timestamp is available, false otherwise. + */ + hasTimestampQuery(uid: string): boolean; + /** + * Allocate queries for a specific uid. + * + * @abstract + * @param {string} uid - A unique identifier for the render context. + * @param {number} frameId - The current frame identifier. + * @returns {?number} + */ + allocateQueriesForContext(): number | null; + /** + * Resolve all timestamps and return data (or process them). + * + * @abstract + * @async + * @returns {Promise|number} The resolved timestamp value. + */ + resolveQueriesAsync(): Promise | number; + /** + * Dispose of the query pool. + * + * @abstract + */ + dispose(): void; +} +/** + * Any render or compute command is executed in a specific context that defines + * the state of the renderer and its backend. Typical examples for such context + * data are the current clear values or data from the active framebuffer. This + * module is used to represent these contexts as objects. + * + * @private + */ +declare class RenderContext { + /** + * The context's ID. + * + * @type {number} + */ + id: number; + /** + * The MRT configuration. + * + * @type {?MRTNode} + * @default null + */ + mrt: MRTNode | null; + /** + * Whether the current active framebuffer has a color attachment. + * + * @type {boolean} + * @default true + */ + color: boolean; + /** + * Whether the color attachment should be cleared or not. + * + * @type {boolean} + * @default true + */ + clearColor: boolean; + /** + * The clear color value. + * + * @type {Object} + * @default true + */ + clearColorValue: Object; + /** + * Whether the current active framebuffer has a depth attachment. + * + * @type {boolean} + * @default true + */ + depth: boolean; + /** + * Whether the depth attachment should be cleared or not. + * + * @type {boolean} + * @default true + */ + clearDepth: boolean; + /** + * The clear depth value. + * + * @type {number} + * @default 1 + */ + clearDepthValue: number; + /** + * Whether the current active framebuffer has a stencil attachment. + * + * @type {boolean} + * @default false + */ + stencil: boolean; + /** + * Whether the stencil attachment should be cleared or not. + * + * @type {boolean} + * @default true + */ + clearStencil: boolean; + /** + * The clear stencil value. + * + * @type {number} + * @default 1 + */ + clearStencilValue: number; + /** + * By default the viewport encloses the entire framebuffer If a smaller + * viewport is manually defined, this property is to `true` by the renderer. + * + * @type {boolean} + * @default false + */ + viewport: boolean; + /** + * The viewport value. This value is in physical pixels meaning it incorporates + * the renderer's pixel ratio. The viewport property of render targets or + * the renderer is in logical pixels. + * + * @type {Vector4} + */ + viewportValue: Vector4; + /** + * When the scissor test is active and scissor rectangle smaller than the + * framebuffers dimensions, this property is to `true` by the renderer. + * + * @type {boolean} + * @default false + */ + scissor: boolean; + /** + * The scissor rectangle. + * + * @type {Vector4} + */ + scissorValue: Vector4; + /** + * The active render target. + * + * @type {?RenderTarget} + * @default null + */ + renderTarget: RenderTarget | null; + /** + * The textures of the active render target. + * `null` when no render target is set. + * + * @type {?Array} + * @default null + */ + textures: Array | null; + /** + * The depth texture of the active render target. + * `null` when no render target is set. + * + * @type {?DepthTexture} + * @default null + */ + depthTexture: DepthTexture | null; + /** + * The active cube face. + * + * @type {number} + * @default 0 + */ + activeCubeFace: number; + /** + * The active mipmap level. + * + * @type {number} + * @default 0 + */ + activeMipmapLevel: number; + /** + * The number of MSAA samples. This value is always `1` when + * MSAA isn't used. + * + * @type {number} + * @default 1 + */ + sampleCount: number; + /** + * The active render target's width in physical pixels. + * + * @type {number} + * @default 0 + */ + width: number; + /** + * The active render target's height in physical pixels. + * + * @type {number} + * @default 0 + */ + height: number; + /** + * The occlusion query count. + * + * @type {number} + * @default 0 + */ + occlusionQueryCount: number; + /** + * The current clipping context. + * + * @type {?ClippingContext} + * @default null + */ + clippingContext: ClippingContext | null; + /** + * The current camera. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * Whether a fullscreen pass is rendered or not. + * + * @type {boolean} + * @default false + */ + fullscreenPass: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderContext: boolean; + /** + * Returns the cache key of this render context. + * + * @return {number} The cache key. + */ + getCacheKey(): number; +} +/** + * A four-component version of {@link Color} which is internally + * used by the renderer to represents clear color with alpha as + * one object. + * + * @private + * @augments Color + */ +declare class Color4 extends Color { + /** + * Constructs a new four-component color. + * You can also pass a single THREE.Color, hex or + * string argument to this constructor. + * + * @param {number|string} [r=1] - The red value. + * @param {number} [g=1] - The green value. + * @param {number} [b=1] - The blue value. + * @param {number} [a=1] - The alpha value. + */ + constructor(r?: number | string, g?: number, b?: number, a?: number); + a: number; + /** + * Overwrites the default to honor alpha. + * You can also pass a single THREE.Color, hex or + * string argument to this method. + * + * @param {number|string|Color} r - The red value. + * @param {number} [g] - The green value. + * @param {number} [b] - The blue value. + * @param {number} [a=1] - The alpha value. + * @return {Color4} A reference to this object. + */ + set(r: number | string | Color, g?: number, b?: number, a?: number): Color4; + /** + * Overwrites the default to honor alpha. + * + * @param {Color4} color - The color to copy. + * @return {Color4} A reference to this object. + */ + copy(color: Color4): Color4; + /** + * Overwrites the default to honor alpha. + * + * @return {Color4} The cloned color. + */ + clone(): Color4; +} +/** + * The purpose of a node library is to assign node implementations + * to existing library features. In `WebGPURenderer` lights, materials + * which are not based on `NodeMaterial` as well as tone mapping techniques + * are implemented with node-based modules. + * + * @private + */ +declare class NodeLibrary { + /** + * A weak map that maps lights to light nodes. + * + * @type {WeakMap} + */ + lightNodes: WeakMap; + /** + * A map that maps materials to node materials. + * + * @type {Map} + */ + materialNodes: Map; + /** + * A map that maps tone mapping techniques (constants) + * to tone mapping node functions. + * + * @type {Map} + */ + toneMappingNodes: Map; + /** + * Returns a matching node material instance for the given material object. + * + * This method also assigns/copies the properties of the given material object + * to the node material. This is done to make sure the current material + * configuration carries over to the node version. + * + * @param {Material} material - A material. + * @return {NodeMaterial} The corresponding node material. + */ + fromMaterial(material: Material): NodeMaterial; + /** + * Adds a tone mapping node function for a tone mapping technique (constant). + * + * @param {Function} toneMappingNode - The tone mapping node function. + * @param {number} toneMapping - The tone mapping. + */ + addToneMapping(toneMappingNode: Function, toneMapping: number): void; + /** + * Returns a tone mapping node function for a tone mapping technique (constant). + * + * @param {number} toneMapping - The tone mapping. + * @return {?Function} The tone mapping node function. Returns `null` if no node function is found. + */ + getToneMappingFunction(toneMapping: number): Function | null; + /** + * Returns a node material class definition for a material type. + * + * @param {string} materialType - The material type. + * @return {?NodeMaterial.constructor} The node material class definition. Returns `null` if no node material is found. + */ + getMaterialNodeClass(materialType: string): NodeMaterial.constructor | null; + /** + * Adds a node material class definition for a given material type. + * + * @param {NodeMaterial.constructor} materialNodeClass - The node material class definition. + * @param {string} materialClassType - The material type. + */ + addMaterial(materialNodeClass: NodeMaterial.constructor, materialClassType: string): void; + /** + * Returns a light node class definition for a light class definition. + * + * @param {Light.constructor} light - The light class definition. + * @return {?AnalyticLightNode.constructor} The light node class definition. Returns `null` if no light node is found. + */ + getLightNodeClass(light: Light.constructor): AnalyticLightNode.constructor | null; + /** + * Adds a light node class definition for a given light class definition. + * + * @param {AnalyticLightNode.constructor} lightNodeClass - The light node class definition. + * @param {Light.constructor} lightClass - The light class definition. + */ + addLight(lightNodeClass: AnalyticLightNode.constructor, lightClass: Light.constructor): void; + /** + * Adds a node class definition for the given type to the provided type library. + * + * @param {Node.constructor} nodeClass - The node class definition. + * @param {number|string} type - The object type. + * @param {Map} library - The type library. + */ + addType(nodeClass: Node.constructor, type: number | string, library: Map): void; + /** + * Adds a node class definition for the given class definition to the provided type library. + * + * @param {Node.constructor} nodeClass - The node class definition. + * @param {Node.constructor} baseClass - The class definition. + * @param {WeakMap} library - The type library. + */ + addClass(nodeClass: Node.constructor, baseClass: Node.constructor, library: WeakMap): void; +} +/** + * Base class for node functions. A derived module must be implemented + * for each supported native shader language. Similar to other `Node*` modules, + * this class is only relevant during the building process and not used + * in user-level code. + */ +declare class NodeFunction { + /** + * Constructs a new node function. + * + * @param {string} type - The node type. This type is the return type of the node function. + * @param {Array} inputs - The function's inputs. + * @param {string} [name=''] - The function's name. + * @param {string} [precision=''] - The precision qualifier. + */ + constructor(type: string, inputs: Array, name?: string, precision?: string); + /** + * The node type. This type is the return type of the node function. + * + * @type {string} + */ + type: string; + /** + * The function's inputs. + * + * @type {Array} + */ + inputs: Array; + /** + * The name of the uniform. + * + * @type {string} + * @default '' + */ + name: string; + /** + * The precision qualifier. + * + * @type {string} + * @default '' + */ + precision: string; + /** + * This method returns the native code of the node function. + * + * @abstract + * @param {string} name - The function's name. + * @return {string} A shader code. + */ + getCode(): string; +} +declare namespace NodeFunction { + let isNodeFunction: boolean; +} +/** + * A special form of uniforms group that represents + * the individual uniforms as node-based uniforms. + * + * @private + * @augments UniformsGroup + */ +declare class NodeUniformsGroup extends UniformsGroup { + /** + * Constructs a new node-based uniforms group. + * + * @param {string} name - The group's name. + * @param {UniformGroupNode} groupNode - The uniform group node. + */ + constructor(name: string, groupNode: UniformGroupNode); + /** + * The group's ID. + * + * @type {number} + */ + id: number; + /** + * The uniform group node. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeUniformsGroup: boolean; +} +declare class ShaderNodeInternal extends Node { + constructor(jsFunc: any, nodeType: any); + jsFunc: any; + layout: any; + once: boolean; + setLayout(layout: any): this; + getLayout(): any; + call(rawInputs?: null): ShaderCallNodeInternal; + setup(): ShaderCallNodeInternal; +} +/** + * Base class for node parsers. A derived parser must be implemented + * for each supported native shader language. + */ +declare class NodeParser { + /** + * The method parses the given native code an returns a node function. + * + * @abstract + * @param {string} source - The native shader code. + * @return {NodeFunction} A node function. + */ + parseFunction(): NodeFunction; +} +/** + * This class represents a GLSL node function. + * + * @augments NodeFunction + */ +declare class GLSLNodeFunction extends NodeFunction { + /** + * Constructs a new GLSL node function. + * + * @param {string} source - The GLSL source. + */ + constructor(source: string); + inputsCode: any; + blockCode: any; + headerCode: any; + /** + * This method returns the GLSL code of the node function. + * + * @param {string} [name=this.name] - The function's name. + * @return {string} The shader code. + */ + getCode(name?: string): string; +} +/** + * Represents the lighting model for unlit materials. The only light contribution + * is baked indirect lighting modulated with ambient occlusion and the material's + * diffuse color. Environment mapping is supported. Used in {@link MeshBasicNodeMaterial}. + * + * @augments LightingModel + */ +declare class BasicLightingModel extends LightingModel { + /** + * Implements the baked indirect lighting with its modulation. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirect({ context }: NodeBuilder): void; + /** + * Implements the environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + */ + finish(builder: NodeBuilder): void; +} +/** + * Represents the lighting model for {@link MeshSSSNodeMaterial}. + * + * @augments PhysicalLightingModel + */ +declare class SSSLightingModel extends PhysicalLightingModel { + /** + * Whether the lighting model should use SSS or not. + * + * @type {boolean} + * @default false + */ + useSSS: boolean; + /** + * Extends the default implementation with a SSS term. + * + * Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) + * + * @param {Object} input - The input data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; +} +/** + * Represents the lighting model for a toon material. Used in {@link MeshToonNodeMaterial}. + * + * @augments LightingModel + */ +declare class ToonLightingModel extends LightingModel { + /** + * Implements the direct lighting. Instead of using a conventional smooth irradiance, the irradiance is + * reduced to a small number of discrete shades to create a comic-like, flat look. + * + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; + /** + * Implements the indirect lighting. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirect(builder: NodeBuilder): void; +} +/** + * Represents the state that is used to perform clipping via clipping planes. + * There is a default clipping context for each render context. When the + * scene holds instances of `ClippingGroup`, there will be a context for each + * group. + * + * @private + */ +declare class ClippingContext { + /** + * Constructs a new clipping context. + * + * @param {?ClippingContext} [parentContext=null] - A reference to the parent clipping context. + */ + constructor(parentContext?: ClippingContext | null); + /** + * The clipping context's version. + * + * @type {number} + * @readonly + */ + readonly version: number; + /** + * Whether the intersection of the clipping planes is used to clip objects, rather than their union. + * + * @type {?boolean} + * @default null + */ + clipIntersection: boolean | null; + /** + * The clipping context's cache key. + * + * @type {string} + */ + cacheKey: string; + /** + * Whether the shadow pass is active or not. + * + * @type {boolean} + * @default false + */ + shadowPass: boolean; + /** + * The view matrix. + * + * @type {Matrix4} + */ + viewMatrix: Matrix4; + /** + * The view normal matrix. + * + * @type {Matrix3} + */ + viewNormalMatrix: Matrix3; + /** + * Internal cache for maintaining clipping contexts. + * + * @type {WeakMap} + */ + clippingGroupContexts: WeakMap; + /** + * The intersection planes. + * + * @type {Array} + */ + intersectionPlanes: Array; + /** + * The intersection planes. + * + * @type {Array} + */ + unionPlanes: Array; + /** + * The version of the clipping context's parent context. + * + * @type {?number} + * @readonly + */ + readonly parentVersion: number | null; + /** + * Projects the given source clipping planes and writes the result into the + * destination array. + * + * @param {Array} source - The source clipping planes. + * @param {Array} destination - The destination. + * @param {number} offset - The offset. + */ + projectPlanes(source: Array, destination: Array, offset: number): void; + /** + * Updates the root clipping context of a scene. + * + * @param {Scene} scene - The scene. + * @param {Camera} camera - The camera that is used to render the scene. + */ + updateGlobal(scene: Scene, camera: Camera): void; + /** + * Updates the clipping context. + * + * @param {ClippingContext} parentContext - The parent context. + * @param {ClippingGroup} clippingGroup - The clipping group this context belongs to. + */ + update(parentContext: ClippingContext, clippingGroup: ClippingGroup): void; + /** + * Returns a clipping context for the given clipping group. + * + * @param {ClippingGroup} clippingGroup - The clipping group. + * @return {ClippingContext} The clipping context. + */ + getGroupContext(clippingGroup: ClippingGroup): ClippingContext; + /** + * The count of union clipping planes. + * + * @type {number} + * @readonly + */ + readonly get unionClippingCount(): number; +} +/** + * A bind group represents a collection of bindings and thus a collection + * or resources. Bind groups are assigned to pipelines to provide them + * with the required resources (like uniform buffers or textures). + * + * @private + */ +declare class BindGroup { + /** + * Constructs a new bind group. + * + * @param {string} name - The bind group's name. + * @param {Array} bindings - An array of bindings. + */ + constructor(name?: string, bindings?: Array); + /** + * The bind group's name. + * + * @type {string} + */ + name: string; + /** + * An array of bindings. + * + * @type {Array} + */ + bindings: Array; + /** + * The group's ID. + * + * @type {number} + */ + id: number; +} +declare class StructType { + constructor(name: any, members: any); + name: any; + members: any; + output: boolean; +} +/** + * Abstract base class for uniforms. + * + * @abstract + * @private + */ +declare class Uniform { + /** + * Constructs a new uniform. + * + * @param {string} name - The uniform's name. + * @param {any} value - The uniform's value. + */ + constructor(name: string, value: any); + /** + * The uniform's name. + * + * @type {string} + */ + name: string; + /** + * The uniform's value. + * + * @type {any} + */ + value: any; + /** + * Used to build the uniform buffer according to the STD140 layout. + * Derived uniforms will set this property to a data type specific + * value. + * + * @type {number} + */ + boundary: number; + /** + * The item size. Derived uniforms will set this property to a data + * type specific value. + * + * @type {number} + */ + itemSize: number; + /** + * This property is set by {@link UniformsGroup} and marks + * the start position in the uniform buffer. + * + * @type {number} + */ + offset: number; + /** + * This property is set by {@link UniformsGroup} and marks + * the index position in the uniform array. + * + * @type {number} + */ + index: number; + /** + * Sets the uniform's value. + * + * @param {any} value - The value to set. + */ + setValue(value: any): void; + /** + * Returns the uniform's value. + * + * @return {any} The value. + */ + getValue(): any; +} +/** + * A render object is the renderer's representation of single entity that gets drawn + * with a draw command. There is no unique mapping of render objects to 3D objects in the + * scene since render objects also depend from the used material, the current render context + * and the current scene's lighting. + * + * In general, the basic process of the renderer is: + * + * - Analyze the 3D objects in the scene and generate render lists containing render items. + * - Process the render lists by calling one or more render commands for each render item. + * - For each render command, request a render object and perform the draw. + * + * The module provides an interface to get data required for the draw command like the actual + * draw parameters or vertex buffers. It also holds a series of caching related methods since + * creating render objects should only be done when necessary. + * + * @private + */ +declare class RenderObject { + /** + * Constructs a new render object. + * + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + * @param {Geometries} geometries - Renderer component for managing geometries. + * @param {Renderer} renderer - The renderer. + * @param {Object3D} object - The 3D object. + * @param {Material} material - The 3D object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {LightsNode} lightsNode - The lights node. + * @param {RenderContext} renderContext - The render context. + * @param {ClippingContext} clippingContext - The clipping context. + */ + constructor(nodes: NodeManager, geometries: Geometries, renderer: Renderer, object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext); + id: number; + /** + * Renderer component for managing nodes related logic. + * + * @type {NodeManager} + * @private + */ + private _nodes; + /** + * Renderer component for managing geometries. + * + * @type {Geometries} + * @private + */ + private _geometries; + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * The 3D object. + * + * @type {Object3D} + */ + object: Object3D; + /** + * The 3D object's material. + * + * @type {Material} + */ + material: Material; + /** + * The scene the 3D object belongs to. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera the 3D object should be rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * The lights node. + * + * @type {LightsNode} + */ + lightsNode: LightsNode; + /** + * The render context. + * + * @type {RenderContext} + */ + context: RenderContext; + /** + * The 3D object's geometry. + * + * @type {BufferGeometry} + */ + geometry: BufferGeometry; + /** + * The render object's version. + * + * @type {number} + */ + version: number; + /** + * The draw range of the geometry. + * + * @type {?Object} + * @default null + */ + drawRange: Object | null; + /** + * An array holding the buffer attributes + * of the render object. This entails attribute + * definitions on geometry and node level. + * + * @type {?Array} + * @default null + */ + attributes: Array | null; + /** + * An object holding the version of the + * attributes. The keys are the attribute names + * and the values are the attribute versions. + * + * @type {?Object} + * @default null + */ + attributesId: { + [x: string]: number; + } | null; + /** + * A reference to a render pipeline the render + * object is processed with. + * + * @type {RenderPipeline} + * @default null + */ + pipeline: RenderPipeline; + /** + * Only relevant for objects using + * multiple materials. This represents a group entry + * from the respective `BufferGeometry`. + * + * @type {?{start: number, count: number}} + * @default null + */ + group: { + start: number; + count: number; + } | null; + /** + * An array holding the vertex buffers which can + * be buffer attributes but also interleaved buffers. + * + * @type {?Array} + * @default null + */ + vertexBuffers: Array | null; + /** + * The parameters for the draw command. + * + * @type {?Object} + * @default null + */ + drawParams: Object | null; + /** + * If this render object is used inside a render bundle, + * this property points to the respective bundle group. + * + * @type {?BundleGroup} + * @default null + */ + bundle: BundleGroup | null; + /** + * The clipping context. + * + * @type {ClippingContext} + */ + clippingContext: ClippingContext; + /** + * The clipping context's cache key. + * + * @type {string} + */ + clippingContextCacheKey: string; + /** + * The initial node cache key. + * + * @type {number} + */ + initialNodesCacheKey: number; + /** + * The initial cache key. + * + * @type {number} + */ + initialCacheKey: number; + /** + * The node builder state. + * + * @type {?NodeBuilderState} + * @private + * @default null + */ + private _nodeBuilderState; + /** + * An array of bindings. + * + * @type {?Array} + * @private + * @default null + */ + private _bindings; + /** + * Reference to the node material observer. + * + * @type {?NodeMaterialObserver} + * @private + * @default null + */ + private _monitor; + /** + * The object's original material when this render object is drawn with an + * override material. + * + * @type {?Material} + * @private + * @default null + */ + private _sourceMaterial; + /** + * An event listener which is defined by `RenderObjects`. It performs + * clean up tasks when `dispose()` on this render object. + * + * @method + */ + onDispose: any; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderObject: boolean; + /** + * An event listener which is executed when `dispose()` is called on + * the material of this render object. + * + * @method + */ + onMaterialDispose: () => void; + /** + * An event listener which is executed when `dispose()` is called on + * the geometry of this render object. + * + * @method + */ + onGeometryDispose: () => void; + /** + * An event listener which is executed when `dispose()` is called on + * the 3D object of this render object. + * + * @method + */ + onObjectDispose: () => void; + /** + * Updates the clipping context. + * + * @param {ClippingContext} context - The clipping context to set. + */ + updateClipping(context: ClippingContext): void; + /** + * Whether the clipping requires an update or not. + * + * @type {boolean} + * @readonly + */ + readonly get clippingNeedsUpdate(): boolean; + /** + * The number of clipping planes defined in context of hardware clipping. + * + * @type {number} + * @readonly + */ + readonly get hardwareClippingPlanes(): number; + /** + * Returns the node builder state of this render object. + * + * @return {NodeBuilderState} The node builder state. + */ + getNodeBuilderState(): NodeBuilderState; + /** + * Returns the node material observer of this render object. + * + * @return {NodeMaterialObserver} The node material observer. + */ + getMonitor(): NodeMaterialObserver; + /** + * Returns an array of bind groups of this render object. + * + * @return {Array} The bindings. + */ + getBindings(): Array; + /** + * Returns a binding group by group name of this render object. + * + * @param {string} name - The name of the binding group. + * @return {?BindGroup} The bindings. + */ + getBindingGroup(name: string): BindGroup | null; + /** + * Returns the index of the render object's geometry. + * + * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. + */ + getIndex(): BufferAttribute | null; + /** + * Returns the indirect buffer attribute. + * + * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. + */ + getIndirect(): BufferAttribute | null; + /** + * Returns the byte offset into the indirect attribute buffer. + * + * @return {number|Array} The byte offset into the indirect attribute buffer. + */ + getIndirectOffset(): number | Array; + /** + * Returns an array that acts as a key for identifying the render object in a chain map. + * + * @return {Array} An array with object references. + */ + getChainArray(): Array; + /** + * This method is used when the geometry of a 3D object has been exchanged and the + * respective render object now requires an update. + * + * @param {BufferGeometry} geometry - The geometry to set. + */ + setGeometry(geometry: BufferGeometry): void; + /** + * Returns the buffer attributes of the render object. The returned array holds + * attribute definitions on geometry and node level. + * + * @return {Array} An array with buffer attributes. + */ + getAttributes(): Array; + /** + * Returns the vertex buffers of the render object. + * + * @return {Array} An array with buffer attribute or interleaved buffers. + */ + getVertexBuffers(): Array; + /** + * Returns the draw parameters for the render object. + * + * @return {?{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} The draw parameters. + */ + getDrawParameters(): { + vertexCount: number; + firstVertex: number; + instanceCount: number; + firstInstance: number; + } | null; + /** + * Returns the render object's geometry cache key. + * + * The geometry cache key is part of the material cache key. + * + * @return {string} The geometry cache key. + */ + getGeometryCacheKey(): string; + /** + * Returns the render object's material cache key. + * + * The material cache key is part of the render object cache key. + * + * @return {number} The material cache key. + */ + getMaterialCacheKey(): number; + /** + * Whether the geometry requires an update or not. + * + * @type {boolean} + * @readonly + */ + readonly get needsGeometryUpdate(): boolean; + /** + * Whether the render object requires an update or not. + * + * Note: There are two distinct places where render objects are checked for an update. + * + * 1. In `RenderObjects.get()` which is executed when the render object is request. This + * method checks the `needsUpdate` flag and recreates the render object if necessary. + * 2. In `Renderer._renderObjectDirect()` right after getting the render object via + * `RenderObjects.get()`. The render object's NodeMaterialObserver is then used to detect + * a need for a refresh due to material, geometry or object related value changes. + * + * TODO: Investigate if it's possible to merge both steps so there is only a single place + * that performs the 'needsUpdate' check. + * + * @type {boolean} + * @readonly + */ + readonly get needsUpdate(): boolean; + /** + * Returns the dynamic cache key which represents a key that is computed per draw command. + * + * @return {number} The cache key. + */ + getDynamicCacheKey(): number; + /** + * Returns the render object's cache key. + * + * @return {number} The cache key. + */ + getCacheKey(): number; + /** + * Frees internal resources. + */ + dispose(): void; +} +/** + * Converts the given array buffer to a Base64 string. + * + * @private + * @method + * @param {ArrayBuffer} arrayBuffer - The array buffer. + * @return {string} The Base64 string. + */ +declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string; +/** + * Converts the given Base64 string to an array buffer. + * + * @private + * @method + * @param {string} base64 - The Base64 string. + * @return {ArrayBuffer} The array buffer. + */ +declare function base64ToArrayBuffer(base64: string): ArrayBuffer; +/** + * Returns the alignment requirement for the given data type in 4-byte elements. + * + * @private + * @method + * @param {string} type - The data type. + * @return {number} The alignment requirement in 4-byte elements. + */ +declare function getAlignmentFromType(type: string): number; +/** + * Gets the object data that can be shared between different rendering steps. + * + * @private + * @param {Object} object - The object to get the data for. + * @return {Object} The object data. + */ +declare function getDataFromObject(object: Object): Object; +/** + * Returns the length for the given data type. + * + * @private + * @method + * @param {string} type - The data type. + * @return {number} The length. + */ +declare function getLengthFromType(type: string): number; +/** + * Returns the gpu memory length for the given data type in 4-byte elements. + * + * @private + * @method + * @param {string} type - The data type. + * @return {number} The memory length in 4-byte elements. + */ +declare function getMemoryLengthFromType(type: string): number; +/** + * Returns the node data type for the given texture. + * + * @private + * @method + * @param {Texture} texture - The texture. + * @return {string} The data type. + */ +declare function getTextureType(texture: Texture): string; +/** + * Returns the data type for the given the length. + * + * @private + * @method + * @param {number} length - The length. + * @return {string} The data type. + */ +declare function getTypeFromLength(length: number): string; +/** + * Returns the typed array for the given data type. + * + * @private + * @method + * @param {string} type - The data type. + * @return {TypedArray} The typed array. + */ +declare function getTypedArrayFromType(type: string): TypedArray; +/** + * Returns the value/object for the given data type and parameters. + * + * @private + * @method + * @param {string} type - The given type. + * @param {...any} params - A parameter list. + * @return {any} The value/object. + */ +declare function getValueFromType(type: string, ...params: any[]): any; +/** + * Returns the data type for the given value. + * + * @private + * @method + * @param {any} value - The value. + * @return {?string} The data type. + */ +declare function getValueType(value: any): string | null; +declare function isArrayAsParameter(params: any): any; +/** + * Holds the actual implementation of the reflector (virtual cameras, render + * targets and the reflection rendering). + * + * This logic is kept separate from {@link ReflectorNode} because the latter is + * a {@link TextureNode} representing a single texture view. A reflector can be + * sampled by multiple texture nodes at once - e.g. one for color and one for + * depth (see {@link ReflectorNode#getDepthNode}) - which all reference the same + * base node so the reflection is rendered only once. + * + * @private + * @augments Node + */ +declare class ReflectorBaseNode extends Node { + /** + * Constructs a new reflector base node. + * + * @param {TextureNode} textureNode - Represents the rendered reflections as a texture node. + * @param {Object} [parameters={}] - An object holding configuration parameters. + * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. + * @param {number} [parameters.resolutionScale=1] - The resolution scale. + * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. + * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. + * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. + * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. + */ + constructor(textureNode: TextureNode, parameters?: { + target?: Object3D | undefined; + resolutionScale?: number | undefined; + generateMipmaps?: boolean | undefined; + bounces?: boolean | undefined; + depth?: boolean | undefined; + samples?: number | undefined; + }); + /** + * Represents the rendered reflections as a texture node. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * The 3D object the reflector is linked to. + * + * @type {Object3D} + * @default {new Object3D()} + */ + target: Object3D; + /** + * The resolution scale. + * + * @type {number} + * @default {1} + */ + resolutionScale: number; + /** + * Whether mipmaps should be generated or not. + * + * @type {boolean} + * @default {false} + */ + generateMipmaps: boolean; + /** + * Whether reflectors can render other reflector nodes or not. + * + * @type {boolean} + * @default {true} + */ + bounces: boolean; + /** + * Whether depth data should be generated or not. + * + * @type {boolean} + * @default {false} + */ + depth: boolean; + /** + * The number of anti-aliasing samples for the render-target + * + * @type {number} + * @default {0} + */ + samples: number; + /** + * Weak map for managing virtual cameras. + * + * @type {WeakMap} + */ + virtualCameras: WeakMap; + /** + * Weak map for managing render targets. + * + * @type {Map} + */ + renderTargets: Map; + /** + * Force render even if reflector is facing away from camera. + * + * @type {boolean} + * @default {false} + */ + forceUpdate: boolean; + /** + * Whether the reflector has been rendered or not. + * + * When the reflector is facing away from the camera, + * this flag is set to `false` and the texture will be empty(black). + * + * @type {boolean} + * @default {false} + */ + hasOutput: boolean; + /** + * Updates the resolution of the internal render target. + * + * @private + * @param {RenderTarget} renderTarget - The render target to resize. + * @param {Renderer} renderer - The renderer that is used to determine the new size. + */ + private _updateResolution; + setup(builder: any): Node | null; + /** + * Returns a virtual camera for the given camera. The virtual camera is used to + * render the scene from the reflector's view so correct reflections can be produced. + * + * @param {Camera} camera - The scene's camera. + * @return {Camera} The corresponding virtual camera. + */ + getVirtualCamera(camera: Camera): Camera; + /** + * Returns a render target for the given camera. The reflections are rendered + * into this render target. + * + * @param {Camera} camera - The scene's camera. + * @return {RenderTarget} The render target. + */ + getRenderTarget(camera: Camera): RenderTarget; + updateBefore(frame: any): false | undefined; + set resolution(value: number); + /** + * The resolution scale. + * + * @deprecated + * @type {number} + * @default {1} + */ + get resolution(): number; +} +/** + * This renderer module provides a series of statistical information + * about the GPU memory and the rendering process. Useful for debugging + * and monitoring. + */ +declare class Info { + /** + * Whether frame related metrics should automatically + * be resetted or not. This property should be set to `false` + * by apps which manage their own animation loop. They must + * then call `renderer.info.reset()` once per frame manually. + * + * @type {boolean} + * @default true + */ + autoReset: boolean; + /** + * The current frame ID. This ID is managed + * by `NodeFrame`. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly frame: number; + /** + * The number of render calls since the + * app has been started. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly calls: number; + /** + * Render related metrics. + * + * @type {Object} + * @readonly + * @property {number} calls - The number of render calls since the app has been started. + * @property {number} frameCalls - The number of render calls of the current frame. + * @property {number} drawCalls - The number of draw calls of the current frame. + * @property {number} triangles - The number of rendered triangle primitives of the current frame. + * @property {number} points - The number of rendered point primitives of the current frame. + * @property {number} lines - The number of rendered line primitives of the current frame. + * @property {number} timestamp - The timestamp of the frame. + */ + readonly render: Object; + /** + * Compute related metrics. + * + * @type {Object} + * @readonly + * @property {number} calls - The number of compute calls since the app has been started. + * @property {number} frameCalls - The number of compute calls of the current frame. + * @property {number} timestamp - The timestamp of the frame when using `renderer.computeAsync()`. + */ + readonly compute: Object; + /** + * Memory related metrics. + * + * @type {Object} + * @readonly + * @property {number} attributes - The number of active attributes. + * @property {number} attributesSize - The memory size of active attributes in bytes. + * @property {number} geometries - The number of active geometries. + * @property {number} indexAttributes - The number of active index attributes. + * @property {number} indexAttributesSize - The memory size of active index attributes in bytes. + * @property {number} indirectStorageAttributes - The number of active indirect storage attributes. + * @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes. + * @property {number} programs - The number of active programs. + * @property {number} programsSize - The memory size of active programs in bytes. + * @property {number} readbackBuffers - The number of active readback buffers. + * @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes. + * @property {number} renderTargets - The number of active renderTargets. + * @property {number} storageAttributes - The number of active storage attributes. + * @property {number} storageAttributesSize - The memory size of active storage attributes in bytes. + * @property {number} textures - The number of active textures. + * @property {number} texturesSize - The memory size of active textures in bytes. + * @property {number} uniformBuffers - The number of active uniform buffers. + * @property {number} uniformBuffersSize - The memory size of active uniform buffers in bytes. + * @property {number} total - The total memory size in bytes. + */ + readonly memory: Object; + /** + * Map for storing calculated byte sizes of tracked objects. + * + * @type {WeakMap} + * @private + */ + private memoryMap; + /** + * This method should be executed per draw call and updates the corresponding metrics. + * + * @param {Object3D} object - The 3D object that is going to be rendered. + * @param {number} count - The vertex or index count. + * @param {number} instanceCount - The instance count. + */ + update(object: Object3D, count: number, instanceCount: number): void; + /** + * Resets frame related metrics. + */ + reset(): void; + /** + * Performs a complete reset of the object. + */ + dispose(): void; + /** + * Tracks texture memory explicitly, updating counts and byte tracking. + * + * @param {Texture} texture + */ + createTexture(texture: Texture): void; + /** + * Tracks texture memory explicitly, updating counts and byte tracking. + * + * @param {Texture} texture + */ + destroyTexture(texture: Texture): void; + /** + * Tracks attribute memory explicitly, updating counts and byte tracking. + * + * @param {BufferAttribute} attribute + * @param {string} type - type of attribute + * @private + */ + private _createAttribute; + /** + * Tracks a regular attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The attribute to track. + */ + createAttribute(attribute: BufferAttribute): void; + /** + * Tracks an index attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The index attribute to track. + */ + createIndexAttribute(attribute: BufferAttribute): void; + /** + * Tracks a storage attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The storage attribute to track. + */ + createStorageAttribute(attribute: BufferAttribute): void; + /** + * Tracks an indirect storage attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The indirect storage attribute to track. + */ + createIndirectStorageAttribute(attribute: BufferAttribute): void; + /** + * Tracks attribute memory explicitly, updating counts and byte tracking. + * + * @param {BufferAttribute} attribute + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * Tracks a readback buffer memory explicitly. + * + * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. + */ + createReadbackBuffer(readbackBuffer: ReadbackBuffer): void; + /** + * Tracks a readback buffer memory explicitly. + * + * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. + */ + destroyReadbackBuffer(readbackBuffer: ReadbackBuffer): void; + /** + * Tracks a uniform buffer memory explicitly. + * + * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. + */ + createUniformBuffer(uniformBuffer: UniformBuffer): void; + /** + * Tracks a uniform buffer memory explicitly. + * + * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. + */ + destroyUniformBuffer(uniformBuffer: UniformBuffer): void; + /** + * Tracks program memory explicitly, updating counts and byte tracking. + * + * @param {ProgrammableStage} program - The program to track. + */ + createProgram(program: ProgrammableStage): void; + /** + * Tracks program memory explicitly, updating counts and byte tracking. + * + * @param {Object} program - The program to track. + */ + destroyProgram(program: Object): void; + /** + * Calculates the memory size of a texture in bytes. + * + * @param {Texture} texture - The texture to calculate the size for. + * @return {number} The calculated size in bytes. + * @private + */ + private _getTextureMemorySize; + /** + * Calculates the memory size of an attribute in bytes. + * + * @param {BufferAttribute} attribute - The attribute to calculate the size for. + * @return {number} The calculated size in bytes. + * @private + */ + private _getAttributeMemorySize; +} +/** + * The XR manager is built on top of the WebXR Device API to + * manage XR sessions with renderer backends. + * + * @augments EventDispatcher + */ +declare class XRManager extends EventDispatcher { + /** + * Constructs a new XR manager. + * + * @param {Renderer} renderer - The renderer. + * @param {boolean} [multiview=false] - Enables multiview if the device supports it. + */ + constructor(renderer: Renderer, multiview?: boolean); + /** + * This flag globally enables XR rendering. + * + * @type {boolean} + * @default false + */ + enabled: boolean; + /** + * Whether the XR device is currently presenting or not. + * + * @type {boolean} + * @default false + * @readonly + */ + readonly isPresenting: boolean; + /** + * Whether the XR camera should automatically be updated or not. + * + * @type {boolean} + * @default true + */ + cameraAutoUpdate: boolean; + /** + * The renderer. + * + * @private + * @type {Renderer} + */ + private _renderer; + /** + * Represents the camera for the left eye. + * + * @private + * @type {PerspectiveCamera} + */ + private _cameraL; + /** + * Represents the camera for the right eye. + * + * @private + * @type {PerspectiveCamera} + */ + private _cameraR; + /** + * A list of cameras used for rendering the XR views. + * + * @private + * @type {Array} + */ + private _cameras; + /** + * The main XR camera. + * + * @private + * @type {ArrayCamera} + */ + private _cameraXR; + /** + * The current near value of the XR camera. + * + * @private + * @type {?number} + * @default null + */ + private _currentDepthNear; + /** + * The current far value of the XR camera. + * + * @private + * @type {?number} + * @default null + */ + private _currentDepthFar; + /** + * A list of WebXR controllers requested by the application. + * + * @private + * @type {Array} + */ + private _controllers; + /** + * A list of XR input source. Each input source belongs to + * an instance of WebXRController. + * + * @private + * @type {Array} + */ + private _controllerInputSources; + /** + * The XR render target that represents the rendering destination + * during an active XR session. + * + * @private + * @type {?RenderTarget} + * @default null + */ + private _xrRenderTarget; + /** + * An array holding all the non-projection layers + * + * @private + * @type {Array} + * @default [] + */ + private _layers; + /** + * Whether the XR session uses layers. + * + * @private + * @type {boolean} + * @default false + */ + private _sessionUsesLayers; + /** + * Whether the device supports binding gl objects. + * + * @private + * @type {boolean} + * @readonly + */ + private readonly _supportsGlBinding; + _supportsWebGPUBinding: boolean; + /** + * Helper function to create native WebXR Layer. + * + * @private + * @type {Function} + */ + private _createXRLayer; + /** + * The current WebGL context. + * + * @private + * @type {?WebGL2RenderingContext} + * @default null + */ + private _gl; + /** + * The current animation context. + * + * @private + * @type {?Window} + * @default null + */ + private _currentAnimationContext; + /** + * The current animation loop. + * + * @private + * @type {?Function} + * @default null + */ + private _currentAnimationLoop; + /** + * The current pixel ratio. + * + * @private + * @type {?number} + * @default null + */ + private _currentPixelRatio; + /** + * The current size of the renderer's canvas + * in logical pixel unit. + * + * @private + * @type {Vector2} + */ + private _currentSize; + /** + * Holds a reference to the user camera and its current settings. + * + * @private + * @type {?Object} + * @default null + */ + private _currentCameraSettings; + /** + * The default event listener for handling events inside a XR session. + * + * @private + * @type {Function} + */ + private _onSessionEvent; + /** + * The event listener for handling the end of a XR session. + * + * @private + * @type {Function} + */ + private _onSessionEnd; + /** + * The event listener for handling the `inputsourceschange` event. + * + * @private + * @type {Function} + */ + private _onInputSourcesChange; + /** + * The animation loop which is used as a replacement for the default + * animation loop of the application. It is only used when a XR session + * is active. + * + * @private + * @type {Function} + */ + private _onAnimationFrame; + /** + * The current XR reference space. + * + * @private + * @type {?XRReferenceSpace} + * @default null + */ + private _referenceSpace; + /** + * The current XR reference space type. + * + * @private + * @type {XRReferenceSpaceType} + * @default 'local-floor' + */ + private _referenceSpaceType; + /** + * A custom reference space defined by the application. + * + * @private + * @type {?XRReferenceSpace} + * @default null + */ + private _customReferenceSpace; + /** + * The framebuffer scale factor. + * + * @private + * @type {number} + * @default 1 + */ + private _framebufferScaleFactor; + /** + * The foveation factor. + * + * @private + * @type {number} + * @default 1 + */ + private _foveation; + /** + * A reference to the current XR session. + * + * @private + * @type {?XRSession} + * @default null + */ + private _session; + /** + * A reference to the current XR base layer. + * + * @private + * @type {?XRWebGLLayer} + * @default null + */ + private _glBaseLayer; + /** + * A reference to the current XR binding. + * + * @private + * @type {?XRWebGLBinding} + * @default null + */ + private _glBinding; + /** + * A reference to the current XR WebGPU binding. + * + * @private + * @type {?XRGPUBinding} + * @default null + */ + private _webgpuBinding; + /** + * A reference to the current XR projection layer. + * + * @private + * @type {?XRProjectionLayer} + * @default null + */ + private _glProjLayer; + /** + * A reference to the current XR frame. + * + * @private + * @type {?XRFrame} + * @default null + */ + private _xrFrame; + /** + * Whether the browser supports the APIs necessary to use XRProjectionLayers. + * + * Note: this does not represent XRSession explicitly requesting + * `'layers'` as a feature - see `_sessionUsesLayers` and #30112 + * + * @private + * @type {boolean} + * @readonly + */ + private readonly _supportsLayers; + /** + * Whether the usage of multiview has been requested by the application or not. + * + * @private + * @type {boolean} + * @default false + * @readonly + */ + private readonly _useMultiviewIfPossible; + /** + * Whether the usage of multiview is actually enabled. This flag only evaluates to `true` + * if multiview has been requested by the application and the `OVR_multiview2` is available. + * + * @private + * @type {boolean} + * @readonly + */ + private readonly _useMultiview; + /** + * Returns an instance of `THREE.Group` that represents the transformation + * of a XR controller in target ray space. The requested controller is defined + * by the given index. + * + * @param {number} index - The index of the XR controller. + * @return {Group} A group that represents the controller's transformation. + */ + getController(index: number): Group; + /** + * Returns an instance of `THREE.Group` that represents the transformation + * of a XR controller in grip space. The requested controller is defined + * by the given index. + * + * @param {number} index - The index of the XR controller. + * @return {Group} A group that represents the controller's transformation. + */ + getControllerGrip(index: number): Group; + /** + * Returns an instance of `THREE.Group` that represents the transformation + * of a XR controller in hand space. The requested controller is defined + * by the given index. + * + * @param {number} index - The index of the XR controller. + * @return {Group} A group that represents the controller's transformation. + */ + getHand(index: number): Group; + /** + * Returns the foveation value. + * + * @return {number|undefined} The foveation value. + */ + getFoveation(): number | undefined; + /** + * Sets the foveation value. + * + * @param {number} foveation - A number in the range `[0,1]` where `0` means no foveation (full resolution) + * and `1` means maximum foveation (the edges render at lower resolution). + */ + setFoveation(foveation: number): void; + /** + * Returns the framebuffer scale factor. + * + * @return {number} The framebuffer scale factor. + */ + getFramebufferScaleFactor(): number; + /** + * Sets the framebuffer scale factor. + * + * This method can not be used during a XR session. + * + * @param {number} factor - The framebuffer scale factor. + */ + setFramebufferScaleFactor(factor: number): void; + /** + * Returns the reference space type. + * + * @return {XRReferenceSpaceType} The reference space type. + */ + getReferenceSpaceType(): XRReferenceSpaceType; + /** + * Sets the reference space type. + * + * This method can not be used during a XR session. + * + * @param {XRReferenceSpaceType} type - The reference space type. + */ + setReferenceSpaceType(type: XRReferenceSpaceType): void; + /** + * Returns the XR reference space. + * + * @return {XRReferenceSpace} The XR reference space. + */ + getReferenceSpace(): XRReferenceSpace; + /** + * Sets a custom XR reference space. + * + * @param {XRReferenceSpace} space - The XR reference space. + */ + setReferenceSpace(space: XRReferenceSpace): void; + /** + * Returns the XR camera. + * + * @return {ArrayCamera} The XR camera. + */ + getCamera(): ArrayCamera; + /** + * Returns the environment blend mode from the current XR session. + * + * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. + */ + getEnvironmentBlendMode(): "opaque" | "additive" | "alpha-blend" | undefined; + /** + * Returns the current base layer. + * + * This is an `XRProjectionLayer` when the targeted XR device supports the + * WebXR Layers API, or an `XRWebGLLayer` otherwise. + * + * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. + */ + getBaseLayer(): (XRWebGLLayer | XRProjectionLayer) | null; + /** + * Returns the current XR binding. + * + * Creates a new binding if needed and the browser is + * capable of doing so. + * + * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. + */ + getBinding(): XRWebGLBinding | null; + /** + * Applies WebXR fixed foveation to the internal post-processing render target + * used by the first XR render pass before compositing into a projection layer. + * + * Browser-side `XRWebGLBinding.foveateBoundTexture()` failures are treated as + * non-fatal so they do not interrupt rendering. + * + * @param {?RenderTarget} renderTarget - The internal render target. + */ + foveateBoundTexture(renderTarget: RenderTarget | null): void; + /** + * Returns the current XR WebGPU binding. + * + * Creates a new binding if needed and the browser is + * capable of doing so. + * + * @return {?XRGPUBinding} The XR WebGPU binding. Returns `null` if one cannot be created. + */ + getWebGPUBinding(): XRGPUBinding | null; + /** + * Returns whether the current XR session is using WebGPU. + * + * @private + * @return {boolean} Whether the current session uses the WebGPU backend and the `webgpu` session feature. + */ + private _isWebGPUSession; + /** + * Validates the current WebGPU XR session requirements. + * + * @private + */ + private _validateWebGPUSession; + /** + * Initializes the WebGPU XR projection layer and render target. + * + * @private + * @async + * @param {XRSession} session - The XR session. + * @return {Promise} + */ + private _initWebGPUSession; + /** + * Releases WebGPU XR resources associated with the current session. + * + * @private + */ + private _disposeWebGPUSession; + /** + * Collects WebGPU XR sub-image data for the current frame. + * + * @private + * @param {Array} views - The XR views for the current pose. + * @return {{colorTexture:?GPUTexture, viewDescriptors:Array, viewports:Array}} The WebGPU XR view data. + */ + private _getWebGPUViewData; + /** + * Returns the current XR frame. + * + * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. + */ + getFrame(): XRFrame | null; + /** + * Returns `true` if the engine renders to a multiview target. + * + * @return {boolean} Whether the engine renders to a multiview render target or not. + */ + useMultiview(): boolean; + /** + * This method can be used in XR applications to create a quadratic layer that presents a separate + * rendered scene. + * + * @param {number} width - The width of the layer plane in world units. + * @param {number} height - The height of the layer plane in world units. + * @param {Vector3} translation - The position/translation of the layer plane in world units. + * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. + * @param {number} pixelwidth - The width of the layer's render target in pixels. + * @param {number} pixelheight - The height of the layer's render target in pixels. + * @param {Function} rendercall - A callback function that renders the layer. Similar to code in + * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. + * @param {Object} [attributes={}] - Allows to configure the layer's render target. + * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. + * @return {Mesh} A mesh representing the quadratic XR layer. This mesh should be added to the XR scene. + */ + createQuadLayer(width: number, height: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { + samples?: number | undefined; + }): Mesh; + /** + * This method can be used in XR applications to create a cylindrical layer that presents a separate + * rendered scene. + * + * @param {number} radius - The radius of the cylinder in world units. + * @param {number} centralAngle - The central angle of the cylinder in radians. + * @param {number} aspectratio - The aspect ratio. + * @param {Vector3} translation - The position/translation of the layer plane in world units. + * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. + * @param {number} pixelwidth - The width of the layer's render target in pixels. + * @param {number} pixelheight - The height of the layer's render target in pixels. + * @param {Function} rendercall - A callback function that renders the layer. Similar to code in + * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. + * @param {Object} [attributes={}] - Allows to configure the layer's render target. + * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. + * @return {Mesh} A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene. + */ + createCylinderLayer(radius: number, centralAngle: number, aspectratio: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { + samples?: number | undefined; + }): Mesh; + /** + * Renders the XR layers that have been previously added to the scene. + * + * This method is usually called in your animation loop before rendering + * the actual scene via `renderer.render( scene, camera );`. + */ + renderLayers(): void; + /** + * Returns the current XR session. + * + * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. + */ + getSession(): XRSession | null; + /** + * After a XR session has been requested usually with one of the `*Button` modules, it + * is injected into the renderer with this method. This method triggers the start of + * the actual XR rendering. + * + * @async + * @param {XRSession} session - The XR session to set. + * @return {Promise} A Promise that resolves when the session has been set. + */ + setSession(session: XRSession): Promise; + /** + * This method is called by the renderer per frame and updates the XR camera + * and it sub cameras based on the given camera. The given camera is the "user" + * camera created on application level and used for non-XR rendering. + * + * @param {PerspectiveCamera} camera - The camera. + */ + updateCamera(camera: PerspectiveCamera): void; + /** + * Returns a WebXR controller for the given controller index. + * + * @private + * @param {number} index - The controller index. + * @return {WebXRController} The XR controller. + */ + private _getController; +} +/** + * Saves the state of the given renderer and scene and stores it into the given state object. + * Besides, the function also resets the state of the renderer and scene to its default values. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +declare function resetRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; +/** + * Saves the state of the given renderer and stores it into the given state object. + * Besides, the function also resets the state of the renderer to its default values. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +declare function resetRendererState(renderer: Renderer, state?: Object): Object; +/** + * Saves the state of the given scene and stores it into the given state object. + * Besides, the function also resets the state of the scene to its default values. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +declare function resetSceneState(scene: Scene, state?: Object): Object; +/** + * Restores the state of the given renderer and scene from the given state object. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Scene} scene - The scene. + * @param {Object} state - The state to restore. + */ +declare function restoreRendererAndSceneState(renderer: Renderer, scene: Scene, state: Object): void; +/** + * Restores the state of the given renderer from the given state object. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Object} state - The state to restore. + */ +declare function restoreRendererState(renderer: Renderer, state: Object): void; +/** + * Restores the state of the given scene from the given state object. + * + * @private + * @function + * @param {Scene} scene - The scene. + * @param {Object} state - The state to restore. + */ +declare function restoreSceneState(scene: Scene, state: Object): void; +/** + * Saves the state of the given renderer and scene and stores it into the given state object. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +declare function saveRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; +/** + * Saves the state of the given renderer and stores it into the given state object. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +declare function saveRendererState(renderer: Renderer, state?: Object): Object; +/** + * Saves the state of the given scene and stores it into the given state object. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +declare function saveSceneState(scene: Scene, state?: Object): Object; +declare class ShaderCallNodeInternal extends Node { + constructor(shaderNode: any, rawInputs: any); + shaderNode: any; + rawInputs: any; + isShaderCallNodeInternal: boolean; + generateNodeType(builder: any): any; + getElementType(builder: any): any; + getMemberType(builder: any, name: any): any; + call(builder: any): any; + setupOutput(builder: any): any; + getOutputNode(builder: any): any; + build(builder: any, output?: null): any; +} +/** + * Represents lighting model for a shadow material. Used in {@link ShadowNodeMaterial}. + * + * @augments LightingModel + */ +declare class ShadowMaskModel extends LightingModel { + /** + * The shadow mask node. + * + * @type {Node} + */ + shadowNode: Node; + /** + * Only used to save the shadow mask. + * + * @param {Object} input - The input data. + */ + direct({ lightNode }: Object): void; + /** + * Uses the shadow mask to produce the final color. + * + * @param {NodeBuilder} builder - The current node builder. + */ + finish({ context }: NodeBuilder): void; +} +declare function Fn(jsFunc: any, layout?: null): () => void; +declare function ShaderNode(jsFunc: any, nodeType: any): ShaderNodeInternal; +/** + * Add the given node to the current stack. + * + * @param {Node} node - The node to add. + * @returns {Node} The node that was added to the stack. + */ +declare function Stack(node: Node): Node; +declare function addMethodChaining(name: any, nodeElement: any): void; +declare function addNodeElement(name: any): void; +/** + * TSL function for defining a built-in ambient occlusion context for a given node. + * + * @tsl + * @function + * @param {Node} aoNode - The ambient occlusion value node to apply. + * @param {Node} [node=null] - The node whose context should be modified. + * @returns {ContextNode} + */ +declare function builtinAOContext(aoNode: Node, node?: Node): ContextNode; +/** + * TSL function for defining a built-in shadow context for a given node. + * + * @tsl + * @function + * @param {ShadowNode} shadowNode - The shadow node representing the light's shadow. + * @param {Light} light - The light associated with the shadow. + * @param {Node} [node=null] - The node whose context should be modified. + * @returns {ContextNode} + */ +declare function builtinShadowContext(shadowNode: ShadowNode, light: Light, node?: Node): ContextNode; +/** + * TSL function for creating a cache node. + * + * @tsl + * @function + * @deprecated + * @param {Node} node - The node that should be cached. + * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. + * @returns {IsolateNode} + */ +declare function cache(node: Node, parent?: boolean): IsolateNode; +declare function defined(value: any): boolean; +/** + * Returns the MRT texture index for the given name. + * + * @param {Array} textures - The textures of a MRT-configured render target. + * @param {string} name - The name of the MRT texture which index is requested. + * @return {number} The texture index. + */ +declare function getTextureIndex(textures: Array, name: string): number; +/** + * Creates an inspector node to wrap around a given node for inspection purposes. + * + * @tsl + * @param {Node} node - The node to inspect. + * @param {string} [name=''] - Optional name for the inspector node. + * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. + * @returns {Node} The inspector node. + */ +declare function inspector(node: Node, name?: string, callback?: Function | null): Node; +/** + * TSL function for defining a label context value for a given node. + * + * @tsl + * @function + * @deprecated + * @param {Node} node - The node whose context should be modified. + * @param {string} name - The name/label to set. + * @returns {ContextNode} + */ +declare function label(node: Node, name: string): ContextNode; +/** + * TSL function for getting the position in world space for the given light. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @returns {UniformNode} The light's position in world space. + */ +declare function lightPosition(light: Light): UniformNode; +/** + * TSL function for getting projected uv coordinates for the given light. + * Relevant when using maps with spot lights. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @param {Node} [position=positionWorld] -The position to project. + * @returns {Node} The projected uvs. + */ +declare function lightProjectionUV(light: Light, position?: Node): Node; +/** + * TSL function for getting a shadow matrix uniform node for the given light. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @returns {UniformNode} The shadow matrix uniform node. + */ +declare function lightShadowMatrix(light: Light): UniformNode; +/** + * TSL function for getting the light target position in world space for the given light. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @returns {UniformNode} The light target position in world space. + */ +declare function lightTargetPosition(light: Light): UniformNode; +/** + * TSL function for getting the position in view space for the given light. + * + * @tsl + * @function + * @param {Light} light - The light source. + * @returns {UniformNode} The light's position in view space. + */ +declare function lightViewPosition(light: Light): UniformNode; +/** + * TSL function for creating an `OverrideContextNode` to override a single target node. + * + * ```js + * material.contextNode = overrideNode( positionLocal, ( builder ) => positionLocal.add( vec3( 1, 0, 0 ) ) ); + * ``` + * + * @tsl + * @function + * @param {Node} targetNode - The target node that should be overridden. + * @param {Function|Node|null} [callback=null] - A callback function returning the overriding node (which receives the builder as its argument), or the overriding node itself. + * @param {Node|null} [flowNode=null] - The node whose context should be modified. + * @return {OverrideContextNode} The created override context node. + */ +declare function overrideNode(targetNode: Node, callback?: Function | Node | null, flowNode?: Node | null): OverrideContextNode; +/** + * TSL function for creating an `OverrideContextNode` to override multiple target nodes. + * + * ```js + * material.contextNode = overrideNodes( [ + * [ positionView, customPositionView ], + * [ positionViewDirection, ( builder ) => customPositionViewDirection ] + * ] ); + * ``` + * + * @tsl + * @function + * @param {Map|Array>} overrides - The overrides mapping target nodes to callback functions or overriding nodes. + * @param {Node|null} [flowNode=null] - The node whose context should be modified. + * @return {OverrideContextNode} The created override context node. + */ +declare function overrideNodes(overrides: Map | Array>, flowNode?: Node | null): OverrideContextNode; +/** + * Represents the texture of a pass node. + * + * @augments TextureNode + */ +declare class PassTextureNode extends TextureNode { + /** + * Constructs a new pass texture node. + * + * @param {PassNode} passNode - The pass node. + * @param {Texture} texture - The output texture. + */ + constructor(passNode: PassNode, texture: Texture); + /** + * A reference to the pass node. + * + * @type {PassNode} + */ + passNode: PassNode; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @default true + * @readonly + */ + readonly isPassTextureNode: boolean; + setup(builder: any): void; + clone(): any; +} +/** + * This node allows to remap a node value from one range into another but with enabled clamping. E.g a value of + * `0.4` in the range `[ 0.3, 0.5 ]` should be remapped into the normalized range `[ 0, 1 ]`. + * `remapClamp` takes care of that and converts the original value of `0.4` to `0.5`. + * + * @tsl + * @function + * @param {Node} node - The node that should be remapped. + * @param {Node} inLowNode - The source or current lower bound of the range. + * @param {Node} inHighNode - The source or current upper bound of the range. + * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. + * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. + * @returns {Node} + */ +declare function remapClamp(node: Node, inLowNode: Node, inHighNode: Node, outLowNode?: Node | null, outHighNode?: Node | null): Node; +/** + * Replaces the default UV coordinates used in texture lookups. + * + * ```js + *material.contextNode = replaceDefaultUV( ( textureNode ) => { + * + * // ... + * return customUVCoordinates; + * + *} ); + *``` + * + * @tsl + * @function + * @param {function(Node):Node|Node} callback - A callback that receives the texture node + * and must return the new uv coordinates. + * @param {Node} [node=null] - An optional node to which the context will be applied. + * @return {ContextNode} A context node that replaces the default UV coordinates. + */ +declare function replaceDefaultUV(callback: (arg0: Node) => Node | Node, node?: Node): ContextNode; +/** + * Represents the element access on uniform array nodes. + * + * @augments ArrayElementNode + */ +declare class UniformArrayElementNode extends ArrayElementNode { + /** + * Constructs a new buffer node. + * + * @param {UniformArrayNode} uniformArrayNode - The uniform array node to access. + * @param {IndexNode} indexNode - The index data that define the position of the accessed element in the array. + */ + constructor(uniformArrayNode: UniformArrayNode, indexNode: IndexNode); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayBufferElementNode: boolean; + generate(builder: any): any; +} +/** + * VolumetricLightingModel class extends the LightingModel to implement volumetric lighting effects. + * This model calculates the scattering and transmittance of light through a volumetric medium. + * It dynamically adjusts the direction of the ray based on the camera and object positions. + * The model supports custom scattering and depth nodes to enhance the lighting effects. + * + * @augments LightingModel + */ +declare class VolumetricLightingModel extends LightingModel { + start(builder: any): void; + scatteringLight(lightColor: any, builder: any): void; + direct({ lightNode, lightColor }: { + lightNode: any; + lightColor: any; + }, builder: any): void; + directRectArea({ lightColor, lightPosition, halfWidth, halfHeight }: { + lightColor: any; + lightPosition: any; + halfWidth: any; + halfHeight: any; + }, builder: any): void; + finish(builder: any): void; +} +/** + * A WebGL 2 backend utility module for managing shader attributes. + * + * @private + */ +declare class WebGLAttributeUtils { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * Creates the GPU buffer for the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. + */ + createAttribute(attribute: BufferAttribute, bufferType: GLenum): void; + /** + * Updates the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * Destroys the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @param {number} offset - The storage buffer attribute. + * @param {number} count - The offset from which to start reading the + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Creates a WebGL buffer with the given data. + * + * @private + * @param {WebGL2RenderingContext} gl - The rendering context. + * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. + * @param {TypedArray} array - The array of the buffer attribute. + * @param {GLenum} usage - The usage. + * @return {WebGLBuffer} The WebGL buffer. + */ + private _createBuffer; +} +/** + * A WebGL 2 backend utility module for managing extensions. + * + * @private + */ +declare class WebGLExtensions { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + /** + * A list with all the supported WebGL extensions. + * + * @type {Array} + */ + availableExtensions: Array; + /** + * A dictionary with requested WebGL extensions. + * The key is the name of the extension, the value + * the requested extension object. + * + * @type {Object} + */ + extensions: { + [x: string]: Object; + }; + /** + * Returns the extension object for the given extension name. + * + * @param {string} name - The extension name. + * @return {Object} The extension object. + */ + get(name: string): Object; + /** + * Returns `true` if the requested extension is available. + * + * @param {string} name - The extension name. + * @return {boolean} Whether the given extension is available or not. + */ + has(name: string): boolean; +} +/** + * A WebGL 2 backend utility module for managing textures. + * + * @private + */ +declare class WebGLTextureUtils { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + /** + * A reference to a backend module holding extension-related + * utility functions. + * + * @type {WebGLExtensions} + */ + extensions: WebGLExtensions; + /** + * A dictionary for managing default textures. The key + * is the binding point (target), the value the WEbGL texture object. + * + * @type {Object} + */ + defaultTextures: any; + /** + * A scratch framebuffer used for attaching the source texture in + * {@link copyTextureToTexture}. + * + * @private + * @type {?WebGLFramebuffer} + */ + private _srcFramebuffer; + /** + * A scratch framebuffer used for attaching the destination texture in + * {@link copyTextureToTexture}. + * + * @private + * @type {?WebGLFramebuffer} + */ + private _dstFramebuffer; + /** + * Inits the state of the utility. + * + * @private + */ + private _init; + /** + * Returns the native texture type for the given texture. + * + * @param {Texture} texture - The texture. + * @return {GLenum} The native texture type. + */ + getGLTextureType(texture: Texture): GLenum; + /** + * Returns the native texture type for the given texture. + * + * @param {?string} internalFormatName - The internal format name. When `null`, the internal format is derived from the subsequent parameters. + * @param {GLenum} glFormat - The WebGL format. + * @param {GLenum} glType - The WebGL type. + * @param {string} colorSpace - The texture's color space. + * @param {boolean} [forceLinearTransfer=false] - Whether to force a linear transfer or not. + * @return {GLenum} The internal format. + */ + getInternalFormat(internalFormatName: string | null, glFormat: GLenum, glType: GLenum, normalized: any, colorSpace: string, forceLinearTransfer?: boolean): GLenum; + /** + * Sets the texture parameters for the given texture. + * + * @param {GLenum} textureType - The texture type. + * @param {Texture} texture - The texture. + */ + setTextureParameters(textureType: GLenum, texture: Texture): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(texture: Texture): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + * @return {undefined} + */ + createTexture(texture: Texture, options?: Object): undefined; + /** + * Uploads texture buffer data to the GPU memory. + * + * @param {WebGLBuffer} buffer - The buffer data. + * @param {Texture} texture - The texture, + */ + copyBufferToTexture(buffer: WebGLBuffer, texture: Texture): void; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + */ + generateMipmaps(texture: Texture): void; + /** + * Deallocates the render buffers of the given render target. + * + * @param {RenderTarget} renderTarget - The render target. + */ + deallocateRenderBuffers(renderTarget: RenderTarget): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Copies data of the given source texture to the given destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; + /** + * SetupS storage for internal depth/stencil buffers and bind to correct framebuffer. + * + * @param {WebGLRenderbuffer} renderbuffer - The render buffer. + * @param {RenderContext} renderContext - The render context. + * @param {number} samples - The MSAA sample count. + * @param {boolean} [useMultisampledRTT=false] - Whether to use WEBGL_multisampled_render_to_texture or not. + */ + setupRenderBufferStorage(renderbuffer: WebGLRenderbuffer, renderContext: RenderContext, samples: number, useMultisampledRTT?: boolean): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Returns the corresponding typed array type for the given WebGL data type. + * + * @private + * @param {GLenum} glType - The WebGL data type. + * @return {TypedArray.constructor} The typed array type. + */ + private _getTypedArrayType; + /** + * Returns the bytes-per-texel value for the given WebGL data type and texture format. + * + * @private + * @param {GLenum} glType - The WebGL data type. + * @param {GLenum} glFormat - The WebGL texture format. + * @return {number} The bytes-per-texel. + */ + private _getBytesPerTexel; + /** + * Frees the internal resources. + */ + dispose(): void; +} +declare class WebGLBufferRenderer { + constructor(backend: any); + gl: any; + extensions: any; + info: any; + mode: any; + index: number; + type: any; + object: any; + render(start: any, count: any): void; + renderInstances(start: any, count: any, primcount: any): void; + renderMultiDraw(starts: any, counts: any, drawCount: any): void; +} +/** + * A WebGL 2 backend utility module for managing the WebGL state. + * + * The major goal of this module is to reduce the number of state changes + * by caching the WEbGL state with a series of variables. In this way, the + * renderer only executes state change commands when necessary which + * improves the overall performance. + * + * @private + */ +declare class WebGLState { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + enabled: {}; + parameters: {}; + currentFlipSided: any; + currentCullFace: any; + currentProgram: any; + currentBlendingEnabled: boolean; + currentBlending: any; + currentBlendEquation: any; + currentBlendEquationAlpha: number | null; + currentBlendSrc: any; + currentBlendDst: number | null; + currentBlendSrcAlpha: number | null; + currentBlendDstAlpha: number | null; + currentBlendColor: Color; + currentBlendAlpha: number; + currentPremultipledAlpha: boolean | null; + currentPolygonOffsetFactor: any; + currentPolygonOffsetUnits: number | null; + currentColorMask: any; + currentDepthReversed: boolean; + currentDepthFunc: any; + currentDepthMask: any; + currentStencilFunc: any; + currentStencilRef: number | null; + currentStencilFuncMask: number | null; + currentStencilFail: any; + currentStencilZFail: number | null; + currentStencilZPass: number | null; + currentStencilMask: any; + currentLineWidth: any; + currentClippingPlanes: number; + currentVAO: any; + currentIndex: WebGLBuffer | null; + currentBoundFramebuffers: {}; + currentDrawbuffers: WeakMap; + maxTextures: any; + currentTextureSlot: any; + currentBoundTextures: {}; + currentBoundBufferBases: {}; + /** + * Inits the state of the utility. + * + * @private + */ + private _init; + currentScissor: Vector4 | undefined; + currentViewport: Vector4 | undefined; + _tempVec4: Vector4 | undefined; + /** + * Enables the given WebGL capability. + * + * This method caches the capability state so + * `gl.enable()` is only called when necessary. + * + * @param {GLenum} id - The capability to enable. + */ + enable(id: GLenum): void; + /** + * Disables the given WebGL capability. + * + * This method caches the capability state so + * `gl.disable()` is only called when necessary. + * + * @param {GLenum} id - The capability to enable. + */ + disable(id: GLenum): void; + /** + * Specifies whether polygons are front- or back-facing + * by setting the winding orientation. + * + * This method caches the state so `gl.frontFace()` is only + * called when necessary. + * + * @param {boolean} flipSided - Whether triangles flipped their sides or not. + */ + setFlipSided(flipSided: boolean): void; + /** + * Specifies whether or not front- and/or back-facing + * polygons can be culled. + * + * This method caches the state so `gl.cullFace()` is only + * called when necessary. + * + * @param {number} cullFace - Defines which polygons are candidates for culling. + */ + setCullFace(cullFace: number): void; + /** + * Specifies the width of line primitives. + * + * This method caches the state so `gl.lineWidth()` is only + * called when necessary. + * + * @param {number} width - The line width. + */ + setLineWidth(width: number): void; + setMRTBlending(textures: any, mrt: any, material: any): void; + /** + * Applies blending configuration for a specific draw buffer index. + * + * @private + * @param {number} index - The draw buffer index. + * @param {Object} blending - The blending configuration (material or BlendMode). + */ + private _setMRTBlendingIndex; + /** + * Defines the blending. + * + * This method caches the state so `gl.blendEquation()`, `gl.blendEquationSeparate()`, + * `gl.blendFunc()`, `gl.blendFuncSeparate()` and `gl.blendColor()` are only called when necessary. + * + * @param {number} blending - The blending type. + * @param {number} blendEquation - The blending equation. + * @param {number} blendSrc - Only relevant for custom blending. The RGB source blending factor. + * @param {number} blendDst - Only relevant for custom blending. The RGB destination blending factor. + * @param {number} blendEquationAlpha - Only relevant for custom blending. The blending equation for alpha. + * @param {number} blendSrcAlpha - Only relevant for custom blending. The alpha source blending factor. + * @param {number} blendDstAlpha - Only relevant for custom blending. The alpha destination blending factor. + * @param {Color} blendColor - Only relevant for custom blending. The RGB values of the constant blend color. + * @param {number} blendAlpha - Only relevant for custom blending. The alpha value of the constant blend color. + * @param {boolean} premultipliedAlpha - Whether premultiplied alpha is enabled or not. + */ + setBlending(blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number, blendColor: Color, blendAlpha: number, premultipliedAlpha: boolean): void; + /** + * Specifies whether colors can be written when rendering + * into a framebuffer or not. + * + * This method caches the state so `gl.colorMask()` is only + * called when necessary. + * + * @param {boolean} colorMask - The color mask. + */ + setColorMask(colorMask: boolean): void; + /** + * Specifies whether the depth test is enabled or not. + * + * @param {boolean} depthTest - Whether the depth test is enabled or not. + */ + setDepthTest(depthTest: boolean): void; + /** + * Configures the WebGL state to use a reversed depth buffer. + * + * @param {boolean} reversed - Whether the depth buffer is reversed or not. + */ + setReversedDepth(reversed: boolean): void; + /** + * Specifies whether depth values can be written when rendering + * into a framebuffer or not. + * + * This method caches the state so `gl.depthMask()` is only + * called when necessary. + * + * @param {boolean} depthMask - The depth mask. + */ + setDepthMask(depthMask: boolean): void; + /** + * Specifies the depth compare function. + * + * This method caches the state so `gl.depthFunc()` is only + * called when necessary. + * + * @param {number} depthFunc - The depth compare function. + */ + setDepthFunc(depthFunc: number): void; + /** + * Specifies the scissor box. + * + * @param {number} x - The x-coordinate of the lower left corner of the viewport. + * @param {number} y - The y-coordinate of the lower left corner of the viewport. + * @param {number} width - The width of the viewport. + * @param {number} height - The height of the viewport. + * + */ + scissor(x: number, y: number, width: number, height: number): void; + /** + * Specifies the viewport. + * + * @param {number} x - The x-coordinate of the lower left corner of the viewport. + * @param {number} y - The y-coordinate of the lower left corner of the viewport. + * @param {number} width - The width of the viewport. + * @param {number} height - The height of the viewport. + * + */ + viewport(x: number, y: number, width: number, height: number): void; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Specifies whether the stencil test is enabled or not. + * + * @param {boolean} stencilTest - Whether the stencil test is enabled or not. + */ + setStencilTest(stencilTest: boolean): void; + /** + * Specifies whether stencil values can be written when rendering + * into a framebuffer or not. + * + * This method caches the state so `gl.stencilMask()` is only + * called when necessary. + * + * @param {boolean} stencilMask - The stencil mask. + */ + setStencilMask(stencilMask: boolean): void; + /** + * Specifies whether the stencil test functions. + * + * This method caches the state so `gl.stencilFunc()` is only + * called when necessary. + * + * @param {number} stencilFunc - The stencil compare function. + * @param {number} stencilRef - The reference value for the stencil test. + * @param {number} stencilMask - A bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. + */ + setStencilFunc(stencilFunc: number, stencilRef: number, stencilMask: number): void; + /** + * Specifies whether the stencil test operation. + * + * This method caches the state so `gl.stencilOp()` is only + * called when necessary. + * + * @param {number} stencilFail - The function to use when the stencil test fails. + * @param {number} stencilZFail - The function to use when the stencil test passes, but the depth test fail. + * @param {number} stencilZPass - The function to use when both the stencil test and the depth test pass, + * or when the stencil test passes and there is no depth buffer or depth testing is disabled. + */ + setStencilOp(stencilFail: number, stencilZFail: number, stencilZPass: number): void; + /** + * Configures the WebGL state for the given material. + * + * @param {Material} material - The material to configure the state for. + * @param {number} frontFaceCW - Whether the front faces are counter-clockwise or not. + * @param {number} hardwareClippingPlanes - The number of hardware clipping planes. + */ + setMaterial(material: Material, frontFaceCW: number, hardwareClippingPlanes: number): void; + /** + * Specifies the polygon offset. + * + * This method caches the state so `gl.polygonOffset()` is only + * called when necessary. + * + * @param {boolean} polygonOffset - Whether polygon offset is enabled or not. + * @param {number} factor - The scale factor for the variable depth offset for each polygon. + * @param {number} units - The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. + */ + setPolygonOffset(polygonOffset: boolean, factor: number, units: number): void; + /** + * Defines the usage of the given WebGL program. + * + * This method caches the state so `gl.useProgram()` is only + * called when necessary. + * + * @param {WebGLProgram} program - The WebGL program to use. + * @return {boolean} Whether a program change has been executed or not. + */ + useProgram(program: WebGLProgram): boolean; + /** + * Sets the vertex state by binding the given VAO and element buffer. + * + * @param {WebGLVertexArrayObject} vao - The VAO. + * @param {?WebGLBuffer} indexBuffer - The index buffer. + * @return {boolean} Whether a vertex state has been changed or not. + */ + setVertexState(vao: WebGLVertexArrayObject, indexBuffer?: WebGLBuffer | null): boolean; + /** + * Resets the vertex array state by resetting the VAO and element buffer. + */ + resetVertexState(): void; + /** + * Binds the given framebuffer. + * + * This method caches the state so `gl.bindFramebuffer()` is only + * called when necessary. + * + * @param {number} target - The binding point (target). + * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer to bind. + * @return {boolean} Whether a bind has been executed or not. + */ + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): boolean; + /** + * Defines draw buffers to which fragment colors are written into. + * Configures the MRT setup of custom framebuffers. + * + * This method caches the state so `gl.drawBuffers()` is only + * called when necessary. + * + * @param {RenderContext} renderContext - The render context. + * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer. + */ + drawBuffers(renderContext: RenderContext, framebuffer: WebGLFramebuffer): void; + /** + * Makes the given texture unit active. + * + * This method caches the state so `gl.activeTexture()` is only + * called when necessary. + * + * @param {number} webglSlot - The texture unit to make active. + */ + activeTexture(webglSlot: number): void; + /** + * Binds the given WebGL texture to a target. + * + * This method caches the state so `gl.bindTexture()` is only + * called when necessary. + * + * @param {number} webglType - The binding point (target). + * @param {WebGLTexture} webglTexture - The WebGL texture to bind. + * @param {number} webglSlot - The texture. + */ + bindTexture(webglType: number, webglTexture: WebGLTexture, webglSlot: number): void; + /** + * Binds a given WebGL buffer to a given binding point (target) at a given index. + * + * This method caches the state so `gl.bindBufferBase()` is only + * called when necessary. + * + * @param {number} target - The target for the bind operation. + * @param {number} index - The index of the target. + * @param {WebGLBuffer} buffer - The WebGL buffer. + * @return {boolean} Whether a bind has been executed or not. + */ + bindBufferBase(target: number, index: number, buffer: WebGLBuffer): boolean; + /** + * Unbinds the current bound texture. + * + * This method caches the state so `gl.bindTexture()` is only + * called when necessary. + */ + unbindTexture(): void; + /** + * Returns the value for the given parameter. + * + * @param {number} name - The parameter to get the value for. + * @return {any} The value for the given parameter. + */ + getParameter(name: number): any; + /** + * Specifies a pixel storage mode. + * + * @param {number} name - The parameter to set. + * @param {any} value - A value to set the parameter to. + */ + pixelStorei(name: number, value: any): void; + /** + * Restores the WebGL state to its default and clears the cache so subsequent renderings + * re-apply the required state. Useful when the WebGL context is shared with other libraries. + */ + reset(): void; +} +/** + * A WebGL 2 backend utility module with common helpers. + * + * @private + */ +declare class WebGLUtils { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + /** + * A reference to a backend module holding extension-related + * utility functions. + * + * @type {WebGLExtensions} + */ + extensions: WebGLExtensions; + /** + * Converts the given three.js constant into a WebGL constant. + * The method currently supports the conversion of texture formats + * and types. + * + * @param {number} p - The three.js constant. + * @param {string} [colorSpace=NoColorSpace] - The color space. + * @return {?number} The corresponding WebGL constant. + */ + convert(p: number, colorSpace?: string): number | null; + /** + * This method can be used to synchronize the CPU with the GPU by waiting until + * ongoing GPU commands have been completed. + * + * @private + * @return {Promise} A promise that resolves when all ongoing GPU commands have been completed. + */ + private _clientWaitAsync; +} +/** + * A special type of render target that is used when rendering + * with the WebXR Device API. + * + * @private + * @augments RenderTarget + */ +declare class XRRenderTarget extends RenderTarget { + /** + * Constructs a new XR render target. + * + * @param {number} [width=1] - The width of the render target. + * @param {number} [height=1] - The height of the render target. + * @param {Object} [options={}] - The configuration options. + */ + constructor(width?: number, height?: number, options?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isXRRenderTarget: boolean; + /** + * Whether the attachments of the render target + * are defined by external textures. This flag is + * set to `true` when using the WebXR Layers API. + * + * @private + * @type {boolean} + * @default false + */ + private _hasExternalTextures; + /** + * Whether a depth buffer should automatically be allocated + * for this XR render target or not. + * + * Allocating a depth buffer is the default behavior of XR render + * targets. However, when using the WebXR Layers API, this flag + * must be set to `false` when the `ignoreDepthValues` property of + * the projection layers evaluates to `false`. + * + * Reference: {@link https://www.w3.org/TR/webxrlayers-1/#dom-xrprojectionlayer-ignoredepthvalues}. + * + * @private + * @type {boolean} + * @default true + */ + private _autoAllocateDepthBuffer; + /** + * Whether this render target is associated with a XRWebGLLayer. + * + * A XRWebGLLayer points to an opaque framebuffer. Basically, + * this means that you don't have access to its bound color, + * stencil and depth buffers. We need to handle this framebuffer + * differently since its textures are always bound. + * + * @private + * @type {boolean} + * @default false + * */ + private _isOpaqueFramebuffer; + copy(source: any): this; +} +/** + * Class for representing compute pipelines. + * + * @private + * @augments Pipeline + */ +declare class ComputePipeline extends Pipeline { + /** + * Constructs a new compute pipeline. + * + * @param {string} cacheKey - The pipeline's cache key. + * @param {ProgrammableStage} computeProgram - The pipeline's compute shader. + */ + constructor(cacheKey: string, computeProgram: ProgrammableStage); + /** + * The pipeline's compute shader. + * + * @type {ProgrammableStage} + */ + computeProgram: ProgrammableStage; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isComputePipeline: boolean; +} +/** + * Class for representing programmable stages which are vertex, + * fragment or compute shaders. Unlike fixed-function states (like blending), + * they represent the programmable part of a pipeline. + * + * @private + */ +declare class ProgrammableStage { + /** + * Constructs a new programmable stage. + * + * @param {string} code - The shader code. + * @param {('vertex'|'fragment'|'compute')} stage - The type of stage. + * @param {string} name - The name of the shader. + * @param {?Array} [transforms=null] - The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + * @param {?Array} [attributes=null] - The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + */ + constructor(code: string, stage: ("vertex" | "fragment" | "compute"), name: string, transforms?: Array | null, attributes?: Array | null); + /** + * The id of the programmable stage. + * + * @type {number} + */ + id: number; + /** + * The shader code. + * + * @type {string} + */ + code: string; + /** + * The type of stage. + * + * @type {string} + */ + stage: string; + /** + * The name of the stage. + * This is used for debugging purposes. + * + * @type {string} + */ + name: string; + /** + * The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + * + * @type {?Array} + */ + transforms: Array | null; + /** + * The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + * + * @type {?Array} + */ + attributes: Array | null; + /** + * How often the programmable stage is currently in use. + * + * @type {number} + * @default 0 + */ + usedTimes: number; +} +/** + * Represents a buffer binding type. + * + * @private + * @abstract + * @augments Binding + */ +declare class Buffer extends Binding { + /** + * Constructs a new buffer. + * + * @param {string} name - The buffer's name. + * @param {TypedArray} [buffer=null] - The buffer. + */ + constructor(name: string, buffer?: TypedArray); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBuffer: boolean; + /** + * The bytes per element. + * + * @type {number} + */ + bytesPerElement: number; + /** + * A reference to the internal buffer. + * + * @private + * @type {TypedArray} + */ + private _buffer; + /** + * An array of update ranges. + * + * @private + * @type {Array<{start: number, count: number}>} + */ + private _updateRanges; + /** + * The array of update ranges. + * + * @type {Array<{start: number, count: number}>} + */ + get updateRanges(): Array<{ + start: number; + count: number; + }>; + /** + * Adds an update range. + * + * @param {number} start - The start index. + * @param {number} count - The number of elements. + */ + addUpdateRange(start: number, count: number): void; + /** + * Clears all update ranges. + */ + clearUpdateRanges(): void; + /** + * The buffer's byte length. + * + * @type {number} + * @readonly + */ + readonly get byteLength(): number; + /** + * A reference to the internal buffer. + * + * @type {Float32Array} + * @readonly + */ + readonly get buffer(): Float32Array; + /** + * Updates the binding. + * + * @return {boolean} Whether the buffer has been updated and must be + * uploaded to the GPU. + */ + update(): boolean; + /** + * Releases the buffer. + */ + release(): void; +} +/** + * A WebGPU backend utility module with common helpers. + * + * @private + */ +declare class WebGPUUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Caches the preferred canvas format. + * + * @private + * @type {?string} + * @default null + */ + private _preferredCanvasFormat; + /** + * Returns the depth/stencil GPU format for the given render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {string} The depth/stencil GPU texture format. + */ + getCurrentDepthStencilFormat(renderContext: RenderContext): string; + /** + * Returns the GPU format for the given texture. + * + * @param {Texture} texture - The texture. + * @return {string} The GPU texture format. + */ + getTextureFormatGPU(texture: Texture): string; + /** + * Returns an object that defines the multi-sampling state of the given texture. + * + * @param {Texture} texture - The texture. + * @return {Object} The multi-sampling state. + */ + getTextureSampleData(texture: Texture): Object; + /** + * Returns the default color attachment's GPU format of the current render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {string} The GPU texture format of the default color attachment. + */ + getCurrentColorFormat(renderContext: RenderContext): string; + /** + * Returns the GPU formats of all color attachments of the current render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {Array} The GPU texture formats of all color attachments. + */ + getCurrentColorFormats(renderContext: RenderContext): Array; + /** + * Returns the output color space of the current render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {string} The output color space. + */ + getCurrentColorSpace(renderContext: RenderContext): string; + /** + * Returns GPU primitive topology for the given object and material. + * + * @param {Object3D} object - The 3D object. + * @param {Material} material - The material. + * @return {string} The GPU primitive topology. + */ + getPrimitiveTopology(object: Object3D, material: Material): string; + /** + * Returns a modified sample count from the given sample count value. + * + * That is required since WebGPU only supports either 1 or 4. + * + * @param {number} sampleCount - The input sample count. + * @return {number} The (potentially updated) output sample count. + */ + getSampleCount(sampleCount: number): number; + /** + * Returns the sample count of the given render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {number} The sample count. + */ + getSampleCountRenderContext(renderContext: RenderContext): number; + /** + * Returns the preferred canvas format. + * + * There is a separate method for this so it's possible to + * honor edge cases for specific devices. + * + * @return {string} The GPU texture format of the canvas. + */ + getPreferredCanvasFormat(): string; +} +/** + * A WebGPU backend utility module for managing shader attributes. + * + * @private + */ +declare class WebGPUAttributeUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Creates the GPU buffer for the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + * @param {GPUBufferUsage} usage - A flag that indicates how the buffer may be used after its creation. + */ + createAttribute(attribute: BufferAttribute, usage: GPUBufferUsage): void; + /** + * Updates the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * This method creates the vertex buffer layout data which are + * require when creating a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {Array} An array holding objects which describe the vertex buffer layout. + */ + createShaderVertexBuffers(renderObject: RenderObject): Array; + /** + * Destroys the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {number} count - The offset from which to start reading the + * @param {number} offset - The storage buffer attribute. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Returns the vertex format of the given buffer attribute. + * + * @private + * @param {BufferAttribute} geometryAttribute - The buffer attribute. + * @return {string|undefined} The vertex format (e.g. 'float32x3'). + */ + private _getVertexFormat; + /** + * Utility method for handling interleaved buffer attributes correctly. + * To process them, their `InterleavedBuffer` is returned. + * + * @private + * @param {BufferAttribute} attribute - The attribute. + * @return {BufferAttribute|InterleavedBuffer} + */ + private _getBufferAttribute; +} +/** + * A WebGPU backend utility module for managing bindings. + * + * When reading the documentation it's helpful to keep in mind that + * all class definitions starting with 'GPU*' are modules from the + * WebGPU API. So for example `BindGroup` is a class from the engine + * whereas `GPUBindGroup` is a class from WebGPU. + * + * @private + */ +declare class WebGPUBindingUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * A cache that maps combinations of layout entries to existing bind group layouts. + * + * @private + * @type {Map} + */ + private _bindGroupLayoutCache; + /** + * Creates a GPU bind group layout for the given bind group. + * + * @param {BindGroup} bindGroup - The bind group. + * @return {GPUBindGroupLayout} The GPU bind group layout. + */ + createBindingsLayout(bindGroup: BindGroup): GPUBindGroupLayout; + /** + * Creates bindings from the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version?: number): void; + /** + * Updates a buffer binding. + * + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(binding: Buffer): void; + /** + * Creates a GPU bind group for the camera index. + * + * @param {Uint32Array} data - The index data. + * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. + * @return {GPUBindGroup} The GPU bind group. + */ + createBindGroupIndex(data: Uint32Array, layoutGPU: GPUBindGroupLayout): GPUBindGroup; + /** + * Creates a GPU bind group for the given bind group and GPU layout. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. + * @return {GPUBindGroup} The GPU bind group. + */ + createBindGroup(bindGroup: BindGroup, layoutGPU: GPUBindGroupLayout): GPUBindGroup; + /** + * Creates a GPU bind group layout entries for the given bind group. + * + * @private + * @param {BindGroup} bindGroup - The bind group. + * @return {Array} The GPU bind group layout entries. + */ + private _createLayoutEntries; + /** + * Delete the data associated with a bind group. + * + * @param {BindGroup} bindGroup - The bind group. + */ + deleteBindGroupData(bindGroup: BindGroup): void; + /** + * Frees internal resources. + */ + dispose(): void; +} +/** + * A WebGPU backend utility module for managing the device's capabilities. + * + * @private + */ +declare class WebGPUCapabilities { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Returns the maximum anisotropy texture filtering value. + * + * @return {number} The maximum anisotropy texture filtering value. + */ + getMaxAnisotropy(): number; + /** + * Returns the maximum number of bytes available for uniform buffers. + * + * @return {number} The maximum number of bytes available for uniform buffers. + */ + getUniformBufferLimit(): number; +} +/** + * A WebGPU backend utility module for managing pipelines. + * + * @private + */ +declare class WebGPUPipelineUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Returns the sample count derived from the given render context. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @return {number} The sample count. + */ + private _getSampleCount; + /** + * Creates a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(renderObject: RenderObject, promises: Array>): void; + /** + * Creates GPU render bundle encoder for the given render context. + * + * @param {RenderContext} renderContext - The render context. + * @param {?string} [label='renderBundleEncoder'] - The label. + * @return {GPURenderBundleEncoder} The GPU render bundle encoder. + */ + createBundleEncoder(renderContext: RenderContext, label?: string | null): GPURenderBundleEncoder; + /** + * Creates a compute pipeline for the given compute node. + * + * @param {ComputePipeline} pipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(pipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; + /** + * Reads line-accurate diagnostics from shader modules and logs them. + * Called from pipeline creation error paths to turn opaque validation + * failures into actionable WGSL feedback. + * + * @private + * @param {Array<{program: ProgrammableStage, module: GPUShaderModule}>} stages - Pairs of program + compiled shader module. + * @param {string} pipelineLabel - Label of the owning pipeline, used as log prefix. + * @return {Promise} + */ + private _reportShaderDiagnostics; + /** + * Returns the blending state as a descriptor object required + * for the pipeline creation. + * + * @private + * @param {Material|BlendMode} object - The object containing blending information. + * @return {Object} The blending state. + */ + private _getBlending; + /** + * Returns the GPU blend factor which is required for the pipeline creation. + * + * @private + * @param {number} blend - The blend factor as a three.js constant. + * @return {string} The GPU blend factor. + */ + private _getBlendFactor; + /** + * Returns the GPU stencil compare function which is required for the pipeline creation. + * + * @private + * @param {Material} material - The material. + * @return {string} The GPU stencil compare function. + */ + private _getStencilCompare; + /** + * Returns the GPU stencil operation which is required for the pipeline creation. + * + * @private + * @param {number} op - A three.js constant defining the stencil operation. + * @return {string} The GPU stencil operation. + */ + private _getStencilOperation; + /** + * Returns the GPU blend operation which is required for the pipeline creation. + * + * @private + * @param {number} blendEquation - A three.js constant defining the blend equation. + * @return {string} The GPU blend operation. + */ + private _getBlendOperation; + /** + * Returns the primitive state as a descriptor object required + * for the pipeline creation. + * + * @private + * @param {Object3D} object - The 3D object. + * @param {BufferGeometry} geometry - The geometry. + * @param {Material} material - The material. + * @return {Object} The primitive state. + */ + private _getPrimitiveState; + /** + * Returns the GPU color write mask which is required for the pipeline creation. + * + * @private + * @param {Material} material - The material. + * @return {number} The GPU color write mask. + */ + private _getColorWriteMask; + /** + * Returns the GPU depth compare function which is required for the pipeline creation. + * + * @private + * @param {Material} material - The material. + * @return {string} The GPU depth compare function. + */ + private _getDepthCompare; +} +/** + * A WebGPU backend utility module for managing textures. + * + * @private + */ +declare class WebGPUTextureUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * A reference to the pass utils. + * + * @type {?WebGPUTexturePassUtils} + * @default null + */ + _passUtils: WebGPUTexturePassUtils | null; + /** + * A dictionary for managing default textures. The key + * is the texture format, the value the texture object. + * + * @type {Object} + */ + defaultTexture: { + [x: string]: Texture; + }; + /** + * A dictionary for managing default cube textures. The key + * is the texture format, the value the texture object. + * + * @type {Object} + */ + defaultCubeTexture: { + [x: string]: CubeTexture; + }; + /** + * A default video frame. + * + * @type {?VideoFrame} + * @default null + */ + defaultVideoFrame: VideoFrame | null; + /** + * A cache of shared texture samplers. + * + * @type {Map} + */ + _samplerCache: Map; + /** + * Creates a GPU sampler for the given texture. + * + * @param {Sampler} binding - The sampler binding to update. + * @return {string} The current sampler key. + */ + updateSampler(binding: Sampler): string; + /** + * Frees the GPU sampler referenced by the given sampler binding. + * + * @param {Sampler} binding - The sampler binding to free. + */ + destroySampler(binding: Sampler): void; + /** + * Releases the pooled sampler referenced by the given binding data and + * removes it from the cache when no binding references it anymore. + * + * @private + * @param {Object} bindingData - The binding data holding the sampler reference. + */ + private _releaseSampler; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(texture: Texture): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(texture: Texture, options?: Object): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. + */ + generateMipmaps(texture: Texture, encoder?: GPUCommandEncoder | null): void; + /** + * Returns the color buffer representing the color + * attachment of the default framebuffer. + * + * @return {GPUTexture} The color buffer. + */ + getColorBuffer(): GPUTexture; + /** + * Returns the depth buffer representing the depth + * attachment of the default framebuffer. + * + * @param {boolean} [depth=true] - Whether depth is enabled or not. + * @param {boolean} [stencil=false] - Whether stencil is enabled or not. + * @return {GPUTexture} The depth buffer. + */ + getDepthBuffer(depth?: boolean, stencil?: boolean): GPUTexture; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Frees all internal resources. + */ + dispose(): void; + /** + * Returns the default GPU texture for the given format. + * + * @private + * @param {string} format - The GPU format. + * @return {GPUTexture} The GPU texture. + */ + private _getDefaultTextureGPU; + /** + * Returns the default GPU cube texture for the given format. + * + * @private + * @param {string} format - The GPU format. + * @return {GPUTexture} The GPU texture. + */ + private _getDefaultCubeTextureGPU; + /** + * Uploads cube texture image data to the GPU memory. + * + * @private + * @param {CubeTexture} texture - The cube texture. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + */ + private _copyCubeMapToTexture; + /** + * Uploads texture image data to the GPU memory. + * + * @private + * @param {HTMLImageElement|ImageBitmap|HTMLCanvasElement} image - The image data. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + * @param {number} originDepth - The origin depth. + * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. + * @param {boolean} premultiplyAlpha - Whether the texture should have its RGB channels premultiplied by the alpha channel or not. + * @param {number} [mipLevel=0] - The mip level where the data should be copied to. + */ + private _copyImageToTexture; + /** + * Returns the pass utils singleton. + * + * @private + * @return {WebGPUTexturePassUtils} The utils instance. + */ + private _getPassUtils; + /** + * Generates mipmaps for the given GPU texture. + * + * @private + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. + */ + private _generateMipmaps; + /** + * Flip the contents of the given GPU texture along its vertical axis. + * + * @private + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {Object} textureDescriptorGPU - The texture descriptor. + * @param {number} [originDepth=0] - The origin depth. + */ + private _flipY; + /** + * Uploads texture buffer data to the GPU memory. + * + * @private + * @param {Object} image - An object defining the image buffer data. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + * @param {number} originDepth - The origin depth. + * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. + * @param {number} [depth=0] - The depth offset when copying array or 3D texture data. + * @param {number} [mipLevel=0] - The mip level where the data should be copied to. + */ + private _copyBufferToTexture; + /** + * Uploads compressed texture data to the GPU memory. + * + * @private + * @param {Array} mipmaps - An array with mipmap data. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + * @param {?Set} [layerUpdates=null] - The layer indices to update. + */ + private _copyCompressedBufferToTexture; + /** + * This method is only relevant for compressed texture formats. It returns a block + * data descriptor for the given GPU compressed texture format. + * + * @private + * @param {string} format - The GPU compressed texture format. + * @return {Object} The block data descriptor. + */ + private _getBlockData; + /** + * Converts the three.js uv wrapping constants to GPU address mode constants. + * + * @private + * @param {number} value - The three.js constant defining a uv wrapping mode. + * @return {string} The GPU address mode. + */ + private _convertAddressMode; + /** + * Converts the three.js filter constants to GPU filter constants. + * + * @private + * @param {number} value - The three.js constant defining a filter mode. + * @return {string} The GPU filter mode. + */ + private _convertFilterMode; + /** + * Converts the three.js filter constants to a GPU mipmap filter constant. + * Unlike `_convertFilterMode`, this extracts the between-mip-level filtering + * axis from the combined three.js constant rather than the within-level axis. + * + * @private + * @param {number} value - The three.js constant defining a filter mode. + * @return {string} The GPU mipmap filter mode. + */ + private _convertMipmapFilterMode; + /** + * Returns the bytes-per-texel value for the given GPU texture format. + * + * @private + * @param {string} format - The GPU texture format. + * @return {number} The bytes-per-texel. + */ + private _getBytesPerTexel; + /** + * Returns the corresponding typed array type for the given GPU texture format. + * + * @private + * @param {string} format - The GPU texture format. + * @return {TypedArray.constructor} The typed array type. + */ + private _getTypedArrayType; + /** + * Returns the GPU dimensions for the given texture. + * + * @private + * @param {Texture} texture - The texture. + * @return {string} The GPU dimension. + */ + private _getDimension; +} +/** + * Represents a sampler binding type. + * + * @private + * @augments Binding + */ +declare class Sampler extends Binding { + /** + * Constructs a new sampler. + * + * @param {string} name - The samplers's name. + * @param {?Texture} texture - The texture this binding is referring to. + */ + constructor(name: string, texture: Texture | null); + /** + * The texture the sampler is referring to. + * + * @private + * @type {?Texture} + */ + private _texture; + /** + * The binding's version. + * + * @type {number} + */ + version: number; + /** + * The binding's generation which is an additional version + * qualifier. + * + * @type {?number} + * @default null + */ + generation: number | null; + /** + * The binding's sampler key. + * + * @type {string} + * @default '' + */ + samplerKey: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampler: boolean; + /** + * Sets the texture of this sampler. + * + * @param {Texture} value - The texture to set. + */ + set texture(value: Texture); + /** + * Gets the texture of this sampler. + * @return {?Texture} The texture. + */ + get texture(): Texture | null; + /** + * Updates the binding. + * + * @return {boolean} Whether the texture has been updated and must be + * uploaded to the GPU. + */ + update(): boolean; + /** + * Resets the version and generation. This is used when the texture + * the binding is pointing to is disposed or exchanged. + */ + reset(): void; + /** + * Releases the texture reference. + */ + release(): void; +} +/** + * This module is used to represent render bundles inside the renderer + * for further processing. + * + * @private + */ +declare class RenderBundle { + /** + * Constructs a new bundle group. + * + * @param {BundleGroup} bundleGroup - The bundle group. + * @param {Camera} camera - The camera the bundle group is rendered with. + * @param {RenderContext} renderContext - The render context the bundle is rendered with. + */ + constructor(bundleGroup: BundleGroup, camera: Camera, renderContext: RenderContext); + bundleGroup: BundleGroup; + camera: Camera; + renderContext: RenderContext; +} +/** + * Represents an element of a 'workgroup' scoped buffer. + * + * @augments ArrayElementNode + */ +declare class WorkgroupInfoElementNode extends ArrayElementNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWorkgroupInfoElementNode: boolean; + generate(builder: any, output: any): any; +} +/** + * This class represents a uniform buffer binding but with + * an API that allows to maintain individual uniform objects. + * + * @private + * @augments UniformBuffer + */ +declare class UniformsGroup extends UniformBuffer { + /** + * Constructs a new uniforms group. + * + * @param {string} name - The group's name. + */ + constructor(name: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformsGroup: boolean; + /** + * An array with the raw uniform values. + * + * @private + * @type {?Array} + * @default null + */ + private _values; + /** + * An array of uniform objects. + * + * The order of uniforms in this array must match the order of uniforms in the shader. + * + * @type {Array} + */ + uniforms: Array; + /** + * A cache for the uniform update ranges. + * + * @private + * @type {Map} + */ + private _updateRangeCache; + /** + * Uniform indices whose range has already been pushed into `updateRanges` + * during the current update cycle. Reset on `clearUpdateRanges()`. + * + * @private + * @type {Set} + */ + private _addedIndices; + /** + * Adds a uniform's update range to this buffer. + * + * @param {Uniform} uniform - The uniform. + */ + addUniformUpdateRange(uniform: Uniform): void; + /** + * Adds a uniform to this group. + * + * @param {Uniform} uniform - The uniform to add. + * @return {UniformsGroup} A reference to this group. + */ + addUniform(uniform: Uniform): UniformsGroup; + /** + * Removes a uniform from this group. + * + * @param {Uniform} uniform - The uniform to remove. + * @return {UniformsGroup} A reference to this group. + */ + removeUniform(uniform: Uniform): UniformsGroup; + /** + * An array with the raw uniform values. + * + * @type {Array} + */ + get values(): Array; + /** + * Updates a given uniform by calling an update method matching + * the uniforms type. + * + * @param {Uniform} uniform - The uniform to update. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateByType(uniform: Uniform): boolean; + /** + * Updates a given Number uniform. + * + * @param {NumberUniform} uniform - The Number uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateNumber(uniform: NumberUniform): boolean; + /** + * Updates a given Vector2 uniform. + * + * @param {Vector2Uniform} uniform - The Vector2 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateVector2(uniform: Vector2Uniform): boolean; + /** + * Updates a given Vector3 uniform. + * + * @param {Vector3Uniform} uniform - The Vector3 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateVector3(uniform: Vector3Uniform): boolean; + /** + * Updates a given Vector4 uniform. + * + * @param {Vector4Uniform} uniform - The Vector4 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateVector4(uniform: Vector4Uniform): boolean; + /** + * Updates a given Color uniform. + * + * @param {ColorUniform} uniform - The Color uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateColor(uniform: ColorUniform): boolean; + /** + * Updates a given Matrix3 uniform. + * + * @param {Matrix3Uniform} uniform - The Matrix3 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateMatrix3(uniform: Matrix3Uniform): boolean; + /** + * Updates a given Matrix4 uniform. + * + * @param {Matrix4Uniform} uniform - The Matrix4 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateMatrix4(uniform: Matrix4Uniform): boolean; + /** + * Returns a typed array that matches the given data type. + * + * @private + * @param {string} type - The data type. + * @return {TypedArray} The typed array. + */ + private _getBufferForType; +} +/** + * A binding represents the connection between a resource (like a texture, sampler + * or uniform buffer) and the resource definition in a shader stage. + * + * This module is an abstract base class for all concrete bindings types. + * + * @abstract + * @private + */ +declare class Binding { + /** + * Constructs a new binding. + * + * @param {string} [name=''] - The binding's name. + */ + constructor(name?: string); + /** + * The binding's name. + * + * @type {string} + */ + name: string; + /** + * A bitmask that defines in what shader stages the + * binding's resource is accessible. + * + * @type {number} + */ + visibility: number; + /** + * Makes sure binding's resource is visible for the given shader stage. + * + * @param {number} visibility - The shader stage. + */ + setVisibility(visibility: number): void; + /** + * The shader stages in which the binding's resource is visible. + * + * @return {number} The visibility bitmask. + */ + getVisibility(): number; + /** + * Clones the binding. + * + * @return {Binding} The cloned binding. + */ + clone(): Binding; +} +/** + * This module represents the state of a node builder after it was + * used to build the nodes for a render object. The state holds the + * results of the build for further processing in the renderer. + * + * Render objects with identical cache keys share the same node builder state. + * + * @private + */ +declare class NodeBuilderState { + /** + * Constructs a new node builder state. + * + * @param {string} vertexShader - The native vertex shader code. + * @param {string} fragmentShader - The native fragment shader code. + * @param {string} computeShader - The native compute shader code. + * @param {Array} nodeAttributes - An array of node attributes. + * @param {Array} bindings - An array of bind groups. + * @param {Array} updateNodes - An array of nodes that implement their `update()` method. + * @param {Array} updateBeforeNodes - An array of nodes that implement their `updateBefore()` method. + * @param {Array} updateAfterNodes - An array of nodes that implement their `updateAfter()` method. + * @param {NodeMaterialObserver} observer - A node material observer. + * @param {boolean} hardwareClipping - Whether the built material uses hardware clipping or not. + * @param {Array} transforms - An array with transform attribute objects. Only relevant when using compute shaders with WebGL 2. + */ + constructor(vertexShader: string, fragmentShader: string, computeShader: string, nodeAttributes: Array, bindings: Array, updateNodes: Array, updateBeforeNodes: Array, updateAfterNodes: Array, observer: NodeMaterialObserver, hardwareClipping: boolean, transforms?: Array); + /** + * The native vertex shader code. + * + * @type {string} + */ + vertexShader: string; + /** + * The native fragment shader code. + * + * @type {string} + */ + fragmentShader: string; + /** + * The native compute shader code. + * + * @type {string} + */ + computeShader: string; + /** + * An array with transform attribute objects. + * Only relevant when using compute shaders with WebGL 2. + * + * @type {Array} + */ + transforms: Array; + /** + * An array of node attributes representing + * the attributes of the shaders. + * + * @type {Array} + */ + nodeAttributes: Array; + /** + * An array of bind groups representing the uniform or storage + * buffers, texture or samplers of the shader. + * + * @type {Array} + */ + bindings: Array; + /** + * An array of nodes that implement their `update()` method. + * + * @type {Array} + */ + updateNodes: Array; + /** + * An array of nodes that implement their `updateBefore()` method. + * + * @type {Array} + */ + updateBeforeNodes: Array; + /** + * An array of nodes that implement their `updateAfter()` method. + * + * @type {Array} + */ + updateAfterNodes: Array; + /** + * A node material observer. + * + * @type {NodeMaterialObserver} + */ + observer: NodeMaterialObserver; + /** + * Whether the built material uses hardware clipping or not. + * + * @type {boolean} + */ + hardwareClipping: boolean; + /** + * How often this state is used by render objects. + * + * @type {number} + */ + usedTimes: number; + /** + * This method is used to create a array of bind groups based + * on the existing bind groups of this state. Shared groups are + * not cloned. + * + * @return {Array} A array of bind groups. + */ + createBindings(): Array; +} +/** + * This renderer module manages node-related objects and is the + * primary interface between the renderer and the node system. + * + * @private + * @augments DataMap + */ +declare class NodeManager extends DataMap { + /** + * Constructs a new nodes management component. + * + * @param {Renderer} renderer - The renderer. + * @param {Backend} backend - The renderer's backend. + */ + constructor(renderer: Renderer, backend: Backend); + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * The renderer's backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * The node frame. + * + * @type {Renderer} + */ + nodeFrame: Renderer; + /** + * A cache for managing node builder states. + * + * @type {Map} + */ + nodeBuilderCache: Map; + /** + * A cache for managing data cache key data. + * + * @type {ChainMap} + */ + callHashCache: ChainMap; + /** + * A cache for managing node uniforms group data. + * + * @type {ChainMap} + */ + groupsData: ChainMap; + /** + * Queue for pending async builds to limit concurrent compilation. + * + * @private + * @type {Array} + */ + private _buildQueue; + /** + * Whether an async build is currently in progress. + * + * @private + * @type {boolean} + */ + private _buildInProgress; + /** + * A cache for managing node objects of + * scene properties like fog or environments. + * + * @type {Object} + */ + cacheLib: { + [x: string]: WeakMap; + }; + /** + * Returns `true` if the given node uniforms group must be updated or not. + * + * @param {NodeUniformsGroup} nodeUniformsGroup - The node uniforms group. + * @return {boolean} Whether the node uniforms group requires an update or not. + */ + updateGroup(nodeUniformsGroup: NodeUniformsGroup): boolean; + /** + * Returns the cache key for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {number} The cache key. + */ + getForRenderCacheKey(renderObject: RenderObject): number; + /** + * Creates a node builder configured for the given render object and material. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {Material} material - The material to use. + * @return {NodeBuilder} The configured node builder. + */ + private _createNodeBuilder; + /** + * Returns a node builder state for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {boolean} [useAsync=false] - Whether to use async build with yielding. + * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). + */ + getForRender(renderObject: RenderObject, useAsync?: boolean): NodeBuilderState | Promise; + /** + * Async version of getForRender() that yields to main thread during build. + * Use this in compileAsync() to prevent blocking the main thread. + * + * @param {RenderObject} renderObject - The render object. + * @return {Promise} A promise that resolves to the node builder state. + */ + getForRenderAsync(renderObject: RenderObject): Promise; + /** + * Returns nodeBuilderState if ready, null if pending async build. + * Queues async build on first call for cache miss. + * Use this in render() path to enable non-blocking compilation. + * + * @param {RenderObject} renderObject - The render object. + * @return {?NodeBuilderState} The node builder state, or null if still building. + */ + getForRenderDeferred(renderObject: RenderObject): NodeBuilderState | null; + /** + * Processes the build queue one item at a time. + * This ensures builds don't all run simultaneously and freeze the main thread. + * + * @private + */ + private _processBuildQueue; + /** + * Deletes the given object from the internal data map + * + * @param {any} object - The object to delete. + * @return {?Object} The deleted dictionary. + */ + delete(object: any): Object | null; + /** + * Returns a node builder state for the given compute node. + * + * @param {Node} computeNode - The compute node. + * @param {boolean} [useAsync=false] - Whether to use async build with yielding. + * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). + */ + getForCompute(computeNode: Node, useAsync?: boolean): NodeBuilderState | Promise; + /** + * Async version of getForCompute() that yields to main thread during build. + * Use this in compileComputeAsync() to prevent blocking the main thread. + * + * @param {Node} computeNode - The compute node. + * @return {Promise} A promise that resolves to the node builder state. + */ + getForComputeAsync(computeNode: Node): Promise; + /** + * Creates a node builder state for the given node builder. + * + * @private + * @param {NodeBuilder} nodeBuilder - The node builder. + * @return {NodeBuilderState} The node builder state. + */ + private _createNodeBuilderState; + /** + * Returns an environment node for the current configured + * scene environment. + * + * @param {Scene} scene - The scene. + * @return {Node} A node representing the current scene environment. + */ + getEnvironmentNode(scene: Scene): Node; + /** + * Returns a background node for the current configured + * scene background. + * + * @param {Scene} scene - The scene. + * @return {Node} A node representing the current scene background. + */ + getBackgroundNode(scene: Scene): Node; + /** + * Returns a fog node for the current configured scene fog. + * + * @param {Scene} scene - The scene. + * @return {Node} A node representing the current scene fog. + */ + getFogNode(scene: Scene): Node; + /** + * Returns a cache key for the given scene and lights node. + * This key is used by `RenderObject` as a part of the dynamic + * cache key (a key that must be checked every time the render + * objects is drawn). + * + * @param {Scene} scene - The scene. + * @param {LightsNode} lightsNode - The lights node. + * @return {number} The cache key. + */ + getCacheKey(scene: Scene, lightsNode: LightsNode): number; + /** + * A boolean that indicates whether tone mapping should be enabled + * or not. + * + * @type {boolean} + */ + get isToneMappingState(): boolean; + /** + * If a scene background is configured, this method makes sure to + * represent the background with a corresponding node-based implementation. + * + * @param {Scene} scene - The scene. + */ + updateBackground(scene: Scene): void; + /** + * This method is part of the caching of nodes which are used to represents the + * scene's background, fog or environment. + * + * @param {string} type - The type of object to cache. + * @param {Object} object - The object. + * @param {Function} callback - A callback that produces a node representation for the given object. + * @param {boolean} [forceUpdate=false] - Whether an update should be enforced or not. + * @return {Node} The node representation. + */ + getCacheNode(type: string, object: Object, callback: Function, forceUpdate?: boolean): Node; + /** + * If a scene fog is configured, this method makes sure to + * represent the fog with a corresponding node-based implementation. + * + * @param {Scene} scene - The scene. + */ + updateFog(scene: Scene): void; + /** + * If a scene environment is configured, this method makes sure to + * represent the environment with a corresponding node-based implementation. + * + * @param {Scene} scene - The scene. + */ + updateEnvironment(scene: Scene): void; + getNodeFrame(renderer?: Renderer, scene?: null, object?: null, camera?: null, material?: null): Renderer; + getNodeFrameForRender(renderObject: any): Renderer; + /** + * Returns the current output cache key. + * + * @return {string} The output cache key. + */ + getOutputCacheKey(): string; + /** + * Returns a node that represents the output configuration (tone mapping and + * color space) for the current target. + * + * @param {Texture} outputTarget - The output target. + * @return {Node} The output node. + */ + getOutputNode(outputTarget: Texture): Node; + /** + * Sets the output layer index for array texture output pass. + * This should be called before each layer render during the output pass. + * + * @param {number} index - The layer index. + */ + setOutputLayerIndex(index: number): void; + /** + * Triggers the call of `updateBefore()` methods + * for all nodes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateBefore(renderObject: RenderObject): void; + /** + * Triggers the call of `updateAfter()` methods + * for all nodes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateAfter(renderObject: RenderObject): void; + /** + * Triggers the call of `update()` methods + * for all nodes of the given compute node. + * + * @param {Node} computeNode - The compute node. + */ + updateForCompute(computeNode: Node): void; + /** + * Triggers the call of `update()` methods + * for all nodes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateForRender(renderObject: RenderObject): void; + /** + * Returns the refresh type of the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {number} The refresh type, see `RenderObjectRefreshType`. + */ + needsRefresh(renderObject: RenderObject): number; +} +/** + * This renderer module manages geometries. + * + * @private + * @augments DataMap + */ +declare class Geometries extends DataMap { + /** + * Constructs a new geometry management component. + * + * @param {Attributes} attributes - Renderer component for managing attributes. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(attributes: Attributes, info: Info); + /** + * Renderer component for managing attributes. + * + * @type {Attributes} + */ + attributes: Attributes; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * Weak Map for managing attributes for wireframe rendering. + * + * @type {WeakMap} + */ + wireframes: WeakMap; + /** + * This Weak Map is used to make sure buffer attributes are + * updated only once per render call. + * + * @type {WeakMap} + */ + attributeCall: WeakMap; + /** + * Stores the event listeners attached to geometries. + * + * @private + * @type {Map} + */ + private _geometryDisposeListeners; + /** + * Returns `true` if the given render object has an initialized geometry. + * + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether if the given render object has an initialized geometry or not. + */ + has(renderObject: RenderObject): boolean; + /** + * Prepares the geometry of the given render object for rendering. + * + * @param {RenderObject} renderObject - The render object. + */ + updateForRender(renderObject: RenderObject): void; + /** + * Initializes the geometry of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + initGeometry(renderObject: RenderObject): void; + /** + * Updates the geometry attributes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateAttributes(renderObject: RenderObject): void; + /** + * Updates the given attribute. + * + * @param {BufferAttribute} attribute - The attribute to update. + * @param {number} type - The attribute type. + */ + updateAttribute(attribute: BufferAttribute, type: number): void; + /** + * Returns the indirect buffer attribute of the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. + */ + getIndirect(renderObject: RenderObject): BufferAttribute | null; + /** + * Returns the byte offset into the indirect attribute buffer of the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {number} The byte offset into the indirect attribute buffer. + */ + getIndirectOffset(renderObject: RenderObject): number; + /** + * Returns the index of the given render object's geometry. This is implemented + * in a method to return a wireframe index if necessary. + * + * @param {RenderObject} renderObject - The render object. + * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. + */ + getIndex(renderObject: RenderObject): BufferAttribute | null; +} +/** + * Represents a uniform buffer binding type. + * + * @private + * @augments Buffer + */ +declare class UniformBuffer extends Buffer { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformBuffer: boolean; +} +/** + * Abstract class for representing pipelines. + * + * @private + * @abstract + */ +declare class Pipeline { + /** + * Constructs a new pipeline. + * + * @param {string} cacheKey - The pipeline's cache key. + */ + constructor(cacheKey: string); + /** + * The pipeline's cache key. + * + * @type {string} + */ + cacheKey: string; + /** + * How often the pipeline is currently in use. + * + * @type {number} + * @default 0 + */ + usedTimes: number; +} +/** + * A WebGPU backend utility module used by {@link WebGPUTextureUtils}. + * + * @private + */ +declare class WebGPUTexturePassUtils extends DataMap { + /** + * Constructs a new utility object. + * + * @param {GPUDevice} device - The WebGPU device. + */ + constructor(device: GPUDevice); + /** + * The WebGPU device. + * + * @type {GPUDevice} + */ + device: GPUDevice; + /** + * The mipmap GPU sampler. + * + * @type {GPUSampler} + */ + mipmapSampler: GPUSampler; + /** + * The flipY GPU sampler. + * + * @type {GPUSampler} + */ + flipYSampler: GPUSampler; + flipUniformBuffer: GPUBuffer; + noFlipUniformBuffer: GPUBuffer; + /** + * A cache for GPU render pipelines used for copy/transfer passes. + * Every texture format and textureBindingViewDimension combo requires a unique pipeline. + * + * @type {Object} + */ + transferPipelines: { + [x: string]: GPURenderPipeline; + }; + mipmapShaderModule: GPUShaderModule; + /** + * Returns a render pipeline for the internal copy render pass. The pass + * requires a unique render pipeline for each texture format. + * + * @param {string} format - The GPU texture format + * @param {string?} textureBindingViewDimension - The GPU texture binding view dimension + * @return {GPURenderPipeline} The GPU render pipeline. + */ + getTransferPipeline(format: string, textureBindingViewDimension: string | null): GPURenderPipeline; + /** + * Flip the contents of the given GPU texture along its vertical axis. + * + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {Object} textureGPUDescriptor - The texture descriptor. + * @param {number} [baseArrayLayer=0] - The index of the first array layer accessible to the texture view. + */ + flipY(textureGPU: GPUTexture, textureGPUDescriptor: Object, baseArrayLayer?: number): void; + /** + * Generates mipmaps for the given GPU texture. + * + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. + */ + generateMipmaps(textureGPU: GPUTexture, encoder?: GPUCommandEncoder | null): void; + /** + * Since multiple copy render passes are required to generate mipmaps, the passes + * are managed as render bundles to improve performance. + * + * @param {GPUTexture} textureGPU - The GPU texture object. + * @return {Array} An array of render bundles. + */ + _mipmapCreateBundles(textureGPU: GPUTexture): Array; + /** + * Executes the render bundles. + * + * @param {GPUCommandEncoder} commandEncoder - The GPU command encoder. + * @param {Array} passes - An array of render bundles. + */ + _mipmapRunBundles(commandEncoder: GPUCommandEncoder, passes: Array): void; +} +/** + * Represents a Number uniform. + * + * @private + * @augments Uniform + */ +declare class NumberUniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {number} value - The uniform's value. + */ + constructor(name: string, value?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNumberUniform: boolean; +} +/** + * Represents a Vector2 uniform. + * + * @private + * @augments Uniform + */ +declare class Vector2Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Vector2} value - The uniform's value. + */ + constructor(name: string, value?: Vector2); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVector2Uniform: boolean; +} +/** + * Represents a Vector3 uniform. + * + * @private + * @augments Uniform + */ +declare class Vector3Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Vector3} value - The uniform's value. + */ + constructor(name: string, value?: Vector3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVector3Uniform: boolean; +} +/** + * Represents a Vector4 uniform. + * + * @private + * @augments Uniform + */ +declare class Vector4Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Vector4} value - The uniform's value. + */ + constructor(name: string, value?: Vector4); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVector4Uniform: boolean; +} +/** + * Represents a Color uniform. + * + * @private + * @augments Uniform + */ +declare class ColorUniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Color} value - The uniform's value. + */ + constructor(name: string, value?: Color); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isColorUniform: boolean; +} +/** + * Represents a Matrix3 uniform. + * + * @private + * @augments Uniform + */ +declare class Matrix3Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Matrix3} value - The uniform's value. + */ + constructor(name: string, value?: Matrix3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMatrix3Uniform: boolean; +} +/** + * Represents a Matrix4 uniform. + * + * @private + * @augments Uniform + */ +declare class Matrix4Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Matrix4} value - The uniform's value. + */ + constructor(name: string, value?: Matrix4); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMatrix4Uniform: boolean; +} +/** + * Data structure for the renderer. It is intended to manage + * data of objects in dictionaries. + * + * @private + */ +declare class DataMap { + /** + * `DataMap` internally uses a weak map + * to manage its data. + * + * @type {WeakMap} + */ + data: WeakMap; + /** + * Returns the dictionary for the given object. + * + * @param {Object} object - The object. + * @return {Object} The dictionary. + */ + get(object: Object): Object; + /** + * Deletes the dictionary for the given object. + * + * @param {Object} object - The object. + * @return {?Object} The deleted dictionary. + */ + delete(object: Object): Object | null; + /** + * Returns `true` if the given object has a dictionary defined. + * + * @param {Object} object - The object to test. + * @return {boolean} Whether a dictionary is defined or not. + */ + has(object: Object): boolean; + /** + * Frees internal resources. + */ + dispose(): void; +} +/** + * Data structure for the renderer. It allows defining values + * with chained, hierarchical keys. Keys are meant to be + * objects since the module internally works with Weak Maps + * for performance reasons. + * + * @private + */ +declare class ChainMap { + /** + * A map of Weak Maps by their key length. + * + * @type {Object} + */ + weakMaps: { + [x: number]: WeakMap; + }; + /** + * Returns the Weak Map for the given keys. + * + * @param {Array} keys - List of keys. + * @return {WeakMap} The weak map. + */ + _getWeakMap(keys: Array): WeakMap; + /** + * Returns the value for the given array of keys. + * + * @param {Array} keys - List of keys. + * @return {any} The value. Returns `undefined` if no value was found. + */ + get(keys: Array): any; + /** + * Sets the value for the given keys. + * + * @param {Array} keys - List of keys. + * @param {any} value - The value to set. + * @return {ChainMap} A reference to this Chain Map. + */ + set(keys: Array, value: any): ChainMap; + /** + * Deletes a value for the given keys. + * + * @param {Array} keys - The keys. + * @return {boolean} Returns `true` if the value has been removed successfully and `false` if the value has not be found. + */ + delete(keys: Array): boolean; +} +/** + * This renderer module manages geometry attributes. + * + * @private + * @augments DataMap + */ +declare class Attributes extends DataMap { + /** + * Constructs a new attribute management component. + * + * @param {Backend} backend - The renderer's backend. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(backend: Backend, info: Info); + /** + * The renderer's backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * Deletes the data for the given attribute. + * + * @param {BufferAttribute} attribute - The attribute. + * @return {?Object} The deleted attribute data. + */ + delete(attribute: BufferAttribute): Object | null; + /** + * Updates the given attribute. This method creates attribute buffers + * for new attributes and updates data for existing ones. + * + * @param {BufferAttribute} attribute - The attribute to update. + * @param {number} type - The attribute type. + */ + update(attribute: BufferAttribute, type: number): void; + /** + * Utility method for handling interleaved buffer attributes correctly. + * To process them, their `InterleavedBuffer` is returned. + * + * @param {BufferAttribute} attribute - The attribute. + * @return {BufferAttribute|InterleavedBuffer} + */ + _getBufferAttribute(attribute: BufferAttribute): BufferAttribute | InterleavedBuffer; +} +export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, ArrayCamera, BackSide, BasicShadowMap, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, Compatibility, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CylinderGeometry, DataArrayTexture, DataTexture, DecrementStencilOp, DecrementWrapStencilOp, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicDrawUsage, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, FramebufferTexture, FrontSide, Frustum, FrustumArray, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, Group, HalfFloatType, HemisphereLight, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedInterleavedBuffer, IntType, InterleavedBuffer, InterleavedBufferAttribute, InvertStencilOp, KeepStencilOp, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, LightProbe, LineBasicMaterial, LineDashedMaterial, LinearFilter, LinearMipMapLinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, Object3D, ObjectLoader, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PerspectiveCamera, Plane, PlaneGeometry, PointLight, PointsMaterial, Quaternion, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderObjectRefreshType, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShadowMaterial, ShortType, Sphere, SphereGeometry, SpotLight, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticDrawUsage, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, TimestampQuery, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGPUCoordinateSystem, WebXRController, ZeroFactor, ZeroStencilOp, createCanvasElement, error, log$1 as log, warn, warnOnce }; +export { AdditiveAnimationBlendMode, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CustomToneMapping, Cylindrical, Data3DTexture, DataTextureLoader, DataUtils, DefaultLoadingManager, DetachedBindMode, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, Euler, ExternalTexture, ExtrudeGeometry, Fog, FogExp2, GLBufferAttribute, GLSL1, GLSL3, GridHelper, HTMLTexture, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, InstancedBufferGeometry, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, KeyframeTrack, LOD, LatheGeometry, Layers, Light, Line, Line3, LineCurve, LineCurve3, LineLoop, LineSegments, LinearInterpolant, LinearMipMapNearestFilter, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, MeshDepthMaterial, MeshDistanceMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NormalAnimationBlendMode, NumberKeyframeTrack, OctahedronGeometry, Path, PlaneHelper, PointLightHelper, Points, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RenderTarget3D, RingGeometry, ShaderMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Spherical, SphericalHarmonics3, SplineCurve, SpotLightHelper, Sprite, StaticCopyUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SunLight, TOUCH, TetrahedronGeometry, TextureLoader, TextureSource, TextureUtils, Timer, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLRenderTarget, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, getConsoleFunction, setConsoleFunction } from "./three.core.js"; diff --git a/jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts b/jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts new file mode 100644 index 000000000..4c5bd3dc3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts @@ -0,0 +1,275 @@ +export * from "./animation/AnimationClipCreator.js"; +export * from "./animation/CCDIKSolver.js"; +export * from "./controls/ArcballControls.js"; +export * from "./controls/DragControls.js"; +export * from "./controls/FirstPersonControls.js"; +export * from "./controls/FlyControls.js"; +export * from "./controls/MapControls.js"; +export * from "./controls/OrbitControls.js"; +export * from "./controls/PointerLockControls.js"; +export * from "./controls/TrackballControls.js"; +export * from "./controls/TransformControls.js"; +export * from "./csm/CSM.js"; +export * from "./csm/CSMFrustum.js"; +export * from "./csm/CSMHelper.js"; +export * from "./csm/CSMShader.js"; +export * from "./curves/NURBSCurve.js"; +export * from "./curves/NURBSSurface.js"; +export * from "./curves/NURBSVolume.js"; +export * from "./effects/AnaglyphEffect.js"; +export * from "./effects/AsciiEffect.js"; +export * from "./effects/OutlineEffect.js"; +export * from "./effects/ParallaxBarrierEffect.js"; +export * from "./effects/StereoEffect.js"; +export * from "./environments/ColorEnvironment.js"; +export * from "./environments/DebugEnvironment.js"; +export * from "./environments/RoomEnvironment.js"; +export * from "./exporters/DRACOExporter.js"; +export * from "./exporters/EXRExporter.js"; +export * from "./exporters/GLTFExporter.js"; +export * from "./exporters/KTX2Exporter.js"; +export * from "./exporters/OBJExporter.js"; +export * from "./exporters/PLYExporter.js"; +export * from "./exporters/STLExporter.js"; +export * from "./exporters/USDZExporter.js"; +export * from "./geometries/BoxLineGeometry.js"; +export * from "./geometries/ConvexGeometry.js"; +export * from "./geometries/DecalGeometry.js"; +export * from "./geometries/LoftGeometry.js"; +export * from "./geometries/ParametricFunctions.js"; +export * from "./geometries/ParametricGeometry.js"; +export * from "./geometries/RoundedBoxGeometry.js"; +export * from "./geometries/TeapotGeometry.js"; +export * from "./geometries/TextGeometry.js"; +export * from "./helpers/AnimationPathHelper.js"; +export * from "./helpers/LightProbeHelper.js"; +export * from "./helpers/OctreeHelper.js"; +export * from "./helpers/PositionalAudioHelper.js"; +export * from "./helpers/RapierHelper.js"; +export * from "./helpers/RectAreaLightHelper.js"; +export * from "./helpers/TextureHelper.js"; +export * from "./helpers/VertexNormalsHelper.js"; +export * from "./helpers/VertexTangentsHelper.js"; +export * from "./helpers/ViewHelper.js"; +export * from "./interactive/HTMLMesh.js"; +export * from "./interactive/InteractiveGroup.js"; +export * from "./interactive/SelectionBox.js"; +export * from "./interactive/SelectionHelper.js"; +export * from "./lights/LightProbeGenerator.js"; +export * from "./lights/RectAreaLightTexturesLib.js"; +export * from "./lights/RectAreaLightUniformsLib.js"; +export * from "./lines/Line2.js"; +export * from "./lines/LineGeometry.js"; +export * from "./lines/LineMaterial.js"; +export * from "./lines/LineSegments2.js"; +export * from "./lines/LineSegmentsGeometry.js"; +export * from "./lines/Wireframe.js"; +export * from "./lines/WireframeGeometry2.js"; +export * from "./loaders/3DMLoader.js"; +export * from "./loaders/3MFLoader.js"; +export * from "./loaders/AMFLoader.js"; +export * from "./loaders/BVHLoader.js"; +export * from "./loaders/ColladaLoader.js"; +export * from "./loaders/DDSLoader.js"; +export * from "./loaders/DRACOLoader.js"; +export * from "./loaders/EXRLoader.js"; +export * from "./loaders/FBXLoader.js"; +export * from "./loaders/FontLoader.js"; +export * from "./loaders/GCodeLoader.js"; +export * from "./loaders/GLTFGaussianSplatLoaderExtension.js"; +export * from "./loaders/GLTFLoader.js"; +export * from "./loaders/HDRLoader.js"; +export * from "./loaders/HDRCubeTextureLoader.js"; +export * from "./loaders/IESLoader.js"; +export * from "./loaders/KMZLoader.js"; +export * from "./loaders/KSPLATLoader.js"; +export * from "./loaders/KTX2Loader.js"; +export * from "./loaders/KTXLoader.js"; +export * from "./loaders/LDrawLoader.js"; +export * from "./loaders/LUT3dlLoader.js"; +export * from "./loaders/LUTCubeLoader.js"; +export * from "./loaders/LUTImageLoader.js"; +export * from "./loaders/LWOLoader.js"; +export * from "./loaders/MD2Loader.js"; +export * from "./loaders/MDDLoader.js"; +export * from "./loaders/MTLLoader.js"; +export * from "./loaders/NRRDLoader.js"; +export * from "./loaders/OBJLoader.js"; +export * from "./loaders/PCDLoader.js"; +export * from "./loaders/PDBLoader.js"; +export * from "./loaders/PLYLoader.js"; +export * from "./loaders/PVRLoader.js"; +export * from "./loaders/RGBELoader.js"; +export * from "./loaders/SPLATLoader.js"; +export * from "./loaders/SPZLoader.js"; +export * from "./loaders/UltraHDRLoader.js"; +export * from "./loaders/STLLoader.js"; +export * from "./loaders/SVGLoader.js"; +export * from "./loaders/TDSLoader.js"; +export * from "./loaders/TGALoader.js"; +export * from "./loaders/TIFFLoader.js"; +export * from "./loaders/TTFLoader.js"; +export * from "./loaders/USDLoader.js"; +export * from "./loaders/VOXLoader.js"; +export * from "./loaders/VRMLLoader.js"; +export * from "./loaders/VTKLoader.js"; +export * from "./loaders/XYZLoader.js"; +export * from "./materials/LDrawConditionalLineMaterial.js"; +export * from "./math/Capsule.js"; +export * from "./math/ColorConverter.js"; +export * from "./math/ConvexHull.js"; +export * from "./math/ImprovedNoise.js"; +export * from "./math/Lut.js"; +export * from "./math/MeshSurfaceSampler.js"; +export * from "./math/OBB.js"; +export * from "./math/Octree.js"; +export * from "./math/SimplexNoise.js"; +export * from "./misc/ConvexObjectBreaker.js"; +export * from "./misc/GPUComputationRenderer.js"; +export * from "./misc/Gyroscope.js"; +export * from "./misc/MD2Character.js"; +export * from "./misc/MD2CharacterComplex.js"; +export * from "./misc/MorphAnimMesh.js"; +export * from "./misc/MorphBlendMesh.js"; +export * from "./misc/ProgressiveLightMap.js"; +export * from "./misc/RollerCoaster.js"; +export * from "./misc/TileCreasedNormalsPlugin.js"; +export * from "./misc/TubePainter.js"; +export * from "./misc/Volume.js"; +export * from "./misc/VolumeSlice.js"; +export * from "./modifiers/CurveModifier.js"; +export * from "./modifiers/EdgeSplitModifier.js"; +export * from "./modifiers/SimplifyModifier.js"; +export * from "./modifiers/TessellateModifier.js"; +export * from "./objects/GroundedSkybox.js"; +export * from "./objects/GaussianSplat.js"; +export * from "./objects/Lensflare.js"; +export * from "./objects/MarchingCubes.js"; +export * from "./objects/Reflector.js"; +export * from "./objects/ReflectorForSSRPass.js"; +export * from "./objects/Refractor.js"; +export * from "./objects/ShadowMesh.js"; +export * from "./objects/Sky.js"; +export * from "./objects/Water.js"; +export * from "./physics/AmmoPhysics.js"; +export * from "./physics/JoltPhysics.js"; +export * from "./physics/RapierPhysics.js"; +export * from "./postprocessing/AfterimagePass.js"; +export * from "./postprocessing/BloomPass.js"; +export * from "./postprocessing/BokehPass.js"; +export * from "./postprocessing/ClearPass.js"; +export * from "./postprocessing/CubeTexturePass.js"; +export * from "./postprocessing/DotScreenPass.js"; +export * from "./postprocessing/EffectComposer.js"; +export * from "./postprocessing/FXAAPass.js"; +export * from "./postprocessing/FilmPass.js"; +export * from "./postprocessing/GlitchPass.js"; +export * from "./postprocessing/GTAOPass.js"; +export * from "./postprocessing/HalftonePass.js"; +export * from "./postprocessing/LUTPass.js"; +export * from "./postprocessing/MaskPass.js"; +export * from "./postprocessing/OutlinePass.js"; +export * from "./postprocessing/OutputPass.js"; +export * from "./postprocessing/Pass.js"; +export * from "./postprocessing/RenderPass.js"; +export * from "./postprocessing/RenderPixelatedPass.js"; +export * from "./postprocessing/RenderTransitionPass.js"; +export * from "./postprocessing/SAOPass.js"; +export * from "./postprocessing/SMAAPass.js"; +export * from "./postprocessing/SSAARenderPass.js"; +export * from "./postprocessing/SSAOPass.js"; +export * from "./postprocessing/SSRPass.js"; +export * from "./postprocessing/SavePass.js"; +export * from "./postprocessing/ShaderPass.js"; +export * from "./postprocessing/TAARenderPass.js"; +export * from "./postprocessing/TexturePass.js"; +export * from "./postprocessing/UnrealBloomPass.js"; +export * from "./renderers/CSS2DRenderer.js"; +export * from "./renderers/CSS3DRenderer.js"; +export * from "./renderers/Projector.js"; +export * from "./renderers/SVGRenderer.js"; +export * from "./shaders/ACESFilmicToneMappingShader.js"; +export * from "./shaders/AfterimageShader.js"; +export * from "./shaders/BasicShader.js"; +export * from "./shaders/BleachBypassShader.js"; +export * from "./shaders/BlendShader.js"; +export * from "./shaders/BokehShader.js"; +export * from "./shaders/BrightnessContrastShader.js"; +export * from "./shaders/ColorCorrectionShader.js"; +export * from "./shaders/ColorifyShader.js"; +export * from "./shaders/ConvolutionShader.js"; +export * from "./shaders/CopyShader.js"; +export * from "./shaders/DOFMipMapShader.js"; +export * from "./shaders/DepthLimitedBlurShader.js"; +export * from "./shaders/DigitalGlitch.js"; +export * from "./shaders/DotScreenShader.js"; +export * from "./shaders/ExposureShader.js"; +export * from "./shaders/FXAAShader.js"; +export * from "./shaders/FilmShader.js"; +export * from "./shaders/FocusShader.js"; +export * from "./shaders/FreiChenShader.js"; +export * from "./shaders/GammaCorrectionShader.js"; +export * from "./shaders/GTAOShader.js"; +export * from "./shaders/HalftoneShader.js"; +export * from "./shaders/HorizontalBlurShader.js"; +export * from "./shaders/HorizontalTiltShiftShader.js"; +export * from "./shaders/HueSaturationShader.js"; +export * from "./shaders/KaleidoShader.js"; +export * from "./shaders/LuminosityHighPassShader.js"; +export * from "./shaders/LuminosityShader.js"; +export * from "./shaders/MirrorShader.js"; +export * from "./shaders/NormalMapShader.js"; +export * from "./shaders/OutputShader.js"; +export * from "./shaders/PoissonDenoiseShader.js"; +export * from "./shaders/RGBShiftShader.js"; +export * from "./shaders/SAOShader.js"; +export * from "./shaders/SMAAShader.js"; +export * from "./shaders/SSAOShader.js"; +export * from "./shaders/SSRShader.js"; +export * from "./shaders/SepiaShader.js"; +export * from "./shaders/SobelOperatorShader.js"; +export * from "./shaders/SubsurfaceScatteringShader.js"; +export * from "./shaders/TechnicolorShader.js"; +export * from "./shaders/ToonShader.js"; +export * from "./shaders/TriangleBlurShader.js"; +export * from "./shaders/UnpackDepthRGBAShader.js"; +export * from "./shaders/VelocityShader.js"; +export * from "./shaders/VerticalBlurShader.js"; +export * from "./shaders/VerticalTiltShiftShader.js"; +export * from "./shaders/VignetteShader.js"; +export * from "./shaders/VolumeShader.js"; +export * from "./shaders/WaterRefractionShader.js"; +export * from "./textures/FlakesTexture.js"; +export * from "./utils/LDrawUtils.js"; +export * from "./utils/SceneOptimizer.js"; +export * from "./utils/ShadowMapViewer.js"; +export * from "./utils/WebGLTextureUtils.js"; +export * from "./utils/UVsDebug.js"; +export * from "./utils/WorkerPool.js"; +export * from "./webxr/ARButton.js"; +export * from "./webxr/OculusHandModel.js"; +export * from "./webxr/OculusHandPointerModel.js"; +export * from "./webxr/Text2D.js"; +export * from "./webxr/VRButton.js"; +export * from "./webxr/WebGLXRFallback.js"; +export * from "./webxr/XRButton.js"; +export * from "./webxr/XRControllerModelFactory.js"; +export * from "./webxr/XREstimatedLight.js"; +export * from "./webxr/XRHandMeshModel.js"; +export * from "./webxr/XRHandModelFactory.js"; +export * from "./webxr/XRHandPrimitiveModel.js"; +export * from "./webxr/XRPlanes.js"; +export { default as WebGL } from "./capabilities/WebGL.js"; +export * as Curves from "./curves/CurveExtras.js"; +export * as NURBSUtils from "./curves/NURBSUtils.js"; +export * as ColorSpaces from "./math/ColorSpaces.js"; +export { Water as Water2 } from "./objects/Water2.js"; +export { BokehShader as BokehShader2 } from "./shaders/BokehShader2.js"; +export * as BufferGeometryUtils from "./utils/BufferGeometryUtils.js"; +export * as CameraUtils from "./utils/CameraUtils.js"; +export * as ColorUtils from "./utils/ColorUtils.js"; +export * as GeometryCompressionUtils from "./utils/GeometryCompressionUtils.js"; +export * as GeometryUtils from "./utils/GeometryUtils.js"; +export * as SceneUtils from "./utils/SceneUtils.js"; +export * as SkeletonUtils from "./utils/SkeletonUtils.js"; +export * as SortUtils from "./utils/SortUtils.js"; diff --git a/jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts new file mode 100644 index 000000000..11c23e792 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts @@ -0,0 +1,62 @@ +/** + * A utility class with factory methods for creating basic animation clips. + * + * @hideconstructor + * @three_import import { AnimationClipCreator } from 'three/addons/animation/AnimationClipCreator.js'; + */ +export class AnimationClipCreator { + /** + * Creates an animation clip that rotates a 3D object 360 degrees + * in the given period of time around the given axis. + * + * @param {number} period - The duration of the animation. + * @param {('x'|'y'|'z')} [axis='x'] - The axis of rotation. + * @return {AnimationClip} The created animation clip. + */ + static CreateRotationAnimation(period: number, axis?: ("x" | "y" | "z")): AnimationClip; + /** + * Creates an animation clip that scales a 3D object from `0` to `1` + * in the given period of time along the given axis. + * + * @param {number} period - The duration of the animation. + * @param {('x'|'y'|'z')} [axis='x'] - The axis to scale the 3D object along. + * @return {AnimationClip} The created animation clip. + */ + static CreateScaleAxisAnimation(period: number, axis?: ("x" | "y" | "z")): AnimationClip; + /** + * Creates an animation clip that translates a 3D object in a shake pattern + * in the given period. + * + * @param {number} duration - The duration of the animation. + * @param {Vector3} shakeScale - The scale of the shake. + * @return {AnimationClip} The created animation clip. + */ + static CreateShakeAnimation(duration: number, shakeScale: Vector3): AnimationClip; + /** + * Creates an animation clip that scales a 3D object in a pulse pattern + * in the given period. + * + * @param {number} duration - The duration of the animation. + * @param {number} pulseScale - The scale of the pulse. + * @return {AnimationClip} The created animation clip. + */ + static CreatePulsationAnimation(duration: number, pulseScale: number): AnimationClip; + /** + * Creates an animation clip that toggles the visibility of a 3D object. + * + * @param {number} duration - The duration of the animation. + * @return {AnimationClip} The created animation clip. + */ + static CreateVisibilityAnimation(duration: number): AnimationClip; + /** + * Creates an animation clip that animates the `color` property of a 3D object's + * material. + * + * @param {number} duration - The duration of the animation. + * @param {Array} colors - An array of colors that should be sequentially animated. + * @return {AnimationClip} The created animation clip. + */ + static CreateMaterialColorAnimation(duration: number, colors: Array): AnimationClip; +} +import { AnimationClip } from 'three'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts b/jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts new file mode 100644 index 000000000..a66b1fd70 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts @@ -0,0 +1,147 @@ +/** + * ~IK + */ +export type CCDIKSolver = { + /** + * - The target bone index which refers to a bone in the `Skeleton.bones` array. + */ + target: number; + /** + * - The effector bone index which refers to a bone in the `Skeleton.bones` array. + */ + effector: number; + /** + * ~BoneLink>} links - An array of bone links. + */ + "": Array; + /** + * - Iteration number of calculation. Smaller is faster but less precise. + */ + iteration?: number | undefined; + /** + * - Minimum rotation angle in a step in radians. + */ + minAngle?: number | undefined; + /** + * - Minimum rotation angle in a step in radians. + */ + maxAngle?: number | undefined; + /** + * - The blend factor. + */ + blendFactor?: number | undefined; +}; +/** + * This class solves the Inverse Kinematics Problem with a [CCD Algorithm](https://web.archive.org/web/20221206080850/https://sites.google.com/site/auraliusproject/ccd-algorithm). + * + * `CCDIKSolver` is designed to work with instances of {@link SkinnedMesh}. + * + * @three_import import { CCDIKSolver } from 'three/addons/animation/CCDIKSolver.js'; + */ +export class CCDIKSolver { + /** + * @param {SkinnedMesh} mesh - The skinned mesh. + * @param {Array} [iks=[]] - The IK objects. + */ + constructor(mesh: SkinnedMesh, iks?: any[]); + /** + * The skinned mesh. + * + * @type {SkinnedMesh} + */ + mesh: SkinnedMesh; + /** + * The IK objects. + * + * @type {Array} + */ + iks: Array; + _initialQuaternions: Quaternion[][]; + _workingQuaternion: Quaternion; + /** + * Updates all IK bones by solving the CCD algorithm. + * + * @param {number} [globalBlendFactor=1.0] - Blend factor applied if an IK chain doesn't have its own .blendFactor. + * @return {CCDIKSolver} A reference to this instance. + */ + update(globalBlendFactor?: number): CCDIKSolver; + /** + * Updates one IK bone solving the CCD algorithm. + * + * @param {CCDIKSolver~IK} ik - The IK to update. + * @param {number} [overrideBlend=1.0] - If the IK object does not define `blendFactor`, this value is used. + * @return {CCDIKSolver} A reference to this instance. + */ + updateOne(ik: any, overrideBlend?: number): CCDIKSolver; + /** + * Creates a helper for visualizing the CCDIK. + * + * @param {number} sphereSize - The sphere size. + * @return {CCDIKHelper} The created helper. + */ + createHelper(sphereSize: number): CCDIKHelper; + _valid(): void; +} +/** + * Helper for visualizing IK bones. + * + * @augments Object3D + * @three_import import { CCDIKHelper } from 'three/addons/animation/CCDIKSolver.js'; + */ +export class CCDIKHelper extends Object3D { + /** + * @param {SkinnedMesh} mesh - The skinned mesh. + * @param {Array} [iks=[]] - The IK objects. + * @param {number} [sphereSize=0.25] - The sphere size. + */ + constructor(mesh: SkinnedMesh, iks?: any[], sphereSize?: number); + /** + * The skinned mesh this helper refers to. + * + * @type {SkinnedMesh} + */ + root: SkinnedMesh; + /** + * The IK objects. + * + * @type {Array} + */ + iks: Array; + /** + * The helpers sphere geometry. + * + * @type {SphereGeometry} + */ + sphereGeometry: SphereGeometry; + /** + * The material for the target spheres. + * + * @type {MeshBasicMaterial} + */ + targetSphereMaterial: MeshBasicMaterial; + /** + * The material for the effector spheres. + * + * @type {MeshBasicMaterial} + */ + effectorSphereMaterial: MeshBasicMaterial; + /** + * The material for the link spheres. + * + * @type {MeshBasicMaterial} + */ + linkSphereMaterial: MeshBasicMaterial; + /** + * A global line material. + * + * @type {LineBasicMaterial} + */ + lineMaterial: LineBasicMaterial; + updateMatrixWorld(force: any): void; + _init(): void; +} +import { Quaternion } from 'three'; +import { Object3D } from 'three'; +import { SphereGeometry } from 'three'; +import { MeshBasicMaterial } from 'three'; +import { LineBasicMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts b/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts new file mode 100644 index 000000000..7a5082970 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts @@ -0,0 +1,31 @@ +export default WebGL; +/** + * A utility module with basic WebGL 2 capability testing. + * + * @hideconstructor + * @three_import import WebGL from 'three/addons/capabilities/WebGL.js'; + */ +declare class WebGL { + /** + * Returns `true` if WebGL 2 is available. + * + * @return {boolean} Whether WebGL 2 is available or not. + */ + static isWebGL2Available(): boolean; + /** + * Returns `true` if the given color space is available. This method can only be used + * if WebGL 2 is supported. + * + * @param {string} colorSpace - The color space to test. + * @return {boolean} Whether the given color space is available or not. + */ + static isColorSpaceAvailable(colorSpace: string): boolean; + /** + * Returns a `div` element representing a formatted error message that can be appended in + * web sites if WebGL 2 isn't supported. + * + * @return {HTMLDivElement} A `div` element representing a formatted error message that WebGL 2 isn't supported. + */ + static getWebGL2ErrorMessage(): HTMLDivElement; + static _getErrorMessage(version: any): HTMLDivElement; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts new file mode 100644 index 000000000..410375a5f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts @@ -0,0 +1,22 @@ +export default WebGPU; +/** + * A utility module with basic WebGPU capability testing. + * + * @hideconstructor + * @three_import import WebGPU from 'three/addons/capabilities/WebGPU.js'; + */ +declare class WebGPU { + /** + * Returns `true` if WebGPU is available. + * + * @return {boolean} Whether WebGPU is available or not. + */ + static isAvailable(): boolean; + /** + * Returns a `div` element representing a formatted error message that can be appended in + * web sites if WebGPU isn't supported. + * + * @return {HTMLDivElement} A `div` element representing a formatted error message that WebGPU isn't supported. + */ + static getErrorMessage(): HTMLDivElement; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts new file mode 100644 index 000000000..430f1cff8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts @@ -0,0 +1,676 @@ +/** + * Arcball controls allow the camera to be controlled by a virtual trackball with full touch support and advanced navigation functionality. + * Cursor/finger positions and movements are mapped over a virtual trackball surface represented by a gizmo and mapped in intuitive and + * consistent camera movements. Dragging cursor/fingers will cause camera to orbit around the center of the trackball in a conservative + * way (returning to the starting point will make the camera return to its starting orientation). + * + * In addition to supporting pan, zoom and pinch gestures, double clicking/tapping focuses on a point, intuitively moving the object's + * point of interest to the center of the virtual trackball. Focus allows a much better inspection and navigation in complex environment. + * Moreover Arcball controls allow FOV manipulation (in a vertigo-style method) and z-rotation. Saving and restoring of Camera State + * is supported also through clipboard (use ctrl+c and ctrl+v shortcuts for copy and paste the state). + * + * Unlike {@link OrbitControls} and {@link TrackballControls}, `ArcballControls` doesn't require `update()` to be called externally in an + * animation loop when animations are on. + * + * @augments Controls + * @three_import import { ArcballControls } from 'three/addons/controls/ArcballControls.js'; + */ +export class ArcballControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Camera} camera - The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself. + * @param {?HTMLElement} [domElement=null] - The HTML element used for event listeners. + * @param {?Scene} [scene=null] The scene rendered by the camera. If not given, gizmos cannot be shown. + */ + constructor(camera: Camera, domElement?: HTMLElement | null, scene?: Scene | null); + /** + * The scene rendered by the camera. If not given, gizmos cannot be shown. + * + * @type {?Scene} + * @default null + */ + scene: Scene | null; + /** + * The control's focus point. + * + * @type {Vector3} + */ + target: Vector3; + _currentTarget: Vector3; + /** + * The size of the gizmo relative to the screen width and height. + * + * @type {number} + * @default 0.67 + */ + radiusFactor: number; + /** + * Holds the mouse actions of this controls. This property is maintained by the methods + * `setMouseAction()` and `unsetMouseAction()`. + * + * @type {Array} + */ + mouseActions: Array; + _mouseOp: any; + _v2_1: Vector2; + _v3_1: Vector3; + _v3_2: Vector3; + _m4_1: Matrix4; + _m4_2: Matrix4; + _quat: Quaternion; + _translationMatrix: Matrix4; + _rotationMatrix: Matrix4; + _scaleMatrix: Matrix4; + _rotationAxis: Vector3; + _cameraMatrixState: Matrix4; + _cameraProjectionState: Matrix4; + _fovState: number; + _upState: Vector3; + _zoomState: number; + _nearPos: number; + _farPos: number; + _gizmoMatrixState: Matrix4; + _up0: Vector3; + _zoom0: number; + _fov0: number; + _initialNear: number; + _nearPos0: number; + _initialFar: number; + _farPos0: number; + _cameraMatrixState0: Matrix4; + _gizmoMatrixState0: Matrix4; + _target0: Vector3; + _button: number; + _touchStart: any[]; + _touchCurrent: any[]; + _input: symbol; + _switchSensibility: number; + _startFingerDistance: number; + _currentFingerDistance: number; + _startFingerRotation: number; + _currentFingerRotation: number; + _devPxRatio: number; + _downValid: boolean; + _nclicks: number; + _downEvents: any[]; + _downStart: number; + _clickStart: number; + _maxDownTime: number; + _maxInterval: number; + _posThreshold: number; + _movementThreshold: number; + _currentCursorPosition: Vector3; + _startCursorPosition: Vector3; + _grid: GridHelper | null; + _gridPosition: Vector3; + _gizmos: Group; + _curvePts: number; + _timeStart: number; + _animationId: number; + /** + * Duration of focus animations in ms. + * + * @type {number} + * @default 500 + */ + focusAnimationTime: number; + _timePrev: number; + _timeCurrent: number; + _anglePrev: number; + _angleCurrent: number; + _cursorPosPrev: Vector3; + _cursorPosCurr: Vector3; + _wPrev: number; + _wCurr: number; + /** + * If set to `true`, the camera's near and far values will be adjusted every time zoom is + * performed trying to maintain the same visible portion given by initial near and far + * values. Only works with perspective cameras. + * + * This feature only works as expected if the camera's initial state (position, near and far values) + * is correctly configured before creating the controls. Otherwise {@link ArcballControls#setCamera} + * must be called by the application. + * + * @type {boolean} + * @default false + */ + adjustNearFar: boolean; + /** + * The scaling factor used when performing zoom operation. + * + * @type {number} + * @default 1.1 + */ + scaleFactor: number; + /** + * The damping inertia used if 'enableAnimations` is set to `true`. + * + * @type {number} + * @default 25 + */ + dampingFactor: number; + /** + * Maximum angular velocity allowed on rotation animation start. + * + * @type {number} + * @default 20 + */ + wMax: number; + /** + * Set to `true` to enable animations for rotation (damping) and focus operation. + * + * @type {boolean} + * @default true + */ + enableAnimations: boolean; + /** + * If set to `true`, a grid will appear when panning operation is being performed + * (desktop interaction only). + * + * @type {boolean} + * @default false + */ + enableGrid: boolean; + /** + * Set to `true` to make zoom become cursor centered. + * + * @type {boolean} + * @default false + */ + cursorZoom: boolean; + /** + * The minimum FOV in degrees. + * + * @type {number} + * @default 5 + */ + minFov: number; + /** + * The maximum FOV in degrees. + * + * @type {number} + * @default 90 + */ + maxFov: number; + /** + * Speed of rotation. + * + * @type {number} + * @default 1 + */ + rotateSpeed: number; + /** + * Enable or disable camera panning. + * + * @type {boolean} + * @default true + */ + enablePan: boolean; + /** + * Enable or disable camera rotation. + * + * @type {boolean} + * @default true + */ + enableRotate: boolean; + /** + * Enable or disable camera zoom. + * + * @type {boolean} + * @default true + */ + enableZoom: boolean; + /** + * Enable or disable gizmos. + * + * @type {boolean} + * @default true + */ + enableGizmos: boolean; + /** + * Enable or disable camera focusing on double-tap (or click) operations. + * + * @type {boolean} + * @default true + */ + enableFocus: boolean; + /** + * How far you can dolly in. For perspective cameras only. + * + * @type {number} + * @default 0 + */ + minDistance: number; + /** + * How far you can dolly out. For perspective cameras only. + * + * @type {number} + * @default Infinity + */ + maxDistance: number; + /** + * How far you can zoom in. For orthographic cameras only. + * + * @type {number} + * @default 0 + */ + minZoom: number; + /** + * How far you can zoom out. For orthographic cameras only. + * + * @type {number} + * @default Infinity + */ + maxZoom: number; + _tbRadius: number; + _state: symbol; + _onContextMenu: typeof onContextMenu; + _onWheel: typeof onWheel; + _onPointerUp: typeof onPointerUp; + _onPointerMove: typeof onPointerMove; + _onPointerDown: typeof onPointerDown; + _onPointerCancel: typeof onPointerCancel; + _onWindowResize: typeof onWindowResize; + connect(element: any): void; + onSinglePanStart(event: any, operation: any): void; + onSinglePanMove(event: any, opState: any): void; + onSinglePanEnd(): void; + onDoubleTap(event: any): void; + onDoublePanStart(): void; + onDoublePanMove(): void; + onDoublePanEnd(): void; + onRotateStart(): void; + onRotateMove(): void; + onRotateEnd(): void; + onPinchStart(): void; + onPinchMove(): void; + onPinchEnd(): void; + onTriplePanStart(): void; + onTriplePanMove(): void; + onTriplePanEnd(): void; + /** + * Set _center's x/y coordinates. + * + * @private + * @param {number} clientX - The x coordinate. + * @param {number} clientY - The y coordinate. + */ + private setCenter; + /** + * Set default mouse actions. + * + * @private + */ + private initializeMouseActions; + /** + * Compare two mouse actions. + * + * @private + * @param {Object} action1 - The first mouse action. + * @param {Object} action2 - The second mouse action. + * @returns {boolean} `true` if action1 and action 2 are the same mouse action, `false` otherwise. + */ + private compareMouseAction; + /** + * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one. + * + * @param {'PAN'|'ROTATE'|'ZOOM'|'FOV'} operation - The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV'). + * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches. + * @param {?('CTRL'|'SHIFT')} [key=null] - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed. + * @returns {boolean} `true` if the mouse action has been successfully added, `false` otherwise. + */ + setMouseAction(operation: "PAN" | "ROTATE" | "ZOOM" | "FOV", mouse: 0 | 1 | 2 | "WHEEL", key?: ("CTRL" | "SHIFT") | null): boolean; + /** + * Remove a mouse action by specifying its mouse/key combination. + * + * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches. + * @param {?('CTRL'|'SHIFT')} key - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed. + * @returns {boolean} `true` if the operation has been successfully removed, `false` otherwise. + */ + unsetMouseAction(mouse: 0 | 1 | 2 | "WHEEL", key?: ("CTRL" | "SHIFT") | null): boolean; + /** + * Return the operation associated to a mouse/keyboard combination. + * + * @private + * @param {0|1|2|'WHEEL'} mouse - Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches. + * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier. + * @returns {?('PAN'|'ROTATE'|'ZOOM'|'FOV')} The operation if it has been found, `null` otherwise. + */ + private getOpFromAction; + /** + * Get the operation associated to mouse and key combination and returns the corresponding FSA state. + * + * @private + * @param {0|1|2} mouse - Mouse button index (0, 1, 2) + * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier + * @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination. + */ + private getOpStateFromAction; + /** + * Calculate the angle between two pointers. + * + * @private + * @param {PointerEvent} p1 - The first pointer event. + * @param {PointerEvent} p2 - The second pointer event. + * @returns {number} The angle between two pointers in degrees. + */ + private getAngle; + /** + * Updates a PointerEvent inside current pointerevents array. + * + * @private + * @param {PointerEvent} event - The pointer event. + */ + private updateTouchEvent; + /** + * Applies a transformation matrix, to the camera and gizmos. + * + * @private + * @param {Object} transformation - Object containing matrices to apply to camera and gizmos. + */ + private applyTransformMatrix; + /** + * Calculates the angular speed. + * + * @private + * @param {number} p0 - Position at t0. + * @param {number} p1 - Position at t1. + * @param {number} t0 - Initial time in milliseconds. + * @param {number} t1 - Ending time in milliseconds. + * @returns {number} The angular speed. + */ + private calculateAngularSpeed; + /** + * Calculates the distance between two pointers. + * + * @private + * @param {PointerEvent} p0 - The first pointer. + * @param {PointerEvent} p1 - The second pointer. + * @returns {number} The distance between the two pointers. + */ + private calculatePointersDistance; + /** + * Calculates the rotation axis as the vector perpendicular between two vectors. + * + * @private + * @param {Vector3} vec1 - The first vector. + * @param {Vector3} vec2 - The second vector. + * @returns {Vector3} The normalized rotation axis. + */ + private calculateRotationAxis; + /** + * Calculates the trackball radius so that gizmo's diameter will be 2/3 of the minimum side of the camera frustum. + * + * @private + * @param {Camera} camera - The camera. + * @returns {number} The trackball radius. + */ + private calculateTbRadius; + /** + * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in. + * + * @private + * @param {Vector3} point - The point of interest. + * @param {number} size - Scale factor. + * @param {number} [amount=1] - Amount of operation to be completed (used for focus animations, default is complete full operation). + */ + private focus; + /** + * Creates a grid if necessary and adds it to the scene. + * + * @private + */ + private drawGrid; + /** + * Removes the grid from the scene. + */ + disposeGrid(): void; + /** + * Computes the easing out cubic function for ease out effect in animation. + * + * @private + * @param {number} t - The absolute progress of the animation in the bound of `0` (beginning of the) and `1` (ending of animation). + * @returns {number} Result of easing out cubic at time `t`. + */ + private easeOutCubic; + /** + * Makes rotation gizmos more or less visible. + * + * @param {boolean} isActive - If set to `true`, gizmos are more visible. + */ + activateGizmos(isActive: boolean): void; + /** + * Calculates the cursor position in NDC. + * + * @private + * @param {number} cursorX - Cursor horizontal coordinate within the canvas. + * @param {number} cursorY - Cursor vertical coordinate within the canvas. + * @param {HTMLElement} canvas - The canvas where the renderer draws its output. + * @returns {Vector2} Cursor normalized position inside the canvas. + */ + private getCursorNDC; + /** + * Calculates the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas. + * + * @private + * @param {number} cursorX - Cursor horizontal coordinate within the canvas. + * @param {number} cursorY - Cursor vertical coordinate within the canvas. + * @param {HTMLElement} canvas - The canvas where the renderer draws its output. + * @returns {Vector2} Cursor position inside the canvas. + */ + private getCursorPosition; + /** + * Sets the camera to be controlled. Must be called in order to set a new camera to be controlled. + * + * @param {Camera} camera - The camera to be controlled. + */ + setCamera(camera: Camera): void; + /** + * Sets gizmos visibility. + * + * @param {boolean} value - Value of gizmos visibility. + */ + setGizmosVisible(value: boolean): void; + /** + * Sets gizmos radius factor and redraws gizmos. + * + * @param {number} value - Value of radius factor. + */ + setTbRadius(value: number): void; + /** + * Creates the rotation gizmos matching trackball center and radius. + * + * @private + * @param {Vector3} tbCenter - The trackball center. + * @param {number} tbRadius - The trackball radius. + */ + private makeGizmos; + /** + * Performs animation for focus operation. + * + * @private + * @param {number} time - Instant in which this function is called as performance.now(). + * @param {Vector3} point - Point of interest for focus operation. + * @param {Matrix4} cameraMatrix - Camera matrix. + * @param {Matrix4} gizmoMatrix - Gizmos matrix. + */ + private onFocusAnim; + /** + * Performs animation for rotation operation. + * + * @private + * @param {number} time - Instant in which this function is called as performance.now(). + * @param {Vector3} rotationAxis - Rotation axis. + * @param {number} w0 - Initial angular velocity. + */ + private onRotationAnim; + /** + * Performs pan operation moving camera between two points. + * + * @private + * @param {Vector3} p0 - Initial point. + * @param {Vector3} p1 - Ending point. + * @param {boolean} [adjust=false] - If movement should be adjusted considering camera distance (Perspective only). + * @returns {Object} + */ + private pan; + /** + * Resets the controls. + */ + reset(): void; + /** + * Rotates the camera around an axis passing by trackball's center. + * + * @private + * @param {Vector3} axis - Rotation axis. + * @param {number} angle - Angle in radians. + * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera. + */ + private rotate; + /** + * Copy the current state to clipboard (as a readable JSON text). + */ + copyState(): void; + /** + * Set the controls state from the clipboard, assumes that the clipboard stores a JSON + * text as saved from `copyState()`. + */ + pasteState(): void; + /** + * Saves the current state of the control. This can later be recover with `reset()`. + */ + saveState(): void; + /** + * Performs uniform scale operation around a given point. + * + * @private + * @param {number} size - Scale factor. + * @param {Vector3} point - Point around which scale. + * @param {boolean} scaleGizmos - If gizmos should be scaled (Perspective only). + * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos. + */ + private scale; + /** + * Sets camera fov. + * + * @private + * @param {number} value - The FOV to be set. + */ + private setFov; + /** + * Sets values in transformation object. + * + * @private + * @param {?Matrix4} [camera=null] - Transformation to be applied to the camera. + * @param {?Matrix4} [gizmos=null] - Transformation to be applied to gizmos. + */ + private setTransformationMatrices; + /** + * Rotates camera around its direction axis passing by a given point by a given angle. + * + * @private + * @param {Vector3} point - The point where the rotation axis is passing through. + * @param {number} angle - Angle in radians. + * @returns {Object} The computed transformation matrix. + */ + private zRotate; + /** + * Returns the raycaster that is used for user interaction. This object is shared between all + * instances of `ArcballControls`. + * + * @returns {Raycaster} The internal raycaster. + */ + getRaycaster(): Raycaster; + /** + * Unprojects the cursor on the 3D object surface. + * + * @private + * @param {Vector2} cursor - Cursor coordinates in NDC. + * @param {Camera} camera - Virtual camera. + * @returns {?Vector3} The point of intersection with the model, if exist, null otherwise. + */ + private unprojectOnObj; + /** + * Unproject the cursor on the trackball surface. + * + * @private + * @param {Camera} camera - The virtual camera. + * @param {number} cursorX - Cursor horizontal coordinate on screen. + * @param {number} cursorY - Cursor vertical coordinate on screen. + * @param {HTMLElement} canvas - The canvas where the renderer draws its output. + * @param {number} tbRadius - The trackball radius. + * @returns {Vector3} The unprojected point on the trackball surface. + */ + private unprojectOnTbSurface; + /** + * Unprojects the cursor on the plane passing through the center of the trackball orthogonal to the camera. + * + * @private + * @param {Camera} camera - The virtual camera. + * @param {number} cursorX - Cursor horizontal coordinate on screen. + * @param {number} cursorY - Cursor vertical coordinate on screen. + * @param {HTMLElement} canvas - The canvas where the renderer draws its output. + * @param {boolean} [initialDistance=false] - If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only). + * @returns {Vector3} The unprojected point on the trackball plane. + */ + private unprojectOnTbPlane; + /** + * Updates camera and gizmos state. + * + * @private + */ + private updateMatrixState; + /** + * Updates the trackball FSA. + * + * @private + * @param {STATE} newState - New state of the FSA. + * @param {boolean} updateMatrices - If matrices state should be updated. + */ + private updateTbState; + setStateFromJSON(json: any): void; +} +import { Controls } from 'three'; +import { Vector3 } from 'three'; +import { Vector2 } from 'three'; +import { Matrix4 } from 'three'; +import { Quaternion } from 'three'; +import { GridHelper } from 'three'; +import { Group } from 'three'; +declare function onContextMenu(event: any): void; +declare function onWheel(event: any): void; +declare function onPointerUp(event: any): void; +declare class onPointerUp { + constructor(event: any); + _input: symbol | undefined; + _button: number | undefined; + _nclicks: number | undefined; + _clickStart: number | undefined; + _downValid: boolean | undefined; +} +declare function onPointerMove(event: any): void; +declare class onPointerMove { + constructor(event: any); + _input: symbol | undefined; + _downValid: boolean | undefined; +} +declare function onPointerDown(event: any): void; +declare class onPointerDown { + constructor(event: any); + _downValid: boolean; + _downStart: number | undefined; + _input: symbol | undefined; + _mouseOp: any; + _button: any; +} +declare function onPointerCancel(): void; +declare class onPointerCancel { + _input: symbol; +} +declare function onWindowResize(): void; +declare class onWindowResize { + _tbRadius: any; +} +import { Raycaster } from 'three'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts new file mode 100644 index 000000000..8457f57fb --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts @@ -0,0 +1,93 @@ +/** + * This class can be used to provide a drag'n'drop interaction. + * + * ```js + * const controls = new DragControls( objects, camera, renderer.domElement ); + * + * // add event listener to highlight dragged objects + * controls.addEventListener( 'dragstart', function ( event ) { + * + * event.object.material.emissive.set( 0xaaaaaa ); + * + * } ); + * + * controls.addEventListener( 'dragend', function ( event ) { + * + * event.object.material.emissive.set( 0x000000 ); + * + * } ); + * ``` + * + * @augments Controls + * @three_import import { DragControls } from 'three/addons/controls/DragControls.js'; + */ +export class DragControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Array} objects - An array of draggable 3D objects. + * @param {Camera} camera - The camera of the rendered scene. + * @param {?HTMLElement} [domElement=null] - The HTML DOM element used for event listeners. + */ + constructor(objects: Array, camera: Camera, domElement?: HTMLElement | null); + /** + * An array of draggable 3D objects. + * + * @type {Array} + */ + objects: Array; + /** + * Whether children of draggable objects can be dragged independently from their parent. + * + * @type {boolean} + * @default true + */ + recursive: boolean; + /** + * This option only works if the `objects` array contains a single draggable group object. + * If set to `true`, the controls does not transform individual objects but the entire group. + * + * @type {boolean} + * @default false + */ + transformGroup: boolean; + /** + * The speed at which the object will rotate when dragged in `rotate` mode. + * The higher the number the faster the rotation. + * + * @type {number} + * @default 1 + */ + rotateSpeed: number; + /** + * The raycaster used for detecting 3D objects. + * + * @type {Raycaster} + */ + raycaster: Raycaster; + mouseButtons: { + LEFT: number; + MIDDLE: number; + RIGHT: number; + }; + touches: { + ONE: number; + }; + _onPointerMove: typeof onPointerMove; + _onPointerDown: typeof onPointerDown; + _onPointerCancel: typeof onPointerCancel; + _onContextMenu: typeof onContextMenu; + connect(element: any): void; + _updatePointer(event: any): void; + _updateState(event: any): void; +} +import { Controls } from 'three'; +import { Raycaster } from 'three'; +declare function onPointerMove(event: any): void; +declare function onPointerDown(event: any): void; +declare function onPointerCancel(): void; +declare class onPointerCancel { + state: number | undefined; +} +declare function onContextMenu(event: any): void; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts new file mode 100644 index 000000000..83dd31c48 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts @@ -0,0 +1,199 @@ +/** + * This class is an alternative implementation of {@link FlyControls}. + * + * @augments Controls + * @three_import import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; + */ +export class FirstPersonControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Object3D} object - The object that is managed by the controls. + * @param {?HTMLElement} domElement - The HTML element used for event listeners. + */ + constructor(object: Object3D, domElement?: HTMLElement | null); + /** + * The movement speed. + * + * @type {number} + * @default 1 + */ + movementSpeed: number; + /** + * The look around speed. + * + * @type {number} + * @default 0.005 + */ + lookSpeed: number; + /** + * How quickly the movement and look velocity catches up to the input. Lower + * values feel heavier (more inertia), `1` disables damping. + * + * @type {number} + * @default 0.1 + */ + dampingFactor: number; + /** + * Whether it's possible to vertically look around or not. + * + * @type {boolean} + * @default true + */ + lookVertical: boolean; + /** + * Whether the camera is automatically moved forward or not. + * + * @type {boolean} + * @default false + */ + autoForward: boolean; + /** + * Whether or not the camera's height influences the forward movement speed. + * Use the properties `heightCoef`, `heightMin` and `heightMax` for configuration. + * + * @type {boolean} + * @default false + */ + heightSpeed: boolean; + /** + * Determines how much faster the camera moves when it's y-component is near `heightMax`. + * + * @type {number} + * @default 1 + */ + heightCoef: number; + /** + * Lower camera height limit used for movement speed adjustment. + * + * @type {number} + * @default 0 + */ + heightMin: number; + /** + * Upper camera height limit used for movement speed adjustment. + * + * @type {number} + * @default 1 + */ + heightMax: number; + /** + * Whether or not looking around is vertically constrained by `verticalMin` and `verticalMax`. + * + * @type {boolean} + * @default false + */ + constrainVertical: boolean; + /** + * How far you can vertically look around, lower limit. Range is `0` to `Math.PI` in radians. + * + * @type {number} + * @default 0 + */ + verticalMin: number; + /** + * How far you can vertically look around, upper limit. Range is `0` to `Math.PI` in radians. + * + * @type {number} + * @default 0 + */ + verticalMax: number; + /** + * Whether the mouse is pressed down or not. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly mouseDragOn: boolean; + _velocity: Vector3; + _pointerX: number; + _pointerY: number; + _pointerDownX: number; + _pointerDownY: number; + _pointerCount: number; + _keyForward: boolean; + _keyBackward: boolean; + _pointerForward: boolean; + _pointerBackward: boolean; + _moveLeft: boolean; + _moveRight: boolean; + _moveUp: boolean; + _moveDown: boolean; + _lat: number; + _lon: number; + _lonVelocity: number; + _latVelocity: number; + _onPointerMove: typeof onPointerMove; + _onPointerDown: typeof onPointerDown; + _onPointerUp: typeof onPointerUp; + _onContextMenu: typeof onContextMenu; + _onKeyDown: typeof onKeyDown; + _onKeyUp: typeof onKeyUp; + connect(element: any): void; + /** + * Rotates the camera towards the defined target position. + * + * @param {number|Vector3} x - The x coordinate of the target position or alternatively a vector representing the target position. + * @param {number} y - The y coordinate of the target position. + * @param {number} z - The z coordinate of the target position. + * @return {FirstPersonControls} A reference to this controls. + */ + lookAt(x: number | Vector3, y: number, z: number): FirstPersonControls; + update(delta: any): void; + _setOrientation(): void; + /** + * @deprecated, r184. This method is no longer needed. + */ + handleResize(): void; +} +import { Controls } from 'three'; +import { Vector3 } from 'three'; +declare function onPointerMove(event: any): void; +declare class onPointerMove { + constructor(event: any); + _pointerX: number | undefined; + _pointerY: number | undefined; +} +declare function onPointerDown(event: any): void; +declare class onPointerDown { + constructor(event: any); + _pointerForward: boolean | undefined; + _pointerBackward: boolean | undefined; + _pointerDownX: any; + _pointerDownY: any; + _pointerX: number; + _pointerY: number; + mouseDragOn: boolean; +} +declare function onPointerUp(event: any): void; +declare class onPointerUp { + constructor(event: any); + _pointerForward: boolean | undefined; + _pointerBackward: boolean | undefined; + _pointerX: number | undefined; + _pointerY: number | undefined; + mouseDragOn: boolean | undefined; +} +declare function onContextMenu(event: any): void; +declare function onKeyDown(event: any): void; +declare class onKeyDown { + constructor(event: any); + _keyForward: boolean | undefined; + _moveLeft: boolean | undefined; + _keyBackward: boolean | undefined; + _moveRight: boolean | undefined; + _moveUp: boolean | undefined; + _moveDown: boolean | undefined; +} +declare function onKeyUp(event: any): void; +declare class onKeyUp { + constructor(event: any); + _keyForward: boolean | undefined; + _moveLeft: boolean | undefined; + _keyBackward: boolean | undefined; + _moveRight: boolean | undefined; + _moveUp: boolean | undefined; + _moveDown: boolean | undefined; +} +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts new file mode 100644 index 000000000..aa87bbefe --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts @@ -0,0 +1,101 @@ +/** + * This class enables a navigation similar to fly modes in DCC tools like Blender. + * You can arbitrarily transform the camera in 3D space without any limitations + * (e.g. focus on a specific target). + * + * @augments Controls + * @three_import import { FlyControls } from 'three/addons/controls/FlyControls.js'; + */ +export class FlyControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Object3D} object - The object that is managed by the controls. + * @param {?HTMLElement} domElement - The HTML element used for event listeners. + */ + constructor(object: Object3D, domElement?: HTMLElement | null); + /** + * The movement speed. + * + * @type {number} + * @default 1 + */ + movementSpeed: number; + /** + * The rotation speed. + * + * @type {number} + * @default 0.005 + */ + rollSpeed: number; + /** + * If set to `true`, you can only look around by performing a drag interaction. + * + * @type {boolean} + * @default false + */ + dragToLook: boolean; + /** + * If set to `true`, the camera automatically moves forward (and does not stop) when initially translated. + * + * @type {boolean} + * @default false + */ + autoForward: boolean; + _moveState: { + up: number; + down: number; + left: number; + right: number; + forward: number; + back: number; + pitchUp: number; + pitchDown: number; + yawLeft: number; + yawRight: number; + rollLeft: number; + rollRight: number; + }; + _moveVector: Vector3; + _rotationVector: Vector3; + _lastQuaternion: Quaternion; + _lastPosition: Vector3; + _status: number; + _onKeyDown: typeof onKeyDown; + _onKeyUp: typeof onKeyUp; + _onPointerMove: typeof onPointerMove; + _onPointerDown: typeof onPointerDown; + _onPointerUp: typeof onPointerUp; + _onPointerCancel: typeof onPointerCancel; + _onContextMenu: typeof onContextMenu; + connect(element: any): void; + update(delta: any): void; + _updateMovementVector(): void; + _updateRotationVector(): void; + _getContainerDimensions(): { + size: number[]; + offset: number[]; + }; +} +import { Controls } from 'three'; +import { Vector3 } from 'three'; +import { Quaternion } from 'three'; +declare function onKeyDown(event: any): void; +declare class onKeyDown { + constructor(event: any); + movementSpeedMultiplier: number | undefined; +} +declare function onKeyUp(event: any): void; +declare class onKeyUp { + constructor(event: any); + movementSpeedMultiplier: number | undefined; +} +declare function onPointerMove(event: any): void; +declare function onPointerDown(event: any): void; +declare function onPointerUp(event: any): void; +declare function onPointerCancel(): void; +declare class onPointerCancel { + _status: number | undefined; +} +declare function onContextMenu(event: any): void; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts new file mode 100644 index 000000000..f3b2f1265 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts @@ -0,0 +1,18 @@ +/** + * This class is intended for transforming a camera over a map from bird's eye perspective. + * The class shares its implementation with {@link OrbitControls} but uses a specific preset + * for mouse/touch interaction and disables screen space panning by default. + * + * - Orbit: Right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate. + * - Zoom: Middle mouse, or mousewheel / touch: two-finger spread or squish. + * - Pan: Left mouse, or arrow keys / touch: one-finger move. + * + * @augments OrbitControls + * @three_import import { MapControls } from 'three/addons/controls/MapControls.js'; + */ +export class MapControls extends OrbitControls { + constructor(object: any, domElement: any); + _panWorldStart: Vector3; +} +import { OrbitControls } from './OrbitControls.js'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts new file mode 100644 index 000000000..0c5ffd8b8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts @@ -0,0 +1,458 @@ +/** + * Orbit controls allow the camera to orbit around a target. + * + * OrbitControls performs orbiting, dollying (zooming), and panning. Unlike {@link TrackballControls}, + * it maintains the "up" direction `object.up` (+Y by default). + * + * - Orbit: Left mouse / touch: one-finger move. + * - Zoom: Middle mouse, or mousewheel / touch: two-finger spread or squish. + * - Pan: Right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move. + * + * ```js + * const controls = new OrbitControls( camera, renderer.domElement ); + * + * // controls.update() must be called after any manual changes to the camera's transform + * camera.position.set( 0, 20, 100 ); + * controls.update(); + * + * function animate() { + * + * // required if controls.enableDamping or controls.autoRotate are set to true + * controls.update(); + * + * renderer.render( scene, camera ); + * + * } + * ``` + * + * @augments Controls + * @three_import import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + */ +export class OrbitControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Object3D} object - The object that is managed by the controls. + * @param {?HTMLElement} domElement - The HTML element used for event listeners. + */ + constructor(object: Object3D, domElement?: HTMLElement | null); + /** + * The focus point of the controls, the `object` orbits around this. + * It can be updated manually at any point to change the focus of the controls. + * + * @type {Vector3} + */ + target: Vector3; + /** + * The focus point of the `minTargetRadius` and `maxTargetRadius` limits. + * It can be updated manually at any point to change the center of interest + * for the `target`. + * + * @type {Vector3} + */ + cursor: Vector3; + /** + * How far you can dolly in (perspective camera only). + * + * @type {number} + * @default 0 + */ + minDistance: number; + /** + * How far you can dolly out (perspective camera only). + * + * @type {number} + * @default Infinity + */ + maxDistance: number; + /** + * How far you can zoom in (orthographic camera only). + * + * @type {number} + * @default 0 + */ + minZoom: number; + /** + * How far you can zoom out (orthographic camera only). + * + * @type {number} + * @default Infinity + */ + maxZoom: number; + /** + * How close you can get the target to the 3D `cursor`. + * + * @type {number} + * @default 0 + */ + minTargetRadius: number; + /** + * How far you can move the target from the 3D `cursor`. + * + * @type {number} + * @default Infinity + */ + maxTargetRadius: number; + /** + * How far you can orbit vertically, lower limit. Range is `[0, Math.PI]` radians. + * + * @type {number} + * @default 0 + */ + minPolarAngle: number; + /** + * How far you can orbit vertically, upper limit. Range is `[0, Math.PI]` radians. + * + * @type {number} + * @default Math.PI + */ + maxPolarAngle: number; + /** + * How far you can orbit horizontally, lower limit. If set, the interval `[ min, max ]` + * must be a sub-interval of `[ - 2 PI, 2 PI ]`, with `( max - min < 2 PI )`. + * + * @type {number} + * @default -Infinity + */ + minAzimuthAngle: number; + /** + * How far you can orbit horizontally, upper limit. If set, the interval `[ min, max ]` + * must be a sub-interval of `[ - 2 PI, 2 PI ]`, with `( max - min < 2 PI )`. + * + * @type {number} + * @default -Infinity + */ + maxAzimuthAngle: number; + /** + * Set to `true` to enable damping (inertia), which can be used to give a sense of weight + * to the controls. Note that if this is enabled, you must call `update()` in your animation + * loop. + * + * @type {boolean} + * @default false + */ + enableDamping: boolean; + /** + * The damping inertia used if `enableDamping` is set to `true`. + * + * Note that for this to work, you must call `update()` in your animation loop. + * + * @type {number} + * @default 0.05 + */ + dampingFactor: number; + /** + * Enable or disable zooming (dollying) of the camera. + * + * @type {boolean} + * @default true + */ + enableZoom: boolean; + /** + * Speed of zooming / dollying. + * + * @type {number} + * @default 1 + */ + zoomSpeed: number; + /** + * Enable or disable horizontal and vertical rotation of the camera. + * + * Note that it is possible to disable a single axis by setting the min and max of the + * `minPolarAngle` or `minAzimuthAngle` to the same value, which will cause the vertical + * or horizontal rotation to be fixed at that value. + * + * @type {boolean} + * @default true + */ + enableRotate: boolean; + /** + * Speed of rotation. + * + * @type {number} + * @default 1 + */ + rotateSpeed: number; + /** + * How fast to rotate the camera when the keyboard is used. + * + * @type {number} + * @default 1 + */ + keyRotateSpeed: number; + /** + * Enable or disable camera panning. + * + * @type {boolean} + * @default true + */ + enablePan: boolean; + /** + * Speed of panning. + * + * @type {number} + * @default 1 + */ + panSpeed: number; + /** + * Defines how the camera's position is translated when panning. If `true`, the camera pans + * in screen space. Otherwise, the camera pans in the plane orthogonal to the camera's up + * direction. + * + * @type {boolean} + * @default true + */ + screenSpacePanning: boolean; + /** + * How fast to pan the camera when the keyboard is used in + * pixels per keypress. + * + * @type {number} + * @default 7 + */ + keyPanSpeed: number; + /** + * Setting this property to `true` allows to zoom to the cursor's position. + * + * @type {boolean} + * @default false + */ + zoomToCursor: boolean; + /** + * Set to true to automatically rotate around the target + * + * Note that if this is enabled, you must call `update()` in your animation loop. + * If you want the auto-rotate speed to be independent of the frame rate (the refresh + * rate of the display), you must pass the time `deltaTime`, in seconds, to `update()`. + * + * @type {boolean} + * @default false + */ + autoRotate: boolean; + /** + * How fast to rotate around the target if `autoRotate` is `true`. The default equates to 30 seconds + * per orbit at 60fps. + * + * Note that if `autoRotate` is enabled, you must call `update()` in your animation loop. + * + * @type {number} + * @default 2 + */ + autoRotateSpeed: number; + /** + * Used internally by `saveState()` and `reset()`. + * + * @type {Vector3} + */ + target0: Vector3; + /** + * Used internally by `saveState()` and `reset()`. + * + * @type {Vector3} + */ + position0: Vector3; + /** + * Used internally by `saveState()` and `reset()`. + * + * @type {number} + */ + zoom0: number; + _cursorStyle: string; + _domElementKeyEvents: HTMLElement | null; + _lastPosition: Vector3; + _lastQuaternion: Quaternion; + _lastTargetPosition: Vector3; + _quat: Quaternion; + _quatInverse: Quaternion; + _spherical: Spherical; + _sphericalDelta: Spherical; + _scale: number; + _panOffset: Vector3; + _rotateStart: Vector2; + _rotateEnd: Vector2; + _rotateDelta: Vector2; + _panStart: Vector2; + _panEnd: Vector2; + _panDelta: Vector2; + _dollyStart: Vector2; + _dollyEnd: Vector2; + _dollyDelta: Vector2; + _dollyDirection: Vector3; + _mouse: Vector2; + _performCursorZoom: boolean; + _pointers: any[]; + _pointerPositions: {}; + _controlActive: boolean; + _onPointerMove: typeof onPointerMove; + _onPointerDown: typeof onPointerDown; + _onPointerUp: typeof onPointerUp; + _onContextMenu: typeof onContextMenu; + _onMouseWheel: typeof onMouseWheel; + _onKeyDown: typeof onKeyDown; + _onTouchStart: typeof onTouchStart; + _onTouchMove: typeof onTouchMove; + _onMouseDown: typeof onMouseDown; + _onMouseMove: typeof onMouseMove; + _interceptControlDown: typeof interceptControlDown; + _interceptControlUp: typeof interceptControlUp; + /** + * Defines the visual representation of the cursor. + * + * @type {('auto'|'grab')} + * @default 'auto' + */ + set cursorStyle(type: string); + get cursorStyle(): string; + connect(element: any): void; + /** + * Get the current vertical rotation, in radians. + * + * @return {number} The current vertical rotation, in radians. + */ + getPolarAngle(): number; + /** + * Get the current horizontal rotation, in radians. + * + * @return {number} The current horizontal rotation, in radians. + */ + getAzimuthalAngle(): number; + /** + * Returns the distance from the camera to the target. + * + * @return {number} The distance from the camera to the target. + */ + getDistance(): number; + /** + * Adds key event listeners to the given DOM element. + * `window` is a recommended argument for using this method. + * + * @param {HTMLElement} domElement - The DOM element + */ + listenToKeyEvents(domElement: HTMLElement): void; + /** + * Removes the key event listener previously defined with `listenToKeyEvents()`. + */ + stopListenToKeyEvents(): void; + /** + * Save the current state of the controls. This can later be recovered with `reset()`. + */ + saveState(): void; + /** + * Reset the controls to their state from either the last time the `saveState()` + * was called, or the initial state. + */ + reset(): void; + /** + * Programmatically pan the camera. + * + * @param {number} deltaX - The horizontal pan amount in pixels. + * @param {number} deltaY - The vertical pan amount in pixels. + */ + pan(deltaX: number, deltaY: number): void; + /** + * Programmatically dolly in (zoom in for perspective camera). + * + * @param {number} dollyScale - The dolly scale factor. + */ + dollyIn(dollyScale: number): void; + /** + * Programmatically dolly out (zoom out for perspective camera). + * + * @param {number} dollyScale - The dolly scale factor. + */ + dollyOut(dollyScale: number): void; + /** + * Programmatically rotate the camera left (around the vertical axis). + * + * @param {number} angle - The rotation angle in radians. + */ + rotateLeft(angle: number): void; + /** + * Programmatically rotate the camera up (around the horizontal axis). + * + * @param {number} angle - The rotation angle in radians. + */ + rotateUp(angle: number): void; + update(deltaTime?: null): boolean; + _getAutoRotationAngle(deltaTime: any): number; + _getZoomScale(delta: any): number; + _rotateLeft(angle: any): void; + _rotateUp(angle: any): void; + _panLeft(distance: any, objectMatrix: any): void; + _panUp(distance: any, objectMatrix: any): void; + _pan(deltaX: any, deltaY: any): void; + _dollyOut(dollyScale: any): void; + _dollyIn(dollyScale: any): void; + _updateZoomParameters(x: any, y: any): void; + _clampDistance(dist: any): number; + _handleMouseDownRotate(event: any): void; + _handleMouseDownDolly(event: any): void; + _handleMouseDownPan(event: any): void; + _handleMouseMoveRotate(event: any): void; + _handleMouseMoveDolly(event: any): void; + _handleMouseMovePan(event: any): void; + _handleMouseWheel(event: any): void; + _handleKeyDown(event: any): void; + _handleTouchStartRotate(event: any): void; + _handleTouchStartPan(event: any): void; + _handleTouchStartDolly(event: any): void; + _handleTouchStartDollyPan(event: any): void; + _handleTouchStartDollyRotate(event: any): void; + _handleTouchMoveRotate(event: any): void; + _handleTouchMovePan(event: any): void; + _handleTouchMoveDolly(event: any): void; + _handleTouchMoveDollyPan(event: any): void; + _handleTouchMoveDollyRotate(event: any): void; + _addPointer(event: any): void; + _removePointer(event: any): void; + _isTrackingPointer(event: any): boolean; + _trackPointer(event: any): void; + _getSecondPointerPosition(event: any): any; + _customWheelEvent(event: any): { + clientX: any; + clientY: any; + deltaY: any; + }; +} +import { Controls } from 'three'; +import { Vector3 } from 'three'; +import { Quaternion } from 'three'; +import { Spherical } from 'three'; +import { Vector2 } from 'three'; +declare function onPointerMove(event: any): void; +declare function onPointerDown(event: any): void; +declare function onPointerUp(event: any): void; +declare class onPointerUp { + constructor(event: any); + state: number | undefined; +} +declare function onContextMenu(event: any): void; +declare function onMouseWheel(event: any): void; +declare function onKeyDown(event: any): void; +declare function onTouchStart(event: any): void; +declare class onTouchStart { + constructor(event: any); + state: number | undefined; +} +declare function onTouchMove(event: any): void; +declare class onTouchMove { + constructor(event: any); + state: number; +} +declare function onMouseDown(event: any): void; +declare class onMouseDown { + constructor(event: any); + state: number | undefined; +} +declare function onMouseMove(event: any): void; +declare function interceptControlDown(event: any): void; +declare class interceptControlDown { + constructor(event: any); + _controlActive: boolean | undefined; +} +declare function interceptControlUp(event: any): void; +declare class interceptControlUp { + constructor(event: any); + _controlActive: boolean | undefined; +} +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts new file mode 100644 index 000000000..7cfa4f7b6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts @@ -0,0 +1,105 @@ +/** + * The implementation of this class is based on the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API). + * `PointerLockControls` is a perfect choice for first person 3D games. + * + * ```js + * const controls = new PointerLockControls( camera, document.body ); + * + * // add event listener to show/hide a UI (e.g. the game's menu) + * controls.addEventListener( 'lock', function () { + * + * menu.style.display = 'none'; + * + * } ); + * + * controls.addEventListener( 'unlock', function () { + * + * menu.style.display = 'block'; + * + * } ); + * ``` + * + * @augments Controls + * @three_import import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js'; + */ +export class PointerLockControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Camera} camera - The camera that is managed by the controls. + * @param {?HTMLElement} domElement - The HTML element used for event listeners. + */ + constructor(camera: Camera, domElement?: HTMLElement | null); + /** + * Whether the controls are locked or not. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly isLocked: boolean; + /** + * Camera pitch, lower limit. Range is '[0, Math.PI]' in radians. + * + * @type {number} + * @default 0 + */ + minPolarAngle: number; + /** + * Camera pitch, upper limit. Range is '[0, Math.PI]' in radians. + * + * @type {number} + * @default Math.PI + */ + maxPolarAngle: number; + /** + * Multiplier for how much the pointer movement influences the camera rotation. + * + * @type {number} + * @default 1 + */ + pointerSpeed: number; + _onMouseMove: typeof onMouseMove; + _onPointerlockChange: typeof onPointerlockChange; + _onPointerlockError: typeof onPointerlockError; + connect(element: any): void; + /** + * Returns the look direction of the camera. + * + * @param {Vector3} v - The target vector that is used to store the method's result. + * @return {Vector3} The normalized direction vector. + */ + getDirection(v: Vector3): Vector3; + /** + * Moves the camera forward parallel to the xz-plane. Assumes camera.up is y-up. + * + * @param {number} distance - The signed distance. + */ + moveForward(distance: number): void; + /** + * Moves the camera sidewards parallel to the xz-plane. + * + * @param {number} distance - The signed distance. + */ + moveRight(distance: number): void; + /** + * Activates the pointer lock. + * + * @param {boolean} [unadjustedMovement=false] - Disables OS-level adjustment for mouse acceleration, and accesses raw mouse input instead. + * Setting it to true will disable mouse acceleration. + */ + lock(unadjustedMovement?: boolean): void; + /** + * Exits the pointer lock. + */ + unlock(): void; +} +import { Controls } from 'three'; +declare function onMouseMove(event: any): void; +declare function onPointerlockChange(): void; +declare class onPointerlockChange { + isLocked: boolean; +} +declare function onPointerlockError(): void; +import { Vector3 } from 'three'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts new file mode 100644 index 000000000..e10874ec1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts @@ -0,0 +1,234 @@ +/** + * This class is similar to {@link OrbitControls}. However, it does not maintain a constant camera + * `up` vector. That means if the camera orbits over the “north” and “south” poles, it does not flip + * to stay "right side up". + * + * @augments Controls + * @three_import import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; + */ +export class TrackballControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Object3D} object - The object that is managed by the controls. + * @param {?HTMLElement} domElement - The HTML element used for event listeners. + */ + constructor(object: Object3D, domElement?: HTMLElement | null); + /** + * Represents the properties of the screen. Automatically set when `handleResize()` is called. + * + * @type {Object} + * @readonly + */ + readonly screen: Object; + /** + * The rotation speed. + * + * @type {number} + * @default 1 + */ + rotateSpeed: number; + /** + * The zoom speed. + * + * @type {number} + * @default 1.2 + */ + zoomSpeed: number; + /** + * The pan speed. + * + * @type {number} + * @default 0.3 + */ + panSpeed: number; + /** + * The roll speed used for multi-touch roll. + * + * @type {number} + * @default 1 + */ + rollSpeed: number; + /** + * Whether rotation is disabled or not. + * + * @type {boolean} + * @default false + */ + noRotate: boolean; + /** + * Whether zooming is disabled or not. + * + * @type {boolean} + * @default false + */ + noZoom: boolean; + /** + * Whether panning is disabled or not. + * + * @type {boolean} + * @default false + */ + noPan: boolean; + /** + * Whether two finger twist gesture rolls + * the camera around its view axis or not. + * + * @type {boolean} + * @default false + */ + multiTouchRoll: boolean; + /** + * Whether damping is disabled or not. + * + * @type {boolean} + * @default false + */ + staticMoving: boolean; + /** + * Defines the intensity of damping. Only considered if `staticMoving` is set to `false`. + * + * @type {number} + * @default 0.2 + */ + dynamicDampingFactor: number; + /** + * How far you can dolly in (perspective camera only). + * + * @type {number} + * @default 0 + */ + minDistance: number; + /** + * How far you can dolly out (perspective camera only). + * + * @type {number} + * @default Infinity + */ + maxDistance: number; + /** + * How far you can zoom in (orthographic camera only). + * + * @type {number} + * @default 0 + */ + minZoom: number; + /** + * How far you can zoom out (orthographic camera only). + * + * @type {number} + * @default Infinity + */ + maxZoom: number; + /** + * The focus point of the controls. + * + * @type {Vector3} + */ + target: Vector3; + keyState: number; + _lastPosition: Vector3; + _lastUp: Vector3; + _lastZoom: number; + _touchZoomDistanceStart: number; + _touchZoomDistanceEnd: number; + _touchRollAngle: number; + _touchRollPointerIds: string; + _lastAngle: number; + _lastRollAngle: number; + _eye: Vector3; + _movePrev: Vector2; + _moveCurr: Vector2; + _lastAxis: Vector3; + _zoomStart: Vector2; + _zoomEnd: Vector2; + _panStart: Vector2; + _panEnd: Vector2; + _pointers: any[]; + _pointerPositions: {}; + _onPointerMove: typeof onPointerMove; + _onPointerDown: typeof onPointerDown; + _onPointerUp: typeof onPointerUp; + _onPointerCancel: typeof onPointerCancel; + _onContextMenu: typeof onContextMenu; + _onMouseWheel: typeof onMouseWheel; + _onKeyDown: typeof onKeyDown; + _onKeyUp: typeof onKeyUp; + _onTouchStart: typeof onTouchStart; + _onTouchMove: typeof onTouchMove; + _onTouchEnd: typeof onTouchEnd; + _onMouseDown: typeof onMouseDown; + _onMouseMove: typeof onMouseMove; + _onMouseUp: typeof onMouseUp; + _target0: Vector3; + _position0: any; + _up0: Vector3; + _zoom0: any; + connect(element: any): void; + /** + * Must be called if the application window is resized. + */ + handleResize(): void; + /** + * Resets the controls to its initial state. + */ + reset(): void; + _panCamera(): void; + _rotateCamera(): void; + _rollCamera(): void; + _getTouchRollAngle(): number; + _zoomCamera(): void; + _getMouseOnScreen(pageX: any, pageY: any): Vector2; + _getMouseOnCircle(pageX: any, pageY: any): Vector2; + _addPointer(event: any): void; + _removePointer(event: any): void; + _trackPointer(event: any): void; + _getSecondPointerPosition(event: any): any; + _checkDistances(): void; +} +import { Controls } from 'three'; +import { Vector3 } from 'three'; +import { Vector2 } from 'three'; +declare function onPointerMove(event: any): void; +declare function onPointerDown(event: any): void; +declare function onPointerUp(event: any): void; +declare function onPointerCancel(event: any): void; +declare function onContextMenu(event: any): void; +declare function onMouseWheel(event: any): void; +declare function onKeyDown(event: any): void; +declare class onKeyDown { + constructor(event: any); + keyState: number | undefined; +} +declare function onKeyUp(): void; +declare class onKeyUp { + keyState: number | undefined; +} +declare function onTouchStart(event: any): void; +declare class onTouchStart { + constructor(event: any); + state: number; + _touchZoomDistanceEnd: number | undefined; + _touchZoomDistanceStart: number | undefined; +} +declare function onTouchMove(event: any): void; +declare class onTouchMove { + constructor(event: any); + _touchZoomDistanceEnd: number | undefined; +} +declare function onTouchEnd(event: any): void; +declare class onTouchEnd { + constructor(event: any); + state: number | undefined; +} +declare function onMouseDown(event: any): void; +declare class onMouseDown { + constructor(event: any); + state: number; +} +declare function onMouseMove(event: any): void; +declare function onMouseUp(): void; +declare class onMouseUp { + state: number; +} +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts new file mode 100644 index 000000000..1595900fb --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts @@ -0,0 +1,191 @@ +/** + * This class can be used to transform objects in 3D space by adapting a similar interaction model + * of DCC tools like Blender. Unlike other controls, it is not intended to transform the scene's camera. + * + * `TransformControls` expects that its attached 3D object is part of the scene graph. + * + * @augments Controls + * @three_import import { TransformControls } from 'three/addons/controls/TransformControls.js'; + */ +export class TransformControls extends Controls { + /** + * Constructs a new controls instance. + * + * @param {Camera} camera - The camera of the rendered scene. + * @param {?HTMLElement} domElement - The HTML element used for event listeners. + */ + constructor(camera: Camera, domElement?: HTMLElement | null); + _root: TransformControlsRoot; + _gizmo: TransformControlsGizmo; + _plane: TransformControlsPlane; + /** + * The viewport rectangle, in logical (CSS) pixels with the origin at the lower-left + * of the canvas. Set this when the renderer uses a sub-canvas viewport so pointer + * coordinates map to the correct region. If `null`, the full canvas is used. + * + * @name TransformControls#viewport + * @type {?Vector4} + * @default null + */ + viewport: Vector4 | null; + _offset: Vector3; + _startNorm: Vector3; + _endNorm: Vector3; + _cameraScale: Vector3; + _parentPosition: Vector3; + _parentQuaternion: Quaternion; + _parentQuaternionInv: Quaternion; + _parentScale: Vector3; + _worldScaleStart: Vector3; + _worldQuaternionInv: Quaternion; + _worldScale: Vector3; + _positionStart: Vector3; + _quaternionStart: Quaternion; + _scaleStart: Vector3; + _getPointer: typeof getPointer; + _onPointerDown: typeof onPointerDown; + _onPointerHover: typeof onPointerHover; + _onPointerMove: typeof onPointerMove; + _onPointerUp: typeof onPointerUp; + connect(element: any): void; + /** + * Returns the visual representation of the controls. Add the helper to your scene to + * visually transform the attached 3D object. + * + * @return {TransformControlsRoot} The helper. + */ + getHelper(): TransformControlsRoot; + pointerHover(pointer: any): void; + axis: any; + pointerDown(pointer: any): void; + dragging: boolean | undefined; + pointerMove(pointer: any): void; + rotationAngle: any; + pointerUp(pointer: any): void; + /** + * Sets the 3D object that should be transformed and ensures the controls UI is visible. + * + * @param {Object3D} object - The 3D object that should be transformed. + * @return {TransformControls} A reference to this controls. + */ + attach(object: Object3D): TransformControls; + /** + * Removes the current 3D object from the controls and makes the helper UI invisible. + * + * @return {TransformControls} A reference to this controls. + */ + detach(): TransformControls; + /** + * Resets the object's position, rotation and scale to when the current transform began. + */ + reset(): void; + /** + * Returns the raycaster that is used for user interaction. This object is shared between all + * instances of `TransformControls`. + * + * @returns {Raycaster} The internal raycaster. + */ + getRaycaster(): Raycaster; + /** + * Returns the transformation mode. + * + * @returns {'translate'|'rotate'|'scale'} The transformation mode. + */ + getMode(): "translate" | "rotate" | "scale"; + /** + * Sets the given transformation mode. + * + * @param {'translate'|'rotate'|'scale'} mode - The transformation mode to set. + */ + setMode(mode: "translate" | "rotate" | "scale"): void; + mode: "rotate" | "scale" | "translate" | undefined; + /** + * Sets the translation snap. + * + * @param {?number} translationSnap - The translation snap to set. + */ + setTranslationSnap(translationSnap: number | null): void; + translationSnap: number | null | undefined; + /** + * Sets the rotation snap. + * + * @param {?number} rotationSnap - The rotation snap to set. + */ + setRotationSnap(rotationSnap: number | null): void; + rotationSnap: number | null | undefined; + /** + * Sets the scale snap. + * + * @param {?number} scaleSnap - The scale snap to set. + */ + setScaleSnap(scaleSnap: number | null): void; + scaleSnap: number | null | undefined; + /** + * Sets the size of the helper UI. + * + * @param {number} size - The size to set. + */ + setSize(size: number): void; + size: number | undefined; + /** + * Sets the coordinate space in which transformations are applied. + * + * @param {'world'|'local'} space - The space to set. + */ + setSpace(space: "world" | "local"): void; + space: "world" | "local" | undefined; + /** + * Sets the colors of the control's gizmo. + * + * @param {number|Color|string} xAxis - The x-axis color. + * @param {number|Color|string} yAxis - The y-axis color. + * @param {number|Color|string} zAxis - The z-axis color. + * @param {number|Color|string} active - The color for active elements. + */ + setColors(xAxis: number | Color | string, yAxis: number | Color | string, zAxis: number | Color | string, active: number | Color | string): void; +} +export class TransformControlsGizmo extends Object3D { + isTransformControlsGizmo: boolean; + type: string; + materialLib: { + xAxis: import("three").Material; + yAxis: import("three").Material; + zAxis: import("three").Material; + active: import("three").Material; + xAxisTransparent: import("three").Material; + yAxisTransparent: import("three").Material; + zAxisTransparent: import("three").Material; + activeTransparent: import("three").Material; + }; + gizmo: {}; + picker: {}; + helper: {}; + updateMatrixWorld(force: any): void; +} +export class TransformControlsPlane extends Mesh { + constructor(); + isTransformControlsPlane: boolean; + updateMatrixWorld(force: any): void; +} +import { Controls } from 'three'; +declare class TransformControlsRoot extends Object3D { + constructor(controls: any); + isTransformControlsRoot: boolean; + controls: any; + updateMatrixWorld(force: any): void; +} +import { Vector3 } from 'three'; +import { Quaternion } from 'three'; +declare function getPointer(event: any): { + x: number; + y: number; + button: any; +}; +declare function onPointerDown(event: any): void; +declare function onPointerHover(event: any): void; +declare function onPointerMove(event: any): void; +declare function onPointerUp(event: any): void; +import { Object3D } from 'three'; +import { Raycaster } from 'three'; +import { Mesh } from 'three'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts new file mode 100644 index 000000000..ed5c7f8ee --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts @@ -0,0 +1,214 @@ +/** + * An implementation of Cascade Shadow Maps (CSM). + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * use {@link CSMShadowNode} instead. + * + * @three_import import { CSM } from 'three/addons/csm/CSM.js'; + */ +export class CSM { + /** + * Constructs a new CSM instance. + * + * @param {CSM~Data} data - The CSM data. + */ + constructor(data: any); + /** + * The scene's camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * The parent object, usually the scene. + * + * @type {Object3D} + */ + parent: Object3D; + /** + * The number of cascades. + * + * @type {number} + * @default 3 + */ + cascades: number; + /** + * The maximum far value. + * + * @type {number} + * @default 100000 + */ + maxFar: number; + /** + * The frustum split mode. + * + * @type {('practical'|'uniform'|'logarithmic'|'custom')} + * @default 'practical' + */ + mode: ("practical" | "uniform" | "logarithmic" | "custom"); + /** + * The shadow map size. + * + * @type {number} + * @default 2048 + */ + shadowMapSize: number; + /** + * The shadow bias. + * + * @type {number} + * @default 0.000001 + */ + shadowBias: number; + /** + * The light direction. + * + * @type {Vector3} + */ + lightDirection: Vector3; + /** + * The light intensity. + * + * @type {number} + * @default 3 + */ + lightIntensity: number; + /** + * The light near value. + * + * @type {number} + * @default 1 + */ + lightNear: number; + /** + * The light far value. + * + * @type {number} + * @default 2000 + */ + lightFar: number; + /** + * The light margin. + * + * @type {number} + * @default 200 + */ + lightMargin: number; + /** + * Custom split callback when using `mode='custom'`. + * + * @type {Function} + */ + customSplitsCallback: Function; + /** + * Whether to fade between cascades or not. + * + * @type {boolean} + * @default false + */ + fade: boolean; + /** + * The main frustum. + * + * @type {CSMFrustum} + */ + mainFrustum: CSMFrustum; + /** + * An array of frustums representing the cascades. + * + * @type {Array} + */ + frustums: Array; + /** + * An array of numbers in the range `[0,1]` the defines how the + * mainCSM frustum should be split up. + * + * @type {Array} + */ + breaks: Array; + /** + * An array of directional lights which cast the shadows for + * the different cascades. There is one directional light for each + * cascade. + * + * @type {Array} + */ + lights: Array; + /** + * A Map holding enhanced material shaders. + * + * @type {Map} + */ + shaders: Map; + /** + * Creates the directional lights of this CSM instance. + * + * @private + */ + private _createLights; + /** + * Inits the cascades according to the scene's camera and breaks configuration. + * + * @private + */ + private _initCascades; + /** + * Updates the shadow bounds of this CSM instance. + * + * @private + */ + private _updateShadowBounds; + /** + * Computes the breaks of this CSM instance based on the scene's camera, number of cascades + * and the selected split mode. + * + * @private + */ + private _getBreaks; + /** + * Updates the CSM. This method must be called in your animation loop before + * calling `renderer.render()`. + */ + update(): void; + /** + * Injects the CSM shader enhancements into the built-in materials. + * + * @private + */ + private _injectInclude; + /** + * Applications must call this method for all materials that should be affected by CSM. + * + * @param {Material} material - The material to setup for CSM support. + */ + setupMaterial(material: Material): void; + /** + * Updates the CSM uniforms. + * + * @private + */ + private _updateUniforms; + /** + * Computes the extended breaks for the CSM uniforms. + * + * @private + * @param {Array} target - The target array that holds the extended breaks. + */ + private _getExtendedBreaks; + /** + * Applications must call this method every time they change camera or CSM settings. + */ + updateFrustums(): void; + /** + * Applications must call this method when they remove the CSM usage from their scene. + */ + remove(): void; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + */ + dispose(): void; +} +import { Vector3 } from 'three'; +import { CSMFrustum } from './CSMFrustum.js'; +import { DirectionalLight } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts new file mode 100644 index 000000000..d3c23f934 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts @@ -0,0 +1,81 @@ +/** + * ~Data + */ +export type CSMFrustum = { + /** + * - Whether this CSM frustum is used with WebGL or WebGPU. + */ + webGL?: boolean | undefined; + /** + * - Whether reversed depth buffer is enabled. + */ + reversedDepth?: boolean | undefined; + /** + * - A projection matrix usually of the scene's camera. + */ + projectionMatrix?: Matrix4 | undefined; + /** + * - The maximum far value. + */ + maxFar?: number | undefined; +}; +import { Matrix4 } from 'three'; +/** + * Represents the frustum of a CSM instance. + * + * @three_import import { CSMFrustum } from 'three/addons/csm/CSMFrustum.js'; + */ +export class CSMFrustum { + /** + * Constructs a new CSM frustum. + * + * @param {CSMFrustum~Data} [data] - The CSM data. + */ + constructor(data: any); + /** + * The zNear value. This value depends on whether the CSM + * is used with WebGL or WebGPU. Both API use different + * conventions for their projection matrices. + * + * @type {number} + */ + zNear: number; + /** + * The zFar value. + * + * @type {number} + */ + zFar: number; + /** + * An object representing the vertices of the near and + * far plane in view space. + * + * @type {Object} + */ + vertices: Object; + /** + * Setups this CSM frustum from the given projection matrix and max far value. + * + * @param {Matrix4} projectionMatrix - The projection matrix, usually of the scene's camera. + * @param {number} maxFar - The maximum far value. + * @returns {Object} An object representing the vertices of the near and far plane in view space. + */ + setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): Object; + /** + * Splits the CSM frustum by the given array. The new CSM frustum are pushed into the given + * target array. + * + * @param {Array} breaks - An array of numbers in the range `[0,1]` the defines how the + * CSM frustum should be split up. + * @param {Array} target - The target array that holds the new CSM frustums. + */ + split(breaks: Array, target: Array): void; + /** + * Transforms the given target CSM frustum into the different coordinate system defined by the + * given camera matrix. + * + * @param {Matrix4} cameraMatrix - The matrix that defines the new coordinate system. + * @param {CSMFrustum} target - The CSM to convert. + */ + toSpace(cameraMatrix: Matrix4, target: CSMFrustum): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts new file mode 100644 index 000000000..92be72fdf --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts @@ -0,0 +1,55 @@ +/** + * A helper for visualizing the cascades of a CSM instance. + * + * @augments Group + * @three_import import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; + */ +export class CSMHelper extends Group { + /** + * Constructs a new CSM helper. + * + * @param {CSM|CSMShadowNode} csm - The CSM instance to visualize. + */ + constructor(csm: CSM | CSMShadowNode); + /** + * The CSM instance to visualize. + * + * @type {CSM|CSMShadowNode} + */ + csm: CSM | CSMShadowNode; + /** + * Whether to display the CSM frustum or not. + * + * @type {boolean} + * @default true + */ + displayFrustum: boolean; + /** + * Whether to display the cascade planes or not. + * + * @type {boolean} + * @default true + */ + displayPlanes: boolean; + /** + * Whether to display the shadow bounds or not. + * + * @type {boolean} + * @default true + */ + displayShadowBounds: boolean; + frustumLines: LineSegments; + cascadeLines: any[]; + cascadePlanes: any[]; + shadowLines: any[]; + /** + * This method must be called if one of the `display*` properties is changed at runtime. + */ + updateVisibility(): void; + /** + * Updates the helper. This method should be called in the app's animation loop. + */ + update(): void; +} +import { Group } from 'three'; +import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts new file mode 100644 index 000000000..8bcc7f719 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module CSMShader + * @three_import import { CSMShader } from 'three/addons/csm/CSMShader.js'; + */ +/** + * The object that holds the GLSL enhancements to enable CSM. This + * code is injected into the built-in material shaders by {@link CSM}. + * + * @type {Object} + */ +export const CSMShader: Object; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts new file mode 100644 index 000000000..6c42c9ff2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts @@ -0,0 +1,176 @@ +/** + * ~Data + */ +export type CSMShadowNode = { + /** + * - The number of cascades. + */ + cascades?: number | undefined; + /** + * - The maximum far value. + */ + maxFar?: number | undefined; + /** + * - The frustum split mode. + */ + mode?: "uniform" | "custom" | "practical" | "logarithmic" | undefined; + /** + * - Custom split callback when using `mode='custom'`. + */ + customSplitsCallback?: Function | undefined; + /** + * - The light margin. + */ + lightMargin?: number | undefined; +}; +/** + * An implementation of Cascade Shadow Maps (CSM). + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * use {@link CSM} instead. + * + * @augments ShadowBaseNode + * @three_import import { CSMShadowNode } from 'three/addons/csm/CSMShadowNode.js'; + */ +export class CSMShadowNode extends ShadowBaseNode { + /** + * Constructs a new CSM shadow node. + * + * @param {DirectionalLight} light - The CSM light. + * @param {CSMShadowNode~Data} [data={}] - The CSM data. + */ + constructor(light: DirectionalLight, data?: {}); + /** + * The scene's camera. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * The number of cascades. + * + * @type {number} + * @default 3 + */ + cascades: number; + /** + * The maximum far value. + * + * @type {number} + * @default 100000 + */ + maxFar: number; + /** + * The frustum split mode. + * + * @type {('practical'|'uniform'|'logarithmic'|'custom')} + * @default 'practical' + */ + mode: ("practical" | "uniform" | "logarithmic" | "custom"); + /** + * The light margin. + * + * @type {number} + * @default 200 + */ + lightMargin: number; + /** + * Custom split callback when using `mode='custom'`. + * + * @type {Function} + */ + customSplitsCallback: Function; + /** + * Whether to fade between cascades or not. + * + * @type {boolean} + * @default false + */ + fade: boolean; + /** + * An array of numbers in the range `[0,1]` the defines how the + * mainCSM frustum should be split up. + * + * @type {Array} + */ + breaks: Array; + _cascades: any[]; + /** + * The main frustum. + * + * @type {?CSMFrustum} + * @default null + */ + mainFrustum: CSMFrustum | null; + /** + * An array of frustums representing the cascades. + * + * @type {Array} + */ + frustums: Array; + /** + * An array of directional lights which cast the shadows for + * the different cascades. There is one directional light for each + * cascade. + * + * @type {Array} + */ + lights: Array; + _shadowNodes: any[]; + /** + * Inits the CSM shadow node. + * + * @private + * @param {NodeBuilder} builder - The node builder. + */ + private _init; + /** + * Inits the cascades according to the scene's camera and breaks configuration. + * + * @private + */ + private _initCascades; + /** + * Computes the breaks of this CSM instance based on the scene's camera, number of cascades + * and the selected split mode. + * + * @private + */ + private _getBreaks; + /** + * Sets the light breaks. + * + * @private + */ + private _setLightBreaks; + /** + * Updates the shadow bounds of this CSM instance. + * + * @private + */ + private _updateShadowBounds; + /** + * Applications must call this method every time they change camera or CSM settings. + */ + updateFrustums(): void; + /** + * Setups the TSL when using fading. + * + * @private + * @return {ShaderCallNodeInternal} + */ + private _setupFade; + /** + * Setups the TSL when no fading (default). + * + * @private + * @return {ShaderCallNodeInternal} + */ + private _setupStandard; + build(builder: any): string | import("three/webgpu").Node | null; + setup(builder: any): any; + updateBefore(): void; +} +import { ShadowBaseNode } from 'three/webgpu'; +import { CSMFrustum } from './CSMFrustum.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts new file mode 100644 index 000000000..98cb8b3f6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts @@ -0,0 +1,378 @@ +/** + * A bunch of parametric curves + * + * Formulas collected from various sources + * http://mathworld.wolfram.com/HeartCurve.html + * http://en.wikipedia.org/wiki/Viviani%27s_curve + * http://www.mi.sanu.ac.rs/vismath/taylorapril2011/Taylor.pdf + * https://prideout.net/blog/old/blog/index.html@p=44.html + */ +/** + * A Granny Knot curve. + * + * @augments Curve + * @three_import import { GrannyKnot } from 'three/addons/curves/CurveExtras.js'; + */ +export class GrannyKnot extends Curve { + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A heart curve. + * + * @augments Curve + * @three_import import { HeartCurve } from 'three/addons/curves/CurveExtras.js'; + */ +export class HeartCurve extends Curve { + /** + * Constructs a new heart curve. + * + * @param {number} [scale=5] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 5 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Viviani curve. + * + * @augments Curve + * @three_import import { VivianiCurve } from 'three/addons/curves/CurveExtras.js'; + */ +export class VivianiCurve extends Curve { + /** + * Constructs a new Viviani curve. + * + * @param {number} [scale=70] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 70 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A knot curve. + * + * @augments Curve + * @three_import import { KnotCurve } from 'three/addons/curves/CurveExtras.js'; + */ +export class KnotCurve extends Curve { + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A helix curve. + * + * @augments Curve + * @three_import import { HelixCurve } from 'three/addons/curves/CurveExtras.js'; + */ +export class HelixCurve extends Curve { + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Trefoil Knot. + * + * @augments Curve + * @three_import import { TrefoilKnot } from 'three/addons/curves/CurveExtras.js'; + */ +export class TrefoilKnot extends Curve { + /** + * Constructs a new Trefoil Knot. + * + * @param {number} [scale=10] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 10 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A torus knot. + * + * @augments Curve + * @three_import import { TorusKnot } from 'three/addons/curves/CurveExtras.js'; + */ +export class TorusKnot extends Curve { + /** + * Constructs a new torus knot. + * + * @param {number} [scale=10] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 10 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Cinquefoil Knot. + * + * @augments Curve + * @three_import import { CinquefoilKnot } from 'three/addons/curves/CurveExtras.js'; + */ +export class CinquefoilKnot extends Curve { + /** + * Constructs a new Cinquefoil Knot. + * + * @param {number} [scale=10] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 10 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Trefoil Polynomial Knot. + * + * @augments Curve + * @three_import import { TrefoilPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; + */ +export class TrefoilPolynomialKnot extends Curve { + /** + * Constructs a new Trefoil Polynomial Knot. + * + * @param {number} [scale=10] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 10 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Figure Eight Polynomial Knot. + * + * @augments Curve + * @three_import import { FigureEightPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; + */ +export class FigureEightPolynomialKnot extends Curve { + /** + * Constructs a new Figure Eight Polynomial Knot. + * + * @param {number} [scale=1] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 1 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Decorated Torus Knot 4a. + * + * @augments Curve + * @three_import import { DecoratedTorusKnot4a } from 'three/addons/curves/CurveExtras.js'; + */ +export class DecoratedTorusKnot4a extends Curve { + /** + * Constructs a new Decorated Torus Knot 4a. + * + * @param {number} [scale=1] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 40 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Decorated Torus Knot 4b. + * + * @augments Curve + * @three_import import { DecoratedTorusKnot4b } from 'three/addons/curves/CurveExtras.js'; + */ +export class DecoratedTorusKnot4b extends Curve { + /** + * Constructs a new Decorated Torus Knot 4b. + * + * @param {number} [scale=1] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 40 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Decorated Torus Knot 5a. + * + * @augments Curve + * @three_import import { DecoratedTorusKnot5a } from 'three/addons/curves/CurveExtras.js'; + */ +export class DecoratedTorusKnot5a extends Curve { + /** + * Constructs a new Decorated Torus Knot 5a. + * + * @param {number} [scale=1] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 40 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +/** + * A Decorated Torus Knot 5c. + * + * @augments Curve + * @three_import import { DecoratedTorusKnot5c } from 'three/addons/curves/CurveExtras.js'; + */ +export class DecoratedTorusKnot5c extends Curve { + /** + * Constructs a new Decorated Torus Knot 5c. + * + * @param {number} [scale=1] - The curve's scale. + */ + constructor(scale?: number); + /** + * The curve's scale. + * + * @type {number} + * @default 40 + */ + scale: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; +} +import { Curve } from 'three'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts new file mode 100644 index 000000000..3a2af704a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts @@ -0,0 +1,70 @@ +/** + * This class represents a NURBS curve. + * + * Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. + * + * @augments Curve + * @three_import import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js'; + */ +export class NURBSCurve extends Curve { + /** + * Constructs a new NURBS curve. + * + * @param {number} degree - The NURBS degree. + * @param {Array} knots - The knots as a flat array of numbers. + * @param {Array} controlPoints - An array holding control points. + * @param {number} [startKnot] - Index of the start knot into the `knots` array. + * @param {number} [endKnot] - Index of the end knot into the `knots` array. + */ + constructor(degree: number, knots: Array, controlPoints: Array, startKnot?: number, endKnot?: number); + /** + * The NURBS degree. + * + * @type {number} + */ + degree: number; + /** + * The knots as a flat array of numbers. + * + * @type {Array} + */ + knots: Array; + /** + * An array of control points. + * + * @type {Array} + */ + controlPoints: Array; + /** + * Index of the start knot into the `knots` array. + * + * @type {number} + */ + startKnot: number; + /** + * Index of the end knot into the `knots` array. + * + * @type {number} + */ + endKnot: number; + /** + * This method returns a vector in 3D space for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; + /** + * Returns a unit vector tangent for the given interpolation factor. + * + * @param {number} t - The interpolation factor. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The tangent vector. + */ + getTangent(t: number, optionalTarget?: Vector3): Vector3; + fromJSON(json: any): this; +} +import { Curve } from 'three'; +import { Vector4 } from 'three'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts new file mode 100644 index 000000000..f55a5954a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts @@ -0,0 +1,58 @@ +/** + * This class represents a NURBS surface. + * + * Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. + * + * @three_import import { NURBSSurface } from 'three/addons/curves/NURBSSurface.js'; + */ +export class NURBSSurface { + /** + * Constructs a new NURBS surface. + * + * @param {number} degree1 - The first NURBS degree. + * @param {number} degree2 - The second NURBS degree. + * @param {Array} knots1 - The first knots as a flat array of numbers. + * @param {Array} knots2 - The second knots as a flat array of numbers. + * @param {Array>} controlPoints - An array^2 holding control points. + */ + constructor(degree1: number, degree2: number, knots1: Array, knots2: Array, controlPoints: Array>); + /** + * The first NURBS degree. + * + * @type {number} + */ + degree1: number; + /** + * The second NURBS degree. + * + * @type {number} + */ + degree2: number; + /** + * The first knots as a flat array of numbers. + * + * @type {Array} + */ + knots1: Array; + /** + * The second knots as a flat array of numbers. + * + * @type {Array} + */ + knots2: Array; + /** + * An array holding arrays of control points. + * + * @type {Array>} + */ + controlPoints: Array>; + /** + * This method returns a vector in 3D space for the given interpolation factor. This vector lies on the NURBS surface. + * + * @param {number} t1 - The first interpolation factor representing the `u` position on the surface. Must be in the range `[0,1]`. + * @param {number} t2 - The second interpolation factor representing the `v` position on the surface. Must be in the range `[0,1]`. + * @param {Vector3} target - The target vector the result is written to. + */ + getPoint(t1: number, t2: number, target: Vector3): void; +} +import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts new file mode 100644 index 000000000..94b6a50e5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts @@ -0,0 +1,112 @@ +/** + * @module NURBSUtils + * @three_import import * as NURBSUtils from 'three/addons/curves/NURBSUtils.js'; + */ +/** + * Finds knot vector span. + * + * @param {number} p - The degree. + * @param {number} u - The parametric value. + * @param {Array} U - The knot vector. + * @return {number} The span. + */ +export function findSpan(p: number, u: number, U: Array): number; +/** + * Calculates basis functions. See The NURBS Book, page 70, algorithm A2.2. + * + * @param {number} span - The span in which `u` lies. + * @param {number} u - The parametric value. + * @param {number} p - The degree. + * @param {Array} U - The knot vector. + * @return {Array} Array[p+1] with basis functions values. + */ +export function calcBasisFunctions(span: number, u: number, p: number, U: Array): Array; +/** + * Calculates B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1. + * + * @param {number} p - The degree of the B-Spline. + * @param {Array} U - The knot vector. + * @param {Array} P - The control points + * @param {number} u - The parametric point. + * @return {Vector4} The point for given `u`. + */ +export function calcBSplinePoint(p: number, U: Array, P: Array, u: number): Vector4; +/** + * Calculates basis functions derivatives. See The NURBS Book, page 72, algorithm A2.3. + * + * @param {number} span - The span in which `u` lies. + * @param {number} u - The parametric point. + * @param {number} p - The degree. + * @param {number} n - number of derivatives to calculate + * @param {Array} U - The knot vector. + * @return {Array>} An array[n+1][p+1] with basis functions derivatives. + */ +export function calcBasisFunctionDerivatives(span: number, u: number, p: number, n: number, U: Array): Array>; +/** + * Calculates derivatives of a B-Spline. See The NURBS Book, page 93, algorithm A3.2. + * + * @param {number} p - The degree. + * @param {Array} U - The knot vector. + * @param {Array} P - The control points + * @param {number} u - The parametric point. + * @param {number} nd - The number of derivatives. + * @return {Array} An array[d+1] with derivatives. + */ +export function calcBSplineDerivatives(p: number, U: Array, P: Array, u: number, nd: number): Array; +/** + * Calculates "K over I". + * + * @param {number} k - The K value. + * @param {number} i - The I value. + * @return {number} k!/(i!(k-i)!) + */ +export function calcKoverI(k: number, i: number): number; +/** + * Calculates derivatives (0-nd) of rational curve. See The NURBS Book, page 127, algorithm A4.2. + * + * @param {Array} Pders - Array with derivatives. + * @return {Array} An array with derivatives for rational curve. + */ +export function calcRationalCurveDerivatives(Pders: Array): Array; +/** + * Calculates NURBS curve derivatives. See The NURBS Book, page 127, algorithm A4.2. + * + * @param {number} p - The degree. + * @param {Array} U - The knot vector. + * @param {Array} P - The control points in homogeneous space. + * @param {number} u - The parametric point. + * @param {number} nd - The number of derivatives. + * @return {Array} array with derivatives for rational curve. + */ +export function calcNURBSDerivatives(p: number, U: Array, P: Array, u: number, nd: number): Array; +/** + * Calculates a rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3. + * + * @param {number} p - The first degree of B-Spline surface. + * @param {number} q - The second degree of B-Spline surface. + * @param {Array} U - The first knot vector. + * @param {Array} V - The second knot vector. + * @param {Array>} P - The control points in homogeneous space. + * @param {number} u - The first parametric point. + * @param {number} v - The second parametric point. + * @param {Vector3} target - The target vector. + */ +export function calcSurfacePoint(p: number, q: number, U: Array, V: Array, P: Array>, u: number, v: number, target: Vector3): void; +/** + * Calculates a rational B-Spline volume point. See The NURBS Book, page 134, algorithm A4.3. + * + * @param {number} p - The first degree of B-Spline surface. + * @param {number} q - The second degree of B-Spline surface. + * @param {number} r - The third degree of B-Spline surface. + * @param {Array} U - The first knot vector. + * @param {Array} V - The second knot vector. + * @param {Array} W - The third knot vector. + * @param {Array>>} P - The control points in homogeneous space. + * @param {number} u - The first parametric point. + * @param {number} v - The second parametric point. + * @param {number} w - The third parametric point. + * @param {Vector3} target - The target vector. + */ +export function calcVolumePoint(p: number, q: number, r: number, U: Array, V: Array, W: Array, P: Array>>, u: number, v: number, w: number, target: Vector3): void; +import { Vector4 } from 'three'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts new file mode 100644 index 000000000..a0ca96016 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts @@ -0,0 +1,38 @@ +/** + * This class represents a NURBS volume. + * + * Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. + * + * @three_import import { NURBSVolume } from 'three/addons/curves/NURBSVolume.js'; + */ +export class NURBSVolume { + /** + * Constructs a new NURBS surface. + * + * @param {number} degree1 - The first NURBS degree. + * @param {number} degree2 - The second NURBS degree. + * @param {number} degree3 - The third NURBS degree. + * @param {Array} knots1 - The first knots as a flat array of numbers. + * @param {Array} knots2 - The second knots as a flat array of numbers. + * @param {Array} knots3 - The third knots as a flat array of numbers. + * @param {Array>>} controlPoints - An array^3 holding control points. + */ + constructor(degree1: number, degree2: number, degree3: number, knots1: Array, knots2: Array, knots3: Array, controlPoints: Array>>); + degree1: number; + degree2: number; + degree3: number; + knots1: number[]; + knots2: number[]; + knots3: number[]; + controlPoints: never[][]; + /** + * This method returns a vector in 3D space for the given interpolation factor. This vector lies within the NURBS volume. + * + * @param {number} t1 - The first interpolation factor representing the `u` position within the volume. Must be in the range `[0,1]`. + * @param {number} t2 - The second interpolation factor representing the `v` position within the volume. Must be in the range `[0,1]`. + * @param {number} t3 - The third interpolation factor representing the `w` position within the volume. Must be in the range `[0,1]`. + * @param {Vector3} target - The target vector the result is written to. + */ + getPoint(t1: number, t2: number, t3: number, target: Vector3): void; +} +import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts new file mode 100644 index 000000000..5b7946284 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts @@ -0,0 +1,68 @@ +/** + * A class that creates an anaglyph effect using physically-correct + * off-axis stereo projection. + * + * This implementation uses CameraUtils.frameCorners() to align stereo + * camera frustums to a virtual screen plane, providing accurate depth + * perception with zero parallax at the plane distance. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link AnaglyphPassNode}. + * + * @three_import import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js'; + */ +export class AnaglyphEffect { + /** + * Constructs a new anaglyph effect. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {number} width - The width of the effect in physical pixels. + * @param {number} height - The height of the effect in physical pixels. + */ + constructor(renderer: WebGLRenderer, width?: number, height?: number); + colorMatrixLeft: Matrix3; + colorMatrixRight: Matrix3; + /** + * The interpupillary distance (eye separation) in world units. + * Typical human IPD is 0.064 meters (64mm). + * + * @type {number} + * @default 0.064 + */ + eyeSep: number; + /** + * The distance in world units from the viewer to the virtual + * screen plane where zero parallax (screen depth) occurs. + * Objects at this distance appear at the screen surface. + * Objects closer appear in front of the screen (negative parallax). + * Objects further appear behind the screen (positive parallax). + * + * The screen dimensions are derived from the camera's FOV and aspect ratio + * at this distance, ensuring the stereo view matches the camera's field of view. + * + * @type {number} + * @default 0.5 + */ + planeDistance: number; + /** + * Resizes the effect. + * + * @param {number} width - The width of the effect in logical pixels. + * @param {number} height - The height of the effect in logical pixels. + */ + setSize: (width: number, height: number) => void; + /** + * When using this effect, this method should be called instead of the + * default {@link WebGLRenderer#render}. + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * Frees internal resources. This method should be called + * when the effect is no longer required. + */ + dispose: () => void; +} +import { Matrix3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts new file mode 100644 index 000000000..2da2a39de --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts @@ -0,0 +1,72 @@ +/** + * ~Options + */ +export type AsciiEffect = { + /** + * - A higher value leads to more details. + */ + resolution?: number | undefined; + /** + * - The scale of the effect. + */ + scale?: number | undefined; + /** + * - Whether colors should be enabled or not. Better quality but slows down rendering. + */ + color?: boolean | undefined; + /** + * - Whether transparency should be enabled or not. + */ + alpha?: boolean | undefined; + /** + * - Whether blocked characters should be enabled or not. + */ + block?: boolean | undefined; + /** + * - Whether colors should be inverted or not. + */ + invert?: boolean | undefined; + /** + * - The string resolution. + */ + strResolution?: "high" | "low" | "medium" | undefined; +}; +/** + * A class that creates an ASCII effect. + * + * The ASCII generation is based on [jsascii](https://github.com/hassadee/jsascii/blob/master/jsascii.js). + * + * @three_import import { AsciiEffect } from 'three/addons/effects/AsciiEffect.js'; + */ +export class AsciiEffect { + /** + * Constructs a new ASCII effect. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {string} [charSet=' .:-=+*#%@'] - The char set. + * @param {AsciiEffect~Options} [options] - The configuration parameter. + */ + constructor(renderer: WebGLRenderer, charSet?: string, options?: {}); + /** + * Resizes the effect. + * + * @param {number} w - The width of the effect in logical pixels. + * @param {number} h - The height of the effect in logical pixels. + */ + setSize: (w: number, h: number) => void; + /** + * When using this effect, this method should be called instead of the + * default {@link WebGLRenderer#render}. + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * The DOM element of the effect. This element must be used instead of the + * default {@link WebGLRenderer#domElement}. + * + * @type {HTMLDivElement} + */ + domElement: HTMLDivElement; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts new file mode 100644 index 000000000..1d5312135 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts @@ -0,0 +1,89 @@ +/** + * ~Options + */ +export type OutlineEffect = { + /** + * - The outline thickness. + */ + defaultThickness?: number | undefined; + /** + * - The outline color. + */ + defaultColor?: number[] | undefined; + /** + * - The outline alpha value. + */ + defaultAlpha?: number | undefined; + /** + * - Whether to keep alive cached internal materials or not. + */ + defaultKeepAlive?: boolean | undefined; +}; +/** + * An outline effect for toon shaders. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link ToonOutlinePassNode}. + * + * ```js + * const effect = new OutlineEffect( renderer ); + * + * function render() { + * + * effect.render( scene, camera ); + * + * } + * ``` + * + * @three_import import { OutlineEffect } from 'three/addons/effects/OutlineEffect.js'; + */ +export class OutlineEffect { + /** + * Constructs a new outline effect. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {OutlineEffect~Options} [parameters] - The configuration parameter. + */ + constructor(renderer: WebGLRenderer, parameters?: {}); + enabled: boolean; + /** + * When using this effect, this method should be called instead of the + * default {@link WebGLRenderer#render}. + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * This method can be used to render outlines in VR. + * + * ```js + * const effect = new OutlineEffect( renderer ); + * let renderingOutline = false; + * + * scene.onAfterRender = function () { + * + * if ( renderingOutline ) return; + * + * renderingOutline = true; + * effect.renderOutline( scene, camera ); + * renderingOutline = false; + * }; + * + * function render() { + * renderer.render( scene, camera ); + * } + * ``` + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + renderOutline: (scene: Object3D, camera: Camera) => void; + /** + * Resizes the effect. + * + * @param {number} width - The width of the effect in logical pixels. + * @param {number} height - The height of the effect in logical pixels. + */ + setSize: (width: number, height: number) => void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts new file mode 100644 index 000000000..7fc021f50 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts @@ -0,0 +1,36 @@ +/** + * A class that creates an parallax barrier effect. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link ParallaxBarrierPassNode}. + * + * @three_import import { ParallaxBarrierEffect } from 'three/addons/effects/ParallaxBarrierEffect.js'; + */ +export class ParallaxBarrierEffect { + /** + * Constructs a new parallax barrier effect. + * + * @param {WebGLRenderer} renderer - The renderer. + */ + constructor(renderer: WebGLRenderer); + /** + * Resizes the effect. + * + * @param {number} width - The width of the effect in logical pixels. + * @param {number} height - The height of the effect in logical pixels. + */ + setSize: (width: number, height: number) => void; + /** + * When using this effect, this method should be called instead of the + * default {@link WebGLRenderer#render}. + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * Frees internal resources. This method should be called + * when the effect is no longer required. + */ + dispose: () => void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts new file mode 100644 index 000000000..b76fcfce7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts @@ -0,0 +1,37 @@ +/** + * A class that creates an stereo effect. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link StereoPassNode}. + * + * @three_import import { StereoEffect } from 'three/addons/effects/StereoEffect.js'; + */ +export class StereoEffect { + /** + * Constructs a new stereo effect. + * + * @param {WebGLRenderer} renderer - The renderer. + */ + constructor(renderer: WebGLRenderer); + /** + * Sets the given eye separation. + * + * @param {number} eyeSep - The eye separation to set. + */ + setEyeSeparation: (eyeSep: number) => void; + /** + * Resizes the effect. + * + * @param {number} width - The width of the effect in logical pixels. + * @param {number} height - The height of the effect in logical pixels. + */ + setSize: (width: number, height: number) => void; + /** + * When using this effect, this method should be called instead of the + * default {@link WebGLRenderer#render}. + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts new file mode 100644 index 000000000..55febdcd8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts @@ -0,0 +1,26 @@ +/** + * This class represents a scene with a uniform color that can be used as + * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents + * uniform ambient lighting and can be used for Image Based Lighting by + * assigning it to {@link Scene#environment}. + * + * ```js + * const environment = new ColorEnvironment( 0x00ff00 ); + * const pmremGenerator = new THREE.PMREMGenerator( renderer ); + * + * const envMap = pmremGenerator.fromScene( environment ).texture; + * scene.environment = envMap; + * ``` + * + * @augments Scene + * @three_import import { ColorEnvironment } from 'three/addons/environments/ColorEnvironment.js'; + */ +export class ColorEnvironment extends Scene { + /** + * Constructs a new color environment. + * + * @param {number|Color} color - The color of the environment. + */ + constructor(color?: number | Color); +} +import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts new file mode 100644 index 000000000..6b78297f3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts @@ -0,0 +1,23 @@ +/** + * This class represents a scene with a very basic room setup that can be used as + * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's + * lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment} + * or directly as an environment map to PBR materials. + * + * This class uses a simple room setup and should only be used for development purposes. + * A more appropriate setup for production is {@link RoomEnvironment}. + * + * ```js + * const environment = new DebugEnvironment(); + * const pmremGenerator = new THREE.PMREMGenerator( renderer ); + * + * const envMap = pmremGenerator.fromScene( environment ).texture; + * scene.environment = envMap; + * ``` + * + * @augments Scene + * @three_import import { DebugEnvironment } from 'three/addons/environments/DebugEnvironment.js'; + */ +export class DebugEnvironment extends Scene { +} +import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts new file mode 100644 index 000000000..dae7d7c67 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts @@ -0,0 +1,23 @@ +/** + * This class represents a scene with a basic room setup that can be used as + * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's + * lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment} + * or directly as an environment map to PBR materials. + * + * The implementation is based on the [EnvironmentScene](https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts) + * component from the `model-viewer` project. + * + * ```js + * const environment = new RoomEnvironment(); + * const pmremGenerator = new THREE.PMREMGenerator( renderer ); + * + * const envMap = pmremGenerator.fromScene( environment ).texture; + * scene.environment = envMap; + * ``` + * + * @augments Scene + * @three_import import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + */ +export class RoomEnvironment extends Scene { +} +import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts new file mode 100644 index 000000000..05a373538 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts @@ -0,0 +1,86 @@ +/** + * ~Options + */ +export type DRACOExporter = { + /** + * - Indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality). + */ + decodeSpeed?: number | undefined; + /** + * - Indicates how to tune the encoder parameters (0 gives better speed but worst quality). + */ + encodeSpeed?: number | undefined; + /** + * - Either sequential (very little compression) or Edgebreaker. Edgebreaker traverses the triangles of the mesh in a deterministic, spiral-like way which provides most of the benefits of this data format. + */ + encoderMethod?: number | undefined; + /** + * - Indicates the precision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC). + */ + quantization?: number[] | undefined; + /** + * - Whether to export UVs or not. + */ + exportUvs?: boolean | undefined; + /** + * - Whether to export normals or not. + */ + exportNormals?: boolean | undefined; + /** + * - Whether to export colors or not. + */ + exportColor?: boolean | undefined; +}; +/** + * An exporter to compress geometry with the Draco library. + * + * [Draco](https://google.github.io/draco/) is an open source library for compressing and + * decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller, + * at the cost of additional decoding time on the client device. + * + * Standalone Draco files have a `.drc` extension, and contain vertex positions, + * normals, colors, and other attributes. Draco files *do not* contain materials, + * textures, animation, or node hierarchies – to use these features, embed Draco geometry + * inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file + * using [glTF-Pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline). + * + * The exporter requires the Draco encoder to be loaded as a global script in advance: + * + * ```html + * + * ``` + * + * ```js + * const exporter = new DRACOExporter(); + * const data = await exporter.parseAsync( mesh, options ); + * ``` + * + * @three_import import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js'; + */ +export class DRACOExporter { + /** + * Parses the given mesh or point cloud and generates the Draco output. + * + * @async + * @param {(Mesh|Points)} object - The mesh or point cloud to export. + * @param {DRACOExporter~Options} options - The export options. + * @return {Promise} A Promise that resolves with the exported Draco. + */ + parseAsync(object: (Mesh | Points), options?: {}): Promise; + /** + * @deprecated Use {@link DRACOExporter#parseAsync} instead. + */ + parse(): void; +} +export namespace DRACOExporter { + let MESH_EDGEBREAKER_ENCODING: number; + let MESH_SEQUENTIAL_ENCODING: number; + let POINT_CLOUD: number; + let TRIANGULAR_MESH: number; + let INVALID: number; + let POSITION: number; + let NORMAL: number; + let COLOR: number; + let TEX_COORD: number; + let GENERIC: number; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts new file mode 100644 index 000000000..9bd21a485 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts @@ -0,0 +1,45 @@ +/** + * ~Options + */ +export type EXRExporter = { + /** + * - Output data type. + */ + type?: number | undefined; +}; +/** + * An exporter for EXR. + * + * EXR ( Extended Dynamic Range) is an [open format specification](https://github.com/AcademySoftwareFoundation/openexr) + * for professional-grade image storage format of the motion picture industry. The purpose of + * format is to accurately and efficiently represent high-dynamic-range scene-linear image data + * and associated metadata. The library is widely used in host application software where accuracy + * is critical, such as photorealistic rendering, texture access, image compositing, deep compositing, + * and DI. + * + * ```js + * const exporter = new EXRExporter(); + * const result = await exporter.parse( renderer, options ); + * ``` + * + * @three_import import { EXRExporter } from 'three/addons/exporters/EXRExporter.js'; + */ +export class EXRExporter { + /** + * This method has two variants. + * + * - When exporting a data texture, it receives two parameters. The texture and the exporter options. + * - When exporting a render target (e.g. a PMREM), it receives three parameters. The renderer, the + * render target and the exporter options. + * + * @async + * @param {(DataTexture|WebGPURenderer|WebGLRenderer)} arg1 - The data texture to export or a renderer. + * @param {(EXRExporter~Options|RenderTarget)} arg2 - The exporter options or a render target. + * @param {EXRExporter~Options} [arg3] - The exporter options. + * @return {Promise} A Promise that resolves with the exported EXR. + */ + parse(arg1: (DataTexture | WebGPURenderer | WebGLRenderer), arg2: any, arg3: any): Promise; +} +export const NO_COMPRESSION: 0; +export const ZIP_COMPRESSION: 3; +export const ZIPS_COMPRESSION: 2; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts new file mode 100644 index 000000000..00ab20b4f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts @@ -0,0 +1,135 @@ +/** + * ~Options + */ +export type GLTFExporter = { + /** + * - Export position, rotation and scale instead of matrix per node. + */ + trs?: boolean | undefined; + /** + * - Export only visible 3D objects. + */ + onlyVisible?: boolean | undefined; + /** + * - Export in binary (.glb) format, returning an ArrayBuffer. + */ + binary?: boolean | undefined; + /** + * - Restricts the image maximum size (both width and height) to the given value. + */ + maxTextureSize?: number | undefined; + /** + * - List of animations to be included in the export. When exporting a single 3D object or scene, this is a flat list of clips. + * When exporting an array of multiple scenes, this must be a nested array with one list of clips per scene, matched to the input by index. + */ + animations?: AnimationClip[] | AnimationClip[][] | undefined; + /** + * - Export custom glTF extensions defined on an object's `userData.gltfExtensions` property. + */ + includeCustomExtensions?: boolean | undefined; + /** + * - Export with a copyright notice embedded in the glTF. + */ + copyright?: string | undefined; +}; +/** + * An exporter for `glTF` 2.0. + * + * glTF (GL Transmission Format) is an [open format specification](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0) + * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) + * or binary (.glb) format. External files store textures (.jpg, .png) and additional binary + * data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials, + * textures, skins, skeletons, morph targets, animations, lights, and/or cameras. + * + * GLTFExporter supports the [glTF 2.0 extensions](https://github.com/KhronosGroup/glTF/tree/master/extensions/): + * + * - KHR_lights_punctual + * - KHR_materials_clearcoat + * - KHR_materials_dispersion + * - KHR_materials_emissive_strength + * - KHR_materials_ior + * - KHR_materials_iridescence + * - KHR_materials_specular + * - KHR_materials_sheen + * - KHR_materials_transmission + * - KHR_materials_unlit + * - KHR_materials_volume + * - KHR_mesh_quantization + * - KHR_texture_transform + * - EXT_materials_bump + * - EXT_mesh_gpu_instancing + * - EXT_texture_webp + * + * The following glTF 2.0 extension is supported by an external user plugin: + * + * - [KHR_materials_variants](https://github.com/takahirox/three-gltf-extensions) + * + * ```js + * const exporter = new GLTFExporter(); + * const data = await exporter.parseAsync( scene, options ); + * ``` + * + * @three_import import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js'; + */ +export class GLTFExporter { + /** + * A reference to a texture utils module. + * + * @type {?(WebGLTextureUtils|WebGPUTextureUtils)} + * @default null + */ + textureUtils: (WebGLTextureUtils | WebGPUTextureUtils) | null; + pluginCallbacks: any[]; + /** + * Registers a plugin callback. This API is internally used to implement the various + * glTF extensions but can also used by third-party code to add additional logic + * to the exporter. + * + * @param {function(writer:GLTFWriter)} callback - The callback function to register. + * @return {GLTFExporter} A reference to this exporter. + */ + register(callback: any): GLTFExporter; + /** + * Unregisters a plugin callback. + * + * @param {Function} callback - The callback function to unregister. + * @return {GLTFExporter} A reference to this exporter. + */ + unregister(callback: Function): GLTFExporter; + /** + * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported. + * + * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the + * corresponding texture utils {@link module:WebGLTextureUtils} or {@link module:WebGPUTextureUtils}. + * + * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils. + * @return {GLTFExporter} A reference to this exporter. + */ + setTextureUtils(utils: WebGLTextureUtils | WebGPUTextureUtils): GLTFExporter; + /** + * Parses the given scenes and generates the glTF output. + * + * @param {Scene|Array} input - A scene or an array of scenes. + * @param {GLTFExporter~OnDone} onDone - A callback function that is executed when the export has finished. + * @param {GLTFExporter~OnError} onError - A callback function that is executed when an error happens. + * @param {GLTFExporter~Options} options - options + */ + parse(input: Scene | Array, onDone: any, onError: any, options: any): void; + /** + * Async version of {@link GLTFExporter#parse}. + * + * @param {Scene|Array} input - A scene or an array of scenes. + * @param {GLTFExporter~Options} options - options. + * @return {Promise} A Promise that resolved with the exported glTF data. + */ + parseAsync(input: Scene | Array, options: any): Promise; +} +export namespace GLTFExporter { + namespace Utils { + function insertKeyframe(track: any, time: any): number | undefined; + function mergeMorphTargetTracks(clip: any, root: any): any; + function toTypedBufferAttribute(srcAttribute: any, TypedArray: any): BufferAttribute; + } +} +import { Scene } from 'three'; +import { BufferAttribute } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts new file mode 100644 index 000000000..3c5367230 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts @@ -0,0 +1,26 @@ +/** + * An exporter for KTX2. + * + * ```js + * const exporter = new KTX2Exporter(); + * const result = await exporter.parse( dataTexture ); + * ``` + * + * @three_import import { KTX2Exporter } from 'three/addons/exporters/KTX2Exporter.js'; + */ +export class KTX2Exporter { + /** + * This method has two variants. + * + * - When exporting a data texture, it receives one parameter. The data or 3D data texture. + * - When exporting a render target (e.g. a PMREM), it receives two parameters. The renderer and the + * render target. + * + * @async + * @param {(DataTexture|Data3DTexture|WebGPURenderer|WebGLRenderer)} arg1 - The data texture to export or a renderer. + * @param {RenderTarget} [arg2] - The render target that should be exported + * @return {Promise} A Promise that resolves with the exported KTX2. + */ + parse(arg1: (DataTexture | Data3DTexture | WebGPURenderer | WebGLRenderer), arg2?: RenderTarget): Promise; +} +import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts new file mode 100644 index 000000000..ce14c5604 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts @@ -0,0 +1,23 @@ +/** + * An exporter for OBJ. + * + * `OBJExporter` is not able to export material data into MTL files so only geometry data are supported. + * + * ```js + * const exporter = new OBJExporter(); + * const data = exporter.parse( scene ); + * ``` + * + * @three_import import { OBJExporter } from 'three/addons/exporters/OBJExporter.js'; + */ +export class OBJExporter { + /** + * Parses the given 3D object and generates the OBJ output. + * + * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. + * + * @param {Object3D} object - The 3D object to export. + * @return {string} The exported OBJ. + */ + parse(object: Object3D): string; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts new file mode 100644 index 000000000..09942d1f4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts @@ -0,0 +1,56 @@ +/** + * ~Options + */ +export type PLYExporter = { + /** + * - Whether to export in binary format or ASCII. + */ + binary?: boolean | undefined; + /** + * - Which properties to explicitly exclude from + * the exported PLY file. Valid values are `'color'`, `'normal'`, `'uv'`, and `'index'`. If triangle + * indices are excluded, then a point cloud is exported. + */ + excludeAttributes?: string[] | undefined; + /** + * - Whether the binary export uses little or big endian. + */ + littleEndian?: boolean | undefined; + /** + * - A mapping that allows + * exporting custom buffer attributes as PLY vertex properties. Each entry maps a buffer attribute + * name to an array of PLY property names. The number of property names must match the item size + * of the buffer attribute. This is the inverse of `PLYLoader.setCustomPropertyNameMapping()`. + */ + customPropertyMapping?: { + [x: string]: string[]; + } | undefined; +}; +/** + * An exporter for PLY. + * + * PLY (Polygon or Stanford Triangle Format) is a file format for efficient delivery and + * loading of simple, static 3D content in a dense format. Both binary and ascii formats are + * supported. PLY can store vertex positions, colors, normals and uv coordinates. No textures + * or texture references are saved. + * + * ```js + * const exporter = new PLYExporter(); + * const data = exporter.parse( scene, options ); + * ``` + * + * @three_import import { PLYExporter } from 'three/addons/exporters/PLYExporter.js'; + */ +export class PLYExporter { + /** + * Parses the given 3D object and generates the PLY output. + * + * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. + * + * @param {Object3D} object - The 3D object to export. + * @param {PLYExporter~OnDone} onDone - A callback function that is executed when the export has finished. + * @param {PLYExporter~Options} options - The export options. + * @return {?(string|ArrayBuffer)} The exported PLY. + */ + parse(object: Object3D, onDone: any, options?: {}): (string | ArrayBuffer) | null; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts new file mode 100644 index 000000000..e72db8c3d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts @@ -0,0 +1,36 @@ +/** + * ~Options + */ +export type STLExporter = { + /** + * - Whether to export in binary format or ASCII. + */ + binary?: boolean | undefined; +}; +/** + * An exporter for STL. + * + * STL files describe only the surface geometry of a three-dimensional object without + * any representation of color, texture or other common model attributes. The STL format + * specifies both ASCII and binary representations, with binary being more compact. + * STL files contain no scale information or indexes, and the units are arbitrary. + * + * ```js + * const exporter = new STLExporter(); + * const data = exporter.parse( mesh, { binary: true } ); + * ``` + * + * @three_import import { STLExporter } from 'three/addons/exporters/STLExporter.js'; + */ +export class STLExporter { + /** + * Parses the given 3D object and generates the STL output. + * + * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. + * + * @param {Object3D} scene - A scene, mesh or any other 3D object containing meshes to encode. + * @param {STLExporter~Options} options - The export options. + * @return {string|ArrayBuffer} The exported STL. + */ + parse(scene: Object3D, options?: {}): string | ArrayBuffer; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts new file mode 100644 index 000000000..33d54405c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts @@ -0,0 +1,82 @@ +/** + * ~Options + */ +export type USDZExporter = { + /** + * - The maximum texture size that is going to be exported. + */ + maxTextureSize?: number | undefined; + /** + * - Whether to include anchoring properties or not. + */ + includeAnchoringProperties?: boolean | undefined; + /** + * - Export only visible 3D objects. + */ + onlyVisible?: boolean | undefined; + /** + * - If `includeAnchoringProperties` is set to `true`, the anchoring type and alignment + * can be configured via `ar.anchoring.type` and `ar.planeAnchoring.alignment`. + */ + ar?: Object | undefined; + /** + * - Whether to make the exported USDZ compatible to QuickLook + * which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback). + */ + quickLookCompatible?: boolean | undefined; + /** + * - Animation clips to bake into `xformOp` time samples on the + * targeted objects. Only `position`, `quaternion`, and `scale` tracks are exported. + */ + animations?: AnimationClip[] | undefined; + /** + * - Time codes per second used when writing animation samples. + */ + animationFrameRate?: number | undefined; +}; +/** + * An exporter for USDZ. + * + * ```js + * const exporter = new USDZExporter(); + * const arraybuffer = await exporter.parseAsync( scene ); + * ``` + * + * @three_import import { USDZExporter } from 'three/addons/exporters/USDZExporter.js'; + */ +export class USDZExporter { + /** + * A reference to a texture utils module. + * + * @type {?(WebGLTextureUtils|WebGPUTextureUtils)} + * @default null + */ + textureUtils: (WebGLTextureUtils | WebGPUTextureUtils) | null; + /** + * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported. + * + * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the + * corresponding texture utils {@link module:WebGLTextureUtils} or {@link module:WebGPUTextureUtils}. + * + * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils. + */ + setTextureUtils(utils: WebGLTextureUtils | WebGPUTextureUtils): void; + /** + * Parse the given 3D object and generates the USDZ output. + * + * @param {Object3D} scene - The 3D object to export. + * @param {USDZExporter~OnDone} onDone - A callback function that is executed when the export has finished. + * @param {USDZExporter~OnError} onError - A callback function that is executed when an error happens. + * @param {USDZExporter~Options} options - The export options. + */ + parse(scene: Object3D, onDone: any, onError: any, options: any): void; + /** + * Async version of {@link USDZExporter#parse}. + * + * @async + * @param {Object3D} scene - The 3D object to export. + * @param {USDZExporter~Options} options - The export options. + * @return {Promise} A Promise that resolved with the exported USDZ data. + */ + parseAsync(scene: Object3D, options?: {}): Promise; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts new file mode 100644 index 000000000..baf210642 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts @@ -0,0 +1,72 @@ +/** + * Lays out a grid of city blocks and fills each lot with a {@link SkyscraperGenerator} + * tower of its own seed, height and footprint, optionally on raised sidewalk + * slabs (curbs). Returns a `THREE.Group` ready to add to a scene. + * + * Pass a building material to dress the towers; the sidewalks dress themselves + * via {@link SidewalkGenerator}. The layout is exposed as + * {@link CityGenerator#layout} so the surrounding scene (road markings, etc.) + * can align to the same grid. + * + * ```js + * const city = new CityGenerator( { seed: 1 } ); + * scene.add( city.build( materials ) ); + * ``` + */ +export class CityGenerator { + constructor(parameters?: {}); + parameters: { + seed: number; + street: number; + lot: number; + lotsX: number; + lotsZ: number; + blocksX: number; + blocksZ: number; + curbHeight: number; + curbRadius: number; + }; + layout: { + street: any; + lot: any; + lotsX: any; + lotsZ: any; + blocksX: any; + blocksZ: any; + blockW: number; + blockD: number; + cityW: number; + cityD: number; + }; + generators: any[]; + sidewalk: SidewalkGenerator; + group: Group | null; + build(materials?: {}): Group; + dispose(): void; +} +export namespace CityGenerator { + namespace defaults { + let seed: number; + let street: number; + let lot: number; + let lotsX: number; + let lotsZ: number; + let blocksX: number; + let blocksZ: number; + let curbHeight: number; + let curbRadius: number; + } +} +/** + * The shared material every tower in a {@link CityGenerator} is dressed with: one flat + * masonry colour per lot, picked from a palette by hashing the lot's grid cell. + */ +export function createBuildingMaterial(layout: any, seed?: number): MeshStandardNodeMaterial; +/** + * The road surface: wet asphalt with lane lines and crosswalks aligned to a + * {@link CityGenerator} layout. Apply it to a ground plane sized to the city. + */ +export function createRoadMaterial(layout: any): MeshStandardNodeMaterial; +import { SidewalkGenerator } from './city/SidewalkGenerator.js'; +import { Group } from 'three'; +import { MeshStandardNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts new file mode 100644 index 000000000..4b2772243 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts @@ -0,0 +1,87 @@ +/** + * Carpets a {@link TerrainGenerator} ( or anything exposing `sampleHeight`, + * `sampleSlope`, `minY`, `maxY` and `parameters.size` ) with a forest of hundreds + * of thousands of trees in a single draw call. + * + * Each tree is the cheapest thing that still reads as a tree: a ~20-face icosphere + * squashed into a tapered teardrop and lumped with a little noise, carrying a baked + * dark-base / bright-top gradient. Tens of triangles each, so a single + * {@link THREE.InstancedMesh} of half a million of them costs one draw call. Trees + * are placed by rejection sampling against ecological rules — a min/max altitude + * band ( above the mist floor, below the snowline ), a slope limit ( none on + * cliffs ) and a low-frequency density mask that opens clearings — then jittered in + * yaw, lean and ( squared-biased ) scale so the stand never reads as copies. + * + * ```js + * const forest = new ForestGenerator( { count: 500000 } ); + * scene.add( forest.build( terrain ) ); + * ``` + */ +export class ForestGenerator { + constructor(parameters?: {}); + parameters: { + seed: number; + count: number; + detail: number; + radius: number; + height: number; + distortion: number; + sink: number; + altitudeMin: number; + altitudeMax: number; + minSlope: number; + densityFrequency: number; + minScale: number; + maxScale: number; + from: number; + to: number; + castShadow: boolean; + }; + from: import("three/webgpu").UniformNode; + to: import("three/webgpu").UniformNode; + _cameraPosition: import("three/webgpu").UniformNode; + material: MeshStandardNodeMaterial; + mesh: InstancedMesh | null; + group: Group | null; + build(terrain: any): Group; + setCameraPosition(position: any): void; + dispose(): void; +} +export namespace ForestGenerator { + namespace defaults { + let seed: number; + let count: number; + let detail: number; + let radius: number; + let height: number; + let distortion: number; + let sink: number; + let altitudeMin: number; + let altitudeMax: number; + let minSlope: number; + let densityFrequency: number; + let minScale: number; + let maxScale: number; + let from: number; + let to: number; + let castShadow: boolean; + } +} +/** + * The single material shared by every tree in a {@link ForestGenerator}. A plain + * MeshStandardNodeMaterial lit by the scene — only the surface is authored: deep + * shadowed green in the recesses rising to a bright, yellow-green sunlit crown, + * mottled into needle clumps by 3D noise, with a matching bump so the clumps catch + * the light. Half a million instanced blobs makes this mesh vertex-bound, so the + * regional colour drift is baked to a per-instance attribute ( no shader noise for it ), + * and the costly clump noise + bump are **gated by distance** — full detail on the near + * trees ( where it reads ), skipped on the far canopy ( where it is sub-pixel ). + * + * @param {Node} from - distance within which every tree is drawn. + * @param {Node} to - distance past which no tree is drawn. + * @return {MeshStandardNodeMaterial} + */ +export function createForestMaterial(from: Node, to: Node, camPos: any): MeshStandardNodeMaterial; +import { MeshStandardNodeMaterial } from 'three/webgpu'; +import { InstancedMesh } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts new file mode 100644 index 000000000..a5b279bf6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts @@ -0,0 +1,76 @@ +/** + * Bakes a procedural mountain range into a single {@link THREE.BufferGeometry} and + * returns a `THREE.Group` ready to add to a scene. + * + * The heightfield is a derivative-damped fractal sum ( Quilez's fake erosion ): each + * octave is suppressed where the running slope is already steep, concentrating detail + * into weathered ridgelines, and a low-frequency domain warp makes those ridges + * meander. A few passes of thermal ( talus ) erosion then relax any slope past the + * angle of repose, settling the fractal's needle-spikes into real crests. + * + * The grid is triangulated with alternating quad diagonals ( a diamond pattern ), so a + * coarse mesh holds its silhouette without a one-way grain. The surface shades itself + * from altitude and slope in TSL — grass, forest, rock, scree and snow, with detail + * normals and aerial perspective — so no material or textures are needed. + * + * The baked height grid is exposed through {@link TerrainGenerator#sampleHeight} so a + * scattered forest ( or anything else ) can sit exactly on the surface. + * + * ```js + * const terrain = new TerrainGenerator( { seed: 1 } ); + * scene.add( terrain.build() ); + * ``` + */ +export class TerrainGenerator { + constructor(parameters?: {}); + parameters: { + seed: number; + size: number; + segments: number; + heightScale: number; + frequency: number; + octaves: number; + lacunarity: number; + gain: number; + erosion: number; + warp: number; + valleyBias: number; + seaLevel: number; + talus: number; + talusPasses: number; + }; + minHeight: import("three/webgpu").UniformNode; + maxHeight: import("three/webgpu").UniformNode; + material: MeshStandardNodeMaterial; + geometry: BufferGeometry | null; + group: Group | null; + build(): Group; + heights: Float32Array | undefined; + gridSize: number | undefined; + minY: number | undefined; + maxY: number | undefined; + sampleHeight(x: any, z: any): number; + sampleSlope(x: any, z: any): number; + dispose(): void; +} +export namespace TerrainGenerator { + namespace defaults { + let seed: number; + let size: number; + let segments: number; + let heightScale: number; + let frequency: number; + let octaves: number; + let lacunarity: number; + let gain: number; + let erosion: number; + let warp: number; + let valleyBias: number; + let seaLevel: number; + let talus: number; + let talusPasses: number; + } +} +import { MeshStandardNodeMaterial } from 'three/webgpu'; +import { BufferGeometry } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts new file mode 100644 index 000000000..48708c301 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts @@ -0,0 +1,66 @@ +/** + * Grows a procedural tree skeleton — trunk, branches and twigs, each swept as a tapered + * tube — and bakes it into one non-indexed {@link BufferGeometry} (position and normal + * only), ready to instance into a forest. It produces *branches only*; add foliage as a + * separate layer. + * + * The branching is deterministic for a given `seed`: a recursive sweep lays down gently + * curved tubes with a parallel-transport frame (so they never twist), forking by the + * pipe model (each child much thinner than its parent), spreading children along the + * upper part of each branch with a golden-angle roll, and pulling them back up toward + * the light. A flared root, non-linear taper and gravity droop fill in the character. + * + * Parameters are set with a fluent builder: a `set()` exists for every default + * ( `setSeed`, `setLevels`, `setChildren`, … ), each returning `this` for chaining. + * + * Each `build()` returns a fresh, independent mesh that the caller owns, so one + * generator can be re-parametrized and built repeatedly to grow a varied stand: + * + * ```js + * const generator = new TreeGenerator( material ); + * const oak = generator.setSeed( 1 ).setLevels( 4 ).build(); + * const pine = generator.setSeed( 2 ).setLevels( 5 ).build(); + * ``` + */ +export class TreeGenerator { + constructor(material?: null); + material: any; + parameters: {}; + build(): Mesh; +} +export namespace TreeGenerator { + namespace defaults { + let seed: number; + let levels: number; + let children: number[]; + let branchAngle: number[]; + let angleVariance: number; + let lengthRatio: number; + let trunkLength: number; + let trunkRadius: number; + let taper: number; + let taperCurve: number; + let rootFlare: number; + let flareFrac: number; + let radiusExponent: number; + let minRadius: number; + let minLength: number; + let droop: number; + let upPull: number; + let gnarl: number[]; + let radialSegments: number; + let sectionLength: number; + let childStart: number; + let trunkClear: number; + } +} +/** + * A simple bark material for a {@link TreeGenerator} mesh: a low-saturation brown with a + * faint, vertically-stretched grain, so trunks read near-black against bright fog. + * + * @param {Object} [parameters] - `barkColor` ( a hex, THREE.Color or TSL node ). + * @return {MeshStandardNodeMaterial} + */ +export function createTreeMaterial(parameters?: Object): MeshStandardNodeMaterial; +import { Mesh } from 'three'; +import { MeshStandardNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts new file mode 100644 index 000000000..81c1a0ec9 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts @@ -0,0 +1,43 @@ +/** + * Generates the raised sidewalk for a city's blocks: per block, a rounded-corner concrete + * slab rimmed by a distinct granite kerbstone that stands proud of the walking surface and + * drops to the road. Instanced across a list of placements and dressed with its own + * procedural material ( poured concrete flags, scored expansion joints, granite curb ). + * Returns a `THREE.Group` of two instanced meshes — the walking slab and the curb. + * + * Unlike the building generator, this one owns its materials: the slab and curb + * geometry and the TSL that shades them live together here. + * + * ```js + * const sidewalk = new SidewalkGenerator( { width: 90, depth: 60, height: 0.5 } ); + * scene.add( sidewalk.build( placements ) ); // placements: Matrix4[] + * ``` + */ +export class SidewalkGenerator { + constructor(parameters?: {}); + parameters: { + width: number; + depth: number; + height: number; + radius: number; + curbWidth: number; + curbLip: number; + }; + material: MeshStandardNodeMaterial | null; + curbMaterial: MeshStandardNodeMaterial | null; + mesh: Group | null; + build(placements: any): Group; + dispose(): void; +} +export namespace SidewalkGenerator { + namespace defaults { + let width: number; + let depth: number; + let height: number; + let radius: number; + let curbWidth: number; + let curbLip: number; + } +} +import { MeshStandardNodeMaterial } from 'three/webgpu'; +import { Group } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts new file mode 100644 index 000000000..cfca639f0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts @@ -0,0 +1,65 @@ +/** + * Generates intricate, tripartite "Beaux-Arts / Neo-Gothic" terracotta + * skyscrapers from a small set of parameters. + * + * The mass is read as a footprint polygon (a rectangle with one chamfered + * corner) split into vertical faces, each split into three tiers — a tall + * arcaded base, a repeating shaft and an ornate crown — then into floors and + * bays. A handful of authored pieces (a pier, a window, a cornice profile, a + * gothic arch) are instanced across the whole tower, then baked — together with + * the bespoke base arcade — into a single non-indexed BufferGeometry tagged with + * a per-vertex `partId` ({@link PartId}) so one material can shade every zone. + * + * The generator is material agnostic — it only produces geometry. Pass a single + * material (e.g. a TSL node material that branches on `partId`) to dress it. + * + * ```js + * const generator = new SkyscraperGenerator( { seed: 35, totalHeight: 140 }, material ); + * scene.add( generator.build() ); // a single Mesh + * ``` + */ +export class SkyscraperGenerator { + constructor(parameters?: {}, material?: null); + parameters: {}; + material: any; + mesh: Mesh | null; + setParameters(parameters: any): this; + build(): Mesh; + rebuild(): Mesh; + dispose(): void; +} +export namespace SkyscraperGenerator { + namespace defaults { + let seed: number; + let totalHeight: number; + let floorHeight: number; + let bayWidth: number; + let stringCourseEvery: number; + let chamferWidth: number; + let chamferCornerX: number; + let chamferCornerZ: number; + let setbackDepth: number; + let acChance: number; + } +} +/** + * The facade material: a single MeshStandardNodeMaterial that reads the baked + * per-vertex `partId` and reproduces every zone — procedural terracotta brickwork + * on the walls and piers, smooth dressed stone on the window frames and ornament, + * dark glazing, and grey AC units — all dressed with world-space + * weathering. One material covers the whole building ( and a whole city ), which is + * what makes it compute-rasterizer friendly. `buildingBase` is the tower's flat + * masonry colour as a TSL node: pass a `uniform( Color )` for a single tower, or a + * per-fragment palette pick for a city, so the same material dresses both. + */ +export function createSkyscraperMaterial(buildingBase?: any): MeshStandardNodeMaterial; +/** + * The NYC masonry palette every tower is dressed from ( hex colours ): limestone-dominant + * with terracotta accents. Shared by the single-tower example and {@link CityGenerator}'s + * building material so both stay in sync. + */ +export const buildingPalette: number[]; +/** Picks one {@link buildingPalette} colour ( a hex number ) for a tower from its seed. */ +export function pickBuildingColor(seed: any): number; +import { Mesh } from 'three'; +import { MeshStandardNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts new file mode 100644 index 000000000..12c45383b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts @@ -0,0 +1,27 @@ +/** + * A special type of box geometry intended for {@link LineSegments}. + * + * ```js + * const geometry = new BoxLineGeometry(); + * const material = new THREE.LineBasicMaterial( { color: 0x00ff00 } ); + * const lines = new THREE.LineSegments( geometry, material ); + * scene.add( lines ); + * ``` + * + * @augments BufferGeometry + * @three_import import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; + */ +export class BoxLineGeometry extends BufferGeometry { + /** + * Constructs a new box line geometry. + * + * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis. + * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis. + * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis. + * @param {number} [widthSegments=1] - Number of segmented rectangular sections along the width of the sides. + * @param {number} [heightSegments=1] - Number of segmented rectangular sections along the height of the sides. + * @param {number} [depthSegments=1] - Number of segmented rectangular sections along the depth of the sides. + */ + constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts new file mode 100644 index 000000000..e5e6dacf7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts @@ -0,0 +1,23 @@ +/** + * This class can be used to generate a convex hull for a given array of 3D points. + * The average time complexity for this task is considered to be O(nlog(n)). + * + * ```js + * const geometry = new ConvexGeometry( points ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * ``` + * + * @augments BufferGeometry + * @three_import import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js'; + */ +export class ConvexGeometry extends BufferGeometry { + /** + * Constructs a new convex geometry. + * + * @param {Array} points - An array of points in 3D space which should be enclosed by the convex hull. + */ + constructor(points?: Array); +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts new file mode 100644 index 000000000..382bd6e37 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts @@ -0,0 +1,40 @@ +/** + * This class can be used to create a decal mesh that serves different kinds of purposes e.g. + * adding unique details to models, performing dynamic visual environmental changes or covering seams. + * + * Please not that decal projections can be distorted when used around corners. More information at + * this GitHub issue: [Decal projections without distortions](https://github.com/mrdoob/three.js/issues/21187). + * + * Reference: [How to project decals](http://blog.wolfire.com/2009/06/how-to-project-decals/) + * + * ```js + * const geometry = new DecalGeometry( mesh, position, orientation, size ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * ``` + * + * @augments BufferGeometry + * @three_import import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js'; + */ +export class DecalGeometry extends BufferGeometry { + /** + * Constructs a new decal geometry. + * + * @param {Mesh} [mesh] - The base mesh the decal should be projected on. + * @param {Vector3} [position] - The position of the decal projector. + * @param {Euler} [orientation] - The orientation of the decal projector. + * @param {Vector3} [size] - The scale of the decal projector. + */ + constructor(mesh?: Mesh, position?: Vector3, orientation?: Euler, size?: Vector3); +} +export class DecalVertex { + constructor(position: any, normal?: null); + position: any; + normal: any; + clone(): any; +} +import { BufferGeometry } from 'three'; +import { Mesh } from 'three'; +import { Vector3 } from 'three'; +import { Euler } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts new file mode 100644 index 000000000..1e007e460 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts @@ -0,0 +1,75 @@ +/** + * This class can be used to generate a geometry by lofting (skinning) a surface + * through a series of cross sections. Each section is an array of points in 3D + * space and all sections must have the same number of points. + * + * `LoftGeometry` is the general case of geometries like {@link LatheGeometry} + * (which revolves a fixed profile around an axis) or {@link TubeGeometry} + * (which sweeps a circular section along a path): the sections can have any + * shape, and can change shape, size, position and orientation from one + * section to the next. + * + * Sections wind around the loft so the resulting face normals point outwards + * when each section is ordered counterclockwise as seen from the end of the + * loft, looking back towards the start. If the surface appears inside out, + * reverse the point order of each section. + * + * ```js + * const sections = []; + * + * for ( let i = 0; i <= 10; i ++ ) { + * + * const points = []; + * const radius = 2 + Math.sin( i * 0.8 ); + * + * for ( let j = 0; j < 32; j ++ ) { + * + * const angle = j / 32 * Math.PI * 2; + * points.push( new THREE.Vector3( Math.sin( angle ) * radius, i, Math.cos( angle ) * radius ) ); + * + * } + * + * sections.push( points ); + * + * } + * + * const geometry = new LoftGeometry( sections, { capStart: true, capEnd: true } ); + * const material = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ); + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * ``` + * + * @augments BufferGeometry + * @three_import import { LoftGeometry } from 'three/addons/geometries/LoftGeometry.js'; + */ +export class LoftGeometry extends BufferGeometry { + /** + * Constructs a new loft geometry. + * + * @param {Array>} sections - The cross sections to skin. At least + * two sections are required and all sections must have the same number of points. + * @param {Object} [options={}] - The loft options. + * @param {boolean} [options.closed=true] - Whether each section is treated as a + * closed ring (e.g. a fuselage) or an open strip (e.g. a ribbon). + * @param {boolean} [options.capStart=false] - Whether the first section is closed + * with a cap or not. + * @param {boolean} [options.capEnd=false] - Whether the last section is closed + * with a cap or not. + */ + constructor(sections?: Array>, options?: { + closed?: boolean | undefined; + capStart?: boolean | undefined; + capEnd?: boolean | undefined; + }); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from 'three'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts new file mode 100644 index 000000000..db21efb1c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts @@ -0,0 +1,36 @@ +/** + * @module ParametricFunctions + * @three_import import * as ParametricFunctions from 'three/addons/geometries/ParametricFunctions.js'; + */ +/** + * A parametric function representing the Klein bottle. + * + * @param {number} v - The `v` coordinate on the surface in the range `[0,1]`. + * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. + * @param {Vector3} target - The target vector that is used to store the method's result. + */ +export function klein(v: number, u: number, target: Vector3): void; +/** + * A parametric function representing a flat plane. + * + * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. + * @param {number} v - The `v` coordinate on the surface in the range `[0,1]`. + * @param {Vector3} target - The target vector that is used to store the method's result. + */ +export function plane(u: number, v: number, target: Vector3): void; +/** + * A parametric function representing a flat mobius strip. + * + * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. + * @param {number} t - The `v` coordinate on the surface in the range `[0,1]`. + * @param {Vector3} target - The target vector that is used to store the method's result. + */ +export function mobius(u: number, t: number, target: Vector3): void; +/** + * A parametric function representing a volumetric mobius strip. + * + * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. + * @param {number} t - The `v` coordinate on the surface in the range `[0,1]`. + * @param {Vector3} target - The target vector that is used to store the method's result. + */ +export function mobius3d(u: number, t: number, target: Vector3): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts new file mode 100644 index 000000000..dbf4ca6a3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts @@ -0,0 +1,40 @@ +/** + * ~Func + */ +export type ParametricGeometry = (u: number, v: number, target: Vector3) => any; +import { Vector3 } from 'three'; +/** + * This class can be used to generate a geometry based on a parametric surface. + * + * Reference: [Mesh Generation with Python](https://prideout.net/blog/old/blog/index.html@p=44.html) + * + * ```js + * const geometry = new ParametricGeometry( klein, 25, 25 ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const klein = new THREE.Mesh( geometry, material ); + * scene.add( klein ); + * ``` + * + * @augments BufferGeometry + * @three_import import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; + */ +export class ParametricGeometry extends BufferGeometry { + /** + * Constructs a new parametric geometry. + * + * @param {ParametricGeometry~Func} func - The parametric function. Default is a function that generates a curved plane surface. + * @param {number} [slices=8] - The number of slices to use for the parametric function. + * @param {number} [stacks=8] - The stacks of slices to use for the parametric function. + */ + constructor(func?: (u: any, v: any, target: any) => any, slices?: number, stacks?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts new file mode 100644 index 000000000..75c6ccace --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts @@ -0,0 +1,26 @@ +/** + * A special type of box geometry with rounded corners and edges. + * + * ```js + * const geometry = new RoundedBoxGeometry(); + * const material = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ); + * const cube = new THREE.Mesh( geometry, material ); + * scene.add( cube ); + * ``` + * + * @augments BoxGeometry + * @three_import import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; + */ +export class RoundedBoxGeometry extends BoxGeometry { + /** + * Constructs a new rounded box geometry. + * + * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis. + * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis. + * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis. + * @param {number} [segments=2] - Number of segments that form the rounded corners. + * @param {number} [radius=0.1] - The radius of the rounded corners. + */ + constructor(width?: number, height?: number, depth?: number, segments?: number, radius?: number); +} +import { BoxGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts new file mode 100644 index 000000000..f555f1a36 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts @@ -0,0 +1,37 @@ +/** + * Tessellates the famous Utah teapot database by Martin Newell into triangles. + * + * The teapot should normally be rendered as a double sided object, since for some + * patches both sides can be seen, e.g., the gap around the lid and inside the spout. + * + * Segments 'n' determines the number of triangles output. Total triangles = 32*2*n*n - 8*n + * (degenerates at the top and bottom cusps are deleted). + * + * Code based on [SPD software](http://tog.acm.org/resources/SPD/) + * Created for the Udacity course [Interactive Rendering](http://bit.ly/ericity) + * + * ```js + * const geometry = new TeapotGeometry( 50, 18 ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const teapot = new THREE.Mesh( geometry, material ); + * scene.add( teapot ); + * ``` + * + * @augments BufferGeometry + * @three_import import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + */ +export class TeapotGeometry extends BufferGeometry { + /** + * Constructs a new teapot geometry. + * + * @param {number} [size=50] - Relative scale of the teapot. + * @param {number} [segments=10] - Number of line segments to subdivide each patch edge. + * @param {boolean} [bottom=true] - Whether the bottom of the teapot is generated or not. + * @param {boolean} [lid=true] - Whether the lid is generated or not. + * @param {boolean} [body=true] - Whether the body is generated or not. + * @param {boolean} [fitLid=true] - Whether the lid is slightly stretched to prevent gaps between the body and lid or not. + * @param {boolean} [blinn=true] - Whether the teapot is scaled vertically for better aesthetics or not. + */ + constructor(size?: number, segments?: number, bottom?: boolean, lid?: boolean, body?: boolean, fitLid?: boolean, blinn?: boolean); +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts new file mode 100644 index 000000000..70f1d0791 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts @@ -0,0 +1,92 @@ +/** + * ~Options + */ +export type TextGeometry = { + /** + * - The font. + */ + font?: Font | undefined; + /** + * - The text size. + */ + size?: number | undefined; + /** + * - Depth to extrude the shape. + */ + depth?: number | undefined; + /** + * - Number of points on the curves. + */ + curveSegments?: number | undefined; + /** + * - Number of points used for subdividing segments along the depth of the extruded spline. + */ + steps?: number | undefined; + /** + * - Whether to beveling to the shape or not. + */ + bevelEnabled?: boolean | undefined; + /** + * - How deep into the original shape the bevel goes. + */ + bevelThickness?: number | undefined; + /** + * - Distance from the shape outline that the bevel extends. + */ + bevelSize?: number | undefined; + /** + * - Distance from the shape outline that the bevel starts. + */ + bevelOffset?: number | undefined; + /** + * - Number of bevel layers. + */ + bevelSegments?: number | undefined; + /** + * - Char direction: ltr(left to right), rtl(right to left) & tb(top bottom). + */ + direction?: string | undefined; + /** + * - A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion. + */ + extrudePath?: Curve | null; + /** + * - An object that provides UV generator functions for custom UV generation. + */ + UVGenerator?: Object | undefined; +}; +import { Font } from '../loaders/FontLoader.js'; +/** + * A class for generating text as a single geometry. It is constructed by providing a string of text, and a set of + * parameters consisting of a loaded font and extrude settings. + * + * See the {@link FontLoader} page for additional details. + * + * `TextGeometry` uses [typeface.json](http://gero3.github.io/facetype.js/) generated fonts. + * Some existing fonts can be found located in `/examples/fonts`. + * + * ```js + * const loader = new FontLoader(); + * const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' ); + * const geometry = new TextGeometry( 'Hello three.js!', { + * font: font, + * size: 80, + * depth: 5, + * curveSegments: 12 + * } ); + * ``` + * + * @augments ExtrudeGeometry + * @three_import import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + */ +export class TextGeometry extends ExtrudeGeometry { + static fromJSON(data: any): TextGeometry; + /** + * Constructs a new text geometry. + * + * @param {string} text - The text that should be transformed into a geometry. + * @param {TextGeometry~Options} [parameters] - The text settings. + */ + constructor(text: string, parameters?: {}); +} +import { ExtrudeGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts b/jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts new file mode 100644 index 000000000..8115e72d5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts @@ -0,0 +1,263 @@ +/** + * Returns the indices that will be compared in a bitonic flip operation. + * + * @tsl + * @private + * @param {Node} index - The compute thread's invocation id. + * @param {Node} blockHeight - The height of the block within which elements are being swapped. + * @returns {Node} The indices of the elements in the data buffer being compared. + */ +export const getBitonicFlipIndices: any; +/** + * Returns the indices that will be compared in a bitonic sort's disperse operation. + * + * @tsl + * @private + * @param {Node} index - The compute thread's invocation id. + * @param {Node} swapSpan - The maximum span over which elements are being swapped. + * @returns {Node} The indices of the elements in the data buffer being compared. + */ +export const getBitonicDisperseIndices: any; +export class BitonicSort { + /** + * Constructs a new light probe helper. + * + * @param {Renderer} renderer - The current scene's renderer. + * @param {StorageBufferNode} dataBuffer - The data buffer to sort. + * @param {Object} [options={}] - Options that modify the bitonic sort. + */ + constructor(renderer: Renderer, dataBuffer: StorageBufferNode, options?: Object); + /** + * A reference to the renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * A reference to the StorageBufferNode holding the data that will be sorted . + * + * @type {StorageBufferNode} + */ + dataBuffer: StorageBufferNode; + /** + * The size of the data. + * + * @type {StorageBufferNode} + */ + count: StorageBufferNode; + /** + * + * The size of each compute dispatch. + * @type {number} + */ + dispatchSize: number; + /** + * The workgroup size of the compute shaders executed during the sort. + * + * @type {StorageBufferNode} + */ + workgroupSize: StorageBufferNode; + /** + * A node representing a workgroup scoped buffer that holds locally sorted elements. + * + * @type {WorkgroupInfoNode} + */ + localStorage: WorkgroupInfoNode; + _tempArray: Uint32Array; + /** + * A node representing a storage buffer used for transferring the result of the global sort back to the original data buffer. + * + * @type {StorageBufferNode} + */ + tempBuffer: StorageBufferNode; + /** + * A node containing the current algorithm type, the current swap span, and the highest swap span. + * + * @type {StorageBufferNode} + */ + infoStorage: StorageBufferNode; + /** + * The number of distinct swap operations ('flips' and 'disperses') executed in an in-place + * bitonic sort of the current data buffer. + * + * @type {number} + */ + swapOpCount: number; + /** + * The number of steps (i.e prepping and/or executing a swap) needed to fully execute an in-place bitonic sort of the current data buffer. + * + * @type {number} + */ + stepCount: number; + /** + * The number of the buffer being read from. + * + * @type {string} + */ + readBufferName: string; + /** + * An object containing compute shaders that execute a 'flip' swap within a global address space on elements in the data buffer. + * + * @type {Object} + */ + flipGlobalNodes: { + [x: string]: ComputeNode; + }; + /** + * An object containing compute shaders that execute a 'disperse' swap within a global address space on elements in the data buffer. + * + * @type {Object} + */ + disperseGlobalNodes: { + [x: string]: ComputeNode; + }; + /** + * A compute shader that executes a sequence of flip and disperse swaps within a local address space on elements in the data buffer. + * + * @type {ComputeNode} + */ + swapLocalFn: ComputeNode; + /** + * A compute shader that executes a sequence of disperse swaps within a local address space on elements in the data buffer. + * + * @type {Object} + */ + disperseLocalNodes: { + [x: string]: ComputeNode; + }; + /** + * A compute shader that sets up the algorithm and the swap span for the next swap operation. + * + * @type {ComputeNode} + */ + setAlgoFn: ComputeNode; + /** + * A compute shader that aligns the result of the global swap operation with the current buffer. + * + * @type {ComputeNode} + */ + alignFn: ComputeNode; + /** + * A compute shader that resets the algorithm and swap span information. + * + * @type {ComputeNode} + */ + resetFn: ComputeNode; + /** + * The current compute shader dispatch within the list of dispatches needed to complete the sort. + * + * @type {number} + */ + currentDispatch: number; + /** + * The number of global swap operations that must be executed before the sort + * can swap in local address space. + * + * @type {number} + */ + globalOpsRemaining: number; + /** + * The total number of global operations needed to sort elements within the current swap span. + * + * @type {number} + */ + globalOpsInSpan: number; + /** + * Get total number of distinct swaps that occur in a bitonic sort. + * + * @private + * @returns {number} - The total number of distinct swaps in a bitonic sort + */ + private _getSwapOpCount; + /** + * Get the number of steps it takes to execute a complete bitonic sort. + * + * @private + * @returns {number} The number of steps it takes to execute a complete bitonic sort. + */ + private _getStepCount; + /** + * Compares and swaps two data points in the data buffer within the global address space. + * @param {Node} idxBefore - The index of the first data element in the data buffer. + * @param {Node} idxAfter - The index of the second data element in the data buffer. + * @param {StorageBufferNode} dataBuffer - The buffer of data to read from. + * @param {StorageBufferNode} tempBuffer - The buffer of data to write to. + * @private + * + */ + private _globalCompareAndSwapTSL; + /** + * Compares and swaps two data points in the data buffer within the local address space. + * + * @private + * @param {Node} idxBefore - The index of the first data element in the data buffer. + * @param {Node} idxAfter - The index of the second data element in the data buffer + */ + private _localCompareAndSwapTSL; + /** + * Create the compute shader that performs a global disperse swap on the data buffer. + * + * @private + * @param {StorageBufferNode} readBuffer - The data buffer to read from. + * @param {StorageBufferNode} writeBuffer - The data buffer to read from. + * @returns {ComputeNode} - A compute shader that performs a global disperse swap on the data buffer. + */ + private _getDisperseGlobal; + /** + * Create the compute shader that performs a global flip swap on the data buffer. + * + * @private + * @param {StorageBufferNode} readBuffer - The data buffer to read from. + * @param {StorageBufferNode} writeBuffer - The data buffer to read from. + * @returns {ComputeNode} - A compute shader that executes a global flip swap. + */ + private _getFlipGlobal; + /** + * Create the compute shader that performs a complete local swap on the data buffer. + * + * @private + * @returns {ComputeNode} - A compute shader that executes a full local swap. + */ + private _getSwapLocal; + /** + * Create the compute shader that performs a local disperse swap on the data buffer. + * + * @private + * @param {StorageBufferNode} readWriteBuffer - The data buffer to read from and write to. + * @returns {ComputeNode} - A compute shader that executes a local disperse swap. + */ + private _getDisperseLocal; + /** + * Create the compute shader that resets the sort's algorithm information. + * + * @private + * @returns {ComputeNode} - A compute shader that resets the bitonic sort's algorithm information. + */ + private _getResetFn; + /** + * Create the compute shader that copies the state of the last global swap to the data buffer. + * + * @private + * @returns {ComputeNode} - A compute shader that copies the state of the last global swap to the data buffer. + */ + private _getAlignFn; + /** + * Create the compute shader that sets the bitonic sort algorithm's information. + * + * @private + * @returns {ComputeNode} - A compute shader that sets the bitonic sort algorithm's information. + */ + private _getSetAlgoFn; + /** + * Executes a step of the bitonic sort operation. + * + * @param {Renderer} renderer - The current scene's renderer. + */ + computeStep(renderer: Renderer): void; + /** + * Executes a complete bitonic sort on the data buffer. + * + * @param {Renderer} renderer - The current scene's renderer. + */ + compute(renderer: Renderer): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts b/jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts new file mode 100644 index 000000000..d2c1974c6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts @@ -0,0 +1,141 @@ +/** + * A reusable GPU counting sort. + * + * This computes a stable-ish permutation of the integers `[0, count)` that orders them by an + * arbitrary, user supplied `uint` key ("bin") in the range `[0, binCount)`. It is a good fit for + * approximate ordering of large element counts (hundreds of thousands to millions) where an exact + * comparison sort such as a bitonic sort (see {@link BitonicSort}) would be too slow: a counting + * sort only requires a fixed number of passes (reset, histogram, prefix sum, scatter) regardless of + * `count`, at the cost of only being accurate to the resolution of `binCount` - elements that land + * in the same bin end up in an unspecified relative order. + * + * This class does not compute the sort key itself. Instead, a TSL function is supplied via + * {@link CountingSort#setBinNode} that maps the current `instanceIndex` to a bin, and an equivalent + * plain JavaScript function can be supplied to {@link CountingSort#computeCPU} for platforms without + * compute shader support (e.g. the WebGL backend of {@link WebGPURenderer}). + * + * ```js + * const sort = new CountingSort( count, { binCount: 4096 } ); + * sort.setBinNode( () => { + * + * // return a `Node` bin index for `instanceIndex`, e.g. derived from a depth value. + * + * } ); + * + * sort.compute( renderer ); + * + * // `sort.orderRead` now holds a storage buffer of `count` indices, ordered by bin. + * ``` + * + * @three_import import { CountingSort } from 'three/addons/gpgpu/CountingSort.js'; + */ +export class CountingSort { + /** + * Constructs a new counting sort. + * + * @param {number} count - The number of elements to sort. + * @param {Object} [options={}] - Options that modify the counting sort. + * @param {number} [options.binCount=4096] - The number of bins/buckets the sort key is quantized into. Larger values improve sort accuracy at the cost of a longer (but still single-pass) prefix sum. + * @param {number} [options.workgroupSize=256] - The workgroup size of the compute shaders executed during the sort. + */ + constructor(count: number, { binCount, workgroupSize }?: { + binCount?: number | undefined; + workgroupSize?: number | undefined; + }); + /** + * The number of elements to sort. + * + * @type {number} + */ + count: number; + /** + * The number of bins/buckets the sort key is quantized into. + * + * @type {number} + */ + binCount: number; + /** + * The workgroup size of the compute shaders executed during the sort. + * + * @type {number} + */ + workgroupSize: number; + /** + * The buffer attribute holding the sorted order (a permutation of `[0, count)`). This is + * also the attribute that is kept up to date by {@link CountingSort#computeCPU}. + * + * @type {StorageBufferAttribute} + */ + orderAttribute: StorageBufferAttribute; + /** + * A read-only storage node for the sorted order buffer. + * + * @type {StorageBufferNode} + */ + orderRead: StorageBufferNode; + /** + * A writable storage node for the sorted order buffer. + * + * @type {StorageBufferNode} + */ + orderWrite: StorageBufferNode; + /** + * A read-only storage node holding each element's bin, computed during the histogram pass. + * + * @type {StorageBufferNode} + */ + binRead: StorageBufferNode; + /** + * A writable storage node holding each element's bin. + * + * @type {StorageBufferNode} + */ + binWrite: StorageBufferNode; + /** + * An atomic storage node used to accumulate the per-bin histogram. + * + * @type {StorageBufferNode} + */ + histogramAtomic: StorageBufferNode; + /** + * An atomic storage node used both for the exclusive prefix sum of the histogram and, during + * the scatter pass, as a per-bin write cursor. + * + * @type {StorageBufferNode} + */ + offsetAtomic: StorageBufferNode; + _webGLBuffersEnabled: boolean; + _cpuBins: Uint32Array; + _cpuCounts: Uint32Array; + _cpuOffsets: Uint32Array; + _resetNode: any; + _histogramNode: any; + _prefixNode: any; + _scatterNode: any; + /** + * Sets the TSL function used to compute the bin of the element currently referenced by + * `instanceIndex`, and (re)builds the compute nodes used by {@link CountingSort#compute}. + * + * @param {Function} binNode - A parameterless function returning a `Node` in `[0, binCount)`. + */ + setBinNode(binNode: Function): void; + /** + * Executes a complete counting sort on the GPU, updating {@link CountingSort#orderRead}. + * + * @param {Renderer} renderer - The current scene's renderer. + */ + compute(renderer: Renderer): void; + /** + * Executes a complete counting sort on the CPU, updating {@link CountingSort#orderAttribute}. + * Intended as a fallback for backends without compute shader support. + * + * @param {Function} binFn - A function taking an element index and returning its bin (a plain number in `[0, binCount)`). + */ + computeCPU(binFn: Function): void; + /** + * Enables the WebGL-specific storage buffer path (PBO + dynamic draw usage) for the order buffer. + * Only needed when {@link CountingSort#computeCPU} is used with the WebGL backend of {@link WebGPURenderer}. + */ + enableWebGLBuffers(): void; +} +import { StorageBufferAttribute } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts new file mode 100644 index 000000000..acab0752f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts @@ -0,0 +1,130 @@ +/** + * Visualizes the motion path of an animated object based on position keyframes + * from an AnimationClip. + * + * ```js + * const clip = model.animations[ 0 ]; + * const helper = new AnimationPathHelper( model, clip, object ); + * scene.add( helper ); + * ``` + * + * @augments Object3D + * @three_import import { AnimationPathHelper } from 'three/addons/helpers/AnimationPathHelper.js'; + */ +export class AnimationPathHelper extends Object3D { + /** + * Constructs a new animation path helper. + * + * @param {Object3D} root - The root object containing the animation clips. + * @param {AnimationClip} clip - The animation clip containing position keyframes. + * @param {Object3D} object - The specific object to show the path for. + * @param {Object} [options={}] - Configuration options. + * @param {number|Color|string} [options.color=0x00ff00] - The path line color. + * @param {number|Color|string} [options.markerColor=0xff0000] - The keyframe marker color. + * @param {number} [options.divisions=100] - Number of samples for smooth path interpolation. + * @param {boolean} [options.showMarkers=true] - Whether to show markers at keyframe positions. + * @param {number} [options.markerSize=5] - Size of keyframe markers in pixels. + */ + constructor(root: Object3D, clip: AnimationClip, object: Object3D, options?: { + color?: number | Color | string; + markerColor?: number | Color | string; + divisions?: number | undefined; + showMarkers?: boolean | undefined; + markerSize?: number | undefined; + }); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAnimationPathHelper: boolean; + type: string; + /** + * The root object containing the animation clips. + * + * @type {Object3D} + */ + root: Object3D; + /** + * The animation clip containing position keyframes. + * + * @type {AnimationClip} + */ + clip: AnimationClip; + /** + * The object whose path is being visualized. + * + * @type {Object3D} + */ + object: Object3D; + /** + * Number of samples for smooth path interpolation. + * + * @type {number} + * @default 100 + */ + divisions: number; + /** + * The position track for the object. + * + * @type {KeyframeTrack|null} + * @private + */ + private _track; + /** + * The line representing the animation path. + * + * @type {Line} + */ + line: Line; + /** + * Points marking keyframe positions. + * + * @type {Points|null} + */ + points: Points | null; + /** + * Finds the position track for the given object. + * + * @private + * @param {Object3D} object - The object to find the track for. + * @returns {KeyframeTrack|null} The position track, or null if not found. + */ + private _findTrackForObject; + /** + * Samples the track at regular intervals. + * + * @private + * @returns {Float32Array} Array of sampled positions. + */ + private _sampleTrack; + /** + * Updates the geometry with sampled path data. + * + * @private + */ + private _updateGeometry; + /** + * Updates the helper's transform to match the object's parent. + * + * @param {boolean} force - Force matrix update. + */ + updateMatrixWorld(force: boolean): void; + /** + * Sets the path line color. + * + * @param {number|Color|string} color - The new color. + */ + setColor(color: number | Color | string): void; + /** + * Sets the keyframe marker color. + * + * @param {number|Color|string} color - The new color. + */ + setMarkerColor(color: number | Color | string): void; +} +import { Object3D } from 'three'; +import { Line } from 'three'; +import { Points } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts new file mode 100644 index 000000000..1c84bfd19 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts @@ -0,0 +1,41 @@ +/** + * Visualizes a {@link LightProbeGrid} by rendering a sphere at each probe + * position, shaded with the probe's L2 spherical harmonics. Uses a single + * `InstancedMesh` draw call for all probes. + * + * This helper can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, import from `LightProbeGridHelperWebGL.js`. + * + * ```js + * const helper = new LightProbeGridHelper( probes ); + * scene.add( helper ); + * ``` + * + * @private + * @augments InstancedMesh + * @three_import import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; + */ +export class LightProbeGridHelper extends InstancedMesh { + /** + * Constructs a new irradiance probe grid helper. + * + * @param {LightProbeGrid} probes - The probe grid to visualize. + * @param {number} [sphereSize=0.12] - The radius of each probe sphere. + */ + constructor(probes: LightProbeGrid, sphereSize?: number); + /** + * The probe grid to visualize. + * + * @type {LightProbeGrid} + */ + probes: LightProbeGrid; + _atlas: any; + _resolution: import("three/webgpu").UniformNode; + /** + * Rebuilds instance matrices and UVW attributes from the current probe grid, + * and rebinds the shading node to its atlas. Call this after changing + * `probes` or after re-baking. + */ + update(): void; +} +import { InstancedMesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts new file mode 100644 index 000000000..53dce264a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts @@ -0,0 +1,35 @@ +/** + * Visualizes an {@link LightProbeGridWebGL} by rendering a sphere at each + * probe position, shaded with the probe's L2 spherical harmonics. + * + * Uses a single `InstancedMesh` draw call for all probes. + * + * ```js + * const helper = new LightProbeGridHelperWebGL( probes ); + * scene.add( helper ); + * ``` + * + * @augments InstancedMesh + * @three_import import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; + */ +export class LightProbeGridHelperWebGL extends InstancedMesh { + /** + * Constructs a new irradiance probe grid helper. + * + * @param {LightProbeGridWebGL} probes - The probe grid to visualize. + * @param {number} [sphereSize=0.12] - The radius of each probe sphere. + */ + constructor(probes: LightProbeGridWebGL, sphereSize?: number); + /** + * The probe grid to visualize. + * + * @type {LightProbeGridWebGL} + */ + probes: LightProbeGridWebGL; + /** + * Rebuilds instance matrices and UVW attributes from the current probe grid. + * Call this after changing `probes` or after re-baking. + */ + update(): void; +} +import { InstancedMesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts new file mode 100644 index 000000000..e34f6b4d0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts @@ -0,0 +1,37 @@ +/** + * Renders a sphere to visualize a light probe in the scene. + * + * This helper can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, import from `LightProbeHelperGPU.js`. + * + * ```js + * const helper = new LightProbeHelper( lightProbe ); + * scene.add( helper ); + * ``` + * + * @augments Mesh + * @three_import import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; + */ +export class LightProbeHelper extends Mesh { + /** + * Constructs a new light probe helper. + * + * @param {LightProbe} lightProbe - The light probe to visualize. + * @param {number} [size=1] - The size of the helper. + */ + constructor(lightProbe: LightProbe, size?: number); + /** + * The light probe to visualize. + * + * @type {LightProbe} + */ + lightProbe: LightProbe; + /** + * The size of the helper. + * + * @type {number} + * @default 1 + */ + size: number; +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts new file mode 100644 index 000000000..7ecb5ec21 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts @@ -0,0 +1,40 @@ +/** + * Renders a sphere to visualize a light probe in the scene. + * + * This helper can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, import from `LightProbeHelper.js`. + * + * ```js + * const helper = new LightProbeHelper( lightProbe ); + * scene.add( helper ); + * ``` + * + * @private + * @augments Mesh + * @three_import import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js'; + */ +export class LightProbeHelper extends Mesh { + /** + * Constructs a new light probe helper. + * + * @param {LightProbe} lightProbe - The light probe to visualize. + * @param {number} [size=1] - The size of the helper. + */ + constructor(lightProbe: LightProbe, size?: number); + /** + * The light probe to visualize. + * + * @type {LightProbe} + */ + lightProbe: LightProbe; + /** + * The size of the helper. + * + * @type {number} + * @default 1 + */ + size: number; + _intensity: import("three/webgpu").UniformNode; + _sh: import("three/webgpu").UniformArrayNode; +} +import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts new file mode 100644 index 000000000..274120242 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts @@ -0,0 +1,38 @@ +/** + * A helper for visualizing an Octree. + * + * ```js + * const helper = new OctreeHelper( octree ); + * scene.add( helper ); + * ``` + * + * @augments LineSegments + * @three_import import { OctreeHelper } from 'three/addons/helpers/OctreeHelper.js'; + */ +export class OctreeHelper extends LineSegments { + /** + * Constructs a new Octree helper. + * + * @param {Octree} octree - The octree to visualize. + * @param {number|Color|string} [color=0xffff00] - The helper's color. + */ + constructor(octree: Octree, color?: number | Color | string); + /** + * The octree to visualize. + * + * @type {Octree} + */ + octree: Octree; + /** + * The helper's color. + * + * @type {number|Color|string} + */ + color: number | Color | string; + /** + * Updates the helper. This method must be called whenever the Octree's + * structure is changed. + */ + update(): void; +} +import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts new file mode 100644 index 000000000..cd81fe886 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts @@ -0,0 +1,61 @@ +/** + * This helper displays the directional cone of a positional audio. + * + * `PositionalAudioHelper` must be added as a child of the positional audio. + * + * ```js + * const positionalAudio = new THREE.PositionalAudio( listener ); + * positionalAudio.setDirectionalCone( 180, 230, 0.1 ); + * scene.add( positionalAudio ); + * + * const helper = new PositionalAudioHelper( positionalAudio ); + * positionalAudio.add( helper ); + * ``` + * + * @augments Line + * @three_import import { PositionalAudioHelper } from 'three/addons/helpers/PositionalAudioHelper.js'; + */ +export class PositionalAudioHelper extends Line { + /** + * Constructs a new positional audio helper. + * + * @param {PositionalAudio} audio - The audio to visualize. + * @param {number} [range=1] - The range of the directional cone. + * @param {number} [divisionsInnerAngle=16] - The number of divisions of the inner part of the directional cone. + * @param {number} [divisionsOuterAngle=2] The number of divisions of the outer part of the directional cone. + */ + constructor(audio: PositionalAudio, range?: number, divisionsInnerAngle?: number, divisionsOuterAngle?: number); + /** + * The audio to visualize. + * + * @type {PositionalAudio} + */ + audio: PositionalAudio; + /** + * The range of the directional cone. + * + * @type {number} + * @default 1 + */ + range: number; + /** + * The number of divisions of the inner part of the directional cone. + * + * @type {number} + * @default 16 + */ + divisionsInnerAngle: number; + /** + * The number of divisions of the outer part of the directional cone. + * + * @type {number} + * @default 2 + */ + divisionsOuterAngle: number; + /** + * Updates the helper. This method must be called whenever the directional cone + * of the positional audio is changed. + */ + update(): void; +} +import { Line } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts new file mode 100644 index 000000000..c7f78d4d4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts @@ -0,0 +1,27 @@ +/** + * This class displays all Rapier Colliders in outline. + * + * @augments LineSegments + * @three_import import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; + */ +export class RapierHelper extends LineSegments { + /** + * Constructs a new Rapier debug helper. + * + * @param {RAPIER.world} world - The Rapier world to visualize. + */ + constructor(world: RAPIER.world); + /** + * The Rapier world to visualize. + * + * @type {RAPIER.world} + */ + world: RAPIER.world; + material: LineBasicMaterial; + /** + * Call this in the render loop to update the outlines. + */ + update(): void; +} +import { LineSegments } from 'three'; +import { LineBasicMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts new file mode 100644 index 000000000..c5f28b95a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts @@ -0,0 +1,38 @@ +/** + * Creates a visual aid for rect area lights. + * + * `RectAreaLightHelper` must be added as a child of the light. + * + * ```js + * const light = new THREE.RectAreaLight( 0xffffbb, 1.0, 5, 5 ); + * const helper = new RectAreaLightHelper( light ); + * light.add( helper ); + * ``` + * + * @augments Line + * @three_import import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; + */ +export class RectAreaLightHelper extends Line { + /** + * Constructs a new rect area light helper. + * + * @param {RectAreaLight} light - The light to visualize. + * @param {number|Color|string} [color] - The helper's color. + * If this is not the set, the helper will take the color of the light. + */ + constructor(light: RectAreaLight, color?: number | Color | string); + /** + * The light to visualize. + * + * @type {RectAreaLight} + */ + light: RectAreaLight; + /** + * The helper's color. If `undefined`, the helper will take the color of the light. + * + * @type {number|Color|string|undefined} + */ + color: number | Color | string | undefined; + updateMatrixWorld(): void; +} +import { Line } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts new file mode 100644 index 000000000..42e13839d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts @@ -0,0 +1,29 @@ +/** + * A helper that can be used to display any type of texture for + * debugging purposes. Depending on the type of texture (2D, 3D, Array), + * the helper becomes a plane or box mesh. + * + * This helper can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, import from `TextureHelperGPU.js`. + * + * @augments Mesh + * @three_import import { TextureHelper } from 'three/addons/helpers/TextureHelper.js'; + */ +export class TextureHelper extends Mesh { + /** + * Constructs a new texture helper. + * + * @param {Texture} texture - The texture to visualize. + * @param {number} [width=1] - The helper's width. + * @param {number} [height=1] - The helper's height. + * @param {number} [depth=1] - The helper's depth. + */ + constructor(texture: Texture, width?: number, height?: number, depth?: number); + /** + * The texture to visualize. + * + * @type {Texture} + */ + texture: Texture; +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts new file mode 100644 index 000000000..0e9151974 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts @@ -0,0 +1,30 @@ +/** + * A helper that can be used to display any type of texture for + * debugging purposes. Depending on the type of texture (2D, 3D, Array), + * the helper becomes a plane or box mesh. + * + * This helper can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, import from `TextureHelper.js`. + * + * @private + * @augments Mesh + * @three_import import { TextureHelper } from 'three/addons/helpers/TextureHelperGPU.js'; + */ +export class TextureHelper extends Mesh { + /** + * Constructs a new texture helper. + * + * @param {Texture} texture - The texture to visualize. + * @param {number} [width=1] - The helper's width. + * @param {number} [height=1] - The helper's height. + * @param {number} [depth=1] - The helper's depth. + */ + constructor(texture: Texture, width?: number, height?: number, depth?: number); + /** + * The texture to visualize. + * + * @type {Texture} + */ + texture: Texture; +} +import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts new file mode 100644 index 000000000..7bd41d0b5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts @@ -0,0 +1,54 @@ +/** + * Visualizes an object's vertex normals. + * + * Requires that normals have been specified in the geometry as a buffer attribute or + * have been calculated using {@link BufferGeometry#computeVertexNormals}. + * ```js + * const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 ); + * const material = new THREE.MeshStandardMaterial(); + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * + * const helper = new VertexNormalsHelper( mesh, 1, 0xff0000 ); + * scene.add( helper ); + * ``` + * + * @augments LineSegments + * @three_import import { VertexNormalsHelper } from 'three/addons/helpers/VertexNormalsHelper.js'; + */ +export class VertexNormalsHelper extends LineSegments { + /** + * Constructs a new vertex normals helper. + * + * @param {Object3D} object - The object for which to visualize vertex normals. + * @param {number} [size=1] - The helper's size. + * @param {number|Color|string} [color=0xff0000] - The helper's color. + */ + constructor(object: Object3D, size?: number, color?: number | Color | string); + /** + * The object for which to visualize vertex normals. + * + * @type {Object3D} + */ + object: Object3D; + /** + * The helper's size. + * + * @type {number} + * @default 1 + */ + size: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVertexNormalsHelper: boolean; + /** + * Updates the vertex normals preview based on the object's world transform. + */ + update(): void; +} +import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts new file mode 100644 index 000000000..3fbf40dbc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts @@ -0,0 +1,41 @@ +/** + * Visualizes an object's vertex tangents. + * + * Requires that tangents have been specified in the geometry as a buffer attribute or + * have been calculated using {@link BufferGeometry#computeTangents}. + * ```js + * const helper = new VertexTangentsHelper( mesh, 1, 0xff0000 ); + * scene.add( helper ); + * ``` + * + * @augments LineSegments + * @three_import import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js'; + */ +export class VertexTangentsHelper extends LineSegments { + /** + * Constructs a new vertex tangents helper. + * + * @param {Object3D} object - The object for which to visualize vertex tangents. + * @param {number} [size=1] - The helper's size. + * @param {number|Color|string} [color=0xff0000] - The helper's color. + */ + constructor(object: Object3D, size?: number, color?: number | Color | string); + /** + * The object for which to visualize vertex tangents. + * + * @type {Object3D} + */ + object: Object3D; + /** + * The helper's size. + * + * @type {number} + * @default 1 + */ + size: number; + /** + * Updates the vertex normals preview based on the object's world transform. + */ + update(): void; +} +import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts new file mode 100644 index 000000000..48b0f2be8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts @@ -0,0 +1,12 @@ +export class Extension extends Tab { + isExtension: boolean; + init(inspector: any): void; + _inspector: any; + _handleLayout: ((event: any) => void) | null | undefined; + serialize(): {}; + deserialize(): void; + save(): void; + onOrientationChange(): void; + onLayoutChange(): void; +} +import { Tab } from 'three/addons/inspector/ui/Tab.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts new file mode 100644 index 000000000..ff84aa49f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts @@ -0,0 +1,88 @@ +export class Inspector extends RendererInspector { + statsData: Map; + profiler: Profiler; + performance: Performance; + memory: Memory; + console: Console; + parameters: Parameters; + viewer: Viewer; + timeline: Timeline; + settings: Settings; + once: {}; + extensionsData: WeakMap; + displayCycle: { + text: { + needsUpdate: boolean; + duration: number; + time: number; + }; + graph: { + needsUpdate: boolean; + duration: number; + time: number; + }; + toggleGraph: { + needsUpdate: boolean; + duration: number; + time: number; + }; + }; + get domElement(): HTMLDivElement | undefined; + isVertical(): boolean | undefined; + onExtension(name: any, callback: any): this; + hide(): void; + show(): void; + setVisible(value: any): this; + getVisible(): boolean; + getSize(): { + width: number; + height: number; + }; + setActiveTab(tab: any): this; + setHorizontalAlign(value: any): this; + setVerticalAlign(value: any): this; + addTab(tab: any): this; + removeTab(tab: any): this; + setActiveExtension(name: any, value: any): this; + resolveConsoleOnce(type: any, message: any): void; + resolveConsole(type: any, message: any, stackTrace?: null): void; + setRenderer(renderer: any): this; + createParameters(name: any): { + parameters: any; + paramList: import("./ui/Item.js").Item; + objects: any[]; + close(): /*elided*/ any; + name(name: any): /*elided*/ any; + show(): /*elided*/ any; + hide(): /*elided*/ any; + add(object: any, property: any, ...params: any[]): import("./ui/Values.js").ValueNumber | import("./ui/Values.js").ValueCheckbox | import("./ui/Values.js").ValueSlider | import("./ui/Values.js").ValueSelect | import("./ui/Values.js").ValueButton | import("./ui/Values.js").ValueString | null; + _addInfo(editor: any, itemNode: any): void; + _addParameter(object: any, property: any, editor: any, subItem: any): void; + _registerParameter(object: any, property: any, editor: any, subItem: any): void; + addString(object: any, property: any): import("./ui/Values.js").ValueString; + addFolder(name: any): /*elided*/ any; + addBoolean(object: any, property: any): import("./ui/Values.js").ValueCheckbox; + addSelect(object: any, property: any, options: any): import("./ui/Values.js").ValueSelect; + addColor(object: any, property: any): import("./ui/Values.js").ValueColor; + addSlider(object: any, property: any, min?: number, max?: number, step?: number): import("./ui/Values.js").ValueSlider; + addNumber(object: any, property: any, ...params: any[]): import("./ui/Values.js").ValueNumber; + addButton(object: any, property: any): import("./ui/Values.js").ValueButton; + }; + getStatsData(cid: any): any; + resolveStats(stats: any): void; + getNodes(): any[] | null; + getAverageDeltaTime(statsData: any, property: any, frames?: number | undefined): number; + resolveFrame(frame: any): void; + updateCycle(cycle: any): void; +} +export function getItem(id: any): any; +export function setItem(id: any, state: any): void; +import { RendererInspector } from './RendererInspector.js'; +import { Profiler } from './ui/Profiler.js'; +import { Performance } from './tabs/Performance.js'; +import { Memory } from './tabs/Memory.js'; +import { Console } from './tabs/Console.js'; +import { Parameters } from './tabs/Parameters.js'; +import { Viewer } from './tabs/Viewer.js'; +import { Timeline } from './tabs/Timeline.js'; +import { Settings } from './tabs/Settings.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts new file mode 100644 index 000000000..92a67d64f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts @@ -0,0 +1,44 @@ +export class RendererInspector extends InspectorBase { + currentFrame: Object | null; + currentRender: any; + currentNodes: any[] | null; + lastFrame: Object | null; + frames: any[]; + framesLib: {}; + maxFrames: number; + _lastFinishTime: number; + _resolveTimestampPromise: any; + overdraw: boolean; + _overdrawMaterial: MeshBasicNodeMaterial | null; + isRendererInspector: boolean; + getParent(): any; + fps: number | undefined; + _renderOverdraw(): void; + _getFPS(): number; + _createFrame(): { + frameId: any; + resolvedCompute: boolean; + resolvedRender: boolean; + deltaTime: number; + startTime: number; + finishTime: number; + miscellaneous: number; + children: never[]; + renders: never[]; + computes: never[]; + }; + getPrimaryPass(): any; + getFrame(): Object | null; + getFrameById(frameId: any): any; + updateTabs(): void; + resolveFrame(): void; + resolveTimestamp(): Promise; + get isAvailable(): boolean; + addFrame(frame: any): void; + inspect(node: any): void; + beginCompute(uid: any, computeNode: any): void; + currentCompute: any; + beginRender(uid: any, scene: any, camera: any, renderTarget: any): void; +} +import { InspectorBase } from 'three/webgpu'; +import { MeshBasicNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts new file mode 100644 index 000000000..ec6f7dec5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts @@ -0,0 +1,168 @@ +export class ColorGrading extends Extension { + constructor(options?: {}); + params: { + exposure: number; + brightness: number; + contrast: number; + contrastPivot: number; + gamma: number; + saturation: number; + vibrance: number; + temperature: number; + tint: number; + hueShift: number; + lift: { + r: number; + g: number; + b: number; + y: number; + }; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + gain: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; + }; + lutSize: number; + lutTexture: Data3DTexture | null; + lutPassNode: import("three/addons/tsl/display/Lut3DNode.js").default | null; + sceneGradingEnabled: boolean; + selectedToneMapping: number; + _lutNeedsUpdate: boolean; + _lutSizeChanged: boolean; + activeTab: string; + modulesMap: Map; + cardsMap: Map; + _createSvgIcon(svgPath: any, width?: number, height?: number, strokeWidth?: number): SVGSVGElement; + _buildHeader(): void; + _buildMainView(): void; + viewContainer: HTMLDivElement | undefined; + dockContainer: HTMLDivElement | undefined; + lutSizeSelect: HTMLSelectElement | undefined; + gradingBtn: HTMLButtonElement | undefined; + updateGradingBtnState: (() => void) | undefined; + pipelineOrder: any[] | string[] | undefined; + cardsRow: HTMLDivElement | undefined; + _cardsResizeObserver: ResizeObserver | null | undefined; + _windowResizeHandler: (() => void) | null | undefined; + _isVerticalMode(): boolean | null; + _updateCardsRowAlignment(): void; + _setupPanAndWheelScroll(container: any, cardsRow: any): void; + _renderCardsFlow(): void; + _updateLiveFlowConnectors(): void; + _openAddCardModal(insertIndex: any): void; + _activeModalOverlay: HTMLDivElement | null | undefined; + _modalKeyDownHandler: ((e: any) => void) | null | undefined; + _closeAddCardModal(): void; + _addCardAt(type: any, insertIndex: any, initialParams?: {}, customId?: null): WhiteBalanceModule | ExposureModule | BrightnessModule | HueModule | ColorWheelModule | CurvesModule | ContrastModule | SaturationModule | VibranceModule | null; + _removeCard(modId: any): void; + _setupCardDragAndDrop(card: any, moduleId: any): void; + _draggedModuleId: any; + _updateRendererCardState(): void; + _onParamChange(): void; + generate3DLUTData(size?: number, buffer?: null): null; + _getExportFileName(defaultBase?: string): any; + _exportCubeFile(): void; + _exportPngFile(): void; + toJSON(): { + version: number; + lutSize: number; + selectedToneMapping: number; + sceneGradingEnabled: boolean; + pipelineOrder: any[]; + modules: {}; + params: {}; + }; + serialize(): { + version: number; + lutSize: number; + selectedToneMapping: number; + sceneGradingEnabled: boolean; + pipelineOrder: any[]; + modules: {}; + params: {}; + }; + deserialize(data: any): void; + _applyParamsToModule(modId: any, params: any): void; + load(data: any): void; + _exportJsonFile(): void; + _importJsonFile(): void; + _createImportedCubeCard(modId: any): HTMLDivElement; + _removeImportedCubeCard(modId: any): void; + _importCubeFileAt(insertIndex: any): void; + _importCubeFile(): void; + onOrientationChange(event: any): void; + update(inspector: any): void; + _getRenderPipeline(renderer: any): any; + _toggleSceneGrading(enable: any): void; + _updateLiveGrading(): void; + _applyLiveGrading(): void; + _createdPipeline: RenderPipeline | null | undefined; + _origRendererRender: any; + _originalPipelineSettings: { + outputNode: any; + outputColorTransform: any; + rendererToneMapping: any; + } | null | undefined; + _removeLiveGrading(): void; +} +import { Extension } from 'three/addons/inspector/Extension.js'; +import { Data3DTexture } from 'three/webgpu'; +import { WhiteBalanceModule } from './modules/WhiteBalanceModule.js'; +import { ExposureModule } from './modules/ExposureModule.js'; +import { BrightnessModule } from './modules/BrightnessModule.js'; +import { HueModule } from './modules/HueModule.js'; +import { ColorWheelModule } from './modules/ColorWheelModule.js'; +import { CurvesModule } from './modules/CurvesModule.js'; +import { ContrastModule } from './modules/ContrastModule.js'; +import { SaturationModule } from './modules/SaturationModule.js'; +import { VibranceModule } from './modules/VibranceModule.js'; +import { RenderPipeline } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts new file mode 100644 index 000000000..cb729200f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts @@ -0,0 +1,27 @@ +/** + * ColorWheel.js - DaVinci Resolve style interactive Color Wheel control widget + */ +export class ColorWheel { + constructor(title: any, initialValues: { + r: number; + g: number; + b: number; + } | undefined, onChange: any, onRemove?: null); + title: any; + values: { + r: number; + g: number; + b: number; + }; + onChange: any; + onRemove: any; + domElement: HTMLDivElement; + _buildUI(): void; + canvas: HTMLCanvasElement | undefined; + ctx: CanvasRenderingContext2D | null | undefined; + ySlider: HTMLInputElement | undefined; + inputs: {} | undefined; + setValues(r: any, g: any, b: any, y?: undefined): void; + draw(): void; + _initEvents(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts new file mode 100644 index 000000000..1573d894b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts @@ -0,0 +1,37 @@ +export class CurveEditor { + constructor(options?: {}); + curves: any; + activeChannel: any; + onChange: any; + selectedIndex: number; + isDragging: boolean; + pointRadius: number; + domElement: HTMLDivElement; + _buildUI(): void; + channelBtns: {} | undefined; + canvasContainer: HTMLDivElement | undefined; + canvas: HTMLCanvasElement | undefined; + ctx: CanvasRenderingContext2D | null | undefined; + _onResize(): void; + setChannel(channelId: any): void; + setCurves(curves: any): void; + getCurves(): { + rgb: any; + red: any; + green: any; + blue: any; + }; + _getChannelColor(channelId?: any): "#e0e0e0" | "#ff3344" | "#22dd55" | "#3388ff"; + _normToCanvas(point: any): { + x: number; + y: number; + }; + _canvasToNorm(px: any, py: any): { + x: number; + y: number; + }; + _initEvents(): void; + _dragStartSnapshot: any; + notifyChange(): void; + render(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts new file mode 100644 index 000000000..e6c350e7e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts @@ -0,0 +1,6 @@ +/** + * LUT3DStyle.js - Unified CSS stylesheet module for 3D LUT Generator extension + */ +export class LUT3DStyle { + static init(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts new file mode 100644 index 000000000..bb74403b7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts @@ -0,0 +1,505 @@ +export function evaluateSpline(t: any, points: any): any; +export function rgbToHsv(r: any, g: any, b: any): number[]; +export function hsvToRgb(h: any, s: any, v: any): number[]; +export function sample3DLUT(r: any, g: any, b: any, size: any, dataLines: any): number[]; +export function applyColorTransform(r: any, g: any, b: any, params: any, pipelineOrder?: null): number[]; +export function generate3DLUTData(params: any, size?: number, buffer?: null, pipelineOrder?: null): null; +export function exportCubeFormat(paramsOrBuffer: any, size?: number, title?: string, pipelineOrder?: null): string; +export function parseCubeFormat(text: any): { + title: string; + size: number; + data: any[][]; + dataLines: any[][]; +}; +export function exportLUTCanvas(paramsOrBuffer: any, size?: number, pipelineOrder?: null): HTMLCanvasElement; +export function createDefaultParams(): { + exposure: number; + brightness: number; + contrast: number; + contrastPivot: number; + gamma: number; + saturation: number; + vibrance: number; + temperature: number; + tint: number; + hueShift: number; + lift: { + r: number; + g: number; + b: number; + y: number; + }; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + gain: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; +}; +export const LUT_PRESETS: { + 'Neutral (Default)': { + exposure: number; + brightness: number; + contrast: number; + contrastPivot: number; + gamma: number; + saturation: number; + vibrance: number; + temperature: number; + tint: number; + hueShift: number; + lift: { + r: number; + g: number; + b: number; + y: number; + }; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + gain: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; + }; + 'Cinematic Teal & Orange': { + contrast: number; + temperature: number; + lift: { + r: number; + g: number; + b: number; + }; + gain: { + r: number; + g: number; + b: number; + }; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; + exposure: number; + brightness: number; + contrastPivot: number; + gamma: number; + saturation: number; + vibrance: number; + tint: number; + hueShift: number; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + }; + 'Vintage Warm Film': { + exposure: number; + contrast: number; + saturation: number; + temperature: number; + tint: number; + lift: { + r: number; + g: number; + b: number; + }; + gain: { + r: number; + g: number; + b: number; + }; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; + brightness: number; + contrastPivot: number; + gamma: number; + vibrance: number; + hueShift: number; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + }; + 'Cold Sci-Fi Blue': { + contrast: number; + temperature: number; + tint: number; + lift: { + r: number; + g: number; + b: number; + }; + gain: { + r: number; + g: number; + b: number; + }; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; + exposure: number; + brightness: number; + contrastPivot: number; + gamma: number; + saturation: number; + vibrance: number; + hueShift: number; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + }; + 'Cyberpunk Neon': { + contrast: number; + saturation: number; + vibrance: number; + lift: { + r: number; + g: number; + b: number; + }; + gain: { + r: number; + g: number; + b: number; + }; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; + exposure: number; + brightness: number; + contrastPivot: number; + gamma: number; + temperature: number; + tint: number; + hueShift: number; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + }; + 'High Contrast B&W': { + contrast: number; + saturation: number; + curves: { + rgb: { + x: number; + y: number; + }[]; + red: { + x: number; + y: number; + }[]; + green: { + x: number; + y: number; + }[]; + blue: { + x: number; + y: number; + }[]; + }; + exposure: number; + brightness: number; + contrastPivot: number; + gamma: number; + vibrance: number; + temperature: number; + tint: number; + hueShift: number; + lift: { + r: number; + g: number; + b: number; + y: number; + }; + gammaBal: { + r: number; + g: number; + b: number; + y: number; + }; + gain: { + r: number; + g: number; + b: number; + y: number; + }; + offset: { + r: number; + g: number; + b: number; + y: number; + }; + channelMixer: { + red: { + r: number; + g: number; + b: number; + }; + green: { + r: number; + g: number; + b: number; + }; + blue: { + r: number; + g: number; + b: number; + }; + }; + }; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts new file mode 100644 index 000000000..5c90157c1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts @@ -0,0 +1,6 @@ +export class BrightnessModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + brightnessControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts new file mode 100644 index 000000000..07497e82d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts @@ -0,0 +1,9 @@ +export class ColorWheelModule extends Module { + constructor(mode: any, title: any, initialParams?: {}, onChange?: null, onRemove?: null, id?: null); + mode: any; + onRemove: any; + wheel: ColorWheel; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; +import { ColorWheel } from '../ColorWheel.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts new file mode 100644 index 000000000..8837f191c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts @@ -0,0 +1,7 @@ +export class ContrastModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + contrastControl: HTMLDivElement; + pivotControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts new file mode 100644 index 000000000..8bd0fec18 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts @@ -0,0 +1,7 @@ +export class CurvesModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + curveEditor: CurveEditor; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; +import { CurveEditor } from '../CurveEditor.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts new file mode 100644 index 000000000..88dbafbbc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts @@ -0,0 +1,7 @@ +export class ExposureHueModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + exposureControl: HTMLDivElement; + hueShiftControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts new file mode 100644 index 000000000..535efeeff --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts @@ -0,0 +1,6 @@ +export class ExposureModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + exposureControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts new file mode 100644 index 000000000..1122af211 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts @@ -0,0 +1,6 @@ +export class HueModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + hueShiftControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts new file mode 100644 index 000000000..60792eb70 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts @@ -0,0 +1,7 @@ +export class ImportedCubeModule extends Module { + constructor(id: any, cubeInfo?: {}, onChange?: null, onRemove?: null); + onRemove: any; + weightControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts new file mode 100644 index 000000000..e2790372f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts @@ -0,0 +1,48 @@ +/** + * Module.js - Base class for LUT 3D Generator Card Modules + */ +export class Module { + constructor(id: any, name: any, params?: {}); + id: any; + name: any; + params: {}; + enabled: boolean; + domElement: any; + onChange: any; + dragAndDrop: boolean; + /** + * Applies module transformation directly onto a Float32Array 3D LUT buffer. + * @param {Float32Array} buffer - Buffer of size x size x size x 4 RGBA elements + * @param {number} size - LUT grid dimension + * @returns {Float32Array} + */ + apply(buffer: Float32Array): Float32Array; + /** + * Transforms a single RGB color pixel (0..1 range) into a reusable target array. + * Virtual method to be overridden by sub-classes. + */ + applyPixel(r: any, g: any, b: any, target?: number[]): number[]; + /** + * Helper to create standard card header with title, reset button, and optional remove button. + */ + createCardHeader(titleText: any, onReset: any, onRemove?: null): HTMLDivElement; + /** + * Helper to create parameter box with label, draggable number input, and range slider. + */ + createSliderControl({ key, label, min, max, step, def }: { + key: any; + label: any; + min: any; + max: any; + step: any; + def: any; + }): HTMLDivElement; + onParamChange(): void; + reset(): void; + updateUI(): void; + toJSON(): { + id: any; + params: any; + }; + fromJSON(json: any): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts new file mode 100644 index 000000000..0fb86f029 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts @@ -0,0 +1,7 @@ +export class OutputModule extends Module { + constructor(params?: {}, onChange?: null); + nameInput: HTMLInputElement; + resVal: HTMLSpanElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts new file mode 100644 index 000000000..4641fc424 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts @@ -0,0 +1,11 @@ +export class RendererModule extends Module { + constructor(params?: {}, onChange?: null, onRendererChange?: null); + defaultToneMapping: any; + defaultExposure: any; + onRendererChange: any; + toneMappingSelect: HTMLSelectElement; + exposureNumInput: HTMLInputElement; + exposureSlider: HTMLInputElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts new file mode 100644 index 000000000..9257e9de3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts @@ -0,0 +1,7 @@ +export class SatVibranceModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + saturationControl: HTMLDivElement; + vibranceControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts new file mode 100644 index 000000000..fbbb63167 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts @@ -0,0 +1,6 @@ +export class SaturationModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + saturationControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts new file mode 100644 index 000000000..89d143771 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts @@ -0,0 +1,6 @@ +export class VibranceModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + vibranceControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts new file mode 100644 index 000000000..dedd0da3a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts @@ -0,0 +1,7 @@ +export class WhiteBalanceModule extends Module { + constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); + temperatureControl: HTMLDivElement; + tintControl: HTMLDivElement; + domElement: HTMLDivElement; +} +import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts new file mode 100644 index 000000000..aa4aa8bc4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts @@ -0,0 +1,43 @@ +export default TSLGraphEditor; +declare class TSLGraphEditor extends Extension { + constructor(options?: {}); + autoGraphId: boolean; + iframe: HTMLIFrameElement; + editorOrigin: string; + material: any; + uniforms: any; + isReady: boolean; + _codeData: any; + _codeSaveTimeout: number | null; + _pending: Map; + _resolveReady: ((value: any) => void) | null; + _editorReady: Promise; + get hasGraphs(): boolean; + _initPicker(inspector: any): void; + apply(scene: any): this; + restoreMaterial(material: any): void; + setMaterial(material: any): Promise; + loadGraph(graphData: any): Promise; + command(type: any, payload: any): Promise; + getCode(): Promise; + getTSLFunction(): Promise; + getGraph(): Promise; + onResponse(): Promise; + onEvent(type: any, payload: any): Promise; + onMessage(event: any): Promise; + _setMaterial(material: any): Promise; + materialDefault: any; + _getGraphType(material: any): "material/physical" | "material/standard" | "material/phong" | "material/basic" | "material/sprite" | "material/node"; + _showManagerModal(): void; + _exportData(): void; + _importData(): void; + getCodes(): any; + _saveCode(): void; + _restoreMaterial(): void; + _updateMaterial(): Promise; + _updateUniforms(uniforms: any): void; + _isEditorMessage(value: any): boolean; + _makeRequestId(): string; + _post(message: any): void; +} +import { Extension } from 'three/addons/inspector/Extension.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts new file mode 100644 index 000000000..85c1dc7fc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts @@ -0,0 +1,24 @@ +export class TSLGraphLoader extends FileLoader { + static get hasGraphs(): boolean; + static getCodes(): any; + static setCodes(codes: any): void; + static setGraph(graphId: any, graphData: any): void; + static getGraph(graphId: any): any; + static deleteGraph(graphId: any): void; + static setGraphs(json: any): any; + static clearGraphs(): void; + constructor(manager: any); + load(url: any, onLoad: any, onProgress: any, onError: any): void; + parseMaterial(json: any): any; + parseMaterials(json: any): any; + parse(json: any): TSLGraphLoaderApplier; + _generateMaterialCode(json: any, name?: string, imports?: {}): any; + _generateCode(materials: any, imports: any): string; +} +import { FileLoader } from 'three'; +declare class TSLGraphLoaderApplier { + constructor(tslGraphFns: any); + tslGraphFns: any; + apply(scene: any): void; +} +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts new file mode 100644 index 000000000..d52a3e94c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts @@ -0,0 +1,31 @@ +export class Console extends Tab { + constructor(options?: {}); + filters: { + info: boolean; + warn: boolean; + error: boolean; + }; + filterText: string; + unreadErrors: number; + unreadWarns: number; + tabBadgeContainer: HTMLSpanElement; + tabErrorBadge: HTMLSpanElement; + tabWarnBadge: HTMLSpanElement; + logContainer: HTMLDivElement; + lastMessage: { + type: any; + text: any; + count: number; + element: HTMLDivElement; + countBadge: HTMLSpanElement; + } | null; + buildHeader(): void; + applyFilters(): void; + copyAll(button: any): void; + _getIcon(type: any, subType: any): string | undefined; + _formatMessage(type: any, text: any): DocumentFragment; + clearUnread(): void; + updateBadges(): void; + addMessage(type: any, text: any): void; +} +import { Tab } from '../ui/Tab.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts new file mode 100644 index 000000000..934bb1515 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts @@ -0,0 +1,20 @@ +export class Memory extends Tab { + constructor(options?: {}); + memoryStats: Item; + attributes: Item; + geometries: Item; + indexAttributes: Item; + indirectStorageAttributes: Item; + programs: Item; + readbackBuffers: Item; + renderTargets: Item; + storageAttributes: Item; + textures: Item; + uniformBuffers: Item; + graph: Graph; + updateGraph(inspector: any): void; + updateText(inspector: any): void; +} +import { Tab } from '../ui/Tab.js'; +import { Item } from '../ui/Item.js'; +import { Graph } from '../ui/Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts new file mode 100644 index 000000000..2e7363ffa --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts @@ -0,0 +1,39 @@ +export class Parameters extends Tab { + constructor(options?: {}); + paramList: List; + groups: any[]; + createGroup(name: any): ParametersGroup; +} +import { Tab } from '../ui/Tab.js'; +import { List } from '../ui/List.js'; +declare class ParametersGroup { + constructor(parameters: any, name: any); + parameters: any; + paramList: Item; + objects: any[]; + close(): this; + name(name: any): this; + show(): this; + hide(): this; + add(object: any, property: any, ...params: any[]): ValueNumber | ValueCheckbox | ValueSlider | ValueSelect | ValueButton | ValueString | null; + _addInfo(editor: any, itemNode: any): void; + _addParameter(object: any, property: any, editor: any, subItem: any): void; + _registerParameter(object: any, property: any, editor: any, subItem: any): void; + addString(object: any, property: any): ValueString; + addFolder(name: any): ParametersGroup; + addBoolean(object: any, property: any): ValueCheckbox; + addSelect(object: any, property: any, options: any): ValueSelect; + addColor(object: any, property: any): ValueColor; + addSlider(object: any, property: any, min?: number, max?: number, step?: number): ValueSlider; + addNumber(object: any, property: any, ...params: any[]): ValueNumber; + addButton(object: any, property: any): ValueButton; +} +import { Item } from '../ui/Item.js'; +import { ValueNumber } from '../ui/Values.js'; +import { ValueCheckbox } from '../ui/Values.js'; +import { ValueSlider } from '../ui/Values.js'; +import { ValueSelect } from '../ui/Values.js'; +import { ValueButton } from '../ui/Values.js'; +import { ValueString } from '../ui/Values.js'; +import { ValueColor } from '../ui/Values.js'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts new file mode 100644 index 000000000..af834317e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts @@ -0,0 +1,20 @@ +export class Performance extends Tab { + constructor(options?: {}); + graphFpsCounter: HTMLSpanElement; + notInUse: Map; + frameStats: Item; + graphStats: Item; + graph: Graph; + miscellaneous: Item; + currentRender: any; + currentItem: any; + frameItems: Map; + resolveStats(inspector: any, stats: any): void; + updateGraph(inspector: any, frame: any): void; + addNotInUse(cid: any, item: any): void; + updateNotInUse(cid: any): void; + updateText(inspector: any, frame: any): void; +} +import { Tab } from '../ui/Tab.js'; +import { Item } from '../ui/Item.js'; +import { Graph } from '../ui/Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts new file mode 100644 index 000000000..46e23ec45 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts @@ -0,0 +1,13 @@ +export class Settings extends Parameters { + constructor(); + extensions: {}; + setActiveExtension(name: any, value: any): Promise; + _updateExtensionUI(extension: any): void; + _unloadExtension(inspector: any, extension: any): Promise; + _loadExtension(inspector: any, extension: any): Promise; + _getExtensions(): Promise<{ + name: string; + url: string; + }[]>; +} +import { Parameters } from './Parameters.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts new file mode 100644 index 000000000..1ff4fdac0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts @@ -0,0 +1,153 @@ +export class Timeline extends Tab { + constructor(options?: {}); + isRecording: boolean; + frames: any[]; + baseTriangles: number; + currentFrame: { + id: any; + calls: never[]; + fps: number; + triangles: number; + } | null; + isHierarchicalView: boolean; + activeBlocks: Map; + domPool: any[]; + originalBackend: any; + originalMethods: Map; + renderer: any; + graph: Graph; + init(inspector: any): void; + buildHeader(): void; + recordButton: HTMLButtonElement | undefined; + viewModeSelect: HTMLSelectElement | undefined; + recordRefreshButton: HTMLButtonElement | undefined; + exportButton: HTMLButtonElement | undefined; + frameInfo: HTMLSpanElement | undefined; + buildUI(): void; + graphSlider: HTMLDivElement | undefined; + hoverIndicator: HTMLDivElement | undefined; + playhead: HTMLDivElement | undefined; + fixedScreenX: number | undefined; + isTrackingLatest: boolean | undefined; + isManualScrubbing: boolean | undefined; + timelineTrack: HTMLDivElement | undefined; + timelineContent: HTMLDivElement | undefined; + setRenderer(renderer: any): void; + toggleRecording(): void; + startRecording(): void; + selectedFrameIndex: any; + stopRecording(): void; + clear(): void; + exportData(): void; + getRenderTargetDetails(renderTarget: any): { + [x: string]: any; + target: any; + }; + getCallDetail(method: any, args: any): { + scene: any; + camera: any; + } | { + compute: any; + } | { + color: any; + depth: any; + stencil: any; + } | { + group: any; + count: any; + } | { + group: any; + size: string; + } | { + object: any; + } | { + name: any; + count: any; + itemSize: any; + } | { + target: any; + width: any; + height: any; + } | { + source: any; + destination: any; + } | { + magFilter: any; + minFilter: any; + wrapS: any; + wrapT: any; + anisotropy: any; + } | { + texture: any; + } | { + node: any; + bindings: number; + dispatch: any; + group?: undefined; + x?: undefined; + y?: undefined; + width?: undefined; + height?: undefined; + stage?: undefined; + name?: undefined; + } | { + group: any; + node?: undefined; + bindings?: undefined; + dispatch?: undefined; + x?: undefined; + y?: undefined; + width?: undefined; + height?: undefined; + stage?: undefined; + name?: undefined; + } | { + x: any; + y: any; + width: any; + height: any; + node?: undefined; + bindings?: undefined; + dispatch?: undefined; + group?: undefined; + stage?: undefined; + name?: undefined; + } | { + stage: any; + name: any; + node?: undefined; + bindings?: undefined; + dispatch?: undefined; + group?: undefined; + x?: undefined; + y?: undefined; + width?: undefined; + height?: undefined; + } | { + name: any; + node?: undefined; + bindings?: undefined; + dispatch?: undefined; + group?: undefined; + x?: undefined; + y?: undefined; + width?: undefined; + height?: undefined; + stage?: undefined; + } | null; + getTextureName(texture: any): any; + getTextureFilterName(filter: any): any; + getTextureWrapName(wrap: any): any; + formatDetails(details: any): string; + renderSlider(): void; + selectFrame(index: any): void; + createBlock(): HTMLDivElement; + clearActiveBlocks(): void; + updateVisibleBlocks(): void; + renderTimelineTrack(frame: any): void; + flatList: any[] | undefined; + collapsedGroups: Set | undefined; + getColorForMethod(method: any): "var(--color-green)" | "var(--text-secondary)" | "var(--color-red)" | "var(--color-yellow)"; +} +import { Tab } from '../ui/Tab.js'; +import { Graph } from '../ui/Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts new file mode 100644 index 000000000..11a73a479 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts @@ -0,0 +1,53 @@ +export class Viewer extends Tab { + constructor(options?: {}); + maximizedByFullscreenButton: boolean; + nodeList: List; + itemLibrary: Map; + folderLibrary: Map; + canvasNodes: Map; + currentDataList: any[]; + nodes: Item; + scrollWrapper: HTMLDivElement; + fullViewerContainer: HTMLDivElement; + select: HTMLSelectElement; + backBtn: HTMLButtonElement; + activeFullNodeId: any; + pendingRestoreView: boolean; + splitActive: boolean; + splitCanvasData: any; + splitOverlay: HTMLDivElement | null; + splitLine: HTMLDivElement | null; + splitQuad: QuadMesh | null; + splitMaterial: NodeMaterial | null; + splitUniforms: { + splitX: import("three/webgpu").UniformNode; + viewportWidth: import("three/webgpu").UniformNode; + } | null; + splitCanvas: HTMLCanvasElement | null; + splitCanvasTarget: CanvasTarget | null; + isDraggingThumbnail: boolean; + activeSourceCanvas: any; + activePointerIds: Set; + getFolder(name: any): any; + addNodeItem(canvasData: any): any; + splitFullscreen: boolean | undefined; + setupEventForwarding(sourceCanvas: any): void; + forwardEvent(event: any, sourceCanvas: any, targetCanvas: any): void; + init(inspector: any): void; + setViewMode(mode: any): void; + showListView(): void; + showNodeView(nodeId: any): void; + startSplitMode(canvasData: any): void; + splitX: number | undefined; + stopSplitMode(): void; + updateSplitButtonsState(): void; + getCanvasDataByNode(renderer: any, node: any): any; + update(inspector: any): void; + saveLastView(): void; +} +import { Tab } from '../ui/Tab.js'; +import { List } from '../ui/List.js'; +import { Item } from '../ui/Item.js'; +import { QuadMesh } from 'three/webgpu'; +import { NodeMaterial } from 'three/webgpu'; +import { CanvasTarget } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts new file mode 100644 index 000000000..6982acfd8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts @@ -0,0 +1,23 @@ +export class Graph { + constructor(maxPoints?: number); + maxPoints: number; + lines: {}; + limit: number; + limitIndex: number; + domElement: HTMLCanvasElement; + ctx: CanvasRenderingContext2D | null; + width: number; + height: number; + devicePixelRatio: number; + resize(width: any, height: any): void; + addLine(id: any, color: any): void; + addPoint(lineId: any, value: any): void; + resetLimit(): void; + update(): void; + draw(): void; + _resolveColor(color: any): { + color: any; + transparent: string; + } | null; + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts new file mode 100644 index 000000000..768c71a81 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts @@ -0,0 +1,23 @@ +export class Item { + constructor(...data: any[]); + children: any[]; + isOpen: boolean; + isCollapsible: boolean; + childrenContainer: HTMLDivElement | null; + parent: any; + domElement: HTMLDivElement; + itemRow: HTMLDivElement; + userData: {}; + data: any[]; + onItemClick(e: any): void; + add(item: any, index?: number): this; + remove(item: any): this; + updateToggler(): void; + setCollapsible(collapsible: any): this; + toggle(): this; + close(): this; + show(): this; + hide(): this; + setValue(index: any, value: any): this; + getValue(index: any): any; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts new file mode 100644 index 000000000..864106ae1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts @@ -0,0 +1,12 @@ +export class List { + constructor(...headers: any[]); + headers: any[]; + children: any[]; + domElement: HTMLDivElement; + id: string; + gridStyleElement: HTMLStyleElement; + setGridStyle(gridTemplate: any): void; + setViewMode(mode: any): void; + add(item: any): void; + remove(item: any): this; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts new file mode 100644 index 000000000..d08b8bdb1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts @@ -0,0 +1,72 @@ +export class Profiler extends EventDispatcher { + constructor(inspector: any); + inspector: any; + tabs: {}; + activeTabId: any; + isResizing: boolean; + lastHeightBottom: number; + lastWidthRight: number; + position: string; + detachedWindows: any[]; + maxZIndex: number; + nextTabOriginalIndex: number; + horizontalAlign: string; + verticalAlign: string; + getSize(): { + width: number; + height: number; + }; + get isMobile(): boolean; + get isSmallScreen(): boolean; + detectMobile(): boolean; + setupOrientationListener(): void; + setupWindowResizeListener(): void; + constrainWindowToBounds(windowPanel: any): void; + setupShell(): void; + domElement: HTMLDivElement | undefined; + toggleButton: HTMLButtonElement | undefined; + builtinTabsContainer: Element | null | undefined; + miniPanel: HTMLDivElement | undefined; + panel: HTMLDivElement | undefined; + tabsContainer: HTMLDivElement | undefined; + floatingBtn: HTMLButtonElement | undefined; + maximizeBtn: HTMLButtonElement | undefined; + contentWrapper: HTMLDivElement | undefined; + toggleGraph: Graph | undefined; + setupResizing(): void; + toggleMaximize(): void; + hide(): void; + show(tab: any): void; + addTab(tab: any): void; + addBuiltinTab(tab: any): void; + removeTab(tab: any): void; + updatePanelSize(): void; + checkHeaderScroll(): void; + setupTabDragAndDrop(tab: any): void; + createPreviewWindow(tab: any, x: any, y: any): HTMLDivElement; + detachTab(tab: any, x: any, y: any): void; + createDetachedWindow(tab: any, x: any, y: any): { + panel: HTMLDivElement; + tab: any; + }; + bringWindowToFront(windowPanel: any): void; + setupDetachedWindowDrag(windowPanel: any, header: any, tab: any): void; + setupDetachedWindowResize(windowPanel: any, resizerTop: any, resizerRight: any, resizerBottom: any, resizerLeft: any, resizerCorner: any): void; + reattachTab(tab: any): void; + setActiveTab(id: any): void; + togglePanel(): void; + togglePosition(): void; + setPosition(targetPosition: any): void; + saveLayout(): void; + loadLayout(): void; + isLoadingLayout: boolean | undefined; + pendingDetachedTabs: any; + restoreDetachedTabs(): void; + setHorizontalAlign(value: any): this; + setVerticalAlign(value: any): this; + updateWidgetPosition(): void; + isVertical(): boolean | undefined; + notifyLayoutChange(): void; +} +import { EventDispatcher } from 'three'; +import { Graph } from './Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts new file mode 100644 index 000000000..7889785be --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts @@ -0,0 +1,3 @@ +export class Style { + static init(container: any): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts new file mode 100644 index 000000000..e878fe9c8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts @@ -0,0 +1,54 @@ +/** + * Tab class + * @param {string} title - The title of the tab + * @param {Object} options - Options for the tab + * @param {boolean} [options.allowDetach=true] - Whether the tab can be detached into a separate window + * @param {boolean} [options.builtin=false] - Whether the tab should appear in the profiler-toggle button + * @param {string} [options.icon] - SVG icon HTML for the builtin button + * + * @example + * // Create a tab that can be detached (default behavior) + * const tab1 = new Tab('My Tab'); + * + * // Create a tab that cannot be detached + * const tab2 = new Tab('Fixed Tab', { allowDetach: false }); + * + * // Create a builtin tab that appears in the profiler-toggle + * const tab3 = new Tab('Builtin Tab', { builtin: true }); + * + * // Create a builtin tab with custom icon + * const tab4 = new Tab('Settings', { builtin: true, icon: '...' }); + * + * // Control builtin tab visibility + * tab3.showBuiltin(); // Show the builtin button and mini-content + * tab3.hideBuiltin(); // Hide the builtin button and mini-content + */ +export class Tab extends EventDispatcher { + constructor(title: any, options?: {}); + id: any; + button: HTMLButtonElement; + content: HTMLDivElement; + _isActive: boolean; + isVisible: boolean; + isDetached: boolean; + detachedWindow: any; + allowDetach: any; + builtin: any; + icon: any; + builtinButton: any; + miniContent: any; + profiler: any; + onVisibilityChange: any; + get inspector(): any; + set isActive(value: boolean); + get isActive(): boolean; + init(): void; + update(): void; + setActive(isActive: any): void; + show(): void; + hide(): void; + showBuiltin(): void; + hideBuiltin(): void; + dispose(): void; +} +import { EventDispatcher } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts new file mode 100644 index 000000000..53a513e13 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts @@ -0,0 +1,82 @@ +export class Value extends EventDispatcher { + domElement: HTMLDivElement; + _onChangeFunction: any; + _changeTimeout: number | null; + _debounceTime: number; + setValue(): this; + getValue(): null; + dispatchChange(): void; + onChange(callback: any): this; + debounce(time: any): this; + show(): this; + hide(): this; +} +export class ValueNumber extends Value { + constructor({ value, step, min, max }: { + value?: number | undefined; + step?: number | undefined; + min?: number | undefined; + max?: number | undefined; + }); + input: HTMLInputElement; + _onChangeValue(): void; + addDragHandler(): void; + setValue(val: any): this; + getValue(): number; +} +export class ValueString extends Value { + constructor({ value }: { + value?: string | undefined; + }); + input: HTMLInputElement; + setValue(val: any): this; + getValue(): string; +} +export class ValueCheckbox extends Value { + constructor({ value }: { + value?: boolean | undefined; + }); + checkbox: HTMLInputElement; + setValue(val: any): this; + getValue(): boolean; +} +export class ValueSlider extends Value { + constructor({ value, min, max, step }: { + value?: number | undefined; + min?: number | undefined; + max?: number | undefined; + step?: number | undefined; + }); + slider: HTMLInputElement; + numberInput: HTMLInputElement; + setValue(val: any): this; + getValue(): number; + step(value: any): this; +} +export class ValueSelect extends Value { + constructor({ options, value }: { + options?: never[] | undefined; + value?: string | undefined; + }); + options: any[]; + select: HTMLSelectElement; + setValue(val: any): this; + getValue(): any; +} +export class ValueColor extends Value { + constructor({ value }: { + value?: string | undefined; + }); + colorInput: HTMLInputElement; + _value: string; + setValue(val: any): this; + _getColorHex(color: any): any; + getValue(): string; +} +export class ValueButton extends Value { + constructor({ text, value }: { + text?: string | undefined; + value?: (() => void) | undefined; + }); +} +import { EventDispatcher } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts new file mode 100644 index 000000000..f1d15efe0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts @@ -0,0 +1,10 @@ +export function createValueSpan(): HTMLSpanElement; +export function setText(element: any, text: any): void; +export function getText(element: any): any; +export function splitPath(fullPath: any): { + path: any; + name: any; +}; +export function splitCamelCase(str: any): any; +export function formatBytes(bytes: any, decimals?: number): string; +export function info(parentNode: any, text: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts new file mode 100644 index 000000000..b71532d01 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts @@ -0,0 +1,77 @@ +/** + * Manages interaction for 3D objects independently of the scene graph. + * + * For objects with an {@link HTMLTexture}, the manager computes CSS `matrix3d` + * transforms each frame so the underlying HTML elements stay aligned with + * their meshes. Because the elements are children of the canvas, the browser + * dispatches pointer events to them natively. + * + * ```js + * const interactions = new InteractionManager(); + * interactions.connect( renderer, camera ); + * + * // Objects live anywhere in the scene graph + * scene.add( mesh ); + * + * // Register for interaction separately + * interactions.add( mesh ); + * + * // In the animation loop + * interactions.update(); + * ``` + * @three_import import { InteractionManager } from 'three/addons/interaction/InteractionManager.js'; + */ +export class InteractionManager { + /** + * The registered interactive objects. + * + * @type {Array} + */ + objects: Array; + /** + * The canvas element. + * + * @type {?HTMLCanvasElement} + * @default null + */ + element: HTMLCanvasElement | null; + /** + * The camera used for computing the element transforms. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + _cachedCssW: number; + _cachedCssH: number; + /** + * Adds one or more objects to the manager. + * + * @param {...Object3D} objects - The objects to add. + * @return {this} + */ + add(...objects: Object3D[]): this; + /** + * Removes one or more objects from the manager. + * + * @param {...Object3D} objects - The objects to remove. + * @return {this} + */ + remove(...objects: Object3D[]): this; + /** + * Stores the renderer and camera needed for computing element transforms. + * + * @param {(WebGPURenderer|WebGLRenderer)} renderer - The renderer. + * @param {Camera} camera - The camera. + */ + connect(renderer: (WebGPURenderer | WebGLRenderer), camera: Camera): void; + /** + * Updates the element transforms for all registered objects. + * Call this once per frame in the animation loop. + */ + update(): void; + /** + * Disconnects this manager, clearing the renderer and camera references. + */ + disconnect(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts new file mode 100644 index 000000000..1c95f087f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts @@ -0,0 +1,26 @@ +/** + * This class can be used to render a DOM element onto a canvas and use it as a texture + * for a plane mesh. + * + * A typical use case for this class is to render the GUI of `lil-gui` as a texture so it + * is compatible for VR. + * + * ```js + * const gui = new GUI( { width: 300 } ); // create lil-gui instance + * + * const mesh = new HTMLMesh( gui.domElement ); + * scene.add( mesh ); + * ``` + * + * @augments Mesh + * @three_import import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; + */ +export class HTMLMesh extends Mesh { + /** + * Constructs a new HTML mesh. + * + * @param {HTMLElement} dom - The DOM element to display as a plane mesh. + */ + constructor(dom: HTMLElement); +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts new file mode 100644 index 000000000..f05136dc0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts @@ -0,0 +1,81 @@ +/** + * This class can be used to group 3D objects in an interactive group. + * The group itself can listen to Pointer, Mouse or XR controller events to + * detect selections of descendant 3D objects. If a 3D object is selected, + * the respective event is going to dispatched to it. + * + * ```js + * const group = new InteractiveGroup(); + * group.listenToPointerEvents( renderer, camera ); + * group.listenToXRControllerEvents( controller1 ); + * group.listenToXRControllerEvents( controller2 ); + * scene.add( group ); + * + * // now add objects that should be interactive + * group.add( mesh1, mesh2, mesh3 ); + * ``` + * @augments Group + * @three_import import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; + */ +export class InteractiveGroup extends Group { + /** + * The internal raycaster. + * + * @type {Raycaster} + */ + raycaster: Raycaster; + /** + * The internal raycaster. + * + * @type {?HTMLElement} + * @default null + */ + element: HTMLElement | null; + /** + * The camera used for raycasting. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * An array of XR controllers. + * + * @type {Array} + */ + controllers: Array; + _onPointerEvent: (event: any) => void; + _onXRControllerEvent: (event: any) => void; + onPointerEvent(event: any): void; + onXRControllerEvent(event: any): void; + /** + * Calling this method makes sure the interactive group listens to Pointer and Mouse events. + * The target is the `domElement` of the given renderer. The camera is required for the internal + * raycasting so 3D objects can be detected based on the events. + * + * @param {(WebGPURenderer|WebGLRenderer)} renderer - The renderer. + * @param {Camera} camera - The camera. + */ + listenToPointerEvents(renderer: (WebGPURenderer | WebGLRenderer), camera: Camera): void; + /** + * Disconnects this interactive group from all Pointer and Mouse Events. + */ + disconnectionPointerEvents(): void; + /** + * Calling this method makes sure the interactive group listens to events of + * the given XR controller. + * + * @param {Group} controller - The XR controller. + */ + listenToXRControllerEvents(controller: Group): void; + /** + * Disconnects this interactive group from all XR controllers. + */ + disconnectXrControllerEvents(): void; + /** + * Disconnects this interactive group from the DOM and all XR controllers. + */ + disconnect(): void; +} +import { Group } from 'three'; +import { Raycaster } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts new file mode 100644 index 000000000..7bd19c5bc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts @@ -0,0 +1,83 @@ +/** + * This class can be used to select 3D objects in a scene with a selection box. + * It is recommended to visualize the selected area with the help of {@link SelectionHelper}. + * + * ```js + * const selectionBox = new SelectionBox( camera, scene ); + * const selectedObjects = selectionBox.select( startPoint, endPoint ); + * ``` + * + * @three_import import { SelectionBox } from 'three/addons/interactive/SelectionBox.js'; + */ +export class SelectionBox { + /** + * Constructs a new selection box. + * + * @param {Camera} camera - The camera the scene is rendered with. + * @param {Scene} scene - The scene. + * @param {number} [deep=Number.MAX_VALUE] - How deep the selection frustum of perspective cameras should extend. + */ + constructor(camera: Camera, scene: Scene, deep?: number); + /** + * The camera the scene is rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * The camera the scene is rendered with. + * + * @type {Scene} + */ + scene: Scene; + /** + * The start point of the selection. + * + * @type {Vector3} + */ + startPoint: Vector3; + /** + * The end point of the selection. + * + * @type {Vector3} + */ + endPoint: Vector3; + /** + * The selected 3D objects. + * + * @type {Array} + */ + collection: Array; + /** + * The selected instance IDs of instanced meshes. + * + * @type {Object} + */ + instances: Object; + /** + * The selected batches of batched meshes. + * + * @type {Object} + */ + batches: Object; + /** + * How deep the selection frustum of perspective cameras should extend. + * + * @type {number} + * @default Number.MAX_VALUE + */ + deep: number; + /** + * This method selects 3D objects in the scene based on the given start + * and end point. If no parameters are provided, the method uses the start + * and end values of the respective members. + * + * @param {Vector3} [startPoint] - The start point. + * @param {Vector3} [endPoint] - The end point. + * @return {Array} The selected 3D objects. + */ + select(startPoint?: Vector3, endPoint?: Vector3): Array; + _updateFrustum(startPoint: any, endPoint: any): void; + _searchChildInFrustum(frustum: any, object: any): void; +} +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts new file mode 100644 index 000000000..a141857f4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts @@ -0,0 +1,2 @@ +export = BASIS; +declare function BASIS(moduleArg?: {}): Promise; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts new file mode 100644 index 000000000..5298df7f0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts @@ -0,0 +1,2 @@ +declare const _default: any; +export default _default; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts new file mode 100644 index 000000000..007913507 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts @@ -0,0 +1,8 @@ +export class MP4Demuxer { + constructor(uri: any, { onConfig, onChunk, setStatus }: { + onConfig: any; + onChunk: any; + setStatus: any; + }); + #private; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts new file mode 100644 index 000000000..8367943c4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts @@ -0,0 +1,5 @@ +export = DracoDecoderModule; +declare function DracoDecoderModule(DracoDecoderModule?: {}): any; +declare namespace DracoDecoderModule { + export { DracoDecoderModule }; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts new file mode 100644 index 000000000..e973d4a6a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts @@ -0,0 +1,5 @@ +export = DracoDecoderModule; +declare function DracoDecoderModule(n: any): any; +declare namespace DracoDecoderModule { + export { DracoDecoderModule }; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts new file mode 100644 index 000000000..8367943c4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts @@ -0,0 +1,5 @@ +export = DracoDecoderModule; +declare function DracoDecoderModule(DracoDecoderModule?: {}): any; +declare namespace DracoDecoderModule { + export { DracoDecoderModule }; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts new file mode 100644 index 000000000..e973d4a6a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts @@ -0,0 +1,5 @@ +export = DracoDecoderModule; +declare function DracoDecoderModule(n: any): any; +declare namespace DracoDecoderModule { + export { DracoDecoderModule }; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts new file mode 100644 index 000000000..092baee43 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts @@ -0,0 +1,344 @@ +export class Component { + constructor(props: any); + _pool: any; + copy(source: any): this; + clone(): any; + reset(): void; + dispose(): void; + getName(): any; + checkUndefinedAttributes(src: any): void; +} +export namespace Component { + let schema: {}; + let isComponent: boolean; + function getName(): any; +} +export function Not(Component: any): { + operator: string; + Component: any; +}; +export class ObjectPool { + constructor(T: any, initialSize: any); + freeList: any[]; + count: number; + T: any; + isObjectPool: boolean; + acquire(): any; + release(item: any): void; + expand(count: any): void; + totalSize(): number; + totalFree(): number; + totalUsed(): number; +} +export class System { + constructor(world: any, attributes: any); + canExecute(): boolean; + getName(): any; + world: any; + enabled: boolean; + _queries: {}; + queries: {}; + priority: any; + executeTime: number; + _mandatoryQueries: any[]; + initialized: boolean; + stop(): void; + play(): void; + clearEvents(): void; + toJSON(): { + name: any; + enabled: boolean; + executeTime: number; + priority: any; + queries: {}; + }; +} +export namespace System { + let isSystem: boolean; + function getName(): any; +} +export class SystemStateComponent extends Component { +} +export namespace SystemStateComponent { + let isSystemStateComponent: boolean; +} +export class TagComponent extends Component { + constructor(); +} +export namespace TagComponent { + let isTagComponent: boolean; +} +export namespace Types { + let Number: any; + let Boolean: any; + let String: any; + let Array: any; + let Ref: any; + let JSON: any; +} +export const Version: "0.3.1"; +export class World { + constructor(options?: {}); + options: { + entityPoolSize: number; + entityClass: typeof Entity; + }; + componentsManager: ComponentManager; + entityManager: EntityManager; + systemManager: SystemManager; + enabled: boolean; + eventQueues: {}; + lastTime: number; + registerComponent(Component: any, objectPool: any): this; + registerSystem(System: any, attributes: any): this; + hasRegisteredComponent(Component: any): boolean; + unregisterSystem(System: any): this; + getSystem(SystemClass: any): any; + getSystems(): any[]; + execute(delta: any, time: any): void; + stop(): void; + play(): void; + createEntity(name: any): any; + stats(): { + entities: { + numEntities: number; + numQueries: number; + queries: {}; + numComponentPool: number; + componentPool: {}; + eventDispatcher: { + fired: number; + handled: number; + }; + }; + system: { + numSystems: number; + systems: {}; + }; + }; +} +declare class Entity { + constructor(entityManager: any); + _entityManager: any; + id: number; + _ComponentTypes: any[]; + _components: {}; + _componentsToRemove: {}; + queries: any[]; + _ComponentTypesToRemove: any[]; + alive: boolean; + numStateComponents: number; + getComponent(Component: any, includeRemoved: any): any; + getRemovedComponent(Component: any): any; + getComponents(): {}; + getComponentsToRemove(): {}; + getComponentTypes(): any[]; + getMutableComponent(Component: any): any; + addComponent(Component: any, values: any): this; + removeComponent(Component: any, forceImmediate: any): this; + hasComponent(Component: any, includeRemoved: any): boolean; + hasRemovedComponent(Component: any): boolean; + hasAllComponents(Components: any): boolean; + hasAnyComponents(Components: any): boolean; + removeAllComponents(forceImmediate: any): any; + copy(src: any): this; + clone(): Entity; + reset(): void; + remove(forceImmediate: any): any; +} +export function cloneArray(src: any): any; +export function cloneClonable(src: any): any; +export function cloneJSON(src: any): any; +export function cloneValue(src: any): any; +export function copyArray(src: any, dest: any): any; +export function copyCopyable(src: any, dest: any): any; +export function copyJSON(src: any): any; +export function copyValue(src: any): any; +export function createType(typeDefinition: any): any; +export function enableRemoteDevtools(remoteId: any): void; +declare class ComponentManager { + Components: any[]; + _ComponentsMap: {}; + _componentPool: {}; + numComponents: {}; + nextComponentId: number; + hasComponent(Component: any): boolean; + registerComponent(Component: any, objectPool: any): void; + componentAddedToEntity(Component: any): void; + componentRemovedFromEntity(Component: any): void; + getComponentsPool(Component: any): any; +} +/** + * @private + * @class EntityManager + */ +declare class EntityManager { + constructor(world: any); + world: any; + componentsManager: any; + _entities: any[]; + _nextEntityId: number; + _entitiesByNames: {}; + _queryManager: QueryManager; + eventDispatcher: EventDispatcher; + _entityPool: EntityPool; + entitiesWithComponentsToRemove: any[]; + entitiesToRemove: any[]; + deferredRemovalEnabled: boolean; + getEntityByName(name: any): any; + /** + * Create a new entity + */ + createEntity(name: any): any; + /** + * Add a component to an entity + * @param {Entity} entity Entity where the component will be added + * @param {Component} Component Component to be added to the entity + * @param {Object} values Optional values to replace the default attributes + */ + entityAddComponent(entity: Entity, Component: Component, values: Object): void; + /** + * Remove a component from an entity + * @param {Entity} entity Entity which will get removed the component + * @param {*} Component Component to remove from the entity + * @param {Bool} immediately If you want to remove the component immediately instead of deferred (Default is false) + */ + entityRemoveComponent(entity: Entity, Component: any, immediately: Bool): void; + _entityRemoveComponentSync(entity: any, Component: any, index: any): void; + /** + * Remove all the components from an entity + * @param {Entity} entity Entity from which the components will be removed + */ + entityRemoveAllComponents(entity: Entity, immediately: any): void; + /** + * Remove the entity from this manager. It will clear also its components + * @param {Entity} entity Entity to remove from the manager + * @param {Bool} immediately If you want to remove the component immediately instead of deferred (Default is false) + */ + removeEntity(entity: Entity, immediately: Bool): void; + _releaseEntity(entity: any, index: any): void; + /** + * Remove all entities from this manager + */ + removeAllEntities(): void; + processDeferredRemoval(): void; + /** + * Get a query based on a list of components + * @param {Array(Component)} Components List of components that will form the query + */ + queryComponents(Components: any): any; + /** + * Return number of entities + */ + count(): number; + /** + * Return some stats + */ + stats(): { + numEntities: number; + numQueries: number; + queries: {}; + numComponentPool: number; + componentPool: {}; + eventDispatcher: { + fired: number; + handled: number; + }; + }; +} +declare class SystemManager { + constructor(world: any); + _systems: any[]; + _executeSystems: any[]; + world: any; + lastExecutedSystem: any; + registerSystem(SystemClass: any, attributes: any): this; + unregisterSystem(SystemClass: any): this; + sortSystems(): void; + getSystem(SystemClass: any): any; + getSystems(): any[]; + removeSystem(SystemClass: any): void; + executeSystem(system: any, delta: any, time: any): void; + stop(): void; + execute(delta: any, time: any, forcePlay: any): void; + stats(): { + numSystems: number; + systems: {}; + }; +} +/** + * @private + * @class QueryManager + */ +declare class QueryManager { + constructor(world: any); + _world: any; + _queries: {}; + onEntityRemoved(entity: any): void; + /** + * Callback when a component is added to an entity + * @param {Entity} entity Entity that just got the new component + * @param {Component} Component Component added to the entity + */ + onEntityComponentAdded(entity: Entity, Component: Component): void; + /** + * Callback when a component is removed from an entity + * @param {Entity} entity Entity to remove the component from + * @param {Component} Component Component to remove from the entity + */ + onEntityComponentRemoved(entity: Entity, Component: Component): void; + /** + * Get a query for the specified components + * @param {Component} Components Components that the query should have + */ + getQuery(Components: Component): any; + /** + * Return some stats from this class + */ + stats(): {}; +} +/** + * @private + * @class EventDispatcher + */ +declare class EventDispatcher { + _listeners: {}; + stats: { + fired: number; + handled: number; + }; + /** + * Add an event listener + * @param {String} eventName Name of the event to listen + * @param {Function} listener Callback to trigger when the event is fired + */ + addEventListener(eventName: string, listener: Function): void; + /** + * Check if an event listener is already added to the list of listeners + * @param {String} eventName Name of the event to check + * @param {Function} listener Callback for the specified event + */ + hasEventListener(eventName: string, listener: Function): boolean; + /** + * Remove an event listener + * @param {String} eventName Name of the event to remove + * @param {Function} listener Callback for the specified event + */ + removeEventListener(eventName: string, listener: Function): void; + /** + * Dispatch an event + * @param {String} eventName Name of the event to dispatch + * @param {Entity} entity (Optional) Entity to emit + * @param {Component} component + */ + dispatchEvent(eventName: string, entity: Entity, component: Component): void; + /** + * Reset stats counters + */ + resetCounters(): void; +} +declare class EntityPool extends ObjectPool { + constructor(entityManager: any, entityClass: any, initialSize: any); + entityManager: any; +} +export { Entity as _Entity }; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts new file mode 100644 index 000000000..40983ceda --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts @@ -0,0 +1,299 @@ +declare const Z: 15; +declare const q: 2; +declare const Q: 14; +declare const G: 1; +declare const R: 0; +declare const J: 13; +declare const u: 1; +declare const _: 0; +declare const s: 0; +declare const U: 162; +declare const f: 160; +declare const h: 163; +declare const c: 161; +declare const l: 1; +declare const p: 166; +declare const o: 0; +declare const H: 6; +declare const z: 7; +declare const Y: 11; +declare const N: 4; +declare const P: 2; +declare const M: 3; +declare const E: 1; +declare const W: 5; +declare const X: 10; +declare const j: 8; +declare const K: 9; +declare const S: 0; +declare const et: 32; +declare const $: 128; +declare const nt: 16; +declare const tt: 64; +declare const F: 16; +declare const O: 17; +declare const T: 18; +declare const w: 7; +declare const k: 12; +declare const B: 9; +declare const v: 8; +declare const b: 3; +declare const x: 1; +declare const m: 4; +declare const V: 14; +declare const I: 13; +declare const L: 10; +declare const A: 11; +declare const d: 5; +declare const D: 6; +declare const y: 2; +declare const C: 15; +declare const g: 0; +declare const a: 0; +declare const r: 2; +declare const e: 1; +declare const t: 0; +declare const i: 3; +declare const n: 2; +declare const Ut: 8; +declare const qt: 69; +declare const Rt: 65; +declare const Gt: 68; +declare const Yt: 64; +declare const Xt: 63; +declare const jt: 59; +declare const Kt: 62; +declare const zt: 58; +declare const Ii: 1000340001; +declare const ki: 1000340000; +declare const Bi: 1000066011; +declare const Xn: 180; +declare const Kn: 179; +declare const Di: 1000066008; +declare const Nn: 174; +declare const Mn: 173; +declare const wi: 1000066009; +declare const Hn: 176; +declare const Wn: 175; +declare const vi: 1000066010; +declare const jn: 178; +declare const zn: 177; +declare const Li: 1000066012; +declare const Rn: 182; +declare const Yn: 181; +declare const Ai: 1000066013; +declare const qn: 184; +declare const Gn: 183; +declare const _i: 1000066000; +declare const wn: 158; +declare const Dn: 157; +declare const ui: 1000066001; +declare const Bn: 160; +declare const vn: 159; +declare const gi: 1000066002; +declare const An: 162; +declare const Ln: 161; +declare const xi: 1000066003; +declare const In: 164; +declare const kn: 163; +declare const yi: 1000066004; +declare const Cn: 166; +declare const Vn: 165; +declare const bi: 1000066005; +declare const On: 168; +declare const Fn: 167; +declare const mi: 1000066006; +declare const Sn: 170; +declare const Tn: 169; +declare const di: 1000066007; +declare const Pn: 172; +declare const En: 171; +declare const We: 122; +declare const ti: 1000156011; +declare const ai: 1000156021; +declare const rt: 3; +declare const ct: 7; +declare const lt: 5; +declare const Wt: 49; +declare const Mt: 45; +declare const Ht: 50; +declare const Nt: 48; +declare const Pt: 44; +declare const Vt: 35; +declare const kt: 31; +declare const Ct: 36; +declare const It: 34; +declare const At: 30; +declare const Ze: 134; +declare const Qe: 133; +declare const Je: 132; +declare const qe: 131; +declare const tn: 136; +declare const $e: 135; +declare const nn: 138; +declare const en: 137; +declare const an: 140; +declare const sn: 139; +declare const on: 142; +declare const rn: 141; +declare const fn: 144; +declare const ln: 143; +declare const Un: 146; +declare const cn: 145; +declare const ze: 124; +declare const Ye: 128; +declare const Re: 129; +declare const Ke: 126; +declare const Ge: 130; +declare const He: 123; +declare const dn: 156; +declare const mn: 155; +declare const bn: 154; +declare const yn: 153; +declare const un: 150; +declare const _n: 149; +declare const xn: 152; +declare const gn: 151; +declare const pn: 148; +declare const hn: 147; +declare const $n: 1000156010; +declare const si: 1000156020; +declare const ci: 1000054004; +declare const ri: 1000054000; +declare const Ui: 1000054005; +declare const oi: 1000054001; +declare const hi: 1000054006; +declare const li: 1000054002; +declare const pi: 1000054007; +declare const fi: 1000054003; +declare const Zn: 1000156009; +declare const Qn: 1000156008; +declare const Jn: 1000156007; +declare const ii: 1000156019; +declare const ni: 1000156018; +declare const ei: 1000156017; +declare const ue: 97; +declare const _e: 96; +declare const he: 92; +declare const pe: 95; +declare const Ue: 91; +declare const ce: 90; +declare const fe: 89; +declare const oe: 85; +declare const le: 88; +declare const re: 84; +declare const ae: 83; +declare const se: 82; +declare const ne: 78; +declare const ie: 81; +declare const ee: 77; +declare const te: 76; +declare const $t: 75; +declare const Qt: 71; +declare const Zt: 74; +declare const Jt: 70; +declare const Ae: 109; +declare const Le: 108; +declare const Be: 107; +declare const ve: 106; +declare const we: 105; +declare const De: 104; +declare const de: 103; +declare const me: 102; +declare const be: 101; +declare const ye: 100; +declare const xe: 99; +declare const ge: 98; +declare const at: 2; +declare const st: 1; +declare const ft: 6; +declare const ot: 4; +declare const Ne: 121; +declare const Me: 120; +declare const Pe: 119; +declare const Ee: 118; +declare const Se: 117; +declare const Te: 116; +declare const Oe: 115; +declare const Fe: 114; +declare const Ce: 113; +declare const Ve: 112; +declare const Ie: 111; +declare const ke: 110; +declare const St: 42; +declare const Ot: 38; +declare const Et: 43; +declare const Tt: 41; +declare const Ft: 37; +declare const Bt: 28; +declare const wt: 24; +declare const Lt: 29; +declare const vt: 27; +declare const Dt: 23; +declare const mt: 21; +declare const yt: 17; +declare const dt: 22; +declare const bt: 20; +declare const xt: 16; +declare const ut: 14; +declare const pt: 10; +declare const gt: 15; +declare const _t: 13; +declare const ht: 9; +declare const Xe: 127; +declare const it: 0; +declare const je: 125; +declare function Vi(): { + vkFormat: number; + typeSize: number; + pixelWidth: number; + pixelHeight: number; + pixelDepth: number; + layerCount: number; + faceCount: number; + levelCount: number; + supercompressionScheme: number; + levels: never[]; + dataFormatDescriptor: { + vendorId: number; + descriptorType: number; + versionNumber: number; + colorModel: number; + colorPrimaries: number; + transferFunction: number; + flags: number; + texelBlockDimension: number[]; + bytesPlane: number[]; + samples: never[]; + }[]; + keyValue: {}; + globalData: null; +}; +declare function Mi(t: any): { + vkFormat: number; + typeSize: number; + pixelWidth: number; + pixelHeight: number; + pixelDepth: number; + layerCount: number; + faceCount: number; + levelCount: number; + supercompressionScheme: number; + levels: never[]; + dataFormatDescriptor: { + vendorId: number; + descriptorType: number; + versionNumber: number; + colorModel: number; + colorPrimaries: number; + transferFunction: number; + flags: number; + texelBlockDimension: number[]; + bytesPlane: number[]; + samples: never[]; + }[]; + keyValue: {}; + globalData: null; +}; +declare function Hi(t: any, e?: {}): Uint8Array; +export { Z as KHR_DF_CHANNEL_RGBSDA_ALPHA, q as KHR_DF_CHANNEL_RGBSDA_BLUE, Q as KHR_DF_CHANNEL_RGBSDA_DEPTH, G as KHR_DF_CHANNEL_RGBSDA_GREEN, R as KHR_DF_CHANNEL_RGBSDA_RED, J as KHR_DF_CHANNEL_RGBSDA_STENCIL, u as KHR_DF_FLAG_ALPHA_PREMULTIPLIED, _ as KHR_DF_FLAG_ALPHA_STRAIGHT, s as KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT, U as KHR_DF_MODEL_ASTC, f as KHR_DF_MODEL_ETC1, h as KHR_DF_MODEL_ETC1S, c as KHR_DF_MODEL_ETC2, l as KHR_DF_MODEL_RGBSDA, p as KHR_DF_MODEL_UASTC, o as KHR_DF_MODEL_UNSPECIFIED, H as KHR_DF_PRIMARIES_ACES, z as KHR_DF_PRIMARIES_ACESCC, Y as KHR_DF_PRIMARIES_ADOBERGB, N as KHR_DF_PRIMARIES_BT2020, P as KHR_DF_PRIMARIES_BT601_EBU, M as KHR_DF_PRIMARIES_BT601_SMPTE, E as KHR_DF_PRIMARIES_BT709, W as KHR_DF_PRIMARIES_CIEXYZ, X as KHR_DF_PRIMARIES_DISPLAYP3, j as KHR_DF_PRIMARIES_NTSC1953, K as KHR_DF_PRIMARIES_PAL525, S as KHR_DF_PRIMARIES_UNSPECIFIED, et as KHR_DF_SAMPLE_DATATYPE_EXPONENT, $ as KHR_DF_SAMPLE_DATATYPE_FLOAT, nt as KHR_DF_SAMPLE_DATATYPE_LINEAR, tt as KHR_DF_SAMPLE_DATATYPE_SIGNED, F as KHR_DF_TRANSFER_ACESCC, O as KHR_DF_TRANSFER_ACESCCT, T as KHR_DF_TRANSFER_ADOBERGB, w as KHR_DF_TRANSFER_BT1886, k as KHR_DF_TRANSFER_DCIP3, B as KHR_DF_TRANSFER_HLG_EOTF, v as KHR_DF_TRANSFER_HLG_OETF, b as KHR_DF_TRANSFER_ITU, x as KHR_DF_TRANSFER_LINEAR, m as KHR_DF_TRANSFER_NTSC, V as KHR_DF_TRANSFER_PAL625_EOTF, I as KHR_DF_TRANSFER_PAL_OETF, L as KHR_DF_TRANSFER_PQ_EOTF, A as KHR_DF_TRANSFER_PQ_OETF, d as KHR_DF_TRANSFER_SLOG, D as KHR_DF_TRANSFER_SLOG2, y as KHR_DF_TRANSFER_SRGB, C as KHR_DF_TRANSFER_ST240, g as KHR_DF_TRANSFER_UNSPECIFIED, a as KHR_DF_VENDORID_KHRONOS, r as KHR_DF_VERSION, e as KHR_SUPERCOMPRESSION_BASISLZ, t as KHR_SUPERCOMPRESSION_NONE, i as KHR_SUPERCOMPRESSION_ZLIB, n as KHR_SUPERCOMPRESSION_ZSTD, Ut as VK_FORMAT_A1R5G5B5_UNORM_PACK16, qt as VK_FORMAT_A2B10G10R10_SINT_PACK32, Rt as VK_FORMAT_A2B10G10R10_SNORM_PACK32, Gt as VK_FORMAT_A2B10G10R10_UINT_PACK32, Yt as VK_FORMAT_A2B10G10R10_UNORM_PACK32, Xt as VK_FORMAT_A2R10G10B10_SINT_PACK32, jt as VK_FORMAT_A2R10G10B10_SNORM_PACK32, Kt as VK_FORMAT_A2R10G10B10_UINT_PACK32, zt as VK_FORMAT_A2R10G10B10_UNORM_PACK32, Ii as VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT, ki as VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT, Bi as VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT, Xn as VK_FORMAT_ASTC_10x10_SRGB_BLOCK, Kn as VK_FORMAT_ASTC_10x10_UNORM_BLOCK, Di as VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT, Nn as VK_FORMAT_ASTC_10x5_SRGB_BLOCK, Mn as VK_FORMAT_ASTC_10x5_UNORM_BLOCK, wi as VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT, Hn as VK_FORMAT_ASTC_10x6_SRGB_BLOCK, Wn as VK_FORMAT_ASTC_10x6_UNORM_BLOCK, vi as VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT, jn as VK_FORMAT_ASTC_10x8_SRGB_BLOCK, zn as VK_FORMAT_ASTC_10x8_UNORM_BLOCK, Li as VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT, Rn as VK_FORMAT_ASTC_12x10_SRGB_BLOCK, Yn as VK_FORMAT_ASTC_12x10_UNORM_BLOCK, Ai as VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT, qn as VK_FORMAT_ASTC_12x12_SRGB_BLOCK, Gn as VK_FORMAT_ASTC_12x12_UNORM_BLOCK, _i as VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT, wn as VK_FORMAT_ASTC_4x4_SRGB_BLOCK, Dn as VK_FORMAT_ASTC_4x4_UNORM_BLOCK, ui as VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT, Bn as VK_FORMAT_ASTC_5x4_SRGB_BLOCK, vn as VK_FORMAT_ASTC_5x4_UNORM_BLOCK, gi as VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT, An as VK_FORMAT_ASTC_5x5_SRGB_BLOCK, Ln as VK_FORMAT_ASTC_5x5_UNORM_BLOCK, xi as VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT, In as VK_FORMAT_ASTC_6x5_SRGB_BLOCK, kn as VK_FORMAT_ASTC_6x5_UNORM_BLOCK, yi as VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT, Cn as VK_FORMAT_ASTC_6x6_SRGB_BLOCK, Vn as VK_FORMAT_ASTC_6x6_UNORM_BLOCK, bi as VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT, On as VK_FORMAT_ASTC_8x5_SRGB_BLOCK, Fn as VK_FORMAT_ASTC_8x5_UNORM_BLOCK, mi as VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT, Sn as VK_FORMAT_ASTC_8x6_SRGB_BLOCK, Tn as VK_FORMAT_ASTC_8x6_UNORM_BLOCK, di as VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT, Pn as VK_FORMAT_ASTC_8x8_SRGB_BLOCK, En as VK_FORMAT_ASTC_8x8_UNORM_BLOCK, We as VK_FORMAT_B10G11R11_UFLOAT_PACK32, ti as VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16, ai as VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16, rt as VK_FORMAT_B4G4R4A4_UNORM_PACK16, ct as VK_FORMAT_B5G5R5A1_UNORM_PACK16, lt as VK_FORMAT_B5G6R5_UNORM_PACK16, Wt as VK_FORMAT_B8G8R8A8_SINT, Mt as VK_FORMAT_B8G8R8A8_SNORM, Ht as VK_FORMAT_B8G8R8A8_SRGB, Nt as VK_FORMAT_B8G8R8A8_UINT, Pt as VK_FORMAT_B8G8R8A8_UNORM, Vt as VK_FORMAT_B8G8R8_SINT, kt as VK_FORMAT_B8G8R8_SNORM, Ct as VK_FORMAT_B8G8R8_SRGB, It as VK_FORMAT_B8G8R8_UINT, At as VK_FORMAT_B8G8R8_UNORM, Ze as VK_FORMAT_BC1_RGBA_SRGB_BLOCK, Qe as VK_FORMAT_BC1_RGBA_UNORM_BLOCK, Je as VK_FORMAT_BC1_RGB_SRGB_BLOCK, qe as VK_FORMAT_BC1_RGB_UNORM_BLOCK, tn as VK_FORMAT_BC2_SRGB_BLOCK, $e as VK_FORMAT_BC2_UNORM_BLOCK, nn as VK_FORMAT_BC3_SRGB_BLOCK, en as VK_FORMAT_BC3_UNORM_BLOCK, an as VK_FORMAT_BC4_SNORM_BLOCK, sn as VK_FORMAT_BC4_UNORM_BLOCK, on as VK_FORMAT_BC5_SNORM_BLOCK, rn as VK_FORMAT_BC5_UNORM_BLOCK, fn as VK_FORMAT_BC6H_SFLOAT_BLOCK, ln as VK_FORMAT_BC6H_UFLOAT_BLOCK, Un as VK_FORMAT_BC7_SRGB_BLOCK, cn as VK_FORMAT_BC7_UNORM_BLOCK, ze as VK_FORMAT_D16_UNORM, Ye as VK_FORMAT_D16_UNORM_S8_UINT, Re as VK_FORMAT_D24_UNORM_S8_UINT, Ke as VK_FORMAT_D32_SFLOAT, Ge as VK_FORMAT_D32_SFLOAT_S8_UINT, He as VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, dn as VK_FORMAT_EAC_R11G11_SNORM_BLOCK, mn as VK_FORMAT_EAC_R11G11_UNORM_BLOCK, bn as VK_FORMAT_EAC_R11_SNORM_BLOCK, yn as VK_FORMAT_EAC_R11_UNORM_BLOCK, un as VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK, _n as VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK, xn as VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK, gn as VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, pn as VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, hn as VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, $n as VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16, si as VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16, ci as VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG, ri as VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG, Ui as VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG, oi as VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG, hi as VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG, li as VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG, pi as VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG, fi as VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG, Zn as VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16, Qn as VK_FORMAT_R10X6G10X6_UNORM_2PACK16, Jn as VK_FORMAT_R10X6_UNORM_PACK16, ii as VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16, ni as VK_FORMAT_R12X4G12X4_UNORM_2PACK16, ei as VK_FORMAT_R12X4_UNORM_PACK16, ue as VK_FORMAT_R16G16B16A16_SFLOAT, _e as VK_FORMAT_R16G16B16A16_SINT, he as VK_FORMAT_R16G16B16A16_SNORM, pe as VK_FORMAT_R16G16B16A16_UINT, Ue as VK_FORMAT_R16G16B16A16_UNORM, ce as VK_FORMAT_R16G16B16_SFLOAT, fe as VK_FORMAT_R16G16B16_SINT, oe as VK_FORMAT_R16G16B16_SNORM, le as VK_FORMAT_R16G16B16_UINT, re as VK_FORMAT_R16G16B16_UNORM, ae as VK_FORMAT_R16G16_SFLOAT, se as VK_FORMAT_R16G16_SINT, ne as VK_FORMAT_R16G16_SNORM, ie as VK_FORMAT_R16G16_UINT, ee as VK_FORMAT_R16G16_UNORM, te as VK_FORMAT_R16_SFLOAT, $t as VK_FORMAT_R16_SINT, Qt as VK_FORMAT_R16_SNORM, Zt as VK_FORMAT_R16_UINT, Jt as VK_FORMAT_R16_UNORM, Ae as VK_FORMAT_R32G32B32A32_SFLOAT, Le as VK_FORMAT_R32G32B32A32_SINT, Be as VK_FORMAT_R32G32B32A32_UINT, ve as VK_FORMAT_R32G32B32_SFLOAT, we as VK_FORMAT_R32G32B32_SINT, De as VK_FORMAT_R32G32B32_UINT, de as VK_FORMAT_R32G32_SFLOAT, me as VK_FORMAT_R32G32_SINT, be as VK_FORMAT_R32G32_UINT, ye as VK_FORMAT_R32_SFLOAT, xe as VK_FORMAT_R32_SINT, ge as VK_FORMAT_R32_UINT, at as VK_FORMAT_R4G4B4A4_UNORM_PACK16, st as VK_FORMAT_R4G4_UNORM_PACK8, ft as VK_FORMAT_R5G5B5A1_UNORM_PACK16, ot as VK_FORMAT_R5G6B5_UNORM_PACK16, Ne as VK_FORMAT_R64G64B64A64_SFLOAT, Me as VK_FORMAT_R64G64B64A64_SINT, Pe as VK_FORMAT_R64G64B64A64_UINT, Ee as VK_FORMAT_R64G64B64_SFLOAT, Se as VK_FORMAT_R64G64B64_SINT, Te as VK_FORMAT_R64G64B64_UINT, Oe as VK_FORMAT_R64G64_SFLOAT, Fe as VK_FORMAT_R64G64_SINT, Ce as VK_FORMAT_R64G64_UINT, Ve as VK_FORMAT_R64_SFLOAT, Ie as VK_FORMAT_R64_SINT, ke as VK_FORMAT_R64_UINT, St as VK_FORMAT_R8G8B8A8_SINT, Ot as VK_FORMAT_R8G8B8A8_SNORM, Et as VK_FORMAT_R8G8B8A8_SRGB, Tt as VK_FORMAT_R8G8B8A8_UINT, Ft as VK_FORMAT_R8G8B8A8_UNORM, Bt as VK_FORMAT_R8G8B8_SINT, wt as VK_FORMAT_R8G8B8_SNORM, Lt as VK_FORMAT_R8G8B8_SRGB, vt as VK_FORMAT_R8G8B8_UINT, Dt as VK_FORMAT_R8G8B8_UNORM, mt as VK_FORMAT_R8G8_SINT, yt as VK_FORMAT_R8G8_SNORM, dt as VK_FORMAT_R8G8_SRGB, bt as VK_FORMAT_R8G8_UINT, xt as VK_FORMAT_R8G8_UNORM, ut as VK_FORMAT_R8_SINT, pt as VK_FORMAT_R8_SNORM, gt as VK_FORMAT_R8_SRGB, _t as VK_FORMAT_R8_UINT, ht as VK_FORMAT_R8_UNORM, Xe as VK_FORMAT_S8_UINT, it as VK_FORMAT_UNDEFINED, je as VK_FORMAT_X8_D24_UNORM_PACK32, Vi as createDefaultContainer, Mi as read, Hi as write }; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts new file mode 100644 index 000000000..2a69ddc7e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts @@ -0,0 +1,77 @@ +export var MeshoptClusterizer: { + supported: boolean; + ready?: undefined; + buildMeshlets?: undefined; + buildMeshletsFlex?: undefined; + buildMeshletsSpatial?: undefined; + extractMeshlet?: undefined; + encodeMeshlet?: undefined; + computeClusterBounds?: undefined; + computeMeshletBounds?: undefined; + computeSphereBounds?: undefined; +} | { + ready: Promise; + supported: boolean; + buildMeshlets: (indices: any, vertex_positions: any, vertex_positions_stride: any, max_vertices: any, max_triangles: any, cone_weight: any) => { + meshlets: Uint32Array; + vertices: Uint32Array; + triangles: Uint8Array; + meshletCount: any; + }; + buildMeshletsFlex: (indices: any, vertex_positions: any, vertex_positions_stride: any, max_vertices: any, min_triangles: any, max_triangles: any, cone_weight: any, split_factor: any) => { + meshlets: Uint32Array; + vertices: Uint32Array; + triangles: Uint8Array; + meshletCount: any; + }; + buildMeshletsSpatial: (indices: any, vertex_positions: any, vertex_positions_stride: any, max_vertices: any, min_triangles: any, max_triangles: any, fill_weight: any) => { + meshlets: Uint32Array; + vertices: Uint32Array; + triangles: Uint8Array; + meshletCount: any; + }; + extractMeshlet: (buffers: any, index: any) => { + vertices: any; + triangles: any; + }; + encodeMeshlet: (vertices: any, triangles: any, level: any) => Uint8Array; + computeClusterBounds: (indices: any, vertex_positions: any, vertex_positions_stride: any) => { + centerX: number; + centerY: number; + centerZ: number; + radius: number; + coneApexX: number; + coneApexY: number; + coneApexZ: number; + coneAxisX: number; + coneAxisY: number; + coneAxisZ: number; + coneCutoff: number; + }; + computeMeshletBounds: (buffers: any, vertex_positions: any, vertex_positions_stride: any) => { + centerX: number; + centerY: number; + centerZ: number; + radius: number; + coneApexX: number; + coneApexY: number; + coneApexZ: number; + coneAxisX: number; + coneAxisY: number; + coneAxisZ: number; + coneCutoff: number; + }[]; + computeSphereBounds: (positions: any, positions_stride: any, radii: any, radii_stride: any) => { + centerX: number; + centerY: number; + centerZ: number; + radius: number; + coneApexX: number; + coneApexY: number; + coneApexZ: number; + coneAxisX: number; + coneAxisY: number; + coneAxisZ: number; + coneCutoff: number; + }; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts new file mode 100644 index 000000000..a2637cd13 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts @@ -0,0 +1,19 @@ +export var MeshoptDecoder: { + supported: boolean; + ready?: undefined; + useWorkers?: undefined; + decodeVertexBuffer?: undefined; + decodeIndexBuffer?: undefined; + decodeIndexSequence?: undefined; + decodeGltfBuffer?: undefined; + decodeGltfBufferAsync?: undefined; +} | { + ready: Promise; + supported: boolean; + useWorkers: (count: any) => void; + decodeVertexBuffer: (target: any, count: any, size: any, source: any, filter: any) => void; + decodeIndexBuffer: (target: any, count: any, size: any, source: any) => void; + decodeIndexSequence: (target: any, count: any, size: any, source: any) => void; + decodeGltfBuffer: (target: any, count: any, size: any, source: any, mode: any, filter: any) => void; + decodeGltfBufferAsync: (count: any, size: any, source: any, mode: any, filter: any) => Promise; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts new file mode 100644 index 000000000..307df7a41 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts @@ -0,0 +1,25 @@ +export var MeshoptSimplifier: { + supported: boolean; + ready?: undefined; + compactMesh?: undefined; + generatePositionRemap?: undefined; + simplify?: undefined; + simplifyWithAttributes?: undefined; + simplifyWithUpdate?: undefined; + getScale?: undefined; + simplifyPoints?: undefined; + simplifySloppy?: undefined; + simplifyPrune?: undefined; +} | { + ready: Promise; + supported: boolean; + compactMesh: (indices: any) => any[]; + generatePositionRemap: (vertex_positions: any, vertex_positions_stride: any) => Uint32Array; + simplify: (indices: any, vertex_positions: any, vertex_positions_stride: any, target_index_count: any, target_error: any, flags: any) => (number | Uint32Array)[]; + simplifyWithAttributes: (indices: any, vertex_positions: any, vertex_positions_stride: any, vertex_attributes: any, vertex_attributes_stride: any, attribute_weights: any, vertex_lock: any, target_index_count: any, target_error: any, flags: any) => (number | Uint32Array)[]; + simplifyWithUpdate: (indices: any, vertex_positions: any, vertex_positions_stride: any, vertex_attributes: any, vertex_attributes_stride: any, attribute_weights: any, vertex_lock: any, target_index_count: any, target_error: any, flags: any) => any[]; + getScale: (vertex_positions: any, vertex_positions_stride: any) => any; + simplifyPoints: (vertex_positions: any, vertex_positions_stride: any, target_vertex_count: any, vertex_colors: any, vertex_colors_stride: any, color_weight: any) => Uint32Array; + simplifySloppy: (indices: any, vertex_positions: any, vertex_positions_stride: any, vertex_lock: any, target_index_count: any, target_error: any) => (number | Uint32Array)[]; + simplifyPrune: (indices: any, vertex_positions: any, vertex_positions_stride: any, target_error: any) => Uint32Array; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts new file mode 100644 index 000000000..8bee20d6e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts @@ -0,0 +1,16 @@ +/** +* Generates vertex tangents for the given position/normal/texcoord attributes. +* @param {Float32Array} position +* @param {Float32Array} normal +* @param {Float32Array} texcoord +* @returns {Float32Array} +*/ +export function generateTangents(position: Float32Array, normal: Float32Array, texcoord: Float32Array): Float32Array; +export function dispose(): void; +export function __wbindgen_string_new(arg0: any, arg1: any): number; +export function __wbindgen_rethrow(arg0: any): never; +export let wasm: any; +export let isReady: boolean; +export namespace ready { + function then(onFulfilled: any, onRejected: any): any; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts new file mode 100644 index 000000000..105f5023d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts @@ -0,0 +1,64 @@ +export namespace Constants { + let Handedness: Readonly<{ + NONE: "none"; + LEFT: "left"; + RIGHT: "right"; + }>; + let ComponentState: Readonly<{ + DEFAULT: "default"; + TOUCHED: "touched"; + PRESSED: "pressed"; + }>; + let ComponentProperty: Readonly<{ + BUTTON: "button"; + X_AXIS: "xAxis"; + Y_AXIS: "yAxis"; + STATE: "state"; + }>; + let ComponentType: Readonly<{ + TRIGGER: "trigger"; + SQUEEZE: "squeeze"; + TOUCHPAD: "touchpad"; + THUMBSTICK: "thumbstick"; + BUTTON: "button"; + }>; + let ButtonTouchThreshold: number; + let AxisTouchThreshold: number; + let VisualResponseProperty: Readonly<{ + TRANSFORM: "transform"; + VISIBILITY: "visibility"; + }>; +} +/** + * @description Builds a motion controller with components and visual responses based on the + * supplied profile description. Data is polled from the xrInputSource's gamepad. + * @author Nell Waliczek / https://github.com/NellWaliczek +*/ +export class MotionController { + /** + * @param {Object} xrInputSource - The XRInputSource to build the MotionController around + * @param {Object} profile - The best matched profile description for the supplied xrInputSource + * @param {string} assetUrl + */ + constructor(xrInputSource: Object, profile: Object, assetUrl: string); + xrInputSource: Object; + assetUrl: string; + id: any; + layoutDescription: any; + components: {}; + get gripSpace(): any; + get targetRaySpace(): any; + /** + * @description Returns a subset of component data for simplified debugging + */ + get data(): any[]; + /** + * @description Poll for updated data based on current gamepad state + */ + updateFromGamepad(): void; +} +export function fetchProfile(xrInputSource: any, basePath: any, defaultProfile?: null, getAssetPath?: boolean): Promise<{ + profile: any; + assetPath: string | undefined; +}>; +export function fetchProfilesList(basePath: any): Promise; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts new file mode 100644 index 000000000..2830d6809 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts @@ -0,0 +1,34 @@ +/** + * potpack - by [@mourner](https://github.com/mourner) + * + * A tiny JavaScript function for packing 2D rectangles into a near-square container, + * which is useful for generating CSS sprites and WebGL textures. Similar to + * [shelf-pack](https://github.com/mapbox/shelf-pack), but static (you can't add items + * once a layout is generated), and aims for maximal space utilization. + * + * A variation of algorithms used in [rectpack2D](https://github.com/TeamHypersomnia/rectpack2D) + * and [bin-pack](https://github.com/bryanburgers/bin-pack), which are in turn based + * on [this article by Blackpawn](http://blackpawn.com/texts/lightmaps/default.html). + * + * @license + * ISC License + * + * Copyright (c) 2018, Mapbox + * + * Permission to use, copy, modify, and/or distribute this software for any purpose + * with or without fee is hereby granted, provided that the above copyright notice + * and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF + * THIS SOFTWARE. + */ +export function potpack(boxes: any): { + w: number; + h: number; + fill: number; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts new file mode 100644 index 000000000..aeae725f1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts @@ -0,0 +1,18 @@ +export default Stats; +declare function Stats(): { + REVISION: number; + dom: HTMLDivElement; + addPanel: (panel: any) => any; + showPanel: (id: any) => void; + begin: () => void; + end: () => number; + update: () => void; + domElement: HTMLDivElement; + setMode: (id: any) => void; +}; +declare namespace Stats { + function Panel(name: any, fg: any, bg: any): { + dom: HTMLCanvasElement; + update: (value: any, maxValue: any) => void; + }; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts new file mode 100644 index 000000000..4c6302df7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts @@ -0,0 +1,15 @@ +/** + * SurfaceNets in JavaScript + * + * Written by Mikola Lysenko (C) 2012 + * + * MIT License + * + * Based on: S.F. Gibson, 'Constrained Elastic Surface Nets'. (1998) MERL Tech Report. + * from https://github.com/mikolalysenko/isosurface/tree/master + * + */ +export function surfaceNet(dims: any, potential: any, bounds: any): { + positions: number[][]; + cells: any[][]; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts new file mode 100644 index 000000000..d3233f736 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts @@ -0,0 +1,156 @@ +export default UTIF; +declare namespace UTIF { + function encodeImage(rgba: any, w: any, h: any, metadata: any): ArrayBuffer; + function encode(ifds: any): ArrayBuffer; + function decode(buff: any, prm: any): any[]; + namespace decode { + function _decompress(img: any, ifds: any, data: any, off: any, len: any, cmpr: any, tgt: any, toff: any, fo: any, w: any, h: any): void; + function _decodePanasonic(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; + function _decodeVC5(t: any, E: any, h: any, L: any, g: any, n: any): void; + function _decodeLogLuv32(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; + function _ljpeg_diff(data: any, prm: any, huff: any): number; + function _decodeARW(img: any, inp: any, off: any, src_length: any, tgt: any, toff: any): void; + function _decodeNikon(img: any, imgs: any, data: any, off: any, src_length: any, tgt: any, toff: any): void; + function _putsF(dt: any, pos: any, val: any): void; + function _getbithuff(data: any, prm: any, nbits: any, huff: any): number; + function _make_decoder(source: any): number[]; + function _decodeNewJPEG(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; + function _decodeOldJPEGInit(img: any, data: any, off: any, len: any): { + jpegOffset: any; + tables?: undefined; + sosMarker?: undefined; + sofPosition?: undefined; + } | { + jpegOffset: any; + tables: Uint8Array; + sosMarker: Uint8Array; + sofPosition: number; + }; + function _decodeOldJPEG(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; + function _decodePackBits(data: any, off: any, len: any, tgt: any, toff: any): any; + function _decodeThunder(data: any, off: any, len: any, tgt: any, toff: any): void; + let _dmap: { + "1": number; + "011": number; + "000011": number; + "0000011": number; + "010": number; + "000010": number; + "0000010": number; + }; + let _lens: {}[]; + function _decodeG4(data: any, off: any, slen: any, tgt: any, toff: any, w: any, fo: any): void; + function _findDiff(line: any, x: any, clr: any): any; + function _makeDiff(line: any): any[]; + function _decodeG2(data: any, off: any, slen: any, tgt: any, toff: any, w: any, fo: any): void; + function _decodeG3(data: any, off: any, slen: any, tgt: any, toff: any, w: any, fo: any, twoDim: any): void; + function _addNtimes(arr: any, n: any, val: any): void; + function _writeBits(bits: any, tgt: any, boff: any): void; + let _decodeLZW: any; + } + function decodeImage(buff: any, img: any, ifds: any): void; + let tags: {}; + namespace _types { + namespace basic { + export { main }; + export { rest }; + } + namespace gps { + let main_1: number[]; + export { main_1 as main }; + let rest_1: { + 18: number; + 29: number; + }; + export { rest_1 as rest }; + } + } + function _readIFD(bin: any, data: any, offset: any, ifds: any, depth: any, prm: any): any; + function _writeIFD(bin: any, types: any, data: any, offset: any, ifd: any): any[]; + function toRGBA8(out: any, scl: any): Uint8Array; + function replaceIMG(imgs: any): void; + let _xhrs: any[]; + let _imgs: any[]; + function _imgLoaded(e: any): void; + function bufferToURI(buff: any): string; + namespace _binBE { + let ui8: Uint8Array; + let i16: Int16Array; + let i32: Int32Array; + let ui32: Uint32Array; + let fl32: Float32Array; + let fl64: Float64Array; + } + namespace _binLE { + import nextZero = nextZero; + export { nextZero }; + export function readUshort(buff: any, p: any): number; + export function readShort(buff: any, p: any): any; + export function readInt(buff: any, p: any): any; + export function readUint(buff: any, p: any): any; + import readASCII = readASCII; + export { readASCII }; + export function readFloat(buff: any, p: any): any; + export function readDouble(buff: any, p: any): any; + export function writeUshort(buff: any, p: any, n: any): void; + export function writeInt(buff: any, p: any, n: any): void; + export function writeUint(buff: any, p: any, n: any): void; + import writeASCII = writeASCII; + export { writeASCII }; + } + function _copyTile(tb: any, tw: any, th: any, b: any, w: any, h: any, xoff: any, yoff: any): void; + function _inflateRaw(N: any, W: any): any; + function LosslessJpegDecode(h: any): Uint8Array | Uint16Array; +} +declare var main: any[]; +declare var rest: { + 33432: number; + 33434: number; + 33437: number; + 34665: number; + 34850: number; + 34853: number; + 34855: number; + 34864: number; + 34866: number; + 36864: number; + 36867: number; + 36868: number; + 37121: number; + 37377: number; + 37378: number; + 37380: number; + 37381: number; + 37383: number; + 37384: number; + 37385: number; + 37386: number; + 37510: number; + 37520: number; + 37521: number; + 37522: number; + 40960: number; + 40961: number; + 40962: number; + 40963: number; + 40965: number; + 41486: number; + 41487: number; + 41488: number; + 41985: number; + 41986: number; + 41987: number; + 41988: number; + 41989: number; + 41990: number; + 41993: number; + 41994: number; + 41995: number; + 41996: number; + 42032: number; + 42033: number; + 42034: number; + 42036: number; + 42037: number; + 59932: number; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts new file mode 100644 index 000000000..6486bf3f1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts @@ -0,0 +1,6 @@ +export { Q as ZSTDDecoder }; +declare class Q { + init(): any; + _init(A: any): void; + decode(A: any, g?: number): any; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts new file mode 100644 index 000000000..66ac1de37 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts @@ -0,0 +1,42 @@ +/** + * A custom lighting implementation based on Forward+ Clustered Shading that + * overwrites the default lighting system in {@link WebGPURenderer}. Suitable + * for 3D scenes with many point lights and real depth complexity — the view + * frustum is partitioned into a 3D cluster grid so only the lights actually + * reaching each fragment are evaluated. + * + * ```js + * const lighting = new ClusteredLighting(); + * renderer.lighting = lighting; // set lighting system + * ``` + * + * @augments Lighting + * @three_import import { ClusteredLighting } from 'three/addons/lighting/ClusteredLighting.js'; + */ +export class ClusteredLighting extends Lighting { + /** + * Constructs a new clustered lighting system. + * + * @param {number} [maxLights=1024] - Maximum number of point lights. + * @param {number} [tileSize=32] - Screen tile size in pixels (cluster XY size). + * @param {number} [zSlices=24] - Number of exponential depth slices. + * @param {number} [maxLightsPerCluster=64] - Per-cluster light-list capacity. + */ + constructor(maxLights?: number, tileSize?: number, zSlices?: number, maxLightsPerCluster?: number); + maxLights: number; + tileSize: number; + zSlices: number; + maxLightsPerCluster: number; + /** + * Creates a new clustered lights node for the given array of lights. + * + * This method is called internally by the renderer and must be overwritten by + * all custom lighting implementations. + * + * @param {Array} lights - The lights. + * @return {ClusteredLightsNode} The clustered lights node. + */ + createNode(lights?: Array): ClusteredLightsNode; +} +import { Lighting } from 'three/webgpu'; +import ClusteredLightsNode from '../tsl/lighting/ClusteredLightsNode.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts new file mode 100644 index 000000000..1dd73c216 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts @@ -0,0 +1,54 @@ +/** + * A custom lighting implementation that batches supported analytic lights into + * uniform arrays so light count changes do not recompile materials. + * + * ```js + * const lighting = new DynamicLighting( { maxPointLights: 64 } ); + * renderer.lighting = lighting; + * ``` + * + * @augments Lighting + * @three_import import { DynamicLighting } from 'three/addons/lighting/DynamicLighting.js'; + */ +export class DynamicLighting extends Lighting { + /** + * Constructs a new dynamic lighting system. + * + * @param {Object} [options={}] - Dynamic lighting configuration. + * @param {number} [options.maxDirectionalLights=8] - Maximum number of batched directional lights. + * @param {number} [options.maxPointLights=16] - Maximum number of batched point lights. + * @param {number} [options.maxSpotLights=16] - Maximum number of batched spot lights. + * @param {number} [options.maxHemisphereLights=4] - Maximum number of batched hemisphere lights. + */ + constructor(options?: { + maxDirectionalLights?: number | undefined; + maxPointLights?: number | undefined; + maxSpotLights?: number | undefined; + maxHemisphereLights?: number | undefined; + }); + options: { + maxDirectionalLights: number; + maxPointLights: number; + maxSpotLights: number; + maxHemisphereLights: number; + }; + _nodes: WeakMap; + /** + * Creates a new dynamic lights node for the given array of lights. + * + * @param {Array} lights - The lights to bind to the node. + * @return {DynamicLightsNode} The dynamic lights node. + */ + createNode(lights?: Array): DynamicLightsNode; + /** + * Returns a lights node for the given scene. + * + * @param {Scene} scene - The scene. + * @return {LightsNode} The lights node. + */ + getNode(scene: Scene): LightsNode; +} +export default DynamicLighting; +import { Lighting } from 'three/webgpu'; +import DynamicLightsNode from '../tsl/lighting/DynamicLightsNode.js'; +import { LightsNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts new file mode 100644 index 000000000..b4dd1eaec --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts @@ -0,0 +1,143 @@ +/** + * A 3D grid of L2 Spherical Harmonic irradiance probes that provides + * position-dependent diffuse global illumination. + * + * This is the {@link WebGPURenderer} version of `LightProbeGrid`. The grid is a + * {@link Light}, so adding it to the scene applies its baked irradiance to every + * lit node material automatically. When using {@link WebGLRenderer}, import the + * grid from `LightProbeGridWebGL.js` instead. + * + * The baked data is stored in a single RGBA `RenderTarget3D` atlas that packs + * the nine L2 SH coefficients into seven sub-volumes stacked along Z. Baking is + * fully GPU-resident: cubemap rendering, SH projection, and texture packing all + * happen on the GPU with zero CPU readback. + * + * @augments Light + * @three_import import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; + */ +export class LightProbeGrid extends Light { + /** + * Constructs a new irradiance probe grid. + * + * The volume is centered at the object's position. + * + * @param {number} [width=1] - Full width of the volume along X. + * @param {number} [height=1] - Full height of the volume along Y. + * @param {number} [depth=1] - Full depth of the volume along Z. + * @param {number} [widthProbes] - Number of probes along X. Defaults to `Math.max( 2, Math.round( width ) + 1 )`. + * @param {number} [heightProbes] - Number of probes along Y. Defaults to `Math.max( 2, Math.round( height ) + 1 )`. + * @param {number} [depthProbes] - Number of probes along Z. Defaults to `Math.max( 2, Math.round( depth ) + 1 )`. + */ + constructor(width?: number, height?: number, depth?: number, widthProbes?: number, heightProbes?: number, depthProbes?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLightProbeGrid: boolean; + /** + * The full width of the volume along X. + * + * @type {number} + */ + width: number; + /** + * The full height of the volume along Y. + * + * @type {number} + */ + height: number; + /** + * The full depth of the volume along Z. + * + * @type {number} + */ + depth: number; + /** + * The number of probes along each axis. + * + * @type {Vector3} + */ + resolution: Vector3; + /** + * The world-space bounding box for the grid. Updated automatically + * by {@link LightProbeGrid#bake}. + * + * @type {Box3} + */ + boundingBox: Box3; + /** + * Distance in world units over which the grid contribution fades out + * past the volume boundary. `0` applies the contribution everywhere + * (clamped), which matches a single-volume setup. Use a small positive + * value to blend multiple overlapping grids. + * + * @type {number} + * @default 0 + */ + falloff: number; + /** + * The single RGBA atlas 3D texture storing all seven packed SH + * sub-volumes stacked along Z. + * + * @type {?Data3DTexture} + * @default null + */ + texture: Data3DTexture | null; + /** + * Internal render target for GPU-resident baking. + * + * @private + * @type {?RenderTarget3D} + * @default null + */ + private _renderTarget; + /** + * Returns the world-space position of the probe at grid indices (ix, iy, iz). + * + * @param {number} ix - X index. + * @param {number} iy - Y index. + * @param {number} iz - Z index. + * @param {Vector3} target - The target vector. + * @return {Vector3} The world-space position. + */ + getProbePosition(ix: number, iy: number, iz: number, target: Vector3): Vector3; + /** + * Updates the world-space bounding box from the current position and size. + */ + updateBoundingBox(): void; + /** + * Bakes all probes by rendering cubemaps at each probe position and + * projecting to L2 SH. Optionally iterates additional passes to capture + * indirect bounces: each extra pass samples the previous pass's data as + * indirect light, so a grid added to the scene before baking accumulates + * one bounce per extra pass. + * + * @param {WebGPURenderer} renderer - The renderer. + * @param {Scene} scene - The scene to render. + * @param {Object} [options] - Bake options. + * @param {number} [options.cubemapSize=8] - Resolution of each cubemap face. + * @param {number} [options.near=0.1] - Near plane for the cube camera. + * @param {number} [options.far=100] - Far plane for the cube camera. + * @param {number} [options.bounces=0] - Additional bounce passes after the initial direct pass. + * @param {number} [options.sampleCount=512] - Directions integrated when projecting each cubemap to SH. + */ + bake(renderer: WebGPURenderer, scene: Scene, options?: { + cubemapSize?: number | undefined; + near?: number | undefined; + far?: number | undefined; + bounces?: number | undefined; + sampleCount?: number | undefined; + }): void; + /** + * Ensures the atlas 3D texture exists with the correct dimensions. + * + * @private + */ + private _ensureTextures; +} +import { Light } from 'three/webgpu'; +import { Vector3 } from 'three/webgpu'; +import { Box3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts new file mode 100644 index 000000000..d1ad9cd51 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts @@ -0,0 +1,147 @@ +/** + * A 3D grid of L2 Spherical Harmonic irradiance probes that provides + * position-dependent diffuse global illumination. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * A version for {@link WebGPURenderer} will be added at a later point. + * + * All seven packed SH sub-volumes are stored in a **single** RGBA + * `WebGL3DRenderTarget` using a texture-atlas layout along the Z axis. + * Each sub-volume occupies `( nz + 2 )` atlas slices: one padding slice at + * each end (a copy of the nearest edge data slice) to prevent color bleeding + * when the hardware trilinear filter reads across a sub-volume boundary. + * + * Atlas layout (nz = resolution.z, PADDING = 1): + * ``` + * slice 0 : padding (copy of sub-volume 0, data slice 0) + * slices 1 … nz : sub-volume 0 data + * slice nz + 1 : padding (copy of sub-volume 0, data slice nz-1) + * slice nz + 2 : padding (copy of sub-volume 1, data slice 0) + * slices nz+3 … 2*nz+2 : sub-volume 1 data + * … + * ``` + * Total atlas depth = `7 * ( nz + 2 )`. + * + * Baking is fully GPU-resident: cubemap rendering, SH projection, and + * texture packing all happen on the GPU with zero CPU readback. + * + * @three_import import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; + */ +export class LightProbeGridWebGL extends Object3D { + /** + * Constructs a new irradiance probe grid. + * + * The volume is centered at the object's position. + * + * @param {number} [width=1] - Full width of the volume along X. + * @param {number} [height=1] - Full height of the volume along Y. + * @param {number} [depth=1] - Full depth of the volume along Z. + * @param {number} [widthProbes] - Number of probes along X. Defaults to `Math.max( 2, Math.round( width ) + 1 )`. + * @param {number} [heightProbes] - Number of probes along Y. Defaults to `Math.max( 2, Math.round( height ) + 1 )`. + * @param {number} [depthProbes] - Number of probes along Z. Defaults to `Math.max( 2, Math.round( depth ) + 1 )`. + */ + constructor(width?: number, height?: number, depth?: number, widthProbes?: number, heightProbes?: number, depthProbes?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLightProbeGrid: boolean; + /** + * The full width of the volume along X. + * + * @type {number} + */ + width: number; + /** + * The full height of the volume along Y. + * + * @type {number} + */ + height: number; + /** + * The full depth of the volume along Z. + * + * @type {number} + */ + depth: number; + /** + * The number of probes along each axis. + * + * @type {Vector3} + */ + resolution: Vector3; + /** + * The world-space bounding box for the grid. Updated automatically + * by {@link LightProbeGridWebGL#bake}. + * + * @type {Box3} + */ + boundingBox: Box3; + /** + * The single RGBA atlas 3D texture storing all seven packed SH sub-volumes. + * + * @type {?Data3DTexture} + * @default null + */ + texture: Data3DTexture | null; + /** + * Internal render target for GPU-resident baking. + * + * @private + * @type {?WebGL3DRenderTarget} + * @default null + */ + private _renderTarget; + /** + * Returns the world-space position of the probe at grid indices (ix, iy, iz). + * + * @param {number} ix - X index. + * @param {number} iy - Y index. + * @param {number} iz - Z index. + * @param {Vector3} target - The target vector. + * @return {Vector3} The world-space position. + */ + getProbePosition(ix: number, iy: number, iz: number, target: Vector3): Vector3; + /** + * Updates the world-space bounding box from the current position and size. + */ + updateBoundingBox(): void; + /** + * Bakes all probes by rendering cubemaps at each probe position + * and projecting to L2 SH. Optionally iterates additional passes to + * capture indirect bounces — each extra pass samples the previous pass's + * atlas as indirect light, so a grid added to the scene before baking + * accumulates one bounce per extra pass. + * + * Shadow-casting instances of `SunLight` are temporarily replaced with + * equivalent directional lights, since their view-fitted shadow cascades + * cannot be frozen across probe renders. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {Scene} scene - The scene to render. + * @param {Object} [options] - Bake options. + * @param {number} [options.cubemapSize=8] - Resolution of each cubemap face. + * @param {number} [options.near=0.1] - Near plane for the cube camera. + * @param {number} [options.far=100] - Far plane for the cube camera. + * @param {number} [options.bounces=0] - Additional bounce passes after the initial direct pass. + */ + bake(renderer: WebGLRenderer, scene: Scene, options?: { + cubemapSize?: number | undefined; + near?: number | undefined; + far?: number | undefined; + bounces?: number | undefined; + }): void; + /** + * Ensures the atlas 3D render target exists with the correct dimensions. + * + * @private + */ + private _ensureTextures; +} +import { Object3D } from 'three'; +import { Vector3 } from 'three'; +import { Box3 } from 'three'; +import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts new file mode 100644 index 000000000..b1ccbcbd9 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts @@ -0,0 +1,30 @@ +/** + * Utility class for creating instances of {@link LightProbe}. + * + * @hideconstructor + * @three_import import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; + */ +export class LightProbeGenerator { + /** + * Creates a light probe from the given (radiance) environment map. + * The method expects that the environment map is represented as a cube texture. + * + * @param {CubeTexture} cubeTexture - The environment map. + * @return {LightProbe} The created light probe. + */ + static fromCubeTexture(cubeTexture: CubeTexture): LightProbe; + /** + * Creates a light probe from the given (radiance) environment map. + * The method expects that the environment map is represented as a cube render target. + * + * The cube render target must be in RGBA so `cubeRenderTarget.texture.format` must be + * set to {@link RGBAFormat}. + * + * @async + * @param {WebGPURenderer|WebGLRenderer} renderer - The renderer. + * @param {CubeRenderTarget|WebGLCubeRenderTarget} cubeRenderTarget - The environment map. + * @return {Promise} A Promise that resolves with the created light probe. + */ + static fromCubeRenderTarget(renderer: WebGPURenderer | WebGLRenderer, cubeRenderTarget: CubeRenderTarget | WebGLCubeRenderTarget): Promise; +} +import { LightProbe } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts new file mode 100644 index 000000000..833559dbc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts @@ -0,0 +1,32 @@ +/** + * Texture library for {@link RectAreaLight}. This class holds the LTC BRDF data + * in data textures for further use in the renderer. + * + * Reference: Real-Time Polygonal-Light Shading with Linearly Transformed Cosines + * by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. [Code](https://github.com/selfshadow/ltc_code/). + * + * NOTE: This is a temporary location for the BRDF approximation texture data + * based off of Eric Heitz's work (see citation). BRDF data for + * `RectAreaLight` is currently approximated using a precomputed texture + * of roughly 80kb in size. The hope is to find a better way to include + * the large texture data before including the full RectAreaLight implementation + * in the main build files. + * + * @hideconstructor + * @three_import import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; + */ +export class RectAreaLightTexturesLib { + /** + * Inits the texture library. + * + * @return {RectAreaLightTexturesLib} + */ + static init(): RectAreaLightTexturesLib; +} +export namespace RectAreaLightTexturesLib { + let LTC_HALF_1: DataTexture | null | undefined; + let LTC_HALF_2: DataTexture | null | undefined; + let LTC_FLOAT_1: DataTexture | null | undefined; + let LTC_FLOAT_2: DataTexture | null | undefined; +} +import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts new file mode 100644 index 000000000..4e8ec37f6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts @@ -0,0 +1,19 @@ +/** + * This class is only relevant when using {@link RectAreaLight} with {@link WebGLRenderer}. + * + * Before rect area lights can be used, the internal uniform library of the renderer must be + * enhanced with the following code. + * + * ```js + * RectAreaLightUniformsLib.init(); + * ``` + * + * @hideconstructor + * @three_import import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js'; + */ +export class RectAreaLightUniformsLib { + /** + * Inits the uniform library required when using rect area lights. + */ + static init(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts new file mode 100644 index 000000000..a1cdac05d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts @@ -0,0 +1,44 @@ +/** + * A polyline drawn between vertices. + * + * This adds functionality beyond {@link Line}, like arbitrary line width and changing width to + * be in world units.It extends {@link LineSegments2}, simplifying constructing segments from a + * chain of points. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * import the class from `lines/webgpu/Line2.js`. + * + * ```js + * const geometry = new LineGeometry(); + * geometry.setPositions( positions ); + * geometry.setColors( colors ); + * + * const material = new LineMaterial( { linewidth: 5, vertexColors: true } }; + * + * const line = new Line2( geometry, material ); + * scene.add( line ); + * ``` + * + * @augments LineSegments2 + * @three_import import { Line2 } from 'three/addons/lines/Line2.js'; + */ +export class Line2 extends LineSegments2 { + /** + * Constructs a new wide line. + * + * @param {LineGeometry} [geometry] - The line geometry. + * @param {LineMaterial} [material] - The line material. + */ + constructor(geometry?: LineGeometry, material?: LineMaterial); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLine2: boolean; +} +import { LineSegments2 } from './LineSegments2.js'; +import { LineGeometry } from './LineGeometry.js'; +import { LineMaterial } from './LineMaterial.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts new file mode 100644 index 000000000..2564da5ce --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts @@ -0,0 +1,58 @@ +/** + * A chain of vertices, forming a polyline. + * + * This is used in {@link Line2} to describe the shape. + * + * ```js + * const points = [ + * new THREE.Vector3( - 10, 0, 0 ), + * new THREE.Vector3( 0, 5, 0 ), + * new THREE.Vector3( 10, 0, 0 ), + * ]; + * + * const geometry = new LineGeometry(); + * geometry.setFromPoints( points ); + * ``` + * + * @augments LineSegmentsGeometry + * @three_import import { LineLineGeometry2 } from 'three/addons/lines/LineGeometry.js'; + */ +export class LineGeometry extends LineSegmentsGeometry { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineGeometry: boolean; + /** + * Sets the given line positions for this geometry. + * + * @param {Float32Array|Array} array - The position data to set. + * @return {LineGeometry} A reference to this geometry. + */ + setPositions(array: Float32Array | Array): LineGeometry; + /** + * Sets the given line colors for this geometry. + * + * @param {Float32Array|Array} array - The position data to set. + * @return {LineGeometry} A reference to this geometry. + */ + setColors(array: Float32Array | Array): LineGeometry; + /** + * Setups this line segments geometry from the given sequence of points. + * + * @param {Array} points - An array of points in 2D or 3D space. + * @return {LineGeometry} A reference to this geometry. + */ + setFromPoints(points: Array): LineGeometry; + /** + * Setups this line segments geometry from the given line. + * + * @param {Line} line - The line that should be used as a data source for this geometry. + * @return {LineGeometry} A reference to this geometry. + */ + fromLine(line: Line): LineGeometry; +} +import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts new file mode 100644 index 000000000..9d03e1c0c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts @@ -0,0 +1,98 @@ +/** + * A material for drawing wireframe-style geometries. + * + * Unlike {@link LineBasicMaterial}, it supports arbitrary line widths and allows using world units + * instead of screen space units. This material is used with {@link LineSegments2} and {@link Line2}. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * use {@link Line2NodeMaterial}. + * + * @augments ShaderMaterial + * @three_import import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; + */ +export class LineMaterial extends ShaderMaterial { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineMaterial: boolean; + set color(value: Color); + /** + * The material's color. + * + * @type {Color} + * @default (1,1,1) + */ + get color(): Color; + set worldUnits(value: boolean); + /** + * Whether the material's sizes (width, dash gaps) are in world units. + * + * @type {boolean} + * @default false + */ + get worldUnits(): boolean; + set linewidth(value: number); + /** + * Controls line thickness in CSS pixel units when `worldUnits` is `false` (default), + * or in world units when `worldUnits` is `true`. + * + * @type {number} + * @default 1 + */ + get linewidth(): number; + set dashed(value: boolean); + /** + * Whether the line is dashed, or solid. + * + * @type {boolean} + * @default false + */ + get dashed(): boolean; + set dashScale(value: number); + /** + * The scale of the dashes and gaps. + * + * @type {number} + * @default 1 + */ + get dashScale(): number; + set dashSize(value: number); + /** + * The size of the dash. + * + * @type {number} + * @default 1 + */ + get dashSize(): number; + set dashOffset(value: number); + /** + * Where in the dash cycle the dash starts. + * + * @type {number} + * @default 0 + */ + get dashOffset(): number; + set gapSize(value: number); + /** + * The size of the gap. + * + * @type {number} + * @default 0 + */ + get gapSize(): number; + set resolution(value: Vector2); + /** + * The size of the viewport, in screen pixels. This must be kept updated to make + * screen-space rendering accurate. The `LineSegments2.onBeforeRender` callback + * performs the update for visible objects. + * + * @type {Vector2} + */ + get resolution(): Vector2; +} +import { ShaderMaterial } from 'three'; +import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts new file mode 100644 index 000000000..7dd0b3b2d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts @@ -0,0 +1,60 @@ +/** + * A series of lines drawn between pairs of vertices. + * + * This adds functionality beyond {@link LineSegments}, like arbitrary line width and changing width + * to be in world units. {@link Line2} extends this object, forming a polyline instead of individual + * segments. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * import the class from `lines/webgpu/LineSegments2.js`. + * + * ```js + * const geometry = new LineSegmentsGeometry(); + * geometry.setPositions( positions ); + * geometry.setColors( colors ); + * + * const material = new LineMaterial( { linewidth: 5, vertexColors: true } }; + * + * const lineSegments = new LineSegments2( geometry, material ); + * scene.add( lineSegments ); + * ``` + * + * @augments Mesh + * @three_import import { LineSegments2 } from 'three/addons/lines/LineSegments2.js'; + */ +export class LineSegments2 extends Mesh { + /** + * Constructs a new wide line. + * + * @param {LineSegmentsGeometry} [geometry] - The line geometry. + * @param {LineMaterial} [material] - The line material. + */ + constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineSegments2: boolean; + /** + * Computes an array of distance values which are necessary for rendering dashed lines. + * For each vertex in the geometry, the method calculates the cumulative length from the + * current point to the very beginning of the line. + * + * @return {LineSegments2} A reference to this instance. + */ + computeLineDistances(): LineSegments2; + /** + * Computes intersection points between a casted ray and this instance. + * + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - The target array that holds the intersection points. + */ + raycast(raycaster: Raycaster, intersects: Array): void; + onBeforeRender(renderer: any): void; +} +import { Mesh } from 'three'; +import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; +import { LineMaterial } from './LineMaterial.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts new file mode 100644 index 000000000..4845d8410 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts @@ -0,0 +1,73 @@ +/** + * A series of vertex pairs, forming line segments. + * + * This is used in {@link LineSegments2} to describe the shape. + * + * @augments InstancedBufferGeometry + * @three_import import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; + */ +export class LineSegmentsGeometry extends InstancedBufferGeometry { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineSegmentsGeometry: boolean; + /** + * Applies the given 4x4 transformation matrix to the geometry. + * + * @param {Matrix4} matrix - The matrix to apply. + * @return {LineSegmentsGeometry} A reference to this instance. + */ + applyMatrix4(matrix: Matrix4): LineSegmentsGeometry; + /** + * Sets the given line positions for this geometry. The length must be a multiple of six since + * each line segment is defined by a start end vertex in the pattern `(xyz xyz)`. + * + * @param {Float32Array|Array} array - The position data to set. + * @return {LineSegmentsGeometry} A reference to this geometry. + */ + setPositions(array: Float32Array | Array): LineSegmentsGeometry; + /** + * Sets the given line colors for this geometry. The length must be a multiple of six since + * each line segment is defined by a start end color in the pattern `(rgb rgb)`. + * + * @param {Float32Array|Array} array - The position data to set. + * @return {LineSegmentsGeometry} A reference to this geometry. + */ + setColors(array: Float32Array | Array): LineSegmentsGeometry; + /** + * Setups this line segments geometry from the given wireframe geometry. + * + * @param {WireframeGeometry} geometry - The geometry that should be used as a data source for this geometry. + * @return {LineSegmentsGeometry} A reference to this geometry. + */ + fromWireframeGeometry(geometry: WireframeGeometry): LineSegmentsGeometry; + /** + * Setups this line segments geometry from the given edges geometry. + * + * @param {EdgesGeometry} geometry - The geometry that should be used as a data source for this geometry. + * @return {LineSegmentsGeometry} A reference to this geometry. + */ + fromEdgesGeometry(geometry: EdgesGeometry): LineSegmentsGeometry; + /** + * Setups this line segments geometry from the given mesh. + * + * @param {Mesh} mesh - The mesh geometry that should be used as a data source for this geometry. + * @return {LineSegmentsGeometry} A reference to this geometry. + */ + fromMesh(mesh: Mesh): LineSegmentsGeometry; + /** + * Setups this line segments geometry from the given line segments. + * + * @param {LineSegments} lineSegments - The line segments that should be used as a data source for this geometry. + * Assumes the source geometry is not using indices. + * @return {LineSegmentsGeometry} A reference to this geometry. + */ + fromLineSegments(lineSegments: LineSegments): LineSegmentsGeometry; + toJSON(): void; +} +import { InstancedBufferGeometry } from 'three'; +import { WireframeGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts new file mode 100644 index 000000000..a40c88984 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts @@ -0,0 +1,46 @@ +/** + * A class for creating wireframes based on wide lines. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * import the class from `lines/webgpu/Wireframe.js`. + * + * ```js + * const geometry = new THREE.IcosahedronGeometry(); + * const wireframeGeometry = new WireframeGeometry2( geo ); + * + * const wireframe = new Wireframe( wireframeGeometry, material ); + * scene.add( wireframe ); + * ``` + * + * @augments Mesh + * @three_import import { Wireframe } from 'three/addons/lines/Wireframe.js'; + */ +export class Wireframe extends Mesh { + /** + * Constructs a new wireframe. + * + * @param {LineSegmentsGeometry} [geometry] - The line geometry. + * @param {LineMaterial} [material] - The line material. + */ + constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWireframe: boolean; + /** + * Computes an array of distance values which are necessary for rendering dashed lines. + * For each vertex in the geometry, the method calculates the cumulative length from the + * current point to the very beginning of the line. + * + * @return {Wireframe} A reference to this instance. + */ + computeLineDistances(): Wireframe; + onBeforeRender(renderer: any): void; +} +import { Mesh } from 'three'; +import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; +import { LineMaterial } from './LineMaterial.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts new file mode 100644 index 000000000..61bb232cf --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts @@ -0,0 +1,30 @@ +/** + * A special type of line segments geometry intended for wireframe rendering. + * + * This is used in {@link Wireframe} to describe the shape. + * + * ```js + * const geometry = new THREE.IcosahedronGeometry(); + * const wireframeGeometry = new WireframeGeometry2( geo ); + * ``` + * + * @augments LineSegmentsGeometry + * @three_import import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; + */ +export class WireframeGeometry2 extends LineSegmentsGeometry { + /** + * Constructs a new wireframe geometry. + * + * @param {BufferGeometry} [geometry] - The geometry to render the wireframe for. + */ + constructor(geometry?: BufferGeometry); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWireframeGeometry2: boolean; +} +import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts new file mode 100644 index 000000000..99fa543d7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts @@ -0,0 +1,33 @@ +/** + * A polyline drawn between vertices. + * + * This adds functionality beyond {@link Line}, like arbitrary line width and changing width to + * be in world units.It extends {@link LineSegments2}, simplifying constructing segments from a + * chain of points. + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * import the class from `lines/Line2.js`. + * + * @augments LineSegments2 + * @three_import import { Line2 } from 'three/addons/lines/webgpu/Line2.js'; + */ +export class Line2 extends LineSegments2 { + /** + * Constructs a new wide line. + * + * @param {LineGeometry} [geometry] - The line geometry. + * @param {Line2NodeMaterial} [material] - The line material. + */ + constructor(geometry?: LineGeometry, material?: Line2NodeMaterial); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLine2: boolean; +} +import { LineSegments2 } from './LineSegments2.js'; +import { LineGeometry } from '../LineGeometry.js'; +import { Line2NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts new file mode 100644 index 000000000..b78c3ec1e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts @@ -0,0 +1,51 @@ +/** + * A series of lines drawn between pairs of vertices. + * + * This adds functionality beyond {@link LineSegments}, like arbitrary line width and changing width + * to be in world units. {@link Line2} extends this object, forming a polyline instead of individual + * segments. + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * import the class from `lines/LineSegments2.js`. + * + * @augments Mesh + * @three_import import { LineSegments2 } from 'three/addons/lines/webgpu/LineSegments2.js'; + */ +export class LineSegments2 extends Mesh { + /** + * Constructs a new wide line. + * + * @param {LineSegmentsGeometry} [geometry] - The line geometry. + * @param {Line2NodeMaterial} [material] - The line material. + */ + constructor(geometry?: LineSegmentsGeometry, material?: Line2NodeMaterial); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineSegments2: boolean; + _resolution: Vector2; + /** + * Computes an array of distance values which are necessary for rendering dashed lines. + * For each vertex in the geometry, the method calculates the cumulative length from the + * current point to the very beginning of the line. + * + * @return {LineSegments2} A reference to this instance. + */ + computeLineDistances(): LineSegments2; + onBeforeRender(renderer: any): void; + /** + * Computes intersection points between a casted ray and this instance. + * + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - The target array that holds the intersection points. + */ + raycast(raycaster: Raycaster, intersects: Array): void; +} +import { Mesh } from 'three/webgpu'; +import { Vector2 } from 'three/webgpu'; +import { LineSegmentsGeometry } from '../LineSegmentsGeometry.js'; +import { Line2NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts new file mode 100644 index 000000000..5c34f7a30 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts @@ -0,0 +1,37 @@ +/** + * A class for creating wireframes based on wide lines. + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * import the class from `lines/Wireframe.js`. + * + * @augments Mesh + * @three_import import { Wireframe } from 'three/addons/lines/webgpu/Wireframe.js'; + */ +export class Wireframe extends Mesh { + /** + * Constructs a new wireframe. + * + * @param {LineSegmentsGeometry} [geometry] - The line geometry. + * @param {Line2NodeMaterial} [material] - The line material. + */ + constructor(geometry?: LineSegmentsGeometry, material?: Line2NodeMaterial); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWireframe: boolean; + /** + * Computes an array of distance values which are necessary for rendering dashed lines. + * For each vertex in the geometry, the method calculates the cumulative length from the + * current point to the very beginning of the line. + * + * @return {Wireframe} A reference to this instance. + */ + computeLineDistances(): Wireframe; +} +import { Mesh } from 'three/webgpu'; +import { LineSegmentsGeometry } from '../LineSegmentsGeometry.js'; +import { Line2NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts new file mode 100644 index 000000000..4ee616be2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts @@ -0,0 +1,135 @@ +/** + * A loader for Rhinoceros 3D files and objects. + * + * Rhinoceros is a 3D modeler used to create, edit, analyze, document, render, + * animate, and translate NURBS curves, surfaces, breps, extrusions, point clouds, + * as well as polygon meshes and SubD objects. `rhino3dm.js` is compiled to WebAssembly + * from the open source geometry library `openNURBS`. The loader currently uses + * `rhino3dm.js 8.32.1`. + * + * ```js + * const loader = new Rhino3dmLoader(); + * loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.32.1/' ); + * + * const object = await loader.loadAsync( 'models/3dm/Rhino_Logo.3dm' ); + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js'; + */ +export class Rhino3dmLoader extends Loader { + /** + * Constructs a new Rhino 3DM loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + libraryPath: string; + libraryPending: Promise | null; + libraryBinary: any; + libraryConfig: {}; + url: string; + workerLimit: number; + workerPool: any[]; + workerNextTaskID: number; + workerSourceURL: string; + workerConfig: {}; + subdivisionLevel: number; + materials: any[]; + warnings: any[]; + /** + * Path to a folder containing the JS and WASM libraries. + * + * @param {string} path - The library path to set. + * @return {Rhino3dmLoader} A reference to this loader. + */ + setLibraryPath(path: string): Rhino3dmLoader; + /** + * Sets the maximum number of Web Workers to be used during decoding. + * A lower limit may be preferable if workers are also for other + * tasks in the application. + * + * @param {number} workerLimit - The worker limit. + * @return {Rhino3dmLoader} A reference to this loader. + */ + setWorkerLimit(workerLimit: number): Rhino3dmLoader; + /** + * Sets the number of global subdivisions applied to SubD objects before they are + * meshed for display. The default is `3`. Large models with many SubD objects may + * benefit from a lower value to keep vertex counts manageable. + * + * @param {number} level - The subdivision level. + * @return {Rhino3dmLoader} A reference to this loader. + */ + setSubdivisionLevel(level: number): Rhino3dmLoader; + /** + * Starts loading from the given URL and passes the loaded 3DM asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Object3D)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Object3D) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Prints debug messages to the browser console. + */ + debug(): void; + /** + * Decodes the 3DM asset data with a Web Worker. + * + * @param {ArrayBuffer} buffer - The raw 3DM asset data as an array buffer. + * @param {string} url - The asset URL. + * @return {Promise} A Promise that resolved with the decoded 3D object. + */ + decodeObjects(buffer: ArrayBuffer, url: string): Promise; + /** + * Parses the given 3DM data and passes the loaded 3DM asset + * to the `onLoad()` callback. + * + * @param {ArrayBuffer} data - The raw 3DM asset data as an array buffer. + * @param {function(Object3D)} onLoad - Executed when the loading process has been finished. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + parse(data: ArrayBuffer, onLoad: (arg0: Object3D) => any, onError: onErrorCallback): void; + /** + * Parses the given 3DM data and returns a Promise that resolves with the loaded asset. + * + * @param {ArrayBuffer} data - The raw 3DM asset data as an array buffer. + * @return {Promise} A Promise that resolves with the decoded 3D object. + */ + parseAsync(data: ArrayBuffer): Promise; + _compareMaterials(material: any): any; + _createMaterial(material: any, renderEnvironment: any): MeshStandardMaterial; + _createGeometry(data: any): Object3D; + /** + * Builds a BufferGeometry from a worker payload. Meshes decoded via the fast path + * arrive as transferable typed arrays (`format: 'buffers'`) and are assembled directly; + * everything else falls back to the three.js BufferGeometry JSON produced by + * `toThreejsJSON()` (older rhino3dm, point clouds, curves, …). + */ + _geometryFromData(data: any): BufferGeometry; + _createObject(obj: any, mat: any): Sprite | Mesh | Line | Points | SpotLight | PointLight | DirectionalLight | RectAreaLight | undefined; + _initLibrary(): Promise; + _getWorker(taskCost: any): Promise; + _releaseTask(worker: any, taskID: any): void; + /** + * Frees internal resources. This method should be called + * when the loader is no longer required. + */ + dispose(): void; +} +import { Loader } from 'three'; +import { Object3D } from 'three'; +import { MeshStandardMaterial } from 'three'; +import { BufferGeometry } from 'three'; +import { Sprite } from 'three'; +import { Mesh } from 'three'; +import { Line } from 'three'; +import { Points } from 'three'; +import { SpotLight } from 'three'; +import { PointLight } from 'three'; +import { DirectionalLight } from 'three'; +import { RectAreaLight } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts new file mode 100644 index 000000000..a47c187be --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts @@ -0,0 +1,67 @@ +/** + * A loader for the [3D Manufacturing Format (3MF)](https://3mf.io/specification/) format. + * + * The following features from the core specification are supported: + * + * - 3D Models + * - Object Resources (Meshes and Components) + * - Material Resources (Base Materials) + * + * 3MF Materials and Properties Extension are only partially supported. + * + * - Texture 2D + * - Texture 2D Groups + * - Color Groups (Vertex Colors) + * - Metallic Display Properties (PBR) + * - Beam Lattice + * + * ```js + * const loader = new ThreeMFLoader(); + * + * const object = await loader.loadAsync( './models/3mf/truck.3mf' ); + * object.rotation.set( - Math.PI / 2, 0, 0 ); // z-up conversion + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; + */ +export class ThreeMFLoader extends Loader { + /** + * Constructs a new 3MF loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * An array of available extensions. + * + * @type {Array} + */ + availableExtensions: Array; + /** + * Starts loading from the given URL and passes the loaded 3MF asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given 3MF data and returns the resulting group. + * + * @param {ArrayBuffer} data - The raw 3MF asset data as an array buffer. + * @return {Group} A group representing the parsed asset. + */ + parse(data: ArrayBuffer): Group; + /** + * Adds a 3MF extension. + * + * @param {Object} extension - The extension to add. + */ + addExtension(extension: Object): void; +} +import { Loader } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts new file mode 100644 index 000000000..ab0d0f496 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts @@ -0,0 +1,43 @@ +/** + * A loader for the AMF format. + * + * The loader supports materials, color and ZIP compressed files. + * No constellation support (yet). + * + * ```js + * const loader = new AMFLoader(); + * + * const object = await loader.loadAsync( './models/amf/rook.amf' ); + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { AMFLoader } from 'three/addons/loaders/AMFLoader.js'; + */ +export class AMFLoader extends Loader { + /** + * Constructs a new AMF loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded AMF asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given AMF data and returns the resulting group. + * + * @param {ArrayBuffer} data - The raw AMF asset data as an array buffer. + * @return {Group} A group representing the parsed asset. + */ + parse(data: ArrayBuffer): Group; +} +import { Loader } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts new file mode 100644 index 000000000..a63bd7f6c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts @@ -0,0 +1,71 @@ +/** + * A loader for the BVH format. + * + * Imports BVH files and outputs a single {@link Skeleton} and {@link AnimationClip}. + * The loader only supports BVH files containing a single root right now. + * + * ```js + * const loader = new BVHLoader(); + * const result = await loader.loadAsync( 'models/bvh/pirouette.bvh' ); + * + * // visualize skeleton + * const skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] ); + * scene.add( result.skeleton.bones[ 0 ] ); + * scene.add( skeletonHelper ); + * + * // play animation clip + * mixer = new THREE.AnimationMixer( result.skeleton.bones[ 0 ] ); + * mixer.clipAction( result.clip ).play(); + * ``` + * + * @augments Loader + * @three_import import { BVHLoader } from 'three/addons/loaders/BVHLoader.js'; + */ +export class BVHLoader extends Loader { + /** + * Constructs a new BVH loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Whether to animate bone positions or not. + * + * @type {boolean} + * @default true + */ + animateBonePositions: boolean; + /** + * Whether to animate bone rotations or not. + * + * @type {boolean} + * @default true + */ + animateBoneRotations: boolean; + /** + * Starts loading from the given URL and passes the loaded BVH asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({skeleton:Skeleton,clip:AnimationClip})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + skeleton: Skeleton; + clip: AnimationClip; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given BVH data and returns the resulting data. + * + * @param {string} text - The raw BVH data as a string. + * @return {{skeleton:Skeleton,clip:AnimationClip}} An object representing the parsed asset. + */ + parse(text: string): { + skeleton: Skeleton; + clip: AnimationClip; + }; +} +import { Loader } from 'three'; +import { Skeleton } from 'three'; +import { AnimationClip } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts new file mode 100644 index 000000000..6eff80f62 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts @@ -0,0 +1,49 @@ +/** + * A loader for the Collada format. + * + * The Collada format is very complex so this loader only supports a subset of what + * is defined in the [official specification](https://www.khronos.org/files/collada_spec_1_5.pdf). + * + * Assets with a Z-UP coordinate system are transformed it into Y-UP by a simple rotation. + * The vertex data are not converted. + * + * ```js + * const loader = new ColladaLoader(); + * + * const result = await loader.loadAsync( './models/collada/elf/elf.dae' ); + * scene.add( result.scene ); + * ``` + * + * @augments Loader + * @three_import import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js'; + */ +export class ColladaLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded Collada asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({scene:Group,animations:Array,kinematics:Object})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + scene: Group; + animations: Array; + kinematics: Object; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given Collada data and returns a result object holding the parsed scene, + * an array of animation clips and kinematics. + * + * @param {string} text - The raw Collada data as a string. + * @param {string} [path] - The asset path. + * @return {?{scene:Group,animations:Array,kinematics:Object}} An object representing the parsed asset. + */ + parse(text: string, path?: string): { + scene: Group; + animations: Array; + kinematics: Object; + } | null; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts new file mode 100644 index 000000000..1042415d7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts @@ -0,0 +1,30 @@ +/** + * A loader for the S3TC texture compression format. + * + * ```js + * const loader = new DDSLoader(); + * + * const map = loader.load( 'textures/compressed/disturb_dxt1_nomip.dds' ); + * map.colorSpace = THREE.SRGBColorSpace; // only for color textures + * ``` + * + * @augments CompressedTextureLoader + * @three_import import { DDSLoader } from 'three/addons/loaders/DDSLoader.js'; + */ +export class DDSLoader extends CompressedTextureLoader { + /** + * Constructs a new DDS loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Parses the given S3TC texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @param {boolean} loadMipmaps - Whether to load mipmaps or not. + * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data. + */ + parse(buffer: ArrayBuffer, loadMipmaps: boolean): CompressedTextureLoader; +} +import { CompressedTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts new file mode 100644 index 000000000..890f47cc5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts @@ -0,0 +1,125 @@ +/** + * A loader for the Draco format. + * + * [Draco](https://google.github.io/draco/) is an open source library for compressing + * and decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller, + * at the cost of additional decoding time on the client device. + * + * Standalone Draco files have a `.drc` extension, and contain vertex positions, normals, colors, + * and other attributes. Draco files do not contain materials, textures, animation, or node hierarchies – + * to use these features, embed Draco geometry inside of a glTF file. A normal glTF file can be converted + * to a Draco-compressed glTF file using [glTF-Pipeline](https://github.com/CesiumGS/gltf-pipeline). + * When using Draco with glTF, an instance of `DRACOLoader` will be used internally by {@link GLTFLoader}. + * + * It is recommended to create one DRACOLoader instance and reuse it to avoid loading and creating + * multiple decoder instances. + * + * `DRACOLoader` will automatically use either the JS or the WASM decoding library, based on + * browser capabilities. + * + * ```js + * const loader = new DRACOLoader(); + * const geometry = await loader.loadAsync( 'models/draco/bunny.drc' ); + * geometry.computeVertexNormals(); // optional + * + * loader.dispose(); + * ``` + * + * @augments Loader + * @three_import import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; + */ +export class DRACOLoader extends Loader { + /** + * Constructs a new Draco loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + decoderPaths: { + js: string; + wasm: string; + dep_js: string; + }; + decoderConfig: {}; + decoderBinary: any; + decoderPending: Promise | null; + workerLimit: number; + workerPool: any[]; + workerNextTaskID: number; + workerSourceURL: string; + defaultAttributeIDs: { + position: string; + normal: string; + color: string; + uv: string; + }; + defaultAttributeTypes: { + position: string; + normal: string; + color: string; + uv: string; + }; + /** + * Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins. + * + * @param {string|{js:string, wasm:string}} path - The decoder path, or a config object with explicit URLs for each decoder file. + * @return {DRACOLoader} A reference to this loader. + */ + setDecoderPath(path: string | { + js: string; + wasm: string; + }): DRACOLoader; + /** + * Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins. + * + * @deprecated + * @param {{type:('js'|'wasm')}} config - The decoder config. + * @return {DRACOLoader} A reference to this loader. + */ + setDecoderConfig(config: { + type: ("js" | "wasm"); + }): DRACOLoader; + /** + * Sets the maximum number of Web Workers to be used during decoding. + * A lower limit may be preferable if workers are also for other tasks in the application. + * + * @param {number} workerLimit - The worker limit. + * @return {DRACOLoader} A reference to this loader. + */ + setWorkerLimit(workerLimit: number): DRACOLoader; + /** + * Starts loading from the given URL and passes the loaded Draco asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given Draco data. + * + * @param {ArrayBuffer} buffer - The raw Draco data as an array buffer. + * @param {function(BufferGeometry)} onLoad - Executed when the loading/parsing process has been finished. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + parse(buffer: ArrayBuffer, onLoad: (arg0: BufferGeometry) => any, onError?: onErrorCallback): void; + decodeDracoFile(buffer: any, callback: any, attributeIDs: any, attributeTypes: any, vertexColorSpace?: string, onError?: () => void): any; + decodeGeometry(buffer: any, taskConfig: any): any; + _createGeometry(geometryData: any): BufferGeometry; + _assignVertexColorSpace(attribute: any, inputColorSpace: any): void; + _loadLibrary(url: any, responseType: any): Promise; + preload(): this; + _initDecoder(): Promise; + _getWorker(taskID: any, taskCost: any): Promise; + _releaseTask(worker: any, taskID: any): void; + debug(): void; + dispose(): this; +} +export namespace DRACO_GLTF_CONFIG { + let js: string; + let wasm: string; +} +import { Loader } from 'three'; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts new file mode 100644 index 000000000..4c061b02d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts @@ -0,0 +1,72 @@ +/** + * A loader for the OpenEXR texture format. + * + * `EXRLoader` currently supports uncompressed, ZIP(S), RLE, PIZ, B44/A and DWA/B compression. + * Supports reading as UnsignedByte, HalfFloat and Float type data texture. + * + * ```js + * const loader = new EXRLoader(); + * const texture = await loader.loadAsync( 'textures/memorial.exr' ); + * ``` + * + * @augments DataTextureLoader + * @three_import import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; + */ +export class EXRLoader extends DataTextureLoader { + /** + * Constructs a new EXR loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The texture type. + * + * @type {(HalfFloatType|FloatType)} + * @default HalfFloatType + */ + type: (number | number); + /** + * Texture output format. + * + * @type {(RGBAFormat|RGFormat|RedFormat)} + * @default RGBAFormat + */ + outputFormat: (number | number | number); + /** + * For multi-part EXR files, the index of the part to load. + * + * @type {number} + * @default 0 + */ + part: number; + /** + * Parses the given EXR texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @return {DataTextureLoader~TexData} An object representing the parsed texture data. + */ + parse(buffer: ArrayBuffer): DataTextureLoader; + /** + * Sets the texture type. + * + * @param {(HalfFloatType|FloatType)} value - The texture type to set. + * @return {EXRLoader} A reference to this loader. + */ + setDataType(value: (number | number)): EXRLoader; + /** + * Sets texture output format. Defaults to `RGBAFormat`. + * + * @param {(RGBAFormat|RGFormat|RedFormat)} value - Texture output format. + * @return {EXRLoader} A reference to this loader. + */ + setOutputFormat(value: (number | number | number)): EXRLoader; + /** + * For multi-part EXR files, sets which part to load. + * + * @param {number} value - The part index to load. + * @return {EXRLoader} A reference to this loader. + */ + setPart(value: number): EXRLoader; +} +import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts new file mode 100644 index 000000000..eb6f58adf --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts @@ -0,0 +1,61 @@ +/** + * A loader for the FBX format. + * + * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format. + * Versions lower than this may load but will probably have errors. + * + * Needs Support: + * - Morph normals / blend shape normals + * + * FBX format references: + * - [C++ SDK reference](https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html) + * + * Binary format specification: + * - [FBX binary file format specification](https://code.blender.org/2013/08/fbx-binary-file-format-specification/) + * + * ```js + * const loader = new FBXLoader(); + * const object = await loader.loadAsync( 'models/fbx/stanford-bunny.fbx' ); + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; + */ +export class FBXLoader extends Loader { + /** + * Constructs a new FBX loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Whether to trim animation clips to the time range of their + * animation stacks and shift them to start at time zero. Useful + * for assets that define multiple clips on a single timeline. + * + * @type {boolean} + * @default false + */ + trimAnimationClips: boolean; + /** + * Starts loading from the given URL and passes the loaded FBX asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given FBX data and returns the resulting group. + * + * @param {ArrayBuffer} FBXBuffer - The raw FBX data as an array buffer. + * @param {string} path - The URL base path. + * @return {Group} An object representing the parsed asset. + */ + parse(FBXBuffer: ArrayBuffer, path: string): Group; +} +import { Loader } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts new file mode 100644 index 000000000..0771ff5cc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts @@ -0,0 +1,75 @@ +/** + * A loader for loading fonts. + * + * You can convert fonts online using [facetype.js](https://gero3.github.io/facetype.js/). + * + * ```js + * const loader = new FontLoader(); + * const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' ); + * ``` + * + * @augments Loader + * @three_import import { FontLoader } from 'three/addons/loaders/FontLoader.js'; + */ +export class FontLoader extends Loader { + /** + * Constructs a new font loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded font + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Font)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Font) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given font data and returns the resulting font. + * + * @param {Object} json - The raw font data as a JSON object. + * @return {Font} The font. + */ + parse(json: Object): Font; +} +/** + * Class representing a font. + */ +export class Font { + /** + * Constructs a new font. + * + * @param {Object} data - The font data as JSON. + */ + constructor(data: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isFont: boolean; + type: string; + /** + * The font data as JSON. + * + * @type {Object} + */ + data: Object; + /** + * Generates geometry shapes from the given text and size. The result of this method + * should be used with {@link ShapeGeometry} to generate the actual geometry data. + * + * @param {string} text - The text. + * @param {number} [size=100] - The text size. + * @param {string} [direction='ltr'] - Char direction: ltr(left to right), rtl(right to left) & tb(top bottom). + * @return {Array} An array of shapes representing the text. + */ + generateShapes(text: string, size?: number, direction?: string): Array; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts new file mode 100644 index 000000000..5c0f7df3a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts @@ -0,0 +1,48 @@ +/** + * A loader for the GCode format. + * + * GCode files are usually used for 3D printing or CNC applications. + * + * ```js + * const loader = new GCodeLoader(); + * const object = await loader.loadAsync( 'models/gcode/benchy.gcode' ); + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js'; + */ +export class GCodeLoader extends Loader { + /** + * Constructs a new GCode loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Whether to split layers or not. + * + * @type {boolean} + * @default false + */ + splitLayer: boolean; + /** + * Starts loading from the given URL and passes the loaded GCode asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given GCode data and returns a group with lines. + * + * @param {string} data - The raw Gcode data as a string. + * @return {Group} The parsed GCode asset. + */ + parse(data: string): Group; +} +import { Loader } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts new file mode 100644 index 000000000..3d6d9392f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts @@ -0,0 +1,36 @@ +/** + * A glTF loader plugin for `KHR_gaussian_splatting`. + * + * This plugin must be registered explicitly because {@link GaussianSplat} + * requires {@link WebGPURenderer}. + * + * ```js + * const loader = new GLTFLoader(); + * loader.register( function ( parser ) { + * + * return new GLTFGaussianSplatLoaderExtension( parser ); + * + * } ); + * ``` + * + * @three_import import { GLTFGaussianSplatLoaderExtension } from 'three/addons/loaders/GLTFGaussianSplatLoaderExtension.js'; + */ +export class GLTFGaussianSplatLoaderExtension { + /** + * Constructs a new glTF gaussian splatting extension plugin. + * + * @param {GLTFParser} parser - The glTF parser. + */ + constructor(parser: GLTFParser); + name: string; + parser: GLTFParser; + /** + * Loads a glTF mesh containing gaussian splat primitives. + * + * @param {number} meshIndex - The mesh index. + * @return {?Promise} The loaded mesh or `null` when the mesh does not use this extension. + */ + loadMesh(meshIndex: number): Promise | null; +} +import { Group } from 'three'; +import { GaussianSplat } from '../objects/GaussianSplat.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts new file mode 100644 index 000000000..d29a15880 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts @@ -0,0 +1,396 @@ +/** + * ~LoadObject + */ +export type GLTFLoader = { + /** + * - An array of animation clips. + */ + animations: Array; + /** + * - Meta data about the loaded asset. + */ + asset: Object; + /** + * - An array of cameras. + */ + cameras: Array; + /** + * - A reference to the internal parser. + */ + parser: GLTFParser; + /** + * - The default scene. + */ + scene: Group; + /** + * - glTF assets might define multiple scenes. + */ + scenes: Array; + /** + * - Additional data. + */ + userData: Object; +}; +import { AnimationClip } from 'three'; +declare class GLTFParser { + constructor(json?: {}, options?: {}); + json: {}; + extensions: {}; + plugins: {}; + options: {}; + cache: any; + associations: Map; + primitiveCache: {}; + nodeCache: {}; + meshCache: { + refs: {}; + uses: {}; + }; + cameraCache: { + refs: {}; + uses: {}; + }; + lightCache: { + refs: {}; + uses: {}; + }; + sourceCache: {}; + textureCache: {}; + nodeNamesUsed: {}; + textureLoader: TextureLoader | ImageBitmapLoader; + fileLoader: FileLoader; + setExtensions(extensions: any): void; + setPlugins(plugins: any): void; + parse(onLoad: any, onError: any): void; + /** + * Marks the special nodes/meshes in json for efficient parse. + * + * @private + */ + private _markDefs; + /** + * Counts references to shared node / Object3D resources. These resources + * can be reused, or "instantiated", at multiple nodes in the scene + * hierarchy. Mesh, Camera, and Light instances are instantiated and must + * be marked. Non-scenegraph resources (like Materials, Geometries, and + * Textures) can be reused directly and are not marked here. + * + * Example: CesiumMilkTruck sample model reuses "Wheel" meshes. + * + * @private + * @param {Object} cache + * @param {Object3D} index + */ + private _addNodeRef; + /** + * Returns a reference to a shared resource, cloning it if necessary. + * + * @private + * @param {Object} cache + * @param {number} index + * @param {Object} object + * @return {Object} + */ + private _getNodeRef; + _invokeOne(func: any): any; + _invokeAll(func: any): any[]; + /** + * Requests the specified dependency asynchronously, with caching. + * + * @private + * @param {string} type + * @param {number} index + * @return {Promise} + */ + private getDependency; + /** + * Requests all dependencies of the specified type asynchronously, with caching. + * + * @private + * @param {string} type + * @return {Promise>} + */ + private getDependencies; + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views + * + * @private + * @param {number} bufferIndex + * @return {Promise} + */ + private loadBuffer; + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views + * + * @private + * @param {number} bufferViewIndex + * @return {Promise} + */ + private loadBufferView; + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors + * + * @private + * @param {number} accessorIndex + * @return {Promise} + */ + private loadAccessor; + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures + * + * @private + * @param {number} textureIndex + * @return {Promise} + */ + private loadTexture; + loadTextureImage(textureIndex: any, sourceIndex: any, loader: any): any; + loadImageSource(sourceIndex: any, loader: any): any; + /** + * Asynchronously assigns a texture to the given material parameters. + * + * @private + * @param {Object} materialParams + * @param {string} mapName + * @param {Object} mapDef + * @param {string} [colorSpace] + * @return {Promise} + */ + private assignTexture; + /** + * Assigns final material to a Mesh, Line, or Points instance. The instance + * already has a material (generated from the glTF material options alone) + * but reuse of the same glTF material may require multiple threejs materials + * to accommodate different primitive types, defines, etc. New materials will + * be created if necessary, and reused from a cache. + * + * @private + * @param {Object3D} mesh Mesh, Line, or Points instance. + */ + private assignFinalMaterial; + getMaterialType(): typeof MeshStandardMaterial; + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials + * + * @private + * @param {number} materialIndex + * @return {Promise} + */ + private loadMaterial; + /** + * When Object3D instances are targeted by animation, they need unique names. + * + * @private + * @param {string} originalName + * @return {string} + */ + private createUniqueName; + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry + * + * Creates BufferGeometries from primitives. + * + * @private + * @param {Array} primitives + * @return {Promise>} + */ + private loadGeometries; + /** + * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes + * + * @private + * @param {number} meshIndex + * @return {Promise} + */ + private loadMesh; + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras + * + * @private + * @param {number} cameraIndex + * @return {Promise|undefined} + */ + private loadCamera; + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins + * + * @private + * @param {number} skinIndex + * @return {Promise} + */ + private loadSkin; + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations + * + * @private + * @param {number} animationIndex + * @return {Promise} + */ + private loadAnimation; + createNodeMesh(nodeIndex: any): Promise | null; + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy + * + * @private + * @param {number} nodeIndex + * @return {Promise} + */ + private loadNode; + _loadNodeShallow(nodeIndex: any): any; + /** + * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes + * + * @private + * @param {number} sceneIndex + * @return {Promise} + */ + private loadScene; + _createAnimationTracks(node: any, inputAccessor: any, outputAccessor: any, sampler: any, target: any): QuaternionKeyframeTrack[]; + _getArrayFromAccessor(accessor: any): any; + _createCubicSplineTrackInterpolant(track: any): void; +} +import { Group } from 'three'; +/** + * A loader for the glTF 2.0 format. + * + * [glTF](https://www.khronos.org/gltf/) (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0) + * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb) + * format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver + * one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights, + * and/or cameras. + * + * `GLTFLoader` uses {@link ImageBitmapLoader} whenever possible. Be advised that image bitmaps are not + * automatically GC-collected when they are no longer referenced, and they require special handling during + * the disposal process. + * + * `GLTFLoader` supports the following glTF 2.0 extensions: + * - KHR_draco_mesh_compression + * - KHR_lights_punctual + * - KHR_materials_anisotropy + * - KHR_materials_clearcoat + * - KHR_materials_dispersion + * - KHR_materials_emissive_strength + * - KHR_materials_ior + * - KHR_materials_specular + * - KHR_materials_transmission + * - KHR_materials_iridescence + * - KHR_materials_unlit + * - KHR_materials_volume + * - KHR_mesh_quantization + * - KHR_meshopt_compression + * - KHR_texture_basisu + * - KHR_texture_transform + * - EXT_materials_bump + * - EXT_meshopt_compression + * - EXT_mesh_gpu_instancing + * - EXT_texture_avif + * - EXT_texture_webp + * + * The following glTF 2.0 extensions are supported by separately registered plugins: + * - KHR_gaussian_splatting + * - [KHR_materials_variants](https://github.com/takahirox/three-gltf-extensions) + * - [MSFT_texture_dds](https://github.com/takahirox/three-gltf-extensions) + * - [KHR_animation_pointer](https://github.com/needle-tools/three-animation-pointer) + * - [NEEDLE_progressive](https://github.com/needle-tools/gltf-progressive) + * + * ```js + * const loader = new GLTFLoader(); + * + * // Optional: Provide a DRACOLoader instance to decode compressed mesh data + * const dracoLoader = new DRACOLoader(); + * dracoLoader.setDecoderPath( '/examples/jsm/libs/draco/' ); + * loader.setDRACOLoader( dracoLoader ); + * + * const gltf = await loader.loadAsync( 'models/gltf/duck/duck.gltf' ); + * scene.add( gltf.scene ); + * ``` + * + * @augments Loader + * @three_import import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + */ +export class GLTFLoader extends Loader { + /** + * Constructs a new glTF loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + dracoLoader: any; + ktx2Loader: any; + meshoptDecoder: Object | null; + pluginCallbacks: any[]; + /** + * Starts loading from the given URL and passes the loaded glTF asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Sets the given Draco loader to this loader. Required for decoding assets + * compressed with the `KHR_draco_mesh_compression` extension. + * + * @param {DRACOLoader} dracoLoader - The Draco loader to set. + * @return {GLTFLoader} A reference to this loader. + */ + setDRACOLoader(dracoLoader: DRACOLoader): GLTFLoader; + /** + * Sets the given KTX2 loader to this loader. Required for loading KTX2 + * compressed textures. + * + * @param {KTX2Loader} ktx2Loader - The KTX2 loader to set. + * @return {GLTFLoader} A reference to this loader. + */ + setKTX2Loader(ktx2Loader: KTX2Loader): GLTFLoader; + /** + * Sets the given meshopt decoder. Required for decoding assets + * compressed with the `EXT_meshopt_compression` extension. + * + * @param {Object} meshoptDecoder - The meshopt decoder to set. + * @return {GLTFLoader} A reference to this loader. + */ + setMeshoptDecoder(meshoptDecoder: Object): GLTFLoader; + /** + * Registers a plugin callback. This API is internally used to implement the various + * glTF extensions but can also used by third-party code to add additional logic + * to the loader. + * + * @param {function(parser:GLTFParser)} callback - The callback function to register. + * @return {GLTFLoader} A reference to this loader. + */ + register(callback: any): GLTFLoader; + /** + * Unregisters a plugin callback. + * + * @param {Function} callback - The callback function to unregister. + * @return {GLTFLoader} A reference to this loader. + */ + unregister(callback: Function): GLTFLoader; + /** + * Parses the given glTF data and returns the resulting group. + * + * @param {string|ArrayBuffer} data - The raw glTF data. + * @param {string} path - The URL base path. + * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + parse(data: string | ArrayBuffer, path: string, onLoad: any, onError: onErrorCallback): void; + /** + * Async version of {@link GLTFLoader#parse}. + * + * @async + * @param {string|ArrayBuffer} data - The raw glTF data. + * @param {string} path - The URL base path. + * @return {Promise} A Promise that resolves with the loaded glTF when the parsing has been finished. + */ + parseAsync(data: string | ArrayBuffer, path: string): Promise; +} +import { TextureLoader } from 'three'; +import { ImageBitmapLoader } from 'three'; +import { FileLoader } from 'three'; +import { MeshStandardMaterial } from 'three'; +import { QuaternionKeyframeTrack } from 'three'; +import { Loader } from 'three'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts new file mode 100644 index 000000000..5d05d065a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts @@ -0,0 +1,52 @@ +/** + * A loader for Gaussian splat PLY files, e.g. as exported by the original + * GraphDECO/INRIA 3D Gaussian Splatting implementation. + * + * PLY itself is a generic format, so the caller would normally have to know + * the file's spherical harmonics (SH) degree ahead of time to configure + * `PLYLoader` with the right custom property mapping before parsing. This + * loader avoids that by scanning the plain-text PLY header for `f_rest_N` + * properties first, since SH degree maps to a fixed, closed table of + * `f_rest` counts (0/9/24/45 -> degree 0/1/2/3), and configuring an + * internal `PLYLoader` accordingly before converting the result into + * Gaussian splat geometry. + * + * ```js + * const loader = new GaussianSplatPLYLoader(); + * const geometry = await loader.loadAsync( './models/gsplat/point_cloud.ply' ); + * scene.add( new GaussianSplat( geometry ) ); + * ``` + * + * @augments Loader + * @three_import import { GaussianSplatPLYLoader } from 'three/addons/loaders/GaussianSplatPLYLoader.js'; + */ +export class GaussianSplatPLYLoader extends Loader { + /** + * Constructs a new Gaussian splat PLY loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded Gaussian splat + * geometry to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given Gaussian splat PLY data and returns the resulting + * Gaussian splat geometry. + * + * This scans the PLY header for the file's spherical harmonics degree, + * so unlike a plain `PLYLoader`, no prior setup is required. + * + * @param {ArrayBuffer|string} data - The raw PLY data, as an array buffer or string. + * @return {BufferGeometry} The parsed Gaussian splat geometry. + */ + parse(data: ArrayBuffer | string): BufferGeometry; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts new file mode 100644 index 000000000..2ca2298ee --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts @@ -0,0 +1,58 @@ +/** + * A loader for loading HDR cube textures. + * + * ```js + * const loader = new HDRCubeTextureLoader(); + * loader.setPath( 'textures/cube/pisaHDR/' ); + * const cubeTexture = await loader.loadAsync( [ 'px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr' ] ); + * + * scene.background = cubeTexture; + * scene.environment = cubeTexture; + * ``` + * + * @augments Loader + * @three_import import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; + */ +export class HDRCubeTextureLoader extends Loader { + /** + * Constructs a new HDR cube texture loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The internal HDR loader that loads the + * individual textures for each cube face. + * + * @type {HDRLoader} + */ + hdrLoader: HDRLoader; + /** + * The texture type. + * + * @type {(HalfFloatType|FloatType)} + * @default HalfFloatType + */ + type: (number | number); + /** + * Starts loading from the given URLs and passes the loaded HDR cube texture + * to the `onLoad()` callback. + * + * @param {Array} urls - The paths/URLs of the files to be loaded. This can also be a data URIs. + * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + * @return {CubeTexture} The HDR cube texture. + */ + load(urls: Array, onLoad: (arg0: CubeTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): CubeTexture; + /** + * Sets the texture type. + * + * @param {(HalfFloatType|FloatType)} value - The texture type to set. + * @return {HDRCubeTextureLoader} A reference to this loader. + */ + setDataType(value: (number | number)): HDRCubeTextureLoader; +} +import { Loader } from 'three'; +import { HDRLoader } from '../loaders/HDRLoader.js'; +import { CubeTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts new file mode 100644 index 000000000..ac05b5206 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts @@ -0,0 +1,44 @@ +/** + * A loader for the RGBE HDR texture format. + * + * ```js + * const loader = new HDRLoader(); + * const envMap = await loader.loadAsync( 'textures/equirectangular/blouberg_sunrise_2_1k.hdr' ); + * envMap.mapping = THREE.EquirectangularReflectionMapping; + * + * scene.environment = envMap; + * ``` + * + * @augments DataTextureLoader + * @three_import import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + */ +export class HDRLoader extends DataTextureLoader { + /** + * Constructs a new RGBE/HDR loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The texture type. + * + * @type {(HalfFloatType|FloatType)} + * @default HalfFloatType + */ + type: (number | number); + /** + * Parses the given RGBE texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @return {DataTextureLoader~TexData} An object representing the parsed texture data. + */ + parse(buffer: ArrayBuffer): DataTextureLoader; + /** + * Sets the texture type. + * + * @param {(HalfFloatType|FloatType)} value - The texture type to set. + * @return {HDRLoader} A reference to this loader. + */ + setDataType(value: (number | number)): HDRLoader; +} +import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts new file mode 100644 index 000000000..15453e42e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts @@ -0,0 +1,51 @@ +/** + * A loader for the IES format. + * + * The loaded texture should be assigned to {@link IESSpotLight#map}. + * + * ```js + * const loader = new IESLoader(); + * const texture = await loader.loadAsync( 'ies/007cfb11e343e2f42e3b476be4ab684e.ies' ); + * + * const spotLight = new THREE.IESSpotLight( 0xff0000, 500 ); + * spotLight.iesMap = texture; + * ``` + * + * @augments Loader + * @three_import import { IESLoader } from 'three/addons/loaders/IESLoader.js'; + */ +export class IESLoader extends Loader { + /** + * Constructs a new IES loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The texture type. + * + * @type {(HalfFloatType|FloatType)} + * @default HalfFloatType + */ + type: (number | number); + _getIESValues(iesLamp: any, type: any): Uint8Array | Uint16Array | Float32Array | null; + /** + * Starts loading from the given URL and passes the loaded IES texture + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: DataTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given IES data. + * + * @param {string} text - The raw IES data. + * @return {DataTexture} THE IES data as a texture. + */ + parse(text: string): DataTexture; +} +import { Loader } from 'three'; +import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts new file mode 100644 index 000000000..17775a709 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts @@ -0,0 +1,38 @@ +/** + * A loader for the KMZ format. + * + * ```js + * const loader = new KMZLoader(); + * const kmz = await loader.loadAsync( './models/kmz/Box.kmz' ); + * + * scene.add( kmz.scene ); + * ``` + * + * @augments Loader + * @three_import import { KMZLoader } from 'three/addons/loaders/KMZLoader.js'; + */ +export class KMZLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded KMZ asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({scene:Group})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + scene: Group; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given KMZ data and returns an object holding the scene. + * + * @param {ArrayBuffer} data - The raw KMZ data as an array buffer. + * @return {{scene:Group}} The parsed KMZ asset. + */ + parse(data: ArrayBuffer): { + scene: Group; + }; +} +import { Loader } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts new file mode 100644 index 000000000..3100ddd36 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts @@ -0,0 +1,44 @@ +/** + * A loader for GaussianSplats3D `.ksplat` files. + * + * This loader decodes the format into `BufferGeometry` for use with + * `GaussianSplat`. Higher-order spherical harmonics are exposed as optional + * `sphericalHarmonics1` through `sphericalHarmonics3` packed uint32 geometry + * attributes (`SH_BAND_WORDS[ degree ]` words per splat). Coefficients use the + * clamped-byte encoding `( value - 128 ) / 128`, four bytes per word. + * + * ```js + * const loader = new KSPLATLoader(); + * const data = await loader.loadAsync( './models/gsplat/example.ksplat' ); + * scene.add( new GaussianSplat( data ) ); + * ``` + * + * @augments Loader + * @three_import import { KSPLATLoader } from 'three/addons/loaders/KSPLATLoader.js'; + */ +export class KSPLATLoader extends Loader { + /** + * Constructs a new Gaussian splat KSPLAT loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded splat data to + * the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given `.ksplat` data. + * + * @param {ArrayBuffer} buffer - The raw KSPLAT file as an array buffer. + * @return {BufferGeometry} The parsed splat geometry. + */ + parse(buffer: ArrayBuffer): BufferGeometry; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts new file mode 100644 index 000000000..064241afc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts @@ -0,0 +1,188 @@ +/** + * A loader for KTX 2.0 GPU Texture containers. + * + * KTX 2.0 is a container format for various GPU texture formats. The loader supports Basis Universal GPU textures, + * which can be quickly transcoded to a wide variety of GPU texture compression formats. While KTX 2.0 also allows + * other hardware-specific formats, this loader does not yet parse them. + * + * This loader parses the KTX 2.0 container and transcodes to a supported GPU compressed texture format. + * The required WASM transcoder and JS wrapper are available from the `examples/jsm/libs/basis` directory. + * + * This loader relies on Web Assembly which is not supported in older browsers. + * + * References: + * - [KTX specification](http://github.khronos.org/KTX-Specification/) + * - [DFD](https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor) + * - [BasisU HDR](https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0) + * + * ```js + * const loader = new KTX2Loader(); + * loader.setTranscoderPath( 'examples/jsm/libs/basis/' ); + * loader.detectSupport( renderer ); + * const texture = loader.loadAsync( 'diffuse.ktx2' ); + * ``` + * + * @augments Loader + * @three_import import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; + */ +export class KTX2Loader extends Loader { + /** + * Constructs a new KTX2 loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + transcoderPath: string; + transcoderBinary: any; + transcoderPending: Promise | null; + workerPool: WorkerPool; + workerSourceURL: string; + workerConfig: { + astcSupported: any; + astcHDRSupported: boolean; + etc1Supported: any; + etc2Supported: any; + dxtSupported: any; + bptcSupported: any; + pvrtcSupported: any; + } | { + astcSupported: any; + astcHDRSupported: any; + etc1Supported: any; + etc2Supported: any; + dxtSupported: any; + bptcSupported: any; + pvrtcSupported: any; + } | null; + /** + * Sets the transcoder path to optionally set the decoder load path from a CDN. + * + * By default The WASM transcoder and JS wrapper are loaded from the `examples/jsm/libs/basis` directory. + * + * @param {string} path - The transcoder path to set. + * @return {KTX2Loader} A reference to this loader. + */ + setTranscoderPath(path: string): KTX2Loader; + /** + * Sets the maximum number of Web Workers to be allocated by this instance. + * + * @param {number} workerLimit - The worker limit. + * @return {KTX2Loader} A reference to this loader. + */ + setWorkerLimit(workerLimit: number): KTX2Loader; + /** + * Async version of {@link KTX2Loader#detectSupport}. + * + * @async + * @deprecated + * @param {WebGPURenderer} renderer - The renderer. + * @return {Promise} A Promise that resolves when the support has been detected. + */ + detectSupportAsync(renderer: WebGPURenderer): Promise; + /** + * Detects hardware support for available compressed texture formats, to determine + * the output format for the transcoder. Must be called before loading a texture. + * + * @param {WebGPURenderer|WebGLRenderer} renderer - The renderer. + * @return {KTX2Loader} A reference to this loader. + */ + detectSupport(renderer: WebGPURenderer | WebGLRenderer): KTX2Loader; + init(): Promise; + /** + * Starts loading from the given URL and passes the loaded KTX2 texture + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(CompressedTexture)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: CompressedTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given KTX2 data. + * + * @param {ArrayBuffer} buffer - The raw KTX2 data as an array buffer. + * @param {function(CompressedTexture)} onLoad - Executed when the loading/parsing process has been finished. + * @param {onErrorCallback} onError - Executed when errors occur. + * @returns {Promise} A Promise that resolves when the parsing has been finished. + */ + parse(buffer: ArrayBuffer, onLoad: (arg0: CompressedTexture) => any, onError: onErrorCallback): Promise; + _createTextureFrom(transcodeResult: any, container: any): CompressedTexture | Promise; + /** + * @private + * @param {ArrayBuffer} buffer + * @param {?Object} config + * @return {Promise} + */ + private _createTexture; + /** + * Frees internal resources. This method should be called + * when the loader is no longer required. + */ + dispose(): void; +} +export namespace KTX2Loader { + namespace BasisFormat { + let ETC1S: number; + let UASTC: number; + let UASTC_HDR: number; + } + namespace TranscoderFormat { + let ETC1: number; + let ETC2: number; + let BC1: number; + let BC3: number; + let BC4: number; + let BC5: number; + let BC7_M6_OPAQUE_ONLY: number; + let BC7_M5: number; + let PVRTC1_4_RGB: number; + let PVRTC1_4_RGBA: number; + let ASTC_4x4: number; + let ATC_RGB: number; + let ATC_RGBA_INTERPOLATED_ALPHA: number; + let RGBA32: number; + let RGB565: number; + let BGR565: number; + let RGBA4444: number; + let BC6H: number; + let RGB_HALF: number; + let RGBA_HALF: number; + } + namespace EngineFormat { + export { RGBAFormat }; + export { RGBA_ASTC_4x4_Format }; + export { RGB_BPTC_UNSIGNED_Format }; + export { RGBA_BPTC_Format }; + export { RGBA_ETC2_EAC_Format }; + export { RGBA_PVRTC_4BPPV1_Format }; + export { RGBA_S3TC_DXT5_Format }; + export { RGB_ETC1_Format }; + export { RGB_ETC2_Format }; + export { RGB_PVRTC_4BPPV1_Format }; + export { RGBA_S3TC_DXT1_Format }; + } + namespace EngineType { + export { UnsignedByteType }; + export { HalfFloatType }; + export { FloatType }; + } + function BasisWorker(): void; +} +import { Loader } from 'three'; +import { WorkerPool } from '../utils/WorkerPool.js'; +import { CompressedTexture } from 'three'; +import { RGBAFormat } from 'three'; +import { RGBA_ASTC_4x4_Format } from 'three'; +import { RGB_BPTC_UNSIGNED_Format } from 'three'; +import { RGBA_BPTC_Format } from 'three'; +import { RGBA_ETC2_EAC_Format } from 'three'; +import { RGBA_PVRTC_4BPPV1_Format } from 'three'; +import { RGBA_S3TC_DXT5_Format } from 'three'; +import { RGB_ETC1_Format } from 'three'; +import { RGB_ETC2_Format } from 'three'; +import { RGB_PVRTC_4BPPV1_Format } from 'three'; +import { RGBA_S3TC_DXT1_Format } from 'three'; +import { UnsignedByteType } from 'three'; +import { HalfFloatType } from 'three'; +import { FloatType } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts new file mode 100644 index 000000000..931e4f47a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts @@ -0,0 +1,34 @@ +/** + * A loader for the KTX texture compression format. + * + * References: + * - [The KTX File Format and Tools](https://www.khronos.org/opengles/sdk/tools/KTX/) + * - [Babylon.JS khronosTextureContainer.ts](https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts) + * + * ```js + * const loader = new KTXLoader(); + * + * const map = loader.load( 'textures/compressed/lensflare_ASTC8x8.ktx' ) + * map.colorSpace = THREE.SRGBColorSpace; // only for color textures + * ``` + * + * @augments CompressedTextureLoader + * @three_import import { KTXLoader } from 'three/addons/loaders/KTXLoader.js'; + */ +export class KTXLoader extends CompressedTextureLoader { + /** + * Constructs a new KTX loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Parses the given KTX texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @param {boolean} loadMipmaps - Whether to load mipmaps or not. + * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data. + */ + parse(buffer: ArrayBuffer, loadMipmaps: boolean): CompressedTextureLoader; +} +import { CompressedTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts new file mode 100644 index 000000000..53f42fbe0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts @@ -0,0 +1,256 @@ +/** + * A loader for the LDraw format. + * + * [LDraw](https://ldraw.org/} (LEGO Draw) is an [open format specification](https://ldraw.org/article/218.html) + * for describing LEGO and other construction set 3D models. + * + * An LDraw asset (a text file usually with extension .ldr, .dat or .txt) can describe just a single construction + * piece, or an entire model. In the case of a model the LDraw file can reference other LDraw files, which are + * loaded from a library path set with `setPartsLibraryPath`. You usually download the LDraw official parts library, + * extract to a folder and point setPartsLibraryPath to it. + * + * Library parts will be loaded by trial and error in subfolders 'parts', 'p' and 'models'. These file accesses + * are not optimal for web environment, so a script tool has been made to pack an LDraw file with all its dependencies + * into a single file, which loads much faster. See section 'Packing LDraw models'. The LDrawLoader example loads + * several packed files. The official parts library is not included due to its large size. + * + * `LDrawLoader` supports the following extensions: + * - !COLOUR: Color and surface finish declarations. + * - BFC: Back Face Culling specification. + * - !CATEGORY: Model/part category declarations. + * - !KEYWORDS: Model/part keywords declarations. + * + * ```js + * const loader = new LDrawLoader(); + * loader.setConditionalLineMaterial( LDrawConditionalLineMaterial ); // the type of line material depends on the used renderer + * const object = await loader.loadAsync( 'models/ldraw/officialLibrary/models/car.ldr_Packed.mpd' ); + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { LDrawLoader } from 'three/addons/loaders/LDrawLoader.js'; + */ +export class LDrawLoader extends Loader { + /** + * Constructs a new LDraw loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + materials: any[]; + materialLibrary: {}; + edgeMaterialCache: WeakMap; + conditionalEdgeMaterialCache: WeakMap; + partsCache: LDrawPartsGeometryCache; + fileMap: {}; + smoothNormals: boolean; + partsLibraryPath: string; + ConditionalLineMaterial: any; + missingColorMaterial: MeshStandardMaterial; + missingEdgeColorMaterial: LineBasicMaterial; + missingConditionalEdgeColorMaterial: any; + /** + * This method must be called prior to `load()` unless the model to load does not reference + * library parts (usually it will be a model with all its parts packed in a single file). + * + * @param {string} path - Path to library parts files to load referenced parts from. + * This is different from Loader.setPath, which indicates the path to load the main asset from. + * @return {LDrawLoader} A reference to this loader. + */ + setPartsLibraryPath(path: string): LDrawLoader; + /** + * Sets the conditional line material type which depends on the used renderer. + * Use {@link LDrawConditionalLineMaterial} when using `WebGLRenderer` and + * {@link LDrawConditionalLineNodeMaterial} when using `WebGPURenderer`. + * + * @param {(LDrawConditionalLineMaterial.constructor|LDrawConditionalLineNodeMaterial.constructor)} type - The conditional line material type. + * @return {LDrawLoader} A reference to this loader. + */ + setConditionalLineMaterial(type: (LDrawConditionalLineMaterial.constructor | LDrawConditionalLineNodeMaterial.constructor)): LDrawLoader; + /** + * This async method preloads materials from a single LDraw file. In the official + * parts library there is a special file which is loaded always the first (LDConfig.ldr) + * and contains all the standard color codes. This method is intended to be used with + * not packed files, for example in an editor where materials are preloaded and parts + * are loaded on demand. + * + * @async + * @param {string} url - Path of the LDraw materials asset. + * @return {Promise} A Promise that resolves when the preload has finished. + */ + preloadMaterials(url: string): Promise; + /** + * Starts loading from the given URL and passes the loaded LDraw asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given LDraw data and returns the resulting group. + * + * @param {string} text - The raw VRML data as a string. + * @param {function(Group)} onLoad - Executed when the loading/parsing process has been finished. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + parse(text: string, onLoad: (arg0: Group) => any, onError: onErrorCallback): void; + /** + * Sets the loader's material library. This method clears existing + * material definitions. + * + * @param {Array} materials - The materials to set. + * @return {LDrawLoader} A reference to this loader. + */ + setMaterials(materials: Array): LDrawLoader; + /** + * Clears the loader's material library. + * + * @return {LDrawLoader} A reference to this loader. + */ + clearMaterials(): LDrawLoader; + /** + * Adds a list of materials to the loader's material library. + * + * @param {Array} materials - The materials to add. + * @return {LDrawLoader} A reference to this loader. + */ + addMaterials(materials: Array): LDrawLoader; + /** + * Initializes the loader with default materials. + * + * @return {LDrawLoader} A reference to this loader. + */ + addDefaultMaterials(): LDrawLoader; + /** + * Sets a map which maps referenced library filenames to new filenames. + * If a fileMap is not specified (the default), library parts will be accessed by trial and + * error in subfolders 'parts', 'p' and 'models'. + * + * @param {Object} fileMap - The file map to set. + * @return {LDrawLoader} A reference to this loader. + */ + setFileMap(fileMap: { + [x: string]: string; + }): LDrawLoader; + /** + * Adds a single material to the loader's material library. + * + * @param {Material} material - The material to add. + * @return {LDrawLoader} A reference to this loader. + */ + addMaterial(material: Material): LDrawLoader; + /** + * Returns a material for the given color code. + * + * @param {string} colorCode - The color code. + * @return {?Material} The material. Returns `null` if no material has been found. + */ + getMaterial(colorCode: string): Material | null; + applyMaterialsToMesh(group: any, parentColorCode: any, materialHierarchy: any, finalMaterialPass?: boolean): void; + /** + * Returns the Material for the main LDraw color. + * + * For an already loaded LDraw asset, returns the Material associated with the main color code. + * This method can be useful to modify the main material of a model or part that exposes it. + * + * The main color code is the standard way to color an LDraw part. It is '16' for triangles and + * '24' for edges. Usually a complete model will not expose the main color (that is, no part + * uses the code '16' at the top level, because they are assigned other specific colors) An LDraw + * part file on the other hand will expose the code '16' to be colored, and can have additional + * fixed colors. + * + * @return {?Material} The material. Returns `null` if no material has been found. + */ + getMainMaterial(): Material | null; + /** + * Returns the material for the edges main LDraw color. + * + * @return {?Material} The material. Returns `null` if no material has been found. + */ + getMainEdgeMaterial(): Material | null; + parseColorMetaDirective(lineParser: any): MeshStandardMaterial | null; + computeBuildingSteps(model: any): void; +} +import { Loader } from 'three'; +declare class LDrawPartsGeometryCache { + constructor(loader: any); + loader: any; + parseCache: LDrawParsedCache; + _cache: {}; + processIntoMesh(info: any): Promise; + hasCachedModel(fileName: any): boolean; + getCachedModel(fileName: any): Promise; + loadModel(fileName: any): Promise; + parseModel(text: any): Promise; +} +import { MeshStandardMaterial } from 'three'; +import { LineBasicMaterial } from 'three'; +import { Group } from 'three'; +declare class LDrawParsedCache { + constructor(loader: any); + loader: any; + _cache: {}; + cloneResult(original: any): { + faces: any; + conditionalSegments: any; + lineSegments: any; + type: any; + category: any; + keywords: any; + author: any; + subobjects: any; + fileName: any; + totalFaces: any; + startingBuildingStep: any; + materials: any; + group: any; + }; + fetchData(fileName: any): Promise; + parse(text: any, fileName?: null): { + faces: { + material: any; + colorCode: any; + faceNormal: null; + vertices: Vector3[]; + normals: null[]; + doubleSided: boolean; + }[]; + conditionalSegments: { + material: any; + colorCode: any; + vertices: Vector3[]; + controlPoints: Vector3[]; + }[]; + lineSegments: { + material: any; + colorCode: any; + vertices: Vector3[]; + }[]; + type: string; + category: any; + keywords: any[] | null; + author: any; + subobjects: { + material: any; + colorCode: any; + matrix: Matrix4; + fileName: any; + inverted: boolean; + startingBuildingStep: boolean; + }[]; + totalFaces: number; + startingBuildingStep: boolean; + materials: {}; + fileName: null; + group: null; + }; + getData(fileName: any, clone?: boolean): any; + ensureDataLoaded(fileName: any): Promise; + setData(fileName: any, text: any): void; +} +import { Vector3 } from 'three'; +import { Matrix4 } from 'three'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts new file mode 100644 index 000000000..86866f649 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts @@ -0,0 +1,62 @@ +/** + * A loader for the 3DL LUT format. + * + * References: + * - [3D LUTs](http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492) + * - [Format Spec for .3dl](https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258) + * + * ```js + * const loader = new LUT3dlLoader(); + * const map = loader.loadAsync( 'luts/Presetpro-Cinematic.3dl' ); + * ``` + * + * @augments Loader + * @three_import import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js'; + */ +export class LUT3dlLoader extends Loader { + /** + * Constructs a new 3DL LUT loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The texture type. + * + * @type {(UnsignedByteType|FloatType)} + * @default UnsignedByteType + */ + type: (number | FloatType); + /** + * Sets the texture type. + * + * @param {(UnsignedByteType|FloatType)} type - The texture type to set. + * @return {LUT3dlLoader} A reference to this loader. + */ + setType(type: (number | FloatType)): LUT3dlLoader; + /** + * Starts loading from the given URL and passes the loaded 3DL LUT asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({size:number,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + size: number; + texture3D: Data3DTexture; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given 3DL LUT data and returns the resulting 3D data texture. + * + * @param {string} input - The raw 3DL LUT data as a string. + * @return {{size:number,texture3D:Data3DTexture}} The parsed 3DL LUT. + */ + parse(input: string): { + size: number; + texture3D: Data3DTexture; + }; +} +import { Loader } from 'three'; +import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts new file mode 100644 index 000000000..9632d7613 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts @@ -0,0 +1,68 @@ +/** + * A loader for the Cube LUT format. + * + * References: + * - [Cube LUT Specification](https://web.archive.org/web/20220220033515/https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf) + * + * ```js + * const loader = new LUTCubeLoader(); + * const map = loader.loadAsync( 'luts/Bourbon 64.CUBE' ); + * ``` + * + * @augments Loader + * @three_import import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js'; + */ +export class LUTCubeLoader extends Loader { + /** + * Constructs a new Cube LUT loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The texture type. + * + * @type {(UnsignedByteType|FloatType)} + * @default UnsignedByteType + */ + type: (number | FloatType); + /** + * Sets the texture type. + * + * @param {(UnsignedByteType|FloatType)} type - The texture type to set. + * @return {LUTCubeLoader} A reference to this loader. + */ + setType(type: (number | FloatType)): LUTCubeLoader; + /** + * Starts loading from the given URL and passes the loaded Cube LUT asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + title: string; + size: number; + domainMin: Vector3; + domainMax: Vector3; + texture3D: Data3DTexture; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given Cube LUT data and returns the resulting 3D data texture. + * + * @param {string} input - The raw Cube LUT data as a string. + * @return {{title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture}} The parsed Cube LUT. + */ + parse(input: string): { + title: string; + size: number; + domainMin: Vector3; + domainMax: Vector3; + texture3D: Data3DTexture; + }; +} +import { Loader } from 'three'; +import { Vector3 } from 'three'; +import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts new file mode 100644 index 000000000..82ad5b541 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts @@ -0,0 +1,58 @@ +/** + * A loader for loading LUT images. + * + * ```js + * const loader = new LUTImageLoader(); + * const map = loader.loadAsync( 'luts/NeutralLUT.png' ); + * ``` + * + * @augments Loader + * @three_import import { LUTImageLoader } from 'three/addons/loaders/LUTImageLoader.js'; + */ +export class LUTImageLoader extends Loader { + /** + * Constructs a new LUT loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Whether to vertically flip the LUT or not. + * + * Depending on the LUT's origin, the texture has green at the bottom (e.g. for Unreal) + * or green at the top (e.g. for Unity URP Color Lookup). If you're using lut image strips + * from a Unity pipeline, then set this property to `true`. + * + * @type {boolean} + * @default false + */ + flip: boolean; + /** + * Starts loading from the given URL and passes the loaded LUT + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({size:number,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + size: number; + texture3D: Data3DTexture; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given LUT data and returns the resulting 3D data texture. + * + * @param {Uint8ClampedArray} dataArray - The raw LUT data. + * @param {number} size - The LUT size. + * @return {{size:number,texture3D:Data3DTexture}} An object representing the parsed LUT. + */ + parse(dataArray: Uint8ClampedArray, size: number): { + size: number; + texture3D: Data3DTexture; + }; + _getImageData(texture: any): ImageData; + _horz2Vert(texture: any): ImageData; +} +import { Loader } from 'three'; +import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts new file mode 100644 index 000000000..d41e3dac0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts @@ -0,0 +1,57 @@ +/** + * A loader for the LWO format. + * + * LWO3 and LWO2 formats are supported. + * + * References: + * - [LWO3 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html) + * - [LWO2 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html) + * + * ```js + * const loader = new LWOLoader(); + * const lwoData = await loader.loadAsync( 'models/lwo/Objects/LWO3/Demo.lwo' ); + * + * const mesh = object.meshes[ 0 ]; + * scene.add( mesh ); + * ``` + * + * @augments Loader + * @three_import import { LWOLoader } from 'three/addons/loaders/LWOLoader.js'; + * @deprecated since r185. + */ +export class LWOLoader extends Loader { + /** + * Constructs a new LWO loader. + * + * @param {LoadingManager} [manager] - The loading manager. + * @deprecated since r185. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded LWO asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({meshes:Array,materials:Array})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + meshes: Array; + materials: Array; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given LWO data and returns the resulting meshes and materials. + * + * @param {ArrayBuffer} iffBuffer - The raw LWO data as an array buffer. + * @param {string} path - The URL base path. + * @param {string} modelName - The model name. + * @return {{meshes:Array,materials:Array}} An object holding the parse meshes and materials. + */ + parse(iffBuffer: ArrayBuffer, path: string, modelName: string): { + meshes: Array; + materials: Array; + }; +} +import { Loader } from 'three'; +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts new file mode 100644 index 000000000..8a30bffd1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts @@ -0,0 +1,43 @@ +/** + * A loader for the MD2 format. + * + * The loader represents the animations of the MD2 asset as an array of animation + * clips and stores them in the `animations` property of the geometry. + * + * ```js + * const loader = new MD2Loader(); + * const geometry = await loader.loadAsync( './models/md2/ogro/ogro.md2' ); + * + * const animations = geometry.animations; + * ``` + * + * @augments Loader + * @three_import import { MD2Loader } from 'three/addons/loaders/MD2Loader.js'; + */ +export class MD2Loader extends Loader { + /** + * Constructs a new MD2 loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded MD2 asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. + * @param {onErrorCallback} [onError] - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress?: onProgressCallback, onError?: onErrorCallback): void; + /** + * Parses the given MD2 data and returns a geometry. + * + * @param {ArrayBuffer} buffer - The raw MD2 data as an array buffer. + * @return {BufferGeometry} The parsed geometry data. + */ + parse(buffer: ArrayBuffer): BufferGeometry; +} +import { Loader } from 'three'; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts new file mode 100644 index 000000000..428e8f4ad --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts @@ -0,0 +1,71 @@ +/** + * A loader for the MDD format. + * + * MDD stores a position for every vertex in a model for every frame in an animation. + * Similar to BVH, it can be used to transfer animation data between different 3D applications or engines. + * + * MDD stores its data in binary format (big endian) in the following way: + * + * - number of frames (a single uint32) + * - number of vertices (a single uint32) + * - time values for each frame (sequence of float32) + * - vertex data for each frame (sequence of float32) + * + * ```js + * const loader = new MDDLoader(); + * const result = await loader.loadAsync( 'models/mdd/cube.mdd' ); + * + * const morphTargets = result.morphTargets; + * const clip = result.clip; + * // clip.optimize(); // optional + * + * const geometry = new THREE.BoxGeometry(); + * geometry.morphAttributes.position = morphTargets; // apply morph targets (vertex data must match) + * + * const material = new THREE.MeshBasicMaterial(); + * + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * + * const mixer = new THREE.AnimationMixer( mesh ); + * mixer.clipAction( clip ).play(); + * ``` + * + * @augments Loader + * @three_import import { MDDLoader } from 'three/addons/loaders/MDDLoader.js'; + */ +export class MDDLoader extends Loader { + /** + * Constructs a new MDD loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded MDD asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({clip:AnimationClip, morphTargets:Array})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + clip: AnimationClip; + morphTargets: Array; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given MDD data and returns an object holding the animation clip and the respective + * morph targets. + * + * @param {ArrayBuffer} data - The raw XYZ data as an array buffer. + * @return {{clip:AnimationClip, morphTargets:Array}} The result object. + */ + parse(data: ArrayBuffer): { + clip: AnimationClip; + morphTargets: Array; + }; +} +import { Loader } from 'three'; +import { AnimationClip } from 'three'; +import { BufferAttribute } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts new file mode 100644 index 000000000..c4443bb17 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts @@ -0,0 +1,107 @@ +/** + * ~MaterialOptions + */ +export type MTLLoader = { + /** + * - Which side to apply the material. + */ + side?: (number | BackSide | DoubleSide); + /** + * - What type of wrapping to apply for textures. + */ + wrap?: (number | ClampToEdgeWrapping | MirroredRepeatWrapping); + /** + * - Whether RGB colors should be normalized to `0-1` from `0-255`. + */ + normalizeRGB?: boolean | undefined; + /** + * - Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. + */ + ignoreZeroRGBs?: boolean | undefined; +}; +/** + * A loader for the MTL format. + * + * The Material Template Library format (MTL) or .MTL File Format is a companion file format + * to OBJ that describes surface shading (material) properties of objects within one or more + * OBJ files. + * + * ```js + * const loader = new MTLLoader(); + * const materials = await loader.loadAsync( 'models/obj/male02/male02.mtl' ); + * + * const objLoader = new OBJLoader(); + * objLoader.setMaterials( materials ); + * ``` + * + * @augments Loader + * @three_import import { MTLLoader } from 'three/addons/loaders/MTLLoader.js'; + */ +export class MTLLoader extends Loader { + constructor(manager: any); + /** + * Starts loading from the given URL and passes the loaded MTL asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(MaterialCreator)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: MaterialCreator) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Sets the material options. + * + * @param {MTLLoader~MaterialOptions} value - The material options. + * @return {MTLLoader} A reference to this loader. + */ + setMaterialOptions(value: any): MTLLoader; + materialOptions: any; + /** + * Parses the given MTL data and returns the resulting material creator. + * + * @param {string} text - The raw MTL data as a string. + * @param {string} path - The URL base path. + * @return {MaterialCreator} The material creator. + */ + parse(text: string, path: string): MaterialCreator; +} +import { Loader } from 'three'; +/** + * Material options of `MTLLoader`. + * + * @typedef {Object} MTLLoader~MaterialOptions + * @property {(FrontSide|BackSide|DoubleSide)} [side=FrontSide] - Which side to apply the material. + * @property {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} [wrap=RepeatWrapping] - What type of wrapping to apply for textures. + * @property {boolean} [normalizeRGB=false] - Whether RGB colors should be normalized to `0-1` from `0-255`. + * @property {boolean} [ignoreZeroRGBs=false] - Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. + */ +declare class MaterialCreator { + constructor(baseUrl?: string, options?: {}); + baseUrl: string; + options: {}; + materialsInfo: {}; + materials: {}; + materialsArray: any[]; + nameLookup: {}; + crossOrigin: string; + side: any; + wrap: any; + setCrossOrigin(value: any): this; + setManager(value: any): void; + manager: any; + setMaterials(materialsInfo: any): void; + convert(materialsInfo: any): any; + preload(): void; + getIndex(materialName: any): any; + getAsArray(): any[]; + create(materialName: any): any; + createMaterial_(materialName: any): any; + getTextureParams(value: any, matParams: any): { + scale: Vector2; + offset: Vector2; + }; + loadTexture(url: any, mapping: any, onLoad: any, onProgress: any, onError: any): any; +} +import { Vector2 } from 'three'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts new file mode 100644 index 000000000..1386a8f0a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts @@ -0,0 +1,20 @@ +export class MaterialXLoader extends Loader { + constructor(manager: any); + archiveDisposer: (() => void) | null; + dispose(): this; + load(url: any, onLoad: any, onProgress: any, onError: any, options?: {}): this; + loadAsync(url: any, onProgress: any, options?: {}): Promise; + parseBuffer(data: any, url?: string, options?: {}): { + materials: any; + log: any; + errors: any; + warnings: any; + }; + parse(text: any, options?: {}): { + materials: any; + log: any; + errors: any; + warnings: any; + }; +} +import { Loader } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts new file mode 100644 index 000000000..1ffe169c3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts @@ -0,0 +1,46 @@ +/** + * A loader for the NRRD format. + * + * ```js + * const loader = new NRRDLoader(); + * const volume = await loader.loadAsync( 'models/nrrd/I.nrrd' ); + * ``` + * + * @augments Loader + * @three_import import { NRRDLoader } from 'three/addons/loaders/NRRDLoader.js'; + */ +export class NRRDLoader extends Loader { + /** + * Constructs a new NRRD loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded NRRD asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Volume)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Volume) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Toggles the segmentation mode. + * + * @param {boolean} segmentation - Whether to use segmentation mode or not. + */ + setSegmentation(segmentation: boolean): void; + segmentation: boolean | undefined; + /** + * Parses the given NRRD data and returns the resulting volume data. + * + * @param {ArrayBuffer} data - The raw NRRD data as an array buffer. + * @return {Volume} The parsed volume. + */ + parse(data: ArrayBuffer): Volume; + _parseChars(array: any, start: any, end: any): string; +} +import { Loader } from 'three'; +import { Volume } from '../misc/Volume.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts new file mode 100644 index 000000000..b35f787d0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts @@ -0,0 +1,58 @@ +/** + * A loader for the OBJ format. + * + * The [OBJ format](https://en.wikipedia.org/wiki/Wavefront_.obj_file) is a simple data-format that + * represents 3D geometry in a human readable format as the position of each vertex, the UV position of + * each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list + * of vertices, and texture vertices. + * + * ```js + * const loader = new OBJLoader(); + * const object = await loader.loadAsync( 'models/monster.obj' ); + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; + */ +export class OBJLoader extends Loader { + /** + * Constructs a new OBJ loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * A reference to a material creator. + * + * @type {?MaterialCreator} + * @default null + */ + materials: MaterialCreator | null; + /** + * Starts loading from the given URL and passes the loaded OBJ asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Sets the material creator for this OBJ. This object is loaded via {@link MTLLoader}. + * + * @param {MaterialCreator} materials - An object that creates the materials for this OBJ. + * @return {OBJLoader} A reference to this loader. + */ + setMaterials(materials: MaterialCreator): OBJLoader; + /** + * Parses the given OBJ data and returns the resulting group. + * + * @param {string} text - The raw OBJ data as a string. + * @return {Group} The parsed OBJ. + */ + parse(text: string): Group; +} +import { Loader } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts new file mode 100644 index 000000000..e11b512de --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts @@ -0,0 +1,67 @@ +/** + * A loader for the Point Cloud Data (PCD) format. + * + * PCDLoader supports ASCII and (compressed) binary files as well as the following PCD fields: + * - x y z + * - rgb + * - normal_x normal_y normal_z + * - intensity + * - label + * + * ```js + * const loader = new PCDLoader(); + * + * const points = await loader.loadAsync( './models/pcd/binary/Zaghetto.pcd' ); + * points.geometry.center(); // optional + * points.geometry.rotateX( Math.PI ); // optional + * scene.add( points ); + * ``` + * + * @augments Loader + * @three_import import { PCDLoader } from 'three/addons/loaders/PCDLoader.js'; + */ +export class PCDLoader extends Loader { + /** + * Constructs a new PCD loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Whether to use little Endian or not. + * + * @type {boolean} + * @default true + */ + littleEndian: boolean; + /** + * Starts loading from the given URL and passes the loaded PCD asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Points)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Points) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Get dataview value by field type and size. + * + * @private + * @param {DataView} dataview - The DataView to read from. + * @param {number} offset - The offset to start reading from. + * @param {'F' | 'U' | 'I'} type - Field type. + * @param {number} size - Field size. + * @returns {number} Field value. + */ + private _getDataView; + /** + * Parses the given PCD data and returns a point cloud. + * + * @param {ArrayBuffer} data - The raw PCD data as an array buffer. + * @return {Points} The parsed point cloud. + */ + parse(data: ArrayBuffer): Points; +} +import { Loader } from 'three'; +import { Points } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts new file mode 100644 index 000000000..9502d6e8e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts @@ -0,0 +1,45 @@ +/** + * A loader for the PDB format. + * + * The [Protein Data Bank](https://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)) + * file format is a textual file describing the three-dimensional structures of molecules. + * + * ```js + * const loader = new PDBLoader(); + * const pdb = await loader.loadAsync( 'models/pdb/ethanol.pdb' ); + * + * const geometryAtoms = pdb.geometryAtoms; + * const geometryBonds = pdb.geometryBonds; + * const json = pdb.json; + * ``` + * + * @augments Loader + * @three_import import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; + */ +export class PDBLoader extends Loader { + /** + * Constructs a new PDB loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded PDB asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Object)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given PDB data and returns an object holding the atoms and + * bond geometries as well as the raw atom data as JSON. + * + * @param {string} text - The raw PDB data as a string. + * @return {Object} The result object. + */ + parse(text: string): Object; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts new file mode 100644 index 000000000..c03afd50c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts @@ -0,0 +1,76 @@ +/** + * A loader for PLY the PLY format (known as the Polygon + * File Format or the Stanford Triangle Format). + * + * Limitations: + * - ASCII decoding assumes file is UTF-8. + * + * ```js + * const loader = new PLYLoader(); + * const geometry = await loader.loadAsync( './models/ply/ascii/dolphins.ply' ); + * scene.add( new THREE.Mesh( geometry ) ); + * ``` + * + * @augments Loader + * @three_import import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; + */ +export class PLYLoader extends Loader { + /** + * Constructs a new PLY loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + propertyNameMapping: {}; + customPropertyMapping: {}; + /** + * Starts loading from the given URL and passes the loaded PLY asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Sets a property name mapping that maps default property names + * to custom ones. For example, the following maps the properties + * “diffuse_(red|green|blue)” in the file to standard color names. + * + * ```js + * loader.setPropertyNameMapping( { + * diffuse_red: 'red', + * diffuse_green: 'green', + * diffuse_blue: 'blue' + * } ); + * ``` + * + * @param {Object} mapping - The mapping dictionary. + */ + setPropertyNameMapping(mapping: Object): void; + /** + * Custom properties outside of the defaults for position, uv, normal + * and color attributes can be added using the setCustomPropertyNameMapping method. + * For example, the following maps the element properties “custom_property_a” + * and “custom_property_b” to an attribute “customAttribute” with an item size of 2. + * Attribute item sizes are set from the number of element properties in the property array. + * + * ```js + * loader.setCustomPropertyNameMapping( { + * customAttribute: ['custom_property_a', 'custom_property_b'], + * } ); + * ``` + * @param {Object} mapping - The mapping dictionary. + */ + setCustomPropertyNameMapping(mapping: Object): void; + /** + * Parses the given PLY data and returns the resulting geometry. + * + * @param {ArrayBuffer} data - The raw PLY data as an array buffer. + * @return {BufferGeometry} The parsed geometry. + */ + parse(data: ArrayBuffer): BufferGeometry; +} +import { Loader } from 'three'; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts new file mode 100644 index 000000000..e8f73618d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts @@ -0,0 +1,30 @@ +/** + * A loader for the PVRTC texture compression format. + * + * ```js + * const loader = new PVRLoader(); + * + * const map = loader.load( 'textures/compressed/disturb_4bpp_rgb.pvr' ); + * map.colorSpace = THREE.SRGBColorSpace; // only for color textures + * ``` + * + * @augments CompressedTextureLoader + * @three_import import { PVRLoader } from 'three/addons/loaders/PVRLoader.js'; + */ +export class PVRLoader extends CompressedTextureLoader { + /** + * Constructs a new PVR loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Parses the given PVRTC texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @param {boolean} loadMipmaps - Whether to load mipmaps or not. This option is not yet supported by the loader. + * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data. + */ + parse(buffer: ArrayBuffer, loadMipmaps: boolean): CompressedTextureLoader; +} +import { CompressedTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts new file mode 100644 index 000000000..692cc5d8e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts @@ -0,0 +1,3 @@ +export class RGBELoader extends HDRLoader { +} +import { HDRLoader } from './HDRLoader.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts new file mode 100644 index 000000000..4bffcabde --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts @@ -0,0 +1,42 @@ +/** + * A loader for standard fixed-width Gaussian splat `.splat` files. + * + * This loader decodes the format into `BufferGeometry` for use with + * `GaussianSplat`. Each 32-byte row stores center, scale, color and + * rotation data for one splat. + * + * ```js + * const loader = new SPLATLoader(); + * const data = await loader.loadAsync( './models/gsplat/example.splat' ); + * scene.add( new GaussianSplat( data ) ); + * ``` + * + * @augments Loader + * @three_import import { SPLATLoader } from 'three/addons/loaders/SPLATLoader.js'; + */ +export class SPLATLoader extends Loader { + /** + * Constructs a new Gaussian splat loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded splat data to + * the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given fixed-width `.splat` data. + * + * @param {ArrayBuffer} buffer - The raw `.splat` file as an array buffer. + * @return {BufferGeometry} The parsed splat geometry. + */ + parse(buffer: ArrayBuffer): BufferGeometry; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts new file mode 100644 index 000000000..723c0925c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts @@ -0,0 +1,62 @@ +/** + * A loader for compressed Gaussian splat `.spz` files. + * + * This loader decodes the format into `BufferGeometry` for use with + * `GaussianSplat`. Higher-order spherical harmonics are exposed as optional + * `sphericalHarmonics1` through `sphericalHarmonics3` packed uint32 geometry + * attributes (`SH_BAND_WORDS[ degree ]` words per splat). Coefficients use the + * clamped-byte encoding `( value - 128 ) / 128`, four bytes per word. + * + * ```js + * const loader = new SPZLoader(); + * const data = await loader.loadAsync( './models/gsplat/example.spz' ); + * scene.add( new GaussianSplat( data ) ); + * ``` + * + * @augments Loader + * @three_import import { SPZLoader } from 'three/addons/loaders/SPZLoader.js'; + */ +export class SPZLoader extends Loader { + /** + * Constructs a new Gaussian splat SPZ loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded splat data to + * the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Decompresses and parses the given `.spz` data. + * + * @param {ArrayBuffer} buffer - The raw SPZ file as an array buffer. + * @param {function(BufferGeometry)} [onLoad] - Executed when the parsing process has been finished. + * @param {onErrorCallback} [onError] - Executed when errors occur. + * @return {BufferGeometry|Promise|undefined} The parsed splat geometry, or a promise for SPZ v4 data. + */ + parse(buffer: ArrayBuffer, onLoad?: (arg0: BufferGeometry) => any, onError?: onErrorCallback): BufferGeometry | Promise | undefined; + /** + * Parses raw SPZ data after gzip decompression. + * + * @param {Uint8Array} bytes - The decompressed SPZ data. + * @return {BufferGeometry} The parsed splat geometry. + */ + parseRawSPZ(bytes: Uint8Array): BufferGeometry; + /** + * Parses raw SPZ v4 data. + * + * @param {Uint8Array} bytes - The raw SPZ v4 data. + * @param {ZSTDDecoder} zstd - The initialized ZSTD decoder. + * @return {BufferGeometry} The parsed splat geometry. + */ + parseRawSPZV4(bytes: Uint8Array, zstd: ZSTDDecoder): BufferGeometry; +} +import { Loader } from 'three'; +import { ZSTDDecoder } from '../libs/zstddec.module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts new file mode 100644 index 000000000..aae8f96aa --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts @@ -0,0 +1,69 @@ +/** + * A loader for the STL format, as created by Solidworks and other CAD programs. + * + * Supports both binary and ASCII encoded files. The loader returns a non-indexed buffer geometry. + * + * Limitations: + * - Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL). + * - There is perhaps some question as to how valid it is to always assume little-endian-ness. + * - ASCII decoding assumes file is UTF-8. + * + * ```js + * const loader = new STLLoader(); + * const geometry = await loader.loadAsync( './models/stl/slotted_disk.stl' ) + * scene.add( new THREE.Mesh( geometry ) ); + * ``` + * For binary STLs geometry might contain colors for vertices. To use it: + * ```js + * // use the same code to load STL as above + * if ( geometry.hasColors ) { + * material = new THREE.MeshPhongMaterial( { opacity: geometry.alpha, vertexColors: true } ); + * } + * const mesh = new THREE.Mesh( geometry, material ); + * ``` + * For ASCII STLs containing multiple solids, each solid is assigned to a different group. + * Groups can be used to assign a different color by defining an array of materials with the same length of + * geometry.groups and passing it to the Mesh constructor: + * + * ```js + * const materials = []; + * const nGeometryGroups = geometry.groups.length; + * + * for ( let i = 0; i < nGeometryGroups; i ++ ) { + * const material = new THREE.MeshPhongMaterial( { color: colorMap[ i ], wireframe: false } ); + * materials.push( material ); + * } + * + * const mesh = new THREE.Mesh(geometry, materials); + * ``` + * + * @augments Loader + * @three_import import { STLLoader } from 'three/addons/loaders/STLLoader.js'; + */ +export class STLLoader extends Loader { + /** + * Constructs a new STL loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded STL asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given STL data and returns the resulting geometry. + * + * @param {ArrayBuffer} data - The raw STL data as an array buffer. + * @return {BufferGeometry} The parsed geometry. + */ + parse(data: ArrayBuffer): BufferGeometry; +} +import { Loader } from 'three'; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts new file mode 100644 index 000000000..b11481bc5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts @@ -0,0 +1,150 @@ +/** + * A loader for the SVG format. + * + * Scalable Vector Graphics is an XML-based vector image format for two-dimensional graphics + * with support for interactivity and animation. + * + * ```js + * const loader = new SVGLoader(); + * const data = await loader.loadAsync( 'data/svgSample.svg' ); + * + * const paths = data.paths; + * const group = new THREE.Group(); + * + * for ( let i = 0; i < paths.length; i ++ ) { + * + * const path = paths[ i ]; + * const material = new THREE.MeshBasicMaterial( { + * color: path.color, + * side: THREE.DoubleSide, + * depthWrite: false + * } ); + * + * const shapes = SVGLoader.createShapes( path ); + * + * for ( let j = 0; j < shapes.length; j ++ ) { + * + * const shape = shapes[ j ]; + * const geometry = new THREE.ShapeGeometry( shape ); + * const mesh = new THREE.Mesh( geometry, material ); + * group.add( mesh ); + * + * } + * + * } + * + * scene.add( group ); + * ``` + * + * @augments Loader + * @three_import import { SVGLoader } from 'three/addons/loaders/SVGLoader.js'; + */ +export class SVGLoader extends Loader { + /** + * Creates a material for rendering the fill of the given path. + * + * @param {ShapePath} shapePath - The shape path. + * @return {?MeshBasicMaterial} The fill material. `null` if the path has no fill. + */ + static createFillMaterial(shapePath: ShapePath): MeshBasicMaterial | null; + /** + * Creates a material for rendering the stroke of the given path. + * + * @param {ShapePath} shapePath - The shape path. + * @return {?MeshBasicMaterial} The stroke material. `null` if the path has no stroke. + */ + static createStrokeMaterial(shapePath: ShapePath): MeshBasicMaterial | null; + /** + * Creates from the given shape path and array of shapes. + * + * @deprecated since 185. + * @param {ShapePath} shapePath - The shape path. + * @return {Array} An array of shapes. + */ + static createShapes(shapePath: ShapePath): Array; + /** + * Returns a stroke style object from the given parameters. + * + * @param {number} [width=1] - The stroke width. + * @param {string} [color='#000'] - The stroke color, as returned by {@link Color#getStyle}. + * @param {'round'|'bevel'|'miter'|'miter-limit'} [lineJoin='miter'] - The line join style. + * @param {'round'|'square'|'butt'} [lineCap='butt'] - The line cap style. + * @param {number} [miterLimit=4] - Maximum join length, in multiples of the `width` parameter (join is truncated if it exceeds that distance). + * @return {Object} The style object. + */ + static getStrokeStyle(width?: number, color?: string, lineJoin?: "round" | "bevel" | "miter" | "miter-limit", lineCap?: "round" | "square" | "butt", miterLimit?: number): Object; + /** + * Creates a stroke from an array of points. + * + * @param {Array} points - The points in 2D space. Minimum 2 points. The path can be open or closed (last point equals to first point). + * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object. + * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps. + * @param {number} [minDistance=0.001] - Points closer to this distance will be merged. + * @return {?BufferGeometry} The stroke geometry. UV coordinates are generated ('u' along path. 'v' across it, from left to right). + * Returns `null` if not geometry was generated. + */ + static pointsToStroke(points: Array, style: Object, arcDivisions?: number, minDistance?: number): BufferGeometry | null; + /** + * Creates a stroke from an array of points. + * + * @param {Array} points - The points in 2D space. Minimum 2 points. + * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object. + * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps. + * @param {number} [minDistance=0.001] - Points closer to this distance will be merged. + * @param {Array} vertices - An array holding vertices. + * @param {Array} normals - An array holding normals. + * @param {Array} uvs - An array holding uvs. + * @param {number} [vertexOffset=0] - The vertex offset. + * @return {number} The number of vertices. + */ + static pointsToStrokeWithBuffers(points: Array, style: Object, arcDivisions?: number, minDistance?: number, vertices: Array, normals: Array, uvs: Array, vertexOffset?: number): number; + /** + * Constructs a new SVG loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Default dots per inch. + * + * @type {number} + * @default 90 + */ + defaultDPI: number; + /** + * Default unit. + * + * @type {('mm'|'cm'|'in'|'pt'|'pc'|'px')} + * @default 'px' + */ + defaultUnit: ("mm" | "cm" | "in" | "pt" | "pc" | "px"); + /** + * Starts loading from the given URL and passes the loaded SVG asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function({paths:Array,xml:string})} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: { + paths: Array; + xml: string; + }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given SVG data and returns the resulting data. + * + * @param {string} text - The raw SVG data as a string. + * @return {{paths:Array,xml:string}} An object holding an array of shape paths and the + * SVG XML document. + */ + parse(text: string): { + paths: Array; + xml: string; + }; +} +import { Loader } from 'three'; +import { ShapePath } from 'three'; +import { MeshBasicMaterial } from 'three'; +import { Vector2 } from 'three'; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts new file mode 100644 index 000000000..819ba7cd6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts @@ -0,0 +1,141 @@ +/** + * A loader for the 3DS format, based on lib3ds. + * + * Loads geometry with uv and materials basic properties with texture support. + * + * ```js + * const loader = new TDSLoader(); + * loader.setResourcePath( 'models/3ds/portalgun/textures/' ); + * const object = await loader.loadAsync( 'models/3ds/portalgun/portalgun.3ds' ); + * scene.add( object ); + * + * @augments Loader + * @three_import import { TDSLoader } from 'three/addons/loaders/TDSLoader.js'; + */ +export class TDSLoader extends Loader { + /** + * Constructs a new 3DS loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Whether debug mode should be enabled or not. + * + * @type {boolean} + * @default false + */ + debug: boolean; + group: Group | null; + materials: any[]; + meshes: any[]; + /** + * Starts loading from the given URL and passes the loaded 3DS asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given 3DS data and returns the resulting data. + * + * @param {ArrayBuffer} arraybuffer - The raw 3DS data as an array buffer. + * @param {string} path - The asset path. + * @return {Group} The parsed asset represented as a group. + */ + parse(arraybuffer: ArrayBuffer, path: string): Group; + /** + * Decode file content to read 3ds data. + * + * @private + * @param {ArrayBuffer} arraybuffer - Arraybuffer data to be loaded. + * @param {string} path - Path for external resources. + */ + private readFile; + /** + * Read mesh data chunk. + * + * @private + * @param {Chunk} chunk - to read mesh from + * @param {string} path - Path for external resources. + */ + private readMeshData; + /** + * Read named object chunk. + * + * @private + * @param {Chunk} chunk - Chunk in use. + */ + private readNamedObject; + /** + * Read material data chunk and add it to the material list. + * + * @private + * @param {Chunk} chunk - Chunk in use. + * @param {string} path - Path for external resources. + */ + private readMaterialEntry; + /** + * Read mesh data chunk. + * + * @private + * @param {Chunk} chunk - Chunk in use. + * @return {Mesh} - The parsed mesh. + */ + private readMesh; + /** + * Read face array data chunk. + * + * @private + * @param {Chunk} chunk - Chunk in use. + * @param {Mesh} mesh - Mesh to be filled with the data read. + */ + private readFaceArray; + /** + * Read texture map data chunk. + * + * @private + * @param {Chunk} chunk - Chunk in use. + * @param {string} path - Path for external resources. + * @return {Texture} Texture read from this data chunk. + */ + private readMap; + /** + * Read material group data chunk. + * + * @private + * @param {Chunk} chunk - Chunk in use. + * @return {Object} Object with name and index of the object. + */ + private readMaterialGroup; + /** + * Read a color value. + * + * @private + * @param {Chunk} chunk - Chunk. + * @return {Color} Color value read. + */ + private readColor; + /** + * Read percentage value. + * + * @private + * @param {Chunk} chunk - Chunk to read data from. + * @return {number} Data read from the dataview. + */ + private readPercentage; + /** + * Print debug message to the console. + * + * Is controlled by a flag to show or hide debug messages. + * + * @private + * @param {Object} message - Debug message to print to the console. + */ + private debugMessage; +} +import { Loader } from 'three'; +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts new file mode 100644 index 000000000..56f74907c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts @@ -0,0 +1,28 @@ +/** + * A loader for the TGA texture format. + * + * ```js + * const loader = new TGALoader(); + * const texture = await loader.loadAsync( 'textures/crate_color8.tga' ); + * texture.colorSpace = THREE.SRGBColorSpace; // only for color textures + * ``` + * + * @augments DataTextureLoader + * @three_import import { TGALoader } from 'three/addons/loaders/TGALoader.js'; + */ +export class TGALoader extends DataTextureLoader { + /** + * Constructs a new TGA loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Parses the given TGA texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @return {DataTextureLoader~TexData} An object representing the parsed texture data. + */ + parse(buffer: ArrayBuffer): DataTextureLoader; +} +import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts new file mode 100644 index 000000000..3291f03ea --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts @@ -0,0 +1,28 @@ +/** + * A loader for the TIFF texture format. + * + * ```js + * const loader = new TIFFLoader(); + * const texture = await loader.loadAsync( 'textures/tiff/crate_lzw.tif' ); + * texture.colorSpace = THREE.SRGBColorSpace; + * ``` + * + * @augments DataTextureLoader + * @three_import import { TIFFLoader } from 'three/addons/loaders/TIFFLoader.js'; + */ +export class TIFFLoader extends DataTextureLoader { + /** + * Constructs a new TIFF loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Parses the given TIFF texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @return {DataTextureLoader~TexData} An object representing the parsed texture data. + */ + parse(buffer: ArrayBuffer): DataTextureLoader; +} +import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts new file mode 100644 index 000000000..a9a9483c9 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts @@ -0,0 +1,48 @@ +/** + * A loader for the TTF format. + * + * Loads TTF files and converts them into typeface JSON that can be used directly + * to create THREE.Font objects. + * + * ```js + * const loader = new TTFLoader(); + * const json = await loader.loadAsync( 'fonts/ttf/kenpixel.ttf' ); + * const font = new Font( json ); + * ``` + * + * @augments Loader + * @three_import import { TTFLoader } from 'three/addons/loaders/TTFLoader.js'; + */ +export class TTFLoader extends Loader { + /** + * Constructs a new TTF loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Whether the TTF commands should be reversed or not. + * + * @type {boolean} + * @default false + */ + reversed: boolean; + /** + * Starts loading from the given URL and passes the loaded TTF asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Object)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given TTF data and returns a JSON for creating a font. + * + * @param {ArrayBuffer} arraybuffer - The raw TTF data as an array buffer. + * @return {Object} The result JSON. + */ + parse(arraybuffer: ArrayBuffer): Object; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts new file mode 100644 index 000000000..247a6b36a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts @@ -0,0 +1,48 @@ +/** + * A loader for the USD format (USD, USDA, USDC, USDZ). + * + * Supports both ASCII (USDA) and binary (USDC) USD files, as well as + * USDZ archives containing either format. + * + * ```js + * const loader = new USDLoader(); + * const model = await loader.loadAsync( 'model.usdz' ); + * scene.add( model ); + * ``` + * + * @augments Loader + * @three_import import { USDLoader } from 'three/addons/loaders/USDLoader.js'; + */ +export class USDLoader extends Loader { + /** + * Constructs a new USDZ loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded USDZ asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Group)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given USDZ data and returns the resulting group. + * + * The returned group is created synchronously, but any referenced textures + * are loaded asynchronously. Provide `onLoad` to be notified once all + * textures have finished loading. + * + * @param {ArrayBuffer|string} buffer - The raw USDZ data as an array buffer. + * @param {string} [path=''] - The URL base path. + * @param {function(Group)} [onLoad] - Executed once the group and all of its textures are ready. + * @param {onErrorCallback} [onError] - Executed when errors occur. + * @return {Group} The parsed asset as a group. + */ + parse(buffer: ArrayBuffer | string, path?: string, onLoad?: (arg0: Group) => any, onError?: onErrorCallback): Group; +} +import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts new file mode 100644 index 000000000..843c08a50 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts @@ -0,0 +1,3 @@ +export class USDZLoader extends USDLoader { +} +import { USDLoader } from './USDLoader.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts new file mode 100644 index 000000000..91c2888d6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts @@ -0,0 +1,82 @@ +/** + * A loader for the Ultra HDR Image Format. + * + * Existing HDR or EXR textures can be converted to Ultra HDR with this [tool](https://gainmap-creator.monogrid.com/). + * + * Current feature set: + * - JPEG headers (required) + * - XMP metadata (legacy format, supported) + * - ISO 21496-1 metadata (current standard, supported) + * - XMP validation (not implemented) + * - EXIF profile (not implemented) + * - ICC profile (not implemented) + * - Binary storage for SDR & HDR images (required) + * - Gainmap metadata (required) + * - Non-JPEG image formats (not implemented) + * - Primary image as an HDR image (not implemented) + * + * ```js + * const loader = new UltraHDRLoader(); + * const texture = await loader.loadAsync( 'textures/equirectangular/ice_planet_close.jpg' ); + * texture.mapping = THREE.EquirectangularReflectionMapping; + * + * scene.background = texture; + * scene.environment = texture; + * ``` + * + * @augments Loader + * @three_import import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + */ +export class UltraHDRLoader extends Loader { + /** + * Constructs a new Ultra HDR loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The texture type. + * + * @type {(HalfFloatType|FloatType)} + * @default HalfFloatType + */ + type: (number | FloatType); + /** + * Sets the texture type. + * + * @param {(HalfFloatType|FloatType)} value - The texture type to set. + * @return {UltraHDRLoader} A reference to this loader. + */ + setDataType(value: (number | FloatType)): UltraHDRLoader; + /** + * Parses the given Ultra HDR texture data. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @param {Function} onLoad - The `onLoad` callback. + */ + parse(buffer: ArrayBuffer, onLoad: Function): void; + /** + * Parses ISO 21496-1 gainmap metadata from binary data. + * + * @private + * @param {Uint8Array} data - The binary ISO metadata. + * @param {Object} metadata - The metadata object to populate. + */ + private _parseISOMetadata; + /** + * Starts loading from the given URL and passes the loaded Ultra HDR texture + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the files to be loaded. This can also be a data URI. + * @param {function(DataTexture, Object)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + * @return {DataTexture} The Ultra HDR texture. + */ + load(url: string, onLoad: (arg0: DataTexture, arg1: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): DataTexture; + _parseXMPMetadata(xmpDataString: any, metadata: any): void; + _srgbToLinear(value: any): number; + _applyGainmapToSDR(metadata: any, sdrBuffer: any, gainmapBuffer: any, onSuccess: any, onError: any): void; +} +import { Loader } from 'three'; +import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts new file mode 100644 index 000000000..4db620acb --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts @@ -0,0 +1,54 @@ +/** + * A loader for the VOX format. + * + * ```js + * const loader = new VOXLoader(); + * const result = await loader.loadAsync( 'models/vox/monu10.vox' ); + * + * scene.add( result.scene.children[ 0 ] ); + * ``` + * @augments Loader + * @three_import import { VOXLoader } from 'three/addons/loaders/VOXLoader.js'; + */ +export class VOXLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded VOX asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Object)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given VOX data and returns the result object. + * + * @param {ArrayBuffer} buffer - The raw VOX data as an array buffer. + * @return {Object} The parsed VOX data with properties: chunks, scene. + */ + parse(buffer: ArrayBuffer): Object; +} +/** + * Builds a mesh from a VOX chunk. + * + * @param {Object} chunk - A VOX chunk loaded via {@link VOXLoader}. + * @return {Mesh} The generated mesh. + */ +export function buildMesh(chunk: Object): Mesh; +/** + * Builds a 3D texture from a VOX chunk. + * + * @param {Object} chunk - A VOX chunk loaded via {@link VOXLoader}. + * @return {Data3DTexture} The generated 3D texture. + */ +export function buildData3DTexture(chunk: Object): Data3DTexture; +export class VOXMesh extends Mesh { + constructor(chunk: any); +} +export class VOXData3DTexture extends Data3DTexture { + constructor(chunk: any); +} +import { Loader } from 'three'; +import { Mesh } from 'three'; +import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts new file mode 100644 index 000000000..08d9f2b94 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts @@ -0,0 +1,40 @@ +/** + * A loader for the VRML format. + * + * ```js + * const loader = new VRMLLoader(); + * const object = await loader.loadAsync( 'models/vrml/house.wrl' ); + * scene.add( object ); + * ``` + * + * @augments Loader + * @three_import import { VRMLLoader } from 'three/addons/loaders/VRMLLoader.js'; + */ +export class VRMLLoader extends Loader { + /** + * Constructs a new VRML loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded VRML asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Scene)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Scene) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given VRML data and returns the resulting scene. + * + * @param {string} data - The raw VRML data as a string. + * @param {string} path - The URL base path. + * @return {Scene} The parsed scene. + */ + parse(data: string, path: string): Scene; +} +import { Loader } from 'three'; +import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts new file mode 100644 index 000000000..daeaecfb0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts @@ -0,0 +1,48 @@ +/** + * A loader for the VTK format. + * + * This loader only supports the `POLYDATA` dataset format so far. Other formats + * (structured points, structured grid, rectilinear grid, unstructured grid, appended) + * are not supported. + * + * ```js + * const loader = new VTKLoader(); + * const geometry = await loader.loadAsync( 'models/vtk/liver.vtk' ); + * geometry.computeVertexNormals(); + * + * const mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial() ); + * scene.add( mesh ); + * ``` + * + * @augments Loader + * @three_import import { VTKLoader } from 'three/addons/loaders/VTKLoader.js'; + * @deprecated since r184. + */ +export class VTKLoader extends Loader { + /** + * Constructs a new VTK loader. + * + * @param {LoadingManager} [manager] - The loading manager. + * @deprecated since r184. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and passes the loaded VTK asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given VTK data and returns the resulting geometry. + * + * @param {ArrayBuffer} data - The raw VTK data as an array buffer + * @return {BufferGeometry} The parsed geometry. + */ + parse(data: ArrayBuffer): BufferGeometry; +} +import { Loader } from 'three'; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts new file mode 100644 index 000000000..e1565591d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts @@ -0,0 +1,42 @@ +/** + * A loader for the XYZ format. + * + * XYZ is a very simple format for storing point clouds. The layouts + * `XYZ` (points) and `XYZRGB` (points + colors) are supported. + * + * ```js + * const loader = new XYZLoader(); + * const geometry = await loader.loadAsync( 'models/xyz/helix_201.xyz' ); + * geometry.center(); + * + * const vertexColors = ( geometry.hasAttribute( 'color' ) === true ); + * const material = new THREE.PointsMaterial( { size: 0.1, vertexColors: vertexColors } ); + * + * const points = new THREE.Points( geometry, material ); + * scene.add( points ); + * ``` + * + * @augments Loader + * @three_import import { XYZLoader } from 'three/addons/loaders/XYZLoader.js'; + */ +export class XYZLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded XYZ asset + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given XYZ data and returns the resulting geometry. + * + * @param {string} text - The raw XYZ data as a string. + * @return {BufferGeometry} The geometry representing the point cloud. + */ + parse(text: string): BufferGeometry; +} +import { Loader } from 'three'; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts new file mode 100644 index 000000000..3113bc0a5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts @@ -0,0 +1,154 @@ +/** + * ColladaComposer converts parsed library data into Three.js objects. + */ +export class ColladaComposer { + constructor(library: any, collada: any, textureLoader: any, tgaLoader: any); + library: any; + collada: any; + textureLoader: any; + tgaLoader: any; + tempColor: Color; + animations: any[]; + kinematics: {}; + position: Vector3; + scale: Vector3; + quaternion: Quaternion; + matrix: Matrix4; + deferredPivotAnimations: {}; + transformNodes: {}; + compose(): { + scene: any; + animations: any[]; + kinematics: {}; + }; + buildLibrary(data: any, builder: any): void; + getBuild(data: any, builder: any): any; + isEmpty(object: any): boolean; + buildAnimation(data: any): any[]; + collectDeferredPivotAnimation(nodeId: any, nodeChannels: any): void; + hasPivotTransforms(nodeData: any): boolean; + getAnimation(id: any): any; + aggregateAnimationChannels(channels: any, samplers: any, sources: any): {}; + buildMatrixTracks(object3D: any, channelData: any, nodeData: any, tracks: any): void; + buildTranslateTrack(object3D: any, channelData: any, transformInfo: any, tracks: any): void; + buildRotateTrack(object3D: any, sid: any, channelData: any, transformInfo: any, nodeData: any, tracks: any): void; + buildScaleTrack(object3D: any, channelData: any, transformInfo: any, tracks: any): void; + getTimesForAllAxes(channelData: any): any[]; + getValueAtTime(componentData: any, time: any, defaultValue: any): any; + evaluateBezierComponent(componentData: any, i0: any, i1: any, t0: any, t1: any, time: any): number; + getInterpolationInfo(channelData: any): { + type: any; + uniform: boolean; + }; + applyInterpolation(track: any, interpolationInfo: any, channelData?: null): void; + prepareAnimationData(data: any, defaultMatrix: any): { + time: number; + value: any; + }[]; + createKeyframeTracks(animation: any, tracks: any): any; + transformAnimationData(keyframes: any, property: any, defaultValue: any): void; + createMissingKeyframes(keyframes: any, property: any): void; + getPrev(keyframes: any, i: any, property: any): any; + getNext(keyframes: any, i: any, property: any): any; + interpolate(key: any, prev: any, next: any, property: any): void; + buildAnimationClip(data: any): AnimationClip; + getAnimationClip(id: any): any; + buildController(data: any): { + id: any; + }; + buildSkin(data: any): { + joints: never[]; + indices: { + array: never[]; + stride: number; + }; + weights: { + array: never[]; + stride: number; + }; + }; + getController(id: any): any; + buildImage(data: any): any; + getImage(id: any): any; + buildEffect(data: any): any; + getEffect(id: any): any; + getTextureLoader(image: any): any; + buildMaterial(data: any): MeshBasicMaterial | MeshPhongMaterial | MeshLambertMaterial; + getMaterial(id: any): any; + buildCamera(data: any): PerspectiveCamera | OrthographicCamera; + getCamera(id: any): any; + buildLight(data: any): SpotLight | PointLight | DirectionalLight | AmbientLight | undefined; + getLight(id: any): any; + groupPrimitives(primitives: any): {}; + checkUVCoordinates(primitives: any): void; + buildGeometry(data: any): {}; + buildGeometryType(primitives: any, sources: any, vertices: any): { + data: BufferGeometry; + type: any; + materialKeys: any[]; + }; + buildGeometryData(primitive: any, source: any, offset: any, array: any, isColor?: boolean): void; + getGeometry(id: any): any; + buildKinematicsModel(data: any): any; + getKinematicsModel(id: any): any; + buildKinematicsScene(data: any): any; + getKinematicsScene(id: any): any; + setupKinematics(): void; + buildTransformList(node: any): ({ + sid: any; + type: any; + obj: Matrix4; + angle?: undefined; + } | { + sid: any; + type: any; + obj: Vector3; + angle?: undefined; + } | { + sid: any; + type: any; + obj: Vector3; + angle: number; + })[]; + buildSkeleton(skeletons: any, joints: any): Skeleton; + buildBoneHierarchy(root: any, joints: any, boneData: any): void; + buildNode(data: any): any; + wrapWithTransformHierarchy(contentObject: any, nodeData: any): Group; + resolveMaterialBinding(keys: any, instanceMaterials: any): any[]; + get fallbackMaterial(): MeshBasicMaterial; + _fallbackMaterial: MeshBasicMaterial | undefined; + buildObjects(geometries: any, instanceMaterials: any): (Mesh | SkinnedMesh | Line | undefined)[]; + hasNode(id: any): boolean; + getNode(id: any): any; + buildVisualScene(data: any): Group; + hasVisualScene(id: any): boolean; + getVisualScene(id: any): any; + parseScene(xml: any): any; + parseId(text: any): any; + setupAnimations(): void; + buildDeferredPivotAnimationTracks(tracks: any): void; + buildTransformHierarchyTracks(nodeId: any, nodeChannels: any, nodeData: any, tracks: any): void; + buildHierarchyTranslateTrack(transformNode: any, channelData: any, transformInfo: any, tracks: any): void; + buildHierarchyRotateTrack(transformNode: any, channelData: any, transformInfo: any, tracks: any): void; + buildHierarchyScaleTrack(transformNode: any, channelData: any, transformInfo: any, tracks: any): void; +} +import { Color } from 'three'; +import { Vector3 } from 'three'; +import { Quaternion } from 'three'; +import { Matrix4 } from 'three'; +import { AnimationClip } from 'three'; +import { MeshBasicMaterial } from 'three'; +import { MeshPhongMaterial } from 'three'; +import { MeshLambertMaterial } from 'three'; +import { PerspectiveCamera } from 'three'; +import { OrthographicCamera } from 'three'; +import { SpotLight } from 'three'; +import { PointLight } from 'three'; +import { DirectionalLight } from 'three'; +import { AmbientLight } from 'three'; +import { BufferGeometry } from 'three'; +import { Skeleton } from 'three'; +import { Group } from 'three'; +import { Mesh } from 'three'; +import { SkinnedMesh } from 'three'; +import { Line } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts new file mode 100644 index 000000000..fbf3e6e77 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts @@ -0,0 +1,234 @@ +/** + * ColladaParser handles XML parsing and converts Collada XML to intermediate data structures. + */ +export class ColladaParser { + count: number; + generateId(): string; + parse(text: any): { + library: { + animations: {}; + clips: {}; + controllers: {}; + images: {}; + effects: {}; + materials: {}; + cameras: {}; + lights: {}; + geometries: {}; + nodes: {}; + visualScenes: {}; + kinematicsModels: {}; + physicsModels: {}; + kinematicsScenes: {}; + joints: {}; + }; + asset: { + unit: number; + upAxis: any; + }; + collada: any; + } | null; + library: { + animations: {}; + clips: {}; + controllers: {}; + images: {}; + effects: {}; + materials: {}; + cameras: {}; + lights: {}; + geometries: {}; + nodes: {}; + visualScenes: {}; + kinematicsModels: {}; + physicsModels: {}; + kinematicsScenes: {}; + joints: {}; + } | undefined; + collada: any; + parserErrorToText(parserError: any): string; + parseAsset(xml: any): { + unit: number; + upAxis: any; + }; + parseAssetUnit(xml: any): number; + parseAssetUpAxis(xml: any): any; + parseLibrary(xml: any, libraryName: any, nodeName: any, parser: any): void; + parseAnimation(xml: any): void; + parseAnimationSampler(xml: any): { + inputs: {}; + }; + parseAnimationChannel(xml: any): { + member: any; + indices: any; + id: any; + sid: any; + arraySyntax: boolean; + memberSyntax: boolean; + sampler: any; + }; + parseAnimationClip(xml: any): void; + parseController(xml: any): void; + parseSkin(xml: any): { + sources: {}; + }; + parseJoints(xml: any): { + inputs: {}; + }; + parseVertexWeights(xml: any): { + inputs: {}; + }; + parseImage(xml: any): void; + parseEffect(xml: any): void; + parseEffectProfileCOMMON(xml: any): { + surfaces: {}; + samplers: {}; + }; + parseEffectNewparam(xml: any, data: any): void; + parseEffectSurface(xml: any): { + init_from: any; + }; + parseEffectSampler(xml: any): { + source: any; + }; + parseEffectTechnique(xml: any): { + type: any; + parameters: {}; + extra: { + technique: {}; + }; + }; + parseEffectParameters(xml: any): {}; + parseEffectParameter(xml: any): {}; + parseEffectParameterTexture(xml: any): { + technique: {}; + }; + parseEffectParameterTextureExtra(xml: any, data: any): void; + parseEffectParameterTextureExtraTechnique(xml: any, data: any): void; + parseEffectExtra(xml: any): { + technique: {}; + }; + parseEffectExtraTechnique(xml: any): {}; + parseEffectExtraTechniqueBump(xml: any): {}; + parseMaterial(xml: any): void; + parseCamera(xml: any): void; + parseCameraOptics(xml: any): {}; + parseCameraTechnique(xml: any): { + technique: any; + parameters: {}; + }; + parseCameraParameters(xml: any): {}; + parseLight(xml: any): void; + parseLightTechnique(xml: any): { + technique: any; + parameters: { + color: Color; + falloffAngle: number; + distance: number; + }; + }; + parseLightParameters(xml: any): { + color: Color; + falloffAngle: number; + distance: number; + }; + parseGeometry(xml: any): void; + parseSource(xml: any): { + array: never[]; + stride: number; + }; + parseGeometryVertices(xml: any): {}; + parseGeometryPrimitive(xml: any): { + type: any; + material: any; + count: number; + inputs: {}; + stride: number; + hasUV: boolean; + }; + parseLibraryJoint(xml: any): void; + parseKinematicsModel(xml: any): void; + parseKinematicsTechniqueCommon(xml: any, data: any): void; + parseKinematicsJoint(xml: any): { + sid: any; + name: any; + axis: Vector3; + limits: { + min: number; + max: number; + }; + type: any; + static: boolean; + zeroPosition: number; + middlePosition: number; + } | undefined; + parseKinematicsJointParameter(xml: any): { + sid: any; + name: any; + axis: Vector3; + limits: { + min: number; + max: number; + }; + type: any; + static: boolean; + zeroPosition: number; + middlePosition: number; + }; + parseKinematicsLink(xml: any): { + sid: any; + name: any; + attachments: never[]; + transforms: never[]; + }; + parseKinematicsAttachment(xml: any): { + joint: any; + transforms: never[]; + links: never[]; + }; + parseKinematicsTransform(xml: any): { + type: any; + }; + parsePhysicsModel(xml: any): void; + parsePhysicsRigidBody(xml: any, data: any): void; + parsePhysicsTechniqueCommon(xml: any, data: any): void; + parseKinematicsScene(xml: any): void; + parseKinematicsBindJointAxis(xml: any): { + target: any; + }; + prepareNodes(xml: any): void; + parseNode(xml: any): { + name: any; + type: any; + id: any; + sid: any; + matrix: Matrix4; + nodes: never[]; + instanceCameras: never[]; + instanceControllers: never[]; + instanceLights: never[]; + instanceGeometries: never[]; + instanceNodes: never[]; + transforms: {}; + transformData: {}; + transformOrder: never[]; + }; + parseNodeInstance(xml: any): { + id: any; + materials: {}; + skeletons: never[]; + }; + parseVisualScene(xml: any): void; + hasNode(id: any): boolean; +} +/** + * Utility functions for parsing + */ +export function getElementsByTagName(xml: any, name: any): any[]; +export function parseStrings(text: any): any; +export function parseFloats(text: any): any; +export function parseInts(text: any): any; +export function parseId(text: any): any; +import { Color } from 'three'; +import { Vector3 } from 'three'; +import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts new file mode 100644 index 000000000..93747f8df --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts @@ -0,0 +1,121 @@ +export class IFFParser { + debugger: Debugger; + parse(buffer: any): { + materials: {}; + layers: never[]; + tags: never[]; + textures: never[]; + } | undefined; + reader: DataViewReader | undefined; + tree: { + materials: {}; + layers: never[]; + tags: never[]; + textures: never[]; + } | undefined; + currentLayer: { + materials: {}; + layers: never[]; + tags: never[]; + textures: never[]; + } | { + number: number; + flags: number; + pivot: number[]; + name: string | undefined; + } | undefined; + currentForm: any; + parser: LWO2Parser | LWO3Parser | undefined; + parseTopForm(): void; + parseForm(length: any): void; + parentForm: any; + setupForm(type: any, length: any): void; + currentFormEnd: any; + skipForm(length: any): void; + parseUnknownForm(type: any, length: any): void; + parseSurfaceForm(length: any): void; + currentSurface: { + attributes: {}; + connections: {}; + name: string | undefined; + inputName: string | undefined; + nodes: {}; + source: string | undefined; + } | { + attributes: {}; + connections: {}; + name: string | undefined; + nodes: {}; + source: string | undefined; + } | undefined; + parseSurfaceLwo2(length: any): void; + parseSubNode(length: any): void; + currentNode: { + name: string | undefined; + } | undefined; + parseConnections(length: any): void; + parseEntryForm(length: any): void; + parseValueForm(): void; + parseImageStateForm(): void; + parseImageMap(length: any): void; + parseTextureNodeAttribute(type: any): void; + parseEnvelope(length: any): void; + parseClip(length: any): void; + parseClipLwo2(length: any): void; + parseImage(): void; + parseXVAL(type: any, length: any): void; + parseXVAL3(type: any, length: any): void; + parseObjectTag(): void; + parseLayer(length: any): void; + parsePoints(length: any): void; + currentPoints: any[] | undefined; + parseVertexMapping(length: any, discontinuous: any): void; + parseUVMapping(name: any, finalOffset: any, discontinuous: any): void; + parseMorphTargets(name: any, finalOffset: any, type: any): void; + parsePolygonList(length: any): void; + parseTagStrings(length: any): void; + parsePolygonTagMapping(length: any): void; + parseMaterialIndices(finalOffset: any): void; + parseUnknownCHUNK(blockID: any, length: any): void; +} +declare class Debugger { + active: boolean; + depth: number; + formList: any[]; + offset: number; + node: number; + nodeID: string; + dataOffset: number; + length: number; + skipped: boolean; + enable(): void; + log(): void; + closeForms(): void; +} +declare class DataViewReader { + constructor(buffer: any); + dv: DataView; + offset: number; + _textDecoder: TextDecoder; + _bytes: Uint8Array; + size(): any; + setOffset(offset: any): void; + endOfFile(): boolean; + skip(length: any): void; + getUint8(): number; + getUint16(): number; + getInt32(): number; + getUint32(): number; + getUint64(): number; + getFloat32(): number; + getFloat32Array(size: any): number[]; + getFloat64(): number; + getFloat64Array(size: any): number[]; + getVariableLengthIndex(): number; + getIDTag(): string | undefined; + getString(size: any): string | undefined; + getStringArray(size: any): any; +} +import { LWO2Parser } from './LWO2Parser.js'; +import { LWO3Parser } from './LWO3Parser.js'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts new file mode 100644 index 000000000..dc1f38872 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts @@ -0,0 +1,5 @@ +export class LWO2Parser { + constructor(IFFParser: any); + IFF: any; + parseBlock(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts new file mode 100644 index 000000000..e5fbcedbf --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts @@ -0,0 +1,5 @@ +export class LWO3Parser { + constructor(IFFParser: any); + IFF: any; + parseBlock(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts new file mode 100644 index 000000000..5af253bb2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts @@ -0,0 +1,10 @@ +export function isZipBuffer(buffer: any): boolean; +export function readMtlxArchive(buffer: any): { + text: string; + mtlxPath: any; + files: Map; +}; +export function createArchiveResolver(files: any): { + resolve: (uri: any) => any; + dispose: () => void; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts new file mode 100644 index 000000000..35c99e5bb --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts @@ -0,0 +1,41 @@ +export class MaterialXDocument { + constructor(manager: any, path: any, log: any, archiveResolver?: null, uvSpace?: string); + manager: any; + path: any; + log: any; + archiveResolver: any; + uvSpace: any; + nodesXLib: Map; + imageLoader: ImageLoader; + textureLoader: ImageBitmapLoader; + textureCache: Map; + compileContext: { + mxTransformUv: (uv_scale?: number, uv_offset?: number, uv_geo?: any) => any; + mxHextileCoord: typeof mxHextileCoord; + mxHextileComputeBlendWeights: typeof mxHextileComputeBlendWeights; + invertConstantMatrixValues: typeof invertConstantMatrixValues; + IDENTITY_MAT3_VALUES: number[]; + IDENTITY_MAT4_VALUES: number[]; + mxToBottomLeftUvSpace: typeof mxFlipUvY; + mxFromBottomLeftUvSpace: typeof mxFlipUvY; + compileRegistry: Map; + nodeLibrary: any; + }; + resolveTextureURI(uri: any): any; + addMaterialXNode(materialXNode: any): void; + getMaterialXNode(...names: any[]): any; + parseNode(nodeXML: any, nodePath?: string): any; + parse(text: any, materialName?: null, options?: {}): { + materials: any; + log: any; + errors: any; + warnings: any; + }; +} +import { ImageLoader } from 'three/webgpu'; +import { ImageBitmapLoader } from 'three/webgpu'; +import { mxHextileCoord } from './MaterialXHextile.js'; +import { mxHextileComputeBlendWeights } from './MaterialXHextile.js'; +declare function invertConstantMatrixValues(values: any, size: any): any; +declare function mxFlipUvY(uvNode: any): any; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts new file mode 100644 index 000000000..dd1c81594 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts @@ -0,0 +1,7 @@ +export function mxHextileComputeBlendWeights(luminanceWeights: any, tileWeights: any, falloff: any): any; +export function mxHextileCoord(coord: any, rotation: any, rotationRange: any, scale: any, scaleRange: any, offset: any, offsetRange: any): { + coords: any[]; + ddx: any[]; + ddy: any[]; + weights: any; +}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts new file mode 100644 index 000000000..6feba6fb2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts @@ -0,0 +1 @@ +export function createStrictInterfaceValidator(): (rootNode: any, log: any) => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts new file mode 100644 index 000000000..22d92ea25 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts @@ -0,0 +1,54 @@ +export namespace MaterialXLogCodes { + namespace UNSUPPORTED_NODE { + let label: string; + let severity: string; + } + namespace IGNORED_SURFACE_INPUT { + let label_1: string; + export { label_1 as label }; + let severity_1: string; + export { severity_1 as severity }; + } + namespace MISSING_REFERENCE { + let label_2: string; + export { label_2 as label }; + let severity_2: string; + export { severity_2 as severity }; + } + namespace MISSING_MATERIAL { + let label_3: string; + export { label_3 as label }; + let severity_3: string; + export { severity_3 as severity }; + } + namespace INVALID_VALUE { + let label_4: string; + export { label_4 as label }; + let severity_4: string; + export { severity_4 as severity }; + } + namespace UNKNOWN_INPUT { + let label_5: string; + export { label_5 as label }; + let severity_5: string; + export { severity_5 as severity }; + } + namespace INVALID_OUTPUT_CONNECTION { + let label_6: string; + export { label_6 as label }; + let severity_6: string; + export { severity_6 as severity }; + } + namespace TYPE_MISMATCH { + let label_7: string; + export { label_7 as label }; + let severity_7: string; + export { severity_7 as severity }; + } +} +export class MaterialXLog { + entries: any[]; + get errors(): any[]; + get warnings(): any[]; + add(code: any, message: any, nodeName: any): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts new file mode 100644 index 000000000..6f917f61d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts @@ -0,0 +1,33497 @@ +export default registryData; +declare namespace registryData { + namespace nodedefs { + namespace ND_oren_nayar_diffuse_bsdf { + let node: string; + let inherit: null; + namespace inputs { + let weight: string; + let color: string; + let roughness: string; + let normal: string; + let energy_compensation: string; + } + namespace outputs { + let out: string; + } + } + namespace ND_burley_diffuse_bsdf { + let node_1: string; + export { node_1 as node }; + let inherit_1: null; + export { inherit_1 as inherit }; + export namespace inputs_1 { + let weight_1: string; + export { weight_1 as weight }; + let color_1: string; + export { color_1 as color }; + let roughness_1: string; + export { roughness_1 as roughness }; + let normal_1: string; + export { normal_1 as normal }; + } + export { inputs_1 as inputs }; + export namespace outputs_1 { + let out_1: string; + export { out_1 as out }; + } + export { outputs_1 as outputs }; + } + namespace ND_translucent_bsdf { + let node_2: string; + export { node_2 as node }; + let inherit_2: null; + export { inherit_2 as inherit }; + export namespace inputs_2 { + let weight_2: string; + export { weight_2 as weight }; + let color_2: string; + export { color_2 as color }; + let normal_2: string; + export { normal_2 as normal }; + } + export { inputs_2 as inputs }; + export namespace outputs_2 { + let out_2: string; + export { out_2 as out }; + } + export { outputs_2 as outputs }; + } + namespace ND_dielectric_bsdf { + let node_3: string; + export { node_3 as node }; + let inherit_3: null; + export { inherit_3 as inherit }; + export namespace inputs_3 { + let weight_3: string; + export { weight_3 as weight }; + export let tint: string; + export let ior: string; + let roughness_2: string; + export { roughness_2 as roughness }; + export let retroreflective: string; + export let thinfilm_thickness: string; + export let thinfilm_ior: string; + let normal_3: string; + export { normal_3 as normal }; + export let tangent: string; + export let distribution: string; + export let scatter_mode: string; + } + export { inputs_3 as inputs }; + export namespace outputs_3 { + let out_3: string; + export { out_3 as out }; + } + export { outputs_3 as outputs }; + } + namespace ND_conductor_bsdf { + let node_4: string; + export { node_4 as node }; + let inherit_4: null; + export { inherit_4 as inherit }; + export namespace inputs_4 { + let weight_4: string; + export { weight_4 as weight }; + let ior_1: string; + export { ior_1 as ior }; + export let extinction: string; + let roughness_3: string; + export { roughness_3 as roughness }; + let retroreflective_1: string; + export { retroreflective_1 as retroreflective }; + let thinfilm_thickness_1: string; + export { thinfilm_thickness_1 as thinfilm_thickness }; + let thinfilm_ior_1: string; + export { thinfilm_ior_1 as thinfilm_ior }; + let normal_4: string; + export { normal_4 as normal }; + let tangent_1: string; + export { tangent_1 as tangent }; + let distribution_1: string; + export { distribution_1 as distribution }; + } + export { inputs_4 as inputs }; + export namespace outputs_4 { + let out_4: string; + export { out_4 as out }; + } + export { outputs_4 as outputs }; + } + namespace ND_generalized_schlick_bsdf { + let node_5: string; + export { node_5 as node }; + let inherit_5: null; + export { inherit_5 as inherit }; + export namespace inputs_5 { + let weight_5: string; + export { weight_5 as weight }; + export let color0: string; + export let color82: string; + export let color90: string; + export let exponent: string; + let roughness_4: string; + export { roughness_4 as roughness }; + let retroreflective_2: string; + export { retroreflective_2 as retroreflective }; + let thinfilm_thickness_2: string; + export { thinfilm_thickness_2 as thinfilm_thickness }; + let thinfilm_ior_2: string; + export { thinfilm_ior_2 as thinfilm_ior }; + let normal_5: string; + export { normal_5 as normal }; + let tangent_2: string; + export { tangent_2 as tangent }; + let distribution_2: string; + export { distribution_2 as distribution }; + let scatter_mode_1: string; + export { scatter_mode_1 as scatter_mode }; + } + export { inputs_5 as inputs }; + export namespace outputs_5 { + let out_5: string; + export { out_5 as out }; + } + export { outputs_5 as outputs }; + } + namespace ND_subsurface_bsdf { + let node_6: string; + export { node_6 as node }; + let inherit_6: null; + export { inherit_6 as inherit }; + export namespace inputs_6 { + let weight_6: string; + export { weight_6 as weight }; + let color_3: string; + export { color_3 as color }; + export let radius: string; + export let anisotropy: string; + let normal_6: string; + export { normal_6 as normal }; + } + export { inputs_6 as inputs }; + export namespace outputs_6 { + let out_6: string; + export { out_6 as out }; + } + export { outputs_6 as outputs }; + } + namespace ND_sheen_bsdf { + let node_7: string; + export { node_7 as node }; + let inherit_7: null; + export { inherit_7 as inherit }; + export namespace inputs_7 { + let weight_7: string; + export { weight_7 as weight }; + let color_4: string; + export { color_4 as color }; + let roughness_5: string; + export { roughness_5 as roughness }; + let normal_7: string; + export { normal_7 as normal }; + export let mode: string; + } + export { inputs_7 as inputs }; + export namespace outputs_7 { + let out_7: string; + export { out_7 as out }; + } + export { outputs_7 as outputs }; + } + namespace ND_chiang_hair_bsdf { + let node_8: string; + export { node_8 as node }; + let inherit_8: null; + export { inherit_8 as inherit }; + export namespace inputs_8 { + export let tint_R: string; + export let tint_TT: string; + export let tint_TRT: string; + let ior_2: string; + export { ior_2 as ior }; + export let roughness_R: string; + export let roughness_TT: string; + export let roughness_TRT: string; + export let cuticle_angle: string; + export let absorption_coefficient: string; + let normal_8: string; + export { normal_8 as normal }; + export let curve_direction: string; + } + export { inputs_8 as inputs }; + export namespace outputs_8 { + let out_8: string; + export { out_8 as out }; + } + export { outputs_8 as outputs }; + } + namespace ND_uniform_edf { + let node_9: string; + export { node_9 as node }; + let inherit_9: null; + export { inherit_9 as inherit }; + export namespace inputs_9 { + let color_5: string; + export { color_5 as color }; + } + export { inputs_9 as inputs }; + export namespace outputs_9 { + let out_9: string; + export { out_9 as out }; + } + export { outputs_9 as outputs }; + } + namespace ND_conical_edf { + let node_10: string; + export { node_10 as node }; + let inherit_10: null; + export { inherit_10 as inherit }; + export namespace inputs_10 { + let color_6: string; + export { color_6 as color }; + let normal_9: string; + export { normal_9 as normal }; + export let inner_angle: string; + export let outer_angle: string; + } + export { inputs_10 as inputs }; + export namespace outputs_10 { + let out_10: string; + export { out_10 as out }; + } + export { outputs_10 as outputs }; + } + namespace ND_measured_edf { + let node_11: string; + export { node_11 as node }; + let inherit_11: null; + export { inherit_11 as inherit }; + export namespace inputs_11 { + let color_7: string; + export { color_7 as color }; + let normal_10: string; + export { normal_10 as normal }; + export let file: string; + } + export { inputs_11 as inputs }; + export namespace outputs_11 { + let out_11: string; + export { out_11 as out }; + } + export { outputs_11 as outputs }; + } + namespace ND_generalized_schlick_edf { + let node_12: string; + export { node_12 as node }; + let inherit_12: null; + export { inherit_12 as inherit }; + export namespace inputs_12 { + let color0_1: string; + export { color0_1 as color0 }; + let color90_1: string; + export { color90_1 as color90 }; + let exponent_1: string; + export { exponent_1 as exponent }; + export let base: string; + } + export { inputs_12 as inputs }; + export namespace outputs_12 { + let out_12: string; + export { out_12 as out }; + } + export { outputs_12 as outputs }; + } + namespace ND_absorption_vdf { + let node_13: string; + export { node_13 as node }; + let inherit_13: null; + export { inherit_13 as inherit }; + export namespace inputs_13 { + let absorption: string; + } + export { inputs_13 as inputs }; + export namespace outputs_13 { + let out_13: string; + export { out_13 as out }; + } + export { outputs_13 as outputs }; + } + namespace ND_anisotropic_vdf { + let node_14: string; + export { node_14 as node }; + let inherit_14: null; + export { inherit_14 as inherit }; + export namespace inputs_14 { + let absorption_1: string; + export { absorption_1 as absorption }; + export let scattering: string; + let anisotropy_1: string; + export { anisotropy_1 as anisotropy }; + } + export { inputs_14 as inputs }; + export namespace outputs_14 { + let out_14: string; + export { out_14 as out }; + } + export { outputs_14 as outputs }; + } + namespace ND_surface { + let node_15: string; + export { node_15 as node }; + let inherit_15: null; + export { inherit_15 as inherit }; + export namespace inputs_15 { + let bsdf: string; + let edf: string; + let opacity: string; + let thin_walled: string; + } + export { inputs_15 as inputs }; + export namespace outputs_15 { + let out_15: string; + export { out_15 as out }; + } + export { outputs_15 as outputs }; + } + namespace ND_volume { + let node_16: string; + export { node_16 as node }; + let inherit_16: null; + export { inherit_16 as inherit }; + export namespace inputs_16 { + export let vdf: string; + let edf_1: string; + export { edf_1 as edf }; + } + export { inputs_16 as inputs }; + export namespace outputs_16 { + let out_16: string; + export { out_16 as out }; + } + export { outputs_16 as outputs }; + } + namespace ND_light { + let node_17: string; + export { node_17 as node }; + let inherit_17: null; + export { inherit_17 as inherit }; + export namespace inputs_17 { + let edf_2: string; + export { edf_2 as edf }; + export let intensity: string; + export let exposure: string; + } + export { inputs_17 as inputs }; + export namespace outputs_17 { + let out_17: string; + export { out_17 as out }; + } + export { outputs_17 as outputs }; + } + namespace ND_displacement_float { + let node_18: string; + export { node_18 as node }; + let inherit_18: null; + export { inherit_18 as inherit }; + export namespace inputs_18 { + let displacement: string; + let scale: string; + } + export { inputs_18 as inputs }; + export namespace outputs_18 { + let out_18: string; + export { out_18 as out }; + } + export { outputs_18 as outputs }; + } + namespace ND_displacement_vector3 { + let node_19: string; + export { node_19 as node }; + let inherit_19: null; + export { inherit_19 as inherit }; + export namespace inputs_19 { + let displacement_1: string; + export { displacement_1 as displacement }; + let scale_1: string; + export { scale_1 as scale }; + } + export { inputs_19 as inputs }; + export namespace outputs_19 { + let out_19: string; + export { out_19 as out }; + } + export { outputs_19 as outputs }; + } + namespace ND_layer_bsdf { + let node_20: string; + export { node_20 as node }; + let inherit_20: null; + export { inherit_20 as inherit }; + export namespace inputs_20 { + export let top: string; + let base_1: string; + export { base_1 as base }; + } + export { inputs_20 as inputs }; + export namespace outputs_20 { + let out_20: string; + export { out_20 as out }; + } + export { outputs_20 as outputs }; + } + namespace ND_layer_vdf { + let node_21: string; + export { node_21 as node }; + let inherit_21: null; + export { inherit_21 as inherit }; + export namespace inputs_21 { + let top_1: string; + export { top_1 as top }; + let base_2: string; + export { base_2 as base }; + } + export { inputs_21 as inputs }; + export namespace outputs_21 { + let out_21: string; + export { out_21 as out }; + } + export { outputs_21 as outputs }; + } + namespace ND_mix_bsdf { + let node_22: string; + export { node_22 as node }; + let inherit_22: null; + export { inherit_22 as inherit }; + export namespace inputs_22 { + let fg: string; + let bg: string; + let mix: string; + } + export { inputs_22 as inputs }; + export namespace outputs_22 { + let out_22: string; + export { out_22 as out }; + } + export { outputs_22 as outputs }; + } + namespace ND_mix_edf { + let node_23: string; + export { node_23 as node }; + let inherit_23: null; + export { inherit_23 as inherit }; + export namespace inputs_23 { + let fg_1: string; + export { fg_1 as fg }; + let bg_1: string; + export { bg_1 as bg }; + let mix_1: string; + export { mix_1 as mix }; + } + export { inputs_23 as inputs }; + export namespace outputs_23 { + let out_23: string; + export { out_23 as out }; + } + export { outputs_23 as outputs }; + } + namespace ND_mix_vdf { + let node_24: string; + export { node_24 as node }; + let inherit_24: null; + export { inherit_24 as inherit }; + export namespace inputs_24 { + let fg_2: string; + export { fg_2 as fg }; + let bg_2: string; + export { bg_2 as bg }; + let mix_2: string; + export { mix_2 as mix }; + } + export { inputs_24 as inputs }; + export namespace outputs_24 { + let out_24: string; + export { out_24 as out }; + } + export { outputs_24 as outputs }; + } + namespace ND_add_bsdf { + let node_25: string; + export { node_25 as node }; + let inherit_25: null; + export { inherit_25 as inherit }; + export namespace inputs_25 { + let in1: string; + let in2: string; + } + export { inputs_25 as inputs }; + export namespace outputs_25 { + let out_25: string; + export { out_25 as out }; + } + export { outputs_25 as outputs }; + } + namespace ND_add_edf { + let node_26: string; + export { node_26 as node }; + let inherit_26: null; + export { inherit_26 as inherit }; + export namespace inputs_26 { + let in1_1: string; + export { in1_1 as in1 }; + let in2_1: string; + export { in2_1 as in2 }; + } + export { inputs_26 as inputs }; + export namespace outputs_26 { + let out_26: string; + export { out_26 as out }; + } + export { outputs_26 as outputs }; + } + namespace ND_add_vdf { + let node_27: string; + export { node_27 as node }; + let inherit_27: null; + export { inherit_27 as inherit }; + export namespace inputs_27 { + let in1_2: string; + export { in1_2 as in1 }; + let in2_2: string; + export { in2_2 as in2 }; + } + export { inputs_27 as inputs }; + export namespace outputs_27 { + let out_27: string; + export { out_27 as out }; + } + export { outputs_27 as outputs }; + } + namespace ND_multiply_bsdfC { + let node_28: string; + export { node_28 as node }; + let inherit_28: null; + export { inherit_28 as inherit }; + export namespace inputs_28 { + let in1_3: string; + export { in1_3 as in1 }; + let in2_3: string; + export { in2_3 as in2 }; + } + export { inputs_28 as inputs }; + export namespace outputs_28 { + let out_28: string; + export { out_28 as out }; + } + export { outputs_28 as outputs }; + } + namespace ND_multiply_bsdfF { + let node_29: string; + export { node_29 as node }; + let inherit_29: null; + export { inherit_29 as inherit }; + export namespace inputs_29 { + let in1_4: string; + export { in1_4 as in1 }; + let in2_4: string; + export { in2_4 as in2 }; + } + export { inputs_29 as inputs }; + export namespace outputs_29 { + let out_29: string; + export { out_29 as out }; + } + export { outputs_29 as outputs }; + } + namespace ND_multiply_edfC { + let node_30: string; + export { node_30 as node }; + let inherit_30: null; + export { inherit_30 as inherit }; + export namespace inputs_30 { + let in1_5: string; + export { in1_5 as in1 }; + let in2_5: string; + export { in2_5 as in2 }; + } + export { inputs_30 as inputs }; + export namespace outputs_30 { + let out_30: string; + export { out_30 as out }; + } + export { outputs_30 as outputs }; + } + namespace ND_multiply_edfF { + let node_31: string; + export { node_31 as node }; + let inherit_31: null; + export { inherit_31 as inherit }; + export namespace inputs_31 { + let in1_6: string; + export { in1_6 as in1 }; + let in2_6: string; + export { in2_6 as in2 }; + } + export { inputs_31 as inputs }; + export namespace outputs_31 { + let out_31: string; + export { out_31 as out }; + } + export { outputs_31 as outputs }; + } + namespace ND_multiply_vdfC { + let node_32: string; + export { node_32 as node }; + let inherit_32: null; + export { inherit_32 as inherit }; + export namespace inputs_32 { + let in1_7: string; + export { in1_7 as in1 }; + let in2_7: string; + export { in2_7 as in2 }; + } + export { inputs_32 as inputs }; + export namespace outputs_32 { + let out_32: string; + export { out_32 as out }; + } + export { outputs_32 as outputs }; + } + namespace ND_multiply_vdfF { + let node_33: string; + export { node_33 as node }; + let inherit_33: null; + export { inherit_33 as inherit }; + export namespace inputs_33 { + let in1_8: string; + export { in1_8 as in1 }; + let in2_8: string; + export { in2_8 as in2 }; + } + export { inputs_33 as inputs }; + export namespace outputs_33 { + let out_33: string; + export { out_33 as out }; + } + export { outputs_33 as outputs }; + } + namespace ND_roughness_anisotropy { + let node_34: string; + export { node_34 as node }; + let inherit_34: null; + export { inherit_34 as inherit }; + export namespace inputs_34 { + let roughness_6: string; + export { roughness_6 as roughness }; + let anisotropy_2: string; + export { anisotropy_2 as anisotropy }; + } + export { inputs_34 as inputs }; + export namespace outputs_34 { + let out_34: string; + export { out_34 as out }; + } + export { outputs_34 as outputs }; + } + namespace ND_roughness_dual { + let node_35: string; + export { node_35 as node }; + let inherit_35: null; + export { inherit_35 as inherit }; + export namespace inputs_35 { + let roughness_7: string; + export { roughness_7 as roughness }; + } + export { inputs_35 as inputs }; + export namespace outputs_35 { + let out_35: string; + export { out_35 as out }; + } + export { outputs_35 as outputs }; + } + namespace ND_glossiness_anisotropy { + let node_36: string; + export { node_36 as node }; + let inherit_36: null; + export { inherit_36 as inherit }; + export namespace inputs_36 { + export let glossiness: string; + let anisotropy_3: string; + export { anisotropy_3 as anisotropy }; + } + export { inputs_36 as inputs }; + export namespace outputs_36 { + let out_36: string; + export { out_36 as out }; + } + export { outputs_36 as outputs }; + } + namespace ND_blackbody { + let node_37: string; + export { node_37 as node }; + let inherit_37: null; + export { inherit_37 as inherit }; + export namespace inputs_37 { + let temperature: string; + } + export { inputs_37 as inputs }; + export namespace outputs_37 { + let out_37: string; + export { out_37 as out }; + } + export { outputs_37 as outputs }; + } + namespace ND_artistic_ior { + let node_38: string; + export { node_38 as node }; + let inherit_38: null; + export { inherit_38 as inherit }; + export namespace inputs_38 { + let reflectivity: string; + let edge_color: string; + } + export { inputs_38 as inputs }; + export namespace outputs_38 { + let ior_3: string; + export { ior_3 as ior }; + let extinction_1: string; + export { extinction_1 as extinction }; + } + export { outputs_38 as outputs }; + } + namespace ND_deon_hair_absorption_from_melanin { + let node_39: string; + export { node_39 as node }; + let inherit_39: null; + export { inherit_39 as inherit }; + export namespace inputs_39 { + let melanin_concentration: string; + let melanin_redness: string; + let eumelanin_color: string; + let pheomelanin_color: string; + } + export { inputs_39 as inputs }; + export namespace outputs_39 { + let absorption_2: string; + export { absorption_2 as absorption }; + } + export { outputs_39 as outputs }; + } + namespace ND_chiang_hair_absorption_from_color { + let node_40: string; + export { node_40 as node }; + let inherit_40: null; + export { inherit_40 as inherit }; + export namespace inputs_40 { + let color_8: string; + export { color_8 as color }; + export let azimuthal_roughness: string; + } + export { inputs_40 as inputs }; + export namespace outputs_40 { + let absorption_3: string; + export { absorption_3 as absorption }; + } + export { outputs_40 as outputs }; + } + namespace ND_chiang_hair_roughness { + let node_41: string; + export { node_41 as node }; + let inherit_41: null; + export { inherit_41 as inherit }; + export namespace inputs_41 { + let longitudinal: string; + let azimuthal: string; + let scale_TT: string; + let scale_TRT: string; + } + export { inputs_41 as inputs }; + export namespace outputs_41 { + let roughness_R_1: string; + export { roughness_R_1 as roughness_R }; + let roughness_TT_1: string; + export { roughness_TT_1 as roughness_TT }; + let roughness_TRT_1: string; + export { roughness_TRT_1 as roughness_TRT }; + } + export { outputs_41 as outputs }; + } + namespace ND_disney_principled { + let node_42: string; + export { node_42 as node }; + let inherit_42: null; + export { inherit_42 as inherit }; + export namespace inputs_42 { + export let baseColor: string; + export let metallic: string; + let roughness_8: string; + export { roughness_8 as roughness }; + export let anisotropic: string; + export let specular: string; + export let specularTint: string; + export let sheen: string; + export let sheenTint: string; + export let clearcoat: string; + export let clearcoatGloss: string; + export let specTrans: string; + let ior_4: string; + export { ior_4 as ior }; + export let subsurface: string; + export let subsurfaceDistance: string; + } + export { inputs_42 as inputs }; + export namespace outputs_42 { + let out_38: string; + export { out_38 as out }; + } + export { outputs_42 as outputs }; + } + namespace ND_open_pbr_surface_surfaceshader { + let node_43: string; + export { node_43 as node }; + let inherit_43: null; + export { inherit_43 as inherit }; + export namespace inputs_43 { + let base_weight: string; + let base_color: string; + let base_diffuse_roughness: string; + let base_metalness: string; + let specular_weight: string; + let specular_color: string; + let specular_roughness: string; + let specular_ior: string; + let specular_roughness_anisotropy: string; + let transmission_weight: string; + let transmission_color: string; + let transmission_depth: string; + let transmission_scatter: string; + let transmission_scatter_anisotropy: string; + let transmission_dispersion_scale: string; + let transmission_dispersion_abbe_number: string; + let subsurface_weight: string; + let subsurface_color: string; + let subsurface_radius: string; + let subsurface_radius_scale: string; + let subsurface_scatter_anisotropy: string; + let fuzz_weight: string; + let fuzz_color: string; + let fuzz_roughness: string; + let coat_weight: string; + let coat_color: string; + let coat_roughness: string; + let coat_roughness_anisotropy: string; + let coat_ior: string; + let coat_darkening: string; + let thin_film_weight: string; + let thin_film_thickness: string; + let thin_film_ior: string; + let emission_luminance: string; + let emission_color: string; + let geometry_opacity: string; + let geometry_thin_walled: string; + let geometry_normal: string; + let geometry_coat_normal: string; + let geometry_tangent: string; + let geometry_coat_tangent: string; + } + export { inputs_43 as inputs }; + export namespace outputs_43 { + let out_39: string; + export { out_39 as out }; + } + export { outputs_43 as outputs }; + } + namespace ND_open_pbr_anisotropy { + let node_44: string; + export { node_44 as node }; + let inherit_44: null; + export { inherit_44 as inherit }; + export namespace inputs_44 { + let roughness_9: string; + export { roughness_9 as roughness }; + let anisotropy_4: string; + export { anisotropy_4 as anisotropy }; + } + export { inputs_44 as inputs }; + export namespace outputs_44 { + let out_40: string; + export { out_40 as out }; + } + export { outputs_44 as outputs }; + } + namespace ND_UsdPreviewSurface_surfaceshader { + let node_45: string; + export { node_45 as node }; + let inherit_45: null; + export { inherit_45 as inherit }; + export namespace inputs_45 { + export let diffuseColor: string; + export let emissiveColor: string; + export let useSpecularWorkflow: string; + export let specularColor: string; + let metallic_1: string; + export { metallic_1 as metallic }; + let roughness_10: string; + export { roughness_10 as roughness }; + let clearcoat_1: string; + export { clearcoat_1 as clearcoat }; + export let clearcoatRoughness: string; + let opacity_1: string; + export { opacity_1 as opacity }; + export let opacityMode: string; + export let opacityThreshold: string; + let ior_5: string; + export { ior_5 as ior }; + let normal_11: string; + export { normal_11 as normal }; + let displacement_2: string; + export { displacement_2 as displacement }; + export let occlusion: string; + } + export { inputs_45 as inputs }; + export namespace outputs_45 { + let out_41: string; + export { out_41 as out }; + } + export { outputs_45 as outputs }; + } + namespace ND_UsdUVTexture { + let node_46: string; + export { node_46 as node }; + let inherit_46: string; + export { inherit_46 as inherit }; + let inputs_46: {}; + export { inputs_46 as inputs }; + export namespace outputs_46 { + let r: string; + let g: string; + let b: string; + let a: string; + let rgb: string; + let rgba: string; + } + export { outputs_46 as outputs }; + } + namespace ND_UsdUVTexture_23 { + let node_47: string; + export { node_47 as node }; + let inherit_47: null; + export { inherit_47 as inherit }; + export namespace inputs_47 { + let file_1: string; + export { file_1 as file }; + export let st: string; + export let wrapS: string; + export let wrapT: string; + export let fallback: string; + let scale_2: string; + export { scale_2 as scale }; + export let bias: string; + } + export { inputs_47 as inputs }; + export namespace outputs_47 { + let r_1: string; + export { r_1 as r }; + let g_1: string; + export { g_1 as g }; + let b_1: string; + export { b_1 as b }; + let a_1: string; + export { a_1 as a }; + let rgb_1: string; + export { rgb_1 as rgb }; + } + export { outputs_47 as outputs }; + } + namespace ND_UsdPrimvarReader_integer { + let node_48: string; + export { node_48 as node }; + let inherit_48: null; + export { inherit_48 as inherit }; + export namespace inputs_48 { + export let varname: string; + let fallback_1: string; + export { fallback_1 as fallback }; + } + export { inputs_48 as inputs }; + export namespace outputs_48 { + let out_42: string; + export { out_42 as out }; + } + export { outputs_48 as outputs }; + } + namespace ND_UsdPrimvarReader_boolean { + let node_49: string; + export { node_49 as node }; + let inherit_49: null; + export { inherit_49 as inherit }; + export namespace inputs_49 { + let varname_1: string; + export { varname_1 as varname }; + let fallback_2: string; + export { fallback_2 as fallback }; + } + export { inputs_49 as inputs }; + export namespace outputs_49 { + let out_43: string; + export { out_43 as out }; + } + export { outputs_49 as outputs }; + } + namespace ND_UsdPrimvarReader_string { + let node_50: string; + export { node_50 as node }; + let inherit_50: null; + export { inherit_50 as inherit }; + export namespace inputs_50 { + let varname_2: string; + export { varname_2 as varname }; + let fallback_3: string; + export { fallback_3 as fallback }; + } + export { inputs_50 as inputs }; + export namespace outputs_50 { + let out_44: string; + export { out_44 as out }; + } + export { outputs_50 as outputs }; + } + namespace ND_UsdPrimvarReader_filename { + let node_51: string; + export { node_51 as node }; + let inherit_51: null; + export { inherit_51 as inherit }; + export namespace inputs_51 { + let varname_3: string; + export { varname_3 as varname }; + let fallback_4: string; + export { fallback_4 as fallback }; + } + export { inputs_51 as inputs }; + export namespace outputs_51 { + let out_45: string; + export { out_45 as out }; + } + export { outputs_51 as outputs }; + } + namespace ND_UsdPrimvarReader_float { + let node_52: string; + export { node_52 as node }; + let inherit_52: null; + export { inherit_52 as inherit }; + export namespace inputs_52 { + let varname_4: string; + export { varname_4 as varname }; + let fallback_5: string; + export { fallback_5 as fallback }; + } + export { inputs_52 as inputs }; + export namespace outputs_52 { + let out_46: string; + export { out_46 as out }; + } + export { outputs_52 as outputs }; + } + namespace ND_UsdPrimvarReader_vector2 { + let node_53: string; + export { node_53 as node }; + let inherit_53: null; + export { inherit_53 as inherit }; + export namespace inputs_53 { + let varname_5: string; + export { varname_5 as varname }; + let fallback_6: string; + export { fallback_6 as fallback }; + } + export { inputs_53 as inputs }; + export namespace outputs_53 { + let out_47: string; + export { out_47 as out }; + } + export { outputs_53 as outputs }; + } + namespace ND_UsdPrimvarReader_vector3 { + let node_54: string; + export { node_54 as node }; + let inherit_54: null; + export { inherit_54 as inherit }; + export namespace inputs_54 { + let varname_6: string; + export { varname_6 as varname }; + let fallback_7: string; + export { fallback_7 as fallback }; + } + export { inputs_54 as inputs }; + export namespace outputs_54 { + let out_48: string; + export { out_48 as out }; + } + export { outputs_54 as outputs }; + } + namespace ND_UsdPrimvarReader_vector4 { + let node_55: string; + export { node_55 as node }; + let inherit_55: null; + export { inherit_55 as inherit }; + export namespace inputs_55 { + let varname_7: string; + export { varname_7 as varname }; + let fallback_8: string; + export { fallback_8 as fallback }; + } + export { inputs_55 as inputs }; + export namespace outputs_55 { + let out_49: string; + export { out_49 as out }; + } + export { outputs_55 as outputs }; + } + namespace ND_UsdTransform2d { + let node_56: string; + export { node_56 as node }; + let inherit_56: null; + export { inherit_56 as inherit }; + export namespace inputs_56 { + let _in: string; + export { _in as in }; + export let rotation: string; + let scale_3: string; + export { scale_3 as scale }; + export let translation: string; + } + export { inputs_56 as inputs }; + export namespace outputs_56 { + let out_50: string; + export { out_50 as out }; + } + export { outputs_56 as outputs }; + } + namespace ND_standard_surface_surfaceshader { + let node_57: string; + export { node_57 as node }; + let inherit_57: string; + export { inherit_57 as inherit }; + export namespace inputs_57 { + let base_3: string; + export { base_3 as base }; + let base_color_1: string; + export { base_color_1 as base_color }; + } + export { inputs_57 as inputs }; + let outputs_57: {}; + export { outputs_57 as outputs }; + } + namespace ND_standard_surface_surfaceshader_100 { + let node_58: string; + export { node_58 as node }; + let inherit_58: null; + export { inherit_58 as inherit }; + export namespace inputs_58 { + let base_4: string; + export { base_4 as base }; + let base_color_2: string; + export { base_color_2 as base_color }; + export let diffuse_roughness: string; + export let metalness: string; + let specular_1: string; + export { specular_1 as specular }; + let specular_color_1: string; + export { specular_color_1 as specular_color }; + let specular_roughness_1: string; + export { specular_roughness_1 as specular_roughness }; + export let specular_IOR: string; + export let specular_anisotropy: string; + export let specular_rotation: string; + export let transmission: string; + let transmission_color_1: string; + export { transmission_color_1 as transmission_color }; + let transmission_depth_1: string; + export { transmission_depth_1 as transmission_depth }; + let transmission_scatter_1: string; + export { transmission_scatter_1 as transmission_scatter }; + let transmission_scatter_anisotropy_1: string; + export { transmission_scatter_anisotropy_1 as transmission_scatter_anisotropy }; + export let transmission_dispersion: string; + export let transmission_extra_roughness: string; + let subsurface_1: string; + export { subsurface_1 as subsurface }; + let subsurface_color_1: string; + export { subsurface_color_1 as subsurface_color }; + let subsurface_radius_1: string; + export { subsurface_radius_1 as subsurface_radius }; + export let subsurface_scale: string; + export let subsurface_anisotropy: string; + let sheen_1: string; + export { sheen_1 as sheen }; + export let sheen_color: string; + export let sheen_roughness: string; + export let coat: string; + let coat_color_1: string; + export { coat_color_1 as coat_color }; + let coat_roughness_1: string; + export { coat_roughness_1 as coat_roughness }; + export let coat_anisotropy: string; + export let coat_rotation: string; + export let coat_IOR: string; + export let coat_normal: string; + export let coat_affect_color: string; + export let coat_affect_roughness: string; + let thin_film_thickness_1: string; + export { thin_film_thickness_1 as thin_film_thickness }; + export let thin_film_IOR: string; + export let emission: string; + let emission_color_1: string; + export { emission_color_1 as emission_color }; + let opacity_2: string; + export { opacity_2 as opacity }; + let thin_walled_1: string; + export { thin_walled_1 as thin_walled }; + let normal_12: string; + export { normal_12 as normal }; + let tangent_3: string; + export { tangent_3 as tangent }; + } + export { inputs_58 as inputs }; + export namespace outputs_58 { + let out_51: string; + export { out_51 as out }; + } + export { outputs_58 as outputs }; + } + namespace ND_gltf_pbr_surfaceshader { + let node_59: string; + export { node_59 as node }; + let inherit_59: null; + export { inherit_59 as inherit }; + export namespace inputs_59 { + let base_color_3: string; + export { base_color_3 as base_color }; + let metallic_2: string; + export { metallic_2 as metallic }; + let roughness_11: string; + export { roughness_11 as roughness }; + let normal_13: string; + export { normal_13 as normal }; + let tangent_4: string; + export { tangent_4 as tangent }; + let occlusion_1: string; + export { occlusion_1 as occlusion }; + let transmission_1: string; + export { transmission_1 as transmission }; + let specular_2: string; + export { specular_2 as specular }; + let specular_color_2: string; + export { specular_color_2 as specular_color }; + let ior_6: string; + export { ior_6 as ior }; + export let alpha: string; + export let alpha_mode: string; + export let alpha_cutoff: string; + export let iridescence: string; + export let iridescence_ior: string; + export let iridescence_thickness: string; + let sheen_color_1: string; + export { sheen_color_1 as sheen_color }; + let sheen_roughness_1: string; + export { sheen_roughness_1 as sheen_roughness }; + let clearcoat_2: string; + export { clearcoat_2 as clearcoat }; + export let clearcoat_roughness: string; + export let clearcoat_normal: string; + export let emissive: string; + export let emissive_strength: string; + export let thickness: string; + export let attenuation_distance: string; + export let attenuation_color: string; + export let anisotropy_strength: string; + export let anisotropy_rotation: string; + export let dispersion: string; + } + export { inputs_59 as inputs }; + export namespace outputs_59 { + let out_52: string; + export { out_52 as out }; + } + export { outputs_59 as outputs }; + } + namespace ND_gltf_colorimage { + let node_60: string; + export { node_60 as node }; + let inherit_60: null; + export { inherit_60 as inherit }; + export namespace inputs_60 { + let file_2: string; + export { file_2 as file }; + let _default: string; + export { _default as default }; + export let texcoord: string; + export let pivot: string; + let scale_4: string; + export { scale_4 as scale }; + export let rotate: string; + export let offset: string; + export let operationorder: string; + export let uaddressmode: string; + export let vaddressmode: string; + export let filtertype: string; + let color_9: string; + export { color_9 as color }; + export let geomcolor: string; + } + export { inputs_60 as inputs }; + export namespace outputs_60 { + let outcolor: string; + let outa: string; + } + export { outputs_60 as outputs }; + } + namespace ND_gltf_image_color3_color3_1_0 { + let node_61: string; + export { node_61 as node }; + let inherit_61: null; + export { inherit_61 as inherit }; + export namespace inputs_61 { + let file_3: string; + export { file_3 as file }; + export let factor: string; + let _default_1: string; + export { _default_1 as default }; + let texcoord_1: string; + export { texcoord_1 as texcoord }; + let pivot_1: string; + export { pivot_1 as pivot }; + let scale_5: string; + export { scale_5 as scale }; + let rotate_1: string; + export { rotate_1 as rotate }; + let offset_1: string; + export { offset_1 as offset }; + let operationorder_1: string; + export { operationorder_1 as operationorder }; + let uaddressmode_1: string; + export { uaddressmode_1 as uaddressmode }; + let vaddressmode_1: string; + export { vaddressmode_1 as vaddressmode }; + let filtertype_1: string; + export { filtertype_1 as filtertype }; + } + export { inputs_61 as inputs }; + export namespace outputs_61 { + let out_53: string; + export { out_53 as out }; + } + export { outputs_61 as outputs }; + } + namespace ND_gltf_image_color4_color4_1_0 { + let node_62: string; + export { node_62 as node }; + let inherit_62: null; + export { inherit_62 as inherit }; + export namespace inputs_62 { + let file_4: string; + export { file_4 as file }; + let factor_1: string; + export { factor_1 as factor }; + let _default_2: string; + export { _default_2 as default }; + let texcoord_2: string; + export { texcoord_2 as texcoord }; + let pivot_2: string; + export { pivot_2 as pivot }; + let scale_6: string; + export { scale_6 as scale }; + let rotate_2: string; + export { rotate_2 as rotate }; + let offset_2: string; + export { offset_2 as offset }; + let operationorder_2: string; + export { operationorder_2 as operationorder }; + let uaddressmode_2: string; + export { uaddressmode_2 as uaddressmode }; + let vaddressmode_2: string; + export { vaddressmode_2 as vaddressmode }; + let filtertype_2: string; + export { filtertype_2 as filtertype }; + } + export { inputs_62 as inputs }; + export namespace outputs_62 { + let out_54: string; + export { out_54 as out }; + } + export { outputs_62 as outputs }; + } + namespace ND_gltf_image_float_float_1_0 { + let node_63: string; + export { node_63 as node }; + let inherit_63: null; + export { inherit_63 as inherit }; + export namespace inputs_63 { + let file_5: string; + export { file_5 as file }; + let factor_2: string; + export { factor_2 as factor }; + let _default_3: string; + export { _default_3 as default }; + let texcoord_3: string; + export { texcoord_3 as texcoord }; + let pivot_3: string; + export { pivot_3 as pivot }; + let scale_7: string; + export { scale_7 as scale }; + let rotate_3: string; + export { rotate_3 as rotate }; + let offset_3: string; + export { offset_3 as offset }; + let operationorder_3: string; + export { operationorder_3 as operationorder }; + let uaddressmode_3: string; + export { uaddressmode_3 as uaddressmode }; + let vaddressmode_3: string; + export { vaddressmode_3 as vaddressmode }; + let filtertype_3: string; + export { filtertype_3 as filtertype }; + } + export { inputs_63 as inputs }; + export namespace outputs_63 { + let out_55: string; + export { out_55 as out }; + } + export { outputs_63 as outputs }; + } + namespace ND_gltf_image_vector3_vector3_1_0 { + let node_64: string; + export { node_64 as node }; + let inherit_64: null; + export { inherit_64 as inherit }; + export namespace inputs_64 { + let file_6: string; + export { file_6 as file }; + let _default_4: string; + export { _default_4 as default }; + let texcoord_4: string; + export { texcoord_4 as texcoord }; + let pivot_4: string; + export { pivot_4 as pivot }; + let scale_8: string; + export { scale_8 as scale }; + let rotate_4: string; + export { rotate_4 as rotate }; + let offset_4: string; + export { offset_4 as offset }; + let operationorder_4: string; + export { operationorder_4 as operationorder }; + let uaddressmode_4: string; + export { uaddressmode_4 as uaddressmode }; + let vaddressmode_4: string; + export { vaddressmode_4 as vaddressmode }; + let filtertype_4: string; + export { filtertype_4 as filtertype }; + } + export { inputs_64 as inputs }; + export namespace outputs_64 { + let out_56: string; + export { out_56 as out }; + } + export { outputs_64 as outputs }; + } + namespace ND_gltf_normalmap_vector3_1_0 { + let node_65: string; + export { node_65 as node }; + let inherit_65: null; + export { inherit_65 as inherit }; + export namespace inputs_65 { + let file_7: string; + export { file_7 as file }; + let _default_5: string; + export { _default_5 as default }; + let texcoord_5: string; + export { texcoord_5 as texcoord }; + let pivot_5: string; + export { pivot_5 as pivot }; + let scale_9: string; + export { scale_9 as scale }; + let rotate_5: string; + export { rotate_5 as rotate }; + let offset_5: string; + export { offset_5 as offset }; + let operationorder_5: string; + export { operationorder_5 as operationorder }; + let uaddressmode_5: string; + export { uaddressmode_5 as uaddressmode }; + let vaddressmode_5: string; + export { vaddressmode_5 as vaddressmode }; + let filtertype_5: string; + export { filtertype_5 as filtertype }; + } + export { inputs_65 as inputs }; + export namespace outputs_65 { + let out_57: string; + export { out_57 as out }; + } + export { outputs_65 as outputs }; + } + namespace ND_gltf_iridescence_thickness_float_1_0 { + let node_66: string; + export { node_66 as node }; + let inherit_66: null; + export { inherit_66 as inherit }; + export namespace inputs_66 { + let file_8: string; + export { file_8 as file }; + let _default_6: string; + export { _default_6 as default }; + let texcoord_6: string; + export { texcoord_6 as texcoord }; + let pivot_6: string; + export { pivot_6 as pivot }; + let scale_10: string; + export { scale_10 as scale }; + let rotate_6: string; + export { rotate_6 as rotate }; + let offset_6: string; + export { offset_6 as offset }; + let uaddressmode_6: string; + export { uaddressmode_6 as uaddressmode }; + let vaddressmode_6: string; + export { vaddressmode_6 as vaddressmode }; + let filtertype_6: string; + export { filtertype_6 as filtertype }; + export let thicknessMin: string; + export let thicknessMax: string; + } + export { inputs_66 as inputs }; + export namespace outputs_66 { + let out_58: string; + export { out_58 as out }; + } + export { outputs_66 as outputs }; + } + namespace ND_gltf_anisotropy_image { + let node_67: string; + export { node_67 as node }; + let inherit_67: null; + export { inherit_67 as inherit }; + export namespace inputs_67 { + let file_9: string; + export { file_9 as file }; + let _default_7: string; + export { _default_7 as default }; + let texcoord_7: string; + export { texcoord_7 as texcoord }; + let pivot_7: string; + export { pivot_7 as pivot }; + let scale_11: string; + export { scale_11 as scale }; + let rotate_7: string; + export { rotate_7 as rotate }; + let offset_7: string; + export { offset_7 as offset }; + let operationorder_6: string; + export { operationorder_6 as operationorder }; + let uaddressmode_7: string; + export { uaddressmode_7 as uaddressmode }; + let vaddressmode_7: string; + export { vaddressmode_7 as vaddressmode }; + let filtertype_7: string; + export { filtertype_7 as filtertype }; + let anisotropy_strength_1: string; + export { anisotropy_strength_1 as anisotropy_strength }; + let anisotropy_rotation_1: string; + export { anisotropy_rotation_1 as anisotropy_rotation }; + } + export { inputs_67 as inputs }; + export namespace outputs_67 { + let anisotropy_strength_out: string; + let anisotropy_rotation_out: string; + } + export { outputs_67 as outputs }; + } + namespace ND_viewdirection_vector3 { + let node_68: string; + export { node_68 as node }; + let inherit_68: null; + export { inherit_68 as inherit }; + export namespace inputs_68 { + let space: string; + } + export { inputs_68 as inputs }; + export namespace outputs_68 { + let out_59: string; + export { out_59 as out }; + } + export { outputs_68 as outputs }; + } + namespace ND_facingratio_float { + let node_69: string; + export { node_69 as node }; + let inherit_69: null; + export { inherit_69 as inherit }; + export namespace inputs_69 { + export let viewdirection: string; + let normal_14: string; + export { normal_14 as normal }; + export let faceforward: string; + export let invert: string; + } + export { inputs_69 as inputs }; + export namespace outputs_69 { + let out_60: string; + export { out_60 as out }; + } + export { outputs_69 as outputs }; + } + namespace ND_gooch_shade { + let node_70: string; + export { node_70 as node }; + let inherit_70: null; + export { inherit_70 as inherit }; + export namespace inputs_70 { + let warm_color: string; + let cool_color: string; + let specular_intensity: string; + let shininess: string; + let light_direction: string; + } + export { inputs_70 as inputs }; + export namespace outputs_70 { + let out_61: string; + export { out_61 as out }; + } + export { outputs_70 as outputs }; + } + namespace ND_g18_rec709_to_lin_rec709_color3 { + let node_71: string; + export { node_71 as node }; + let inherit_71: null; + export { inherit_71 as inherit }; + export namespace inputs_71 { + let _in_1: string; + export { _in_1 as in }; + } + export { inputs_71 as inputs }; + export namespace outputs_71 { + let out_62: string; + export { out_62 as out }; + } + export { outputs_71 as outputs }; + } + namespace ND_g18_rec709_to_lin_rec709_color4 { + let node_72: string; + export { node_72 as node }; + let inherit_72: null; + export { inherit_72 as inherit }; + export namespace inputs_72 { + let _in_2: string; + export { _in_2 as in }; + } + export { inputs_72 as inputs }; + export namespace outputs_72 { + let out_63: string; + export { out_63 as out }; + } + export { outputs_72 as outputs }; + } + namespace ND_g22_rec709_to_lin_rec709_color3 { + let node_73: string; + export { node_73 as node }; + let inherit_73: null; + export { inherit_73 as inherit }; + export namespace inputs_73 { + let _in_3: string; + export { _in_3 as in }; + } + export { inputs_73 as inputs }; + export namespace outputs_73 { + let out_64: string; + export { out_64 as out }; + } + export { outputs_73 as outputs }; + } + namespace ND_g22_rec709_to_lin_rec709_color4 { + let node_74: string; + export { node_74 as node }; + let inherit_74: null; + export { inherit_74 as inherit }; + export namespace inputs_74 { + let _in_4: string; + export { _in_4 as in }; + } + export { inputs_74 as inputs }; + export namespace outputs_74 { + let out_65: string; + export { out_65 as out }; + } + export { outputs_74 as outputs }; + } + namespace ND_rec709_display_to_lin_rec709_color3 { + let node_75: string; + export { node_75 as node }; + let inherit_75: null; + export { inherit_75 as inherit }; + export namespace inputs_75 { + let _in_5: string; + export { _in_5 as in }; + } + export { inputs_75 as inputs }; + export namespace outputs_75 { + let out_66: string; + export { out_66 as out }; + } + export { outputs_75 as outputs }; + } + namespace ND_rec709_display_to_lin_rec709_color4 { + let node_76: string; + export { node_76 as node }; + let inherit_76: null; + export { inherit_76 as inherit }; + export namespace inputs_76 { + let _in_6: string; + export { _in_6 as in }; + } + export { inputs_76 as inputs }; + export namespace outputs_76 { + let out_67: string; + export { out_67 as out }; + } + export { outputs_76 as outputs }; + } + namespace ND_acescg_to_lin_rec709_color3 { + let node_77: string; + export { node_77 as node }; + let inherit_77: null; + export { inherit_77 as inherit }; + export namespace inputs_77 { + let _in_7: string; + export { _in_7 as in }; + } + export { inputs_77 as inputs }; + export namespace outputs_77 { + let out_68: string; + export { out_68 as out }; + } + export { outputs_77 as outputs }; + } + namespace ND_acescg_to_lin_rec709_color4 { + let node_78: string; + export { node_78 as node }; + let inherit_78: null; + export { inherit_78 as inherit }; + export namespace inputs_78 { + let _in_8: string; + export { _in_8 as in }; + } + export { inputs_78 as inputs }; + export namespace outputs_78 { + let out_69: string; + export { out_69 as out }; + } + export { outputs_78 as outputs }; + } + namespace ND_g22_ap1_to_lin_rec709_color3 { + let node_79: string; + export { node_79 as node }; + let inherit_79: null; + export { inherit_79 as inherit }; + export namespace inputs_79 { + let _in_9: string; + export { _in_9 as in }; + } + export { inputs_79 as inputs }; + export namespace outputs_79 { + let out_70: string; + export { out_70 as out }; + } + export { outputs_79 as outputs }; + } + namespace ND_g22_ap1_to_lin_rec709_color4 { + let node_80: string; + export { node_80 as node }; + let inherit_80: null; + export { inherit_80 as inherit }; + export namespace inputs_80 { + let _in_10: string; + export { _in_10 as in }; + } + export { inputs_80 as inputs }; + export namespace outputs_80 { + let out_71: string; + export { out_71 as out }; + } + export { outputs_80 as outputs }; + } + namespace ND_srgb_texture_to_lin_rec709_color3 { + let node_81: string; + export { node_81 as node }; + let inherit_81: null; + export { inherit_81 as inherit }; + export namespace inputs_81 { + let _in_11: string; + export { _in_11 as in }; + } + export { inputs_81 as inputs }; + export namespace outputs_81 { + let out_72: string; + export { out_72 as out }; + } + export { outputs_81 as outputs }; + } + namespace ND_srgb_texture_to_lin_rec709_color4 { + let node_82: string; + export { node_82 as node }; + let inherit_82: null; + export { inherit_82 as inherit }; + export namespace inputs_82 { + let _in_12: string; + export { _in_12 as in }; + } + export { inputs_82 as inputs }; + export namespace outputs_82 { + let out_73: string; + export { out_73 as out }; + } + export { outputs_82 as outputs }; + } + namespace ND_lin_adobergb_to_lin_rec709_color3 { + let node_83: string; + export { node_83 as node }; + let inherit_83: null; + export { inherit_83 as inherit }; + export namespace inputs_83 { + let _in_13: string; + export { _in_13 as in }; + } + export { inputs_83 as inputs }; + export namespace outputs_83 { + let out_74: string; + export { out_74 as out }; + } + export { outputs_83 as outputs }; + } + namespace ND_lin_adobergb_to_lin_rec709_color4 { + let node_84: string; + export { node_84 as node }; + let inherit_84: null; + export { inherit_84 as inherit }; + export namespace inputs_84 { + let _in_14: string; + export { _in_14 as in }; + } + export { inputs_84 as inputs }; + export namespace outputs_84 { + let out_75: string; + export { out_75 as out }; + } + export { outputs_84 as outputs }; + } + namespace ND_adobergb_to_lin_rec709_color3 { + let node_85: string; + export { node_85 as node }; + let inherit_85: null; + export { inherit_85 as inherit }; + export namespace inputs_85 { + let _in_15: string; + export { _in_15 as in }; + } + export { inputs_85 as inputs }; + export namespace outputs_85 { + let out_76: string; + export { out_76 as out }; + } + export { outputs_85 as outputs }; + } + namespace ND_adobergb_to_lin_rec709_color4 { + let node_86: string; + export { node_86 as node }; + let inherit_86: null; + export { inherit_86 as inherit }; + export namespace inputs_86 { + let _in_16: string; + export { _in_16 as in }; + } + export { inputs_86 as inputs }; + export namespace outputs_86 { + let out_77: string; + export { out_77 as out }; + } + export { outputs_86 as outputs }; + } + namespace ND_srgb_displayp3_to_lin_rec709_color3 { + let node_87: string; + export { node_87 as node }; + let inherit_87: null; + export { inherit_87 as inherit }; + export namespace inputs_87 { + let _in_17: string; + export { _in_17 as in }; + } + export { inputs_87 as inputs }; + export namespace outputs_87 { + let out_78: string; + export { out_78 as out }; + } + export { outputs_87 as outputs }; + } + namespace ND_srgb_displayp3_to_lin_rec709_color4 { + let node_88: string; + export { node_88 as node }; + let inherit_88: null; + export { inherit_88 as inherit }; + export namespace inputs_88 { + let _in_18: string; + export { _in_18 as in }; + } + export { inputs_88 as inputs }; + export namespace outputs_88 { + let out_79: string; + export { out_79 as out }; + } + export { outputs_88 as outputs }; + } + namespace ND_lin_displayp3_to_lin_rec709_color3 { + let node_89: string; + export { node_89 as node }; + let inherit_89: null; + export { inherit_89 as inherit }; + export namespace inputs_89 { + let _in_19: string; + export { _in_19 as in }; + } + export { inputs_89 as inputs }; + export namespace outputs_89 { + let out_80: string; + export { out_80 as out }; + } + export { outputs_89 as outputs }; + } + namespace ND_lin_displayp3_to_lin_rec709_color4 { + let node_90: string; + export { node_90 as node }; + let inherit_90: null; + export { inherit_90 as inherit }; + export namespace inputs_90 { + let _in_20: string; + export { _in_20 as in }; + } + export { inputs_90 as inputs }; + export namespace outputs_90 { + let out_81: string; + export { out_81 as out }; + } + export { outputs_90 as outputs }; + } + namespace ND_surfacematerial { + let node_91: string; + export { node_91 as node }; + let inherit_91: null; + export { inherit_91 as inherit }; + export namespace inputs_91 { + let surfaceshader: string; + let backsurfaceshader: string; + let displacementshader: string; + } + export { inputs_91 as inputs }; + export namespace outputs_91 { + let out_82: string; + export { out_82 as out }; + } + export { outputs_91 as outputs }; + } + namespace ND_volumematerial { + let node_92: string; + export { node_92 as node }; + let inherit_92: null; + export { inherit_92 as inherit }; + export namespace inputs_92 { + let volumeshader: string; + } + export { inputs_92 as inputs }; + export namespace outputs_92 { + let out_83: string; + export { out_83 as out }; + } + export { outputs_92 as outputs }; + } + namespace ND_surface_unlit { + let node_93: string; + export { node_93 as node }; + let inherit_93: null; + export { inherit_93 as inherit }; + export namespace inputs_93 { + let emission_1: string; + export { emission_1 as emission }; + let emission_color_2: string; + export { emission_color_2 as emission_color }; + let transmission_2: string; + export { transmission_2 as transmission }; + let transmission_color_2: string; + export { transmission_color_2 as transmission_color }; + let opacity_3: string; + export { opacity_3 as opacity }; + } + export { inputs_93 as inputs }; + export namespace outputs_93 { + let out_84: string; + export { out_84 as out }; + } + export { outputs_93 as outputs }; + } + namespace ND_image_float { + let node_94: string; + export { node_94 as node }; + let inherit_94: null; + export { inherit_94 as inherit }; + export namespace inputs_94 { + let file_10: string; + export { file_10 as file }; + export let layer: string; + let _default_8: string; + export { _default_8 as default }; + let texcoord_8: string; + export { texcoord_8 as texcoord }; + let uaddressmode_8: string; + export { uaddressmode_8 as uaddressmode }; + let vaddressmode_8: string; + export { vaddressmode_8 as vaddressmode }; + let filtertype_8: string; + export { filtertype_8 as filtertype }; + export let framerange: string; + export let frameoffset: string; + export let frameendaction: string; + } + export { inputs_94 as inputs }; + export namespace outputs_94 { + let out_85: string; + export { out_85 as out }; + } + export { outputs_94 as outputs }; + } + namespace ND_image_color3 { + let node_95: string; + export { node_95 as node }; + let inherit_95: null; + export { inherit_95 as inherit }; + export namespace inputs_95 { + let file_11: string; + export { file_11 as file }; + let layer_1: string; + export { layer_1 as layer }; + let _default_9: string; + export { _default_9 as default }; + let texcoord_9: string; + export { texcoord_9 as texcoord }; + let uaddressmode_9: string; + export { uaddressmode_9 as uaddressmode }; + let vaddressmode_9: string; + export { vaddressmode_9 as vaddressmode }; + let filtertype_9: string; + export { filtertype_9 as filtertype }; + let framerange_1: string; + export { framerange_1 as framerange }; + let frameoffset_1: string; + export { frameoffset_1 as frameoffset }; + let frameendaction_1: string; + export { frameendaction_1 as frameendaction }; + } + export { inputs_95 as inputs }; + export namespace outputs_95 { + let out_86: string; + export { out_86 as out }; + } + export { outputs_95 as outputs }; + } + namespace ND_image_color4 { + let node_96: string; + export { node_96 as node }; + let inherit_96: null; + export { inherit_96 as inherit }; + export namespace inputs_96 { + let file_12: string; + export { file_12 as file }; + let layer_2: string; + export { layer_2 as layer }; + let _default_10: string; + export { _default_10 as default }; + let texcoord_10: string; + export { texcoord_10 as texcoord }; + let uaddressmode_10: string; + export { uaddressmode_10 as uaddressmode }; + let vaddressmode_10: string; + export { vaddressmode_10 as vaddressmode }; + let filtertype_10: string; + export { filtertype_10 as filtertype }; + let framerange_2: string; + export { framerange_2 as framerange }; + let frameoffset_2: string; + export { frameoffset_2 as frameoffset }; + let frameendaction_2: string; + export { frameendaction_2 as frameendaction }; + } + export { inputs_96 as inputs }; + export namespace outputs_96 { + let out_87: string; + export { out_87 as out }; + } + export { outputs_96 as outputs }; + } + namespace ND_image_vector2 { + let node_97: string; + export { node_97 as node }; + let inherit_97: null; + export { inherit_97 as inherit }; + export namespace inputs_97 { + let file_13: string; + export { file_13 as file }; + let layer_3: string; + export { layer_3 as layer }; + let _default_11: string; + export { _default_11 as default }; + let texcoord_11: string; + export { texcoord_11 as texcoord }; + let uaddressmode_11: string; + export { uaddressmode_11 as uaddressmode }; + let vaddressmode_11: string; + export { vaddressmode_11 as vaddressmode }; + let filtertype_11: string; + export { filtertype_11 as filtertype }; + let framerange_3: string; + export { framerange_3 as framerange }; + let frameoffset_3: string; + export { frameoffset_3 as frameoffset }; + let frameendaction_3: string; + export { frameendaction_3 as frameendaction }; + } + export { inputs_97 as inputs }; + export namespace outputs_97 { + let out_88: string; + export { out_88 as out }; + } + export { outputs_97 as outputs }; + } + namespace ND_image_vector3 { + let node_98: string; + export { node_98 as node }; + let inherit_98: null; + export { inherit_98 as inherit }; + export namespace inputs_98 { + let file_14: string; + export { file_14 as file }; + let layer_4: string; + export { layer_4 as layer }; + let _default_12: string; + export { _default_12 as default }; + let texcoord_12: string; + export { texcoord_12 as texcoord }; + let uaddressmode_12: string; + export { uaddressmode_12 as uaddressmode }; + let vaddressmode_12: string; + export { vaddressmode_12 as vaddressmode }; + let filtertype_12: string; + export { filtertype_12 as filtertype }; + let framerange_4: string; + export { framerange_4 as framerange }; + let frameoffset_4: string; + export { frameoffset_4 as frameoffset }; + let frameendaction_4: string; + export { frameendaction_4 as frameendaction }; + } + export { inputs_98 as inputs }; + export namespace outputs_98 { + let out_89: string; + export { out_89 as out }; + } + export { outputs_98 as outputs }; + } + namespace ND_image_vector4 { + let node_99: string; + export { node_99 as node }; + let inherit_99: null; + export { inherit_99 as inherit }; + export namespace inputs_99 { + let file_15: string; + export { file_15 as file }; + let layer_5: string; + export { layer_5 as layer }; + let _default_13: string; + export { _default_13 as default }; + let texcoord_13: string; + export { texcoord_13 as texcoord }; + let uaddressmode_13: string; + export { uaddressmode_13 as uaddressmode }; + let vaddressmode_13: string; + export { vaddressmode_13 as vaddressmode }; + let filtertype_13: string; + export { filtertype_13 as filtertype }; + let framerange_5: string; + export { framerange_5 as framerange }; + let frameoffset_5: string; + export { frameoffset_5 as frameoffset }; + let frameendaction_5: string; + export { frameendaction_5 as frameendaction }; + } + export { inputs_99 as inputs }; + export namespace outputs_99 { + let out_90: string; + export { out_90 as out }; + } + export { outputs_99 as outputs }; + } + namespace ND_tiledimage_float { + let node_100: string; + export { node_100 as node }; + let inherit_100: null; + export { inherit_100 as inherit }; + export namespace inputs_100 { + let file_16: string; + export { file_16 as file }; + let _default_14: string; + export { _default_14 as default }; + let texcoord_14: string; + export { texcoord_14 as texcoord }; + export let uvtiling: string; + export let uvoffset: string; + export let realworldimagesize: string; + export let realworldtilesize: string; + let filtertype_14: string; + export { filtertype_14 as filtertype }; + let framerange_6: string; + export { framerange_6 as framerange }; + let frameoffset_6: string; + export { frameoffset_6 as frameoffset }; + let frameendaction_6: string; + export { frameendaction_6 as frameendaction }; + } + export { inputs_100 as inputs }; + export namespace outputs_100 { + let out_91: string; + export { out_91 as out }; + } + export { outputs_100 as outputs }; + } + namespace ND_tiledimage_color3 { + let node_101: string; + export { node_101 as node }; + let inherit_101: null; + export { inherit_101 as inherit }; + export namespace inputs_101 { + let file_17: string; + export { file_17 as file }; + let _default_15: string; + export { _default_15 as default }; + let texcoord_15: string; + export { texcoord_15 as texcoord }; + let uvtiling_1: string; + export { uvtiling_1 as uvtiling }; + let uvoffset_1: string; + export { uvoffset_1 as uvoffset }; + let realworldimagesize_1: string; + export { realworldimagesize_1 as realworldimagesize }; + let realworldtilesize_1: string; + export { realworldtilesize_1 as realworldtilesize }; + let filtertype_15: string; + export { filtertype_15 as filtertype }; + let framerange_7: string; + export { framerange_7 as framerange }; + let frameoffset_7: string; + export { frameoffset_7 as frameoffset }; + let frameendaction_7: string; + export { frameendaction_7 as frameendaction }; + } + export { inputs_101 as inputs }; + export namespace outputs_101 { + let out_92: string; + export { out_92 as out }; + } + export { outputs_101 as outputs }; + } + namespace ND_tiledimage_color4 { + let node_102: string; + export { node_102 as node }; + let inherit_102: null; + export { inherit_102 as inherit }; + export namespace inputs_102 { + let file_18: string; + export { file_18 as file }; + let _default_16: string; + export { _default_16 as default }; + let texcoord_16: string; + export { texcoord_16 as texcoord }; + let uvtiling_2: string; + export { uvtiling_2 as uvtiling }; + let uvoffset_2: string; + export { uvoffset_2 as uvoffset }; + let realworldimagesize_2: string; + export { realworldimagesize_2 as realworldimagesize }; + let realworldtilesize_2: string; + export { realworldtilesize_2 as realworldtilesize }; + let filtertype_16: string; + export { filtertype_16 as filtertype }; + let framerange_8: string; + export { framerange_8 as framerange }; + let frameoffset_8: string; + export { frameoffset_8 as frameoffset }; + let frameendaction_8: string; + export { frameendaction_8 as frameendaction }; + } + export { inputs_102 as inputs }; + export namespace outputs_102 { + let out_93: string; + export { out_93 as out }; + } + export { outputs_102 as outputs }; + } + namespace ND_tiledimage_vector2 { + let node_103: string; + export { node_103 as node }; + let inherit_103: null; + export { inherit_103 as inherit }; + export namespace inputs_103 { + let file_19: string; + export { file_19 as file }; + let _default_17: string; + export { _default_17 as default }; + let texcoord_17: string; + export { texcoord_17 as texcoord }; + let uvtiling_3: string; + export { uvtiling_3 as uvtiling }; + let uvoffset_3: string; + export { uvoffset_3 as uvoffset }; + let realworldimagesize_3: string; + export { realworldimagesize_3 as realworldimagesize }; + let realworldtilesize_3: string; + export { realworldtilesize_3 as realworldtilesize }; + let filtertype_17: string; + export { filtertype_17 as filtertype }; + let framerange_9: string; + export { framerange_9 as framerange }; + let frameoffset_9: string; + export { frameoffset_9 as frameoffset }; + let frameendaction_9: string; + export { frameendaction_9 as frameendaction }; + } + export { inputs_103 as inputs }; + export namespace outputs_103 { + let out_94: string; + export { out_94 as out }; + } + export { outputs_103 as outputs }; + } + namespace ND_tiledimage_vector3 { + let node_104: string; + export { node_104 as node }; + let inherit_104: null; + export { inherit_104 as inherit }; + export namespace inputs_104 { + let file_20: string; + export { file_20 as file }; + let _default_18: string; + export { _default_18 as default }; + let texcoord_18: string; + export { texcoord_18 as texcoord }; + let uvtiling_4: string; + export { uvtiling_4 as uvtiling }; + let uvoffset_4: string; + export { uvoffset_4 as uvoffset }; + let realworldimagesize_4: string; + export { realworldimagesize_4 as realworldimagesize }; + let realworldtilesize_4: string; + export { realworldtilesize_4 as realworldtilesize }; + let filtertype_18: string; + export { filtertype_18 as filtertype }; + let framerange_10: string; + export { framerange_10 as framerange }; + let frameoffset_10: string; + export { frameoffset_10 as frameoffset }; + let frameendaction_10: string; + export { frameendaction_10 as frameendaction }; + } + export { inputs_104 as inputs }; + export namespace outputs_104 { + let out_95: string; + export { out_95 as out }; + } + export { outputs_104 as outputs }; + } + namespace ND_tiledimage_vector4 { + let node_105: string; + export { node_105 as node }; + let inherit_105: null; + export { inherit_105 as inherit }; + export namespace inputs_105 { + let file_21: string; + export { file_21 as file }; + let _default_19: string; + export { _default_19 as default }; + let texcoord_19: string; + export { texcoord_19 as texcoord }; + let uvtiling_5: string; + export { uvtiling_5 as uvtiling }; + let uvoffset_5: string; + export { uvoffset_5 as uvoffset }; + let realworldimagesize_5: string; + export { realworldimagesize_5 as realworldimagesize }; + let realworldtilesize_5: string; + export { realworldtilesize_5 as realworldtilesize }; + let filtertype_19: string; + export { filtertype_19 as filtertype }; + let framerange_11: string; + export { framerange_11 as framerange }; + let frameoffset_11: string; + export { frameoffset_11 as frameoffset }; + let frameendaction_11: string; + export { frameendaction_11 as frameendaction }; + } + export { inputs_105 as inputs }; + export namespace outputs_105 { + let out_96: string; + export { out_96 as out }; + } + export { outputs_105 as outputs }; + } + namespace ND_latlongimage { + let node_106: string; + export { node_106 as node }; + let inherit_106: null; + export { inherit_106 as inherit }; + export namespace inputs_106 { + let file_22: string; + export { file_22 as file }; + let _default_20: string; + export { _default_20 as default }; + export let viewdir: string; + let rotation_1: string; + export { rotation_1 as rotation }; + } + export { inputs_106 as inputs }; + export namespace outputs_106 { + let out_97: string; + export { out_97 as out }; + } + export { outputs_106 as outputs }; + } + namespace ND_hextiledimage_color3 { + let node_107: string; + export { node_107 as node }; + let inherit_107: null; + export { inherit_107 as inherit }; + export namespace inputs_107 { + let file_23: string; + export { file_23 as file }; + let _default_21: string; + export { _default_21 as default }; + let texcoord_20: string; + export { texcoord_20 as texcoord }; + export let tiling: string; + let rotation_2: string; + export { rotation_2 as rotation }; + export let rotationrange: string; + let scale_12: string; + export { scale_12 as scale }; + export let scalerange: string; + let offset_8: string; + export { offset_8 as offset }; + export let offsetrange: string; + export let falloff: string; + export let falloffcontrast: string; + export let lumacoeffs: string; + } + export { inputs_107 as inputs }; + export namespace outputs_107 { + let out_98: string; + export { out_98 as out }; + } + export { outputs_107 as outputs }; + } + namespace ND_hextiledimage_color4 { + let node_108: string; + export { node_108 as node }; + let inherit_108: null; + export { inherit_108 as inherit }; + export namespace inputs_108 { + let file_24: string; + export { file_24 as file }; + let _default_22: string; + export { _default_22 as default }; + let texcoord_21: string; + export { texcoord_21 as texcoord }; + let tiling_1: string; + export { tiling_1 as tiling }; + let rotation_3: string; + export { rotation_3 as rotation }; + let rotationrange_1: string; + export { rotationrange_1 as rotationrange }; + let scale_13: string; + export { scale_13 as scale }; + let scalerange_1: string; + export { scalerange_1 as scalerange }; + let offset_9: string; + export { offset_9 as offset }; + let offsetrange_1: string; + export { offsetrange_1 as offsetrange }; + let falloff_1: string; + export { falloff_1 as falloff }; + let falloffcontrast_1: string; + export { falloffcontrast_1 as falloffcontrast }; + let lumacoeffs_1: string; + export { lumacoeffs_1 as lumacoeffs }; + } + export { inputs_108 as inputs }; + export namespace outputs_108 { + let out_99: string; + export { out_99 as out }; + } + export { outputs_108 as outputs }; + } + namespace ND_triplanarprojection_float { + let node_109: string; + export { node_109 as node }; + let inherit_109: null; + export { inherit_109 as inherit }; + export namespace inputs_109 { + export let filex: string; + export let filey: string; + export let filez: string; + export let layerx: string; + export let layery: string; + export let layerz: string; + let _default_23: string; + export { _default_23 as default }; + export let position: string; + let normal_15: string; + export { normal_15 as normal }; + export let upaxis: string; + export let blend: string; + let filtertype_20: string; + export { filtertype_20 as filtertype }; + let framerange_12: string; + export { framerange_12 as framerange }; + let frameoffset_12: string; + export { frameoffset_12 as frameoffset }; + let frameendaction_12: string; + export { frameendaction_12 as frameendaction }; + } + export { inputs_109 as inputs }; + export namespace outputs_109 { + let out_100: string; + export { out_100 as out }; + } + export { outputs_109 as outputs }; + } + namespace ND_triplanarprojection_color3 { + let node_110: string; + export { node_110 as node }; + let inherit_110: null; + export { inherit_110 as inherit }; + export namespace inputs_110 { + let filex_1: string; + export { filex_1 as filex }; + let filey_1: string; + export { filey_1 as filey }; + let filez_1: string; + export { filez_1 as filez }; + let layerx_1: string; + export { layerx_1 as layerx }; + let layery_1: string; + export { layery_1 as layery }; + let layerz_1: string; + export { layerz_1 as layerz }; + let _default_24: string; + export { _default_24 as default }; + let position_1: string; + export { position_1 as position }; + let normal_16: string; + export { normal_16 as normal }; + let upaxis_1: string; + export { upaxis_1 as upaxis }; + let blend_1: string; + export { blend_1 as blend }; + let filtertype_21: string; + export { filtertype_21 as filtertype }; + let framerange_13: string; + export { framerange_13 as framerange }; + let frameoffset_13: string; + export { frameoffset_13 as frameoffset }; + let frameendaction_13: string; + export { frameendaction_13 as frameendaction }; + } + export { inputs_110 as inputs }; + export namespace outputs_110 { + let out_101: string; + export { out_101 as out }; + } + export { outputs_110 as outputs }; + } + namespace ND_triplanarprojection_color4 { + let node_111: string; + export { node_111 as node }; + let inherit_111: null; + export { inherit_111 as inherit }; + export namespace inputs_111 { + let filex_2: string; + export { filex_2 as filex }; + let filey_2: string; + export { filey_2 as filey }; + let filez_2: string; + export { filez_2 as filez }; + let layerx_2: string; + export { layerx_2 as layerx }; + let layery_2: string; + export { layery_2 as layery }; + let layerz_2: string; + export { layerz_2 as layerz }; + let _default_25: string; + export { _default_25 as default }; + let position_2: string; + export { position_2 as position }; + let normal_17: string; + export { normal_17 as normal }; + let upaxis_2: string; + export { upaxis_2 as upaxis }; + let blend_2: string; + export { blend_2 as blend }; + let filtertype_22: string; + export { filtertype_22 as filtertype }; + let framerange_14: string; + export { framerange_14 as framerange }; + let frameoffset_14: string; + export { frameoffset_14 as frameoffset }; + let frameendaction_14: string; + export { frameendaction_14 as frameendaction }; + } + export { inputs_111 as inputs }; + export namespace outputs_111 { + let out_102: string; + export { out_102 as out }; + } + export { outputs_111 as outputs }; + } + namespace ND_triplanarprojection_vector2 { + let node_112: string; + export { node_112 as node }; + let inherit_112: null; + export { inherit_112 as inherit }; + export namespace inputs_112 { + let filex_3: string; + export { filex_3 as filex }; + let filey_3: string; + export { filey_3 as filey }; + let filez_3: string; + export { filez_3 as filez }; + let layerx_3: string; + export { layerx_3 as layerx }; + let layery_3: string; + export { layery_3 as layery }; + let layerz_3: string; + export { layerz_3 as layerz }; + let _default_26: string; + export { _default_26 as default }; + let position_3: string; + export { position_3 as position }; + let normal_18: string; + export { normal_18 as normal }; + let upaxis_3: string; + export { upaxis_3 as upaxis }; + let blend_3: string; + export { blend_3 as blend }; + let filtertype_23: string; + export { filtertype_23 as filtertype }; + let framerange_15: string; + export { framerange_15 as framerange }; + let frameoffset_15: string; + export { frameoffset_15 as frameoffset }; + let frameendaction_15: string; + export { frameendaction_15 as frameendaction }; + } + export { inputs_112 as inputs }; + export namespace outputs_112 { + let out_103: string; + export { out_103 as out }; + } + export { outputs_112 as outputs }; + } + namespace ND_triplanarprojection_vector3 { + let node_113: string; + export { node_113 as node }; + let inherit_113: null; + export { inherit_113 as inherit }; + export namespace inputs_113 { + let filex_4: string; + export { filex_4 as filex }; + let filey_4: string; + export { filey_4 as filey }; + let filez_4: string; + export { filez_4 as filez }; + let layerx_4: string; + export { layerx_4 as layerx }; + let layery_4: string; + export { layery_4 as layery }; + let layerz_4: string; + export { layerz_4 as layerz }; + let _default_27: string; + export { _default_27 as default }; + let position_4: string; + export { position_4 as position }; + let normal_19: string; + export { normal_19 as normal }; + let upaxis_4: string; + export { upaxis_4 as upaxis }; + let blend_4: string; + export { blend_4 as blend }; + let filtertype_24: string; + export { filtertype_24 as filtertype }; + let framerange_16: string; + export { framerange_16 as framerange }; + let frameoffset_16: string; + export { frameoffset_16 as frameoffset }; + let frameendaction_16: string; + export { frameendaction_16 as frameendaction }; + } + export { inputs_113 as inputs }; + export namespace outputs_113 { + let out_104: string; + export { out_104 as out }; + } + export { outputs_113 as outputs }; + } + namespace ND_triplanarprojection_vector4 { + let node_114: string; + export { node_114 as node }; + let inherit_114: null; + export { inherit_114 as inherit }; + export namespace inputs_114 { + let filex_5: string; + export { filex_5 as filex }; + let filey_5: string; + export { filey_5 as filey }; + let filez_5: string; + export { filez_5 as filez }; + let layerx_5: string; + export { layerx_5 as layerx }; + let layery_5: string; + export { layery_5 as layery }; + let layerz_5: string; + export { layerz_5 as layerz }; + let _default_28: string; + export { _default_28 as default }; + let position_5: string; + export { position_5 as position }; + let normal_20: string; + export { normal_20 as normal }; + let upaxis_5: string; + export { upaxis_5 as upaxis }; + let blend_5: string; + export { blend_5 as blend }; + let filtertype_25: string; + export { filtertype_25 as filtertype }; + let framerange_17: string; + export { framerange_17 as framerange }; + let frameoffset_17: string; + export { frameoffset_17 as frameoffset }; + let frameendaction_17: string; + export { frameendaction_17 as frameendaction }; + } + export { inputs_114 as inputs }; + export namespace outputs_114 { + let out_105: string; + export { out_105 as out }; + } + export { outputs_114 as outputs }; + } + namespace ND_constant_float { + let node_115: string; + export { node_115 as node }; + let inherit_115: null; + export { inherit_115 as inherit }; + export namespace inputs_115 { + let value: string; + } + export { inputs_115 as inputs }; + export namespace outputs_115 { + let out_106: string; + export { out_106 as out }; + } + export { outputs_115 as outputs }; + } + namespace ND_constant_color3 { + let node_116: string; + export { node_116 as node }; + let inherit_116: null; + export { inherit_116 as inherit }; + export namespace inputs_116 { + let value_1: string; + export { value_1 as value }; + } + export { inputs_116 as inputs }; + export namespace outputs_116 { + let out_107: string; + export { out_107 as out }; + } + export { outputs_116 as outputs }; + } + namespace ND_constant_color4 { + let node_117: string; + export { node_117 as node }; + let inherit_117: null; + export { inherit_117 as inherit }; + export namespace inputs_117 { + let value_2: string; + export { value_2 as value }; + } + export { inputs_117 as inputs }; + export namespace outputs_117 { + let out_108: string; + export { out_108 as out }; + } + export { outputs_117 as outputs }; + } + namespace ND_constant_vector2 { + let node_118: string; + export { node_118 as node }; + let inherit_118: null; + export { inherit_118 as inherit }; + export namespace inputs_118 { + let value_3: string; + export { value_3 as value }; + } + export { inputs_118 as inputs }; + export namespace outputs_118 { + let out_109: string; + export { out_109 as out }; + } + export { outputs_118 as outputs }; + } + namespace ND_constant_vector3 { + let node_119: string; + export { node_119 as node }; + let inherit_119: null; + export { inherit_119 as inherit }; + export namespace inputs_119 { + let value_4: string; + export { value_4 as value }; + } + export { inputs_119 as inputs }; + export namespace outputs_119 { + let out_110: string; + export { out_110 as out }; + } + export { outputs_119 as outputs }; + } + namespace ND_constant_vector4 { + let node_120: string; + export { node_120 as node }; + let inherit_120: null; + export { inherit_120 as inherit }; + export namespace inputs_120 { + let value_5: string; + export { value_5 as value }; + } + export { inputs_120 as inputs }; + export namespace outputs_120 { + let out_111: string; + export { out_111 as out }; + } + export { outputs_120 as outputs }; + } + namespace ND_constant_boolean { + let node_121: string; + export { node_121 as node }; + let inherit_121: null; + export { inherit_121 as inherit }; + export namespace inputs_121 { + let value_6: string; + export { value_6 as value }; + } + export { inputs_121 as inputs }; + export namespace outputs_121 { + let out_112: string; + export { out_112 as out }; + } + export { outputs_121 as outputs }; + } + namespace ND_constant_integer { + let node_122: string; + export { node_122 as node }; + let inherit_122: null; + export { inherit_122 as inherit }; + export namespace inputs_122 { + let value_7: string; + export { value_7 as value }; + } + export { inputs_122 as inputs }; + export namespace outputs_122 { + let out_113: string; + export { out_113 as out }; + } + export { outputs_122 as outputs }; + } + namespace ND_constant_matrix33 { + let node_123: string; + export { node_123 as node }; + let inherit_123: null; + export { inherit_123 as inherit }; + export namespace inputs_123 { + let value_8: string; + export { value_8 as value }; + } + export { inputs_123 as inputs }; + export namespace outputs_123 { + let out_114: string; + export { out_114 as out }; + } + export { outputs_123 as outputs }; + } + namespace ND_constant_matrix44 { + let node_124: string; + export { node_124 as node }; + let inherit_124: null; + export { inherit_124 as inherit }; + export namespace inputs_124 { + let value_9: string; + export { value_9 as value }; + } + export { inputs_124 as inputs }; + export namespace outputs_124 { + let out_115: string; + export { out_115 as out }; + } + export { outputs_124 as outputs }; + } + namespace ND_constant_string { + let node_125: string; + export { node_125 as node }; + let inherit_125: null; + export { inherit_125 as inherit }; + export namespace inputs_125 { + let value_10: string; + export { value_10 as value }; + } + export { inputs_125 as inputs }; + export namespace outputs_125 { + let out_116: string; + export { out_116 as out }; + } + export { outputs_125 as outputs }; + } + namespace ND_constant_filename { + let node_126: string; + export { node_126 as node }; + let inherit_126: null; + export { inherit_126 as inherit }; + export namespace inputs_126 { + let value_11: string; + export { value_11 as value }; + } + export { inputs_126 as inputs }; + export namespace outputs_126 { + let out_117: string; + export { out_117 as out }; + } + export { outputs_126 as outputs }; + } + namespace ND_ramp { + let node_127: string; + export { node_127 as node }; + let inherit_127: null; + export { inherit_127 as inherit }; + export namespace inputs_127 { + let texcoord_22: string; + export { texcoord_22 as texcoord }; + export let type: string; + export let interpolation: string; + export let num_intervals: string; + export let interval1: string; + export let color1: string; + export let interval2: string; + export let color2: string; + export let interval3: string; + export let color3: string; + export let interval4: string; + export let color4: string; + export let interval5: string; + export let color5: string; + export let interval6: string; + export let color6: string; + export let interval7: string; + export let color7: string; + export let interval8: string; + export let color8: string; + export let interval9: string; + export let color9: string; + export let interval10: string; + export let color10: string; + } + export { inputs_127 as inputs }; + export namespace outputs_127 { + let out_118: string; + export { out_118 as out }; + } + export { outputs_127 as outputs }; + } + namespace ND_ramp_gradient { + let node_128: string; + export { node_128 as node }; + let inherit_128: null; + export { inherit_128 as inherit }; + export namespace inputs_128 { + export let x: string; + let interval1_1: string; + export { interval1_1 as interval1 }; + let interval2_1: string; + export { interval2_1 as interval2 }; + let color1_1: string; + export { color1_1 as color1 }; + let color2_1: string; + export { color2_1 as color2 }; + let interpolation_1: string; + export { interpolation_1 as interpolation }; + export let prev_color: string; + export let interval_num: string; + let num_intervals_1: string; + export { num_intervals_1 as num_intervals }; + } + export { inputs_128 as inputs }; + export namespace outputs_128 { + let out_119: string; + export { out_119 as out }; + } + export { outputs_128 as outputs }; + } + namespace ND_ramplr_float { + let node_129: string; + export { node_129 as node }; + let inherit_129: null; + export { inherit_129 as inherit }; + export namespace inputs_129 { + export let valuel: string; + export let valuer: string; + let texcoord_23: string; + export { texcoord_23 as texcoord }; + } + export { inputs_129 as inputs }; + export namespace outputs_129 { + let out_120: string; + export { out_120 as out }; + } + export { outputs_129 as outputs }; + } + namespace ND_ramplr_color3 { + let node_130: string; + export { node_130 as node }; + let inherit_130: null; + export { inherit_130 as inherit }; + export namespace inputs_130 { + let valuel_1: string; + export { valuel_1 as valuel }; + let valuer_1: string; + export { valuer_1 as valuer }; + let texcoord_24: string; + export { texcoord_24 as texcoord }; + } + export { inputs_130 as inputs }; + export namespace outputs_130 { + let out_121: string; + export { out_121 as out }; + } + export { outputs_130 as outputs }; + } + namespace ND_ramplr_color4 { + let node_131: string; + export { node_131 as node }; + let inherit_131: null; + export { inherit_131 as inherit }; + export namespace inputs_131 { + let valuel_2: string; + export { valuel_2 as valuel }; + let valuer_2: string; + export { valuer_2 as valuer }; + let texcoord_25: string; + export { texcoord_25 as texcoord }; + } + export { inputs_131 as inputs }; + export namespace outputs_131 { + let out_122: string; + export { out_122 as out }; + } + export { outputs_131 as outputs }; + } + namespace ND_ramplr_vector2 { + let node_132: string; + export { node_132 as node }; + let inherit_132: null; + export { inherit_132 as inherit }; + export namespace inputs_132 { + let valuel_3: string; + export { valuel_3 as valuel }; + let valuer_3: string; + export { valuer_3 as valuer }; + let texcoord_26: string; + export { texcoord_26 as texcoord }; + } + export { inputs_132 as inputs }; + export namespace outputs_132 { + let out_123: string; + export { out_123 as out }; + } + export { outputs_132 as outputs }; + } + namespace ND_ramplr_vector3 { + let node_133: string; + export { node_133 as node }; + let inherit_133: null; + export { inherit_133 as inherit }; + export namespace inputs_133 { + let valuel_4: string; + export { valuel_4 as valuel }; + let valuer_4: string; + export { valuer_4 as valuer }; + let texcoord_27: string; + export { texcoord_27 as texcoord }; + } + export { inputs_133 as inputs }; + export namespace outputs_133 { + let out_124: string; + export { out_124 as out }; + } + export { outputs_133 as outputs }; + } + namespace ND_ramplr_vector4 { + let node_134: string; + export { node_134 as node }; + let inherit_134: null; + export { inherit_134 as inherit }; + export namespace inputs_134 { + let valuel_5: string; + export { valuel_5 as valuel }; + let valuer_5: string; + export { valuer_5 as valuer }; + let texcoord_28: string; + export { texcoord_28 as texcoord }; + } + export { inputs_134 as inputs }; + export namespace outputs_134 { + let out_125: string; + export { out_125 as out }; + } + export { outputs_134 as outputs }; + } + namespace ND_ramptb_float { + let node_135: string; + export { node_135 as node }; + let inherit_135: null; + export { inherit_135 as inherit }; + export namespace inputs_135 { + export let valuet: string; + export let valueb: string; + let texcoord_29: string; + export { texcoord_29 as texcoord }; + } + export { inputs_135 as inputs }; + export namespace outputs_135 { + let out_126: string; + export { out_126 as out }; + } + export { outputs_135 as outputs }; + } + namespace ND_ramptb_color3 { + let node_136: string; + export { node_136 as node }; + let inherit_136: null; + export { inherit_136 as inherit }; + export namespace inputs_136 { + let valuet_1: string; + export { valuet_1 as valuet }; + let valueb_1: string; + export { valueb_1 as valueb }; + let texcoord_30: string; + export { texcoord_30 as texcoord }; + } + export { inputs_136 as inputs }; + export namespace outputs_136 { + let out_127: string; + export { out_127 as out }; + } + export { outputs_136 as outputs }; + } + namespace ND_ramptb_color4 { + let node_137: string; + export { node_137 as node }; + let inherit_137: null; + export { inherit_137 as inherit }; + export namespace inputs_137 { + let valuet_2: string; + export { valuet_2 as valuet }; + let valueb_2: string; + export { valueb_2 as valueb }; + let texcoord_31: string; + export { texcoord_31 as texcoord }; + } + export { inputs_137 as inputs }; + export namespace outputs_137 { + let out_128: string; + export { out_128 as out }; + } + export { outputs_137 as outputs }; + } + namespace ND_ramptb_vector2 { + let node_138: string; + export { node_138 as node }; + let inherit_138: null; + export { inherit_138 as inherit }; + export namespace inputs_138 { + let valuet_3: string; + export { valuet_3 as valuet }; + let valueb_3: string; + export { valueb_3 as valueb }; + let texcoord_32: string; + export { texcoord_32 as texcoord }; + } + export { inputs_138 as inputs }; + export namespace outputs_138 { + let out_129: string; + export { out_129 as out }; + } + export { outputs_138 as outputs }; + } + namespace ND_ramptb_vector3 { + let node_139: string; + export { node_139 as node }; + let inherit_139: null; + export { inherit_139 as inherit }; + export namespace inputs_139 { + let valuet_4: string; + export { valuet_4 as valuet }; + let valueb_4: string; + export { valueb_4 as valueb }; + let texcoord_33: string; + export { texcoord_33 as texcoord }; + } + export { inputs_139 as inputs }; + export namespace outputs_139 { + let out_130: string; + export { out_130 as out }; + } + export { outputs_139 as outputs }; + } + namespace ND_ramptb_vector4 { + let node_140: string; + export { node_140 as node }; + let inherit_140: null; + export { inherit_140 as inherit }; + export namespace inputs_140 { + let valuet_5: string; + export { valuet_5 as valuet }; + let valueb_5: string; + export { valueb_5 as valueb }; + let texcoord_34: string; + export { texcoord_34 as texcoord }; + } + export { inputs_140 as inputs }; + export namespace outputs_140 { + let out_131: string; + export { out_131 as out }; + } + export { outputs_140 as outputs }; + } + namespace ND_ramp4_float { + let node_141: string; + export { node_141 as node }; + let inherit_141: null; + export { inherit_141 as inherit }; + export namespace inputs_141 { + export let valuetl: string; + export let valuetr: string; + export let valuebl: string; + export let valuebr: string; + let texcoord_35: string; + export { texcoord_35 as texcoord }; + } + export { inputs_141 as inputs }; + export namespace outputs_141 { + let out_132: string; + export { out_132 as out }; + } + export { outputs_141 as outputs }; + } + namespace ND_ramp4_color3 { + let node_142: string; + export { node_142 as node }; + let inherit_142: null; + export { inherit_142 as inherit }; + export namespace inputs_142 { + let valuetl_1: string; + export { valuetl_1 as valuetl }; + let valuetr_1: string; + export { valuetr_1 as valuetr }; + let valuebl_1: string; + export { valuebl_1 as valuebl }; + let valuebr_1: string; + export { valuebr_1 as valuebr }; + let texcoord_36: string; + export { texcoord_36 as texcoord }; + } + export { inputs_142 as inputs }; + export namespace outputs_142 { + let out_133: string; + export { out_133 as out }; + } + export { outputs_142 as outputs }; + } + namespace ND_ramp4_color4 { + let node_143: string; + export { node_143 as node }; + let inherit_143: null; + export { inherit_143 as inherit }; + export namespace inputs_143 { + let valuetl_2: string; + export { valuetl_2 as valuetl }; + let valuetr_2: string; + export { valuetr_2 as valuetr }; + let valuebl_2: string; + export { valuebl_2 as valuebl }; + let valuebr_2: string; + export { valuebr_2 as valuebr }; + let texcoord_37: string; + export { texcoord_37 as texcoord }; + } + export { inputs_143 as inputs }; + export namespace outputs_143 { + let out_134: string; + export { out_134 as out }; + } + export { outputs_143 as outputs }; + } + namespace ND_ramp4_vector2 { + let node_144: string; + export { node_144 as node }; + let inherit_144: null; + export { inherit_144 as inherit }; + export namespace inputs_144 { + let valuetl_3: string; + export { valuetl_3 as valuetl }; + let valuetr_3: string; + export { valuetr_3 as valuetr }; + let valuebl_3: string; + export { valuebl_3 as valuebl }; + let valuebr_3: string; + export { valuebr_3 as valuebr }; + let texcoord_38: string; + export { texcoord_38 as texcoord }; + } + export { inputs_144 as inputs }; + export namespace outputs_144 { + let out_135: string; + export { out_135 as out }; + } + export { outputs_144 as outputs }; + } + namespace ND_ramp4_vector3 { + let node_145: string; + export { node_145 as node }; + let inherit_145: null; + export { inherit_145 as inherit }; + export namespace inputs_145 { + let valuetl_4: string; + export { valuetl_4 as valuetl }; + let valuetr_4: string; + export { valuetr_4 as valuetr }; + let valuebl_4: string; + export { valuebl_4 as valuebl }; + let valuebr_4: string; + export { valuebr_4 as valuebr }; + let texcoord_39: string; + export { texcoord_39 as texcoord }; + } + export { inputs_145 as inputs }; + export namespace outputs_145 { + let out_136: string; + export { out_136 as out }; + } + export { outputs_145 as outputs }; + } + namespace ND_ramp4_vector4 { + let node_146: string; + export { node_146 as node }; + let inherit_146: null; + export { inherit_146 as inherit }; + export namespace inputs_146 { + let valuetl_5: string; + export { valuetl_5 as valuetl }; + let valuetr_5: string; + export { valuetr_5 as valuetr }; + let valuebl_5: string; + export { valuebl_5 as valuebl }; + let valuebr_5: string; + export { valuebr_5 as valuebr }; + let texcoord_40: string; + export { texcoord_40 as texcoord }; + } + export { inputs_146 as inputs }; + export namespace outputs_146 { + let out_137: string; + export { out_137 as out }; + } + export { outputs_146 as outputs }; + } + namespace ND_splitlr_float { + let node_147: string; + export { node_147 as node }; + let inherit_147: null; + export { inherit_147 as inherit }; + export namespace inputs_147 { + let valuel_6: string; + export { valuel_6 as valuel }; + let valuer_6: string; + export { valuer_6 as valuer }; + export let center: string; + let texcoord_41: string; + export { texcoord_41 as texcoord }; + } + export { inputs_147 as inputs }; + export namespace outputs_147 { + let out_138: string; + export { out_138 as out }; + } + export { outputs_147 as outputs }; + } + namespace ND_splitlr_color3 { + let node_148: string; + export { node_148 as node }; + let inherit_148: null; + export { inherit_148 as inherit }; + export namespace inputs_148 { + let valuel_7: string; + export { valuel_7 as valuel }; + let valuer_7: string; + export { valuer_7 as valuer }; + let center_1: string; + export { center_1 as center }; + let texcoord_42: string; + export { texcoord_42 as texcoord }; + } + export { inputs_148 as inputs }; + export namespace outputs_148 { + let out_139: string; + export { out_139 as out }; + } + export { outputs_148 as outputs }; + } + namespace ND_splitlr_color4 { + let node_149: string; + export { node_149 as node }; + let inherit_149: null; + export { inherit_149 as inherit }; + export namespace inputs_149 { + let valuel_8: string; + export { valuel_8 as valuel }; + let valuer_8: string; + export { valuer_8 as valuer }; + let center_2: string; + export { center_2 as center }; + let texcoord_43: string; + export { texcoord_43 as texcoord }; + } + export { inputs_149 as inputs }; + export namespace outputs_149 { + let out_140: string; + export { out_140 as out }; + } + export { outputs_149 as outputs }; + } + namespace ND_splitlr_vector2 { + let node_150: string; + export { node_150 as node }; + let inherit_150: null; + export { inherit_150 as inherit }; + export namespace inputs_150 { + let valuel_9: string; + export { valuel_9 as valuel }; + let valuer_9: string; + export { valuer_9 as valuer }; + let center_3: string; + export { center_3 as center }; + let texcoord_44: string; + export { texcoord_44 as texcoord }; + } + export { inputs_150 as inputs }; + export namespace outputs_150 { + let out_141: string; + export { out_141 as out }; + } + export { outputs_150 as outputs }; + } + namespace ND_splitlr_vector3 { + let node_151: string; + export { node_151 as node }; + let inherit_151: null; + export { inherit_151 as inherit }; + export namespace inputs_151 { + let valuel_10: string; + export { valuel_10 as valuel }; + let valuer_10: string; + export { valuer_10 as valuer }; + let center_4: string; + export { center_4 as center }; + let texcoord_45: string; + export { texcoord_45 as texcoord }; + } + export { inputs_151 as inputs }; + export namespace outputs_151 { + let out_142: string; + export { out_142 as out }; + } + export { outputs_151 as outputs }; + } + namespace ND_splitlr_vector4 { + let node_152: string; + export { node_152 as node }; + let inherit_152: null; + export { inherit_152 as inherit }; + export namespace inputs_152 { + let valuel_11: string; + export { valuel_11 as valuel }; + let valuer_11: string; + export { valuer_11 as valuer }; + let center_5: string; + export { center_5 as center }; + let texcoord_46: string; + export { texcoord_46 as texcoord }; + } + export { inputs_152 as inputs }; + export namespace outputs_152 { + let out_143: string; + export { out_143 as out }; + } + export { outputs_152 as outputs }; + } + namespace ND_splittb_float { + let node_153: string; + export { node_153 as node }; + let inherit_153: null; + export { inherit_153 as inherit }; + export namespace inputs_153 { + let valuet_6: string; + export { valuet_6 as valuet }; + let valueb_6: string; + export { valueb_6 as valueb }; + let center_6: string; + export { center_6 as center }; + let texcoord_47: string; + export { texcoord_47 as texcoord }; + } + export { inputs_153 as inputs }; + export namespace outputs_153 { + let out_144: string; + export { out_144 as out }; + } + export { outputs_153 as outputs }; + } + namespace ND_splittb_color3 { + let node_154: string; + export { node_154 as node }; + let inherit_154: null; + export { inherit_154 as inherit }; + export namespace inputs_154 { + let valuet_7: string; + export { valuet_7 as valuet }; + let valueb_7: string; + export { valueb_7 as valueb }; + let center_7: string; + export { center_7 as center }; + let texcoord_48: string; + export { texcoord_48 as texcoord }; + } + export { inputs_154 as inputs }; + export namespace outputs_154 { + let out_145: string; + export { out_145 as out }; + } + export { outputs_154 as outputs }; + } + namespace ND_splittb_color4 { + let node_155: string; + export { node_155 as node }; + let inherit_155: null; + export { inherit_155 as inherit }; + export namespace inputs_155 { + let valuet_8: string; + export { valuet_8 as valuet }; + let valueb_8: string; + export { valueb_8 as valueb }; + let center_8: string; + export { center_8 as center }; + let texcoord_49: string; + export { texcoord_49 as texcoord }; + } + export { inputs_155 as inputs }; + export namespace outputs_155 { + let out_146: string; + export { out_146 as out }; + } + export { outputs_155 as outputs }; + } + namespace ND_splittb_vector2 { + let node_156: string; + export { node_156 as node }; + let inherit_156: null; + export { inherit_156 as inherit }; + export namespace inputs_156 { + let valuet_9: string; + export { valuet_9 as valuet }; + let valueb_9: string; + export { valueb_9 as valueb }; + let center_9: string; + export { center_9 as center }; + let texcoord_50: string; + export { texcoord_50 as texcoord }; + } + export { inputs_156 as inputs }; + export namespace outputs_156 { + let out_147: string; + export { out_147 as out }; + } + export { outputs_156 as outputs }; + } + namespace ND_splittb_vector3 { + let node_157: string; + export { node_157 as node }; + let inherit_157: null; + export { inherit_157 as inherit }; + export namespace inputs_157 { + let valuet_10: string; + export { valuet_10 as valuet }; + let valueb_10: string; + export { valueb_10 as valueb }; + let center_10: string; + export { center_10 as center }; + let texcoord_51: string; + export { texcoord_51 as texcoord }; + } + export { inputs_157 as inputs }; + export namespace outputs_157 { + let out_148: string; + export { out_148 as out }; + } + export { outputs_157 as outputs }; + } + namespace ND_splittb_vector4 { + let node_158: string; + export { node_158 as node }; + let inherit_158: null; + export { inherit_158 as inherit }; + export namespace inputs_158 { + let valuet_11: string; + export { valuet_11 as valuet }; + let valueb_11: string; + export { valueb_11 as valueb }; + let center_11: string; + export { center_11 as center }; + let texcoord_52: string; + export { texcoord_52 as texcoord }; + } + export { inputs_158 as inputs }; + export namespace outputs_158 { + let out_149: string; + export { out_149 as out }; + } + export { outputs_158 as outputs }; + } + namespace ND_noise2d_float { + let node_159: string; + export { node_159 as node }; + let inherit_159: null; + export { inherit_159 as inherit }; + export namespace inputs_159 { + export let amplitude: string; + let pivot_8: string; + export { pivot_8 as pivot }; + let texcoord_53: string; + export { texcoord_53 as texcoord }; + } + export { inputs_159 as inputs }; + export namespace outputs_159 { + let out_150: string; + export { out_150 as out }; + } + export { outputs_159 as outputs }; + } + namespace ND_noise2d_color3 { + let node_160: string; + export { node_160 as node }; + let inherit_160: null; + export { inherit_160 as inherit }; + export namespace inputs_160 { + let amplitude_1: string; + export { amplitude_1 as amplitude }; + let pivot_9: string; + export { pivot_9 as pivot }; + let texcoord_54: string; + export { texcoord_54 as texcoord }; + } + export { inputs_160 as inputs }; + export namespace outputs_160 { + let out_151: string; + export { out_151 as out }; + } + export { outputs_160 as outputs }; + } + namespace ND_noise2d_color4 { + let node_161: string; + export { node_161 as node }; + let inherit_161: null; + export { inherit_161 as inherit }; + export namespace inputs_161 { + let amplitude_2: string; + export { amplitude_2 as amplitude }; + let pivot_10: string; + export { pivot_10 as pivot }; + let texcoord_55: string; + export { texcoord_55 as texcoord }; + } + export { inputs_161 as inputs }; + export namespace outputs_161 { + let out_152: string; + export { out_152 as out }; + } + export { outputs_161 as outputs }; + } + namespace ND_noise2d_vector2 { + let node_162: string; + export { node_162 as node }; + let inherit_162: null; + export { inherit_162 as inherit }; + export namespace inputs_162 { + let amplitude_3: string; + export { amplitude_3 as amplitude }; + let pivot_11: string; + export { pivot_11 as pivot }; + let texcoord_56: string; + export { texcoord_56 as texcoord }; + } + export { inputs_162 as inputs }; + export namespace outputs_162 { + let out_153: string; + export { out_153 as out }; + } + export { outputs_162 as outputs }; + } + namespace ND_noise2d_vector3 { + let node_163: string; + export { node_163 as node }; + let inherit_163: null; + export { inherit_163 as inherit }; + export namespace inputs_163 { + let amplitude_4: string; + export { amplitude_4 as amplitude }; + let pivot_12: string; + export { pivot_12 as pivot }; + let texcoord_57: string; + export { texcoord_57 as texcoord }; + } + export { inputs_163 as inputs }; + export namespace outputs_163 { + let out_154: string; + export { out_154 as out }; + } + export { outputs_163 as outputs }; + } + namespace ND_noise2d_vector4 { + let node_164: string; + export { node_164 as node }; + let inherit_164: null; + export { inherit_164 as inherit }; + export namespace inputs_164 { + let amplitude_5: string; + export { amplitude_5 as amplitude }; + let pivot_13: string; + export { pivot_13 as pivot }; + let texcoord_58: string; + export { texcoord_58 as texcoord }; + } + export { inputs_164 as inputs }; + export namespace outputs_164 { + let out_155: string; + export { out_155 as out }; + } + export { outputs_164 as outputs }; + } + namespace ND_noise2d_color3FA { + let node_165: string; + export { node_165 as node }; + let inherit_165: null; + export { inherit_165 as inherit }; + export namespace inputs_165 { + let amplitude_6: string; + export { amplitude_6 as amplitude }; + let pivot_14: string; + export { pivot_14 as pivot }; + let texcoord_59: string; + export { texcoord_59 as texcoord }; + } + export { inputs_165 as inputs }; + export namespace outputs_165 { + let out_156: string; + export { out_156 as out }; + } + export { outputs_165 as outputs }; + } + namespace ND_noise2d_color4FA { + let node_166: string; + export { node_166 as node }; + let inherit_166: null; + export { inherit_166 as inherit }; + export namespace inputs_166 { + let amplitude_7: string; + export { amplitude_7 as amplitude }; + let pivot_15: string; + export { pivot_15 as pivot }; + let texcoord_60: string; + export { texcoord_60 as texcoord }; + } + export { inputs_166 as inputs }; + export namespace outputs_166 { + let out_157: string; + export { out_157 as out }; + } + export { outputs_166 as outputs }; + } + namespace ND_noise2d_vector2FA { + let node_167: string; + export { node_167 as node }; + let inherit_167: null; + export { inherit_167 as inherit }; + export namespace inputs_167 { + let amplitude_8: string; + export { amplitude_8 as amplitude }; + let pivot_16: string; + export { pivot_16 as pivot }; + let texcoord_61: string; + export { texcoord_61 as texcoord }; + } + export { inputs_167 as inputs }; + export namespace outputs_167 { + let out_158: string; + export { out_158 as out }; + } + export { outputs_167 as outputs }; + } + namespace ND_noise2d_vector3FA { + let node_168: string; + export { node_168 as node }; + let inherit_168: null; + export { inherit_168 as inherit }; + export namespace inputs_168 { + let amplitude_9: string; + export { amplitude_9 as amplitude }; + let pivot_17: string; + export { pivot_17 as pivot }; + let texcoord_62: string; + export { texcoord_62 as texcoord }; + } + export { inputs_168 as inputs }; + export namespace outputs_168 { + let out_159: string; + export { out_159 as out }; + } + export { outputs_168 as outputs }; + } + namespace ND_noise2d_vector4FA { + let node_169: string; + export { node_169 as node }; + let inherit_169: null; + export { inherit_169 as inherit }; + export namespace inputs_169 { + let amplitude_10: string; + export { amplitude_10 as amplitude }; + let pivot_18: string; + export { pivot_18 as pivot }; + let texcoord_63: string; + export { texcoord_63 as texcoord }; + } + export { inputs_169 as inputs }; + export namespace outputs_169 { + let out_160: string; + export { out_160 as out }; + } + export { outputs_169 as outputs }; + } + namespace ND_noise3d_float { + let node_170: string; + export { node_170 as node }; + let inherit_170: null; + export { inherit_170 as inherit }; + export namespace inputs_170 { + let amplitude_11: string; + export { amplitude_11 as amplitude }; + let pivot_19: string; + export { pivot_19 as pivot }; + let position_6: string; + export { position_6 as position }; + } + export { inputs_170 as inputs }; + export namespace outputs_170 { + let out_161: string; + export { out_161 as out }; + } + export { outputs_170 as outputs }; + } + namespace ND_noise3d_color3 { + let node_171: string; + export { node_171 as node }; + let inherit_171: null; + export { inherit_171 as inherit }; + export namespace inputs_171 { + let amplitude_12: string; + export { amplitude_12 as amplitude }; + let pivot_20: string; + export { pivot_20 as pivot }; + let position_7: string; + export { position_7 as position }; + } + export { inputs_171 as inputs }; + export namespace outputs_171 { + let out_162: string; + export { out_162 as out }; + } + export { outputs_171 as outputs }; + } + namespace ND_noise3d_color4 { + let node_172: string; + export { node_172 as node }; + let inherit_172: null; + export { inherit_172 as inherit }; + export namespace inputs_172 { + let amplitude_13: string; + export { amplitude_13 as amplitude }; + let pivot_21: string; + export { pivot_21 as pivot }; + let position_8: string; + export { position_8 as position }; + } + export { inputs_172 as inputs }; + export namespace outputs_172 { + let out_163: string; + export { out_163 as out }; + } + export { outputs_172 as outputs }; + } + namespace ND_noise3d_vector2 { + let node_173: string; + export { node_173 as node }; + let inherit_173: null; + export { inherit_173 as inherit }; + export namespace inputs_173 { + let amplitude_14: string; + export { amplitude_14 as amplitude }; + let pivot_22: string; + export { pivot_22 as pivot }; + let position_9: string; + export { position_9 as position }; + } + export { inputs_173 as inputs }; + export namespace outputs_173 { + let out_164: string; + export { out_164 as out }; + } + export { outputs_173 as outputs }; + } + namespace ND_noise3d_vector3 { + let node_174: string; + export { node_174 as node }; + let inherit_174: null; + export { inherit_174 as inherit }; + export namespace inputs_174 { + let amplitude_15: string; + export { amplitude_15 as amplitude }; + let pivot_23: string; + export { pivot_23 as pivot }; + let position_10: string; + export { position_10 as position }; + } + export { inputs_174 as inputs }; + export namespace outputs_174 { + let out_165: string; + export { out_165 as out }; + } + export { outputs_174 as outputs }; + } + namespace ND_noise3d_vector4 { + let node_175: string; + export { node_175 as node }; + let inherit_175: null; + export { inherit_175 as inherit }; + export namespace inputs_175 { + let amplitude_16: string; + export { amplitude_16 as amplitude }; + let pivot_24: string; + export { pivot_24 as pivot }; + let position_11: string; + export { position_11 as position }; + } + export { inputs_175 as inputs }; + export namespace outputs_175 { + let out_166: string; + export { out_166 as out }; + } + export { outputs_175 as outputs }; + } + namespace ND_noise3d_color3FA { + let node_176: string; + export { node_176 as node }; + let inherit_176: null; + export { inherit_176 as inherit }; + export namespace inputs_176 { + let amplitude_17: string; + export { amplitude_17 as amplitude }; + let pivot_25: string; + export { pivot_25 as pivot }; + let position_12: string; + export { position_12 as position }; + } + export { inputs_176 as inputs }; + export namespace outputs_176 { + let out_167: string; + export { out_167 as out }; + } + export { outputs_176 as outputs }; + } + namespace ND_noise3d_color4FA { + let node_177: string; + export { node_177 as node }; + let inherit_177: null; + export { inherit_177 as inherit }; + export namespace inputs_177 { + let amplitude_18: string; + export { amplitude_18 as amplitude }; + let pivot_26: string; + export { pivot_26 as pivot }; + let position_13: string; + export { position_13 as position }; + } + export { inputs_177 as inputs }; + export namespace outputs_177 { + let out_168: string; + export { out_168 as out }; + } + export { outputs_177 as outputs }; + } + namespace ND_noise3d_vector2FA { + let node_178: string; + export { node_178 as node }; + let inherit_178: null; + export { inherit_178 as inherit }; + export namespace inputs_178 { + let amplitude_19: string; + export { amplitude_19 as amplitude }; + let pivot_27: string; + export { pivot_27 as pivot }; + let position_14: string; + export { position_14 as position }; + } + export { inputs_178 as inputs }; + export namespace outputs_178 { + let out_169: string; + export { out_169 as out }; + } + export { outputs_178 as outputs }; + } + namespace ND_noise3d_vector3FA { + let node_179: string; + export { node_179 as node }; + let inherit_179: null; + export { inherit_179 as inherit }; + export namespace inputs_179 { + let amplitude_20: string; + export { amplitude_20 as amplitude }; + let pivot_28: string; + export { pivot_28 as pivot }; + let position_15: string; + export { position_15 as position }; + } + export { inputs_179 as inputs }; + export namespace outputs_179 { + let out_170: string; + export { out_170 as out }; + } + export { outputs_179 as outputs }; + } + namespace ND_noise3d_vector4FA { + let node_180: string; + export { node_180 as node }; + let inherit_180: null; + export { inherit_180 as inherit }; + export namespace inputs_180 { + let amplitude_21: string; + export { amplitude_21 as amplitude }; + let pivot_29: string; + export { pivot_29 as pivot }; + let position_16: string; + export { position_16 as position }; + } + export { inputs_180 as inputs }; + export namespace outputs_180 { + let out_171: string; + export { out_171 as out }; + } + export { outputs_180 as outputs }; + } + namespace ND_fractal2d_float { + let node_181: string; + export { node_181 as node }; + let inherit_181: null; + export { inherit_181 as inherit }; + export namespace inputs_181 { + let amplitude_22: string; + export { amplitude_22 as amplitude }; + export let octaves: string; + export let lacunarity: string; + export let diminish: string; + let texcoord_64: string; + export { texcoord_64 as texcoord }; + } + export { inputs_181 as inputs }; + export namespace outputs_181 { + let out_172: string; + export { out_172 as out }; + } + export { outputs_181 as outputs }; + } + namespace ND_fractal2d_color3 { + let node_182: string; + export { node_182 as node }; + let inherit_182: null; + export { inherit_182 as inherit }; + export namespace inputs_182 { + let amplitude_23: string; + export { amplitude_23 as amplitude }; + let octaves_1: string; + export { octaves_1 as octaves }; + let lacunarity_1: string; + export { lacunarity_1 as lacunarity }; + let diminish_1: string; + export { diminish_1 as diminish }; + let texcoord_65: string; + export { texcoord_65 as texcoord }; + } + export { inputs_182 as inputs }; + export namespace outputs_182 { + let out_173: string; + export { out_173 as out }; + } + export { outputs_182 as outputs }; + } + namespace ND_fractal2d_color4 { + let node_183: string; + export { node_183 as node }; + let inherit_183: null; + export { inherit_183 as inherit }; + export namespace inputs_183 { + let amplitude_24: string; + export { amplitude_24 as amplitude }; + let octaves_2: string; + export { octaves_2 as octaves }; + let lacunarity_2: string; + export { lacunarity_2 as lacunarity }; + let diminish_2: string; + export { diminish_2 as diminish }; + let texcoord_66: string; + export { texcoord_66 as texcoord }; + } + export { inputs_183 as inputs }; + export namespace outputs_183 { + let out_174: string; + export { out_174 as out }; + } + export { outputs_183 as outputs }; + } + namespace ND_fractal2d_vector2 { + let node_184: string; + export { node_184 as node }; + let inherit_184: null; + export { inherit_184 as inherit }; + export namespace inputs_184 { + let amplitude_25: string; + export { amplitude_25 as amplitude }; + let octaves_3: string; + export { octaves_3 as octaves }; + let lacunarity_3: string; + export { lacunarity_3 as lacunarity }; + let diminish_3: string; + export { diminish_3 as diminish }; + let texcoord_67: string; + export { texcoord_67 as texcoord }; + } + export { inputs_184 as inputs }; + export namespace outputs_184 { + let out_175: string; + export { out_175 as out }; + } + export { outputs_184 as outputs }; + } + namespace ND_fractal2d_vector3 { + let node_185: string; + export { node_185 as node }; + let inherit_185: null; + export { inherit_185 as inherit }; + export namespace inputs_185 { + let amplitude_26: string; + export { amplitude_26 as amplitude }; + let octaves_4: string; + export { octaves_4 as octaves }; + let lacunarity_4: string; + export { lacunarity_4 as lacunarity }; + let diminish_4: string; + export { diminish_4 as diminish }; + let texcoord_68: string; + export { texcoord_68 as texcoord }; + } + export { inputs_185 as inputs }; + export namespace outputs_185 { + let out_176: string; + export { out_176 as out }; + } + export { outputs_185 as outputs }; + } + namespace ND_fractal2d_vector4 { + let node_186: string; + export { node_186 as node }; + let inherit_186: null; + export { inherit_186 as inherit }; + export namespace inputs_186 { + let amplitude_27: string; + export { amplitude_27 as amplitude }; + let octaves_5: string; + export { octaves_5 as octaves }; + let lacunarity_5: string; + export { lacunarity_5 as lacunarity }; + let diminish_5: string; + export { diminish_5 as diminish }; + let texcoord_69: string; + export { texcoord_69 as texcoord }; + } + export { inputs_186 as inputs }; + export namespace outputs_186 { + let out_177: string; + export { out_177 as out }; + } + export { outputs_186 as outputs }; + } + namespace ND_fractal2d_color3FA { + let node_187: string; + export { node_187 as node }; + let inherit_187: null; + export { inherit_187 as inherit }; + export namespace inputs_187 { + let amplitude_28: string; + export { amplitude_28 as amplitude }; + let octaves_6: string; + export { octaves_6 as octaves }; + let lacunarity_6: string; + export { lacunarity_6 as lacunarity }; + let diminish_6: string; + export { diminish_6 as diminish }; + let texcoord_70: string; + export { texcoord_70 as texcoord }; + } + export { inputs_187 as inputs }; + export namespace outputs_187 { + let out_178: string; + export { out_178 as out }; + } + export { outputs_187 as outputs }; + } + namespace ND_fractal2d_color4FA { + let node_188: string; + export { node_188 as node }; + let inherit_188: null; + export { inherit_188 as inherit }; + export namespace inputs_188 { + let amplitude_29: string; + export { amplitude_29 as amplitude }; + let octaves_7: string; + export { octaves_7 as octaves }; + let lacunarity_7: string; + export { lacunarity_7 as lacunarity }; + let diminish_7: string; + export { diminish_7 as diminish }; + let texcoord_71: string; + export { texcoord_71 as texcoord }; + } + export { inputs_188 as inputs }; + export namespace outputs_188 { + let out_179: string; + export { out_179 as out }; + } + export { outputs_188 as outputs }; + } + namespace ND_fractal2d_vector2FA { + let node_189: string; + export { node_189 as node }; + let inherit_189: null; + export { inherit_189 as inherit }; + export namespace inputs_189 { + let amplitude_30: string; + export { amplitude_30 as amplitude }; + let octaves_8: string; + export { octaves_8 as octaves }; + let lacunarity_8: string; + export { lacunarity_8 as lacunarity }; + let diminish_8: string; + export { diminish_8 as diminish }; + let texcoord_72: string; + export { texcoord_72 as texcoord }; + } + export { inputs_189 as inputs }; + export namespace outputs_189 { + let out_180: string; + export { out_180 as out }; + } + export { outputs_189 as outputs }; + } + namespace ND_fractal2d_vector3FA { + let node_190: string; + export { node_190 as node }; + let inherit_190: null; + export { inherit_190 as inherit }; + export namespace inputs_190 { + let amplitude_31: string; + export { amplitude_31 as amplitude }; + let octaves_9: string; + export { octaves_9 as octaves }; + let lacunarity_9: string; + export { lacunarity_9 as lacunarity }; + let diminish_9: string; + export { diminish_9 as diminish }; + let texcoord_73: string; + export { texcoord_73 as texcoord }; + } + export { inputs_190 as inputs }; + export namespace outputs_190 { + let out_181: string; + export { out_181 as out }; + } + export { outputs_190 as outputs }; + } + namespace ND_fractal2d_vector4FA { + let node_191: string; + export { node_191 as node }; + let inherit_191: null; + export { inherit_191 as inherit }; + export namespace inputs_191 { + let amplitude_32: string; + export { amplitude_32 as amplitude }; + let octaves_10: string; + export { octaves_10 as octaves }; + let lacunarity_10: string; + export { lacunarity_10 as lacunarity }; + let diminish_10: string; + export { diminish_10 as diminish }; + let texcoord_74: string; + export { texcoord_74 as texcoord }; + } + export { inputs_191 as inputs }; + export namespace outputs_191 { + let out_182: string; + export { out_182 as out }; + } + export { outputs_191 as outputs }; + } + namespace ND_fractal3d_float { + let node_192: string; + export { node_192 as node }; + let inherit_192: null; + export { inherit_192 as inherit }; + export namespace inputs_192 { + let amplitude_33: string; + export { amplitude_33 as amplitude }; + let octaves_11: string; + export { octaves_11 as octaves }; + let lacunarity_11: string; + export { lacunarity_11 as lacunarity }; + let diminish_11: string; + export { diminish_11 as diminish }; + let position_17: string; + export { position_17 as position }; + } + export { inputs_192 as inputs }; + export namespace outputs_192 { + let out_183: string; + export { out_183 as out }; + } + export { outputs_192 as outputs }; + } + namespace ND_fractal3d_color3 { + let node_193: string; + export { node_193 as node }; + let inherit_193: null; + export { inherit_193 as inherit }; + export namespace inputs_193 { + let amplitude_34: string; + export { amplitude_34 as amplitude }; + let octaves_12: string; + export { octaves_12 as octaves }; + let lacunarity_12: string; + export { lacunarity_12 as lacunarity }; + let diminish_12: string; + export { diminish_12 as diminish }; + let position_18: string; + export { position_18 as position }; + } + export { inputs_193 as inputs }; + export namespace outputs_193 { + let out_184: string; + export { out_184 as out }; + } + export { outputs_193 as outputs }; + } + namespace ND_fractal3d_color4 { + let node_194: string; + export { node_194 as node }; + let inherit_194: null; + export { inherit_194 as inherit }; + export namespace inputs_194 { + let amplitude_35: string; + export { amplitude_35 as amplitude }; + let octaves_13: string; + export { octaves_13 as octaves }; + let lacunarity_13: string; + export { lacunarity_13 as lacunarity }; + let diminish_13: string; + export { diminish_13 as diminish }; + let position_19: string; + export { position_19 as position }; + } + export { inputs_194 as inputs }; + export namespace outputs_194 { + let out_185: string; + export { out_185 as out }; + } + export { outputs_194 as outputs }; + } + namespace ND_fractal3d_vector2 { + let node_195: string; + export { node_195 as node }; + let inherit_195: null; + export { inherit_195 as inherit }; + export namespace inputs_195 { + let amplitude_36: string; + export { amplitude_36 as amplitude }; + let octaves_14: string; + export { octaves_14 as octaves }; + let lacunarity_14: string; + export { lacunarity_14 as lacunarity }; + let diminish_14: string; + export { diminish_14 as diminish }; + let position_20: string; + export { position_20 as position }; + } + export { inputs_195 as inputs }; + export namespace outputs_195 { + let out_186: string; + export { out_186 as out }; + } + export { outputs_195 as outputs }; + } + namespace ND_fractal3d_vector3 { + let node_196: string; + export { node_196 as node }; + let inherit_196: null; + export { inherit_196 as inherit }; + export namespace inputs_196 { + let amplitude_37: string; + export { amplitude_37 as amplitude }; + let octaves_15: string; + export { octaves_15 as octaves }; + let lacunarity_15: string; + export { lacunarity_15 as lacunarity }; + let diminish_15: string; + export { diminish_15 as diminish }; + let position_21: string; + export { position_21 as position }; + } + export { inputs_196 as inputs }; + export namespace outputs_196 { + let out_187: string; + export { out_187 as out }; + } + export { outputs_196 as outputs }; + } + namespace ND_fractal3d_vector4 { + let node_197: string; + export { node_197 as node }; + let inherit_197: null; + export { inherit_197 as inherit }; + export namespace inputs_197 { + let amplitude_38: string; + export { amplitude_38 as amplitude }; + let octaves_16: string; + export { octaves_16 as octaves }; + let lacunarity_16: string; + export { lacunarity_16 as lacunarity }; + let diminish_16: string; + export { diminish_16 as diminish }; + let position_22: string; + export { position_22 as position }; + } + export { inputs_197 as inputs }; + export namespace outputs_197 { + let out_188: string; + export { out_188 as out }; + } + export { outputs_197 as outputs }; + } + namespace ND_fractal3d_color3FA { + let node_198: string; + export { node_198 as node }; + let inherit_198: null; + export { inherit_198 as inherit }; + export namespace inputs_198 { + let amplitude_39: string; + export { amplitude_39 as amplitude }; + let octaves_17: string; + export { octaves_17 as octaves }; + let lacunarity_17: string; + export { lacunarity_17 as lacunarity }; + let diminish_17: string; + export { diminish_17 as diminish }; + let position_23: string; + export { position_23 as position }; + } + export { inputs_198 as inputs }; + export namespace outputs_198 { + let out_189: string; + export { out_189 as out }; + } + export { outputs_198 as outputs }; + } + namespace ND_fractal3d_color4FA { + let node_199: string; + export { node_199 as node }; + let inherit_199: null; + export { inherit_199 as inherit }; + export namespace inputs_199 { + let amplitude_40: string; + export { amplitude_40 as amplitude }; + let octaves_18: string; + export { octaves_18 as octaves }; + let lacunarity_18: string; + export { lacunarity_18 as lacunarity }; + let diminish_18: string; + export { diminish_18 as diminish }; + let position_24: string; + export { position_24 as position }; + } + export { inputs_199 as inputs }; + export namespace outputs_199 { + let out_190: string; + export { out_190 as out }; + } + export { outputs_199 as outputs }; + } + namespace ND_fractal3d_vector2FA { + let node_200: string; + export { node_200 as node }; + let inherit_200: null; + export { inherit_200 as inherit }; + export namespace inputs_200 { + let amplitude_41: string; + export { amplitude_41 as amplitude }; + let octaves_19: string; + export { octaves_19 as octaves }; + let lacunarity_19: string; + export { lacunarity_19 as lacunarity }; + let diminish_19: string; + export { diminish_19 as diminish }; + let position_25: string; + export { position_25 as position }; + } + export { inputs_200 as inputs }; + export namespace outputs_200 { + let out_191: string; + export { out_191 as out }; + } + export { outputs_200 as outputs }; + } + namespace ND_fractal3d_vector3FA { + let node_201: string; + export { node_201 as node }; + let inherit_201: null; + export { inherit_201 as inherit }; + export namespace inputs_201 { + let amplitude_42: string; + export { amplitude_42 as amplitude }; + let octaves_20: string; + export { octaves_20 as octaves }; + let lacunarity_20: string; + export { lacunarity_20 as lacunarity }; + let diminish_20: string; + export { diminish_20 as diminish }; + let position_26: string; + export { position_26 as position }; + } + export { inputs_201 as inputs }; + export namespace outputs_201 { + let out_192: string; + export { out_192 as out }; + } + export { outputs_201 as outputs }; + } + namespace ND_fractal3d_vector4FA { + let node_202: string; + export { node_202 as node }; + let inherit_202: null; + export { inherit_202 as inherit }; + export namespace inputs_202 { + let amplitude_43: string; + export { amplitude_43 as amplitude }; + let octaves_21: string; + export { octaves_21 as octaves }; + let lacunarity_21: string; + export { lacunarity_21 as lacunarity }; + let diminish_21: string; + export { diminish_21 as diminish }; + let position_27: string; + export { position_27 as position }; + } + export { inputs_202 as inputs }; + export namespace outputs_202 { + let out_193: string; + export { out_193 as out }; + } + export { outputs_202 as outputs }; + } + namespace ND_cellnoise2d_float { + let node_203: string; + export { node_203 as node }; + let inherit_203: null; + export { inherit_203 as inherit }; + export namespace inputs_203 { + let texcoord_75: string; + export { texcoord_75 as texcoord }; + } + export { inputs_203 as inputs }; + export namespace outputs_203 { + let out_194: string; + export { out_194 as out }; + } + export { outputs_203 as outputs }; + } + namespace ND_cellnoise3d_float { + let node_204: string; + export { node_204 as node }; + let inherit_204: null; + export { inherit_204 as inherit }; + export namespace inputs_204 { + let position_28: string; + export { position_28 as position }; + } + export { inputs_204 as inputs }; + export namespace outputs_204 { + let out_195: string; + export { out_195 as out }; + } + export { outputs_204 as outputs }; + } + namespace ND_worleynoise2d_float { + let node_205: string; + export { node_205 as node }; + let inherit_205: null; + export { inherit_205 as inherit }; + export namespace inputs_205 { + let texcoord_76: string; + export { texcoord_76 as texcoord }; + export let jitter: string; + export let style: string; + } + export { inputs_205 as inputs }; + export namespace outputs_205 { + let out_196: string; + export { out_196 as out }; + } + export { outputs_205 as outputs }; + } + namespace ND_worleynoise2d_vector2 { + let node_206: string; + export { node_206 as node }; + let inherit_206: null; + export { inherit_206 as inherit }; + export namespace inputs_206 { + let texcoord_77: string; + export { texcoord_77 as texcoord }; + let jitter_1: string; + export { jitter_1 as jitter }; + let style_1: string; + export { style_1 as style }; + } + export { inputs_206 as inputs }; + export namespace outputs_206 { + let out_197: string; + export { out_197 as out }; + } + export { outputs_206 as outputs }; + } + namespace ND_worleynoise2d_vector3 { + let node_207: string; + export { node_207 as node }; + let inherit_207: null; + export { inherit_207 as inherit }; + export namespace inputs_207 { + let texcoord_78: string; + export { texcoord_78 as texcoord }; + let jitter_2: string; + export { jitter_2 as jitter }; + let style_2: string; + export { style_2 as style }; + } + export { inputs_207 as inputs }; + export namespace outputs_207 { + let out_198: string; + export { out_198 as out }; + } + export { outputs_207 as outputs }; + } + namespace ND_worleynoise3d_float { + let node_208: string; + export { node_208 as node }; + let inherit_208: null; + export { inherit_208 as inherit }; + export namespace inputs_208 { + let position_29: string; + export { position_29 as position }; + let jitter_3: string; + export { jitter_3 as jitter }; + let style_3: string; + export { style_3 as style }; + } + export { inputs_208 as inputs }; + export namespace outputs_208 { + let out_199: string; + export { out_199 as out }; + } + export { outputs_208 as outputs }; + } + namespace ND_worleynoise3d_vector2 { + let node_209: string; + export { node_209 as node }; + let inherit_209: null; + export { inherit_209 as inherit }; + export namespace inputs_209 { + let position_30: string; + export { position_30 as position }; + let jitter_4: string; + export { jitter_4 as jitter }; + let style_4: string; + export { style_4 as style }; + } + export { inputs_209 as inputs }; + export namespace outputs_209 { + let out_200: string; + export { out_200 as out }; + } + export { outputs_209 as outputs }; + } + namespace ND_worleynoise3d_vector3 { + let node_210: string; + export { node_210 as node }; + let inherit_210: null; + export { inherit_210 as inherit }; + export namespace inputs_210 { + let position_31: string; + export { position_31 as position }; + let jitter_5: string; + export { jitter_5 as jitter }; + let style_5: string; + export { style_5 as style }; + } + export { inputs_210 as inputs }; + export namespace outputs_210 { + let out_201: string; + export { out_201 as out }; + } + export { outputs_210 as outputs }; + } + namespace ND_unifiednoise2d_float { + let node_211: string; + export { node_211 as node }; + let inherit_211: null; + export { inherit_211 as inherit }; + export namespace inputs_211 { + let texcoord_79: string; + export { texcoord_79 as texcoord }; + export let freq: string; + let offset_10: string; + export { offset_10 as offset }; + let jitter_6: string; + export { jitter_6 as jitter }; + export let outmin: string; + export let outmax: string; + export let clampoutput: string; + let octaves_22: string; + export { octaves_22 as octaves }; + let lacunarity_22: string; + export { lacunarity_22 as lacunarity }; + let diminish_22: string; + export { diminish_22 as diminish }; + let type_1: string; + export { type_1 as type }; + let style_6: string; + export { style_6 as style }; + } + export { inputs_211 as inputs }; + export namespace outputs_211 { + let out_202: string; + export { out_202 as out }; + } + export { outputs_211 as outputs }; + } + namespace ND_unifiednoise3d_float { + let node_212: string; + export { node_212 as node }; + let inherit_212: null; + export { inherit_212 as inherit }; + export namespace inputs_212 { + let position_32: string; + export { position_32 as position }; + let freq_1: string; + export { freq_1 as freq }; + let offset_11: string; + export { offset_11 as offset }; + let jitter_7: string; + export { jitter_7 as jitter }; + let outmin_1: string; + export { outmin_1 as outmin }; + let outmax_1: string; + export { outmax_1 as outmax }; + let clampoutput_1: string; + export { clampoutput_1 as clampoutput }; + let octaves_23: string; + export { octaves_23 as octaves }; + let lacunarity_23: string; + export { lacunarity_23 as lacunarity }; + let diminish_23: string; + export { diminish_23 as diminish }; + let type_2: string; + export { type_2 as type }; + let style_7: string; + export { style_7 as style }; + } + export { inputs_212 as inputs }; + export namespace outputs_212 { + let out_203: string; + export { out_203 as out }; + } + export { outputs_212 as outputs }; + } + namespace ND_flake2d { + let node_213: string; + export { node_213 as node }; + let inherit_213: null; + export { inherit_213 as inherit }; + export namespace inputs_213 { + export let size: string; + let roughness_12: string; + export { roughness_12 as roughness }; + export let coverage: string; + let texcoord_80: string; + export { texcoord_80 as texcoord }; + let normal_21: string; + export { normal_21 as normal }; + let tangent_5: string; + export { tangent_5 as tangent }; + export let bitangent: string; + } + export { inputs_213 as inputs }; + export namespace outputs_213 { + let id: string; + let rand: string; + let presence: string; + let flakenormal: string; + } + export { outputs_213 as outputs }; + } + namespace ND_flake3d { + let node_214: string; + export { node_214 as node }; + let inherit_214: null; + export { inherit_214 as inherit }; + export namespace inputs_214 { + let size_1: string; + export { size_1 as size }; + let roughness_13: string; + export { roughness_13 as roughness }; + let coverage_1: string; + export { coverage_1 as coverage }; + let position_33: string; + export { position_33 as position }; + let normal_22: string; + export { normal_22 as normal }; + let tangent_6: string; + export { tangent_6 as tangent }; + let bitangent_1: string; + export { bitangent_1 as bitangent }; + } + export { inputs_214 as inputs }; + export namespace outputs_214 { + let id_1: string; + export { id_1 as id }; + let rand_1: string; + export { rand_1 as rand }; + let presence_1: string; + export { presence_1 as presence }; + let flakenormal_1: string; + export { flakenormal_1 as flakenormal }; + } + export { outputs_214 as outputs }; + } + namespace ND_randomfloat_float { + let node_215: string; + export { node_215 as node }; + let inherit_215: null; + export { inherit_215 as inherit }; + export namespace inputs_215 { + let _in_21: string; + export { _in_21 as in }; + export let min: string; + export let max: string; + export let seed: string; + } + export { inputs_215 as inputs }; + export namespace outputs_215 { + let out_204: string; + export { out_204 as out }; + } + export { outputs_215 as outputs }; + } + namespace ND_randomfloat_integer { + let node_216: string; + export { node_216 as node }; + let inherit_216: null; + export { inherit_216 as inherit }; + export namespace inputs_216 { + let _in_22: string; + export { _in_22 as in }; + let min_1: string; + export { min_1 as min }; + let max_1: string; + export { max_1 as max }; + let seed_1: string; + export { seed_1 as seed }; + } + export { inputs_216 as inputs }; + export namespace outputs_216 { + let out_205: string; + export { out_205 as out }; + } + export { outputs_216 as outputs }; + } + namespace ND_randomcolor_float { + let node_217: string; + export { node_217 as node }; + let inherit_217: null; + export { inherit_217 as inherit }; + export namespace inputs_217 { + let _in_23: string; + export { _in_23 as in }; + export let huelow: string; + export let huehigh: string; + export let saturationlow: string; + export let saturationhigh: string; + export let brightnesslow: string; + export let brightnesshigh: string; + let seed_2: string; + export { seed_2 as seed }; + } + export { inputs_217 as inputs }; + export namespace outputs_217 { + let out_206: string; + export { out_206 as out }; + } + export { outputs_217 as outputs }; + } + namespace ND_randomcolor_integer { + let node_218: string; + export { node_218 as node }; + let inherit_218: null; + export { inherit_218 as inherit }; + export namespace inputs_218 { + let _in_24: string; + export { _in_24 as in }; + let huelow_1: string; + export { huelow_1 as huelow }; + let huehigh_1: string; + export { huehigh_1 as huehigh }; + let saturationlow_1: string; + export { saturationlow_1 as saturationlow }; + let saturationhigh_1: string; + export { saturationhigh_1 as saturationhigh }; + let brightnesslow_1: string; + export { brightnesslow_1 as brightnesslow }; + let brightnesshigh_1: string; + export { brightnesshigh_1 as brightnesshigh }; + let seed_3: string; + export { seed_3 as seed }; + } + export { inputs_218 as inputs }; + export namespace outputs_218 { + let out_207: string; + export { out_207 as out }; + } + export { outputs_218 as outputs }; + } + namespace ND_checkerboard_color3 { + let node_219: string; + export { node_219 as node }; + let inherit_219: null; + export { inherit_219 as inherit }; + export namespace inputs_219 { + let color1_2: string; + export { color1_2 as color1 }; + let color2_2: string; + export { color2_2 as color2 }; + let uvtiling_6: string; + export { uvtiling_6 as uvtiling }; + let uvoffset_6: string; + export { uvoffset_6 as uvoffset }; + let texcoord_81: string; + export { texcoord_81 as texcoord }; + } + export { inputs_219 as inputs }; + export namespace outputs_219 { + let out_208: string; + export { out_208 as out }; + } + export { outputs_219 as outputs }; + } + namespace ND_line_float { + let node_220: string; + export { node_220 as node }; + let inherit_220: null; + export { inherit_220 as inherit }; + export namespace inputs_220 { + let texcoord_82: string; + export { texcoord_82 as texcoord }; + let center_12: string; + export { center_12 as center }; + let radius_1: string; + export { radius_1 as radius }; + export let point1: string; + export let point2: string; + } + export { inputs_220 as inputs }; + export namespace outputs_220 { + let out_209: string; + export { out_209 as out }; + } + export { outputs_220 as outputs }; + } + namespace ND_circle_float { + let node_221: string; + export { node_221 as node }; + let inherit_221: null; + export { inherit_221 as inherit }; + export namespace inputs_221 { + let texcoord_83: string; + export { texcoord_83 as texcoord }; + let center_13: string; + export { center_13 as center }; + let radius_2: string; + export { radius_2 as radius }; + } + export { inputs_221 as inputs }; + export namespace outputs_221 { + let out_210: string; + export { out_210 as out }; + } + export { outputs_221 as outputs }; + } + namespace ND_cloverleaf_float { + let node_222: string; + export { node_222 as node }; + let inherit_222: null; + export { inherit_222 as inherit }; + export namespace inputs_222 { + let texcoord_84: string; + export { texcoord_84 as texcoord }; + let center_14: string; + export { center_14 as center }; + let radius_3: string; + export { radius_3 as radius }; + } + export { inputs_222 as inputs }; + export namespace outputs_222 { + let out_211: string; + export { out_211 as out }; + } + export { outputs_222 as outputs }; + } + namespace ND_hexagon_float { + let node_223: string; + export { node_223 as node }; + let inherit_223: null; + export { inherit_223 as inherit }; + export namespace inputs_223 { + let texcoord_85: string; + export { texcoord_85 as texcoord }; + let center_15: string; + export { center_15 as center }; + let radius_4: string; + export { radius_4 as radius }; + } + export { inputs_223 as inputs }; + export namespace outputs_223 { + let out_212: string; + export { out_212 as out }; + } + export { outputs_223 as outputs }; + } + namespace ND_grid_color3 { + let node_224: string; + export { node_224 as node }; + let inherit_224: null; + export { inherit_224 as inherit }; + export namespace inputs_224 { + let texcoord_86: string; + export { texcoord_86 as texcoord }; + let uvtiling_7: string; + export { uvtiling_7 as uvtiling }; + let uvoffset_7: string; + export { uvoffset_7 as uvoffset }; + let thickness_1: string; + export { thickness_1 as thickness }; + export let staggered: string; + } + export { inputs_224 as inputs }; + export namespace outputs_224 { + let out_213: string; + export { out_213 as out }; + } + export { outputs_224 as outputs }; + } + namespace ND_crosshatch_color3 { + let node_225: string; + export { node_225 as node }; + let inherit_225: null; + export { inherit_225 as inherit }; + export namespace inputs_225 { + let texcoord_87: string; + export { texcoord_87 as texcoord }; + let uvtiling_8: string; + export { uvtiling_8 as uvtiling }; + let uvoffset_8: string; + export { uvoffset_8 as uvoffset }; + let thickness_2: string; + export { thickness_2 as thickness }; + let staggered_1: string; + export { staggered_1 as staggered }; + } + export { inputs_225 as inputs }; + export namespace outputs_225 { + let out_214: string; + export { out_214 as out }; + } + export { outputs_225 as outputs }; + } + namespace ND_tiledcircles_color3 { + let node_226: string; + export { node_226 as node }; + let inherit_226: null; + export { inherit_226 as inherit }; + export namespace inputs_226 { + let texcoord_88: string; + export { texcoord_88 as texcoord }; + let uvtiling_9: string; + export { uvtiling_9 as uvtiling }; + let uvoffset_9: string; + export { uvoffset_9 as uvoffset }; + let size_2: string; + export { size_2 as size }; + let staggered_2: string; + export { staggered_2 as staggered }; + } + export { inputs_226 as inputs }; + export namespace outputs_226 { + let out_215: string; + export { out_215 as out }; + } + export { outputs_226 as outputs }; + } + namespace ND_tiledcloverleafs_color3 { + let node_227: string; + export { node_227 as node }; + let inherit_227: null; + export { inherit_227 as inherit }; + export namespace inputs_227 { + let texcoord_89: string; + export { texcoord_89 as texcoord }; + let uvtiling_10: string; + export { uvtiling_10 as uvtiling }; + let uvoffset_10: string; + export { uvoffset_10 as uvoffset }; + let size_3: string; + export { size_3 as size }; + let staggered_3: string; + export { staggered_3 as staggered }; + } + export { inputs_227 as inputs }; + export namespace outputs_227 { + let out_216: string; + export { out_216 as out }; + } + export { outputs_227 as outputs }; + } + namespace ND_tiledhexagons_color3 { + let node_228: string; + export { node_228 as node }; + let inherit_228: null; + export { inherit_228 as inherit }; + export namespace inputs_228 { + let texcoord_90: string; + export { texcoord_90 as texcoord }; + let uvtiling_11: string; + export { uvtiling_11 as uvtiling }; + let uvoffset_11: string; + export { uvoffset_11 as uvoffset }; + let size_4: string; + export { size_4 as size }; + let staggered_4: string; + export { staggered_4 as staggered }; + } + export { inputs_228 as inputs }; + export namespace outputs_228 { + let out_217: string; + export { out_217 as out }; + } + export { outputs_228 as outputs }; + } + namespace ND_position_vector3 { + let node_229: string; + export { node_229 as node }; + let inherit_229: null; + export { inherit_229 as inherit }; + export namespace inputs_229 { + let space_1: string; + export { space_1 as space }; + } + export { inputs_229 as inputs }; + export namespace outputs_229 { + let out_218: string; + export { out_218 as out }; + } + export { outputs_229 as outputs }; + } + namespace ND_normal_vector3 { + let node_230: string; + export { node_230 as node }; + let inherit_230: null; + export { inherit_230 as inherit }; + export namespace inputs_230 { + let space_2: string; + export { space_2 as space }; + } + export { inputs_230 as inputs }; + export namespace outputs_230 { + let out_219: string; + export { out_219 as out }; + } + export { outputs_230 as outputs }; + } + namespace ND_tangent_vector3 { + let node_231: string; + export { node_231 as node }; + let inherit_231: null; + export { inherit_231 as inherit }; + export namespace inputs_231 { + let space_3: string; + export { space_3 as space }; + export let index: string; + } + export { inputs_231 as inputs }; + export namespace outputs_231 { + let out_220: string; + export { out_220 as out }; + } + export { outputs_231 as outputs }; + } + namespace ND_bitangent_vector3 { + let node_232: string; + export { node_232 as node }; + let inherit_232: null; + export { inherit_232 as inherit }; + export namespace inputs_232 { + let space_4: string; + export { space_4 as space }; + let index_1: string; + export { index_1 as index }; + } + export { inputs_232 as inputs }; + export namespace outputs_232 { + let out_221: string; + export { out_221 as out }; + } + export { outputs_232 as outputs }; + } + namespace ND_texcoord_vector2 { + let node_233: string; + export { node_233 as node }; + let inherit_233: null; + export { inherit_233 as inherit }; + export namespace inputs_233 { + let index_2: string; + export { index_2 as index }; + } + export { inputs_233 as inputs }; + export namespace outputs_233 { + let out_222: string; + export { out_222 as out }; + } + export { outputs_233 as outputs }; + } + namespace ND_texcoord_vector3 { + let node_234: string; + export { node_234 as node }; + let inherit_234: null; + export { inherit_234 as inherit }; + export namespace inputs_234 { + let index_3: string; + export { index_3 as index }; + } + export { inputs_234 as inputs }; + export namespace outputs_234 { + let out_223: string; + export { out_223 as out }; + } + export { outputs_234 as outputs }; + } + namespace ND_geomcolor_float { + let node_235: string; + export { node_235 as node }; + let inherit_235: null; + export { inherit_235 as inherit }; + export namespace inputs_235 { + let index_4: string; + export { index_4 as index }; + } + export { inputs_235 as inputs }; + export namespace outputs_235 { + let out_224: string; + export { out_224 as out }; + } + export { outputs_235 as outputs }; + } + namespace ND_geomcolor_color3 { + let node_236: string; + export { node_236 as node }; + let inherit_236: null; + export { inherit_236 as inherit }; + export namespace inputs_236 { + let index_5: string; + export { index_5 as index }; + } + export { inputs_236 as inputs }; + export namespace outputs_236 { + let out_225: string; + export { out_225 as out }; + } + export { outputs_236 as outputs }; + } + namespace ND_geomcolor_color4 { + let node_237: string; + export { node_237 as node }; + let inherit_237: null; + export { inherit_237 as inherit }; + export namespace inputs_237 { + let index_6: string; + export { index_6 as index }; + } + export { inputs_237 as inputs }; + export namespace outputs_237 { + let out_226: string; + export { out_226 as out }; + } + export { outputs_237 as outputs }; + } + namespace ND_geompropvalue_integer { + let node_238: string; + export { node_238 as node }; + let inherit_238: null; + export { inherit_238 as inherit }; + export namespace inputs_238 { + export let geomprop: string; + let _default_29: string; + export { _default_29 as default }; + } + export { inputs_238 as inputs }; + export namespace outputs_238 { + let out_227: string; + export { out_227 as out }; + } + export { outputs_238 as outputs }; + } + namespace ND_geompropvalue_boolean { + let node_239: string; + export { node_239 as node }; + let inherit_239: null; + export { inherit_239 as inherit }; + export namespace inputs_239 { + let geomprop_1: string; + export { geomprop_1 as geomprop }; + let _default_30: string; + export { _default_30 as default }; + } + export { inputs_239 as inputs }; + export namespace outputs_239 { + let out_228: string; + export { out_228 as out }; + } + export { outputs_239 as outputs }; + } + namespace ND_geompropvalue_float { + let node_240: string; + export { node_240 as node }; + let inherit_240: null; + export { inherit_240 as inherit }; + export namespace inputs_240 { + let geomprop_2: string; + export { geomprop_2 as geomprop }; + let _default_31: string; + export { _default_31 as default }; + } + export { inputs_240 as inputs }; + export namespace outputs_240 { + let out_229: string; + export { out_229 as out }; + } + export { outputs_240 as outputs }; + } + namespace ND_geompropvalue_color3 { + let node_241: string; + export { node_241 as node }; + let inherit_241: null; + export { inherit_241 as inherit }; + export namespace inputs_241 { + let geomprop_3: string; + export { geomprop_3 as geomprop }; + let _default_32: string; + export { _default_32 as default }; + } + export { inputs_241 as inputs }; + export namespace outputs_241 { + let out_230: string; + export { out_230 as out }; + } + export { outputs_241 as outputs }; + } + namespace ND_geompropvalue_color4 { + let node_242: string; + export { node_242 as node }; + let inherit_242: null; + export { inherit_242 as inherit }; + export namespace inputs_242 { + let geomprop_4: string; + export { geomprop_4 as geomprop }; + let _default_33: string; + export { _default_33 as default }; + } + export { inputs_242 as inputs }; + export namespace outputs_242 { + let out_231: string; + export { out_231 as out }; + } + export { outputs_242 as outputs }; + } + namespace ND_geompropvalue_vector2 { + let node_243: string; + export { node_243 as node }; + let inherit_243: null; + export { inherit_243 as inherit }; + export namespace inputs_243 { + let geomprop_5: string; + export { geomprop_5 as geomprop }; + let _default_34: string; + export { _default_34 as default }; + } + export { inputs_243 as inputs }; + export namespace outputs_243 { + let out_232: string; + export { out_232 as out }; + } + export { outputs_243 as outputs }; + } + namespace ND_geompropvalue_vector3 { + let node_244: string; + export { node_244 as node }; + let inherit_244: null; + export { inherit_244 as inherit }; + export namespace inputs_244 { + let geomprop_6: string; + export { geomprop_6 as geomprop }; + let _default_35: string; + export { _default_35 as default }; + } + export { inputs_244 as inputs }; + export namespace outputs_244 { + let out_233: string; + export { out_233 as out }; + } + export { outputs_244 as outputs }; + } + namespace ND_geompropvalue_vector4 { + let node_245: string; + export { node_245 as node }; + let inherit_245: null; + export { inherit_245 as inherit }; + export namespace inputs_245 { + let geomprop_7: string; + export { geomprop_7 as geomprop }; + let _default_36: string; + export { _default_36 as default }; + } + export { inputs_245 as inputs }; + export namespace outputs_245 { + let out_234: string; + export { out_234 as out }; + } + export { outputs_245 as outputs }; + } + namespace ND_geompropvalueuniform_string { + let node_246: string; + export { node_246 as node }; + let inherit_246: null; + export { inherit_246 as inherit }; + export namespace inputs_246 { + let geomprop_8: string; + export { geomprop_8 as geomprop }; + let _default_37: string; + export { _default_37 as default }; + } + export { inputs_246 as inputs }; + export namespace outputs_246 { + let out_235: string; + export { out_235 as out }; + } + export { outputs_246 as outputs }; + } + namespace ND_geompropvalueuniform_filename { + let node_247: string; + export { node_247 as node }; + let inherit_247: null; + export { inherit_247 as inherit }; + export namespace inputs_247 { + let geomprop_9: string; + export { geomprop_9 as geomprop }; + let _default_38: string; + export { _default_38 as default }; + } + export { inputs_247 as inputs }; + export namespace outputs_247 { + let out_236: string; + export { out_236 as out }; + } + export { outputs_247 as outputs }; + } + namespace ND_bump_vector3 { + let node_248: string; + export { node_248 as node }; + let inherit_248: null; + export { inherit_248 as inherit }; + export namespace inputs_248 { + export let height: string; + let scale_14: string; + export { scale_14 as scale }; + let normal_23: string; + export { normal_23 as normal }; + let tangent_7: string; + export { tangent_7 as tangent }; + let bitangent_2: string; + export { bitangent_2 as bitangent }; + } + export { inputs_248 as inputs }; + export namespace outputs_248 { + let out_237: string; + export { out_237 as out }; + } + export { outputs_248 as outputs }; + } + namespace ND_frame_float { + let node_249: string; + export { node_249 as node }; + let inherit_249: null; + export { inherit_249 as inherit }; + let inputs_249: {}; + export { inputs_249 as inputs }; + export namespace outputs_249 { + let out_238: string; + export { out_238 as out }; + } + export { outputs_249 as outputs }; + } + namespace ND_time_float { + let node_250: string; + export { node_250 as node }; + let inherit_250: null; + export { inherit_250 as inherit }; + export namespace inputs_250 { + let fps: string; + } + export { inputs_250 as inputs }; + export namespace outputs_250 { + let out_239: string; + export { out_239 as out }; + } + export { outputs_250 as outputs }; + } + namespace ND_add_float { + let node_251: string; + export { node_251 as node }; + let inherit_251: null; + export { inherit_251 as inherit }; + export namespace inputs_251 { + let in1_9: string; + export { in1_9 as in1 }; + let in2_9: string; + export { in2_9 as in2 }; + } + export { inputs_251 as inputs }; + export namespace outputs_251 { + let out_240: string; + export { out_240 as out }; + } + export { outputs_251 as outputs }; + } + namespace ND_add_integer { + let node_252: string; + export { node_252 as node }; + let inherit_252: null; + export { inherit_252 as inherit }; + export namespace inputs_252 { + let in1_10: string; + export { in1_10 as in1 }; + let in2_10: string; + export { in2_10 as in2 }; + } + export { inputs_252 as inputs }; + export namespace outputs_252 { + let out_241: string; + export { out_241 as out }; + } + export { outputs_252 as outputs }; + } + namespace ND_add_color3 { + let node_253: string; + export { node_253 as node }; + let inherit_253: null; + export { inherit_253 as inherit }; + export namespace inputs_253 { + let in1_11: string; + export { in1_11 as in1 }; + let in2_11: string; + export { in2_11 as in2 }; + } + export { inputs_253 as inputs }; + export namespace outputs_253 { + let out_242: string; + export { out_242 as out }; + } + export { outputs_253 as outputs }; + } + namespace ND_add_color4 { + let node_254: string; + export { node_254 as node }; + let inherit_254: null; + export { inherit_254 as inherit }; + export namespace inputs_254 { + let in1_12: string; + export { in1_12 as in1 }; + let in2_12: string; + export { in2_12 as in2 }; + } + export { inputs_254 as inputs }; + export namespace outputs_254 { + let out_243: string; + export { out_243 as out }; + } + export { outputs_254 as outputs }; + } + namespace ND_add_vector2 { + let node_255: string; + export { node_255 as node }; + let inherit_255: null; + export { inherit_255 as inherit }; + export namespace inputs_255 { + let in1_13: string; + export { in1_13 as in1 }; + let in2_13: string; + export { in2_13 as in2 }; + } + export { inputs_255 as inputs }; + export namespace outputs_255 { + let out_244: string; + export { out_244 as out }; + } + export { outputs_255 as outputs }; + } + namespace ND_add_vector3 { + let node_256: string; + export { node_256 as node }; + let inherit_256: null; + export { inherit_256 as inherit }; + export namespace inputs_256 { + let in1_14: string; + export { in1_14 as in1 }; + let in2_14: string; + export { in2_14 as in2 }; + } + export { inputs_256 as inputs }; + export namespace outputs_256 { + let out_245: string; + export { out_245 as out }; + } + export { outputs_256 as outputs }; + } + namespace ND_add_vector4 { + let node_257: string; + export { node_257 as node }; + let inherit_257: null; + export { inherit_257 as inherit }; + export namespace inputs_257 { + let in1_15: string; + export { in1_15 as in1 }; + let in2_15: string; + export { in2_15 as in2 }; + } + export { inputs_257 as inputs }; + export namespace outputs_257 { + let out_246: string; + export { out_246 as out }; + } + export { outputs_257 as outputs }; + } + namespace ND_add_matrix33 { + let node_258: string; + export { node_258 as node }; + let inherit_258: null; + export { inherit_258 as inherit }; + export namespace inputs_258 { + let in1_16: string; + export { in1_16 as in1 }; + let in2_16: string; + export { in2_16 as in2 }; + } + export { inputs_258 as inputs }; + export namespace outputs_258 { + let out_247: string; + export { out_247 as out }; + } + export { outputs_258 as outputs }; + } + namespace ND_add_matrix44 { + let node_259: string; + export { node_259 as node }; + let inherit_259: null; + export { inherit_259 as inherit }; + export namespace inputs_259 { + let in1_17: string; + export { in1_17 as in1 }; + let in2_17: string; + export { in2_17 as in2 }; + } + export { inputs_259 as inputs }; + export namespace outputs_259 { + let out_248: string; + export { out_248 as out }; + } + export { outputs_259 as outputs }; + } + namespace ND_add_color3FA { + let node_260: string; + export { node_260 as node }; + let inherit_260: null; + export { inherit_260 as inherit }; + export namespace inputs_260 { + let in1_18: string; + export { in1_18 as in1 }; + let in2_18: string; + export { in2_18 as in2 }; + } + export { inputs_260 as inputs }; + export namespace outputs_260 { + let out_249: string; + export { out_249 as out }; + } + export { outputs_260 as outputs }; + } + namespace ND_add_color4FA { + let node_261: string; + export { node_261 as node }; + let inherit_261: null; + export { inherit_261 as inherit }; + export namespace inputs_261 { + let in1_19: string; + export { in1_19 as in1 }; + let in2_19: string; + export { in2_19 as in2 }; + } + export { inputs_261 as inputs }; + export namespace outputs_261 { + let out_250: string; + export { out_250 as out }; + } + export { outputs_261 as outputs }; + } + namespace ND_add_vector2FA { + let node_262: string; + export { node_262 as node }; + let inherit_262: null; + export { inherit_262 as inherit }; + export namespace inputs_262 { + let in1_20: string; + export { in1_20 as in1 }; + let in2_20: string; + export { in2_20 as in2 }; + } + export { inputs_262 as inputs }; + export namespace outputs_262 { + let out_251: string; + export { out_251 as out }; + } + export { outputs_262 as outputs }; + } + namespace ND_add_vector3FA { + let node_263: string; + export { node_263 as node }; + let inherit_263: null; + export { inherit_263 as inherit }; + export namespace inputs_263 { + let in1_21: string; + export { in1_21 as in1 }; + let in2_21: string; + export { in2_21 as in2 }; + } + export { inputs_263 as inputs }; + export namespace outputs_263 { + let out_252: string; + export { out_252 as out }; + } + export { outputs_263 as outputs }; + } + namespace ND_add_vector4FA { + let node_264: string; + export { node_264 as node }; + let inherit_264: null; + export { inherit_264 as inherit }; + export namespace inputs_264 { + let in1_22: string; + export { in1_22 as in1 }; + let in2_22: string; + export { in2_22 as in2 }; + } + export { inputs_264 as inputs }; + export namespace outputs_264 { + let out_253: string; + export { out_253 as out }; + } + export { outputs_264 as outputs }; + } + namespace ND_add_matrix33FA { + let node_265: string; + export { node_265 as node }; + let inherit_265: null; + export { inherit_265 as inherit }; + export namespace inputs_265 { + let in1_23: string; + export { in1_23 as in1 }; + let in2_23: string; + export { in2_23 as in2 }; + } + export { inputs_265 as inputs }; + export namespace outputs_265 { + let out_254: string; + export { out_254 as out }; + } + export { outputs_265 as outputs }; + } + namespace ND_add_matrix44FA { + let node_266: string; + export { node_266 as node }; + let inherit_266: null; + export { inherit_266 as inherit }; + export namespace inputs_266 { + let in1_24: string; + export { in1_24 as in1 }; + let in2_24: string; + export { in2_24 as in2 }; + } + export { inputs_266 as inputs }; + export namespace outputs_266 { + let out_255: string; + export { out_255 as out }; + } + export { outputs_266 as outputs }; + } + namespace ND_subtract_float { + let node_267: string; + export { node_267 as node }; + let inherit_267: null; + export { inherit_267 as inherit }; + export namespace inputs_267 { + let in1_25: string; + export { in1_25 as in1 }; + let in2_25: string; + export { in2_25 as in2 }; + } + export { inputs_267 as inputs }; + export namespace outputs_267 { + let out_256: string; + export { out_256 as out }; + } + export { outputs_267 as outputs }; + } + namespace ND_subtract_integer { + let node_268: string; + export { node_268 as node }; + let inherit_268: null; + export { inherit_268 as inherit }; + export namespace inputs_268 { + let in1_26: string; + export { in1_26 as in1 }; + let in2_26: string; + export { in2_26 as in2 }; + } + export { inputs_268 as inputs }; + export namespace outputs_268 { + let out_257: string; + export { out_257 as out }; + } + export { outputs_268 as outputs }; + } + namespace ND_subtract_color3 { + let node_269: string; + export { node_269 as node }; + let inherit_269: null; + export { inherit_269 as inherit }; + export namespace inputs_269 { + let in1_27: string; + export { in1_27 as in1 }; + let in2_27: string; + export { in2_27 as in2 }; + } + export { inputs_269 as inputs }; + export namespace outputs_269 { + let out_258: string; + export { out_258 as out }; + } + export { outputs_269 as outputs }; + } + namespace ND_subtract_color4 { + let node_270: string; + export { node_270 as node }; + let inherit_270: null; + export { inherit_270 as inherit }; + export namespace inputs_270 { + let in1_28: string; + export { in1_28 as in1 }; + let in2_28: string; + export { in2_28 as in2 }; + } + export { inputs_270 as inputs }; + export namespace outputs_270 { + let out_259: string; + export { out_259 as out }; + } + export { outputs_270 as outputs }; + } + namespace ND_subtract_vector2 { + let node_271: string; + export { node_271 as node }; + let inherit_271: null; + export { inherit_271 as inherit }; + export namespace inputs_271 { + let in1_29: string; + export { in1_29 as in1 }; + let in2_29: string; + export { in2_29 as in2 }; + } + export { inputs_271 as inputs }; + export namespace outputs_271 { + let out_260: string; + export { out_260 as out }; + } + export { outputs_271 as outputs }; + } + namespace ND_subtract_vector3 { + let node_272: string; + export { node_272 as node }; + let inherit_272: null; + export { inherit_272 as inherit }; + export namespace inputs_272 { + let in1_30: string; + export { in1_30 as in1 }; + let in2_30: string; + export { in2_30 as in2 }; + } + export { inputs_272 as inputs }; + export namespace outputs_272 { + let out_261: string; + export { out_261 as out }; + } + export { outputs_272 as outputs }; + } + namespace ND_subtract_vector4 { + let node_273: string; + export { node_273 as node }; + let inherit_273: null; + export { inherit_273 as inherit }; + export namespace inputs_273 { + let in1_31: string; + export { in1_31 as in1 }; + let in2_31: string; + export { in2_31 as in2 }; + } + export { inputs_273 as inputs }; + export namespace outputs_273 { + let out_262: string; + export { out_262 as out }; + } + export { outputs_273 as outputs }; + } + namespace ND_subtract_matrix33 { + let node_274: string; + export { node_274 as node }; + let inherit_274: null; + export { inherit_274 as inherit }; + export namespace inputs_274 { + let in1_32: string; + export { in1_32 as in1 }; + let in2_32: string; + export { in2_32 as in2 }; + } + export { inputs_274 as inputs }; + export namespace outputs_274 { + let out_263: string; + export { out_263 as out }; + } + export { outputs_274 as outputs }; + } + namespace ND_subtract_matrix44 { + let node_275: string; + export { node_275 as node }; + let inherit_275: null; + export { inherit_275 as inherit }; + export namespace inputs_275 { + let in1_33: string; + export { in1_33 as in1 }; + let in2_33: string; + export { in2_33 as in2 }; + } + export { inputs_275 as inputs }; + export namespace outputs_275 { + let out_264: string; + export { out_264 as out }; + } + export { outputs_275 as outputs }; + } + namespace ND_subtract_color3FA { + let node_276: string; + export { node_276 as node }; + let inherit_276: null; + export { inherit_276 as inherit }; + export namespace inputs_276 { + let in1_34: string; + export { in1_34 as in1 }; + let in2_34: string; + export { in2_34 as in2 }; + } + export { inputs_276 as inputs }; + export namespace outputs_276 { + let out_265: string; + export { out_265 as out }; + } + export { outputs_276 as outputs }; + } + namespace ND_subtract_color4FA { + let node_277: string; + export { node_277 as node }; + let inherit_277: null; + export { inherit_277 as inherit }; + export namespace inputs_277 { + let in1_35: string; + export { in1_35 as in1 }; + let in2_35: string; + export { in2_35 as in2 }; + } + export { inputs_277 as inputs }; + export namespace outputs_277 { + let out_266: string; + export { out_266 as out }; + } + export { outputs_277 as outputs }; + } + namespace ND_subtract_vector2FA { + let node_278: string; + export { node_278 as node }; + let inherit_278: null; + export { inherit_278 as inherit }; + export namespace inputs_278 { + let in1_36: string; + export { in1_36 as in1 }; + let in2_36: string; + export { in2_36 as in2 }; + } + export { inputs_278 as inputs }; + export namespace outputs_278 { + let out_267: string; + export { out_267 as out }; + } + export { outputs_278 as outputs }; + } + namespace ND_subtract_vector3FA { + let node_279: string; + export { node_279 as node }; + let inherit_279: null; + export { inherit_279 as inherit }; + export namespace inputs_279 { + let in1_37: string; + export { in1_37 as in1 }; + let in2_37: string; + export { in2_37 as in2 }; + } + export { inputs_279 as inputs }; + export namespace outputs_279 { + let out_268: string; + export { out_268 as out }; + } + export { outputs_279 as outputs }; + } + namespace ND_subtract_vector4FA { + let node_280: string; + export { node_280 as node }; + let inherit_280: null; + export { inherit_280 as inherit }; + export namespace inputs_280 { + let in1_38: string; + export { in1_38 as in1 }; + let in2_38: string; + export { in2_38 as in2 }; + } + export { inputs_280 as inputs }; + export namespace outputs_280 { + let out_269: string; + export { out_269 as out }; + } + export { outputs_280 as outputs }; + } + namespace ND_subtract_matrix33FA { + let node_281: string; + export { node_281 as node }; + let inherit_281: null; + export { inherit_281 as inherit }; + export namespace inputs_281 { + let in1_39: string; + export { in1_39 as in1 }; + let in2_39: string; + export { in2_39 as in2 }; + } + export { inputs_281 as inputs }; + export namespace outputs_281 { + let out_270: string; + export { out_270 as out }; + } + export { outputs_281 as outputs }; + } + namespace ND_subtract_matrix44FA { + let node_282: string; + export { node_282 as node }; + let inherit_282: null; + export { inherit_282 as inherit }; + export namespace inputs_282 { + let in1_40: string; + export { in1_40 as in1 }; + let in2_40: string; + export { in2_40 as in2 }; + } + export { inputs_282 as inputs }; + export namespace outputs_282 { + let out_271: string; + export { out_271 as out }; + } + export { outputs_282 as outputs }; + } + namespace ND_multiply_float { + let node_283: string; + export { node_283 as node }; + let inherit_283: null; + export { inherit_283 as inherit }; + export namespace inputs_283 { + let in1_41: string; + export { in1_41 as in1 }; + let in2_41: string; + export { in2_41 as in2 }; + } + export { inputs_283 as inputs }; + export namespace outputs_283 { + let out_272: string; + export { out_272 as out }; + } + export { outputs_283 as outputs }; + } + namespace ND_multiply_color3 { + let node_284: string; + export { node_284 as node }; + let inherit_284: null; + export { inherit_284 as inherit }; + export namespace inputs_284 { + let in1_42: string; + export { in1_42 as in1 }; + let in2_42: string; + export { in2_42 as in2 }; + } + export { inputs_284 as inputs }; + export namespace outputs_284 { + let out_273: string; + export { out_273 as out }; + } + export { outputs_284 as outputs }; + } + namespace ND_multiply_color4 { + let node_285: string; + export { node_285 as node }; + let inherit_285: null; + export { inherit_285 as inherit }; + export namespace inputs_285 { + let in1_43: string; + export { in1_43 as in1 }; + let in2_43: string; + export { in2_43 as in2 }; + } + export { inputs_285 as inputs }; + export namespace outputs_285 { + let out_274: string; + export { out_274 as out }; + } + export { outputs_285 as outputs }; + } + namespace ND_multiply_vector2 { + let node_286: string; + export { node_286 as node }; + let inherit_286: null; + export { inherit_286 as inherit }; + export namespace inputs_286 { + let in1_44: string; + export { in1_44 as in1 }; + let in2_44: string; + export { in2_44 as in2 }; + } + export { inputs_286 as inputs }; + export namespace outputs_286 { + let out_275: string; + export { out_275 as out }; + } + export { outputs_286 as outputs }; + } + namespace ND_multiply_vector3 { + let node_287: string; + export { node_287 as node }; + let inherit_287: null; + export { inherit_287 as inherit }; + export namespace inputs_287 { + let in1_45: string; + export { in1_45 as in1 }; + let in2_45: string; + export { in2_45 as in2 }; + } + export { inputs_287 as inputs }; + export namespace outputs_287 { + let out_276: string; + export { out_276 as out }; + } + export { outputs_287 as outputs }; + } + namespace ND_multiply_vector4 { + let node_288: string; + export { node_288 as node }; + let inherit_288: null; + export { inherit_288 as inherit }; + export namespace inputs_288 { + let in1_46: string; + export { in1_46 as in1 }; + let in2_46: string; + export { in2_46 as in2 }; + } + export { inputs_288 as inputs }; + export namespace outputs_288 { + let out_277: string; + export { out_277 as out }; + } + export { outputs_288 as outputs }; + } + namespace ND_multiply_matrix33 { + let node_289: string; + export { node_289 as node }; + let inherit_289: null; + export { inherit_289 as inherit }; + export namespace inputs_289 { + let in1_47: string; + export { in1_47 as in1 }; + let in2_47: string; + export { in2_47 as in2 }; + } + export { inputs_289 as inputs }; + export namespace outputs_289 { + let out_278: string; + export { out_278 as out }; + } + export { outputs_289 as outputs }; + } + namespace ND_multiply_matrix44 { + let node_290: string; + export { node_290 as node }; + let inherit_290: null; + export { inherit_290 as inherit }; + export namespace inputs_290 { + let in1_48: string; + export { in1_48 as in1 }; + let in2_48: string; + export { in2_48 as in2 }; + } + export { inputs_290 as inputs }; + export namespace outputs_290 { + let out_279: string; + export { out_279 as out }; + } + export { outputs_290 as outputs }; + } + namespace ND_multiply_color3FA { + let node_291: string; + export { node_291 as node }; + let inherit_291: null; + export { inherit_291 as inherit }; + export namespace inputs_291 { + let in1_49: string; + export { in1_49 as in1 }; + let in2_49: string; + export { in2_49 as in2 }; + } + export { inputs_291 as inputs }; + export namespace outputs_291 { + let out_280: string; + export { out_280 as out }; + } + export { outputs_291 as outputs }; + } + namespace ND_multiply_color4FA { + let node_292: string; + export { node_292 as node }; + let inherit_292: null; + export { inherit_292 as inherit }; + export namespace inputs_292 { + let in1_50: string; + export { in1_50 as in1 }; + let in2_50: string; + export { in2_50 as in2 }; + } + export { inputs_292 as inputs }; + export namespace outputs_292 { + let out_281: string; + export { out_281 as out }; + } + export { outputs_292 as outputs }; + } + namespace ND_multiply_vector2FA { + let node_293: string; + export { node_293 as node }; + let inherit_293: null; + export { inherit_293 as inherit }; + export namespace inputs_293 { + let in1_51: string; + export { in1_51 as in1 }; + let in2_51: string; + export { in2_51 as in2 }; + } + export { inputs_293 as inputs }; + export namespace outputs_293 { + let out_282: string; + export { out_282 as out }; + } + export { outputs_293 as outputs }; + } + namespace ND_multiply_vector3FA { + let node_294: string; + export { node_294 as node }; + let inherit_294: null; + export { inherit_294 as inherit }; + export namespace inputs_294 { + let in1_52: string; + export { in1_52 as in1 }; + let in2_52: string; + export { in2_52 as in2 }; + } + export { inputs_294 as inputs }; + export namespace outputs_294 { + let out_283: string; + export { out_283 as out }; + } + export { outputs_294 as outputs }; + } + namespace ND_multiply_vector4FA { + let node_295: string; + export { node_295 as node }; + let inherit_295: null; + export { inherit_295 as inherit }; + export namespace inputs_295 { + let in1_53: string; + export { in1_53 as in1 }; + let in2_53: string; + export { in2_53 as in2 }; + } + export { inputs_295 as inputs }; + export namespace outputs_295 { + let out_284: string; + export { out_284 as out }; + } + export { outputs_295 as outputs }; + } + namespace ND_divide_float { + let node_296: string; + export { node_296 as node }; + let inherit_296: null; + export { inherit_296 as inherit }; + export namespace inputs_296 { + let in1_54: string; + export { in1_54 as in1 }; + let in2_54: string; + export { in2_54 as in2 }; + } + export { inputs_296 as inputs }; + export namespace outputs_296 { + let out_285: string; + export { out_285 as out }; + } + export { outputs_296 as outputs }; + } + namespace ND_divide_color3 { + let node_297: string; + export { node_297 as node }; + let inherit_297: null; + export { inherit_297 as inherit }; + export namespace inputs_297 { + let in1_55: string; + export { in1_55 as in1 }; + let in2_55: string; + export { in2_55 as in2 }; + } + export { inputs_297 as inputs }; + export namespace outputs_297 { + let out_286: string; + export { out_286 as out }; + } + export { outputs_297 as outputs }; + } + namespace ND_divide_color4 { + let node_298: string; + export { node_298 as node }; + let inherit_298: null; + export { inherit_298 as inherit }; + export namespace inputs_298 { + let in1_56: string; + export { in1_56 as in1 }; + let in2_56: string; + export { in2_56 as in2 }; + } + export { inputs_298 as inputs }; + export namespace outputs_298 { + let out_287: string; + export { out_287 as out }; + } + export { outputs_298 as outputs }; + } + namespace ND_divide_vector2 { + let node_299: string; + export { node_299 as node }; + let inherit_299: null; + export { inherit_299 as inherit }; + export namespace inputs_299 { + let in1_57: string; + export { in1_57 as in1 }; + let in2_57: string; + export { in2_57 as in2 }; + } + export { inputs_299 as inputs }; + export namespace outputs_299 { + let out_288: string; + export { out_288 as out }; + } + export { outputs_299 as outputs }; + } + namespace ND_divide_vector3 { + let node_300: string; + export { node_300 as node }; + let inherit_300: null; + export { inherit_300 as inherit }; + export namespace inputs_300 { + let in1_58: string; + export { in1_58 as in1 }; + let in2_58: string; + export { in2_58 as in2 }; + } + export { inputs_300 as inputs }; + export namespace outputs_300 { + let out_289: string; + export { out_289 as out }; + } + export { outputs_300 as outputs }; + } + namespace ND_divide_vector4 { + let node_301: string; + export { node_301 as node }; + let inherit_301: null; + export { inherit_301 as inherit }; + export namespace inputs_301 { + let in1_59: string; + export { in1_59 as in1 }; + let in2_59: string; + export { in2_59 as in2 }; + } + export { inputs_301 as inputs }; + export namespace outputs_301 { + let out_290: string; + export { out_290 as out }; + } + export { outputs_301 as outputs }; + } + namespace ND_divide_matrix33 { + let node_302: string; + export { node_302 as node }; + let inherit_302: null; + export { inherit_302 as inherit }; + export namespace inputs_302 { + let in1_60: string; + export { in1_60 as in1 }; + let in2_60: string; + export { in2_60 as in2 }; + } + export { inputs_302 as inputs }; + export namespace outputs_302 { + let out_291: string; + export { out_291 as out }; + } + export { outputs_302 as outputs }; + } + namespace ND_divide_matrix44 { + let node_303: string; + export { node_303 as node }; + let inherit_303: null; + export { inherit_303 as inherit }; + export namespace inputs_303 { + let in1_61: string; + export { in1_61 as in1 }; + let in2_61: string; + export { in2_61 as in2 }; + } + export { inputs_303 as inputs }; + export namespace outputs_303 { + let out_292: string; + export { out_292 as out }; + } + export { outputs_303 as outputs }; + } + namespace ND_divide_color3FA { + let node_304: string; + export { node_304 as node }; + let inherit_304: null; + export { inherit_304 as inherit }; + export namespace inputs_304 { + let in1_62: string; + export { in1_62 as in1 }; + let in2_62: string; + export { in2_62 as in2 }; + } + export { inputs_304 as inputs }; + export namespace outputs_304 { + let out_293: string; + export { out_293 as out }; + } + export { outputs_304 as outputs }; + } + namespace ND_divide_color4FA { + let node_305: string; + export { node_305 as node }; + let inherit_305: null; + export { inherit_305 as inherit }; + export namespace inputs_305 { + let in1_63: string; + export { in1_63 as in1 }; + let in2_63: string; + export { in2_63 as in2 }; + } + export { inputs_305 as inputs }; + export namespace outputs_305 { + let out_294: string; + export { out_294 as out }; + } + export { outputs_305 as outputs }; + } + namespace ND_divide_vector2FA { + let node_306: string; + export { node_306 as node }; + let inherit_306: null; + export { inherit_306 as inherit }; + export namespace inputs_306 { + let in1_64: string; + export { in1_64 as in1 }; + let in2_64: string; + export { in2_64 as in2 }; + } + export { inputs_306 as inputs }; + export namespace outputs_306 { + let out_295: string; + export { out_295 as out }; + } + export { outputs_306 as outputs }; + } + namespace ND_divide_vector3FA { + let node_307: string; + export { node_307 as node }; + let inherit_307: null; + export { inherit_307 as inherit }; + export namespace inputs_307 { + let in1_65: string; + export { in1_65 as in1 }; + let in2_65: string; + export { in2_65 as in2 }; + } + export { inputs_307 as inputs }; + export namespace outputs_307 { + let out_296: string; + export { out_296 as out }; + } + export { outputs_307 as outputs }; + } + namespace ND_divide_vector4FA { + let node_308: string; + export { node_308 as node }; + let inherit_308: null; + export { inherit_308 as inherit }; + export namespace inputs_308 { + let in1_66: string; + export { in1_66 as in1 }; + let in2_66: string; + export { in2_66 as in2 }; + } + export { inputs_308 as inputs }; + export namespace outputs_308 { + let out_297: string; + export { out_297 as out }; + } + export { outputs_308 as outputs }; + } + namespace ND_modulo_float { + let node_309: string; + export { node_309 as node }; + let inherit_309: null; + export { inherit_309 as inherit }; + export namespace inputs_309 { + let in1_67: string; + export { in1_67 as in1 }; + let in2_67: string; + export { in2_67 as in2 }; + } + export { inputs_309 as inputs }; + export namespace outputs_309 { + let out_298: string; + export { out_298 as out }; + } + export { outputs_309 as outputs }; + } + namespace ND_modulo_color3 { + let node_310: string; + export { node_310 as node }; + let inherit_310: null; + export { inherit_310 as inherit }; + export namespace inputs_310 { + let in1_68: string; + export { in1_68 as in1 }; + let in2_68: string; + export { in2_68 as in2 }; + } + export { inputs_310 as inputs }; + export namespace outputs_310 { + let out_299: string; + export { out_299 as out }; + } + export { outputs_310 as outputs }; + } + namespace ND_modulo_color4 { + let node_311: string; + export { node_311 as node }; + let inherit_311: null; + export { inherit_311 as inherit }; + export namespace inputs_311 { + let in1_69: string; + export { in1_69 as in1 }; + let in2_69: string; + export { in2_69 as in2 }; + } + export { inputs_311 as inputs }; + export namespace outputs_311 { + let out_300: string; + export { out_300 as out }; + } + export { outputs_311 as outputs }; + } + namespace ND_modulo_vector2 { + let node_312: string; + export { node_312 as node }; + let inherit_312: null; + export { inherit_312 as inherit }; + export namespace inputs_312 { + let in1_70: string; + export { in1_70 as in1 }; + let in2_70: string; + export { in2_70 as in2 }; + } + export { inputs_312 as inputs }; + export namespace outputs_312 { + let out_301: string; + export { out_301 as out }; + } + export { outputs_312 as outputs }; + } + namespace ND_modulo_vector3 { + let node_313: string; + export { node_313 as node }; + let inherit_313: null; + export { inherit_313 as inherit }; + export namespace inputs_313 { + let in1_71: string; + export { in1_71 as in1 }; + let in2_71: string; + export { in2_71 as in2 }; + } + export { inputs_313 as inputs }; + export namespace outputs_313 { + let out_302: string; + export { out_302 as out }; + } + export { outputs_313 as outputs }; + } + namespace ND_modulo_vector4 { + let node_314: string; + export { node_314 as node }; + let inherit_314: null; + export { inherit_314 as inherit }; + export namespace inputs_314 { + let in1_72: string; + export { in1_72 as in1 }; + let in2_72: string; + export { in2_72 as in2 }; + } + export { inputs_314 as inputs }; + export namespace outputs_314 { + let out_303: string; + export { out_303 as out }; + } + export { outputs_314 as outputs }; + } + namespace ND_modulo_color3FA { + let node_315: string; + export { node_315 as node }; + let inherit_315: null; + export { inherit_315 as inherit }; + export namespace inputs_315 { + let in1_73: string; + export { in1_73 as in1 }; + let in2_73: string; + export { in2_73 as in2 }; + } + export { inputs_315 as inputs }; + export namespace outputs_315 { + let out_304: string; + export { out_304 as out }; + } + export { outputs_315 as outputs }; + } + namespace ND_modulo_color4FA { + let node_316: string; + export { node_316 as node }; + let inherit_316: null; + export { inherit_316 as inherit }; + export namespace inputs_316 { + let in1_74: string; + export { in1_74 as in1 }; + let in2_74: string; + export { in2_74 as in2 }; + } + export { inputs_316 as inputs }; + export namespace outputs_316 { + let out_305: string; + export { out_305 as out }; + } + export { outputs_316 as outputs }; + } + namespace ND_modulo_vector2FA { + let node_317: string; + export { node_317 as node }; + let inherit_317: null; + export { inherit_317 as inherit }; + export namespace inputs_317 { + let in1_75: string; + export { in1_75 as in1 }; + let in2_75: string; + export { in2_75 as in2 }; + } + export { inputs_317 as inputs }; + export namespace outputs_317 { + let out_306: string; + export { out_306 as out }; + } + export { outputs_317 as outputs }; + } + namespace ND_modulo_vector3FA { + let node_318: string; + export { node_318 as node }; + let inherit_318: null; + export { inherit_318 as inherit }; + export namespace inputs_318 { + let in1_76: string; + export { in1_76 as in1 }; + let in2_76: string; + export { in2_76 as in2 }; + } + export { inputs_318 as inputs }; + export namespace outputs_318 { + let out_307: string; + export { out_307 as out }; + } + export { outputs_318 as outputs }; + } + namespace ND_modulo_vector4FA { + let node_319: string; + export { node_319 as node }; + let inherit_319: null; + export { inherit_319 as inherit }; + export namespace inputs_319 { + let in1_77: string; + export { in1_77 as in1 }; + let in2_77: string; + export { in2_77 as in2 }; + } + export { inputs_319 as inputs }; + export namespace outputs_319 { + let out_308: string; + export { out_308 as out }; + } + export { outputs_319 as outputs }; + } + namespace ND_fract_float { + let node_320: string; + export { node_320 as node }; + let inherit_320: null; + export { inherit_320 as inherit }; + export namespace inputs_320 { + let _in_25: string; + export { _in_25 as in }; + } + export { inputs_320 as inputs }; + export namespace outputs_320 { + let out_309: string; + export { out_309 as out }; + } + export { outputs_320 as outputs }; + } + namespace ND_fract_color3 { + let node_321: string; + export { node_321 as node }; + let inherit_321: null; + export { inherit_321 as inherit }; + export namespace inputs_321 { + let _in_26: string; + export { _in_26 as in }; + } + export { inputs_321 as inputs }; + export namespace outputs_321 { + let out_310: string; + export { out_310 as out }; + } + export { outputs_321 as outputs }; + } + namespace ND_fract_color4 { + let node_322: string; + export { node_322 as node }; + let inherit_322: null; + export { inherit_322 as inherit }; + export namespace inputs_322 { + let _in_27: string; + export { _in_27 as in }; + } + export { inputs_322 as inputs }; + export namespace outputs_322 { + let out_311: string; + export { out_311 as out }; + } + export { outputs_322 as outputs }; + } + namespace ND_fract_vector2 { + let node_323: string; + export { node_323 as node }; + let inherit_323: null; + export { inherit_323 as inherit }; + export namespace inputs_323 { + let _in_28: string; + export { _in_28 as in }; + } + export { inputs_323 as inputs }; + export namespace outputs_323 { + let out_312: string; + export { out_312 as out }; + } + export { outputs_323 as outputs }; + } + namespace ND_fract_vector3 { + let node_324: string; + export { node_324 as node }; + let inherit_324: null; + export { inherit_324 as inherit }; + export namespace inputs_324 { + let _in_29: string; + export { _in_29 as in }; + } + export { inputs_324 as inputs }; + export namespace outputs_324 { + let out_313: string; + export { out_313 as out }; + } + export { outputs_324 as outputs }; + } + namespace ND_fract_vector4 { + let node_325: string; + export { node_325 as node }; + let inherit_325: null; + export { inherit_325 as inherit }; + export namespace inputs_325 { + let _in_30: string; + export { _in_30 as in }; + } + export { inputs_325 as inputs }; + export namespace outputs_325 { + let out_314: string; + export { out_314 as out }; + } + export { outputs_325 as outputs }; + } + namespace ND_invert_float { + let node_326: string; + export { node_326 as node }; + let inherit_326: null; + export { inherit_326 as inherit }; + export namespace inputs_326 { + let _in_31: string; + export { _in_31 as in }; + export let amount: string; + } + export { inputs_326 as inputs }; + export namespace outputs_326 { + let out_315: string; + export { out_315 as out }; + } + export { outputs_326 as outputs }; + } + namespace ND_invert_color3 { + let node_327: string; + export { node_327 as node }; + let inherit_327: null; + export { inherit_327 as inherit }; + export namespace inputs_327 { + let _in_32: string; + export { _in_32 as in }; + let amount_1: string; + export { amount_1 as amount }; + } + export { inputs_327 as inputs }; + export namespace outputs_327 { + let out_316: string; + export { out_316 as out }; + } + export { outputs_327 as outputs }; + } + namespace ND_invert_color4 { + let node_328: string; + export { node_328 as node }; + let inherit_328: null; + export { inherit_328 as inherit }; + export namespace inputs_328 { + let _in_33: string; + export { _in_33 as in }; + let amount_2: string; + export { amount_2 as amount }; + } + export { inputs_328 as inputs }; + export namespace outputs_328 { + let out_317: string; + export { out_317 as out }; + } + export { outputs_328 as outputs }; + } + namespace ND_invert_vector2 { + let node_329: string; + export { node_329 as node }; + let inherit_329: null; + export { inherit_329 as inherit }; + export namespace inputs_329 { + let _in_34: string; + export { _in_34 as in }; + let amount_3: string; + export { amount_3 as amount }; + } + export { inputs_329 as inputs }; + export namespace outputs_329 { + let out_318: string; + export { out_318 as out }; + } + export { outputs_329 as outputs }; + } + namespace ND_invert_vector3 { + let node_330: string; + export { node_330 as node }; + let inherit_330: null; + export { inherit_330 as inherit }; + export namespace inputs_330 { + let _in_35: string; + export { _in_35 as in }; + let amount_4: string; + export { amount_4 as amount }; + } + export { inputs_330 as inputs }; + export namespace outputs_330 { + let out_319: string; + export { out_319 as out }; + } + export { outputs_330 as outputs }; + } + namespace ND_invert_vector4 { + let node_331: string; + export { node_331 as node }; + let inherit_331: null; + export { inherit_331 as inherit }; + export namespace inputs_331 { + let _in_36: string; + export { _in_36 as in }; + let amount_5: string; + export { amount_5 as amount }; + } + export { inputs_331 as inputs }; + export namespace outputs_331 { + let out_320: string; + export { out_320 as out }; + } + export { outputs_331 as outputs }; + } + namespace ND_invert_color3FA { + let node_332: string; + export { node_332 as node }; + let inherit_332: null; + export { inherit_332 as inherit }; + export namespace inputs_332 { + let _in_37: string; + export { _in_37 as in }; + let amount_6: string; + export { amount_6 as amount }; + } + export { inputs_332 as inputs }; + export namespace outputs_332 { + let out_321: string; + export { out_321 as out }; + } + export { outputs_332 as outputs }; + } + namespace ND_invert_color4FA { + let node_333: string; + export { node_333 as node }; + let inherit_333: null; + export { inherit_333 as inherit }; + export namespace inputs_333 { + let _in_38: string; + export { _in_38 as in }; + let amount_7: string; + export { amount_7 as amount }; + } + export { inputs_333 as inputs }; + export namespace outputs_333 { + let out_322: string; + export { out_322 as out }; + } + export { outputs_333 as outputs }; + } + namespace ND_invert_vector2FA { + let node_334: string; + export { node_334 as node }; + let inherit_334: null; + export { inherit_334 as inherit }; + export namespace inputs_334 { + let _in_39: string; + export { _in_39 as in }; + let amount_8: string; + export { amount_8 as amount }; + } + export { inputs_334 as inputs }; + export namespace outputs_334 { + let out_323: string; + export { out_323 as out }; + } + export { outputs_334 as outputs }; + } + namespace ND_invert_vector3FA { + let node_335: string; + export { node_335 as node }; + let inherit_335: null; + export { inherit_335 as inherit }; + export namespace inputs_335 { + let _in_40: string; + export { _in_40 as in }; + let amount_9: string; + export { amount_9 as amount }; + } + export { inputs_335 as inputs }; + export namespace outputs_335 { + let out_324: string; + export { out_324 as out }; + } + export { outputs_335 as outputs }; + } + namespace ND_invert_vector4FA { + let node_336: string; + export { node_336 as node }; + let inherit_336: null; + export { inherit_336 as inherit }; + export namespace inputs_336 { + let _in_41: string; + export { _in_41 as in }; + let amount_10: string; + export { amount_10 as amount }; + } + export { inputs_336 as inputs }; + export namespace outputs_336 { + let out_325: string; + export { out_325 as out }; + } + export { outputs_336 as outputs }; + } + namespace ND_absval_float { + let node_337: string; + export { node_337 as node }; + let inherit_337: null; + export { inherit_337 as inherit }; + export namespace inputs_337 { + let _in_42: string; + export { _in_42 as in }; + } + export { inputs_337 as inputs }; + export namespace outputs_337 { + let out_326: string; + export { out_326 as out }; + } + export { outputs_337 as outputs }; + } + namespace ND_absval_color3 { + let node_338: string; + export { node_338 as node }; + let inherit_338: null; + export { inherit_338 as inherit }; + export namespace inputs_338 { + let _in_43: string; + export { _in_43 as in }; + } + export { inputs_338 as inputs }; + export namespace outputs_338 { + let out_327: string; + export { out_327 as out }; + } + export { outputs_338 as outputs }; + } + namespace ND_absval_color4 { + let node_339: string; + export { node_339 as node }; + let inherit_339: null; + export { inherit_339 as inherit }; + export namespace inputs_339 { + let _in_44: string; + export { _in_44 as in }; + } + export { inputs_339 as inputs }; + export namespace outputs_339 { + let out_328: string; + export { out_328 as out }; + } + export { outputs_339 as outputs }; + } + namespace ND_absval_vector2 { + let node_340: string; + export { node_340 as node }; + let inherit_340: null; + export { inherit_340 as inherit }; + export namespace inputs_340 { + let _in_45: string; + export { _in_45 as in }; + } + export { inputs_340 as inputs }; + export namespace outputs_340 { + let out_329: string; + export { out_329 as out }; + } + export { outputs_340 as outputs }; + } + namespace ND_absval_vector3 { + let node_341: string; + export { node_341 as node }; + let inherit_341: null; + export { inherit_341 as inherit }; + export namespace inputs_341 { + let _in_46: string; + export { _in_46 as in }; + } + export { inputs_341 as inputs }; + export namespace outputs_341 { + let out_330: string; + export { out_330 as out }; + } + export { outputs_341 as outputs }; + } + namespace ND_absval_vector4 { + let node_342: string; + export { node_342 as node }; + let inherit_342: null; + export { inherit_342 as inherit }; + export namespace inputs_342 { + let _in_47: string; + export { _in_47 as in }; + } + export { inputs_342 as inputs }; + export namespace outputs_342 { + let out_331: string; + export { out_331 as out }; + } + export { outputs_342 as outputs }; + } + namespace ND_floor_float { + let node_343: string; + export { node_343 as node }; + let inherit_343: null; + export { inherit_343 as inherit }; + export namespace inputs_343 { + let _in_48: string; + export { _in_48 as in }; + } + export { inputs_343 as inputs }; + export namespace outputs_343 { + let out_332: string; + export { out_332 as out }; + } + export { outputs_343 as outputs }; + } + namespace ND_floor_color3 { + let node_344: string; + export { node_344 as node }; + let inherit_344: null; + export { inherit_344 as inherit }; + export namespace inputs_344 { + let _in_49: string; + export { _in_49 as in }; + } + export { inputs_344 as inputs }; + export namespace outputs_344 { + let out_333: string; + export { out_333 as out }; + } + export { outputs_344 as outputs }; + } + namespace ND_floor_color4 { + let node_345: string; + export { node_345 as node }; + let inherit_345: null; + export { inherit_345 as inherit }; + export namespace inputs_345 { + let _in_50: string; + export { _in_50 as in }; + } + export { inputs_345 as inputs }; + export namespace outputs_345 { + let out_334: string; + export { out_334 as out }; + } + export { outputs_345 as outputs }; + } + namespace ND_floor_vector2 { + let node_346: string; + export { node_346 as node }; + let inherit_346: null; + export { inherit_346 as inherit }; + export namespace inputs_346 { + let _in_51: string; + export { _in_51 as in }; + } + export { inputs_346 as inputs }; + export namespace outputs_346 { + let out_335: string; + export { out_335 as out }; + } + export { outputs_346 as outputs }; + } + namespace ND_floor_vector3 { + let node_347: string; + export { node_347 as node }; + let inherit_347: null; + export { inherit_347 as inherit }; + export namespace inputs_347 { + let _in_52: string; + export { _in_52 as in }; + } + export { inputs_347 as inputs }; + export namespace outputs_347 { + let out_336: string; + export { out_336 as out }; + } + export { outputs_347 as outputs }; + } + namespace ND_floor_vector4 { + let node_348: string; + export { node_348 as node }; + let inherit_348: null; + export { inherit_348 as inherit }; + export namespace inputs_348 { + let _in_53: string; + export { _in_53 as in }; + } + export { inputs_348 as inputs }; + export namespace outputs_348 { + let out_337: string; + export { out_337 as out }; + } + export { outputs_348 as outputs }; + } + namespace ND_floor_integer { + let node_349: string; + export { node_349 as node }; + let inherit_349: null; + export { inherit_349 as inherit }; + export namespace inputs_349 { + let _in_54: string; + export { _in_54 as in }; + } + export { inputs_349 as inputs }; + export namespace outputs_349 { + let out_338: string; + export { out_338 as out }; + } + export { outputs_349 as outputs }; + } + namespace ND_ceil_float { + let node_350: string; + export { node_350 as node }; + let inherit_350: null; + export { inherit_350 as inherit }; + export namespace inputs_350 { + let _in_55: string; + export { _in_55 as in }; + } + export { inputs_350 as inputs }; + export namespace outputs_350 { + let out_339: string; + export { out_339 as out }; + } + export { outputs_350 as outputs }; + } + namespace ND_ceil_color3 { + let node_351: string; + export { node_351 as node }; + let inherit_351: null; + export { inherit_351 as inherit }; + export namespace inputs_351 { + let _in_56: string; + export { _in_56 as in }; + } + export { inputs_351 as inputs }; + export namespace outputs_351 { + let out_340: string; + export { out_340 as out }; + } + export { outputs_351 as outputs }; + } + namespace ND_ceil_color4 { + let node_352: string; + export { node_352 as node }; + let inherit_352: null; + export { inherit_352 as inherit }; + export namespace inputs_352 { + let _in_57: string; + export { _in_57 as in }; + } + export { inputs_352 as inputs }; + export namespace outputs_352 { + let out_341: string; + export { out_341 as out }; + } + export { outputs_352 as outputs }; + } + namespace ND_ceil_vector2 { + let node_353: string; + export { node_353 as node }; + let inherit_353: null; + export { inherit_353 as inherit }; + export namespace inputs_353 { + let _in_58: string; + export { _in_58 as in }; + } + export { inputs_353 as inputs }; + export namespace outputs_353 { + let out_342: string; + export { out_342 as out }; + } + export { outputs_353 as outputs }; + } + namespace ND_ceil_vector3 { + let node_354: string; + export { node_354 as node }; + let inherit_354: null; + export { inherit_354 as inherit }; + export namespace inputs_354 { + let _in_59: string; + export { _in_59 as in }; + } + export { inputs_354 as inputs }; + export namespace outputs_354 { + let out_343: string; + export { out_343 as out }; + } + export { outputs_354 as outputs }; + } + namespace ND_ceil_vector4 { + let node_355: string; + export { node_355 as node }; + let inherit_355: null; + export { inherit_355 as inherit }; + export namespace inputs_355 { + let _in_60: string; + export { _in_60 as in }; + } + export { inputs_355 as inputs }; + export namespace outputs_355 { + let out_344: string; + export { out_344 as out }; + } + export { outputs_355 as outputs }; + } + namespace ND_ceil_integer { + let node_356: string; + export { node_356 as node }; + let inherit_356: null; + export { inherit_356 as inherit }; + export namespace inputs_356 { + let _in_61: string; + export { _in_61 as in }; + } + export { inputs_356 as inputs }; + export namespace outputs_356 { + let out_345: string; + export { out_345 as out }; + } + export { outputs_356 as outputs }; + } + namespace ND_round_float { + let node_357: string; + export { node_357 as node }; + let inherit_357: null; + export { inherit_357 as inherit }; + export namespace inputs_357 { + let _in_62: string; + export { _in_62 as in }; + } + export { inputs_357 as inputs }; + export namespace outputs_357 { + let out_346: string; + export { out_346 as out }; + } + export { outputs_357 as outputs }; + } + namespace ND_round_color3 { + let node_358: string; + export { node_358 as node }; + let inherit_358: null; + export { inherit_358 as inherit }; + export namespace inputs_358 { + let _in_63: string; + export { _in_63 as in }; + } + export { inputs_358 as inputs }; + export namespace outputs_358 { + let out_347: string; + export { out_347 as out }; + } + export { outputs_358 as outputs }; + } + namespace ND_round_color4 { + let node_359: string; + export { node_359 as node }; + let inherit_359: null; + export { inherit_359 as inherit }; + export namespace inputs_359 { + let _in_64: string; + export { _in_64 as in }; + } + export { inputs_359 as inputs }; + export namespace outputs_359 { + let out_348: string; + export { out_348 as out }; + } + export { outputs_359 as outputs }; + } + namespace ND_round_vector2 { + let node_360: string; + export { node_360 as node }; + let inherit_360: null; + export { inherit_360 as inherit }; + export namespace inputs_360 { + let _in_65: string; + export { _in_65 as in }; + } + export { inputs_360 as inputs }; + export namespace outputs_360 { + let out_349: string; + export { out_349 as out }; + } + export { outputs_360 as outputs }; + } + namespace ND_round_vector3 { + let node_361: string; + export { node_361 as node }; + let inherit_361: null; + export { inherit_361 as inherit }; + export namespace inputs_361 { + let _in_66: string; + export { _in_66 as in }; + } + export { inputs_361 as inputs }; + export namespace outputs_361 { + let out_350: string; + export { out_350 as out }; + } + export { outputs_361 as outputs }; + } + namespace ND_round_vector4 { + let node_362: string; + export { node_362 as node }; + let inherit_362: null; + export { inherit_362 as inherit }; + export namespace inputs_362 { + let _in_67: string; + export { _in_67 as in }; + } + export { inputs_362 as inputs }; + export namespace outputs_362 { + let out_351: string; + export { out_351 as out }; + } + export { outputs_362 as outputs }; + } + namespace ND_round_integer { + let node_363: string; + export { node_363 as node }; + let inherit_363: null; + export { inherit_363 as inherit }; + export namespace inputs_363 { + let _in_68: string; + export { _in_68 as in }; + } + export { inputs_363 as inputs }; + export namespace outputs_363 { + let out_352: string; + export { out_352 as out }; + } + export { outputs_363 as outputs }; + } + namespace ND_power_float { + let node_364: string; + export { node_364 as node }; + let inherit_364: null; + export { inherit_364 as inherit }; + export namespace inputs_364 { + let in1_78: string; + export { in1_78 as in1 }; + let in2_78: string; + export { in2_78 as in2 }; + } + export { inputs_364 as inputs }; + export namespace outputs_364 { + let out_353: string; + export { out_353 as out }; + } + export { outputs_364 as outputs }; + } + namespace ND_power_color3 { + let node_365: string; + export { node_365 as node }; + let inherit_365: null; + export { inherit_365 as inherit }; + export namespace inputs_365 { + let in1_79: string; + export { in1_79 as in1 }; + let in2_79: string; + export { in2_79 as in2 }; + } + export { inputs_365 as inputs }; + export namespace outputs_365 { + let out_354: string; + export { out_354 as out }; + } + export { outputs_365 as outputs }; + } + namespace ND_power_color4 { + let node_366: string; + export { node_366 as node }; + let inherit_366: null; + export { inherit_366 as inherit }; + export namespace inputs_366 { + let in1_80: string; + export { in1_80 as in1 }; + let in2_80: string; + export { in2_80 as in2 }; + } + export { inputs_366 as inputs }; + export namespace outputs_366 { + let out_355: string; + export { out_355 as out }; + } + export { outputs_366 as outputs }; + } + namespace ND_power_vector2 { + let node_367: string; + export { node_367 as node }; + let inherit_367: null; + export { inherit_367 as inherit }; + export namespace inputs_367 { + let in1_81: string; + export { in1_81 as in1 }; + let in2_81: string; + export { in2_81 as in2 }; + } + export { inputs_367 as inputs }; + export namespace outputs_367 { + let out_356: string; + export { out_356 as out }; + } + export { outputs_367 as outputs }; + } + namespace ND_power_vector3 { + let node_368: string; + export { node_368 as node }; + let inherit_368: null; + export { inherit_368 as inherit }; + export namespace inputs_368 { + let in1_82: string; + export { in1_82 as in1 }; + let in2_82: string; + export { in2_82 as in2 }; + } + export { inputs_368 as inputs }; + export namespace outputs_368 { + let out_357: string; + export { out_357 as out }; + } + export { outputs_368 as outputs }; + } + namespace ND_power_vector4 { + let node_369: string; + export { node_369 as node }; + let inherit_369: null; + export { inherit_369 as inherit }; + export namespace inputs_369 { + let in1_83: string; + export { in1_83 as in1 }; + let in2_83: string; + export { in2_83 as in2 }; + } + export { inputs_369 as inputs }; + export namespace outputs_369 { + let out_358: string; + export { out_358 as out }; + } + export { outputs_369 as outputs }; + } + namespace ND_power_color3FA { + let node_370: string; + export { node_370 as node }; + let inherit_370: null; + export { inherit_370 as inherit }; + export namespace inputs_370 { + let in1_84: string; + export { in1_84 as in1 }; + let in2_84: string; + export { in2_84 as in2 }; + } + export { inputs_370 as inputs }; + export namespace outputs_370 { + let out_359: string; + export { out_359 as out }; + } + export { outputs_370 as outputs }; + } + namespace ND_power_color4FA { + let node_371: string; + export { node_371 as node }; + let inherit_371: null; + export { inherit_371 as inherit }; + export namespace inputs_371 { + let in1_85: string; + export { in1_85 as in1 }; + let in2_85: string; + export { in2_85 as in2 }; + } + export { inputs_371 as inputs }; + export namespace outputs_371 { + let out_360: string; + export { out_360 as out }; + } + export { outputs_371 as outputs }; + } + namespace ND_power_vector2FA { + let node_372: string; + export { node_372 as node }; + let inherit_372: null; + export { inherit_372 as inherit }; + export namespace inputs_372 { + let in1_86: string; + export { in1_86 as in1 }; + let in2_86: string; + export { in2_86 as in2 }; + } + export { inputs_372 as inputs }; + export namespace outputs_372 { + let out_361: string; + export { out_361 as out }; + } + export { outputs_372 as outputs }; + } + namespace ND_power_vector3FA { + let node_373: string; + export { node_373 as node }; + let inherit_373: null; + export { inherit_373 as inherit }; + export namespace inputs_373 { + let in1_87: string; + export { in1_87 as in1 }; + let in2_87: string; + export { in2_87 as in2 }; + } + export { inputs_373 as inputs }; + export namespace outputs_373 { + let out_362: string; + export { out_362 as out }; + } + export { outputs_373 as outputs }; + } + namespace ND_power_vector4FA { + let node_374: string; + export { node_374 as node }; + let inherit_374: null; + export { inherit_374 as inherit }; + export namespace inputs_374 { + let in1_88: string; + export { in1_88 as in1 }; + let in2_88: string; + export { in2_88 as in2 }; + } + export { inputs_374 as inputs }; + export namespace outputs_374 { + let out_363: string; + export { out_363 as out }; + } + export { outputs_374 as outputs }; + } + namespace ND_safepower_float { + let node_375: string; + export { node_375 as node }; + let inherit_375: null; + export { inherit_375 as inherit }; + export namespace inputs_375 { + let in1_89: string; + export { in1_89 as in1 }; + let in2_89: string; + export { in2_89 as in2 }; + } + export { inputs_375 as inputs }; + export namespace outputs_375 { + let out_364: string; + export { out_364 as out }; + } + export { outputs_375 as outputs }; + } + namespace ND_safepower_color3 { + let node_376: string; + export { node_376 as node }; + let inherit_376: null; + export { inherit_376 as inherit }; + export namespace inputs_376 { + let in1_90: string; + export { in1_90 as in1 }; + let in2_90: string; + export { in2_90 as in2 }; + } + export { inputs_376 as inputs }; + export namespace outputs_376 { + let out_365: string; + export { out_365 as out }; + } + export { outputs_376 as outputs }; + } + namespace ND_safepower_color4 { + let node_377: string; + export { node_377 as node }; + let inherit_377: null; + export { inherit_377 as inherit }; + export namespace inputs_377 { + let in1_91: string; + export { in1_91 as in1 }; + let in2_91: string; + export { in2_91 as in2 }; + } + export { inputs_377 as inputs }; + export namespace outputs_377 { + let out_366: string; + export { out_366 as out }; + } + export { outputs_377 as outputs }; + } + namespace ND_safepower_vector2 { + let node_378: string; + export { node_378 as node }; + let inherit_378: null; + export { inherit_378 as inherit }; + export namespace inputs_378 { + let in1_92: string; + export { in1_92 as in1 }; + let in2_92: string; + export { in2_92 as in2 }; + } + export { inputs_378 as inputs }; + export namespace outputs_378 { + let out_367: string; + export { out_367 as out }; + } + export { outputs_378 as outputs }; + } + namespace ND_safepower_vector3 { + let node_379: string; + export { node_379 as node }; + let inherit_379: null; + export { inherit_379 as inherit }; + export namespace inputs_379 { + let in1_93: string; + export { in1_93 as in1 }; + let in2_93: string; + export { in2_93 as in2 }; + } + export { inputs_379 as inputs }; + export namespace outputs_379 { + let out_368: string; + export { out_368 as out }; + } + export { outputs_379 as outputs }; + } + namespace ND_safepower_vector4 { + let node_380: string; + export { node_380 as node }; + let inherit_380: null; + export { inherit_380 as inherit }; + export namespace inputs_380 { + let in1_94: string; + export { in1_94 as in1 }; + let in2_94: string; + export { in2_94 as in2 }; + } + export { inputs_380 as inputs }; + export namespace outputs_380 { + let out_369: string; + export { out_369 as out }; + } + export { outputs_380 as outputs }; + } + namespace ND_safepower_color3FA { + let node_381: string; + export { node_381 as node }; + let inherit_381: null; + export { inherit_381 as inherit }; + export namespace inputs_381 { + let in1_95: string; + export { in1_95 as in1 }; + let in2_95: string; + export { in2_95 as in2 }; + } + export { inputs_381 as inputs }; + export namespace outputs_381 { + let out_370: string; + export { out_370 as out }; + } + export { outputs_381 as outputs }; + } + namespace ND_safepower_color4FA { + let node_382: string; + export { node_382 as node }; + let inherit_382: null; + export { inherit_382 as inherit }; + export namespace inputs_382 { + let in1_96: string; + export { in1_96 as in1 }; + let in2_96: string; + export { in2_96 as in2 }; + } + export { inputs_382 as inputs }; + export namespace outputs_382 { + let out_371: string; + export { out_371 as out }; + } + export { outputs_382 as outputs }; + } + namespace ND_safepower_vector2FA { + let node_383: string; + export { node_383 as node }; + let inherit_383: null; + export { inherit_383 as inherit }; + export namespace inputs_383 { + let in1_97: string; + export { in1_97 as in1 }; + let in2_97: string; + export { in2_97 as in2 }; + } + export { inputs_383 as inputs }; + export namespace outputs_383 { + let out_372: string; + export { out_372 as out }; + } + export { outputs_383 as outputs }; + } + namespace ND_safepower_vector3FA { + let node_384: string; + export { node_384 as node }; + let inherit_384: null; + export { inherit_384 as inherit }; + export namespace inputs_384 { + let in1_98: string; + export { in1_98 as in1 }; + let in2_98: string; + export { in2_98 as in2 }; + } + export { inputs_384 as inputs }; + export namespace outputs_384 { + let out_373: string; + export { out_373 as out }; + } + export { outputs_384 as outputs }; + } + namespace ND_safepower_vector4FA { + let node_385: string; + export { node_385 as node }; + let inherit_385: null; + export { inherit_385 as inherit }; + export namespace inputs_385 { + let in1_99: string; + export { in1_99 as in1 }; + let in2_99: string; + export { in2_99 as in2 }; + } + export { inputs_385 as inputs }; + export namespace outputs_385 { + let out_374: string; + export { out_374 as out }; + } + export { outputs_385 as outputs }; + } + namespace ND_sin_float { + let node_386: string; + export { node_386 as node }; + let inherit_386: null; + export { inherit_386 as inherit }; + export namespace inputs_386 { + let _in_69: string; + export { _in_69 as in }; + } + export { inputs_386 as inputs }; + export namespace outputs_386 { + let out_375: string; + export { out_375 as out }; + } + export { outputs_386 as outputs }; + } + namespace ND_cos_float { + let node_387: string; + export { node_387 as node }; + let inherit_387: null; + export { inherit_387 as inherit }; + export namespace inputs_387 { + let _in_70: string; + export { _in_70 as in }; + } + export { inputs_387 as inputs }; + export namespace outputs_387 { + let out_376: string; + export { out_376 as out }; + } + export { outputs_387 as outputs }; + } + namespace ND_tan_float { + let node_388: string; + export { node_388 as node }; + let inherit_388: null; + export { inherit_388 as inherit }; + export namespace inputs_388 { + let _in_71: string; + export { _in_71 as in }; + } + export { inputs_388 as inputs }; + export namespace outputs_388 { + let out_377: string; + export { out_377 as out }; + } + export { outputs_388 as outputs }; + } + namespace ND_asin_float { + let node_389: string; + export { node_389 as node }; + let inherit_389: null; + export { inherit_389 as inherit }; + export namespace inputs_389 { + let _in_72: string; + export { _in_72 as in }; + } + export { inputs_389 as inputs }; + export namespace outputs_389 { + let out_378: string; + export { out_378 as out }; + } + export { outputs_389 as outputs }; + } + namespace ND_acos_float { + let node_390: string; + export { node_390 as node }; + let inherit_390: null; + export { inherit_390 as inherit }; + export namespace inputs_390 { + let _in_73: string; + export { _in_73 as in }; + } + export { inputs_390 as inputs }; + export namespace outputs_390 { + let out_379: string; + export { out_379 as out }; + } + export { outputs_390 as outputs }; + } + namespace ND_atan2_float { + let node_391: string; + export { node_391 as node }; + let inherit_391: null; + export { inherit_391 as inherit }; + export namespace inputs_391 { + let iny: string; + let inx: string; + } + export { inputs_391 as inputs }; + export namespace outputs_391 { + let out_380: string; + export { out_380 as out }; + } + export { outputs_391 as outputs }; + } + namespace ND_sin_vector2 { + let node_392: string; + export { node_392 as node }; + let inherit_392: null; + export { inherit_392 as inherit }; + export namespace inputs_392 { + let _in_74: string; + export { _in_74 as in }; + } + export { inputs_392 as inputs }; + export namespace outputs_392 { + let out_381: string; + export { out_381 as out }; + } + export { outputs_392 as outputs }; + } + namespace ND_cos_vector2 { + let node_393: string; + export { node_393 as node }; + let inherit_393: null; + export { inherit_393 as inherit }; + export namespace inputs_393 { + let _in_75: string; + export { _in_75 as in }; + } + export { inputs_393 as inputs }; + export namespace outputs_393 { + let out_382: string; + export { out_382 as out }; + } + export { outputs_393 as outputs }; + } + namespace ND_tan_vector2 { + let node_394: string; + export { node_394 as node }; + let inherit_394: null; + export { inherit_394 as inherit }; + export namespace inputs_394 { + let _in_76: string; + export { _in_76 as in }; + } + export { inputs_394 as inputs }; + export namespace outputs_394 { + let out_383: string; + export { out_383 as out }; + } + export { outputs_394 as outputs }; + } + namespace ND_asin_vector2 { + let node_395: string; + export { node_395 as node }; + let inherit_395: null; + export { inherit_395 as inherit }; + export namespace inputs_395 { + let _in_77: string; + export { _in_77 as in }; + } + export { inputs_395 as inputs }; + export namespace outputs_395 { + let out_384: string; + export { out_384 as out }; + } + export { outputs_395 as outputs }; + } + namespace ND_acos_vector2 { + let node_396: string; + export { node_396 as node }; + let inherit_396: null; + export { inherit_396 as inherit }; + export namespace inputs_396 { + let _in_78: string; + export { _in_78 as in }; + } + export { inputs_396 as inputs }; + export namespace outputs_396 { + let out_385: string; + export { out_385 as out }; + } + export { outputs_396 as outputs }; + } + namespace ND_atan2_vector2 { + let node_397: string; + export { node_397 as node }; + let inherit_397: null; + export { inherit_397 as inherit }; + export namespace inputs_397 { + let iny_1: string; + export { iny_1 as iny }; + let inx_1: string; + export { inx_1 as inx }; + } + export { inputs_397 as inputs }; + export namespace outputs_397 { + let out_386: string; + export { out_386 as out }; + } + export { outputs_397 as outputs }; + } + namespace ND_sin_vector3 { + let node_398: string; + export { node_398 as node }; + let inherit_398: null; + export { inherit_398 as inherit }; + export namespace inputs_398 { + let _in_79: string; + export { _in_79 as in }; + } + export { inputs_398 as inputs }; + export namespace outputs_398 { + let out_387: string; + export { out_387 as out }; + } + export { outputs_398 as outputs }; + } + namespace ND_cos_vector3 { + let node_399: string; + export { node_399 as node }; + let inherit_399: null; + export { inherit_399 as inherit }; + export namespace inputs_399 { + let _in_80: string; + export { _in_80 as in }; + } + export { inputs_399 as inputs }; + export namespace outputs_399 { + let out_388: string; + export { out_388 as out }; + } + export { outputs_399 as outputs }; + } + namespace ND_tan_vector3 { + let node_400: string; + export { node_400 as node }; + let inherit_400: null; + export { inherit_400 as inherit }; + export namespace inputs_400 { + let _in_81: string; + export { _in_81 as in }; + } + export { inputs_400 as inputs }; + export namespace outputs_400 { + let out_389: string; + export { out_389 as out }; + } + export { outputs_400 as outputs }; + } + namespace ND_asin_vector3 { + let node_401: string; + export { node_401 as node }; + let inherit_401: null; + export { inherit_401 as inherit }; + export namespace inputs_401 { + let _in_82: string; + export { _in_82 as in }; + } + export { inputs_401 as inputs }; + export namespace outputs_401 { + let out_390: string; + export { out_390 as out }; + } + export { outputs_401 as outputs }; + } + namespace ND_acos_vector3 { + let node_402: string; + export { node_402 as node }; + let inherit_402: null; + export { inherit_402 as inherit }; + export namespace inputs_402 { + let _in_83: string; + export { _in_83 as in }; + } + export { inputs_402 as inputs }; + export namespace outputs_402 { + let out_391: string; + export { out_391 as out }; + } + export { outputs_402 as outputs }; + } + namespace ND_atan2_vector3 { + let node_403: string; + export { node_403 as node }; + let inherit_403: null; + export { inherit_403 as inherit }; + export namespace inputs_403 { + let iny_2: string; + export { iny_2 as iny }; + let inx_2: string; + export { inx_2 as inx }; + } + export { inputs_403 as inputs }; + export namespace outputs_403 { + let out_392: string; + export { out_392 as out }; + } + export { outputs_403 as outputs }; + } + namespace ND_sin_vector4 { + let node_404: string; + export { node_404 as node }; + let inherit_404: null; + export { inherit_404 as inherit }; + export namespace inputs_404 { + let _in_84: string; + export { _in_84 as in }; + } + export { inputs_404 as inputs }; + export namespace outputs_404 { + let out_393: string; + export { out_393 as out }; + } + export { outputs_404 as outputs }; + } + namespace ND_cos_vector4 { + let node_405: string; + export { node_405 as node }; + let inherit_405: null; + export { inherit_405 as inherit }; + export namespace inputs_405 { + let _in_85: string; + export { _in_85 as in }; + } + export { inputs_405 as inputs }; + export namespace outputs_405 { + let out_394: string; + export { out_394 as out }; + } + export { outputs_405 as outputs }; + } + namespace ND_tan_vector4 { + let node_406: string; + export { node_406 as node }; + let inherit_406: null; + export { inherit_406 as inherit }; + export namespace inputs_406 { + let _in_86: string; + export { _in_86 as in }; + } + export { inputs_406 as inputs }; + export namespace outputs_406 { + let out_395: string; + export { out_395 as out }; + } + export { outputs_406 as outputs }; + } + namespace ND_asin_vector4 { + let node_407: string; + export { node_407 as node }; + let inherit_407: null; + export { inherit_407 as inherit }; + export namespace inputs_407 { + let _in_87: string; + export { _in_87 as in }; + } + export { inputs_407 as inputs }; + export namespace outputs_407 { + let out_396: string; + export { out_396 as out }; + } + export { outputs_407 as outputs }; + } + namespace ND_acos_vector4 { + let node_408: string; + export { node_408 as node }; + let inherit_408: null; + export { inherit_408 as inherit }; + export namespace inputs_408 { + let _in_88: string; + export { _in_88 as in }; + } + export { inputs_408 as inputs }; + export namespace outputs_408 { + let out_397: string; + export { out_397 as out }; + } + export { outputs_408 as outputs }; + } + namespace ND_atan2_vector4 { + let node_409: string; + export { node_409 as node }; + let inherit_409: null; + export { inherit_409 as inherit }; + export namespace inputs_409 { + let iny_3: string; + export { iny_3 as iny }; + let inx_3: string; + export { inx_3 as inx }; + } + export { inputs_409 as inputs }; + export namespace outputs_409 { + let out_398: string; + export { out_398 as out }; + } + export { outputs_409 as outputs }; + } + namespace ND_sqrt_float { + let node_410: string; + export { node_410 as node }; + let inherit_410: null; + export { inherit_410 as inherit }; + export namespace inputs_410 { + let _in_89: string; + export { _in_89 as in }; + } + export { inputs_410 as inputs }; + export namespace outputs_410 { + let out_399: string; + export { out_399 as out }; + } + export { outputs_410 as outputs }; + } + namespace ND_ln_float { + let node_411: string; + export { node_411 as node }; + let inherit_411: null; + export { inherit_411 as inherit }; + export namespace inputs_411 { + let _in_90: string; + export { _in_90 as in }; + } + export { inputs_411 as inputs }; + export namespace outputs_411 { + let out_400: string; + export { out_400 as out }; + } + export { outputs_411 as outputs }; + } + namespace ND_exp_float { + let node_412: string; + export { node_412 as node }; + let inherit_412: null; + export { inherit_412 as inherit }; + export namespace inputs_412 { + let _in_91: string; + export { _in_91 as in }; + } + export { inputs_412 as inputs }; + export namespace outputs_412 { + let out_401: string; + export { out_401 as out }; + } + export { outputs_412 as outputs }; + } + namespace ND_sqrt_vector2 { + let node_413: string; + export { node_413 as node }; + let inherit_413: null; + export { inherit_413 as inherit }; + export namespace inputs_413 { + let _in_92: string; + export { _in_92 as in }; + } + export { inputs_413 as inputs }; + export namespace outputs_413 { + let out_402: string; + export { out_402 as out }; + } + export { outputs_413 as outputs }; + } + namespace ND_ln_vector2 { + let node_414: string; + export { node_414 as node }; + let inherit_414: null; + export { inherit_414 as inherit }; + export namespace inputs_414 { + let _in_93: string; + export { _in_93 as in }; + } + export { inputs_414 as inputs }; + export namespace outputs_414 { + let out_403: string; + export { out_403 as out }; + } + export { outputs_414 as outputs }; + } + namespace ND_exp_vector2 { + let node_415: string; + export { node_415 as node }; + let inherit_415: null; + export { inherit_415 as inherit }; + export namespace inputs_415 { + let _in_94: string; + export { _in_94 as in }; + } + export { inputs_415 as inputs }; + export namespace outputs_415 { + let out_404: string; + export { out_404 as out }; + } + export { outputs_415 as outputs }; + } + namespace ND_sqrt_vector3 { + let node_416: string; + export { node_416 as node }; + let inherit_416: null; + export { inherit_416 as inherit }; + export namespace inputs_416 { + let _in_95: string; + export { _in_95 as in }; + } + export { inputs_416 as inputs }; + export namespace outputs_416 { + let out_405: string; + export { out_405 as out }; + } + export { outputs_416 as outputs }; + } + namespace ND_ln_vector3 { + let node_417: string; + export { node_417 as node }; + let inherit_417: null; + export { inherit_417 as inherit }; + export namespace inputs_417 { + let _in_96: string; + export { _in_96 as in }; + } + export { inputs_417 as inputs }; + export namespace outputs_417 { + let out_406: string; + export { out_406 as out }; + } + export { outputs_417 as outputs }; + } + namespace ND_exp_vector3 { + let node_418: string; + export { node_418 as node }; + let inherit_418: null; + export { inherit_418 as inherit }; + export namespace inputs_418 { + let _in_97: string; + export { _in_97 as in }; + } + export { inputs_418 as inputs }; + export namespace outputs_418 { + let out_407: string; + export { out_407 as out }; + } + export { outputs_418 as outputs }; + } + namespace ND_sqrt_vector4 { + let node_419: string; + export { node_419 as node }; + let inherit_419: null; + export { inherit_419 as inherit }; + export namespace inputs_419 { + let _in_98: string; + export { _in_98 as in }; + } + export { inputs_419 as inputs }; + export namespace outputs_419 { + let out_408: string; + export { out_408 as out }; + } + export { outputs_419 as outputs }; + } + namespace ND_ln_vector4 { + let node_420: string; + export { node_420 as node }; + let inherit_420: null; + export { inherit_420 as inherit }; + export namespace inputs_420 { + let _in_99: string; + export { _in_99 as in }; + } + export { inputs_420 as inputs }; + export namespace outputs_420 { + let out_409: string; + export { out_409 as out }; + } + export { outputs_420 as outputs }; + } + namespace ND_exp_vector4 { + let node_421: string; + export { node_421 as node }; + let inherit_421: null; + export { inherit_421 as inherit }; + export namespace inputs_421 { + let _in_100: string; + export { _in_100 as in }; + } + export { inputs_421 as inputs }; + export namespace outputs_421 { + let out_410: string; + export { out_410 as out }; + } + export { outputs_421 as outputs }; + } + namespace ND_sign_float { + let node_422: string; + export { node_422 as node }; + let inherit_422: null; + export { inherit_422 as inherit }; + export namespace inputs_422 { + let _in_101: string; + export { _in_101 as in }; + } + export { inputs_422 as inputs }; + export namespace outputs_422 { + let out_411: string; + export { out_411 as out }; + } + export { outputs_422 as outputs }; + } + namespace ND_sign_color3 { + let node_423: string; + export { node_423 as node }; + let inherit_423: null; + export { inherit_423 as inherit }; + export namespace inputs_423 { + let _in_102: string; + export { _in_102 as in }; + } + export { inputs_423 as inputs }; + export namespace outputs_423 { + let out_412: string; + export { out_412 as out }; + } + export { outputs_423 as outputs }; + } + namespace ND_sign_color4 { + let node_424: string; + export { node_424 as node }; + let inherit_424: null; + export { inherit_424 as inherit }; + export namespace inputs_424 { + let _in_103: string; + export { _in_103 as in }; + } + export { inputs_424 as inputs }; + export namespace outputs_424 { + let out_413: string; + export { out_413 as out }; + } + export { outputs_424 as outputs }; + } + namespace ND_sign_vector2 { + let node_425: string; + export { node_425 as node }; + let inherit_425: null; + export { inherit_425 as inherit }; + export namespace inputs_425 { + let _in_104: string; + export { _in_104 as in }; + } + export { inputs_425 as inputs }; + export namespace outputs_425 { + let out_414: string; + export { out_414 as out }; + } + export { outputs_425 as outputs }; + } + namespace ND_sign_vector3 { + let node_426: string; + export { node_426 as node }; + let inherit_426: null; + export { inherit_426 as inherit }; + export namespace inputs_426 { + let _in_105: string; + export { _in_105 as in }; + } + export { inputs_426 as inputs }; + export namespace outputs_426 { + let out_415: string; + export { out_415 as out }; + } + export { outputs_426 as outputs }; + } + namespace ND_sign_vector4 { + let node_427: string; + export { node_427 as node }; + let inherit_427: null; + export { inherit_427 as inherit }; + export namespace inputs_427 { + let _in_106: string; + export { _in_106 as in }; + } + export { inputs_427 as inputs }; + export namespace outputs_427 { + let out_416: string; + export { out_416 as out }; + } + export { outputs_427 as outputs }; + } + namespace ND_clamp_float { + let node_428: string; + export { node_428 as node }; + let inherit_428: null; + export { inherit_428 as inherit }; + export namespace inputs_428 { + let _in_107: string; + export { _in_107 as in }; + export let low: string; + export let high: string; + } + export { inputs_428 as inputs }; + export namespace outputs_428 { + let out_417: string; + export { out_417 as out }; + } + export { outputs_428 as outputs }; + } + namespace ND_clamp_color3 { + let node_429: string; + export { node_429 as node }; + let inherit_429: null; + export { inherit_429 as inherit }; + export namespace inputs_429 { + let _in_108: string; + export { _in_108 as in }; + let low_1: string; + export { low_1 as low }; + let high_1: string; + export { high_1 as high }; + } + export { inputs_429 as inputs }; + export namespace outputs_429 { + let out_418: string; + export { out_418 as out }; + } + export { outputs_429 as outputs }; + } + namespace ND_clamp_color4 { + let node_430: string; + export { node_430 as node }; + let inherit_430: null; + export { inherit_430 as inherit }; + export namespace inputs_430 { + let _in_109: string; + export { _in_109 as in }; + let low_2: string; + export { low_2 as low }; + let high_2: string; + export { high_2 as high }; + } + export { inputs_430 as inputs }; + export namespace outputs_430 { + let out_419: string; + export { out_419 as out }; + } + export { outputs_430 as outputs }; + } + namespace ND_clamp_vector2 { + let node_431: string; + export { node_431 as node }; + let inherit_431: null; + export { inherit_431 as inherit }; + export namespace inputs_431 { + let _in_110: string; + export { _in_110 as in }; + let low_3: string; + export { low_3 as low }; + let high_3: string; + export { high_3 as high }; + } + export { inputs_431 as inputs }; + export namespace outputs_431 { + let out_420: string; + export { out_420 as out }; + } + export { outputs_431 as outputs }; + } + namespace ND_clamp_vector3 { + let node_432: string; + export { node_432 as node }; + let inherit_432: null; + export { inherit_432 as inherit }; + export namespace inputs_432 { + let _in_111: string; + export { _in_111 as in }; + let low_4: string; + export { low_4 as low }; + let high_4: string; + export { high_4 as high }; + } + export { inputs_432 as inputs }; + export namespace outputs_432 { + let out_421: string; + export { out_421 as out }; + } + export { outputs_432 as outputs }; + } + namespace ND_clamp_vector4 { + let node_433: string; + export { node_433 as node }; + let inherit_433: null; + export { inherit_433 as inherit }; + export namespace inputs_433 { + let _in_112: string; + export { _in_112 as in }; + let low_5: string; + export { low_5 as low }; + let high_5: string; + export { high_5 as high }; + } + export { inputs_433 as inputs }; + export namespace outputs_433 { + let out_422: string; + export { out_422 as out }; + } + export { outputs_433 as outputs }; + } + namespace ND_clamp_color3FA { + let node_434: string; + export { node_434 as node }; + let inherit_434: null; + export { inherit_434 as inherit }; + export namespace inputs_434 { + let _in_113: string; + export { _in_113 as in }; + let low_6: string; + export { low_6 as low }; + let high_6: string; + export { high_6 as high }; + } + export { inputs_434 as inputs }; + export namespace outputs_434 { + let out_423: string; + export { out_423 as out }; + } + export { outputs_434 as outputs }; + } + namespace ND_clamp_color4FA { + let node_435: string; + export { node_435 as node }; + let inherit_435: null; + export { inherit_435 as inherit }; + export namespace inputs_435 { + let _in_114: string; + export { _in_114 as in }; + let low_7: string; + export { low_7 as low }; + let high_7: string; + export { high_7 as high }; + } + export { inputs_435 as inputs }; + export namespace outputs_435 { + let out_424: string; + export { out_424 as out }; + } + export { outputs_435 as outputs }; + } + namespace ND_clamp_vector2FA { + let node_436: string; + export { node_436 as node }; + let inherit_436: null; + export { inherit_436 as inherit }; + export namespace inputs_436 { + let _in_115: string; + export { _in_115 as in }; + let low_8: string; + export { low_8 as low }; + let high_8: string; + export { high_8 as high }; + } + export { inputs_436 as inputs }; + export namespace outputs_436 { + let out_425: string; + export { out_425 as out }; + } + export { outputs_436 as outputs }; + } + namespace ND_clamp_vector3FA { + let node_437: string; + export { node_437 as node }; + let inherit_437: null; + export { inherit_437 as inherit }; + export namespace inputs_437 { + let _in_116: string; + export { _in_116 as in }; + let low_9: string; + export { low_9 as low }; + let high_9: string; + export { high_9 as high }; + } + export { inputs_437 as inputs }; + export namespace outputs_437 { + let out_426: string; + export { out_426 as out }; + } + export { outputs_437 as outputs }; + } + namespace ND_clamp_vector4FA { + let node_438: string; + export { node_438 as node }; + let inherit_438: null; + export { inherit_438 as inherit }; + export namespace inputs_438 { + let _in_117: string; + export { _in_117 as in }; + let low_10: string; + export { low_10 as low }; + let high_10: string; + export { high_10 as high }; + } + export { inputs_438 as inputs }; + export namespace outputs_438 { + let out_427: string; + export { out_427 as out }; + } + export { outputs_438 as outputs }; + } + namespace ND_min_float { + let node_439: string; + export { node_439 as node }; + let inherit_439: null; + export { inherit_439 as inherit }; + export namespace inputs_439 { + let in1_100: string; + export { in1_100 as in1 }; + let in2_100: string; + export { in2_100 as in2 }; + } + export { inputs_439 as inputs }; + export namespace outputs_439 { + let out_428: string; + export { out_428 as out }; + } + export { outputs_439 as outputs }; + } + namespace ND_min_color3 { + let node_440: string; + export { node_440 as node }; + let inherit_440: null; + export { inherit_440 as inherit }; + export namespace inputs_440 { + let in1_101: string; + export { in1_101 as in1 }; + let in2_101: string; + export { in2_101 as in2 }; + } + export { inputs_440 as inputs }; + export namespace outputs_440 { + let out_429: string; + export { out_429 as out }; + } + export { outputs_440 as outputs }; + } + namespace ND_min_color4 { + let node_441: string; + export { node_441 as node }; + let inherit_441: null; + export { inherit_441 as inherit }; + export namespace inputs_441 { + let in1_102: string; + export { in1_102 as in1 }; + let in2_102: string; + export { in2_102 as in2 }; + } + export { inputs_441 as inputs }; + export namespace outputs_441 { + let out_430: string; + export { out_430 as out }; + } + export { outputs_441 as outputs }; + } + namespace ND_min_vector2 { + let node_442: string; + export { node_442 as node }; + let inherit_442: null; + export { inherit_442 as inherit }; + export namespace inputs_442 { + let in1_103: string; + export { in1_103 as in1 }; + let in2_103: string; + export { in2_103 as in2 }; + } + export { inputs_442 as inputs }; + export namespace outputs_442 { + let out_431: string; + export { out_431 as out }; + } + export { outputs_442 as outputs }; + } + namespace ND_min_vector3 { + let node_443: string; + export { node_443 as node }; + let inherit_443: null; + export { inherit_443 as inherit }; + export namespace inputs_443 { + let in1_104: string; + export { in1_104 as in1 }; + let in2_104: string; + export { in2_104 as in2 }; + } + export { inputs_443 as inputs }; + export namespace outputs_443 { + let out_432: string; + export { out_432 as out }; + } + export { outputs_443 as outputs }; + } + namespace ND_min_vector4 { + let node_444: string; + export { node_444 as node }; + let inherit_444: null; + export { inherit_444 as inherit }; + export namespace inputs_444 { + let in1_105: string; + export { in1_105 as in1 }; + let in2_105: string; + export { in2_105 as in2 }; + } + export { inputs_444 as inputs }; + export namespace outputs_444 { + let out_433: string; + export { out_433 as out }; + } + export { outputs_444 as outputs }; + } + namespace ND_min_color3FA { + let node_445: string; + export { node_445 as node }; + let inherit_445: null; + export { inherit_445 as inherit }; + export namespace inputs_445 { + let in1_106: string; + export { in1_106 as in1 }; + let in2_106: string; + export { in2_106 as in2 }; + } + export { inputs_445 as inputs }; + export namespace outputs_445 { + let out_434: string; + export { out_434 as out }; + } + export { outputs_445 as outputs }; + } + namespace ND_min_color4FA { + let node_446: string; + export { node_446 as node }; + let inherit_446: null; + export { inherit_446 as inherit }; + export namespace inputs_446 { + let in1_107: string; + export { in1_107 as in1 }; + let in2_107: string; + export { in2_107 as in2 }; + } + export { inputs_446 as inputs }; + export namespace outputs_446 { + let out_435: string; + export { out_435 as out }; + } + export { outputs_446 as outputs }; + } + namespace ND_min_vector2FA { + let node_447: string; + export { node_447 as node }; + let inherit_447: null; + export { inherit_447 as inherit }; + export namespace inputs_447 { + let in1_108: string; + export { in1_108 as in1 }; + let in2_108: string; + export { in2_108 as in2 }; + } + export { inputs_447 as inputs }; + export namespace outputs_447 { + let out_436: string; + export { out_436 as out }; + } + export { outputs_447 as outputs }; + } + namespace ND_min_vector3FA { + let node_448: string; + export { node_448 as node }; + let inherit_448: null; + export { inherit_448 as inherit }; + export namespace inputs_448 { + let in1_109: string; + export { in1_109 as in1 }; + let in2_109: string; + export { in2_109 as in2 }; + } + export { inputs_448 as inputs }; + export namespace outputs_448 { + let out_437: string; + export { out_437 as out }; + } + export { outputs_448 as outputs }; + } + namespace ND_min_vector4FA { + let node_449: string; + export { node_449 as node }; + let inherit_449: null; + export { inherit_449 as inherit }; + export namespace inputs_449 { + let in1_110: string; + export { in1_110 as in1 }; + let in2_110: string; + export { in2_110 as in2 }; + } + export { inputs_449 as inputs }; + export namespace outputs_449 { + let out_438: string; + export { out_438 as out }; + } + export { outputs_449 as outputs }; + } + namespace ND_max_float { + let node_450: string; + export { node_450 as node }; + let inherit_450: null; + export { inherit_450 as inherit }; + export namespace inputs_450 { + let in1_111: string; + export { in1_111 as in1 }; + let in2_111: string; + export { in2_111 as in2 }; + } + export { inputs_450 as inputs }; + export namespace outputs_450 { + let out_439: string; + export { out_439 as out }; + } + export { outputs_450 as outputs }; + } + namespace ND_max_color3 { + let node_451: string; + export { node_451 as node }; + let inherit_451: null; + export { inherit_451 as inherit }; + export namespace inputs_451 { + let in1_112: string; + export { in1_112 as in1 }; + let in2_112: string; + export { in2_112 as in2 }; + } + export { inputs_451 as inputs }; + export namespace outputs_451 { + let out_440: string; + export { out_440 as out }; + } + export { outputs_451 as outputs }; + } + namespace ND_max_color4 { + let node_452: string; + export { node_452 as node }; + let inherit_452: null; + export { inherit_452 as inherit }; + export namespace inputs_452 { + let in1_113: string; + export { in1_113 as in1 }; + let in2_113: string; + export { in2_113 as in2 }; + } + export { inputs_452 as inputs }; + export namespace outputs_452 { + let out_441: string; + export { out_441 as out }; + } + export { outputs_452 as outputs }; + } + namespace ND_max_vector2 { + let node_453: string; + export { node_453 as node }; + let inherit_453: null; + export { inherit_453 as inherit }; + export namespace inputs_453 { + let in1_114: string; + export { in1_114 as in1 }; + let in2_114: string; + export { in2_114 as in2 }; + } + export { inputs_453 as inputs }; + export namespace outputs_453 { + let out_442: string; + export { out_442 as out }; + } + export { outputs_453 as outputs }; + } + namespace ND_max_vector3 { + let node_454: string; + export { node_454 as node }; + let inherit_454: null; + export { inherit_454 as inherit }; + export namespace inputs_454 { + let in1_115: string; + export { in1_115 as in1 }; + let in2_115: string; + export { in2_115 as in2 }; + } + export { inputs_454 as inputs }; + export namespace outputs_454 { + let out_443: string; + export { out_443 as out }; + } + export { outputs_454 as outputs }; + } + namespace ND_max_vector4 { + let node_455: string; + export { node_455 as node }; + let inherit_455: null; + export { inherit_455 as inherit }; + export namespace inputs_455 { + let in1_116: string; + export { in1_116 as in1 }; + let in2_116: string; + export { in2_116 as in2 }; + } + export { inputs_455 as inputs }; + export namespace outputs_455 { + let out_444: string; + export { out_444 as out }; + } + export { outputs_455 as outputs }; + } + namespace ND_max_color3FA { + let node_456: string; + export { node_456 as node }; + let inherit_456: null; + export { inherit_456 as inherit }; + export namespace inputs_456 { + let in1_117: string; + export { in1_117 as in1 }; + let in2_117: string; + export { in2_117 as in2 }; + } + export { inputs_456 as inputs }; + export namespace outputs_456 { + let out_445: string; + export { out_445 as out }; + } + export { outputs_456 as outputs }; + } + namespace ND_max_color4FA { + let node_457: string; + export { node_457 as node }; + let inherit_457: null; + export { inherit_457 as inherit }; + export namespace inputs_457 { + let in1_118: string; + export { in1_118 as in1 }; + let in2_118: string; + export { in2_118 as in2 }; + } + export { inputs_457 as inputs }; + export namespace outputs_457 { + let out_446: string; + export { out_446 as out }; + } + export { outputs_457 as outputs }; + } + namespace ND_max_vector2FA { + let node_458: string; + export { node_458 as node }; + let inherit_458: null; + export { inherit_458 as inherit }; + export namespace inputs_458 { + let in1_119: string; + export { in1_119 as in1 }; + let in2_119: string; + export { in2_119 as in2 }; + } + export { inputs_458 as inputs }; + export namespace outputs_458 { + let out_447: string; + export { out_447 as out }; + } + export { outputs_458 as outputs }; + } + namespace ND_max_vector3FA { + let node_459: string; + export { node_459 as node }; + let inherit_459: null; + export { inherit_459 as inherit }; + export namespace inputs_459 { + let in1_120: string; + export { in1_120 as in1 }; + let in2_120: string; + export { in2_120 as in2 }; + } + export { inputs_459 as inputs }; + export namespace outputs_459 { + let out_448: string; + export { out_448 as out }; + } + export { outputs_459 as outputs }; + } + namespace ND_max_vector4FA { + let node_460: string; + export { node_460 as node }; + let inherit_460: null; + export { inherit_460 as inherit }; + export namespace inputs_460 { + let in1_121: string; + export { in1_121 as in1 }; + let in2_121: string; + export { in2_121 as in2 }; + } + export { inputs_460 as inputs }; + export namespace outputs_460 { + let out_449: string; + export { out_449 as out }; + } + export { outputs_460 as outputs }; + } + namespace ND_normalize_vector2 { + let node_461: string; + export { node_461 as node }; + let inherit_461: null; + export { inherit_461 as inherit }; + export namespace inputs_461 { + let _in_118: string; + export { _in_118 as in }; + } + export { inputs_461 as inputs }; + export namespace outputs_461 { + let out_450: string; + export { out_450 as out }; + } + export { outputs_461 as outputs }; + } + namespace ND_normalize_vector3 { + let node_462: string; + export { node_462 as node }; + let inherit_462: null; + export { inherit_462 as inherit }; + export namespace inputs_462 { + let _in_119: string; + export { _in_119 as in }; + } + export { inputs_462 as inputs }; + export namespace outputs_462 { + let out_451: string; + export { out_451 as out }; + } + export { outputs_462 as outputs }; + } + namespace ND_normalize_vector4 { + let node_463: string; + export { node_463 as node }; + let inherit_463: null; + export { inherit_463 as inherit }; + export namespace inputs_463 { + let _in_120: string; + export { _in_120 as in }; + } + export { inputs_463 as inputs }; + export namespace outputs_463 { + let out_452: string; + export { out_452 as out }; + } + export { outputs_463 as outputs }; + } + namespace ND_magnitude_vector2 { + let node_464: string; + export { node_464 as node }; + let inherit_464: null; + export { inherit_464 as inherit }; + export namespace inputs_464 { + let _in_121: string; + export { _in_121 as in }; + } + export { inputs_464 as inputs }; + export namespace outputs_464 { + let out_453: string; + export { out_453 as out }; + } + export { outputs_464 as outputs }; + } + namespace ND_magnitude_vector3 { + let node_465: string; + export { node_465 as node }; + let inherit_465: null; + export { inherit_465 as inherit }; + export namespace inputs_465 { + let _in_122: string; + export { _in_122 as in }; + } + export { inputs_465 as inputs }; + export namespace outputs_465 { + let out_454: string; + export { out_454 as out }; + } + export { outputs_465 as outputs }; + } + namespace ND_magnitude_vector4 { + let node_466: string; + export { node_466 as node }; + let inherit_466: null; + export { inherit_466 as inherit }; + export namespace inputs_466 { + let _in_123: string; + export { _in_123 as in }; + } + export { inputs_466 as inputs }; + export namespace outputs_466 { + let out_455: string; + export { out_455 as out }; + } + export { outputs_466 as outputs }; + } + namespace ND_distance_vector2 { + let node_467: string; + export { node_467 as node }; + let inherit_467: null; + export { inherit_467 as inherit }; + export namespace inputs_467 { + let in1_122: string; + export { in1_122 as in1 }; + let in2_122: string; + export { in2_122 as in2 }; + } + export { inputs_467 as inputs }; + export namespace outputs_467 { + let out_456: string; + export { out_456 as out }; + } + export { outputs_467 as outputs }; + } + namespace ND_distance_vector3 { + let node_468: string; + export { node_468 as node }; + let inherit_468: null; + export { inherit_468 as inherit }; + export namespace inputs_468 { + let in1_123: string; + export { in1_123 as in1 }; + let in2_123: string; + export { in2_123 as in2 }; + } + export { inputs_468 as inputs }; + export namespace outputs_468 { + let out_457: string; + export { out_457 as out }; + } + export { outputs_468 as outputs }; + } + namespace ND_distance_vector4 { + let node_469: string; + export { node_469 as node }; + let inherit_469: null; + export { inherit_469 as inherit }; + export namespace inputs_469 { + let in1_124: string; + export { in1_124 as in1 }; + let in2_124: string; + export { in2_124 as in2 }; + } + export { inputs_469 as inputs }; + export namespace outputs_469 { + let out_458: string; + export { out_458 as out }; + } + export { outputs_469 as outputs }; + } + namespace ND_dotproduct_vector2 { + let node_470: string; + export { node_470 as node }; + let inherit_470: null; + export { inherit_470 as inherit }; + export namespace inputs_470 { + let in1_125: string; + export { in1_125 as in1 }; + let in2_125: string; + export { in2_125 as in2 }; + } + export { inputs_470 as inputs }; + export namespace outputs_470 { + let out_459: string; + export { out_459 as out }; + } + export { outputs_470 as outputs }; + } + namespace ND_dotproduct_vector3 { + let node_471: string; + export { node_471 as node }; + let inherit_471: null; + export { inherit_471 as inherit }; + export namespace inputs_471 { + let in1_126: string; + export { in1_126 as in1 }; + let in2_126: string; + export { in2_126 as in2 }; + } + export { inputs_471 as inputs }; + export namespace outputs_471 { + let out_460: string; + export { out_460 as out }; + } + export { outputs_471 as outputs }; + } + namespace ND_dotproduct_vector4 { + let node_472: string; + export { node_472 as node }; + let inherit_472: null; + export { inherit_472 as inherit }; + export namespace inputs_472 { + let in1_127: string; + export { in1_127 as in1 }; + let in2_127: string; + export { in2_127 as in2 }; + } + export { inputs_472 as inputs }; + export namespace outputs_472 { + let out_461: string; + export { out_461 as out }; + } + export { outputs_472 as outputs }; + } + namespace ND_crossproduct_vector3 { + let node_473: string; + export { node_473 as node }; + let inherit_473: null; + export { inherit_473 as inherit }; + export namespace inputs_473 { + let in1_128: string; + export { in1_128 as in1 }; + let in2_128: string; + export { in2_128 as in2 }; + } + export { inputs_473 as inputs }; + export namespace outputs_473 { + let out_462: string; + export { out_462 as out }; + } + export { outputs_473 as outputs }; + } + namespace ND_transformpoint_vector3 { + let node_474: string; + export { node_474 as node }; + let inherit_474: null; + export { inherit_474 as inherit }; + export namespace inputs_474 { + let _in_124: string; + export { _in_124 as in }; + export let fromspace: string; + export let tospace: string; + } + export { inputs_474 as inputs }; + export namespace outputs_474 { + let out_463: string; + export { out_463 as out }; + } + export { outputs_474 as outputs }; + } + namespace ND_transformvector_vector3 { + let node_475: string; + export { node_475 as node }; + let inherit_475: null; + export { inherit_475 as inherit }; + export namespace inputs_475 { + let _in_125: string; + export { _in_125 as in }; + let fromspace_1: string; + export { fromspace_1 as fromspace }; + let tospace_1: string; + export { tospace_1 as tospace }; + } + export { inputs_475 as inputs }; + export namespace outputs_475 { + let out_464: string; + export { out_464 as out }; + } + export { outputs_475 as outputs }; + } + namespace ND_transformnormal_vector3 { + let node_476: string; + export { node_476 as node }; + let inherit_476: null; + export { inherit_476 as inherit }; + export namespace inputs_476 { + let _in_126: string; + export { _in_126 as in }; + let fromspace_2: string; + export { fromspace_2 as fromspace }; + let tospace_2: string; + export { tospace_2 as tospace }; + } + export { inputs_476 as inputs }; + export namespace outputs_476 { + let out_465: string; + export { out_465 as out }; + } + export { outputs_476 as outputs }; + } + namespace ND_transformmatrix_vector2M3 { + let node_477: string; + export { node_477 as node }; + let inherit_477: null; + export { inherit_477 as inherit }; + export namespace inputs_477 { + let _in_127: string; + export { _in_127 as in }; + export let mat: string; + } + export { inputs_477 as inputs }; + export namespace outputs_477 { + let out_466: string; + export { out_466 as out }; + } + export { outputs_477 as outputs }; + } + namespace ND_transformmatrix_vector3 { + let node_478: string; + export { node_478 as node }; + let inherit_478: null; + export { inherit_478 as inherit }; + export namespace inputs_478 { + let _in_128: string; + export { _in_128 as in }; + let mat_1: string; + export { mat_1 as mat }; + } + export { inputs_478 as inputs }; + export namespace outputs_478 { + let out_467: string; + export { out_467 as out }; + } + export { outputs_478 as outputs }; + } + namespace ND_transformmatrix_vector3M4 { + let node_479: string; + export { node_479 as node }; + let inherit_479: null; + export { inherit_479 as inherit }; + export namespace inputs_479 { + let _in_129: string; + export { _in_129 as in }; + let mat_2: string; + export { mat_2 as mat }; + } + export { inputs_479 as inputs }; + export namespace outputs_479 { + let out_468: string; + export { out_468 as out }; + } + export { outputs_479 as outputs }; + } + namespace ND_transformmatrix_vector4 { + let node_480: string; + export { node_480 as node }; + let inherit_480: null; + export { inherit_480 as inherit }; + export namespace inputs_480 { + let _in_130: string; + export { _in_130 as in }; + let mat_3: string; + export { mat_3 as mat }; + } + export { inputs_480 as inputs }; + export namespace outputs_480 { + let out_469: string; + export { out_469 as out }; + } + export { outputs_480 as outputs }; + } + namespace ND_normalmap_float { + let node_481: string; + export { node_481 as node }; + let inherit_481: null; + export { inherit_481 as inherit }; + export namespace inputs_481 { + let _in_131: string; + export { _in_131 as in }; + let scale_15: string; + export { scale_15 as scale }; + let normal_24: string; + export { normal_24 as normal }; + let tangent_8: string; + export { tangent_8 as tangent }; + let bitangent_3: string; + export { bitangent_3 as bitangent }; + } + export { inputs_481 as inputs }; + export namespace outputs_481 { + let out_470: string; + export { out_470 as out }; + } + export { outputs_481 as outputs }; + } + namespace ND_normalmap_vector2 { + let node_482: string; + export { node_482 as node }; + let inherit_482: null; + export { inherit_482 as inherit }; + export namespace inputs_482 { + let _in_132: string; + export { _in_132 as in }; + let scale_16: string; + export { scale_16 as scale }; + let normal_25: string; + export { normal_25 as normal }; + let tangent_9: string; + export { tangent_9 as tangent }; + let bitangent_4: string; + export { bitangent_4 as bitangent }; + } + export { inputs_482 as inputs }; + export namespace outputs_482 { + let out_471: string; + export { out_471 as out }; + } + export { outputs_482 as outputs }; + } + namespace ND_hextilednormalmap_vector3 { + let node_483: string; + export { node_483 as node }; + let inherit_483: null; + export { inherit_483 as inherit }; + export namespace inputs_483 { + let file_25: string; + export { file_25 as file }; + let _default_39: string; + export { _default_39 as default }; + let texcoord_91: string; + export { texcoord_91 as texcoord }; + let tiling_2: string; + export { tiling_2 as tiling }; + let rotation_4: string; + export { rotation_4 as rotation }; + let rotationrange_2: string; + export { rotationrange_2 as rotationrange }; + let scale_17: string; + export { scale_17 as scale }; + let scalerange_2: string; + export { scalerange_2 as scalerange }; + let offset_12: string; + export { offset_12 as offset }; + let offsetrange_2: string; + export { offsetrange_2 as offsetrange }; + let falloff_2: string; + export { falloff_2 as falloff }; + export let strength: string; + export let flip_g: string; + let normal_26: string; + export { normal_26 as normal }; + let tangent_10: string; + export { tangent_10 as tangent }; + let bitangent_5: string; + export { bitangent_5 as bitangent }; + } + export { inputs_483 as inputs }; + export namespace outputs_483 { + let out_472: string; + export { out_472 as out }; + } + export { outputs_483 as outputs }; + } + namespace ND_transpose_matrix33 { + let node_484: string; + export { node_484 as node }; + let inherit_484: null; + export { inherit_484 as inherit }; + export namespace inputs_484 { + let _in_133: string; + export { _in_133 as in }; + } + export { inputs_484 as inputs }; + export namespace outputs_484 { + let out_473: string; + export { out_473 as out }; + } + export { outputs_484 as outputs }; + } + namespace ND_transpose_matrix44 { + let node_485: string; + export { node_485 as node }; + let inherit_485: null; + export { inherit_485 as inherit }; + export namespace inputs_485 { + let _in_134: string; + export { _in_134 as in }; + } + export { inputs_485 as inputs }; + export namespace outputs_485 { + let out_474: string; + export { out_474 as out }; + } + export { outputs_485 as outputs }; + } + namespace ND_determinant_matrix33 { + let node_486: string; + export { node_486 as node }; + let inherit_486: null; + export { inherit_486 as inherit }; + export namespace inputs_486 { + let _in_135: string; + export { _in_135 as in }; + } + export { inputs_486 as inputs }; + export namespace outputs_486 { + let out_475: string; + export { out_475 as out }; + } + export { outputs_486 as outputs }; + } + namespace ND_determinant_matrix44 { + let node_487: string; + export { node_487 as node }; + let inherit_487: null; + export { inherit_487 as inherit }; + export namespace inputs_487 { + let _in_136: string; + export { _in_136 as in }; + } + export { inputs_487 as inputs }; + export namespace outputs_487 { + let out_476: string; + export { out_476 as out }; + } + export { outputs_487 as outputs }; + } + namespace ND_invertmatrix_matrix33 { + let node_488: string; + export { node_488 as node }; + let inherit_488: null; + export { inherit_488 as inherit }; + export namespace inputs_488 { + let _in_137: string; + export { _in_137 as in }; + } + export { inputs_488 as inputs }; + export namespace outputs_488 { + let out_477: string; + export { out_477 as out }; + } + export { outputs_488 as outputs }; + } + namespace ND_invertmatrix_matrix44 { + let node_489: string; + export { node_489 as node }; + let inherit_489: null; + export { inherit_489 as inherit }; + export namespace inputs_489 { + let _in_138: string; + export { _in_138 as in }; + } + export { inputs_489 as inputs }; + export namespace outputs_489 { + let out_478: string; + export { out_478 as out }; + } + export { outputs_489 as outputs }; + } + namespace ND_rotate2d_vector2 { + let node_490: string; + export { node_490 as node }; + let inherit_490: null; + export { inherit_490 as inherit }; + export namespace inputs_490 { + let _in_139: string; + export { _in_139 as in }; + let amount_11: string; + export { amount_11 as amount }; + } + export { inputs_490 as inputs }; + export namespace outputs_490 { + let out_479: string; + export { out_479 as out }; + } + export { outputs_490 as outputs }; + } + namespace ND_rotate3d_vector3 { + let node_491: string; + export { node_491 as node }; + let inherit_491: null; + export { inherit_491 as inherit }; + export namespace inputs_491 { + let _in_140: string; + export { _in_140 as in }; + let amount_12: string; + export { amount_12 as amount }; + export let axis: string; + } + export { inputs_491 as inputs }; + export namespace outputs_491 { + let out_480: string; + export { out_480 as out }; + } + export { outputs_491 as outputs }; + } + namespace ND_place2d_vector2 { + let node_492: string; + export { node_492 as node }; + let inherit_492: null; + export { inherit_492 as inherit }; + export namespace inputs_492 { + let texcoord_92: string; + export { texcoord_92 as texcoord }; + let pivot_30: string; + export { pivot_30 as pivot }; + let scale_18: string; + export { scale_18 as scale }; + let rotate_8: string; + export { rotate_8 as rotate }; + let offset_13: string; + export { offset_13 as offset }; + let operationorder_7: string; + export { operationorder_7 as operationorder }; + } + export { inputs_492 as inputs }; + export namespace outputs_492 { + let out_481: string; + export { out_481 as out }; + } + export { outputs_492 as outputs }; + } + namespace ND_trianglewave_float { + let node_493: string; + export { node_493 as node }; + let inherit_493: null; + export { inherit_493 as inherit }; + export namespace inputs_493 { + let _in_141: string; + export { _in_141 as in }; + } + export { inputs_493 as inputs }; + export namespace outputs_493 { + let out_482: string; + export { out_482 as out }; + } + export { outputs_493 as outputs }; + } + namespace ND_reflect_vector3 { + let node_494: string; + export { node_494 as node }; + let inherit_494: null; + export { inherit_494 as inherit }; + export namespace inputs_494 { + let _in_142: string; + export { _in_142 as in }; + let normal_27: string; + export { normal_27 as normal }; + } + export { inputs_494 as inputs }; + export namespace outputs_494 { + let out_483: string; + export { out_483 as out }; + } + export { outputs_494 as outputs }; + } + namespace ND_refract_vector3 { + let node_495: string; + export { node_495 as node }; + let inherit_495: null; + export { inherit_495 as inherit }; + export namespace inputs_495 { + let _in_143: string; + export { _in_143 as in }; + let normal_28: string; + export { normal_28 as normal }; + let ior_7: string; + export { ior_7 as ior }; + } + export { inputs_495 as inputs }; + export namespace outputs_495 { + let out_484: string; + export { out_484 as out }; + } + export { outputs_495 as outputs }; + } + namespace ND_remap_float { + let node_496: string; + export { node_496 as node }; + let inherit_496: null; + export { inherit_496 as inherit }; + export namespace inputs_496 { + let _in_144: string; + export { _in_144 as in }; + export let inlow: string; + export let inhigh: string; + export let outlow: string; + export let outhigh: string; + } + export { inputs_496 as inputs }; + export namespace outputs_496 { + let out_485: string; + export { out_485 as out }; + } + export { outputs_496 as outputs }; + } + namespace ND_remap_color3 { + let node_497: string; + export { node_497 as node }; + let inherit_497: null; + export { inherit_497 as inherit }; + export namespace inputs_497 { + let _in_145: string; + export { _in_145 as in }; + let inlow_1: string; + export { inlow_1 as inlow }; + let inhigh_1: string; + export { inhigh_1 as inhigh }; + let outlow_1: string; + export { outlow_1 as outlow }; + let outhigh_1: string; + export { outhigh_1 as outhigh }; + } + export { inputs_497 as inputs }; + export namespace outputs_497 { + let out_486: string; + export { out_486 as out }; + } + export { outputs_497 as outputs }; + } + namespace ND_remap_color4 { + let node_498: string; + export { node_498 as node }; + let inherit_498: null; + export { inherit_498 as inherit }; + export namespace inputs_498 { + let _in_146: string; + export { _in_146 as in }; + let inlow_2: string; + export { inlow_2 as inlow }; + let inhigh_2: string; + export { inhigh_2 as inhigh }; + let outlow_2: string; + export { outlow_2 as outlow }; + let outhigh_2: string; + export { outhigh_2 as outhigh }; + } + export { inputs_498 as inputs }; + export namespace outputs_498 { + let out_487: string; + export { out_487 as out }; + } + export { outputs_498 as outputs }; + } + namespace ND_remap_vector2 { + let node_499: string; + export { node_499 as node }; + let inherit_499: null; + export { inherit_499 as inherit }; + export namespace inputs_499 { + let _in_147: string; + export { _in_147 as in }; + let inlow_3: string; + export { inlow_3 as inlow }; + let inhigh_3: string; + export { inhigh_3 as inhigh }; + let outlow_3: string; + export { outlow_3 as outlow }; + let outhigh_3: string; + export { outhigh_3 as outhigh }; + } + export { inputs_499 as inputs }; + export namespace outputs_499 { + let out_488: string; + export { out_488 as out }; + } + export { outputs_499 as outputs }; + } + namespace ND_remap_vector3 { + let node_500: string; + export { node_500 as node }; + let inherit_500: null; + export { inherit_500 as inherit }; + export namespace inputs_500 { + let _in_148: string; + export { _in_148 as in }; + let inlow_4: string; + export { inlow_4 as inlow }; + let inhigh_4: string; + export { inhigh_4 as inhigh }; + let outlow_4: string; + export { outlow_4 as outlow }; + let outhigh_4: string; + export { outhigh_4 as outhigh }; + } + export { inputs_500 as inputs }; + export namespace outputs_500 { + let out_489: string; + export { out_489 as out }; + } + export { outputs_500 as outputs }; + } + namespace ND_remap_vector4 { + let node_501: string; + export { node_501 as node }; + let inherit_501: null; + export { inherit_501 as inherit }; + export namespace inputs_501 { + let _in_149: string; + export { _in_149 as in }; + let inlow_5: string; + export { inlow_5 as inlow }; + let inhigh_5: string; + export { inhigh_5 as inhigh }; + let outlow_5: string; + export { outlow_5 as outlow }; + let outhigh_5: string; + export { outhigh_5 as outhigh }; + } + export { inputs_501 as inputs }; + export namespace outputs_501 { + let out_490: string; + export { out_490 as out }; + } + export { outputs_501 as outputs }; + } + namespace ND_remap_color3FA { + let node_502: string; + export { node_502 as node }; + let inherit_502: null; + export { inherit_502 as inherit }; + export namespace inputs_502 { + let _in_150: string; + export { _in_150 as in }; + let inlow_6: string; + export { inlow_6 as inlow }; + let inhigh_6: string; + export { inhigh_6 as inhigh }; + let outlow_6: string; + export { outlow_6 as outlow }; + let outhigh_6: string; + export { outhigh_6 as outhigh }; + } + export { inputs_502 as inputs }; + export namespace outputs_502 { + let out_491: string; + export { out_491 as out }; + } + export { outputs_502 as outputs }; + } + namespace ND_remap_color4FA { + let node_503: string; + export { node_503 as node }; + let inherit_503: null; + export { inherit_503 as inherit }; + export namespace inputs_503 { + let _in_151: string; + export { _in_151 as in }; + let inlow_7: string; + export { inlow_7 as inlow }; + let inhigh_7: string; + export { inhigh_7 as inhigh }; + let outlow_7: string; + export { outlow_7 as outlow }; + let outhigh_7: string; + export { outhigh_7 as outhigh }; + } + export { inputs_503 as inputs }; + export namespace outputs_503 { + let out_492: string; + export { out_492 as out }; + } + export { outputs_503 as outputs }; + } + namespace ND_remap_vector2FA { + let node_504: string; + export { node_504 as node }; + let inherit_504: null; + export { inherit_504 as inherit }; + export namespace inputs_504 { + let _in_152: string; + export { _in_152 as in }; + let inlow_8: string; + export { inlow_8 as inlow }; + let inhigh_8: string; + export { inhigh_8 as inhigh }; + let outlow_8: string; + export { outlow_8 as outlow }; + let outhigh_8: string; + export { outhigh_8 as outhigh }; + } + export { inputs_504 as inputs }; + export namespace outputs_504 { + let out_493: string; + export { out_493 as out }; + } + export { outputs_504 as outputs }; + } + namespace ND_remap_vector3FA { + let node_505: string; + export { node_505 as node }; + let inherit_505: null; + export { inherit_505 as inherit }; + export namespace inputs_505 { + let _in_153: string; + export { _in_153 as in }; + let inlow_9: string; + export { inlow_9 as inlow }; + let inhigh_9: string; + export { inhigh_9 as inhigh }; + let outlow_9: string; + export { outlow_9 as outlow }; + let outhigh_9: string; + export { outhigh_9 as outhigh }; + } + export { inputs_505 as inputs }; + export namespace outputs_505 { + let out_494: string; + export { out_494 as out }; + } + export { outputs_505 as outputs }; + } + namespace ND_remap_vector4FA { + let node_506: string; + export { node_506 as node }; + let inherit_506: null; + export { inherit_506 as inherit }; + export namespace inputs_506 { + let _in_154: string; + export { _in_154 as in }; + let inlow_10: string; + export { inlow_10 as inlow }; + let inhigh_10: string; + export { inhigh_10 as inhigh }; + let outlow_10: string; + export { outlow_10 as outlow }; + let outhigh_10: string; + export { outhigh_10 as outhigh }; + } + export { inputs_506 as inputs }; + export namespace outputs_506 { + let out_495: string; + export { out_495 as out }; + } + export { outputs_506 as outputs }; + } + namespace ND_smoothstep_float { + let node_507: string; + export { node_507 as node }; + let inherit_507: null; + export { inherit_507 as inherit }; + export namespace inputs_507 { + let _in_155: string; + export { _in_155 as in }; + let low_11: string; + export { low_11 as low }; + let high_11: string; + export { high_11 as high }; + } + export { inputs_507 as inputs }; + export namespace outputs_507 { + let out_496: string; + export { out_496 as out }; + } + export { outputs_507 as outputs }; + } + namespace ND_smoothstep_color3 { + let node_508: string; + export { node_508 as node }; + let inherit_508: null; + export { inherit_508 as inherit }; + export namespace inputs_508 { + let _in_156: string; + export { _in_156 as in }; + let low_12: string; + export { low_12 as low }; + let high_12: string; + export { high_12 as high }; + } + export { inputs_508 as inputs }; + export namespace outputs_508 { + let out_497: string; + export { out_497 as out }; + } + export { outputs_508 as outputs }; + } + namespace ND_smoothstep_color4 { + let node_509: string; + export { node_509 as node }; + let inherit_509: null; + export { inherit_509 as inherit }; + export namespace inputs_509 { + let _in_157: string; + export { _in_157 as in }; + let low_13: string; + export { low_13 as low }; + let high_13: string; + export { high_13 as high }; + } + export { inputs_509 as inputs }; + export namespace outputs_509 { + let out_498: string; + export { out_498 as out }; + } + export { outputs_509 as outputs }; + } + namespace ND_smoothstep_vector2 { + let node_510: string; + export { node_510 as node }; + let inherit_510: null; + export { inherit_510 as inherit }; + export namespace inputs_510 { + let _in_158: string; + export { _in_158 as in }; + let low_14: string; + export { low_14 as low }; + let high_14: string; + export { high_14 as high }; + } + export { inputs_510 as inputs }; + export namespace outputs_510 { + let out_499: string; + export { out_499 as out }; + } + export { outputs_510 as outputs }; + } + namespace ND_smoothstep_vector3 { + let node_511: string; + export { node_511 as node }; + let inherit_511: null; + export { inherit_511 as inherit }; + export namespace inputs_511 { + let _in_159: string; + export { _in_159 as in }; + let low_15: string; + export { low_15 as low }; + let high_15: string; + export { high_15 as high }; + } + export { inputs_511 as inputs }; + export namespace outputs_511 { + let out_500: string; + export { out_500 as out }; + } + export { outputs_511 as outputs }; + } + namespace ND_smoothstep_vector4 { + let node_512: string; + export { node_512 as node }; + let inherit_512: null; + export { inherit_512 as inherit }; + export namespace inputs_512 { + let _in_160: string; + export { _in_160 as in }; + let low_16: string; + export { low_16 as low }; + let high_16: string; + export { high_16 as high }; + } + export { inputs_512 as inputs }; + export namespace outputs_512 { + let out_501: string; + export { out_501 as out }; + } + export { outputs_512 as outputs }; + } + namespace ND_smoothstep_color3FA { + let node_513: string; + export { node_513 as node }; + let inherit_513: null; + export { inherit_513 as inherit }; + export namespace inputs_513 { + let _in_161: string; + export { _in_161 as in }; + let low_17: string; + export { low_17 as low }; + let high_17: string; + export { high_17 as high }; + } + export { inputs_513 as inputs }; + export namespace outputs_513 { + let out_502: string; + export { out_502 as out }; + } + export { outputs_513 as outputs }; + } + namespace ND_smoothstep_color4FA { + let node_514: string; + export { node_514 as node }; + let inherit_514: null; + export { inherit_514 as inherit }; + export namespace inputs_514 { + let _in_162: string; + export { _in_162 as in }; + let low_18: string; + export { low_18 as low }; + let high_18: string; + export { high_18 as high }; + } + export { inputs_514 as inputs }; + export namespace outputs_514 { + let out_503: string; + export { out_503 as out }; + } + export { outputs_514 as outputs }; + } + namespace ND_smoothstep_vector2FA { + let node_515: string; + export { node_515 as node }; + let inherit_515: null; + export { inherit_515 as inherit }; + export namespace inputs_515 { + let _in_163: string; + export { _in_163 as in }; + let low_19: string; + export { low_19 as low }; + let high_19: string; + export { high_19 as high }; + } + export { inputs_515 as inputs }; + export namespace outputs_515 { + let out_504: string; + export { out_504 as out }; + } + export { outputs_515 as outputs }; + } + namespace ND_smoothstep_vector3FA { + let node_516: string; + export { node_516 as node }; + let inherit_516: null; + export { inherit_516 as inherit }; + export namespace inputs_516 { + let _in_164: string; + export { _in_164 as in }; + let low_20: string; + export { low_20 as low }; + let high_20: string; + export { high_20 as high }; + } + export { inputs_516 as inputs }; + export namespace outputs_516 { + let out_505: string; + export { out_505 as out }; + } + export { outputs_516 as outputs }; + } + namespace ND_smoothstep_vector4FA { + let node_517: string; + export { node_517 as node }; + let inherit_517: null; + export { inherit_517 as inherit }; + export namespace inputs_517 { + let _in_165: string; + export { _in_165 as in }; + let low_21: string; + export { low_21 as low }; + let high_21: string; + export { high_21 as high }; + } + export { inputs_517 as inputs }; + export namespace outputs_517 { + let out_506: string; + export { out_506 as out }; + } + export { outputs_517 as outputs }; + } + namespace ND_luminance_color3 { + let node_518: string; + export { node_518 as node }; + let inherit_518: null; + export { inherit_518 as inherit }; + export namespace inputs_518 { + let _in_166: string; + export { _in_166 as in }; + let lumacoeffs_2: string; + export { lumacoeffs_2 as lumacoeffs }; + } + export { inputs_518 as inputs }; + export namespace outputs_518 { + let out_507: string; + export { out_507 as out }; + } + export { outputs_518 as outputs }; + } + namespace ND_luminance_color4 { + let node_519: string; + export { node_519 as node }; + let inherit_519: null; + export { inherit_519 as inherit }; + export namespace inputs_519 { + let _in_167: string; + export { _in_167 as in }; + let lumacoeffs_3: string; + export { lumacoeffs_3 as lumacoeffs }; + } + export { inputs_519 as inputs }; + export namespace outputs_519 { + let out_508: string; + export { out_508 as out }; + } + export { outputs_519 as outputs }; + } + namespace ND_rgbtohsv_color3 { + let node_520: string; + export { node_520 as node }; + let inherit_520: null; + export { inherit_520 as inherit }; + export namespace inputs_520 { + let _in_168: string; + export { _in_168 as in }; + } + export { inputs_520 as inputs }; + export namespace outputs_520 { + let out_509: string; + export { out_509 as out }; + } + export { outputs_520 as outputs }; + } + namespace ND_rgbtohsv_color4 { + let node_521: string; + export { node_521 as node }; + let inherit_521: null; + export { inherit_521 as inherit }; + export namespace inputs_521 { + let _in_169: string; + export { _in_169 as in }; + } + export { inputs_521 as inputs }; + export namespace outputs_521 { + let out_510: string; + export { out_510 as out }; + } + export { outputs_521 as outputs }; + } + namespace ND_hsvtorgb_color3 { + let node_522: string; + export { node_522 as node }; + let inherit_522: null; + export { inherit_522 as inherit }; + export namespace inputs_522 { + let _in_170: string; + export { _in_170 as in }; + } + export { inputs_522 as inputs }; + export namespace outputs_522 { + let out_511: string; + export { out_511 as out }; + } + export { outputs_522 as outputs }; + } + namespace ND_hsvtorgb_color4 { + let node_523: string; + export { node_523 as node }; + let inherit_523: null; + export { inherit_523 as inherit }; + export namespace inputs_523 { + let _in_171: string; + export { _in_171 as in }; + } + export { inputs_523 as inputs }; + export namespace outputs_523 { + let out_512: string; + export { out_512 as out }; + } + export { outputs_523 as outputs }; + } + namespace ND_contrast_float { + let node_524: string; + export { node_524 as node }; + let inherit_524: null; + export { inherit_524 as inherit }; + export namespace inputs_524 { + let _in_172: string; + export { _in_172 as in }; + let amount_13: string; + export { amount_13 as amount }; + let pivot_31: string; + export { pivot_31 as pivot }; + } + export { inputs_524 as inputs }; + export namespace outputs_524 { + let out_513: string; + export { out_513 as out }; + } + export { outputs_524 as outputs }; + } + namespace ND_contrast_color3 { + let node_525: string; + export { node_525 as node }; + let inherit_525: null; + export { inherit_525 as inherit }; + export namespace inputs_525 { + let _in_173: string; + export { _in_173 as in }; + let amount_14: string; + export { amount_14 as amount }; + let pivot_32: string; + export { pivot_32 as pivot }; + } + export { inputs_525 as inputs }; + export namespace outputs_525 { + let out_514: string; + export { out_514 as out }; + } + export { outputs_525 as outputs }; + } + namespace ND_contrast_color4 { + let node_526: string; + export { node_526 as node }; + let inherit_526: null; + export { inherit_526 as inherit }; + export namespace inputs_526 { + let _in_174: string; + export { _in_174 as in }; + let amount_15: string; + export { amount_15 as amount }; + let pivot_33: string; + export { pivot_33 as pivot }; + } + export { inputs_526 as inputs }; + export namespace outputs_526 { + let out_515: string; + export { out_515 as out }; + } + export { outputs_526 as outputs }; + } + namespace ND_contrast_vector2 { + let node_527: string; + export { node_527 as node }; + let inherit_527: null; + export { inherit_527 as inherit }; + export namespace inputs_527 { + let _in_175: string; + export { _in_175 as in }; + let amount_16: string; + export { amount_16 as amount }; + let pivot_34: string; + export { pivot_34 as pivot }; + } + export { inputs_527 as inputs }; + export namespace outputs_527 { + let out_516: string; + export { out_516 as out }; + } + export { outputs_527 as outputs }; + } + namespace ND_contrast_vector3 { + let node_528: string; + export { node_528 as node }; + let inherit_528: null; + export { inherit_528 as inherit }; + export namespace inputs_528 { + let _in_176: string; + export { _in_176 as in }; + let amount_17: string; + export { amount_17 as amount }; + let pivot_35: string; + export { pivot_35 as pivot }; + } + export { inputs_528 as inputs }; + export namespace outputs_528 { + let out_517: string; + export { out_517 as out }; + } + export { outputs_528 as outputs }; + } + namespace ND_contrast_vector4 { + let node_529: string; + export { node_529 as node }; + let inherit_529: null; + export { inherit_529 as inherit }; + export namespace inputs_529 { + let _in_177: string; + export { _in_177 as in }; + let amount_18: string; + export { amount_18 as amount }; + let pivot_36: string; + export { pivot_36 as pivot }; + } + export { inputs_529 as inputs }; + export namespace outputs_529 { + let out_518: string; + export { out_518 as out }; + } + export { outputs_529 as outputs }; + } + namespace ND_contrast_color3FA { + let node_530: string; + export { node_530 as node }; + let inherit_530: null; + export { inherit_530 as inherit }; + export namespace inputs_530 { + let _in_178: string; + export { _in_178 as in }; + let amount_19: string; + export { amount_19 as amount }; + let pivot_37: string; + export { pivot_37 as pivot }; + } + export { inputs_530 as inputs }; + export namespace outputs_530 { + let out_519: string; + export { out_519 as out }; + } + export { outputs_530 as outputs }; + } + namespace ND_contrast_color4FA { + let node_531: string; + export { node_531 as node }; + let inherit_531: null; + export { inherit_531 as inherit }; + export namespace inputs_531 { + let _in_179: string; + export { _in_179 as in }; + let amount_20: string; + export { amount_20 as amount }; + let pivot_38: string; + export { pivot_38 as pivot }; + } + export { inputs_531 as inputs }; + export namespace outputs_531 { + let out_520: string; + export { out_520 as out }; + } + export { outputs_531 as outputs }; + } + namespace ND_contrast_vector2FA { + let node_532: string; + export { node_532 as node }; + let inherit_532: null; + export { inherit_532 as inherit }; + export namespace inputs_532 { + let _in_180: string; + export { _in_180 as in }; + let amount_21: string; + export { amount_21 as amount }; + let pivot_39: string; + export { pivot_39 as pivot }; + } + export { inputs_532 as inputs }; + export namespace outputs_532 { + let out_521: string; + export { out_521 as out }; + } + export { outputs_532 as outputs }; + } + namespace ND_contrast_vector3FA { + let node_533: string; + export { node_533 as node }; + let inherit_533: null; + export { inherit_533 as inherit }; + export namespace inputs_533 { + let _in_181: string; + export { _in_181 as in }; + let amount_22: string; + export { amount_22 as amount }; + let pivot_40: string; + export { pivot_40 as pivot }; + } + export { inputs_533 as inputs }; + export namespace outputs_533 { + let out_522: string; + export { out_522 as out }; + } + export { outputs_533 as outputs }; + } + namespace ND_contrast_vector4FA { + let node_534: string; + export { node_534 as node }; + let inherit_534: null; + export { inherit_534 as inherit }; + export namespace inputs_534 { + let _in_182: string; + export { _in_182 as in }; + let amount_23: string; + export { amount_23 as amount }; + let pivot_41: string; + export { pivot_41 as pivot }; + } + export { inputs_534 as inputs }; + export namespace outputs_534 { + let out_523: string; + export { out_523 as out }; + } + export { outputs_534 as outputs }; + } + namespace ND_range_float { + let node_535: string; + export { node_535 as node }; + let inherit_535: null; + export { inherit_535 as inherit }; + export namespace inputs_535 { + let _in_183: string; + export { _in_183 as in }; + let inlow_11: string; + export { inlow_11 as inlow }; + let inhigh_11: string; + export { inhigh_11 as inhigh }; + export let gamma: string; + let outlow_11: string; + export { outlow_11 as outlow }; + let outhigh_11: string; + export { outhigh_11 as outhigh }; + export let doclamp: string; + } + export { inputs_535 as inputs }; + export namespace outputs_535 { + let out_524: string; + export { out_524 as out }; + } + export { outputs_535 as outputs }; + } + namespace ND_range_color3 { + let node_536: string; + export { node_536 as node }; + let inherit_536: null; + export { inherit_536 as inherit }; + export namespace inputs_536 { + let _in_184: string; + export { _in_184 as in }; + let inlow_12: string; + export { inlow_12 as inlow }; + let inhigh_12: string; + export { inhigh_12 as inhigh }; + let gamma_1: string; + export { gamma_1 as gamma }; + let outlow_12: string; + export { outlow_12 as outlow }; + let outhigh_12: string; + export { outhigh_12 as outhigh }; + let doclamp_1: string; + export { doclamp_1 as doclamp }; + } + export { inputs_536 as inputs }; + export namespace outputs_536 { + let out_525: string; + export { out_525 as out }; + } + export { outputs_536 as outputs }; + } + namespace ND_range_color4 { + let node_537: string; + export { node_537 as node }; + let inherit_537: null; + export { inherit_537 as inherit }; + export namespace inputs_537 { + let _in_185: string; + export { _in_185 as in }; + let inlow_13: string; + export { inlow_13 as inlow }; + let inhigh_13: string; + export { inhigh_13 as inhigh }; + let gamma_2: string; + export { gamma_2 as gamma }; + let outlow_13: string; + export { outlow_13 as outlow }; + let outhigh_13: string; + export { outhigh_13 as outhigh }; + let doclamp_2: string; + export { doclamp_2 as doclamp }; + } + export { inputs_537 as inputs }; + export namespace outputs_537 { + let out_526: string; + export { out_526 as out }; + } + export { outputs_537 as outputs }; + } + namespace ND_range_vector2 { + let node_538: string; + export { node_538 as node }; + let inherit_538: null; + export { inherit_538 as inherit }; + export namespace inputs_538 { + let _in_186: string; + export { _in_186 as in }; + let inlow_14: string; + export { inlow_14 as inlow }; + let inhigh_14: string; + export { inhigh_14 as inhigh }; + let gamma_3: string; + export { gamma_3 as gamma }; + let outlow_14: string; + export { outlow_14 as outlow }; + let outhigh_14: string; + export { outhigh_14 as outhigh }; + let doclamp_3: string; + export { doclamp_3 as doclamp }; + } + export { inputs_538 as inputs }; + export namespace outputs_538 { + let out_527: string; + export { out_527 as out }; + } + export { outputs_538 as outputs }; + } + namespace ND_range_vector3 { + let node_539: string; + export { node_539 as node }; + let inherit_539: null; + export { inherit_539 as inherit }; + export namespace inputs_539 { + let _in_187: string; + export { _in_187 as in }; + let inlow_15: string; + export { inlow_15 as inlow }; + let inhigh_15: string; + export { inhigh_15 as inhigh }; + let gamma_4: string; + export { gamma_4 as gamma }; + let outlow_15: string; + export { outlow_15 as outlow }; + let outhigh_15: string; + export { outhigh_15 as outhigh }; + let doclamp_4: string; + export { doclamp_4 as doclamp }; + } + export { inputs_539 as inputs }; + export namespace outputs_539 { + let out_528: string; + export { out_528 as out }; + } + export { outputs_539 as outputs }; + } + namespace ND_range_vector4 { + let node_540: string; + export { node_540 as node }; + let inherit_540: null; + export { inherit_540 as inherit }; + export namespace inputs_540 { + let _in_188: string; + export { _in_188 as in }; + let inlow_16: string; + export { inlow_16 as inlow }; + let inhigh_16: string; + export { inhigh_16 as inhigh }; + let gamma_5: string; + export { gamma_5 as gamma }; + let outlow_16: string; + export { outlow_16 as outlow }; + let outhigh_16: string; + export { outhigh_16 as outhigh }; + let doclamp_5: string; + export { doclamp_5 as doclamp }; + } + export { inputs_540 as inputs }; + export namespace outputs_540 { + let out_529: string; + export { out_529 as out }; + } + export { outputs_540 as outputs }; + } + namespace ND_range_color3FA { + let node_541: string; + export { node_541 as node }; + let inherit_541: null; + export { inherit_541 as inherit }; + export namespace inputs_541 { + let _in_189: string; + export { _in_189 as in }; + let inlow_17: string; + export { inlow_17 as inlow }; + let inhigh_17: string; + export { inhigh_17 as inhigh }; + let gamma_6: string; + export { gamma_6 as gamma }; + let outlow_17: string; + export { outlow_17 as outlow }; + let outhigh_17: string; + export { outhigh_17 as outhigh }; + let doclamp_6: string; + export { doclamp_6 as doclamp }; + } + export { inputs_541 as inputs }; + export namespace outputs_541 { + let out_530: string; + export { out_530 as out }; + } + export { outputs_541 as outputs }; + } + namespace ND_range_color4FA { + let node_542: string; + export { node_542 as node }; + let inherit_542: null; + export { inherit_542 as inherit }; + export namespace inputs_542 { + let _in_190: string; + export { _in_190 as in }; + let inlow_18: string; + export { inlow_18 as inlow }; + let inhigh_18: string; + export { inhigh_18 as inhigh }; + let gamma_7: string; + export { gamma_7 as gamma }; + let outlow_18: string; + export { outlow_18 as outlow }; + let outhigh_18: string; + export { outhigh_18 as outhigh }; + let doclamp_7: string; + export { doclamp_7 as doclamp }; + } + export { inputs_542 as inputs }; + export namespace outputs_542 { + let out_531: string; + export { out_531 as out }; + } + export { outputs_542 as outputs }; + } + namespace ND_range_vector2FA { + let node_543: string; + export { node_543 as node }; + let inherit_543: null; + export { inherit_543 as inherit }; + export namespace inputs_543 { + let _in_191: string; + export { _in_191 as in }; + let inlow_19: string; + export { inlow_19 as inlow }; + let inhigh_19: string; + export { inhigh_19 as inhigh }; + let gamma_8: string; + export { gamma_8 as gamma }; + let outlow_19: string; + export { outlow_19 as outlow }; + let outhigh_19: string; + export { outhigh_19 as outhigh }; + let doclamp_8: string; + export { doclamp_8 as doclamp }; + } + export { inputs_543 as inputs }; + export namespace outputs_543 { + let out_532: string; + export { out_532 as out }; + } + export { outputs_543 as outputs }; + } + namespace ND_range_vector3FA { + let node_544: string; + export { node_544 as node }; + let inherit_544: null; + export { inherit_544 as inherit }; + export namespace inputs_544 { + let _in_192: string; + export { _in_192 as in }; + let inlow_20: string; + export { inlow_20 as inlow }; + let inhigh_20: string; + export { inhigh_20 as inhigh }; + let gamma_9: string; + export { gamma_9 as gamma }; + let outlow_20: string; + export { outlow_20 as outlow }; + let outhigh_20: string; + export { outhigh_20 as outhigh }; + let doclamp_9: string; + export { doclamp_9 as doclamp }; + } + export { inputs_544 as inputs }; + export namespace outputs_544 { + let out_533: string; + export { out_533 as out }; + } + export { outputs_544 as outputs }; + } + namespace ND_range_vector4FA { + let node_545: string; + export { node_545 as node }; + let inherit_545: null; + export { inherit_545 as inherit }; + export namespace inputs_545 { + let _in_193: string; + export { _in_193 as in }; + let inlow_21: string; + export { inlow_21 as inlow }; + let inhigh_21: string; + export { inhigh_21 as inhigh }; + let gamma_10: string; + export { gamma_10 as gamma }; + let outlow_21: string; + export { outlow_21 as outlow }; + let outhigh_21: string; + export { outhigh_21 as outhigh }; + let doclamp_10: string; + export { doclamp_10 as doclamp }; + } + export { inputs_545 as inputs }; + export namespace outputs_545 { + let out_534: string; + export { out_534 as out }; + } + export { outputs_545 as outputs }; + } + namespace ND_hsvadjust_color3 { + let node_546: string; + export { node_546 as node }; + let inherit_546: null; + export { inherit_546 as inherit }; + export namespace inputs_546 { + let _in_194: string; + export { _in_194 as in }; + let amount_24: string; + export { amount_24 as amount }; + } + export { inputs_546 as inputs }; + export namespace outputs_546 { + let out_535: string; + export { out_535 as out }; + } + export { outputs_546 as outputs }; + } + namespace ND_hsvadjust_color4 { + let node_547: string; + export { node_547 as node }; + let inherit_547: null; + export { inherit_547 as inherit }; + export namespace inputs_547 { + let _in_195: string; + export { _in_195 as in }; + let amount_25: string; + export { amount_25 as amount }; + } + export { inputs_547 as inputs }; + export namespace outputs_547 { + let out_536: string; + export { out_536 as out }; + } + export { outputs_547 as outputs }; + } + namespace ND_saturate_color3 { + let node_548: string; + export { node_548 as node }; + let inherit_548: null; + export { inherit_548 as inherit }; + export namespace inputs_548 { + let _in_196: string; + export { _in_196 as in }; + let amount_26: string; + export { amount_26 as amount }; + let lumacoeffs_4: string; + export { lumacoeffs_4 as lumacoeffs }; + } + export { inputs_548 as inputs }; + export namespace outputs_548 { + let out_537: string; + export { out_537 as out }; + } + export { outputs_548 as outputs }; + } + namespace ND_saturate_color4 { + let node_549: string; + export { node_549 as node }; + let inherit_549: null; + export { inherit_549 as inherit }; + export namespace inputs_549 { + let _in_197: string; + export { _in_197 as in }; + let amount_27: string; + export { amount_27 as amount }; + let lumacoeffs_5: string; + export { lumacoeffs_5 as lumacoeffs }; + } + export { inputs_549 as inputs }; + export namespace outputs_549 { + let out_538: string; + export { out_538 as out }; + } + export { outputs_549 as outputs }; + } + namespace ND_colorcorrect_color3 { + let node_550: string; + export { node_550 as node }; + let inherit_550: null; + export { inherit_550 as inherit }; + export namespace inputs_550 { + let _in_198: string; + export { _in_198 as in }; + export let hue: string; + export let saturation: string; + let gamma_11: string; + export { gamma_11 as gamma }; + export let lift: string; + export let gain: string; + export let contrast: string; + export let contrastpivot: string; + let exposure_1: string; + export { exposure_1 as exposure }; + } + export { inputs_550 as inputs }; + export namespace outputs_550 { + let out_539: string; + export { out_539 as out }; + } + export { outputs_550 as outputs }; + } + namespace ND_colorcorrect_color4 { + let node_551: string; + export { node_551 as node }; + let inherit_551: null; + export { inherit_551 as inherit }; + export namespace inputs_551 { + let _in_199: string; + export { _in_199 as in }; + let hue_1: string; + export { hue_1 as hue }; + let saturation_1: string; + export { saturation_1 as saturation }; + let gamma_12: string; + export { gamma_12 as gamma }; + let lift_1: string; + export { lift_1 as lift }; + let gain_1: string; + export { gain_1 as gain }; + let contrast_1: string; + export { contrast_1 as contrast }; + let contrastpivot_1: string; + export { contrastpivot_1 as contrastpivot }; + let exposure_2: string; + export { exposure_2 as exposure }; + } + export { inputs_551 as inputs }; + export namespace outputs_551 { + let out_540: string; + export { out_540 as out }; + } + export { outputs_551 as outputs }; + } + namespace ND_premult_color4 { + let node_552: string; + export { node_552 as node }; + let inherit_552: null; + export { inherit_552 as inherit }; + export namespace inputs_552 { + let _in_200: string; + export { _in_200 as in }; + } + export { inputs_552 as inputs }; + export namespace outputs_552 { + let out_541: string; + export { out_541 as out }; + } + export { outputs_552 as outputs }; + } + namespace ND_unpremult_color4 { + let node_553: string; + export { node_553 as node }; + let inherit_553: null; + export { inherit_553 as inherit }; + export namespace inputs_553 { + let _in_201: string; + export { _in_201 as in }; + } + export { inputs_553 as inputs }; + export namespace outputs_553 { + let out_542: string; + export { out_542 as out }; + } + export { outputs_553 as outputs }; + } + namespace ND_plus_float { + let node_554: string; + export { node_554 as node }; + let inherit_554: null; + export { inherit_554 as inherit }; + export namespace inputs_554 { + let fg_3: string; + export { fg_3 as fg }; + let bg_3: string; + export { bg_3 as bg }; + let mix_3: string; + export { mix_3 as mix }; + } + export { inputs_554 as inputs }; + export namespace outputs_554 { + let out_543: string; + export { out_543 as out }; + } + export { outputs_554 as outputs }; + } + namespace ND_plus_color3 { + let node_555: string; + export { node_555 as node }; + let inherit_555: null; + export { inherit_555 as inherit }; + export namespace inputs_555 { + let fg_4: string; + export { fg_4 as fg }; + let bg_4: string; + export { bg_4 as bg }; + let mix_4: string; + export { mix_4 as mix }; + } + export { inputs_555 as inputs }; + export namespace outputs_555 { + let out_544: string; + export { out_544 as out }; + } + export { outputs_555 as outputs }; + } + namespace ND_plus_color4 { + let node_556: string; + export { node_556 as node }; + let inherit_556: null; + export { inherit_556 as inherit }; + export namespace inputs_556 { + let fg_5: string; + export { fg_5 as fg }; + let bg_5: string; + export { bg_5 as bg }; + let mix_5: string; + export { mix_5 as mix }; + } + export { inputs_556 as inputs }; + export namespace outputs_556 { + let out_545: string; + export { out_545 as out }; + } + export { outputs_556 as outputs }; + } + namespace ND_minus_float { + let node_557: string; + export { node_557 as node }; + let inherit_557: null; + export { inherit_557 as inherit }; + export namespace inputs_557 { + let fg_6: string; + export { fg_6 as fg }; + let bg_6: string; + export { bg_6 as bg }; + let mix_6: string; + export { mix_6 as mix }; + } + export { inputs_557 as inputs }; + export namespace outputs_557 { + let out_546: string; + export { out_546 as out }; + } + export { outputs_557 as outputs }; + } + namespace ND_minus_color3 { + let node_558: string; + export { node_558 as node }; + let inherit_558: null; + export { inherit_558 as inherit }; + export namespace inputs_558 { + let fg_7: string; + export { fg_7 as fg }; + let bg_7: string; + export { bg_7 as bg }; + let mix_7: string; + export { mix_7 as mix }; + } + export { inputs_558 as inputs }; + export namespace outputs_558 { + let out_547: string; + export { out_547 as out }; + } + export { outputs_558 as outputs }; + } + namespace ND_minus_color4 { + let node_559: string; + export { node_559 as node }; + let inherit_559: null; + export { inherit_559 as inherit }; + export namespace inputs_559 { + let fg_8: string; + export { fg_8 as fg }; + let bg_8: string; + export { bg_8 as bg }; + let mix_8: string; + export { mix_8 as mix }; + } + export { inputs_559 as inputs }; + export namespace outputs_559 { + let out_548: string; + export { out_548 as out }; + } + export { outputs_559 as outputs }; + } + namespace ND_difference_float { + let node_560: string; + export { node_560 as node }; + let inherit_560: null; + export { inherit_560 as inherit }; + export namespace inputs_560 { + let fg_9: string; + export { fg_9 as fg }; + let bg_9: string; + export { bg_9 as bg }; + let mix_9: string; + export { mix_9 as mix }; + } + export { inputs_560 as inputs }; + export namespace outputs_560 { + let out_549: string; + export { out_549 as out }; + } + export { outputs_560 as outputs }; + } + namespace ND_difference_color3 { + let node_561: string; + export { node_561 as node }; + let inherit_561: null; + export { inherit_561 as inherit }; + export namespace inputs_561 { + let fg_10: string; + export { fg_10 as fg }; + let bg_10: string; + export { bg_10 as bg }; + let mix_10: string; + export { mix_10 as mix }; + } + export { inputs_561 as inputs }; + export namespace outputs_561 { + let out_550: string; + export { out_550 as out }; + } + export { outputs_561 as outputs }; + } + namespace ND_difference_color4 { + let node_562: string; + export { node_562 as node }; + let inherit_562: null; + export { inherit_562 as inherit }; + export namespace inputs_562 { + let fg_11: string; + export { fg_11 as fg }; + let bg_11: string; + export { bg_11 as bg }; + let mix_11: string; + export { mix_11 as mix }; + } + export { inputs_562 as inputs }; + export namespace outputs_562 { + let out_551: string; + export { out_551 as out }; + } + export { outputs_562 as outputs }; + } + namespace ND_burn_float { + let node_563: string; + export { node_563 as node }; + let inherit_563: null; + export { inherit_563 as inherit }; + export namespace inputs_563 { + let fg_12: string; + export { fg_12 as fg }; + let bg_12: string; + export { bg_12 as bg }; + let mix_12: string; + export { mix_12 as mix }; + } + export { inputs_563 as inputs }; + export namespace outputs_563 { + let out_552: string; + export { out_552 as out }; + } + export { outputs_563 as outputs }; + } + namespace ND_burn_color3 { + let node_564: string; + export { node_564 as node }; + let inherit_564: null; + export { inherit_564 as inherit }; + export namespace inputs_564 { + let fg_13: string; + export { fg_13 as fg }; + let bg_13: string; + export { bg_13 as bg }; + let mix_13: string; + export { mix_13 as mix }; + } + export { inputs_564 as inputs }; + export namespace outputs_564 { + let out_553: string; + export { out_553 as out }; + } + export { outputs_564 as outputs }; + } + namespace ND_burn_color4 { + let node_565: string; + export { node_565 as node }; + let inherit_565: null; + export { inherit_565 as inherit }; + export namespace inputs_565 { + let fg_14: string; + export { fg_14 as fg }; + let bg_14: string; + export { bg_14 as bg }; + let mix_14: string; + export { mix_14 as mix }; + } + export { inputs_565 as inputs }; + export namespace outputs_565 { + let out_554: string; + export { out_554 as out }; + } + export { outputs_565 as outputs }; + } + namespace ND_dodge_float { + let node_566: string; + export { node_566 as node }; + let inherit_566: null; + export { inherit_566 as inherit }; + export namespace inputs_566 { + let fg_15: string; + export { fg_15 as fg }; + let bg_15: string; + export { bg_15 as bg }; + let mix_15: string; + export { mix_15 as mix }; + } + export { inputs_566 as inputs }; + export namespace outputs_566 { + let out_555: string; + export { out_555 as out }; + } + export { outputs_566 as outputs }; + } + namespace ND_dodge_color3 { + let node_567: string; + export { node_567 as node }; + let inherit_567: null; + export { inherit_567 as inherit }; + export namespace inputs_567 { + let fg_16: string; + export { fg_16 as fg }; + let bg_16: string; + export { bg_16 as bg }; + let mix_16: string; + export { mix_16 as mix }; + } + export { inputs_567 as inputs }; + export namespace outputs_567 { + let out_556: string; + export { out_556 as out }; + } + export { outputs_567 as outputs }; + } + namespace ND_dodge_color4 { + let node_568: string; + export { node_568 as node }; + let inherit_568: null; + export { inherit_568 as inherit }; + export namespace inputs_568 { + let fg_17: string; + export { fg_17 as fg }; + let bg_17: string; + export { bg_17 as bg }; + let mix_17: string; + export { mix_17 as mix }; + } + export { inputs_568 as inputs }; + export namespace outputs_568 { + let out_557: string; + export { out_557 as out }; + } + export { outputs_568 as outputs }; + } + namespace ND_screen_float { + let node_569: string; + export { node_569 as node }; + let inherit_569: null; + export { inherit_569 as inherit }; + export namespace inputs_569 { + let fg_18: string; + export { fg_18 as fg }; + let bg_18: string; + export { bg_18 as bg }; + let mix_18: string; + export { mix_18 as mix }; + } + export { inputs_569 as inputs }; + export namespace outputs_569 { + let out_558: string; + export { out_558 as out }; + } + export { outputs_569 as outputs }; + } + namespace ND_screen_color3 { + let node_570: string; + export { node_570 as node }; + let inherit_570: null; + export { inherit_570 as inherit }; + export namespace inputs_570 { + let fg_19: string; + export { fg_19 as fg }; + let bg_19: string; + export { bg_19 as bg }; + let mix_19: string; + export { mix_19 as mix }; + } + export { inputs_570 as inputs }; + export namespace outputs_570 { + let out_559: string; + export { out_559 as out }; + } + export { outputs_570 as outputs }; + } + namespace ND_screen_color4 { + let node_571: string; + export { node_571 as node }; + let inherit_571: null; + export { inherit_571 as inherit }; + export namespace inputs_571 { + let fg_20: string; + export { fg_20 as fg }; + let bg_20: string; + export { bg_20 as bg }; + let mix_20: string; + export { mix_20 as mix }; + } + export { inputs_571 as inputs }; + export namespace outputs_571 { + let out_560: string; + export { out_560 as out }; + } + export { outputs_571 as outputs }; + } + namespace ND_overlay_float { + let node_572: string; + export { node_572 as node }; + let inherit_572: null; + export { inherit_572 as inherit }; + export namespace inputs_572 { + let fg_21: string; + export { fg_21 as fg }; + let bg_21: string; + export { bg_21 as bg }; + let mix_21: string; + export { mix_21 as mix }; + } + export { inputs_572 as inputs }; + export namespace outputs_572 { + let out_561: string; + export { out_561 as out }; + } + export { outputs_572 as outputs }; + } + namespace ND_overlay_color3 { + let node_573: string; + export { node_573 as node }; + let inherit_573: null; + export { inherit_573 as inherit }; + export namespace inputs_573 { + let fg_22: string; + export { fg_22 as fg }; + let bg_22: string; + export { bg_22 as bg }; + let mix_22: string; + export { mix_22 as mix }; + } + export { inputs_573 as inputs }; + export namespace outputs_573 { + let out_562: string; + export { out_562 as out }; + } + export { outputs_573 as outputs }; + } + namespace ND_overlay_color4 { + let node_574: string; + export { node_574 as node }; + let inherit_574: null; + export { inherit_574 as inherit }; + export namespace inputs_574 { + let fg_23: string; + export { fg_23 as fg }; + let bg_23: string; + export { bg_23 as bg }; + let mix_23: string; + export { mix_23 as mix }; + } + export { inputs_574 as inputs }; + export namespace outputs_574 { + let out_563: string; + export { out_563 as out }; + } + export { outputs_574 as outputs }; + } + namespace ND_disjointover_color4 { + let node_575: string; + export { node_575 as node }; + let inherit_575: null; + export { inherit_575 as inherit }; + export namespace inputs_575 { + let fg_24: string; + export { fg_24 as fg }; + let bg_24: string; + export { bg_24 as bg }; + let mix_24: string; + export { mix_24 as mix }; + } + export { inputs_575 as inputs }; + export namespace outputs_575 { + let out_564: string; + export { out_564 as out }; + } + export { outputs_575 as outputs }; + } + namespace ND_in_color4 { + let node_576: string; + export { node_576 as node }; + let inherit_576: null; + export { inherit_576 as inherit }; + export namespace inputs_576 { + let fg_25: string; + export { fg_25 as fg }; + let bg_25: string; + export { bg_25 as bg }; + let mix_25: string; + export { mix_25 as mix }; + } + export { inputs_576 as inputs }; + export namespace outputs_576 { + let out_565: string; + export { out_565 as out }; + } + export { outputs_576 as outputs }; + } + namespace ND_mask_color4 { + let node_577: string; + export { node_577 as node }; + let inherit_577: null; + export { inherit_577 as inherit }; + export namespace inputs_577 { + let fg_26: string; + export { fg_26 as fg }; + let bg_26: string; + export { bg_26 as bg }; + let mix_26: string; + export { mix_26 as mix }; + } + export { inputs_577 as inputs }; + export namespace outputs_577 { + let out_566: string; + export { out_566 as out }; + } + export { outputs_577 as outputs }; + } + namespace ND_matte_color4 { + let node_578: string; + export { node_578 as node }; + let inherit_578: null; + export { inherit_578 as inherit }; + export namespace inputs_578 { + let fg_27: string; + export { fg_27 as fg }; + let bg_27: string; + export { bg_27 as bg }; + let mix_27: string; + export { mix_27 as mix }; + } + export { inputs_578 as inputs }; + export namespace outputs_578 { + let out_567: string; + export { out_567 as out }; + } + export { outputs_578 as outputs }; + } + namespace ND_out_color4 { + let node_579: string; + export { node_579 as node }; + let inherit_579: null; + export { inherit_579 as inherit }; + export namespace inputs_579 { + let fg_28: string; + export { fg_28 as fg }; + let bg_28: string; + export { bg_28 as bg }; + let mix_28: string; + export { mix_28 as mix }; + } + export { inputs_579 as inputs }; + export namespace outputs_579 { + let out_568: string; + export { out_568 as out }; + } + export { outputs_579 as outputs }; + } + namespace ND_over_color4 { + let node_580: string; + export { node_580 as node }; + let inherit_580: null; + export { inherit_580 as inherit }; + export namespace inputs_580 { + let fg_29: string; + export { fg_29 as fg }; + let bg_29: string; + export { bg_29 as bg }; + let mix_29: string; + export { mix_29 as mix }; + } + export { inputs_580 as inputs }; + export namespace outputs_580 { + let out_569: string; + export { out_569 as out }; + } + export { outputs_580 as outputs }; + } + namespace ND_inside_float { + let node_581: string; + export { node_581 as node }; + let inherit_581: null; + export { inherit_581 as inherit }; + export namespace inputs_581 { + let _in_202: string; + export { _in_202 as in }; + export let mask: string; + } + export { inputs_581 as inputs }; + export namespace outputs_581 { + let out_570: string; + export { out_570 as out }; + } + export { outputs_581 as outputs }; + } + namespace ND_inside_color3 { + let node_582: string; + export { node_582 as node }; + let inherit_582: null; + export { inherit_582 as inherit }; + export namespace inputs_582 { + let _in_203: string; + export { _in_203 as in }; + let mask_1: string; + export { mask_1 as mask }; + } + export { inputs_582 as inputs }; + export namespace outputs_582 { + let out_571: string; + export { out_571 as out }; + } + export { outputs_582 as outputs }; + } + namespace ND_inside_color4 { + let node_583: string; + export { node_583 as node }; + let inherit_583: null; + export { inherit_583 as inherit }; + export namespace inputs_583 { + let _in_204: string; + export { _in_204 as in }; + let mask_2: string; + export { mask_2 as mask }; + } + export { inputs_583 as inputs }; + export namespace outputs_583 { + let out_572: string; + export { out_572 as out }; + } + export { outputs_583 as outputs }; + } + namespace ND_outside_float { + let node_584: string; + export { node_584 as node }; + let inherit_584: null; + export { inherit_584 as inherit }; + export namespace inputs_584 { + let _in_205: string; + export { _in_205 as in }; + let mask_3: string; + export { mask_3 as mask }; + } + export { inputs_584 as inputs }; + export namespace outputs_584 { + let out_573: string; + export { out_573 as out }; + } + export { outputs_584 as outputs }; + } + namespace ND_outside_color3 { + let node_585: string; + export { node_585 as node }; + let inherit_585: null; + export { inherit_585 as inherit }; + export namespace inputs_585 { + let _in_206: string; + export { _in_206 as in }; + let mask_4: string; + export { mask_4 as mask }; + } + export { inputs_585 as inputs }; + export namespace outputs_585 { + let out_574: string; + export { out_574 as out }; + } + export { outputs_585 as outputs }; + } + namespace ND_outside_color4 { + let node_586: string; + export { node_586 as node }; + let inherit_586: null; + export { inherit_586 as inherit }; + export namespace inputs_586 { + let _in_207: string; + export { _in_207 as in }; + let mask_5: string; + export { mask_5 as mask }; + } + export { inputs_586 as inputs }; + export namespace outputs_586 { + let out_575: string; + export { out_575 as out }; + } + export { outputs_586 as outputs }; + } + namespace ND_mix_float { + let node_587: string; + export { node_587 as node }; + let inherit_587: null; + export { inherit_587 as inherit }; + export namespace inputs_587 { + let fg_30: string; + export { fg_30 as fg }; + let bg_30: string; + export { bg_30 as bg }; + let mix_30: string; + export { mix_30 as mix }; + } + export { inputs_587 as inputs }; + export namespace outputs_587 { + let out_576: string; + export { out_576 as out }; + } + export { outputs_587 as outputs }; + } + namespace ND_mix_color3 { + let node_588: string; + export { node_588 as node }; + let inherit_588: null; + export { inherit_588 as inherit }; + export namespace inputs_588 { + let fg_31: string; + export { fg_31 as fg }; + let bg_31: string; + export { bg_31 as bg }; + let mix_31: string; + export { mix_31 as mix }; + } + export { inputs_588 as inputs }; + export namespace outputs_588 { + let out_577: string; + export { out_577 as out }; + } + export { outputs_588 as outputs }; + } + namespace ND_mix_color3_color3 { + let node_589: string; + export { node_589 as node }; + let inherit_589: null; + export { inherit_589 as inherit }; + export namespace inputs_589 { + let fg_32: string; + export { fg_32 as fg }; + let bg_32: string; + export { bg_32 as bg }; + let mix_32: string; + export { mix_32 as mix }; + } + export { inputs_589 as inputs }; + export namespace outputs_589 { + let out_578: string; + export { out_578 as out }; + } + export { outputs_589 as outputs }; + } + namespace ND_mix_color4 { + let node_590: string; + export { node_590 as node }; + let inherit_590: null; + export { inherit_590 as inherit }; + export namespace inputs_590 { + let fg_33: string; + export { fg_33 as fg }; + let bg_33: string; + export { bg_33 as bg }; + let mix_33: string; + export { mix_33 as mix }; + } + export { inputs_590 as inputs }; + export namespace outputs_590 { + let out_579: string; + export { out_579 as out }; + } + export { outputs_590 as outputs }; + } + namespace ND_mix_color4_color4 { + let node_591: string; + export { node_591 as node }; + let inherit_591: null; + export { inherit_591 as inherit }; + export namespace inputs_591 { + let fg_34: string; + export { fg_34 as fg }; + let bg_34: string; + export { bg_34 as bg }; + let mix_34: string; + export { mix_34 as mix }; + } + export { inputs_591 as inputs }; + export namespace outputs_591 { + let out_580: string; + export { out_580 as out }; + } + export { outputs_591 as outputs }; + } + namespace ND_mix_vector2 { + let node_592: string; + export { node_592 as node }; + let inherit_592: null; + export { inherit_592 as inherit }; + export namespace inputs_592 { + let fg_35: string; + export { fg_35 as fg }; + let bg_35: string; + export { bg_35 as bg }; + let mix_35: string; + export { mix_35 as mix }; + } + export { inputs_592 as inputs }; + export namespace outputs_592 { + let out_581: string; + export { out_581 as out }; + } + export { outputs_592 as outputs }; + } + namespace ND_mix_vector2_vector2 { + let node_593: string; + export { node_593 as node }; + let inherit_593: null; + export { inherit_593 as inherit }; + export namespace inputs_593 { + let fg_36: string; + export { fg_36 as fg }; + let bg_36: string; + export { bg_36 as bg }; + let mix_36: string; + export { mix_36 as mix }; + } + export { inputs_593 as inputs }; + export namespace outputs_593 { + let out_582: string; + export { out_582 as out }; + } + export { outputs_593 as outputs }; + } + namespace ND_mix_vector3 { + let node_594: string; + export { node_594 as node }; + let inherit_594: null; + export { inherit_594 as inherit }; + export namespace inputs_594 { + let fg_37: string; + export { fg_37 as fg }; + let bg_37: string; + export { bg_37 as bg }; + let mix_37: string; + export { mix_37 as mix }; + } + export { inputs_594 as inputs }; + export namespace outputs_594 { + let out_583: string; + export { out_583 as out }; + } + export { outputs_594 as outputs }; + } + namespace ND_mix_vector3_vector3 { + let node_595: string; + export { node_595 as node }; + let inherit_595: null; + export { inherit_595 as inherit }; + export namespace inputs_595 { + let fg_38: string; + export { fg_38 as fg }; + let bg_38: string; + export { bg_38 as bg }; + let mix_38: string; + export { mix_38 as mix }; + } + export { inputs_595 as inputs }; + export namespace outputs_595 { + let out_584: string; + export { out_584 as out }; + } + export { outputs_595 as outputs }; + } + namespace ND_mix_vector4 { + let node_596: string; + export { node_596 as node }; + let inherit_596: null; + export { inherit_596 as inherit }; + export namespace inputs_596 { + let fg_39: string; + export { fg_39 as fg }; + let bg_39: string; + export { bg_39 as bg }; + let mix_39: string; + export { mix_39 as mix }; + } + export { inputs_596 as inputs }; + export namespace outputs_596 { + let out_585: string; + export { out_585 as out }; + } + export { outputs_596 as outputs }; + } + namespace ND_mix_vector4_vector4 { + let node_597: string; + export { node_597 as node }; + let inherit_597: null; + export { inherit_597 as inherit }; + export namespace inputs_597 { + let fg_40: string; + export { fg_40 as fg }; + let bg_40: string; + export { bg_40 as bg }; + let mix_40: string; + export { mix_40 as mix }; + } + export { inputs_597 as inputs }; + export namespace outputs_597 { + let out_586: string; + export { out_586 as out }; + } + export { outputs_597 as outputs }; + } + namespace ND_mix_surfaceshader { + let node_598: string; + export { node_598 as node }; + let inherit_598: null; + export { inherit_598 as inherit }; + export namespace inputs_598 { + let fg_41: string; + export { fg_41 as fg }; + let bg_41: string; + export { bg_41 as bg }; + let mix_41: string; + export { mix_41 as mix }; + } + export { inputs_598 as inputs }; + export namespace outputs_598 { + let out_587: string; + export { out_587 as out }; + } + export { outputs_598 as outputs }; + } + namespace ND_mix_displacementshader { + let node_599: string; + export { node_599 as node }; + let inherit_599: null; + export { inherit_599 as inherit }; + export namespace inputs_599 { + let fg_42: string; + export { fg_42 as fg }; + let bg_42: string; + export { bg_42 as bg }; + let mix_42: string; + export { mix_42 as mix }; + } + export { inputs_599 as inputs }; + export namespace outputs_599 { + let out_588: string; + export { out_588 as out }; + } + export { outputs_599 as outputs }; + } + namespace ND_mix_volumeshader { + let node_600: string; + export { node_600 as node }; + let inherit_600: null; + export { inherit_600 as inherit }; + export namespace inputs_600 { + let fg_43: string; + export { fg_43 as fg }; + let bg_43: string; + export { bg_43 as bg }; + let mix_43: string; + export { mix_43 as mix }; + } + export { inputs_600 as inputs }; + export namespace outputs_600 { + let out_589: string; + export { out_589 as out }; + } + export { outputs_600 as outputs }; + } + namespace ND_ifgreater_float { + let node_601: string; + export { node_601 as node }; + let inherit_601: null; + export { inherit_601 as inherit }; + export namespace inputs_601 { + export let value1: string; + export let value2: string; + let in1_129: string; + export { in1_129 as in1 }; + let in2_129: string; + export { in2_129 as in2 }; + } + export { inputs_601 as inputs }; + export namespace outputs_601 { + let out_590: string; + export { out_590 as out }; + } + export { outputs_601 as outputs }; + } + namespace ND_ifgreater_integer { + let node_602: string; + export { node_602 as node }; + let inherit_602: null; + export { inherit_602 as inherit }; + export namespace inputs_602 { + let value1_1: string; + export { value1_1 as value1 }; + let value2_1: string; + export { value2_1 as value2 }; + let in1_130: string; + export { in1_130 as in1 }; + let in2_130: string; + export { in2_130 as in2 }; + } + export { inputs_602 as inputs }; + export namespace outputs_602 { + let out_591: string; + export { out_591 as out }; + } + export { outputs_602 as outputs }; + } + namespace ND_ifgreater_color3 { + let node_603: string; + export { node_603 as node }; + let inherit_603: null; + export { inherit_603 as inherit }; + export namespace inputs_603 { + let value1_2: string; + export { value1_2 as value1 }; + let value2_2: string; + export { value2_2 as value2 }; + let in1_131: string; + export { in1_131 as in1 }; + let in2_131: string; + export { in2_131 as in2 }; + } + export { inputs_603 as inputs }; + export namespace outputs_603 { + let out_592: string; + export { out_592 as out }; + } + export { outputs_603 as outputs }; + } + namespace ND_ifgreater_color4 { + let node_604: string; + export { node_604 as node }; + let inherit_604: null; + export { inherit_604 as inherit }; + export namespace inputs_604 { + let value1_3: string; + export { value1_3 as value1 }; + let value2_3: string; + export { value2_3 as value2 }; + let in1_132: string; + export { in1_132 as in1 }; + let in2_132: string; + export { in2_132 as in2 }; + } + export { inputs_604 as inputs }; + export namespace outputs_604 { + let out_593: string; + export { out_593 as out }; + } + export { outputs_604 as outputs }; + } + namespace ND_ifgreater_vector2 { + let node_605: string; + export { node_605 as node }; + let inherit_605: null; + export { inherit_605 as inherit }; + export namespace inputs_605 { + let value1_4: string; + export { value1_4 as value1 }; + let value2_4: string; + export { value2_4 as value2 }; + let in1_133: string; + export { in1_133 as in1 }; + let in2_133: string; + export { in2_133 as in2 }; + } + export { inputs_605 as inputs }; + export namespace outputs_605 { + let out_594: string; + export { out_594 as out }; + } + export { outputs_605 as outputs }; + } + namespace ND_ifgreater_vector3 { + let node_606: string; + export { node_606 as node }; + let inherit_606: null; + export { inherit_606 as inherit }; + export namespace inputs_606 { + let value1_5: string; + export { value1_5 as value1 }; + let value2_5: string; + export { value2_5 as value2 }; + let in1_134: string; + export { in1_134 as in1 }; + let in2_134: string; + export { in2_134 as in2 }; + } + export { inputs_606 as inputs }; + export namespace outputs_606 { + let out_595: string; + export { out_595 as out }; + } + export { outputs_606 as outputs }; + } + namespace ND_ifgreater_vector4 { + let node_607: string; + export { node_607 as node }; + let inherit_607: null; + export { inherit_607 as inherit }; + export namespace inputs_607 { + let value1_6: string; + export { value1_6 as value1 }; + let value2_6: string; + export { value2_6 as value2 }; + let in1_135: string; + export { in1_135 as in1 }; + let in2_135: string; + export { in2_135 as in2 }; + } + export { inputs_607 as inputs }; + export namespace outputs_607 { + let out_596: string; + export { out_596 as out }; + } + export { outputs_607 as outputs }; + } + namespace ND_ifgreater_matrix33 { + let node_608: string; + export { node_608 as node }; + let inherit_608: null; + export { inherit_608 as inherit }; + export namespace inputs_608 { + let value1_7: string; + export { value1_7 as value1 }; + let value2_7: string; + export { value2_7 as value2 }; + let in1_136: string; + export { in1_136 as in1 }; + let in2_136: string; + export { in2_136 as in2 }; + } + export { inputs_608 as inputs }; + export namespace outputs_608 { + let out_597: string; + export { out_597 as out }; + } + export { outputs_608 as outputs }; + } + namespace ND_ifgreater_matrix44 { + let node_609: string; + export { node_609 as node }; + let inherit_609: null; + export { inherit_609 as inherit }; + export namespace inputs_609 { + let value1_8: string; + export { value1_8 as value1 }; + let value2_8: string; + export { value2_8 as value2 }; + let in1_137: string; + export { in1_137 as in1 }; + let in2_137: string; + export { in2_137 as in2 }; + } + export { inputs_609 as inputs }; + export namespace outputs_609 { + let out_598: string; + export { out_598 as out }; + } + export { outputs_609 as outputs }; + } + namespace ND_ifgreater_boolean { + let node_610: string; + export { node_610 as node }; + let inherit_610: null; + export { inherit_610 as inherit }; + export namespace inputs_610 { + let value1_9: string; + export { value1_9 as value1 }; + let value2_9: string; + export { value2_9 as value2 }; + } + export { inputs_610 as inputs }; + export namespace outputs_610 { + let out_599: string; + export { out_599 as out }; + } + export { outputs_610 as outputs }; + } + namespace ND_ifgreater_floatI { + let node_611: string; + export { node_611 as node }; + let inherit_611: null; + export { inherit_611 as inherit }; + export namespace inputs_611 { + let value1_10: string; + export { value1_10 as value1 }; + let value2_10: string; + export { value2_10 as value2 }; + let in1_138: string; + export { in1_138 as in1 }; + let in2_138: string; + export { in2_138 as in2 }; + } + export { inputs_611 as inputs }; + export namespace outputs_611 { + let out_600: string; + export { out_600 as out }; + } + export { outputs_611 as outputs }; + } + namespace ND_ifgreater_integerI { + let node_612: string; + export { node_612 as node }; + let inherit_612: null; + export { inherit_612 as inherit }; + export namespace inputs_612 { + let value1_11: string; + export { value1_11 as value1 }; + let value2_11: string; + export { value2_11 as value2 }; + let in1_139: string; + export { in1_139 as in1 }; + let in2_139: string; + export { in2_139 as in2 }; + } + export { inputs_612 as inputs }; + export namespace outputs_612 { + let out_601: string; + export { out_601 as out }; + } + export { outputs_612 as outputs }; + } + namespace ND_ifgreater_color3I { + let node_613: string; + export { node_613 as node }; + let inherit_613: null; + export { inherit_613 as inherit }; + export namespace inputs_613 { + let value1_12: string; + export { value1_12 as value1 }; + let value2_12: string; + export { value2_12 as value2 }; + let in1_140: string; + export { in1_140 as in1 }; + let in2_140: string; + export { in2_140 as in2 }; + } + export { inputs_613 as inputs }; + export namespace outputs_613 { + let out_602: string; + export { out_602 as out }; + } + export { outputs_613 as outputs }; + } + namespace ND_ifgreater_color4I { + let node_614: string; + export { node_614 as node }; + let inherit_614: null; + export { inherit_614 as inherit }; + export namespace inputs_614 { + let value1_13: string; + export { value1_13 as value1 }; + let value2_13: string; + export { value2_13 as value2 }; + let in1_141: string; + export { in1_141 as in1 }; + let in2_141: string; + export { in2_141 as in2 }; + } + export { inputs_614 as inputs }; + export namespace outputs_614 { + let out_603: string; + export { out_603 as out }; + } + export { outputs_614 as outputs }; + } + namespace ND_ifgreater_vector2I { + let node_615: string; + export { node_615 as node }; + let inherit_615: null; + export { inherit_615 as inherit }; + export namespace inputs_615 { + let value1_14: string; + export { value1_14 as value1 }; + let value2_14: string; + export { value2_14 as value2 }; + let in1_142: string; + export { in1_142 as in1 }; + let in2_142: string; + export { in2_142 as in2 }; + } + export { inputs_615 as inputs }; + export namespace outputs_615 { + let out_604: string; + export { out_604 as out }; + } + export { outputs_615 as outputs }; + } + namespace ND_ifgreater_vector3I { + let node_616: string; + export { node_616 as node }; + let inherit_616: null; + export { inherit_616 as inherit }; + export namespace inputs_616 { + let value1_15: string; + export { value1_15 as value1 }; + let value2_15: string; + export { value2_15 as value2 }; + let in1_143: string; + export { in1_143 as in1 }; + let in2_143: string; + export { in2_143 as in2 }; + } + export { inputs_616 as inputs }; + export namespace outputs_616 { + let out_605: string; + export { out_605 as out }; + } + export { outputs_616 as outputs }; + } + namespace ND_ifgreater_vector4I { + let node_617: string; + export { node_617 as node }; + let inherit_617: null; + export { inherit_617 as inherit }; + export namespace inputs_617 { + let value1_16: string; + export { value1_16 as value1 }; + let value2_16: string; + export { value2_16 as value2 }; + let in1_144: string; + export { in1_144 as in1 }; + let in2_144: string; + export { in2_144 as in2 }; + } + export { inputs_617 as inputs }; + export namespace outputs_617 { + let out_606: string; + export { out_606 as out }; + } + export { outputs_617 as outputs }; + } + namespace ND_ifgreater_matrix33I { + let node_618: string; + export { node_618 as node }; + let inherit_618: null; + export { inherit_618 as inherit }; + export namespace inputs_618 { + let value1_17: string; + export { value1_17 as value1 }; + let value2_17: string; + export { value2_17 as value2 }; + let in1_145: string; + export { in1_145 as in1 }; + let in2_145: string; + export { in2_145 as in2 }; + } + export { inputs_618 as inputs }; + export namespace outputs_618 { + let out_607: string; + export { out_607 as out }; + } + export { outputs_618 as outputs }; + } + namespace ND_ifgreater_matrix44I { + let node_619: string; + export { node_619 as node }; + let inherit_619: null; + export { inherit_619 as inherit }; + export namespace inputs_619 { + let value1_18: string; + export { value1_18 as value1 }; + let value2_18: string; + export { value2_18 as value2 }; + let in1_146: string; + export { in1_146 as in1 }; + let in2_146: string; + export { in2_146 as in2 }; + } + export { inputs_619 as inputs }; + export namespace outputs_619 { + let out_608: string; + export { out_608 as out }; + } + export { outputs_619 as outputs }; + } + namespace ND_ifgreater_booleanI { + let node_620: string; + export { node_620 as node }; + let inherit_620: null; + export { inherit_620 as inherit }; + export namespace inputs_620 { + let value1_19: string; + export { value1_19 as value1 }; + let value2_19: string; + export { value2_19 as value2 }; + } + export { inputs_620 as inputs }; + export namespace outputs_620 { + let out_609: string; + export { out_609 as out }; + } + export { outputs_620 as outputs }; + } + namespace ND_ifgreatereq_float { + let node_621: string; + export { node_621 as node }; + let inherit_621: null; + export { inherit_621 as inherit }; + export namespace inputs_621 { + let value1_20: string; + export { value1_20 as value1 }; + let value2_20: string; + export { value2_20 as value2 }; + let in1_147: string; + export { in1_147 as in1 }; + let in2_147: string; + export { in2_147 as in2 }; + } + export { inputs_621 as inputs }; + export namespace outputs_621 { + let out_610: string; + export { out_610 as out }; + } + export { outputs_621 as outputs }; + } + namespace ND_ifgreatereq_integer { + let node_622: string; + export { node_622 as node }; + let inherit_622: null; + export { inherit_622 as inherit }; + export namespace inputs_622 { + let value1_21: string; + export { value1_21 as value1 }; + let value2_21: string; + export { value2_21 as value2 }; + let in1_148: string; + export { in1_148 as in1 }; + let in2_148: string; + export { in2_148 as in2 }; + } + export { inputs_622 as inputs }; + export namespace outputs_622 { + let out_611: string; + export { out_611 as out }; + } + export { outputs_622 as outputs }; + } + namespace ND_ifgreatereq_color3 { + let node_623: string; + export { node_623 as node }; + let inherit_623: null; + export { inherit_623 as inherit }; + export namespace inputs_623 { + let value1_22: string; + export { value1_22 as value1 }; + let value2_22: string; + export { value2_22 as value2 }; + let in1_149: string; + export { in1_149 as in1 }; + let in2_149: string; + export { in2_149 as in2 }; + } + export { inputs_623 as inputs }; + export namespace outputs_623 { + let out_612: string; + export { out_612 as out }; + } + export { outputs_623 as outputs }; + } + namespace ND_ifgreatereq_color4 { + let node_624: string; + export { node_624 as node }; + let inherit_624: null; + export { inherit_624 as inherit }; + export namespace inputs_624 { + let value1_23: string; + export { value1_23 as value1 }; + let value2_23: string; + export { value2_23 as value2 }; + let in1_150: string; + export { in1_150 as in1 }; + let in2_150: string; + export { in2_150 as in2 }; + } + export { inputs_624 as inputs }; + export namespace outputs_624 { + let out_613: string; + export { out_613 as out }; + } + export { outputs_624 as outputs }; + } + namespace ND_ifgreatereq_vector2 { + let node_625: string; + export { node_625 as node }; + let inherit_625: null; + export { inherit_625 as inherit }; + export namespace inputs_625 { + let value1_24: string; + export { value1_24 as value1 }; + let value2_24: string; + export { value2_24 as value2 }; + let in1_151: string; + export { in1_151 as in1 }; + let in2_151: string; + export { in2_151 as in2 }; + } + export { inputs_625 as inputs }; + export namespace outputs_625 { + let out_614: string; + export { out_614 as out }; + } + export { outputs_625 as outputs }; + } + namespace ND_ifgreatereq_vector3 { + let node_626: string; + export { node_626 as node }; + let inherit_626: null; + export { inherit_626 as inherit }; + export namespace inputs_626 { + let value1_25: string; + export { value1_25 as value1 }; + let value2_25: string; + export { value2_25 as value2 }; + let in1_152: string; + export { in1_152 as in1 }; + let in2_152: string; + export { in2_152 as in2 }; + } + export { inputs_626 as inputs }; + export namespace outputs_626 { + let out_615: string; + export { out_615 as out }; + } + export { outputs_626 as outputs }; + } + namespace ND_ifgreatereq_vector4 { + let node_627: string; + export { node_627 as node }; + let inherit_627: null; + export { inherit_627 as inherit }; + export namespace inputs_627 { + let value1_26: string; + export { value1_26 as value1 }; + let value2_26: string; + export { value2_26 as value2 }; + let in1_153: string; + export { in1_153 as in1 }; + let in2_153: string; + export { in2_153 as in2 }; + } + export { inputs_627 as inputs }; + export namespace outputs_627 { + let out_616: string; + export { out_616 as out }; + } + export { outputs_627 as outputs }; + } + namespace ND_ifgreatereq_matrix33 { + let node_628: string; + export { node_628 as node }; + let inherit_628: null; + export { inherit_628 as inherit }; + export namespace inputs_628 { + let value1_27: string; + export { value1_27 as value1 }; + let value2_27: string; + export { value2_27 as value2 }; + let in1_154: string; + export { in1_154 as in1 }; + let in2_154: string; + export { in2_154 as in2 }; + } + export { inputs_628 as inputs }; + export namespace outputs_628 { + let out_617: string; + export { out_617 as out }; + } + export { outputs_628 as outputs }; + } + namespace ND_ifgreatereq_matrix44 { + let node_629: string; + export { node_629 as node }; + let inherit_629: null; + export { inherit_629 as inherit }; + export namespace inputs_629 { + let value1_28: string; + export { value1_28 as value1 }; + let value2_28: string; + export { value2_28 as value2 }; + let in1_155: string; + export { in1_155 as in1 }; + let in2_155: string; + export { in2_155 as in2 }; + } + export { inputs_629 as inputs }; + export namespace outputs_629 { + let out_618: string; + export { out_618 as out }; + } + export { outputs_629 as outputs }; + } + namespace ND_ifgreatereq_boolean { + let node_630: string; + export { node_630 as node }; + let inherit_630: null; + export { inherit_630 as inherit }; + export namespace inputs_630 { + let value1_29: string; + export { value1_29 as value1 }; + let value2_29: string; + export { value2_29 as value2 }; + } + export { inputs_630 as inputs }; + export namespace outputs_630 { + let out_619: string; + export { out_619 as out }; + } + export { outputs_630 as outputs }; + } + namespace ND_ifgreatereq_floatI { + let node_631: string; + export { node_631 as node }; + let inherit_631: null; + export { inherit_631 as inherit }; + export namespace inputs_631 { + let value1_30: string; + export { value1_30 as value1 }; + let value2_30: string; + export { value2_30 as value2 }; + let in1_156: string; + export { in1_156 as in1 }; + let in2_156: string; + export { in2_156 as in2 }; + } + export { inputs_631 as inputs }; + export namespace outputs_631 { + let out_620: string; + export { out_620 as out }; + } + export { outputs_631 as outputs }; + } + namespace ND_ifgreatereq_integerI { + let node_632: string; + export { node_632 as node }; + let inherit_632: null; + export { inherit_632 as inherit }; + export namespace inputs_632 { + let value1_31: string; + export { value1_31 as value1 }; + let value2_31: string; + export { value2_31 as value2 }; + let in1_157: string; + export { in1_157 as in1 }; + let in2_157: string; + export { in2_157 as in2 }; + } + export { inputs_632 as inputs }; + export namespace outputs_632 { + let out_621: string; + export { out_621 as out }; + } + export { outputs_632 as outputs }; + } + namespace ND_ifgreatereq_color3I { + let node_633: string; + export { node_633 as node }; + let inherit_633: null; + export { inherit_633 as inherit }; + export namespace inputs_633 { + let value1_32: string; + export { value1_32 as value1 }; + let value2_32: string; + export { value2_32 as value2 }; + let in1_158: string; + export { in1_158 as in1 }; + let in2_158: string; + export { in2_158 as in2 }; + } + export { inputs_633 as inputs }; + export namespace outputs_633 { + let out_622: string; + export { out_622 as out }; + } + export { outputs_633 as outputs }; + } + namespace ND_ifgreatereq_color4I { + let node_634: string; + export { node_634 as node }; + let inherit_634: null; + export { inherit_634 as inherit }; + export namespace inputs_634 { + let value1_33: string; + export { value1_33 as value1 }; + let value2_33: string; + export { value2_33 as value2 }; + let in1_159: string; + export { in1_159 as in1 }; + let in2_159: string; + export { in2_159 as in2 }; + } + export { inputs_634 as inputs }; + export namespace outputs_634 { + let out_623: string; + export { out_623 as out }; + } + export { outputs_634 as outputs }; + } + namespace ND_ifgreatereq_vector2I { + let node_635: string; + export { node_635 as node }; + let inherit_635: null; + export { inherit_635 as inherit }; + export namespace inputs_635 { + let value1_34: string; + export { value1_34 as value1 }; + let value2_34: string; + export { value2_34 as value2 }; + let in1_160: string; + export { in1_160 as in1 }; + let in2_160: string; + export { in2_160 as in2 }; + } + export { inputs_635 as inputs }; + export namespace outputs_635 { + let out_624: string; + export { out_624 as out }; + } + export { outputs_635 as outputs }; + } + namespace ND_ifgreatereq_vector3I { + let node_636: string; + export { node_636 as node }; + let inherit_636: null; + export { inherit_636 as inherit }; + export namespace inputs_636 { + let value1_35: string; + export { value1_35 as value1 }; + let value2_35: string; + export { value2_35 as value2 }; + let in1_161: string; + export { in1_161 as in1 }; + let in2_161: string; + export { in2_161 as in2 }; + } + export { inputs_636 as inputs }; + export namespace outputs_636 { + let out_625: string; + export { out_625 as out }; + } + export { outputs_636 as outputs }; + } + namespace ND_ifgreatereq_vector4I { + let node_637: string; + export { node_637 as node }; + let inherit_637: null; + export { inherit_637 as inherit }; + export namespace inputs_637 { + let value1_36: string; + export { value1_36 as value1 }; + let value2_36: string; + export { value2_36 as value2 }; + let in1_162: string; + export { in1_162 as in1 }; + let in2_162: string; + export { in2_162 as in2 }; + } + export { inputs_637 as inputs }; + export namespace outputs_637 { + let out_626: string; + export { out_626 as out }; + } + export { outputs_637 as outputs }; + } + namespace ND_ifgreatereq_matrix33I { + let node_638: string; + export { node_638 as node }; + let inherit_638: null; + export { inherit_638 as inherit }; + export namespace inputs_638 { + let value1_37: string; + export { value1_37 as value1 }; + let value2_37: string; + export { value2_37 as value2 }; + let in1_163: string; + export { in1_163 as in1 }; + let in2_163: string; + export { in2_163 as in2 }; + } + export { inputs_638 as inputs }; + export namespace outputs_638 { + let out_627: string; + export { out_627 as out }; + } + export { outputs_638 as outputs }; + } + namespace ND_ifgreatereq_matrix44I { + let node_639: string; + export { node_639 as node }; + let inherit_639: null; + export { inherit_639 as inherit }; + export namespace inputs_639 { + let value1_38: string; + export { value1_38 as value1 }; + let value2_38: string; + export { value2_38 as value2 }; + let in1_164: string; + export { in1_164 as in1 }; + let in2_164: string; + export { in2_164 as in2 }; + } + export { inputs_639 as inputs }; + export namespace outputs_639 { + let out_628: string; + export { out_628 as out }; + } + export { outputs_639 as outputs }; + } + namespace ND_ifgreatereq_booleanI { + let node_640: string; + export { node_640 as node }; + let inherit_640: null; + export { inherit_640 as inherit }; + export namespace inputs_640 { + let value1_39: string; + export { value1_39 as value1 }; + let value2_39: string; + export { value2_39 as value2 }; + } + export { inputs_640 as inputs }; + export namespace outputs_640 { + let out_629: string; + export { out_629 as out }; + } + export { outputs_640 as outputs }; + } + namespace ND_ifequal_float { + let node_641: string; + export { node_641 as node }; + let inherit_641: null; + export { inherit_641 as inherit }; + export namespace inputs_641 { + let value1_40: string; + export { value1_40 as value1 }; + let value2_40: string; + export { value2_40 as value2 }; + let in1_165: string; + export { in1_165 as in1 }; + let in2_165: string; + export { in2_165 as in2 }; + } + export { inputs_641 as inputs }; + export namespace outputs_641 { + let out_630: string; + export { out_630 as out }; + } + export { outputs_641 as outputs }; + } + namespace ND_ifequal_integer { + let node_642: string; + export { node_642 as node }; + let inherit_642: null; + export { inherit_642 as inherit }; + export namespace inputs_642 { + let value1_41: string; + export { value1_41 as value1 }; + let value2_41: string; + export { value2_41 as value2 }; + let in1_166: string; + export { in1_166 as in1 }; + let in2_166: string; + export { in2_166 as in2 }; + } + export { inputs_642 as inputs }; + export namespace outputs_642 { + let out_631: string; + export { out_631 as out }; + } + export { outputs_642 as outputs }; + } + namespace ND_ifequal_color3 { + let node_643: string; + export { node_643 as node }; + let inherit_643: null; + export { inherit_643 as inherit }; + export namespace inputs_643 { + let value1_42: string; + export { value1_42 as value1 }; + let value2_42: string; + export { value2_42 as value2 }; + let in1_167: string; + export { in1_167 as in1 }; + let in2_167: string; + export { in2_167 as in2 }; + } + export { inputs_643 as inputs }; + export namespace outputs_643 { + let out_632: string; + export { out_632 as out }; + } + export { outputs_643 as outputs }; + } + namespace ND_ifequal_color4 { + let node_644: string; + export { node_644 as node }; + let inherit_644: null; + export { inherit_644 as inherit }; + export namespace inputs_644 { + let value1_43: string; + export { value1_43 as value1 }; + let value2_43: string; + export { value2_43 as value2 }; + let in1_168: string; + export { in1_168 as in1 }; + let in2_168: string; + export { in2_168 as in2 }; + } + export { inputs_644 as inputs }; + export namespace outputs_644 { + let out_633: string; + export { out_633 as out }; + } + export { outputs_644 as outputs }; + } + namespace ND_ifequal_vector2 { + let node_645: string; + export { node_645 as node }; + let inherit_645: null; + export { inherit_645 as inherit }; + export namespace inputs_645 { + let value1_44: string; + export { value1_44 as value1 }; + let value2_44: string; + export { value2_44 as value2 }; + let in1_169: string; + export { in1_169 as in1 }; + let in2_169: string; + export { in2_169 as in2 }; + } + export { inputs_645 as inputs }; + export namespace outputs_645 { + let out_634: string; + export { out_634 as out }; + } + export { outputs_645 as outputs }; + } + namespace ND_ifequal_vector3 { + let node_646: string; + export { node_646 as node }; + let inherit_646: null; + export { inherit_646 as inherit }; + export namespace inputs_646 { + let value1_45: string; + export { value1_45 as value1 }; + let value2_45: string; + export { value2_45 as value2 }; + let in1_170: string; + export { in1_170 as in1 }; + let in2_170: string; + export { in2_170 as in2 }; + } + export { inputs_646 as inputs }; + export namespace outputs_646 { + let out_635: string; + export { out_635 as out }; + } + export { outputs_646 as outputs }; + } + namespace ND_ifequal_vector4 { + let node_647: string; + export { node_647 as node }; + let inherit_647: null; + export { inherit_647 as inherit }; + export namespace inputs_647 { + let value1_46: string; + export { value1_46 as value1 }; + let value2_46: string; + export { value2_46 as value2 }; + let in1_171: string; + export { in1_171 as in1 }; + let in2_171: string; + export { in2_171 as in2 }; + } + export { inputs_647 as inputs }; + export namespace outputs_647 { + let out_636: string; + export { out_636 as out }; + } + export { outputs_647 as outputs }; + } + namespace ND_ifequal_matrix33 { + let node_648: string; + export { node_648 as node }; + let inherit_648: null; + export { inherit_648 as inherit }; + export namespace inputs_648 { + let value1_47: string; + export { value1_47 as value1 }; + let value2_47: string; + export { value2_47 as value2 }; + let in1_172: string; + export { in1_172 as in1 }; + let in2_172: string; + export { in2_172 as in2 }; + } + export { inputs_648 as inputs }; + export namespace outputs_648 { + let out_637: string; + export { out_637 as out }; + } + export { outputs_648 as outputs }; + } + namespace ND_ifequal_matrix44 { + let node_649: string; + export { node_649 as node }; + let inherit_649: null; + export { inherit_649 as inherit }; + export namespace inputs_649 { + let value1_48: string; + export { value1_48 as value1 }; + let value2_48: string; + export { value2_48 as value2 }; + let in1_173: string; + export { in1_173 as in1 }; + let in2_173: string; + export { in2_173 as in2 }; + } + export { inputs_649 as inputs }; + export namespace outputs_649 { + let out_638: string; + export { out_638 as out }; + } + export { outputs_649 as outputs }; + } + namespace ND_ifequal_boolean { + let node_650: string; + export { node_650 as node }; + let inherit_650: null; + export { inherit_650 as inherit }; + export namespace inputs_650 { + let value1_49: string; + export { value1_49 as value1 }; + let value2_49: string; + export { value2_49 as value2 }; + } + export { inputs_650 as inputs }; + export namespace outputs_650 { + let out_639: string; + export { out_639 as out }; + } + export { outputs_650 as outputs }; + } + namespace ND_ifequal_floatI { + let node_651: string; + export { node_651 as node }; + let inherit_651: null; + export { inherit_651 as inherit }; + export namespace inputs_651 { + let value1_50: string; + export { value1_50 as value1 }; + let value2_50: string; + export { value2_50 as value2 }; + let in1_174: string; + export { in1_174 as in1 }; + let in2_174: string; + export { in2_174 as in2 }; + } + export { inputs_651 as inputs }; + export namespace outputs_651 { + let out_640: string; + export { out_640 as out }; + } + export { outputs_651 as outputs }; + } + namespace ND_ifequal_integerI { + let node_652: string; + export { node_652 as node }; + let inherit_652: null; + export { inherit_652 as inherit }; + export namespace inputs_652 { + let value1_51: string; + export { value1_51 as value1 }; + let value2_51: string; + export { value2_51 as value2 }; + let in1_175: string; + export { in1_175 as in1 }; + let in2_175: string; + export { in2_175 as in2 }; + } + export { inputs_652 as inputs }; + export namespace outputs_652 { + let out_641: string; + export { out_641 as out }; + } + export { outputs_652 as outputs }; + } + namespace ND_ifequal_color3I { + let node_653: string; + export { node_653 as node }; + let inherit_653: null; + export { inherit_653 as inherit }; + export namespace inputs_653 { + let value1_52: string; + export { value1_52 as value1 }; + let value2_52: string; + export { value2_52 as value2 }; + let in1_176: string; + export { in1_176 as in1 }; + let in2_176: string; + export { in2_176 as in2 }; + } + export { inputs_653 as inputs }; + export namespace outputs_653 { + let out_642: string; + export { out_642 as out }; + } + export { outputs_653 as outputs }; + } + namespace ND_ifequal_color4I { + let node_654: string; + export { node_654 as node }; + let inherit_654: null; + export { inherit_654 as inherit }; + export namespace inputs_654 { + let value1_53: string; + export { value1_53 as value1 }; + let value2_53: string; + export { value2_53 as value2 }; + let in1_177: string; + export { in1_177 as in1 }; + let in2_177: string; + export { in2_177 as in2 }; + } + export { inputs_654 as inputs }; + export namespace outputs_654 { + let out_643: string; + export { out_643 as out }; + } + export { outputs_654 as outputs }; + } + namespace ND_ifequal_vector2I { + let node_655: string; + export { node_655 as node }; + let inherit_655: null; + export { inherit_655 as inherit }; + export namespace inputs_655 { + let value1_54: string; + export { value1_54 as value1 }; + let value2_54: string; + export { value2_54 as value2 }; + let in1_178: string; + export { in1_178 as in1 }; + let in2_178: string; + export { in2_178 as in2 }; + } + export { inputs_655 as inputs }; + export namespace outputs_655 { + let out_644: string; + export { out_644 as out }; + } + export { outputs_655 as outputs }; + } + namespace ND_ifequal_vector3I { + let node_656: string; + export { node_656 as node }; + let inherit_656: null; + export { inherit_656 as inherit }; + export namespace inputs_656 { + let value1_55: string; + export { value1_55 as value1 }; + let value2_55: string; + export { value2_55 as value2 }; + let in1_179: string; + export { in1_179 as in1 }; + let in2_179: string; + export { in2_179 as in2 }; + } + export { inputs_656 as inputs }; + export namespace outputs_656 { + let out_645: string; + export { out_645 as out }; + } + export { outputs_656 as outputs }; + } + namespace ND_ifequal_vector4I { + let node_657: string; + export { node_657 as node }; + let inherit_657: null; + export { inherit_657 as inherit }; + export namespace inputs_657 { + let value1_56: string; + export { value1_56 as value1 }; + let value2_56: string; + export { value2_56 as value2 }; + let in1_180: string; + export { in1_180 as in1 }; + let in2_180: string; + export { in2_180 as in2 }; + } + export { inputs_657 as inputs }; + export namespace outputs_657 { + let out_646: string; + export { out_646 as out }; + } + export { outputs_657 as outputs }; + } + namespace ND_ifequal_matrix33I { + let node_658: string; + export { node_658 as node }; + let inherit_658: null; + export { inherit_658 as inherit }; + export namespace inputs_658 { + let value1_57: string; + export { value1_57 as value1 }; + let value2_57: string; + export { value2_57 as value2 }; + let in1_181: string; + export { in1_181 as in1 }; + let in2_181: string; + export { in2_181 as in2 }; + } + export { inputs_658 as inputs }; + export namespace outputs_658 { + let out_647: string; + export { out_647 as out }; + } + export { outputs_658 as outputs }; + } + namespace ND_ifequal_matrix44I { + let node_659: string; + export { node_659 as node }; + let inherit_659: null; + export { inherit_659 as inherit }; + export namespace inputs_659 { + let value1_58: string; + export { value1_58 as value1 }; + let value2_58: string; + export { value2_58 as value2 }; + let in1_182: string; + export { in1_182 as in1 }; + let in2_182: string; + export { in2_182 as in2 }; + } + export { inputs_659 as inputs }; + export namespace outputs_659 { + let out_648: string; + export { out_648 as out }; + } + export { outputs_659 as outputs }; + } + namespace ND_ifequal_booleanI { + let node_660: string; + export { node_660 as node }; + let inherit_660: null; + export { inherit_660 as inherit }; + export namespace inputs_660 { + let value1_59: string; + export { value1_59 as value1 }; + let value2_59: string; + export { value2_59 as value2 }; + } + export { inputs_660 as inputs }; + export namespace outputs_660 { + let out_649: string; + export { out_649 as out }; + } + export { outputs_660 as outputs }; + } + namespace ND_ifequal_floatB { + let node_661: string; + export { node_661 as node }; + let inherit_661: null; + export { inherit_661 as inherit }; + export namespace inputs_661 { + let value1_60: string; + export { value1_60 as value1 }; + let value2_60: string; + export { value2_60 as value2 }; + let in1_183: string; + export { in1_183 as in1 }; + let in2_183: string; + export { in2_183 as in2 }; + } + export { inputs_661 as inputs }; + export namespace outputs_661 { + let out_650: string; + export { out_650 as out }; + } + export { outputs_661 as outputs }; + } + namespace ND_ifequal_integerB { + let node_662: string; + export { node_662 as node }; + let inherit_662: null; + export { inherit_662 as inherit }; + export namespace inputs_662 { + let value1_61: string; + export { value1_61 as value1 }; + let value2_61: string; + export { value2_61 as value2 }; + let in1_184: string; + export { in1_184 as in1 }; + let in2_184: string; + export { in2_184 as in2 }; + } + export { inputs_662 as inputs }; + export namespace outputs_662 { + let out_651: string; + export { out_651 as out }; + } + export { outputs_662 as outputs }; + } + namespace ND_ifequal_color3B { + let node_663: string; + export { node_663 as node }; + let inherit_663: null; + export { inherit_663 as inherit }; + export namespace inputs_663 { + let value1_62: string; + export { value1_62 as value1 }; + let value2_62: string; + export { value2_62 as value2 }; + let in1_185: string; + export { in1_185 as in1 }; + let in2_185: string; + export { in2_185 as in2 }; + } + export { inputs_663 as inputs }; + export namespace outputs_663 { + let out_652: string; + export { out_652 as out }; + } + export { outputs_663 as outputs }; + } + namespace ND_ifequal_color4B { + let node_664: string; + export { node_664 as node }; + let inherit_664: null; + export { inherit_664 as inherit }; + export namespace inputs_664 { + let value1_63: string; + export { value1_63 as value1 }; + let value2_63: string; + export { value2_63 as value2 }; + let in1_186: string; + export { in1_186 as in1 }; + let in2_186: string; + export { in2_186 as in2 }; + } + export { inputs_664 as inputs }; + export namespace outputs_664 { + let out_653: string; + export { out_653 as out }; + } + export { outputs_664 as outputs }; + } + namespace ND_ifequal_vector2B { + let node_665: string; + export { node_665 as node }; + let inherit_665: null; + export { inherit_665 as inherit }; + export namespace inputs_665 { + let value1_64: string; + export { value1_64 as value1 }; + let value2_64: string; + export { value2_64 as value2 }; + let in1_187: string; + export { in1_187 as in1 }; + let in2_187: string; + export { in2_187 as in2 }; + } + export { inputs_665 as inputs }; + export namespace outputs_665 { + let out_654: string; + export { out_654 as out }; + } + export { outputs_665 as outputs }; + } + namespace ND_ifequal_vector3B { + let node_666: string; + export { node_666 as node }; + let inherit_666: null; + export { inherit_666 as inherit }; + export namespace inputs_666 { + let value1_65: string; + export { value1_65 as value1 }; + let value2_65: string; + export { value2_65 as value2 }; + let in1_188: string; + export { in1_188 as in1 }; + let in2_188: string; + export { in2_188 as in2 }; + } + export { inputs_666 as inputs }; + export namespace outputs_666 { + let out_655: string; + export { out_655 as out }; + } + export { outputs_666 as outputs }; + } + namespace ND_ifequal_vector4B { + let node_667: string; + export { node_667 as node }; + let inherit_667: null; + export { inherit_667 as inherit }; + export namespace inputs_667 { + let value1_66: string; + export { value1_66 as value1 }; + let value2_66: string; + export { value2_66 as value2 }; + let in1_189: string; + export { in1_189 as in1 }; + let in2_189: string; + export { in2_189 as in2 }; + } + export { inputs_667 as inputs }; + export namespace outputs_667 { + let out_656: string; + export { out_656 as out }; + } + export { outputs_667 as outputs }; + } + namespace ND_ifequal_matrix33B { + let node_668: string; + export { node_668 as node }; + let inherit_668: null; + export { inherit_668 as inherit }; + export namespace inputs_668 { + let value1_67: string; + export { value1_67 as value1 }; + let value2_67: string; + export { value2_67 as value2 }; + let in1_190: string; + export { in1_190 as in1 }; + let in2_190: string; + export { in2_190 as in2 }; + } + export { inputs_668 as inputs }; + export namespace outputs_668 { + let out_657: string; + export { out_657 as out }; + } + export { outputs_668 as outputs }; + } + namespace ND_ifequal_matrix44B { + let node_669: string; + export { node_669 as node }; + let inherit_669: null; + export { inherit_669 as inherit }; + export namespace inputs_669 { + let value1_68: string; + export { value1_68 as value1 }; + let value2_68: string; + export { value2_68 as value2 }; + let in1_191: string; + export { in1_191 as in1 }; + let in2_191: string; + export { in2_191 as in2 }; + } + export { inputs_669 as inputs }; + export namespace outputs_669 { + let out_658: string; + export { out_658 as out }; + } + export { outputs_669 as outputs }; + } + namespace ND_ifequal_booleanB { + let node_670: string; + export { node_670 as node }; + let inherit_670: null; + export { inherit_670 as inherit }; + export namespace inputs_670 { + let value1_69: string; + export { value1_69 as value1 }; + let value2_69: string; + export { value2_69 as value2 }; + } + export { inputs_670 as inputs }; + export namespace outputs_670 { + let out_659: string; + export { out_659 as out }; + } + export { outputs_670 as outputs }; + } + namespace ND_switch_float { + let node_671: string; + export { node_671 as node }; + let inherit_671: null; + export { inherit_671 as inherit }; + export namespace inputs_671 { + let in1_192: string; + export { in1_192 as in1 }; + let in2_192: string; + export { in2_192 as in2 }; + export let in3: string; + export let in4: string; + export let in5: string; + export let in6: string; + export let in7: string; + export let in8: string; + export let in9: string; + export let in10: string; + export let which: string; + } + export { inputs_671 as inputs }; + export namespace outputs_671 { + let out_660: string; + export { out_660 as out }; + } + export { outputs_671 as outputs }; + } + namespace ND_switch_color3 { + let node_672: string; + export { node_672 as node }; + let inherit_672: null; + export { inherit_672 as inherit }; + export namespace inputs_672 { + let in1_193: string; + export { in1_193 as in1 }; + let in2_193: string; + export { in2_193 as in2 }; + let in3_1: string; + export { in3_1 as in3 }; + let in4_1: string; + export { in4_1 as in4 }; + let in5_1: string; + export { in5_1 as in5 }; + let in6_1: string; + export { in6_1 as in6 }; + let in7_1: string; + export { in7_1 as in7 }; + let in8_1: string; + export { in8_1 as in8 }; + let in9_1: string; + export { in9_1 as in9 }; + let in10_1: string; + export { in10_1 as in10 }; + let which_1: string; + export { which_1 as which }; + } + export { inputs_672 as inputs }; + export namespace outputs_672 { + let out_661: string; + export { out_661 as out }; + } + export { outputs_672 as outputs }; + } + namespace ND_switch_color4 { + let node_673: string; + export { node_673 as node }; + let inherit_673: null; + export { inherit_673 as inherit }; + export namespace inputs_673 { + let in1_194: string; + export { in1_194 as in1 }; + let in2_194: string; + export { in2_194 as in2 }; + let in3_2: string; + export { in3_2 as in3 }; + let in4_2: string; + export { in4_2 as in4 }; + let in5_2: string; + export { in5_2 as in5 }; + let in6_2: string; + export { in6_2 as in6 }; + let in7_2: string; + export { in7_2 as in7 }; + let in8_2: string; + export { in8_2 as in8 }; + let in9_2: string; + export { in9_2 as in9 }; + let in10_2: string; + export { in10_2 as in10 }; + let which_2: string; + export { which_2 as which }; + } + export { inputs_673 as inputs }; + export namespace outputs_673 { + let out_662: string; + export { out_662 as out }; + } + export { outputs_673 as outputs }; + } + namespace ND_switch_vector2 { + let node_674: string; + export { node_674 as node }; + let inherit_674: null; + export { inherit_674 as inherit }; + export namespace inputs_674 { + let in1_195: string; + export { in1_195 as in1 }; + let in2_195: string; + export { in2_195 as in2 }; + let in3_3: string; + export { in3_3 as in3 }; + let in4_3: string; + export { in4_3 as in4 }; + let in5_3: string; + export { in5_3 as in5 }; + let in6_3: string; + export { in6_3 as in6 }; + let in7_3: string; + export { in7_3 as in7 }; + let in8_3: string; + export { in8_3 as in8 }; + let in9_3: string; + export { in9_3 as in9 }; + let in10_3: string; + export { in10_3 as in10 }; + let which_3: string; + export { which_3 as which }; + } + export { inputs_674 as inputs }; + export namespace outputs_674 { + let out_663: string; + export { out_663 as out }; + } + export { outputs_674 as outputs }; + } + namespace ND_switch_vector3 { + let node_675: string; + export { node_675 as node }; + let inherit_675: null; + export { inherit_675 as inherit }; + export namespace inputs_675 { + let in1_196: string; + export { in1_196 as in1 }; + let in2_196: string; + export { in2_196 as in2 }; + let in3_4: string; + export { in3_4 as in3 }; + let in4_4: string; + export { in4_4 as in4 }; + let in5_4: string; + export { in5_4 as in5 }; + let in6_4: string; + export { in6_4 as in6 }; + let in7_4: string; + export { in7_4 as in7 }; + let in8_4: string; + export { in8_4 as in8 }; + let in9_4: string; + export { in9_4 as in9 }; + let in10_4: string; + export { in10_4 as in10 }; + let which_4: string; + export { which_4 as which }; + } + export { inputs_675 as inputs }; + export namespace outputs_675 { + let out_664: string; + export { out_664 as out }; + } + export { outputs_675 as outputs }; + } + namespace ND_switch_vector4 { + let node_676: string; + export { node_676 as node }; + let inherit_676: null; + export { inherit_676 as inherit }; + export namespace inputs_676 { + let in1_197: string; + export { in1_197 as in1 }; + let in2_197: string; + export { in2_197 as in2 }; + let in3_5: string; + export { in3_5 as in3 }; + let in4_5: string; + export { in4_5 as in4 }; + let in5_5: string; + export { in5_5 as in5 }; + let in6_5: string; + export { in6_5 as in6 }; + let in7_5: string; + export { in7_5 as in7 }; + let in8_5: string; + export { in8_5 as in8 }; + let in9_5: string; + export { in9_5 as in9 }; + let in10_5: string; + export { in10_5 as in10 }; + let which_5: string; + export { which_5 as which }; + } + export { inputs_676 as inputs }; + export namespace outputs_676 { + let out_665: string; + export { out_665 as out }; + } + export { outputs_676 as outputs }; + } + namespace ND_switch_matrix33 { + let node_677: string; + export { node_677 as node }; + let inherit_677: null; + export { inherit_677 as inherit }; + export namespace inputs_677 { + let in1_198: string; + export { in1_198 as in1 }; + let in2_198: string; + export { in2_198 as in2 }; + let in3_6: string; + export { in3_6 as in3 }; + let in4_6: string; + export { in4_6 as in4 }; + let in5_6: string; + export { in5_6 as in5 }; + let in6_6: string; + export { in6_6 as in6 }; + let in7_6: string; + export { in7_6 as in7 }; + let in8_6: string; + export { in8_6 as in8 }; + let in9_6: string; + export { in9_6 as in9 }; + let in10_6: string; + export { in10_6 as in10 }; + let which_6: string; + export { which_6 as which }; + } + export { inputs_677 as inputs }; + export namespace outputs_677 { + let out_666: string; + export { out_666 as out }; + } + export { outputs_677 as outputs }; + } + namespace ND_switch_matrix44 { + let node_678: string; + export { node_678 as node }; + let inherit_678: null; + export { inherit_678 as inherit }; + export namespace inputs_678 { + let in1_199: string; + export { in1_199 as in1 }; + let in2_199: string; + export { in2_199 as in2 }; + let in3_7: string; + export { in3_7 as in3 }; + let in4_7: string; + export { in4_7 as in4 }; + let in5_7: string; + export { in5_7 as in5 }; + let in6_7: string; + export { in6_7 as in6 }; + let in7_7: string; + export { in7_7 as in7 }; + let in8_7: string; + export { in8_7 as in8 }; + let in9_7: string; + export { in9_7 as in9 }; + let in10_7: string; + export { in10_7 as in10 }; + let which_7: string; + export { which_7 as which }; + } + export { inputs_678 as inputs }; + export namespace outputs_678 { + let out_667: string; + export { out_667 as out }; + } + export { outputs_678 as outputs }; + } + namespace ND_switch_floatI { + let node_679: string; + export { node_679 as node }; + let inherit_679: null; + export { inherit_679 as inherit }; + export namespace inputs_679 { + let in1_200: string; + export { in1_200 as in1 }; + let in2_200: string; + export { in2_200 as in2 }; + let in3_8: string; + export { in3_8 as in3 }; + let in4_8: string; + export { in4_8 as in4 }; + let in5_8: string; + export { in5_8 as in5 }; + let in6_8: string; + export { in6_8 as in6 }; + let in7_8: string; + export { in7_8 as in7 }; + let in8_8: string; + export { in8_8 as in8 }; + let in9_8: string; + export { in9_8 as in9 }; + let in10_8: string; + export { in10_8 as in10 }; + let which_8: string; + export { which_8 as which }; + } + export { inputs_679 as inputs }; + export namespace outputs_679 { + let out_668: string; + export { out_668 as out }; + } + export { outputs_679 as outputs }; + } + namespace ND_switch_color3I { + let node_680: string; + export { node_680 as node }; + let inherit_680: null; + export { inherit_680 as inherit }; + export namespace inputs_680 { + let in1_201: string; + export { in1_201 as in1 }; + let in2_201: string; + export { in2_201 as in2 }; + let in3_9: string; + export { in3_9 as in3 }; + let in4_9: string; + export { in4_9 as in4 }; + let in5_9: string; + export { in5_9 as in5 }; + let in6_9: string; + export { in6_9 as in6 }; + let in7_9: string; + export { in7_9 as in7 }; + let in8_9: string; + export { in8_9 as in8 }; + let in9_9: string; + export { in9_9 as in9 }; + let in10_9: string; + export { in10_9 as in10 }; + let which_9: string; + export { which_9 as which }; + } + export { inputs_680 as inputs }; + export namespace outputs_680 { + let out_669: string; + export { out_669 as out }; + } + export { outputs_680 as outputs }; + } + namespace ND_switch_color4I { + let node_681: string; + export { node_681 as node }; + let inherit_681: null; + export { inherit_681 as inherit }; + export namespace inputs_681 { + let in1_202: string; + export { in1_202 as in1 }; + let in2_202: string; + export { in2_202 as in2 }; + let in3_10: string; + export { in3_10 as in3 }; + let in4_10: string; + export { in4_10 as in4 }; + let in5_10: string; + export { in5_10 as in5 }; + let in6_10: string; + export { in6_10 as in6 }; + let in7_10: string; + export { in7_10 as in7 }; + let in8_10: string; + export { in8_10 as in8 }; + let in9_10: string; + export { in9_10 as in9 }; + let in10_10: string; + export { in10_10 as in10 }; + let which_10: string; + export { which_10 as which }; + } + export { inputs_681 as inputs }; + export namespace outputs_681 { + let out_670: string; + export { out_670 as out }; + } + export { outputs_681 as outputs }; + } + namespace ND_switch_vector2I { + let node_682: string; + export { node_682 as node }; + let inherit_682: null; + export { inherit_682 as inherit }; + export namespace inputs_682 { + let in1_203: string; + export { in1_203 as in1 }; + let in2_203: string; + export { in2_203 as in2 }; + let in3_11: string; + export { in3_11 as in3 }; + let in4_11: string; + export { in4_11 as in4 }; + let in5_11: string; + export { in5_11 as in5 }; + let in6_11: string; + export { in6_11 as in6 }; + let in7_11: string; + export { in7_11 as in7 }; + let in8_11: string; + export { in8_11 as in8 }; + let in9_11: string; + export { in9_11 as in9 }; + let in10_11: string; + export { in10_11 as in10 }; + let which_11: string; + export { which_11 as which }; + } + export { inputs_682 as inputs }; + export namespace outputs_682 { + let out_671: string; + export { out_671 as out }; + } + export { outputs_682 as outputs }; + } + namespace ND_switch_vector3I { + let node_683: string; + export { node_683 as node }; + let inherit_683: null; + export { inherit_683 as inherit }; + export namespace inputs_683 { + let in1_204: string; + export { in1_204 as in1 }; + let in2_204: string; + export { in2_204 as in2 }; + let in3_12: string; + export { in3_12 as in3 }; + let in4_12: string; + export { in4_12 as in4 }; + let in5_12: string; + export { in5_12 as in5 }; + let in6_12: string; + export { in6_12 as in6 }; + let in7_12: string; + export { in7_12 as in7 }; + let in8_12: string; + export { in8_12 as in8 }; + let in9_12: string; + export { in9_12 as in9 }; + let in10_12: string; + export { in10_12 as in10 }; + let which_12: string; + export { which_12 as which }; + } + export { inputs_683 as inputs }; + export namespace outputs_683 { + let out_672: string; + export { out_672 as out }; + } + export { outputs_683 as outputs }; + } + namespace ND_switch_vector4I { + let node_684: string; + export { node_684 as node }; + let inherit_684: null; + export { inherit_684 as inherit }; + export namespace inputs_684 { + let in1_205: string; + export { in1_205 as in1 }; + let in2_205: string; + export { in2_205 as in2 }; + let in3_13: string; + export { in3_13 as in3 }; + let in4_13: string; + export { in4_13 as in4 }; + let in5_13: string; + export { in5_13 as in5 }; + let in6_13: string; + export { in6_13 as in6 }; + let in7_13: string; + export { in7_13 as in7 }; + let in8_13: string; + export { in8_13 as in8 }; + let in9_13: string; + export { in9_13 as in9 }; + let in10_13: string; + export { in10_13 as in10 }; + let which_13: string; + export { which_13 as which }; + } + export { inputs_684 as inputs }; + export namespace outputs_684 { + let out_673: string; + export { out_673 as out }; + } + export { outputs_684 as outputs }; + } + namespace ND_switch_matrix33I { + let node_685: string; + export { node_685 as node }; + let inherit_685: null; + export { inherit_685 as inherit }; + export namespace inputs_685 { + let in1_206: string; + export { in1_206 as in1 }; + let in2_206: string; + export { in2_206 as in2 }; + let in3_14: string; + export { in3_14 as in3 }; + let in4_14: string; + export { in4_14 as in4 }; + let in5_14: string; + export { in5_14 as in5 }; + let in6_14: string; + export { in6_14 as in6 }; + let in7_14: string; + export { in7_14 as in7 }; + let in8_14: string; + export { in8_14 as in8 }; + let in9_14: string; + export { in9_14 as in9 }; + let in10_14: string; + export { in10_14 as in10 }; + let which_14: string; + export { which_14 as which }; + } + export { inputs_685 as inputs }; + export namespace outputs_685 { + let out_674: string; + export { out_674 as out }; + } + export { outputs_685 as outputs }; + } + namespace ND_switch_matrix44I { + let node_686: string; + export { node_686 as node }; + let inherit_686: null; + export { inherit_686 as inherit }; + export namespace inputs_686 { + let in1_207: string; + export { in1_207 as in1 }; + let in2_207: string; + export { in2_207 as in2 }; + let in3_15: string; + export { in3_15 as in3 }; + let in4_15: string; + export { in4_15 as in4 }; + let in5_15: string; + export { in5_15 as in5 }; + let in6_15: string; + export { in6_15 as in6 }; + let in7_15: string; + export { in7_15 as in7 }; + let in8_15: string; + export { in8_15 as in8 }; + let in9_15: string; + export { in9_15 as in9 }; + let in10_15: string; + export { in10_15 as in10 }; + let which_15: string; + export { which_15 as which }; + } + export { inputs_686 as inputs }; + export namespace outputs_686 { + let out_675: string; + export { out_675 as out }; + } + export { outputs_686 as outputs }; + } + namespace ND_convert_float_color3 { + let node_687: string; + export { node_687 as node }; + let inherit_687: null; + export { inherit_687 as inherit }; + export namespace inputs_687 { + let _in_208: string; + export { _in_208 as in }; + } + export { inputs_687 as inputs }; + export namespace outputs_687 { + let out_676: string; + export { out_676 as out }; + } + export { outputs_687 as outputs }; + } + namespace ND_convert_float_color4 { + let node_688: string; + export { node_688 as node }; + let inherit_688: null; + export { inherit_688 as inherit }; + export namespace inputs_688 { + let _in_209: string; + export { _in_209 as in }; + } + export { inputs_688 as inputs }; + export namespace outputs_688 { + let out_677: string; + export { out_677 as out }; + } + export { outputs_688 as outputs }; + } + namespace ND_convert_float_vector2 { + let node_689: string; + export { node_689 as node }; + let inherit_689: null; + export { inherit_689 as inherit }; + export namespace inputs_689 { + let _in_210: string; + export { _in_210 as in }; + } + export { inputs_689 as inputs }; + export namespace outputs_689 { + let out_678: string; + export { out_678 as out }; + } + export { outputs_689 as outputs }; + } + namespace ND_convert_float_vector3 { + let node_690: string; + export { node_690 as node }; + let inherit_690: null; + export { inherit_690 as inherit }; + export namespace inputs_690 { + let _in_211: string; + export { _in_211 as in }; + } + export { inputs_690 as inputs }; + export namespace outputs_690 { + let out_679: string; + export { out_679 as out }; + } + export { outputs_690 as outputs }; + } + namespace ND_convert_float_vector4 { + let node_691: string; + export { node_691 as node }; + let inherit_691: null; + export { inherit_691 as inherit }; + export namespace inputs_691 { + let _in_212: string; + export { _in_212 as in }; + } + export { inputs_691 as inputs }; + export namespace outputs_691 { + let out_680: string; + export { out_680 as out }; + } + export { outputs_691 as outputs }; + } + namespace ND_convert_color3_color4 { + let node_692: string; + export { node_692 as node }; + let inherit_692: null; + export { inherit_692 as inherit }; + export namespace inputs_692 { + let _in_213: string; + export { _in_213 as in }; + } + export { inputs_692 as inputs }; + export namespace outputs_692 { + let out_681: string; + export { out_681 as out }; + } + export { outputs_692 as outputs }; + } + namespace ND_convert_color3_vector2 { + let node_693: string; + export { node_693 as node }; + let inherit_693: null; + export { inherit_693 as inherit }; + export namespace inputs_693 { + let _in_214: string; + export { _in_214 as in }; + } + export { inputs_693 as inputs }; + export namespace outputs_693 { + let out_682: string; + export { out_682 as out }; + } + export { outputs_693 as outputs }; + } + namespace ND_convert_color3_vector3 { + let node_694: string; + export { node_694 as node }; + let inherit_694: null; + export { inherit_694 as inherit }; + export namespace inputs_694 { + let _in_215: string; + export { _in_215 as in }; + } + export { inputs_694 as inputs }; + export namespace outputs_694 { + let out_683: string; + export { out_683 as out }; + } + export { outputs_694 as outputs }; + } + namespace ND_convert_color3_vector4 { + let node_695: string; + export { node_695 as node }; + let inherit_695: null; + export { inherit_695 as inherit }; + export namespace inputs_695 { + let _in_216: string; + export { _in_216 as in }; + } + export { inputs_695 as inputs }; + export namespace outputs_695 { + let out_684: string; + export { out_684 as out }; + } + export { outputs_695 as outputs }; + } + namespace ND_convert_color4_color3 { + let node_696: string; + export { node_696 as node }; + let inherit_696: null; + export { inherit_696 as inherit }; + export namespace inputs_696 { + let _in_217: string; + export { _in_217 as in }; + } + export { inputs_696 as inputs }; + export namespace outputs_696 { + let out_685: string; + export { out_685 as out }; + } + export { outputs_696 as outputs }; + } + namespace ND_convert_color4_vector2 { + let node_697: string; + export { node_697 as node }; + let inherit_697: null; + export { inherit_697 as inherit }; + export namespace inputs_697 { + let _in_218: string; + export { _in_218 as in }; + } + export { inputs_697 as inputs }; + export namespace outputs_697 { + let out_686: string; + export { out_686 as out }; + } + export { outputs_697 as outputs }; + } + namespace ND_convert_color4_vector3 { + let node_698: string; + export { node_698 as node }; + let inherit_698: null; + export { inherit_698 as inherit }; + export namespace inputs_698 { + let _in_219: string; + export { _in_219 as in }; + } + export { inputs_698 as inputs }; + export namespace outputs_698 { + let out_687: string; + export { out_687 as out }; + } + export { outputs_698 as outputs }; + } + namespace ND_convert_color4_vector4 { + let node_699: string; + export { node_699 as node }; + let inherit_699: null; + export { inherit_699 as inherit }; + export namespace inputs_699 { + let _in_220: string; + export { _in_220 as in }; + } + export { inputs_699 as inputs }; + export namespace outputs_699 { + let out_688: string; + export { out_688 as out }; + } + export { outputs_699 as outputs }; + } + namespace ND_convert_vector2_color3 { + let node_700: string; + export { node_700 as node }; + let inherit_700: null; + export { inherit_700 as inherit }; + export namespace inputs_700 { + let _in_221: string; + export { _in_221 as in }; + } + export { inputs_700 as inputs }; + export namespace outputs_700 { + let out_689: string; + export { out_689 as out }; + } + export { outputs_700 as outputs }; + } + namespace ND_convert_vector2_color4 { + let node_701: string; + export { node_701 as node }; + let inherit_701: null; + export { inherit_701 as inherit }; + export namespace inputs_701 { + let _in_222: string; + export { _in_222 as in }; + } + export { inputs_701 as inputs }; + export namespace outputs_701 { + let out_690: string; + export { out_690 as out }; + } + export { outputs_701 as outputs }; + } + namespace ND_convert_vector2_vector3 { + let node_702: string; + export { node_702 as node }; + let inherit_702: null; + export { inherit_702 as inherit }; + export namespace inputs_702 { + let _in_223: string; + export { _in_223 as in }; + } + export { inputs_702 as inputs }; + export namespace outputs_702 { + let out_691: string; + export { out_691 as out }; + } + export { outputs_702 as outputs }; + } + namespace ND_convert_vector2_vector4 { + let node_703: string; + export { node_703 as node }; + let inherit_703: null; + export { inherit_703 as inherit }; + export namespace inputs_703 { + let _in_224: string; + export { _in_224 as in }; + } + export { inputs_703 as inputs }; + export namespace outputs_703 { + let out_692: string; + export { out_692 as out }; + } + export { outputs_703 as outputs }; + } + namespace ND_convert_vector3_color3 { + let node_704: string; + export { node_704 as node }; + let inherit_704: null; + export { inherit_704 as inherit }; + export namespace inputs_704 { + let _in_225: string; + export { _in_225 as in }; + } + export { inputs_704 as inputs }; + export namespace outputs_704 { + let out_693: string; + export { out_693 as out }; + } + export { outputs_704 as outputs }; + } + namespace ND_convert_vector3_color4 { + let node_705: string; + export { node_705 as node }; + let inherit_705: null; + export { inherit_705 as inherit }; + export namespace inputs_705 { + let _in_226: string; + export { _in_226 as in }; + } + export { inputs_705 as inputs }; + export namespace outputs_705 { + let out_694: string; + export { out_694 as out }; + } + export { outputs_705 as outputs }; + } + namespace ND_convert_vector3_vector2 { + let node_706: string; + export { node_706 as node }; + let inherit_706: null; + export { inherit_706 as inherit }; + export namespace inputs_706 { + let _in_227: string; + export { _in_227 as in }; + } + export { inputs_706 as inputs }; + export namespace outputs_706 { + let out_695: string; + export { out_695 as out }; + } + export { outputs_706 as outputs }; + } + namespace ND_convert_vector3_vector4 { + let node_707: string; + export { node_707 as node }; + let inherit_707: null; + export { inherit_707 as inherit }; + export namespace inputs_707 { + let _in_228: string; + export { _in_228 as in }; + } + export { inputs_707 as inputs }; + export namespace outputs_707 { + let out_696: string; + export { out_696 as out }; + } + export { outputs_707 as outputs }; + } + namespace ND_convert_vector4_color3 { + let node_708: string; + export { node_708 as node }; + let inherit_708: null; + export { inherit_708 as inherit }; + export namespace inputs_708 { + let _in_229: string; + export { _in_229 as in }; + } + export { inputs_708 as inputs }; + export namespace outputs_708 { + let out_697: string; + export { out_697 as out }; + } + export { outputs_708 as outputs }; + } + namespace ND_convert_vector4_color4 { + let node_709: string; + export { node_709 as node }; + let inherit_709: null; + export { inherit_709 as inherit }; + export namespace inputs_709 { + let _in_230: string; + export { _in_230 as in }; + } + export { inputs_709 as inputs }; + export namespace outputs_709 { + let out_698: string; + export { out_698 as out }; + } + export { outputs_709 as outputs }; + } + namespace ND_convert_vector4_vector2 { + let node_710: string; + export { node_710 as node }; + let inherit_710: null; + export { inherit_710 as inherit }; + export namespace inputs_710 { + let _in_231: string; + export { _in_231 as in }; + } + export { inputs_710 as inputs }; + export namespace outputs_710 { + let out_699: string; + export { out_699 as out }; + } + export { outputs_710 as outputs }; + } + namespace ND_convert_vector4_vector3 { + let node_711: string; + export { node_711 as node }; + let inherit_711: null; + export { inherit_711 as inherit }; + export namespace inputs_711 { + let _in_232: string; + export { _in_232 as in }; + } + export { inputs_711 as inputs }; + export namespace outputs_711 { + let out_700: string; + export { out_700 as out }; + } + export { outputs_711 as outputs }; + } + namespace ND_convert_boolean_float { + let node_712: string; + export { node_712 as node }; + let inherit_712: null; + export { inherit_712 as inherit }; + export namespace inputs_712 { + let _in_233: string; + export { _in_233 as in }; + } + export { inputs_712 as inputs }; + export namespace outputs_712 { + let out_701: string; + export { out_701 as out }; + } + export { outputs_712 as outputs }; + } + namespace ND_convert_boolean_color3 { + let node_713: string; + export { node_713 as node }; + let inherit_713: null; + export { inherit_713 as inherit }; + export namespace inputs_713 { + let _in_234: string; + export { _in_234 as in }; + } + export { inputs_713 as inputs }; + export namespace outputs_713 { + let out_702: string; + export { out_702 as out }; + } + export { outputs_713 as outputs }; + } + namespace ND_convert_boolean_color4 { + let node_714: string; + export { node_714 as node }; + let inherit_714: null; + export { inherit_714 as inherit }; + export namespace inputs_714 { + let _in_235: string; + export { _in_235 as in }; + } + export { inputs_714 as inputs }; + export namespace outputs_714 { + let out_703: string; + export { out_703 as out }; + } + export { outputs_714 as outputs }; + } + namespace ND_convert_boolean_vector2 { + let node_715: string; + export { node_715 as node }; + let inherit_715: null; + export { inherit_715 as inherit }; + export namespace inputs_715 { + let _in_236: string; + export { _in_236 as in }; + } + export { inputs_715 as inputs }; + export namespace outputs_715 { + let out_704: string; + export { out_704 as out }; + } + export { outputs_715 as outputs }; + } + namespace ND_convert_boolean_vector3 { + let node_716: string; + export { node_716 as node }; + let inherit_716: null; + export { inherit_716 as inherit }; + export namespace inputs_716 { + let _in_237: string; + export { _in_237 as in }; + } + export { inputs_716 as inputs }; + export namespace outputs_716 { + let out_705: string; + export { out_705 as out }; + } + export { outputs_716 as outputs }; + } + namespace ND_convert_boolean_vector4 { + let node_717: string; + export { node_717 as node }; + let inherit_717: null; + export { inherit_717 as inherit }; + export namespace inputs_717 { + let _in_238: string; + export { _in_238 as in }; + } + export { inputs_717 as inputs }; + export namespace outputs_717 { + let out_706: string; + export { out_706 as out }; + } + export { outputs_717 as outputs }; + } + namespace ND_convert_boolean_integer { + let node_718: string; + export { node_718 as node }; + let inherit_718: null; + export { inherit_718 as inherit }; + export namespace inputs_718 { + let _in_239: string; + export { _in_239 as in }; + } + export { inputs_718 as inputs }; + export namespace outputs_718 { + let out_707: string; + export { out_707 as out }; + } + export { outputs_718 as outputs }; + } + namespace ND_convert_integer_float { + let node_719: string; + export { node_719 as node }; + let inherit_719: null; + export { inherit_719 as inherit }; + export namespace inputs_719 { + let _in_240: string; + export { _in_240 as in }; + } + export { inputs_719 as inputs }; + export namespace outputs_719 { + let out_708: string; + export { out_708 as out }; + } + export { outputs_719 as outputs }; + } + namespace ND_convert_integer_color3 { + let node_720: string; + export { node_720 as node }; + let inherit_720: null; + export { inherit_720 as inherit }; + export namespace inputs_720 { + let _in_241: string; + export { _in_241 as in }; + } + export { inputs_720 as inputs }; + export namespace outputs_720 { + let out_709: string; + export { out_709 as out }; + } + export { outputs_720 as outputs }; + } + namespace ND_convert_integer_color4 { + let node_721: string; + export { node_721 as node }; + let inherit_721: null; + export { inherit_721 as inherit }; + export namespace inputs_721 { + let _in_242: string; + export { _in_242 as in }; + } + export { inputs_721 as inputs }; + export namespace outputs_721 { + let out_710: string; + export { out_710 as out }; + } + export { outputs_721 as outputs }; + } + namespace ND_convert_integer_vector2 { + let node_722: string; + export { node_722 as node }; + let inherit_722: null; + export { inherit_722 as inherit }; + export namespace inputs_722 { + let _in_243: string; + export { _in_243 as in }; + } + export { inputs_722 as inputs }; + export namespace outputs_722 { + let out_711: string; + export { out_711 as out }; + } + export { outputs_722 as outputs }; + } + namespace ND_convert_integer_vector3 { + let node_723: string; + export { node_723 as node }; + let inherit_723: null; + export { inherit_723 as inherit }; + export namespace inputs_723 { + let _in_244: string; + export { _in_244 as in }; + } + export { inputs_723 as inputs }; + export namespace outputs_723 { + let out_712: string; + export { out_712 as out }; + } + export { outputs_723 as outputs }; + } + namespace ND_convert_integer_vector4 { + let node_724: string; + export { node_724 as node }; + let inherit_724: null; + export { inherit_724 as inherit }; + export namespace inputs_724 { + let _in_245: string; + export { _in_245 as in }; + } + export { inputs_724 as inputs }; + export namespace outputs_724 { + let out_713: string; + export { out_713 as out }; + } + export { outputs_724 as outputs }; + } + namespace ND_convert_integer_boolean { + let node_725: string; + export { node_725 as node }; + let inherit_725: null; + export { inherit_725 as inherit }; + export namespace inputs_725 { + let _in_246: string; + export { _in_246 as in }; + } + export { inputs_725 as inputs }; + export namespace outputs_725 { + let out_714: string; + export { out_714 as out }; + } + export { outputs_725 as outputs }; + } + namespace ND_convert_color3_surfaceshader { + let node_726: string; + export { node_726 as node }; + let inherit_726: null; + export { inherit_726 as inherit }; + export namespace inputs_726 { + let _in_247: string; + export { _in_247 as in }; + } + export { inputs_726 as inputs }; + export namespace outputs_726 { + let out_715: string; + export { out_715 as out }; + } + export { outputs_726 as outputs }; + } + namespace ND_convert_color4_surfaceshader { + let node_727: string; + export { node_727 as node }; + let inherit_727: null; + export { inherit_727 as inherit }; + export namespace inputs_727 { + let _in_248: string; + export { _in_248 as in }; + } + export { inputs_727 as inputs }; + export namespace outputs_727 { + let out_716: string; + export { out_716 as out }; + } + export { outputs_727 as outputs }; + } + namespace ND_convert_float_surfaceshader { + let node_728: string; + export { node_728 as node }; + let inherit_728: null; + export { inherit_728 as inherit }; + export namespace inputs_728 { + let _in_249: string; + export { _in_249 as in }; + } + export { inputs_728 as inputs }; + export namespace outputs_728 { + let out_717: string; + export { out_717 as out }; + } + export { outputs_728 as outputs }; + } + namespace ND_convert_vector2_surfaceshader { + let node_729: string; + export { node_729 as node }; + let inherit_729: null; + export { inherit_729 as inherit }; + export namespace inputs_729 { + let _in_250: string; + export { _in_250 as in }; + } + export { inputs_729 as inputs }; + export namespace outputs_729 { + let out_718: string; + export { out_718 as out }; + } + export { outputs_729 as outputs }; + } + namespace ND_convert_vector3_surfaceshader { + let node_730: string; + export { node_730 as node }; + let inherit_730: null; + export { inherit_730 as inherit }; + export namespace inputs_730 { + let _in_251: string; + export { _in_251 as in }; + } + export { inputs_730 as inputs }; + export namespace outputs_730 { + let out_719: string; + export { out_719 as out }; + } + export { outputs_730 as outputs }; + } + namespace ND_convert_vector4_surfaceshader { + let node_731: string; + export { node_731 as node }; + let inherit_731: null; + export { inherit_731 as inherit }; + export namespace inputs_731 { + let _in_252: string; + export { _in_252 as in }; + } + export { inputs_731 as inputs }; + export namespace outputs_731 { + let out_720: string; + export { out_720 as out }; + } + export { outputs_731 as outputs }; + } + namespace ND_convert_integer_surfaceshader { + let node_732: string; + export { node_732 as node }; + let inherit_732: null; + export { inherit_732 as inherit }; + export namespace inputs_732 { + let _in_253: string; + export { _in_253 as in }; + } + export { inputs_732 as inputs }; + export namespace outputs_732 { + let out_721: string; + export { out_721 as out }; + } + export { outputs_732 as outputs }; + } + namespace ND_convert_boolean_surfaceshader { + let node_733: string; + export { node_733 as node }; + let inherit_733: null; + export { inherit_733 as inherit }; + export namespace inputs_733 { + let _in_254: string; + export { _in_254 as in }; + } + export { inputs_733 as inputs }; + export namespace outputs_733 { + let out_722: string; + export { out_722 as out }; + } + export { outputs_733 as outputs }; + } + namespace ND_combine2_vector2 { + let node_734: string; + export { node_734 as node }; + let inherit_734: null; + export { inherit_734 as inherit }; + export namespace inputs_734 { + let in1_208: string; + export { in1_208 as in1 }; + let in2_208: string; + export { in2_208 as in2 }; + } + export { inputs_734 as inputs }; + export namespace outputs_734 { + let out_723: string; + export { out_723 as out }; + } + export { outputs_734 as outputs }; + } + namespace ND_combine2_color4CF { + let node_735: string; + export { node_735 as node }; + let inherit_735: null; + export { inherit_735 as inherit }; + export namespace inputs_735 { + let in1_209: string; + export { in1_209 as in1 }; + let in2_209: string; + export { in2_209 as in2 }; + } + export { inputs_735 as inputs }; + export namespace outputs_735 { + let out_724: string; + export { out_724 as out }; + } + export { outputs_735 as outputs }; + } + namespace ND_combine2_vector4VF { + let node_736: string; + export { node_736 as node }; + let inherit_736: null; + export { inherit_736 as inherit }; + export namespace inputs_736 { + let in1_210: string; + export { in1_210 as in1 }; + let in2_210: string; + export { in2_210 as in2 }; + } + export { inputs_736 as inputs }; + export namespace outputs_736 { + let out_725: string; + export { out_725 as out }; + } + export { outputs_736 as outputs }; + } + namespace ND_combine2_vector4VV { + let node_737: string; + export { node_737 as node }; + let inherit_737: null; + export { inherit_737 as inherit }; + export namespace inputs_737 { + let in1_211: string; + export { in1_211 as in1 }; + let in2_211: string; + export { in2_211 as in2 }; + } + export { inputs_737 as inputs }; + export namespace outputs_737 { + let out_726: string; + export { out_726 as out }; + } + export { outputs_737 as outputs }; + } + namespace ND_combine3_color3 { + let node_738: string; + export { node_738 as node }; + let inherit_738: null; + export { inherit_738 as inherit }; + export namespace inputs_738 { + let in1_212: string; + export { in1_212 as in1 }; + let in2_212: string; + export { in2_212 as in2 }; + let in3_16: string; + export { in3_16 as in3 }; + } + export { inputs_738 as inputs }; + export namespace outputs_738 { + let out_727: string; + export { out_727 as out }; + } + export { outputs_738 as outputs }; + } + namespace ND_combine3_vector3 { + let node_739: string; + export { node_739 as node }; + let inherit_739: null; + export { inherit_739 as inherit }; + export namespace inputs_739 { + let in1_213: string; + export { in1_213 as in1 }; + let in2_213: string; + export { in2_213 as in2 }; + let in3_17: string; + export { in3_17 as in3 }; + } + export { inputs_739 as inputs }; + export namespace outputs_739 { + let out_728: string; + export { out_728 as out }; + } + export { outputs_739 as outputs }; + } + namespace ND_combine4_color4 { + let node_740: string; + export { node_740 as node }; + let inherit_740: null; + export { inherit_740 as inherit }; + export namespace inputs_740 { + let in1_214: string; + export { in1_214 as in1 }; + let in2_214: string; + export { in2_214 as in2 }; + let in3_18: string; + export { in3_18 as in3 }; + let in4_16: string; + export { in4_16 as in4 }; + } + export { inputs_740 as inputs }; + export namespace outputs_740 { + let out_729: string; + export { out_729 as out }; + } + export { outputs_740 as outputs }; + } + namespace ND_combine4_vector4 { + let node_741: string; + export { node_741 as node }; + let inherit_741: null; + export { inherit_741 as inherit }; + export namespace inputs_741 { + let in1_215: string; + export { in1_215 as in1 }; + let in2_215: string; + export { in2_215 as in2 }; + let in3_19: string; + export { in3_19 as in3 }; + let in4_17: string; + export { in4_17 as in4 }; + } + export { inputs_741 as inputs }; + export namespace outputs_741 { + let out_730: string; + export { out_730 as out }; + } + export { outputs_741 as outputs }; + } + namespace ND_creatematrix_vector3_matrix33 { + let node_742: string; + export { node_742 as node }; + let inherit_742: null; + export { inherit_742 as inherit }; + export namespace inputs_742 { + let in1_216: string; + export { in1_216 as in1 }; + let in2_216: string; + export { in2_216 as in2 }; + let in3_20: string; + export { in3_20 as in3 }; + } + export { inputs_742 as inputs }; + export namespace outputs_742 { + let out_731: string; + export { out_731 as out }; + } + export { outputs_742 as outputs }; + } + namespace ND_creatematrix_vector3_matrix44 { + let node_743: string; + export { node_743 as node }; + let inherit_743: null; + export { inherit_743 as inherit }; + export namespace inputs_743 { + let in1_217: string; + export { in1_217 as in1 }; + let in2_217: string; + export { in2_217 as in2 }; + let in3_21: string; + export { in3_21 as in3 }; + let in4_18: string; + export { in4_18 as in4 }; + } + export { inputs_743 as inputs }; + export namespace outputs_743 { + let out_732: string; + export { out_732 as out }; + } + export { outputs_743 as outputs }; + } + namespace ND_creatematrix_vector4_matrix44 { + let node_744: string; + export { node_744 as node }; + let inherit_744: null; + export { inherit_744 as inherit }; + export namespace inputs_744 { + let in1_218: string; + export { in1_218 as in1 }; + let in2_218: string; + export { in2_218 as in2 }; + let in3_22: string; + export { in3_22 as in3 }; + let in4_19: string; + export { in4_19 as in4 }; + } + export { inputs_744 as inputs }; + export namespace outputs_744 { + let out_733: string; + export { out_733 as out }; + } + export { outputs_744 as outputs }; + } + namespace ND_extract_color3 { + let node_745: string; + export { node_745 as node }; + let inherit_745: null; + export { inherit_745 as inherit }; + export namespace inputs_745 { + let _in_255: string; + export { _in_255 as in }; + let index_7: string; + export { index_7 as index }; + } + export { inputs_745 as inputs }; + export namespace outputs_745 { + let out_734: string; + export { out_734 as out }; + } + export { outputs_745 as outputs }; + } + namespace ND_extract_color4 { + let node_746: string; + export { node_746 as node }; + let inherit_746: null; + export { inherit_746 as inherit }; + export namespace inputs_746 { + let _in_256: string; + export { _in_256 as in }; + let index_8: string; + export { index_8 as index }; + } + export { inputs_746 as inputs }; + export namespace outputs_746 { + let out_735: string; + export { out_735 as out }; + } + export { outputs_746 as outputs }; + } + namespace ND_extract_vector2 { + let node_747: string; + export { node_747 as node }; + let inherit_747: null; + export { inherit_747 as inherit }; + export namespace inputs_747 { + let _in_257: string; + export { _in_257 as in }; + let index_9: string; + export { index_9 as index }; + } + export { inputs_747 as inputs }; + export namespace outputs_747 { + let out_736: string; + export { out_736 as out }; + } + export { outputs_747 as outputs }; + } + namespace ND_extract_vector3 { + let node_748: string; + export { node_748 as node }; + let inherit_748: null; + export { inherit_748 as inherit }; + export namespace inputs_748 { + let _in_258: string; + export { _in_258 as in }; + let index_10: string; + export { index_10 as index }; + } + export { inputs_748 as inputs }; + export namespace outputs_748 { + let out_737: string; + export { out_737 as out }; + } + export { outputs_748 as outputs }; + } + namespace ND_extract_vector4 { + let node_749: string; + export { node_749 as node }; + let inherit_749: null; + export { inherit_749 as inherit }; + export namespace inputs_749 { + let _in_259: string; + export { _in_259 as in }; + let index_11: string; + export { index_11 as index }; + } + export { inputs_749 as inputs }; + export namespace outputs_749 { + let out_738: string; + export { out_738 as out }; + } + export { outputs_749 as outputs }; + } + namespace ND_extract_matrix33 { + let node_750: string; + export { node_750 as node }; + let inherit_750: null; + export { inherit_750 as inherit }; + export namespace inputs_750 { + let _in_260: string; + export { _in_260 as in }; + let index_12: string; + export { index_12 as index }; + } + export { inputs_750 as inputs }; + export namespace outputs_750 { + let out_739: string; + export { out_739 as out }; + } + export { outputs_750 as outputs }; + } + namespace ND_extract_matrix44 { + let node_751: string; + export { node_751 as node }; + let inherit_751: null; + export { inherit_751 as inherit }; + export namespace inputs_751 { + let _in_261: string; + export { _in_261 as in }; + let index_13: string; + export { index_13 as index }; + } + export { inputs_751 as inputs }; + export namespace outputs_751 { + let out_740: string; + export { out_740 as out }; + } + export { outputs_751 as outputs }; + } + namespace ND_separate2_vector2 { + let node_752: string; + export { node_752 as node }; + let inherit_752: null; + export { inherit_752 as inherit }; + export namespace inputs_752 { + let _in_262: string; + export { _in_262 as in }; + } + export { inputs_752 as inputs }; + export namespace outputs_752 { + let outx: string; + let outy: string; + } + export { outputs_752 as outputs }; + } + namespace ND_separate3_color3 { + let node_753: string; + export { node_753 as node }; + let inherit_753: null; + export { inherit_753 as inherit }; + export namespace inputs_753 { + let _in_263: string; + export { _in_263 as in }; + } + export { inputs_753 as inputs }; + export namespace outputs_753 { + let outr: string; + let outg: string; + let outb: string; + } + export { outputs_753 as outputs }; + } + namespace ND_separate3_vector3 { + let node_754: string; + export { node_754 as node }; + let inherit_754: null; + export { inherit_754 as inherit }; + export namespace inputs_754 { + let _in_264: string; + export { _in_264 as in }; + } + export { inputs_754 as inputs }; + export namespace outputs_754 { + let outx_1: string; + export { outx_1 as outx }; + let outy_1: string; + export { outy_1 as outy }; + export let outz: string; + } + export { outputs_754 as outputs }; + } + namespace ND_separate4_color4 { + let node_755: string; + export { node_755 as node }; + let inherit_755: null; + export { inherit_755 as inherit }; + export namespace inputs_755 { + let _in_265: string; + export { _in_265 as in }; + } + export { inputs_755 as inputs }; + export namespace outputs_755 { + let outr_1: string; + export { outr_1 as outr }; + let outg_1: string; + export { outg_1 as outg }; + let outb_1: string; + export { outb_1 as outb }; + let outa_1: string; + export { outa_1 as outa }; + } + export { outputs_755 as outputs }; + } + namespace ND_separate4_vector4 { + let node_756: string; + export { node_756 as node }; + let inherit_756: null; + export { inherit_756 as inherit }; + export namespace inputs_756 { + let _in_266: string; + export { _in_266 as in }; + } + export { inputs_756 as inputs }; + export namespace outputs_756 { + let outx_2: string; + export { outx_2 as outx }; + let outy_2: string; + export { outy_2 as outy }; + let outz_1: string; + export { outz_1 as outz }; + export let outw: string; + } + export { outputs_756 as outputs }; + } + namespace ND_blur_float { + let node_757: string; + export { node_757 as node }; + let inherit_757: null; + export { inherit_757 as inherit }; + export namespace inputs_757 { + let _in_267: string; + export { _in_267 as in }; + let size_5: string; + export { size_5 as size }; + let filtertype_26: string; + export { filtertype_26 as filtertype }; + } + export { inputs_757 as inputs }; + export namespace outputs_757 { + let out_741: string; + export { out_741 as out }; + } + export { outputs_757 as outputs }; + } + namespace ND_blur_color3 { + let node_758: string; + export { node_758 as node }; + let inherit_758: null; + export { inherit_758 as inherit }; + export namespace inputs_758 { + let _in_268: string; + export { _in_268 as in }; + let size_6: string; + export { size_6 as size }; + let filtertype_27: string; + export { filtertype_27 as filtertype }; + } + export { inputs_758 as inputs }; + export namespace outputs_758 { + let out_742: string; + export { out_742 as out }; + } + export { outputs_758 as outputs }; + } + namespace ND_blur_color4 { + let node_759: string; + export { node_759 as node }; + let inherit_759: null; + export { inherit_759 as inherit }; + export namespace inputs_759 { + let _in_269: string; + export { _in_269 as in }; + let size_7: string; + export { size_7 as size }; + let filtertype_28: string; + export { filtertype_28 as filtertype }; + } + export { inputs_759 as inputs }; + export namespace outputs_759 { + let out_743: string; + export { out_743 as out }; + } + export { outputs_759 as outputs }; + } + namespace ND_blur_vector2 { + let node_760: string; + export { node_760 as node }; + let inherit_760: null; + export { inherit_760 as inherit }; + export namespace inputs_760 { + let _in_270: string; + export { _in_270 as in }; + let size_8: string; + export { size_8 as size }; + let filtertype_29: string; + export { filtertype_29 as filtertype }; + } + export { inputs_760 as inputs }; + export namespace outputs_760 { + let out_744: string; + export { out_744 as out }; + } + export { outputs_760 as outputs }; + } + namespace ND_blur_vector3 { + let node_761: string; + export { node_761 as node }; + let inherit_761: null; + export { inherit_761 as inherit }; + export namespace inputs_761 { + let _in_271: string; + export { _in_271 as in }; + let size_9: string; + export { size_9 as size }; + let filtertype_30: string; + export { filtertype_30 as filtertype }; + } + export { inputs_761 as inputs }; + export namespace outputs_761 { + let out_745: string; + export { out_745 as out }; + } + export { outputs_761 as outputs }; + } + namespace ND_blur_vector4 { + let node_762: string; + export { node_762 as node }; + let inherit_762: null; + export { inherit_762 as inherit }; + export namespace inputs_762 { + let _in_272: string; + export { _in_272 as in }; + let size_10: string; + export { size_10 as size }; + let filtertype_31: string; + export { filtertype_31 as filtertype }; + } + export { inputs_762 as inputs }; + export namespace outputs_762 { + let out_746: string; + export { out_746 as out }; + } + export { outputs_762 as outputs }; + } + namespace ND_heighttonormal_vector3 { + let node_763: string; + export { node_763 as node }; + let inherit_763: null; + export { inherit_763 as inherit }; + export namespace inputs_763 { + let _in_273: string; + export { _in_273 as in }; + let scale_19: string; + export { scale_19 as scale }; + let texcoord_93: string; + export { texcoord_93 as texcoord }; + } + export { inputs_763 as inputs }; + export namespace outputs_763 { + let out_747: string; + export { out_747 as out }; + } + export { outputs_763 as outputs }; + } + namespace ND_logical_and { + let node_764: string; + export { node_764 as node }; + let inherit_764: null; + export { inherit_764 as inherit }; + export namespace inputs_764 { + let in1_219: string; + export { in1_219 as in1 }; + let in2_219: string; + export { in2_219 as in2 }; + } + export { inputs_764 as inputs }; + export namespace outputs_764 { + let out_748: string; + export { out_748 as out }; + } + export { outputs_764 as outputs }; + } + namespace ND_logical_or { + let node_765: string; + export { node_765 as node }; + let inherit_765: null; + export { inherit_765 as inherit }; + export namespace inputs_765 { + let in1_220: string; + export { in1_220 as in1 }; + let in2_220: string; + export { in2_220 as in2 }; + } + export { inputs_765 as inputs }; + export namespace outputs_765 { + let out_749: string; + export { out_749 as out }; + } + export { outputs_765 as outputs }; + } + namespace ND_logical_xor { + let node_766: string; + export { node_766 as node }; + let inherit_766: null; + export { inherit_766 as inherit }; + export namespace inputs_766 { + let in1_221: string; + export { in1_221 as in1 }; + let in2_221: string; + export { in2_221 as in2 }; + } + export { inputs_766 as inputs }; + export namespace outputs_766 { + let out_750: string; + export { out_750 as out }; + } + export { outputs_766 as outputs }; + } + namespace ND_logical_not { + let node_767: string; + export { node_767 as node }; + let inherit_767: null; + export { inherit_767 as inherit }; + export namespace inputs_767 { + let _in_274: string; + export { _in_274 as in }; + } + export { inputs_767 as inputs }; + export namespace outputs_767 { + let out_751: string; + export { out_751 as out }; + } + export { outputs_767 as outputs }; + } + namespace ND_dot_float { + let node_768: string; + export { node_768 as node }; + let inherit_768: null; + export { inherit_768 as inherit }; + export namespace inputs_768 { + let _in_275: string; + export { _in_275 as in }; + export let note: string; + } + export { inputs_768 as inputs }; + export namespace outputs_768 { + let out_752: string; + export { out_752 as out }; + } + export { outputs_768 as outputs }; + } + namespace ND_dot_color3 { + let node_769: string; + export { node_769 as node }; + let inherit_769: null; + export { inherit_769 as inherit }; + export namespace inputs_769 { + let _in_276: string; + export { _in_276 as in }; + let note_1: string; + export { note_1 as note }; + } + export { inputs_769 as inputs }; + export namespace outputs_769 { + let out_753: string; + export { out_753 as out }; + } + export { outputs_769 as outputs }; + } + namespace ND_dot_color4 { + let node_770: string; + export { node_770 as node }; + let inherit_770: null; + export { inherit_770 as inherit }; + export namespace inputs_770 { + let _in_277: string; + export { _in_277 as in }; + let note_2: string; + export { note_2 as note }; + } + export { inputs_770 as inputs }; + export namespace outputs_770 { + let out_754: string; + export { out_754 as out }; + } + export { outputs_770 as outputs }; + } + namespace ND_dot_vector2 { + let node_771: string; + export { node_771 as node }; + let inherit_771: null; + export { inherit_771 as inherit }; + export namespace inputs_771 { + let _in_278: string; + export { _in_278 as in }; + let note_3: string; + export { note_3 as note }; + } + export { inputs_771 as inputs }; + export namespace outputs_771 { + let out_755: string; + export { out_755 as out }; + } + export { outputs_771 as outputs }; + } + namespace ND_dot_vector3 { + let node_772: string; + export { node_772 as node }; + let inherit_772: null; + export { inherit_772 as inherit }; + export namespace inputs_772 { + let _in_279: string; + export { _in_279 as in }; + let note_4: string; + export { note_4 as note }; + } + export { inputs_772 as inputs }; + export namespace outputs_772 { + let out_756: string; + export { out_756 as out }; + } + export { outputs_772 as outputs }; + } + namespace ND_dot_vector4 { + let node_773: string; + export { node_773 as node }; + let inherit_773: null; + export { inherit_773 as inherit }; + export namespace inputs_773 { + let _in_280: string; + export { _in_280 as in }; + let note_5: string; + export { note_5 as note }; + } + export { inputs_773 as inputs }; + export namespace outputs_773 { + let out_757: string; + export { out_757 as out }; + } + export { outputs_773 as outputs }; + } + namespace ND_dot_boolean { + let node_774: string; + export { node_774 as node }; + let inherit_774: null; + export { inherit_774 as inherit }; + export namespace inputs_774 { + let _in_281: string; + export { _in_281 as in }; + let note_6: string; + export { note_6 as note }; + } + export { inputs_774 as inputs }; + export namespace outputs_774 { + let out_758: string; + export { out_758 as out }; + } + export { outputs_774 as outputs }; + } + namespace ND_dot_integer { + let node_775: string; + export { node_775 as node }; + let inherit_775: null; + export { inherit_775 as inherit }; + export namespace inputs_775 { + let _in_282: string; + export { _in_282 as in }; + let note_7: string; + export { note_7 as note }; + } + export { inputs_775 as inputs }; + export namespace outputs_775 { + let out_759: string; + export { out_759 as out }; + } + export { outputs_775 as outputs }; + } + namespace ND_dot_matrix33 { + let node_776: string; + export { node_776 as node }; + let inherit_776: null; + export { inherit_776 as inherit }; + export namespace inputs_776 { + let _in_283: string; + export { _in_283 as in }; + let note_8: string; + export { note_8 as note }; + } + export { inputs_776 as inputs }; + export namespace outputs_776 { + let out_760: string; + export { out_760 as out }; + } + export { outputs_776 as outputs }; + } + namespace ND_dot_matrix44 { + let node_777: string; + export { node_777 as node }; + let inherit_777: null; + export { inherit_777 as inherit }; + export namespace inputs_777 { + let _in_284: string; + export { _in_284 as in }; + let note_9: string; + export { note_9 as note }; + } + export { inputs_777 as inputs }; + export namespace outputs_777 { + let out_761: string; + export { out_761 as out }; + } + export { outputs_777 as outputs }; + } + namespace ND_dot_string { + let node_778: string; + export { node_778 as node }; + let inherit_778: null; + export { inherit_778 as inherit }; + export namespace inputs_778 { + let _in_285: string; + export { _in_285 as in }; + let note_10: string; + export { note_10 as note }; + } + export { inputs_778 as inputs }; + export namespace outputs_778 { + let out_762: string; + export { out_762 as out }; + } + export { outputs_778 as outputs }; + } + namespace ND_dot_filename { + let node_779: string; + export { node_779 as node }; + let inherit_779: null; + export { inherit_779 as inherit }; + export namespace inputs_779 { + let _in_286: string; + export { _in_286 as in }; + let note_11: string; + export { note_11 as note }; + } + export { inputs_779 as inputs }; + export namespace outputs_779 { + let out_763: string; + export { out_763 as out }; + } + export { outputs_779 as outputs }; + } + namespace ND_dot_surfaceshader { + let node_780: string; + export { node_780 as node }; + let inherit_780: null; + export { inherit_780 as inherit }; + export namespace inputs_780 { + let _in_287: string; + export { _in_287 as in }; + let note_12: string; + export { note_12 as note }; + } + export { inputs_780 as inputs }; + export namespace outputs_780 { + let out_764: string; + export { out_764 as out }; + } + export { outputs_780 as outputs }; + } + namespace ND_dot_displacementshader { + let node_781: string; + export { node_781 as node }; + let inherit_781: null; + export { inherit_781 as inherit }; + export namespace inputs_781 { + let _in_288: string; + export { _in_288 as in }; + let note_13: string; + export { note_13 as note }; + } + export { inputs_781 as inputs }; + export namespace outputs_781 { + let out_765: string; + export { out_765 as out }; + } + export { outputs_781 as outputs }; + } + namespace ND_dot_volumeshader { + let node_782: string; + export { node_782 as node }; + let inherit_782: null; + export { inherit_782 as inherit }; + export namespace inputs_782 { + let _in_289: string; + export { _in_289 as in }; + let note_14: string; + export { note_14 as note }; + } + export { inputs_782 as inputs }; + export namespace outputs_782 { + let out_766: string; + export { out_766 as out }; + } + export { outputs_782 as outputs }; + } + namespace ND_dot_lightshader { + let node_783: string; + export { node_783 as node }; + let inherit_783: null; + export { inherit_783 as inherit }; + export namespace inputs_783 { + let _in_290: string; + export { _in_290 as in }; + let note_15: string; + export { note_15 as note }; + } + export { inputs_783 as inputs }; + export namespace outputs_783 { + let out_767: string; + export { out_767 as out }; + } + export { outputs_783 as outputs }; + } + namespace ND_point_light { + let node_784: string; + export { node_784 as node }; + let inherit_784: null; + export { inherit_784 as inherit }; + export namespace inputs_784 { + let position_34: string; + export { position_34 as position }; + let color_10: string; + export { color_10 as color }; + let intensity_1: string; + export { intensity_1 as intensity }; + export let decay_rate: string; + } + export { inputs_784 as inputs }; + export namespace outputs_784 { + let out_768: string; + export { out_768 as out }; + } + export { outputs_784 as outputs }; + } + namespace ND_directional_light { + let node_785: string; + export { node_785 as node }; + let inherit_785: null; + export { inherit_785 as inherit }; + export namespace inputs_785 { + export let direction: string; + let color_11: string; + export { color_11 as color }; + let intensity_2: string; + export { intensity_2 as intensity }; + } + export { inputs_785 as inputs }; + export namespace outputs_785 { + let out_769: string; + export { out_769 as out }; + } + export { outputs_785 as outputs }; + } + namespace ND_spot_light { + let node_786: string; + export { node_786 as node }; + let inherit_786: null; + export { inherit_786 as inherit }; + export namespace inputs_786 { + let position_35: string; + export { position_35 as position }; + let direction_1: string; + export { direction_1 as direction }; + let color_12: string; + export { color_12 as color }; + let intensity_3: string; + export { intensity_3 as intensity }; + let decay_rate_1: string; + export { decay_rate_1 as decay_rate }; + let inner_angle_1: string; + export { inner_angle_1 as inner_angle }; + let outer_angle_1: string; + export { outer_angle_1 as outer_angle }; + } + export { inputs_786 as inputs }; + export namespace outputs_786 { + let out_770: string; + export { out_770 as out }; + } + export { outputs_786 as outputs }; + } + namespace ND_open_pbr_surface_to_standard_surface { + let node_787: string; + export { node_787 as node }; + let inherit_787: null; + export { inherit_787 as inherit }; + export namespace inputs_787 { + let base_weight_1: string; + export { base_weight_1 as base_weight }; + let base_color_4: string; + export { base_color_4 as base_color }; + let base_diffuse_roughness_1: string; + export { base_diffuse_roughness_1 as base_diffuse_roughness }; + let base_metalness_1: string; + export { base_metalness_1 as base_metalness }; + let specular_weight_1: string; + export { specular_weight_1 as specular_weight }; + let specular_color_3: string; + export { specular_color_3 as specular_color }; + let specular_roughness_2: string; + export { specular_roughness_2 as specular_roughness }; + let specular_ior_1: string; + export { specular_ior_1 as specular_ior }; + let specular_roughness_anisotropy_1: string; + export { specular_roughness_anisotropy_1 as specular_roughness_anisotropy }; + let transmission_weight_1: string; + export { transmission_weight_1 as transmission_weight }; + let transmission_color_3: string; + export { transmission_color_3 as transmission_color }; + let transmission_depth_2: string; + export { transmission_depth_2 as transmission_depth }; + let transmission_scatter_2: string; + export { transmission_scatter_2 as transmission_scatter }; + let transmission_scatter_anisotropy_2: string; + export { transmission_scatter_anisotropy_2 as transmission_scatter_anisotropy }; + let transmission_dispersion_scale_1: string; + export { transmission_dispersion_scale_1 as transmission_dispersion_scale }; + let subsurface_weight_1: string; + export { subsurface_weight_1 as subsurface_weight }; + let subsurface_color_2: string; + export { subsurface_color_2 as subsurface_color }; + let subsurface_radius_2: string; + export { subsurface_radius_2 as subsurface_radius }; + let subsurface_radius_scale_1: string; + export { subsurface_radius_scale_1 as subsurface_radius_scale }; + let subsurface_scatter_anisotropy_1: string; + export { subsurface_scatter_anisotropy_1 as subsurface_scatter_anisotropy }; + let fuzz_weight_1: string; + export { fuzz_weight_1 as fuzz_weight }; + let fuzz_color_1: string; + export { fuzz_color_1 as fuzz_color }; + let fuzz_roughness_1: string; + export { fuzz_roughness_1 as fuzz_roughness }; + let coat_weight_1: string; + export { coat_weight_1 as coat_weight }; + let coat_color_2: string; + export { coat_color_2 as coat_color }; + let coat_roughness_2: string; + export { coat_roughness_2 as coat_roughness }; + let coat_roughness_anisotropy_1: string; + export { coat_roughness_anisotropy_1 as coat_roughness_anisotropy }; + let coat_ior_1: string; + export { coat_ior_1 as coat_ior }; + let coat_darkening_1: string; + export { coat_darkening_1 as coat_darkening }; + let thin_film_weight_1: string; + export { thin_film_weight_1 as thin_film_weight }; + let thin_film_thickness_2: string; + export { thin_film_thickness_2 as thin_film_thickness }; + let thin_film_ior_1: string; + export { thin_film_ior_1 as thin_film_ior }; + let emission_luminance_1: string; + export { emission_luminance_1 as emission_luminance }; + let emission_color_3: string; + export { emission_color_3 as emission_color }; + let geometry_opacity_1: string; + export { geometry_opacity_1 as geometry_opacity }; + let geometry_thin_walled_1: string; + export { geometry_thin_walled_1 as geometry_thin_walled }; + } + export { inputs_787 as inputs }; + export namespace outputs_787 { + let base_out: string; + let base_color_out: string; + let diffuse_roughness_out: string; + let metalness_out: string; + let specular_out: string; + let specular_color_out: string; + let specular_roughness_out: string; + let specular_IOR_out: string; + let specular_anisotropy_out: string; + let transmission_out: string; + let transmission_color_out: string; + let transmission_depth_out: string; + let transmission_scatter_out: string; + let transmission_scatter_anisotropy_out: string; + let transmission_dispersion_out: string; + let subsurface_out: string; + let subsurface_color_out: string; + let subsurface_radius_out: string; + let subsurface_scale_out: string; + let subsurface_anisotropy_out: string; + let sheen_out: string; + let sheen_color_out: string; + let sheen_roughness_out: string; + let coat_out: string; + let coat_color_out: string; + let coat_roughness_out: string; + let coat_anisotropy_out: string; + let coat_IOR_out: string; + let coat_affect_roughness_out: string; + let thin_film_thickness_out: string; + let thin_film_IOR_out: string; + let emission_out: string; + let emission_color_out: string; + let opacity_out: string; + let thin_walled_out: string; + } + export { outputs_787 as outputs }; + } + namespace ND_standard_surface_to_open_pbr_surface { + let node_788: string; + export { node_788 as node }; + let inherit_788: null; + export { inherit_788 as inherit }; + export namespace inputs_788 { + let base_5: string; + export { base_5 as base }; + let base_color_5: string; + export { base_color_5 as base_color }; + let diffuse_roughness_1: string; + export { diffuse_roughness_1 as diffuse_roughness }; + let metalness_1: string; + export { metalness_1 as metalness }; + let specular_3: string; + export { specular_3 as specular }; + let specular_color_4: string; + export { specular_color_4 as specular_color }; + let specular_roughness_3: string; + export { specular_roughness_3 as specular_roughness }; + let specular_IOR_1: string; + export { specular_IOR_1 as specular_IOR }; + let specular_anisotropy_1: string; + export { specular_anisotropy_1 as specular_anisotropy }; + let transmission_3: string; + export { transmission_3 as transmission }; + let transmission_color_4: string; + export { transmission_color_4 as transmission_color }; + let transmission_depth_3: string; + export { transmission_depth_3 as transmission_depth }; + let transmission_scatter_3: string; + export { transmission_scatter_3 as transmission_scatter }; + let transmission_scatter_anisotropy_3: string; + export { transmission_scatter_anisotropy_3 as transmission_scatter_anisotropy }; + let transmission_dispersion_1: string; + export { transmission_dispersion_1 as transmission_dispersion }; + let subsurface_2: string; + export { subsurface_2 as subsurface }; + let subsurface_color_3: string; + export { subsurface_color_3 as subsurface_color }; + let subsurface_radius_3: string; + export { subsurface_radius_3 as subsurface_radius }; + let subsurface_scale_1: string; + export { subsurface_scale_1 as subsurface_scale }; + let subsurface_anisotropy_1: string; + export { subsurface_anisotropy_1 as subsurface_anisotropy }; + let sheen_2: string; + export { sheen_2 as sheen }; + let sheen_color_2: string; + export { sheen_color_2 as sheen_color }; + let sheen_roughness_2: string; + export { sheen_roughness_2 as sheen_roughness }; + let coat_1: string; + export { coat_1 as coat }; + let coat_color_3: string; + export { coat_color_3 as coat_color }; + let coat_roughness_3: string; + export { coat_roughness_3 as coat_roughness }; + let coat_anisotropy_1: string; + export { coat_anisotropy_1 as coat_anisotropy }; + let coat_IOR_1: string; + export { coat_IOR_1 as coat_IOR }; + let coat_affect_roughness_1: string; + export { coat_affect_roughness_1 as coat_affect_roughness }; + let thin_film_thickness_3: string; + export { thin_film_thickness_3 as thin_film_thickness }; + let thin_film_IOR_1: string; + export { thin_film_IOR_1 as thin_film_IOR }; + let emission_2: string; + export { emission_2 as emission }; + let emission_color_4: string; + export { emission_color_4 as emission_color }; + let opacity_4: string; + export { opacity_4 as opacity }; + let thin_walled_2: string; + export { thin_walled_2 as thin_walled }; + } + export { inputs_788 as inputs }; + export namespace outputs_788 { + export let base_weight_out: string; + let base_color_out_1: string; + export { base_color_out_1 as base_color_out }; + export let base_diffuse_roughness_out: string; + export let base_metalness_out: string; + export let specular_weight_out: string; + let specular_color_out_1: string; + export { specular_color_out_1 as specular_color_out }; + let specular_roughness_out_1: string; + export { specular_roughness_out_1 as specular_roughness_out }; + export let specular_ior_out: string; + export let specular_roughness_anisotropy_out: string; + export let transmission_weight_out: string; + let transmission_color_out_1: string; + export { transmission_color_out_1 as transmission_color_out }; + let transmission_depth_out_1: string; + export { transmission_depth_out_1 as transmission_depth_out }; + let transmission_scatter_out_1: string; + export { transmission_scatter_out_1 as transmission_scatter_out }; + let transmission_scatter_anisotropy_out_1: string; + export { transmission_scatter_anisotropy_out_1 as transmission_scatter_anisotropy_out }; + export let transmission_dispersion_scale_out: string; + export let subsurface_weight_out: string; + let subsurface_color_out_1: string; + export { subsurface_color_out_1 as subsurface_color_out }; + let subsurface_radius_out_1: string; + export { subsurface_radius_out_1 as subsurface_radius_out }; + export let subsurface_radius_scale_out: string; + export let subsurface_scatter_anisotropy_out: string; + export let fuzz_weight_out: string; + export let fuzz_color_out: string; + export let fuzz_roughness_out: string; + export let coat_weight_out: string; + let coat_color_out_1: string; + export { coat_color_out_1 as coat_color_out }; + let coat_roughness_out_1: string; + export { coat_roughness_out_1 as coat_roughness_out }; + export let coat_roughness_anisotropy_out: string; + export let coat_ior_out: string; + export let coat_darkening_out: string; + export let thin_film_weight_out: string; + let thin_film_thickness_out_1: string; + export { thin_film_thickness_out_1 as thin_film_thickness_out }; + export let thin_film_ior_out: string; + export let emission_luminance_out: string; + let emission_color_out_1: string; + export { emission_color_out_1 as emission_color_out }; + export let geometry_opacity_out: string; + export let geometry_thin_walled_out: string; + } + export { outputs_788 as outputs }; + } + namespace ND_standard_surface_to_UsdPreviewSurface { + let node_789: string; + export { node_789 as node }; + let inherit_789: null; + export { inherit_789 as inherit }; + export namespace inputs_789 { + let metalness_2: string; + export { metalness_2 as metalness }; + let base_6: string; + export { base_6 as base }; + let base_color_6: string; + export { base_color_6 as base_color }; + let specular_4: string; + export { specular_4 as specular }; + let specular_color_5: string; + export { specular_color_5 as specular_color }; + let specular_IOR_2: string; + export { specular_IOR_2 as specular_IOR }; + let specular_roughness_4: string; + export { specular_roughness_4 as specular_roughness }; + let coat_2: string; + export { coat_2 as coat }; + let coat_color_4: string; + export { coat_color_4 as coat_color }; + let coat_roughness_4: string; + export { coat_roughness_4 as coat_roughness }; + let subsurface_3: string; + export { subsurface_3 as subsurface }; + let subsurface_color_4: string; + export { subsurface_color_4 as subsurface_color }; + let emission_3: string; + export { emission_3 as emission }; + let emission_color_5: string; + export { emission_color_5 as emission_color }; + let opacity_5: string; + export { opacity_5 as opacity }; + let normal_29: string; + export { normal_29 as normal }; + } + export { inputs_789 as inputs }; + export namespace outputs_789 { + export let diffuseColor_out: string; + export let emissiveColor_out: string; + export let metallic_out: string; + export let roughness_out: string; + export let clearcoat_out: string; + export let clearcoatRoughness_out: string; + let opacity_out_1: string; + export { opacity_out_1 as opacity_out }; + export let ior_out: string; + export let normal_out: string; + } + export { outputs_789 as outputs }; + } + namespace ND_standard_surface_to_gltf_pbr { + let node_790: string; + export { node_790 as node }; + let inherit_790: null; + export { inherit_790 as inherit }; + export namespace inputs_790 { + let base_7: string; + export { base_7 as base }; + let base_color_7: string; + export { base_color_7 as base_color }; + let metalness_3: string; + export { metalness_3 as metalness }; + let specular_5: string; + export { specular_5 as specular }; + let specular_color_6: string; + export { specular_color_6 as specular_color }; + let specular_anisotropy_2: string; + export { specular_anisotropy_2 as specular_anisotropy }; + let specular_rotation_1: string; + export { specular_rotation_1 as specular_rotation }; + let specular_roughness_5: string; + export { specular_roughness_5 as specular_roughness }; + let specular_IOR_3: string; + export { specular_IOR_3 as specular_IOR }; + let transmission_4: string; + export { transmission_4 as transmission }; + let transmission_color_5: string; + export { transmission_color_5 as transmission_color }; + let transmission_depth_4: string; + export { transmission_depth_4 as transmission_depth }; + let transmission_dispersion_2: string; + export { transmission_dispersion_2 as transmission_dispersion }; + let sheen_3: string; + export { sheen_3 as sheen }; + let sheen_color_3: string; + export { sheen_color_3 as sheen_color }; + let sheen_roughness_3: string; + export { sheen_roughness_3 as sheen_roughness }; + let coat_3: string; + export { coat_3 as coat }; + let coat_color_5: string; + export { coat_color_5 as coat_color }; + let coat_roughness_5: string; + export { coat_roughness_5 as coat_roughness }; + let emission_4: string; + export { emission_4 as emission }; + let emission_color_6: string; + export { emission_color_6 as emission_color }; + let normal_30: string; + export { normal_30 as normal }; + let tangent_11: string; + export { tangent_11 as tangent }; + let opacity_6: string; + export { opacity_6 as opacity }; + let thin_walled_3: string; + export { thin_walled_3 as thin_walled }; + } + export { inputs_790 as inputs }; + export namespace outputs_790 { + let base_color_out_2: string; + export { base_color_out_2 as base_color_out }; + let metallic_out_1: string; + export { metallic_out_1 as metallic_out }; + let roughness_out_1: string; + export { roughness_out_1 as roughness_out }; + let specular_out_1: string; + export { specular_out_1 as specular_out }; + let specular_color_out_2: string; + export { specular_color_out_2 as specular_color_out }; + let ior_out_1: string; + export { ior_out_1 as ior_out }; + let anisotropy_strength_out_1: string; + export { anisotropy_strength_out_1 as anisotropy_strength_out }; + let anisotropy_rotation_out_1: string; + export { anisotropy_rotation_out_1 as anisotropy_rotation_out }; + let transmission_out_1: string; + export { transmission_out_1 as transmission_out }; + export let thickness_out: string; + export let attenuation_color_out: string; + export let attenuation_distance_out: string; + let sheen_color_out_1: string; + export { sheen_color_out_1 as sheen_color_out }; + let sheen_roughness_out_1: string; + export { sheen_roughness_out_1 as sheen_roughness_out }; + let clearcoat_out_1: string; + export { clearcoat_out_1 as clearcoat_out }; + export let clearcoat_roughness_out: string; + export let dispersion_out: string; + export let emissive_out: string; + export let emissive_strength_out: string; + let normal_out_1: string; + export { normal_out_1 as normal_out }; + export let tangent_out: string; + export let alpha_out: string; + export let alpha_mode_out: string; + } + export { outputs_790 as outputs }; + } + namespace ND_lama_sheen { + let node_791: string; + export { node_791 as node }; + let inherit_791: null; + export { inherit_791 as inherit }; + export namespace inputs_791 { + let color_13: string; + export { color_13 as color }; + let roughness_14: string; + export { roughness_14 as roughness }; + let normal_31: string; + export { normal_31 as normal }; + } + export { inputs_791 as inputs }; + export namespace outputs_791 { + let out_771: string; + export { out_771 as out }; + } + export { outputs_791 as outputs }; + } + namespace ND_lama_sss { + let node_792: string; + export { node_792 as node }; + let inherit_792: null; + export { inherit_792 as inherit }; + export namespace inputs_792 { + let color_14: string; + export { color_14 as color }; + let normal_32: string; + export { normal_32 as normal }; + export let sssRadius: string; + export let sssScale: string; + export let sssMode: string; + export let sssIOR: string; + export let sssAnisotropy: string; + export let sssBleed: string; + export let sssFollowTopology: string; + export let sssSubset: string; + export let sssContinuationRays: string; + export let sssUnitLength: string; + let mode_1: string; + export { mode_1 as mode }; + export let albedoInversionMethod: string; + } + export { inputs_792 as inputs }; + export namespace outputs_792 { + let out_772: string; + export { out_772 as out }; + } + export { outputs_792 as outputs }; + } + namespace ND_lama_dielectric { + let node_793: string; + export { node_793 as node }; + let inherit_793: null; + export { inherit_793 as inherit }; + export namespace inputs_793 { + export let reflectionTint: string; + export let transmissionTint: string; + export let fresnelMode: string; + export let IOR: string; + let reflectivity_1: string; + export { reflectivity_1 as reflectivity }; + let roughness_15: string; + export { roughness_15 as roughness }; + let normal_33: string; + export { normal_33 as normal }; + let anisotropy_5: string; + export { anisotropy_5 as anisotropy }; + let direction_2: string; + export { direction_2 as direction }; + let rotation_5: string; + export { rotation_5 as rotation }; + export let absorptionColor: string; + export let absorptionRadius: string; + export let scatterColor: string; + export let scatterAnisotropy: string; + } + export { inputs_793 as inputs }; + export namespace outputs_793 { + let out_773: string; + export { out_773 as out }; + } + export { outputs_793 as outputs }; + } + namespace ND_lama_iridescence { + let node_794: string; + export { node_794 as node }; + let inherit_794: null; + export { inherit_794 as inherit }; + export namespace inputs_794 { + let roughness_16: string; + export { roughness_16 as roughness }; + let anisotropy_6: string; + export { anisotropy_6 as anisotropy }; + export let anisotropyDirection: string; + export let anisotropyRotation: string; + export let relativeFilmThickness: string; + export let minFilmThickness: string; + export let maxFilmThickness: string; + export let filmIOR: string; + } + export { inputs_794 as inputs }; + export namespace outputs_794 { + let out_774: string; + export { out_774 as out }; + } + export { outputs_794 as outputs }; + } + namespace ND_lama_diffuse { + let node_795: string; + export { node_795 as node }; + let inherit_795: null; + export { inherit_795 as inherit }; + export namespace inputs_795 { + let color_15: string; + export { color_15 as color }; + let roughness_17: string; + export { roughness_17 as roughness }; + let normal_34: string; + export { normal_34 as normal }; + export let energyCompensation: string; + } + export { inputs_795 as inputs }; + export namespace outputs_795 { + let out_775: string; + export { out_775 as out }; + } + export { outputs_795 as outputs }; + } + namespace ND_lama_mix_bsdf { + let node_796: string; + export { node_796 as node }; + let inherit_796: null; + export { inherit_796 as inherit }; + export namespace inputs_796 { + export let material1: string; + export let material2: string; + let mix_44: string; + export { mix_44 as mix }; + } + export { inputs_796 as inputs }; + export namespace outputs_796 { + let out_776: string; + export { out_776 as out }; + } + export { outputs_796 as outputs }; + } + namespace ND_lama_mix_edf { + let node_797: string; + export { node_797 as node }; + let inherit_797: null; + export { inherit_797 as inherit }; + export namespace inputs_797 { + let material1_1: string; + export { material1_1 as material1 }; + let material2_1: string; + export { material2_1 as material2 }; + let mix_45: string; + export { mix_45 as mix }; + } + export { inputs_797 as inputs }; + export namespace outputs_797 { + let out_777: string; + export { out_777 as out }; + } + export { outputs_797 as outputs }; + } + namespace ND_lama_add_bsdf { + let node_798: string; + export { node_798 as node }; + let inherit_798: null; + export { inherit_798 as inherit }; + export namespace inputs_798 { + let material1_2: string; + export { material1_2 as material1 }; + let material2_2: string; + export { material2_2 as material2 }; + export let weight1: string; + export let weight2: string; + } + export { inputs_798 as inputs }; + export namespace outputs_798 { + let out_778: string; + export { out_778 as out }; + } + export { outputs_798 as outputs }; + } + namespace ND_lama_add_edf { + let node_799: string; + export { node_799 as node }; + let inherit_799: null; + export { inherit_799 as inherit }; + export namespace inputs_799 { + let material1_3: string; + export { material1_3 as material1 }; + let material2_3: string; + export { material2_3 as material2 }; + let weight1_1: string; + export { weight1_1 as weight1 }; + let weight2_1: string; + export { weight2_1 as weight2 }; + } + export { inputs_799 as inputs }; + export namespace outputs_799 { + let out_779: string; + export { out_779 as out }; + } + export { outputs_799 as outputs }; + } + namespace ND_lama_conductor { + let node_800: string; + export { node_800 as node }; + let inherit_800: null; + export { inherit_800 as inherit }; + export namespace inputs_800 { + let tint_1: string; + export { tint_1 as tint }; + let fresnelMode_1: string; + export { fresnelMode_1 as fresnelMode }; + let IOR_1: string; + export { IOR_1 as IOR }; + let extinction_2: string; + export { extinction_2 as extinction }; + let reflectivity_2: string; + export { reflectivity_2 as reflectivity }; + export let edgeColor: string; + let roughness_18: string; + export { roughness_18 as roughness }; + let normal_35: string; + export { normal_35 as normal }; + let anisotropy_7: string; + export { anisotropy_7 as anisotropy }; + let anisotropyDirection_1: string; + export { anisotropyDirection_1 as anisotropyDirection }; + let anisotropyRotation_1: string; + export { anisotropyRotation_1 as anisotropyRotation }; + } + export { inputs_800 as inputs }; + export namespace outputs_800 { + let out_780: string; + export { out_780 as out }; + } + export { outputs_800 as outputs }; + } + namespace ND_lama_emission { + let node_801: string; + export { node_801 as node }; + let inherit_801: null; + export { inherit_801 as inherit }; + export namespace inputs_801 { + let color_16: string; + export { color_16 as color }; + } + export { inputs_801 as inputs }; + export namespace outputs_801 { + let out_781: string; + export { out_781 as out }; + } + export { outputs_801 as outputs }; + } + namespace ND_lama_surface { + let node_802: string; + export { node_802 as node }; + let inherit_802: null; + export { inherit_802 as inherit }; + export namespace inputs_802 { + export let materialFront: string; + export let materialBack: string; + let presence_2: string; + export { presence_2 as presence }; + } + export { inputs_802 as inputs }; + export namespace outputs_802 { + let out_782: string; + export { out_782 as out }; + } + export { outputs_802 as outputs }; + } + namespace ND_lama_generalized_schlick { + let node_803: string; + export { node_803 as node }; + let inherit_803: null; + export { inherit_803 as inherit }; + export namespace inputs_803 { + let reflectionTint_1: string; + export { reflectionTint_1 as reflectionTint }; + let transmissionTint_1: string; + export { transmissionTint_1 as transmissionTint }; + let fresnelMode_2: string; + export { fresnelMode_2 as fresnelMode }; + let IOR_2: string; + export { IOR_2 as IOR }; + let reflectivity_3: string; + export { reflectivity_3 as reflectivity }; + export let reflectivity90: string; + export let reflectivityProfile: string; + let roughness_19: string; + export { roughness_19 as roughness }; + let normal_36: string; + export { normal_36 as normal }; + let anisotropy_8: string; + export { anisotropy_8 as anisotropy }; + let anisotropyDirection_2: string; + export { anisotropyDirection_2 as anisotropyDirection }; + let anisotropyRotation_2: string; + export { anisotropyRotation_2 as anisotropyRotation }; + let absorptionColor_1: string; + export { absorptionColor_1 as absorptionColor }; + let absorptionRadius_1: string; + export { absorptionRadius_1 as absorptionRadius }; + let scatterColor_1: string; + export { scatterColor_1 as scatterColor }; + let scatterAnisotropy_1: string; + export { scatterAnisotropy_1 as scatterAnisotropy }; + } + export { inputs_803 as inputs }; + export namespace outputs_803 { + let out_783: string; + export { out_783 as out }; + } + export { outputs_803 as outputs }; + } + namespace ND_lama_translucent { + let node_804: string; + export { node_804 as node }; + let inherit_804: null; + export { inherit_804 as inherit }; + export namespace inputs_804 { + let color_17: string; + export { color_17 as color }; + let roughness_20: string; + export { roughness_20 as roughness }; + let normal_37: string; + export { normal_37 as normal }; + let energyCompensation_1: string; + export { energyCompensation_1 as energyCompensation }; + } + export { inputs_804 as inputs }; + export namespace outputs_804 { + let out_784: string; + export { out_784 as out }; + } + export { outputs_804 as outputs }; + } + namespace ND_lama_layer_bsdf { + let node_805: string; + export { node_805 as node }; + let inherit_805: null; + export { inherit_805 as inherit }; + export namespace inputs_805 { + let materialTop: string; + let materialBase: string; + let topMix: string; + let topThickness: string; + } + export { inputs_805 as inputs }; + export namespace outputs_805 { + let out_785: string; + export { out_785 as out }; + } + export { outputs_805 as outputs }; + } + } + namespace resolved { + export namespace ND_oren_nayar_diffuse_bsdf_1 { + let node_806: string; + export { node_806 as node }; + export namespace inputs_806 { + let weight_8: string; + export { weight_8 as weight }; + let color_18: string; + export { color_18 as color }; + let roughness_21: string; + export { roughness_21 as roughness }; + let normal_38: string; + export { normal_38 as normal }; + let energy_compensation_1: string; + export { energy_compensation_1 as energy_compensation }; + } + export { inputs_806 as inputs }; + export namespace outputs_806 { + let out_786: string; + export { out_786 as out }; + } + export { outputs_806 as outputs }; + } + export { ND_oren_nayar_diffuse_bsdf_1 as ND_oren_nayar_diffuse_bsdf }; + export namespace ND_burley_diffuse_bsdf_1 { + let node_807: string; + export { node_807 as node }; + export namespace inputs_807 { + let weight_9: string; + export { weight_9 as weight }; + let color_19: string; + export { color_19 as color }; + let roughness_22: string; + export { roughness_22 as roughness }; + let normal_39: string; + export { normal_39 as normal }; + } + export { inputs_807 as inputs }; + export namespace outputs_807 { + let out_787: string; + export { out_787 as out }; + } + export { outputs_807 as outputs }; + } + export { ND_burley_diffuse_bsdf_1 as ND_burley_diffuse_bsdf }; + export namespace ND_translucent_bsdf_1 { + let node_808: string; + export { node_808 as node }; + export namespace inputs_808 { + let weight_10: string; + export { weight_10 as weight }; + let color_20: string; + export { color_20 as color }; + let normal_40: string; + export { normal_40 as normal }; + } + export { inputs_808 as inputs }; + export namespace outputs_808 { + let out_788: string; + export { out_788 as out }; + } + export { outputs_808 as outputs }; + } + export { ND_translucent_bsdf_1 as ND_translucent_bsdf }; + export namespace ND_dielectric_bsdf_1 { + let node_809: string; + export { node_809 as node }; + export namespace inputs_809 { + let weight_11: string; + export { weight_11 as weight }; + let tint_2: string; + export { tint_2 as tint }; + let ior_8: string; + export { ior_8 as ior }; + let roughness_23: string; + export { roughness_23 as roughness }; + let retroreflective_3: string; + export { retroreflective_3 as retroreflective }; + let thinfilm_thickness_3: string; + export { thinfilm_thickness_3 as thinfilm_thickness }; + let thinfilm_ior_3: string; + export { thinfilm_ior_3 as thinfilm_ior }; + let normal_41: string; + export { normal_41 as normal }; + let tangent_12: string; + export { tangent_12 as tangent }; + let distribution_3: string; + export { distribution_3 as distribution }; + let scatter_mode_2: string; + export { scatter_mode_2 as scatter_mode }; + } + export { inputs_809 as inputs }; + export namespace outputs_809 { + let out_789: string; + export { out_789 as out }; + } + export { outputs_809 as outputs }; + } + export { ND_dielectric_bsdf_1 as ND_dielectric_bsdf }; + export namespace ND_conductor_bsdf_1 { + let node_810: string; + export { node_810 as node }; + export namespace inputs_810 { + let weight_12: string; + export { weight_12 as weight }; + let ior_9: string; + export { ior_9 as ior }; + let extinction_3: string; + export { extinction_3 as extinction }; + let roughness_24: string; + export { roughness_24 as roughness }; + let retroreflective_4: string; + export { retroreflective_4 as retroreflective }; + let thinfilm_thickness_4: string; + export { thinfilm_thickness_4 as thinfilm_thickness }; + let thinfilm_ior_4: string; + export { thinfilm_ior_4 as thinfilm_ior }; + let normal_42: string; + export { normal_42 as normal }; + let tangent_13: string; + export { tangent_13 as tangent }; + let distribution_4: string; + export { distribution_4 as distribution }; + } + export { inputs_810 as inputs }; + export namespace outputs_810 { + let out_790: string; + export { out_790 as out }; + } + export { outputs_810 as outputs }; + } + export { ND_conductor_bsdf_1 as ND_conductor_bsdf }; + export namespace ND_generalized_schlick_bsdf_1 { + let node_811: string; + export { node_811 as node }; + export namespace inputs_811 { + let weight_13: string; + export { weight_13 as weight }; + let color0_2: string; + export { color0_2 as color0 }; + let color82_1: string; + export { color82_1 as color82 }; + let color90_2: string; + export { color90_2 as color90 }; + let exponent_2: string; + export { exponent_2 as exponent }; + let roughness_25: string; + export { roughness_25 as roughness }; + let retroreflective_5: string; + export { retroreflective_5 as retroreflective }; + let thinfilm_thickness_5: string; + export { thinfilm_thickness_5 as thinfilm_thickness }; + let thinfilm_ior_5: string; + export { thinfilm_ior_5 as thinfilm_ior }; + let normal_43: string; + export { normal_43 as normal }; + let tangent_14: string; + export { tangent_14 as tangent }; + let distribution_5: string; + export { distribution_5 as distribution }; + let scatter_mode_3: string; + export { scatter_mode_3 as scatter_mode }; + } + export { inputs_811 as inputs }; + export namespace outputs_811 { + let out_791: string; + export { out_791 as out }; + } + export { outputs_811 as outputs }; + } + export { ND_generalized_schlick_bsdf_1 as ND_generalized_schlick_bsdf }; + export namespace ND_subsurface_bsdf_1 { + let node_812: string; + export { node_812 as node }; + export namespace inputs_812 { + let weight_14: string; + export { weight_14 as weight }; + let color_21: string; + export { color_21 as color }; + let radius_5: string; + export { radius_5 as radius }; + let anisotropy_9: string; + export { anisotropy_9 as anisotropy }; + let normal_44: string; + export { normal_44 as normal }; + } + export { inputs_812 as inputs }; + export namespace outputs_812 { + let out_792: string; + export { out_792 as out }; + } + export { outputs_812 as outputs }; + } + export { ND_subsurface_bsdf_1 as ND_subsurface_bsdf }; + export namespace ND_sheen_bsdf_1 { + let node_813: string; + export { node_813 as node }; + export namespace inputs_813 { + let weight_15: string; + export { weight_15 as weight }; + let color_22: string; + export { color_22 as color }; + let roughness_26: string; + export { roughness_26 as roughness }; + let normal_45: string; + export { normal_45 as normal }; + let mode_2: string; + export { mode_2 as mode }; + } + export { inputs_813 as inputs }; + export namespace outputs_813 { + let out_793: string; + export { out_793 as out }; + } + export { outputs_813 as outputs }; + } + export { ND_sheen_bsdf_1 as ND_sheen_bsdf }; + export namespace ND_chiang_hair_bsdf_1 { + let node_814: string; + export { node_814 as node }; + export namespace inputs_814 { + let tint_R_1: string; + export { tint_R_1 as tint_R }; + let tint_TT_1: string; + export { tint_TT_1 as tint_TT }; + let tint_TRT_1: string; + export { tint_TRT_1 as tint_TRT }; + let ior_10: string; + export { ior_10 as ior }; + let roughness_R_2: string; + export { roughness_R_2 as roughness_R }; + let roughness_TT_2: string; + export { roughness_TT_2 as roughness_TT }; + let roughness_TRT_2: string; + export { roughness_TRT_2 as roughness_TRT }; + let cuticle_angle_1: string; + export { cuticle_angle_1 as cuticle_angle }; + let absorption_coefficient_1: string; + export { absorption_coefficient_1 as absorption_coefficient }; + let normal_46: string; + export { normal_46 as normal }; + let curve_direction_1: string; + export { curve_direction_1 as curve_direction }; + } + export { inputs_814 as inputs }; + export namespace outputs_814 { + let out_794: string; + export { out_794 as out }; + } + export { outputs_814 as outputs }; + } + export { ND_chiang_hair_bsdf_1 as ND_chiang_hair_bsdf }; + export namespace ND_uniform_edf_1 { + let node_815: string; + export { node_815 as node }; + export namespace inputs_815 { + let color_23: string; + export { color_23 as color }; + } + export { inputs_815 as inputs }; + export namespace outputs_815 { + let out_795: string; + export { out_795 as out }; + } + export { outputs_815 as outputs }; + } + export { ND_uniform_edf_1 as ND_uniform_edf }; + export namespace ND_conical_edf_1 { + let node_816: string; + export { node_816 as node }; + export namespace inputs_816 { + let color_24: string; + export { color_24 as color }; + let normal_47: string; + export { normal_47 as normal }; + let inner_angle_2: string; + export { inner_angle_2 as inner_angle }; + let outer_angle_2: string; + export { outer_angle_2 as outer_angle }; + } + export { inputs_816 as inputs }; + export namespace outputs_816 { + let out_796: string; + export { out_796 as out }; + } + export { outputs_816 as outputs }; + } + export { ND_conical_edf_1 as ND_conical_edf }; + export namespace ND_measured_edf_1 { + let node_817: string; + export { node_817 as node }; + export namespace inputs_817 { + let color_25: string; + export { color_25 as color }; + let normal_48: string; + export { normal_48 as normal }; + let file_26: string; + export { file_26 as file }; + } + export { inputs_817 as inputs }; + export namespace outputs_817 { + let out_797: string; + export { out_797 as out }; + } + export { outputs_817 as outputs }; + } + export { ND_measured_edf_1 as ND_measured_edf }; + export namespace ND_generalized_schlick_edf_1 { + let node_818: string; + export { node_818 as node }; + export namespace inputs_818 { + let color0_3: string; + export { color0_3 as color0 }; + let color90_3: string; + export { color90_3 as color90 }; + let exponent_3: string; + export { exponent_3 as exponent }; + let base_8: string; + export { base_8 as base }; + } + export { inputs_818 as inputs }; + export namespace outputs_818 { + let out_798: string; + export { out_798 as out }; + } + export { outputs_818 as outputs }; + } + export { ND_generalized_schlick_edf_1 as ND_generalized_schlick_edf }; + export namespace ND_absorption_vdf_1 { + let node_819: string; + export { node_819 as node }; + export namespace inputs_819 { + let absorption_4: string; + export { absorption_4 as absorption }; + } + export { inputs_819 as inputs }; + export namespace outputs_819 { + let out_799: string; + export { out_799 as out }; + } + export { outputs_819 as outputs }; + } + export { ND_absorption_vdf_1 as ND_absorption_vdf }; + export namespace ND_anisotropic_vdf_1 { + let node_820: string; + export { node_820 as node }; + export namespace inputs_820 { + let absorption_5: string; + export { absorption_5 as absorption }; + let scattering_1: string; + export { scattering_1 as scattering }; + let anisotropy_10: string; + export { anisotropy_10 as anisotropy }; + } + export { inputs_820 as inputs }; + export namespace outputs_820 { + let out_800: string; + export { out_800 as out }; + } + export { outputs_820 as outputs }; + } + export { ND_anisotropic_vdf_1 as ND_anisotropic_vdf }; + export namespace ND_surface_1 { + let node_821: string; + export { node_821 as node }; + export namespace inputs_821 { + let bsdf_1: string; + export { bsdf_1 as bsdf }; + let edf_3: string; + export { edf_3 as edf }; + let opacity_7: string; + export { opacity_7 as opacity }; + let thin_walled_4: string; + export { thin_walled_4 as thin_walled }; + } + export { inputs_821 as inputs }; + export namespace outputs_821 { + let out_801: string; + export { out_801 as out }; + } + export { outputs_821 as outputs }; + } + export { ND_surface_1 as ND_surface }; + export namespace ND_volume_1 { + let node_822: string; + export { node_822 as node }; + export namespace inputs_822 { + let vdf_1: string; + export { vdf_1 as vdf }; + let edf_4: string; + export { edf_4 as edf }; + } + export { inputs_822 as inputs }; + export namespace outputs_822 { + let out_802: string; + export { out_802 as out }; + } + export { outputs_822 as outputs }; + } + export { ND_volume_1 as ND_volume }; + export namespace ND_light_1 { + let node_823: string; + export { node_823 as node }; + export namespace inputs_823 { + let edf_5: string; + export { edf_5 as edf }; + let intensity_4: string; + export { intensity_4 as intensity }; + let exposure_3: string; + export { exposure_3 as exposure }; + } + export { inputs_823 as inputs }; + export namespace outputs_823 { + let out_803: string; + export { out_803 as out }; + } + export { outputs_823 as outputs }; + } + export { ND_light_1 as ND_light }; + export namespace ND_displacement_float_1 { + let node_824: string; + export { node_824 as node }; + export namespace inputs_824 { + let displacement_3: string; + export { displacement_3 as displacement }; + let scale_20: string; + export { scale_20 as scale }; + } + export { inputs_824 as inputs }; + export namespace outputs_824 { + let out_804: string; + export { out_804 as out }; + } + export { outputs_824 as outputs }; + } + export { ND_displacement_float_1 as ND_displacement_float }; + export namespace ND_displacement_vector3_1 { + let node_825: string; + export { node_825 as node }; + export namespace inputs_825 { + let displacement_4: string; + export { displacement_4 as displacement }; + let scale_21: string; + export { scale_21 as scale }; + } + export { inputs_825 as inputs }; + export namespace outputs_825 { + let out_805: string; + export { out_805 as out }; + } + export { outputs_825 as outputs }; + } + export { ND_displacement_vector3_1 as ND_displacement_vector3 }; + export namespace ND_layer_bsdf_1 { + let node_826: string; + export { node_826 as node }; + export namespace inputs_826 { + let top_2: string; + export { top_2 as top }; + let base_9: string; + export { base_9 as base }; + } + export { inputs_826 as inputs }; + export namespace outputs_826 { + let out_806: string; + export { out_806 as out }; + } + export { outputs_826 as outputs }; + } + export { ND_layer_bsdf_1 as ND_layer_bsdf }; + export namespace ND_layer_vdf_1 { + let node_827: string; + export { node_827 as node }; + export namespace inputs_827 { + let top_3: string; + export { top_3 as top }; + let base_10: string; + export { base_10 as base }; + } + export { inputs_827 as inputs }; + export namespace outputs_827 { + let out_807: string; + export { out_807 as out }; + } + export { outputs_827 as outputs }; + } + export { ND_layer_vdf_1 as ND_layer_vdf }; + export namespace ND_mix_bsdf_1 { + let node_828: string; + export { node_828 as node }; + export namespace inputs_828 { + let fg_44: string; + export { fg_44 as fg }; + let bg_44: string; + export { bg_44 as bg }; + let mix_46: string; + export { mix_46 as mix }; + } + export { inputs_828 as inputs }; + export namespace outputs_828 { + let out_808: string; + export { out_808 as out }; + } + export { outputs_828 as outputs }; + } + export { ND_mix_bsdf_1 as ND_mix_bsdf }; + export namespace ND_mix_edf_1 { + let node_829: string; + export { node_829 as node }; + export namespace inputs_829 { + let fg_45: string; + export { fg_45 as fg }; + let bg_45: string; + export { bg_45 as bg }; + let mix_47: string; + export { mix_47 as mix }; + } + export { inputs_829 as inputs }; + export namespace outputs_829 { + let out_809: string; + export { out_809 as out }; + } + export { outputs_829 as outputs }; + } + export { ND_mix_edf_1 as ND_mix_edf }; + export namespace ND_mix_vdf_1 { + let node_830: string; + export { node_830 as node }; + export namespace inputs_830 { + let fg_46: string; + export { fg_46 as fg }; + let bg_46: string; + export { bg_46 as bg }; + let mix_48: string; + export { mix_48 as mix }; + } + export { inputs_830 as inputs }; + export namespace outputs_830 { + let out_810: string; + export { out_810 as out }; + } + export { outputs_830 as outputs }; + } + export { ND_mix_vdf_1 as ND_mix_vdf }; + export namespace ND_add_bsdf_1 { + let node_831: string; + export { node_831 as node }; + export namespace inputs_831 { + let in1_222: string; + export { in1_222 as in1 }; + let in2_222: string; + export { in2_222 as in2 }; + } + export { inputs_831 as inputs }; + export namespace outputs_831 { + let out_811: string; + export { out_811 as out }; + } + export { outputs_831 as outputs }; + } + export { ND_add_bsdf_1 as ND_add_bsdf }; + export namespace ND_add_edf_1 { + let node_832: string; + export { node_832 as node }; + export namespace inputs_832 { + let in1_223: string; + export { in1_223 as in1 }; + let in2_223: string; + export { in2_223 as in2 }; + } + export { inputs_832 as inputs }; + export namespace outputs_832 { + let out_812: string; + export { out_812 as out }; + } + export { outputs_832 as outputs }; + } + export { ND_add_edf_1 as ND_add_edf }; + export namespace ND_add_vdf_1 { + let node_833: string; + export { node_833 as node }; + export namespace inputs_833 { + let in1_224: string; + export { in1_224 as in1 }; + let in2_224: string; + export { in2_224 as in2 }; + } + export { inputs_833 as inputs }; + export namespace outputs_833 { + let out_813: string; + export { out_813 as out }; + } + export { outputs_833 as outputs }; + } + export { ND_add_vdf_1 as ND_add_vdf }; + export namespace ND_multiply_bsdfC_1 { + let node_834: string; + export { node_834 as node }; + export namespace inputs_834 { + let in1_225: string; + export { in1_225 as in1 }; + let in2_225: string; + export { in2_225 as in2 }; + } + export { inputs_834 as inputs }; + export namespace outputs_834 { + let out_814: string; + export { out_814 as out }; + } + export { outputs_834 as outputs }; + } + export { ND_multiply_bsdfC_1 as ND_multiply_bsdfC }; + export namespace ND_multiply_bsdfF_1 { + let node_835: string; + export { node_835 as node }; + export namespace inputs_835 { + let in1_226: string; + export { in1_226 as in1 }; + let in2_226: string; + export { in2_226 as in2 }; + } + export { inputs_835 as inputs }; + export namespace outputs_835 { + let out_815: string; + export { out_815 as out }; + } + export { outputs_835 as outputs }; + } + export { ND_multiply_bsdfF_1 as ND_multiply_bsdfF }; + export namespace ND_multiply_edfC_1 { + let node_836: string; + export { node_836 as node }; + export namespace inputs_836 { + let in1_227: string; + export { in1_227 as in1 }; + let in2_227: string; + export { in2_227 as in2 }; + } + export { inputs_836 as inputs }; + export namespace outputs_836 { + let out_816: string; + export { out_816 as out }; + } + export { outputs_836 as outputs }; + } + export { ND_multiply_edfC_1 as ND_multiply_edfC }; + export namespace ND_multiply_edfF_1 { + let node_837: string; + export { node_837 as node }; + export namespace inputs_837 { + let in1_228: string; + export { in1_228 as in1 }; + let in2_228: string; + export { in2_228 as in2 }; + } + export { inputs_837 as inputs }; + export namespace outputs_837 { + let out_817: string; + export { out_817 as out }; + } + export { outputs_837 as outputs }; + } + export { ND_multiply_edfF_1 as ND_multiply_edfF }; + export namespace ND_multiply_vdfC_1 { + let node_838: string; + export { node_838 as node }; + export namespace inputs_838 { + let in1_229: string; + export { in1_229 as in1 }; + let in2_229: string; + export { in2_229 as in2 }; + } + export { inputs_838 as inputs }; + export namespace outputs_838 { + let out_818: string; + export { out_818 as out }; + } + export { outputs_838 as outputs }; + } + export { ND_multiply_vdfC_1 as ND_multiply_vdfC }; + export namespace ND_multiply_vdfF_1 { + let node_839: string; + export { node_839 as node }; + export namespace inputs_839 { + let in1_230: string; + export { in1_230 as in1 }; + let in2_230: string; + export { in2_230 as in2 }; + } + export { inputs_839 as inputs }; + export namespace outputs_839 { + let out_819: string; + export { out_819 as out }; + } + export { outputs_839 as outputs }; + } + export { ND_multiply_vdfF_1 as ND_multiply_vdfF }; + export namespace ND_roughness_anisotropy_1 { + let node_840: string; + export { node_840 as node }; + export namespace inputs_840 { + let roughness_27: string; + export { roughness_27 as roughness }; + let anisotropy_11: string; + export { anisotropy_11 as anisotropy }; + } + export { inputs_840 as inputs }; + export namespace outputs_840 { + let out_820: string; + export { out_820 as out }; + } + export { outputs_840 as outputs }; + } + export { ND_roughness_anisotropy_1 as ND_roughness_anisotropy }; + export namespace ND_roughness_dual_1 { + let node_841: string; + export { node_841 as node }; + export namespace inputs_841 { + let roughness_28: string; + export { roughness_28 as roughness }; + } + export { inputs_841 as inputs }; + export namespace outputs_841 { + let out_821: string; + export { out_821 as out }; + } + export { outputs_841 as outputs }; + } + export { ND_roughness_dual_1 as ND_roughness_dual }; + export namespace ND_glossiness_anisotropy_1 { + let node_842: string; + export { node_842 as node }; + export namespace inputs_842 { + let glossiness_1: string; + export { glossiness_1 as glossiness }; + let anisotropy_12: string; + export { anisotropy_12 as anisotropy }; + } + export { inputs_842 as inputs }; + export namespace outputs_842 { + let out_822: string; + export { out_822 as out }; + } + export { outputs_842 as outputs }; + } + export { ND_glossiness_anisotropy_1 as ND_glossiness_anisotropy }; + export namespace ND_blackbody_1 { + let node_843: string; + export { node_843 as node }; + export namespace inputs_843 { + let temperature_1: string; + export { temperature_1 as temperature }; + } + export { inputs_843 as inputs }; + export namespace outputs_843 { + let out_823: string; + export { out_823 as out }; + } + export { outputs_843 as outputs }; + } + export { ND_blackbody_1 as ND_blackbody }; + export namespace ND_artistic_ior_1 { + let node_844: string; + export { node_844 as node }; + export namespace inputs_844 { + let reflectivity_4: string; + export { reflectivity_4 as reflectivity }; + let edge_color_1: string; + export { edge_color_1 as edge_color }; + } + export { inputs_844 as inputs }; + export namespace outputs_844 { + let ior_11: string; + export { ior_11 as ior }; + let extinction_4: string; + export { extinction_4 as extinction }; + } + export { outputs_844 as outputs }; + } + export { ND_artistic_ior_1 as ND_artistic_ior }; + export namespace ND_deon_hair_absorption_from_melanin_1 { + let node_845: string; + export { node_845 as node }; + export namespace inputs_845 { + let melanin_concentration_1: string; + export { melanin_concentration_1 as melanin_concentration }; + let melanin_redness_1: string; + export { melanin_redness_1 as melanin_redness }; + let eumelanin_color_1: string; + export { eumelanin_color_1 as eumelanin_color }; + let pheomelanin_color_1: string; + export { pheomelanin_color_1 as pheomelanin_color }; + } + export { inputs_845 as inputs }; + export namespace outputs_845 { + let absorption_6: string; + export { absorption_6 as absorption }; + } + export { outputs_845 as outputs }; + } + export { ND_deon_hair_absorption_from_melanin_1 as ND_deon_hair_absorption_from_melanin }; + export namespace ND_chiang_hair_absorption_from_color_1 { + let node_846: string; + export { node_846 as node }; + export namespace inputs_846 { + let color_26: string; + export { color_26 as color }; + let azimuthal_roughness_1: string; + export { azimuthal_roughness_1 as azimuthal_roughness }; + } + export { inputs_846 as inputs }; + export namespace outputs_846 { + let absorption_7: string; + export { absorption_7 as absorption }; + } + export { outputs_846 as outputs }; + } + export { ND_chiang_hair_absorption_from_color_1 as ND_chiang_hair_absorption_from_color }; + export namespace ND_chiang_hair_roughness_1 { + let node_847: string; + export { node_847 as node }; + export namespace inputs_847 { + let longitudinal_1: string; + export { longitudinal_1 as longitudinal }; + let azimuthal_1: string; + export { azimuthal_1 as azimuthal }; + let scale_TT_1: string; + export { scale_TT_1 as scale_TT }; + let scale_TRT_1: string; + export { scale_TRT_1 as scale_TRT }; + } + export { inputs_847 as inputs }; + export namespace outputs_847 { + let roughness_R_3: string; + export { roughness_R_3 as roughness_R }; + let roughness_TT_3: string; + export { roughness_TT_3 as roughness_TT }; + let roughness_TRT_3: string; + export { roughness_TRT_3 as roughness_TRT }; + } + export { outputs_847 as outputs }; + } + export { ND_chiang_hair_roughness_1 as ND_chiang_hair_roughness }; + export namespace ND_disney_principled_1 { + let node_848: string; + export { node_848 as node }; + export namespace inputs_848 { + let baseColor_1: string; + export { baseColor_1 as baseColor }; + let metallic_3: string; + export { metallic_3 as metallic }; + let roughness_29: string; + export { roughness_29 as roughness }; + let anisotropic_1: string; + export { anisotropic_1 as anisotropic }; + let specular_6: string; + export { specular_6 as specular }; + let specularTint_1: string; + export { specularTint_1 as specularTint }; + let sheen_4: string; + export { sheen_4 as sheen }; + let sheenTint_1: string; + export { sheenTint_1 as sheenTint }; + let clearcoat_3: string; + export { clearcoat_3 as clearcoat }; + let clearcoatGloss_1: string; + export { clearcoatGloss_1 as clearcoatGloss }; + let specTrans_1: string; + export { specTrans_1 as specTrans }; + let ior_12: string; + export { ior_12 as ior }; + let subsurface_4: string; + export { subsurface_4 as subsurface }; + let subsurfaceDistance_1: string; + export { subsurfaceDistance_1 as subsurfaceDistance }; + } + export { inputs_848 as inputs }; + export namespace outputs_848 { + let out_824: string; + export { out_824 as out }; + } + export { outputs_848 as outputs }; + } + export { ND_disney_principled_1 as ND_disney_principled }; + export namespace ND_open_pbr_surface_surfaceshader_1 { + let node_849: string; + export { node_849 as node }; + export namespace inputs_849 { + let base_weight_2: string; + export { base_weight_2 as base_weight }; + let base_color_8: string; + export { base_color_8 as base_color }; + let base_diffuse_roughness_2: string; + export { base_diffuse_roughness_2 as base_diffuse_roughness }; + let base_metalness_2: string; + export { base_metalness_2 as base_metalness }; + let specular_weight_2: string; + export { specular_weight_2 as specular_weight }; + let specular_color_7: string; + export { specular_color_7 as specular_color }; + let specular_roughness_6: string; + export { specular_roughness_6 as specular_roughness }; + let specular_ior_2: string; + export { specular_ior_2 as specular_ior }; + let specular_roughness_anisotropy_2: string; + export { specular_roughness_anisotropy_2 as specular_roughness_anisotropy }; + let transmission_weight_2: string; + export { transmission_weight_2 as transmission_weight }; + let transmission_color_6: string; + export { transmission_color_6 as transmission_color }; + let transmission_depth_5: string; + export { transmission_depth_5 as transmission_depth }; + let transmission_scatter_4: string; + export { transmission_scatter_4 as transmission_scatter }; + let transmission_scatter_anisotropy_4: string; + export { transmission_scatter_anisotropy_4 as transmission_scatter_anisotropy }; + let transmission_dispersion_scale_2: string; + export { transmission_dispersion_scale_2 as transmission_dispersion_scale }; + let transmission_dispersion_abbe_number_1: string; + export { transmission_dispersion_abbe_number_1 as transmission_dispersion_abbe_number }; + let subsurface_weight_2: string; + export { subsurface_weight_2 as subsurface_weight }; + let subsurface_color_5: string; + export { subsurface_color_5 as subsurface_color }; + let subsurface_radius_4: string; + export { subsurface_radius_4 as subsurface_radius }; + let subsurface_radius_scale_2: string; + export { subsurface_radius_scale_2 as subsurface_radius_scale }; + let subsurface_scatter_anisotropy_2: string; + export { subsurface_scatter_anisotropy_2 as subsurface_scatter_anisotropy }; + let fuzz_weight_2: string; + export { fuzz_weight_2 as fuzz_weight }; + let fuzz_color_2: string; + export { fuzz_color_2 as fuzz_color }; + let fuzz_roughness_2: string; + export { fuzz_roughness_2 as fuzz_roughness }; + let coat_weight_2: string; + export { coat_weight_2 as coat_weight }; + let coat_color_6: string; + export { coat_color_6 as coat_color }; + let coat_roughness_6: string; + export { coat_roughness_6 as coat_roughness }; + let coat_roughness_anisotropy_2: string; + export { coat_roughness_anisotropy_2 as coat_roughness_anisotropy }; + let coat_ior_2: string; + export { coat_ior_2 as coat_ior }; + let coat_darkening_2: string; + export { coat_darkening_2 as coat_darkening }; + let thin_film_weight_2: string; + export { thin_film_weight_2 as thin_film_weight }; + let thin_film_thickness_4: string; + export { thin_film_thickness_4 as thin_film_thickness }; + let thin_film_ior_2: string; + export { thin_film_ior_2 as thin_film_ior }; + let emission_luminance_2: string; + export { emission_luminance_2 as emission_luminance }; + let emission_color_7: string; + export { emission_color_7 as emission_color }; + let geometry_opacity_2: string; + export { geometry_opacity_2 as geometry_opacity }; + let geometry_thin_walled_2: string; + export { geometry_thin_walled_2 as geometry_thin_walled }; + let geometry_normal_1: string; + export { geometry_normal_1 as geometry_normal }; + let geometry_coat_normal_1: string; + export { geometry_coat_normal_1 as geometry_coat_normal }; + let geometry_tangent_1: string; + export { geometry_tangent_1 as geometry_tangent }; + let geometry_coat_tangent_1: string; + export { geometry_coat_tangent_1 as geometry_coat_tangent }; + } + export { inputs_849 as inputs }; + export namespace outputs_849 { + let out_825: string; + export { out_825 as out }; + } + export { outputs_849 as outputs }; + } + export { ND_open_pbr_surface_surfaceshader_1 as ND_open_pbr_surface_surfaceshader }; + export namespace ND_open_pbr_anisotropy_1 { + let node_850: string; + export { node_850 as node }; + export namespace inputs_850 { + let roughness_30: string; + export { roughness_30 as roughness }; + let anisotropy_13: string; + export { anisotropy_13 as anisotropy }; + } + export { inputs_850 as inputs }; + export namespace outputs_850 { + let out_826: string; + export { out_826 as out }; + } + export { outputs_850 as outputs }; + } + export { ND_open_pbr_anisotropy_1 as ND_open_pbr_anisotropy }; + export namespace ND_UsdPreviewSurface_surfaceshader_1 { + let node_851: string; + export { node_851 as node }; + export namespace inputs_851 { + let diffuseColor_1: string; + export { diffuseColor_1 as diffuseColor }; + let emissiveColor_1: string; + export { emissiveColor_1 as emissiveColor }; + let useSpecularWorkflow_1: string; + export { useSpecularWorkflow_1 as useSpecularWorkflow }; + let specularColor_1: string; + export { specularColor_1 as specularColor }; + let metallic_4: string; + export { metallic_4 as metallic }; + let roughness_31: string; + export { roughness_31 as roughness }; + let clearcoat_4: string; + export { clearcoat_4 as clearcoat }; + let clearcoatRoughness_1: string; + export { clearcoatRoughness_1 as clearcoatRoughness }; + let opacity_8: string; + export { opacity_8 as opacity }; + let opacityMode_1: string; + export { opacityMode_1 as opacityMode }; + let opacityThreshold_1: string; + export { opacityThreshold_1 as opacityThreshold }; + let ior_13: string; + export { ior_13 as ior }; + let normal_49: string; + export { normal_49 as normal }; + let displacement_5: string; + export { displacement_5 as displacement }; + let occlusion_2: string; + export { occlusion_2 as occlusion }; + } + export { inputs_851 as inputs }; + export namespace outputs_851 { + let out_827: string; + export { out_827 as out }; + } + export { outputs_851 as outputs }; + } + export { ND_UsdPreviewSurface_surfaceshader_1 as ND_UsdPreviewSurface_surfaceshader }; + export namespace ND_UsdUVTexture_23_1 { + let node_852: string; + export { node_852 as node }; + export namespace inputs_852 { + let file_27: string; + export { file_27 as file }; + let st_1: string; + export { st_1 as st }; + let wrapS_1: string; + export { wrapS_1 as wrapS }; + let wrapT_1: string; + export { wrapT_1 as wrapT }; + let fallback_9: string; + export { fallback_9 as fallback }; + let scale_22: string; + export { scale_22 as scale }; + let bias_1: string; + export { bias_1 as bias }; + } + export { inputs_852 as inputs }; + export namespace outputs_852 { + let r_2: string; + export { r_2 as r }; + let g_2: string; + export { g_2 as g }; + let b_2: string; + export { b_2 as b }; + let a_2: string; + export { a_2 as a }; + let rgb_2: string; + export { rgb_2 as rgb }; + } + export { outputs_852 as outputs }; + } + export { ND_UsdUVTexture_23_1 as ND_UsdUVTexture_23 }; + export namespace ND_UsdUVTexture_1 { + let node_853: string; + export { node_853 as node }; + export namespace inputs_853 { + let file_28: string; + export { file_28 as file }; + let st_2: string; + export { st_2 as st }; + let wrapS_2: string; + export { wrapS_2 as wrapS }; + let wrapT_2: string; + export { wrapT_2 as wrapT }; + let fallback_10: string; + export { fallback_10 as fallback }; + let scale_23: string; + export { scale_23 as scale }; + let bias_2: string; + export { bias_2 as bias }; + } + export { inputs_853 as inputs }; + export namespace outputs_853 { + let r_3: string; + export { r_3 as r }; + let g_3: string; + export { g_3 as g }; + let b_3: string; + export { b_3 as b }; + let a_3: string; + export { a_3 as a }; + let rgb_3: string; + export { rgb_3 as rgb }; + let rgba_1: string; + export { rgba_1 as rgba }; + } + export { outputs_853 as outputs }; + } + export { ND_UsdUVTexture_1 as ND_UsdUVTexture }; + export namespace ND_UsdPrimvarReader_integer_1 { + let node_854: string; + export { node_854 as node }; + export namespace inputs_854 { + let varname_8: string; + export { varname_8 as varname }; + let fallback_11: string; + export { fallback_11 as fallback }; + } + export { inputs_854 as inputs }; + export namespace outputs_854 { + let out_828: string; + export { out_828 as out }; + } + export { outputs_854 as outputs }; + } + export { ND_UsdPrimvarReader_integer_1 as ND_UsdPrimvarReader_integer }; + export namespace ND_UsdPrimvarReader_boolean_1 { + let node_855: string; + export { node_855 as node }; + export namespace inputs_855 { + let varname_9: string; + export { varname_9 as varname }; + let fallback_12: string; + export { fallback_12 as fallback }; + } + export { inputs_855 as inputs }; + export namespace outputs_855 { + let out_829: string; + export { out_829 as out }; + } + export { outputs_855 as outputs }; + } + export { ND_UsdPrimvarReader_boolean_1 as ND_UsdPrimvarReader_boolean }; + export namespace ND_UsdPrimvarReader_string_1 { + let node_856: string; + export { node_856 as node }; + export namespace inputs_856 { + let varname_10: string; + export { varname_10 as varname }; + let fallback_13: string; + export { fallback_13 as fallback }; + } + export { inputs_856 as inputs }; + export namespace outputs_856 { + let out_830: string; + export { out_830 as out }; + } + export { outputs_856 as outputs }; + } + export { ND_UsdPrimvarReader_string_1 as ND_UsdPrimvarReader_string }; + export namespace ND_UsdPrimvarReader_filename_1 { + let node_857: string; + export { node_857 as node }; + export namespace inputs_857 { + let varname_11: string; + export { varname_11 as varname }; + let fallback_14: string; + export { fallback_14 as fallback }; + } + export { inputs_857 as inputs }; + export namespace outputs_857 { + let out_831: string; + export { out_831 as out }; + } + export { outputs_857 as outputs }; + } + export { ND_UsdPrimvarReader_filename_1 as ND_UsdPrimvarReader_filename }; + export namespace ND_UsdPrimvarReader_float_1 { + let node_858: string; + export { node_858 as node }; + export namespace inputs_858 { + let varname_12: string; + export { varname_12 as varname }; + let fallback_15: string; + export { fallback_15 as fallback }; + } + export { inputs_858 as inputs }; + export namespace outputs_858 { + let out_832: string; + export { out_832 as out }; + } + export { outputs_858 as outputs }; + } + export { ND_UsdPrimvarReader_float_1 as ND_UsdPrimvarReader_float }; + export namespace ND_UsdPrimvarReader_vector2_1 { + let node_859: string; + export { node_859 as node }; + export namespace inputs_859 { + let varname_13: string; + export { varname_13 as varname }; + let fallback_16: string; + export { fallback_16 as fallback }; + } + export { inputs_859 as inputs }; + export namespace outputs_859 { + let out_833: string; + export { out_833 as out }; + } + export { outputs_859 as outputs }; + } + export { ND_UsdPrimvarReader_vector2_1 as ND_UsdPrimvarReader_vector2 }; + export namespace ND_UsdPrimvarReader_vector3_1 { + let node_860: string; + export { node_860 as node }; + export namespace inputs_860 { + let varname_14: string; + export { varname_14 as varname }; + let fallback_17: string; + export { fallback_17 as fallback }; + } + export { inputs_860 as inputs }; + export namespace outputs_860 { + let out_834: string; + export { out_834 as out }; + } + export { outputs_860 as outputs }; + } + export { ND_UsdPrimvarReader_vector3_1 as ND_UsdPrimvarReader_vector3 }; + export namespace ND_UsdPrimvarReader_vector4_1 { + let node_861: string; + export { node_861 as node }; + export namespace inputs_861 { + let varname_15: string; + export { varname_15 as varname }; + let fallback_18: string; + export { fallback_18 as fallback }; + } + export { inputs_861 as inputs }; + export namespace outputs_861 { + let out_835: string; + export { out_835 as out }; + } + export { outputs_861 as outputs }; + } + export { ND_UsdPrimvarReader_vector4_1 as ND_UsdPrimvarReader_vector4 }; + export namespace ND_UsdTransform2d_1 { + let node_862: string; + export { node_862 as node }; + export namespace inputs_862 { + let _in_291: string; + export { _in_291 as in }; + let rotation_6: string; + export { rotation_6 as rotation }; + let scale_24: string; + export { scale_24 as scale }; + let translation_1: string; + export { translation_1 as translation }; + } + export { inputs_862 as inputs }; + export namespace outputs_862 { + let out_836: string; + export { out_836 as out }; + } + export { outputs_862 as outputs }; + } + export { ND_UsdTransform2d_1 as ND_UsdTransform2d }; + export namespace ND_standard_surface_surfaceshader_100_1 { + let node_863: string; + export { node_863 as node }; + export namespace inputs_863 { + let base_11: string; + export { base_11 as base }; + let base_color_9: string; + export { base_color_9 as base_color }; + let diffuse_roughness_2: string; + export { diffuse_roughness_2 as diffuse_roughness }; + let metalness_4: string; + export { metalness_4 as metalness }; + let specular_7: string; + export { specular_7 as specular }; + let specular_color_8: string; + export { specular_color_8 as specular_color }; + let specular_roughness_7: string; + export { specular_roughness_7 as specular_roughness }; + let specular_IOR_4: string; + export { specular_IOR_4 as specular_IOR }; + let specular_anisotropy_3: string; + export { specular_anisotropy_3 as specular_anisotropy }; + let specular_rotation_2: string; + export { specular_rotation_2 as specular_rotation }; + let transmission_5: string; + export { transmission_5 as transmission }; + let transmission_color_7: string; + export { transmission_color_7 as transmission_color }; + let transmission_depth_6: string; + export { transmission_depth_6 as transmission_depth }; + let transmission_scatter_5: string; + export { transmission_scatter_5 as transmission_scatter }; + let transmission_scatter_anisotropy_5: string; + export { transmission_scatter_anisotropy_5 as transmission_scatter_anisotropy }; + let transmission_dispersion_3: string; + export { transmission_dispersion_3 as transmission_dispersion }; + let transmission_extra_roughness_1: string; + export { transmission_extra_roughness_1 as transmission_extra_roughness }; + let subsurface_5: string; + export { subsurface_5 as subsurface }; + let subsurface_color_6: string; + export { subsurface_color_6 as subsurface_color }; + let subsurface_radius_5: string; + export { subsurface_radius_5 as subsurface_radius }; + let subsurface_scale_2: string; + export { subsurface_scale_2 as subsurface_scale }; + let subsurface_anisotropy_2: string; + export { subsurface_anisotropy_2 as subsurface_anisotropy }; + let sheen_5: string; + export { sheen_5 as sheen }; + let sheen_color_4: string; + export { sheen_color_4 as sheen_color }; + let sheen_roughness_4: string; + export { sheen_roughness_4 as sheen_roughness }; + let coat_4: string; + export { coat_4 as coat }; + let coat_color_7: string; + export { coat_color_7 as coat_color }; + let coat_roughness_7: string; + export { coat_roughness_7 as coat_roughness }; + let coat_anisotropy_2: string; + export { coat_anisotropy_2 as coat_anisotropy }; + let coat_rotation_1: string; + export { coat_rotation_1 as coat_rotation }; + let coat_IOR_2: string; + export { coat_IOR_2 as coat_IOR }; + let coat_normal_1: string; + export { coat_normal_1 as coat_normal }; + let coat_affect_color_1: string; + export { coat_affect_color_1 as coat_affect_color }; + let coat_affect_roughness_2: string; + export { coat_affect_roughness_2 as coat_affect_roughness }; + let thin_film_thickness_5: string; + export { thin_film_thickness_5 as thin_film_thickness }; + let thin_film_IOR_2: string; + export { thin_film_IOR_2 as thin_film_IOR }; + let emission_5: string; + export { emission_5 as emission }; + let emission_color_8: string; + export { emission_color_8 as emission_color }; + let opacity_9: string; + export { opacity_9 as opacity }; + let thin_walled_5: string; + export { thin_walled_5 as thin_walled }; + let normal_50: string; + export { normal_50 as normal }; + let tangent_15: string; + export { tangent_15 as tangent }; + } + export { inputs_863 as inputs }; + export namespace outputs_863 { + let out_837: string; + export { out_837 as out }; + } + export { outputs_863 as outputs }; + } + export { ND_standard_surface_surfaceshader_100_1 as ND_standard_surface_surfaceshader_100 }; + export namespace ND_standard_surface_surfaceshader_1 { + let node_864: string; + export { node_864 as node }; + export namespace inputs_864 { + let base_12: string; + export { base_12 as base }; + let base_color_10: string; + export { base_color_10 as base_color }; + let diffuse_roughness_3: string; + export { diffuse_roughness_3 as diffuse_roughness }; + let metalness_5: string; + export { metalness_5 as metalness }; + let specular_8: string; + export { specular_8 as specular }; + let specular_color_9: string; + export { specular_color_9 as specular_color }; + let specular_roughness_8: string; + export { specular_roughness_8 as specular_roughness }; + let specular_IOR_5: string; + export { specular_IOR_5 as specular_IOR }; + let specular_anisotropy_4: string; + export { specular_anisotropy_4 as specular_anisotropy }; + let specular_rotation_3: string; + export { specular_rotation_3 as specular_rotation }; + let transmission_6: string; + export { transmission_6 as transmission }; + let transmission_color_8: string; + export { transmission_color_8 as transmission_color }; + let transmission_depth_7: string; + export { transmission_depth_7 as transmission_depth }; + let transmission_scatter_6: string; + export { transmission_scatter_6 as transmission_scatter }; + let transmission_scatter_anisotropy_6: string; + export { transmission_scatter_anisotropy_6 as transmission_scatter_anisotropy }; + let transmission_dispersion_4: string; + export { transmission_dispersion_4 as transmission_dispersion }; + let transmission_extra_roughness_2: string; + export { transmission_extra_roughness_2 as transmission_extra_roughness }; + let subsurface_6: string; + export { subsurface_6 as subsurface }; + let subsurface_color_7: string; + export { subsurface_color_7 as subsurface_color }; + let subsurface_radius_6: string; + export { subsurface_radius_6 as subsurface_radius }; + let subsurface_scale_3: string; + export { subsurface_scale_3 as subsurface_scale }; + let subsurface_anisotropy_3: string; + export { subsurface_anisotropy_3 as subsurface_anisotropy }; + let sheen_6: string; + export { sheen_6 as sheen }; + let sheen_color_5: string; + export { sheen_color_5 as sheen_color }; + let sheen_roughness_5: string; + export { sheen_roughness_5 as sheen_roughness }; + let coat_5: string; + export { coat_5 as coat }; + let coat_color_8: string; + export { coat_color_8 as coat_color }; + let coat_roughness_8: string; + export { coat_roughness_8 as coat_roughness }; + let coat_anisotropy_3: string; + export { coat_anisotropy_3 as coat_anisotropy }; + let coat_rotation_2: string; + export { coat_rotation_2 as coat_rotation }; + let coat_IOR_3: string; + export { coat_IOR_3 as coat_IOR }; + let coat_normal_2: string; + export { coat_normal_2 as coat_normal }; + let coat_affect_color_2: string; + export { coat_affect_color_2 as coat_affect_color }; + let coat_affect_roughness_3: string; + export { coat_affect_roughness_3 as coat_affect_roughness }; + let thin_film_thickness_6: string; + export { thin_film_thickness_6 as thin_film_thickness }; + let thin_film_IOR_3: string; + export { thin_film_IOR_3 as thin_film_IOR }; + let emission_6: string; + export { emission_6 as emission }; + let emission_color_9: string; + export { emission_color_9 as emission_color }; + let opacity_10: string; + export { opacity_10 as opacity }; + let thin_walled_6: string; + export { thin_walled_6 as thin_walled }; + let normal_51: string; + export { normal_51 as normal }; + let tangent_16: string; + export { tangent_16 as tangent }; + } + export { inputs_864 as inputs }; + export namespace outputs_864 { + let out_838: string; + export { out_838 as out }; + } + export { outputs_864 as outputs }; + } + export { ND_standard_surface_surfaceshader_1 as ND_standard_surface_surfaceshader }; + export namespace ND_gltf_pbr_surfaceshader_1 { + let node_865: string; + export { node_865 as node }; + export namespace inputs_865 { + let base_color_11: string; + export { base_color_11 as base_color }; + let metallic_5: string; + export { metallic_5 as metallic }; + let roughness_32: string; + export { roughness_32 as roughness }; + let normal_52: string; + export { normal_52 as normal }; + let tangent_17: string; + export { tangent_17 as tangent }; + let occlusion_3: string; + export { occlusion_3 as occlusion }; + let transmission_7: string; + export { transmission_7 as transmission }; + let specular_9: string; + export { specular_9 as specular }; + let specular_color_10: string; + export { specular_color_10 as specular_color }; + let ior_14: string; + export { ior_14 as ior }; + let alpha_1: string; + export { alpha_1 as alpha }; + let alpha_mode_1: string; + export { alpha_mode_1 as alpha_mode }; + let alpha_cutoff_1: string; + export { alpha_cutoff_1 as alpha_cutoff }; + let iridescence_1: string; + export { iridescence_1 as iridescence }; + let iridescence_ior_1: string; + export { iridescence_ior_1 as iridescence_ior }; + let iridescence_thickness_1: string; + export { iridescence_thickness_1 as iridescence_thickness }; + let sheen_color_6: string; + export { sheen_color_6 as sheen_color }; + let sheen_roughness_6: string; + export { sheen_roughness_6 as sheen_roughness }; + let clearcoat_5: string; + export { clearcoat_5 as clearcoat }; + let clearcoat_roughness_1: string; + export { clearcoat_roughness_1 as clearcoat_roughness }; + let clearcoat_normal_1: string; + export { clearcoat_normal_1 as clearcoat_normal }; + let emissive_1: string; + export { emissive_1 as emissive }; + let emissive_strength_1: string; + export { emissive_strength_1 as emissive_strength }; + let thickness_3: string; + export { thickness_3 as thickness }; + let attenuation_distance_1: string; + export { attenuation_distance_1 as attenuation_distance }; + let attenuation_color_1: string; + export { attenuation_color_1 as attenuation_color }; + let anisotropy_strength_2: string; + export { anisotropy_strength_2 as anisotropy_strength }; + let anisotropy_rotation_2: string; + export { anisotropy_rotation_2 as anisotropy_rotation }; + let dispersion_1: string; + export { dispersion_1 as dispersion }; + } + export { inputs_865 as inputs }; + export namespace outputs_865 { + let out_839: string; + export { out_839 as out }; + } + export { outputs_865 as outputs }; + } + export { ND_gltf_pbr_surfaceshader_1 as ND_gltf_pbr_surfaceshader }; + export namespace ND_gltf_colorimage_1 { + let node_866: string; + export { node_866 as node }; + export namespace inputs_866 { + let file_29: string; + export { file_29 as file }; + let _default_40: string; + export { _default_40 as default }; + let texcoord_94: string; + export { texcoord_94 as texcoord }; + let pivot_42: string; + export { pivot_42 as pivot }; + let scale_25: string; + export { scale_25 as scale }; + let rotate_9: string; + export { rotate_9 as rotate }; + let offset_14: string; + export { offset_14 as offset }; + let operationorder_8: string; + export { operationorder_8 as operationorder }; + let uaddressmode_14: string; + export { uaddressmode_14 as uaddressmode }; + let vaddressmode_14: string; + export { vaddressmode_14 as vaddressmode }; + let filtertype_32: string; + export { filtertype_32 as filtertype }; + let color_27: string; + export { color_27 as color }; + let geomcolor_1: string; + export { geomcolor_1 as geomcolor }; + } + export { inputs_866 as inputs }; + export namespace outputs_866 { + let outcolor_1: string; + export { outcolor_1 as outcolor }; + let outa_2: string; + export { outa_2 as outa }; + } + export { outputs_866 as outputs }; + } + export { ND_gltf_colorimage_1 as ND_gltf_colorimage }; + export namespace ND_gltf_image_color3_color3_1_0_1 { + let node_867: string; + export { node_867 as node }; + export namespace inputs_867 { + let file_30: string; + export { file_30 as file }; + let factor_3: string; + export { factor_3 as factor }; + let _default_41: string; + export { _default_41 as default }; + let texcoord_95: string; + export { texcoord_95 as texcoord }; + let pivot_43: string; + export { pivot_43 as pivot }; + let scale_26: string; + export { scale_26 as scale }; + let rotate_10: string; + export { rotate_10 as rotate }; + let offset_15: string; + export { offset_15 as offset }; + let operationorder_9: string; + export { operationorder_9 as operationorder }; + let uaddressmode_15: string; + export { uaddressmode_15 as uaddressmode }; + let vaddressmode_15: string; + export { vaddressmode_15 as vaddressmode }; + let filtertype_33: string; + export { filtertype_33 as filtertype }; + } + export { inputs_867 as inputs }; + export namespace outputs_867 { + let out_840: string; + export { out_840 as out }; + } + export { outputs_867 as outputs }; + } + export { ND_gltf_image_color3_color3_1_0_1 as ND_gltf_image_color3_color3_1_0 }; + export namespace ND_gltf_image_color4_color4_1_0_1 { + let node_868: string; + export { node_868 as node }; + export namespace inputs_868 { + let file_31: string; + export { file_31 as file }; + let factor_4: string; + export { factor_4 as factor }; + let _default_42: string; + export { _default_42 as default }; + let texcoord_96: string; + export { texcoord_96 as texcoord }; + let pivot_44: string; + export { pivot_44 as pivot }; + let scale_27: string; + export { scale_27 as scale }; + let rotate_11: string; + export { rotate_11 as rotate }; + let offset_16: string; + export { offset_16 as offset }; + let operationorder_10: string; + export { operationorder_10 as operationorder }; + let uaddressmode_16: string; + export { uaddressmode_16 as uaddressmode }; + let vaddressmode_16: string; + export { vaddressmode_16 as vaddressmode }; + let filtertype_34: string; + export { filtertype_34 as filtertype }; + } + export { inputs_868 as inputs }; + export namespace outputs_868 { + let out_841: string; + export { out_841 as out }; + } + export { outputs_868 as outputs }; + } + export { ND_gltf_image_color4_color4_1_0_1 as ND_gltf_image_color4_color4_1_0 }; + export namespace ND_gltf_image_float_float_1_0_1 { + let node_869: string; + export { node_869 as node }; + export namespace inputs_869 { + let file_32: string; + export { file_32 as file }; + let factor_5: string; + export { factor_5 as factor }; + let _default_43: string; + export { _default_43 as default }; + let texcoord_97: string; + export { texcoord_97 as texcoord }; + let pivot_45: string; + export { pivot_45 as pivot }; + let scale_28: string; + export { scale_28 as scale }; + let rotate_12: string; + export { rotate_12 as rotate }; + let offset_17: string; + export { offset_17 as offset }; + let operationorder_11: string; + export { operationorder_11 as operationorder }; + let uaddressmode_17: string; + export { uaddressmode_17 as uaddressmode }; + let vaddressmode_17: string; + export { vaddressmode_17 as vaddressmode }; + let filtertype_35: string; + export { filtertype_35 as filtertype }; + } + export { inputs_869 as inputs }; + export namespace outputs_869 { + let out_842: string; + export { out_842 as out }; + } + export { outputs_869 as outputs }; + } + export { ND_gltf_image_float_float_1_0_1 as ND_gltf_image_float_float_1_0 }; + export namespace ND_gltf_image_vector3_vector3_1_0_1 { + let node_870: string; + export { node_870 as node }; + export namespace inputs_870 { + let file_33: string; + export { file_33 as file }; + let _default_44: string; + export { _default_44 as default }; + let texcoord_98: string; + export { texcoord_98 as texcoord }; + let pivot_46: string; + export { pivot_46 as pivot }; + let scale_29: string; + export { scale_29 as scale }; + let rotate_13: string; + export { rotate_13 as rotate }; + let offset_18: string; + export { offset_18 as offset }; + let operationorder_12: string; + export { operationorder_12 as operationorder }; + let uaddressmode_18: string; + export { uaddressmode_18 as uaddressmode }; + let vaddressmode_18: string; + export { vaddressmode_18 as vaddressmode }; + let filtertype_36: string; + export { filtertype_36 as filtertype }; + } + export { inputs_870 as inputs }; + export namespace outputs_870 { + let out_843: string; + export { out_843 as out }; + } + export { outputs_870 as outputs }; + } + export { ND_gltf_image_vector3_vector3_1_0_1 as ND_gltf_image_vector3_vector3_1_0 }; + export namespace ND_gltf_normalmap_vector3_1_0_1 { + let node_871: string; + export { node_871 as node }; + export namespace inputs_871 { + let file_34: string; + export { file_34 as file }; + let _default_45: string; + export { _default_45 as default }; + let texcoord_99: string; + export { texcoord_99 as texcoord }; + let pivot_47: string; + export { pivot_47 as pivot }; + let scale_30: string; + export { scale_30 as scale }; + let rotate_14: string; + export { rotate_14 as rotate }; + let offset_19: string; + export { offset_19 as offset }; + let operationorder_13: string; + export { operationorder_13 as operationorder }; + let uaddressmode_19: string; + export { uaddressmode_19 as uaddressmode }; + let vaddressmode_19: string; + export { vaddressmode_19 as vaddressmode }; + let filtertype_37: string; + export { filtertype_37 as filtertype }; + } + export { inputs_871 as inputs }; + export namespace outputs_871 { + let out_844: string; + export { out_844 as out }; + } + export { outputs_871 as outputs }; + } + export { ND_gltf_normalmap_vector3_1_0_1 as ND_gltf_normalmap_vector3_1_0 }; + export namespace ND_gltf_iridescence_thickness_float_1_0_1 { + let node_872: string; + export { node_872 as node }; + export namespace inputs_872 { + let file_35: string; + export { file_35 as file }; + let _default_46: string; + export { _default_46 as default }; + let texcoord_100: string; + export { texcoord_100 as texcoord }; + let pivot_48: string; + export { pivot_48 as pivot }; + let scale_31: string; + export { scale_31 as scale }; + let rotate_15: string; + export { rotate_15 as rotate }; + let offset_20: string; + export { offset_20 as offset }; + let uaddressmode_20: string; + export { uaddressmode_20 as uaddressmode }; + let vaddressmode_20: string; + export { vaddressmode_20 as vaddressmode }; + let filtertype_38: string; + export { filtertype_38 as filtertype }; + let thicknessMin_1: string; + export { thicknessMin_1 as thicknessMin }; + let thicknessMax_1: string; + export { thicknessMax_1 as thicknessMax }; + } + export { inputs_872 as inputs }; + export namespace outputs_872 { + let out_845: string; + export { out_845 as out }; + } + export { outputs_872 as outputs }; + } + export { ND_gltf_iridescence_thickness_float_1_0_1 as ND_gltf_iridescence_thickness_float_1_0 }; + export namespace ND_gltf_anisotropy_image_1 { + let node_873: string; + export { node_873 as node }; + export namespace inputs_873 { + let file_36: string; + export { file_36 as file }; + let _default_47: string; + export { _default_47 as default }; + let texcoord_101: string; + export { texcoord_101 as texcoord }; + let pivot_49: string; + export { pivot_49 as pivot }; + let scale_32: string; + export { scale_32 as scale }; + let rotate_16: string; + export { rotate_16 as rotate }; + let offset_21: string; + export { offset_21 as offset }; + let operationorder_14: string; + export { operationorder_14 as operationorder }; + let uaddressmode_21: string; + export { uaddressmode_21 as uaddressmode }; + let vaddressmode_21: string; + export { vaddressmode_21 as vaddressmode }; + let filtertype_39: string; + export { filtertype_39 as filtertype }; + let anisotropy_strength_3: string; + export { anisotropy_strength_3 as anisotropy_strength }; + let anisotropy_rotation_3: string; + export { anisotropy_rotation_3 as anisotropy_rotation }; + } + export { inputs_873 as inputs }; + export namespace outputs_873 { + let anisotropy_strength_out_2: string; + export { anisotropy_strength_out_2 as anisotropy_strength_out }; + let anisotropy_rotation_out_2: string; + export { anisotropy_rotation_out_2 as anisotropy_rotation_out }; + } + export { outputs_873 as outputs }; + } + export { ND_gltf_anisotropy_image_1 as ND_gltf_anisotropy_image }; + export namespace ND_viewdirection_vector3_1 { + let node_874: string; + export { node_874 as node }; + export namespace inputs_874 { + let space_5: string; + export { space_5 as space }; + } + export { inputs_874 as inputs }; + export namespace outputs_874 { + let out_846: string; + export { out_846 as out }; + } + export { outputs_874 as outputs }; + } + export { ND_viewdirection_vector3_1 as ND_viewdirection_vector3 }; + export namespace ND_facingratio_float_1 { + let node_875: string; + export { node_875 as node }; + export namespace inputs_875 { + let viewdirection_1: string; + export { viewdirection_1 as viewdirection }; + let normal_53: string; + export { normal_53 as normal }; + let faceforward_1: string; + export { faceforward_1 as faceforward }; + let invert_1: string; + export { invert_1 as invert }; + } + export { inputs_875 as inputs }; + export namespace outputs_875 { + let out_847: string; + export { out_847 as out }; + } + export { outputs_875 as outputs }; + } + export { ND_facingratio_float_1 as ND_facingratio_float }; + export namespace ND_gooch_shade_1 { + let node_876: string; + export { node_876 as node }; + export namespace inputs_876 { + let warm_color_1: string; + export { warm_color_1 as warm_color }; + let cool_color_1: string; + export { cool_color_1 as cool_color }; + let specular_intensity_1: string; + export { specular_intensity_1 as specular_intensity }; + let shininess_1: string; + export { shininess_1 as shininess }; + let light_direction_1: string; + export { light_direction_1 as light_direction }; + } + export { inputs_876 as inputs }; + export namespace outputs_876 { + let out_848: string; + export { out_848 as out }; + } + export { outputs_876 as outputs }; + } + export { ND_gooch_shade_1 as ND_gooch_shade }; + export namespace ND_g18_rec709_to_lin_rec709_color3_1 { + let node_877: string; + export { node_877 as node }; + export namespace inputs_877 { + let _in_292: string; + export { _in_292 as in }; + } + export { inputs_877 as inputs }; + export namespace outputs_877 { + let out_849: string; + export { out_849 as out }; + } + export { outputs_877 as outputs }; + } + export { ND_g18_rec709_to_lin_rec709_color3_1 as ND_g18_rec709_to_lin_rec709_color3 }; + export namespace ND_g18_rec709_to_lin_rec709_color4_1 { + let node_878: string; + export { node_878 as node }; + export namespace inputs_878 { + let _in_293: string; + export { _in_293 as in }; + } + export { inputs_878 as inputs }; + export namespace outputs_878 { + let out_850: string; + export { out_850 as out }; + } + export { outputs_878 as outputs }; + } + export { ND_g18_rec709_to_lin_rec709_color4_1 as ND_g18_rec709_to_lin_rec709_color4 }; + export namespace ND_g22_rec709_to_lin_rec709_color3_1 { + let node_879: string; + export { node_879 as node }; + export namespace inputs_879 { + let _in_294: string; + export { _in_294 as in }; + } + export { inputs_879 as inputs }; + export namespace outputs_879 { + let out_851: string; + export { out_851 as out }; + } + export { outputs_879 as outputs }; + } + export { ND_g22_rec709_to_lin_rec709_color3_1 as ND_g22_rec709_to_lin_rec709_color3 }; + export namespace ND_g22_rec709_to_lin_rec709_color4_1 { + let node_880: string; + export { node_880 as node }; + export namespace inputs_880 { + let _in_295: string; + export { _in_295 as in }; + } + export { inputs_880 as inputs }; + export namespace outputs_880 { + let out_852: string; + export { out_852 as out }; + } + export { outputs_880 as outputs }; + } + export { ND_g22_rec709_to_lin_rec709_color4_1 as ND_g22_rec709_to_lin_rec709_color4 }; + export namespace ND_rec709_display_to_lin_rec709_color3_1 { + let node_881: string; + export { node_881 as node }; + export namespace inputs_881 { + let _in_296: string; + export { _in_296 as in }; + } + export { inputs_881 as inputs }; + export namespace outputs_881 { + let out_853: string; + export { out_853 as out }; + } + export { outputs_881 as outputs }; + } + export { ND_rec709_display_to_lin_rec709_color3_1 as ND_rec709_display_to_lin_rec709_color3 }; + export namespace ND_rec709_display_to_lin_rec709_color4_1 { + let node_882: string; + export { node_882 as node }; + export namespace inputs_882 { + let _in_297: string; + export { _in_297 as in }; + } + export { inputs_882 as inputs }; + export namespace outputs_882 { + let out_854: string; + export { out_854 as out }; + } + export { outputs_882 as outputs }; + } + export { ND_rec709_display_to_lin_rec709_color4_1 as ND_rec709_display_to_lin_rec709_color4 }; + export namespace ND_acescg_to_lin_rec709_color3_1 { + let node_883: string; + export { node_883 as node }; + export namespace inputs_883 { + let _in_298: string; + export { _in_298 as in }; + } + export { inputs_883 as inputs }; + export namespace outputs_883 { + let out_855: string; + export { out_855 as out }; + } + export { outputs_883 as outputs }; + } + export { ND_acescg_to_lin_rec709_color3_1 as ND_acescg_to_lin_rec709_color3 }; + export namespace ND_acescg_to_lin_rec709_color4_1 { + let node_884: string; + export { node_884 as node }; + export namespace inputs_884 { + let _in_299: string; + export { _in_299 as in }; + } + export { inputs_884 as inputs }; + export namespace outputs_884 { + let out_856: string; + export { out_856 as out }; + } + export { outputs_884 as outputs }; + } + export { ND_acescg_to_lin_rec709_color4_1 as ND_acescg_to_lin_rec709_color4 }; + export namespace ND_g22_ap1_to_lin_rec709_color3_1 { + let node_885: string; + export { node_885 as node }; + export namespace inputs_885 { + let _in_300: string; + export { _in_300 as in }; + } + export { inputs_885 as inputs }; + export namespace outputs_885 { + let out_857: string; + export { out_857 as out }; + } + export { outputs_885 as outputs }; + } + export { ND_g22_ap1_to_lin_rec709_color3_1 as ND_g22_ap1_to_lin_rec709_color3 }; + export namespace ND_g22_ap1_to_lin_rec709_color4_1 { + let node_886: string; + export { node_886 as node }; + export namespace inputs_886 { + let _in_301: string; + export { _in_301 as in }; + } + export { inputs_886 as inputs }; + export namespace outputs_886 { + let out_858: string; + export { out_858 as out }; + } + export { outputs_886 as outputs }; + } + export { ND_g22_ap1_to_lin_rec709_color4_1 as ND_g22_ap1_to_lin_rec709_color4 }; + export namespace ND_srgb_texture_to_lin_rec709_color3_1 { + let node_887: string; + export { node_887 as node }; + export namespace inputs_887 { + let _in_302: string; + export { _in_302 as in }; + } + export { inputs_887 as inputs }; + export namespace outputs_887 { + let out_859: string; + export { out_859 as out }; + } + export { outputs_887 as outputs }; + } + export { ND_srgb_texture_to_lin_rec709_color3_1 as ND_srgb_texture_to_lin_rec709_color3 }; + export namespace ND_srgb_texture_to_lin_rec709_color4_1 { + let node_888: string; + export { node_888 as node }; + export namespace inputs_888 { + let _in_303: string; + export { _in_303 as in }; + } + export { inputs_888 as inputs }; + export namespace outputs_888 { + let out_860: string; + export { out_860 as out }; + } + export { outputs_888 as outputs }; + } + export { ND_srgb_texture_to_lin_rec709_color4_1 as ND_srgb_texture_to_lin_rec709_color4 }; + export namespace ND_lin_adobergb_to_lin_rec709_color3_1 { + let node_889: string; + export { node_889 as node }; + export namespace inputs_889 { + let _in_304: string; + export { _in_304 as in }; + } + export { inputs_889 as inputs }; + export namespace outputs_889 { + let out_861: string; + export { out_861 as out }; + } + export { outputs_889 as outputs }; + } + export { ND_lin_adobergb_to_lin_rec709_color3_1 as ND_lin_adobergb_to_lin_rec709_color3 }; + export namespace ND_lin_adobergb_to_lin_rec709_color4_1 { + let node_890: string; + export { node_890 as node }; + export namespace inputs_890 { + let _in_305: string; + export { _in_305 as in }; + } + export { inputs_890 as inputs }; + export namespace outputs_890 { + let out_862: string; + export { out_862 as out }; + } + export { outputs_890 as outputs }; + } + export { ND_lin_adobergb_to_lin_rec709_color4_1 as ND_lin_adobergb_to_lin_rec709_color4 }; + export namespace ND_adobergb_to_lin_rec709_color3_1 { + let node_891: string; + export { node_891 as node }; + export namespace inputs_891 { + let _in_306: string; + export { _in_306 as in }; + } + export { inputs_891 as inputs }; + export namespace outputs_891 { + let out_863: string; + export { out_863 as out }; + } + export { outputs_891 as outputs }; + } + export { ND_adobergb_to_lin_rec709_color3_1 as ND_adobergb_to_lin_rec709_color3 }; + export namespace ND_adobergb_to_lin_rec709_color4_1 { + let node_892: string; + export { node_892 as node }; + export namespace inputs_892 { + let _in_307: string; + export { _in_307 as in }; + } + export { inputs_892 as inputs }; + export namespace outputs_892 { + let out_864: string; + export { out_864 as out }; + } + export { outputs_892 as outputs }; + } + export { ND_adobergb_to_lin_rec709_color4_1 as ND_adobergb_to_lin_rec709_color4 }; + export namespace ND_srgb_displayp3_to_lin_rec709_color3_1 { + let node_893: string; + export { node_893 as node }; + export namespace inputs_893 { + let _in_308: string; + export { _in_308 as in }; + } + export { inputs_893 as inputs }; + export namespace outputs_893 { + let out_865: string; + export { out_865 as out }; + } + export { outputs_893 as outputs }; + } + export { ND_srgb_displayp3_to_lin_rec709_color3_1 as ND_srgb_displayp3_to_lin_rec709_color3 }; + export namespace ND_srgb_displayp3_to_lin_rec709_color4_1 { + let node_894: string; + export { node_894 as node }; + export namespace inputs_894 { + let _in_309: string; + export { _in_309 as in }; + } + export { inputs_894 as inputs }; + export namespace outputs_894 { + let out_866: string; + export { out_866 as out }; + } + export { outputs_894 as outputs }; + } + export { ND_srgb_displayp3_to_lin_rec709_color4_1 as ND_srgb_displayp3_to_lin_rec709_color4 }; + export namespace ND_lin_displayp3_to_lin_rec709_color3_1 { + let node_895: string; + export { node_895 as node }; + export namespace inputs_895 { + let _in_310: string; + export { _in_310 as in }; + } + export { inputs_895 as inputs }; + export namespace outputs_895 { + let out_867: string; + export { out_867 as out }; + } + export { outputs_895 as outputs }; + } + export { ND_lin_displayp3_to_lin_rec709_color3_1 as ND_lin_displayp3_to_lin_rec709_color3 }; + export namespace ND_lin_displayp3_to_lin_rec709_color4_1 { + let node_896: string; + export { node_896 as node }; + export namespace inputs_896 { + let _in_311: string; + export { _in_311 as in }; + } + export { inputs_896 as inputs }; + export namespace outputs_896 { + let out_868: string; + export { out_868 as out }; + } + export { outputs_896 as outputs }; + } + export { ND_lin_displayp3_to_lin_rec709_color4_1 as ND_lin_displayp3_to_lin_rec709_color4 }; + export namespace ND_surfacematerial_1 { + let node_897: string; + export { node_897 as node }; + export namespace inputs_897 { + let surfaceshader_1: string; + export { surfaceshader_1 as surfaceshader }; + let backsurfaceshader_1: string; + export { backsurfaceshader_1 as backsurfaceshader }; + let displacementshader_1: string; + export { displacementshader_1 as displacementshader }; + } + export { inputs_897 as inputs }; + export namespace outputs_897 { + let out_869: string; + export { out_869 as out }; + } + export { outputs_897 as outputs }; + } + export { ND_surfacematerial_1 as ND_surfacematerial }; + export namespace ND_volumematerial_1 { + let node_898: string; + export { node_898 as node }; + export namespace inputs_898 { + let volumeshader_1: string; + export { volumeshader_1 as volumeshader }; + } + export { inputs_898 as inputs }; + export namespace outputs_898 { + let out_870: string; + export { out_870 as out }; + } + export { outputs_898 as outputs }; + } + export { ND_volumematerial_1 as ND_volumematerial }; + export namespace ND_surface_unlit_1 { + let node_899: string; + export { node_899 as node }; + export namespace inputs_899 { + let emission_7: string; + export { emission_7 as emission }; + let emission_color_10: string; + export { emission_color_10 as emission_color }; + let transmission_8: string; + export { transmission_8 as transmission }; + let transmission_color_9: string; + export { transmission_color_9 as transmission_color }; + let opacity_11: string; + export { opacity_11 as opacity }; + } + export { inputs_899 as inputs }; + export namespace outputs_899 { + let out_871: string; + export { out_871 as out }; + } + export { outputs_899 as outputs }; + } + export { ND_surface_unlit_1 as ND_surface_unlit }; + export namespace ND_image_float_1 { + let node_900: string; + export { node_900 as node }; + export namespace inputs_900 { + let file_37: string; + export { file_37 as file }; + let layer_6: string; + export { layer_6 as layer }; + let _default_48: string; + export { _default_48 as default }; + let texcoord_102: string; + export { texcoord_102 as texcoord }; + let uaddressmode_22: string; + export { uaddressmode_22 as uaddressmode }; + let vaddressmode_22: string; + export { vaddressmode_22 as vaddressmode }; + let filtertype_40: string; + export { filtertype_40 as filtertype }; + let framerange_18: string; + export { framerange_18 as framerange }; + let frameoffset_18: string; + export { frameoffset_18 as frameoffset }; + let frameendaction_18: string; + export { frameendaction_18 as frameendaction }; + } + export { inputs_900 as inputs }; + export namespace outputs_900 { + let out_872: string; + export { out_872 as out }; + } + export { outputs_900 as outputs }; + } + export { ND_image_float_1 as ND_image_float }; + export namespace ND_image_color3_1 { + let node_901: string; + export { node_901 as node }; + export namespace inputs_901 { + let file_38: string; + export { file_38 as file }; + let layer_7: string; + export { layer_7 as layer }; + let _default_49: string; + export { _default_49 as default }; + let texcoord_103: string; + export { texcoord_103 as texcoord }; + let uaddressmode_23: string; + export { uaddressmode_23 as uaddressmode }; + let vaddressmode_23: string; + export { vaddressmode_23 as vaddressmode }; + let filtertype_41: string; + export { filtertype_41 as filtertype }; + let framerange_19: string; + export { framerange_19 as framerange }; + let frameoffset_19: string; + export { frameoffset_19 as frameoffset }; + let frameendaction_19: string; + export { frameendaction_19 as frameendaction }; + } + export { inputs_901 as inputs }; + export namespace outputs_901 { + let out_873: string; + export { out_873 as out }; + } + export { outputs_901 as outputs }; + } + export { ND_image_color3_1 as ND_image_color3 }; + export namespace ND_image_color4_1 { + let node_902: string; + export { node_902 as node }; + export namespace inputs_902 { + let file_39: string; + export { file_39 as file }; + let layer_8: string; + export { layer_8 as layer }; + let _default_50: string; + export { _default_50 as default }; + let texcoord_104: string; + export { texcoord_104 as texcoord }; + let uaddressmode_24: string; + export { uaddressmode_24 as uaddressmode }; + let vaddressmode_24: string; + export { vaddressmode_24 as vaddressmode }; + let filtertype_42: string; + export { filtertype_42 as filtertype }; + let framerange_20: string; + export { framerange_20 as framerange }; + let frameoffset_20: string; + export { frameoffset_20 as frameoffset }; + let frameendaction_20: string; + export { frameendaction_20 as frameendaction }; + } + export { inputs_902 as inputs }; + export namespace outputs_902 { + let out_874: string; + export { out_874 as out }; + } + export { outputs_902 as outputs }; + } + export { ND_image_color4_1 as ND_image_color4 }; + export namespace ND_image_vector2_1 { + let node_903: string; + export { node_903 as node }; + export namespace inputs_903 { + let file_40: string; + export { file_40 as file }; + let layer_9: string; + export { layer_9 as layer }; + let _default_51: string; + export { _default_51 as default }; + let texcoord_105: string; + export { texcoord_105 as texcoord }; + let uaddressmode_25: string; + export { uaddressmode_25 as uaddressmode }; + let vaddressmode_25: string; + export { vaddressmode_25 as vaddressmode }; + let filtertype_43: string; + export { filtertype_43 as filtertype }; + let framerange_21: string; + export { framerange_21 as framerange }; + let frameoffset_21: string; + export { frameoffset_21 as frameoffset }; + let frameendaction_21: string; + export { frameendaction_21 as frameendaction }; + } + export { inputs_903 as inputs }; + export namespace outputs_903 { + let out_875: string; + export { out_875 as out }; + } + export { outputs_903 as outputs }; + } + export { ND_image_vector2_1 as ND_image_vector2 }; + export namespace ND_image_vector3_1 { + let node_904: string; + export { node_904 as node }; + export namespace inputs_904 { + let file_41: string; + export { file_41 as file }; + let layer_10: string; + export { layer_10 as layer }; + let _default_52: string; + export { _default_52 as default }; + let texcoord_106: string; + export { texcoord_106 as texcoord }; + let uaddressmode_26: string; + export { uaddressmode_26 as uaddressmode }; + let vaddressmode_26: string; + export { vaddressmode_26 as vaddressmode }; + let filtertype_44: string; + export { filtertype_44 as filtertype }; + let framerange_22: string; + export { framerange_22 as framerange }; + let frameoffset_22: string; + export { frameoffset_22 as frameoffset }; + let frameendaction_22: string; + export { frameendaction_22 as frameendaction }; + } + export { inputs_904 as inputs }; + export namespace outputs_904 { + let out_876: string; + export { out_876 as out }; + } + export { outputs_904 as outputs }; + } + export { ND_image_vector3_1 as ND_image_vector3 }; + export namespace ND_image_vector4_1 { + let node_905: string; + export { node_905 as node }; + export namespace inputs_905 { + let file_42: string; + export { file_42 as file }; + let layer_11: string; + export { layer_11 as layer }; + let _default_53: string; + export { _default_53 as default }; + let texcoord_107: string; + export { texcoord_107 as texcoord }; + let uaddressmode_27: string; + export { uaddressmode_27 as uaddressmode }; + let vaddressmode_27: string; + export { vaddressmode_27 as vaddressmode }; + let filtertype_45: string; + export { filtertype_45 as filtertype }; + let framerange_23: string; + export { framerange_23 as framerange }; + let frameoffset_23: string; + export { frameoffset_23 as frameoffset }; + let frameendaction_23: string; + export { frameendaction_23 as frameendaction }; + } + export { inputs_905 as inputs }; + export namespace outputs_905 { + let out_877: string; + export { out_877 as out }; + } + export { outputs_905 as outputs }; + } + export { ND_image_vector4_1 as ND_image_vector4 }; + export namespace ND_tiledimage_float_1 { + let node_906: string; + export { node_906 as node }; + export namespace inputs_906 { + let file_43: string; + export { file_43 as file }; + let _default_54: string; + export { _default_54 as default }; + let texcoord_108: string; + export { texcoord_108 as texcoord }; + let uvtiling_12: string; + export { uvtiling_12 as uvtiling }; + let uvoffset_12: string; + export { uvoffset_12 as uvoffset }; + let realworldimagesize_6: string; + export { realworldimagesize_6 as realworldimagesize }; + let realworldtilesize_6: string; + export { realworldtilesize_6 as realworldtilesize }; + let filtertype_46: string; + export { filtertype_46 as filtertype }; + let framerange_24: string; + export { framerange_24 as framerange }; + let frameoffset_24: string; + export { frameoffset_24 as frameoffset }; + let frameendaction_24: string; + export { frameendaction_24 as frameendaction }; + } + export { inputs_906 as inputs }; + export namespace outputs_906 { + let out_878: string; + export { out_878 as out }; + } + export { outputs_906 as outputs }; + } + export { ND_tiledimage_float_1 as ND_tiledimage_float }; + export namespace ND_tiledimage_color3_1 { + let node_907: string; + export { node_907 as node }; + export namespace inputs_907 { + let file_44: string; + export { file_44 as file }; + let _default_55: string; + export { _default_55 as default }; + let texcoord_109: string; + export { texcoord_109 as texcoord }; + let uvtiling_13: string; + export { uvtiling_13 as uvtiling }; + let uvoffset_13: string; + export { uvoffset_13 as uvoffset }; + let realworldimagesize_7: string; + export { realworldimagesize_7 as realworldimagesize }; + let realworldtilesize_7: string; + export { realworldtilesize_7 as realworldtilesize }; + let filtertype_47: string; + export { filtertype_47 as filtertype }; + let framerange_25: string; + export { framerange_25 as framerange }; + let frameoffset_25: string; + export { frameoffset_25 as frameoffset }; + let frameendaction_25: string; + export { frameendaction_25 as frameendaction }; + } + export { inputs_907 as inputs }; + export namespace outputs_907 { + let out_879: string; + export { out_879 as out }; + } + export { outputs_907 as outputs }; + } + export { ND_tiledimage_color3_1 as ND_tiledimage_color3 }; + export namespace ND_tiledimage_color4_1 { + let node_908: string; + export { node_908 as node }; + export namespace inputs_908 { + let file_45: string; + export { file_45 as file }; + let _default_56: string; + export { _default_56 as default }; + let texcoord_110: string; + export { texcoord_110 as texcoord }; + let uvtiling_14: string; + export { uvtiling_14 as uvtiling }; + let uvoffset_14: string; + export { uvoffset_14 as uvoffset }; + let realworldimagesize_8: string; + export { realworldimagesize_8 as realworldimagesize }; + let realworldtilesize_8: string; + export { realworldtilesize_8 as realworldtilesize }; + let filtertype_48: string; + export { filtertype_48 as filtertype }; + let framerange_26: string; + export { framerange_26 as framerange }; + let frameoffset_26: string; + export { frameoffset_26 as frameoffset }; + let frameendaction_26: string; + export { frameendaction_26 as frameendaction }; + } + export { inputs_908 as inputs }; + export namespace outputs_908 { + let out_880: string; + export { out_880 as out }; + } + export { outputs_908 as outputs }; + } + export { ND_tiledimage_color4_1 as ND_tiledimage_color4 }; + export namespace ND_tiledimage_vector2_1 { + let node_909: string; + export { node_909 as node }; + export namespace inputs_909 { + let file_46: string; + export { file_46 as file }; + let _default_57: string; + export { _default_57 as default }; + let texcoord_111: string; + export { texcoord_111 as texcoord }; + let uvtiling_15: string; + export { uvtiling_15 as uvtiling }; + let uvoffset_15: string; + export { uvoffset_15 as uvoffset }; + let realworldimagesize_9: string; + export { realworldimagesize_9 as realworldimagesize }; + let realworldtilesize_9: string; + export { realworldtilesize_9 as realworldtilesize }; + let filtertype_49: string; + export { filtertype_49 as filtertype }; + let framerange_27: string; + export { framerange_27 as framerange }; + let frameoffset_27: string; + export { frameoffset_27 as frameoffset }; + let frameendaction_27: string; + export { frameendaction_27 as frameendaction }; + } + export { inputs_909 as inputs }; + export namespace outputs_909 { + let out_881: string; + export { out_881 as out }; + } + export { outputs_909 as outputs }; + } + export { ND_tiledimage_vector2_1 as ND_tiledimage_vector2 }; + export namespace ND_tiledimage_vector3_1 { + let node_910: string; + export { node_910 as node }; + export namespace inputs_910 { + let file_47: string; + export { file_47 as file }; + let _default_58: string; + export { _default_58 as default }; + let texcoord_112: string; + export { texcoord_112 as texcoord }; + let uvtiling_16: string; + export { uvtiling_16 as uvtiling }; + let uvoffset_16: string; + export { uvoffset_16 as uvoffset }; + let realworldimagesize_10: string; + export { realworldimagesize_10 as realworldimagesize }; + let realworldtilesize_10: string; + export { realworldtilesize_10 as realworldtilesize }; + let filtertype_50: string; + export { filtertype_50 as filtertype }; + let framerange_28: string; + export { framerange_28 as framerange }; + let frameoffset_28: string; + export { frameoffset_28 as frameoffset }; + let frameendaction_28: string; + export { frameendaction_28 as frameendaction }; + } + export { inputs_910 as inputs }; + export namespace outputs_910 { + let out_882: string; + export { out_882 as out }; + } + export { outputs_910 as outputs }; + } + export { ND_tiledimage_vector3_1 as ND_tiledimage_vector3 }; + export namespace ND_tiledimage_vector4_1 { + let node_911: string; + export { node_911 as node }; + export namespace inputs_911 { + let file_48: string; + export { file_48 as file }; + let _default_59: string; + export { _default_59 as default }; + let texcoord_113: string; + export { texcoord_113 as texcoord }; + let uvtiling_17: string; + export { uvtiling_17 as uvtiling }; + let uvoffset_17: string; + export { uvoffset_17 as uvoffset }; + let realworldimagesize_11: string; + export { realworldimagesize_11 as realworldimagesize }; + let realworldtilesize_11: string; + export { realworldtilesize_11 as realworldtilesize }; + let filtertype_51: string; + export { filtertype_51 as filtertype }; + let framerange_29: string; + export { framerange_29 as framerange }; + let frameoffset_29: string; + export { frameoffset_29 as frameoffset }; + let frameendaction_29: string; + export { frameendaction_29 as frameendaction }; + } + export { inputs_911 as inputs }; + export namespace outputs_911 { + let out_883: string; + export { out_883 as out }; + } + export { outputs_911 as outputs }; + } + export { ND_tiledimage_vector4_1 as ND_tiledimage_vector4 }; + export namespace ND_latlongimage_1 { + let node_912: string; + export { node_912 as node }; + export namespace inputs_912 { + let file_49: string; + export { file_49 as file }; + let _default_60: string; + export { _default_60 as default }; + let viewdir_1: string; + export { viewdir_1 as viewdir }; + let rotation_7: string; + export { rotation_7 as rotation }; + } + export { inputs_912 as inputs }; + export namespace outputs_912 { + let out_884: string; + export { out_884 as out }; + } + export { outputs_912 as outputs }; + } + export { ND_latlongimage_1 as ND_latlongimage }; + export namespace ND_hextiledimage_color3_1 { + let node_913: string; + export { node_913 as node }; + export namespace inputs_913 { + let file_50: string; + export { file_50 as file }; + let _default_61: string; + export { _default_61 as default }; + let texcoord_114: string; + export { texcoord_114 as texcoord }; + let tiling_3: string; + export { tiling_3 as tiling }; + let rotation_8: string; + export { rotation_8 as rotation }; + let rotationrange_3: string; + export { rotationrange_3 as rotationrange }; + let scale_33: string; + export { scale_33 as scale }; + let scalerange_3: string; + export { scalerange_3 as scalerange }; + let offset_22: string; + export { offset_22 as offset }; + let offsetrange_3: string; + export { offsetrange_3 as offsetrange }; + let falloff_3: string; + export { falloff_3 as falloff }; + let falloffcontrast_2: string; + export { falloffcontrast_2 as falloffcontrast }; + let lumacoeffs_6: string; + export { lumacoeffs_6 as lumacoeffs }; + } + export { inputs_913 as inputs }; + export namespace outputs_913 { + let out_885: string; + export { out_885 as out }; + } + export { outputs_913 as outputs }; + } + export { ND_hextiledimage_color3_1 as ND_hextiledimage_color3 }; + export namespace ND_hextiledimage_color4_1 { + let node_914: string; + export { node_914 as node }; + export namespace inputs_914 { + let file_51: string; + export { file_51 as file }; + let _default_62: string; + export { _default_62 as default }; + let texcoord_115: string; + export { texcoord_115 as texcoord }; + let tiling_4: string; + export { tiling_4 as tiling }; + let rotation_9: string; + export { rotation_9 as rotation }; + let rotationrange_4: string; + export { rotationrange_4 as rotationrange }; + let scale_34: string; + export { scale_34 as scale }; + let scalerange_4: string; + export { scalerange_4 as scalerange }; + let offset_23: string; + export { offset_23 as offset }; + let offsetrange_4: string; + export { offsetrange_4 as offsetrange }; + let falloff_4: string; + export { falloff_4 as falloff }; + let falloffcontrast_3: string; + export { falloffcontrast_3 as falloffcontrast }; + let lumacoeffs_7: string; + export { lumacoeffs_7 as lumacoeffs }; + } + export { inputs_914 as inputs }; + export namespace outputs_914 { + let out_886: string; + export { out_886 as out }; + } + export { outputs_914 as outputs }; + } + export { ND_hextiledimage_color4_1 as ND_hextiledimage_color4 }; + export namespace ND_triplanarprojection_float_1 { + let node_915: string; + export { node_915 as node }; + export namespace inputs_915 { + let filex_6: string; + export { filex_6 as filex }; + let filey_6: string; + export { filey_6 as filey }; + let filez_6: string; + export { filez_6 as filez }; + let layerx_6: string; + export { layerx_6 as layerx }; + let layery_6: string; + export { layery_6 as layery }; + let layerz_6: string; + export { layerz_6 as layerz }; + let _default_63: string; + export { _default_63 as default }; + let position_36: string; + export { position_36 as position }; + let normal_54: string; + export { normal_54 as normal }; + let upaxis_6: string; + export { upaxis_6 as upaxis }; + let blend_6: string; + export { blend_6 as blend }; + let filtertype_52: string; + export { filtertype_52 as filtertype }; + let framerange_30: string; + export { framerange_30 as framerange }; + let frameoffset_30: string; + export { frameoffset_30 as frameoffset }; + let frameendaction_30: string; + export { frameendaction_30 as frameendaction }; + } + export { inputs_915 as inputs }; + export namespace outputs_915 { + let out_887: string; + export { out_887 as out }; + } + export { outputs_915 as outputs }; + } + export { ND_triplanarprojection_float_1 as ND_triplanarprojection_float }; + export namespace ND_triplanarprojection_color3_1 { + let node_916: string; + export { node_916 as node }; + export namespace inputs_916 { + let filex_7: string; + export { filex_7 as filex }; + let filey_7: string; + export { filey_7 as filey }; + let filez_7: string; + export { filez_7 as filez }; + let layerx_7: string; + export { layerx_7 as layerx }; + let layery_7: string; + export { layery_7 as layery }; + let layerz_7: string; + export { layerz_7 as layerz }; + let _default_64: string; + export { _default_64 as default }; + let position_37: string; + export { position_37 as position }; + let normal_55: string; + export { normal_55 as normal }; + let upaxis_7: string; + export { upaxis_7 as upaxis }; + let blend_7: string; + export { blend_7 as blend }; + let filtertype_53: string; + export { filtertype_53 as filtertype }; + let framerange_31: string; + export { framerange_31 as framerange }; + let frameoffset_31: string; + export { frameoffset_31 as frameoffset }; + let frameendaction_31: string; + export { frameendaction_31 as frameendaction }; + } + export { inputs_916 as inputs }; + export namespace outputs_916 { + let out_888: string; + export { out_888 as out }; + } + export { outputs_916 as outputs }; + } + export { ND_triplanarprojection_color3_1 as ND_triplanarprojection_color3 }; + export namespace ND_triplanarprojection_color4_1 { + let node_917: string; + export { node_917 as node }; + export namespace inputs_917 { + let filex_8: string; + export { filex_8 as filex }; + let filey_8: string; + export { filey_8 as filey }; + let filez_8: string; + export { filez_8 as filez }; + let layerx_8: string; + export { layerx_8 as layerx }; + let layery_8: string; + export { layery_8 as layery }; + let layerz_8: string; + export { layerz_8 as layerz }; + let _default_65: string; + export { _default_65 as default }; + let position_38: string; + export { position_38 as position }; + let normal_56: string; + export { normal_56 as normal }; + let upaxis_8: string; + export { upaxis_8 as upaxis }; + let blend_8: string; + export { blend_8 as blend }; + let filtertype_54: string; + export { filtertype_54 as filtertype }; + let framerange_32: string; + export { framerange_32 as framerange }; + let frameoffset_32: string; + export { frameoffset_32 as frameoffset }; + let frameendaction_32: string; + export { frameendaction_32 as frameendaction }; + } + export { inputs_917 as inputs }; + export namespace outputs_917 { + let out_889: string; + export { out_889 as out }; + } + export { outputs_917 as outputs }; + } + export { ND_triplanarprojection_color4_1 as ND_triplanarprojection_color4 }; + export namespace ND_triplanarprojection_vector2_1 { + let node_918: string; + export { node_918 as node }; + export namespace inputs_918 { + let filex_9: string; + export { filex_9 as filex }; + let filey_9: string; + export { filey_9 as filey }; + let filez_9: string; + export { filez_9 as filez }; + let layerx_9: string; + export { layerx_9 as layerx }; + let layery_9: string; + export { layery_9 as layery }; + let layerz_9: string; + export { layerz_9 as layerz }; + let _default_66: string; + export { _default_66 as default }; + let position_39: string; + export { position_39 as position }; + let normal_57: string; + export { normal_57 as normal }; + let upaxis_9: string; + export { upaxis_9 as upaxis }; + let blend_9: string; + export { blend_9 as blend }; + let filtertype_55: string; + export { filtertype_55 as filtertype }; + let framerange_33: string; + export { framerange_33 as framerange }; + let frameoffset_33: string; + export { frameoffset_33 as frameoffset }; + let frameendaction_33: string; + export { frameendaction_33 as frameendaction }; + } + export { inputs_918 as inputs }; + export namespace outputs_918 { + let out_890: string; + export { out_890 as out }; + } + export { outputs_918 as outputs }; + } + export { ND_triplanarprojection_vector2_1 as ND_triplanarprojection_vector2 }; + export namespace ND_triplanarprojection_vector3_1 { + let node_919: string; + export { node_919 as node }; + export namespace inputs_919 { + let filex_10: string; + export { filex_10 as filex }; + let filey_10: string; + export { filey_10 as filey }; + let filez_10: string; + export { filez_10 as filez }; + let layerx_10: string; + export { layerx_10 as layerx }; + let layery_10: string; + export { layery_10 as layery }; + let layerz_10: string; + export { layerz_10 as layerz }; + let _default_67: string; + export { _default_67 as default }; + let position_40: string; + export { position_40 as position }; + let normal_58: string; + export { normal_58 as normal }; + let upaxis_10: string; + export { upaxis_10 as upaxis }; + let blend_10: string; + export { blend_10 as blend }; + let filtertype_56: string; + export { filtertype_56 as filtertype }; + let framerange_34: string; + export { framerange_34 as framerange }; + let frameoffset_34: string; + export { frameoffset_34 as frameoffset }; + let frameendaction_34: string; + export { frameendaction_34 as frameendaction }; + } + export { inputs_919 as inputs }; + export namespace outputs_919 { + let out_891: string; + export { out_891 as out }; + } + export { outputs_919 as outputs }; + } + export { ND_triplanarprojection_vector3_1 as ND_triplanarprojection_vector3 }; + export namespace ND_triplanarprojection_vector4_1 { + let node_920: string; + export { node_920 as node }; + export namespace inputs_920 { + let filex_11: string; + export { filex_11 as filex }; + let filey_11: string; + export { filey_11 as filey }; + let filez_11: string; + export { filez_11 as filez }; + let layerx_11: string; + export { layerx_11 as layerx }; + let layery_11: string; + export { layery_11 as layery }; + let layerz_11: string; + export { layerz_11 as layerz }; + let _default_68: string; + export { _default_68 as default }; + let position_41: string; + export { position_41 as position }; + let normal_59: string; + export { normal_59 as normal }; + let upaxis_11: string; + export { upaxis_11 as upaxis }; + let blend_11: string; + export { blend_11 as blend }; + let filtertype_57: string; + export { filtertype_57 as filtertype }; + let framerange_35: string; + export { framerange_35 as framerange }; + let frameoffset_35: string; + export { frameoffset_35 as frameoffset }; + let frameendaction_35: string; + export { frameendaction_35 as frameendaction }; + } + export { inputs_920 as inputs }; + export namespace outputs_920 { + let out_892: string; + export { out_892 as out }; + } + export { outputs_920 as outputs }; + } + export { ND_triplanarprojection_vector4_1 as ND_triplanarprojection_vector4 }; + export namespace ND_constant_float_1 { + let node_921: string; + export { node_921 as node }; + export namespace inputs_921 { + let value_12: string; + export { value_12 as value }; + } + export { inputs_921 as inputs }; + export namespace outputs_921 { + let out_893: string; + export { out_893 as out }; + } + export { outputs_921 as outputs }; + } + export { ND_constant_float_1 as ND_constant_float }; + export namespace ND_constant_color3_1 { + let node_922: string; + export { node_922 as node }; + export namespace inputs_922 { + let value_13: string; + export { value_13 as value }; + } + export { inputs_922 as inputs }; + export namespace outputs_922 { + let out_894: string; + export { out_894 as out }; + } + export { outputs_922 as outputs }; + } + export { ND_constant_color3_1 as ND_constant_color3 }; + export namespace ND_constant_color4_1 { + let node_923: string; + export { node_923 as node }; + export namespace inputs_923 { + let value_14: string; + export { value_14 as value }; + } + export { inputs_923 as inputs }; + export namespace outputs_923 { + let out_895: string; + export { out_895 as out }; + } + export { outputs_923 as outputs }; + } + export { ND_constant_color4_1 as ND_constant_color4 }; + export namespace ND_constant_vector2_1 { + let node_924: string; + export { node_924 as node }; + export namespace inputs_924 { + let value_15: string; + export { value_15 as value }; + } + export { inputs_924 as inputs }; + export namespace outputs_924 { + let out_896: string; + export { out_896 as out }; + } + export { outputs_924 as outputs }; + } + export { ND_constant_vector2_1 as ND_constant_vector2 }; + export namespace ND_constant_vector3_1 { + let node_925: string; + export { node_925 as node }; + export namespace inputs_925 { + let value_16: string; + export { value_16 as value }; + } + export { inputs_925 as inputs }; + export namespace outputs_925 { + let out_897: string; + export { out_897 as out }; + } + export { outputs_925 as outputs }; + } + export { ND_constant_vector3_1 as ND_constant_vector3 }; + export namespace ND_constant_vector4_1 { + let node_926: string; + export { node_926 as node }; + export namespace inputs_926 { + let value_17: string; + export { value_17 as value }; + } + export { inputs_926 as inputs }; + export namespace outputs_926 { + let out_898: string; + export { out_898 as out }; + } + export { outputs_926 as outputs }; + } + export { ND_constant_vector4_1 as ND_constant_vector4 }; + export namespace ND_constant_boolean_1 { + let node_927: string; + export { node_927 as node }; + export namespace inputs_927 { + let value_18: string; + export { value_18 as value }; + } + export { inputs_927 as inputs }; + export namespace outputs_927 { + let out_899: string; + export { out_899 as out }; + } + export { outputs_927 as outputs }; + } + export { ND_constant_boolean_1 as ND_constant_boolean }; + export namespace ND_constant_integer_1 { + let node_928: string; + export { node_928 as node }; + export namespace inputs_928 { + let value_19: string; + export { value_19 as value }; + } + export { inputs_928 as inputs }; + export namespace outputs_928 { + let out_900: string; + export { out_900 as out }; + } + export { outputs_928 as outputs }; + } + export { ND_constant_integer_1 as ND_constant_integer }; + export namespace ND_constant_matrix33_1 { + let node_929: string; + export { node_929 as node }; + export namespace inputs_929 { + let value_20: string; + export { value_20 as value }; + } + export { inputs_929 as inputs }; + export namespace outputs_929 { + let out_901: string; + export { out_901 as out }; + } + export { outputs_929 as outputs }; + } + export { ND_constant_matrix33_1 as ND_constant_matrix33 }; + export namespace ND_constant_matrix44_1 { + let node_930: string; + export { node_930 as node }; + export namespace inputs_930 { + let value_21: string; + export { value_21 as value }; + } + export { inputs_930 as inputs }; + export namespace outputs_930 { + let out_902: string; + export { out_902 as out }; + } + export { outputs_930 as outputs }; + } + export { ND_constant_matrix44_1 as ND_constant_matrix44 }; + export namespace ND_constant_string_1 { + let node_931: string; + export { node_931 as node }; + export namespace inputs_931 { + let value_22: string; + export { value_22 as value }; + } + export { inputs_931 as inputs }; + export namespace outputs_931 { + let out_903: string; + export { out_903 as out }; + } + export { outputs_931 as outputs }; + } + export { ND_constant_string_1 as ND_constant_string }; + export namespace ND_constant_filename_1 { + let node_932: string; + export { node_932 as node }; + export namespace inputs_932 { + let value_23: string; + export { value_23 as value }; + } + export { inputs_932 as inputs }; + export namespace outputs_932 { + let out_904: string; + export { out_904 as out }; + } + export { outputs_932 as outputs }; + } + export { ND_constant_filename_1 as ND_constant_filename }; + export namespace ND_ramp_1 { + let node_933: string; + export { node_933 as node }; + export namespace inputs_933 { + let texcoord_116: string; + export { texcoord_116 as texcoord }; + let type_3: string; + export { type_3 as type }; + let interpolation_2: string; + export { interpolation_2 as interpolation }; + let num_intervals_2: string; + export { num_intervals_2 as num_intervals }; + let interval1_2: string; + export { interval1_2 as interval1 }; + let color1_3: string; + export { color1_3 as color1 }; + let interval2_2: string; + export { interval2_2 as interval2 }; + let color2_3: string; + export { color2_3 as color2 }; + let interval3_1: string; + export { interval3_1 as interval3 }; + let color3_1: string; + export { color3_1 as color3 }; + let interval4_1: string; + export { interval4_1 as interval4 }; + let color4_1: string; + export { color4_1 as color4 }; + let interval5_1: string; + export { interval5_1 as interval5 }; + let color5_1: string; + export { color5_1 as color5 }; + let interval6_1: string; + export { interval6_1 as interval6 }; + let color6_1: string; + export { color6_1 as color6 }; + let interval7_1: string; + export { interval7_1 as interval7 }; + let color7_1: string; + export { color7_1 as color7 }; + let interval8_1: string; + export { interval8_1 as interval8 }; + let color8_1: string; + export { color8_1 as color8 }; + let interval9_1: string; + export { interval9_1 as interval9 }; + let color9_1: string; + export { color9_1 as color9 }; + let interval10_1: string; + export { interval10_1 as interval10 }; + let color10_1: string; + export { color10_1 as color10 }; + } + export { inputs_933 as inputs }; + export namespace outputs_933 { + let out_905: string; + export { out_905 as out }; + } + export { outputs_933 as outputs }; + } + export { ND_ramp_1 as ND_ramp }; + export namespace ND_ramp_gradient_1 { + let node_934: string; + export { node_934 as node }; + export namespace inputs_934 { + let x_1: string; + export { x_1 as x }; + let interval1_3: string; + export { interval1_3 as interval1 }; + let interval2_3: string; + export { interval2_3 as interval2 }; + let color1_4: string; + export { color1_4 as color1 }; + let color2_4: string; + export { color2_4 as color2 }; + let interpolation_3: string; + export { interpolation_3 as interpolation }; + let prev_color_1: string; + export { prev_color_1 as prev_color }; + let interval_num_1: string; + export { interval_num_1 as interval_num }; + let num_intervals_3: string; + export { num_intervals_3 as num_intervals }; + } + export { inputs_934 as inputs }; + export namespace outputs_934 { + let out_906: string; + export { out_906 as out }; + } + export { outputs_934 as outputs }; + } + export { ND_ramp_gradient_1 as ND_ramp_gradient }; + export namespace ND_ramplr_float_1 { + let node_935: string; + export { node_935 as node }; + export namespace inputs_935 { + let valuel_12: string; + export { valuel_12 as valuel }; + let valuer_12: string; + export { valuer_12 as valuer }; + let texcoord_117: string; + export { texcoord_117 as texcoord }; + } + export { inputs_935 as inputs }; + export namespace outputs_935 { + let out_907: string; + export { out_907 as out }; + } + export { outputs_935 as outputs }; + } + export { ND_ramplr_float_1 as ND_ramplr_float }; + export namespace ND_ramplr_color3_1 { + let node_936: string; + export { node_936 as node }; + export namespace inputs_936 { + let valuel_13: string; + export { valuel_13 as valuel }; + let valuer_13: string; + export { valuer_13 as valuer }; + let texcoord_118: string; + export { texcoord_118 as texcoord }; + } + export { inputs_936 as inputs }; + export namespace outputs_936 { + let out_908: string; + export { out_908 as out }; + } + export { outputs_936 as outputs }; + } + export { ND_ramplr_color3_1 as ND_ramplr_color3 }; + export namespace ND_ramplr_color4_1 { + let node_937: string; + export { node_937 as node }; + export namespace inputs_937 { + let valuel_14: string; + export { valuel_14 as valuel }; + let valuer_14: string; + export { valuer_14 as valuer }; + let texcoord_119: string; + export { texcoord_119 as texcoord }; + } + export { inputs_937 as inputs }; + export namespace outputs_937 { + let out_909: string; + export { out_909 as out }; + } + export { outputs_937 as outputs }; + } + export { ND_ramplr_color4_1 as ND_ramplr_color4 }; + export namespace ND_ramplr_vector2_1 { + let node_938: string; + export { node_938 as node }; + export namespace inputs_938 { + let valuel_15: string; + export { valuel_15 as valuel }; + let valuer_15: string; + export { valuer_15 as valuer }; + let texcoord_120: string; + export { texcoord_120 as texcoord }; + } + export { inputs_938 as inputs }; + export namespace outputs_938 { + let out_910: string; + export { out_910 as out }; + } + export { outputs_938 as outputs }; + } + export { ND_ramplr_vector2_1 as ND_ramplr_vector2 }; + export namespace ND_ramplr_vector3_1 { + let node_939: string; + export { node_939 as node }; + export namespace inputs_939 { + let valuel_16: string; + export { valuel_16 as valuel }; + let valuer_16: string; + export { valuer_16 as valuer }; + let texcoord_121: string; + export { texcoord_121 as texcoord }; + } + export { inputs_939 as inputs }; + export namespace outputs_939 { + let out_911: string; + export { out_911 as out }; + } + export { outputs_939 as outputs }; + } + export { ND_ramplr_vector3_1 as ND_ramplr_vector3 }; + export namespace ND_ramplr_vector4_1 { + let node_940: string; + export { node_940 as node }; + export namespace inputs_940 { + let valuel_17: string; + export { valuel_17 as valuel }; + let valuer_17: string; + export { valuer_17 as valuer }; + let texcoord_122: string; + export { texcoord_122 as texcoord }; + } + export { inputs_940 as inputs }; + export namespace outputs_940 { + let out_912: string; + export { out_912 as out }; + } + export { outputs_940 as outputs }; + } + export { ND_ramplr_vector4_1 as ND_ramplr_vector4 }; + export namespace ND_ramptb_float_1 { + let node_941: string; + export { node_941 as node }; + export namespace inputs_941 { + let valuet_12: string; + export { valuet_12 as valuet }; + let valueb_12: string; + export { valueb_12 as valueb }; + let texcoord_123: string; + export { texcoord_123 as texcoord }; + } + export { inputs_941 as inputs }; + export namespace outputs_941 { + let out_913: string; + export { out_913 as out }; + } + export { outputs_941 as outputs }; + } + export { ND_ramptb_float_1 as ND_ramptb_float }; + export namespace ND_ramptb_color3_1 { + let node_942: string; + export { node_942 as node }; + export namespace inputs_942 { + let valuet_13: string; + export { valuet_13 as valuet }; + let valueb_13: string; + export { valueb_13 as valueb }; + let texcoord_124: string; + export { texcoord_124 as texcoord }; + } + export { inputs_942 as inputs }; + export namespace outputs_942 { + let out_914: string; + export { out_914 as out }; + } + export { outputs_942 as outputs }; + } + export { ND_ramptb_color3_1 as ND_ramptb_color3 }; + export namespace ND_ramptb_color4_1 { + let node_943: string; + export { node_943 as node }; + export namespace inputs_943 { + let valuet_14: string; + export { valuet_14 as valuet }; + let valueb_14: string; + export { valueb_14 as valueb }; + let texcoord_125: string; + export { texcoord_125 as texcoord }; + } + export { inputs_943 as inputs }; + export namespace outputs_943 { + let out_915: string; + export { out_915 as out }; + } + export { outputs_943 as outputs }; + } + export { ND_ramptb_color4_1 as ND_ramptb_color4 }; + export namespace ND_ramptb_vector2_1 { + let node_944: string; + export { node_944 as node }; + export namespace inputs_944 { + let valuet_15: string; + export { valuet_15 as valuet }; + let valueb_15: string; + export { valueb_15 as valueb }; + let texcoord_126: string; + export { texcoord_126 as texcoord }; + } + export { inputs_944 as inputs }; + export namespace outputs_944 { + let out_916: string; + export { out_916 as out }; + } + export { outputs_944 as outputs }; + } + export { ND_ramptb_vector2_1 as ND_ramptb_vector2 }; + export namespace ND_ramptb_vector3_1 { + let node_945: string; + export { node_945 as node }; + export namespace inputs_945 { + let valuet_16: string; + export { valuet_16 as valuet }; + let valueb_16: string; + export { valueb_16 as valueb }; + let texcoord_127: string; + export { texcoord_127 as texcoord }; + } + export { inputs_945 as inputs }; + export namespace outputs_945 { + let out_917: string; + export { out_917 as out }; + } + export { outputs_945 as outputs }; + } + export { ND_ramptb_vector3_1 as ND_ramptb_vector3 }; + export namespace ND_ramptb_vector4_1 { + let node_946: string; + export { node_946 as node }; + export namespace inputs_946 { + let valuet_17: string; + export { valuet_17 as valuet }; + let valueb_17: string; + export { valueb_17 as valueb }; + let texcoord_128: string; + export { texcoord_128 as texcoord }; + } + export { inputs_946 as inputs }; + export namespace outputs_946 { + let out_918: string; + export { out_918 as out }; + } + export { outputs_946 as outputs }; + } + export { ND_ramptb_vector4_1 as ND_ramptb_vector4 }; + export namespace ND_ramp4_float_1 { + let node_947: string; + export { node_947 as node }; + export namespace inputs_947 { + let valuetl_6: string; + export { valuetl_6 as valuetl }; + let valuetr_6: string; + export { valuetr_6 as valuetr }; + let valuebl_6: string; + export { valuebl_6 as valuebl }; + let valuebr_6: string; + export { valuebr_6 as valuebr }; + let texcoord_129: string; + export { texcoord_129 as texcoord }; + } + export { inputs_947 as inputs }; + export namespace outputs_947 { + let out_919: string; + export { out_919 as out }; + } + export { outputs_947 as outputs }; + } + export { ND_ramp4_float_1 as ND_ramp4_float }; + export namespace ND_ramp4_color3_1 { + let node_948: string; + export { node_948 as node }; + export namespace inputs_948 { + let valuetl_7: string; + export { valuetl_7 as valuetl }; + let valuetr_7: string; + export { valuetr_7 as valuetr }; + let valuebl_7: string; + export { valuebl_7 as valuebl }; + let valuebr_7: string; + export { valuebr_7 as valuebr }; + let texcoord_130: string; + export { texcoord_130 as texcoord }; + } + export { inputs_948 as inputs }; + export namespace outputs_948 { + let out_920: string; + export { out_920 as out }; + } + export { outputs_948 as outputs }; + } + export { ND_ramp4_color3_1 as ND_ramp4_color3 }; + export namespace ND_ramp4_color4_1 { + let node_949: string; + export { node_949 as node }; + export namespace inputs_949 { + let valuetl_8: string; + export { valuetl_8 as valuetl }; + let valuetr_8: string; + export { valuetr_8 as valuetr }; + let valuebl_8: string; + export { valuebl_8 as valuebl }; + let valuebr_8: string; + export { valuebr_8 as valuebr }; + let texcoord_131: string; + export { texcoord_131 as texcoord }; + } + export { inputs_949 as inputs }; + export namespace outputs_949 { + let out_921: string; + export { out_921 as out }; + } + export { outputs_949 as outputs }; + } + export { ND_ramp4_color4_1 as ND_ramp4_color4 }; + export namespace ND_ramp4_vector2_1 { + let node_950: string; + export { node_950 as node }; + export namespace inputs_950 { + let valuetl_9: string; + export { valuetl_9 as valuetl }; + let valuetr_9: string; + export { valuetr_9 as valuetr }; + let valuebl_9: string; + export { valuebl_9 as valuebl }; + let valuebr_9: string; + export { valuebr_9 as valuebr }; + let texcoord_132: string; + export { texcoord_132 as texcoord }; + } + export { inputs_950 as inputs }; + export namespace outputs_950 { + let out_922: string; + export { out_922 as out }; + } + export { outputs_950 as outputs }; + } + export { ND_ramp4_vector2_1 as ND_ramp4_vector2 }; + export namespace ND_ramp4_vector3_1 { + let node_951: string; + export { node_951 as node }; + export namespace inputs_951 { + let valuetl_10: string; + export { valuetl_10 as valuetl }; + let valuetr_10: string; + export { valuetr_10 as valuetr }; + let valuebl_10: string; + export { valuebl_10 as valuebl }; + let valuebr_10: string; + export { valuebr_10 as valuebr }; + let texcoord_133: string; + export { texcoord_133 as texcoord }; + } + export { inputs_951 as inputs }; + export namespace outputs_951 { + let out_923: string; + export { out_923 as out }; + } + export { outputs_951 as outputs }; + } + export { ND_ramp4_vector3_1 as ND_ramp4_vector3 }; + export namespace ND_ramp4_vector4_1 { + let node_952: string; + export { node_952 as node }; + export namespace inputs_952 { + let valuetl_11: string; + export { valuetl_11 as valuetl }; + let valuetr_11: string; + export { valuetr_11 as valuetr }; + let valuebl_11: string; + export { valuebl_11 as valuebl }; + let valuebr_11: string; + export { valuebr_11 as valuebr }; + let texcoord_134: string; + export { texcoord_134 as texcoord }; + } + export { inputs_952 as inputs }; + export namespace outputs_952 { + let out_924: string; + export { out_924 as out }; + } + export { outputs_952 as outputs }; + } + export { ND_ramp4_vector4_1 as ND_ramp4_vector4 }; + export namespace ND_splitlr_float_1 { + let node_953: string; + export { node_953 as node }; + export namespace inputs_953 { + let valuel_18: string; + export { valuel_18 as valuel }; + let valuer_18: string; + export { valuer_18 as valuer }; + let center_16: string; + export { center_16 as center }; + let texcoord_135: string; + export { texcoord_135 as texcoord }; + } + export { inputs_953 as inputs }; + export namespace outputs_953 { + let out_925: string; + export { out_925 as out }; + } + export { outputs_953 as outputs }; + } + export { ND_splitlr_float_1 as ND_splitlr_float }; + export namespace ND_splitlr_color3_1 { + let node_954: string; + export { node_954 as node }; + export namespace inputs_954 { + let valuel_19: string; + export { valuel_19 as valuel }; + let valuer_19: string; + export { valuer_19 as valuer }; + let center_17: string; + export { center_17 as center }; + let texcoord_136: string; + export { texcoord_136 as texcoord }; + } + export { inputs_954 as inputs }; + export namespace outputs_954 { + let out_926: string; + export { out_926 as out }; + } + export { outputs_954 as outputs }; + } + export { ND_splitlr_color3_1 as ND_splitlr_color3 }; + export namespace ND_splitlr_color4_1 { + let node_955: string; + export { node_955 as node }; + export namespace inputs_955 { + let valuel_20: string; + export { valuel_20 as valuel }; + let valuer_20: string; + export { valuer_20 as valuer }; + let center_18: string; + export { center_18 as center }; + let texcoord_137: string; + export { texcoord_137 as texcoord }; + } + export { inputs_955 as inputs }; + export namespace outputs_955 { + let out_927: string; + export { out_927 as out }; + } + export { outputs_955 as outputs }; + } + export { ND_splitlr_color4_1 as ND_splitlr_color4 }; + export namespace ND_splitlr_vector2_1 { + let node_956: string; + export { node_956 as node }; + export namespace inputs_956 { + let valuel_21: string; + export { valuel_21 as valuel }; + let valuer_21: string; + export { valuer_21 as valuer }; + let center_19: string; + export { center_19 as center }; + let texcoord_138: string; + export { texcoord_138 as texcoord }; + } + export { inputs_956 as inputs }; + export namespace outputs_956 { + let out_928: string; + export { out_928 as out }; + } + export { outputs_956 as outputs }; + } + export { ND_splitlr_vector2_1 as ND_splitlr_vector2 }; + export namespace ND_splitlr_vector3_1 { + let node_957: string; + export { node_957 as node }; + export namespace inputs_957 { + let valuel_22: string; + export { valuel_22 as valuel }; + let valuer_22: string; + export { valuer_22 as valuer }; + let center_20: string; + export { center_20 as center }; + let texcoord_139: string; + export { texcoord_139 as texcoord }; + } + export { inputs_957 as inputs }; + export namespace outputs_957 { + let out_929: string; + export { out_929 as out }; + } + export { outputs_957 as outputs }; + } + export { ND_splitlr_vector3_1 as ND_splitlr_vector3 }; + export namespace ND_splitlr_vector4_1 { + let node_958: string; + export { node_958 as node }; + export namespace inputs_958 { + let valuel_23: string; + export { valuel_23 as valuel }; + let valuer_23: string; + export { valuer_23 as valuer }; + let center_21: string; + export { center_21 as center }; + let texcoord_140: string; + export { texcoord_140 as texcoord }; + } + export { inputs_958 as inputs }; + export namespace outputs_958 { + let out_930: string; + export { out_930 as out }; + } + export { outputs_958 as outputs }; + } + export { ND_splitlr_vector4_1 as ND_splitlr_vector4 }; + export namespace ND_splittb_float_1 { + let node_959: string; + export { node_959 as node }; + export namespace inputs_959 { + let valuet_18: string; + export { valuet_18 as valuet }; + let valueb_18: string; + export { valueb_18 as valueb }; + let center_22: string; + export { center_22 as center }; + let texcoord_141: string; + export { texcoord_141 as texcoord }; + } + export { inputs_959 as inputs }; + export namespace outputs_959 { + let out_931: string; + export { out_931 as out }; + } + export { outputs_959 as outputs }; + } + export { ND_splittb_float_1 as ND_splittb_float }; + export namespace ND_splittb_color3_1 { + let node_960: string; + export { node_960 as node }; + export namespace inputs_960 { + let valuet_19: string; + export { valuet_19 as valuet }; + let valueb_19: string; + export { valueb_19 as valueb }; + let center_23: string; + export { center_23 as center }; + let texcoord_142: string; + export { texcoord_142 as texcoord }; + } + export { inputs_960 as inputs }; + export namespace outputs_960 { + let out_932: string; + export { out_932 as out }; + } + export { outputs_960 as outputs }; + } + export { ND_splittb_color3_1 as ND_splittb_color3 }; + export namespace ND_splittb_color4_1 { + let node_961: string; + export { node_961 as node }; + export namespace inputs_961 { + let valuet_20: string; + export { valuet_20 as valuet }; + let valueb_20: string; + export { valueb_20 as valueb }; + let center_24: string; + export { center_24 as center }; + let texcoord_143: string; + export { texcoord_143 as texcoord }; + } + export { inputs_961 as inputs }; + export namespace outputs_961 { + let out_933: string; + export { out_933 as out }; + } + export { outputs_961 as outputs }; + } + export { ND_splittb_color4_1 as ND_splittb_color4 }; + export namespace ND_splittb_vector2_1 { + let node_962: string; + export { node_962 as node }; + export namespace inputs_962 { + let valuet_21: string; + export { valuet_21 as valuet }; + let valueb_21: string; + export { valueb_21 as valueb }; + let center_25: string; + export { center_25 as center }; + let texcoord_144: string; + export { texcoord_144 as texcoord }; + } + export { inputs_962 as inputs }; + export namespace outputs_962 { + let out_934: string; + export { out_934 as out }; + } + export { outputs_962 as outputs }; + } + export { ND_splittb_vector2_1 as ND_splittb_vector2 }; + export namespace ND_splittb_vector3_1 { + let node_963: string; + export { node_963 as node }; + export namespace inputs_963 { + let valuet_22: string; + export { valuet_22 as valuet }; + let valueb_22: string; + export { valueb_22 as valueb }; + let center_26: string; + export { center_26 as center }; + let texcoord_145: string; + export { texcoord_145 as texcoord }; + } + export { inputs_963 as inputs }; + export namespace outputs_963 { + let out_935: string; + export { out_935 as out }; + } + export { outputs_963 as outputs }; + } + export { ND_splittb_vector3_1 as ND_splittb_vector3 }; + export namespace ND_splittb_vector4_1 { + let node_964: string; + export { node_964 as node }; + export namespace inputs_964 { + let valuet_23: string; + export { valuet_23 as valuet }; + let valueb_23: string; + export { valueb_23 as valueb }; + let center_27: string; + export { center_27 as center }; + let texcoord_146: string; + export { texcoord_146 as texcoord }; + } + export { inputs_964 as inputs }; + export namespace outputs_964 { + let out_936: string; + export { out_936 as out }; + } + export { outputs_964 as outputs }; + } + export { ND_splittb_vector4_1 as ND_splittb_vector4 }; + export namespace ND_noise2d_float_1 { + let node_965: string; + export { node_965 as node }; + export namespace inputs_965 { + let amplitude_44: string; + export { amplitude_44 as amplitude }; + let pivot_50: string; + export { pivot_50 as pivot }; + let texcoord_147: string; + export { texcoord_147 as texcoord }; + } + export { inputs_965 as inputs }; + export namespace outputs_965 { + let out_937: string; + export { out_937 as out }; + } + export { outputs_965 as outputs }; + } + export { ND_noise2d_float_1 as ND_noise2d_float }; + export namespace ND_noise2d_color3_1 { + let node_966: string; + export { node_966 as node }; + export namespace inputs_966 { + let amplitude_45: string; + export { amplitude_45 as amplitude }; + let pivot_51: string; + export { pivot_51 as pivot }; + let texcoord_148: string; + export { texcoord_148 as texcoord }; + } + export { inputs_966 as inputs }; + export namespace outputs_966 { + let out_938: string; + export { out_938 as out }; + } + export { outputs_966 as outputs }; + } + export { ND_noise2d_color3_1 as ND_noise2d_color3 }; + export namespace ND_noise2d_color4_1 { + let node_967: string; + export { node_967 as node }; + export namespace inputs_967 { + let amplitude_46: string; + export { amplitude_46 as amplitude }; + let pivot_52: string; + export { pivot_52 as pivot }; + let texcoord_149: string; + export { texcoord_149 as texcoord }; + } + export { inputs_967 as inputs }; + export namespace outputs_967 { + let out_939: string; + export { out_939 as out }; + } + export { outputs_967 as outputs }; + } + export { ND_noise2d_color4_1 as ND_noise2d_color4 }; + export namespace ND_noise2d_vector2_1 { + let node_968: string; + export { node_968 as node }; + export namespace inputs_968 { + let amplitude_47: string; + export { amplitude_47 as amplitude }; + let pivot_53: string; + export { pivot_53 as pivot }; + let texcoord_150: string; + export { texcoord_150 as texcoord }; + } + export { inputs_968 as inputs }; + export namespace outputs_968 { + let out_940: string; + export { out_940 as out }; + } + export { outputs_968 as outputs }; + } + export { ND_noise2d_vector2_1 as ND_noise2d_vector2 }; + export namespace ND_noise2d_vector3_1 { + let node_969: string; + export { node_969 as node }; + export namespace inputs_969 { + let amplitude_48: string; + export { amplitude_48 as amplitude }; + let pivot_54: string; + export { pivot_54 as pivot }; + let texcoord_151: string; + export { texcoord_151 as texcoord }; + } + export { inputs_969 as inputs }; + export namespace outputs_969 { + let out_941: string; + export { out_941 as out }; + } + export { outputs_969 as outputs }; + } + export { ND_noise2d_vector3_1 as ND_noise2d_vector3 }; + export namespace ND_noise2d_vector4_1 { + let node_970: string; + export { node_970 as node }; + export namespace inputs_970 { + let amplitude_49: string; + export { amplitude_49 as amplitude }; + let pivot_55: string; + export { pivot_55 as pivot }; + let texcoord_152: string; + export { texcoord_152 as texcoord }; + } + export { inputs_970 as inputs }; + export namespace outputs_970 { + let out_942: string; + export { out_942 as out }; + } + export { outputs_970 as outputs }; + } + export { ND_noise2d_vector4_1 as ND_noise2d_vector4 }; + export namespace ND_noise2d_color3FA_1 { + let node_971: string; + export { node_971 as node }; + export namespace inputs_971 { + let amplitude_50: string; + export { amplitude_50 as amplitude }; + let pivot_56: string; + export { pivot_56 as pivot }; + let texcoord_153: string; + export { texcoord_153 as texcoord }; + } + export { inputs_971 as inputs }; + export namespace outputs_971 { + let out_943: string; + export { out_943 as out }; + } + export { outputs_971 as outputs }; + } + export { ND_noise2d_color3FA_1 as ND_noise2d_color3FA }; + export namespace ND_noise2d_color4FA_1 { + let node_972: string; + export { node_972 as node }; + export namespace inputs_972 { + let amplitude_51: string; + export { amplitude_51 as amplitude }; + let pivot_57: string; + export { pivot_57 as pivot }; + let texcoord_154: string; + export { texcoord_154 as texcoord }; + } + export { inputs_972 as inputs }; + export namespace outputs_972 { + let out_944: string; + export { out_944 as out }; + } + export { outputs_972 as outputs }; + } + export { ND_noise2d_color4FA_1 as ND_noise2d_color4FA }; + export namespace ND_noise2d_vector2FA_1 { + let node_973: string; + export { node_973 as node }; + export namespace inputs_973 { + let amplitude_52: string; + export { amplitude_52 as amplitude }; + let pivot_58: string; + export { pivot_58 as pivot }; + let texcoord_155: string; + export { texcoord_155 as texcoord }; + } + export { inputs_973 as inputs }; + export namespace outputs_973 { + let out_945: string; + export { out_945 as out }; + } + export { outputs_973 as outputs }; + } + export { ND_noise2d_vector2FA_1 as ND_noise2d_vector2FA }; + export namespace ND_noise2d_vector3FA_1 { + let node_974: string; + export { node_974 as node }; + export namespace inputs_974 { + let amplitude_53: string; + export { amplitude_53 as amplitude }; + let pivot_59: string; + export { pivot_59 as pivot }; + let texcoord_156: string; + export { texcoord_156 as texcoord }; + } + export { inputs_974 as inputs }; + export namespace outputs_974 { + let out_946: string; + export { out_946 as out }; + } + export { outputs_974 as outputs }; + } + export { ND_noise2d_vector3FA_1 as ND_noise2d_vector3FA }; + export namespace ND_noise2d_vector4FA_1 { + let node_975: string; + export { node_975 as node }; + export namespace inputs_975 { + let amplitude_54: string; + export { amplitude_54 as amplitude }; + let pivot_60: string; + export { pivot_60 as pivot }; + let texcoord_157: string; + export { texcoord_157 as texcoord }; + } + export { inputs_975 as inputs }; + export namespace outputs_975 { + let out_947: string; + export { out_947 as out }; + } + export { outputs_975 as outputs }; + } + export { ND_noise2d_vector4FA_1 as ND_noise2d_vector4FA }; + export namespace ND_noise3d_float_1 { + let node_976: string; + export { node_976 as node }; + export namespace inputs_976 { + let amplitude_55: string; + export { amplitude_55 as amplitude }; + let pivot_61: string; + export { pivot_61 as pivot }; + let position_42: string; + export { position_42 as position }; + } + export { inputs_976 as inputs }; + export namespace outputs_976 { + let out_948: string; + export { out_948 as out }; + } + export { outputs_976 as outputs }; + } + export { ND_noise3d_float_1 as ND_noise3d_float }; + export namespace ND_noise3d_color3_1 { + let node_977: string; + export { node_977 as node }; + export namespace inputs_977 { + let amplitude_56: string; + export { amplitude_56 as amplitude }; + let pivot_62: string; + export { pivot_62 as pivot }; + let position_43: string; + export { position_43 as position }; + } + export { inputs_977 as inputs }; + export namespace outputs_977 { + let out_949: string; + export { out_949 as out }; + } + export { outputs_977 as outputs }; + } + export { ND_noise3d_color3_1 as ND_noise3d_color3 }; + export namespace ND_noise3d_color4_1 { + let node_978: string; + export { node_978 as node }; + export namespace inputs_978 { + let amplitude_57: string; + export { amplitude_57 as amplitude }; + let pivot_63: string; + export { pivot_63 as pivot }; + let position_44: string; + export { position_44 as position }; + } + export { inputs_978 as inputs }; + export namespace outputs_978 { + let out_950: string; + export { out_950 as out }; + } + export { outputs_978 as outputs }; + } + export { ND_noise3d_color4_1 as ND_noise3d_color4 }; + export namespace ND_noise3d_vector2_1 { + let node_979: string; + export { node_979 as node }; + export namespace inputs_979 { + let amplitude_58: string; + export { amplitude_58 as amplitude }; + let pivot_64: string; + export { pivot_64 as pivot }; + let position_45: string; + export { position_45 as position }; + } + export { inputs_979 as inputs }; + export namespace outputs_979 { + let out_951: string; + export { out_951 as out }; + } + export { outputs_979 as outputs }; + } + export { ND_noise3d_vector2_1 as ND_noise3d_vector2 }; + export namespace ND_noise3d_vector3_1 { + let node_980: string; + export { node_980 as node }; + export namespace inputs_980 { + let amplitude_59: string; + export { amplitude_59 as amplitude }; + let pivot_65: string; + export { pivot_65 as pivot }; + let position_46: string; + export { position_46 as position }; + } + export { inputs_980 as inputs }; + export namespace outputs_980 { + let out_952: string; + export { out_952 as out }; + } + export { outputs_980 as outputs }; + } + export { ND_noise3d_vector3_1 as ND_noise3d_vector3 }; + export namespace ND_noise3d_vector4_1 { + let node_981: string; + export { node_981 as node }; + export namespace inputs_981 { + let amplitude_60: string; + export { amplitude_60 as amplitude }; + let pivot_66: string; + export { pivot_66 as pivot }; + let position_47: string; + export { position_47 as position }; + } + export { inputs_981 as inputs }; + export namespace outputs_981 { + let out_953: string; + export { out_953 as out }; + } + export { outputs_981 as outputs }; + } + export { ND_noise3d_vector4_1 as ND_noise3d_vector4 }; + export namespace ND_noise3d_color3FA_1 { + let node_982: string; + export { node_982 as node }; + export namespace inputs_982 { + let amplitude_61: string; + export { amplitude_61 as amplitude }; + let pivot_67: string; + export { pivot_67 as pivot }; + let position_48: string; + export { position_48 as position }; + } + export { inputs_982 as inputs }; + export namespace outputs_982 { + let out_954: string; + export { out_954 as out }; + } + export { outputs_982 as outputs }; + } + export { ND_noise3d_color3FA_1 as ND_noise3d_color3FA }; + export namespace ND_noise3d_color4FA_1 { + let node_983: string; + export { node_983 as node }; + export namespace inputs_983 { + let amplitude_62: string; + export { amplitude_62 as amplitude }; + let pivot_68: string; + export { pivot_68 as pivot }; + let position_49: string; + export { position_49 as position }; + } + export { inputs_983 as inputs }; + export namespace outputs_983 { + let out_955: string; + export { out_955 as out }; + } + export { outputs_983 as outputs }; + } + export { ND_noise3d_color4FA_1 as ND_noise3d_color4FA }; + export namespace ND_noise3d_vector2FA_1 { + let node_984: string; + export { node_984 as node }; + export namespace inputs_984 { + let amplitude_63: string; + export { amplitude_63 as amplitude }; + let pivot_69: string; + export { pivot_69 as pivot }; + let position_50: string; + export { position_50 as position }; + } + export { inputs_984 as inputs }; + export namespace outputs_984 { + let out_956: string; + export { out_956 as out }; + } + export { outputs_984 as outputs }; + } + export { ND_noise3d_vector2FA_1 as ND_noise3d_vector2FA }; + export namespace ND_noise3d_vector3FA_1 { + let node_985: string; + export { node_985 as node }; + export namespace inputs_985 { + let amplitude_64: string; + export { amplitude_64 as amplitude }; + let pivot_70: string; + export { pivot_70 as pivot }; + let position_51: string; + export { position_51 as position }; + } + export { inputs_985 as inputs }; + export namespace outputs_985 { + let out_957: string; + export { out_957 as out }; + } + export { outputs_985 as outputs }; + } + export { ND_noise3d_vector3FA_1 as ND_noise3d_vector3FA }; + export namespace ND_noise3d_vector4FA_1 { + let node_986: string; + export { node_986 as node }; + export namespace inputs_986 { + let amplitude_65: string; + export { amplitude_65 as amplitude }; + let pivot_71: string; + export { pivot_71 as pivot }; + let position_52: string; + export { position_52 as position }; + } + export { inputs_986 as inputs }; + export namespace outputs_986 { + let out_958: string; + export { out_958 as out }; + } + export { outputs_986 as outputs }; + } + export { ND_noise3d_vector4FA_1 as ND_noise3d_vector4FA }; + export namespace ND_fractal2d_float_1 { + let node_987: string; + export { node_987 as node }; + export namespace inputs_987 { + let amplitude_66: string; + export { amplitude_66 as amplitude }; + let octaves_24: string; + export { octaves_24 as octaves }; + let lacunarity_24: string; + export { lacunarity_24 as lacunarity }; + let diminish_24: string; + export { diminish_24 as diminish }; + let texcoord_158: string; + export { texcoord_158 as texcoord }; + } + export { inputs_987 as inputs }; + export namespace outputs_987 { + let out_959: string; + export { out_959 as out }; + } + export { outputs_987 as outputs }; + } + export { ND_fractal2d_float_1 as ND_fractal2d_float }; + export namespace ND_fractal2d_color3_1 { + let node_988: string; + export { node_988 as node }; + export namespace inputs_988 { + let amplitude_67: string; + export { amplitude_67 as amplitude }; + let octaves_25: string; + export { octaves_25 as octaves }; + let lacunarity_25: string; + export { lacunarity_25 as lacunarity }; + let diminish_25: string; + export { diminish_25 as diminish }; + let texcoord_159: string; + export { texcoord_159 as texcoord }; + } + export { inputs_988 as inputs }; + export namespace outputs_988 { + let out_960: string; + export { out_960 as out }; + } + export { outputs_988 as outputs }; + } + export { ND_fractal2d_color3_1 as ND_fractal2d_color3 }; + export namespace ND_fractal2d_color4_1 { + let node_989: string; + export { node_989 as node }; + export namespace inputs_989 { + let amplitude_68: string; + export { amplitude_68 as amplitude }; + let octaves_26: string; + export { octaves_26 as octaves }; + let lacunarity_26: string; + export { lacunarity_26 as lacunarity }; + let diminish_26: string; + export { diminish_26 as diminish }; + let texcoord_160: string; + export { texcoord_160 as texcoord }; + } + export { inputs_989 as inputs }; + export namespace outputs_989 { + let out_961: string; + export { out_961 as out }; + } + export { outputs_989 as outputs }; + } + export { ND_fractal2d_color4_1 as ND_fractal2d_color4 }; + export namespace ND_fractal2d_vector2_1 { + let node_990: string; + export { node_990 as node }; + export namespace inputs_990 { + let amplitude_69: string; + export { amplitude_69 as amplitude }; + let octaves_27: string; + export { octaves_27 as octaves }; + let lacunarity_27: string; + export { lacunarity_27 as lacunarity }; + let diminish_27: string; + export { diminish_27 as diminish }; + let texcoord_161: string; + export { texcoord_161 as texcoord }; + } + export { inputs_990 as inputs }; + export namespace outputs_990 { + let out_962: string; + export { out_962 as out }; + } + export { outputs_990 as outputs }; + } + export { ND_fractal2d_vector2_1 as ND_fractal2d_vector2 }; + export namespace ND_fractal2d_vector3_1 { + let node_991: string; + export { node_991 as node }; + export namespace inputs_991 { + let amplitude_70: string; + export { amplitude_70 as amplitude }; + let octaves_28: string; + export { octaves_28 as octaves }; + let lacunarity_28: string; + export { lacunarity_28 as lacunarity }; + let diminish_28: string; + export { diminish_28 as diminish }; + let texcoord_162: string; + export { texcoord_162 as texcoord }; + } + export { inputs_991 as inputs }; + export namespace outputs_991 { + let out_963: string; + export { out_963 as out }; + } + export { outputs_991 as outputs }; + } + export { ND_fractal2d_vector3_1 as ND_fractal2d_vector3 }; + export namespace ND_fractal2d_vector4_1 { + let node_992: string; + export { node_992 as node }; + export namespace inputs_992 { + let amplitude_71: string; + export { amplitude_71 as amplitude }; + let octaves_29: string; + export { octaves_29 as octaves }; + let lacunarity_29: string; + export { lacunarity_29 as lacunarity }; + let diminish_29: string; + export { diminish_29 as diminish }; + let texcoord_163: string; + export { texcoord_163 as texcoord }; + } + export { inputs_992 as inputs }; + export namespace outputs_992 { + let out_964: string; + export { out_964 as out }; + } + export { outputs_992 as outputs }; + } + export { ND_fractal2d_vector4_1 as ND_fractal2d_vector4 }; + export namespace ND_fractal2d_color3FA_1 { + let node_993: string; + export { node_993 as node }; + export namespace inputs_993 { + let amplitude_72: string; + export { amplitude_72 as amplitude }; + let octaves_30: string; + export { octaves_30 as octaves }; + let lacunarity_30: string; + export { lacunarity_30 as lacunarity }; + let diminish_30: string; + export { diminish_30 as diminish }; + let texcoord_164: string; + export { texcoord_164 as texcoord }; + } + export { inputs_993 as inputs }; + export namespace outputs_993 { + let out_965: string; + export { out_965 as out }; + } + export { outputs_993 as outputs }; + } + export { ND_fractal2d_color3FA_1 as ND_fractal2d_color3FA }; + export namespace ND_fractal2d_color4FA_1 { + let node_994: string; + export { node_994 as node }; + export namespace inputs_994 { + let amplitude_73: string; + export { amplitude_73 as amplitude }; + let octaves_31: string; + export { octaves_31 as octaves }; + let lacunarity_31: string; + export { lacunarity_31 as lacunarity }; + let diminish_31: string; + export { diminish_31 as diminish }; + let texcoord_165: string; + export { texcoord_165 as texcoord }; + } + export { inputs_994 as inputs }; + export namespace outputs_994 { + let out_966: string; + export { out_966 as out }; + } + export { outputs_994 as outputs }; + } + export { ND_fractal2d_color4FA_1 as ND_fractal2d_color4FA }; + export namespace ND_fractal2d_vector2FA_1 { + let node_995: string; + export { node_995 as node }; + export namespace inputs_995 { + let amplitude_74: string; + export { amplitude_74 as amplitude }; + let octaves_32: string; + export { octaves_32 as octaves }; + let lacunarity_32: string; + export { lacunarity_32 as lacunarity }; + let diminish_32: string; + export { diminish_32 as diminish }; + let texcoord_166: string; + export { texcoord_166 as texcoord }; + } + export { inputs_995 as inputs }; + export namespace outputs_995 { + let out_967: string; + export { out_967 as out }; + } + export { outputs_995 as outputs }; + } + export { ND_fractal2d_vector2FA_1 as ND_fractal2d_vector2FA }; + export namespace ND_fractal2d_vector3FA_1 { + let node_996: string; + export { node_996 as node }; + export namespace inputs_996 { + let amplitude_75: string; + export { amplitude_75 as amplitude }; + let octaves_33: string; + export { octaves_33 as octaves }; + let lacunarity_33: string; + export { lacunarity_33 as lacunarity }; + let diminish_33: string; + export { diminish_33 as diminish }; + let texcoord_167: string; + export { texcoord_167 as texcoord }; + } + export { inputs_996 as inputs }; + export namespace outputs_996 { + let out_968: string; + export { out_968 as out }; + } + export { outputs_996 as outputs }; + } + export { ND_fractal2d_vector3FA_1 as ND_fractal2d_vector3FA }; + export namespace ND_fractal2d_vector4FA_1 { + let node_997: string; + export { node_997 as node }; + export namespace inputs_997 { + let amplitude_76: string; + export { amplitude_76 as amplitude }; + let octaves_34: string; + export { octaves_34 as octaves }; + let lacunarity_34: string; + export { lacunarity_34 as lacunarity }; + let diminish_34: string; + export { diminish_34 as diminish }; + let texcoord_168: string; + export { texcoord_168 as texcoord }; + } + export { inputs_997 as inputs }; + export namespace outputs_997 { + let out_969: string; + export { out_969 as out }; + } + export { outputs_997 as outputs }; + } + export { ND_fractal2d_vector4FA_1 as ND_fractal2d_vector4FA }; + export namespace ND_fractal3d_float_1 { + let node_998: string; + export { node_998 as node }; + export namespace inputs_998 { + let amplitude_77: string; + export { amplitude_77 as amplitude }; + let octaves_35: string; + export { octaves_35 as octaves }; + let lacunarity_35: string; + export { lacunarity_35 as lacunarity }; + let diminish_35: string; + export { diminish_35 as diminish }; + let position_53: string; + export { position_53 as position }; + } + export { inputs_998 as inputs }; + export namespace outputs_998 { + let out_970: string; + export { out_970 as out }; + } + export { outputs_998 as outputs }; + } + export { ND_fractal3d_float_1 as ND_fractal3d_float }; + export namespace ND_fractal3d_color3_1 { + let node_999: string; + export { node_999 as node }; + export namespace inputs_999 { + let amplitude_78: string; + export { amplitude_78 as amplitude }; + let octaves_36: string; + export { octaves_36 as octaves }; + let lacunarity_36: string; + export { lacunarity_36 as lacunarity }; + let diminish_36: string; + export { diminish_36 as diminish }; + let position_54: string; + export { position_54 as position }; + } + export { inputs_999 as inputs }; + export namespace outputs_999 { + let out_971: string; + export { out_971 as out }; + } + export { outputs_999 as outputs }; + } + export { ND_fractal3d_color3_1 as ND_fractal3d_color3 }; + export namespace ND_fractal3d_color4_1 { + let node_1000: string; + export { node_1000 as node }; + export namespace inputs_1000 { + let amplitude_79: string; + export { amplitude_79 as amplitude }; + let octaves_37: string; + export { octaves_37 as octaves }; + let lacunarity_37: string; + export { lacunarity_37 as lacunarity }; + let diminish_37: string; + export { diminish_37 as diminish }; + let position_55: string; + export { position_55 as position }; + } + export { inputs_1000 as inputs }; + export namespace outputs_1000 { + let out_972: string; + export { out_972 as out }; + } + export { outputs_1000 as outputs }; + } + export { ND_fractal3d_color4_1 as ND_fractal3d_color4 }; + export namespace ND_fractal3d_vector2_1 { + let node_1001: string; + export { node_1001 as node }; + export namespace inputs_1001 { + let amplitude_80: string; + export { amplitude_80 as amplitude }; + let octaves_38: string; + export { octaves_38 as octaves }; + let lacunarity_38: string; + export { lacunarity_38 as lacunarity }; + let diminish_38: string; + export { diminish_38 as diminish }; + let position_56: string; + export { position_56 as position }; + } + export { inputs_1001 as inputs }; + export namespace outputs_1001 { + let out_973: string; + export { out_973 as out }; + } + export { outputs_1001 as outputs }; + } + export { ND_fractal3d_vector2_1 as ND_fractal3d_vector2 }; + export namespace ND_fractal3d_vector3_1 { + let node_1002: string; + export { node_1002 as node }; + export namespace inputs_1002 { + let amplitude_81: string; + export { amplitude_81 as amplitude }; + let octaves_39: string; + export { octaves_39 as octaves }; + let lacunarity_39: string; + export { lacunarity_39 as lacunarity }; + let diminish_39: string; + export { diminish_39 as diminish }; + let position_57: string; + export { position_57 as position }; + } + export { inputs_1002 as inputs }; + export namespace outputs_1002 { + let out_974: string; + export { out_974 as out }; + } + export { outputs_1002 as outputs }; + } + export { ND_fractal3d_vector3_1 as ND_fractal3d_vector3 }; + export namespace ND_fractal3d_vector4_1 { + let node_1003: string; + export { node_1003 as node }; + export namespace inputs_1003 { + let amplitude_82: string; + export { amplitude_82 as amplitude }; + let octaves_40: string; + export { octaves_40 as octaves }; + let lacunarity_40: string; + export { lacunarity_40 as lacunarity }; + let diminish_40: string; + export { diminish_40 as diminish }; + let position_58: string; + export { position_58 as position }; + } + export { inputs_1003 as inputs }; + export namespace outputs_1003 { + let out_975: string; + export { out_975 as out }; + } + export { outputs_1003 as outputs }; + } + export { ND_fractal3d_vector4_1 as ND_fractal3d_vector4 }; + export namespace ND_fractal3d_color3FA_1 { + let node_1004: string; + export { node_1004 as node }; + export namespace inputs_1004 { + let amplitude_83: string; + export { amplitude_83 as amplitude }; + let octaves_41: string; + export { octaves_41 as octaves }; + let lacunarity_41: string; + export { lacunarity_41 as lacunarity }; + let diminish_41: string; + export { diminish_41 as diminish }; + let position_59: string; + export { position_59 as position }; + } + export { inputs_1004 as inputs }; + export namespace outputs_1004 { + let out_976: string; + export { out_976 as out }; + } + export { outputs_1004 as outputs }; + } + export { ND_fractal3d_color3FA_1 as ND_fractal3d_color3FA }; + export namespace ND_fractal3d_color4FA_1 { + let node_1005: string; + export { node_1005 as node }; + export namespace inputs_1005 { + let amplitude_84: string; + export { amplitude_84 as amplitude }; + let octaves_42: string; + export { octaves_42 as octaves }; + let lacunarity_42: string; + export { lacunarity_42 as lacunarity }; + let diminish_42: string; + export { diminish_42 as diminish }; + let position_60: string; + export { position_60 as position }; + } + export { inputs_1005 as inputs }; + export namespace outputs_1005 { + let out_977: string; + export { out_977 as out }; + } + export { outputs_1005 as outputs }; + } + export { ND_fractal3d_color4FA_1 as ND_fractal3d_color4FA }; + export namespace ND_fractal3d_vector2FA_1 { + let node_1006: string; + export { node_1006 as node }; + export namespace inputs_1006 { + let amplitude_85: string; + export { amplitude_85 as amplitude }; + let octaves_43: string; + export { octaves_43 as octaves }; + let lacunarity_43: string; + export { lacunarity_43 as lacunarity }; + let diminish_43: string; + export { diminish_43 as diminish }; + let position_61: string; + export { position_61 as position }; + } + export { inputs_1006 as inputs }; + export namespace outputs_1006 { + let out_978: string; + export { out_978 as out }; + } + export { outputs_1006 as outputs }; + } + export { ND_fractal3d_vector2FA_1 as ND_fractal3d_vector2FA }; + export namespace ND_fractal3d_vector3FA_1 { + let node_1007: string; + export { node_1007 as node }; + export namespace inputs_1007 { + let amplitude_86: string; + export { amplitude_86 as amplitude }; + let octaves_44: string; + export { octaves_44 as octaves }; + let lacunarity_44: string; + export { lacunarity_44 as lacunarity }; + let diminish_44: string; + export { diminish_44 as diminish }; + let position_62: string; + export { position_62 as position }; + } + export { inputs_1007 as inputs }; + export namespace outputs_1007 { + let out_979: string; + export { out_979 as out }; + } + export { outputs_1007 as outputs }; + } + export { ND_fractal3d_vector3FA_1 as ND_fractal3d_vector3FA }; + export namespace ND_fractal3d_vector4FA_1 { + let node_1008: string; + export { node_1008 as node }; + export namespace inputs_1008 { + let amplitude_87: string; + export { amplitude_87 as amplitude }; + let octaves_45: string; + export { octaves_45 as octaves }; + let lacunarity_45: string; + export { lacunarity_45 as lacunarity }; + let diminish_45: string; + export { diminish_45 as diminish }; + let position_63: string; + export { position_63 as position }; + } + export { inputs_1008 as inputs }; + export namespace outputs_1008 { + let out_980: string; + export { out_980 as out }; + } + export { outputs_1008 as outputs }; + } + export { ND_fractal3d_vector4FA_1 as ND_fractal3d_vector4FA }; + export namespace ND_cellnoise2d_float_1 { + let node_1009: string; + export { node_1009 as node }; + export namespace inputs_1009 { + let texcoord_169: string; + export { texcoord_169 as texcoord }; + } + export { inputs_1009 as inputs }; + export namespace outputs_1009 { + let out_981: string; + export { out_981 as out }; + } + export { outputs_1009 as outputs }; + } + export { ND_cellnoise2d_float_1 as ND_cellnoise2d_float }; + export namespace ND_cellnoise3d_float_1 { + let node_1010: string; + export { node_1010 as node }; + export namespace inputs_1010 { + let position_64: string; + export { position_64 as position }; + } + export { inputs_1010 as inputs }; + export namespace outputs_1010 { + let out_982: string; + export { out_982 as out }; + } + export { outputs_1010 as outputs }; + } + export { ND_cellnoise3d_float_1 as ND_cellnoise3d_float }; + export namespace ND_worleynoise2d_float_1 { + let node_1011: string; + export { node_1011 as node }; + export namespace inputs_1011 { + let texcoord_170: string; + export { texcoord_170 as texcoord }; + let jitter_8: string; + export { jitter_8 as jitter }; + let style_8: string; + export { style_8 as style }; + } + export { inputs_1011 as inputs }; + export namespace outputs_1011 { + let out_983: string; + export { out_983 as out }; + } + export { outputs_1011 as outputs }; + } + export { ND_worleynoise2d_float_1 as ND_worleynoise2d_float }; + export namespace ND_worleynoise2d_vector2_1 { + let node_1012: string; + export { node_1012 as node }; + export namespace inputs_1012 { + let texcoord_171: string; + export { texcoord_171 as texcoord }; + let jitter_9: string; + export { jitter_9 as jitter }; + let style_9: string; + export { style_9 as style }; + } + export { inputs_1012 as inputs }; + export namespace outputs_1012 { + let out_984: string; + export { out_984 as out }; + } + export { outputs_1012 as outputs }; + } + export { ND_worleynoise2d_vector2_1 as ND_worleynoise2d_vector2 }; + export namespace ND_worleynoise2d_vector3_1 { + let node_1013: string; + export { node_1013 as node }; + export namespace inputs_1013 { + let texcoord_172: string; + export { texcoord_172 as texcoord }; + let jitter_10: string; + export { jitter_10 as jitter }; + let style_10: string; + export { style_10 as style }; + } + export { inputs_1013 as inputs }; + export namespace outputs_1013 { + let out_985: string; + export { out_985 as out }; + } + export { outputs_1013 as outputs }; + } + export { ND_worleynoise2d_vector3_1 as ND_worleynoise2d_vector3 }; + export namespace ND_worleynoise3d_float_1 { + let node_1014: string; + export { node_1014 as node }; + export namespace inputs_1014 { + let position_65: string; + export { position_65 as position }; + let jitter_11: string; + export { jitter_11 as jitter }; + let style_11: string; + export { style_11 as style }; + } + export { inputs_1014 as inputs }; + export namespace outputs_1014 { + let out_986: string; + export { out_986 as out }; + } + export { outputs_1014 as outputs }; + } + export { ND_worleynoise3d_float_1 as ND_worleynoise3d_float }; + export namespace ND_worleynoise3d_vector2_1 { + let node_1015: string; + export { node_1015 as node }; + export namespace inputs_1015 { + let position_66: string; + export { position_66 as position }; + let jitter_12: string; + export { jitter_12 as jitter }; + let style_12: string; + export { style_12 as style }; + } + export { inputs_1015 as inputs }; + export namespace outputs_1015 { + let out_987: string; + export { out_987 as out }; + } + export { outputs_1015 as outputs }; + } + export { ND_worleynoise3d_vector2_1 as ND_worleynoise3d_vector2 }; + export namespace ND_worleynoise3d_vector3_1 { + let node_1016: string; + export { node_1016 as node }; + export namespace inputs_1016 { + let position_67: string; + export { position_67 as position }; + let jitter_13: string; + export { jitter_13 as jitter }; + let style_13: string; + export { style_13 as style }; + } + export { inputs_1016 as inputs }; + export namespace outputs_1016 { + let out_988: string; + export { out_988 as out }; + } + export { outputs_1016 as outputs }; + } + export { ND_worleynoise3d_vector3_1 as ND_worleynoise3d_vector3 }; + export namespace ND_unifiednoise2d_float_1 { + let node_1017: string; + export { node_1017 as node }; + export namespace inputs_1017 { + let texcoord_173: string; + export { texcoord_173 as texcoord }; + let freq_2: string; + export { freq_2 as freq }; + let offset_24: string; + export { offset_24 as offset }; + let jitter_14: string; + export { jitter_14 as jitter }; + let outmin_2: string; + export { outmin_2 as outmin }; + let outmax_2: string; + export { outmax_2 as outmax }; + let clampoutput_2: string; + export { clampoutput_2 as clampoutput }; + let octaves_46: string; + export { octaves_46 as octaves }; + let lacunarity_46: string; + export { lacunarity_46 as lacunarity }; + let diminish_46: string; + export { diminish_46 as diminish }; + let type_4: string; + export { type_4 as type }; + let style_14: string; + export { style_14 as style }; + } + export { inputs_1017 as inputs }; + export namespace outputs_1017 { + let out_989: string; + export { out_989 as out }; + } + export { outputs_1017 as outputs }; + } + export { ND_unifiednoise2d_float_1 as ND_unifiednoise2d_float }; + export namespace ND_unifiednoise3d_float_1 { + let node_1018: string; + export { node_1018 as node }; + export namespace inputs_1018 { + let position_68: string; + export { position_68 as position }; + let freq_3: string; + export { freq_3 as freq }; + let offset_25: string; + export { offset_25 as offset }; + let jitter_15: string; + export { jitter_15 as jitter }; + let outmin_3: string; + export { outmin_3 as outmin }; + let outmax_3: string; + export { outmax_3 as outmax }; + let clampoutput_3: string; + export { clampoutput_3 as clampoutput }; + let octaves_47: string; + export { octaves_47 as octaves }; + let lacunarity_47: string; + export { lacunarity_47 as lacunarity }; + let diminish_47: string; + export { diminish_47 as diminish }; + let type_5: string; + export { type_5 as type }; + let style_15: string; + export { style_15 as style }; + } + export { inputs_1018 as inputs }; + export namespace outputs_1018 { + let out_990: string; + export { out_990 as out }; + } + export { outputs_1018 as outputs }; + } + export { ND_unifiednoise3d_float_1 as ND_unifiednoise3d_float }; + export namespace ND_flake2d_1 { + let node_1019: string; + export { node_1019 as node }; + export namespace inputs_1019 { + let size_11: string; + export { size_11 as size }; + let roughness_33: string; + export { roughness_33 as roughness }; + let coverage_2: string; + export { coverage_2 as coverage }; + let texcoord_174: string; + export { texcoord_174 as texcoord }; + let normal_60: string; + export { normal_60 as normal }; + let tangent_18: string; + export { tangent_18 as tangent }; + let bitangent_6: string; + export { bitangent_6 as bitangent }; + } + export { inputs_1019 as inputs }; + export namespace outputs_1019 { + let id_2: string; + export { id_2 as id }; + let rand_2: string; + export { rand_2 as rand }; + let presence_3: string; + export { presence_3 as presence }; + let flakenormal_2: string; + export { flakenormal_2 as flakenormal }; + } + export { outputs_1019 as outputs }; + } + export { ND_flake2d_1 as ND_flake2d }; + export namespace ND_flake3d_1 { + let node_1020: string; + export { node_1020 as node }; + export namespace inputs_1020 { + let size_12: string; + export { size_12 as size }; + let roughness_34: string; + export { roughness_34 as roughness }; + let coverage_3: string; + export { coverage_3 as coverage }; + let position_69: string; + export { position_69 as position }; + let normal_61: string; + export { normal_61 as normal }; + let tangent_19: string; + export { tangent_19 as tangent }; + let bitangent_7: string; + export { bitangent_7 as bitangent }; + } + export { inputs_1020 as inputs }; + export namespace outputs_1020 { + let id_3: string; + export { id_3 as id }; + let rand_3: string; + export { rand_3 as rand }; + let presence_4: string; + export { presence_4 as presence }; + let flakenormal_3: string; + export { flakenormal_3 as flakenormal }; + } + export { outputs_1020 as outputs }; + } + export { ND_flake3d_1 as ND_flake3d }; + export namespace ND_randomfloat_float_1 { + let node_1021: string; + export { node_1021 as node }; + export namespace inputs_1021 { + let _in_312: string; + export { _in_312 as in }; + let min_2: string; + export { min_2 as min }; + let max_2: string; + export { max_2 as max }; + let seed_4: string; + export { seed_4 as seed }; + } + export { inputs_1021 as inputs }; + export namespace outputs_1021 { + let out_991: string; + export { out_991 as out }; + } + export { outputs_1021 as outputs }; + } + export { ND_randomfloat_float_1 as ND_randomfloat_float }; + export namespace ND_randomfloat_integer_1 { + let node_1022: string; + export { node_1022 as node }; + export namespace inputs_1022 { + let _in_313: string; + export { _in_313 as in }; + let min_3: string; + export { min_3 as min }; + let max_3: string; + export { max_3 as max }; + let seed_5: string; + export { seed_5 as seed }; + } + export { inputs_1022 as inputs }; + export namespace outputs_1022 { + let out_992: string; + export { out_992 as out }; + } + export { outputs_1022 as outputs }; + } + export { ND_randomfloat_integer_1 as ND_randomfloat_integer }; + export namespace ND_randomcolor_float_1 { + let node_1023: string; + export { node_1023 as node }; + export namespace inputs_1023 { + let _in_314: string; + export { _in_314 as in }; + let huelow_2: string; + export { huelow_2 as huelow }; + let huehigh_2: string; + export { huehigh_2 as huehigh }; + let saturationlow_2: string; + export { saturationlow_2 as saturationlow }; + let saturationhigh_2: string; + export { saturationhigh_2 as saturationhigh }; + let brightnesslow_2: string; + export { brightnesslow_2 as brightnesslow }; + let brightnesshigh_2: string; + export { brightnesshigh_2 as brightnesshigh }; + let seed_6: string; + export { seed_6 as seed }; + } + export { inputs_1023 as inputs }; + export namespace outputs_1023 { + let out_993: string; + export { out_993 as out }; + } + export { outputs_1023 as outputs }; + } + export { ND_randomcolor_float_1 as ND_randomcolor_float }; + export namespace ND_randomcolor_integer_1 { + let node_1024: string; + export { node_1024 as node }; + export namespace inputs_1024 { + let _in_315: string; + export { _in_315 as in }; + let huelow_3: string; + export { huelow_3 as huelow }; + let huehigh_3: string; + export { huehigh_3 as huehigh }; + let saturationlow_3: string; + export { saturationlow_3 as saturationlow }; + let saturationhigh_3: string; + export { saturationhigh_3 as saturationhigh }; + let brightnesslow_3: string; + export { brightnesslow_3 as brightnesslow }; + let brightnesshigh_3: string; + export { brightnesshigh_3 as brightnesshigh }; + let seed_7: string; + export { seed_7 as seed }; + } + export { inputs_1024 as inputs }; + export namespace outputs_1024 { + let out_994: string; + export { out_994 as out }; + } + export { outputs_1024 as outputs }; + } + export { ND_randomcolor_integer_1 as ND_randomcolor_integer }; + export namespace ND_checkerboard_color3_1 { + let node_1025: string; + export { node_1025 as node }; + export namespace inputs_1025 { + let color1_5: string; + export { color1_5 as color1 }; + let color2_5: string; + export { color2_5 as color2 }; + let uvtiling_18: string; + export { uvtiling_18 as uvtiling }; + let uvoffset_18: string; + export { uvoffset_18 as uvoffset }; + let texcoord_175: string; + export { texcoord_175 as texcoord }; + } + export { inputs_1025 as inputs }; + export namespace outputs_1025 { + let out_995: string; + export { out_995 as out }; + } + export { outputs_1025 as outputs }; + } + export { ND_checkerboard_color3_1 as ND_checkerboard_color3 }; + export namespace ND_line_float_1 { + let node_1026: string; + export { node_1026 as node }; + export namespace inputs_1026 { + let texcoord_176: string; + export { texcoord_176 as texcoord }; + let center_28: string; + export { center_28 as center }; + let radius_6: string; + export { radius_6 as radius }; + let point1_1: string; + export { point1_1 as point1 }; + let point2_1: string; + export { point2_1 as point2 }; + } + export { inputs_1026 as inputs }; + export namespace outputs_1026 { + let out_996: string; + export { out_996 as out }; + } + export { outputs_1026 as outputs }; + } + export { ND_line_float_1 as ND_line_float }; + export namespace ND_circle_float_1 { + let node_1027: string; + export { node_1027 as node }; + export namespace inputs_1027 { + let texcoord_177: string; + export { texcoord_177 as texcoord }; + let center_29: string; + export { center_29 as center }; + let radius_7: string; + export { radius_7 as radius }; + } + export { inputs_1027 as inputs }; + export namespace outputs_1027 { + let out_997: string; + export { out_997 as out }; + } + export { outputs_1027 as outputs }; + } + export { ND_circle_float_1 as ND_circle_float }; + export namespace ND_cloverleaf_float_1 { + let node_1028: string; + export { node_1028 as node }; + export namespace inputs_1028 { + let texcoord_178: string; + export { texcoord_178 as texcoord }; + let center_30: string; + export { center_30 as center }; + let radius_8: string; + export { radius_8 as radius }; + } + export { inputs_1028 as inputs }; + export namespace outputs_1028 { + let out_998: string; + export { out_998 as out }; + } + export { outputs_1028 as outputs }; + } + export { ND_cloverleaf_float_1 as ND_cloverleaf_float }; + export namespace ND_hexagon_float_1 { + let node_1029: string; + export { node_1029 as node }; + export namespace inputs_1029 { + let texcoord_179: string; + export { texcoord_179 as texcoord }; + let center_31: string; + export { center_31 as center }; + let radius_9: string; + export { radius_9 as radius }; + } + export { inputs_1029 as inputs }; + export namespace outputs_1029 { + let out_999: string; + export { out_999 as out }; + } + export { outputs_1029 as outputs }; + } + export { ND_hexagon_float_1 as ND_hexagon_float }; + export namespace ND_grid_color3_1 { + let node_1030: string; + export { node_1030 as node }; + export namespace inputs_1030 { + let texcoord_180: string; + export { texcoord_180 as texcoord }; + let uvtiling_19: string; + export { uvtiling_19 as uvtiling }; + let uvoffset_19: string; + export { uvoffset_19 as uvoffset }; + let thickness_4: string; + export { thickness_4 as thickness }; + let staggered_5: string; + export { staggered_5 as staggered }; + } + export { inputs_1030 as inputs }; + export namespace outputs_1030 { + let out_1000: string; + export { out_1000 as out }; + } + export { outputs_1030 as outputs }; + } + export { ND_grid_color3_1 as ND_grid_color3 }; + export namespace ND_crosshatch_color3_1 { + let node_1031: string; + export { node_1031 as node }; + export namespace inputs_1031 { + let texcoord_181: string; + export { texcoord_181 as texcoord }; + let uvtiling_20: string; + export { uvtiling_20 as uvtiling }; + let uvoffset_20: string; + export { uvoffset_20 as uvoffset }; + let thickness_5: string; + export { thickness_5 as thickness }; + let staggered_6: string; + export { staggered_6 as staggered }; + } + export { inputs_1031 as inputs }; + export namespace outputs_1031 { + let out_1001: string; + export { out_1001 as out }; + } + export { outputs_1031 as outputs }; + } + export { ND_crosshatch_color3_1 as ND_crosshatch_color3 }; + export namespace ND_tiledcircles_color3_1 { + let node_1032: string; + export { node_1032 as node }; + export namespace inputs_1032 { + let texcoord_182: string; + export { texcoord_182 as texcoord }; + let uvtiling_21: string; + export { uvtiling_21 as uvtiling }; + let uvoffset_21: string; + export { uvoffset_21 as uvoffset }; + let size_13: string; + export { size_13 as size }; + let staggered_7: string; + export { staggered_7 as staggered }; + } + export { inputs_1032 as inputs }; + export namespace outputs_1032 { + let out_1002: string; + export { out_1002 as out }; + } + export { outputs_1032 as outputs }; + } + export { ND_tiledcircles_color3_1 as ND_tiledcircles_color3 }; + export namespace ND_tiledcloverleafs_color3_1 { + let node_1033: string; + export { node_1033 as node }; + export namespace inputs_1033 { + let texcoord_183: string; + export { texcoord_183 as texcoord }; + let uvtiling_22: string; + export { uvtiling_22 as uvtiling }; + let uvoffset_22: string; + export { uvoffset_22 as uvoffset }; + let size_14: string; + export { size_14 as size }; + let staggered_8: string; + export { staggered_8 as staggered }; + } + export { inputs_1033 as inputs }; + export namespace outputs_1033 { + let out_1003: string; + export { out_1003 as out }; + } + export { outputs_1033 as outputs }; + } + export { ND_tiledcloverleafs_color3_1 as ND_tiledcloverleafs_color3 }; + export namespace ND_tiledhexagons_color3_1 { + let node_1034: string; + export { node_1034 as node }; + export namespace inputs_1034 { + let texcoord_184: string; + export { texcoord_184 as texcoord }; + let uvtiling_23: string; + export { uvtiling_23 as uvtiling }; + let uvoffset_23: string; + export { uvoffset_23 as uvoffset }; + let size_15: string; + export { size_15 as size }; + let staggered_9: string; + export { staggered_9 as staggered }; + } + export { inputs_1034 as inputs }; + export namespace outputs_1034 { + let out_1004: string; + export { out_1004 as out }; + } + export { outputs_1034 as outputs }; + } + export { ND_tiledhexagons_color3_1 as ND_tiledhexagons_color3 }; + export namespace ND_position_vector3_1 { + let node_1035: string; + export { node_1035 as node }; + export namespace inputs_1035 { + let space_6: string; + export { space_6 as space }; + } + export { inputs_1035 as inputs }; + export namespace outputs_1035 { + let out_1005: string; + export { out_1005 as out }; + } + export { outputs_1035 as outputs }; + } + export { ND_position_vector3_1 as ND_position_vector3 }; + export namespace ND_normal_vector3_1 { + let node_1036: string; + export { node_1036 as node }; + export namespace inputs_1036 { + let space_7: string; + export { space_7 as space }; + } + export { inputs_1036 as inputs }; + export namespace outputs_1036 { + let out_1006: string; + export { out_1006 as out }; + } + export { outputs_1036 as outputs }; + } + export { ND_normal_vector3_1 as ND_normal_vector3 }; + export namespace ND_tangent_vector3_1 { + let node_1037: string; + export { node_1037 as node }; + export namespace inputs_1037 { + let space_8: string; + export { space_8 as space }; + let index_14: string; + export { index_14 as index }; + } + export { inputs_1037 as inputs }; + export namespace outputs_1037 { + let out_1007: string; + export { out_1007 as out }; + } + export { outputs_1037 as outputs }; + } + export { ND_tangent_vector3_1 as ND_tangent_vector3 }; + export namespace ND_bitangent_vector3_1 { + let node_1038: string; + export { node_1038 as node }; + export namespace inputs_1038 { + let space_9: string; + export { space_9 as space }; + let index_15: string; + export { index_15 as index }; + } + export { inputs_1038 as inputs }; + export namespace outputs_1038 { + let out_1008: string; + export { out_1008 as out }; + } + export { outputs_1038 as outputs }; + } + export { ND_bitangent_vector3_1 as ND_bitangent_vector3 }; + export namespace ND_texcoord_vector2_1 { + let node_1039: string; + export { node_1039 as node }; + export namespace inputs_1039 { + let index_16: string; + export { index_16 as index }; + } + export { inputs_1039 as inputs }; + export namespace outputs_1039 { + let out_1009: string; + export { out_1009 as out }; + } + export { outputs_1039 as outputs }; + } + export { ND_texcoord_vector2_1 as ND_texcoord_vector2 }; + export namespace ND_texcoord_vector3_1 { + let node_1040: string; + export { node_1040 as node }; + export namespace inputs_1040 { + let index_17: string; + export { index_17 as index }; + } + export { inputs_1040 as inputs }; + export namespace outputs_1040 { + let out_1010: string; + export { out_1010 as out }; + } + export { outputs_1040 as outputs }; + } + export { ND_texcoord_vector3_1 as ND_texcoord_vector3 }; + export namespace ND_geomcolor_float_1 { + let node_1041: string; + export { node_1041 as node }; + export namespace inputs_1041 { + let index_18: string; + export { index_18 as index }; + } + export { inputs_1041 as inputs }; + export namespace outputs_1041 { + let out_1011: string; + export { out_1011 as out }; + } + export { outputs_1041 as outputs }; + } + export { ND_geomcolor_float_1 as ND_geomcolor_float }; + export namespace ND_geomcolor_color3_1 { + let node_1042: string; + export { node_1042 as node }; + export namespace inputs_1042 { + let index_19: string; + export { index_19 as index }; + } + export { inputs_1042 as inputs }; + export namespace outputs_1042 { + let out_1012: string; + export { out_1012 as out }; + } + export { outputs_1042 as outputs }; + } + export { ND_geomcolor_color3_1 as ND_geomcolor_color3 }; + export namespace ND_geomcolor_color4_1 { + let node_1043: string; + export { node_1043 as node }; + export namespace inputs_1043 { + let index_20: string; + export { index_20 as index }; + } + export { inputs_1043 as inputs }; + export namespace outputs_1043 { + let out_1013: string; + export { out_1013 as out }; + } + export { outputs_1043 as outputs }; + } + export { ND_geomcolor_color4_1 as ND_geomcolor_color4 }; + export namespace ND_geompropvalue_integer_1 { + let node_1044: string; + export { node_1044 as node }; + export namespace inputs_1044 { + let geomprop_10: string; + export { geomprop_10 as geomprop }; + let _default_69: string; + export { _default_69 as default }; + } + export { inputs_1044 as inputs }; + export namespace outputs_1044 { + let out_1014: string; + export { out_1014 as out }; + } + export { outputs_1044 as outputs }; + } + export { ND_geompropvalue_integer_1 as ND_geompropvalue_integer }; + export namespace ND_geompropvalue_boolean_1 { + let node_1045: string; + export { node_1045 as node }; + export namespace inputs_1045 { + let geomprop_11: string; + export { geomprop_11 as geomprop }; + let _default_70: string; + export { _default_70 as default }; + } + export { inputs_1045 as inputs }; + export namespace outputs_1045 { + let out_1015: string; + export { out_1015 as out }; + } + export { outputs_1045 as outputs }; + } + export { ND_geompropvalue_boolean_1 as ND_geompropvalue_boolean }; + export namespace ND_geompropvalue_float_1 { + let node_1046: string; + export { node_1046 as node }; + export namespace inputs_1046 { + let geomprop_12: string; + export { geomprop_12 as geomprop }; + let _default_71: string; + export { _default_71 as default }; + } + export { inputs_1046 as inputs }; + export namespace outputs_1046 { + let out_1016: string; + export { out_1016 as out }; + } + export { outputs_1046 as outputs }; + } + export { ND_geompropvalue_float_1 as ND_geompropvalue_float }; + export namespace ND_geompropvalue_color3_1 { + let node_1047: string; + export { node_1047 as node }; + export namespace inputs_1047 { + let geomprop_13: string; + export { geomprop_13 as geomprop }; + let _default_72: string; + export { _default_72 as default }; + } + export { inputs_1047 as inputs }; + export namespace outputs_1047 { + let out_1017: string; + export { out_1017 as out }; + } + export { outputs_1047 as outputs }; + } + export { ND_geompropvalue_color3_1 as ND_geompropvalue_color3 }; + export namespace ND_geompropvalue_color4_1 { + let node_1048: string; + export { node_1048 as node }; + export namespace inputs_1048 { + let geomprop_14: string; + export { geomprop_14 as geomprop }; + let _default_73: string; + export { _default_73 as default }; + } + export { inputs_1048 as inputs }; + export namespace outputs_1048 { + let out_1018: string; + export { out_1018 as out }; + } + export { outputs_1048 as outputs }; + } + export { ND_geompropvalue_color4_1 as ND_geompropvalue_color4 }; + export namespace ND_geompropvalue_vector2_1 { + let node_1049: string; + export { node_1049 as node }; + export namespace inputs_1049 { + let geomprop_15: string; + export { geomprop_15 as geomprop }; + let _default_74: string; + export { _default_74 as default }; + } + export { inputs_1049 as inputs }; + export namespace outputs_1049 { + let out_1019: string; + export { out_1019 as out }; + } + export { outputs_1049 as outputs }; + } + export { ND_geompropvalue_vector2_1 as ND_geompropvalue_vector2 }; + export namespace ND_geompropvalue_vector3_1 { + let node_1050: string; + export { node_1050 as node }; + export namespace inputs_1050 { + let geomprop_16: string; + export { geomprop_16 as geomprop }; + let _default_75: string; + export { _default_75 as default }; + } + export { inputs_1050 as inputs }; + export namespace outputs_1050 { + let out_1020: string; + export { out_1020 as out }; + } + export { outputs_1050 as outputs }; + } + export { ND_geompropvalue_vector3_1 as ND_geompropvalue_vector3 }; + export namespace ND_geompropvalue_vector4_1 { + let node_1051: string; + export { node_1051 as node }; + export namespace inputs_1051 { + let geomprop_17: string; + export { geomprop_17 as geomprop }; + let _default_76: string; + export { _default_76 as default }; + } + export { inputs_1051 as inputs }; + export namespace outputs_1051 { + let out_1021: string; + export { out_1021 as out }; + } + export { outputs_1051 as outputs }; + } + export { ND_geompropvalue_vector4_1 as ND_geompropvalue_vector4 }; + export namespace ND_geompropvalueuniform_string_1 { + let node_1052: string; + export { node_1052 as node }; + export namespace inputs_1052 { + let geomprop_18: string; + export { geomprop_18 as geomprop }; + let _default_77: string; + export { _default_77 as default }; + } + export { inputs_1052 as inputs }; + export namespace outputs_1052 { + let out_1022: string; + export { out_1022 as out }; + } + export { outputs_1052 as outputs }; + } + export { ND_geompropvalueuniform_string_1 as ND_geompropvalueuniform_string }; + export namespace ND_geompropvalueuniform_filename_1 { + let node_1053: string; + export { node_1053 as node }; + export namespace inputs_1053 { + let geomprop_19: string; + export { geomprop_19 as geomprop }; + let _default_78: string; + export { _default_78 as default }; + } + export { inputs_1053 as inputs }; + export namespace outputs_1053 { + let out_1023: string; + export { out_1023 as out }; + } + export { outputs_1053 as outputs }; + } + export { ND_geompropvalueuniform_filename_1 as ND_geompropvalueuniform_filename }; + export namespace ND_bump_vector3_1 { + let node_1054: string; + export { node_1054 as node }; + export namespace inputs_1054 { + let height_1: string; + export { height_1 as height }; + let scale_35: string; + export { scale_35 as scale }; + let normal_62: string; + export { normal_62 as normal }; + let tangent_20: string; + export { tangent_20 as tangent }; + let bitangent_8: string; + export { bitangent_8 as bitangent }; + } + export { inputs_1054 as inputs }; + export namespace outputs_1054 { + let out_1024: string; + export { out_1024 as out }; + } + export { outputs_1054 as outputs }; + } + export { ND_bump_vector3_1 as ND_bump_vector3 }; + export namespace ND_frame_float_1 { + let node_1055: string; + export { node_1055 as node }; + let inputs_1055: {}; + export { inputs_1055 as inputs }; + export namespace outputs_1055 { + let out_1025: string; + export { out_1025 as out }; + } + export { outputs_1055 as outputs }; + } + export { ND_frame_float_1 as ND_frame_float }; + export namespace ND_time_float_1 { + let node_1056: string; + export { node_1056 as node }; + export namespace inputs_1056 { + let fps_1: string; + export { fps_1 as fps }; + } + export { inputs_1056 as inputs }; + export namespace outputs_1056 { + let out_1026: string; + export { out_1026 as out }; + } + export { outputs_1056 as outputs }; + } + export { ND_time_float_1 as ND_time_float }; + export namespace ND_add_float_1 { + let node_1057: string; + export { node_1057 as node }; + export namespace inputs_1057 { + let in1_231: string; + export { in1_231 as in1 }; + let in2_231: string; + export { in2_231 as in2 }; + } + export { inputs_1057 as inputs }; + export namespace outputs_1057 { + let out_1027: string; + export { out_1027 as out }; + } + export { outputs_1057 as outputs }; + } + export { ND_add_float_1 as ND_add_float }; + export namespace ND_add_integer_1 { + let node_1058: string; + export { node_1058 as node }; + export namespace inputs_1058 { + let in1_232: string; + export { in1_232 as in1 }; + let in2_232: string; + export { in2_232 as in2 }; + } + export { inputs_1058 as inputs }; + export namespace outputs_1058 { + let out_1028: string; + export { out_1028 as out }; + } + export { outputs_1058 as outputs }; + } + export { ND_add_integer_1 as ND_add_integer }; + export namespace ND_add_color3_1 { + let node_1059: string; + export { node_1059 as node }; + export namespace inputs_1059 { + let in1_233: string; + export { in1_233 as in1 }; + let in2_233: string; + export { in2_233 as in2 }; + } + export { inputs_1059 as inputs }; + export namespace outputs_1059 { + let out_1029: string; + export { out_1029 as out }; + } + export { outputs_1059 as outputs }; + } + export { ND_add_color3_1 as ND_add_color3 }; + export namespace ND_add_color4_1 { + let node_1060: string; + export { node_1060 as node }; + export namespace inputs_1060 { + let in1_234: string; + export { in1_234 as in1 }; + let in2_234: string; + export { in2_234 as in2 }; + } + export { inputs_1060 as inputs }; + export namespace outputs_1060 { + let out_1030: string; + export { out_1030 as out }; + } + export { outputs_1060 as outputs }; + } + export { ND_add_color4_1 as ND_add_color4 }; + export namespace ND_add_vector2_1 { + let node_1061: string; + export { node_1061 as node }; + export namespace inputs_1061 { + let in1_235: string; + export { in1_235 as in1 }; + let in2_235: string; + export { in2_235 as in2 }; + } + export { inputs_1061 as inputs }; + export namespace outputs_1061 { + let out_1031: string; + export { out_1031 as out }; + } + export { outputs_1061 as outputs }; + } + export { ND_add_vector2_1 as ND_add_vector2 }; + export namespace ND_add_vector3_1 { + let node_1062: string; + export { node_1062 as node }; + export namespace inputs_1062 { + let in1_236: string; + export { in1_236 as in1 }; + let in2_236: string; + export { in2_236 as in2 }; + } + export { inputs_1062 as inputs }; + export namespace outputs_1062 { + let out_1032: string; + export { out_1032 as out }; + } + export { outputs_1062 as outputs }; + } + export { ND_add_vector3_1 as ND_add_vector3 }; + export namespace ND_add_vector4_1 { + let node_1063: string; + export { node_1063 as node }; + export namespace inputs_1063 { + let in1_237: string; + export { in1_237 as in1 }; + let in2_237: string; + export { in2_237 as in2 }; + } + export { inputs_1063 as inputs }; + export namespace outputs_1063 { + let out_1033: string; + export { out_1033 as out }; + } + export { outputs_1063 as outputs }; + } + export { ND_add_vector4_1 as ND_add_vector4 }; + export namespace ND_add_matrix33_1 { + let node_1064: string; + export { node_1064 as node }; + export namespace inputs_1064 { + let in1_238: string; + export { in1_238 as in1 }; + let in2_238: string; + export { in2_238 as in2 }; + } + export { inputs_1064 as inputs }; + export namespace outputs_1064 { + let out_1034: string; + export { out_1034 as out }; + } + export { outputs_1064 as outputs }; + } + export { ND_add_matrix33_1 as ND_add_matrix33 }; + export namespace ND_add_matrix44_1 { + let node_1065: string; + export { node_1065 as node }; + export namespace inputs_1065 { + let in1_239: string; + export { in1_239 as in1 }; + let in2_239: string; + export { in2_239 as in2 }; + } + export { inputs_1065 as inputs }; + export namespace outputs_1065 { + let out_1035: string; + export { out_1035 as out }; + } + export { outputs_1065 as outputs }; + } + export { ND_add_matrix44_1 as ND_add_matrix44 }; + export namespace ND_add_color3FA_1 { + let node_1066: string; + export { node_1066 as node }; + export namespace inputs_1066 { + let in1_240: string; + export { in1_240 as in1 }; + let in2_240: string; + export { in2_240 as in2 }; + } + export { inputs_1066 as inputs }; + export namespace outputs_1066 { + let out_1036: string; + export { out_1036 as out }; + } + export { outputs_1066 as outputs }; + } + export { ND_add_color3FA_1 as ND_add_color3FA }; + export namespace ND_add_color4FA_1 { + let node_1067: string; + export { node_1067 as node }; + export namespace inputs_1067 { + let in1_241: string; + export { in1_241 as in1 }; + let in2_241: string; + export { in2_241 as in2 }; + } + export { inputs_1067 as inputs }; + export namespace outputs_1067 { + let out_1037: string; + export { out_1037 as out }; + } + export { outputs_1067 as outputs }; + } + export { ND_add_color4FA_1 as ND_add_color4FA }; + export namespace ND_add_vector2FA_1 { + let node_1068: string; + export { node_1068 as node }; + export namespace inputs_1068 { + let in1_242: string; + export { in1_242 as in1 }; + let in2_242: string; + export { in2_242 as in2 }; + } + export { inputs_1068 as inputs }; + export namespace outputs_1068 { + let out_1038: string; + export { out_1038 as out }; + } + export { outputs_1068 as outputs }; + } + export { ND_add_vector2FA_1 as ND_add_vector2FA }; + export namespace ND_add_vector3FA_1 { + let node_1069: string; + export { node_1069 as node }; + export namespace inputs_1069 { + let in1_243: string; + export { in1_243 as in1 }; + let in2_243: string; + export { in2_243 as in2 }; + } + export { inputs_1069 as inputs }; + export namespace outputs_1069 { + let out_1039: string; + export { out_1039 as out }; + } + export { outputs_1069 as outputs }; + } + export { ND_add_vector3FA_1 as ND_add_vector3FA }; + export namespace ND_add_vector4FA_1 { + let node_1070: string; + export { node_1070 as node }; + export namespace inputs_1070 { + let in1_244: string; + export { in1_244 as in1 }; + let in2_244: string; + export { in2_244 as in2 }; + } + export { inputs_1070 as inputs }; + export namespace outputs_1070 { + let out_1040: string; + export { out_1040 as out }; + } + export { outputs_1070 as outputs }; + } + export { ND_add_vector4FA_1 as ND_add_vector4FA }; + export namespace ND_add_matrix33FA_1 { + let node_1071: string; + export { node_1071 as node }; + export namespace inputs_1071 { + let in1_245: string; + export { in1_245 as in1 }; + let in2_245: string; + export { in2_245 as in2 }; + } + export { inputs_1071 as inputs }; + export namespace outputs_1071 { + let out_1041: string; + export { out_1041 as out }; + } + export { outputs_1071 as outputs }; + } + export { ND_add_matrix33FA_1 as ND_add_matrix33FA }; + export namespace ND_add_matrix44FA_1 { + let node_1072: string; + export { node_1072 as node }; + export namespace inputs_1072 { + let in1_246: string; + export { in1_246 as in1 }; + let in2_246: string; + export { in2_246 as in2 }; + } + export { inputs_1072 as inputs }; + export namespace outputs_1072 { + let out_1042: string; + export { out_1042 as out }; + } + export { outputs_1072 as outputs }; + } + export { ND_add_matrix44FA_1 as ND_add_matrix44FA }; + export namespace ND_subtract_float_1 { + let node_1073: string; + export { node_1073 as node }; + export namespace inputs_1073 { + let in1_247: string; + export { in1_247 as in1 }; + let in2_247: string; + export { in2_247 as in2 }; + } + export { inputs_1073 as inputs }; + export namespace outputs_1073 { + let out_1043: string; + export { out_1043 as out }; + } + export { outputs_1073 as outputs }; + } + export { ND_subtract_float_1 as ND_subtract_float }; + export namespace ND_subtract_integer_1 { + let node_1074: string; + export { node_1074 as node }; + export namespace inputs_1074 { + let in1_248: string; + export { in1_248 as in1 }; + let in2_248: string; + export { in2_248 as in2 }; + } + export { inputs_1074 as inputs }; + export namespace outputs_1074 { + let out_1044: string; + export { out_1044 as out }; + } + export { outputs_1074 as outputs }; + } + export { ND_subtract_integer_1 as ND_subtract_integer }; + export namespace ND_subtract_color3_1 { + let node_1075: string; + export { node_1075 as node }; + export namespace inputs_1075 { + let in1_249: string; + export { in1_249 as in1 }; + let in2_249: string; + export { in2_249 as in2 }; + } + export { inputs_1075 as inputs }; + export namespace outputs_1075 { + let out_1045: string; + export { out_1045 as out }; + } + export { outputs_1075 as outputs }; + } + export { ND_subtract_color3_1 as ND_subtract_color3 }; + export namespace ND_subtract_color4_1 { + let node_1076: string; + export { node_1076 as node }; + export namespace inputs_1076 { + let in1_250: string; + export { in1_250 as in1 }; + let in2_250: string; + export { in2_250 as in2 }; + } + export { inputs_1076 as inputs }; + export namespace outputs_1076 { + let out_1046: string; + export { out_1046 as out }; + } + export { outputs_1076 as outputs }; + } + export { ND_subtract_color4_1 as ND_subtract_color4 }; + export namespace ND_subtract_vector2_1 { + let node_1077: string; + export { node_1077 as node }; + export namespace inputs_1077 { + let in1_251: string; + export { in1_251 as in1 }; + let in2_251: string; + export { in2_251 as in2 }; + } + export { inputs_1077 as inputs }; + export namespace outputs_1077 { + let out_1047: string; + export { out_1047 as out }; + } + export { outputs_1077 as outputs }; + } + export { ND_subtract_vector2_1 as ND_subtract_vector2 }; + export namespace ND_subtract_vector3_1 { + let node_1078: string; + export { node_1078 as node }; + export namespace inputs_1078 { + let in1_252: string; + export { in1_252 as in1 }; + let in2_252: string; + export { in2_252 as in2 }; + } + export { inputs_1078 as inputs }; + export namespace outputs_1078 { + let out_1048: string; + export { out_1048 as out }; + } + export { outputs_1078 as outputs }; + } + export { ND_subtract_vector3_1 as ND_subtract_vector3 }; + export namespace ND_subtract_vector4_1 { + let node_1079: string; + export { node_1079 as node }; + export namespace inputs_1079 { + let in1_253: string; + export { in1_253 as in1 }; + let in2_253: string; + export { in2_253 as in2 }; + } + export { inputs_1079 as inputs }; + export namespace outputs_1079 { + let out_1049: string; + export { out_1049 as out }; + } + export { outputs_1079 as outputs }; + } + export { ND_subtract_vector4_1 as ND_subtract_vector4 }; + export namespace ND_subtract_matrix33_1 { + let node_1080: string; + export { node_1080 as node }; + export namespace inputs_1080 { + let in1_254: string; + export { in1_254 as in1 }; + let in2_254: string; + export { in2_254 as in2 }; + } + export { inputs_1080 as inputs }; + export namespace outputs_1080 { + let out_1050: string; + export { out_1050 as out }; + } + export { outputs_1080 as outputs }; + } + export { ND_subtract_matrix33_1 as ND_subtract_matrix33 }; + export namespace ND_subtract_matrix44_1 { + let node_1081: string; + export { node_1081 as node }; + export namespace inputs_1081 { + let in1_255: string; + export { in1_255 as in1 }; + let in2_255: string; + export { in2_255 as in2 }; + } + export { inputs_1081 as inputs }; + export namespace outputs_1081 { + let out_1051: string; + export { out_1051 as out }; + } + export { outputs_1081 as outputs }; + } + export { ND_subtract_matrix44_1 as ND_subtract_matrix44 }; + export namespace ND_subtract_color3FA_1 { + let node_1082: string; + export { node_1082 as node }; + export namespace inputs_1082 { + let in1_256: string; + export { in1_256 as in1 }; + let in2_256: string; + export { in2_256 as in2 }; + } + export { inputs_1082 as inputs }; + export namespace outputs_1082 { + let out_1052: string; + export { out_1052 as out }; + } + export { outputs_1082 as outputs }; + } + export { ND_subtract_color3FA_1 as ND_subtract_color3FA }; + export namespace ND_subtract_color4FA_1 { + let node_1083: string; + export { node_1083 as node }; + export namespace inputs_1083 { + let in1_257: string; + export { in1_257 as in1 }; + let in2_257: string; + export { in2_257 as in2 }; + } + export { inputs_1083 as inputs }; + export namespace outputs_1083 { + let out_1053: string; + export { out_1053 as out }; + } + export { outputs_1083 as outputs }; + } + export { ND_subtract_color4FA_1 as ND_subtract_color4FA }; + export namespace ND_subtract_vector2FA_1 { + let node_1084: string; + export { node_1084 as node }; + export namespace inputs_1084 { + let in1_258: string; + export { in1_258 as in1 }; + let in2_258: string; + export { in2_258 as in2 }; + } + export { inputs_1084 as inputs }; + export namespace outputs_1084 { + let out_1054: string; + export { out_1054 as out }; + } + export { outputs_1084 as outputs }; + } + export { ND_subtract_vector2FA_1 as ND_subtract_vector2FA }; + export namespace ND_subtract_vector3FA_1 { + let node_1085: string; + export { node_1085 as node }; + export namespace inputs_1085 { + let in1_259: string; + export { in1_259 as in1 }; + let in2_259: string; + export { in2_259 as in2 }; + } + export { inputs_1085 as inputs }; + export namespace outputs_1085 { + let out_1055: string; + export { out_1055 as out }; + } + export { outputs_1085 as outputs }; + } + export { ND_subtract_vector3FA_1 as ND_subtract_vector3FA }; + export namespace ND_subtract_vector4FA_1 { + let node_1086: string; + export { node_1086 as node }; + export namespace inputs_1086 { + let in1_260: string; + export { in1_260 as in1 }; + let in2_260: string; + export { in2_260 as in2 }; + } + export { inputs_1086 as inputs }; + export namespace outputs_1086 { + let out_1056: string; + export { out_1056 as out }; + } + export { outputs_1086 as outputs }; + } + export { ND_subtract_vector4FA_1 as ND_subtract_vector4FA }; + export namespace ND_subtract_matrix33FA_1 { + let node_1087: string; + export { node_1087 as node }; + export namespace inputs_1087 { + let in1_261: string; + export { in1_261 as in1 }; + let in2_261: string; + export { in2_261 as in2 }; + } + export { inputs_1087 as inputs }; + export namespace outputs_1087 { + let out_1057: string; + export { out_1057 as out }; + } + export { outputs_1087 as outputs }; + } + export { ND_subtract_matrix33FA_1 as ND_subtract_matrix33FA }; + export namespace ND_subtract_matrix44FA_1 { + let node_1088: string; + export { node_1088 as node }; + export namespace inputs_1088 { + let in1_262: string; + export { in1_262 as in1 }; + let in2_262: string; + export { in2_262 as in2 }; + } + export { inputs_1088 as inputs }; + export namespace outputs_1088 { + let out_1058: string; + export { out_1058 as out }; + } + export { outputs_1088 as outputs }; + } + export { ND_subtract_matrix44FA_1 as ND_subtract_matrix44FA }; + export namespace ND_multiply_float_1 { + let node_1089: string; + export { node_1089 as node }; + export namespace inputs_1089 { + let in1_263: string; + export { in1_263 as in1 }; + let in2_263: string; + export { in2_263 as in2 }; + } + export { inputs_1089 as inputs }; + export namespace outputs_1089 { + let out_1059: string; + export { out_1059 as out }; + } + export { outputs_1089 as outputs }; + } + export { ND_multiply_float_1 as ND_multiply_float }; + export namespace ND_multiply_color3_1 { + let node_1090: string; + export { node_1090 as node }; + export namespace inputs_1090 { + let in1_264: string; + export { in1_264 as in1 }; + let in2_264: string; + export { in2_264 as in2 }; + } + export { inputs_1090 as inputs }; + export namespace outputs_1090 { + let out_1060: string; + export { out_1060 as out }; + } + export { outputs_1090 as outputs }; + } + export { ND_multiply_color3_1 as ND_multiply_color3 }; + export namespace ND_multiply_color4_1 { + let node_1091: string; + export { node_1091 as node }; + export namespace inputs_1091 { + let in1_265: string; + export { in1_265 as in1 }; + let in2_265: string; + export { in2_265 as in2 }; + } + export { inputs_1091 as inputs }; + export namespace outputs_1091 { + let out_1061: string; + export { out_1061 as out }; + } + export { outputs_1091 as outputs }; + } + export { ND_multiply_color4_1 as ND_multiply_color4 }; + export namespace ND_multiply_vector2_1 { + let node_1092: string; + export { node_1092 as node }; + export namespace inputs_1092 { + let in1_266: string; + export { in1_266 as in1 }; + let in2_266: string; + export { in2_266 as in2 }; + } + export { inputs_1092 as inputs }; + export namespace outputs_1092 { + let out_1062: string; + export { out_1062 as out }; + } + export { outputs_1092 as outputs }; + } + export { ND_multiply_vector2_1 as ND_multiply_vector2 }; + export namespace ND_multiply_vector3_1 { + let node_1093: string; + export { node_1093 as node }; + export namespace inputs_1093 { + let in1_267: string; + export { in1_267 as in1 }; + let in2_267: string; + export { in2_267 as in2 }; + } + export { inputs_1093 as inputs }; + export namespace outputs_1093 { + let out_1063: string; + export { out_1063 as out }; + } + export { outputs_1093 as outputs }; + } + export { ND_multiply_vector3_1 as ND_multiply_vector3 }; + export namespace ND_multiply_vector4_1 { + let node_1094: string; + export { node_1094 as node }; + export namespace inputs_1094 { + let in1_268: string; + export { in1_268 as in1 }; + let in2_268: string; + export { in2_268 as in2 }; + } + export { inputs_1094 as inputs }; + export namespace outputs_1094 { + let out_1064: string; + export { out_1064 as out }; + } + export { outputs_1094 as outputs }; + } + export { ND_multiply_vector4_1 as ND_multiply_vector4 }; + export namespace ND_multiply_matrix33_1 { + let node_1095: string; + export { node_1095 as node }; + export namespace inputs_1095 { + let in1_269: string; + export { in1_269 as in1 }; + let in2_269: string; + export { in2_269 as in2 }; + } + export { inputs_1095 as inputs }; + export namespace outputs_1095 { + let out_1065: string; + export { out_1065 as out }; + } + export { outputs_1095 as outputs }; + } + export { ND_multiply_matrix33_1 as ND_multiply_matrix33 }; + export namespace ND_multiply_matrix44_1 { + let node_1096: string; + export { node_1096 as node }; + export namespace inputs_1096 { + let in1_270: string; + export { in1_270 as in1 }; + let in2_270: string; + export { in2_270 as in2 }; + } + export { inputs_1096 as inputs }; + export namespace outputs_1096 { + let out_1066: string; + export { out_1066 as out }; + } + export { outputs_1096 as outputs }; + } + export { ND_multiply_matrix44_1 as ND_multiply_matrix44 }; + export namespace ND_multiply_color3FA_1 { + let node_1097: string; + export { node_1097 as node }; + export namespace inputs_1097 { + let in1_271: string; + export { in1_271 as in1 }; + let in2_271: string; + export { in2_271 as in2 }; + } + export { inputs_1097 as inputs }; + export namespace outputs_1097 { + let out_1067: string; + export { out_1067 as out }; + } + export { outputs_1097 as outputs }; + } + export { ND_multiply_color3FA_1 as ND_multiply_color3FA }; + export namespace ND_multiply_color4FA_1 { + let node_1098: string; + export { node_1098 as node }; + export namespace inputs_1098 { + let in1_272: string; + export { in1_272 as in1 }; + let in2_272: string; + export { in2_272 as in2 }; + } + export { inputs_1098 as inputs }; + export namespace outputs_1098 { + let out_1068: string; + export { out_1068 as out }; + } + export { outputs_1098 as outputs }; + } + export { ND_multiply_color4FA_1 as ND_multiply_color4FA }; + export namespace ND_multiply_vector2FA_1 { + let node_1099: string; + export { node_1099 as node }; + export namespace inputs_1099 { + let in1_273: string; + export { in1_273 as in1 }; + let in2_273: string; + export { in2_273 as in2 }; + } + export { inputs_1099 as inputs }; + export namespace outputs_1099 { + let out_1069: string; + export { out_1069 as out }; + } + export { outputs_1099 as outputs }; + } + export { ND_multiply_vector2FA_1 as ND_multiply_vector2FA }; + export namespace ND_multiply_vector3FA_1 { + let node_1100: string; + export { node_1100 as node }; + export namespace inputs_1100 { + let in1_274: string; + export { in1_274 as in1 }; + let in2_274: string; + export { in2_274 as in2 }; + } + export { inputs_1100 as inputs }; + export namespace outputs_1100 { + let out_1070: string; + export { out_1070 as out }; + } + export { outputs_1100 as outputs }; + } + export { ND_multiply_vector3FA_1 as ND_multiply_vector3FA }; + export namespace ND_multiply_vector4FA_1 { + let node_1101: string; + export { node_1101 as node }; + export namespace inputs_1101 { + let in1_275: string; + export { in1_275 as in1 }; + let in2_275: string; + export { in2_275 as in2 }; + } + export { inputs_1101 as inputs }; + export namespace outputs_1101 { + let out_1071: string; + export { out_1071 as out }; + } + export { outputs_1101 as outputs }; + } + export { ND_multiply_vector4FA_1 as ND_multiply_vector4FA }; + export namespace ND_divide_float_1 { + let node_1102: string; + export { node_1102 as node }; + export namespace inputs_1102 { + let in1_276: string; + export { in1_276 as in1 }; + let in2_276: string; + export { in2_276 as in2 }; + } + export { inputs_1102 as inputs }; + export namespace outputs_1102 { + let out_1072: string; + export { out_1072 as out }; + } + export { outputs_1102 as outputs }; + } + export { ND_divide_float_1 as ND_divide_float }; + export namespace ND_divide_color3_1 { + let node_1103: string; + export { node_1103 as node }; + export namespace inputs_1103 { + let in1_277: string; + export { in1_277 as in1 }; + let in2_277: string; + export { in2_277 as in2 }; + } + export { inputs_1103 as inputs }; + export namespace outputs_1103 { + let out_1073: string; + export { out_1073 as out }; + } + export { outputs_1103 as outputs }; + } + export { ND_divide_color3_1 as ND_divide_color3 }; + export namespace ND_divide_color4_1 { + let node_1104: string; + export { node_1104 as node }; + export namespace inputs_1104 { + let in1_278: string; + export { in1_278 as in1 }; + let in2_278: string; + export { in2_278 as in2 }; + } + export { inputs_1104 as inputs }; + export namespace outputs_1104 { + let out_1074: string; + export { out_1074 as out }; + } + export { outputs_1104 as outputs }; + } + export { ND_divide_color4_1 as ND_divide_color4 }; + export namespace ND_divide_vector2_1 { + let node_1105: string; + export { node_1105 as node }; + export namespace inputs_1105 { + let in1_279: string; + export { in1_279 as in1 }; + let in2_279: string; + export { in2_279 as in2 }; + } + export { inputs_1105 as inputs }; + export namespace outputs_1105 { + let out_1075: string; + export { out_1075 as out }; + } + export { outputs_1105 as outputs }; + } + export { ND_divide_vector2_1 as ND_divide_vector2 }; + export namespace ND_divide_vector3_1 { + let node_1106: string; + export { node_1106 as node }; + export namespace inputs_1106 { + let in1_280: string; + export { in1_280 as in1 }; + let in2_280: string; + export { in2_280 as in2 }; + } + export { inputs_1106 as inputs }; + export namespace outputs_1106 { + let out_1076: string; + export { out_1076 as out }; + } + export { outputs_1106 as outputs }; + } + export { ND_divide_vector3_1 as ND_divide_vector3 }; + export namespace ND_divide_vector4_1 { + let node_1107: string; + export { node_1107 as node }; + export namespace inputs_1107 { + let in1_281: string; + export { in1_281 as in1 }; + let in2_281: string; + export { in2_281 as in2 }; + } + export { inputs_1107 as inputs }; + export namespace outputs_1107 { + let out_1077: string; + export { out_1077 as out }; + } + export { outputs_1107 as outputs }; + } + export { ND_divide_vector4_1 as ND_divide_vector4 }; + export namespace ND_divide_matrix33_1 { + let node_1108: string; + export { node_1108 as node }; + export namespace inputs_1108 { + let in1_282: string; + export { in1_282 as in1 }; + let in2_282: string; + export { in2_282 as in2 }; + } + export { inputs_1108 as inputs }; + export namespace outputs_1108 { + let out_1078: string; + export { out_1078 as out }; + } + export { outputs_1108 as outputs }; + } + export { ND_divide_matrix33_1 as ND_divide_matrix33 }; + export namespace ND_divide_matrix44_1 { + let node_1109: string; + export { node_1109 as node }; + export namespace inputs_1109 { + let in1_283: string; + export { in1_283 as in1 }; + let in2_283: string; + export { in2_283 as in2 }; + } + export { inputs_1109 as inputs }; + export namespace outputs_1109 { + let out_1079: string; + export { out_1079 as out }; + } + export { outputs_1109 as outputs }; + } + export { ND_divide_matrix44_1 as ND_divide_matrix44 }; + export namespace ND_divide_color3FA_1 { + let node_1110: string; + export { node_1110 as node }; + export namespace inputs_1110 { + let in1_284: string; + export { in1_284 as in1 }; + let in2_284: string; + export { in2_284 as in2 }; + } + export { inputs_1110 as inputs }; + export namespace outputs_1110 { + let out_1080: string; + export { out_1080 as out }; + } + export { outputs_1110 as outputs }; + } + export { ND_divide_color3FA_1 as ND_divide_color3FA }; + export namespace ND_divide_color4FA_1 { + let node_1111: string; + export { node_1111 as node }; + export namespace inputs_1111 { + let in1_285: string; + export { in1_285 as in1 }; + let in2_285: string; + export { in2_285 as in2 }; + } + export { inputs_1111 as inputs }; + export namespace outputs_1111 { + let out_1081: string; + export { out_1081 as out }; + } + export { outputs_1111 as outputs }; + } + export { ND_divide_color4FA_1 as ND_divide_color4FA }; + export namespace ND_divide_vector2FA_1 { + let node_1112: string; + export { node_1112 as node }; + export namespace inputs_1112 { + let in1_286: string; + export { in1_286 as in1 }; + let in2_286: string; + export { in2_286 as in2 }; + } + export { inputs_1112 as inputs }; + export namespace outputs_1112 { + let out_1082: string; + export { out_1082 as out }; + } + export { outputs_1112 as outputs }; + } + export { ND_divide_vector2FA_1 as ND_divide_vector2FA }; + export namespace ND_divide_vector3FA_1 { + let node_1113: string; + export { node_1113 as node }; + export namespace inputs_1113 { + let in1_287: string; + export { in1_287 as in1 }; + let in2_287: string; + export { in2_287 as in2 }; + } + export { inputs_1113 as inputs }; + export namespace outputs_1113 { + let out_1083: string; + export { out_1083 as out }; + } + export { outputs_1113 as outputs }; + } + export { ND_divide_vector3FA_1 as ND_divide_vector3FA }; + export namespace ND_divide_vector4FA_1 { + let node_1114: string; + export { node_1114 as node }; + export namespace inputs_1114 { + let in1_288: string; + export { in1_288 as in1 }; + let in2_288: string; + export { in2_288 as in2 }; + } + export { inputs_1114 as inputs }; + export namespace outputs_1114 { + let out_1084: string; + export { out_1084 as out }; + } + export { outputs_1114 as outputs }; + } + export { ND_divide_vector4FA_1 as ND_divide_vector4FA }; + export namespace ND_modulo_float_1 { + let node_1115: string; + export { node_1115 as node }; + export namespace inputs_1115 { + let in1_289: string; + export { in1_289 as in1 }; + let in2_289: string; + export { in2_289 as in2 }; + } + export { inputs_1115 as inputs }; + export namespace outputs_1115 { + let out_1085: string; + export { out_1085 as out }; + } + export { outputs_1115 as outputs }; + } + export { ND_modulo_float_1 as ND_modulo_float }; + export namespace ND_modulo_color3_1 { + let node_1116: string; + export { node_1116 as node }; + export namespace inputs_1116 { + let in1_290: string; + export { in1_290 as in1 }; + let in2_290: string; + export { in2_290 as in2 }; + } + export { inputs_1116 as inputs }; + export namespace outputs_1116 { + let out_1086: string; + export { out_1086 as out }; + } + export { outputs_1116 as outputs }; + } + export { ND_modulo_color3_1 as ND_modulo_color3 }; + export namespace ND_modulo_color4_1 { + let node_1117: string; + export { node_1117 as node }; + export namespace inputs_1117 { + let in1_291: string; + export { in1_291 as in1 }; + let in2_291: string; + export { in2_291 as in2 }; + } + export { inputs_1117 as inputs }; + export namespace outputs_1117 { + let out_1087: string; + export { out_1087 as out }; + } + export { outputs_1117 as outputs }; + } + export { ND_modulo_color4_1 as ND_modulo_color4 }; + export namespace ND_modulo_vector2_1 { + let node_1118: string; + export { node_1118 as node }; + export namespace inputs_1118 { + let in1_292: string; + export { in1_292 as in1 }; + let in2_292: string; + export { in2_292 as in2 }; + } + export { inputs_1118 as inputs }; + export namespace outputs_1118 { + let out_1088: string; + export { out_1088 as out }; + } + export { outputs_1118 as outputs }; + } + export { ND_modulo_vector2_1 as ND_modulo_vector2 }; + export namespace ND_modulo_vector3_1 { + let node_1119: string; + export { node_1119 as node }; + export namespace inputs_1119 { + let in1_293: string; + export { in1_293 as in1 }; + let in2_293: string; + export { in2_293 as in2 }; + } + export { inputs_1119 as inputs }; + export namespace outputs_1119 { + let out_1089: string; + export { out_1089 as out }; + } + export { outputs_1119 as outputs }; + } + export { ND_modulo_vector3_1 as ND_modulo_vector3 }; + export namespace ND_modulo_vector4_1 { + let node_1120: string; + export { node_1120 as node }; + export namespace inputs_1120 { + let in1_294: string; + export { in1_294 as in1 }; + let in2_294: string; + export { in2_294 as in2 }; + } + export { inputs_1120 as inputs }; + export namespace outputs_1120 { + let out_1090: string; + export { out_1090 as out }; + } + export { outputs_1120 as outputs }; + } + export { ND_modulo_vector4_1 as ND_modulo_vector4 }; + export namespace ND_modulo_color3FA_1 { + let node_1121: string; + export { node_1121 as node }; + export namespace inputs_1121 { + let in1_295: string; + export { in1_295 as in1 }; + let in2_295: string; + export { in2_295 as in2 }; + } + export { inputs_1121 as inputs }; + export namespace outputs_1121 { + let out_1091: string; + export { out_1091 as out }; + } + export { outputs_1121 as outputs }; + } + export { ND_modulo_color3FA_1 as ND_modulo_color3FA }; + export namespace ND_modulo_color4FA_1 { + let node_1122: string; + export { node_1122 as node }; + export namespace inputs_1122 { + let in1_296: string; + export { in1_296 as in1 }; + let in2_296: string; + export { in2_296 as in2 }; + } + export { inputs_1122 as inputs }; + export namespace outputs_1122 { + let out_1092: string; + export { out_1092 as out }; + } + export { outputs_1122 as outputs }; + } + export { ND_modulo_color4FA_1 as ND_modulo_color4FA }; + export namespace ND_modulo_vector2FA_1 { + let node_1123: string; + export { node_1123 as node }; + export namespace inputs_1123 { + let in1_297: string; + export { in1_297 as in1 }; + let in2_297: string; + export { in2_297 as in2 }; + } + export { inputs_1123 as inputs }; + export namespace outputs_1123 { + let out_1093: string; + export { out_1093 as out }; + } + export { outputs_1123 as outputs }; + } + export { ND_modulo_vector2FA_1 as ND_modulo_vector2FA }; + export namespace ND_modulo_vector3FA_1 { + let node_1124: string; + export { node_1124 as node }; + export namespace inputs_1124 { + let in1_298: string; + export { in1_298 as in1 }; + let in2_298: string; + export { in2_298 as in2 }; + } + export { inputs_1124 as inputs }; + export namespace outputs_1124 { + let out_1094: string; + export { out_1094 as out }; + } + export { outputs_1124 as outputs }; + } + export { ND_modulo_vector3FA_1 as ND_modulo_vector3FA }; + export namespace ND_modulo_vector4FA_1 { + let node_1125: string; + export { node_1125 as node }; + export namespace inputs_1125 { + let in1_299: string; + export { in1_299 as in1 }; + let in2_299: string; + export { in2_299 as in2 }; + } + export { inputs_1125 as inputs }; + export namespace outputs_1125 { + let out_1095: string; + export { out_1095 as out }; + } + export { outputs_1125 as outputs }; + } + export { ND_modulo_vector4FA_1 as ND_modulo_vector4FA }; + export namespace ND_fract_float_1 { + let node_1126: string; + export { node_1126 as node }; + export namespace inputs_1126 { + let _in_316: string; + export { _in_316 as in }; + } + export { inputs_1126 as inputs }; + export namespace outputs_1126 { + let out_1096: string; + export { out_1096 as out }; + } + export { outputs_1126 as outputs }; + } + export { ND_fract_float_1 as ND_fract_float }; + export namespace ND_fract_color3_1 { + let node_1127: string; + export { node_1127 as node }; + export namespace inputs_1127 { + let _in_317: string; + export { _in_317 as in }; + } + export { inputs_1127 as inputs }; + export namespace outputs_1127 { + let out_1097: string; + export { out_1097 as out }; + } + export { outputs_1127 as outputs }; + } + export { ND_fract_color3_1 as ND_fract_color3 }; + export namespace ND_fract_color4_1 { + let node_1128: string; + export { node_1128 as node }; + export namespace inputs_1128 { + let _in_318: string; + export { _in_318 as in }; + } + export { inputs_1128 as inputs }; + export namespace outputs_1128 { + let out_1098: string; + export { out_1098 as out }; + } + export { outputs_1128 as outputs }; + } + export { ND_fract_color4_1 as ND_fract_color4 }; + export namespace ND_fract_vector2_1 { + let node_1129: string; + export { node_1129 as node }; + export namespace inputs_1129 { + let _in_319: string; + export { _in_319 as in }; + } + export { inputs_1129 as inputs }; + export namespace outputs_1129 { + let out_1099: string; + export { out_1099 as out }; + } + export { outputs_1129 as outputs }; + } + export { ND_fract_vector2_1 as ND_fract_vector2 }; + export namespace ND_fract_vector3_1 { + let node_1130: string; + export { node_1130 as node }; + export namespace inputs_1130 { + let _in_320: string; + export { _in_320 as in }; + } + export { inputs_1130 as inputs }; + export namespace outputs_1130 { + let out_1100: string; + export { out_1100 as out }; + } + export { outputs_1130 as outputs }; + } + export { ND_fract_vector3_1 as ND_fract_vector3 }; + export namespace ND_fract_vector4_1 { + let node_1131: string; + export { node_1131 as node }; + export namespace inputs_1131 { + let _in_321: string; + export { _in_321 as in }; + } + export { inputs_1131 as inputs }; + export namespace outputs_1131 { + let out_1101: string; + export { out_1101 as out }; + } + export { outputs_1131 as outputs }; + } + export { ND_fract_vector4_1 as ND_fract_vector4 }; + export namespace ND_invert_float_1 { + let node_1132: string; + export { node_1132 as node }; + export namespace inputs_1132 { + let _in_322: string; + export { _in_322 as in }; + let amount_28: string; + export { amount_28 as amount }; + } + export { inputs_1132 as inputs }; + export namespace outputs_1132 { + let out_1102: string; + export { out_1102 as out }; + } + export { outputs_1132 as outputs }; + } + export { ND_invert_float_1 as ND_invert_float }; + export namespace ND_invert_color3_1 { + let node_1133: string; + export { node_1133 as node }; + export namespace inputs_1133 { + let _in_323: string; + export { _in_323 as in }; + let amount_29: string; + export { amount_29 as amount }; + } + export { inputs_1133 as inputs }; + export namespace outputs_1133 { + let out_1103: string; + export { out_1103 as out }; + } + export { outputs_1133 as outputs }; + } + export { ND_invert_color3_1 as ND_invert_color3 }; + export namespace ND_invert_color4_1 { + let node_1134: string; + export { node_1134 as node }; + export namespace inputs_1134 { + let _in_324: string; + export { _in_324 as in }; + let amount_30: string; + export { amount_30 as amount }; + } + export { inputs_1134 as inputs }; + export namespace outputs_1134 { + let out_1104: string; + export { out_1104 as out }; + } + export { outputs_1134 as outputs }; + } + export { ND_invert_color4_1 as ND_invert_color4 }; + export namespace ND_invert_vector2_1 { + let node_1135: string; + export { node_1135 as node }; + export namespace inputs_1135 { + let _in_325: string; + export { _in_325 as in }; + let amount_31: string; + export { amount_31 as amount }; + } + export { inputs_1135 as inputs }; + export namespace outputs_1135 { + let out_1105: string; + export { out_1105 as out }; + } + export { outputs_1135 as outputs }; + } + export { ND_invert_vector2_1 as ND_invert_vector2 }; + export namespace ND_invert_vector3_1 { + let node_1136: string; + export { node_1136 as node }; + export namespace inputs_1136 { + let _in_326: string; + export { _in_326 as in }; + let amount_32: string; + export { amount_32 as amount }; + } + export { inputs_1136 as inputs }; + export namespace outputs_1136 { + let out_1106: string; + export { out_1106 as out }; + } + export { outputs_1136 as outputs }; + } + export { ND_invert_vector3_1 as ND_invert_vector3 }; + export namespace ND_invert_vector4_1 { + let node_1137: string; + export { node_1137 as node }; + export namespace inputs_1137 { + let _in_327: string; + export { _in_327 as in }; + let amount_33: string; + export { amount_33 as amount }; + } + export { inputs_1137 as inputs }; + export namespace outputs_1137 { + let out_1107: string; + export { out_1107 as out }; + } + export { outputs_1137 as outputs }; + } + export { ND_invert_vector4_1 as ND_invert_vector4 }; + export namespace ND_invert_color3FA_1 { + let node_1138: string; + export { node_1138 as node }; + export namespace inputs_1138 { + let _in_328: string; + export { _in_328 as in }; + let amount_34: string; + export { amount_34 as amount }; + } + export { inputs_1138 as inputs }; + export namespace outputs_1138 { + let out_1108: string; + export { out_1108 as out }; + } + export { outputs_1138 as outputs }; + } + export { ND_invert_color3FA_1 as ND_invert_color3FA }; + export namespace ND_invert_color4FA_1 { + let node_1139: string; + export { node_1139 as node }; + export namespace inputs_1139 { + let _in_329: string; + export { _in_329 as in }; + let amount_35: string; + export { amount_35 as amount }; + } + export { inputs_1139 as inputs }; + export namespace outputs_1139 { + let out_1109: string; + export { out_1109 as out }; + } + export { outputs_1139 as outputs }; + } + export { ND_invert_color4FA_1 as ND_invert_color4FA }; + export namespace ND_invert_vector2FA_1 { + let node_1140: string; + export { node_1140 as node }; + export namespace inputs_1140 { + let _in_330: string; + export { _in_330 as in }; + let amount_36: string; + export { amount_36 as amount }; + } + export { inputs_1140 as inputs }; + export namespace outputs_1140 { + let out_1110: string; + export { out_1110 as out }; + } + export { outputs_1140 as outputs }; + } + export { ND_invert_vector2FA_1 as ND_invert_vector2FA }; + export namespace ND_invert_vector3FA_1 { + let node_1141: string; + export { node_1141 as node }; + export namespace inputs_1141 { + let _in_331: string; + export { _in_331 as in }; + let amount_37: string; + export { amount_37 as amount }; + } + export { inputs_1141 as inputs }; + export namespace outputs_1141 { + let out_1111: string; + export { out_1111 as out }; + } + export { outputs_1141 as outputs }; + } + export { ND_invert_vector3FA_1 as ND_invert_vector3FA }; + export namespace ND_invert_vector4FA_1 { + let node_1142: string; + export { node_1142 as node }; + export namespace inputs_1142 { + let _in_332: string; + export { _in_332 as in }; + let amount_38: string; + export { amount_38 as amount }; + } + export { inputs_1142 as inputs }; + export namespace outputs_1142 { + let out_1112: string; + export { out_1112 as out }; + } + export { outputs_1142 as outputs }; + } + export { ND_invert_vector4FA_1 as ND_invert_vector4FA }; + export namespace ND_absval_float_1 { + let node_1143: string; + export { node_1143 as node }; + export namespace inputs_1143 { + let _in_333: string; + export { _in_333 as in }; + } + export { inputs_1143 as inputs }; + export namespace outputs_1143 { + let out_1113: string; + export { out_1113 as out }; + } + export { outputs_1143 as outputs }; + } + export { ND_absval_float_1 as ND_absval_float }; + export namespace ND_absval_color3_1 { + let node_1144: string; + export { node_1144 as node }; + export namespace inputs_1144 { + let _in_334: string; + export { _in_334 as in }; + } + export { inputs_1144 as inputs }; + export namespace outputs_1144 { + let out_1114: string; + export { out_1114 as out }; + } + export { outputs_1144 as outputs }; + } + export { ND_absval_color3_1 as ND_absval_color3 }; + export namespace ND_absval_color4_1 { + let node_1145: string; + export { node_1145 as node }; + export namespace inputs_1145 { + let _in_335: string; + export { _in_335 as in }; + } + export { inputs_1145 as inputs }; + export namespace outputs_1145 { + let out_1115: string; + export { out_1115 as out }; + } + export { outputs_1145 as outputs }; + } + export { ND_absval_color4_1 as ND_absval_color4 }; + export namespace ND_absval_vector2_1 { + let node_1146: string; + export { node_1146 as node }; + export namespace inputs_1146 { + let _in_336: string; + export { _in_336 as in }; + } + export { inputs_1146 as inputs }; + export namespace outputs_1146 { + let out_1116: string; + export { out_1116 as out }; + } + export { outputs_1146 as outputs }; + } + export { ND_absval_vector2_1 as ND_absval_vector2 }; + export namespace ND_absval_vector3_1 { + let node_1147: string; + export { node_1147 as node }; + export namespace inputs_1147 { + let _in_337: string; + export { _in_337 as in }; + } + export { inputs_1147 as inputs }; + export namespace outputs_1147 { + let out_1117: string; + export { out_1117 as out }; + } + export { outputs_1147 as outputs }; + } + export { ND_absval_vector3_1 as ND_absval_vector3 }; + export namespace ND_absval_vector4_1 { + let node_1148: string; + export { node_1148 as node }; + export namespace inputs_1148 { + let _in_338: string; + export { _in_338 as in }; + } + export { inputs_1148 as inputs }; + export namespace outputs_1148 { + let out_1118: string; + export { out_1118 as out }; + } + export { outputs_1148 as outputs }; + } + export { ND_absval_vector4_1 as ND_absval_vector4 }; + export namespace ND_floor_float_1 { + let node_1149: string; + export { node_1149 as node }; + export namespace inputs_1149 { + let _in_339: string; + export { _in_339 as in }; + } + export { inputs_1149 as inputs }; + export namespace outputs_1149 { + let out_1119: string; + export { out_1119 as out }; + } + export { outputs_1149 as outputs }; + } + export { ND_floor_float_1 as ND_floor_float }; + export namespace ND_floor_color3_1 { + let node_1150: string; + export { node_1150 as node }; + export namespace inputs_1150 { + let _in_340: string; + export { _in_340 as in }; + } + export { inputs_1150 as inputs }; + export namespace outputs_1150 { + let out_1120: string; + export { out_1120 as out }; + } + export { outputs_1150 as outputs }; + } + export { ND_floor_color3_1 as ND_floor_color3 }; + export namespace ND_floor_color4_1 { + let node_1151: string; + export { node_1151 as node }; + export namespace inputs_1151 { + let _in_341: string; + export { _in_341 as in }; + } + export { inputs_1151 as inputs }; + export namespace outputs_1151 { + let out_1121: string; + export { out_1121 as out }; + } + export { outputs_1151 as outputs }; + } + export { ND_floor_color4_1 as ND_floor_color4 }; + export namespace ND_floor_vector2_1 { + let node_1152: string; + export { node_1152 as node }; + export namespace inputs_1152 { + let _in_342: string; + export { _in_342 as in }; + } + export { inputs_1152 as inputs }; + export namespace outputs_1152 { + let out_1122: string; + export { out_1122 as out }; + } + export { outputs_1152 as outputs }; + } + export { ND_floor_vector2_1 as ND_floor_vector2 }; + export namespace ND_floor_vector3_1 { + let node_1153: string; + export { node_1153 as node }; + export namespace inputs_1153 { + let _in_343: string; + export { _in_343 as in }; + } + export { inputs_1153 as inputs }; + export namespace outputs_1153 { + let out_1123: string; + export { out_1123 as out }; + } + export { outputs_1153 as outputs }; + } + export { ND_floor_vector3_1 as ND_floor_vector3 }; + export namespace ND_floor_vector4_1 { + let node_1154: string; + export { node_1154 as node }; + export namespace inputs_1154 { + let _in_344: string; + export { _in_344 as in }; + } + export { inputs_1154 as inputs }; + export namespace outputs_1154 { + let out_1124: string; + export { out_1124 as out }; + } + export { outputs_1154 as outputs }; + } + export { ND_floor_vector4_1 as ND_floor_vector4 }; + export namespace ND_floor_integer_1 { + let node_1155: string; + export { node_1155 as node }; + export namespace inputs_1155 { + let _in_345: string; + export { _in_345 as in }; + } + export { inputs_1155 as inputs }; + export namespace outputs_1155 { + let out_1125: string; + export { out_1125 as out }; + } + export { outputs_1155 as outputs }; + } + export { ND_floor_integer_1 as ND_floor_integer }; + export namespace ND_ceil_float_1 { + let node_1156: string; + export { node_1156 as node }; + export namespace inputs_1156 { + let _in_346: string; + export { _in_346 as in }; + } + export { inputs_1156 as inputs }; + export namespace outputs_1156 { + let out_1126: string; + export { out_1126 as out }; + } + export { outputs_1156 as outputs }; + } + export { ND_ceil_float_1 as ND_ceil_float }; + export namespace ND_ceil_color3_1 { + let node_1157: string; + export { node_1157 as node }; + export namespace inputs_1157 { + let _in_347: string; + export { _in_347 as in }; + } + export { inputs_1157 as inputs }; + export namespace outputs_1157 { + let out_1127: string; + export { out_1127 as out }; + } + export { outputs_1157 as outputs }; + } + export { ND_ceil_color3_1 as ND_ceil_color3 }; + export namespace ND_ceil_color4_1 { + let node_1158: string; + export { node_1158 as node }; + export namespace inputs_1158 { + let _in_348: string; + export { _in_348 as in }; + } + export { inputs_1158 as inputs }; + export namespace outputs_1158 { + let out_1128: string; + export { out_1128 as out }; + } + export { outputs_1158 as outputs }; + } + export { ND_ceil_color4_1 as ND_ceil_color4 }; + export namespace ND_ceil_vector2_1 { + let node_1159: string; + export { node_1159 as node }; + export namespace inputs_1159 { + let _in_349: string; + export { _in_349 as in }; + } + export { inputs_1159 as inputs }; + export namespace outputs_1159 { + let out_1129: string; + export { out_1129 as out }; + } + export { outputs_1159 as outputs }; + } + export { ND_ceil_vector2_1 as ND_ceil_vector2 }; + export namespace ND_ceil_vector3_1 { + let node_1160: string; + export { node_1160 as node }; + export namespace inputs_1160 { + let _in_350: string; + export { _in_350 as in }; + } + export { inputs_1160 as inputs }; + export namespace outputs_1160 { + let out_1130: string; + export { out_1130 as out }; + } + export { outputs_1160 as outputs }; + } + export { ND_ceil_vector3_1 as ND_ceil_vector3 }; + export namespace ND_ceil_vector4_1 { + let node_1161: string; + export { node_1161 as node }; + export namespace inputs_1161 { + let _in_351: string; + export { _in_351 as in }; + } + export { inputs_1161 as inputs }; + export namespace outputs_1161 { + let out_1131: string; + export { out_1131 as out }; + } + export { outputs_1161 as outputs }; + } + export { ND_ceil_vector4_1 as ND_ceil_vector4 }; + export namespace ND_ceil_integer_1 { + let node_1162: string; + export { node_1162 as node }; + export namespace inputs_1162 { + let _in_352: string; + export { _in_352 as in }; + } + export { inputs_1162 as inputs }; + export namespace outputs_1162 { + let out_1132: string; + export { out_1132 as out }; + } + export { outputs_1162 as outputs }; + } + export { ND_ceil_integer_1 as ND_ceil_integer }; + export namespace ND_round_float_1 { + let node_1163: string; + export { node_1163 as node }; + export namespace inputs_1163 { + let _in_353: string; + export { _in_353 as in }; + } + export { inputs_1163 as inputs }; + export namespace outputs_1163 { + let out_1133: string; + export { out_1133 as out }; + } + export { outputs_1163 as outputs }; + } + export { ND_round_float_1 as ND_round_float }; + export namespace ND_round_color3_1 { + let node_1164: string; + export { node_1164 as node }; + export namespace inputs_1164 { + let _in_354: string; + export { _in_354 as in }; + } + export { inputs_1164 as inputs }; + export namespace outputs_1164 { + let out_1134: string; + export { out_1134 as out }; + } + export { outputs_1164 as outputs }; + } + export { ND_round_color3_1 as ND_round_color3 }; + export namespace ND_round_color4_1 { + let node_1165: string; + export { node_1165 as node }; + export namespace inputs_1165 { + let _in_355: string; + export { _in_355 as in }; + } + export { inputs_1165 as inputs }; + export namespace outputs_1165 { + let out_1135: string; + export { out_1135 as out }; + } + export { outputs_1165 as outputs }; + } + export { ND_round_color4_1 as ND_round_color4 }; + export namespace ND_round_vector2_1 { + let node_1166: string; + export { node_1166 as node }; + export namespace inputs_1166 { + let _in_356: string; + export { _in_356 as in }; + } + export { inputs_1166 as inputs }; + export namespace outputs_1166 { + let out_1136: string; + export { out_1136 as out }; + } + export { outputs_1166 as outputs }; + } + export { ND_round_vector2_1 as ND_round_vector2 }; + export namespace ND_round_vector3_1 { + let node_1167: string; + export { node_1167 as node }; + export namespace inputs_1167 { + let _in_357: string; + export { _in_357 as in }; + } + export { inputs_1167 as inputs }; + export namespace outputs_1167 { + let out_1137: string; + export { out_1137 as out }; + } + export { outputs_1167 as outputs }; + } + export { ND_round_vector3_1 as ND_round_vector3 }; + export namespace ND_round_vector4_1 { + let node_1168: string; + export { node_1168 as node }; + export namespace inputs_1168 { + let _in_358: string; + export { _in_358 as in }; + } + export { inputs_1168 as inputs }; + export namespace outputs_1168 { + let out_1138: string; + export { out_1138 as out }; + } + export { outputs_1168 as outputs }; + } + export { ND_round_vector4_1 as ND_round_vector4 }; + export namespace ND_round_integer_1 { + let node_1169: string; + export { node_1169 as node }; + export namespace inputs_1169 { + let _in_359: string; + export { _in_359 as in }; + } + export { inputs_1169 as inputs }; + export namespace outputs_1169 { + let out_1139: string; + export { out_1139 as out }; + } + export { outputs_1169 as outputs }; + } + export { ND_round_integer_1 as ND_round_integer }; + export namespace ND_power_float_1 { + let node_1170: string; + export { node_1170 as node }; + export namespace inputs_1170 { + let in1_300: string; + export { in1_300 as in1 }; + let in2_300: string; + export { in2_300 as in2 }; + } + export { inputs_1170 as inputs }; + export namespace outputs_1170 { + let out_1140: string; + export { out_1140 as out }; + } + export { outputs_1170 as outputs }; + } + export { ND_power_float_1 as ND_power_float }; + export namespace ND_power_color3_1 { + let node_1171: string; + export { node_1171 as node }; + export namespace inputs_1171 { + let in1_301: string; + export { in1_301 as in1 }; + let in2_301: string; + export { in2_301 as in2 }; + } + export { inputs_1171 as inputs }; + export namespace outputs_1171 { + let out_1141: string; + export { out_1141 as out }; + } + export { outputs_1171 as outputs }; + } + export { ND_power_color3_1 as ND_power_color3 }; + export namespace ND_power_color4_1 { + let node_1172: string; + export { node_1172 as node }; + export namespace inputs_1172 { + let in1_302: string; + export { in1_302 as in1 }; + let in2_302: string; + export { in2_302 as in2 }; + } + export { inputs_1172 as inputs }; + export namespace outputs_1172 { + let out_1142: string; + export { out_1142 as out }; + } + export { outputs_1172 as outputs }; + } + export { ND_power_color4_1 as ND_power_color4 }; + export namespace ND_power_vector2_1 { + let node_1173: string; + export { node_1173 as node }; + export namespace inputs_1173 { + let in1_303: string; + export { in1_303 as in1 }; + let in2_303: string; + export { in2_303 as in2 }; + } + export { inputs_1173 as inputs }; + export namespace outputs_1173 { + let out_1143: string; + export { out_1143 as out }; + } + export { outputs_1173 as outputs }; + } + export { ND_power_vector2_1 as ND_power_vector2 }; + export namespace ND_power_vector3_1 { + let node_1174: string; + export { node_1174 as node }; + export namespace inputs_1174 { + let in1_304: string; + export { in1_304 as in1 }; + let in2_304: string; + export { in2_304 as in2 }; + } + export { inputs_1174 as inputs }; + export namespace outputs_1174 { + let out_1144: string; + export { out_1144 as out }; + } + export { outputs_1174 as outputs }; + } + export { ND_power_vector3_1 as ND_power_vector3 }; + export namespace ND_power_vector4_1 { + let node_1175: string; + export { node_1175 as node }; + export namespace inputs_1175 { + let in1_305: string; + export { in1_305 as in1 }; + let in2_305: string; + export { in2_305 as in2 }; + } + export { inputs_1175 as inputs }; + export namespace outputs_1175 { + let out_1145: string; + export { out_1145 as out }; + } + export { outputs_1175 as outputs }; + } + export { ND_power_vector4_1 as ND_power_vector4 }; + export namespace ND_power_color3FA_1 { + let node_1176: string; + export { node_1176 as node }; + export namespace inputs_1176 { + let in1_306: string; + export { in1_306 as in1 }; + let in2_306: string; + export { in2_306 as in2 }; + } + export { inputs_1176 as inputs }; + export namespace outputs_1176 { + let out_1146: string; + export { out_1146 as out }; + } + export { outputs_1176 as outputs }; + } + export { ND_power_color3FA_1 as ND_power_color3FA }; + export namespace ND_power_color4FA_1 { + let node_1177: string; + export { node_1177 as node }; + export namespace inputs_1177 { + let in1_307: string; + export { in1_307 as in1 }; + let in2_307: string; + export { in2_307 as in2 }; + } + export { inputs_1177 as inputs }; + export namespace outputs_1177 { + let out_1147: string; + export { out_1147 as out }; + } + export { outputs_1177 as outputs }; + } + export { ND_power_color4FA_1 as ND_power_color4FA }; + export namespace ND_power_vector2FA_1 { + let node_1178: string; + export { node_1178 as node }; + export namespace inputs_1178 { + let in1_308: string; + export { in1_308 as in1 }; + let in2_308: string; + export { in2_308 as in2 }; + } + export { inputs_1178 as inputs }; + export namespace outputs_1178 { + let out_1148: string; + export { out_1148 as out }; + } + export { outputs_1178 as outputs }; + } + export { ND_power_vector2FA_1 as ND_power_vector2FA }; + export namespace ND_power_vector3FA_1 { + let node_1179: string; + export { node_1179 as node }; + export namespace inputs_1179 { + let in1_309: string; + export { in1_309 as in1 }; + let in2_309: string; + export { in2_309 as in2 }; + } + export { inputs_1179 as inputs }; + export namespace outputs_1179 { + let out_1149: string; + export { out_1149 as out }; + } + export { outputs_1179 as outputs }; + } + export { ND_power_vector3FA_1 as ND_power_vector3FA }; + export namespace ND_power_vector4FA_1 { + let node_1180: string; + export { node_1180 as node }; + export namespace inputs_1180 { + let in1_310: string; + export { in1_310 as in1 }; + let in2_310: string; + export { in2_310 as in2 }; + } + export { inputs_1180 as inputs }; + export namespace outputs_1180 { + let out_1150: string; + export { out_1150 as out }; + } + export { outputs_1180 as outputs }; + } + export { ND_power_vector4FA_1 as ND_power_vector4FA }; + export namespace ND_safepower_float_1 { + let node_1181: string; + export { node_1181 as node }; + export namespace inputs_1181 { + let in1_311: string; + export { in1_311 as in1 }; + let in2_311: string; + export { in2_311 as in2 }; + } + export { inputs_1181 as inputs }; + export namespace outputs_1181 { + let out_1151: string; + export { out_1151 as out }; + } + export { outputs_1181 as outputs }; + } + export { ND_safepower_float_1 as ND_safepower_float }; + export namespace ND_safepower_color3_1 { + let node_1182: string; + export { node_1182 as node }; + export namespace inputs_1182 { + let in1_312: string; + export { in1_312 as in1 }; + let in2_312: string; + export { in2_312 as in2 }; + } + export { inputs_1182 as inputs }; + export namespace outputs_1182 { + let out_1152: string; + export { out_1152 as out }; + } + export { outputs_1182 as outputs }; + } + export { ND_safepower_color3_1 as ND_safepower_color3 }; + export namespace ND_safepower_color4_1 { + let node_1183: string; + export { node_1183 as node }; + export namespace inputs_1183 { + let in1_313: string; + export { in1_313 as in1 }; + let in2_313: string; + export { in2_313 as in2 }; + } + export { inputs_1183 as inputs }; + export namespace outputs_1183 { + let out_1153: string; + export { out_1153 as out }; + } + export { outputs_1183 as outputs }; + } + export { ND_safepower_color4_1 as ND_safepower_color4 }; + export namespace ND_safepower_vector2_1 { + let node_1184: string; + export { node_1184 as node }; + export namespace inputs_1184 { + let in1_314: string; + export { in1_314 as in1 }; + let in2_314: string; + export { in2_314 as in2 }; + } + export { inputs_1184 as inputs }; + export namespace outputs_1184 { + let out_1154: string; + export { out_1154 as out }; + } + export { outputs_1184 as outputs }; + } + export { ND_safepower_vector2_1 as ND_safepower_vector2 }; + export namespace ND_safepower_vector3_1 { + let node_1185: string; + export { node_1185 as node }; + export namespace inputs_1185 { + let in1_315: string; + export { in1_315 as in1 }; + let in2_315: string; + export { in2_315 as in2 }; + } + export { inputs_1185 as inputs }; + export namespace outputs_1185 { + let out_1155: string; + export { out_1155 as out }; + } + export { outputs_1185 as outputs }; + } + export { ND_safepower_vector3_1 as ND_safepower_vector3 }; + export namespace ND_safepower_vector4_1 { + let node_1186: string; + export { node_1186 as node }; + export namespace inputs_1186 { + let in1_316: string; + export { in1_316 as in1 }; + let in2_316: string; + export { in2_316 as in2 }; + } + export { inputs_1186 as inputs }; + export namespace outputs_1186 { + let out_1156: string; + export { out_1156 as out }; + } + export { outputs_1186 as outputs }; + } + export { ND_safepower_vector4_1 as ND_safepower_vector4 }; + export namespace ND_safepower_color3FA_1 { + let node_1187: string; + export { node_1187 as node }; + export namespace inputs_1187 { + let in1_317: string; + export { in1_317 as in1 }; + let in2_317: string; + export { in2_317 as in2 }; + } + export { inputs_1187 as inputs }; + export namespace outputs_1187 { + let out_1157: string; + export { out_1157 as out }; + } + export { outputs_1187 as outputs }; + } + export { ND_safepower_color3FA_1 as ND_safepower_color3FA }; + export namespace ND_safepower_color4FA_1 { + let node_1188: string; + export { node_1188 as node }; + export namespace inputs_1188 { + let in1_318: string; + export { in1_318 as in1 }; + let in2_318: string; + export { in2_318 as in2 }; + } + export { inputs_1188 as inputs }; + export namespace outputs_1188 { + let out_1158: string; + export { out_1158 as out }; + } + export { outputs_1188 as outputs }; + } + export { ND_safepower_color4FA_1 as ND_safepower_color4FA }; + export namespace ND_safepower_vector2FA_1 { + let node_1189: string; + export { node_1189 as node }; + export namespace inputs_1189 { + let in1_319: string; + export { in1_319 as in1 }; + let in2_319: string; + export { in2_319 as in2 }; + } + export { inputs_1189 as inputs }; + export namespace outputs_1189 { + let out_1159: string; + export { out_1159 as out }; + } + export { outputs_1189 as outputs }; + } + export { ND_safepower_vector2FA_1 as ND_safepower_vector2FA }; + export namespace ND_safepower_vector3FA_1 { + let node_1190: string; + export { node_1190 as node }; + export namespace inputs_1190 { + let in1_320: string; + export { in1_320 as in1 }; + let in2_320: string; + export { in2_320 as in2 }; + } + export { inputs_1190 as inputs }; + export namespace outputs_1190 { + let out_1160: string; + export { out_1160 as out }; + } + export { outputs_1190 as outputs }; + } + export { ND_safepower_vector3FA_1 as ND_safepower_vector3FA }; + export namespace ND_safepower_vector4FA_1 { + let node_1191: string; + export { node_1191 as node }; + export namespace inputs_1191 { + let in1_321: string; + export { in1_321 as in1 }; + let in2_321: string; + export { in2_321 as in2 }; + } + export { inputs_1191 as inputs }; + export namespace outputs_1191 { + let out_1161: string; + export { out_1161 as out }; + } + export { outputs_1191 as outputs }; + } + export { ND_safepower_vector4FA_1 as ND_safepower_vector4FA }; + export namespace ND_sin_float_1 { + let node_1192: string; + export { node_1192 as node }; + export namespace inputs_1192 { + let _in_360: string; + export { _in_360 as in }; + } + export { inputs_1192 as inputs }; + export namespace outputs_1192 { + let out_1162: string; + export { out_1162 as out }; + } + export { outputs_1192 as outputs }; + } + export { ND_sin_float_1 as ND_sin_float }; + export namespace ND_cos_float_1 { + let node_1193: string; + export { node_1193 as node }; + export namespace inputs_1193 { + let _in_361: string; + export { _in_361 as in }; + } + export { inputs_1193 as inputs }; + export namespace outputs_1193 { + let out_1163: string; + export { out_1163 as out }; + } + export { outputs_1193 as outputs }; + } + export { ND_cos_float_1 as ND_cos_float }; + export namespace ND_tan_float_1 { + let node_1194: string; + export { node_1194 as node }; + export namespace inputs_1194 { + let _in_362: string; + export { _in_362 as in }; + } + export { inputs_1194 as inputs }; + export namespace outputs_1194 { + let out_1164: string; + export { out_1164 as out }; + } + export { outputs_1194 as outputs }; + } + export { ND_tan_float_1 as ND_tan_float }; + export namespace ND_asin_float_1 { + let node_1195: string; + export { node_1195 as node }; + export namespace inputs_1195 { + let _in_363: string; + export { _in_363 as in }; + } + export { inputs_1195 as inputs }; + export namespace outputs_1195 { + let out_1165: string; + export { out_1165 as out }; + } + export { outputs_1195 as outputs }; + } + export { ND_asin_float_1 as ND_asin_float }; + export namespace ND_acos_float_1 { + let node_1196: string; + export { node_1196 as node }; + export namespace inputs_1196 { + let _in_364: string; + export { _in_364 as in }; + } + export { inputs_1196 as inputs }; + export namespace outputs_1196 { + let out_1166: string; + export { out_1166 as out }; + } + export { outputs_1196 as outputs }; + } + export { ND_acos_float_1 as ND_acos_float }; + export namespace ND_atan2_float_1 { + let node_1197: string; + export { node_1197 as node }; + export namespace inputs_1197 { + let iny_4: string; + export { iny_4 as iny }; + let inx_4: string; + export { inx_4 as inx }; + } + export { inputs_1197 as inputs }; + export namespace outputs_1197 { + let out_1167: string; + export { out_1167 as out }; + } + export { outputs_1197 as outputs }; + } + export { ND_atan2_float_1 as ND_atan2_float }; + export namespace ND_sin_vector2_1 { + let node_1198: string; + export { node_1198 as node }; + export namespace inputs_1198 { + let _in_365: string; + export { _in_365 as in }; + } + export { inputs_1198 as inputs }; + export namespace outputs_1198 { + let out_1168: string; + export { out_1168 as out }; + } + export { outputs_1198 as outputs }; + } + export { ND_sin_vector2_1 as ND_sin_vector2 }; + export namespace ND_cos_vector2_1 { + let node_1199: string; + export { node_1199 as node }; + export namespace inputs_1199 { + let _in_366: string; + export { _in_366 as in }; + } + export { inputs_1199 as inputs }; + export namespace outputs_1199 { + let out_1169: string; + export { out_1169 as out }; + } + export { outputs_1199 as outputs }; + } + export { ND_cos_vector2_1 as ND_cos_vector2 }; + export namespace ND_tan_vector2_1 { + let node_1200: string; + export { node_1200 as node }; + export namespace inputs_1200 { + let _in_367: string; + export { _in_367 as in }; + } + export { inputs_1200 as inputs }; + export namespace outputs_1200 { + let out_1170: string; + export { out_1170 as out }; + } + export { outputs_1200 as outputs }; + } + export { ND_tan_vector2_1 as ND_tan_vector2 }; + export namespace ND_asin_vector2_1 { + let node_1201: string; + export { node_1201 as node }; + export namespace inputs_1201 { + let _in_368: string; + export { _in_368 as in }; + } + export { inputs_1201 as inputs }; + export namespace outputs_1201 { + let out_1171: string; + export { out_1171 as out }; + } + export { outputs_1201 as outputs }; + } + export { ND_asin_vector2_1 as ND_asin_vector2 }; + export namespace ND_acos_vector2_1 { + let node_1202: string; + export { node_1202 as node }; + export namespace inputs_1202 { + let _in_369: string; + export { _in_369 as in }; + } + export { inputs_1202 as inputs }; + export namespace outputs_1202 { + let out_1172: string; + export { out_1172 as out }; + } + export { outputs_1202 as outputs }; + } + export { ND_acos_vector2_1 as ND_acos_vector2 }; + export namespace ND_atan2_vector2_1 { + let node_1203: string; + export { node_1203 as node }; + export namespace inputs_1203 { + let iny_5: string; + export { iny_5 as iny }; + let inx_5: string; + export { inx_5 as inx }; + } + export { inputs_1203 as inputs }; + export namespace outputs_1203 { + let out_1173: string; + export { out_1173 as out }; + } + export { outputs_1203 as outputs }; + } + export { ND_atan2_vector2_1 as ND_atan2_vector2 }; + export namespace ND_sin_vector3_1 { + let node_1204: string; + export { node_1204 as node }; + export namespace inputs_1204 { + let _in_370: string; + export { _in_370 as in }; + } + export { inputs_1204 as inputs }; + export namespace outputs_1204 { + let out_1174: string; + export { out_1174 as out }; + } + export { outputs_1204 as outputs }; + } + export { ND_sin_vector3_1 as ND_sin_vector3 }; + export namespace ND_cos_vector3_1 { + let node_1205: string; + export { node_1205 as node }; + export namespace inputs_1205 { + let _in_371: string; + export { _in_371 as in }; + } + export { inputs_1205 as inputs }; + export namespace outputs_1205 { + let out_1175: string; + export { out_1175 as out }; + } + export { outputs_1205 as outputs }; + } + export { ND_cos_vector3_1 as ND_cos_vector3 }; + export namespace ND_tan_vector3_1 { + let node_1206: string; + export { node_1206 as node }; + export namespace inputs_1206 { + let _in_372: string; + export { _in_372 as in }; + } + export { inputs_1206 as inputs }; + export namespace outputs_1206 { + let out_1176: string; + export { out_1176 as out }; + } + export { outputs_1206 as outputs }; + } + export { ND_tan_vector3_1 as ND_tan_vector3 }; + export namespace ND_asin_vector3_1 { + let node_1207: string; + export { node_1207 as node }; + export namespace inputs_1207 { + let _in_373: string; + export { _in_373 as in }; + } + export { inputs_1207 as inputs }; + export namespace outputs_1207 { + let out_1177: string; + export { out_1177 as out }; + } + export { outputs_1207 as outputs }; + } + export { ND_asin_vector3_1 as ND_asin_vector3 }; + export namespace ND_acos_vector3_1 { + let node_1208: string; + export { node_1208 as node }; + export namespace inputs_1208 { + let _in_374: string; + export { _in_374 as in }; + } + export { inputs_1208 as inputs }; + export namespace outputs_1208 { + let out_1178: string; + export { out_1178 as out }; + } + export { outputs_1208 as outputs }; + } + export { ND_acos_vector3_1 as ND_acos_vector3 }; + export namespace ND_atan2_vector3_1 { + let node_1209: string; + export { node_1209 as node }; + export namespace inputs_1209 { + let iny_6: string; + export { iny_6 as iny }; + let inx_6: string; + export { inx_6 as inx }; + } + export { inputs_1209 as inputs }; + export namespace outputs_1209 { + let out_1179: string; + export { out_1179 as out }; + } + export { outputs_1209 as outputs }; + } + export { ND_atan2_vector3_1 as ND_atan2_vector3 }; + export namespace ND_sin_vector4_1 { + let node_1210: string; + export { node_1210 as node }; + export namespace inputs_1210 { + let _in_375: string; + export { _in_375 as in }; + } + export { inputs_1210 as inputs }; + export namespace outputs_1210 { + let out_1180: string; + export { out_1180 as out }; + } + export { outputs_1210 as outputs }; + } + export { ND_sin_vector4_1 as ND_sin_vector4 }; + export namespace ND_cos_vector4_1 { + let node_1211: string; + export { node_1211 as node }; + export namespace inputs_1211 { + let _in_376: string; + export { _in_376 as in }; + } + export { inputs_1211 as inputs }; + export namespace outputs_1211 { + let out_1181: string; + export { out_1181 as out }; + } + export { outputs_1211 as outputs }; + } + export { ND_cos_vector4_1 as ND_cos_vector4 }; + export namespace ND_tan_vector4_1 { + let node_1212: string; + export { node_1212 as node }; + export namespace inputs_1212 { + let _in_377: string; + export { _in_377 as in }; + } + export { inputs_1212 as inputs }; + export namespace outputs_1212 { + let out_1182: string; + export { out_1182 as out }; + } + export { outputs_1212 as outputs }; + } + export { ND_tan_vector4_1 as ND_tan_vector4 }; + export namespace ND_asin_vector4_1 { + let node_1213: string; + export { node_1213 as node }; + export namespace inputs_1213 { + let _in_378: string; + export { _in_378 as in }; + } + export { inputs_1213 as inputs }; + export namespace outputs_1213 { + let out_1183: string; + export { out_1183 as out }; + } + export { outputs_1213 as outputs }; + } + export { ND_asin_vector4_1 as ND_asin_vector4 }; + export namespace ND_acos_vector4_1 { + let node_1214: string; + export { node_1214 as node }; + export namespace inputs_1214 { + let _in_379: string; + export { _in_379 as in }; + } + export { inputs_1214 as inputs }; + export namespace outputs_1214 { + let out_1184: string; + export { out_1184 as out }; + } + export { outputs_1214 as outputs }; + } + export { ND_acos_vector4_1 as ND_acos_vector4 }; + export namespace ND_atan2_vector4_1 { + let node_1215: string; + export { node_1215 as node }; + export namespace inputs_1215 { + let iny_7: string; + export { iny_7 as iny }; + let inx_7: string; + export { inx_7 as inx }; + } + export { inputs_1215 as inputs }; + export namespace outputs_1215 { + let out_1185: string; + export { out_1185 as out }; + } + export { outputs_1215 as outputs }; + } + export { ND_atan2_vector4_1 as ND_atan2_vector4 }; + export namespace ND_sqrt_float_1 { + let node_1216: string; + export { node_1216 as node }; + export namespace inputs_1216 { + let _in_380: string; + export { _in_380 as in }; + } + export { inputs_1216 as inputs }; + export namespace outputs_1216 { + let out_1186: string; + export { out_1186 as out }; + } + export { outputs_1216 as outputs }; + } + export { ND_sqrt_float_1 as ND_sqrt_float }; + export namespace ND_ln_float_1 { + let node_1217: string; + export { node_1217 as node }; + export namespace inputs_1217 { + let _in_381: string; + export { _in_381 as in }; + } + export { inputs_1217 as inputs }; + export namespace outputs_1217 { + let out_1187: string; + export { out_1187 as out }; + } + export { outputs_1217 as outputs }; + } + export { ND_ln_float_1 as ND_ln_float }; + export namespace ND_exp_float_1 { + let node_1218: string; + export { node_1218 as node }; + export namespace inputs_1218 { + let _in_382: string; + export { _in_382 as in }; + } + export { inputs_1218 as inputs }; + export namespace outputs_1218 { + let out_1188: string; + export { out_1188 as out }; + } + export { outputs_1218 as outputs }; + } + export { ND_exp_float_1 as ND_exp_float }; + export namespace ND_sqrt_vector2_1 { + let node_1219: string; + export { node_1219 as node }; + export namespace inputs_1219 { + let _in_383: string; + export { _in_383 as in }; + } + export { inputs_1219 as inputs }; + export namespace outputs_1219 { + let out_1189: string; + export { out_1189 as out }; + } + export { outputs_1219 as outputs }; + } + export { ND_sqrt_vector2_1 as ND_sqrt_vector2 }; + export namespace ND_ln_vector2_1 { + let node_1220: string; + export { node_1220 as node }; + export namespace inputs_1220 { + let _in_384: string; + export { _in_384 as in }; + } + export { inputs_1220 as inputs }; + export namespace outputs_1220 { + let out_1190: string; + export { out_1190 as out }; + } + export { outputs_1220 as outputs }; + } + export { ND_ln_vector2_1 as ND_ln_vector2 }; + export namespace ND_exp_vector2_1 { + let node_1221: string; + export { node_1221 as node }; + export namespace inputs_1221 { + let _in_385: string; + export { _in_385 as in }; + } + export { inputs_1221 as inputs }; + export namespace outputs_1221 { + let out_1191: string; + export { out_1191 as out }; + } + export { outputs_1221 as outputs }; + } + export { ND_exp_vector2_1 as ND_exp_vector2 }; + export namespace ND_sqrt_vector3_1 { + let node_1222: string; + export { node_1222 as node }; + export namespace inputs_1222 { + let _in_386: string; + export { _in_386 as in }; + } + export { inputs_1222 as inputs }; + export namespace outputs_1222 { + let out_1192: string; + export { out_1192 as out }; + } + export { outputs_1222 as outputs }; + } + export { ND_sqrt_vector3_1 as ND_sqrt_vector3 }; + export namespace ND_ln_vector3_1 { + let node_1223: string; + export { node_1223 as node }; + export namespace inputs_1223 { + let _in_387: string; + export { _in_387 as in }; + } + export { inputs_1223 as inputs }; + export namespace outputs_1223 { + let out_1193: string; + export { out_1193 as out }; + } + export { outputs_1223 as outputs }; + } + export { ND_ln_vector3_1 as ND_ln_vector3 }; + export namespace ND_exp_vector3_1 { + let node_1224: string; + export { node_1224 as node }; + export namespace inputs_1224 { + let _in_388: string; + export { _in_388 as in }; + } + export { inputs_1224 as inputs }; + export namespace outputs_1224 { + let out_1194: string; + export { out_1194 as out }; + } + export { outputs_1224 as outputs }; + } + export { ND_exp_vector3_1 as ND_exp_vector3 }; + export namespace ND_sqrt_vector4_1 { + let node_1225: string; + export { node_1225 as node }; + export namespace inputs_1225 { + let _in_389: string; + export { _in_389 as in }; + } + export { inputs_1225 as inputs }; + export namespace outputs_1225 { + let out_1195: string; + export { out_1195 as out }; + } + export { outputs_1225 as outputs }; + } + export { ND_sqrt_vector4_1 as ND_sqrt_vector4 }; + export namespace ND_ln_vector4_1 { + let node_1226: string; + export { node_1226 as node }; + export namespace inputs_1226 { + let _in_390: string; + export { _in_390 as in }; + } + export { inputs_1226 as inputs }; + export namespace outputs_1226 { + let out_1196: string; + export { out_1196 as out }; + } + export { outputs_1226 as outputs }; + } + export { ND_ln_vector4_1 as ND_ln_vector4 }; + export namespace ND_exp_vector4_1 { + let node_1227: string; + export { node_1227 as node }; + export namespace inputs_1227 { + let _in_391: string; + export { _in_391 as in }; + } + export { inputs_1227 as inputs }; + export namespace outputs_1227 { + let out_1197: string; + export { out_1197 as out }; + } + export { outputs_1227 as outputs }; + } + export { ND_exp_vector4_1 as ND_exp_vector4 }; + export namespace ND_sign_float_1 { + let node_1228: string; + export { node_1228 as node }; + export namespace inputs_1228 { + let _in_392: string; + export { _in_392 as in }; + } + export { inputs_1228 as inputs }; + export namespace outputs_1228 { + let out_1198: string; + export { out_1198 as out }; + } + export { outputs_1228 as outputs }; + } + export { ND_sign_float_1 as ND_sign_float }; + export namespace ND_sign_color3_1 { + let node_1229: string; + export { node_1229 as node }; + export namespace inputs_1229 { + let _in_393: string; + export { _in_393 as in }; + } + export { inputs_1229 as inputs }; + export namespace outputs_1229 { + let out_1199: string; + export { out_1199 as out }; + } + export { outputs_1229 as outputs }; + } + export { ND_sign_color3_1 as ND_sign_color3 }; + export namespace ND_sign_color4_1 { + let node_1230: string; + export { node_1230 as node }; + export namespace inputs_1230 { + let _in_394: string; + export { _in_394 as in }; + } + export { inputs_1230 as inputs }; + export namespace outputs_1230 { + let out_1200: string; + export { out_1200 as out }; + } + export { outputs_1230 as outputs }; + } + export { ND_sign_color4_1 as ND_sign_color4 }; + export namespace ND_sign_vector2_1 { + let node_1231: string; + export { node_1231 as node }; + export namespace inputs_1231 { + let _in_395: string; + export { _in_395 as in }; + } + export { inputs_1231 as inputs }; + export namespace outputs_1231 { + let out_1201: string; + export { out_1201 as out }; + } + export { outputs_1231 as outputs }; + } + export { ND_sign_vector2_1 as ND_sign_vector2 }; + export namespace ND_sign_vector3_1 { + let node_1232: string; + export { node_1232 as node }; + export namespace inputs_1232 { + let _in_396: string; + export { _in_396 as in }; + } + export { inputs_1232 as inputs }; + export namespace outputs_1232 { + let out_1202: string; + export { out_1202 as out }; + } + export { outputs_1232 as outputs }; + } + export { ND_sign_vector3_1 as ND_sign_vector3 }; + export namespace ND_sign_vector4_1 { + let node_1233: string; + export { node_1233 as node }; + export namespace inputs_1233 { + let _in_397: string; + export { _in_397 as in }; + } + export { inputs_1233 as inputs }; + export namespace outputs_1233 { + let out_1203: string; + export { out_1203 as out }; + } + export { outputs_1233 as outputs }; + } + export { ND_sign_vector4_1 as ND_sign_vector4 }; + export namespace ND_clamp_float_1 { + let node_1234: string; + export { node_1234 as node }; + export namespace inputs_1234 { + let _in_398: string; + export { _in_398 as in }; + let low_22: string; + export { low_22 as low }; + let high_22: string; + export { high_22 as high }; + } + export { inputs_1234 as inputs }; + export namespace outputs_1234 { + let out_1204: string; + export { out_1204 as out }; + } + export { outputs_1234 as outputs }; + } + export { ND_clamp_float_1 as ND_clamp_float }; + export namespace ND_clamp_color3_1 { + let node_1235: string; + export { node_1235 as node }; + export namespace inputs_1235 { + let _in_399: string; + export { _in_399 as in }; + let low_23: string; + export { low_23 as low }; + let high_23: string; + export { high_23 as high }; + } + export { inputs_1235 as inputs }; + export namespace outputs_1235 { + let out_1205: string; + export { out_1205 as out }; + } + export { outputs_1235 as outputs }; + } + export { ND_clamp_color3_1 as ND_clamp_color3 }; + export namespace ND_clamp_color4_1 { + let node_1236: string; + export { node_1236 as node }; + export namespace inputs_1236 { + let _in_400: string; + export { _in_400 as in }; + let low_24: string; + export { low_24 as low }; + let high_24: string; + export { high_24 as high }; + } + export { inputs_1236 as inputs }; + export namespace outputs_1236 { + let out_1206: string; + export { out_1206 as out }; + } + export { outputs_1236 as outputs }; + } + export { ND_clamp_color4_1 as ND_clamp_color4 }; + export namespace ND_clamp_vector2_1 { + let node_1237: string; + export { node_1237 as node }; + export namespace inputs_1237 { + let _in_401: string; + export { _in_401 as in }; + let low_25: string; + export { low_25 as low }; + let high_25: string; + export { high_25 as high }; + } + export { inputs_1237 as inputs }; + export namespace outputs_1237 { + let out_1207: string; + export { out_1207 as out }; + } + export { outputs_1237 as outputs }; + } + export { ND_clamp_vector2_1 as ND_clamp_vector2 }; + export namespace ND_clamp_vector3_1 { + let node_1238: string; + export { node_1238 as node }; + export namespace inputs_1238 { + let _in_402: string; + export { _in_402 as in }; + let low_26: string; + export { low_26 as low }; + let high_26: string; + export { high_26 as high }; + } + export { inputs_1238 as inputs }; + export namespace outputs_1238 { + let out_1208: string; + export { out_1208 as out }; + } + export { outputs_1238 as outputs }; + } + export { ND_clamp_vector3_1 as ND_clamp_vector3 }; + export namespace ND_clamp_vector4_1 { + let node_1239: string; + export { node_1239 as node }; + export namespace inputs_1239 { + let _in_403: string; + export { _in_403 as in }; + let low_27: string; + export { low_27 as low }; + let high_27: string; + export { high_27 as high }; + } + export { inputs_1239 as inputs }; + export namespace outputs_1239 { + let out_1209: string; + export { out_1209 as out }; + } + export { outputs_1239 as outputs }; + } + export { ND_clamp_vector4_1 as ND_clamp_vector4 }; + export namespace ND_clamp_color3FA_1 { + let node_1240: string; + export { node_1240 as node }; + export namespace inputs_1240 { + let _in_404: string; + export { _in_404 as in }; + let low_28: string; + export { low_28 as low }; + let high_28: string; + export { high_28 as high }; + } + export { inputs_1240 as inputs }; + export namespace outputs_1240 { + let out_1210: string; + export { out_1210 as out }; + } + export { outputs_1240 as outputs }; + } + export { ND_clamp_color3FA_1 as ND_clamp_color3FA }; + export namespace ND_clamp_color4FA_1 { + let node_1241: string; + export { node_1241 as node }; + export namespace inputs_1241 { + let _in_405: string; + export { _in_405 as in }; + let low_29: string; + export { low_29 as low }; + let high_29: string; + export { high_29 as high }; + } + export { inputs_1241 as inputs }; + export namespace outputs_1241 { + let out_1211: string; + export { out_1211 as out }; + } + export { outputs_1241 as outputs }; + } + export { ND_clamp_color4FA_1 as ND_clamp_color4FA }; + export namespace ND_clamp_vector2FA_1 { + let node_1242: string; + export { node_1242 as node }; + export namespace inputs_1242 { + let _in_406: string; + export { _in_406 as in }; + let low_30: string; + export { low_30 as low }; + let high_30: string; + export { high_30 as high }; + } + export { inputs_1242 as inputs }; + export namespace outputs_1242 { + let out_1212: string; + export { out_1212 as out }; + } + export { outputs_1242 as outputs }; + } + export { ND_clamp_vector2FA_1 as ND_clamp_vector2FA }; + export namespace ND_clamp_vector3FA_1 { + let node_1243: string; + export { node_1243 as node }; + export namespace inputs_1243 { + let _in_407: string; + export { _in_407 as in }; + let low_31: string; + export { low_31 as low }; + let high_31: string; + export { high_31 as high }; + } + export { inputs_1243 as inputs }; + export namespace outputs_1243 { + let out_1213: string; + export { out_1213 as out }; + } + export { outputs_1243 as outputs }; + } + export { ND_clamp_vector3FA_1 as ND_clamp_vector3FA }; + export namespace ND_clamp_vector4FA_1 { + let node_1244: string; + export { node_1244 as node }; + export namespace inputs_1244 { + let _in_408: string; + export { _in_408 as in }; + let low_32: string; + export { low_32 as low }; + let high_32: string; + export { high_32 as high }; + } + export { inputs_1244 as inputs }; + export namespace outputs_1244 { + let out_1214: string; + export { out_1214 as out }; + } + export { outputs_1244 as outputs }; + } + export { ND_clamp_vector4FA_1 as ND_clamp_vector4FA }; + export namespace ND_min_float_1 { + let node_1245: string; + export { node_1245 as node }; + export namespace inputs_1245 { + let in1_322: string; + export { in1_322 as in1 }; + let in2_322: string; + export { in2_322 as in2 }; + } + export { inputs_1245 as inputs }; + export namespace outputs_1245 { + let out_1215: string; + export { out_1215 as out }; + } + export { outputs_1245 as outputs }; + } + export { ND_min_float_1 as ND_min_float }; + export namespace ND_min_color3_1 { + let node_1246: string; + export { node_1246 as node }; + export namespace inputs_1246 { + let in1_323: string; + export { in1_323 as in1 }; + let in2_323: string; + export { in2_323 as in2 }; + } + export { inputs_1246 as inputs }; + export namespace outputs_1246 { + let out_1216: string; + export { out_1216 as out }; + } + export { outputs_1246 as outputs }; + } + export { ND_min_color3_1 as ND_min_color3 }; + export namespace ND_min_color4_1 { + let node_1247: string; + export { node_1247 as node }; + export namespace inputs_1247 { + let in1_324: string; + export { in1_324 as in1 }; + let in2_324: string; + export { in2_324 as in2 }; + } + export { inputs_1247 as inputs }; + export namespace outputs_1247 { + let out_1217: string; + export { out_1217 as out }; + } + export { outputs_1247 as outputs }; + } + export { ND_min_color4_1 as ND_min_color4 }; + export namespace ND_min_vector2_1 { + let node_1248: string; + export { node_1248 as node }; + export namespace inputs_1248 { + let in1_325: string; + export { in1_325 as in1 }; + let in2_325: string; + export { in2_325 as in2 }; + } + export { inputs_1248 as inputs }; + export namespace outputs_1248 { + let out_1218: string; + export { out_1218 as out }; + } + export { outputs_1248 as outputs }; + } + export { ND_min_vector2_1 as ND_min_vector2 }; + export namespace ND_min_vector3_1 { + let node_1249: string; + export { node_1249 as node }; + export namespace inputs_1249 { + let in1_326: string; + export { in1_326 as in1 }; + let in2_326: string; + export { in2_326 as in2 }; + } + export { inputs_1249 as inputs }; + export namespace outputs_1249 { + let out_1219: string; + export { out_1219 as out }; + } + export { outputs_1249 as outputs }; + } + export { ND_min_vector3_1 as ND_min_vector3 }; + export namespace ND_min_vector4_1 { + let node_1250: string; + export { node_1250 as node }; + export namespace inputs_1250 { + let in1_327: string; + export { in1_327 as in1 }; + let in2_327: string; + export { in2_327 as in2 }; + } + export { inputs_1250 as inputs }; + export namespace outputs_1250 { + let out_1220: string; + export { out_1220 as out }; + } + export { outputs_1250 as outputs }; + } + export { ND_min_vector4_1 as ND_min_vector4 }; + export namespace ND_min_color3FA_1 { + let node_1251: string; + export { node_1251 as node }; + export namespace inputs_1251 { + let in1_328: string; + export { in1_328 as in1 }; + let in2_328: string; + export { in2_328 as in2 }; + } + export { inputs_1251 as inputs }; + export namespace outputs_1251 { + let out_1221: string; + export { out_1221 as out }; + } + export { outputs_1251 as outputs }; + } + export { ND_min_color3FA_1 as ND_min_color3FA }; + export namespace ND_min_color4FA_1 { + let node_1252: string; + export { node_1252 as node }; + export namespace inputs_1252 { + let in1_329: string; + export { in1_329 as in1 }; + let in2_329: string; + export { in2_329 as in2 }; + } + export { inputs_1252 as inputs }; + export namespace outputs_1252 { + let out_1222: string; + export { out_1222 as out }; + } + export { outputs_1252 as outputs }; + } + export { ND_min_color4FA_1 as ND_min_color4FA }; + export namespace ND_min_vector2FA_1 { + let node_1253: string; + export { node_1253 as node }; + export namespace inputs_1253 { + let in1_330: string; + export { in1_330 as in1 }; + let in2_330: string; + export { in2_330 as in2 }; + } + export { inputs_1253 as inputs }; + export namespace outputs_1253 { + let out_1223: string; + export { out_1223 as out }; + } + export { outputs_1253 as outputs }; + } + export { ND_min_vector2FA_1 as ND_min_vector2FA }; + export namespace ND_min_vector3FA_1 { + let node_1254: string; + export { node_1254 as node }; + export namespace inputs_1254 { + let in1_331: string; + export { in1_331 as in1 }; + let in2_331: string; + export { in2_331 as in2 }; + } + export { inputs_1254 as inputs }; + export namespace outputs_1254 { + let out_1224: string; + export { out_1224 as out }; + } + export { outputs_1254 as outputs }; + } + export { ND_min_vector3FA_1 as ND_min_vector3FA }; + export namespace ND_min_vector4FA_1 { + let node_1255: string; + export { node_1255 as node }; + export namespace inputs_1255 { + let in1_332: string; + export { in1_332 as in1 }; + let in2_332: string; + export { in2_332 as in2 }; + } + export { inputs_1255 as inputs }; + export namespace outputs_1255 { + let out_1225: string; + export { out_1225 as out }; + } + export { outputs_1255 as outputs }; + } + export { ND_min_vector4FA_1 as ND_min_vector4FA }; + export namespace ND_max_float_1 { + let node_1256: string; + export { node_1256 as node }; + export namespace inputs_1256 { + let in1_333: string; + export { in1_333 as in1 }; + let in2_333: string; + export { in2_333 as in2 }; + } + export { inputs_1256 as inputs }; + export namespace outputs_1256 { + let out_1226: string; + export { out_1226 as out }; + } + export { outputs_1256 as outputs }; + } + export { ND_max_float_1 as ND_max_float }; + export namespace ND_max_color3_1 { + let node_1257: string; + export { node_1257 as node }; + export namespace inputs_1257 { + let in1_334: string; + export { in1_334 as in1 }; + let in2_334: string; + export { in2_334 as in2 }; + } + export { inputs_1257 as inputs }; + export namespace outputs_1257 { + let out_1227: string; + export { out_1227 as out }; + } + export { outputs_1257 as outputs }; + } + export { ND_max_color3_1 as ND_max_color3 }; + export namespace ND_max_color4_1 { + let node_1258: string; + export { node_1258 as node }; + export namespace inputs_1258 { + let in1_335: string; + export { in1_335 as in1 }; + let in2_335: string; + export { in2_335 as in2 }; + } + export { inputs_1258 as inputs }; + export namespace outputs_1258 { + let out_1228: string; + export { out_1228 as out }; + } + export { outputs_1258 as outputs }; + } + export { ND_max_color4_1 as ND_max_color4 }; + export namespace ND_max_vector2_1 { + let node_1259: string; + export { node_1259 as node }; + export namespace inputs_1259 { + let in1_336: string; + export { in1_336 as in1 }; + let in2_336: string; + export { in2_336 as in2 }; + } + export { inputs_1259 as inputs }; + export namespace outputs_1259 { + let out_1229: string; + export { out_1229 as out }; + } + export { outputs_1259 as outputs }; + } + export { ND_max_vector2_1 as ND_max_vector2 }; + export namespace ND_max_vector3_1 { + let node_1260: string; + export { node_1260 as node }; + export namespace inputs_1260 { + let in1_337: string; + export { in1_337 as in1 }; + let in2_337: string; + export { in2_337 as in2 }; + } + export { inputs_1260 as inputs }; + export namespace outputs_1260 { + let out_1230: string; + export { out_1230 as out }; + } + export { outputs_1260 as outputs }; + } + export { ND_max_vector3_1 as ND_max_vector3 }; + export namespace ND_max_vector4_1 { + let node_1261: string; + export { node_1261 as node }; + export namespace inputs_1261 { + let in1_338: string; + export { in1_338 as in1 }; + let in2_338: string; + export { in2_338 as in2 }; + } + export { inputs_1261 as inputs }; + export namespace outputs_1261 { + let out_1231: string; + export { out_1231 as out }; + } + export { outputs_1261 as outputs }; + } + export { ND_max_vector4_1 as ND_max_vector4 }; + export namespace ND_max_color3FA_1 { + let node_1262: string; + export { node_1262 as node }; + export namespace inputs_1262 { + let in1_339: string; + export { in1_339 as in1 }; + let in2_339: string; + export { in2_339 as in2 }; + } + export { inputs_1262 as inputs }; + export namespace outputs_1262 { + let out_1232: string; + export { out_1232 as out }; + } + export { outputs_1262 as outputs }; + } + export { ND_max_color3FA_1 as ND_max_color3FA }; + export namespace ND_max_color4FA_1 { + let node_1263: string; + export { node_1263 as node }; + export namespace inputs_1263 { + let in1_340: string; + export { in1_340 as in1 }; + let in2_340: string; + export { in2_340 as in2 }; + } + export { inputs_1263 as inputs }; + export namespace outputs_1263 { + let out_1233: string; + export { out_1233 as out }; + } + export { outputs_1263 as outputs }; + } + export { ND_max_color4FA_1 as ND_max_color4FA }; + export namespace ND_max_vector2FA_1 { + let node_1264: string; + export { node_1264 as node }; + export namespace inputs_1264 { + let in1_341: string; + export { in1_341 as in1 }; + let in2_341: string; + export { in2_341 as in2 }; + } + export { inputs_1264 as inputs }; + export namespace outputs_1264 { + let out_1234: string; + export { out_1234 as out }; + } + export { outputs_1264 as outputs }; + } + export { ND_max_vector2FA_1 as ND_max_vector2FA }; + export namespace ND_max_vector3FA_1 { + let node_1265: string; + export { node_1265 as node }; + export namespace inputs_1265 { + let in1_342: string; + export { in1_342 as in1 }; + let in2_342: string; + export { in2_342 as in2 }; + } + export { inputs_1265 as inputs }; + export namespace outputs_1265 { + let out_1235: string; + export { out_1235 as out }; + } + export { outputs_1265 as outputs }; + } + export { ND_max_vector3FA_1 as ND_max_vector3FA }; + export namespace ND_max_vector4FA_1 { + let node_1266: string; + export { node_1266 as node }; + export namespace inputs_1266 { + let in1_343: string; + export { in1_343 as in1 }; + let in2_343: string; + export { in2_343 as in2 }; + } + export { inputs_1266 as inputs }; + export namespace outputs_1266 { + let out_1236: string; + export { out_1236 as out }; + } + export { outputs_1266 as outputs }; + } + export { ND_max_vector4FA_1 as ND_max_vector4FA }; + export namespace ND_normalize_vector2_1 { + let node_1267: string; + export { node_1267 as node }; + export namespace inputs_1267 { + let _in_409: string; + export { _in_409 as in }; + } + export { inputs_1267 as inputs }; + export namespace outputs_1267 { + let out_1237: string; + export { out_1237 as out }; + } + export { outputs_1267 as outputs }; + } + export { ND_normalize_vector2_1 as ND_normalize_vector2 }; + export namespace ND_normalize_vector3_1 { + let node_1268: string; + export { node_1268 as node }; + export namespace inputs_1268 { + let _in_410: string; + export { _in_410 as in }; + } + export { inputs_1268 as inputs }; + export namespace outputs_1268 { + let out_1238: string; + export { out_1238 as out }; + } + export { outputs_1268 as outputs }; + } + export { ND_normalize_vector3_1 as ND_normalize_vector3 }; + export namespace ND_normalize_vector4_1 { + let node_1269: string; + export { node_1269 as node }; + export namespace inputs_1269 { + let _in_411: string; + export { _in_411 as in }; + } + export { inputs_1269 as inputs }; + export namespace outputs_1269 { + let out_1239: string; + export { out_1239 as out }; + } + export { outputs_1269 as outputs }; + } + export { ND_normalize_vector4_1 as ND_normalize_vector4 }; + export namespace ND_magnitude_vector2_1 { + let node_1270: string; + export { node_1270 as node }; + export namespace inputs_1270 { + let _in_412: string; + export { _in_412 as in }; + } + export { inputs_1270 as inputs }; + export namespace outputs_1270 { + let out_1240: string; + export { out_1240 as out }; + } + export { outputs_1270 as outputs }; + } + export { ND_magnitude_vector2_1 as ND_magnitude_vector2 }; + export namespace ND_magnitude_vector3_1 { + let node_1271: string; + export { node_1271 as node }; + export namespace inputs_1271 { + let _in_413: string; + export { _in_413 as in }; + } + export { inputs_1271 as inputs }; + export namespace outputs_1271 { + let out_1241: string; + export { out_1241 as out }; + } + export { outputs_1271 as outputs }; + } + export { ND_magnitude_vector3_1 as ND_magnitude_vector3 }; + export namespace ND_magnitude_vector4_1 { + let node_1272: string; + export { node_1272 as node }; + export namespace inputs_1272 { + let _in_414: string; + export { _in_414 as in }; + } + export { inputs_1272 as inputs }; + export namespace outputs_1272 { + let out_1242: string; + export { out_1242 as out }; + } + export { outputs_1272 as outputs }; + } + export { ND_magnitude_vector4_1 as ND_magnitude_vector4 }; + export namespace ND_distance_vector2_1 { + let node_1273: string; + export { node_1273 as node }; + export namespace inputs_1273 { + let in1_344: string; + export { in1_344 as in1 }; + let in2_344: string; + export { in2_344 as in2 }; + } + export { inputs_1273 as inputs }; + export namespace outputs_1273 { + let out_1243: string; + export { out_1243 as out }; + } + export { outputs_1273 as outputs }; + } + export { ND_distance_vector2_1 as ND_distance_vector2 }; + export namespace ND_distance_vector3_1 { + let node_1274: string; + export { node_1274 as node }; + export namespace inputs_1274 { + let in1_345: string; + export { in1_345 as in1 }; + let in2_345: string; + export { in2_345 as in2 }; + } + export { inputs_1274 as inputs }; + export namespace outputs_1274 { + let out_1244: string; + export { out_1244 as out }; + } + export { outputs_1274 as outputs }; + } + export { ND_distance_vector3_1 as ND_distance_vector3 }; + export namespace ND_distance_vector4_1 { + let node_1275: string; + export { node_1275 as node }; + export namespace inputs_1275 { + let in1_346: string; + export { in1_346 as in1 }; + let in2_346: string; + export { in2_346 as in2 }; + } + export { inputs_1275 as inputs }; + export namespace outputs_1275 { + let out_1245: string; + export { out_1245 as out }; + } + export { outputs_1275 as outputs }; + } + export { ND_distance_vector4_1 as ND_distance_vector4 }; + export namespace ND_dotproduct_vector2_1 { + let node_1276: string; + export { node_1276 as node }; + export namespace inputs_1276 { + let in1_347: string; + export { in1_347 as in1 }; + let in2_347: string; + export { in2_347 as in2 }; + } + export { inputs_1276 as inputs }; + export namespace outputs_1276 { + let out_1246: string; + export { out_1246 as out }; + } + export { outputs_1276 as outputs }; + } + export { ND_dotproduct_vector2_1 as ND_dotproduct_vector2 }; + export namespace ND_dotproduct_vector3_1 { + let node_1277: string; + export { node_1277 as node }; + export namespace inputs_1277 { + let in1_348: string; + export { in1_348 as in1 }; + let in2_348: string; + export { in2_348 as in2 }; + } + export { inputs_1277 as inputs }; + export namespace outputs_1277 { + let out_1247: string; + export { out_1247 as out }; + } + export { outputs_1277 as outputs }; + } + export { ND_dotproduct_vector3_1 as ND_dotproduct_vector3 }; + export namespace ND_dotproduct_vector4_1 { + let node_1278: string; + export { node_1278 as node }; + export namespace inputs_1278 { + let in1_349: string; + export { in1_349 as in1 }; + let in2_349: string; + export { in2_349 as in2 }; + } + export { inputs_1278 as inputs }; + export namespace outputs_1278 { + let out_1248: string; + export { out_1248 as out }; + } + export { outputs_1278 as outputs }; + } + export { ND_dotproduct_vector4_1 as ND_dotproduct_vector4 }; + export namespace ND_crossproduct_vector3_1 { + let node_1279: string; + export { node_1279 as node }; + export namespace inputs_1279 { + let in1_350: string; + export { in1_350 as in1 }; + let in2_350: string; + export { in2_350 as in2 }; + } + export { inputs_1279 as inputs }; + export namespace outputs_1279 { + let out_1249: string; + export { out_1249 as out }; + } + export { outputs_1279 as outputs }; + } + export { ND_crossproduct_vector3_1 as ND_crossproduct_vector3 }; + export namespace ND_transformpoint_vector3_1 { + let node_1280: string; + export { node_1280 as node }; + export namespace inputs_1280 { + let _in_415: string; + export { _in_415 as in }; + let fromspace_3: string; + export { fromspace_3 as fromspace }; + let tospace_3: string; + export { tospace_3 as tospace }; + } + export { inputs_1280 as inputs }; + export namespace outputs_1280 { + let out_1250: string; + export { out_1250 as out }; + } + export { outputs_1280 as outputs }; + } + export { ND_transformpoint_vector3_1 as ND_transformpoint_vector3 }; + export namespace ND_transformvector_vector3_1 { + let node_1281: string; + export { node_1281 as node }; + export namespace inputs_1281 { + let _in_416: string; + export { _in_416 as in }; + let fromspace_4: string; + export { fromspace_4 as fromspace }; + let tospace_4: string; + export { tospace_4 as tospace }; + } + export { inputs_1281 as inputs }; + export namespace outputs_1281 { + let out_1251: string; + export { out_1251 as out }; + } + export { outputs_1281 as outputs }; + } + export { ND_transformvector_vector3_1 as ND_transformvector_vector3 }; + export namespace ND_transformnormal_vector3_1 { + let node_1282: string; + export { node_1282 as node }; + export namespace inputs_1282 { + let _in_417: string; + export { _in_417 as in }; + let fromspace_5: string; + export { fromspace_5 as fromspace }; + let tospace_5: string; + export { tospace_5 as tospace }; + } + export { inputs_1282 as inputs }; + export namespace outputs_1282 { + let out_1252: string; + export { out_1252 as out }; + } + export { outputs_1282 as outputs }; + } + export { ND_transformnormal_vector3_1 as ND_transformnormal_vector3 }; + export namespace ND_transformmatrix_vector2M3_1 { + let node_1283: string; + export { node_1283 as node }; + export namespace inputs_1283 { + let _in_418: string; + export { _in_418 as in }; + let mat_4: string; + export { mat_4 as mat }; + } + export { inputs_1283 as inputs }; + export namespace outputs_1283 { + let out_1253: string; + export { out_1253 as out }; + } + export { outputs_1283 as outputs }; + } + export { ND_transformmatrix_vector2M3_1 as ND_transformmatrix_vector2M3 }; + export namespace ND_transformmatrix_vector3_1 { + let node_1284: string; + export { node_1284 as node }; + export namespace inputs_1284 { + let _in_419: string; + export { _in_419 as in }; + let mat_5: string; + export { mat_5 as mat }; + } + export { inputs_1284 as inputs }; + export namespace outputs_1284 { + let out_1254: string; + export { out_1254 as out }; + } + export { outputs_1284 as outputs }; + } + export { ND_transformmatrix_vector3_1 as ND_transformmatrix_vector3 }; + export namespace ND_transformmatrix_vector3M4_1 { + let node_1285: string; + export { node_1285 as node }; + export namespace inputs_1285 { + let _in_420: string; + export { _in_420 as in }; + let mat_6: string; + export { mat_6 as mat }; + } + export { inputs_1285 as inputs }; + export namespace outputs_1285 { + let out_1255: string; + export { out_1255 as out }; + } + export { outputs_1285 as outputs }; + } + export { ND_transformmatrix_vector3M4_1 as ND_transformmatrix_vector3M4 }; + export namespace ND_transformmatrix_vector4_1 { + let node_1286: string; + export { node_1286 as node }; + export namespace inputs_1286 { + let _in_421: string; + export { _in_421 as in }; + let mat_7: string; + export { mat_7 as mat }; + } + export { inputs_1286 as inputs }; + export namespace outputs_1286 { + let out_1256: string; + export { out_1256 as out }; + } + export { outputs_1286 as outputs }; + } + export { ND_transformmatrix_vector4_1 as ND_transformmatrix_vector4 }; + export namespace ND_normalmap_float_1 { + let node_1287: string; + export { node_1287 as node }; + export namespace inputs_1287 { + let _in_422: string; + export { _in_422 as in }; + let scale_36: string; + export { scale_36 as scale }; + let normal_63: string; + export { normal_63 as normal }; + let tangent_21: string; + export { tangent_21 as tangent }; + let bitangent_9: string; + export { bitangent_9 as bitangent }; + } + export { inputs_1287 as inputs }; + export namespace outputs_1287 { + let out_1257: string; + export { out_1257 as out }; + } + export { outputs_1287 as outputs }; + } + export { ND_normalmap_float_1 as ND_normalmap_float }; + export namespace ND_normalmap_vector2_1 { + let node_1288: string; + export { node_1288 as node }; + export namespace inputs_1288 { + let _in_423: string; + export { _in_423 as in }; + let scale_37: string; + export { scale_37 as scale }; + let normal_64: string; + export { normal_64 as normal }; + let tangent_22: string; + export { tangent_22 as tangent }; + let bitangent_10: string; + export { bitangent_10 as bitangent }; + } + export { inputs_1288 as inputs }; + export namespace outputs_1288 { + let out_1258: string; + export { out_1258 as out }; + } + export { outputs_1288 as outputs }; + } + export { ND_normalmap_vector2_1 as ND_normalmap_vector2 }; + export namespace ND_hextilednormalmap_vector3_1 { + let node_1289: string; + export { node_1289 as node }; + export namespace inputs_1289 { + let file_52: string; + export { file_52 as file }; + let _default_79: string; + export { _default_79 as default }; + let texcoord_185: string; + export { texcoord_185 as texcoord }; + let tiling_5: string; + export { tiling_5 as tiling }; + let rotation_10: string; + export { rotation_10 as rotation }; + let rotationrange_5: string; + export { rotationrange_5 as rotationrange }; + let scale_38: string; + export { scale_38 as scale }; + let scalerange_5: string; + export { scalerange_5 as scalerange }; + let offset_26: string; + export { offset_26 as offset }; + let offsetrange_5: string; + export { offsetrange_5 as offsetrange }; + let falloff_5: string; + export { falloff_5 as falloff }; + let strength_1: string; + export { strength_1 as strength }; + let flip_g_1: string; + export { flip_g_1 as flip_g }; + let normal_65: string; + export { normal_65 as normal }; + let tangent_23: string; + export { tangent_23 as tangent }; + let bitangent_11: string; + export { bitangent_11 as bitangent }; + } + export { inputs_1289 as inputs }; + export namespace outputs_1289 { + let out_1259: string; + export { out_1259 as out }; + } + export { outputs_1289 as outputs }; + } + export { ND_hextilednormalmap_vector3_1 as ND_hextilednormalmap_vector3 }; + export namespace ND_transpose_matrix33_1 { + let node_1290: string; + export { node_1290 as node }; + export namespace inputs_1290 { + let _in_424: string; + export { _in_424 as in }; + } + export { inputs_1290 as inputs }; + export namespace outputs_1290 { + let out_1260: string; + export { out_1260 as out }; + } + export { outputs_1290 as outputs }; + } + export { ND_transpose_matrix33_1 as ND_transpose_matrix33 }; + export namespace ND_transpose_matrix44_1 { + let node_1291: string; + export { node_1291 as node }; + export namespace inputs_1291 { + let _in_425: string; + export { _in_425 as in }; + } + export { inputs_1291 as inputs }; + export namespace outputs_1291 { + let out_1261: string; + export { out_1261 as out }; + } + export { outputs_1291 as outputs }; + } + export { ND_transpose_matrix44_1 as ND_transpose_matrix44 }; + export namespace ND_determinant_matrix33_1 { + let node_1292: string; + export { node_1292 as node }; + export namespace inputs_1292 { + let _in_426: string; + export { _in_426 as in }; + } + export { inputs_1292 as inputs }; + export namespace outputs_1292 { + let out_1262: string; + export { out_1262 as out }; + } + export { outputs_1292 as outputs }; + } + export { ND_determinant_matrix33_1 as ND_determinant_matrix33 }; + export namespace ND_determinant_matrix44_1 { + let node_1293: string; + export { node_1293 as node }; + export namespace inputs_1293 { + let _in_427: string; + export { _in_427 as in }; + } + export { inputs_1293 as inputs }; + export namespace outputs_1293 { + let out_1263: string; + export { out_1263 as out }; + } + export { outputs_1293 as outputs }; + } + export { ND_determinant_matrix44_1 as ND_determinant_matrix44 }; + export namespace ND_invertmatrix_matrix33_1 { + let node_1294: string; + export { node_1294 as node }; + export namespace inputs_1294 { + let _in_428: string; + export { _in_428 as in }; + } + export { inputs_1294 as inputs }; + export namespace outputs_1294 { + let out_1264: string; + export { out_1264 as out }; + } + export { outputs_1294 as outputs }; + } + export { ND_invertmatrix_matrix33_1 as ND_invertmatrix_matrix33 }; + export namespace ND_invertmatrix_matrix44_1 { + let node_1295: string; + export { node_1295 as node }; + export namespace inputs_1295 { + let _in_429: string; + export { _in_429 as in }; + } + export { inputs_1295 as inputs }; + export namespace outputs_1295 { + let out_1265: string; + export { out_1265 as out }; + } + export { outputs_1295 as outputs }; + } + export { ND_invertmatrix_matrix44_1 as ND_invertmatrix_matrix44 }; + export namespace ND_rotate2d_vector2_1 { + let node_1296: string; + export { node_1296 as node }; + export namespace inputs_1296 { + let _in_430: string; + export { _in_430 as in }; + let amount_39: string; + export { amount_39 as amount }; + } + export { inputs_1296 as inputs }; + export namespace outputs_1296 { + let out_1266: string; + export { out_1266 as out }; + } + export { outputs_1296 as outputs }; + } + export { ND_rotate2d_vector2_1 as ND_rotate2d_vector2 }; + export namespace ND_rotate3d_vector3_1 { + let node_1297: string; + export { node_1297 as node }; + export namespace inputs_1297 { + let _in_431: string; + export { _in_431 as in }; + let amount_40: string; + export { amount_40 as amount }; + let axis_1: string; + export { axis_1 as axis }; + } + export { inputs_1297 as inputs }; + export namespace outputs_1297 { + let out_1267: string; + export { out_1267 as out }; + } + export { outputs_1297 as outputs }; + } + export { ND_rotate3d_vector3_1 as ND_rotate3d_vector3 }; + export namespace ND_place2d_vector2_1 { + let node_1298: string; + export { node_1298 as node }; + export namespace inputs_1298 { + let texcoord_186: string; + export { texcoord_186 as texcoord }; + let pivot_72: string; + export { pivot_72 as pivot }; + let scale_39: string; + export { scale_39 as scale }; + let rotate_17: string; + export { rotate_17 as rotate }; + let offset_27: string; + export { offset_27 as offset }; + let operationorder_15: string; + export { operationorder_15 as operationorder }; + } + export { inputs_1298 as inputs }; + export namespace outputs_1298 { + let out_1268: string; + export { out_1268 as out }; + } + export { outputs_1298 as outputs }; + } + export { ND_place2d_vector2_1 as ND_place2d_vector2 }; + export namespace ND_trianglewave_float_1 { + let node_1299: string; + export { node_1299 as node }; + export namespace inputs_1299 { + let _in_432: string; + export { _in_432 as in }; + } + export { inputs_1299 as inputs }; + export namespace outputs_1299 { + let out_1269: string; + export { out_1269 as out }; + } + export { outputs_1299 as outputs }; + } + export { ND_trianglewave_float_1 as ND_trianglewave_float }; + export namespace ND_reflect_vector3_1 { + let node_1300: string; + export { node_1300 as node }; + export namespace inputs_1300 { + let _in_433: string; + export { _in_433 as in }; + let normal_66: string; + export { normal_66 as normal }; + } + export { inputs_1300 as inputs }; + export namespace outputs_1300 { + let out_1270: string; + export { out_1270 as out }; + } + export { outputs_1300 as outputs }; + } + export { ND_reflect_vector3_1 as ND_reflect_vector3 }; + export namespace ND_refract_vector3_1 { + let node_1301: string; + export { node_1301 as node }; + export namespace inputs_1301 { + let _in_434: string; + export { _in_434 as in }; + let normal_67: string; + export { normal_67 as normal }; + let ior_15: string; + export { ior_15 as ior }; + } + export { inputs_1301 as inputs }; + export namespace outputs_1301 { + let out_1271: string; + export { out_1271 as out }; + } + export { outputs_1301 as outputs }; + } + export { ND_refract_vector3_1 as ND_refract_vector3 }; + export namespace ND_remap_float_1 { + let node_1302: string; + export { node_1302 as node }; + export namespace inputs_1302 { + let _in_435: string; + export { _in_435 as in }; + let inlow_22: string; + export { inlow_22 as inlow }; + let inhigh_22: string; + export { inhigh_22 as inhigh }; + let outlow_22: string; + export { outlow_22 as outlow }; + let outhigh_22: string; + export { outhigh_22 as outhigh }; + } + export { inputs_1302 as inputs }; + export namespace outputs_1302 { + let out_1272: string; + export { out_1272 as out }; + } + export { outputs_1302 as outputs }; + } + export { ND_remap_float_1 as ND_remap_float }; + export namespace ND_remap_color3_1 { + let node_1303: string; + export { node_1303 as node }; + export namespace inputs_1303 { + let _in_436: string; + export { _in_436 as in }; + let inlow_23: string; + export { inlow_23 as inlow }; + let inhigh_23: string; + export { inhigh_23 as inhigh }; + let outlow_23: string; + export { outlow_23 as outlow }; + let outhigh_23: string; + export { outhigh_23 as outhigh }; + } + export { inputs_1303 as inputs }; + export namespace outputs_1303 { + let out_1273: string; + export { out_1273 as out }; + } + export { outputs_1303 as outputs }; + } + export { ND_remap_color3_1 as ND_remap_color3 }; + export namespace ND_remap_color4_1 { + let node_1304: string; + export { node_1304 as node }; + export namespace inputs_1304 { + let _in_437: string; + export { _in_437 as in }; + let inlow_24: string; + export { inlow_24 as inlow }; + let inhigh_24: string; + export { inhigh_24 as inhigh }; + let outlow_24: string; + export { outlow_24 as outlow }; + let outhigh_24: string; + export { outhigh_24 as outhigh }; + } + export { inputs_1304 as inputs }; + export namespace outputs_1304 { + let out_1274: string; + export { out_1274 as out }; + } + export { outputs_1304 as outputs }; + } + export { ND_remap_color4_1 as ND_remap_color4 }; + export namespace ND_remap_vector2_1 { + let node_1305: string; + export { node_1305 as node }; + export namespace inputs_1305 { + let _in_438: string; + export { _in_438 as in }; + let inlow_25: string; + export { inlow_25 as inlow }; + let inhigh_25: string; + export { inhigh_25 as inhigh }; + let outlow_25: string; + export { outlow_25 as outlow }; + let outhigh_25: string; + export { outhigh_25 as outhigh }; + } + export { inputs_1305 as inputs }; + export namespace outputs_1305 { + let out_1275: string; + export { out_1275 as out }; + } + export { outputs_1305 as outputs }; + } + export { ND_remap_vector2_1 as ND_remap_vector2 }; + export namespace ND_remap_vector3_1 { + let node_1306: string; + export { node_1306 as node }; + export namespace inputs_1306 { + let _in_439: string; + export { _in_439 as in }; + let inlow_26: string; + export { inlow_26 as inlow }; + let inhigh_26: string; + export { inhigh_26 as inhigh }; + let outlow_26: string; + export { outlow_26 as outlow }; + let outhigh_26: string; + export { outhigh_26 as outhigh }; + } + export { inputs_1306 as inputs }; + export namespace outputs_1306 { + let out_1276: string; + export { out_1276 as out }; + } + export { outputs_1306 as outputs }; + } + export { ND_remap_vector3_1 as ND_remap_vector3 }; + export namespace ND_remap_vector4_1 { + let node_1307: string; + export { node_1307 as node }; + export namespace inputs_1307 { + let _in_440: string; + export { _in_440 as in }; + let inlow_27: string; + export { inlow_27 as inlow }; + let inhigh_27: string; + export { inhigh_27 as inhigh }; + let outlow_27: string; + export { outlow_27 as outlow }; + let outhigh_27: string; + export { outhigh_27 as outhigh }; + } + export { inputs_1307 as inputs }; + export namespace outputs_1307 { + let out_1277: string; + export { out_1277 as out }; + } + export { outputs_1307 as outputs }; + } + export { ND_remap_vector4_1 as ND_remap_vector4 }; + export namespace ND_remap_color3FA_1 { + let node_1308: string; + export { node_1308 as node }; + export namespace inputs_1308 { + let _in_441: string; + export { _in_441 as in }; + let inlow_28: string; + export { inlow_28 as inlow }; + let inhigh_28: string; + export { inhigh_28 as inhigh }; + let outlow_28: string; + export { outlow_28 as outlow }; + let outhigh_28: string; + export { outhigh_28 as outhigh }; + } + export { inputs_1308 as inputs }; + export namespace outputs_1308 { + let out_1278: string; + export { out_1278 as out }; + } + export { outputs_1308 as outputs }; + } + export { ND_remap_color3FA_1 as ND_remap_color3FA }; + export namespace ND_remap_color4FA_1 { + let node_1309: string; + export { node_1309 as node }; + export namespace inputs_1309 { + let _in_442: string; + export { _in_442 as in }; + let inlow_29: string; + export { inlow_29 as inlow }; + let inhigh_29: string; + export { inhigh_29 as inhigh }; + let outlow_29: string; + export { outlow_29 as outlow }; + let outhigh_29: string; + export { outhigh_29 as outhigh }; + } + export { inputs_1309 as inputs }; + export namespace outputs_1309 { + let out_1279: string; + export { out_1279 as out }; + } + export { outputs_1309 as outputs }; + } + export { ND_remap_color4FA_1 as ND_remap_color4FA }; + export namespace ND_remap_vector2FA_1 { + let node_1310: string; + export { node_1310 as node }; + export namespace inputs_1310 { + let _in_443: string; + export { _in_443 as in }; + let inlow_30: string; + export { inlow_30 as inlow }; + let inhigh_30: string; + export { inhigh_30 as inhigh }; + let outlow_30: string; + export { outlow_30 as outlow }; + let outhigh_30: string; + export { outhigh_30 as outhigh }; + } + export { inputs_1310 as inputs }; + export namespace outputs_1310 { + let out_1280: string; + export { out_1280 as out }; + } + export { outputs_1310 as outputs }; + } + export { ND_remap_vector2FA_1 as ND_remap_vector2FA }; + export namespace ND_remap_vector3FA_1 { + let node_1311: string; + export { node_1311 as node }; + export namespace inputs_1311 { + let _in_444: string; + export { _in_444 as in }; + let inlow_31: string; + export { inlow_31 as inlow }; + let inhigh_31: string; + export { inhigh_31 as inhigh }; + let outlow_31: string; + export { outlow_31 as outlow }; + let outhigh_31: string; + export { outhigh_31 as outhigh }; + } + export { inputs_1311 as inputs }; + export namespace outputs_1311 { + let out_1281: string; + export { out_1281 as out }; + } + export { outputs_1311 as outputs }; + } + export { ND_remap_vector3FA_1 as ND_remap_vector3FA }; + export namespace ND_remap_vector4FA_1 { + let node_1312: string; + export { node_1312 as node }; + export namespace inputs_1312 { + let _in_445: string; + export { _in_445 as in }; + let inlow_32: string; + export { inlow_32 as inlow }; + let inhigh_32: string; + export { inhigh_32 as inhigh }; + let outlow_32: string; + export { outlow_32 as outlow }; + let outhigh_32: string; + export { outhigh_32 as outhigh }; + } + export { inputs_1312 as inputs }; + export namespace outputs_1312 { + let out_1282: string; + export { out_1282 as out }; + } + export { outputs_1312 as outputs }; + } + export { ND_remap_vector4FA_1 as ND_remap_vector4FA }; + export namespace ND_smoothstep_float_1 { + let node_1313: string; + export { node_1313 as node }; + export namespace inputs_1313 { + let _in_446: string; + export { _in_446 as in }; + let low_33: string; + export { low_33 as low }; + let high_33: string; + export { high_33 as high }; + } + export { inputs_1313 as inputs }; + export namespace outputs_1313 { + let out_1283: string; + export { out_1283 as out }; + } + export { outputs_1313 as outputs }; + } + export { ND_smoothstep_float_1 as ND_smoothstep_float }; + export namespace ND_smoothstep_color3_1 { + let node_1314: string; + export { node_1314 as node }; + export namespace inputs_1314 { + let _in_447: string; + export { _in_447 as in }; + let low_34: string; + export { low_34 as low }; + let high_34: string; + export { high_34 as high }; + } + export { inputs_1314 as inputs }; + export namespace outputs_1314 { + let out_1284: string; + export { out_1284 as out }; + } + export { outputs_1314 as outputs }; + } + export { ND_smoothstep_color3_1 as ND_smoothstep_color3 }; + export namespace ND_smoothstep_color4_1 { + let node_1315: string; + export { node_1315 as node }; + export namespace inputs_1315 { + let _in_448: string; + export { _in_448 as in }; + let low_35: string; + export { low_35 as low }; + let high_35: string; + export { high_35 as high }; + } + export { inputs_1315 as inputs }; + export namespace outputs_1315 { + let out_1285: string; + export { out_1285 as out }; + } + export { outputs_1315 as outputs }; + } + export { ND_smoothstep_color4_1 as ND_smoothstep_color4 }; + export namespace ND_smoothstep_vector2_1 { + let node_1316: string; + export { node_1316 as node }; + export namespace inputs_1316 { + let _in_449: string; + export { _in_449 as in }; + let low_36: string; + export { low_36 as low }; + let high_36: string; + export { high_36 as high }; + } + export { inputs_1316 as inputs }; + export namespace outputs_1316 { + let out_1286: string; + export { out_1286 as out }; + } + export { outputs_1316 as outputs }; + } + export { ND_smoothstep_vector2_1 as ND_smoothstep_vector2 }; + export namespace ND_smoothstep_vector3_1 { + let node_1317: string; + export { node_1317 as node }; + export namespace inputs_1317 { + let _in_450: string; + export { _in_450 as in }; + let low_37: string; + export { low_37 as low }; + let high_37: string; + export { high_37 as high }; + } + export { inputs_1317 as inputs }; + export namespace outputs_1317 { + let out_1287: string; + export { out_1287 as out }; + } + export { outputs_1317 as outputs }; + } + export { ND_smoothstep_vector3_1 as ND_smoothstep_vector3 }; + export namespace ND_smoothstep_vector4_1 { + let node_1318: string; + export { node_1318 as node }; + export namespace inputs_1318 { + let _in_451: string; + export { _in_451 as in }; + let low_38: string; + export { low_38 as low }; + let high_38: string; + export { high_38 as high }; + } + export { inputs_1318 as inputs }; + export namespace outputs_1318 { + let out_1288: string; + export { out_1288 as out }; + } + export { outputs_1318 as outputs }; + } + export { ND_smoothstep_vector4_1 as ND_smoothstep_vector4 }; + export namespace ND_smoothstep_color3FA_1 { + let node_1319: string; + export { node_1319 as node }; + export namespace inputs_1319 { + let _in_452: string; + export { _in_452 as in }; + let low_39: string; + export { low_39 as low }; + let high_39: string; + export { high_39 as high }; + } + export { inputs_1319 as inputs }; + export namespace outputs_1319 { + let out_1289: string; + export { out_1289 as out }; + } + export { outputs_1319 as outputs }; + } + export { ND_smoothstep_color3FA_1 as ND_smoothstep_color3FA }; + export namespace ND_smoothstep_color4FA_1 { + let node_1320: string; + export { node_1320 as node }; + export namespace inputs_1320 { + let _in_453: string; + export { _in_453 as in }; + let low_40: string; + export { low_40 as low }; + let high_40: string; + export { high_40 as high }; + } + export { inputs_1320 as inputs }; + export namespace outputs_1320 { + let out_1290: string; + export { out_1290 as out }; + } + export { outputs_1320 as outputs }; + } + export { ND_smoothstep_color4FA_1 as ND_smoothstep_color4FA }; + export namespace ND_smoothstep_vector2FA_1 { + let node_1321: string; + export { node_1321 as node }; + export namespace inputs_1321 { + let _in_454: string; + export { _in_454 as in }; + let low_41: string; + export { low_41 as low }; + let high_41: string; + export { high_41 as high }; + } + export { inputs_1321 as inputs }; + export namespace outputs_1321 { + let out_1291: string; + export { out_1291 as out }; + } + export { outputs_1321 as outputs }; + } + export { ND_smoothstep_vector2FA_1 as ND_smoothstep_vector2FA }; + export namespace ND_smoothstep_vector3FA_1 { + let node_1322: string; + export { node_1322 as node }; + export namespace inputs_1322 { + let _in_455: string; + export { _in_455 as in }; + let low_42: string; + export { low_42 as low }; + let high_42: string; + export { high_42 as high }; + } + export { inputs_1322 as inputs }; + export namespace outputs_1322 { + let out_1292: string; + export { out_1292 as out }; + } + export { outputs_1322 as outputs }; + } + export { ND_smoothstep_vector3FA_1 as ND_smoothstep_vector3FA }; + export namespace ND_smoothstep_vector4FA_1 { + let node_1323: string; + export { node_1323 as node }; + export namespace inputs_1323 { + let _in_456: string; + export { _in_456 as in }; + let low_43: string; + export { low_43 as low }; + let high_43: string; + export { high_43 as high }; + } + export { inputs_1323 as inputs }; + export namespace outputs_1323 { + let out_1293: string; + export { out_1293 as out }; + } + export { outputs_1323 as outputs }; + } + export { ND_smoothstep_vector4FA_1 as ND_smoothstep_vector4FA }; + export namespace ND_luminance_color3_1 { + let node_1324: string; + export { node_1324 as node }; + export namespace inputs_1324 { + let _in_457: string; + export { _in_457 as in }; + let lumacoeffs_8: string; + export { lumacoeffs_8 as lumacoeffs }; + } + export { inputs_1324 as inputs }; + export namespace outputs_1324 { + let out_1294: string; + export { out_1294 as out }; + } + export { outputs_1324 as outputs }; + } + export { ND_luminance_color3_1 as ND_luminance_color3 }; + export namespace ND_luminance_color4_1 { + let node_1325: string; + export { node_1325 as node }; + export namespace inputs_1325 { + let _in_458: string; + export { _in_458 as in }; + let lumacoeffs_9: string; + export { lumacoeffs_9 as lumacoeffs }; + } + export { inputs_1325 as inputs }; + export namespace outputs_1325 { + let out_1295: string; + export { out_1295 as out }; + } + export { outputs_1325 as outputs }; + } + export { ND_luminance_color4_1 as ND_luminance_color4 }; + export namespace ND_rgbtohsv_color3_1 { + let node_1326: string; + export { node_1326 as node }; + export namespace inputs_1326 { + let _in_459: string; + export { _in_459 as in }; + } + export { inputs_1326 as inputs }; + export namespace outputs_1326 { + let out_1296: string; + export { out_1296 as out }; + } + export { outputs_1326 as outputs }; + } + export { ND_rgbtohsv_color3_1 as ND_rgbtohsv_color3 }; + export namespace ND_rgbtohsv_color4_1 { + let node_1327: string; + export { node_1327 as node }; + export namespace inputs_1327 { + let _in_460: string; + export { _in_460 as in }; + } + export { inputs_1327 as inputs }; + export namespace outputs_1327 { + let out_1297: string; + export { out_1297 as out }; + } + export { outputs_1327 as outputs }; + } + export { ND_rgbtohsv_color4_1 as ND_rgbtohsv_color4 }; + export namespace ND_hsvtorgb_color3_1 { + let node_1328: string; + export { node_1328 as node }; + export namespace inputs_1328 { + let _in_461: string; + export { _in_461 as in }; + } + export { inputs_1328 as inputs }; + export namespace outputs_1328 { + let out_1298: string; + export { out_1298 as out }; + } + export { outputs_1328 as outputs }; + } + export { ND_hsvtorgb_color3_1 as ND_hsvtorgb_color3 }; + export namespace ND_hsvtorgb_color4_1 { + let node_1329: string; + export { node_1329 as node }; + export namespace inputs_1329 { + let _in_462: string; + export { _in_462 as in }; + } + export { inputs_1329 as inputs }; + export namespace outputs_1329 { + let out_1299: string; + export { out_1299 as out }; + } + export { outputs_1329 as outputs }; + } + export { ND_hsvtorgb_color4_1 as ND_hsvtorgb_color4 }; + export namespace ND_contrast_float_1 { + let node_1330: string; + export { node_1330 as node }; + export namespace inputs_1330 { + let _in_463: string; + export { _in_463 as in }; + let amount_41: string; + export { amount_41 as amount }; + let pivot_73: string; + export { pivot_73 as pivot }; + } + export { inputs_1330 as inputs }; + export namespace outputs_1330 { + let out_1300: string; + export { out_1300 as out }; + } + export { outputs_1330 as outputs }; + } + export { ND_contrast_float_1 as ND_contrast_float }; + export namespace ND_contrast_color3_1 { + let node_1331: string; + export { node_1331 as node }; + export namespace inputs_1331 { + let _in_464: string; + export { _in_464 as in }; + let amount_42: string; + export { amount_42 as amount }; + let pivot_74: string; + export { pivot_74 as pivot }; + } + export { inputs_1331 as inputs }; + export namespace outputs_1331 { + let out_1301: string; + export { out_1301 as out }; + } + export { outputs_1331 as outputs }; + } + export { ND_contrast_color3_1 as ND_contrast_color3 }; + export namespace ND_contrast_color4_1 { + let node_1332: string; + export { node_1332 as node }; + export namespace inputs_1332 { + let _in_465: string; + export { _in_465 as in }; + let amount_43: string; + export { amount_43 as amount }; + let pivot_75: string; + export { pivot_75 as pivot }; + } + export { inputs_1332 as inputs }; + export namespace outputs_1332 { + let out_1302: string; + export { out_1302 as out }; + } + export { outputs_1332 as outputs }; + } + export { ND_contrast_color4_1 as ND_contrast_color4 }; + export namespace ND_contrast_vector2_1 { + let node_1333: string; + export { node_1333 as node }; + export namespace inputs_1333 { + let _in_466: string; + export { _in_466 as in }; + let amount_44: string; + export { amount_44 as amount }; + let pivot_76: string; + export { pivot_76 as pivot }; + } + export { inputs_1333 as inputs }; + export namespace outputs_1333 { + let out_1303: string; + export { out_1303 as out }; + } + export { outputs_1333 as outputs }; + } + export { ND_contrast_vector2_1 as ND_contrast_vector2 }; + export namespace ND_contrast_vector3_1 { + let node_1334: string; + export { node_1334 as node }; + export namespace inputs_1334 { + let _in_467: string; + export { _in_467 as in }; + let amount_45: string; + export { amount_45 as amount }; + let pivot_77: string; + export { pivot_77 as pivot }; + } + export { inputs_1334 as inputs }; + export namespace outputs_1334 { + let out_1304: string; + export { out_1304 as out }; + } + export { outputs_1334 as outputs }; + } + export { ND_contrast_vector3_1 as ND_contrast_vector3 }; + export namespace ND_contrast_vector4_1 { + let node_1335: string; + export { node_1335 as node }; + export namespace inputs_1335 { + let _in_468: string; + export { _in_468 as in }; + let amount_46: string; + export { amount_46 as amount }; + let pivot_78: string; + export { pivot_78 as pivot }; + } + export { inputs_1335 as inputs }; + export namespace outputs_1335 { + let out_1305: string; + export { out_1305 as out }; + } + export { outputs_1335 as outputs }; + } + export { ND_contrast_vector4_1 as ND_contrast_vector4 }; + export namespace ND_contrast_color3FA_1 { + let node_1336: string; + export { node_1336 as node }; + export namespace inputs_1336 { + let _in_469: string; + export { _in_469 as in }; + let amount_47: string; + export { amount_47 as amount }; + let pivot_79: string; + export { pivot_79 as pivot }; + } + export { inputs_1336 as inputs }; + export namespace outputs_1336 { + let out_1306: string; + export { out_1306 as out }; + } + export { outputs_1336 as outputs }; + } + export { ND_contrast_color3FA_1 as ND_contrast_color3FA }; + export namespace ND_contrast_color4FA_1 { + let node_1337: string; + export { node_1337 as node }; + export namespace inputs_1337 { + let _in_470: string; + export { _in_470 as in }; + let amount_48: string; + export { amount_48 as amount }; + let pivot_80: string; + export { pivot_80 as pivot }; + } + export { inputs_1337 as inputs }; + export namespace outputs_1337 { + let out_1307: string; + export { out_1307 as out }; + } + export { outputs_1337 as outputs }; + } + export { ND_contrast_color4FA_1 as ND_contrast_color4FA }; + export namespace ND_contrast_vector2FA_1 { + let node_1338: string; + export { node_1338 as node }; + export namespace inputs_1338 { + let _in_471: string; + export { _in_471 as in }; + let amount_49: string; + export { amount_49 as amount }; + let pivot_81: string; + export { pivot_81 as pivot }; + } + export { inputs_1338 as inputs }; + export namespace outputs_1338 { + let out_1308: string; + export { out_1308 as out }; + } + export { outputs_1338 as outputs }; + } + export { ND_contrast_vector2FA_1 as ND_contrast_vector2FA }; + export namespace ND_contrast_vector3FA_1 { + let node_1339: string; + export { node_1339 as node }; + export namespace inputs_1339 { + let _in_472: string; + export { _in_472 as in }; + let amount_50: string; + export { amount_50 as amount }; + let pivot_82: string; + export { pivot_82 as pivot }; + } + export { inputs_1339 as inputs }; + export namespace outputs_1339 { + let out_1309: string; + export { out_1309 as out }; + } + export { outputs_1339 as outputs }; + } + export { ND_contrast_vector3FA_1 as ND_contrast_vector3FA }; + export namespace ND_contrast_vector4FA_1 { + let node_1340: string; + export { node_1340 as node }; + export namespace inputs_1340 { + let _in_473: string; + export { _in_473 as in }; + let amount_51: string; + export { amount_51 as amount }; + let pivot_83: string; + export { pivot_83 as pivot }; + } + export { inputs_1340 as inputs }; + export namespace outputs_1340 { + let out_1310: string; + export { out_1310 as out }; + } + export { outputs_1340 as outputs }; + } + export { ND_contrast_vector4FA_1 as ND_contrast_vector4FA }; + export namespace ND_range_float_1 { + let node_1341: string; + export { node_1341 as node }; + export namespace inputs_1341 { + let _in_474: string; + export { _in_474 as in }; + let inlow_33: string; + export { inlow_33 as inlow }; + let inhigh_33: string; + export { inhigh_33 as inhigh }; + let gamma_13: string; + export { gamma_13 as gamma }; + let outlow_33: string; + export { outlow_33 as outlow }; + let outhigh_33: string; + export { outhigh_33 as outhigh }; + let doclamp_11: string; + export { doclamp_11 as doclamp }; + } + export { inputs_1341 as inputs }; + export namespace outputs_1341 { + let out_1311: string; + export { out_1311 as out }; + } + export { outputs_1341 as outputs }; + } + export { ND_range_float_1 as ND_range_float }; + export namespace ND_range_color3_1 { + let node_1342: string; + export { node_1342 as node }; + export namespace inputs_1342 { + let _in_475: string; + export { _in_475 as in }; + let inlow_34: string; + export { inlow_34 as inlow }; + let inhigh_34: string; + export { inhigh_34 as inhigh }; + let gamma_14: string; + export { gamma_14 as gamma }; + let outlow_34: string; + export { outlow_34 as outlow }; + let outhigh_34: string; + export { outhigh_34 as outhigh }; + let doclamp_12: string; + export { doclamp_12 as doclamp }; + } + export { inputs_1342 as inputs }; + export namespace outputs_1342 { + let out_1312: string; + export { out_1312 as out }; + } + export { outputs_1342 as outputs }; + } + export { ND_range_color3_1 as ND_range_color3 }; + export namespace ND_range_color4_1 { + let node_1343: string; + export { node_1343 as node }; + export namespace inputs_1343 { + let _in_476: string; + export { _in_476 as in }; + let inlow_35: string; + export { inlow_35 as inlow }; + let inhigh_35: string; + export { inhigh_35 as inhigh }; + let gamma_15: string; + export { gamma_15 as gamma }; + let outlow_35: string; + export { outlow_35 as outlow }; + let outhigh_35: string; + export { outhigh_35 as outhigh }; + let doclamp_13: string; + export { doclamp_13 as doclamp }; + } + export { inputs_1343 as inputs }; + export namespace outputs_1343 { + let out_1313: string; + export { out_1313 as out }; + } + export { outputs_1343 as outputs }; + } + export { ND_range_color4_1 as ND_range_color4 }; + export namespace ND_range_vector2_1 { + let node_1344: string; + export { node_1344 as node }; + export namespace inputs_1344 { + let _in_477: string; + export { _in_477 as in }; + let inlow_36: string; + export { inlow_36 as inlow }; + let inhigh_36: string; + export { inhigh_36 as inhigh }; + let gamma_16: string; + export { gamma_16 as gamma }; + let outlow_36: string; + export { outlow_36 as outlow }; + let outhigh_36: string; + export { outhigh_36 as outhigh }; + let doclamp_14: string; + export { doclamp_14 as doclamp }; + } + export { inputs_1344 as inputs }; + export namespace outputs_1344 { + let out_1314: string; + export { out_1314 as out }; + } + export { outputs_1344 as outputs }; + } + export { ND_range_vector2_1 as ND_range_vector2 }; + export namespace ND_range_vector3_1 { + let node_1345: string; + export { node_1345 as node }; + export namespace inputs_1345 { + let _in_478: string; + export { _in_478 as in }; + let inlow_37: string; + export { inlow_37 as inlow }; + let inhigh_37: string; + export { inhigh_37 as inhigh }; + let gamma_17: string; + export { gamma_17 as gamma }; + let outlow_37: string; + export { outlow_37 as outlow }; + let outhigh_37: string; + export { outhigh_37 as outhigh }; + let doclamp_15: string; + export { doclamp_15 as doclamp }; + } + export { inputs_1345 as inputs }; + export namespace outputs_1345 { + let out_1315: string; + export { out_1315 as out }; + } + export { outputs_1345 as outputs }; + } + export { ND_range_vector3_1 as ND_range_vector3 }; + export namespace ND_range_vector4_1 { + let node_1346: string; + export { node_1346 as node }; + export namespace inputs_1346 { + let _in_479: string; + export { _in_479 as in }; + let inlow_38: string; + export { inlow_38 as inlow }; + let inhigh_38: string; + export { inhigh_38 as inhigh }; + let gamma_18: string; + export { gamma_18 as gamma }; + let outlow_38: string; + export { outlow_38 as outlow }; + let outhigh_38: string; + export { outhigh_38 as outhigh }; + let doclamp_16: string; + export { doclamp_16 as doclamp }; + } + export { inputs_1346 as inputs }; + export namespace outputs_1346 { + let out_1316: string; + export { out_1316 as out }; + } + export { outputs_1346 as outputs }; + } + export { ND_range_vector4_1 as ND_range_vector4 }; + export namespace ND_range_color3FA_1 { + let node_1347: string; + export { node_1347 as node }; + export namespace inputs_1347 { + let _in_480: string; + export { _in_480 as in }; + let inlow_39: string; + export { inlow_39 as inlow }; + let inhigh_39: string; + export { inhigh_39 as inhigh }; + let gamma_19: string; + export { gamma_19 as gamma }; + let outlow_39: string; + export { outlow_39 as outlow }; + let outhigh_39: string; + export { outhigh_39 as outhigh }; + let doclamp_17: string; + export { doclamp_17 as doclamp }; + } + export { inputs_1347 as inputs }; + export namespace outputs_1347 { + let out_1317: string; + export { out_1317 as out }; + } + export { outputs_1347 as outputs }; + } + export { ND_range_color3FA_1 as ND_range_color3FA }; + export namespace ND_range_color4FA_1 { + let node_1348: string; + export { node_1348 as node }; + export namespace inputs_1348 { + let _in_481: string; + export { _in_481 as in }; + let inlow_40: string; + export { inlow_40 as inlow }; + let inhigh_40: string; + export { inhigh_40 as inhigh }; + let gamma_20: string; + export { gamma_20 as gamma }; + let outlow_40: string; + export { outlow_40 as outlow }; + let outhigh_40: string; + export { outhigh_40 as outhigh }; + let doclamp_18: string; + export { doclamp_18 as doclamp }; + } + export { inputs_1348 as inputs }; + export namespace outputs_1348 { + let out_1318: string; + export { out_1318 as out }; + } + export { outputs_1348 as outputs }; + } + export { ND_range_color4FA_1 as ND_range_color4FA }; + export namespace ND_range_vector2FA_1 { + let node_1349: string; + export { node_1349 as node }; + export namespace inputs_1349 { + let _in_482: string; + export { _in_482 as in }; + let inlow_41: string; + export { inlow_41 as inlow }; + let inhigh_41: string; + export { inhigh_41 as inhigh }; + let gamma_21: string; + export { gamma_21 as gamma }; + let outlow_41: string; + export { outlow_41 as outlow }; + let outhigh_41: string; + export { outhigh_41 as outhigh }; + let doclamp_19: string; + export { doclamp_19 as doclamp }; + } + export { inputs_1349 as inputs }; + export namespace outputs_1349 { + let out_1319: string; + export { out_1319 as out }; + } + export { outputs_1349 as outputs }; + } + export { ND_range_vector2FA_1 as ND_range_vector2FA }; + export namespace ND_range_vector3FA_1 { + let node_1350: string; + export { node_1350 as node }; + export namespace inputs_1350 { + let _in_483: string; + export { _in_483 as in }; + let inlow_42: string; + export { inlow_42 as inlow }; + let inhigh_42: string; + export { inhigh_42 as inhigh }; + let gamma_22: string; + export { gamma_22 as gamma }; + let outlow_42: string; + export { outlow_42 as outlow }; + let outhigh_42: string; + export { outhigh_42 as outhigh }; + let doclamp_20: string; + export { doclamp_20 as doclamp }; + } + export { inputs_1350 as inputs }; + export namespace outputs_1350 { + let out_1320: string; + export { out_1320 as out }; + } + export { outputs_1350 as outputs }; + } + export { ND_range_vector3FA_1 as ND_range_vector3FA }; + export namespace ND_range_vector4FA_1 { + let node_1351: string; + export { node_1351 as node }; + export namespace inputs_1351 { + let _in_484: string; + export { _in_484 as in }; + let inlow_43: string; + export { inlow_43 as inlow }; + let inhigh_43: string; + export { inhigh_43 as inhigh }; + let gamma_23: string; + export { gamma_23 as gamma }; + let outlow_43: string; + export { outlow_43 as outlow }; + let outhigh_43: string; + export { outhigh_43 as outhigh }; + let doclamp_21: string; + export { doclamp_21 as doclamp }; + } + export { inputs_1351 as inputs }; + export namespace outputs_1351 { + let out_1321: string; + export { out_1321 as out }; + } + export { outputs_1351 as outputs }; + } + export { ND_range_vector4FA_1 as ND_range_vector4FA }; + export namespace ND_hsvadjust_color3_1 { + let node_1352: string; + export { node_1352 as node }; + export namespace inputs_1352 { + let _in_485: string; + export { _in_485 as in }; + let amount_52: string; + export { amount_52 as amount }; + } + export { inputs_1352 as inputs }; + export namespace outputs_1352 { + let out_1322: string; + export { out_1322 as out }; + } + export { outputs_1352 as outputs }; + } + export { ND_hsvadjust_color3_1 as ND_hsvadjust_color3 }; + export namespace ND_hsvadjust_color4_1 { + let node_1353: string; + export { node_1353 as node }; + export namespace inputs_1353 { + let _in_486: string; + export { _in_486 as in }; + let amount_53: string; + export { amount_53 as amount }; + } + export { inputs_1353 as inputs }; + export namespace outputs_1353 { + let out_1323: string; + export { out_1323 as out }; + } + export { outputs_1353 as outputs }; + } + export { ND_hsvadjust_color4_1 as ND_hsvadjust_color4 }; + export namespace ND_saturate_color3_1 { + let node_1354: string; + export { node_1354 as node }; + export namespace inputs_1354 { + let _in_487: string; + export { _in_487 as in }; + let amount_54: string; + export { amount_54 as amount }; + let lumacoeffs_10: string; + export { lumacoeffs_10 as lumacoeffs }; + } + export { inputs_1354 as inputs }; + export namespace outputs_1354 { + let out_1324: string; + export { out_1324 as out }; + } + export { outputs_1354 as outputs }; + } + export { ND_saturate_color3_1 as ND_saturate_color3 }; + export namespace ND_saturate_color4_1 { + let node_1355: string; + export { node_1355 as node }; + export namespace inputs_1355 { + let _in_488: string; + export { _in_488 as in }; + let amount_55: string; + export { amount_55 as amount }; + let lumacoeffs_11: string; + export { lumacoeffs_11 as lumacoeffs }; + } + export { inputs_1355 as inputs }; + export namespace outputs_1355 { + let out_1325: string; + export { out_1325 as out }; + } + export { outputs_1355 as outputs }; + } + export { ND_saturate_color4_1 as ND_saturate_color4 }; + export namespace ND_colorcorrect_color3_1 { + let node_1356: string; + export { node_1356 as node }; + export namespace inputs_1356 { + let _in_489: string; + export { _in_489 as in }; + let hue_2: string; + export { hue_2 as hue }; + let saturation_2: string; + export { saturation_2 as saturation }; + let gamma_24: string; + export { gamma_24 as gamma }; + let lift_2: string; + export { lift_2 as lift }; + let gain_2: string; + export { gain_2 as gain }; + let contrast_2: string; + export { contrast_2 as contrast }; + let contrastpivot_2: string; + export { contrastpivot_2 as contrastpivot }; + let exposure_4: string; + export { exposure_4 as exposure }; + } + export { inputs_1356 as inputs }; + export namespace outputs_1356 { + let out_1326: string; + export { out_1326 as out }; + } + export { outputs_1356 as outputs }; + } + export { ND_colorcorrect_color3_1 as ND_colorcorrect_color3 }; + export namespace ND_colorcorrect_color4_1 { + let node_1357: string; + export { node_1357 as node }; + export namespace inputs_1357 { + let _in_490: string; + export { _in_490 as in }; + let hue_3: string; + export { hue_3 as hue }; + let saturation_3: string; + export { saturation_3 as saturation }; + let gamma_25: string; + export { gamma_25 as gamma }; + let lift_3: string; + export { lift_3 as lift }; + let gain_3: string; + export { gain_3 as gain }; + let contrast_3: string; + export { contrast_3 as contrast }; + let contrastpivot_3: string; + export { contrastpivot_3 as contrastpivot }; + let exposure_5: string; + export { exposure_5 as exposure }; + } + export { inputs_1357 as inputs }; + export namespace outputs_1357 { + let out_1327: string; + export { out_1327 as out }; + } + export { outputs_1357 as outputs }; + } + export { ND_colorcorrect_color4_1 as ND_colorcorrect_color4 }; + export namespace ND_premult_color4_1 { + let node_1358: string; + export { node_1358 as node }; + export namespace inputs_1358 { + let _in_491: string; + export { _in_491 as in }; + } + export { inputs_1358 as inputs }; + export namespace outputs_1358 { + let out_1328: string; + export { out_1328 as out }; + } + export { outputs_1358 as outputs }; + } + export { ND_premult_color4_1 as ND_premult_color4 }; + export namespace ND_unpremult_color4_1 { + let node_1359: string; + export { node_1359 as node }; + export namespace inputs_1359 { + let _in_492: string; + export { _in_492 as in }; + } + export { inputs_1359 as inputs }; + export namespace outputs_1359 { + let out_1329: string; + export { out_1329 as out }; + } + export { outputs_1359 as outputs }; + } + export { ND_unpremult_color4_1 as ND_unpremult_color4 }; + export namespace ND_plus_float_1 { + let node_1360: string; + export { node_1360 as node }; + export namespace inputs_1360 { + let fg_47: string; + export { fg_47 as fg }; + let bg_47: string; + export { bg_47 as bg }; + let mix_49: string; + export { mix_49 as mix }; + } + export { inputs_1360 as inputs }; + export namespace outputs_1360 { + let out_1330: string; + export { out_1330 as out }; + } + export { outputs_1360 as outputs }; + } + export { ND_plus_float_1 as ND_plus_float }; + export namespace ND_plus_color3_1 { + let node_1361: string; + export { node_1361 as node }; + export namespace inputs_1361 { + let fg_48: string; + export { fg_48 as fg }; + let bg_48: string; + export { bg_48 as bg }; + let mix_50: string; + export { mix_50 as mix }; + } + export { inputs_1361 as inputs }; + export namespace outputs_1361 { + let out_1331: string; + export { out_1331 as out }; + } + export { outputs_1361 as outputs }; + } + export { ND_plus_color3_1 as ND_plus_color3 }; + export namespace ND_plus_color4_1 { + let node_1362: string; + export { node_1362 as node }; + export namespace inputs_1362 { + let fg_49: string; + export { fg_49 as fg }; + let bg_49: string; + export { bg_49 as bg }; + let mix_51: string; + export { mix_51 as mix }; + } + export { inputs_1362 as inputs }; + export namespace outputs_1362 { + let out_1332: string; + export { out_1332 as out }; + } + export { outputs_1362 as outputs }; + } + export { ND_plus_color4_1 as ND_plus_color4 }; + export namespace ND_minus_float_1 { + let node_1363: string; + export { node_1363 as node }; + export namespace inputs_1363 { + let fg_50: string; + export { fg_50 as fg }; + let bg_50: string; + export { bg_50 as bg }; + let mix_52: string; + export { mix_52 as mix }; + } + export { inputs_1363 as inputs }; + export namespace outputs_1363 { + let out_1333: string; + export { out_1333 as out }; + } + export { outputs_1363 as outputs }; + } + export { ND_minus_float_1 as ND_minus_float }; + export namespace ND_minus_color3_1 { + let node_1364: string; + export { node_1364 as node }; + export namespace inputs_1364 { + let fg_51: string; + export { fg_51 as fg }; + let bg_51: string; + export { bg_51 as bg }; + let mix_53: string; + export { mix_53 as mix }; + } + export { inputs_1364 as inputs }; + export namespace outputs_1364 { + let out_1334: string; + export { out_1334 as out }; + } + export { outputs_1364 as outputs }; + } + export { ND_minus_color3_1 as ND_minus_color3 }; + export namespace ND_minus_color4_1 { + let node_1365: string; + export { node_1365 as node }; + export namespace inputs_1365 { + let fg_52: string; + export { fg_52 as fg }; + let bg_52: string; + export { bg_52 as bg }; + let mix_54: string; + export { mix_54 as mix }; + } + export { inputs_1365 as inputs }; + export namespace outputs_1365 { + let out_1335: string; + export { out_1335 as out }; + } + export { outputs_1365 as outputs }; + } + export { ND_minus_color4_1 as ND_minus_color4 }; + export namespace ND_difference_float_1 { + let node_1366: string; + export { node_1366 as node }; + export namespace inputs_1366 { + let fg_53: string; + export { fg_53 as fg }; + let bg_53: string; + export { bg_53 as bg }; + let mix_55: string; + export { mix_55 as mix }; + } + export { inputs_1366 as inputs }; + export namespace outputs_1366 { + let out_1336: string; + export { out_1336 as out }; + } + export { outputs_1366 as outputs }; + } + export { ND_difference_float_1 as ND_difference_float }; + export namespace ND_difference_color3_1 { + let node_1367: string; + export { node_1367 as node }; + export namespace inputs_1367 { + let fg_54: string; + export { fg_54 as fg }; + let bg_54: string; + export { bg_54 as bg }; + let mix_56: string; + export { mix_56 as mix }; + } + export { inputs_1367 as inputs }; + export namespace outputs_1367 { + let out_1337: string; + export { out_1337 as out }; + } + export { outputs_1367 as outputs }; + } + export { ND_difference_color3_1 as ND_difference_color3 }; + export namespace ND_difference_color4_1 { + let node_1368: string; + export { node_1368 as node }; + export namespace inputs_1368 { + let fg_55: string; + export { fg_55 as fg }; + let bg_55: string; + export { bg_55 as bg }; + let mix_57: string; + export { mix_57 as mix }; + } + export { inputs_1368 as inputs }; + export namespace outputs_1368 { + let out_1338: string; + export { out_1338 as out }; + } + export { outputs_1368 as outputs }; + } + export { ND_difference_color4_1 as ND_difference_color4 }; + export namespace ND_burn_float_1 { + let node_1369: string; + export { node_1369 as node }; + export namespace inputs_1369 { + let fg_56: string; + export { fg_56 as fg }; + let bg_56: string; + export { bg_56 as bg }; + let mix_58: string; + export { mix_58 as mix }; + } + export { inputs_1369 as inputs }; + export namespace outputs_1369 { + let out_1339: string; + export { out_1339 as out }; + } + export { outputs_1369 as outputs }; + } + export { ND_burn_float_1 as ND_burn_float }; + export namespace ND_burn_color3_1 { + let node_1370: string; + export { node_1370 as node }; + export namespace inputs_1370 { + let fg_57: string; + export { fg_57 as fg }; + let bg_57: string; + export { bg_57 as bg }; + let mix_59: string; + export { mix_59 as mix }; + } + export { inputs_1370 as inputs }; + export namespace outputs_1370 { + let out_1340: string; + export { out_1340 as out }; + } + export { outputs_1370 as outputs }; + } + export { ND_burn_color3_1 as ND_burn_color3 }; + export namespace ND_burn_color4_1 { + let node_1371: string; + export { node_1371 as node }; + export namespace inputs_1371 { + let fg_58: string; + export { fg_58 as fg }; + let bg_58: string; + export { bg_58 as bg }; + let mix_60: string; + export { mix_60 as mix }; + } + export { inputs_1371 as inputs }; + export namespace outputs_1371 { + let out_1341: string; + export { out_1341 as out }; + } + export { outputs_1371 as outputs }; + } + export { ND_burn_color4_1 as ND_burn_color4 }; + export namespace ND_dodge_float_1 { + let node_1372: string; + export { node_1372 as node }; + export namespace inputs_1372 { + let fg_59: string; + export { fg_59 as fg }; + let bg_59: string; + export { bg_59 as bg }; + let mix_61: string; + export { mix_61 as mix }; + } + export { inputs_1372 as inputs }; + export namespace outputs_1372 { + let out_1342: string; + export { out_1342 as out }; + } + export { outputs_1372 as outputs }; + } + export { ND_dodge_float_1 as ND_dodge_float }; + export namespace ND_dodge_color3_1 { + let node_1373: string; + export { node_1373 as node }; + export namespace inputs_1373 { + let fg_60: string; + export { fg_60 as fg }; + let bg_60: string; + export { bg_60 as bg }; + let mix_62: string; + export { mix_62 as mix }; + } + export { inputs_1373 as inputs }; + export namespace outputs_1373 { + let out_1343: string; + export { out_1343 as out }; + } + export { outputs_1373 as outputs }; + } + export { ND_dodge_color3_1 as ND_dodge_color3 }; + export namespace ND_dodge_color4_1 { + let node_1374: string; + export { node_1374 as node }; + export namespace inputs_1374 { + let fg_61: string; + export { fg_61 as fg }; + let bg_61: string; + export { bg_61 as bg }; + let mix_63: string; + export { mix_63 as mix }; + } + export { inputs_1374 as inputs }; + export namespace outputs_1374 { + let out_1344: string; + export { out_1344 as out }; + } + export { outputs_1374 as outputs }; + } + export { ND_dodge_color4_1 as ND_dodge_color4 }; + export namespace ND_screen_float_1 { + let node_1375: string; + export { node_1375 as node }; + export namespace inputs_1375 { + let fg_62: string; + export { fg_62 as fg }; + let bg_62: string; + export { bg_62 as bg }; + let mix_64: string; + export { mix_64 as mix }; + } + export { inputs_1375 as inputs }; + export namespace outputs_1375 { + let out_1345: string; + export { out_1345 as out }; + } + export { outputs_1375 as outputs }; + } + export { ND_screen_float_1 as ND_screen_float }; + export namespace ND_screen_color3_1 { + let node_1376: string; + export { node_1376 as node }; + export namespace inputs_1376 { + let fg_63: string; + export { fg_63 as fg }; + let bg_63: string; + export { bg_63 as bg }; + let mix_65: string; + export { mix_65 as mix }; + } + export { inputs_1376 as inputs }; + export namespace outputs_1376 { + let out_1346: string; + export { out_1346 as out }; + } + export { outputs_1376 as outputs }; + } + export { ND_screen_color3_1 as ND_screen_color3 }; + export namespace ND_screen_color4_1 { + let node_1377: string; + export { node_1377 as node }; + export namespace inputs_1377 { + let fg_64: string; + export { fg_64 as fg }; + let bg_64: string; + export { bg_64 as bg }; + let mix_66: string; + export { mix_66 as mix }; + } + export { inputs_1377 as inputs }; + export namespace outputs_1377 { + let out_1347: string; + export { out_1347 as out }; + } + export { outputs_1377 as outputs }; + } + export { ND_screen_color4_1 as ND_screen_color4 }; + export namespace ND_overlay_float_1 { + let node_1378: string; + export { node_1378 as node }; + export namespace inputs_1378 { + let fg_65: string; + export { fg_65 as fg }; + let bg_65: string; + export { bg_65 as bg }; + let mix_67: string; + export { mix_67 as mix }; + } + export { inputs_1378 as inputs }; + export namespace outputs_1378 { + let out_1348: string; + export { out_1348 as out }; + } + export { outputs_1378 as outputs }; + } + export { ND_overlay_float_1 as ND_overlay_float }; + export namespace ND_overlay_color3_1 { + let node_1379: string; + export { node_1379 as node }; + export namespace inputs_1379 { + let fg_66: string; + export { fg_66 as fg }; + let bg_66: string; + export { bg_66 as bg }; + let mix_68: string; + export { mix_68 as mix }; + } + export { inputs_1379 as inputs }; + export namespace outputs_1379 { + let out_1349: string; + export { out_1349 as out }; + } + export { outputs_1379 as outputs }; + } + export { ND_overlay_color3_1 as ND_overlay_color3 }; + export namespace ND_overlay_color4_1 { + let node_1380: string; + export { node_1380 as node }; + export namespace inputs_1380 { + let fg_67: string; + export { fg_67 as fg }; + let bg_67: string; + export { bg_67 as bg }; + let mix_69: string; + export { mix_69 as mix }; + } + export { inputs_1380 as inputs }; + export namespace outputs_1380 { + let out_1350: string; + export { out_1350 as out }; + } + export { outputs_1380 as outputs }; + } + export { ND_overlay_color4_1 as ND_overlay_color4 }; + export namespace ND_disjointover_color4_1 { + let node_1381: string; + export { node_1381 as node }; + export namespace inputs_1381 { + let fg_68: string; + export { fg_68 as fg }; + let bg_68: string; + export { bg_68 as bg }; + let mix_70: string; + export { mix_70 as mix }; + } + export { inputs_1381 as inputs }; + export namespace outputs_1381 { + let out_1351: string; + export { out_1351 as out }; + } + export { outputs_1381 as outputs }; + } + export { ND_disjointover_color4_1 as ND_disjointover_color4 }; + export namespace ND_in_color4_1 { + let node_1382: string; + export { node_1382 as node }; + export namespace inputs_1382 { + let fg_69: string; + export { fg_69 as fg }; + let bg_69: string; + export { bg_69 as bg }; + let mix_71: string; + export { mix_71 as mix }; + } + export { inputs_1382 as inputs }; + export namespace outputs_1382 { + let out_1352: string; + export { out_1352 as out }; + } + export { outputs_1382 as outputs }; + } + export { ND_in_color4_1 as ND_in_color4 }; + export namespace ND_mask_color4_1 { + let node_1383: string; + export { node_1383 as node }; + export namespace inputs_1383 { + let fg_70: string; + export { fg_70 as fg }; + let bg_70: string; + export { bg_70 as bg }; + let mix_72: string; + export { mix_72 as mix }; + } + export { inputs_1383 as inputs }; + export namespace outputs_1383 { + let out_1353: string; + export { out_1353 as out }; + } + export { outputs_1383 as outputs }; + } + export { ND_mask_color4_1 as ND_mask_color4 }; + export namespace ND_matte_color4_1 { + let node_1384: string; + export { node_1384 as node }; + export namespace inputs_1384 { + let fg_71: string; + export { fg_71 as fg }; + let bg_71: string; + export { bg_71 as bg }; + let mix_73: string; + export { mix_73 as mix }; + } + export { inputs_1384 as inputs }; + export namespace outputs_1384 { + let out_1354: string; + export { out_1354 as out }; + } + export { outputs_1384 as outputs }; + } + export { ND_matte_color4_1 as ND_matte_color4 }; + export namespace ND_out_color4_1 { + let node_1385: string; + export { node_1385 as node }; + export namespace inputs_1385 { + let fg_72: string; + export { fg_72 as fg }; + let bg_72: string; + export { bg_72 as bg }; + let mix_74: string; + export { mix_74 as mix }; + } + export { inputs_1385 as inputs }; + export namespace outputs_1385 { + let out_1355: string; + export { out_1355 as out }; + } + export { outputs_1385 as outputs }; + } + export { ND_out_color4_1 as ND_out_color4 }; + export namespace ND_over_color4_1 { + let node_1386: string; + export { node_1386 as node }; + export namespace inputs_1386 { + let fg_73: string; + export { fg_73 as fg }; + let bg_73: string; + export { bg_73 as bg }; + let mix_75: string; + export { mix_75 as mix }; + } + export { inputs_1386 as inputs }; + export namespace outputs_1386 { + let out_1356: string; + export { out_1356 as out }; + } + export { outputs_1386 as outputs }; + } + export { ND_over_color4_1 as ND_over_color4 }; + export namespace ND_inside_float_1 { + let node_1387: string; + export { node_1387 as node }; + export namespace inputs_1387 { + let _in_493: string; + export { _in_493 as in }; + let mask_6: string; + export { mask_6 as mask }; + } + export { inputs_1387 as inputs }; + export namespace outputs_1387 { + let out_1357: string; + export { out_1357 as out }; + } + export { outputs_1387 as outputs }; + } + export { ND_inside_float_1 as ND_inside_float }; + export namespace ND_inside_color3_1 { + let node_1388: string; + export { node_1388 as node }; + export namespace inputs_1388 { + let _in_494: string; + export { _in_494 as in }; + let mask_7: string; + export { mask_7 as mask }; + } + export { inputs_1388 as inputs }; + export namespace outputs_1388 { + let out_1358: string; + export { out_1358 as out }; + } + export { outputs_1388 as outputs }; + } + export { ND_inside_color3_1 as ND_inside_color3 }; + export namespace ND_inside_color4_1 { + let node_1389: string; + export { node_1389 as node }; + export namespace inputs_1389 { + let _in_495: string; + export { _in_495 as in }; + let mask_8: string; + export { mask_8 as mask }; + } + export { inputs_1389 as inputs }; + export namespace outputs_1389 { + let out_1359: string; + export { out_1359 as out }; + } + export { outputs_1389 as outputs }; + } + export { ND_inside_color4_1 as ND_inside_color4 }; + export namespace ND_outside_float_1 { + let node_1390: string; + export { node_1390 as node }; + export namespace inputs_1390 { + let _in_496: string; + export { _in_496 as in }; + let mask_9: string; + export { mask_9 as mask }; + } + export { inputs_1390 as inputs }; + export namespace outputs_1390 { + let out_1360: string; + export { out_1360 as out }; + } + export { outputs_1390 as outputs }; + } + export { ND_outside_float_1 as ND_outside_float }; + export namespace ND_outside_color3_1 { + let node_1391: string; + export { node_1391 as node }; + export namespace inputs_1391 { + let _in_497: string; + export { _in_497 as in }; + let mask_10: string; + export { mask_10 as mask }; + } + export { inputs_1391 as inputs }; + export namespace outputs_1391 { + let out_1361: string; + export { out_1361 as out }; + } + export { outputs_1391 as outputs }; + } + export { ND_outside_color3_1 as ND_outside_color3 }; + export namespace ND_outside_color4_1 { + let node_1392: string; + export { node_1392 as node }; + export namespace inputs_1392 { + let _in_498: string; + export { _in_498 as in }; + let mask_11: string; + export { mask_11 as mask }; + } + export { inputs_1392 as inputs }; + export namespace outputs_1392 { + let out_1362: string; + export { out_1362 as out }; + } + export { outputs_1392 as outputs }; + } + export { ND_outside_color4_1 as ND_outside_color4 }; + export namespace ND_mix_float_1 { + let node_1393: string; + export { node_1393 as node }; + export namespace inputs_1393 { + let fg_74: string; + export { fg_74 as fg }; + let bg_74: string; + export { bg_74 as bg }; + let mix_76: string; + export { mix_76 as mix }; + } + export { inputs_1393 as inputs }; + export namespace outputs_1393 { + let out_1363: string; + export { out_1363 as out }; + } + export { outputs_1393 as outputs }; + } + export { ND_mix_float_1 as ND_mix_float }; + export namespace ND_mix_color3_1 { + let node_1394: string; + export { node_1394 as node }; + export namespace inputs_1394 { + let fg_75: string; + export { fg_75 as fg }; + let bg_75: string; + export { bg_75 as bg }; + let mix_77: string; + export { mix_77 as mix }; + } + export { inputs_1394 as inputs }; + export namespace outputs_1394 { + let out_1364: string; + export { out_1364 as out }; + } + export { outputs_1394 as outputs }; + } + export { ND_mix_color3_1 as ND_mix_color3 }; + export namespace ND_mix_color3_color3_1 { + let node_1395: string; + export { node_1395 as node }; + export namespace inputs_1395 { + let fg_76: string; + export { fg_76 as fg }; + let bg_76: string; + export { bg_76 as bg }; + let mix_78: string; + export { mix_78 as mix }; + } + export { inputs_1395 as inputs }; + export namespace outputs_1395 { + let out_1365: string; + export { out_1365 as out }; + } + export { outputs_1395 as outputs }; + } + export { ND_mix_color3_color3_1 as ND_mix_color3_color3 }; + export namespace ND_mix_color4_1 { + let node_1396: string; + export { node_1396 as node }; + export namespace inputs_1396 { + let fg_77: string; + export { fg_77 as fg }; + let bg_77: string; + export { bg_77 as bg }; + let mix_79: string; + export { mix_79 as mix }; + } + export { inputs_1396 as inputs }; + export namespace outputs_1396 { + let out_1366: string; + export { out_1366 as out }; + } + export { outputs_1396 as outputs }; + } + export { ND_mix_color4_1 as ND_mix_color4 }; + export namespace ND_mix_color4_color4_1 { + let node_1397: string; + export { node_1397 as node }; + export namespace inputs_1397 { + let fg_78: string; + export { fg_78 as fg }; + let bg_78: string; + export { bg_78 as bg }; + let mix_80: string; + export { mix_80 as mix }; + } + export { inputs_1397 as inputs }; + export namespace outputs_1397 { + let out_1367: string; + export { out_1367 as out }; + } + export { outputs_1397 as outputs }; + } + export { ND_mix_color4_color4_1 as ND_mix_color4_color4 }; + export namespace ND_mix_vector2_1 { + let node_1398: string; + export { node_1398 as node }; + export namespace inputs_1398 { + let fg_79: string; + export { fg_79 as fg }; + let bg_79: string; + export { bg_79 as bg }; + let mix_81: string; + export { mix_81 as mix }; + } + export { inputs_1398 as inputs }; + export namespace outputs_1398 { + let out_1368: string; + export { out_1368 as out }; + } + export { outputs_1398 as outputs }; + } + export { ND_mix_vector2_1 as ND_mix_vector2 }; + export namespace ND_mix_vector2_vector2_1 { + let node_1399: string; + export { node_1399 as node }; + export namespace inputs_1399 { + let fg_80: string; + export { fg_80 as fg }; + let bg_80: string; + export { bg_80 as bg }; + let mix_82: string; + export { mix_82 as mix }; + } + export { inputs_1399 as inputs }; + export namespace outputs_1399 { + let out_1369: string; + export { out_1369 as out }; + } + export { outputs_1399 as outputs }; + } + export { ND_mix_vector2_vector2_1 as ND_mix_vector2_vector2 }; + export namespace ND_mix_vector3_1 { + let node_1400: string; + export { node_1400 as node }; + export namespace inputs_1400 { + let fg_81: string; + export { fg_81 as fg }; + let bg_81: string; + export { bg_81 as bg }; + let mix_83: string; + export { mix_83 as mix }; + } + export { inputs_1400 as inputs }; + export namespace outputs_1400 { + let out_1370: string; + export { out_1370 as out }; + } + export { outputs_1400 as outputs }; + } + export { ND_mix_vector3_1 as ND_mix_vector3 }; + export namespace ND_mix_vector3_vector3_1 { + let node_1401: string; + export { node_1401 as node }; + export namespace inputs_1401 { + let fg_82: string; + export { fg_82 as fg }; + let bg_82: string; + export { bg_82 as bg }; + let mix_84: string; + export { mix_84 as mix }; + } + export { inputs_1401 as inputs }; + export namespace outputs_1401 { + let out_1371: string; + export { out_1371 as out }; + } + export { outputs_1401 as outputs }; + } + export { ND_mix_vector3_vector3_1 as ND_mix_vector3_vector3 }; + export namespace ND_mix_vector4_1 { + let node_1402: string; + export { node_1402 as node }; + export namespace inputs_1402 { + let fg_83: string; + export { fg_83 as fg }; + let bg_83: string; + export { bg_83 as bg }; + let mix_85: string; + export { mix_85 as mix }; + } + export { inputs_1402 as inputs }; + export namespace outputs_1402 { + let out_1372: string; + export { out_1372 as out }; + } + export { outputs_1402 as outputs }; + } + export { ND_mix_vector4_1 as ND_mix_vector4 }; + export namespace ND_mix_vector4_vector4_1 { + let node_1403: string; + export { node_1403 as node }; + export namespace inputs_1403 { + let fg_84: string; + export { fg_84 as fg }; + let bg_84: string; + export { bg_84 as bg }; + let mix_86: string; + export { mix_86 as mix }; + } + export { inputs_1403 as inputs }; + export namespace outputs_1403 { + let out_1373: string; + export { out_1373 as out }; + } + export { outputs_1403 as outputs }; + } + export { ND_mix_vector4_vector4_1 as ND_mix_vector4_vector4 }; + export namespace ND_mix_surfaceshader_1 { + let node_1404: string; + export { node_1404 as node }; + export namespace inputs_1404 { + let fg_85: string; + export { fg_85 as fg }; + let bg_85: string; + export { bg_85 as bg }; + let mix_87: string; + export { mix_87 as mix }; + } + export { inputs_1404 as inputs }; + export namespace outputs_1404 { + let out_1374: string; + export { out_1374 as out }; + } + export { outputs_1404 as outputs }; + } + export { ND_mix_surfaceshader_1 as ND_mix_surfaceshader }; + export namespace ND_mix_displacementshader_1 { + let node_1405: string; + export { node_1405 as node }; + export namespace inputs_1405 { + let fg_86: string; + export { fg_86 as fg }; + let bg_86: string; + export { bg_86 as bg }; + let mix_88: string; + export { mix_88 as mix }; + } + export { inputs_1405 as inputs }; + export namespace outputs_1405 { + let out_1375: string; + export { out_1375 as out }; + } + export { outputs_1405 as outputs }; + } + export { ND_mix_displacementshader_1 as ND_mix_displacementshader }; + export namespace ND_mix_volumeshader_1 { + let node_1406: string; + export { node_1406 as node }; + export namespace inputs_1406 { + let fg_87: string; + export { fg_87 as fg }; + let bg_87: string; + export { bg_87 as bg }; + let mix_89: string; + export { mix_89 as mix }; + } + export { inputs_1406 as inputs }; + export namespace outputs_1406 { + let out_1376: string; + export { out_1376 as out }; + } + export { outputs_1406 as outputs }; + } + export { ND_mix_volumeshader_1 as ND_mix_volumeshader }; + export namespace ND_ifgreater_float_1 { + let node_1407: string; + export { node_1407 as node }; + export namespace inputs_1407 { + let value1_70: string; + export { value1_70 as value1 }; + let value2_70: string; + export { value2_70 as value2 }; + let in1_351: string; + export { in1_351 as in1 }; + let in2_351: string; + export { in2_351 as in2 }; + } + export { inputs_1407 as inputs }; + export namespace outputs_1407 { + let out_1377: string; + export { out_1377 as out }; + } + export { outputs_1407 as outputs }; + } + export { ND_ifgreater_float_1 as ND_ifgreater_float }; + export namespace ND_ifgreater_integer_1 { + let node_1408: string; + export { node_1408 as node }; + export namespace inputs_1408 { + let value1_71: string; + export { value1_71 as value1 }; + let value2_71: string; + export { value2_71 as value2 }; + let in1_352: string; + export { in1_352 as in1 }; + let in2_352: string; + export { in2_352 as in2 }; + } + export { inputs_1408 as inputs }; + export namespace outputs_1408 { + let out_1378: string; + export { out_1378 as out }; + } + export { outputs_1408 as outputs }; + } + export { ND_ifgreater_integer_1 as ND_ifgreater_integer }; + export namespace ND_ifgreater_color3_1 { + let node_1409: string; + export { node_1409 as node }; + export namespace inputs_1409 { + let value1_72: string; + export { value1_72 as value1 }; + let value2_72: string; + export { value2_72 as value2 }; + let in1_353: string; + export { in1_353 as in1 }; + let in2_353: string; + export { in2_353 as in2 }; + } + export { inputs_1409 as inputs }; + export namespace outputs_1409 { + let out_1379: string; + export { out_1379 as out }; + } + export { outputs_1409 as outputs }; + } + export { ND_ifgreater_color3_1 as ND_ifgreater_color3 }; + export namespace ND_ifgreater_color4_1 { + let node_1410: string; + export { node_1410 as node }; + export namespace inputs_1410 { + let value1_73: string; + export { value1_73 as value1 }; + let value2_73: string; + export { value2_73 as value2 }; + let in1_354: string; + export { in1_354 as in1 }; + let in2_354: string; + export { in2_354 as in2 }; + } + export { inputs_1410 as inputs }; + export namespace outputs_1410 { + let out_1380: string; + export { out_1380 as out }; + } + export { outputs_1410 as outputs }; + } + export { ND_ifgreater_color4_1 as ND_ifgreater_color4 }; + export namespace ND_ifgreater_vector2_1 { + let node_1411: string; + export { node_1411 as node }; + export namespace inputs_1411 { + let value1_74: string; + export { value1_74 as value1 }; + let value2_74: string; + export { value2_74 as value2 }; + let in1_355: string; + export { in1_355 as in1 }; + let in2_355: string; + export { in2_355 as in2 }; + } + export { inputs_1411 as inputs }; + export namespace outputs_1411 { + let out_1381: string; + export { out_1381 as out }; + } + export { outputs_1411 as outputs }; + } + export { ND_ifgreater_vector2_1 as ND_ifgreater_vector2 }; + export namespace ND_ifgreater_vector3_1 { + let node_1412: string; + export { node_1412 as node }; + export namespace inputs_1412 { + let value1_75: string; + export { value1_75 as value1 }; + let value2_75: string; + export { value2_75 as value2 }; + let in1_356: string; + export { in1_356 as in1 }; + let in2_356: string; + export { in2_356 as in2 }; + } + export { inputs_1412 as inputs }; + export namespace outputs_1412 { + let out_1382: string; + export { out_1382 as out }; + } + export { outputs_1412 as outputs }; + } + export { ND_ifgreater_vector3_1 as ND_ifgreater_vector3 }; + export namespace ND_ifgreater_vector4_1 { + let node_1413: string; + export { node_1413 as node }; + export namespace inputs_1413 { + let value1_76: string; + export { value1_76 as value1 }; + let value2_76: string; + export { value2_76 as value2 }; + let in1_357: string; + export { in1_357 as in1 }; + let in2_357: string; + export { in2_357 as in2 }; + } + export { inputs_1413 as inputs }; + export namespace outputs_1413 { + let out_1383: string; + export { out_1383 as out }; + } + export { outputs_1413 as outputs }; + } + export { ND_ifgreater_vector4_1 as ND_ifgreater_vector4 }; + export namespace ND_ifgreater_matrix33_1 { + let node_1414: string; + export { node_1414 as node }; + export namespace inputs_1414 { + let value1_77: string; + export { value1_77 as value1 }; + let value2_77: string; + export { value2_77 as value2 }; + let in1_358: string; + export { in1_358 as in1 }; + let in2_358: string; + export { in2_358 as in2 }; + } + export { inputs_1414 as inputs }; + export namespace outputs_1414 { + let out_1384: string; + export { out_1384 as out }; + } + export { outputs_1414 as outputs }; + } + export { ND_ifgreater_matrix33_1 as ND_ifgreater_matrix33 }; + export namespace ND_ifgreater_matrix44_1 { + let node_1415: string; + export { node_1415 as node }; + export namespace inputs_1415 { + let value1_78: string; + export { value1_78 as value1 }; + let value2_78: string; + export { value2_78 as value2 }; + let in1_359: string; + export { in1_359 as in1 }; + let in2_359: string; + export { in2_359 as in2 }; + } + export { inputs_1415 as inputs }; + export namespace outputs_1415 { + let out_1385: string; + export { out_1385 as out }; + } + export { outputs_1415 as outputs }; + } + export { ND_ifgreater_matrix44_1 as ND_ifgreater_matrix44 }; + export namespace ND_ifgreater_boolean_1 { + let node_1416: string; + export { node_1416 as node }; + export namespace inputs_1416 { + let value1_79: string; + export { value1_79 as value1 }; + let value2_79: string; + export { value2_79 as value2 }; + } + export { inputs_1416 as inputs }; + export namespace outputs_1416 { + let out_1386: string; + export { out_1386 as out }; + } + export { outputs_1416 as outputs }; + } + export { ND_ifgreater_boolean_1 as ND_ifgreater_boolean }; + export namespace ND_ifgreater_floatI_1 { + let node_1417: string; + export { node_1417 as node }; + export namespace inputs_1417 { + let value1_80: string; + export { value1_80 as value1 }; + let value2_80: string; + export { value2_80 as value2 }; + let in1_360: string; + export { in1_360 as in1 }; + let in2_360: string; + export { in2_360 as in2 }; + } + export { inputs_1417 as inputs }; + export namespace outputs_1417 { + let out_1387: string; + export { out_1387 as out }; + } + export { outputs_1417 as outputs }; + } + export { ND_ifgreater_floatI_1 as ND_ifgreater_floatI }; + export namespace ND_ifgreater_integerI_1 { + let node_1418: string; + export { node_1418 as node }; + export namespace inputs_1418 { + let value1_81: string; + export { value1_81 as value1 }; + let value2_81: string; + export { value2_81 as value2 }; + let in1_361: string; + export { in1_361 as in1 }; + let in2_361: string; + export { in2_361 as in2 }; + } + export { inputs_1418 as inputs }; + export namespace outputs_1418 { + let out_1388: string; + export { out_1388 as out }; + } + export { outputs_1418 as outputs }; + } + export { ND_ifgreater_integerI_1 as ND_ifgreater_integerI }; + export namespace ND_ifgreater_color3I_1 { + let node_1419: string; + export { node_1419 as node }; + export namespace inputs_1419 { + let value1_82: string; + export { value1_82 as value1 }; + let value2_82: string; + export { value2_82 as value2 }; + let in1_362: string; + export { in1_362 as in1 }; + let in2_362: string; + export { in2_362 as in2 }; + } + export { inputs_1419 as inputs }; + export namespace outputs_1419 { + let out_1389: string; + export { out_1389 as out }; + } + export { outputs_1419 as outputs }; + } + export { ND_ifgreater_color3I_1 as ND_ifgreater_color3I }; + export namespace ND_ifgreater_color4I_1 { + let node_1420: string; + export { node_1420 as node }; + export namespace inputs_1420 { + let value1_83: string; + export { value1_83 as value1 }; + let value2_83: string; + export { value2_83 as value2 }; + let in1_363: string; + export { in1_363 as in1 }; + let in2_363: string; + export { in2_363 as in2 }; + } + export { inputs_1420 as inputs }; + export namespace outputs_1420 { + let out_1390: string; + export { out_1390 as out }; + } + export { outputs_1420 as outputs }; + } + export { ND_ifgreater_color4I_1 as ND_ifgreater_color4I }; + export namespace ND_ifgreater_vector2I_1 { + let node_1421: string; + export { node_1421 as node }; + export namespace inputs_1421 { + let value1_84: string; + export { value1_84 as value1 }; + let value2_84: string; + export { value2_84 as value2 }; + let in1_364: string; + export { in1_364 as in1 }; + let in2_364: string; + export { in2_364 as in2 }; + } + export { inputs_1421 as inputs }; + export namespace outputs_1421 { + let out_1391: string; + export { out_1391 as out }; + } + export { outputs_1421 as outputs }; + } + export { ND_ifgreater_vector2I_1 as ND_ifgreater_vector2I }; + export namespace ND_ifgreater_vector3I_1 { + let node_1422: string; + export { node_1422 as node }; + export namespace inputs_1422 { + let value1_85: string; + export { value1_85 as value1 }; + let value2_85: string; + export { value2_85 as value2 }; + let in1_365: string; + export { in1_365 as in1 }; + let in2_365: string; + export { in2_365 as in2 }; + } + export { inputs_1422 as inputs }; + export namespace outputs_1422 { + let out_1392: string; + export { out_1392 as out }; + } + export { outputs_1422 as outputs }; + } + export { ND_ifgreater_vector3I_1 as ND_ifgreater_vector3I }; + export namespace ND_ifgreater_vector4I_1 { + let node_1423: string; + export { node_1423 as node }; + export namespace inputs_1423 { + let value1_86: string; + export { value1_86 as value1 }; + let value2_86: string; + export { value2_86 as value2 }; + let in1_366: string; + export { in1_366 as in1 }; + let in2_366: string; + export { in2_366 as in2 }; + } + export { inputs_1423 as inputs }; + export namespace outputs_1423 { + let out_1393: string; + export { out_1393 as out }; + } + export { outputs_1423 as outputs }; + } + export { ND_ifgreater_vector4I_1 as ND_ifgreater_vector4I }; + export namespace ND_ifgreater_matrix33I_1 { + let node_1424: string; + export { node_1424 as node }; + export namespace inputs_1424 { + let value1_87: string; + export { value1_87 as value1 }; + let value2_87: string; + export { value2_87 as value2 }; + let in1_367: string; + export { in1_367 as in1 }; + let in2_367: string; + export { in2_367 as in2 }; + } + export { inputs_1424 as inputs }; + export namespace outputs_1424 { + let out_1394: string; + export { out_1394 as out }; + } + export { outputs_1424 as outputs }; + } + export { ND_ifgreater_matrix33I_1 as ND_ifgreater_matrix33I }; + export namespace ND_ifgreater_matrix44I_1 { + let node_1425: string; + export { node_1425 as node }; + export namespace inputs_1425 { + let value1_88: string; + export { value1_88 as value1 }; + let value2_88: string; + export { value2_88 as value2 }; + let in1_368: string; + export { in1_368 as in1 }; + let in2_368: string; + export { in2_368 as in2 }; + } + export { inputs_1425 as inputs }; + export namespace outputs_1425 { + let out_1395: string; + export { out_1395 as out }; + } + export { outputs_1425 as outputs }; + } + export { ND_ifgreater_matrix44I_1 as ND_ifgreater_matrix44I }; + export namespace ND_ifgreater_booleanI_1 { + let node_1426: string; + export { node_1426 as node }; + export namespace inputs_1426 { + let value1_89: string; + export { value1_89 as value1 }; + let value2_89: string; + export { value2_89 as value2 }; + } + export { inputs_1426 as inputs }; + export namespace outputs_1426 { + let out_1396: string; + export { out_1396 as out }; + } + export { outputs_1426 as outputs }; + } + export { ND_ifgreater_booleanI_1 as ND_ifgreater_booleanI }; + export namespace ND_ifgreatereq_float_1 { + let node_1427: string; + export { node_1427 as node }; + export namespace inputs_1427 { + let value1_90: string; + export { value1_90 as value1 }; + let value2_90: string; + export { value2_90 as value2 }; + let in1_369: string; + export { in1_369 as in1 }; + let in2_369: string; + export { in2_369 as in2 }; + } + export { inputs_1427 as inputs }; + export namespace outputs_1427 { + let out_1397: string; + export { out_1397 as out }; + } + export { outputs_1427 as outputs }; + } + export { ND_ifgreatereq_float_1 as ND_ifgreatereq_float }; + export namespace ND_ifgreatereq_integer_1 { + let node_1428: string; + export { node_1428 as node }; + export namespace inputs_1428 { + let value1_91: string; + export { value1_91 as value1 }; + let value2_91: string; + export { value2_91 as value2 }; + let in1_370: string; + export { in1_370 as in1 }; + let in2_370: string; + export { in2_370 as in2 }; + } + export { inputs_1428 as inputs }; + export namespace outputs_1428 { + let out_1398: string; + export { out_1398 as out }; + } + export { outputs_1428 as outputs }; + } + export { ND_ifgreatereq_integer_1 as ND_ifgreatereq_integer }; + export namespace ND_ifgreatereq_color3_1 { + let node_1429: string; + export { node_1429 as node }; + export namespace inputs_1429 { + let value1_92: string; + export { value1_92 as value1 }; + let value2_92: string; + export { value2_92 as value2 }; + let in1_371: string; + export { in1_371 as in1 }; + let in2_371: string; + export { in2_371 as in2 }; + } + export { inputs_1429 as inputs }; + export namespace outputs_1429 { + let out_1399: string; + export { out_1399 as out }; + } + export { outputs_1429 as outputs }; + } + export { ND_ifgreatereq_color3_1 as ND_ifgreatereq_color3 }; + export namespace ND_ifgreatereq_color4_1 { + let node_1430: string; + export { node_1430 as node }; + export namespace inputs_1430 { + let value1_93: string; + export { value1_93 as value1 }; + let value2_93: string; + export { value2_93 as value2 }; + let in1_372: string; + export { in1_372 as in1 }; + let in2_372: string; + export { in2_372 as in2 }; + } + export { inputs_1430 as inputs }; + export namespace outputs_1430 { + let out_1400: string; + export { out_1400 as out }; + } + export { outputs_1430 as outputs }; + } + export { ND_ifgreatereq_color4_1 as ND_ifgreatereq_color4 }; + export namespace ND_ifgreatereq_vector2_1 { + let node_1431: string; + export { node_1431 as node }; + export namespace inputs_1431 { + let value1_94: string; + export { value1_94 as value1 }; + let value2_94: string; + export { value2_94 as value2 }; + let in1_373: string; + export { in1_373 as in1 }; + let in2_373: string; + export { in2_373 as in2 }; + } + export { inputs_1431 as inputs }; + export namespace outputs_1431 { + let out_1401: string; + export { out_1401 as out }; + } + export { outputs_1431 as outputs }; + } + export { ND_ifgreatereq_vector2_1 as ND_ifgreatereq_vector2 }; + export namespace ND_ifgreatereq_vector3_1 { + let node_1432: string; + export { node_1432 as node }; + export namespace inputs_1432 { + let value1_95: string; + export { value1_95 as value1 }; + let value2_95: string; + export { value2_95 as value2 }; + let in1_374: string; + export { in1_374 as in1 }; + let in2_374: string; + export { in2_374 as in2 }; + } + export { inputs_1432 as inputs }; + export namespace outputs_1432 { + let out_1402: string; + export { out_1402 as out }; + } + export { outputs_1432 as outputs }; + } + export { ND_ifgreatereq_vector3_1 as ND_ifgreatereq_vector3 }; + export namespace ND_ifgreatereq_vector4_1 { + let node_1433: string; + export { node_1433 as node }; + export namespace inputs_1433 { + let value1_96: string; + export { value1_96 as value1 }; + let value2_96: string; + export { value2_96 as value2 }; + let in1_375: string; + export { in1_375 as in1 }; + let in2_375: string; + export { in2_375 as in2 }; + } + export { inputs_1433 as inputs }; + export namespace outputs_1433 { + let out_1403: string; + export { out_1403 as out }; + } + export { outputs_1433 as outputs }; + } + export { ND_ifgreatereq_vector4_1 as ND_ifgreatereq_vector4 }; + export namespace ND_ifgreatereq_matrix33_1 { + let node_1434: string; + export { node_1434 as node }; + export namespace inputs_1434 { + let value1_97: string; + export { value1_97 as value1 }; + let value2_97: string; + export { value2_97 as value2 }; + let in1_376: string; + export { in1_376 as in1 }; + let in2_376: string; + export { in2_376 as in2 }; + } + export { inputs_1434 as inputs }; + export namespace outputs_1434 { + let out_1404: string; + export { out_1404 as out }; + } + export { outputs_1434 as outputs }; + } + export { ND_ifgreatereq_matrix33_1 as ND_ifgreatereq_matrix33 }; + export namespace ND_ifgreatereq_matrix44_1 { + let node_1435: string; + export { node_1435 as node }; + export namespace inputs_1435 { + let value1_98: string; + export { value1_98 as value1 }; + let value2_98: string; + export { value2_98 as value2 }; + let in1_377: string; + export { in1_377 as in1 }; + let in2_377: string; + export { in2_377 as in2 }; + } + export { inputs_1435 as inputs }; + export namespace outputs_1435 { + let out_1405: string; + export { out_1405 as out }; + } + export { outputs_1435 as outputs }; + } + export { ND_ifgreatereq_matrix44_1 as ND_ifgreatereq_matrix44 }; + export namespace ND_ifgreatereq_boolean_1 { + let node_1436: string; + export { node_1436 as node }; + export namespace inputs_1436 { + let value1_99: string; + export { value1_99 as value1 }; + let value2_99: string; + export { value2_99 as value2 }; + } + export { inputs_1436 as inputs }; + export namespace outputs_1436 { + let out_1406: string; + export { out_1406 as out }; + } + export { outputs_1436 as outputs }; + } + export { ND_ifgreatereq_boolean_1 as ND_ifgreatereq_boolean }; + export namespace ND_ifgreatereq_floatI_1 { + let node_1437: string; + export { node_1437 as node }; + export namespace inputs_1437 { + let value1_100: string; + export { value1_100 as value1 }; + let value2_100: string; + export { value2_100 as value2 }; + let in1_378: string; + export { in1_378 as in1 }; + let in2_378: string; + export { in2_378 as in2 }; + } + export { inputs_1437 as inputs }; + export namespace outputs_1437 { + let out_1407: string; + export { out_1407 as out }; + } + export { outputs_1437 as outputs }; + } + export { ND_ifgreatereq_floatI_1 as ND_ifgreatereq_floatI }; + export namespace ND_ifgreatereq_integerI_1 { + let node_1438: string; + export { node_1438 as node }; + export namespace inputs_1438 { + let value1_101: string; + export { value1_101 as value1 }; + let value2_101: string; + export { value2_101 as value2 }; + let in1_379: string; + export { in1_379 as in1 }; + let in2_379: string; + export { in2_379 as in2 }; + } + export { inputs_1438 as inputs }; + export namespace outputs_1438 { + let out_1408: string; + export { out_1408 as out }; + } + export { outputs_1438 as outputs }; + } + export { ND_ifgreatereq_integerI_1 as ND_ifgreatereq_integerI }; + export namespace ND_ifgreatereq_color3I_1 { + let node_1439: string; + export { node_1439 as node }; + export namespace inputs_1439 { + let value1_102: string; + export { value1_102 as value1 }; + let value2_102: string; + export { value2_102 as value2 }; + let in1_380: string; + export { in1_380 as in1 }; + let in2_380: string; + export { in2_380 as in2 }; + } + export { inputs_1439 as inputs }; + export namespace outputs_1439 { + let out_1409: string; + export { out_1409 as out }; + } + export { outputs_1439 as outputs }; + } + export { ND_ifgreatereq_color3I_1 as ND_ifgreatereq_color3I }; + export namespace ND_ifgreatereq_color4I_1 { + let node_1440: string; + export { node_1440 as node }; + export namespace inputs_1440 { + let value1_103: string; + export { value1_103 as value1 }; + let value2_103: string; + export { value2_103 as value2 }; + let in1_381: string; + export { in1_381 as in1 }; + let in2_381: string; + export { in2_381 as in2 }; + } + export { inputs_1440 as inputs }; + export namespace outputs_1440 { + let out_1410: string; + export { out_1410 as out }; + } + export { outputs_1440 as outputs }; + } + export { ND_ifgreatereq_color4I_1 as ND_ifgreatereq_color4I }; + export namespace ND_ifgreatereq_vector2I_1 { + let node_1441: string; + export { node_1441 as node }; + export namespace inputs_1441 { + let value1_104: string; + export { value1_104 as value1 }; + let value2_104: string; + export { value2_104 as value2 }; + let in1_382: string; + export { in1_382 as in1 }; + let in2_382: string; + export { in2_382 as in2 }; + } + export { inputs_1441 as inputs }; + export namespace outputs_1441 { + let out_1411: string; + export { out_1411 as out }; + } + export { outputs_1441 as outputs }; + } + export { ND_ifgreatereq_vector2I_1 as ND_ifgreatereq_vector2I }; + export namespace ND_ifgreatereq_vector3I_1 { + let node_1442: string; + export { node_1442 as node }; + export namespace inputs_1442 { + let value1_105: string; + export { value1_105 as value1 }; + let value2_105: string; + export { value2_105 as value2 }; + let in1_383: string; + export { in1_383 as in1 }; + let in2_383: string; + export { in2_383 as in2 }; + } + export { inputs_1442 as inputs }; + export namespace outputs_1442 { + let out_1412: string; + export { out_1412 as out }; + } + export { outputs_1442 as outputs }; + } + export { ND_ifgreatereq_vector3I_1 as ND_ifgreatereq_vector3I }; + export namespace ND_ifgreatereq_vector4I_1 { + let node_1443: string; + export { node_1443 as node }; + export namespace inputs_1443 { + let value1_106: string; + export { value1_106 as value1 }; + let value2_106: string; + export { value2_106 as value2 }; + let in1_384: string; + export { in1_384 as in1 }; + let in2_384: string; + export { in2_384 as in2 }; + } + export { inputs_1443 as inputs }; + export namespace outputs_1443 { + let out_1413: string; + export { out_1413 as out }; + } + export { outputs_1443 as outputs }; + } + export { ND_ifgreatereq_vector4I_1 as ND_ifgreatereq_vector4I }; + export namespace ND_ifgreatereq_matrix33I_1 { + let node_1444: string; + export { node_1444 as node }; + export namespace inputs_1444 { + let value1_107: string; + export { value1_107 as value1 }; + let value2_107: string; + export { value2_107 as value2 }; + let in1_385: string; + export { in1_385 as in1 }; + let in2_385: string; + export { in2_385 as in2 }; + } + export { inputs_1444 as inputs }; + export namespace outputs_1444 { + let out_1414: string; + export { out_1414 as out }; + } + export { outputs_1444 as outputs }; + } + export { ND_ifgreatereq_matrix33I_1 as ND_ifgreatereq_matrix33I }; + export namespace ND_ifgreatereq_matrix44I_1 { + let node_1445: string; + export { node_1445 as node }; + export namespace inputs_1445 { + let value1_108: string; + export { value1_108 as value1 }; + let value2_108: string; + export { value2_108 as value2 }; + let in1_386: string; + export { in1_386 as in1 }; + let in2_386: string; + export { in2_386 as in2 }; + } + export { inputs_1445 as inputs }; + export namespace outputs_1445 { + let out_1415: string; + export { out_1415 as out }; + } + export { outputs_1445 as outputs }; + } + export { ND_ifgreatereq_matrix44I_1 as ND_ifgreatereq_matrix44I }; + export namespace ND_ifgreatereq_booleanI_1 { + let node_1446: string; + export { node_1446 as node }; + export namespace inputs_1446 { + let value1_109: string; + export { value1_109 as value1 }; + let value2_109: string; + export { value2_109 as value2 }; + } + export { inputs_1446 as inputs }; + export namespace outputs_1446 { + let out_1416: string; + export { out_1416 as out }; + } + export { outputs_1446 as outputs }; + } + export { ND_ifgreatereq_booleanI_1 as ND_ifgreatereq_booleanI }; + export namespace ND_ifequal_float_1 { + let node_1447: string; + export { node_1447 as node }; + export namespace inputs_1447 { + let value1_110: string; + export { value1_110 as value1 }; + let value2_110: string; + export { value2_110 as value2 }; + let in1_387: string; + export { in1_387 as in1 }; + let in2_387: string; + export { in2_387 as in2 }; + } + export { inputs_1447 as inputs }; + export namespace outputs_1447 { + let out_1417: string; + export { out_1417 as out }; + } + export { outputs_1447 as outputs }; + } + export { ND_ifequal_float_1 as ND_ifequal_float }; + export namespace ND_ifequal_integer_1 { + let node_1448: string; + export { node_1448 as node }; + export namespace inputs_1448 { + let value1_111: string; + export { value1_111 as value1 }; + let value2_111: string; + export { value2_111 as value2 }; + let in1_388: string; + export { in1_388 as in1 }; + let in2_388: string; + export { in2_388 as in2 }; + } + export { inputs_1448 as inputs }; + export namespace outputs_1448 { + let out_1418: string; + export { out_1418 as out }; + } + export { outputs_1448 as outputs }; + } + export { ND_ifequal_integer_1 as ND_ifequal_integer }; + export namespace ND_ifequal_color3_1 { + let node_1449: string; + export { node_1449 as node }; + export namespace inputs_1449 { + let value1_112: string; + export { value1_112 as value1 }; + let value2_112: string; + export { value2_112 as value2 }; + let in1_389: string; + export { in1_389 as in1 }; + let in2_389: string; + export { in2_389 as in2 }; + } + export { inputs_1449 as inputs }; + export namespace outputs_1449 { + let out_1419: string; + export { out_1419 as out }; + } + export { outputs_1449 as outputs }; + } + export { ND_ifequal_color3_1 as ND_ifequal_color3 }; + export namespace ND_ifequal_color4_1 { + let node_1450: string; + export { node_1450 as node }; + export namespace inputs_1450 { + let value1_113: string; + export { value1_113 as value1 }; + let value2_113: string; + export { value2_113 as value2 }; + let in1_390: string; + export { in1_390 as in1 }; + let in2_390: string; + export { in2_390 as in2 }; + } + export { inputs_1450 as inputs }; + export namespace outputs_1450 { + let out_1420: string; + export { out_1420 as out }; + } + export { outputs_1450 as outputs }; + } + export { ND_ifequal_color4_1 as ND_ifequal_color4 }; + export namespace ND_ifequal_vector2_1 { + let node_1451: string; + export { node_1451 as node }; + export namespace inputs_1451 { + let value1_114: string; + export { value1_114 as value1 }; + let value2_114: string; + export { value2_114 as value2 }; + let in1_391: string; + export { in1_391 as in1 }; + let in2_391: string; + export { in2_391 as in2 }; + } + export { inputs_1451 as inputs }; + export namespace outputs_1451 { + let out_1421: string; + export { out_1421 as out }; + } + export { outputs_1451 as outputs }; + } + export { ND_ifequal_vector2_1 as ND_ifequal_vector2 }; + export namespace ND_ifequal_vector3_1 { + let node_1452: string; + export { node_1452 as node }; + export namespace inputs_1452 { + let value1_115: string; + export { value1_115 as value1 }; + let value2_115: string; + export { value2_115 as value2 }; + let in1_392: string; + export { in1_392 as in1 }; + let in2_392: string; + export { in2_392 as in2 }; + } + export { inputs_1452 as inputs }; + export namespace outputs_1452 { + let out_1422: string; + export { out_1422 as out }; + } + export { outputs_1452 as outputs }; + } + export { ND_ifequal_vector3_1 as ND_ifequal_vector3 }; + export namespace ND_ifequal_vector4_1 { + let node_1453: string; + export { node_1453 as node }; + export namespace inputs_1453 { + let value1_116: string; + export { value1_116 as value1 }; + let value2_116: string; + export { value2_116 as value2 }; + let in1_393: string; + export { in1_393 as in1 }; + let in2_393: string; + export { in2_393 as in2 }; + } + export { inputs_1453 as inputs }; + export namespace outputs_1453 { + let out_1423: string; + export { out_1423 as out }; + } + export { outputs_1453 as outputs }; + } + export { ND_ifequal_vector4_1 as ND_ifequal_vector4 }; + export namespace ND_ifequal_matrix33_1 { + let node_1454: string; + export { node_1454 as node }; + export namespace inputs_1454 { + let value1_117: string; + export { value1_117 as value1 }; + let value2_117: string; + export { value2_117 as value2 }; + let in1_394: string; + export { in1_394 as in1 }; + let in2_394: string; + export { in2_394 as in2 }; + } + export { inputs_1454 as inputs }; + export namespace outputs_1454 { + let out_1424: string; + export { out_1424 as out }; + } + export { outputs_1454 as outputs }; + } + export { ND_ifequal_matrix33_1 as ND_ifequal_matrix33 }; + export namespace ND_ifequal_matrix44_1 { + let node_1455: string; + export { node_1455 as node }; + export namespace inputs_1455 { + let value1_118: string; + export { value1_118 as value1 }; + let value2_118: string; + export { value2_118 as value2 }; + let in1_395: string; + export { in1_395 as in1 }; + let in2_395: string; + export { in2_395 as in2 }; + } + export { inputs_1455 as inputs }; + export namespace outputs_1455 { + let out_1425: string; + export { out_1425 as out }; + } + export { outputs_1455 as outputs }; + } + export { ND_ifequal_matrix44_1 as ND_ifequal_matrix44 }; + export namespace ND_ifequal_boolean_1 { + let node_1456: string; + export { node_1456 as node }; + export namespace inputs_1456 { + let value1_119: string; + export { value1_119 as value1 }; + let value2_119: string; + export { value2_119 as value2 }; + } + export { inputs_1456 as inputs }; + export namespace outputs_1456 { + let out_1426: string; + export { out_1426 as out }; + } + export { outputs_1456 as outputs }; + } + export { ND_ifequal_boolean_1 as ND_ifequal_boolean }; + export namespace ND_ifequal_floatI_1 { + let node_1457: string; + export { node_1457 as node }; + export namespace inputs_1457 { + let value1_120: string; + export { value1_120 as value1 }; + let value2_120: string; + export { value2_120 as value2 }; + let in1_396: string; + export { in1_396 as in1 }; + let in2_396: string; + export { in2_396 as in2 }; + } + export { inputs_1457 as inputs }; + export namespace outputs_1457 { + let out_1427: string; + export { out_1427 as out }; + } + export { outputs_1457 as outputs }; + } + export { ND_ifequal_floatI_1 as ND_ifequal_floatI }; + export namespace ND_ifequal_integerI_1 { + let node_1458: string; + export { node_1458 as node }; + export namespace inputs_1458 { + let value1_121: string; + export { value1_121 as value1 }; + let value2_121: string; + export { value2_121 as value2 }; + let in1_397: string; + export { in1_397 as in1 }; + let in2_397: string; + export { in2_397 as in2 }; + } + export { inputs_1458 as inputs }; + export namespace outputs_1458 { + let out_1428: string; + export { out_1428 as out }; + } + export { outputs_1458 as outputs }; + } + export { ND_ifequal_integerI_1 as ND_ifequal_integerI }; + export namespace ND_ifequal_color3I_1 { + let node_1459: string; + export { node_1459 as node }; + export namespace inputs_1459 { + let value1_122: string; + export { value1_122 as value1 }; + let value2_122: string; + export { value2_122 as value2 }; + let in1_398: string; + export { in1_398 as in1 }; + let in2_398: string; + export { in2_398 as in2 }; + } + export { inputs_1459 as inputs }; + export namespace outputs_1459 { + let out_1429: string; + export { out_1429 as out }; + } + export { outputs_1459 as outputs }; + } + export { ND_ifequal_color3I_1 as ND_ifequal_color3I }; + export namespace ND_ifequal_color4I_1 { + let node_1460: string; + export { node_1460 as node }; + export namespace inputs_1460 { + let value1_123: string; + export { value1_123 as value1 }; + let value2_123: string; + export { value2_123 as value2 }; + let in1_399: string; + export { in1_399 as in1 }; + let in2_399: string; + export { in2_399 as in2 }; + } + export { inputs_1460 as inputs }; + export namespace outputs_1460 { + let out_1430: string; + export { out_1430 as out }; + } + export { outputs_1460 as outputs }; + } + export { ND_ifequal_color4I_1 as ND_ifequal_color4I }; + export namespace ND_ifequal_vector2I_1 { + let node_1461: string; + export { node_1461 as node }; + export namespace inputs_1461 { + let value1_124: string; + export { value1_124 as value1 }; + let value2_124: string; + export { value2_124 as value2 }; + let in1_400: string; + export { in1_400 as in1 }; + let in2_400: string; + export { in2_400 as in2 }; + } + export { inputs_1461 as inputs }; + export namespace outputs_1461 { + let out_1431: string; + export { out_1431 as out }; + } + export { outputs_1461 as outputs }; + } + export { ND_ifequal_vector2I_1 as ND_ifequal_vector2I }; + export namespace ND_ifequal_vector3I_1 { + let node_1462: string; + export { node_1462 as node }; + export namespace inputs_1462 { + let value1_125: string; + export { value1_125 as value1 }; + let value2_125: string; + export { value2_125 as value2 }; + let in1_401: string; + export { in1_401 as in1 }; + let in2_401: string; + export { in2_401 as in2 }; + } + export { inputs_1462 as inputs }; + export namespace outputs_1462 { + let out_1432: string; + export { out_1432 as out }; + } + export { outputs_1462 as outputs }; + } + export { ND_ifequal_vector3I_1 as ND_ifequal_vector3I }; + export namespace ND_ifequal_vector4I_1 { + let node_1463: string; + export { node_1463 as node }; + export namespace inputs_1463 { + let value1_126: string; + export { value1_126 as value1 }; + let value2_126: string; + export { value2_126 as value2 }; + let in1_402: string; + export { in1_402 as in1 }; + let in2_402: string; + export { in2_402 as in2 }; + } + export { inputs_1463 as inputs }; + export namespace outputs_1463 { + let out_1433: string; + export { out_1433 as out }; + } + export { outputs_1463 as outputs }; + } + export { ND_ifequal_vector4I_1 as ND_ifequal_vector4I }; + export namespace ND_ifequal_matrix33I_1 { + let node_1464: string; + export { node_1464 as node }; + export namespace inputs_1464 { + let value1_127: string; + export { value1_127 as value1 }; + let value2_127: string; + export { value2_127 as value2 }; + let in1_403: string; + export { in1_403 as in1 }; + let in2_403: string; + export { in2_403 as in2 }; + } + export { inputs_1464 as inputs }; + export namespace outputs_1464 { + let out_1434: string; + export { out_1434 as out }; + } + export { outputs_1464 as outputs }; + } + export { ND_ifequal_matrix33I_1 as ND_ifequal_matrix33I }; + export namespace ND_ifequal_matrix44I_1 { + let node_1465: string; + export { node_1465 as node }; + export namespace inputs_1465 { + let value1_128: string; + export { value1_128 as value1 }; + let value2_128: string; + export { value2_128 as value2 }; + let in1_404: string; + export { in1_404 as in1 }; + let in2_404: string; + export { in2_404 as in2 }; + } + export { inputs_1465 as inputs }; + export namespace outputs_1465 { + let out_1435: string; + export { out_1435 as out }; + } + export { outputs_1465 as outputs }; + } + export { ND_ifequal_matrix44I_1 as ND_ifequal_matrix44I }; + export namespace ND_ifequal_booleanI_1 { + let node_1466: string; + export { node_1466 as node }; + export namespace inputs_1466 { + let value1_129: string; + export { value1_129 as value1 }; + let value2_129: string; + export { value2_129 as value2 }; + } + export { inputs_1466 as inputs }; + export namespace outputs_1466 { + let out_1436: string; + export { out_1436 as out }; + } + export { outputs_1466 as outputs }; + } + export { ND_ifequal_booleanI_1 as ND_ifequal_booleanI }; + export namespace ND_ifequal_floatB_1 { + let node_1467: string; + export { node_1467 as node }; + export namespace inputs_1467 { + let value1_130: string; + export { value1_130 as value1 }; + let value2_130: string; + export { value2_130 as value2 }; + let in1_405: string; + export { in1_405 as in1 }; + let in2_405: string; + export { in2_405 as in2 }; + } + export { inputs_1467 as inputs }; + export namespace outputs_1467 { + let out_1437: string; + export { out_1437 as out }; + } + export { outputs_1467 as outputs }; + } + export { ND_ifequal_floatB_1 as ND_ifequal_floatB }; + export namespace ND_ifequal_integerB_1 { + let node_1468: string; + export { node_1468 as node }; + export namespace inputs_1468 { + let value1_131: string; + export { value1_131 as value1 }; + let value2_131: string; + export { value2_131 as value2 }; + let in1_406: string; + export { in1_406 as in1 }; + let in2_406: string; + export { in2_406 as in2 }; + } + export { inputs_1468 as inputs }; + export namespace outputs_1468 { + let out_1438: string; + export { out_1438 as out }; + } + export { outputs_1468 as outputs }; + } + export { ND_ifequal_integerB_1 as ND_ifequal_integerB }; + export namespace ND_ifequal_color3B_1 { + let node_1469: string; + export { node_1469 as node }; + export namespace inputs_1469 { + let value1_132: string; + export { value1_132 as value1 }; + let value2_132: string; + export { value2_132 as value2 }; + let in1_407: string; + export { in1_407 as in1 }; + let in2_407: string; + export { in2_407 as in2 }; + } + export { inputs_1469 as inputs }; + export namespace outputs_1469 { + let out_1439: string; + export { out_1439 as out }; + } + export { outputs_1469 as outputs }; + } + export { ND_ifequal_color3B_1 as ND_ifequal_color3B }; + export namespace ND_ifequal_color4B_1 { + let node_1470: string; + export { node_1470 as node }; + export namespace inputs_1470 { + let value1_133: string; + export { value1_133 as value1 }; + let value2_133: string; + export { value2_133 as value2 }; + let in1_408: string; + export { in1_408 as in1 }; + let in2_408: string; + export { in2_408 as in2 }; + } + export { inputs_1470 as inputs }; + export namespace outputs_1470 { + let out_1440: string; + export { out_1440 as out }; + } + export { outputs_1470 as outputs }; + } + export { ND_ifequal_color4B_1 as ND_ifequal_color4B }; + export namespace ND_ifequal_vector2B_1 { + let node_1471: string; + export { node_1471 as node }; + export namespace inputs_1471 { + let value1_134: string; + export { value1_134 as value1 }; + let value2_134: string; + export { value2_134 as value2 }; + let in1_409: string; + export { in1_409 as in1 }; + let in2_409: string; + export { in2_409 as in2 }; + } + export { inputs_1471 as inputs }; + export namespace outputs_1471 { + let out_1441: string; + export { out_1441 as out }; + } + export { outputs_1471 as outputs }; + } + export { ND_ifequal_vector2B_1 as ND_ifequal_vector2B }; + export namespace ND_ifequal_vector3B_1 { + let node_1472: string; + export { node_1472 as node }; + export namespace inputs_1472 { + let value1_135: string; + export { value1_135 as value1 }; + let value2_135: string; + export { value2_135 as value2 }; + let in1_410: string; + export { in1_410 as in1 }; + let in2_410: string; + export { in2_410 as in2 }; + } + export { inputs_1472 as inputs }; + export namespace outputs_1472 { + let out_1442: string; + export { out_1442 as out }; + } + export { outputs_1472 as outputs }; + } + export { ND_ifequal_vector3B_1 as ND_ifequal_vector3B }; + export namespace ND_ifequal_vector4B_1 { + let node_1473: string; + export { node_1473 as node }; + export namespace inputs_1473 { + let value1_136: string; + export { value1_136 as value1 }; + let value2_136: string; + export { value2_136 as value2 }; + let in1_411: string; + export { in1_411 as in1 }; + let in2_411: string; + export { in2_411 as in2 }; + } + export { inputs_1473 as inputs }; + export namespace outputs_1473 { + let out_1443: string; + export { out_1443 as out }; + } + export { outputs_1473 as outputs }; + } + export { ND_ifequal_vector4B_1 as ND_ifequal_vector4B }; + export namespace ND_ifequal_matrix33B_1 { + let node_1474: string; + export { node_1474 as node }; + export namespace inputs_1474 { + let value1_137: string; + export { value1_137 as value1 }; + let value2_137: string; + export { value2_137 as value2 }; + let in1_412: string; + export { in1_412 as in1 }; + let in2_412: string; + export { in2_412 as in2 }; + } + export { inputs_1474 as inputs }; + export namespace outputs_1474 { + let out_1444: string; + export { out_1444 as out }; + } + export { outputs_1474 as outputs }; + } + export { ND_ifequal_matrix33B_1 as ND_ifequal_matrix33B }; + export namespace ND_ifequal_matrix44B_1 { + let node_1475: string; + export { node_1475 as node }; + export namespace inputs_1475 { + let value1_138: string; + export { value1_138 as value1 }; + let value2_138: string; + export { value2_138 as value2 }; + let in1_413: string; + export { in1_413 as in1 }; + let in2_413: string; + export { in2_413 as in2 }; + } + export { inputs_1475 as inputs }; + export namespace outputs_1475 { + let out_1445: string; + export { out_1445 as out }; + } + export { outputs_1475 as outputs }; + } + export { ND_ifequal_matrix44B_1 as ND_ifequal_matrix44B }; + export namespace ND_ifequal_booleanB_1 { + let node_1476: string; + export { node_1476 as node }; + export namespace inputs_1476 { + let value1_139: string; + export { value1_139 as value1 }; + let value2_139: string; + export { value2_139 as value2 }; + } + export { inputs_1476 as inputs }; + export namespace outputs_1476 { + let out_1446: string; + export { out_1446 as out }; + } + export { outputs_1476 as outputs }; + } + export { ND_ifequal_booleanB_1 as ND_ifequal_booleanB }; + export namespace ND_switch_float_1 { + let node_1477: string; + export { node_1477 as node }; + export namespace inputs_1477 { + let in1_414: string; + export { in1_414 as in1 }; + let in2_414: string; + export { in2_414 as in2 }; + let in3_23: string; + export { in3_23 as in3 }; + let in4_20: string; + export { in4_20 as in4 }; + let in5_16: string; + export { in5_16 as in5 }; + let in6_16: string; + export { in6_16 as in6 }; + let in7_16: string; + export { in7_16 as in7 }; + let in8_16: string; + export { in8_16 as in8 }; + let in9_16: string; + export { in9_16 as in9 }; + let in10_16: string; + export { in10_16 as in10 }; + let which_16: string; + export { which_16 as which }; + } + export { inputs_1477 as inputs }; + export namespace outputs_1477 { + let out_1447: string; + export { out_1447 as out }; + } + export { outputs_1477 as outputs }; + } + export { ND_switch_float_1 as ND_switch_float }; + export namespace ND_switch_color3_1 { + let node_1478: string; + export { node_1478 as node }; + export namespace inputs_1478 { + let in1_415: string; + export { in1_415 as in1 }; + let in2_415: string; + export { in2_415 as in2 }; + let in3_24: string; + export { in3_24 as in3 }; + let in4_21: string; + export { in4_21 as in4 }; + let in5_17: string; + export { in5_17 as in5 }; + let in6_17: string; + export { in6_17 as in6 }; + let in7_17: string; + export { in7_17 as in7 }; + let in8_17: string; + export { in8_17 as in8 }; + let in9_17: string; + export { in9_17 as in9 }; + let in10_17: string; + export { in10_17 as in10 }; + let which_17: string; + export { which_17 as which }; + } + export { inputs_1478 as inputs }; + export namespace outputs_1478 { + let out_1448: string; + export { out_1448 as out }; + } + export { outputs_1478 as outputs }; + } + export { ND_switch_color3_1 as ND_switch_color3 }; + export namespace ND_switch_color4_1 { + let node_1479: string; + export { node_1479 as node }; + export namespace inputs_1479 { + let in1_416: string; + export { in1_416 as in1 }; + let in2_416: string; + export { in2_416 as in2 }; + let in3_25: string; + export { in3_25 as in3 }; + let in4_22: string; + export { in4_22 as in4 }; + let in5_18: string; + export { in5_18 as in5 }; + let in6_18: string; + export { in6_18 as in6 }; + let in7_18: string; + export { in7_18 as in7 }; + let in8_18: string; + export { in8_18 as in8 }; + let in9_18: string; + export { in9_18 as in9 }; + let in10_18: string; + export { in10_18 as in10 }; + let which_18: string; + export { which_18 as which }; + } + export { inputs_1479 as inputs }; + export namespace outputs_1479 { + let out_1449: string; + export { out_1449 as out }; + } + export { outputs_1479 as outputs }; + } + export { ND_switch_color4_1 as ND_switch_color4 }; + export namespace ND_switch_vector2_1 { + let node_1480: string; + export { node_1480 as node }; + export namespace inputs_1480 { + let in1_417: string; + export { in1_417 as in1 }; + let in2_417: string; + export { in2_417 as in2 }; + let in3_26: string; + export { in3_26 as in3 }; + let in4_23: string; + export { in4_23 as in4 }; + let in5_19: string; + export { in5_19 as in5 }; + let in6_19: string; + export { in6_19 as in6 }; + let in7_19: string; + export { in7_19 as in7 }; + let in8_19: string; + export { in8_19 as in8 }; + let in9_19: string; + export { in9_19 as in9 }; + let in10_19: string; + export { in10_19 as in10 }; + let which_19: string; + export { which_19 as which }; + } + export { inputs_1480 as inputs }; + export namespace outputs_1480 { + let out_1450: string; + export { out_1450 as out }; + } + export { outputs_1480 as outputs }; + } + export { ND_switch_vector2_1 as ND_switch_vector2 }; + export namespace ND_switch_vector3_1 { + let node_1481: string; + export { node_1481 as node }; + export namespace inputs_1481 { + let in1_418: string; + export { in1_418 as in1 }; + let in2_418: string; + export { in2_418 as in2 }; + let in3_27: string; + export { in3_27 as in3 }; + let in4_24: string; + export { in4_24 as in4 }; + let in5_20: string; + export { in5_20 as in5 }; + let in6_20: string; + export { in6_20 as in6 }; + let in7_20: string; + export { in7_20 as in7 }; + let in8_20: string; + export { in8_20 as in8 }; + let in9_20: string; + export { in9_20 as in9 }; + let in10_20: string; + export { in10_20 as in10 }; + let which_20: string; + export { which_20 as which }; + } + export { inputs_1481 as inputs }; + export namespace outputs_1481 { + let out_1451: string; + export { out_1451 as out }; + } + export { outputs_1481 as outputs }; + } + export { ND_switch_vector3_1 as ND_switch_vector3 }; + export namespace ND_switch_vector4_1 { + let node_1482: string; + export { node_1482 as node }; + export namespace inputs_1482 { + let in1_419: string; + export { in1_419 as in1 }; + let in2_419: string; + export { in2_419 as in2 }; + let in3_28: string; + export { in3_28 as in3 }; + let in4_25: string; + export { in4_25 as in4 }; + let in5_21: string; + export { in5_21 as in5 }; + let in6_21: string; + export { in6_21 as in6 }; + let in7_21: string; + export { in7_21 as in7 }; + let in8_21: string; + export { in8_21 as in8 }; + let in9_21: string; + export { in9_21 as in9 }; + let in10_21: string; + export { in10_21 as in10 }; + let which_21: string; + export { which_21 as which }; + } + export { inputs_1482 as inputs }; + export namespace outputs_1482 { + let out_1452: string; + export { out_1452 as out }; + } + export { outputs_1482 as outputs }; + } + export { ND_switch_vector4_1 as ND_switch_vector4 }; + export namespace ND_switch_matrix33_1 { + let node_1483: string; + export { node_1483 as node }; + export namespace inputs_1483 { + let in1_420: string; + export { in1_420 as in1 }; + let in2_420: string; + export { in2_420 as in2 }; + let in3_29: string; + export { in3_29 as in3 }; + let in4_26: string; + export { in4_26 as in4 }; + let in5_22: string; + export { in5_22 as in5 }; + let in6_22: string; + export { in6_22 as in6 }; + let in7_22: string; + export { in7_22 as in7 }; + let in8_22: string; + export { in8_22 as in8 }; + let in9_22: string; + export { in9_22 as in9 }; + let in10_22: string; + export { in10_22 as in10 }; + let which_22: string; + export { which_22 as which }; + } + export { inputs_1483 as inputs }; + export namespace outputs_1483 { + let out_1453: string; + export { out_1453 as out }; + } + export { outputs_1483 as outputs }; + } + export { ND_switch_matrix33_1 as ND_switch_matrix33 }; + export namespace ND_switch_matrix44_1 { + let node_1484: string; + export { node_1484 as node }; + export namespace inputs_1484 { + let in1_421: string; + export { in1_421 as in1 }; + let in2_421: string; + export { in2_421 as in2 }; + let in3_30: string; + export { in3_30 as in3 }; + let in4_27: string; + export { in4_27 as in4 }; + let in5_23: string; + export { in5_23 as in5 }; + let in6_23: string; + export { in6_23 as in6 }; + let in7_23: string; + export { in7_23 as in7 }; + let in8_23: string; + export { in8_23 as in8 }; + let in9_23: string; + export { in9_23 as in9 }; + let in10_23: string; + export { in10_23 as in10 }; + let which_23: string; + export { which_23 as which }; + } + export { inputs_1484 as inputs }; + export namespace outputs_1484 { + let out_1454: string; + export { out_1454 as out }; + } + export { outputs_1484 as outputs }; + } + export { ND_switch_matrix44_1 as ND_switch_matrix44 }; + export namespace ND_switch_floatI_1 { + let node_1485: string; + export { node_1485 as node }; + export namespace inputs_1485 { + let in1_422: string; + export { in1_422 as in1 }; + let in2_422: string; + export { in2_422 as in2 }; + let in3_31: string; + export { in3_31 as in3 }; + let in4_28: string; + export { in4_28 as in4 }; + let in5_24: string; + export { in5_24 as in5 }; + let in6_24: string; + export { in6_24 as in6 }; + let in7_24: string; + export { in7_24 as in7 }; + let in8_24: string; + export { in8_24 as in8 }; + let in9_24: string; + export { in9_24 as in9 }; + let in10_24: string; + export { in10_24 as in10 }; + let which_24: string; + export { which_24 as which }; + } + export { inputs_1485 as inputs }; + export namespace outputs_1485 { + let out_1455: string; + export { out_1455 as out }; + } + export { outputs_1485 as outputs }; + } + export { ND_switch_floatI_1 as ND_switch_floatI }; + export namespace ND_switch_color3I_1 { + let node_1486: string; + export { node_1486 as node }; + export namespace inputs_1486 { + let in1_423: string; + export { in1_423 as in1 }; + let in2_423: string; + export { in2_423 as in2 }; + let in3_32: string; + export { in3_32 as in3 }; + let in4_29: string; + export { in4_29 as in4 }; + let in5_25: string; + export { in5_25 as in5 }; + let in6_25: string; + export { in6_25 as in6 }; + let in7_25: string; + export { in7_25 as in7 }; + let in8_25: string; + export { in8_25 as in8 }; + let in9_25: string; + export { in9_25 as in9 }; + let in10_25: string; + export { in10_25 as in10 }; + let which_25: string; + export { which_25 as which }; + } + export { inputs_1486 as inputs }; + export namespace outputs_1486 { + let out_1456: string; + export { out_1456 as out }; + } + export { outputs_1486 as outputs }; + } + export { ND_switch_color3I_1 as ND_switch_color3I }; + export namespace ND_switch_color4I_1 { + let node_1487: string; + export { node_1487 as node }; + export namespace inputs_1487 { + let in1_424: string; + export { in1_424 as in1 }; + let in2_424: string; + export { in2_424 as in2 }; + let in3_33: string; + export { in3_33 as in3 }; + let in4_30: string; + export { in4_30 as in4 }; + let in5_26: string; + export { in5_26 as in5 }; + let in6_26: string; + export { in6_26 as in6 }; + let in7_26: string; + export { in7_26 as in7 }; + let in8_26: string; + export { in8_26 as in8 }; + let in9_26: string; + export { in9_26 as in9 }; + let in10_26: string; + export { in10_26 as in10 }; + let which_26: string; + export { which_26 as which }; + } + export { inputs_1487 as inputs }; + export namespace outputs_1487 { + let out_1457: string; + export { out_1457 as out }; + } + export { outputs_1487 as outputs }; + } + export { ND_switch_color4I_1 as ND_switch_color4I }; + export namespace ND_switch_vector2I_1 { + let node_1488: string; + export { node_1488 as node }; + export namespace inputs_1488 { + let in1_425: string; + export { in1_425 as in1 }; + let in2_425: string; + export { in2_425 as in2 }; + let in3_34: string; + export { in3_34 as in3 }; + let in4_31: string; + export { in4_31 as in4 }; + let in5_27: string; + export { in5_27 as in5 }; + let in6_27: string; + export { in6_27 as in6 }; + let in7_27: string; + export { in7_27 as in7 }; + let in8_27: string; + export { in8_27 as in8 }; + let in9_27: string; + export { in9_27 as in9 }; + let in10_27: string; + export { in10_27 as in10 }; + let which_27: string; + export { which_27 as which }; + } + export { inputs_1488 as inputs }; + export namespace outputs_1488 { + let out_1458: string; + export { out_1458 as out }; + } + export { outputs_1488 as outputs }; + } + export { ND_switch_vector2I_1 as ND_switch_vector2I }; + export namespace ND_switch_vector3I_1 { + let node_1489: string; + export { node_1489 as node }; + export namespace inputs_1489 { + let in1_426: string; + export { in1_426 as in1 }; + let in2_426: string; + export { in2_426 as in2 }; + let in3_35: string; + export { in3_35 as in3 }; + let in4_32: string; + export { in4_32 as in4 }; + let in5_28: string; + export { in5_28 as in5 }; + let in6_28: string; + export { in6_28 as in6 }; + let in7_28: string; + export { in7_28 as in7 }; + let in8_28: string; + export { in8_28 as in8 }; + let in9_28: string; + export { in9_28 as in9 }; + let in10_28: string; + export { in10_28 as in10 }; + let which_28: string; + export { which_28 as which }; + } + export { inputs_1489 as inputs }; + export namespace outputs_1489 { + let out_1459: string; + export { out_1459 as out }; + } + export { outputs_1489 as outputs }; + } + export { ND_switch_vector3I_1 as ND_switch_vector3I }; + export namespace ND_switch_vector4I_1 { + let node_1490: string; + export { node_1490 as node }; + export namespace inputs_1490 { + let in1_427: string; + export { in1_427 as in1 }; + let in2_427: string; + export { in2_427 as in2 }; + let in3_36: string; + export { in3_36 as in3 }; + let in4_33: string; + export { in4_33 as in4 }; + let in5_29: string; + export { in5_29 as in5 }; + let in6_29: string; + export { in6_29 as in6 }; + let in7_29: string; + export { in7_29 as in7 }; + let in8_29: string; + export { in8_29 as in8 }; + let in9_29: string; + export { in9_29 as in9 }; + let in10_29: string; + export { in10_29 as in10 }; + let which_29: string; + export { which_29 as which }; + } + export { inputs_1490 as inputs }; + export namespace outputs_1490 { + let out_1460: string; + export { out_1460 as out }; + } + export { outputs_1490 as outputs }; + } + export { ND_switch_vector4I_1 as ND_switch_vector4I }; + export namespace ND_switch_matrix33I_1 { + let node_1491: string; + export { node_1491 as node }; + export namespace inputs_1491 { + let in1_428: string; + export { in1_428 as in1 }; + let in2_428: string; + export { in2_428 as in2 }; + let in3_37: string; + export { in3_37 as in3 }; + let in4_34: string; + export { in4_34 as in4 }; + let in5_30: string; + export { in5_30 as in5 }; + let in6_30: string; + export { in6_30 as in6 }; + let in7_30: string; + export { in7_30 as in7 }; + let in8_30: string; + export { in8_30 as in8 }; + let in9_30: string; + export { in9_30 as in9 }; + let in10_30: string; + export { in10_30 as in10 }; + let which_30: string; + export { which_30 as which }; + } + export { inputs_1491 as inputs }; + export namespace outputs_1491 { + let out_1461: string; + export { out_1461 as out }; + } + export { outputs_1491 as outputs }; + } + export { ND_switch_matrix33I_1 as ND_switch_matrix33I }; + export namespace ND_switch_matrix44I_1 { + let node_1492: string; + export { node_1492 as node }; + export namespace inputs_1492 { + let in1_429: string; + export { in1_429 as in1 }; + let in2_429: string; + export { in2_429 as in2 }; + let in3_38: string; + export { in3_38 as in3 }; + let in4_35: string; + export { in4_35 as in4 }; + let in5_31: string; + export { in5_31 as in5 }; + let in6_31: string; + export { in6_31 as in6 }; + let in7_31: string; + export { in7_31 as in7 }; + let in8_31: string; + export { in8_31 as in8 }; + let in9_31: string; + export { in9_31 as in9 }; + let in10_31: string; + export { in10_31 as in10 }; + let which_31: string; + export { which_31 as which }; + } + export { inputs_1492 as inputs }; + export namespace outputs_1492 { + let out_1462: string; + export { out_1462 as out }; + } + export { outputs_1492 as outputs }; + } + export { ND_switch_matrix44I_1 as ND_switch_matrix44I }; + export namespace ND_convert_float_color3_1 { + let node_1493: string; + export { node_1493 as node }; + export namespace inputs_1493 { + let _in_499: string; + export { _in_499 as in }; + } + export { inputs_1493 as inputs }; + export namespace outputs_1493 { + let out_1463: string; + export { out_1463 as out }; + } + export { outputs_1493 as outputs }; + } + export { ND_convert_float_color3_1 as ND_convert_float_color3 }; + export namespace ND_convert_float_color4_1 { + let node_1494: string; + export { node_1494 as node }; + export namespace inputs_1494 { + let _in_500: string; + export { _in_500 as in }; + } + export { inputs_1494 as inputs }; + export namespace outputs_1494 { + let out_1464: string; + export { out_1464 as out }; + } + export { outputs_1494 as outputs }; + } + export { ND_convert_float_color4_1 as ND_convert_float_color4 }; + export namespace ND_convert_float_vector2_1 { + let node_1495: string; + export { node_1495 as node }; + export namespace inputs_1495 { + let _in_501: string; + export { _in_501 as in }; + } + export { inputs_1495 as inputs }; + export namespace outputs_1495 { + let out_1465: string; + export { out_1465 as out }; + } + export { outputs_1495 as outputs }; + } + export { ND_convert_float_vector2_1 as ND_convert_float_vector2 }; + export namespace ND_convert_float_vector3_1 { + let node_1496: string; + export { node_1496 as node }; + export namespace inputs_1496 { + let _in_502: string; + export { _in_502 as in }; + } + export { inputs_1496 as inputs }; + export namespace outputs_1496 { + let out_1466: string; + export { out_1466 as out }; + } + export { outputs_1496 as outputs }; + } + export { ND_convert_float_vector3_1 as ND_convert_float_vector3 }; + export namespace ND_convert_float_vector4_1 { + let node_1497: string; + export { node_1497 as node }; + export namespace inputs_1497 { + let _in_503: string; + export { _in_503 as in }; + } + export { inputs_1497 as inputs }; + export namespace outputs_1497 { + let out_1467: string; + export { out_1467 as out }; + } + export { outputs_1497 as outputs }; + } + export { ND_convert_float_vector4_1 as ND_convert_float_vector4 }; + export namespace ND_convert_color3_color4_1 { + let node_1498: string; + export { node_1498 as node }; + export namespace inputs_1498 { + let _in_504: string; + export { _in_504 as in }; + } + export { inputs_1498 as inputs }; + export namespace outputs_1498 { + let out_1468: string; + export { out_1468 as out }; + } + export { outputs_1498 as outputs }; + } + export { ND_convert_color3_color4_1 as ND_convert_color3_color4 }; + export namespace ND_convert_color3_vector2_1 { + let node_1499: string; + export { node_1499 as node }; + export namespace inputs_1499 { + let _in_505: string; + export { _in_505 as in }; + } + export { inputs_1499 as inputs }; + export namespace outputs_1499 { + let out_1469: string; + export { out_1469 as out }; + } + export { outputs_1499 as outputs }; + } + export { ND_convert_color3_vector2_1 as ND_convert_color3_vector2 }; + export namespace ND_convert_color3_vector3_1 { + let node_1500: string; + export { node_1500 as node }; + export namespace inputs_1500 { + let _in_506: string; + export { _in_506 as in }; + } + export { inputs_1500 as inputs }; + export namespace outputs_1500 { + let out_1470: string; + export { out_1470 as out }; + } + export { outputs_1500 as outputs }; + } + export { ND_convert_color3_vector3_1 as ND_convert_color3_vector3 }; + export namespace ND_convert_color3_vector4_1 { + let node_1501: string; + export { node_1501 as node }; + export namespace inputs_1501 { + let _in_507: string; + export { _in_507 as in }; + } + export { inputs_1501 as inputs }; + export namespace outputs_1501 { + let out_1471: string; + export { out_1471 as out }; + } + export { outputs_1501 as outputs }; + } + export { ND_convert_color3_vector4_1 as ND_convert_color3_vector4 }; + export namespace ND_convert_color4_color3_1 { + let node_1502: string; + export { node_1502 as node }; + export namespace inputs_1502 { + let _in_508: string; + export { _in_508 as in }; + } + export { inputs_1502 as inputs }; + export namespace outputs_1502 { + let out_1472: string; + export { out_1472 as out }; + } + export { outputs_1502 as outputs }; + } + export { ND_convert_color4_color3_1 as ND_convert_color4_color3 }; + export namespace ND_convert_color4_vector2_1 { + let node_1503: string; + export { node_1503 as node }; + export namespace inputs_1503 { + let _in_509: string; + export { _in_509 as in }; + } + export { inputs_1503 as inputs }; + export namespace outputs_1503 { + let out_1473: string; + export { out_1473 as out }; + } + export { outputs_1503 as outputs }; + } + export { ND_convert_color4_vector2_1 as ND_convert_color4_vector2 }; + export namespace ND_convert_color4_vector3_1 { + let node_1504: string; + export { node_1504 as node }; + export namespace inputs_1504 { + let _in_510: string; + export { _in_510 as in }; + } + export { inputs_1504 as inputs }; + export namespace outputs_1504 { + let out_1474: string; + export { out_1474 as out }; + } + export { outputs_1504 as outputs }; + } + export { ND_convert_color4_vector3_1 as ND_convert_color4_vector3 }; + export namespace ND_convert_color4_vector4_1 { + let node_1505: string; + export { node_1505 as node }; + export namespace inputs_1505 { + let _in_511: string; + export { _in_511 as in }; + } + export { inputs_1505 as inputs }; + export namespace outputs_1505 { + let out_1475: string; + export { out_1475 as out }; + } + export { outputs_1505 as outputs }; + } + export { ND_convert_color4_vector4_1 as ND_convert_color4_vector4 }; + export namespace ND_convert_vector2_color3_1 { + let node_1506: string; + export { node_1506 as node }; + export namespace inputs_1506 { + let _in_512: string; + export { _in_512 as in }; + } + export { inputs_1506 as inputs }; + export namespace outputs_1506 { + let out_1476: string; + export { out_1476 as out }; + } + export { outputs_1506 as outputs }; + } + export { ND_convert_vector2_color3_1 as ND_convert_vector2_color3 }; + export namespace ND_convert_vector2_color4_1 { + let node_1507: string; + export { node_1507 as node }; + export namespace inputs_1507 { + let _in_513: string; + export { _in_513 as in }; + } + export { inputs_1507 as inputs }; + export namespace outputs_1507 { + let out_1477: string; + export { out_1477 as out }; + } + export { outputs_1507 as outputs }; + } + export { ND_convert_vector2_color4_1 as ND_convert_vector2_color4 }; + export namespace ND_convert_vector2_vector3_1 { + let node_1508: string; + export { node_1508 as node }; + export namespace inputs_1508 { + let _in_514: string; + export { _in_514 as in }; + } + export { inputs_1508 as inputs }; + export namespace outputs_1508 { + let out_1478: string; + export { out_1478 as out }; + } + export { outputs_1508 as outputs }; + } + export { ND_convert_vector2_vector3_1 as ND_convert_vector2_vector3 }; + export namespace ND_convert_vector2_vector4_1 { + let node_1509: string; + export { node_1509 as node }; + export namespace inputs_1509 { + let _in_515: string; + export { _in_515 as in }; + } + export { inputs_1509 as inputs }; + export namespace outputs_1509 { + let out_1479: string; + export { out_1479 as out }; + } + export { outputs_1509 as outputs }; + } + export { ND_convert_vector2_vector4_1 as ND_convert_vector2_vector4 }; + export namespace ND_convert_vector3_color3_1 { + let node_1510: string; + export { node_1510 as node }; + export namespace inputs_1510 { + let _in_516: string; + export { _in_516 as in }; + } + export { inputs_1510 as inputs }; + export namespace outputs_1510 { + let out_1480: string; + export { out_1480 as out }; + } + export { outputs_1510 as outputs }; + } + export { ND_convert_vector3_color3_1 as ND_convert_vector3_color3 }; + export namespace ND_convert_vector3_color4_1 { + let node_1511: string; + export { node_1511 as node }; + export namespace inputs_1511 { + let _in_517: string; + export { _in_517 as in }; + } + export { inputs_1511 as inputs }; + export namespace outputs_1511 { + let out_1481: string; + export { out_1481 as out }; + } + export { outputs_1511 as outputs }; + } + export { ND_convert_vector3_color4_1 as ND_convert_vector3_color4 }; + export namespace ND_convert_vector3_vector2_1 { + let node_1512: string; + export { node_1512 as node }; + export namespace inputs_1512 { + let _in_518: string; + export { _in_518 as in }; + } + export { inputs_1512 as inputs }; + export namespace outputs_1512 { + let out_1482: string; + export { out_1482 as out }; + } + export { outputs_1512 as outputs }; + } + export { ND_convert_vector3_vector2_1 as ND_convert_vector3_vector2 }; + export namespace ND_convert_vector3_vector4_1 { + let node_1513: string; + export { node_1513 as node }; + export namespace inputs_1513 { + let _in_519: string; + export { _in_519 as in }; + } + export { inputs_1513 as inputs }; + export namespace outputs_1513 { + let out_1483: string; + export { out_1483 as out }; + } + export { outputs_1513 as outputs }; + } + export { ND_convert_vector3_vector4_1 as ND_convert_vector3_vector4 }; + export namespace ND_convert_vector4_color3_1 { + let node_1514: string; + export { node_1514 as node }; + export namespace inputs_1514 { + let _in_520: string; + export { _in_520 as in }; + } + export { inputs_1514 as inputs }; + export namespace outputs_1514 { + let out_1484: string; + export { out_1484 as out }; + } + export { outputs_1514 as outputs }; + } + export { ND_convert_vector4_color3_1 as ND_convert_vector4_color3 }; + export namespace ND_convert_vector4_color4_1 { + let node_1515: string; + export { node_1515 as node }; + export namespace inputs_1515 { + let _in_521: string; + export { _in_521 as in }; + } + export { inputs_1515 as inputs }; + export namespace outputs_1515 { + let out_1485: string; + export { out_1485 as out }; + } + export { outputs_1515 as outputs }; + } + export { ND_convert_vector4_color4_1 as ND_convert_vector4_color4 }; + export namespace ND_convert_vector4_vector2_1 { + let node_1516: string; + export { node_1516 as node }; + export namespace inputs_1516 { + let _in_522: string; + export { _in_522 as in }; + } + export { inputs_1516 as inputs }; + export namespace outputs_1516 { + let out_1486: string; + export { out_1486 as out }; + } + export { outputs_1516 as outputs }; + } + export { ND_convert_vector4_vector2_1 as ND_convert_vector4_vector2 }; + export namespace ND_convert_vector4_vector3_1 { + let node_1517: string; + export { node_1517 as node }; + export namespace inputs_1517 { + let _in_523: string; + export { _in_523 as in }; + } + export { inputs_1517 as inputs }; + export namespace outputs_1517 { + let out_1487: string; + export { out_1487 as out }; + } + export { outputs_1517 as outputs }; + } + export { ND_convert_vector4_vector3_1 as ND_convert_vector4_vector3 }; + export namespace ND_convert_boolean_float_1 { + let node_1518: string; + export { node_1518 as node }; + export namespace inputs_1518 { + let _in_524: string; + export { _in_524 as in }; + } + export { inputs_1518 as inputs }; + export namespace outputs_1518 { + let out_1488: string; + export { out_1488 as out }; + } + export { outputs_1518 as outputs }; + } + export { ND_convert_boolean_float_1 as ND_convert_boolean_float }; + export namespace ND_convert_boolean_color3_1 { + let node_1519: string; + export { node_1519 as node }; + export namespace inputs_1519 { + let _in_525: string; + export { _in_525 as in }; + } + export { inputs_1519 as inputs }; + export namespace outputs_1519 { + let out_1489: string; + export { out_1489 as out }; + } + export { outputs_1519 as outputs }; + } + export { ND_convert_boolean_color3_1 as ND_convert_boolean_color3 }; + export namespace ND_convert_boolean_color4_1 { + let node_1520: string; + export { node_1520 as node }; + export namespace inputs_1520 { + let _in_526: string; + export { _in_526 as in }; + } + export { inputs_1520 as inputs }; + export namespace outputs_1520 { + let out_1490: string; + export { out_1490 as out }; + } + export { outputs_1520 as outputs }; + } + export { ND_convert_boolean_color4_1 as ND_convert_boolean_color4 }; + export namespace ND_convert_boolean_vector2_1 { + let node_1521: string; + export { node_1521 as node }; + export namespace inputs_1521 { + let _in_527: string; + export { _in_527 as in }; + } + export { inputs_1521 as inputs }; + export namespace outputs_1521 { + let out_1491: string; + export { out_1491 as out }; + } + export { outputs_1521 as outputs }; + } + export { ND_convert_boolean_vector2_1 as ND_convert_boolean_vector2 }; + export namespace ND_convert_boolean_vector3_1 { + let node_1522: string; + export { node_1522 as node }; + export namespace inputs_1522 { + let _in_528: string; + export { _in_528 as in }; + } + export { inputs_1522 as inputs }; + export namespace outputs_1522 { + let out_1492: string; + export { out_1492 as out }; + } + export { outputs_1522 as outputs }; + } + export { ND_convert_boolean_vector3_1 as ND_convert_boolean_vector3 }; + export namespace ND_convert_boolean_vector4_1 { + let node_1523: string; + export { node_1523 as node }; + export namespace inputs_1523 { + let _in_529: string; + export { _in_529 as in }; + } + export { inputs_1523 as inputs }; + export namespace outputs_1523 { + let out_1493: string; + export { out_1493 as out }; + } + export { outputs_1523 as outputs }; + } + export { ND_convert_boolean_vector4_1 as ND_convert_boolean_vector4 }; + export namespace ND_convert_boolean_integer_1 { + let node_1524: string; + export { node_1524 as node }; + export namespace inputs_1524 { + let _in_530: string; + export { _in_530 as in }; + } + export { inputs_1524 as inputs }; + export namespace outputs_1524 { + let out_1494: string; + export { out_1494 as out }; + } + export { outputs_1524 as outputs }; + } + export { ND_convert_boolean_integer_1 as ND_convert_boolean_integer }; + export namespace ND_convert_integer_float_1 { + let node_1525: string; + export { node_1525 as node }; + export namespace inputs_1525 { + let _in_531: string; + export { _in_531 as in }; + } + export { inputs_1525 as inputs }; + export namespace outputs_1525 { + let out_1495: string; + export { out_1495 as out }; + } + export { outputs_1525 as outputs }; + } + export { ND_convert_integer_float_1 as ND_convert_integer_float }; + export namespace ND_convert_integer_color3_1 { + let node_1526: string; + export { node_1526 as node }; + export namespace inputs_1526 { + let _in_532: string; + export { _in_532 as in }; + } + export { inputs_1526 as inputs }; + export namespace outputs_1526 { + let out_1496: string; + export { out_1496 as out }; + } + export { outputs_1526 as outputs }; + } + export { ND_convert_integer_color3_1 as ND_convert_integer_color3 }; + export namespace ND_convert_integer_color4_1 { + let node_1527: string; + export { node_1527 as node }; + export namespace inputs_1527 { + let _in_533: string; + export { _in_533 as in }; + } + export { inputs_1527 as inputs }; + export namespace outputs_1527 { + let out_1497: string; + export { out_1497 as out }; + } + export { outputs_1527 as outputs }; + } + export { ND_convert_integer_color4_1 as ND_convert_integer_color4 }; + export namespace ND_convert_integer_vector2_1 { + let node_1528: string; + export { node_1528 as node }; + export namespace inputs_1528 { + let _in_534: string; + export { _in_534 as in }; + } + export { inputs_1528 as inputs }; + export namespace outputs_1528 { + let out_1498: string; + export { out_1498 as out }; + } + export { outputs_1528 as outputs }; + } + export { ND_convert_integer_vector2_1 as ND_convert_integer_vector2 }; + export namespace ND_convert_integer_vector3_1 { + let node_1529: string; + export { node_1529 as node }; + export namespace inputs_1529 { + let _in_535: string; + export { _in_535 as in }; + } + export { inputs_1529 as inputs }; + export namespace outputs_1529 { + let out_1499: string; + export { out_1499 as out }; + } + export { outputs_1529 as outputs }; + } + export { ND_convert_integer_vector3_1 as ND_convert_integer_vector3 }; + export namespace ND_convert_integer_vector4_1 { + let node_1530: string; + export { node_1530 as node }; + export namespace inputs_1530 { + let _in_536: string; + export { _in_536 as in }; + } + export { inputs_1530 as inputs }; + export namespace outputs_1530 { + let out_1500: string; + export { out_1500 as out }; + } + export { outputs_1530 as outputs }; + } + export { ND_convert_integer_vector4_1 as ND_convert_integer_vector4 }; + export namespace ND_convert_integer_boolean_1 { + let node_1531: string; + export { node_1531 as node }; + export namespace inputs_1531 { + let _in_537: string; + export { _in_537 as in }; + } + export { inputs_1531 as inputs }; + export namespace outputs_1531 { + let out_1501: string; + export { out_1501 as out }; + } + export { outputs_1531 as outputs }; + } + export { ND_convert_integer_boolean_1 as ND_convert_integer_boolean }; + export namespace ND_convert_color3_surfaceshader_1 { + let node_1532: string; + export { node_1532 as node }; + export namespace inputs_1532 { + let _in_538: string; + export { _in_538 as in }; + } + export { inputs_1532 as inputs }; + export namespace outputs_1532 { + let out_1502: string; + export { out_1502 as out }; + } + export { outputs_1532 as outputs }; + } + export { ND_convert_color3_surfaceshader_1 as ND_convert_color3_surfaceshader }; + export namespace ND_convert_color4_surfaceshader_1 { + let node_1533: string; + export { node_1533 as node }; + export namespace inputs_1533 { + let _in_539: string; + export { _in_539 as in }; + } + export { inputs_1533 as inputs }; + export namespace outputs_1533 { + let out_1503: string; + export { out_1503 as out }; + } + export { outputs_1533 as outputs }; + } + export { ND_convert_color4_surfaceshader_1 as ND_convert_color4_surfaceshader }; + export namespace ND_convert_float_surfaceshader_1 { + let node_1534: string; + export { node_1534 as node }; + export namespace inputs_1534 { + let _in_540: string; + export { _in_540 as in }; + } + export { inputs_1534 as inputs }; + export namespace outputs_1534 { + let out_1504: string; + export { out_1504 as out }; + } + export { outputs_1534 as outputs }; + } + export { ND_convert_float_surfaceshader_1 as ND_convert_float_surfaceshader }; + export namespace ND_convert_vector2_surfaceshader_1 { + let node_1535: string; + export { node_1535 as node }; + export namespace inputs_1535 { + let _in_541: string; + export { _in_541 as in }; + } + export { inputs_1535 as inputs }; + export namespace outputs_1535 { + let out_1505: string; + export { out_1505 as out }; + } + export { outputs_1535 as outputs }; + } + export { ND_convert_vector2_surfaceshader_1 as ND_convert_vector2_surfaceshader }; + export namespace ND_convert_vector3_surfaceshader_1 { + let node_1536: string; + export { node_1536 as node }; + export namespace inputs_1536 { + let _in_542: string; + export { _in_542 as in }; + } + export { inputs_1536 as inputs }; + export namespace outputs_1536 { + let out_1506: string; + export { out_1506 as out }; + } + export { outputs_1536 as outputs }; + } + export { ND_convert_vector3_surfaceshader_1 as ND_convert_vector3_surfaceshader }; + export namespace ND_convert_vector4_surfaceshader_1 { + let node_1537: string; + export { node_1537 as node }; + export namespace inputs_1537 { + let _in_543: string; + export { _in_543 as in }; + } + export { inputs_1537 as inputs }; + export namespace outputs_1537 { + let out_1507: string; + export { out_1507 as out }; + } + export { outputs_1537 as outputs }; + } + export { ND_convert_vector4_surfaceshader_1 as ND_convert_vector4_surfaceshader }; + export namespace ND_convert_integer_surfaceshader_1 { + let node_1538: string; + export { node_1538 as node }; + export namespace inputs_1538 { + let _in_544: string; + export { _in_544 as in }; + } + export { inputs_1538 as inputs }; + export namespace outputs_1538 { + let out_1508: string; + export { out_1508 as out }; + } + export { outputs_1538 as outputs }; + } + export { ND_convert_integer_surfaceshader_1 as ND_convert_integer_surfaceshader }; + export namespace ND_convert_boolean_surfaceshader_1 { + let node_1539: string; + export { node_1539 as node }; + export namespace inputs_1539 { + let _in_545: string; + export { _in_545 as in }; + } + export { inputs_1539 as inputs }; + export namespace outputs_1539 { + let out_1509: string; + export { out_1509 as out }; + } + export { outputs_1539 as outputs }; + } + export { ND_convert_boolean_surfaceshader_1 as ND_convert_boolean_surfaceshader }; + export namespace ND_combine2_vector2_1 { + let node_1540: string; + export { node_1540 as node }; + export namespace inputs_1540 { + let in1_430: string; + export { in1_430 as in1 }; + let in2_430: string; + export { in2_430 as in2 }; + } + export { inputs_1540 as inputs }; + export namespace outputs_1540 { + let out_1510: string; + export { out_1510 as out }; + } + export { outputs_1540 as outputs }; + } + export { ND_combine2_vector2_1 as ND_combine2_vector2 }; + export namespace ND_combine2_color4CF_1 { + let node_1541: string; + export { node_1541 as node }; + export namespace inputs_1541 { + let in1_431: string; + export { in1_431 as in1 }; + let in2_431: string; + export { in2_431 as in2 }; + } + export { inputs_1541 as inputs }; + export namespace outputs_1541 { + let out_1511: string; + export { out_1511 as out }; + } + export { outputs_1541 as outputs }; + } + export { ND_combine2_color4CF_1 as ND_combine2_color4CF }; + export namespace ND_combine2_vector4VF_1 { + let node_1542: string; + export { node_1542 as node }; + export namespace inputs_1542 { + let in1_432: string; + export { in1_432 as in1 }; + let in2_432: string; + export { in2_432 as in2 }; + } + export { inputs_1542 as inputs }; + export namespace outputs_1542 { + let out_1512: string; + export { out_1512 as out }; + } + export { outputs_1542 as outputs }; + } + export { ND_combine2_vector4VF_1 as ND_combine2_vector4VF }; + export namespace ND_combine2_vector4VV_1 { + let node_1543: string; + export { node_1543 as node }; + export namespace inputs_1543 { + let in1_433: string; + export { in1_433 as in1 }; + let in2_433: string; + export { in2_433 as in2 }; + } + export { inputs_1543 as inputs }; + export namespace outputs_1543 { + let out_1513: string; + export { out_1513 as out }; + } + export { outputs_1543 as outputs }; + } + export { ND_combine2_vector4VV_1 as ND_combine2_vector4VV }; + export namespace ND_combine3_color3_1 { + let node_1544: string; + export { node_1544 as node }; + export namespace inputs_1544 { + let in1_434: string; + export { in1_434 as in1 }; + let in2_434: string; + export { in2_434 as in2 }; + let in3_39: string; + export { in3_39 as in3 }; + } + export { inputs_1544 as inputs }; + export namespace outputs_1544 { + let out_1514: string; + export { out_1514 as out }; + } + export { outputs_1544 as outputs }; + } + export { ND_combine3_color3_1 as ND_combine3_color3 }; + export namespace ND_combine3_vector3_1 { + let node_1545: string; + export { node_1545 as node }; + export namespace inputs_1545 { + let in1_435: string; + export { in1_435 as in1 }; + let in2_435: string; + export { in2_435 as in2 }; + let in3_40: string; + export { in3_40 as in3 }; + } + export { inputs_1545 as inputs }; + export namespace outputs_1545 { + let out_1515: string; + export { out_1515 as out }; + } + export { outputs_1545 as outputs }; + } + export { ND_combine3_vector3_1 as ND_combine3_vector3 }; + export namespace ND_combine4_color4_1 { + let node_1546: string; + export { node_1546 as node }; + export namespace inputs_1546 { + let in1_436: string; + export { in1_436 as in1 }; + let in2_436: string; + export { in2_436 as in2 }; + let in3_41: string; + export { in3_41 as in3 }; + let in4_36: string; + export { in4_36 as in4 }; + } + export { inputs_1546 as inputs }; + export namespace outputs_1546 { + let out_1516: string; + export { out_1516 as out }; + } + export { outputs_1546 as outputs }; + } + export { ND_combine4_color4_1 as ND_combine4_color4 }; + export namespace ND_combine4_vector4_1 { + let node_1547: string; + export { node_1547 as node }; + export namespace inputs_1547 { + let in1_437: string; + export { in1_437 as in1 }; + let in2_437: string; + export { in2_437 as in2 }; + let in3_42: string; + export { in3_42 as in3 }; + let in4_37: string; + export { in4_37 as in4 }; + } + export { inputs_1547 as inputs }; + export namespace outputs_1547 { + let out_1517: string; + export { out_1517 as out }; + } + export { outputs_1547 as outputs }; + } + export { ND_combine4_vector4_1 as ND_combine4_vector4 }; + export namespace ND_creatematrix_vector3_matrix33_1 { + let node_1548: string; + export { node_1548 as node }; + export namespace inputs_1548 { + let in1_438: string; + export { in1_438 as in1 }; + let in2_438: string; + export { in2_438 as in2 }; + let in3_43: string; + export { in3_43 as in3 }; + } + export { inputs_1548 as inputs }; + export namespace outputs_1548 { + let out_1518: string; + export { out_1518 as out }; + } + export { outputs_1548 as outputs }; + } + export { ND_creatematrix_vector3_matrix33_1 as ND_creatematrix_vector3_matrix33 }; + export namespace ND_creatematrix_vector3_matrix44_1 { + let node_1549: string; + export { node_1549 as node }; + export namespace inputs_1549 { + let in1_439: string; + export { in1_439 as in1 }; + let in2_439: string; + export { in2_439 as in2 }; + let in3_44: string; + export { in3_44 as in3 }; + let in4_38: string; + export { in4_38 as in4 }; + } + export { inputs_1549 as inputs }; + export namespace outputs_1549 { + let out_1519: string; + export { out_1519 as out }; + } + export { outputs_1549 as outputs }; + } + export { ND_creatematrix_vector3_matrix44_1 as ND_creatematrix_vector3_matrix44 }; + export namespace ND_creatematrix_vector4_matrix44_1 { + let node_1550: string; + export { node_1550 as node }; + export namespace inputs_1550 { + let in1_440: string; + export { in1_440 as in1 }; + let in2_440: string; + export { in2_440 as in2 }; + let in3_45: string; + export { in3_45 as in3 }; + let in4_39: string; + export { in4_39 as in4 }; + } + export { inputs_1550 as inputs }; + export namespace outputs_1550 { + let out_1520: string; + export { out_1520 as out }; + } + export { outputs_1550 as outputs }; + } + export { ND_creatematrix_vector4_matrix44_1 as ND_creatematrix_vector4_matrix44 }; + export namespace ND_extract_color3_1 { + let node_1551: string; + export { node_1551 as node }; + export namespace inputs_1551 { + let _in_546: string; + export { _in_546 as in }; + let index_21: string; + export { index_21 as index }; + } + export { inputs_1551 as inputs }; + export namespace outputs_1551 { + let out_1521: string; + export { out_1521 as out }; + } + export { outputs_1551 as outputs }; + } + export { ND_extract_color3_1 as ND_extract_color3 }; + export namespace ND_extract_color4_1 { + let node_1552: string; + export { node_1552 as node }; + export namespace inputs_1552 { + let _in_547: string; + export { _in_547 as in }; + let index_22: string; + export { index_22 as index }; + } + export { inputs_1552 as inputs }; + export namespace outputs_1552 { + let out_1522: string; + export { out_1522 as out }; + } + export { outputs_1552 as outputs }; + } + export { ND_extract_color4_1 as ND_extract_color4 }; + export namespace ND_extract_vector2_1 { + let node_1553: string; + export { node_1553 as node }; + export namespace inputs_1553 { + let _in_548: string; + export { _in_548 as in }; + let index_23: string; + export { index_23 as index }; + } + export { inputs_1553 as inputs }; + export namespace outputs_1553 { + let out_1523: string; + export { out_1523 as out }; + } + export { outputs_1553 as outputs }; + } + export { ND_extract_vector2_1 as ND_extract_vector2 }; + export namespace ND_extract_vector3_1 { + let node_1554: string; + export { node_1554 as node }; + export namespace inputs_1554 { + let _in_549: string; + export { _in_549 as in }; + let index_24: string; + export { index_24 as index }; + } + export { inputs_1554 as inputs }; + export namespace outputs_1554 { + let out_1524: string; + export { out_1524 as out }; + } + export { outputs_1554 as outputs }; + } + export { ND_extract_vector3_1 as ND_extract_vector3 }; + export namespace ND_extract_vector4_1 { + let node_1555: string; + export { node_1555 as node }; + export namespace inputs_1555 { + let _in_550: string; + export { _in_550 as in }; + let index_25: string; + export { index_25 as index }; + } + export { inputs_1555 as inputs }; + export namespace outputs_1555 { + let out_1525: string; + export { out_1525 as out }; + } + export { outputs_1555 as outputs }; + } + export { ND_extract_vector4_1 as ND_extract_vector4 }; + export namespace ND_extract_matrix33_1 { + let node_1556: string; + export { node_1556 as node }; + export namespace inputs_1556 { + let _in_551: string; + export { _in_551 as in }; + let index_26: string; + export { index_26 as index }; + } + export { inputs_1556 as inputs }; + export namespace outputs_1556 { + let out_1526: string; + export { out_1526 as out }; + } + export { outputs_1556 as outputs }; + } + export { ND_extract_matrix33_1 as ND_extract_matrix33 }; + export namespace ND_extract_matrix44_1 { + let node_1557: string; + export { node_1557 as node }; + export namespace inputs_1557 { + let _in_552: string; + export { _in_552 as in }; + let index_27: string; + export { index_27 as index }; + } + export { inputs_1557 as inputs }; + export namespace outputs_1557 { + let out_1527: string; + export { out_1527 as out }; + } + export { outputs_1557 as outputs }; + } + export { ND_extract_matrix44_1 as ND_extract_matrix44 }; + export namespace ND_separate2_vector2_1 { + let node_1558: string; + export { node_1558 as node }; + export namespace inputs_1558 { + let _in_553: string; + export { _in_553 as in }; + } + export { inputs_1558 as inputs }; + export namespace outputs_1558 { + let outx_3: string; + export { outx_3 as outx }; + let outy_3: string; + export { outy_3 as outy }; + } + export { outputs_1558 as outputs }; + } + export { ND_separate2_vector2_1 as ND_separate2_vector2 }; + export namespace ND_separate3_color3_1 { + let node_1559: string; + export { node_1559 as node }; + export namespace inputs_1559 { + let _in_554: string; + export { _in_554 as in }; + } + export { inputs_1559 as inputs }; + export namespace outputs_1559 { + let outr_2: string; + export { outr_2 as outr }; + let outg_2: string; + export { outg_2 as outg }; + let outb_2: string; + export { outb_2 as outb }; + } + export { outputs_1559 as outputs }; + } + export { ND_separate3_color3_1 as ND_separate3_color3 }; + export namespace ND_separate3_vector3_1 { + let node_1560: string; + export { node_1560 as node }; + export namespace inputs_1560 { + let _in_555: string; + export { _in_555 as in }; + } + export { inputs_1560 as inputs }; + export namespace outputs_1560 { + let outx_4: string; + export { outx_4 as outx }; + let outy_4: string; + export { outy_4 as outy }; + let outz_2: string; + export { outz_2 as outz }; + } + export { outputs_1560 as outputs }; + } + export { ND_separate3_vector3_1 as ND_separate3_vector3 }; + export namespace ND_separate4_color4_1 { + let node_1561: string; + export { node_1561 as node }; + export namespace inputs_1561 { + let _in_556: string; + export { _in_556 as in }; + } + export { inputs_1561 as inputs }; + export namespace outputs_1561 { + let outr_3: string; + export { outr_3 as outr }; + let outg_3: string; + export { outg_3 as outg }; + let outb_3: string; + export { outb_3 as outb }; + let outa_3: string; + export { outa_3 as outa }; + } + export { outputs_1561 as outputs }; + } + export { ND_separate4_color4_1 as ND_separate4_color4 }; + export namespace ND_separate4_vector4_1 { + let node_1562: string; + export { node_1562 as node }; + export namespace inputs_1562 { + let _in_557: string; + export { _in_557 as in }; + } + export { inputs_1562 as inputs }; + export namespace outputs_1562 { + let outx_5: string; + export { outx_5 as outx }; + let outy_5: string; + export { outy_5 as outy }; + let outz_3: string; + export { outz_3 as outz }; + let outw_1: string; + export { outw_1 as outw }; + } + export { outputs_1562 as outputs }; + } + export { ND_separate4_vector4_1 as ND_separate4_vector4 }; + export namespace ND_blur_float_1 { + let node_1563: string; + export { node_1563 as node }; + export namespace inputs_1563 { + let _in_558: string; + export { _in_558 as in }; + let size_16: string; + export { size_16 as size }; + let filtertype_58: string; + export { filtertype_58 as filtertype }; + } + export { inputs_1563 as inputs }; + export namespace outputs_1563 { + let out_1528: string; + export { out_1528 as out }; + } + export { outputs_1563 as outputs }; + } + export { ND_blur_float_1 as ND_blur_float }; + export namespace ND_blur_color3_1 { + let node_1564: string; + export { node_1564 as node }; + export namespace inputs_1564 { + let _in_559: string; + export { _in_559 as in }; + let size_17: string; + export { size_17 as size }; + let filtertype_59: string; + export { filtertype_59 as filtertype }; + } + export { inputs_1564 as inputs }; + export namespace outputs_1564 { + let out_1529: string; + export { out_1529 as out }; + } + export { outputs_1564 as outputs }; + } + export { ND_blur_color3_1 as ND_blur_color3 }; + export namespace ND_blur_color4_1 { + let node_1565: string; + export { node_1565 as node }; + export namespace inputs_1565 { + let _in_560: string; + export { _in_560 as in }; + let size_18: string; + export { size_18 as size }; + let filtertype_60: string; + export { filtertype_60 as filtertype }; + } + export { inputs_1565 as inputs }; + export namespace outputs_1565 { + let out_1530: string; + export { out_1530 as out }; + } + export { outputs_1565 as outputs }; + } + export { ND_blur_color4_1 as ND_blur_color4 }; + export namespace ND_blur_vector2_1 { + let node_1566: string; + export { node_1566 as node }; + export namespace inputs_1566 { + let _in_561: string; + export { _in_561 as in }; + let size_19: string; + export { size_19 as size }; + let filtertype_61: string; + export { filtertype_61 as filtertype }; + } + export { inputs_1566 as inputs }; + export namespace outputs_1566 { + let out_1531: string; + export { out_1531 as out }; + } + export { outputs_1566 as outputs }; + } + export { ND_blur_vector2_1 as ND_blur_vector2 }; + export namespace ND_blur_vector3_1 { + let node_1567: string; + export { node_1567 as node }; + export namespace inputs_1567 { + let _in_562: string; + export { _in_562 as in }; + let size_20: string; + export { size_20 as size }; + let filtertype_62: string; + export { filtertype_62 as filtertype }; + } + export { inputs_1567 as inputs }; + export namespace outputs_1567 { + let out_1532: string; + export { out_1532 as out }; + } + export { outputs_1567 as outputs }; + } + export { ND_blur_vector3_1 as ND_blur_vector3 }; + export namespace ND_blur_vector4_1 { + let node_1568: string; + export { node_1568 as node }; + export namespace inputs_1568 { + let _in_563: string; + export { _in_563 as in }; + let size_21: string; + export { size_21 as size }; + let filtertype_63: string; + export { filtertype_63 as filtertype }; + } + export { inputs_1568 as inputs }; + export namespace outputs_1568 { + let out_1533: string; + export { out_1533 as out }; + } + export { outputs_1568 as outputs }; + } + export { ND_blur_vector4_1 as ND_blur_vector4 }; + export namespace ND_heighttonormal_vector3_1 { + let node_1569: string; + export { node_1569 as node }; + export namespace inputs_1569 { + let _in_564: string; + export { _in_564 as in }; + let scale_40: string; + export { scale_40 as scale }; + let texcoord_187: string; + export { texcoord_187 as texcoord }; + } + export { inputs_1569 as inputs }; + export namespace outputs_1569 { + let out_1534: string; + export { out_1534 as out }; + } + export { outputs_1569 as outputs }; + } + export { ND_heighttonormal_vector3_1 as ND_heighttonormal_vector3 }; + export namespace ND_logical_and_1 { + let node_1570: string; + export { node_1570 as node }; + export namespace inputs_1570 { + let in1_441: string; + export { in1_441 as in1 }; + let in2_441: string; + export { in2_441 as in2 }; + } + export { inputs_1570 as inputs }; + export namespace outputs_1570 { + let out_1535: string; + export { out_1535 as out }; + } + export { outputs_1570 as outputs }; + } + export { ND_logical_and_1 as ND_logical_and }; + export namespace ND_logical_or_1 { + let node_1571: string; + export { node_1571 as node }; + export namespace inputs_1571 { + let in1_442: string; + export { in1_442 as in1 }; + let in2_442: string; + export { in2_442 as in2 }; + } + export { inputs_1571 as inputs }; + export namespace outputs_1571 { + let out_1536: string; + export { out_1536 as out }; + } + export { outputs_1571 as outputs }; + } + export { ND_logical_or_1 as ND_logical_or }; + export namespace ND_logical_xor_1 { + let node_1572: string; + export { node_1572 as node }; + export namespace inputs_1572 { + let in1_443: string; + export { in1_443 as in1 }; + let in2_443: string; + export { in2_443 as in2 }; + } + export { inputs_1572 as inputs }; + export namespace outputs_1572 { + let out_1537: string; + export { out_1537 as out }; + } + export { outputs_1572 as outputs }; + } + export { ND_logical_xor_1 as ND_logical_xor }; + export namespace ND_logical_not_1 { + let node_1573: string; + export { node_1573 as node }; + export namespace inputs_1573 { + let _in_565: string; + export { _in_565 as in }; + } + export { inputs_1573 as inputs }; + export namespace outputs_1573 { + let out_1538: string; + export { out_1538 as out }; + } + export { outputs_1573 as outputs }; + } + export { ND_logical_not_1 as ND_logical_not }; + export namespace ND_dot_float_1 { + let node_1574: string; + export { node_1574 as node }; + export namespace inputs_1574 { + let _in_566: string; + export { _in_566 as in }; + let note_16: string; + export { note_16 as note }; + } + export { inputs_1574 as inputs }; + export namespace outputs_1574 { + let out_1539: string; + export { out_1539 as out }; + } + export { outputs_1574 as outputs }; + } + export { ND_dot_float_1 as ND_dot_float }; + export namespace ND_dot_color3_1 { + let node_1575: string; + export { node_1575 as node }; + export namespace inputs_1575 { + let _in_567: string; + export { _in_567 as in }; + let note_17: string; + export { note_17 as note }; + } + export { inputs_1575 as inputs }; + export namespace outputs_1575 { + let out_1540: string; + export { out_1540 as out }; + } + export { outputs_1575 as outputs }; + } + export { ND_dot_color3_1 as ND_dot_color3 }; + export namespace ND_dot_color4_1 { + let node_1576: string; + export { node_1576 as node }; + export namespace inputs_1576 { + let _in_568: string; + export { _in_568 as in }; + let note_18: string; + export { note_18 as note }; + } + export { inputs_1576 as inputs }; + export namespace outputs_1576 { + let out_1541: string; + export { out_1541 as out }; + } + export { outputs_1576 as outputs }; + } + export { ND_dot_color4_1 as ND_dot_color4 }; + export namespace ND_dot_vector2_1 { + let node_1577: string; + export { node_1577 as node }; + export namespace inputs_1577 { + let _in_569: string; + export { _in_569 as in }; + let note_19: string; + export { note_19 as note }; + } + export { inputs_1577 as inputs }; + export namespace outputs_1577 { + let out_1542: string; + export { out_1542 as out }; + } + export { outputs_1577 as outputs }; + } + export { ND_dot_vector2_1 as ND_dot_vector2 }; + export namespace ND_dot_vector3_1 { + let node_1578: string; + export { node_1578 as node }; + export namespace inputs_1578 { + let _in_570: string; + export { _in_570 as in }; + let note_20: string; + export { note_20 as note }; + } + export { inputs_1578 as inputs }; + export namespace outputs_1578 { + let out_1543: string; + export { out_1543 as out }; + } + export { outputs_1578 as outputs }; + } + export { ND_dot_vector3_1 as ND_dot_vector3 }; + export namespace ND_dot_vector4_1 { + let node_1579: string; + export { node_1579 as node }; + export namespace inputs_1579 { + let _in_571: string; + export { _in_571 as in }; + let note_21: string; + export { note_21 as note }; + } + export { inputs_1579 as inputs }; + export namespace outputs_1579 { + let out_1544: string; + export { out_1544 as out }; + } + export { outputs_1579 as outputs }; + } + export { ND_dot_vector4_1 as ND_dot_vector4 }; + export namespace ND_dot_boolean_1 { + let node_1580: string; + export { node_1580 as node }; + export namespace inputs_1580 { + let _in_572: string; + export { _in_572 as in }; + let note_22: string; + export { note_22 as note }; + } + export { inputs_1580 as inputs }; + export namespace outputs_1580 { + let out_1545: string; + export { out_1545 as out }; + } + export { outputs_1580 as outputs }; + } + export { ND_dot_boolean_1 as ND_dot_boolean }; + export namespace ND_dot_integer_1 { + let node_1581: string; + export { node_1581 as node }; + export namespace inputs_1581 { + let _in_573: string; + export { _in_573 as in }; + let note_23: string; + export { note_23 as note }; + } + export { inputs_1581 as inputs }; + export namespace outputs_1581 { + let out_1546: string; + export { out_1546 as out }; + } + export { outputs_1581 as outputs }; + } + export { ND_dot_integer_1 as ND_dot_integer }; + export namespace ND_dot_matrix33_1 { + let node_1582: string; + export { node_1582 as node }; + export namespace inputs_1582 { + let _in_574: string; + export { _in_574 as in }; + let note_24: string; + export { note_24 as note }; + } + export { inputs_1582 as inputs }; + export namespace outputs_1582 { + let out_1547: string; + export { out_1547 as out }; + } + export { outputs_1582 as outputs }; + } + export { ND_dot_matrix33_1 as ND_dot_matrix33 }; + export namespace ND_dot_matrix44_1 { + let node_1583: string; + export { node_1583 as node }; + export namespace inputs_1583 { + let _in_575: string; + export { _in_575 as in }; + let note_25: string; + export { note_25 as note }; + } + export { inputs_1583 as inputs }; + export namespace outputs_1583 { + let out_1548: string; + export { out_1548 as out }; + } + export { outputs_1583 as outputs }; + } + export { ND_dot_matrix44_1 as ND_dot_matrix44 }; + export namespace ND_dot_string_1 { + let node_1584: string; + export { node_1584 as node }; + export namespace inputs_1584 { + let _in_576: string; + export { _in_576 as in }; + let note_26: string; + export { note_26 as note }; + } + export { inputs_1584 as inputs }; + export namespace outputs_1584 { + let out_1549: string; + export { out_1549 as out }; + } + export { outputs_1584 as outputs }; + } + export { ND_dot_string_1 as ND_dot_string }; + export namespace ND_dot_filename_1 { + let node_1585: string; + export { node_1585 as node }; + export namespace inputs_1585 { + let _in_577: string; + export { _in_577 as in }; + let note_27: string; + export { note_27 as note }; + } + export { inputs_1585 as inputs }; + export namespace outputs_1585 { + let out_1550: string; + export { out_1550 as out }; + } + export { outputs_1585 as outputs }; + } + export { ND_dot_filename_1 as ND_dot_filename }; + export namespace ND_dot_surfaceshader_1 { + let node_1586: string; + export { node_1586 as node }; + export namespace inputs_1586 { + let _in_578: string; + export { _in_578 as in }; + let note_28: string; + export { note_28 as note }; + } + export { inputs_1586 as inputs }; + export namespace outputs_1586 { + let out_1551: string; + export { out_1551 as out }; + } + export { outputs_1586 as outputs }; + } + export { ND_dot_surfaceshader_1 as ND_dot_surfaceshader }; + export namespace ND_dot_displacementshader_1 { + let node_1587: string; + export { node_1587 as node }; + export namespace inputs_1587 { + let _in_579: string; + export { _in_579 as in }; + let note_29: string; + export { note_29 as note }; + } + export { inputs_1587 as inputs }; + export namespace outputs_1587 { + let out_1552: string; + export { out_1552 as out }; + } + export { outputs_1587 as outputs }; + } + export { ND_dot_displacementshader_1 as ND_dot_displacementshader }; + export namespace ND_dot_volumeshader_1 { + let node_1588: string; + export { node_1588 as node }; + export namespace inputs_1588 { + let _in_580: string; + export { _in_580 as in }; + let note_30: string; + export { note_30 as note }; + } + export { inputs_1588 as inputs }; + export namespace outputs_1588 { + let out_1553: string; + export { out_1553 as out }; + } + export { outputs_1588 as outputs }; + } + export { ND_dot_volumeshader_1 as ND_dot_volumeshader }; + export namespace ND_dot_lightshader_1 { + let node_1589: string; + export { node_1589 as node }; + export namespace inputs_1589 { + let _in_581: string; + export { _in_581 as in }; + let note_31: string; + export { note_31 as note }; + } + export { inputs_1589 as inputs }; + export namespace outputs_1589 { + let out_1554: string; + export { out_1554 as out }; + } + export { outputs_1589 as outputs }; + } + export { ND_dot_lightshader_1 as ND_dot_lightshader }; + export namespace ND_point_light_1 { + let node_1590: string; + export { node_1590 as node }; + export namespace inputs_1590 { + let position_70: string; + export { position_70 as position }; + let color_28: string; + export { color_28 as color }; + let intensity_5: string; + export { intensity_5 as intensity }; + let decay_rate_2: string; + export { decay_rate_2 as decay_rate }; + } + export { inputs_1590 as inputs }; + export namespace outputs_1590 { + let out_1555: string; + export { out_1555 as out }; + } + export { outputs_1590 as outputs }; + } + export { ND_point_light_1 as ND_point_light }; + export namespace ND_directional_light_1 { + let node_1591: string; + export { node_1591 as node }; + export namespace inputs_1591 { + let direction_3: string; + export { direction_3 as direction }; + let color_29: string; + export { color_29 as color }; + let intensity_6: string; + export { intensity_6 as intensity }; + } + export { inputs_1591 as inputs }; + export namespace outputs_1591 { + let out_1556: string; + export { out_1556 as out }; + } + export { outputs_1591 as outputs }; + } + export { ND_directional_light_1 as ND_directional_light }; + export namespace ND_spot_light_1 { + let node_1592: string; + export { node_1592 as node }; + export namespace inputs_1592 { + let position_71: string; + export { position_71 as position }; + let direction_4: string; + export { direction_4 as direction }; + let color_30: string; + export { color_30 as color }; + let intensity_7: string; + export { intensity_7 as intensity }; + let decay_rate_3: string; + export { decay_rate_3 as decay_rate }; + let inner_angle_3: string; + export { inner_angle_3 as inner_angle }; + let outer_angle_3: string; + export { outer_angle_3 as outer_angle }; + } + export { inputs_1592 as inputs }; + export namespace outputs_1592 { + let out_1557: string; + export { out_1557 as out }; + } + export { outputs_1592 as outputs }; + } + export { ND_spot_light_1 as ND_spot_light }; + export namespace ND_open_pbr_surface_to_standard_surface_1 { + let node_1593: string; + export { node_1593 as node }; + export namespace inputs_1593 { + let base_weight_3: string; + export { base_weight_3 as base_weight }; + let base_color_12: string; + export { base_color_12 as base_color }; + let base_diffuse_roughness_3: string; + export { base_diffuse_roughness_3 as base_diffuse_roughness }; + let base_metalness_3: string; + export { base_metalness_3 as base_metalness }; + let specular_weight_3: string; + export { specular_weight_3 as specular_weight }; + let specular_color_11: string; + export { specular_color_11 as specular_color }; + let specular_roughness_9: string; + export { specular_roughness_9 as specular_roughness }; + let specular_ior_3: string; + export { specular_ior_3 as specular_ior }; + let specular_roughness_anisotropy_3: string; + export { specular_roughness_anisotropy_3 as specular_roughness_anisotropy }; + let transmission_weight_3: string; + export { transmission_weight_3 as transmission_weight }; + let transmission_color_10: string; + export { transmission_color_10 as transmission_color }; + let transmission_depth_8: string; + export { transmission_depth_8 as transmission_depth }; + let transmission_scatter_7: string; + export { transmission_scatter_7 as transmission_scatter }; + let transmission_scatter_anisotropy_7: string; + export { transmission_scatter_anisotropy_7 as transmission_scatter_anisotropy }; + let transmission_dispersion_scale_3: string; + export { transmission_dispersion_scale_3 as transmission_dispersion_scale }; + let subsurface_weight_3: string; + export { subsurface_weight_3 as subsurface_weight }; + let subsurface_color_8: string; + export { subsurface_color_8 as subsurface_color }; + let subsurface_radius_7: string; + export { subsurface_radius_7 as subsurface_radius }; + let subsurface_radius_scale_3: string; + export { subsurface_radius_scale_3 as subsurface_radius_scale }; + let subsurface_scatter_anisotropy_3: string; + export { subsurface_scatter_anisotropy_3 as subsurface_scatter_anisotropy }; + let fuzz_weight_3: string; + export { fuzz_weight_3 as fuzz_weight }; + let fuzz_color_3: string; + export { fuzz_color_3 as fuzz_color }; + let fuzz_roughness_3: string; + export { fuzz_roughness_3 as fuzz_roughness }; + let coat_weight_3: string; + export { coat_weight_3 as coat_weight }; + let coat_color_9: string; + export { coat_color_9 as coat_color }; + let coat_roughness_9: string; + export { coat_roughness_9 as coat_roughness }; + let coat_roughness_anisotropy_3: string; + export { coat_roughness_anisotropy_3 as coat_roughness_anisotropy }; + let coat_ior_3: string; + export { coat_ior_3 as coat_ior }; + let coat_darkening_3: string; + export { coat_darkening_3 as coat_darkening }; + let thin_film_weight_3: string; + export { thin_film_weight_3 as thin_film_weight }; + let thin_film_thickness_7: string; + export { thin_film_thickness_7 as thin_film_thickness }; + let thin_film_ior_3: string; + export { thin_film_ior_3 as thin_film_ior }; + let emission_luminance_3: string; + export { emission_luminance_3 as emission_luminance }; + let emission_color_11: string; + export { emission_color_11 as emission_color }; + let geometry_opacity_3: string; + export { geometry_opacity_3 as geometry_opacity }; + let geometry_thin_walled_3: string; + export { geometry_thin_walled_3 as geometry_thin_walled }; + } + export { inputs_1593 as inputs }; + export namespace outputs_1593 { + let base_out_1: string; + export { base_out_1 as base_out }; + let base_color_out_3: string; + export { base_color_out_3 as base_color_out }; + let diffuse_roughness_out_1: string; + export { diffuse_roughness_out_1 as diffuse_roughness_out }; + let metalness_out_1: string; + export { metalness_out_1 as metalness_out }; + let specular_out_2: string; + export { specular_out_2 as specular_out }; + let specular_color_out_3: string; + export { specular_color_out_3 as specular_color_out }; + let specular_roughness_out_2: string; + export { specular_roughness_out_2 as specular_roughness_out }; + let specular_IOR_out_1: string; + export { specular_IOR_out_1 as specular_IOR_out }; + let specular_anisotropy_out_1: string; + export { specular_anisotropy_out_1 as specular_anisotropy_out }; + let transmission_out_2: string; + export { transmission_out_2 as transmission_out }; + let transmission_color_out_2: string; + export { transmission_color_out_2 as transmission_color_out }; + let transmission_depth_out_2: string; + export { transmission_depth_out_2 as transmission_depth_out }; + let transmission_scatter_out_2: string; + export { transmission_scatter_out_2 as transmission_scatter_out }; + let transmission_scatter_anisotropy_out_2: string; + export { transmission_scatter_anisotropy_out_2 as transmission_scatter_anisotropy_out }; + let transmission_dispersion_out_1: string; + export { transmission_dispersion_out_1 as transmission_dispersion_out }; + let subsurface_out_1: string; + export { subsurface_out_1 as subsurface_out }; + let subsurface_color_out_2: string; + export { subsurface_color_out_2 as subsurface_color_out }; + let subsurface_radius_out_2: string; + export { subsurface_radius_out_2 as subsurface_radius_out }; + let subsurface_scale_out_1: string; + export { subsurface_scale_out_1 as subsurface_scale_out }; + let subsurface_anisotropy_out_1: string; + export { subsurface_anisotropy_out_1 as subsurface_anisotropy_out }; + let sheen_out_1: string; + export { sheen_out_1 as sheen_out }; + let sheen_color_out_2: string; + export { sheen_color_out_2 as sheen_color_out }; + let sheen_roughness_out_2: string; + export { sheen_roughness_out_2 as sheen_roughness_out }; + let coat_out_1: string; + export { coat_out_1 as coat_out }; + let coat_color_out_2: string; + export { coat_color_out_2 as coat_color_out }; + let coat_roughness_out_2: string; + export { coat_roughness_out_2 as coat_roughness_out }; + let coat_anisotropy_out_1: string; + export { coat_anisotropy_out_1 as coat_anisotropy_out }; + let coat_IOR_out_1: string; + export { coat_IOR_out_1 as coat_IOR_out }; + let coat_affect_roughness_out_1: string; + export { coat_affect_roughness_out_1 as coat_affect_roughness_out }; + let thin_film_thickness_out_2: string; + export { thin_film_thickness_out_2 as thin_film_thickness_out }; + let thin_film_IOR_out_1: string; + export { thin_film_IOR_out_1 as thin_film_IOR_out }; + let emission_out_1: string; + export { emission_out_1 as emission_out }; + let emission_color_out_2: string; + export { emission_color_out_2 as emission_color_out }; + let opacity_out_2: string; + export { opacity_out_2 as opacity_out }; + let thin_walled_out_1: string; + export { thin_walled_out_1 as thin_walled_out }; + } + export { outputs_1593 as outputs }; + } + export { ND_open_pbr_surface_to_standard_surface_1 as ND_open_pbr_surface_to_standard_surface }; + export namespace ND_standard_surface_to_open_pbr_surface_1 { + let node_1594: string; + export { node_1594 as node }; + export namespace inputs_1594 { + let base_13: string; + export { base_13 as base }; + let base_color_13: string; + export { base_color_13 as base_color }; + let diffuse_roughness_4: string; + export { diffuse_roughness_4 as diffuse_roughness }; + let metalness_6: string; + export { metalness_6 as metalness }; + let specular_10: string; + export { specular_10 as specular }; + let specular_color_12: string; + export { specular_color_12 as specular_color }; + let specular_roughness_10: string; + export { specular_roughness_10 as specular_roughness }; + let specular_IOR_6: string; + export { specular_IOR_6 as specular_IOR }; + let specular_anisotropy_5: string; + export { specular_anisotropy_5 as specular_anisotropy }; + let transmission_9: string; + export { transmission_9 as transmission }; + let transmission_color_11: string; + export { transmission_color_11 as transmission_color }; + let transmission_depth_9: string; + export { transmission_depth_9 as transmission_depth }; + let transmission_scatter_8: string; + export { transmission_scatter_8 as transmission_scatter }; + let transmission_scatter_anisotropy_8: string; + export { transmission_scatter_anisotropy_8 as transmission_scatter_anisotropy }; + let transmission_dispersion_5: string; + export { transmission_dispersion_5 as transmission_dispersion }; + let subsurface_7: string; + export { subsurface_7 as subsurface }; + let subsurface_color_9: string; + export { subsurface_color_9 as subsurface_color }; + let subsurface_radius_8: string; + export { subsurface_radius_8 as subsurface_radius }; + let subsurface_scale_4: string; + export { subsurface_scale_4 as subsurface_scale }; + let subsurface_anisotropy_4: string; + export { subsurface_anisotropy_4 as subsurface_anisotropy }; + let sheen_7: string; + export { sheen_7 as sheen }; + let sheen_color_7: string; + export { sheen_color_7 as sheen_color }; + let sheen_roughness_7: string; + export { sheen_roughness_7 as sheen_roughness }; + let coat_6: string; + export { coat_6 as coat }; + let coat_color_10: string; + export { coat_color_10 as coat_color }; + let coat_roughness_10: string; + export { coat_roughness_10 as coat_roughness }; + let coat_anisotropy_4: string; + export { coat_anisotropy_4 as coat_anisotropy }; + let coat_IOR_4: string; + export { coat_IOR_4 as coat_IOR }; + let coat_affect_roughness_4: string; + export { coat_affect_roughness_4 as coat_affect_roughness }; + let thin_film_thickness_8: string; + export { thin_film_thickness_8 as thin_film_thickness }; + let thin_film_IOR_4: string; + export { thin_film_IOR_4 as thin_film_IOR }; + let emission_8: string; + export { emission_8 as emission }; + let emission_color_12: string; + export { emission_color_12 as emission_color }; + let opacity_12: string; + export { opacity_12 as opacity }; + let thin_walled_7: string; + export { thin_walled_7 as thin_walled }; + } + export { inputs_1594 as inputs }; + export namespace outputs_1594 { + let base_weight_out_1: string; + export { base_weight_out_1 as base_weight_out }; + let base_color_out_4: string; + export { base_color_out_4 as base_color_out }; + let base_diffuse_roughness_out_1: string; + export { base_diffuse_roughness_out_1 as base_diffuse_roughness_out }; + let base_metalness_out_1: string; + export { base_metalness_out_1 as base_metalness_out }; + let specular_weight_out_1: string; + export { specular_weight_out_1 as specular_weight_out }; + let specular_color_out_4: string; + export { specular_color_out_4 as specular_color_out }; + let specular_roughness_out_3: string; + export { specular_roughness_out_3 as specular_roughness_out }; + let specular_ior_out_1: string; + export { specular_ior_out_1 as specular_ior_out }; + let specular_roughness_anisotropy_out_1: string; + export { specular_roughness_anisotropy_out_1 as specular_roughness_anisotropy_out }; + let transmission_weight_out_1: string; + export { transmission_weight_out_1 as transmission_weight_out }; + let transmission_color_out_3: string; + export { transmission_color_out_3 as transmission_color_out }; + let transmission_depth_out_3: string; + export { transmission_depth_out_3 as transmission_depth_out }; + let transmission_scatter_out_3: string; + export { transmission_scatter_out_3 as transmission_scatter_out }; + let transmission_scatter_anisotropy_out_3: string; + export { transmission_scatter_anisotropy_out_3 as transmission_scatter_anisotropy_out }; + let transmission_dispersion_scale_out_1: string; + export { transmission_dispersion_scale_out_1 as transmission_dispersion_scale_out }; + let subsurface_weight_out_1: string; + export { subsurface_weight_out_1 as subsurface_weight_out }; + let subsurface_color_out_3: string; + export { subsurface_color_out_3 as subsurface_color_out }; + let subsurface_radius_out_3: string; + export { subsurface_radius_out_3 as subsurface_radius_out }; + let subsurface_radius_scale_out_1: string; + export { subsurface_radius_scale_out_1 as subsurface_radius_scale_out }; + let subsurface_scatter_anisotropy_out_1: string; + export { subsurface_scatter_anisotropy_out_1 as subsurface_scatter_anisotropy_out }; + let fuzz_weight_out_1: string; + export { fuzz_weight_out_1 as fuzz_weight_out }; + let fuzz_color_out_1: string; + export { fuzz_color_out_1 as fuzz_color_out }; + let fuzz_roughness_out_1: string; + export { fuzz_roughness_out_1 as fuzz_roughness_out }; + let coat_weight_out_1: string; + export { coat_weight_out_1 as coat_weight_out }; + let coat_color_out_3: string; + export { coat_color_out_3 as coat_color_out }; + let coat_roughness_out_3: string; + export { coat_roughness_out_3 as coat_roughness_out }; + let coat_roughness_anisotropy_out_1: string; + export { coat_roughness_anisotropy_out_1 as coat_roughness_anisotropy_out }; + let coat_ior_out_1: string; + export { coat_ior_out_1 as coat_ior_out }; + let coat_darkening_out_1: string; + export { coat_darkening_out_1 as coat_darkening_out }; + let thin_film_weight_out_1: string; + export { thin_film_weight_out_1 as thin_film_weight_out }; + let thin_film_thickness_out_3: string; + export { thin_film_thickness_out_3 as thin_film_thickness_out }; + let thin_film_ior_out_1: string; + export { thin_film_ior_out_1 as thin_film_ior_out }; + let emission_luminance_out_1: string; + export { emission_luminance_out_1 as emission_luminance_out }; + let emission_color_out_3: string; + export { emission_color_out_3 as emission_color_out }; + let geometry_opacity_out_1: string; + export { geometry_opacity_out_1 as geometry_opacity_out }; + let geometry_thin_walled_out_1: string; + export { geometry_thin_walled_out_1 as geometry_thin_walled_out }; + } + export { outputs_1594 as outputs }; + } + export { ND_standard_surface_to_open_pbr_surface_1 as ND_standard_surface_to_open_pbr_surface }; + export namespace ND_standard_surface_to_UsdPreviewSurface_1 { + let node_1595: string; + export { node_1595 as node }; + export namespace inputs_1595 { + let metalness_7: string; + export { metalness_7 as metalness }; + let base_14: string; + export { base_14 as base }; + let base_color_14: string; + export { base_color_14 as base_color }; + let specular_11: string; + export { specular_11 as specular }; + let specular_color_13: string; + export { specular_color_13 as specular_color }; + let specular_IOR_7: string; + export { specular_IOR_7 as specular_IOR }; + let specular_roughness_11: string; + export { specular_roughness_11 as specular_roughness }; + let coat_7: string; + export { coat_7 as coat }; + let coat_color_11: string; + export { coat_color_11 as coat_color }; + let coat_roughness_11: string; + export { coat_roughness_11 as coat_roughness }; + let subsurface_8: string; + export { subsurface_8 as subsurface }; + let subsurface_color_10: string; + export { subsurface_color_10 as subsurface_color }; + let emission_9: string; + export { emission_9 as emission }; + let emission_color_13: string; + export { emission_color_13 as emission_color }; + let opacity_13: string; + export { opacity_13 as opacity }; + let normal_68: string; + export { normal_68 as normal }; + } + export { inputs_1595 as inputs }; + export namespace outputs_1595 { + let diffuseColor_out_1: string; + export { diffuseColor_out_1 as diffuseColor_out }; + let emissiveColor_out_1: string; + export { emissiveColor_out_1 as emissiveColor_out }; + let metallic_out_2: string; + export { metallic_out_2 as metallic_out }; + let roughness_out_2: string; + export { roughness_out_2 as roughness_out }; + let clearcoat_out_2: string; + export { clearcoat_out_2 as clearcoat_out }; + let clearcoatRoughness_out_1: string; + export { clearcoatRoughness_out_1 as clearcoatRoughness_out }; + let opacity_out_3: string; + export { opacity_out_3 as opacity_out }; + let ior_out_2: string; + export { ior_out_2 as ior_out }; + let normal_out_2: string; + export { normal_out_2 as normal_out }; + } + export { outputs_1595 as outputs }; + } + export { ND_standard_surface_to_UsdPreviewSurface_1 as ND_standard_surface_to_UsdPreviewSurface }; + export namespace ND_standard_surface_to_gltf_pbr_1 { + let node_1596: string; + export { node_1596 as node }; + export namespace inputs_1596 { + let base_15: string; + export { base_15 as base }; + let base_color_15: string; + export { base_color_15 as base_color }; + let metalness_8: string; + export { metalness_8 as metalness }; + let specular_12: string; + export { specular_12 as specular }; + let specular_color_14: string; + export { specular_color_14 as specular_color }; + let specular_anisotropy_6: string; + export { specular_anisotropy_6 as specular_anisotropy }; + let specular_rotation_4: string; + export { specular_rotation_4 as specular_rotation }; + let specular_roughness_12: string; + export { specular_roughness_12 as specular_roughness }; + let specular_IOR_8: string; + export { specular_IOR_8 as specular_IOR }; + let transmission_10: string; + export { transmission_10 as transmission }; + let transmission_color_12: string; + export { transmission_color_12 as transmission_color }; + let transmission_depth_10: string; + export { transmission_depth_10 as transmission_depth }; + let transmission_dispersion_6: string; + export { transmission_dispersion_6 as transmission_dispersion }; + let sheen_8: string; + export { sheen_8 as sheen }; + let sheen_color_8: string; + export { sheen_color_8 as sheen_color }; + let sheen_roughness_8: string; + export { sheen_roughness_8 as sheen_roughness }; + let coat_8: string; + export { coat_8 as coat }; + let coat_color_12: string; + export { coat_color_12 as coat_color }; + let coat_roughness_12: string; + export { coat_roughness_12 as coat_roughness }; + let emission_10: string; + export { emission_10 as emission }; + let emission_color_14: string; + export { emission_color_14 as emission_color }; + let normal_69: string; + export { normal_69 as normal }; + let tangent_24: string; + export { tangent_24 as tangent }; + let opacity_14: string; + export { opacity_14 as opacity }; + let thin_walled_8: string; + export { thin_walled_8 as thin_walled }; + } + export { inputs_1596 as inputs }; + export namespace outputs_1596 { + let base_color_out_5: string; + export { base_color_out_5 as base_color_out }; + let metallic_out_3: string; + export { metallic_out_3 as metallic_out }; + let roughness_out_3: string; + export { roughness_out_3 as roughness_out }; + let specular_out_3: string; + export { specular_out_3 as specular_out }; + let specular_color_out_5: string; + export { specular_color_out_5 as specular_color_out }; + let ior_out_3: string; + export { ior_out_3 as ior_out }; + let anisotropy_strength_out_3: string; + export { anisotropy_strength_out_3 as anisotropy_strength_out }; + let anisotropy_rotation_out_3: string; + export { anisotropy_rotation_out_3 as anisotropy_rotation_out }; + let transmission_out_3: string; + export { transmission_out_3 as transmission_out }; + let thickness_out_1: string; + export { thickness_out_1 as thickness_out }; + let attenuation_color_out_1: string; + export { attenuation_color_out_1 as attenuation_color_out }; + let attenuation_distance_out_1: string; + export { attenuation_distance_out_1 as attenuation_distance_out }; + let sheen_color_out_3: string; + export { sheen_color_out_3 as sheen_color_out }; + let sheen_roughness_out_3: string; + export { sheen_roughness_out_3 as sheen_roughness_out }; + let clearcoat_out_3: string; + export { clearcoat_out_3 as clearcoat_out }; + let clearcoat_roughness_out_1: string; + export { clearcoat_roughness_out_1 as clearcoat_roughness_out }; + let dispersion_out_1: string; + export { dispersion_out_1 as dispersion_out }; + let emissive_out_1: string; + export { emissive_out_1 as emissive_out }; + let emissive_strength_out_1: string; + export { emissive_strength_out_1 as emissive_strength_out }; + let normal_out_3: string; + export { normal_out_3 as normal_out }; + let tangent_out_1: string; + export { tangent_out_1 as tangent_out }; + let alpha_out_1: string; + export { alpha_out_1 as alpha_out }; + let alpha_mode_out_1: string; + export { alpha_mode_out_1 as alpha_mode_out }; + } + export { outputs_1596 as outputs }; + } + export { ND_standard_surface_to_gltf_pbr_1 as ND_standard_surface_to_gltf_pbr }; + export namespace ND_lama_sheen_1 { + let node_1597: string; + export { node_1597 as node }; + export namespace inputs_1597 { + let color_31: string; + export { color_31 as color }; + let roughness_35: string; + export { roughness_35 as roughness }; + let normal_70: string; + export { normal_70 as normal }; + } + export { inputs_1597 as inputs }; + export namespace outputs_1597 { + let out_1558: string; + export { out_1558 as out }; + } + export { outputs_1597 as outputs }; + } + export { ND_lama_sheen_1 as ND_lama_sheen }; + export namespace ND_lama_sss_1 { + let node_1598: string; + export { node_1598 as node }; + export namespace inputs_1598 { + let color_32: string; + export { color_32 as color }; + let normal_71: string; + export { normal_71 as normal }; + let sssRadius_1: string; + export { sssRadius_1 as sssRadius }; + let sssScale_1: string; + export { sssScale_1 as sssScale }; + let sssMode_1: string; + export { sssMode_1 as sssMode }; + let sssIOR_1: string; + export { sssIOR_1 as sssIOR }; + let sssAnisotropy_1: string; + export { sssAnisotropy_1 as sssAnisotropy }; + let sssBleed_1: string; + export { sssBleed_1 as sssBleed }; + let sssFollowTopology_1: string; + export { sssFollowTopology_1 as sssFollowTopology }; + let sssSubset_1: string; + export { sssSubset_1 as sssSubset }; + let sssContinuationRays_1: string; + export { sssContinuationRays_1 as sssContinuationRays }; + let sssUnitLength_1: string; + export { sssUnitLength_1 as sssUnitLength }; + let mode_3: string; + export { mode_3 as mode }; + let albedoInversionMethod_1: string; + export { albedoInversionMethod_1 as albedoInversionMethod }; + } + export { inputs_1598 as inputs }; + export namespace outputs_1598 { + let out_1559: string; + export { out_1559 as out }; + } + export { outputs_1598 as outputs }; + } + export { ND_lama_sss_1 as ND_lama_sss }; + export namespace ND_lama_dielectric_1 { + let node_1599: string; + export { node_1599 as node }; + export namespace inputs_1599 { + let reflectionTint_2: string; + export { reflectionTint_2 as reflectionTint }; + let transmissionTint_2: string; + export { transmissionTint_2 as transmissionTint }; + let fresnelMode_3: string; + export { fresnelMode_3 as fresnelMode }; + let IOR_3: string; + export { IOR_3 as IOR }; + let reflectivity_5: string; + export { reflectivity_5 as reflectivity }; + let roughness_36: string; + export { roughness_36 as roughness }; + let normal_72: string; + export { normal_72 as normal }; + let anisotropy_14: string; + export { anisotropy_14 as anisotropy }; + let direction_5: string; + export { direction_5 as direction }; + let rotation_11: string; + export { rotation_11 as rotation }; + let absorptionColor_2: string; + export { absorptionColor_2 as absorptionColor }; + let absorptionRadius_2: string; + export { absorptionRadius_2 as absorptionRadius }; + let scatterColor_2: string; + export { scatterColor_2 as scatterColor }; + let scatterAnisotropy_2: string; + export { scatterAnisotropy_2 as scatterAnisotropy }; + } + export { inputs_1599 as inputs }; + export namespace outputs_1599 { + let out_1560: string; + export { out_1560 as out }; + } + export { outputs_1599 as outputs }; + } + export { ND_lama_dielectric_1 as ND_lama_dielectric }; + export namespace ND_lama_iridescence_1 { + let node_1600: string; + export { node_1600 as node }; + export namespace inputs_1600 { + let roughness_37: string; + export { roughness_37 as roughness }; + let anisotropy_15: string; + export { anisotropy_15 as anisotropy }; + let anisotropyDirection_3: string; + export { anisotropyDirection_3 as anisotropyDirection }; + let anisotropyRotation_3: string; + export { anisotropyRotation_3 as anisotropyRotation }; + let relativeFilmThickness_1: string; + export { relativeFilmThickness_1 as relativeFilmThickness }; + let minFilmThickness_1: string; + export { minFilmThickness_1 as minFilmThickness }; + let maxFilmThickness_1: string; + export { maxFilmThickness_1 as maxFilmThickness }; + let filmIOR_1: string; + export { filmIOR_1 as filmIOR }; + } + export { inputs_1600 as inputs }; + export namespace outputs_1600 { + let out_1561: string; + export { out_1561 as out }; + } + export { outputs_1600 as outputs }; + } + export { ND_lama_iridescence_1 as ND_lama_iridescence }; + export namespace ND_lama_diffuse_1 { + let node_1601: string; + export { node_1601 as node }; + export namespace inputs_1601 { + let color_33: string; + export { color_33 as color }; + let roughness_38: string; + export { roughness_38 as roughness }; + let normal_73: string; + export { normal_73 as normal }; + let energyCompensation_2: string; + export { energyCompensation_2 as energyCompensation }; + } + export { inputs_1601 as inputs }; + export namespace outputs_1601 { + let out_1562: string; + export { out_1562 as out }; + } + export { outputs_1601 as outputs }; + } + export { ND_lama_diffuse_1 as ND_lama_diffuse }; + export namespace ND_lama_mix_bsdf_1 { + let node_1602: string; + export { node_1602 as node }; + export namespace inputs_1602 { + let material1_4: string; + export { material1_4 as material1 }; + let material2_4: string; + export { material2_4 as material2 }; + let mix_90: string; + export { mix_90 as mix }; + } + export { inputs_1602 as inputs }; + export namespace outputs_1602 { + let out_1563: string; + export { out_1563 as out }; + } + export { outputs_1602 as outputs }; + } + export { ND_lama_mix_bsdf_1 as ND_lama_mix_bsdf }; + export namespace ND_lama_mix_edf_1 { + let node_1603: string; + export { node_1603 as node }; + export namespace inputs_1603 { + let material1_5: string; + export { material1_5 as material1 }; + let material2_5: string; + export { material2_5 as material2 }; + let mix_91: string; + export { mix_91 as mix }; + } + export { inputs_1603 as inputs }; + export namespace outputs_1603 { + let out_1564: string; + export { out_1564 as out }; + } + export { outputs_1603 as outputs }; + } + export { ND_lama_mix_edf_1 as ND_lama_mix_edf }; + export namespace ND_lama_add_bsdf_1 { + let node_1604: string; + export { node_1604 as node }; + export namespace inputs_1604 { + let material1_6: string; + export { material1_6 as material1 }; + let material2_6: string; + export { material2_6 as material2 }; + let weight1_2: string; + export { weight1_2 as weight1 }; + let weight2_2: string; + export { weight2_2 as weight2 }; + } + export { inputs_1604 as inputs }; + export namespace outputs_1604 { + let out_1565: string; + export { out_1565 as out }; + } + export { outputs_1604 as outputs }; + } + export { ND_lama_add_bsdf_1 as ND_lama_add_bsdf }; + export namespace ND_lama_add_edf_1 { + let node_1605: string; + export { node_1605 as node }; + export namespace inputs_1605 { + let material1_7: string; + export { material1_7 as material1 }; + let material2_7: string; + export { material2_7 as material2 }; + let weight1_3: string; + export { weight1_3 as weight1 }; + let weight2_3: string; + export { weight2_3 as weight2 }; + } + export { inputs_1605 as inputs }; + export namespace outputs_1605 { + let out_1566: string; + export { out_1566 as out }; + } + export { outputs_1605 as outputs }; + } + export { ND_lama_add_edf_1 as ND_lama_add_edf }; + export namespace ND_lama_conductor_1 { + let node_1606: string; + export { node_1606 as node }; + export namespace inputs_1606 { + let tint_3: string; + export { tint_3 as tint }; + let fresnelMode_4: string; + export { fresnelMode_4 as fresnelMode }; + let IOR_4: string; + export { IOR_4 as IOR }; + let extinction_5: string; + export { extinction_5 as extinction }; + let reflectivity_6: string; + export { reflectivity_6 as reflectivity }; + let edgeColor_1: string; + export { edgeColor_1 as edgeColor }; + let roughness_39: string; + export { roughness_39 as roughness }; + let normal_74: string; + export { normal_74 as normal }; + let anisotropy_16: string; + export { anisotropy_16 as anisotropy }; + let anisotropyDirection_4: string; + export { anisotropyDirection_4 as anisotropyDirection }; + let anisotropyRotation_4: string; + export { anisotropyRotation_4 as anisotropyRotation }; + } + export { inputs_1606 as inputs }; + export namespace outputs_1606 { + let out_1567: string; + export { out_1567 as out }; + } + export { outputs_1606 as outputs }; + } + export { ND_lama_conductor_1 as ND_lama_conductor }; + export namespace ND_lama_emission_1 { + let node_1607: string; + export { node_1607 as node }; + export namespace inputs_1607 { + let color_34: string; + export { color_34 as color }; + } + export { inputs_1607 as inputs }; + export namespace outputs_1607 { + let out_1568: string; + export { out_1568 as out }; + } + export { outputs_1607 as outputs }; + } + export { ND_lama_emission_1 as ND_lama_emission }; + export namespace ND_lama_surface_1 { + let node_1608: string; + export { node_1608 as node }; + export namespace inputs_1608 { + let materialFront_1: string; + export { materialFront_1 as materialFront }; + let materialBack_1: string; + export { materialBack_1 as materialBack }; + let presence_5: string; + export { presence_5 as presence }; + } + export { inputs_1608 as inputs }; + export namespace outputs_1608 { + let out_1569: string; + export { out_1569 as out }; + } + export { outputs_1608 as outputs }; + } + export { ND_lama_surface_1 as ND_lama_surface }; + export namespace ND_lama_generalized_schlick_1 { + let node_1609: string; + export { node_1609 as node }; + export namespace inputs_1609 { + let reflectionTint_3: string; + export { reflectionTint_3 as reflectionTint }; + let transmissionTint_3: string; + export { transmissionTint_3 as transmissionTint }; + let fresnelMode_5: string; + export { fresnelMode_5 as fresnelMode }; + let IOR_5: string; + export { IOR_5 as IOR }; + let reflectivity_7: string; + export { reflectivity_7 as reflectivity }; + let reflectivity90_1: string; + export { reflectivity90_1 as reflectivity90 }; + let reflectivityProfile_1: string; + export { reflectivityProfile_1 as reflectivityProfile }; + let roughness_40: string; + export { roughness_40 as roughness }; + let normal_75: string; + export { normal_75 as normal }; + let anisotropy_17: string; + export { anisotropy_17 as anisotropy }; + let anisotropyDirection_5: string; + export { anisotropyDirection_5 as anisotropyDirection }; + let anisotropyRotation_5: string; + export { anisotropyRotation_5 as anisotropyRotation }; + let absorptionColor_3: string; + export { absorptionColor_3 as absorptionColor }; + let absorptionRadius_3: string; + export { absorptionRadius_3 as absorptionRadius }; + let scatterColor_3: string; + export { scatterColor_3 as scatterColor }; + let scatterAnisotropy_3: string; + export { scatterAnisotropy_3 as scatterAnisotropy }; + } + export { inputs_1609 as inputs }; + export namespace outputs_1609 { + let out_1570: string; + export { out_1570 as out }; + } + export { outputs_1609 as outputs }; + } + export { ND_lama_generalized_schlick_1 as ND_lama_generalized_schlick }; + export namespace ND_lama_translucent_1 { + let node_1610: string; + export { node_1610 as node }; + export namespace inputs_1610 { + let color_35: string; + export { color_35 as color }; + let roughness_41: string; + export { roughness_41 as roughness }; + let normal_76: string; + export { normal_76 as normal }; + let energyCompensation_3: string; + export { energyCompensation_3 as energyCompensation }; + } + export { inputs_1610 as inputs }; + export namespace outputs_1610 { + let out_1571: string; + export { out_1571 as out }; + } + export { outputs_1610 as outputs }; + } + export { ND_lama_translucent_1 as ND_lama_translucent }; + export namespace ND_lama_layer_bsdf_1 { + let node_1611: string; + export { node_1611 as node }; + export namespace inputs_1611 { + let materialTop_1: string; + export { materialTop_1 as materialTop }; + let materialBase_1: string; + export { materialBase_1 as materialBase }; + let topMix_1: string; + export { topMix_1 as topMix }; + let topThickness_1: string; + export { topThickness_1 as topThickness }; + } + export { inputs_1611 as inputs }; + export namespace outputs_1611 { + let out_1572: string; + export { out_1572 as out }; + } + export { outputs_1611 as outputs }; + } + export { ND_lama_layer_bsdf_1 as ND_lama_layer_bsdf }; + } + namespace byNode { + export let oren_nayar_diffuse_bsdf: string[]; + export let burley_diffuse_bsdf: string[]; + export let translucent_bsdf: string[]; + export let dielectric_bsdf: string[]; + export let conductor_bsdf: string[]; + export let generalized_schlick_bsdf: string[]; + export let subsurface_bsdf: string[]; + export let sheen_bsdf: string[]; + export let chiang_hair_bsdf: string[]; + export let uniform_edf: string[]; + export let conical_edf: string[]; + export let measured_edf: string[]; + export let generalized_schlick_edf: string[]; + export let absorption_vdf: string[]; + export let anisotropic_vdf: string[]; + export let surface: string[]; + export let volume: string[]; + export let light: string[]; + let displacement_6: string[]; + export { displacement_6 as displacement }; + let layer_12: string[]; + export { layer_12 as layer }; + let mix_92: string[]; + export { mix_92 as mix }; + export let add: string[]; + export let multiply: string[]; + export let roughness_anisotropy: string[]; + export let roughness_dual: string[]; + export let glossiness_anisotropy: string[]; + export let blackbody: string[]; + export let artistic_ior: string[]; + export let deon_hair_absorption_from_melanin: string[]; + export let chiang_hair_absorption_from_color: string[]; + export let chiang_hair_roughness: string[]; + export let disney_principled: string[]; + export let open_pbr_surface: string[]; + export let open_pbr_anisotropy: string[]; + export let UsdPreviewSurface: string[]; + export let UsdUVTexture: string[]; + export let UsdPrimvarReader: string[]; + export let UsdTransform2d: string[]; + export let standard_surface: string[]; + export let gltf_pbr: string[]; + export let gltf_colorimage: string[]; + export let gltf_image: string[]; + export let gltf_normalmap: string[]; + export let gltf_iridescence_thickness: string[]; + export let gltf_anisotropy_image: string[]; + let viewdirection_2: string[]; + export { viewdirection_2 as viewdirection }; + export let facingratio: string[]; + export let gooch_shade: string[]; + export let g18_rec709_to_lin_rec709: string[]; + export let g22_rec709_to_lin_rec709: string[]; + export let rec709_display_to_lin_rec709: string[]; + export let acescg_to_lin_rec709: string[]; + export let g22_ap1_to_lin_rec709: string[]; + export let srgb_texture_to_lin_rec709: string[]; + export let lin_adobergb_to_lin_rec709: string[]; + export let adobergb_to_lin_rec709: string[]; + export let srgb_displayp3_to_lin_rec709: string[]; + export let lin_displayp3_to_lin_rec709: string[]; + export let surfacematerial: string[]; + export let volumematerial: string[]; + export let surface_unlit: string[]; + export let image: string[]; + export let tiledimage: string[]; + export let latlongimage: string[]; + export let hextiledimage: string[]; + export let triplanarprojection: string[]; + export let constant: string[]; + export let ramp: string[]; + export let ramp_gradient: string[]; + export let ramplr: string[]; + export let ramptb: string[]; + export let ramp4: string[]; + export let splitlr: string[]; + export let splittb: string[]; + export let noise2d: string[]; + export let noise3d: string[]; + export let fractal2d: string[]; + export let fractal3d: string[]; + export let cellnoise2d: string[]; + export let cellnoise3d: string[]; + export let worleynoise2d: string[]; + export let worleynoise3d: string[]; + export let unifiednoise2d: string[]; + export let unifiednoise3d: string[]; + export let flake2d: string[]; + export let flake3d: string[]; + export let randomfloat: string[]; + export let randomcolor: string[]; + export let checkerboard: string[]; + export let line: string[]; + export let circle: string[]; + export let cloverleaf: string[]; + export let hexagon: string[]; + export let grid: string[]; + export let crosshatch: string[]; + export let tiledcircles: string[]; + export let tiledcloverleafs: string[]; + export let tiledhexagons: string[]; + let position_72: string[]; + export { position_72 as position }; + let normal_77: string[]; + export { normal_77 as normal }; + let tangent_25: string[]; + export { tangent_25 as tangent }; + let bitangent_12: string[]; + export { bitangent_12 as bitangent }; + let texcoord_188: string[]; + export { texcoord_188 as texcoord }; + let geomcolor_2: string[]; + export { geomcolor_2 as geomcolor }; + export let geompropvalue: string[]; + export let geompropvalueuniform: string[]; + export let bump: string[]; + export let frame: string[]; + export let time: string[]; + export let subtract: string[]; + export let divide: string[]; + export let modulo: string[]; + export let fract: string[]; + let invert_2: string[]; + export { invert_2 as invert }; + export let absval: string[]; + export let floor: string[]; + export let ceil: string[]; + export let round: string[]; + export let power: string[]; + export let safepower: string[]; + export let sin: string[]; + export let cos: string[]; + export let tan: string[]; + export let asin: string[]; + export let acos: string[]; + export let atan2: string[]; + export let sqrt: string[]; + export let ln: string[]; + export let exp: string[]; + export let sign: string[]; + export let clamp: string[]; + let min_4: string[]; + export { min_4 as min }; + let max_4: string[]; + export { max_4 as max }; + export let normalize: string[]; + export let magnitude: string[]; + export let distance: string[]; + export let dotproduct: string[]; + export let crossproduct: string[]; + export let transformpoint: string[]; + export let transformvector: string[]; + export let transformnormal: string[]; + export let transformmatrix: string[]; + export let normalmap: string[]; + export let hextilednormalmap: string[]; + export let transpose: string[]; + export let determinant: string[]; + export let invertmatrix: string[]; + export let rotate2d: string[]; + export let rotate3d: string[]; + export let place2d: string[]; + export let trianglewave: string[]; + export let reflect: string[]; + export let refract: string[]; + export let remap: string[]; + export let smoothstep: string[]; + export let luminance: string[]; + export let rgbtohsv: string[]; + export let hsvtorgb: string[]; + let contrast_4: string[]; + export { contrast_4 as contrast }; + export let range: string[]; + export let hsvadjust: string[]; + export let saturate: string[]; + export let colorcorrect: string[]; + export let premult: string[]; + export let unpremult: string[]; + export let plus: string[]; + export let minus: string[]; + export let difference: string[]; + export let burn: string[]; + export let dodge: string[]; + export let screen: string[]; + export let overlay: string[]; + export let disjointover: string[]; + let _in_582: string[]; + export { _in_582 as in }; + let mask_12: string[]; + export { mask_12 as mask }; + export let matte: string[]; + let out_1573: string[]; + export { out_1573 as out }; + export let over: string[]; + export let inside: string[]; + export let outside: string[]; + export let ifgreater: string[]; + export let ifgreatereq: string[]; + export let ifequal: string[]; + let _switch: string[]; + export { _switch as switch }; + export let convert: string[]; + export let combine2: string[]; + export let combine3: string[]; + export let combine4: string[]; + export let creatematrix: string[]; + export let extract: string[]; + export let separate2: string[]; + export let separate3: string[]; + export let separate4: string[]; + export let blur: string[]; + export let heighttonormal: string[]; + export let and: string[]; + export let or: string[]; + export let xor: string[]; + export let not: string[]; + export let dot: string[]; + export let point_light: string[]; + export let directional_light: string[]; + export let spot_light: string[]; + export let open_pbr_surface_to_standard_surface: string[]; + export let standard_surface_to_open_pbr_surface: string[]; + export let standard_surface_to_UsdPreviewSurface: string[]; + export let standard_surface_to_gltf_pbr: string[]; + export let LamaSheen: string[]; + export let LamaSSS: string[]; + export let LamaDielectric: string[]; + export let LamaIridescence: string[]; + export let LamaDiffuse: string[]; + export let LamaMix: string[]; + export let LamaAdd: string[]; + export let LamaConductor: string[]; + export let LamaEmission: string[]; + export let LamaSurface: string[]; + export let LamaGeneralizedSchlick: string[]; + export let LamaTranslucent: string[]; + export let LamaLayer: string[]; + } +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts new file mode 100644 index 000000000..1cfdb7798 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts @@ -0,0 +1 @@ +export const MtlXLibrary: any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts new file mode 100644 index 000000000..e5538624b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts @@ -0,0 +1,20 @@ +export namespace MaterialXSurfaceMappings { + export { applyStandardSurface as standard_surface }; + export { applyGltfPbrSurface as gltf_pbr }; + export { applyOpenPbrSurface as open_pbr_surface }; +} +export const surfaceMapperRegistry: Map; +export function getSurfaceMapper(category: any): { + category: string; + apply: typeof applyStandardSurface | typeof applyGltfPbrSurface | typeof applyOpenPbrSurface; +} | undefined; +export function getSupportedSurfaceCategories(): string[]; +export function applyStandardSurface(material: any, inputs: any, log: any, nodeName: any): void; +export function applyGltfPbrSurface(material: any, inputs: any, log: any, nodeName: any): void; +export function applyOpenPbrSurface(material: any, inputs: any, log: any, nodeName: any): void; +export const mappedStandardSurfaceInputs: Set; +export const mappedGltfPbrInputs: Set; +export const mappedOpenPbrInputs: Set; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts new file mode 100644 index 000000000..221cf1eb2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts @@ -0,0 +1,5 @@ +export function getComponentCountForType(type: any): 2 | 3 | 4; +export function isBooleanNode(node: any): any; +export function normalizeSpaceName(value: any, fallback?: string): string; +export function toBooleanNode(node: any): any; +export function toVec3Channels(input: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts new file mode 100644 index 000000000..79aeef441 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts @@ -0,0 +1,2 @@ +export function createMaterialXCompileRegistry(): Map; +export function compileNodeFromRegistry(nodeX: any, out: any, compileContext: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts new file mode 100644 index 000000000..7f139c8c3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts @@ -0,0 +1,2 @@ +export function parseMaterialXNodeTree(nodeXML: any, createNode: any, addNode: any, nodePath?: string): any; +export function parseMaterialXText(text: any, createNode: any, addNode: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts new file mode 100644 index 000000000..fae9e0192 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts @@ -0,0 +1,31 @@ +export class USDAParser { + parseText(text: any): {}; + _preprocess(text: any): string; + _stripBlockComments(text: any): string; + _collapseTripleQuotedStrings(text: any): string; + _stripInlineComment(line: any): any; + _findAssignmentOperator(line: any): number; + /** + * Parse USDA text and return raw spec data in specsByPath format. + * Used by USDComposer for unified scene composition. + */ + parseData(text: any): { + specsByPath: { + '/': { + specType: number; + fields: { + upAxis: any; + defaultPrim: any; + metersPerUnit: number; + framesPerSecond: number; + timeCodesPerSecond: number; + }; + }; + }; + }; + _inferSkelElementSize(specsByPath: any): void; + _inferElementSize(attrSpec: any, numVertices: any): void; + _extractPrimData(data: any, path: any, primFields: any, specsByPath: any, SpecType: any): void; + _parseAttributeValue(valueType: any, rawValue: any): any; + _parseString(str: any): string; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts new file mode 100644 index 000000000..546010819 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts @@ -0,0 +1,70 @@ +export class USDCParser { + /** + * Parse USDC file and return raw spec data without building Three.js scene. + * Used by USDComposer for unified scene composition. + */ + parseData(buffer: any): { + specsByPath: {}; + }; + buffer: any; + reader: BinaryReader | undefined; + version: { + major: number; + minor: number; + patch: number; + } | undefined; + _conversionBuffer: ArrayBuffer | undefined; + _conversionView: DataView | undefined; + specsByPath: {} | undefined; + _readBootstrap(): void; + tocOffset: number | undefined; + _readTOC(): void; + sections: {} | undefined; + _readTokens(): void; + tokens: any[] | undefined; + _readStrings(): void; + strings: any[] | undefined; + _readFields(): void; + fields: any[] | undefined; + _readFieldSets(): void; + fieldSets: any[] | undefined; + _readPaths(): void; + paths: any[] | undefined; + _readPathsRecursive(parentPath: any, depth?: number): void; + _buildPathsFromCompressed(pathIndices: any, elementTokenIndices: any, jumps: any): void; + _readSpecs(): void; + specs: any[] | undefined; + _readValue(valueRep: any): any; + _readInlinedValue(valueRep: any): any; + _readTimeSamples(valueRep: any): { + times: any; + values: any[]; + }; + _readScalarValue(type: any): any; + _readArrayValue(valueRep: any): any[] | Uint32Array | Float64Array | Float32Array | Int32Array; + _readCompressedArray(type: any, size: any): never[] | Float32Array | Int32Array; + _readHalf(): number; + _halfToFloat(h: any): number; + _getFieldsForSpec(spec: any): {}; +} +declare class BinaryReader { + constructor(buffer: any); + buffer: any; + view: DataView; + offset: number; + seek(offset: any): void; + tell(): number; + readUint8(): number; + readInt8(): number; + readUint16(): number; + readInt16(): number; + readUint32(): number; + readInt32(): number; + readUint64(): number; + readInt64(): number; + readFloat32(): number; + readFloat64(): number; + readBytes(length: any): Uint8Array; + readString(length: any): string; +} +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts new file mode 100644 index 000000000..87c5cbf83 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts @@ -0,0 +1,238 @@ +/** + * USDComposer handles scene composition from parsed USD data. + * This includes reference resolution, variant selection, transform handling, + * and building the Three.js scene graph. + * + * Works with specsByPath format from USDCParser. + */ +export class USDComposer { + constructor(manager?: null); + textureCache: {}; + skinnedMeshes: any[]; + manager: any; + texturePromises: any[]; + /** + * Compose a Three.js scene from parsed USD data. + * @param {Object} parsedData - Data from USDCParser or USDAParser + * @param {Object} assets - Dictionary of referenced assets (specsByPath or blob URLs) + * @param {Object} variantSelections - External variant selections + * @param {string} basePath - Base path for resolving relative references + * @returns {Group} Three.js scene graph + */ + compose(parsedData: Object, assets?: Object, variantSelections?: Object, basePath?: string): Group; + specsByPath: any; + assets: Object | undefined; + externalVariantSelections: Object | undefined; + basePath: string | undefined; + skeletons: {} | undefined; + fps: any; + /** + * Apply USD transforms to a Three.js object. + * Handles xformOpOrder with proper matrix composition. + * USD uses row-vector convention, Three.js uses column-vector. + */ + applyTransform(obj: any, fields: any, attrs?: {}): void; + /** + * Build indexes for efficient lookups. + * Called once during compose() to avoid O(n) scans per lookup. + */ + _buildIndexes(): void; + childrenByPath: Map | undefined; + attributesByPrimPath: Map | undefined; + materialsByRoot: Map | undefined; + shadersByMaterialPath: Map | undefined; + geomSubsetsByMeshPath: Map | undefined; + /** + * Check if a path is a direct child of parentPath. + */ + _isDirectChild(parentPath: any, path: any, prefix: any): boolean; + /** + * Build the scene hierarchy recursively. + * Uses childrenByPath index for O(1) child lookup instead of O(n) iteration. + */ + _buildHierarchy(parent: any, parentPath: any): void; + /** + * Get variant paths for a parent path based on variant selections. + */ + _getVariantPaths(parentPath: any): any[]; + /** + * Resolve a file path relative to basePath. + */ + _resolveFilePath(refPath: any): any; + /** + * Resolve a USD reference and return the composed content. + * @param {string} refValue - Reference value like "@./path/to/file.usdc@" + * @param {Object} localVariants - Variant selections to apply + * @returns {Group|null} Composed content or null + */ + _resolveReference(refValue: string, localVariants?: Object): Group | null; + /** + * Find a single mesh in the group's shallow hierarchy. + * Only returns a mesh if it's at depth 0 or 1, not deeply nested. + * This preserves transforms in complex hierarchies like Kitchen Set + * while supporting USDZExporter round-trip (Xform > Xform > Mesh pattern). + */ + _findSingleMesh(group: any): any; + /** + * Check if an object has a non-identity local transform. + */ + _hasNonIdentityTransform(obj: any): boolean; + /** + * Get the base path (directory) from a file path. + */ + _getBasePath(filePath: any): any; + /** + * Extract variant selections from a spec's fields. + */ + _getLocalVariantSelections(fields: any): {}; + /** + * Get all reference values from a prim spec. + * @returns {string[]} Array of reference strings like "@path@" or "@path@" + */ + _getReferences(spec: any): string[]; + /** + * Resolve an attribute's authored value, following connections before using + * local fallback values. + */ + _resolveAttributeValue(path: any, visited?: Set): any; + /** + * Get attributes for a path from attribute specs. + */ + _getAttributes(path: any): {}; + _collectAttributesFromPath(path: any, attrs: any): void; + /** + * Build a mesh from a USD geometric primitive (Cube, Sphere, Cylinder, Cone, Capsule). + */ + _buildGeomPrimitive(path: any, spec: any, typeName: any): Mesh; + /** + * Build a mesh from a Mesh spec. + */ + _buildMesh(path: any, spec: any): Mesh | SkinnedMesh; + /** + * Build a camera from a Camera spec. + */ + _buildCamera(path: any): PerspectiveCamera | OrthographicCamera; + /** + * Build a light from a UsdLux light spec. + */ + _buildLight(path: any, typeName: any): SpotLight | PointLight | DirectionalLight | RectAreaLight | undefined; + /** + * Convert a color temperature in Kelvin to an RGB Color. + * Based on Tanner Helland's algorithm. + */ + _colorTemperature(kelvin: any): Color; + _parseNumber(value: any, fallback: any): any; + _getGeomSubsets(meshPath: any): any[]; + /** + * Get the material binding relationship for a prim, including overrides from + * active variants. + */ + _getMaterialBindingSpec(primPath: any): any; + /** + * Get the resolved material binding target for a prim. Material bindings are + * inherited, and an ancestor marked strongerThanDescendants takes precedence + * over bindings authored on its descendants. + */ + _getMaterialBindingTarget(primPath: any): any; + _buildGeometry(path: any, fields: any, hasSkinning?: boolean): BufferGeometry; + _buildGeometryWithSubsets(fields: any, geomSubsets: any, hasSkinning?: boolean): BufferGeometry; + _selectTopWeights(srcIndices: any, srcWeights: any, elementSize: any, numVertices: any, dstIndices: any, dstWeights: any): void; + _findUVPrimvar(fields: any): { + uvs: any; + uvIndices: any; + }; + _findUV2Primvar(fields: any): { + uvs2: any; + uv2Indices: any; + }; + _buildHoleMap(polygonHoles: any): { + parentToHoles: Map; + holeFaces: Set; + }; + _triangulateIndicesWithPattern(indices: any, counts: any, points?: null, holeMap?: null): { + indices: any[]; + pattern: any[]; + }; + _applyTriangulationPattern(indices: any, pattern: any): any[]; + _triangulateNGon(faceIndices: any, points: any): any[][]; + _triangulateNGonWithHoles(outerIndices: any, holeContours: any, points: any): any[][]; + _triangulateIndices(indices: any, counts: any): any[]; + _expandAttribute(data: any, indices: any, itemSize: any): any[]; + /** + * Compute per-vertex normals from indexed triangle data. + * Accumulates area-weighted face normals at each shared vertex and normalizes. + */ + _computeVertexNormals(points: any, indices: any): Float32Array; + /** + * Get the material path for a mesh, checking various binding sources. + */ + _getMaterialPath(meshPath: any, fields: any): any; + _buildMaterial(meshPath: any, fields: any): MeshPhysicalMaterial; + _buildMaterialForPath(materialPath: any): MeshPhysicalMaterial; + /** + * Apply material binding from a prim path to a mesh. + * Used when merging referenced geometry into a prim that has material binding. + */ + _applyMaterialBinding(mesh: any, primPath: any): void; + _pickBestMaterial(materialPaths: any): any; + _applyMaterial(material: any, materialPath: any): void; + /** + * Shared helper for applying texture or value from shader attribute. + * Reduces duplication between _applyPreviewSurface and _applyOpenPBRSurface. + */ + _applyTextureOrValue(material: any, shaderPath: any, fields: any, attrName: any, textureProperty: any, colorSpace: any, valueCallback: any, textureGetter: any): boolean; + _applyPreviewSurface(material: any, shaderPath: any): void; + _applyOpenPBRSurface(material: any, shaderPath: any): void; + _getTextureFromOpenPBRConnection(connPath: any): any; + _loadTextureFromPath(filePath: any): any; + _getTextureFromConnection(connPath: any): any; + _applyTextureTransforms(texture: any, attrs: any): void; + _loadTexture(filePath: any, textureAttrs: any, transformAttrs: any): Texture | null; + _createTextureFromData(data: any, textureAttrs: any, transformAttrs: any): Texture | null; + _getWrapMode(wrapValue: any): number; + _buildSkeleton(path: any): { + skeleton: Skeleton; + joints: any; + rootBones: Bone[]; + animationPath: any; + path: any; + } | null; + _bindSkeletons(): void; + _buildAnimations(): AnimationClip[]; + _buildTransformAnimations(): (QuaternionKeyframeTrack | VectorKeyframeTrack)[]; + _buildAnimationClip(path: any): AnimationClip | null; + _getTimeSampledAttribute(primPath: any, attrName: any): any; + _flattenMatrixArray(matrices: any, numMatrices: any): any; +} +export namespace SpecType { + let Unknown: number; + let Attribute: number; + let Connection: number; + let Expression: number; + let Mapper: number; + let MapperArg: number; + let Prim: number; + let PseudoRoot: number; + let Relationship: number; + let RelationshipTarget: number; + let Variant: number; + let VariantSet: number; +} +import { Group } from 'three'; +import { Mesh } from 'three'; +import { SkinnedMesh } from 'three'; +import { PerspectiveCamera } from 'three'; +import { OrthographicCamera } from 'three'; +import { SpotLight } from 'three'; +import { PointLight } from 'three'; +import { DirectionalLight } from 'three'; +import { RectAreaLight } from 'three'; +import { Color } from 'three'; +import { BufferGeometry } from 'three'; +import { MeshPhysicalMaterial } from 'three'; +import { Texture } from 'three'; +import { Skeleton } from 'three'; +import { Bone } from 'three'; +import { AnimationClip } from 'three'; +import { QuaternionKeyframeTrack } from 'three'; +import { VectorKeyframeTrack } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts new file mode 100644 index 000000000..d0c825fab --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts @@ -0,0 +1,21 @@ +/** + * A special line material for meshes loaded via {@link LDrawLoader}. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * import the class from `LDrawConditionalLineNodeMaterial.js`. + * + * @augments ShaderMaterial + * @three_import import { LDrawConditionalLineMaterial } from 'three/addons/materials/LDrawConditionalLineMaterial.js'; + */ +export class LDrawConditionalLineMaterial extends ShaderMaterial { + static get type(): string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLDrawConditionalLineMaterial: boolean; +} +import { ShaderMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts new file mode 100644 index 000000000..2115b2f70 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts @@ -0,0 +1,34 @@ +/** + * A special line material for meshes loaded via {@link LDrawLoader}. + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * import the class from `LDrawConditionalLineMaterial.js`. + * + * @augments NodeMaterial + * @three_import import { LDrawConditionalLineMaterial } from 'three/addons/materials/LDrawConditionalLineMaterial.js'; + */ +export class LDrawConditionalLineMaterial extends NodeMaterial { + /** + * Constructs a new conditional line material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + vertexNode: void; + fragmentNode: void; + _diffuseUniform: import("three/webgpu").UniformNode; + _opacityUniform: import("three/webgpu").UniformNode; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLDrawConditionalLineMaterial: boolean; +} +import { NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts new file mode 100644 index 000000000..ce5f59442 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts @@ -0,0 +1,38 @@ +export function GetWoodPreset(genus: any, finish: any): any; +export const WoodGenuses: string[]; +export const Finishes: string[]; +/** + * Procedural wood material using TSL (Three.js Shading Language). + * + * Usage examples: + * + * // Using presets (recommended for common wood types) + * const material = WoodNodeMaterial.fromPreset('walnut', 'gloss'); + * + * // Using custom parameters (for advanced customization) + * const material = new WoodNodeMaterial({ + * centerSize: 1.2, + * ringThickness: 1/40, + * darkGrainColor: new THREE.Color('#2a1a0a'), + * lightGrainColor: new THREE.Color('#8b4513'), + * clearcoat: 1, + * clearcoatRoughness: 0.3 + * }); + * + * // Mixing presets with custom overrides + * const walnutParams = GetWoodPreset('walnut', 'raw'); + * const material = new WoodNodeMaterial({ + * ...walnutParams, + * ringThickness: 1/50, // Override specific parameter + * clearcoat: 1 // Add finish + * }); + */ +export class WoodNodeMaterial extends THREE.MeshPhysicalMaterial { + static get type(): string; + static fromPreset(genus?: string, finish?: string): WoodNodeMaterial; + constructor(params?: {}); + isWoodNodeMaterial: boolean; + colorNode: any; + clearcoatNode: any; +} +import * as THREE from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts new file mode 100644 index 000000000..8eac33066 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts @@ -0,0 +1,82 @@ +/** + * A capsule is essentially a cylinder with hemispherical caps at both ends. + * It can be thought of as a swept sphere, where a sphere is moved along a line segment. + * + * Capsules are often used as bounding volumes (next to AABBs and bounding spheres). + * + * @three_import import { Capsule } from 'three/addons/math/Capsule.js'; + */ +export class Capsule { + /** + * Constructs a new capsule. + * + * @param {Vector3} [start] - The start vector. + * @param {Vector3} [end] - The end vector. + * @param {number} [radius=1] - The capsule's radius. + */ + constructor(start?: Vector3, end?: Vector3, radius?: number); + /** + * The start vector. + * + * @type {Vector3} + */ + start: Vector3; + /** + * The end vector. + * + * @type {Vector3} + */ + end: Vector3; + /** + * The capsule's radius. + * + * @type {number} + * @default 1 + */ + radius: number; + /** + * Returns a new capsule with copied values from this instance. + * + * @return {Capsule} A clone of this instance. + */ + clone(): Capsule; + /** + * Sets the capsule components to the given values. + * Please note that this method only copies the values from the given objects. + * + * @param {Vector3} start - The start vector. + * @param {Vector3} end - The end vector + * @param {number} radius - The capsule's radius. + * @return {Capsule} A reference to this capsule. + */ + set(start: Vector3, end: Vector3, radius: number): Capsule; + /** + * Copies the values of the given capsule to this instance. + * + * @param {Capsule} capsule - The capsule to copy. + * @return {Capsule} A reference to this capsule. + */ + copy(capsule: Capsule): Capsule; + /** + * Returns the center point of this capsule. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The center point. + */ + getCenter(target: Vector3): Vector3; + /** + * Adds the given offset to this capsule, effectively moving it in 3D space. + * + * @param {Vector3} v - The offset that should be used to translate the capsule. + * @return {Capsule} A reference to this capsule. + */ + translate(v: Vector3): Capsule; + /** + * Returns `true` if the given bounding box intersects with this capsule. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the given bounding box intersects with this capsule. + */ + intersectsBox(box: Box3): boolean; +} +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts new file mode 100644 index 000000000..a730f9728 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts @@ -0,0 +1,34 @@ +/** + * A utility class with helper functions for color conversion. + * + * @hideconstructor + * @three_import import { ColorConverter } from 'three/addons/math/ColorConverter.js'; + */ +export class ColorConverter { + /** + * Sets the given HSV color definition to the given color object. + * + * @param {Color} color - The color to set. + * @param {number} h - The hue. + * @param {number} s - The saturation. + * @param {number} v - The value. + * @return {Color} The update color. + */ + static setHSV(color: Color, h: number, s: number, v: number): Color; + /** + * Returns a HSV color representation of the given color object. + * + * @param {Color} color - The color to get HSV values from. + * @param {{h:number,s:number,v:number}} target - The target object that is used to store the method's result. + * @return {{h:number,s:number,v:number}} The HSV color. + */ + static getHSV(color: Color, target: { + h: number; + s: number; + v: number; + }): { + h: number; + s: number; + v: number; + }; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts new file mode 100644 index 000000000..e7c282d5b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts @@ -0,0 +1,94 @@ +/** + * Display-P3 color space. + * + * @type {string} + * @constant + */ +export const DisplayP3ColorSpace: string; +/** + * Display-P3-Linear color space. + * + * @type {string} + * @constant + */ +export const LinearDisplayP3ColorSpace: string; +/** + * Implementation object for the Display-P3 color space. + * + * @type {module:ColorSpaces~ColorSpaceImpl} + * @constant + */ +export const DisplayP3ColorSpaceImpl: any; +/** + * Implementation object for the Display-P3-Linear color space. + * + * @type {module:ColorSpaces~ColorSpaceImpl} + * @constant + */ +export const LinearDisplayP3ColorSpaceImpl: any; +/** + * Rec2020-Linear color space. + * + * @type {string} + * @constant + */ +export const LinearRec2020ColorSpace: string; +/** + * Implementation object for the Rec2020-Linear color space. + * + * @type {module:ColorSpaces~ColorSpaceImpl} + * @constant + */ +export const LinearRec2020ColorSpaceImpl: any; +/** + * Extended-sRGB color space. + * + * @type {string} + * @constant + */ +export const ExtendedSRGBColorSpace: string; +/** + * Implementation object for the Extended-sRGB color space. + * + * @type {module:ColorSpaces~ColorSpaceImpl} + * @constant + */ +export const ExtendedSRGBColorSpaceImpl: any; +/** + * :ColorSpaces~ColorSpaceImpl + */ +export type module = { + /** + * - The primaries. + */ + primaries: Array; + /** + * - The white point. + */ + whitePoint: Array; + /** + * - A color space conversion matrix, converting to CIE XYZ. + */ + toXYZ: Matrix3; + /** + * - A color space conversion matrix, converting from CIE XYZ. + */ + fromXYZ: Matrix3; + /** + * - The luminance coefficients. + */ + luminanceCoefficients: Array; + /** + * - The working color space config. + */ + workingColorSpaceConfig?: { + unpackColorSpace: string; + } | undefined; + /** + * - The drawing buffer color space config. + */ + outputColorSpaceConfig?: { + drawingBufferColorSpace: string; + } | undefined; +}; +import { Matrix3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts new file mode 100644 index 000000000..ca53b31bc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts @@ -0,0 +1,533 @@ +/** + * Can be used to compute the convex hull in 3D space for a given set of points. It + * is primarily intended for {@link ConvexGeometry}. + * + * This Quickhull 3D implementation is a port of [quickhull3d](https://github.com/maurizzzio/quickhull3d/) + * by Mauricio Poppe. + * + * @three_import import { ConvexHull } from 'three/addons/math/ConvexHull.js'; + */ +export class ConvexHull { + tolerance: number; + faces: any[]; + newFaces: any[]; + assigned: VertexList; + unassigned: VertexList; + vertices: any[]; + /** + * Computes to convex hull for the given array of points. + * + * @param {Array} points - The array of points in 3D space. + * @return {ConvexHull} A reference to this convex hull. + */ + setFromPoints(points: Array): ConvexHull; + /** + * Computes the convex hull of the given 3D object (including its descendants), + * accounting for the world transforms of both the 3D object and its descendants. + * + * @param {Object3D} object - The 3D object to compute the convex hull for. + * @return {ConvexHull} A reference to this convex hull. + */ + setFromObject(object: Object3D): ConvexHull; + /** + * Returns `true` if the given point lies in the convex hull. + * + * @param {Vector3} point - The point to test. + * @return {boolean} Whether the given point lies in the convex hull or not. + */ + containsPoint(point: Vector3): boolean; + /** + * Computes the intersections point of the given ray and this convex hull. + * + * @param {Ray} ray - The ray to test. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The intersection point. Returns `null` if not intersection was detected. + */ + intersectRay(ray: Ray, target: Vector3): Vector3 | null; + /** + * Returns `true` if the given ray intersects with this convex hull. + * + * @param {Ray} ray - The ray to test. + * @return {boolean} Whether the given ray intersects with this convex hull or not. + */ + intersectsRay(ray: Ray): boolean; + /** + * Makes the convex hull empty. + * + * @return {ConvexHull} A reference to this convex hull. + */ + makeEmpty(): ConvexHull; + /** + * Adds a vertex to the 'assigned' list of vertices and assigns it to the given face. + * + * @private + * @param {VertexNode} vertex - The vertex to add. + * @param {Face} face - The target face. + * @return {ConvexHull} A reference to this convex hull. + */ + private _addVertexToFace; + /** + * Removes a vertex from the 'assigned' list of vertices and from the given face. + * It also makes sure that the link from 'face' to the first vertex it sees in 'assigned' + * is linked correctly after the removal. + * + * @private + * @param {VertexNode} vertex - The vertex to remove. + * @param {Face} face - The target face. + * @return {ConvexHull} A reference to this convex hull. + */ + private _removeVertexFromFace; + /** + * Removes all the visible vertices that a given face is able to see which are stored in + * the 'assigned' vertex list. + * + * @private + * @param {Face} face - The target face. + * @return {VertexNode|undefined} A reference to this convex hull. + */ + private _removeAllVerticesFromFace; + /** + * Removes all the visible vertices that `face` is able to see. + * + * - If `absorbingFace` doesn't exist, then all the removed vertices will be added to the 'unassigned' vertex list. + * - If `absorbingFace` exists, then this method will assign all the vertices of 'face' that can see 'absorbingFace'. + * - If a vertex cannot see `absorbingFace`, it's added to the 'unassigned' vertex list. + * + * @private + * @param {Face} face - The given face. + * @param {Face} [absorbingFace] - An optional face that tries to absorb the vertices of the first face. + * @return {ConvexHull} A reference to this convex hull. + */ + private _deleteFaceVertices; + /** + * Reassigns as many vertices as possible from the unassigned list to the new faces. + * + * @private + * @param {Array} newFaces - The new faces. + * @return {ConvexHull} A reference to this convex hull. + */ + private _resolveUnassignedPoints; + /** + * Computes the extremes values (min/max vectors) which will be used to + * compute the initial hull. + * + * @private + * @return {Object} The extremes. + */ + private _computeExtremes; + /** + * Computes the initial simplex assigning to its faces all the points that are + * candidates to form part of the hull. + * + * @private + * @return {ConvexHull} A reference to this convex hull. + */ + private _computeInitialHull; + /** + * Removes inactive (e.g. deleted) faces from the internal face list. + * + * @private + * @return {ConvexHull} A reference to this convex hull. + */ + private _reindexFaces; + /** + * Finds the next vertex to create faces with the current hull. + * + * - Let the initial face be the first face existing in the 'assigned' vertex list. + * - If a face doesn't exist then return since there're no vertices left. + * - Otherwise for each vertex that face sees find the one furthest away from it. + * + * @private + * @return {?VertexNode} The next vertex to add. + */ + private _nextVertexToAdd; + /** + * Computes a chain of half edges in CCW order called the 'horizon'. For an edge + * to be part of the horizon it must join a face that can see 'eyePoint' and a face + * that cannot see 'eyePoint'. + * + * @private + * @param {Vector3} eyePoint - The 3D-coordinates of a point. + * @param {HalfEdge} crossEdge - The edge used to jump to the current face. + * @param {Face} face - The current face being tested. + * @param {Array} horizon - The edges that form part of the horizon in CCW order. + * @return {ConvexHull} A reference to this convex hull. + */ + private _computeHorizon; + /** + * Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' + * in CCW order. All the half edges are created in CCW order thus the face is always pointing + * outside the hull. + * + * @private + * @param {VertexNode} eyeVertex - The vertex that is added to the hull. + * @param {HalfEdge} horizonEdge - A single edge of the horizon. + * @return {HalfEdge} The half edge whose vertex is the eyeVertex. + */ + private _addAdjoiningFace; + /** + * Adds 'horizon.length' faces to the hull, each face will be linked with the horizon + * opposite face and the face on the left/right. + * + * @private + * @param {VertexNode} eyeVertex - The vertex that is added to the hull. + * @param {Array} horizon - The horizon. + * @return {ConvexHull} A reference to this convex hull. + */ + private _addNewFaces; + /** + * Adds a vertex to the hull with the following algorithm: + * + * - Compute the 'horizon' which is a chain of half edges. For an edge to belong to this group + * it must be the edge connecting a face that can see 'eyeVertex' and a face which cannot see 'eyeVertex'. + * - All the faces that can see 'eyeVertex' have its visible vertices removed from the assigned vertex list. + * - A new set of faces is created with each edge of the 'horizon' and 'eyeVertex'. Each face is connected + * with the opposite horizon face and the face on the left/right. + * - The vertices removed from all the visible faces are assigned to the new faces if possible. + * + * @private + * @param {VertexNode} eyeVertex - The vertex to add. + * @return {ConvexHull} A reference to this convex hull. + */ + private _addVertexToHull; + /** + * Cleans up internal properties after computing the convex hull. + * + * @private + * @return {ConvexHull} A reference to this convex hull. + */ + private _cleanup; + /** + * Starts the execution of the quick hull algorithm. + * + * @private + * @return {ConvexHull} A reference to this convex hull. + */ + private _compute; +} +/** + * Represents a section bounded by a specific amount of half-edges. + * The current implementation assumes that a face always consist of three edges. + * + * @private + */ +export class Face { + /** + * Creates a face from the given vertex nodes. + * + * @private + * @param {VertexNode} a - The first vertex node. + * @param {VertexNode} b - The second vertex node. + * @param {VertexNode} c - The third vertex node. + * @return {Face} The created face. + */ + private static create; + /** + * The normal vector of the face. + * + * @private + * @type {Vector3} + */ + private normal; + /** + * The midpoint or centroid of the face. + * + * @private + * @type {Vector3} + */ + private midpoint; + /** + * The area of the face. + * + * @private + * @type {number} + * @default 0 + */ + private area; + /** + * Signed distance from face to the origin. + * + * @private + * @type {number} + * @default 0 + */ + private constant; + /** + * Reference to a vertex in a vertex list this face can see. + * + * @private + * @type {?VertexNode} + * @default null + */ + private outside; + mark: number; + /** + * Reference to the base edge of a face. To retrieve all edges, you can use the + * `next` reference of the current edge. + * + * @private + * @type {?HalfEdge} + * @default null + */ + private edge; + /** + * Returns an edge by the given index. + * + * @private + * @param {number} i - The edge index. + * @return {HalfEdge} The edge. + */ + private getEdge; + /** + * Computes all properties of the face. + * + * @private + * @return {Face} A reference to this face. + */ + private compute; + /** + * Returns the signed distance from a given point to the plane representation of this face. + * + * @private + * @param {Vector3} point - The point to compute the distance to. + * @return {number} The distance. + */ + private distanceToPoint; +} +/** + * The basis for a half-edge data structure, also known as doubly + * connected edge list (DCEL). + * + * @private + */ +export class HalfEdge { + /** + * Constructs a new half edge. + * + * @param {VertexNode} vertex - A reference to its destination vertex. + * @param {Face} face - A reference to its face. + */ + constructor(vertex: VertexNode, face: Face); + /** + * A reference to its destination vertex. + * + * @private + * @type {VertexNode} + */ + private vertex; + /** + * Reference to the previous half-edge of the same face. + * + * @private + * @type {?HalfEdge} + * @default null + */ + private prev; + /** + * Reference to the next half-edge of the same face. + * + * @private + * @type {?HalfEdge} + * @default null + */ + private next; + /** + * Reference to the twin half-edge to reach the opposite face. + * + * @private + * @type {?HalfEdge} + * @default null + */ + private twin; + /** + * A reference to its face. + * + * @private + * @type {Face} + */ + private face; + /** + * Returns the destination vertex. + * + * @private + * @return {VertexNode} The destination vertex. + */ + private head; + /** + * Returns the origin vertex. + * + * @private + * @return {?VertexNode} The destination vertex. + */ + private tail; + /** + * Returns the Euclidean length (straight-line length) of the edge. + * + * @private + * @return {number} The edge's length. + */ + private length; + /** + * Returns the square of the Euclidean length (straight-line length) of the edge. + * + * @private + * @return {number} The square of the edge's length. + */ + private lengthSquared; + /** + * Sets the twin edge of this half-edge. It also ensures that the twin reference + * of the given half-edge is correctly set. + * + * @private + * @param {HalfEdge} edge - The twin edge to set. + * @return {HalfEdge} A reference to this edge. + */ + private setTwin; +} +/** + * A vertex as a double linked list node. + * + * @private + */ +export class VertexNode { + /** + * Constructs a new vertex node. + * + * @param {Vector3} point - A point in 3D space. + */ + constructor(point: Vector3); + /** + * A point in 3D space. + * + * @private + * @type {Vector3} + */ + private point; + /** + * Reference to the previous vertex in the double linked list. + * + * @private + * @type {?VertexNode} + * @default null + */ + private prev; + /** + * Reference to the next vertex in the double linked list. + * + * @private + * @type {?VertexNode} + * @default null + */ + private next; + /** + * Reference to the face that is able to see this vertex. + * + * @private + * @type {?Face} + * @default null + */ + private face; +} +/** + * A doubly linked list of vertices. + * + * @private + */ +export class VertexList { + /** + * Reference to the first vertex of the linked list. + * + * @private + * @type {?VertexNode} + * @default null + */ + private head; + /** + * Reference to the last vertex of the linked list. + * + * @private + * @type {?VertexNode} + * @default null + */ + private tail; + /** + * Returns the head reference. + * + * @private + * @return {VertexNode} The head reference. + */ + private first; + /** + * Returns the tail reference. + * + * @private + * @return {VertexNode} The tail reference. + */ + private last; + /** + * Clears the linked list. + * + * @private + * @return {VertexList} A reference to this vertex list. + */ + private clear; + /** + * Inserts a vertex before a target vertex. + * + * @private + * @param {VertexNode} target - The target. + * @param {VertexNode} vertex - The vertex to insert. + * @return {VertexList} A reference to this vertex list. + */ + private insertBefore; + /** + * Inserts a vertex after a target vertex. + * + * @private + * @param {VertexNode} target - The target. + * @param {VertexNode} vertex - The vertex to insert. + * @return {VertexList} A reference to this vertex list. + */ + private insertAfter; + /** + * Appends a vertex to this vertex list. + * + * @private + * @param {VertexNode} vertex - The vertex to append. + * @return {VertexList} A reference to this vertex list. + */ + private append; + /** + * Appends a chain of vertices where the given vertex is the head. + * + * @private + * @param {VertexNode} vertex - The head vertex of a chain of vertices. + * @return {VertexList} A reference to this vertex list. + */ + private appendChain; + /** + * Removes a vertex from the linked list. + * + * @private + * @param {VertexNode} vertex - The vertex to remove. + * @return {VertexList} A reference to this vertex list. + */ + private remove; + /** + * Removes a sublist of vertices from the linked list. + * + * @private + * @param {VertexNode} a - The head of the sublist. + * @param {VertexNode} b - The tail of the sublist. + * @return {VertexList} A reference to this vertex list. + */ + private removeSubList; + /** + * Returns `true` if the linked list is empty. + * + * @private + * @return {boolean} Whether the linked list is empty or not. + */ + private isEmpty; +} +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts new file mode 100644 index 000000000..85ce6eb37 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts @@ -0,0 +1,19 @@ +/** + * A utility class providing a 3D noise function. + * + * The code is based on [IMPROVED NOISE](https://cs.nyu.edu/~perlin/noise/) + * by Ken Perlin, 2002. + * + * @three_import import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + */ +export class ImprovedNoise { + /** + * Returns a noise value for the given parameters. + * + * @param {number} x - The x coordinate. + * @param {number} y - The y coordinate. + * @param {number} z - The z coordinate. + * @return {number} The noise value. + */ + noise(x: number, y: number, z: number): number; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts new file mode 100644 index 000000000..2650ec61f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts @@ -0,0 +1,133 @@ +/** + * Represents a lookup table for colormaps. It is used to determine the color + * values from a range of data values. + * + * ```js + * const lut = new Lut( 'rainbow', 512 ); + * const color = lut.getColor( 0.5 ); + * ``` + * + * @three_import import { Lut } from 'three/addons/math/Lut.js'; + */ +export class Lut { + /** + * Constructs a new Lut. + * + * @param {('rainbow'|'cooltowarm'|'blackbody'|'grayscale')} [colormap='rainbow'] - Sets a colormap from predefined list of colormaps. + * @param {number} [count=32] - Sets the number of colors used to represent the data array. + */ + constructor(colormap?: ("rainbow" | "cooltowarm" | "blackbody" | "grayscale"), count?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLut: boolean; + /** + * The lookup table for the selected color map + * + * @type {Array} + */ + lut: Array; + /** + * The currently selected color map. + * + * @type {Array>} + */ + map: Array>; + /** + * The number of colors of the current selected color map. + * + * @type {number} + * @default 32 + */ + n: number; + /** + * The minimum value to be represented with the lookup table. + * + * @type {number} + * @default 0 + */ + minV: number; + /** + * The maximum value to be represented with the lookup table. + * + * @type {number} + * @default 1 + */ + maxV: number; + /** + * Sets the given LUT. + * + * @param {Lut} value - The LUT to set. + * @return {Lut} A reference to this LUT. + */ + set(value: Lut): Lut; + /** + * Sets the minimum value to be represented with this LUT. + * + * @param {number} min - The minimum value to be represented with the lookup table. + * @return {Lut} A reference to this LUT. + */ + setMin(min: number): Lut; + /** + * Sets the maximum value to be represented with this LUT. + * + * @param {number} max - The maximum value to be represented with the lookup table. + * @return {Lut} A reference to this LUT. + */ + setMax(max: number): Lut; + /** + * Configure the lookup table for the given color map and number of colors. + * + * @param {string} colormap - The name of the color map. + * @param {number} [count=32] - The number of colors. + * @return {Lut} A reference to this LUT. + */ + setColorMap(colormap: string, count?: number): Lut; + /** + * Copies the given lut. + * + * @param {Lut} lut - The LUT to copy. + * @return {Lut} A reference to this LUT. + */ + copy(lut: Lut): Lut; + /** + * Returns an instance of Color for the given data value. + * + * @param {number} alpha - The value to lookup. + * @return {Color} The color from the LUT. + */ + getColor(alpha: number): Color; + /** + * Adds a color map to this Lut instance. + * + * @param {string} name - The name of the color map. + * @param {Array>} arrayOfColors - An array of color values. Each value is an array + * holding a threshold and the actual color value as a hexadecimal number. + * @return {Lut} A reference to this LUT. + */ + addColorMap(name: string, arrayOfColors: Array>): Lut; + /** + * Creates a canvas in order to visualize the lookup table as a texture. + * + * @return {HTMLCanvasElement} The created canvas. + */ + createCanvas(): HTMLCanvasElement; + /** + * Updates the given canvas with the Lut's data. + * + * @param {HTMLCanvasElement} canvas - The canvas to update. + * @return {HTMLCanvasElement} The updated canvas. + */ + updateCanvas(canvas: HTMLCanvasElement): HTMLCanvasElement; +} +export namespace ColorMapKeywords { + let rainbow: number[][]; + let cooltowarm: number[][]; + let blackbody: number[][]; + let grayscale: number[][]; +} +import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts new file mode 100644 index 000000000..c430c18dd --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts @@ -0,0 +1,95 @@ +/** + * Utility class for sampling weighted random points on the surface of a mesh. + * + * Building the sampler is a one-time O(n) operation. Once built, any number of + * random samples may be selected in O(logn) time. Memory usage is O(n). + * + * References: + * - {@link http://www.joesfer.com/?p=84} + * - {@link https://stackoverflow.com/a/4322940/1314762} + * + * ```js + * const sampler = new MeshSurfaceSampler( surfaceMesh ) + * .setWeightAttribute( 'color' ) + * .build(); + * + * const mesh = new THREE.InstancedMesh( sampleGeometry, sampleMaterial, 100 ); + * + * const position = new THREE.Vector3(); + * const matrix = new THREE.Matrix4(); + * + * // Sample randomly from the surface, creating an instance of the sample geometry at each sample point. + * + * for ( let i = 0; i < 100; i ++ ) { + * + * sampler.sample( position ); + * matrix.makeTranslation( position.x, position.y, position.z ); + * mesh.setMatrixAt( i, matrix ); + * + * } + * + * scene.add( mesh ); + * ``` + * + * @three_import import { MeshSurfaceSampler } from 'three/addons/math/MeshSurfaceSampler.js'; + */ +export class MeshSurfaceSampler { + /** + * Constructs a mesh surface sampler. + * + * @param {Mesh} mesh - Surface mesh from which to sample. + */ + constructor(mesh: Mesh); + geometry: any; + randomFunction: () => number; + indexAttribute: any; + positionAttribute: any; + normalAttribute: any; + colorAttribute: any; + uvAttribute: any; + weightAttribute: any; + distribution: Float32Array | null; + /** + * Specifies a vertex attribute to be used as a weight when sampling from the surface. + * Faces with higher weights are more likely to be sampled, and those with weights of + * zero will not be sampled at all. For vector attributes, only .x is used in sampling. + * + * If no weight attribute is selected, sampling is randomly distributed by area. + * + * @param {string} name - The attribute name. + * @return {MeshSurfaceSampler} A reference to this sampler. + */ + setWeightAttribute(name: string): MeshSurfaceSampler; + /** + * Processes the input geometry and prepares to return samples. Any configuration of the + * geometry or sampler must occur before this method is called. Time complexity is O(n) + * for a surface with n faces. + * + * @return {MeshSurfaceSampler} A reference to this sampler. + */ + build(): MeshSurfaceSampler; + /** + * Allows to set a custom random number generator. Default is `Math.random()`. + * + * @param {Function} randomFunction - A random number generator. + * @return {MeshSurfaceSampler} A reference to this sampler. + */ + setRandomGenerator(randomFunction: Function): MeshSurfaceSampler; + /** + * Selects a random point on the surface of the input geometry, returning the + * position and optionally the normal vector, color and UV Coordinate at that point. + * Time complexity is O(log n) for a surface with n faces. + * + * @param {Vector3} targetPosition - The target object holding the sampled position. + * @param {Vector3} targetNormal - The target object holding the sampled normal. + * @param {Color} targetColor - The target object holding the sampled color. + * @param {Vector2} targetUV - The target object holding the sampled uv coordinates. + * @return {MeshSurfaceSampler} A reference to this sampler. + */ + sample(targetPosition: Vector3, targetNormal: Vector3, targetColor: Color, targetUV: Vector2): MeshSurfaceSampler; + _sampleFaceIndex(): number; + _binarySearch(x: any): number; + _sampleFace(faceIndex: any, targetPosition: any, targetNormal: any, targetColor: any, targetUV: any): this; +} +import { Vector3 } from 'three'; +import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts new file mode 100644 index 000000000..de304fef8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts @@ -0,0 +1,150 @@ +/** + * Represents an oriented bounding box (OBB) in 3D space. + * + * @three_import import { OBB } from 'three/addons/math/OBB.js'; + */ +export class OBB { + /** + * Constructs a new OBB. + * + * @param {Vector3} [center] - The center of the OBB. + * @param {Vector3} [halfSize] - Positive halfwidth extents of the OBB along each axis. + * @param {Matrix3} [rotation] - The rotation of the OBB. + */ + constructor(center?: Vector3, halfSize?: Vector3, rotation?: Matrix3); + /** + * The center of the OBB. + * + * @type {Vector3} + */ + center: Vector3; + /** + * Positive halfwidth extents of the OBB along each axis. + * + * @type {Vector3} + */ + halfSize: Vector3; + /** + * The rotation of the OBB. + * + * @type {Matrix3} + */ + rotation: Matrix3; + /** + * Sets the OBBs components to the given values. + * + * @param {Vector3} [center] - The center of the OBB. + * @param {Vector3} [halfSize] - Positive halfwidth extents of the OBB along each axis. + * @param {Matrix3} [rotation] - The rotation of the OBB. + * @return {OBB} A reference to this OBB. + */ + set(center?: Vector3, halfSize?: Vector3, rotation?: Matrix3): OBB; + /** + * Copies the values of the given OBB to this instance. + * + * @param {OBB} obb - The OBB to copy. + * @return {OBB} A reference to this OBB. + */ + copy(obb: OBB): OBB; + /** + * Returns a new OBB with copied values from this instance. + * + * @return {OBB} A clone of this instance. + */ + clone(): OBB; + /** + * Returns the size of this OBB. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The size. + */ + getSize(target: Vector3): Vector3; + /** + * Clamps the given point within the bounds of this OBB. + * + * @param {Vector3} point - The point that should be clamped within the bounds of this OBB. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @returns {Vector3} - The clamped point. + */ + clampPoint(point: Vector3, target: Vector3): Vector3; + /** + * Returns `true` if the given point lies within this OBB. + * + * @param {Vector3} point - The point to test. + * @returns {boolean} - Whether the given point lies within this OBB or not. + */ + containsPoint(point: Vector3): boolean; + /** + * Returns `true` if the given AABB intersects this OBB. + * + * @param {Box3} box3 - The AABB to test. + * @returns {boolean} - Whether the given AABB intersects this OBB or not. + */ + intersectsBox3(box3: Box3): boolean; + /** + * Returns `true` if the given bounding sphere intersects this OBB. + * + * @param {Sphere} sphere - The bounding sphere to test. + * @returns {boolean} - Whether the given bounding sphere intersects this OBB or not. + */ + intersectsSphere(sphere: Sphere): boolean; + /** + * Returns `true` if the given OBB intersects this OBB. + * + * @param {OBB} obb - The OBB to test. + * @param {number} [epsilon=Number.EPSILON] - A small value to prevent arithmetic errors. + * @returns {boolean} - Whether the given OBB intersects this OBB or not. + */ + intersectsOBB(obb: OBB, epsilon?: number): boolean; + /** + * Returns `true` if the given plane intersects this OBB. + * + * @param {Plane} plane - The plane to test. + * @returns {boolean} Whether the given plane intersects this OBB or not. + */ + intersectsPlane(plane: Plane): boolean; + /** + * Performs a ray/OBB intersection test and stores the intersection point + * in the given 3D vector. + * + * @param {Ray} ray - The ray to test. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The intersection point. If no intersection is detected, `null` is returned. + */ + intersectRay(ray: Ray, target: Vector3): Vector3 | null; + /** + * Returns `true` if the given ray intersects this OBB. + * + * @param {Ray} ray - The ray to test. + * @returns {boolean} Whether the given ray intersects this OBB or not. + */ + intersectsRay(ray: Ray): boolean; + /** + * Defines an OBB based on the given AABB. + * + * @param {Box3} box3 - The AABB to setup the OBB from. + * @return {OBB} A reference of this OBB. + */ + fromBox3(box3: Box3): OBB; + /** + * Returns `true` if the given OBB is equal to this OBB. + * + * @param {OBB} obb - The OBB to test. + * @returns {boolean} Whether the given OBB is equal to this OBB or not. + */ + equals(obb: OBB): boolean; + /** + * Applies the given transformation matrix to this OBB. This method can be + * used to transform the bounding volume with the world matrix of a 3D object + * in order to keep both entities in sync. + * + * @param {Matrix4} matrix - The matrix to apply. + * @return {OBB} A reference of this OBB. + */ + applyMatrix4(matrix: Matrix4): OBB; +} +import { Vector3 } from 'three'; +import { Matrix3 } from 'three'; +import { Box3 } from 'three'; +import { Ray } from 'three'; +import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts new file mode 100644 index 000000000..234a0bd1d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts @@ -0,0 +1,195 @@ +/** + * An octree is a hierarchical tree data structure used to partition a three-dimensional + * space by recursively subdividing it into eight octants. + * + * This particular implementation can have up to sixteen levels and stores up to eight triangles + * in leaf nodes. + * + * `Octree` can be used in games to compute collision between the game world and colliders from + * the player or other dynamic 3D objects. + * + * + * ```js + * const octree = new Octree().fromGraphNode( scene ); + * const result = octree.capsuleIntersect( playerCollider ); // collision detection + * ``` + * + * @three_import import { Octree } from 'three/addons/math/Octree.js'; + */ +export class Octree { + /** + * Constructs a new Octree. + * + * @param {Box3} [box] - The base box with enclose the entire Octree. + */ + constructor(box?: Box3); + /** + * The base box with enclose the entire Octree. + * + * @type {Box3} + */ + box: Box3; + /** + * The bounds of the Octree. Compared to {@link Octree#box}, no + * margin is applied. + * + * @type {Box3} + */ + bounds: Box3; + /** + * Can by used for layers configuration for refine testing. + * + * @type {Layers} + */ + layers: Layers; + /** + * The number of triangles a leaf can store before it is split. + * + * @type {number} + * @default 8 + */ + trianglesPerLeaf: number; + /** + * The maximum level of the Octree. It defines the maximum + * hierarchical depth of the data structure. + * + * @type {number} + * @default 16 + */ + maxLevel: number; + subTrees: any[]; + triangles: any[]; + /** + * Adds the given triangle to the Octree. The triangle vertices are clamped if they exceed + * the bounds of the Octree. + * + * @param {Triangle} triangle - The triangle to add. + * @return {Octree} A reference to this Octree. + */ + addTriangle(triangle: Triangle): Octree; + /** + * Prepares {@link Octree#box} for the build. + * + * @return {Octree} A reference to this Octree. + */ + calcBox(): Octree; + /** + * Splits the Octree. This method is used recursively when + * building the Octree. + * + * @param {number} level - The current level. + * @return {Octree} A reference to this Octree. + */ + split(level: number): Octree; + /** + * Builds the Octree. + * + * @return {Octree} A reference to this Octree. + */ + build(): Octree; + /** + * Computes the triangles that potentially intersect with the given ray. + * + * @param {Ray} ray - The ray to test. + * @param {Array} triangles - The target array that holds the triangles. + */ + getRayTriangles(ray: Ray, triangles: Array): void; + /** + * Computes the intersection between the given capsule and triangle. + * + * @param {Capsule} capsule - The capsule to test. + * @param {Triangle} triangle - The triangle to test. + * @return {Object|false} The intersection object. If no intersection + * is detected, the method returns `false`. + */ + triangleCapsuleIntersect(capsule: Capsule, triangle: Triangle): Object | false; + /** + * Computes the intersection between the given bounding box and triangle. + * + * @param {Box3} box - The bounding box to test. + * @param {Triangle} triangle - The triangle to test. + * @return {Object|false} The intersection object. If no intersection + * is detected, the method returns `false`. + */ + triangleBoxIntersect(box: Box3, triangle: Triangle): Object | false; + /** + * Computes the intersection between the given sphere and triangle. + * + * @param {Sphere} sphere - The sphere to test. + * @param {Triangle} triangle - The triangle to test. + * @return {Object|false} The intersection object. If no intersection + * is detected, the method returns `false`. + */ + triangleSphereIntersect(sphere: Sphere, triangle: Triangle): Object | false; + /** + * Computes the triangles that potentially intersect with the given bounding sphere. + * + * @param {Sphere} sphere - The sphere to test. + * @param {Array} triangles - The target array that holds the triangles. + */ + getSphereTriangles(sphere: Sphere, triangles: Array): void; + /** + * Computes the triangles that potentially intersect with the given bounding box. + * + * @param {Box3} box - The bounding box. + * @param {Array} triangles - The target array that holds the triangles. + */ + getBoxTriangles(box: Box3, triangles: Array): void; + /** + * Computes the triangles that potentially intersect with the given capsule. + * + * @param {Capsule} capsule - The capsule to test. + * @param {Array} triangles - The target array that holds the triangles. + */ + getCapsuleTriangles(capsule: Capsule, triangles: Array): void; + /** + * Performs a bounding box intersection test with this Octree. + * + * @param {Box3} box - The bounding box to test. + * @return {Object|boolean} The intersection object. If no intersection + * is detected, the method returns `false`. + */ + boxIntersect(box: Box3): Object | boolean; + /** + * Performs a bounding sphere intersection test with this Octree. + * + * @param {Sphere} sphere - The bounding sphere to test. + * @return {Object|boolean} The intersection object. If no intersection + * is detected, the method returns `false`. + */ + sphereIntersect(sphere: Sphere): Object | boolean; + /** + * Performs a capsule intersection test with this Octree. + * + * @param {Capsule} capsule - The capsule to test. + * @return {Object|boolean} The intersection object. If no intersection + * is detected, the method returns `false`. + */ + capsuleIntersect(capsule: Capsule): Object | boolean; + /** + * Performs a ray intersection test with this Octree. + * + * @param {Ray} ray - The ray to test. + * @return {Object|boolean} The nearest intersection object. If no intersection + * is detected, the method returns `false`. + */ + rayIntersect(ray: Ray): Object | boolean; + /** + * Constructs the Octree from the given 3D object. + * + * @param {Object3D} group - The scene graph node. + * @return {Octree} A reference to this Octree. + */ + fromGraphNode(group: Object3D): Octree; + /** + * Clears the Octree by making it empty. + * + * @return {Octree} A reference to this Octree. + */ + clear(): Octree; +} +import { Box3 } from 'three'; +import { Layers } from 'three'; +import { Triangle } from 'three'; +import { Capsule } from '../math/Capsule.js'; +import { Sphere } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts new file mode 100644 index 000000000..b6ba529db --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts @@ -0,0 +1,52 @@ +/** + * A utility class providing noise functions. + * + * The code is based on [Simplex noise demystified](https://web.archive.org/web/20210210162332/http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf) + * by Stefan Gustavson, 2005. + * + * @three_import import { SimplexNoise } from 'three/addons/math/SimplexNoise.js'; + */ +export class SimplexNoise { + /** + * Constructs a new simplex noise object. + * + * @param {Object} [r=Math] - A math utility class that holds a `random()` method. This makes it + * possible to pass in custom random number generator. + */ + constructor(r?: Object); + grad3: number[][]; + grad4: number[][]; + p: number[]; + perm: number[]; + simplex: number[][]; + /** + * A 2D simplex noise method. + * + * @param {number} xin - The x coordinate. + * @param {number} yin - The y coordinate. + * @return {number} The noise value. + */ + noise(xin: number, yin: number): number; + /** + * A 3D simplex noise method. + * + * @param {number} xin - The x coordinate. + * @param {number} yin - The y coordinate. + * @param {number} zin - The z coordinate. + * @return {number} The noise value. + */ + noise3d(xin: number, yin: number, zin: number): number; + /** + * A 4D simplex noise method. + * + * @param {number} x - The x coordinate. + * @param {number} y - The y coordinate. + * @param {number} z - The z coordinate. + * @param {number} w - The w coordinate. + * @return {number} The noise value. + */ + noise4d(x: number, y: number, z: number, w: number): number; + _dot(g: any, x: any, y: any): number; + _dot3(g: any, x: any, y: any, z: any): number; + _dot4(g: any, x: any, y: any, z: any, w: any): number; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts new file mode 100644 index 000000000..f1201ad74 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts @@ -0,0 +1,93 @@ +/** + * This class can be used to subdivide a convex Geometry object into pieces. + * + * Use the function prepareBreakableObject to prepare a Mesh object to be broken. + * Then, call the various functions to subdivide the object (subdivideByImpact, cutByPlane). + * Sub-objects that are product of subdivision don't need prepareBreakableObject to be called on them. + * + * Requisites for the object: + * - Mesh object must have a buffer geometry and a material. + * - Vertex normals must be planar (not smoothed). + * - The geometry must be convex (this is not checked in the library). You can create convex + * geometries with {@link ConvexGeometry}. The {@link BoxGeometry}, {@link SphereGeometry} and other + * convex primitives can also be used. + * + * Note: This lib adds member variables to object's userData member (see prepareBreakableObject function) + * Use with caution and read the code when using with other libs. + * + * @three_import import { ConvexObjectBreaker } from 'three/addons/misc/ConvexObjectBreaker.js'; + */ +export class ConvexObjectBreaker { + static transformFreeVector(v: any, m: any): any; + static transformFreeVectorInverse(v: any, m: any): any; + static transformTiedVectorInverse(v: any, m: any): any; + static transformPlaneToLocalSpace(plane: any, m: any, resultPlane: any): void; + /** + * Constructs a new convex object breaker. + * + * @param {number} [minSizeForBreak=1.4] - Min size a debris can have to break. + * @param {number} [smallDelta=0.0001] - Max distance to consider that a point belongs to a plane. + */ + constructor(minSizeForBreak?: number, smallDelta?: number); + minSizeForBreak: number; + smallDelta: number; + tempLine1: Line3; + tempPlane1: Plane; + tempPlane2: Plane; + tempPlane_Cut: Plane; + tempCM1: Vector3; + tempCM2: Vector3; + tempVector3: Vector3; + tempVector3_2: Vector3; + tempVector3_3: Vector3; + tempVector3_P0: Vector3; + tempVector3_P1: Vector3; + tempVector3_P2: Vector3; + tempVector3_N0: Vector3; + tempVector3_N1: Vector3; + tempVector3_AB: Vector3; + tempVector3_CB: Vector3; + tempResultObjects: { + object1: null; + object2: null; + }; + segments: boolean[]; + /** + * Must be called for all 3D objects that should be breakable. + * + * @param {Object3D} object - The 3D object. It must have a convex geometry. + * @param {number} mass - The 3D object's mass in kg. Must be greater than `0`. + * @param {Vector3} velocity - The 3D object's velocity. + * @param {Vector3} angularVelocity - The 3D object's angular velocity. + * @param {boolean} breakable - Whether the 3D object is breakable or not. + */ + prepareBreakableObject(object: Object3D, mass: number, velocity: Vector3, angularVelocity: Vector3, breakable: boolean): void; + /** + * Subdivides the given 3D object into pieces by an impact (meaning another object hits + * the given 3D object at a certain surface point). + * + * @param {Object3D} object - The 3D object to subdivide. + * @param {Vector3} pointOfImpact - The point of impact. + * @param {Vector3} normal - The impact normal. + * @param {number} maxRadialIterations - Iterations for radial cuts. + * @param {number} maxRandomIterations - Max random iterations for not-radial cuts. + * @return {Array} The array of pieces. + */ + subdivideByImpact(object: Object3D, pointOfImpact: Vector3, normal: Vector3, maxRadialIterations: number, maxRandomIterations: number): Array; + /** + * Subdivides the given 3D object into pieces by a plane. + * + * @param {Object3D} object - The 3D object to subdivide. + * @param {Plane} plane - The plane to cut the 3D object. + * @param {{object1:?Mesh,object2:?Mesh}} output - An object that stores the pieces. + * @return {number} The number of pieces. + */ + cutByPlane(object: Object3D, plane: Plane, output: { + object1: Mesh | null; + object2: Mesh | null; + }): number; +} +import { Line3 } from 'three'; +import { Plane } from 'three'; +import { Vector3 } from 'three'; +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts new file mode 100644 index 000000000..783a39ef5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts @@ -0,0 +1,13 @@ +/** + * A special type of 3D object that takes a position from the scene graph hierarchy + * but uses its local rotation as world rotation. It works like real-world gyroscope - + * you can move it around using hierarchy while its orientation stays fixed with + * respect to the world. + * + * @augments Object3D + * @three_import import { Gyroscope } from 'three/addons/misc/Gyroscope.js'; + */ +export class Gyroscope extends Object3D { + updateMatrixWorld(force: any): void; +} +import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts new file mode 100644 index 000000000..39a32d240 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts @@ -0,0 +1,133 @@ +/** + * This class represents a management component for animated MD2 + * character assets. + * + * @three_import import { MD2Character } from 'three/addons/misc/MD2Character.js'; + */ +export class MD2Character { + /** + * The mesh scale. + * + * @type {number} + * @default 1 + */ + scale: number; + /** + * The FPS + * + * @type {number} + * @default 6 + */ + animationFPS: number; + /** + * The root 3D object + * + * @type {Object3D} + */ + root: Object3D; + /** + * The body mesh. + * + * @type {?Mesh} + * @default null + */ + meshBody: Mesh | null; + /** + * The weapon mesh. + * + * @type {?Mesh} + * @default null + */ + meshWeapon: Mesh | null; + /** + * The body skins. + * + * @type {Array} + */ + skinsBody: Array; + /** + * The weapon skins. + * + * @type {Array} + */ + skinsWeapon: Array; + /** + * The weapon meshes. + * + * @type {Array} + */ + weapons: Array; + /** + * The name of the active animation clip. + * + * @type {?string} + * @default null + */ + activeAnimationClipName: string | null; + /** + * The animation mixer. + * + * @type {?AnimationMixer} + * @default null + */ + mixer: AnimationMixer | null; + /** + * The `onLoad` callback function. + * + * @type {Function} + */ + onLoadComplete: Function; + loadCounter: number; + /** + * Loads the character model for the given config. + * + * @param {Object} config - The config which defines the model and textures paths. + */ + loadParts(config: Object): void; + /** + * Sets the animation playback rate. + * + * @param {number} rate - The playback rate to set. + */ + setPlaybackRate(rate: number): void; + /** + * Sets the wireframe material flag. + * + * @param {boolean} wireframeEnabled - Whether to enable wireframe rendering or not. + */ + setWireframe(wireframeEnabled: boolean): void; + /** + * Sets the skin defined by the given skin index. This will result in a different texture + * for the body mesh. + * + * @param {number} index - The skin index. + */ + setSkin(index: number): void; + /** + * Sets the weapon defined by the given weapon index. This will result in a different weapon + * hold by the character. + * + * @param {number} index - The weapon index. + */ + setWeapon(index: number): void; + /** + * Sets the defined animation clip as the active animation. + * + * @param {string} clipName - The name of the animation clip. + */ + setAnimation(clipName: string): void; + activeClipName: string | undefined; + /** + * Synchronizes the weapon with the body animation. + */ + syncWeaponAnimation(): void; + /** + * Updates the animations of the mesh. Must be called inside the animation loop. + * + * @param {number} delta - The delta time in seconds. + */ + update(delta: number): void; +} +import { Object3D } from 'three'; +import { Mesh } from 'three'; +import { AnimationMixer } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts new file mode 100644 index 000000000..9ccc09604 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts @@ -0,0 +1,210 @@ +/** + * This class represents a management component for animated MD2 + * character assets. It provides a larger API compared to {@link MD2Character}. + * + * @three_import import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js'; + */ +export class MD2CharacterComplex { + /** + * The mesh scale. + * + * @type {number} + * @default 1 + */ + scale: number; + /** + * The FPS + * + * @type {number} + * @default 6 + */ + animationFPS: number; + /** + * The transition frames. + * + * @type {number} + * @default 15 + */ + transitionFrames: number; + /** + * The character's maximum speed. + * + * @type {number} + * @default 275 + */ + maxSpeed: number; + /** + * The character's maximum reverse speed. + * + * @type {number} + * @default - 275 + */ + maxReverseSpeed: number; + /** + * The character's front acceleration. + * + * @type {number} + * @default 600 + */ + frontAcceleration: number; + /** + * The character's back acceleration. + * + * @type {number} + * @default 600 + */ + backAcceleration: number; + /** + * The character's front deceleration. + * + * @type {number} + * @default 600 + */ + frontDeceleration: number; + /** + * The character's angular speed. + * + * @type {number} + * @default 2.5 + */ + angularSpeed: number; + /** + * The root 3D object + * + * @type {Object3D} + */ + root: Object3D; + /** + * The body mesh. + * + * @type {?Mesh} + * @default null + */ + meshBody: Mesh | null; + /** + * The weapon mesh. + * + * @type {?Mesh} + * @default null + */ + meshWeapon: Mesh | null; + /** + * The movement controls. + * + * @type {?Object} + * @default null + */ + controls: Object | null; + /** + * The body skins. + * + * @type {Array} + */ + skinsBody: Array; + /** + * The weapon skins. + * + * @type {Array} + */ + skinsWeapon: Array; + /** + * The weapon meshes. + * + * @type {Array} + */ + weapons: Array; + /** + * The current skin. + * + * @type {Texture} + * @default undefined + */ + currentSkin: Texture; + onLoadComplete: () => void; + meshes: any[]; + animations: {}; + loadCounter: number; + speed: number; + bodyOrientation: number; + walkSpeed: number; + crouchSpeed: number; + activeAnimation: any; + oldAnimation: any; + /** + * Toggles shadow casting and receiving on the character's meshes. + * + * @param {boolean} enable - Whether to enable shadows or not. + */ + enableShadows(enable: boolean): void; + /** + * Toggles visibility on the character's meshes. + * + * @param {boolean} enable - Whether the character is visible or not. + */ + setVisible(enable: boolean): void; + /** + * Shares certain resources from a different character model. + * + * @param {MD2CharacterComplex} original - The original MD2 character. + */ + shareParts(original: MD2CharacterComplex): void; + /** + * Loads the character model for the given config. + * + * @param {Object} config - The config which defines the model and textures paths. + */ + loadParts(config: Object): void; + /** + * Sets the animation playback rate. + * + * @param {number} rate - The playback rate to set. + */ + setPlaybackRate(rate: number): void; + /** + * Sets the wireframe material flag. + * + * @param {boolean} wireframeEnabled - Whether to enable wireframe rendering or not. + */ + setWireframe(wireframeEnabled: boolean): void; + /** + * Sets the skin defined by the given skin index. This will result in a different texture + * for the body mesh. + * + * @param {number} index - The skin index. + */ + setSkin(index: number): void; + /** + * Sets the weapon defined by the given weapon index. This will result in a different weapon + * hold by the character. + * + * @param {number} index - The weapon index. + */ + setWeapon(index: number): void; + /** + * Sets the defined animation clip as the active animation. + * + * @param {string} animationName - The name of the animation clip. + */ + setAnimation(animationName: string): void; + blendCounter: number | undefined; + update(delta: any): void; + /** + * Updates the animations of the mesh. Must be called inside the animation loop. + * + * @param {number} delta - The delta time in seconds. + */ + updateAnimations(delta: number): void; + /** + * Updates the animation state based on the control inputs. + */ + updateBehaviors(): void; + /** + * Transforms the character model based on the control input. + * + * @param {number} delta - The delta time in seconds. + */ + updateMovementModel(delta: number): void; + _createPart(geometry: any, skinMap: any): MorphBlendMesh; +} +import { Object3D } from 'three'; +import { MorphBlendMesh } from '../misc/MorphBlendMesh.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts new file mode 100644 index 000000000..565013827 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts @@ -0,0 +1,55 @@ +/** + * A special type of an animated mesh with a simple interface + * for animation playback. It allows to playback just one animation + * without any transitions or fading between animation changes. + * + * @augments Mesh + * @three_import import { MorphAnimMesh } from 'three/addons/misc/MorphAnimMesh.js'; + */ +export class MorphAnimMesh extends Mesh { + /** + * Constructs a new morph anim mesh. + * + * @param {BufferGeometry} [geometry] - The mesh geometry. + * @param {Material|Array} [material] - The mesh material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * The internal animation mixer. + * + * @type {AnimationMixer} + */ + mixer: AnimationMixer; + /** + * The current active animation action. + * + * @type {?AnimationAction} + * @default null + */ + activeAction: AnimationAction | null; + /** + * Sets the animation playback direction to "forward". + */ + setDirectionForward(): void; + /** + * Sets the animation playback direction to "backward". + */ + setDirectionBackward(): void; + /** + * Plays the defined animation clip. The implementation assumes the animation + * clips are stored in {@link Object3D#animations} or the geometry. + * + * @param {string} label - The name of the animation clip. + * @param {number} fps - The FPS of the animation clip. + */ + playAnimation(label: string, fps: number): void; + /** + * Updates the animations of the mesh. Must be called inside the animation loop. + * + * @param {number} delta - The delta time in seconds. + */ + updateAnimation(delta: number): void; + copy(source: any, recursive: any): this; +} +import { Mesh } from 'three'; +import { AnimationMixer } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts new file mode 100644 index 000000000..153109c6a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts @@ -0,0 +1,124 @@ +/** + * A special type of an animated mesh with a more advanced interface + * for animation playback. Unlike {@link MorphAnimMesh}. It allows to + * playback more than one morph animation at the same time but without + * fading options. + * + * @augments Mesh + * @three_import import { MorphBlendMesh } from 'three/addons/misc/MorphBlendMesh.js'; + */ +export class MorphBlendMesh extends Mesh { + /** + * Constructs a new morph blend mesh. + * + * @param {BufferGeometry} [geometry] - The mesh geometry. + * @param {Material|Array} [material] - The mesh material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * A dictionary of animations. + * + * @type {Object} + */ + animationsMap: { + [x: string]: Object; + }; + /** + * A list of animations. + * + * @type {Array} + */ + animationsList: Array; + /** + * Creates a new animation. + * + * @param {string} name - The animation name. + * @param {number} start - The start time. + * @param {number} end - The end time. + * @param {number} fps - The FPS. + */ + createAnimation(name: string, start: number, end: number, fps: number): void; + /** + * Automatically creates animations based on the values in + * {@link Mesh#morphTargetDictionary}. + * + * @param {number} fps - The FPS of all animations. + */ + autoCreateAnimations(fps: number): void; + firstAnimation: string | undefined; + /** + * Sets the animation playback direction to "forward" for the + * defined animation. + * + * @param {string} name - The animation name. + */ + setAnimationDirectionForward(name: string): void; + /** + * Sets the animation playback direction to "backward" for the + * defined animation. + * + * @param {string} name - The animation name. + */ + setAnimationDirectionBackward(name: string): void; + /** + * Sets the FPS to the given value for the defined animation. + * + * @param {string} name - The animation name. + * @param {number} fps - The FPS to set. + */ + setAnimationFPS(name: string, fps: number): void; + /** + * Sets the duration to the given value for the defined animation. + * + * @param {string} name - The animation name. + * @param {number} duration - The duration to set. + */ + setAnimationDuration(name: string, duration: number): void; + /** + * Sets the weight to the given value for the defined animation. + * + * @param {string} name - The animation name. + * @param {number} weight - The weight to set. + */ + setAnimationWeight(name: string, weight: number): void; + /** + * Sets the time to the given value for the defined animation. + * + * @param {string} name - The animation name. + * @param {number} time - The time to set. + */ + setAnimationTime(name: string, time: number): void; + /** + * Returns the time for the defined animation. + * + * @param {string} name - The animation name. + * @return {number} The time. + */ + getAnimationTime(name: string): number; + /** + * Returns the duration for the defined animation. + * + * @param {string} name - The animation name. + * @return {number} The duration. + */ + getAnimationDuration(name: string): number; + /** + * Plays the defined animation. + * + * @param {string} name - The animation name. + */ + playAnimation(name: string): void; + /** + * Stops the defined animation. + * + * @param {string} name - The animation name. + */ + stopAnimation(name: string): void; + /** + * Updates the animations of the mesh. + * + * @param {number} delta - The delta time in seconds. + */ + update(delta: number): void; +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts new file mode 100644 index 000000000..ce7c04e65 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts @@ -0,0 +1,87 @@ +/** + * Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/). + * + * To use, simply construct a `ProgressiveLightMap` object, + * `plmap.addObjectsToLightMap(object)` an array of semi-static + * objects and lights to the class once, and then call + * `plmap.update(camera)` every frame to begin accumulating + * lighting samples. + * + * This should begin accumulating lightmaps which apply to + * your objects, so you can start jittering lighting to achieve + * the texture-space effect you're looking for. + * + * This class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, import from `ProgressiveLightMapGPU.js`. + * + * @three_import import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js'; + */ +export class ProgressiveLightMap { + /** + * Constructs a new progressive light map. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {number} [res=1024] - The side-long dimension of the total lightmap. + */ + constructor(renderer: WebGLRenderer, res?: number); + /** + * The renderer. + * + * @type {WebGLRenderer} + */ + renderer: WebGLRenderer; + /** + * The side-long dimension of the total lightmap. + * + * @type {number} + * @default 1024 + */ + res: number; + lightMapContainers: any[]; + scene: Scene; + buffer1Active: boolean; + firstUpdate: boolean; + labelMesh: Mesh | null; + blurringPlane: Mesh | null; + progressiveLightMap1: WebGLRenderTarget; + progressiveLightMap2: WebGLRenderTarget; + uvMat: MeshPhongMaterial; + /** + * Sets these objects' materials' lightmaps and modifies their uv1's. + * + * @param {Array} objects - An array of objects and lights to set up your lightmap. + */ + addObjectsToLightMap(objects: Array): void; + uv_boxes: any[] | undefined; + /** + * This function renders each mesh one at a time into their respective surface maps. + * + * @param {Camera} camera - The camera the scene is rendered with. + * @param {number} [blendWindow=100] - When >1, samples will accumulate over time. + * @param {boolean} [blurEdges=true] - Whether to fix UV Edges via blurring. + */ + update(camera: Camera, blendWindow?: number, blurEdges?: boolean): void; + /** + * Draws the lightmap in the main scene. Call this after adding the objects to it. + * + * @param {boolean} visible - Whether the debug plane should be visible + * @param {Vector3} [position] - Where the debug plane should be drawn + */ + showDebugLightmap(visible: boolean, position?: Vector3): void; + /** + * Creates the Blurring Plane. + * + * @private + * @param {number} res - The square resolution of this object's lightMap. + * @param {WebGLRenderTarget} lightMap - The lightmap to initialize the plane with. + */ + private _initializeBlurPlane; + /** + * Frees all internal resources. + */ + dispose(): void; +} +import { Scene } from 'three'; +import { Mesh } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { MeshPhongMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts new file mode 100644 index 000000000..f6dcf6335 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts @@ -0,0 +1,83 @@ +/** + * Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/). + * + * To use, simply construct a `ProgressiveLightMap` object, + * `plmap.addObjectsToLightMap(object)` an array of semi-static + * objects and lights to the class once, and then call + * `plmap.update(camera)` every frame to begin accumulating + * lighting samples. + * + * This should begin accumulating lightmaps which apply to + * your objects, so you can start jittering lighting to achieve + * the texture-space effect you're looking for. + * + * This class can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, import from `ProgressiveLightMap.js`. + * + * @three_import import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMapGPU.js'; + */ +export class ProgressiveLightMap { + /** + * @param {WebGPURenderer} renderer - The renderer. + * @param {number} [resolution=1024] - The side-long dimension of the total lightmap. + */ + constructor(renderer: WebGPURenderer, resolution?: number); + /** + * The renderer. + * + * @type {WebGPURenderer} + */ + renderer: WebGPURenderer; + /** + * The side-long dimension of the total lightmap. + * + * @type {number} + * @default 1024 + */ + resolution: number; + _lightMapContainers: any[]; + _scene: Scene; + _buffer1Active: boolean; + _labelMesh: Mesh | null; + _blurringPlane: Mesh | null; + _progressiveLightMap1: RenderTarget; + _progressiveLightMap2: RenderTarget; + _averagingWindow: import("three/webgpu").UniformNode; + _previousShadowMap: import("three/webgpu").TextureNode; + _uvMat: MeshPhongNodeMaterial; + /** + * Sets these objects' materials' lightmaps and modifies their uv1's. + * + * @param {Array} objects - An array of objects and lights to set up your lightmap. + */ + addObjectsToLightMap(objects: Array): void; + /** + * Frees all internal resources. + */ + dispose(): void; + /** + * This function renders each mesh one at a time into their respective surface maps. + * + * @param {Camera} camera - The camera the scene is rendered with. + * @param {number} [blendWindow=100] - When >1, samples will accumulate over time. + * @param {boolean} [blurEdges=true] - Whether to fix UV Edges via blurring. + */ + update(camera: Camera, blendWindow?: number, blurEdges?: boolean): void; + /** + * Draws the lightmap in the main scene. Call this after adding the objects to it. + * + * @param {boolean} visible - Whether the debug plane should be visible + * @param {Vector3} [position] - Where the debug plane should be drawn + */ + showDebugLightmap(visible: boolean, position?: Vector3): void; + /** + * Creates the Blurring Plane. + * + * @private + */ + private _initializeBlurPlane; +} +import { Scene } from 'three/webgpu'; +import { Mesh } from 'three/webgpu'; +import { RenderTarget } from 'three/webgpu'; +import { MeshPhongNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts new file mode 100644 index 000000000..5e3866664 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts @@ -0,0 +1,69 @@ +/** + * A procedural roller coaster geometry. + * + * @augments BufferGeometry + * @three_import import { RollerCoasterGeometry } from 'three/addons/misc/RollerCoaster.js'; + */ +export class RollerCoasterGeometry extends BufferGeometry { + /** + * Constructs a new geometry. + * + * @param {Curve} curve - The curve to generate the geometry along. + * @param {number} divisions - The number of divisions which defines the detail of the geometry. + */ + constructor(curve: Curve, divisions: number); +} +/** + * A procedural roller coaster lifters geometry. + * + * @augments BufferGeometry + * @three_import import { RollerCoasterLiftersGeometry } from 'three/addons/misc/RollerCoaster.js'; + */ +export class RollerCoasterLiftersGeometry extends BufferGeometry { + /** + * Constructs a new geometry. + * + * @param {Curve} curve - The curve to generate the geometry along. + * @param {number} divisions - The number of divisions which defines the detail of the geometry. + */ + constructor(curve: Curve, divisions: number); +} +/** + * A procedural roller coaster shadow geometry. + * + * @augments BufferGeometry + * @three_import import { RollerCoasterShadowGeometry } from 'three/addons/misc/RollerCoaster.js'; + */ +export class RollerCoasterShadowGeometry extends BufferGeometry { + /** + * Constructs a new geometry. + * + * @param {Curve} curve - The curve to generate the geometry along. + * @param {number} divisions - The number of divisions which defines the detail of the geometry. + */ + constructor(curve: Curve, divisions: number); +} +/** + * A procedural sky geometry. + * + * @augments BufferGeometry + * @three_import import { SkyGeometry } from 'three/addons/misc/RollerCoaster.js'; + */ +export class SkyGeometry extends BufferGeometry { +} +/** + * A procedural trees geometry. + * + * @augments BufferGeometry + * @three_import import { TreesGeometry } from 'three/addons/misc/RollerCoaster.js'; + */ +export class TreesGeometry extends BufferGeometry { + /** + * Constructs a new geometry. + * + * @param {Mesh} landscape - A mesh representing the landscape. Trees will be positioned + * randomly on the landscape's surface. + */ + constructor(landscape: Mesh); +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts new file mode 100644 index 000000000..3a794d7df --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts @@ -0,0 +1,49 @@ +/** + * A plugin for `3d-tiles-renderer` that computes creased vertex normals for the + * geometry of each loaded tile: smooth normals everywhere except where faces meet + * at an angle greater than the crease angle. Useful for photogrammetry tile sets + * like Google Photorealistic 3D Tiles which come without vertex normals. + * + * The normals are computed in a Web Worker so tile processing doesn't block the + * main thread. Tiles are displayed once their normals are ready. + * + * ```js + * tiles.registerPlugin( new TileCreasedNormalsPlugin( { creaseAngle: Math.PI / 6 } ) ); + * ``` + * + * @three_import import { TileCreasedNormalsPlugin } from 'three/addons/misc/TileCreasedNormalsPlugin.js'; + */ +export class TileCreasedNormalsPlugin { + /** + * Constructs a new plugin. + * + * @param {Object} [options] - The configuration options. + * @param {number} [options.creaseAngle=Math.PI/3] - The crease angle in radians. + */ + constructor({ creaseAngle }?: { + creaseAngle?: number | undefined; + }); + /** + * The crease angle in radians. + * + * @type {number} + */ + creaseAngle: number; + _requestId: number; + _pending: Map; + _worker: Worker; + /** + * Called by the tiles renderer for each loaded tile model. The tile is + * displayed once the returned promise resolves. + * + * @param {Object3D} scene - The tile model. + * @return {Promise} A promise that resolves when all geometries have creased normals. + */ + processTileModel(scene: Object3D): Promise; + _processMesh(mesh: any): Promise; + /** + * Called by the tiles renderer when the plugin is unregistered or the + * tiles renderer is disposed. + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts new file mode 100644 index 000000000..398fe3186 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts @@ -0,0 +1,68 @@ +/** + * @classdesc This module can be used to paint tube-like meshes + * along a sequence of points. This module is used in a XR + * painter demo. + * + * ```js + * const painter = new TubePainter(); + * scene.add( painter.mesh ); + * ``` + * + * @name TubePainter + * @class + * @three_import import { TubePainter } from 'three/addons/misc/TubePainter.js'; + */ +export function TubePainter(): { + /** + * The "painted" tube mesh. Must be added to the scene. + * + * @name TubePainter#mesh + * @type {Mesh} + */ + mesh: Mesh; + /** + * Moves the current painting position to the given value. + * + * @method + * @name TubePainter#moveTo + * @param {Vector3} position The new painting position. + */ + moveTo: (position: any) => void; + /** + * Draw a stroke from the current position to the given one. + * This method extends the tube while drawing with the XR + * controllers. + * + * @method + * @name TubePainter#lineTo + * @param {Vector3} position The destination position. + */ + lineTo: (position: any) => void; + /** + * Sets the size of newly rendered tube segments. + * + * @method + * @name TubePainter#setSize + * @param {number} size The size. + */ + setSize: (value: any) => void; + /** + * Sets the color of newly rendered tube segments. + * + * @method + * @name TubePainter#setColor + * @param {Color} color The color. + */ + setColor: (value: any) => void; + /** + * Updates the internal geometry buffers so the new painted + * segments are rendered. + * + * @method + * @name TubePainter#update + */ + update: () => void; +}; +export class TubePainter { +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts new file mode 100644 index 000000000..87012184d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts @@ -0,0 +1,163 @@ +/** + * This class had been written to handle the output of the {@link NRRDLoader}. + * It contains a volume of data and information about it. For now it only handles 3 dimensional data. + * + * @three_import import { Volume } from 'three/addons/misc/Volume.js'; + */ +export class Volume { + /** + * Constructs a new volume. + * + * @param {number} [xLength] - Width of the volume. + * @param {number} [yLength] - Length of the volume. + * @param {number} [zLength] - Depth of the volume. + * @param {string} [type] - The type of data (uint8, uint16, ...). + * @param {ArrayBuffer} [arrayBuffer] - The buffer with volume data. + */ + constructor(xLength?: number, yLength?: number, zLength?: number, type?: string, arrayBuffer?: ArrayBuffer); + /** + * Width of the volume in the IJK coordinate system. + * + * @type {number} + * @default 1 + */ + xLength: number; + /** + * Height of the volume in the IJK coordinate system. + * + * @type {number} + * @default 1 + */ + yLength: number; + /** + * Depth of the volume in the IJK coordinate system. + * + * @type {number} + * @default 1 + */ + zLength: number; + /** + * The order of the Axis dictated by the NRRD header + * + * @type {Array} + */ + axisOrder: Array; + /** + * The data of the volume. + * + * @type {TypedArray} + */ + data: TypedArray; + /** + * Spacing to apply to the volume from IJK to RAS coordinate system + * + * @type {Array} + */ + spacing: Array; + /** + * Offset of the volume in the RAS coordinate system + * + * @type {Array} + */ + offset: Array; + /** + * The IJK to RAS matrix. + * + * @type {Martrix3} + */ + matrix: Martrix3; + /** + * The RAS to IJK matrix. + * + * @type {Martrix3} + */ + inverseMatrix: Martrix3; + /** + * The list of all the slices associated to this volume + * + * @type {Array} + */ + sliceList: Array; + /** + * Whether to use segmentation mode or not. + * It can load 16-bits nrrds correctly. + * + * @type {boolean} + * @default false + */ + segmentation: boolean; + /** + * This array holds the dimensions of the volume in the RAS space + * + * @type {Array} + */ + RASDimensions: Array; + /** + * Shortcut for data[access(i,j,k)]. + * + * @param {number} i - First coordinate. + * @param {number} j - Second coordinate. + * @param {number} k - Third coordinate. + * @returns {number} The value in the data array. + */ + getData(i: number, j: number, k: number): number; + /** + * Compute the index in the data array corresponding to the given coordinates in IJK system. + * + * @param {number} i - First coordinate. + * @param {number} j - Second coordinate. + * @param {number} k - Third coordinate. + * @returns {number} The index. + */ + access(i: number, j: number, k: number): number; + /** + * Retrieve the IJK coordinates of the voxel corresponding of the given index in the data. + * + * @param {number} index - Index of the voxel. + * @returns {Array} The IJK coordinates as `[x,y,z]`. + */ + reverseAccess(index: number): Array; + /** + * Apply a function to all the voxels, be careful, the value will be replaced. + * + * @param {Function} functionToMap A function to apply to every voxel, will be called with the following parameters: + * value of the voxel, index of the voxel, the data (TypedArray). + * @param {Object} context - You can specify a context in which call the function, default if this Volume. + * @returns {Volume} A reference to this instance. + */ + map(functionToMap: Function, context: Object): Volume; + /** + * Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, + * the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system. + * + * @param {('x'|'y'|'z')} axis - The normal axis to the slice. + * @param {number} RASIndex - The index of the slice. + * @returns {Object} An object containing all the useful information on the geometry of the slice. + */ + extractPerpendicularPlane(axis: ("x" | "y" | "z"), RASIndex: number): Object; + /** + * Returns a slice corresponding to the given axis and index. + * The coordinate are given in the Right Anterior Superior coordinate format. + * + * @param {('x'|'y'|'z')} axis - The normal axis to the slice. + * @param {number} index - The index of the slice. + * @returns {VolumeSlice} The extracted slice. + */ + extractSlice(axis: ("x" | "y" | "z"), index: number): VolumeSlice; + /** + * Call repaint on all the slices extracted from this volume. + * + * @see {@link VolumeSlice#repaint} + * @returns {Volume} A reference to this volume. + */ + repaintAllSlices(): Volume; + /** + * Compute the minimum and the maximum of the data in the volume. + * + * @returns {Array} The min/max data as `[min,max]`. + */ + computeMinMax(): Array; + min: number | undefined; + max: number | undefined; +} +import { VolumeSlice } from '../misc/VolumeSlice.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts new file mode 100644 index 000000000..a6b927a05 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts @@ -0,0 +1,99 @@ +/** + * This class has been made to hold a slice of a volume data. + * + * @see {@link Volume} + * @three_import import { VolumeSlice } from 'three/addons/misc/VolumeSlice.js'; + */ +export class VolumeSlice { + /** + * Constructs a new volume slice. + * + * @param {Volume} volume - The associated volume. + * @param {number} [index=0] - The index of the slice. + * @param {('x'|'y'|'z')} [axis='z'] - For now only 'x', 'y' or 'z' but later it will change to a normal vector. + */ + constructor(volume: Volume, index?: number, axis?: ("x" | "y" | "z")); + /** + * The associated volume. + * + * @type {Volume} + */ + volume: Volume; + /** + * The normal axis. + * + * @type {('x'|'y'|'z')} + */ + axis: ("x" | "y" | "z"); + /** + * The final canvas used for the texture. + * + * @type {HTMLCanvasElement} + */ + canvas: HTMLCanvasElement; + /** + * The rendering context of the canvas. + * + * @type {CanvasRenderingContext2D} + */ + ctx: CanvasRenderingContext2D; + /** + * The intermediary canvas used to paint the data. + * + * @type {HTMLCanvasElement} + */ + canvasBuffer: HTMLCanvasElement; + /** + * The rendering context of the canvas buffer, + * + * @type {CanvasRenderingContext2D} + */ + ctxBuffer: CanvasRenderingContext2D; + /** + * Width of slice in the original coordinate system, corresponds to the width of the buffer canvas. + * + * @type {number} + * @default 0 + */ + iLength: number; + /** + * Height of slice in the original coordinate system, corresponds to the height of the buffer canvas. + * + * @type {number} + * @default 0 + */ + jLength: number; + /** + * Function that allow the slice to access right data. + * + * @type {?Function} + * @see {@link Volume#extractPerpendicularPlane} + */ + sliceAccess: Function | null; + /** + * The mesh ready to get used in the scene. + * + * @type {Mesh} + */ + mesh: Mesh; + /** + * If set to `true`, `updateGeometry()` will be triggered at the next repaint. + * + * @type {boolean} + * @default true + */ + geometryNeedsUpdate: boolean; + /** + * Refresh the texture and the geometry if geometryNeedsUpdate is set to `true`. + */ + repaint(): void; + /** + * Refresh the geometry according to axis and index. + * @see {@link Volume#extractPerpendicularPlane} + */ + updateGeometry(): void; + matrix: any; + geometry: PlaneGeometry | undefined; +} +import { Mesh } from 'three'; +import { PlaneGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts new file mode 100644 index 000000000..9fd45f091 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts @@ -0,0 +1,79 @@ +/** + * A modifier for making meshes bend around curves. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * import the class from `CurveModifierGPU.js`. + * + * @three_import import { Flow } from 'three/addons/modifiers/CurveModifier.js'; + */ +export class Flow { + /** + * Constructs a new Flow instance. + * + * @param {Mesh} mesh - The mesh to clone and modify to bend around the curve. + * @param {number} numberOfCurves - The amount of space that should preallocated for additional curves. + */ + constructor(mesh: Mesh, numberOfCurves?: number); + curveArray: any[]; + curveLengthArray: any[]; + object3D: import("three").Object3D; + splineTexture: DataTexture; + uniforms: Object; + /** + * Updates the curve for the given curve index. + * + * @param {number} index - The curve index. + * @param {Curve} curve - The curve that should be used to bend the mesh. + */ + updateCurve(index: number, curve: Curve): void; + /** + * Moves the mesh along the curve. + * + * @param {number} amount - The offset. + */ + moveAlongCurve(amount: number): void; +} +/** + * An instanced version of {@link Flow} for making meshes bend around curves, where the instances are placed on the curve. + * + * This module can only be used with {@link WebGLRenderer}. + * + * @augments Flow + * @three_import import { InstancedFlow } from 'three/addons/modifiers/CurveModifier.js'; + */ +export class InstancedFlow extends Flow { + /** + * Constructs a new InstancedFlow instance. + * + * @param {number} count - The number of instanced elements. + * @param {number} curveCount - The number of curves to preallocate for. + * @param {Geometry} geometry - The geometry to use for the instanced mesh. + * @param {Material} material - The material to use for the instanced mesh. + */ + constructor(count: number, curveCount: number, geometry: Geometry, material: Material); + offsets: any[]; + whichCurve: any[]; + /** + * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects + * This writes that information to the matrix and marks it as needing update. + * + * @param {number} index - The index of tge instanced element to update. + */ + writeChanges(index: number): void; + /** + * Move an individual element along the curve by a specific amount. + * + * @param {number} index - Which element to update. + * @param {number} offset - The offset. + */ + moveIndividualAlongCurve(index: number, offset: number): void; + /** + * Select which curve to use for an element. + * + * @param {number} index - The index of the instanced element to update. + * @param {number} curveNo - The index of the curve it should use. + */ + setCurve(index: number, curveNo: number): void; +} +import { DataTexture } from 'three'; +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts new file mode 100644 index 000000000..c88b4f893 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts @@ -0,0 +1,37 @@ +/** + * A modifier for making meshes bend around curves. + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * import the class from `CurveModifier.js`. + * + * @three_import import { Flow } from 'three/addons/modifiers/CurveModifierGPU.js'; + */ +export class Flow { + /** + * Constructs a new Flow instance. + * + * @param {Mesh} mesh - The mesh to clone and modify to bend around the curve. + * @param {number} numberOfCurves - The amount of space that should preallocated for additional curves. + */ + constructor(mesh: Mesh, numberOfCurves?: number); + curveArray: any[]; + curveLengthArray: any[]; + object3D: import("three").Object3D; + splineTexture: DataTexture; + uniforms: Object; + /** + * Updates the curve for the given curve index. + * + * @param {number} index - The curve index. + * @param {Curve} curve - The curve that should be used to bend the mesh. + */ + updateCurve(index: number, curve: Curve): void; + /** + * Moves the mesh along the curve. + * + * @param {number} amount - The offset. + */ + moveAlongCurve(amount: number): void; +} +import { DataTexture } from 'three'; +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts new file mode 100644 index 000000000..65a5f1d5a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts @@ -0,0 +1,24 @@ +/** + * The modifier can be used to split faces at sharp edges. This allows to compute + * normals without smoothing the edges which can lead to an improved visual result. + * + * ```js + * const modifier = new EdgeSplitModifier(); + * geometry = modifier.modify( geometry, Math.PI * 0.4 ); + * ``` + * + * @three_import import { EdgeSplitModifier } from 'three/addons/modifiers/EdgeSplitModifier.js'; + */ +export class EdgeSplitModifier { + /** + * Returns a new, modified version of the given geometry by applying an edge-split operation. + * Please note that the resulting geometry is always indexed. + * + * @param {BufferGeometry} geometry - The geometry to modify. + * @param {number} cutOffAngle - The cut off angle in radians. + * @param {boolean} [tryKeepNormals=true] - Whether to try to keep normals or not. + * @return {BufferGeometry} A new, modified geometry. + */ + modify(geometry: BufferGeometry, cutOffAngle: number, tryKeepNormals?: boolean): BufferGeometry; +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts new file mode 100644 index 000000000..e15a42f5e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts @@ -0,0 +1,27 @@ +/** + * This class can be used to modify a geometry by simplifying it. A typical use + * case for such a modifier is automatic LOD generation. + * + * The implementation is based on [meshoptimizer]{@link https://github.com/zeux/meshoptimizer}. + * If you only need a simplified index buffer, use {@link MeshoptSimplifier} directly. + * + * ```js + * const modifier = new SimplifyModifier(); + * geometry = await modifier.modify( geometry, count ); + * ``` + * + * @three_import import { SimplifyModifier } from 'three/addons/modifiers/SimplifyModifier.js'; + */ +export class SimplifyModifier { + /** + * Returns a new, simplified version of the given geometry. The vertex buffers + * of the result only contain vertices referenced by the simplified index. + * + * @async + * @param {BufferGeometry} geometry - The geometry to modify. + * @param {number} count - The approximate number of vertices to remove. + * @return {Promise} A promise that resolves with the new, modified geometry. + */ + modify(geometry: BufferGeometry, count: number): Promise; +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts new file mode 100644 index 000000000..58e45c699 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts @@ -0,0 +1,43 @@ +/** + * This class can be used to modify a geometry by breaking its edges if they + * are longer than maximum length. + * + * ```js + * const modifier = new TessellateModifier( 8, 6 ); + * geometry = modifier.modify( geometry ); + * ``` + * + * @three_import import { TessellateModifier } from 'three/addons/modifiers/TessellateModifier.js'; + */ +export class TessellateModifier { + /** + * Constructs a new Tessellate modifier. + * + * @param {number} [maxEdgeLength=0.1] - The maximum edge length. + * @param {number} [maxIterations=6] - The number of iterations. + */ + constructor(maxEdgeLength?: number, maxIterations?: number); + /** + * The maximum edge length. + * + * @type {number} + * @default 0.1 + */ + maxEdgeLength: number; + /** + * The maximum edge length. + * + * @type {number} + * @default 0.1 + */ + maxIterations: number; + /** + * Returns a new, modified version of the given geometry by applying a tessellation. + * Please note that the resulting geometry is always non-indexed. + * + * @param {BufferGeometry} geometry - The geometry to modify. + * @return {BufferGeometry} A new, modified geometry. + */ + modify(geometry: BufferGeometry): BufferGeometry; +} +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts new file mode 100644 index 000000000..17efc123e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts @@ -0,0 +1,126 @@ +/** + * A minimal renderer for 3D Gaussian splat geometry. + * + * Note that this class can only be used with {@link WebGPURenderer}. The + * `forceWebGL` fallback of {@link WebGPURenderer} is supported, but + * {@link WebGLRenderer} is not. Import maps or package exports must resolve + * both `three/webgpu` and `three/tsl`. + * + * ```js + * const splats = new GaussianSplat( geometry ); + * scene.add( splats ); + * ``` + * + * @augments Mesh + * @three_import import { GaussianSplat } from 'three/addons/objects/GaussianSplat.js'; + */ +export class GaussianSplat extends Mesh { + /** + * Constructs a new Gaussian splat mesh. + * + * @param {BufferGeometry} splatGeometry - The splat geometry to render. Higher-order spherical harmonics attributes must use packed `Uint32Array` words from {@link createGaussianSplatGeometry} (`SH_BAND_WORDS[ degree ]` words per splat, four clamped-byte coefficients per word). + * @param {Object} [options] - Options. + * @param {boolean} [options.autoSort=true] - Whether to sort automatically in `onBeforeRender`. + */ + constructor(splatGeometry: BufferGeometry, { autoSort }?: { + autoSort?: boolean | undefined; + }); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isGaussianSplat: boolean; + /** + * The source splat geometry. + * + * @type {BufferGeometry} + */ + splatGeometry: BufferGeometry; + /** + * The bounding box of the splats. Can be computed via {@link GaussianSplat#computeBoundingBox}. + * + * @type {?Box3} + * @default null + */ + boundingBox: Box3 | null; + /** + * The bounding sphere of the splats. Can be computed via {@link GaussianSplat#computeBoundingSphere}. + * + * @type {?Sphere} + * @default null + */ + boundingSphere: Sphere | null; + /** + * Whether to sort automatically in `onBeforeRender`. + * + * @type {boolean} + */ + autoSort: boolean; + _buffers: { + count: any; + sphericalHarmonicsDegree: any; + webGLBuffersEnabled: boolean; + centerRead: import("three/webgpu").StorageBufferNode; + covarianceARead: import("three/webgpu").StorageBufferNode; + covarianceBRead: import("three/webgpu").StorageBufferNode; + colorRead: import("three/webgpu").StorageBufferNode; + }; + _sort: CountingSort; + _sortMatrix: import("three/webgpu").UniformNode; + _sortDepthRange: import("three/webgpu").UniformNode; + _sortInitialized: boolean; + _lastSortDirection: Vector3; + _localCameraPosition: import("three/webgpu").UniformNode; + _sphericalHarmonicsComputeNode: any; + _sphericalHarmonicsInitialized: boolean; + _lastSphericalHarmonicsCameraMatrix: Matrix4; + _lastSphericalHarmonicsWorldMatrix: Matrix4; + _sphericalHarmonicsVertexNode: void | null; + _precomputedSphericalHarmonicsVertexNode: void; + _positionAttribute: any; + onBeforeRender: (renderer: any, scene: any, camera: any) => void; + /** + * Updates the view-dependent spherical harmonics colors if the camera or + * mesh transform has changed. + * + * @param {Renderer} renderer - The renderer. + * @param {Camera} camera - The camera used for rendering. + * @return {boolean} Whether a compute pass was dispatched this call. + */ + updateSphericalHarmonics(renderer: Renderer, camera: Camera): boolean; + /** + * Computes the bounding box of the splats, updating {@link GaussianSplat#boundingBox}. + * + * Each splat is expanded by its own extent rather than treated as a point, so the bounds cover + * what is drawn. + */ + computeBoundingBox(): void; + /** + * Computes the bounding sphere of the splats, updating {@link GaussianSplat#boundingSphere}. + * + * Each splat is expanded by its own extent rather than treated as a point, so the bounds cover + * what is drawn. + */ + computeBoundingSphere(): void; + /** + * Updates the draw order if the camera or mesh orientation has changed enough + * to need a new sort. + * + * @param {Renderer} renderer - The renderer. + * @param {Camera} camera - The camera used for rendering. + * @return {boolean} Whether a sort was dispatched this call. + */ + updateSort(renderer: Renderer, camera: Camera): boolean; + _needsSort(camera: any): boolean; + _updateSortUniforms(camera: any): void; + _sortCPU(): void; +} +import { Mesh } from 'three/webgpu'; +import { Box3 } from 'three/webgpu'; +import { Sphere } from 'three/webgpu'; +import { CountingSort } from '../gpgpu/CountingSort.js'; +import { Vector3 } from 'three/webgpu'; +import { Matrix4 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts new file mode 100644 index 000000000..51d43e1ef --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts @@ -0,0 +1,30 @@ +/** + * A ground-projected skybox. + * + * By default the object is centered at the camera, so it is often helpful to set + * `skybox.position.y = height` to put the ground at the origin. + * + * ```js + * const height = 15, radius = 100; + * + * const skybox = new GroundedSkybox( envMap, height, radius ); + * skybox.position.y = height; + * scene.add( skybox ); + * ``` + * + * @augments Mesh + * @three_import import { GroundedSkybox } from 'three/addons/objects/GroundedSkybox.js'; + */ +export class GroundedSkybox extends Mesh { + /** + * Constructs a new ground-projected skybox. + * + * @param {Texture} map - The environment map to use. + * @param {number} height - The height is how far the camera that took the photo was above the ground. + * A larger value will magnify the downward part of the image. + * @param {number} radius - The radius of the skybox. Must be large enough to ensure the scene's camera stays inside. + * @param {number} [resolution=128] - The geometry resolution of the skybox. + */ + constructor(map: Texture, height: number, radius: number, resolution?: number); +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts new file mode 100644 index 000000000..589ce3fc6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts @@ -0,0 +1,120 @@ +/** + * Creates a simulated lens flare that tracks a light. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link LensflareMesh}. + * + * ```js + * const light = new THREE.PointLight( 0xffffff, 1.5, 2000 ); + * + * const lensflare = new Lensflare(); + * lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) ); + * lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) ); + * lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) ); + * + * light.add( lensflare ); + * ``` + * + * @augments Mesh + * @three_import import { Lensflare } from 'three/addons/objects/Lensflare.js'; + */ +export class Lensflare extends Mesh { + /** + * Constructs a new lensflare. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLensflare: boolean; + /** + * Adds the given lensflare element to this instance. + * + * @param {LensflareElement} element - The element to add. + */ + addElement: (element: LensflareElement) => void; + onBeforeRender: (renderer: any, scene: any, camera: any) => void; +} +export namespace Lensflare { + let Geometry: BufferGeometry; +} +/** + * Represents a single flare that can be added to a {@link Lensflare} container. + * + * @three_import import { LensflareElement } from 'three/addons/objects/Lensflare.js'; + */ +export class LensflareElement { + /** + * Constructs a new lensflare element. + * + * @param {Texture} texture - The flare's texture. + * @param {number} [size=1] - The size in pixels. + * @param {number} [distance=0] - The normalized distance (`[0,1]`) from the light source. + * A value of `0` means the flare is located at light source. + * @param {Color} [color] - The flare's color + */ + constructor(texture: Texture, size?: number, distance?: number, color?: Color); + /** + * The flare's texture. + * + * @type {Texture} + */ + texture: Texture; + /** + * The size in pixels. + * + * @type {number} + * @default 1 + */ + size: number; + /** + * The normalized distance (`[0,1]`) from the light source. + * A value of `0` means the flare is located at light source. + * + * @type {number} + * @default 0 + */ + distance: number; + /** + * The flare's color + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; +} +export namespace LensflareElement { + namespace Shader { + let name: string; + namespace uniforms { + namespace map { + let value: null; + } + namespace occlusionMap { + let value_1: null; + export { value_1 as value }; + } + namespace color { + let value_2: null; + export { value_2 as value }; + } + namespace scale { + let value_3: null; + export { value_3 as value }; + } + namespace screenPosition { + let value_4: null; + export { value_4 as value }; + } + } + let vertexShader: string; + let fragmentShader: string; + } +} +import { Mesh } from 'three'; +import { BufferGeometry } from 'three'; +import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts new file mode 100644 index 000000000..e42352db3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts @@ -0,0 +1,54 @@ +/** + * Creates a simulated lens flare that tracks a light. + * + * Note that this class can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, use {@link Lensflare}. + * + * ```js + * const light = new THREE.PointLight( 0xffffff, 1.5, 2000 ); + * + * const lensflare = new LensflareMesh(); + * lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) ); + * lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) ); + * lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) ); + * + * light.add( lensflare ); + * ``` + * + * @augments Mesh + * @three_import import { LensflareMesh } from 'three/addons/objects/LensflareMesh.js'; + */ +export class LensflareMesh extends Mesh { + /** + * Constructs a new lensflare mesh. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLensflareMesh: boolean; + /** + * Adds the given lensflare element to this instance. + * + * @param {LensflareElement} element - The element to add. + */ + addElement: (element: LensflareElement) => void; + onBeforeRender: (renderer: any, scene: any, camera: any) => void; +} +export namespace LensflareMesh { + let Geometry: BufferGeometry; +} +export class LensflareElement { + constructor(texture: any, size?: number, distance?: number, color?: Color); + texture: any; + size: number; + distance: number; + color: Color; +} +import { Mesh } from 'three/webgpu'; +import { BufferGeometry } from 'three/webgpu'; +import { Color } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts new file mode 100644 index 000000000..8c6880e9f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts @@ -0,0 +1,134 @@ +/** + * ~Options + */ +export type ReflectorForSSRPass = { + /** + * - The reflector's color. + */ + color?: string | number | Color | undefined; + /** + * - The texture width. A higher value results in more clear reflections but is also more expensive. + */ + textureWidth?: number | undefined; + /** + * - The texture height. A higher value results in more clear reflections but is also more expensive. + */ + textureHeight?: number | undefined; + /** + * - The clip bias. + */ + clipBias?: number | undefined; + /** + * - Can be used to pass in a custom shader that defines how the reflective view is projected onto the reflector's geometry. + */ + shader?: Object | undefined; + /** + * - Whether to store depth values in a texture or not. + */ + useDepthTexture?: boolean | undefined; + /** + * - Resolution for the Reflector Pass. + */ + resolution?: Vector2 | undefined; +}; +import { Color } from 'three'; +import { Vector2 } from 'three'; +/** + * A special version of {@link Reflector} for usage with {@link SSRPass}. + * + * @augments Mesh + * @three_import import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js'; + */ +export class ReflectorForSSRPass extends Mesh { + /** + * Constructs a new reflector. + * + * @param {BufferGeometry} geometry - The reflector's geometry. + * @param {ReflectorForSSRPass~Options} [options] - The configuration options. + */ + constructor(geometry: BufferGeometry, options?: {}); + isReflectorForSSRPass: boolean; + needsUpdate: boolean; + maxDistance: number; + opacity: number; + color: Color; + resolution: any; + _distanceAttenuation: boolean; + _fresnel: boolean; + material: ShaderMaterial; + doRender: (renderer: any, scene: any, camera: any) => void; + /** + * Returns the reflector's internal render target. + * + * @return {WebGLRenderTarget} The internal render target + */ + getRenderTarget: () => WebGLRenderTarget; +} +export namespace ReflectorForSSRPass { + namespace ReflectorShader { + let name: string; + namespace defines { + let DISTANCE_ATTENUATION: boolean; + let FRESNEL: boolean; + } + namespace uniforms { + namespace color { + let value: null; + } + namespace tDiffuse { + let value_1: null; + export { value_1 as value }; + } + namespace tDepth { + let value_2: null; + export { value_2 as value }; + } + namespace textureMatrix { + let value_3: Matrix4; + export { value_3 as value }; + } + namespace maxDistance { + let value_4: number; + export { value_4 as value }; + } + namespace opacity { + let value_5: number; + export { value_5 as value }; + } + namespace fresnelCoe { + let value_6: null; + export { value_6 as value }; + } + namespace virtualCameraNear { + let value_7: null; + export { value_7 as value }; + } + namespace virtualCameraFar { + let value_8: null; + export { value_8 as value }; + } + namespace virtualCameraProjectionMatrix { + let value_9: Matrix4; + export { value_9 as value }; + } + namespace virtualCameraMatrixWorld { + let value_10: Matrix4; + export { value_10 as value }; + } + namespace virtualCameraProjectionMatrixInverse { + let value_11: Matrix4; + export { value_11 as value }; + } + namespace resolution { + let value_12: Vector2; + export { value_12 as value }; + } + } + let vertexShader: string; + let fragmentShader: string; + } +} +import { Mesh } from 'three'; +import { ShaderMaterial } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts new file mode 100644 index 000000000..c55ab301e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts @@ -0,0 +1,107 @@ +/** + * ~Options + */ +export type Refractor = { + /** + * - The refractor's color. + */ + color?: string | number | Color | undefined; + /** + * - The texture width. A higher value results in more clear refractions but is also more expensive. + */ + textureWidth?: number | undefined; + /** + * - The texture height. A higher value results in more clear refractions but is also more expensive. + */ + textureHeight?: number | undefined; + /** + * - The clip bias. + */ + clipBias?: number | undefined; + /** + * - Can be used to pass in a custom shader that defines how the refractive view is projected onto the reflector's geometry. + */ + shader?: Object | undefined; + /** + * - How many samples to use for MSAA. `0` disables MSAA. + */ + multisample?: number | undefined; +}; +import { Color } from 'three'; +/** + * Can be used to create a flat, refractive surface like for special + * windows or water effects. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link viewportSharedTexture}. + * + * ```js + * const geometry = new THREE.PlaneGeometry( 100, 100 ); + * + * const refractor = new Refractor( refractorGeometry, { + * color: 0xcbcbcb, + * textureWidth: 1024, + * textureHeight: 1024 + * } ); + * + * scene.add( refractor ); + * ``` + * + * @augments Mesh + * @three_import import { Refractor } from 'three/addons/objects/Refractor.js'; + */ +export class Refractor extends Mesh { + /** + * Constructs a new refractor. + * + * @param {BufferGeometry} geometry - The refractor's geometry. + * @param {Refractor~Options} [options] - The configuration options. + */ + constructor(geometry: BufferGeometry, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRefractor: boolean; + /** + * The reflector's virtual camera. + * + * @type {PerspectiveCamera} + */ + camera: PerspectiveCamera; + material: ShaderMaterial; + onBeforeRender: (renderer: any, scene: any, camera: any) => void; + /** + * Returns the reflector's internal render target. + * + * @return {WebGLRenderTarget} The internal render target + */ + getRenderTarget: () => WebGLRenderTarget; +} +export namespace Refractor { + namespace RefractorShader { + let name: string; + namespace uniforms { + namespace color { + let value: null; + } + namespace tDiffuse { + let value_1: null; + export { value_1 as value }; + } + namespace textureMatrix { + let value_2: null; + export { value_2 as value }; + } + } + let vertexShader: string; + let fragmentShader: string; + } +} +import { Mesh } from 'three'; +import { PerspectiveCamera } from 'three'; +import { ShaderMaterial } from 'three'; +import { WebGLRenderTarget } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts new file mode 100644 index 000000000..41e8e275f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts @@ -0,0 +1,48 @@ +/** + * A Shadow Mesh that follows a shadow-casting mesh in the scene, + * but is confined to a single plane. This technique can be used as + * a very performant alternative to classic shadow mapping. However, + * it has serious limitations like: + * + * - Shadows can only be casted on flat planes. + * - No soft shadows support. + * + * ```js + * const cubeShadow = new ShadowMesh( cube ); + * scene.add( cubeShadow ); + * ``` + * + * @augments Mesh + * @three_import import { ShadowMesh } from 'three/addons/objects/ShadowMesh.js'; + */ +export class ShadowMesh extends Mesh { + /** + * Constructs a new shadow mesh. + * + * @param {Mesh} mesh - The shadow-casting reference mesh. + */ + constructor(mesh: Mesh); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowMesh: boolean; + /** + * Represent the world matrix of the reference mesh. + * + * @type {Matrix4} + */ + meshMatrix: Matrix4; + /** + * Updates the shadow mesh so it follows its shadow-casting reference mesh. + * + * @param {Plane} plane - The plane onto the shadow mesh is projected. + * @param {Vector4} lightPosition4D - The light position. + */ + update(plane: Plane, lightPosition4D: Vector4): void; +} +import { Mesh } from 'three'; +import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts new file mode 100644 index 000000000..dbd0641e6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts @@ -0,0 +1,108 @@ +/** + * Represents a skydome for scene backgrounds. Based on [A Practical Analytic Model for Daylight](https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight) + * aka The Preetham Model, the de facto standard for analytical skydomes. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link SkyMesh}. + * + * More references: + * + * - {@link http://simonwallner.at/project/atmospheric-scattering/} + * - {@link http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR} + * + * + * ```js + * const sky = new Sky(); + * sky.scale.setScalar( 10000 ); + * scene.add( sky ); + * ``` + * + * It can be useful to hide the sun disc when generating an environment map to avoid artifacts + * + * ```js + * // disable before rendering environment map + * sky.material.uniforms.showSunDisc.value = false; + * // ... + * // re-enable before scene sky box rendering + * sky.material.uniforms.showSunDisc.value = true; + * ``` + * + * @augments Mesh + * @three_import import { Sky } from 'three/addons/objects/Sky.js'; + */ +export class Sky extends Mesh { + /** + * Constructs a new skydome. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSky: boolean; +} +export namespace Sky { + namespace SkyShader { + let name: string; + namespace uniforms { + namespace turbidity { + let value: number; + } + namespace rayleigh { + let value_1: number; + export { value_1 as value }; + } + namespace mieCoefficient { + let value_2: number; + export { value_2 as value }; + } + namespace mieDirectionalG { + let value_3: number; + export { value_3 as value }; + } + namespace sunPosition { + let value_4: Vector3; + export { value_4 as value }; + } + namespace up { + let value_5: Vector3; + export { value_5 as value }; + } + namespace cloudScale { + let value_6: number; + export { value_6 as value }; + } + namespace cloudSpeed { + let value_7: number; + export { value_7 as value }; + } + namespace cloudCoverage { + let value_8: number; + export { value_8 as value }; + } + namespace cloudDensity { + let value_9: number; + export { value_9 as value }; + } + namespace cloudElevation { + let value_10: number; + export { value_10 as value }; + } + namespace showSunDisc { + let value_11: number; + export { value_11 as value }; + } + namespace time { + let value_12: number; + export { value_12 as value }; + } + } + let vertexShader: string; + let fragmentShader: string; + } +} +import { Mesh } from 'three'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts new file mode 100644 index 000000000..825c2c2f7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts @@ -0,0 +1,127 @@ +/** + * Represents a skydome for scene backgrounds. Based on [A Practical Analytic Model for Daylight](https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight) + * aka The Preetham Model, the de facto standard for analytical skydomes. + * + * Note that this class can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, use {@link Sky}. + * + * More references: + * + * - {@link http://simonwallner.at/project/atmospheric-scattering/} + * - {@link http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR} + * + * ```js + * const sky = new SkyMesh(); + * sky.scale.setScalar( 10000 ); + * scene.add( sky ); + * ``` + * + * It can be useful to hide the sun disc when generating an environment map to avoid artifacts + * + * ```js + * // disable before rendering environment map + * sky.showSunDisc.value = false; + * // ... + * // re-enable before scene sky box rendering + * sky.showSunDisc.value = true; + * ``` + * + * @augments Mesh + * @three_import import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; + */ +export class SkyMesh extends Mesh { + /** + * Constructs a new skydome. + */ + constructor(); + /** + * The turbidity uniform. + * + * @type {UniformNode} + */ + turbidity: UniformNode; + /** + * The rayleigh uniform. + * + * @type {UniformNode} + */ + rayleigh: UniformNode; + /** + * The mieCoefficient uniform. + * + * @type {UniformNode} + */ + mieCoefficient: UniformNode; + /** + * The mieDirectionalG uniform. + * + * @type {UniformNode} + */ + mieDirectionalG: UniformNode; + /** + * The sun position uniform. + * + * @type {UniformNode} + */ + sunPosition: UniformNode; + /** + * The up position. + * + * @type {UniformNode} + */ + upUniform: UniformNode; + /** + * The cloud scale uniform. + * + * @type {UniformNode} + */ + cloudScale: UniformNode; + /** + * The cloud speed uniform. + * + * @type {UniformNode} + */ + cloudSpeed: UniformNode; + /** + * The cloud coverage uniform. + * + * @type {UniformNode} + */ + cloudCoverage: UniformNode; + /** + * The cloud density uniform. + * + * @type {UniformNode} + */ + cloudDensity: UniformNode; + /** + * The cloud elevation uniform. + * + * @type {UniformNode} + */ + cloudElevation: UniformNode; + /** + * Whether to render the solar disc. + * + * @type {UniformNode} + */ + showSunDisc: UniformNode; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + * @deprecated Use isSkyMesh instead. + */ + readonly isSky: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSkyMesh: boolean; +} +import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts new file mode 100644 index 000000000..4cbedafa7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts @@ -0,0 +1,92 @@ +/** + * ~Options + */ +export type Water = { + /** + * - The texture width. A higher value results in more clear reflections but is also more expensive. + */ + textureWidth?: number | undefined; + /** + * - The texture height. A higher value results in more clear reflections but is also more expensive. + */ + textureHeight?: number | undefined; + /** + * - The clip bias. + */ + clipBias?: number | undefined; + /** + * - The alpha value. + */ + alpha?: number | undefined; + /** + * - The time value. + */ + time?: number | undefined; + /** + * - The water's normal map. + */ + waterNormals?: Texture | null; + /** + * - The sun direction. + */ + sunDirection?: Vector3 | undefined; + /** + * - The sun color. + */ + sunColor?: string | number | Color | undefined; + /** + * - The water color. + */ + waterColor?: string | number | Color | undefined; + /** + * - The eye vector. + */ + eye?: Vector3 | undefined; + /** + * - The distortion scale. + */ + distortionScale?: number | undefined; + /** + * - The water material's `side` property. + */ + side?: (number | BackSide | DoubleSide); + /** + * - Whether the water should be affected by fog or not. + */ + fog?: boolean | undefined; +}; +import { Vector3 } from 'three'; +import { Color } from 'three'; +/** + * A basic flat, reflective water effect. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link WaterMesh}. + * + * References: + * + * - [Flat mirror for three.js](https://github.com/Slayvin) + * - [An implementation of water shader based on the flat mirror](https://home.adelphi.edu/~stemkoski/) + * - [Water shader explanations in WebGL](http://29a.ch/slides/2012/webglwater/ ) + * + * @augments Mesh + * @three_import import { Water } from 'three/addons/objects/Water.js'; + */ +export class Water extends Mesh { + /** + * Constructs a new water instance. + * + * @param {BufferGeometry} geometry - The water's geometry. + * @param {Water~Options} [options] - The configuration options. + */ + constructor(geometry: BufferGeometry, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWater: boolean; +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts new file mode 100644 index 000000000..515f144a6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts @@ -0,0 +1,145 @@ +/** + * :Water2~Options + */ +export type module = { + /** + * - The water color. + */ + color?: string | number | Color | undefined; + /** + * - The texture width. A higher value results in better quality but is also more expensive. + */ + textureWidth?: number | undefined; + /** + * - The texture height. A higher value results in better quality but is also more expensive. + */ + textureHeight?: number | undefined; + /** + * - The clip bias. + */ + clipBias?: number | undefined; + /** + * - The water's flow direction. + */ + flowDirection?: Vector2 | undefined; + /** + * - The water's flow speed. + */ + flowSpeed?: number | undefined; + /** + * - The water's reflectivity. + */ + reflectivity?: number | undefined; + /** + * - The water's scale. + */ + scale?: number | undefined; + /** + * - A custom water shader. + */ + shader?: Object | undefined; + /** + * - The flow map. If no flow map is assigned, the water flow is defined by `flowDirection`. + */ + flowMap?: Texture | null; + /** + * - The first water normal map. + */ + normalMap0?: Texture | null; + /** + * - The second water normal map. + */ + normalMap1?: Texture | null; +}; +/** @module Water2 */ +/** + * An advanced water effect that supports reflections, refractions and flow maps. + * + * Note that this class can only be used with {@link WebGLRenderer}. + * When using {@link WebGPURenderer}, use {@link module:Water2Mesh}. + * + * References: + * + * - {@link https://alex.vlachos.com/graphics/Vlachos-SIGGRAPH10-WaterFlow.pdf} + * - {@link http://graphicsrunner.blogspot.de/2010/08/water-using-flow-maps.html} + * + * @augments Mesh + * @three_import import { Water } from 'three/addons/objects/Water2.js'; + */ +export class Water extends Mesh { + /** + * Constructs a new water instance. + * + * @param {BufferGeometry} geometry - The water's geometry. + * @param {module:Water2~Options} [options] - The configuration options. + */ + constructor(geometry: BufferGeometry, options?: any); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWater: boolean; + onBeforeRender: (renderer: any, scene: any, camera: any) => void; +} +export namespace Water { + namespace WaterShader { + let name: string; + namespace uniforms { + namespace color { + let type: string; + let value: null; + } + namespace reflectivity { + let type_1: string; + export { type_1 as type }; + let value_1: number; + export { value_1 as value }; + } + namespace tReflectionMap { + let type_2: string; + export { type_2 as type }; + let value_2: null; + export { value_2 as value }; + } + namespace tRefractionMap { + let type_3: string; + export { type_3 as type }; + let value_3: null; + export { value_3 as value }; + } + namespace tNormalMap0 { + let type_4: string; + export { type_4 as type }; + let value_4: null; + export { value_4 as value }; + } + namespace tNormalMap1 { + let type_5: string; + export { type_5 as type }; + let value_5: null; + export { value_5 as value }; + } + namespace textureMatrix { + let type_6: string; + export { type_6 as type }; + let value_6: null; + export { value_6 as value }; + } + namespace config { + let type_7: string; + export { type_7 as type }; + let value_7: Vector4; + export { value_7 as value }; + } + } + let vertexShader: string; + let fragmentShader: string; + } +} +import { Color } from 'three'; +import { Vector2 } from 'three'; +import { Mesh } from 'three'; +import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts new file mode 100644 index 000000000..92371b2fd --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts @@ -0,0 +1,72 @@ +/** + * :Water2Mesh~Options + */ +export type module = { + /** + * - The water color. + */ + color?: string | number | Color | undefined; + /** + * - The water's flow direction. + */ + flowDirection?: Vector2 | undefined; + /** + * - The water's flow speed. + */ + flowSpeed?: number | undefined; + /** + * - The water's reflectivity. + */ + reflectivity?: number | undefined; + /** + * - The water's scale. + */ + scale?: number | undefined; + /** + * - The flow map. If no flow map is assigned, the water flow is defined by `flowDirection`. + */ + flowMap?: Texture | null; + /** + * - The first water normal map. + */ + normalMap0: Texture; + /** + * - The second water normal map. + */ + normalMap1: Texture; +}; +/** @module Water2Mesh */ +/** + * An advanced water effect that supports reflections, refractions and flow maps. + * + * Note that this class can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, use {@link module:Water2}. + * + * References: + * + * - {@link https://alex.vlachos.com/graphics/Vlachos-SIGGRAPH10-WaterFlow.pdf} + * - {@link http://graphicsrunner.blogspot.de/2010/08/water-using-flow-maps.html} + * + * @augments Mesh + * @three_import import { WaterMesh } from 'three/addons/objects/Water2Mesh.js'; + */ +export class WaterMesh extends Mesh { + /** + * Constructs a new water mesh. + * + * @param {BufferGeometry} geometry - The water's geometry. + * @param {module:Water2~Options} [options] - The configuration options. + */ + constructor(geometry: BufferGeometry, options?: any); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWater: boolean; +} +import { Color } from 'three/webgpu'; +import { Vector2 } from 'three/webgpu'; +import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts new file mode 100644 index 000000000..4fb266691 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts @@ -0,0 +1,127 @@ +/** + * ~Options + */ +export type WaterMesh = { + /** + * - The resolution scale. + */ + resolutionScale?: number | undefined; + /** + * - The water's normal map. + */ + waterNormals?: Texture | null; + /** + * - The alpha value. + */ + alpha?: number | undefined; + /** + * - The size value. + */ + size?: number | undefined; + /** + * - The sun color. + */ + sunColor?: string | number | Color | undefined; + /** + * - The sun direction. + */ + sunDirection?: Vector3 | undefined; + /** + * - The water color. + */ + waterColor?: string | number | Color | undefined; + /** + * - The distortion scale. + */ + distortionScale?: number | undefined; +}; +import { Color } from 'three/webgpu'; +import { Vector3 } from 'three/webgpu'; +/** + * A basic flat, reflective water effect. + * + * Note that this class can only be used with {@link WebGPURenderer}. + * When using {@link WebGLRenderer}, use {@link Water}. + * + * References: + * + * - [Flat mirror for three.js](https://github.com/Slayvin) + * - [An implementation of water shader based on the flat mirror](https://home.adelphi.edu/~stemkoski/) + * - [Water shader explanations in WebGL](http://29a.ch/slides/2012/webglwater/ ) + * + * @augments Mesh + * @three_import import { WaterMesh } from 'three/addons/objects/WaterMesh.js'; + */ +export class WaterMesh extends Mesh { + /** + * Constructs a new water mesh. + * + * @param {BufferGeometry} geometry - The water mesh's geometry. + * @param {WaterMesh~Options} [options] - The configuration options. + */ + constructor(geometry: BufferGeometry, options: any); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWaterMesh: boolean; + /** + * The effect's resolution scale. + * + * @type {number} + * @default 0.5 + */ + resolutionScale: number; + /** + * The water's normal map. + * + * @type {TextureNode} + */ + waterNormals: TextureNode; + /** + * The alpha value. + * + * @type {UniformNode} + * @default 1 + */ + alpha: UniformNode; + /** + * The size value. + * + * @type {UniformNode} + * @default 1 + */ + size: UniformNode; + /** + * The sun color. + * + * @type {UniformNode} + * @default 0xffffff + */ + sunColor: UniformNode; + /** + * The sun direction. + * + * @type {UniformNode} + * @default (0.70707,0.70707,0.0) + */ + sunDirection: UniformNode; + /** + * The water color. + * + * @type {UniformNode} + * @default 0x7f7f7f + */ + waterColor: UniformNode; + /** + * The distortion scale. + * + * @type {UniformNode} + * @default 20 + */ + distortionScale: UniformNode; +} +import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts b/jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts new file mode 100644 index 000000000..7729eb4da --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts @@ -0,0 +1,2 @@ +export default initJank; +declare function initJank(): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts b/jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts b/jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts new file mode 100644 index 000000000..4f3b99c71 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts @@ -0,0 +1,2 @@ +export default init; +declare function init(canvas: any, width: any, height: any, pixelRatio: any, path: any): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts b/jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts new file mode 100644 index 000000000..9494a16be --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts @@ -0,0 +1,52 @@ +/** + * @classdesc Can be used to include Ammo.js as a Physics engine into + * `three.js` apps. The API can be initialized via: + * ```js + * const physics = await AmmoPhysics(); + * ``` + * The component automatically imports Ammo.js from a CDN so make sure + * to use the component with an active Internet connection. + * + * @name AmmoPhysics + * @class + * @hideconstructor + * @three_import import { AmmoPhysics } from 'three/addons/physics/AmmoPhysics.js'; + */ +export function AmmoPhysics(): Promise<{ + /** + * Adds the given scene to this physics simulation. Only meshes with a + * `physics` object in their {@link Object3D#userData} field will be honored. + * The object can be used to store the mass of the mesh. E.g.: + * ```js + * box.userData.physics = { mass: 1 }; + * ``` + * + * @method + * @name AmmoPhysics#addScene + * @param {Object3D} scene The scene or any type of 3D object to add. + */ + addScene: (scene: any) => void; + /** + * Adds the given mesh to this physics simulation. + * + * @method + * @name AmmoPhysics#addMesh + * @param {Mesh} mesh The mesh to add. + * @param {number} [mass=0] The mass in kg of the mesh. + * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. + */ + addMesh: (mesh: any, mass?: number, restitution?: number) => void; + /** + * Set the position of the given mesh which is part of the physics simulation. Calling this + * method will reset the current simulated velocity of the mesh. + * + * @method + * @name AmmoPhysics#setMeshPosition + * @param {Mesh} mesh The mesh to update the position for. + * @param {Vector3} position - The new position. + * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. + */ + setMeshPosition: (mesh: any, position: any, index?: number) => void; +}>; +export class AmmoPhysics { +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts b/jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts new file mode 100644 index 000000000..d6ab661fe --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts @@ -0,0 +1,53 @@ +/** + * @classdesc Can be used to include Jolt as a Physics engine into + * `three.js` apps. The API can be initialized via: + * ```js + * const physics = await JoltPhysics(); + * ``` + * The component automatically imports Jolt from a CDN so make sure + * to use the component with an active Internet connection. + * + * @name JoltPhysics + * @class + * @hideconstructor + * @three_import import { JoltPhysics } from 'three/addons/physics/JoltPhysics.js'; + */ +export function JoltPhysics(): Promise<{ + /** + * Adds the given scene to this physics simulation. Only meshes with a + * `physics` object in their {@link Object3D#userData} field will be honored. + * The object can be used to store the mass and restitution of the mesh. E.g.: + * ```js + * box.userData.physics = { mass: 1, restitution: 0 }; + * ``` + * + * @method + * @name JoltPhysics#addScene + * @param {Object3D} scene The scene or any type of 3D object to add. + */ + addScene: (scene: any) => void; + /** + * Adds the given mesh to this physics simulation. + * + * @method + * @name JoltPhysics#addMesh + * @param {Mesh} mesh The mesh to add. + * @param {number} [mass=0] The mass in kg of the mesh. + * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. + */ + addMesh: (mesh: any, mass?: number, restitution?: number) => void; + /** + * Set the position of the given mesh which is part of the physics simulation. Calling this + * method will reset the current simulated velocity of the mesh. + * + * @method + * @name JoltPhysics#setMeshPosition + * @param {Mesh} mesh The mesh to update the position for. + * @param {Vector3} position - The new position. + * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. + */ + setMeshPosition: (mesh: any, position: any, index?: number) => void; + setMeshVelocity: () => void; +}>; +export class JoltPhysics { +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts b/jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts new file mode 100644 index 000000000..cf3f9fb28 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts @@ -0,0 +1,98 @@ +/** + * @classdesc Can be used to include Rapier as a Physics engine into + * `three.js` apps. The API can be initialized via: + * ```js + * const physics = await RapierPhysics(); + * ``` + * The component automatically imports Rapier from a CDN so make sure + * to use the component with an active Internet connection. + * + * @name RapierPhysics + * @class + * @hideconstructor + * @three_import import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; + */ +export function RapierPhysics(): Promise<{ + RAPIER: any; + world: any; + /** + * Adds the given scene to this physics simulation. Only meshes with a + * `physics` object in their {@link Object3D#userData} field will be honored. + * The object can be used to store the mass and restitution of the mesh. E.g.: + * ```js + * box.userData.physics = { mass: 1, restitution: 0 }; + * ``` + * + * @method + * @name RapierPhysics#addScene + * @param {Object3D} scene The scene or any type of 3D object to add. + */ + addScene: (scene: any) => void; + /** + * Adds the given mesh to this physics simulation. + * + * @method + * @name RapierPhysics#addMesh + * @param {Mesh} mesh The mesh to add. + * @param {number} [mass=0] The mass in kg of the mesh. + * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. + */ + addMesh: (mesh: any, mass?: number, restitution?: number) => void; + /** + * Removes the given mesh from this physics simulation. + * + * @method + * @name RapierPhysics#removeMesh + * @param {Mesh} mesh The mesh to remove. + */ + removeMesh: (mesh: any) => void; + /** + * Set the position of the given mesh which is part of the physics simulation. Calling this + * method will reset the current simulated velocity of the mesh. + * + * @method + * @name RapierPhysics#setMeshPosition + * @param {Mesh} mesh The mesh to update the position for. + * @param {Vector3} position - The new position. + * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. + */ + setMeshPosition: (mesh: any, position: any, index?: number) => void; + /** + * Set the velocity of the given mesh which is part of the physics simulation. + * + * @method + * @name RapierPhysics#setMeshVelocity + * @param {Mesh} mesh The mesh to update the velocity for. + * @param {Vector3} velocity - The new velocity. + * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. + */ + setMeshVelocity: (mesh: any, velocity: any, index?: number) => void; + /** + * Adds a heightfield terrain to the physics simulation. + * + * @method + * @name RapierPhysics#addHeightfield + * @param {Mesh} mesh - The Three.js mesh representing the terrain. + * @param {number} width - The number of vertices along the width (x-axis) of the heightfield. + * @param {number} depth - The number of vertices along the depth (z-axis) of the heightfield. + * @param {Float32Array} heights - Array of height values for each vertex in the heightfield. + * @param {Object} scale - Scale factors for the heightfield dimensions. + * @param {number} scale.x - Scale factor for width. + * @param {number} scale.y - Scale factor for height. + * @param {number} scale.z - Scale factor for depth. + * @returns {RigidBody} The created Rapier rigid body for the heightfield. + */ + addHeightfield: (mesh: any, width: any, depth: any, heights: any, scale: any) => any; + /** + * Applies an impulse to the given mesh which is part of the physics simulation. + * + * @method + * @name RapierPhysics#applyImpulse + * @param {Mesh} mesh - The mesh to apply the impulse to. + * @param {Vector3} impulse - The impulse to apply. + * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. + */ + applyImpulse: (mesh: any, impulse: any, index?: number) => void; +}>; +export class RapierPhysics { +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts new file mode 100644 index 000000000..ce505f2d5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts @@ -0,0 +1,75 @@ +/** + * Pass for a basic after image effect. + * + * ```js + * const afterimagePass = new AfterimagePass( 0.9 ); + * composer.addPass( afterimagePass ); + * ``` + * + * @augments Pass + * @three_import import { AfterimagePass } from 'three/addons/postprocessing/AfterimagePass.js'; + */ +export class AfterimagePass extends Pass { + /** + * Constructs a new after image pass. + * + * @param {number} [damp=0.96] - The damping intensity. A higher value means a stronger after image effect. + */ + constructor(damp?: number); + /** + * The pass uniforms. Use this object if you want to update the + * `damp` value at runtime. + * ```js + * pass.uniforms.damp.value = 0.9; + * ``` + * + * @type {Object} + */ + uniforms: Object; + set damp(value: number); + /** + * The damping intensity, from 0.0 to 1.0. A higher value means a stronger after image effect. + * + * @type {number} + */ + get damp(): number; + /** + * The composition material. + * + * @type {ShaderMaterial} + */ + compFsMaterial: ShaderMaterial; + /** + * The copy material. + * + * @type {ShaderMaterial} + */ + copyFsMaterial: ShaderMaterial; + _textureComp: WebGLRenderTarget; + _textureOld: WebGLRenderTarget; + _compFsQuad: FullScreenQuad; + _copyFsQuad: FullScreenQuad; + /** + * Performs the after image pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts new file mode 100644 index 000000000..97155abd9 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts @@ -0,0 +1,79 @@ +/** + * A pass for a basic Bloom effect. + * + * {@link UnrealBloomPass} produces a more advanced Bloom but is also + * more expensive. + * + * ```js + * const effectBloom = new BloomPass( 0.75 ); + * composer.addPass( effectBloom ); + * ``` + * + * @augments Pass + * @three_import import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; + */ +export class BloomPass extends Pass { + /** + * Constructs a new Bloom pass. + * + * @param {number} [strength=1] - The Bloom strength. + * @param {number} [kernelSize=25] - The kernel size. + * @param {number} [sigma=4] - The sigma. + */ + constructor(strength?: number, kernelSize?: number, sigma?: number); + /** + * The combine pass uniforms. + * + * @type {Object} + */ + combineUniforms: Object; + /** + * The combine pass material. + * + * @type {ShaderMaterial} + */ + materialCombine: ShaderMaterial; + /** + * The convolution pass uniforms. + * + * @type {Object} + */ + convolutionUniforms: Object; + /** + * The convolution pass material. + * + * @type {ShaderMaterial} + */ + materialConvolution: ShaderMaterial; + _renderTargetX: WebGLRenderTarget; + _renderTargetY: WebGLRenderTarget; + _fsQuad: FullScreenQuad; + /** + * Performs the Bloom pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; +} +export namespace BloomPass { + let blurX: Vector2; + let blurY: Vector2; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { FullScreenQuad } from './Pass.js'; +import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts new file mode 100644 index 000000000..22a5e5f4a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts @@ -0,0 +1,102 @@ +/** + * ~Options + */ +export type BokehPass = { + /** + * - Defines the effect's focus which is the distance along the camera's look direction in world units. + */ + focus?: number | undefined; + /** + * - Defines the effect's aperture. + */ + aperture?: number | undefined; + /** + * - Defines the effect's maximum blur. + */ + maxblur?: number | undefined; +}; +/** + * Pass for creating depth of field (DOF) effect. + * + * ```js + * const bokehPass = new BokehPass( scene, camera, { + * focus: 500 + * aperture: 5, + * maxblur: 0.01 + * } ); + * composer.addPass( bokehPass ); + * ``` + * + * @augments Pass + * @three_import import { BokehPass } from 'three/addons/postprocessing/BokehPass.js'; + */ +export class BokehPass extends Pass { + /** + * Constructs a new Bokeh pass. + * + * @param {Scene} scene - The scene to render the DOF for. + * @param {Camera} camera - The camera. + * @param {BokehPass~Options} params - The pass options. + */ + constructor(scene: Scene, camera: Camera, params: any); + /** + * The scene to render the DOF for. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + _renderTargetDepth: WebGLRenderTarget; + _materialDepth: MeshDepthMaterial; + /** + * The pass bokeh material. + * + * @type {ShaderMaterial} + */ + materialBokeh: ShaderMaterial; + /** + * The pass uniforms. Use this object if you want to update the + * `focus`, `aperture` or `maxblur` values at runtime. + * + * ```js + * pass.uniforms.focus.value = focus; + * pass.uniforms.aperture.value = aperture; + * pass.uniforms.maxblur.value = maxblur; + * ``` + * + * @type {Object} + */ + uniforms: Object; + _fsQuad: FullScreenQuad; + _oldClearColor: Color; + /** + * Performs the Bokeh pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; +} +import { Pass } from './Pass.js'; +import { WebGLRenderTarget } from 'three'; +import { MeshDepthMaterial } from 'three'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; +import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts new file mode 100644 index 000000000..1e974da1b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts @@ -0,0 +1,50 @@ +/** + * This class can be used to force a clear operation for the current read or + * default framebuffer (when rendering to screen). + * + * ```js + * const clearPass = new ClearPass(); + * composer.addPass( clearPass ); + * ``` + * + * @augments Pass + * @three_import import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; + */ +export class ClearPass extends Pass { + /** + * Constructs a new clear pass. + * + * @param {(number|Color|string)} [clearColor=0x000000] - The clear color. + * @param {number} [clearAlpha=0] - The clear alpha. + */ + constructor(clearColor?: (number | Color | string), clearAlpha?: number); + /** + * The clear color. + * + * @type {(number|Color|string)} + * @default 0x000000 + */ + clearColor: (number | Color | string); + /** + * The clear alpha. + * + * @type {number} + * @default 0 + */ + clearAlpha: number; + _oldClearColor: Color; + /** + * Performs the clear operation. This affects the current read or the default framebuffer. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts new file mode 100644 index 000000000..e67221297 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts @@ -0,0 +1,61 @@ +/** + * This pass can be used to render a cube texture over the entire screen. + * + * ```js + * const cubeMap = new THREE.CubeTextureLoader().load( urls ); + * + * const cubeTexturePass = new CubeTexturePass( camera, cubemap ); + * composer.addPass( cubeTexturePass ); + * ``` + * + * @augments Pass + * @three_import import { CubeTexturePass } from 'three/addons/postprocessing/CubeTexturePass.js'; + */ +export class CubeTexturePass extends Pass { + /** + * Constructs a new cube texture pass. + * + * @param {PerspectiveCamera} camera - The camera. + * @param {CubeTexture} tCube - The cube texture to render. + * @param {number} [opacity=1] - The opacity. + */ + constructor(camera: PerspectiveCamera, tCube: CubeTexture, opacity?: number); + /** + * The camera. + * + * @type {PerspectiveCamera} + */ + camera: PerspectiveCamera; + /** + * The cube texture to render. + * + * @type {CubeTexture} + */ + tCube: CubeTexture; + /** + * The opacity. + * + * @type {number} + * @default 1 + */ + opacity: number; + _cubeMesh: Mesh; + _cubeScene: Scene; + _cubeCamera: PerspectiveCamera; + /** + * Performs the cube texture pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { PerspectiveCamera } from 'three'; +import { Mesh } from 'three'; +import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts new file mode 100644 index 000000000..295052177 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts @@ -0,0 +1,55 @@ +/** + * Pass for creating a dot-screen effect. + * + * ```js + * const pass = new DotScreenPass( new THREE.Vector2( 0, 0 ), 0.5, 0.8 ); + * composer.addPass( pass ); + * ``` + * + * @augments Pass + * @three_import import { DotScreenPass } from 'three/addons/postprocessing/DotScreenPass.js'; + */ +export class DotScreenPass extends Pass { + /** + * Constructs a new dot screen pass. + * + * @param {Vector2} center - The center point. + * @param {number} angle - The rotation of the effect in radians. + * @param {number} scale - The scale of the effect. A higher value means smaller dots. + */ + constructor(center: Vector2, angle: number, scale: number); + /** + * The pass uniforms. Use this object if you want to update the + * `center`, `angle` or `scale` values at runtime. + * ```js + * pass.uniforms.center.value.copy( center ); + * pass.uniforms.angle.value = 0; + * pass.uniforms.scale.value = 0.5; + * ``` + * + * @type {Object} + */ + uniforms: Object; + /** + * The pass material. + * + * @type {ShaderMaterial} + */ + material: ShaderMaterial; + _fsQuad: FullScreenQuad; + /** + * Performs the dot screen pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts new file mode 100644 index 000000000..ba4d2c368 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts @@ -0,0 +1,158 @@ +/** + * Used to implement post-processing effects in three.js. + * The class manages a chain of post-processing passes to produce the final visual result. + * Post-processing passes are executed in order of their addition/insertion. + * The last pass is automatically rendered to screen. + * + * This module can only be used with {@link WebGLRenderer}. + * + * ```js + * const composer = new EffectComposer( renderer ); + * + * // adding some passes + * const renderPass = new RenderPass( scene, camera ); + * composer.addPass( renderPass ); + * + * const glitchPass = new GlitchPass(); + * composer.addPass( glitchPass ); + * + * const outputPass = new OutputPass() + * composer.addPass( outputPass ); + * + * function animate() { + * + * composer.render(); // instead of renderer.render() + * + * } + * ``` + * + * @three_import import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; + */ +export class EffectComposer { + /** + * Constructs a new effect composer. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} [renderTarget] - This render target and a clone will + * be used as the internal read and write buffers. If not given, the composer creates + * the buffers automatically. + */ + constructor(renderer: WebGLRenderer, renderTarget?: WebGLRenderTarget); + /** + * The renderer. + * + * @type {WebGLRenderer} + */ + renderer: WebGLRenderer; + _pixelRatio: any; + _width: any; + _height: any; + renderTarget1: WebGLRenderTarget; + renderTarget2: import("three").RenderTarget; + /** + * A reference to the internal write buffer. Passes usually write + * their result into this buffer. + * + * @type {WebGLRenderTarget} + */ + writeBuffer: WebGLRenderTarget; + /** + * A reference to the internal read buffer. Passes usually read + * the previous render result from this buffer. + * + * @type {WebGLRenderTarget} + */ + readBuffer: WebGLRenderTarget; + /** + * Whether the final pass is rendered to the screen (default framebuffer) or not. + * + * @type {boolean} + * @default true + */ + renderToScreen: boolean; + /** + * An array representing the (ordered) chain of post-processing passes. + * + * @type {Array} + */ + passes: Array; + /** + * A copy pass used for internal swap operations. + * + * @private + * @type {ShaderPass} + */ + private copyPass; + /** + * The internal timer for managing time data. + * + * @private + * @type {Timer} + */ + private timer; + /** + * Swaps the internal read/write buffers. + */ + swapBuffers(): void; + /** + * Adds the given pass to the pass chain. + * + * @param {Pass} pass - The pass to add. + */ + addPass(pass: Pass): void; + /** + * Inserts the given pass at a given index. + * + * @param {Pass} pass - The pass to insert. + * @param {number} index - The index into the pass chain. + */ + insertPass(pass: Pass, index: number): void; + /** + * Removes the given pass from the pass chain. + * + * @param {Pass} pass - The pass to remove. + */ + removePass(pass: Pass): void; + /** + * Returns `true` if the pass for the given index is the last enabled pass in the pass chain. + * + * @param {number} passIndex - The pass index. + * @return {boolean} Whether the pass for the given index is the last pass in the pass chain. + */ + isLastEnabledPass(passIndex: number): boolean; + /** + * Executes all enabled post-processing passes in order to produce the final frame. + * + * @param {number} deltaTime - The delta time in seconds. If not given, the composer computes + * its own time delta value. + */ + render(deltaTime: number): void; + /** + * Resets the internal state of the EffectComposer. + * + * @param {WebGLRenderTarget} [renderTarget] - This render target has the same purpose like + * the one from the constructor. If set, it is used to setup the read and write buffers. + */ + reset(renderTarget?: WebGLRenderTarget): void; + /** + * Resizes the internal read and write buffers as well as all passes. Similar to {@link WebGLRenderer#setSize}, + * this method honors the current pixel ration. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + */ + setSize(width: number, height: number): void; + /** + * Sets device pixel ratio. This is usually used for HiDPI device to prevent blurring output. + * Setting the pixel ratio will automatically resize the composer. + * + * @param {number} pixelRatio - The pixel ratio to set. + */ + setPixelRatio(pixelRatio: number): void; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever the composer is no longer used in your app. + */ + dispose(): void; +} +import { WebGLRenderTarget } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts new file mode 100644 index 000000000..9bcbeed49 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts @@ -0,0 +1,25 @@ +/** + * A pass for applying FXAA. + * + * ```js + * const fxaaPass = new FXAAPass(); + * composer.addPass( fxaaPass ); + * ``` + * + * @augments ShaderPass + * @three_import import { FXAAPass } from 'three/addons/postprocessing/FXAAPass.js'; + */ +export class FXAAPass extends ShaderPass { + /** + * Constructs a new FXAA pass. + */ + constructor(); + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; +} +import { ShaderPass } from './ShaderPass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts new file mode 100644 index 000000000..14d8c1255 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts @@ -0,0 +1,53 @@ +/** + * This pass can be used to create a film grain effect. + * + * ```js + * const filmPass = new FilmPass(); + * composer.addPass( filmPass ); + * ``` + * + * @augments Pass + * @three_import import { FilmPass } from 'three/addons/postprocessing/FilmPass.js'; + */ +export class FilmPass extends Pass { + /** + * Constructs a new film pass. + * + * @param {number} [intensity=0.5] - The grain intensity in the range `[0,1]` (0 = no effect, 1 = full effect). + * @param {boolean} [grayscale=false] - Whether to apply a grayscale effect or not. + */ + constructor(intensity?: number, grayscale?: boolean); + /** + * The pass uniforms. Use this object if you want to update the + * `intensity` or `grayscale` values at runtime. + * ```js + * pass.uniforms.intensity.value = 1; + * pass.uniforms.grayscale.value = true; + * ``` + * + * @type {Object} + */ + uniforms: Object; + /** + * The pass material. + * + * @type {ShaderMaterial} + */ + material: ShaderMaterial; + _fsQuad: FullScreenQuad; + /** + * Performs the film pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number): void; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts new file mode 100644 index 000000000..5188ebe80 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts @@ -0,0 +1,184 @@ +/** + * A pass for an GTAO effect. + * + * `GTAOPass` provides better quality than {@link SSAOPass} but is also more expensive. + * + * ```js + * const gtaoPass = new GTAOPass( scene, camera, width, height ); + * gtaoPass.output = GTAOPass.OUTPUT.Denoise; + * composer.addPass( gtaoPass ); + * ``` + * + * @augments Pass + * @three_import import { GTAOPass } from 'three/addons/postprocessing/GTAOPass.js'; + */ +export class GTAOPass extends Pass { + /** + * Constructs a new GTAO pass. + * + * @param {Scene} scene - The scene to compute the AO for. + * @param {Camera} camera - The camera. + * @param {number} [width=512] - The width of the effect. + * @param {number} [height=512] - The height of the effect. + * @param {Object} [parameters] - The pass parameters. + * @param {Object} [aoParameters] - The AO parameters. + * @param {Object} [pdParameters] - The denoise parameters. + */ + constructor(scene: Scene, camera: Camera, width?: number, height?: number, parameters?: Object, aoParameters?: Object, pdParameters?: Object); + /** + * The width of the effect. + * + * @type {number} + * @default 512 + */ + width: number; + /** + * The height of the effect. + * + * @type {number} + * @default 512 + */ + height: number; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * The scene to render the AO for. + * + * @type {Scene} + */ + scene: Scene; + /** + * The output configuration. + * + * @type {number} + * @default 0 + */ + output: number; + _renderGBuffer: boolean; + _visibilityCache: any[]; + /** + * The AO blend intensity. + * + * @type {number} + * @default 1 + */ + blendIntensity: number; + /** + * The number of Poisson Denoise rings. + * + * @type {number} + * @default 2 + */ + pdRings: number; + /** + * The Poisson Denoise radius exponent. + * + * @type {number} + * @default 2 + */ + pdRadiusExponent: number; + /** + * The Poisson Denoise sample count. + * + * @type {number} + * @default 16 + */ + pdSamples: number; + gtaoNoiseTexture: DataTexture; + pdNoiseTexture: DataTexture; + gtaoRenderTarget: WebGLRenderTarget; + pdRenderTarget: import("three").RenderTarget; + gtaoMaterial: ShaderMaterial; + normalMaterial: MeshNormalMaterial; + pdMaterial: ShaderMaterial; + depthRenderMaterial: ShaderMaterial; + copyMaterial: ShaderMaterial; + blendMaterial: ShaderMaterial; + _fsQuad: FullScreenQuad; + _originalClearColor: Color; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * A texture holding the computed AO. + * + * @type {Texture} + * @readonly + */ + readonly get gtaoMap(): Texture; + /** + * Configures the GBuffer of this pass. If no arguments are passed, + * the pass creates an internal render target for holding depth + * and normal data. + * + * @param {DepthTexture} [depthTexture] - The depth texture. + * @param {DepthTexture} [normalTexture] - The normal texture. + */ + setGBuffer(depthTexture?: DepthTexture, normalTexture?: DepthTexture): void; + depthTexture: DepthTexture | undefined; + normalTexture: import("three").Texture | DepthTexture | undefined; + normalRenderTarget: WebGLRenderTarget | undefined; + /** + * Configures the clip box of the GTAO shader with the given AABB. + * + * @param {?Box3} box - The AABB enclosing the scene that should receive AO. When passing + * `null`, to clip box is used. + */ + setSceneClipBox(box: Box3 | null): void; + /** + * Updates the GTAO material from the given parameter object. + * + * @param {Object} parameters - The GTAO material parameters. + */ + updateGtaoMaterial(parameters: Object): void; + /** + * Updates the Denoise material from the given parameter object. + * + * @param {Object} parameters - The denoise parameters. + */ + updatePdMaterial(parameters: Object): void; + /** + * Performs the GTAO pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; + _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; + _overrideVisibility(): void; + _restoreVisibility(): void; + _generateNoise(size?: number): DataTexture; +} +export namespace GTAOPass { + namespace OUTPUT { + let Off: number; + let Default: number; + let Diffuse: number; + let Depth: number; + let Normal: number; + let AO: number; + let Denoise: number; + } +} +import { Pass } from './Pass.js'; +import { DataTexture } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { ShaderMaterial } from 'three'; +import { MeshNormalMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; +import { Color } from 'three'; +import { DepthTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts new file mode 100644 index 000000000..2ca364516 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts @@ -0,0 +1,61 @@ +/** + * Pass for creating a glitch effect. + * + * ```js + * const glitchPass = new GlitchPass(); + * composer.addPass( glitchPass ); + * ``` + * + * @augments Pass + * @three_import import { GlitchPass } from 'three/addons/postprocessing/GlitchPass.js'; + */ +export class GlitchPass extends Pass { + /** + * Constructs a new glitch pass. + * + * @param {number} [dt_size=64] - The size of the displacement texture + * for digital glitch squares. + */ + constructor(dt_size?: number); + /** + * The pass uniforms. + * + * @type {Object} + */ + uniforms: Object; + /** + * The pass material. + * + * @type {ShaderMaterial} + */ + material: ShaderMaterial; + /** + * Whether to noticeably increase the effect intensity or not. + * + * @type {boolean} + * @default false + */ + goWild: boolean; + _heightMap: DataTexture; + _fsQuad: FullScreenQuad; + _curF: number; + _randX: number; + /** + * Performs the glitch pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + _generateTrigger(): void; + _generateHeightmap(dt_size: any): DataTexture; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { DataTexture } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts new file mode 100644 index 000000000..a3907b4d1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts @@ -0,0 +1,66 @@ +/** + * Pass for creating a RGB halftone effect. + * + * ```js + * const params = { + * shape: 1, + * radius: 4, + * rotateR: Math.PI / 12, + * rotateB: Math.PI / 12 * 2, + * rotateG: Math.PI / 12 * 3, + * scatter: 0, + * blending: 1, + * blendingMode: 1, + * greyscale: false, + * disable: false + * }; + * const halftonePass = new HalftonePass( params ); + * composer.addPass( halftonePass ); + * ``` + * + * @augments Pass + * @three_import import { HalftonePass } from 'three/addons/postprocessing/HalftonePass.js'; + */ +export class HalftonePass extends Pass { + /** + * Constructs a new halftone pass. + * + * @param {Object} params - The halftone shader parameter. + */ + constructor(params: Object); + /** + * The pass uniforms. + * + * @type {Object} + */ + uniforms: Object; + /** + * The pass material. + * + * @type {ShaderMaterial} + */ + material: ShaderMaterial; + _fsQuad: FullScreenQuad; + /** + * Performs the halftone pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts new file mode 100644 index 000000000..0cc065935 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts @@ -0,0 +1,27 @@ +/** + * Pass for color grading via lookup tables. + * + * ```js + * const lutPass = new LUTPass( { lut: lut.texture3D } ); + * composer.addPass( lutPass ); + * ``` + * + * @augments ShaderPass + * @three_import import { LUTPass } from 'three/addons/postprocessing/LUTPass.js'; + */ +export class LUTPass extends ShaderPass { + /** + * Constructs a LUT pass. + * + * @param {{lut:Data3DTexture,intensity:number}} [options={}] - The pass options. + */ + constructor(options?: { + lut: Data3DTexture; + intensity: number; + }); + set lut(v: any); + get lut(): any; + set intensity(v: any); + get intensity(): any; +} +import { ShaderPass } from './ShaderPass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts new file mode 100644 index 000000000..2563d270d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts @@ -0,0 +1,79 @@ +/** + * This pass can be used to define a mask during post processing. + * Meaning only areas of subsequent post processing are affected + * which lie in the masking area of this pass. Internally, the masking + * is implemented with the stencil buffer. + * + * ```js + * const maskPass = new MaskPass( scene, camera ); + * composer.addPass( maskPass ); + * ``` + * + * @augments Pass + * @three_import import { MaskPass } from 'three/addons/postprocessing/MaskPass.js'; + */ +export class MaskPass extends Pass { + /** + * Constructs a new mask pass. + * + * @param {Scene} scene - The 3D objects in this scene will define the mask. + * @param {Camera} camera - The camera. + */ + constructor(scene: Scene, camera: Camera); + /** + * The scene that defines the mask. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * Whether to inverse the mask or not. + * + * @type {boolean} + * @default false + */ + inverse: boolean; + /** + * Performs a mask pass with the configured scene and camera. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +/** + * This pass can be used to clear a mask previously defined with {@link MaskPass}. + * + * ```js + * const clearPass = new ClearMaskPass(); + * composer.addPass( clearPass ); + * ``` + * + * @augments Pass + */ +export class ClearMaskPass extends Pass { + /** + * Performs the clear of the currently defined mask. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer): void; +} +import { Pass } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts new file mode 100644 index 000000000..9e237fdea --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts @@ -0,0 +1,177 @@ +/** + * A pass for rendering outlines around selected objects. + * + * ```js + * const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight ); + * const outlinePass = new OutlinePass( resolution, scene, camera ); + * composer.addPass( outlinePass ); + * ``` + * + * @augments Pass + * @three_import import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js'; + */ +export class OutlinePass extends Pass { + /** + * Constructs a new outline pass. + * + * @param {Vector2} [resolution] - The effect's resolution. + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera. + * @param {Array} [selectedObjects] - The selected 3D objects that should receive an outline. + * + */ + constructor(resolution?: Vector2, scene: Scene, camera: Camera, selectedObjects?: Array); + /** + * The scene to render. + * + * @type {Object} + */ + renderScene: Object; + /** + * The camera. + * + * @type {Object} + */ + renderCamera: Object; + /** + * The selected 3D objects that should receive an outline. + * + * @type {Array} + */ + selectedObjects: Array; + /** + * The visible edge color. + * + * @type {Color} + * @default (1,1,1) + */ + visibleEdgeColor: Color; + /** + * The hidden edge color. + * + * @type {Color} + * @default (0.1,0.04,0.02) + */ + hiddenEdgeColor: Color; + /** + * Can be used for an animated glow/pulse effect. + * + * @type {number} + * @default 0 + */ + edgeGlow: number; + /** + * Whether to use a pattern texture for to highlight selected + * 3D objects or not. + * + * @type {boolean} + * @default false + */ + usePatternTexture: boolean; + /** + * Can be used to highlight selected 3D objects. Requires to set + * {@link OutlinePass#usePatternTexture} to `true`. + * + * @type {?Texture} + * @default null + */ + patternTexture: Texture | null; + /** + * The edge thickness. + * + * @type {number} + * @default 1 + */ + edgeThickness: number; + /** + * The edge strength. + * + * @type {number} + * @default 3 + */ + edgeStrength: number; + /** + * The downsample ratio. The effect can be rendered in a much + * lower resolution than the beauty pass. + * + * @type {number} + * @default 2 + */ + downSampleRatio: number; + /** + * The pulse period. + * + * @type {number} + * @default 0 + */ + pulsePeriod: number; + _visibilityCache: Map; + _selectionCache: Set; + /** + * The effect's resolution. + * + * @type {Vector2} + * @default (256,256) + */ + resolution: Vector2; + renderTargetMaskBuffer: WebGLRenderTarget; + depthMaterial: MeshDepthMaterial; + prepareMaskMaterial: ShaderMaterial; + renderTargetDepthBuffer: WebGLRenderTarget; + renderTargetMaskDownSampleBuffer: WebGLRenderTarget; + renderTargetBlurBuffer1: WebGLRenderTarget; + renderTargetBlurBuffer2: WebGLRenderTarget; + edgeDetectionMaterial: ShaderMaterial; + renderTargetEdgeBuffer1: WebGLRenderTarget; + renderTargetEdgeBuffer2: WebGLRenderTarget; + separableBlurMaterial1: ShaderMaterial; + separableBlurMaterial2: ShaderMaterial; + overlayMaterial: ShaderMaterial; + copyUniforms: Object; + materialCopy: ShaderMaterial; + _oldClearColor: Color; + oldClearAlpha: number; + _fsQuad: FullScreenQuad; + tempPulseColor1: Color; + tempPulseColor2: Color; + textureMatrix: Matrix4; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * Performs the Outline pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean): void; + _updateSelectionCache(): void; + _changeVisibilityOfSelectedObjects(bVisible: any): void; + _changeVisibilityOfNonSelectedObjects(bVisible: any): void; + _updateTextureMatrix(): void; + _getPrepareMaskMaterial(): ShaderMaterial; + _getEdgeDetectionMaterial(): ShaderMaterial; + _getSeparableBlurMaterial(maxRadius: any): ShaderMaterial; + _getOverlayMaterial(): ShaderMaterial; +} +export namespace OutlinePass { + let BlurDirectionX: Vector2; + let BlurDirectionY: Vector2; +} +import { Pass } from './Pass.js'; +import { Color } from 'three'; +import { Vector2 } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { MeshDepthMaterial } from 'three'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; +import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts new file mode 100644 index 000000000..a4b3d2594 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts @@ -0,0 +1,56 @@ +/** + * This pass is responsible for including tone mapping and color space conversion + * into your pass chain. In most cases, this pass should be included at the end + * of each pass chain. If a pass requires sRGB input (e.g. like FXAA), the pass + * must follow `OutputPass` in the pass chain. + * + * The tone mapping and color space settings are extracted from the renderer. + * + * ```js + * const outputPass = new OutputPass(); + * composer.addPass( outputPass ); + * ``` + * + * @augments Pass + * @three_import import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + */ +export class OutputPass extends Pass { + /** + * This flag indicates that this is an output pass. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOutputPass: boolean; + /** + * The pass uniforms. + * + * @type {Object} + */ + uniforms: Object; + /** + * The pass material. + * + * @type {RawShaderMaterial} + */ + material: RawShaderMaterial; + _fsQuad: FullScreenQuad; + _outputColorSpace: any; + _toneMapping: any; + /** + * Performs the output pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { RawShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts new file mode 100644 index 000000000..77af31f08 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts @@ -0,0 +1,115 @@ +/** + * Abstract base class for all post processing passes. + * + * This module is only relevant for post processing with {@link WebGLRenderer}. + * + * @abstract + * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js'; + */ +export class Pass { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPass: boolean; + /** + * If set to `true`, the pass is processed by the composer. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * If set to `true`, the pass indicates to swap read and write buffer after rendering. + * + * @type {boolean} + * @default true + */ + needsSwap: boolean; + /** + * If set to `true`, the pass clears its buffer before rendering + * + * @type {boolean} + * @default false + */ + clear: boolean; + /** + * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers + * pass chain gets automatically rendered to screen, no matter how this property is configured. + * + * @type {boolean} + * @default false + */ + renderToScreen: boolean; + /** + * Sets the size of the pass. + * + * @abstract + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(): void; + /** + * This method holds the render logic of a pass. It must be implemented in all derived classes. + * + * @abstract + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(): void; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever the pass is no longer used in your app. + * + * @abstract + */ + dispose(): void; +} +/** + * This module is a helper for passes which need to render a full + * screen effect which is quite common in context of post processing. + * + * The intended usage is to reuse a single full screen quad for rendering + * subsequent passes by just reassigning the `material` reference. + * + * This module can only be used with {@link WebGLRenderer}. + * + * @augments Mesh + * @three_import import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js'; + */ +export class FullScreenQuad { + /** + * Constructs a new full screen quad. + * + * @param {?Material} material - The material to render te full screen quad with. + */ + constructor(material: Material | null); + _mesh: Mesh; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever the instance is no longer used in your app. + */ + dispose(): void; + /** + * Renders the full screen quad. + * + * @param {WebGLRenderer} renderer - The renderer. + */ + render(renderer: WebGLRenderer): void; + set material(value: Material | null); + /** + * The quad's material. + * + * @type {?Material} + */ + get material(): Material | null; +} +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts new file mode 100644 index 000000000..9e9147843 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts @@ -0,0 +1,89 @@ +/** + * This class represents a render pass. It takes a camera and a scene and produces + * a beauty pass for subsequent post processing effects. + * + * ```js + * const renderPass = new RenderPass( scene, camera ); + * composer.addPass( renderPass ); + * ``` + * + * @augments Pass + * @three_import import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; + */ +export class RenderPass extends Pass { + /** + * Constructs a new render pass. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera. + * @param {?Material} [overrideMaterial=null] - The override material. If set, this material is used + * for all objects in the scene. + * @param {?(number|Color|string)} [clearColor=null] - The clear color of the render pass. + * @param {?number} [clearAlpha=null] - The clear alpha of the render pass. + */ + constructor(scene: Scene, camera: Camera, overrideMaterial?: Material | null, clearColor?: (number | Color | string) | null, clearAlpha?: number | null); + /** + * The scene to render. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * The override material. If set, this material is used + * for all objects in the scene. + * + * @type {?Material} + * @default null + */ + overrideMaterial: Material | null; + /** + * The clear color of the render pass. + * + * @type {?(number|Color|string)} + * @default null + */ + clearColor: (number | Color | string) | null; + /** + * The clear alpha of the render pass. + * + * @type {?number} + * @default null + */ + clearAlpha: number | null; + /** + * If set to `true`, only the depth can be cleared when `clear` is to `false`. + * + * @type {boolean} + * @default false + */ + clearDepth: boolean; + /** + * This flag indicates that this pass renders the scene itself. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderPass: boolean; + _oldClearColor: Color; + /** + * Performs a beauty pass with the configured scene and camera. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts new file mode 100644 index 000000000..5d7439be4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts @@ -0,0 +1,101 @@ +/** + * A special type of render pass that produces a pixelated beauty pass. + * + * ```js + * const renderPixelatedPass = new RenderPixelatedPass( 6, scene, camera ); + * composer.addPass( renderPixelatedPass ); + * ``` + * + * @augments Pass + * @three_import import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js'; + */ +export class RenderPixelatedPass extends Pass { + /** + * Constructs a new render pixelated pass. + * + * @param {number} pixelSize - The effect's pixel size. + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera. + * @param {{normalEdgeStrength:number,depthEdgeStrength:number}} options - The pass options. + */ + constructor(pixelSize: number, scene: Scene, camera: Camera, options?: { + normalEdgeStrength: number; + depthEdgeStrength: number; + }); + /** + * The effect's pixel size. + * + * @type {number} + */ + pixelSize: number; + /** + * The scene to render. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * The normal edge strength. + * + * @type {number} + * @default 0.3 + */ + normalEdgeStrength: number; + /** + * The normal edge strength. + * + * @type {number} + * @default 0.4 + */ + depthEdgeStrength: number; + /** + * The pixelated material. + * + * @type {ShaderMaterial} + */ + pixelatedMaterial: ShaderMaterial; + _resolution: Vector2; + _renderResolution: Vector2; + _normalMaterial: MeshNormalMaterial; + _beautyRenderTarget: WebGLRenderTarget; + _normalRenderTarget: WebGLRenderTarget; + _fsQuad: FullScreenQuad; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * Sets the effect's pixel size. + * + * @param {number} pixelSize - The pixel size to set. + */ + setPixelSize(pixelSize: number): void; + /** + * Performs the pixelation pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void; + _createPixelatedMaterial(): ShaderMaterial; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { Vector2 } from 'three'; +import { MeshNormalMaterial } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts new file mode 100644 index 000000000..4f782a095 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts @@ -0,0 +1,107 @@ +/** + * A special type of render pass for implementing transition effects. + * When active, the pass will transition from scene A to scene B. + * + * ```js + * const renderTransitionPass = new RenderTransitionPass( fxSceneA.scene, fxSceneA.camera, fxSceneB.scene, fxSceneB.camera ); + * renderTransitionPass.setTexture( textures[ 0 ] ); + * composer.addPass( renderTransitionPass ); + * ``` + * + * @augments Pass + * @three_import import { RenderTransitionPass } from 'three/addons/postprocessing/RenderTransitionPass.js'; + */ +export class RenderTransitionPass extends Pass { + /** + * Constructs a render transition pass. + * + * @param {Scene} sceneA - The first scene. + * @param {Camera} cameraA - The camera of the first scene. + * @param {Scene} sceneB - The second scene. + * @param {Camera} cameraB - The camera of the second scene. + */ + constructor(sceneA: Scene, cameraA: Camera, sceneB: Scene, cameraB: Camera); + /** + * The first scene. + * + * @type {Scene} + */ + sceneA: Scene; + /** + * The camera of the first scene. + * + * @type {Camera} + */ + cameraA: Camera; + /** + * The second scene. + * + * @type {Scene} + */ + sceneB: Scene; + /** + * The camera of the second scene. + * + * @type {Camera} + */ + cameraB: Camera; + /** + * The pass material. + * + * @type {ShaderMaterial} + */ + material: ShaderMaterial; + _renderTargetA: WebGLRenderTarget; + _renderTargetB: WebGLRenderTarget; + _fsQuad: FullScreenQuad; + /** + * Sets the transition factor. Must be in the range `[0,1]`. + * This value determines to what degree both scenes are mixed. + * + * @param {boolean|number} value - The transition factor. + */ + setTransition(value: boolean | number): void; + /** + * Toggles the usage of a texture for the effect. + * + * @param {boolean} value - Whether to use a texture for the transition effect or not. + */ + useTexture(value: boolean): void; + /** + * Sets the effect texture. + * + * @param {Texture} value - The effect texture. + */ + setTexture(value: Texture): void; + /** + * Sets the texture threshold. This value defines how strong the texture effects + * the transition. Must be in the range `[0,1]` (0 means full effect, 1 means no effect). + * + * @param {boolean|number} value - The threshold value. + */ + setTextureThreshold(value: boolean | number): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * Performs the transition pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void; + _createMaterial(): ShaderMaterial; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts new file mode 100644 index 000000000..5bc6ace74 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts @@ -0,0 +1,97 @@ +/** + * A SAO implementation inspired from @bhouston previous SAO work. + * + * `SAOPass` provides better quality than {@link SSAOPass} but is also more expensive. + * + * ```js + * const saoPass = new SAOPass( scene, camera ); + * composer.addPass( saoPass ); + * ``` + * + * @augments Pass + * @three_import import { SAOPass } from 'three/addons/postprocessing/SAOPass.js'; + */ +export class SAOPass extends Pass { + /** + * Constructs a new SAO pass. + * + * @param {Scene} scene - The scene to compute the AO for. + * @param {Camera} camera - The camera. + * @param {Vector2} [resolution] - The effect's resolution. + */ + constructor(scene: Scene, camera: Camera, resolution?: Vector2); + /** + * The scene to render the AO for. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + _originalClearColor: Color; + _oldClearColor: Color; + _oldClearAlpha: number; + /** + * The SAO parameter. + * + * @type {Object} + */ + params: Object; + /** + * The effect's resolution. + * + * @type {Vector2} + * @default (256,256) + */ + resolution: Vector2; + saoRenderTarget: WebGLRenderTarget; + blurIntermediateRenderTarget: import("three").RenderTarget; + normalRenderTarget: WebGLRenderTarget; + normalMaterial: MeshNormalMaterial; + saoMaterial: ShaderMaterial; + vBlurMaterial: ShaderMaterial; + hBlurMaterial: ShaderMaterial; + materialCopy: ShaderMaterial; + fsQuad: FullScreenQuad; + /** + * Performs the SAO pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + prevStdDev: any; + prevNumSamples: any; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; + _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; +} +export namespace SAOPass { + namespace OUTPUT { + let Default: number; + let SAO: number; + let Normal: number; + } +} +import { Pass } from './Pass.js'; +import { Color } from 'three'; +import { Vector2 } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { MeshNormalMaterial } from 'three'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts new file mode 100644 index 000000000..fbdc709b6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts @@ -0,0 +1,51 @@ +/** + * A pass for applying SMAA. Unlike {@link FXAAPass}, `SMAAPass` operates in + * `linear-srgb` so this pass must be executed before {@link OutputPass}. + * + * ```js + * const smaaPass = new SMAAPass(); + * composer.addPass( smaaPass ); + * ``` + * + * @augments Pass + * @three_import import { SMAAPass } from 'three/addons/postprocessing/SMAAPass.js'; + */ +export class SMAAPass extends Pass { + _edgesRT: WebGLRenderTarget; + _weightsRT: WebGLRenderTarget; + _areaTexture: Texture; + _searchTexture: Texture; + _uniformsEdges: Object; + _materialEdges: ShaderMaterial; + _uniformsWeights: Object; + _materialWeights: ShaderMaterial; + _uniformsBlend: Object; + _materialBlend: ShaderMaterial; + _fsQuad: FullScreenQuad; + /** + * Performs the SMAA pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + _getAreaTexture(): string; + _getSearchTexture(): string; +} +import { Pass } from './Pass.js'; +import { WebGLRenderTarget } from 'three'; +import { Texture } from 'three'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts new file mode 100644 index 000000000..7dad6594f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts @@ -0,0 +1,105 @@ +/** + * Supersample Anti-Aliasing Render Pass. + * + * This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results. + * + * ```js + * const ssaaRenderPass = new SSAARenderPass( scene, camera ); + * ssaaRenderPass.sampleLevel = 3; + * composer.addPass( ssaaRenderPass ); + * ``` + * + * @augments Pass + * @three_import import { SSAARenderPass } from 'three/addons/postprocessing/SSAARenderPass.js'; + */ +export class SSAARenderPass extends Pass { + /** + * Constructs a new SSAA render pass. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera. + * @param {?(number|Color|string)} [clearColor=0x000000] - The clear color of the render pass. + * @param {?number} [clearAlpha=0] - The clear alpha of the render pass. + */ + constructor(scene: Scene, camera: Camera, clearColor?: (number | Color | string) | null, clearAlpha?: number | null); + /** + * The scene to render. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * The sample level. Specified as n, where the number of + * samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16. + * + * @type {number} + * @default 4 + */ + sampleLevel: number; + /** + * Whether the pass should be unbiased or not. This property has the most + * visible effect when rendering to a RGBA8 buffer because it mitigates + * rounding errors. By default RGBA16F is used. + * + * @type {boolean} + * @default true + */ + unbiased: boolean; + /** + * Whether to use a stencil buffer or not. This property can't + * be changed after the first render. + * + * @type {boolean} + * @default false + */ + stencilBuffer: boolean; + /** + * The clear color of the render pass. + * + * @type {?(number|Color|string)} + * @default 0x000000 + */ + clearColor: (number | Color | string) | null; + /** + * The clear alpha of the render pass. + * + * @type {?number} + * @default 0 + */ + clearAlpha: number | null; + _sampleRenderTarget: WebGLRenderTarget | null; + _oldClearColor: Color; + _copyUniforms: Object; + _copyMaterial: ShaderMaterial; + _fsQuad: FullScreenQuad; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * Performs the SSAA render pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { Color } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts new file mode 100644 index 000000000..e26c2ac62 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts @@ -0,0 +1,137 @@ +/** + * A pass for a basic SSAO effect. + * + * {@link SAOPass} and {@link GTAPass} produce a more advanced AO but are also + * more expensive. + * + * ```js + * const ssaoPass = new SSAOPass( scene, camera, width, height ); + * composer.addPass( ssaoPass ); + * ``` + * + * @augments Pass + * @three_import import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js'; + */ +export class SSAOPass extends Pass { + /** + * Constructs a new SSAO pass. + * + * @param {Scene} scene - The scene to compute the AO for. + * @param {Camera} camera - The camera. + * @param {number} [width=512] - The width of the effect. + * @param {number} [height=512] - The height of the effect. + * @param {number} [kernelSize=32] - The kernel size. + */ + constructor(scene: Scene, camera: Camera, width?: number, height?: number, kernelSize?: number); + /** + * The width of the effect. + * + * @type {number} + * @default 512 + */ + width: number; + /** + * The height of the effect. + * + * @type {number} + * @default 512 + */ + height: number; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * The scene to render the AO for. + * + * @type {Scene} + */ + scene: Scene; + /** + * The kernel radius controls how wide the + * AO spreads. + * + * @type {number} + * @default 8 + */ + kernelRadius: number; + kernel: any[]; + noiseTexture: DataTexture | null; + /** + * The output configuration. + * + * @type {number} + * @default 0 + */ + output: number; + /** + * Defines the minimum distance that should be + * affected by the AO. + * + * @type {number} + * @default 0.005 + */ + minDistance: number; + /** + * Defines the maximum distance that should be + * affected by the AO. + * + * @type {number} + * @default 0.1 + */ + maxDistance: number; + _visibilityCache: any[]; + normalRenderTarget: WebGLRenderTarget; + ssaoRenderTarget: WebGLRenderTarget; + blurRenderTarget: import("three").RenderTarget; + ssaoMaterial: ShaderMaterial; + normalMaterial: MeshNormalMaterial; + blurMaterial: ShaderMaterial; + depthRenderMaterial: ShaderMaterial; + copyMaterial: ShaderMaterial; + _fsQuad: FullScreenQuad; + _originalClearColor: Color; + /** + * Performs the SSAO pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; + _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; + _generateSampleKernel(kernelSize: any): void; + _generateRandomKernelRotations(): void; + _overrideVisibility(): void; + _restoreVisibility(): void; +} +export namespace SSAOPass { + namespace OUTPUT { + let Default: number; + let SSAO: number; + let Blur: number; + let Depth: number; + let Normal: number; + } +} +import { Pass } from './Pass.js'; +import { DataTexture } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { ShaderMaterial } from 'three'; +import { MeshNormalMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; +import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts new file mode 100644 index 000000000..02504603f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts @@ -0,0 +1,218 @@ +/** + * ~Options + */ +export type SSRPass = { + /** + * - The renderer. + */ + renderer: WebGLRenderer; + /** + * - The scene to render. + */ + scene: Scene; + /** + * - The camera. + */ + camera: Camera; + /** + * - The width of the effect. + */ + width?: number | undefined; + /** + * - The width of the effect. + */ + height?: number | undefined; + /** + * - Which 3D objects should be affected by SSR. If not set, the entire scene is affected. + */ + selects?: Object3D[] | null | undefined; + /** + * - Whether bouncing is enabled or not. + */ + bouncing?: boolean | undefined; + /** + * - A ground reflector. + */ + groundReflector?: ReflectorForSSRPass | null; +}; +/** + * A pass for a basic SSR effect. + * + * ```js + * const ssrPass = new SSRPass( { + * renderer, + * scene, + * camera, + * width: innerWidth, + * height: innerHeight + * } ); + * composer.addPass( ssrPass ); + * ``` + * + * @augments Pass + * @three_import import { SSRPass } from 'three/addons/postprocessing/SSRPass.js'; + */ +export class SSRPass extends Pass { + /** + * Constructs a new SSR pass. + * + * @param {SSRPass~Options} options - The pass options. + */ + constructor({ renderer, scene, camera, width, height, selects, bouncing, groundReflector }: SSRPass); + /** + * The width of the effect. + * + * @type {number} + * @default 512 + */ + width: number; + /** + * The height of the effect. + * + * @type {number} + * @default 512 + */ + height: number; + /** + * The renderer. + * + * @type {WebGLRenderer} + */ + renderer: WebGLRenderer; + /** + * The scene to render. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * The ground reflector. + * + * @type {?ReflectorForSSRPass} + * @default 0 + */ + groundReflector: ReflectorForSSRPass | null; + /** + * The opacity. + * + * @type {number} + * @default 0.5 + */ + opacity: number; + /** + * The output configuration. + * + * @type {number} + * @default 0 + */ + output: number; + /** + * Controls how far a fragment can reflect. + * + * @type {number} + * @default 180 + */ + maxDistance: number; + /** + * Controls the cutoff between what counts as a + * possible reflection hit and what does not. + * + * @type {number} + * @default .018 + */ + thickness: number; + tempColor: Color; + _selects: any; + _resolutionScale: number; + /** + * Whether the pass is selective or not. + * + * @type {boolean} + * @default false + */ + selective: boolean; + _bouncing: any; + /** + * Whether to blur reflections or not. + * + * @type {boolean} + * @default true + */ + blur: boolean; + _distanceAttenuation: any; + _fresnel: any; + _infiniteThick: any; + beautyRenderTarget: WebGLRenderTarget; + prevRenderTarget: WebGLRenderTarget; + normalRenderTarget: WebGLRenderTarget; + metalnessRenderTarget: WebGLRenderTarget; + ssrRenderTarget: WebGLRenderTarget; + blurRenderTarget: import("three").RenderTarget; + blurRenderTarget2: import("three").RenderTarget; + ssrMaterial: ShaderMaterial; + normalMaterial: MeshNormalMaterial; + metalnessOnMaterial: MeshBasicMaterial; + metalnessOffMaterial: MeshBasicMaterial; + blurMaterial: ShaderMaterial; + blurMaterial2: ShaderMaterial; + depthRenderMaterial: ShaderMaterial; + copyMaterial: ShaderMaterial; + fsQuad: FullScreenQuad; + originalClearColor: Color; + set resolutionScale(value: number); + /** + * The resolution scale. Valid values are in the range + * `[0,1]`. `1` means best quality but also results in + * more computational overhead. Setting to `0.5` means + * the effect is computed in half-resolution. + * + * @type {number} + * @default 1 + */ + get resolutionScale(): number; + /** + * Performs the SSR pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; + _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; + _renderMetalness(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; +} +export namespace SSRPass { + namespace OUTPUT { + let Default: number; + let SSR: number; + let Beauty: number; + let Depth: number; + let Normal: number; + let Metalness: number; + } +} +import { Pass } from './Pass.js'; +import { Color } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { ShaderMaterial } from 'three'; +import { MeshNormalMaterial } from 'three'; +import { MeshBasicMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts new file mode 100644 index 000000000..658d5124e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts @@ -0,0 +1,62 @@ +/** + * A pass that saves the contents of the current read buffer in a render target. + * + * ```js + * const savePass = new SavePass( customRenderTarget ); + * composer.addPass( savePass ); + * ``` + * + * @augments Pass + * @three_import import { SavePass } from 'three/addons/postprocessing/SavePass.js'; + */ +export class SavePass extends Pass { + /** + * Constructs a new save pass. + * + * @param {WebGLRenderTarget} [renderTarget] - The render target for saving the read buffer. + * If not provided, the pass automatically creates a render target. + */ + constructor(renderTarget?: WebGLRenderTarget); + /** + * The pass uniforms. + * + * @type {Object} + */ + uniforms: Object; + /** + * The pass material. + * + * @type {ShaderMaterial} + */ + material: ShaderMaterial; + /** + * The render target which is used to save the read buffer. + * + * @type {WebGLRenderTarget} + */ + renderTarget: WebGLRenderTarget; + _fsQuad: FullScreenQuad; + /** + * Performs the save pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts new file mode 100644 index 000000000..f88751cd7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts @@ -0,0 +1,59 @@ +/** + * This pass can be used to create a post processing effect + * with a raw GLSL shader object. Useful for implementing custom + * effects. + * + * ```js + * const fxaaPass = new ShaderPass( FXAAShader ); + * composer.addPass( fxaaPass ); + * ``` + * + * @augments Pass + * @three_import import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; + */ +export class ShaderPass extends Pass { + /** + * Constructs a new shader pass. + * + * @param {Object|ShaderMaterial} [shader] - A shader object holding vertex and fragment shader as well as + * defines and uniforms. It's also valid to pass a custom shader material. + * @param {string} [textureID='tDiffuse'] - The name of the texture uniform that should sample + * the read buffer. + */ + constructor(shader?: Object | ShaderMaterial, textureID?: string); + /** + * The name of the texture uniform that should sample the read buffer. + * + * @type {string} + * @default 'tDiffuse' + */ + textureID: string; + /** + * The pass uniforms. + * + * @type {?Object} + */ + uniforms: Object | null; + /** + * The pass material. + * + * @type {?ShaderMaterial} + */ + material: ShaderMaterial | null; + _fsQuad: FullScreenQuad; + /** + * Performs the shader pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts new file mode 100644 index 000000000..c70de7eda --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts @@ -0,0 +1,59 @@ +/** + * + * Temporal Anti-Aliasing Render Pass. + * + * When there is no motion in the scene, the TAA render pass accumulates jittered camera + * samples across frames to create a high quality anti-aliased result. + * + * Note: This effect uses no reprojection so it is no TRAA implementation. + * + * ```js + * const taaRenderPass = new TAARenderPass( scene, camera ); + * taaRenderPass.unbiased = false; + * composer.addPass( taaRenderPass ); + * ``` + * + * @augments SSAARenderPass + * @three_import import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; + */ +export class TAARenderPass extends SSAARenderPass { + /** + * Constructs a new TAA render pass. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera. + * @param {?(number|Color|string)} [clearColor=0x000000] - The clear color of the render pass. + * @param {?number} [clearAlpha=0] - The clear alpha of the render pass. + */ + constructor(scene: Scene, camera: Camera, clearColor?: (number | Color | string) | null, clearAlpha?: number | null); + /** + * Whether to accumulate frames or not. This enables + * the TAA. + * + * @type {boolean} + * @default false + */ + accumulate: boolean; + /** + * The accumulation index. + * + * @type {number} + * @default -1 + */ + accumulateIndex: number; + _holdRenderTarget: WebGLRenderTarget | null; + /** + * Performs the TAA render pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number): void; +} +import { SSAARenderPass } from './SSAARenderPass.js'; +import { WebGLRenderTarget } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts new file mode 100644 index 000000000..77a24d54f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts @@ -0,0 +1,64 @@ +/** + * This pass can be used to render a texture over the entire screen. + * + * ```js + * const texture = new THREE.TextureLoader().load( 'textures/2294472375_24a3b8ef46_o.jpg' ); + * texture.colorSpace = THREE.SRGBColorSpace; + * + * const texturePass = new TexturePass( texture ); + * composer.addPass( texturePass ); + * ``` + * + * @augments Pass + * @three_import import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; + */ +export class TexturePass extends Pass { + /** + * Constructs a new texture pass. + * + * @param {Texture} map - The texture to render. + * @param {number} [opacity=1] - The opacity. + */ + constructor(map: Texture, opacity?: number); + /** + * The texture to render. + * + * @type {Texture} + */ + map: Texture; + /** + * The opacity. + * + * @type {number} + * @default 1 + */ + opacity: number; + /** + * The pass uniforms. + * + * @type {Object} + */ + uniforms: Object; + /** + * The pass material. + * + * @type {ShaderMaterial} + */ + material: ShaderMaterial; + _fsQuad: FullScreenQuad; + /** + * Performs the texture pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; +} +import { Pass } from './Pass.js'; +import { ShaderMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts new file mode 100644 index 000000000..e16437efd --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts @@ -0,0 +1,112 @@ +/** + * This pass is inspired by the bloom pass of Unreal Engine. It creates a + * mip map chain of bloom textures and blurs them with different radii. Because + * of the weighted combination of mips, and because larger blurs are done on + * higher mips, this effect provides good quality and performance. + * + * When using this pass, tone mapping must be enabled in the renderer settings. + * + * Reference: + * - [Bloom in Unreal Engine](https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/) + * + * ```js + * const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight ); + * const bloomPass = new UnrealBloomPass( resolution, 1.5, 0.4, 0.85 ); + * composer.addPass( bloomPass ); + * ``` + * + * @augments Pass + * @three_import import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; + */ +export class UnrealBloomPass extends Pass { + /** + * Constructs a new Unreal Bloom pass. + * + * @param {Vector2} [resolution] - The effect's resolution. + * @param {number} [strength=1] - The Bloom strength. + * @param {number} radius - The Bloom radius. + * @param {number} threshold - The luminance threshold limits which bright areas contribute to the Bloom effect. + */ + constructor(resolution?: Vector2, strength?: number, radius: number, threshold: number); + /** + * The Bloom strength. + * + * @type {number} + * @default 1 + */ + strength: number; + /** + * The Bloom radius. Must be in the range `[0,1]`. + * + * @type {number} + */ + radius: number; + /** + * The luminance threshold limits which bright areas contribute to the Bloom effect. + * + * @type {number} + */ + threshold: number; + /** + * The effect's resolution. + * + * @type {Vector2} + * @default (256,256) + */ + resolution: Vector2; + /** + * The effect's clear color + * + * @type {Color} + * @default (0,0,0) + */ + clearColor: Color; + renderTargetsHorizontal: WebGLRenderTarget[]; + renderTargetsVertical: WebGLRenderTarget[]; + nMips: number; + renderTargetBright: WebGLRenderTarget; + highPassUniforms: Object; + materialHighPassFilter: ShaderMaterial; + separableBlurMaterials: ShaderMaterial[]; + compositeMaterial: ShaderMaterial; + bloomTintColors: Vector3[]; + copyUniforms: Object; + blendMaterial: ShaderMaterial; + _oldClearColor: Color; + _oldClearAlpha: number; + _basic: MeshBasicMaterial; + _fsQuad: FullScreenQuad; + /** + * Sets the size of the pass. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * Performs the Bloom pass. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering + * destination for the pass. + * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the + * previous pass from this buffer. + * @param {number} deltaTime - The delta time in seconds. + * @param {boolean} maskActive - Whether masking is active or not. + */ + render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean): void; + _getSeparableBlurMaterial(kernelRadius: any): ShaderMaterial; + _getCompositeMaterial(nMips: any): ShaderMaterial; +} +export namespace UnrealBloomPass { + let BlurDirectionX: Vector2; + let BlurDirectionY: Vector2; +} +import { Pass } from './Pass.js'; +import { Vector2 } from 'three'; +import { Color } from 'three'; +import { WebGLRenderTarget } from 'three'; +import { ShaderMaterial } from 'three'; +import { Vector3 } from 'three'; +import { MeshBasicMaterial } from 'three'; +import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts new file mode 100644 index 000000000..73d34035e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts @@ -0,0 +1,117 @@ +/** + * ~Parameters + */ +export type CSS2DRenderer = { + /** + * - A DOM element where the renderer appends its child-elements. + * If not passed in here, a new div element will be created. + */ + element?: HTMLElement | undefined; +}; +/** + * The only type of 3D object that is supported by {@link CSS2DRenderer}. + * + * @augments Object3D + * @three_import import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; + */ +export class CSS2DObject extends Object3D { + /** + * Constructs a new CSS2D object. + * + * @param {HTMLElement} [element] - The DOM element. + */ + constructor(element?: HTMLElement); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCSS2DObject: boolean; + /** + * The DOM element which defines the appearance of this 3D object. + * + * @type {HTMLElement} + * @readonly + * @default true + */ + readonly element: HTMLElement; + /** + * The object's anchor point, and the point around which the object rotates. + * A value of `(0.5, 0.5)` corresponds to the midpoint of the object. A value + * of `(0, 0)` corresponds to the upper left corner of the object. + * + * @type {Vector2} + * @default (0.5,0.5) + */ + center: Vector2; + /** + * The object's angle of rotation, counterclockwise, in radians. + * + * @type {number} + * @default 0 + */ + rotation2D: number; + copy(source: any, recursive: any): this; +} +/** + * This renderer is a simplified version of {@link CSS3DRenderer}. The only transformations that + * are supported are translation and 2D rotation. + * + * The renderer is very useful if you want to combine HTML based labels with 3D objects. Here too, + * the respective DOM elements are wrapped into an instance of {@link CSS2DObject} and added to the + * scene graph. All other types of renderable 3D objects (like meshes or point clouds) are ignored. + * + * `CSS2DRenderer` only supports 100% browser and display zoom. + * + * @three_import import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js'; + */ +export class CSS2DRenderer { + /** + * Constructs a new CSS2D renderer. + * + * @param {CSS2DRenderer~Parameters} [parameters] - The parameters. + */ + constructor(parameters?: {}); + /** + * The DOM where the renderer appends its child-elements. + * + * @type {HTMLElement} + */ + domElement: HTMLElement; + /** + * Controls whether the renderer assigns `z-index` values to CSS2DObject DOM elements. + * If set to `true`, z-index values are assigned first based on the `renderOrder` + * and secondly - the distance to the camera. If set to `false`, no z-index values are assigned. + * + * @type {boolean} + * @default true + */ + sortObjects: boolean; + /** + * Returns an object containing the width and height of the renderer. + * + * @return {{width:number,height:number}} The size of the renderer. + */ + getSize: () => { + width: number; + height: number; + }; + /** + * Renders the given scene using the given camera. + * + * @param {Object3D} scene - A scene or any other type of 3D object. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * Resizes the renderer to the given width and height. + * + * @param {number} width - The width of the renderer. + * @param {number} height - The height of the renderer. + */ + setSize: (width: number, height: number) => void; +} +import { Object3D } from 'three'; +import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts new file mode 100644 index 000000000..0cf3ed245 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts @@ -0,0 +1,121 @@ +/** + * ~Parameters + */ +export type CSS3DRenderer = { + /** + * - A DOM element where the renderer appends its child-elements. + * If not passed in here, a new div element will be created. + */ + element?: HTMLElement | undefined; +}; +/** + * The base 3D object that is supported by {@link CSS3DRenderer}. + * + * @augments Object3D + * @three_import import { CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; + */ +export class CSS3DObject extends Object3D { + /** + * Constructs a new CSS3D object. + * + * @param {HTMLElement} [element] - The DOM element. + */ + constructor(element?: HTMLElement); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCSS3DObject: boolean; + /** + * The DOM element which defines the appearance of this 3D object. + * + * @type {HTMLElement} + * @readonly + * @default true + */ + readonly element: HTMLElement; + copy(source: any, recursive: any): this; +} +/** + * A specialized version of {@link CSS3DObject} that represents + * DOM elements as sprites. + * + * @augments CSS3DObject + * @three_import import { CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; + */ +export class CSS3DSprite extends CSS3DObject { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCSS3DSprite: boolean; + /** + * The sprite's rotation in radians. + * + * @type {number} + * @default 0 + */ + rotation2D: number; + copy(source: any, recursive: any): this; +} +/** + * This renderer can be used to apply hierarchical 3D transformations to DOM elements + * via the CSS3 [transform](https://www.w3schools.com/cssref/css3_pr_transform.asp) property. + * `CSS3DRenderer` is particularly interesting if you want to apply 3D effects to a website without + * canvas based rendering. It can also be used in order to combine DOM elements with WebGL content. + * + * There are, however, some important limitations: + * + * - It's not possible to use the material system of *three.js*. + * - It's also not possible to use geometries. + * - The renderer only supports 100% browser and display zoom. + * + * So `CSS3DRenderer` is just focused on ordinary DOM elements. These elements are wrapped into special + * 3D objects ({@link CSS3DObject} or {@link CSS3DSprite}) and then added to the scene graph. + * + * @three_import import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js'; + */ +export class CSS3DRenderer { + /** + * Constructs a new CSS3D renderer. + * + * @param {CSS3DRenderer~Parameters} [parameters] - The parameters. + */ + constructor(parameters?: {}); + /** + * The DOM where the renderer appends its child-elements. + * + * @type {HTMLElement} + */ + domElement: HTMLElement; + /** + * Returns an object containing the width and height of the renderer. + * + * @return {{width:number,height:number}} The size of the renderer. + */ + getSize: () => { + width: number; + height: number; + }; + /** + * Renders the given scene using the given camera. + * + * @param {Object3D} scene - A scene or any other type of 3D object. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * Resizes the renderer to the given width and height. + * + * @param {number} width - The width of the renderer. + * @param {number} height - The height of the renderer. + */ + setSize: (width: number, height: number) => void; +} +import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts new file mode 100644 index 000000000..32084b049 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts @@ -0,0 +1,75 @@ +export class RenderableObject { + id: number; + object: any; + z: number; + renderOrder: number; +} +export class RenderableFace { + id: number; + v1: RenderableVertex; + v2: RenderableVertex; + v3: RenderableVertex; + normalModel: Vector3; + vertexNormalsModel: Vector3[]; + vertexNormalsLength: number; + color: Color; + material: any; + uvs: Vector2[]; + z: number; + renderOrder: number; +} +export class RenderableVertex { + position: Vector3; + positionWorld: Vector3; + positionScreen: Vector4; + visible: boolean; + copy(vertex: any): void; +} +export class RenderableLine { + id: number; + v1: RenderableVertex; + v2: RenderableVertex; + vertexColors: Color[]; + material: any; + z: number; + renderOrder: number; +} +export class RenderableSprite { + id: number; + object: any; + x: number; + y: number; + z: number; + rotation: number; + scale: Vector2; + material: any; + renderOrder: number; +} +/** + * This class can project a given scene in 3D space into a 2D representation + * used for rendering with a 2D API. `Projector` is currently used by {@link SVGRenderer} + * and was previously used by the legacy `CanvasRenderer`. + * + * @three_import import { Projector } from 'three/addons/renderers/Projector.js'; + */ +export class Projector { + /** + * Projects the given scene in 3D space into a 2D representation. The result + * is an object with renderable items. + * + * @param {Object3D} scene - A scene or any other type of 3D object. + * @param {Camera} camera - The camera. + * @param {boolean} sortObjects - Whether to sort objects or not. + * @param {boolean} sortElements - Whether to sort elements (faces, lines and sprites) or not. + * @return {{objects:Array,lights:Array,elements:Array}} The projected scene as renderable objects. + */ + projectScene: (scene: Object3D, camera: Camera, sortObjects: boolean, sortElements: boolean) => { + objects: Array; + lights: Array; + elements: Array; + }; +} +import { Vector3 } from 'three'; +import { Color } from 'three'; +import { Vector2 } from 'three'; +import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts new file mode 100644 index 000000000..a9813dd1b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts @@ -0,0 +1,150 @@ +/** + * Can be used to wrap SVG elements into a 3D object. + * + * @augments Object3D + * @three_import import { SVGObject } from 'three/addons/renderers/SVGRenderer.js'; + */ +export class SVGObject extends Object3D { + /** + * Constructs a new SVG object. + * + * @param {SVGElement} node - The SVG element. + */ + constructor(node: SVGElement); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSVGObject: boolean; + /** + * This SVG element. + * + * @type {SVGElement} + */ + node: SVGElement; +} +/** + * This renderer an be used to render geometric data using SVG. The produced vector + * graphics are particular useful in the following use cases: + * + * - Animated logos or icons. + * - Interactive 2D/3D diagrams or graphs. + * - Interactive maps. + * - Complex or animated user interfaces. + * + * `SVGRenderer` has various advantages. It produces crystal-clear and sharp output which + * is independent of the actual viewport resolution.SVG elements can be styled via CSS. + * And they have good accessibility since it's possible to add metadata like title or description + * (useful for search engines or screen readers). + * + * There are, however, some important limitations: + * - No advanced shading. + * - No texture support. + * - No shadow support. + * + * @three_import import { SVGRenderer } from 'three/addons/renderers/SVGRenderer.js'; + */ +export class SVGRenderer { + /** + * The DOM where the renderer appends its child-elements. + * + * @type {SVGSVGElement} + */ + domElement: SVGSVGElement; + /** + * Whether to automatically perform a clear before a render call or not. + * + * @type {boolean} + * @default true + */ + autoClear: boolean; + /** + * Whether to sort 3D objects or not. + * + * @type {boolean} + * @default true + */ + sortObjects: boolean; + /** + * Whether to sort elements or not. + * + * @type {boolean} + * @default true + */ + sortElements: boolean; + /** + * Number of fractional pixels to enlarge polygons in order to + * prevent anti-aliasing gaps. Range is `[0,1]`. + * + * @type {number} + * @default 0.5 + */ + overdraw: number; + /** + * The output color space. + * + * @type {(SRGBColorSpace|LinearSRGBColorSpace)} + * @default SRGBColorSpace + */ + outputColorSpace: (string | LinearSRGBColorSpace); + /** + * Provides information about the number of + * rendered vertices and faces. + * + * @type {Object} + */ + info: Object; + /** + * Sets the render quality. Setting to `high` makes the browser improve SVG quality + * over rendering speed and geometric precision. + * + * @param {('low'|'high')} quality - The quality. + */ + setQuality: (quality: ("low" | "high")) => void; + /** + * Sets the clear color. + * + * @param {(number|Color|string)} color - The clear color to set. + */ + setClearColor: (color: (number | Color | string)) => void; + setPixelRatio: () => void; + /** + * Resizes the renderer to the given width and height. + * + * @param {number} width - The width of the renderer. + * @param {number} height - The height of the renderer. + */ + setSize: (width: number, height: number) => void; + /** + * Returns an object containing the width and height of the renderer. + * + * @return {{width:number,height:number}} The size of the renderer. + */ + getSize: () => { + width: number; + height: number; + }; + /** + * Sets the precision of the data used to create a paths. + * + * @param {number} precision - The precision to set. + */ + setPrecision: (precision: number) => void; + /** + * Performs a manual clear with the defined clear color. + */ + clear: () => void; + /** + * Renders the given scene using the given camera. + * + * @param {Object3D} scene - A scene or any other type of 3D object. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; +} +import { Object3D } from 'three'; +import { Color } from 'three'; +import { Camera } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts new file mode 100644 index 000000000..31079d7c7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts @@ -0,0 +1,15 @@ +/** + * @module ACESFilmicToneMappingShader + * @three_import import { ACESFilmicToneMappingShader } from 'three/addons/shaders/ACESFilmicToneMappingShader.js'; + */ +/** + * ACES Filmic Tone Mapping Shader by Stephen Hill. + * Reference: [ltc_blit.fs](https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs) + * + * This implementation of ACES is modified to accommodate a brighter viewing environment. + * The scale factor of 1/0.6 is subjective. See discussion in #19621. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const ACESFilmicToneMappingShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts new file mode 100644 index 000000000..440b592fa --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module AfterimageShader + * @three_import import { AfterimageShader } from 'three/addons/shaders/AfterimageShader.js'; + */ +/** + * Inspired by [Three.js FBO motion trails](https://codepen.io/brunoimbrizi/pen/MoRJaN?page=1&). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const AfterimageShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts new file mode 100644 index 000000000..18bfeb90b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module BasicShader + * @three_import import { BasicShader } from 'three/addons/shaders/BasicShader.js'; + */ +/** + * Simple shader for testing. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const BasicShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts new file mode 100644 index 000000000..a1ccf8066 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts @@ -0,0 +1,12 @@ +/** + * @module BleachBypassShader + * @three_import import { BleachBypassShader } from 'three/addons/shaders/BleachBypassShader.js'; + */ +/** + * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass] based on + * [Nvidia Shader library](http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const BleachBypassShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts new file mode 100644 index 000000000..e611c0440 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module BlendShader + * @three_import import { BlendShader } from 'three/addons/shaders/BlendShader.js'; + */ +/** + * Blends two textures. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const BlendShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts new file mode 100644 index 000000000..8f1a07d14 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts @@ -0,0 +1,12 @@ +/** + * @module BokehShader + * @three_import import { BokehShader } from 'three/addons/shaders/BokehShader.js'; + */ +/** + * Depth-of-field shader with bokeh ported from + * [GLSL shader by Martins Upitis](http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const BokehShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts new file mode 100644 index 000000000..ee60e93f0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts @@ -0,0 +1,28 @@ +/** + * @module BokehShader2 + * @three_import import { BokehShader, BokehDepthShader } from 'three/addons/shaders/BokehShader2.js'; + */ +/** + * Depth-of-field shader with bokeh ported from + * [GLSL shader by Martins Upitis](http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update)). + * + * Requires #define RINGS and SAMPLES integers + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const BokehShader: ShaderMaterial; +export namespace BokehDepthShader { + let name: string; + namespace uniforms { + namespace mNear { + let value: number; + } + namespace mFar { + let value_1: number; + export { value_1 as value }; + } + } + let vertexShader: string; + let fragmentShader: string; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts new file mode 100644 index 000000000..cab589f4b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module BrightnessContrastShader + * @three_import import { BrightnessContrastShader } from 'three/addons/shaders/BrightnessContrastShader.js'; + */ +/** + * Brightness and contrast adjustment {@link https://github.com/evanw/glfx.js}. + * Brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white) + * Contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const BrightnessContrastShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts new file mode 100644 index 000000000..1172081b2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module ColorCorrectionShader + * @three_import import { ColorCorrectionShader } from 'three/addons/shaders/ColorCorrectionShader.js'; + */ +/** + * Color correction shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const ColorCorrectionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts new file mode 100644 index 000000000..ad6864f45 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module ColorifyShader + * @three_import import { ColorifyShader } from 'three/addons/shaders/ColorifyShader.js'; + */ +/** + * Colorify shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const ColorifyShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts new file mode 100644 index 000000000..f272adf10 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module ConvolutionShader + * @three_import import { ConvolutionShader } from 'three/addons/shaders/ConvolutionShader.js'; + */ +/** + * Convolution shader ported from o3d sample to WebGL / GLSL. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const ConvolutionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts new file mode 100644 index 000000000..9afca73ca --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module CopyShader + * @three_import import { CopyShader } from 'three/addons/shaders/CopyShader.js'; + */ +/** + * Full-screen copy shader pass. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const CopyShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts new file mode 100644 index 000000000..be1d0dc76 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module DOFMipMapShader + * @three_import import { DOFMipMapShader } from 'three/addons/shaders/DOFMipMapShader.js'; + */ +/** + * Depth-of-field shader using mipmaps from Matt Handley @applmak. + * + * Requires power-of-2 sized render target with enabled mipmaps. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const DOFMipMapShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts new file mode 100644 index 000000000..7d7e8b717 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts @@ -0,0 +1,21 @@ +/** + * @module DepthLimitedBlurShader + * @three_import import { DepthLimitedBlurShader, BlurShaderUtils } from 'three/addons/shaders/DepthLimitedBlurShader.js'; + */ +/** + * A separable Gaussian blur shader that limits blurring across depth + * discontinuities, stopping when the view-space depth difference to a + * neighboring sample exceeds `depthCutoff`. This preserves edges and + * avoids bleeding across them. + * + * Used by {@link SAOPass}. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const DepthLimitedBlurShader: ShaderMaterial; +export namespace BlurShaderUtils { + function createSampleWeights(kernelRadius: any, stdDev: any): number[]; + function createSampleOffsets(kernelRadius: any, uvIncrement: any): any[]; + function configure(material: any, kernelRadius: any, stdDev: any, uvIncrement: any): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts new file mode 100644 index 000000000..2e3ea3fc5 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts @@ -0,0 +1,11 @@ +/** + * @module DigitalGlitch + * @three_import import { DigitalGlitch } from 'three/addons/shaders/DigitalGlitch.js'; + */ +/** + * Digital glitch shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const DigitalGlitch: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts new file mode 100644 index 000000000..1b7a05f1b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module DotScreenShader + * @three_import import { DotScreenShader } from 'three/addons/shaders/DotScreenShader.js'; + */ +/** + * Dot screen shader based on [glfx.js sepia shader](https://github.com/evanw/glfx.js). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const DotScreenShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts new file mode 100644 index 000000000..72e9b2951 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module ExposureShader + * @three_import import { ExposureShader } from 'three/addons/shaders/ExposureShader.js'; + */ +/** + * Exposure shader that scales the image color by an exposure factor. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const ExposureShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts new file mode 100644 index 000000000..069ce39da --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts @@ -0,0 +1,15 @@ +/** + * @module FXAAShader + * @three_import import { FXAAShader } from 'three/addons/shaders/FXAAShader.js'; + */ +/** + * FXAA algorithm from NVIDIA, C# implementation by Jasper Flick, GLSL port by Dave Hoskins. + * + * References: + * - {@link http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf}. + * - {@link https://catlikecoding.com/unity/tutorials/advanced-rendering/fxaa/}. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const FXAAShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts new file mode 100644 index 000000000..57764b36b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts @@ -0,0 +1,14 @@ +/** + * @module FilmShader + * @three_import import { FilmShader } from 'three/addons/shaders/FilmShader.js'; + */ +/** + * Film grain shader that adds animated noise to the image, with an optional + * grayscale conversion. + * + * Used by {@link FilmPass}. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const FilmShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts new file mode 100644 index 000000000..350ddb21f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module FocusShader + * @three_import import { FocusShader } from 'three/addons/shaders/FocusShader.js'; + */ +/** + * Focus shader based on [PaintEffect postprocess from ro.me](http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const FocusShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts new file mode 100644 index 000000000..90085fb50 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts @@ -0,0 +1,14 @@ +/** + * @module FreiChenShader + * @three_import import { FreiChenShader } from 'three/addons/shaders/FreiChenShader.js'; + */ +/** + * Edge Detection Shader using Frei-Chen filter. + * Based on {@link http://rastergrid.com/blog/2011/01/frei-chen-edge-detector}. + * + * aspect: vec2 of (1/width, 1/height) + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const FreiChenShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts new file mode 100644 index 000000000..ffb41db2f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts @@ -0,0 +1,31 @@ +export function generateMagicSquareNoise(size?: number): DataTexture; +/** + * @module GTAOShader + * @three_import import { GTAOShader } from 'three/addons/shaders/GTAOShader.js'; + */ +/** + * GTAO shader. Use by {@link GTAOPass}. + * + * References: + * - [Practical Realtime Strategies for Accurate Indirect Occlusion](https://iryoku.com/downloads/Practical-Realtime-Strategies-for-Accurate-Indirect-Occlusion.pdf). + * - [Horizon-Based Indirect Lighting (HBIL)](https://github.com/Patapom/GodComplex/blob/master/Tests/TestHBIL/2018%20Mayaux%20-%20Horizon-Based%20Indirect%20Lighting%20(HBIL).pdf) + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const GTAOShader: ShaderMaterial; +/** + * GTAO depth shader. Use by {@link GTAOPass}. + * + * @constant + * @type {Object} + */ +export const GTAODepthShader: Object; +/** + * GTAO blend shader. Use by {@link GTAOPass}. + * + * @constant + * @type {Object} + */ +export const GTAOBlendShader: Object; +import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts new file mode 100644 index 000000000..283eb77b0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts @@ -0,0 +1,14 @@ +/** + * @module GammaCorrectionShader + * @three_import import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js'; + */ +/** + * Gamma Correction Shader + * + * References: + * - {@link http://en.wikipedia.org/wiki/gamma_correction}. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const GammaCorrectionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts new file mode 100644 index 000000000..2114cfc0f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts @@ -0,0 +1,16 @@ +/** + * @module HalftoneShader + * @three_import import { HalftoneShader } from 'three/addons/shaders/HalftoneShader.js'; + */ +/** + * RGB Halftone shader. + * + * Used by {@link HalftonePass}. + * + * Shape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square, 5 = Diamond) + * Blending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker) + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const HalftoneShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts new file mode 100644 index 000000000..28377f8a9 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts @@ -0,0 +1,18 @@ +/** + * @module HorizontalBlurShader + * @three_import import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; + */ +/** + * Two pass Gaussian blur filter (horizontal and vertical blur shaders). + * + * References: + * - {@link http://www.cake23.de/traveling-wavefronts-lit-up.html}. + * + * - 9 samples per pass + * - standard deviation 2.7 + * - "h" and "v" parameters should be set to "1 / width" and "1 / height" + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const HorizontalBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts new file mode 100644 index 000000000..f50eb117e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts @@ -0,0 +1,16 @@ +/** + * @module HorizontalTiltShiftShader + * @three_import import { HorizontalTiltShiftShader } from 'three/addons/shaders/HorizontalTiltShiftShader.js'; + */ +/** + * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position. + * + * - 9 samples per pass + * - standard deviation 2.7 + * - "h" and "v" parameters should be set to "1 / width" and "1 / height" + * - "r" parameter control where "focused" horizontal line lies + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const HorizontalTiltShiftShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts new file mode 100644 index 000000000..7447091f8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts @@ -0,0 +1,14 @@ +/** + * @module HueSaturationShader + * @three_import import { HueSaturationShader } from 'three/addons/shaders/HueSaturationShader.js'; + */ +/** + * Hue and saturation adjustment, {@link https://github.com/evanw/glfx.js}. + * + * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc. + * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const HueSaturationShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts new file mode 100644 index 000000000..15e4c2f5d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts @@ -0,0 +1,17 @@ +/** + * @module KaleidoShader + * @three_import import { KaleidoShader } from 'three/addons/shaders/KaleidoShader.js'; + */ +/** + * Kaleidoscope Shader. + * Radial reflection around center point + * Ported from: {@link http://pixelshaders.com/editor/} + * by [Toby Schachman](http://tobyschachman.com/) + * + * sides: number of reflections + * angle: initial angle in radians + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const KaleidoShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts new file mode 100644 index 000000000..921107772 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module LuminosityHighPassShader + * @three_import import { LuminosityHighPassShader } from 'three/addons/shaders/LuminosityHighPassShader.js'; + */ +/** + * Luminosity high pass shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const LuminosityHighPassShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts new file mode 100644 index 000000000..846896a76 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module LuminosityShader + * @three_import import { LuminosityShader } from 'three/addons/shaders/LuminosityShader.js'; + */ +/** + * Luminosity shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const LuminosityShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts new file mode 100644 index 000000000..418c2ee5b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module MirrorShader + * @three_import import { MirrorShader } from 'three/addons/shaders/MirrorShader.js'; + */ +/** + * Copies half the input to the other half. + * + * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const MirrorShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts new file mode 100644 index 000000000..8a3269372 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts @@ -0,0 +1,10 @@ +/** + * @module NormalMapShader + * @three_import import { NormalMapShader } from 'three/addons/shaders/NormalMapShader.js'; + */ +/** + * Normal map shader, compute normals from heightmap. + * @constant + * @type {ShaderMaterial~Shader} + */ +export const NormalMapShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts new file mode 100644 index 000000000..92a0cb17a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts @@ -0,0 +1,14 @@ +/** + * @module OutputShader + * @three_import import { OutputShader } from 'three/addons/shaders/OutputShader.js'; + */ +/** + * Performs tone mapping and color space conversion for + * FX workflows. + * + * Used by {@link OutputPass}. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const OutputShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts new file mode 100644 index 000000000..096d7a99f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts @@ -0,0 +1,16 @@ +export function generatePdSamplePointInitializer(samples: any, rings: any, radiusExponent: any): string; +/** + * @module PoissonDenoiseShader + * @three_import import { PoissonDenoiseShader } from 'three/addons/shaders/PoissonDenoiseShader.js'; + */ +/** + * Poisson Denoise Shader. + * + * References: + * - [Self-Supervised Poisson-Gaussian Denoising](https://openaccess.thecvf.com/content/WACV2021/papers/Khademi_Self-Supervised_Poisson-Gaussian_Denoising_WACV_2021_paper.pdf). + * - [Poisson2Sparse: Self-Supervised Poisson Denoising From a Single Image](https://arxiv.org/pdf/2206.01856.pdf) + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const PoissonDenoiseShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts new file mode 100644 index 000000000..18ef03581 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts @@ -0,0 +1,17 @@ +/** + * @module RGBShiftShader + * @three_import import { RGBShiftShader } from 'three/addons/shaders/RGBShiftShader.js'; + */ +/** + * RGB Shift Shader + * Shifts red and blue channels from center in opposite directions + * Ported from https://web.archive.org/web/20090820185047/http://kriss.cx/tom/2009/05/rgb-shift/ + * by Tom Butterworth / https://web.archive.org/web/20090810054752/http://kriss.cx/tom/ + * + * amount: shift distance (1 is width of input) + * angle: shift angle in radians + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const RGBShiftShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts new file mode 100644 index 000000000..b6bcb6d30 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module SAOShader + * @three_import import { SAOShader } from 'three/addons/shaders/SAOShader.js'; + */ +/** + * SAO shader. + * + * Used by {@link SAOPass}. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SAOShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts new file mode 100644 index 000000000..62c115472 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts @@ -0,0 +1,31 @@ +/** + * WebGL port of Subpixel Morphological Antialiasing (SMAA) v2.8 + * Preset: SMAA 1x Medium (with color edge detection) + * + * References: + * - {@link https://github.com/iryoku/smaa/releases/tag/v2.8} + * + * @module SMAAShader + * @three_import import { SMAAShader } from 'three/addons/shaders/SMAAShader.js'; + */ +/** + * SMAA Edges shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SMAAEdgesShader: ShaderMaterial; +/** + * SMAA Weights shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SMAAWeightsShader: ShaderMaterial; +/** + * SMAA Blend shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SMAABlendShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts new file mode 100644 index 000000000..eeb9afa46 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts @@ -0,0 +1,30 @@ +/** + * @module SSAOShader + * @three_import import { SSAOShader } from 'three/addons/shaders/SSAOShader.js'; + */ +/** + * SSAO shader. + * + * References: + * - {@link http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html} + * - {@link https://learnopengl.com/Advanced-Lighting/SSAO} + * - {@link https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl} + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SSAOShader: ShaderMaterial; +/** + * SSAO depth shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SSAODepthShader: ShaderMaterial; +/** + * SSAO blur shader. + * + * @constant + * @type {Object} + */ +export const SSAOBlurShader: Object; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts new file mode 100644 index 000000000..6bb69e4d6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts @@ -0,0 +1,30 @@ +/** + * A collection of shaders used for SSR. + * + * References: + * - [3D Game Shaders For Beginners, Screen Space Reflection (SSR)](https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html). + * + * @module SSRShader + * @three_import import * as SSRShader from 'three/addons/shaders/SSRShader.js'; + */ +/** + * SSR shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SSRShader: ShaderMaterial; +/** + * SSR Depth shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SSRDepthShader: ShaderMaterial; +/** + * SSR Blur shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SSRBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts new file mode 100644 index 000000000..28750538f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module SepiaShader + * @three_import import { SepiaShader } from 'three/addons/shaders/SepiaShader.js'; + */ +/** + * Sepia tone shader based on [glfx.js sepia shader](https://github.com/evanw/glfx.js). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SepiaShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts new file mode 100644 index 000000000..6eba3a4ca --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module SobelOperatorShader + * @three_import import { SobelOperatorShader } from 'three/addons/shaders/SobelOperatorShader.js'; + */ +/** + * Sobel Edge Detection (see {@link https://youtu.be/uihBwtPIBxM}). + * + * As mentioned in the video the Sobel operator expects a grayscale image as input. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SobelOperatorShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts new file mode 100644 index 000000000..b9f7b54f7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module SubsurfaceScatteringShader + * @three_import import { SubsurfaceScatteringShader } from 'three/addons/shaders/SubsurfaceScatteringShader.js'; + */ +/** + * Subsurface Scattering shader. + * + * Based on GDC 2011 – [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const SubsurfaceScatteringShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts new file mode 100644 index 000000000..5b94f59de --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module TriangleBlurShader + * @three_import import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; + */ +/** + * Simulates the look of the two-strip technicolor process popular in early 20th century films. + * More historical info here: {@link http://www.widescreenmuseum.com/oldcolor/technicolor1.htm} + * Demo here: {@link http://charliehoey.com/technicolor_shader/shader_test.html} + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const TechnicolorShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts new file mode 100644 index 000000000..27e8ccfa4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts @@ -0,0 +1,34 @@ +/** + * Collection of toon shaders. + * + * @module TriangleBlurShader + * @three_import import * as ToonShader from 'three/addons/shaders/ToonShader.js'; + */ +/** + * Toon1 shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const ToonShader1: ShaderMaterial; +/** + * Toon2 shader. + * + * @constant + * @type {Object} + */ +export const ToonShader2: Object; +/** + * Toon Hatching shader. + * + * @constant + * @type {Object} + */ +export const ToonShaderHatching: Object; +/** + * Toon Dotted shader. + * + * @constant + * @type {Object} + */ +export const ToonShaderDotted: Object; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts new file mode 100644 index 000000000..ead206593 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts @@ -0,0 +1,15 @@ +/** + * @module TriangleBlurShader + * @three_import import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; + */ +/** + * Triangle blur shader based on [glfx.js triangle blur shader](https://github.com/evanw/glfx.js). + * + * A basic blur filter, which convolves the image with a + * pyramid filter. The pyramid filter is separable and is applied as two + * perpendicular triangle filters. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const TriangleBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts new file mode 100644 index 000000000..f351e2dd6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module UnpackDepthRGBAShader + * @three_import import { UnpackDepthRGBAShader } from 'three/addons/shaders/UnpackDepthRGBAShader.js'; + */ +/** + * Depth visualization shader that shows depth values as monochrome color. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const UnpackDepthRGBAShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts new file mode 100644 index 000000000..db4b5800b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module VelocityShader + * @three_import import { VelocityShader } from 'three/addons/shaders/VelocityShader.js'; + */ +/** + * Mesh velocity shader by @bhouston. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const VelocityShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts new file mode 100644 index 000000000..ff448f282 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts @@ -0,0 +1,16 @@ +/** + * @module VerticalBlurShader + * @three_import import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; + */ +/** + * Two pass Gaussian blur filter (horizontal and vertical blur shaders) + * - see {@link http://www.cake23.de/traveling-wavefronts-lit-up.html} + * + * - 9 samples per pass + * - standard deviation 2.7 + * - "h" and "v" parameters should be set to "1 / width" and "1 / height" + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const VerticalBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts new file mode 100644 index 000000000..341f5b80c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts @@ -0,0 +1,16 @@ +/** + * @module VerticalTiltShiftShader + * @three_import import { VerticalTiltShiftShader } from 'three/addons/shaders/VerticalTiltShiftShader.js'; + */ +/** + * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position + * + * - 9 samples per pass + * - standard deviation 2.7 + * - "h" and "v" parameters should be set to "1 / width" and "1 / height" + * - "r" parameter control where "focused" horizontal line lies + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const VerticalTiltShiftShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts new file mode 100644 index 000000000..9461b9018 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module VignetteShader + * @three_import import { VignetteShader } from 'three/addons/shaders/VignetteShader.js'; + */ +/** + * Based on [PaintEffect postprocess from ro.me](https://github.com/dataarts/3-dreams-of-black/blob/master/deploy/js/effects/PaintEffect.js). + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const VignetteShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts new file mode 100644 index 000000000..04bbdc80d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts @@ -0,0 +1,13 @@ +/** + * @module VolumeShader + * @three_import import { VolumeRenderShader1 } from 'three/addons/shaders/VolumeShader.js'; + */ +/** + * Shaders to render 3D volumes using raycasting. + * The applied techniques are based on similar implementations in the Visvis and Vispy projects. + * This is not the only approach, therefore it's marked 1. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const VolumeRenderShader1: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts new file mode 100644 index 000000000..5b5c7ff3a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts @@ -0,0 +1,11 @@ +/** + * @module WaterRefractionShader + * @three_import import { WaterRefractionShader } from 'three/addons/shaders/WaterRefractionShader.js'; + */ +/** + * Basic water refraction shader. + * + * @constant + * @type {ShaderMaterial~Shader} + */ +export const WaterRefractionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts b/jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts new file mode 100644 index 000000000..40226d8e3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts @@ -0,0 +1,17 @@ +/** + * Utility class for generating a flakes texture image. This image might be used + * as a normal map to produce a car paint like effect. + * + * @three_import import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; + */ +export class FlakesTexture { + /** + * Generates a new flakes texture image. The result is a canvas + * that can be used as an input for {@link CanvasTexture}. + * + * @param {number} [width=512] - The width of the image. + * @param {number} [height=512] - The height of the image. + * @return {HTMLCanvasElement} The generated image. + */ + constructor(width?: number, height?: number); +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts new file mode 100644 index 000000000..59d646aaf --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts @@ -0,0 +1,191 @@ +export class ASTNode { + isASTNode: boolean; + linker: { + reference: null; + accesses: never[]; + assignments: never[]; + }; + parent: any; + get isNumericExpression(): boolean; + get hasAssignment(): any; + getType(): any; + getProgram(): this | null; + getParent(parents?: any[]): any; + initialize(): void; +} +export class Comment extends ASTNode { + constructor(comment: any); + comment: any; + isComment: boolean; +} +export class Program extends ASTNode { + constructor(body?: any[]); + body: any[]; + structTypes: Map; + isProgram: boolean; +} +export class VariableDeclaration extends ASTNode { + constructor(type: any, name: any, value?: null, next?: null, immutable?: boolean); + type: any; + name: any; + value: any; + next: any; + immutable: boolean; + isVariableDeclaration: boolean; + get isAssignment(): boolean; +} +export class Uniform extends ASTNode { + constructor(type: any, name: any); + type: any; + name: any; + isUniform: boolean; +} +export class Varying extends ASTNode { + constructor(type: any, name: any); + type: any; + name: any; + isVarying: boolean; +} +export class FunctionParameter extends ASTNode { + constructor(type: any, name: any, qualifier?: null, immutable?: boolean); + type: any; + name: any; + qualifier: any; + immutable: boolean; + isFunctionParameter: boolean; +} +export class FunctionDeclaration extends ASTNode { + constructor(type: any, name: any, params?: any[], body?: any[]); + type: any; + name: any; + params: any[]; + body: any[]; + isFunctionDeclaration: boolean; +} +export class Expression extends ASTNode { + constructor(expression: any); + expression: any; + isExpression: boolean; +} +export class Ternary extends ASTNode { + constructor(cond: any, left: any, right: any); + cond: any; + left: any; + right: any; + isTernary: boolean; +} +export class Operator extends ASTNode { + constructor(type: any, left: any, right: any); + type: any; + left: any; + right: any; + isOperator: boolean; + get isAssignment(): boolean; +} +export class Unary extends ASTNode { + constructor(type: any, expression: any, after?: boolean); + type: any; + expression: any; + after: boolean; + isUnary: boolean; + get isAssignment(): boolean; +} +export class Number extends ASTNode { + constructor(value: any, type?: string); + type: string; + value: any; + isNumber: boolean; +} +export class String extends ASTNode { + constructor(value: any); + value: any; + isString: boolean; +} +export class Conditional extends ASTNode { + constructor(cond?: null, body?: any[]); + cond: any; + body: any[]; + elseConditional: any; + isConditional: boolean; +} +export class FunctionCall extends ASTNode { + constructor(name: any, params?: any[]); + name: any; + params: any[]; + isFunctionCall: boolean; +} +export class Return extends ASTNode { + constructor(value: any); + value: any; + isReturn: boolean; +} +export class Discard extends ASTNode { + isDiscard: boolean; +} +export class Continue extends ASTNode { + isContinue: boolean; +} +export class Break extends ASTNode { + isBreak: boolean; +} +export class Accessor extends ASTNode { + constructor(property: any); + property: any; + isAccessor: boolean; +} +export class StaticElement extends ASTNode { + constructor(value: any); + value: any; + isStaticElement: boolean; +} +export class DynamicElement extends ASTNode { + constructor(value: any); + value: any; + isDynamicElement: boolean; +} +export class AccessorElements extends ASTNode { + constructor(object: any, elements?: any[]); + object: any; + elements: any[]; + isAccessorElements: boolean; +} +export class For extends ASTNode { + constructor(initialization: any, condition: any, afterthought: any, body?: any[]); + initialization: any; + condition: any; + afterthought: any; + body: any[]; + isFor: boolean; +} +export class While extends ASTNode { + constructor(condition: any, body?: any[], doWhile?: boolean); + condition: any; + body: any[]; + doWhile: boolean; + isWhile: boolean; +} +export class Switch extends ASTNode { + constructor(discriminant: any, cases: any); + discriminant: any; + cases: any; + isSwitch: boolean; +} +export class SwitchCase extends ASTNode { + constructor(body: any, conditions?: null); + body: any; + conditions: any; + isDefault: boolean; + isSwitchCase: boolean; +} +export class StructMember { + constructor(type: any, name: any); + type: any; + name: any; + isStructMember: boolean; +} +export class StructDefinition extends ASTNode { + constructor(name: any, members?: any[]); + name: any; + members: any[]; + isStructDefinition: boolean; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts new file mode 100644 index 000000000..b347373ec --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts @@ -0,0 +1,76 @@ +export default GLSLDecoder; +declare class GLSLDecoder { + index: number; + tokenizer: Tokenizer | null; + keywords: any[]; + structTypes: Map; + addPolyfill(name: any, polyfill: any): this; + get tokens(): any[]; + readToken(): any; + getTokenPosition(token: any): string; + getToken(offset?: number): any; + getTokensUntil(str: any, tokens: any, offset?: number): any[]; + readTokensUntil(str: any): any[]; + parseExpressionFromTokens(tokens: any): any; + parseAccessorElementsFromTokens(tokens: any): any; + parseFunctionParametersFromTokens(tokens: any): any; + parseExpression(): any; + parseFunctionParams(tokens: any): FunctionParameter[]; + parseFunction(): any; + parseVariablesFromToken(tokens: any, type: any): any; + parseVariables(): any; + parseUniform(): Uniform; + parseVarying(): Varying; + parseStructDefinition(): StructDefinition; + parseReturn(): Return; + parseWhile(): any; + parseDoWhile(): any; + parseFor(): any; + parseSwitch(): any; + parseSwitchCases(): any; + parseIf(): any; + parseBlock(): any; + evaluateCondition(expr: any, macros: any): boolean; + extractMacroArgs(str: any): string[]; + expandMacros(line: any, macros: any): any; + preprocess(source: any): string; + parse(source: any): Program; +} +declare class Tokenizer { + constructor(source: any); + source: any; + position: number; + tokens: any[]; + tokenize(): this; + skip(...params: any[]): any; + nextToken(): Token | undefined; + readToken(): Token | undefined; +} +import { FunctionParameter } from './AST.js'; +import { Uniform } from './AST.js'; +import { Varying } from './AST.js'; +import { StructDefinition } from './AST.js'; +import { Return } from './AST.js'; +import { Program } from './AST.js'; +declare class Token { + constructor(tokenizer: any, type: any, str: any, pos: any); + tokenizer: any; + type: any; + str: any; + pos: any; + isTag: boolean; + tags: any; + get endPos(): any; + get isNumber(): boolean; + get isString(): boolean; + get isLiteral(): boolean; + get isOperator(): boolean; +} +declare namespace Token { + let LINE: string; + let COMMENT: string; + let NUMBER: string; + let STRING: string; + let LITERAL: string; + let OPERATOR: string; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts new file mode 100644 index 000000000..41d776add --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts @@ -0,0 +1,17 @@ +export default Linker; +declare class Linker { + block: any; + addBlock(node: any): void; + removeBlock(node: any): void; + processVariables(node: any): void; + processUniform(node: any): void; + processVarying(node: any): void; + evalProperty(node: any): string; + processExpression(node: any): void; + processBody(body: any): void; + processConditional(node: any): void; + processForWhile(node: any): void; + processSwitch(switchNode: any): void; + processFunction(node: any): void; + process(ast: any): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts new file mode 100644 index 000000000..e38bd27ca --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts @@ -0,0 +1,4 @@ +export default ShaderToyDecoder; +declare class ShaderToyDecoder extends GLSLDecoder { +} +import GLSLDecoder from './GLSLDecoder.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts new file mode 100644 index 000000000..0bf5232f6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts @@ -0,0 +1,31 @@ +export default TSLEncoder; +declare class TSLEncoder { + tab: string; + imports: Set; + global: Set; + overloadings: Map; + iife: boolean; + reference: boolean; + block: any; + addImport(name: any): void; + emitUniform(node: any): string; + emitExpression(node: any, output?: null): any; + emitBody(body: any): string; + emitTernary(node: any): string; + emitConditional(node: any): any; + isVariableUsed(node: any, varName: any): boolean; + emitLoop(node: any): any; + emitSwitch(switchNode: any): any; + emitFor(node: any): any; + emitForWhile(node: any): any; + emitDoWhile(node: any): any; + emitWhile(node: any): any; + emitVariables(node: any, isRoot?: boolean): string; + emitVarying(node: any): string; + emitStructDefinition(node: any): string; + emitOverloadingFunction(nodes: any): string; + emitFunction(node: any): string; + emitComment(statement: any, body: any): string; + emitExtraLine(statement: any, body: any): "" | "\n"; + emit(ast: any): string; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts new file mode 100644 index 000000000..ff77458cb --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts @@ -0,0 +1,48 @@ +export default Transpiler; +/** + * A class that transpiles shader code from one language into another. + * + * `Transpiler` can only be used to convert GLSL into TSL right now. It is intended + * to support developers when they want to migrate their custom materials from the + * current to the new node-based material system. + * + * @three_import import Transpiler from 'three/addons/transpiler/Transpiler.js'; + */ +declare class Transpiler { + /** + * Constructs a new transpiler. + * + * @param {GLSLDecoder} decoder - The GLSL decoder. + * @param {TSLEncoder} encoder - The TSL encoder. + */ + constructor(decoder: GLSLDecoder, encoder: TSLEncoder); + /** + * The GLSL decoder. This component parse GLSL and produces + * a language-independent AST for further processing. + * + * @type {GLSLDecoder} + */ + decoder: GLSLDecoder; + /** + * The TSL encoder. It takes the AST and emits TSL code. + * + * @type {TSLEncoder} + */ + encoder: TSLEncoder; + /** + * The linker. It processes the AST and resolves + * variable and function references, ensuring that all + * dependencies are properly linked. + * + * @type {Linker} + */ + linker: Linker; + /** + * Parses the given GLSL source and returns TSL syntax. + * + * @param {string} source - The GLSL source. + * @return {string} The TSL code. + */ + parse(source: string): string; +} +import Linker from './Linker.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts new file mode 100644 index 000000000..ec88472ef --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts @@ -0,0 +1,4 @@ +export function isExpression(st: any): boolean; +export function isPrimitive(value: any): boolean; +export function isBuiltinType(str: any): boolean; +export function toFloatType(type: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts new file mode 100644 index 000000000..2e43a1d74 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts @@ -0,0 +1,24 @@ +export default WGSLEncoder; +declare class WGSLEncoder { + tab: string; + functions: Map; + uniforms: any[]; + varyings: any[]; + structs: Map; + polyfills: Map; + groupIndex: number; + getWgslType(type: any): any; + emitExpression(node: any): any; + emitTextureAccess(node: any): any; + emitBody(body: any): string; + emitConditional(node: any): any; + emitFor(node: any): string; + emitWhile(node: any): any; + emitSwitch(node: any): any; + emitVariables(node: any): string; + emitStructDefinition(node: any): string; + emitFunction(node: any): string; + emitComment(statement: any, body: any): string; + emitExtraLine(statement: any, body: any): "" | "\n"; + emit(ast: any): string; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts new file mode 100644 index 000000000..755c8d91e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts @@ -0,0 +1,93 @@ +export function afterImage(node: Node, damp?: (Node | number)): AfterImageNode; +export default AfterImageNode; +/** + * Post processing node for creating an after image effect. + * + * @augments TempNode + * @three_import import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; + */ +declare class AfterImageNode extends TempNode { + /** + * Constructs a new after image node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {Node} [damp=0.96] - The damping intensity. A higher value means a stronger after image effect. + */ + constructor(textureNode: TextureNode, damp?: Node); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * How quickly the after-image fades. A higher value means the after-image + * persists longer, while a lower value means it fades faster. Should be in + * the range `[0, 1]`. + * + * @type {Node} + */ + damp: Node; + /** + * The render target used for compositing the effect. + * + * @private + * @type {RenderTarget} + */ + private _compRT; + /** + * The render target that represents the previous frame. + * + * @private + * @type {RenderTarget} + */ + private _oldRT; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * The texture represents the pervious frame. + * + * @private + * @type {TextureNode} + */ + private _textureNodeOld; + /** + * The material for the composite pass. + * + * @private + * @type {?NodeMaterial} + */ + private _materialComposed; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts new file mode 100644 index 000000000..bb4019473 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts @@ -0,0 +1,135 @@ +export default AnaglyphPassNode; +export function anaglyphPass(scene: Scene, camera: Camera): AnaglyphPassNode; +/** + * A render pass node that creates an anaglyph effect using physically-correct + * off-axis stereo projection. + * + * This implementation uses CameraUtils.frameCorners() to align stereo + * camera frustums to a virtual screen plane, providing accurate depth + * perception with zero parallax at the plane distance. + * + * @augments StereoCompositePassNode + * @three_import import { anaglyphPass, AnaglyphAlgorithm, AnaglyphColorMode } from 'three/addons/tsl/display/AnaglyphPassNode.js'; + */ +declare class AnaglyphPassNode extends StereoCompositePassNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAnaglyphPassNode: boolean; + /** + * The interpupillary distance (eye separation) in world units. + * Typical human IPD is 0.064 meters (64mm). + * + * @type {number} + * @default 0.064 + */ + eyeSep: number; + /** + * The distance in world units from the viewer to the virtual + * screen plane where zero parallax (screen depth) occurs. + * Objects at this distance appear at the screen surface. + * Objects closer appear in front of the screen (negative parallax). + * Objects further appear behind the screen (positive parallax). + * + * The screen dimensions are derived from the camera's FOV and aspect ratio + * at this distance, ensuring the stereo view matches the camera's field of view. + * + * @type {number} + * @default 0.5 + */ + planeDistance: number; + /** + * The current anaglyph algorithm. + * + * @private + * @type {string} + * @default 'dubois' + */ + private _algorithm; + /** + * The current color mode. + * + * @private + * @type {string} + * @default 'redCyan' + */ + private _colorMode; + /** + * Color matrix node for the left eye. + * + * @private + * @type {UniformNode} + */ + private _colorMatrixLeft; + /** + * Color matrix node for the right eye. + * + * @private + * @type {UniformNode} + */ + private _colorMatrixRight; + /** + * Sets the anaglyph algorithm. + * + * @type {string} + */ + set algorithm(value: string); + /** + * Gets the current anaglyph algorithm. + * + * @type {string} + */ + get algorithm(): string; + /** + * Sets the color mode. + * + * @type {string} + */ + set colorMode(value: string); + /** + * Gets the current color mode. + * + * @type {string} + */ + get colorMode(): string; + /** + * Updates the color matrices based on current algorithm and color mode. + * + * @private + */ + private _updateMatrices; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +/** + * Anaglyph algorithm types. + */ +export type AnaglyphAlgorithm = string; +export namespace AnaglyphAlgorithm { + let TRUE: string; + let GREY: string; + let COLOUR: string; + let HALF_COLOUR: string; + let DUBOIS: string; + let OPTIMISED: string; + let COMPROMISE: string; +} +/** + * Anaglyph color modes. + */ +export type AnaglyphColorMode = string; +export namespace AnaglyphColorMode { + let RED_CYAN: string; + let MAGENTA_CYAN: string; + let MAGENTA_GREEN: string; +} +import StereoCompositePassNode from './StereoCompositePassNode.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts new file mode 100644 index 000000000..6bc590e84 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts @@ -0,0 +1,138 @@ +export default BilateralBlurNode; +export function bilateralBlur(node: Node, directionNode: Node, sigma: number, sigmaColor: number): BilateralBlurNode; +/** + * Post processing node for creating a bilateral blur effect. + * + * Bilateral blur smooths an image while preserving sharp edges. Unlike a + * standard Gaussian blur which blurs everything equally, bilateral blur + * analyzes the intensity/color of neighboring pixels. If a neighbor is too + * different from the center pixel (indicating an edge), it is excluded + * from the blurring process. + * + * Reference: {@link https://en.wikipedia.org/wiki/Bilateral_filter} + * + * @augments TempNode + * @three_import import { bilateralBlur } from 'three/addons/tsl/display/BilateralBlurNode.js'; + */ +declare class BilateralBlurNode extends TempNode { + /** + * Constructs a new bilateral blur node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {Node} directionNode - Defines the direction and radius of the blur. + * @param {number} sigma - Controls the spatial kernel of the blur filter. Higher values mean a wider blur radius. + * @param {number} sigmaColor - Controls the intensity kernel. Higher values allow more color difference to be blurred together. + */ + constructor(textureNode: TextureNode, directionNode?: Node, sigma?: number, sigmaColor?: number); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * Defines the direction and radius of the blur. + * + * @type {Node} + */ + directionNode: Node; + /** + * Controls the spatial kernel of the blur filter. Higher values mean a wider blur radius. + * + * @type {number} + */ + sigma: number; + /** + * Controls the color/intensity kernel. Higher values allow more color difference + * to be blurred together. Lower values preserve edges more strictly. + * + * @type {number} + */ + sigmaColor: number; + /** + * A uniform node holding the inverse resolution value. + * + * @private + * @type {UniformNode} + */ + private _invSize; + /** + * Bilateral blur is applied in two passes (horizontal, vertical). + * This node controls the direction of each pass. + * + * @private + * @type {UniformNode} + */ + private _passDirection; + /** + * The render target used for the horizontal pass. + * + * @private + * @type {RenderTarget} + */ + private _horizontalRT; + /** + * The render target used for the vertical pass. + * + * @private + * @type {RenderTarget} + */ + private _verticalRT; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * The material for the blur pass. + * + * @private + * @type {?NodeMaterial} + */ + private _material; + /** + * The resolution scale. + * + * @type {number} + * @default 1 + */ + resolutionScale: number; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; + /** + * Computes spatial (Gaussian) coefficients depending on the given kernel radius. + * These coefficients are used for the spatial component of the bilateral filter. + * + * @private + * @param {number} kernelRadius - The kernel radius. + * @return {Array} + */ + private _getSpatialCoefficients; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts new file mode 100644 index 000000000..638306ce2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts @@ -0,0 +1,10 @@ +/** + * Applies a bleach bypass effect to the given color node. + * + * @tsl + * @function + * @param {Node} color - The color node to apply the sepia for. + * @param {Node} [opacity=1] - Influences how strong the effect is blended with the original color. + * @return {Node} The updated color node. + */ +export const bleach: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts new file mode 100644 index 000000000..056cd15a0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts @@ -0,0 +1,247 @@ +export function bloom(node: Node, strength?: number, radius?: number, threshold?: number): BloomNode; +export default BloomNode; +/** + * Post processing node for creating a bloom effect. + * ```js + * const renderPipeline = new THREE.RenderPipeline( renderer ); + * + * const scenePass = pass( scene, camera ); + * const scenePassColor = scenePass.getTextureNode( 'output' ); + * + * const bloomPass = bloom( scenePassColor ); + * + * renderPipeline.outputNode = scenePassColor.add( bloomPass ); + * ``` + * By default, the node affects the entire image. For a selective bloom, + * use the `emissive` material property to control which objects should + * contribute to bloom or not. This can be achieved via MRT. + * ```js + * const renderPipeline = new THREE.RenderPipeline( renderer ); + * + * const scenePass = pass( scene, camera ); + * scenePass.setMRT( mrt( { + * output, + * emissive + * } ) ); + * + * const scenePassColor = scenePass.getTextureNode( 'output' ); + * const emissivePass = scenePass.getTextureNode( 'emissive' ); + * + * const bloomPass = bloom( emissivePass ); + * renderPipeline.outputNode = scenePassColor.add( bloomPass ); + * ``` + * @augments TempNode + * @three_import import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + */ +declare class BloomNode extends TempNode { + /** + * Constructs a new bloom node. + * + * @param {Node} inputNode - The node that represents the input of the effect. + * @param {number} [strength=1] - The strength of the bloom. + * @param {number} [radius=0] - The radius of the bloom. + * @param {number} [threshold=0] - The luminance threshold limits which bright areas contribute to the bloom effect. + */ + constructor(inputNode: Node, strength?: number, radius?: number, threshold?: number); + /** + * The node that represents the input of the effect. + * + * @type {Node} + */ + inputNode: Node; + /** + * The strength of the bloom. + * + * @type {UniformNode} + */ + strength: UniformNode; + /** + * The radius of the bloom. Must be in the range `[0,1]`. + * + * @type {UniformNode} + */ + radius: UniformNode; + /** + * The luminance threshold limits which bright areas contribute to the bloom effect. + * + * @type {UniformNode} + */ + threshold: UniformNode; + /** + * Can be used to tweak the extracted luminance from the scene. + * + * @type {UniformNode} + */ + smoothWidth: UniformNode; + /** + * A per-mip tint color for the bloom, applied during the composite pass. + * Defaults to white (no tint) for each of the mips. Mutate the vectors to + * colorize the bloom (e.g. for a warm or anamorphic look). + * + * @type {Array} + */ + bloomTintColors: Array; + /** + * Scale factor for the internal render targets. + * + * @private + * @type {number} + * @default 0.5 + */ + private _resolutionScale; + /** + * Can be used to inject a custom high pass filter (e.g., for anamorphic effects). + * + * @type {Function} + */ + highPassFn: Function; + /** + * An array that holds the render targets for the horizontal blur passes. + * + * @private + * @type {Array} + */ + private _renderTargetsHorizontal; + /** + * An array that holds the render targets for the vertical blur passes. + * + * @private + * @type {Array} + */ + private _renderTargetsVertical; + /** + * The number if blur mips. + * + * @private + * @type {number} + */ + private _nMips; + /** + * The render target for the luminance pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetBright; + /** + * The material for the composite pass. + * + * @private + * @type {?NodeMaterial} + */ + private _compositeMaterial; + /** + * The material for the luminance pass. + * + * @private + * @type {?NodeMaterial} + */ + private _highPassFilterMaterial; + /** + * The materials for the blur pass. + * + * @private + * @type {Array} + */ + private _separableBlurMaterials; + /** + * The result of the luminance pass as a texture node for further processing. + * + * @private + * @type {TextureNode} + */ + private _textureNodeBright; + /** + * The result of the first blur pass as a texture node for further processing. + * + * @private + * @type {TextureNode} + */ + private _textureNodeBlur0; + /** + * The result of the second blur pass as a texture node for further processing. + * + * @private + * @type {TextureNode} + */ + private _textureNodeBlur1; + /** + * The result of the third blur pass as a texture node for further processing. + * + * @private + * @type {TextureNode} + */ + private _textureNodeBlur2; + /** + * The result of the fourth blur pass as a texture node for further processing. + * + * @private + * @type {TextureNode} + */ + private _textureNodeBlur3; + /** + * The result of the fifth blur pass as a texture node for further processing. + * + * @private + * @type {TextureNode} + */ + private _textureNodeBlur4; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureOutput; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the resolution scale for the pass. + * The resolution scale is a factor that is multiplied with the renderer's width and height. + * + * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. + * @return {BloomNode} A reference to this node. + */ + setResolutionScale(resolutionScale: number): BloomNode; + /** + * Gets the current resolution scale of the pass. + * + * @return {number} The current resolution scale. A value of `1` means full resolution. + */ + getResolutionScale(): number; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; + /** + * Create a separable blur material for the given kernel radius. + * + * @private + * @param {NodeContext} sharedContext + * @param {number} kernelRadius - The kernel radius. + * @return {NodeMaterial} + */ + private _getSeparableBlurMaterial; +} +import { TempNode } from 'three/webgpu'; +import { Vector3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts new file mode 100644 index 000000000..8fa82745a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts @@ -0,0 +1,58 @@ +/** + * Creates barrel-distorted UV coordinates. + * The center of the screen appears to bulge outward (convex distortion). + * + * @tsl + * @function + * @param {Node} [curvature=0.1] - The amount of curvature (0 = flat, 0.5 = very curved). + * @param {Node} [coord=uv()] - The input UV coordinates. + * @return {Node} The distorted UV coordinates. + */ +export const barrelUV: () => void; +/** + * Checks if UV coordinates are inside the valid 0-1 range. + * Useful for masking areas inside the distorted screen. + * + * @tsl + * @function + * @param {Node} coord - The UV coordinates to check. + * @return {Node} 1.0 if inside bounds, 0.0 if outside. + */ +export const barrelMask: () => void; +/** + * Applies color bleeding effect to simulate horizontal color smearing. + * Simulates the analog signal bleeding in CRT displays where colors + * "leak" into adjacent pixels horizontally. + * + * @tsl + * @function + * @param {Node} color - The input texture node. + * @param {Node} [amount=0.002] - The amount of color bleeding (0-0.01). + * @return {Node} The color with bleeding effect applied. + */ +export const colorBleeding: () => void; +/** + * Applies scanline effect to simulate CRT monitor horizontal lines with animation. + * + * @tsl + * @function + * @param {Node} color - The input color. + * @param {Node} [intensity=0.3] - The intensity of the scanlines (0-1). + * @param {Node} [count=240] - The number of scanlines (typically matches vertical resolution). + * @param {Node} [speed=0.0] - The scroll speed of scanlines (0 = static, 1 = normal CRT roll). + * @param {Node} [coord=uv()] - The UV coordinates to use for scanlines. + * @return {Node} The color with scanlines applied. + */ +export const scanlines: () => void; +/** + * Applies vignette effect to darken the edges of the screen. + * + * @tsl + * @function + * @param {Node} color - The input color. + * @param {Node} [intensity=0.4] - The intensity of the vignette (0-1). + * @param {Node} [smoothness=0.5] - The smoothness of the vignette falloff. + * @param {Node} [coord=uv()] - The UV coordinates to use for vignette calculation. + * @return {Node} The color with vignette applied. + */ +export const vignette: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts new file mode 100644 index 000000000..564bed21b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts @@ -0,0 +1,53 @@ +export default ChromaticAberrationNode; +export function chromaticAberration(node: Node, strength?: Node | number, center?: (Node | Vector2) | null, scale?: Node | number): ChromaticAberrationNode; +/** + * Post processing node for applying chromatic aberration effect. + * This effect simulates the color fringing that occurs in real camera lenses + * by separating and offsetting the red, green, and blue channels. + * + * @augments TempNode + * @three_import import { chromaticAberration } from 'three/addons/tsl/display/ChromaticAberrationNode.js'; + */ +declare class ChromaticAberrationNode extends TempNode { + /** + * Constructs a new chromatic aberration node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {Node} strengthNode - The strength of the chromatic aberration effect as a node. + * @param {Node} centerNode - The center point of the effect as a node. + * @param {Node} scaleNode - The scale factor for stepped scaling from center as a node. + */ + constructor(textureNode: TextureNode, strengthNode: Node, centerNode: Node, scaleNode: Node); + /** + * The texture node that represents the input of the effect. + * + * @type {texture} + */ + textureNode: texture; + /** + * A node holding the strength of the effect. + * + * @type {Node} + */ + strengthNode: Node; + /** + * A node holding the center point of the effect. + * + * @type {Node} + */ + centerNode: Node; + /** + * A node holding the scale factor for stepped scaling. + * + * @type {Node} + */ + scaleNode: Node; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts new file mode 100644 index 000000000..26cac984d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts @@ -0,0 +1,115 @@ +export default DenoiseNode; +export function denoise(node: Node, depthNode: Node, normalNode: Node | null, camera: Camera): DenoiseNode; +/** + * Post processing node for denoising data like raw screen-space ambient occlusion output. + * Denoise can noticeably improve the quality of ambient occlusion but also add quite some + * overhead to the post processing setup. It's best to make its usage optional (e.g. via + * graphic settings). + * + * Reference: {@link https://openaccess.thecvf.com/content/WACV2021/papers/Khademi_Self-Supervised_Poisson-Gaussian_Denoising_WACV_2021_paper.pdf}. + * + * @augments TempNode + * @three_import import { denoise } from 'three/addons/tsl/display/DenoiseNode.js'; + */ +declare class DenoiseNode extends TempNode { + /** + * Constructs a new denoise node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect (e.g. AO). + * @param {Node} depthNode - A node that represents the scene's depth. + * @param {?Node} normalNode - A node that represents the scene's normals. + * @param {Camera} camera - The camera the scene is rendered with. + */ + constructor(textureNode: TextureNode, depthNode: Node, normalNode: Node | null, camera: Camera); + /** + * The texture node that represents the input of the effect (e.g. AO). + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * A node that represents the scene's depth. + * + * @type {Node} + */ + depthNode: Node; + /** + * A node that represents the scene's normals. If no normals are passed to the + * constructor (because MRT is not available), normals can be automatically + * reconstructed from depth values in the shader. + * + * @type {?Node} + */ + normalNode: Node | null; + /** + * The node represents the internal noise texture. + * + * @type {TextureNode} + */ + noiseNode: TextureNode; + /** + * The luma Phi value. + * + * @type {UniformNode} + */ + lumaPhi: UniformNode; + /** + * The depth Phi value. + * + * @type {UniformNode} + */ + depthPhi: UniformNode; + /** + * The normal Phi value. + * + * @type {UniformNode} + */ + normalPhi: UniformNode; + /** + * The radius. + * + * @type {UniformNode} + */ + radius: UniformNode; + /** + * The index. + * + * @type {UniformNode} + */ + index: UniformNode; + /** + * The resolution of the effect. + * + * @private + * @type {UniformNode} + */ + private _resolution; + /** + * An array of sample vectors. + * + * @private + * @type {UniformArrayNode} + */ + private _sampleVectors; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * This method is used to update internal uniforms once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts new file mode 100644 index 000000000..0a33cfff6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts @@ -0,0 +1,212 @@ +export default DepthOfFieldNode; +export function dof(node: Node, viewZNode: Node, focusDistance?: Node | number, focalLength?: Node | number, bokehScale?: Node | number): DepthOfFieldNode; +/** + * Post processing node for creating depth of field (DOF) effect. + * + * References: + * - {@link https://pixelmischiefblog.wordpress.com/2016/11/25/bokeh-depth-of-field/} + * - {@link https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/} + * + * @augments TempNode + * @three_import import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js'; + */ +declare class DepthOfFieldNode extends TempNode { + /** + * Constructs a new DOF node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {Node} viewZNode - Represents the viewZ depth values of the scene. + * @param {Node} focusDistanceNode - Defines the effect's focus which is the distance along the camera's look direction in world units. + * @param {Node} focalLengthNode - How far an object can be from the focal plane before it goes completely out-of-focus in world units. + * @param {Node} bokehScaleNode - A unitless value for artistic purposes to adjust the size of the bokeh. + */ + constructor(textureNode: TextureNode, viewZNode: Node, focusDistanceNode: Node, focalLengthNode: Node, bokehScaleNode: Node); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * Represents the viewZ depth values of the scene. + * + * @type {Node} + */ + viewZNode: Node; + /** + * Defines the effect's focus which is the distance along the camera's look direction in world units. + * + * @type {Node} + */ + focusDistanceNode: Node; + /** + * How far an object can be from the focal plane before it goes completely out-of-focus in world units. + * + * @type {Node} + */ + focalLengthNode: Node; + /** + * A unitless value for artistic purposes to adjust the size of the bokeh. + * + * @type {Node} + */ + bokehScaleNode: Node; + /** + * The inverse size of the resolution. + * + * @private + * @type {UniformNode} + */ + private _invSize; + /** + * The render target used for the near and far field. + * + * @private + * @type {RenderTarget} + */ + private _CoCRT; + /** + * The render target used for blurring the near field. + * + * @private + * @type {RenderTarget} + */ + private _CoCBlurredRT; + /** + * The render target used for the first blur pass. + * + * @private + * @type {RenderTarget} + */ + private _blur64RT; + /** + * The render target used for the near field's second blur pass. + * + * @private + * @type {RenderTarget} + */ + private _blur16NearRT; + /** + * The render target used for the far field's second blur pass. + * + * @private + * @type {RenderTarget} + */ + private _blur16FarRT; + /** + * The render target used for the composite + * + * @private + * @type {RenderTarget} + */ + private _compositeRT; + /** + * The material used for the CoC/near and far fields. + * + * @private + * @type {NodeMaterial} + */ + private _CoCMaterial; + /** + * The material used for blurring the near field. + * + * @private + * @type {NodeMaterial} + */ + private _CoCBlurredMaterial; + /** + * The material used for the 64 tap blur. + * + * @private + * @type {NodeMaterial} + */ + private _blur64Material; + /** + * The material used for the 16 tap blur. + * + * @private + * @type {NodeMaterial} + */ + private _blur16Material; + /** + * The material used for the final composite. + * + * @private + * @type {NodeMaterial} + */ + private _compositeMaterial; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {TextureNode} + */ + private _textureNode; + /** + * The result of the CoC pass as a texture node. + * + * @private + * @type {TextureNode} + */ + private _CoCTextureNode; + /** + * The Gaussian blur node used to blur the near field's circle of confusion. + * + * @private + * @type {GaussianBlurNode} + */ + private _CoCBlurNode; + /** + * The result of the blur64 pass as a texture node. + * + * @private + * @type {TextureNode} + */ + private _blur64TextureNode; + /** + * The result of the near field's blur16 pass as a texture node. + * + * @private + * @type {TextureNode} + */ + private _blur16NearTextureNode; + /** + * The result of the far field's blur16 pass as a texture node. + * + * @private + * @type {TextureNode} + */ + private _blur16FarTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * This method is used to update the effect's uniforms once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(builder: NodeBuilder): ShaderCallNodeInternal; + _generateKernels(): { + points16: Vector2[]; + points64: Vector2[]; + }; +} +import { TempNode } from 'three/webgpu'; +import { Vector2 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts new file mode 100644 index 000000000..c3e37fe86 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts @@ -0,0 +1,44 @@ +export default DotScreenNode; +export function dotScreen(node: Node, angle?: number, scale?: number): DotScreenNode; +/** + * Post processing node for creating dot-screen effect. + * + * @augments TempNode + * @three_import import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js'; + */ +declare class DotScreenNode extends TempNode { + /** + * Constructs a new dot screen node. + * + * @param {Node} inputNode - The node that represents the input of the effect. + * @param {number} [angle=1.57] - The rotation of the effect in radians. + * @param {number} [scale=1] - The scale of the effect. A higher value means smaller dots. + */ + constructor(inputNode: Node, angle?: number, scale?: number); + /** + * The node that represents the input of the effect. + * + * @type {Node} + */ + inputNode: Node; + /** + * A uniform node that represents the rotation of the effect in radians. + * + * @type {UniformNode} + */ + angle: UniformNode; + /** + * A uniform node that represents the scale of the effect. A higher value means smaller dots. + * + * @type {UniformNode} + */ + scale: UniformNode; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts new file mode 100644 index 000000000..ce9465982 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts @@ -0,0 +1,112 @@ +export default FSR1Node; +export function fsr1(node: Node, sharpness?: (number | Node), denoise?: (boolean | Node)): FSR1Node; +/** + * Post processing node for applying AMD FidelityFX Super Resolution 1 (FSR 1). + * + * Combines two passes: + * - **EASU** (Edge-Adaptive Spatial Upsampling): Uses 12 texture samples in a cross pattern + * to detect local edge direction, then shapes an approximate Lanczos2 kernel into an + * ellipse aligned with the detected edge. + * - **RCAS** (Robust Contrast-Adaptive Sharpening): Uses a 5-tap cross pattern to apply + * contrast-aware sharpening that is automatically limited per-pixel to avoid artifacts. + * + * Note: Only use FSR 1 if your application is fragment-shader bound and cannot afford to render + * at full resolution. FSR 1 adds its own overhead, so simply shaded scenes will render faster + * at native resolution without it. Besides, FSR 1 should always be used with an anti-aliased + * source image. + * + * Reference: {@link https://gpuopen.com/fidelityfx-superresolution/}. + * + * @augments TempNode + * @three_import import { fsr1 } from 'three/addons/tsl/display/fsr1/FSR1Node.js'; + */ +declare class FSR1Node extends TempNode { + /** + * Constructs a new FSR 1 node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {Node} [sharpness=0.2] - RCAS sharpening strength. 0 = maximum sharpening, 2 = no sharpening. + * @param {Node} [denoise=false] - Whether to attenuate RCAS sharpening in noisy areas. + */ + constructor(textureNode: TextureNode, sharpness?: Node, denoise?: Node); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * RCAS sharpening strength. 0 = maximum, 2 = none. + * + * @type {Node} + */ + sharpness: Node; + /** + * Whether to attenuate RCAS sharpening in noisy areas. + * + * @type {Node} + */ + denoise: Node; + /** + * The render target for the EASU upscale pass. + * + * @private + * @type {RenderTarget} + */ + private _easuRT; + /** + * The render target for the RCAS sharpen pass. + * + * @private + * @type {RenderTarget} + */ + private _rcasRT; + /** + * The result of the effect as a texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * The material for the EASU pass. + * + * @private + * @type {?NodeMaterial} + */ + private _easuMaterial; + /** + * The material for the RCAS pass. + * + * @private + * @type {?NodeMaterial} + */ + private _rcasMaterial; + /** + * Sets the output size of the effect. + * + * @param {number} width - The width in pixels. + * @param {number} height - The height in pixels. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts new file mode 100644 index 000000000..aa6c1cc3a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts @@ -0,0 +1,44 @@ +export default FXAANode; +export function fxaa(node: Node): FXAANode; +/** + * Post processing node for applying FXAA. This node requires sRGB input + * so tone mapping and color space conversion must happen before the anti-aliasing. + * + * @augments TempNode + * @three_import import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; + */ +declare class FXAANode extends TempNode { + /** + * Constructs a new FXAA node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + */ + constructor(textureNode: TextureNode); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * A uniform node holding the inverse resolution value. + * + * @private + * @type {UniformNode} + */ + private _invSize; + /** + * This method is used to update the effect's uniforms once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts new file mode 100644 index 000000000..0cac52e90 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts @@ -0,0 +1,56 @@ +export default FilmNode; +/** + * TSL function for creating a film node for post processing. + * + * @tsl + * @function + * @param {Node} inputNode - The node that represents the input of the effect. + * @param {?Node} [intensityNode=null] - A node that represents the effect's intensity. + * @param {?Node} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data. + * @returns {FilmNode} + */ +export const film: any; +/** + * Post processing node for creating a film grain effect. + * + * @augments TempNode + * @three_import import { film } from 'three/addons/tsl/display/FilmNode.js'; + */ +declare class FilmNode extends TempNode { + /** + * Constructs a new film node. + * + * @param {Node} inputNode - The node that represents the input of the effect. + * @param {?Node} [intensityNode=null] - A node that represents the effect's intensity. + * @param {?Node} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data. + */ + constructor(inputNode: Node, intensityNode?: Node | null, uvNode?: Node | null); + /** + * The node that represents the input of the effect. + * + * @type {Node} + */ + inputNode: Node; + /** + * A node that represents the effect's intensity. + * + * @type {?Node} + * @default null + */ + intensityNode: Node | null; + /** + * A node that allows to pass custom (e.g. animated) uv data. + * + * @type {?Node} + * @default null + */ + uvNode: Node | null; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts new file mode 100644 index 000000000..e0d8e5bc3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts @@ -0,0 +1,259 @@ +export default GTAONode; +export function ao(depthNode: Node, normalNode: Node | null, camera: Camera): GTAONode; +/** + * Post processing node for applying Ground Truth Ambient Occlusion (GTAO) to a scene. + * ```js + * const renderPipeline = new THREE.RenderPipeline( renderer ); + * + * // pre-pass for normals and depth + * + * const prePass = pass( scene, camera ); + * prePass.setMRT( mrt( { + * output: normalView + * } ) ); + * + * const prePassNormal = prePass.getTextureNode(); + * const prePassDepth = prePass.getTextureNode( 'depth' ); + * + * // scene pass + * + * const scenePass = pass( scene, camera ); + * + * // ao + * + * const aoPass = ao( prePassDepth, prePassNormal, camera ); + * const aoPassOutput = aoPass.getTextureNode(); + * + * // apply the ambient occlusion to the scene + * + * scenePass.contextNode = builtinAOContext( aoPassOutput.sample( screenUV ).r ); + * + * renderPipeline.outputNode = scenePass; + * ``` + * + * Reference: [Practical Real-Time Strategies for Accurate Indirect Occlusion](https://www.activision.com/cdn/research/Practical_Real_Time_Strategies_for_Accurate_Indirect_Occlusion_NEW%20VERSION_COLOR.pdf). + * + * @augments TempNode + * @three_import import { ao } from 'three/addons/tsl/display/GTAONode.js'; + */ +declare class GTAONode extends TempNode { + /** + * Constructs a new GTAO node. + * + * @param {Node} depthNode - A node that represents the scene's depth. + * @param {?Node} normalNode - A node that represents the scene's normals. + * @param {Camera} camera - The camera the scene is rendered with. + */ + constructor(depthNode: Node, normalNode: Node | null, camera: Camera); + /** + * A node that represents the scene's depth. + * + * @type {Node} + */ + depthNode: Node; + /** + * A node that represents the scene's normals. If no normals are passed to the + * constructor (because MRT is not available), normals can be automatically + * reconstructed from depth values in the shader. + * + * @type {?Node} + */ + normalNode: Node | null; + /** + * The resolution scale. By default the effect is rendered in full resolution + * for best quality but a value of `0.5` should be sufficient for most scenes. + * + * @type {number} + * @default 1 + */ + resolutionScale: number; + /** + * The render target the ambient occlusion is rendered into. + * + * @private + * @type {RenderTarget} + */ + private _aoRenderTarget; + /** + * The radius of the ambient occlusion. + * + * @type {UniformNode} + */ + radius: UniformNode; + /** + * The thickness of the ambient occlusion. + * + * @type {UniformNode} + */ + thickness: UniformNode; + /** + * @deprecated since r186. The new distance model "Quadratic Ray Stepping" + * does not need it anymore. + * + * @type {UniformNode} + */ + distanceExponent: UniformNode; + /** + * @deprecated since r186. The new distance model "Quadratic Ray Stepping" + * does not need it anymore. + * + * @type {UniformNode} + */ + distanceFallOff: UniformNode; + /** + * The scale of the ambient occlusion. + * + * @type {UniformNode} + */ + scale: UniformNode; + /** + * How many samples are used to compute the AO. + * A higher value results in better quality but also + * in a more expensive runtime behavior. + * + * Note: Changing this member triggers a shader recompilation. + * + * @type {UniformNode} + */ + samples: UniformNode; + /** + * Whether to use temporal filtering or not. Setting this property to + * `true` requires the usage of `TRAANode`. This will help to reduce noise + * although it introduces typical TAA artifacts like ghosting and temporal + * instabilities. + * + * If setting this property to `false`, a manual denoise via `DenoiseNode` + * might be required. + * + * @type {boolean} + * @default false + */ + useTemporalFiltering: boolean; + /** + * The resolution of the effect. Can be scaled via `resolutionScale`. + * + * @private + * @type {UniformNode} + */ + private _resolution; + /** + * The node represents the internal noise texture used by the AO. + * + * @private + * @type {TextureNode} + */ + private _noiseNode; + /** + * Represents the projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrix; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * Represents the near value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraNear; + /** + * Represents the far value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraFar; + /** + * Temporal direction that influences the rotation angle for each slice. + * + * @private + * @type {UniformNode} + */ + private _temporalDirection; + /** + * Temporal offset added to the initial ray step. + * + * @private + * @type {UniformNode} + */ + private _temporalOffset; + /** + * Resolution scale uniform. + * + * @private + * @type {UniformNode} + */ + private _resolutionScale; + /** + * The TSL function that computes the AO. Required for rebuild. + * + * @private + * @type {?Function} + * @default null + */ + private _ao; + /** + * The sample count currently baked into the shader. + * + * @private + * @type {number} + */ + private _currentSamples; + /** + * The shared builder context. Required for rebuild. + * + * @private + * @type {?Object} + * @default null + */ + private _sharedContext; + /** + * The material that is used to render the effect. + * + * @private + * @type {NodeMaterial} + */ + private _material; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts new file mode 100644 index 000000000..7d9e95355 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts @@ -0,0 +1,168 @@ +/** + * TSL function for creating a gaussian blur node for post processing with enabled premultiplied alpha. + * + * @tsl + * @function + * @deprecated since r180. Use `gaussianBlur()` with `premultipliedAlpha: true` option instead. + * @param {Node} node - The node that represents the input of the effect. + * @param {Node} directionNode - Defines the direction and radius of the blur. + * @param {number} sigma - Controls the kernel of the blur filter. Higher values mean a wider blur radius. + * @returns {GaussianBlurNode} + */ +export function premultipliedGaussianBlur(node: Node, directionNode: Node, sigma: number): GaussianBlurNode; +export default GaussianBlurNode; +export function gaussianBlur(node: Node, directionNode: Node, sigma: number, options?: { + premultipliedAlpha?: boolean | undefined; + resolutionScale?: number | undefined; +}): GaussianBlurNode; +/** + * Post processing node for creating a gaussian blur effect. + * + * @augments TempNode + * @three_import import { gaussianBlur, premultipliedGaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + */ +declare class GaussianBlurNode extends TempNode { + /** + * Constructs a new gaussian blur node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {Node} directionNode - Defines the direction and radius of the blur. + * @param {number} sigma - Controls the kernel of the blur filter. Higher values mean a wider blur radius. + * @param {Object} [options={}] - Additional options for the gaussian blur effect. + * @param {boolean} [options.premultipliedAlpha=false] - Whether to use premultiplied alpha for the blur effect. + * @param {number} [options.resolutionScale=1] - The resolution of the effect. 0.5 means half the resolution of the texture node. + */ + constructor(textureNode: TextureNode, directionNode?: Node, sigma?: number, options?: { + premultipliedAlpha?: boolean | undefined; + resolutionScale?: number | undefined; + }); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * Defines the direction and radius of the blur. + * + * @type {Node} + */ + directionNode: Node; + /** + * Controls the kernel of the blur filter. Higher values mean a wider blur radius. + * + * @type {number} + */ + sigma: number; + /** + * A uniform node holding the inverse resolution value. + * + * @private + * @type {UniformNode} + */ + private _invSize; + /** + * Gaussian blur is applied in two passes (horizontal, vertical). + * This node controls the direction of each pass. + * + * @private + * @type {UniformNode} + */ + private _passDirection; + /** + * The render target used for the horizontal pass. + * + * @private + * @type {RenderTarget} + */ + private _horizontalRT; + /** + * The render target used for the vertical pass. + * + * @private + * @type {RenderTarget} + */ + private _verticalRT; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * The material for the blur pass. + * + * @private + * @type {?NodeMaterial} + */ + private _material; + /** + * The resolution scale. + * + * @type {number} + * @default (1) + */ + resolutionScale: number; + /** + * Whether the effect should use premultiplied alpha or not. Set this to `true` + * if you are going to blur texture input with transparency. + * + * @type {boolean} + * @default false + */ + premultipliedAlpha: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @default true + * @readonly + */ + readonly isGaussianBlurNode: boolean; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; + /** + * Computes gaussian coefficients depending on the given kernel radius. + * + * @private + * @param {number} kernelRadius - The kernel radius. + * @return {Array} + */ + private _getCoefficients; + set resolution(value: Vector2); + /** + * The resolution scale. + * + * @deprecated + * @type {Vector2} + * @default {(1,1)} + */ + get resolution(): Vector2; +} +import { TempNode } from 'three/webgpu'; +import { Vector2 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts new file mode 100644 index 000000000..dfd74ef47 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts @@ -0,0 +1,201 @@ +export default GodraysNode; +export function godrays(depthNode: TextureNode, camera: Camera, light: (DirectionalLight | PointLight)): GodraysNode; +/** + * Post-Processing node for apply Screen-space raymarched godrays to a scene. + * + * After the godrays have been computed, it's recommened to apply a Bilateral + * Blur to the result to mitigate raymarching and noise artifacts. + * + * The composite with the scene pass is ideally done with `depthAwareBlend()`, + * which mitigates aliasing and light leaking. + * + * ```js + * const godraysPass = godrays( scenePassDepth, camera, light ); + * + * const blurPass = bilateralBlur( godraysPassColor ); // optional blur + * + * const outputBlurred = depthAwareBlend( scenePassColor, blurPassColor, scenePassDepth, camera, { blendColor, edgeRadius, edgeStrength } ); // composite + * ``` + * + * Limitations: + * + * - Only point and directional lights are currently supported. + * - The effect requires a full shadow setup. Meaning shadows must be enabled in the renderer, + * 3D objects must cast and receive shadows and the main light must cast shadows. + * + * Reference: This Node is a part of [three-good-godrays](https://github.com/Ameobea/three-good-godrays). + * + * @augments TempNode + * @three_import import { godrays } from 'three/addons/tsl/display/GodraysNode.js'; + */ +declare class GodraysNode extends TempNode { + /** + * Constructs a new Godrays node. + * + * @param {TextureNode} depthNode - A texture node that represents the scene's depth. + * @param {Camera} camera - The camera the scene is rendered with. + * @param {(DirectionalLight|PointLight)} light - The light the godrays are rendered for. + */ + constructor(depthNode: TextureNode, camera: Camera, light: (DirectionalLight | PointLight)); + /** + * A node that represents the beauty pass's depth. + * + * @type {TextureNode} + */ + depthNode: TextureNode; + /** + * The number of raymarching steps + * + * @type {UniformNode} + * @default 60 + */ + raymarchSteps: UniformNode; + /** + * The rate of accumulation for the godrays. Higher values roughly equate to more humid air/denser fog. + * + * @type {UniformNode} + * @default 0.7 + */ + density: UniformNode; + /** + * The maximum density of the godrays. Limits the maximum brightness of the godrays. + * + * @type {UniformNode} + * @default 0.5 + */ + maxDensity: UniformNode; + /** + * Higher values decrease the accumulation of godrays the further away they are from the light source. + * + * @type {UniformNode} + * @default 2 + */ + distanceAttenuation: UniformNode; + /** + * The resolution scale. + * + * @type {number} + */ + resolutionScale: number; + /** + * Represents the world matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraMatrixWorld; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _premultipliedLightCameraMatrix; + /** + * Represents the world position of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraPosition; + /** + * Represents the near value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraNear; + /** + * Represents the far value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraFar; + /** + * The near value of the shadow camera. + * + * @private + * @type {ReferenceNode} + */ + private _shadowCameraNear; + /** + * The far value of the shadow camera. + * + * @private + * @type {ReferenceNode} + */ + private _shadowCameraFar; + _fNormals: import("three/webgpu").UniformArrayNode; + _fConstants: import("three/webgpu").UniformArrayNode; + /** + * The light the godrays are rendered for. + * + * @private + * @type {(DirectionalLight|PointLight)} + */ + private _light; + /** + * The camera the scene is rendered with. + * + * @private + * @type {Camera} + */ + private _camera; + /** + * The render target the godrays are rendered into. + * + * @private + * @type {RenderTarget} + */ + private _godraysRenderTarget; + /** + * The material that is used to render the effect. + * + * @private + * @type {NodeMaterial} + */ + private _material; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + _updateLightParams(): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts new file mode 100644 index 000000000..6e6e3a603 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts @@ -0,0 +1,102 @@ +export default ImportanceSampledEnvironment; +/** + * Manages a preprocessed HDR environment map (CDF textures, uniforms) and exposes + * TSL helpers for BRDF-direction lookups and MIS importance sampling. + * + * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} + */ +declare class ImportanceSampledEnvironment { + /** + * @param {boolean} [importanceSampling=false] - When `true`, builds luminance CDF tables and enables MIS env sampling. + */ + constructor(importanceSampling?: boolean); + _importanceSampling: boolean; + _cdf: EnvMapCDFGenerator; + _totalSum: import("three/webgpu").UniformNode; + _size: import("three/webgpu").UniformNode; + intensity: import("three/webgpu").UniformNode; + _mapNode: import("three/webgpu").TextureNode | null; + _marginalNode: import("three/webgpu").TextureNode | null; + _conditionalNode: import("three/webgpu").TextureNode | null; + /** + * @param {Texture} hdr - Equirectangular HDR environment map. + */ + updateFrom(hdr: Texture): void; + clear(): void; + /** + * Simple environment lookup along the reflected direction (no MIS). + * + * @param {Object} params + * @param {UniformNode} params.cameraWorldMatrix + * @param {Node} params.viewReflectDir + * @param {Node} [params.sampleWeight] - Optional radiance scale (defaults to 1). + * @return {Node} + */ + sampleReflect({ cameraWorldMatrix, viewReflectDir, sampleWeight }: { + cameraWorldMatrix: UniformNode; + viewReflectDir: Node; + sampleWeight?: Node; + }): Node; + /** + * Environment reflection for a screen-space miss using only the BRDF / reflected-ray direction. + * + * @param {Object} params + * @param {UniformNode} params.cameraWorldMatrix + * @param {Node} params.viewReflectDir - View-space GGX-sampled reflected ray. + * @param {Node} params.N - View-space shading normal. + * @param {Node} params.V - View-space direction to camera. + * @param {Node} params.alpha - GGX roughness (alpha). + * @param {Node} params.f0 + * @return {Node} + */ + sampleEnvironmentBRDF({ cameraWorldMatrix, viewReflectDir, N, V, alpha, f0 }: { + cameraWorldMatrix: UniformNode; + viewReflectDir: Node; + N: Node; + V: Node; + alpha: Node; + f0: Node; + }): Node; + /** + * Environment reflection for a screen-space miss, estimated with multiple importance + * sampling (MIS) between the BRDF / reflected-ray direction and the env-luminance CDF + * direction. Both techniques use consistent solid-angle PDFs (`D·G1(N·V)/(4·N·V)`), so + * the power heuristic is unbiased. Adapted from three-gpu-pathtracer. + * + * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} + * + * @param {Object} params + * @param {UniformNode} params.cameraWorldMatrix + * @param {Node} params.viewReflectDir - View-space GGX-sampled reflected ray. + * @param {Node} params.N - View-space shading normal. + * @param {Node} params.V - View-space direction to camera. + * @param {Node} params.alpha - GGX roughness (alpha). + * @param {Node} params.f0 + * @param {Node} params.Xi2 - Second blue-noise sample (zw used for the CDF). + * @return {Node} + */ + sampleEnvironmentMIS({ cameraWorldMatrix, viewReflectDir, N, V, alpha, f0, Xi2 }: { + cameraWorldMatrix: UniformNode; + viewReflectDir: Node; + N: Node; + V: Node; + alpha: Node; + f0: Node; + Xi2: Node; + }): Node; + dispose(): void; +} +/** + * Precomputes marginal and conditional CDF textures from an equirectangular HDR environment map + * for luminance importance sampling. + */ +declare class EnvMapCDFGenerator { + map: any; + marginalWeights: DataTexture | null; + conditionalWeights: DataTexture | null; + totalSum: number; + updateFrom(hdr: any): void; + updateMapOnly(hdr: any): void; + dispose(): void; +} +import { DataTexture } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts new file mode 100644 index 000000000..924f98774 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts @@ -0,0 +1,132 @@ +export default LensflareNode; +export function lensflare(node: TextureNode, params: { + ghostTint?: Node | Color; + threshold?: Node | number; + ghostSamples?: Node | number; + ghostSpacing?: Node | number; + ghostAttenuationFactor?: Node | number; + downSampleRatio?: number | undefined; +}): LensflareNode; +/** + * Post processing node for adding a bloom-based lens flare effect. This effect + * requires that you extract the bloom of the scene via a bloom pass first. + * + * References: + * - {@link https://john-chapman-graphics.blogspot.com/2013/02/pseudo-lens-flare.html}. + * - {@link https://john-chapman.github.io/2017/11/05/pseudo-lens-flare.html}. + * + * @augments TempNode + * @three_import import { lensflare } from 'three/addons/tsl/display/LensflareNode.js'; + */ +declare class LensflareNode extends TempNode { + /** + * Constructs a new lens flare node. + * + * @param {TextureNode} textureNode - The texture node that represents the scene's bloom. + * @param {Object} params - The parameter object for configuring the effect. + * @param {Node | Color} [params.ghostTint=vec3(1, 1, 1)] - Defines the tint of the flare/ghosts. + * @param {Node | number} [params.threshold=float(0.5)] - Controls the size and strength of the effect. A higher threshold results in smaller flares. + * @param {Node | number} [params.ghostSamples=float(4)] - Represents the number of flares/ghosts per bright spot which pivot around the center. + * @param {Node | number} [params.ghostSpacing=float(0.25)] - Defines the spacing of the flares/ghosts. + * @param {Node | number} [params.ghostAttenuationFactor=float(25)] - Defines the attenuation factor of flares/ghosts. + * @param {number} [params.downSampleRatio=4] - Defines how downsampling since the effect is usually not rendered at full resolution. + */ + constructor(textureNode: TextureNode, params?: { + ghostTint?: Node | Color; + threshold?: Node | number; + ghostSamples?: Node | number; + ghostSpacing?: Node | number; + ghostAttenuationFactor?: Node | number; + downSampleRatio?: number | undefined; + }); + /** + * The texture node that represents the scene's bloom. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * Defines the tint of the flare/ghosts. + * + * @type {Node} + */ + ghostTintNode: Node; + /** + * Controls the size and strength of the effect. A higher threshold results in smaller flares. + * + * @type {Node} + */ + thresholdNode: Node; + /** + * Represents the number of flares/ghosts per bright spot which pivot around the center. + * + * @type {Node} + */ + ghostSamplesNode: Node; + /** + * Defines the spacing of the flares/ghosts. + * + * @type {Node} + */ + ghostSpacingNode: Node; + /** + * Defines the attenuation factor of flares/ghosts. + * + * @type {Node} + */ + ghostAttenuationFactorNode: Node; + /** + * Defines how downsampling since the effect is usually not rendered at full resolution. + * + * @type {number} + */ + downSampleRatio: number; + /** + * The internal render target of the effect. + * + * @private + * @type {RenderTarget} + */ + private _renderTarget; + /** + * The node material that holds the effect's TSL code. + * + * @private + * @type {NodeMaterial} + */ + private _material; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts new file mode 100644 index 000000000..29e3620ff --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts @@ -0,0 +1,51 @@ +export default Lut3DNode; +export function lut3D(node: Node, lut: TextureNode, size: number, intensity: Node | number): Lut3DNode; +/** + * A post processing node for color grading via lookup tables. + * + * @augments TempNode + * @three_import import { lut3D } from 'three/addons/tsl/display/Lut3DNode.js'; + */ +declare class Lut3DNode extends TempNode { + /** + * Constructs a new LUT node. + * + * @param {Node} inputNode - The node that represents the input of the effect. + * @param {TextureNode} lutNode - A texture node that represents the lookup table. + * @param {number} size - The size of the lookup table. + * @param {Node} intensityNode - Controls the intensity of the effect. + */ + constructor(inputNode: Node, lutNode: TextureNode, size: number, intensityNode: Node); + /** + * The node that represents the input of the effect. + * + * @type {Node} + */ + inputNode: Node; + /** + * A texture node that represents the lookup table. + * + * @type {TextureNode} + */ + lutNode: TextureNode; + /** + * The size of the lookup table. + * + * @type {UniformNode} + */ + size: UniformNode; + /** + * Controls the intensity of the effect. + * + * @type {Node} + */ + intensityNode: Node; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts new file mode 100644 index 000000000..618927b5d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts @@ -0,0 +1,11 @@ +/** + * Applies a motion blur effect to the given input node. + * + * @tsl + * @function + * @param {Node} inputNode - The input node to apply the motion blur for. + * @param {Node} velocity - The motion vectors of the beauty pass. + * @param {Node} [numSamples=int(16)] - How many samples the effect should use. A higher value results in better quality but is also more expensive. + * @return {Node} The input node with the motion blur effect applied. + */ +export const motionBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts new file mode 100644 index 000000000..d15fa4427 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts @@ -0,0 +1,105 @@ +export default OITPassNode; +export function oitPass(scene: Scene, camera: Camera, options?: Object): OITPassNode; +/** + * A render pass node that renders the scene with Order-Independent Transparency + * based on the Weighted Blended OIT technique by McGuire and Bavoil. + * + * Transparent objects are rendered in a separate pass into two accumulation + * targets (a weighted color sum and the pixel's revealage) which are + * then composited over the rest of the scene. Since the result does not depend + * on the draw order, artifacts from sorting-based transparency like popping or + * incorrectly resolved intersecting geometry are avoided. + * + * Only transparent materials using `NormalBlending` and no transmission qualify + * for OIT. All other objects are rendered as usual. + * + * MSAA is only supported with the WebGPU backend. + * + * MRT configurations assigned via `setMRT()` apply to the default pass only. + * OIT-qualified objects contribute to the color output but not to custom + * MRT outputs since a pixel may accumulate multiple transparent surfaces. + * + * ```js + * const renderPipeline = new THREE.RenderPipeline( renderer ); + * renderPipeline.outputNode = oitPass( scene, camera ); + * ``` + * + * References: + * - {@link https://jcgt.org/published/0002/02/09/} + * - {@link https://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html} + * + * @augments PassNode + * @three_import import { oitPass } from 'three/addons/tsl/display/OITPassNode.js'; + */ +declare class OITPassNode extends PassNode { + /** + * Constructs a new OIT pass node. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera to render the scene with. + * @param {Object} [options={}] - Options for the internal render target. + */ + constructor(scene: Scene, camera: Camera, options?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOITPassNode: boolean; + /** + * The depth-based weight of a transparent fragment, see equations (7) to (9) + * in the paper. When `null`, equation (9) is used. Must be assigned before + * the first render. + * + * @type {?Node} + * @default null + */ + weightNode: Node | null; + /** + * The render target holding the OIT accumulation textures. + * + * @private + * @type {RenderTarget} + */ + private _oitRenderTarget; + /** + * The MRT configuration for the OIT pass. + * + * @private + * @type {?MRTNode} + */ + private _oitMRTNode; + /** + * The renderer of the current frame. + * + * @private + * @type {?Renderer} + */ + private _renderer; + /** + * Renders opaque objects and transparent objects that do not qualify for OIT. + * + * @private + * @type {Function} + */ + private _defaultRenderObjectFunction; + /** + * Renders OIT-qualified objects into the accumulation targets. + * + * @private + * @type {Function} + */ + private _oitRenderObjectFunction; + /** + * Returns the MRT configuration for the OIT pass. + * + * @private + * @return {MRTNode} The MRT node. + */ + private _getMRTNode; + setSize(width: any, height: any): void; + setup(builder: any): any; +} +import { PassNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts new file mode 100644 index 000000000..a7b2befe2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts @@ -0,0 +1,351 @@ +export default OutlineNode; +export function outline(scene: Scene, camera: Camera, params: { + selectedObjects?: Object3D[] | undefined; + edgeThickness?: Node; + edgeGlow?: Node; + downSampleRatio?: number | undefined; +}): OutlineNode; +/** + * Post processing node for rendering outlines around selected objects. The node + * gives you great flexibility in composing the final outline look depending on + * your requirements. + * ```js + * const renderPipeline = new THREE.RenderPipeline( renderer ); + * + * const scenePass = pass( scene, camera ); + * + * // outline parameter + * + * const edgeStrength = uniform( 3.0 ); + * const edgeGlow = uniform( 0.0 ); + * const edgeThickness = uniform( 1.0 ); + * const visibleEdgeColor = uniform( new THREE.Color( 0xffffff ) ); + * const hiddenEdgeColor = uniform( new THREE.Color( 0x4e3636 ) ); + * + * outlinePass = outline( scene, camera, { + * selectedObjects, + * edgeGlow, + * edgeThickness + * } ); + * + * // compose custom outline + * + * const { visibleEdge, hiddenEdge } = outlinePass; + * const outlineColor = visibleEdge.mul( visibleEdgeColor ).add( hiddenEdge.mul( hiddenEdgeColor ) ).mul( edgeStrength ); + * + * renderPipeline.outputNode = outlineColor.add( scenePass ); + * ``` + * + * @augments TempNode + * @three_import import { outline } from 'three/addons/tsl/display/OutlineNode.js'; + */ +declare class OutlineNode extends TempNode { + /** + * Constructs a new outline node. + * + * @param {Scene} scene - A reference to the scene. + * @param {Camera} camera - The camera the scene is rendered with. + * @param {Object} params - The configuration parameters. + * @param {Array} [params.selectedObjects] - An array of selected objects. + * @param {Node} [params.edgeThickness=float(1)] - The thickness of the edges. + * @param {Node} [params.edgeGlow=float(0)] - Can be used for an animated glow/pulse effects. + * @param {number} [params.downSampleRatio=2] - The downsample ratio. + */ + constructor(scene: Scene, camera: Camera, params?: { + selectedObjects?: Object3D[] | undefined; + edgeThickness?: Node; + edgeGlow?: Node; + downSampleRatio?: number | undefined; + }); + /** + * A reference to the scene. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera the scene is rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * An array of selected objects. + * + * @type {Array} + */ + selectedObjects: Array; + /** + * The thickness of the edges. + * + * @type {Node} + */ + edgeThicknessNode: Node; + /** + * Can be used for an animated glow/pulse effect. + * + * @type {Node} + */ + edgeGlowNode: Node; + /** + * The downsample ratio. + * + * @type {number} + * @default 2 + */ + downSampleRatio: number; + /** + * The render target for the depth pre-pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetDepthBuffer; + /** + * The render target for the mask pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetMaskBuffer; + /** + * The render target for the mask downsample. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetMaskDownSampleBuffer; + /** + * The first render target for the edge detection. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetEdgeBuffer1; + /** + * The second render target for the edge detection. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetEdgeBuffer2; + /** + * The first render target for the blur pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetBlurBuffer1; + /** + * The second render target for the blur pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetBlurBuffer2; + /** + * The render target for the final composite. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetComposite; + /** + * Represents the near value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraNear; + /** + * Represents the far value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraFar; + /** + * Uniform that represents the blur direction of the pass. + * + * @private + * @type {UniformNode} + */ + private _blurDirection; + /** + * Texture node that holds the data from the depth pre-pass. + * + * @private + * @type {TextureNode} + */ + private _depthTextureUniform; + /** + * Texture node that holds the data from the mask pass. + * + * @private + * @type {TextureNode} + */ + private _maskTextureUniform; + /** + * Texture node that holds the data from the mask downsample pass. + * + * @private + * @type {TextureNode} + */ + private _maskTextureDownsSampleUniform; + /** + * Texture node that holds the data from the first edge detection pass. + * + * @private + * @type {TextureNode} + */ + private _edge1TextureUniform; + /** + * Texture node that holds the data from the second edge detection pass. + * + * @private + * @type {TextureNode} + */ + private _edge2TextureUniform; + /** + * Texture node that holds the current blurred color data. + * + * @private + * @type {TextureNode} + */ + private _blurColorTextureUniform; + /** + * Visible edge color. + * + * @private + * @type {Node} + */ + private _visibleEdgeColor; + /** + * Hidden edge color. + * + * @private + * @type {Node} + */ + private _hiddenEdgeColor; + /** + * The material for the depth pre-pass. + * + * @private + * @type {NodeMaterial} + */ + private _depthMaterial; + _depthSpriteMaterial: SpriteNodeMaterial; + /** + * The material for preparing the mask. + * + * @private + * @type {NodeMaterial} + */ + private _prepareMaskMaterial; + _prepareMaskSpriteMaterial: SpriteNodeMaterial; + /** + * The copy material + * + * @private + * @type {NodeMaterial} + */ + private _materialCopy; + /** + * The edge detection material. + * + * @private + * @type {NodeMaterial} + */ + private _edgeDetectionMaterial; + /** + * The material that is used to render in the blur pass. + * + * @private + * @type {NodeMaterial} + */ + private _separableBlurMaterial; + /** + * The material that is used to render in the blur pass. + * + * @private + * @type {NodeMaterial} + */ + private _separableBlurMaterial2; + /** + * The final composite material. + * + * @private + * @type {NodeMaterial} + */ + private _compositeMaterial; + /** + * A set to cache selected objects in the scene. + * + * @private + * @type {Set} + */ + private _selectionCache; + /** + * The number of selected objects from the previous frame. Used to detect + * the transition to an empty selection so the composite render target can + * be cleared once and avoid leaving a stale outline on screen. + * + * @private + * @type {number} + * @default 0 + */ + private _lastSelectionCount; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * A mask value that represents the visible edge. + * + * @return {Node} The visible edge. + */ + get visibleEdge(): Node; + /** + * A mask value that represents the hidden edge. + * + * @return {Node} The hidden edge. + */ + get hiddenEdge(): Node; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(): PassTextureNode; + /** + * Updates the selection cache based on the selected objects. + * + * @private + */ + private _updateSelectionCache; +} +import { TempNode } from 'three/webgpu'; +import { SpriteNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts new file mode 100644 index 000000000..a63395293 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts @@ -0,0 +1,26 @@ +export default ParallaxBarrierPassNode; +export function parallaxBarrierPass(scene: Scene, camera: Camera): ParallaxBarrierPassNode; +/** + * A render pass node that creates a parallax barrier effect. + * + * @augments StereoCompositePassNode + * @three_import import { parallaxBarrierPass } from 'three/addons/tsl/display/ParallaxBarrierPassNode.js'; + */ +declare class ParallaxBarrierPassNode extends StereoCompositePassNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isParallaxBarrierPassNode: boolean; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import StereoCompositePassNode from './StereoCompositePassNode.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts new file mode 100644 index 000000000..8e2a1b56e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts @@ -0,0 +1,134 @@ +export function pixelationPass(scene: Scene, camera: Camera, pixelSize?: Node | number, normalEdgeStrength?: Node | number, depthEdgeStrength?: Node | number): PixelationPassNode; +export default PixelationPassNode; +/** + * A special render pass node that renders the scene with a pixelation effect. + * + * @augments PassNode + * @three_import import { pixelationPass } from 'three/addons/tsl/display/PixelationPassNode.js'; + */ +declare class PixelationPassNode extends PassNode { + /** + * Constructs a new pixelation pass node. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera to render the scene with. + * @param {Node | number} [pixelSize=6] - The pixel size. + * @param {Node | number} [normalEdgeStrength=0.3] - The normal edge strength. + * @param {Node | number} [depthEdgeStrength=0.4] - The depth edge strength. + */ + constructor(scene: Scene, camera: Camera, pixelSize?: Node | number, normalEdgeStrength?: Node | number, depthEdgeStrength?: Node | number); + /** + * The pixel size. + * + * @type {number} + * @default 6 + */ + pixelSize: number; + /** + * The normal edge strength. + * + * @type {number} + * @default 0.3 + */ + normalEdgeStrength: number; + /** + * The depth edge strength. + * + * @type {number} + * @default 0.4 + */ + depthEdgeStrength: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPixelationPassNode: boolean; + _mrt: any; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PixelationNode} + */ + setup(): PixelationNode; +} +import { PassNode } from 'three/webgpu'; +/** + * A inner node definition that implements the actual pixelation TSL code. + * + * @inner + * @augments TempNode + */ +declare class PixelationNode extends TempNode { + /** + * Constructs a new pixelation node. + * + * @param {TextureNode} textureNode - The texture node that represents the beauty pass. + * @param {TextureNode} depthNode - The texture that represents the beauty's depth. + * @param {TextureNode} normalNode - The texture that represents the beauty's normals. + * @param {Node} pixelSize - The pixel size. + * @param {Node} normalEdgeStrength - The normal edge strength. + * @param {Node} depthEdgeStrength - The depth edge strength. + */ + constructor(textureNode: TextureNode, depthNode: TextureNode, normalNode: TextureNode, pixelSize: Node, normalEdgeStrength: Node, depthEdgeStrength: Node); + /** + * The texture node that represents the beauty pass. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * The texture that represents the beauty's depth. + * + * @type {TextureNode} + */ + depthNode: TextureNode; + /** + * The texture that represents the beauty's normals. + * + * @type {TextureNode} + */ + normalNode: TextureNode; + /** + * The pixel size. + * + * @type {Node} + */ + pixelSize: Node; + /** + * The pixel size. + * + * @type {Node} + */ + normalEdgeStrength: Node; + /** + * The depth edge strength. + * + * @type {Node} + */ + depthEdgeStrength: Node; + /** + * Uniform node that represents the resolution. + * + * @private + * @type {Node} + */ + private _resolution; + /** + * This method is used to update uniforms once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + update(): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts new file mode 100644 index 000000000..efcef8e20 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts @@ -0,0 +1,45 @@ +export default RGBShiftNode; +export function rgbShift(node: Node, amount?: number, angle?: number): RGBShiftNode; +/** + * Post processing node for shifting/splitting RGB color channels. The effect + * separates color channels and offsets them from each other. + * + * @augments TempNode + * @three_import import { rgbShift } from 'three/addons/tsl/display/RGBShiftNode.js'; + */ +declare class RGBShiftNode extends TempNode { + /** + * Constructs a new RGB shift node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {number} [amount=0.005] - The amount of the RGB shift. + * @param {number} [angle=0] - Defines the orientation in which colors are shifted. + */ + constructor(textureNode: TextureNode, amount?: number, angle?: number); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * The amount of the RGB shift. + * + * @type {UniformNode} + */ + amount: UniformNode; + /** + * Defines in which direction colors are shifted. + * + * @type {UniformNode} + */ + angle: UniformNode; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts new file mode 100644 index 000000000..26e36a922 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts @@ -0,0 +1,40 @@ +export default RetroPassNode; +export function retroPass(scene: Scene, camera: Camera, options?: { + affineDistortion?: Node | undefined; +}): RetroPassNode; +/** + * A post-processing pass that applies a retro PS1-style effect to the scene. + * + * This node renders the scene with classic PlayStation 1 visual characteristics: + * - **Vertex snapping**: Vertices are snapped to screen pixels, creating the iconic "wobbly" geometry + * - **Affine texture mapping**: Textures are sampled without perspective correction, resulting in distortion effects + * - **Low resolution**: Default 0.25 scale (typical 320x240 equivalent) + * - **Nearest-neighbor filtering**: Sharp pixelated textures without smoothing + * + * @augments PassNode + */ +declare class RetroPassNode extends PassNode { + /** + * Creates a new RetroPassNode instance. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera to render from. + * @param {Object} [options={}] - Additional options for the retro pass. + * @param {Node} [options.affineDistortion=null] - An optional node to apply affine distortion to UVs. + */ + constructor(scene: Scene, camera: Camera, options?: { + affineDistortion?: Node | undefined; + }); + affineDistortionNode: Node | null; + filterTextures: any; + _materialCache: Map; + /** + * Updates the retro pass before rendering. + * + * @override + * @param {Frame} frame - The current frame information. + * @returns {void} + */ + override updateBefore(frame: Frame): void; +} +import { PassNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts new file mode 100644 index 000000000..412d29a3a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts @@ -0,0 +1,166 @@ +export default SMAANode; +export function smaa(node: Node): SMAANode; +/** + * Post processing node for applying SMAA. Unlike FXAA, this node + * should be applied before converting colors to sRGB. SMAA should produce + * better results than FXAA but is also more expensive to execute. + * + * Used Preset: SMAA 1x Medium (with color edge detection) + * Reference: {@link https://github.com/iryoku/smaa/releases/tag/v2.8}. + * + * @augments TempNode + * @three_import import { smaa } from 'three/addons/tsl/display/SMAANode.js'; + */ +declare class SMAANode extends TempNode { + /** + * Constructs a new SMAA node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + */ + constructor(textureNode: TextureNode); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * The render target used for the edges pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetEdges; + /** + * The render target used for the weights pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetWeights; + /** + * The render target used for the blend pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetBlend; + /** + * Represents the "area" texture used by the SMAA implementation. + * + * @private + * @type {RenderTarget} + */ + private _areaTexture; + /** + * Represents the "search" texture used by the SMAA implementation. + * + * @private + * @type {RenderTarget} + */ + private _searchTexture; + /** + * A uniform node holding the inverse resolution value. + * + * @private + * @type {UniformNode} + */ + private _invSize; + /** + * A uniform texture node holding the area texture. + * + * @private + * @type {TextureNode} + */ + private _areaTextureUniform; + /** + * A uniform texture node holding the search texture. + * + * @private + * @type {TextureNode} + */ + private _searchTextureUniform; + /** + * A uniform texture node representing the edges pass. + * + * @private + * @type {TextureNode} + */ + private _edgesTextureUniform; + /** + * A uniform texture node representing the weights pass. + * + * @private + * @type {TextureNode} + */ + private _weightsTextureUniform; + /** + * The node material that holds the TSL for rendering the edges pass. + * + * @private + * @type {NodeMaterial} + */ + private _materialEdges; + /** + * The node material that holds the TSL for rendering the weights pass. + * + * @private + * @type {NodeMaterial} + */ + private _materialWeights; + /** + * The node material that holds the TSL for rendering the blend pass. + * + * @private + * @type {NodeMaterial} + */ + private _materialBlend; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; + /** + * Returns the area texture as a Base64 string. + * + * @private + * @return {string} The area texture. + */ + private _getAreaTexture; + /** + * Returns the search texture as a Base64 string.. + * + * @private + * @return {string} The search texture. + */ + private _getSearchTexture; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts new file mode 100644 index 000000000..82cbc0ef6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts @@ -0,0 +1,83 @@ +export default SSAAPassNode; +export function ssaaPass(scene: Scene, camera: Camera): SSAAPassNode; +/** + * A special render pass node that renders the scene with SSAA (Supersampling Anti-Aliasing). + * This manual SSAA approach re-renders the scene ones for each sample with camera jitter and accumulates the results. + * + * This node produces a high-quality anti-aliased output but is also extremely expensive because of + * its brute-force approach of re-rendering the entire scene multiple times. + * + * Reference: {@link https://en.wikipedia.org/wiki/Supersampling} + * + * @augments PassNode + * @three_import import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; + */ +declare class SSAAPassNode extends PassNode { + /** + * Constructs a new SSAA pass node. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera to render the scene with. + */ + constructor(scene: Scene, camera: Camera); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSSAAPassNode: boolean; + /** + * The sample level specified as n, where the number of samples is 2^n, + * so sampleLevel = 4, is 2^4 samples, 16. + * + * @type {number} + * @default 4 + */ + sampleLevel: number; + /** + * Whether rounding errors should be mitigated or not. + * + * @type {boolean} + * @default true + */ + unbiased: boolean; + /** + * A uniform node representing the sample weight. + * + * @type {UniformNode} + * @default 1 + */ + sampleWeight: UniformNode; + /** + * Reference to the internal render target that holds the current sample. + * + * @private + * @type {?RenderTarget} + * @default null + */ + private _sampleRenderTarget; + /** + * Reference to the internal quad mesh. + * + * @private + * @type {QuadMesh} + */ + private _quadMesh; + /** + * This method is used to render the SSAA effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + _pixelRatio: any; + /** + * This method is used to setup the effect's MRT configuration and quad mesh. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { PassNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts new file mode 100644 index 000000000..83bcbea9c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts @@ -0,0 +1,213 @@ +export default SSAONode; +export function ssao(depthNode: Node, normalNode: Node, camera: Camera): SSAONode; +/** + * Post processing node for a fast, screen-space ambient occlusion (SSAO). + * + * It point-samples a per-pixel rotated Vogel disk and estimates obscurance with a single depth tap + * per sample, trading the ground-truth accuracy of {@link GTAONode}'s horizon ray-marching for + * lower cost. A built-in separable, depth-aware blur denoises the result so it can be used without + * temporal accumulation. + * ```js + * const scenePass = pass( scene, camera ); + * scenePass.setMRT( mrt( { output, normal: normalView } ) ); + * const scenePassColor = scenePass.getTextureNode( 'output' ); + * const scenePassDepth = scenePass.getTextureNode( 'depth' ); + * const scenePassNormal = scenePass.getTextureNode( 'normal' ); + * + * const aoPass = ssao( scenePassDepth, scenePassNormal, camera ); + * + * renderPipeline.outputNode = scenePassColor.mul( aoPass.r ); + * ``` + * + * @augments TempNode + * @three_import import { ssao } from 'three/addons/tsl/display/SSAONode.js'; + */ +declare class SSAONode extends TempNode { + /** + * Constructs a new SSAO node. + * + * @param {Node} depthNode - A node that represents the scene's depth. + * @param {Node} normalNode - A node that represents the scene's normals. + * @param {Camera} camera - The camera the scene is rendered with. + */ + constructor(depthNode: Node, normalNode: Node, camera: Camera); + /** + * A node that represents the scene's depth. + * + * @type {Node} + */ + depthNode: Node; + /** + * A node that represents the scene's normals. + * + * @type {Node} + */ + normalNode: Node; + /** + * The resolution scale. The effect renders at a fraction of the drawing buffer + * for extra speed; `0.5` is a good default for a low-frequency signal like AO. + * + * @type {number} + * @default 0.5 + */ + resolutionScale: number; + /** + * The world-space radius the occlusion is gathered within. + * + * @type {UniformNode} + */ + radius: UniformNode; + /** + * The strength of the occlusion. + * + * @type {UniformNode} + */ + intensity: UniformNode; + /** + * An angle bias that suppresses self-occlusion on near-flat surfaces. + * + * @type {UniformNode} + */ + bias: UniformNode; + /** + * How many samples are used to estimate the occlusion. A higher value + * results in a smoother result at a higher runtime cost. + * + * @type {UniformNode} + */ + samples: UniformNode; + /** + * Whether the depth-aware blur that denoises the raw AO is applied or not. + * + * @type {boolean} + * @default true + */ + blurEnabled: boolean; + /** + * How strongly the blur rejects samples across depth discontinuities, + * relative to the AO radius. A higher value keeps edges crisper. + * + * @type {UniformNode} + */ + blurSharpness: UniformNode; + /** + * The resolution of the effect. Set from the drawing buffer size and `resolutionScale`. + * + * @type {Vector2} + */ + resolution: Vector2; + /** + * The render target the raw ambient occlusion is rendered into. Also holds the + * final result after the separable blur has ping-ponged back into it. + * + * @private + * @type {RenderTarget} + */ + private _aoRenderTarget; + /** + * The render target the intermediate (horizontally blurred) result is rendered into. + * + * @private + * @type {RenderTarget} + */ + private _blurRenderTarget; + /** + * Represents the projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrix; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * Represents the near value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraNear; + /** + * Represents the far value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraFar; + /** + * The camera the scene is rendered with. + * + * @private + * @type {Camera} + */ + private _camera; + /** + * The input texture the blur material reads from. Swapped between the two render + * targets to run the horizontal and vertical passes with a single material. + * + * @private + * @type {TextureNode} + */ + private _blurInput; + /** + * The blur direction (one texel along x or y). + * + * @private + * @type {UniformNode} + */ + private _blurDirection; + /** + * The material that computes the raw ambient occlusion. + * + * @private + * @type {NodeMaterial} + */ + private _aoMaterial; + /** + * The material that applies the separable, depth-aware blur. + * + * @private + * @type {NodeMaterial} + */ + private _blurMaterial; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; +import { Vector2 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts new file mode 100644 index 000000000..e1a9735aa --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts @@ -0,0 +1,277 @@ +export default SSGINode; +export function ssgi(beautyNode: TextureNode, depthNode: TextureNode, normalNode: TextureNode, camera: Camera): SSGINode; +/** + * Post processing node for applying Screen Space Global Illumination (SSGI) to a scene. + * + * References: + * - {@link https://github.com/cdrinmatane/SSRT3}. + * - {@link https://cdrinmatane.github.io/posts/ssaovb-code/}. + * - {@link https://cdrinmatane.github.io/cgspotlight-slides/ssilvb_slides.pdf}. + * + * The quality and performance of the effect mainly depend on `sliceCount` and `stepCount`. + * The total number of samples taken per pixel is `sliceCount` * `stepCount` * `2`. Here are some + * recommended presets depending on whether temporal filtering is used or not. + * + * With temporal filtering (recommended): + * + * - Low: `sliceCount` of `1`, `stepCount` of `12`. + * - Medium: `sliceCount` of `2`, `stepCount` of `8`. + * - High: `sliceCount` of `3`, `stepCount` of `16`. + * + * Use for a higher slice count if you notice temporal instabilities like flickering. Reduce the sample + * count then to mitigate the performance lost. + * + * Without temporal filtering: + * + * - Low: `sliceCount` of `2`, `stepCount` of `6`. + * - Medium: `sliceCount` of `3`, `stepCount` of `8`. + * - High: `sliceCount` of `4`, `stepCount` of `12`. + * + * @augments TempNode + * @three_import import { ssgi } from 'three/addons/tsl/display/SSGINode.js'; + */ +declare class SSGINode extends TempNode { + /** + * Constructs a new SSGI node. + * + * @param {TextureNode} beautyNode - A texture node that represents the beauty or scene pass. + * @param {TextureNode} depthNode - A texture node that represents the scene's depth. + * @param {TextureNode} normalNode - A texture node that represents the scene's normals. + * @param {PerspectiveCamera} camera - The camera the scene is rendered with. + */ + constructor(beautyNode: TextureNode, depthNode: TextureNode, normalNode: TextureNode, camera: PerspectiveCamera); + /** + * A texture node that represents the beauty or scene pass. + * + * @type {TextureNode} + */ + beautyNode: TextureNode; + /** + * A node that represents the scene's depth. + * + * @type {TextureNode} + */ + depthNode: TextureNode; + /** + * A node that represents the scene's normals. If no normals are passed to the + * constructor (because MRT is not available), normals can be automatically + * reconstructed from depth values in the shader. + * + * @type {TextureNode} + */ + normalNode: TextureNode; + /** + * Number of per-pixel hemisphere slices. This has a big performance cost and should be kept as low as possible. + * Should be in the range `[1, 4]`. + * + * @type {UniformNode} + * @default 1 + */ + sliceCount: UniformNode; + /** + * Number of samples taken along one side of a given hemisphere slice. This has a big performance cost and should + * be kept as low as possible. Should be in the range `[1, 32]`. + * + * @type {UniformNode} + * @default 12 + */ + stepCount: UniformNode; + /** + * Power function applied to AO to make it appear darker/lighter. Should be in the range `[0, 4]`. + * + * @type {UniformNode} + * @default 1 + */ + aoIntensity: UniformNode; + /** + * Intensity of the indirect diffuse light. Should be in the range `[0, 100]`. + * + * @type {UniformNode} + * @default 10 + */ + giIntensity: UniformNode; + /** + * Effective sampling radius in world space. AO and GI can only have influence within that radius. + * Should be in the range `[1, 25]`. + * + * @type {UniformNode} + * @default 12 + */ + radius: UniformNode; + /** + * Makes the sample distance in screen space instead of world-space (helps having more detail up close). + * + * @type {UniformNode} + * @default true + */ + useScreenSpaceSampling: UniformNode; + /** + * Controls samples distribution. It's an exponent applied at each step get increasing step size over the distance. + * Should be in the range `[1, 3]`. + * + * @type {UniformNode} + * @default 2 + */ + expFactor: UniformNode; + /** + * Constant thickness value of objects on the screen in world units. Allows light to pass behind surfaces past that thickness value. + * Should be in the range `[0.01, 10]`. + * + * @type {UniformNode} + * @default 1 + */ + thickness: UniformNode; + /** + * Whether to increase thickness linearly over distance or not (avoid losing detail over the distance). + * + * @type {UniformNode} + * @default false + */ + useLinearThickness: UniformNode; + /** + * How much light backface surfaces emit. + * Should be in the range `[0, 1]`. + * + * @type {UniformNode} + * @default 0 + */ + backfaceLighting: UniformNode; + /** + * Whether to use temporal filtering or not. Setting this property to + * `true` requires the usage of `TRAANode`. This will help to reduce noise + * although it introduces typical TAA artifacts like ghosting and temporal + * instabilities. + * + * If setting this property to `false`, a manual denoise via `DenoiseNode` + * is required. + * + * @type {boolean} + * @default true + */ + useTemporalFiltering: boolean; + /** + * The resolution of the effect. + * + * @private + * @type {UniformNode} + */ + private _resolution; + /** + * Used to compute the effective step radius when viewSpaceSampling is `false`. + * + * @private + * @type {UniformNode} + */ + private _halfProjScale; + /** + * Temporal direction that influences the rotation angle for each slice. + * + * @private + * @type {UniformNode} + */ + private _temporalDirection; + /** + * Temporal offset added to the initial ray step. + * + * @private + * @type {UniformNode} + */ + private _temporalOffset; + /** + * Represents the projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrix; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * Represents the near value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraNear; + /** + * Represents the far value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraFar; + /** + * A reference to the scene's camera. + * + * @private + * @type {PerspectiveCamera} + */ + private _camera; + /** + * The render target the effect is rendered into. The first texture holds the GI, + * the second one the AO. + * + * @private + * @type {RenderTarget} + */ + private _ssgiRenderTarget; + /** + * The material that is used to render the effect. + * + * @private + * @type {NodeMaterial} + */ + private _material; + /** + * The AO result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _aoNode; + /** + * The GI result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _giNode; + /** + * Returns the AO result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the AO result of the effect. + */ + getAONode(): PassTextureNode; + /** + * Returns the GI result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the GI result of the effect. + */ + getGINode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts new file mode 100644 index 000000000..f607c677e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts @@ -0,0 +1,507 @@ +export default SSRNode; +export function ssr(colorNode: Node, depthNode: Node, normalNode: Node, options?: SSRNodeOptions): SSRNode; +export type SSRNodeOptions = { + /** + * - When `false`, traces a single mirror reflection and softens roughness with a blur pass (first-generation SSR). When `true`, varies the reflection direction per pixel with stochastic GGX rays (second-generation SSR); higher quality on rough/glossy surfaces but noisier, so it expects a temporal/spatial denoiser downstream. + */ + stochastic?: boolean | undefined; + /** + * - Per-pixel metalness. Drives GGX reflection sampling and, with `reflectNonMetals=false`, the non-metal early-out. + */ + metalnessNode?: Node; + /** + * - Per-pixel roughness. Drives GGX sampling and the blur mip selection. + */ + roughnessNode?: Node; + /** + * - Only used when `stochastic=false`. When `false`, non-metallic surfaces are discarded for a noticeable performance gain; set `true` to also reflect dielectrics (e.g. marble, polished wood, plastic). + */ + reflectNonMetals?: boolean | undefined; + /** + * - Equirectangular HDR environment map with CPU-side `image.data` (e.g. from RGBELoader). Not compatible with PMREM / `scene.environment` cubemaps. + */ + environmentNode?: Texture; + /** + * - When `true`, precomputes env-luminance CDF tables and uses MIS for environment misses. Build-time only. + */ + envImportanceSampling?: boolean | undefined; + /** + * - Scene diffuse / base color. Defaults to `vec3(1)` in the shader when omitted. + */ + diffuseNode?: Node | undefined; + /** + * - Sub-step binary-search refinement of detected hits. Compile-time constant (baked into the shader at construction). + */ + binaryRefine?: boolean | undefined; + /** + * - Camera the scene is rendered with. Inferred from the color pass when omitted. + */ + camera?: Camera; +}; +/** + * @typedef {Object} SSRNodeOptions + * @property {boolean} [stochastic=false] - When `false`, traces a single mirror reflection and softens roughness with a blur pass (first-generation SSR). When `true`, varies the reflection direction per pixel with stochastic GGX rays (second-generation SSR); higher quality on rough/glossy surfaces but noisier, so it expects a temporal/spatial denoiser downstream. + * @property {Node} [metalnessNode=null] - Per-pixel metalness. Drives GGX reflection sampling and, with `reflectNonMetals=false`, the non-metal early-out. + * @property {Node} [roughnessNode=null] - Per-pixel roughness. Drives GGX sampling and the blur mip selection. + * @property {boolean} [reflectNonMetals=false] - Only used when `stochastic=false`. When `false`, non-metallic surfaces are discarded for a noticeable performance gain; set `true` to also reflect dielectrics (e.g. marble, polished wood, plastic). + * @property {Texture} [environmentNode=null] - Equirectangular HDR environment map with CPU-side `image.data` (e.g. from RGBELoader). Not compatible with PMREM / `scene.environment` cubemaps. + * @property {boolean} [envImportanceSampling=false] - When `true`, precomputes env-luminance CDF tables and uses MIS for environment misses. Build-time only. + * @property {Node} [diffuseNode=null] - Scene diffuse / base color. Defaults to `vec3(1)` in the shader when omitted. + * @property {boolean} [binaryRefine=false] - Sub-step binary-search refinement of detected hits. Compile-time constant (baked into the shader at construction). + * @property {Camera} [camera=null] - Camera the scene is rendered with. Inferred from the color pass when omitted. + */ +/** + * Post processing node for computing screen space reflections (SSR). + * + * Reference: {@link https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html} + * + * @augments TempNode + * @three_import import { ssr } from 'three/addons/tsl/display/SSRNode.js'; + */ +declare class SSRNode extends TempNode { + /** + * Constructs a new SSR node. + * + * @param {Node} colorNode - The node that represents the beauty pass. + * @param {Node} depthNode - A node that represents the beauty pass's depth. + * @param {Node} normalNode - A node that represents the beauty pass's normals. + * @param {SSRNodeOptions} [options] - Optional inputs for material and environment data. + */ + constructor(colorNode: Node, depthNode: Node, normalNode: Node, options?: SSRNodeOptions); + /** + * When `true`, the reflection direction is varied per pixel with stochastic GGX rays + * (second-generation SSR). When `false`, a single mirror reflection is traced and + * roughness is softened with a blur pass (first-generation SSR). + * + * @type {boolean} + */ + stochastic: boolean; + /** + * When `true`, env-luminance CDF tables are built and MIS is used for environment misses. + * Fixed at construction time. + * + * @type {boolean} + */ + envImportanceSampling: boolean; + /** + * The node that represents the beauty pass. + * + * @type {Node} + */ + colorNode: Node; + /** + * A node that represents the scene's diffuse color (typically the MRT `diffuseColor` attachment). + * When `null`, the shader uses `vec3(1)`. + * + * @type {?Node} + */ + diffuseNode: Node | null; + /** + * A node that represents the beauty pass's depth. + * + * @type {Node} + */ + depthNode: Node; + /** + * A node that represents the beauty pass's normals. + * + * @type {Node} + */ + normalNode: Node; + /** + * Per-pixel metalness, used to drive the GGX reflection sampling and the non-metal + * early-out. When `null`, the shader treats surfaces as non-metallic. + * + * @type {?Node} + */ + metalnessNode: Node | null; + /** + * Per-pixel roughness, used to drive the GGX reflection sampling and the blur mip + * selection. When `null`, the shader treats surfaces as fully smooth. + * + * @type {?Node} + */ + roughnessNode: Node | null; + /** + * Only used when {@link SSRNode#stochastic} is `false`. When `false`, non-metallic + * surfaces are discarded for a noticeable performance gain; set `true` to also + * reflect dielectrics. Baked into the shader as a compile-time constant; assigning a + * new value recompiles the SSR material. + * + * @type {boolean} + * @default false + */ + _reflectNonMetals: boolean; + /** + * The resolution scale. Valid values are in the range + * `[0,1]`. `1` means best quality but also results in + * more computational overhead. Setting to `0.5` means + * the effect is computed in half-resolution. + * + * @type {number} + * @default 1 + */ + resolutionScale: number; + /** + * Controls how far a fragment can reflect. Increasing this value result in more + * computational overhead but also increases the reflection distance. + * + * @type {UniformNode} + */ + maxDistance: UniformNode; + /** + * Controls the cutoff between what counts as a possible reflection hit and what does not. + * + * @type {UniformNode} + */ + thickness: UniformNode; + /** + * A multiplier for the overall reflection intensity. `1` leaves the + * reflections unchanged, lower values dim them and higher values boost them. + * + * @type {UniformNode} + * @default 1 + */ + intensity: UniformNode; + /** + * Screen-edge fade width, in UV units. As a screen-space hit approaches a screen + * border, the reflection is faded over this distance — either toward the environment + * reflection ({@link SSRNode#screenEdgeFadeBlack} `false`) or to zero intensity + * (`true`). `0` disables it. + * + * @type {UniformNode} + * @default 0.2 + */ + screenEdgeFade: UniformNode; + /** + * When `true`, SSR fades to zero near screen borders instead of blending toward + * the environment map. Hits are faded by the reflection sample UV; misses are + * faded by the surface pixel UV. + * + * Baked into the shader as a compile-time constant so the unused fade branch is + * eliminated; assigning a new value recompiles the SSR material. + * + * @type {boolean} + * @default false + */ + _screenEdgeFadeBlack: boolean; + /** + * Absolute env luminance cap. HDR env samples above this are scaled down (hue preserved). + * + * @type {UniformNode} + * @default 10 + */ + maxLuminance: UniformNode; + /** + * This parameter controls how detailed the raymarching process works. + * The value ranges is `[0,1]` where `1` means best quality (the maximum number + * of raymarching iterations/samples) and `0` means no samples at all. + * + * A quality of `0.5` is usually sufficient for most use cases. Try to keep + * this parameter as low as possible. Larger values result in noticeable more + * overhead. + * + * @type {UniformNode} + */ + quality: UniformNode; + /** + * Mirror bias for the stochastic GGX sampling. Concentrates the reflected rays toward + * the lobe's narrow (near-mirror) core, trading a small amount of bias for less noise. + * `0` samples the full VNDF lobe; values toward `1` tighten the cone. Range `[0,1]`. + * + * @type {UniformNode} + * @default 0.5 + */ + mirrorBias: UniformNode; + /** + * The quality of the blur. Must be an integer in the range `[1,3]`. + * + * Baked into the blur shader as a compile-time constant so the `(size*2+1)²` + * sample loop unrolls; assigning a new value recompiles the blur material. + * + * @type {number} + * @default 2 + */ + _blurQuality: number; + /** + * Enables sub-step binary-search refinement of a detected hit. When on, a coarse + * crossing is bisected toward the exact intersection (sharper hits, less step + * aliasing) at the cost of extra depth samples. Baked into the shader as a + * compile-time constant; assigning a new value rebuilds the SSR material. + * + * @type {boolean} + * @default false + */ + _binaryRefine: boolean; + /** + * Non-linear step distribution exponent. `1` = uniform steps; `> 1` concentrates + * samples near the ray origin — where most short-range reflections are missed — and + * spaces them out toward maxDistance, as `s = (i / steps) ^ stepExponent`. + * + * Baked into the shader as a compile-time constant so `pow()` folds to a few + * multiplies; assigning a new value recompiles the SSR material. Only used by the + * stochastic reflection path. + * + * @type {number} + * @default 2 + */ + _stepExponent: number; + /** + * HDR environment map for screen-space misses. + * + * @type {?Texture} + */ + environmentNode: Texture | null; + /** + * A node that represents the history texture for multi-bounce reflections. + * + * @type {?Texture} + */ + historyTexture: Texture | null; + /** + * A node that represents the velocity texture for reprojection. + * + * @type {?Node} + */ + velocityTexture: Node | null; + /** + * The camera the scene is rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * The spread of the blur. Automatically set when generating mips. + * + * @private + * @type {UniformNode} + */ + private _blurSpread; + /** + * Represents the projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrix; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * Represents the near value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraNear; + /** + * Represents the far value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraFar; + _cameraWorldMatrix: import("three/webgpu").UniformNode; + _cameraWorldPosition: import("three/webgpu").UniformNode; + _cameraViewMatrix: import("three/webgpu").UniformNode; + _cameraViewMatrixInverse: import("three/webgpu").UniformNode; + /** + * The resolution of the pass. + * + * @private + * @type {UniformNode} + */ + private _resolution; + _noiseIndex: import("three/webgpu").UniformNode; + /** + * CDF-backed environment sampler. Created when {@link setEnvMap} is called. + * + * @private + * @type {?ImportanceSampledEnvironment} + */ + private _importanceEnvironment; + /** + * Intensity multiplier applied to environment-map reflections on screen-space + * misses and at screen edges. Defaults to π to match the former hardcoded multiplier. + * + * @type {UniformNode} + * @default Math.PI + */ + environmentIntensity: UniformNode; + /** + * The render target the SSR is rendered into. + * + * @private + * @type {RenderTarget} + */ + private _ssrRenderTarget; + /** + * The render target for the blurred SSR reflections. + * + * @private + * @type {RenderTarget} + */ + private _blurRenderTarget; + /** + * The material that is used to render the effect. + * + * @private + * @type {NodeMaterial} + */ + private _ssrMaterial; + /** + * The SSR fragment `Fn` and its shared context, captured in {@link SSRNode#setup}. + * Re-invoking the `Fn` produces a fresh node graph, which is how the baked + * compile-time constants are re-applied when they change (see {@link SSRNode#_buildSSRMaterial}). + * + * @private + */ + private _ssrFn; + _sharedContext: any; + /** + * The blur material. + * + * @private + * @type {NodeMaterial} + */ + private _blurMaterial; + /** + * The copy material. + * + * @private + * @type {NodeMaterial} + */ + private _copyMaterial; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Holds the blurred SSR reflections. + * + * @private + * @type {?PassTextureNode} + */ + private _blurredTextureNode; + set stepExponent(value: number); + /** + * Non-linear step distribution exponent (compile-time constant). See the backing + * field for details. Assigning a new value recompiles the SSR material. + * + * @type {number} + */ + get stepExponent(): number; + set blurQuality(value: number); + /** + * Blur kernel size (compile-time constant). Assigning a new value recompiles the + * blur material. + * + * @type {number} + */ + get blurQuality(): number; + /** + * Builds (or rebuilds) the blur material's node graph, baking the current + * {@link SSRNode#blurQuality} as the kernel size so the sample loop unrolls. + * + * @private + */ + private _buildBlurMaterial; + set screenEdgeFadeBlack(value: boolean); + /** + * Whether SSR fades to black near screen borders (compile-time constant). Assigning + * a new value recompiles the SSR material. + * + * @type {boolean} + */ + get screenEdgeFadeBlack(): boolean; + set binaryRefine(value: boolean); + /** + * Whether sub-step binary-search hit refinement is enabled (compile-time constant). + * Assigning a new value rebuilds the SSR material. + * + * @type {boolean} + */ + get binaryRefine(): boolean; + set reflectNonMetals(value: boolean); + /** + * Whether dielectrics are reflected in the non-stochastic path (compile-time constant). + * Assigning a new value rebuilds the SSR material. + * + * @type {boolean} + */ + get reflectNonMetals(): boolean; + /** + * Rebuilds the SSR material's node graph by re-invoking the fragment `Fn`, which + * re-bakes the compile-time constants ({@link SSRNode#binaryRefine}, + * {@link SSRNode#stepExponent}, {@link SSRNode#screenEdgeFadeBlack}) at their current + * values. A no-op until {@link SSRNode#setup} has captured the `Fn`. + * + * @private + */ + private _buildSSRMaterial; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * Wires the feedback inputs for multi-bounce reflections: the previous frame's + * denoised result (`history`) and the velocity buffer used to reproject it + * (`velocity`). `history` accepts the producing node (e.g. a + * {@link RecurrentDenoiseNode}) — its output render target is used — or a raw + * texture. Pass `null` for both to disable multi-bounce. + * + * @param {Texture} history + * @param {Node} velocity + */ + setHistory(history: Texture, velocity: Node): void; + /** + * Sets the environment map for importance-sampled env lighting when + * screen-space rays miss. Call this whenever the scene's env map changes. + * + * Uses {@link ImportanceSampledEnvironment} (CDF + MIS adapted from + * [three-gpu-pathtracer](https://github.com/gkjohnson/three-gpu-pathtracer)). + * + * @param {Texture|null} hdr - The equirectangular HDR environment map, or null to disable. + * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} + */ + setEnvMap(hdr: Texture | null): void; + /** + * Intensity multiplier for the importance-sampled env contribution. + * Only available after {@link setEnvMap} has been called. + * + * @type {?UniformNode} + */ + get envMapIntensity(): UniformNode | null; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; + getRenderTarget(): RenderTarget; +} +import { TempNode } from 'three/webgpu'; +import { RenderTarget } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts new file mode 100644 index 000000000..6137e2373 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts @@ -0,0 +1,226 @@ +export default SSSNode; +export function sss(depthNode: TextureNode, camera: Camera, mainLight: DirectionalLight): SSSNode; +/** + * Post processing node for applying Screen-Space Shadows (SSS) to a scene. + * + * Screen-Space Shadows (also known as Contact Shadows) should ideally be used to complement + * traditional shadow maps. They are best suited for rendering detailed shadows of smaller + * objects at a closer scale like intricate shadowing on highly detailed models. In other words: + * Use Shadow Maps for the foundation and Screen-Space Shadows for the details. + * + * The shadows produced by this implementation might have too hard edges for certain use cases. + * Use a box, gaussian or hash blur to soften the edges before doing the composite with the + * beauty pass. Code example: + * + * ```js + * const sssPass = sss( scenePassDepth, camera, mainLight ); + * + * const sssBlur = boxBlur( sssPass.r, { size: 2, separation: 1 } ); // optional blur + * ``` + * + * Limitations: + * + * - Ideally the maximum shadow length should not exceed `1` meter. Otherwise the effect gets + * computationally very expensive since more samples during the ray marching process are evaluated. + * You can mitigate this issue by reducing the `quality` parameter. + * - The effect can only be used with a single directional light, the main light of your scene. + * This main light usually represents the sun or daylight. + * - Like other Screen-Space techniques SSS can only honor objects in the shadowing computation that + * are currently visible within the camera's view. + * + * References: + * - {@link https://panoskarabelas.com/posts/screen_space_shadows/}. + * - {@link https://www.bendstudio.com/blog/inside-bend-screen-space-shadows/}. + * + * @augments TempNode + * @three_import import { sss } from 'three/addons/tsl/display/SSSNode.js'; + */ +declare class SSSNode extends TempNode { + /** + * Constructs a new SSS node. + * + * @param {TextureNode} depthNode - A texture node that represents the scene's depth. + * @param {Camera} camera - The camera the scene is rendered with. + * @param {DirectionalLight} mainLight - The main directional light of the scene. + */ + constructor(depthNode: TextureNode, camera: Camera, mainLight: DirectionalLight); + /** + * A node that represents the beauty pass's depth. + * + * @type {TextureNode} + */ + depthNode: TextureNode; + /** + * Maximum shadow length in world units. Longer shadows result in more computational + * overhead. + * + * @type {UniformNode} + * @default 0.1 + */ + maxDistance: UniformNode; + /** + * Depth testing thickness. + * + * @type {UniformNode} + * @default 0.01 + */ + thickness: UniformNode; + /** + * Shadow intensity. Must be in the range `[0, 1]`. + * + * @type {UniformNode} + * @default 1.0 + */ + shadowIntensity: UniformNode; + /** + * This parameter controls how detailed the raymarching process works. + * The value ranges is `[0,1]` where `1` means best quality (the maximum number + * of raymarching iterations/samples) and `0` means no samples at all. + * + * A quality of `0.5` is usually sufficient for most use cases. Try to keep + * this parameter as low as possible. Larger values result in noticeable more + * overhead. + * + * @type {UniformNode} + * @default 0.5 + */ + quality: UniformNode; + /** + * The resolution scale. Valid values are in the range + * `[0,1]`. `1` means best quality but also results in + * more computational overhead. Setting to `0.5` means + * the effect is computed in half-resolution. + * + * @type {number} + * @default 1 + */ + resolutionScale: number; + /** + * Whether to use temporal filtering or not. Setting this property to + * `true` requires the usage of `TRAANode`. This will help to reduce noise + * although it introduces typical TAA artifacts like ghosting and temporal + * instabilities. + * + * @type {boolean} + * @default false + */ + useTemporalFiltering: boolean; + /** + * Represents the view matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraViewMatrix; + /** + * Represents the projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrix; + /** + * Represents the inverse projection matrix of the scene's camera. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * Represents the near value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraNear; + /** + * Represents the far value of the scene's camera. + * + * @private + * @type {ReferenceNode} + */ + private _cameraFar; + /** + * The resolution of the pass. + * + * @private + * @type {UniformNode} + */ + private _resolution; + /** + * Temporal offset added to the initial ray step. + * + * @private + * @type {UniformNode} + */ + private _temporalOffset; + /** + * The frame ID use when temporal filtering is enabled. + * + * @private + * @type {UniformNode} + */ + private _frameId; + /** + * A reference to the scene's main light. + * + * @private + * @type {DirectionalLight} + */ + private _mainLight; + /** + * The camera the scene is rendered with. + * + * @private + * @type {Camera} + */ + private _camera; + /** + * The render target the SSS is rendered into. + * + * @private + * @type {RenderTarget} + */ + private _sssRenderTarget; + /** + * The material that is used to render the effect. + * + * @private + * @type {NodeMaterial} + */ + private _material; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts new file mode 100644 index 000000000..a1ddcf38d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts @@ -0,0 +1,9 @@ +/** + * Applies a sepia effect to the given color node. + * + * @tsl + * @function + * @param {Node} color - The color node to apply the sepia for. + * @return {Node} The updated color node. + */ +export const sepia: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts new file mode 100644 index 000000000..2df2ca224 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts @@ -0,0 +1,12 @@ +/** + * Returns a radial gradient from center (white) to edges (black). + * Useful for masking effects based on distance from center. + * + * @tsl + * @function + * @param {Node} [scale=1.0] - Controls the size of the gradient (0 = all black, 1 = full circle). + * @param {Node} [softness=0.5] - Controls the edge softness (0 = hard edge, 1 = soft gradient). + * @param {Node} [coord=uv()] - The input UV coordinates. + * @return {Node} 1.0 at center, 0.0 at edges. + */ +export const circle: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts new file mode 100644 index 000000000..c6886ab8a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts @@ -0,0 +1,96 @@ +export default SharpenNode; +export function sharpen(node: Node, sharpness?: (number | Node), denoise?: (boolean | Node)): SharpenNode; +/** + * Post processing node for contrast-adaptive sharpening (RCAS). + * + * Reference: {@link https://gpuopen.com/fidelityfx-superresolution/}. + * + * @augments TempNode + * @three_import import { sharpen } from 'three/addons/tsl/display/SharpenNode.js'; + */ +declare class SharpenNode extends TempNode { + /** + * Constructs a new sharpen node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + * @param {Node} [sharpness=0.2] - Sharpening strength. 0 = maximum sharpening, 2 = no sharpening. + * @param {Node} [denoise=false] - Whether to attenuate sharpening in noisy areas. + */ + constructor(textureNode: TextureNode, sharpness?: Node, denoise?: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSharpenNode: boolean; + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * Sharpening strength. 0 = maximum, 2 = none. + * + * @type {Node} + * @default 0.2 + */ + sharpness: Node; + /** + * Whether to attenuate sharpening in noisy areas. + * + * @type {Node} + * @default false + */ + denoise: Node; + /** + * The render target for the sharpening pass. + * + * @private + * @type {RenderTarget} + */ + private _renderTarget; + /** + * The result of the effect as a texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * The material for the sharpening pass. + * + * @private + * @type {?NodeMaterial} + */ + private _material; + /** + * Sets the output size of the effect. + * + * @param {number} width - The width in pixels. + * @param {number} height - The height in pixels. + */ + setSize(width: number, height: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts new file mode 100644 index 000000000..251c245d8 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts @@ -0,0 +1,45 @@ +export default SobelOperatorNode; +export function sobel(node: Node): SobelOperatorNode; +/** + * Post processing node for detecting edges with a sobel filter. + * A sobel filter should be applied after tone mapping and output color + * space conversion. + * + * @augments TempNode + * @three_import import { sobel } from 'three/addons/tsl/display/SobelOperatorNode.js'; + */ +declare class SobelOperatorNode extends TempNode { + /** + * Constructs a new sobel operator node. + * + * @param {TextureNode} textureNode - The texture node that represents the input of the effect. + */ + constructor(textureNode: TextureNode); + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * A uniform node holding the inverse resolution value. + * + * @private + * @type {UniformNode} + */ + private _invSize; + /** + * This method is used to update the effect's uniforms once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(): void; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts new file mode 100644 index 000000000..1a310b73f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts @@ -0,0 +1,87 @@ +export default StereoCompositePassNode; +/** + * A special (abstract) render pass node that renders the scene + * as a stereoscopic image. Unlike {@link StereoPassNode}, this + * node merges the image for the left and right eye + * into a single one. That is required for effects like + * anaglyph or parallax barrier. + * + * @abstract + * @augments PassNode + * @three_import import { StereoCompositePassNode } from 'three/addons/tsl/display/StereoCompositePassNode.js'; + */ +declare class StereoCompositePassNode extends PassNode { + /** + * Constructs a new stereo composite pass node. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera to render the scene with. + */ + constructor(scene: Scene, camera: Camera); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStereoCompositePassNode: boolean; + /** + * The internal stereo camera that is used to render the scene. + * + * @type {StereoCamera} + */ + stereo: StereoCamera; + /** + * The render target for rendering the left eye's view. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetL; + /** + * The render target for rendering the right eye's view. + * + * @private + * @type {RenderTarget} + */ + private _renderTargetR; + /** + * A texture node representing the left's eye view. + * + * @private + * @type {TextureNode} + */ + private _mapLeft; + /** + * A texture node representing the right's eye view. + * + * @private + * @type {TextureNode} + */ + private _mapRight; + /** + * The node material that implements the composite. All + * derived effect passes must provide an instance for rendering. + * + * @private + * @type {?NodeMaterial} + * @default null + */ + private _material; + /** + * Updates the internal stereo camera. + * + * @param {number} coordinateSystem - The current coordinate system. + */ + updateStereoCamera(coordinateSystem: number): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + _pixelRatio: any; +} +import { PassNode } from 'three/webgpu'; +import { StereoCamera } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts new file mode 100644 index 000000000..e6d848c84 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts @@ -0,0 +1,40 @@ +export default StereoPassNode; +export function stereoPass(scene: Scene, camera: Camera): StereoPassNode; +/** + * A special render pass node that renders the scene as a stereoscopic image. + * + * @augments PassNode + * @three_import import { stereoPass } from 'three/addons/tsl/display/StereoPassNode.js'; + */ +declare class StereoPassNode extends PassNode { + /** + * Constructs a new stereo pass node. + * + * @param {Scene} scene - The scene to render. + * @param {Camera} camera - The camera to render the scene with. + */ + constructor(scene: Scene, camera: Camera); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStereoPassNode: boolean; + /** + * The internal stereo camera that is used to render the scene. + * + * @type {StereoCamera} + */ + stereo: StereoCamera; + /** + * This method is used to render the stereo effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + _pixelRatio: any; +} +import { PassNode } from 'three/webgpu'; +import { StereoCamera } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts new file mode 100644 index 000000000..b2315c1b2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts @@ -0,0 +1,275 @@ +export default TAAUNode; +export function taau(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera): TAAUNode; +/** + * A special node that performs Temporal Anti-Aliasing Upscaling (TAAU). + * + * Like TRAA, the node accumulates jittered samples over multiple frames and + * reprojects history with motion vectors. Unlike TRAA, the input buffers + * (beauty, depth, velocity) are expected to be rendered at a lower resolution + * than the renderer's drawing buffer — typically by lowering the upstream + * pass's resolution via {@link PassNode#setResolutionScale} — and the resolve + * pass reconstructs an output-resolution image using a 9-tap Blackman-Harris + * filter (Gaussian approximation) over the jittered input samples. The result + * is an alternative to FSR2/3 that does anti-aliasing and upscaling in a + * single pass. + * + * References: + * - Karis, "High Quality Temporal Supersampling", SIGGRAPH 2014, {@link https://advances.realtimerendering.com/s2014/} + * - Riley/Arcila, FidelityFX Super Resolution 2, GDC 2022, {@link https://gpuopen.com/download/GDC_FidelityFX_Super_Resolution_2_0.pdf} + * + * Note: MSAA must be disabled when TAAU is in use. + * + * @augments TempNode + * @three_import import { taau } from 'three/addons/tsl/display/TAAUNode.js'; + */ +declare class TAAUNode extends TempNode { + /** + * Constructs a new TAAU node. + * + * @param {TextureNode} beautyNode - The texture node that represents the input of the effect. + * @param {TextureNode} depthNode - A node that represents the scene's depth. + * @param {TextureNode} velocityNode - A node that represents the scene's velocity. + * @param {Camera} camera - The camera the scene is rendered with. + */ + constructor(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTAAUNode: boolean; + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + beautyNode: TextureNode; + /** + * A node that represents the scene's depth. + * + * @type {TextureNode} + */ + depthNode: TextureNode; + /** + * A node that represents the scene's velocity. + * + * @type {TextureNode} + */ + velocityNode: TextureNode; + /** + * The camera the scene is rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * When the difference between the current and previous depth goes above this threshold, + * the history is considered invalid. + * + * @type {number} + * @default 0.0005 + */ + depthThreshold: number; + /** + * The depth difference within the 3×3 neighborhood to consider a pixel as an edge. + * + * @type {number} + * @default 0.001 + */ + edgeDepthDiff: number; + /** + * The history becomes invalid as the pixel length of the velocity approaches this value. + * + * @type {number} + * @default 128 + */ + maxVelocityLength: number; + /** + * Baseline weight applied to the current frame in the resolve. Lower + * values produce smoother results with longer accumulation but slower + * convergence on disoccluded regions; the motion factor is added on + * top, so fast-moving pixels still respond quickly. + * + * @type {number} + * @default 0.025 + */ + currentFrameWeight: number; + /** + * The jitter index selects the current camera offset value. + * + * @private + * @type {number} + * @default 0 + */ + private _jitterIndex; + /** + * A uniform node holding the current jitter offset in input-pixel + * units. The shader needs this to know where each input sample was + * actually rendered when computing per-tap reconstruction weights. + * + * @private + * @type {UniformNode} + */ + private _jitterOffset; + /** + * The render target that represents the history of frame data. + * Sized to the renderer's drawing buffer (the output resolution). + * + * @private + * @type {?RenderTarget} + */ + private _historyRenderTarget; + /** + * The render target for the resolve. Sized to the renderer's drawing + * buffer (the output resolution). + * + * @private + * @type {?RenderTarget} + */ + private _resolveRenderTarget; + /** + * Render target whose depth attachment holds the previous frame's + * depth buffer. The depth texture must be owned by a render target + * so that `copyTextureToTexture` can copy into it on the WebGL + * backend, which uses a framebuffer blit and therefore needs the + * destination depth texture to be attached to a framebuffer. This + * render target is sized independently of the history target so it + * can match the (lower-resolution) input depth texture. + * + * @private + * @type {RenderTarget} + */ + private _previousDepthRenderTarget; + /** + * Material used for the resolve step. + * + * @private + * @type {NodeMaterial} + */ + private _resolveMaterial; + /** + * Material used to seed the history render target on resize. It + * performs a bilinear upscale of the current beauty buffer into the + * output-sized history target so that the first frames after a + * resize do not fade in from black. + * + * @private + * @type {NodeMaterial} + */ + private _seedMaterial; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Used to save the original/unjittered projection matrix. + * + * @private + * @type {Matrix4} + */ + private _originalProjectionMatrix; + /** + * A uniform node holding the camera's near and far. + * + * @private + * @type {UniformNode} + */ + private _cameraNearFar; + /** + * A uniform node holding the camera world matrix. + * + * @private + * @type {UniformNode} + */ + private _cameraWorldMatrix; + /** + * A uniform node holding the camera world matrix inverse. + * + * @private + * @type {UniformNode} + */ + private _cameraWorldMatrixInverse; + /** + * A uniform node holding the camera projection matrix inverse. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * A uniform node holding the previous frame's view matrix. + * + * @private + * @type {UniformNode} + */ + private _previousCameraWorldMatrix; + /** + * A uniform node holding the previous frame's projection matrix inverse. + * + * @private + * @type {UniformNode} + */ + private _previousCameraProjectionMatrixInverse; + /** + * A texture node for the previous depth buffer. + * + * @private + * @type {TextureNode} + */ + private _previousDepthNode; + /** + * Sync the post processing stack with the TAAU node. + * + * @private + * @type {boolean} + */ + private _needsPostProcessingSync; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the output size of the effect (history and resolve targets). The + * previous-depth texture is sized independently in `updateBefore()` to + * track the scene's current depth texture. + * + * @param {number} outputWidth - The output width (drawing buffer width). + * @param {number} outputHeight - The output height (drawing buffer height). + */ + setSize(outputWidth: number, outputHeight: number): void; + /** + * Defines the TAAU's current jitter as a view offset to the scene's + * camera. The jitter is shrunk to one *output* pixel (rather than one + * input pixel) so that the halton sequence gradually fills the output + * sub-pixel grid over multiple frames. + * + * @param {number} inputWidth - The width of the input buffers the camera renders into. + * @param {number} inputHeight - The height of the input buffers the camera renders into. + */ + setViewOffset(inputWidth: number, inputHeight: number): void; + /** + * Clears the view offset from the scene's camera. + */ + clearViewOffset(): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's render targets and TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts new file mode 100644 index 000000000..56581bb40 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts @@ -0,0 +1,239 @@ +export default TRAANode; +export function traa(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera): TRAANode; +/** + * A special node that applies TRAA (Temporal Reprojection Anti-Aliasing). + * + * References: + * - {@link https://alextardif.com/TAA.html} + * - {@link https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/} + * + * Note: MSAA must be disabled when TRAA is in use. + * + * @augments TempNode + * @three_import import { traa } from 'three/addons/tsl/display/TRAANode.js'; + */ +declare class TRAANode extends TempNode { + /** + * Constructs a new TRAA node. + * + * @param {TextureNode} beautyNode - The texture node that represents the input of the effect. + * @param {TextureNode} depthNode - A node that represents the scene's depth. + * @param {TextureNode} velocityNode - A node that represents the scene's velocity. + * @param {Camera} camera - The camera the scene is rendered with. + */ + constructor(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTRAANode: boolean; + /** + * The texture node that represents the input of the effect. + * + * @type {TextureNode} + */ + beautyNode: TextureNode; + /** + * A node that represents the scene's velocity. + * + * @type {TextureNode} + */ + depthNode: TextureNode; + /** + * A node that represents the scene's velocity. + * + * @type {TextureNode} + */ + velocityNode: TextureNode; + /** + * The camera the scene is rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * When the difference between the current and previous depth goes above this threshold, + * the history is considered invalid. + * + * @type {number} + * @default 0.0005 + */ + depthThreshold: number; + /** + * The depth difference within the 3×3 neighborhood to consider a pixel as an edge. + * + * @type {number} + * @default 0.001 + */ + edgeDepthDiff: number; + /** + * The history becomes invalid as the pixel length of the velocity approaches this value. + * + * @type {number} + * @default 128 + */ + maxVelocityLength: number; + /** + * Whether to decrease the weight on the current frame when the velocity is more subpixel. + * This reduces blurriness under motion, but can introduce a square pattern artifact. + * + * @type {boolean} + * @default true + */ + useSubpixelCorrection: boolean; + /** + * The jitter index selects the current camera offset value. + * + * @private + * @type {number} + * @default 0 + */ + private _jitterIndex; + /** + * A uniform node holding the inverse resolution value. + * + * @private + * @type {UniformNode} + */ + private _invSize; + /** + * The render target that represents the history of frame data. + * + * @private + * @type {?RenderTarget} + */ + private _historyRenderTarget; + /** + * The render target for the resolve. + * + * @private + * @type {?RenderTarget} + */ + private _resolveRenderTarget; + /** + * Material used for the resolve step. + * + * @private + * @type {NodeMaterial} + */ + private _resolveMaterial; + /** + * The result of the effect is represented as a separate texture node. + * + * @private + * @type {PassTextureNode} + */ + private _textureNode; + /** + * Used to save the original/unjittered projection matrix. + * + * @private + * @type {Matrix4} + */ + private _originalProjectionMatrix; + /** + * A uniform node holding the camera's near and far. + * + * @private + * @type {UniformNode} + */ + private _cameraNearFar; + /** + * A uniform node holding the camera world matrix. + * + * @private + * @type {UniformNode} + */ + private _cameraWorldMatrix; + /** + * A uniform node holding the camera world matrix inverse. + * + * @private + * @type {UniformNode} + */ + private _cameraWorldMatrixInverse; + /** + * A uniform node holding the camera projection matrix inverse. + * + * @private + * @type {UniformNode} + */ + private _cameraProjectionMatrixInverse; + /** + * A uniform node holding the previous frame's view matrix. + * + * @private + * @type {UniformNode} + */ + private _previousCameraWorldMatrix; + /** + * A uniform node holding the previous frame's projection matrix inverse. + * + * @private + * @type {UniformNode} + */ + private _previousCameraProjectionMatrixInverse; + /** + * A texture node for the previous depth buffer. + * + * @private + * @type {TextureNode} + */ + private _previousDepthNode; + /** + * Sync the post processing stack with the TRAA node. + * + * @private + * @type {boolean} + */ + private _needsPostProcessingSync; + /** + * The node used to render the scene's velocity. + * + * @private + * @type {?VelocityNode} + */ + private _velocityNode; + /** + * Returns the result of the effect as a texture node. + * + * @return {PassTextureNode} A texture node that represents the result of the effect. + */ + getTextureNode(): PassTextureNode; + /** + * Sets the size of the effect. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setSize(width: number, height: number): void; + /** + * Defines the TRAA's current jitter as a view offset + * to the scene's camera. + * + * @param {number} width - The width of the effect. + * @param {number} height - The height of the effect. + */ + setViewOffset(width: number, height: number): void; + /** + * Clears the view offset from the scene's camera. + */ + clearViewOffset(): void; + /** + * This method is used to render the effect once per frame. + * + * @param {NodeFrame} frame - The current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * This method is used to setup the effect's render targets and TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {PassTextureNode} + */ + setup(builder: NodeBuilder): PassTextureNode; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts new file mode 100644 index 000000000..71665d855 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts @@ -0,0 +1,65 @@ +export default TransitionNode; +export function transition(nodeA: Node, nodeB: Node, mixTextureNode: Node, mixRatio: Node | number, threshold: Node | number, useTexture: Node | number): TransitionNode; +/** + * Post processing node for creating a transition effect between scenes. + * + * @augments TempNode + * @three_import import { transition } from 'three/addons/tsl/display/TransitionNode.js'; + */ +declare class TransitionNode extends TempNode { + /** + * Constructs a new transition node. + * + * @param {TextureNode} textureNodeA - A texture node that represents the beauty pass of the first scene. + * @param {TextureNode} textureNodeB - A texture node that represents the beauty pass of the second scene. + * @param {TextureNode} mixTextureNode - A texture node that defines how the transition effect should look like. + * @param {Node} mixRatioNode - The interpolation factor that controls the mix. + * @param {Node} thresholdNode - Can be used to tweak the linear interpolation. + * @param {Node} useTextureNode - Whether `mixTextureNode` should influence the transition or not. + */ + constructor(textureNodeA: TextureNode, textureNodeB: TextureNode, mixTextureNode: TextureNode, mixRatioNode: Node, thresholdNode: Node, useTextureNode: Node); + /** + * A texture node that represents the beauty pass of the first scene. + * + * @type {TextureNode} + */ + textureNodeA: TextureNode; + /** + * A texture node that represents the beauty pass of the second scene. + * + * @type {TextureNode} + */ + textureNodeB: TextureNode; + /** + * A texture that defines how the transition effect should look like. + * + * @type {TextureNode} + */ + mixTextureNode: TextureNode; + /** + * The interpolation factor that controls the mix. + * + * @type {Node} + */ + mixRatioNode: Node; + /** + * Can be used to tweak the linear interpolation. + * + * @type {Node} + */ + thresholdNode: Node; + /** + * Whether `mixTextureNode` should influence the transition or not. + * + * @type {Node} + */ + useTextureNode: Node; + /** + * This method is used to setup the effect's TSL code. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ShaderCallNodeInternal} + */ + setup(): ShaderCallNodeInternal; +} +import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts new file mode 100644 index 000000000..db00aa0d9 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts @@ -0,0 +1,24 @@ +/** + * Applies a box blur effect to the given texture node. + * + * Compared to Gaussian blur, box blur produces a more blocky result but with better performance when correctly + * configured. It is intended for mobile devices or performance restricted use cases where Gaussian is too heavy. + * + * The (kernel) `size` parameter should be small (1, 2 or 3) since it determines the number of samples based on (size * 2 + 1)^2. + * This implementation uses a single pass approach so the kernel is not applied as a separable filter. That means larger + * kernels won't perform well. Use Gaussian instead if you need a more high-quality blur. + * + * To produce wider blurs, increase the `separation` parameter instead which has no influence on the performance. + * + * Reference: {@link https://github.com/lettier/3d-game-shaders-for-beginners/blob/master/demonstration/shaders/fragment/box-blur.frag}. + * + * @tsl + * @function + * @param {Node} textureNode - The texture node that should be blurred. + * @param {Object} [options={}] - Additional options for the hash blur effect. + * @param {Node} [options.size=int(1)] - Controls the blur's kernel. For performant results, the range should within [1, 3]. + * @param {Node} [options.separation=int(1)] - Spreads out the blur without having to sample additional fragments. Ranges from [1, Infinity]. + * @param {boolean} [options.premultipliedAlpha=false] - Whether to use premultiplied alpha for the blur effect. + * @return {Node} The blurred texture node. + */ +export const boxBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts new file mode 100644 index 000000000..7027dea2f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts @@ -0,0 +1,17 @@ +/** + * Performs a depth-aware blend between a base scene and a secondary effect (like godrays). + * This function uses a Poisson disk sampling pattern to detect depth discontinuities + * in the neighborhood of the current pixel. If an edge is detected, it shifts the + * sampling coordinate for the blend node away from the edge to prevent light leaking/haloing. + * + * @param {Node} baseNode - The main scene/beauty pass texture node. + * @param {Node} blendNode - The effect to be blended (e.g., Godrays, Bloom). + * @param {Node} depthNode - The scene depth texture node. + * @param {Camera} camera - The camera used for the scene. + * @param {Object} [options={}] - Configuration for the blend effect. + * @param {Node|Color} [options.blendColor=Color(0xff0000)] - The color applied to the blend node. + * @param {Node | number} [options.edgeRadius=2] - The search radius (in pixels) for detecting depth edges. + * @param {Node | number} [options.edgeStrength=2] - How far to "push" the UV away from detected edges. + * @returns {Node} The resulting blended color node. + */ +export const depthAwareBlend: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts new file mode 100644 index 000000000..16a271336 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts @@ -0,0 +1,20 @@ +/** + * Applies one pass of a separable, depth-aware (bilateral) blur to a screen-space signal. + * + * The spatial term is a fixed 5-tap gaussian along `directionNode`; the edge-stopping term + * rejects neighbours whose view-space depth differs from the center, so the signal is smoothed + * across surfaces but not across silhouettes. Depth rejection is measured relative to `radius`, + * which keeps it scale invariant. Run it twice (horizontal then vertical) for a full separable + * blur. Handy for denoising a half-resolution effect such as ambient occlusion. + * + * @tsl + * @function + * @param {Node} inputNode - The texture node to blur; its red channel is filtered. + * @param {Node} depthNode - The scene depth texture node. + * @param {Node} directionNode - One texel step along the blur axis, e.g. `vec2( 1 / width, 0 )`. + * @param {Camera} camera - The camera the scene is rendered with. + * @param {Node | number} [sharpness=2] - How strongly a depth difference rejects a neighbour. + * @param {Node | number} [radius=1] - The world-space scale the depth rejection is relative to. + * @returns {Node} The blurred value. + */ +export const depthAwareBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts new file mode 100644 index 000000000..e02a15356 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts @@ -0,0 +1,22 @@ +/** + * Applies a hash blur effect to the given texture node. + * + * The approach of this blur is different compared to Gaussian and box blur since + * it does not rely on a kernel to apply a convolution. Instead, it reads the base + * texture multiple times in a random pattern and then averages the samples. A + * typical artifact of this technique is a slightly noisy appearance of the blur which + * can be mitigated by increasing the number of iterations (see `repeats` parameter). + * Compared to Gaussian blur, hash blur requires just a single pass. + * + * Reference: {@link https://www.shadertoy.com/view/4lXXWn}. + * + * @tsl + * @function + * @param {Node} textureNode - The texture node that should be blurred. + * @param {Node} [bluramount=float(0.1)] - This node determines the amount of blur. + * @param {Object} [options={}] - Additional options for the hash blur effect. + * @param {Node} [options.repeats=float(45)] - The number of iterations for the blur effect. + * @param {boolean} [options.premultipliedAlpha=false] - Whether to use premultiplied alpha for the blur effect. + * @return {Node} The blurred texture node. + */ +export const hashBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts new file mode 100644 index 000000000..0450409a0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts @@ -0,0 +1,20 @@ +/** + * This TSL function blurs an image in a circular pattern, radiating from a configurable center point in screen space. + * + * Radial blurs can be used for different kind of effects like producing simple faked lighting effects also known as + * "light shafts". The major limitation of this specific usage is the center point can only be defined in 2D so the + * effect does not honor the depth of 3D objects. Consequently, it is not intended for physically correct lit scenes. + * + * @tsl + * @function + * @param {Node} textureNode - The texture node that should be blurred. + * @param {Object} [options={}] - Additional options for the radial blur effect. + * @param {Node} [options.center=vec2(0.5, 0.5)] - The center of the light in screen uvs. + * @param {Node} [options.weight=float(0.9)] - Base weight factor for each sample in the range `[0,1]`. + * @param {Node} [options.decay=float(0.95)] - Decreases the weight factor so each iteration adds less to the sum. Must be in the range `[0,1]`. + * If you increase the sample count, you have to increase this option as well to avoid a darking effect. + * @param {Node} [options.count=int(32)] - The number if iterations. Should be in the range `[16,64]`. + * @param {Node} [options.exposure=float(5)] - Exposure control of the blur. + * @return {Node} The blurred texture node. + */ +export const radialBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts new file mode 100644 index 000000000..3fc0b16d1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts @@ -0,0 +1,80 @@ +export default ClusteredLightsNode; +/** + * TSL function that creates a clustered lights node. + * + * @tsl + * @function + * @param {number} [maxLights=1024] - Maximum number of point lights. + * @param {number} [tileSize=32] - Screen tile size in pixels. + * @param {number} [zSlices=24] - Depth slice count. + * @param {number} [maxLightsPerCluster=64] - Per-cluster light-list capacity. + * @return {ClusteredLightsNode} The clustered lights node. + */ +export const clusteredLights: any; +/** + * A custom version of `LightsNode` implementing Forward+ clustered shading: + * the view frustum is subdivided into a 3D grid of clusters (X × Y screen tiles + * times an exponentially-spaced set of Z depth slices), and each cluster holds + * only the point lights whose spheres intersect it. At shading time each fragment + * looks up its cluster and loops over just that cluster's lights. Unlike 2D tiled + * lighting, clustered shading culls lights that share screen pixels but lie at + * different depths — suitable for 3D scenes with real depth complexity. + * + * @augments LightsNode + * @three_import import { clusteredLights } from 'three/addons/tsl/lighting/ClusteredLightsNode.js'; + */ +declare class ClusteredLightsNode extends LightsNode { + /** + * Constructs a new clustered lights node. + * + * @param {number} [maxLights=1024] - Maximum number of point lights. + * @param {number} [tileSize=32] - Screen tile size in pixels (cluster XY size). + * @param {number} [zSlices=24] - Number of exponential depth slices. + * @param {number} [maxLightsPerCluster=64] - Per-cluster light-list capacity. + */ + constructor(maxLights?: number, tileSize?: number, zSlices?: number, maxLightsPerCluster?: number); + materialLights: any[]; + clusteredLights: any[]; + maxLights: number; + tileSize: number; + zSlices: number; + maxLightsPerCluster: number; + _chunksPerCluster: number; + _bufferSize: Vector2 | null; + _lightIndexes: import("three/webgpu").UniformNode | null; + _screenClusterIndex: any; + _compute: any; + _lightsTexture: DataTexture | null; + _zSliceRangesTexture: DataTexture | null; + _zSliceRangesData: Float32Array | null; + _lightViewZ: Float32Array; + _lightSortOrder: any[]; + _lightsCount: import("three/webgpu").UniformNode; + _cameraNear: import("three/webgpu").UniformNode; + _cameraFar: import("three/webgpu").UniformNode; + _cameraViewMatrix: import("three/webgpu").UniformNode; + _cameraProjectionMatrix: import("three/webgpu").UniformNode; + _gridDimensions: import("three/webgpu").UniformNode; + customCacheKey(): any; + updateLightsTexture(camera: any): void; + updateBefore(frame: any): void; + setLights(lights: any): LightsNode; + getBlock(): any; + getTile(element: any): any; + getClusterLightCount(zSliceNode: any): void; + getLightData(index: any): { + position: any; + viewPosition: any; + distance: any; + color: any; + decay: any; + }; + setupLights(builder: any, lightNodes: any): void; + getBufferFitSize(value: any): number; + setSize(width: any, height: any): this; + updateProgram(renderer: any): void; + create(width: any, height: any): void; +} +import { LightsNode } from 'three/webgpu'; +import { Vector2 } from 'three/webgpu'; +import { DataTexture } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts new file mode 100644 index 000000000..4deed63b4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts @@ -0,0 +1,38 @@ +export default DynamicLightsNode; +export function dynamicLights(options?: Object): DynamicLightsNode; +/** + * A custom version of `LightsNode` that batches supported analytic lights into + * uniform arrays and loops. + * + * Unsupported lights, node lights, shadow-casting lights, and projected spot + * lights keep the default per-light path. + * + * @augments LightsNode + * @three_import import { DynamicLightsNode } from 'three/addons/tsl/lighting/DynamicLightsNode.js'; + */ +declare class DynamicLightsNode extends LightsNode { + /** + * Constructs a new dynamic lights node. + * + * @param {Object} [options={}] - Dynamic lighting configuration. + * @param {number} [options.maxDirectionalLights=8] - Maximum number of batched directional lights. + * @param {number} [options.maxPointLights=16] - Maximum number of batched point lights. + * @param {number} [options.maxSpotLights=16] - Maximum number of batched spot lights. + * @param {number} [options.maxHemisphereLights=4] - Maximum number of batched hemisphere lights. + */ + constructor(options?: { + maxDirectionalLights?: number | undefined; + maxPointLights?: number | undefined; + maxSpotLights?: number | undefined; + maxHemisphereLights?: number | undefined; + }); + maxDirectionalLights: number; + maxPointLights: number; + maxSpotLights: number; + maxHemisphereLights: number; + _dataNodes: Map; + setupLightsNode(builder: any): any[]; + setLights(lights: any): this; + _updateDataNodeLights(lights: any): void; +} +import { LightsNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts new file mode 100644 index 000000000..86407abb2 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts @@ -0,0 +1,21 @@ +export const ATLAS_PADDING: 1; +/** + * The light node that applies a {@link LightProbeGrid} to the scene. It samples + * the baked L2 spherical-harmonic atlas at the surface position and adds the + * resulting irradiance to the lighting context, so every standard node material + * picks up the grid automatically (same role as the WebGL `lights_fragment_begin` + * integration). + * + * @private + * @augments AnalyticLightNode + */ +export class LightProbeGridNode extends AnalyticLightNode { + constructor(light?: null); + _min: import("three/webgpu").UniformNode; + _max: import("three/webgpu").UniformNode; + _resolution: import("three/webgpu").UniformNode; + _intensity: import("three/webgpu").UniformNode; + _falloff: import("three/webgpu").UniformNode; + setup(builder: any): void; +} +import { AnalyticLightNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts new file mode 100644 index 000000000..fe894a9c0 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts @@ -0,0 +1,17 @@ +export default AmbientLightDataNode; +/** + * Batched data node for ambient lights in dynamic lighting mode. + * + * @augments Node + */ +declare class AmbientLightDataNode extends Node { + constructor(); + _color: Color; + _lights: any[]; + colorNode: import("three/webgpu").UniformNode; + setLights(lights: any): this; + update(): void; + setup(builder: any): void; +} +import { Node } from 'three/webgpu'; +import { Color } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts new file mode 100644 index 000000000..8aefc7b47 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts @@ -0,0 +1,24 @@ +export default DirectionalLightDataNode; +/** + * Batched data node for directional lights in dynamic lighting mode. + * + * @augments Node + */ +declare class DirectionalLightDataNode extends Node { + constructor(maxCount?: number); + maxCount: number; + _lights: any[]; + _colors: Color[]; + _directions: Vector3[]; + colorsNode: import("three/webgpu").UniformNode; + directionsNode: import("three/webgpu").UniformNode; + countNode: import("three/webgpu").UniformNode; + setLights(lights: any): this; + update({ camera }: { + camera: any; + }): void; + setup(builder: any): void; +} +import { Node } from 'three/webgpu'; +import { Color } from 'three/webgpu'; +import { Vector3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts new file mode 100644 index 000000000..20c3132df --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts @@ -0,0 +1,24 @@ +export default HemisphereLightDataNode; +/** + * Batched data node for hemisphere lights in dynamic lighting mode. + * + * @augments Node + */ +declare class HemisphereLightDataNode extends Node { + constructor(maxCount?: number); + maxCount: number; + _lights: any[]; + _skyColors: Color[]; + _groundColors: Color[]; + _directions: Vector3[]; + skyColorsNode: import("three/webgpu").UniformNode; + groundColorsNode: import("three/webgpu").UniformNode; + directionsNode: import("three/webgpu").UniformNode; + countNode: import("three/webgpu").UniformNode; + setLights(lights: any): this; + update(): void; + setup(builder: any): void; +} +import { Node } from 'three/webgpu'; +import { Color } from 'three/webgpu'; +import { Vector3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts new file mode 100644 index 000000000..693924670 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts @@ -0,0 +1,26 @@ +export default PointLightDataNode; +/** + * Batched data node for point lights in dynamic lighting mode. + * + * @augments Node + */ +declare class PointLightDataNode extends Node { + constructor(maxCount?: number); + maxCount: number; + _lights: any[]; + _colors: Color[]; + _positionsAndCutoff: Vector4[]; + _decays: Vector4[]; + colorsNode: import("three/webgpu").UniformNode; + positionsAndCutoffNode: import("three/webgpu").UniformNode; + decaysNode: import("three/webgpu").UniformNode; + countNode: import("three/webgpu").UniformNode; + setLights(lights: any): this; + update({ camera }: { + camera: any; + }): void; + setup(builder: any): void; +} +import { Node } from 'three/webgpu'; +import { Color } from 'three/webgpu'; +import { Vector4 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts new file mode 100644 index 000000000..b46db542a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts @@ -0,0 +1,30 @@ +export default SpotLightDataNode; +/** + * Batched data node for simple spot lights in dynamic lighting mode. + * + * Projected spot lights keep the default per-light path. + * + * @augments Node + */ +declare class SpotLightDataNode extends Node { + constructor(maxCount?: number); + maxCount: number; + _lights: any[]; + _colors: Color[]; + _positionsAndCutoff: Vector4[]; + _directionsAndDecay: Vector4[]; + _cones: Vector4[]; + colorsNode: import("three/webgpu").UniformNode; + positionsAndCutoffNode: import("three/webgpu").UniformNode; + directionsAndDecayNode: import("three/webgpu").UniformNode; + conesNode: import("three/webgpu").UniformNode; + countNode: import("three/webgpu").UniformNode; + setLights(lights: any): this; + update({ camera }: { + camera: any; + }): void; + setup(builder: any): void; +} +import { Node } from 'three/webgpu'; +import { Color } from 'three/webgpu'; +import { Vector4 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts new file mode 100644 index 000000000..87b7fcb02 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts @@ -0,0 +1,29 @@ +/** + * This TSL function can be used to sample a Bayer16 texture which is a 16x16 texture with a Bayer Matrix pattern. + * It can be used for dithering effects but also as an alternative to blue-noise. When used with Ray Marching + * specifically in {@link VolumeNodeMaterial#offsetNode}, it reduces banding problem, thus being able to use + * fewer steps without affecting the visuals as much. + * + * @tsl + * @function + * @param {Node} uv - The uv to sample the bayer16 texture. + * @return {Node} The sampled bayer value. + */ +export const bayer16: () => void; +/** + * This TSL function applies Bayer dithering to a color input. It uses a 4x4 Bayer matrix + * pattern to add structured noise before color quantization, which helps reduce visible + * color banding when limiting color depth. + * + * @tsl + * @function + * @param {Node} color - The input color to apply dithering to. + * @param {Node} [steps=32] - The number of color steps per channel. + * @return {Node} The dithered color ready for quantization. + * + * @example + * // Apply dithering with posterize + * const ditheredColor = bayerDither( inputColor, 32 ); + * const finalColor = posterize( ditheredColor, 32 ); + */ +export const bayerDither: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts new file mode 100644 index 000000000..a6101efb7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts @@ -0,0 +1,36 @@ +/** + * Permutation polynomial for noise generation. + * + * @tsl + * @function + * @param {Node} x - Input vector. + * @return {Node} Permuted vector. + */ +export const permute: () => void; +/** + * 3D Simplex noise implementation in TSL. + * + * @tsl + * @function + * @param {Node} v - Input coordinate vector. + * @return {Node} Simplex noise value. + */ +export const snoise: () => void; +/** + * 3D Simplex noise vector. Returns a vec3 containing three independent noise samples. + * + * @tsl + * @function + * @param {Node} x - Input coordinate vector. + * @return {Node} Vector of three noise values. + */ +export const snoiseVec3: () => void; +/** + * 3D Curl noise in TSL. Generates a divergence-free vector field from simplex noise. + * + * @tsl + * @function + * @param {Node} p - Input coordinate vector. + * @return {Node} Curl noise vector. + */ +export const curlNoise: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts new file mode 100644 index 000000000..02872393c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts @@ -0,0 +1,50 @@ +/** + * @module VoronoiNoise + * @three_import import { voronoi2d, voronoi3d } from 'three/addons/tsl/math/voronoiNoise.js'; + */ +/** + * Generates a pseudo-random vec2 from the given coordinate. + * + * Reference: {@link https://www.shadertoy.com/view/MslGD8}. + * + * @tsl + * @function + * @param {Node} p - The input coordinate. + * @return {Node} A pseudo-random value in the range `[0, 1]`. + */ +export const hash2d: () => void; +/** + * Animated 2D Voronoi noise. The feature points orbit inside their cells so the + * resulting pattern morphs over time. + * + * Reference: {@link https://www.shadertoy.com/view/MslGD8}. + * + * @tsl + * @function + * @param {Node} p - The input coordinate. + * @param {Node} time - The animation time. + * @return {Node} The squared distance to the closest feature point, roughly in the range `[0, 1]`. + */ +export const voronoi2d: () => void; +/** + * Generates a pseudo-random vec3 from the given coordinate. + * + * @tsl + * @function + * @param {Node} p - The input coordinate. + * @return {Node} A pseudo-random value in the range `[0, 1]`. + */ +export const hash3d: () => void; +/** + * Animated 3D Voronoi noise. Like {@link voronoi2d} but with a volumetric input + * coordinate so the pattern can be applied to arbitrary surfaces without + * projection artifacts. Evaluates 27 cells instead of 9 and is therefore + * considerably more expensive than the 2D version. + * + * @tsl + * @function + * @param {Node} p - The input coordinate. + * @param {Node} time - The animation time. + * @return {Node} The squared distance to the closest feature point, roughly in the range `[0, 1]`. + */ +export const voronoi3d: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts new file mode 100644 index 000000000..70c1b42db --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts @@ -0,0 +1,115 @@ +/** + * A class that extends `ShadowBaseNode` to implement tiled shadow mapping. + * This allows splitting a shadow map into multiple tiles, each with its own light and camera, + * to improve shadow quality and performance for large scenes. + * + * **Note:** This class does not support `VSMShadowMap` at the moment. + * + * @class + * @augments ShadowBaseNode + * @three_import import { TileShadowNode } from 'three/addons/tsl/shadows/TileShadowNode.js'; + */ +export class TileShadowNode extends ShadowBaseNode { + /** + * Creates an instance of `TileShadowNode`. + * + * @param {Light} light - The original light source used for shadow mapping. + * @param {Object} [options={}] - Configuration options for the tiled shadow node. + * @param {number} [options.tilesX=2] - The number of tiles along the X-axis. + * @param {number} [options.tilesY=2] - The number of tiles along the Y-axis. + * @param {Object} [options.resolution] - The resolution of the shadow map. + * @param {boolean} [options.debug=false] - Whether to enable debug mode. + */ + constructor(light: Light, options?: { + tilesX?: number | undefined; + tilesY?: number | undefined; + resolution?: Object | undefined; + debug?: boolean | undefined; + }); + config: { + tilesX: number; + tilesY: number; + resolution: any; + debug: boolean; + }; + debug: boolean; + originalLight: Light; + lightPlane: Plane; + line: Line3; + initialLightDirection: Vector3; + _cameraFrameId: WeakMap; + shadowSize: { + top: any; + bottom: any; + left: any; + right: any; + }; + lights: any[]; + _shadowNodes: any[]; + tiles: Object[]; + /** + * Generates the tiles for the shadow map based on the specified number of tiles along the X and Y axes. + * + * @param {number} tilesX - The number of tiles along the X-axis. + * @param {number} tilesY - The number of tiles along the Y-axis. + * @returns {Array} An array of tile objects, each containing the tile's bounds and index. + */ + generateTiles(tilesX: number, tilesY: number): Array; + /** + * Updates the initial light direction based on the light's target position. + */ + updateLightDirection(): void; + /** + * Initializes the tiled shadow node by creating lights, cameras, and shadow maps for each tile. + * + * @param {Builder} builder - The builder used to create render targets and other resources. + */ + init(builder: Builder): void; + shadowMap: any; + cameraArray: ArrayCamera | undefined; + /** + * Updates the light transformations and shadow cameras for each tile. + */ + update(): void; + /** + * Updates the shadow map rendering. + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateShadow(frame: NodeFrame): void; + _depthVersionCached: any; + /** + * The implementation performs the update of the shadow map if necessary. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateBefore(frame: NodeFrame): void; + /** + * Synchronizes the transformation of a tile light with the source light. + * + * @param {LwLight} lwLight - The tile light to synchronize. + * @param {Light} sourceLight - The source light to copy transformations from. + */ + syncLightTransformation(lwLight: LwLight, sourceLight: Light): void; + /** + * Sets up the shadow node for rendering. + * + * @param {Builder} builder - The builder used to set up the shadow node. + * @returns {Node} A node representing the shadow value. + */ + setup(builder: Builder): Node; + /** + * Helper method to remove lights and associated nodes/targets. + * Used internally during dispose and potential re-initialization. + */ + disposeLightsAndNodes(): void; +} +import { ShadowBaseNode } from 'three/webgpu'; +import { Plane } from 'three/webgpu'; +import { Line3 } from 'three/webgpu'; +import { Vector3 } from 'three/webgpu'; +import { ArrayCamera } from 'three/webgpu'; +declare class LwLight extends Object3D { + target: Object3D; +} +import { Object3D } from 'three/webgpu'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts new file mode 100644 index 000000000..cc99f0e70 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts @@ -0,0 +1,29 @@ +/** + * Helper class to manage and display debug visuals for TileShadowNode. + * + * @augments Group + * @three_import import { TileShadowNodeHelper } from 'three/addons/tsl/shadows/TileShadowNodeHelper.js'; + */ +export class TileShadowNodeHelper extends Group { + /** + * @param {TileShadowNode} tileShadowNode The TileShadowNode instance to debug. + */ + constructor(tileShadowNode: TileShadowNode); + tileShadowNode: any; + config: any; + tiles: any; + _debugMeshes: any[]; + _shadowCamHelpers: any[]; + initialized: boolean; + /** + * Initializes the debug displays (planes and camera helpers). + * Should be called after TileShadowNode has initialized its lights and shadow nodes. + */ + init(): void; + /** + * Updates the debug visuals (specifically camera helpers). + * Should be called within TileShadowNode's update method. + */ + update(): void; +} +import { Group } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts new file mode 100644 index 000000000..e49e7c2b6 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts @@ -0,0 +1,15 @@ +/** + * @module GroundedSkybox + * @three_import import { getGroundProjectedNormal } from 'three/addons/tsl/utils/GroundedSkybox.js'; + */ +/** + * Projects the world position onto a sphere whose bottom is clipped by a ground disk, + * then returns a vector usable for sampling an environment cube map. + * + * @tsl + * @function + * @param {Node} radiusNode - The radius of the projection sphere. Must be large enough to ensure the scene's camera stays inside. + * @param {Node} heightNode - The height is how far the camera that took the photo was above the ground. A larger value will magnify the downward part of the image. + * @return {Node} A direction vector for sampling the environment cube map. + */ +export const getGroundProjectedNormal: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts new file mode 100644 index 000000000..bf4cfffe4 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts @@ -0,0 +1,10 @@ +/** + * Returns a TSL function that samples texture-free analytic R² noise. + * Index 0 uses continuous screen pixels; other indices tile-shift with an R² + * sequence into a 64×64 period. Values are four independent R² dimensions + * hashed from the sample coordinates. + * + * @param {UniformNode} resolution + * @param {number} [seed=0] - Added to the coordinate hash so each pass gets an independent R² phase. + */ +export function bindAnalyticNoise(resolution: UniformNode, seed?: number): () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts new file mode 100644 index 000000000..82ad5f77c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts @@ -0,0 +1 @@ +export function RaymarchingBox(steps: number | Node, callback: Function | FunctionNode): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts new file mode 100644 index 000000000..8df6f566e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts @@ -0,0 +1,19 @@ +/** + * Computes an opacity node for soft particles, based on the "Soft Particles" white + * paper (NVIDIA, Tristan Lorach). + * + * @tsl + * @function + * @param {Object} [parameters={}] - The configuration parameters. + * @param {Node} [parameters.opacity=float(1)] - The sprite's base opacity, which the soft fade is multiplied with. + * @param {Node|number} [parameters.distance=1] - The world-space distance over which the sprite fades out against the scene. + * @param {Node|number} [parameters.contrast=2] - The contrast power of the fade curve. `1` is linear, higher values sharpen the transition. + * @param {Node} [parameters.viewportDepth=viewportDepthTexture()] - The opaque scene depth the particles fade against. + * @return {Node} The opacity node to assign to `material.opacityNode`. + */ +export function softParticles({ opacity, distance, contrast, viewportDepth }?: { + opacity?: Node; + distance?: Node | number; + contrast?: Node | number; + viewportDepth?: Node; +}): Node; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts new file mode 100644 index 000000000..8dfe8a871 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts @@ -0,0 +1,65 @@ +/** + * Specular / microfacet BRDF helpers: VNDF sampling, GTR distribution, Smith geometry, + * Fresnel, reflection importance sampling, parallax-corrected ray-length terms, and + * equirectangular environment sampling / MIS helpers. + * Pure TSL functions of their inputs (no scene/camera state). + */ +/** + * Sentinel ray length the SSR pass writes for environment misses (no screen-space hit), set far above + * any real hit distance so a single magnitude test separates misses from hits and survives `.max( 0 )`. + * + * @type {number} + */ +export const ENV_RAY_LENGTH: number; +/** + * Classification threshold for {@link ENV_RAY_LENGTH}: above this is an env miss, below a real hit. + * An order of magnitude under the sentinel, robust to fp16 storage and bilinear blending at borders. + * + * @type {number} + */ +export const ENV_RAY_LENGTH_THRESHOLD: number; +export const D_GTR: () => void; +export const SmithG: () => void; +export const GeometryTerm: () => void; +/** + * Fresnel reflectance for the Schlick approximation. + */ +export const F_Schlick: () => void; +/** + * Specular dominant factor for parallax-corrected ray length. + * From REBLUR: A Hierarchical Recurrent Denoiser (NRD). + */ +export const getSpecularDominantFactor: any; +/** + * Importance-samples the GGX/VNDF specular lobe for one pixel and returns the reflected + * ray direction plus the Monte-Carlo weight to apply to the gathered radiance, along with + * the GGX terms the SSR env-miss MIS fallback needs. + * + * @param {Node} N - View-space shading normal (normalized). + * @param {Node} V - View-space surface→camera direction (normalized). + * @param {Node} roughness - Perceptual roughness in `[0,1]`. + * @param {Node} metalness - Metalness in `[0,1]`. + * @param {Node} albedo - Surface base color; tints the metal Fresnel reflectance (`f0`). + * @param {Node} Xi - Per-pixel random numbers; only `.xy` are used. + * @return {ggxReflectionStruct} + */ +export const ggxReflectionSample: () => void; +/** + * Equirectangular direction / UV / PDF helpers and MIS weighting shared by environment sampling code. + * Env-miss MIS integration lives in {@link ImportanceSampledEnvironment}. + * + * Equirectangular parameterization helpers used with CDF importance sampling are adapted from + * [three-gpu-pathtracer](https://github.com/gkjohnson/three-gpu-pathtracer). + * + * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} + */ +export const equirectUvToDir: any; +export const equirectDirPdf: any; +/** + * MIS power heuristic with β = 2: `pdfA² / (pdfA² + pdfB²)`. + * Weights the contribution of the strategy that produced `pdfA` against the other strategy. + * + * @see Eric Veach, *Optimally Combining Sampling Techniques for Monte Carlo Rendering* + * @tsl + */ +export const misPowerHeuristic: any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts new file mode 100644 index 000000000..2585bcb59 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts @@ -0,0 +1,124 @@ +/** + * @module BufferGeometryUtils + * @three_import import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + */ +/** + * Computes vertex tangents using the MikkTSpace algorithm. MikkTSpace generates the same tangents consistently, + * and is used in most modelling tools and normal map bakers. Use MikkTSpace for materials with normal maps, + * because inconsistent tangents may lead to subtle visual issues in the normal map, particularly around mirrored + * UV seams. + * + * In comparison to this method, {@link BufferGeometry#computeTangents} (a custom algorithm) generates tangents that + * probably will not match the tangents in other software. The custom algorithm is sufficient for general use with a + * custom material, and may be faster than MikkTSpace. + * + * Returns the original BufferGeometry. Indexed geometries will be de-indexed. Requires position, normal, and uv attributes. + * + * @param {BufferGeometry} geometry - The geometry to compute tangents for. + * @param {Object} MikkTSpace - Instance of `examples/jsm/libs/mikktspace.module.js`, or `mikktspace` npm package. + * Await `MikkTSpace.ready` before use. + * @param {boolean} [negateSign=true] - Whether to negate the sign component (.w) of each tangent. + * Required for normal map conventions in some formats, including glTF. + * @return {BufferGeometry} The updated geometry. + */ +export function computeMikkTSpaceTangents(geometry: BufferGeometry, MikkTSpace: Object, negateSign?: boolean): BufferGeometry; +/** + * Merges a set of geometries into a single instance. All geometries must have compatible attributes. + * + * @param {Array} geometries - The geometries to merge. + * @param {boolean} [useGroups=false] - Whether to use groups or not. + * @return {?BufferGeometry} The merged geometry. Returns `null` if the merge does not succeed. + */ +export function mergeGeometries(geometries: Array, useGroups?: boolean): BufferGeometry | null; +/** + * Merges a set of attributes into a single instance. All attributes must have compatible properties and types. + * Instances of {@link InterleavedBufferAttribute} are not supported. + * + * @param {Array} attributes - The attributes to merge. + * @return {?BufferAttribute} The merged attribute. Returns `null` if the merge does not succeed. + */ +export function mergeAttributes(attributes: Array): BufferAttribute | null; +/** + * Performs a deep clone of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The attribute to clone. + * @return {BufferAttribute} The cloned attribute. + */ +export function deepCloneAttribute(attribute: BufferAttribute): BufferAttribute; +/** + * Returns a new, non-interleaved version of the given attribute. + * + * @param {InterleavedBufferAttribute} attribute - The interleaved attribute. + * @return {BufferAttribute} The non-interleaved attribute. + */ +export function deinterleaveAttribute(attribute: InterleavedBufferAttribute): BufferAttribute; +/** + * Deinterleaves all attributes on the given geometry. + * + * @param {BufferGeometry} geometry - The geometry to deinterleave. + */ +export function deinterleaveGeometry(geometry: BufferGeometry): void; +/** + * Interleaves a set of attributes and returns a new array of corresponding attributes that share a + * single {@link InterleavedBuffer} instance. All attributes must have compatible types. + * + * @param {Array} attributes - The attributes to interleave. + * @return {?Array} An array of interleaved attributes. If interleave does not succeed, the method returns `null`. + */ +export function interleaveAttributes(attributes: Array): Array | null; +/** + * Returns the amount of bytes used by all attributes to represent the geometry. + * + * @param {BufferGeometry} geometry - The geometry. + * @return {number} The estimate bytes used. + */ +export function estimateBytesUsed(geometry: BufferGeometry): number; +/** + * Returns a new geometry with vertices for which all similar vertex attributes (within tolerance) are merged. + * + * @param {BufferGeometry} geometry - The geometry to merge vertices for. + * @param {number} [tolerance=1e-4] - The tolerance value. + * @return {BufferGeometry} - The new geometry with merged vertices. + */ +export function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry; +/** + * Converts the given geometry to the `TrianglesDrawMode` draw mode, which + * corresponds to the `gl.TRIANGLES` primitive in WebGL. The conversion only + * rewrites the index, so the geometry is modified in place and returned. + * + * @param {BufferGeometry} geometry - The geometry to convert. + * @param {number} drawMode - The current draw mode. + * @return {BufferGeometry} The converted geometry using `TrianglesDrawMode`. + */ +export function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: number): BufferGeometry; +/** + * Calculates the morphed attributes of a morphed/skinned BufferGeometry. + * + * Helpful for Raytracing or Decals (i.e. a `DecalGeometry` applied to a morphed Object with a `BufferGeometry` + * will use the original `BufferGeometry`, not the morphed/skinned one, generating an incorrect result. + * Using this function to create a shadow `Object3`D the `DecalGeometry` can be correctly generated). + * + * @param {Mesh|Line|Points} object - The 3D object to compute morph attributes for. + * @return {Object} An object with original position/normal attributes and morphed ones. + */ +export function computeMorphedAttributes(object: Mesh | Line | Points): Object; +/** + * Merges the {@link BufferGeometry#groups} for the given geometry. + * + * @param {BufferGeometry} geometry - The geometry to modify. + * @return {BufferGeometry} - The updated geometry + */ +export function mergeGroups(geometry: BufferGeometry): BufferGeometry; +/** + * Modifies the supplied geometry if it is non-indexed, otherwise creates a new, + * non-indexed geometry. Returns the geometry with smooth normals everywhere except + * faces that meet at an angle greater than the crease angle. + * + * @param {BufferGeometry} geometry - The geometry to modify. + * @param {number} [creaseAngle=Math.PI/3] - The crease angle in radians. + * @return {BufferGeometry} - The updated geometry + */ +export function toCreasedNormals(geometry: BufferGeometry, creaseAngle?: number): BufferGeometry; +import { BufferGeometry } from 'three'; +import { BufferAttribute } from 'three'; +import { InterleavedBufferAttribute } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts new file mode 100644 index 000000000..42813c0bf --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts @@ -0,0 +1,14 @@ +/** + * Set projection matrix and the orientation of a perspective camera + * to exactly frame the corners of an arbitrary rectangle. + * NOTE: This function ignores the standard parameters; + * do not call `updateProjectionMatrix()` after this. + * + * @param {PerspectiveCamera} camera - The camera. + * @param {Vector3} bottomLeftCorner - The bottom-left corner point. + * @param {Vector3} bottomRightCorner - The bottom-right corner point. + * @param {Vector3} topLeftCorner - The top-left corner point. + * @param {boolean} [estimateViewFrustum=false] - If set to `true`, the function tries to estimate the camera's FOV. + */ +export function frameCorners(camera: PerspectiveCamera, bottomLeftCorner: Vector3, bottomRightCorner: Vector3, topLeftCorner: Vector3, estimateViewFrustum?: boolean): void; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts new file mode 100644 index 000000000..fd8d570bc --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts @@ -0,0 +1,20 @@ +/** + * @module ColorUtils + * @three_import import * as ColorUtils from 'three/addons/utils/ColorUtils.js'; + */ +/** + * Sets the given color from a color temperature in Kelvin. + * + * Converts a correlated color temperature (CTT) to an approximate sRGB color + * using Tanner Helland's algorithm. Useful for physically-based lighting + * setups — e.g. candle flame (~1900K), tungsten bulb (~3200K), daylight + * (~6500K), or clear blue sky (~10000K). Values outside [1000, 40000] are + * clamped. + * + * Reference: https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html + * + * @param {Color} color - The color to set. + * @param {number} kelvin - Color temperature in Kelvin. Clamped to [1000, 40000]. + * @return {Color} The updated color. + */ +export function setKelvin(color: Color, kelvin: number): Color; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts new file mode 100644 index 000000000..ab8bda46a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts @@ -0,0 +1,28 @@ +export const SH_BAND_COMPONENTS: number[]; +export const SH_BAND_WORDS: number[]; +export const SH_C0: 0.2820947917738781; +/** + * Creates Gaussian splat geometry from packed attribute arrays. Higher-order + * spherical harmonics must be supplied as packed `Uint32Array` words + * (`SH_BAND_WORDS[ degree ]` words per splat, four clamped-byte coefficients + * per word using `( value - 128 ) / 128`). + * + * @param {Float32Array} centers - Splat centers. + * @param {Float32Array} covariances - Splat covariance matrices. + * @param {Uint8Array|Uint8ClampedArray} colors - RGBA colors. + * @param {Object} [sphericalHarmonics={}] - Optional packed SH band arrays. + * @return {BufferGeometry} The Gaussian splat geometry. + */ +export function createGaussianSplatGeometry(centers: Float32Array, covariances: Float32Array, colors: Uint8Array | Uint8ClampedArray, sphericalHarmonics?: Object): BufferGeometry; +export function createPackedSphericalHarmonicsBand(count: any, degree: any): { + packed: Uint32Array; + bytes: Uint8ClampedArray; +}; +export function getSphericalHarmonicsDegree(geometry: any): number; +export function linearToSH0(color: any): number; +export function sh0ToLinear(coefficient: any): number; +export function sigmoid(value: any): number; +export function writeColorBytes(target: any, offset: any, r: any, g: any, b: any, a: any): void; +export function writeColorBytesFromSH0(target: any, offset: any, r: any, g: any, b: any, a: any): void; +export function writeCovariance(target: any, offset: any, sx: any, sy: any, sz: any, qx: any, qy: any, qz: any, qw: any): void; +import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts new file mode 100644 index 000000000..30aa1ef4b --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts @@ -0,0 +1,23 @@ +/** + * @module GeometryCompressionUtils + * @three_import import * as GeometryCompressionUtils from 'three/addons/utils/GeometryCompressionUtils.js'; + */ +/** + * Compressed the given geometry's `normal` attribute by the selected encode method. + * + * @param {BufferGeometry} geometry - The geometry whose normals should be compressed. + * @param {('DEFAULT'|'OCT1Byte'|'OCT2Byte'|'ANGLES')} encodeMethod - The compression method. + */ +export function compressNormals(geometry: BufferGeometry, encodeMethod: ("DEFAULT" | "OCT1Byte" | "OCT2Byte" | "ANGLES")): void; +/** + * Compressed the given geometry's `position` attribute. + * + * @param {BufferGeometry} geometry - The geometry whose position values should be compressed. + */ +export function compressPositions(geometry: BufferGeometry): void; +/** + * Compressed the given geometry's `uv` attribute. + * + * @param {BufferGeometry} geometry - The geometry whose texture coordinates should be compressed. + */ +export function compressUvs(geometry: BufferGeometry): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts new file mode 100644 index 000000000..a5d2f6c5e --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts @@ -0,0 +1,48 @@ +/** + * @module GeometryUtils + * @three_import import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; + */ +/** + * Generates 2D-Coordinates along a Hilbert curve. + * + * Based on work by: {@link http://www.openprocessing.org/sketch/15493} + * + * @param {Vector3} [center] - Center of Hilbert curve. + * @param {number} [size=10] - Total width of Hilbert curve. + * @param {number} [iterations=10] - Number of subdivisions. + * @param {number} [v0=0] - Corner index -X, -Z. + * @param {number} [v1=1] - Corner index -X, +Z. + * @param {number} [v2=2] - Corner index +X, +Z. + * @param {number} [v3=3] - Corner index +X, -Z. + * @returns {Array} The Hilbert curve points. + */ +export function hilbert2D(center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number): Array; +/** + * Generates 3D-Coordinates along a Hilbert curve. + * + * Based on work by: {@link https://openprocessing.org/user/5654} + * + * @param {Vector3} [center] - Center of Hilbert curve. + * @param {number} [size=10] - Total width of Hilbert curve. + * @param {number} [iterations=1] - Number of subdivisions. + * @param {number} [v0=0] - Corner index -X, +Y, -Z. + * @param {number} [v1=1] - Corner index -X, +Y, +Z. + * @param {number} [v2=2] - Corner index -X, -Y, +Z. + * @param {number} [v3=3] - Corner index -X, -Y, -Z. + * @param {number} [v4=4] - Corner index +X, -Y, -Z. + * @param {number} [v5=5] - Corner index +X, -Y, +Z. + * @param {number} [v6=6] - Corner index +X, +Y, +Z. + * @param {number} [v7=7] - Corner index +X, +Y, -Z. + * @returns {Array} - The Hilbert curve points. + */ +export function hilbert3D(center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number): Array; +/** + * Generates a Gosper curve (lying in the XY plane). + * + * Reference: {@link https://gist.github.com/nitaku/6521802} + * + * @param {number} [size=1] - The size of a single gosper island. + * @return {Array} The gosper island points. + */ +export function gosper(size?: number): Array; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts new file mode 100644 index 000000000..6345ec25f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts @@ -0,0 +1,17 @@ +/** + * Utility class for LDraw models. + * + * @three_import import { LDrawUtils } from 'three/addons/utils/LDrawUtils.js'; + */ +export class LDrawUtils { + /** + * Merges geometries in the given object by materials and returns a new group object. + * Use on not indexed geometries. The object buffers reference the old object ones. + * Special treatment is done to the conditional lines generated by LDrawLoader. + * + * @param {Object3D} object - The object to merge. + * @returns {Group} The merged object. + */ + static mergeObject(object: Object3D): Group; +} +import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts new file mode 100644 index 000000000..e8def1ced --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts @@ -0,0 +1,72 @@ +/** + * ~Options + */ +export type SceneOptimizer = { + /** + * - Whether to enable debug mode or not. + */ + debug?: boolean | undefined; +}; +/** + * This class can be used to optimized scenes by converting + * individual meshes into {@link BatchedMesh}. This component + * is an experimental attempt to implement auto-batching in three.js. + * + * @three_import import { SceneOptimizer } from 'three/addons/utils/SceneOptimizer.js'; + */ +export class SceneOptimizer { + /** + * Constructs a new scene optimizer. + * + * @param {Scene} scene - The scene to optimize. + * @param {SceneOptimizer~Options} options - The configuration options. + */ + constructor(scene: Scene, options?: {}); + scene: Scene; + debug: any; + _bufferToHash(buffer: any): number; + _getMaterialPropertiesHash(material: any): string; + _getAttributesSignature(geometry: any): string; + _getGeometryHash(geometry: any): string; + _getBatchKey(materialProps: any, attributesSignature: any): string; + _analyzeModel(): { + batchGroups: Map; + singleGroups: Map; + uniqueGeometries: number; + }; + _createBatchedMeshes(batchGroups: any): Set; + /** + * Removes empty nodes from all descendants of the given 3D object. + * + * @param {Object3D} object - The 3D object to process. + */ + removeEmptyNodes(object: Object3D): void; + /** + * Removes the given array of meshes from the scene. + * + * @param {Set} meshesToRemove - The meshes to remove. + */ + disposeMeshes(meshesToRemove: Set): void; + _logDebugInfo(stats: any): void; + /** + * Performs the auto-baching by identifying groups of meshes in the scene + * that can be represented as a single {@link BatchedMesh}. The method modifies + * the scene by adding instances of `BatchedMesh` and removing the now redundant + * individual meshes. + * + * @return {Scene} The optimized scene. + */ + toBatchedMesh(): Scene; + /** + * Performs the auto-instancing by identifying groups of meshes in the scene + * that can be represented as a single {@link InstancedMesh}. The method modifies + * the scene by adding instances of `InstancedMesh` and removing the now redundant + * individual meshes. + * + * This method is not yet implemented. + * + * @abstract + * @return {Scene} The optimized scene. + */ + toInstancingMesh(): Scene; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts new file mode 100644 index 000000000..c25850d82 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts @@ -0,0 +1,72 @@ +/** + * This function creates a mesh for each instance of the given instanced mesh and + * adds it to a group. Each mesh will honor the current 3D transformation of its + * corresponding instance. + * + * @param {InstancedMesh} instancedMesh - The instanced mesh. + * @return {Group} A group of meshes. + */ +export function createMeshesFromInstancedMesh(instancedMesh: InstancedMesh): Group; +/** + * This function creates a mesh for each geometry-group of the given multi-material mesh and + * adds it to a group. + * + * @param {Mesh} mesh - The multi-material mesh. + * @return {Group} A group of meshes. + */ +export function createMeshesFromMultiMaterialMesh(mesh: Mesh): Group; +/** + * This function represents an alternative way to create 3D objects with multiple materials. + * Normally, {@link BufferGeometry#groups} are used which might introduce issues e.g. when + * exporting the object to a 3D format. This function accepts a geometry and an array of + * materials and creates for each material a mesh that is added to a group. + * + * @param {BufferGeometry} geometry - The geometry. + * @param {Array} materials - An array of materials. + * @return {Group} A group representing a multi-material object. + */ +export function createMultiMaterialObject(geometry: BufferGeometry, materials: Array): Group; +/** + * Executes a reducer function for each vertex of the given 3D object. + * `reduceVertices()` returns a single value: the function's accumulated result. + * + * @param {Object3D} object - The 3D object that should be processed. It must have a + * geometry with a `position` attribute. + * @param {function(number,Vector3):number} func - The reducer function. First argument + * is the current value, second argument the current vertex. + * @param {any} initialValue - The initial value. + * @return {any} The result. + */ +export function reduceVertices(object: Object3D, func: (arg0: number, arg1: Vector3) => number, initialValue: any): any; +/** + * Sorts the instances of the given instanced mesh. + * + * @param {InstancedMesh} mesh - The instanced mesh to sort. + * @param {function(number, number):number} compareFn - A custom compare function for the sort. + */ +export function sortInstancedMesh(mesh: InstancedMesh, compareFn: (arg0: number, arg1: number) => number): void; +/** + * Generator based alternative to {@link Object3D#traverse}. + * + * @param {Object3D} object - Object to traverse. + * @yields {Object3D} Objects that passed the filter condition. + */ +export function traverseGenerator(object: Object3D): any; +/** + * Generator based alternative to {@link Object3D#traverseVisible}. + * + * @param {Object3D} object Object to traverse. + * @yields {Object3D} Objects that passed the filter condition. + */ +export function traverseVisibleGenerator(object: Object3D): any; +/** + * Generator based alternative to {@link Object3D#traverseAncestors}. + * + * @param {Object3D} object Object to traverse. + * @yields {Object3D} Objects that passed the filter condition. + */ +export function traverseAncestorsGenerator(object: Object3D): any; +import { Group } from 'three'; +import { Mesh } from 'three'; +import { BufferGeometry } from 'three'; +import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts new file mode 100644 index 000000000..868c5d524 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts @@ -0,0 +1,72 @@ +/** + * This is a helper for visualising a given light's shadow map. + * It works for shadow casting lights: DirectionalLight and SpotLight. + * It renders out the shadow map and displays it on a HUD. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * import the class from `ShadowMapViewerGPU.js`. + * + * ```js + * const lightShadowMapViewer = new ShadowMapViewer( light ); + * lightShadowMapViewer.position.x = 10; + * lightShadowMapViewer.position.y = SCREEN_HEIGHT - ( SHADOW_MAP_HEIGHT / 4 ) - 10; + * lightShadowMapViewer.size.width = SHADOW_MAP_WIDTH / 4; + * lightShadowMapViewer.size.height = SHADOW_MAP_HEIGHT / 4; + * lightShadowMapViewer.update(); + * ``` + * + * @three_import import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; + */ +export class ShadowMapViewer { + /** + * Constructs a new shadow map viewer. + * + * @param {Light} light - The shadow casting light. + */ + constructor(light: Light); + /** + * Whether to display the shadow map viewer or not. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * The size of the viewer. When changing this property, make sure + * to call {@link ShadowMapViewer#update}. + * + * @type {{width:number,height:number}} + * @default true + */ + size: { + width: number; + height: number; + }; + /** + * The position of the viewer. When changing this property, make sure + * to call {@link ShadowMapViewer#update}. + * + * @type {{x:number,y:number, set:function(number,number)}} + * @default true + */ + position: { + x: number; + y: number; + set: (arg0: number, arg1: number) => any; + }; + /** + * Renders the viewer. This method must be called in the app's animation loop. + * + * @param {WebGLRenderer} renderer - The renderer. + */ + render: (renderer: WebGLRenderer) => void; + /** + * Resizes the viewer. This method should be called whenever the app's + * window is resized. + */ + updateForWindowResize: () => void; + /** + * Updates the viewer. + */ + update: () => void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts new file mode 100644 index 000000000..b32070902 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts @@ -0,0 +1,71 @@ +/** + * This is a helper for visualising a given light's shadow map. + * It works for shadow casting lights: DirectionalLight and SpotLight. + * It renders out the shadow map and displays it on a HUD. + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * import the class from `ShadowMapViewer.js`. + * + * ```js + * const lightShadowMapViewer = new ShadowMapViewer( light ); + * lightShadowMapViewer.position.x = 10; + * lightShadowMapViewer.position.y = SCREEN_HEIGHT - ( SHADOW_MAP_HEIGHT / 4 ) - 10; + * lightShadowMapViewer.size.width = SHADOW_MAP_WIDTH / 4; + * lightShadowMapViewer.size.height = SHADOW_MAP_HEIGHT / 4; + * lightShadowMapViewer.update(); + * ``` + * + * @three_import import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewerGPU.js'; + */ +export class ShadowMapViewer { + /** + * Constructs a new shadow map viewer. + * + * @param {Light} light - The shadow casting light. + */ + constructor(light: Light); + /** + * Whether to display the shadow map viewer or not. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * The size of the viewer. When changing this property, make sure + * to call {@link ShadowMapViewer#update}. + * + * @type {{width:number,height:number}} + * @default true + */ + size: { + width: number; + height: number; + }; + /** + * The position of the viewer. When changing this property, make sure + * to call {@link ShadowMapViewer#update}. + * + * @type {{width:number,height:number}} + * @default true + */ + position: { + width: number; + height: number; + }; + /** + * Renders the viewer. This method must be called in the app's animation loop. + * + * @param {WebGPURenderer} renderer - The renderer. + */ + render: (renderer: WebGPURenderer) => void; + /** + * Resizes the viewer. This method should be called whenever the app's + * window is resized. + */ + updateForWindowResize: () => void; + /** + * Updates the viewer. + */ + update: () => void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts new file mode 100644 index 000000000..d4841dd3a --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts @@ -0,0 +1,97 @@ +/** + * :SkeletonUtils~RetargetOptions + */ +export type module = { + /** + * - Whether to use the position of the first frame or not. + */ + useFirstFramePosition?: boolean | undefined; + /** + * - The FPS of the clip. + */ + fps?: number | undefined; + /** + * - A dictionary for mapping target to source bone names. + */ + names?: { + [x: string]: string; + } | undefined; + /** + * - A function for mapping bone names. Alternative to `names`. + */ + getBoneName?: ((arg0: string) => string) | undefined; + /** + * - Whether to trim the clip or not. If set the array should hold two values for the start and end. + */ + trim?: number[] | undefined; + /** + * - Whether to preserve bone matrices or not. + */ + preserveBoneMatrix?: boolean | undefined; + /** + * - Whether to preserve bone positions or not. + */ + preserveBonePositions?: boolean | undefined; + /** + * - Whether to use the target matrix or not. + */ + useTargetMatrix?: boolean | undefined; + /** + * - The name of the source's hip bone. + */ + hip?: string | undefined; + /** + * - The hip influence. + */ + hipInfluence?: Vector3 | undefined; + /** + * - The scale. + */ + scale?: number | undefined; + /** + * - Per-bone local offset matrices, keyed by bone name. + */ + localOffsets?: { + [x: string]: Matrix4; + } | undefined; + /** + * - An additional position offset applied to the hip bone. + */ + hipPosition?: Vector3 | undefined; +}; +/** + * Retargets the skeleton from the given source to the target. + * + * Both `target` and `source` can be a 3D object with a skeleton property (e.g. a skinned mesh) + * or a {@link Skeleton} directly. + * + * @param {Object3D|Skeleton} target - The target object. + * @param {Object3D|Skeleton} source - The source object. + * @param {module:SkeletonUtils~RetargetOptions} options - The options. + */ +export function retarget(target: Object3D | Skeleton, source: Object3D | Skeleton, options?: any): void; +/** + * Retargets the animation clip of the source to the target 3D object. + * + * The `source` can be a 3D object with a skeleton property (e.g. a skinned mesh) + * or a {@link Skeleton} directly. + * + * @param {Object3D} target - The target 3D object. Must have a `skeleton` property. + * @param {Object3D|Skeleton} source - The source object. + * @param {AnimationClip} clip - The animation clip. + * @param {module:SkeletonUtils~RetargetOptions} options - The options. + * @return {AnimationClip} The retargeted animation clip. + */ +export function retargetClip(target: Object3D, source: Object3D | Skeleton, clip: AnimationClip, options?: any): AnimationClip; +/** + * Clones the given 3D object and its descendants, ensuring that any `SkinnedMesh` instances are + * correctly associated with their bones. Bones are also cloned, and must be descendants of the + * object passed to this method. Other data, like geometries and materials, are reused by reference. + * + * @param {Object3D} source - The 3D object to clone. + * @return {Object3D} The cloned 3D object. + */ +export function clone(source: Object3D): Object3D; +import { Vector3 } from 'three'; +import { Matrix4 } from 'three'; +import { AnimationClip } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts new file mode 100644 index 000000000..c3b427e51 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts @@ -0,0 +1 @@ +export function radixSort(arr: Array, opt: Object): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts new file mode 100644 index 000000000..241f84f5f --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts @@ -0,0 +1,16 @@ +/** + * @module UVsDebug + * @three_import import { UVsDebug } from 'three/addons/utils/UVsDebug.js'; + */ +/** + * Function for "unwrapping" and debugging three.js geometries UV mapping. + * + * ```js + * document.body.appendChild( UVsDebug( new THREE.SphereGeometry() ) ); + * ``` + * + * @param {BufferGeometry} geometry - The geometry whose uv coordinates should be inspected. + * @param {number} [size=1024] - The size of the debug canvas. + * @return {HTMLCanvasElement} A canvas element with visualized uv coordinates. + */ +export function UVsDebug(geometry: BufferGeometry, size?: number): HTMLCanvasElement; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts new file mode 100644 index 000000000..80f87055c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts @@ -0,0 +1,14 @@ +/** + * Returns an uncompressed version of the given compressed texture. + * + * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, + * import the function from {@link module:WebGPUTextureUtils}. + * + * @param {CompressedTexture} texture - The compressed texture. + * @param {number} [maxTextureSize=Infinity] - The maximum size of the uncompressed texture. + * @param {?WebGLRenderer} [renderer=null] - A reference to a renderer. + * @return {CanvasTexture} The uncompressed texture. + */ +export function decompress(texture: CompressedTexture, maxTextureSize?: number, renderer?: WebGLRenderer | null): CanvasTexture; +import { WebGLRenderer } from 'three'; +import { CanvasTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts new file mode 100644 index 000000000..6a415b8bf --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts @@ -0,0 +1,15 @@ +/** + * Returns an uncompressed version of the given compressed texture. + * + * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, + * import the function from {@link module:WebGLTextureUtils}. + * + * @async + * @param {CompressedTexture} blitTexture - The compressed texture. + * @param {number} [maxTextureSize=Infinity] - The maximum size of the uncompressed texture. + * @param {?WebGPURenderer} [renderer=null] - A reference to a renderer. + * @return {Promise} A Promise that resolved with the uncompressed texture. + */ +export function decompress(blitTexture: CompressedTexture, maxTextureSize?: number, renderer?: WebGPURenderer | null): Promise; +import { WebGPURenderer } from 'three/webgpu'; +import { CanvasTexture } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts new file mode 100644 index 000000000..054151041 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts @@ -0,0 +1,79 @@ +/** + * A simple pool for managing Web Workers. + * + * @three_import import { WorkerPool } from 'three/addons/utils/WorkerPool.js'; + */ +export class WorkerPool { + /** + * Constructs a new Worker pool. + * + * @param {number} [pool=4] - The size of the pool. + */ + constructor(pool?: number); + /** + * The size of the pool. + * + * @type {number} + * @default 4 + */ + pool: number; + /** + * A message queue. + * + * @type {Array} + */ + queue: Array; + /** + * An array of Workers. + * + * @type {Array} + */ + workers: Array; + /** + * An array with resolve functions for messages. + * + * @type {Array} + */ + workersResolve: Array; + /** + * The current worker status. + * + * @type {number} + */ + workerStatus: number; + /** + * A factory function for creating workers. + * + * @type {?Function} + */ + workerCreator: Function | null; + _initWorker(workerId: any): void; + _getIdleWorker(): number; + _onMessage(workerId: any, msg: any): void; + /** + * Sets a function that is responsible for creating Workers. + * + * @param {Function} workerCreator - The worker creator function. + */ + setWorkerCreator(workerCreator: Function): void; + /** + * Sets the Worker limit + * + * @param {number} pool - The size of the pool. + */ + setWorkerLimit(pool: number): void; + /** + * Post a message to an idle Worker. If no Worker is available, + * the message is pushed into a message queue for later processing. + * + * @param {Object} msg - The message. + * @param {Array} transfer - An array with array buffers for data transfer. + * @return {Promise} A Promise that resolves when the message has been processed. + */ + postMessage(msg: Object, transfer: Array): Promise; + /** + * Terminates all Workers of this pool. Call this method whenever this + * Worker pool is no longer used in your app. + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts new file mode 100644 index 000000000..64886c1b3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts @@ -0,0 +1,22 @@ +/** + * A utility class for creating a button that allows to initiate + * immersive AR sessions based on WebXR. The button can be created + * with a factory method and then appended to the website's DOM. + * + * ```js + * document.body.appendChild( ARButton.createButton( renderer ) ); + * ``` + * + * @hideconstructor + * @three_import import { ARButton } from 'three/addons/webxr/ARButton.js'; + */ +export class ARButton { + /** + * Constructs a new AR button. + * + * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. + * @param {XRSessionInit} [sessionInit] - The a configuration object for the AR session. + * @return {HTMLElement} The button or an error message if `immersive-ar` isn't supported. + */ + static createButton(renderer: WebGLRenderer | WebGPURenderer, sessionInit?: XRSessionInit): HTMLElement; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts new file mode 100644 index 000000000..7d8e29631 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts @@ -0,0 +1,87 @@ +/** + * Represents an Oculus hand model. + * + * @augments Object3D + * @three_import import { OculusHandModel } from 'three/addons/webxr/OculusHandModel.js'; + */ +export class OculusHandModel extends Object3D { + /** + * Constructs a new Oculus hand model. + * + * @param {Group} controller - The hand controller. + * @param {?Loader} [loader=null] - A loader that is used to load hand models. + * @param {?Function} [onLoad=null] - A callback that is executed when a hand model has been loaded. + */ + constructor(controller: Group, loader?: Loader | null, onLoad?: Function | null); + /** + * The hand controller. + * + * @type {Group} + */ + controller: Group; + /** + * The motion controller. + * + * @type {?MotionController} + * @default null + */ + motionController: MotionController | null; + /** + * The model's environment map. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + /** + * A loader that is used to load hand models. + * + * @type {?Loader} + * @default null + */ + loader: Loader | null; + /** + * A callback that is executed when a hand model has been loaded. + * + * @type {?Function} + * @default null + */ + onLoad: Function | null; + /** + * The path to the model repository. + * + * @type {?string} + * @default null + */ + path: string | null; + /** + * The model mesh. + * + * @type {Mesh} + * @default null + */ + mesh: Mesh; + xrInputSource: any; + /** + * Returns the pointer position which is the position of the index finger tip. + * + * @return {?Vector3} The pointer position. Returns `null` if not index finger tip joint was found. + */ + getPointerPosition(): Vector3 | null; + /** + * Returns `true` if the current pointer position (the index finger tip) intersections + * with the given box object. + * + * @param {Mesh} boxObject - The box object. + * @return {boolean} Whether an intersection was found or not. + */ + intersectBoxObject(boxObject: Mesh): boolean; + /** + * Executed actions depending on the interaction state with + * the given button. + * + * @param {Object} button - The button. + */ + checkButton(button: Object): void; +} +import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts new file mode 100644 index 000000000..6b95236eb --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts @@ -0,0 +1,146 @@ +/** + * Represents an Oculus hand pointer model. + * + * @augments Object3D + * @three_import import { OculusHandPointerModel } from 'three/addons/webxr/OculusHandPointerModel.js'; + */ +export class OculusHandPointerModel extends Object3D { + /** + * Constructs a new Oculus hand model. + * + * @param {Group} hand - The hand controller. + * @param {Group} controller - The WebXR controller in target ray space. + */ + constructor(hand: Group, controller: Group); + /** + * The hand controller. + * + * @type {Group} + */ + hand: Group; + /** + * The WebXR controller in target ray space. + * + * @type {Group} + */ + controller: Group; + motionController: any; + envMap: any; + mesh: any; + /** + * The pointer geometry. + * + * @type {?BufferGeometry} + * @default null + */ + pointerGeometry: BufferGeometry | null; + /** + * The pointer mesh. + * + * @type {?Mesh} + * @default null + */ + pointerMesh: Mesh | null; + /** + * The pointer object that holds the pointer mesh. + * + * @type {?Object3D} + * @default null + */ + pointerObject: Object3D | null; + /** + * Whether the model is pinched or not. + * + * @type {?boolean} + * @default false + */ + pinched: boolean | null; + /** + * Whether the model is attached or not. + * + * @type {boolean} + * @default false + */ + attached: boolean; + /** + * The cursor object. + * + * @type {?Mesh} + * @default null + */ + cursorObject: Mesh | null; + /** + * The internal raycaster used for detecting + * intersections. + * + * @type {?Raycaster} + * @default null + */ + raycaster: Raycaster | null; + _onConnected(event: any): void; + _onDisconnected(): void; + xrInputSource: any; + _drawVerticesRing(vertices: any, baseVector: any, ringIndex: any): void; + _updatePointerVertices(rearRadius: any): void; + /** + * Creates a pointer mesh and adds it to this model. + */ + createPointer(): void; + _updateRaycaster(): void; + _updatePointer(): void; + /** + * Returns `true` is the model is pinched. + * + * @return {boolean} Whether the model is pinched or not. + */ + isPinched(): boolean; + /** + * Sets the attached state. + * + * @param {boolean} attached - Whether the model is attached or not. + */ + setAttached(attached: boolean): void; + /** + * Returns `true` is the model is attached. + * + * @return {boolean} Whether the model is attached or not. + */ + isAttached(): boolean; + /** + * Performs an intersection test with the model's raycaster and the given object. + * + * @param {Object3D} object - The 3D object to check for intersection with the ray. + * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. + * Otherwise it only checks intersection with the object. + * @return {Array} An array holding the intersection points. + */ + intersectObject(object: Object3D, recursive?: boolean): Array; + /** + * Performs an intersection test with the model's raycaster and the given objects. + * + * @param {Array} objects - The 3D objects to check for intersection with the ray. + * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. + * Otherwise it only checks intersection with the object. + * @return {Array} An array holding the intersection points. + */ + intersectObjects(objects: Array, recursive?: boolean): Array; + /** + * Checks for intersections between the model's raycaster and the given objects. The method + * updates the cursor object to the intersection point. + * + * @param {Array} objects - The 3D objects to check for intersection with the ray. + * @param {boolean} [recursive=false] - If set to `true`, it also checks all descendants. + * Otherwise it only checks intersection with the object. + */ + checkIntersections(objects: Array, recursive?: boolean): void; + /** + * Sets the cursor to the given distance. + * + * @param {number} distance - The distance to set the cursor to. + */ + setCursor(distance: number): void; +} +import { Object3D } from 'three'; +import { BufferGeometry } from 'three'; +import { Mesh } from 'three'; +import { Raycaster } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts new file mode 100644 index 000000000..4101f890c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts @@ -0,0 +1,15 @@ +/** + * @module Text2D + * @three_import import * as Text2D from 'three/addons/webxr/Text2D.js'; + */ +/** + * A helper function for creating a simple plane mesh + * that can be used as a text label. The mesh's material + * holds a canvas texture that displays the given message. + * + * @param {string} message - The message to display. + * @param {number} height - The labels height. + * @return {Mesh} The plane mesh representing a text label. + */ +export function createText(message: string, height: number): Mesh; +import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts new file mode 100644 index 000000000..5901f3ec3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts @@ -0,0 +1,31 @@ +/** + * A utility class for creating a button that allows to initiate + * immersive VR sessions based on WebXR. The button can be created + * with a factory method and then appended ot the website's DOM. + * + * ```js + * document.body.appendChild( VRButton.createButton( renderer ) ); + * ``` + * + * @hideconstructor + * @three_import import { VRButton } from 'three/addons/webxr/VRButton.js'; + */ +export class VRButton { + /** + * Constructs a new VR button. + * + * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. + * @param {XRSessionInit} [sessionInit] - The a configuration object for the AR session. + * @return {HTMLElement} The button or an error message if `immersive-ar` isn't supported. + */ + static createButton(renderer: WebGLRenderer | WebGPURenderer, sessionInit?: XRSessionInit): HTMLElement; + /** + * Registers a `sessiongranted` event listener. When a session is granted, the {@link VRButton#xrSessionIsGranted} + * flag will evaluate to `true`. This method is automatically called by the module itself so there + * should be no need to use it on app level. + */ + static registerSessionGrantedListener(): void; +} +export namespace VRButton { + let xrSessionIsGranted: boolean; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts new file mode 100644 index 000000000..113ff7df3 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts @@ -0,0 +1,8 @@ +/** + * Sets up a construction-time WebGL fallback for WebGPU XR examples. + * + * @param {WebGPURenderer} renderer - The initial renderer. + * @param {Function} createFallbackRenderer - A function that returns a new renderer with a WebGL backend. + * @param {Function} onFallback - A function that installs the new renderer in the app. + */ +export function setupWebGLXRFallback(renderer: WebGPURenderer, createFallbackRenderer: Function, onFallback?: Function): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts new file mode 100644 index 000000000..ad3f844b1 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts @@ -0,0 +1,26 @@ +/** + * A utility class for creating a button that allows to initiate + * immersive XR sessions based on WebXR. The button can be created + * with a factory method and then appended ot the website's DOM. + * + * ```js + * document.body.appendChild( XRButton.createButton( renderer ) ); + * ``` + * + * Compared to {@link ARButton} and {@link VRButton}, this class will + * try to offer an immersive AR session first. If the device does not + * support this type of session, it uses an immersive VR session. + * + * @hideconstructor + * @three_import import { XRButton } from 'three/addons/webxr/XRButton.js'; + */ +export class XRButton { + /** + * Constructs a new XR button. + * + * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. + * @param {XRSessionInit} [sessionInit] - The a configuration object for the AR session. + * @return {HTMLElement} The button or an error message if WebXR isn't supported. + */ + static createButton(renderer: WebGLRenderer | WebGPURenderer, sessionInit?: XRSessionInit): HTMLElement; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts new file mode 100644 index 000000000..b4a44651c --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts @@ -0,0 +1,96 @@ +/** + * Allows to create controller models for WebXR controllers that can be added as a visual + * representation to your scene. `XRControllerModelFactory` will automatically fetch controller + * models that match what the user is holding as closely as possible. The models should be + * attached to the object returned from getControllerGrip in order to match the orientation of + * the held device. + * + * This module depends on the [motion-controllers](https://github.com/immersive-web/webxr-input-profiles/blob/main/packages/motion-controllers/README.md) + * third-part library. + * + * ```js + * const controllerModelFactory = new XRControllerModelFactory(); + * + * const controllerGrip = renderer.xr.getControllerGrip( 0 ); + * controllerGrip.add( controllerModelFactory.createControllerModel( controllerGrip ) ); + * scene.add( controllerGrip ); + * ``` + * + * @three_import import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; + */ +export class XRControllerModelFactory { + /** + * Constructs a new XR controller model factory. + * + * @param {?GLTFLoader} [gltfLoader=null] - A glTF loader that is used to load controller models. + * @param {?Function} [onLoad=null] - A callback that is executed when a controller model has been loaded. + */ + constructor(gltfLoader?: GLTFLoader | null, onLoad?: Function | null); + /** + * A glTF loader that is used to load controller models. + * + * @type {?GLTFLoader} + * @default null + */ + gltfLoader: GLTFLoader | null; + /** + * The path to the model repository. + * + * @type {string} + */ + path: string; + _assetCache: {}; + /** + * A callback that is executed when a controller model has been loaded. + * + * @type {?Function} + * @default null + */ + onLoad: Function | null; + /** + * Sets the path to the model repository. + * + * @param {string} path - The path to set. + * @return {XRControllerModelFactory} A reference to this instance. + */ + setPath(path: string): XRControllerModelFactory; + /** + * Creates a controller model for the given WebXR controller. + * + * @param {Group} controller - The controller. + * @return {XRControllerModel} The XR controller model. + */ + createControllerModel(controller: Group): XRControllerModel; +} +import { GLTFLoader } from '../loaders/GLTFLoader.js'; +/** + * Represents a XR controller model. + * + * @augments Object3D + */ +declare class XRControllerModel extends Object3D { + /** + * The motion controller. + * + * @type {?MotionController} + * @default null + */ + motionController: MotionController | null; + /** + * The controller's environment map. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + /** + * Sets an environment map that is applied to the controller model. + * + * @param {?Texture} envMap - The environment map to apply. + * @return {XRControllerModel} A reference to this instance. + */ + setEnvironmentMap(envMap: Texture | null): XRControllerModel; +} +import { Object3D } from 'three'; +import { MotionController } from '../libs/motion-controllers.module.js'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts new file mode 100644 index 000000000..49e4e1b99 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts @@ -0,0 +1,39 @@ +/** + * This class can be used to represent the environmental light of + * a XR session. It relies on the WebXR Lighting Estimation API. + * + * @augments Group + * @three_import import { XREstimatedLight } from 'three/addons/webxr/XREstimatedLight.js'; + */ +export class XREstimatedLight extends Group { + /** + * Constructs a new light. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {boolean} [environmentEstimation=true] - Whether to use environment estimation or not. + */ + constructor(renderer: WebGLRenderer, environmentEstimation?: boolean); + /** + * The light probe that represents the estimated light. + * + * @type {LightProbe} + */ + lightProbe: LightProbe; + /** + * Represents the primary light from the XR environment. + * + * @type {DirectionalLight} + */ + directionalLight: DirectionalLight; + /** + * Will be set to a cube map in the SessionLightProbe if environment estimation is + * available and requested. + * + * @type {?Texture} + * @default null + */ + environment: Texture | null; +} +import { Group } from 'three'; +import { LightProbe } from 'three'; +import { DirectionalLight } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts new file mode 100644 index 000000000..7cb18fa25 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts @@ -0,0 +1,44 @@ +/** + * Represents one of the hand model types {@link XRHandModelFactory} might produce + * depending on the selected profile. `XRHandMeshModel` represents a hand with a + * custom asset. + * + * @three_import import { XRHandMeshModel } from 'three/addons/webxr/XRHandMeshModel.js'; + */ +export class XRHandMeshModel { + /** + * Constructs a new XR hand mesh model. + * + * @param {XRHandModel} handModel - The hand model. + * @param {Group} controller - The WebXR controller. + * @param {?string} path - The model path. + * @param {XRHandedness} handedness - The handedness of the XR input source. + * @param {?Loader} [loader=null] - The loader. If not provided, an instance of `GLTFLoader` will be used to load models. + * @param {?Function} [onLoad=null] - A callback that is executed when a controller model has been loaded. + * @param {?Object} [customCache=null] - An optional shared cache object for storing and reusing loaded assets across instances. + */ + constructor(handModel: XRHandModel, controller: Group, path: string | null, handedness: XRHandedness, loader?: Loader | null, onLoad?: Function | null, customCache?: Object | null); + /** + * The WebXR controller. + * + * @type {Group} + */ + controller: Group; + /** + * The hand model. + * + * @type {XRHandModel} + */ + handModel: XRHandModel; + /** + * An array of bones representing the bones + * of the hand skeleton. + * + * @type {Array} + */ + bones: Array; + /** + * Updates the mesh based on the tracked XR joints data. + */ + updateMesh(): void; +} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts new file mode 100644 index 000000000..720ee0cd7 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts @@ -0,0 +1,102 @@ +/** + * Similar to {@link XRControllerModelFactory}, this class allows to create hand models + * for WebXR controllers that can be added as a visual representation to your scene. + * + * ```js + * const handModelFactory = new XRHandModelFactory(); + * + * const hand = renderer.xr.getHand( 0 ); + * hand.add( handModelFactory.createHandModel( hand ) ); + * scene.add( hand ); + * ``` + * + * @three_import import { XRHandModelFactory } from 'three/addons/webxr/XRHandModelFactory.js'; + */ +export class XRHandModelFactory { + /** + * Constructs a new XR hand model factory. + * + * @param {?GLTFLoader} [gltfLoader=null] - A glTF loader that is used to load hand models. + * @param {?Function} [onLoad=null] - A callback that is executed when a hand model has been loaded. + */ + constructor(gltfLoader?: GLTFLoader | null, onLoad?: Function | null); + /** + * A glTF loader that is used to load hand models. + * + * @type {?GLTFLoader} + * @default null + */ + gltfLoader: GLTFLoader | null; + /** + * The path to the model repository. + * + * @type {?string} + * @default null + */ + path: string | null; + _assetCache: {}; + /** + * A callback that is executed when a hand model has been loaded. + * + * @type {?Function} + * @default null + */ + onLoad: Function | null; + /** + * Sets the path to the hand model repository. + * + * @param {string} path - The path to set. + * @return {XRHandModelFactory} A reference to this instance. + */ + setPath(path: string): XRHandModelFactory; + /** + * Creates a controller model for the given WebXR hand controller. + * + * @param {Group} controller - The hand controller. + * @param {('spheres'|'boxes'|'mesh')} [profile] - The model profile that defines the model type. + * @return {XRHandModel} The XR hand model. + */ + createHandModel(controller: Group, profile?: ("spheres" | "boxes" | "mesh")): XRHandModel; +} +/** + * Represents a XR hand model. + * + * @augments Object3D + */ +declare class XRHandModel extends Object3D { + /** + * Constructs a new XR hand model. + * + * @param {Group} controller - The hand controller. + */ + constructor(controller: Group); + /** + * The hand controller. + * + * @type {Group} + */ + controller: Group; + /** + * The motion controller. + * + * @type {?MotionController} + * @default null + */ + motionController: MotionController | null; + /** + * The controller's environment map. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + /** + * The model mesh. + * + * @type {Mesh} + * @default null + */ + mesh: Mesh; +} +import { Object3D } from 'three'; +export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts new file mode 100644 index 000000000..fbe6ed543 --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts @@ -0,0 +1,54 @@ +/** + * ~Options + */ +export type XRHandPrimitiveModel = { + /** + * - The primitive type. + */ + primitive?: "sphere" | "box" | undefined; +}; +/** + * Represents one of the hand model types {@link XRHandModelFactory} might produce + * depending on the selected profile. `XRHandPrimitiveModel` represents a hand + * with sphere or box primitives according to the selected `primitive` option. + * + * @three_import import { XRHandPrimitiveModel } from 'three/addons/webxr/XRHandPrimitiveModel.js'; + */ +export class XRHandPrimitiveModel { + /** + * Constructs a new XR hand primitive model. + * + * @param {XRHandModel} handModel - The hand model. + * @param {Group} controller - The WebXR controller. + * @param {string} path - The model path. + * @param {XRHandedness} handedness - The handedness of the XR input source. + * @param {XRHandPrimitiveModel~Options} options - The model options. + */ + constructor(handModel: XRHandModel, controller: Group, path: string, handedness: XRHandedness, options: any); + /** + * The WebXR controller. + * + * @type {Group} + */ + controller: Group; + /** + * The hand model. + * + * @type {XRHandModel} + */ + handModel: XRHandModel; + /** + * The model's environment map. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + handMesh: InstancedMesh; + joints: string[]; + /** + * Updates the mesh based on the tracked XR joints data. + */ + updateMesh(): void; +} +import { InstancedMesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts new file mode 100644 index 000000000..de818107d --- /dev/null +++ b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts @@ -0,0 +1,22 @@ +/** + * A utility class for the WebXR Plane Detection Module. If planes + * are detected by WebXR, this class will automatically add them + * as thin box meshes to the scene when below code snippet is used. + * + * ```js + * const planes = new XRPlanes( renderer ); + * scene.add( planes ); + * ``` + * + * @augments Object3D + * @three_import import { XRPlanes } from 'three/addons/webxr/XRPlanes.js'; + */ +export class XRPlanes extends Object3D { + /** + * Constructs a new XR plane container. + * + * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. + */ + constructor(renderer: WebGLRenderer | WebGPURenderer); +} +import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/src/Three.Core.d.ts b/jsdoc-testing/jsdoc/src/Three.Core.d.ts new file mode 100644 index 000000000..b7a036bb7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/Three.Core.d.ts @@ -0,0 +1,163 @@ +export { WebGLArrayRenderTarget } from "./renderers/WebGLArrayRenderTarget.js"; +export { WebGL3DRenderTarget } from "./renderers/WebGL3DRenderTarget.js"; +export { WebGLRenderTarget } from "./renderers/WebGLRenderTarget.js"; +export { WebXRController } from "./renderers/webxr/WebXRController.js"; +export { FogExp2 } from "./scenes/FogExp2.js"; +export { Fog } from "./scenes/Fog.js"; +export { Scene } from "./scenes/Scene.js"; +export { Sprite } from "./objects/Sprite.js"; +export { LOD } from "./objects/LOD.js"; +export { SkinnedMesh } from "./objects/SkinnedMesh.js"; +export { Skeleton } from "./objects/Skeleton.js"; +export { Bone } from "./objects/Bone.js"; +export { Mesh } from "./objects/Mesh.js"; +export { InstancedMesh } from "./objects/InstancedMesh.js"; +export { BatchedMesh } from "./objects/BatchedMesh.js"; +export { LineSegments } from "./objects/LineSegments.js"; +export { LineLoop } from "./objects/LineLoop.js"; +export { Line } from "./objects/Line.js"; +export { Points } from "./objects/Points.js"; +export { Group } from "./objects/Group.js"; +export { VideoTexture } from "./textures/VideoTexture.js"; +export { VideoFrameTexture } from "./textures/VideoFrameTexture.js"; +export { FramebufferTexture } from "./textures/FramebufferTexture.js"; +export { DataTexture } from "./textures/DataTexture.js"; +export { DataArrayTexture } from "./textures/DataArrayTexture.js"; +export { Data3DTexture } from "./textures/Data3DTexture.js"; +export { CompressedTexture } from "./textures/CompressedTexture.js"; +export { CompressedArrayTexture } from "./textures/CompressedArrayTexture.js"; +export { CompressedCubeTexture } from "./textures/CompressedCubeTexture.js"; +export { CubeTexture } from "./textures/CubeTexture.js"; +export { CanvasTexture } from "./textures/CanvasTexture.js"; +export { HTMLTexture } from "./textures/HTMLTexture.js"; +export { DepthTexture } from "./textures/DepthTexture.js"; +export { CubeDepthTexture } from "./textures/CubeDepthTexture.js"; +export { ExternalTexture } from "./textures/ExternalTexture.js"; +export { Texture } from "./textures/Texture.js"; +export * from "./geometries/Geometries.js"; +export * from "./materials/Materials.js"; +export * from "./core/BufferAttribute.js"; +export * from "./extras/curves/Curves.js"; +export * from "./constants.js"; +export * from "./Three.Legacy.js"; +export { AnimationLoader } from "./loaders/AnimationLoader.js"; +export { CompressedTextureLoader } from "./loaders/CompressedTextureLoader.js"; +export { CubeTextureLoader } from "./loaders/CubeTextureLoader.js"; +export { DataTextureLoader } from "./loaders/DataTextureLoader.js"; +export { TextureLoader } from "./loaders/TextureLoader.js"; +export { ObjectLoader } from "./loaders/ObjectLoader.js"; +export { MaterialLoader } from "./loaders/MaterialLoader.js"; +export { BufferGeometryLoader } from "./loaders/BufferGeometryLoader.js"; +export { ImageLoader } from "./loaders/ImageLoader.js"; +export { ImageBitmapLoader } from "./loaders/ImageBitmapLoader.js"; +export { FileLoader } from "./loaders/FileLoader.js"; +export { Loader } from "./loaders/Loader.js"; +export { LoaderUtils } from "./loaders/LoaderUtils.js"; +export { Cache } from "./loaders/Cache.js"; +export { AudioLoader } from "./loaders/AudioLoader.js"; +export { SpotLight } from "./lights/SpotLight.js"; +export { PointLight } from "./lights/PointLight.js"; +export { RectAreaLight } from "./lights/RectAreaLight.js"; +export { HemisphereLight } from "./lights/HemisphereLight.js"; +export { SunLight } from "./lights/SunLight.js"; +export { DirectionalLight } from "./lights/DirectionalLight.js"; +export { AmbientLight } from "./lights/AmbientLight.js"; +export { Light } from "./lights/Light.js"; +export { LightProbe } from "./lights/LightProbe.js"; +export { StereoCamera } from "./cameras/StereoCamera.js"; +export { PerspectiveCamera } from "./cameras/PerspectiveCamera.js"; +export { OrthographicCamera } from "./cameras/OrthographicCamera.js"; +export { CubeCamera } from "./cameras/CubeCamera.js"; +export { ArrayCamera } from "./cameras/ArrayCamera.js"; +export { Camera } from "./cameras/Camera.js"; +export { AudioListener } from "./audio/AudioListener.js"; +export { PositionalAudio } from "./audio/PositionalAudio.js"; +export { AudioContext } from "./audio/AudioContext.js"; +export { AudioAnalyser } from "./audio/AudioAnalyser.js"; +export { Audio } from "./audio/Audio.js"; +export { VectorKeyframeTrack } from "./animation/tracks/VectorKeyframeTrack.js"; +export { StringKeyframeTrack } from "./animation/tracks/StringKeyframeTrack.js"; +export { QuaternionKeyframeTrack } from "./animation/tracks/QuaternionKeyframeTrack.js"; +export { NumberKeyframeTrack } from "./animation/tracks/NumberKeyframeTrack.js"; +export { ColorKeyframeTrack } from "./animation/tracks/ColorKeyframeTrack.js"; +export { BooleanKeyframeTrack } from "./animation/tracks/BooleanKeyframeTrack.js"; +export { PropertyMixer } from "./animation/PropertyMixer.js"; +export { PropertyBinding } from "./animation/PropertyBinding.js"; +export { KeyframeTrack } from "./animation/KeyframeTrack.js"; +export { AnimationUtils } from "./animation/AnimationUtils.js"; +export { AnimationObjectGroup } from "./animation/AnimationObjectGroup.js"; +export { AnimationMixer } from "./animation/AnimationMixer.js"; +export { AnimationClip } from "./animation/AnimationClip.js"; +export { AnimationAction } from "./animation/AnimationAction.js"; +export { RenderTarget } from "./core/RenderTarget.js"; +export { RenderTarget3D } from "./core/RenderTarget3D.js"; +export { Uniform } from "./core/Uniform.js"; +export { UniformsGroup } from "./core/UniformsGroup.js"; +export { InstancedBufferGeometry } from "./core/InstancedBufferGeometry.js"; +export { BufferGeometry } from "./core/BufferGeometry.js"; +export { InterleavedBufferAttribute } from "./core/InterleavedBufferAttribute.js"; +export { InstancedInterleavedBuffer } from "./core/InstancedInterleavedBuffer.js"; +export { InterleavedBuffer } from "./core/InterleavedBuffer.js"; +export { InstancedBufferAttribute } from "./core/InstancedBufferAttribute.js"; +export { GLBufferAttribute } from "./core/GLBufferAttribute.js"; +export { Object3D } from "./core/Object3D.js"; +export { Raycaster } from "./core/Raycaster.js"; +export { Layers } from "./core/Layers.js"; +export { EventDispatcher } from "./core/EventDispatcher.js"; +export { Clock } from "./core/Clock.js"; +export { Timer } from "./core/Timer.js"; +export { QuaternionLinearInterpolant } from "./math/interpolants/QuaternionLinearInterpolant.js"; +export { LinearInterpolant } from "./math/interpolants/LinearInterpolant.js"; +export { DiscreteInterpolant } from "./math/interpolants/DiscreteInterpolant.js"; +export { CubicInterpolant } from "./math/interpolants/CubicInterpolant.js"; +export { BezierInterpolant } from "./math/interpolants/BezierInterpolant.js"; +export { Interpolant } from "./math/Interpolant.js"; +export { Triangle } from "./math/Triangle.js"; +export { MathUtils } from "./math/MathUtils.js"; +export { Spherical } from "./math/Spherical.js"; +export { Cylindrical } from "./math/Cylindrical.js"; +export { Plane } from "./math/Plane.js"; +export { Frustum } from "./math/Frustum.js"; +export { FrustumArray } from "./math/FrustumArray.js"; +export { Sphere } from "./math/Sphere.js"; +export { Ray } from "./math/Ray.js"; +export { Matrix4 } from "./math/Matrix4.js"; +export { Matrix3 } from "./math/Matrix3.js"; +export { Matrix2 } from "./math/Matrix2.js"; +export { Box3 } from "./math/Box3.js"; +export { Box2 } from "./math/Box2.js"; +export { Line3 } from "./math/Line3.js"; +export { Euler } from "./math/Euler.js"; +export { Vector4 } from "./math/Vector4.js"; +export { Vector3 } from "./math/Vector3.js"; +export { Vector2 } from "./math/Vector2.js"; +export { Quaternion } from "./math/Quaternion.js"; +export { Color } from "./math/Color.js"; +export { ColorManagement } from "./math/ColorManagement.js"; +export { SphericalHarmonics3 } from "./math/SphericalHarmonics3.js"; +export { SpotLightHelper } from "./helpers/SpotLightHelper.js"; +export { SkeletonHelper } from "./helpers/SkeletonHelper.js"; +export { PointLightHelper } from "./helpers/PointLightHelper.js"; +export { HemisphereLightHelper } from "./helpers/HemisphereLightHelper.js"; +export { GridHelper } from "./helpers/GridHelper.js"; +export { PolarGridHelper } from "./helpers/PolarGridHelper.js"; +export { DirectionalLightHelper } from "./helpers/DirectionalLightHelper.js"; +export { CameraHelper } from "./helpers/CameraHelper.js"; +export { BoxHelper } from "./helpers/BoxHelper.js"; +export { Box3Helper } from "./helpers/Box3Helper.js"; +export { PlaneHelper } from "./helpers/PlaneHelper.js"; +export { ArrowHelper } from "./helpers/ArrowHelper.js"; +export { AxesHelper } from "./helpers/AxesHelper.js"; +export { Shape } from "./extras/core/Shape.js"; +export { Path } from "./extras/core/Path.js"; +export { ShapePath } from "./extras/core/ShapePath.js"; +export { CurvePath } from "./extras/core/CurvePath.js"; +export { Curve } from "./extras/core/Curve.js"; +export { Controls } from "./extras/Controls.js"; +export { DataUtils } from "./extras/DataUtils.js"; +export { ImageUtils } from "./extras/ImageUtils.js"; +export { ShapeUtils } from "./extras/ShapeUtils.js"; +export { TextureUtils } from "./extras/TextureUtils.js"; +export { TextureSource, Source } from "./textures/TextureSource.js"; +export { DefaultLoadingManager, LoadingManager } from "./loaders/LoadingManager.js"; +export { createCanvasElement, setConsoleFunction, getConsoleFunction, log, warn, error, warnOnce } from "./utils.js"; diff --git a/jsdoc-testing/jsdoc/src/Three.Legacy.d.ts b/jsdoc-testing/jsdoc/src/Three.Legacy.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/Three.Legacy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts b/jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts new file mode 100644 index 000000000..a1e4e42c9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts @@ -0,0 +1,30 @@ +export * from "./Three.Core.js"; +export * from "./materials/nodes/NodeMaterials.js"; +export * from "./nodes/Nodes.js"; +export { default as WebGPURenderer } from "./renderers/webgpu/WebGPURenderer.Nodes.js"; +export { default as WebGPUBackend } from "./renderers/webgpu/WebGPUBackend.js"; +export { default as WebGLBackend } from "./renderers/webgl-fallback/WebGLBackend.js"; +export { default as Lighting } from "./renderers/common/Lighting.js"; +export { default as BundleGroup } from "./renderers/common/BundleGroup.js"; +export { default as QuadMesh } from "./renderers/common/QuadMesh.js"; +export { default as PMREMGenerator } from "./renderers/common/extras/PMREMGenerator.js"; +export { default as RenderPipeline } from "./renderers/common/RenderPipeline.js"; +export { default as DirectRenderPipeline } from "./renderers/common/DirectRenderPipeline.js"; +export { default as PostProcessing } from "./renderers/common/PostProcessing.js"; +export { default as ReadbackBuffer } from "./renderers/common/ReadbackBuffer.js"; +export { default as StorageTexture } from "./renderers/common/StorageTexture.js"; +export { default as StorageBufferAttribute } from "./renderers/common/StorageBufferAttribute.js"; +export { default as StorageInstancedBufferAttribute } from "./renderers/common/StorageInstancedBufferAttribute.js"; +export { default as IndirectStorageBufferAttribute } from "./renderers/common/IndirectStorageBufferAttribute.js"; +export { default as IESSpotLight } from "./lights/webgpu/IESSpotLight.js"; +export { default as ProjectorLight } from "./lights/webgpu/ProjectorLight.js"; +export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js"; +export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js"; +export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js"; +export { default as InspectorBase } from "./renderers/common/InspectorBase.js"; +export { default as CanvasTarget } from "./renderers/common/CanvasTarget.js"; +export { default as BlendMode } from "./renderers/common/BlendMode.js"; +export { ClippingGroup } from "./objects/ClippingGroup.js"; +import * as RendererUtils from './renderers/common/RendererUtils.js'; +import * as TSL from './nodes/TSL.js'; +export { RendererUtils, TSL }; diff --git a/jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts b/jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts new file mode 100644 index 000000000..fb3edc290 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts @@ -0,0 +1,40 @@ +export * from "./Three.Core.js"; +export * from "./materials/nodes/NodeMaterials.js"; +export * from "./nodes/Nodes.js"; +export { default as WebGPURenderer } from "./renderers/webgpu/WebGPURenderer.js"; +export { default as WebGPUBackend } from "./renderers/webgpu/WebGPUBackend.js"; +export { default as WebGLBackend } from "./renderers/webgl-fallback/WebGLBackend.js"; +export { default as Renderer } from "./renderers/common/Renderer.js"; +export { default as Backend } from "./renderers/common/Backend.js"; +export { default as WebGLCapabilities } from "./renderers/webgl-fallback/utils/WebGLCapabilities.js"; +export { default as Lighting } from "./renderers/common/Lighting.js"; +export { default as BundleGroup } from "./renderers/common/BundleGroup.js"; +export { default as QuadMesh } from "./renderers/common/QuadMesh.js"; +export { default as PMREMGenerator } from "./renderers/common/extras/PMREMGenerator.js"; +export { default as RenderPipeline } from "./renderers/common/RenderPipeline.js"; +export { default as DirectRenderPipeline } from "./renderers/common/DirectRenderPipeline.js"; +export { default as PostProcessing } from "./renderers/common/PostProcessing.js"; +export { default as ReadbackBuffer } from "./renderers/common/ReadbackBuffer.js"; +export { default as CubeRenderTarget } from "./renderers/common/CubeRenderTarget.js"; +export { default as StorageTexture } from "./renderers/common/StorageTexture.js"; +export { default as Storage3DTexture } from "./renderers/common/Storage3DTexture.js"; +export { default as StorageArrayTexture } from "./renderers/common/StorageArrayTexture.js"; +export { default as StorageBufferAttribute } from "./renderers/common/StorageBufferAttribute.js"; +export { default as StorageInstancedBufferAttribute } from "./renderers/common/StorageInstancedBufferAttribute.js"; +export { default as IndirectStorageBufferAttribute } from "./renderers/common/IndirectStorageBufferAttribute.js"; +export { default as IESSpotLight } from "./lights/webgpu/IESSpotLight.js"; +export { default as ProjectorLight } from "./lights/webgpu/ProjectorLight.js"; +export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js"; +export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js"; +export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js"; +export { default as InspectorBase } from "./renderers/common/InspectorBase.js"; +export { default as CanvasTarget } from "./renderers/common/CanvasTarget.js"; +export { default as BlendMode } from "./renderers/common/BlendMode.js"; +export { default as GLSLNodeBuilder } from "./renderers/webgl-fallback/nodes/GLSLNodeBuilder.js"; +export { default as BasicNodeLibrary } from "./renderers/webgpu/nodes/BasicNodeLibrary.js"; +export { default as StandardNodeLibrary } from "./renderers/webgpu/nodes/StandardNodeLibrary.js"; +export { default as WGSLNodeBuilder } from "./renderers/webgpu/nodes/WGSLNodeBuilder.js"; +export { ClippingGroup } from "./objects/ClippingGroup.js"; +import * as RendererUtils from './renderers/common/RendererUtils.js'; +import * as TSL from './nodes/TSL.js'; +export { RendererUtils, TSL }; diff --git a/jsdoc-testing/jsdoc/src/Three.d.ts b/jsdoc-testing/jsdoc/src/Three.d.ts new file mode 100644 index 000000000..3c8c6cd87 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/Three.d.ts @@ -0,0 +1,9 @@ +export * from "./Three.Core.js"; +export { WebGLRenderer } from "./renderers/WebGLRenderer.js"; +export { WebGLCubeRenderTarget } from "./renderers/WebGLCubeRenderTarget.js"; +export { ShaderLib } from "./renderers/shaders/ShaderLib.js"; +export { UniformsLib } from "./renderers/shaders/UniformsLib.js"; +export { UniformsUtils } from "./renderers/shaders/UniformsUtils.js"; +export { ShaderChunk } from "./renderers/shaders/ShaderChunk.js"; +export { PMREMGenerator } from "./extras/PMREMGenerator.js"; +export { WebGLUtils } from "./renderers/webgl/WebGLUtils.js"; diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts new file mode 100644 index 000000000..543005806 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts @@ -0,0 +1,311 @@ +/** + * An instance of `AnimationAction` schedules the playback of an animation which is + * stored in {@link AnimationClip}. + */ +export class AnimationAction { + /** + * Constructs a new animation action. + * + * @param {AnimationMixer} mixer - The mixer that is controlled by this action. + * @param {AnimationClip} clip - The animation clip that holds the actual keyframes. + * @param {?Object3D} [localRoot=null] - The root object on which this action is performed. + * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode. + */ + constructor(mixer: AnimationMixer, clip: AnimationClip, localRoot?: Object3D | null, blendMode?: (number | number)); + _mixer: AnimationMixer; + _clip: AnimationClip; + _localRoot: any; + /** + * Defines how the animation is blended/combined when two or more animations + * are simultaneously played. + * + * @type {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} + */ + blendMode: (number | number); + _interpolantSettings: { + endingStart: number; + endingEnd: number; + }; + _interpolants: any[]; + _propertyBindings: any[]; + _cacheIndex: any; + _byClipCacheIndex: any; + _timeScaleInterpolant: any; + _restoreTimeScale: number | null; + _weightInterpolant: any; + /** + * The loop mode, set via {@link AnimationAction#setLoop}. + * + * @type {(LoopRepeat|LoopOnce|LoopPingPong)} + * @default LoopRepeat + */ + loop: (number | number | number); + _loopCount: number; + _startTime: number | null; + /** + * The local time of this action (in seconds, starting with `0`). + * + * The value gets clamped or wrapped to `[0,clip.duration]` (according to the + * loop state). + * + * @type {number} + * @default Infinity + */ + time: number; + /** + * Scaling factor for the {@link AnimationAction#time}. A value of `0` causes the + * animation to pause. Negative values cause the animation to play backwards. + * + * @type {number} + * @default 1 + */ + timeScale: number; + _effectiveTimeScale: number; + /** + * The degree of influence of this action (in the interval `[0, 1]`). Values + * between `0` (no impact) and `1` (full impact) can be used to blend between + * several actions. + * + * @type {number} + * @default 1 + */ + weight: number; + _effectiveWeight: number; + /** + * The number of repetitions of the performed clip over the course of this action. + * Can be set via {@link AnimationAction#setLoop}. + * + * Setting this number has no effect if {@link AnimationAction#loop} is set to + * `THREE:LoopOnce`. + * + * @type {number} + * @default Infinity + */ + repetitions: number; + /** + * If set to `true`, the playback of the action is paused. + * + * @type {boolean} + * @default false + */ + paused: boolean; + /** + * If set to `false`, the action is disabled so it has no impact. + * + * When the action is re-enabled, the animation continues from its current + * time (setting `enabled` to `false` doesn't reset the action). + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * If set to true the animation will automatically be paused on its last frame. + * + * If set to false, {@link AnimationAction#enabled} will automatically be switched + * to `false` when the last loop of the action has finished, so that this action has + * no further impact. + * + * Note: This member has no impact if the action is interrupted (it + * has only an effect if its last loop has really finished). + * + * @type {boolean} + * @default false + */ + clampWhenFinished: boolean; + /** + * Enables smooth interpolation without separate clips for start, loop and end. + * + * @type {boolean} + * @default true + */ + zeroSlopeAtStart: boolean; + /** + * Enables smooth interpolation without separate clips for start, loop and end. + * + * @type {boolean} + * @default true + */ + zeroSlopeAtEnd: boolean; + /** + * Starts the playback of the animation. + * + * @return {AnimationAction} A reference to this animation action. + */ + play(): AnimationAction; + /** + * Stops the playback of the animation. + * + * @return {AnimationAction} A reference to this animation action. + */ + stop(): AnimationAction; + /** + * Resets the playback of the animation. + * + * @return {AnimationAction} A reference to this animation action. + */ + reset(): AnimationAction; + /** + * Returns `true` if the animation is running. + * + * @return {boolean} Whether the animation is running or not. + */ + isRunning(): boolean; + /** + * Returns `true` when {@link AnimationAction#play} has been called. + * + * @return {boolean} Whether the animation is scheduled or not. + */ + isScheduled(): boolean; + /** + * Defines the time when the animation should start. + * + * @param {number} time - The start time in seconds. + * @return {AnimationAction} A reference to this animation action. + */ + startAt(time: number): AnimationAction; + /** + * Configures the loop settings for this action. + * + * @param {(LoopRepeat|LoopOnce|LoopPingPong)} mode - The loop mode. + * @param {number} repetitions - The number of repetitions. + * @return {AnimationAction} A reference to this animation action. + */ + setLoop(mode: (number | number | number), repetitions: number): AnimationAction; + /** + * Sets the effective weight of this action. + * + * An action has no effect and thus an effective weight of zero when the + * action is disabled. + * + * @param {number} weight - The weight to set. + * @return {AnimationAction} A reference to this animation action. + */ + setEffectiveWeight(weight: number): AnimationAction; + /** + * Returns the effective weight of this action. + * + * @return {number} The effective weight. + */ + getEffectiveWeight(): number; + /** + * Fades the animation in by increasing its weight gradually from `0` to `1`, + * within the passed time interval. + * + * @param {number} duration - The duration of the fade. + * @return {AnimationAction} A reference to this animation action. + */ + fadeIn(duration: number): AnimationAction; + /** + * Fades the animation out by decreasing its weight gradually from `1` to `0`, + * within the passed time interval. + * + * @param {number} duration - The duration of the fade. + * @return {AnimationAction} A reference to this animation action. + */ + fadeOut(duration: number): AnimationAction; + /** + * Causes this action to fade in and the given action to fade out, + * within the passed time interval. + * + * @param {AnimationAction} fadeOutAction - The animation action to fade out. + * @param {number} duration - The duration of the fade. + * @param {boolean} [warp=false] - Whether warping should be used or not. + * @return {AnimationAction} A reference to this animation action. + */ + crossFadeFrom(fadeOutAction: AnimationAction, duration: number, warp?: boolean): AnimationAction; + /** + * Causes this action to fade out and the given action to fade in, + * within the passed time interval. + * + * @param {AnimationAction} fadeInAction - The animation action to fade in. + * @param {number} duration - The duration of the fade. + * @param {boolean} [warp=false] - Whether warping should be used or not. + * @return {AnimationAction} A reference to this animation action. + */ + crossFadeTo(fadeInAction: AnimationAction, duration: number, warp?: boolean): AnimationAction; + /** + * Stops any fading which is applied to this action. + * + * @return {AnimationAction} A reference to this animation action. + */ + stopFading(): AnimationAction; + /** + * Sets the effective time scale of this action. + * + * An action has no effect and thus an effective time scale of zero when the + * action is paused. + * + * @param {number} timeScale - The time scale to set. + * @return {AnimationAction} A reference to this animation action. + */ + setEffectiveTimeScale(timeScale: number): AnimationAction; + /** + * Returns the effective time scale of this action. + * + * @return {number} The effective time scale. + */ + getEffectiveTimeScale(): number; + /** + * Sets the duration for a single loop of this action. + * + * @param {number} duration - The duration to set. + * @return {AnimationAction} A reference to this animation action. + */ + setDuration(duration: number): AnimationAction; + /** + * Synchronizes this action with the passed other action. + * + * @param {AnimationAction} action - The action to sync with. + * @return {AnimationAction} A reference to this animation action. + */ + syncWith(action: AnimationAction): AnimationAction; + /** + * Decelerates this animation's speed to `0` within the passed time interval. + * + * @param {number} duration - The duration. + * @return {AnimationAction} A reference to this animation action. + */ + halt(duration: number): AnimationAction; + /** + * Changes the playback speed, within the passed time interval, by modifying + * {@link AnimationAction#timeScale} gradually from `startTimeScale` to + * `endTimeScale`. + * + * @param {number} startTimeScale - The start time scale. + * @param {number} endTimeScale - The end time scale. + * @param {number} duration - The duration. + * @return {AnimationAction} A reference to this animation action. + */ + warp(startTimeScale: number, endTimeScale: number, duration: number): AnimationAction; + /** + * Stops any scheduled warping which is applied to this action. + * + * @return {AnimationAction} A reference to this animation action. + */ + stopWarping(): AnimationAction; + /** + * Returns the animation mixer of this animation action. + * + * @return {AnimationMixer} The animation mixer. + */ + getMixer(): AnimationMixer; + /** + * Returns the animation clip of this animation action. + * + * @return {AnimationClip} The animation clip. + */ + getClip(): AnimationClip; + /** + * Returns the root object of this animation action. + * + * @return {Object3D} The root object. + */ + getRoot(): Object3D; + _update(time: any, deltaTime: any, timeDirection: any, accuIndex: any): void; + _updateWeight(time: any): number; + _updateTimeScale(time: any): number; + _updateTime(deltaTime: any): any; + _setEndings(atStart: any, atEnd: any, pingPong: any): void; + _scheduleFading(duration: any, weightNow: any, weightThen: any): this; +} diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts new file mode 100644 index 000000000..23194681c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts @@ -0,0 +1,154 @@ +/** + * A reusable set of keyframe tracks which represent an animation. + */ +export class AnimationClip { + /** + * Factory method for creating an animation clip from the given JSON. + * + * @static + * @param {Object} json - The serialized animation clip. + * @return {AnimationClip} The new animation clip. + */ + static parse(json: Object): AnimationClip; + /** + * Serializes the given animation clip into JSON. + * + * @static + * @param {AnimationClip} clip - The animation clip to serialize. + * @return {Object} The JSON object. + */ + static toJSON(clip: AnimationClip): Object; + /** + * Returns a new animation clip from the passed morph targets array of a + * geometry, taking a name and the number of frames per second. + * + * Note: The fps parameter is required, but the animation speed can be + * overridden via {@link AnimationAction#setDuration}. + * + * @static + * @param {string} name - The name of the animation clip. + * @param {Array} morphTargetSequence - A sequence of morph targets. + * @param {number} fps - The Frames-Per-Second value. + * @param {boolean} noLoop - Whether the clip should be no loop or not. + * @return {AnimationClip} The new animation clip. + */ + static CreateFromMorphTargetSequence(name: string, morphTargetSequence: Array, fps: number, noLoop: boolean): AnimationClip; + /** + * Searches for an animation clip by name, taking as its first parameter + * either an array of clips, or a mesh or geometry that contains an + * array named "animations" property. + * + * @static + * @param {(Array|Object3D)} objectOrClipArray - The array or object to search through. + * @param {string} name - The name to search for. + * @return {?AnimationClip} The found animation clip. Returns `null` if no clip has been found. + */ + static findByName(objectOrClipArray: (Array | Object3D), name: string): AnimationClip | null; + /** + * Returns an array of new AnimationClips created from the morph target + * sequences of a geometry, trying to sort morph target names into + * animation-group-based patterns like "Walk_001, Walk_002, Run_001, Run_002...". + * + * See {@link MD2Loader#parse} as an example for how the method should be used. + * + * @static + * @param {Array} morphTargets - A sequence of morph targets. + * @param {number} fps - The Frames-Per-Second value. + * @param {boolean} noLoop - Whether the clip should be no loop or not. + * @return {Array} An array of new animation clips. + */ + static CreateClipsFromMorphTargetSequences(morphTargets: Array, fps: number, noLoop: boolean): Array; + /** + * Constructs a new animation clip. + * + * Note: Instead of instantiating an AnimationClip directly with the constructor, you can + * use the static interface of this class for creating clips. In most cases though, animation clips + * will automatically be created by loaders when importing animated 3D assets. + * + * @param {string} [name=''] - The clip's name. + * @param {number} [duration=-1] - The clip's duration in seconds. If a negative value is passed, + * the duration will be calculated from the passed keyframes. + * @param {Array} tracks - An array of keyframe tracks. + * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode=NormalAnimationBlendMode] - Defines how the animation + * is blended/combined when two or more animations are simultaneously played. + */ + constructor(name?: string, duration?: number, tracks?: Array, blendMode?: (number | AdditiveAnimationBlendMode)); + /** + * The clip's name. + * + * @type {string} + */ + name: string; + /** + * An array of keyframe tracks. + * + * @type {Array} + */ + tracks: Array; + /** + * The clip's duration in seconds. + * + * @type {number} + */ + duration: number; + /** + * Defines how the animation is blended/combined when two or more animations + * are simultaneously played. + * + * @type {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} + */ + blendMode: (number | AdditiveAnimationBlendMode); + /** + * The UUID of the animation clip. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * An object that can be used to store custom data about the animation clip. + * It should not hold references to functions as these will not be cloned. + * + * @type {Object} + */ + userData: Object; + /** + * Sets the duration of this clip to the duration of its longest keyframe track. + * + * @return {AnimationClip} A reference to this animation clip. + */ + resetDuration(): AnimationClip; + /** + * Trims all tracks to the clip's duration. + * + * @return {AnimationClip} A reference to this animation clip. + */ + trim(): AnimationClip; + /** + * Performs minimal validation on each track in the clip. Returns `true` if all + * tracks are valid. + * + * @return {boolean} Whether the clip's keyframes are valid or not. + */ + validate(): boolean; + /** + * Optimizes each track by removing equivalent sequential keys (which are + * common in morph target sequences). + * + * @return {AnimationClip} A reference to this animation clip. + */ + optimize(): AnimationClip; + /** + * Returns a new animation clip with copied values from this instance. + * + * @return {AnimationClip} A clone of this instance. + */ + clone(): AnimationClip; + /** + * Serializes this animation clip into JSON. + * + * @return {Object} The JSON object. + */ + toJSON(): Object; +} +import { KeyframeTrack } from './KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts new file mode 100644 index 000000000..b474470e7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts @@ -0,0 +1,152 @@ +/** + * `AnimationMixer` is a player for animations on a particular object in + * the scene. When multiple objects in the scene are animated independently, + * one `AnimationMixer` may be used for each object. + */ +export class AnimationMixer extends EventDispatcher { + /** + * Constructs a new animation mixer. + * + * @param {Object3D} root - The object whose animations shall be played by this mixer. + */ + constructor(root: Object3D); + _root: Object3D; + _accuIndex: number; + /** + * The global mixer time (in seconds; starting with `0` on the mixer's creation). + * + * @type {number} + * @default 0 + */ + time: number; + /** + * A scaling factor for the global time. + * + * Note: Setting this member to `0` and later back to `1` is a + * possibility to pause/unpause all actions that are controlled by this + * mixer. + * + * @type {number} + * @default 1 + */ + timeScale: number; + _bindAction(action: any, prototypeAction: any): void; + _activateAction(action: any): void; + _deactivateAction(action: any): void; + _initMemoryManager(): void; + _actions: any[] | undefined; + _nActiveActions: number | undefined; + _actionsByClip: {} | undefined; + _bindings: any[] | undefined; + _nActiveBindings: number | undefined; + _bindingsByRootAndName: {} | undefined; + _controlInterpolants: any[] | undefined; + _nActiveControlInterpolants: number | undefined; + stats: { + actions: { + readonly total: number; + readonly inUse: number | undefined; + }; + bindings: { + readonly total: number; + readonly inUse: number | undefined; + }; + controlInterpolants: { + readonly total: number; + readonly inUse: number | undefined; + }; + } | undefined; + _isActiveAction(action: any): boolean; + _addInactiveAction(action: any, clipUuid: any, rootUuid: any): void; + _removeInactiveAction(action: any): void; + _removeInactiveBindingsForAction(action: any): void; + _lendAction(action: any): void; + _takeBackAction(action: any): void; + _addInactiveBinding(binding: any, rootUuid: any, trackName: any): void; + _removeInactiveBinding(binding: any): void; + _lendBinding(binding: any): void; + _takeBackBinding(binding: any): void; + _lendControlInterpolant(): any; + _takeBackControlInterpolant(interpolant: any): void; + /** + * Returns an instance of {@link AnimationAction} for the passed clip. + * + * If an action fitting the clip and root parameters doesn't yet exist, it + * will be created by this method. Calling this method several times with the + * same clip and root parameters always returns the same action. + * + * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip. + * @param {Object3D} [optionalRoot] - An alternative root object. + * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode. + * @return {?AnimationAction} The animation action. + */ + clipAction(clip: AnimationClip | string, optionalRoot?: Object3D, blendMode?: (number | AdditiveAnimationBlendMode)): AnimationAction | null; + /** + * Returns an existing animation action for the passed clip. + * + * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip. + * @param {Object3D} [optionalRoot] - An alternative root object. + * @return {?AnimationAction} The animation action. Returns `null` if no action was found. + */ + existingAction(clip: AnimationClip | string, optionalRoot?: Object3D): AnimationAction | null; + /** + * Deactivates all previously scheduled actions on this mixer. + * + * @return {AnimationMixer} A reference to this animation mixer. + */ + stopAllAction(): AnimationMixer; + /** + * Advances the global mixer time and updates the animation. + * + * This is usually done in the render loop by passing the delta + * time from {@link Clock} or {@link Timer}. + * + * @param {number} deltaTime - The delta time in seconds. + * @return {AnimationMixer} A reference to this animation mixer. + */ + update(deltaTime: number): AnimationMixer; + /** + * Sets the global mixer to a specific time and updates the animation accordingly. + * + * This is useful when you need to jump to an exact time in an animation. The + * input parameter will be scaled by {@link AnimationMixer#timeScale} + * + * @param {number} time - The time to set in seconds. + * @return {AnimationMixer} A reference to this animation mixer. + */ + setTime(time: number): AnimationMixer; + /** + * Returns this mixer's root object. + * + * @return {Object3D} The mixer's root object. + */ + getRoot(): Object3D; + /** + * Deallocates all memory resources for a clip. Before using this method make + * sure to call {@link AnimationAction#stop} for all related actions. + * + * @param {AnimationClip} clip - The clip to uncache. + */ + uncacheClip(clip: AnimationClip): void; + /** + * Deallocates all memory resources for a root object. Before using this + * method make sure to call {@link AnimationAction#stop} for all related + * actions or alternatively {@link AnimationMixer#stopAllAction} when the + * mixer operates on a single root. + * + * @param {Object3D} root - The root object to uncache. + */ + uncacheRoot(root: Object3D): void; + /** + * Deallocates all memory resources for an action. The action is identified by the + * given clip and an optional root object. Before using this method make + * sure to call {@link AnimationAction#stop} to deactivate the action. + * + * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip. + * @param {Object3D} [optionalRoot] - An alternative root object. + */ + uncacheAction(clip: AnimationClip | string, optionalRoot?: Object3D): void; +} +import { EventDispatcher } from '../core/EventDispatcher.js'; +import { AnimationClip } from './AnimationClip.js'; +import { AnimationAction } from './AnimationAction.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts new file mode 100644 index 000000000..040c4af5c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts @@ -0,0 +1,77 @@ +/** + * A group of objects that receives a shared animation state. + * + * Usage: + * + * - Add objects you would otherwise pass as 'root' to the + * constructor or the .clipAction method of AnimationMixer. + * - Instead pass this object as 'root'. + * - You can also add and remove objects later when the mixer is running. + * + * Note: + * + * - Objects of this class appear as one object to the mixer, + * so cache control of the individual objects must be done on the group. + * + * Limitation: + * + * - The animated properties must be compatible among the all objects in the group. + * - A single property can either be controlled through a target group or directly, but not both. + */ +export class AnimationObjectGroup { + /** + * Constructs a new animation group. + * + * @param {...Object3D} arguments - An arbitrary number of 3D objects that share the same animation state. + */ + constructor(...args: Object3D[]); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAnimationObjectGroup: boolean; + /** + * The UUID of the 3D object. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + _objects: any[]; + nCachedObjects_: number; + _indicesByUUID: {}; + _paths: any[]; + _parsedPaths: any[]; + _bindings: any[]; + _bindingsIndicesByPath: {}; + stats: { + objects: { + readonly total: number; + readonly inUse: number; + }; + readonly bindingsPerObject: number; + }; + /** + * Adds an arbitrary number of objects to this animation group. + * + * @param {...Object3D} arguments - The 3D objects to add. + */ + add(...args: Object3D[]): void; + /** + * Removes an arbitrary number of objects to this animation group + * + * @param {...Object3D} arguments - The 3D objects to remove. + */ + remove(...args: Object3D[]): void; + /** + * Deallocates all memory resources for the passed 3D objects of this animation group. + * + * @param {...Object3D} arguments - The 3D objects to uncache. + */ + uncache(...args: Object3D[]): void; + subscribe_(path: any, parsedPath: any): any; + unsubscribe_(path: any): void; +} diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts new file mode 100644 index 000000000..7355fe037 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts @@ -0,0 +1,131 @@ +/** + * Converts an array to a specific type. + * + * @param {TypedArray|Array} array - The array to convert. + * @param {TypedArray.constructor} type - The constructor of a typed array that defines the new type. + * @return {TypedArray} The converted array. + */ +export function convertArray(array: TypedArray | any[], type: TypedArray.constructor): TypedArray; +import { isTypedArray } from '../utils.js'; +/** + * Returns an array by which times and values can be sorted. + * + * @param {Array} times - The keyframe time values. + * @return {Array} The array. + */ +export function getKeyframeOrder(times: Array): Array; +/** + * Sorts the given array by the previously computed order via `getKeyframeOrder()`. + * + * @param {Array} values - The values to sort. + * @param {number} stride - The stride. + * @param {Array} order - The sort order. + * @return {Array} The sorted values. + */ +export function sortedArray(values: Array, stride: number, order: Array): Array; +/** + * Used for parsing AOS keyframe formats. + * + * @param {Array} jsonKeys - A list of JSON keyframes. + * @param {Array} times - This array will be filled with keyframe times by this function. + * @param {Array} values - This array will be filled with keyframe values by this function. + * @param {string} valuePropertyName - The name of the property to use. + */ +export function flattenJSON(jsonKeys: Array, times: Array, values: Array, valuePropertyName: string): void; +/** + * Creates a new clip, containing only the segment of the original clip between the given frames. + * + * @param {AnimationClip} sourceClip - The values to sort. + * @param {string} name - The name of the clip. + * @param {number} startFrame - The start frame. + * @param {number} endFrame - The end frame. + * @param {number} [fps=30] - The FPS. + * @return {AnimationClip} The new sub clip. + */ +export function subclip(sourceClip: AnimationClip, name: string, startFrame: number, endFrame: number, fps?: number): AnimationClip; +/** + * Converts the keyframes of the given animation clip to an additive format. + * + * @param {AnimationClip} targetClip - The clip to make additive. + * @param {number} [referenceFrame=0] - The reference frame. + * @param {AnimationClip} [referenceClip=targetClip] - The reference clip. + * @param {number} [fps=30] - The FPS. + * @return {AnimationClip} The updated clip which is now additive. + */ +export function makeClipAdditive(targetClip: AnimationClip, referenceFrame?: number, referenceClip?: AnimationClip, fps?: number): AnimationClip; +/** + * A class with various methods to assist with animations. + * + * @hideconstructor + */ +export class AnimationUtils { + /** + * Converts an array to a specific type + * + * @static + * @param {TypedArray|Array} array - The array to convert. + * @param {TypedArray.constructor} type - The constructor of a type array. + * @return {TypedArray} The converted array + */ + static convertArray(array: TypedArray | any[], type: TypedArray.constructor): TypedArray; + /** + * Returns `true` if the given object is a typed array. + * + * @static + * @param {any} object - The object to check. + * @return {boolean} Whether the given object is a typed array. + */ + static isTypedArray(object: any): boolean; + /** + * Returns an array by which times and values can be sorted. + * + * @static + * @param {Array} times - The keyframe time values. + * @return {Array} The array. + */ + static getKeyframeOrder(times: Array): Array; + /** + * Sorts the given array by the previously computed order via `getKeyframeOrder()`. + * + * @static + * @param {Array} values - The values to sort. + * @param {number} stride - The stride. + * @param {Array} order - The sort order. + * @return {Array} The sorted values. + */ + static sortedArray(values: Array, stride: number, order: Array): Array; + /** + * Used for parsing AOS keyframe formats. + * + * @static + * @param {Array} jsonKeys - A list of JSON keyframes. + * @param {Array} times - This array will be filled with keyframe times by this method. + * @param {Array} values - This array will be filled with keyframe values by this method. + * @param {string} valuePropertyName - The name of the property to use. + */ + static flattenJSON(jsonKeys: Array, times: Array, values: Array, valuePropertyName: string): void; + /** + * Creates a new clip, containing only the segment of the original clip between the given frames. + * + * @static + * @param {AnimationClip} sourceClip - The values to sort. + * @param {string} name - The name of the clip. + * @param {number} startFrame - The start frame. + * @param {number} endFrame - The end frame. + * @param {number} [fps=30] - The FPS. + * @return {AnimationClip} The new sub clip. + */ + static subclip(sourceClip: AnimationClip, name: string, startFrame: number, endFrame: number, fps?: number): AnimationClip; + /** + * Converts the keyframes of the given animation clip to an additive format. + * + * @static + * @param {AnimationClip} targetClip - The clip to make additive. + * @param {number} [referenceFrame=0] - The reference frame. + * @param {AnimationClip} [referenceClip=targetClip] - The reference clip. + * @param {number} [fps=30] - The FPS. + * @return {AnimationClip} The updated clip which is now additive. + */ + static makeClipAdditive(targetClip: AnimationClip, referenceFrame?: number, referenceClip?: AnimationClip, fps?: number): AnimationClip; +} +export { isTypedArray }; diff --git a/jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts new file mode 100644 index 000000000..72239e7a2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts @@ -0,0 +1,178 @@ +/** + * Represents a timed sequence of keyframes, which are composed of lists of + * times and related values, and which are used to animate a specific property + * of an object. + */ +export class KeyframeTrack { + /** + * Converts the keyframe track to JSON. + * + * @static + * @param {KeyframeTrack} track - The keyframe track to serialize. + * @return {Object} The serialized keyframe track as JSON. + */ + static toJSON(track: KeyframeTrack): Object; + /** + * Constructs a new keyframe track. + * + * @param {string} name - The keyframe track's name. + * @param {Array} times - A list of keyframe times. + * @param {Array} values - A list of keyframe values. + * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} [interpolation] - The interpolation type. + */ + constructor(name: string, times: Array, values: Array, interpolation?: (number | number | number | number)); + /** + * The track's name can refer to morph targets or bones or + * possibly other values within an animated object. See {@link PropertyBinding#parseTrackName} + * for the forms of strings that can be parsed for property binding. + * + * @type {string} + */ + name: string; + /** + * The keyframe times. + * + * @type {Float32Array} + */ + times: Float32Array; + /** + * The keyframe values. + * + * @type {Float32Array} + */ + values: Float32Array; + /** + * Factory method for creating a new discrete interpolant. + * + * @static + * @param {TypedArray} [result] - The result buffer. + * @return {DiscreteInterpolant} The new interpolant. + */ + InterpolantFactoryMethodDiscrete(result?: TypedArray): DiscreteInterpolant; + /** + * Factory method for creating a new linear interpolant. + * + * @static + * @param {TypedArray} [result] - The result buffer. + * @return {LinearInterpolant} The new interpolant. + */ + InterpolantFactoryMethodLinear(result?: TypedArray): LinearInterpolant; + /** + * Factory method for creating a new smooth interpolant. + * + * @static + * @param {TypedArray} [result] - The result buffer. + * @return {CubicInterpolant} The new interpolant. + */ + InterpolantFactoryMethodSmooth(result?: TypedArray): CubicInterpolant; + /** + * Factory method for creating a new Bezier interpolant. + * + * The Bezier interpolant requires tangent data to be set via the `settings` property + * on the track before creating the interpolant. The settings should contain: + * - `inTangents`: Float32Array with [time, value] pairs per keyframe per component + * - `outTangents`: Float32Array with [time, value] pairs per keyframe per component + * + * @static + * @param {TypedArray} [result] - The result buffer. + * @return {BezierInterpolant} The new interpolant. + */ + InterpolantFactoryMethodBezier(result?: TypedArray): BezierInterpolant; + /** + * Defines the interpolation factor method for this keyframe track. + * + * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} interpolation - The interpolation type. + * @return {KeyframeTrack} A reference to this keyframe track. + */ + setInterpolation(interpolation: (number | number | number | number)): KeyframeTrack; + createInterpolant: ((result?: TypedArray) => LinearInterpolant) | ((result?: TypedArray) => CubicInterpolant) | undefined; + /** + * Returns the current interpolation type. + * + * @return {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} The interpolation type. + */ + getInterpolation(): (number | number | number | number); + /** + * Returns the value size. + * + * @return {number} The value size. + */ + getValueSize(): number; + /** + * Moves all keyframes either forward or backward in time. + * + * @param {number} timeOffset - The offset to move the time values. + * @return {KeyframeTrack} A reference to this keyframe track. + */ + shift(timeOffset: number): KeyframeTrack; + /** + * Scale all keyframe times by a factor (useful for frame - seconds conversions). + * + * @param {number} timeScale - The time scale. + * @return {KeyframeTrack} A reference to this keyframe track. + */ + scale(timeScale: number): KeyframeTrack; + /** + * Removes keyframes before and after animation without changing any values within the defined time range. + * + * Note: The method does not shift around keys to the start of the track time, because for interpolated + * keys this will change their values + * + * @param {number} startTime - The start time. + * @param {number} endTime - The end time. + * @return {KeyframeTrack} A reference to this keyframe track. + */ + trim(startTime: number, endTime: number): KeyframeTrack; + /** + * Performs minimal validation on the keyframe track. Returns `true` if the values + * are valid. + * + * @return {boolean} Whether the keyframes are valid or not. + */ + validate(): boolean; + /** + * Optimizes this keyframe track by removing equivalent sequential keys (which are + * common in morph target sequences). + * + * @return {KeyframeTrack} A reference to this keyframe track. + */ + optimize(): KeyframeTrack; + /** + * Returns a new keyframe track with copied values from this instance. + * + * @return {KeyframeTrack} A clone of this instance. + */ + clone(): KeyframeTrack; + /** + * The value type name. + * + * @type {string} + * @default '' + */ + ValueTypeName: string; + /** + * The time buffer type of this keyframe track. + * + * @type {TypedArray|Array} + * @default Float32Array.constructor + */ + TimeBufferType: TypedArray | any[]; + /** + * The value buffer type of this keyframe track. + * + * @type {TypedArray|Array} + * @default Float32Array.constructor + */ + ValueBufferType: TypedArray | any[]; + /** + * The default interpolation type of this keyframe track. + * + * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} + * @default InterpolateLinear + */ + DefaultInterpolation: (number | number | number | number); +} +import { DiscreteInterpolant } from '../math/interpolants/DiscreteInterpolant.js'; +import { LinearInterpolant } from '../math/interpolants/LinearInterpolant.js'; +import { CubicInterpolant } from '../math/interpolants/CubicInterpolant.js'; +import { BezierInterpolant } from '../math/interpolants/BezierInterpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts b/jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts new file mode 100644 index 000000000..af4e99d9d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts @@ -0,0 +1,144 @@ +/** + * This holds a reference to a real property in the scene graph; used internally. + */ +export class PropertyBinding { + /** + * Factory method for creating a property binding from the given parameters. + * + * @static + * @param {Object} root - The root node. + * @param {string} path - The path. + * @param {?Object} [parsedPath] - The parsed path. + * @return {PropertyBinding|Composite} The created property binding or composite. + */ + static create(root: Object, path: string, parsedPath?: Object | null): PropertyBinding | Composite; + /** + * Replaces spaces with underscores and removes unsupported characters from + * node names, to ensure compatibility with parseTrackName(). + * + * @param {string} name - Node name to be sanitized. + * @return {string} The sanitized node name. + */ + static sanitizeNodeName(name: string): string; + /** + * Parses the given track name (an object path to an animated property) and + * returns an object with information about the path. Matches strings in the following forms: + * + * - nodeName.property + * - nodeName.property[accessor] + * - nodeName.material.property[accessor] + * - uuid.property[accessor] + * - uuid.objectName[objectIndex].propertyName[propertyIndex] + * - parentName/nodeName.property + * - parentName/parentName/nodeName.property[index] + * - .bone[Armature.DEF_cog].position + * - scene:helium_balloon_model:helium_balloon_model.position + * + * @static + * @param {string} trackName - The track name to parse. + * @return {Object} The parsed track name as an object. + */ + static parseTrackName(trackName: string): Object; + /** + * Searches for a node in the hierarchy of the given root object by the given + * node name. + * + * @static + * @param {Object} root - The root object. + * @param {string|number} nodeName - The name of the node. + * @return {?Object} The found node. Returns `null` if no object was found. + */ + static findNode(root: Object, nodeName: string | number): Object | null; + /** + * Constructs a new property binding. + * + * @param {Object} rootNode - The root node. + * @param {string} path - The path. + * @param {?Object} [parsedPath] - The parsed path. + */ + constructor(rootNode: Object, path: string, parsedPath?: Object | null); + /** + * The object path to the animated property. + * + * @type {string} + */ + path: string; + /** + * An object holding information about the path. + * + * @type {Object} + */ + parsedPath: Object; + /** + * The object owns the animated property. + * + * @type {?Object} + */ + node: Object | null; + /** + * The root node. + * + * @type {Object3D|Skeleton} + */ + rootNode: Object3D | Skeleton; + getValue: (targetArray: any, offset: any) => void; + setValue: (sourceArray: any, offset: any) => void; + _getValue_unavailable(): void; + _setValue_unavailable(): void; + _getValue_direct(buffer: any, offset: any): void; + _getValue_array(buffer: any, offset: any): void; + _getValue_arrayElement(buffer: any, offset: any): void; + _getValue_toArray(buffer: any, offset: any): void; + _setValue_direct(buffer: any, offset: any): void; + _setValue_direct_setNeedsUpdate(buffer: any, offset: any): void; + _setValue_direct_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; + _setValue_array(buffer: any, offset: any): void; + _setValue_array_setNeedsUpdate(buffer: any, offset: any): void; + _setValue_array_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; + _setValue_arrayElement(buffer: any, offset: any): void; + _setValue_arrayElement_setNeedsUpdate(buffer: any, offset: any): void; + _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; + _setValue_fromArray(buffer: any, offset: any): void; + _setValue_fromArray_setNeedsUpdate(buffer: any, offset: any): void; + _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; + _getValue_unbound(targetArray: any, offset: any): void; + _setValue_unbound(sourceArray: any, offset: any): void; + /** + * Creates a getter / setter pair for the property tracked by this binding. + */ + bind(): void; + targetObject: Object | null | undefined; + resolvedProperty: any; + propertyIndex: any; + propertyName: any; + /** + * Unbinds the property. + */ + unbind(): void; + BindingType: { + Direct: number; + EntireArray: number; + ArrayElement: number; + HasFromToArray: number; + }; + Versioning: { + None: number; + NeedsUpdate: number; + MatrixWorldNeedsUpdate: number; + }; + GetterByBindingType: ((buffer: any, offset: any) => void)[]; + SetterByBindingTypeAndVersioning: ((buffer: any, offset: any) => void)[][]; +} +export namespace PropertyBinding { + export { Composite }; +} +declare class Composite { + constructor(targetGroup: any, path: any, optionalParsedPath: any); + _targetGroup: any; + _bindings: any; + getValue(array: any, offset: any): void; + setValue(array: any, offset: any): void; + bind(): void; + unbind(): void; +} +export {}; diff --git a/jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts b/jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts new file mode 100644 index 000000000..0f715aa7b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts @@ -0,0 +1,95 @@ +/** + * Buffered scene graph property that allows weighted accumulation; used internally. + */ +export class PropertyMixer { + /** + * Constructs a new property mixer. + * + * @param {PropertyBinding} binding - The property binding. + * @param {string} typeName - The keyframe track type name. + * @param {number} valueSize - The keyframe track value size. + */ + constructor(binding: PropertyBinding, typeName: string, valueSize: number); + /** + * The property binding. + * + * @type {PropertyBinding} + */ + binding: PropertyBinding; + /** + * The keyframe track value size. + * + * @type {number} + */ + valueSize: number; + buffer: any[] | Float64Array; + _workIndex: number | undefined; + _mixBufferRegion: (buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any) => void; + _mixBufferRegionAdditive: (buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any) => void; + _setIdentity: () => void; + _origIndex: number; + _addIndex: number; + /** + * Accumulated weight of the property binding. + * + * @type {number} + * @default 0 + */ + cumulativeWeight: number; + /** + * Accumulated additive weight of the property binding. + * + * @type {number} + * @default 0 + */ + cumulativeWeightAdditive: number; + /** + * Number of active keyframe tracks currently using this property binding. + * + * @type {number} + * @default 0 + */ + useCount: number; + /** + * Number of keyframe tracks referencing this property binding. + * + * @type {number} + * @default 0 + */ + referenceCount: number; + /** + * Accumulates data in the `incoming` region into `accu`. + * + * @param {number} accuIndex - The accumulation index. + * @param {number} weight - The weight. + */ + accumulate(accuIndex: number, weight: number): void; + /** + * Accumulates data in the `incoming` region into `add`. + * + * @param {number} weight - The weight. + */ + accumulateAdditive(weight: number): void; + /** + * Applies the state of `accu` to the binding when accus differ. + * + * @param {number} accuIndex - The accumulation index. + */ + apply(accuIndex: number): void; + /** + * Remembers the state of the bound property and copy it to both accus. + */ + saveOriginalState(): void; + /** + * Applies the state previously taken via {@link PropertyMixer#saveOriginalState} to the binding. + */ + restoreOriginalState(): void; + _setAdditiveIdentityNumeric(): void; + _setAdditiveIdentityQuaternion(): void; + _setAdditiveIdentityOther(): void; + _select(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; + _slerp(buffer: any, dstOffset: any, srcOffset: any, t: any): void; + _slerpAdditive(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; + _lerp(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; + _lerpAdditive(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; +} diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts new file mode 100644 index 000000000..d8e3cfd7f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts @@ -0,0 +1,28 @@ +/** + * A track for boolean keyframe values. + * + * @augments KeyframeTrack + */ +export class BooleanKeyframeTrack extends KeyframeTrack { + /** + * Constructs a new boolean keyframe track. + * + * This keyframe track type has no `interpolation` parameter because the + * interpolation is always discrete. + * + * @param {string} name - The keyframe track's name. + * @param {Array} times - A list of keyframe times. + * @param {Array} values - A list of keyframe values. + */ + constructor(name: string, times: Array, values: Array); + /** + * The default interpolation type of this keyframe track. + * + * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} + * @default InterpolateDiscrete + */ + DefaultInterpolation: (InterpolateLinear | number | InterpolateSmooth); + InterpolantFactoryMethodLinear: any; + InterpolantFactoryMethodSmooth: any; +} +import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts new file mode 100644 index 000000000..aa0f64d74 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts @@ -0,0 +1,17 @@ +/** + * A track for color keyframe values. + * + * @augments KeyframeTrack + */ +export class ColorKeyframeTrack extends KeyframeTrack { + /** + * Constructs a new color keyframe track. + * + * @param {string} name - The keyframe track's name. + * @param {Array} times - A list of keyframe times. + * @param {Array} values - A list of keyframe values. + * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. + */ + constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); +} +import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts new file mode 100644 index 000000000..f83c955ca --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts @@ -0,0 +1,17 @@ +/** + * A track for numeric keyframe values. + * + * @augments KeyframeTrack + */ +export class NumberKeyframeTrack extends KeyframeTrack { + /** + * Constructs a new number keyframe track. + * + * @param {string} name - The keyframe track's name. + * @param {Array} times - A list of keyframe times. + * @param {Array} values - A list of keyframe values. + * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. + */ + constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); +} +import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts new file mode 100644 index 000000000..98e4a75e2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts @@ -0,0 +1,18 @@ +/** + * A track for Quaternion keyframe values. + * + * @augments KeyframeTrack + */ +export class QuaternionKeyframeTrack extends KeyframeTrack { + /** + * Constructs a new Quaternion keyframe track. + * + * @param {string} name - The keyframe track's name. + * @param {Array} times - A list of keyframe times. + * @param {Array} values - A list of keyframe values. + * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. + */ + constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); + InterpolantFactoryMethodSmooth: any; +} +import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts new file mode 100644 index 000000000..95c5bd155 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts @@ -0,0 +1,28 @@ +/** + * A track for string keyframe values. + * + * @augments KeyframeTrack + */ +export class StringKeyframeTrack extends KeyframeTrack { + /** + * Constructs a new string keyframe track. + * + * This keyframe track type has no `interpolation` parameter because the + * interpolation is always discrete. + * + * @param {string} name - The keyframe track's name. + * @param {Array} times - A list of keyframe times. + * @param {Array} values - A list of keyframe values. + */ + constructor(name: string, times: Array, values: Array); + /** + * The default interpolation type of this keyframe track. + * + * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} + * @default InterpolateDiscrete + */ + DefaultInterpolation: (InterpolateLinear | number | InterpolateSmooth); + InterpolantFactoryMethodLinear: any; + InterpolantFactoryMethodSmooth: any; +} +import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts new file mode 100644 index 000000000..856db2d58 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts @@ -0,0 +1,17 @@ +/** + * A track for vector keyframe values. + * + * @augments KeyframeTrack + */ +export class VectorKeyframeTrack extends KeyframeTrack { + /** + * Constructs a new vector keyframe track. + * + * @param {string} name - The keyframe track's name. + * @param {Array} times - A list of keyframe times. + * @param {Array} values - A list of keyframe values. + * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. + */ + constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); +} +import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/audio/Audio.d.ts b/jsdoc-testing/jsdoc/src/audio/Audio.d.ts new file mode 100644 index 000000000..755622769 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/audio/Audio.d.ts @@ -0,0 +1,379 @@ +/** + * Represents a non-positional ( global ) audio object. + * + * This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/). + * + * ```js + * // create an AudioListener and add it to the camera + * const listener = new THREE.AudioListener(); + * camera.add( listener ); + * + * // create a global audio source + * const sound = new THREE.Audio( listener ); + * + * // load a sound and set it as the Audio object's buffer + * const audioLoader = new THREE.AudioLoader(); + * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { + * sound.setBuffer( buffer ); + * sound.setLoop( true ); + * sound.setVolume( 0.5 ); + * sound.play(); + * }); + * ``` + * + * @augments Object3D + */ +export class Audio extends Object3D { + /** + * Constructs a new audio. + * + * @param {AudioListener} listener - The global audio listener. + */ + constructor(listener: AudioListener); + type: string; + /** + * The global audio listener. + * + * @type {AudioListener} + * @readonly + */ + readonly listener: AudioListener; + /** + * The audio context. + * + * @type {AudioContext} + * @readonly + */ + readonly context: AudioContext; + /** + * The gain node used for volume control. + * + * @type {GainNode} + * @readonly + */ + readonly gain: GainNode; + /** + * Whether to start playback automatically or not. + * + * @type {boolean} + * @default false + */ + autoplay: boolean; + /** + * A reference to an audio buffer. + * + * Defined via {@link Audio#setBuffer}. + * + * @type {?AudioBuffer} + * @default null + * @readonly + */ + readonly buffer: AudioBuffer | null; + /** + * Modify pitch, measured in cents. +/- 100 is a semitone. + * +/- 1200 is an octave. + * + * Defined via {@link Audio#setDetune}. + * + * @type {number} + * @default 0 + * @readonly + */ + readonly detune: number; + /** + * Whether the audio should loop or not. + * + * Defined via {@link Audio#setLoop}. + * + * @type {boolean} + * @default false + * @readonly + */ + readonly loop: boolean; + /** + * Defines where in the audio buffer the replay should + * start, in seconds. + * + * @type {number} + * @default 0 + */ + loopStart: number; + /** + * Defines where in the audio buffer the replay should + * stop, in seconds. + * + * @type {number} + * @default 0 + */ + loopEnd: number; + /** + * An offset to the time within the audio buffer the playback + * should begin, in seconds. + * + * @type {number} + * @default 0 + */ + offset: number; + /** + * Overrides the default duration of the audio. + * + * @type {undefined|number} + * @default undefined + */ + duration: undefined | number; + /** + * The playback speed. + * + * Defined via {@link Audio#setPlaybackRate}. + * + * @type {number} + * @readonly + * @default 1 + */ + readonly playbackRate: number; + /** + * Indicates whether the audio is playing or not. + * + * This flag will be automatically set when using {@link Audio#play}, + * {@link Audio#pause}, {@link Audio#stop}. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly isPlaying: boolean; + /** + * Indicates whether the audio playback can be controlled + * with method like {@link Audio#play} or {@link Audio#pause}. + * + * This flag will be automatically set when audio sources are + * defined. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly hasPlaybackControl: boolean; + /** + * Holds a reference to the current audio source. + * + * The property is automatically by one of the `set*()` methods. + * + * @type {?AudioNode} + * @readonly + * @default null + */ + readonly source: AudioNode | null; + /** + * Defines the source type. + * + * The property is automatically set by one of the `set*()` methods. + * + * @type {('empty'|'audioNode'|'mediaNode'|'mediaStreamNode'|'buffer')} + * @readonly + * @default 'empty' + */ + readonly sourceType: ("empty" | "audioNode" | "mediaNode" | "mediaStreamNode" | "buffer"); + _startedAt: number; + _progress: number; + _connected: boolean; + /** + * Can be used to apply a variety of low-order filters to create + * more complex sound effects e.g. via `BiquadFilterNode`. + * + * The property is automatically set by {@link Audio#setFilters}. + * + * @type {Array} + * @readonly + */ + readonly filters: Array; + /** + * Returns the output audio node. + * + * @return {GainNode} The output node. + */ + getOutput(): GainNode; + /** + * Sets the given audio node as the source of this instance. + * + * {@link Audio#sourceType} is set to `audioNode` and {@link Audio#hasPlaybackControl} to `false`. + * + * @param {AudioNode} audioNode - The audio node like an instance of `OscillatorNode`. + * @return {Audio} A reference to this instance. + */ + setNodeSource(audioNode: AudioNode): Audio; + /** + * Sets the given media element as the source of this instance. + * + * {@link Audio#sourceType} is set to `mediaNode` and {@link Audio#hasPlaybackControl} to `false`. + * + * @param {HTMLMediaElement} mediaElement - The media element. + * @return {Audio} A reference to this instance. + */ + setMediaElementSource(mediaElement: HTMLMediaElement): Audio; + /** + * Sets the given media stream as the source of this instance. + * + * {@link Audio#sourceType} is set to `mediaStreamNode` and {@link Audio#hasPlaybackControl} to `false`. + * + * @param {MediaStream} mediaStream - The media stream. + * @return {Audio} A reference to this instance. + */ + setMediaStreamSource(mediaStream: MediaStream): Audio; + /** + * Sets the given audio buffer as the source of this instance. + * + * {@link Audio#sourceType} is set to `buffer` and {@link Audio#hasPlaybackControl} to `true`. + * + * @param {AudioBuffer} audioBuffer - The audio buffer. + * @return {Audio} A reference to this instance. + */ + setBuffer(audioBuffer: AudioBuffer): Audio; + /** + * Starts the playback of the audio. + * + * Can only be used with compatible audio sources that allow playback control. + * + * @param {number} [delay=0] - The delay, in seconds, at which the audio should start playing. + * @return {Audio|undefined} A reference to this instance. + */ + play(delay?: number): Audio | undefined; + /** + * Pauses the playback of the audio. + * + * Can only be used with compatible audio sources that allow playback control. + * + * @return {Audio|undefined} A reference to this instance. + */ + pause(): Audio | undefined; + /** + * Stops the playback of the audio. + * + * Can only be used with compatible audio sources that allow playback control. + * + * @param {number} [delay=0] - The delay, in seconds, at which the audio should stop playing. + * @return {Audio|undefined} A reference to this instance. + */ + stop(delay?: number): Audio | undefined; + /** + * Connects to the audio source. This is used internally on + * initialisation and when setting / removing filters. + * + * @return {Audio} A reference to this instance. + */ + connect(): Audio; + /** + * Disconnects to the audio source. This is used internally on + * initialisation and when setting / removing filters. + * + * @return {Audio|undefined} A reference to this instance. + */ + disconnect(): Audio | undefined; + /** + * Returns the current set filters. + * + * @return {Array} The list of filters. + */ + getFilters(): Array; + /** + * Sets an array of filters and connects them with the audio source. + * + * @param {Array} [value] - A list of filters. + * @return {Audio} A reference to this instance. + */ + setFilters(value?: Array): Audio; + /** + * Defines the detuning of oscillation in cents. + * + * @param {number} value - The detuning of oscillation in cents. + * @return {Audio} A reference to this instance. + */ + setDetune(value: number): Audio; + /** + * Returns the detuning of oscillation in cents. + * + * @return {number} The detuning of oscillation in cents. + */ + getDetune(): number; + /** + * Returns the first filter in the list of filters. + * + * @return {AudioNode|undefined} The first filter in the list of filters. + */ + getFilter(): AudioNode | undefined; + /** + * Applies a single filter node to the audio. + * + * @param {AudioNode} [filter] - The filter to set. + * @return {Audio} A reference to this instance. + */ + setFilter(filter?: AudioNode): Audio; + /** + * Sets the playback rate. + * + * Can only be used with compatible audio sources that allow playback control. + * + * @param {number} [value] - The playback rate to set. + * @return {Audio|undefined} A reference to this instance. + */ + setPlaybackRate(value?: number): Audio | undefined; + /** + * Returns the current playback rate. + + * @return {number} The playback rate. + */ + getPlaybackRate(): number; + /** + * Automatically called when playback finished. + */ + onEnded(): void; + /** + * Returns the loop flag. + * + * Can only be used with compatible audio sources that allow playback control. + * + * @return {boolean} Whether the audio should loop or not. + */ + getLoop(): boolean; + /** + * Sets the loop flag. + * + * Can only be used with compatible audio sources that allow playback control. + * + * @param {boolean} value - Whether the audio should loop or not. + * @return {Audio|undefined} A reference to this instance. + */ + setLoop(value: boolean): Audio | undefined; + /** + * Sets the loop start value which defines where in the audio buffer the replay should + * start, in seconds. + * + * @param {number} value - The loop start value. + * @return {Audio} A reference to this instance. + */ + setLoopStart(value: number): Audio; + /** + * Sets the loop end value which defines where in the audio buffer the replay should + * stop, in seconds. + * + * @param {number} value - The loop end value. + * @return {Audio} A reference to this instance. + */ + setLoopEnd(value: number): Audio; + /** + * Returns the volume. + * + * @return {number} The volume. + */ + getVolume(): number; + /** + * Sets the volume. + * + * @param {number} value - The volume to set. + * @return {Audio} A reference to this instance. + */ + setVolume(value: number): Audio; + copy(source: any, recursive: any): this; + clone(recursive: any): any; +} +import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts b/jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts new file mode 100644 index 000000000..241498397 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts @@ -0,0 +1,65 @@ +/** + * This class can be used to analyse audio data. + * + * ```js + * // create an AudioListener and add it to the camera + * const listener = new THREE.AudioListener(); + * camera.add( listener ); + * + * // create an Audio source + * const sound = new THREE.Audio( listener ); + * + * // load a sound and set it as the Audio object's buffer + * const audioLoader = new THREE.AudioLoader(); + * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { + * sound.setBuffer( buffer ); + * sound.setLoop(true); + * sound.setVolume(0.5); + * sound.play(); + * }); + * + * // create an AudioAnalyser, passing in the sound and desired fftSize + * const analyser = new THREE.AudioAnalyser( sound, 32 ); + * + * // get the average frequency of the sound + * const data = analyser.getAverageFrequency(); + * ``` + */ +export class AudioAnalyser { + /** + * Constructs a new audio analyzer. + * + * @param {Audio} audio - The audio to analyze. + * @param {number} [fftSize=2048] - The window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data. + */ + constructor(audio: new (src?: string) => HTMLAudioElement, fftSize?: number); + /** + * The global audio listener. + * + * @type {AnalyserNode} + */ + analyser: AnalyserNode; + /** + * Holds the analyzed data. + * + * @type {Uint8Array} + */ + data: Uint8Array; + /** + * Returns an array with frequency data of the audio. + * + * Each item in the array represents the decibel value for a specific frequency. + * The frequencies are spread linearly from 0 to 1/2 of the sample rate. + * For example, for 48000 sample rate, the last item of the array will represent + * the decibel value for 24000 Hz. + * + * @return {Uint8Array} The frequency data. + */ + getFrequencyData(): Uint8Array; + /** + * Returns the average of the frequencies returned by {@link AudioAnalyser#getFrequencyData}. + * + * @return {number} The average frequency. + */ + getAverageFrequency(): number; +} diff --git a/jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts b/jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts new file mode 100644 index 000000000..3a4632519 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts @@ -0,0 +1,19 @@ +/** + * Manages the global audio context in the engine. + * + * @hideconstructor + */ +export class AudioContext { + /** + * Returns the global native audio context. + * + * @return {Window.AudioContext} The native audio context. + */ + static getContext(): Window.AudioContext; + /** + * Allows to set the global native audio context from outside. + * + * @param {Window.AudioContext} value - The native context to set. + */ + static setContext(value: Window.AudioContext): void; +} diff --git a/jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts b/jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts new file mode 100644 index 000000000..c668dd516 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts @@ -0,0 +1,91 @@ +/** + * The class represents a virtual listener of the all positional and non-positional audio effects + * in the scene. A three.js application usually creates a single listener. It is a mandatory + * constructor parameter for audios entities like {@link Audio} and {@link PositionalAudio}. + * + * In most cases, the listener object is a child of the camera. So the 3D transformation of the + * camera represents the 3D transformation of the listener. + * + * @augments Object3D + */ +export class AudioListener extends Object3D { + type: string; + /** + * The native audio context. + * + * @type {AudioContext} + * @readonly + */ + readonly context: AudioContext; + /** + * The gain node used for volume control. + * + * @type {GainNode} + * @readonly + */ + readonly gain: GainNode; + /** + * An optional filter. + * + * Defined via {@link AudioListener#setFilter}. + * + * @type {?AudioNode} + * @default null + * @readonly + */ + readonly filter: AudioNode | null; + /** + * Time delta values required for `linearRampToValueAtTime()` usage. + * + * @type {number} + * @default 0 + * @readonly + */ + readonly timeDelta: number; + _timer: Timer; + /** + * Returns the listener's input node. + * + * This method is used by other audio nodes to connect to this listener. + * + * @return {GainNode} The input node. + */ + getInput(): GainNode; + /** + * Removes the current filter from this listener. + * + * @return {AudioListener} A reference to this listener. + */ + removeFilter(): AudioListener; + /** + * Returns the current set filter. + * + * @return {?AudioNode} The filter. + */ + getFilter(): AudioNode | null; + /** + * Sets the given filter to this listener. + * + * @param {AudioNode} value - The filter to set. + * @return {AudioListener} A reference to this listener. + */ + setFilter(value: AudioNode): AudioListener; + /** + * Returns the applications master volume. + * + * @return {number} The master volume. + */ + getMasterVolume(): number; + /** + * Sets the applications master volume. This volume setting affects + * all audio nodes in the scene. + * + * @param {number} value - The master volume to set. + * @return {AudioListener} A reference to this listener. + */ + setMasterVolume(value: number): AudioListener; + updateMatrixWorld(force: any): void; +} +import { Object3D } from '../core/Object3D.js'; +import { AudioContext } from './AudioContext.js'; +import { Timer } from '../core/Timer.js'; diff --git a/jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts b/jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts new file mode 100644 index 000000000..03307384c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts @@ -0,0 +1,115 @@ +/** + * Represents a positional audio object. + * + * ```js + * // create an AudioListener and add it to the camera + * const listener = new THREE.AudioListener(); + * camera.add( listener ); + * + * // create the PositionalAudio object (passing in the listener) + * const sound = new THREE.PositionalAudio( listener ); + * + * // load a sound and set it as the PositionalAudio object's buffer + * const audioLoader = new THREE.AudioLoader(); + * audioLoader.load( 'sounds/song.ogg', function( buffer ) { + * sound.setBuffer( buffer ); + * sound.setRefDistance( 20 ); + * sound.play(); + * }); + * + * // create an object for the sound to play from + * const sphere = new THREE.SphereGeometry( 20, 32, 16 ); + * const material = new THREE.MeshPhongMaterial( { color: 0xff2200 } ); + * const mesh = new THREE.Mesh( sphere, material ); + * scene.add( mesh ); + * + * // finally add the sound to the mesh + * mesh.add( sound ); + * + * @augments Audio + */ +export class PositionalAudio extends Audio { + /** + * The panner node represents the location, direction, and behavior of an audio + * source in 3D space. + * + * @type {PannerNode} + * @readonly + */ + readonly panner: PannerNode; + connect(): this; + disconnect(): this; + getOutput(): PannerNode; + /** + * Returns the current reference distance. + * + * @return {number} The reference distance. + */ + getRefDistance(): number; + /** + * Defines the reference distance for reducing volume as the audio source moves + * further from the listener – i.e. the distance at which the volume reduction + * starts taking effect. + * + * @param {number} value - The reference distance to set. + * @return {PositionalAudio} A reference to this instance. + */ + setRefDistance(value: number): PositionalAudio; + /** + * Returns the current rolloff factor. + * + * @return {number} The rolloff factor. + */ + getRolloffFactor(): number; + /** + * Defines how quickly the volume is reduced as the source moves away from the listener. + * + * @param {number} value - The rolloff factor. + * @return {PositionalAudio} A reference to this instance. + */ + setRolloffFactor(value: number): PositionalAudio; + /** + * Returns the current distance model. + * + * @return {('linear'|'inverse'|'exponential')} The distance model. + */ + getDistanceModel(): ("linear" | "inverse" | "exponential"); + /** + * Defines which algorithm to use to reduce the volume of the audio source + * as it moves away from the listener. + * + * Read [the spec](https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype) + * for more details. + * + * @param {('linear'|'inverse'|'exponential')} value - The distance model to set. + * @return {PositionalAudio} A reference to this instance. + */ + setDistanceModel(value: ("linear" | "inverse" | "exponential")): PositionalAudio; + /** + * Returns the current max distance. + * + * @return {number} The max distance. + */ + getMaxDistance(): number; + /** + * Defines the maximum distance between the audio source and the listener, + * after which the volume is not reduced any further. + * + * This value is used only by the `linear` distance model. + * + * @param {number} value - The max distance. + * @return {PositionalAudio} A reference to this instance. + */ + setMaxDistance(value: number): PositionalAudio; + /** + * Sets the directional cone in which the audio can be listened. + * + * @param {number} coneInnerAngle - An angle, in degrees, of a cone inside of which there will be no volume reduction. + * @param {number} coneOuterAngle - An angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the `coneOuterGain` parameter. + * @param {number} coneOuterGain - The amount of volume reduction outside the cone defined by the `coneOuterAngle`. When set to `0`, no sound can be heard. + * @return {PositionalAudio} A reference to this instance. + */ + setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): PositionalAudio; + updateMatrixWorld(force: any): void; +} +import { Audio } from './Audio.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts new file mode 100644 index 000000000..d1dd98d30 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts @@ -0,0 +1,42 @@ +/** + * This type of camera can be used in order to efficiently render a scene with a + * predefined set of cameras. This is an important performance aspect for + * rendering VR scenes. + * + * An instance of `ArrayCamera` always has an array of sub cameras. It's mandatory + * to define for each sub camera the `viewport` property which determines the + * part of the viewport that is rendered with this camera. + * + * @augments PerspectiveCamera + */ +export class ArrayCamera extends PerspectiveCamera { + /** + * Constructs a new array camera. + * + * @param {Array} [array=[]] - An array of perspective sub cameras. + */ + constructor(array?: Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayCamera: boolean; + /** + * Whether this camera is used with multiview rendering or not. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly isMultiViewCamera: boolean; + /** + * An array of perspective sub cameras. + * + * @type {Array} + */ + cameras: Array; +} +import { PerspectiveCamera } from './PerspectiveCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/Camera.d.ts b/jsdoc-testing/jsdoc/src/cameras/Camera.d.ts new file mode 100644 index 000000000..67a368630 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/cameras/Camera.d.ts @@ -0,0 +1,56 @@ +/** + * Abstract base class for cameras. This class should always be inherited + * when you build a new camera. + * + * @abstract + * @augments Object3D + */ +export class Camera extends Object3D { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCamera: boolean; + type: string; + /** + * The inverse of the camera's world matrix. + * + * @type {Matrix4} + */ + matrixWorldInverse: Matrix4; + /** + * The camera's projection matrix. + * + * @type {Matrix4} + */ + projectionMatrix: Matrix4; + /** + * The inverse of the camera's projection matrix. + * + * @type {Matrix4} + */ + projectionMatrixInverse: Matrix4; + /** + * The coordinate system in which the camera is used. + * + * @type {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} + */ + coordinateSystem: (number | WebGPUCoordinateSystem); + _reversedDepth: boolean; + /** + * The flag that indicates whether the camera uses a reversed depth buffer. + * + * @type {boolean} + * @default false + */ + get reversedDepth(): boolean; + copy(source: any, recursive: any): this; + updateMatrixWorld(force: any): void; + updateWorldMatrix(updateParents: any, updateChildren: any, force?: boolean): void; + clone(): any; +} +import { Object3D } from '../core/Object3D.js'; +import { Matrix4 } from '../math/Matrix4.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts new file mode 100644 index 000000000..28a2ba9c1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts @@ -0,0 +1,74 @@ +/** + * A special type of camera that is positioned in 3D space to render its surroundings into a + * cube render target. The render target can then be used as an environment map for rendering + * realtime reflections in your scene. + * + * ```js + * // Create cube render target + * const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 256, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } ); + * + * // Create cube camera + * const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget ); + * scene.add( cubeCamera ); + * + * // Create car + * const chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeRenderTarget.texture } ); + * const car = new THREE.Mesh( carGeometry, chromeMaterial ); + * scene.add( car ); + * + * // Update the render target cube + * car.visible = false; + * cubeCamera.position.copy( car.position ); + * cubeCamera.update( renderer, scene ); + * + * // Render the scene + * car.visible = true; + * renderer.render( scene, camera ); + * ``` + * + * @augments Object3D + */ +export class CubeCamera extends Object3D { + /** + * Constructs a new cube camera. + * + * @param {number} near - The camera's near plane. + * @param {number} far - The camera's far plane. + * @param {WebGLCubeRenderTarget} renderTarget - The cube render target. + */ + constructor(near: number, far: number, renderTarget: WebGLCubeRenderTarget); + type: string; + /** + * A reference to the cube render target. + * + * @type {WebGLCubeRenderTarget} + */ + renderTarget: WebGLCubeRenderTarget; + /** + * The current active coordinate system. + * + * @type {?(WebGLCoordinateSystem|WebGPUCoordinateSystem)} + * @default null + */ + coordinateSystem: (number | number) | null; + /** + * The current active mipmap level + * + * @type {number} + * @default 0 + */ + activeMipmapLevel: number; + /** + * Must be called when the coordinate system of the cube camera is changed. + */ + updateCoordinateSystem(): void; + /** + * Calling this method will render the given scene with the given renderer + * into the cube render target of the camera. + * + * @param {(Renderer|WebGLRenderer)} renderer - The renderer. + * @param {Scene} scene - The scene to render. + */ + update(renderer: (Renderer | WebGLRenderer), scene: Scene): void; +} +import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts new file mode 100644 index 000000000..b6269a9b1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts @@ -0,0 +1,122 @@ +/** + * Camera that uses [orthographic projection](https://en.wikipedia.org/wiki/Orthographic_projection). + * + * In this projection mode, an object's size in the rendered image stays + * constant regardless of its distance from the camera. This can be useful + * for rendering 2D scenes and UI elements, amongst other things. + * + * ```js + * const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 ); + * scene.add( camera ); + * ``` + * + * @augments Camera + */ +export class OrthographicCamera extends Camera { + /** + * Constructs a new orthographic camera. + * + * @param {number} [left=-1] - The left plane of the camera's frustum. + * @param {number} [right=1] - The right plane of the camera's frustum. + * @param {number} [top=1] - The top plane of the camera's frustum. + * @param {number} [bottom=-1] - The bottom plane of the camera's frustum. + * @param {number} [near=0.1] - The camera's near plane. + * @param {number} [far=2000] - The camera's far plane. + */ + constructor(left?: number, right?: number, top?: number, bottom?: number, near?: number, far?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOrthographicCamera: boolean; + /** + * The zoom factor of the camera. + * + * @type {number} + * @default 1 + */ + zoom: number; + /** + * Represents the frustum window specification. This property should not be edited + * directly but via {@link PerspectiveCamera#setViewOffset} and {@link PerspectiveCamera#clearViewOffset}. + * + * @type {?Object} + * @default null + */ + view: Object | null; + /** + * The left plane of the camera's frustum. + * + * @type {number} + * @default -1 + */ + left: number; + /** + * The right plane of the camera's frustum. + * + * @type {number} + * @default 1 + */ + right: number; + /** + * The top plane of the camera's frustum. + * + * @type {number} + * @default 1 + */ + top: number; + /** + * The bottom plane of the camera's frustum. + * + * @type {number} + * @default -1 + */ + bottom: number; + /** + * The camera's near plane. The valid range is greater than `0` + * and less than the current value of {@link OrthographicCamera#far}. + * + * Note that, unlike for the {@link PerspectiveCamera}, `0` is a + * valid value for an orthographic camera's near plane. + * + * @type {number} + * @default 0.1 + */ + near: number; + /** + * The camera's far plane. Must be greater than the + * current value of {@link OrthographicCamera#near}. + * + * @type {number} + * @default 2000 + */ + far: number; + copy(source: any, recursive: any): this; + /** + * Sets an offset in a larger frustum. This is useful for multi-window or + * multi-monitor/multi-machine setups. + * + * @param {number} fullWidth - The full width of multiview setup. + * @param {number} fullHeight - The full height of multiview setup. + * @param {number} x - The horizontal offset of the subcamera. + * @param {number} y - The vertical offset of the subcamera. + * @param {number} width - The width of subcamera. + * @param {number} height - The height of subcamera. + * @see {@link PerspectiveCamera#setViewOffset} + */ + setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void; + /** + * Removes the view offset from the projection matrix. + */ + clearViewOffset(): void; + /** + * Updates the camera's projection matrix. Must be called after any change of + * camera properties. + */ + updateProjectionMatrix(): void; + toJSON(meta: any): Object; +} +import { Camera } from './Camera.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts new file mode 100644 index 000000000..0bf274692 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts @@ -0,0 +1,216 @@ +/** + * Camera that uses [perspective projection](https://en.wikipedia.org/wiki/Perspective_(graphical)). + * + * This projection mode is designed to mimic the way the human eye sees. It + * is the most common projection mode used for rendering a 3D scene. + * + * ```js + * const camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 ); + * scene.add( camera ); + * ``` + * + * @augments Camera + */ +export class PerspectiveCamera extends Camera { + /** + * Constructs a new perspective camera. + * + * @param {number} [fov=50] - The vertical field of view. + * @param {number} [aspect=1] - The aspect ratio. + * @param {number} [near=0.1] - The camera's near plane. + * @param {number} [far=2000] - The camera's far plane. + */ + constructor(fov?: number, aspect?: number, near?: number, far?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPerspectiveCamera: boolean; + /** + * The vertical field of view, from bottom to top of view, + * in degrees. + * + * @type {number} + * @default 50 + */ + fov: number; + /** + * The zoom factor of the camera. + * + * @type {number} + * @default 1 + */ + zoom: number; + /** + * The camera's near plane. The valid range is greater than `0` + * and less than the current value of {@link PerspectiveCamera#far}. + * + * Note that, unlike for the {@link OrthographicCamera}, `0` is not a + * valid value for a perspective camera's near plane. + * + * @type {number} + * @default 0.1 + */ + near: number; + /** + * The camera's far plane. Must be greater than the + * current value of {@link PerspectiveCamera#near}. + * + * @type {number} + * @default 2000 + */ + far: number; + /** + * Object distance used for stereoscopy and depth-of-field effects. This + * parameter does not influence the projection matrix unless a + * {@link StereoCamera} is being used. + * + * @type {number} + * @default 10 + */ + focus: number; + /** + * The aspect ratio, usually the canvas width / canvas height. + * + * @type {number} + * @default 1 + */ + aspect: number; + /** + * Represents the frustum window specification. This property should not be edited + * directly but via {@link PerspectiveCamera#setViewOffset} and {@link PerspectiveCamera#clearViewOffset}. + * + * @type {?Object} + * @default null + */ + view: Object | null; + /** + * Film size used for the larger axis. Default is `35` (millimeters). This + * parameter does not influence the projection matrix unless {@link PerspectiveCamera#filmOffset} + * is set to a nonzero value. + * + * @type {number} + * @default 35 + */ + filmGauge: number; + /** + * Horizontal off-center offset in the same unit as {@link PerspectiveCamera#filmGauge}. + * + * @type {number} + * @default 0 + */ + filmOffset: number; + copy(source: any, recursive: any): this; + /** + * Sets the FOV by focal length in respect to the current {@link PerspectiveCamera#filmGauge}. + * + * The default film gauge is 35, so that the focal length can be specified for + * a 35mm (full frame) camera. + * + * @param {number} focalLength - Values for focal length and film gauge must have the same unit. + */ + setFocalLength(focalLength: number): void; + /** + * Returns the focal length from the current {@link PerspectiveCamera#fov} and + * {@link PerspectiveCamera#filmGauge}. + * + * @return {number} The computed focal length. + */ + getFocalLength(): number; + /** + * Returns the current vertical field of view angle in degrees considering {@link PerspectiveCamera#zoom}. + * + * @return {number} The effective FOV. + */ + getEffectiveFOV(): number; + /** + * Returns the width of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or + * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}. + * + * @return {number} The film width. + */ + getFilmWidth(): number; + /** + * Returns the height of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or + * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}. + * + * @return {number} The film width. + */ + getFilmHeight(): number; + /** + * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction. + * Sets `minTarget` and `maxTarget` to the coordinates of the lower-left and upper-right corners of the view rectangle. + * + * @param {number} distance - The viewing distance. + * @param {Vector2} minTarget - The lower-left corner of the view rectangle is written into this vector. + * @param {Vector2} maxTarget - The upper-right corner of the view rectangle is written into this vector. + */ + getViewBounds(distance: number, minTarget: Vector2, maxTarget: Vector2): void; + /** + * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction. + * + * @param {number} distance - The viewing distance. + * @param {Vector2} target - The target vector that is used to store result where x is width and y is height. + * @returns {Vector2} The view size. + */ + getViewSize(distance: number, target: Vector2): Vector2; + /** + * Sets an offset in a larger frustum. This is useful for multi-window or + * multi-monitor/multi-machine setups. + * + * For example, if you have 3x2 monitors and each monitor is 1920x1080 and + * the monitors are in grid like this + *``` + * +---+---+---+ + * | A | B | C | + * +---+---+---+ + * | D | E | F | + * +---+---+---+ + *``` + * then for each monitor you would call it like this: + *```js + * const w = 1920; + * const h = 1080; + * const fullWidth = w * 3; + * const fullHeight = h * 2; + * + * // --A-- + * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); + * // --B-- + * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); + * // --C-- + * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); + * // --D-- + * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); + * // --E-- + * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); + * // --F-- + * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); + * ``` + * + * Note there is no reason monitors have to be the same size or in a grid. + * + * @param {number} fullWidth - The full width of multiview setup. + * @param {number} fullHeight - The full height of multiview setup. + * @param {number} x - The horizontal offset of the subcamera. + * @param {number} y - The vertical offset of the subcamera. + * @param {number} width - The width of subcamera. + * @param {number} height - The height of subcamera. + */ + setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void; + /** + * Removes the view offset from the projection matrix. + */ + clearViewOffset(): void; + /** + * Updates the camera's projection matrix. Must be called after any change of + * camera properties. + */ + updateProjectionMatrix(): void; + toJSON(meta: any): Object; +} +import { Camera } from './Camera.js'; +import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts new file mode 100644 index 000000000..929bf5258 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts @@ -0,0 +1,61 @@ +/** + * A special type of camera that uses two perspective cameras with + * stereoscopic projection. Can be used for rendering stereo effects + * like [3D Anaglyph](https://en.wikipedia.org/wiki/Anaglyph_3D) or + * [Parallax Barrier](https://en.wikipedia.org/wiki/parallax_barrier). + */ +export class StereoCamera { + /** + * The type property is used for detecting the object type + * in context of serialization/deserialization. + * + * @type {string} + * @readonly + */ + readonly type: string; + /** + * The aspect. + * + * @type {number} + * @default 1 + */ + aspect: number; + /** + * The eye separation which represents the distance + * between the left and right camera. + * + * @type {number} + * @default 0.064 + */ + eyeSep: number; + /** + * The camera representing the left eye. This is added to layer `1` so objects to be + * rendered by the left camera must also be added to this layer. + * + * @type {PerspectiveCamera} + */ + cameraL: PerspectiveCamera; + /** + * The camera representing the right eye. This is added to layer `2` so objects to be + * rendered by the right camera must also be added to this layer. + * + * @type {PerspectiveCamera} + */ + cameraR: PerspectiveCamera; + _cache: { + focus: null; + fov: null; + aspect: null; + near: null; + far: null; + zoom: null; + eyeSep: null; + }; + /** + * Updates the stereo camera based on the given perspective camera. + * + * @param {PerspectiveCamera} camera - The perspective camera. + */ + update(camera: PerspectiveCamera): void; +} +import { PerspectiveCamera } from './PerspectiveCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/constants.d.ts b/jsdoc-testing/jsdoc/src/constants.d.ts new file mode 100644 index 000000000..d5c3f9397 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/constants.d.ts @@ -0,0 +1,1617 @@ +export const REVISION: "186dev"; +/** + * Represents mouse buttons and interaction types in context of controls. + * + * @type {ConstantsMouse} + * @constant + */ +export const MOUSE: ConstantsMouse; +/** + * Represents touch interaction types in context of controls. + * + * @type {ConstantsTouch} + * @constant + */ +export const TOUCH: ConstantsTouch; +/** + * Disables face culling. + * + * @type {number} + * @constant + */ +export const CullFaceNone: number; +/** + * Culls back faces. + * + * @type {number} + * @constant + */ +export const CullFaceBack: number; +/** + * Culls front faces. + * + * @type {number} + * @constant + */ +export const CullFaceFront: number; +/** + * Culls both front and back faces. + * + * @type {number} + * @constant + */ +export const CullFaceFrontBack: number; +/** + * Gives unfiltered shadow maps - fastest, but lowest quality. + * + * @type {number} + * @constant + */ +export const BasicShadowMap: number; +/** + * Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm. + * + * @type {number} + * @constant + */ +export const PCFShadowMap: number; +/** + * Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm with + * better soft shadows especially when using low-resolution shadow maps. + * + * @type {number} + * @constant + * @deprecated since r186. Use `PCFShadowMap` instead. + */ +export const PCFSoftShadowMap: number; +/** + * Filters shadow maps using the Variance Shadow Map (VSM) algorithm. + * When using VSMShadowMap all shadow receivers will also cast shadows. + * + * @type {number} + * @constant + */ +export const VSMShadowMap: number; +/** + * Only front faces are rendered. + * + * @type {number} + * @constant + */ +export const FrontSide: number; +/** + * Only back faces are rendered. + * + * @type {number} + * @constant + */ +export const BackSide: number; +/** + * Both front and back faces are rendered. + * + * @type {number} + * @constant + */ +export const DoubleSide: number; +/** + * No blending is performed which effectively disables + * alpha transparency. + * + * @type {number} + * @constant + */ +export const NoBlending: number; +/** + * The default blending. + * + * @type {number} + * @constant + */ +export const NormalBlending: number; +/** + * Represents additive blending. + * + * @type {number} + * @constant + */ +export const AdditiveBlending: number; +/** + * Represents subtractive blending. + * + * @type {number} + * @constant + */ +export const SubtractiveBlending: number; +/** + * Represents multiply blending. + * + * @type {number} + * @constant + */ +export const MultiplyBlending: number; +/** + * Represents custom blending. + * + * @type {number} + * @constant + */ +export const CustomBlending: number; +/** + * Represents material blending. + * + * @type {number} + * @constant + */ +export const MaterialBlending: number; +/** + * A `source + destination` blending equation. + * + * @type {number} + * @constant + */ +export const AddEquation: number; +/** + * A `source - destination` blending equation. + * + * @type {number} + * @constant + */ +export const SubtractEquation: number; +/** + * A `destination - source` blending equation. + * + * @type {number} + * @constant + */ +export const ReverseSubtractEquation: number; +/** + * A blend equation that uses the minimum of source and destination. + * + * @type {number} + * @constant + */ +export const MinEquation: number; +/** + * A blend equation that uses the maximum of source and destination. + * + * @type {number} + * @constant + */ +export const MaxEquation: number; +/** + * Multiplies all colors by `0`. + * + * @type {number} + * @constant + */ +export const ZeroFactor: number; +/** + * Multiplies all colors by `1`. + * + * @type {number} + * @constant + */ +export const OneFactor: number; +/** + * Multiplies all colors by the source colors. + * + * @type {number} + * @constant + */ +export const SrcColorFactor: number; +/** + * Multiplies all colors by `1` minus each source color. + * + * @type {number} + * @constant + */ +export const OneMinusSrcColorFactor: number; +/** + * Multiplies all colors by the source alpha value. + * + * @type {number} + * @constant + */ +export const SrcAlphaFactor: number; +/** + * Multiplies all colors by 1 minus the source alpha value. + * + * @type {number} + * @constant + */ +export const OneMinusSrcAlphaFactor: number; +/** + * Multiplies all colors by the destination alpha value. + * + * @type {number} + * @constant + */ +export const DstAlphaFactor: number; +/** + * Multiplies all colors by `1` minus the destination alpha value. + * + * @type {number} + * @constant + */ +export const OneMinusDstAlphaFactor: number; +/** + * Multiplies all colors by the destination color. + * + * @type {number} + * @constant + */ +export const DstColorFactor: number; +/** + * Multiplies all colors by `1` minus each destination color. + * + * @type {number} + * @constant + */ +export const OneMinusDstColorFactor: number; +/** + * Multiplies the RGB colors by the smaller of either the source alpha + * value or the value of `1` minus the destination alpha value. The alpha + * value is multiplied by `1`. + * + * @type {number} + * @constant + */ +export const SrcAlphaSaturateFactor: number; +/** + * Multiplies all colors by a constant color. + * + * @type {number} + * @constant + */ +export const ConstantColorFactor: number; +/** + * Multiplies all colors by `1` minus a constant color. + * + * @type {number} + * @constant + */ +export const OneMinusConstantColorFactor: number; +/** + * Multiplies all colors by a constant alpha value. + * + * @type {number} + * @constant + */ +export const ConstantAlphaFactor: number; +/** + * Multiplies all colors by 1 minus a constant alpha value. + * + * @type {number} + * @constant + */ +export const OneMinusConstantAlphaFactor: number; +/** + * Never pass. + * + * @type {number} + * @constant + */ +export const NeverDepth: number; +/** + * Always pass. + * + * @type {number} + * @constant + */ +export const AlwaysDepth: number; +/** + * Pass if the incoming value is less than the depth buffer value. + * + * @type {number} + * @constant + */ +export const LessDepth: number; +/** + * Pass if the incoming value is less than or equal to the depth buffer value. + * + * @type {number} + * @constant + */ +export const LessEqualDepth: number; +/** + * Pass if the incoming value equals the depth buffer value. + * + * @type {number} + * @constant + */ +export const EqualDepth: number; +/** + * Pass if the incoming value is greater than or equal to the depth buffer value. + * + * @type {number} + * @constant + */ +export const GreaterEqualDepth: number; +/** + * Pass if the incoming value is greater than the depth buffer value. + * + * @type {number} + * @constant + */ +export const GreaterDepth: number; +/** + * Pass if the incoming value is not equal to the depth buffer value. + * + * @type {number} + * @constant + */ +export const NotEqualDepth: number; +/** + * Multiplies the environment map color with the surface color. + * + * @type {number} + * @constant + */ +export const MultiplyOperation: number; +/** + * Uses reflectivity to blend between the two colors. + * + * @type {number} + * @constant + */ +export const MixOperation: number; +/** + * Adds the two colors. + * + * @type {number} + * @constant + */ +export const AddOperation: number; +/** + * No tone mapping is applied. + * + * @type {number} + * @constant + */ +export const NoToneMapping: number; +/** + * Linear tone mapping. + * + * @type {number} + * @constant + */ +export const LinearToneMapping: number; +/** + * Reinhard tone mapping. + * + * @type {number} + * @constant + */ +export const ReinhardToneMapping: number; +/** + * Cineon tone mapping. + * + * @type {number} + * @constant + */ +export const CineonToneMapping: number; +/** + * ACES Filmic tone mapping. + * + * @type {number} + * @constant + */ +export const ACESFilmicToneMapping: number; +/** + * Custom tone mapping. + * + * Expects a custom implementation by modifying shader code of the material's fragment shader. + * + * @type {number} + * @constant + */ +export const CustomToneMapping: number; +/** + * AgX tone mapping. + * + * @type {number} + * @constant + */ +export const AgXToneMapping: number; +/** + * Neutral tone mapping. + * + * Implementation based on the Khronos 3D Commerce Group standard tone mapping. + * + * @type {number} + * @constant + */ +export const NeutralToneMapping: number; +/** + * The skinned mesh shares the same world space as the skeleton. + * + * @type {string} + * @constant + */ +export const AttachedBindMode: string; +/** + * The skinned mesh does not share the same world space as the skeleton. + * This is useful when a skeleton is shared across multiple skinned meshes. + * + * @type {string} + * @constant + */ +export const DetachedBindMode: string; +/** + * Maps textures using the geometry's UV coordinates. + * + * @type {number} + * @constant + */ +export const UVMapping: number; +/** + * Reflection mapping for cube textures. + * + * @type {number} + * @constant + */ +export const CubeReflectionMapping: number; +/** + * Refraction mapping for cube textures. + * + * @type {number} + * @constant + */ +export const CubeRefractionMapping: number; +/** + * Reflection mapping for equirectangular textures. + * + * @type {number} + * @constant + */ +export const EquirectangularReflectionMapping: number; +/** + * Refraction mapping for equirectangular textures. + * + * @type {number} + * @constant + */ +export const EquirectangularRefractionMapping: number; +/** + * Reflection mapping for PMREM textures. + * + * @type {number} + * @constant + */ +export const CubeUVReflectionMapping: number; +/** + * The texture will simply repeat to infinity. + * + * @type {number} + * @constant + */ +export const RepeatWrapping: number; +/** + * The last pixel of the texture stretches to the edge of the mesh. + * + * @type {number} + * @constant + */ +export const ClampToEdgeWrapping: number; +/** + * The texture will repeats to infinity, mirroring on each repeat. + * + * @type {number} + * @constant + */ +export const MirroredRepeatWrapping: number; +/** + * Returns the value of the texture element that is nearest (in Manhattan distance) + * to the specified texture coordinates. + * + * @type {number} + * @constant + */ +export const NearestFilter: number; +/** + * Chooses the mipmap that most closely matches the size of the pixel being textured + * and uses the `NearestFilter` criterion (the texel nearest to the center of the pixel) + * to produce a texture value. + * + * @type {number} + * @constant + */ +export const NearestMipmapNearestFilter: number; +export const NearestMipMapNearestFilter: 1004; +/** + * Chooses the two mipmaps that most closely match the size of the pixel being textured and + * uses the `NearestFilter` criterion to produce a texture value from each mipmap. + * The final texture value is a weighted average of those two values. + * + * @type {number} + * @constant + */ +export const NearestMipmapLinearFilter: number; +export const NearestMipMapLinearFilter: 1005; +/** + * Returns the weighted average of the four texture elements that are closest to the specified + * texture coordinates, and can include items wrapped or repeated from other parts of a texture, + * depending on the values of `wrapS` and `wrapT`, and on the exact mapping. + * + * @type {number} + * @constant + */ +export const LinearFilter: number; +/** + * Chooses the mipmap that most closely matches the size of the pixel being textured and uses + * the `LinearFilter` criterion (a weighted average of the four texels that are closest to the + * center of the pixel) to produce a texture value. + * + * @type {number} + * @constant + */ +export const LinearMipmapNearestFilter: number; +export const LinearMipMapNearestFilter: 1007; +/** + * Chooses the two mipmaps that most closely match the size of the pixel being textured and uses + * the `LinearFilter` criterion to produce a texture value from each mipmap. The final texture value + * is a weighted average of those two values. + * + * @type {number} + * @constant + */ +export const LinearMipmapLinearFilter: number; +export const LinearMipMapLinearFilter: 1008; +/** + * An unsigned byte data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedByteType: number; +/** + * A byte data type for textures. + * + * @type {number} + * @constant + */ +export const ByteType: number; +/** + * A short data type for textures. + * + * @type {number} + * @constant + */ +export const ShortType: number; +/** + * An unsigned short data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedShortType: number; +/** + * An int data type for textures. + * + * @type {number} + * @constant + */ +export const IntType: number; +/** + * An unsigned int data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedIntType: number; +/** + * A float data type for textures. + * + * @type {number} + * @constant + */ +export const FloatType: number; +/** + * A half float data type for textures. + * + * @type {number} + * @constant + */ +export const HalfFloatType: number; +/** + * An unsigned short 4_4_4_4 (packed) data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedShort4444Type: number; +/** + * An unsigned short 5_5_5_1 (packed) data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedShort5551Type: number; +/** + * An unsigned int 24_8 data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedInt248Type: number; +/** + * An unsigned int 5_9_9_9 (packed) data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedInt5999Type: number; +/** + * An unsigned int 10_11_11 (packed) data type for textures. + * + * @type {number} + * @constant + */ +export const UnsignedInt101111Type: number; +/** + * Discards the red, green and blue components and reads just the alpha component. + * + * @type {number} + * @constant + */ +export const AlphaFormat: number; +/** + * Discards the alpha component and reads the red, green and blue component. + * + * @type {number} + * @constant + */ +export const RGBFormat: number; +/** + * Reads the red, green, blue and alpha components. + * + * @type {number} + * @constant + */ +export const RGBAFormat: number; +/** + * Reads each element as a single depth value, converts it to floating point, and clamps to the range `[0,1]`. + * + * @type {number} + * @constant + */ +export const DepthFormat: number; +/** + * Reads each element is a pair of depth and stencil values. The depth component of the pair is interpreted as + * in `DepthFormat`. The stencil component is interpreted based on the depth + stencil internal format. + * + * @type {number} + * @constant + */ +export const DepthStencilFormat: number; +/** + * Discards the green, blue and alpha components and reads just the red component. + * + * @type {number} + * @constant + */ +export const RedFormat: number; +/** + * Discards the green, blue and alpha components and reads just the red component. The texels are read as integers instead of floating point. + * + * @type {number} + * @constant + */ +export const RedIntegerFormat: number; +/** + * Discards the alpha, and blue components and reads the red, and green components. + * + * @type {number} + * @constant + */ +export const RGFormat: number; +/** + * Discards the alpha, and blue components and reads the red, and green components. The texels are read as integers instead of floating point. + * + * @type {number} + * @constant + */ +export const RGIntegerFormat: number; +/** + * Discards the alpha component and reads the red, green and blue component. The texels are read as integers instead of floating point. + * + * @type {number} + * @constant + */ +export const RGBIntegerFormat: number; +/** + * Reads the red, green, blue and alpha components. The texels are read as integers instead of floating point. + * + * @type {number} + * @constant + */ +export const RGBAIntegerFormat: number; +/** + * A DXT1-compressed image in an RGB image format. + * + * @type {number} + * @constant + */ +export const RGB_S3TC_DXT1_Format: number; +/** + * A DXT1-compressed image in an RGB image format with a simple on/off alpha value. + * + * @type {number} + * @constant + */ +export const RGBA_S3TC_DXT1_Format: number; +/** + * A DXT3-compressed image in an RGBA image format. Compared to a 32-bit RGBA texture, it offers 4:1 compression. + * + * @type {number} + * @constant + */ +export const RGBA_S3TC_DXT3_Format: number; +/** + * A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3 + * compression in how the alpha compression is done. + * + * @type {number} + * @constant + */ +export const RGBA_S3TC_DXT5_Format: number; +/** + * PVRTC RGB compression in 4-bit mode. One block for each 4×4 pixels. + * + * @type {number} + * @constant + */ +export const RGB_PVRTC_4BPPV1_Format: number; +/** + * PVRTC RGB compression in 2-bit mode. One block for each 8×4 pixels. + * + * @type {number} + * @constant + */ +export const RGB_PVRTC_2BPPV1_Format: number; +/** + * PVRTC RGBA compression in 4-bit mode. One block for each 4×4 pixels. + * + * @type {number} + * @constant + */ +export const RGBA_PVRTC_4BPPV1_Format: number; +/** + * PVRTC RGBA compression in 2-bit mode. One block for each 8×4 pixels. + * + * @type {number} + * @constant + */ +export const RGBA_PVRTC_2BPPV1_Format: number; +/** + * ETC1 RGB format. + * + * @type {number} + * @constant + */ +export const RGB_ETC1_Format: number; +/** + * ETC2 RGB format. + * + * @type {number} + * @constant + */ +export const RGB_ETC2_Format: number; +/** + * ETC2 RGBA format. + * + * @type {number} + * @constant + */ +export const RGBA_ETC2_EAC_Format: number; +/** + * EAC R11 UNORM format. + * + * @type {number} + * @constant + */ +export const R11_EAC_Format: number; +/** + * EAC R11 SNORM format. + * + * @type {number} + * @constant + */ +export const SIGNED_R11_EAC_Format: number; +/** + * EAC RG11 UNORM format. + * + * @type {number} + * @constant + */ +export const RG11_EAC_Format: number; +/** + * EAC RG11 SNORM format. + * + * @type {number} + * @constant + */ +export const SIGNED_RG11_EAC_Format: number; +/** + * ASTC RGBA 4x4 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_4x4_Format: number; +/** + * ASTC RGBA 5x4 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_5x4_Format: number; +/** + * ASTC RGBA 5x5 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_5x5_Format: number; +/** + * ASTC RGBA 6x5 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_6x5_Format: number; +/** + * ASTC RGBA 6x6 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_6x6_Format: number; +/** + * ASTC RGBA 8x5 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_8x5_Format: number; +/** + * ASTC RGBA 8x6 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_8x6_Format: number; +/** + * ASTC RGBA 8x8 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_8x8_Format: number; +/** + * ASTC RGBA 10x5 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_10x5_Format: number; +/** + * ASTC RGBA 10x6 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_10x6_Format: number; +/** + * ASTC RGBA 10x8 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_10x8_Format: number; +/** + * ASTC RGBA 10x10 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_10x10_Format: number; +/** + * ASTC RGBA 12x10 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_12x10_Format: number; +/** + * ASTC RGBA 12x12 format. + * + * @type {number} + * @constant + */ +export const RGBA_ASTC_12x12_Format: number; +/** + * BPTC RGBA format. + * + * @type {number} + * @constant + */ +export const RGBA_BPTC_Format: number; +/** + * BPTC Signed RGB format. + * + * @type {number} + * @constant + */ +export const RGB_BPTC_SIGNED_Format: number; +/** + * BPTC Unsigned RGB format. + * + * @type {number} + * @constant + */ +export const RGB_BPTC_UNSIGNED_Format: number; +/** + * RGTC1 Red format. + * + * @type {number} + * @constant + */ +export const RED_RGTC1_Format: number; +/** + * RGTC1 Signed Red format. + * + * @type {number} + * @constant + */ +export const SIGNED_RED_RGTC1_Format: number; +/** + * RGTC2 Red Green format. + * + * @type {number} + * @constant + */ +export const RED_GREEN_RGTC2_Format: number; +/** + * RGTC2 Signed Red Green format. + * + * @type {number} + * @constant + */ +export const SIGNED_RED_GREEN_RGTC2_Format: number; +/** + * Animations are played once. + * + * @type {number} + * @constant + */ +export const LoopOnce: number; +/** + * Animations are played with a chosen number of repetitions, each time jumping from + * the end of the clip directly to its beginning. + * + * @type {number} + * @constant + */ +export const LoopRepeat: number; +/** + * Animations are played with a chosen number of repetitions, alternately playing forward + * and backward. + * + * @type {number} + * @constant + */ +export const LoopPingPong: number; +/** + * Discrete interpolation mode for keyframe tracks. + * + * @type {number} + * @constant + */ +export const InterpolateDiscrete: number; +/** + * Linear interpolation mode for keyframe tracks. + * + * @type {number} + * @constant + */ +export const InterpolateLinear: number; +/** + * Smooth interpolation mode for keyframe tracks. + * + * @type {number} + * @constant + */ +export const InterpolateSmooth: number; +/** + * Bezier interpolation mode for keyframe tracks. + * + * Uses cubic Bezier curves with explicit 2D control points. + * Requires tangent data to be set on the track. + * + * @type {number} + * @constant + */ +export const InterpolateBezier: number; +/** + * Zero curvature ending for animations. + * + * @type {number} + * @constant + */ +export const ZeroCurvatureEnding: number; +/** + * Zero slope ending for animations. + * + * @type {number} + * @constant + */ +export const ZeroSlopeEnding: number; +/** + * Wrap around ending for animations. + * + * @type {number} + * @constant + */ +export const WrapAroundEnding: number; +/** + * Default animation blend mode. + * + * @type {number} + * @constant + */ +export const NormalAnimationBlendMode: number; +/** + * Additive animation blend mode. Can be used to layer motions on top of + * each other to build complex performances from smaller re-usable assets. + * + * @type {number} + * @constant + */ +export const AdditiveAnimationBlendMode: number; +/** + * For every three vertices draw a single triangle. + * + * @type {number} + * @constant + */ +export const TrianglesDrawMode: number; +/** + * For each vertex draw a triangle from the last three vertices. + * + * @type {number} + * @constant + */ +export const TriangleStripDrawMode: number; +/** + * For each vertex draw a triangle from the first vertex and the last two vertices. + * + * @type {number} + * @constant + */ +export const TriangleFanDrawMode: number; +/** + * The depth value is inverted (1.0 - z) for visualization purposes. + * + * @type {number} + * @constant + */ +export const BasicDepthPacking: number; +/** + * The depth value is packed into 32 bit RGBA. + * + * @type {number} + * @constant + */ +export const RGBADepthPacking: number; +/** + * The depth value is packed into 24 bit RGB. + * + * @type {number} + * @constant + */ +export const RGBDepthPacking: number; +/** + * The depth value is packed into 16 bit RG. + * + * @type {number} + * @constant + */ +export const RGDepthPacking: number; +/** + * Normal information is relative to the underlying surface. + * + * @type {number} + * @constant + */ +export const TangentSpaceNormalMap: number; +/** + * Normal information is relative to the object orientation. + * + * @type {number} + * @constant + */ +export const ObjectSpaceNormalMap: number; +/** + * No color space. + * + * @type {string} + * @constant + */ +export const NoColorSpace: string; +/** + * sRGB color space. + * + * @type {string} + * @constant + */ +export const SRGBColorSpace: string; +/** + * sRGB-linear color space. + * + * @type {string} + * @constant + */ +export const LinearSRGBColorSpace: string; +/** + * Linear transfer function. + * + * @type {string} + * @constant + */ +export const LinearTransfer: string; +/** + * sRGB transfer function. + * + * @type {string} + * @constant + */ +export const SRGBTransfer: string; +/** + * No normal map packing. + * + * @type {string} + * @constant + */ +export const NoNormalPacking: string; +/** + * Normal RG packing. + * + * @type {string} + * @constant + */ +export const NormalRGPacking: string; +/** + * Normal GA packing. + * + * @type {string} + * @constant + */ +export const NormalGAPacking: string; +/** + * Sets the stencil buffer value to `0`. + * + * @type {number} + * @constant + */ +export const ZeroStencilOp: number; +/** + * Keeps the current value. + * + * @type {number} + * @constant + */ +export const KeepStencilOp: number; +/** + * Sets the stencil buffer value to the specified reference value. + * + * @type {number} + * @constant + */ +export const ReplaceStencilOp: number; +/** + * Increments the current stencil buffer value. Clamps to the maximum representable unsigned value. + * + * @type {number} + * @constant + */ +export const IncrementStencilOp: number; +/** + * Decrements the current stencil buffer value. Clamps to `0`. + * + * @type {number} + * @constant + */ +export const DecrementStencilOp: number; +/** + * Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing + * the maximum representable unsigned value. + * + * @type {number} + * @constant + */ +export const IncrementWrapStencilOp: number; +/** + * Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable + * unsigned value when decrementing a stencil buffer value of `0`. + * + * @type {number} + * @constant + */ +export const DecrementWrapStencilOp: number; +/** + * Inverts the current stencil buffer value bitwise. + * + * @type {number} + * @constant + */ +export const InvertStencilOp: number; +/** + * Will never return true. + * + * @type {number} + * @constant + */ +export const NeverStencilFunc: number; +/** + * Will return true if the stencil reference value is less than the current stencil value. + * + * @type {number} + * @constant + */ +export const LessStencilFunc: number; +/** + * Will return true if the stencil reference value is equal to the current stencil value. + * + * @type {number} + * @constant + */ +export const EqualStencilFunc: number; +/** + * Will return true if the stencil reference value is less than or equal to the current stencil value. + * + * @type {number} + * @constant + */ +export const LessEqualStencilFunc: number; +/** + * Will return true if the stencil reference value is greater than the current stencil value. + * + * @type {number} + * @constant + */ +export const GreaterStencilFunc: number; +/** + * Will return true if the stencil reference value is not equal to the current stencil value. + * + * @type {number} + * @constant + */ +export const NotEqualStencilFunc: number; +/** + * Will return true if the stencil reference value is greater than or equal to the current stencil value. + * + * @type {number} + * @constant + */ +export const GreaterEqualStencilFunc: number; +/** + * Will always return true. + * + * @type {number} + * @constant + */ +export const AlwaysStencilFunc: number; +/** + * Never pass. + * + * @type {number} + * @constant + */ +export const NeverCompare: number; +/** + * Pass if the incoming value is less than the texture value. + * + * @type {number} + * @constant + */ +export const LessCompare: number; +/** + * Pass if the incoming value equals the texture value. + * + * @type {number} + * @constant + */ +export const EqualCompare: number; +/** + * Pass if the incoming value is less than or equal to the texture value. + * + * @type {number} + * @constant + */ +export const LessEqualCompare: number; +/** + * Pass if the incoming value is greater than the texture value. + * + * @type {number} + * @constant + */ +export const GreaterCompare: number; +/** + * Pass if the incoming value is not equal to the texture value. + * + * @type {number} + * @constant + */ +export const NotEqualCompare: number; +/** + * Pass if the incoming value is greater than or equal to the texture value. + * + * @type {number} + * @constant + */ +export const GreaterEqualCompare: number; +/** + * Always pass. + * + * @type {number} + * @constant + */ +export const AlwaysCompare: number; +/** + * The contents are intended to be specified once by the application, and used many + * times as the source for drawing and image specification commands. + * + * @type {number} + * @constant + */ +export const StaticDrawUsage: number; +/** + * The contents are intended to be respecified repeatedly by the application, and + * used many times as the source for drawing and image specification commands. + * + * @type {number} + * @constant + */ +export const DynamicDrawUsage: number; +/** + * The contents are intended to be specified once by the application, and used at most + * a few times as the source for drawing and image specification commands. + * + * @type {number} + * @constant + */ +export const StreamDrawUsage: number; +/** + * The contents are intended to be specified once by reading data from the 3D API, and queried + * many times by the application. + * + * @type {number} + * @constant + */ +export const StaticReadUsage: number; +/** + * The contents are intended to be respecified repeatedly by reading data from the 3D API, and queried + * many times by the application. + * + * @type {number} + * @constant + */ +export const DynamicReadUsage: number; +/** + * The contents are intended to be specified once by reading data from the 3D API, and queried at most + * a few times by the application + * + * @type {number} + * @constant + */ +export const StreamReadUsage: number; +/** + * The contents are intended to be specified once by reading data from the 3D API, and used many times as + * the source for WebGL drawing and image specification commands. + * + * @type {number} + * @constant + */ +export const StaticCopyUsage: number; +/** + * The contents are intended to be respecified repeatedly by reading data from the 3D API, and used many times + * as the source for WebGL drawing and image specification commands. + * + * @type {number} + * @constant + */ +export const DynamicCopyUsage: number; +/** + * The contents are intended to be specified once by reading data from the 3D API, and used at most a few times + * as the source for WebGL drawing and image specification commands. + * + * @type {number} + * @constant + */ +export const StreamCopyUsage: number; +/** + * GLSL 1 shader code. + * + * @type {string} + * @constant + */ +export const GLSL1: string; +/** + * GLSL 3 shader code. + * + * @type {string} + * @constant + */ +export const GLSL3: string; +/** + * WebGL coordinate system. + * + * @type {number} + * @constant + */ +export const WebGLCoordinateSystem: number; +/** + * WebGPU coordinate system. + * + * @type {number} + * @constant + */ +export const WebGPUCoordinateSystem: number; +/** + * Represents the different timestamp query types. + * + * @type {ConstantsTimestampQuery} + * @constant + */ +export const TimestampQuery: ConstantsTimestampQuery; +/** + * Represents mouse buttons and interaction types in context of controls. + * + * @type {ConstantsInterpolationSamplingType} + * @constant + */ +export const InterpolationSamplingType: ConstantsInterpolationSamplingType; +/** + * Represents the different interpolation sampling modes. + * + * @type {ConstantsInterpolationSamplingMode} + * @constant + */ +export const InterpolationSamplingMode: ConstantsInterpolationSamplingMode; +/** + * Compatibility flags for features that may not be supported across all platforms. + * + * @type {Object} + * @constant + */ +export const Compatibility: Object; +/** + * Represents the refresh types of render objects. + * + * @type {ConstantsRenderObjectRefreshType} + * @constant + */ +export const RenderObjectRefreshType: ConstantsRenderObjectRefreshType; +/** + * This type represents mouse buttons and interaction types in context of controls. + */ +export type ConstantsMouse = { + /** + * - The left mouse button. + */ + MIDDLE: number; + /** + * - The middle mouse button. + */ + LEFT: number; + /** + * - The right mouse button. + */ + RIGHT: number; + /** + * - A rotate interaction. + */ + ROTATE: number; + /** + * - A dolly interaction. + */ + DOLLY: number; + /** + * - A pan interaction. + */ + PAN: number; +}; +/** + * This type represents touch interaction types in context of controls. + */ +export type ConstantsTouch = { + /** + * - A rotate interaction. + */ + ROTATE: number; + /** + * - A pan interaction. + */ + PAN: number; + /** + * - The dolly-pan interaction. + */ + DOLLY_PAN: number; + /** + * - A dolly-rotate interaction. + */ + DOLLY_ROTATE: number; +}; +/** + * This type represents the different timestamp query types. + */ +export type ConstantsTimestampQuery = { + /** + * - A `compute` timestamp query. + */ + COMPUTE: string; + /** + * - A `render` timestamp query. + */ + RENDER: string; +}; +/** + * Represents the different interpolation sampling types. + */ +export type ConstantsInterpolationSamplingType = { + /** + * - Perspective-correct interpolation. + */ + PERSPECTIVE: string; + /** + * - Linear interpolation. + */ + LINEAR: string; + /** + * - Flat interpolation. + */ + FLAT: string; +}; +/** + * Represents the different interpolation sampling modes. + */ +export type ConstantsInterpolationSamplingMode = { + /** + * - Normal sampling mode. + */ + NORMAL: string; + /** + * - Centroid sampling mode. + */ + CENTROID: string; + /** + * - Sample-specific sampling mode. + */ + SAMPLE: string; + /** + * - Flat interpolation using the first vertex. + */ + FIRST: string; + /** + * - Flat interpolation using either vertex. + */ + EITHER: string; +}; +/** + * Represents the refresh types of render objects. + */ +export type ConstantsRenderObjectRefreshType = { + /** + * - No refresh required. + */ + NONE: number; + /** + * - Only shared uniform buffers require an update. + */ + SHARED: number; + /** + * - The render object requires a full refresh. + */ + FULL: number; +}; diff --git a/jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts new file mode 100644 index 000000000..577098a58 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts @@ -0,0 +1,487 @@ +/** + * Convenient class that can be used when creating a `Float32` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Float32BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Float32Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Float32Array), itemSize: number, normalized?: boolean); +} +/** + * Convenient class that can be used when creating a `Float16` buffer attribute with + * a plain `Array` instance. + * + * This class automatically converts to and from FP16 via `Uint16Array` since `Float16Array` + * browser support is still problematic. + * + * @augments BufferAttribute + */ +export class Float16BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Uint16Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Uint16Array), itemSize: number, normalized?: boolean); + isFloat16BufferAttribute: boolean; + getX(index: any): number; + setX(index: any, x: any): this; + getY(index: any): number; + setY(index: any, y: any): this; + getZ(index: any): number; + setZ(index: any, z: any): this; + getW(index: any): number; + setW(index: any, w: any): this; + setXY(index: any, x: any, y: any): this; + setXYZ(index: any, x: any, y: any, z: any): this; + setXYZW(index: any, x: any, y: any, z: any, w: any): this; +} +/** + * Convenient class that can be used when creating a `UInt32` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Uint32BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Uint32Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Uint32Array), itemSize: number, normalized?: boolean); +} +/** + * Convenient class that can be used when creating a `Int32` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Int32BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Int32Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Int32Array), itemSize: number, normalized?: boolean); +} +/** + * Convenient class that can be used when creating a `UInt16` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Uint16BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Uint16Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Uint16Array), itemSize: number, normalized?: boolean); +} +/** + * Convenient class that can be used when creating a `Int16` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Int16BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Int16Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Int16Array), itemSize: number, normalized?: boolean); +} +/** + * Convenient class that can be used when creating a `UInt8Clamped` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Uint8ClampedBufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Uint8ClampedArray)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Uint8ClampedArray), itemSize: number, normalized?: boolean); +} +/** + * Convenient class that can be used when creating a `UInt8` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Uint8BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Uint8Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Uint8Array), itemSize: number, normalized?: boolean); +} +/** + * Convenient class that can be used when creating a `Int8` buffer attribute with + * a plain `Array` instance. + * + * @augments BufferAttribute + */ +export class Int8BufferAttribute extends BufferAttribute { + /** + * Constructs a new buffer attribute. + * + * @param {(Array|Int8Array)} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: (Array | Int8Array), itemSize: number, normalized?: boolean); +} +/** + * This class stores data for an attribute (such as vertex positions, face + * indices, normals, colors, UVs, and any custom attributes ) associated with + * a geometry, which allows for more efficient passing of data to the GPU. + * + * When working with vector-like data, the `fromBufferAttribute( attribute, index )` + * helper methods on vector and color class might be helpful. E.g. {@link Vector3#fromBufferAttribute}. + */ +export class BufferAttribute extends EventDispatcher { + /** + * Constructs a new buffer attribute. + * + * @param {TypedArray} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(array: TypedArray, itemSize: number, normalized?: boolean); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBufferAttribute: boolean; + /** + * The name of the buffer attribute. + * + * @type {string} + */ + name: string; + /** + * The array holding the attribute data. It should have `itemSize * numVertices` + * elements, where `numVertices` is the number of vertices in the associated geometry. + * + * @type {TypedArray} + */ + array: TypedArray; + /** + * The number of values of the array that should be associated with a particular vertex. + * For instance, if this attribute is storing a 3-component vector (such as a position, + * normal, or color), then the value should be `3`. + * + * @type {number} + */ + itemSize: number; + /** + * Represents the number of items this buffer attribute stores. It is internally computed + * by dividing the `array` length by the `itemSize`. + * + * @type {number} + * @readonly + */ + readonly count: number; + /** + * Applies to integer data only. Indicates how the underlying data in the buffer maps to + * the values in the GLSL code. For instance, if `array` is an instance of `UInt16Array`, + * and `normalized` is `true`, the values `0 - +65535` in the array data will be mapped to + * `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted + * to floats unmodified, i.e. `65535` becomes `65535.0f`. + * + * @type {boolean} + */ + normalized: boolean; + /** + * Defines the intended usage pattern of the data store for optimization purposes. + * + * Note: After the initial use of a buffer, its usage cannot be changed. Instead, + * instantiate a new one and set the desired usage before the next render. + * + * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} + * @default StaticDrawUsage + */ + usage: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage); + /** + * This can be used to only update some components of stored vectors (for example, just the + * component related to color). Use the `addUpdateRange()` function to add ranges to this array. + * + * @type {Array} + */ + updateRanges: Array; + /** + * Configures the bound GPU type for use in shaders. + * + * Note: this only has an effect for integer arrays and is not configurable for float arrays. + * For lower precision float types, use `Float16BufferAttribute`. + * + * @type {(FloatType|IntType)} + * @default FloatType + */ + gpuType: (number | IntType); + /** + * A version number, incremented every time the `needsUpdate` is set to `true`. + * + * @type {number} + */ + version: number; + /** + * A callback function that is executed after the renderer has transferred the attribute + * array data to the GPU. + */ + onUploadCallback(): void; + /** + * Flag to indicate that this attribute has changed and should be re-sent to + * the GPU. Set this to `true` when you modify the value of the array. + * + * @type {number} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * Sets the usage of this buffer attribute. + * + * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set. + * @return {BufferAttribute} A reference to this buffer attribute. + */ + setUsage(value: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage)): BufferAttribute; + /** + * Adds a range of data in the data array to be updated on the GPU. + * + * @param {number} start - Position at which to start update. + * @param {number} count - The number of components to update. + */ + addUpdateRange(start: number, count: number): void; + /** + * Clears the update ranges. + */ + clearUpdateRanges(): void; + /** + * Copies the values of the given buffer attribute to this instance. + * + * @param {BufferAttribute} source - The buffer attribute to copy. + * @return {BufferAttribute} A reference to this instance. + */ + copy(source: BufferAttribute): BufferAttribute; + /** + * Copies a vector from the given buffer attribute to this one. The start + * and destination position in the attribute buffers are represented by the + * given indices. + * + * @param {number} index1 - The destination index into this buffer attribute. + * @param {BufferAttribute} attribute - The buffer attribute to copy from. + * @param {number} index2 - The source index into the given buffer attribute. + * @return {BufferAttribute} A reference to this instance. + */ + copyAt(index1: number, attribute: BufferAttribute, index2: number): BufferAttribute; + /** + * Copies the given array data into this buffer attribute. + * + * @param {(TypedArray|Array)} array - The array to copy. + * @return {BufferAttribute} A reference to this instance. + */ + copyArray(array: (TypedArray | any[])): BufferAttribute; + /** + * Applies the given 3x3 matrix to the given attribute. Works with + * item size `2` and `3`. + * + * @param {Matrix3} m - The matrix to apply. + * @return {BufferAttribute} A reference to this instance. + */ + applyMatrix3(m: Matrix3): BufferAttribute; + /** + * Applies the given 4x4 matrix to the given attribute. Only works with + * item size `3`. + * + * @param {Matrix4} m - The matrix to apply. + * @return {BufferAttribute} A reference to this instance. + */ + applyMatrix4(m: Matrix4): BufferAttribute; + /** + * Applies the given 3x3 normal matrix to the given attribute. Only works with + * item size `3`. + * + * @param {Matrix3} m - The normal matrix to apply. + * @return {BufferAttribute} A reference to this instance. + */ + applyNormalMatrix(m: Matrix3): BufferAttribute; + /** + * Applies the given 4x4 matrix to the given attribute. Only works with + * item size `3` and with direction vectors. + * + * @param {Matrix4} m - The matrix to apply. + * @return {BufferAttribute} A reference to this instance. + */ + transformDirection(m: Matrix4): BufferAttribute; + /** + * Sets the given array data in the buffer attribute. + * + * @param {(TypedArray|Array)} value - The array data to set. + * @param {number} [offset=0] - The offset in this buffer attribute's array. + * @return {BufferAttribute} A reference to this instance. + */ + set(value: (TypedArray | any[]), offset?: number): BufferAttribute; + /** + * Returns the given component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} component - The component index. + * @return {number} The returned value. + */ + getComponent(index: number, component: number): number; + /** + * Sets the given value to the given component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} component - The component index. + * @param {number} value - The value to set. + * @return {BufferAttribute} A reference to this instance. + */ + setComponent(index: number, component: number, value: number): BufferAttribute; + /** + * Returns the x component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The x component. + */ + getX(index: number): number; + /** + * Sets the x component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value to set. + * @return {BufferAttribute} A reference to this instance. + */ + setX(index: number, x: number): BufferAttribute; + /** + * Returns the y component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The y component. + */ + getY(index: number): number; + /** + * Sets the y component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} y - The value to set. + * @return {BufferAttribute} A reference to this instance. + */ + setY(index: number, y: number): BufferAttribute; + /** + * Returns the z component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The z component. + */ + getZ(index: number): number; + /** + * Sets the z component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} z - The value to set. + * @return {BufferAttribute} A reference to this instance. + */ + setZ(index: number, z: number): BufferAttribute; + /** + * Returns the w component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The w component. + */ + getW(index: number): number; + /** + * Sets the w component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} w - The value to set. + * @return {BufferAttribute} A reference to this instance. + */ + setW(index: number, w: number): BufferAttribute; + /** + * Sets the x and y component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value for the x component to set. + * @param {number} y - The value for the y component to set. + * @return {BufferAttribute} A reference to this instance. + */ + setXY(index: number, x: number, y: number): BufferAttribute; + /** + * Sets the x, y and z component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value for the x component to set. + * @param {number} y - The value for the y component to set. + * @param {number} z - The value for the z component to set. + * @return {BufferAttribute} A reference to this instance. + */ + setXYZ(index: number, x: number, y: number, z: number): BufferAttribute; + /** + * Sets the x, y, z and w component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value for the x component to set. + * @param {number} y - The value for the y component to set. + * @param {number} z - The value for the z component to set. + * @param {number} w - The value for the w component to set. + * @return {BufferAttribute} A reference to this instance. + */ + setXYZW(index: number, x: number, y: number, z: number, w: number): BufferAttribute; + /** + * Sets the given callback function that is executed after the Renderer has transferred + * the attribute array data to the GPU. Can be used to perform clean-up operations after + * the upload when attribute data are not needed anymore on the CPU side. + * + * @param {Function} callback - The `onUpload()` callback. + * @return {BufferAttribute} A reference to this instance. + */ + onUpload(callback: Function): BufferAttribute; + /** + * Returns a new buffer attribute with copied values from this instance. + * + * @return {BufferAttribute} A clone of this instance. + */ + clone(): BufferAttribute; + /** + * Serializes the buffer attribute into JSON. + * + * @return {Object} A JSON object representing the serialized buffer attribute. + */ + toJSON(): Object; + /** + * Disposes of the buffer attribute. Available only in {@link WebGPURenderer}. + */ + dispose(): void; +} +import { EventDispatcher } from './EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts b/jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts new file mode 100644 index 000000000..9906f15d4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts @@ -0,0 +1,403 @@ +/** + * A representation of mesh, line, or point geometry. Includes vertex + * positions, face indices, normals, colors, UVs, and custom attributes + * within buffers, reducing the cost of passing all this data to the GPU. + * + * ```js + * const geometry = new THREE.BufferGeometry(); + * // create a simple square shape. We duplicate the top left and bottom right + * // vertices because each vertex needs to appear once per triangle. + * const vertices = new Float32Array( [ + * -1.0, -1.0, 1.0, // v0 + * 1.0, -1.0, 1.0, // v1 + * 1.0, 1.0, 1.0, // v2 + * + * 1.0, 1.0, 1.0, // v3 + * -1.0, 1.0, 1.0, // v4 + * -1.0, -1.0, 1.0 // v5 + * ] ); + * // itemSize = 3 because there are 3 values (components) per vertex + * geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); + * const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); + * const mesh = new THREE.Mesh( geometry, material ); + * ``` + * + * @augments EventDispatcher + */ +export class BufferGeometry extends EventDispatcher { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBufferGeometry: boolean; + /** + * The UUID of the geometry. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * The name of the geometry. + * + * @type {string} + */ + name: string; + type: string; + /** + * Allows for vertices to be re-used across multiple triangles; this is + * called using "indexed triangles". Each triangle is associated with the + * indices of three vertices. This attribute therefore stores the index of + * each vertex for each triangular face. If this attribute is not set, the + * renderer assumes that each three contiguous positions represent a single triangle. + * + * @type {?BufferAttribute} + * @default null + */ + index: BufferAttribute | null; + /** + * A (storage) buffer attribute which was generated with a compute shader and + * now defines indirect draw calls. + * + * Can only be used with {@link WebGPURenderer} and a WebGPU backend. + * + * @type {?BufferAttribute} + * @default null + */ + indirect: BufferAttribute | null; + /** + * The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset. + * + * Can only be used with {@link WebGPURenderer} and a WebGPU backend. + * + * @type {number|Array} + * @default 0 + */ + indirectOffset: number | Array; + /** + * This dictionary has as id the name of the attribute to be set and as value + * the buffer attribute to set it to. Rather than accessing this property directly, + * use `setAttribute()` and `getAttribute()` to access attributes of this geometry. + * + * @type {Object} + */ + attributes: { + [x: string]: any; + }; + /** + * This dictionary holds the morph targets of the geometry. + * + * Note: Once the geometry has been rendered, the morph attribute data cannot + * be changed. You will have to call `dispose()`, and create a new geometry instance. + * + * @type {Object} + */ + morphAttributes: Object; + /** + * Used to control the morph target behavior; when set to `true`, the morph + * target data is treated as relative offsets, rather than as absolute + * positions/normals. + * + * @type {boolean} + * @default false + */ + morphTargetsRelative: boolean; + /** + * Split the geometry into groups, each of which will be rendered in a + * separate draw call. This allows an array of materials to be used with the geometry. + * + * Use `addGroup()` and `clearGroups()` to edit groups, rather than modifying this array directly. + * + * Every vertex and index must belong to exactly one group — groups must not share vertices or + * indices, and must not leave vertices or indices unused. + * + * @type {Array} + */ + groups: Array; + /** + * Bounding box for the geometry which can be calculated with `computeBoundingBox()`. + * + * @type {?Box3} + * @default null + */ + boundingBox: Box3 | null; + /** + * Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`. + * + * @type {?Sphere} + * @default null + */ + boundingSphere: Sphere | null; + /** + * Determines the part of the geometry to render. This should not be set directly, + * instead use `setDrawRange()`. + * + * @type {{start:number,count:number}} + */ + drawRange: { + start: number; + count: number; + }; + /** + * An object that can be used to store custom data about the geometry. + * It should not hold references to functions as these will not be cloned. + * + * @type {Object} + */ + userData: Object; + /** + * `true` when the geometry has been transformed since construction + * (e.g. via {@link BufferGeometry#applyMatrix4}). Only relevant for + * geometry generators (subclasses that populate `parameters`): when set, + * {@link BufferGeometry#toJSON} omits `parameters` since they no longer + * describe the geometry. + * + * @private + * @type {boolean} + * @default false + */ + private _transformed; + /** + * Returns the index of this geometry. + * + * @return {?BufferAttribute} The index. Returns `null` if no index is defined. + */ + getIndex(): BufferAttribute | null; + /** + * Sets the given index to this geometry. + * + * @param {Array|BufferAttribute} index - The index to set. + * @return {BufferGeometry} A reference to this instance. + */ + setIndex(index: Array | BufferAttribute): BufferGeometry; + /** + * Sets the given indirect attribute to this geometry. + * + * @param {BufferAttribute} indirect - The attribute holding indirect draw calls. + * @param {number|Array} [indirectOffset=0] - The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset. + * @return {BufferGeometry} A reference to this instance. + */ + setIndirect(indirect: BufferAttribute, indirectOffset?: number | Array): BufferGeometry; + /** + * Returns the indirect attribute of this geometry. + * + * @return {?BufferAttribute} The indirect attribute. Returns `null` if no indirect attribute is defined. + */ + getIndirect(): BufferAttribute | null; + /** + * Returns the buffer attribute for the given name. + * + * @param {string} name - The attribute name. + * @return {BufferAttribute|InterleavedBufferAttribute|undefined} The buffer attribute. + * Returns `undefined` if not attribute has been found. + */ + getAttribute(name: string): BufferAttribute | InterleavedBufferAttribute | undefined; + /** + * Sets the given attribute for the given name. + * + * @param {string} name - The attribute name. + * @param {BufferAttribute|InterleavedBufferAttribute} attribute - The attribute to set. + * @return {BufferGeometry} A reference to this instance. + */ + setAttribute(name: string, attribute: BufferAttribute | InterleavedBufferAttribute): BufferGeometry; + /** + * Deletes the attribute for the given name. + * + * @param {string} name - The attribute name to delete. + * @return {BufferGeometry} A reference to this instance. + */ + deleteAttribute(name: string): BufferGeometry; + /** + * Returns `true` if this geometry has an attribute for the given name. + * + * @param {string} name - The attribute name. + * @return {boolean} Whether this geometry has an attribute for the given name or not. + */ + hasAttribute(name: string): boolean; + /** + * Adds a group to this geometry. + * + * @param {number} start - The first element in this draw call. That is the first + * vertex for non-indexed geometry, otherwise the first triangle index. + * @param {number} count - Specifies how many vertices (or indices) are part of this group. + * @param {number} [materialIndex=0] - The material array index to use. + */ + addGroup(start: number, count: number, materialIndex?: number): void; + /** + * Clears all groups. + */ + clearGroups(): void; + /** + * Sets the draw range for this geometry. + * + * @param {number} start - The first vertex for non-indexed geometry, otherwise the first triangle index. + * @param {number} count - For non-indexed BufferGeometry, `count` is the number of vertices to render. + * For indexed BufferGeometry, `count` is the number of indices to render. + */ + setDrawRange(start: number, count: number): void; + /** + * Applies the given 4x4 transformation matrix to the geometry. + * + * @param {Matrix4} matrix - The matrix to apply. + * @return {BufferGeometry} A reference to this instance. + */ + applyMatrix4(matrix: Matrix4): BufferGeometry; + /** + * Applies the rotation represented by the Quaternion to the geometry. + * + * @param {Quaternion} q - The Quaternion to apply. + * @return {BufferGeometry} A reference to this instance. + */ + applyQuaternion(q: Quaternion): BufferGeometry; + /** + * Rotates the geometry about the X axis. This is typically done as a one time + * operation, and not during a loop. Use {@link Object3D#rotation} for typical + * real-time mesh rotation. + * + * @param {number} angle - The angle in radians. + * @return {BufferGeometry} A reference to this instance. + */ + rotateX(angle: number): BufferGeometry; + /** + * Rotates the geometry about the Y axis. This is typically done as a one time + * operation, and not during a loop. Use {@link Object3D#rotation} for typical + * real-time mesh rotation. + * + * @param {number} angle - The angle in radians. + * @return {BufferGeometry} A reference to this instance. + */ + rotateY(angle: number): BufferGeometry; + /** + * Rotates the geometry about the Z axis. This is typically done as a one time + * operation, and not during a loop. Use {@link Object3D#rotation} for typical + * real-time mesh rotation. + * + * @param {number} angle - The angle in radians. + * @return {BufferGeometry} A reference to this instance. + */ + rotateZ(angle: number): BufferGeometry; + /** + * Translates the geometry. This is typically done as a one time + * operation, and not during a loop. Use {@link Object3D#position} for typical + * real-time mesh rotation. + * + * @param {number} x - The x offset. + * @param {number} y - The y offset. + * @param {number} z - The z offset. + * @return {BufferGeometry} A reference to this instance. + */ + translate(x: number, y: number, z: number): BufferGeometry; + /** + * Scales the geometry. This is typically done as a one time + * operation, and not during a loop. Use {@link Object3D#scale} for typical + * real-time mesh rotation. + * + * @param {number} x - The x scale. + * @param {number} y - The y scale. + * @param {number} z - The z scale. + * @return {BufferGeometry} A reference to this instance. + */ + scale(x: number, y: number, z: number): BufferGeometry; + /** + * Rotates the geometry to face a point in 3D space. This is typically done as a one time + * operation, and not during a loop. Use {@link Object3D#lookAt} for typical + * real-time mesh rotation. + * + * @param {Vector3} vector - The target point. + * @return {BufferGeometry} A reference to this instance. + */ + lookAt(vector: Vector3): BufferGeometry; + /** + * Center the geometry based on its bounding box. + * + * @return {BufferGeometry} A reference to this instance. + */ + center(): BufferGeometry; + /** + * Defines a geometry by creating a `position` attribute based on the given array of points. The array + * can hold 2D or 3D vectors. When using two-dimensional data, the `z` coordinate for all vertices is + * set to `0`. + * + * If the method is used with an existing `position` attribute, the vertex data are overwritten with the + * data from the array. The length of the array must match the vertex count. + * + * @param {Array|Array} points - The points. + * @return {BufferGeometry} A reference to this instance. + */ + setFromPoints(points: Array | Array): BufferGeometry; + /** + * Computes the bounding box of the geometry, and updates the `boundingBox` member. + * The bounding box is not computed by the engine; it must be computed by your app. + * You may need to recompute the bounding box if the geometry vertices are modified. + */ + computeBoundingBox(): void; + /** + * Computes the bounding sphere of the geometry, and updates the `boundingSphere` member. + * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. + * You may need to recompute the bounding sphere if the geometry vertices are modified. + */ + computeBoundingSphere(): void; + /** + * Calculates and adds a tangent attribute to this geometry. + * + * The computation is only supported for indexed geometries and if position, normal, and uv attributes + * are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by + * {@link BufferGeometryUtils#computeMikkTSpaceTangents} instead. + */ + computeTangents(): void; + /** + * Computes vertex normals for the given vertex data. For indexed geometries, the method sets + * each vertex normal to be the average of the face normals of the faces that share that vertex. + * For non-indexed geometries, vertices are not shared, and the method sets each vertex normal + * to be the same as the face normal. + */ + computeVertexNormals(): void; + /** + * Ensures every normal vector in a geometry will have a magnitude of `1`. This will + * correct lighting on the geometry surfaces. + */ + normalizeNormals(): void; + /** + * Return a new non-index version of this indexed geometry. If the geometry + * is already non-indexed, the method is a NOOP. + * + * @return {BufferGeometry} The non-indexed version of this indexed geometry. + */ + toNonIndexed(): BufferGeometry; + /** + * Serializes the geometry into JSON. + * + * @return {Object} A JSON object representing the serialized geometry. + */ + toJSON(): Object; + /** + * Returns a new geometry with copied values from this instance. + * + * @return {BufferGeometry} A clone of this instance. + */ + clone(): BufferGeometry; + /** + * Copies the values of the given geometry to this instance. + * + * @param {BufferGeometry} source - The geometry to copy. + * @return {BufferGeometry} A reference to this instance. + */ + copy(source: BufferGeometry): BufferGeometry; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires BufferGeometry#dispose + */ + dispose(): void; +} +import { EventDispatcher } from './EventDispatcher.js'; +import { BufferAttribute } from './BufferAttribute.js'; +import { Box3 } from '../math/Box3.js'; +import { Sphere } from '../math/Sphere.js'; +import { Matrix4 } from '../math/Matrix4.js'; +import { Vector3 } from '../math/Vector3.js'; +import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Clock.d.ts b/jsdoc-testing/jsdoc/src/core/Clock.d.ts new file mode 100644 index 000000000..d8945c215 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/Clock.d.ts @@ -0,0 +1,73 @@ +/** + * Class for keeping track of time. + * + * @deprecated since r183. + */ +export class Clock { + /** + * Constructs a new clock. + * + * @deprecated since 183. + * @param {boolean} [autoStart=true] - Whether to automatically start the clock when + * `getDelta()` is called for the first time. + */ + constructor(autoStart?: boolean); + /** + * If set to `true`, the clock starts automatically when `getDelta()` is called + * for the first time. + * + * @type {boolean} + * @default true + */ + autoStart: boolean; + /** + * Holds the time at which the clock's `start()` method was last called. + * + * @type {number} + * @default 0 + */ + startTime: number; + /** + * Holds the time at which the clock's `start()`, `getElapsedTime()` or + * `getDelta()` methods were last called. + * + * @type {number} + * @default 0 + */ + oldTime: number; + /** + * Keeps track of the total time that the clock has been running. + * + * @type {number} + * @default 0 + */ + elapsedTime: number; + /** + * Whether the clock is running or not. + * + * @type {boolean} + * @default true + */ + running: boolean; + /** + * Starts the clock. When `autoStart` is set to `true`, the method is automatically + * called by the class. + */ + start(): void; + /** + * Stops the clock. + */ + stop(): void; + /** + * Returns the elapsed time in seconds. + * + * @return {number} The elapsed time. + */ + getElapsedTime(): number; + /** + * Returns the delta time in seconds. + * + * @return {number} The delta time. + */ + getDelta(): number; +} diff --git a/jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts b/jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts new file mode 100644 index 000000000..b53482ecc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts @@ -0,0 +1,53 @@ +/** + * This modules allows to dispatch event objects on custom JavaScript objects. + * + * Main repository: [eventdispatcher.js](https://github.com/mrdoob/eventdispatcher.js/) + * + * Code Example: + * ```js + * class Car extends EventDispatcher { + * start() { + * this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } ); + * } + *}; + * + * // Using events with the custom object + * const car = new Car(); + * car.addEventListener( 'start', function ( event ) { + * alert( event.message ); + * } ); + * + * car.start(); + * ``` + */ +export class EventDispatcher { + /** + * Adds the given event listener to the given event type. + * + * @param {string} type - The type of event to listen to. + * @param {Function} listener - The function that gets called when the event is fired. + */ + addEventListener(type: string, listener: Function): void; + _listeners: {} | undefined; + /** + * Returns `true` if the given event listener has been added to the given event type. + * + * @param {string} type - The type of event. + * @param {Function} listener - The listener to check. + * @return {boolean} Whether the given event listener has been added to the given event type. + */ + hasEventListener(type: string, listener: Function): boolean; + /** + * Removes the given event listener from the given event type. + * + * @param {string} type - The type of event. + * @param {Function} listener - The listener to remove. + */ + removeEventListener(type: string, listener: Function): void; + /** + * Dispatches an event object. + * + * @param {Object} event - The event that gets fired. + */ + dispatchEvent(event: Object): void; +} diff --git a/jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts new file mode 100644 index 000000000..636d7b1e6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts @@ -0,0 +1,122 @@ +/** + * An alternative version of a buffer attribute with more control over the VBO. + * + * The renderer does not construct a VBO for this kind of attribute. Instead, it uses + * whatever VBO is passed in constructor and can later be altered via the `buffer` property. + * + * The most common use case for this class is when some kind of GPGPU calculation interferes + * or even produces the VBOs in question. + * + * Notice that this class can only be used with {@link WebGLRenderer}. + */ +export class GLBufferAttribute { + /** + * Constructs a new GL buffer attribute. + * + * @param {WebGLBuffer} buffer - The native WebGL buffer. + * @param {number} type - The native data type (e.g. `gl.FLOAT`). + * @param {number} itemSize - The item size. + * @param {number} elementSize - The corresponding size (in bytes) for the given `type` parameter. + * @param {number} count - The expected number of vertices in VBO. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(buffer: WebGLBuffer, type: number, itemSize: number, elementSize: number, count: number, normalized?: boolean); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isGLBufferAttribute: boolean; + /** + * The name of the buffer attribute. + * + * @type {string} + */ + name: string; + /** + * The native WebGL buffer. + * + * @type {WebGLBuffer} + */ + buffer: WebGLBuffer; + /** + * The native data type. + * + * @type {number} + */ + type: number; + /** + * The item size, see {@link BufferAttribute#itemSize}. + * + * @type {number} + */ + itemSize: number; + /** + * The corresponding size (in bytes) for the given `type` parameter. + * + * @type {number} + */ + elementSize: number; + /** + * The expected number of vertices in VBO. + * + * @type {number} + */ + count: number; + /** + * Applies to integer data only. Indicates how the underlying data in the buffer maps to + * the values in the GLSL code. For instance, if `buffer` contains data of `gl.UNSIGNED_SHORT`, + * and `normalized` is `true`, the values `0 - +65535` in the buffer data will be mapped to + * `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted + * to floats unmodified, i.e. `65535` becomes `65535.0f`. + * + * @type {boolean} + */ + normalized: boolean; + /** + * A version number, incremented every time the `needsUpdate` is set to `true`. + * + * @type {number} + */ + version: number; + /** + * Flag to indicate that this attribute has changed and should be re-sent to + * the GPU. Set this to `true` when you modify the value of the array. + * + * @type {number} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * Sets the given native WebGL buffer. + * + * @param {WebGLBuffer} buffer - The buffer to set. + * @return {BufferAttribute} A reference to this instance. + */ + setBuffer(buffer: WebGLBuffer): BufferAttribute; + /** + * Sets the given native data type and element size. + * + * @param {number} type - The native data type (e.g. `gl.FLOAT`). + * @param {number} elementSize - The corresponding size (in bytes) for the given `type` parameter. + * @return {BufferAttribute} A reference to this instance. + */ + setType(type: number, elementSize: number): BufferAttribute; + /** + * Sets the item size. + * + * @param {number} itemSize - The item size. + * @return {BufferAttribute} A reference to this instance. + */ + setItemSize(itemSize: number): BufferAttribute; + /** + * Sets the count (the expected number of vertices in VBO). + * + * @param {number} count - The count. + * @return {BufferAttribute} A reference to this instance. + */ + setCount(count: number): BufferAttribute; +} diff --git a/jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts new file mode 100644 index 000000000..aed6b3ff4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts @@ -0,0 +1,36 @@ +/** + * An instanced version of a buffer attribute. + * + * @augments BufferAttribute + */ +export class InstancedBufferAttribute extends BufferAttribute { + /** + * Constructs a new instanced buffer attribute. + * + * @param {TypedArray} array - The array holding the attribute data. + * @param {number} itemSize - The item size. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + * @param {number} [meshPerAttribute=1] - How often a value of this buffer attribute should be repeated. + */ + constructor(array: TypedArray, itemSize: number, normalized?: boolean, meshPerAttribute?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInstancedBufferAttribute: boolean; + /** + * Defines how often a value of this buffer attribute should be repeated. A + * value of one means that each value of the instanced attribute is used for + * a single instance. A value of two means that each value is used for two + * consecutive instances (and so on). + * + * @type {number} + * @default 1 + */ + meshPerAttribute: number; + copy(source: any): this; +} +import { BufferAttribute } from './BufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts b/jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts new file mode 100644 index 000000000..4ea16abdd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts @@ -0,0 +1,22 @@ +/** + * An instanced version of a geometry. + */ +export class InstancedBufferGeometry extends BufferGeometry { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInstancedBufferGeometry: boolean; + /** + * The instance count. + * + * @type {number} + * @default Infinity + */ + instanceCount: number; + copy(source: any): this; +} +import { BufferGeometry } from './BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts b/jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts new file mode 100644 index 000000000..3f95ae1bb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts @@ -0,0 +1,35 @@ +/** + * An instanced version of an interleaved buffer. + * + * @augments InterleavedBuffer + */ +export class InstancedInterleavedBuffer extends InterleavedBuffer { + /** + * Constructs a new instanced interleaved buffer. + * + * @param {TypedArray} array - A typed array with a shared buffer storing attribute data. + * @param {number} stride - The number of typed-array elements per vertex. + * @param {number} [meshPerAttribute=1] - Defines how often a value of this interleaved buffer should be repeated. + */ + constructor(array: TypedArray, stride: number, meshPerAttribute?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInstancedInterleavedBuffer: boolean; + /** + * Defines how often a value of this buffer attribute should be repeated, + * see {@link InstancedBufferAttribute#meshPerAttribute}. + * + * @type {number} + * @default 1 + */ + meshPerAttribute: number; + copy(source: any): this; + clone(data: any): InterleavedBuffer; + toJSON(data: any): Object; +} +import { InterleavedBuffer } from './InterleavedBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts b/jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts new file mode 100644 index 000000000..c6054ce83 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts @@ -0,0 +1,153 @@ +/** + * "Interleaved" means that multiple attributes, possibly of different types, + * (e.g., position, normal, uv, color) are packed into a single array buffer. + * + * An introduction into interleaved arrays can be found here: [Interleaved array basics](https://blog.tojicode.com/2011/05/interleaved-array-basics.html) + */ +export class InterleavedBuffer { + /** + * Constructs a new interleaved buffer. + * + * @param {TypedArray} array - A typed array with a shared buffer storing attribute data. + * @param {number} stride - The number of typed-array elements per vertex. + */ + constructor(array: TypedArray, stride: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInterleavedBuffer: boolean; + /** + * A typed array with a shared buffer storing attribute data. + * + * @type {TypedArray} + */ + array: TypedArray; + /** + * The number of typed-array elements per vertex. + * + * @type {number} + */ + stride: number; + /** + * The total number of elements in the array + * + * @type {number} + * @readonly + */ + readonly count: number; + /** + * Defines the intended usage pattern of the data store for optimization purposes. + * + * Note: After the initial use of a buffer, its usage cannot be changed. Instead, + * instantiate a new one and set the desired usage before the next render. + * + * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} + * @default StaticDrawUsage + */ + usage: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage); + /** + * This can be used to only update some components of stored vectors (for example, just the + * component related to color). Use the `addUpdateRange()` function to add ranges to this array. + * + * @type {Array} + */ + updateRanges: Array; + /** + * A version number, incremented every time the `needsUpdate` is set to `true`. + * + * @type {number} + */ + version: number; + /** + * The UUID of the interleaved buffer. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * A callback function that is executed after the renderer has transferred the attribute array + * data to the GPU. + */ + onUploadCallback(): void; + /** + * Flag to indicate that this attribute has changed and should be re-sent to + * the GPU. Set this to `true` when you modify the value of the array. + * + * @type {number} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * Sets the usage of this interleaved buffer. + * + * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set. + * @return {InterleavedBuffer} A reference to this interleaved buffer. + */ + setUsage(value: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage)): InterleavedBuffer; + /** + * Adds a range of data in the data array to be updated on the GPU. + * + * @param {number} start - Position at which to start update. + * @param {number} count - The number of components to update. + */ + addUpdateRange(start: number, count: number): void; + /** + * Clears the update ranges. + */ + clearUpdateRanges(): void; + /** + * Copies the values of the given interleaved buffer to this instance. + * + * @param {InterleavedBuffer} source - The interleaved buffer to copy. + * @return {InterleavedBuffer} A reference to this instance. + */ + copy(source: InterleavedBuffer): InterleavedBuffer; + /** + * Copies a vector from the given interleaved buffer to this one. The start + * and destination position in the attribute buffers are represented by the + * given indices. + * + * @param {number} index1 - The destination index into this interleaved buffer. + * @param {InterleavedBuffer} interleavedBuffer - The interleaved buffer to copy from. + * @param {number} index2 - The source index into the given interleaved buffer. + * @return {InterleavedBuffer} A reference to this instance. + */ + copyAt(index1: number, interleavedBuffer: InterleavedBuffer, index2: number): InterleavedBuffer; + /** + * Sets the given array data in the interleaved buffer. + * + * @param {(TypedArray|Array)} value - The array data to set. + * @param {number} [offset=0] - The offset in this interleaved buffer's array. + * @return {InterleavedBuffer} A reference to this instance. + */ + set(value: (TypedArray | any[]), offset?: number): InterleavedBuffer; + /** + * Returns a new interleaved buffer with copied values from this instance. + * + * @param {Object} [data] - An object with shared array buffers that allows to retain shared structures. + * @return {InterleavedBuffer} A clone of this instance. + */ + clone(data?: Object): InterleavedBuffer; + /** + * Sets the given callback function that is executed after the Renderer has transferred + * the array data to the GPU. Can be used to perform clean-up operations after + * the upload when data are not needed anymore on the CPU side. + * + * @param {Function} callback - The `onUpload()` callback. + * @return {InterleavedBuffer} A reference to this instance. + */ + onUpload(callback: Function): InterleavedBuffer; + /** + * Serializes the interleaved buffer into JSON. + * + * @param {Object} [data] - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized interleaved buffer. + */ + toJSON(data?: Object): Object; +} diff --git a/jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts new file mode 100644 index 000000000..8fd60911e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts @@ -0,0 +1,226 @@ +/** + * An alternative version of a buffer attribute with interleaved data. Interleaved + * attributes share a common interleaved data storage ({@link InterleavedBuffer}) and refer with + * different offsets into the buffer. + */ +export class InterleavedBufferAttribute { + /** + * Constructs a new interleaved buffer attribute. + * + * @param {InterleavedBuffer} interleavedBuffer - The buffer holding the interleaved data. + * @param {number} itemSize - The item size. + * @param {number} offset - The attribute offset into the buffer. + * @param {boolean} [normalized=false] - Whether the data are normalized or not. + */ + constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized?: boolean); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInterleavedBufferAttribute: boolean; + /** + * The name of the buffer attribute. + * + * @type {string} + */ + name: string; + /** + * The buffer holding the interleaved data. + * + * @type {InterleavedBuffer} + */ + data: InterleavedBuffer; + /** + * The item size, see {@link BufferAttribute#itemSize}. + * + * @type {number} + */ + itemSize: number; + /** + * The attribute offset into the buffer. + * + * @type {number} + */ + offset: number; + /** + * Whether the data are normalized or not, see {@link BufferAttribute#normalized} + * + * @type {InterleavedBuffer} + */ + normalized: InterleavedBuffer; + /** + * The item count of this buffer attribute. + * + * @type {number} + * @readonly + */ + readonly get count(): number; + /** + * The array holding the interleaved buffer attribute data. + * + * @type {TypedArray} + */ + get array(): TypedArray; + /** + * Flag to indicate that this attribute has changed and should be re-sent to + * the GPU. Set this to `true` when you modify the value of the array. + * + * @type {number} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * Applies the given 4x4 matrix to the given attribute. Only works with + * item size `3`. + * + * @param {Matrix4} m - The matrix to apply. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + applyMatrix4(m: Matrix4): InterleavedBufferAttribute; + /** + * Applies the given 3x3 normal matrix to the given attribute. Only works with + * item size `3`. + * + * @param {Matrix3} m - The normal matrix to apply. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + applyNormalMatrix(m: Matrix3): InterleavedBufferAttribute; + /** + * Applies the given 4x4 matrix to the given attribute. Only works with + * item size `3` and with direction vectors. + * + * @param {Matrix4} m - The matrix to apply. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + transformDirection(m: Matrix4): InterleavedBufferAttribute; + /** + * Returns the given component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} component - The component index. + * @return {number} The returned value. + */ + getComponent(index: number, component: number): number; + /** + * Sets the given value to the given component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} component - The component index. + * @param {number} value - The value to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setComponent(index: number, component: number, value: number): InterleavedBufferAttribute; + /** + * Sets the x component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setX(index: number, x: number): InterleavedBufferAttribute; + /** + * Sets the y component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} y - The value to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setY(index: number, y: number): InterleavedBufferAttribute; + /** + * Sets the z component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} z - The value to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setZ(index: number, z: number): InterleavedBufferAttribute; + /** + * Sets the w component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} w - The value to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setW(index: number, w: number): InterleavedBufferAttribute; + /** + * Returns the x component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The x component. + */ + getX(index: number): number; + /** + * Returns the y component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The y component. + */ + getY(index: number): number; + /** + * Returns the z component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The z component. + */ + getZ(index: number): number; + /** + * Returns the w component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @return {number} The w component. + */ + getW(index: number): number; + /** + * Sets the x and y component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value for the x component to set. + * @param {number} y - The value for the y component to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setXY(index: number, x: number, y: number): InterleavedBufferAttribute; + /** + * Sets the x, y and z component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value for the x component to set. + * @param {number} y - The value for the y component to set. + * @param {number} z - The value for the z component to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setXYZ(index: number, x: number, y: number, z: number): InterleavedBufferAttribute; + /** + * Sets the x, y, z and w component of the vector at the given index. + * + * @param {number} index - The index into the buffer attribute. + * @param {number} x - The value for the x component to set. + * @param {number} y - The value for the y component to set. + * @param {number} z - The value for the z component to set. + * @param {number} w - The value for the w component to set. + * @return {InterleavedBufferAttribute} A reference to this instance. + */ + setXYZW(index: number, x: number, y: number, z: number, w: number): InterleavedBufferAttribute; + /** + * Returns a new buffer attribute with copied values from this instance. + * + * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data. + * + * @param {Object} [data] - An object with interleaved buffers that allows to retain the interleaved property. + * @return {BufferAttribute|InterleavedBufferAttribute} A clone of this instance. + */ + clone(data?: Object): BufferAttribute | InterleavedBufferAttribute; + /** + * Serializes the buffer attribute into JSON. + * + * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data. + * + * @param {Object} [data] - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized buffer attribute. + */ + toJSON(data?: Object): Object; +} +import { BufferAttribute } from './BufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Layers.d.ts b/jsdoc-testing/jsdoc/src/core/Layers.d.ts new file mode 100644 index 000000000..34b3c6175 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/Layers.d.ts @@ -0,0 +1,68 @@ +/** + * A layers object assigns an 3D object to 1 or more of 32 + * layers numbered `0` to `31` - internally the layers are stored as a + * bit mask], and by default all 3D objects are a member of layer `0`. + * + * This can be used to control visibility - an object must share a layer with + * a camera to be visible when that camera's view is + * rendered. + * + * All classes that inherit from {@link Object3D} have an `layers` property which + * is an instance of this class. + */ +export class Layers { + /** + * A bit mask storing which of the 32 layers this layers object is currently + * a member of. + * + * @type {number} + */ + mask: number; + /** + * Sets membership to the given layer, and remove membership all other layers. + * + * @param {number} layer - The layer to set. + */ + set(layer: number): void; + /** + * Adds membership of the given layer. + * + * @param {number} layer - The layer to enable. + */ + enable(layer: number): void; + /** + * Adds membership to all layers. + */ + enableAll(): void; + /** + * Toggles the membership of the given layer. + * + * @param {number} layer - The layer to toggle. + */ + toggle(layer: number): void; + /** + * Removes membership of the given layer. + * + * @param {number} layer - The layer to enable. + */ + disable(layer: number): void; + /** + * Removes the membership from all layers. + */ + disableAll(): void; + /** + * Returns `true` if this and the given layers object have at least one + * layer in common. + * + * @param {Layers} layers - The layers to test. + * @return {boolean } Whether this and the given layers object have at least one layer in common or not. + */ + test(layers: Layers): boolean; + /** + * Returns `true` if the given layer is enabled. + * + * @param {number} layer - The layer to test. + * @return {boolean } Whether the given layer is enabled or not. + */ + isEnabled(layer: number): boolean; +} diff --git a/jsdoc-testing/jsdoc/src/core/Object3D.d.ts b/jsdoc-testing/jsdoc/src/core/Object3D.d.ts new file mode 100644 index 000000000..7e07bf8c4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/Object3D.d.ts @@ -0,0 +1,606 @@ +/** + * This is the base class for most objects in three.js and provides a set of + * properties and methods for manipulating objects in 3D space. + * + * @augments EventDispatcher + */ +export class Object3D extends EventDispatcher { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isObject3D: boolean; + /** + * The UUID of the 3D object. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * The name of the 3D object. + * + * @type {string} + */ + name: string; + /** + * The type property is used for detecting the object type + * in context of serialization/deserialization. + * + * @type {string} + * @readonly + */ + readonly type: string; + /** + * A reference to the parent object. + * + * @type {?Object3D} + * @default null + */ + parent: Object3D | null; + /** + * An array holding the child 3D objects of this instance. + * + * @type {Array} + */ + children: Array; + /** + * Defines the `up` direction of the 3D object which influences + * the orientation via methods like {@link Object3D#lookAt}. + * + * The default values for all 3D objects is defined by `Object3D.DEFAULT_UP`. + * + * @type {Vector3} + */ + up: Vector3; + /** + * Represents the object's transformation matrix in local space. + * + * @type {Matrix4} + */ + matrix: Matrix4; + /** + * Represents the object's transformation matrix in world space. + * If the 3D object has no parent, then it's identical to the local transformation matrix + * + * @type {Matrix4} + */ + matrixWorld: Matrix4; + /** + * When set to `true`, the engine automatically computes the local matrix from position, + * rotation and scale every frame. If set to `false`, the app is responsible for recomputing + * the local matrix by calling `updateMatrix()`. + * + * The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_AUTO_UPDATE`. + * + * @type {boolean} + * @default true + */ + matrixAutoUpdate: boolean; + /** + * When set to `true`, the engine automatically computes the world matrix from the current local + * matrix and the object's transformation hierarchy. If set to `false`, the app is responsible for + * recomputing the world matrix by directly updating the `matrixWorld` property. + * + * The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE`. + * + * @type {boolean} + * @default true + */ + matrixWorldAutoUpdate: boolean; + /** + * When set to `true`, it calculates the world matrix in that frame and resets this property + * to `false`. + * + * @type {boolean} + * @default false + */ + matrixWorldNeedsUpdate: boolean; + /** + * The layer membership of the 3D object. The 3D object is only visible if it has + * at least one layer in common with the camera in use. This property can also be + * used to filter out unwanted objects in ray-intersection tests when using {@link Raycaster}. + * + * @type {Layers} + */ + layers: Layers; + /** + * When set to `true`, the 3D object gets rendered. + * + * @type {boolean} + * @default true + */ + visible: boolean; + /** + * When set to `true`, the 3D object gets rendered into shadow maps. + * + * @type {boolean} + * @default false + */ + castShadow: boolean; + /** + * When set to `true`, the 3D object is affected by shadows in the scene. + * + * @type {boolean} + * @default false + */ + receiveShadow: boolean; + /** + * When set to `true`, the 3D object is honored by view frustum culling. + * + * @type {boolean} + * @default true + */ + frustumCulled: boolean; + /** + * This value allows the default rendering order of scene graph objects to be + * overridden although opaque and transparent objects remain sorted independently. + * When this property is set for an instance of {@link Group},all descendants + * objects will be sorted and rendered together. Sorting is from lowest to highest + * render order. + * + * @type {number} + * @default 0 + */ + renderOrder: number; + /** + * An array holding the animation clips of the 3D object. + * + * @type {Array} + */ + animations: Array; + /** + * Custom depth material to be used when rendering to the depth map. Can only be used + * in context of meshes. When shadow-casting with a {@link DirectionalLight} or {@link SpotLight}, + * if you are modifying vertex positions in the vertex shader you must specify a custom depth + * material for proper shadows. + * + * Only relevant in context of {@link WebGLRenderer}. + * + * @type {(Material|undefined)} + * @default undefined + */ + customDepthMaterial: (Material | undefined); + /** + * Same as {@link Object3D#customDepthMaterial}, but used with {@link PointLight}. + * + * Only relevant in context of {@link WebGLRenderer}. + * + * @type {(Material|undefined)} + * @default undefined + */ + customDistanceMaterial: (Material | undefined); + /** + * Whether the 3D object is supposed to be static or not. If set to `true`, it means + * the 3D object is not going to be changed after the initial renderer. This includes + * geometry and material settings. A static 3D object can be processed by the renderer + * slightly faster since certain state checks can be bypassed. + * + * Only relevant in context of {@link WebGPURenderer}. + * + * @type {boolean} + * @default false + */ + static: boolean; + /** + * An object that can be used to store custom data about the 3D object. It + * should not hold references to functions as these will not be cloned. + * + * @type {Object} + */ + userData: Object; + /** + * The pivot point for rotation and scale transformations. + * When set, rotation and scale are applied around this point + * instead of the object's origin. + * + * @type {?Vector3} + * @default null + */ + pivot: Vector3 | null; + /** + * A callback that is executed immediately before a 3D object is rendered to a shadow map. + * + * @param {Renderer|WebGLRenderer} renderer - The renderer. + * @param {Object3D} object - The 3D object. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {Camera} shadowCamera - The shadow camera. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Material} depthMaterial - The depth material. + * @param {Object} group - The geometry group data. + */ + onBeforeShadow(): void; + /** + * A callback that is executed immediately after a 3D object is rendered to a shadow map. + * + * @param {Renderer|WebGLRenderer} renderer - The renderer. + * @param {Object3D} object - The 3D object. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {Camera} shadowCamera - The shadow camera. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Material} depthMaterial - The depth material. + * @param {Object} group - The geometry group data. + */ + onAfterShadow(): void; + /** + * A callback that is executed immediately before a 3D object is rendered. + * + * @param {Renderer|WebGLRenderer} renderer - The renderer. + * @param {Object3D} object - The 3D object. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Material} material - The 3D object's material. + * @param {Object} group - The geometry group data. + */ + onBeforeRender(): void; + /** + * A callback that is executed immediately after a 3D object is rendered. + * + * @param {Renderer|WebGLRenderer} renderer - The renderer. + * @param {Object3D} object - The 3D object. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Material} material - The 3D object's material. + * @param {Object} group - The geometry group data. + */ + onAfterRender(): void; + /** + * Applies the given transformation matrix to the object and updates the object's position, + * rotation and scale. + * + * @param {Matrix4} matrix - The transformation matrix. + */ + applyMatrix4(matrix: Matrix4): void; + /** + * Applies a rotation represented by given the quaternion to the 3D object. + * + * @param {Quaternion} q - The quaternion. + * @return {Object3D} A reference to this instance. + */ + applyQuaternion(q: Quaternion): Object3D; + /** + * Sets the given rotation represented as an axis/angle couple to the 3D object. + * + * @param {Vector3} axis - The (normalized) axis vector. + * @param {number} angle - The angle in radians. + */ + setRotationFromAxisAngle(axis: Vector3, angle: number): void; + /** + * Sets the given rotation represented as Euler angles to the 3D object. + * + * @param {Euler} euler - The Euler angles. + */ + setRotationFromEuler(euler: Euler): void; + /** + * Sets the given rotation represented as rotation matrix to the 3D object. + * + * @param {Matrix4} m - Although a 4x4 matrix is expected, the upper 3x3 portion must be + * a pure rotation matrix (i.e, unscaled). + */ + setRotationFromMatrix(m: Matrix4): void; + /** + * Sets the given rotation represented as a Quaternion to the 3D object. + * + * @param {Quaternion} q - The Quaternion + */ + setRotationFromQuaternion(q: Quaternion): void; + /** + * Rotates the 3D object along an axis in local space. + * + * @param {Vector3} axis - The (normalized) axis vector. + * @param {number} angle - The angle in radians. + * @return {Object3D} A reference to this instance. + */ + rotateOnAxis(axis: Vector3, angle: number): Object3D; + /** + * Rotates the 3D object along an axis in world space. + * + * @param {Vector3} axis - The (normalized) axis vector. + * @param {number} angle - The angle in radians. + * @return {Object3D} A reference to this instance. + */ + rotateOnWorldAxis(axis: Vector3, angle: number): Object3D; + /** + * Rotates the 3D object around its X axis in local space. + * + * @param {number} angle - The angle in radians. + * @return {Object3D} A reference to this instance. + */ + rotateX(angle: number): Object3D; + /** + * Rotates the 3D object around its Y axis in local space. + * + * @param {number} angle - The angle in radians. + * @return {Object3D} A reference to this instance. + */ + rotateY(angle: number): Object3D; + /** + * Rotates the 3D object around its Z axis in local space. + * + * @param {number} angle - The angle in radians. + * @return {Object3D} A reference to this instance. + */ + rotateZ(angle: number): Object3D; + /** + * Translate the 3D object by a distance along the given axis in local space. + * + * @param {Vector3} axis - The (normalized) axis vector. + * @param {number} distance - The distance in world units. + * @return {Object3D} A reference to this instance. + */ + translateOnAxis(axis: Vector3, distance: number): Object3D; + /** + * Translate the 3D object by a distance along its X-axis in local space. + * + * @param {number} distance - The distance in world units. + * @return {Object3D} A reference to this instance. + */ + translateX(distance: number): Object3D; + /** + * Translate the 3D object by a distance along its Y-axis in local space. + * + * @param {number} distance - The distance in world units. + * @return {Object3D} A reference to this instance. + */ + translateY(distance: number): Object3D; + /** + * Translate the 3D object by a distance along its Z-axis in local space. + * + * @param {number} distance - The distance in world units. + * @return {Object3D} A reference to this instance. + */ + translateZ(distance: number): Object3D; + /** + * Converts the given vector from this 3D object's local space to world space. + * + * @param {Vector3} vector - The vector to convert. + * @return {Vector3} The converted vector. + */ + localToWorld(vector: Vector3): Vector3; + /** + * Converts the given vector from this 3D object's world space to local space. + * + * @param {Vector3} vector - The vector to convert. + * @return {Vector3} The converted vector. + */ + worldToLocal(vector: Vector3): Vector3; + /** + * Rotates the object to face a point in world space. + * + * This method does not support objects having non-uniformly-scaled parent(s). + * + * @param {number|Vector3} x - The x coordinate in world space. Alternatively, a vector representing a position in world space + * @param {number} [y] - The y coordinate in world space. + * @param {number} [z] - The z coordinate in world space. + */ + lookAt(x: number | Vector3, y?: number, z?: number): void; + /** + * Adds the given 3D object as a child to this 3D object. An arbitrary number of + * objects may be added. Any current parent on an object passed in here will be + * removed, since an object can have at most one parent. + * + * @fires Object3D#added + * @fires Object3D#childadded + * @param {Object3D} object - The 3D object to add. + * @return {Object3D} A reference to this instance. + */ + add(object: Object3D, ...args: any[]): Object3D; + /** + * Removes the given 3D object as child from this 3D object. + * An arbitrary number of objects may be removed. + * + * @fires Object3D#removed + * @fires Object3D#childremoved + * @param {Object3D} object - The 3D object to remove. + * @return {Object3D} A reference to this instance. + */ + remove(object: Object3D, ...args: any[]): Object3D; + /** + * Removes this 3D object from its current parent. + * + * @fires Object3D#removed + * @fires Object3D#childremoved + * @return {Object3D} A reference to this instance. + */ + removeFromParent(): Object3D; + /** + * Removes all child objects. + * + * @fires Object3D#removed + * @fires Object3D#childremoved + * @return {Object3D} A reference to this instance. + */ + clear(): Object3D; + /** + * Adds the given 3D object as a child of this 3D object, while maintaining the object's world + * transform. This method does not support scene graphs having non-uniformly-scaled nodes(s). + * + * @fires Object3D#added + * @fires Object3D#childadded + * @param {Object3D} object - The 3D object to attach. + * @return {Object3D} A reference to this instance. + */ + attach(object: Object3D): Object3D; + /** + * Searches through the 3D object and its children, starting with the 3D object + * itself, and returns the first with a matching ID. + * + * @param {number} id - The id. + * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found. + */ + getObjectById(id: number): Object3D | undefined; + /** + * Searches through the 3D object and its children, starting with the 3D object + * itself, and returns the first with a matching name. + * + * @param {string} name - The name. + * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found. + */ + getObjectByName(name: string): Object3D | undefined; + /** + * Searches through the 3D object and its children, starting with the 3D object + * itself, and returns the first with a matching property value. + * + * @param {string} name - The name of the property. + * @param {any} value - The value. + * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found. + */ + getObjectByProperty(name: string, value: any): Object3D | undefined; + /** + * Searches through the 3D object and its children, starting with the 3D object + * itself, and returns all 3D objects with a matching property value. + * + * @param {string} name - The name of the property. + * @param {any} value - The value. + * @param {Array} result - The method stores the result in this array. + * @return {Array} The found 3D objects. + */ + getObjectsByProperty(name: string, value: any, result?: Array): Array; + /** + * Returns a vector representing the position of the 3D object in world space. + * + * @param {Vector3} target - The target vector the result is stored to. + * @return {Vector3} The 3D object's position in world space. + */ + getWorldPosition(target: Vector3): Vector3; + /** + * Returns a Quaternion representing the position of the 3D object in world space. + * + * @param {Quaternion} target - The target Quaternion the result is stored to. + * @return {Quaternion} The 3D object's rotation in world space. + */ + getWorldQuaternion(target: Quaternion): Quaternion; + /** + * Returns a vector representing the scale of the 3D object in world space. + * + * @param {Vector3} target - The target vector the result is stored to. + * @return {Vector3} The 3D object's scale in world space. + */ + getWorldScale(target: Vector3): Vector3; + /** + * Returns a vector representing the ("look") direction of the 3D object in world space. + * + * @param {Vector3} target - The target vector the result is stored to. + * @return {Vector3} The 3D object's direction in world space. + */ + getWorldDirection(target: Vector3): Vector3; + /** + * Abstract method to get intersections between a casted ray and this + * 3D object. Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points} + * implement this method in order to use raycasting. + * + * @abstract + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - An array holding the result of the method. + */ + raycast(): void; + /** + * Abstract method to test whether this 3D object intersects the given frustum. + * Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points} + * implement this method in order to use frustum culling. + * + * @abstract + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean|undefined} Whether this 3D object intersects the given frustum or not. + */ + intersectsFrustum(): boolean | undefined; + /** + * Executes the callback on this 3D object and all descendants. + * + * Note: Modifying the scene graph inside the callback is discouraged. + * + * @param {Function} callback - A callback function that allows to process the current 3D object. + */ + traverse(callback: Function): void; + /** + * Like {@link Object3D#traverse}, but the callback will only be executed for visible 3D objects. + * Descendants of invisible 3D objects are not traversed. + * + * Note: Modifying the scene graph inside the callback is discouraged. + * + * @param {Function} callback - A callback function that allows to process the current 3D object. + */ + traverseVisible(callback: Function): void; + /** + * Like {@link Object3D#traverse}, but the callback will only be executed for all ancestors. + * + * Note: Modifying the scene graph inside the callback is discouraged. + * + * @param {Function} callback - A callback function that allows to process the current 3D object. + */ + traverseAncestors(callback: Function): void; + /** + * Updates the transformation matrix in local space by computing it from the current + * position, rotation and scale values. + */ + updateMatrix(): void; + /** + * Updates the transformation matrix in world space of this 3D objects and its descendants. + * + * To ensure correct results, this method also recomputes the 3D object's transformation matrix in + * local space. The computation of the local and world matrix can be controlled with the + * {@link Object3D#matrixAutoUpdate} and {@link Object3D#matrixWorldAutoUpdate} flags which are both + * `true` by default. Set these flags to `false` if you need more control over the update matrix process. + * + * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even + * when {@link Object3D#matrixWorldNeedsUpdate} is `false`. + */ + updateMatrixWorld(force?: boolean): void; + /** + * An alternative version of {@link Object3D#updateMatrixWorld} with more control over the + * update of ancestor and descendant nodes. + * + * @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not. + * @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not. + * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even + * when {@link Object3D#matrixWorldNeedsUpdate} is `false`. + */ + updateWorldMatrix(updateParents?: boolean, updateChildren?: boolean, force?: boolean): void; + /** + * Serializes the 3D object into JSON. + * + * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized 3D object. + * @see {@link ObjectLoader#parse} + */ + toJSON(meta: (Object | string) | null): Object; + /** + * Returns a new 3D object with copied values from this instance. + * + * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are also cloned. + * @return {Object3D} A clone of this instance. + */ + clone(recursive?: boolean): Object3D; + /** + * Copies the values of the given 3D object to this instance. + * + * @param {Object3D} source - The 3D object to copy. + * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are cloned. + * @return {Object3D} A reference to this instance. + */ + copy(source: Object3D, recursive?: boolean): Object3D; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * Geometries, materials and textures are potentially shared with other + * 3D objects and must be disposed of separately. + * + * @fires Object3D#dispose + */ + dispose(): void; +} +export namespace Object3D { + let DEFAULT_UP: Vector3; + let DEFAULT_MATRIX_AUTO_UPDATE: boolean; + let DEFAULT_MATRIX_WORLD_AUTO_UPDATE: boolean; +} +import { EventDispatcher } from './EventDispatcher.js'; +import { Vector3 } from '../math/Vector3.js'; +import { Matrix4 } from '../math/Matrix4.js'; +import { Layers } from './Layers.js'; +import { Quaternion } from '../math/Quaternion.js'; +import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Raycaster.d.ts b/jsdoc-testing/jsdoc/src/core/Raycaster.d.ts new file mode 100644 index 000000000..09c8b0845 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/Raycaster.d.ts @@ -0,0 +1,149 @@ +/** + * This class is designed to assist with raycasting. Raycasting is used for + * mouse picking (working out what objects in the 3d space the mouse is over) + * amongst other things. + */ +export class Raycaster { + /** + * Constructs a new raycaster. + * + * @param {Vector3} origin - The origin vector where the ray casts from. + * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray. + * @param {number} [near=0] - All results returned are further away than near. Near can't be negative. + * @param {number} [far=Infinity] - All results returned are closer than far. Far can't be lower than near. + */ + constructor(origin: Vector3, direction: Vector3, near?: number, far?: number); + /** + * The ray used for raycasting. + * + * @type {Ray} + */ + ray: Ray; + /** + * All results returned are further away than near. Near can't be negative. + * + * @type {number} + * @default 0 + */ + near: number; + /** + * All results returned are closer than far. Far can't be lower than near. + * + * @type {number} + * @default Infinity + */ + far: number; + /** + * The camera to use when raycasting against view-dependent objects such as + * billboarded objects like sprites. This field can be set manually or + * is set when calling `setFromCamera()`. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * Allows to selectively ignore 3D objects when performing intersection tests. + * The following code example ensures that only 3D objects on layer `1` will be + * honored by raycaster. + * ```js + * raycaster.layers.set( 1 ); + * object.layers.enable( 1 ); + * ``` + * + * @type {Layers} + */ + layers: Layers; + /** + * A parameter object that configures the raycasting. It has the structure: + * + * ``` + * { + * Mesh: {}, + * Line: { threshold: 1 }, + * LOD: {}, + * Points: { threshold: 1 }, + * Sprite: {} + * } + * ``` + * Where `threshold` is the precision of the raycaster when intersecting objects, in world units. + * + * @type {Object} + */ + params: Object; + /** + * Updates the ray with a new origin and direction by copying the values from the arguments. + * + * @param {Vector3} origin - The origin vector where the ray casts from. + * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray. + */ + set(origin: Vector3, direction: Vector3): void; + /** + * Uses the given coordinates and camera to compute a new origin and direction for the internal ray. + * + * @param {Vector2} coords - 2D coordinates of the mouse, in normalized device coordinates (NDC). + * X and Y components should be between `-1` and `1`. + * @param {Camera} camera - The camera from which the ray should originate. + */ + setFromCamera(coords: Vector2, camera: Camera): void; + /** + * Uses the given WebXR controller to compute a new origin and direction for the internal ray. + * + * @param {WebXRController} controller - The controller to copy the position and direction from. + * @return {Raycaster} A reference to this raycaster. + */ + setFromXRController(controller: WebXRController): Raycaster; + /** + * The intersection point of a raycaster intersection test. + * @typedef {Object} Raycaster~Intersection + * @property {number} distance - The distance from the ray's origin to the intersection point. + * @property {number} distanceToRay - Some 3D objects e.g. {@link Points} provide the distance of the + * intersection to the nearest point on the ray. For other objects it will be `undefined`. + * @property {Vector3} point - The intersection point, in world coordinates. + * @property {Object} face - The face that has been intersected. + * @property {number} faceIndex - The face index. + * @property {Object3D} object - The 3D object that has been intersected. + * @property {Vector2} uv - U,V coordinates at point of intersection. + * @property {Vector2} uv1 - Second set of U,V coordinates at point of intersection. + * @property {Vector3} normal - Interpolated normal vector at point of intersection. + * @property {number} instanceId - The index number of the instance where the ray + * intersects the {@link InstancedMesh}. + */ + /** + * Checks all intersection between the ray and the object with or without the + * descendants. Intersections are returned sorted by distance, closest first. + * + * `Raycaster` delegates to the `raycast()` method of the passed 3D object, when + * evaluating whether the ray intersects the object or not. This allows meshes to respond + * differently to ray casting than lines or points. + * + * Note that for meshes, faces must be pointed towards the origin of the ray in order + * to be detected; intersections of the ray passing through the back of a face will not + * be detected. To raycast against both faces of an object, you'll want to set {@link Material#side} + * to `THREE.DoubleSide`. + * + * Note that a ray hitting a triangle mesh exactly along an edge shared by two faces may be + * reported by both faces, resulting in two coincident intersections (identical point and + * distance) in the returned array. + * + * @param {Object3D} object - The 3D object to check for intersection with the ray. + * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. + * Otherwise it only checks intersection with the object. + * @param {Array} [intersects=[]] The target array that holds the result of the method. + * @return {Array} An array holding the intersection points. + */ + intersectObject(object: Object3D, recursive?: boolean, intersects?: any[]): Array; + /** + * Checks all intersection between the ray and the objects with or without + * the descendants. Intersections are returned sorted by distance, closest first. + * + * @param {Array} objects - The 3D objects to check for intersection with the ray. + * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. + * Otherwise it only checks intersection with the object. + * @param {Array} [intersects=[]] The target array that holds the result of the method. + * @return {Array} An array holding the intersection points. + */ + intersectObjects(objects: Array, recursive?: boolean, intersects?: any[]): Array; +} +import { Ray } from '../math/Ray.js'; +import { Layers } from './Layers.js'; diff --git a/jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts b/jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts new file mode 100644 index 000000000..772ac985d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts @@ -0,0 +1,269 @@ +/** + * A render target is a buffer where the video card draws pixels for a scene + * that is being rendered in the background. It is used in different effects, + * such as applying postprocessing to a rendered image before displaying it + * on the screen. + * + * @augments EventDispatcher + */ +export class RenderTarget extends EventDispatcher { + /** + * Render target options. + * + * @typedef {Object} RenderTarget~Options + * @property {boolean} [generateMipmaps=false] - Whether to generate mipmaps or not. + * @property {number} [magFilter=LinearFilter] - The mag filter. + * @property {number} [minFilter=LinearFilter] - The min filter. + * @property {number} [format=RGBAFormat] - The texture format. + * @property {number} [type=UnsignedByteType] - The texture type. + * @property {?string} [internalFormat=null] - The texture's internal format. + * @property {number} [wrapS=ClampToEdgeWrapping] - The texture's uv wrapping mode. + * @property {number} [wrapT=ClampToEdgeWrapping] - The texture's uv wrapping mode. + * @property {number} [anisotropy=1] - The texture's anisotropy value. + * @property {string} [colorSpace=NoColorSpace] - The texture's color space. + * @property {boolean} [depthBuffer=true] - Whether to allocate a depth buffer or not. + * @property {boolean} [stencilBuffer=false] - Whether to allocate a stencil buffer or not. + * @property {boolean} [resolveColorBuffer=true] - Whether to resolve the color buffer or not. Only relevant for multisampled render targets. + * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not. Only relevant for multisampled render targets. + * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not. Only relevant for multisampled render targets. + * @property {boolean} [storeMultisampledColorBuffer=true] - Whether to store the multisampled color buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass. + * @property {boolean} [storeMultisampledDepthBuffer=true] - Whether to store the multisampled depth buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass. + * @property {boolean} [storeMultisampledStencilBuffer=true] - Whether to store the multisampled stencil buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass. + * @property {?Texture} [depthTexture=null] - Reference to a depth texture. + * @property {number} [samples=0] - The MSAA samples count. + * @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`. + * @property {number} [depth=1] - The texture depth. + * @property {boolean} [multiview=false] - Whether this target is used for multiview rendering (WebGL OVR_multiview2 extension). + * @property {boolean} [useArrayDepthTexture=false] - Whether to create the depth texture as an array texture for per-layer depth testing. This is separate from multiview so layered render targets can use array depth without the multiview extension. + */ + /** + * Constructs a new render target. + * + * @param {number} [width=1] - The width of the render target. + * @param {number} [height=1] - The height of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(width?: number, height?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderTarget: boolean; + /** + * The width of the render target. + * + * @type {number} + * @default 1 + */ + width: number; + /** + * The height of the render target. + * + * @type {number} + * @default 1 + */ + height: number; + /** + * The depth of the render target. + * + * @type {number} + * @default 1 + */ + depth: number; + /** + * A rectangular area inside the render target's viewport. Fragments that are + * outside the area will be discarded. + * + * @type {Vector4} + * @default (0,0,width,height) + */ + scissor: Vector4; + /** + * Indicates whether the scissor test should be enabled when rendering into + * this render target or not. + * + * @type {boolean} + * @default false + */ + scissorTest: boolean; + /** + * A rectangular area representing the render target's viewport. + * + * @type {Vector4} + * @default (0,0,width,height) + */ + viewport: Vector4; + /** + * An array of textures. Each color attachment is represented as a separate texture. + * Has at least a single entry for the default color attachment. + * + * @type {Array} + */ + textures: Array; + /** + * Whether to allocate a depth buffer or not. + * + * @type {boolean} + * @default true + */ + depthBuffer: boolean; + /** + * Whether to allocate a stencil buffer or not. + * + * @type {boolean} + * @default false + */ + stencilBuffer: boolean; + /** + * Whether to resolve the color buffer or not. When set to `false`, the color + * attachments do not receive the resolved (single-sampled) output of a render + * pass and the render target's textures are left untouched. The rendered + * content is then only accessible within the render pass itself. + * + * Only relevant for multisampled render targets. + * + * @type {boolean} + * @default true + */ + resolveColorBuffer: boolean; + /** + * Whether to resolve the depth buffer or not. When set to `false`, the depth + * texture does not receive the resolved depth output of a render pass which + * saves memory bandwidth. Use this setting when the depth data of a render + * pass are not required afterwards. + * + * Only relevant for multisampled render targets in WebGL. WebGPU does not + * support depth resolves; sampling the depth texture of a multisampled render + * target accesses the multisampled data directly, see + * {@link RenderTarget#storeMultisampledDepthBuffer}. + * + * @type {boolean} + * @default true + */ + resolveDepthBuffer: boolean; + /** + * Whether to resolve the stencil buffer or not. Analogous to + * {@link RenderTarget#resolveDepthBuffer} but for the stencil aspect. + * + * @type {boolean} + * @default true + */ + resolveStencilBuffer: boolean; + /** + * Whether to store the multisampled color buffer or not. When set to `false`, + * the multisampled data are discarded at the end of a render pass, right after + * they have been resolved. This saves memory bandwidth, especially on tile-based + * GPUs, and is the recommended setting for render targets that are fully redrawn + * each frame and whose output is only accessed via the resolved textures (e.g. + * scene passes in post-processing chains). + * + * Must be kept `true` when the multisampled data are needed after the render + * pass ends, e.g. when rendering into the target without clearing or when the + * scene contains transmissive objects which require a mid-pass framebuffer copy. + * + * @type {boolean} + * @default true + */ + storeMultisampledColorBuffer: boolean; + /** + * Whether to store the multisampled depth buffer or not. When set to `false`, + * the multisampled depth data are discarded at the end of a render pass which + * saves memory bandwidth. + * + * Must be kept `true` in WebGPU when the depth texture of a multisampled render + * target is sampled (e.g. by depth-based post-processing effects) since depth + * is read directly from the multisampled data. + * + * @type {boolean} + * @default true + */ + storeMultisampledDepthBuffer: boolean; + /** + * Whether to store the multisampled stencil buffer or not. Analogous to + * {@link RenderTarget#storeMultisampledDepthBuffer} but for the stencil aspect. + * + * @type {boolean} + * @default true + */ + storeMultisampledStencilBuffer: boolean; + _depthTexture: any; + set depthTexture(current: DepthTexture | null); + /** + * Instead of saving the depth in a renderbuffer, a texture + * can be used instead which is useful for further processing + * e.g. in context of post-processing. + * + * @type {?DepthTexture} + * @default null + */ + get depthTexture(): DepthTexture | null; + /** + * The number of MSAA samples. + * + * A value of `0` disables MSAA. + * + * @type {number} + * @default 0 + */ + samples: number; + /** + * Whether to this target is used in multiview rendering. + * + * @type {boolean} + * @default false + */ + multiview: boolean; + /** + * Whether to create the depth texture as an array texture for per-layer depth testing. + * This is separate from multiview so layered render targets can use array depth without + * the multiview extension. + * + * @type {boolean} + * @default false + */ + useArrayDepthTexture: boolean; + _setTextureOptions(options?: {}): void; + set texture(value: Texture); + /** + * The texture representing the default color attachment. + * + * @type {Texture} + */ + get texture(): Texture; + /** + * Sets the size of this render target. + * + * @param {number} width - The width. + * @param {number} height - The height. + * @param {number} [depth=1] - The depth. + */ + setSize(width: number, height: number, depth?: number): void; + /** + * Returns a new render target with copied values from this instance. + * + * @return {RenderTarget} A clone of this instance. + */ + clone(): RenderTarget; + /** + * Copies the settings of the given render target. This is a structural copy so + * no resources are shared between render targets after the copy. That includes + * all MRT textures and the depth texture. + * + * @param {RenderTarget} source - The render target to copy. + * @return {RenderTarget} A reference to this instance. + */ + copy(source: RenderTarget): RenderTarget; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires RenderTarget#dispose + */ + dispose(): void; +} +import { EventDispatcher } from './EventDispatcher.js'; +import { Vector4 } from '../math/Vector4.js'; +import { Texture } from '../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts b/jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts new file mode 100644 index 000000000..11621efd2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts @@ -0,0 +1,25 @@ +/** + * Represents a 3D render target. + * + * @augments RenderTarget + */ +export class RenderTarget3D extends RenderTarget { + /** + * Constructs a new 3D render target. + * + * @param {number} [width=1] - The width of the render target. + * @param {number} [height=1] - The height of the render target. + * @param {number} [depth=1] - The height of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(width?: number, height?: number, depth?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderTarget3D: boolean; +} +import { RenderTarget } from './RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Timer.d.ts b/jsdoc-testing/jsdoc/src/core/Timer.d.ts new file mode 100644 index 000000000..d47c2d4bd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/Timer.d.ts @@ -0,0 +1,86 @@ +/** + * This class is an alternative to {@link Clock} with a different API design and behavior. + * The goal is to avoid the conceptual flaws that became apparent in `Clock` over time. + * + * - `Timer` has an `update()` method that updates its internal state. That makes it possible to + * call `getDelta()` and `getElapsed()` multiple times per simulation step without getting different values. + * - The class can make use of the Page Visibility API to avoid large time delta values when the app + * is inactive (e.g. tab switched or browser hidden). + * + * ```js + * const timer = new Timer(); + * timer.connect( document ); // use Page Visibility API + * ``` + */ +export class Timer { + _previousTime: number; + _currentTime: number; + _startTime: number; + _delta: number; + _elapsed: number; + _timescale: number; + _document: Document | null; + _pageVisibilityHandler: typeof handleVisibilityChange | null; + /** + * Connect the timer to the given document.Calling this method is not mandatory to + * use the timer but enables the usage of the Page Visibility API to avoid large time + * delta values. + * + * @param {Document} document - The document. + */ + connect(document: Document): void; + /** + * Disconnects the timer from the DOM and also disables the usage of the Page Visibility API. + */ + disconnect(): void; + /** + * Returns the time delta in seconds. + * + * @return {number} The time delta in second. + */ + getDelta(): number; + /** + * Returns the elapsed time in seconds. + * + * @return {number} The elapsed time in second. + */ + getElapsed(): number; + /** + * Returns the timescale. + * + * @return {number} The timescale. + */ + getTimescale(): number; + /** + * Sets the given timescale which scale the time delta computation + * in `update()`. + * + * @param {number} timescale - The timescale to set. + * @return {Timer} A reference to this timer. + */ + setTimescale(timescale: number): Timer; + /** + * Resets the time computation for the current simulation step. + * + * @return {Timer} A reference to this timer. + */ + reset(): Timer; + /** + * Can be used to free all internal resources. Usually called when + * the timer instance isn't required anymore. + */ + dispose(): void; + /** + * Updates the internal state of the timer. This method should be called + * once per simulation step and before you perform queries against the timer + * (e.g. via `getDelta()`). + * + * @param {number} timestamp - The current time in milliseconds. Can be obtained + * from the `requestAnimationFrame` callback argument. If not provided, the current + * time will be determined with `performance.now`. + * @return {Timer} A reference to this timer. + */ + update(timestamp: number): Timer; +} +declare function handleVisibilityChange(): void; +export {}; diff --git a/jsdoc-testing/jsdoc/src/core/Uniform.d.ts b/jsdoc-testing/jsdoc/src/core/Uniform.d.ts new file mode 100644 index 000000000..4febfde95 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/Uniform.d.ts @@ -0,0 +1,34 @@ +/** + * Represents a uniform which is a global shader variable. They are passed to shader programs. + * + * When declaring a uniform of a {@link ShaderMaterial}, it is declared by value or by object. + * ```js + * uniforms: { + * time: { value: 1.0 }, + * resolution: new Uniform( new Vector2() ) + * }; + * ``` + * Since this class can only be used in context of {@link ShaderMaterial}, it is only supported + * in {@link WebGLRenderer}. + */ +export class Uniform { + /** + * Constructs a new uniform. + * + * @param {any} value - The uniform value. + */ + constructor(value: any); + /** + * The uniform value. + * + * @type {any} + */ + value: any; + /** + * Returns a new uniform with copied values from this instance. + * If the value has a `clone()` method, the value is cloned as well. + * + * @return {Uniform} A clone of this instance. + */ + clone(): Uniform; +} diff --git a/jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts b/jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts new file mode 100644 index 000000000..fd08bb44b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts @@ -0,0 +1,87 @@ +/** + * A class for managing multiple uniforms in a single group. The renderer will process + * such a definition as a single UBO. + * + * Since this class can only be used in context of {@link ShaderMaterial}, it is only supported + * in {@link WebGLRenderer}. + * + * @augments EventDispatcher + */ +export class UniformsGroup extends EventDispatcher { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformsGroup: boolean; + /** + * The name of the uniforms group. + * + * @type {string} + */ + name: string; + /** + * The buffer usage. + * + * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} + * @default StaticDrawUsage + */ + usage: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage); + /** + * An array holding the uniforms. + * + * @type {Array} + */ + uniforms: Array; + /** + * Adds the given uniform to this uniforms group. + * + * @param {Uniform} uniform - The uniform to add. + * @return {UniformsGroup} A reference to this uniforms group. + */ + add(uniform: Uniform): UniformsGroup; + /** + * Removes the given uniform from this uniforms group. + * + * @param {Uniform} uniform - The uniform to remove. + * @return {UniformsGroup} A reference to this uniforms group. + */ + remove(uniform: Uniform): UniformsGroup; + /** + * Sets the name of this uniforms group. + * + * @param {string} name - The name to set. + * @return {UniformsGroup} A reference to this uniforms group. + */ + setName(name: string): UniformsGroup; + /** + * Sets the usage of this uniforms group. + * + * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set. + * @return {UniformsGroup} A reference to this uniforms group. + */ + setUsage(value: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage)): UniformsGroup; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires Texture#dispose + */ + dispose(): void; + /** + * Copies the values of the given uniforms group to this instance. + * + * @param {UniformsGroup} source - The uniforms group to copy. + * @return {UniformsGroup} A reference to this uniforms group. + */ + copy(source: UniformsGroup): UniformsGroup; + /** + * Returns a new uniforms group with copied values from this instance. + * + * @return {UniformsGroup} A clone of this instance. + */ + clone(): UniformsGroup; +} +import { EventDispatcher } from './EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/Controls.d.ts b/jsdoc-testing/jsdoc/src/extras/Controls.d.ts new file mode 100644 index 000000000..f9b5a381f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/Controls.d.ts @@ -0,0 +1,93 @@ +/** + * Abstract base class for controls. + * + * @abstract + * @augments EventDispatcher + */ +export class Controls extends EventDispatcher { + /** + * Constructs a new controls instance. + * + * @param {Object3D} object - The object that is managed by the controls. + * @param {?HTMLElement} domElement - The HTML element used for event listeners. + */ + constructor(object: Object3D, domElement?: HTMLElement | null); + /** + * The object that is managed by the controls. + * + * @type {Object3D} + */ + object: Object3D; + /** + * The HTML element used for event listeners. + * + * @type {?HTMLElement} + * @default null + */ + domElement: HTMLElement | null; + /** + * Whether the controls responds to user input or not. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * The internal state of the controls. + * + * @type {number} + * @default -1 + */ + state: number; + /** + * This object defines the keyboard input of the controls. + * + * @type {Object} + */ + keys: Object; + /** + * This object defines what type of actions are assigned to the available mouse buttons. + * It depends on the control implementation what kind of mouse buttons and actions are supported. + * + * @type {{LEFT: ?number, MIDDLE: ?number, RIGHT: ?number}} + */ + mouseButtons: { + LEFT: number | null; + MIDDLE: number | null; + RIGHT: number | null; + }; + /** + * This object defines what type of actions are assigned to what kind of touch interaction. + * It depends on the control implementation what kind of touch interaction and actions are supported. + * + * @type {{ONE: ?number, TWO: ?number}} + */ + touches: { + ONE: number | null; + TWO: number | null; + }; + /** + * Connects the controls to the DOM. This method has so called "side effects" since + * it adds the module's event listeners to the DOM. + * + * @param {HTMLElement} element - The DOM element to connect to. + */ + connect(element: HTMLElement): void; + /** + * Disconnects the controls from the DOM. + */ + disconnect(): void; + /** + * Call this method if you no longer want use to the controls. It frees all internal + * resources and removes all event listeners. + */ + dispose(): void; + /** + * Controls should implement this method if they have to update their internal state + * per simulation step. + * + * @param {number} [delta] - The time delta in seconds. + */ + update(): void; +} +import { EventDispatcher } from '../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts new file mode 100644 index 000000000..66cfe1590 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts @@ -0,0 +1,39 @@ +/** + * Returns a half precision floating point value (FP16) from the given single + * precision floating point value (FP32). + * + * @param {number} val - A single precision floating point value. + * @return {number} The FP16 value. + */ +export function toHalfFloat(val: number): number; +/** + * Returns a single precision floating point value (FP32) from the given half + * precision floating point value (FP16). + * + * @param {number} val - A half precision floating point value. + * @return {number} The FP32 value. + */ +export function fromHalfFloat(val: number): number; +/** + * A class containing utility functions for data. + * + * @hideconstructor + */ +export class DataUtils { + /** + * Returns a half precision floating point value (FP16) from the given single + * precision floating point value (FP32). + * + * @param {number} val - A single precision floating point value. + * @return {number} The FP16 value. + */ + static toHalfFloat(val: number): number; + /** + * Returns a single precision floating point value (FP32) from the given half + * precision floating point value (FP16). + * + * @param {number} val - A half precision floating point value. + * @return {number} The FP32 value. + */ + static fromHalfFloat(val: number): number; +} diff --git a/jsdoc-testing/jsdoc/src/extras/Earcut.d.ts b/jsdoc-testing/jsdoc/src/extras/Earcut.d.ts new file mode 100644 index 000000000..77d051e6a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/Earcut.d.ts @@ -0,0 +1,18 @@ +/** + * An implementation of the earcut polygon triangulation algorithm. + * The code is a port of [mapbox/earcut](https://github.com/mapbox/earcut). + * + * @see https://github.com/mapbox/earcut + */ +export class Earcut { + /** + * Triangulates the given shape definition by returning an array of triangles. + * + * @param {Array} data - An array with 2D points. + * @param {Array} holeIndices - An array with indices defining holes. + * @param {number} [dim=2] - The number of coordinates per vertex in the input array. + * @return {Array} An array representing the triangulated faces. Each face is defined by three consecutive numbers + * representing vertex indices. + */ + static triangulate(data: Array, holeIndices: Array, dim?: number): Array; +} diff --git a/jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts new file mode 100644 index 000000000..26077e10c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts @@ -0,0 +1,22 @@ +/** + * A class containing utility functions for images. + * + * @hideconstructor + */ +export class ImageUtils { + /** + * Returns a data URI containing a representation of the given image. + * + * @param {(HTMLImageElement|HTMLCanvasElement)} image - The image object. + * @param {string} [type='image/png'] - Indicates the image format. + * @return {string} The data URI. + */ + static getDataURL(image: (HTMLImageElement | HTMLCanvasElement), type?: string): string; + /** + * Converts the given sRGB image data to linear color space. + * + * @param {(HTMLImageElement|HTMLCanvasElement|ImageBitmap|Object)} image - The image object. + * @return {HTMLCanvasElement|Object} The converted image. + */ + static sRGBToLinear(image: (HTMLImageElement | HTMLCanvasElement | ImageBitmap | Object)): HTMLCanvasElement | Object; +} diff --git a/jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts b/jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts new file mode 100644 index 000000000..f306c169b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts @@ -0,0 +1,520 @@ +/** + * This class generates a Prefiltered, Mipmapped Radiance Environment Map + * (PMREM) from a cubeMap environment texture. This allows different levels of + * blur to be quickly accessed based on material roughness. It is packed into a + * special CubeUV format that allows us to perform custom interpolation so that + * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap + * chain, it only goes down to the LOD_MIN level (above), and then creates extra + * even more filtered 'mips' at the same LOD_MIN resolution, associated with + * higher roughness levels. In this way we maintain resolution to smoothly + * interpolate diffuse lighting while limiting sampling computation. + * + * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) + * importance sampling based on "Sampling the GGX Distribution of Visible Normals" + * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF + * used in material rendering for physically-based image-based lighting. + */ +export class PMREMGenerator { + /** + * Constructs a new PMREM generator. + * + * @param {WebGLRenderer} renderer - The renderer. + */ + constructor(renderer: WebGLRenderer); + _renderer: WebGLRenderer; + _pingPongRenderTarget: any; + _lodMax: number; + _cubeSize: number; + _sizeLods: any[]; + _lodMeshes: any[]; + _backgroundBox: Mesh | null; + _cubemapMaterial: { + readonly isShaderMaterial: boolean; + type: string; + defines: Object; + uniforms: Object; + uniformsGroups: Array; + vertexShader: string; + fragmentShader: string; + linewidth: number; + wireframe: boolean; + wireframeLinewidth: number; + fog: boolean; + lights: boolean; + clipping: boolean; + forceSinglePass: boolean; + extensions: { + clipCullDistance: false; + multiDraw: false; + }; + defaultAttributeValues: Object; + index0AttributeName: string | undefined; + uniformsNeedUpdate: boolean; + glslVersion: (GLSL1 | GLSL3) | null; + copy(source: any): /*elided*/ any; + toJSON(meta: any): Object; + fromJSON(json: Object, textures: { + [x: string]: Texture; + }): /*elided*/ any; + readonly isMaterial: boolean; + readonly uuid: string; + name: string; + blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); + side: (number | BackSide | DoubleSide); + vertexColors: boolean; + opacity: number; + transparent: boolean; + alphaHash: boolean; + blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); + blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; + blendColor: Color; + blendAlpha: number; + depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); + depthTest: boolean; + depthWrite: boolean; + stencilWriteMask: number; + stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; + stencilRef: number; + stencilFuncMask: number; + stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilWrite: boolean; + clippingPlanes: Array | null; + clipIntersection: boolean; + clipShadows: boolean; + shadowSide: (number | BackSide | DoubleSide) | null; + colorWrite: boolean; + precision: ("highp" | "mediump" | "lowp") | null; + polygonOffset: boolean; + polygonOffsetFactor: number; + polygonOffsetUnits: number; + dithering: boolean; + alphaToCoverage: boolean; + premultipliedAlpha: boolean; + allowOverride: boolean; + visible: boolean; + toneMapped: boolean; + userData: Object; + readonly version: number; + _alphaTest: number; + get alphaTest(): number; + set alphaTest(value: number); + onBeforeRender(): void; + onBeforeCompile(): void; + customProgramCacheKey(): string; + setValues(values?: Object): void; + clone(): Material; + dispose(): void; + set needsUpdate(value: boolean); + addEventListener(type: string, listener: Function): void; + _listeners: {} | undefined; + hasEventListener(type: string, listener: Function): boolean; + removeEventListener(type: string, listener: Function): void; + dispatchEvent(event: Object): void; + } | null; + _equirectMaterial: { + readonly isShaderMaterial: boolean; + type: string; + defines: Object; + uniforms: Object; + uniformsGroups: Array; + vertexShader: string; + fragmentShader: string; + linewidth: number; + wireframe: boolean; + wireframeLinewidth: number; + fog: boolean; + lights: boolean; + clipping: boolean; + forceSinglePass: boolean; + extensions: { + clipCullDistance: false; + multiDraw: false; + }; + defaultAttributeValues: Object; + index0AttributeName: string | undefined; + uniformsNeedUpdate: boolean; + glslVersion: (GLSL1 | GLSL3) | null; + copy(source: any): /*elided*/ any; + toJSON(meta: any): Object; + fromJSON(json: Object, textures: { + [x: string]: Texture; + }): /*elided*/ any; + readonly isMaterial: boolean; + readonly uuid: string; + name: string; + blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); + side: (number | BackSide | DoubleSide); + vertexColors: boolean; + opacity: number; + transparent: boolean; + alphaHash: boolean; + blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); + blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; + blendColor: Color; + blendAlpha: number; + depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); + depthTest: boolean; + depthWrite: boolean; + stencilWriteMask: number; + stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; + stencilRef: number; + stencilFuncMask: number; + stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilWrite: boolean; + clippingPlanes: Array | null; + clipIntersection: boolean; + clipShadows: boolean; + shadowSide: (number | BackSide | DoubleSide) | null; + colorWrite: boolean; + precision: ("highp" | "mediump" | "lowp") | null; + polygonOffset: boolean; + polygonOffsetFactor: number; + polygonOffsetUnits: number; + dithering: boolean; + alphaToCoverage: boolean; + premultipliedAlpha: boolean; + allowOverride: boolean; + visible: boolean; + toneMapped: boolean; + userData: Object; + readonly version: number; + _alphaTest: number; + get alphaTest(): number; + set alphaTest(value: number); + onBeforeRender(): void; + onBeforeCompile(): void; + customProgramCacheKey(): string; + setValues(values?: Object): void; + clone(): Material; + dispose(): void; + set needsUpdate(value: boolean); + addEventListener(type: string, listener: Function): void; + _listeners: {} | undefined; + hasEventListener(type: string, listener: Function): boolean; + removeEventListener(type: string, listener: Function): void; + dispatchEvent(event: Object): void; + } | null; + _blurMaterial: { + readonly isShaderMaterial: boolean; + type: string; + defines: Object; + uniforms: Object; + uniformsGroups: Array; + vertexShader: string; + fragmentShader: string; + linewidth: number; + wireframe: boolean; + wireframeLinewidth: number; + fog: boolean; + lights: boolean; + clipping: boolean; + forceSinglePass: boolean; + extensions: { + clipCullDistance: false; + multiDraw: false; + }; + defaultAttributeValues: Object; + index0AttributeName: string | undefined; + uniformsNeedUpdate: boolean; + glslVersion: (GLSL1 | GLSL3) | null; + copy(source: any): /*elided*/ any; + toJSON(meta: any): Object; + fromJSON(json: Object, textures: { + [x: string]: Texture; + }): /*elided*/ any; + readonly isMaterial: boolean; + readonly uuid: string; + name: string; + blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); + side: (number | BackSide | DoubleSide); + vertexColors: boolean; + opacity: number; + transparent: boolean; + alphaHash: boolean; + blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); + blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; + blendColor: Color; + blendAlpha: number; + depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); + depthTest: boolean; + depthWrite: boolean; + stencilWriteMask: number; + stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; + stencilRef: number; + stencilFuncMask: number; + stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilWrite: boolean; + clippingPlanes: Array | null; + clipIntersection: boolean; + clipShadows: boolean; + shadowSide: (number | BackSide | DoubleSide) | null; + colorWrite: boolean; + precision: ("highp" | "mediump" | "lowp") | null; + polygonOffset: boolean; + polygonOffsetFactor: number; + polygonOffsetUnits: number; + dithering: boolean; + alphaToCoverage: boolean; + premultipliedAlpha: boolean; + allowOverride: boolean; + visible: boolean; + toneMapped: boolean; + userData: Object; + readonly version: number; + _alphaTest: number; + get alphaTest(): number; + set alphaTest(value: number); + onBeforeRender(): void; + onBeforeCompile(): void; + customProgramCacheKey(): string; + setValues(values?: Object): void; + clone(): Material; + dispose(): void; + set needsUpdate(value: boolean); + addEventListener(type: string, listener: Function): void; + _listeners: {} | undefined; + hasEventListener(type: string, listener: Function): boolean; + removeEventListener(type: string, listener: Function): void; + dispatchEvent(event: Object): void; + } | null; + _ggxMaterial: { + readonly isShaderMaterial: boolean; + type: string; + defines: Object; + uniforms: Object; + uniformsGroups: Array; + vertexShader: string; + fragmentShader: string; + linewidth: number; + wireframe: boolean; + wireframeLinewidth: number; + fog: boolean; + lights: boolean; + clipping: boolean; + forceSinglePass: boolean; + extensions: { + clipCullDistance: false; + multiDraw: false; + }; + defaultAttributeValues: Object; + index0AttributeName: string | undefined; + uniformsNeedUpdate: boolean; + glslVersion: (GLSL1 | GLSL3) | null; + copy(source: any): /*elided*/ any; + toJSON(meta: any): Object; + fromJSON(json: Object, textures: { + [x: string]: Texture; + }): /*elided*/ any; + readonly isMaterial: boolean; + readonly uuid: string; + name: string; + blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); + side: (number | BackSide | DoubleSide); + vertexColors: boolean; + opacity: number; + transparent: boolean; + alphaHash: boolean; + blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); + blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; + blendColor: Color; + blendAlpha: number; + depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); + depthTest: boolean; + depthWrite: boolean; + stencilWriteMask: number; + stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; + stencilRef: number; + stencilFuncMask: number; + stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilWrite: boolean; + clippingPlanes: Array | null; + clipIntersection: boolean; + clipShadows: boolean; + shadowSide: (number | BackSide | DoubleSide) | null; + colorWrite: boolean; + precision: ("highp" | "mediump" | "lowp") | null; + polygonOffset: boolean; + polygonOffsetFactor: number; + polygonOffsetUnits: number; + dithering: boolean; + alphaToCoverage: boolean; + premultipliedAlpha: boolean; + allowOverride: boolean; + visible: boolean; + toneMapped: boolean; + userData: Object; + readonly version: number; + _alphaTest: number; + get alphaTest(): number; + set alphaTest(value: number); + onBeforeRender(): void; + onBeforeCompile(): void; + customProgramCacheKey(): string; + setValues(values?: Object): void; + clone(): Material; + dispose(): void; + set needsUpdate(value: boolean); + addEventListener(type: string, listener: Function): void; + _listeners: {} | undefined; + hasEventListener(type: string, listener: Function): boolean; + removeEventListener(type: string, listener: Function): void; + dispatchEvent(event: Object): void; + } | null; + /** + * Generates a PMREM from a supplied Scene, which can be faster than using an + * image if networking bandwidth is low. Optional sigma specifies a blur radius + * in radians to be applied to the scene before PMREM generation. Optional near + * and far planes ensure the scene is rendered in its entirety. + * + * @param {Scene} scene - The scene to be captured. + * @param {number} [sigma=0] - The blur radius in radians. + * @param {number} [near=0.1] - The near plane distance. + * @param {number} [far=100] - The far plane distance. + * @param {Object} [options={}] - The configuration options. + * @param {number} [options.size=256] - The texture size of the PMREM. + * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. + * @return {WebGLRenderTarget} The resulting PMREM. + */ + fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { + size?: number | undefined; + position?: Vector3 | undefined; + }): WebGLRenderTarget; + /** + * Generates a PMREM from an equirectangular texture, which can be either LDR + * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best + * with the 256 x 256 cubemap output. The minimum supported input image size + * is 64 x 32. + * + * @param {Texture} equirectangular - The equirectangular texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ + fromEquirectangular(equirectangular: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; + /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. + * @return {WebGLRenderTarget} The resulting PMREM. + */ + fromCubemap(cubemap: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; + /** + * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + */ + compileCubemapShader(): void; + /** + * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + */ + compileEquirectangularShader(): void; + /** + * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, + * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on + * one of them will cause any others to also become unusable. + */ + dispose(): void; + _setSize(cubeSize: any): void; + _dispose(): void; + _cleanup(outputTarget: any): void; + _fromTexture(texture: any, renderTarget: any): any; + _allocateTargets(): WebGLRenderTarget; + _compileMaterial(material: any): void; + _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; + _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; + _applyPMREM(cubeUVRenderTarget: any): void; + /** + * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. + * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the + * GGX BRDF for physically-based rendering. Reads from the previous LOD level and + * applies incremental roughness filtering to avoid over-blurring. + * + * @private + * @param {WebGLRenderTarget} cubeUVRenderTarget + * @param {number} lodIn - Source LOD level to read from + * @param {number} lodOut - Target LOD level to write to + */ + private _applyGGXFilter; + /** + * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples + * the Gaussian along a spiral kernel (Golden Angle), which distributes samples + * isotropically on the sphere (no pole artifacts). + * + * Used for initial scene blur in fromScene() method when sigma > 0. + * + * @private + * @param {WebGLRenderTarget} cubeUVRenderTarget + * @param {number} lodIn + * @param {number} lodOut + * @param {number} sigma + */ + private _blur; + _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; +} +import { Mesh } from '../objects/Mesh.js'; +import { Color } from '../math/Color.js'; +import { Vector3 } from '../math/Vector3.js'; +import { WebGLRenderTarget } from '../renderers/WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts new file mode 100644 index 000000000..333966c85 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts @@ -0,0 +1,29 @@ +/** + * A class containing utility functions for shapes. + * + * @hideconstructor + */ +export class ShapeUtils { + /** + * Calculate area of a ( 2D ) contour polygon. + * + * @param {Array} contour - An array of 2D points. + * @return {number} The area. + */ + static area(contour: Array): number; + /** + * Returns `true` if the given contour uses a clockwise winding order. + * + * @param {Array} pts - An array of 2D points defining a polygon. + * @return {boolean} Whether the given contour uses a clockwise winding order or not. + */ + static isClockWise(pts: Array): boolean; + /** + * Triangulates the given shape definition. + * + * @param {Array} contour - An array of 2D points defining the contour. + * @param {Array>} holes - An array that holds arrays of 2D points defining the holes. + * @return {Array>} An array that holds for each face definition an array with three indices. + */ + static triangulateShape(contour: Array, holes: Array>): Array>; +} diff --git a/jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts new file mode 100644 index 000000000..5de7a1677 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts @@ -0,0 +1,81 @@ +/** + * Scales the texture as large as possible within its surface without cropping + * or stretching the texture. The method preserves the original aspect ratio of + * the texture. Akin to CSS `object-fit: contain` + * + * @param {Texture} texture - The texture. + * @param {number} aspect - The texture's aspect ratio. + * @return {Texture} The updated texture. + */ +export function contain(texture: Texture, aspect: number): Texture; +/** + * Scales the texture to the smallest possible size to fill the surface, leaving + * no empty space. The method preserves the original aspect ratio of the texture. + * Akin to CSS `object-fit: cover`. + * + * @param {Texture} texture - The texture. + * @param {number} aspect - The texture's aspect ratio. + * @return {Texture} The updated texture. + */ +export function cover(texture: Texture, aspect: number): Texture; +/** + * Configures the texture to the default transformation. Akin to CSS `object-fit: fill`. + * + * @param {Texture} texture - The texture. + * @return {Texture} The updated texture. + */ +export function fill(texture: Texture): Texture; +/** + * Determines how many bytes must be used to represent the texture. + * + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} format - The texture's format. + * @param {number} type - The texture's type. + * @return {number} The byte length. + */ +export function getByteLength(width: number, height: number, format: number, type: number): number; +/** + * A class containing utility functions for textures. + * + * @hideconstructor + */ +export class TextureUtils { + /** + * Scales the texture as large as possible within its surface without cropping + * or stretching the texture. The method preserves the original aspect ratio of + * the texture. Akin to CSS `object-fit: contain` + * + * @param {Texture} texture - The texture. + * @param {number} aspect - The texture's aspect ratio. + * @return {Texture} The updated texture. + */ + static contain(texture: Texture, aspect: number): Texture; + /** + * Scales the texture to the smallest possible size to fill the surface, leaving + * no empty space. The method preserves the original aspect ratio of the texture. + * Akin to CSS `object-fit: cover`. + * + * @param {Texture} texture - The texture. + * @param {number} aspect - The texture's aspect ratio. + * @return {Texture} The updated texture. + */ + static cover(texture: Texture, aspect: number): Texture; + /** + * Configures the texture to the default transformation. Akin to CSS `object-fit: fill`. + * + * @param {Texture} texture - The texture. + * @return {Texture} The updated texture. + */ + static fill(texture: Texture): Texture; + /** + * Determines how many bytes must be used to represent the texture. + * + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} format - The texture's format. + * @param {number} type - The texture's type. + * @return {number} The byte length. + */ + static getByteLength(width: number, height: number, format: number, type: number): number; +} diff --git a/jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts new file mode 100644 index 000000000..ff7e9b470 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts @@ -0,0 +1,170 @@ +/** + * An abstract base class for creating an analytic curve object that contains methods + * for interpolation. + * + * @abstract + */ +export class Curve { + /** + * The type property is used for detecting the object type + * in context of serialization/deserialization. + * + * @type {string} + * @readonly + */ + readonly type: string; + /** + * This value determines the amount of divisions when calculating the + * cumulative segment lengths of a curve via {@link Curve#getLengths}. To ensure + * precision when using methods like {@link Curve#getSpacedPoints}, it is + * recommended to increase the value of this property if the curve is very large. + * + * @type {number} + * @default 200 + */ + arcLengthDivisions: number; + /** + * Must be set to `true` if the curve parameters have changed. + * + * @type {boolean} + * @default false + */ + needsUpdate: boolean; + /** + * An internal cache that holds precomputed curve length values. + * + * @private + * @type {?Array} + * @default null + */ + private cacheArcLengths; + /** + * This method returns a vector in 2D or 3D space (depending on the curve definition) + * for the given interpolation factor. + * + * @abstract + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. + * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition. + */ + getPoint(): (Vector2 | Vector3); + /** + * This method returns a vector in 2D or 3D space (depending on the curve definition) + * for the given interpolation factor. Unlike {@link Curve#getPoint}, this method honors the length + * of the curve which equidistant samples. + * + * @param {number} u - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. + * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition. + */ + getPointAt(u: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3); + /** + * This method samples the curve via {@link Curve#getPoint} and returns an array of points representing + * the curve shape. + * + * @param {number} [divisions=5] - The number of divisions. + * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`. + */ + getPoints(divisions?: number): Array<(Vector2 | Vector3)>; + /** + * This method samples the curve via {@link Curve#getPointAt} and returns an array of points representing + * the curve shape. Unlike {@link Curve#getPoints}, this method returns equi-spaced points across the entire + * curve. + * + * @param {number} [divisions=5] - The number of divisions. + * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`. + */ + getSpacedPoints(divisions?: number): Array<(Vector2 | Vector3)>; + /** + * Returns the total arc length of the curve. + * + * @return {number} The length of the curve. + */ + getLength(): number; + /** + * Returns an array of cumulative segment lengths of the curve. + * + * @param {number} [divisions=this.arcLengthDivisions] - The number of divisions. + * @return {Array} An array holding the cumulative segment lengths. + */ + getLengths(divisions?: number): Array; + /** + * Update the cumulative segment distance cache. The method must be called + * every time curve parameters are changed. If an updated curve is part of a + * composed curve like {@link CurvePath}, this method must be called on the + * composed curve, too. + */ + updateArcLengths(): void; + /** + * Given an interpolation factor in the range `[0,1]`, this method returns an updated + * interpolation factor in the same range that can be ued to sample equidistant points + * from a curve. + * + * @param {number} u - The interpolation factor. + * @param {?number} distance - An optional distance on the curve. + * @return {number} The updated interpolation factor. + */ + getUtoTmapping(u: number, distance?: number | null): number; + /** + * Returns a unit vector tangent for the given interpolation factor. + * If the derived curve does not implement its tangent derivation, + * two points a small delta apart will be used to find its gradient + * which seems to give a reasonable approximation. + * + * @param {number} t - The interpolation factor. + * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. + * @return {(Vector2|Vector3)} The tangent vector. + */ + getTangent(t: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3); + /** + * Same as {@link Curve#getTangent} but with equidistant samples. + * + * @param {number} u - The interpolation factor. + * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. + * @return {(Vector2|Vector3)} The tangent vector. + * @see {@link Curve#getPointAt} + */ + getTangentAt(u: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3); + /** + * Generates the Frenet Frames. Requires a curve definition in 3D space. Used + * in geometries like {@link TubeGeometry} or {@link ExtrudeGeometry}. + * + * @param {number} segments - The number of segments. + * @param {boolean} [closed=false] - Whether the curve is closed or not. + * @return {{tangents: Array, normals: Array, binormals: Array}} The Frenet Frames. + */ + computeFrenetFrames(segments: number, closed?: boolean): { + tangents: Array; + normals: Array; + binormals: Array; + }; + /** + * Returns a new curve with copied values from this instance. + * + * @return {Curve} A clone of this instance. + */ + clone(): Curve; + /** + * Copies the values of the given curve to this instance. + * + * @param {Curve} source - The curve to copy. + * @return {Curve} A reference to this curve. + */ + copy(source: Curve): Curve; + /** + * Serializes the curve into JSON. + * + * @return {Object} A JSON object representing the serialized curve. + * @see {@link ObjectLoader#parse} + */ + toJSON(): Object; + /** + * Deserializes the curve from the given JSON. + * + * @param {Object} json - The JSON holding the serialized curve. + * @return {Curve} A reference to this curve. + */ + fromJSON(json: Object): Curve; +} +import { Vector2 } from '../../math/Vector2.js'; +import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts b/jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts new file mode 100644 index 000000000..a92079be5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts @@ -0,0 +1,56 @@ +/** + * A base class extending {@link Curve}. `CurvePath` is simply an + * array of connected curves, but retains the API of a curve. + * + * @augments Curve + */ +export class CurvePath extends Curve { + type: string; + /** + * An array of curves defining the + * path. + * + * @type {Array} + */ + curves: Array; + /** + * Whether the path should automatically be closed + * by a line curve. + * + * @type {boolean} + * @default false + */ + autoClose: boolean; + /** + * Adds a curve to this curve path. + * + * @param {Curve} curve - The curve to add. + */ + add(curve: Curve): void; + /** + * Adds a line curve to close the path. + * + * @return {CurvePath} A reference to this curve path. + */ + closePath(): CurvePath; + /** + * This method returns a vector in 2D or 3D space (depending on the curve definitions) + * for the given interpolation factor. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. + * @return {?(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition. + */ + getPoint(t: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3) | null; + cacheLengths: number[] | null | undefined; + /** + * Returns list of cumulative curve lengths of the defined curves. + * + * @return {Array} The curve lengths. + */ + getCurveLengths(): Array; + getSpacedPoints(divisions?: number): any[]; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from './Curve.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts new file mode 100644 index 000000000..aa80afbc8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts @@ -0,0 +1,39 @@ +/** + * Interpolations contains spline and Bézier functions internally used by concrete curve classes. + * + * Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier_curve + * + * @module Interpolations + */ +/** + * Computes a point on a Catmull-Rom spline. + * + * @param {number} t - The interpolation factor. + * @param {number} p0 - The first control point. + * @param {number} p1 - The second control point. + * @param {number} p2 - The third control point. + * @param {number} p3 - The fourth control point. + * @return {number} The calculated point on a Catmull-Rom spline. + */ +export function CatmullRom(t: number, p0: number, p1: number, p2: number, p3: number): number; +/** + * Computes a point on a Quadratic Bezier curve. + * + * @param {number} t - The interpolation factor. + * @param {number} p0 - The first control point. + * @param {number} p1 - The second control point. + * @param {number} p2 - The third control point. + * @return {number} The calculated point on a Quadratic Bezier curve. + */ +export function QuadraticBezier(t: number, p0: number, p1: number, p2: number): number; +/** + * Computes a point on a Cubic Bezier curve. + * + * @param {number} t - The interpolation factor. + * @param {number} p0 - The first control point. + * @param {number} p1 - The second control point. + * @param {number} p2 - The third control point. + * @param {number} p3 - The fourth control point. + * @return {number} The calculated point on a Cubic Bezier curve. + */ +export function CubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number; diff --git a/jsdoc-testing/jsdoc/src/extras/core/Path.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Path.d.ts new file mode 100644 index 000000000..521287532 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/core/Path.d.ts @@ -0,0 +1,151 @@ +/** + * A 2D path representation. The class provides methods for creating paths + * and contours of 2D shapes similar to the 2D Canvas API. + * + * ```js + * const path = new THREE.Path(); + * + * path.lineTo( 0, 0.8 ); + * path.quadraticCurveTo( 0, 1, 0.2, 1 ); + * path.lineTo( 1, 1 ); + * + * const points = path.getPoints(); + * + * const geometry = new THREE.BufferGeometry().setFromPoints( points ); + * const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); + * + * const line = new THREE.Line( geometry, material ); + * scene.add( line ); + * ``` + * + * @augments CurvePath + */ +export class Path extends CurvePath { + /** + * Constructs a new path. + * + * @param {Array} [points] - An array of 2D points defining the path. + */ + constructor(points?: Array); + /** + * The current offset of the path. Any new curve added will start here. + * + * @type {Vector2} + */ + currentPoint: Vector2; + /** + * Creates a path from the given list of points. The points are added + * to the path as instances of {@link LineCurve}. + * + * @param {Array} points - An array of 2D points. + * @return {Path} A reference to this path. + */ + setFromPoints(points: Array): Path; + /** + * Moves {@link Path#currentPoint} to the given point. + * + * @param {number} x - The x coordinate. + * @param {number} y - The y coordinate. + * @return {Path} A reference to this path. + */ + moveTo(x: number, y: number): Path; + /** + * Adds an instance of {@link LineCurve} to the path by connecting + * the current point with the given one. + * + * @param {number} x - The x coordinate of the end point. + * @param {number} y - The y coordinate of the end point. + * @return {Path} A reference to this path. + */ + lineTo(x: number, y: number): Path; + /** + * Adds an instance of {@link QuadraticBezierCurve} to the path by connecting + * the current point with the given one. + * + * @param {number} aCPx - The x coordinate of the control point. + * @param {number} aCPy - The y coordinate of the control point. + * @param {number} aX - The x coordinate of the end point. + * @param {number} aY - The y coordinate of the end point. + * @return {Path} A reference to this path. + */ + quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): Path; + /** + * Adds an instance of {@link CubicBezierCurve} to the path by connecting + * the current point with the given one. + * + * @param {number} aCP1x - The x coordinate of the first control point. + * @param {number} aCP1y - The y coordinate of the first control point. + * @param {number} aCP2x - The x coordinate of the second control point. + * @param {number} aCP2y - The y coordinate of the second control point. + * @param {number} aX - The x coordinate of the end point. + * @param {number} aY - The y coordinate of the end point. + * @return {Path} A reference to this path. + */ + bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): Path; + /** + * Adds an instance of {@link SplineCurve} to the path by connecting + * the current point with the given list of points. + * + * @param {Array} pts - An array of points in 2D space. + * @return {Path} A reference to this path. + */ + splineThru(pts: Array): Path; + /** + * Adds an arc as an instance of {@link EllipseCurve} to the path, positioned relative + * to the current point. + * + * @param {number} [aX=0] - The x coordinate of the center of the arc offsetted from the previous curve. + * @param {number} [aY=0] - The y coordinate of the center of the arc offsetted from the previous curve. + * @param {number} [aRadius=1] - The radius of the arc. + * @param {number} [aStartAngle=0] - The start angle in radians. + * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. + * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not. + * @return {Path} A reference to this path. + */ + arc(aX?: number, aY?: number, aRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean): Path; + /** + * Adds an absolutely positioned arc as an instance of {@link EllipseCurve} to the path. + * + * @param {number} [aX=0] - The x coordinate of the center of the arc. + * @param {number} [aY=0] - The y coordinate of the center of the arc. + * @param {number} [aRadius=1] - The radius of the arc. + * @param {number} [aStartAngle=0] - The start angle in radians. + * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. + * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not. + * @return {Path} A reference to this path. + */ + absarc(aX?: number, aY?: number, aRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean): Path; + /** + * Adds an ellipse as an instance of {@link EllipseCurve} to the path, positioned relative + * to the current point + * + * @param {number} [aX=0] - The x coordinate of the center of the ellipse offsetted from the previous curve. + * @param {number} [aY=0] - The y coordinate of the center of the ellipse offsetted from the previous curve. + * @param {number} [xRadius=1] - The radius of the ellipse in the x axis. + * @param {number} [yRadius=1] - The radius of the ellipse in the y axis. + * @param {number} [aStartAngle=0] - The start angle in radians. + * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. + * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not. + * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + * @return {Path} A reference to this path. + */ + ellipse(aX?: number, aY?: number, xRadius?: number, yRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean, aRotation?: number): Path; + /** + * Adds an absolutely positioned ellipse as an instance of {@link EllipseCurve} to the path. + * + * @param {number} [aX=0] - The x coordinate of the absolute center of the ellipse. + * @param {number} [aY=0] - The y coordinate of the absolute center of the ellipse. + * @param {number} [xRadius=1] - The radius of the ellipse in the x axis. + * @param {number} [yRadius=1] - The radius of the ellipse in the y axis. + * @param {number} [aStartAngle=0] - The start angle in radians. + * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. + * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not. + * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + * @return {Path} A reference to this path. + */ + absellipse(aX?: number, aY?: number, xRadius?: number, yRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean, aRotation?: number): Path; + copy(source: any): this; + fromJSON(json: any): this; +} +import { CurvePath } from './CurvePath.js'; +import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts new file mode 100644 index 000000000..056fdb610 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts @@ -0,0 +1,76 @@ +/** + * Defines an arbitrary 2d shape plane using paths with optional holes. It + * can be used with {@link ExtrudeGeometry}, {@link ShapeGeometry}, to get + * points, or to get triangulated faces. + * + * ```js + * const heartShape = new THREE.Shape(); + * + * heartShape.moveTo( 25, 25 ); + * heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 ); + * heartShape.bezierCurveTo( - 30, 0, - 30, 35, - 30, 35 ); + * heartShape.bezierCurveTo( - 30, 55, - 10, 77, 25, 95 ); + * heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 ); + * heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 ); + * heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 ); + * + * const extrudeSettings = { + * depth: 8, + * bevelEnabled: true, + * bevelSegments: 2, + * steps: 2, + * bevelSize: 1, + * bevelThickness: 1 + * }; + * + * const geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings ); + * const mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial() ); + * ``` + * + * @augments Path + */ +export class Shape extends Path { + /** + * Constructs a new shape. + * + * @param {Array} [points] - An array of 2D points defining the shape. + */ + constructor(points?: Array); + /** + * The UUID of the shape. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * Defines the holes in the shape. Hole definitions must use the + * opposite winding order (CW/CCW) than the outer shape. + * + * @type {Array} + * @readonly + */ + readonly holes: Array; + /** + * Returns an array representing each contour of the holes + * as a list of 2D points. + * + * @param {number} divisions - The fineness of the result. + * @return {Array>} The holes as a series of 2D points. + */ + getPointsHoles(divisions: number): Array>; + /** + * Returns an object that holds contour data for the shape and its holes as + * arrays of 2D points. + * + * @param {number} divisions - The fineness of the result. + * @return {{shape:Array,holes:Array>}} An object with contour data. + */ + extractPoints(divisions: number): { + shape: Array; + holes: Array>; + }; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Path } from './Path.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts b/jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts new file mode 100644 index 000000000..04032cbd6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts @@ -0,0 +1,93 @@ +/** + * This class is used to convert a series of paths to an array of + * shapes. It is specifically used in context of fonts and SVG. + */ +export class ShapePath { + type: string; + /** + * The color of the shape. + * + * @type {Color} + */ + color: Color; + /** + * The paths that have been generated for this shape. + * + * @type {Array} + * @default null + */ + subPaths: Array; + /** + * The current path that is being generated. + * + * @type {?Path} + * @default null + */ + currentPath: Path | null; + /** + * An object that can be used to store custom data about the shape path. + * Mainly used by SVGLoader to store style information. + * + * @type {Object} + */ + userData: Object; + /** + * Creates a new path and moves it current point to the given one. + * + * @param {number} x - The x coordinate. + * @param {number} y - The y coordinate. + * @return {ShapePath} A reference to this shape path. + */ + moveTo(x: number, y: number): ShapePath; + /** + * Adds an instance of {@link LineCurve} to the path by connecting + * the current point with the given one. + * + * @param {number} x - The x coordinate of the end point. + * @param {number} y - The y coordinate of the end point. + * @return {ShapePath} A reference to this shape path. + */ + lineTo(x: number, y: number): ShapePath; + /** + * Adds an instance of {@link QuadraticBezierCurve} to the path by connecting + * the current point with the given one. + * + * @param {number} aCPx - The x coordinate of the control point. + * @param {number} aCPy - The y coordinate of the control point. + * @param {number} aX - The x coordinate of the end point. + * @param {number} aY - The y coordinate of the end point. + * @return {ShapePath} A reference to this shape path. + */ + quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): ShapePath; + /** + * Adds an instance of {@link CubicBezierCurve} to the path by connecting + * the current point with the given one. + * + * @param {number} aCP1x - The x coordinate of the first control point. + * @param {number} aCP1y - The y coordinate of the first control point. + * @param {number} aCP2x - The x coordinate of the second control point. + * @param {number} aCP2y - The y coordinate of the second control point. + * @param {number} aX - The x coordinate of the end point. + * @param {number} aY - The y coordinate of the end point. + * @return {ShapePath} A reference to this shape path. + */ + bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): ShapePath; + /** + * Adds an instance of {@link SplineCurve} to the path by connecting + * the current point with the given list of points. + * + * @param {Array} pts - An array of points in 2D space. + * @return {ShapePath} A reference to this shape path. + */ + splineThru(pts: Array): ShapePath; + /** + * Converts the paths into an array of shapes. + * + * @return {Array} An array of shapes. + */ + toShapes(): Array; +} +import { Color } from '../../math/Color.js'; +import { Path } from './Path.js'; +import { Vector2 } from '../../math/Vector2.js'; +import { Shape } from './Shape.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts new file mode 100644 index 000000000..3ae4feae2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts @@ -0,0 +1,27 @@ +/** + * A curve representing an arc. + * + * @augments EllipseCurve + */ +export class ArcCurve extends EllipseCurve { + /** + * Constructs a new arc curve. + * + * @param {number} [aX=0] - The X center of the ellipse. + * @param {number} [aY=0] - The Y center of the ellipse. + * @param {number} [aRadius=1] - The radius of the ellipse in the x direction. + * @param {number} [aStartAngle=0] - The start angle of the curve in radians starting from the positive X axis. + * @param {number} [aEndAngle=Math.PI*2] - The end angle of the curve in radians starting from the positive X axis. + * @param {boolean} [aClockwise=false] - Whether the ellipse is drawn clockwise or not. + */ + constructor(aX?: number, aY?: number, aRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArcCurve: boolean; +} +import { EllipseCurve } from './EllipseCurve.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts new file mode 100644 index 000000000..8798e6d39 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts @@ -0,0 +1,83 @@ +/** + * A curve representing a Catmull-Rom spline. + * + * ```js + * //Create a closed wavey loop + * const curve = new THREE.CatmullRomCurve3( [ + * new THREE.Vector3( -10, 0, 10 ), + * new THREE.Vector3( -5, 5, 5 ), + * new THREE.Vector3( 0, 0, 0 ), + * new THREE.Vector3( 5, -5, 5 ), + * new THREE.Vector3( 10, 0, 10 ) + * ] ); + * + * const points = curve.getPoints( 50 ); + * const geometry = new THREE.BufferGeometry().setFromPoints( points ); + * + * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); + * + * // Create the final object to add to the scene + * const curveObject = new THREE.Line( geometry, material ); + * ``` + * + * @augments Curve + */ +export class CatmullRomCurve3 extends Curve { + /** + * Constructs a new Catmull-Rom curve. + * + * @param {Array} [points] - An array of 3D points defining the curve. + * @param {boolean} [closed=false] - Whether the curve is closed or not. + * @param {('centripetal'|'chordal'|'catmullrom')} [curveType='centripetal'] - The curve type. + * @param {number} [tension=0.5] - Tension of the curve. + */ + constructor(points?: Array, closed?: boolean, curveType?: ("centripetal" | "chordal" | "catmullrom"), tension?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCatmullRomCurve3: boolean; + type: string; + /** + * An array of 3D points defining the curve. + * + * @type {Array} + */ + points: Array; + /** + * Whether the curve is closed or not. + * + * @type {boolean} + * @default false + */ + closed: boolean; + /** + * The curve type. + * + * @type {('centripetal'|'chordal'|'catmullrom')} + * @default 'centripetal' + */ + curveType: ("centripetal" | "chordal" | "catmullrom"); + /** + * Tension of the curve. + * + * @type {number} + * @default 0.5 + */ + tension: number; + /** + * Returns a point on the curve. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts new file mode 100644 index 000000000..434713a9f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts @@ -0,0 +1,78 @@ +/** + * A curve representing a 2D Cubic Bezier curve. + * + * ```js + * const curve = new THREE.CubicBezierCurve( + * new THREE.Vector2( - 0, 0 ), + * new THREE.Vector2( - 5, 15 ), + * new THREE.Vector2( 20, 15 ), + * new THREE.Vector2( 10, 0 ) + * ); + * + * const points = curve.getPoints( 50 ); + * const geometry = new THREE.BufferGeometry().setFromPoints( points ); + * + * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); + * + * // Create the final object to add to the scene + * const curveObject = new THREE.Line( geometry, material ); + * ``` + * + * @augments Curve + */ +export class CubicBezierCurve extends Curve { + /** + * Constructs a new Cubic Bezier curve. + * + * @param {Vector2} [v0] - The start point. + * @param {Vector2} [v1] - The first control point. + * @param {Vector2} [v2] - The second control point. + * @param {Vector2} [v3] - The end point. + */ + constructor(v0?: Vector2, v1?: Vector2, v2?: Vector2, v3?: Vector2); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubicBezierCurve: boolean; + type: string; + /** + * The start point. + * + * @type {Vector2} + */ + v0: Vector2; + /** + * The first control point. + * + * @type {Vector2} + */ + v1: Vector2; + /** + * The second control point. + * + * @type {Vector2} + */ + v2: Vector2; + /** + * The end point. + * + * @type {Vector2} + */ + v3: Vector2; + /** + * Returns a point on the curve. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector2} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector2): Vector2; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts new file mode 100644 index 000000000..ccc99379e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts @@ -0,0 +1,61 @@ +/** + * A curve representing a 3D Cubic Bezier curve. + * + * @augments Curve + */ +export class CubicBezierCurve3 extends Curve { + /** + * Constructs a new Cubic Bezier curve. + * + * @param {Vector3} [v0] - The start point. + * @param {Vector3} [v1] - The first control point. + * @param {Vector3} [v2] - The second control point. + * @param {Vector3} [v3] - The end point. + */ + constructor(v0?: Vector3, v1?: Vector3, v2?: Vector3, v3?: Vector3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubicBezierCurve3: boolean; + type: string; + /** + * The start point. + * + * @type {Vector3} + */ + v0: Vector3; + /** + * The first control point. + * + * @type {Vector3} + */ + v1: Vector3; + /** + * The second control point. + * + * @type {Vector3} + */ + v2: Vector3; + /** + * The end point. + * + * @type {Vector3} + */ + v3: Vector3; + /** + * Returns a point on the curve. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts new file mode 100644 index 000000000..ce726ca5a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts @@ -0,0 +1,10 @@ +export { ArcCurve } from "./ArcCurve.js"; +export { CatmullRomCurve3 } from "./CatmullRomCurve3.js"; +export { CubicBezierCurve } from "./CubicBezierCurve.js"; +export { CubicBezierCurve3 } from "./CubicBezierCurve3.js"; +export { EllipseCurve } from "./EllipseCurve.js"; +export { LineCurve } from "./LineCurve.js"; +export { LineCurve3 } from "./LineCurve3.js"; +export { QuadraticBezierCurve } from "./QuadraticBezierCurve.js"; +export { QuadraticBezierCurve3 } from "./QuadraticBezierCurve3.js"; +export { SplineCurve } from "./SplineCurve.js"; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts new file mode 100644 index 000000000..4080dab88 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts @@ -0,0 +1,117 @@ +/** + * A curve representing an ellipse. + * + * ```js + * const curve = new THREE.EllipseCurve( + * 0, 0, + * 10, 10, + * 0, 2 * Math.PI, + * false, + * 0 + * ); + * + * const points = curve.getPoints( 50 ); + * const geometry = new THREE.BufferGeometry().setFromPoints( points ); + * + * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); + * + * // Create the final object to add to the scene + * const ellipse = new THREE.Line( geometry, material ); + * ``` + * + * @augments Curve + */ +export class EllipseCurve extends Curve { + /** + * Constructs a new ellipse curve. + * + * @param {number} [aX=0] - The X center of the ellipse. + * @param {number} [aY=0] - The Y center of the ellipse. + * @param {number} [xRadius=1] - The radius of the ellipse in the x direction. + * @param {number} [yRadius=1] - The radius of the ellipse in the y direction. + * @param {number} [aStartAngle=0] - The start angle of the curve in radians starting from the positive X axis. + * @param {number} [aEndAngle=Math.PI*2] - The end angle of the curve in radians starting from the positive X axis. + * @param {boolean} [aClockwise=false] - Whether the ellipse is drawn clockwise or not. + * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + */ + constructor(aX?: number, aY?: number, xRadius?: number, yRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean, aRotation?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isEllipseCurve: boolean; + type: string; + /** + * The X center of the ellipse. + * + * @type {number} + * @default 0 + */ + aX: number; + /** + * The Y center of the ellipse. + * + * @type {number} + * @default 0 + */ + aY: number; + /** + * The radius of the ellipse in the x direction. + * Setting the this value equal to the {@link EllipseCurve#yRadius} will result in a circle. + * + * @type {number} + * @default 1 + */ + xRadius: number; + /** + * The radius of the ellipse in the y direction. + * Setting the this value equal to the {@link EllipseCurve#xRadius} will result in a circle. + * + * @type {number} + * @default 1 + */ + yRadius: number; + /** + * The start angle of the curve in radians starting from the positive X axis. + * + * @type {number} + * @default 0 + */ + aStartAngle: number; + /** + * The end angle of the curve in radians starting from the positive X axis. + * + * @type {number} + * @default Math.PI*2 + */ + aEndAngle: number; + /** + * Whether the ellipse is drawn clockwise or not. + * + * @type {boolean} + * @default false + */ + aClockwise: boolean; + /** + * The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. + * + * @type {number} + * @default 0 + */ + aRotation: number; + /** + * Returns a point on the curve. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector2} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector2): Vector2; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts new file mode 100644 index 000000000..3a0f08206 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts @@ -0,0 +1,50 @@ +/** + * A curve representing a 2D line segment. + * + * @augments Curve + */ +export class LineCurve extends Curve { + /** + * Constructs a new line curve. + * + * @param {Vector2} [v1] - The start point. + * @param {Vector2} [v2] - The end point. + */ + constructor(v1?: Vector2, v2?: Vector2); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineCurve: boolean; + type: string; + /** + * The start point. + * + * @type {Vector2} + */ + v1: Vector2; + /** + * The end point. + * + * @type {Vector2} + */ + v2: Vector2; + /** + * Returns a point on the line. + * + * @param {number} t - A interpolation factor representing a position on the line. Must be in the range `[0,1]`. + * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector2} The position on the line. + */ + getPoint(t: number, optionalTarget?: Vector2): Vector2; + getPointAt(u: any, optionalTarget: any): Vector2; + getTangent(t: any, optionalTarget?: Vector2): Vector2; + getTangentAt(u: any, optionalTarget: any): Vector2; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts new file mode 100644 index 000000000..5f03eb30d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts @@ -0,0 +1,50 @@ +/** + * A curve representing a 3D line segment. + * + * @augments Curve + */ +export class LineCurve3 extends Curve { + /** + * Constructs a new line curve. + * + * @param {Vector3} [v1] - The start point. + * @param {Vector3} [v2] - The end point. + */ + constructor(v1?: Vector3, v2?: Vector3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineCurve3: boolean; + type: string; + /** + * The start point. + * + * @type {Vector3} + */ + v1: Vector3; + /** + * The end point. + * + * @type {Vector2} + */ + v2: Vector2; + /** + * Returns a point on the line. + * + * @param {number} t - A interpolation factor representing a position on the line. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the line. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; + getPointAt(u: any, optionalTarget: any): Vector3; + getTangent(t: any, optionalTarget?: Vector3): Vector3; + getTangentAt(u: any, optionalTarget: any): Vector3; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts new file mode 100644 index 000000000..d123a23b5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts @@ -0,0 +1,70 @@ +/** + * A curve representing a 2D Quadratic Bezier curve. + * + * ```js + * const curve = new THREE.QuadraticBezierCurve( + * new THREE.Vector2( - 10, 0 ), + * new THREE.Vector2( 20, 15 ), + * new THREE.Vector2( 10, 0 ) + * ) + * + * const points = curve.getPoints( 50 ); + * const geometry = new THREE.BufferGeometry().setFromPoints( points ); + * + * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); + * + * // Create the final object to add to the scene + * const curveObject = new THREE.Line( geometry, material ); + * ``` + * + * @augments Curve + */ +export class QuadraticBezierCurve extends Curve { + /** + * Constructs a new Quadratic Bezier curve. + * + * @param {Vector2} [v0] - The start point. + * @param {Vector2} [v1] - The control point. + * @param {Vector2} [v2] - The end point. + */ + constructor(v0?: Vector2, v1?: Vector2, v2?: Vector2); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isQuadraticBezierCurve: boolean; + type: string; + /** + * The start point. + * + * @type {Vector2} + */ + v0: Vector2; + /** + * The control point. + * + * @type {Vector2} + */ + v1: Vector2; + /** + * The end point. + * + * @type {Vector2} + */ + v2: Vector2; + /** + * Returns a point on the curve. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector2} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector2): Vector2; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts new file mode 100644 index 000000000..5166fe270 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts @@ -0,0 +1,54 @@ +/** + * A curve representing a 3D Quadratic Bezier curve. + * + * @augments Curve + */ +export class QuadraticBezierCurve3 extends Curve { + /** + * Constructs a new Quadratic Bezier curve. + * + * @param {Vector3} [v0] - The start point. + * @param {Vector3} [v1] - The control point. + * @param {Vector3} [v2] - The end point. + */ + constructor(v0?: Vector3, v1?: Vector3, v2?: Vector3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isQuadraticBezierCurve3: boolean; + type: string; + /** + * The start point. + * + * @type {Vector3} + */ + v0: Vector3; + /** + * The control point. + * + * @type {Vector3} + */ + v1: Vector3; + /** + * The end point. + * + * @type {Vector3} + */ + v2: Vector3; + /** + * Returns a point on the curve. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector3} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector3): Vector3; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts new file mode 100644 index 000000000..10e62e17d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts @@ -0,0 +1,59 @@ +/** + * A curve representing a 2D spline curve. + * + * ```js + * // Create a sine-like wave + * const curve = new THREE.SplineCurve( [ + * new THREE.Vector2( -10, 0 ), + * new THREE.Vector2( -5, 5 ), + * new THREE.Vector2( 0, 0 ), + * new THREE.Vector2( 5, -5 ), + * new THREE.Vector2( 10, 0 ) + * ] ); + * + * const points = curve.getPoints( 50 ); + * const geometry = new THREE.BufferGeometry().setFromPoints( points ); + * + * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); + * + * // Create the final object to add to the scene + * const splineObject = new THREE.Line( geometry, material ); + * ``` + * + * @augments Curve + */ +export class SplineCurve extends Curve { + /** + * Constructs a new 2D spline curve. + * + * @param {Array} [points] - An array of 2D points defining the curve. + */ + constructor(points?: Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSplineCurve: boolean; + type: string; + /** + * An array of 2D points defining the curve. + * + * @type {Array} + */ + points: Array; + /** + * Returns a point on the curve. + * + * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. + * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. + * @return {Vector2} The position on the curve. + */ + getPoint(t: number, optionalTarget?: Vector2): Vector2; + copy(source: any): this; + fromJSON(json: any): this; +} +import { Curve } from '../core/Curve.js'; +import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts b/jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts new file mode 100644 index 000000000..8cf03b1bf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts @@ -0,0 +1,7 @@ +export default function earcut(data: any, holeIndices: any, dim?: number): any[]; +export function deviation(data: any, holeIndices: any, dim: any, triangles: any): number; +export function flatten(data: any): { + vertices: any[]; + holes: number[]; + dimensions: any; +}; diff --git a/jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts new file mode 100644 index 000000000..36fb50dad --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts @@ -0,0 +1,46 @@ +/** + * A geometry class for a rectangular cuboid with a given width, height, and depth. + * On creation, the cuboid is centred on the origin, with each edge parallel to one + * of the axes. + * + * ```js + * const geometry = new THREE.BoxGeometry( 1, 1, 1 ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const cube = new THREE.Mesh( geometry, material ); + * scene.add( cube ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#BoxGeometry + */ +export class BoxGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {BoxGeometry} A new instance. + */ + static fromJSON(data: Object): BoxGeometry; + /** + * Constructs a new box geometry. + * + * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis. + * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis. + * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis. + * @param {number} [widthSegments=1] - Number of segmented rectangular faces along the width of the sides. + * @param {number} [heightSegments=1] - Number of segmented rectangular faces along the height of the sides. + * @param {number} [depthSegments=1] - Number of segmented rectangular faces along the depth of the sides. + */ + constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts new file mode 100644 index 000000000..207ba310c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts @@ -0,0 +1,43 @@ +/** + * A geometry class for representing a capsule. + * + * ```js + * const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8, 1 ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const capsule = new THREE.Mesh( geometry, material ); + * scene.add( capsule ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#CapsuleGeometry + */ +export class CapsuleGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {CapsuleGeometry} A new instance. + */ + static fromJSON(data: Object): CapsuleGeometry; + /** + * Constructs a new capsule geometry. + * + * @param {number} [radius=1] - Radius of the capsule. + * @param {number} [height=1] - Height of the middle section. + * @param {number} [capSegments=4] - Number of curve segments used to build each cap. + * @param {number} [radialSegments=8] - Number of segmented faces around the circumference of the capsule. Must be an integer >= 3. + * @param {number} [heightSegments=1] - Number of rows of faces along the height of the middle section. Must be an integer >= 1. + */ + constructor(radius?: number, height?: number, capSegments?: number, radialSegments?: number, heightSegments?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts new file mode 100644 index 000000000..964d89897 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts @@ -0,0 +1,48 @@ +/** + * A simple shape of Euclidean geometry. It is constructed from a + * number of triangular segments that are oriented around a central point and + * extend as far out as a given radius. It is built counter-clockwise from a + * start angle and a given central angle. It can also be used to create + * regular polygons, where the number of segments determines the number of + * sides. + * + * ```js + * const geometry = new THREE.CircleGeometry( 5, 32 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const circle = new THREE.Mesh( geometry, material ); + * scene.add( circle ) + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#CircleGeometry + */ +export class CircleGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {CircleGeometry} A new instance. + */ + static fromJSON(data: Object): CircleGeometry; + /** + * Constructs a new circle geometry. + * + * @param {number} [radius=1] - Radius of the circle. + * @param {number} [segments=32] - Number of segments (triangles), minimum = `3`. + * @param {number} [thetaStart=0] - Start angle for first segment in radians. + * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, + * of the circular sector in radians. The default value results in a complete circle. + */ + constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts new file mode 100644 index 000000000..0df48d532 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts @@ -0,0 +1,29 @@ +/** + * A geometry class for representing a cone. + * + * ```js + * const geometry = new THREE.ConeGeometry( 5, 20, 32 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const cone = new THREE.Mesh(geometry, material ); + * scene.add( cone ); + * ``` + * + * @augments CylinderGeometry + * @demo scenes/geometry-browser.html#ConeGeometry + */ +export class ConeGeometry extends CylinderGeometry { + /** + * Constructs a new cone geometry. + * + * @param {number} [radius=1] - Radius of the cone base. + * @param {number} [height=1] - Height of the cone. + * @param {number} [radialSegments=32] - Number of segmented faces around the circumference of the cone. + * @param {number} [heightSegments=1] - Number of rows of faces along the height of the cone. + * @param {boolean} [openEnded=false] - Whether the base of the cone is open or capped. + * @param {number} [thetaStart=0] - Start angle for first segment, in radians. + * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, of the circular sector, in radians. + * The default value results in a complete cone. + */ + constructor(radius?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); +} +import { CylinderGeometry } from './CylinderGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts new file mode 100644 index 000000000..6b28774bd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts @@ -0,0 +1,47 @@ +/** + * A geometry class for representing a cylinder. + * + * ```js + * const geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const cylinder = new THREE.Mesh( geometry, material ); + * scene.add( cylinder ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#CylinderGeometry + */ +export class CylinderGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {CylinderGeometry} A new instance. + */ + static fromJSON(data: Object): CylinderGeometry; + /** + * Constructs a new cylinder geometry. + * + * @param {number} [radiusTop=1] - Radius of the cylinder at the top. + * @param {number} [radiusBottom=1] - Radius of the cylinder at the bottom. + * @param {number} [height=1] - Height of the cylinder. + * @param {number} [radialSegments=32] - Number of segmented faces around the circumference of the cylinder. + * @param {number} [heightSegments=1] - Number of rows of faces along the height of the cylinder. + * @param {boolean} [openEnded=false] - Whether the base of the cylinder is open or capped. + * @param {number} [thetaStart=0] - Start angle for first segment, in radians. + * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, of the circular sector, in radians. + * The default value results in a complete cylinder. + */ + constructor(radiusTop?: number, radiusBottom?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts new file mode 100644 index 000000000..dd5a084d9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts @@ -0,0 +1,23 @@ +/** + * A geometry class for representing a dodecahedron. + * + * ```js + * const geometry = new THREE.DodecahedronGeometry(); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const dodecahedron = new THREE.Mesh( geometry, material ); + * scene.add( dodecahedron ); + * ``` + * + * @augments PolyhedronGeometry + * @demo scenes/geometry-browser.html#DodecahedronGeometry + */ +export class DodecahedronGeometry extends PolyhedronGeometry { + /** + * Constructs a new dodecahedron geometry. + * + * @param {number} [radius=1] - Radius of the dodecahedron. + * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a dodecahedron. + */ + constructor(radius?: number, detail?: number); +} +import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts new file mode 100644 index 000000000..e8a57e60b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts @@ -0,0 +1,34 @@ +/** + * Can be used as a helper object to view the edges of a geometry. + * + * ```js + * const geometry = new THREE.BoxGeometry(); + * const edges = new THREE.EdgesGeometry( geometry ); + * const line = new THREE.LineSegments( edges ); + * scene.add( line ); + * ``` + * + * Note: It is not yet possible to serialize/deserialize instances of this class. + * + * @augments BufferGeometry + */ +export class EdgesGeometry extends BufferGeometry { + /** + * Constructs a new edges geometry. + * + * @param {?BufferGeometry} [geometry=null] - The geometry. + * @param {number} [thresholdAngle=1] - An edge is only rendered if the angle (in degrees) + * between the face normals of the adjoining faces exceeds this value. + */ + constructor(geometry?: BufferGeometry | null, thresholdAngle?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts new file mode 100644 index 000000000..92ba6a8a5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts @@ -0,0 +1,97 @@ +/** + * ~Options + */ +export type ExtrudeGeometry = { + /** + * - Number of points on the curves. + */ + curveSegments?: number | undefined; + /** + * - Number of points used for subdividing segments along the depth of the extruded spline. + */ + steps?: number | undefined; + /** + * - Depth to extrude the shape. + */ + depth?: number | undefined; + /** + * - Whether to beveling to the shape or not. + */ + bevelEnabled?: boolean | undefined; + /** + * - How deep into the original shape the bevel goes. + */ + bevelThickness?: number | undefined; + /** + * - Distance from the shape outline that the bevel extends. + */ + bevelSize?: number | undefined; + /** + * - Distance from the shape outline that the bevel starts. + */ + bevelOffset?: number | undefined; + /** + * - Number of bevel layers. + */ + bevelSegments?: number | undefined; + /** + * - A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion. + */ + extrudePath?: Curve | null; + /** + * - An object that provides UV generator functions for custom UV generation. + */ + UVGenerator?: Object | undefined; +}; +/** + * Creates extruded geometry from a path shape. + * + * ```js + * const length = 12, width = 8; + * + * const shape = new THREE.Shape(); + * shape.moveTo( 0,0 ); + * shape.lineTo( 0, width ); + * shape.lineTo( length, width ); + * shape.lineTo( length, 0 ); + * shape.lineTo( 0, 0 ); + * + * const geometry = new THREE.ExtrudeGeometry( shape ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const mesh = new THREE.Mesh( geometry, material ) ; + * scene.add( mesh ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#ExtrudeGeometry + */ +export class ExtrudeGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @param {Array} shapes - An array of shapes. + * @return {ExtrudeGeometry} A new instance. + */ + static fromJSON(data: Object, shapes: Array): ExtrudeGeometry; + /** + * Constructs a new extrude geometry. + * + * @param {Shape|Array} [shapes] - A shape or an array of shapes. + * @param {ExtrudeGeometry~Options} [options] - The extrude settings. + */ + constructor(shapes?: Shape | Array, options?: {}); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; + toJSON(): any; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; +import { Shape } from '../extras/core/Shape.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts b/jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts new file mode 100644 index 000000000..b1be46c46 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts @@ -0,0 +1,21 @@ +export * from "./BoxGeometry.js"; +export * from "./CapsuleGeometry.js"; +export * from "./CircleGeometry.js"; +export * from "./ConeGeometry.js"; +export * from "./CylinderGeometry.js"; +export * from "./DodecahedronGeometry.js"; +export * from "./EdgesGeometry.js"; +export * from "./ExtrudeGeometry.js"; +export * from "./IcosahedronGeometry.js"; +export * from "./LatheGeometry.js"; +export * from "./OctahedronGeometry.js"; +export * from "./PlaneGeometry.js"; +export * from "./PolyhedronGeometry.js"; +export * from "./RingGeometry.js"; +export * from "./ShapeGeometry.js"; +export * from "./SphereGeometry.js"; +export * from "./TetrahedronGeometry.js"; +export * from "./TorusGeometry.js"; +export * from "./TorusKnotGeometry.js"; +export * from "./TubeGeometry.js"; +export * from "./WireframeGeometry.js"; diff --git a/jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts new file mode 100644 index 000000000..fb50e77df --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts @@ -0,0 +1,23 @@ +/** + * A geometry class for representing an icosahedron. + * + * ```js + * const geometry = new THREE.IcosahedronGeometry(); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const icosahedron = new THREE.Mesh( geometry, material ); + * scene.add( icosahedron ); + * ``` + * + * @augments PolyhedronGeometry + * @demo scenes/geometry-browser.html#IcosahedronGeometry + */ +export class IcosahedronGeometry extends PolyhedronGeometry { + /** + * Constructs a new icosahedron geometry. + * + * @param {number} [radius=1] - Radius of the icosahedron. + * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a icosahedron. + */ + constructor(radius?: number, detail?: number); +} +import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts new file mode 100644 index 000000000..cce939fca --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts @@ -0,0 +1,50 @@ +/** + * Creates meshes with axial symmetry like vases. The lathe rotates around the Y axis. + * + * ```js + * const points = []; + * for ( let i = 0; i < 10; i ++ ) { + * points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) ); + * } + * const geometry = new THREE.LatheGeometry( points ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const lathe = new THREE.Mesh( geometry, material ); + * scene.add( lathe ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#LatheGeometry + */ +export class LatheGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {LatheGeometry} A new instance. + */ + static fromJSON(data: Object): LatheGeometry; + /** + * Constructs a new lathe geometry. + * + * @param {Array} [points] - An array of points in 2D space. The x-coordinate of each point + * must be greater than zero. + * @param {number} [segments=12] - The number of circumference segments to generate. + * @param {number} [phiStart=0] - The starting angle in radians. + * @param {number} [phiLength=Math.PI*2] - The radian (0 to 2PI) range of the lathed section 2PI is a + * closed lathe, less than 2PI is a portion. + */ + constructor(points?: Array, segments?: number, phiStart?: number, phiLength?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; +import { Vector2 } from '../math/Vector2.js'; +import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts new file mode 100644 index 000000000..d61fe28a2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts @@ -0,0 +1,23 @@ +/** + * A geometry class for representing an octahedron. + * + * ```js + * const geometry = new THREE.OctahedronGeometry(); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const octahedron = new THREE.Mesh( geometry, material ); + * scene.add( octahedron ); + * ``` + * + * @augments PolyhedronGeometry + * @demo scenes/geometry-browser.html#OctahedronGeometry + */ +export class OctahedronGeometry extends PolyhedronGeometry { + /** + * Constructs a new octahedron geometry. + * + * @param {number} [radius=1] - Radius of the octahedron. + * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a octahedron. + */ + constructor(radius?: number, detail?: number); +} +import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts new file mode 100644 index 000000000..d75a367ea --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts @@ -0,0 +1,42 @@ +/** + * A geometry class for representing a plane. + * + * ```js + * const geometry = new THREE.PlaneGeometry( 1, 1 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); + * const plane = new THREE.Mesh( geometry, material ); + * scene.add( plane ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#PlaneGeometry + */ +export class PlaneGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {PlaneGeometry} A new instance. + */ + static fromJSON(data: Object): PlaneGeometry; + /** + * Constructs a new plane geometry. + * + * @param {number} [width=1] - The width along the X axis. + * @param {number} [height=1] - The height along the Y axis + * @param {number} [widthSegments=1] - The number of segments along the X axis. + * @param {number} [heightSegments=1] - The number of segments along the Y axis. + */ + constructor(width?: number, height?: number, widthSegments?: number, heightSegments?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts new file mode 100644 index 000000000..c0ef0437c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts @@ -0,0 +1,36 @@ +/** + * A polyhedron is a solid in three dimensions with flat faces. This class + * will take an array of vertices, project them onto a sphere, and then + * divide them up to the desired level of detail. + * + * @augments BufferGeometry + */ +export class PolyhedronGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {PolyhedronGeometry} A new instance. + */ + static fromJSON(data: Object): PolyhedronGeometry; + /** + * Constructs a new polyhedron geometry. + * + * @param {Array} [vertices] - A flat array of vertices describing the base shape. + * @param {Array} [indices] - A flat array of indices describing the base shape. + * @param {number} [radius=1] - The radius of the shape. + * @param {number} [detail=0] - How many levels to subdivide the geometry. The more detail, the smoother the shape. + */ + constructor(vertices?: Array, indices?: Array, radius?: number, detail?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts new file mode 100644 index 000000000..3d54a0d1a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts @@ -0,0 +1,44 @@ +/** + * A class for generating a two-dimensional ring geometry. + * + * ```js + * const geometry = new THREE.RingGeometry( 1, 5, 32 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#RingGeometry + */ +export class RingGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {RingGeometry} A new instance. + */ + static fromJSON(data: Object): RingGeometry; + /** + * Constructs a new ring geometry. + * + * @param {number} [innerRadius=0.5] - The inner radius of the ring. + * @param {number} [outerRadius=1] - The outer radius of the ring. + * @param {number} [thetaSegments=32] - Number of segments. A higher number means the ring will be more round. Minimum is `3`. + * @param {number} [phiSegments=1] - Number of segments per ring segment. Minimum is `1`. + * @param {number} [thetaStart=0] - Starting angle in radians. + * @param {number} [thetaLength=Math.PI*2] - Central angle in radians. + */ + constructor(innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts new file mode 100644 index 000000000..335290e14 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts @@ -0,0 +1,47 @@ +/** + * Creates an one-sided polygonal geometry from one or more path shapes. + * + * ```js + * const arcShape = new THREE.Shape() + * .moveTo( 5, 1 ) + * .absarc( 1, 1, 4, 0, Math.PI * 2, false ); + * + * const geometry = new THREE.ShapeGeometry( arcShape ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00, side: THREE.DoubleSide } ); + * const mesh = new THREE.Mesh( geometry, material ) ; + * scene.add( mesh ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#ShapeGeometry + */ +export class ShapeGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @param {Array} shapes - An array of shapes. + * @return {ShapeGeometry} A new instance. + */ + static fromJSON(data: Object, shapes: Array): ShapeGeometry; + /** + * Constructs a new shape geometry. + * + * @param {Shape|Array} [shapes] - A shape or an array of shapes. + * @param {number} [curveSegments=12] - Number of segments per shape. + */ + constructor(shapes?: Shape | Array, curveSegments?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; + toJSON(): any; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; +import { Shape } from '../extras/core/Shape.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts new file mode 100644 index 000000000..b150fa7df --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts @@ -0,0 +1,45 @@ +/** + * A class for generating a sphere geometry. + * + * ```js + * const geometry = new THREE.SphereGeometry( 15, 32, 16 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const sphere = new THREE.Mesh( geometry, material ); + * scene.add( sphere ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#SphereGeometry + */ +export class SphereGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {SphereGeometry} A new instance. + */ + static fromJSON(data: Object): SphereGeometry; + /** + * Constructs a new sphere geometry. + * + * @param {number} [radius=1] - The sphere radius. + * @param {number} [widthSegments=32] - The number of horizontal segments. Minimum value is `3`. + * @param {number} [heightSegments=16] - The number of vertical segments. Minimum value is `2`. + * @param {number} [phiStart=0] - The horizontal starting angle in radians. + * @param {number} [phiLength=Math.PI*2] - The horizontal sweep angle size. + * @param {number} [thetaStart=0] - The vertical starting angle in radians. + * @param {number} [thetaLength=Math.PI] - The vertical sweep angle size. + */ + constructor(radius?: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts new file mode 100644 index 000000000..20b8cc1f3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts @@ -0,0 +1,23 @@ +/** + * A geometry class for representing an tetrahedron. + * + * ```js + * const geometry = new THREE.TetrahedronGeometry(); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const tetrahedron = new THREE.Mesh( geometry, material ); + * scene.add( tetrahedron ); + * ``` + * + * @augments PolyhedronGeometry + * @demo scenes/geometry-browser.html#TetrahedronGeometry + */ +export class TetrahedronGeometry extends PolyhedronGeometry { + /** + * Constructs a new tetrahedron geometry. + * + * @param {number} [radius=1] - Radius of the tetrahedron. + * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a tetrahedron. + */ + constructor(radius?: number, detail?: number); +} +import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts new file mode 100644 index 000000000..cb545919c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts @@ -0,0 +1,45 @@ +/** + * A geometry class for representing an torus. + * + * ```js + * const geometry = new THREE.TorusGeometry( 10, 3, 16, 100 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const torus = new THREE.Mesh( geometry, material ); + * scene.add( torus ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#TorusGeometry + */ +export class TorusGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {TorusGeometry} A new instance. + */ + static fromJSON(data: Object): TorusGeometry; + /** + * Constructs a new torus geometry. + * + * @param {number} [radius=1] - Radius of the torus, from the center of the torus to the center of the tube. + * @param {number} [tube=0.4] - Radius of the tube. Must be smaller than `radius`. + * @param {number} [radialSegments=12] - The number of radial segments. + * @param {number} [tubularSegments=48] - The number of tubular segments. + * @param {number} [arc=Math.PI*2] - Central angle in radians. + * @param {number} [thetaStart=0] - Start of the tubular sweep in radians. + * @param {number} [thetaLength=Math.PI*2] - Length of the tubular sweep in radians. + */ + constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number, thetaStart?: number, thetaLength?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts new file mode 100644 index 000000000..5f7272dfe --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts @@ -0,0 +1,46 @@ +/** + * Creates a torus knot, the particular shape of which is defined by a pair + * of coprime integers, p and q. If p and q are not coprime, the result will + * be a torus link. + * + * ```js + * const geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const torusKnot = new THREE.Mesh( geometry, material ); + * scene.add( torusKnot ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#TorusKnotGeometry + */ +export class TorusKnotGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {TorusKnotGeometry} A new instance. + */ + static fromJSON(data: Object): TorusKnotGeometry; + /** + * Constructs a new torus knot geometry. + * + * @param {number} [radius=1] - Radius of the torus knot. + * @param {number} [tube=0.4] - Radius of the tube. + * @param {number} [tubularSegments=64] - The number of tubular segments. + * @param {number} [radialSegments=8] - The number of radial segments. + * @param {number} [p=2] - This value determines, how many times the geometry winds around its axis of rotational symmetry. + * @param {number} [q=3] - This value determines, how many times the geometry winds around a circle in the interior of the torus. + */ + constructor(radius?: number, tube?: number, tubularSegments?: number, radialSegments?: number, p?: number, q?: number); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts new file mode 100644 index 000000000..f34277010 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts @@ -0,0 +1,60 @@ +/** + * Creates a tube that extrudes along a 3D curve. + * + * ```js + * class CustomSinCurve extends THREE.Curve { + * + * getPoint( t, optionalTarget = new THREE.Vector3() ) { + * + * const tx = t * 3 - 1.5; + * const ty = Math.sin( 2 * Math.PI * t ); + * const tz = 0; + * + * return optionalTarget.set( tx, ty, tz ); + * } + * + * } + * + * const path = new CustomSinCurve( 10 ); + * const geometry = new THREE.TubeGeometry( path, 20, 2, 8, false ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * ``` + * + * @augments BufferGeometry + * @demo scenes/geometry-browser.html#TubeGeometry + */ +export class TubeGeometry extends BufferGeometry { + /** + * Factory method for creating an instance of this class from the given + * JSON object. + * + * @param {Object} data - A JSON object representing the serialized geometry. + * @return {TubeGeometry} A new instance. + */ + static fromJSON(data: Object): TubeGeometry; + /** + * Constructs a new tube geometry. + * + * @param {Curve} [path=QuadraticBezierCurve3] - A 3D curve defining the path of the tube. + * @param {number} [tubularSegments=64] - The number of segments that make up the tube. + * @param {number} [radius=1] -The radius of the tube. + * @param {number} [radialSegments=8] - The number of segments that make up the cross-section. + * @param {boolean} [closed=false] - Whether the tube is closed or not. + */ + constructor(path?: Curve, tubularSegments?: number, radius?: number, radialSegments?: number, closed?: boolean); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + tangents: any; + normals: any; + binormals: any; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts new file mode 100644 index 000000000..39f9908ab --- /dev/null +++ b/jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts @@ -0,0 +1,38 @@ +/** + * Can be used as a helper object to visualize a geometry as a wireframe. + * + * ```js + * const geometry = new THREE.SphereGeometry(); + * + * const wireframe = new THREE.WireframeGeometry( geometry ); + * + * const line = new THREE.LineSegments( wireframe ); + * line.material.depthWrite = false; + * line.material.opacity = 0.25; + * line.material.transparent = true; + * + * scene.add( line ); + * ``` + * + * Note: It is not yet possible to serialize/deserialize instances of this class. + * + * @augments BufferGeometry + */ +export class WireframeGeometry extends BufferGeometry { + /** + * Constructs a new wireframe geometry. + * + * @param {?BufferGeometry} [geometry=null] - The geometry. + */ + constructor(geometry?: BufferGeometry | null); + /** + * Holds the constructor parameters that have been + * used to generate the geometry. Any modification + * after instantiation does not change the geometry. + * + * @type {Object} + */ + parameters: Object; + copy(source: any): this; +} +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts new file mode 100644 index 000000000..c4ee0cb4f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts @@ -0,0 +1,70 @@ +/** + * An 3D arrow object for visualizing directions. + * + * ```js + * const dir = new THREE.Vector3( 1, 2, 0 ); + * + * //normalize the direction vector (convert to vector of length 1) + * dir.normalize(); + * + * const origin = new THREE.Vector3( 0, 0, 0 ); + * const length = 1; + * const hex = 0xffff00; + * + * const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex ); + * scene.add( arrowHelper ); + * ``` + * + * @augments Object3D + */ +export class ArrowHelper extends Object3D { + /** + * Constructs a new arrow helper. + * + * @param {Vector3} [dir=(0, 0, 1)] - The (normalized) direction vector. + * @param {Vector3} [origin=(0, 0, 0)] - Point at which the arrow starts. + * @param {number} [length=1] - Length of the arrow in world units. + * @param {(number|Color|string)} [color=0xffff00] - Color of the arrow. + * @param {number} [headLength=length*0.2] - The length of the head of the arrow. + * @param {number} [headWidth=headLength*0.2] - The width of the head of the arrow. + */ + constructor(dir?: Vector3, origin?: Vector3, length?: number, color?: (number | Color | string), headLength?: number, headWidth?: number); + type: string; + /** + * The line part of the arrow helper. + * + * @type {Line} + */ + line: Line; + /** + * The cone part of the arrow helper. + * + * @type {Mesh} + */ + cone: Mesh; + /** + * Sets the direction of the helper. + * + * @param {Vector3} dir - The normalized direction vector. + */ + setDirection(dir: Vector3): void; + /** + * Sets the length of the helper. + * + * @param {number} length - Length of the arrow in world units. + * @param {number} [headLength=length*0.2] - The length of the head of the arrow. + * @param {number} [headWidth=headLength*0.2] - The width of the head of the arrow. + */ + setLength(length: number, headLength?: number, headWidth?: number): void; + /** + * Sets the color of the helper. + * + * @param {number|Color|string} color - The color to set. + */ + setColor(color: number | Color | string): void; + copy(source: any): this; +} +import { Object3D } from '../core/Object3D.js'; +import { Line } from '../objects/Line.js'; +import { Mesh } from '../objects/Mesh.js'; +import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts new file mode 100644 index 000000000..3669564fc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts @@ -0,0 +1,30 @@ +/** + * An axis object to visualize the 3 axes in a simple way. + * The X axis is red. The Y axis is green. The Z axis is blue. + * + * ```js + * const axesHelper = new THREE.AxesHelper( 5 ); + * scene.add( axesHelper ); + * ``` + * + * @augments LineSegments + */ +export class AxesHelper extends LineSegments { + /** + * Constructs a new axes helper. + * + * @param {number} [size=1] - Size of the lines representing the axes. + */ + constructor(size?: number); + /** + * Defines the colors of the axes helper. + * + * @param {number|Color|string} xAxisColor - The color for the x axis. + * @param {number|Color|string} yAxisColor - The color for the y axis. + * @param {number|Color|string} zAxisColor - The color for the z axis. + * @return {AxesHelper} A reference to this axes helper. + */ + setColors(xAxisColor: number | Color | string, yAxisColor: number | Color | string, zAxisColor: number | Color | string): AxesHelper; +} +import { LineSegments } from '../objects/LineSegments.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts b/jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts new file mode 100644 index 000000000..77ea2a19f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts @@ -0,0 +1,30 @@ +/** + * A helper object to visualize an instance of {@link Box3}. + * + * ```js + * const box = new THREE.Box3(); + * box.setFromCenterAndSize( new THREE.Vector3( 1, 1, 1 ), new THREE.Vector3( 2, 1, 3 ) ); + * + * const helper = new THREE.Box3Helper( box, 0xffff00 ); + * scene.add( helper ) + * ``` + * + * @augments LineSegments + */ +export class Box3Helper extends LineSegments { + /** + * Constructs a new box3 helper. + * + * @param {Box3} box - The box to visualize. + * @param {number|Color|string} [color=0xffff00] - The box's color. + */ + constructor(box: Box3, color?: number | Color | string); + /** + * The box being visualized. + * + * @type {Box3} + */ + box: Box3; + updateMatrixWorld(force: any): void; +} +import { LineSegments } from '../objects/LineSegments.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts new file mode 100644 index 000000000..02a4fa37c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts @@ -0,0 +1,39 @@ +/** + * Helper object to graphically show the world-axis-aligned bounding box + * around an object. The actual bounding box is handled with {@link Box3}, + * this is just a visual helper for debugging. It can be automatically + * resized with {@link BoxHelper#update} when the object it's created from + * is transformed. Note that the object must have a geometry for this to work, + * so it won't work with sprites. + * + * ```js + * const sphere = new THREE.SphereGeometry(); + * const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) ); + * const box = new THREE.BoxHelper( object, 0xffff00 ); + * scene.add( box ); + * ``` + * + * @augments LineSegments + */ +export class BoxHelper extends LineSegments { + /** + * The 3D object being visualized. + * + * @type {Object3D} + */ + object: Object3D; + /** + * Updates the helper's geometry to match the dimensions of the object, + * including any children. + */ + update(): void; + /** + * Updates the wireframe box for the passed object. + * + * @param {Object3D} object - The 3D object to create the helper for. + * @return {BoxHelper} A reference to this instance. + */ + setFromObject(object: Object3D): BoxHelper; + copy(source: any, recursive: any): this; +} +import { LineSegments } from '../objects/LineSegments.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts new file mode 100644 index 000000000..7aa2e0e29 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts @@ -0,0 +1,59 @@ +/** + * This helps with visualizing what a camera contains in its frustum. It + * visualizes the frustum of a camera using a line segments. + * + * Based on frustum visualization in [lightgl.js shadowmap example](https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html). + * + * `CameraHelper` must be a child of the scene. + * + * When the camera is transformed or its projection matrix is changed, it's necessary + * to call the `update()` method of the respective helper. + * + * ```js + * const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); + * const helper = new THREE.CameraHelper( camera ); + * scene.add( helper ); + * ``` + * + * @augments LineSegments + */ +export class CameraHelper extends LineSegments { + /** + * Constructs a new arrow helper. + * + * @param {Camera} camera - The camera to visualize. + */ + constructor(camera: Camera); + /** + * The camera being visualized. + * + * @type {Camera} + */ + camera: Camera; + /** + * This contains the points used to visualize the camera. + * + * @type {Object>} + */ + pointMap: { + [x: string]: number[]; + }; + /** + * Defines the colors of the helper. + * + * @param {Color} frustum - The frustum line color. + * @param {Color} cone - The cone line color. + * @param {Color} up - The up line color. + * @param {Color} target - The target line color. + * @param {Color} cross - The cross line color. + * @return {CameraHelper} A reference to this helper. + */ + setColors(frustum: Color, cone: Color, up: Color, target: Color, cross: Color): CameraHelper; + /** + * Updates the helper based on the projection matrix of the camera. + */ + update(): void; +} +import { LineSegments } from '../objects/LineSegments.js'; +import { Camera } from '../cameras/Camera.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts new file mode 100644 index 000000000..6931d5275 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts @@ -0,0 +1,63 @@ +/** + * Helper object to assist with visualizing a {@link DirectionalLight}'s + * effect on the scene. This consists of a plane and a line representing the + * light's position and direction. + * + * When the directional light or its target are transformed or light properties + * are changed, it's necessary to call the `update()` method of the respective helper. + * + * ```js + * const light = new THREE.DirectionalLight( 0xFFFFFF ); + * scene.add( light ); + * + * const helper = new THREE.DirectionalLightHelper( light, 5 ); + * scene.add( helper ); + * ``` + * + * @augments Object3D + */ +export class DirectionalLightHelper extends Object3D { + /** + * Constructs a new directional light helper. + * + * @param {DirectionalLight} light - The light to be visualized. + * @param {number} [size=1] - The dimensions of the plane. + * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take + * the color of the light. + */ + constructor(light: DirectionalLight, size?: number, color?: number | Color | string); + /** + * The light being visualized. + * + * @type {DirectionalLight} + */ + light: DirectionalLight; + matrix: any; + /** + * The color parameter passed in the constructor. + * If not set, the helper will take the color of the light. + * + * @type {number|Color|string} + */ + color: number | Color | string; + type: string; + /** + * Contains the line showing the location of the directional light. + * + * @type {Line} + */ + lightPlane: Line; + /** + * Represents the target line of the directional light. + * + * @type {Line} + */ + targetLine: Line; + /** + * Updates the helper to match the position and direction of the + * light being visualized. + */ + update(): void; +} +import { Object3D } from '../core/Object3D.js'; +import { Line } from '../objects/Line.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts new file mode 100644 index 000000000..7efd650b5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts @@ -0,0 +1,27 @@ +/** + * The helper is an object to define grids. Grids are two-dimensional + * arrays of lines. + * + * ```js + * const size = 10; + * const divisions = 10; + * + * const gridHelper = new THREE.GridHelper( size, divisions ); + * scene.add( gridHelper ); + * ``` + * + * @augments LineSegments + */ +export class GridHelper extends LineSegments { + /** + * Constructs a new grid helper. + * + * @param {number} [size=10] - The size of the grid. + * @param {number} [divisions=10] - The number of divisions across the grid. + * @param {number|Color|string} [color1=0x444444] - The color of the center line. + * @param {number|Color|string} [color2=0x888888] - The color of the lines of the grid. + */ + constructor(size?: number, divisions?: number, color1?: number | Color | string, color2?: number | Color | string); +} +import { LineSegments } from '../objects/LineSegments.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts new file mode 100644 index 000000000..d3dc6b8da --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts @@ -0,0 +1,50 @@ +/** + * Creates a visual aid consisting of a spherical mesh for a + * given {@link HemisphereLight}. + * + * When the hemisphere light is transformed or its light properties are changed, + * it's necessary to call the `update()` method of the respective helper. + * + * ```js + * const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); + * const helper = new THREE.HemisphereLightHelper( light, 5 ); + * scene.add( helper ); + * ``` + * + * @augments Object3D + */ +export class HemisphereLightHelper extends Object3D { + /** + * Constructs a new hemisphere light helper. + * + * @param {HemisphereLight} light - The light to be visualized. + * @param {number} [size=1] - The size of the mesh used to visualize the light. + * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take + * the color of the light. + */ + constructor(light: HemisphereLight, size?: number, color?: number | Color | string); + /** + * The light being visualized. + * + * @type {HemisphereLight} + */ + light: HemisphereLight; + matrix: any; + /** + * The color parameter passed in the constructor. + * If not set, the helper will take the color of the light. + * + * @type {number|Color|string} + */ + color: number | Color | string; + type: string; + material: MeshBasicMaterial; + /** + * Updates the helper to match the position and direction of the + * light being visualized. + */ + update(): void; +} +import { Object3D } from '../core/Object3D.js'; +import { Color } from '../math/Color.js'; +import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts new file mode 100644 index 000000000..b2015d607 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts @@ -0,0 +1,36 @@ +/** + * A helper object to visualize an instance of {@link Plane}. + * + * ```js + * const plane = new THREE.Plane( new THREE.Vector3( 1, 1, 0.2 ), 3 ); + * const helper = new THREE.PlaneHelper( plane, 1, 0xffff00 ); + * scene.add( helper ); + * ``` + * + * @augments Line + */ +export class PlaneHelper extends Line { + /** + * Constructs a new plane helper. + * + * @param {Plane} plane - The plane to be visualized. + * @param {number} [size=1] - The side length of plane helper. + * @param {number|Color|string} [hex=0xffff00] - The helper's color. + */ + constructor(plane: Plane, size?: number, hex?: number | Color | string); + /** + * The plane being visualized. + * + * @type {Plane} + */ + plane: Plane; + /** + * The side length of plane helper. + * + * @type {number} + * @default 1 + */ + size: number; + updateMatrixWorld(force: any): void; +} +import { Line } from '../objects/Line.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts new file mode 100644 index 000000000..ef2ecb228 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts @@ -0,0 +1,47 @@ +/** + * This displays a helper object consisting of a spherical mesh for + * visualizing an instance of {@link PointLight}. + * + * ```js + * const pointLight = new THREE.PointLight( 0xff0000, 1, 100 ); + * pointLight.position.set( 10, 10, 10 ); + * scene.add( pointLight ); + * + * const sphereSize = 1; + * const pointLightHelper = new THREE.PointLightHelper( pointLight, sphereSize ); + * scene.add( pointLightHelper ); + * ``` + * + * @augments Mesh + */ +export class PointLightHelper extends Mesh { + /** + * Constructs a new point light helper. + * + * @param {PointLight} light - The light to be visualized. + * @param {number} [sphereSize=1] - The size of the sphere helper. + * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take + * the color of the light. + */ + constructor(light: PointLight, sphereSize?: number, color?: number | Color | string); + /** + * The light being visualized. + * + * @type {PointLight} + */ + light: PointLight; + /** + * The color parameter passed in the constructor. + * If not set, the helper will take the color of the light. + * + * @type {number|Color|string} + */ + color: number | Color | string; + matrix: any; + /** + * Updates the helper to match the position of the + * light being visualized. + */ + update(): void; +} +import { Mesh } from '../objects/Mesh.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts new file mode 100644 index 000000000..edaecda65 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts @@ -0,0 +1,31 @@ +/** + * This helper is an object to define polar grids. Grids are + * two-dimensional arrays of lines. + * + * ```js + * const radius = 10; + * const sectors = 16; + * const rings = 8; + * const divisions = 64; + * + * const helper = new THREE.PolarGridHelper( radius, sectors, rings, divisions ); + * scene.add( helper ); + * ``` + * + * @augments LineSegments + */ +export class PolarGridHelper extends LineSegments { + /** + * Constructs a new polar grid helper. + * + * @param {number} [radius=10] - The radius of the polar grid. This can be any positive number. + * @param {number} [sectors=16] - The number of sectors the grid will be divided into. This can be any positive integer. + * @param {number} [rings=16] - The number of rings. This can be any positive integer. + * @param {number} [divisions=64] - The number of line segments used for each circle. This can be any positive integer. + * @param {number|Color|string} [color1=0x444444] - The first color used for grid elements. + * @param {number|Color|string} [color2=0x888888] - The second color used for grid elements. + */ + constructor(radius?: number, sectors?: number, rings?: number, divisions?: number, color1?: number | Color | string, color2?: number | Color | string); +} +import { LineSegments } from '../objects/LineSegments.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts new file mode 100644 index 000000000..4b864c4eb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts @@ -0,0 +1,51 @@ +/** + * A helper object to assist with visualizing a {@link Skeleton}. + * + * ```js + * const helper = new THREE.SkeletonHelper( skinnedMesh ); + * scene.add( helper ); + * ``` + * + * @augments LineSegments + */ +export class SkeletonHelper extends LineSegments { + /** + * Constructs a new skeleton helper. + * + * @param {Object3D} object - Usually an instance of {@link SkinnedMesh}. However, any 3D object + * can be used if it represents a hierarchy of bones (see {@link Bone}). + */ + constructor(object: Object3D); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSkeletonHelper: boolean; + /** + * The object being visualized. + * + * @type {Object3D} + */ + root: Object3D; + /** + * The list of bones that the helper visualizes. + * + * @type {Array} + */ + bones: Array; + matrix: any; + updateMatrixWorld(force: any): void; + /** + * Defines the colors of the helper. + * + * @param {Color} color1 - The first line color for each bone. + * @param {Color} color2 - The second line color for each bone. + * @return {SkeletonHelper} A reference to this helper. + */ + setColors(color1: Color, color2: Color): SkeletonHelper; +} +import { LineSegments } from '../objects/LineSegments.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts new file mode 100644 index 000000000..84337bbb2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts @@ -0,0 +1,49 @@ +/** + * This displays a cone shaped helper object for a {@link SpotLight}. + * + * When the spot light or its target are transformed or light properties are + * changed, it's necessary to call the `update()` method of the respective helper. + * + * ```js + * const spotLight = new THREE.SpotLight( 0xffffff ); + * spotLight.position.set( 10, 10, 10 ); + * scene.add( spotLight ); + * + * const spotLightHelper = new THREE.SpotLightHelper( spotLight ); + * scene.add( spotLightHelper ); + * ``` + * + * @augments Object3D + */ +export class SpotLightHelper extends Object3D { + /** + * Constructs a new spot light helper. + * + * @param {HemisphereLight} light - The light to be visualized. + * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take + * the color of the light. + */ + constructor(light: HemisphereLight, color?: number | Color | string); + /** + * The light being visualized. + * + * @type {SpotLight} + */ + light: SpotLight; + /** + * The color parameter passed in the constructor. + * If not set, the helper will take the color of the light. + * + * @type {number|Color|string} + */ + color: number | Color | string; + type: string; + cone: LineSegments; + /** + * Updates the helper to match the position and direction of the + * light being visualized. + */ + update(): void; +} +import { Object3D } from '../core/Object3D.js'; +import { LineSegments } from '../objects/LineSegments.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts b/jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts new file mode 100644 index 000000000..78c3196fd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts @@ -0,0 +1,30 @@ +/** + * This light globally illuminates all objects in the scene equally. + * + * It cannot be used to cast shadows as it does not have a direction. + * + * ```js + * const light = new THREE.AmbientLight( 0x404040 ); // soft white light + * scene.add( light ); + * ``` + * + * @augments Light + */ +export class AmbientLight extends Light { + /** + * Constructs a new ambient light. + * + * @param {(number|Color|string)} [color=0xffffff] - The light's color. + * @param {number} [intensity=1] - The light's strength/intensity. + */ + constructor(color?: (number | Color | string), intensity?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAmbientLight: boolean; +} +import { Light } from './Light.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts b/jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts new file mode 100644 index 000000000..753317423 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts @@ -0,0 +1,67 @@ +/** + * A light that gets emitted in a specific direction. This light will behave + * as though it is infinitely far away and the rays produced from it are all + * parallel. The common use case for this is to simulate daylight; the sun is + * far enough away that its position can be considered to be infinite, and + * all light rays coming from it are parallel. + * + * A common point of confusion for directional lights is that setting the + * rotation has no effect. This is because three.js's DirectionalLight is the + * equivalent to what is often called a 'Target Direct Light' in other + * applications. + * + * This means that its direction is calculated as pointing from the light's + * {@link Object3D#position} to the {@link DirectionalLight#target} position + * (as opposed to a 'Free Direct Light' that just has a rotation + * component). + * + * This light can cast shadows - see the {@link DirectionalLightShadow} for details. + * + * ```js + * // White directional light at half intensity shining from the top. + * const directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); + * scene.add( directionalLight ); + * ``` + * + * @augments Light + */ +export class DirectionalLight extends Light { + /** + * Constructs a new directional light. + * + * @param {(number|Color|string)} [color=0xffffff] - The light's color. + * @param {number} [intensity=1] - The light's strength/intensity. + */ + constructor(color?: (number | Color | string), intensity?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isDirectionalLight: boolean; + /** + * The directional light points from its position to the + * target's position. + * + * For the target's position to be changed to anything other + * than the default, it must be added to the scene. + * + * It is also possible to set the target to be another 3D object + * in the scene. The light will now track the target object. + * + * @type {Object3D} + */ + target: Object3D; + /** + * This property holds the light's shadow configuration. + * + * @type {DirectionalLightShadow} + */ + shadow: DirectionalLightShadow; + copy(source: any): this; +} +import { Light } from './Light.js'; +import { Object3D } from '../core/Object3D.js'; +import { DirectionalLightShadow } from './DirectionalLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts new file mode 100644 index 000000000..69d809ea1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts @@ -0,0 +1,20 @@ +/** + * Represents the shadow configuration of directional lights. + * + * @augments LightShadow + */ +export class DirectionalLightShadow extends LightShadow { + /** + * Constructs a new directional light shadow. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isDirectionalLightShadow: boolean; +} +import { LightShadow } from './LightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts b/jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts new file mode 100644 index 000000000..9bffa0d03 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts @@ -0,0 +1,40 @@ +/** + * A light source positioned directly above the scene, with color fading from + * the sky color to the ground color. + * + * This light cannot be used to cast shadows. + * + * ```js + * const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); + * scene.add( light ); + * ``` + * + * @augments Light + */ +export class HemisphereLight extends Light { + /** + * Constructs a new hemisphere light. + * + * @param {(number|Color|string)} [skyColor=0xffffff] - The light's sky color. + * @param {(number|Color|string)} [groundColor=0xffffff] - The light's ground color. + * @param {number} [intensity=1] - The light's strength/intensity. + */ + constructor(skyColor?: (number | Color | string), groundColor?: (number | Color | string), intensity?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isHemisphereLight: boolean; + /** + * The light's ground color. + * + * @type {Color} + */ + groundColor: Color; + copy(source: any, recursive: any): this; +} +import { Light } from './Light.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/Light.d.ts b/jsdoc-testing/jsdoc/src/lights/Light.d.ts new file mode 100644 index 000000000..53b1d77ab --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/Light.d.ts @@ -0,0 +1,42 @@ +/** + * Abstract base class for lights - all other light types inherit the + * properties and methods described here. + * + * @abstract + * @augments Object3D + */ +export class Light extends Object3D { + /** + * Constructs a new light. + * + * @param {(number|Color|string)} [color=0xffffff] - The light's color. + * @param {number} [intensity=1] - The light's strength/intensity. + */ + constructor(color?: (number | Color | string), intensity?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLight: boolean; + type: string; + /** + * The light's color. + * + * @type {Color} + */ + color: Color; + /** + * The light's intensity. + * + * @type {number} + * @default 1 + */ + intensity: number; + copy(source: any, recursive: any): this; + toJSON(meta: any): Object; +} +import { Object3D } from '../core/Object3D.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts b/jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts new file mode 100644 index 000000000..8a03aa8cf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts @@ -0,0 +1,45 @@ +/** + * Light probes are an alternative way of adding light to a 3D scene. Unlike + * classical light sources (e.g. directional, point or spot lights), light + * probes do not emit light. Instead they store information about light + * passing through 3D space. During rendering, the light that hits a 3D + * object is approximated by using the data from the light probe. + * + * Light probes are usually created from (radiance) environment maps. The + * class {@link LightProbeGenerator} can be used to create light probes from + * cube textures or render targets. However, light estimation data could also + * be provided in other forms e.g. by WebXR. This enables the rendering of + * augmented reality content that reacts to real world lighting. + * + * The current probe implementation in three.js supports so-called diffuse + * light probes. This type of light probe is functionally equivalent to an + * irradiance environment map. + * + * @augments Light + */ +export class LightProbe extends Light { + /** + * Constructs a new light probe. + * + * @param {SphericalHarmonics3} sh - The spherical harmonics which represents encoded lighting information. + * @param {number} [intensity=1] - The light's strength/intensity. + */ + constructor(sh?: SphericalHarmonics3, intensity?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLightProbe: boolean; + /** + * A light probe uses spherical harmonics to encode lighting information. + * + * @type {SphericalHarmonics3} + */ + sh: SphericalHarmonics3; + copy(source: any): this; +} +import { Light } from './Light.js'; +import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts new file mode 100644 index 000000000..71e500048 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts @@ -0,0 +1,215 @@ +/** + * Abstract base class for light shadow classes. These classes + * represent the shadow configuration for different light types. + * + * @abstract + */ +export class LightShadow { + /** + * Constructs a new light shadow. + * + * @param {Camera} camera - The light's view of the world. + */ + constructor(camera: Camera); + /** + * The light's view of the world. + * + * @type {Camera} + */ + camera: Camera; + /** + * The intensity of the shadow. The default is `1`. + * Valid values are in the range `[0, 1]`. + * + * @type {number} + * @default 1 + */ + intensity: number; + /** + * Shadow map bias, how much to add or subtract from the normalized depth + * when deciding whether a surface is in shadow. + * + * The default is `0`. Very tiny adjustments here (in the order of `0.0001`) + * may help reduce artifacts in shadows. + * + * @type {number} + * @default 0 + */ + bias: number; + /** + * A node version of `bias`. Only supported with `WebGPURenderer`. + * + * If a bias node is defined, `bias` has no effect. + * + * @type {?Node} + * @default null + */ + biasNode: Node | null; + /** + * Defines how much the position used to query the shadow map is offset along + * the object normal. The default is `0`. Increasing this value can be used to + * reduce shadow acne especially in large scenes where light shines onto + * geometry at a shallow angle. The cost is that shadows may appear distorted. + * + * @type {number} + * @default 0 + */ + normalBias: number; + /** + * Setting this to values greater than 1 will blur the edges of the shadow. + * High values will cause unwanted banding effects in the shadows - a greater + * map size will allow for a higher value to be used here before these effects + * become visible. + * + * The property has no effect when the shadow map type is `BasicShadowMap`. + * + * @type {number} + * @default 1 + */ + radius: number; + /** + * The amount of samples to use when blurring a VSM shadow map. + * + * @type {number} + * @default 8 + */ + blurSamples: number; + /** + * Defines the width and height of the shadow map. Higher values give better quality + * shadows at the cost of computation time. Values must be powers of two. + * + * @type {Vector2} + * @default (512,512) + */ + mapSize: Vector2; + /** + * The type of shadow texture. The default is `UnsignedByteType`. + * + * @type {number} + * @default UnsignedByteType + */ + mapType: number; + /** + * The depth map generated using the internal camera; a location beyond a + * pixel's depth is in shadow. Computed internally during rendering. + * + * @type {?RenderTarget} + * @default null + */ + map: RenderTarget | null; + /** + * The distribution map generated using the internal camera; an occlusion is + * calculated based on the distribution of depths. Computed internally during + * rendering. + * + * @type {?RenderTarget} + * @default null + */ + mapPass: RenderTarget | null; + /** + * Model to shadow camera space, to compute location and depth in shadow map. + * This is computed internally during rendering. + * + * @type {Matrix4} + */ + matrix: Matrix4; + /** + * Enables automatic updates of the light's shadow. If you do not require dynamic + * lighting / shadows, you may set this to `false`. + * + * @type {boolean} + * @default true + */ + autoUpdate: boolean; + /** + * When set to `true`, shadow maps will be updated in the next `render` call. + * If you have set {@link LightShadow#autoUpdate} to `false`, you will need to + * set this property to `true` and then make a render call to update the light's shadow. + * + * @type {boolean} + * @default false + */ + needsUpdate: boolean; + _frustum: Frustum; + _frameExtents: Vector2; + _viewportCount: number; + _viewports: Vector4[]; + /** + * Used internally by the renderer to get the number of viewports that need + * to be rendered for this shadow. + * + * @return {number} The viewport count. + */ + getViewportCount(): number; + /** + * Used internally by the renderer to get the camera that renders the given viewport. + * + * @param {number} [viewportIndex=0] - The viewport index. + * @return {Camera} The shadow camera. + */ + getCamera(): Camera; + /** + * Gets the shadow cameras frustum. Used internally by the renderer to cull objects. + * + * @return {Frustum} The shadow camera frustum. + */ + getFrustum(): Frustum; + /** + * Update the matrices for the camera and shadow, used internally by the renderer. + * + * @param {Light} light - The light for which the shadow is being rendered. + */ + updateMatrices(light: Light): void; + /** + * Updates a shadow projection matrix and its corresponding frustum. + * + * @private + * @param {Camera} shadowCamera - The shadow camera. + * @param {Matrix4} shadowMatrix - The target shadow matrix. + * @param {Frustum} frustum - The target frustum. + * @param {Vector4} [viewport] - The viewport within the shadow atlas. + */ + private _updateMatrix; + /** + * Returns a viewport definition for the given viewport index. + * + * @param {number} viewportIndex - The viewport index. + * @return {Vector4} The viewport. + */ + getViewport(viewportIndex: number): Vector4; + /** + * Returns the frame extends. + * + * @return {Vector2} The frame extends. + */ + getFrameExtents(): Vector2; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + */ + dispose(): void; + /** + * Copies the values of the given light shadow instance to this instance. + * + * @param {LightShadow} source - The light shadow to copy. + * @return {LightShadow} A reference to this light shadow instance. + */ + copy(source: LightShadow): LightShadow; + /** + * Returns a new light shadow instance with copied values from this instance. + * + * @return {LightShadow} A clone of this instance. + */ + clone(): LightShadow; + /** + * Serializes the light shadow into JSON. + * + * @return {Object} A JSON object representing the serialized light shadow. + * @see {@link ObjectLoader#parse} + */ + toJSON(): Object; +} +import { Vector2 } from '../math/Vector2.js'; +import { Matrix4 } from '../math/Matrix4.js'; +import { Frustum } from '../math/Frustum.js'; +import { Vector4 } from '../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/PointLight.d.ts b/jsdoc-testing/jsdoc/src/lights/PointLight.d.ts new file mode 100644 index 000000000..f42ec0f7c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/PointLight.d.ts @@ -0,0 +1,70 @@ +/** + * A light that gets emitted from a single point in all directions. A common + * use case for this is to replicate the light emitted from a bare + * lightbulb. + * + * This light can cast shadows - see the {@link PointLightShadow} for details. + * + * ```js + * const light = new THREE.PointLight( 0xff0000, 1, 100 ); + * light.position.set( 50, 50, 50 ); + * scene.add( light ); + * ``` + * + * @augments Light + */ +export class PointLight extends Light { + /** + * Constructs a new point light. + * + * @param {(number|Color|string)} [color=0xffffff] - The light's color. + * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd). + * @param {number} [distance=0] - Maximum range of the light. `0` means no limit. + * @param {number} [decay=2] - The amount the light dims along the distance of the light. + */ + constructor(color?: (number | Color | string), intensity?: number, distance?: number, decay?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPointLight: boolean; + /** + * When distance is zero, light will attenuate according to inverse-square + * law to infinite distance. When distance is non-zero, light will attenuate + * according to inverse-square law until near the distance cutoff, where it + * will then attenuate quickly and smoothly to 0. Inherently, cutoffs are not + * physically correct. + * + * @type {number} + * @default 0 + */ + distance: number; + /** + * The amount the light dims along the distance of the light. In context of + * physically-correct rendering the default value should not be changed. + * + * @type {number} + * @default 2 + */ + decay: number; + /** + * This property holds the light's shadow configuration. + * + * @type {PointLightShadow} + */ + shadow: PointLightShadow; + set power(power: number); + /** + * The light's power. Power is the luminous power of the light measured in lumens (lm). + * Changing the power will also change the light's intensity. + * + * @type {number} + */ + get power(): number; + copy(source: any, recursive: any): this; +} +import { Light } from './Light.js'; +import { PointLightShadow } from './PointLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts new file mode 100644 index 000000000..9157a63b8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts @@ -0,0 +1,20 @@ +/** + * Represents the shadow configuration of point lights. + * + * @augments LightShadow + */ +export class PointLightShadow extends LightShadow { + /** + * Constructs a new point light shadow. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPointLightShadow: boolean; +} +import { LightShadow } from './LightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts b/jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts new file mode 100644 index 000000000..6d4b7b657 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts @@ -0,0 +1,68 @@ +/** + * This class emits light uniformly across the face a rectangular plane. + * This light type can be used to simulate light sources such as bright + * windows or strip lighting. + * + * Important Notes: + * + * - There is no shadow support. + * - Only PBR materials are supported. + * - You have to include `RectAreaLightUniformsLib` (`WebGLRenderer`) or `RectAreaLightTexturesLib` (`WebGPURenderer`) + * into your app and init the uniforms/textures. + * + * ```js + * RectAreaLightUniformsLib.init(); // only relevant for WebGLRenderer + * THREE.RectAreaLightNode.setLTC( RectAreaLightTexturesLib.init() ); // only relevant for WebGPURenderer + * + * const intensity = 1; const width = 10; const height = 10; + * const rectLight = new THREE.RectAreaLight( 0xffffff, intensity, width, height ); + * rectLight.position.set( 5, 5, 0 ); + * rectLight.lookAt( 0, 0, 0 ); + * scene.add( rectLight ) + * ``` + * + * @augments Light + */ +export class RectAreaLight extends Light { + /** + * Constructs a new area light. + * + * @param {(number|Color|string)} [color=0xffffff] - The light's color. + * @param {number} [intensity=1] - The light's strength/intensity. + * @param {number} [width=10] - The width of the light. + * @param {number} [height=10] - The height of the light. + */ + constructor(color?: (number | Color | string), intensity?: number, width?: number, height?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRectAreaLight: boolean; + /** + * The width of the light. + * + * @type {number} + * @default 10 + */ + width: number; + /** + * The height of the light. + * + * @type {number} + * @default 10 + */ + height: number; + set power(power: number); + /** + * The light's power. Power is the luminous power of the light measured in lumens (lm). + * Changing the power will also change the light's intensity. + * + * @type {number} + */ + get power(): number; + copy(source: any): this; +} +import { Light } from './Light.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts b/jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts new file mode 100644 index 000000000..1197fdf27 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts @@ -0,0 +1,116 @@ +/** + * This light gets emitted from a single point in one direction, along a cone + * that increases in size the further from the light it gets. + * + * This light can cast shadows - see the {@link SpotLightShadow} for details. + * + * ```js + * // white spotlight shining from the side, modulated by a texture + * const spotLight = new THREE.SpotLight( 0xffffff ); + * spotLight.position.set( 100, 1000, 100 ); + * spotLight.map = new THREE.TextureLoader().load( url ); + * + * spotLight.castShadow = true; + * spotLight.shadow.mapSize.width = 1024; + * spotLight.shadow.mapSize.height = 1024; + * spotLight.shadow.camera.near = 500; + * spotLight.shadow.camera.far = 4000; + * spotLight.shadow.camera.fov = 30;s + * ``` + * + * @augments Light + */ +export class SpotLight extends Light { + /** + * Constructs a new spot light. + * + * @param {(number|Color|string)} [color=0xffffff] - The light's color. + * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd). + * @param {number} [distance=0] - Maximum range of the light. `0` means no limit. + * @param {number} [angle=Math.PI/3] - Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. + * @param {number} [penumbra=0] - Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`. + * @param {number} [decay=2] - The amount the light dims along the distance of the light. + */ + constructor(color?: (number | Color | string), intensity?: number, distance?: number, angle?: number, penumbra?: number, decay?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSpotLight: boolean; + /** + * The spot light points from its position to the + * target's position. + * + * For the target's position to be changed to anything other + * than the default, it must be added to the scene. + * + * It is also possible to set the target to be another 3D object + * in the scene. The light will now track the target object. + * + * @type {Object3D} + */ + target: Object3D; + /** + * Maximum range of the light. `0` means no limit. + * + * @type {number} + * @default 0 + */ + distance: number; + /** + * Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. + * + * @type {number} + * @default Math.PI/3 + */ + angle: number; + /** + * Percent of the spotlight cone that is attenuated due to penumbra. + * Value range is `[0,1]`. + * + * @type {number} + * @default 0 + */ + penumbra: number; + /** + * The amount the light dims along the distance of the light. In context of + * physically-correct rendering the default value should not be changed. + * + * @type {number} + * @default 2 + */ + decay: number; + /** + * A texture used to modulate the color of the light. The spot light + * color is mixed with the RGB value of this texture, with a ratio + * corresponding to its alpha value. The cookie-like masking effect is + * reproduced using pixel values (0, 0, 0, 1-cookie_value). + * + * *Warning*: This property is disabled if {@link Object3D#castShadow} is set to `false`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * This property holds the light's shadow configuration. + * + * @type {SpotLightShadow} + */ + shadow: SpotLightShadow; + set power(power: number); + /** + * The light's power. Power is the luminous power of the light measured in lumens (lm). + * Changing the power will also change the light's intensity. + * + * @type {number} + */ + get power(): number; + copy(source: any, recursive: any): this; +} +import { Light } from './Light.js'; +import { Object3D } from '../core/Object3D.js'; +import { SpotLightShadow } from './SpotLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts new file mode 100644 index 000000000..0de4c95b0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts @@ -0,0 +1,37 @@ +/** + * Represents the shadow configuration of directional lights. + * + * @augments LightShadow + */ +export class SpotLightShadow extends LightShadow { + /** + * Constructs a new spot light shadow. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSpotLightShadow: boolean; + /** + * Used to focus the shadow camera. The camera's field of view is set as a + * percentage of the spotlight's field-of-view. Range is `[0, 1]`. + * + * @type {number} + * @default 1 + */ + focus: number; + /** + * Texture aspect ratio. + * + * @type {number} + * @default 1 + */ + aspect: number; + updateMatrices(light: any): void; + copy(source: any): this; +} +import { LightShadow } from './LightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SunLight.d.ts b/jsdoc-testing/jsdoc/src/lights/SunLight.d.ts new file mode 100644 index 000000000..a89ca7861 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/SunLight.d.ts @@ -0,0 +1,48 @@ +/** + * A sun-like light that gets emitted in a specific direction, with rays that + * are all parallel, and casts cascaded shadow maps via {@link SunLightShadow}, + * suited for lighting large scenes. + * + * Unlike {@link DirectionalLight}, the light has no target: like + * {@link HemisphereLight}, its direction is defined by its position. The + * light shines from its position towards the origin and points straight + * down by default. + * + * ```js + * const sun = new SunLight( 0xfff2e3, 3 ); + * sun.position.set( 1, 1, 1 ); + * sun.castShadow = true; + * scene.add( sun ); + * ``` + * + * This light is only supported by `WebGLRenderer`. When using `WebGPURenderer`, + * use {@link DirectionalLight} with `CSMShadowNode` instead. + * + * @augments Light + */ +export class SunLight extends Light { + /** + * Constructs a new sun light. + * + * @param {(number|Color|string)} [color=0xffffff] - The light's color. + * @param {number} [intensity=1] - The light's strength/intensity. + */ + constructor(color?: (number | Color | string), intensity?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSunLight: boolean; + /** + * This property holds the light's shadow configuration. + * + * @type {SunLightShadow} + */ + shadow: SunLightShadow; + copy(source: any): this; +} +import { Light } from './Light.js'; +import { SunLightShadow } from './SunLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts new file mode 100644 index 000000000..b61d245ab --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts @@ -0,0 +1,67 @@ +/** + * Represents the shadow configuration of {@link SunLight}, using four + * cascaded shadow maps (CSM). + * + * The shadow camera projection is fitted automatically to slices of the view + * frustum, up to a distance of `camera.far` (or the view camera's far plane, + * whichever is smaller), and adjacent cascades blend into each other over a + * small depth range. `camera.left/right/top/bottom` are ignored. + * + * The default `mapSize` is `1024x1024` per cascade. + * + * @augments LightShadow + */ +export class SunLightShadow extends LightShadow { + /** + * Constructs a new sun light shadow. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSunLightShadow: boolean; + _cameras: OrthographicCamera[]; + _matrices: Matrix4[]; + _frustums: Frustum[]; + _cascadeSplits: any[]; + _cascadeData: Vector4[]; + /** + * Returns the shadow camera of the given cascade. + * + * @param {number} [cascadeIndex=0] - The cascade index. + * @return {OrthographicCamera} The shadow camera. + */ + getCamera(cascadeIndex?: number): OrthographicCamera; + /** + * Returns the shadow matrix of the given cascade. + * + * @param {number} [cascadeIndex=0] - The cascade index. + * @return {Matrix4} The shadow matrix. + */ + getMatrix(cascadeIndex?: number): Matrix4; + /** + * Returns the shadow camera frustum of the given cascade. Used internally by + * the renderer to cull objects. + * + * @param {number} [cascadeIndex=0] - The cascade index. + * @return {Frustum} The shadow camera frustum. + */ + getFrustum(cascadeIndex?: number): Frustum; + /** + * Update the matrices for the cascade cameras and shadows, used internally + * by the renderer. + * + * @param {Light} light - The light for which the shadow is being rendered. + * @param {Camera} viewCamera - The camera the scene is rendered with. + */ + updateMatrices(light: Light, viewCamera: Camera): void; +} +import { LightShadow } from './LightShadow.js'; +import { OrthographicCamera } from '../cameras/OrthographicCamera.js'; +import { Matrix4 } from '../math/Matrix4.js'; +import { Frustum } from '../math/Frustum.js'; +import { Vector4 } from '../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts b/jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts new file mode 100644 index 000000000..0e372ff20 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts @@ -0,0 +1,18 @@ +export default IESSpotLight; +/** + * A IES version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. + * + * @augments SpotLight + */ +declare class IESSpotLight extends SpotLight { + /** + * The IES map. It's a lookup table that stores normalized attenuation factors + * (0.0 to 1.0) that represent the light's intensity at a specific angle. + * + * @type {?Texture} + * @default null + */ + iesMap: Texture | null; + copy(source: any, recursive: any): this; +} +import { SpotLight } from '../SpotLight.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts b/jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts new file mode 100644 index 000000000..f561855ff --- /dev/null +++ b/jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts @@ -0,0 +1,17 @@ +export default ProjectorLight; +/** + * A projector light version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. + * + * @augments SpotLight + */ +declare class ProjectorLight extends SpotLight { + /** + * Aspect ratio of the light. Set to `null` to use the texture aspect ratio. + * + * @type {?number} + * @default null + */ + aspect: number | null; + copy(source: any, recursive: any): this; +} +import { SpotLight } from '../SpotLight.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts new file mode 100644 index 000000000..4bed37855 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts @@ -0,0 +1,32 @@ +/** + * Class for loading animation clips in the JSON format. The files are internally + * loaded via {@link FileLoader}. + * + * ```js + * const loader = new THREE.AnimationLoader(); + * const animations = await loader.loadAsync( 'animations/animation.js' ); + * ``` + * + * @augments Loader + */ +export class AnimationLoader extends Loader { + /** + * Starts loading from the given URL and pass the loaded animations as an array + * holding instances of {@link AnimationClip} to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Array)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Array) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given JSON object and returns an array of animation clips. + * + * @param {Object} json - The serialized animation clips. + * @return {Array} The parsed animation clips. + */ + parse(json: Object): Array; +} +import { Loader } from './Loader.js'; +import { AnimationClip } from '../animation/AnimationClip.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts new file mode 100644 index 000000000..c9c2c4c2c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts @@ -0,0 +1,30 @@ +/** + * Class for loading audio buffers. Audios are internally + * loaded via {@link FileLoader}. + * + * ```js + * const audioListener = new THREE.AudioListener(); + * const ambientSound = new THREE.Audio( audioListener ); + * + * const loader = new THREE.AudioLoader(); + * const audioBuffer = await loader.loadAsync( 'audio/ambient_ocean.ogg' ); + * + * ambientSound.setBuffer( audioBuffer ); + * ambientSound.play(); + * ``` + * + * @augments Loader + */ +export class AudioLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded audio buffer + * to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(AudioBuffer)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: AudioBuffer) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; +} +import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts new file mode 100644 index 000000000..b85f471e0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts @@ -0,0 +1,35 @@ +/** + * Class for loading geometries. The files are internally + * loaded via {@link FileLoader}. + * + * ```js + * const loader = new THREE.BufferGeometryLoader(); + * const geometry = await loader.loadAsync( 'models/json/pressure.json' ); + * + * const material = new THREE.MeshBasicMaterial( { color: 0xF5F5F5 } ); + * const object = new THREE.Mesh( geometry, material ); + * scene.add( object ); + * ``` + * + * @augments Loader + */ +export class BufferGeometryLoader extends Loader { + /** + * Starts loading from the given URL and pass the loaded geometry to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given JSON object and returns a geometry. + * + * @param {Object} json - The serialized geometry. + * @return {BufferGeometry} The parsed geometry. + */ + parse(json: Object): BufferGeometry; +} +import { Loader } from './Loader.js'; +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts new file mode 100644 index 000000000..652d27243 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts @@ -0,0 +1,61 @@ +/** + * ~TexData + */ +export type CompressedTextureLoader = { + /** + * - The width of the base mip. + */ + width: number; + /** + * - The width of the base mip. + */ + height: number; + /** + * - Whether the data represent a cubemap or not. + */ + isCubemap: boolean; + /** + * - The mipmap count. + */ + mipmapCount: number; + /** + * - An array holding the mipmaps. + * Each entry holds the data and the dimensions for each level. + */ + mipmaps: Array<{ + data: TypedArray; + width: number; + height: number; + }>; + /** + * - The texture format. + */ + format: number; +}; +/** + * Abstract base class for loading compressed texture formats S3TC, ASTC or ETC. + * Textures are internally loaded via {@link FileLoader}. + * + * Derived classes have to implement the `parse()` method which holds the parsing + * for the respective format. + * + * @abstract + * @augments Loader + */ +export class CompressedTextureLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded compressed texture + * to the `onLoad()` callback. The method also returns a new texture object which can + * directly be used for material creation. If you do it this way, the texture + * may pop up in your scene once the respective loading process is finished. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(CompressedTexture)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + * @return {CompressedTexture} The compressed texture. + */ + load(url: string, onLoad: (arg0: CompressedTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): CompressedTexture; +} +import { Loader } from './Loader.js'; +import { CompressedTexture } from '../textures/CompressedTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts new file mode 100644 index 000000000..8ac41df2c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts @@ -0,0 +1,45 @@ +/** + * Class for loading cube textures. Images are internally loaded via {@link ImageLoader}. + * + * The loader returns an instance of {@link CubeTexture} and expects the cube map to + * be defined as six separate images representing the sides of a cube. Other cube map definitions + * like vertical and horizontal cross, column and row layouts are not supported. + * + * Note that, by convention, cube maps are specified in a coordinate system + * in which positive-x is to the right when looking up the positive-z axis -- + * in other words, using a left-handed coordinate system. Since three.js uses + * a right-handed coordinate system, environment maps used in three.js will + * have pos-x and neg-x swapped. + * + * The loaded cube texture is in sRGB color space. Meaning {@link Texture#colorSpace} + * is set to `SRGBColorSpace` by default. + * + * ```js + * const loader = new THREE.CubeTextureLoader().setPath( 'textures/cubeMaps/' ); + * const cubeTexture = await loader.loadAsync( [ + * 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' + * ] ); + * scene.background = cubeTexture; + * ``` + * + * @augments Loader + */ +export class CubeTextureLoader extends Loader { + /** + * Starts loading from the given URL and pass the fully loaded cube texture + * to the `onLoad()` callback. The method also returns a new cube texture object which can + * directly be used for material creation. If you do it this way, the cube texture + * may pop up in your scene once the respective loading process is finished. + * + * @param {Array} urls - Array of 6 URLs to images, one for each side of the + * cube texture. The urls should be specified in the following order: pos-x, + * neg-x, pos-y, neg-y, pos-z, neg-z. An array of data URIs are allowed as well. + * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Unsupported in this loader. + * @param {onErrorCallback} onError - Executed when errors occur. + * @return {CubeTexture} The cube texture. + */ + load(urls: Array, onLoad: (arg0: CubeTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): CubeTexture; +} +import { Loader } from './Loader.js'; +import { CubeTexture } from '../textures/CubeTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts new file mode 100644 index 000000000..62f05e621 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts @@ -0,0 +1,109 @@ +/** + * ~TexData + */ +export type DataTextureLoader = { + /** + * - An object holding width, height and the texture data. + */ + image?: Object | undefined; + /** + * - The width of the base mip. + */ + width?: number | undefined; + /** + * - The width of the base mip. + */ + height?: number | undefined; + /** + * - The texture data. + */ + data?: TypedArray; + /** + * - The texture format. + */ + format?: number | undefined; + /** + * - The texture type. + */ + type?: number | undefined; + /** + * - If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. + */ + flipY?: boolean | undefined; + /** + * - The wrapS value. + */ + wrapS?: number | undefined; + /** + * - The wrapT value. + */ + wrapT?: number | undefined; + /** + * - The anisotropy value. + */ + anisotropy?: number | undefined; + /** + * - Whether to generate mipmaps or not. + */ + generateMipmaps?: boolean | undefined; + /** + * - The color space. + */ + colorSpace?: string | undefined; + /** + * - The mag filter. + */ + magFilter?: number | undefined; + /** + * - The min filter. + */ + minFilter?: number | undefined; + /** + * - The mipmaps. + */ + mipmaps?: Object[] | undefined; +}; +/** + * Abstract base class for loading binary texture formats RGBE, EXR or TGA. + * Textures are internally loaded via {@link FileLoader}. + * + * Derived classes have to implement the `parse()` method which holds the parsing + * for the respective format. + * + * @abstract + * @augments Loader + */ +export class DataTextureLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded data texture + * to the `onLoad()` callback. The method also returns a new texture object which can + * directly be used for material creation. If you do it this way, the texture + * may pop up in your scene once the respective loading process is finished. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + * @return {DataTexture} The data texture. + */ + load(url: string, onLoad: (arg0: DataTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): DataTexture; + /** + * Parses the given buffer and returns a configured data texture. Use this method + * for parsing texture data that is already in memory (e.g. drag and drop or data + * loaded from a server) without going through {@link DataTextureLoader#load}. + * + * @param {ArrayBuffer} buffer - The raw texture data. + * @return {DataTexture} The data texture. + */ + createDataTexture(buffer: ArrayBuffer): DataTexture; + /** + * Applies the given parsed texture data to the given data texture. + * + * @private + * @param {DataTexture} texture - The data texture. + * @param {DataTextureLoader~TexData} texData - The parsed texture data. + */ + private _applyTexData; +} +import { Loader } from './Loader.js'; +import { DataTexture } from '../textures/DataTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts new file mode 100644 index 000000000..bdad7b69a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts @@ -0,0 +1,68 @@ +/** + * A low level class for loading resources with the Fetch API, used internally by + * most loaders. It can also be used directly to load any file type that does + * not have a loader. + * + * This loader supports caching. If you want to use it, add `THREE.Cache.enabled = true;` + * once to your application. + * + * ```js + * const loader = new THREE.FileLoader(); + * const data = await loader.loadAsync( 'example.txt' ); + * ``` + * + * @augments Loader + */ +export class FileLoader extends Loader { + /** + * The expected mime type. Valid values can be found + * [here](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype) + * + * @type {string} + */ + mimeType: string; + /** + * The expected response type. + * + * @type {('arraybuffer'|'blob'|'document'|'json'|'')} + * @default '' + */ + responseType: ("arraybuffer" | "blob" | "document" | "json" | ""); + /** + * Used for aborting requests. + * + * @private + * @type {AbortController} + */ + private _abortController; + /** + * Starts loading from the given URL and pass the loaded response to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(any)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. + * @param {onErrorCallback} [onError] - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: any) => any, onProgress?: onProgressCallback, onError?: onErrorCallback): void; + /** + * Sets the expected response type. + * + * @param {('arraybuffer'|'blob'|'document'|'json'|'')} value - The response type. + * @return {FileLoader} A reference to this file loader. + */ + setResponseType(value: ("arraybuffer" | "blob" | "document" | "json" | "")): FileLoader; + /** + * Sets the expected mime type of the loaded file. + * + * @param {string} value - The mime type. + * @return {FileLoader} A reference to this file loader. + */ + setMimeType(value: string): FileLoader; + /** + * Aborts ongoing fetch requests. + * + * @return {FileLoader} A reference to this instance. + */ + abort(): FileLoader; +} +import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts new file mode 100644 index 000000000..c060ff5b6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts @@ -0,0 +1,79 @@ +/** + * A loader for loading images as an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap). + * An `ImageBitmap` provides an asynchronous and resource efficient pathway to prepare + * textures for rendering. + * + * Note that {@link Texture#flipY} and {@link Texture#premultiplyAlpha} are ignored with image bitmaps. + * These options need to be configured via {@link ImageBitmapLoader#setOptions} prior to loading, + * unlike regular images which can be configured on the Texture to set these options on GPU upload instead. + * + * To match the default behaviour of {@link Texture}, the following options are needed: + * + * ```js + * { imageOrientation: 'flipY', premultiplyAlpha: 'none' } + * ``` + * + * Also note that unlike {@link FileLoader}, this loader will only avoid multiple concurrent requests to the same URL if {@link Cache} is enabled. + * + * ```js + * const loader = new THREE.ImageBitmapLoader(); + * loader.setOptions( { imageOrientation: 'flipY' } ); // set options if needed + * const imageBitmap = await loader.loadAsync( 'image.png' ); + * + * const texture = new THREE.Texture( imageBitmap ); + * texture.needsUpdate = true; + * ``` + * + * @augments Loader + */ +export class ImageBitmapLoader extends Loader { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isImageBitmapLoader: boolean; + /** + * Represents the loader options. + * + * @type {Object} + * @default {premultiplyAlpha:'none'} + */ + options: Object; + /** + * Used for aborting requests. + * + * @private + * @type {AbortController} + */ + private _abortController; + /** + * Sets the given loader options. The structure of the object must match the `options` parameter of + * [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap). + * + * Note: When caching is enabled, the cache key is based on the URL only. Loading the same URL with + * different options will return the cached result of the first request. + * + * @param {Object} options - The loader options to set. + * @return {ImageBitmapLoader} A reference to this image bitmap loader. + */ + setOptions(options: Object): ImageBitmapLoader; + /** + * Starts loading from the given URL and pass the loaded image bitmap to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Unsupported in this loader. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: ImageBitmap) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Aborts ongoing fetch requests. + * + * @return {ImageBitmapLoader} A reference to this instance. + */ + abort(): ImageBitmapLoader; +} +import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts new file mode 100644 index 000000000..0b4296abc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts @@ -0,0 +1,29 @@ +/** + * A loader for loading images. The class loads images with the HTML `Image` API. + * + * ```js + * const loader = new THREE.ImageLoader(); + * const image = await loader.loadAsync( 'image.png' ); + * ``` + * Please note that `ImageLoader` has dropped support for progress + * events in `r84`. For an `ImageLoader` that supports progress events, see + * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639). + * + * @augments Loader + */ +export class ImageLoader extends Loader { + /** + * Starts loading from the given URL and passes the loaded image + * to the `onLoad()` callback. The method also returns a new `Image` object which can + * directly be used for texture creation. If you do it this way, the texture + * may pop up in your scene once the respective loading process is finished. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Image)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Unsupported in this loader. + * @param {onErrorCallback} onError - Executed when errors occur. + * @return {Image} The image. + */ + load(url: string, onLoad: (arg0: new (width?: number, height?: number) => HTMLImageElement) => any, onProgress: onProgressCallback, onError: onErrorCallback): new (width?: number, height?: number) => HTMLImageElement; +} +import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/Loader.d.ts b/jsdoc-testing/jsdoc/src/loaders/Loader.d.ts new file mode 100644 index 000000000..a1e704eb9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/Loader.d.ts @@ -0,0 +1,141 @@ +/** + * Callback for onProgress in loaders. + */ +export type onProgressCallback = (event: ProgressEvent) => any; +/** + * Callback for onError in loaders. + */ +export type onErrorCallback = (error: Error) => any; +/** + * Abstract base class for loaders. + * + * @abstract + */ +export class Loader { + /** + * Constructs a new loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * The loading manager. + * + * @type {LoadingManager} + * @default DefaultLoadingManager + */ + manager: LoadingManager; + /** + * The crossOrigin string to implement CORS for loading the url from a + * different domain that allows CORS. + * + * @type {string} + * @default 'anonymous' + */ + crossOrigin: string; + /** + * Whether the XMLHttpRequest uses credentials. + * + * @type {boolean} + * @default false + */ + withCredentials: boolean; + /** + * The base path from which the asset will be loaded. + * + * @type {string} + */ + path: string; + /** + * The base path from which additional resources like textures will be loaded. + * + * @type {string} + */ + resourcePath: string; + /** + * The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header) + * used in HTTP request. + * + * @type {Object} + */ + requestHeader: { + [x: string]: any; + }; + /** + * This method needs to be implemented by all concrete loaders. It holds the + * logic for loading assets from the backend. + * + * @abstract + * @param {string} url - The path/URL of the file to be loaded. + * @param {Function} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. + * @param {onErrorCallback} [onError] - Executed when errors occur. + */ + load(): void; + /** + * A async version of {@link Loader#load}. + * + * @param {string} url - The path/URL of the file to be loaded. + * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. + * @return {Promise} A Promise that resolves when the asset has been loaded. + */ + loadAsync(url: string, onProgress?: onProgressCallback): Promise; + /** + * This method needs to be implemented by all concrete loaders. It holds the + * logic for parsing the asset into three.js entities. + * + * @abstract + * @param {any} data - The data to parse. + */ + parse(): void; + /** + * Sets the `crossOrigin` String to implement CORS for loading the URL + * from a different domain that allows CORS. + * + * @param {string} crossOrigin - The `crossOrigin` value. + * @return {Loader} A reference to this instance. + */ + setCrossOrigin(crossOrigin: string): Loader; + /** + * Whether the XMLHttpRequest uses credentials such as cookies, authorization + * headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials). + * + * Note: This setting has no effect if you are loading files locally or from the same domain. + * + * @param {boolean} value - The `withCredentials` value. + * @return {Loader} A reference to this instance. + */ + setWithCredentials(value: boolean): Loader; + /** + * Sets the base path for the asset. + * + * @param {string} path - The base path. + * @return {Loader} A reference to this instance. + */ + setPath(path: string): Loader; + /** + * Sets the base path for dependent resources like textures. + * + * @param {string} resourcePath - The resource path. + * @return {Loader} A reference to this instance. + */ + setResourcePath(resourcePath: string): Loader; + /** + * Sets the given request header. + * + * @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header) + * for configuring the HTTP request. + * @return {Loader} A reference to this instance. + */ + setRequestHeader(requestHeader: Object): Loader; + /** + * This method can be implemented in loaders for aborting ongoing requests. + * + * @abstract + * @return {Loader} A reference to this instance. + */ + abort(): Loader; +} +export namespace Loader { + let DEFAULT_MATERIAL_NAME: string; +} diff --git a/jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts b/jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts new file mode 100644 index 000000000..ce241791d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts @@ -0,0 +1,22 @@ +/** + * A class with loader utility functions. + */ +export class LoaderUtils { + /** + * Extracts the base URL from the given URL. + * + * @param {string} url -The URL to extract the base URL from. + * @return {string} The extracted base URL. + */ + static extractUrlBase(url: string): string; + /** + * Resolves relative URLs against the given path. Absolute paths, data urls, + * and blob URLs will be returned as is. Invalid URLs will return an empty + * string. + * + * @param {string} url -The URL to resolve. + * @param {string} path - The base path for relative URLs to be resolved against. + * @return {string} The resolved URL. + */ + static resolveURL(url: string, path: string): string; +} diff --git a/jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts new file mode 100644 index 000000000..9dda62756 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts @@ -0,0 +1,72 @@ +/** + * Class for loading materials. The files are internally + * loaded via {@link FileLoader}. + * + * ```js + * const loader = new THREE.MaterialLoader(); + * const material = await loader.loadAsync( 'material.json' ); + * ``` + * This loader does not support node materials. Use {@link NodeMaterialLoader} instead. + * + * @augments Loader + */ +export class MaterialLoader extends Loader { + /** + * Creates a material for the given type. + * + * @static + * @param {string} type - The material type. + * @return {Material} The new material. + */ + static createMaterialFromType(type: string): Material; + /** + * Registers the given material at the internal + * material library. + * + * @static + * @param {string} type - The material type. + * @param {Material.constructor} materialClass - The material class. + */ + static registerMaterial(type: string, materialClass: Material.constructor): void; + /** + * A dictionary holding textures used by the material. + * + * @type {Object} + */ + textures: { + [x: string]: Texture; + }; + /** + * Starts loading from the given URL and pass the loaded material to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Material)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Material) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Parses the given JSON object and returns a material. + * + * @param {Object} json - The serialized material. + * @return {Material} The parsed material. + */ + parse(json: Object): Material; + /** + * Textures are not embedded in the material JSON so they have + * to be injected before the loading process starts. + * + * @param {Object} value - A dictionary holding textures for material properties. + * @return {MaterialLoader} A reference to this material loader. + */ + setTextures(value: Object): MaterialLoader; + /** + * Creates a material for the given type. + * + * @param {string} type - The material type. + * @return {Material} The new material. + */ + createMaterialFromType(type: string): Material; +} +import { Loader } from './Loader.js'; +import { Material } from '../materials/Materials.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts new file mode 100644 index 000000000..79e15d582 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts @@ -0,0 +1,91 @@ +/** + * A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4). + * The files are internally loaded via {@link FileLoader}. + * + * ```js + * const loader = new THREE.ObjectLoader(); + * const obj = await loader.loadAsync( 'models/json/example.json' ); + * scene.add( obj ); + * + * // Alternatively, to parse a previously loaded JSON structure + * const object = await loader.parseAsync( a_json_object ); + * scene.add( object ); + * ``` + * + * @augments Loader + */ +export class ObjectLoader extends Loader { + /** + * Registers the given geometry at the internal + * geometry library. + * + * @static + * @param {string} type - The geometry type. + * @param {BufferGeometry.constructor} geometryClass - The geometry class. + */ + static registerGeometry(type: string, geometryClass: BufferGeometry.constructor): void; + /** + * Constructs a new object loader. + * + * @param {LoadingManager} [manager] - The loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Starts loading from the given URL and pass the loaded 3D object to the `onLoad()` callback. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Object3D)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @param {onErrorCallback} onError - Executed when errors occur. + */ + load(url: string, onLoad: (arg0: Object3D) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; + /** + * Async version of {@link ObjectLoader#load}. + * + * @async + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {onProgressCallback} onProgress - Executed while the loading is in progress. + * @return {Promise} A Promise that resolves with the loaded 3D object. + */ + loadAsync(url: string, onProgress: onProgressCallback): Promise; + /** + * Parses the given JSON. This is used internally by {@link ObjectLoader#load} + * but can also be used directly to parse a previously loaded JSON structure. + * + * @param {Object} json - The serialized 3D object. + * @param {onLoad} onLoad - Executed when all resources (e.g. textures) have been fully loaded. + * @return {Object3D} The parsed 3D object. + */ + parse(json: Object, onLoad: any): Object3D; + /** + * Async version of {@link ObjectLoader#parse}. + * + * @param {Object} json - The serialized 3D object. + * @return {Promise} A Promise that resolves with the parsed 3D object. + */ + parseAsync(json: Object): Promise; + parseShapes(json: any): {}; + parseSkeletons(json: any, object: any): {}; + parseGeometries(json: any, shapes: any): {}; + parseMaterials(json: any, textures: any): {}; + parseAnimations(json: any): {}; + parseImages(json: any, onLoad: any): {}; + parseImagesAsync(json: any): Promise<{}>; + parseTextures(json: any, images: any): {}; + parseObject(data: any, geometries: any, materials: any, textures: any, animations: any): Object3D | Sprite | LOD | Mesh | SkinnedMesh | InstancedMesh | BatchedMesh | Line | Points | OrthographicCamera | PerspectiveCamera; + bindSkeletons(object: any, skeletons: any): void; + bindLightTargets(object: any): void; +} +import { Loader } from './Loader.js'; +import { Object3D } from '../core/Object3D.js'; +import { Sprite } from '../objects/Sprite.js'; +import { LOD } from '../objects/LOD.js'; +import { Mesh } from '../objects/Mesh.js'; +import { SkinnedMesh } from '../objects/SkinnedMesh.js'; +import { InstancedMesh } from '../objects/InstancedMesh.js'; +import { BatchedMesh } from '../objects/BatchedMesh.js'; +import { Line } from '../objects/Line.js'; +import { Points } from '../objects/Points.js'; +import { OrthographicCamera } from '../cameras/OrthographicCamera.js'; +import { PerspectiveCamera } from '../cameras/PerspectiveCamera.js'; +import { LoadingManager } from './LoadingManager.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts new file mode 100644 index 000000000..8069b4948 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts @@ -0,0 +1,33 @@ +/** + * Class for loading textures. Images are internally + * loaded via {@link ImageLoader}. + * + * ```js + * const loader = new THREE.TextureLoader(); + * const texture = await loader.loadAsync( 'textures/land_ocean_ice_cloud_2048.jpg' ); + * + * const material = new THREE.MeshBasicMaterial( { map:texture } ); + * ``` + * Please note that `TextureLoader` has dropped support for progress + * events in `r84`. For a `TextureLoader` that supports progress events, see + * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145). + * + * @augments Loader + */ +export class TextureLoader extends Loader { + /** + * Starts loading from the given URL and pass the fully loaded texture + * to the `onLoad()` callback. The method also returns a new texture object which can + * directly be used for material creation. If you do it this way, the texture + * may pop up in your scene once the respective loading process is finished. + * + * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. + * @param {function(Texture)} onLoad - Executed when the loading process has been finished. + * @param {onProgressCallback} onProgress - Unsupported in this loader. + * @param {onErrorCallback} onError - Executed when errors occur. + * @return {Texture} The texture. + */ + load(url: string, onLoad: (arg0: Texture) => any, onProgress: onProgressCallback, onError: onErrorCallback): Texture; +} +import { Loader } from './Loader.js'; +import { Texture } from '../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts new file mode 100644 index 000000000..58b362d35 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts @@ -0,0 +1,84 @@ +export default NodeLoader; +/** + * A loader for loading node objects in the three.js JSON Object/Scene format. + * + * @augments Loader + */ +declare class NodeLoader extends Loader { + /** + * Represents a dictionary of textures. + * + * @type {Object} + */ + textures: { + [x: string]: Texture; + }; + /** + * Represents a dictionary of node types. + * + * @type {Object} + */ + nodes: { + [x: string]: Node.constructor; + }; + /** + * Loads the node definitions from the given URL. + * + * @param {string} url - The path/URL of the file to be loaded. + * @param {Function} onLoad - Will be called when load completes. + * @param {Function} onProgress - Will be called while load progresses. + * @param {Function} onError - Will be called when errors are thrown during the loading process. + */ + load(url: string, onLoad: Function, onProgress: Function, onError: Function): void; + /** + * Parse the node dependencies for the loaded node. + * + * @param {Array} [json] - The JSON definition + * @return {Object} A dictionary with node dependencies. + */ + parseNodes(json?: Array): { + [x: string]: Node; + }; + /** + * Parses the node from the given JSON. + * + * @param {Object} json - The JSON definition + * @param {string} json.type - The node type. + * @param {string} json.uuid - The node UUID. + * @param {Array} [json.nodes] - The node dependencies. + * @param {Object} [json.meta] - The meta data. + * @return {Node} The parsed node. + */ + parse(json: { + type: string; + uuid: string; + nodes?: Object[] | undefined; + meta?: Object | undefined; + }): Node; + /** + * Defines the dictionary of textures. + * + * @param {Object} value - The texture library defines as ``. + * @return {NodeLoader} A reference to this loader. + */ + setTextures(value: { + [x: string]: Texture; + }): NodeLoader; + /** + * Defines the dictionary of node types. + * + * @param {Object} value - The node library defined as ``. + * @return {NodeLoader} A reference to this loader. + */ + setNodes(value: { + [x: string]: Node.constructor; + }): NodeLoader; + /** + * Creates a node object from the given type. + * + * @param {string} type - The node type. + * @return {Node} The created node instance. + */ + createNodeFromType(type: string): Node; +} +import { Loader } from '../Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts new file mode 100644 index 000000000..cf350a240 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts @@ -0,0 +1,57 @@ +export default NodeMaterialLoader; +/** + * A special type of material loader for loading node materials. + * + * @augments MaterialLoader + */ +declare class NodeMaterialLoader extends MaterialLoader { + /** + * Represents a dictionary of node types. + * + * @type {Object} + */ + nodes: { + [x: string]: Node.constructor; + }; + /** + * Represents a dictionary of node material types. + * + * @type {Object} + */ + nodeMaterials: { + [x: string]: NodeMaterial.constructor; + }; + /** + * Parses the node material from the given JSON. + * + * @param {Object} json - The JSON definition + * @return {NodeMaterial}. The parsed material. + */ + parse(json: Object): NodeMaterial; + /** + * Defines the dictionary of node types. + * + * @param {Object} value - The node library defined as ``. + * @return {NodeLoader} A reference to this loader. + */ + setNodes(value: { + [x: string]: Node.constructor; + }): NodeLoader; + /** + * Defines the dictionary of node material types. + * + * @param {Object} value - The node material library defined as ``. + * @return {NodeLoader} A reference to this loader. + */ + setNodeMaterials(value: { + [x: string]: NodeMaterial.constructor; + }): NodeLoader; + /** + * Creates a node material from the given type. + * + * @param {string} type - The node material type. + * @return {Node} The created node material instance. + */ + createMaterialFromType(type: string): Node; +} +import { MaterialLoader } from '../../loaders/MaterialLoader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts new file mode 100644 index 000000000..b5954eab2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts @@ -0,0 +1,96 @@ +export default NodeObjectLoader; +/** + * A special type of object loader for loading 3D objects using + * node materials. + * + * @augments ObjectLoader + */ +declare class NodeObjectLoader extends ObjectLoader { + /** + * Constructs a new node object loader. + * + * @param {LoadingManager} [manager] - A reference to a loading manager. + */ + constructor(manager?: LoadingManager); + /** + * Represents a dictionary of node types. + * + * @type {Object} + */ + nodes: { + [x: string]: Node.constructor; + }; + /** + * Represents a dictionary of node material types. + * + * @type {Object} + */ + nodeMaterials: { + [x: string]: NodeMaterial.constructor; + }; + /** + * A reference to hold the `nodes` JSON property. + * + * @private + * @type {?Object[]} + */ + private _nodesJSON; + /** + * Defines the dictionary of node types. + * + * @param {Object} value - The node library defined as ``. + * @return {NodeObjectLoader} A reference to this loader. + */ + setNodes(value: { + [x: string]: Node.constructor; + }): NodeObjectLoader; + /** + * Defines the dictionary of node material types. + * + * @param {Object} value - The node material library defined as ``. + * @return {NodeObjectLoader} A reference to this loader. + */ + setNodeMaterials(value: { + [x: string]: NodeMaterial.constructor; + }): NodeObjectLoader; + /** + * Parses the node objects from the given JSON. + * + * @param {Object} json - The JSON definition + * @param {Function} onLoad - The onLoad callback function. + * @return {Object3D}. The parsed 3D object. + */ + parse(json: Object, onLoad: Function): Object3D; + /** + * Async version of {@link NodeObjectLoader#parse}. + * + * @param {Object} json - The JSON definition + * @return {Promise} A Promise that resolves with the parsed 3D object. + */ + parseAsync(json: Object): Promise; + /** + * Parses the node objects from the given JSON and textures. + * + * @param {Object[]} json - The JSON definition + * @param {Object} textures - The texture library. + * @return {Object}. The parsed nodes. + */ + parseNodes(json: Object[], textures: { + [x: string]: Texture; + }): { + [x: string]: Node; + }; + /** + * Parses the node objects from the given JSON and textures. + * + * @param {Object} json - The JSON definition + * @param {Object} textures - The texture library. + * @return {Object}. The parsed materials. + */ + parseMaterials(json: Object, textures: { + [x: string]: Texture; + }): { + [x: string]: NodeMaterial; + }; +} +import { ObjectLoader } from '../../loaders/ObjectLoader.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts new file mode 100644 index 000000000..b7fb9b69a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts @@ -0,0 +1,90 @@ +/** + * A material for rendering line primitives. + * + * Materials define the appearance of renderable 3D objects. + * + * ```js + * const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); + * ``` + * + * @augments Material + */ +export class LineBasicMaterial extends Material { + /** + * Constructs a new line basic material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineBasicMaterial: boolean; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * Sets the color of the lines using data from a texture. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * Controls line thickness or lines. + * + * Can only be used with {@link SVGRenderer}. WebGL and WebGPU + * ignore this setting and always render line primitives with a + * width of one pixel. + * + * @type {number} + * @default 1 + */ + linewidth: number; + /** + * Defines appearance of line ends. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('butt'|'round'|'square')} + * @default 'round' + */ + linecap: ("butt" | "round" | "square"); + /** + * Defines appearance of line joints. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + linejoin: ("round" | "bevel" | "miter"); + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts new file mode 100644 index 000000000..3cb1a34d8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts @@ -0,0 +1,49 @@ +/** + * A material for rendering line primitives. + * + * Materials define the appearance of renderable 3D objects. + * + * ```js + * const material = new THREE.LineDashedMaterial( { + * color: 0xffffff, + * scale: 1, + * dashSize: 3, + * gapSize: 1, + * } ); + * ``` + * + * @augments LineBasicMaterial + */ +export class LineDashedMaterial extends LineBasicMaterial { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineDashedMaterial: boolean; + /** + * The scale of the dashed part of a line. + * + * @type {number} + * @default 1 + */ + scale: number; + /** + * The size of the dash. This is both the gap with the stroke. + * + * @type {number} + * @default 3 + */ + dashSize: number; + /** + * The size of the gap. + * + * @type {number} + * @default 1 + */ + gapSize: number; + copy(source: any): this; +} +import { LineBasicMaterial } from './LineBasicMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/Material.d.ts b/jsdoc-testing/jsdoc/src/materials/Material.d.ts new file mode 100644 index 000000000..a559b6e84 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/Material.d.ts @@ -0,0 +1,508 @@ +/** + * Abstract base class for materials. + * + * Materials define the appearance of renderable 3D objects. + * + * @abstract + * @augments EventDispatcher + */ +export class Material extends EventDispatcher { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMaterial: boolean; + /** + * The UUID of the material. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * The name of the material. + * + * @type {string} + */ + name: string; + /** + * The type property is used for detecting the object type + * in context of serialization/deserialization. + * + * @type {string} + * @readonly + */ + readonly type: string; + /** + * Defines the blending type of the material. + * + * It must be set to `CustomBlending` if custom blending properties like + * {@link Material#blendSrc}, {@link Material#blendDst} or {@link Material#blendEquation} + * should have any effect. + * + * @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending)} + * @default NormalBlending + */ + blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); + /** + * Defines which side of faces will be rendered - front, back or both. + * + * @type {(FrontSide|BackSide|DoubleSide)} + * @default FrontSide + */ + side: (number | BackSide | DoubleSide); + /** + * If set to `true`, vertex colors should be used. + * + * The engine supports RGB and RGBA vertex colors depending on whether a three (RGB) or + * four (RGBA) component color buffer attribute is used. + * + * @type {boolean} + * @default false + */ + vertexColors: boolean; + /** + * Defines how transparent the material is. + * A value of `0.0` indicates fully transparent, `1.0` is fully opaque. + * + * If the {@link Material#transparent} is not set to `true`, + * the material will remain fully opaque and this value will only affect its color. + * + * @type {number} + * @default 1 + */ + opacity: number; + /** + * Defines whether this material is transparent. This has an effect on + * rendering as transparent objects need special treatment and are rendered + * after non-transparent objects. + * + * When set to true, the extent to which the material is transparent is + * controlled by {@link Material#opacity}. + * + * @type {boolean} + * @default false + */ + transparent: boolean; + /** + * Enables alpha hashed transparency, an alternative to {@link Material#transparent} or + * {@link Material#alphaTest}. The material will not be rendered if opacity is lower than + * a random threshold. Randomization introduces some grain or noise, but approximates alpha + * blending without the associated problems of sorting. Using TAA can reduce the resulting noise. + * + * @type {boolean} + * @default false + */ + alphaHash: boolean; + /** + * Defines the blending source factor. + * + * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default SrcAlphaFactor + */ + blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + /** + * Defines the blending destination factor. + * + * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default OneMinusSrcAlphaFactor + */ + blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + /** + * Defines the blending equation. + * + * @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} + * @default AddEquation + */ + blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); + /** + * Defines the blending source alpha factor. + * + * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default null + */ + blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + /** + * Defines the blending destination alpha factor. + * + * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default null + */ + blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + /** + * Defines the blending equation of the alpha channel. + * + * @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} + * @default null + */ + blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; + /** + * Represents the RGB values of the constant blend color. + * + * This property has only an effect when using custom blending with `ConstantColor` or `OneMinusConstantColor`. + * + * @type {Color} + * @default (0,0,0) + */ + blendColor: Color; + /** + * Represents the alpha value of the constant blend color. + * + * This property has only an effect when using custom blending with `ConstantAlpha` or `OneMinusConstantAlpha`. + * + * @type {number} + * @default 0 + */ + blendAlpha: number; + /** + * Defines the depth function. + * + * @type {(NeverDepth|AlwaysDepth|LessDepth|LessEqualDepth|EqualDepth|GreaterEqualDepth|GreaterDepth|NotEqualDepth)} + * @default LessEqualDepth + */ + depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); + /** + * Whether to have depth test enabled when rendering this material. + * When the depth test is disabled, the depth write will also be implicitly disabled. + * + * @type {boolean} + * @default true + */ + depthTest: boolean; + /** + * Whether rendering this material has any effect on the depth buffer. + * + * When drawing 2D overlays it can be useful to disable the depth writing in + * order to layer several things together without creating z-index artifacts. + * + * @type {boolean} + * @default true + */ + depthWrite: boolean; + /** + * The bit mask to use when writing to the stencil buffer. + * + * @type {number} + * @default 0xff + */ + stencilWriteMask: number; + /** + * The stencil comparison function to use. + * + * @type {NeverStencilFunc|LessStencilFunc|EqualStencilFunc|LessEqualStencilFunc|GreaterStencilFunc|NotEqualStencilFunc|GreaterEqualStencilFunc|AlwaysStencilFunc} + * @default AlwaysStencilFunc + */ + stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; + /** + * The value to use when performing stencil comparisons or stencil operations. + * + * @type {number} + * @default 0 + */ + stencilRef: number; + /** + * The bit mask to use when comparing against the stencil buffer. + * + * @type {number} + * @default 0xff + */ + stencilFuncMask: number; + /** + * Which stencil operation to perform when the comparison function returns `false`. + * + * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp} + * @default KeepStencilOp + */ + stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + /** + * Which stencil operation to perform when the comparison function returns + * `true` but the depth test fails. + * + * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp} + * @default KeepStencilOp + */ + stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + /** + * Which stencil operation to perform when the comparison function returns + * `true` and the depth test passes. + * + * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp} + * @default KeepStencilOp + */ + stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + /** + * Whether stencil operations are performed against the stencil buffer. In + * order to perform writes or comparisons against the stencil buffer this + * value must be `true`. + * + * @type {boolean} + * @default false + */ + stencilWrite: boolean; + /** + * User-defined clipping planes specified as THREE.Plane objects in world + * space. These planes apply to the objects this material is attached to. + * Points in space whose signed distance to the plane is negative are clipped + * (not rendered). This requires {@link WebGLRenderer#localClippingEnabled} to + * be `true`. + * + * @type {?Array} + * @default null + */ + clippingPlanes: Array | null; + /** + * Changes the behavior of clipping planes so that only their intersection is + * clipped, rather than their union. + * + * @type {boolean} + * @default false + */ + clipIntersection: boolean; + /** + * Defines whether to clip shadows according to the clipping planes specified + * on this material. + * + * @type {boolean} + * @default false + */ + clipShadows: boolean; + /** + * Defines which side of faces cast shadows. If `null`, the side casting shadows + * is determined as follows: + * + * - When {@link Material#side} is set to `FrontSide`, the back side cast shadows. + * - When {@link Material#side} is set to `BackSide`, the front side cast shadows. + * - When {@link Material#side} is set to `DoubleSide`, both sides cast shadows. + * + * @type {?(FrontSide|BackSide|DoubleSide)} + * @default null + */ + shadowSide: (number | BackSide | DoubleSide) | null; + /** + * Whether to render the material's color. + * + * This can be used in conjunction with {@link Object3D#renderOder} to create invisible + * objects that occlude other objects. + * + * @type {boolean} + * @default true + */ + colorWrite: boolean; + /** + * Override the renderer's default precision for this material. + * + * @type {?('highp'|'mediump'|'lowp')} + * @default null + */ + precision: ("highp" | "mediump" | "lowp") | null; + /** + * Whether to use polygon offset or not. When enabled, each fragment's depth value will + * be offset after it is interpolated from the depth values of the appropriate vertices. + * The offset is added before the depth test is performed and before the value is written + * into the depth buffer. + * + * Can be useful for rendering hidden-line images, for applying decals to surfaces, and for + * rendering solids with highlighted edges. + * + * @type {boolean} + * @default false + */ + polygonOffset: boolean; + /** + * Specifies a scale factor that is used to create a variable depth offset for each polygon. + * + * @type {number} + * @default 0 + */ + polygonOffsetFactor: number; + /** + * Is multiplied by an implementation-specific value to create a constant depth offset. + * + * @type {number} + * @default 0 + */ + polygonOffsetUnits: number; + /** + * Whether to apply dithering to the color to remove the appearance of banding. + * + * @type {boolean} + * @default false + */ + dithering: boolean; + /** + * Whether alpha to coverage should be enabled or not. Can only be used with MSAA-enabled contexts + * (meaning when the renderer was created with *antialias* parameter set to `true`). Enabling this + * will smooth aliasing on clip plane edges and alphaTest-clipped edges. + * + * @type {boolean} + * @default false + */ + alphaToCoverage: boolean; + /** + * Whether to premultiply the alpha (transparency) value. + * + * @type {boolean} + * @default false + */ + premultipliedAlpha: boolean; + /** + * Whether double-sided, transparent objects should be rendered with a single pass or not. + * + * The engine renders double-sided, transparent objects with two draw calls (back faces first, + * then front faces) to mitigate transparency artifacts. There are scenarios however where this + * approach produces no quality gains but still doubles draw calls e.g. when rendering flat + * vegetation like grass sprites. In these cases, set the `forceSinglePass` flag to `true` to + * disable the two pass rendering to avoid performance issues. + * + * @type {boolean} + * @default false + */ + forceSinglePass: boolean; + /** + * Whether it's possible to override the material with {@link Scene#overrideMaterial} or not. + * + * @type {boolean} + * @default true + */ + allowOverride: boolean; + /** + * Defines whether 3D objects using this material are visible. + * + * @type {boolean} + * @default true + */ + visible: boolean; + /** + * Defines whether this material is tone mapped according to the renderer's tone mapping setting. + * + * It is ignored when rendering to a render target or using post processing or when using + * `WebGPURenderer`. In all these cases, all materials are honored by tone mapping. + * + * @type {boolean} + * @default true + */ + toneMapped: boolean; + /** + * An object that can be used to store custom data about the Material. It + * should not hold references to functions as these will not be cloned. + * + * @type {Object} + */ + userData: Object; + /** + * This starts at `0` and counts how many times {@link Material#needsUpdate} is set to `true`. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly version: number; + _alphaTest: number; + readonly set alphaTest(value: number); + /** + * Sets the alpha value to be used when running an alpha test. The material + * will not be rendered if the opacity is lower than this value. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly get alphaTest(): number; + /** + * An optional callback that is executed immediately before the material is used to render a 3D object. + * + * This method can only be used when rendering with {@link WebGLRenderer}. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {Scene} scene - The scene. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Object3D} object - The 3D object. + * @param {Object} group - The geometry group data. + */ + onBeforeRender(): void; + /** + * An optional callback that is executed immediately before the shader + * program is compiled. This function is called with the shader source code + * as a parameter. Useful for the modification of built-in materials. + * + * This method can only be used when rendering with {@link WebGLRenderer}. The + * recommended approach when customizing materials is to use `WebGPURenderer` with the new + * Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language). + * + * @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source. + * @param {WebGLRenderer} renderer - A reference to the renderer. + */ + onBeforeCompile(): void; + /** + * In case {@link Material#onBeforeCompile} is used, this callback can be used to identify + * values of settings used in `onBeforeCompile()`, so three.js can reuse a cached + * shader or recompile the shader for this material as needed. + * + * This method can only be used when rendering with {@link WebGLRenderer}. + * + * @return {string} The custom program cache key. + */ + customProgramCacheKey(): string; + /** + * This method can be used to set default values from parameter objects. + * It is a generic implementation so it can be used with different types + * of materials. + * + * @param {Object} [values] - The material values to set. + */ + setValues(values?: Object): void; + /** + * Serializes the material into JSON. + * + * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized material. + * @see {@link ObjectLoader#parse} + */ + toJSON(meta: (Object | string) | null): Object; + /** + * Deserializes the material from the given JSON. + * + * @param {Object} json - The JSON holding the serialized material. + * @param {Object} textures - A dictionary holding textures referenced by the material. + * @return {Material} A reference to this material. + */ + fromJSON(json: Object, textures: { + [x: string]: Texture; + }): Material; + /** + * Returns a new material with copied values from this instance. + * + * @return {Material} A clone of this instance. + */ + clone(): Material; + /** + * Copies the values of the given material to this instance. + * + * @param {Material} source - The material to copy. + * @return {Material} A reference to this instance. + */ + copy(source: Material): Material; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires Material#dispose + */ + dispose(): void; + /** + * Setting this property to `true` indicates the engine the material + * needs to be recompiled. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); +} +import { EventDispatcher } from '../core/EventDispatcher.js'; +import { Color } from '../math/Color.js'; +import { Plane } from '../math/Plane.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/Materials.d.ts b/jsdoc-testing/jsdoc/src/materials/Materials.d.ts new file mode 100644 index 000000000..3f555b856 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/Materials.d.ts @@ -0,0 +1,19 @@ +import { ShadowMaterial } from './ShadowMaterial.js'; +import { SpriteMaterial } from './SpriteMaterial.js'; +import { RawShaderMaterial } from './RawShaderMaterial.js'; +import { ShaderMaterial } from './ShaderMaterial.js'; +import { PointsMaterial } from './PointsMaterial.js'; +import { MeshPhysicalMaterial } from './MeshPhysicalMaterial.js'; +import { MeshStandardMaterial } from './MeshStandardMaterial.js'; +import { MeshPhongMaterial } from './MeshPhongMaterial.js'; +import { MeshToonMaterial } from './MeshToonMaterial.js'; +import { MeshNormalMaterial } from './MeshNormalMaterial.js'; +import { MeshLambertMaterial } from './MeshLambertMaterial.js'; +import { MeshDepthMaterial } from './MeshDepthMaterial.js'; +import { MeshDistanceMaterial } from './MeshDistanceMaterial.js'; +import { MeshBasicMaterial } from './MeshBasicMaterial.js'; +import { MeshMatcapMaterial } from './MeshMatcapMaterial.js'; +import { LineDashedMaterial } from './LineDashedMaterial.js'; +import { LineBasicMaterial } from './LineBasicMaterial.js'; +import { Material } from './Material.js'; +export { ShadowMaterial, SpriteMaterial, RawShaderMaterial, ShaderMaterial, PointsMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshPhongMaterial, MeshToonMaterial, MeshNormalMaterial, MeshLambertMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshBasicMaterial, MeshMatcapMaterial, LineDashedMaterial, LineBasicMaterial, Material }; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts new file mode 100644 index 000000000..e124b7403 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts @@ -0,0 +1,208 @@ +/** + * A material for drawing geometries in a simple shaded (flat or wireframe) way. + * + * This material is not affected by lights. + * + * @augments Material + * @demo scenes/material-browser.html#MeshBasicMaterial + */ +export class MeshBasicMaterial extends Material { + /** + * Constructs a new mesh basic material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshBasicMaterial: boolean; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The light map. Requires a second set of UVs. + * + * `lightMap` represents pre-baked illuminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `lightMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + lightMap: Texture | null; + /** + * Intensity of the baked light. + * + * @type {number} + * @default 1 + */ + lightMapIntensity: number; + /** + * The red channel of this texture is used as the ambient occlusion map. + * Requires a second set of UVs. + * + * `aoMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + aoMap: Texture | null; + /** + * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` + * disables ambient occlusion. Where intensity is `1` and the AO map's + * red channel is also `1`, ambient light is fully occluded on a surface. + * + * @type {number} + * @default 1 + */ + aoMapIntensity: number; + /** + * Specular map used by the material. + * + * `specularMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `specularMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + specularMap: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * The environment map. + * + * `envMap` represents luminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `envMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + /** + * The rotation of the environment map in radians. + * + * @type {Euler} + * @default (0,0,0) + */ + envMapRotation: Euler; + /** + * How to combine the result of the surface's color with the environment map, if any. + * + * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to + * blend between the two colors. + * + * @type {(MultiplyOperation|MixOperation|AddOperation)} + * @default MultiplyOperation + */ + combine: (number | MixOperation | AddOperation); + /** + * How much the environment map affects the surface. + * The valid range is between `0` (no reflections) and `1` (full reflections). + * + * @type {number} + * @default 1 + */ + reflectivity: number; + /** + * The index of refraction (IOR) of air (approximately 1) divided by the + * index of refraction of the material. It is used with environment mapping + * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}. + * The refraction ratio should not exceed `1`. + * + * @type {number} + * @default 0.98 + */ + refractionRatio: number; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Defines appearance of wireframe ends. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinecap: ("round" | "bevel" | "miter"); + /** + * Defines appearance of wireframe joints. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinejoin: ("round" | "bevel" | "miter"); + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; +import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts new file mode 100644 index 000000000..0b95d4608 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts @@ -0,0 +1,116 @@ +/** + * A material for drawing geometry by depth. Depth is based off of the camera + * near and far plane. White is nearest, black is farthest. + * + * @augments Material + * @demo scenes/material-browser.html#MeshDepthMaterial + */ +export class MeshDepthMaterial extends Material { + /** + * Constructs a new mesh depth material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshDepthMaterial: boolean; + type: string; + /** + * Type for depth packing. + * + * @type {(BasicDepthPacking|RGBADepthPacking|RGBDepthPacking|RGDepthPacking)} + * @default BasicDepthPacking + */ + depthPacking: (number | RGBADepthPacking | RGBDepthPacking | RGDepthPacking); + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. + * + * `displacementMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * WebGL and WebGPU ignore this property and always render + * 1 pixel wide lines. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + copy(source: any): this; +} +import { Material } from './Material.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts new file mode 100644 index 000000000..459c2a606 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts @@ -0,0 +1,96 @@ +/** + * A material used internally for implementing shadow mapping with + * point lights. + * + * Can also be used to customize the shadow casting of an object by assigning + * an instance of `MeshDistanceMaterial` to {@link Object3D#customDistanceMaterial}. + * The following examples demonstrates this approach in order to ensure + * transparent parts of objects do not cast shadows. + * + * @augments Material + */ +export class MeshDistanceMaterial extends Material { + /** + * Constructs a new mesh distance material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshDistanceMaterial: boolean; + type: string; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. + * + * `displacementMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + copy(source: any): this; +} +import { Material } from './Material.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts new file mode 100644 index 000000000..375147a59 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts @@ -0,0 +1,344 @@ +/** + * A material for non-shiny surfaces, without specular highlights. + * + * The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance) + * model for calculating reflectance. This can simulate some surfaces (such + * as untreated wood or stone) well, but cannot simulate shiny surfaces with + * specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment + * shading. + * + * Due to the simplicity of the reflectance and illumination models, + * performance will be greater when using this material over the + * {@link MeshPhongMaterial}, {@link MeshStandardMaterial} or + * {@link MeshPhysicalMaterial}, at the cost of some graphical accuracy. + * + * @augments Material + * @demo scenes/material-browser.html#MeshLambertMaterial + */ +export class MeshLambertMaterial extends Material { + /** + * Constructs a new mesh lambert material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshLambertMaterial: boolean; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The light map. Requires a second set of UVs. + * + * `lightMap` represents pre-baked illuminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `lightMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + lightMap: Texture | null; + /** + * Intensity of the baked light. + * + * @type {number} + * @default 1 + */ + lightMapIntensity: number; + /** + * The red channel of this texture is used as the ambient occlusion map. + * Requires a second set of UVs. + * + * `aoMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + aoMap: Texture | null; + /** + * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` + * disables ambient occlusion. Where intensity is `1` and the AO map's + * red channel is also `1`, ambient light is fully occluded on a surface. + * + * @type {number} + * @default 1 + */ + aoMapIntensity: number; + /** + * Emissive (light) color of the material, essentially a solid color + * unaffected by other lighting. + * + * @type {Color} + * @default (0,0,0) + */ + emissive: Color; + /** + * Intensity of the emissive light. Modulates the emissive color. + * + * @type {number} + * @default 1 + */ + emissiveIntensity: number; + /** + * Set emissive (glow) map. The emissive map color is modulated by the + * emissive color and the emissive intensity. If you have an emissive map, + * be sure to set the emissive color to something other than black. + * + * `emissiveMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `emissiveMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + emissiveMap: Texture | null; + /** + * The texture to create a bump map. The black and white values map to the + * perceived depth in relation to the lights. Bump doesn't actually affect + * the geometry of the object, only the lighting. If a normal map is defined + * this will be ignored. + * + * `bumpMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + bumpMap: Texture | null; + /** + * How much the bump map affects the material. Typical range is `[0,1]`. + * + * @type {number} + * @default 1 + */ + bumpScale: number; + /** + * The texture to create a normal map. The RGB values affect the surface + * normal for each pixel fragment and change the way the color is lit. Normal + * maps do not change the actual shape of the surface, only the lighting. In + * case the material has a normal map authored using the left handed + * convention, the `y` component of `normalScale` should be negated to compensate + * for the different handedness. + * + * `normalMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + normalMap: Texture | null; + /** + * The type of normal map. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | ObjectSpaceNormalMap); + /** + * How much the normal map affects the material. Typical value range is `[0,1]`. + * + * @type {Vector2} + * @default (1,1) + */ + normalScale: Vector2; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. For best results, pair a + * displacement map with a matching normal map, since the renderer can + * not recompute surface normals from the displaced vertices. + * + * `displacementMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + /** + * Specular map used by the material. + * + * `specularMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `specularMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + specularMap: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * The environment map. + * + * `envMap` represents luminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `envMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + /** + * The rotation of the environment map in radians. + * + * @type {Euler} + * @default (0,0,0) + */ + envMapRotation: Euler; + /** + * How to combine the result of the surface's color with the environment map, if any. + * + * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to + * blend between the two colors. + * + * @type {(MultiplyOperation|MixOperation|AddOperation)} + * @default MultiplyOperation + */ + combine: (number | MixOperation | AddOperation); + /** + * How much the environment map affects the surface. + * The valid range is between `0` (no reflections) and `1` (full reflections). + * + * @type {number} + * @default 1 + */ + reflectivity: number; + /** + * Scales the effect of the environment map by multiplying its color. + * + * @type {number} + * @default 1 + */ + envMapIntensity: number; + /** + * The index of refraction (IOR) of air (approximately 1) divided by the + * index of refraction of the material. It is used with environment mapping + * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}. + * The refraction ratio should not exceed `1`. + * + * @type {number} + * @default 0.98 + */ + refractionRatio: number; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Defines appearance of wireframe ends. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinecap: ("round" | "bevel" | "miter"); + /** + * Defines appearance of wireframe joints. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinejoin: ("round" | "bevel" | "miter"); + /** + * Whether the material is rendered with flat shading or not. + * + * @type {boolean} + * @default false + */ + flatShading: boolean; + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; +import { Vector2 } from '../math/Vector2.js'; +import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts new file mode 100644 index 000000000..f345fb9f5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts @@ -0,0 +1,204 @@ +/** + * This material is defined by a MatCap (or Lit Sphere) texture, which encodes the + * material color and shading. + * + * `MeshMatcapMaterial` does not respond to lights since the matcap image file encodes + * baked lighting. It will cast a shadow onto an object that receives shadows + * (and shadow clipping works), but it will not self-shadow or receive + * shadows. + * + * @augments Material + * @demo scenes/material-browser.html#MeshMatcapMaterial + */ +export class MeshMatcapMaterial extends Material { + /** + * Constructs a new mesh matcap material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshMatcapMaterial: boolean; + defines: { + MATCAP: string; + }; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * The matcap map. + * + * `matcap` represents luminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. HDR `matcap` textures (e.g. `.exr`) + * typically set `texture.colorSpace = LinearSRGBColorSpace`, while LDR + * `matcap` textures (e.g. `.png`, `.jpg`, `.webp`) typically set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + matcap: Texture | null; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The texture to create a bump map. The black and white values map to the + * perceived depth in relation to the lights. Bump doesn't actually affect + * the geometry of the object, only the lighting. If a normal map is defined + * this will be ignored. + * + * `bumpMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + bumpMap: Texture | null; + /** + * How much the bump map affects the material. Typical range is `[0,1]`. + * + * @type {number} + * @default 1 + */ + bumpScale: number; + /** + * The texture to create a normal map. The RGB values affect the surface + * normal for each pixel fragment and change the way the color is lit. Normal + * maps do not change the actual shape of the surface, only the lighting. In + * case the material has a normal map authored using the left handed + * convention, the `y` component of `normalScale` should be negated to compensate + * for the different handedness. + * + * `normalMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + normalMap: Texture | null; + /** + * The type of normal map. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | ObjectSpaceNormalMap); + /** + * How much the normal map affects the material. Typical value range is `[0,1]`. + * + * @type {Vector2} + * @default (1,1) + */ + normalScale: Vector2; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. For best results, pair a + * displacement map with a matching normal map, since the renderer can + * not recompute surface normals from the displaced vertices. + * + * `displacementMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Whether the material is rendered with flat shading or not. + * + * @type {boolean} + * @default false + */ + flatShading: boolean; + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; +import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts new file mode 100644 index 000000000..794b28e73 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts @@ -0,0 +1,135 @@ +/** + * A material that maps the normal vectors to RGB colors. + * + * @augments Material + * @demo scenes/material-browser.html#MeshNormalMaterial + */ +export class MeshNormalMaterial extends Material { + /** + * Constructs a new mesh normal material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshNormalMaterial: boolean; + type: string; + /** + * The texture to create a bump map. The black and white values map to the + * perceived depth in relation to the lights. Bump doesn't actually affect + * the geometry of the object, only the lighting. If a normal map is defined + * this will be ignored. + * + * `bumpMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + bumpMap: Texture | null; + /** + * How much the bump map affects the material. Typical range is `[0,1]`. + * + * @type {number} + * @default 1 + */ + bumpScale: number; + /** + * The texture to create a normal map. The RGB values affect the surface + * normal for each pixel fragment and change the way the color is lit. Normal + * maps do not change the actual shape of the surface, only the lighting. In + * case the material has a normal map authored using the left handed + * convention, the `y` component of `normalScale` should be negated to compensate + * for the different handedness. + * + * `normalMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + normalMap: Texture | null; + /** + * The type of normal map. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | ObjectSpaceNormalMap); + /** + * How much the normal map affects the material. Typical value range is `[0,1]`. + * + * @type {Vector2} + * @default (1,1) + */ + normalScale: Vector2; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. For best results, pair a + * displacement map with a matching normal map, since the renderer can + * not recompute surface normals from the displaced vertices. + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * WebGL and WebGPU ignore this property and always render + * 1 pixel wide lines. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Whether the material is rendered with flat shading or not. + * + * @type {boolean} + * @default false + */ + flatShading: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts new file mode 100644 index 000000000..6fb55c994 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts @@ -0,0 +1,359 @@ +/** + * A material for shiny surfaces with specular highlights. + * + * The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model) + * model for calculating reflectance. Unlike the Lambertian model used in the + * {@link MeshLambertMaterial} this can simulate shiny surfaces with specular + * highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading. + * + * Performance will generally be greater when using this material over the + * {@link MeshStandardMaterial} or {@link MeshPhysicalMaterial}, at the cost of + * some graphical accuracy. + * + * @augments Material + * @demo scenes/material-browser.html#MeshPhongMaterial + */ +export class MeshPhongMaterial extends Material { + /** + * Constructs a new mesh phong material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshPhongMaterial: boolean; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * Specular color of the material. The default color is set to `0x111111` (very dark grey) + * + * This defines how shiny the material is and the color of its shine. + * + * @type {Color} + */ + specular: Color; + /** + * How shiny the specular highlight is; a higher value gives a sharper highlight. + * + * @type {number} + * @default 30 + */ + shininess: number; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The light map. Requires a second set of UVs. + * + * `lightMap` represents pre-baked illuminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `lightMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + lightMap: Texture | null; + /** + * Intensity of the baked light. + * + * @type {number} + * @default 1 + */ + lightMapIntensity: number; + /** + * The red channel of this texture is used as the ambient occlusion map. + * Requires a second set of UVs. + * + * `aoMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + aoMap: Texture | null; + /** + * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` + * disables ambient occlusion. Where intensity is `1` and the AO map's + * red channel is also `1`, ambient light is fully occluded on a surface. + * + * @type {number} + * @default 1 + */ + aoMapIntensity: number; + /** + * Emissive (light) color of the material, essentially a solid color + * unaffected by other lighting. + * + * @type {Color} + * @default (0,0,0) + */ + emissive: Color; + /** + * Intensity of the emissive light. Modulates the emissive color. + * + * @type {number} + * @default 1 + */ + emissiveIntensity: number; + /** + * Set emissive (glow) map. The emissive map color is modulated by the + * emissive color and the emissive intensity. If you have an emissive map, + * be sure to set the emissive color to something other than black. + * + * `emissiveMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `emissiveMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + emissiveMap: Texture | null; + /** + * The texture to create a bump map. The black and white values map to the + * perceived depth in relation to the lights. Bump doesn't actually affect + * the geometry of the object, only the lighting. If a normal map is defined + * this will be ignored. + * + * `bumpMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + bumpMap: Texture | null; + /** + * How much the bump map affects the material. Typical range is `[0,1]`. + * + * @type {number} + * @default 1 + */ + bumpScale: number; + /** + * The texture to create a normal map. The RGB values affect the surface + * normal for each pixel fragment and change the way the color is lit. Normal + * maps do not change the actual shape of the surface, only the lighting. In + * case the material has a normal map authored using the left handed + * convention, the `y` component of `normalScale` should be negated to compensate + * for the different handedness. + * + * `normalMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + normalMap: Texture | null; + /** + * The type of normal map. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | ObjectSpaceNormalMap); + /** + * How much the normal map affects the material. Typical value range is `[0,1]`. + * + * @type {Vector2} + * @default (1,1) + */ + normalScale: Vector2; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. For best results, pair a + * displacement map with a matching normal map, since the renderer can + * not recompute surface normals from the displaced vertices. + * + * `displacementMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + /** + * The specular map value affects both how much the specular surface + * highlight contributes and how much of the environment map affects the + * surface. + * + * `specularMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `specularMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + specularMap: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * The environment map. + * + * `envMap` represents luminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `envMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + /** + * The rotation of the environment map in radians. + * + * @type {Euler} + * @default (0,0,0) + */ + envMapRotation: Euler; + /** + * How to combine the result of the surface's color with the environment map, if any. + * + * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to + * blend between the two colors. + * + * @type {(MultiplyOperation|MixOperation|AddOperation)} + * @default MultiplyOperation + */ + combine: (number | MixOperation | AddOperation); + /** + * How much the environment map affects the surface. + * The valid range is between `0` (no reflections) and `1` (full reflections). + * + * @type {number} + * @default 1 + */ + reflectivity: number; + /** + * Scales the effect of the environment map by multiplying its color. + * + * @type {number} + * @default 1 + */ + envMapIntensity: number; + /** + * The index of refraction (IOR) of air (approximately 1) divided by the + * index of refraction of the material. It is used with environment mapping + * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}. + * The refraction ratio should not exceed `1`. + * + * @type {number} + * @default 0.98 + */ + refractionRatio: number; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Defines appearance of wireframe ends. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinecap: ("round" | "bevel" | "miter"); + /** + * Defines appearance of wireframe joints. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinejoin: ("round" | "bevel" | "miter"); + /** + * Whether the material is rendered with flat shading or not. + * + * @type {boolean} + * @default false + */ + flatShading: boolean; + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; +import { Vector2 } from '../math/Vector2.js'; +import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts new file mode 100644 index 000000000..285e8a2bb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts @@ -0,0 +1,362 @@ +/** + * An extension of the {@link MeshStandardMaterial}, providing more advanced + * physically-based rendering properties: + * + * - Anisotropy: Ability to represent the anisotropic property of materials + * as observable with brushed metals. + * - Clearcoat: Some materials — like car paints, carbon fiber, and wet surfaces — require + * a clear, reflective layer on top of another layer that may be irregular or rough. + * Clearcoat approximates this effect, without the need for a separate transparent surface. + * - Iridescence: Allows to render the effect where hue varies depending on the viewing + * angle and illumination angle. This can be seen on soap bubbles, oil films, or on the + * wings of many insects. + * - Physically-based transparency: One limitation of {@link Material#opacity} is that highly + * transparent materials are less reflective. Physically-based transmission provides a more + * realistic option for thin, transparent surfaces like glass. + * - Advanced reflectivity: More flexible reflectivity for non-metallic materials. + * - Retroreflection: Redirects specular light back toward the light source for + * safety materials like road markings and reflective tape. + * - Sheen: Can be used for representing cloth and fabric materials. + * + * As a result of these complex shading features, `MeshPhysicalMaterial` has a + * higher performance cost, per pixel, than other three.js materials. Most + * effects are disabled by default, and add cost as they are enabled. For + * best results, always specify an environment map when using this material. + * + * @augments MeshStandardMaterial + * @demo scenes/material-browser.html#MeshPhysicalMaterial + */ +export class MeshPhysicalMaterial extends MeshStandardMaterial { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshPhysicalMaterial: boolean; + defines: { + STANDARD: string; + PHYSICAL: string; + }; + /** + * The rotation of the anisotropy in tangent, bitangent space, measured in radians + * counter-clockwise from the tangent. When `anisotropyMap` is present, this + * property provides additional rotation to the vectors in the texture. + * + * @type {number} + * @default 1 + */ + anisotropyRotation: number; + /** + * Red and green channels represent the anisotropy direction in `[-1, 1]` tangent, + * bitangent space, to be rotated by `anisotropyRotation`. The blue channel + * contains strength as `[0, 1]` to be multiplied by `anisotropy`. + * + * `anisotropyMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + anisotropyMap: Texture | null; + /** + * The red channel of this texture is multiplied against `clearcoat`, + * for per-pixel control over a coating's intensity. + * + * `clearcoatMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + clearcoatMap: Texture | null; + /** + * Roughness of the clear coat layer, from `0.0` to `1.0`. + * + * @type {number} + * @default 0 + */ + clearcoatRoughness: number; + /** + * The green channel of this texture is multiplied against + * `clearcoatRoughness`, for per-pixel control over a coating's roughness. + * + * `clearcoatRoughnessMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + clearcoatRoughnessMap: Texture | null; + /** + * How much `clearcoatNormalMap` affects the clear coat layer, from + * `(0,0)` to `(1,1)`. + * + * @type {Vector2} + * @default (1,1) + */ + clearcoatNormalScale: Vector2; + /** + * Can be used to enable independent normals for the clear coat layer. + * + * `clearcoatNormalMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + clearcoatNormalMap: Texture | null; + /** + * Index-of-refraction for non-metallic materials, from `1.0` to `2.333`. + * + * @type {number} + * @default 1.5 + */ + ior: number; + /** + * The red channel of this texture is multiplied against `iridescence`, for per-pixel + * control over iridescence. + * + * `iridescenceMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + iridescenceMap: Texture | null; + /** + * Strength of the iridescence RGB color shift effect, represented by an index-of-refraction. + * Between `1.0` to `2.333`. + * + * @type {number} + * @default 1.3 + */ + iridescenceIOR: number; + /** + *Array of exactly 2 elements, specifying minimum and maximum thickness of the iridescence layer. + Thickness of iridescence layer has an equivalent effect of the one `thickness` has on `ior`. + * + * @type {Array} + * @default [100,400] + */ + iridescenceThicknessRange: Array; + /** + * A texture that defines the thickness of the iridescence layer, stored in the green channel. + * Minimum and maximum values of thickness are defined by `iridescenceThicknessRange` array: + * - `0.0` in the green channel will result in thickness equal to first element of the array. + * - `1.0` in the green channel will result in thickness equal to second element of the array. + * - Values in-between will linearly interpolate between the elements of the array. + * + * `iridescenceThicknessMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + iridescenceThicknessMap: Texture | null; + /** + * The sheen tint. + * + * @type {Color} + * @default (0,0,0) + */ + sheenColor: Color; + /** + * The RGB channels of this texture are multiplied against `sheenColor`, for per-pixel control + * over sheen tint. + * + * `sheenColorMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `sheenColorMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + sheenColorMap: Texture | null; + /** + * Roughness of the sheen layer, from `0.0` to `1.0`. + * + * @type {number} + * @default 1 + */ + sheenRoughness: number; + /** + * The alpha channel of this texture is multiplied against `sheenRoughness`, for per-pixel control + * over sheen roughness. + * + * `sheenRoughnessMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + sheenRoughnessMap: Texture | null; + /** + * The red channel of this texture is multiplied against `transmission`, for per-pixel control over + * optical transparency. + * + * `transmissionMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + transmissionMap: Texture | null; + /** + * The thickness of the volume beneath the surface. The value is given in the + * coordinate space of the mesh. If the value is `0` the material is + * thin-walled. Otherwise the material is a volume boundary. + * + * @type {number} + * @default 0 + */ + thickness: number; + /** + * A texture that defines the thickness, stored in the green channel. This will + * be multiplied by `thickness`. + * + * `thicknessMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + thicknessMap: Texture | null; + /** + * Density of the medium given as the average distance that light travels in + * the medium before interacting with a particle. The value is given in world + * space units, and must be greater than zero. + * + * @type {number} + * @default Infinity + */ + attenuationDistance: number; + /** + * The color that white light turns into due to absorption when reaching the + * attenuation distance. + * + * @type {Color} + * @default (1,1,1) + */ + attenuationColor: Color; + /** + * A float that scales the amount of specular reflection for non-metals only. + * When set to zero, the model is effectively Lambertian. From `0.0` to `1.0`. + * + * @type {number} + * @default 1 + */ + specularIntensity: number; + /** + * The alpha channel of this texture is multiplied against `specularIntensity`, + * for per-pixel control over specular intensity. + * + * `specularIntensityMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + specularIntensityMap: Texture | null; + /** + * Tints the specular reflection at normal incidence for non-metals only. + * + * @type {Color} + * @default (1,1,1) + */ + specularColor: Color; + /** + * The RGB channels of this texture are multiplied against `specularColor`, + * for per-pixel control over specular color. + * + * `specularColorMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `specularColorMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + specularColorMap: Texture | null; + _anisotropy: number; + _clearcoat: number; + _dispersion: number; + _iridescence: number; + _retroreflectivity: number; + _sheen: number; + _transmission: number; + set anisotropy(value: number); + /** + * The anisotropy strength, from `0.0` to `1.0`. + * + * @type {number} + * @default 0 + */ + get anisotropy(): number; + set clearcoat(value: number); + /** + * Represents the intensity of the clear coat layer, from `0.0` to `1.0`. Use + * clear coat related properties to enable multilayer materials that have a + * thin translucent layer over the base layer. + * + * @type {number} + * @default 0 + */ + get clearcoat(): number; + set iridescence(value: number); + /** + * The intensity of the iridescence layer, simulating RGB color shift based on the angle between + * the surface and the viewer, from `0.0` to `1.0`. + * + * @type {number} + * @default 0 + */ + get iridescence(): number; + set dispersion(value: number); + /** + * Defines the strength of the angular separation of colors (chromatic aberration) transmitting + * through a relatively clear volume. Any value zero or larger is valid, the typical range of + * realistic values is `[0, 1]`. This property can be only be used with transmissive objects. + * + * @type {number} + * @default 0 + */ + get dispersion(): number; + set retroreflectivity(value: number); + /** + * The strength of retroreflection, from `0.0` to `1.0`. A value of `1.0` + * evaluates the material's microfacet reflection with the view direction + * reflected about the surface normal, redirecting the specular lobe back + * toward the light source. + * + * @type {number} + * @default 0 + */ + get retroreflectivity(): number; + set sheen(value: number); + /** + * The intensity of the sheen layer, from `0.0` to `1.0`. + * + * @type {number} + * @default 0 + */ + get sheen(): number; + set transmission(value: number); + /** + * Degree of transmission (or optical transparency), from `0.0` to `1.0`. + * + * Thin, transparent or semitransparent, plastic or glass materials remain + * largely reflective even if they are fully transmissive. The transmission + * property can be used to model these materials. + * + * When transmission is non-zero, `opacity` should be set to `1`. + * + * @type {number} + * @default 0 + */ + get transmission(): number; + copy(source: any): this; +} +import { MeshStandardMaterial } from './MeshStandardMaterial.js'; +import { Vector2 } from '../math/Vector2.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts new file mode 100644 index 000000000..d95b258b5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts @@ -0,0 +1,367 @@ +/** + * A standard physically based material, using Metallic-Roughness workflow. + * + * Physically based rendering (PBR) has recently become the standard in many + * 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/), + * [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and + * [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017). + * + * This approach differs from older approaches in that instead of using + * approximations for the way in which light interacts with a surface, a + * physically correct model is used. The idea is that, instead of tweaking + * materials to look good under specific lighting, a material can be created + * that will react 'correctly' under all lighting scenarios. + * + * In practice this gives a more accurate and realistic looking result than + * the {@link MeshLambertMaterial} or {@link MeshPhongMaterial}, at the cost of + * being somewhat more computationally expensive. `MeshStandardMaterial` uses per-fragment + * shading. + * + * Note that for best results you should always specify an environment map when using this material. + * + * For a non-technical introduction to the concept of PBR and how to set up a + * PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co): + * + * - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/) + * - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/) + * + * Technical details of the approach used in three.js (and most other PBR systems) can be found is this + * [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf) + * (pdf), by Brent Burley. + * + * @augments Material + * @demo scenes/material-browser.html#MeshStandardMaterial + */ +export class MeshStandardMaterial extends Material { + /** + * Constructs a new mesh standard material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshStandardMaterial: boolean; + type: string; + defines: { + STANDARD: string; + }; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * How rough the material appears. `0.0` means a smooth mirror reflection, `1.0` + * means fully diffuse. If `roughnessMap` is also provided, + * both values are multiplied. + * + * @type {number} + * @default 1 + */ + roughness: number; + /** + * How much the material is like a metal. Non-metallic materials such as wood + * or stone use `0.0`, metallic use `1.0`, with nothing (usually) in between. + * A value between `0.0` and `1.0` could be used for a rusty metal look. + * If `metalnessMap` is also provided, both values are multiplied. + * + * @type {number} + * @default 0 + */ + metalness: number; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The light map. Requires a second set of UVs. + * + * `lightMap` represents pre-baked illuminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `lightMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + lightMap: Texture | null; + /** + * Intensity of the baked light. + * + * @type {number} + * @default 1 + */ + lightMapIntensity: number; + /** + * The red channel of this texture is used as the ambient occlusion map. + * Requires a second set of UVs. + * + * `aoMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + aoMap: Texture | null; + /** + * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` + * disables ambient occlusion. Where intensity is `1` and the AO map's + * red channel is also `1`, ambient light is fully occluded on a surface. + * + * @type {number} + * @default 1 + */ + aoMapIntensity: number; + /** + * Emissive (light) color of the material, essentially a solid color + * unaffected by other lighting. + * + * @type {Color} + * @default (0,0,0) + */ + emissive: Color; + /** + * Intensity of the emissive light. Modulates the emissive color. + * + * @type {number} + * @default 1 + */ + emissiveIntensity: number; + /** + * Set emissive (glow) map. The emissive map color is modulated by the + * emissive color and the emissive intensity. If you have an emissive map, + * be sure to set the emissive color to something other than black. + * + * `emissiveMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `emissiveMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + emissiveMap: Texture | null; + /** + * The texture to create a bump map. The black and white values map to the + * perceived depth in relation to the lights. Bump doesn't actually affect + * the geometry of the object, only the lighting. If a normal map is defined + * this will be ignored. + * + * `bumpMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + bumpMap: Texture | null; + /** + * How much the bump map affects the material. Typical range is `[0,1]`. + * + * @type {number} + * @default 1 + */ + bumpScale: number; + /** + * The texture to create a normal map. The RGB values affect the surface + * normal for each pixel fragment and change the way the color is lit. Normal + * maps do not change the actual shape of the surface, only the lighting. In + * case the material has a normal map authored using the left handed + * convention, the `y` component of `normalScale` should be negated to compensate + * for the different handedness. + * + * `normalMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + normalMap: Texture | null; + /** + * The type of normal map. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | ObjectSpaceNormalMap); + /** + * How much the normal map affects the material. Typical value range is `[0,1]`. + * + * @type {Vector2} + * @default (1,1) + */ + normalScale: Vector2; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. For best results, pair a + * displacement map with a matching normal map, since the renderer can + * not recompute surface normals from the displaced vertices. + * + * `displacementMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + /** + * The green channel of this texture is used to alter the roughness of the + * material. + * + * `roughnessMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + roughnessMap: Texture | null; + /** + * The blue channel of this texture is used to alter the metalness of the + * material. + * + * `metalnessMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + metalnessMap: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * The environment map. To ensure a physically correct rendering, environment maps + * are internally pre-processed with {@link PMREMGenerator}. + * + * `envMap` represents luminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `envMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + envMap: Texture | null; + /** + * The rotation of the environment map in radians. + * + * @type {Euler} + * @default (0,0,0) + */ + envMapRotation: Euler; + /** + * Scales the effect of the environment map by multiplying its color. + * + * @type {number} + * @default 1 + */ + envMapIntensity: number; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Defines appearance of wireframe ends. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinecap: ("round" | "bevel" | "miter"); + /** + * Defines appearance of wireframe joints. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinejoin: ("round" | "bevel" | "miter"); + /** + * Whether the material is rendered with flat shading or not. + * + * @type {boolean} + * @default false + */ + flatShading: boolean; + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; +import { Vector2 } from '../math/Vector2.js'; +import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts new file mode 100644 index 000000000..8777c4e00 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts @@ -0,0 +1,275 @@ +/** + * A material implementing toon shading. + * + * @augments Material + * @demo scenes/material-browser.html#MeshToonMaterial + */ +export class MeshToonMaterial extends Material { + /** + * Constructs a new mesh toon material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshToonMaterial: boolean; + defines: { + TOON: string; + }; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * Gradient map for toon shading. It's required to set + * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter} + * when using this type of texture. + * + * `gradientMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + gradientMap: Texture | null; + /** + * The light map. Requires a second set of UVs. + * + * `lightMap` represents pre-baked illuminance data, and the texture must be assigned + * a {@link Texture#colorSpace}. Most `lightMap` textures set + * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats + * such as `.exr` or `.hdr`. + * + * @type {?Texture} + * @default null + */ + lightMap: Texture | null; + /** + * Intensity of the baked light. + * + * @type {number} + * @default 1 + */ + lightMapIntensity: number; + /** + * The red channel of this texture is used as the ambient occlusion map. + * Requires a second set of UVs. + * + * `aoMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + aoMap: Texture | null; + /** + * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` + * disables ambient occlusion. Where intensity is `1` and the AO map's + * red channel is also `1`, ambient light is fully occluded on a surface. + * + * @type {number} + * @default 1 + */ + aoMapIntensity: number; + /** + * Emissive (light) color of the material, essentially a solid color + * unaffected by other lighting. + * + * @type {Color} + * @default (0,0,0) + */ + emissive: Color; + /** + * Intensity of the emissive light. Modulates the emissive color. + * + * @type {number} + * @default 1 + */ + emissiveIntensity: number; + /** + * Set emissive (glow) map. The emissive map color is modulated by the + * emissive color and the emissive intensity. If you have an emissive map, + * be sure to set the emissive color to something other than black. + * + * `emissiveMap` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `emissiveMap` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + emissiveMap: Texture | null; + /** + * The texture to create a bump map. The black and white values map to the + * perceived depth in relation to the lights. Bump doesn't actually affect + * the geometry of the object, only the lighting. If a normal map is defined + * this will be ignored. + * + * `bumpMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + bumpMap: Texture | null; + /** + * How much the bump map affects the material. Typical range is `[0,1]`. + * + * @type {number} + * @default 1 + */ + bumpScale: number; + /** + * The texture to create a normal map. The RGB values affect the surface + * normal for each pixel fragment and change the way the color is lit. Normal + * maps do not change the actual shape of the surface, only the lighting. In + * case the material has a normal map authored using the left handed + * convention, the `y` component of `normalScale` should be negated to compensate + * for the different handedness. + * + * `normalMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + normalMap: Texture | null; + /** + * The type of normal map. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | ObjectSpaceNormalMap); + /** + * How much the normal map affects the material. Typical value range is `[0,1]`. + * + * @type {Vector2} + * @default (1,1) + */ + normalScale: Vector2; + /** + * The displacement map affects the position of the mesh's vertices. Unlike + * other maps which only affect the light and shade of the material the + * displaced vertices can cast shadows, block other objects, and otherwise + * act as real geometry. The displacement texture is an image where the value + * of each pixel (white being the highest) is mapped against, and + * repositions, the vertices of the mesh. For best results, pair a + * displacement map with a matching normal map, since the renderer can + * not recompute surface normals from the displaced vertices. + * + * `displacementMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + displacementMap: Texture | null; + /** + * How much the displacement map affects the mesh (where black is no + * displacement, and white is maximum displacement). Without a displacement + * map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementScale: number; + /** + * The offset of the displacement map's values on the mesh's vertices. + * The bias is added to the scaled sample of the displacement map. + * Without a displacement map set, this value is not applied. + * + * @type {number} + * @default 0 + */ + displacementBias: number; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Defines appearance of wireframe ends. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinecap: ("round" | "bevel" | "miter"); + /** + * Defines appearance of wireframe joints. + * + * Can only be used with {@link SVGRenderer}. + * + * @type {('round'|'bevel'|'miter')} + * @default 'round' + */ + wireframeLinejoin: ("round" | "bevel" | "miter"); + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; +import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts new file mode 100644 index 000000000..69665f811 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts @@ -0,0 +1,109 @@ +/** + * A material for rendering point primitives. + * + * Materials define the appearance of renderable 3D objects. + * + * ```js + * const vertices = []; + * + * for ( let i = 0; i < 10000; i ++ ) { + * const x = THREE.MathUtils.randFloatSpread( 2000 ); + * const y = THREE.MathUtils.randFloatSpread( 2000 ); + * const z = THREE.MathUtils.randFloatSpread( 2000 ); + * + * vertices.push( x, y, z ); + * } + * + * const geometry = new THREE.BufferGeometry(); + * geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); + * const material = new THREE.PointsMaterial( { color: 0x888888 } ); + * const points = new THREE.Points( geometry, material ); + * scene.add( points ); + * ``` + * + * @augments Material + */ +export class PointsMaterial extends Material { + /** + * Constructs a new points material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPointsMaterial: boolean; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * Defines the size of the points in pixels. + * + * Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete). + * + * @type {number} + * @default 1 + */ + size: number; + /** + * Specifies whether size of individual points is attenuated by the camera depth (perspective camera only). + * + * @type {boolean} + * @default true + */ + sizeAttenuation: boolean; + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts new file mode 100644 index 000000000..c9e548d48 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts @@ -0,0 +1,111 @@ +declare const RawShaderMaterial_base: { + new (parameters?: Object): { + readonly isShaderMaterial: boolean; + type: string; + defines: Object; + uniforms: Object; + uniformsGroups: Array; + vertexShader: string; + fragmentShader: string; + linewidth: number; + wireframe: boolean; + wireframeLinewidth: number; + fog: boolean; + lights: boolean; + clipping: boolean; + forceSinglePass: boolean; + extensions: { + clipCullDistance: false; + multiDraw: false; + }; + defaultAttributeValues: Object; + index0AttributeName: string | undefined; + uniformsNeedUpdate: boolean; + glslVersion: (GLSL1 | GLSL3) | null; + copy(source: any): /*elided*/ any; + toJSON(meta: any): Object; + fromJSON(json: Object, textures: { + [x: string]: Texture; + }): /*elided*/ any; + readonly isMaterial: boolean; + readonly uuid: string; + name: string; + blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); + side: (number | BackSide | DoubleSide); + vertexColors: boolean; + opacity: number; + transparent: boolean; + alphaHash: boolean; + blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); + blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; + blendColor: import("../Three.Core.js").Color; + blendAlpha: number; + depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); + depthTest: boolean; + depthWrite: boolean; + stencilWriteMask: number; + stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; + stencilRef: number; + stencilFuncMask: number; + stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; + stencilWrite: boolean; + clippingPlanes: Array | null; + clipIntersection: boolean; + clipShadows: boolean; + shadowSide: (number | BackSide | DoubleSide) | null; + colorWrite: boolean; + precision: ("highp" | "mediump" | "lowp") | null; + polygonOffset: boolean; + polygonOffsetFactor: number; + polygonOffsetUnits: number; + dithering: boolean; + alphaToCoverage: boolean; + premultipliedAlpha: boolean; + allowOverride: boolean; + visible: boolean; + toneMapped: boolean; + userData: Object; + readonly version: number; + _alphaTest: number; + get alphaTest(): number; + set alphaTest(value: number); + onBeforeRender(): void; + onBeforeCompile(): void; + customProgramCacheKey(): string; + setValues(values?: Object): void; + clone(): Material; + dispose(): void; + set needsUpdate(value: boolean); + addEventListener(type: string, listener: Function): void; + _listeners: {} | undefined; + hasEventListener(type: string, listener: Function): boolean; + removeEventListener(type: string, listener: Function): void; + dispatchEvent(event: Object): void; + }; +}; +/** + * This class works just like {@link ShaderMaterial}, except that definitions + * of built-in uniforms and attributes are not automatically prepended to the + * GLSL shader code. + * + * `RawShaderMaterial` can only be used with {@link WebGLRenderer}. + * + * @augments ShaderMaterial + */ +export class RawShaderMaterial extends RawShaderMaterial_base { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRawShaderMaterial: boolean; +} +export {}; diff --git a/jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts new file mode 100644 index 000000000..24157d560 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts @@ -0,0 +1,266 @@ +/** + * ~Shader + */ +export type ShaderMaterial = { + /** + * - The name of the shader. + */ + name: string; + /** + * - The uniforms of the shader. + */ + uniforms: { + [x: string]: Uniform; + }; + /** + * - The defines of the shader. + */ + defines: { + [x: string]: any; + }; + /** + * - The vertex shader code. + */ + vertexShader: string; + /** + * - The fragment shader code. + */ + fragmentShader: string; +}; +/** + * A material rendered with custom shaders. A shader is a small program written in GLSL. + * that runs on the GPU. You may want to use a custom shader if you need to implement an + * effect not included with any of the built-in materials. + * + * There are the following notes to bear in mind when using a `ShaderMaterial`: + * + * - `ShaderMaterial` can only be used with {@link WebGLRenderer}. + * - Built in attributes and uniforms are passed to the shaders along with your code. If + * you don't want that, use {@link RawShaderMaterial} instead. + * - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end` + * in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has + * to be placed right above the loop. The loop formatting has to correspond to a defined standard. + * - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop). + * - The loop variable has to be *i*. + * - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly + * value of *i* for the given iteration and can be used in preprocessor + * statements. + * + * ```js + * const material = new THREE.ShaderMaterial( { + * uniforms: { + * time: { value: 1.0 }, + * resolution: { value: new THREE.Vector2() } + * }, + * vertexShader: document.getElementById( 'vertexShader' ).textContent, + * fragmentShader: document.getElementById( 'fragmentShader' ).textContent + * } ); + * ``` + * + * @augments Material + */ +export class ShaderMaterial extends Material { + /** + * Constructs a new shader material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShaderMaterial: boolean; + type: string; + /** + * Defines custom constants using `#define` directives within the GLSL code + * for both the vertex shader and the fragment shader; each key/value pair + * yields another directive. + * ```js + * defines: { + * FOO: 15, + * BAR: true + * } + * ``` + * Yields the lines: + * ``` + * #define FOO 15 + * #define BAR true + * ``` + * + * @type {Object} + */ + defines: Object; + /** + * An object of the form: + * ```js + * { + * "uniform1": { value: 1.0 }, + * "uniform2": { value: 2 } + * } + * ``` + * specifying the uniforms to be passed to the shader code; keys are uniform + * names, values are definitions of the form + * ``` + * { + * value: 1.0 + * } + * ``` + * where `value` is the value of the uniform. Names must match the name of + * the uniform, as defined in the GLSL code. Note that uniforms are refreshed + * on every frame, so updating the value of the uniform will immediately + * update the value available to the GLSL code. + * + * @type {Object} + */ + uniforms: Object; + /** + * An array holding uniforms groups for configuring UBOs. + * + * @type {Array} + */ + uniformsGroups: Array; + /** + * Vertex shader GLSL code. This is the actual code for the shader. + * + * @type {string} + */ + vertexShader: string; + /** + * Fragment shader GLSL code. This is the actual code for the shader. + * + * @type {string} + */ + fragmentShader: string; + /** + * Controls line thickness or lines. + * + * WebGL and WebGPU ignore this setting and always render line primitives with a + * width of one pixel. + * + * @type {number} + * @default 1 + */ + linewidth: number; + /** + * Renders the geometry as a wireframe. + * + * @type {boolean} + * @default false + */ + wireframe: boolean; + /** + * Controls the thickness of the wireframe. + * + * WebGL and WebGPU ignore this property and always render + * 1 pixel wide lines. + * + * @type {number} + * @default 1 + */ + wireframeLinewidth: number; + /** + * Defines whether the material color is affected by global fog settings; `true` + * to pass fog uniforms to the shader. + * + * Setting this property to `true` requires the definition of fog uniforms. It is + * recommended to use `UniformsUtils.merge()` to combine the custom shader uniforms + * with predefined fog uniforms. + * + * ```js + * const material = new ShaderMaterial( { + * uniforms: UniformsUtils.merge( [ UniformsLib[ 'fog' ], shaderUniforms ] ); + * vertexShader: vertexShader, + * fragmentShader: fragmentShader, + * fog: true + * } ); + * ``` + * + * @type {boolean} + * @default false + */ + fog: boolean; + /** + * Defines whether this material uses lighting; `true` to pass uniform data + * related to lighting to this shader. + * + * @type {boolean} + * @default false + */ + lights: boolean; + /** + * Defines whether this material supports clipping; `true` to let the renderer + * pass the clippingPlanes uniform. + * + * @type {boolean} + * @default false + */ + clipping: boolean; + /** + * This object allows to enable certain WebGL 2 extensions. + * + * - clipCullDistance: set to `true` to use vertex shader clipping + * - multiDraw: set to `true` to use vertex shader multi_draw / enable gl_DrawID + * + * @type {{clipCullDistance:false,multiDraw:false}} + */ + extensions: { + clipCullDistance: false; + multiDraw: false; + }; + /** + * When the rendered geometry doesn't include these attributes but the + * material does, these default values will be passed to the shaders. This + * avoids errors when buffer data is missing. + * + * - color: [ 1, 1, 1 ] + * - uv: [ 0, 0 ] + * - uv1: [ 0, 0 ] + * + * @type {Object} + */ + defaultAttributeValues: Object; + /** + * If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation) + * to bind a generic vertex index to an attribute variable. + * + * @type {string|undefined} + * @default undefined + */ + index0AttributeName: string | undefined; + /** + * Can be used to force a uniform update while changing uniforms in + * {@link Object3D#onBeforeRender}. + * + * @type {boolean} + * @default false + */ + uniformsNeedUpdate: boolean; + /** + * Defines the GLSL version of custom shader code. + * + * @type {?(GLSL1|GLSL3)} + * @default null + */ + glslVersion: (GLSL1 | GLSL3) | null; + copy(source: any): this; + toJSON(meta: any): Object; + /** + * Deserializes the material from the given JSON. + * + * @param {Object} json - The JSON holding the serialized material. + * @param {Object} textures - A dictionary holding textures referenced by the material. + * @return {ShaderMaterial} A reference to this material. + */ + fromJSON(json: Object, textures: { + [x: string]: Texture; + }): ShaderMaterial; +} +import { Material } from './Material.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts new file mode 100644 index 000000000..2e66a5668 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts @@ -0,0 +1,56 @@ +/** + * This material can receive shadows, but otherwise is completely transparent. + * + * ```js + * const geometry = new THREE.PlaneGeometry( 2000, 2000 ); + * geometry.rotateX( - Math.PI / 2 ); + * + * const material = new THREE.ShadowMaterial(); + * material.opacity = 0.2; + * + * const plane = new THREE.Mesh( geometry, material ); + * plane.position.y = -200; + * plane.receiveShadow = true; + * scene.add( plane ); + * ``` + * + * @augments Material + */ +export class ShadowMaterial extends Material { + /** + * Constructs a new shadow material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowMaterial: boolean; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (0,0,0) + */ + color: Color; + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts new file mode 100644 index 000000000..dfe9816f7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts @@ -0,0 +1,96 @@ +/** + * A material for rendering instances of {@link Sprite}. + * + * ```js + * const map = new THREE.TextureLoader().load( 'textures/sprite.png' ); + * const material = new THREE.SpriteMaterial( { map: map, color: 0xffffff } ); + * + * const sprite = new THREE.Sprite( material ); + * sprite.scale.set(200, 200, 1) + * scene.add( sprite ); + * ``` + * + * @augments Material + */ +export class SpriteMaterial extends Material { + /** + * Constructs a new sprite material. + * + * @param {Object} [parameters] - An object with one or more properties + * defining the material's appearance. Any property of the material + * (including any property from inherited materials) can be passed + * in here. Color values can be passed any type of value accepted + * by {@link Color#set}. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSpriteMaterial: boolean; + type: string; + /** + * Color of the material. + * + * @type {Color} + * @default (1,1,1) + */ + color: Color; + /** + * The color map. May optionally include an alpha channel, typically combined + * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map + * color is modulated by the diffuse `color`. + * + * `map` represents color data, and the texture must be assigned a + * {@link Texture#colorSpace}. Most `map` textures set + * `texture.colorSpace = SRGBColorSpace`. + * + * @type {?Texture} + * @default null + */ + map: Texture | null; + /** + * The alpha map is a grayscale texture that controls the opacity across the + * surface (black: fully transparent; white: fully opaque). + * + * Only the color of the texture is used, ignoring the alpha channel if one + * exists. For RGB and RGBA textures, the renderer will use the green channel + * when sampling this texture due to the extra bit of precision provided for + * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and + * luminance/alpha textures will also still work as expected. + * + * `alphaMap` represents non-color data. Any texture assigned must have + * `texture.colorSpace = NoColorSpace` (default). + * + * @type {?Texture} + * @default null + */ + alphaMap: Texture | null; + /** + * The rotation of the sprite in radians. + * + * @type {number} + * @default 0 + */ + rotation: number; + /** + * Specifies whether size of the sprite is attenuated by the camera depth (perspective camera only). + * + * @type {boolean} + * @default true + */ + sizeAttenuation: boolean; + /** + * Whether the material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + copy(source: any): this; +} +import { Material } from './Material.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts new file mode 100644 index 000000000..861ba6447 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts @@ -0,0 +1,87 @@ +export default Line2NodeMaterial; +/** + * This node material can be used to render lines with a size larger than one + * by representing them as instanced meshes. + * + * @augments NodeMaterial + */ +declare class Line2NodeMaterial extends NodeMaterial { + /** + * Constructs a new node material for wide line rendering. + * + * @param {Object} [parameters={}] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLine2NodeMaterial: boolean; + /** + * The dash offset. + * + * @type {number} + * @default 0 + */ + dashOffset: number; + /** + * Defines the offset. + * + * @type {?Node} + * @default null + */ + offsetNode: Node | null; + /** + * Defines the dash scale. + * + * @type {?Node} + * @default null + */ + dashScaleNode: Node | null; + /** + * Defines the dash size. + * + * @type {?Node} + * @default null + */ + dashSizeNode: Node | null; + /** + * Defines the gap size. + * + * @type {?Node} + * @default null + */ + gapSizeNode: Node | null; + _useDash: any; + _useAlphaToCoverage: boolean; + _useWorldUnits: boolean; + set lineColorNode(value: Node | null); + /** + * Defines the lines color. + * + * @deprecated since r185. Use {@link NodeMaterial#colorNode} instead. + * @type {?Node} + */ + get lineColorNode(): Node | null; + set worldUnits(value: boolean); + /** + * Whether the lines should sized in world units or not. + * When set to `false` the unit is pixel. + * + * @type {boolean} + * @default false + */ + get worldUnits(): boolean; + set dashed(value: boolean); + /** + * Whether the lines should be dashed or not. + * + * @type {boolean} + * @default false + */ + get dashed(): boolean; +} +import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts new file mode 100644 index 000000000..da65dc888 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts @@ -0,0 +1,23 @@ +export default LineBasicNodeMaterial; +/** + * Node material version of {@link LineBasicMaterial}. + * + * @augments NodeMaterial + */ +declare class LineBasicNodeMaterial extends NodeMaterial { + /** + * Constructs a new line basic node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineBasicNodeMaterial: boolean; +} +import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts new file mode 100644 index 000000000..89820e463 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts @@ -0,0 +1,78 @@ +export default LineDashedNodeMaterial; +/** + * Node material version of {@link LineDashedMaterial}. + * + * @augments NodeMaterial + */ +declare class LineDashedNodeMaterial extends NodeMaterial { + /** + * Constructs a new line dashed node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineDashedNodeMaterial: boolean; + /** + * The dash offset. + * + * @type {number} + * @default 0 + */ + dashOffset: number; + /** + * The offset of dash materials is by default inferred from the `dashOffset` + * property. This node property allows to overwrite the default + * and define the offset with a node instead. + * + * If you don't want to overwrite the offset but modify the existing + * value instead, use {@link materialLineDashOffset}. + * + * @type {?Node} + * @default null + */ + offsetNode: Node | null; + /** + * The scale of dash materials is by default inferred from the `scale` + * property. This node property allows to overwrite the default + * and define the scale with a node instead. + * + * If you don't want to overwrite the scale but modify the existing + * value instead, use {@link materialLineScale}. + * + * @type {?Node} + * @default null + */ + dashScaleNode: Node | null; + /** + * The dash size of dash materials is by default inferred from the `dashSize` + * property. This node property allows to overwrite the default + * and define the dash size with a node instead. + * + * If you don't want to overwrite the dash size but modify the existing + * value instead, use {@link materialLineDashSize}. + * + * @type {?Node} + * @default null + */ + dashSizeNode: Node | null; + /** + * The gap size of dash materials is by default inferred from the `gapSize` + * property. This node property allows to overwrite the default + * and define the gap size with a node instead. + * + * If you don't want to overwrite the gap size but modify the existing + * value instead, use {@link materialLineGapSize}. + * + * @type {?Node} + * @default null + */ + gapSizeNode: Node | null; +} +import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts new file mode 100644 index 000000000..97d6b1cb4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts @@ -0,0 +1,39 @@ +export default MeshBasicNodeMaterial; +/** + * Node material version of {@link MeshBasicMaterial}. + * + * @augments NodeMaterial + */ +declare class MeshBasicNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh basic node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshBasicNodeMaterial: boolean; + /** + * Overwritten since this type of material uses {@link BasicEnvironmentNode} + * to implement the default environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?BasicEnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {BasicLightingModel} The lighting model. + */ + setupLightingModel(): BasicLightingModel; +} +import NodeMaterial from './NodeMaterial.js'; +import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; +import BasicLightingModel from '../../nodes/functions/BasicLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts new file mode 100644 index 000000000..a5e110905 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts @@ -0,0 +1,39 @@ +export default MeshLambertNodeMaterial; +/** + * Node material version of {@link MeshLambertMaterial}. + * + * @augments NodeMaterial + */ +declare class MeshLambertNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh lambert node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshLambertNodeMaterial: boolean; + /** + * Overwritten since this type of material uses {@link BasicEnvironmentNode} + * to implement the default environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?BasicEnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {PhongLightingModel} The lighting model. + */ + setupLightingModel(): PhongLightingModel; +} +import NodeMaterial from './NodeMaterial.js'; +import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; +import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts new file mode 100644 index 000000000..1a2d32c8c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts @@ -0,0 +1,29 @@ +export default MeshMatcapNodeMaterial; +/** + * Node material version of {@link MeshMatcapMaterial}. + * + * @augments NodeMaterial + */ +declare class MeshMatcapNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh normal node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshMatcapNodeMaterial: boolean; + /** + * Setups the matcap specific node variables. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupVariants(builder: NodeBuilder): void; +} +import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts new file mode 100644 index 000000000..effc5951b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts @@ -0,0 +1,28 @@ +export default MeshNormalNodeMaterial; +/** + * Node material version of {@link MeshNormalMaterial}. + * + * @augments NodeMaterial + */ +declare class MeshNormalNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh normal node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshNormalNodeMaterial: boolean; + /** + * Overwrites the default implementation by computing the diffuse color + * based on the normal data. + */ + setupDiffuseColor(): void; +} +import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts new file mode 100644 index 000000000..374eb470a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts @@ -0,0 +1,63 @@ +export default MeshPhongNodeMaterial; +/** + * Node material version of {@link MeshPhongMaterial}. + * + * @augments NodeMaterial + */ +declare class MeshPhongNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh lambert node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshPhongNodeMaterial: boolean; + /** + * The shininess of phong materials is by default inferred from the `shininess` + * property. This node property allows to overwrite the default + * and define the shininess with a node instead. + * + * If you don't want to overwrite the shininess but modify the existing + * value instead, use {@link materialShininess}. + * + * @type {?Node} + * @default null + */ + shininessNode: Node | null; + /** + * The specular color of phong materials is by default inferred from the + * `specular` property. This node property allows to overwrite the default + * and define the specular color with a node instead. + * + * If you don't want to overwrite the specular color but modify the existing + * value instead, use {@link materialSpecular}. + * + * @type {?Node} + * @default null + */ + specularNode: Node | null; + /** + * Overwritten since this type of material uses {@link BasicEnvironmentNode} + * to implement the default environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?BasicEnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {PhongLightingModel} The lighting model. + */ + setupLightingModel(): PhongLightingModel; +} +import NodeMaterial from './NodeMaterial.js'; +import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; +import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts new file mode 100644 index 000000000..f5cd2ac32 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts @@ -0,0 +1,295 @@ +export default MeshPhysicalNodeMaterial; +/** + * Node material version of {@link MeshPhysicalMaterial}. + * + * @augments MeshStandardNodeMaterial + */ +declare class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshPhysicalNodeMaterial: boolean; + /** + * The clearcoat of physical materials is by default inferred from the `clearcoat` + * and `clearcoatMap` properties. This node property allows to overwrite the default + * and define the clearcoat with a node instead. + * + * If you don't want to overwrite the clearcoat but modify the existing + * value instead, use {@link materialClearcoat}. + * + * @type {?Node} + * @default null + */ + clearcoatNode: Node | null; + /** + * The clearcoat roughness of physical materials is by default inferred from the `clearcoatRoughness` + * and `clearcoatRoughnessMap` properties. This node property allows to overwrite the default + * and define the clearcoat roughness with a node instead. + * + * If you don't want to overwrite the clearcoat roughness but modify the existing + * value instead, use {@link materialClearcoatRoughness}. + * + * @type {?Node} + * @default null + */ + clearcoatRoughnessNode: Node | null; + /** + * The clearcoat normal of physical materials is by default inferred from the `clearcoatNormalMap` + * property. This node property allows to overwrite the default + * and define the clearcoat normal with a node instead. + * + * If you don't want to overwrite the clearcoat normal but modify the existing + * value instead, use {@link materialClearcoatNormal}. + * + * @type {?Node} + * @default null + */ + clearcoatNormalNode: Node | null; + /** + * The sheen of physical materials is by default inferred from the `sheen`, `sheenColor` + * and `sheenColorMap` properties. This node property allows to overwrite the default + * and define the sheen with a node instead. + * + * If you don't want to overwrite the sheen but modify the existing + * value instead, use {@link materialSheen}. + * + * @type {?Node} + * @default null + */ + sheenNode: Node | null; + /** + * The sheen roughness of physical materials is by default inferred from the `sheenRoughness` and + * `sheenRoughnessMap` properties. This node property allows to overwrite the default + * and define the sheen roughness with a node instead. + * + * If you don't want to overwrite the sheen roughness but modify the existing + * value instead, use {@link materialSheenRoughness}. + * + * @type {?Node} + * @default null + */ + sheenRoughnessNode: Node | null; + /** + * The iridescence of physical materials is by default inferred from the `iridescence` + * property. This node property allows to overwrite the default + * and define the iridescence with a node instead. + * + * If you don't want to overwrite the iridescence but modify the existing + * value instead, use {@link materialIridescence}. + * + * @type {?Node} + * @default null + */ + iridescenceNode: Node | null; + /** + * The iridescence IOR of physical materials is by default inferred from the `iridescenceIOR` + * property. This node property allows to overwrite the default + * and define the iridescence IOR with a node instead. + * + * If you don't want to overwrite the iridescence IOR but modify the existing + * value instead, use {@link materialIridescenceIOR}. + * + * @type {?Node} + * @default null + */ + iridescenceIORNode: Node | null; + /** + * The iridescence thickness of physical materials is by default inferred from the `iridescenceThicknessRange` + * and `iridescenceThicknessMap` properties. This node property allows to overwrite the default + * and define the iridescence thickness with a node instead. + * + * If you don't want to overwrite the iridescence thickness but modify the existing + * value instead, use {@link materialIridescenceThickness}. + * + * @type {?Node} + * @default null + */ + iridescenceThicknessNode: Node | null; + /** + * The specular intensity of physical materials is by default inferred from the `specularIntensity` + * and `specularIntensityMap` properties. This node property allows to overwrite the default + * and define the specular intensity with a node instead. + * + * If you don't want to overwrite the specular intensity but modify the existing + * value instead, use {@link materialSpecularIntensity}. + * + * @type {?Node} + * @default null + */ + specularIntensityNode: Node | null; + /** + * The specular color of physical materials is by default inferred from the `specularColor` + * and `specularColorMap` properties. This node property allows to overwrite the default + * and define the specular color with a node instead. + * + * If you don't want to overwrite the specular color but modify the existing + * value instead, use {@link materialSpecularColor}. + * + * @type {?Node} + * @default null + */ + specularColorNode: Node | null; + /** + * The ior of physical materials is by default inferred from the `ior` + * property. This node property allows to overwrite the default + * and define the ior with a node instead. + * + * If you don't want to overwrite the ior but modify the existing + * value instead, use {@link materialIOR}. + * + * @type {?Node} + * @default null + */ + iorNode: Node | null; + /** + * The transmission of physical materials is by default inferred from the `transmission` and + * `transmissionMap` properties. This node property allows to overwrite the default + * and define the transmission with a node instead. + * + * If you don't want to overwrite the transmission but modify the existing + * value instead, use {@link materialTransmission}. + * + * @type {?Node} + * @default null + */ + transmissionNode: Node | null; + /** + * The thickness of physical materials is by default inferred from the `thickness` and + * `thicknessMap` properties. This node property allows to overwrite the default + * and define the thickness with a node instead. + * + * If you don't want to overwrite the thickness but modify the existing + * value instead, use {@link materialThickness}. + * + * @type {?Node} + * @default null + */ + thicknessNode: Node | null; + /** + * The attenuation distance of physical materials is by default inferred from the + * `attenuationDistance` property. This node property allows to overwrite the default + * and define the attenuation distance with a node instead. + * + * If you don't want to overwrite the attenuation distance but modify the existing + * value instead, use {@link materialAttenuationDistance}. + * + * @type {?Node} + * @default null + */ + attenuationDistanceNode: Node | null; + /** + * The attenuation color of physical materials is by default inferred from the + * `attenuationColor` property. This node property allows to overwrite the default + * and define the attenuation color with a node instead. + * + * If you don't want to overwrite the attenuation color but modify the existing + * value instead, use {@link materialAttenuationColor}. + * + * @type {?Node} + * @default null + */ + attenuationColorNode: Node | null; + /** + * The dispersion of physical materials is by default inferred from the + * `dispersion` property. This node property allows to overwrite the default + * and define the dispersion with a node instead. + * + * If you don't want to overwrite the dispersion but modify the existing + * value instead, use {@link materialDispersion}. + * + * @type {?Node} + * @default null + */ + dispersionNode: Node | null; + /** + * The retroreflective strength of physical materials is by default inferred from the + * `retroreflectivity` property. This node property allows to overwrite the default + * and define the retroreflective strength with a node instead. + * + * If you don't want to overwrite the retroreflective strength but modify the existing + * value instead, use {@link materialRetroreflectivity}. + * + * @type {?Node} + * @default null + */ + retroreflectivityNode: Node | null; + /** + * The anisotropy of physical materials is by default inferred from the + * `anisotropy` property. This node property allows to overwrite the default + * and define the anisotropy with a node instead. + * + * If you don't want to overwrite the anisotropy but modify the existing + * value instead, use {@link materialAnisotropy}. + * + * @type {?Node} + * @default null + */ + anisotropyNode: Node | null; + /** + * Whether the lighting model should use clearcoat or not. + * + * @type {boolean} + * @default true + */ + get useClearcoat(): boolean; + /** + * Whether the lighting model should use iridescence or not. + * + * @type {boolean} + * @default true + */ + get useIridescence(): boolean; + /** + * Whether the lighting model should use sheen or not. + * + * @type {boolean} + * @default true + */ + get useSheen(): boolean; + /** + * Whether the lighting model should use anisotropy or not. + * + * @type {boolean} + * @default true + */ + get useAnisotropy(): boolean; + /** + * Whether the lighting model should use transmission or not. + * + * @type {boolean} + * @default true + */ + get useTransmission(): boolean; + /** + * Whether the lighting model should use dispersion or not. + * + * @type {boolean} + * @default true + */ + get useDispersion(): boolean; + /** + * Whether the lighting model should use retroreflection or not. + * + * @type {boolean} + * @default true + */ + get useRetroreflection(): boolean; + /** + * Setups the physical specific node variables. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupVariants(builder: NodeBuilder): void; + /** + * Setups the clearcoat normal node. + * + * @return {Node} The clearcoat normal. + */ + setupClearcoatNormal(): Node; + setup(builder: any): void; +} +import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts new file mode 100644 index 000000000..29ec54604 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts @@ -0,0 +1,84 @@ +export default MeshSSSNodeMaterial; +/** + * This node material is an experimental extension of {@link MeshPhysicalNodeMaterial} + * that implements a Subsurface scattering (SSS) term. + * + * @augments MeshPhysicalNodeMaterial + */ +declare class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial { + /** + * Represents the thickness color. + * + * @type {?Node} + * @default null + */ + thicknessColorNode: Node | null; + /** + * Represents the distortion factor. + * + * @type {?Node} + */ + thicknessDistortionNode: Node | null; + /** + * Represents the thickness ambient factor. + * + * @type {?Node} + */ + thicknessAmbientNode: Node | null; + /** + * Represents the thickness attenuation. + * + * @type {?Node} + */ + thicknessAttenuationNode: Node | null; + /** + * Represents the thickness power. + * + * @type {?Node} + */ + thicknessPowerNode: Node | null; + /** + * Represents the thickness scale. + * + * @type {?Node} + */ + thicknessScaleNode: Node | null; + /** + * Whether the lighting model should use SSS or not. + * + * @type {boolean} + * @default true + */ + get useSSS(): boolean; + /** + * Setups the lighting model. + * + * @return {SSSLightingModel} The lighting model. + */ + setupLightingModel(): SSSLightingModel; +} +import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial.js'; +/** + * Represents the lighting model for {@link MeshSSSNodeMaterial}. + * + * @augments PhysicalLightingModel + */ +declare class SSSLightingModel extends PhysicalLightingModel { + /** + * Whether the lighting model should use SSS or not. + * + * @type {boolean} + * @default false + */ + useSSS: boolean; + /** + * Extends the default implementation with a SSS term. + * + * Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) + * + * @param {Object} input - The input data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; +} +import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts new file mode 100644 index 000000000..f81035d5a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts @@ -0,0 +1,80 @@ +export default MeshStandardNodeMaterial; +/** + * Node material version of {@link MeshStandardMaterial}. + * + * @augments NodeMaterial + */ +declare class MeshStandardNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh standard node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshStandardNodeMaterial: boolean; + /** + * The emissive color of standard materials is by default inferred from the `emissive`, + * `emissiveIntensity` and `emissiveMap` properties. This node property allows to + * overwrite the default and define the emissive color with a node instead. + * + * If you don't want to overwrite the emissive color but modify the existing + * value instead, use {@link materialEmissive}. + * + * @type {?Node} + * @default null + */ + emissiveNode: Node | null; + /** + * The metalness of standard materials is by default inferred from the `metalness`, + * and `metalnessMap` properties. This node property allows to + * overwrite the default and define the metalness with a node instead. + * + * If you don't want to overwrite the metalness but modify the existing + * value instead, use {@link materialMetalness}. + * + * @type {?Node} + * @default null + */ + metalnessNode: Node | null; + /** + * The roughness of standard materials is by default inferred from the `roughness`, + * and `roughnessMap` properties. This node property allows to + * overwrite the default and define the roughness with a node instead. + * + * If you don't want to overwrite the roughness but modify the existing + * value instead, use {@link materialRoughness}. + * + * @type {?Node} + * @default null + */ + roughnessNode: Node | null; + /** + * Overwritten since this type of material uses {@link EnvironmentNode} + * to implement the PBR (PMREM based) environment mapping. Besides, the + * method honors `Scene.environment`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?EnvironmentNode} The environment node. + */ + setupEnvironment(builder: NodeBuilder): EnvironmentNode | null; + /** + * Setups the lighting model. + * + * @return {PhysicalLightingModel} The lighting model. + */ + setupLightingModel(): PhysicalLightingModel; + /** + * Setups the specular related node variables. + */ + setupSpecular(): void; +} +import NodeMaterial from './NodeMaterial.js'; +import EnvironmentNode from '../../nodes/lighting/EnvironmentNode.js'; +import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts new file mode 100644 index 000000000..1ffe1bd1b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts @@ -0,0 +1,30 @@ +export default MeshToonNodeMaterial; +/** + * Node material version of {@link MeshToonMaterial}. + * + * @augments NodeMaterial + */ +declare class MeshToonNodeMaterial extends NodeMaterial { + /** + * Constructs a new mesh toon node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMeshToonNodeMaterial: boolean; + /** + * Setups the lighting model. + * + * @return {ToonLightingModel} The lighting model. + */ + setupLightingModel(): ToonLightingModel; +} +import NodeMaterial from './NodeMaterial.js'; +import ToonLightingModel from '../../nodes/functions/ToonLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts new file mode 100644 index 000000000..6389a9643 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts @@ -0,0 +1,524 @@ +export default NodeMaterial; +/** + * Base class for all node materials. + * + * @augments Material + */ +declare class NodeMaterial extends Material { + static get type(): string; + set type(_value: string); + /** + * Represents the type of the node material. + * + * @type {string} + */ + get type(): string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeMaterial: boolean; + /** + * Whether this material is affected by fog or not. + * + * @type {boolean} + * @default true + */ + fog: boolean; + /** + * Whether this material is affected by lights or not. + * + * @type {boolean} + * @default false + */ + lights: boolean; + /** + * Node materials which set their `lights` property to `true` + * are affected by all lights of the scene. Sometimes selective + * lighting is wanted which means only _some_ lights in the scene + * affect a material. This can be achieved by creating an instance + * of {@link LightsNode} with a list of selective + * lights and assign the node to this property. + * + * ```js + * const customLightsNode = lights( [ light1, light2 ] ); + * material.lightsNode = customLightsNode; + * ``` + * + * @type {?LightsNode} + * @default null + */ + lightsNode: LightsNode | null; + /** + * The environment of node materials can be defined by an environment + * map assigned to the `envMap` property or by `Scene.environment` + * if the node material is a PBR material. This node property allows to overwrite + * the default behavior and define the environment with a custom node. + * + * ```js + * material.envNode = pmremTexture( renderTarget.texture ); + * ``` + * + * @type {?Node} + * @default null + */ + envNode: Node | null; + /** + * The lighting of node materials might be influenced by ambient occlusion. + * The default AO is inferred from an ambient occlusion map assigned to `aoMap` + * and the respective `aoMapIntensity`. This node property allows to overwrite + * the default and define the ambient occlusion with a custom node instead. + * + * If you don't want to overwrite the diffuse color but modify the existing + * values instead, use {@link materialAO}. + * + * @type {?Node} + * @default null + */ + aoNode: Node | null; + /** + * The diffuse color of node materials is by default inferred from the + * `color` and `map` properties. This node property allows to overwrite the default + * and define the diffuse color with a node instead. + * + * ```js + * material.colorNode = color( 0xff0000 ); // define red color + * ``` + * + * If you don't want to overwrite the diffuse color but modify the existing + * values instead, use {@link materialColor}. + * + * ```js + * material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint + * ``` + * + * @type {?Node} + * @default null + */ + colorNode: Node | null; + /** + * The normals of node materials are by default inferred from the `normalMap`/`normalScale` + * or `bumpMap`/`bumpScale` properties. This node property allows to overwrite the default + * and define the normals with a node instead. + * + * If you don't want to overwrite the normals but modify the existing values instead, + * use {@link materialNormal}. + * + * @type {?Node} + * @default null + */ + normalNode: Node | null; + /** + * The opacity of node materials is by default inferred from the `opacity` + * and `alphaMap` properties. This node property allows to overwrite the default + * and define the opacity with a node instead. + * + * If you don't want to overwrite the opacity but modify the existing + * value instead, use {@link materialOpacity}. + * + * @type {?Node} + * @default null + */ + opacityNode: Node | null; + /** + * This node can be used to implement a variety of filter-like effects. The idea is + * to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it + * to create an arbitrary effect and then assign the node composition to this property. + * Everything behind the object using this material will now be affected by a filter. + * + * ```js + * const material = new NodeMaterial() + * material.transparent = true; + * + * // everything behind the object will be monochromatic + * material.backdropNode = saturation( viewportSharedTexture().rgb, 0 ); + * ``` + * + * Backdrop computations are part of the lighting so only lit materials can use this property. + * + * @type {?Node} + * @default null + */ + backdropNode: Node | null; + /** + * This node allows to modulate the influence of `backdropNode` to the outgoing light. + * + * @type {?Node} + * @default null + */ + backdropAlphaNode: Node | null; + /** + * The alpha test of node materials is by default inferred from the `alphaTest` + * property. This node property allows to overwrite the default and define the + * alpha test with a node instead. + * + * If you don't want to overwrite the alpha test but modify the existing + * value instead, use {@link materialAlphaTest}. + * + * @type {?Node} + * @default null + */ + alphaTestNode: Node | null; + /** + * Discards the fragment if the mask value is `false`. + * + * @type {?Node} + * @default null + */ + maskNode: Node | null; + /** + * This node can be used to implement a shadow mask for the material. + * + * @type {?Node} + * @default null + */ + maskShadowNode: Node | null; + /** + * The local vertex positions are computed based on multiple factors like the + * attribute data, morphing or skinning. This node property allows to overwrite + * the default and define local vertex positions with nodes instead. + * + * If you don't want to overwrite the vertex positions but modify the existing + * values instead, use {@link positionLocal}. + * + *```js + * material.positionNode = positionLocal.add( displace ); + * ``` + * + * @type {?Node} + * @default null + */ + positionNode: Node | null; + /** + * This node property is intended for logic which modifies geometry data once or per animation step. + * Apps usually place such logic randomly in initialization routines or in the animation loop. + * `geometryNode` is intended as a dedicated API so there is an intended spot where geometry modifications + * can be implemented. + * + * The idea is to assign a `Fn` definition that holds the geometry modification logic. A typical example + * would be a GPU based particle system that provides a node material for usage on app level. The particle + * simulation would be implemented as compute shaders and managed inside a `Fn` function. This function is + * eventually assigned to `geometryNode`. + * + * @type {?Function} + * @default null + */ + geometryNode: Function | null; + /** + * Allows to overwrite depth values in the fragment shader. + * + * @type {?Node} + * @default null + */ + depthNode: Node | null; + /** + * Allows to overwrite the position used for shadow map rendering which + * is by default {@link positionWorld}, the vertex position + * in world space. + * + * @type {?Node} + * @default null + */ + receivedShadowPositionNode: Node | null; + /** + * Allows to overwrite the geometry position used for shadow map projection which + * is by default {@link positionLocal}, the vertex position in local space. + * + * @type {?Node} + * @default null + */ + castShadowPositionNode: Node | null; + /** + * This node can be used to influence how an object using this node material + * receive shadows. + * + * ```js + * const totalShadows = float( 1 ).toVar(); + * material.receivedShadowNode = Fn( ( [ shadow ] ) => { + * totalShadows.mulAssign( shadow ); + * //return float( 1 ); // bypass received shadows + * return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color + * } ); + * + * @type {?(Function|FunctionNode)} + * @default null + */ + receivedShadowNode: (Function | FunctionNode) | null; + /** + * This node can be used to influence how an object using this node material + * casts shadows. To apply a color to shadows, you can simply do: + * + * ```js + * material.castShadowNode = vec4( 1, 0, 0, 1 ); + * ``` + * + * Which can be nice to fake colored shadows of semi-transparent objects. It + * is also common to use the property with `Fn` function so checks are performed + * per fragment. + * + * ```js + * materialCustomShadow.castShadowNode = Fn( () => { + * hash( vertexIndex ).greaterThan( 0.5 ).discard(); + * return materialColor; + * } )(); + * ``` + * + * @type {?Node} + * @default null + */ + castShadowNode: Node | null; + /** + * This node can be used to overwrite the final output of the material. + * + * Unlike {@link NodeMaterial#fragmentNode}, the built-in material logic + * (diffuse color, lighting, etc.) is still evaluated; assigning a node + * only replaces the resulting output color. + * + * @type {?Node} + * @default null + */ + outputNode: Node | null; + /** + * MRT configuration is done on renderer or pass level. This node allows to + * overwrite what values are written into MRT targets on material level. This + * can be useful for implementing selective FX features that should only affect + * specific objects. + * + * @type {?MRTNode} + * @default null + */ + mrtNode: MRTNode | null; + /** + * This node property can be used if you need complete freedom in implementing + * the fragment shader. Assigning a node will replace the built-in material + * logic used in the fragment stage. + * + * @type {?Node} + * @default null + */ + fragmentNode: Node | null; + /** + * This node property can be used if you need complete freedom in implementing + * the vertex shader. Assigning a node will replace the built-in material logic + * used in the vertex stage. + * + * @type {?Node} + * @default null + */ + vertexNode: Node | null; + /** + * This node can be used as a global context management component for this material. + * + * @type {?ContextNode} + * @default null + */ + contextNode: ContextNode | null; + /** + * Returns an array of child nodes for this material. + * + * @private + * @returns {Array<{property: string, childNode: Node}>} + */ + private _getNodeChildren; + /** + * Builds this material with the given node builder. + * + * @param {NodeBuilder} builder - The current node builder. + */ + build(builder: NodeBuilder): void; + /** + * Setups a node material observer with the given builder. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {NodeMaterialObserver} The node material observer. + */ + setupObserver(builder: NodeBuilder): NodeMaterialObserver; + /** + * Setups the vertex and fragment stage of this node material. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * Setups the clipping node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {ClippingNode} The clipping node. + */ + setupClipping(builder: NodeBuilder): ClippingNode; + /** + * Setups the hardware clipping if available on the current device. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupHardwareClipping(builder: NodeBuilder): void; + /** + * Setups the depth of this material. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupDepth(builder: NodeBuilder): void; + /** + * Setups the position node in view space. This method exists + * so derived node materials can modify the implementation e.g. sprite materials. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in view space. + */ + setupPositionView(): Node; + /** + * Setups the position in clip space. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in view space. + */ + setupModelViewProjection(): Node; + /** + * Setups the logic for the vertex stage. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in clip space. + */ + setupVertex(builder: NodeBuilder): Node; + /** + * Setups the computation of the position in local space. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in local space. + */ + setupPosition(builder: NodeBuilder): Node; + /** + * Setups the computation of the material's diffuse color. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupDiffuseColor(builder: NodeBuilder): void; + /** + * Abstract interface method that can be implemented by derived materials + * to setup material-specific node variables. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + setupVariants(): void; + /** + * Setups the outgoing light node variable + * + * @return {Node} The outgoing light node. + */ + setupOutgoingLight(): Node; + /** + * Setups the normal node from the material. + * + * @return {Node} The normal node. + */ + setupNormal(): Node; + /** + * Setups the environment node from the material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The environment node. + */ + setupEnvironment(): Node; + /** + * Setups the light map node from the material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The light map node. + */ + setupLightMap(builder: NodeBuilder): Node; + /** + * Setups the lights node based on the scene, environment and material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {LightingNode} The lights node. + */ + setupMaterialLightings(builder: NodeBuilder): LightingNode; + /** + * Setups the ambient occlusion node from the material. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The ambient occlusion node. + */ + setupAmbientOcclusion(builder: NodeBuilder): Node; + /** + * This method should be implemented by most derived materials + * since it defines the material's lighting model. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + * @return {LightingModel} The lighting model. + */ + setupLightingModel(): LightingModel; + /** + * Setups the outgoing light node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The outgoing light node. + */ + setupLighting(builder: NodeBuilder): Node; + /** + * Setup the fog. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} outputNode - The existing output node. + * @return {Node} The output node. + */ + setupFog(builder: NodeBuilder, outputNode: Node): Node; + /** + * Setups premultiplied alpha. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} outputNode - The existing output node. + * @return {Node} The output node. + */ + setupPremultipliedAlpha(builder: NodeBuilder, outputNode: Node): Node; + /** + * Setups the output node. + * + * This method can be implemented by derived materials to extend the functionality + * of the material's output or replace it altogether. + * + * ```js + * class ColoredShadowMaterial extends MeshPhongNodeMaterial { + * constructor( parameters ) { + * super( parameters ); + * this._shadeColor = uniform( new Color( parameters.shadeColor ?? 0xff0000 ) ); + * } + * + * setupOutput( builder, outputNode ) { + * // Modify the native output of the MeshPhongNodeMaterial fragment shader + * const brightness = min( outputNode.r, 1.0 ); + * const mixedColor = mix( this._shadeColor, diffuseColor.rgb, brightness ); + * // Return new output back into NodeMaterial flow + * return super.setupOutput( builder, vec4( mixedColor, outputNode.a ) ); + * } + * } + * ``` + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} outputNode - The existing output node. + * @return {Node} The output node. + */ + setupOutput(builder: NodeBuilder, outputNode: Node): Node; + /** + * Most classic material types have a node pendant e.g. for `MeshBasicMaterial` + * there is `MeshBasicNodeMaterial`. This utility method is intended for + * defining all material properties of the classic type in the node type. + * + * @param {Material} material - The material to copy properties with their values to this node material. + */ + setDefaultValues(material: Material): void; + /** + * Copies the common properties of the given material to this instance. + * + * @param {Material} source - The material to copy. + * @return {NodeMaterial} A reference to this node material. + */ + copy(source: Material): NodeMaterial; +} +import { Material } from '../Material.js'; +import NodeMaterialObserver from './manager/NodeMaterialObserver.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts new file mode 100644 index 000000000..3ab3141d1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts @@ -0,0 +1,18 @@ +export { default as NodeMaterialObserver } from "./manager/NodeMaterialObserver.js"; +export { default as NodeMaterial } from "./NodeMaterial.js"; +export { default as LineBasicNodeMaterial } from "./LineBasicNodeMaterial.js"; +export { default as LineDashedNodeMaterial } from "./LineDashedNodeMaterial.js"; +export { default as Line2NodeMaterial } from "./Line2NodeMaterial.js"; +export { default as MeshNormalNodeMaterial } from "./MeshNormalNodeMaterial.js"; +export { default as MeshBasicNodeMaterial } from "./MeshBasicNodeMaterial.js"; +export { default as MeshLambertNodeMaterial } from "./MeshLambertNodeMaterial.js"; +export { default as MeshPhongNodeMaterial } from "./MeshPhongNodeMaterial.js"; +export { default as MeshStandardNodeMaterial } from "./MeshStandardNodeMaterial.js"; +export { default as MeshPhysicalNodeMaterial } from "./MeshPhysicalNodeMaterial.js"; +export { default as MeshSSSNodeMaterial } from "./MeshSSSNodeMaterial.js"; +export { default as MeshToonNodeMaterial } from "./MeshToonNodeMaterial.js"; +export { default as MeshMatcapNodeMaterial } from "./MeshMatcapNodeMaterial.js"; +export { default as PointsNodeMaterial } from "./PointsNodeMaterial.js"; +export { default as SpriteNodeMaterial } from "./SpriteNodeMaterial.js"; +export { default as ShadowNodeMaterial } from "./ShadowNodeMaterial.js"; +export { default as VolumeNodeMaterial } from "./VolumeNodeMaterial.js"; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts new file mode 100644 index 000000000..1a6e48eef --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts @@ -0,0 +1,49 @@ +export default PointsNodeMaterial; +/** + * Node material version of {@link PointsMaterial}. + * + * This material can be used in two ways: + * + * - By rendering point primitives with {@link Points}. Since WebGPU only supports point primitives + * with a pixel size of `1`, it's not possible to define a size. + * + * ```js + * const pointCloud = new THREE.Points( geometry, new THREE.PointsNodeMaterial() ); + * ``` + * + * - By rendering point primitives with {@link Sprites}. In this case, size is honored, + * see {@link PointsNodeMaterial#sizeNode}. + * + * ```js + * const instancedPoints = new THREE.Sprite( new THREE.PointsNodeMaterial( { positionNode: instancedBufferAttribute( positionAttribute ) } ) ); + * ``` + * + * @augments SpriteNodeMaterial + */ +declare class PointsNodeMaterial extends SpriteNodeMaterial { + /** + * This node property provides an additional way to set the point size. + * + * Note that WebGPU only supports point primitives with 1 pixel size. Consequently, + * this node has no effect when the material is used with {@link Points} and a WebGPU + * backend. If an application wants to render points with a size larger than 1 pixel, + * the material should be used with {@link Sprite} and instancing. + * + * @type {?Node} + * @default null + */ + sizeNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPointsNodeMaterial: boolean; + setupPositionView(): any; + setupVertexSprite(builder: any): any; + setupVertex(builder: any): any; + _useAlphaToCoverage: any; +} +import SpriteNodeMaterial from './SpriteNodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts new file mode 100644 index 000000000..edf904684 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts @@ -0,0 +1,30 @@ +export default ShadowNodeMaterial; +/** + * Node material version of {@link ShadowMaterial}. + * + * @augments NodeMaterial + */ +declare class ShadowNodeMaterial extends NodeMaterial { + /** + * Constructs a new shadow node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowNodeMaterial: boolean; + /** + * Setups the lighting model. + * + * @return {ShadowMaskModel} The lighting model. + */ + setupLightingModel(): ShadowMaskModel; +} +import NodeMaterial from './NodeMaterial.js'; +import ShadowMaskModel from '../../nodes/functions/ShadowMaskModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts new file mode 100644 index 000000000..491e32e08 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts @@ -0,0 +1,61 @@ +export default SpriteNodeMaterial; +/** + * Node material version of {@link SpriteMaterial}. + * + * @augments NodeMaterial + */ +declare class SpriteNodeMaterial extends NodeMaterial { + /** + * Constructs a new sprite node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSpriteNodeMaterial: boolean; + _useSizeAttenuation: boolean; + /** + * The rotation of sprite materials is by default inferred from the `rotation`, + * property. This node property allows to overwrite the default and define + * the rotation with a node instead. + * + * If you don't want to overwrite the rotation but modify the existing + * value instead, use {@link materialRotation}. + * + * @type {?Node} + * @default null + */ + rotationNode: Node | null; + /** + * This node property provides an additional way to scale sprites next to + * `Object3D.scale`. The scale transformation based in `Object3D.scale` + * is multiplied with the scale value of this node in the vertex shader. + * + * @type {?Node} + * @default null + */ + scaleNode: Node | null; + /** + * Setups the position node in view space. This method implements + * the sprite specific vertex shader. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The position in view space. + */ + setupPositionView(builder: NodeBuilder): Node; + set sizeAttenuation(value: boolean); + /** + * Whether to use size attenuation or not. + * + * @type {boolean} + * @default true + */ + get sizeAttenuation(): boolean; +} +import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts new file mode 100644 index 000000000..8b5885c3c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts @@ -0,0 +1,48 @@ +export default VolumeNodeMaterial; +/** + * Volume node material. + * + * @augments NodeMaterial + */ +declare class VolumeNodeMaterial extends NodeMaterial { + /** + * Constructs a new volume node material. + * + * @param {Object} [parameters] - The configuration parameter. + */ + constructor(parameters?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVolumeNodeMaterial: boolean; + /** + * Number of steps used for raymarching. + * + * @type {number} + * @default 25 + */ + steps: number; + /** + * Offsets the distance a ray has been traveled through a volume. + * Can be used to implement dithering to reduce banding. + * + * @type {Node} + * @default null + */ + offsetNode: Node; + /** + * Node used for scattering calculations. + * + * @type {Function|FunctionNode} + * @default null + */ + scatteringNode: Function | FunctionNode; + side: number; + setupLightingModel(): VolumetricLightingModel; +} +import NodeMaterial from './NodeMaterial.js'; +import VolumetricLightingModel from '../../nodes/functions/VolumetricLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts new file mode 100644 index 000000000..3f21040e0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts @@ -0,0 +1,147 @@ +export default NodeMaterialObserver; +/** + * This class is used by {@link WebGPURenderer} as management component. + * It's primary purpose is to determine whether render objects require a + * refresh right before they are going to be rendered or not. + */ +declare class NodeMaterialObserver { + /** + * Constructs a new node material observer. + * + * @param {NodeBuilder} builder - The node builder. + */ + constructor(builder: NodeBuilder); + /** + * A node material can be used by more than one render object so the + * monitor must maintain a list of render objects. + * + * @type {WeakMap} + */ + renderObjects: WeakMap; + /** + * Whether the material uses node objects or not. + * + * @type {boolean} + */ + hasNode: boolean; + /** + * Whether the node builder's 3D object is animated or not. + * + * @type {boolean} + */ + hasAnimation: boolean; + /** + * A list of all possible material uniforms + * + * @type {Array} + */ + refreshUniforms: Array; + /** + * Holds the current render ID from the node frame. + * + * @type {number} + * @default 0 + */ + renderId: number; + /** + * Returns `true` if the given render object is verified for the first time of this observer. + * + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether the given render object is verified for the first time of this observer. + */ + firstInitialization(renderObject: RenderObject): boolean; + /** + * Returns `true` if the given 3D object uses instance buffers with dynamic draw usage. + * Such buffers must be uploaded once per render so the render object requires a full refresh. + * + * @param {Object3D} object - The 3D object. + * @return {boolean} Whether the given 3D object uses instance buffers with dynamic draw usage or not. + */ + hasDynamicInstancing(object: Object3D): boolean; + /** + * Returns `true` if the current rendering produces motion vectors. + * + * @param {Renderer} renderer - The renderer. + * @return {boolean} Whether the current rendering produces motion vectors or not. + */ + needsVelocity(renderer: Renderer): boolean; + /** + * Returns monitoring data for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {Object} The monitoring data. + */ + getRenderObjectData(renderObject: RenderObject): Object; + /** + * Returns an attribute data structure holding the attributes versions for + * monitoring. + * + * @param {Object} attributes - The geometry attributes. + * @return {Object} An object for monitoring the versions of attributes. + */ + getAttributesData(attributes: Object): Object; + /** + * Returns `true` if the node builder's material uses + * node properties. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether the node builder's material uses node properties or not. + */ + containsNode(builder: NodeBuilder): boolean; + /** + * Returns a geometry data structure holding the geometry property values for + * monitoring. + * + * @param {BufferGeometry} geometry - The geometry. + * @return {Object} An object for monitoring geometry properties. + */ + getGeometryData(geometry: BufferGeometry): Object; + /** + * Returns a texture data structure holding the texture state for + * monitoring. + * + * @param {Texture} texture - The texture. + * @return {Object} An object for monitoring the texture. + */ + getTextureData(texture: Texture): Object; + /** + * Returns a material data structure holding the material property values for + * monitoring. + * + * @param {Material} material - The material. + * @return {Object} An object for monitoring material properties. + */ + getMaterialData(material: Material): Object; + /** + * Returns `true` if the given render object has not changed its state. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} lightsData - The current material lights. + * @param {number} renderId - The current render ID. + * @return {boolean} Whether the given render object is equal to its cached state or not. + */ + equals(renderObject: RenderObject, lightsData: Array, renderId: number): boolean; + /** + * Returns the lights data for the given material lights. + * + * @param {Array} materialLights - The material lights. + * @return {Array} The lights data for the given material lights. + */ + getLightsData(materialLights: Array, lights: any): Array; + /** + * Returns the lights for the given lights node and render ID. + * + * @param {LightsNode} lightsNode - The lights node. + * @param {number} renderId - The render ID. + * @return {Array} The lights for the given lights node and render ID. + */ + getLights(lightsNode: LightsNode, renderId: number): Array; + /** + * Checks if the given render object requires a refresh. + * + * @param {RenderObject} renderObject - The render object. + * @param {NodeFrame} nodeFrame - The current node frame. + * @return {number} The refresh type, see {@link RenderObjectRefreshType}. + */ + needsRefresh(renderObject: RenderObject, nodeFrame: NodeFrame): number; +} diff --git a/jsdoc-testing/jsdoc/src/math/Box2.d.ts b/jsdoc-testing/jsdoc/src/math/Box2.d.ts new file mode 100644 index 000000000..cc99e0f2f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Box2.d.ts @@ -0,0 +1,205 @@ +/** + * Represents an axis-aligned bounding box (AABB) in 2D space. + */ +export class Box2 { + /** + * Constructs a new bounding box. + * + * @param {Vector2} [min=(Infinity,Infinity)] - A vector representing the lower boundary of the box. + * @param {Vector2} [max=(-Infinity,-Infinity)] - A vector representing the upper boundary of the box. + */ + constructor(min?: Vector2, max?: Vector2); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBox2: boolean; + /** + * The lower boundary of the box. + * + * @type {Vector2} + */ + min: Vector2; + /** + * The upper boundary of the box. + * + * @type {Vector2} + */ + max: Vector2; + /** + * Sets the lower and upper boundaries of this box. + * Please note that this method only copies the values from the given objects. + * + * @param {Vector2} min - The lower boundary of the box. + * @param {Vector2} max - The upper boundary of the box. + * @return {Box2} A reference to this bounding box. + */ + set(min: Vector2, max: Vector2): Box2; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given array. + * + * @param {Array} points - An array holding 2D position data as instances of {@link Vector2}. + * @return {Box2} A reference to this bounding box. + */ + setFromPoints(points: Array): Box2; + /** + * Centers this box on the given center vector and sets this box's width, height and + * depth to the given size values. + * + * @param {Vector2} center - The center of the box. + * @param {Vector2} size - The x and y dimensions of the box. + * @return {Box2} A reference to this bounding box. + */ + setFromCenterAndSize(center: Vector2, size: Vector2): Box2; + /** + * Returns a new box with copied values from this instance. + * + * @return {Box2} A clone of this instance. + */ + clone(): Box2; + /** + * Copies the values of the given box to this instance. + * + * @param {Box2} box - The box to copy. + * @return {Box2} A reference to this bounding box. + */ + copy(box: Box2): Box2; + /** + * Makes this box empty which means in encloses a zero space in 2D. + * + * @return {Box2} A reference to this bounding box. + */ + makeEmpty(): Box2; + /** + * Returns true if this box includes zero points within its bounds. + * Note that a box with equal lower and upper bounds still includes one + * point, the one both bounds share. + * + * @return {boolean} Whether this box is empty or not. + */ + isEmpty(): boolean; + /** + * Returns the center point of this box. + * + * @param {Vector2} target - The target vector that is used to store the method's result. + * @return {Vector2} The center point. + */ + getCenter(target: Vector2): Vector2; + /** + * Returns the dimensions of this box. + * + * @param {Vector2} target - The target vector that is used to store the method's result. + * @return {Vector2} The size. + */ + getSize(target: Vector2): Vector2; + /** + * Expands the boundaries of this box to include the given point. + * + * @param {Vector2} point - The point that should be included by the bounding box. + * @return {Box2} A reference to this bounding box. + */ + expandByPoint(point: Vector2): Box2; + /** + * Expands this box equilaterally by the given vector. The width of this + * box will be expanded by the x component of the vector in both + * directions. The height of this box will be expanded by the y component of + * the vector in both directions. + * + * @param {Vector2} vector - The vector that should expand the bounding box. + * @return {Box2} A reference to this bounding box. + */ + expandByVector(vector: Vector2): Box2; + /** + * Expands each dimension of the box by the given scalar. If negative, the + * dimensions of the box will be contracted. + * + * @param {number} scalar - The scalar value that should expand the bounding box. + * @return {Box2} A reference to this bounding box. + */ + expandByScalar(scalar: number): Box2; + /** + * Returns `true` if the given point lies within or on the boundaries of this box. + * + * @param {Vector2} point - The point to test. + * @return {boolean} Whether the bounding box contains the given point or not. + */ + containsPoint(point: Vector2): boolean; + /** + * Returns `true` if this bounding box includes the entirety of the given bounding box. + * If this box and the given one are identical, this function also returns `true`. + * + * @param {Box2} box - The bounding box to test. + * @return {boolean} Whether the bounding box contains the given bounding box or not. + */ + containsBox(box: Box2): boolean; + /** + * Returns a point as a proportion of this box's width and height. + * + * @param {Vector2} point - A point in 2D space. + * @param {Vector2} target - The target vector that is used to store the method's result. + * @return {Vector2} A point as a proportion of this box's width and height. + */ + getParameter(point: Vector2, target: Vector2): Vector2; + /** + * Returns `true` if the given bounding box intersects with this bounding box. + * + * @param {Box2} box - The bounding box to test. + * @return {boolean} Whether the given bounding box intersects with this bounding box. + */ + intersectsBox(box: Box2): boolean; + /** + * Clamps the given point within the bounds of this box. + * + * @param {Vector2} point - The point to clamp. + * @param {Vector2} target - The target vector that is used to store the method's result. + * @return {Vector2} The clamped point. + */ + clampPoint(point: Vector2, target: Vector2): Vector2; + /** + * Returns the euclidean distance from any edge of this box to the specified point. If + * the given point lies inside of this box, the distance will be `0`. + * + * @param {Vector2} point - The point to compute the distance to. + * @return {number} The euclidean distance. + */ + distanceToPoint(point: Vector2): number; + /** + * Computes the intersection of this bounding box and the given one, setting the upper + * bound of this box to the lesser of the two boxes' upper bounds and the + * lower bound of this box to the greater of the two boxes' lower bounds. If + * there's no overlap, makes this box empty. + * + * @param {Box2} box - The bounding box to intersect with. + * @return {Box2} A reference to this bounding box. + */ + intersect(box: Box2): Box2; + /** + * Computes the union of this box and another and the given one, setting the upper + * bound of this box to the greater of the two boxes' upper bounds and the + * lower bound of this box to the lesser of the two boxes' lower bounds. + * + * @param {Box2} box - The bounding box that will be unioned with this instance. + * @return {Box2} A reference to this bounding box. + */ + union(box: Box2): Box2; + /** + * Adds the given offset to both the upper and lower bounds of this bounding box, + * effectively moving it in 2D space. + * + * @param {Vector2} offset - The offset that should be used to translate the bounding box. + * @return {Box2} A reference to this bounding box. + */ + translate(offset: Vector2): Box2; + /** + * Returns `true` if this bounding box is equal with the given one. + * + * @param {Box2} box - The box to test for equality. + * @return {boolean} Whether this bounding box is equal with the given one. + */ + equals(box: Box2): boolean; +} +import { Vector2 } from './Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Box3.d.ts b/jsdoc-testing/jsdoc/src/math/Box3.d.ts new file mode 100644 index 000000000..b1c152106 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Box3.d.ts @@ -0,0 +1,298 @@ +/** + * Represents an axis-aligned bounding box (AABB) in 3D space. + */ +export class Box3 { + /** + * Constructs a new bounding box. + * + * @param {Vector3} [min=(Infinity,Infinity,Infinity)] - A vector representing the lower boundary of the box. + * @param {Vector3} [max=(-Infinity,-Infinity,-Infinity)] - A vector representing the upper boundary of the box. + */ + constructor(min?: Vector3, max?: Vector3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBox3: boolean; + /** + * The lower boundary of the box. + * + * @type {Vector3} + */ + min: Vector3; + /** + * The upper boundary of the box. + * + * @type {Vector3} + */ + max: Vector3; + /** + * Sets the lower and upper boundaries of this box. + * Please note that this method only copies the values from the given objects. + * + * @param {Vector3} min - The lower boundary of the box. + * @param {Vector3} max - The upper boundary of the box. + * @return {Box3} A reference to this bounding box. + */ + set(min: Vector3, max: Vector3): Box3; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given array. + * + * @param {Array} array - An array holding 3D position data. + * @return {Box3} A reference to this bounding box. + */ + setFromArray(array: Array): Box3; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given buffer attribute. + * + * @param {BufferAttribute} attribute - A buffer attribute holding 3D position data. + * @return {Box3} A reference to this bounding box. + */ + setFromBufferAttribute(attribute: BufferAttribute): Box3; + /** + * Sets the upper and lower bounds of this box so it encloses the position data + * in the given array. + * + * @param {Array} points - An array holding 3D position data as instances of {@link Vector3}. + * @return {Box3} A reference to this bounding box. + */ + setFromPoints(points: Array): Box3; + /** + * Centers this box on the given center vector and sets this box's width, height and + * depth to the given size values. + * + * @param {Vector3} center - The center of the box. + * @param {Vector3} size - The x, y and z dimensions of the box. + * @return {Box3} A reference to this bounding box. + */ + setFromCenterAndSize(center: Vector3, size: Vector3): Box3; + /** + * Computes the world-axis-aligned bounding box for the given 3D object + * (including its children), accounting for the object's, and children's, + * world transforms. The function may result in a larger box than strictly necessary. + * + * Note: To compute the correct bounding box, make sure the given 3D object + * has an up-to-date world matrix that reflects the current transformation of its + * ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if + * you're unsure. + * + * @param {Object3D} object - The 3D object to compute the bounding box for. + * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest + * world-axis-aligned bounding box at the expense of more computation. + * @return {Box3} A reference to this bounding box. + */ + setFromObject(object: Object3D, precise?: boolean): Box3; + /** + * Returns a new box with copied values from this instance. + * + * @return {Box3} A clone of this instance. + */ + clone(): Box3; + /** + * Copies the values of the given box to this instance. + * + * @param {Box3} box - The box to copy. + * @return {Box3} A reference to this bounding box. + */ + copy(box: Box3): Box3; + /** + * Makes this box empty which means in encloses a zero space in 3D. + * + * @return {Box3} A reference to this bounding box. + */ + makeEmpty(): Box3; + /** + * Returns true if this box includes zero points within its bounds. + * Note that a box with equal lower and upper bounds still includes one + * point, the one both bounds share. + * + * @return {boolean} Whether this box is empty or not. + */ + isEmpty(): boolean; + /** + * Returns the center point of this box. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The center point. + */ + getCenter(target: Vector3): Vector3; + /** + * Returns the dimensions of this box. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The size. + */ + getSize(target: Vector3): Vector3; + /** + * Expands the boundaries of this box to include the given point. + * + * @param {Vector3} point - The point that should be included by the bounding box. + * @return {Box3} A reference to this bounding box. + */ + expandByPoint(point: Vector3): Box3; + /** + * Expands this box equilaterally by the given vector. The width of this + * box will be expanded by the x component of the vector in both + * directions. The height of this box will be expanded by the y component of + * the vector in both directions. The depth of this box will be + * expanded by the z component of the vector in both directions. + * + * @param {Vector3} vector - The vector that should expand the bounding box. + * @return {Box3} A reference to this bounding box. + */ + expandByVector(vector: Vector3): Box3; + /** + * Expands each dimension of the box by the given scalar. If negative, the + * dimensions of the box will be contracted. + * + * @param {number} scalar - The scalar value that should expand the bounding box. + * @return {Box3} A reference to this bounding box. + */ + expandByScalar(scalar: number): Box3; + /** + * Expands the boundaries of this box to include the given 3D object and + * its children, accounting for the object's, and children's, world + * transforms. The function may result in a larger box than strictly + * necessary (unless the precise parameter is set to true). + * + * @param {Object3D} object - The 3D object that should expand the bounding box. + * @param {boolean} precise - If set to `true`, the method expands the bounding box + * as little as necessary at the expense of more computation. + * @return {Box3} A reference to this bounding box. + */ + expandByObject(object: Object3D, precise?: boolean): Box3; + /** + * Returns `true` if the given point lies within or on the boundaries of this box. + * + * @param {Vector3} point - The point to test. + * @return {boolean} Whether the bounding box contains the given point or not. + */ + containsPoint(point: Vector3): boolean; + /** + * Returns `true` if this bounding box includes the entirety of the given bounding box. + * If this box and the given one are identical, this function also returns `true`. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the bounding box contains the given bounding box or not. + */ + containsBox(box: Box3): boolean; + /** + * Returns a point as a proportion of this box's width, height and depth. + * + * @param {Vector3} point - A point in 3D space. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} A point as a proportion of this box's width, height and depth. + */ + getParameter(point: Vector3, target: Vector3): Vector3; + /** + * Returns `true` if the given bounding box intersects with this bounding box. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the given bounding box intersects with this bounding box. + */ + intersectsBox(box: Box3): boolean; + /** + * Returns `true` if the given bounding sphere intersects with this bounding box. + * + * @param {Sphere} sphere - The bounding sphere to test. + * @return {boolean} Whether the given bounding sphere intersects with this bounding box. + */ + intersectsSphere(sphere: Sphere): boolean; + /** + * Returns `true` if the given plane intersects with this bounding box. + * + * @param {Plane} plane - The plane to test. + * @return {boolean} Whether the given plane intersects with this bounding box. + */ + intersectsPlane(plane: Plane): boolean; + /** + * Returns `true` if the given triangle intersects with this bounding box. + * + * @param {Triangle} triangle - The triangle to test. + * @return {boolean} Whether the given triangle intersects with this bounding box. + */ + intersectsTriangle(triangle: Triangle): boolean; + /** + * Clamps the given point within the bounds of this box. + * + * @param {Vector3} point - The point to clamp. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The clamped point. + */ + clampPoint(point: Vector3, target: Vector3): Vector3; + /** + * Returns the euclidean distance from any edge of this box to the specified point. If + * the given point lies inside of this box, the distance will be `0`. + * + * @param {Vector3} point - The point to compute the distance to. + * @return {number} The euclidean distance. + */ + distanceToPoint(point: Vector3): number; + /** + * Returns a bounding sphere that encloses this bounding box. + * + * @param {Sphere} target - The target sphere that is used to store the method's result. + * @return {Sphere} The bounding sphere that encloses this bounding box. + */ + getBoundingSphere(target: Sphere): Sphere; + /** + * Computes the intersection of this bounding box and the given one, setting the upper + * bound of this box to the lesser of the two boxes' upper bounds and the + * lower bound of this box to the greater of the two boxes' lower bounds. If + * there's no overlap, makes this box empty. + * + * @param {Box3} box - The bounding box to intersect with. + * @return {Box3} A reference to this bounding box. + */ + intersect(box: Box3): Box3; + /** + * Computes the union of this box and another and the given one, setting the upper + * bound of this box to the greater of the two boxes' upper bounds and the + * lower bound of this box to the lesser of the two boxes' lower bounds. + * + * @param {Box3} box - The bounding box that will be unioned with this instance. + * @return {Box3} A reference to this bounding box. + */ + union(box: Box3): Box3; + /** + * Transforms this bounding box by the given 4x4 transformation matrix. + * + * @param {Matrix4} matrix - The transformation matrix. + * @return {Box3} A reference to this bounding box. + */ + applyMatrix4(matrix: Matrix4): Box3; + /** + * Adds the given offset to both the upper and lower bounds of this bounding box, + * effectively moving it in 3D space. + * + * @param {Vector3} offset - The offset that should be used to translate the bounding box. + * @return {Box3} A reference to this bounding box. + */ + translate(offset: Vector3): Box3; + /** + * Returns `true` if this bounding box is equal with the given one. + * + * @param {Box3} box - The box to test for equality. + * @return {boolean} Whether this bounding box is equal with the given one. + */ + equals(box: Box3): boolean; + /** + * Returns a serialized structure of the bounding box. + * + * @return {Object} Serialized structure with fields representing the object state. + */ + toJSON(): Object; + /** + * Returns a serialized structure of the bounding box. + * + * @param {Object} json - The serialized json to set the box from. + * @return {Box3} A reference to this bounding box. + */ + fromJSON(json: Object): Box3; +} +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Color.d.ts b/jsdoc-testing/jsdoc/src/math/Color.d.ts new file mode 100644 index 000000000..88445d822 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Color.d.ts @@ -0,0 +1,538 @@ +/** + * A Color instance is represented by RGB components in the linear working + * color space, which defaults to `LinearSRGBColorSpace`. Inputs + * conventionally using `SRGBColorSpace` (such as hexadecimals and CSS + * strings) are converted to the working color space automatically. + * + * ```js + * // converted automatically from SRGBColorSpace to LinearSRGBColorSpace + * const color = new THREE.Color().setHex( 0x112233 ); + * ``` + * Source color spaces may be specified explicitly, to ensure correct conversions. + * ```js + * // assumed already LinearSRGBColorSpace; no conversion + * const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5 ); + * + * // converted explicitly from SRGBColorSpace to LinearSRGBColorSpace + * const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5, SRGBColorSpace ); + * ``` + * If THREE.ColorManagement is disabled, no conversions occur. For details, + * see Color management. Iterating through a Color instance will yield + * its components (r, g, b) in the corresponding order. A Color can be initialised + * in any of the following ways: + * ```js + * //empty constructor - will default white + * const color1 = new THREE.Color(); + * + * //Hexadecimal color (recommended) + * const color2 = new THREE.Color( 0xff0000 ); + * + * //RGB string + * const color3 = new THREE.Color("rgb(255, 0, 0)"); + * const color4 = new THREE.Color("rgb(100%, 0%, 0%)"); + * + * //X11 color name - all 140 color names are supported. + * //Note the lack of CamelCase in the name + * const color5 = new THREE.Color( 'skyblue' ); + * //HSL string + * const color6 = new THREE.Color("hsl(0, 100%, 50%)"); + * + * //Separate RGB values between 0 and 1 + * const color7 = new THREE.Color( 1, 0, 0 ); + * ``` + */ +export class Color { + /** + * Constructs a new color. + * + * Note that standard method of specifying color in three.js is with a hexadecimal triplet, + * and that method is used throughout the rest of the documentation. + * + * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are + * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance. + * @param {number} [g] - The green component. + * @param {number} [b] - The blue component. + */ + constructor(r?: (number | string | Color), g?: number, b?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isColor: boolean; + /** + * The red component. + * + * @type {number} + * @default 1 + */ + r: number; + /** + * The green component. + * + * @type {number} + * @default 1 + */ + g: number; + /** + * The blue component. + * + * @type {number} + * @default 1 + */ + b: number; + /** + * Sets the colors's components from the given values. + * + * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are + * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance. + * @param {number} [g] - The green component. + * @param {number} [b] - The blue component. + * @return {Color} A reference to this color. + */ + set(r?: (number | string | Color), g?: number, b?: number): Color; + /** + * Sets the colors's components to the given scalar value. + * + * @param {number} scalar - The scalar value. + * @return {Color} A reference to this color. + */ + setScalar(scalar: number): Color; + /** + * Sets this color from a hexadecimal value. + * + * @param {number} hex - The hexadecimal value. + * @param {string} [colorSpace=SRGBColorSpace] - The color space. + * @return {Color} A reference to this color. + */ + setHex(hex: number, colorSpace?: string): Color; + /** + * Sets this color from RGB values. + * + * @param {number} r - Red channel value between `0.0` and `1.0`. + * @param {number} g - Green channel value between `0.0` and `1.0`. + * @param {number} b - Blue channel value between `0.0` and `1.0`. + * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. + * @return {Color} A reference to this color. + */ + setRGB(r: number, g: number, b: number, colorSpace?: string): Color; + /** + * Sets this color from RGB values. + * + * @param {number} h - Hue value between `0.0` and `1.0`. + * @param {number} s - Saturation value between `0.0` and `1.0`. + * @param {number} l - Lightness value between `0.0` and `1.0`. + * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. + * @return {Color} A reference to this color. + */ + setHSL(h: number, s: number, l: number, colorSpace?: string): Color; + /** + * Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`, + * `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or + * any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) - + * all 140 color names are supported). + * + * @param {string} style - Color as a CSS-style string. + * @param {string} [colorSpace=SRGBColorSpace] - The color space. + * @return {Color} A reference to this color. + */ + setStyle(style: string, colorSpace?: string): Color; + /** + * Sets this color from a color name. Faster than {@link Color#setStyle} if + * you don't need the other CSS-style formats. + * + * For convenience, the list of names is exposed in `Color.NAMES` as a hash. + * ```js + * Color.NAMES.aliceblue // returns 0xF0F8FF + * ``` + * + * @param {string} style - The color name. + * @param {string} [colorSpace=SRGBColorSpace] - The color space. + * @return {Color} A reference to this color. + */ + setColorName(style: string, colorSpace?: string): Color; + /** + * Returns a new color with copied values from this instance. + * + * @return {Color} A clone of this instance. + */ + clone(): Color; + /** + * Copies the values of the given color to this instance. + * + * @param {Color} color - The color to copy. + * @return {Color} A reference to this color. + */ + copy(color: Color): Color; + /** + * Copies the given color into this color, and then converts this color from + * `SRGBColorSpace` to `LinearSRGBColorSpace`. + * + * @param {Color} color - The color to copy/convert. + * @return {Color} A reference to this color. + */ + copySRGBToLinear(color: Color): Color; + /** + * Copies the given color into this color, and then converts this color from + * `LinearSRGBColorSpace` to `SRGBColorSpace`. + * + * @param {Color} color - The color to copy/convert. + * @return {Color} A reference to this color. + */ + copyLinearToSRGB(color: Color): Color; + /** + * Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`. + * + * @return {Color} A reference to this color. + */ + convertSRGBToLinear(): Color; + /** + * Converts this color from `LinearSRGBColorSpace` to `SRGBColorSpace`. + * + * @return {Color} A reference to this color. + */ + convertLinearToSRGB(): Color; + /** + * Returns the hexadecimal value of this color. + * + * @param {string} [colorSpace=SRGBColorSpace] - The color space. + * @return {number} The hexadecimal value. + */ + getHex(colorSpace?: string): number; + /** + * Returns the hexadecimal value of this color as a string (for example, 'FFFFFF'). + * + * @param {string} [colorSpace=SRGBColorSpace] - The color space. + * @return {string} The hexadecimal value as a string. + */ + getHexString(colorSpace?: string): string; + /** + * Converts the colors RGB values into the HSL format and stores them into the + * given target object. + * + * @param {{h:number,s:number,l:number}} target - The target object that is used to store the method's result. + * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. + * @return {{h:number,s:number,l:number}} The HSL representation of this color. + */ + getHSL(target: { + h: number; + s: number; + l: number; + }, colorSpace?: string): { + h: number; + s: number; + l: number; + }; + /** + * Returns the RGB values of this color and stores them into the given target object. + * + * @param {Color} target - The target color that is used to store the method's result. + * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. + * @return {Color} The RGB representation of this color. + */ + getRGB(target: Color, colorSpace?: string): Color; + /** + * Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`. + * + * @param {string} [colorSpace=SRGBColorSpace] - The color space. + * @return {string} The CSS representation of this color. + */ + getStyle(colorSpace?: string): string; + /** + * Adds the given HSL values to this color's values. + * Internally, this converts the color's RGB values to HSL, adds HSL + * and then converts the color back to RGB. + * + * @param {number} h - Hue value between `0.0` and `1.0`. + * @param {number} s - Saturation value between `0.0` and `1.0`. + * @param {number} l - Lightness value between `0.0` and `1.0`. + * @return {Color} A reference to this color. + */ + offsetHSL(h: number, s: number, l: number): Color; + /** + * Adds the RGB values of the given color to the RGB values of this color. + * + * @param {Color} color - The color to add. + * @return {Color} A reference to this color. + */ + add(color: Color): Color; + /** + * Adds the RGB values of the given colors and stores the result in this instance. + * + * @param {Color} color1 - The first color. + * @param {Color} color2 - The second color. + * @return {Color} A reference to this color. + */ + addColors(color1: Color, color2: Color): Color; + /** + * Adds the given scalar value to the RGB values of this color. + * + * @param {number} s - The scalar to add. + * @return {Color} A reference to this color. + */ + addScalar(s: number): Color; + /** + * Subtracts the RGB values of the given color from the RGB values of this color. + * + * @param {Color} color - The color to subtract. + * @return {Color} A reference to this color. + */ + sub(color: Color): Color; + /** + * Multiplies the RGB values of the given color with the RGB values of this color. + * + * @param {Color} color - The color to multiply. + * @return {Color} A reference to this color. + */ + multiply(color: Color): Color; + /** + * Multiplies the given scalar value with the RGB values of this color. + * + * @param {number} s - The scalar to multiply. + * @return {Color} A reference to this color. + */ + multiplyScalar(s: number): Color; + /** + * Linearly interpolates this color's RGB values toward the RGB values of the + * given color. The alpha argument can be thought of as the ratio between + * the two colors, where `0.0` is this color and `1.0` is the first argument. + * + * @param {Color} color - The color to converge on. + * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`. + * @return {Color} A reference to this color. + */ + lerp(color: Color, alpha: number): Color; + /** + * Linearly interpolates between the given colors and stores the result in this instance. + * The alpha argument can be thought of as the ratio between the two colors, where `0.0` + * is the first and `1.0` is the second color. + * + * @param {Color} color1 - The first color. + * @param {Color} color2 - The second color. + * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`. + * @return {Color} A reference to this color. + */ + lerpColors(color1: Color, color2: Color, alpha: number): Color; + /** + * Linearly interpolates this color's HSL values toward the HSL values of the + * given color. It differs from {@link Color#lerp} by not interpolating straight + * from one color to the other, but instead going through all the hues in between + * those two colors. The alpha argument can be thought of as the ratio between + * the two colors, where 0.0 is this color and 1.0 is the first argument. + * + * @param {Color} color - The color to converge on. + * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`. + * @return {Color} A reference to this color. + */ + lerpHSL(color: Color, alpha: number): Color; + /** + * Sets the color's RGB components from the given 3D vector. + * + * @param {Vector3} v - The vector to set. + * @return {Color} A reference to this color. + */ + setFromVector3(v: Vector3): Color; + /** + * Transforms this color with the given 3x3 matrix. + * + * @param {Matrix3} m - The matrix. + * @return {Color} A reference to this color. + */ + applyMatrix3(m: Matrix3): Color; + /** + * Returns `true` if this color is equal with the given one. + * + * @param {Color} c - The color to test for equality. + * @return {boolean} Whether this bounding color is equal with the given one. + */ + equals(c: Color): boolean; + /** + * Sets this color's RGB components from the given array. + * + * @param {Array} array - An array holding the RGB values. + * @param {number} [offset=0] - The offset into the array. + * @return {Color} A reference to this color. + */ + fromArray(array: Array, offset?: number): Color; + /** + * Writes the RGB components of this color to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the color components. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The color components. + */ + toArray(array?: Array, offset?: number): Array; + /** + * Sets the components of this color from the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute holding color data. + * @param {number} index - The index into the attribute. + * @return {Color} A reference to this color. + */ + fromBufferAttribute(attribute: BufferAttribute, index: number): Color; + /** + * This methods defines the serialization result of this class. Returns the color + * as a hexadecimal value. + * + * @return {number} The hexadecimal value. + */ + toJSON(): number; + [Symbol.iterator](): Generator; +} +export namespace Color { + export { _colorKeywords as NAMES }; +} +declare namespace _colorKeywords { + let aliceblue: number; + let antiquewhite: number; + let aqua: number; + let aquamarine: number; + let azure: number; + let beige: number; + let bisque: number; + let black: number; + let blanchedalmond: number; + let blue: number; + let blueviolet: number; + let brown: number; + let burlywood: number; + let cadetblue: number; + let chartreuse: number; + let chocolate: number; + let coral: number; + let cornflowerblue: number; + let cornsilk: number; + let crimson: number; + let cyan: number; + let darkblue: number; + let darkcyan: number; + let darkgoldenrod: number; + let darkgray: number; + let darkgreen: number; + let darkgrey: number; + let darkkhaki: number; + let darkmagenta: number; + let darkolivegreen: number; + let darkorange: number; + let darkorchid: number; + let darkred: number; + let darksalmon: number; + let darkseagreen: number; + let darkslateblue: number; + let darkslategray: number; + let darkslategrey: number; + let darkturquoise: number; + let darkviolet: number; + let deeppink: number; + let deepskyblue: number; + let dimgray: number; + let dimgrey: number; + let dodgerblue: number; + let firebrick: number; + let floralwhite: number; + let forestgreen: number; + let fuchsia: number; + let gainsboro: number; + let ghostwhite: number; + let gold: number; + let goldenrod: number; + let gray: number; + let green: number; + let greenyellow: number; + let grey: number; + let honeydew: number; + let hotpink: number; + let indianred: number; + let indigo: number; + let ivory: number; + let khaki: number; + let lavender: number; + let lavenderblush: number; + let lawngreen: number; + let lemonchiffon: number; + let lightblue: number; + let lightcoral: number; + let lightcyan: number; + let lightgoldenrodyellow: number; + let lightgray: number; + let lightgreen: number; + let lightgrey: number; + let lightpink: number; + let lightsalmon: number; + let lightseagreen: number; + let lightskyblue: number; + let lightslategray: number; + let lightslategrey: number; + let lightsteelblue: number; + let lightyellow: number; + let lime: number; + let limegreen: number; + let linen: number; + let magenta: number; + let maroon: number; + let mediumaquamarine: number; + let mediumblue: number; + let mediumorchid: number; + let mediumpurple: number; + let mediumseagreen: number; + let mediumslateblue: number; + let mediumspringgreen: number; + let mediumturquoise: number; + let mediumvioletred: number; + let midnightblue: number; + let mintcream: number; + let mistyrose: number; + let moccasin: number; + let navajowhite: number; + let navy: number; + let oldlace: number; + let olive: number; + let olivedrab: number; + let orange: number; + let orangered: number; + let orchid: number; + let palegoldenrod: number; + let palegreen: number; + let paleturquoise: number; + let palevioletred: number; + let papayawhip: number; + let peachpuff: number; + let peru: number; + let pink: number; + let plum: number; + let powderblue: number; + let purple: number; + let rebeccapurple: number; + let red: number; + let rosybrown: number; + let royalblue: number; + let saddlebrown: number; + let salmon: number; + let sandybrown: number; + let seagreen: number; + let seashell: number; + let sienna: number; + let silver: number; + let skyblue: number; + let slateblue: number; + let slategray: number; + let slategrey: number; + let snow: number; + let springgreen: number; + let steelblue: number; + let tan: number; + let teal: number; + let thistle: number; + let tomato: number; + let turquoise: number; + let violet: number; + let wheat: number; + let white: number; + let whitesmoke: number; + let yellow: number; + let yellowgreen: number; +} +export {}; diff --git a/jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts b/jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts new file mode 100644 index 000000000..63d1502b9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts @@ -0,0 +1,21 @@ +export function SRGBToLinear(c: any): number; +export function LinearToSRGB(c: any): number; +export namespace ColorManagement { + export let enabled: boolean; + export { LinearSRGBColorSpace as workingColorSpace }; + export let spaces: {}; + export function convert(color: any, sourceColorSpace: any, targetColorSpace: any): any; + export function workingToColorSpace(color: any, targetColorSpace: any): any; + export function colorSpaceToWorking(color: any, sourceColorSpace: any): any; + export function getPrimaries(colorSpace: any): any; + export function getTransfer(colorSpace: any): any; + export function getToneMappingMode(colorSpace: any): any; + export function getLuminanceCoefficients(target: any, colorSpace?: any): any; + export function define(colorSpaces: any): void; + export function _getMatrix(targetMatrix: any, sourceColorSpace: any, targetColorSpace: any): any; + export function _getDrawingBufferColorSpace(colorSpace: any): any; + export function _getUnpackColorSpace(colorSpace?: any): any; + export function fromWorkingColorSpace(color: any, targetColorSpace: any): any; + export function toWorkingColorSpace(color: any, sourceColorSpace: any): any; +} +import { LinearSRGBColorSpace } from '../constants.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts b/jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts new file mode 100644 index 000000000..8c5d91627 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts @@ -0,0 +1,74 @@ +/** + * This class can be used to represent points in 3D space as + * [Cylindrical coordinates](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system). + */ +export class Cylindrical { + /** + * Constructs a new cylindrical. + * + * @param {number} [radius=1] - The distance from the origin to a point in the x-z plane. + * @param {number} [theta=0] - A counterclockwise angle in the x-z plane measured in radians from the positive z-axis. + * @param {number} [y=0] - The height above the x-z plane. + */ + constructor(radius?: number, theta?: number, y?: number); + /** + * The distance from the origin to a point in the x-z plane. + * + * @type {number} + * @default 1 + */ + radius: number; + /** + * A counterclockwise angle in the x-z plane measured in radians from the positive z-axis. + * + * @type {number} + * @default 0 + */ + theta: number; + /** + * The height above the x-z plane. + * + * @type {number} + * @default 0 + */ + y: number; + /** + * Sets the cylindrical components by copying the given values. + * + * @param {number} radius - The radius. + * @param {number} theta - The theta angle. + * @param {number} y - The height value. + * @return {Cylindrical} A reference to this cylindrical. + */ + set(radius: number, theta: number, y: number): Cylindrical; + /** + * Copies the values of the given cylindrical to this instance. + * + * @param {Cylindrical} other - The cylindrical to copy. + * @return {Cylindrical} A reference to this cylindrical. + */ + copy(other: Cylindrical): Cylindrical; + /** + * Sets the cylindrical components from the given vector which is assumed to hold + * Cartesian coordinates. + * + * @param {Vector3} v - The vector to set. + * @return {Cylindrical} A reference to this cylindrical. + */ + setFromVector3(v: Vector3): Cylindrical; + /** + * Sets the cylindrical components from the given Cartesian coordinates. + * + * @param {number} x - The x value. + * @param {number} y - The x value. + * @param {number} z - The x value. + * @return {Cylindrical} A reference to this cylindrical. + */ + setFromCartesianCoords(x: number, y: number, z: number): Cylindrical; + /** + * Returns a new cylindrical with copied values from this instance. + * + * @return {Cylindrical} A clone of this instance. + */ + clone(): Cylindrical; +} diff --git a/jsdoc-testing/jsdoc/src/math/Euler.d.ts b/jsdoc-testing/jsdoc/src/math/Euler.d.ts new file mode 100644 index 000000000..8ba21b0f2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Euler.d.ts @@ -0,0 +1,164 @@ +/** + * A class representing Euler angles. + * + * Euler angles describe a rotational transformation by rotating an object on + * its various axes in specified amounts per axis, and a specified axis + * order. + * + * Iterating through an instance will yield its components (x, y, z, + * order) in the corresponding order. + * + * ```js + * const a = new THREE.Euler( 0, 1, 1.57, 'XYZ' ); + * const b = new THREE.Vector3( 1, 0, 1 ); + * b.applyEuler(a); + * ``` + */ +export class Euler { + /** + * Constructs a new euler instance. + * + * @param {number} [x=0] - The angle of the x axis in radians. + * @param {number} [y=0] - The angle of the y axis in radians. + * @param {number} [z=0] - The angle of the z axis in radians. + * @param {string} [order=Euler.DEFAULT_ORDER] - A string representing the order that the rotations are applied. + */ + constructor(x?: number, y?: number, z?: number, order?: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isEuler: boolean; + _x: number; + _y: number; + _z: number; + _order: string; + set x(value: number); + /** + * The angle of the x axis in radians. + * + * @type {number} + * @default 0 + */ + get x(): number; + set y(value: number); + /** + * The angle of the y axis in radians. + * + * @type {number} + * @default 0 + */ + get y(): number; + set z(value: number); + /** + * The angle of the z axis in radians. + * + * @type {number} + * @default 0 + */ + get z(): number; + set order(value: string); + /** + * A string representing the order that the rotations are applied. + * + * @type {string} + * @default 'XYZ' + */ + get order(): string; + /** + * Sets the Euler components. + * + * @param {number} x - The angle of the x axis in radians. + * @param {number} y - The angle of the y axis in radians. + * @param {number} z - The angle of the z axis in radians. + * @param {string} [order] - A string representing the order that the rotations are applied. + * @return {Euler} A reference to this Euler instance. + */ + set(x: number, y: number, z: number, order?: string): Euler; + /** + * Returns a new Euler instance with copied values from this instance. + * + * @return {Euler} A clone of this instance. + */ + clone(): Euler; + /** + * Copies the values of the given Euler instance to this instance. + * + * @param {Euler} euler - The Euler instance to copy. + * @return {Euler} A reference to this Euler instance. + */ + copy(euler: Euler): Euler; + /** + * Sets the angles of this Euler instance from a pure rotation matrix. + * + * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled). + * @param {string} [order] - A string representing the order that the rotations are applied. + * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not. + * @return {Euler} A reference to this Euler instance. + */ + setFromRotationMatrix(m: Matrix4, order?: string, update?: boolean): Euler; + /** + * Sets the angles of this Euler instance from a normalized quaternion. + * + * @param {Quaternion} q - A normalized Quaternion. + * @param {string} [order] - A string representing the order that the rotations are applied. + * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not. + * @return {Euler} A reference to this Euler instance. + */ + setFromQuaternion(q: Quaternion, order?: string, update?: boolean): Euler; + /** + * Sets the angles of this Euler instance from the given vector. + * + * @param {Vector3} v - The vector. + * @param {string} [order] - A string representing the order that the rotations are applied. + * @return {Euler} A reference to this Euler instance. + */ + setFromVector3(v: Vector3, order?: string): Euler; + /** + * Resets the euler angle with a new order by creating a quaternion from this + * euler angle and then setting this euler angle with the quaternion and the + * new order. + * + * Warning: This discards revolution information. + * + * @param {string} [newOrder] - A string representing the new order that the rotations are applied. + * @return {Euler} A reference to this Euler instance. + */ + reorder(newOrder?: string): Euler; + /** + * Returns `true` if this Euler instance is equal with the given one. + * + * @param {Euler} euler - The Euler instance to test for equality. + * @return {boolean} Whether this Euler instance is equal with the given one. + */ + equals(euler: Euler): boolean; + /** + * Sets this Euler instance's components to values from the given array. The first three + * entries of the array are assign to the x,y and z components. An optional fourth entry + * defines the Euler order. + * + * @param {Array} array - An array holding the Euler component values. + * @return {Euler} A reference to this Euler instance. + */ + fromArray(array: Array): Euler; + /** + * Writes the components of this Euler instance to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the Euler components. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The Euler components. + */ + toArray(array?: Array, offset?: number): Array; + _onChange(callback: any): this; + _onChangeCallback(): void; + [Symbol.iterator](): Generator; +} +export namespace Euler { + let DEFAULT_ORDER: string; +} +import { Matrix4 } from './Matrix4.js'; +import { Quaternion } from './Quaternion.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Frustum.d.ts b/jsdoc-testing/jsdoc/src/math/Frustum.d.ts new file mode 100644 index 000000000..b75731203 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Frustum.d.ts @@ -0,0 +1,109 @@ +/** + * Frustums are used to determine what is inside the camera's field of view. + * They help speed up the rendering process - objects which lie outside a camera's + * frustum can safely be excluded from rendering. + * + * This class is mainly intended for use internally by a renderer. + */ +export class Frustum { + /** + * Constructs a new frustum. + * + * @param {Plane} [p0] - The first plane that encloses the frustum. + * @param {Plane} [p1] - The second plane that encloses the frustum. + * @param {Plane} [p2] - The third plane that encloses the frustum. + * @param {Plane} [p3] - The fourth plane that encloses the frustum. + * @param {Plane} [p4] - The fifth plane that encloses the frustum. + * @param {Plane} [p5] - The sixth plane that encloses the frustum. + */ + constructor(p0?: Plane, p1?: Plane, p2?: Plane, p3?: Plane, p4?: Plane, p5?: Plane); + /** + * This array holds the planes that enclose the frustum. + * + * @type {Array} + */ + planes: Array; + /** + * Sets the frustum planes by copying the given planes. + * + * @param {Plane} [p0] - The first plane that encloses the frustum. + * @param {Plane} [p1] - The second plane that encloses the frustum. + * @param {Plane} [p2] - The third plane that encloses the frustum. + * @param {Plane} [p3] - The fourth plane that encloses the frustum. + * @param {Plane} [p4] - The fifth plane that encloses the frustum. + * @param {Plane} [p5] - The sixth plane that encloses the frustum. + * @return {Frustum} A reference to this frustum. + */ + set(p0?: Plane, p1?: Plane, p2?: Plane, p3?: Plane, p4?: Plane, p5?: Plane): Frustum; + /** + * Copies the values of the given frustum to this instance. + * + * @param {Frustum} frustum - The frustum to copy. + * @return {Frustum} A reference to this frustum. + */ + copy(frustum: Frustum): Frustum; + /** + * Sets the frustum planes from the given projection matrix. + * + * @param {Matrix4} m - The projection matrix. + * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} coordinateSystem - The coordinate system. + * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth. + * @return {Frustum} A reference to this frustum. + */ + setFromProjectionMatrix(m: Matrix4, coordinateSystem?: (number | number), reversedDepth?: boolean): Frustum; + /** + * Returns `true` if the 3D object's bounding sphere is intersecting this frustum. + * + * Note that the 3D object must have a geometry so that the bounding sphere can be calculated. + * + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object's bounding sphere is intersecting this frustum or not. + */ + intersectsObject(object: Object3D): boolean; + /** + * Returns `true` if the given sprite is intersecting this frustum. + * + * @param {Sprite} sprite - The sprite to test. + * @return {boolean} Whether the sprite is intersecting this frustum or not. + */ + intersectsSprite(sprite: Sprite): boolean; + /** + * Returns `true` if the given bounding sphere is intersecting this frustum. + * + * This is a fast, conservative test that favors performance over precision. It can + * report false positives for spheres that lie outside the frustum but are not separated + * by a single frustum plane. It never reports false negatives, so it is safe for culling. + * + * @param {Sphere} sphere - The bounding sphere to test. + * @return {boolean} Whether the bounding sphere is intersecting this frustum or not. + */ + intersectsSphere(sphere: Sphere): boolean; + /** + * Returns `true` if the given bounding box is intersecting this frustum. + * + * This is a fast, conservative test that favors performance over precision. It can + * report false positives for large boxes that lie outside the frustum but are not + * separated by a single frustum plane. It never reports false negatives, so it is + * safe for culling. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the bounding box is intersecting this frustum or not. + */ + intersectsBox(box: Box3): boolean; + /** + * Returns `true` if the given point lies within the frustum. + * + * @param {Vector3} point - The point to test. + * @return {boolean} Whether the point lies within this frustum or not. + */ + containsPoint(point: Vector3): boolean; + /** + * Returns a new frustum with copied values from this instance. + * + * @return {Frustum} A clone of this instance. + */ + clone(): Frustum; +} +import { Plane } from './Plane.js'; +import { Sphere } from './Sphere.js'; +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts b/jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts new file mode 100644 index 000000000..09dd15ad3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts @@ -0,0 +1,96 @@ +/** + * FrustumArray is used to determine if an object is visible in at least one camera + * from an array of cameras. This is particularly useful for multi-view renderers. +*/ +export class FrustumArray { + /** + * The coordinate system to use. + * + * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem} + * @default WebGLCoordinateSystem + */ + coordinateSystem: number | WebGPUCoordinateSystem; + /** + * A pool of frustum instances. It may hold more entries than are + * currently in use; surplus instances are kept for reuse to avoid + * reallocating when array cameras of different lengths are rendered. + * + * @private + * @type {Array} + */ + private _frustums; + /** + * The number of frustums in {@link FrustumArray#_frustums} that are currently + * in use. + * + * @private + * @type {number} + * @default 0 + */ + private _count; + /** + * Computes and caches a frustum for each camera of the given array camera. + * + * @param {ArrayCamera} cameraArray - The array camera whose sub-cameras define the frustums. + * @return {FrustumArray} A reference to this frustum array. + */ + setFromArrayCamera(cameraArray: ArrayCamera): FrustumArray; + /** + * Returns `true` if the 3D object's bounding sphere is intersecting any cached frustum. + * + * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. + * + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is visible in any camera. + */ + intersectsObject(object: Object3D): boolean; + /** + * Returns `true` if the given sprite is intersecting any cached frustum. + * + * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. + * + * @param {Sprite} sprite - The sprite to test. + * @return {boolean} Whether the sprite is visible in any camera. + */ + intersectsSprite(sprite: Sprite): boolean; + /** + * Returns `true` if the given bounding sphere is intersecting any cached frustum. + * + * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. + * + * @param {Sphere} sphere - The bounding sphere to test. + * @return {boolean} Whether the sphere is visible in any camera. + */ + intersectsSphere(sphere: Sphere): boolean; + /** + * Returns `true` if the given bounding box is intersecting any cached frustum. + * + * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the box is visible in any camera. + */ + intersectsBox(box: Box3): boolean; + /** + * Returns `true` if the given point lies within any cached frustum. + * + * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. + * + * @param {Vector3} point - The point to test. + * @return {boolean} Whether the point is visible in any camera. + */ + containsPoint(point: Vector3): boolean; + /** + * Copies the values of the given frustum array to this instance. + * + * @param {FrustumArray} source - The frustum array to copy. + * @return {FrustumArray} A reference to this frustum array. + */ + copy(source: FrustumArray): FrustumArray; + /** + * Returns a new frustum array with copied values from this instance. + * + * @return {FrustumArray} A clone of this instance. + */ + clone(): FrustumArray; +} diff --git a/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts b/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts new file mode 100644 index 000000000..561415c0e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts @@ -0,0 +1,114 @@ +/** + * Abstract base class of interpolants over parametric samples. + * + * The parameter domain is one dimensional, typically the time or a path + * along a curve defined by the data. + * + * The sample values can have any dimensionality and derived classes may + * apply special interpretations to the data. + * + * This class provides the interval seek in a Template Method, deferring + * the actual interpolation to derived classes. + * + * Time complexity is O(1) for linear access crossing at most two points + * and O(log N) for random access, where N is the number of positions. + * + * References: {@link http://www.oodesign.com/template-method-pattern.html} + * + * @abstract + */ +export class Interpolant { + /** + * Constructs a new interpolant. + * + * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors. + * @param {TypedArray} sampleValues - The sample values. + * @param {number} sampleSize - The sample size + * @param {TypedArray} [resultBuffer] - The result buffer. + */ + constructor(parameterPositions: TypedArray, sampleValues: TypedArray, sampleSize: number, resultBuffer?: TypedArray); + /** + * The parameter positions. + * + * @type {TypedArray} + */ + parameterPositions: TypedArray; + /** + * A cache index. + * + * @private + * @type {number} + * @default 0 + */ + private _cachedIndex; + /** + * The result buffer. + * + * @type {TypedArray} + */ + resultBuffer: TypedArray; + /** + * The sample values. + * + * @type {TypedArray} + */ + sampleValues: TypedArray; + /** + * The value size. + * + * @type {TypedArray} + */ + valueSize: TypedArray; + /** + * The interpolation settings. + * + * @type {?Object} + * @default null + */ + settings: Object | null; + /** + * The default settings object. + * + * @type {Object} + */ + DefaultSettings_: Object; + /** + * Evaluate the interpolant at position `t`. + * + * @param {number} t - The interpolation factor. + * @return {TypedArray} The result buffer. + */ + evaluate(t: number): TypedArray; + /** + * Returns the interpolation settings. + * + * @return {Object} The interpolation settings. + */ + getSettings_(): Object; + /** + * Copies a sample value to the result buffer. + * + * @param {number} index - An index into the sample value buffer. + * @return {TypedArray} The result buffer. + */ + copySampleValue_(index: number): TypedArray; + /** + * Copies a sample value to the result buffer. + * + * @abstract + * @param {number} i1 - An index into the sample value buffer. + * @param {number} t0 - The previous interpolation factor. + * @param {number} t - The current interpolation factor. + * @param {number} t1 - The next interpolation factor. + * @return {TypedArray} The result buffer. + */ + interpolate_(): TypedArray; + /** + * Optional method that is executed when the interval has changed. + * + * @param {number} i1 - An index into the sample value buffer. + * @param {number} t0 - The previous interpolation factor. + * @param {number} t - The current interpolation factor. + */ + intervalChanged_(): void; +} diff --git a/jsdoc-testing/jsdoc/src/math/Line3.d.ts b/jsdoc-testing/jsdoc/src/math/Line3.d.ts new file mode 100644 index 000000000..339e53546 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Line3.d.ts @@ -0,0 +1,120 @@ +/** + * An analytical line segment in 3D space represented by a start and end point. + */ +export class Line3 { + /** + * Constructs a new line segment. + * + * @param {Vector3} [start=(0,0,0)] - Start of the line segment. + * @param {Vector3} [end=(0,0,0)] - End of the line segment. + */ + constructor(start?: Vector3, end?: Vector3); + /** + * Start of the line segment. + * + * @type {Vector3} + */ + start: Vector3; + /** + * End of the line segment. + * + * @type {Vector3} + */ + end: Vector3; + /** + * Sets the start and end values by copying the given vectors. + * + * @param {Vector3} start - The start point. + * @param {Vector3} end - The end point. + * @return {Line3} A reference to this line segment. + */ + set(start: Vector3, end: Vector3): Line3; + /** + * Copies the values of the given line segment to this instance. + * + * @param {Line3} line - The line segment to copy. + * @return {Line3} A reference to this line segment. + */ + copy(line: Line3): Line3; + /** + * Returns the center of the line segment. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The center point. + */ + getCenter(target: Vector3): Vector3; + /** + * Returns the delta vector of the line segment's start and end point. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The delta vector. + */ + delta(target: Vector3): Vector3; + /** + * Returns the squared Euclidean distance between the line' start and end point. + * + * @return {number} The squared Euclidean distance. + */ + distanceSq(): number; + /** + * Returns the Euclidean distance between the line' start and end point. + * + * @return {number} The Euclidean distance. + */ + distance(): number; + /** + * Returns a vector at a certain position along the line segment. + * + * @param {number} t - A value between `[0,1]` to represent a position along the line segment. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The delta vector. + */ + at(t: number, target: Vector3): Vector3; + /** + * Returns a point parameter based on the closest point as projected on the line segment. + * + * @param {Vector3} point - The point for which to return a point parameter. + * @param {boolean} clampToLine - Whether to clamp the result to the range `[0,1]` or not. + * @return {number} The point parameter. + */ + closestPointToPointParameter(point: Vector3, clampToLine: boolean): number; + /** + * Returns the closest point on the line for a given point. + * + * @param {Vector3} point - The point to compute the closest point on the line for. + * @param {boolean} clampToLine - Whether to clamp the result to the range `[0,1]` or not. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The closest point on the line. + */ + closestPointToPoint(point: Vector3, clampToLine: boolean, target: Vector3): Vector3; + /** + * Returns the closest squared distance between this line segment and the given one. + * + * @param {Line3} line - The line segment to compute the closest squared distance to. + * @param {Vector3} [c1] - The closest point on this line segment. + * @param {Vector3} [c2] - The closest point on the given line segment. + * @return {number} The squared distance between this line segment and the given one. + */ + distanceSqToLine3(line: Line3, c1?: Vector3, c2?: Vector3): number; + /** + * Applies a 4x4 transformation matrix to this line segment. + * + * @param {Matrix4} matrix - The transformation matrix. + * @return {Line3} A reference to this line segment. + */ + applyMatrix4(matrix: Matrix4): Line3; + /** + * Returns `true` if this line segment is equal with the given one. + * + * @param {Line3} line - The line segment to test for equality. + * @return {boolean} Whether this line segment is equal with the given one. + */ + equals(line: Line3): boolean; + /** + * Returns a new line segment with copied values from this instance. + * + * @return {Line3} A clone of this instance. + */ + clone(): Line3; +} +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/MathUtils.d.ts b/jsdoc-testing/jsdoc/src/math/MathUtils.d.ts new file mode 100644 index 000000000..bc4d11f77 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/MathUtils.d.ts @@ -0,0 +1,224 @@ +export const DEG2RAD: number; +export const RAD2DEG: number; +/** + * Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) + * (universally unique identifier). + * + * @return {string} The UUID. + */ +export function generateUUID(): string; +/** + * Clamps the given value between min and max. + * + * @param {number} value - The value to clamp. + * @param {number} min - The min value. + * @param {number} max - The max value. + * @return {number} The clamped value. + */ +export function clamp(value: number, min: number, max: number): number; +/** + * Computes the Euclidean modulo of the given parameters that + * is `( ( n % m ) + m ) % m`. + * + * @param {number} n - The first parameter. + * @param {number} m - The second parameter. + * @return {number} The Euclidean modulo. + */ +export function euclideanModulo(n: number, m: number): number; +/** + * Performs a linear mapping from range `` to range `` + * for the given value. `a2` must be greater than `a1`. + * + * @param {number} x - The value to be mapped. + * @param {number} a1 - Minimum value for range A. + * @param {number} a2 - Maximum value for range A. + * @param {number} b1 - Minimum value for range B. + * @param {number} b2 - Maximum value for range B. + * @return {number} The mapped value. + */ +export function mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number; +/** + * Returns the percentage in the closed interval `[0, 1]` of the given value + * between the start and end point. + * + * @param {number} x - The start point + * @param {number} y - The end point. + * @param {number} value - A value between start and end. + * @return {number} The interpolation factor. + */ +export function inverseLerp(x: number, y: number, value: number): number; +/** + * Returns a value linearly interpolated from two known points based on the given interval - + * `t = 0` will return `x` and `t = 1` will return `y`. + * + * @param {number} x - The start point + * @param {number} y - The end point. + * @param {number} t - The interpolation factor in the closed interval `[0, 1]`. + * @return {number} The interpolated value. + */ +export function lerp(x: number, y: number, t: number): number; +/** + * Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta + * time to maintain frame rate independent movement. For details, see + * [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/). + * + * @param {number} x - The current point. + * @param {number} y - The target point. + * @param {number} lambda - A higher lambda value will make the movement more sudden, + * and a lower value will make the movement more gradual. + * @param {number} dt - Delta time in seconds. + * @return {number} The interpolated value. + */ +export function damp(x: number, y: number, lambda: number, dt: number): number; +/** + * Returns a value that alternates between `0` and the given `length` parameter. + * + * @param {number} x - The value to pingpong. + * @param {number} [length=1] - The positive value the function will pingpong to. + * @return {number} The alternated value. + */ +export function pingpong(x: number, length?: number): number; +/** + * Returns a value in the range `[0,1]` that represents the percentage that `x` has + * moved between `min` and `max`, but smoothed or slowed down the closer `x` is to + * the `min` and `max`. + * + * See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details. + * + * @param {number} x - The value to evaluate based on its position between `min` and `max`. + * @param {number} min - The min value. Any `x` value below `min` will be `0`. `min` must be lower than `max`. + * @param {number} max - The max value. Any `x` value above `max` will be `1`. `max` must be greater than `min`. + * @return {number} The alternated value. + */ +export function smoothstep(x: number, min: number, max: number): number; +/** + * A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations) + * that has zero 1st and 2nd order derivatives at `x=0` and `x=1`. + * + * @param {number} x - The value to evaluate based on its position between `min` and `max`. + * @param {number} min - The min value. Any `x` value below `min` will be `0`. `min` must be lower than `max`. + * @param {number} max - The max value. Any `x` value above `max` will be `1`. `max` must be greater than `min`. + * @return {number} The alternated value. + */ +export function smootherstep(x: number, min: number, max: number): number; +/** + * Returns a random integer from `` interval. + * + * @param {number} low - The lower value boundary. + * @param {number} high - The upper value boundary + * @return {number} A random integer. + */ +export function randInt(low: number, high: number): number; +/** + * Returns a random float from `` interval. + * + * @param {number} low - The lower value boundary. + * @param {number} high - The upper value boundary + * @return {number} A random float. + */ +export function randFloat(low: number, high: number): number; +/** + * Returns a random integer from `<-range/2, range/2>` interval. + * + * @param {number} range - Defines the value range. + * @return {number} A random float. + */ +export function randFloatSpread(range: number): number; +/** + * Returns a deterministic pseudo-random float in the interval `[0, 1]`. + * + * @param {number} [s] - The integer seed. + * @return {number} A random float. + */ +export function seededRandom(s?: number): number; +/** + * Converts degrees to radians. + * + * @param {number} degrees - A value in degrees. + * @return {number} The converted value in radians. + */ +export function degToRad(degrees: number): number; +/** + * Converts radians to degrees. + * + * @param {number} radians - A value in radians. + * @return {number} The converted value in degrees. + */ +export function radToDeg(radians: number): number; +/** + * Returns `true` if the given number is a power of two. + * + * @param {number} value - The value to check. + * @return {boolean} Whether the given number is a power of two or not. + */ +export function isPowerOfTwo(value: number): boolean; +/** + * Returns the smallest power of two that is greater than or equal to the given number. + * + * @param {number} value - The value to find a POT for. Must be greater than `0`. + * @return {number} The smallest power of two that is greater than or equal to the given number. + */ +export function ceilPowerOfTwo(value: number): number; +/** + * Returns the largest power of two that is less than or equal to the given number. + * + * @param {number} value - The value to find a POT for. Must be greater than `0`. + * @return {number} The largest power of two that is less than or equal to the given number. + */ +export function floorPowerOfTwo(value: number): number; +/** + * Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles) + * defined by the given angles and order. + * + * Rotations are applied to the axes in the order specified by order: + * rotation by angle `a` is applied first, then by angle `b`, then by angle `c`. + * + * @param {Quaternion} q - The quaternion to set. + * @param {number} a - The rotation applied to the first axis, in radians. + * @param {number} b - The rotation applied to the second axis, in radians. + * @param {number} c - The rotation applied to the third axis, in radians. + * @param {('XYX'|'XZX'|'YXY'|'YZY'|'ZXZ'|'ZYZ')} order - A string specifying the axes order. + */ +export function setQuaternionFromProperEuler(q: Quaternion, a: number, b: number, c: number, order: ("XYX" | "XZX" | "YXY" | "YZY" | "ZXZ" | "ZYZ")): void; +/** + * Normalizes the given value according to the given typed array. + * + * @param {number} value - The float value in the range `[0,1]` to normalize. + * @param {TypedArray} array - The typed array that defines the data type of the value. + * @return {number} The normalize value. + */ +export function normalize(value: number, array: TypedArray): number; +/** + * Denormalizes the given value according to the given typed array. + * + * @param {number} value - The value to denormalize. + * @param {TypedArray} array - The typed array that defines the data type of the value. + * @return {number} The denormalize (float) value in the range `[0,1]`. + */ +export function denormalize(value: number, array: TypedArray): number; +export namespace MathUtils { + export { DEG2RAD }; + export { RAD2DEG }; + export { generateUUID }; + export { clamp }; + export { euclideanModulo }; + export { mapLinear }; + export { inverseLerp }; + export { lerp }; + export { damp }; + export { pingpong }; + export { smoothstep }; + export { smootherstep }; + export { randInt }; + export { randFloat }; + export { randFloatSpread }; + export { seededRandom }; + export { degToRad }; + export { radToDeg }; + export { isPowerOfTwo }; + export { ceilPowerOfTwo }; + export { floorPowerOfTwo }; + export { setQuaternionFromProperEuler }; + export { normalize }; + export { denormalize }; +} diff --git a/jsdoc-testing/jsdoc/src/math/Matrix2.d.ts b/jsdoc-testing/jsdoc/src/math/Matrix2.d.ts new file mode 100644 index 000000000..7eac72d0b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Matrix2.d.ts @@ -0,0 +1,70 @@ +/** + * Represents a 2x2 matrix. + * + * A Note on Row-Major and Column-Major Ordering: + * + * The constructor and {@link Matrix2#set} method take arguments in + * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) + * order, while internally they are stored in the {@link Matrix2#elements} array in column-major order. + * This means that calling: + * ```js + * const m = new THREE.Matrix2(); + * m.set( 11, 12, + * 21, 22 ); + * ``` + * will result in the elements array containing: + * ```js + * m.elements = [ 11, 21, + * 12, 22 ]; + * ``` + * and internally all calculations are performed using column-major ordering. + * However, as the actual ordering makes no difference mathematically and + * most people are used to thinking about matrices in row-major order, the + * three.js documentation shows matrices in row-major order. Just bear in + * mind that if you are reading the source code, you'll have to take the + * transpose of any matrices outlined here to make sense of the calculations. + */ +export class Matrix2 { + /** + * Constructs a new 2x2 matrix. The arguments are supposed to be + * in row-major order. If no arguments are provided, the constructor + * initializes the matrix as an identity matrix. + * + * @param {number} [n11] - 1-1 matrix element. + * @param {number} [n12] - 1-2 matrix element. + * @param {number} [n21] - 2-1 matrix element. + * @param {number} [n22] - 2-2 matrix element. + */ + constructor(n11?: number, n12?: number, n21?: number, n22?: number); + /** + * A column-major list of matrix values. + * + * @type {Array} + */ + elements: Array; + /** + * Sets this matrix to the 2x2 identity matrix. + * + * @return {Matrix2} A reference to this matrix. + */ + identity(): Matrix2; + /** + * Sets the elements of the matrix from the given array. + * + * @param {Array} array - The matrix elements in column-major order. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Matrix2} A reference to this matrix. + */ + fromArray(array: Array, offset?: number): Matrix2; + /** + * Sets the elements of the matrix.The arguments are supposed to be + * in row-major order. + * + * @param {number} n11 - 1-1 matrix element. + * @param {number} n12 - 1-2 matrix element. + * @param {number} n21 - 2-1 matrix element. + * @param {number} n22 - 2-2 matrix element. + * @return {Matrix2} A reference to this matrix. + */ + set(n11: number, n12: number, n21: number, n22: number): Matrix2; +} diff --git a/jsdoc-testing/jsdoc/src/math/Matrix3.d.ts b/jsdoc-testing/jsdoc/src/math/Matrix3.d.ts new file mode 100644 index 000000000..659ea41a3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Matrix3.d.ts @@ -0,0 +1,254 @@ +/** + * Represents a 3x3 matrix. + * + * A Note on Row-Major and Column-Major Ordering: + * + * The constructor and {@link Matrix3#set} method take arguments in + * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) + * order, while internally they are stored in the {@link Matrix3#elements} array in column-major order. + * This means that calling: + * ```js + * const m = new THREE.Matrix(); + * m.set( 11, 12, 13, + * 21, 22, 23, + * 31, 32, 33 ); + * ``` + * will result in the elements array containing: + * ```js + * m.elements = [ 11, 21, 31, + * 12, 22, 32, + * 13, 23, 33 ]; + * ``` + * and internally all calculations are performed using column-major ordering. + * However, as the actual ordering makes no difference mathematically and + * most people are used to thinking about matrices in row-major order, the + * three.js documentation shows matrices in row-major order. Just bear in + * mind that if you are reading the source code, you'll have to take the + * transpose of any matrices outlined here to make sense of the calculations. + */ +export class Matrix3 { + /** + * Constructs a new 3x3 matrix. The arguments are supposed to be + * in row-major order. If no arguments are provided, the constructor + * initializes the matrix as an identity matrix. + * + * @param {number} [n11] - 1-1 matrix element. + * @param {number} [n12] - 1-2 matrix element. + * @param {number} [n13] - 1-3 matrix element. + * @param {number} [n21] - 2-1 matrix element. + * @param {number} [n22] - 2-2 matrix element. + * @param {number} [n23] - 2-3 matrix element. + * @param {number} [n31] - 3-1 matrix element. + * @param {number} [n32] - 3-2 matrix element. + * @param {number} [n33] - 3-3 matrix element. + */ + constructor(n11?: number, n12?: number, n13?: number, n21?: number, n22?: number, n23?: number, n31?: number, n32?: number, n33?: number); + /** + * A column-major list of matrix values. + * + * @type {Array} + */ + elements: Array; + /** + * Sets the elements of the matrix.The arguments are supposed to be + * in row-major order. + * + * @param {number} [n11] - 1-1 matrix element. + * @param {number} [n12] - 1-2 matrix element. + * @param {number} [n13] - 1-3 matrix element. + * @param {number} [n21] - 2-1 matrix element. + * @param {number} [n22] - 2-2 matrix element. + * @param {number} [n23] - 2-3 matrix element. + * @param {number} [n31] - 3-1 matrix element. + * @param {number} [n32] - 3-2 matrix element. + * @param {number} [n33] - 3-3 matrix element. + * @return {Matrix3} A reference to this matrix. + */ + set(n11?: number, n12?: number, n13?: number, n21?: number, n22?: number, n23?: number, n31?: number, n32?: number, n33?: number): Matrix3; + /** + * Sets this matrix to the 3x3 identity matrix. + * + * @return {Matrix3} A reference to this matrix. + */ + identity(): Matrix3; + /** + * Copies the values of the given matrix to this instance. + * + * @param {Matrix3} m - The matrix to copy. + * @return {Matrix3} A reference to this matrix. + */ + copy(m: Matrix3): Matrix3; + /** + * Extracts the basis of this matrix into the three axis vectors provided. + * + * @param {Vector3} xAxis - The basis's x axis. + * @param {Vector3} yAxis - The basis's y axis. + * @param {Vector3} zAxis - The basis's z axis. + * @return {Matrix3} A reference to this matrix. + */ + extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix3; + /** + * Set this matrix to the upper 3x3 matrix of the given 4x4 matrix. + * + * @param {Matrix4} m - The 4x4 matrix. + * @return {Matrix3} A reference to this matrix. + */ + setFromMatrix4(m: Matrix4): Matrix3; + /** + * Post-multiplies this matrix by the given 3x3 matrix. + * + * @param {Matrix3} m - The matrix to multiply with. + * @return {Matrix3} A reference to this matrix. + */ + multiply(m: Matrix3): Matrix3; + /** + * Pre-multiplies this matrix by the given 3x3 matrix. + * + * @param {Matrix3} m - The matrix to multiply with. + * @return {Matrix3} A reference to this matrix. + */ + premultiply(m: Matrix3): Matrix3; + /** + * Multiples the given 3x3 matrices and stores the result + * in this matrix. + * + * @param {Matrix3} a - The first matrix. + * @param {Matrix3} b - The second matrix. + * @return {Matrix3} A reference to this matrix. + */ + multiplyMatrices(a: Matrix3, b: Matrix3): Matrix3; + /** + * Multiplies every component of the matrix by the given scalar. + * + * @param {number} s - The scalar. + * @return {Matrix3} A reference to this matrix. + */ + multiplyScalar(s: number): Matrix3; + /** + * Computes and returns the determinant of this matrix. + * + * @return {number} The determinant. + */ + determinant(): number; + /** + * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution). + * You can not invert with a determinant of zero. If you attempt this, the method produces + * a zero matrix instead. + * + * @return {Matrix3} A reference to this matrix. + */ + invert(): Matrix3; + /** + * Transposes this matrix in place. + * + * @return {Matrix3} A reference to this matrix. + */ + transpose(): Matrix3; + /** + * Computes the normal matrix which is the inverse transpose of the upper + * left 3x3 portion of the given 4x4 matrix. + * + * @param {Matrix4} matrix4 - The 4x4 matrix. + * @return {Matrix3} A reference to this matrix. + */ + getNormalMatrix(matrix4: Matrix4): Matrix3; + /** + * Transposes this matrix into the supplied array, and returns itself unchanged. + * + * @param {Array} r - An array to store the transposed matrix elements. + * @return {Matrix3} A reference to this matrix. + */ + transposeIntoArray(r: Array): Matrix3; + /** + * Sets the UV transform matrix from offset, repeat, rotation, and center. + * + * @param {number} tx - Offset x. + * @param {number} ty - Offset y. + * @param {number} sx - Repeat x. + * @param {number} sy - Repeat y. + * @param {number} rotation - Rotation, in radians. Positive values rotate counterclockwise. + * @param {number} cx - Center x of rotation. + * @param {number} cy - Center y of rotation + * @return {Matrix3} A reference to this matrix. + */ + setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number): Matrix3; + /** + * Scales this matrix with the given scalar values. + * + * @deprecated + * @param {number} sx - The amount to scale in the X axis. + * @param {number} sy - The amount to scale in the Y axis. + * @return {Matrix3} A reference to this matrix. + */ + scale(sx: number, sy: number): Matrix3; + /** + * Rotates this matrix by the given angle. + * + * @deprecated + * @param {number} theta - The rotation in radians. + * @return {Matrix3} A reference to this matrix. + */ + rotate(theta: number): Matrix3; + /** + * Translates this matrix by the given scalar values. + * + * @deprecated + * @param {number} tx - The amount to translate in the X axis. + * @param {number} ty - The amount to translate in the Y axis. + * @return {Matrix3} A reference to this matrix. + */ + translate(tx: number, ty: number): Matrix3; + /** + * Sets this matrix as a 2D translation transform. + * + * @param {number|Vector2} x - The amount to translate in the X axis or alternatively a translation vector. + * @param {number} y - The amount to translate in the Y axis. + * @return {Matrix3} A reference to this matrix. + */ + makeTranslation(x: number | Vector2, y: number): Matrix3; + /** + * Sets this matrix as a 2D rotational transformation. + * + * @param {number} theta - The rotation in radians. + * @return {Matrix3} A reference to this matrix. + */ + makeRotation(theta: number): Matrix3; + /** + * Sets this matrix as a 2D scale transform. + * + * @param {number} x - The amount to scale in the X axis. + * @param {number} y - The amount to scale in the Y axis. + * @return {Matrix3} A reference to this matrix. + */ + makeScale(x: number, y: number): Matrix3; + /** + * Returns `true` if this matrix is equal with the given one. + * + * @param {Matrix3} matrix - The matrix to test for equality. + * @return {boolean} Whether this matrix is equal with the given one. + */ + equals(matrix: Matrix3): boolean; + /** + * Sets the elements of the matrix from the given array. + * + * @param {Array} array - The matrix elements in column-major order. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Matrix3} A reference to this matrix. + */ + fromArray(array: Array, offset?: number): Matrix3; + /** + * Writes the elements of this matrix to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the matrix elements in column-major order. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The matrix elements in column-major order. + */ + toArray(array?: Array, offset?: number): Array; + /** + * Returns a matrix with copied values from this instance. + * + * @return {Matrix3} A clone of this instance. + */ + clone(): Matrix3; +} diff --git a/jsdoc-testing/jsdoc/src/math/Matrix4.d.ts b/jsdoc-testing/jsdoc/src/math/Matrix4.d.ts new file mode 100644 index 000000000..e6e246bc2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Matrix4.d.ts @@ -0,0 +1,411 @@ +/** + * Represents a 4x4 matrix. + * + * The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix. + * For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices) + * + * This allows a 3D vector representing a point in 3D space to undergo + * transformations such as translation, rotation, shear, scale, reflection, + * orthogonal or perspective projection and so on, by being multiplied by the + * matrix. This is known as `applying` the matrix to the vector. + * + * A Note on Row-Major and Column-Major Ordering: + * + * The constructor and {@link Matrix3#set} method take arguments in + * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) + * order, while internally they are stored in the {@link Matrix3#elements} array in column-major order. + * This means that calling: + * ```js + * const m = new THREE.Matrix4(); + * m.set( 11, 12, 13, 14, + * 21, 22, 23, 24, + * 31, 32, 33, 34, + * 41, 42, 43, 44 ); + * ``` + * will result in the elements array containing: + * ```js + * m.elements = [ 11, 21, 31, 41, + * 12, 22, 32, 42, + * 13, 23, 33, 43, + * 14, 24, 34, 44 ]; + * ``` + * and internally all calculations are performed using column-major ordering. + * However, as the actual ordering makes no difference mathematically and + * most people are used to thinking about matrices in row-major order, the + * three.js documentation shows matrices in row-major order. Just bear in + * mind that if you are reading the source code, you'll have to take the + * transpose of any matrices outlined here to make sense of the calculations. + */ +export class Matrix4 { + /** + * Constructs a new 4x4 matrix. The arguments are supposed to be + * in row-major order. If no arguments are provided, the constructor + * initializes the matrix as an identity matrix. + * + * @param {number} [n11] - 1-1 matrix element. + * @param {number} [n12] - 1-2 matrix element. + * @param {number} [n13] - 1-3 matrix element. + * @param {number} [n14] - 1-4 matrix element. + * @param {number} [n21] - 2-1 matrix element. + * @param {number} [n22] - 2-2 matrix element. + * @param {number} [n23] - 2-3 matrix element. + * @param {number} [n24] - 2-4 matrix element. + * @param {number} [n31] - 3-1 matrix element. + * @param {number} [n32] - 3-2 matrix element. + * @param {number} [n33] - 3-3 matrix element. + * @param {number} [n34] - 3-4 matrix element. + * @param {number} [n41] - 4-1 matrix element. + * @param {number} [n42] - 4-2 matrix element. + * @param {number} [n43] - 4-3 matrix element. + * @param {number} [n44] - 4-4 matrix element. + */ + constructor(n11?: number, n12?: number, n13?: number, n14?: number, n21?: number, n22?: number, n23?: number, n24?: number, n31?: number, n32?: number, n33?: number, n34?: number, n41?: number, n42?: number, n43?: number, n44?: number); + /** + * A column-major list of matrix values. + * + * @type {Array} + */ + elements: Array; + /** + * Sets the elements of the matrix.The arguments are supposed to be + * in row-major order. + * + * @param {number} [n11] - 1-1 matrix element. + * @param {number} [n12] - 1-2 matrix element. + * @param {number} [n13] - 1-3 matrix element. + * @param {number} [n14] - 1-4 matrix element. + * @param {number} [n21] - 2-1 matrix element. + * @param {number} [n22] - 2-2 matrix element. + * @param {number} [n23] - 2-3 matrix element. + * @param {number} [n24] - 2-4 matrix element. + * @param {number} [n31] - 3-1 matrix element. + * @param {number} [n32] - 3-2 matrix element. + * @param {number} [n33] - 3-3 matrix element. + * @param {number} [n34] - 3-4 matrix element. + * @param {number} [n41] - 4-1 matrix element. + * @param {number} [n42] - 4-2 matrix element. + * @param {number} [n43] - 4-3 matrix element. + * @param {number} [n44] - 4-4 matrix element. + * @return {Matrix4} A reference to this matrix. + */ + set(n11?: number, n12?: number, n13?: number, n14?: number, n21?: number, n22?: number, n23?: number, n24?: number, n31?: number, n32?: number, n33?: number, n34?: number, n41?: number, n42?: number, n43?: number, n44?: number): Matrix4; + /** + * Sets this matrix to the 4x4 identity matrix. + * + * @return {Matrix4} A reference to this matrix. + */ + identity(): Matrix4; + /** + * Returns a matrix with copied values from this instance. + * + * @return {Matrix4} A clone of this instance. + */ + clone(): Matrix4; + /** + * Copies the values of the given matrix to this instance. + * + * @param {Matrix4} m - The matrix to copy. + * @return {Matrix4} A reference to this matrix. + */ + copy(m: Matrix4): Matrix4; + /** + * Copies the translation component of the given matrix + * into this matrix's translation component. + * + * @param {Matrix4} m - The matrix to copy the translation component. + * @return {Matrix4} A reference to this matrix. + */ + copyPosition(m: Matrix4): Matrix4; + /** + * Set the upper 3x3 elements of this matrix to the values of given 3x3 matrix. + * + * @param {Matrix3} m - The 3x3 matrix. + * @return {Matrix4} A reference to this matrix. + */ + setFromMatrix3(m: Matrix3): Matrix4; + /** + * Extracts the basis vectors of this matrix into the three vectors provided. + * + * @param {Vector3} xAxis - The basis's x axis. + * @param {Vector3} yAxis - The basis's y axis. + * @param {Vector3} zAxis - The basis's z axis. + * @return {Matrix4} A reference to this matrix. + */ + extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; + /** + * Sets the given basis vectors to this matrix. + * + * @param {Vector3} xAxis - The basis's x axis. + * @param {Vector3} yAxis - The basis's y axis. + * @param {Vector3} zAxis - The basis's z axis. + * @return {Matrix4} A reference to this matrix. + */ + makeBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; + /** + * Extracts the rotation component of the given matrix + * into this matrix's rotation component. + * + * Note: This method does not support reflection matrices. + * + * @param {Matrix4} m - The matrix. + * @return {Matrix4} A reference to this matrix. + */ + extractRotation(m: Matrix4): Matrix4; + /** + * Sets the rotation component (the upper left 3x3 matrix) of this matrix to + * the rotation specified by the given Euler angles. The rest of + * the matrix is set to the identity. Depending on the {@link Euler#order}, + * there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix) + * for a complete list. + * + * @param {Euler} euler - The Euler angles. + * @return {Matrix4} A reference to this matrix. + */ + makeRotationFromEuler(euler: Euler): Matrix4; + /** + * Sets the rotation component of this matrix to the rotation specified by + * the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion) + * The rest of the matrix is set to the identity. + * + * @param {Quaternion} q - The Quaternion. + * @return {Matrix4} A reference to this matrix. + */ + makeRotationFromQuaternion(q: Quaternion): Matrix4; + /** + * Sets the rotation component of the transformation matrix, looking from `eye` towards + * `target`, and oriented by the up-direction. + * + * @param {Vector3} eye - The eye vector. + * @param {Vector3} target - The target vector. + * @param {Vector3} up - The up vector. + * @return {Matrix4} A reference to this matrix. + */ + lookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix4; + /** + * Post-multiplies this matrix by the given 4x4 matrix. + * + * @param {Matrix4} m - The matrix to multiply with. + * @return {Matrix4} A reference to this matrix. + */ + multiply(m: Matrix4): Matrix4; + /** + * Pre-multiplies this matrix by the given 4x4 matrix. + * + * @param {Matrix4} m - The matrix to multiply with. + * @return {Matrix4} A reference to this matrix. + */ + premultiply(m: Matrix4): Matrix4; + /** + * Multiples the given 4x4 matrices and stores the result + * in this matrix. + * + * @param {Matrix4} a - The first matrix. + * @param {Matrix4} b - The second matrix. + * @return {Matrix4} A reference to this matrix. + */ + multiplyMatrices(a: Matrix4, b: Matrix4): Matrix4; + /** + * Multiplies every component of the matrix by the given scalar. + * + * @param {number} s - The scalar. + * @return {Matrix4} A reference to this matrix. + */ + multiplyScalar(s: number): Matrix4; + /** + * Computes and returns the determinant of this matrix. + * + * @return {number} The determinant. + */ + determinant(): number; + /** + * Computes and returns the determinant of the 4x4 matrix, but assumes the + * matrix is affine, saving some computations. + * + * For affine matrices (like an object's world matrix), this value equals the + * full 4x4 {@link Matrix4#determinant} but is cheaper to compute. + * + * Assumes the bottom row is [0, 0, 0, 1]. + * + * @return {number} The determinant of the matrix. + */ + determinantAffine(): number; + /** + * Transposes this matrix in place. + * + * @return {Matrix4} A reference to this matrix. + */ + transpose(): Matrix4; + /** + * Sets the position component for this matrix from the given vector, + * without affecting the rest of the matrix. + * + * @param {number|Vector3} x - The x component of the vector or alternatively the vector object. + * @param {number} y - The y component of the vector. + * @param {number} z - The z component of the vector. + * @return {Matrix4} A reference to this matrix. + */ + setPosition(x: number | Vector3, y: number, z: number): Matrix4; + /** + * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution). + * You can not invert with a determinant of zero. If you attempt this, the method produces + * a zero matrix instead. + * + * @return {Matrix4} A reference to this matrix. + */ + invert(): Matrix4; + /** + * Scales each of the first three columns of this matrix by the corresponding component of the given vector. + * + * @param {Vector3} v - The scale vector. + * @return {Matrix4} A reference to this matrix. + */ + scale(v: Vector3): Matrix4; + /** + * Gets the maximum scale value of the three axes. + * + * @return {number} The maximum scale. + */ + getMaxScaleOnAxis(): number; + /** + * Sets this matrix as a translation transform from the given vector. + * + * @param {number|Vector3} x - The amount to translate in the X axis or alternatively a translation vector. + * @param {number} y - The amount to translate in the Y axis. + * @param {number} z - The amount to translate in the z axis. + * @return {Matrix4} A reference to this matrix. + */ + makeTranslation(x: number | Vector3, y: number, z: number): Matrix4; + /** + * Sets this matrix as a rotational transformation around the X axis by + * the given angle. + * + * @param {number} theta - The rotation in radians. + * @return {Matrix4} A reference to this matrix. + */ + makeRotationX(theta: number): Matrix4; + /** + * Sets this matrix as a rotational transformation around the Y axis by + * the given angle. + * + * @param {number} theta - The rotation in radians. + * @return {Matrix4} A reference to this matrix. + */ + makeRotationY(theta: number): Matrix4; + /** + * Sets this matrix as a rotational transformation around the Z axis by + * the given angle. + * + * @param {number} theta - The rotation in radians. + * @return {Matrix4} A reference to this matrix. + */ + makeRotationZ(theta: number): Matrix4; + /** + * Sets this matrix as a rotational transformation around the given axis by + * the given angle. + * + * @param {Vector3} axis - The normalized rotation axis. + * @param {number} angle - The rotation in radians. + * @return {Matrix4} A reference to this matrix. + */ + makeRotationAxis(axis: Vector3, angle: number): Matrix4; + /** + * Sets this matrix as a scale transformation. + * + * @param {number} x - The amount to scale in the X axis. + * @param {number} y - The amount to scale in the Y axis. + * @param {number} z - The amount to scale in the Z axis. + * @return {Matrix4} A reference to this matrix. + */ + makeScale(x: number, y: number, z: number): Matrix4; + /** + * Sets this matrix as a shear transformation. + * + * @param {number} xy - The amount to shear X by Y. + * @param {number} xz - The amount to shear X by Z. + * @param {number} yx - The amount to shear Y by X. + * @param {number} yz - The amount to shear Y by Z. + * @param {number} zx - The amount to shear Z by X. + * @param {number} zy - The amount to shear Z by Y. + * @return {Matrix4} A reference to this matrix. + */ + makeShear(xy: number, xz: number, yx: number, yz: number, zx: number, zy: number): Matrix4; + /** + * Sets this matrix to the transformation composed of the given position, + * rotation (Quaternion) and scale. + * + * @param {Vector3} position - The position vector. + * @param {Quaternion} quaternion - The rotation as a Quaternion. + * @param {Vector3} scale - The scale vector. + * @return {Matrix4} A reference to this matrix. + */ + compose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4; + /** + * Decomposes this matrix into its position, rotation and scale components + * and provides the result in the given objects. + * + * Note: Not all matrices are decomposable in this way. For example, if an + * object has a non-uniformly scaled parent, then the object's world matrix + * may not be decomposable, and this method may not be appropriate. + * + * @param {Vector3} position - The position vector. + * @param {Quaternion} quaternion - The rotation as a Quaternion. + * @param {Vector3} scale - The scale vector. + * @return {Matrix4} A reference to this matrix. + */ + decompose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4; + /** + * Creates a perspective projection matrix. This is used internally by + * {@link PerspectiveCamera#updateProjectionMatrix}. + + * @param {number} left - Left boundary of the viewing frustum at the near plane. + * @param {number} right - Right boundary of the viewing frustum at the near plane. + * @param {number} top - Top boundary of the viewing frustum at the near plane. + * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane. + * @param {number} near - The distance from the camera to the near plane. + * @param {number} far - The distance from the camera to the far plane. + * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system. + * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth. + * @return {Matrix4} A reference to this matrix. + */ + makePerspective(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: (number | number), reversedDepth?: boolean): Matrix4; + /** + * Creates a orthographic projection matrix. This is used internally by + * {@link OrthographicCamera#updateProjectionMatrix}. + + * @param {number} left - Left boundary of the viewing frustum at the near plane. + * @param {number} right - Right boundary of the viewing frustum at the near plane. + * @param {number} top - Top boundary of the viewing frustum at the near plane. + * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane. + * @param {number} near - The distance from the camera to the near plane. + * @param {number} far - The distance from the camera to the far plane. + * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system. + * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth. + * @return {Matrix4} A reference to this matrix. + */ + makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: (number | number), reversedDepth?: boolean): Matrix4; + /** + * Returns `true` if this matrix is equal with the given one. + * + * @param {Matrix4} matrix - The matrix to test for equality. + * @return {boolean} Whether this matrix is equal with the given one. + */ + equals(matrix: Matrix4): boolean; + /** + * Sets the elements of the matrix from the given array. + * + * @param {Array} array - The matrix elements in column-major order. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Matrix4} A reference to this matrix. + */ + fromArray(array: Array, offset?: number): Matrix4; + /** + * Writes the elements of this matrix to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the matrix elements in column-major order. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The matrix elements in column-major order. + */ + toArray(array?: Array, offset?: number): Array; +} +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Plane.d.ts b/jsdoc-testing/jsdoc/src/math/Plane.d.ts new file mode 100644 index 000000000..b98878577 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Plane.d.ts @@ -0,0 +1,203 @@ +/** + * A two dimensional surface that extends infinitely in 3D space, represented + * in [Hessian normal form](https://mathworld.wolfram.com/HessianNormalForm.html) + * by a unit length normal vector and a constant. + */ +export class Plane { + /** + * Constructs a new plane. + * + * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane. + * @param {number} [constant=0] - The signed distance from the origin to the plane. + */ + constructor(normal?: Vector3, constant?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPlane: boolean; + /** + * A unit length vector defining the normal of the plane. + * + * @type {Vector3} + */ + normal: Vector3; + /** + * The signed distance from the origin to the plane. + * + * @type {number} + * @default 0 + */ + constant: number; + /** + * Sets the plane components by copying the given values. + * + * @param {Vector3} normal - The normal. + * @param {number} constant - The constant. + * @return {Plane} A reference to this plane. + */ + set(normal: Vector3, constant: number): Plane; + /** + * Sets the plane components by defining `x`, `y`, `z` as the + * plane normal and `w` as the constant. + * + * @param {number} x - The value for the normal's x component. + * @param {number} y - The value for the normal's y component. + * @param {number} z - The value for the normal's z component. + * @param {number} w - The constant value. + * @return {Plane} A reference to this plane. + */ + setComponents(x: number, y: number, z: number, w: number): Plane; + /** + * Sets the plane from the given normal and coplanar point (that is a point + * that lies onto the plane). + * + * @param {Vector3} normal - The normal. + * @param {Vector3} point - A coplanar point. + * @return {Plane} A reference to this plane. + */ + setFromNormalAndCoplanarPoint(normal: Vector3, point: Vector3): Plane; + /** + * Sets the plane from three coplanar points. The winding order is + * assumed to be counter-clockwise, and determines the direction of + * the plane normal. + * + * @param {Vector3} a - The first coplanar point. + * @param {Vector3} b - The second coplanar point. + * @param {Vector3} c - The third coplanar point. + * @return {Plane} A reference to this plane. + */ + setFromCoplanarPoints(a: Vector3, b: Vector3, c: Vector3): Plane; + /** + * Copies the values of the given plane to this instance. + * + * @param {Plane} plane - The plane to copy. + * @return {Plane} A reference to this plane. + */ + copy(plane: Plane): Plane; + /** + * Normalizes the plane normal and adjusts the constant accordingly. + * + * @return {Plane} A reference to this plane. + */ + normalize(): Plane; + /** + * Negates both the plane normal and the constant. + * + * @return {Plane} A reference to this plane. + */ + negate(): Plane; + /** + * Returns the signed distance from the given point to this plane. + * + * @param {Vector3} point - The point to compute the distance for. + * @return {number} The signed distance. + */ + distanceToPoint(point: Vector3): number; + /** + * Returns the signed distance from the given sphere to this plane. + * + * @param {Sphere} sphere - The sphere to compute the distance for. + * @return {number} The signed distance. + */ + distanceToSphere(sphere: Sphere): number; + /** + * Projects a the given point onto the plane. + * + * @param {Vector3} point - The point to project. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The projected point on the plane. + */ + projectPoint(point: Vector3, target: Vector3): Vector3; + /** + * Returns the intersection point of the passed line and the plane. Returns + * `null` if the line does not intersect. Returns the line's starting point if + * the line is coplanar with the plane. + * + * @param {Line3} line - The line to compute the intersection for. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment. + * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected. + */ + intersectLine(line: Line3, target: Vector3, clampToLine?: boolean): Vector3 | null; + /** + * Returns `true` if the given line segment intersects with (passes through) the plane. + * + * @param {Line3} line - The line to test. + * @return {boolean} Whether the given line segment intersects with the plane or not. + */ + intersectsLine(line: Line3): boolean; + /** + * Returns `true` if the given bounding box intersects with the plane. + * + * @param {Box3} box - The bounding box to test. + * @return {boolean} Whether the given bounding box intersects with the plane or not. + */ + intersectsBox(box: Box3): boolean; + /** + * Returns `true` if the given bounding sphere intersects with the plane. + * + * @param {Sphere} sphere - The bounding sphere to test. + * @return {boolean} Whether the given bounding sphere intersects with the plane or not. + */ + intersectsSphere(sphere: Sphere): boolean; + /** + * Returns a coplanar vector to the plane, by calculating the + * projection of the normal at the origin onto the plane. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The coplanar point. + */ + coplanarPoint(target: Vector3): Vector3; + /** + * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform. + * + * The optional normal matrix can be pre-computed like so: + * ```js + * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); + * ``` + * + * @param {Matrix4} matrix - The transformation matrix. + * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix. + * @return {Plane} A reference to this plane. + */ + applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix4): Plane; + /** + * Translates the plane by the distance defined by the given offset vector. + * Note that this only affects the plane constant and will not affect the normal vector. + * + * @param {Vector3} offset - The offset vector. + * @return {Plane} A reference to this plane. + */ + translate(offset: Vector3): Plane; + /** + * Returns `true` if this plane is equal with the given one. + * + * @param {Plane} plane - The plane to test for equality. + * @return {boolean} Whether this plane is equal with the given one. + */ + equals(plane: Plane): boolean; + /** + * Returns a new plane with copied values from this instance. + * + * @return {Plane} A clone of this instance. + */ + clone(): Plane; + /** + * Returns a serialized structure of the plane. + * + * @return {Object} Serialized structure with fields representing the object state. + */ + toJSON(): Object; + /** + * Sets the plane properties from the given JSON. + * + * @param {Object} json - The serialized json to set the plane from. + * @return {Plane} A reference to this plane. + */ + fromJSON(json: Object): Plane; +} +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Quaternion.d.ts b/jsdoc-testing/jsdoc/src/math/Quaternion.d.ts new file mode 100644 index 000000000..214548cde --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Quaternion.d.ts @@ -0,0 +1,310 @@ +/** + * Class for representing a Quaternion. Quaternions are used in three.js to represent rotations. + * + * Iterating through a vector instance will yield its components `(x, y, z, w)` in + * the corresponding order. + * + * Note that three.js expects Quaternions to be normalized. + * ```js + * const quaternion = new THREE.Quaternion(); + * quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 ); + * + * const vector = new THREE.Vector3( 1, 0, 0 ); + * vector.applyQuaternion( quaternion ); + * ``` + */ +export class Quaternion { + /** + * Interpolates between two quaternions via SLERP. This implementation assumes the + * quaternion data are managed in flat arrays. + * + * @param {Array} dst - The destination array. + * @param {number} dstOffset - An offset into the destination array. + * @param {Array} src0 - The source array of the first quaternion. + * @param {number} srcOffset0 - An offset into the first source array. + * @param {Array} src1 - The source array of the second quaternion. + * @param {number} srcOffset1 - An offset into the second source array. + * @param {number} t - The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate. + * @see {@link Quaternion#slerp} + */ + static slerpFlat(dst: Array, dstOffset: number, src0: Array, srcOffset0: number, src1: Array, srcOffset1: number, t: number): void; + /** + * Multiplies two quaternions. This implementation assumes the quaternion data are managed + * in flat arrays. + * + * @param {Array} dst - The destination array. + * @param {number} dstOffset - An offset into the destination array. + * @param {Array} src0 - The source array of the first quaternion. + * @param {number} srcOffset0 - An offset into the first source array. + * @param {Array} src1 - The source array of the second quaternion. + * @param {number} srcOffset1 - An offset into the second source array. + * @return {Array} The destination array. + * @see {@link Quaternion#multiplyQuaternions}. + */ + static multiplyQuaternionsFlat(dst: Array, dstOffset: number, src0: Array, srcOffset0: number, src1: Array, srcOffset1: number): Array; + /** + * Constructs a new quaternion. + * + * @param {number} [x=0] - The x value of this quaternion. + * @param {number} [y=0] - The y value of this quaternion. + * @param {number} [z=0] - The z value of this quaternion. + * @param {number} [w=1] - The w value of this quaternion. + */ + constructor(x?: number, y?: number, z?: number, w?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isQuaternion: boolean; + _x: number; + _y: number; + _z: number; + _w: number; + set x(value: number); + /** + * The x value of this quaternion. + * + * @type {number} + * @default 0 + */ + get x(): number; + set y(value: number); + /** + * The y value of this quaternion. + * + * @type {number} + * @default 0 + */ + get y(): number; + set z(value: number); + /** + * The z value of this quaternion. + * + * @type {number} + * @default 0 + */ + get z(): number; + set w(value: number); + /** + * The w value of this quaternion. + * + * @type {number} + * @default 1 + */ + get w(): number; + /** + * Sets the quaternion components. + * + * @param {number} x - The x value of this quaternion. + * @param {number} y - The y value of this quaternion. + * @param {number} z - The z value of this quaternion. + * @param {number} w - The w value of this quaternion. + * @return {Quaternion} A reference to this quaternion. + */ + set(x: number, y: number, z: number, w: number): Quaternion; + /** + * Returns a new quaternion with copied values from this instance. + * + * @return {Quaternion} A clone of this instance. + */ + clone(): Quaternion; + /** + * Copies the values of the given quaternion to this instance. + * + * @param {Quaternion} quaternion - The quaternion to copy. + * @return {Quaternion} A reference to this quaternion. + */ + copy(quaternion: Quaternion): Quaternion; + /** + * Sets this quaternion from the rotation specified by the given + * Euler angles. + * + * @param {Euler} euler - The Euler angles. + * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not. + * @return {Quaternion} A reference to this quaternion. + */ + setFromEuler(euler: Euler, update?: boolean): Quaternion; + /** + * Sets this quaternion from the given axis and angle. + * + * @param {Vector3} axis - The normalized axis. + * @param {number} angle - The angle in radians. + * @return {Quaternion} A reference to this quaternion. + */ + setFromAxisAngle(axis: Vector3, angle: number): Quaternion; + /** + * Sets this quaternion from the given rotation matrix. + * + * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled). + * @return {Quaternion} A reference to this quaternion. + */ + setFromRotationMatrix(m: Matrix4): Quaternion; + /** + * Sets this quaternion to the rotation required to rotate the direction vector + * `vFrom` to the direction vector `vTo`. + * + * @param {Vector3} vFrom - The first (normalized) direction vector. + * @param {Vector3} vTo - The second (normalized) direction vector. + * @return {Quaternion} A reference to this quaternion. + */ + setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion; + /** + * Returns the angle between this quaternion and the given one in radians. + * + * @param {Quaternion} q - The quaternion to compute the angle with. + * @return {number} The angle in radians. + */ + angleTo(q: Quaternion): number; + /** + * Rotates this quaternion by a given angular step to the given quaternion. + * The method ensures that the final quaternion will not overshoot `q`. + * + * @param {Quaternion} q - The target quaternion. + * @param {number} step - The angular step in radians. + * @return {Quaternion} A reference to this quaternion. + */ + rotateTowards(q: Quaternion, step: number): Quaternion; + /** + * Sets this quaternion to the identity quaternion; that is, to the + * quaternion that represents "no rotation". + * + * @return {Quaternion} A reference to this quaternion. + */ + identity(): Quaternion; + /** + * Inverts this quaternion via {@link Quaternion#conjugate}. The + * quaternion is assumed to have unit length. + * + * @return {Quaternion} A reference to this quaternion. + */ + invert(): Quaternion; + /** + * Returns the rotational conjugate of this quaternion. The conjugate of a + * quaternion represents the same rotation in the opposite direction about + * the rotational axis. + * + * @return {Quaternion} A reference to this quaternion. + */ + conjugate(): Quaternion; + /** + * Calculates the dot product of this quaternion and the given one. + * + * @param {Quaternion} v - The quaternion to compute the dot product with. + * @return {number} The result of the dot product. + */ + dot(v: Quaternion): number; + /** + * Computes the squared Euclidean length (straight-line length) of this quaternion, + * considered as a 4 dimensional vector. This can be useful if you are comparing the + * lengths of two quaternions, as this is a slightly more efficient calculation than + * {@link Quaternion#length}. + * + * @return {number} The squared Euclidean length. + */ + lengthSq(): number; + /** + * Computes the Euclidean length (straight-line length) of this quaternion, + * considered as a 4 dimensional vector. + * + * @return {number} The Euclidean length. + */ + length(): number; + /** + * Normalizes this quaternion - that is, calculated the quaternion that performs + * the same rotation as this one, but has a length equal to `1`. + * + * @return {Quaternion} A reference to this quaternion. + */ + normalize(): Quaternion; + /** + * Multiplies this quaternion by the given one. + * + * @param {Quaternion} q - The quaternion. + * @return {Quaternion} A reference to this quaternion. + */ + multiply(q: Quaternion): Quaternion; + /** + * Pre-multiplies this quaternion by the given one. + * + * @param {Quaternion} q - The quaternion. + * @return {Quaternion} A reference to this quaternion. + */ + premultiply(q: Quaternion): Quaternion; + /** + * Multiplies the given quaternions and stores the result in this instance. + * + * @param {Quaternion} a - The first quaternion. + * @param {Quaternion} b - The second quaternion. + * @return {Quaternion} A reference to this quaternion. + */ + multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion; + /** + * Performs a spherical linear interpolation between this quaternion and the target quaternion. + * + * @param {Quaternion} qb - The target quaternion. + * @param {number} t - The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate. + * @return {Quaternion} A reference to this quaternion. + */ + slerp(qb: Quaternion, t: number): Quaternion; + /** + * Performs a spherical linear interpolation between the given quaternions + * and stores the result in this quaternion. + * + * @param {Quaternion} qa - The source quaternion. + * @param {Quaternion} qb - The target quaternion. + * @param {number} t - The interpolation factor in the closed interval `[0, 1]`. + * @return {Quaternion} A reference to this quaternion. + */ + slerpQuaternions(qa: Quaternion, qb: Quaternion, t: number): Quaternion; + /** + * Sets this quaternion to a uniformly random, normalized quaternion. + * + * @return {Quaternion} A reference to this quaternion. + */ + random(): Quaternion; + /** + * Returns `true` if this quaternion is equal with the given one. + * + * @param {Quaternion} quaternion - The quaternion to test for equality. + * @return {boolean} Whether this quaternion is equal with the given one. + */ + equals(quaternion: Quaternion): boolean; + /** + * Sets this quaternion's components from the given array. + * + * @param {Array} array - An array holding the quaternion component values. + * @param {number} [offset=0] - The offset into the array. + * @return {Quaternion} A reference to this quaternion. + */ + fromArray(array: Array, offset?: number): Quaternion; + /** + * Writes the components of this quaternion to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the quaternion components. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The quaternion components. + */ + toArray(array?: Array, offset?: number): Array; + /** + * Sets the components of this quaternion from the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute holding quaternion data. + * @param {number} index - The index into the attribute. + * @return {Quaternion} A reference to this quaternion. + */ + fromBufferAttribute(attribute: BufferAttribute, index: number): Quaternion; + /** + * This methods defines the serialization result of this class. Returns the + * numerical elements of this quaternion in an array of format `[x, y, z, w]`. + * + * @return {Array} The serialized quaternion. + */ + toJSON(): Array; + _onChange(callback: any): this; + _onChangeCallback(): void; + [Symbol.iterator](): Generator; +} diff --git a/jsdoc-testing/jsdoc/src/math/Ray.d.ts b/jsdoc-testing/jsdoc/src/math/Ray.d.ts new file mode 100644 index 000000000..02531c54e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Ray.d.ts @@ -0,0 +1,185 @@ +/** + * A ray that emits from an origin in a certain direction. The class is used by + * {@link Raycaster} to assist with raycasting. Raycasting is used for + * mouse picking (working out what objects in the 3D space the mouse is over) + * amongst other things. + */ +export class Ray { + /** + * Constructs a new ray. + * + * @param {Vector3} [origin=(0,0,0)] - The origin of the ray. + * @param {Vector3} [direction=(0,0,-1)] - The (normalized) direction of the ray. + */ + constructor(origin?: Vector3, direction?: Vector3); + /** + * The origin of the ray. + * + * @type {Vector3} + */ + origin: Vector3; + /** + * The (normalized) direction of the ray. + * + * @type {Vector3} + */ + direction: Vector3; + /** + * Sets the ray's components by copying the given values. + * + * @param {Vector3} origin - The origin. + * @param {Vector3} direction - The direction. + * @return {Ray} A reference to this ray. + */ + set(origin: Vector3, direction: Vector3): Ray; + /** + * Copies the values of the given ray to this instance. + * + * @param {Ray} ray - The ray to copy. + * @return {Ray} A reference to this ray. + */ + copy(ray: Ray): Ray; + /** + * Returns a vector that is located at a given distance along this ray. + * + * @param {number} t - The distance along the ray to retrieve a position for. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} A position on the ray. + */ + at(t: number, target: Vector3): Vector3; + /** + * Adjusts the direction of the ray to point at the given vector in world space. + * + * @param {Vector3} v - The target position. + * @return {Ray} A reference to this ray. + */ + lookAt(v: Vector3): Ray; + /** + * Shift the origin of this ray along its direction by the given distance. + * + * @param {number} t - The distance along the ray to interpolate. + * @return {Ray} A reference to this ray. + */ + recast(t: number): Ray; + /** + * Returns the point along this ray that is closest to the given point. + * + * @param {Vector3} point - A point in 3D space to get the closet location on the ray for. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The closest point on this ray. + */ + closestPointToPoint(point: Vector3, target: Vector3): Vector3; + /** + * Returns the distance of the closest approach between this ray and the given point. + * + * @param {Vector3} point - A point in 3D space to compute the distance to. + * @return {number} The distance. + */ + distanceToPoint(point: Vector3): number; + /** + * Returns the squared distance of the closest approach between this ray and the given point. + * + * @param {Vector3} point - A point in 3D space to compute the distance to. + * @return {number} The squared distance. + */ + distanceSqToPoint(point: Vector3): number; + /** + * Returns the squared distance between this ray and the given line segment. + * + * @param {Vector3} v0 - The start point of the line segment. + * @param {Vector3} v1 - The end point of the line segment. + * @param {Vector3} [optionalPointOnRay] - When provided, it receives the point on this ray that is closest to the segment. + * @param {Vector3} [optionalPointOnSegment] - When provided, it receives the point on the line segment that is closest to this ray. + * @return {number} The squared distance. + */ + distanceSqToSegment(v0: Vector3, v1: Vector3, optionalPointOnRay?: Vector3, optionalPointOnSegment?: Vector3): number; + /** + * Intersects this ray with the given sphere, returning the intersection + * point or `null` if there is no intersection. + * + * @param {Sphere} sphere - The sphere to intersect. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The intersection point. + */ + intersectSphere(sphere: Sphere, target: Vector3): Vector3 | null; + /** + * Returns `true` if this ray intersects with the given sphere. + * + * @param {Sphere} sphere - The sphere to intersect. + * @return {boolean} Whether this ray intersects with the given sphere or not. + */ + intersectsSphere(sphere: Sphere): boolean; + /** + * Computes the distance from the ray's origin to the given plane. Returns `null` if the ray + * does not intersect with the plane. + * + * @param {Plane} plane - The plane to compute the distance to. + * @return {?number} Whether this ray intersects with the given sphere or not. + */ + distanceToPlane(plane: Plane): number | null; + /** + * Intersects this ray with the given plane, returning the intersection + * point or `null` if there is no intersection. + * + * @param {Plane} plane - The plane to intersect. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The intersection point. + */ + intersectPlane(plane: Plane, target: Vector3): Vector3 | null; + /** + * Returns `true` if this ray intersects with the given plane. + * + * @param {Plane} plane - The plane to intersect. + * @return {boolean} Whether this ray intersects with the given plane or not. + */ + intersectsPlane(plane: Plane): boolean; + /** + * Intersects this ray with the given bounding box, returning the intersection + * point or `null` if there is no intersection. + * + * @param {Box3} box - The box to intersect. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The intersection point. + */ + intersectBox(box: Box3, target: Vector3): Vector3 | null; + /** + * Returns `true` if this ray intersects with the given box. + * + * @param {Box3} box - The box to intersect. + * @return {boolean} Whether this ray intersects with the given box or not. + */ + intersectsBox(box: Box3): boolean; + /** + * Intersects this ray with the given triangle, returning the intersection + * point or `null` if there is no intersection. + * + * @param {Vector3} a - The first vertex of the triangle. + * @param {Vector3} b - The second vertex of the triangle. + * @param {Vector3} c - The third vertex of the triangle. + * @param {boolean} backfaceCulling - Whether to use backface culling or not. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The intersection point. + */ + intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, target: Vector3): Vector3 | null; + /** + * Transforms this ray with the given 4x4 transformation matrix. + * + * @param {Matrix4} matrix4 - The transformation matrix. + * @return {Ray} A reference to this ray. + */ + applyMatrix4(matrix4: Matrix4): Ray; + /** + * Returns `true` if this ray is equal with the given one. + * + * @param {Ray} ray - The ray to test for equality. + * @return {boolean} Whether this ray is equal with the given one. + */ + equals(ray: Ray): boolean; + /** + * Returns a new ray with copied values from this instance. + * + * @return {Ray} A clone of this instance. + */ + clone(): Ray; +} +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Sphere.d.ts b/jsdoc-testing/jsdoc/src/math/Sphere.d.ts new file mode 100644 index 000000000..5d7e4ac67 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Sphere.d.ts @@ -0,0 +1,185 @@ +/** + * An analytical 3D sphere defined by a center and radius. This class is mainly + * used as a Bounding Sphere for 3D objects. + */ +export class Sphere { + /** + * Constructs a new sphere. + * + * @param {Vector3} [center=(0,0,0)] - The center of the sphere + * @param {number} [radius=-1] - The radius of the sphere. + */ + constructor(center?: Vector3, radius?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSphere: boolean; + /** + * The center of the sphere + * + * @type {Vector3} + */ + center: Vector3; + /** + * The radius of the sphere. + * + * @type {number} + */ + radius: number; + /** + * Sets the sphere's components by copying the given values. + * + * @param {Vector3} center - The center. + * @param {number} radius - The radius. + * @return {Sphere} A reference to this sphere. + */ + set(center: Vector3, radius: number): Sphere; + /** + * Computes the minimum bounding sphere for list of points. + * If the optional center point is given, it is used as the sphere's + * center. Otherwise, the center of the axis-aligned bounding box + * encompassing the points is calculated. + * + * @param {Array} points - A list of points in 3D space. + * @param {Vector3} [optionalCenter] - The center of the sphere. + * @return {Sphere} A reference to this sphere. + */ + setFromPoints(points: Array, optionalCenter?: Vector3): Sphere; + /** + * Copies the values of the given sphere to this instance. + * + * @param {Sphere} sphere - The sphere to copy. + * @return {Sphere} A reference to this sphere. + */ + copy(sphere: Sphere): Sphere; + /** + * Returns `true` if the sphere is empty (the radius set to a negative number). + * + * Spheres with a radius of `0` contain only their center point and are not + * considered to be empty. + * + * @return {boolean} Whether this sphere is empty or not. + */ + isEmpty(): boolean; + /** + * Makes this sphere empty which means in encloses a zero space in 3D. + * + * @return {Sphere} A reference to this sphere. + */ + makeEmpty(): Sphere; + /** + * Returns `true` if this sphere contains the given point inclusive of + * the surface of the sphere. + * + * @param {Vector3} point - The point to check. + * @return {boolean} Whether this sphere contains the given point or not. + */ + containsPoint(point: Vector3): boolean; + /** + * Returns the closest distance from the boundary of the sphere to the + * given point. If the sphere contains the point, the distance will + * be negative. + * + * @param {Vector3} point - The point to compute the distance to. + * @return {number} The distance to the point. + */ + distanceToPoint(point: Vector3): number; + /** + * Returns `true` if this sphere intersects with the given one. + * + * @param {Sphere} sphere - The sphere to test. + * @return {boolean} Whether this sphere intersects with the given one or not. + */ + intersectsSphere(sphere: Sphere): boolean; + /** + * Returns `true` if this sphere intersects with the given box. + * + * @param {Box3} box - The box to test. + * @return {boolean} Whether this sphere intersects with the given box or not. + */ + intersectsBox(box: Box3): boolean; + /** + * Returns `true` if this sphere intersects with the given plane. + * + * @param {Plane} plane - The plane to test. + * @return {boolean} Whether this sphere intersects with the given plane or not. + */ + intersectsPlane(plane: Plane): boolean; + /** + * Clamps a point within the sphere. If the point is outside the sphere, it + * will clamp it to the closest point on the edge of the sphere. Points + * already inside the sphere will not be affected. + * + * @param {Vector3} point - The plane to clamp. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The clamped point. + */ + clampPoint(point: Vector3, target: Vector3): Vector3; + /** + * Returns a bounding box that encloses this sphere. + * + * @param {Box3} target - The target box that is used to store the method's result. + * @return {Box3} The bounding box that encloses this sphere. + */ + getBoundingBox(target: Box3): Box3; + /** + * Transforms this sphere with the given 4x4 transformation matrix. + * + * @param {Matrix4} matrix - The transformation matrix. + * @return {Sphere} A reference to this sphere. + */ + applyMatrix4(matrix: Matrix4): Sphere; + /** + * Translates the sphere's center by the given offset. + * + * @param {Vector3} offset - The offset. + * @return {Sphere} A reference to this sphere. + */ + translate(offset: Vector3): Sphere; + /** + * Expands the boundaries of this sphere to include the given point. + * + * @param {Vector3} point - The point to include. + * @return {Sphere} A reference to this sphere. + */ + expandByPoint(point: Vector3): Sphere; + /** + * Expands this sphere to enclose both the original sphere and the given sphere. + * + * @param {Sphere} sphere - The sphere to include. + * @return {Sphere} A reference to this sphere. + */ + union(sphere: Sphere): Sphere; + /** + * Returns `true` if this sphere is equal with the given one. + * + * @param {Sphere} sphere - The sphere to test for equality. + * @return {boolean} Whether this bounding sphere is equal with the given one. + */ + equals(sphere: Sphere): boolean; + /** + * Returns a new sphere with copied values from this instance. + * + * @return {Sphere} A clone of this instance. + */ + clone(): Sphere; + /** + * Returns a serialized structure of the bounding sphere. + * + * @return {Object} Serialized structure with fields representing the object state. + */ + toJSON(): Object; + /** + * Returns a serialized structure of the bounding sphere. + * + * @param {Object} json - The serialized json to set the sphere from. + * @return {Sphere} A reference to this bounding sphere. + */ + fromJSON(json: Object): Sphere; +} +import { Vector3 } from './Vector3.js'; +import { Box3 } from './Box3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Spherical.d.ts b/jsdoc-testing/jsdoc/src/math/Spherical.d.ts new file mode 100644 index 000000000..300c0481a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Spherical.d.ts @@ -0,0 +1,81 @@ +/** + * This class can be used to represent points in 3D space as + * [Spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system). + */ +export class Spherical { + /** + * Constructs a new spherical. + * + * @param {number} [radius=1] - The radius, or the Euclidean distance (straight-line distance) from the point to the origin. + * @param {number} [phi=0] - The polar angle in radians from the y (up) axis. + * @param {number} [theta=0] - The equator/azimuthal angle in radians around the y (up) axis. + */ + constructor(radius?: number, phi?: number, theta?: number); + /** + * The radius, or the Euclidean distance (straight-line distance) from the point to the origin. + * + * @type {number} + * @default 1 + */ + radius: number; + /** + * The polar angle in radians from the y (up) axis. + * + * @type {number} + * @default 0 + */ + phi: number; + /** + * The equator/azimuthal angle in radians around the y (up) axis. + * + * @type {number} + * @default 0 + */ + theta: number; + /** + * Sets the spherical components by copying the given values. + * + * @param {number} radius - The radius. + * @param {number} phi - The polar angle. + * @param {number} theta - The azimuthal angle. + * @return {Spherical} A reference to this spherical. + */ + set(radius: number, phi: number, theta: number): Spherical; + /** + * Copies the values of the given spherical to this instance. + * + * @param {Spherical} other - The spherical to copy. + * @return {Spherical} A reference to this spherical. + */ + copy(other: Spherical): Spherical; + /** + * Restricts the polar angle [page:.phi phi] to be between `0.000001` and pi - + * `0.000001`. + * + * @return {Spherical} A reference to this spherical. + */ + makeSafe(): Spherical; + /** + * Sets the spherical components from the given vector which is assumed to hold + * Cartesian coordinates. + * + * @param {Vector3} v - The vector to set. + * @return {Spherical} A reference to this spherical. + */ + setFromVector3(v: Vector3): Spherical; + /** + * Sets the spherical components from the given Cartesian coordinates. + * + * @param {number} x - The x value. + * @param {number} y - The y value. + * @param {number} z - The z value. + * @return {Spherical} A reference to this spherical. + */ + setFromCartesianCoords(x: number, y: number, z: number): Spherical; + /** + * Returns a new spherical with copied values from this instance. + * + * @return {Spherical} A clone of this instance. + */ + clone(): Spherical; +} diff --git a/jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts b/jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts new file mode 100644 index 000000000..307ff49fa --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts @@ -0,0 +1,131 @@ +/** + * Represents a third-order spherical harmonics (SH). Light probes use this class + * to encode lighting information. + * + * - Primary reference: {@link https://graphics.stanford.edu/papers/envmap/envmap.pdf} + * - Secondary reference: {@link https://www.ppsloan.org/publications/StupidSH36.pdf} + */ +export class SphericalHarmonics3 { + /** + * Computes the SH basis for the given normal vector. + * + * @param {Vector3} normal - The normal. + * @param {Array} shBasis - The target array holding the SH basis. + */ + static getBasisAt(normal: Vector3, shBasis: Array): void; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSphericalHarmonics3: boolean; + /** + * An array holding the (9) SH coefficients. + * + * @type {Array} + */ + coefficients: Array; + /** + * Sets the given SH coefficients to this instance by copying + * the values. + * + * @param {Array} coefficients - The SH coefficients. + * @return {SphericalHarmonics3} A reference to this spherical harmonics. + */ + set(coefficients: Array): SphericalHarmonics3; + /** + * Sets all SH coefficients to `0`. + * + * @return {SphericalHarmonics3} A reference to this spherical harmonics. + */ + zero(): SphericalHarmonics3; + /** + * Returns the radiance in the direction of the given normal. + * + * @param {Vector3} normal - The normal vector (assumed to be unit length) + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The radiance. + */ + getAt(normal: Vector3, target: Vector3): Vector3; + /** + * Returns the irradiance (radiance convolved with cosine lobe) in the + * direction of the given normal. + * + * @param {Vector3} normal - The normal vector (assumed to be unit length) + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The irradiance. + */ + getIrradianceAt(normal: Vector3, target: Vector3): Vector3; + /** + * Adds the given SH to this instance. + * + * @param {SphericalHarmonics3} sh - The SH to add. + * @return {SphericalHarmonics3} A reference to this spherical harmonics. + */ + add(sh: SphericalHarmonics3): SphericalHarmonics3; + /** + * A convenience method for performing {@link SphericalHarmonics3#add} and + * {@link SphericalHarmonics3#scale} at once. + * + * @param {SphericalHarmonics3} sh - The SH to add. + * @param {number} s - The scale factor. + * @return {SphericalHarmonics3} A reference to this spherical harmonics. + */ + addScaledSH(sh: SphericalHarmonics3, s: number): SphericalHarmonics3; + /** + * Scales this SH by the given scale factor. + * + * @param {number} s - The scale factor. + * @return {SphericalHarmonics3} A reference to this spherical harmonics. + */ + scale(s: number): SphericalHarmonics3; + /** + * Linear interpolates between the given SH and this instance by the given + * alpha factor. + * + * @param {SphericalHarmonics3} sh - The SH to interpolate with. + * @param {number} alpha - The alpha factor. + * @return {SphericalHarmonics3} A reference to this spherical harmonics. + */ + lerp(sh: SphericalHarmonics3, alpha: number): SphericalHarmonics3; + /** + * Returns `true` if this spherical harmonics is equal with the given one. + * + * @param {SphericalHarmonics3} sh - The spherical harmonics to test for equality. + * @return {boolean} Whether this spherical harmonics is equal with the given one. + */ + equals(sh: SphericalHarmonics3): boolean; + /** + * Copies the values of the given spherical harmonics to this instance. + * + * @param {SphericalHarmonics3} sh - The spherical harmonics to copy. + * @return {SphericalHarmonics3} A reference to this spherical harmonics. + */ + copy(sh: SphericalHarmonics3): SphericalHarmonics3; + /** + * Returns a new spherical harmonics with copied values from this instance. + * + * @return {SphericalHarmonics3} A clone of this instance. + */ + clone(): SphericalHarmonics3; + /** + * Sets the SH coefficients of this instance from the given array. + * + * @param {Array} array - An array holding the SH coefficients. + * @param {number} [offset=0] - The array offset where to start copying. + * @return {SphericalHarmonics3} A clone of this instance. + */ + fromArray(array: Array, offset?: number): SphericalHarmonics3; + /** + * Returns an array with the SH coefficients, or copies them into the provided + * array. The coefficients are represented as numbers. + * + * @param {Array} [array=[]] - The target array. + * @param {number} [offset=0] - The array offset where to start copying. + * @return {Array} An array with flat SH coefficients. + */ + toArray(array?: Array, offset?: number): Array; +} +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Triangle.d.ts b/jsdoc-testing/jsdoc/src/math/Triangle.d.ts new file mode 100644 index 000000000..3841d3852 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Triangle.d.ts @@ -0,0 +1,231 @@ +/** + * A geometric triangle as defined by three vectors representing its three corners. + */ +export class Triangle { + /** + * Computes the normal vector of a triangle. + * + * @param {Vector3} a - The first corner of the triangle. + * @param {Vector3} b - The second corner of the triangle. + * @param {Vector3} c - The third corner of the triangle. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The triangle's normal. + */ + static getNormal(a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3; + /** + * Computes a barycentric coordinates from the given vector. + * Returns `null` if the triangle is degenerate. + * + * @param {Vector3} point - A point in 3D space. + * @param {Vector3} a - The first corner of the triangle. + * @param {Vector3} b - The second corner of the triangle. + * @param {Vector3} c - The third corner of the triangle. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The barycentric coordinates for the given point + */ + static getBarycoord(point: Vector3, a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3 | null; + /** + * Returns `true` if the given point, when projected onto the plane of the + * triangle, lies within the triangle. + * + * @param {Vector3} point - The point in 3D space to test. + * @param {Vector3} a - The first corner of the triangle. + * @param {Vector3} b - The second corner of the triangle. + * @param {Vector3} c - The third corner of the triangle. + * @return {boolean} Whether the given point, when projected onto the plane of the + * triangle, lies within the triangle or not. + */ + static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean; + /** + * Computes the value barycentrically interpolated for the given point on the + * triangle. Returns `null` if the triangle is degenerate. + * + * @param {Vector3} point - Position of interpolated point. + * @param {Vector3} p1 - The first corner of the triangle. + * @param {Vector3} p2 - The second corner of the triangle. + * @param {Vector3} p3 - The third corner of the triangle. + * @param {Vector3} v1 - Value to interpolate of first vertex. + * @param {Vector3} v2 - Value to interpolate of second vertex. + * @param {Vector3} v3 - Value to interpolate of third vertex. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The interpolated value. + */ + static getInterpolation(point: Vector3, p1: Vector3, p2: Vector3, p3: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, target: Vector3): Vector3 | null; + /** + * Computes the value barycentrically interpolated for the given attribute and indices. + * + * @param {BufferAttribute} attr - The attribute to interpolate. + * @param {number} i1 - Index of first vertex. + * @param {number} i2 - Index of second vertex. + * @param {number} i3 - Index of third vertex. + * @param {Vector3} barycoord - The barycoordinate value to use to interpolate. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The interpolated attribute value. + */ + static getInterpolatedAttribute(attr: BufferAttribute, i1: number, i2: number, i3: number, barycoord: Vector3, target: Vector3): Vector3; + /** + * Returns `true` if the triangle is oriented towards the given direction. + * + * @param {Vector3} a - The first corner of the triangle. + * @param {Vector3} b - The second corner of the triangle. + * @param {Vector3} c - The third corner of the triangle. + * @param {Vector3} direction - The (normalized) direction vector. + * @return {boolean} Whether the triangle is oriented towards the given direction or not. + */ + static isFrontFacing(a: Vector3, b: Vector3, c: Vector3, direction: Vector3): boolean; + /** + * Constructs a new triangle. + * + * @param {Vector3} [a=(0,0,0)] - The first corner of the triangle. + * @param {Vector3} [b=(0,0,0)] - The second corner of the triangle. + * @param {Vector3} [c=(0,0,0)] - The third corner of the triangle. + */ + constructor(a?: Vector3, b?: Vector3, c?: Vector3); + /** + * The first corner of the triangle. + * + * @type {Vector3} + */ + a: Vector3; + /** + * The second corner of the triangle. + * + * @type {Vector3} + */ + b: Vector3; + /** + * The third corner of the triangle. + * + * @type {Vector3} + */ + c: Vector3; + /** + * Sets the triangle's vertices by copying the given values. + * + * @param {Vector3} a - The first corner of the triangle. + * @param {Vector3} b - The second corner of the triangle. + * @param {Vector3} c - The third corner of the triangle. + * @return {Triangle} A reference to this triangle. + */ + set(a: Vector3, b: Vector3, c: Vector3): Triangle; + /** + * Sets the triangle's vertices by copying the given array values. + * + * @param {Array} points - An array with 3D points. + * @param {number} i0 - The array index representing the first corner of the triangle. + * @param {number} i1 - The array index representing the second corner of the triangle. + * @param {number} i2 - The array index representing the third corner of the triangle. + * @return {Triangle} A reference to this triangle. + */ + setFromPointsAndIndices(points: Array, i0: number, i1: number, i2: number): Triangle; + /** + * Sets the triangle's vertices by copying the given attribute values. + * + * @param {BufferAttribute} attribute - A buffer attribute with 3D points data. + * @param {number} i0 - The attribute index representing the first corner of the triangle. + * @param {number} i1 - The attribute index representing the second corner of the triangle. + * @param {number} i2 - The attribute index representing the third corner of the triangle. + * @return {Triangle} A reference to this triangle. + */ + setFromAttributeAndIndices(attribute: BufferAttribute, i0: number, i1: number, i2: number): Triangle; + /** + * Returns a new triangle with copied values from this instance. + * + * @return {Triangle} A clone of this instance. + */ + clone(): Triangle; + /** + * Copies the values of the given triangle to this instance. + * + * @param {Triangle} triangle - The triangle to copy. + * @return {Triangle} A reference to this triangle. + */ + copy(triangle: Triangle): Triangle; + /** + * Computes the area of the triangle. + * + * @return {number} The triangle's area. + */ + getArea(): number; + /** + * Computes the midpoint of the triangle. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The triangle's midpoint. + */ + getMidpoint(target: Vector3): Vector3; + /** + * Computes the normal of the triangle. + * + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The triangle's normal. + */ + getNormal(target: Vector3): Vector3; + /** + * Computes a plane the triangle lies within. + * + * @param {Plane} target - The target vector that is used to store the method's result. + * @return {Plane} The plane the triangle lies within. + */ + getPlane(target: Plane): Plane; + /** + * Computes a barycentric coordinates from the given vector. + * Returns `null` if the triangle is degenerate. + * + * @param {Vector3} point - A point in 3D space. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The barycentric coordinates for the given point + */ + getBarycoord(point: Vector3, target: Vector3): Vector3 | null; + /** + * Computes the value barycentrically interpolated for the given point on the + * triangle. Returns `null` if the triangle is degenerate. + * + * @param {Vector3} point - Position of interpolated point. + * @param {Vector3} v1 - Value to interpolate of first vertex. + * @param {Vector3} v2 - Value to interpolate of second vertex. + * @param {Vector3} v3 - Value to interpolate of third vertex. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {?Vector3} The interpolated value. + */ + getInterpolation(point: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, target: Vector3): Vector3 | null; + /** + * Returns `true` if the given point, when projected onto the plane of the + * triangle, lies within the triangle. + * + * @param {Vector3} point - The point in 3D space to test. + * @return {boolean} Whether the given point, when projected onto the plane of the + * triangle, lies within the triangle or not. + */ + containsPoint(point: Vector3): boolean; + /** + * Returns `true` if the triangle is oriented towards the given direction. + * + * @param {Vector3} direction - The (normalized) direction vector. + * @return {boolean} Whether the triangle is oriented towards the given direction or not. + */ + isFrontFacing(direction: Vector3): boolean; + /** + * Returns `true` if this triangle intersects with the given box. + * + * @param {Box3} box - The box to intersect. + * @return {boolean} Whether this triangle intersects with the given box or not. + */ + intersectsBox(box: Box3): boolean; + /** + * Returns the closest point on the triangle to the given point. + * + * @param {Vector3} p - The point to compute the closest point for. + * @param {Vector3} target - The target vector that is used to store the method's result. + * @return {Vector3} The closest point on the triangle. + */ + closestPointToPoint(p: Vector3, target: Vector3): Vector3; + /** + * Returns `true` if this triangle is equal with the given one. + * + * @param {Triangle} triangle - The triangle to test for equality. + * @return {boolean} Whether this triangle is equal with the given one. + */ + equals(triangle: Triangle): boolean; +} +import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Vector2.d.ts b/jsdoc-testing/jsdoc/src/math/Vector2.d.ts new file mode 100644 index 000000000..aeaeb509d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Vector2.d.ts @@ -0,0 +1,440 @@ +/** + * Class representing a 2D vector. A 2D vector is an ordered pair of numbers + * (labeled x and y), which can be used to represent a number of things, such as: + * + * - A point in 2D space (i.e. a position on a plane). + * - A direction and length across a plane. In three.js the length will + * always be the Euclidean distance(straight-line distance) from `(0, 0)` to `(x, y)` + * and the direction is also measured from `(0, 0)` towards `(x, y)`. + * - Any arbitrary ordered pair of numbers. + * + * There are other things a 2D vector can be used to represent, such as + * momentum vectors, complex numbers and so on, however these are the most + * common uses in three.js. + * + * Iterating through a vector instance will yield its components `(x, y)` in + * the corresponding order. + * ```js + * const a = new THREE.Vector2( 0, 1 ); + * + * //no arguments; will be initialised to (0, 0) + * const b = new THREE.Vector2( ); + * + * const d = a.distanceTo( b ); + * ``` + */ +export class Vector2 { + /** + * Constructs a new 2D vector. + * + * @param {number} [x=0] - The x value of this vector. + * @param {number} [y=0] - The y value of this vector. + */ + constructor(x?: number, y?: number); + /** + * The x value of this vector. + * + * @type {number} + */ + x: number; + /** + * The y value of this vector. + * + * @type {number} + */ + y: number; + set width(value: number); + /** + * Alias for {@link Vector2#x}. + * + * @type {number} + */ + get width(): number; + set height(value: number); + /** + * Alias for {@link Vector2#y}. + * + * @type {number} + */ + get height(): number; + /** + * Sets the vector components. + * + * @param {number} x - The value of the x component. + * @param {number} y - The value of the y component. + * @return {Vector2} A reference to this vector. + */ + set(x: number, y: number): Vector2; + /** + * Sets the vector components to the same value. + * + * @param {number} scalar - The value to set for all vector components. + * @return {Vector2} A reference to this vector. + */ + setScalar(scalar: number): Vector2; + /** + * Sets the vector's x component to the given value + * + * @param {number} x - The value to set. + * @return {Vector2} A reference to this vector. + */ + setX(x: number): Vector2; + /** + * Sets the vector's y component to the given value + * + * @param {number} y - The value to set. + * @return {Vector2} A reference to this vector. + */ + setY(y: number): Vector2; + /** + * Allows to set a vector component with an index. + * + * @param {number} index - The component index. `0` equals to x, `1` equals to y. + * @param {number} value - The value to set. + * @return {Vector2} A reference to this vector. + */ + setComponent(index: number, value: number): Vector2; + /** + * Returns the value of the vector component which matches the given index. + * + * @param {number} index - The component index. `0` equals to x, `1` equals to y. + * @return {number} A vector component value. + */ + getComponent(index: number): number; + /** + * Returns a new vector with copied values from this instance. + * + * @return {Vector2} A clone of this instance. + */ + clone(): Vector2; + /** + * Copies the values of the given vector to this instance. + * + * @param {Vector2} v - The vector to copy. + * @return {Vector2} A reference to this vector. + */ + copy(v: Vector2): Vector2; + /** + * Adds the given vector to this instance. + * + * @param {Vector2} v - The vector to add. + * @return {Vector2} A reference to this vector. + */ + add(v: Vector2): Vector2; + /** + * Adds the given scalar value to all components of this instance. + * + * @param {number} s - The scalar to add. + * @return {Vector2} A reference to this vector. + */ + addScalar(s: number): Vector2; + /** + * Adds the given vectors and stores the result in this instance. + * + * @param {Vector2} a - The first vector. + * @param {Vector2} b - The second vector. + * @return {Vector2} A reference to this vector. + */ + addVectors(a: Vector2, b: Vector2): Vector2; + /** + * Adds the given vector scaled by the given factor to this instance. + * + * @param {Vector2} v - The vector. + * @param {number} s - The factor that scales `v`. + * @return {Vector2} A reference to this vector. + */ + addScaledVector(v: Vector2, s: number): Vector2; + /** + * Subtracts the given vector from this instance. + * + * @param {Vector2} v - The vector to subtract. + * @return {Vector2} A reference to this vector. + */ + sub(v: Vector2): Vector2; + /** + * Subtracts the given scalar value from all components of this instance. + * + * @param {number} s - The scalar to subtract. + * @return {Vector2} A reference to this vector. + */ + subScalar(s: number): Vector2; + /** + * Subtracts the given vectors and stores the result in this instance. + * + * @param {Vector2} a - The first vector. + * @param {Vector2} b - The second vector. + * @return {Vector2} A reference to this vector. + */ + subVectors(a: Vector2, b: Vector2): Vector2; + /** + * Multiplies the given vector with this instance. + * + * @param {Vector2} v - The vector to multiply. + * @return {Vector2} A reference to this vector. + */ + multiply(v: Vector2): Vector2; + /** + * Multiplies the given scalar value with all components of this instance. + * + * @param {number} scalar - The scalar to multiply. + * @return {Vector2} A reference to this vector. + */ + multiplyScalar(scalar: number): Vector2; + /** + * Divides this instance by the given vector. + * + * @param {Vector2} v - The vector to divide. + * @return {Vector2} A reference to this vector. + */ + divide(v: Vector2): Vector2; + /** + * Divides this vector by the given scalar. + * + * @param {number} scalar - The scalar to divide. + * @return {Vector2} A reference to this vector. + */ + divideScalar(scalar: number): Vector2; + /** + * Multiplies this vector (with an implicit 1 as the 3rd component) by + * the given 3x3 matrix. + * + * @param {Matrix3} m - The matrix to apply. + * @return {Vector2} A reference to this vector. + */ + applyMatrix3(m: Matrix3): Vector2; + /** + * If this vector's x or y value is greater than the given vector's x or y + * value, replace that value with the corresponding min value. + * + * @param {Vector2} v - The vector. + * @return {Vector2} A reference to this vector. + */ + min(v: Vector2): Vector2; + /** + * If this vector's x or y value is less than the given vector's x or y + * value, replace that value with the corresponding max value. + * + * @param {Vector2} v - The vector. + * @return {Vector2} A reference to this vector. + */ + max(v: Vector2): Vector2; + /** + * If this vector's x or y value is greater than the max vector's x or y + * value, it is replaced by the corresponding value. + * If this vector's x or y value is less than the min vector's x or y value, + * it is replaced by the corresponding value. + * + * @param {Vector2} min - The minimum x and y values. + * @param {Vector2} max - The maximum x and y values in the desired range. + * @return {Vector2} A reference to this vector. + */ + clamp(min: Vector2, max: Vector2): Vector2; + /** + * If this vector's x or y values are greater than the max value, they are + * replaced by the max value. + * If this vector's x or y values are less than the min value, they are + * replaced by the min value. + * + * @param {number} minVal - The minimum value the components will be clamped to. + * @param {number} maxVal - The maximum value the components will be clamped to. + * @return {Vector2} A reference to this vector. + */ + clampScalar(minVal: number, maxVal: number): Vector2; + /** + * If this vector's length is greater than the max value, it is replaced by + * the max value. + * If this vector's length is less than the min value, it is replaced by the + * min value. + * + * @param {number} min - The minimum value the vector length will be clamped to. + * @param {number} max - The maximum value the vector length will be clamped to. + * @return {Vector2} A reference to this vector. + */ + clampLength(min: number, max: number): Vector2; + /** + * The components of this vector are rounded down to the nearest integer value. + * + * @return {Vector2} A reference to this vector. + */ + floor(): Vector2; + /** + * The components of this vector are rounded up to the nearest integer value. + * + * @return {Vector2} A reference to this vector. + */ + ceil(): Vector2; + /** + * The components of this vector are rounded to the nearest integer value + * + * @return {Vector2} A reference to this vector. + */ + round(): Vector2; + /** + * The components of this vector are rounded towards zero (up if negative, + * down if positive) to an integer value. + * + * @return {Vector2} A reference to this vector. + */ + roundToZero(): Vector2; + /** + * Inverts this vector - i.e. sets x = -x and y = -y. + * + * @return {Vector2} A reference to this vector. + */ + negate(): Vector2; + /** + * Calculates the dot product of the given vector with this instance. + * + * @param {Vector2} v - The vector to compute the dot product with. + * @return {number} The result of the dot product. + */ + dot(v: Vector2): number; + /** + * Calculates the cross product of the given vector with this instance. + * + * @param {Vector2} v - The vector to compute the cross product with. + * @return {number} The result of the cross product. + */ + cross(v: Vector2): number; + /** + * Computes the square of the Euclidean length (straight-line length) from + * (0, 0) to (x, y). If you are comparing the lengths of vectors, you should + * compare the length squared instead as it is slightly more efficient to calculate. + * + * @return {number} The square length of this vector. + */ + lengthSq(): number; + /** + * Computes the Euclidean length (straight-line length) from (0, 0) to (x, y). + * + * @return {number} The length of this vector. + */ + length(): number; + /** + * Computes the Manhattan length of this vector. + * + * @return {number} The length of this vector. + */ + manhattanLength(): number; + /** + * Converts this vector to a unit vector - that is, sets it equal to a vector + * with the same direction as this one, but with a vector length of `1`. + * + * @return {Vector2} A reference to this vector. + */ + normalize(): Vector2; + /** + * Computes the angle in radians of this vector with respect to the positive x-axis. + * + * @return {number} The angle in radians. + */ + angle(): number; + /** + * Returns the angle between the given vector and this instance in radians. + * + * @param {Vector2} v - The vector to compute the angle with. + * @return {number} The angle in radians. + */ + angleTo(v: Vector2): number; + /** + * Computes the distance from the given vector to this instance. + * + * @param {Vector2} v - The vector to compute the distance to. + * @return {number} The distance. + */ + distanceTo(v: Vector2): number; + /** + * Computes the squared distance from the given vector to this instance. + * If you are just comparing the distance with another distance, you should compare + * the distance squared instead as it is slightly more efficient to calculate. + * + * @param {Vector2} v - The vector to compute the squared distance to. + * @return {number} The squared distance. + */ + distanceToSquared(v: Vector2): number; + /** + * Computes the Manhattan distance from the given vector to this instance. + * + * @param {Vector2} v - The vector to compute the Manhattan distance to. + * @return {number} The Manhattan distance. + */ + manhattanDistanceTo(v: Vector2): number; + /** + * Sets this vector to a vector with the same direction as this one, but + * with the specified length. + * + * @param {number} length - The new length of this vector. + * @return {Vector2} A reference to this vector. + */ + setLength(length: number): Vector2; + /** + * Linearly interpolates between the given vector and this instance, where + * alpha is the percent distance along the line - alpha = 0 will be this + * vector, and alpha = 1 will be the given one. + * + * @param {Vector2} v - The vector to interpolate towards. + * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. + * @return {Vector2} A reference to this vector. + */ + lerp(v: Vector2, alpha: number): Vector2; + /** + * Linearly interpolates between the given vectors, where alpha is the percent + * distance along the line - alpha = 0 will be first vector, and alpha = 1 will + * be the second one. The result is stored in this instance. + * + * @param {Vector2} v1 - The first vector. + * @param {Vector2} v2 - The second vector. + * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. + * @return {Vector2} A reference to this vector. + */ + lerpVectors(v1: Vector2, v2: Vector2, alpha: number): Vector2; + /** + * Returns `true` if this vector is equal with the given one. + * + * @param {Vector2} v - The vector to test for equality. + * @return {boolean} Whether this vector is equal with the given one. + */ + equals(v: Vector2): boolean; + /** + * Sets this vector's x value to be `array[ offset ]` and y + * value to be `array[ offset + 1 ]`. + * + * @param {Array} array - An array holding the vector component values. + * @param {number} [offset=0] - The offset into the array. + * @return {Vector2} A reference to this vector. + */ + fromArray(array: Array, offset?: number): Vector2; + /** + * Writes the components of this vector to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the vector components. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The vector components. + */ + toArray(array?: Array, offset?: number): Array; + /** + * Sets the components of this vector from the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute holding vector data. + * @param {number} index - The index into the attribute. + * @return {Vector2} A reference to this vector. + */ + fromBufferAttribute(attribute: BufferAttribute, index: number): Vector2; + /** + * Rotates this vector around the given center by the given angle. + * + * @param {Vector2} center - The point around which to rotate. + * @param {number} angle - The angle to rotate, in radians. + * @return {Vector2} A reference to this vector. + */ + rotateAround(center: Vector2, angle: number): Vector2; + /** + * Sets each component of this vector to a pseudo-random value between `0` and + * `1`, excluding `1`. + * + * @return {Vector2} A reference to this vector. + */ + random(): Vector2; + [Symbol.iterator](): Generator; +} diff --git a/jsdoc-testing/jsdoc/src/math/Vector3.d.ts b/jsdoc-testing/jsdoc/src/math/Vector3.d.ts new file mode 100644 index 000000000..c102e1d72 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Vector3.d.ts @@ -0,0 +1,613 @@ +/** + * Class representing a 3D vector. A 3D vector is an ordered triplet of numbers + * (labeled x, y and z), which can be used to represent a number of things, such as: + * + * - A point in 3D space. + * - A direction and length in 3D space. In three.js the length will + * always be the Euclidean distance(straight-line distance) from `(0, 0, 0)` to `(x, y, z)` + * and the direction is also measured from `(0, 0, 0)` towards `(x, y, z)`. + * - Any arbitrary ordered triplet of numbers. + * + * There are other things a 3D vector can be used to represent, such as + * momentum vectors and so on, however these are the most + * common uses in three.js. + * + * Iterating through a vector instance will yield its components `(x, y, z)` in + * the corresponding order. + * ```js + * const a = new THREE.Vector3( 0, 1, 0 ); + * + * //no arguments; will be initialised to (0, 0, 0) + * const b = new THREE.Vector3( ); + * + * const d = a.distanceTo( b ); + * ``` + */ +export class Vector3 { + /** + * Constructs a new 3D vector. + * + * @param {number} [x=0] - The x value of this vector. + * @param {number} [y=0] - The y value of this vector. + * @param {number} [z=0] - The z value of this vector. + */ + constructor(x?: number, y?: number, z?: number); + /** + * The x value of this vector. + * + * @type {number} + */ + x: number; + /** + * The y value of this vector. + * + * @type {number} + */ + y: number; + /** + * The z value of this vector. + * + * @type {number} + */ + z: number; + /** + * Sets the vector components. + * + * @param {number} x - The value of the x component. + * @param {number} y - The value of the y component. + * @param {number} z - The value of the z component. + * @return {Vector3} A reference to this vector. + */ + set(x: number, y: number, z: number): Vector3; + /** + * Sets the vector components to the same value. + * + * @param {number} scalar - The value to set for all vector components. + * @return {Vector3} A reference to this vector. + */ + setScalar(scalar: number): Vector3; + /** + * Sets the vector's x component to the given value. + * + * @param {number} x - The value to set. + * @return {Vector3} A reference to this vector. + */ + setX(x: number): Vector3; + /** + * Sets the vector's y component to the given value. + * + * @param {number} y - The value to set. + * @return {Vector3} A reference to this vector. + */ + setY(y: number): Vector3; + /** + * Sets the vector's z component to the given value. + * + * @param {number} z - The value to set. + * @return {Vector3} A reference to this vector. + */ + setZ(z: number): Vector3; + /** + * Allows to set a vector component with an index. + * + * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z. + * @param {number} value - The value to set. + * @return {Vector3} A reference to this vector. + */ + setComponent(index: number, value: number): Vector3; + /** + * Returns the value of the vector component which matches the given index. + * + * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z. + * @return {number} A vector component value. + */ + getComponent(index: number): number; + /** + * Returns a new vector with copied values from this instance. + * + * @return {Vector3} A clone of this instance. + */ + clone(): Vector3; + /** + * Copies the values of the given vector to this instance. + * + * @param {Vector3} v - The vector to copy. + * @return {Vector3} A reference to this vector. + */ + copy(v: Vector3): Vector3; + /** + * Adds the given vector to this instance. + * + * @param {Vector3} v - The vector to add. + * @return {Vector3} A reference to this vector. + */ + add(v: Vector3): Vector3; + /** + * Adds the given scalar value to all components of this instance. + * + * @param {number} s - The scalar to add. + * @return {Vector3} A reference to this vector. + */ + addScalar(s: number): Vector3; + /** + * Adds the given vectors and stores the result in this instance. + * + * @param {Vector3} a - The first vector. + * @param {Vector3} b - The second vector. + * @return {Vector3} A reference to this vector. + */ + addVectors(a: Vector3, b: Vector3): Vector3; + /** + * Adds the given vector scaled by the given factor to this instance. + * + * @param {Vector3|Vector4} v - The vector. + * @param {number} s - The factor that scales `v`. + * @return {Vector3} A reference to this vector. + */ + addScaledVector(v: Vector3 | Vector4, s: number): Vector3; + /** + * Subtracts the given vector from this instance. + * + * @param {Vector3} v - The vector to subtract. + * @return {Vector3} A reference to this vector. + */ + sub(v: Vector3): Vector3; + /** + * Subtracts the given scalar value from all components of this instance. + * + * @param {number} s - The scalar to subtract. + * @return {Vector3} A reference to this vector. + */ + subScalar(s: number): Vector3; + /** + * Subtracts the given vectors and stores the result in this instance. + * + * @param {Vector3} a - The first vector. + * @param {Vector3} b - The second vector. + * @return {Vector3} A reference to this vector. + */ + subVectors(a: Vector3, b: Vector3): Vector3; + /** + * Multiplies the given vector with this instance. + * + * @param {Vector3} v - The vector to multiply. + * @return {Vector3} A reference to this vector. + */ + multiply(v: Vector3): Vector3; + /** + * Multiplies the given scalar value with all components of this instance. + * + * @param {number} scalar - The scalar to multiply. + * @return {Vector3} A reference to this vector. + */ + multiplyScalar(scalar: number): Vector3; + /** + * Multiplies the given vectors and stores the result in this instance. + * + * @param {Vector3} a - The first vector. + * @param {Vector3} b - The second vector. + * @return {Vector3} A reference to this vector. + */ + multiplyVectors(a: Vector3, b: Vector3): Vector3; + /** + * Applies the given Euler rotation to this vector. + * + * @param {Euler} euler - The Euler angles. + * @return {Vector3} A reference to this vector. + */ + applyEuler(euler: Euler): Vector3; + /** + * Applies a rotation specified by an axis and an angle to this vector. + * + * @param {Vector3} axis - A normalized vector representing the rotation axis. + * @param {number} angle - The angle in radians. + * @return {Vector3} A reference to this vector. + */ + applyAxisAngle(axis: Vector3, angle: number): Vector3; + /** + * Multiplies this vector with the given 3x3 matrix. + * + * @param {Matrix3} m - The 3x3 matrix. + * @return {Vector3} A reference to this vector. + */ + applyMatrix3(m: Matrix3): Vector3; + /** + * Multiplies this vector by the given normal matrix and normalizes + * the result. + * + * @param {Matrix3} m - The normal matrix. + * @return {Vector3} A reference to this vector. + */ + applyNormalMatrix(m: Matrix3): Vector3; + /** + * Multiplies this vector (with an implicit 1 in the 4th dimension) by m, and + * divides by perspective. + * + * @param {Matrix4} m - The matrix to apply. + * @return {Vector3} A reference to this vector. + */ + applyMatrix4(m: Matrix4): Vector3; + /** + * Applies the given Quaternion to this vector. + * + * @param {Quaternion} q - The Quaternion. + * @return {Vector3} A reference to this vector. + */ + applyQuaternion(q: Quaternion): Vector3; + /** + * Projects this vector from world space into the camera's normalized + * device coordinate (NDC) space. + * + * @param {Camera} camera - The camera. + * @return {Vector3} A reference to this vector. + */ + project(camera: Camera): Vector3; + /** + * Unprojects this vector from the camera's normalized device coordinate (NDC) + * space into world space. + * + * @param {Camera} camera - The camera. + * @return {Vector3} A reference to this vector. + */ + unproject(camera: Camera): Vector3; + /** + * Transforms this vector by the upper left 3x3 sub-matrix of the given 4x4 matrix, + * and normalizes the result. + * + * @param {Matrix4} m - The matrix. + * @return {Vector3} A reference to this vector. + */ + transformDirection(m: Matrix4): Vector3; + /** + * Divides this instance by the given vector. + * + * @param {Vector3} v - The vector to divide. + * @return {Vector3} A reference to this vector. + */ + divide(v: Vector3): Vector3; + /** + * Divides this vector by the given scalar. + * + * @param {number} scalar - The scalar to divide. + * @return {Vector3} A reference to this vector. + */ + divideScalar(scalar: number): Vector3; + /** + * If this vector's x, y or z value is greater than the given vector's x, y or z + * value, replace that value with the corresponding min value. + * + * @param {Vector3} v - The vector. + * @return {Vector3} A reference to this vector. + */ + min(v: Vector3): Vector3; + /** + * If this vector's x, y or z value is less than the given vector's x, y or z + * value, replace that value with the corresponding max value. + * + * @param {Vector3} v - The vector. + * @return {Vector3} A reference to this vector. + */ + max(v: Vector3): Vector3; + /** + * If this vector's x, y or z value is greater than the max vector's x, y or z + * value, it is replaced by the corresponding value. + * If this vector's x, y or z value is less than the min vector's x, y or z value, + * it is replaced by the corresponding value. + * + * @param {Vector3} min - The minimum x, y and z values. + * @param {Vector3} max - The maximum x, y and z values in the desired range. + * @return {Vector3} A reference to this vector. + */ + clamp(min: Vector3, max: Vector3): Vector3; + /** + * If this vector's x, y or z values are greater than the max value, they are + * replaced by the max value. + * If this vector's x, y or z values are less than the min value, they are + * replaced by the min value. + * + * @param {number} minVal - The minimum value the components will be clamped to. + * @param {number} maxVal - The maximum value the components will be clamped to. + * @return {Vector3} A reference to this vector. + */ + clampScalar(minVal: number, maxVal: number): Vector3; + /** + * If this vector's length is greater than the max value, it is replaced by + * the max value. + * If this vector's length is less than the min value, it is replaced by the + * min value. + * + * @param {number} min - The minimum value the vector length will be clamped to. + * @param {number} max - The maximum value the vector length will be clamped to. + * @return {Vector3} A reference to this vector. + */ + clampLength(min: number, max: number): Vector3; + /** + * The components of this vector are rounded down to the nearest integer value. + * + * @return {Vector3} A reference to this vector. + */ + floor(): Vector3; + /** + * The components of this vector are rounded up to the nearest integer value. + * + * @return {Vector3} A reference to this vector. + */ + ceil(): Vector3; + /** + * The components of this vector are rounded to the nearest integer value + * + * @return {Vector3} A reference to this vector. + */ + round(): Vector3; + /** + * The components of this vector are rounded towards zero (up if negative, + * down if positive) to an integer value. + * + * @return {Vector3} A reference to this vector. + */ + roundToZero(): Vector3; + /** + * Inverts this vector - i.e. sets x = -x, y = -y and z = -z. + * + * @return {Vector3} A reference to this vector. + */ + negate(): Vector3; + /** + * Calculates the dot product of the given vector with this instance. + * + * @param {Vector3} v - The vector to compute the dot product with. + * @return {number} The result of the dot product. + */ + dot(v: Vector3): number; + /** + * Computes the square of the Euclidean length (straight-line length) from + * (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should + * compare the length squared instead as it is slightly more efficient to calculate. + * + * @return {number} The square length of this vector. + */ + lengthSq(): number; + /** + * Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z). + * + * @return {number} The length of this vector. + */ + length(): number; + /** + * Computes the Manhattan length of this vector. + * + * @return {number} The length of this vector. + */ + manhattanLength(): number; + /** + * Converts this vector to a unit vector - that is, sets it equal to a vector + * with the same direction as this one, but with a vector length of `1`. + * + * @return {Vector3} A reference to this vector. + */ + normalize(): Vector3; + /** + * Sets this vector to a vector with the same direction as this one, but + * with the specified length. + * + * @param {number} length - The new length of this vector. + * @return {Vector3} A reference to this vector. + */ + setLength(length: number): Vector3; + /** + * Linearly interpolates between the given vector and this instance, where + * alpha is the percent distance along the line - alpha = 0 will be this + * vector, and alpha = 1 will be the given one. + * + * @param {Vector3} v - The vector to interpolate towards. + * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. + * @return {Vector3} A reference to this vector. + */ + lerp(v: Vector3, alpha: number): Vector3; + /** + * Linearly interpolates between the given vectors, where alpha is the percent + * distance along the line - alpha = 0 will be first vector, and alpha = 1 will + * be the second one. The result is stored in this instance. + * + * @param {Vector3} v1 - The first vector. + * @param {Vector3} v2 - The second vector. + * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. + * @return {Vector3} A reference to this vector. + */ + lerpVectors(v1: Vector3, v2: Vector3, alpha: number): Vector3; + /** + * Calculates the cross product of the given vector with this instance. + * + * @param {Vector3} v - The vector to compute the cross product with. + * @return {Vector3} The result of the cross product. + */ + cross(v: Vector3): Vector3; + /** + * Calculates the cross product of the given vectors and stores the result + * in this instance. + * + * @param {Vector3} a - The first vector. + * @param {Vector3} b - The second vector. + * @return {Vector3} A reference to this vector. + */ + crossVectors(a: Vector3, b: Vector3): Vector3; + /** + * Projects this vector onto the given one. + * + * @param {Vector3} v - The vector to project to. + * @return {Vector3} A reference to this vector. + */ + projectOnVector(v: Vector3): Vector3; + /** + * Projects this vector onto a plane by subtracting this + * vector projected onto the plane's normal from this vector. + * + * @param {Vector3} planeNormal - The plane normal. + * @return {Vector3} A reference to this vector. + */ + projectOnPlane(planeNormal: Vector3): Vector3; + /** + * Reflects this vector off a plane orthogonal to the given normal vector. + * + * @param {Vector3} normal - The (normalized) normal vector. + * @return {Vector3} A reference to this vector. + */ + reflect(normal: Vector3): Vector3; + /** + * Returns the angle between the given vector and this instance in radians. + * + * @param {Vector3} v - The vector to compute the angle with. + * @return {number} The angle in radians. + */ + angleTo(v: Vector3): number; + /** + * Computes the distance from the given vector to this instance. + * + * @param {Vector3} v - The vector to compute the distance to. + * @return {number} The distance. + */ + distanceTo(v: Vector3): number; + /** + * Computes the squared distance from the given vector to this instance. + * If you are just comparing the distance with another distance, you should compare + * the distance squared instead as it is slightly more efficient to calculate. + * + * @param {Vector3} v - The vector to compute the squared distance to. + * @return {number} The squared distance. + */ + distanceToSquared(v: Vector3): number; + /** + * Computes the Manhattan distance from the given vector to this instance. + * + * @param {Vector3} v - The vector to compute the Manhattan distance to. + * @return {number} The Manhattan distance. + */ + manhattanDistanceTo(v: Vector3): number; + /** + * Sets the vector components from the given spherical coordinates. + * + * @param {Spherical} s - The spherical coordinates. + * @return {Vector3} A reference to this vector. + */ + setFromSpherical(s: Spherical): Vector3; + /** + * Sets the vector components from the given spherical coordinates. + * + * @param {number} radius - The radius. + * @param {number} phi - The phi angle in radians. + * @param {number} theta - The theta angle in radians. + * @return {Vector3} A reference to this vector. + */ + setFromSphericalCoords(radius: number, phi: number, theta: number): Vector3; + /** + * Sets the vector components from the given cylindrical coordinates. + * + * @param {Cylindrical} c - The cylindrical coordinates. + * @return {Vector3} A reference to this vector. + */ + setFromCylindrical(c: Cylindrical): Vector3; + /** + * Sets the vector components from the given cylindrical coordinates. + * + * @param {number} radius - The radius. + * @param {number} theta - The theta angle in radians. + * @param {number} y - The y value. + * @return {Vector3} A reference to this vector. + */ + setFromCylindricalCoords(radius: number, theta: number, y: number): Vector3; + /** + * Sets the vector components to the position elements of the + * given transformation matrix. + * + * @param {Matrix4} m - The 4x4 matrix. + * @return {Vector3} A reference to this vector. + */ + setFromMatrixPosition(m: Matrix4): Vector3; + /** + * Sets the vector components to the scale elements of the + * given transformation matrix. + * + * @param {Matrix4} m - The 4x4 matrix. + * @return {Vector3} A reference to this vector. + */ + setFromMatrixScale(m: Matrix4): Vector3; + /** + * Sets the vector components from the specified matrix column. + * + * @param {Matrix4} m - The 4x4 matrix. + * @param {number} index - The column index. + * @return {Vector3} A reference to this vector. + */ + setFromMatrixColumn(m: Matrix4, index: number): Vector3; + /** + * Sets the vector components from the specified matrix column. + * + * @param {Matrix3} m - The 3x3 matrix. + * @param {number} index - The column index. + * @return {Vector3} A reference to this vector. + */ + setFromMatrix3Column(m: Matrix3, index: number): Vector3; + /** + * Sets the vector components from the given Euler angles. + * + * @param {Euler} e - The Euler angles to set. + * @return {Vector3} A reference to this vector. + */ + setFromEuler(e: Euler): Vector3; + /** + * Sets the vector components from the RGB components of the + * given color. + * + * @param {Color} c - The color to set. + * @return {Vector3} A reference to this vector. + */ + setFromColor(c: Color): Vector3; + /** + * Returns `true` if this vector is equal with the given one. + * + * @param {Vector3} v - The vector to test for equality. + * @return {boolean} Whether this vector is equal with the given one. + */ + equals(v: Vector3): boolean; + /** + * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]` + * and z value to be `array[ offset + 2 ]`. + * + * @param {Array} array - An array holding the vector component values. + * @param {number} [offset=0] - The offset into the array. + * @return {Vector3} A reference to this vector. + */ + fromArray(array: Array, offset?: number): Vector3; + /** + * Writes the components of this vector to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the vector components. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The vector components. + */ + toArray(array?: Array, offset?: number): Array; + /** + * Sets the components of this vector from the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute holding vector data. + * @param {number} index - The index into the attribute. + * @return {Vector3} A reference to this vector. + */ + fromBufferAttribute(attribute: BufferAttribute, index: number): Vector3; + /** + * Sets each component of this vector to a pseudo-random value between `0` and + * `1`, excluding `1`. + * + * @return {Vector3} A reference to this vector. + */ + random(): Vector3; + /** + * Sets this vector to a uniformly random point on a unit sphere. + * + * @return {Vector3} A reference to this vector. + */ + randomDirection(): Vector3; + [Symbol.iterator](): Generator; +} +import { Quaternion } from './Quaternion.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Vector4.d.ts b/jsdoc-testing/jsdoc/src/math/Vector4.d.ts new file mode 100644 index 000000000..2360be77d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/Vector4.d.ts @@ -0,0 +1,443 @@ +/** + * Class representing a 4D vector. A 4D vector is an ordered quadruplet of numbers + * (labeled x, y, z and w), which can be used to represent a number of things, such as: + * + * - A point in 4D space. + * - A direction and length in 4D space. In three.js the length will + * always be the Euclidean distance(straight-line distance) from `(0, 0, 0, 0)` to `(x, y, z, w)` + * and the direction is also measured from `(0, 0, 0, 0)` towards `(x, y, z, w)`. + * - Any arbitrary ordered quadruplet of numbers. + * + * There are other things a 4D vector can be used to represent, however these + * are the most common uses in *three.js*. + * + * Iterating through a vector instance will yield its components `(x, y, z, w)` in + * the corresponding order. + * ```js + * const a = new THREE.Vector4( 0, 1, 0, 0 ); + * + * //no arguments; will be initialised to (0, 0, 0, 1) + * const b = new THREE.Vector4( ); + * + * const d = a.dot( b ); + * ``` + */ +export class Vector4 { + /** + * Constructs a new 4D vector. + * + * @param {number} [x=0] - The x value of this vector. + * @param {number} [y=0] - The y value of this vector. + * @param {number} [z=0] - The z value of this vector. + * @param {number} [w=1] - The w value of this vector. + */ + constructor(x?: number, y?: number, z?: number, w?: number); + /** + * The x value of this vector. + * + * @type {number} + */ + x: number; + /** + * The y value of this vector. + * + * @type {number} + */ + y: number; + /** + * The z value of this vector. + * + * @type {number} + */ + z: number; + /** + * The w value of this vector. + * + * @type {number} + */ + w: number; + set width(value: number); + /** + * Alias for {@link Vector4#z}. + * + * @type {number} + */ + get width(): number; + set height(value: number); + /** + * Alias for {@link Vector4#w}. + * + * @type {number} + */ + get height(): number; + /** + * Sets the vector components. + * + * @param {number} x - The value of the x component. + * @param {number} y - The value of the y component. + * @param {number} z - The value of the z component. + * @param {number} w - The value of the w component. + * @return {Vector4} A reference to this vector. + */ + set(x: number, y: number, z: number, w: number): Vector4; + /** + * Sets the vector components to the same value. + * + * @param {number} scalar - The value to set for all vector components. + * @return {Vector4} A reference to this vector. + */ + setScalar(scalar: number): Vector4; + /** + * Sets the vector's x component to the given value + * + * @param {number} x - The value to set. + * @return {Vector4} A reference to this vector. + */ + setX(x: number): Vector4; + /** + * Sets the vector's y component to the given value + * + * @param {number} y - The value to set. + * @return {Vector4} A reference to this vector. + */ + setY(y: number): Vector4; + /** + * Sets the vector's z component to the given value + * + * @param {number} z - The value to set. + * @return {Vector4} A reference to this vector. + */ + setZ(z: number): Vector4; + /** + * Sets the vector's w component to the given value + * + * @param {number} w - The value to set. + * @return {Vector4} A reference to this vector. + */ + setW(w: number): Vector4; + /** + * Allows to set a vector component with an index. + * + * @param {number} index - The component index. `0` equals to x, `1` equals to y, + * `2` equals to z, `3` equals to w. + * @param {number} value - The value to set. + * @return {Vector4} A reference to this vector. + */ + setComponent(index: number, value: number): Vector4; + /** + * Returns the value of the vector component which matches the given index. + * + * @param {number} index - The component index. `0` equals to x, `1` equals to y, + * `2` equals to z, `3` equals to w. + * @return {number} A vector component value. + */ + getComponent(index: number): number; + /** + * Returns a new vector with copied values from this instance. + * + * @return {Vector4} A clone of this instance. + */ + clone(): Vector4; + /** + * Copies the values of the given vector to this instance. + * + * @param {Vector3|Vector4} v - The vector to copy. + * @return {Vector4} A reference to this vector. + */ + copy(v: Vector3 | Vector4): Vector4; + /** + * Adds the given vector to this instance. + * + * @param {Vector4} v - The vector to add. + * @return {Vector4} A reference to this vector. + */ + add(v: Vector4): Vector4; + /** + * Adds the given scalar value to all components of this instance. + * + * @param {number} s - The scalar to add. + * @return {Vector4} A reference to this vector. + */ + addScalar(s: number): Vector4; + /** + * Adds the given vectors and stores the result in this instance. + * + * @param {Vector4} a - The first vector. + * @param {Vector4} b - The second vector. + * @return {Vector4} A reference to this vector. + */ + addVectors(a: Vector4, b: Vector4): Vector4; + /** + * Adds the given vector scaled by the given factor to this instance. + * + * @param {Vector4} v - The vector. + * @param {number} s - The factor that scales `v`. + * @return {Vector4} A reference to this vector. + */ + addScaledVector(v: Vector4, s: number): Vector4; + /** + * Subtracts the given vector from this instance. + * + * @param {Vector4} v - The vector to subtract. + * @return {Vector4} A reference to this vector. + */ + sub(v: Vector4): Vector4; + /** + * Subtracts the given scalar value from all components of this instance. + * + * @param {number} s - The scalar to subtract. + * @return {Vector4} A reference to this vector. + */ + subScalar(s: number): Vector4; + /** + * Subtracts the given vectors and stores the result in this instance. + * + * @param {Vector4} a - The first vector. + * @param {Vector4} b - The second vector. + * @return {Vector4} A reference to this vector. + */ + subVectors(a: Vector4, b: Vector4): Vector4; + /** + * Multiplies the given vector with this instance. + * + * @param {Vector4} v - The vector to multiply. + * @return {Vector4} A reference to this vector. + */ + multiply(v: Vector4): Vector4; + /** + * Multiplies the given scalar value with all components of this instance. + * + * @param {number} scalar - The scalar to multiply. + * @return {Vector4} A reference to this vector. + */ + multiplyScalar(scalar: number): Vector4; + /** + * Multiplies this vector with the given 4x4 matrix. + * + * @param {Matrix4} m - The 4x4 matrix. + * @return {Vector4} A reference to this vector. + */ + applyMatrix4(m: Matrix4): Vector4; + /** + * Divides this instance by the given vector. + * + * @param {Vector4} v - The vector to divide. + * @return {Vector4} A reference to this vector. + */ + divide(v: Vector4): Vector4; + /** + * Divides this vector by the given scalar. + * + * @param {number} scalar - The scalar to divide. + * @return {Vector4} A reference to this vector. + */ + divideScalar(scalar: number): Vector4; + /** + * Sets the x, y and z components of this + * vector to the quaternion's axis and w to the angle. + * + * @param {Quaternion} q - The Quaternion to set. + * @return {Vector4} A reference to this vector. + */ + setAxisAngleFromQuaternion(q: Quaternion): Vector4; + /** + * Sets the x, y and z components of this + * vector to the axis of rotation and w to the angle. + * + * @param {Matrix4} m - A 4x4 matrix of which the upper left 3x3 matrix is a pure rotation matrix. + * @return {Vector4} A reference to this vector. + */ + setAxisAngleFromRotationMatrix(m: Matrix4): Vector4; + /** + * Sets the vector components to the position elements of the + * given transformation matrix. + * + * @param {Matrix4} m - The 4x4 matrix. + * @return {Vector4} A reference to this vector. + */ + setFromMatrixPosition(m: Matrix4): Vector4; + /** + * If this vector's x, y, z or w value is greater than the given vector's x, y, z or w + * value, replace that value with the corresponding min value. + * + * @param {Vector4} v - The vector. + * @return {Vector4} A reference to this vector. + */ + min(v: Vector4): Vector4; + /** + * If this vector's x, y, z or w value is less than the given vector's x, y, z or w + * value, replace that value with the corresponding max value. + * + * @param {Vector4} v - The vector. + * @return {Vector4} A reference to this vector. + */ + max(v: Vector4): Vector4; + /** + * If this vector's x, y, z or w value is greater than the max vector's x, y, z or w + * value, it is replaced by the corresponding value. + * If this vector's x, y, z or w value is less than the min vector's x, y, z or w value, + * it is replaced by the corresponding value. + * + * @param {Vector4} min - The minimum x, y and z values. + * @param {Vector4} max - The maximum x, y and z values in the desired range. + * @return {Vector4} A reference to this vector. + */ + clamp(min: Vector4, max: Vector4): Vector4; + /** + * If this vector's x, y, z or w values are greater than the max value, they are + * replaced by the max value. + * If this vector's x, y, z or w values are less than the min value, they are + * replaced by the min value. + * + * @param {number} minVal - The minimum value the components will be clamped to. + * @param {number} maxVal - The maximum value the components will be clamped to. + * @return {Vector4} A reference to this vector. + */ + clampScalar(minVal: number, maxVal: number): Vector4; + /** + * If this vector's length is greater than the max value, it is replaced by + * the max value. + * If this vector's length is less than the min value, it is replaced by the + * min value. + * + * @param {number} min - The minimum value the vector length will be clamped to. + * @param {number} max - The maximum value the vector length will be clamped to. + * @return {Vector4} A reference to this vector. + */ + clampLength(min: number, max: number): Vector4; + /** + * The components of this vector are rounded down to the nearest integer value. + * + * @return {Vector4} A reference to this vector. + */ + floor(): Vector4; + /** + * The components of this vector are rounded up to the nearest integer value. + * + * @return {Vector4} A reference to this vector. + */ + ceil(): Vector4; + /** + * The components of this vector are rounded to the nearest integer value + * + * @return {Vector4} A reference to this vector. + */ + round(): Vector4; + /** + * The components of this vector are rounded towards zero (up if negative, + * down if positive) to an integer value. + * + * @return {Vector4} A reference to this vector. + */ + roundToZero(): Vector4; + /** + * Inverts this vector - i.e. sets x = -x, y = -y, z = -z, w = -w. + * + * @return {Vector4} A reference to this vector. + */ + negate(): Vector4; + /** + * Calculates the dot product of the given vector with this instance. + * + * @param {Vector4} v - The vector to compute the dot product with. + * @return {number} The result of the dot product. + */ + dot(v: Vector4): number; + /** + * Computes the square of the Euclidean length (straight-line length) from + * (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should + * compare the length squared instead as it is slightly more efficient to calculate. + * + * @return {number} The square length of this vector. + */ + lengthSq(): number; + /** + * Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w). + * + * @return {number} The length of this vector. + */ + length(): number; + /** + * Computes the Manhattan length of this vector. + * + * @return {number} The length of this vector. + */ + manhattanLength(): number; + /** + * Converts this vector to a unit vector - that is, sets it equal to a vector + * with the same direction as this one, but with a vector length of `1`. + * + * @return {Vector4} A reference to this vector. + */ + normalize(): Vector4; + /** + * Sets this vector to a vector with the same direction as this one, but + * with the specified length. + * + * @param {number} length - The new length of this vector. + * @return {Vector4} A reference to this vector. + */ + setLength(length: number): Vector4; + /** + * Linearly interpolates between the given vector and this instance, where + * alpha is the percent distance along the line - alpha = 0 will be this + * vector, and alpha = 1 will be the given one. + * + * @param {Vector4} v - The vector to interpolate towards. + * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. + * @return {Vector4} A reference to this vector. + */ + lerp(v: Vector4, alpha: number): Vector4; + /** + * Linearly interpolates between the given vectors, where alpha is the percent + * distance along the line - alpha = 0 will be first vector, and alpha = 1 will + * be the second one. The result is stored in this instance. + * + * @param {Vector4} v1 - The first vector. + * @param {Vector4} v2 - The second vector. + * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. + * @return {Vector4} A reference to this vector. + */ + lerpVectors(v1: Vector4, v2: Vector4, alpha: number): Vector4; + /** + * Returns `true` if this vector is equal with the given one. + * + * @param {Vector4} v - The vector to test for equality. + * @return {boolean} Whether this vector is equal with the given one. + */ + equals(v: Vector4): boolean; + /** + * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`, + * z value to be `array[ offset + 2 ]`, w value to be `array[ offset + 3 ]`. + * + * @param {Array} array - An array holding the vector component values. + * @param {number} [offset=0] - The offset into the array. + * @return {Vector4} A reference to this vector. + */ + fromArray(array: Array, offset?: number): Vector4; + /** + * Writes the components of this vector to the given array. If no array is provided, + * the method returns a new instance. + * + * @param {Array} [array=[]] - The target array holding the vector components. + * @param {number} [offset=0] - Index of the first element in the array. + * @return {Array} The vector components. + */ + toArray(array?: Array, offset?: number): Array; + /** + * Sets the components of this vector from the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute holding vector data. + * @param {number} index - The index into the attribute. + * @return {Vector4} A reference to this vector. + */ + fromBufferAttribute(attribute: BufferAttribute, index: number): Vector4; + /** + * Sets each component of this vector to a pseudo-random value between `0` and + * `1`, excluding `1`. + * + * @return {Vector4} A reference to this vector. + */ + random(): Vector4; + [Symbol.iterator](): Generator; +} diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts new file mode 100644 index 000000000..a3d1715dc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts @@ -0,0 +1,21 @@ +/** + * A Bezier interpolant using cubic Bezier curves with 2D control points. + * + * This interpolant supports the COLLADA/Maya style of Bezier animation where + * each keyframe has explicit in/out tangent control points specified as + * 2D coordinates (time, value). + * + * Tangent data is read from `inTangents` and `outTangents` on the interpolant + * (populated by `KeyframeTrack.InterpolantFactoryMethodBezier`). + * + * For a track with N keyframes and stride S: + * - Each tangent array has N * S * 2 values + * - Layout: [k0_c0_time, k0_c0_value, k0_c1_time, k0_c1_value, ..., k0_cS_time, k0_cS_value, + * k1_c0_time, k1_c0_value, ...] + * + * @augments Interpolant + */ +export class BezierInterpolant extends Interpolant { + interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; +} +import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts new file mode 100644 index 000000000..ca53c5e9a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts @@ -0,0 +1,22 @@ +/** + * Fast and simple cubic spline interpolant. + * + * It was derived from a Hermitian construction setting the first derivative + * at each sample position to the linear slope between neighboring positions + * over their parameter interval. + * + * @augments Interpolant + */ +export class CubicInterpolant extends Interpolant { + _weightPrev: number; + _offsetPrev: number; + _weightNext: number; + _offsetNext: number; + DefaultSettings_: { + endingStart: number; + endingEnd: number; + }; + intervalChanged_(i1: any, t0: any, t1: any): void; + interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; +} +import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts new file mode 100644 index 000000000..04ce01eb6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts @@ -0,0 +1,10 @@ +/** + * Interpolant that evaluates to the sample value at the position preceding + * the parameter. + * + * @augments Interpolant + */ +export class DiscreteInterpolant extends Interpolant { + interpolate_(i1: any): TypedArray; +} +import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts new file mode 100644 index 000000000..d36003868 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts @@ -0,0 +1,9 @@ +/** + * A basic linear interpolant. + * + * @augments Interpolant + */ +export class LinearInterpolant extends Interpolant { + interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; +} +import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts new file mode 100644 index 000000000..e8ddddc6e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts @@ -0,0 +1,9 @@ +/** + * Spherical linear unit quaternion interpolant. + * + * @augments Interpolant + */ +export class QuaternionLinearInterpolant extends Interpolant { + interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; +} +import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts b/jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts new file mode 100644 index 000000000..8712dab21 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts @@ -0,0 +1,138 @@ +export * from "./core/constants.js"; +export { default as ArrayNode } from "./core/ArrayNode.js"; +export { default as AssignNode } from "./core/AssignNode.js"; +export { default as AttributeNode } from "./core/AttributeNode.js"; +export { default as BypassNode } from "./core/BypassNode.js"; +export { default as ConstNode } from "./core/ConstNode.js"; +export { default as ContextNode } from "./core/ContextNode.js"; +export { default as IndexNode } from "./core/IndexNode.js"; +export { default as InputNode } from "./core/InputNode.js"; +export { default as InspectorNode } from "./core/InspectorNode.js"; +export { default as IsolateNode } from "./core/IsolateNode.js"; +export { default as LightingModel } from "./core/LightingModel.js"; +export { default as MRTNode } from "./core/MRTNode.js"; +export { default as Node } from "./core/Node.js"; +export { default as NodeAttribute } from "./core/NodeAttribute.js"; +export { default as NodeBuilder } from "./core/NodeBuilder.js"; +export { default as NodeCache } from "./core/NodeCache.js"; +export { default as NodeCode } from "./core/NodeCode.js"; +export { default as NodeError } from "./core/NodeError.js"; +export { default as NodeFrame } from "./core/NodeFrame.js"; +export { default as NodeFunctionInput } from "./core/NodeFunctionInput.js"; +export { default as NodeUniform } from "./core/NodeUniform.js"; +export { default as NodeVar } from "./core/NodeVar.js"; +export { default as NodeVarying } from "./core/NodeVarying.js"; +export { default as OutputStructNode } from "./core/OutputStructNode.js"; +export { default as OverrideContextNode } from "./core/OverrideContextNode.js"; +export { default as ParameterNode } from "./core/ParameterNode.js"; +export { default as PropertyNode } from "./core/PropertyNode.js"; +export { default as StackNode } from "./core/StackNode.js"; +export { default as StackTrace } from "./core/StackTrace.js"; +export { default as StructNode } from "./core/StructNode.js"; +export { default as StructTypeNode } from "./core/StructTypeNode.js"; +export { default as SubBuildNode } from "./core/SubBuildNode.js"; +export { default as TempNode } from "./core/TempNode.js"; +export { default as UniformGroupNode } from "./core/UniformGroupNode.js"; +export { default as UniformNode } from "./core/UniformNode.js"; +export { default as VarNode } from "./core/VarNode.js"; +export { default as VaryingNode } from "./core/VaryingNode.js"; +export { NodeUtils }; +export { default as BufferAttributeNode } from "./accessors/BufferAttributeNode.js"; +export { default as BufferNode } from "./accessors/BufferNode.js"; +export { default as BuiltinNode } from "./accessors/BuiltinNode.js"; +export { default as ClippingNode } from "./accessors/ClippingNode.js"; +export { default as CubeTextureNode } from "./accessors/CubeTextureNode.js"; +export { default as MaterialNode } from "./accessors/MaterialNode.js"; +export { default as MaterialReferenceNode } from "./accessors/MaterialReferenceNode.js"; +export { default as ModelNode } from "./accessors/ModelNode.js"; +export { default as Object3DNode } from "./accessors/Object3DNode.js"; +export { default as PointUVNode } from "./accessors/PointUVNode.js"; +export { default as ReferenceBaseNode } from "./accessors/ReferenceBaseNode.js"; +export { default as ReferenceElementNode } from "./accessors/ReferenceElementNode.js"; +export { default as ReferenceNode } from "./accessors/ReferenceNode.js"; +export { default as RendererReferenceNode } from "./accessors/RendererReferenceNode.js"; +export { default as StorageBufferNode } from "./accessors/StorageBufferNode.js"; +export { default as StorageTexture3DNode } from "./accessors/StorageTexture3DNode.js"; +export { default as StorageTextureNode } from "./accessors/StorageTextureNode.js"; +export { default as Texture3DNode } from "./accessors/Texture3DNode.js"; +export { default as TextureNode } from "./accessors/TextureNode.js"; +export { default as TextureSizeNode } from "./accessors/TextureSizeNode.js"; +export { default as UniformArrayNode } from "./accessors/UniformArrayNode.js"; +export { default as UserDataNode } from "./accessors/UserDataNode.js"; +export { default as VelocityNode } from "./accessors/VelocityNode.js"; +export { default as VertexColorNode } from "./accessors/VertexColorNode.js"; +export { default as CodeNode } from "./code/CodeNode.js"; +export { default as ExpressionNode } from "./code/ExpressionNode.js"; +export { default as FunctionCallNode } from "./code/FunctionCallNode.js"; +export { default as FunctionNode } from "./code/FunctionNode.js"; +export { default as BumpMapNode } from "./display/BumpMapNode.js"; +export { default as ColorSpaceNode } from "./display/ColorSpaceNode.js"; +export { default as FrontFacingNode } from "./display/FrontFacingNode.js"; +export { default as NormalMapNode } from "./display/NormalMapNode.js"; +export { default as PassNode } from "./display/PassNode.js"; +export { default as RenderOutputNode } from "./display/RenderOutputNode.js"; +export { default as ScreenNode } from "./display/ScreenNode.js"; +export { default as ToneMappingNode } from "./display/ToneMappingNode.js"; +export { default as ToonOutlinePassNode } from "./display/ToonOutlinePassNode.js"; +export { default as ViewportDepthNode } from "./display/ViewportDepthNode.js"; +export { default as ViewportDepthTextureNode } from "./display/ViewportDepthTextureNode.js"; +export { default as ViewportSharedTextureNode } from "./display/ViewportSharedTextureNode.js"; +export { default as ViewportTextureNode } from "./display/ViewportTextureNode.js"; +export { default as RangeNode } from "./geometry/RangeNode.js"; +export { default as AtomicFunctionNode } from "./gpgpu/AtomicFunctionNode.js"; +export { default as BarrierNode } from "./gpgpu/BarrierNode.js"; +export { default as ComputeBuiltinNode } from "./gpgpu/ComputeBuiltinNode.js"; +export { default as ComputeNode } from "./gpgpu/ComputeNode.js"; +export { default as SubgroupFunctionNode } from "./gpgpu/SubgroupFunctionNode.js"; +export { default as WorkgroupInfoNode } from "./gpgpu/WorkgroupInfoNode.js"; +export { default as AmbientLightNode } from "./lighting/AmbientLightNode.js"; +export { default as AnalyticLightNode } from "./lighting/AnalyticLightNode.js"; +export { default as AONode } from "./lighting/AONode.js"; +export { default as BasicEnvironmentNode } from "./lighting/BasicEnvironmentNode.js"; +export { default as BasicLightMapNode } from "./lighting/BasicLightMapNode.js"; +export { default as DirectionalLightNode } from "./lighting/DirectionalLightNode.js"; +export { default as EnvironmentNode } from "./lighting/EnvironmentNode.js"; +export { default as HemisphereLightNode } from "./lighting/HemisphereLightNode.js"; +export { default as IESSpotLightNode } from "./lighting/IESSpotLightNode.js"; +export { default as IrradianceNode } from "./lighting/IrradianceNode.js"; +export { default as LightingContextNode } from "./lighting/LightingContextNode.js"; +export { default as LightingNode } from "./lighting/LightingNode.js"; +export { default as LightProbeNode } from "./lighting/LightProbeNode.js"; +export { default as LightsNode } from "./lighting/LightsNode.js"; +export { default as PointLightNode } from "./lighting/PointLightNode.js"; +export { default as PointShadowNode } from "./lighting/PointShadowNode.js"; +export { default as ProjectorLightNode } from "./lighting/ProjectorLightNode.js"; +export { default as RectAreaLightNode } from "./lighting/RectAreaLightNode.js"; +export { default as ShadowBaseNode } from "./lighting/ShadowBaseNode.js"; +export { default as ShadowNode } from "./lighting/ShadowNode.js"; +export { default as SpotLightNode } from "./lighting/SpotLightNode.js"; +export { default as BitcastNode } from "./math/BitcastNode.js"; +export { default as BitcountNode } from "./math/BitcountNode.js"; +export { default as ConditionalNode } from "./math/ConditionalNode.js"; +export { default as MathNode } from "./math/MathNode.js"; +export { default as OperatorNode } from "./math/OperatorNode.js"; +export { default as PackFloatNode } from "./math/PackFloatNode.js"; +export { default as UnpackFloatNode } from "./math/UnpackFloatNode.js"; +export { default as GLSLNodeParser } from "./parsers/GLSLNodeParser.js"; +export { default as PMREMNode } from "./pmrem/PMREMNode.js"; +export { default as ArrayElementNode } from "./utils/ArrayElementNode.js"; +export { default as ConvertNode } from "./utils/ConvertNode.js"; +export { default as CubeMapNode } from "./utils/CubeMapNode.js"; +export { default as DebugNode } from "./utils/DebugNode.js"; +export { default as EventNode } from "./utils/EventNode.js"; +export { default as FlipNode } from "./utils/FlipNode.js"; +export { default as FunctionOverloadingNode } from "./utils/FunctionOverloadingNode.js"; +export { default as JoinNode } from "./utils/JoinNode.js"; +export { default as LoopNode } from "./utils/LoopNode.js"; +export { default as MaxMipLevelNode } from "./utils/MaxMipLevelNode.js"; +export { default as MemberNode } from "./utils/MemberNode.js"; +export { default as ReflectorNode } from "./utils/ReflectorNode.js"; +export { default as RotateNode } from "./utils/RotateNode.js"; +export { default as RTTNode } from "./utils/RTTNode.js"; +export { default as SampleNode } from "./utils/SampleNode.js"; +export { default as SetNode } from "./utils/SetNode.js"; +export { default as SplitNode } from "./utils/SplitNode.js"; +export { default as StorageArrayElementNode } from "./utils/StorageArrayElementNode.js"; +export { default as PhongLightingModel } from "./functions/PhongLightingModel.js"; +export { default as PhysicalLightingModel } from "./functions/PhysicalLightingModel.js"; +import * as NodeUtils from './core/NodeUtils.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/TSL.d.ts b/jsdoc-testing/jsdoc/src/nodes/TSL.d.ts new file mode 100644 index 000000000..9e37c77eb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/TSL.d.ts @@ -0,0 +1,144 @@ +export * from "./core/constants.js"; +export * from "./core/AssignNode.js"; +export * from "./core/AttributeNode.js"; +export * from "./core/BypassNode.js"; +export * from "./core/IsolateNode.js"; +export * from "./core/ContextNode.js"; +export * from "./core/OverrideContextNode.js"; +export * from "./core/IndexNode.js"; +export * from "./core/ParameterNode.js"; +export * from "./core/PropertyNode.js"; +export * from "./core/StackNode.js"; +export * from "./core/StructNode.js"; +export * from "./core/UniformGroupNode.js"; +export * from "./core/UniformNode.js"; +export * from "./core/VaryingNode.js"; +export * from "./core/OutputStructNode.js"; +export * from "./core/MRTNode.js"; +export * from "./math/BitcastNode.js"; +export * from "./math/BitcountNode.js"; +export * from "./math/Hash.js"; +export * from "./math/MathUtils.js"; +export * from "./math/PackFloatNode.js"; +export * from "./math/UnpackFloatNode.js"; +export * from "./math/TriNoise3D.js"; +export * from "./utils/EquirectUV.js"; +export * from "./utils/FunctionOverloadingNode.js"; +export * from "./utils/LoopNode.js"; +export * from "./utils/MatcapUV.js"; +export * from "./utils/MaxMipLevelNode.js"; +export * from "./utils/Oscillators.js"; +export * from "./utils/Packing.js"; +export * from "./utils/Remap.js"; +export * from "./utils/UVUtils.js"; +export * from "./utils/SpriteUtils.js"; +export * from "./utils/ViewportUtils.js"; +export * from "./utils/RotateNode.js"; +export * from "./utils/SpriteSheetUV.js"; +export * from "./utils/Timer.js"; +export * from "./utils/TriplanarTextures.js"; +export * from "./utils/ReflectorNode.js"; +export * from "./utils/RTTNode.js"; +export * from "./utils/PostProcessingUtils.js"; +export * from "./utils/SampleNode.js"; +export * from "./utils/EventNode.js"; +export * from "./utils/StorageArrayElementNode.js"; +export * from "./tsl/TSLBase.js"; +export * from "./accessors/AccessorsUtils.js"; +export * from "./accessors/Arrays.js"; +export * from "./accessors/UniformArrayNode.js"; +export * from "./accessors/Bitangent.js"; +export * from "./accessors/ClippingNode.js"; +export * from "./accessors/TangentUtils.js"; +export * from "./accessors/BufferAttributeNode.js"; +export * from "./accessors/BufferNode.js"; +export * from "./accessors/BuiltinNode.js"; +export * from "./accessors/Camera.js"; +export * from "./accessors/VertexColorNode.js"; +export * from "./accessors/CubeTextureNode.js"; +export * from "./accessors/Instance.js"; +export * from "./accessors/Batch.js"; +export * from "./accessors/MaterialNode.js"; +export * from "./accessors/MaterialProperties.js"; +export * from "./accessors/MaterialReferenceNode.js"; +export * from "./accessors/RendererReferenceNode.js"; +export * from "./accessors/Morph.js"; +export * from "./accessors/TextureBicubic.js"; +export * from "./accessors/ModelNode.js"; +export * from "./accessors/ModelViewProjectionNode.js"; +export * from "./accessors/Normal.js"; +export * from "./accessors/Object3DNode.js"; +export * from "./accessors/PointUVNode.js"; +export * from "./accessors/Position.js"; +export * from "./accessors/ReferenceNode.js"; +export * from "./accessors/ReflectVector.js"; +export * from "./accessors/Skinning.js"; +export * from "./accessors/SceneProperties.js"; +export * from "./accessors/StorageBufferNode.js"; +export * from "./accessors/StorageTexture3DNode.js"; +export * from "./accessors/StorageTextureNode.js"; +export * from "./accessors/Tangent.js"; +export * from "./accessors/TextureNode.js"; +export * from "./accessors/TextureSizeNode.js"; +export * from "./accessors/Texture3DNode.js"; +export * from "./accessors/UV.js"; +export * from "./accessors/UserDataNode.js"; +export * from "./accessors/VelocityNode.js"; +export * from "./display/BlendModes.js"; +export * from "./display/BumpMapNode.js"; +export * from "./display/ColorAdjustment.js"; +export * from "./display/ColorSpaceNode.js"; +export * from "./display/FrontFacingNode.js"; +export * from "./display/NormalMapNode.js"; +export * from "./display/PremultiplyAlphaFunctions.js"; +export * from "./display/ToneMappingNode.js"; +export * from "./display/ScreenNode.js"; +export * from "./display/ViewportTextureNode.js"; +export * from "./display/ViewportSharedTextureNode.js"; +export * from "./display/ViewportDepthTextureNode.js"; +export * from "./display/ViewportDepthNode.js"; +export * from "./display/RenderOutputNode.js"; +export * from "./display/ToonOutlinePassNode.js"; +export * from "./display/PassNode.js"; +export * from "./display/ColorSpaceFunctions.js"; +export * from "./display/ToneMappingFunctions.js"; +export * from "./code/ExpressionNode.js"; +export * from "./code/CodeNode.js"; +export * from "./code/FunctionCallNode.js"; +export * from "./code/FunctionNode.js"; +export * from "./fog/Fog.js"; +export * from "./geometry/RangeNode.js"; +export * from "./gpgpu/ComputeNode.js"; +export * from "./gpgpu/ComputeBuiltinNode.js"; +export * from "./gpgpu/BarrierNode.js"; +export * from "./gpgpu/WorkgroupInfoNode.js"; +export * from "./gpgpu/AtomicFunctionNode.js"; +export * from "./gpgpu/SubgroupFunctionNode.js"; +export * from "./accessors/Lights.js"; +export * from "./lighting/LightsNode.js"; +export * from "./lighting/LightingContextNode.js"; +export * from "./lighting/ShadowBaseNode.js"; +export * from "./lighting/PointShadowNode.js"; +export * from "./lighting/PointLightNode.js"; +export * from "./pmrem/PMREMNode.js"; +export * from "./procedural/Checker.js"; +export * from "./shapes/Shapes.js"; +export * from "./materialx/MaterialXNodes.js"; +export * from "./lighting/LightUtils.js"; +export { shadow } from "./lighting/ShadowNode.js"; +export { default as BRDF_GGX } from "./functions/BSDF/BRDF_GGX.js"; +export { default as BRDF_Lambert } from "./functions/BSDF/BRDF_Lambert.js"; +export { default as BRDF_Sheen } from "./functions/BSDF/BRDF_Sheen.js"; +export { default as D_GGX } from "./functions/BSDF/D_GGX.js"; +export { default as D_GGX_Anisotropic } from "./functions/BSDF/D_GGX_Anisotropic.js"; +export { default as DFGLUT } from "./functions/BSDF/DFGLUT.js"; +export { default as EnvironmentBRDF } from "./functions/BSDF/EnvironmentBRDF.js"; +export { default as F_Schlick } from "./functions/BSDF/F_Schlick.js"; +export { default as Schlick_to_F0 } from "./functions/BSDF/Schlick_to_F0.js"; +export { default as V_GGX_SmithCorrelated } from "./functions/BSDF/V_GGX_SmithCorrelated.js"; +export { default as V_GGX_SmithCorrelated_Anisotropic } from "./functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js"; +export { default as getGeometryRoughness } from "./functions/material/getGeometryRoughness.js"; +export { default as getParallaxCorrectNormal } from "./functions/material/getParallaxCorrectNormal.js"; +export { default as getRoughness } from "./functions/material/getRoughness.js"; +export { default as getShIrradianceAt } from "./functions/material/getShIrradianceAt.js"; +export { BasicShadowFilter, PCFShadowFilter, VSMShadowFilter } from "./lighting/ShadowFilterNode.js"; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts new file mode 100644 index 000000000..07177caec --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts @@ -0,0 +1,23 @@ +/** + * TSL object that represents the TBN matrix in view space. + * + * @tsl + * @type {Node} + */ +export const TBNViewMatrix: Node; +/** + * TSL object that represents the parallax direction. + * + * @tsl + * @type {Node} + */ +export const parallaxDirection: Node; +export function parallaxUV(uv: Node, scale: Node): Node; +/** + * TSL function for computing bent normals. + * + * @tsl + * @function + * @returns {Node} Bent normals. + */ +export const bentNormalView: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts new file mode 100644 index 000000000..6c9184803 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts @@ -0,0 +1,2 @@ +export function attributeArray(count: number | TypedArray, type?: string | Struct): StorageBufferNode; +export function instancedArray(count: number | TypedArray, type?: string | Struct): StorageBufferNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts new file mode 100644 index 000000000..f483ad0da --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts @@ -0,0 +1,22 @@ +/** + * TSL object representing a varying property for the batching color vector. + * + * @type {VaryingNode} + */ +export const batchColor: VaryingNode; +/** + * TSL object representing a varying property for the batch indirect index (instance ID). + * + * @type {VaryingNode} + */ +export const batchIndirectIndex: VaryingNode; +/** + * TSL function representing the vertex shader batching setup. + * Applies the batch transformation matrix to positionLocal, normalLocal, and tangentLocal. + * Also assigns the batch color if a color texture is present. + * + * @tsl + * @function + * @param {BatchedMesh} batchMesh - The batched mesh. + */ +export const batch: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts new file mode 100644 index 000000000..7694a53fc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts @@ -0,0 +1,28 @@ +/** + * TSL object that represents the bitangent attribute of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const bitangentGeometry: Node; +/** + * TSL object that represents the vertex bitangent in local space of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const bitangentLocal: Node; +/** + * TSL object that represents the vertex bitangent in view space of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const bitangentView: Node; +/** + * TSL object that represents the vertex bitangent in world space of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const bitangentWorld: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts new file mode 100644 index 000000000..60775a2a1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts @@ -0,0 +1,143 @@ +export default BufferAttributeNode; +export function bufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; +export function dynamicBufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; +export function instancedBufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; +export function instancedDynamicBufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; +/** + * In earlier `three.js` versions it was only possible to define attribute data + * on geometry level. With `BufferAttributeNode`, it is also possible to do this + * on the node level. + * ```js + * const geometry = new THREE.PlaneGeometry(); + * const positionAttribute = geometry.getAttribute( 'position' ); + * + * const colors = []; + * for ( let i = 0; i < position.count; i ++ ) { + * colors.push( 1, 0, 0 ); + * } + * + * material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) ); + * ``` + * This new approach is especially interesting when geometry data are generated via + * compute shaders. The below line converts a storage buffer into an attribute node. + * ```js + * material.positionNode = positionBuffer.toAttribute(); + * ``` + * @augments InputNode + */ +declare class BufferAttributeNode extends InputNode { + /** + * Constructs a new buffer attribute node. + * + * @param {BufferAttribute|InterleavedBuffer|TypedArray} value - The attribute data. + * @param {?string} [bufferType=null] - The buffer type (e.g. `'vec3'`). + * @param {number} [bufferStride=0] - The buffer stride. + * @param {number} [bufferOffset=0] - The buffer offset. + */ + constructor(value: BufferAttribute | InterleavedBuffer | TypedArray, bufferType?: string | null, bufferStride?: number, bufferOffset?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBufferNode: boolean; + /** + * The buffer type (e.g. `'vec3'`). + * + * @type {?string} + * @default null + */ + bufferType: string | null; + /** + * The buffer stride. + * + * @type {number} + * @default 0 + */ + bufferStride: number; + /** + * The buffer offset. + * + * @type {number} + * @default 0 + */ + bufferOffset: number; + /** + * The usage property. Set this to `THREE.DynamicDrawUsage` via `.setUsage()`, + * if you are planning to update the attribute data per frame. + * + * @type {number} + * @default StaticDrawUsage + */ + usage: number; + /** + * Whether the attribute is instanced or not. + * + * @type {boolean} + * @default false + */ + instanced: boolean; + /** + * A reference to the buffer attribute. + * + * @type {?BufferAttribute} + * @default null + */ + attribute: BufferAttribute | null; + /** + * This method is overwritten since the attribute data might be shared + * and thus the hash should be shared as well. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(builder: NodeBuilder): string; + /** + * This method is overwritten since the node type is inferred from + * the buffer attribute. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Depending on which value was passed to the node, `setup()` behaves + * differently. If no instance of `BufferAttribute` was passed, the method + * creates an internal attribute and configures it respectively. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * Generates the code snippet of the buffer attribute node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder): string; + /** + * Overwrites the default implementation to return a fixed value `'bufferAttribute'`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; + /** + * Sets the `usage` property to the given value. + * + * @param {number} value - The usage to set. + * @return {BufferAttributeNode} A reference to this node. + */ + setUsage(value: number): BufferAttributeNode; + /** + * Sets the `instanced` property to the given value. + * + * @param {boolean} value - The value to set. + * @return {BufferAttributeNode} A reference to this node. + */ + setInstanced(value: boolean): BufferAttributeNode; +} +import { InterleavedBuffer } from '../../core/InterleavedBuffer.js'; +import InputNode from '../core/InputNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts new file mode 100644 index 000000000..a0765ba1c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts @@ -0,0 +1,75 @@ +export default BufferNode; +export function buffer(value: Array, type: string, count: number): BufferNode; +/** + * A special type of uniform node which represents array-like data + * as uniform buffers. The access usually happens via `element()` + * which returns an instance of {@link ArrayElementNode}. For example: + * + * ```js + * const bufferNode = buffer( array, 'mat4', count ); + * const matrixNode = bufferNode.element( index ); // access a matrix from the buffer + * ``` + * In general, it is recommended to use the more managed {@link UniformArrayNode} + * since it handles more input types and automatically cares about buffer paddings. + * + * @augments UniformNode + */ +declare class BufferNode extends UniformNode { + /** + * Constructs a new buffer node. + * + * @param {Array} value - Array-like buffer data. + * @param {string} bufferType - The data type of the buffer. + * @param {number} [bufferCount=0] - The count of buffer elements. + */ + constructor(value: Array, bufferType: string, bufferCount?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBufferNode: boolean; + /** + * The data type of the buffer. + * + * @type {string} + */ + bufferType: string; + /** + * The uniform node that holds the value of the reference node. + * + * @type {number} + * @default 0 + */ + bufferCount: number; + /** + * An array of update ranges. + * + * @type {Array<{start: number, count: number}>} + */ + updateRanges: Array<{ + start: number; + count: number; + }>; + /** + * Adds a range of data in the data array to be updated on the GPU. + * + * @param {number} start - Position at which to start update. + * @param {number} count - The number of components to update. + */ + addUpdateRange(start: number, count: number): void; + /** + * Clears the update ranges. + */ + clearUpdateRanges(): void; + /** + * Overwrites the default implementation to return a fixed value `'buffer'`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; +} +import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts new file mode 100644 index 000000000..1081d0ec4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts @@ -0,0 +1,40 @@ +export default BuiltinNode; +/** + * TSL function for creating a builtin node. + * + * @tsl + * @function + * @param {string} name - The name of the built-in shader variable. + * @returns {BuiltinNode} + */ +export const builtin: any; +/** + * The node allows to set values for built-in shader variables. That is + * required for features like hardware-accelerated vertex clipping. + * + * @augments Node + */ +declare class BuiltinNode extends Node { + /** + * Constructs a new builtin node. + * + * @param {string} name - The name of the built-in shader variable. + */ + constructor(name: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBuiltinNode: boolean; + /** + * Generates the code snippet of the builtin node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(): string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts new file mode 100644 index 000000000..1af86bd26 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts @@ -0,0 +1,70 @@ +/** + * TSL object that represents the current `index` value of the camera if used ArrayCamera. + * + * @tsl + * @type {UniformNode} + */ +export const cameraIndex: UniformNode; +/** + * TSL object that represents the `near` value of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraNear: UniformNode; +/** + * TSL object that represents the `far` value of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraFar: UniformNode; +/** + * TSL object that represents the projection matrix of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraProjectionMatrix: UniformNode; +/** + * TSL object that represents the inverse projection matrix of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraProjectionMatrixInverse: UniformNode; +/** + * TSL object that represents the view matrix of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraViewMatrix: UniformNode; +/** + * TSL object that represents the world matrix of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraWorldMatrix: UniformNode; +/** + * TSL object that represents the normal matrix of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraNormalMatrix: UniformNode; +/** + * TSL object that represents the position in world space of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraPosition: UniformNode; +/** + * TSL object that represents the viewport of the camera used for the current render. + * + * @tsl + * @type {UniformNode} + */ +export const cameraViewport: UniformNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts new file mode 100644 index 000000000..5ee80d125 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts @@ -0,0 +1,65 @@ +export default ClippingNode; +export function clipping(): ClippingNode; +export function clippingAlpha(): ClippingNode; +export function hardwareClipping(): ClippingNode; +/** + * This node is used in {@link NodeMaterial} to setup the clipping + * which can happen hardware-accelerated (if supported) and optionally + * use alpha-to-coverage for anti-aliasing clipped edges. + * + * @augments Node + */ +declare class ClippingNode extends Node { + /** + * Constructs a new clipping node. + * + * @param {('default'|'hardware'|'alphaToCoverage')} [scope='default'] - The node's scope. Similar to other nodes, + * the selected scope influences the behavior of the node and what type of code is generated. + */ + constructor(scope?: ("default" | "hardware" | "alphaToCoverage")); + /** + * The node's scope. Similar to other nodes, the selected scope influences + * the behavior of the node and what type of code is generated. + * + * @type {('default'|'hardware'|'alphaToCoverage')} + */ + scope: ("default" | "hardware" | "alphaToCoverage"); + /** + * Setups the node depending on the selected scope. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The result node. + */ + setup(builder: NodeBuilder): Node; + hardwareClipping: any; + /** + * Setups alpha to coverage. + * + * @param {Array} intersectionPlanes - The intersection planes. + * @param {Array} unionPlanes - The union planes. + * @return {Node} The result node. + */ + setupAlphaToCoverage(intersectionPlanes: Array, unionPlanes: Array): Node; + /** + * Setups the default clipping. + * + * @param {Array} intersectionPlanes - The intersection planes. + * @param {Array} unionPlanes - The union planes. + * @return {Node} The result node. + */ + setupDefault(intersectionPlanes: Array, unionPlanes: Array): Node; + /** + * Setups hardware clipping. + * + * @param {Array} unionPlanes - The union planes. + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The result node. + */ + setupHardwareClipping(unionPlanes: Array, builder: NodeBuilder): Node; +} +declare namespace ClippingNode { + let ALPHA_TO_COVERAGE: string; + let DEFAULT: string; + let HARDWARE: string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts new file mode 100644 index 000000000..23a01c90a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts @@ -0,0 +1,48 @@ +export default CubeTextureNode; +/** + * TSL function for creating a cube texture node. + * + * @tsl + * @function + * @param {CubeTexture} value - The cube texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Node} [biasNode=null] - The bias node. + * @returns {CubeTextureNode} + */ +export const cubeTextureBase: any; +export function cubeTexture(value?: (CubeTexture | CubeTextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null): CubeTextureNode; +export function uniformCubeTexture(value?: CubeTexture | null): CubeTextureNode; +/** + * This type of uniform node represents a cube texture. + * + * @augments TextureNode + */ +declare class CubeTextureNode extends TextureNode { + /** + * Constructs a new cube texture node. + * + * @param {CubeTexture} value - The cube texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Node} [biasNode=null] - The bias node. + */ + constructor(value: CubeTexture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeTextureNode: boolean; + /** + * Overwritten with an empty implementation since the `updateMatrix` flag is ignored + * for cube textures. The uv transformation matrix is not applied to cube textures. + * + * @param {boolean} value - The update toggle. + */ + setUpdateMatrix(): void; +} +import { CubeTexture } from '../../textures/CubeTexture.js'; +import TextureNode from './TextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts new file mode 100644 index 000000000..7976840f6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts @@ -0,0 +1,24 @@ +/** + * TSL object representing a varying property for the instanced color vector. + * + * @type {VaryingNode} + */ +export const instanceColor: VaryingNode; +/** + * TSL function representing the standard instancing vertex shader setup. + * Transforms positionLocal and normalLocal, and assigns varying color in-place. + * + * @tsl + * @function + * @param {InstancedBufferAttribute|StorageInstancedBufferAttribute} matrices - The instanced transformation matrices. + * @param {?InstancedBufferAttribute|StorageInstancedBufferAttribute} [colors=null] - The optional instanced colors. + */ +export const instance: () => void; +/** + * TSL wrapper for applying instanced mesh rendering setup. + * + * @tsl + * @function + * @param {InstancedMesh} instancedMesh - The instanced mesh. + */ +export const instancedMesh: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts new file mode 100644 index 000000000..1639939c2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts @@ -0,0 +1,48 @@ +/** + * TSL function for getting a shadow matrix uniform node for the given light. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @returns {UniformNode} The shadow matrix uniform node. + */ +export function lightShadowMatrix(light: Light): UniformNode; +/** + * TSL function for getting projected uv coordinates for the given light. + * Relevant when using maps with spot lights. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @param {Node} [position=positionWorld] -The position to project. + * @returns {Node} The projected uvs. + */ +export function lightProjectionUV(light: Light, position?: Node): Node; +/** + * TSL function for getting the position in world space for the given light. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @returns {UniformNode} The light's position in world space. + */ +export function lightPosition(light: Light): UniformNode; +/** + * TSL function for getting the light target position in world space for the given light. + * + * @tsl + * @function + * @param {Light} light -The light source. + * @returns {UniformNode} The light target position in world space. + */ +export function lightTargetPosition(light: Light): UniformNode; +/** + * TSL function for getting the position in view space for the given light. + * + * @tsl + * @function + * @param {Light} light - The light source. + * @returns {UniformNode} The light's position in view space. + */ +export function lightViewPosition(light: Light): UniformNode; +export function lightTargetDirection(light: Light): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts new file mode 100644 index 000000000..35c61d585 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts @@ -0,0 +1,392 @@ +export default MaterialNode; +/** + * TSL object that represents alpha test of the current material. + * + * @tsl + * @type {Node} + */ +export const materialAlphaTest: Node; +/** + * TSL object that represents the diffuse color of the current material. + * The value is composed via `color` * `map`. + * + * @tsl + * @type {Node} + */ +export const materialColor: Node; +/** + * TSL object that represents the shininess of the current material. + * + * @tsl + * @type {Node} + */ +export const materialShininess: Node; +/** + * TSL object that represents the emissive color of the current material. + * The value is composed via `emissive` * `emissiveIntensity` * `emissiveMap`. + * + * @tsl + * @type {Node} + */ +export const materialEmissive: Node; +/** + * TSL object that represents the opacity of the current material. + * The value is composed via `opacity` * `alphaMap`. + * + * @tsl + * @type {Node} + */ +export const materialOpacity: Node; +/** + * TSL object that represents the specular of the current material. + * + * @tsl + * @type {Node} + */ +export const materialSpecular: Node; +/** + * TSL object that represents the specular intensity of the current material. + * The value is composed via `specularIntensity` * `specularMap.a`. + * + * @tsl + * @type {Node} + */ +export const materialSpecularIntensity: Node; +/** + * TSL object that represents the specular color of the current material. + * The value is composed via `specularColor` * `specularMap.rgb`. + * + * @tsl + * @type {Node} + */ +export const materialSpecularColor: Node; +/** + * TSL object that represents the specular strength of the current material. + * The value is composed via `specularMap.r`. + * + * @tsl + * @type {Node} + */ +export const materialSpecularStrength: Node; +/** + * TSL object that represents the reflectivity of the current material. + * + * @tsl + * @type {Node} + */ +export const materialReflectivity: Node; +/** + * TSL object that represents the roughness of the current material. + * The value is composed via `roughness` * `roughnessMap.g`. + * + * @tsl + * @type {Node} + */ +export const materialRoughness: Node; +/** + * TSL object that represents the metalness of the current material. + * The value is composed via `metalness` * `metalnessMap.b`. + * + * @tsl + * @type {Node} + */ +export const materialMetalness: Node; +/** + * TSL object that represents the normal of the current material. + * The value will be either `normalMap` * `normalScale`, `bumpMap` * `bumpScale` or `normalView`. + * + * @tsl + * @type {Node} + */ +export const materialNormal: Node; +/** + * TSL object that represents the clearcoat of the current material. + * The value is composed via `clearcoat` * `clearcoatMap.r` + * + * @tsl + * @type {Node} + */ +export const materialClearcoat: Node; +/** + * TSL object that represents the clearcoat roughness of the current material. + * The value is composed via `clearcoatRoughness` * `clearcoatRoughnessMap.r`. + * + * @tsl + * @type {Node} + */ +export const materialClearcoatRoughness: Node; +/** + * TSL object that represents the clearcoat normal of the current material. + * The value will be either `clearcoatNormalMap` or `normalView`. + * + * @tsl + * @type {Node} + */ +export const materialClearcoatNormal: Node; +/** + * TSL object that represents the rotation of the current sprite material. + * + * @tsl + * @type {Node} + */ +export const materialRotation: Node; +/** + * TSL object that represents the sheen color of the current material. + * The value is composed via `sheen` * `sheenColor` * `sheenColorMap`. + * + * @tsl + * @type {Node} + */ +export const materialSheen: Node; +/** + * TSL object that represents the sheen roughness of the current material. + * The value is composed via `sheenRoughness` * `sheenRoughnessMap.a`. + * + * @tsl + * @type {Node} + */ +export const materialSheenRoughness: Node; +/** + * TSL object that represents the anisotropy of the current material. + * + * @tsl + * @type {Node} + */ +export const materialAnisotropy: Node; +/** + * TSL object that represents the iridescence of the current material. + * + * @tsl + * @type {Node} + */ +export const materialIridescence: Node; +/** + * TSL object that represents the iridescence IOR of the current material. + * + * @tsl + * @type {Node} + */ +export const materialIridescenceIOR: Node; +/** + * TSL object that represents the iridescence thickness of the current material. + * + * @tsl + * @type {Node} + */ +export const materialIridescenceThickness: Node; +/** + * TSL object that represents the transmission of the current material. + * The value is composed via `transmission` * `transmissionMap.r`. + * + * @tsl + * @type {Node} + */ +export const materialTransmission: Node; +/** + * TSL object that represents the thickness of the current material. + * The value is composed via `thickness` * `thicknessMap.g`. + * + * @tsl + * @type {Node} + */ +export const materialThickness: Node; +/** + * TSL object that represents the IOR of the current material. + * + * @tsl + * @type {Node} + */ +export const materialIOR: Node; +/** + * TSL object that represents the attenuation distance of the current material. + * + * @tsl + * @type {Node} + */ +export const materialAttenuationDistance: Node; +/** + * TSL object that represents the attenuation color of the current material. + * + * @tsl + * @type {Node} + */ +export const materialAttenuationColor: Node; +/** + * TSL object that represents the scale of the current dashed line material. + * + * @tsl + * @type {Node} + */ +export const materialLineScale: Node; +/** + * TSL object that represents the dash size of the current dashed line material. + * + * @tsl + * @type {Node} + */ +export const materialLineDashSize: Node; +/** + * TSL object that represents the gap size of the current dashed line material. + * + * @tsl + * @type {Node} + */ +export const materialLineGapSize: Node; +/** + * TSL object that represents the line width of the current line material. + * + * @tsl + * @type {Node} + */ +export const materialLineWidth: Node; +/** + * TSL object that represents the dash offset of the current line material. + * + * @tsl + * @type {Node} + */ +export const materialLineDashOffset: Node; +/** + * TSL object that represents the point size of the current points material. + * + * @tsl + * @type {Node} + */ +export const materialPointSize: Node; +/** + * TSL object that represents the dispersion of the current material. + * + * @tsl + * @type {Node} + */ +export const materialDispersion: Node; +/** + * TSL object that represents the retroreflective strength of the current material. + * + * @tsl + * @type {Node} + */ +export const materialRetroreflectivity: Node; +/** + * TSL object that represents the light map of the current material. + * The value is composed via `lightMapIntensity` * `lightMap.rgb`. + * + * @tsl + * @type {Node} + */ +export const materialLightMap: Node; +/** + * TSL object that represents the ambient occlusion map of the current material. + * The value is composed via `aoMap.r` - 1 * `aoMapIntensity` + 1. + * + * @tsl + * @type {Node} + */ +export const materialAO: Node; +/** + * TSL object that represents the anisotropy vector of the current material. + * + * @tsl + * @type {Node} + */ +export const materialAnisotropyVector: Node; +/** + * This class should simplify the node access to material properties. + * It internal uses reference nodes to make sure changes to material + * properties are automatically reflected to predefined TSL objects + * like e.g. `materialColor`. + * + * @augments Node + */ +declare class MaterialNode extends Node { + /** + * Constructs a new material node. + * + * @param {string} scope - The scope defines what kind of material property is referred by the node. + */ + constructor(scope: string); + /** + * The scope defines what material property is referred by the node. + * + * @type {string} + */ + scope: string; + /** + * Returns a cached reference node for the given property and type. + * + * @param {string} property - The name of the material property. + * @param {string} type - The uniform type of the property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getCache(property: string, type: string): MaterialReferenceNode; + /** + * Returns a float-typed material reference node for the given property name. + * + * @param {string} property - The name of the material property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getFloat(property: string): MaterialReferenceNode; + /** + * Returns a color-typed material reference node for the given property name. + * + * @param {string} property - The name of the material property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getColor(property: string): MaterialReferenceNode; + /** + * Returns a texture-typed material reference node for the given property name. + * + * @param {string} property - The name of the material property. + * @return {MaterialReferenceNode} A material reference node representing the property access. + */ + getTexture(property: string): MaterialReferenceNode; + /** + * The node setup is done depending on the selected scope. Multiple material properties + * might be grouped into a single node composition if they logically belong together. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The node representing the selected scope. + */ + setup(builder: NodeBuilder): Node; +} +declare namespace MaterialNode { + let ALPHA_TEST: string; + let COLOR: string; + let OPACITY: string; + let SHININESS: string; + let SPECULAR: string; + let SPECULAR_STRENGTH: string; + let SPECULAR_INTENSITY: string; + let SPECULAR_COLOR: string; + let REFLECTIVITY: string; + let ROUGHNESS: string; + let METALNESS: string; + let NORMAL: string; + let CLEARCOAT: string; + let CLEARCOAT_ROUGHNESS: string; + let CLEARCOAT_NORMAL: string; + let EMISSIVE: string; + let ROTATION: string; + let SHEEN: string; + let SHEEN_ROUGHNESS: string; + let ANISOTROPY: string; + let IRIDESCENCE: string; + let IRIDESCENCE_IOR: string; + let IRIDESCENCE_THICKNESS: string; + let IOR: string; + let TRANSMISSION: string; + let THICKNESS: string; + let ATTENUATION_DISTANCE: string; + let ATTENUATION_COLOR: string; + let LINE_SCALE: string; + let LINE_DASH_SIZE: string; + let LINE_GAP_SIZE: string; + let LINE_WIDTH: string; + let LINE_DASH_OFFSET: string; + let POINT_SIZE: string; + let DISPERSION: string; + let RETROREFLECTIVITY: string; + let LIGHT_MAP: string; + let AO: string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts new file mode 100644 index 000000000..6ef441cc9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts @@ -0,0 +1,24 @@ +/** + * TSL object that represents the refraction ratio of the material used for rendering the current object. + * + * @tsl + * @type {UniformNode} + */ +export const materialRefractionRatio: UniformNode; +/** + * TSL object that represents the intensity of environment maps of PBR materials. + * When `material.envMap` is set, the value is `material.envMapIntensity` otherwise `scene.environmentIntensity`. + * + * @tsl + * @type {Node} + */ +export const materialEnvIntensity: Node; +/** + * TSL object that represents the rotation of environment maps. + * When `material.envMap` is set, the value is `material.envMapRotation`. + * `scene.environmentRotation` controls the rotation of `scene.environment` or `scene.environmentNode` instead. + * + * @tsl + * @type {Node} + */ +export const materialEnvRotation: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts new file mode 100644 index 000000000..7a6029df8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts @@ -0,0 +1,41 @@ +export default MaterialReferenceNode; +export function materialReference(name: string, type: string, material?: Material | null): MaterialReferenceNode; +/** + * This node is a special type of reference node which is intended + * for linking material properties with node values. + * ```js + * const opacityNode = materialReference( 'opacity', 'float', material ); + * ``` + * When changing `material.opacity`, the node value of `opacityNode` will + * automatically be updated. + * + * @augments ReferenceNode + */ +declare class MaterialReferenceNode extends ReferenceNode { + /** + * Constructs a new material reference node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} inputType - The uniform type that should be used to represent the property value. + * @param {?Material} [material=null] - The material the property belongs to. When no material is set, + * the node refers to the material of the current rendered object. + */ + constructor(property: string, inputType: string, material?: Material | null); + /** + * The material the property belongs to. When no material is set, + * the node refers to the material of the current rendered object. + * + * @type {?Material} + * @default null + */ + material: Material | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMaterialReferenceNode: boolean; +} +import ReferenceNode from './ReferenceNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts new file mode 100644 index 000000000..b5523dfa3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts @@ -0,0 +1,104 @@ +export default ModelNode; +/** + * TSL object that represents the object's direction in world space. + * + * @tsl + * @type {ModelNode} + */ +export const modelDirection: ModelNode; +/** + * TSL object that represents the object's world matrix. + * + * @tsl + * @type {ModelNode} + */ +export const modelWorldMatrix: ModelNode; +/** + * TSL object that represents the object's position in world space. + * + * @tsl + * @type {ModelNode} + */ +export const modelPosition: ModelNode; +/** + * TSL object that represents the object's scale in world space. + * + * @tsl + * @type {ModelNode} + */ +export const modelScale: ModelNode; +/** + * TSL object that represents the object's position in view/camera space. + * + * @tsl + * @type {ModelNode} + */ +export const modelViewPosition: ModelNode; +/** + * TSL object that represents the object's radius. + * + * @tsl + * @type {ModelNode} + */ +export const modelRadius: ModelNode; +/** + * TSL object that represents the object's normal matrix. + * + * @tsl + * @type {UniformNode} + */ +export const modelNormalMatrix: UniformNode; +/** + * TSL object that represents the object's inverse world matrix. + * + * @tsl + * @type {UniformNode} + */ +export const modelWorldMatrixInverse: UniformNode; +/** + * TSL object that represents the object's model view matrix. + * + * @tsl + * @type {Node} + */ +export const modelViewMatrix: Node; +/** + * TSL object that represents the object's model view in `mediump` precision. + * + * @tsl + * @type {Node} + */ +export const mediumpModelViewMatrix: Node; +/** + * TSL object that represents the object's model view in `highp` precision + * which is achieved by computing the matrix in JS and not in the shader. + * + * @tsl + * @type {Node} + */ +export const highpModelViewMatrix: Node; +/** + * TSL object that represents the object's model normal view in `highp` precision + * which is achieved by computing the matrix in JS and not in the shader. + * + * @tsl + * @type {Node} + */ +export const highpModelNormalViewMatrix: Node; +/** + * This type of node is a specialized version of `Object3DNode` + * with larger set of model related metrics. Unlike `Object3DNode`, + * `ModelNode` extracts the reference to the 3D object from the + * current node frame state. + * + * @augments Object3DNode + */ +declare class ModelNode extends Object3DNode { + /** + * Constructs a new object model node. + * + * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. + */ + constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix")); +} +import Object3DNode from './Object3DNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts new file mode 100644 index 000000000..40d0ac691 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts @@ -0,0 +1,7 @@ +/** + * TSL object that represents the position in clip space after the model-view-projection transform of the current rendered object. + * + * @tsl + * @type {VaryingNode} + */ +export const modelViewProjection: VaryingNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts new file mode 100644 index 000000000..1713b3af4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts @@ -0,0 +1,9 @@ +/** + * TSL function representing the vertex shader morph targets blend setup. + * Dynamically computes morph targets weights and updates positionLocal and normalLocal in-place. + * + * @tsl + * @function + * @param {Mesh} mesh - The mesh. + */ +export const morphReference: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts new file mode 100644 index 000000000..b7f3793b1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts @@ -0,0 +1,100 @@ +/** + * TSL object that represents the normal attribute of the current rendered object in local space. + * + * @tsl + * @type {Node} + */ +export const normalGeometry: Node; +/** + * TSL object that represents the vertex normal of the current rendered object in local space. + * + * @tsl + * @type {Node} + */ +export const normalLocal: Node; +/** + * TSL object that represents the flat vertex normal of the current rendered object in view space. + * + * @tsl + * @type {Node} + */ +export const normalFlat: Node; +/** + * TSL object that represents the vertex normal of the current rendered object in view space. + * + * @tsl + * @type {Node} + */ +export const normalViewGeometry: Node; +/** + * TSL object that represents the vertex normal of the current rendered object in world space. + * + * @tsl + * @type {Node} + */ +export const normalWorldGeometry: Node; +/** + * TSL object that represents the vertex normal of the current rendered object in view space. + * + * @tsl + * @type {Node} + */ +export const normalView: Node; +/** + * TSL object that represents the vertex normal of the current rendered object in world space. + * + * @tsl + * @type {Node} + */ +export const normalWorld: Node; +/** + * TSL object that represents the clearcoat vertex normal of the current rendered object in view space. + * + * @tsl + * @type {Node} + */ +export const clearcoatNormalView: Node; +/** + * Transforms the normal by the normal matrix of the given matrix and then normalizes the result. + * + * @tsl + * @function + * @param {Node} normal - The normal. + * @param {Node} [matrix=modelWorldMatrix] - The matrix. + * @return {Node} The transformed normal. + */ +export const transformNormal: () => void; +/** + * Transforms the given normal from local to view space. + * + * @tsl + * @function + * @param {Node} normal - The normal. + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The transformed normal. + */ +export const transformNormalToView: () => void; +/** + * TSL object that represents the transformed vertex normal of the current rendered object in view space. + * + * @tsl + * @type {Node} + * @deprecated since r178. Use `normalView` instead. + */ +export const transformedNormalView: Node; +/** + * TSL object that represents the transformed vertex normal of the current rendered object in world space. + * + * @tsl + * @type {Node} + * @deprecated since r178. Use `normalWorld` instead. + */ +export const transformedNormalWorld: Node; +/** + * TSL object that represents the transformed clearcoat vertex normal of the current rendered object in view space. + * + * @tsl + * @type {Node} + * @deprecated since r178. Use `clearcoatNormalView` instead. + */ +export const transformedClearcoatNormalView: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts new file mode 100644 index 000000000..99b15b948 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts @@ -0,0 +1,128 @@ +export default Object3DNode; +/** + * TSL function for creating an object 3D node that represents the object's direction in world space. + * + * @tsl + * @function + * @param {?Object3D} [object3d] - The 3D object. + * @returns {Object3DNode} + */ +export const objectDirection: any; +/** + * TSL function for creating an object 3D node that represents the object's world matrix. + * + * @tsl + * @function + * @param {?Object3D} [object3d] - The 3D object. + * @returns {Object3DNode} + */ +export const objectWorldMatrix: any; +/** + * TSL function for creating an object 3D node that represents the object's position in world space. + * + * @tsl + * @function + * @param {?Object3D} [object3d] - The 3D object. + * @returns {Object3DNode} + */ +export const objectPosition: any; +/** + * TSL function for creating an object 3D node that represents the object's scale in world space. + * + * @tsl + * @function + * @param {?Object3D} [object3d] - The 3D object. + * @returns {Object3DNode} + */ +export const objectScale: any; +/** + * TSL function for creating an object 3D node that represents the object's position in view/camera space. + * + * @tsl + * @function + * @param {?Object3D} [object3d] - The 3D object. + * @returns {Object3DNode} + */ +export const objectViewPosition: any; +/** + * TSL function for creating an object 3D node that represents the object's radius. + * + * @tsl + * @function + * @param {?Object3D} [object3d] - The 3D object. + * @returns {Object3DNode} + */ +export const objectRadius: any; +/** + * This node can be used to access transformation related metrics of 3D objects. + * Depending on the selected scope, a different metric is represented as a uniform + * in the shader. The following scopes are supported: + * + * - `POSITION`: The object's position in world space. + * - `VIEW_POSITION`: The object's position in view/camera space. + * - `DIRECTION`: The object's direction in world space. + * - `SCALE`: The object's scale in world space. + * - `WORLD_MATRIX`: The object's matrix in world space. + * + * @augments Node + */ +declare class Object3DNode extends Node { + /** + * Constructs a new object 3D node. + * + * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. + * @param {?Object3D} [object3d=null] - The 3D object. + */ + constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"), object3d?: Object3D | null); + /** + * The node reports a different type of transformation depending on the scope. + * + * @type {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} + */ + scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"); + /** + * The 3D object. + * + * @type {?Object3D} + * @default null + */ + object3d: Object3D | null; + /** + * Holds the value of the node as a uniform. + * + * @type {UniformNode} + */ + uniformNode: UniformNode; + /** + * Overwritten since the node type is inferred from the scope. + * + * @return {('mat4'|'vec3'|'float')} The node type. + */ + generateNodeType(): ("mat4" | "vec3" | "float"); + /** + * Updates the uniform value depending on the scope. + * + * @param {NodeFrame} frame - The current node frame. + */ + update(frame: NodeFrame): void; + /** + * Generates the code snippet of the uniform node. The node type of the uniform + * node also depends on the selected scope. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder): string; + serialize(data: any): void; + deserialize(data: any): void; +} +declare namespace Object3DNode { + let WORLD_MATRIX: string; + let POSITION: string; + let SCALE: string; + let VIEW_POSITION: string; + let DIRECTION: string; + let RADIUS: string; +} +import Node from '../core/Node.js'; +import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts new file mode 100644 index 000000000..67872c0e7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts @@ -0,0 +1,33 @@ +export default PointUVNode; +/** + * TSL object that represents the uv coordinates of points. + * + * @tsl + * @type {PointUVNode} + */ +export const pointUV: PointUVNode; +/** + * A node for representing the uv coordinates of points. + * + * Can only be used with a WebGL backend. In WebGPU, point + * primitives always have the size of one pixel and can thus + * can't be used as sprite-like objects that display textures. + * + * @augments Node + */ +declare class PointUVNode extends Node { + /** + * Constructs a new point uv node. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPointUVNode: boolean; + generate(): string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts new file mode 100644 index 000000000..6b2893c1d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts @@ -0,0 +1,61 @@ +/** + * TSL object that represents the clip space position of the current rendered object. + * + * @tsl + * @type {VaryingNode} + */ +export const clipSpace: VaryingNode; +/** + * TSL object that represents the position attribute of the current rendered object. + * + * @tsl + * @type {AttributeNode} + */ +export const positionGeometry: AttributeNode; +/** + * TSL object that represents the transformed vertex position in local space of the current rendered object. + * + * The term "transformed" indicates that an object or material's properties, such as skinning, batch, + * instancing, or displacement mapping, will change the vertex position of the node when present. + * To use the pre-transformed local space position of the object, use {@link positionGeometry}. + * + * @tsl + * @type {AttributeNode} + */ +export const positionLocal: AttributeNode; +/** + * TSL object that represents the previous vertex position in local space of the current rendered object. + * Used in context of {@link VelocityNode} for rendering motion vectors. + * + * @tsl + * @type {AttributeNode} + */ +export const positionPrevious: AttributeNode; +/** + * TSL object that represents the vertex position in world space of the current rendered object. + * + * @tsl + * @type {VaryingNode} + */ +export const positionWorld: VaryingNode; +/** + * TSL object that represents the position world direction of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const positionWorldDirection: Node; +/** + * TSL object that represents the vertex position in view space of the current rendered object. + * + * @tsl + * @type {VaryingNode} + */ +export const positionView: VaryingNode; +/** + * TSL object that represents the position view direction of the current rendered object. + * + * @tsl + * @type {VaryingNode} + */ +export const positionViewDirection: VaryingNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts new file mode 100644 index 000000000..856e0f400 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts @@ -0,0 +1,141 @@ +export default ReferenceBaseNode; +export function reference(name: string, type: string, object: Object): ReferenceBaseNode; +export function referenceBuffer(name: string, type: string, count: number, object?: Object): ReferenceBaseNode; +/** + * Base class for nodes which establishes a reference to a property of another object. + * In this way, the value of the node is automatically linked to the value of + * referenced object. Reference nodes internally represent the linked value + * as a uniform. + * + * @augments Node + */ +declare class ReferenceBaseNode extends Node { + /** + * Constructs a new reference base node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} uniformType - The uniform type that should be used to represent the property value. + * @param {?Object} [object=null] - The object the property belongs to. + * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. + */ + constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); + /** + * The name of the property the node refers to. + * + * @type {string} + */ + property: string; + /** + * The uniform type that should be used to represent the property value. + * + * @type {string} + */ + uniformType: string; + /** + * The object the property belongs to. + * + * @type {?Object} + * @default null + */ + object: Object | null; + /** + * When the linked property is an array, this parameter defines its length. + * + * @type {?number} + * @default null + */ + count: number | null; + /** + * The property name might have dots so nested properties can be referred. + * The hierarchy of the names is stored inside this array. + * + * @type {Array} + */ + properties: Array; + /** + * Points to the current referred object. This property exists next to {@link ReferenceNode#object} + * since the final reference might be updated from calling code. + * + * @type {?Object} + * @default null + */ + reference: Object | null; + /** + * The uniform node that holds the value of the reference node. + * + * @type {UniformNode} + * @default null + */ + node: UniformNode; + /** + * The uniform group of the internal uniform. + * + * @type {UniformGroupNode} + * @default null + */ + group: UniformGroupNode; + /** + * Sets the uniform group for this reference node. + * + * @param {UniformGroupNode} group - The uniform group to set. + * @return {ReferenceBaseNode} A reference to this node. + */ + setGroup(group: UniformGroupNode): ReferenceBaseNode; + /** + * When the referred property is array-like, this method can be used + * to access elements via an index node. + * + * @param {IndexNode} indexNode - indexNode. + * @return {ReferenceElementNode} A reference to an element. + */ + element(indexNode: IndexNode): ReferenceElementNode; + /** + * Sets the node type which automatically defines the internal + * uniform type. + * + * @param {string} uniformType - The type to set. + */ + setNodeType(uniformType: string): void; + /** + * This method is overwritten since the node type is inferred from + * the type of the reference node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the property value from the given referred object. + * + * @param {Object} [object=this.reference] - The object to retrieve the property value from. + * @return {any} The value. + */ + getValueFromReference(object?: Object): any; + /** + * Allows to update the reference based on the given state. The state is only + * evaluated {@link ReferenceBaseNode#object} is not set. + * + * @param {(NodeFrame|NodeBuilder)} state - The current state. + * @return {Object} The updated reference. + */ + updateReference(state: (NodeFrame | NodeBuilder)): Object; + /** + * The output of the reference node is the internal uniform node. + * + * @return {UniformNode} The output node. + */ + setup(): UniformNode; + /** + * Overwritten to update the internal uniform value. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(): void; + /** + * Retrieves the value from the referred object property and uses it + * to updated the internal uniform. + */ + updateValue(): void; +} +import Node from '../core/Node.js'; +import ReferenceElementNode from './ReferenceElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts new file mode 100644 index 000000000..f46eabeb4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts @@ -0,0 +1,42 @@ +export default ReferenceElementNode; +/** + * This class is only relevant if the referenced property is array-like. + * In this case, `ReferenceElementNode` allows to refer to a specific + * element inside the data structure via an index. + * + * @augments ArrayElementNode + */ +declare class ReferenceElementNode extends ArrayElementNode { + /** + * Constructs a new reference element node. + * + * @param {(ReferenceBaseNode|ReferenceNode)} referenceNode - The reference node. + * @param {Node} indexNode - The index node that defines the element access. + */ + constructor(referenceNode: (ReferenceBaseNode | ReferenceNode), indexNode: Node); + /** + * Similar to {@link ReferenceNode#reference}, an additional + * property references to the current node. + * + * @type {?(ReferenceBaseNode|ReferenceNode)} + * @default null + */ + referenceNode: (ReferenceBaseNode | ReferenceNode) | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isReferenceElementNode: boolean; + /** + * This method is overwritten since the node type is inferred from + * the uniform type of the reference node. + * + * @return {string} The node type. + */ + generateNodeType(): string; + generate(builder: any): any; +} +import ArrayElementNode from '../utils/ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts new file mode 100644 index 000000000..c5aa93edd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts @@ -0,0 +1,157 @@ +export default ReferenceNode; +export function reference(name: string, type: string, object?: Object | null): ReferenceNode; +export function referenceBuffer(name: string, type: string, count: number, object: Object): ReferenceNode; +/** + * This type of node establishes a reference to a property of another object. + * In this way, the value of the node is automatically linked to the value of + * referenced object. Reference nodes internally represent the linked value + * as a uniform. + * + * @augments Node + */ +declare class ReferenceNode extends Node { + /** + * Constructs a new reference node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} uniformType - The uniform type that should be used to represent the property value. + * @param {?Object} [object=null] - The object the property belongs to. + * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. + */ + constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); + /** + * The name of the property the node refers to. + * + * @type {string} + */ + property: string; + /** + * The uniform type that should be used to represent the property value. + * + * @type {string} + */ + uniformType: string; + /** + * The object the property belongs to. + * + * @type {?Object} + * @default null + */ + object: Object | null; + /** + * When the linked property is an array, this parameter defines its length. + * + * @type {?number} + * @default null + */ + count: number | null; + /** + * The property name might have dots so nested properties can be referred. + * The hierarchy of the names is stored inside this array. + * + * @type {Array} + */ + properties: Array; + /** + * Points to the current referred object. This property exists next to {@link ReferenceNode#object} + * since the final reference might be updated from calling code. + * + * @type {?Object} + * @default null + */ + reference: Object | null; + /** + * The uniform node that holds the value of the reference node. + * + * @type {UniformNode} + * @default null + */ + node: UniformNode; + /** + * The uniform group of the internal uniform. + * + * @type {UniformGroupNode} + * @default null + */ + group: UniformGroupNode; + /** + * When the referred property is array-like, this method can be used + * to access elements via an index node. + * + * @param {IndexNode} indexNode - indexNode. + * @return {ReferenceElementNode} A reference to an element. + */ + element(indexNode: IndexNode): ReferenceElementNode; + /** + * Sets the uniform group for this reference node. + * + * @param {UniformGroupNode} group - The uniform group to set. + * @return {ReferenceNode} A reference to this node. + */ + setGroup(group: UniformGroupNode): ReferenceNode; + /** + * Sets the name for the internal uniform. + * + * @param {string} name - The label to set. + * @return {ReferenceNode} A reference to this node. + */ + setName(name: string): ReferenceNode; + /** + * Sets the label for the internal uniform. + * + * @deprecated + * @param {string} name - The label to set. + * @return {ReferenceNode} A reference to this node. + */ + label(name: string): ReferenceNode; + /** + * Sets the node type which automatically defines the internal + * uniform type. + * + * @param {string} uniformType - The type to set. + */ + setNodeType(uniformType: string): void; + /** + * This method is overwritten since the node type is inferred from + * the type of the reference node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the property value from the given referred object. + * + * @param {Object} [object=this.reference] - The object to retrieve the property value from. + * @return {any} The value. + */ + getValueFromReference(object?: Object): any; + /** + * Allows to update the reference based on the given state. The state is only + * evaluated {@link ReferenceNode#object} is not set. + * + * @param {(NodeFrame|NodeBuilder)} state - The current state. + * @return {Object} The updated reference. + */ + updateReference(state: (NodeFrame | NodeBuilder)): Object; + /** + * The output of the reference node is the internal uniform node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {UniformNode} The output node. + */ + setup(): UniformNode; + /** + * Overwritten to update the internal uniform value. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(): void; + /** + * Retrieves the value from the referred object property and uses it + * to updated the internal uniform. + */ + updateValue(): void; +} +import Node from '../core/Node.js'; +import ReferenceElementNode from './ReferenceElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts new file mode 100644 index 000000000..6cf15717c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts @@ -0,0 +1,28 @@ +/** + * The reflect vector in view space. + * + * @tsl + * @type {Node} + */ +export const reflectView: Node; +/** + * The refract vector in view space. + * + * @tsl + * @type {Node} + */ +export const refractView: Node; +/** + * Used for sampling cube maps when using cube reflection mapping. + * + * @tsl + * @type {Node} + */ +export const reflectVector: Node; +/** + * Used for sampling cube maps when using cube refraction mapping. + * + * @tsl + * @type {Node} + */ +export const refractVector: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts new file mode 100644 index 000000000..43bd3b071 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts @@ -0,0 +1,33 @@ +export default RendererReferenceNode; +export function rendererReference(name: string, type: string, renderer?: Renderer | null): RendererReferenceNode; +/** + * This node is a special type of reference node which is intended + * for linking renderer properties with node values. + * ```js + * const exposureNode = rendererReference( 'toneMappingExposure', 'float', renderer ); + * ``` + * When changing `renderer.toneMappingExposure`, the node value of `exposureNode` will + * automatically be updated. + * + * @augments ReferenceBaseNode + */ +declare class RendererReferenceNode extends ReferenceBaseNode { + /** + * Constructs a new renderer reference node. + * + * @param {string} property - The name of the property the node refers to. + * @param {string} inputType - The uniform type that should be used to represent the property value. + * @param {?Renderer} [renderer=null] - The renderer the property belongs to. When no renderer is set, + * the node refers to the renderer of the current state. + */ + constructor(property: string, inputType: string, renderer?: Renderer | null); + /** + * The renderer the property belongs to. When no renderer is set, + * the node refers to the renderer of the current state. + * + * @type {?Renderer} + * @default null + */ + renderer: Renderer | null; +} +import ReferenceBaseNode from './ReferenceBaseNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts new file mode 100644 index 000000000..12f6b0aef --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts @@ -0,0 +1,21 @@ +/** + * TSL object that represents the scene's background blurriness. + * + * @tsl + * @type {Node} + */ +export const backgroundBlurriness: Node; +/** + * TSL object that represents the scene's background intensity. + * + * @tsl + * @type {Node} + */ +export const backgroundIntensity: Node; +/** + * TSL object that represents the scene's background rotation. + * + * @tsl + * @type {Node} + */ +export const backgroundRotation: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts new file mode 100644 index 000000000..ca4dd3dff --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts @@ -0,0 +1,19 @@ +/** + * TSL function representing the standard skeletal animation vertex shader setup. + * Transforms positionLocal, normalLocal, and tangentLocal in-place. + * + * @tsl + * @function + * @param {SkinnedMesh} skinnedMesh - The skinned mesh. + */ +export const skinning: () => void; +/** + * TSL function that computes skeletal animation for custom compute passes. + * + * @tsl + * @function + * @param {SkinnedMesh} skinnedMesh - The skinned mesh. + * @param {Node} [toPosition=null] - The target position node to assign. + * @returns {Node} The computed skinned position node. + */ +export const computeSkinning: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts new file mode 100644 index 000000000..fea4f9cd4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts @@ -0,0 +1,183 @@ +export default StorageBufferNode; +export function storage(value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, type?: (string | Struct) | null, count?: number): StorageBufferNode; +/** + * This node is used in context of compute shaders and allows to define a + * storage buffer for data. A typical workflow is to create instances of + * this node with the convenience functions `attributeArray()` or `instancedArray()`, + * setup up a compute shader that writes into the buffers and then convert + * the storage buffers to attribute nodes for rendering. + * + * ```js + * const positionBuffer = instancedArray( particleCount, 'vec3' ); // the storage buffer node + * + * const computeInit = Fn( () => { // the compute shader + * + * const position = positionBuffer.element( instanceIndex ); + * + * // compute position data + * + * position.x = 1; + * position.y = 1; + * position.z = 1; + * + * } )().compute( particleCount ); + * + * const particleMaterial = new THREE.SpriteNodeMaterial(); + * particleMaterial.positionNode = positionBuffer.toAttribute(); + * + * renderer.computeAsync( computeInit ); + * + * ``` + * + * @augments BufferNode + */ +declare class StorageBufferNode extends BufferNode { + /** + * Constructs a new storage buffer node. + * + * @param {StorageBufferAttribute|StorageInstancedBufferAttribute|BufferAttribute} value - The buffer data. + * @param {?(string|Struct)} [bufferType=null] - The buffer type (e.g. `'vec3'`). + * @param {number} [bufferCount=0] - The buffer count. + */ + constructor(value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, bufferType?: (string | Struct) | null, bufferCount?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageBufferNode: boolean; + /** + * The buffer struct type. + * + * @type {?StructTypeNode} + * @default null + */ + structTypeNode: StructTypeNode | null; + /** + * The access type of the texture node. + * + * @type {string} + * @default 'readWrite' + */ + access: string; + /** + * Whether the node is atomic or not. + * + * @type {boolean} + * @default false + */ + isAtomic: boolean; + /** + * Whether the node represents a PBO or not. + * Only relevant for WebGL. + * + * @type {boolean} + * @default false + */ + isPBO: boolean; + /** + * A reference to the internal buffer attribute node. + * + * @private + * @type {?BufferAttributeNode} + * @default null + */ + private _attribute; + /** + * A reference to the internal varying node. + * + * @private + * @type {?VaryingNode} + * @default null + */ + private _varying; + /** + * This method is overwritten since the buffer data might be shared + * and thus the hash should be shared as well. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(builder: NodeBuilder): string; + /** + * Enables element access with the given index node. + * + * @param {IndexNode} indexNode - The index node. + * @return {StorageArrayElementNode} A node representing the element access. + */ + element(indexNode: IndexNode): StorageArrayElementNode; + /** + * Defines whether this node is a PBO or not. Only relevant for WebGL. + * + * @param {boolean} value - The value so set. + * @return {StorageBufferNode} A reference to this node. + */ + setPBO(value: boolean): StorageBufferNode; + /** + * Returns the `isPBO` value. + * + * @return {boolean} Whether the node represents a PBO or not. + */ + getPBO(): boolean; + /** + * Defines the node access. + * + * @param {string} value - The node access. + * @return {StorageBufferNode} A reference to this node. + */ + setAccess(value: string): StorageBufferNode; + /** + * Convenience method for configuring a read-only node access. + * + * @return {StorageBufferNode} A reference to this node. + */ + toReadOnly(): StorageBufferNode; + /** + * Defines whether the node is atomic or not. + * + * @param {boolean} value - The atomic flag. + * @return {StorageBufferNode} A reference to this node. + */ + setAtomic(value: boolean): StorageBufferNode; + /** + * Convenience method for making this node atomic. + * + * @return {StorageBufferNode} A reference to this node. + */ + toAtomic(): StorageBufferNode; + /** + * Returns attribute data for this storage buffer node. + * + * @return {{attribute: BufferAttributeNode, varying: VaryingNode}} The attribute data. + */ + getAttributeData(): { + attribute: BufferAttributeNode; + varying: VaryingNode; + }; + /** + * This method is overwritten since the node type from the availability of storage buffers + * and the attribute data. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the type of a member of the struct. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member. + * @return {string} The type of the member. + */ + getMemberType(builder: NodeBuilder, name: string): string; + /** + * Generates the code snippet of the storage buffer node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder): string; +} +import BufferNode from './BufferNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts new file mode 100644 index 000000000..72f129b88 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts @@ -0,0 +1,36 @@ +export default StorageTexture3DNode; +/** + * TSL function for creating a 3D storage texture node. + * + * @tsl + * @function + * @param {Storage3DTexture} value - The 3D storage texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. + * @returns {StorageTexture3DNode} + */ +export const storageTexture3D: any; +/** + * This special version of a texture node can be used to + * write data into a 3D storage texture with a compute shader. + * + * @augments StorageTextureNode + */ +declare class StorageTexture3DNode extends StorageTextureNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture3DNode: boolean; + /** + * Overwritten with an empty implementation since the `updateMatrix` flag is ignored + * for 3D textures. The uv transformation matrix is not applied to 3D textures. + * + * @param {boolean} value - The update toggle. + */ + setUpdateMatrix(): void; +} +import StorageTextureNode from './StorageTextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts new file mode 100644 index 000000000..f1ac56640 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts @@ -0,0 +1,146 @@ +export default StorageTextureNode; +/** + * TSL function for creating a storage texture node. + * + * @tsl + * @function + * @param {StorageTexture} value - The storage texture. + * @param {?Node} uvNode - The uv node. + * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. + * @returns {StorageTextureNode} + */ +export const storageTexture: any; +export function textureStore(value: StorageTexture | StorageTextureNode, uvNode: Node, storeNode?: Node | null): StorageTextureNode; +/** + * This special version of a texture node can be used to + * write data into a storage texture with a compute shader. + * + * ```js + * const storageTexture = new THREE.StorageTexture( width, height ); + * + * const computeTexture = Fn( ( { storageTexture } ) => { + * + * const posX = instanceIndex.mod( width ); + * const posY = instanceIndex.div( width ); + * const indexUV = uvec2( posX, posY ); + * + * // generate RGB values + * + * const r = 1; + * const g = 1; + * const b = 1; + * + * textureStore( storageTexture, indexUV, vec4( r, g, b, 1 ) ).toWriteOnly(); + * + * } ); + * + * const computeNode = computeTexture( { storageTexture } ).compute( width * height ); + * renderer.computeAsync( computeNode ); + * ``` + * + * This node can only be used with a WebGPU backend. + * + * @augments TextureNode + */ +declare class StorageTextureNode extends TextureNode { + /** + * Constructs a new storage texture node. + * + * @param {StorageTexture} value - The storage texture. + * @param {Node} uvNode - The uv node. + * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. + */ + constructor(value: StorageTexture, uvNode: Node, storeNode?: Node | null); + /** + * The value node that should be stored in the texture. + * + * @type {?Node} + * @default null + */ + storeNode: Node | null; + /** + * The mip level to write to for storage textures. + * + * @type {number} + * @default 0 + */ + mipLevel: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTextureNode: boolean; + /** + * The access type of the texture node. + * + * @type {string} + * @default 'writeOnly' + */ + access: string; + setup(builder: any): any; + /** + * Defines the node access. + * + * @param {string} value - The node access. + * @return {StorageTextureNode} A reference to this node. + */ + setAccess(value: string): StorageTextureNode; + /** + * Sets the mip level to write to. + * + * @param {number} level - The mip level. + * @return {StorageTextureNode} A reference to this node. + */ + setMipLevel(level: number): StorageTextureNode; + /** + * Generates the snippet for the storage texture. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} textureProperty - The texture property. + * @param {string} uvSnippet - The uv snippet. + * @param {?string} levelSnippet - The level snippet. + * @param {?string} biasSnippet - The bias snippet. + * @param {?string} depthSnippet - The depth snippet. + * @param {?string} compareSnippet - The compare snippet. + * @param {?Array} gradSnippet - The grad snippet. + * @param {?string} offsetSnippet - The offset snippet. + * @return {string} The generated code snippet. + */ + generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, offsetSnippet: string | null): string; + /** + * Convenience method for configuring a read/write node access. + * + * @return {StorageTextureNode} A reference to this node. + */ + toReadWrite(): StorageTextureNode; + /** + * Convenience method for configuring a read-only node access. + * + * @return {StorageTextureNode} A reference to this node. + */ + toReadOnly(): StorageTextureNode; + /** + * Convenience method for configuring a write-only node access. + * + * @return {StorageTextureNode} A reference to this node. + */ + toWriteOnly(): StorageTextureNode; + /** + * Stores a value in this storage texture at the given coordinates. + * + * @param {Node} uvNode - The storage texture coordinates. + * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. + * @return {StorageTextureNode} A storage texture node representing the store operation. + */ + store(uvNode: Node, storeNode?: Node | null): StorageTextureNode; + /** + * Generates the code snippet of the storage texture node. + * + * @param {NodeBuilder} builder - The current node builder. + */ + generateStore(builder: NodeBuilder): void; +} +import TextureNode from './TextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts new file mode 100644 index 000000000..fa48ada28 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts @@ -0,0 +1,28 @@ +/** + * TSL object that represents the tangent attribute of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const tangentGeometry: Node; +/** + * TSL object that represents the vertex tangent in local space of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const tangentLocal: Node; +/** + * TSL object that represents the vertex tangent in view space of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const tangentView: Node; +/** + * TSL object that represents the vertex tangent in world space of the current rendered object. + * + * @tsl + * @type {Node} + */ +export const tangentWorld: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts new file mode 100644 index 000000000..5ae231172 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts @@ -0,0 +1,20 @@ +/** + * Tangent vector in view space, computed dynamically from geometry and UV derivatives. + * Useful for normal mapping without precomputed tangents. + * + * Reference: http://www.thetenthplanet.de/archives/1180 + * + * @tsl + * @type {Node} + */ +export const tangentViewFrame: Node; +/** + * Bitangent vector in view space, computed dynamically from geometry and UV derivatives. + * Complements the tangentViewFrame for constructing the tangent space basis. + * + * Reference: http://www.thetenthplanet.de/archives/1180 + * + * @tsl + * @type {Node} + */ +export const bitangentViewFrame: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts new file mode 100644 index 000000000..1b1066b8b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts @@ -0,0 +1,54 @@ +export default Texture3DNode; +/** + * TSL function for creating a 3D texture node. + * + * @tsl + * @function + * @param {Data3DTexture} value - The 3D texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @returns {Texture3DNode} + */ +export const texture3D: any; +export function texture3DLoad(...params: any[]): TextureNode; +export function texture3DLevel(value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null): TextureNode; +/** + * This type of uniform node represents a 3D texture. + * + * @augments TextureNode + */ +declare class Texture3DNode extends TextureNode { + /** + * Constructs a new 3D texture node. + * + * @param {Data3DTexture} value - The 3D texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + */ + constructor(value: Data3DTexture, uvNode?: Node | null, levelNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTexture3DNode: boolean; + /** + * Overwritten with an empty implementation since the `updateMatrix` flag is ignored + * for 3D textures. The uv transformation matrix is not applied to 3D textures. + * + * @param {boolean} value - The update toggle. + */ + setUpdateMatrix(): void; + /** + * Computes the normal for the given uv. These texture coordiantes represent a + * position inside the 3D texture. Unlike geometric normals, this normal + * represents a slope or gradient of scalar data inside the 3D texture. + * + * @param {Node} uvNode - The uv node that defines a position in the 3D texture. + * @return {Node} The normal representing the slope/gradient in the data. + */ + normal(uvNode: Node): Node; +} +import TextureNode from './TextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts new file mode 100644 index 000000000..ff3a05aad --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts @@ -0,0 +1,20 @@ +/** + * Applies mipped bicubic texture filtering to the given texture node. + * + * @tsl + * @function + * @param {TextureNode} textureNode - The texture node that should be filtered. + * @param {Node} lodNode - Defines the LOD to sample from. + * @return {Node} The filtered texture sample. + */ +export const textureBicubicLevel: () => void; +/** + * Applies mipped bicubic texture filtering to the given texture node. + * + * @tsl + * @function + * @param {TextureNode} textureNode - The texture node that should be filtered. + * @param {Node} [strength] - Defines the strength of the bicubic filtering. + * @return {Node} The filtered texture sample. + */ +export const textureBicubic: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts new file mode 100644 index 000000000..76de67ef9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts @@ -0,0 +1,369 @@ +export default TextureNode; +export function texture(value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null): TextureNode; +export function uniformTexture(value?: Texture | null): TextureNode; +export function textureLoad(...params: any[]): TextureNode; +export function textureLevel(value: any, uv: any, level: any): TextureNode; +export function sampler(value: TextureNode | Texture): Node; +export function samplerComparison(value: TextureNode | Texture): Node; +/** + * This type of uniform node represents a 2D texture. + * + * @augments UniformNode + */ +declare class TextureNode extends UniformNode { + /** + * Constructs a new texture node. + * + * @param {Texture} [value=EmptyTexture] - The texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Node} [biasNode=null] - The bias node. + */ + constructor(value?: Texture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTextureNode: boolean; + /** + * Represents the texture coordinates. + * + * @type {?Node} + * @default null + */ + uvNode: Node | null; + /** + * Represents the mip level that should be selected. + * + * @type {?Node} + * @default null + */ + levelNode: Node | null; + /** + * Represents the bias to be applied during level-of-detail computation. + * + * @type {?Node} + * @default null + */ + biasNode: Node | null; + /** + * Represents a reference value a texture sample is compared to. + * + * @type {?Node} + * @default null + */ + compareNode: Node | null; + /** + * When using texture arrays, the depth node defines the layer to select. + * + * @type {?Node} + * @default null + */ + depthNode: Node | null; + /** + * When defined, a texture is sampled using explicit gradients. + * + * @type {?Array>} + * @default null + */ + gradNode: Array> | null; + /** + * Represents the optional index constant of the channel to gather. + * This must be in range [0, 3] and a compile-time constant. + * + * @type {?Node} + * @default null + */ + gatherNode: Node | null; + /** + * Represents the optional texel offset applied to the unnormalized texture + * coordinate before sampling the texture. + * + * @type {?Node} + * @default null + */ + offsetNode: Node | null; + /** + * Whether texture values should be sampled or fetched. + * + * @type {boolean} + * @default true + */ + sampler: boolean; + /** + * Whether the uv transformation matrix should be + * automatically updated or not. Use `setUpdateMatrix()` + * if you want to change the value of the property. + * + * @type {boolean} + * @default false + */ + updateMatrix: boolean; + /** + * The reference node. + * + * @type {?Node} + * @default null + */ + referenceNode: Node | null; + /** + * The texture value is stored in a private property. + * + * @private + * @type {Texture} + */ + private _value; + /** + * The uniform node that represents the uv transformation matrix. + * + * @private + * @type {?UniformNode} + * @default null + */ + private _matrixUniform; + /** + * The uniform node that represents the y-flip. Only required for WebGL. + * + * @private + * @type {?UniformNode} + * @default null + */ + private _flipYUniform; + /** + * Whether the node is used as a comparison sampler, e.g. via `samplerComparison()`. + * + * @private + * @type {boolean} + * @default false + */ + private _samplerComparison; + set value(value: Texture); + /** + * The texture value. + * + * @type {Texture} + */ + get value(): Texture; + /** + * Overwritten since the uniform hash is defined by the texture's UUID. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The uniform hash. + */ + getUniformHash(): string; + /** + * Overwritten since the node type is inferred from the texture type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(): string; + /** + * Overwrites the default implementation to return a fixed value `'texture'`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; + /** + * Returns a default uvs based on the current texture's channel. + * + * @return {AttributeNode} The default uvs. + */ + getDefaultUV(): AttributeNode; + /** + * Overwritten to always return the texture reference of the node. + * + * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. + * @return {Texture} The texture reference. + */ + updateReference(): Texture; + /** + * Transforms the given uv node with the texture transformation matrix. + * + * @param {Node} uvNode - The uv node to transform. + * @return {Node} The transformed uv node. + */ + getTransformedUV(uvNode: Node): Node; + /** + * Defines whether the uv transformation matrix should automatically be updated or not. + * + * @param {boolean} value - The update toggle. + * @return {TextureNode} A reference to this node. + */ + setUpdateMatrix(value: boolean): TextureNode; + /** + * Setups the uv node. Depending on the backend as well as texture's image and type, it might be necessary + * to modify the uv node for correct sampling. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} uvNode - The uv node to setup. + * @return {Node} The updated uv node. + */ + setupUV(builder: NodeBuilder, uvNode: Node): Node; + /** + * Setups texture node by preparing the internal nodes for code generation. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * Generates the uv code snippet. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} uvNode - The uv node to generate code for. + * @return {string} The generated code snippet. + */ + generateUV(builder: NodeBuilder, uvNode: Node): string; + /** + * Generates the offset code snippet. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {Node} offsetNode - The offset node to generate code for. + * @return {string} The generated code snippet. + */ + generateOffset(builder: NodeBuilder, offsetNode: Node): string; + /** + * Generates the snippet for the texture sampling. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} textureProperty - The texture property. + * @param {string} uvSnippet - The uv snippet. + * @param {?string} levelSnippet - The level snippet. + * @param {?string} biasSnippet - The bias snippet. + * @param {?string} depthSnippet - The depth snippet. + * @param {?string} compareSnippet - The compare snippet. + * @param {?Array} gradSnippet - The grad snippet. + * @param {?string} gatherSnippet - The gather snippet. + * @param {?string} offsetSnippet - The offset snippet. + * @param {?string} flipYSnippet - The y-flip snippet. Only used for WebGL. + * @return {string} The generated code snippet. + */ + generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, gatherSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; + /** + * Generates the code snippet of the texture node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} output - The current output. + * @return {string} The generated code snippet. + */ + generate(builder: NodeBuilder, output: string): string; + /** + * Sets the sampler value. + * + * @param {boolean} value - The sampler value to set. + * @return {TextureNode} A reference to this texture node. + */ + setSampler(value: boolean): TextureNode; + /** + * Returns the sampler value. + * + * @return {boolean} The sampler value. + */ + getSampler(): boolean; + /** + * Samples the texture with the given uv node. + * + * @param {Node} uvNode - The uv node. + * @return {TextureNode} A texture node representing the texture sample. + */ + sample(uvNode: Node): TextureNode; + /** + * TSL function for creating a texture node that fetches/loads texels without interpolation. + * + * @param {Node} uvNode - The uv node. + * @returns {TextureNode} A texture node representing the texture load. + */ + load(uvNode: Node): TextureNode; + /** + * Samples a blurred version of the texture by defining an internal bias. + * + * @param {Node} amountNode - How blurred the texture should be. + * @return {TextureNode} A texture node representing the texture sample. + */ + blur(amountNode: Node): TextureNode; + /** + * Samples a specific mip of the texture. + * + * @param {Node} levelNode - The mip level to sample. + * @return {TextureNode} A texture node representing the texture sample. + */ + level(levelNode: Node): TextureNode; + /** + * Returns the texture size of the requested level. + * + * @param {Node} levelNode - The level to compute the size for. + * @return {TextureSizeNode} The texture size. + */ + size(levelNode: Node): TextureSizeNode; + /** + * Samples the texture with the given bias. + * + * @param {Node} biasNode - The bias node. + * @return {TextureNode} A texture node representing the texture sample. + */ + bias(biasNode: Node): TextureNode; + /** + * Returns the base texture of this node. + * @return {TextureNode} The base texture node. + */ + getBase(): TextureNode; + /** + * Samples the texture by executing a compare operation. + * + * @param {Node} compareNode - The node that defines the compare value. + * @return {TextureNode} A texture node representing the texture sample. + */ + compare(compareNode: Node): TextureNode; + /** + * Samples the texture using an explicit gradient. + * + * @param {Node} gradNodeX - The gradX node. + * @param {Node} gradNodeY - The gradY node. + * @return {TextureNode} A texture node representing the texture sample. + */ + grad(gradNodeX: Node, gradNodeY: Node): TextureNode; + /** + * Gathers four texels from the texture. + * + * @param {Node} gatherNode - The index of the channel to read. This must be in range [0, 3] and a compile-time constant. + * @return {TextureNode} A texture node representing the texture sample. + */ + gather(gatherNode?: Node): TextureNode; + /** + * Returns `true` if the texture is sampled with a depth comparison, + * meaning the node must be bound with a comparison sampler. + * + * @return {boolean} Whether comparison sampling is used or not. + */ + isSampleCompare(): boolean; + /** + * Samples the texture by defining a depth node. + * + * @param {Node} depthNode - The depth node. + * @return {TextureNode} A texture node representing the texture sample. + */ + depth(depthNode: Node): TextureNode; + /** + * Samples the texture by defining an offset node. + * + * @param {Node} offsetNode - The offset node. + * @return {TextureNode} A texture node representing the texture sample. + */ + offset(offsetNode: Node): TextureNode; + /** + * The update is used to implement the update of the uv transformation matrix. + */ + update(): void; + /** + * Clones the texture node. + * + * @return {TextureNode} The cloned texture node. + */ + clone(): TextureNode; +} +import { Texture } from '../../textures/Texture.js'; +import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts new file mode 100644 index 000000000..e8ddf1c81 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts @@ -0,0 +1,50 @@ +export default TextureSizeNode; +/** + * TSL function for creating a texture size node. + * + * @tsl + * @function + * @param {TextureNode} textureNode - A texture node which size should be retrieved. + * @param {?Node} [levelNode=null] - A level node which defines the requested mip. + * @returns {TextureSizeNode} + */ +export const textureSize: any; +/** + * A node that represents the dimensions of a texture. The texture size is + * retrieved in the shader via built-in shader functions like `textureDimensions()` + * or `textureSize()`. + * + * @augments Node + */ +declare class TextureSizeNode extends Node { + /** + * Constructs a new texture size node. + * + * @param {TextureNode} textureNode - A texture node which size should be retrieved. + * @param {?Node} [levelNode=null] - A level node which defines the requested mip. + */ + constructor(textureNode: TextureNode, levelNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTextureSizeNode: boolean; + /** + * A texture node which size should be retrieved. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * A level node which defines the requested mip. + * + * @type {Node} + * @default null + */ + levelNode: Node; + generate(builder: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts new file mode 100644 index 000000000..959b2be65 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts @@ -0,0 +1 @@ +export function uv(index?: number): AttributeNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts new file mode 100644 index 000000000..ade6a8e94 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts @@ -0,0 +1,132 @@ +export default UniformArrayNode; +export function uniformArray(values: Array, nodeType?: string | null): UniformArrayNode; +/** + * Similar to {@link BufferNode} this module represents array-like data as + * uniform buffers. Unlike {@link BufferNode}, it can handle more common + * data types in the array (e.g `three.js` primitives) and automatically + * manage buffer padding. It should be the first choice when working with + * uniforms buffers. + * ```js + * const tintColors = uniformArray( [ + * new Color( 1, 0, 0 ), + * new Color( 0, 1, 0 ), + * new Color( 0, 0, 1 ) + * ], 'color' ); + * + * const redColor = tintColors.element( 0 ); + * + * @augments BufferNode + */ +declare class UniformArrayNode extends BufferNode { + /** + * Constructs a new uniform array node. + * + * @param {Array} value - Array holding the buffer data. + * @param {?string} [elementType=null] - The data type of a buffer element. + */ + constructor(value: Array, elementType?: string | null); + /** + * Array holding the buffer data. Unlike {@link BufferNode}, the array can + * hold number primitives as well as three.js objects like vectors, matrices + * or colors. + * + * @type {Array} + */ + array: Array; + /** + * The data type of an array element. + * + * @type {string} + */ + elementType: string; + /** + * The padded type. Uniform buffers must conform to a certain buffer layout + * so a separate type is computed to ensure correct buffer size. + * + * @type {string} + */ + paddedType: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayBufferNode: boolean; + /** + * This method is overwritten since the node type is inferred from the + * {@link UniformArrayNode#paddedType}. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(): string; + /** + * The data type of the array elements. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The element type. + */ + getElementType(): string; + /** + * Returns the padded type based on the element type. + * + * @return {string} The padded type. + */ + getPaddedType(): string; + update(): void; + /** + * Composes a user-defined update with the buffer transfer. + * + * @param {Function} callback - The update function. + * @param {string} updateType - The update type. + * @return {UniformArrayNode} A reference to this node. + */ + onUpdate(callback: Function, updateType: string): UniformArrayNode; + /** + * The method makes sure to correctly transfer the data from the (complex) objects + * in the array to the internal, correctly padded value buffer. + */ + updateBuffer(): void; + /** + * Implement the value buffer creation based on the array data. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {null} + */ + setup(builder: NodeBuilder): null; + /** + * Overwrites the default `element()` method to provide element access + * based on {@link UniformArrayNode}. + * + * @param {IndexNode} indexNode - The index node. + * @return {UniformArrayElementNode} + */ + element(indexNode: IndexNode): UniformArrayElementNode; +} +import BufferNode from './BufferNode.js'; +/** + * Represents the element access on uniform array nodes. + * + * @augments ArrayElementNode + */ +declare class UniformArrayElementNode extends ArrayElementNode { + /** + * Constructs a new buffer node. + * + * @param {UniformArrayNode} uniformArrayNode - The uniform array node to access. + * @param {IndexNode} indexNode - The index data that define the position of the accessed element in the array. + */ + constructor(uniformArrayNode: UniformArrayNode, indexNode: IndexNode); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayBufferElementNode: boolean; + generate(builder: any): any; +} +import ArrayElementNode from '../utils/ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts new file mode 100644 index 000000000..e526f57c7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts @@ -0,0 +1,35 @@ +export default UserDataNode; +export function userData(name: string, inputType: string, userData: Object | null): UserDataNode; +/** + * A special type of reference node that allows to link values in + * `userData` fields to node objects. + * ```js + * sprite.userData.rotation = 1; // stores individual rotation per sprite + * + * const material = new THREE.SpriteNodeMaterial(); + * material.rotationNode = userData( 'rotation', 'float' ); + * ``` + * Since `UserDataNode` is extended from {@link ReferenceNode}, the node value + * will automatically be updated when the `rotation` user data field changes. + * + * @augments ReferenceNode + */ +declare class UserDataNode extends ReferenceNode { + /** + * Constructs a new user data node. + * + * @param {string} property - The property name that should be referenced by the node. + * @param {string} inputType - The node data type of the reference. + * @param {?Object} [userData=null] - A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated. + */ + constructor(property: string, inputType: string, userData?: Object | null); + /** + * A reference to the `userData` object. If not provided, the `userData` + * property of the 3D object that uses the node material is evaluated. + * + * @type {?Object} + * @default null + */ + userData: Object | null; +} +import ReferenceNode from './ReferenceNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts new file mode 100644 index 000000000..476ee206d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts @@ -0,0 +1,79 @@ +export default VelocityNode; +/** + * TSL object that represents the velocity of a render pass. + * + * @tsl + * @type {VelocityNode} + */ +export const velocity: VelocityNode; +/** + * A node for representing motion or velocity vectors. Foundation + * for advanced post processing effects like motion blur or TRAA. + * + * The node keeps track of the model, view and projection matrices + * of the previous frame and uses them to compute offsets in NDC space. + * These offsets represent the final velocity. + * + * @augments TempNode + */ +declare class VelocityNode extends TempNode { + /** + * Constructs a new vertex color node. + */ + constructor(); + /** + * The current projection matrix. + * + * @type {?Matrix4} + * @default null + */ + projectionMatrix: Matrix4 | null; + /** + * Uniform node representing the previous model matrix in world space. + * + * @type {UniformNode} + * @default null + */ + previousModelWorldMatrix: UniformNode; + /** + * Uniform node representing the previous projection matrix. + * + * @type {UniformNode} + * @default null + */ + previousProjectionMatrix: UniformNode; + /** + * Uniform node representing the previous view matrix. + * + * @type {UniformNode} + * @default null + */ + previousCameraViewMatrix: UniformNode; + /** + * Sets the given projection matrix. + * + * @param {Matrix4} projectionMatrix - The projection matrix to set. + */ + setProjectionMatrix(projectionMatrix: Matrix4): void; + /** + * Updates velocity specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update({ frameId, camera, object }: NodeFrame): void; + /** + * Overwritten to updated velocity specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateAfter({ object }: NodeFrame): void; + /** + * Implements the velocity computation based on the previous and current vertex data. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Node} The motion vector. + */ + setup(): Node; +} +import TempNode from '../core/TempNode.js'; +import { Matrix4 } from '../../math/Matrix4.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts new file mode 100644 index 000000000..c55c763bd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts @@ -0,0 +1,31 @@ +export default VertexColorNode; +export function vertexColor(index?: number): VertexColorNode; +/** + * An attribute node for representing vertex colors. + * + * @augments AttributeNode + */ +declare class VertexColorNode extends AttributeNode { + /** + * Constructs a new vertex color node. + * + * @param {number} index - The attribute index. + */ + constructor(index: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVertexColorNode: boolean; + /** + * The attribute index to enable more than one sets of vertex colors. + * + * @type {number} + * @default 0 + */ + index: number; +} +import AttributeNode from '../core/AttributeNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts new file mode 100644 index 000000000..13ca56a3d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts @@ -0,0 +1,79 @@ +export default CodeNode; +/** + * TSL function for creating a code node. + * + * @tsl + * @function + * @param {string} [code] - The native code. + * @param {?Array} [includes=[]] - An array of includes. + * @param {?('js'|'wgsl'|'glsl')} [language=''] - The used language. + * @returns {CodeNode} + */ +export const code: any; +export function js(src: string, includes: Array): CodeNode; +export function wgsl(src: string, includes: Array): CodeNode; +export function glsl(src: string, includes: Array): CodeNode; +/** + * This class represents native code sections. It is the base + * class for modules like {@link FunctionNode} which allows to implement + * functions with native shader languages. + * + * @augments Node + */ +declare class CodeNode extends Node { + /** + * Constructs a new code node. + * + * @param {string} [code=''] - The native code. + * @param {Array} [includes=[]] - An array of includes. + * @param {('js'|'wgsl'|'glsl')} [language=''] - The used language. + */ + constructor(code?: string, includes?: Array, language?: ("js" | "wgsl" | "glsl")); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCodeNode: boolean; + /** + * The native code. + * + * @type {string} + * @default '' + */ + code: string; + /** + * An array of includes + * + * @type {Array} + * @default [] + */ + includes: Array; + /** + * The used language. + * + * @type {('js'|'wgsl'|'glsl')} + * @default '' + */ + language: ("js" | "wgsl" | "glsl"); + /** + * Sets the includes of this code node. + * + * @param {Array} includes - The includes to set. + * @return {CodeNode} A reference to this node. + */ + setIncludes(includes: Array): CodeNode; + /** + * Returns the includes of this code node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Array} The includes. + */ + getIncludes(): Array; + generate(builder: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts new file mode 100644 index 000000000..47f1180ff --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts @@ -0,0 +1,35 @@ +export default ExpressionNode; +/** + * TSL function for creating an expression node. + * + * @tsl + * @function + * @param {string} [snippet] - The native code snippet. + * @param {?string} [nodeType='void'] - The node type. + * @returns {ExpressionNode} + */ +export const expression: any; +/** + * This class can be used to implement basic expressions in shader code. + * Basic examples for that are `return`, `continue` or `discard` statements. + * + * @augments Node + */ +declare class ExpressionNode extends Node { + /** + * Constructs a new expression node. + * + * @param {string} [snippet=''] - The native code snippet. + * @param {string} [nodeType='void'] - The node type. + */ + constructor(snippet?: string, nodeType?: string); + /** + * The native code snippet. + * + * @type {string} + * @default '' + */ + snippet: string; + generate(builder: any, output: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts new file mode 100644 index 000000000..38783b5a5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts @@ -0,0 +1,70 @@ +export default FunctionCallNode; +export function call(func: any, ...params: any[]): FunctionCallNode; +/** + * This module represents the call of a {@link FunctionNode}. Developers are usually not confronted + * with this module since they use the predefined TSL syntax `wgslFn` and `glslFn` which encapsulate + * this logic. + * + * @augments TempNode + */ +declare class FunctionCallNode extends TempNode { + /** + * Constructs a new function call node. + * + * @param {?FunctionNode} functionNode - The function node. + * @param {Object} [parameters={}] - The parameters for the function call. + */ + constructor(functionNode?: FunctionNode | null, parameters?: { + [x: string]: Node; + }); + /** + * The function node. + * + * @type {?FunctionNode} + * @default null + */ + functionNode: FunctionNode | null; + /** + * The parameters of the function call. + * + * @type {Object} + * @default {} + */ + parameters: { + [x: string]: Node; + }; + /** + * Sets the parameters of the function call node. + * + * @param {Object} parameters - The parameters to set. + * @return {FunctionCallNode} A reference to this node. + */ + setParameters(parameters: { + [x: string]: Node; + }): FunctionCallNode; + /** + * Returns the parameters of the function call node. + * + * @return {Object} The parameters of this node. + */ + getParameters(): { + [x: string]: Node; + }; + /** + * Returns the type of this function call node. + * + * @param {NodeBuilder} builder - The current node builder. + * @returns {string} The type of this node. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the function node of this function call node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} [name] - The name of the member. + * @returns {string} The type of the member. + */ + getMemberType(builder: NodeBuilder, name?: string): string; + generate(builder: any): string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts new file mode 100644 index 000000000..d17722e1f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts @@ -0,0 +1,70 @@ +export default FunctionNode; +export function glslFn(code: any, includes: any): any; +export function wgslFn(code: any, includes: any): any; +/** + * This class represents a native shader function. It can be used to implement + * certain aspects of a node material with native shader code. There are two predefined + * TSL functions for easier usage. + * + * - `wgslFn`: Creates a WGSL function node. + * - `glslFn`: Creates a GLSL function node. + * + * A basic example with one include looks like so: + * + * ```js + * const desaturateWGSLFn = wgslFn( ` + * fn desaturate( color:vec3 ) -> vec3 { + * let lum = vec3( 0.299, 0.587, 0.114 ); + * return vec3( dot( lum, color ) ); + * }` + *); + * const someWGSLFn = wgslFn( ` + * fn someFn( color:vec3 ) -> vec3 { + * return desaturate( color ); + * } + * `, [ desaturateWGSLFn ] ); + * material.colorNode = someWGSLFn( { color: texture( map ) } ); + *``` + * @augments CodeNode + */ +declare class FunctionNode extends CodeNode { + /** + * Constructs a new function node. + * + * @param {string} [code=''] - The native code. + * @param {Array} [includes=[]] - An array of includes. + * @param {('js'|'wgsl'|'glsl')} [language=''] - The used language. + */ + constructor(code?: string, includes?: Array, language?: ("js" | "wgsl" | "glsl")); + /** + * Returns the type of this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the type of a member of this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member. + * @return {string} The type of the member. + */ + getMemberType(builder: NodeBuilder, name: string): string; + /** + * Returns the inputs of this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Array} The inputs. + */ + getInputs(builder: NodeBuilder): Array; + /** + * Returns the node function for this function node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {NodeFunction} The node function. + */ + getNodeFunction(builder: NodeBuilder): NodeFunction; + generate(builder: any, output: any): any; +} +import CodeNode from './CodeNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts new file mode 100644 index 000000000..41339a0bd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts @@ -0,0 +1,76 @@ +export default ArrayNode; +export function array(...params: any[]): ArrayNode; +/** + * ArrayNode represents a collection of nodes, typically created using the {@link array} function. + * ```js + * const colors = array( [ + * vec3( 1, 0, 0 ), + * vec3( 0, 1, 0 ), + * vec3( 0, 0, 1 ) + * ] ); + * + * const redColor = tintColors.element( 0 ); + * ``` + * + * @augments TempNode + */ +declare class ArrayNode extends TempNode { + /** + * Constructs a new array node. + * + * @param {?string} nodeType - The data type of the elements. + * @param {number} count - Size of the array. + * @param {?Array} [values=null] - Array default values. + */ + constructor(nodeType: string | null, count: number, values?: Array | null); + /** + * Array size. + * + * @type {number} + */ + count: number; + /** + * Array default values. + * + * @type {?Array} + */ + values: Array | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayNode: boolean; + /** + * Returns the number of elements in the node array. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {number} The number of elements in the node array. + */ + getArrayCount(): number; + /** + * Returns the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The type of the node. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the type of a member variable. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member variable. + * @return {string} The type of the member variable. + */ + getMemberType(builder: NodeBuilder, name: string): string; + /** + * This method builds the output node and returns the resulting array as a shader string. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated shader string. + */ + generate(builder: NodeBuilder): string; +} +import TempNode from './TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts new file mode 100644 index 000000000..3f1ab4808 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts @@ -0,0 +1,65 @@ +export default AssignNode; +/** + * TSL function for creating an assign node. + * + * @tsl + * @function + * @param {Node} targetNode - The target node. + * @param {Node} sourceNode - The source type. + * @returns {AssignNode} + */ +export const assign: any; +/** + * These node represents an assign operation. Meaning a node is assigned + * to another node. + * + * @augments TempNode + */ +declare class AssignNode extends TempNode { + /** + * Constructs a new assign node. + * + * @param {Node} targetNode - The target node. + * @param {Node} sourceNode - The source type. + */ + constructor(targetNode: Node, sourceNode: Node); + /** + * The target node. + * + * @type {Node} + */ + targetNode: Node; + /** + * The source node. + * + * @type {Node} + */ + sourceNode: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAssignNode: boolean; + /** + * Whether this node is used more than once in context of other nodes. This method + * is overwritten since it always returns `false` (assigns are unique). + * + * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. Always `false`. + */ + hasDependencies(): boolean; + generateNodeType(builder: any, output: any): any; + /** + * Whether a split is required when assigning source to target. This can happen when the component length of + * target and source data type does not match. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether a split is required when assigning source to target. + */ + needsSplitAssign(builder: NodeBuilder): boolean; + setup(builder: any): void; + generate(builder: any, output: any): any; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts new file mode 100644 index 000000000..0f8b0bf15 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts @@ -0,0 +1,41 @@ +export default AttributeNode; +export function attribute(name: string, nodeType?: string | null): AttributeNode; +/** + * Base class for representing shader attributes as nodes. + * + * @augments Node + */ +declare class AttributeNode extends Node { + /** + * Constructs a new attribute node. + * + * @param {string} attributeName - The name of the attribute. + * @param {?string} nodeType - The node type. + */ + constructor(attributeName: string, nodeType?: string | null); + _attributeName: string; + getHash(builder: any): string; + generateNodeType(builder: any): string | null; + /** + * Sets the attribute name to the given value. The method can be + * overwritten in derived classes if the final name must be computed + * analytically. + * + * @param {string} attributeName - The name of the attribute. + * @return {AttributeNode} A reference to this node. + */ + setAttributeName(attributeName: string): AttributeNode; + /** + * Returns the attribute name of this node. The method can be + * overwritten in derived classes if the final name must be computed + * analytically. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The attribute name. + */ + getAttributeName(): string; + generate(builder: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts new file mode 100644 index 000000000..db68f52f5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts @@ -0,0 +1,54 @@ +export default BypassNode; +/** + * TSL function for creating a bypass node. + * + * @tsl + * @function + * @param {Node} outputNode - The output node. + * @param {Node} callNode - The call node. + * @returns {BypassNode} + */ +export const bypass: any; +/** + * The class generates the code of a given node but returns another node in the output. + * This can be used to call a method or node that does not return a value, i.e. + * type `void` on an input where returning a value is required. Example: + * + * ```js + * material.colorNode = myColor.bypass( runVoidFn() ) + *``` + * + * @augments Node + */ +declare class BypassNode extends Node { + /** + * Constructs a new bypass node. + * + * @param {Node} outputNode - The output node. + * @param {Node} callNode - The call node. + */ + constructor(outputNode: Node, callNode: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBypassNode: boolean; + /** + * The output node. + * + * @type {Node} + */ + outputNode: Node; + /** + * The call node. + * + * @type {Node} + */ + callNode: Node; + generateNodeType(builder: any): string; + generate(builder: any): string | Node | null; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts new file mode 100644 index 000000000..f26ae9eb3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts @@ -0,0 +1,25 @@ +export default ConstNode; +/** + * Class for representing a constant value in the shader. + * + * @augments InputNode + */ +declare class ConstNode extends InputNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isConstNode: boolean; + /** + * Generates the shader string of the value with the current node builder. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The generated value as a shader string. + */ + generateConst(builder: NodeBuilder): string; + generate(builder: any, output: any): any; +} +import InputNode from './InputNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts new file mode 100644 index 000000000..08ff51454 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts @@ -0,0 +1,107 @@ +/** + * TSL function for defining a built-in shadow context for a given node. + * + * @tsl + * @function + * @param {ShadowNode} shadowNode - The shadow node representing the light's shadow. + * @param {Light} light - The light associated with the shadow. + * @param {Node} [node=null] - The node whose context should be modified. + * @returns {ContextNode} + */ +export function builtinShadowContext(shadowNode: ShadowNode, light: Light, node?: Node): ContextNode; +/** + * TSL function for defining a built-in ambient occlusion context for a given node. + * + * @tsl + * @function + * @param {Node} aoNode - The ambient occlusion value node to apply. + * @param {Node} [node=null] - The node whose context should be modified. + * @returns {ContextNode} + */ +export function builtinAOContext(aoNode: Node, node?: Node): ContextNode; +/** + * TSL function for defining a label context value for a given node. + * + * @tsl + * @function + * @deprecated + * @param {Node} node - The node whose context should be modified. + * @param {string} name - The name/label to set. + * @returns {ContextNode} + */ +export function label(node: Node, name: string): ContextNode; +export default ContextNode; +export function context(nodeOrValue?: Node | Object, value?: Object): ContextNode; +export function uniformFlow(node: Node): ContextNode; +export function setName(node: Node, name: string): ContextNode; +import Node from './Node.js'; +/** + * This node can be used as a context management component for another node. + * {@link NodeBuilder} performs its node building process in a specific context and + * this node allows the modify the context. A typical use case is to overwrite `getUV()` e.g.: + * + * ```js + *node.context( { getUV: () => customCoord } ); + *\// or + *material.contextNode = context( { getUV: () => customCoord } ); + *\// or + *renderer.contextNode = context( { getUV: () => customCoord } ); + *\// or + *scenePass.contextNode = context( { getUV: () => customCoord } ); + *``` + * @augments Node + */ +declare class ContextNode extends Node { + /** + * Constructs a new context node. + * + * @param {Node} node - The node whose context should be modified. + * @param {Object} [value={}] - The modified context data. + */ + constructor(node?: Node, value?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isContextNode: boolean; + /** + * The node whose context should be modified. + * + * @type {Node} + */ + node: Node; + /** + * The modified context data. + * + * @type {Object} + * @default {} + */ + value: Object; + /** + * This method is overwritten to ensure it returns the type of {@link ContextNode#node}. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Gathers the context data from all parent context nodes. + * + * @return {Object} The gathered context data. + */ + getFlowContextData(): Object; + /** + * This method is overwritten to ensure it returns the member type of {@link ContextNode#node}. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The member name. + * @returns {string} The member type. + */ + getMemberType(builder: NodeBuilder, name: string): string; + analyze(builder: any): void; + setup(builder: any): string | Node | null; + generate(builder: any, output: any): string | Node | null; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts new file mode 100644 index 000000000..6117487c5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts @@ -0,0 +1,88 @@ +export default IndexNode; +/** + * TSL object that represents the index of a vertex within a mesh. + * + * @tsl + * @type {IndexNode} + */ +export const vertexIndex: IndexNode; +/** + * TSL object that represents the index of either a mesh instance or an invocation of a compute shader. + * + * @tsl + * @type {IndexNode} + */ +export const instanceIndex: IndexNode; +/** + * TSL object that represents the index of the subgroup the current compute invocation belongs to. + * + * @tsl + * @type {IndexNode} + */ +export const subgroupIndex: IndexNode; +/** + * TSL object that represents the index of a compute invocation within the scope of a subgroup. + * + * @tsl + * @type {IndexNode} + */ +export const invocationSubgroupIndex: IndexNode; +/** + * TSL object that represents the index of a compute invocation within the scope of a workgroup load. + * + * @tsl + * @type {IndexNode} + */ +export const invocationLocalIndex: IndexNode; +/** + * TSL object that represents the index of a draw call. + * + * @tsl + * @type {IndexNode} + */ +export const drawIndex: IndexNode; +/** + * This class represents shader indices of different types. The following predefined node + * objects cover frequent use cases: + * + * - `vertexIndex`: The index of a vertex within a mesh. + * - `instanceIndex`: The index of either a mesh instance or an invocation of a compute shader. + * - `drawIndex`: The index of a draw call. + * - `invocationLocalIndex`: The index of a compute invocation within the scope of a workgroup load. + * - `invocationSubgroupIndex`: The index of a compute invocation within the scope of a subgroup. + * - `subgroupIndex`: The index of a compute invocation's subgroup within its workgroup. + * + * @augments Node + */ +declare class IndexNode extends Node { + /** + * Constructs a new index node. + * + * @param {('vertex'|'instance'|'subgroup'|'invocationLocal'|'invocationGlobal'|'invocationSubgroup'|'draw')} scope - The scope of the index node. + */ + constructor(scope: ("vertex" | "instance" | "subgroup" | "invocationLocal" | "invocationGlobal" | "invocationSubgroup" | "draw")); + /** + * The scope of the index node. + * + * @type {string} + */ + scope: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isIndexNode: boolean; + generate(builder: any): any; +} +declare namespace IndexNode { + let VERTEX: string; + let INSTANCE: string; + let SUBGROUP: string; + let INVOCATION_LOCAL: string; + let INVOCATION_SUBGROUP: string; + let DRAW: string; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts new file mode 100644 index 000000000..fc285a964 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts @@ -0,0 +1,61 @@ +export default InputNode; +/** + * Base class for representing data input nodes. + * + * @augments Node + */ +declare class InputNode extends Node { + /** + * Constructs a new input node. + * + * @param {any} value - The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). + * @param {?string} nodeType - The node type. If no explicit type is defined, the node tries to derive the type from its value. + */ + constructor(value: any, nodeType?: string | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInputNode: boolean; + /** + * The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). + * + * @type {any} + */ + value: any; + /** + * The precision of the value in the shader. + * + * @type {?('low'|'medium'|'high')} + * @default null + */ + precision: ("low" | "medium" | "high") | null; + generateNodeType(): string | null; + /** + * Returns the input type of the node which is by default the node type. Derived modules + * might overwrite this method and use a fixed type or compute one analytically. + * + * A typical example for different input and node types are textures. The input type of a + * normal RGBA texture is `texture` whereas its node type is `vec4`. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(builder: NodeBuilder): string; + /** + * Sets the precision to the given value. The method can be + * overwritten in derived classes if the final precision must be computed + * analytically. + * + * @param {('low'|'medium'|'high')} precision - The precision of the input value in the shader. + * @return {InputNode} A reference to this node. + */ + setPrecision(precision: ("low" | "medium" | "high")): InputNode; + serialize(data: any): void; + deserialize(data: any): void; + generate(): void; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts new file mode 100644 index 000000000..4671327d0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts @@ -0,0 +1,57 @@ +/** + * Creates an inspector node to wrap around a given node for inspection purposes. + * + * @tsl + * @param {Node} node - The node to inspect. + * @param {string} [name=''] - Optional name for the inspector node. + * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. + * @returns {Node} The inspector node. + */ +export function inspect(node: Node, name?: string, callback?: Function | null): Node; +export default InspectorNode; +import Node from './Node.js'; +/** + * InspectorNode is a wrapper node that allows inspection of node values during rendering. + * It can be used to debug or analyze node outputs in the rendering pipeline. + * + * @augments Node + */ +declare class InspectorNode extends Node { + /** + * Creates an InspectorNode. + * + * @param {Node} node - The node to inspect. + * @param {string} [name=''] - Optional name for the inspector node. + * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. + */ + constructor(node: Node, name?: string, callback?: Function | null); + node: Node; + callback: Function | null; + isInspectorNode: boolean; + /** + * Returns the name of the inspector node. + * + * @returns {string} + */ + getName(): string; + /** + * Updates the inspector node, allowing inspection of the wrapped node. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + /** + * Returns the type of the wrapped node. + * + * @param {NodeBuilder} builder - The node builder. + * @returns {string} + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Sets up the inspector node. + * + * @param {NodeBuilder} builder - The node builder. + * @returns {Node} The setup node. + */ + setup(builder: NodeBuilder): Node; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts new file mode 100644 index 000000000..23e65acba --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts @@ -0,0 +1,55 @@ +/** + * TSL function for creating a cache node. + * + * @tsl + * @function + * @deprecated + * @param {Node} node - The node that should be cached. + * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. + * @returns {IsolateNode} + */ +export function cache(node: Node, parent?: boolean): IsolateNode; +export default IsolateNode; +export function isolate(node: Node): IsolateNode; +import Node from './Node.js'; +/** + * This node can be used as a cache management component for another node. + * Caching is in general used by default in {@link NodeBuilder} but this node + * allows the usage of a shared parent cache during the build process. + * + * @augments Node + */ +declare class IsolateNode extends Node { + /** + * Constructs a new cache node. + * + * @param {Node} node - The node that should be cached. + * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. + */ + constructor(node: Node, parent?: boolean); + /** + * The node that should be cached. + * + * @type {Node} + */ + node: Node; + /** + * Whether this node refers to a shared parent cache or not. + * + * @type {boolean} + * @default true + */ + parent: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isIsolateNode: boolean; + generateNodeType(builder: any): string; + build(builder: any, ...params: any[]): string | Node | null; + setParent(parent: any): this; + getParent(): boolean; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts new file mode 100644 index 000000000..e281d8a3c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts @@ -0,0 +1,59 @@ +export default LightingModel; +/** + * Abstract class for implementing lighting models. The module defines + * multiple methods that concrete lighting models can implement. These + * methods are executed at different points during the light evaluation + * process. + */ +declare class LightingModel { + /** + * This method is intended for setting up lighting model and context data + * which are later used in the evaluation process. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + start(builder: NodeBuilder): void; + /** + * This method is intended for executing final tasks like final updates + * to the outgoing light. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + finish(): void; + /** + * This method is intended for implementing the direct light term and + * executed during the build process of directional, point and spot light nodes. + * + * @abstract + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct(): void; + /** + * This method is intended for implementing the direct light term for + * rect area light nodes. + * + * @abstract + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + directRectArea(): void; + /** + * This method is intended for implementing the indirect light term. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + indirect(): void; + /** + * This method is intended for implementing the ambient occlusion term. + * Unlike other methods, this method must be called manually by the lighting + * model in its indirect term. + * + * @abstract + * @param {NodeBuilder} builder - The current node builder. + */ + ambientOcclusion(): void; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts new file mode 100644 index 000000000..3ad6b3c3e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts @@ -0,0 +1,132 @@ +/** + * Returns the MRT texture index for the given name. + * + * @param {Array} textures - The textures of a MRT-configured render target. + * @param {string} name - The name of the MRT texture which index is requested. + * @return {number} The texture index. + */ +export function getTextureIndex(textures: Array, name: string): number; +export default MRTNode; +/** + * TSL function for creating a MRT node. + * + * @tsl + * @function + * @param {Object} outputNodes - The MRT outputs. + * @returns {MRTNode} + */ +export const mrt: any; +/** + * This node can be used setup a MRT context for rendering. A typical MRT setup for + * post-processing is shown below: + * ```js + * const mrtNode = mrt( { + * output: output, + * normal: normalView + * } ) ; + * ``` + * The MRT output is defined as a dictionary. + * + * @augments OutputStructNode + */ +declare class MRTNode extends OutputStructNode { + /** + * Constructs a new output struct node. + * + * @param {Object} outputNodes - The MRT outputs. + */ + constructor(outputNodes: { + [x: string]: Node; + }); + /** + * A dictionary representing the MRT outputs. The key + * is the name of the output, the value the node which produces + * the output result. + * + * @type {Object} + */ + outputNodes: { + [x: string]: Node; + }; + /** + * A dictionary storing the blend modes for each output. + * + * @type {Object} + */ + blendModes: { + [x: string]: BlendMode; + }; + /** + * A dictionary storing the clear colors for each output. + * + * @type {Object} + */ + clearColors: { + [x: string]: Color4; + }; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMRTNode: boolean; + /** + * Sets the blend mode for the given output name. + * + * @param {string} name - The name of the output. + * @param {BlendMode} blend - The blending mode. + * @return {MRTNode} The current MRT node. + */ + setBlendMode(name: string, blend: BlendMode): MRTNode; + /** + * Returns the blend mode for the given output name. + * + * @param {string} name - The name of the output. + * @return {BlendMode} The blend mode. + */ + getBlendMode(name: string): BlendMode; + /** + * Sets the clear color for the given output name. + * + * @param {string} name - The name of the output. + * @param {number|string|Color} color - The clear color. + * @param {number} [alpha=1] - The clear alpha. + * @return {MRTNode} The current MRT node. + */ + setClearColor(name: string, color: number | string | Color, alpha?: number): MRTNode; + /** + * Returns the clear color for the given output name. + * + * @param {string} name - The name of the output. + * @return {?Color4} The clear color. Returns `null` if no clear color is defined + * which means the renderer's default clear policy is applied. + */ + getClearColor(name: string): Color4 | null; + /** + * Returns `true` if the MRT node has an output with the given name. + * + * @param {string} name - The name of the output. + * @return {NodeBuilder} Whether the MRT node has an output for the given name or not. + */ + has(name: string): NodeBuilder; + /** + * Returns the output node for the given name. + * + * @param {string} name - The name of the output. + * @return {Node} The output node. + */ + get(name: string): Node; + /** + * Merges the outputs of the given MRT node with the outputs of this node. + * + * @param {MRTNode} mrtNode - The MRT to merge. + * @return {MRTNode} A new MRT node with merged outputs.. + */ + merge(mrtNode: MRTNode): MRTNode; + setup(builder: any): import("./Node.js").default | null; +} +import OutputStructNode from './OutputStructNode.js'; +import BlendMode from '../../renderers/common/BlendMode.js'; +import Color4 from '../../renderers/common/Color4.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts new file mode 100644 index 000000000..ffffd5676 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts @@ -0,0 +1,438 @@ +export default Node; +/** + * Base class for all nodes. + * + * @augments EventDispatcher + */ +declare class Node extends EventDispatcher { + static get type(): string; + /** + * Constructs a new node. + * + * @param {?string} nodeType - The node type. + */ + constructor(nodeType?: string | null); + /** + * The node type. This represents the result type of the node (e.g. `float` or `vec3`). + * + * @type {?string} + * @default null + */ + nodeType: string | null; + /** + * The update type of the node's {@link Node#update} method. Possible values are listed in {@link NodeUpdateType}. + * + * @type {string} + * @default 'none' + */ + updateType: string; + /** + * The update type of the node's {@link Node#updateBefore} method. Possible values are listed in {@link NodeUpdateType}. + * + * @type {string} + * @default 'none' + */ + updateBeforeType: string; + /** + * The update type of the node's {@link Node#updateAfter} method. Possible values are listed in {@link NodeUpdateType}. + * + * @type {string} + * @default 'none' + */ + updateAfterType: string; + /** + * The version of the node. The version automatically is increased when {@link Node#needsUpdate} is set to `true`. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly version: number; + /** + * The name of the node. + * + * @type {string} + * @default '' + */ + name: string; + /** + * Whether this node is global or not. This property is relevant for the internal + * node caching system. All nodes which should be declared just once should + * set this flag to `true` (a typical example is {@link AttributeNode}). + * + * @type {boolean} + * @default false + */ + global: boolean; + /** + * Create a list of parents for this node during the build process. + * + * @type {boolean} + * @default false + */ + parents: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNode: boolean; + _beforeNodes: any; + /** + * The cache key of this node. + * + * @private + * @type {?number} + * @default null + */ + private _cacheKey; + /** + * The UUID of the node. + * + * @type {string} + * @default null + * @private + */ + private _uuid; + /** + * The cache key's version. + * + * @private + * @type {number} + * @default 0 + */ + private _cacheKeyVersion; + /** + * The unique ID of the node. + * + * @type {number} + * @readonly + */ + readonly id: number; + /** + * The stack trace of the node for debugging purposes. + * + * @type {?string} + * @default null + */ + stackTrace: string | null; + /** + * Set this property to `true` when the node should be regenerated. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * The UUID of the node. + * + * @type {string} + * @readonly + */ + readonly get uuid(): string; + /** + * The type of the class. The value is usually the constructor name. + * + * @type {string} + * @readonly + */ + readonly get type(): string; + /** + * Convenient method for defining {@link Node#update}. + * + * @param {Function} callback - The update method. + * @param {string} updateType - The update type. + * @return {Node} A reference to this node. + */ + onUpdate(callback: Function, updateType: string): Node; + /** + * The method can be implemented to update the node's internal state when it is used to render an object. + * The {@link Node#updateType} property defines how often the update is executed. + * + * @abstract + * @param {NodeFrame} frame - A reference to the current node frame. + * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + */ + update(): boolean | null; + /** + * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but + * this method automatically sets the update type to `FRAME`. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onFrameUpdate(callback: Function): Node; + /** + * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but + * this method automatically sets the update type to `RENDER`. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onRenderUpdate(callback: Function): Node; + /** + * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but + * this method automatically sets the update type to `OBJECT`. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onObjectUpdate(callback: Function): Node; + /** + * Convenient method for defining {@link Node#updateReference}. + * + * @param {Function} callback - The update method. + * @return {Node} A reference to this node. + */ + onReference(callback: Function): Node; + /** + * Nodes might refer to other objects like materials. This method allows to dynamically update the reference + * to such objects based on a given state (e.g. the current node frame or builder). + * + * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. + * @return {any} The updated reference. + */ + updateReference(): any; + /** + * By default this method returns the value of the {@link Node#global} flag. This method + * can be overwritten in derived classes if an analytical way is required to determine the + * global cache referring to the current shader-stage. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether this node is global or not. + */ + isGlobal(): boolean; + /** + * Generator function that can be used to iterate over the child nodes. + * + * @generator + * @yields {Node} A child node. + */ + getChildren(): Generator; + /** + * Calling this method dispatches the `dispose` event. This event can be used + * to register event listeners for clean up tasks. + */ + dispose(): void; + /** + * Callback for {@link Node#traverse}. + * + * @callback traverseCallback + * @param {Node} node - The current node. + */ + /** + * Can be used to traverse through the node's hierarchy. + * + * @param {traverseCallback} callback - A callback that is executed per node. + */ + traverse(callback: (node: Node) => any): void; + /** + * Returns the child nodes of this node. + * + * @private + * @param {Set} [ignores=new Set()] - A set of nodes to ignore during the search to avoid circular references. + * @returns {Array} An array of objects describing the child nodes. + */ + private _getChildren; + /** + * Returns the cache key for this node. + * + * @param {boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced. + * @param {Set} [ignores=null] - A set of nodes to ignore during the computation of the cache key. + * @return {number} The cache key of the node. + */ + getCacheKey(force?: boolean, ignores?: Set): number; + /** + * Generate a custom cache key for this node. + * + * @return {number} The cache key of the node. + */ + customCacheKey(): number; + /** + * Returns the references to this node which is by default `this`. + * + * @return {Node} A reference to this node. + */ + getScope(): Node; + /** + * Returns the hash of the node which is used to identify the node. By default it's + * the {@link Node#uuid} however derived node classes might have to overwrite this method + * depending on their implementation. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(): string; + /** + * Returns the update type of {@link Node#update}. + * + * @return {NodeUpdateType} The update type. + */ + getUpdateType(): { + NONE: string; + FRAME: string; + RENDER: string; + OBJECT: string; + }; + /** + * Returns the update type of {@link Node#updateBefore}. + * + * @return {NodeUpdateType} The update type. + */ + getUpdateBeforeType(): { + NONE: string; + FRAME: string; + RENDER: string; + OBJECT: string; + }; + /** + * Returns the update type of {@link Node#updateAfter}. + * + * @return {NodeUpdateType} The update type. + */ + getUpdateAfterType(): { + NONE: string; + FRAME: string; + RENDER: string; + OBJECT: string; + }; + /** + * Certain types are composed of multiple elements. For example a `vec3` + * is composed of three `float` values. This method returns the type of + * these elements. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The type of the node. + */ + getElementType(builder: NodeBuilder): string; + /** + * Returns the node member type for the given name. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The name of the member. + * @return {string} The type of the node. + */ + getMemberType(): string; + /** + * Returns the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} [output=null] - The output of the node. + * @return {string} The type of the node. + */ + getNodeType(builder: NodeBuilder, output?: string): string; + /** + * Returns the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} [output=null] - The output of the node. + * @return {string} The type of the node. + */ + generateNodeType(builder: NodeBuilder, output?: string): string; + /** + * This method is used during the build process of a node and ensures + * equal nodes are not built multiple times but just once. For example if + * `attribute( 'uv' )` is used multiple times by the user, the build + * process makes sure to process just the first node. It also handles + * node overrides if an override context is set. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The shared node if possible. Otherwise `this` is returned. + */ + getShared(builder: NodeBuilder): Node; + /** + * Returns the number of elements in the node array. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?number} The number of elements in the node array. + */ + getArrayCount(): number | null; + /** + * Represents the setup stage which is the first step of the build process, see {@link Node#build} method. + * This method is often overwritten in derived modules to prepare the node which is used as a node's output/result. + * If an output node is prepared, then it must be returned in the `return` statement of the derived module's setup function. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {?Node} The output node. + */ + setup(builder: NodeBuilder): Node | null; + /** + * Represents the analyze stage which is the second step of the build process, see {@link Node#build} method. + * This stage analyzes the node hierarchy and ensures descendent nodes are built. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?Node} output - The target output node. + */ + analyze(builder: NodeBuilder, output?: Node | null): void; + /** + * Represents the generate stage which is the third step of the build process, see {@link Node#build} method. + * This state builds the output node and returns the resulting shader string. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?string} [output] - Can be used to define the output type. + * @return {?string} The generated shader string. + */ + generate(builder: NodeBuilder, output?: string | null): string | null; + /** + * The method can be implemented to update the node's internal state before it is used to render an object. + * The {@link Node#updateBeforeType} property defines how often the update is executed. + * + * @abstract + * @param {NodeFrame} frame - A reference to the current node frame. + * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + */ + updateBefore(): boolean | null; + /** + * The method can be implemented to update the node's internal state after it was used to render an object. + * The {@link Node#updateAfterType} property defines how often the update is executed. + * + * @abstract + * @param {NodeFrame} frame - A reference to the current node frame. + * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). + */ + updateAfter(): boolean | null; + before(node: any): this; + /** + * This method performs the build of a node. The behavior and return value depend on the current build stage: + * - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant. + * - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`. + * - **generate**: Generates the shader code for the node. Returns the generated shader string. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?(string|Node)} [output=null] - Can be used to define the output type. + * @return {?(Node|string)} The result of the build process, depending on the build stage. + */ + build(builder: NodeBuilder, output?: (string | Node) | null): (Node | string) | null; + /** + * Returns the child nodes as a JSON object. + * + * @return {Generator} An iterable list of serialized child objects as JSON. + */ + getSerializeChildren(): Generator; + /** + * Serializes the node to JSON. + * + * @param {Object} json - The output JSON object. + */ + serialize(json: Object): void; + /** + * Deserializes the node from the given JSON. + * + * @param {Object} json - The JSON object. + */ + deserialize(json: Object): void; + /** + * Serializes the node into the three.js JSON Object/Scene format. + * + * @param {?Object} meta - An optional JSON object that already holds serialized data from other scene objects. + * @return {Object} The serialized node. + */ + toJSON(meta: Object | null): Object; +} +declare namespace Node { + let captureStackTrace: boolean; +} +import { EventDispatcher } from '../../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts new file mode 100644 index 000000000..d6414185f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts @@ -0,0 +1,44 @@ +export default NodeAttribute; +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader attributes that are going to be generated + * by the builder. Arrays of node attributes is maintained in {@link NodeBuilder#attributes} + * and {@link NodeBuilder#bufferAttributes} for this purpose. + */ +declare class NodeAttribute { + /** + * Constructs a new node attribute. + * + * @param {string} name - The name of the attribute. + * @param {string} type - The type of the attribute. + * @param {?Node} node - An optional reference to the node. + */ + constructor(name: string, type: string, node?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeAttribute: boolean; + /** + * The name of the attribute. + * + * @type {string} + */ + name: string; + /** + * The type of the attribute. + * + * @type {string} + */ + type: string; + /** + * An optional reference to the node. + * + * @type {?Node} + * @default null + */ + node: Node | null; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts new file mode 100644 index 000000000..150cba495 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts @@ -0,0 +1,1380 @@ +export default NodeBuilder; +/** + * Base class for builders which generate a shader program based + * on a 3D object and its node material definition. + */ +declare class NodeBuilder { + /** + * Constructs a new node builder. + * + * @param {Object3D} object - The 3D object. + * @param {Renderer} renderer - The current renderer. + * @param {NodeParser} parser - A reference to a node parser. + */ + constructor(object: Object3D, renderer: Renderer, parser: NodeParser); + /** + * The 3D object. + * + * @type {Object3D} + */ + object: Object3D; + /** + * The material of the 3D object. + * + * @type {?Material} + */ + material: Material | null; + /** + * The geometry of the 3D object. + * + * @type {?BufferGeometry} + */ + geometry: BufferGeometry | null; + /** + * The current renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * A reference to a node parser. + * + * @type {NodeParser} + */ + parser: NodeParser; + /** + * The scene the 3D object belongs to. + * + * @type {?Scene} + * @default null + */ + scene: Scene | null; + /** + * The camera the 3D object is rendered with. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * A list of all nodes the builder is processing + * for this 3D object. + * + * @type {Set} + */ + nodes: Set; + /** + * A list of all nodes the builder is processing in sequential order. + * + * This is used to determine the update order of nodes, which is important for + * {@link NodeUpdateType#UPDATE_BEFORE} and {@link NodeUpdateType#UPDATE_AFTER}. + * + * @type {Set} + */ + sequentialNodes: Set; + /** + * A list of all nodes which {@link Node#update} method should be executed. + * + * @type {Array} + */ + updateNodes: Array; + /** + * A list of all nodes which {@link Node#updateBefore} method should be executed. + * + * @type {Array} + */ + updateBeforeNodes: Array; + /** + * A list of all nodes which {@link Node#updateAfter} method should be executed. + * + * @type {Array} + */ + updateAfterNodes: Array; + /** + * A dictionary that assigns each node to a unique hash. + * + * @type {Object} + */ + hashNodes: { + [x: number]: Node; + }; + /** + * A reference to a node material observer. + * + * @type {?NodeMaterialObserver} + * @default null + */ + observer: NodeMaterialObserver | null; + /** + * A reference to the current lights node. + * + * @type {?LightsNode} + * @default null + */ + lightsNode: LightsNode | null; + /** + * A reference to the current environment node. + * + * @type {?Node} + * @default null + */ + environmentNode: Node | null; + /** + * A reference to the current fog node. + * + * @type {?Node} + * @default null + */ + fogNode: Node | null; + /** + * The current clipping context. + * + * @type {?ClippingContext} + */ + clippingContext: ClippingContext | null; + /** + * Whether the built material uses hardware clipping or not. + * + * @type {boolean} + * @default false + */ + hardwareClipping: boolean; + /** + * The generated vertex shader. + * + * @type {?string} + */ + vertexShader: string | null; + /** + * The generated fragment shader. + * + * @type {?string} + */ + fragmentShader: string | null; + /** + * The generated compute shader. + * + * @type {?string} + */ + computeShader: string | null; + /** + * Nodes used in the primary flow of code generation. + * + * @type {Object>} + */ + flowNodes: { + [x: string]: Node[]; + }; + /** + * Nodes code from `.flowNodes`. + * + * @type {Object} + */ + flowCode: { + [x: string]: string; + }; + /** + * This dictionary holds the node uniforms of the builder. + * The uniforms are maintained in an array for each shader stage. + * + * @type {Object} + */ + uniforms: Object; + /** + * This dictionary holds the output structs of the builder. + * The structs are maintained in an array for each shader stage. + * + * @type {Object} + */ + structs: Object; + /** + * This dictionary holds the types of the builder. + * + * @type {Object} + */ + types: Object; + /** + * This dictionary holds the bindings for each shader stage. + * + * @type {Object} + */ + bindings: Object; + /** + * This dictionary maintains the binding indices per bind group. + * + * @type {Object} + */ + bindingsIndexes: Object; + /** + * Reference to the array of bind groups. + * + * @type {?Array} + */ + bindGroups: Array | null; + /** + * This array holds the node attributes of this builder + * created via {@link AttributeNode}. + * + * @type {Array} + */ + attributes: Array; + /** + * This array holds the node attributes of this builder + * created via {@link BufferAttributeNode}. + * + * @type {Array} + */ + bufferAttributes: Array; + /** + * This array holds the node varyings of this builder. + * + * @type {Array} + */ + varyings: Array; + /** + * This dictionary holds the (native) node codes of this builder. + * The codes are maintained in an array for each shader stage. + * + * @type {Object>} + */ + codes: { + [x: string]: NodeCode[]; + }; + /** + * This dictionary holds the node variables of this builder. + * The variables are maintained in an array for each shader stage. + * This dictionary is also used to count the number of variables + * according to their type (const, vars). + * + * @type {Object|number>} + */ + vars: { + [x: string]: number | NodeVar[]; + }; + /** + * This dictionary holds the declarations for each shader stage. + * + * @type {Object} + */ + declarations: Object; + /** + * Current code flow. + * All code generated in this stack will be stored in `.flow`. + * + * @type {{code: string}} + */ + flow: { + code: string; + }; + /** + * A chain of nodes. + * Used to check recursive calls in node-graph. + * + * @type {Array} + */ + chaining: Array; + /** + * The current stack. + * This reflects the current process in the code block hierarchy, + * it is useful to know if the current process is inside a conditional for example. + * + * @type {StackNode} + */ + stack: StackNode; + /** + * List of stack nodes. + * The current stack hierarchy is stored in an array. + * + * @type {Array} + */ + stacks: Array; + /** + * A tab value. Used for shader string generation. + * + * @type {string} + * @default '\t' + */ + tab: string; + /** + * Reference to the current function node. + * + * @type {?FunctionNode} + * @default null + */ + currentFunctionNode: FunctionNode | null; + /** + * The builder's context. + * + * @type {Object} + */ + context: Object; + /** + * The builder's cache. + * + * @type {NodeCache} + */ + cache: NodeCache; + /** + * Since the {@link NodeBuilder#cache} might be temporarily + * overwritten by other caches, this member retains the reference + * to the builder's own cache. + * + * @type {NodeCache} + * @default this.cache + */ + globalCache: NodeCache; + flowsData: WeakMap; + /** + * The current shader stage. + * + * @type {?('vertex'|'fragment'|'compute'|'any')} + */ + shaderStage: ("vertex" | "fragment" | "compute" | "any") | null; + /** + * The current build stage. + * + * @type {?('setup'|'analyze'|'generate')} + */ + buildStage: ("setup" | "analyze" | "generate") | null; + /** + * The sub-build layers. + * + * @type {Array} + * @default [] + */ + subBuildLayers: Array; + /** + * The active stack nodes. + * + * @type {Array} + */ + activeStacks: Array; + /** + * The current sub-build TSL function(Fn). + * + * @type {?string} + * @default null + */ + subBuildFn: string | null; + /** + * The current TSL function(Fn) call node. + * + * @type {?Node} + * @default null + */ + fnCall: Node | null; + /** + * Whether the material is using flat shading or not. + * + * @returns {boolean} Whether the material is using flat shading or not. + */ + isFlatShading(): boolean; + /** + * Whether the material is opaque or not. + * + * @return {boolean} Whether the material is opaque or not. + */ + isOpaque(): boolean; + /** + * Factory method for creating an instance of {@link RenderTarget} with the given + * dimensions and options. + * + * @param {number} width - The width of the render target. + * @param {number} height - The height of the render target. + * @param {Object} options - The options of the render target. + * @return {RenderTarget} The render target. + */ + createRenderTarget(width: number, height: number, options: Object): RenderTarget; + /** + * Factory method for creating an instance of {@link CubeRenderTarget} with the given + * dimensions and options. + * + * @param {number} size - The size of the cube render target. + * @param {Object} options - The options of the cube render target. + * @return {CubeRenderTarget} The cube render target. + */ + createCubeRenderTarget(size: number, options: Object): CubeRenderTarget; + /** + * Whether the given node is included in the internal array of nodes or not. + * + * @param {Node} node - The node to test. + * @return {boolean} Whether the given node is included in the internal array of nodes or not. + */ + includes(node: Node): boolean; + /** + * Returns the type of the color output based on the renderer's render target. + * + * @param {number} [index=0] - The index of the render target texture. + * @return {string} The type. + */ + getOutputType(index?: number): string; + /** + * Returns the output struct name which is required by + * {@link OutputStructNode}. + * + * @abstract + * @return {string} The name of the output struct. + */ + getOutputStructName(): string; + /** + * Returns a bind group for the given group name and binding. + * + * @private + * @param {string} groupName - The group name. + * @param {Array} bindings - List of bindings. + * @return {BindGroup} The bind group + */ + private _getBindGroup; + /** + * Returns an array of node uniform groups for the given group name and shader stage. + * + * @param {string} groupName - The group name. + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {Array} The array of node uniform groups. + */ + getBindGroupArray(groupName: string, shaderStage: ("vertex" | "fragment" | "compute" | "any")): Array; + /** + * Returns a list bindings of all shader stages separated by groups. + * + * @return {Array} The list of bindings. + */ + getBindings(): Array; + /** + * Sorts the bind groups and updates {@link NodeBuilder#bindingsIndexes}. + */ + sortBindingGroups(): void; + /** + * The builder maintains each node in a hash-based dictionary. + * This method sets the given node (value) with the given hash (key) into this dictionary. + * + * @param {Node} node - The node to add. + * @param {number} hash - The hash of the node. + */ + setHashNode(node: Node, hash: number): void; + /** + * Adds a node to this builder. + * + * @param {Node} node - The node to add. + */ + addNode(node: Node): void; + /** + * It is used to add Nodes that will be used as FRAME and RENDER events, + * and need to follow a certain sequence in the calls to work correctly. + * This function should be called after 'setup()' in the 'build()' process to ensure that the child nodes are processed first. + * + * @param {Node} node - The node to add. + */ + addSequentialNode(node: Node): void; + /** + * Checks the update types of nodes + */ + buildUpdateNodes(): void; + /** + * A reference the current node which is the + * last node in the chain of nodes. + * + * @type {Node} + */ + get currentNode(): Node; + /** + * A reference to the render pipeline. + * + * @type {RenderPipeline} + */ + get renderPipeline(): RenderPipeline; + /** + * Whether the given texture is filtered or not. + * + * @param {Texture} texture - The texture to check. + * @return {boolean} Whether the given texture is filtered or not. + */ + isFilteredTexture(texture: Texture): boolean; + /** + * Returns the maximum number of bytes available for uniform buffers. + * + * @return {number} The maximum number of bytes available for uniform buffers. + */ + getUniformBufferLimit(): number; + /** + * Adds the given node to the internal node chain. + * This is used to check recursive calls in node-graph. + * + * @param {Node} node - The node to add. + */ + addChain(node: Node): void; + /** + * Removes the given node from the internal node chain. + * + * @param {Node} node - The node to remove. + */ + removeChain(node: Node): void; + /** + * Returns the native shader method name for a given generic name. E.g. + * the method name `textureDimensions` matches the WGSL name but must be + * resolved to `textureSize` in GLSL. + * + * @abstract + * @param {string} method - The method name to resolve. + * @return {string} The resolved method name. + */ + getMethod(method: string): string; + /** + * Returns the native snippet for a ternary operation. E.g. GLSL would output + * a ternary op as `cond ? x : y` whereas WGSL would output it as `select(y, x, cond)` + * + * @abstract + * @param {string} condSnippet - The condition determining which expression gets resolved. + * @param {string} ifSnippet - The expression to resolve to if the condition is true. + * @param {string} elseSnippet - The expression to resolve to if the condition is false. + * @return {string} The resolved method name. + */ + getTernary(): string; + /** + * Returns a node for the given hash, see {@link NodeBuilder#setHashNode}. + * + * @param {number} hash - The hash of the node. + * @return {Node} The found node. + */ + getNodeFromHash(hash: number): Node; + /** + * Adds the Node to a target flow so that it can generate code in the 'generate' process. + * + * @param {('vertex'|'fragment'|'compute')} shaderStage - The shader stage. + * @param {Node} node - The node to add. + * @return {Node} The node. + */ + addFlow(shaderStage: ("vertex" | "fragment" | "compute"), node: Node): Node; + /** + * Sets builder's context. + * + * @param {Object} context - The context to set. + */ + setContext(context: Object): void; + /** + * Returns the builder's current context. + * + * @return {Object} The builder's current context. + */ + getContext(): Object; + /** + * Adds context data to the builder's current context. + * + * @param {Object} context - The context to add. + * @return {Object} The previous context. + */ + addContext(context: Object): Object; + /** + * Gets a context used in shader construction that can be shared across different materials. + * This is necessary since the renderer cache can reuse shaders generated in one material and use them in another. + * + * @return {Object} The builder's current context without material. + */ + getSharedContext(): Object; + /** + * Sets builder's cache. + * + * @param {NodeCache} cache - The cache to set. + */ + setCache(cache: NodeCache): void; + /** + * Returns the builder's current cache. + * + * @return {NodeCache} The builder's current cache. + */ + getCache(): NodeCache; + /** + * Returns a cache for the given node. + * + * @param {Node} node - The node. + * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. + * @return {NodeCache} The cache. + */ + getCacheFromNode(node: Node, parent?: boolean): NodeCache; + /** + * Whether the requested feature is available or not. + * + * @abstract + * @param {string} name - The requested feature. + * @return {boolean} Whether the requested feature is supported or not. + */ + isAvailable(): boolean; + /** + * Returns the vertexIndex input variable as a native shader string. + * + * @abstract + * @return {string} The instanceIndex shader string. + */ + getVertexIndex(): string; + /** + * Contextually returns either the vertex stage instance index builtin + * or the linearized index of an compute invocation within a grid of workgroups. + * + * @abstract + * @return {string} The instanceIndex shader string. + */ + getInstanceIndex(): string; + /** + * Returns the drawIndex input variable as a native shader string. + * Only relevant for WebGL and its `WEBGL_multi_draw` extension. + * + * @abstract + * @return {?string} The drawIndex shader string. + */ + getDrawIndex(): string | null; + /** + * Returns the frontFacing input variable as a native shader string. + * + * @abstract + * @return {string} The frontFacing shader string. + */ + getFrontFacing(): string; + /** + * Returns the fragCoord input variable as a native shader string. + * + * @abstract + * @return {string} The fragCoord shader string. + */ + getFragCoord(): string; + /** + * Whether to flip texture data along its vertical axis or not. WebGL needs + * this method evaluate to `true`, WebGPU to `false`. + * + * @abstract + * @return {boolean} Whether to flip texture data along its vertical axis or not. + */ + isFlipY(): boolean; + /** + * Returns whether the builder is currently in an assignment context. + * + * @return {boolean} Whether the builder is in an assignment context. + */ + isContextAssign(): boolean; + /** + * Calling this method increases the usage count for the given node by one. + * + * @param {Node} node - The node to increase the usage count for. + * @return {number} The updated usage count. + */ + increaseUsage(node: Node): number; + /** + * Returns whether the given node has been written to in any shader stage. + * + * @param {Node} node - The node to check. + * @return {boolean} Whether the node has been written to. + */ + hasWriteUsage(node: Node): boolean; + /** + * Generates a texture sample shader string for the given texture data. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The texture property name. + * @param {string} uvSnippet - Snippet defining the texture coordinates. + * @return {string} The generated shader string. + */ + generateTexture(): string; + /** + * Generates a texture LOD shader string for the given texture data. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The texture property name. + * @param {string} uvSnippet - Snippet defining the texture coordinates. + * @param {?string} depthSnippet - Snippet defining the 0-based texture array index to sample. + * @param {string} levelSnippet - Snippet defining the mip level. + * @return {string} The generated shader string. + */ + generateTextureLod(): string; + /** + * Generates a texture size shader string for the given texture data. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The texture property name. + * @param {string} levelSnippet - Snippet defining the mip level. + * @return {string} The generated shader string. + */ + generateTextureSize(): string; + /** + * Generates the array declaration string. + * + * @param {string} type - The type. + * @param {?number} [count] - The count. + * @return {string} The generated value as a shader string. + */ + generateArrayDeclaration(type: string, count?: number | null): string; + /** + * Generates the array shader string for the given type and value. + * + * @param {string} type - The type. + * @param {?number} [count] - The count. + * @param {?Array} [values=null] - The default values. + * @return {string} The generated value as a shader string. + */ + generateArray(type: string, count?: number | null, values?: Array | null): string; + /** + * Generates the struct shader string. + * + * @param {string} type - The type. + * @param {Array} [membersLayout] - The count. + * @param {?Array} [values=null] - The default values. + * @return {string} The generated value as a shader string. + */ + generateStruct(type: string, membersLayout?: Array, values?: Array | null): string; + /** + * Generates the shader string for the given type and value. + * + * @param {string} type - The type. + * @param {?any} [value=null] - The value. + * @return {string} The generated value as a shader string. + */ + generateConst(type: string, value?: any | null): string; + /** + * It might be necessary to convert certain data types to different ones + * so this method can be used to hide the conversion. + * + * @param {string} type - The type. + * @return {string} The updated type. + */ + getType(type: string): string; + /** + * Whether the given attribute name is defined in the geometry or not. + * + * @param {string} name - The attribute name. + * @return {boolean} Whether the given attribute name is defined in the geometry. + */ + hasGeometryAttribute(name: string): boolean; + /** + * Returns a node attribute for the given name and type. + * + * @param {string} name - The attribute's name. + * @param {string} type - The attribute's type. + * @return {NodeAttribute} The node attribute. + */ + getAttribute(name: string, type: string): NodeAttribute; + /** + * Returns for the given node and shader stage the property name for the shader. + * + * @param {Node} node - The node. + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The property name. + */ + getPropertyName(node: Node): string; + /** + * Returns whether the given name is a reserved keyword of the backend's + * shading language. Backends override this method to provide their + * language-specific keywords. + * + * @param {string} name - The name to test. + * @return {boolean} Whether the name is a reserved keyword or not. + */ + isReservedKeyword(): boolean; + /** + * Whether the given type is a vector type or not. + * + * @param {string} type - The type to check. + * @return {boolean} Whether the given type is a vector type or not. + */ + isVector(type: string): boolean; + /** + * Whether the given type is a matrix type or not. + * + * @param {string} type - The type to check. + * @return {boolean} Whether the given type is a matrix type or not. + */ + isMatrix(type: string): boolean; + /** + * Whether the given type is a reference type or not. + * + * @param {string} type - The type to check. + * @return {boolean} Whether the given type is a reference type or not. + */ + isReference(type: string): boolean; + /** + * Checks if the given texture requires a manual conversion to the working color space. + * + * @abstract + * @param {Texture} texture - The texture to check. + * @return {boolean} Whether the given texture requires a conversion to working color space or not. + */ + needsToWorkingColorSpace(): boolean; + /** + * Returns the component type of a given texture. + * + * @param {Texture} texture - The texture. + * @return {string} The component type. + */ + getComponentTypeFromTexture(texture: Texture): string; + /** + * Returns the element type for a given type. + * + * @param {string} type - The type. + * @return {string} The element type. + */ + getElementType(type: string): string; + /** + * Returns the component type for a given type. + * + * @param {string} type - The type. + * @return {string} The component type. + */ + getComponentType(type: string): string; + /** + * Returns the vector type for a given type. + * + * @param {string} type - The type. + * @return {string} The vector type. + */ + getVectorType(type: string): string; + /** + * Returns the data type for the given the length and component type. + * + * @param {number} length - The length. + * @param {string} [componentType='float'] - The component type. + * @return {string} The type. + */ + getTypeFromLength(length: number, componentType?: string): string; + /** + * Returns the type for a given typed array. + * + * @param {TypedArray} array - The typed array. + * @return {string} The type. + */ + getTypeFromArray(array: TypedArray): string; + /** + * Returns the type is an integer type. + * + * @param {string} type - The type. + * @return {boolean} Whether the type is an integer type or not. + */ + isInteger(type: string): boolean; + /** + * Returns the type for a given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + * @return {string} The type. + */ + getTypeFromAttribute(attribute: BufferAttribute): string; + /** + * Returns the length for the given data type. + * + * @param {string} type - The data type. + * @return {number} The length. + */ + getTypeLength(type: string): number; + /** + * Returns the vector type for a given matrix type. + * + * @param {string} type - The matrix type. + * @return {string} The vector type. + */ + getVectorFromMatrix(type: string): string; + /** + * For a given type this method changes the component type to the + * given value. E.g. `vec4` should be changed to the new component type + * `uint` which results in `uvec4`. + * + * @param {string} type - The type. + * @param {string} newComponentType - The new component type. + * @return {string} The new type. + */ + changeComponentType(type: string, newComponentType: string): string; + /** + * Returns the integer type pendant for the given type. + * + * @param {string} type - The type. + * @return {string} The integer type. + */ + getIntegerType(type: string): string; + /** + * Adds an active stack to the internal stack. + * + * @param {StackNode} stack - The stack node to add. + */ + setActiveStack(stack: StackNode): void; + /** + * Removes the active stack from the internal stack. + * + * @param {StackNode} stack - The stack node to remove. + */ + removeActiveStack(stack: StackNode): void; + /** + * Returns the active stack. + * + * @return {StackNode} The active stack. + */ + getActiveStack(): StackNode; + /** + * Returns the base stack. + * + * @return {StackNode} The base stack. + */ + getBaseStack(): StackNode; + /** + * Adds a stack node to the internal stack. + * + * @return {StackNode} The added stack node. + */ + addStack(): StackNode; + /** + * Removes the last stack node from the internal stack. + * + * @return {StackNode} The removed stack node. + */ + removeStack(): StackNode; + /** + * The builder maintains (cached) data for each node during the building process. This method + * can be used to get these data for a specific shader stage and cache. + * + * @param {Node} node - The node to get the data for. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @param {?NodeCache} cache - An optional cache. + * @return {Object} The node data. + */ + getDataFromNode(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), cache?: NodeCache | null): Object; + /** + * Returns the properties for the given node and shader stage. + * + * Properties are typically used within a build stage to reference a node's + * child node or nodes manually assigned to the properties in a separate build stage. + * A typical usage pattern for defining nodes manually would be assigning dependency nodes + * to the current node's properties in the setup stage and building those properties in the generate stage. + * + * @param {Node} node - The node to get the properties for. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage='any'] - The shader stage. + * @return {Object} The node properties. + */ + getNodeProperties(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): Object; + /** + * Returns an instance of {@link NodeAttribute} for the given buffer attribute node. + * + * @param {BufferAttributeNode} node - The buffer attribute node. + * @param {string} type - The node type. + * @param {?string} [name=null] - The name of the buffer attribute. + * @return {NodeAttribute} The node attribute. + */ + getBufferAttributeFromNode(node: BufferAttributeNode, type: string, name?: string | null): NodeAttribute; + /** + * Returns an instance of {@link StructType} for the given struct name and shader stage + * or null if not found. + * + * @param {string} name - The name of the struct. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @return {?StructType} The struct type or null if not found. + */ + getStructTypeNode(name: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType | null; + /** + * Returns an instance of {@link StructType} for the given output struct node. + * + * @param {OutputStructNode} node - The output struct node. + * @param {Array} membersLayout - The output struct types. + * @param {?string} [name=null] - The name of the struct. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @return {StructType} The struct type attribute. + */ + getStructTypeFromNode(node: OutputStructNode, membersLayout: Array, name?: string | null, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType; + /** + * Returns an instance of {@link StructType} for the given output struct node. + * + * @param {OutputStructNode} node - The output struct node. + * @param {Array} membersLayout - The output struct types. + * @return {StructType} The struct type attribute. + */ + getOutputStructTypeFromNode(node: OutputStructNode, membersLayout: Array): StructType; + /** + * Returns an instance of {@link NodeUniform} for the given uniform node. + * + * @param {UniformNode} node - The uniform node. + * @param {string} type - The uniform type. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @param {?string} name - The name of the uniform. + * @return {NodeUniform} The node uniform. + */ + getUniformFromNode(node: UniformNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), name?: string | null): NodeUniform; + /** + * Returns an instance of {@link NodeVar} for the given variable node. + * + * @param {VarNode} node - The variable node. + * @param {?string} name - The variable's name. + * @param {string} [type=node.getNodeType( this )] - The variable's type. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @param {boolean} [readOnly=false] - Whether the variable is read-only or not. + * + * @return {NodeVar} The node variable. + */ + getVarFromNode(node: VarNode, name?: string | null, type?: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), readOnly?: boolean): NodeVar; + /** + * Returns whether a Node or its flow is deterministic, useful for use in `const`. + * + * @param {Node} node - The varying node. + * @return {boolean} Returns true if deterministic. + */ + isDeterministic(node: Node): boolean; + /** + * Returns an instance of {@link NodeVarying} for the given varying node. + * + * @param {(VaryingNode|PropertyNode)} node - The varying node. + * @param {?string} name - The varying's name. + * @param {string} [type=node.getNodeType( this )] - The varying's type. + * @param {?string} interpolationType - The interpolation type of the varying. + * @param {?string} interpolationSampling - The interpolation sampling type of the varying. + * @return {NodeVar} The node varying. + */ + getVaryingFromNode(node: (VaryingNode | PropertyNode), name?: string | null, type?: string, interpolationType?: string | null, interpolationSampling?: string | null): NodeVar; + /** + * Registers a node declaration in the current shader stage. + * + * @param {Object} node - The node to be registered. + */ + registerDeclaration(node: Object): void; + /** + * Returns an instance of {@link NodeCode} for the given code node. + * + * @param {CodeNode} node - The code node. + * @param {string} type - The node type. + * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. + * @return {NodeCode} The node code. + */ + getCodeFromNode(node: CodeNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): NodeCode; + /** + * Adds a code flow based on the code-block hierarchy. + + * This is used so that code-blocks like If,Else create their variables locally if the Node + * is only used inside one of these conditionals in the current shader stage. + * + * @param {Node} node - The node to add. + * @param {Node} nodeBlock - Node-based code-block. Usually 'ConditionalNode'. + */ + addFlowCodeHierarchy(node: Node, nodeBlock: Node): void; + /** + * Add a inline-code to the current flow code-block. + * + * @param {Node} node - The node to add. + * @param {string} code - The code to add. + * @param {Node} nodeBlock - Current ConditionalNode + */ + addLineFlowCodeBlock(node: Node, code: string, nodeBlock: Node): void; + /** + * Add a inline-code to the current flow. + * + * @param {string} code - The code to add. + * @param {?Node} [node= null] - Optional Node, can help the system understand if the Node is part of a code-block. + * @return {NodeBuilder} A reference to this node builder. + */ + addLineFlowCode(code: string, node?: Node | null): NodeBuilder; + /** + * Adds a code to the current code flow. + * + * @param {string} code - Shader code. + * @return {NodeBuilder} A reference to this node builder. + */ + addFlowCode(code: string): NodeBuilder; + /** + * Add tab in the code that will be generated so that other snippets respect the current tabulation. + * Typically used in codes with If,Else. + * + * @return {NodeBuilder} A reference to this node builder. + */ + addFlowTab(): NodeBuilder; + /** + * Removes a tab. + * + * @return {NodeBuilder} A reference to this node builder. + */ + removeFlowTab(): NodeBuilder; + /** + * Gets the current flow data based on a Node. + * + * @param {Node} node - Node that the flow was started. + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {Object} The flow data. + */ + getFlowData(node: Node): Object; + /** + * Executes the node flow based on a root node to generate the final shader code. + * + * @param {Node} node - The node to execute. + * @return {Object} The code flow. + */ + flowNode(node: Node): Object; + /** + * Includes a node in the current function node. + * + * @param {Node} node - The node to include. + * @returns {void} + */ + addInclude(node: Node): void; + /** + * Returns the native shader operator name for a given generic name. + * It is a similar type of method like {@link NodeBuilder#getMethod}. + * + * @param {ShaderNodeInternal} shaderNode - The shader node to build the function node with. + * @return {FunctionNode} The build function node. + */ + buildFunctionNode(shaderNode: ShaderNodeInternal): FunctionNode; + /** + * Generates a code flow based on a TSL function: Fn(). + * + * @param {ShaderNodeInternal} shaderNode - A function code will be generated based on the input. + * @return {Object} + */ + flowShaderNode(shaderNode: ShaderNodeInternal): Object; + /** + * Executes the node in a specific build stage. + * + * This function can be used to arbitrarily execute the specified build stage + * outside of the standard build process. For instance, if a node's type depends + * on properties created by the 'setup' stage, then flowBuildStage(node, 'setup') + * can be used to execute the setup build stage and access its generated nodes + * before the standard build process begins. + * + * @param {Node} node - The node to execute. + * @param {string} buildStage - The build stage to execute the node in. + * @param {?(Node|string)} [output=null] - Expected output type. For example 'vec3'. + * @return {?(Node|string)} The result of the node build. + */ + flowBuildStage(node: Node, buildStage: string, output?: (Node | string) | null): (Node | string) | null; + /** + * Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'. + * + * @param {Node} node - The node to execute. + * @param {?string} output - Expected output type. For example 'vec3'. + * @return {Object} + */ + flowStagesNode(node: Node, output?: string | null): Object; + /** + * Returns the native shader operator name for a given generic name. + * It is a similar type of method like {@link NodeBuilder#getMethod}. + * + * @abstract + * @param {string} op - The operator name to resolve. + * @return {?string} The resolved operator name. + */ + getFunctionOperator(): string | null; + /** + * Builds the given shader node. + * + * @abstract + * @param {ShaderNodeInternal} shaderNode - The shader node. + * @return {string} The function code. + */ + buildFunctionCode(): string; + /** + * Generates a code flow based on a child Node. + * + * @param {Node} node - The node to execute. + * @param {?string} output - Expected output type. For example 'vec3'. + * @return {Object} The code flow. + */ + flowChildNode(node: Node, output?: string | null): Object; + /** + * Executes a flow of code in a different stage. + * + * Some nodes like `varying()` have the ability to compute code in vertex-stage and + * return the value in fragment-stage even if it is being executed in an input fragment. + * + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @param {Node} node - The node to execute. + * @param {?string} output - Expected output type. For example 'vec3'. + * @param {?string} propertyName - The property name to assign the result. + * @return {?(Object|Node)} The code flow or node.build() result. + */ + flowNodeFromShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any"), node: Node, output?: string | null, propertyName?: string | null): (Object | Node) | null; + /** + * Returns an array holding all node attributes of this node builder. + * + * @return {Array} The node attributes of this builder. + */ + getAttributesArray(): Array; + /** + * Returns the attribute definitions as a shader string for the given shader stage. + * + * @abstract + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The attribute code section. + */ + getAttributes(): string; + /** + * Returns the varying definitions as a shader string for the given shader stage. + * + * @abstract + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The varying code section. + */ + getVaryings(): string; + /** + * Returns a single variable definition as a shader string for the given variable type and name. + * + * @param {string} type - The variable's type. + * @param {string} name - The variable's name. + * @param {?number} [count=null] - The array length. + * @return {string} The shader string. + */ + getVar(type: string, name: string, count?: number | null): string; + /** + * Returns the variable definitions as a shader string for the given shader stage. + * + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @param {boolean} [global=false] - Whether the variables are global. + * @return {string} The variable code section. + */ + getVars(shaderStage: ("vertex" | "fragment" | "compute" | "any"), global?: boolean): string; + /** + * Returns the uniform definitions as a shader string for the given shader stage. + * + * @abstract + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The uniform code section. + */ + getUniforms(): string; + /** + * Returns the native code definitions as a shader string for the given shader stage. + * + * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. + * @return {string} The native code section. + */ + getCodes(shaderStage: ("vertex" | "fragment" | "compute" | "any")): string; + /** + * Returns the hash of this node builder. + * + * @return {string} The hash. + */ + getHash(): string; + /** + * Sets the current shader stage. + * + * @param {?('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage to set. + */ + setShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any") | null): void; + /** + * Returns the current shader stage. + * + * @return {?('vertex'|'fragment'|'compute'|'any')} The current shader stage. + */ + getShaderStage(): ("vertex" | "fragment" | "compute" | "any") | null; + /** + * Sets the current build stage. + * + * @param {?('setup'|'analyze'|'generate')} buildStage - The build stage to set. + */ + setBuildStage(buildStage: ("setup" | "analyze" | "generate") | null): void; + /** + * Returns the current build stage. + * + * @return {?('setup'|'analyze'|'generate')} The current build stage. + */ + getBuildStage(): ("setup" | "analyze" | "generate") | null; + /** + * Controls the code build of the shader stages. + * + * @abstract + */ + buildCode(): void; + /** + * Returns the current sub-build layer. + * + * @return {SubBuildNode} The current sub-build layers. + */ + get subBuild(): SubBuildNode; + /** + * Adds a sub-build layer to the node builder. + * + * @param {SubBuildNode} subBuild - The sub-build layer to add. + */ + addSubBuild(subBuild: SubBuildNode): void; + /** + * Removes the last sub-build layer from the node builder. + * + * @return {SubBuildNode} The removed sub-build layer. + */ + removeSubBuild(): SubBuildNode; + /** + * Returns the closest sub-build layer for the given data. + * + * @param {Node|Set|Array} data - The data to get the closest sub-build layer from. + * @return {?string} The closest sub-build name or null if none found. + */ + getClosestSubBuild(data: Node | Set | Array): string | null; + /** + * Returns the output node of a sub-build layer. + * + * @param {Node} node - The node to get the output from. + * @return {string} The output node name. + */ + getSubBuildOutput(node: Node): string; + /** + * Returns the sub-build property name for the given property and node. + * + * @param {string} [property=''] - The property name. + * @param {?Node} [node=null] - The node to get the sub-build from. + * @return {string} The sub-build property name. + */ + getSubBuildProperty(property?: string, node?: Node | null): string; + /** + * Prebuild the node builder. + */ + prebuild(): void; + /** + * Central build method which controls the build for the given object. + * + * @return {NodeBuilder} A reference to this node builder. + */ + build(): NodeBuilder; + /** + * Async version of build() that yields to main thread between shader stages. + * Use this in compileAsync() to prevent blocking the main thread. + * + * @return {Promise} A promise that resolves to this node builder. + */ + buildAsync(): Promise; + /** + * Returns shared data object for the given node. + * + * @param {Node} node - The node to get shared data from. + * @return {Object} The shared data. + */ + getSharedDataFromNode(node: Node): Object; + /** + * Returns a uniform representation which is later used for UBO generation and rendering. + * + * @param {NodeUniform} uniformNode - The uniform node. + * @param {string} type - The requested type. + * @return {Uniform} The uniform. + */ + getNodeUniform(uniformNode: NodeUniform, type: string): Uniform; + /** + * Formats the given shader snippet from a given type into another one. E.g. + * this method might be used to convert a simple float string `"1.0"` into a + * `vec3` representation: `"vec3( 1.0 )"`. + * + * @param {string} snippet - The shader snippet. + * @param {string} fromType - The source type. + * @param {string} toType - The target type. + * @return {string} The updated shader string. + */ + format(snippet: string, fromType: string, toType: string): string; + /** + * Returns a signature with the engine's current revision. + * + * @return {string} The signature. + */ + getSignature(): string; + /** + * Returns `true` if data from the previous frame are required. Relevant + * when computing motion vectors with {@link VelocityNode}. + * + * @return {boolean} Whether data from the previous frame are required or not. + */ + needsPreviousData(): boolean; +} +import BindGroup from '../../renderers/common/BindGroup.js'; +import NodeAttribute from './NodeAttribute.js'; +import NodeVarying from './NodeVarying.js'; +import NodeCode from './NodeCode.js'; +import NodeVar from './NodeVar.js'; +import FunctionNode from '../code/FunctionNode.js'; +import NodeCache from './NodeCache.js'; +import { RenderTarget } from '../../core/RenderTarget.js'; +import CubeRenderTarget from '../../renderers/common/CubeRenderTarget.js'; +import StructType from './StructType.js'; +import NodeUniform from './NodeUniform.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts new file mode 100644 index 000000000..0c192004d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts @@ -0,0 +1,47 @@ +export default NodeCache; +/** + * This utility class is used in {@link NodeBuilder} as an internal + * cache data structure for node data. + */ +declare class NodeCache { + /** + * Constructs a new node cache. + * + * @param {?NodeCache} parent - A reference to a parent cache. + */ + constructor(parent?: NodeCache | null); + /** + * The id of the cache. + * + * @type {number} + * @readonly + */ + readonly id: number; + /** + * A weak map for managing node data. + * + * @type {WeakMap} + */ + nodesData: WeakMap; + /** + * Reference to a parent node cache. + * + * @type {?NodeCache} + * @default null + */ + parent: NodeCache | null; + /** + * Returns the data for the given node. + * + * @param {Node} node - The node. + * @return {?Object} The data for the node. + */ + getData(node: Node): Object | null; + /** + * Sets the data for a given node. + * + * @param {Node} node - The node. + * @param {Object} data - The data that should be cached. + */ + setData(node: Node, data: Object): void; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts new file mode 100644 index 000000000..f96665f26 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts @@ -0,0 +1,36 @@ +export default NodeCode; +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent user-defined, native shader code portions that are going to be + * injected by the builder. A dictionary of node codes is maintained in {@link NodeBuilder#codes} + * for this purpose. + */ +declare class NodeCode { + /** + * Constructs a new code node. + * + * @param {string} name - The name of the code. + * @param {string} type - The node type. + * @param {string} [code=''] - The native shader code. + */ + constructor(name: string, type: string, code?: string); + /** + * The name of the code. + * + * @type {string} + */ + name: string; + /** + * The node type. + * + * @type {string} + */ + type: string; + /** + * The native shader code. + * + * @type {string} + * @default '' + */ + code: string; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts new file mode 100644 index 000000000..71d14d55f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts @@ -0,0 +1,13 @@ +export default NodeError; +/** + * Custom error class for node-related errors, including stack trace information. + */ +declare class NodeError extends Error { + constructor(message: any, stackTrace?: null); + /** + * The stack trace associated with the error. + * + * @type {?StackTrace} + */ + stackTrace: StackTrace | null; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts new file mode 100644 index 000000000..afaee4fe4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts @@ -0,0 +1,133 @@ +export default NodeFrame; +/** + * Management class for updating nodes. The module tracks metrics like + * the elapsed time, delta time, the render and frame ID to correctly + * call the node update methods {@link Node#updateBefore}, {@link Node#update} + * and {@link Node#updateAfter} depending on the node's configuration. + */ +declare class NodeFrame { + /** + * The elapsed time in seconds. + * + * @type {number} + * @default 0 + */ + time: number; + /** + * The delta time in seconds. + * + * @type {number} + * @default 0 + */ + deltaTime: number; + /** + * The frame ID. + * + * @type {number} + * @default 0 + */ + frameId: number; + /** + * The render ID. + * + * @type {number} + * @default 0 + */ + renderId: number; + /** + * Used to control the {@link Node#update} call. + * + * @type {WeakMap} + */ + updateMap: WeakMap; + /** + * Used to control the {@link Node#updateBefore} call. + * + * @type {WeakMap} + */ + updateBeforeMap: WeakMap; + /** + * Used to control the {@link Node#updateAfter} call. + * + * @type {WeakMap} + */ + updateAfterMap: WeakMap; + /** + * A reference to the current renderer. + * + * @type {?Renderer} + * @default null + */ + renderer: Renderer | null; + /** + * A reference to the current material. + * + * @type {?Material} + * @default null + */ + material: Material | null; + /** + * A reference to the current camera. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * A reference to the current 3D object. + * + * @type {?Object3D} + * @default null + */ + object: Object3D | null; + /** + * A reference to the current scene. + * + * @type {?Scene} + * @default null + */ + scene: Scene | null; + /** + * Returns a dictionary for a given node and update map which + * is used to correctly call node update methods per frame or render. + * + * @private + * @param {WeakMap} referenceMap - The reference weak map. + * @param {Node} nodeRef - The reference to the current node. + * @return {Object>} The dictionary. + */ + private _getMaps; + /** + * This method executes the {@link Node#updateBefore} for the given node. + * It makes sure {@link Node#updateBeforeType} is honored meaning the update + * is only executed once per frame, render or object depending on the update + * type. + * + * @param {Node} node - The node that should be updated. + */ + updateBeforeNode(node: Node): void; + /** + * This method executes the {@link Node#updateAfter} for the given node. + * It makes sure {@link Node#updateAfterType} is honored meaning the update + * is only executed once per frame, render or object depending on the update + * type. + * + * @param {Node} node - The node that should be updated. + */ + updateAfterNode(node: Node): void; + /** + * This method executes the {@link Node#update} for the given node. + * It makes sure {@link Node#updateType} is honored meaning the update + * is only executed once per frame, render or object depending on the update + * type. + * + * @param {Node} node - The node that should be updated. + */ + updateNode(node: Node): void; + /** + * Updates the internal state of the node frame. This method is + * called by the renderer in its internal animation loop. + */ + update(): void; + lastTime: number | undefined; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts new file mode 100644 index 000000000..ef2cdbc0a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts @@ -0,0 +1,55 @@ +export default NodeFunction; +/** + * Base class for node functions. A derived module must be implemented + * for each supported native shader language. Similar to other `Node*` modules, + * this class is only relevant during the building process and not used + * in user-level code. + */ +declare class NodeFunction { + /** + * Constructs a new node function. + * + * @param {string} type - The node type. This type is the return type of the node function. + * @param {Array} inputs - The function's inputs. + * @param {string} [name=''] - The function's name. + * @param {string} [precision=''] - The precision qualifier. + */ + constructor(type: string, inputs: Array, name?: string, precision?: string); + /** + * The node type. This type is the return type of the node function. + * + * @type {string} + */ + type: string; + /** + * The function's inputs. + * + * @type {Array} + */ + inputs: Array; + /** + * The name of the uniform. + * + * @type {string} + * @default '' + */ + name: string; + /** + * The precision qualifier. + * + * @type {string} + * @default '' + */ + precision: string; + /** + * This method returns the native code of the node function. + * + * @abstract + * @param {string} name - The function's name. + * @return {string} A shader code. + */ + getCode(): string; +} +declare namespace NodeFunction { + let isNodeFunction: boolean; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts new file mode 100644 index 000000000..3df5a1b75 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts @@ -0,0 +1,52 @@ +export default NodeFunctionInput; +/** + * Describes the input of a {@link NodeFunction}. + */ +declare class NodeFunctionInput { + /** + * Constructs a new node function input. + * + * @param {string} type - The input type. + * @param {string} name - The input name. + * @param {?number} [count=null] - If the input is an Array, count will be the length. + * @param {('in'|'out'|'inout')} [qualifier=''] - The parameter qualifier (only relevant for GLSL). + * @param {boolean} [isConst=false] - Whether the input uses a const qualifier or not (only relevant for GLSL). + */ + constructor(type: string, name: string, count?: number | null, qualifier?: ("in" | "out" | "inout"), isConst?: boolean); + /** + * The input type. + * + * @type {string} + */ + type: string; + /** + * The input name. + * + * @type {string} + */ + name: string; + /** + * If the input is an Array, count will be the length. + * + * @type {?number} + * @default null + */ + count: number | null; + /** + *The parameter qualifier (only relevant for GLSL). + * + * @type {('in'|'out'|'inout')} + * @default '' + */ + qualifier: ("in" | "out" | "inout"); + /** + * Whether the input uses a const qualifier or not (only relevant for GLSL). + * + * @type {boolean} + * @default false + */ + isConst: boolean; +} +declare namespace NodeFunctionInput { + let isNodeFunctionInput: boolean; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts new file mode 100644 index 000000000..f15875899 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts @@ -0,0 +1,15 @@ +export default NodeParser; +/** + * Base class for node parsers. A derived parser must be implemented + * for each supported native shader language. + */ +declare class NodeParser { + /** + * The method parses the given native code an returns a node function. + * + * @abstract + * @param {string} source - The native shader code. + * @return {NodeFunction} A node function. + */ + parseFunction(): NodeFunction; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts new file mode 100644 index 000000000..3f872f033 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts @@ -0,0 +1,62 @@ +export default NodeUniform; +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader uniforms that are going to be generated + * by the builder. A dictionary of node uniforms is maintained in {@link NodeBuilder#uniforms} + * for this purpose. + */ +declare class NodeUniform { + /** + * Constructs a new node uniform. + * + * @param {string} name - The name of the uniform. + * @param {string} type - The type of the uniform. + * @param {UniformNode} node - An reference to the node. + */ + constructor(name: string, type: string, node: UniformNode); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeUniform: boolean; + /** + * The name of the uniform. + * + * @type {string} + */ + name: string; + /** + * The type of the uniform. + * + * @type {string} + */ + type: string; + /** + * An reference to the node. + * + * @type {UniformNode} + */ + node: UniformNode; + set value(val: any); + /** + * The value of the uniform node. + * + * @type {any} + */ + get value(): any; + /** + * The id of the uniform node. + * + * @type {number} + */ + get id(): number; + /** + * The uniform node's group. + * + * @type {UniformGroupNode} + */ + get groupNode(): UniformGroupNode; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts new file mode 100644 index 000000000..527147b2a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts @@ -0,0 +1,103 @@ +/** + * Returns the data type for the given the length. + * + * @private + * @method + * @param {number} length - The length. + * @return {string} The data type. + */ +export function getTypeFromLength(length: number): string; +/** + * Returns the typed array for the given data type. + * + * @private + * @method + * @param {string} type - The data type. + * @return {TypedArray} The typed array. + */ +export function getTypedArrayFromType(type: string): TypedArray; +/** + * Returns the length for the given data type. + * + * @private + * @method + * @param {string} type - The data type. + * @return {number} The length. + */ +export function getLengthFromType(type: string): number; +/** + * Returns the gpu memory length for the given data type in 4-byte elements. + * + * @private + * @method + * @param {string} type - The data type. + * @return {number} The memory length in 4-byte elements. + */ +export function getMemoryLengthFromType(type: string): number; +/** + * Returns the alignment requirement for the given data type in 4-byte elements. + * + * @private + * @method + * @param {string} type - The data type. + * @return {number} The alignment requirement in 4-byte elements. + */ +export function getAlignmentFromType(type: string): number; +/** + * Returns the data type for the given value. + * + * @private + * @method + * @param {any} value - The value. + * @return {?string} The data type. + */ +export function getValueType(value: any): string | null; +/** + * Returns the node data type for the given texture. + * + * @private + * @method + * @param {Texture} texture - The texture. + * @return {string} The data type. + */ +export function getTextureType(texture: Texture): string; +/** + * Returns the value/object for the given data type and parameters. + * + * @private + * @method + * @param {string} type - The given type. + * @param {...any} params - A parameter list. + * @return {any} The value/object. + */ +export function getValueFromType(type: string, ...params: any[]): any; +/** + * Gets the object data that can be shared between different rendering steps. + * + * @private + * @param {Object} object - The object to get the data for. + * @return {Object} The object data. + */ +export function getDataFromObject(object: Object): Object; +/** + * Converts the given array buffer to a Base64 string. + * + * @private + * @method + * @param {ArrayBuffer} arrayBuffer - The array buffer. + * @return {string} The Base64 string. + */ +export function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string; +/** + * Converts the given Base64 string to an array buffer. + * + * @private + * @method + * @param {string} base64 - The Base64 string. + * @return {ArrayBuffer} The array buffer. + */ +export function base64ToArrayBuffer(base64: string): ArrayBuffer; +export function isArrayAsParameter(params: any): any; +export function hashString(str: string): number; +export function hashArray(array: Array): number; +export function hash(...params: number[]): number; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts new file mode 100644 index 000000000..43e82262f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts @@ -0,0 +1,50 @@ +export default NodeVar; +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader variables that are going to be generated + * by the builder. A dictionary of node variables is maintained in {@link NodeBuilder#vars} for + * this purpose. + */ +declare class NodeVar { + /** + * Constructs a new node variable. + * + * @param {string} name - The name of the variable. + * @param {string} type - The type of the variable. + * @param {boolean} [readOnly=false] - The read-only flag. + * @param {?number} [count=null] - The size. + */ + constructor(name: string, type: string, readOnly?: boolean, count?: number | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeVar: boolean; + /** + * The name of the variable. + * + * @type {string} + */ + name: string; + /** + * The type of the variable. + * + * @type {string} + */ + type: string; + /** + * The read-only flag. + * + * @type {boolean} + */ + readOnly: boolean; + /** + * The size. + * + * @type {?number} + */ + count: number | null; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts new file mode 100644 index 000000000..587fb0896 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts @@ -0,0 +1,51 @@ +export default NodeVarying; +/** + * {@link NodeBuilder} is going to create instances of this class during the build process + * of nodes. They represent the final shader varyings that are going to be generated + * by the builder. An array of node varyings is maintained in {@link NodeBuilder#varyings} for + * this purpose. + * + * @augments NodeVar + */ +declare class NodeVarying extends NodeVar { + /** + * Constructs a new node varying. + * + * @param {string} name - The name of the varying. + * @param {string} type - The type of the varying. + * @param {?string} interpolationType - The interpolation type of the varying. + * @param {?string} interpolationSampling - The interpolation sampling type of the varying. + */ + constructor(name: string, type: string, interpolationType?: string | null, interpolationSampling?: string | null); + /** + * Whether this varying requires interpolation or not. This property can be used + * to check if the varying can be optimized for a variable. + * + * @type {boolean} + * @default false + */ + needsInterpolation: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeVarying: boolean; + /** + * The interpolation type of the varying data. + * + * @type {?string} + * @default null + */ + interpolationType: string | null; + /** + * The interpolation sampling type of varying data. + * + * @type {?string} + * @default null + */ + interpolationSampling: string | null; +} +import NodeVar from './NodeVar.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts new file mode 100644 index 000000000..ea5448089 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts @@ -0,0 +1,41 @@ +export default OutputStructNode; +/** + * TSL function for creating an output struct node. + * + * @tsl + * @function + * @param {...Node} members - A parameter list of nodes. + * @returns {OutputStructNode} + */ +export const outputStruct: any; +/** + * This node can be used to define multiple outputs in a shader programs. + * + * @augments Node + */ +declare class OutputStructNode extends Node { + /** + * Constructs a new output struct node. The constructor can be invoked with an + * arbitrary number of nodes representing the members. + * + * @param {...Node} members - A parameter list of nodes. + */ + constructor(...members: Node[]); + /** + * An array of nodes which defines the output. + * + * @type {Array} + */ + members: Array; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOutputStructNode: boolean; + generateNodeType(): string; + generate(builder: any): any; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts new file mode 100644 index 000000000..dadc1807e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts @@ -0,0 +1,67 @@ +/** + * TSL function for creating an `OverrideContextNode` to override a single target node. + * + * ```js + * material.contextNode = overrideNode( positionLocal, ( builder ) => positionLocal.add( vec3( 1, 0, 0 ) ) ); + * ``` + * + * @tsl + * @function + * @param {Node} targetNode - The target node that should be overridden. + * @param {Function|Node|null} [callback=null] - A callback function returning the overriding node (which receives the builder as its argument), or the overriding node itself. + * @param {Node|null} [flowNode=null] - The node whose context should be modified. + * @return {OverrideContextNode} The created override context node. + */ +export function overrideNode(targetNode: Node, callback?: Function | Node | null, flowNode?: Node | null): OverrideContextNode; +/** + * TSL function for creating an `OverrideContextNode` to override multiple target nodes. + * + * ```js + * material.contextNode = overrideNodes( [ + * [ positionView, customPositionView ], + * [ positionViewDirection, ( builder ) => customPositionViewDirection ] + * ] ); + * ``` + * + * @tsl + * @function + * @param {Map|Array>} overrides - The overrides mapping target nodes to callback functions or overriding nodes. + * @param {Node|null} [flowNode=null] - The node whose context should be modified. + * @return {OverrideContextNode} The created override context node. + */ +export function overrideNodes(overrides: Map | Array>, flowNode?: Node | null): OverrideContextNode; +export default OverrideContextNode; +/** + * A specialized context node designed to override specific target nodes within a + * node sub-graph or flow. This allows replacing specific inputs (e.g., normal + * and position vectors) dynamically during compilation for a specific flow node, + * without having to reconstruct or duplicate the source nodes. + * + * ```js + * // Method chaining example: + * node.overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); + * + * // Context assignment example: + * material.contextNode = overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); + * ``` + * + * @augments ContextNode + */ +declare class OverrideContextNode extends ContextNode { + /** + * Constructs a new override context node. + * + * @param {Map} overrideNodes - A map mapping target nodes to their respective override callback functions. + * @param {Node|null} [flowNode=null] - The node whose context should be modified. + */ + constructor(overrideNodes: Map, flowNode?: Node | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOverrideContextNode: boolean; +} +import ContextNode from './ContextNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts new file mode 100644 index 000000000..6ab531096 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts @@ -0,0 +1,35 @@ +export default ParameterNode; +export function parameter(type: string, name: string | null): ParameterNode; +/** + * Special version of {@link PropertyNode} which is used for parameters. + * + * @augments PropertyNode + */ +declare class ParameterNode extends PropertyNode { + /** + * Constructs a new parameter node. + * + * @param {string} nodeType - The type of the node. + * @param {?string} [name=null] - The name of the parameter in the shader. + */ + constructor(nodeType: string, name?: string | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isParameterNode: boolean; + /** + * Gets the type of a member variable in the parameter node. + * + * @param {NodeBuilder} builder - The node builder. + * @param {string} name - The name of the member variable. + * @returns {string} + */ + getMemberType(builder: NodeBuilder, name: string): string; + getHash(): string; + generate(): string; +} +import PropertyNode from './PropertyNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts new file mode 100644 index 000000000..7c15780f7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts @@ -0,0 +1,277 @@ +export default PropertyNode; +export function property(type: string, name?: string | null, placeholderNode?: Node | null): PropertyNode; +export function varyingProperty(type: string, name?: string | null, placeholderNode?: Node | null): PropertyNode; +/** + * TSL object that represents the shader variable `DiffuseColor`. + * + * @tsl + * @type {PropertyNode} + */ +export const diffuseColor: PropertyNode; +/** + * TSL object that represents the shader variable `DiffuseContribution`. + * + * @tsl + * @type {PropertyNode} + */ +export const diffuseContribution: PropertyNode; +/** + * TSL object that represents the shader variable `EmissiveColor`. + * + * @tsl + * @type {PropertyNode} + */ +export const emissive: PropertyNode; +/** + * TSL object that represents the shader variable `Roughness`. + * + * @tsl + * @type {PropertyNode} + */ +export const roughness: PropertyNode; +/** + * TSL object that represents the shader variable `Metalness`. + * + * @tsl + * @type {PropertyNode} + */ +export const metalness: PropertyNode; +/** + * TSL object that represents the shader variable `Clearcoat`. + * + * @tsl + * @type {PropertyNode} + */ +export const clearcoat: PropertyNode; +/** + * TSL object that represents the shader variable `ClearcoatRoughness`. + * + * @tsl + * @type {PropertyNode} + */ +export const clearcoatRoughness: PropertyNode; +/** + * TSL object that represents the shader variable `Sheen`. + * + * @tsl + * @type {PropertyNode} + */ +export const sheen: PropertyNode; +/** + * TSL object that represents the shader variable `SheenRoughness`. + * + * @tsl + * @type {PropertyNode} + */ +export const sheenRoughness: PropertyNode; +/** + * TSL object that represents the shader variable `Iridescence`. + * + * @tsl + * @type {PropertyNode} + */ +export const iridescence: PropertyNode; +/** + * TSL object that represents the shader variable `IridescenceIOR`. + * + * @tsl + * @type {PropertyNode} + */ +export const iridescenceIOR: PropertyNode; +/** + * TSL object that represents the shader variable `IridescenceThickness`. + * + * @tsl + * @type {PropertyNode} + */ +export const iridescenceThickness: PropertyNode; +/** + * TSL object that represents the shader variable `AlphaT`. + * + * @tsl + * @type {PropertyNode} + */ +export const alphaT: PropertyNode; +/** + * TSL object that represents the shader variable `Anisotropy`. + * + * @tsl + * @type {PropertyNode} + */ +export const anisotropy: PropertyNode; +/** + * TSL object that represents the shader variable `AnisotropyT`. + * + * @tsl + * @type {PropertyNode} + */ +export const anisotropyT: PropertyNode; +/** + * TSL object that represents the shader variable `AnisotropyB`. + * + * @tsl + * @type {PropertyNode} + */ +export const anisotropyB: PropertyNode; +/** + * TSL object that represents the shader variable `SpecularColor`. + * + * @tsl + * @type {PropertyNode} + */ +export const specularColor: PropertyNode; +/** + * TSL object that represents the shader variable `SpecularColorBlended`. + * + * @tsl + * @type {PropertyNode} + */ +export const specularColorBlended: PropertyNode; +/** + * TSL object that represents the shader variable `SpecularF90`. + * + * @tsl + * @type {PropertyNode} + */ +export const specularF90: PropertyNode; +/** + * TSL object that represents the shader variable `Shininess`. + * + * @tsl + * @type {PropertyNode} + */ +export const shininess: PropertyNode; +/** + * TSL object that represents the shader variable `Output`. + * + * @tsl + * @type {PropertyNode} + */ +export const output: PropertyNode; +/** + * TSL object that represents the shader variable `dashSize`. + * + * @tsl + * @type {PropertyNode} + */ +export const dashSize: PropertyNode; +/** + * TSL object that represents the shader variable `gapSize`. + * + * @tsl + * @type {PropertyNode} + */ +export const gapSize: PropertyNode; +/** + * TSL object that represents the shader variable `pointWidth`. + * + * @tsl + * @type {PropertyNode} + */ +export const pointWidth: PropertyNode; +/** + * TSL object that represents the shader variable `IOR`. + * + * @tsl + * @type {PropertyNode} + */ +export const ior: PropertyNode; +/** + * TSL object that represents the shader variable `Transmission`. + * + * @tsl + * @type {PropertyNode} + */ +export const transmission: PropertyNode; +/** + * TSL object that represents the shader variable `Thickness`. + * + * @tsl + * @type {PropertyNode} + */ +export const thickness: PropertyNode; +/** + * TSL object that represents the shader variable `AttenuationDistance`. + * + * @tsl + * @type {PropertyNode} + */ +export const attenuationDistance: PropertyNode; +/** + * TSL object that represents the shader variable `AttenuationColor`. + * + * @tsl + * @type {PropertyNode} + */ +export const attenuationColor: PropertyNode; +/** + * TSL object that represents the shader variable `Dispersion`. + * + * @tsl + * @type {PropertyNode} + */ +export const dispersion: PropertyNode; +/** + * TSL object that represents the shader variable `Retroreflectivity`. + * + * @tsl + * @type {PropertyNode} + */ +export const retroreflectivity: PropertyNode; +/** + * TSL object that represents the shader variable `AmbientOcclusion`. + * If no value is assigned to this property, it defaults to a placeholder value of `1.0`. + * + * @tsl + * @type {PropertyNode} + */ +export const ambientOcclusion: PropertyNode; +/** + * This class represents a shader property. It can be used + * to explicitly define a property and assign a value to it. + * + * ```js + * const threshold = property( 'float', 'threshold' ).assign( THRESHOLD ); + *``` + * `PropertyNode` is used by the engine to predefined common material properties + * for TSL code. + * + * @augments Node + */ +declare class PropertyNode extends Node { + /** + * Constructs a new property node. + * + * @param {string} nodeType - The type of the node. + * @param {?string} [name=null] - The name of the property in the shader. + * @param {boolean} [varying=false] - Whether this property is a varying or not. + * @param {?Node} [placeholderNode=null] - The placeholder node if not assigned. + */ + constructor(nodeType: string, name?: string | null, varying?: boolean, placeholderNode?: Node | null); + /** + * Whether this property is a varying or not. + * + * @type {boolean} + * @default false + */ + varying: boolean; + /** + * The placeholder node of the property if it is not assigned. + * + * @type {?Node} + * @default null + */ + placeholderNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPropertyNode: boolean; + getNodeType(builder: any): any; + getHash(builder: any): string; + generate(builder: any): any; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts new file mode 100644 index 000000000..279abd734 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts @@ -0,0 +1,150 @@ +export default StackNode; +/** + * TSL function for creating a stack node. + * + * @tsl + * @function + * @param {?StackNode} [parent=null] - The parent stack node. + * @returns {StackNode} + */ +export const stack: any; +/** + * Stack is a helper for Nodes that need to produce stack-based code instead of continuous flow. + * They are usually needed in cases like `If`, `Else`. + * + * @augments Node + */ +declare class StackNode extends Node { + /** + * Constructs a new stack node. + * + * @param {?StackNode} [parent=null] - The parent stack node. + */ + constructor(parent?: StackNode | null); + /** + * List of nodes. + * + * @type {Array} + */ + nodes: Array; + /** + * The output node. + * + * @type {?Node} + * @default null + */ + outputNode: Node | null; + /** + * The parent stack node. + * + * @type {?StackNode} + * @default null + */ + parent: StackNode | null; + /** + * The current conditional node. + * + * @private + * @type {ConditionalNode} + * @default null + */ + private _currentCond; + /** + * The expression node. Only + * relevant for Switch/Case. + * + * @private + * @type {Node} + * @default null + */ + private _expressionNode; + /** + * The current node being processed. + * + * @private + * @type {Node} + * @default null + */ + private _currentNode; + /** + * Stores additional data for nodes that are added to the stack. + * + * @private + * @type {Map} + */ + private _nodeDataLibrary; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStackNode: boolean; + getElementType(builder: any): string; + generateNodeType(builder: any): string; + getMemberType(builder: any, name: any): string; + /** + * Adds a node to this stack. + * + * @param {Node} node - The node to add. + * @param {number} [index=-1] - The index of the node. If not specified, the node will be added to the end of the stack. + * @return {StackNode} A reference to this stack node. + */ + addToStack(node: Node, index?: number): StackNode; + /** + * Adds a node to the stack before the current node. + * + * @param {Node} node - The node to add. + * @return {StackNode} A reference to this stack node. + */ + addToStackBefore(node: Node): StackNode; + /** + * Represent an `if` statement in TSL. + * + * @param {Node} boolNode - Represents the condition. + * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. + * @return {StackNode} A reference to this stack node. + */ + If(boolNode: Node, method: Function): StackNode; + /** + * Represent an `elseif` statement in TSL. + * + * @param {Node} boolNode - Represents the condition. + * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. + * @return {StackNode} A reference to this stack node. + */ + ElseIf(boolNode: Node, method: Function): StackNode; + /** + * Represent an `else` statement in TSL. + * + * @param {Function} method - TSL code which is executed in the `else` case. + * @return {StackNode} A reference to this stack node. + */ + Else(method: Function): StackNode; + /** + * Represents a `switch` statement in TSL. + * + * @param {any} expression - Represents the expression. + * @return {StackNode} A reference to this stack node. + */ + Switch(expression: any): StackNode; + /** + * Represents a `case` statement in TSL. The TSL version accepts an arbitrary numbers of values. + * The last parameter must be the callback method that should be executed in the `true` case. + * + * @param {...any} params - The values of the `Case()` statement as well as the callback method. + * @return {StackNode} A reference to this stack node. + */ + Case(...params: any[]): StackNode; + /** + * Represents the default code block of a Switch/Case statement. + * + * @param {Function} method - TSL code which is executed in the `else` case. + * @return {StackNode} A reference to this stack node. + */ + Default(method: Function): StackNode; + setup(builder: any): any; + build(builder: any, ...params: any[]): string | Node | null | undefined; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts new file mode 100644 index 000000000..d870b1d2f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts @@ -0,0 +1,44 @@ +export default StackTrace; +/** + * Class representing a stack trace for debugging purposes. + */ +declare class StackTrace { + /** + * Creates a StackTrace instance by capturing and filtering the current stack trace. + * + * @param {Error|string|null} stackMessage - An optional stack trace to use instead of capturing a new one. + */ + constructor(stackMessage?: Error | string | null); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStackTrace: boolean; + /** + * The stack trace. + * + * @type {Array<{fn: string, file: string, line: number, column: number}>} + */ + stack: Array<{ + fn: string; + file: string; + line: number; + column: number; + }>; + /** + * Returns a formatted location string of the top stack frame. + * + * @returns {string} The formatted stack trace message. + */ + getLocation(): string; + /** + * Returns the full error message including the stack trace. + * + * @param {string} message - The error message. + * @returns {string} The full error message with stack trace. + */ + getError(message: string): string; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts new file mode 100644 index 000000000..0b9c6e2d8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts @@ -0,0 +1,33 @@ +export default StructNode; +export function struct(membersLayout: Object, name?: string | null): Function; +/** + * StructNode allows to create custom structures with multiple members. + * This can also be used to define structures in attribute and uniform data. + * + * ```js + * // Define a custom struct + * const BoundingBox = struct( { min: 'vec3', max: 'vec3' } ); + * + * // Create a new instance of the struct + * const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1 + * const bb = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2 + * + * // Access the struct members + * const min = bb.get( 'min' ); + * + * // Assign a new value to a member + * min.assign( vec3() ); + * ``` + * @augments Node + */ +declare class StructNode extends Node { + constructor(structTypeNode: any, values: any); + structTypeNode: any; + values: any; + isStructNode: boolean; + generateNodeType(builder: any): any; + getMemberType(builder: any, name: any): any; + _getChildren(): Object[]; + generate(builder: any): any; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts new file mode 100644 index 000000000..af08042f6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts @@ -0,0 +1,7 @@ +export default StructType; +declare class StructType { + constructor(name: any, members: any); + name: any; + members: any; + output: boolean; +} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts new file mode 100644 index 000000000..7fb5881df --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts @@ -0,0 +1,49 @@ +export default StructTypeNode; +/** + * Represents a struct type node in the node-based system. + * This class is used to define and manage the layout and types of struct members. + * It extends the base Node class and provides methods to get the length of the struct, + * retrieve member types, and generate the struct type for a builder. + * + * @augments Node + */ +declare class StructTypeNode extends Node { + /** + * Creates an instance of StructTypeNode. + * + * @param {Object} membersLayout - The layout of the members for the struct. + * @param {?string} [name=null] - The optional name of the struct. + */ + constructor(membersLayout: Object, name?: string | null); + /** + * The layout of the members for the struct + * + * @type {Array.<{name: string, type: string, atomic: boolean}>} + */ + membersLayout: Array<{ + name: string; + type: string; + atomic: boolean; + }>; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStructTypeNode: boolean; + /** + * Returns the length of the struct in 4-byte elements (e.g. float or int components). + * The length is calculated by summing the lengths of the struct's members, accounting for memory alignment. + * To get the size in bytes, multiply the returned value by 4. + * + * @returns {number} The length of the struct in 4-byte elements. + */ + getLength(): number; + getMemberType(builder: any, name: any): string; + generateNodeType(builder: any): any; + setup(builder: any): void; + generate(builder: any): string; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts new file mode 100644 index 000000000..a5227f1b6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts @@ -0,0 +1,30 @@ +export default SubBuildNode; +export function subBuild(node: Node, name: string, type?: string | null): Node; +/** + * This node is used to build a sub-build in the node system. + * + * @augments Node + * @param {Node} node - The node to be built in the sub-build. + * @param {string} name - The name of the sub-build. + * @param {?string} [nodeType=null] - The type of the node, if known. + */ +declare class SubBuildNode extends Node { + constructor(node: any, name: any, nodeType?: null); + /** + * The node to be built in the sub-build. + * + * @type {Node} + */ + node: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSubBuildNode: boolean; + generateNodeType(builder: any): string; + build(builder: any, ...params: any[]): string | Node | null; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts new file mode 100644 index 000000000..ed3119f09 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts @@ -0,0 +1,28 @@ +export default TempNode; +/** + * This module uses cache management to create temporary variables + * if the node is used more than once to prevent duplicate calculations. + * + * The class acts as a base class for many other nodes types. + * + * @augments Node + */ +declare class TempNode extends Node { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTempNode: boolean; + /** + * Whether this node is used more than once in context of other nodes. + * + * @param {NodeBuilder} builder - The node builder. + * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. + */ + hasDependencies(builder: NodeBuilder): boolean; + build(builder: any, output: any): any; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts new file mode 100644 index 000000000..04956ab9c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts @@ -0,0 +1,78 @@ +export default UniformGroupNode; +export function uniformGroup(name: string, order?: number, updateType?: null): UniformGroupNode; +export function sharedUniformGroup(name: string, order?: number, updateType?: null): UniformGroupNode; +/** + * TSL object that represents a shared uniform group node which is updated once per frame. + * + * @tsl + * @type {UniformGroupNode} + */ +export const frameGroup: UniformGroupNode; +/** + * TSL object that represents a shared uniform group node which is updated once per render. + * + * @tsl + * @type {UniformGroupNode} + */ +export const renderGroup: UniformGroupNode; +/** + * TSL object that represents a uniform group node which is updated once per object. + * + * @tsl + * @type {UniformGroupNode} + */ +export const objectGroup: UniformGroupNode; +/** + * This node can be used to group single instances of {@link UniformNode} + * and manage them as a uniform buffer. + * + * In most cases, the predefined nodes `objectGroup`, `renderGroup` and `frameGroup` + * will be used when defining the {@link UniformNode#groupNode} property. + * + * - `objectGroup`: Uniform buffer per object. + * - `renderGroup`: Shared uniform buffer, updated once per render call. + * - `frameGroup`: Shared uniform buffer, updated once per frame. + * + * @augments Node + */ +declare class UniformGroupNode extends Node { + /** + * Constructs a new uniform group node. + * + * @param {string} name - The name of the uniform group node. + * @param {boolean} [shared=false] - Whether this uniform group node is shared or not. + * @param {number} [order=1] - Influences the internal sorting. + * @param {string|null} [updateType=null] - The update type of the uniform group node. + */ + constructor(name: string, shared?: boolean, order?: number, updateType?: string | null); + /** + * Whether this uniform group node is shared or not. + * + * @type {boolean} + * @default false + */ + shared: boolean; + /** + * The sort key that determines the order of this group relative to other + * uniform groups. Groups with a lower order are placed first. Shared groups + * typically use a lower order so they precede regular per-object groups. + * + * @type {number} + * @default 1 + */ + order: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformGroup: boolean; + /** + * Marks the uniform group node as needing an update. + * This will trigger the necessary updates in the rendering process. + */ + update(): void; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts new file mode 100644 index 000000000..780398f37 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts @@ -0,0 +1,73 @@ +export default UniformNode; +export function uniform(value: any | string, type?: string): UniformNode; +/** + * Class for representing a uniform. + * + * @augments InputNode + */ +declare class UniformNode extends InputNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformNode: boolean; + /** + * The uniform group of this uniform. By default, uniforms are + * managed per object but they might belong to a shared group + * which is updated per frame or render call. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; + /** + * Sets the {@link UniformNode#name} property. + * + * @param {string} name - The name of the uniform. + * @return {UniformNode} A reference to this node. + */ + setName(name: string): UniformNode; + /** + * Sets the {@link UniformNode#name} property. + * + * @deprecated + * @param {string} name - The name of the uniform. + * @return {UniformNode} A reference to this node. + */ + label(name: string): UniformNode; + /** + * Sets the {@link UniformNode#groupNode} property. + * + * @param {UniformGroupNode} group - The uniform group. + * @return {UniformNode} A reference to this node. + */ + setGroup(group: UniformGroupNode): UniformNode; + /** + * Returns the {@link UniformNode#groupNode}. + * + * @return {UniformGroupNode} The uniform group. + */ + getGroup(): UniformGroupNode; + /** + * By default, this method returns the result of {@link Node#getHash} but derived + * classes might overwrite this method with a different implementation. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The uniform hash. + */ + getUniformHash(builder: NodeBuilder): string; + /** + * Uniform nodes with the same hash share a single uniform. This method returns the node + * the shared uniform refers to which is the first node registered for the hash. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {UniformNode} The node the shared uniform refers to. + */ + getSharedNode(builder: NodeBuilder): UniformNode; + onUpdate(callback: any, updateType: any): import("./Node.js").default; + getInputType(builder: any): string; + generate(builder: any, output: any): any; +} +import InputNode from './InputNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts new file mode 100644 index 000000000..5e200133c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts @@ -0,0 +1,88 @@ +export default VarNode; +export function Var(node: Node, name?: string | null): VarNode; +export function Const(node: Node, name?: string | null): VarNode; +export function VarIntent(node: Node): VarNode; +/** + * Class for representing shader variables as nodes. Variables are created from + * existing nodes like the following: + * + * ```js + * const depth = sampleDepth( uvNode ).toVar( 'depth' ); + * ``` + * + * @augments Node + */ +declare class VarNode extends Node { + /** + * Constructs a new variable node. + * + * @param {Node} node - The node for which a variable should be created. + * @param {?string} [name=null] - The name of the variable in the shader. + * @param {boolean} [readOnly=false] - The read-only flag. + */ + constructor(node: Node, name?: string | null, readOnly?: boolean); + /** + * The node for which a variable should be created. + * + * @type {Node} + */ + node: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVarNode: boolean; + /** + * + * The read-only flag. + * + * @type {boolean} + * @default false + */ + readOnly: boolean; + /** + * This flag is used to indicate that this node is used for intent. + * + * @type {boolean} + * @default false + */ + intent: boolean; + /** + * Sets the intent flag for this node. + * + * This flag is used to indicate that this node is used for intent + * and should not be built directly. Instead, it is used to indicate that + * the node should be treated as a variable intent. + * + * It's useful for assigning variables without needing creating a new variable node. + * + * @param {boolean} value - The value to set for the intent flag. + * @returns {VarNode} This node. + */ + setIntent(value: boolean): VarNode; + /** + * Checks if this node is used for intent. + * + * @param {NodeBuilder} builder - The node builder. + * @returns {boolean} Whether this node is used for intent. + */ + isIntent(builder: NodeBuilder): boolean; + /** + * Returns the intent flag of this node. + * + * @return {boolean} The intent flag. + */ + getIntent(): boolean; + getMemberType(builder: any, name: any): string; + getElementType(builder: any): string; + generateNodeType(builder: any): string; + getArrayCount(builder: any): number | null; + isAssign(builder: any): any; + build(...params: any[]): string | Node | null; + generate(builder: any): any; + _hasStack(builder: any): boolean; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts new file mode 100644 index 000000000..4833ad311 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts @@ -0,0 +1,80 @@ +export default VaryingNode; +/** + * TSL function for creating a varying node. + * + * @tsl + * @function + * @param {Node} node - The node for which a varying should be created. + * @param {?string} name - The name of the varying in the shader. + * @returns {VaryingNode} + */ +export const varying: any; +export function vertexStage(node: Node): VaryingNode; +/** + * Class for representing shader varyings as nodes. Varyings are create from + * existing nodes like the following: + * + * ```js + * const positionLocal = positionGeometry.toVarying( 'vPositionLocal' ); + * ``` + * + * @augments Node + */ +declare class VaryingNode extends Node { + /** + * Constructs a new varying node. + * + * @param {Node} node - The node for which a varying should be created. + * @param {?string} name - The name of the varying in the shader. + */ + constructor(node: Node, name?: string | null); + /** + * The node for which a varying should be created. + * + * @type {Node} + */ + node: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVaryingNode: boolean; + /** + * The interpolation type of the varying data. + * + * @type {?string} + * @default null + */ + interpolationType: string | null; + /** + * The interpolation sampling type of varying data. + * + * @type {?string} + * @default null + */ + interpolationSampling: string | null; + /** + * Defines the interpolation type of the varying. + * + * @param {string} type - The interpolation type. + * @param {?string} sampling - The interpolation sampling type + * @return {VaryingNode} A reference to this node. + */ + setInterpolation(type: string, sampling?: string | null): VaryingNode; + getHash(builder: any): string; + generateNodeType(builder: any): string; + /** + * This method performs the setup of a varying node with the current node builder. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {NodeVarying} The node varying from the node builder. + */ + setupVarying(builder: NodeBuilder): NodeVarying; + setup(builder: any): void; + analyze(builder: any): void; + generate(builder: any): any; +} +import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts new file mode 100644 index 000000000..5d342ff3a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts @@ -0,0 +1,30 @@ +export namespace NodeShaderStage { + let VERTEX: string; + let FRAGMENT: string; +} +export namespace NodeUpdateType { + let NONE: string; + let FRAME: string; + let RENDER: string; + let OBJECT: string; +} +export namespace NodeType { + let BOOLEAN: string; + let INTEGER: string; + let FLOAT: string; + let VECTOR2: string; + let VECTOR3: string; + let VECTOR4: string; + let MATRIX2: string; + let MATRIX3: string; + let MATRIX4: string; +} +export namespace NodeAccess { + let READ_ONLY: string; + let WRITE_ONLY: string; + let READ_WRITE: string; +} +export const defaultShaderStages: string[]; +export const defaultBuildStages: string[]; +export const shaderStages: string[]; +export const vectorComponents: string[]; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts new file mode 100644 index 000000000..243a98ae5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts @@ -0,0 +1,67 @@ +/** + * Represents a "Color Burn" blend mode. + * + * It's designed to darken the base layer's colors based on the color of the blend layer. + * It significantly increases the contrast of the base layer, making the colors more vibrant and saturated. + * The darker the color in the blend layer, the stronger the darkening and contrast effect on the base layer. + * + * @tsl + * @function + * @param {Node} base - The base color. + * @param {Node} blend - The blend color. A white (#ffffff) blend color does not alter the base color. + * @return {Node} The result. + */ +export const blendBurn: any; +/** + * Represents a "Color Dodge" blend mode. + * + * It's designed to lighten the base layer's colors based on the color of the blend layer. + * It significantly increases the brightness of the base layer, making the colors lighter and more vibrant. + * The brighter the color in the blend layer, the stronger the lightening and contrast effect on the base layer. + * + * @tsl + * @function + * @param {Node} base - The base color. + * @param {Node} blend - The blend color. A black (#000000) blend color does not alter the base color. + * @return {Node} The result. + */ +export const blendDodge: any; +/** + * Represents a "Screen" blend mode. + * + * Similar to `blendDodge()`, this mode also lightens the base layer's colors based on the color of the blend layer. + * The "Screen" blend mode is better for general brightening whereas the "Dodge" results in more subtle and nuanced + * effects. + * + * @tsl + * @function + * @param {Node} base - The base color. + * @param {Node} blend - The blend color. A black (#000000) blend color does not alter the base color. + * @return {Node} The result. + */ +export const blendScreen: any; +/** + * Represents a "Overlay" blend mode. + * + * It's designed to increase the contrast of the base layer based on the color of the blend layer. + * It amplifies the existing colors and contrast in the base layer, making lighter areas lighter and darker areas darker. + * The color of the blend layer significantly influences the resulting contrast and color shift in the base layer. + * + * @tsl + * @function + * @param {Node} base - The base color. + * @param {Node} blend - The blend color + * @return {Node} The result. + */ +export const blendOverlay: any; +/** + * This function blends two color based on their alpha values by replicating the behavior of `THREE.NormalBlending`. + * It assumes both input colors have non-premultiplied alpha. + * + * @tsl + * @function + * @param {Node} base - The base color. + * @param {Node} blend - The blend color + * @return {Node} The result. + */ +export const blendColor: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts new file mode 100644 index 000000000..be1b07013 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts @@ -0,0 +1,44 @@ +export default BumpMapNode; +/** + * TSL function for creating a bump map node. + * + * @tsl + * @function + * @param {Node} textureNode - Represents the bump map data. + * @param {?Node} [scaleNode=null] - Controls the intensity of the bump effect. + * @returns {BumpMapNode} + */ +export const bumpMap: any; +/** + * This class can be used for applying bump maps to materials. + * + * ```js + * material.normalNode = bumpMap( texture( bumpTex ) ); + * ``` + * + * @augments TempNode + */ +declare class BumpMapNode extends TempNode { + /** + * Constructs a new bump map node. + * + * @param {Node} textureNode - Represents the bump map data. + * @param {?Node} [scaleNode=null] - Controls the intensity of the bump effect. + */ + constructor(textureNode: Node, scaleNode?: Node | null); + /** + * Represents the bump map data. + * + * @type {Node} + */ + textureNode: Node; + /** + * Controls the intensity of the bump effect. + * + * @type {?Node} + * @default null + */ + scaleNode: Node | null; + setup(builder: any): any; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts new file mode 100644 index 000000000..37d9b6b99 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts @@ -0,0 +1,76 @@ +/** + * Computes a grayscale value for the given RGB color value. + * + * @tsl + * @function + * @param {Node} color - The color value to compute the grayscale for. + * @return {Node} The grayscale color. + */ +export const grayscale: () => void; +/** + * Super-saturates or desaturates the given RGB color. + * + * @tsl + * @function + * @param {Node} color - The input color. + * @param {Node} [adjustment=1] - Specifies the amount of the conversion. A value under `1` desaturates the color, a value over `1` super-saturates it. + * @return {Node} The saturated color. + */ +export const saturation: () => void; +/** + * Selectively enhance the intensity of less saturated RGB colors. Can result + * in a more natural and visually appealing image with enhanced color depth + * compared to {@link ColorAdjustment#saturation}. + * + * @tsl + * @function + * @param {Node} color - The input color. + * @param {Node} [adjustment=0] - Controls the intensity of the vibrance effect. + * @return {Node} The updated color. + */ +export const vibrance: () => void; +/** + * Updates the hue component of the given RGB color while preserving its luminance and saturation. + * + * @tsl + * @function + * @param {Node} color - The input color. + * @param {Node} [adjustment=1] - Defines the degree of hue rotation in radians. A positive value rotates the hue clockwise, while a negative value rotates it counterclockwise. + * @return {Node} The updated color. + */ +export const hue: () => void; +export function luminance(color: Node, luminanceCoefficients?: Node | null): Node; +/** + * Color Decision List (CDL) v1.2 + * + * Compact representation of color grading information, defined by slope, offset, power, and + * saturation. The CDL should be typically be given input in a log space (such as LogC, ACEScc, + * or AgX Log), and will return output in the same space. Output may require clamping >=0. + * + * @tsl + * @function + * @param {Node} color Input (-Infinity < input < +Infinity) + * @param {Node} slope Slope (0 ≤ slope < +Infinity) + * @param {Node} offset Offset (-Infinity < offset < +Infinity; typically -1 < offset < 1) + * @param {Node} power Power (0 < power < +Infinity) + * @param {Node} saturation Saturation (0 ≤ saturation < +Infinity; typically 0 ≤ saturation < 4) + * @param {Node} luminanceCoefficients Luminance coefficients for saturation term, typically Rec. 709 + * @return {Node} Output, -Infinity < output < +Infinity + * + * References: + * - ASC CDL v1.2 + * - {@link https://blender.stackexchange.com/a/55239/43930} + * - {@link https://docs.acescentral.com/specifications/acescc/} + */ +export const cdl: () => void; +/** + * TSL function for creating a posterize effect which reduces the number of colors + * in an image, resulting in a more blocky and stylized appearance. + * + * @tsl + * @function + * @param {Node} sourceNode - The input color. + * @param {Node} stepsNode - Controls the intensity of the posterization effect. A lower number results in a more blocky appearance. + * @returns {Node} The posterized color. + */ +export const posterize: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts new file mode 100644 index 000000000..2677fb978 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts @@ -0,0 +1,18 @@ +/** + * Converts the given color value from sRGB to linear-sRGB color space. + * + * @tsl + * @function + * @param {Node} color - The sRGB color. + * @return {Node} The linear-sRGB color. + */ +export const sRGBTransferEOTF: any; +/** + * Converts the given color value from linear-sRGB to sRGB color space. + * + * @tsl + * @function + * @param {Node} color - The linear-sRGB color. + * @return {Node} The sRGB color. + */ +export const sRGBTransferOETF: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts new file mode 100644 index 000000000..37eaac303 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts @@ -0,0 +1,50 @@ +export default ColorSpaceNode; +export function workingToColorSpace(node: Node, targetColorSpace: string): ColorSpaceNode; +export function colorSpaceToWorking(node: Node, sourceColorSpace: string): ColorSpaceNode; +export function convertColorSpace(node: Node, sourceColorSpace: string, targetColorSpace: string): ColorSpaceNode; +/** + * This node represents a color space conversion. Meaning it converts + * a color value from a source to a target color space. + * + * @augments TempNode + */ +declare class ColorSpaceNode extends TempNode { + /** + * Constructs a new color space node. + * + * @param {Node} colorNode - Represents the color to convert. + * @param {string} source - The source color space. + * @param {string} target - The target color space. + */ + constructor(colorNode: Node, source: string, target: string); + /** + * Represents the color to convert. + * + * @type {Node} + */ + colorNode: Node; + /** + * The source color space. + * + * @type {string} + */ + source: string; + /** + * The target color space. + * + * @type {string} + */ + target: string; + /** + * This method resolves the constants `WORKING_COLOR_SPACE` and + * `OUTPUT_COLOR_SPACE` based on the current configuration of the + * color management and renderer. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} colorSpace - The color space to resolve. + * @return {string} The resolved color space. + */ + resolveColorSpace(builder: NodeBuilder, colorSpace: string): string; + setup(builder: any): Node; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts new file mode 100644 index 000000000..b1d3e7e1c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts @@ -0,0 +1,53 @@ +export default FrontFacingNode; +/** + * TSL object that represents whether a primitive is front or back facing + * + * @tsl + * @type {FrontFacingNode} + */ +export const frontFacing: FrontFacingNode; +/** + * TSL object that represents the front facing status as a number instead of a bool. + * `1` means front facing, `-1` means back facing. + * + * @tsl + * @type {Node} + */ +export const faceDirection: Node; +/** + * Negates a vector if the rendering occurs on the back side of a face, + * based on the material's side configuration. + * + * - If the material's side is `BackSide`, the vector is inverted (negated). + * - If the material's side is `DoubleSide`, the vector is multiplied by `faceDirection` + * (negated only for back-facing fragments). + * - If the material's side is `FrontSide` (default), the vector remains unchanged. + * + * @tsl + * @function + * @param {Node} vector - The vector to process. + * @returns {Node} The processed vector. + */ +export const negateOnBackSide: () => void; +export function directionToFaceDirection(vector: Node): Node; +/** + * This node can be used to evaluate whether a primitive is front or back facing. + * + * @augments Node + */ +declare class FrontFacingNode extends Node { + /** + * Constructs a new front facing node. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isFrontFacingNode: boolean; + generate(builder: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts new file mode 100644 index 000000000..a87be475f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts @@ -0,0 +1,58 @@ +export default NormalMapNode; +/** + * TSL function for creating a normal map node. + * + * @tsl + * @function + * @param {Node} node - Represents the normal map data. + * @param {?Node} [scaleNode=null] - Controls the intensity of the effect. + * @returns {NormalMapNode} + */ +export const normalMap: any; +/** + * This class can be used for applying normals maps to materials. + * + * ```js + * material.normalNode = normalMap( texture( normalTex ) ); + * ``` + * + * @augments TempNode + */ +declare class NormalMapNode extends TempNode { + /** + * Constructs a new normal map node. + * + * @param {Node} node - Represents the normal map data. + * @param {?Node} [scaleNode=null] - Controls the intensity of the effect. + */ + constructor(node: Node, scaleNode?: Node | null); + /** + * Represents the normal map data. + * + * @type {Node} + */ + node: Node; + /** + * Controls the intensity of the effect. + * + * @type {?Node} + * @default null + */ + scaleNode: Node | null; + /** + * The normal map type. + * + * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} + * @default TangentSpaceNormalMap + */ + normalMapType: (number | number); + /** + * Controls how to unpack the sampled normal map values. + * + * @type {string} + * @default NoNormalPacking + */ + unpackNormalMode: string; + setup(builder: any): any; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts new file mode 100644 index 000000000..7c6731f50 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts @@ -0,0 +1,432 @@ +export default PassNode; +export function pass(scene: Scene, camera: Camera, options: Object): PassNode; +export function passTexture(pass: PassNode, texture: Texture): PassTextureNode; +export function depthPass(scene: Scene, camera: Camera, options: Object): PassNode; +/** + * Represents a render pass (sometimes called beauty pass) in context of post processing. + * This pass produces a render for the given scene and camera and can provide multiple outputs + * via MRT for further processing. + * + * ```js + * const postProcessing = new RenderPipeline( renderer ); + * + * const scenePass = pass( scene, camera ); + * + * postProcessing.outputNode = scenePass; + * ``` + * + * @augments TempNode + */ +declare class PassNode extends TempNode { + /** + * Constructs a new pass node. + * + * @param {('color'|'depth')} scope - The scope of the pass. The scope determines whether the node outputs color or depth. + * @param {Scene} scene - A reference to the scene. + * @param {Camera} camera - A reference to the camera. + * @param {Object} options - Options for the internal render target. + */ + constructor(scope: ("color" | "depth"), scene: Scene, camera: Camera, options?: Object); + /** + * The scope of the pass. The scope determines whether the node outputs color or depth. + * + * @type {('color'|'depth')} + */ + scope: ("color" | "depth"); + /** + * A reference to the scene. + * + * @type {Scene} + */ + scene: Scene; + /** + * A reference to the camera. + * + * @type {Camera} + */ + camera: Camera; + /** + * Options for the internal render target. + * + * @type {Object} + */ + options: Object; + /** + * The pass's pixel width. Will be kept automatically kept in sync with the renderer's width. + * @private + * @type {number} + * @default 1 + */ + private _width; + /** + * The pass's pixel height. Will be kept automatically kept in sync with the renderer's height. + * @private + * @type {number} + * @default 1 + */ + private _height; + /** + * The pass's render target. + * + * @type {RenderTarget} + */ + renderTarget: RenderTarget; + /** + * An optional override material for the pass. + * + * @type {Material|null} + */ + overrideMaterial: Material | null; + /** + * Whether the pass is transparent. + * + * @type {boolean} + * @default false + */ + transparent: boolean; + /** + * Whether the pass is opaque. + * + * @type {boolean} + * @default true + */ + opaque: boolean; + lighting: any; + /** + * Whether the renderer should automatically clear before rendering the pass. + * + * @type {boolean} + * @default true + */ + autoClear: boolean; + /** + * Whether the color buffer should be cleared. + * + * @type {boolean} + * @default true + */ + autoClearColor: boolean; + /** + * Whether the depth buffer should be cleared. + * + * @type {boolean} + * @default true + */ + autoClearDepth: boolean; + /** + * Whether the stencil buffer should be cleared. + * + * @type {boolean} + * @default true + */ + autoClearStencil: boolean; + /** + * An optional global context for the pass. + * + * @type {ContextNode|null} + */ + contextNode: ContextNode | null; + /** + * A cache for the context node. + * + * @private + * @type {?Object} + * @default null + */ + private _contextNodeCache; + /** + * A dictionary holding the internal result textures. + * + * @private + * @type {{ output: Texture, depth: ?DepthTexture }} + */ + private _textures; + /** + * A dictionary holding the internal texture nodes. + * + * @private + * @type {Object} + */ + private _textureNodes; + /** + * A dictionary holding the internal depth nodes. + * + * @private + * @type {Object} + */ + private _linearDepthNodes; + /** + * A dictionary holding the internal viewZ nodes. + * + * @private + * @type {Object} + */ + private _viewZNodes; + /** + * A dictionary holding the texture data of the previous frame. + * Used for computing velocity/motion vectors. + * + * @private + * @type {Object} + */ + private _previousTextures; + /** + * A dictionary holding the texture nodes of the previous frame. + * Used for computing velocity/motion vectors. + * + * @private + * @type {Object} + */ + private _previousTextureNodes; + /** + * The `near` property of the camera as a uniform. + * + * @private + * @type {UniformNode} + */ + private _cameraNear; + /** + * The `far` property of the camera as a uniform. + * + * @private + * @type {UniformNode} + */ + private _cameraFar; + /** + * A MRT node configuring the MRT settings. + * + * @private + * @type {?MRTNode} + * @default null + */ + private _mrt; + /** + * Layer object for configuring the camera that is used + * to produce the pass. + * + * @private + * @type {?Layers} + * @default null + */ + private _layers; + /** + * Scales the resolution of the internal render target. + * + * @private + * @type {number} + * @default 1 + */ + private _resolutionScale; + /** + * Custom viewport definition. + * + * @private + * @type {?Vector4} + * @default null + */ + private _viewport; + /** + * Custom scissor definition. + * + * @private + * @type {?Vector4} + * @default null + */ + private _scissor; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPassNode: boolean; + /** + * Sets the resolution scale for the pass. + * The resolution scale is a factor that is multiplied with the renderer's width and height. + * + * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. + * @return {PassNode} A reference to this pass. + */ + setResolutionScale(resolutionScale: number): PassNode; + /** + * Gets the current resolution scale of the pass. + * + * @return {number} The current resolution scale. A value of `1` means full resolution. + */ + getResolutionScale(): number; + /** + * Sets the resolution for the pass. + * The resolution is a factor that is multiplied with the renderer's width and height. + * + * @param {number} resolution - The resolution to set. A value of `1` means full resolution. + * @return {PassNode} A reference to this pass. + * @deprecated since r181. Use {@link PassNode#setResolutionScale `setResolutionScale()`} instead. + */ + setResolution(resolution: number): PassNode; + /** + * Gets the current resolution of the pass. + * + * @return {number} The current resolution. A value of `1` means full resolution. + * @deprecated since r181. Use {@link PassNode#getResolutionScale `getResolutionScale()`} instead. + */ + getResolution(): number; + /** + * Sets the layer configuration that should be used when rendering the pass. + * + * @param {Layers} layers - The layers object to set. + * @return {PassNode} A reference to this pass. + */ + setLayers(layers: Layers): PassNode; + /** + * Gets the current layer configuration of the pass. + * + * @return {?Layers} . + */ + getLayers(): Layers | null; + /** + * Sets the given MRT node to setup MRT for this pass. + * + * @param {MRTNode} mrt - The MRT object. + * @return {PassNode} A reference to this pass. + */ + setMRT(mrt: MRTNode): PassNode; + /** + * Returns the current MRT node. + * + * @return {MRTNode} The current MRT node. + */ + getMRT(): MRTNode; + /** + * Returns the texture for the given output name. + * + * @param {string} name - The output name to get the texture for. + * @return {Texture} The texture. + */ + getTexture(name: string): Texture; + /** + * Returns the texture holding the data of the previous frame for the given output name. + * + * @param {string} name - The output name to get the texture for. + * @return {Texture} The texture holding the data of the previous frame. + */ + getPreviousTexture(name: string): Texture; + /** + * Switches current and previous textures for the given output name. + * + * @param {string} name - The output name. + */ + toggleTexture(name: string): void; + /** + * Returns the texture node for the given output name. + * + * @param {string} [name='output'] - The output name to get the texture node for. + * @return {TextureNode} The texture node. + */ + getTextureNode(name?: string): TextureNode; + /** + * Returns the previous texture node for the given output name. + * + * @param {string} [name='output'] - The output name to get the previous texture node for. + * @return {TextureNode} The previous texture node. + */ + getPreviousTextureNode(name?: string): TextureNode; + /** + * Returns a viewZ node of this pass. + * + * @param {string} [name='depth'] - The output name to get the viewZ node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. + * @return {Node} The viewZ node. + */ + getViewZNode(name?: string): Node; + /** + * Returns a linear depth node of this pass. + * + * @param {string} [name='depth'] - The output name to get the linear depth node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. + * @return {Node} The linear depth node. + */ + getLinearDepthNode(name?: string): Node; + /** + * Precompiles the pass. + * + * Note that this method must be called after the pass configuration is complete. + * So calls like `setMRT()` and `getTextureNode()` must proceed the precompilation. + * + * @async + * @param {Renderer} renderer - The renderer. + * @return {Promise} A Promise that resolves when the compile has been finished. + * @see {@link Renderer#compileAsync} + */ + compileAsync(renderer: Renderer): Promise; + setup({ renderer }: { + renderer: any; + }): Node | TextureNode; + updateBefore(frame: any): void; + /** + * Sets the size of the pass's render target. Honors the pixel ratio. + * + * @param {number} width - The width to set. + * @param {number} height - The height to set. + */ + setSize(width: number, height: number): void; + /** + * This method allows to define the pass's scissor rectangle. By default, the scissor rectangle is kept + * in sync with the pass's dimensions. To reverse the process and use auto-sizing again, call the method + * with `null` as the single argument. + * + * @param {?(number | Vector4)} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. + * Instead of passing four arguments, the method also works with a single four-dimensional vector. + * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. + * @param {number} width - The width of the scissor box in logical pixel unit. + * @param {number} height - The height of the scissor box in logical pixel unit. + */ + setScissor(x: (number | Vector4) | null, y: number, width: number, height: number): void; + /** + * This method allows to define the pass's viewport. By default, the viewport is kept in sync + * with the pass's dimensions. To reverse the process and use auto-sizing again, call the method + * with `null` as the single argument. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + */ + setViewport(x: number | Vector4, y: number, width: number, height: number): void; +} +declare namespace PassNode { + let COLOR: "color"; + let DEPTH: "depth"; +} +/** + * Represents the texture of a pass node. + * + * @augments TextureNode + */ +declare class PassTextureNode extends TextureNode { + /** + * Constructs a new pass texture node. + * + * @param {PassNode} passNode - The pass node. + * @param {Texture} texture - The output texture. + */ + constructor(passNode: PassNode, texture: Texture); + /** + * A reference to the pass node. + * + * @type {PassNode} + */ + passNode: PassNode; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @default true + * @readonly + */ + readonly isPassTextureNode: boolean; + setup(builder: any): void; + clone(): any; +} +import TempNode from '../core/TempNode.js'; +import { RenderTarget } from '../../core/RenderTarget.js'; +import { default as TextureNode } from '../accessors/TextureNode.js'; +import { Vector4 } from '../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts new file mode 100644 index 000000000..bcf1b8bef --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts @@ -0,0 +1,28 @@ +/** + * Premultiplies the RGB channels of a color by its alpha channel. + * + * This function is useful for converting a non-premultiplied alpha color + * into a premultiplied alpha format, where the RGB values are scaled + * by the alpha value. Premultiplied alpha is often used in graphics + * rendering for certain operations, such as compositing and image processing. + * + * @tsl + * @function + * @param {Node} color - The input color with non-premultiplied alpha. + * @return {Node} The color with premultiplied alpha. + */ +export const premultiplyAlpha: () => void; +/** + * Unpremultiplies the RGB channels of a color by its alpha channel. + * + * This function is useful for converting a premultiplied alpha color + * back into a non-premultiplied alpha format, where the RGB values are + * divided by the alpha value. Unpremultiplied alpha is often used in graphics + * rendering for certain operations, such as compositing and image processing. + * + * @tsl + * @function + * @param {Node} color - The input color with premultiplied alpha. + * @return {Node} The color with non-premultiplied alpha. + */ +export const unpremultiplyAlpha: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts new file mode 100644 index 000000000..d469787e9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts @@ -0,0 +1,79 @@ +export default RenderOutputNode; +export function renderOutput(color: Node, toneMapping?: number | null, outputColorSpace?: string | null): RenderOutputNode; +/** + * Normally, tone mapping and color conversion happens automatically just + * before outputting a pixel to the default (screen) framebuffer. In certain + * post processing setups this is too late because some effects such as FXAA + * require e.g. sRGB input. For such scenarios, `RenderOutputNode` can be used + * to apply tone mapping and color space conversion at an arbitrary point + * in the effect chain. + * + * When applying tone mapping and color space conversion manually with this node, + * you have to set {@link RenderPipeline#outputColorTransform} to `false`. + * + * ```js + * const postProcessing = new RenderPipeline( renderer ); + * postProcessing.outputColorTransform = false; + * + * const scenePass = pass( scene, camera ); + * const outputPass = renderOutput( scenePass ); + * + * postProcessing.outputNode = outputPass; + * ``` + * + * @augments TempNode + */ +declare class RenderOutputNode extends TempNode { + /** + * Constructs a new render output node. + * + * @param {Node} colorNode - The color node to process. + * @param {?number} toneMapping - The tone mapping type. + * @param {?string} outputColorSpace - The output color space. + */ + constructor(colorNode: Node, toneMapping: number | null, outputColorSpace: string | null); + /** + * The color node to process. + * + * @type {Node} + */ + colorNode: Node; + /** + * The tone mapping type. + * + * @private + * @type {?number} + */ + private _toneMapping; + /** + * The output color space. + * + * @type {?string} + */ + outputColorSpace: string | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderOutputNode: boolean; + /** + * Sets the tone mapping type. + * + * @param {number} value - The tone mapping type. + * @return {ToneMappingNode} A reference to this node. + */ + setToneMapping(value: number): ToneMappingNode; + /** + * Gets the tone mapping type. + * + * @returns {number} The tone mapping type. + */ + getToneMapping(): number; + setup({ context }: { + context: any; + }): Node; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts new file mode 100644 index 000000000..a9226363d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts @@ -0,0 +1,113 @@ +export default ScreenNode; +/** + * TSL object that represents the current DPR. + * + * @tsl + * @type {UniformNode} + */ +export const screenDPR: UniformNode; +/** + * TSL object that represents normalized screen coordinates, unitless in `[0, 1]`. + * + * @tsl + * @type {ScreenNode} + */ +export const screenUV: ScreenNode; +/** + * TSL object that represents the screen resolution in physical pixel units. + * + * @tsl + * @type {ScreenNode} + */ +export const screenSize: ScreenNode; +/** + * TSL object that represents the current `x`/`y` pixel position on the screen in physical pixel units. + * + * @tsl + * @type {ScreenNode} + */ +export const screenCoordinate: ScreenNode; +/** + * TSL object that represents the viewport rectangle as `x`, `y`, `width` and `height` in physical pixel units. + * + * @tsl + * @type {ScreenNode} + */ +export const viewport: ScreenNode; +/** + * TSL object that represents the viewport resolution in physical pixel units. + * + * @tsl + * @type {ScreenNode} + */ +export const viewportSize: ScreenNode; +/** + * TSL object that represents the current `x`/`y` pixel position on the viewport in physical pixel units. + * + * @tsl + * @type {ScreenNode} + */ +export const viewportCoordinate: ScreenNode; +/** + * TSL object that represents normalized viewport coordinates, unitless in `[0, 1]`. + * + * @tsl + * @type {ScreenNode} + */ +export const viewportUV: ScreenNode; +/** + * This node provides a collection of screen related metrics. + * Depending on {@link ScreenNode#scope}, the nodes can represent + * resolution or viewport data as well as fragment or uv coordinates. + * + * @augments Node + */ +declare class ScreenNode extends Node { + /** + * Constructs a new screen node. + * + * @param {('coordinate'|'viewport'|'size'|'uv')} scope - The node's scope. + */ + constructor(scope: ("coordinate" | "viewport" | "size" | "uv")); + /** + * The node represents different metric depending on which scope is selected. + * + * - `ScreenNode.COORDINATE`: Window-relative coordinates of the current fragment according to WebGPU standards. + * - `ScreenNode.VIEWPORT`: The current viewport defined as a four-dimensional vector. + * - `ScreenNode.SIZE`: The dimensions of the current bound framebuffer. + * - `ScreenNode.UV`: Normalized coordinates. + * + * @type {('coordinate'|'viewport'|'size'|'uv')} + */ + scope: ("coordinate" | "viewport" | "size" | "uv"); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isViewportNode: boolean; + /** + * This method is overwritten since the node type depends on the selected scope. + * + * @return {('vec2'|'vec4')} The node type. + */ + generateNodeType(): ("vec2" | "vec4"); + /** + * `ScreenNode` implements {@link Node#update} to retrieve viewport and size information + * from the current renderer. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update({ renderer }: NodeFrame): void; + setup(): any; + generate(builder: any): any; +} +declare namespace ScreenNode { + let COORDINATE: string; + let VIEWPORT: string; + let SIZE: string; + let UV: string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts new file mode 100644 index 000000000..2d04148f4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts @@ -0,0 +1,68 @@ +/** + * Linear tone mapping, exposure only. + * + * @tsl + * @function + * @param {Node} color - The color that should be tone mapped. + * @param {Node} exposure - The exposure. + * @return {Node} The tone mapped color. + */ +export const linearToneMapping: any; +/** + * Reinhard tone mapping. + * + * Reference: {@link https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf} + * + * @tsl + * @function + * @param {Node} color - The color that should be tone mapped. + * @param {Node} exposure - The exposure. + * @return {Node} The tone mapped color. + */ +export const reinhardToneMapping: any; +/** + * Cineon tone mapping. + * + * Reference: {@link http://filmicworlds.com/blog/filmic-tonemapping-operators/} + * + * @tsl + * @function + * @param {Node} color - The color that should be tone mapped. + * @param {Node} exposure - The exposure. + * @return {Node} The tone mapped color. + */ +export const cineonToneMapping: any; +/** + * ACESFilmic tone mapping. + * + * Reference: {@link https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs} + * + * @tsl + * @function + * @param {Node} color - The color that should be tone mapped. + * @param {Node} exposure - The exposure. + * @return {Node} The tone mapped color. + */ +export const acesFilmicToneMapping: any; +/** + * AgX tone mapping. + * + * @tsl + * @function + * @param {Node} color - The color that should be tone mapped. + * @param {Node} exposure - The exposure. + * @return {Node} The tone mapped color. + */ +export const agxToneMapping: any; +/** + * Neutral tone mapping. + * + * Reference: {@link https://modelviewer.dev/examples/tone-mapping} + * + * @tsl + * @function + * @param {Node} color - The color that should be tone mapped. + * @param {Node} exposure - The exposure. + * @return {Node} The tone mapped color. + */ +export const neutralToneMapping: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts new file mode 100644 index 000000000..7e8ca1871 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts @@ -0,0 +1,60 @@ +export default ToneMappingNode; +export function toneMapping(mapping: number, exposure: Node | number, color: Node | Color): ToneMappingNode; +/** + * TSL object that represents the global tone mapping exposure of the renderer. + * + * @tsl + * @type {RendererReferenceNode} + */ +export const toneMappingExposure: RendererReferenceNode; +/** + * This node represents a tone mapping operation. + * + * @augments TempNode + */ +declare class ToneMappingNode extends TempNode { + /** + * Constructs a new tone mapping node. + * + * @param {number} toneMapping - The tone mapping type. + * @param {Node} exposureNode - The tone mapping exposure. + * @param {Node} [colorNode=null] - The color node to process. + */ + constructor(toneMapping: number, exposureNode?: Node, colorNode?: Node); + /** + * The tone mapping type. + * + * @private + * @type {number} + */ + private _toneMapping; + /** + * The tone mapping exposure. + * + * @type {Node} + * @default null + */ + exposureNode: Node; + /** + * Represents the color to process. + * + * @type {?Node} + * @default null + */ + colorNode: Node | null; + /** + * Sets the tone mapping type. + * + * @param {number} value - The tone mapping type. + * @return {ToneMappingNode} A reference to this node. + */ + setToneMapping(value: number): ToneMappingNode; + /** + * Gets the tone mapping type. + * + * @returns {number} The tone mapping type. + */ + getToneMapping(): number; + setup(builder: any): any; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts new file mode 100644 index 000000000..cb934f4cb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts @@ -0,0 +1,71 @@ +export default ToonOutlinePassNode; +export function toonOutlinePass(scene: Scene, camera: Camera, color?: Color, thickness?: number, alpha?: number): ToonOutlinePassNode; +/** + * Represents a render pass for producing a toon outline effect on compatible objects. + * Only 3D objects with materials of type `MeshToonMaterial` and `MeshToonNodeMaterial` + * will receive the outline. + * + * ```js + * const postProcessing = new RenderPipeline( renderer ); + * + * const scenePass = toonOutlinePass( scene, camera ); + * + * postProcessing.outputNode = scenePass; + * ``` + * @augments PassNode + */ +declare class ToonOutlinePassNode extends PassNode { + /** + * Constructs a new outline pass node. + * + * @param {Scene} scene - A reference to the scene. + * @param {Camera} camera - A reference to the camera. + * @param {Node} colorNode - Defines the outline's color. + * @param {Node} thicknessNode - Defines the outline's thickness. + * @param {Node} alphaNode - Defines the outline's alpha. + */ + constructor(scene: Scene, camera: Camera, colorNode: Node, thicknessNode: Node, alphaNode: Node); + /** + * Defines the outline's color. + * + * @type {Node} + */ + colorNode: Node; + /** + * Defines the outline's thickness. + * + * @type {Node} + */ + thicknessNode: Node; + /** + * Defines the outline's alpha. + * + * @type {Node} + */ + alphaNode: Node; + /** + * An internal material cache. + * + * @private + * @type {WeakMap} + */ + private _materialCache; + /** + * Creates the material used for outline rendering. + * + * @private + * @return {NodeMaterial} The outline material. + */ + private _createMaterial; + /** + * For the given toon material, this method returns a corresponding + * outline material. + * + * @private + * @param {(MeshToonMaterial|MeshToonNodeMaterial)} originalMaterial - The toon material. + * @return {NodeMaterial} The outline material. + */ + private _getOutlineMaterial; +} +import { Color } from '../../math/Color.js'; +import PassNode from './PassNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts new file mode 100644 index 000000000..6b0693f40 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts @@ -0,0 +1,105 @@ +export default ViewportDepthNode; +export function viewZToOrthographicDepth(viewZ: Node, near: Node, far: Node): Node; +export function viewZToReversedOrthographicDepth(viewZ: Node, near: Node, far: Node): Node; +/** + * TSL function for converting an orthographic depth value to a viewZ value. + * + * @tsl + * @function + * @param {Node} depth - The orthographic depth. + * @param {Node} near - The camera's near value. + * @param {Node} far - The camera's far value. + * @returns {Node} + */ +export const orthographicDepthToViewZ: () => void; +export function viewZToPerspectiveDepth(viewZ: Node, near: Node, far: Node): Node; +export function viewZToReversedPerspectiveDepth(viewZ: Node, near: Node, far: Node): Node; +/** + * TSL function for converting a perspective depth value to a viewZ value. + * + * @tsl + * @function + * @param {Node} depth - The perspective depth. + * @param {Node} near - The camera's near value. + * @param {Node} far - The camera's far value. + * @returns {Node} + */ +export const perspectiveDepthToViewZ: () => void; +export function viewZToLogarithmicDepth(viewZ: Node, near: Node, far: Node): Node; +export function logarithmicDepthToViewZ(depth: Node, near: Node, far: Node): Node; +/** + * TSL object that represents the depth value for the current fragment. + * + * @tsl + * @type {ViewportDepthNode} + */ +export const depth: ViewportDepthNode; +/** + * TSL function for converting a perspective depth value to linear depth. + * + * @tsl + * @function + * @param {?Node} [value=null] - The perspective depth. If `null` is provided, the current fragment's depth is used. + * @returns {ViewportDepthNode} + */ +export const linearDepth: any; +/** + * TSL object that represents the linear (orthographic) depth value of the current fragment + * + * @tsl + * @type {ViewportDepthNode} + */ +export const viewportLinearDepth: ViewportDepthNode; +/** + * This node offers a collection of features in context of the depth logic in the fragment shader. + * Depending on {@link ViewportDepthNode#scope}, it can be used to define a depth value for the current + * fragment or for depth evaluation purposes. + * + * @augments Node + */ +declare class ViewportDepthNode extends Node { + /** + * Constructs a new viewport depth node. + * + * @param {('depth'|'depthBase'|'linearDepth')} scope - The node's scope. + * @param {?Node} [valueNode=null] - The value node. + */ + constructor(scope: ("depth" | "depthBase" | "linearDepth"), valueNode?: Node | null); + /** + * The node behaves differently depending on which scope is selected. + * + * - `ViewportDepthNode.DEPTH_BASE`: Allows to define a value for the current fragment's depth. + * - `ViewportDepthNode.DEPTH`: Represents the depth value for the current fragment (`valueNode` is ignored). + * - `ViewportDepthNode.LINEAR_DEPTH`: Represents the linear (orthographic) depth value of the current fragment. + * If a `valueNode` is set, the scope can be used to convert perspective depth data to linear data. + * + * @type {('depth'|'depthBase'|'linearDepth')} + */ + scope: ("depth" | "depthBase" | "linearDepth"); + /** + * Can be used to define a custom depth value. + * The property is ignored in the `ViewportDepthNode.DEPTH` scope. + * + * @type {?Node} + * @default null + */ + valueNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isViewportDepthNode: boolean; + generate(builder: any): any; + setup({ camera }: { + camera: any; + }): any; +} +declare namespace ViewportDepthNode { + let DEPTH_BASE: string; + let DEPTH: string; + let LINEAR_DEPTH: string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts new file mode 100644 index 000000000..c70252a7e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts @@ -0,0 +1,31 @@ +export default ViewportDepthTextureNode; +/** + * TSL function for a viewport depth texture node. + * + * @tsl + * @function + * @param {?Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, a depth texture is created automatically. + * @returns {ViewportDepthTextureNode} + */ +export const viewportDepthTexture: any; +/** + * Represents the depth of the current viewport as a texture. This module + * can be used in combination with viewport texture to achieve effects + * that require depth evaluation. + * + * @augments ViewportTextureNode + */ +declare class ViewportDepthTextureNode extends ViewportTextureNode { + /** + * Constructs a new viewport depth texture node. + * + * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, uses a shared depth texture. + */ + constructor(uvNode?: Node, levelNode?: Node | null, depthTexture?: DepthTexture | null); +} +import ViewportTextureNode from './ViewportTextureNode.js'; +import { DepthTexture } from '../../textures/DepthTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts new file mode 100644 index 000000000..46859c337 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts @@ -0,0 +1,37 @@ +export default ViewportSharedTextureNode; +/** + * TSL function for creating a shared viewport texture node. + * + * @tsl + * @function + * @param {?Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @returns {ViewportSharedTextureNode} + */ +export const viewportSharedTexture: any; +/** + * `ViewportTextureNode` creates an internal texture for each node instance. This module + * shares a texture across all instances of `ViewportSharedTextureNode`. It should + * be the first choice when using data of the default/screen framebuffer for performance reasons. + * + * @augments ViewportTextureNode + */ +declare class ViewportSharedTextureNode extends ViewportTextureNode { + /** + * Constructs a new viewport shared texture node. + * + * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + */ + constructor(uvNode?: Node, levelNode?: Node | null); + /** + * Overwritten so the method always returns the unique shared + * framebuffer texture. + * + * @return {FramebufferTexture} The shared framebuffer texture. + */ + getTextureForReference(): FramebufferTexture; + updateReference(): this; +} +import ViewportTextureNode from './ViewportTextureNode.js'; +import { FramebufferTexture } from '../../textures/FramebufferTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts new file mode 100644 index 000000000..e679f9d6a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts @@ -0,0 +1,89 @@ +export default ViewportTextureNode; +/** + * TSL function for creating a viewport texture node. + * + * @tsl + * @function + * @param {?Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. + * @returns {ViewportTextureNode} + */ +export const viewportTexture: any; +/** + * TSL function for creating a viewport texture node with enabled mipmap generation. + * + * @tsl + * @function + * @param {?Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. + * @returns {ViewportTextureNode} + */ +export const viewportMipTexture: any; +export function viewportOpaqueMipTexture(uv?: Node | null, level?: Node | null): ViewportTextureNode; +/** + * A special type of texture node which represents the data of the current viewport + * as a texture. The module extracts data from the current bound framebuffer with + * a copy operation so no extra render pass is required to produce the texture data + * (which is good for performance). `ViewportTextureNode` can be used as an input for a + * variety of effects like refractive or transmissive materials. + * + * @augments TextureNode + */ +declare class ViewportTextureNode extends TextureNode { + /** + * Constructs a new viewport texture node. + * + * @param {Node} [uvNode=screenUV] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. + */ + constructor(uvNode?: Node, levelNode?: Node | null, framebufferTexture?: Texture | null); + /** + * Whether to generate mipmaps or not. + * + * @type {boolean} + * @default false + */ + generateMipmaps: boolean; + /** + * The reference framebuffer texture. This is used to store the framebuffer texture + * for the current render target. If the render target changes, a new framebuffer texture + * is created automatically. + * + * @type {FramebufferTexture} + * @default null + */ + defaultFramebuffer: FramebufferTexture; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOutputTextureNode: boolean; + /** + * The framebuffer texture for the current renderer context. + * + * @type {WeakMap} + * @private + */ + private _cacheTextures; + /** + * This methods returns a texture for the given render target or canvas target reference. + * + * To avoid rendering errors, `ViewportTextureNode` must use unique framebuffer textures + * for different render contexts. + * + * @param {?(RenderTarget|CanvasTarget)} [reference=null] - The render target or canvas target reference. + * @return {Texture} The framebuffer texture. + */ + getTextureForReference(reference?: (RenderTarget | CanvasTarget) | null): Texture; + updateReference(frame: any): import("../../Three.Core.js").Texture; + updateBefore(frame: any): void; + clone(): any; +} +import TextureNode from '../accessors/TextureNode.js'; +import { FramebufferTexture } from '../../textures/FramebufferTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts b/jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts new file mode 100644 index 000000000..34f7636b6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts @@ -0,0 +1,38 @@ +/** + * Constructs a new range factor node. + * + * @tsl + * @function + * @param {Node} near - Defines the near value. + * @param {Node} far - Defines the far value. + */ +export const rangeFogFactor: () => void; +/** + * Represents an exponential squared fog. This type of fog gives + * a clear view near the camera and a faster than exponentially + * densening fog farther from the camera. + * + * @tsl + * @function + * @param {Node} density - Defines the fog density. + */ +export const densityFogFactor: () => void; +/** + * Constructs a new height fog factor node. This fog factor requires a Y-up coordinate system. + * + * @tsl + * @function + * @param {Node} density - Defines the fog density. + * @param {Node} height - The height threshold in world space. Everything below this y-coordinate is affected by fog. + */ +export const exponentialHeightFogFactor: () => void; +/** + * This class can be used to configure a fog for the scene. + * Nodes of this type are assigned to `Scene.fogNode`. + * + * @tsl + * @function + * @param {Node} color - Defines the color of the fog. + * @param {Node} factor - Defines how the fog is factored in the scene. + */ +export const fog: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts new file mode 100644 index 000000000..c47f5559a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts @@ -0,0 +1,2 @@ +export default BRDF_GGX; +declare const BRDF_GGX: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts new file mode 100644 index 000000000..71b76485d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts @@ -0,0 +1,2 @@ +export default BRDF_Lambert; +declare const BRDF_Lambert: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts new file mode 100644 index 000000000..eb31b60ad --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts @@ -0,0 +1,2 @@ +export default BRDF_Sheen; +declare const BRDF_Sheen: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts new file mode 100644 index 000000000..5a20667ef --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts @@ -0,0 +1,2 @@ +export default DFGLUT; +declare const DFGLUT: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts new file mode 100644 index 000000000..ee1081261 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts @@ -0,0 +1,2 @@ +export default D_GGX; +declare const D_GGX: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts new file mode 100644 index 000000000..788dd6c3b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts @@ -0,0 +1,2 @@ +export default D_GGX_Anisotropic; +declare const D_GGX_Anisotropic: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts new file mode 100644 index 000000000..ebc316a79 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts @@ -0,0 +1,2 @@ +export default EnvironmentBRDF; +declare const EnvironmentBRDF: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts new file mode 100644 index 000000000..a1d2caea7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts @@ -0,0 +1,2 @@ +export default F_Schlick; +declare const F_Schlick: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts new file mode 100644 index 000000000..3f41af9a6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts @@ -0,0 +1,3 @@ +export const LTC_Evaluate: any; +export const LTC_Evaluate_Volume: any; +export const LTC_Uv: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts new file mode 100644 index 000000000..316542c93 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts @@ -0,0 +1,2 @@ +export default Schlick_to_F0; +declare const Schlick_to_F0: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts new file mode 100644 index 000000000..aeaeb6109 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts @@ -0,0 +1,2 @@ +export default V_GGX_SmithCorrelated; +declare const V_GGX_SmithCorrelated: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts new file mode 100644 index 000000000..7c2c87243 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts @@ -0,0 +1,2 @@ +export default V_GGX_SmithCorrelated_Anisotropic; +declare const V_GGX_SmithCorrelated_Anisotropic: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts new file mode 100644 index 000000000..3db9024d7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts @@ -0,0 +1,23 @@ +export default BasicLightingModel; +/** + * Represents the lighting model for unlit materials. The only light contribution + * is baked indirect lighting modulated with ambient occlusion and the material's + * diffuse color. Environment mapping is supported. Used in {@link MeshBasicNodeMaterial}. + * + * @augments LightingModel + */ +declare class BasicLightingModel extends LightingModel { + /** + * Implements the baked indirect lighting with its modulation. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirect({ context }: NodeBuilder): void; + /** + * Implements the environment mapping. + * + * @param {NodeBuilder} builder - The current node builder. + */ + finish(builder: NodeBuilder): void; +} +import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts new file mode 100644 index 000000000..8e2c536a1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts @@ -0,0 +1,31 @@ +export default PhongLightingModel; +/** + * Represents the lighting model for a phong material. Used in {@link MeshPhongNodeMaterial}. + * + * @augments BasicLightingModel + */ +declare class PhongLightingModel extends BasicLightingModel { + /** + * Constructs a new phong lighting model. + * + * @param {boolean} [specular=true] - Whether specular is supported or not. + */ + constructor(specular?: boolean); + /** + * Whether specular is supported or not. Set this to `false` if you are + * looking for a Lambert-like material meaning a material for non-shiny + * surfaces, without specular highlights. + * + * @type {boolean} + * @default true + */ + specular: boolean; + /** + * Implements the direct lighting. The specular portion is optional and can be controlled + * with the {@link PhongLightingModel#specular} flag. + * + * @param {Object} lightData - The light data. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object): void; +} +import BasicLightingModel from './BasicLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts new file mode 100644 index 000000000..2b22eba0d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts @@ -0,0 +1,186 @@ +export default PhysicalLightingModel; +/** + * Represents the lighting model for a PBR material. + * + * @augments LightingModel + */ +declare class PhysicalLightingModel extends LightingModel { + /** + * Constructs a new physical lighting model. + * + * @param {boolean} [clearcoat=false] - Whether clearcoat is supported or not. + * @param {boolean} [sheen=false] - Whether sheen is supported or not. + * @param {boolean} [iridescence=false] - Whether iridescence is supported or not. + * @param {boolean} [anisotropy=false] - Whether anisotropy is supported or not. + * @param {boolean} [transmission=false] - Whether transmission is supported or not. + * @param {boolean} [dispersion=false] - Whether dispersion is supported or not. + * @param {boolean} [retroreflection=false] - Whether retroreflection is supported or not. + */ + constructor(clearcoat?: boolean, sheen?: boolean, iridescence?: boolean, anisotropy?: boolean, transmission?: boolean, dispersion?: boolean, retroreflection?: boolean); + /** + * Whether clearcoat is supported or not. + * + * @type {boolean} + * @default false + */ + clearcoat: boolean; + /** + * Whether sheen is supported or not. + * + * @type {boolean} + * @default false + */ + sheen: boolean; + /** + * Whether iridescence is supported or not. + * + * @type {boolean} + * @default false + */ + iridescence: boolean; + /** + * Whether anisotropy is supported or not. + * + * @type {boolean} + * @default false + */ + anisotropy: boolean; + /** + * Whether transmission is supported or not. + * + * @type {boolean} + * @default false + */ + transmission: boolean; + /** + * Whether dispersion is supported or not. + * + * @type {boolean} + * @default false + */ + dispersion: boolean; + /** + * Whether retroreflection is supported or not. + * + * @type {boolean} + * @default false + */ + retroreflection: boolean; + /** + * The clear coat radiance. + * + * @type {?Node} + * @default null + */ + clearcoatRadiance: Node | null; + /** + * The clear coat specular direct. + * + * @type {?Node} + * @default null + */ + clearcoatSpecularDirect: Node | null; + /** + * The clear coat specular indirect. + * + * @type {?Node} + * @default null + */ + clearcoatSpecularIndirect: Node | null; + /** + * The sheen specular direct. + * + * @type {?Node} + * @default null + */ + sheenSpecularDirect: Node | null; + /** + * The sheen specular indirect. + * + * @type {?Node} + * @default null + */ + sheenSpecularIndirect: Node | null; + /** + * The iridescence Fresnel. + * + * @type {?Node} + * @default null + */ + iridescenceFresnel: Node | null; + /** + * The iridescence F0 dielectric. + * + * @type {?Node} + * @default null + */ + iridescenceF0Dielectric: Node | null; + /** + * The iridescence F0 metallic. + * + * @type {?Node} + * @default null + */ + iridescenceF0Metallic: Node | null; + /** + * The sampled DFG LUT value, shared by the direct and indirect lighting paths. + * + * @type {?Node} + * @default null + */ + dfg: Node | null; + /** + * The multi-scattering energy compensation for direct lighting. + * + * @type {?Node} + * @default null + */ + multiScatteringCompensation: Node | null; + computeMultiscattering(singleScatter: any, multiScatter: any, specularF90: any, f0: any, iridescenceF0?: null): void; + /** + * Implements the direct light. + * + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object): void; + /** + * This method is intended for implementing the direct light term for + * rect area light nodes. + * + * @param {Object} input - The input data. + * @param {NodeBuilder} builder - The current node builder. + */ + directRectArea({ lightColor, lightPosition, halfWidth, halfHeight, reflectedLight, ltc_1, ltc_2 }: Object): void; + /** + * Implements the indirect lighting. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirect(builder: NodeBuilder): void; + /** + * Implements the indirect diffuse term. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirectDiffuse(builder: NodeBuilder): void; + /** + * Implements the indirect specular term. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirectSpecular(builder: NodeBuilder): void; + /** + * Implements the ambient occlusion term. + * + * @param {NodeBuilder} builder - The current node builder. + */ + ambientOcclusion(builder: NodeBuilder): void; + /** + * Used for final lighting accumulations depending on the requested features. + * + * @param {NodeBuilder} builder - The current node builder. + */ + finish({ context }: NodeBuilder): void; +} +import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts new file mode 100644 index 000000000..84e3d6ecf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts @@ -0,0 +1,27 @@ +export default ShadowMaskModel; +/** + * Represents lighting model for a shadow material. Used in {@link ShadowNodeMaterial}. + * + * @augments LightingModel + */ +declare class ShadowMaskModel extends LightingModel { + /** + * The shadow mask node. + * + * @type {Node} + */ + shadowNode: Node; + /** + * Only used to save the shadow mask. + * + * @param {Object} input - The input data. + */ + direct({ lightNode }: Object): void; + /** + * Uses the shadow mask to produce the final color. + * + * @param {NodeBuilder} builder - The current node builder. + */ + finish({ context }: NodeBuilder): void; +} +import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts new file mode 100644 index 000000000..420e9ee87 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts @@ -0,0 +1,23 @@ +export default ToonLightingModel; +/** + * Represents the lighting model for a toon material. Used in {@link MeshToonNodeMaterial}. + * + * @augments LightingModel + */ +declare class ToonLightingModel extends LightingModel { + /** + * Implements the direct lighting. Instead of using a conventional smooth irradiance, the irradiance is + * reduced to a small number of discrete shades to create a comic-like, flat look. + * + * @param {Object} lightData - The light data. + * @param {NodeBuilder} builder - The current node builder. + */ + direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; + /** + * Implements the indirect lighting. + * + * @param {NodeBuilder} builder - The current node builder. + */ + indirect(builder: NodeBuilder): void; +} +import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts new file mode 100644 index 000000000..1cf33cba5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts @@ -0,0 +1,25 @@ +export default VolumetricLightingModel; +/** + * VolumetricLightingModel class extends the LightingModel to implement volumetric lighting effects. + * This model calculates the scattering and transmittance of light through a volumetric medium. + * It dynamically adjusts the direction of the ray based on the camera and object positions. + * The model supports custom scattering and depth nodes to enhance the lighting effects. + * + * @augments LightingModel + */ +declare class VolumetricLightingModel extends LightingModel { + start(builder: any): void; + scatteringLight(lightColor: any, builder: any): void; + direct({ lightNode, lightColor }: { + lightNode: any; + lightColor: any; + }, builder: any): void; + directRectArea({ lightColor, lightPosition, halfWidth, halfHeight }: { + lightColor: any; + lightPosition: any; + halfWidth: any; + halfHeight: any; + }, builder: any): void; + finish(builder: any): void; +} +import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts new file mode 100644 index 000000000..30b15c98e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts @@ -0,0 +1,2 @@ +export default getAlphaHashThreshold; +declare const getAlphaHashThreshold: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts new file mode 100644 index 000000000..30ea57be5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts @@ -0,0 +1,2 @@ +export default getGeometryRoughness; +declare const getGeometryRoughness: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts new file mode 100644 index 000000000..4c4a103a4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts @@ -0,0 +1,19 @@ +export default getParallaxCorrectNormal; +/** + * This computes a parallax corrected normal which is used for box-projected cube mapping (BPCEM). + * + * Reference: {@link https://devlog-martinsh.blogspot.com/2011/09/box-projected-cube-environment-mapping.html} + * + * ```js + * const uvNode = getParallaxCorrectNormal( reflectVector, vec3( 200, 100, 100 ), vec3( 0, - 50, 0 ) ); + * material.envNode = pmremTexture( renderTarget.texture, uvNode ); + * ``` + * + * @tsl + * @function + * @param {Node} normal - The normal to correct. + * @param {Node} cubeSize - The cube size should reflect the size of the environment (BPCEM is usually applied in closed environments like rooms). + * @param {Node} cubePos - The cube position. + * @return {Node} The parallax corrected normal. + */ +declare const getParallaxCorrectNormal: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts new file mode 100644 index 000000000..18eff5982 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts @@ -0,0 +1,2 @@ +export default getRoughness; +declare const getRoughness: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts new file mode 100644 index 000000000..627b15982 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts @@ -0,0 +1,2 @@ +export default getShIrradianceAt; +declare const getShIrradianceAt: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts new file mode 100644 index 000000000..3630a9978 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts @@ -0,0 +1,68 @@ +export default RangeNode; +/** + * TSL function for creating a range node. + * + * @tsl + * @function + * @param {Node} [minNode=float()] - A node defining the lower bound of the range. + * @param {Node} [maxNode=float()] - A node defining the upper bound of the range. + * @returns {RangeNode} + */ +export const range: any; +/** + * `RangeNode` generates random instanced attribute data in a defined range. + * An exemplary use case for this utility node is to generate random per-instance + * colors: + * ```js + * const material = new MeshBasicNodeMaterial(); + * material.colorNode = range( new Color( 0x000000 ), new Color( 0xFFFFFF ) ); + * const mesh = new InstancedMesh( geometry, material, count ); + * ``` + * @augments Node + */ +declare class RangeNode extends Node { + /** + * Constructs a new range node. + * + * @param {Node} [minNode=float()] - A node defining the lower bound of the range. + * @param {Node} [maxNode=float()] - A node defining the upper bound of the range. + */ + constructor(minNode?: Node, maxNode?: Node); + /** + * A node defining the lower bound of the range. + * + * @type {Node} + * @default float() + */ + minNode: Node; + /** + * A node defining the upper bound of the range. + * + * @type {Node} + * @default float() + */ + maxNode: Node; + /** + * Returns the vector length which is computed based on the range definition. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {number} The vector length. + */ + getVectorLength(builder: NodeBuilder): number; + /** + * This method is overwritten since the node type is inferred from range definition. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns a constant node from the given node by traversing it. + * + * @param {Node} node - The node to traverse. + * @returns {Node} The constant node, if found. + */ + getConstNode(node: Node): Node; + setup(builder: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts new file mode 100644 index 000000000..956f26c33 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts @@ -0,0 +1,78 @@ +export default AtomicFunctionNode; +export function atomicFunc(method: string, pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicLoad(pointerNode: Node): AtomicFunctionNode; +export function atomicStore(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicAdd(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicSub(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicMax(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicMin(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicAnd(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicOr(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +export function atomicXor(pointerNode: Node, valueNode: Node): AtomicFunctionNode; +/** + * `AtomicFunctionNode` represents any function that can operate on atomic variable types + * within a shader. In an atomic function, any modification to an atomic variable will + * occur as an indivisible step with a defined order relative to other modifications. + * Accordingly, even if multiple atomic functions are modifying an atomic variable at once + * atomic operations will not interfere with each other. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +declare class AtomicFunctionNode extends Node { + /** + * Constructs a new atomic function node. + * + * @param {string} method - The signature of the atomic function to construct. + * @param {Node} pointerNode - An atomic variable or element of an atomic buffer. + * @param {Node} valueNode - The value that mutates the atomic variable. + */ + constructor(method: string, pointerNode: Node, valueNode: Node); + /** + * The signature of the atomic function to construct. + * + * @type {string} + */ + method: string; + /** + * An atomic variable or element of an atomic buffer. + * + * @type {Node} + */ + pointerNode: Node; + /** + * A value that modifies the atomic variable. + * + * @type {Node} + */ + valueNode: Node; + /** + * Overwrites the default implementation to return the type of + * the pointer node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(builder: NodeBuilder): string; + /** + * Overwritten since the node type is inferred from the input type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any): any; +} +declare namespace AtomicFunctionNode { + let ATOMIC_LOAD: string; + let ATOMIC_STORE: string; + let ATOMIC_ADD: string; + let ATOMIC_SUB: string; + let ATOMIC_MAX: string; + let ATOMIC_MIN: string; + let ATOMIC_AND: string; + let ATOMIC_OR: string; + let ATOMIC_XOR: string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts new file mode 100644 index 000000000..6879cc29f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts @@ -0,0 +1,24 @@ +export default BarrierNode; +export function workgroupBarrier(): BarrierNode; +export function storageBarrier(): BarrierNode; +export function textureBarrier(): BarrierNode; +/** + * Represents a GPU control barrier that synchronizes compute operations within a given scope. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +declare class BarrierNode extends Node { + /** + * Constructs a new barrier node. + * + * @param {string} scope - The scope defines the behavior of the node. + */ + constructor(scope: string); + scope: string; + isBarrierNode: boolean; + setup(builder: any): void; + generate(builder: any): void; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts new file mode 100644 index 000000000..d5dbfe59e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts @@ -0,0 +1,135 @@ +export default ComputeBuiltinNode; +/** + * Represents the number of workgroups dispatched by the compute shader. + * ```js + * // Run 512 invocations/threads with a workgroup size of 128. + * const computeFn = Fn(() => { + * + * // numWorkgroups.x = 4 + * storageBuffer.element(0).assign(numWorkgroups.x) + * + * })().compute(512, [128]); + * + * // Run 512 invocations/threads with the default workgroup size of 64. + * const computeFn = Fn(() => { + * + * // numWorkgroups.x = 8 + * storageBuffer.element(0).assign(numWorkgroups.x) + * + * })().compute(512); + * ``` + * + * @tsl + * @type {ComputeBuiltinNode} + */ +export const numWorkgroups: ComputeBuiltinNode; +/** + * Represents the 3-dimensional index of the workgroup the current compute invocation belongs to. + * ```js + * // Execute 12 compute threads with a workgroup size of 3. + * const computeFn = Fn( () => { + * + * If( workgroupId.x.mod( 2 ).equal( 0 ), () => { + * + * storageBuffer.element( instanceIndex ).assign( instanceIndex ); + * + * } ).Else( () => { + * + * storageBuffer.element( instanceIndex ).assign( 0 ); + * + * } ); + * + * } )().compute( 12, [ 3 ] ); + * + * // workgroupId.x = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3]; + * // Buffer Output = [0, 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0]; + * ``` + * + * @tsl + * @type {ComputeBuiltinNode} + */ +export const workgroupId: ComputeBuiltinNode; +/** + * A non-linearized 3-dimensional representation of the current invocation's position within a 3D global grid. + * + * @tsl + * @type {ComputeBuiltinNode} + */ +export const globalId: ComputeBuiltinNode; +/** + * A non-linearized 3-dimensional representation of the current invocation's position within a 3D workgroup grid. + * + * @tsl + * @type {ComputeBuiltinNode} + */ +export const localId: ComputeBuiltinNode; +/** + * A device dependent variable that exposes the size of the current invocation's subgroup. + * + * @tsl + * @type {ComputeBuiltinNode} + */ +export const subgroupSize: ComputeBuiltinNode; +/** + * `ComputeBuiltinNode` represents a compute-scope builtin value that expose information + * about the currently running dispatch and/or the device it is running on. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +declare class ComputeBuiltinNode extends Node { + /** + * Constructs a new compute builtin node. + * + * @param {string} builtinName - The built-in name. + * @param {string} nodeType - The node type. + */ + constructor(builtinName: string, nodeType: string); + /** + * The built-in name. + * + * @private + * @type {string} + */ + private _builtinName; + /** + * This method is overwritten since hash is derived from the built-in name. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The hash. + */ + getHash(builder: NodeBuilder): string; + /** + * This method is overwritten since the node type is simply derived from `nodeType`.. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(): string; + /** + * Sets the builtin name. + * + * @param {string} builtinName - The built-in name. + * @return {ComputeBuiltinNode} A reference to this node. + */ + setBuiltinName(builtinName: string): ComputeBuiltinNode; + /** + * Returns the builtin name. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The builtin name. + */ + getBuiltinName(): string; + /** + * Whether the current node builder has the builtin or not. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {boolean} Whether the builder has the builtin or not. + */ + hasBuiltin(builder: NodeBuilder): boolean; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts new file mode 100644 index 000000000..66213c478 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts @@ -0,0 +1,96 @@ +export default ComputeNode; +export function computeKernel(node: Node, workgroupSize?: Array): ComputeNode; +export function compute(node: Node, count: number | Array, workgroupSize?: Array): ComputeNode; +/** + * Represents a compute shader node. + * + * @augments Node + */ +declare class ComputeNode extends Node { + /** + * Constructs a new compute node. + * + * @param {Node} computeNode - The node that defines the compute shader logic. + * @param {Array} workgroupSize - An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. + */ + constructor(computeNode: Node, workgroupSize: Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isComputeNode: boolean; + /** + * The node that defines the compute shader logic. + * + * @type {Node} + */ + computeNode: Node; + /** + * An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. + * + * @type {Array} + * @default [ 64 ] + */ + workgroupSize: Array; + /** + * The total number of threads (invocations) to execute. If it is a number, it will be used + * to automatically generate bounds checking against `instanceIndex`. + * + * @type {number|Array} + */ + count: number | Array; + /** + * The dispatch size for workgroups on X, Y, and Z axes. + * Used directly if `count` is not provided. + * + * @type {number|Array} + */ + dispatchSize: number | Array; + /** + * A callback executed when the compute node finishes initialization. + * + * @type {?Function} + */ + onInitFunction: Function | null; + /** + * A uniform node holding the dispatch count for bounds checking. + * Created automatically when `count` is a number. + * + * @type {?UniformNode} + */ + countNode: UniformNode | null; + /** + * Sets the {@link ComputeNode#name} property. + * + * @param {string} name - The name of the uniform. + * @return {ComputeNode} A reference to this node. + */ + setName(name: string): ComputeNode; + /** + * Sets the {@link ComputeNode#name} property. + * + * @deprecated + * @param {string} name - The name of the uniform. + * @return {ComputeNode} A reference to this node. + */ + label(name: string): ComputeNode; + /** + * Sets the callback to run during initialization. + * + * @param {Function} callback - The callback function. + * @return {ComputeNode} A reference to this node. + */ + onInit(callback: Function): ComputeNode; + /** + * The method execute the compute for this node. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateBefore({ renderer }: NodeFrame): void; + setup(builder: any): string | Node | null; + generate(builder: any, output: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts new file mode 100644 index 000000000..19c603f9b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts @@ -0,0 +1,303 @@ +export default SubgroupFunctionNode; +/** + * Returns true if this invocation has the lowest subgroup_invocation_id + * among active invocations in the subgroup. + * + * @tsl + * @method + * @return {bool} The result of the computation. + */ +export const subgroupElect: any; +/** + * Returns a set of bitfields where the bit corresponding to subgroup_invocation_id + * is 1 if pred is true for that active invocation and 0 otherwise. + * + * @tsl + * @method + * @param {bool} pred - A boolean that sets the bit corresponding to the invocations subgroup invocation id. + * @return {vec4}- A bitfield corresponding to the pred value of each subgroup invocation. + */ +export const subgroupBallot: any; +/** + * A reduction that adds e among all active invocations and returns that result. + * + * @tsl + * @method + * @param {number} e - The value provided to the reduction by the current invocation. + * @return {number} The accumulated result of the reduction operation. + */ +export const subgroupAdd: any; +/** + * An inclusive scan returning the sum of e for all active invocations with subgroup_invocation_id less than or equal to this invocation. + * + * @tsl + * @method + * @param {number} e - The value provided to the inclusive scan by the current invocation. + * @return {number} The accumulated result of the inclusive scan operation. + */ +export const subgroupInclusiveAdd: any; +/** + * An exclusive scan that returns the sum of e for all active invocations with subgroup_invocation_id less than this invocation. + * + * @tsl + * @method + * @param {number} e - The value provided to the exclusive scan by the current invocation. + * @return {number} The accumulated result of the exclusive scan operation. + */ +export const subgroupExclusiveAdd: any; +/** + * A reduction that multiplies e among all active invocations and returns that result. + * + * @tsl + * @method + * @param {number} e - The value provided to the reduction by the current invocation. + * @return {number} The accumulated result of the reduction operation. + */ +export const subgroupMul: any; +/** + * An inclusive scan returning the product of e for all active invocations with subgroup_invocation_id less than or equal to this invocation. + * + * @tsl + * @method + * @param {number} e - The value provided to the inclusive scan by the current invocation. + * @return {number} The accumulated result of the inclusive scan operation. + */ +export const subgroupInclusiveMul: any; +/** + * An exclusive scan that returns the product of e for all active invocations with subgroup_invocation_id less than this invocation. + * + * @tsl + * @method + * @param {number} e - The value provided to the exclusive scan by the current invocation. + * @return {number} The accumulated result of the exclusive scan operation. + */ +export const subgroupExclusiveMul: any; +/** + * A reduction that performs a bitwise and of e among all active invocations and returns that result. + * + * @tsl + * @method + * @param {number} e - The value provided to the reduction by the current invocation. + * @return {number} The result of the reduction operation. + */ +export const subgroupAnd: any; +/** + * A reduction that performs a bitwise or of e among all active invocations and returns that result. + * + * @tsl + * @method + * @param {number} e - The value provided to the reduction by the current invocation. + * @return {number} The result of the reduction operation. + */ +export const subgroupOr: any; +/** + * A reduction that performs a bitwise xor of e among all active invocations and returns that result. + * + * @tsl + * @method + * @param {number} e - The value provided to the reduction by the current invocation. + * @return {number} The result of the reduction operation. + */ +export const subgroupXor: any; +/** + * A reduction that performs a min of e among all active invocations and returns that result. + * + * @tsl + * @method + * @param {number} e - The value provided to the reduction by the current invocation. + * @return {number} The result of the reduction operation. + */ +export const subgroupMin: any; +/** + * A reduction that performs a max of e among all active invocations and returns that result. + * + * @tsl + * @method + * @param {number} e - The value provided to the reduction by the current invocation. + * @return {number} The result of the reduction operation. + */ +export const subgroupMax: any; +/** + * Returns true if e is true for all active invocations in the subgroup. + * + * @tsl + * @method + * @return {bool} The result of the computation. + */ +export const subgroupAll: any; +/** + * Returns true if e is true for any active invocation in the subgroup + * + * @tsl + * @method + * @return {bool} The result of the computation. + */ +export const subgroupAny: any; +/** + * Broadcasts e from the active invocation with the lowest subgroup_invocation_id in the subgroup to all other active invocations. + * + * @tsl + * @method + * @param {number} e - The value to broadcast from the lowest subgroup invocation. + * @param {number} id - The subgroup invocation to broadcast from. + * @return {number} The broadcast value. + */ +export const subgroupBroadcastFirst: any; +/** + * Swaps e between invocations in the quad in the X direction. + * + * @tsl + * @method + * @param {number} e - The value to swap from the current invocation. + * @return {number} The value received from the swap operation. + */ +export const quadSwapX: any; +/** + * Swaps e between invocations in the quad in the Y direction. + * + * @tsl + * @method + * @param {number} e - The value to swap from the current invocation. + * @return {number} The value received from the swap operation. + */ +export const quadSwapY: any; +/** + * Swaps e between invocations in the quad diagonally. + * + * @tsl + * @method + * @param {number} e - The value to swap from the current invocation. + * @return {number} The value received from the swap operation. + */ +export const quadSwapDiagonal: any; +/** + * Broadcasts e from the invocation whose subgroup_invocation_id matches id, to all active invocations. + * + * @tsl + * @method + * @param {number} e - The value to broadcast from subgroup invocation 'id'. + * @param {number} id - The subgroup invocation to broadcast from. + * @return {number} The broadcast value. + */ +export const subgroupBroadcast: any; +/** + * Returns v from the active invocation whose subgroup_invocation_id matches id + * + * @tsl + * @method + * @param {number} v - The value to return from subgroup invocation id^mask. + * @param {number} id - The subgroup invocation which returns the value v. + * @return {number} The broadcast value. + */ +export const subgroupShuffle: any; +/** + * Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id ^ mask. + * + * @tsl + * @method + * @param {number} v - The value to return from subgroup invocation id^mask. + * @param {number} mask - A bitmask that determines the target invocation via a XOR operation. + * @return {number} The broadcast value. + */ +export const subgroupShuffleXor: any; +/** + * Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id - delta + * + * @tsl + * @method + * @param {number} v - The value to return from subgroup invocation id^mask. + * @param {number} delta - A value that offsets the current in. + * @return {number} The broadcast value. + */ +export const subgroupShuffleUp: any; +/** + * Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id + delta + * + * @tsl + * @method + * @param {number} v - The value to return from subgroup invocation id^mask. + * @param {number} delta - A value that offsets the current subgroup invocation. + * @return {number} The broadcast value. + */ +export const subgroupShuffleDown: any; +/** + * Broadcasts e from the quad invocation with id equal to id. + * + * @tsl + * @method + * @param {number} e - The value to broadcast. + * @return {number} The broadcast value. + */ +export const quadBroadcast: any; +/** + * This class represents a set of built in WGSL shader functions that sync + * synchronously execute an operation across a subgroup, or 'warp', of compute + * or fragment shader invocations within a workgroup. Typically, these functions + * will synchronously execute an operation using data from all active invocations + * within the subgroup, then broadcast that result to all active invocations. In + * other graphics APIs, subgroup functions are also referred to as wave intrinsics + * (DirectX/HLSL) or warp intrinsics (CUDA). + * + * @augments TempNode + */ +declare class SubgroupFunctionNode extends TempNode { + /** + * Constructs a new function node. + * + * @param {string} method - The subgroup/wave intrinsic method to construct. + * @param {Node} [aNode=null] - The method's first argument. + * @param {Node} [bNode=null] - The method's second argument. + */ + constructor(method: string, aNode?: Node, bNode?: Node); + /** + * The subgroup/wave intrinsic method to construct. + * + * @type {string} + */ + method: string; + /** + * The method's first argument. + * + * @type {Node} + */ + aNode: Node; + /** + * The method's second argument. + * + * @type {Node} + */ + bNode: Node; + getInputType(builder: any): any; + generateNodeType(builder: any): any; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +declare namespace SubgroupFunctionNode { + let SUBGROUP_ELECT: string; + let SUBGROUP_BALLOT: string; + let SUBGROUP_ADD: string; + let SUBGROUP_INCLUSIVE_ADD: string; + let SUBGROUP_EXCLUSIVE_AND: string; + let SUBGROUP_MUL: string; + let SUBGROUP_INCLUSIVE_MUL: string; + let SUBGROUP_EXCLUSIVE_MUL: string; + let SUBGROUP_AND: string; + let SUBGROUP_OR: string; + let SUBGROUP_XOR: string; + let SUBGROUP_MIN: string; + let SUBGROUP_MAX: string; + let SUBGROUP_ALL: string; + let SUBGROUP_ANY: string; + let SUBGROUP_BROADCAST_FIRST: string; + let QUAD_SWAP_X: string; + let QUAD_SWAP_Y: string; + let QUAD_SWAP_DIAGONAL: string; + let SUBGROUP_BROADCAST: string; + let SUBGROUP_SHUFFLE: string; + let SUBGROUP_SHUFFLE_XOR: string; + let SUBGROUP_SHUFFLE_UP: string; + let SUBGROUP_SHUFFLE_DOWN: string; + let QUAD_BROADCAST: string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts new file mode 100644 index 000000000..617e35cea --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts @@ -0,0 +1,119 @@ +export default WorkgroupInfoNode; +export function workgroupArray(type: string, count?: number): WorkgroupInfoNode; +/** + * A node allowing the user to create a 'workgroup' scoped buffer within the + * context of a compute shader. Typically, workgroup scoped buffers are + * created to hold data that is transferred from a global storage scope into + * a local workgroup scope. For invocations within a workgroup, data + * access speeds on 'workgroup' scoped buffers can be significantly faster + * than similar access operations on globally accessible storage buffers. + * + * This node can only be used with a WebGPU backend. + * + * @augments Node + */ +declare class WorkgroupInfoNode extends Node { + /** + * Constructs a new workgroup info node. + * + * @param {string} scope - The address space the buffer is scoped to. Currently only `'Workgroup'` is used. + * @param {string} bufferType - The data type of a 'workgroup' scoped buffer element. + * @param {number} [bufferCount=0] - The number of elements in the buffer. + */ + constructor(scope: string, bufferType: string, bufferCount?: number); + /** + * The buffer type. + * + * @type {string} + */ + bufferType: string; + /** + * The buffer count. + * + * @type {number} + * @default 0 + */ + bufferCount: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWorkgroupInfoNode: boolean; + /** + * The data type of the array buffer. + * + * @type {string} + */ + elementType: string; + /** + * The address space the buffer is scoped to. Currently only `'Workgroup'` is used. + * + * @type {string} + */ + scope: string; + /** + * Sets the name of this node. + * + * @param {string} name - The name to set. + * @return {WorkgroupInfoNode} A reference to this node. + */ + setName(name: string): WorkgroupInfoNode; + /** + * Sets the name/label of this node. + * + * @deprecated + * @param {string} name - The name to set. + * @return {WorkgroupInfoNode} A reference to this node. + */ + label(name: string): WorkgroupInfoNode; + /** + * Sets the scope of this node. + * + * @param {string} scope - The scope to set. + * @return {WorkgroupInfoNode} A reference to this node. + */ + setScope(scope: string): WorkgroupInfoNode; + /** + * The data type of the array buffer. + * + * @return {string} The element type. + */ + getElementType(): string; + /** + * Overwrites the default implementation since the input type + * is inferred from the scope. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(): string; + /** + * This method can be used to access elements via an index node. + * + * @param {IndexNode} indexNode - indexNode. + * @return {WorkgroupInfoElementNode} A reference to an element. + */ + element(indexNode: IndexNode): WorkgroupInfoElementNode; + generate(builder: any): any; +} +import Node from '../core/Node.js'; +/** + * Represents an element of a 'workgroup' scoped buffer. + * + * @augments ArrayElementNode + */ +declare class WorkgroupInfoElementNode extends ArrayElementNode { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWorkgroupInfoElementNode: boolean; + generate(builder: any, output: any): any; +} +import ArrayElementNode from '../utils/ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts new file mode 100644 index 000000000..5c4e49ae2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts @@ -0,0 +1,25 @@ +export default AONode; +/** + * A generic class that can be used by nodes which contribute + * ambient occlusion to the scene. E.g. an ambient occlusion map + * node can be used as input for this module. Used in {@link NodeMaterial}. + * + * @augments LightingNode + */ +declare class AONode extends LightingNode { + /** + * Constructs a new AO node. + * + * @param {?Node} [aoNode=null] - The ambient occlusion node. + */ + constructor(aoNode?: Node | null); + /** + * The ambient occlusion node. + * + * @type {?Node} + * @default null + */ + aoNode: Node | null; + setup(builder: any): void; +} +import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts new file mode 100644 index 000000000..5705b1d91 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts @@ -0,0 +1,12 @@ +export default AmbientLightNode; +/** + * Module for representing ambient lights as nodes. + * + * @augments AnalyticLightNode + */ +declare class AmbientLightNode extends AnalyticLightNode { + setup({ context }: { + context: any; + }): void; +} +import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts new file mode 100644 index 000000000..e1c0209aa --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts @@ -0,0 +1,127 @@ +export default AnalyticLightNode; +/** + * Base class for analytic light nodes. + * + * @augments LightingNode + */ +declare class AnalyticLightNode extends LightingNode { + /** + * Constructs a new analytic light node. + * + * @param {?Light} [light=null] - The light source. + */ + constructor(light?: Light | null); + /** + * The light source. + * + * @type {?Light} + * @default null + */ + light: Light | null; + /** + * The light's color value. + * + * @type {Color} + */ + color: Color; + /** + * The light's color node. Points to `colorNode` of the light source, if set. Otherwise + * it creates a uniform node based on {@link AnalyticLightNode#color}. + * + * @type {Node} + */ + colorNode: Node; + /** + * This property is used to retain a reference to the original value of {@link AnalyticLightNode#colorNode}. + * The final color node is represented by a different node when using shadows. + * + * @type {?Node} + * @default null + */ + baseColorNode: Node | null; + /** + * Represents the light's shadow. + * + * @type {?ShadowNode} + * @default null + */ + shadowNode: ShadowNode | null; + /** + * Represents the light's shadow color. + * + * @type {?Node} + * @default null + */ + shadowColorNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isAnalyticLightNode: boolean; + _shadowDisposeListener: (() => void) | undefined; + /** + * Frees internal resources related to shadows. + */ + disposeShadow(): void; + getHash(): any; + /** + * Returns a node representing a direction vector which points from the current + * position in view space to the light's position in view space. + * + * @param {NodeBuilder} builder - The builder object used for setting up the light. + * @return {Node} The light vector node. + */ + getLightVector(builder: NodeBuilder): Node; + /** + * Sets up the direct lighting for the analytic light node. + * + * @abstract + * @param {NodeBuilder} builder - The builder object used for setting up the light. + * @return {Object|undefined} The direct light data (color and direction). + */ + setupDirect(): Object | undefined; + /** + * Sets up the direct rect area lighting for the analytic light node. + * + * @abstract + * @param {NodeBuilder} builder - The builder object used for setting up the light. + * @return {Object|undefined} The direct rect area light data. + */ + setupDirectRectArea(): Object | undefined; + /** + * Setups the shadow node for this light. The method exists so concrete light classes + * can setup different types of shadow nodes. + * + * @return {ShadowNode} The created shadow node. + */ + setupShadowNode(): ShadowNode; + /** + * Setups the shadow for this light. This method is only executed if the light + * cast shadows and the current build object receives shadows. It incorporates + * shadows into the lighting computation. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setupShadow(builder: NodeBuilder): void; + /** + * Unlike most other nodes, lighting nodes do not return a output node in {@link Node#setup}. + * The main purpose of lighting nodes is to configure the current {@link LightingModel} and/or + * invocate the respective interface methods. + * + * @param {NodeBuilder} builder - The current node builder. + */ + setup(builder: NodeBuilder): void; + /** + * The update method is used to update light uniforms per frame. + * Potentially overwritten in concrete light nodes to update light + * specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(): void; +} +import LightingNode from './LightingNode.js'; +import { Color } from '../../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts new file mode 100644 index 000000000..701118341 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts @@ -0,0 +1,26 @@ +export default BasicEnvironmentNode; +/** + * Represents a basic model for Image-based lighting (IBL). The environment + * is defined via environment maps in the equirectangular or cube map format. + * `BasicEnvironmentNode` is intended for non-PBR materials like {@link MeshBasicNodeMaterial} + * or {@link MeshPhongNodeMaterial}. + * + * @augments LightingNode + */ +declare class BasicEnvironmentNode extends LightingNode { + /** + * Constructs a new basic environment node. + * + * @param {Node} [envNode=null] - A node representing the environment. + */ + constructor(envNode?: Node); + /** + * A node representing the environment. + * + * @type {Node} + * @default null + */ + envNode: Node; + setup(builder: any): void; +} +import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts new file mode 100644 index 000000000..b5173c497 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts @@ -0,0 +1,24 @@ +export default BasicLightMapNode; +/** + * A specific version of {@link IrradianceNode} that is only relevant + * for {@link MeshBasicNodeMaterial}. Since the material is unlit, it + * requires a special scaling factor for the light map. + * + * @augments LightingNode + */ +declare class BasicLightMapNode extends LightingNode { + /** + * Constructs a new basic light map node. + * + * @param {?Node} [lightMapNode=null] - The light map node. + */ + constructor(lightMapNode?: Node | null); + /** + * The light map node. + * + * @type {?Node} + */ + lightMapNode: Node | null; + setup(builder: any): void; +} +import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts new file mode 100644 index 000000000..723a2afc6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts @@ -0,0 +1,13 @@ +export default DirectionalLightNode; +/** + * Module for representing directional lights as nodes. + * + * @augments AnalyticLightNode + */ +declare class DirectionalLightNode extends AnalyticLightNode { + setupDirect(): { + lightDirection: any; + lightColor: Node; + }; +} +import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts new file mode 100644 index 000000000..6b87431fc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts @@ -0,0 +1,33 @@ +export default EnvironmentNode; +/** + * Represents a physical model for Image-based lighting (IBL). The environment + * is defined via environment maps in the equirectangular, cube map or cubeUV (PMREM) format. + * `EnvironmentNode` is intended for PBR materials like {@link MeshStandardNodeMaterial}. + * + * @augments LightingNode + */ +declare class EnvironmentNode extends LightingNode { + /** + * Constructs a new environment node. + * + * @param {Node} [envNode=null] - A node representing the environment. + */ + constructor(envNode?: Node); + /** + * A node representing the environment. + * + * @type {?Node} + * @default null + */ + envNode: Node | null; + setup(builder: any): void; + /** + * Returns the PMREM node cache of the current renderer. + * + * @private + * @param {Renderer} renderer - The current renderer. + * @return {WeakMap} The node cache. + */ + private _getPMREMNodeCache; +} +import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts new file mode 100644 index 000000000..6612f6067 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts @@ -0,0 +1,34 @@ +export default HemisphereLightNode; +/** + * Module for representing hemisphere lights as nodes. + * + * @augments AnalyticLightNode + */ +declare class HemisphereLightNode extends AnalyticLightNode { + /** + * Uniform node representing the light's position. + * + * @type {UniformNode} + */ + lightPositionNode: UniformNode; + /** + * A node representing the light's direction. + * + * @type {Node} + */ + lightDirectionNode: Node; + /** + * Uniform node representing the light's ground color. + * + * @type {UniformNode} + */ + groundColorNode: UniformNode; + /** + * Overwritten to updated hemisphere light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + setup(builder: any): void; +} +import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts new file mode 100644 index 000000000..28a59eced --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts @@ -0,0 +1,16 @@ +export default IESSpotLightNode; +/** + * An IES version of the default spot light node. + * + * @augments SpotLightNode + */ +declare class IESSpotLightNode extends SpotLightNode { + /** + * The texture node representing the IES texture. + * + * @type {?TextureNode} + * @default null + */ + _iesTextureNode: TextureNode | null; +} +import SpotLightNode from './SpotLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts new file mode 100644 index 000000000..0498aea05 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts @@ -0,0 +1,24 @@ +export default IrradianceNode; +/** + * A generic class that can be used by nodes which contribute + * irradiance to the scene. E.g. a light map node can be used + * as input for this module. Used in {@link NodeMaterial}. + * + * @augments LightingNode + */ +declare class IrradianceNode extends LightingNode { + /** + * Constructs a new irradiance node. + * + * @param {Node} node - A node contributing irradiance. + */ + constructor(node: Node); + /** + * A node contributing irradiance. + * + * @type {Node} + */ + node: Node; + setup(builder: any): void; +} +import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts new file mode 100644 index 000000000..02fd000fd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts @@ -0,0 +1,22 @@ +export default LightProbeNode; +/** + * Module for representing light probes as nodes. + * + * @augments AnalyticLightNode + */ +declare class LightProbeNode extends AnalyticLightNode { + /** + * Light probe represented as a uniform of spherical harmonics. + * + * @type {UniformArrayNode} + */ + lightProbe: UniformArrayNode; + /** + * Overwritten to updated light probe specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + setup(builder: any): void; +} +import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts new file mode 100644 index 000000000..9a60548b3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts @@ -0,0 +1,11 @@ +/** + * Represents a `discard` shader operation in TSL. + * + * @method + * @param {Object} inputs - The input parameter object. + * @param {Node} inputs.lightDistance - The distance of the light's position to the current fragment position. + * @param {Node} inputs.cutoffDistance - The light's cutoff distance. + * @param {Node} inputs.decayExponent - The light's decay exponent. + * @return {Node} The distance falloff. + */ +export const getDistanceAttenuation: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts new file mode 100644 index 000000000..deef06daa --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts @@ -0,0 +1,89 @@ +export default LightingContextNode; +export const lightingContext: any; +/** + * `LightingContextNode` represents an extension of the {@link ContextNode} module + * by adding lighting specific context data. It represents the runtime context of + * {@link LightsNode}. + * + * @augments ContextNode + */ +declare class LightingContextNode extends ContextNode { + /** + * Constructs a new lighting context node. + * + * @param {LightsNode} lightsNode - The lights node. + * @param {?LightingModel} [lightingModel=null] - The current lighting model. + * @param {?Array} materialLightings - The material lightings nodes. + * @param {?Node} [backdropNode=null] - A backdrop node. + * @param {?Node} [backdropAlphaNode=null] - A backdrop alpha node. + */ + constructor(lightsNode: LightsNode, lightingModel?: LightingModel | null, materialLightings?: Array | null, backdropNode?: Node | null, backdropAlphaNode?: Node | null); + /** + * The current lighting model. + * + * @type {?LightingModel} + * @default null + */ + lightingModel: LightingModel | null; + /** + * @type {?Array} + * @default [] + */ + materialLightings: Array | null; + /** + * A backdrop node. + * + * @type {?Node} + * @default null + */ + backdropNode: Node | null; + /** + * A backdrop alpha node. + * + * @type {?Node} + * @default null + */ + backdropAlphaNode: Node | null; + _value: { + radiance: Node; + irradiance: Node; + iblIrradiance: Node; + ambientOcclusion: Node; + reflectedLight: { + directDiffuse: Node; + directSpecular: Node; + indirectDiffuse: Node; + indirectSpecular: Node; + }; + backdrop: Node; + backdropAlpha: Node; + } | null; + /** + * Returns a lighting context object. + * + * @return {{ + * radiance: Node, + * irradiance: Node, + * iblIrradiance: Node, + * ambientOcclusion: Node, + * reflectedLight: {directDiffuse: Node, directSpecular: Node, indirectDiffuse: Node, indirectSpecular: Node}, + * backdrop: Node, + * backdropAlpha: Node + * }} The lighting context object. + */ + getContext(): { + radiance: Node; + irradiance: Node; + iblIrradiance: Node; + ambientOcclusion: Node; + reflectedLight: { + directDiffuse: Node; + directSpecular: Node; + indirectDiffuse: Node; + indirectSpecular: Node; + }; + backdrop: Node; + backdropAlpha: Node; + }; +} +import ContextNode from '../core/ContextNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts new file mode 100644 index 000000000..adc145155 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts @@ -0,0 +1,21 @@ +export default LightingNode; +/** + * Base class for lighting nodes. + * + * @augments Node + */ +declare class LightingNode extends Node { + /** + * Constructs a new lighting node. + */ + constructor(); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLightingNode: boolean; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts new file mode 100644 index 000000000..a78eb1292 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts @@ -0,0 +1,125 @@ +export default LightsNode; +export function lights(lights?: Array): LightsNode; +/** + * This node represents the scene's lighting and manages the lighting model's life cycle + * for the current build 3D object. It is responsible for computing the total outgoing + * light in a given lighting context. + * + * @augments Node + */ +declare class LightsNode extends Node { + /** + * Constructs a new lights node. + */ + constructor(); + /** + * A node representing the total diffuse light. + * + * @type {Node} + */ + totalDiffuseNode: Node; + /** + * A node representing the total specular light. + * + * @type {Node} + */ + totalSpecularNode: Node; + /** + * A node representing the outgoing light. + * + * @type {Node} + */ + outgoingLightNode: Node; + /** + * An array representing the lights in the scene. + * + * @private + * @type {Array} + */ + private _lights; + /** + * Computes a hash value for identifying the current light nodes setup. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {string} The computed hash. + */ + getHash(builder: NodeBuilder): string; + /** + * Analyzes the node's dependencies by building all nested light nodes + * and the output node. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + */ + analyze(builder: NodeBuilder): void; + /** + * Creates lighting nodes for each scene light. This makes it possible to further + * process lights in the node system. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Array} The array of lighting nodes. + */ + setupLightsNode(builder: NodeBuilder): Array; + /** + * Sets up a direct light in the lighting model. + * + * @param {Object} builder - The builder object containing the context and stack. + * @param {Object} lightNode - The light node. + * @param {Object} lightData - The light object containing color and direction properties. + */ + setupDirectLight(builder: Object, lightNode: Object, lightData: Object): void; + /** + * Sets up a direct rect area light in the lighting model. + * + * @param {Object} builder - The builder object containing the context and stack. + * @param {Object} lightNode - The light node. + * @param {Object} lightData - The light object containing color and area light properties. + */ + setupDirectRectAreaLight(builder: Object, lightNode: Object, lightData: Object): void; + /** + * Setups the internal lights by building all respective + * light nodes. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @param {Array} lightNodes - An array of lighting nodes. + */ + setupLights(builder: NodeBuilder, lightNodes: Array): void; + getLightNodes(builder: any): any; + /** + * The implementation makes sure that for each light in the scene + * there is a corresponding light node. By building the light nodes + * and evaluating the lighting model the outgoing light is computed. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Node} A node representing the outgoing light. + */ + setup(builder: NodeBuilder): Node; + /** + * Configures this node with an array of lights. + * + * @param {Array} lights - An array of lights. + * @return {LightsNode} A reference to this node. + */ + setLights(lights: Array): LightsNode; + /** + * Returns an array of the scene's lights. + * + * @return {Array} The scene's lights. + */ + getLights(): Array; + /** + * Returns an array of the scene's lights. + * + * The light variations are shader-dependent; + * if this array changes, the shader needs to be recreated. + * + * @return {Array} The scene's lights. + */ + getBuiltinLights(): Array; + /** + * Whether the scene has lights or not. + * + * @type {boolean} + */ + get hasLights(): boolean; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts new file mode 100644 index 000000000..4dee5e49c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts @@ -0,0 +1,40 @@ +export function directPointLight({ color, lightVector, cutoffDistance, decayExponent }: { + color: any; + lightVector: any; + cutoffDistance: any; + decayExponent: any; +}): { + lightDirection: any; + lightColor: any; +}; +export default PointLightNode; +/** + * Module for representing point lights as nodes. + * + * @augments AnalyticLightNode + */ +declare class PointLightNode extends AnalyticLightNode { + /** + * Uniform node representing the cutoff distance. + * + * @type {UniformNode} + */ + cutoffDistanceNode: UniformNode; + /** + * Uniform node representing the decay exponent. + * + * @type {UniformNode} + */ + decayExponentNode: UniformNode; + /** + * Overwritten to updated point light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + setupDirect(builder: any): { + lightDirection: any; + lightColor: any; + }; +} +import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts new file mode 100644 index 000000000..6215b48a3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts @@ -0,0 +1,52 @@ +export const BasicPointShadowFilter: () => void; +/** + * A shadow filtering function for point lights using Vogel disk sampling and IGN. + * + * Uses 5 samples distributed via Vogel disk pattern in tangent space around the + * sample direction, rotated per-pixel using Interleaved Gradient Noise (IGN). + * + * @method + * @param {Object} inputs - The input parameter object. + * @param {CubeDepthTexture} inputs.depthTexture - A reference to the shadow cube map. + * @param {Node} inputs.bd3D - The normalized direction from light to fragment. + * @param {Node} inputs.dp - The depth value to compare against. + * @param {LightShadow} inputs.shadow - The light shadow. + * @return {Node} The filtering result. + */ +export const PointShadowFilter: () => void; +export default PointShadowNode; +export function pointShadow(light: PointLight, shadow?: PointLightShadow | null): PointShadowNode; +/** + * Represents the shadow implementation for point light nodes. + * + * @augments ShadowNode + */ +declare class PointShadowNode extends ShadowNode { + /** + * Overwrites the default implementation to only use point light specific + * shadow filter functions. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @param {Object} inputs - A configuration object that defines the shadow filtering. + * @param {Function} inputs.filterFn - This function defines the filtering type of the shadow map e.g. PCF. + * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's depth texture. + * @param {Node} inputs.shadowCoord - Shadow coordinates which are used to sample from the shadow map. + * @param {LightShadow} inputs.shadow - The light shadow. + * @return {Node} The result node of the shadow filtering. + */ + setupShadowFilter(builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow }: { + filterFn: Function; + depthTexture: DepthTexture; + shadowCoord: Node; + shadow: LightShadow; + }): Node; + /** + * Overwrites the default implementation to create a CubeRenderTarget with CubeDepthTexture. + * + * @param {LightShadow} shadow - The light shadow object. + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Object} An object containing the shadow map and depth texture. + */ + setupRenderTarget(shadow: LightShadow, builder: NodeBuilder): Object; +} +import ShadowNode from './ShadowNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts new file mode 100644 index 000000000..22f3ffe8b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts @@ -0,0 +1,17 @@ +export default ProjectorLightNode; +/** + * An implementation of a projector light node. + * + * @augments SpotLightNode + */ +declare class ProjectorLightNode extends SpotLightNode { + update(frame: any): void; + /** + * Overwrites the default implementation to compute projection attenuation. + * + * @param {NodeBuilder} builder - The node builder. + * @return {Node} The spot attenuation. + */ + getSpotAttenuation(builder: NodeBuilder): Node; +} +import SpotLightNode from './SpotLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts new file mode 100644 index 000000000..0b4d56420 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts @@ -0,0 +1,41 @@ +export default RectAreaLightNode; +/** + * Module for representing rect area lights as nodes. + * + * @augments AnalyticLightNode + */ +declare class RectAreaLightNode extends AnalyticLightNode { + /** + * Used to configure the internal BRDF approximation texture data. + * + * @param {RectAreaLightTexturesLib} ltc - The BRDF approximation texture data. + */ + static setLTC(ltc: RectAreaLightTexturesLib): void; + /** + * Uniform node representing the half height of the are light. + * + * @type {UniformNode} + */ + halfHeight: UniformNode; + /** + * Uniform node representing the half width of the are light. + * + * @type {UniformNode} + */ + halfWidth: UniformNode; + /** + * Overwritten to updated rect area light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + setupDirectRectArea(builder: any): { + lightColor: Node; + lightPosition: UniformNode; + halfWidth: UniformNode; + halfHeight: UniformNode; + ltc_1: import("../accessors/TextureNode.js").default; + ltc_2: import("../accessors/TextureNode.js").default; + }; +} +import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts new file mode 100644 index 000000000..423eed39e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts @@ -0,0 +1,68 @@ +/** + * TSL object that represents the vertex position in world space during the shadow pass. + * + * @tsl + * @type {Node} + */ +export const shadowPositionWorld: Node; +export default ShadowBaseNode; +import Node from '../core/Node.js'; +/** + * Base class for all shadow nodes. + * + * Shadow nodes encapsulate shadow related logic and are always coupled to lighting nodes. + * Lighting nodes might share the same shadow node type or use specific ones depending on + * their requirements. + * + * @augments Node + */ +declare class ShadowBaseNode extends Node { + /** + * Constructs a new shadow base node. + * + * @param {Light} light - The shadow casting light. + */ + constructor(light: Light); + /** + * The shadow casting light. + * + * @type {Light} + */ + light: Light; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowBaseNode: boolean; + /** + * Retrieves or creates a shadow material for the shadow casting light source. + * + * This method checks if a shadow material already exists for the provided light in the internal library. + * If not, it creates a new `NodeMaterial` configured for shadow rendering and stores it for future use. + * + * @return {NodeMaterial} The shadow material associated with the given light. + */ + getShadowMaterial(): NodeMaterial; + /** + * Disposes the shadow material for the shadow casting light source. + */ + disposeShadowMaterial(): void; + /** + * Returns a function to render shadow objects in a scene for the given light shadow and renderer. + * + * @param {Renderer} renderer - The renderer. + * @param {LightShadow} [shadow=this.light.shadow] - The light shadow object containing shadow properties. + * @return {Function} A function that renders shadow objects. + */ + getShadowRenderObjectFunction(renderer: Renderer, shadow?: LightShadow): Function; + /** + * Setups the shadow position node which is by default the predefined TSL node object `shadowPositionWorld`. + * + * @param {NodeBuilder} object - A configuration object that must at least hold a material reference. + */ + setupShadowPosition({ context, material }: NodeBuilder): void; +} +import NodeMaterial from '../../materials/nodes/NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts new file mode 100644 index 000000000..3946fc3fb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts @@ -0,0 +1,36 @@ +/** + * A shadow filtering function performing basic filtering. This is in fact an unfiltered version of the shadow map + * with a binary `[0,1]` result. + * + * @method + * @param {Object} inputs - The input parameter object. + * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. + * @param {Node} inputs.shadowCoord - The shadow coordinates. + * @return {Node} The filtering result. + */ +export const BasicShadowFilter: () => void; +/** + * A shadow filtering function performing PCF filtering with Vogel disk sampling and IGN. + * + * Uses 5 samples distributed via Vogel disk pattern, rotated per-pixel using Interleaved + * Gradient Noise (IGN) to break up banding artifacts. Combined with hardware PCF (4-tap + * filtering per sample), this effectively provides 20 filtered taps with better distribution. + * + * @method + * @param {Object} inputs - The input parameter object. + * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. + * @param {Node} inputs.shadowCoord - The shadow coordinates. + * @param {LightShadow} inputs.shadow - The light shadow. + * @return {Node} The filtering result. + */ +export const PCFShadowFilter: () => void; +/** + * A shadow filtering function performing VSM filtering. + * + * @method + * @param {Object} inputs - The input parameter object. + * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. + * @param {Node} inputs.shadowCoord - The shadow coordinates. + * @return {Node} The filtering result. + */ +export const VSMShadowFilter: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts new file mode 100644 index 000000000..a24be2495 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts @@ -0,0 +1,192 @@ +export default ShadowNode; +export function shadow(light: Light, shadow?: LightShadow | null): ShadowNode; +/** + * Represents the default shadow implementation for lighting nodes. + * + * @augments ShadowBaseNode + */ +declare class ShadowNode extends ShadowBaseNode { + /** + * Constructs a new shadow node. + * + * @param {Light} light - The shadow casting light. + * @param {?LightShadow} [shadow=null] - An optional light shadow. + */ + constructor(light: Light, shadow?: LightShadow | null); + /** + * The light shadow which defines the properties light's + * shadow. + * + * @type {?LightShadow} + * @default null + */ + shadow: LightShadow | null; + /** + * A reference to the shadow map which is a render target. + * + * @type {?RenderTarget} + * @default null + */ + shadowMap: RenderTarget | null; + /** + * Only relevant for VSM shadows. Render target for the + * first VSM render pass. + * + * @type {?RenderTarget} + * @default null + */ + vsmShadowMapVertical: RenderTarget | null; + /** + * Only relevant for VSM shadows. Render target for the + * second VSM render pass. + * + * @type {?RenderTarget} + * @default null + */ + vsmShadowMapHorizontal: RenderTarget | null; + /** + * Only relevant for VSM shadows. Node material which + * is used to render the first VSM pass. + * + * @type {?NodeMaterial} + * @default null + */ + vsmMaterialVertical: NodeMaterial | null; + /** + * Only relevant for VSM shadows. Node material which + * is used to render the second VSM pass. + * + * @type {?NodeMaterial} + * @default null + */ + vsmMaterialHorizontal: NodeMaterial | null; + /** + * A reference to the output node which defines the + * final result of this shadow node. + * + * @type {?Node} + * @private + * @default null + */ + private _node; + /** + * The current shadow map type of this shadow node. + * + * @type {?number} + * @private + * @default null + */ + private _currentShadowType; + /** + * A Weak Map holding the current frame ID per camera. Used + * to control the update of shadow maps. + * + * @type {WeakMap} + * @private + */ + private _cameraFrameId; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isShadowNode: boolean; + /** + * This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer. + * + * @type {number} + * @readonly + * @default true + */ + readonly depthLayer: number; + /** + * Setups the shadow filtering. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @param {Object} inputs - A configuration object that defines the shadow filtering. + * @param {Function} inputs.filterFn - This function defines the filtering type of the shadow map e.g. PCF. + * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. + * @param {Node} inputs.shadowCoord - Shadow coordinates which are used to sample from the shadow map. + * @param {LightShadow} inputs.shadow - The light shadow. + * @return {Node} The result node of the shadow filtering. + */ + setupShadowFilter(builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow, depthLayer }: { + filterFn: Function; + depthTexture: DepthTexture; + shadowCoord: Node; + shadow: LightShadow; + }): Node; + /** + * Setups the shadow coordinates. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @param {Node} shadowPosition - A node representing the shadow position. + * @return {Node} The shadow coordinates. + */ + setupShadowCoord(builder: NodeBuilder, shadowPosition: Node): Node; + /** + * Returns the shadow filtering function for the given shadow type. + * + * @param {number} type - The shadow type. + * @return {Function} The filtering function. + */ + getShadowFilterFn(type: number): Function; + setupRenderTarget(shadow: any, builder: any): { + shadowMap: any; + depthTexture: DepthTexture; + }; + /** + * Setups the shadow output node. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {Node} The shadow output node. + */ + setupShadow(builder: NodeBuilder): Node; + /** + * The implementation performs the setup of the output node. An output is only + * produces if shadow mapping is globally enabled in the renderer. + * + * @param {NodeBuilder} builder - A reference to the current node builder. + * @return {ShaderCallNodeInternal} The output node. + */ + setup(builder: NodeBuilder): ShaderCallNodeInternal; + /** + * Renders the shadow. The logic of this function could be included + * into {@link ShadowNode#updateShadow} however more specialized shadow + * nodes might require a custom shadow map rendering. By having a + * dedicated method, it's easier to overwrite the default behavior. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + renderShadow(frame: NodeFrame): void; + /** + * Updates the shadow. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateShadow(frame: NodeFrame): void; + _depthVersionCached: any; + /** + * For VSM additional render passes are required. + * + * @param {Renderer} renderer - A reference to the current renderer. + */ + vsmPass(renderer: Renderer): void; + /** + * Resets the resouce state of this shadow node. + * + * @private + */ + private _reset; + /** + * The implementation performs the update of the shadow map if necessary. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + updateBefore(frame: NodeFrame): void; +} +import ShadowBaseNode from './ShadowBaseNode.js'; +import NodeMaterial from '../../materials/nodes/NodeMaterial.js'; +import { DepthTexture } from '../../textures/DepthTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts new file mode 100644 index 000000000..84f17e937 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts @@ -0,0 +1,52 @@ +export default SpotLightNode; +/** + * Module for representing spot lights as nodes. + * + * @augments AnalyticLightNode + */ +declare class SpotLightNode extends AnalyticLightNode { + /** + * Uniform node representing the cone cosine. + * + * @type {UniformNode} + */ + coneCosNode: UniformNode; + /** + * Uniform node representing the penumbra cosine. + * + * @type {UniformNode} + */ + penumbraCosNode: UniformNode; + /** + * Uniform node representing the cutoff distance. + * + * @type {UniformNode} + */ + cutoffDistanceNode: UniformNode; + /** + * Uniform node representing the decay exponent. + * + * @type {UniformNode} + */ + decayExponentNode: UniformNode; + /** + * Overwritten to updated spot light specific uniforms. + * + * @param {NodeFrame} frame - A reference to the current node frame. + */ + update(frame: NodeFrame): void; + /** + * Computes the spot attenuation for the given angle. + * + * @param {NodeBuilder} builder - The node builder. + * @param {Node} angleCosine - The angle to compute the spot attenuation for. + * @return {Node} The spot attenuation. + */ + getSpotAttenuation(builder: NodeBuilder, angleCosine: Node): Node; + getLightCoord(builder: any): any; + setupDirect(builder: any): { + lightColor: any; + lightDirection: any; + }; +} +import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts new file mode 100644 index 000000000..27d194964 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts @@ -0,0 +1,2 @@ +export const mx_hsvtorgb: any; +export const mx_rgbtohsv: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts new file mode 100644 index 000000000..521d93346 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts @@ -0,0 +1 @@ +export const mx_srgb_texture_to_lin_rec709: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts new file mode 100644 index 000000000..4edb75dc5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts @@ -0,0 +1,2 @@ +export function mx_rotate2d(input: any, amount?: number): any; +export function mx_rotate3d(input: any, amount?: number, axis?: any): any; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts new file mode 100644 index 000000000..a9df4cdc0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts @@ -0,0 +1,50 @@ +export function mx_aastep(threshold: any, value: any): any; +export function mx_ramplr(valuel: any, valuer: any, texcoord?: AttributeNode): any; +export function mx_ramptb(valueb: any, valuet: any, texcoord?: AttributeNode): any; +export function mx_ramp4(valuetl: any, valuetr: any, valuebl: any, valuebr: any, texcoord?: AttributeNode): any; +export function mx_splitlr(valuel: any, valuer: any, center: any, texcoord?: AttributeNode): any; +export function mx_splittb(valueb: any, valuet: any, center: any, texcoord?: AttributeNode): any; +export function mx_transform_uv(uv_scale?: number, uv_offset?: number, uv_geo?: AttributeNode): any; +export function mx_safepower(in1: any, in2?: number): any; +export function mx_contrast(input: any, amount?: number, pivot?: number): any; +export function mx_noise_float(texcoord?: AttributeNode, amplitude?: number, pivot?: number): any; +export function mx_noise_vec3(texcoord?: AttributeNode, amplitude?: number, pivot?: number): any; +export function mx_noise_vec4(texcoord?: AttributeNode, amplitude?: number, pivot?: number): any; +export function mx_smoothstep(inNode: any, low?: number, high?: number): any; +export function mx_cell_noise_vec3(texcoord?: AttributeNode): any; +export function mx_worley_noise_float_2d(texcoord?: AttributeNode, jitter?: number, style?: number): void; +export function mx_worley_noise_float_3d(texcoord?: AttributeNode, jitter?: number, style?: number): void; +export function mx_unifiednoise2d(noiseType: any, texcoord?: AttributeNode, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number): void; +export function mx_unifiednoise3d(noiseType: any, texcoord?: AttributeNode, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number): void; +export function mx_worley_noise_float(texcoord?: AttributeNode, jitter?: number, style?: number): void; +export function mx_worley_noise_vec2(texcoord?: AttributeNode, jitter?: number): any; +export function mx_worley_noise_vec3(texcoord?: AttributeNode, jitter?: number, metric?: number): any; +export function mx_worley_noise_vec3_style(texcoord?: AttributeNode, jitter?: number, style?: number, metric?: number): any; +export function mx_cell_noise_float(texcoord?: AttributeNode): any; +export function mx_fractal_noise_float_2d(texcoord?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; +export function mx_fractal_noise_float(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; +export function mx_fractal_noise_vec2(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; +export function mx_fractal_noise_vec3(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; +export function mx_fractal_noise_vec4(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; +export function mx_add(in1: any, in2?: any): any; +export function mx_subtract(in1: any, in2?: any): any; +export function mx_multiply(in1: any, in2?: any): any; +export function mx_divide(in1: any, in2?: any): any; +export function mx_modulo(in1: any, in2?: any): any; +export function mx_power(in1: any, in2?: any): any; +export function mx_atan2(in1?: any, in2?: any): any; +export function mx_timer(): UniformNode; +export function mx_frame(): UniformNode; +export function mx_invert(in1: any, amount?: any): any; +export function mx_ifgreater(value1: any, value2: any, in1: any, in2: any): any; +export function mx_ifgreatereq(value1: any, value2: any, in1: any, in2: any): any; +export function mx_ifequal(value1: any, value2: any, in1: any, in2: any): any; +export function mx_separate(in1: any, channelOrOut?: null): any; +export function mx_place2d(texcoord: any, pivot?: any, scale?: any, rotate?: any, offset?: any, operationorder?: any): any; +export function mx_heighttonormal(input: any, scale?: number, texcoord?: AttributeNode): any; +import { mx_rotate2d } from './MaterialXCore.js'; +import { mx_rotate3d } from './MaterialXCore.js'; +import { mx_hsvtorgb } from './MaterialXColor.js'; +import { mx_rgbtohsv } from './MaterialXColor.js'; +import { mx_srgb_texture_to_lin_rec709 } from './MaterialXColorTransform.js'; +export { mx_rotate2d, mx_rotate3d, mx_hsvtorgb, mx_rgbtohsv, mx_srgb_texture_to_lin_rec709 }; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts new file mode 100644 index 000000000..e6cad55ae --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts @@ -0,0 +1,74 @@ +export const mx_select: any; +export const mx_negate_if: any; +export const mx_floor: any; +export const mx_floorfrac: () => void; +export const mx_bilerp_0: any; +export const mx_bilerp_1: any; +export const mx_bilerp: import("../utils/FunctionOverloadingNode.js").default; +export const mx_trilerp_0: any; +export const mx_trilerp_1: any; +export const mx_trilerp: import("../utils/FunctionOverloadingNode.js").default; +export const mx_gradient_float_0: any; +export const mx_gradient_float_1: any; +export const mx_gradient_float: import("../utils/FunctionOverloadingNode.js").default; +export const mx_gradient_vec3_0: any; +export const mx_gradient_vec3_1: any; +export const mx_gradient_vec3: import("../utils/FunctionOverloadingNode.js").default; +export const mx_gradient_scale2d_0: any; +export const mx_gradient_scale3d_0: any; +export const mx_gradient_scale2d_1: any; +export const mx_gradient_scale2d: import("../utils/FunctionOverloadingNode.js").default; +export const mx_gradient_scale3d_1: any; +export const mx_gradient_scale3d: import("../utils/FunctionOverloadingNode.js").default; +export const mx_rotl32: any; +export const mx_bjmix: any; +export const mx_bjfinal: any; +export const mx_bits_to_01: any; +export const mx_fade: any; +export const mx_hash_int_0: any; +export const mx_hash_int_1: any; +export const mx_hash_int_2: any; +export const mx_hash_int_3: any; +export const mx_hash_int_4: any; +export const mx_hash_int: import("../utils/FunctionOverloadingNode.js").default; +export const mx_hash_vec3_0: any; +export const mx_hash_vec3_1: any; +export const mx_hash_vec3: import("../utils/FunctionOverloadingNode.js").default; +export const mx_perlin_noise_float_0: any; +export const mx_perlin_noise_float_1: any; +export const mx_perlin_noise_float: import("../utils/FunctionOverloadingNode.js").default; +export const mx_perlin_noise_vec3_0: any; +export const mx_perlin_noise_vec3_1: any; +export const mx_perlin_noise_vec3: import("../utils/FunctionOverloadingNode.js").default; +export const mx_cell_noise_float_0: any; +export const mx_cell_noise_float_1: any; +export const mx_cell_noise_float_2: any; +export const mx_cell_noise_float_3: any; +export const mx_cell_noise_float: import("../utils/FunctionOverloadingNode.js").default; +export const mx_cell_noise_vec3_0: any; +export const mx_cell_noise_vec3_1: any; +export const mx_cell_noise_vec3_2: any; +export const mx_cell_noise_vec3_3: any; +export const mx_cell_noise_vec3: import("../utils/FunctionOverloadingNode.js").default; +export const mx_fractal_noise_float_2d: any; +export const mx_fractal_noise_float: any; +export const mx_fractal_noise_vec3: any; +export const mx_fractal_noise_vec2: any; +export const mx_fractal_noise_vec4: any; +export const mx_worley_distance_0: any; +export const mx_worley_distance_1: any; +export const mx_worley_distance: import("../utils/FunctionOverloadingNode.js").default; +export const mx_worley_noise_float_3d: () => void; +export const mx_worley_noise_float_2d: () => void; +export const mx_worley_noise_float: import("../utils/FunctionOverloadingNode.js").default; +export const mx_worley_noise_vec2_0: any; +export const mx_worley_noise_vec3_0: any; +export const mx_worley_noise_vec2_1: any; +export const mx_worley_noise_vec2: import("../utils/FunctionOverloadingNode.js").default; +export const mx_worley_noise_vec3_1: any; +export const mx_worley_noise_vec3: import("../utils/FunctionOverloadingNode.js").default; +export const mx_worley_noise_vec3_style_0: any; +export const mx_worley_noise_vec3_style_1: any; +export const mx_worley_noise_vec3_style: import("../utils/FunctionOverloadingNode.js").default; +export const mx_unifiednoise2d: () => void; +export const mx_unifiednoise3d: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts new file mode 100644 index 000000000..f15d7989b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts @@ -0,0 +1,62 @@ +export default BitcastNode; +/** + * Reinterpret the bit representation of a value in one type as a value in another type. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @param {string} y - The new type. + * @returns {Node} + */ +export const bitcast: any; +export function floatBitsToInt(value: Node): BitcastNode; +export function floatBitsToUint(value: Node): BitcastNode; +export function intBitsToFloat(value: Node): BitcastNode; +export function uintBitsToFloat(value: Node): BitcastNode; +/** + * This node represents an operation that reinterprets the bit representation of a value + * in one type as a value in another type. + * + * @augments TempNode + */ +declare class BitcastNode extends TempNode { + /** + * Constructs a new bitcast node. + * + * @param {Node} valueNode - The value to convert. + * @param {string} conversionType - The type to convert to. + * @param {?string} [inputType = null] - The expected input data type of the bitcast operation. + */ + constructor(valueNode: Node, conversionType: string, inputType?: string | null); + /** + * The data to bitcast to a new type. + * + * @type {Node} + */ + valueNode: Node; + /** + * The type the value will be converted to. + * + * @type {string} + */ + conversionType: string; + /** + * The expected input data type of the bitcast operation. + * + * + * @type {string} + * @default null + */ + inputType: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBitcastNode: boolean; + generateNodeType(builder: any): any; + generate(builder: any): string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts new file mode 100644 index 000000000..5a85b0585 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts @@ -0,0 +1,111 @@ +export default BitcountNode; +/** + * Finds the number of consecutive 0 bits from the least significant bit of the input value, + * which is also the index of the least significant bit of the input value. + * + * Can only be used with {@link WebGPURenderer} and a WebGPU backend. + * + * @tsl + * @function + * @param {Node | number} x - The input value. + * @returns {Node} + */ +export const countTrailingZeros: any; +/** + * Finds the number of consecutive 0 bits starting from the most significant bit of the input value. + * + * Can only be used with {@link WebGPURenderer} and a WebGPU backend. + * + * @tsl + * @function + * @param {Node | number} x - The input value. + * @returns {Node} + */ +export const countLeadingZeros: any; +/** + * Finds the number of '1' bits set in the input value + * + * Can only be used with {@link WebGPURenderer} and a WebGPU backend. + * + * @tsl + * @function + * @returns {Node} + */ +export const countOneBits: any; +/** + * This node represents an operation that counts the bits of a piece of shader data. + * + * @augments MathNode + */ +declare class BitcountNode extends MathNode { + /** + * Constructs a new math node. + * + * @param {'countTrailingZeros'|'countLeadingZeros'|'countOneBits'} method - The method name. + * @param {Node} aNode - The first input. + */ + constructor(method: "countTrailingZeros" | "countLeadingZeros" | "countOneBits", aNode: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBitcountNode: boolean; + /** + * Casts the input value of the function to an integer if necessary. + * + * @private + * @param {Node|Node} inputNode - The input value. + * @param {Node} outputNode - The output value. + * @param {string} elementType - The type of the input value. + */ + private _resolveElementType; + _returnDataNode(inputType: any): any; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of countTrailingZeros. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} elementType - The type of the input value. + * @returns {Function} - The generated function + */ + private _createTrailingZerosBaseLayout; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of countLeadingZeros. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} elementType - The type of the input value. + * @returns {Function} - The generated function + */ + private _createLeadingZerosBaseLayout; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of countOneBits. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} elementType - The type of the input value. + * @returns {Function} - The generated function + */ + private _createOneBitsBaseLayout; + /** + * Creates and registers a reusable GLSL function that emulates the behavior of the specified bitcount function. + * including considerations for component-wise bitcounts on vector type inputs. + * + * @private + * @param {string} method - The name of the function to create. + * @param {string} inputType - The type of the input value. + * @param {number} typeLength - The vec length of the input value. + * @param {Function} baseFn - The base function that operates on an individual component of the vector. + * @returns {Function} - The alias function for the specified bitcount method. + */ + private _createMainLayout; +} +declare namespace BitcountNode { + let COUNT_TRAILING_ZEROS: string; + let COUNT_LEADING_ZEROS: string; + let COUNT_ONE_BITS: string; +} +import MathNode from './MathNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts new file mode 100644 index 000000000..25e21f3e9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts @@ -0,0 +1,65 @@ +export default ConditionalNode; +/** + * TSL function for creating a conditional node. + * + * @tsl + * @function + * @param {Node} condNode - The node that defines the condition. + * @param {Node} ifNode - The node that is evaluate when the condition ends up `true`. + * @param {?Node} [elseNode=null] - The node that is evaluate when the condition ends up `false`. + * @returns {ConditionalNode} + */ +export const select: any; +/** + * Represents a logical `if/else` statement. Can be used as an alternative + * to the `If()`/`Else()` syntax. + * + * The `select()` method is called in a chaining fashion on a condition. The parameter nodes of `select()` + * determine the outcome of the entire statement. + * + * ```js + * velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity ); + * ``` + * + * @augments Node + */ +declare class ConditionalNode extends Node { + /** + * Constructs a new conditional node. + * + * @param {Node} condNode - The node that defines the condition. + * @param {Node} ifNode - The node that is evaluate when the condition ends up `true`. + * @param {?Node} [elseNode=null] - The node that is evaluate when the condition ends up `false`. + */ + constructor(condNode: Node, ifNode: Node, elseNode?: Node | null); + /** + * The node that defines the condition. + * + * @type {Node} + */ + condNode: Node; + /** + * The node that is evaluate when the condition ends up `true`. + * + * @type {Node} + */ + ifNode: Node; + /** + * The node that is evaluate when the condition ends up `false`. + * + * @type {?Node} + * @default null + */ + elseNode: Node | null; + /** + * This method is overwritten since the node type is inferred from the if/else + * nodes. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + setup(builder: any): void; + generate(builder: any, output: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts new file mode 100644 index 000000000..e42866ba8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts @@ -0,0 +1,9 @@ +/** + * Generates a hash value in the range `[0, 1]` from the given seed. + * + * @tsl + * @function + * @param {Node} seed - The seed. + * @return {Node} The hash value. + */ +export const hash: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts new file mode 100644 index 000000000..7311ec733 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts @@ -0,0 +1,703 @@ +export default MathNode; +/** + * A small value used to handle floating-point precision errors. + * + * @tsl + * @type {Node} + */ +export const EPSILON: Node; +/** + * Represents infinity. + * + * @tsl + * @type {Node} + */ +export const INFINITY: Node; +/** + * Represents PI. + * + * @tsl + * @type {Node} + */ +export const PI: Node; +/** + * Represents PI * 2. Please use the non-deprecated version `TWO_PI`. + * + * @tsl + * @deprecated + * @type {Node} + */ +export const PI2: Node; +/** + * Represents PI * 2. + * + * @tsl + * @type {Node} + */ +export const TWO_PI: Node; +/** + * Represents PI / 2. + * + * @tsl + * @type {Node} + */ +export const HALF_PI: Node; +/** + * Returns `true` if all components of `x` are `true`. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const all: any; +/** + * Returns `true` if any components of `x` are `true`. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const any: any; +/** + * Converts a quantity in degrees to radians. + * + * @tsl + * @function + * @param {Node | number} x - The input in degrees. + * @returns {Node} + */ +export const radians: any; +/** + * Convert a quantity in radians to degrees. + * + * @tsl + * @function + * @param {Node | number} x - The input in radians. + * @returns {Node} + */ +export const degrees: any; +/** + * Returns the natural exponentiation of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const exp: any; +/** + * Returns 2 raised to the power of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const exp2: any; +/** + * Returns the natural logarithm of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const log: any; +/** + * Returns the base 2 logarithm of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const log2: any; +/** + * Returns the square root of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const sqrt: any; +/** + * Returns the inverse of the square root of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const inverseSqrt: any; +/** + * Finds the nearest integer less than or equal to the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const floor: any; +/** + * Finds the nearest integer that is greater than or equal to the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const ceil: any; +/** + * Calculates the unit vector in the same direction as the original vector. + * + * @tsl + * @function + * @param {Node} x - The input vector. + * @returns {Node} + */ +export const normalize: any; +/** + * Computes the fractional part of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const fract: any; +/** + * Returns the sine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const sin: any; +/** + * Returns the hyperbolic sine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const sinh: any; +/** + * Returns the cosine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const cos: any; +/** + * Returns the hyperbolic cosine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const cosh: any; +/** + * Returns the tangent of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const tan: any; +/** + * Returns the hyperbolic tangent of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const tanh: any; +/** + * Returns the arcsine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const asin: any; +/** + * Returns the inverse hyperbolic sine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const asinh: any; +/** + * Returns the arccosine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const acos: any; +/** + * Returns the inverse hyperbolic cosine of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const acosh: any; +/** + * Returns the arc-tangent of the parameter. + * If two parameters are provided, the result is `atan2(y/x)`. + * + * @tsl + * @function + * @param {Node | number} y - The y parameter. + * @param {?(Node | number)} x - The x parameter. + * @returns {Node} + */ +export const atan: any; +/** + * Returns the inverse hyperbolic tangent of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const atanh: any; +/** + * Returns the absolute value of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const abs: any; +/** + * Extracts the sign of the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const sign: any; +/** + * Calculates the length of a vector. + * + * @tsl + * @function + * @param {Node} x - The parameter. + * @returns {Node} + */ +export const length: any; +/** + * Negates the value of the parameter (-x). + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const negate: any; +/** + * Return `1` minus the parameter. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const oneMinus: any; +/** + * Returns the partial derivative of the parameter with respect to x. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const dFdx: any; +/** + * Returns the partial derivative of the parameter with respect to y. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const dFdy: any; +/** + * Rounds the parameter to the nearest integer. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const round: any; +/** + * Returns the reciprocal of the parameter `(1/x)`. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const reciprocal: any; +/** + * Truncates the parameter, removing the fractional part. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const trunc: any; +/** + * Returns the sum of the absolute derivatives in x and y. + * + * @tsl + * @function + * @param {Node | number} x - The parameter. + * @returns {Node} + */ +export const fwidth: any; +/** + * Returns the transpose of a matrix. + * + * @tsl + * @function + * @param {Node} x - The parameter. + * @returns {Node} + */ +export const transpose: any; +/** + * Returns the determinant of a matrix. + * + * @tsl + * @function + * @param {Node} x - The parameter. + * @returns {Node} + */ +export const determinant: any; +/** + * Returns the inverse of a matrix. + * + * @tsl + * @function + * @param {Node} x - The parameter. + * @returns {Node} + */ +export const inverse: any; +/** + * Returns the least of the given values. + * + * @tsl + * @function + * @param {...(Node | number)} values - The values to compare. + * @returns {Node} + */ +export const min: any; +/** + * Returns the greatest of the given values. + * + * @tsl + * @function + * @param {...(Node | number)} values - The values to compare. + * @returns {Node} + */ +export const max: any; +/** + * Generate a step function by comparing two values. + * + * @tsl + * @function + * @param {Node | number} x - The y parameter. + * @param {Node | number} y - The x parameter. + * @returns {Node} + */ +export const step: any; +/** + * Calculates the reflection direction for an incident vector. + * + * @tsl + * @function + * @param {Node} I - The incident vector. + * @param {Node} N - The normal vector. + * @returns {Node} + */ +export const reflect: any; +/** + * Calculates the distance between two points. + * + * @tsl + * @function + * @param {Node} x - The first point. + * @param {Node} y - The second point. + * @returns {Node} + */ +export const distance: any; +/** + * Calculates the absolute difference between two values. + * + * @tsl + * @function + * @param {Node | number} x - The first parameter. + * @param {Node | number} y - The second parameter. + * @returns {Node} + */ +export const difference: any; +/** + * Calculates the dot product of two vectors. + * + * @tsl + * @function + * @param {Node} x - The first vector. + * @param {Node} y - The second vector. + * @returns {Node} + */ +export const dot: any; +/** + * Calculates the cross product of two vectors. + * + * @tsl + * @function + * @param {Node} x - The first vector. + * @param {Node} y - The second vector. + * @returns {Node} + */ +export const cross: any; +/** + * Return the value of the first parameter raised to the power of the second one. + * + * @tsl + * @function + * @param {Node | number} x - The first parameter. + * @param {Node | number} y - The second parameter. + * @returns {Node} + */ +export const pow: any; +export function pow2(x: Node | number): Node; +export function pow3(x: Node | number): Node; +export function pow4(x: Node | number): Node; +/** + * Transforms the direction of a vector by a matrix and then normalizes the result. + * + * @tsl + * @function + * @param {Node} direction - The direction vector. + * @param {Node} matrix - The transformation matrix. + * @returns {Node} + */ +export const transformDirection: any; +export function transformNormalByViewMatrix(normal: Node, viewMatrix: Node): Node; +export function transformNormalByInverseViewMatrix(normal: Node, viewMatrix: Node): Node; +export function cbrt(a: Node | number): Node; +export function lengthSq(a: Node): Node; +/** + * Linearly interpolates between two values. + * + * @tsl + * @function + * @param {Node | number} a - The first parameter. + * @param {Node | number} b - The second parameter. + * @param {Node | number} t - The interpolation value. + * @returns {Node} + */ +export const mix: any; +export function clamp(value: Node | number, low?: Node | number, high?: Node | number): Node; +export function saturate(value: Node | number): Node; +/** + * Calculates the refraction direction for an incident vector. + * + * @tsl + * @function + * @param {Node} I - The incident vector. + * @param {Node} N - The normal vector. + * @param {Node} eta - The ratio of indices of refraction. + * @returns {Node} + */ +export const refract: any; +/** + * Performs a Hermite interpolation between two values. + * + * @tsl + * @function + * @param {Node | number} low - The value of the lower edge of the Hermite function. + * @param {Node | number} high - The value of the upper edge of the Hermite function. + * @param {Node | number} x - The source value for interpolation. + * @returns {Node} + */ +export const smoothstep: any; +/** + * Returns a vector pointing in the same direction as another. + * + * @tsl + * @function + * @param {Node} N - The vector to orient. + * @param {Node} I - The incident vector. + * @param {Node} Nref - The reference vector. + * @returns {Node} + */ +export const faceForward: any; +/** + * Returns a random value for the given uv. + * + * @tsl + * @function + * @param {Node} uv - The uv node. + * @returns {Node} + */ +export const rand: () => void; +export function mixElement(t: Node | number, e1: Node | number, e2: Node | number): Node; +export function smoothstepElement(x: Node | number, low: Node | number, high: Node | number): Node; +export function stepElement(x: Node | number, edge: Node | number): Node; +export const faceforward: any; +export const inversesqrt: any; +/** + * This node represents a variety of mathematical methods available in shaders. + * They are divided into three categories: + * + * - Methods with one input like `sin`, `cos` or `normalize`. + * - Methods with two inputs like `dot`, `cross` or `pow`. + * - Methods with three inputs like `mix`, `clamp` or `smoothstep`. + * + * @augments TempNode + */ +declare class MathNode extends TempNode { + /** + * Constructs a new math node. + * + * @param {string} method - The method name. + * @param {Node} aNode - The first input. + * @param {?Node} [bNode=null] - The second input. + * @param {?Node} [cNode=null] - The third input. + */ + constructor(method: string, aNode: Node, bNode?: Node | null, cNode?: Node | null, ...args: any[]); + /** + * The method name. + * + * @type {string} + */ + method: string; + /** + * The first input. + * + * @type {Node} + */ + aNode: Node; + /** + * The second input. + * + * @type {?Node} + * @default null + */ + bNode: Node | null; + /** + * The third input. + * + * @type {?Node} + * @default null + */ + cNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMathNode: boolean; + /** + * The input type is inferred from the node types of the input nodes. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The input type. + */ + getInputType(builder: NodeBuilder): string; + /** + * The selected method as well as the input type determine the node type of this node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + setup(builder: any): any; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +declare namespace MathNode { + let ALL: string; + let ANY: string; + let RADIANS: string; + let DEGREES: string; + let EXP: string; + let EXP2: string; + let LOG: string; + let LOG2: string; + let SQRT: string; + let INVERSE_SQRT: string; + let FLOOR: string; + let CEIL: string; + let NORMALIZE: string; + let FRACT: string; + let SIN: string; + let SINH: string; + let COS: string; + let COSH: string; + let TAN: string; + let TANH: string; + let ASIN: string; + let ASINH: string; + let ACOS: string; + let ACOSH: string; + let ATAN: string; + let ATANH: string; + let ABS: string; + let SIGN: string; + let LENGTH: string; + let NEGATE: string; + let ONE_MINUS: string; + let DFDX: string; + let DFDY: string; + let ROUND: string; + let RECIPROCAL: string; + let TRUNC: string; + let FWIDTH: string; + let TRANSPOSE: string; + let DETERMINANT: string; + let INVERSE: string; + let EQUALS: string; + let MIN: string; + let MAX: string; + let STEP: string; + let REFLECT: string; + let DISTANCE: string; + let DIFFERENCE: string; + let DOT: string; + let CROSS: string; + let POW: string; + let TRANSFORM_DIRECTION: string; + let MIX: string; + let CLAMP: string; + let REFRACT: string; + let SMOOTHSTEP: string; + let FACEFORWARD: string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts new file mode 100644 index 000000000..69ed7ec52 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts @@ -0,0 +1,4 @@ +export function parabola(x: Node, k: Node): Node; +export function gain(x: Node, k: Node): Node; +export function pcurve(x: Node, a: Node, b: Node): Node; +export function sinc(x: Node, k: Node): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts new file mode 100644 index 000000000..34ed2e4b4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts @@ -0,0 +1,312 @@ +export default OperatorNode; +/** + * Returns the addition of two or more value. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @param {...Node} params - Additional input parameters. + * @returns {OperatorNode} + */ +export const add: any; +/** + * Returns the subtraction of two or more value. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @param {...Node} params - Additional input parameters. + * @returns {OperatorNode} + */ +export const sub: any; +/** + * Returns the multiplication of two or more value. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @param {...Node} params - Additional input parameters. + * @returns {OperatorNode} + */ +export const mul: any; +/** + * Returns the division of two or more value. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @param {...Node} params - Additional input parameters. + * @returns {OperatorNode} + */ +export const div: any; +/** + * Computes the remainder of dividing the first node by the second one. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const mod: any; +/** + * Checks if two nodes are equal. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const equal: any; +/** + * Checks if two nodes are not equal. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const notEqual: any; +/** + * Checks if the first node is less than the second. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const lessThan: any; +/** + * Checks if the first node is greater than the second. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const greaterThan: any; +/** + * Checks if the first node is less than or equal to the second. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const lessThanEqual: any; +/** + * Checks if the first node is greater than or equal to the second. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const greaterThanEqual: any; +/** + * Performs a logical AND operation on multiple nodes. + * + * @tsl + * @function + * @param {...Node} nodes - The input nodes to be combined using AND. + * @returns {OperatorNode} + */ +export const and: any; +/** + * Performs a logical OR operation on multiple nodes. + * + * @tsl + * @function + * @param {...Node} nodes - The input nodes to be combined using OR. + * @returns {OperatorNode} + */ +export const or: any; +/** + * Performs logical NOT on a node. + * + * @tsl + * @function + * @param {Node} value - The value. + * @returns {OperatorNode} + */ +export const not: any; +/** + * Performs logical XOR on two nodes. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const xor: any; +/** + * Performs bitwise AND on two nodes. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const bitAnd: any; +/** + * Performs bitwise NOT on a node. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const bitNot: any; +/** + * Performs bitwise OR on two nodes. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const bitOr: any; +/** + * Performs bitwise XOR on two nodes. + * + * @tsl + * @function + * @param {Node} a - The first input. + * @param {Node} b - The second input. + * @returns {OperatorNode} + */ +export const bitXor: any; +/** + * Shifts a node to the left. + * + * @tsl + * @function + * @param {Node} a - The node to shift. + * @param {Node} b - The value to shift. + * @returns {OperatorNode} + */ +export const shiftLeft: any; +/** + * Shifts a node to the right. + * + * @tsl + * @function + * @param {Node} a - The node to shift. + * @param {Node} b - The value to shift. + * @returns {OperatorNode} + */ +export const shiftRight: any; +/** + * Increments a node by 1. + * + * @tsl + * @function + * @param {Node} a - The node to increment. + * @returns {OperatorNode} + */ +export const incrementBefore: () => void; +/** + * Decrements a node by 1. + * + * @tsl + * @function + * @param {Node} a - The node to decrement. + * @returns {OperatorNode} + */ +export const decrementBefore: () => void; +/** + * Increments a node by 1 and returns the previous value. + * + * @tsl + * @function + * @param {Node} a - The node to increment. + * @returns {OperatorNode} + */ +export const increment: () => void; +/** + * Decrements a node by 1 and returns the previous value. + * + * @tsl + * @function + * @param {Node} a - The node to decrement. + * @returns {OperatorNode} + */ +export const decrement: () => void; +/** + * This node represents basic mathematical and logical operations like addition, + * subtraction or comparisons (e.g. `equal()`). + * + * @augments TempNode + */ +declare class OperatorNode extends TempNode { + /** + * Constructs a new operator node. + * + * @param {string} op - The operator. + * @param {Node} aNode - The first input. + * @param {Node} bNode - The second input. + * @param {...Node} params - Additional input parameters. + */ + constructor(op: string, aNode: Node, bNode: Node, ...params: Node[]); + /** + * The operator. + * + * @type {string} + */ + op: string; + /** + * The first input. + * + * @type {Node} + */ + aNode: Node; + /** + * The second input. + * + * @type {Node} + */ + bNode: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isOperatorNode: boolean; + /** + * Returns the operator method name. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} output - The output type. + * @returns {string} The operator method name. + */ + getOperatorMethod(builder: NodeBuilder, output: string): string; + /** + * This method is overwritten since the node type is inferred from the operator + * and the input node types. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {?string} [output=null] - The output type. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder, output?: string | null): string; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts new file mode 100644 index 000000000..d9b190a16 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts @@ -0,0 +1,91 @@ +export default PackFloatNode; +/** + * Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. + * round(clamp(c, -1, +1) * 32767.0) + * + * @tsl + * @function + * @param {Node} value - The 2-component vector to be packed + * @returns {Node} + */ +export const packSnorm2x16: any; +/** + * Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. + * round(clamp(c, 0, +1) * 65535.0) + * + * @tsl + * @function + * @param {Node} value - The 2-component vector to be packed + * @returns {Node} + */ +export const packUnorm2x16: any; +/** + * Converts each component of the vec2 to 16-bit floating-point values. The results are packed into a single unsigned integer. + * + * @tsl + * @function + * @param {Node} value - The 2-component vector to be packed + * @returns {Node} + */ +export const packHalf2x16: any; +/** + * Converts each component of the normalized float to 8-bit integer values. The results are packed into a single unsigned integer. + * + * @tsl + * @function + * @param {Node} value - The 4-component vector to be packed + * @returns {Node} + */ +export const packSnorm4x8: any; +/** + * Converts each component of the normalized float to 8-bit integer values. The results are packed into a single unsigned integer. + * + * @tsl + * @function + * @param {Node} value - The 4-component vector to be packed + * @returns {Node} + */ +export const packUnorm4x8: any; +/** + * This node represents an operation that packs floating-point values of a vector into an unsigned 32-bit integer + * + * @augments TempNode + */ +declare class PackFloatNode extends TempNode { + /** + * + * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the float values are mapped to the integer range. + * @param {Node} vectorNode - The vector node to be packed + */ + constructor(encoding: "snorm" | "unorm" | "float16", vectorNode: Node); + /** + * The vector to be packed. + * + * @type {Node} + */ + vectorNode: Node; + /** + * The numeric encoding. + * + * @type {string} + */ + encoding: string; + /** + * The component layout of the packed integer. + * + * @type {'2x16' | '4x8'} + * @default '2x16' + */ + layout: "2x16" | "4x8"; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPackFloatNode: boolean; + generateNodeType(): string; + generate(builder: any): string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts new file mode 100644 index 000000000..15dad5e5f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts @@ -0,0 +1,11 @@ +/** + * Generates a noise value from the given position, speed and time parameters. + * + * @tsl + * @function + * @param {Node} position - The position. + * @param {Node} speed - The speed. + * @param {Node} time - The time. + * @return {Node} The generated noise. + */ +export const triNoise3D: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts new file mode 100644 index 000000000..198e08bc4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts @@ -0,0 +1,89 @@ +export default UnpackFloatNode; +/** + * Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized signed integers. Returns a vec2 with both values. + * + * @tsl + * @function + * @param {Node} value - The unsigned integer to be unpacked + * @returns {Node} + */ +export const unpackSnorm2x16: any; +/** + * Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized unsigned integers. Returns a vec2 with both values. + * + * @tsl + * @function + * @param {Node} value - The unsigned integer to be unpacked + * @returns {Node} + */ +export const unpackUnorm2x16: any; +/** + * Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as 16-bit floating-point numbers. Returns a vec2 with both values. + * + * @tsl + * @function + * @param {Node} value - The unsigned integer to be unpacked + * @returns {Node} + */ +export const unpackHalf2x16: any; +/** + * Unpacks a 32-bit unsigned integer into four 8-bit values, interpreted as normalized signed integers. Returns a vec4 with all values. + * + * @tsl + * @function + * @param {Node} value - The unsigned integer to be unpacked + * @returns {Node} + */ +export const unpackSnorm4x8: any; +/** + * Unpacks a 32-bit unsigned integer into four 8-bit values, interpreted as normalized unsigned integers. Returns a vec4 with all values. + * + * @tsl + * @function + * @param {Node} value - The unsigned integer to be unpacked + * @returns {Node} + */ +export const unpackUnorm4x8: any; +/** + * This node represents an operation that unpacks values from a 32-bit unsigned integer, reinterpreting the results as a floating-point vector + * + * @augments TempNode + */ +declare class UnpackFloatNode extends TempNode { + /** + * + * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the integer values are mapped to the float range + * @param {Node} uintNode - The uint node to be unpacked + */ + constructor(encoding: "snorm" | "unorm" | "float16", uintNode: Node); + /** + * The unsigned integer to be unpacked. + * + * @type {Node} + */ + uintNode: Node; + /** + * The numeric encoding. + * + * @type {string} + */ + encoding: string; + /** + * The component layout of the packed integer. + * + * @type {'2x16' | '4x8'} + * @default '2x16' + */ + layout: "2x16" | "4x8"; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUnpackFloatNode: boolean; + generateNodeType(): "vec2" | "vec4"; + generate(builder: any): string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts b/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts new file mode 100644 index 000000000..3b3ed5efe --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts @@ -0,0 +1,25 @@ +export default GLSLNodeFunction; +/** + * This class represents a GLSL node function. + * + * @augments NodeFunction + */ +declare class GLSLNodeFunction extends NodeFunction { + /** + * Constructs a new GLSL node function. + * + * @param {string} source - The GLSL source. + */ + constructor(source: string); + inputsCode: any; + blockCode: any; + headerCode: any; + /** + * This method returns the GLSL code of the node function. + * + * @param {string} [name=this.name] - The function's name. + * @return {string} The shader code. + */ + getCode(name?: string): string; +} +import NodeFunction from '../core/NodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts b/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts new file mode 100644 index 000000000..4219e9d0e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts @@ -0,0 +1,17 @@ +export default GLSLNodeParser; +/** + * A GLSL node parser. + * + * @augments NodeParser + */ +declare class GLSLNodeParser extends NodeParser { + /** + * The method parses the given GLSL code an returns a node function. + * + * @param {string} source - The GLSL code. + * @return {GLSLNodeFunction} A node function. + */ + parseFunction(source: string): GLSLNodeFunction; +} +import NodeParser from '../core/NodeParser.js'; +import GLSLNodeFunction from './GLSLNodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts new file mode 100644 index 000000000..0ddba7546 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts @@ -0,0 +1,113 @@ +export default PMREMNode; +/** + * TSL function for creating a PMREM node. + * + * @tsl + * @function + * @param {Texture} value - The input texture. + * @param {?Node} [uvNode=null] - The uv node. + * @param {?Node} [levelNode=null] - The level node. + * @returns {PMREMNode} + */ +export const pmremTexture: any; +/** + * This node represents a PMREM which is a special type of preprocessed + * environment map intended for PBR materials. + * + * ```js + * const material = new MeshStandardNodeMaterial(); + * material.envNode = pmremTexture( envMap ); + * ``` + * + * @augments TempNode + */ +declare class PMREMNode extends TempNode { + /** + * Constructs a new function overloading node. + * + * @param {Texture} value - The input texture. + * @param {Node} [uvNode=null] - The uv node. + * @param {Node} [levelNode=null] - The level node. + */ + constructor(value: Texture, uvNode?: Node, levelNode?: Node); + /** + * Reference to the input texture. + * + * @private + * @type {Texture} + */ + private _value; + /** + * Reference to the generated PMREM. + * + * @private + * @type {Texture | null} + * @default null + */ + private _pmrem; + /** + * The uv node. + * + * @type {Node} + */ + uvNode: Node; + /** + * The level node. + * + * @type {Node} + */ + levelNode: Node; + /** + * Reference to a PMREM generator. + * + * @private + * @type {?PMREMGenerator} + * @default null + */ + private _generator; + /** + * The texture node holding the generated PMREM. + * + * @private + * @type {TextureNode} + */ + private _texture; + /** + * A uniform representing the PMREM's width. + * + * @private + * @type {UniformNode} + */ + private _width; + /** + * A uniform representing the PMREM's height. + * + * @private + * @type {UniformNode} + */ + private _height; + /** + * A uniform representing the PMREM's max Mip. + * + * @private + * @type {UniformNode} + */ + private _maxMip; + set value(value: Texture); + /** + * The node's texture value. + * + * @type {Texture} + */ + get value(): Texture; + /** + * Uses the given PMREM texture to update internal values. + * + * @param {Texture} texture - The PMREM texture. + */ + updateFromTexture(texture: Texture): void; + updateBefore(frame: any): void; + setup(builder: any): void; +} +import TempNode from '../core/TempNode.js'; +import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts new file mode 100644 index 000000000..28e9913e8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts @@ -0,0 +1,3 @@ +export const textureCubeUV: () => void; +export const sphericalGaussianBlur: () => void; +export const ggxConvolution: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts b/jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts new file mode 100644 index 000000000..622cf3968 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts @@ -0,0 +1,9 @@ +/** + * Creates a 2x2 checkerboard pattern that can be used as procedural texture data. + * + * @tsl + * @function + * @param {Node} coord - The uv coordinates. + * @return {Node} The result data. + */ +export const checker: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts b/jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts new file mode 100644 index 000000000..0777cf76d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts @@ -0,0 +1,9 @@ +/** + * Generates a circle based on the uv coordinates. + * + * @tsl + * @function + * @param {Node} coord - The uv to generate the circle. + * @return {Node} The circle shape. + */ +export const shapeCircle: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts b/jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts new file mode 100644 index 000000000..cbad0a788 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts @@ -0,0 +1,26 @@ +export function addNodeElement(name: any): void; +export * from "./TSLCore.js"; +export * from "../core/ArrayNode.js"; +export * from "../core/UniformNode.js"; +export * from "../core/PropertyNode.js"; +export * from "../core/AssignNode.js"; +export * from "../code/FunctionCallNode.js"; +export * from "../math/OperatorNode.js"; +export * from "../math/MathNode.js"; +export * from "../math/ConditionalNode.js"; +export * from "../core/ContextNode.js"; +export * from "../core/VarNode.js"; +export * from "../core/VaryingNode.js"; +export * from "../display/ColorSpaceNode.js"; +export * from "../display/ToneMappingNode.js"; +export * from "../accessors/BufferAttributeNode.js"; +export * from "../gpgpu/ComputeNode.js"; +export * from "../core/IsolateNode.js"; +export * from "../core/BypassNode.js"; +export * from "../utils/Remap.js"; +export * from "../code/ExpressionNode.js"; +export * from "../utils/Discard.js"; +export * from "../display/RenderOutputNode.js"; +export * from "../utils/DebugNode.js"; +export * from "../core/SubBuildNode.js"; +export * from "../core/InspectorNode.js"; diff --git a/jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts b/jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts new file mode 100644 index 000000000..9fb1bc989 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts @@ -0,0 +1,74 @@ +export function addMethodChaining(name: any, nodeElement: any): void; +export function defined(value: any): boolean; +export function ShaderNode(jsFunc: any, nodeType: any): ShaderNodeInternal; +export function Fn(jsFunc: any, layout?: null): () => void; +/** + * Add the given node to the current stack. + * + * @param {Node} node - The node to add. + * @returns {Node} The node that was added to the stack. + */ +export function Stack(node: Node): Node; +export function getConstNodeType(value: any): any; +export function nodeObject(val: any, altType?: null): any; +export function nodeObjectIntent(val: any, altType?: null): any; +export function nodeObjects(val: any, altType?: null): any; +export function nodeArray(val: any, altType?: null): any; +export function nodeProxy(NodeClass: any, scope?: null, factor?: null, settings?: null): any; +export function nodeImmutable(NodeClass: any, ...params: any[]): any; +export function nodeProxyIntent(NodeClass: any, scope?: null, factor?: null, settings?: {}): any; +export function nodeProxyConstructor(constructorFunction: any, nodeInstance: any): any; +export function setCurrentStack(stack: any): void; +export function getCurrentStack(): any; +export function If(...params: any[]): StackNode; +export function Switch(...params: any[]): StackNode; +export const color: any; +export const float: any; +export const int: any; +export const uint: any; +export const bool: any; +export const vec2: any; +export const ivec2: any; +export const uvec2: any; +export const bvec2: any; +export const vec3: any; +export const ivec3: any; +export const uvec3: any; +export const bvec3: any; +export const vec4: any; +export const ivec4: any; +export const uvec4: any; +export const bvec4: any; +export const mat2: any; +export const mat3: any; +export const mat4: any; +export const element: any; +export function convert(node: any, types: any): ConvertNode; +export function split(node: any, channels: any): SplitNode; +declare class ShaderNodeInternal extends Node { + constructor(jsFunc: any, nodeType: any); + jsFunc: any; + layout: any; + once: boolean; + setLayout(layout: any): this; + getLayout(): any; + call(rawInputs?: null): ShaderCallNodeInternal; + setup(): ShaderCallNodeInternal; +} +import Node from '../core/Node.js'; +import ConvertNode from '../utils/ConvertNode.js'; +import SplitNode from '../utils/SplitNode.js'; +declare class ShaderCallNodeInternal extends Node { + constructor(shaderNode: any, rawInputs: any); + shaderNode: any; + rawInputs: any; + isShaderCallNodeInternal: boolean; + generateNodeType(builder: any): any; + getElementType(builder: any): any; + getMemberType(builder: any, name: any): any; + call(builder: any): any; + setupOutput(builder: any): any; + getOutputNode(builder: any): any; + build(builder: any, output?: null): any; +} +export {}; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts new file mode 100644 index 000000000..e5669d2f2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts @@ -0,0 +1,53 @@ +export default ArrayElementNode; +/** + * Base class for representing element access on an array-like + * node data structures. + * + * @augments Node + */ +declare class ArrayElementNode extends Node { + /** + * Constructs an array element node. + * + * @param {Node} node - The array-like node. + * @param {Node} indexNode - The index node that defines the element access. + */ + constructor(node: Node, indexNode: Node); + /** + * The array-like node. + * + * @type {Node} + */ + node: Node; + /** + * The index node that defines the element access. + * + * @type {Node} + */ + indexNode: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isArrayElementNode: boolean; + /** + * This method is overwritten since the node type is inferred from the array-like node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * This method is overwritten since the member type is inferred from the array-like node. + * + * @param {NodeBuilder} builder - The current node builder. + * @param {string} name - The member name. + * @return {string} The member type. + */ + getMemberType(builder: NodeBuilder, name: string): string; + generate(builder: any): string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts new file mode 100644 index 000000000..77f0ea2f7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts @@ -0,0 +1,41 @@ +export default ConvertNode; +/** + * This module is part of the TSL core and usually not used in app level code. + * It represents a convert operation during the shader generation process + * meaning it converts the data type of a node to a target data type. + * + * @augments Node + */ +declare class ConvertNode extends Node { + /** + * Constructs a new convert node. + * + * @param {Node} node - The node which type should be converted. + * @param {string} convertTo - The target node type. Multiple types can be defined by separating them with a `|` sign. + */ + constructor(node: Node, convertTo: string); + /** + * The node which type should be converted. + * + * @type {Node} + */ + node: Node; + /** + * The target node type. Multiple types can be defined by separating them with a `|` sign. + * + * @type {string} + */ + convertTo: string; + /** + * This method is overwritten since the implementation tries to infer the best + * matching type from the {@link ConvertNode#convertTo} property. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + serialize(data: any): void; + deserialize(data: any): void; + generate(builder: any, output: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts new file mode 100644 index 000000000..a24a72427 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts @@ -0,0 +1,57 @@ +export default CubeMapNode; +/** + * TSL function for creating a cube map node. + * + * @tsl + * @function + * @param {Node} envNode - The node representing the environment map. + * @returns {CubeMapNode} + */ +export const cubeMapNode: any; +/** + * This node can be used to automatically convert environment maps in the + * equirectangular format into the cube map format. + * + * @augments TempNode + */ +declare class CubeMapNode extends TempNode { + /** + * Constructs a new cube map node. + * + * @param {Node} envNode - The node representing the environment map. + */ + constructor(envNode: Node); + /** + * The node representing the environment map. + * + * @type {Node} + */ + envNode: Node; + /** + * A reference to the internal cube texture. + * + * @private + * @type {?CubeTexture} + * @default null + */ + private _cubeTexture; + /** + * A reference to the internal cube texture node. + * + * @private + * @type {CubeTextureNode} + */ + private _cubeTextureNode; + /** + * A default cube texture that acts as a placeholder. + * It is used when the conversion from equirectangular to cube + * map has not finished yet for a given texture. + * + * @private + * @type {CubeTexture} + */ + private _defaultTexture; + updateBefore(frame: any): void; + setup(builder: any): CubeTextureNode; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts new file mode 100644 index 000000000..526033e08 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts @@ -0,0 +1,12 @@ +export default DebugNode; +export function debug(node: Node, callback?: Function | null): DebugNode; +declare class DebugNode extends TempNode { + constructor(node: any, callback?: null); + node: any; + callback: any; + generateNodeType(builder: any): any; + setup(builder: any): any; + analyze(builder: any): any; + generate(builder: any): any; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts new file mode 100644 index 000000000..2d21a4048 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts @@ -0,0 +1,2 @@ +export function Discard(conditional: ConditionalNode | null): Node; +export function Return(): ExpressionNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts new file mode 100644 index 000000000..32dc240ff --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts @@ -0,0 +1,29 @@ +/** + * TSL function for creating an equirect uv node. + * + * Can be used to compute texture coordinates for projecting an + * equirectangular texture onto a mesh for using it as the scene's + * background. + * + * ```js + * scene.backgroundNode = texture( equirectTexture, equirectUV() ); + * ``` + * + * @tsl + * @function + * @param {?Node} [direction=positionWorldDirection] - A direction vector for sampling which is by default `positionWorldDirection`. + * @returns {Node} + */ +export const equirectUV: () => void; +/** + * TSL function for creating an equirect direction node. + * + * Can be used to compute a direction vector from the given equirectangular + * UV coordinates. + * + * @tsl + * @function + * @param {?Node} [uv=UV()] - The equirectangular UV coordinates. + * @returns {Node} The computed direction vector. + */ +export const equirectDirection: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts new file mode 100644 index 000000000..9c9a75232 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts @@ -0,0 +1,42 @@ +export default EventNode; +export function OnObjectUpdate(callback: Function): EventNode; +export function OnMaterialUpdate(callback: Function): EventNode; +export function OnFrameUpdate(callback: Function): EventNode; +export function OnAfterObjectUpdate(callback: Function): EventNode; +export function OnBeforeObjectUpdate(callback: Function): EventNode; +export function OnBeforeMaterialUpdate(callback: Function): EventNode; +export function OnBeforeFrameUpdate(callback: Function): EventNode; +export function OnBeforeRenderPipeline(callback: Function): EventNode; +export function OnAfterRenderPipeline(callback: Function): EventNode; +/** + * EventNode is a node that executes a callback during specific update phases. + * + * @augments Node + */ +declare class EventNode extends Node { + /** + * Creates an EventNode. + * + * @param {string} eventType - The type of event + * @param {Function} callback - The callback to execute on update. + */ + constructor(eventType: string, callback: Function); + eventType: string; + callback: Function; + setup(builder: any): Node | null; + update(frame: any): void; + updateBefore(frame: any): void; + updateAfter(frame: any): void; +} +declare namespace EventNode { + let OBJECT: string; + let MATERIAL: string; + let FRAME: string; + let AFTER_OBJECT: string; + let BEFORE_OBJECT: string; + let BEFORE_MATERIAL: string; + let BEFORE_FRAME: string; + let BEFORE_RENDER_PIPELINE: string; + let AFTER_RENDER_PIPELINE: string; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts new file mode 100644 index 000000000..15e36f325 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts @@ -0,0 +1,46 @@ +export default FlipNode; +/** + * This module is part of the TSL core and usually not used in app level code. + * It represents a flip operation during the shader generation process + * meaning it flips normalized values with the following formula: + * ``` + * x = 1 - x; + * ``` + * `FlipNode` is internally used to implement any `flipXYZW()`, `flipRGBA()` and + * `flipSTPQ()` method invocations on node objects. For example: + * ```js + * uvNode = uvNode.flipY(); + * ``` + * + * @augments TempNode + */ +declare class FlipNode extends TempNode { + /** + * Constructs a new flip node. + * + * @param {Node} sourceNode - The node which component(s) should be flipped. + * @param {string} components - The components that should be flipped e.g. `'x'` or `'xy'`. + */ + constructor(sourceNode: Node, components: string); + /** + * The node which component(s) should be flipped. + * + * @type {Node} + */ + sourceNode: Node; + /** + * The components that should be flipped e.g. `'x'` or `'xy'`. + * + * @type {string} + */ + components: string; + /** + * This method is overwritten since the node type is inferred from the source node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any): string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts new file mode 100644 index 000000000..765ca535c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts @@ -0,0 +1,60 @@ +export default FunctionOverloadingNode; +export function overloadingFn(functionNodes: Array): FunctionOverloadingNode; +/** + * This class allows to define multiple overloaded versions + * of the same function. Depending on the parameters of the function + * call, the node picks the best-fit overloaded version. + * + * @augments Node + */ +declare class FunctionOverloadingNode extends Node { + /** + * Constructs a new function overloading node. + * + * @param {Array} functionNodes - Array of `Fn` function definitions. + * @param {...Node} parametersNodes - A list of parameter nodes. + */ + constructor(functionNodes?: Array, ...parametersNodes: Node[]); + /** + * Array of `Fn` function definitions. + * + * @type {Array} + */ + functionNodes: Array; + /** + * A list of parameter nodes. + * + * @type {Array} + */ + parametersNodes: Array; + /** + * The selected overloaded function call. + * + * @private + * @type {ShaderCallNodeInternal} + */ + private _candidateFn; + /** + * This method is overwritten since the node type is inferred from + * the function's return type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + /** + * Returns the candidate function for the current parameters. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {FunctionNode} The candidate function. + */ + getCandidateFn(builder: NodeBuilder): FunctionNode; + /** + * Sets up the node for the current parameters. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Node} The setup node. + */ + setup(builder: NodeBuilder): Node; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts new file mode 100644 index 000000000..70dfe5537 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts @@ -0,0 +1,33 @@ +export default JoinNode; +/** + * This module is part of the TSL core and usually not used in app level code. + * It represents a join operation during the shader generation process. + * For example in can compose/join two single floats into a `vec2` type. + * + * @augments TempNode + */ +declare class JoinNode extends TempNode { + /** + * Constructs a new join node. + * + * @param {Array} nodes - An array of nodes that should be joined. + * @param {?string} [nodeType=null] - The node type. + */ + constructor(nodes?: Array, nodeType?: string | null); + /** + * An array of nodes that should be joined. + * + * @type {Array} + */ + nodes: Array; + /** + * This method is overwritten since the node type must be inferred from the + * joined data length if not explicitly defined. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any, output: any): any; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts new file mode 100644 index 000000000..cf5080cae --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts @@ -0,0 +1,68 @@ +export default LoopNode; +export function Loop(...params: any[]): LoopNode; +export function Continue(): ExpressionNode; +export function Break(): ExpressionNode; +/** + * This module offers a variety of ways to implement loops in TSL. In it's basic form it's: + * ```js + * Loop( count, ( { i } ) => { + * + * } ); + * ``` + * However, it is also possible to define a start and end ranges, data types and loop conditions: + * ```js + * Loop( { start: int( 0 ), end: int( 10 ), type: 'int', condition: '<' }, ( { i } ) => { + * + * } ); + *``` + * Nested loops can be defined in a compacted form: + * ```js + * Loop( 10, 5, ( { i, j } ) => { + * + * } ); + * ``` + * Loops that should run backwards can be defined like so: + * ```js + * Loop( { start: 10 }, () => {} ); + * ``` + * It is possible to execute with boolean values, similar to the `while` syntax. + * ```js + * const value = float( 0 ).toVar(); + * + * Loop( value.lessThan( 10 ), () => { + * + * value.addAssign( 1 ); + * + * } ); + * ``` + * The module also provides `Break()` and `Continue()` TSL expression for loop control. + * @augments Node + */ +declare class LoopNode extends Node { + /** + * Constructs a new loop node. + * + * @param {Array} params - Depending on the loop type, array holds different parameterization values for the loop. + */ + constructor(params?: Array); + params: any[]; + /** + * Returns a loop variable name based on an index. The pattern is + * `0` = `i`, `1`= `j`, `2`= `k` and so on. + * + * @param {number} index - The index. + * @return {string} The loop variable name. + */ + getVarName(index: number): string; + /** + * Returns properties about this node. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {Object} The node properties. + */ + getProperties(builder: NodeBuilder): Object; + _getInternalParams(): any[]; + setup(builder: any): void; + generate(builder: any): void; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts new file mode 100644 index 000000000..11ccf7d5a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts @@ -0,0 +1,11 @@ +/** + * TSL function for creating a matcap uv node. + * + * Can be used to compute texture coordinates for projecting a + * matcap onto a mesh. Used by {@link MeshMatcapNodeMaterial}. + * + * @tsl + * @function + * @returns {Node} The matcap UV coordinates. + */ +export const matcapUV: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts new file mode 100644 index 000000000..a54346cc2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts @@ -0,0 +1,51 @@ +export default MaxMipLevelNode; +/** + * TSL function for creating a max mip level node. + * + * @tsl + * @function + * @param {TextureNode} textureNode - The texture node to compute the max mip level for. + * @returns {MaxMipLevelNode} + */ +export const maxMipLevel: any; +/** + * A special type of uniform node that computes the + * maximum mipmap level for a given texture node. + * + * ```js + * const level = maxMipLevel( textureNode ); + * ``` + * + * @augments UniformNode + */ +declare class MaxMipLevelNode extends UniformNode { + /** + * Constructs a new max mip level node. + * + * @param {TextureNode} textureNode - The texture node to compute the max mip level for. + */ + constructor(textureNode: TextureNode); + /** + * The texture node to compute the max mip level for. + * + * @private + * @type {TextureNode} + */ + private _textureNode; + /** + * The texture node to compute the max mip level for. + * + * @readonly + * @type {TextureNode} + */ + readonly get textureNode(): TextureNode; + /** + * The texture. + * + * @readonly + * @type {Texture} + */ + readonly get texture(): Texture; + update(): void; +} +import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts new file mode 100644 index 000000000..45fabbe06 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts @@ -0,0 +1,41 @@ +export default MemberNode; +/** + * Base class for representing member access on an object-like + * node data structures. + * + * @augments Node + */ +declare class MemberNode extends Node { + /** + * Constructs a member node. + * + * @param {Node} structNode - The struct node. + * @param {string} property - The property name. + */ + constructor(structNode: Node, property: string); + /** + * The struct node. + * + * @type {Node} + */ + structNode: Node; + /** + * The property name. + * + * @type {Node} + */ + property: Node; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMemberNode: boolean; + hasMember(builder: any): boolean; + generateNodeType(builder: any): string; + getMemberType(builder: any, name: any): any; + generate(builder: any): any; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts new file mode 100644 index 000000000..08bd81824 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts @@ -0,0 +1,4 @@ +export function oscSine(t?: Node): Node; +export function oscSquare(t?: Node): Node; +export function oscTriangle(t?: Node): Node; +export function oscSawtooth(t?: Node): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts new file mode 100644 index 000000000..35dbe54c6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts @@ -0,0 +1,5 @@ +export function packNormalToRGB(node: Node): Node; +export function unpackRGBToNormal(node: Node): Node; +export function unpackNormal(xy: Node): Node; +export function directionToColor(node: Node): Node; +export function colorToDirection(node: Node): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts new file mode 100644 index 000000000..2a6b7133e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts @@ -0,0 +1,75 @@ +/** + * Computes a position in view space based on a fragment's screen position expressed as uv coordinates, the fragments + * depth value and the camera's inverse projection matrix. + * + * @tsl + * @function + * @param {Node} screenPosition - The fragment's screen position expressed as uv coordinates. + * @param {Node} depth - The fragment's depth value. + * @param {Node} projectionMatrixInverse - The camera's inverse projection matrix. + * @return {Node} The fragments position in view space. + */ +export const getViewPosition: () => void; +/** + * Computes a screen position expressed as uv coordinates based on a fragment's position in view space + * and the camera's projection matrix + * + * @tsl + * @function + * @param {Node} viewPosition - The fragments position in view space. + * @param {Node} projectionMatrix - The camera's projection matrix. + * @return {Node} The fragment's screen position expressed as uv coordinates. + */ +export const getScreenPosition: () => void; +/** + * Converts a clip-space position into a screen position expressed as uv coordinates. + * + * @tsl + * @function + * @param {Node} clipPosition - The position in clip space. + * @return {Node} The screen position expressed as uv coordinates. + */ +export const getScreenPositionFromClip: any; +/** + * Computes a normal vector based on depth data. Can be used as a fallback when no normal render + * target is available or if flat surface normals are required. + * + * @tsl + * @function + * @param {Node} uv - The texture coordinate. + * @param {DepthTexture} depthTexture - The depth texture. + * @param {Node} projectionMatrixInverse - The camera's inverse projection matrix. + * @return {Node} The computed normal vector. + */ +export const getNormalFromDepth: () => void; +/** + * Interleaved Gradient Noise (IGN) from Jimenez 2014. + * + * IGN has "low discrepancy" resulting in evenly distributed samples. It's superior compared to + * default white noise, blue noise or Bayer. + * + * References: + * - {@link https://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare/} + * - {@link https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/} + * + * @tsl + * @function + * @param {Node} position - The input position, usually screen coordinates. + * @return {Node} The noise value. + */ +export const interleavedGradientNoise: any; +/** + * Vogel disk sampling for uniform circular distribution. + * + * This function generates sample points distributed uniformly on a disk using the golden angle, + * resulting in an efficient low-discrepancy sequence for sampling. The rotation parameter (phi) + * allows randomizing the pattern per-pixel when combined with IGN. + * + * @tsl + * @function + * @param {Node} sampleIndex - The index of the current sample (0-based). + * @param {Node} samplesCount - The total number of samples. + * @param {Node} phi - Rotation angle in radians (typically from IGN * 2π). + * @return {Node} A 2D point on the unit disk. + */ +export const vogelDiskSample: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts new file mode 100644 index 000000000..455e11adb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts @@ -0,0 +1,128 @@ +export default RTTNode; +export function rtt(node: Node, ...params: any[]): RTTNode; +export function convertToTexture(node: Node, ...params: any[]): RTTNode; +/** + * `RTTNode` takes another node and uses it with a `QuadMesh` to render into a texture (RTT). + * This module is especially relevant in context of post processing where certain nodes require + * texture input for their effects. With the helper function `convertToTexture()` which is based + * on this module, the node system can automatically ensure texture input if required. + * + * @augments TextureNode + */ +declare class RTTNode extends TextureNode { + /** + * Constructs a new RTT node. + * + * @param {Node} node - The node to render a texture with. + * @param {?number} [width=null] - The width of the internal render target. If not width is applied, the render target is automatically resized. + * @param {?number} [height=null] - The height of the internal render target. + * @param {Object} [options={}] - The options for the internal render target. + * @param {number} [options.type=HalfFloatType] - The texture type. + * @param {boolean} [options.autoUpdate=true] - Whether the texture should automatically be updated or not. + * @param {number} [options.resolutionScale=1] - The resolution scale. + */ + constructor(node: Node, width?: number | null, height?: number | null, options?: { + type?: number | undefined; + autoUpdate?: boolean | undefined; + resolutionScale?: number | undefined; + }); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRTTNode: boolean; + /** + * The node to render a texture with. + * + * @type {Node} + */ + node: Node; + /** + * The width of the internal render target. + * If not width is applied, the render target is automatically resized. + * + * @type {?number} + * @default null + */ + width: number | null; + /** + * The height of the internal render target. + * + * @type {?number} + * @default null + */ + height: number | null; + /** + * The render target + * + * @type {RenderTarget} + */ + renderTarget: RenderTarget; + /** + * Whether the texture requires an update or not. + * + * @type {boolean} + * @default true + */ + textureNeedsUpdate: boolean; + /** + * Whether the texture should automatically be updated or not. + * + * @type {boolean} + * @default true + */ + autoUpdate: boolean; + /** + * The resolution scale + * + * @private + * @type {number} + * @default 1 + */ + private _resolutionScale; + /** + * The internal quad mesh for RTT. + * + * @private + * @type {QuadMesh} + */ + private _quadMesh; + /** + * Whether the internal render target should automatically be resized or not. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly get autoResize(): boolean; + setup(builder: any): void; + /** + * Sets the size of the internal render target + * + * @param {number} width - The width to set. + * @param {number} height - The width to set. + */ + setSize(width: number, height: number): void; + /** + * Sets the resolution scale. + * The resolution scale is a factor that is multiplied with the renderer's width and height. + * + * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. + * @returns {RTTNode} A reference to this node. + */ + setResolutionScale(resolutionScale: number): RTTNode; + /** + * Gets the resolution scale. + * + * @returns {number} The resolution scale. + */ + getResolutionScale(): number; + updateBefore({ renderer }: { + renderer: any; + }): void; +} +import TextureNode from '../accessors/TextureNode.js'; +import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts new file mode 100644 index 000000000..cbe1f5605 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts @@ -0,0 +1,237 @@ +export function reflector(parameters?: { + target?: Object3D | undefined; + resolution?: number | undefined; + generateMipmaps?: boolean | undefined; + bounces?: boolean | undefined; + depth?: boolean | undefined; + samples?: number | undefined; + defaultTexture?: TextureNode | undefined; + reflector?: ReflectorBaseNode | undefined; +}): ReflectorNode; +export default ReflectorNode; +import { Object3D } from '../../core/Object3D.js'; +import TextureNode from '../accessors/TextureNode.js'; +/** + * Holds the actual implementation of the reflector (virtual cameras, render + * targets and the reflection rendering). + * + * This logic is kept separate from {@link ReflectorNode} because the latter is + * a {@link TextureNode} representing a single texture view. A reflector can be + * sampled by multiple texture nodes at once - e.g. one for color and one for + * depth (see {@link ReflectorNode#getDepthNode}) - which all reference the same + * base node so the reflection is rendered only once. + * + * @private + * @augments Node + */ +declare class ReflectorBaseNode extends Node { + /** + * Constructs a new reflector base node. + * + * @param {TextureNode} textureNode - Represents the rendered reflections as a texture node. + * @param {Object} [parameters={}] - An object holding configuration parameters. + * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. + * @param {number} [parameters.resolutionScale=1] - The resolution scale. + * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. + * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. + * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. + * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. + */ + constructor(textureNode: TextureNode, parameters?: { + target?: Object3D | undefined; + resolutionScale?: number | undefined; + generateMipmaps?: boolean | undefined; + bounces?: boolean | undefined; + depth?: boolean | undefined; + samples?: number | undefined; + }); + /** + * Represents the rendered reflections as a texture node. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * The 3D object the reflector is linked to. + * + * @type {Object3D} + * @default {new Object3D()} + */ + target: Object3D; + /** + * The resolution scale. + * + * @type {number} + * @default {1} + */ + resolutionScale: number; + /** + * Whether mipmaps should be generated or not. + * + * @type {boolean} + * @default {false} + */ + generateMipmaps: boolean; + /** + * Whether reflectors can render other reflector nodes or not. + * + * @type {boolean} + * @default {true} + */ + bounces: boolean; + /** + * Whether depth data should be generated or not. + * + * @type {boolean} + * @default {false} + */ + depth: boolean; + /** + * The number of anti-aliasing samples for the render-target + * + * @type {number} + * @default {0} + */ + samples: number; + /** + * Weak map for managing virtual cameras. + * + * @type {WeakMap} + */ + virtualCameras: WeakMap; + /** + * Weak map for managing render targets. + * + * @type {Map} + */ + renderTargets: Map; + /** + * Force render even if reflector is facing away from camera. + * + * @type {boolean} + * @default {false} + */ + forceUpdate: boolean; + /** + * Whether the reflector has been rendered or not. + * + * When the reflector is facing away from the camera, + * this flag is set to `false` and the texture will be empty(black). + * + * @type {boolean} + * @default {false} + */ + hasOutput: boolean; + /** + * Updates the resolution of the internal render target. + * + * @private + * @param {RenderTarget} renderTarget - The render target to resize. + * @param {Renderer} renderer - The renderer that is used to determine the new size. + */ + private _updateResolution; + setup(builder: any): Node | null; + /** + * Returns a virtual camera for the given camera. The virtual camera is used to + * render the scene from the reflector's view so correct reflections can be produced. + * + * @param {Camera} camera - The scene's camera. + * @return {Camera} The corresponding virtual camera. + */ + getVirtualCamera(camera: Camera): Camera; + /** + * Returns a render target for the given camera. The reflections are rendered + * into this render target. + * + * @param {Camera} camera - The scene's camera. + * @return {RenderTarget} The render target. + */ + getRenderTarget(camera: Camera): RenderTarget; + updateBefore(frame: any): false | undefined; + set resolution(value: number); + /** + * The resolution scale. + * + * @deprecated + * @type {number} + * @default {1} + */ + get resolution(): number; +} +/** + * This node can be used to implement mirror-like flat reflective surfaces. + * + * ```js + * const groundReflector = reflector(); + * material.colorNode = groundReflector; + * + * const plane = new Mesh( geometry, material ); + * plane.add( groundReflector.target ); + * ``` + * + * @augments TextureNode + */ +declare class ReflectorNode extends TextureNode { + /** + * Constructs a new reflector node. + * + * @param {Object} [parameters={}] - An object holding configuration parameters. + * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. + * @param {number} [parameters.resolutionScale=1] - The resolution scale. + * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. + * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. + * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. + * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. + * @param {TextureNode} [parameters.defaultTexture] - The default texture node. + * @param {ReflectorBaseNode} [parameters.reflector] - The reflector base node. + */ + constructor(parameters?: { + target?: Object3D | undefined; + resolutionScale?: number | undefined; + generateMipmaps?: boolean | undefined; + bounces?: boolean | undefined; + depth?: boolean | undefined; + samples?: number | undefined; + defaultTexture?: TextureNode | undefined; + reflector?: ReflectorBaseNode | undefined; + }); + /** + * A reference to the internal reflector base node which holds the actual implementation. + * + * @private + * @type {ReflectorBaseNode} + * @default ReflectorBaseNode + */ + private _reflectorBaseNode; + /** + * A reference to the internal depth node. + * + * @private + * @type {?Node} + * @default null + */ + private _depthNode; + /** + * A reference to the internal reflector node. + * + * @type {ReflectorBaseNode} + */ + get reflector(): ReflectorBaseNode; + /** + * A reference to 3D object the reflector is linked to. + * + * @type {Object3D} + */ + get target(): Object3D; + /** + * Returns a node representing the mirror's depth. That can be used + * to implement more advanced reflection effects like distance attenuation. + * + * @return {Node} The depth node. + */ + getDepthNode(): Node; + setup(builder: any): void; + clone(): any; +} +import Node from '../core/Node.js'; +import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts new file mode 100644 index 000000000..b6aacd043 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts @@ -0,0 +1,30 @@ +/** + * This node allows to remap a node value from one range into another but with enabled clamping. E.g a value of + * `0.4` in the range `[ 0.3, 0.5 ]` should be remapped into the normalized range `[ 0, 1 ]`. + * `remapClamp` takes care of that and converts the original value of `0.4` to `0.5`. + * + * @tsl + * @function + * @param {Node} node - The node that should be remapped. + * @param {Node} inLowNode - The source or current lower bound of the range. + * @param {Node} inHighNode - The source or current upper bound of the range. + * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. + * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. + * @returns {Node} + */ +export function remapClamp(node: Node, inLowNode: Node, inHighNode: Node, outLowNode?: Node | null, outHighNode?: Node | null): Node; +/** + * This node allows to remap a node value from one range into another. E.g a value of + * `0.4` in the range `[ 0.3, 0.5 ]` should be remapped into the normalized range `[ 0, 1 ]`. + * `remap` takes care of that and converts the original value of `0.4` to `0.5`. + * + * @tsl + * @function + * @param {Node} node - The node that should be remapped. + * @param {Node} inLowNode - The source or current lower bound of the range. + * @param {Node} inHighNode - The source or current upper bound of the range. + * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. + * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. + * @returns {Node} + */ +export const remap: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts new file mode 100644 index 000000000..ed6dfe36b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts @@ -0,0 +1,49 @@ +export default RotateNode; +/** + * TSL function for creating a rotate node. + * + * @tsl + * @function + * @param {Node} positionNode - The position node. + * @param {Node} rotationNode - Represents the rotation that is applied to the position node. Depending + * on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + * @returns {RotateNode} + */ +export const rotate: any; +/** + * Applies a rotation to the given position node. + * + * @augments TempNode + */ +declare class RotateNode extends TempNode { + /** + * Constructs a new rotate node. + * + * @param {Node} positionNode - The position node. + * @param {Node} rotationNode - Represents the rotation that is applied to the position node. Depending + * on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + */ + constructor(positionNode: Node, rotationNode: Node); + /** + * The position node. + * + * @type {Node} + */ + positionNode: Node; + /** + * Represents the rotation that is applied to the position node. + * Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. + * + * @type {Node} + */ + rotationNode: Node; + /** + * The type of the {@link RotateNode#positionNode} defines the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node's type. + */ + generateNodeType(builder: NodeBuilder): string; + setup(builder: any): any; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts new file mode 100644 index 000000000..6fb9d738c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts @@ -0,0 +1,46 @@ +export default SampleNode; +export function sample(callback: Function, uv?: Node | null): SampleNode; +/** + * Class representing a node that samples a value using a provided callback function. + * + * @extends Node + */ +declare class SampleNode extends Node { + /** + * Creates an instance of SampleNode. + * + * @param {Function} callback - The function to be called when sampling. Should accept a UV node and return a value. + * @param {?Node} [uvNode=null] - The UV node to be used in the texture sampling. + */ + constructor(callback: Function, uvNode?: Node | null); + callback: Function; + /** + * Represents the texture coordinates. + * + * @type {?Node} + * @default null + */ + uvNode: Node | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampleNode: boolean; + /** + * Sets up the node by sampling with the default UV accessor. + * + * @returns {Node} The result of the callback function when called with the UV node. + */ + setup(): Node; + /** + * Calls the callback function with the provided UV node. + * + * @param {Node} uv - The UV node or value to be passed to the callback. + * @returns {Node} The result of the callback function. + */ + sample(uv: Node): Node; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts new file mode 100644 index 000000000..4dcfbd1b9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts @@ -0,0 +1,49 @@ +export default SetNode; +/** + * This module is part of the TSL core and usually not used in app level code. + * `SetNode` represents a set operation which means it is used to implement any + * `setXYZW()`, `setRGBA()` and `setSTPQ()` method invocations on node objects. + * For example: + * ```js + * materialLine.colorNode = color( 0, 0, 0 ).setR( float( 1 ) ); + * ``` + * + * @augments TempNode + */ +declare class SetNode extends TempNode { + /** + * Constructs a new set node. + * + * @param {Node} sourceNode - The node that should be updated. + * @param {string} components - The components that should be updated. + * @param {Node} targetNode - The value node. + */ + constructor(sourceNode: Node, components: string, targetNode: Node); + /** + * The node that should be updated. + * + * @type {Node} + */ + sourceNode: Node; + /** + * The components that should be updated. + * + * @type {string} + */ + components: string; + /** + * The value node. + * + * @type {Node} + */ + targetNode: Node; + /** + * This method is overwritten since the node type is inferred from {@link SetNode#sourceNode}. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any): string; +} +import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts new file mode 100644 index 000000000..9941f1852 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts @@ -0,0 +1,65 @@ +export default SplitNode; +/** + * This module is part of the TSL core and usually not used in app level code. + * `SplitNode` represents a property access operation which means it is + * used to implement any `.xyzw`, `.rgba` and `stpq` usage on node objects. + * For example: + * ```js + * const redValue = color.r; + * ``` + * + * @augments Node + */ +declare class SplitNode extends Node { + /** + * Constructs a new split node. + * + * @param {Node} node - The node that should be accessed. + * @param {string} [components='x'] - The components that should be accessed. + */ + constructor(node: Node, components?: string); + /** + * The node that should be accessed. + * + * @type {Node} + */ + node: Node; + /** + * The components that should be accessed. + * + * @type {string} + */ + components: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSplitNode: boolean; + /** + * Returns the vector length which is computed based on the requested components. + * + * @return {number} The vector length. + */ + getVectorLength(): number; + /** + * Returns the component type of the node's type. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The component type. + */ + getComponentType(builder: NodeBuilder): string; + /** + * This method is overwritten since the node type is inferred from requested components. + * + * @param {NodeBuilder} builder - The current node builder. + * @return {string} The node type. + */ + generateNodeType(builder: NodeBuilder): string; + generate(builder: any, output: any): any; + serialize(data: any): void; + deserialize(data: any): void; +} +import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts new file mode 100644 index 000000000..572dccc2c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts @@ -0,0 +1,17 @@ +/** + * TSL function for computing texture coordinates for animated sprite sheets. + * + * ```js + * const uvNode = spritesheetUV( vec2( 6, 6 ), uv(), time.mul( animationSpeed ) ); + * + * material.colorNode = texture( spriteSheet, uvNode ); + * ``` + * + * @tsl + * @function + * @param {Node} countNode - The node that defines the number of sprites in the x and y direction (e.g 6x6). + * @param {?Node} [uvNode=uv()] - The uv node. + * @param {?Node} [frameNode=float(0)] - The node that defines the current frame/sprite. + * @returns {Node} + */ +export const spritesheetUV: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts new file mode 100644 index 000000000..9c3d7017a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts @@ -0,0 +1,19 @@ +/** + * This can be used to achieve a billboarding behavior for flat meshes. That means they are + * oriented always towards the camera. + * + * ```js + * material.vertexNode = billboarding(); + * ``` + * + * @tsl + * @function + * @param {Object} config - The configuration object. + * @param {?Node} [config.position=null] - Can be used to define the billboard center position directly. + * When null, the center is derived automatically from `positionWorld`. + * @param {boolean} [config.horizontal=true] - Whether to follow the camera rotation horizontally or not. + * @param {boolean} [config.vertical=false] - Whether to follow the camera rotation vertically or not. + * @param {boolean} [config.horizontalRotation=false] - Whether to rotate around the Y axis to face the camera. + * @return {Node} The updated vertex position in clip space. + */ +export const billboarding: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts new file mode 100644 index 000000000..5257eebfd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts @@ -0,0 +1,51 @@ +export default StorageArrayElementNode; +/** + * TSL function for creating a storage element node. + * + * @tsl + * @function + * @param {StorageBufferNode} storageBufferNode - The storage buffer node. + * @param {Node} indexNode - The index node that defines the element access. + * @returns {StorageArrayElementNode} + */ +export const storageElement: any; +/** + * This class enables element access on instances of {@link StorageBufferNode}. + * In most cases, it is indirectly used when accessing elements with the + * {@link StorageBufferNode#element} method. + * + * ```js + * const position = positionStorage.element( instanceIndex ); + * ``` + * + * @augments ArrayElementNode + */ +declare class StorageArrayElementNode extends ArrayElementNode { + /** + * Constructs storage buffer element node. + * + * @param {StorageBufferNode} storageBufferNode - The storage buffer node. + * @param {Node} indexNode - The index node that defines the element access. + */ + constructor(storageBufferNode: StorageBufferNode, indexNode: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageArrayElementNode: boolean; + /** + * The storage buffer node. + * + * @param {Node} value + * @type {StorageBufferNode} + */ + set storageBufferNode(value: Node); + get storageBufferNode(): Node; + getMemberType(builder: any, name: any): any; + setup(builder: any): import("../Nodes.js").Node | null; + generate(builder: any, output: any): any; +} +import ArrayElementNode from './ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts new file mode 100644 index 000000000..9131612ca --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts @@ -0,0 +1,21 @@ +/** + * Represents the elapsed time in seconds. + * + * @tsl + * @type {UniformNode} + */ +export const time: UniformNode; +/** + * Represents the delta time in seconds. + * + * @tsl + * @type {UniformNode} + */ +export const deltaTime: UniformNode; +/** + * Represents the current frame ID. + * + * @tsl + * @type {UniformNode} + */ +export const frameId: UniformNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts new file mode 100644 index 000000000..df819d30b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts @@ -0,0 +1,21 @@ +/** + * TSL function for creating a triplanar textures node. + * + * Can be used for triplanar texture mapping. + * + * ```js + * material.colorNode = triplanarTexture( texture( diffuseMap ) ); + * ``` + * + * @tsl + * @function + * @param {Node} textureXNode - First texture node. + * @param {?Node} [textureYNode=null] - Second texture node. When not set, the shader will sample from `textureXNode` instead. + * @param {?Node} [textureZNode=null] - Third texture node. When not set, the shader will sample from `textureXNode` instead. + * @param {?Node} [scaleNode=float(1)] - The scale node. + * @param {?Node} [positionNode=positionLocal] - Vertex positions in local space. + * @param {?Node} [normalNode=normalLocal] - Normals in local space. + * @returns {Node} + */ +export const triplanarTextures: () => void; +export function triplanarTexture(...params: any[]): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts new file mode 100644 index 000000000..fb078e354 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts @@ -0,0 +1,42 @@ +/** + * Replaces the default UV coordinates used in texture lookups. + * + * ```js + *material.contextNode = replaceDefaultUV( ( textureNode ) => { + * + * // ... + * return customUVCoordinates; + * + *} ); + *``` + * + * @tsl + * @function + * @param {function(Node):Node|Node} callback - A callback that receives the texture node + * and must return the new uv coordinates. + * @param {Node} [node=null] - An optional node to which the context will be applied. + * @return {ContextNode} A context node that replaces the default UV coordinates. + */ +export function replaceDefaultUV(callback: (arg0: Node) => Node | Node, node?: Node): ContextNode; +/** + * Rotates the given uv coordinates around a center point + * + * @tsl + * @function + * @param {Node} uv - The uv coordinates. + * @param {Node} rotation - The rotation defined in radians. + * @param {Node} center - The center of rotation + * @return {Node} The rotated uv coordinates. + */ +export const rotateUV: () => void; +/** + * Applies a spherical warping effect to the given uv coordinates. + * + * @tsl + * @function + * @param {Node} uv - The uv coordinates. + * @param {Node} strength - The strength of the effect. + * @param {Node} center - The center point + * @return {Node} The updated uv coordinates. + */ +export const spherizeUV: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts new file mode 100644 index 000000000..8622c377b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts @@ -0,0 +1,13 @@ +/** + * A special version of a screen uv function that involves a depth comparison + * when computing the final uvs. The function mitigates visual errors when + * using viewport texture nodes for refraction purposes. Without this function + * objects in front of a refractive surface might appear on the refractive surface + * which is incorrect. + * + * @tsl + * @function + * @param {?Node} uv - Optional uv coordinates. By default `screenUV` is used. + * @return {Node} The update uv coordinates. + */ +export const viewportSafeUV: () => void; diff --git a/jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts b/jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts new file mode 100644 index 000000000..54ed9a5d8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts @@ -0,0 +1,362 @@ +/** + * A special version of a mesh with multi draw batch rendering support. Use + * this class if you have to render a large number of objects with the same + * material but with different geometries or world transformations. The usage of + * `BatchedMesh` will help you to reduce the number of draw calls and thus improve the overall + * rendering performance in your application. + * + * ```js + * const box = new THREE.BoxGeometry( 1, 1, 1 ); + * const sphere = new THREE.SphereGeometry( 1, 12, 12 ); + * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); + * + * // initialize and add geometries into the batched mesh + * const batchedMesh = new BatchedMesh( 10, 5000, 10000, material ); + * const boxGeometryId = batchedMesh.addGeometry( box ); + * const sphereGeometryId = batchedMesh.addGeometry( sphere ); + * + * // create instances of those geometries + * const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId ); + * const boxInstancedId2 = batchedMesh.addInstance( boxGeometryId ); + * + * const sphereInstancedId1 = batchedMesh.addInstance( sphereGeometryId ); + * const sphereInstancedId2 = batchedMesh.addInstance( sphereGeometryId ); + * + * // position the geometries + * batchedMesh.setMatrixAt( boxInstancedId1, boxMatrix1 ); + * batchedMesh.setMatrixAt( boxInstancedId2, boxMatrix2 ); + * + * batchedMesh.setMatrixAt( sphereInstancedId1, sphereMatrix1 ); + * batchedMesh.setMatrixAt( sphereInstancedId2, sphereMatrix2 ); + * + * scene.add( batchedMesh ); + * ``` + * + * @augments Mesh + */ +export class BatchedMesh extends Mesh { + /** + * Constructs a new batched mesh. + * + * @param {number} maxInstanceCount - The maximum number of individual instances planned to be added and rendered. + * @param {number} maxVertexCount - The maximum number of vertices to be used by all unique geometries. + * @param {number} [maxIndexCount=maxVertexCount*2] - The maximum number of indices to be used by all unique geometries + * @param {Material|Array} [material] - The mesh material. + */ + constructor(maxInstanceCount: number, maxVertexCount: number, maxIndexCount?: number, material?: Material | Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBatchedMesh: boolean; + /** + * When set ot `true`, the individual objects of a batch are frustum culled. + * + * @type {boolean} + * @default true + */ + perObjectFrustumCulled: boolean; + /** + * When set to `true`, the individual objects of a batch are sorted to improve overdraw-related artifacts. + * If the material is marked as "transparent" objects are rendered back to front and if not then they are + * rendered front to back. + * + * @type {boolean} + * @default true + */ + sortObjects: boolean; + /** + * The bounding box of the batched mesh. Can be computed via {@link BatchedMesh#computeBoundingBox}. + * + * @type {?Box3} + * @default null + */ + boundingBox: Box3 | null; + /** + * The bounding sphere of the batched mesh. Can be computed via {@link BatchedMesh#computeBoundingSphere}. + * + * @type {?Sphere} + * @default null + */ + boundingSphere: Sphere | null; + /** + * Takes a sort a function that is run before render. The function takes a list of instances to + * sort and a camera. The objects in the list include a "z" field to perform a depth-ordered + * sort with. + * + * @type {?Function} + * @default null + */ + customSort: Function | null; + _instanceInfo: any[]; + _geometryInfo: any[]; + _availableInstanceIds: any[]; + _availableGeometryIds: any[]; + _nextIndexStart: number; + _nextVertexStart: number; + _geometryCount: number; + _visibilityChanged: boolean; + _geometryInitialized: boolean; + _maxInstanceCount: number; + _maxVertexCount: number; + _maxIndexCount: number; + _multiDrawCounts: Int32Array; + _multiDrawStarts: Int32Array; + _multiDrawCount: number; + _multiDrawBytesPerElement: number; + _matricesTexture: any; + _indirectTexture: any; + _colorsTexture: any; + /** + * The maximum number of individual instances that can be stored in the batch. + * + * @type {number} + * @readonly + */ + readonly get maxInstanceCount(): number; + /** + * The instance count. + * + * @type {number} + * @readonly + */ + readonly get instanceCount(): number; + /** + * The number of unused vertices. + * + * @type {number} + * @readonly + */ + readonly get unusedVertexCount(): number; + /** + * The number of unused indices. + * + * @type {number} + * @readonly + */ + readonly get unusedIndexCount(): number; + _initMatricesTexture(): void; + _initIndirectTexture(): void; + _initColorsTexture(): void; + _initializeGeometry(reference: any): void; + _validateGeometry(geometry: any): void; + /** + * Validates the instance defined by the given ID. + * + * @param {number} instanceId - The instance to validate. + */ + validateInstanceId(instanceId: number): void; + /** + * Validates the geometry defined by the given ID. + * + * @param {number} geometryId - The geometry to validate. + */ + validateGeometryId(geometryId: number): void; + /** + * Takes a sort a function that is run before render. The function takes a list of instances to + * sort and a camera. The objects in the list include a "z" field to perform a depth-ordered sort with. + * + * @param {Function} func - The custom sort function. + * @return {BatchedMesh} A reference to this batched mesh. + */ + setCustomSort(func: Function): BatchedMesh; + /** + * Computes the bounding box, updating {@link BatchedMesh#boundingBox}. + * Bounding boxes aren't computed by default. They need to be explicitly computed, + * otherwise they are `null`. + */ + computeBoundingBox(): void; + /** + * Computes the bounding sphere, updating {@link BatchedMesh#boundingSphere}. + * Bounding spheres aren't computed by default. They need to be explicitly computed, + * otherwise they are `null`. + */ + computeBoundingSphere(): void; + /** + * Adds a new instance to the batch using the geometry of the given ID and returns + * a new id referring to the new instance to be used by other functions. + * + * @param {number} geometryId - The ID of a previously added geometry via {@link BatchedMesh#addGeometry}. + * @return {number} The instance ID. + */ + addInstance(geometryId: number): number; + /** + * Adds the given geometry to the batch and returns the associated + * geometry id referring to it to be used in other functions. + * + * @param {BufferGeometry} geometry - The geometry to add. + * @param {number} [reservedVertexCount=-1] - Optional parameter specifying the amount of + * vertex buffer space to reserve for the added geometry. This is necessary if it is planned + * to set a new geometry at this index at a later time that is larger than the original geometry. + * Defaults to the length of the given geometry vertex buffer. + * @param {number} [reservedIndexCount=-1] - Optional parameter specifying the amount of index + * buffer space to reserve for the added geometry. This is necessary if it is planned to set a + * new geometry at this index at a later time that is larger than the original geometry. Defaults to + * the length of the given geometry index buffer. + * @return {number} The geometry ID. + */ + addGeometry(geometry: BufferGeometry, reservedVertexCount?: number, reservedIndexCount?: number): number; + /** + * Replaces the geometry at the given ID with the provided geometry. Throws an error if there + * is not enough space reserved for geometry. Calling this will change all instances that are + * rendering that geometry. + * + * @param {number} geometryId - The ID of the geometry that should be replaced with the given geometry. + * @param {BufferGeometry} geometry - The new geometry. + * @return {number} The geometry ID. + */ + setGeometryAt(geometryId: number, geometry: BufferGeometry): number; + /** + * Deletes the geometry defined by the given ID from this batch. Any instances referencing + * this geometry will also be removed as a side effect. + * + * @param {number} geometryId - The ID of the geometry to remove from the batch. + * @return {BatchedMesh} A reference to this batched mesh. + */ + deleteGeometry(geometryId: number): BatchedMesh; + /** + * Deletes an existing instance from the batch using the given ID. + * + * @param {number} instanceId - The ID of the instance to remove from the batch. + * @return {BatchedMesh} A reference to this batched mesh. + */ + deleteInstance(instanceId: number): BatchedMesh; + /** + * Repacks the sub geometries in BatchedMesh to remove any unused space remaining from + * previously deleted geometry, freeing up space to add new geometry. + * + * @return {BatchedMesh} A reference to this batched mesh. + */ + optimize(): BatchedMesh; + /** + * Returns the bounding box for the given geometry. + * + * @param {number} geometryId - The ID of the geometry to return the bounding box for. + * @param {Box3} target - The target object that is used to store the method's result. + * @return {?Box3} The geometry's bounding box. Returns `null` if no geometry has been found for the given ID. + */ + getBoundingBoxAt(geometryId: number, target: Box3): Box3 | null; + /** + * Returns the bounding sphere for the given geometry. + * + * @param {number} geometryId - The ID of the geometry to return the bounding sphere for. + * @param {Sphere} target - The target object that is used to store the method's result. + * @return {?Sphere} The geometry's bounding sphere. Returns `null` if no geometry has been found for the given ID. + */ + getBoundingSphereAt(geometryId: number, target: Sphere): Sphere | null; + /** + * Sets the given local transformation matrix to the defined instance. + * Negatively scaled matrices are not supported. + * + * @param {number} instanceId - The ID of an instance to set the matrix of. + * @param {Matrix4} matrix - A 4x4 matrix representing the local transformation of a single instance. + * @return {BatchedMesh} A reference to this batched mesh. + */ + setMatrixAt(instanceId: number, matrix: Matrix4): BatchedMesh; + /** + * Returns the local transformation matrix of the defined instance. + * + * @param {number} instanceId - The ID of an instance to get the matrix of. + * @param {Matrix4} matrix - The target object that is used to store the method's result. + * @return {Matrix4} The instance's local transformation matrix. + */ + getMatrixAt(instanceId: number, matrix: Matrix4): Matrix4; + /** + * Sets the given color to the defined instance. + * + * @param {number} instanceId - The ID of an instance to set the color of. + * @param {Color|Vector4} color - The color to set the instance to. Use a `Vector4` to also define alpha. + * @return {BatchedMesh} A reference to this batched mesh. + */ + setColorAt(instanceId: number, color: Color | Vector4): BatchedMesh; + /** + * Returns the color of the defined instance. + * + * @param {number} instanceId - The ID of an instance to get the color of. + * @param {Color|Vector4} color - The target object that is used to store the method's result. + * @return {Color|Vector4} The instance's color. Use a `Vector4` to also retrieve alpha. + */ + getColorAt(instanceId: number, color: Color | Vector4): Color | Vector4; + /** + * Sets the visibility of the instance. + * + * @param {number} instanceId - The id of the instance to set the visibility of. + * @param {boolean} visible - Whether the instance is visible or not. + * @return {BatchedMesh} A reference to this batched mesh. + */ + setVisibleAt(instanceId: number, visible: boolean): BatchedMesh; + /** + * Returns the visibility state of the defined instance. + * + * @param {number} instanceId - The ID of an instance to get the visibility state of. + * @return {boolean} Whether the instance is visible or not. + */ + getVisibleAt(instanceId: number): boolean; + /** + * Sets the geometry ID of the instance at the given index. + * + * @param {number} instanceId - The ID of the instance to set the geometry ID of. + * @param {number} geometryId - The geometry ID to be use by the instance. + * @return {BatchedMesh} A reference to this batched mesh. + */ + setGeometryIdAt(instanceId: number, geometryId: number): BatchedMesh; + /** + * Returns the geometry ID of the defined instance. + * + * @param {number} instanceId - The ID of an instance to get the geometry ID of. + * @return {number} The instance's geometry ID. + */ + getGeometryIdAt(instanceId: number): number; + /** + * Get the range representing the subset of triangles related to the attached geometry, + * indicating the starting offset and count, or `null` if invalid. + * + * @param {number} geometryId - The id of the geometry to get the range of. + * @param {Object} [target] - The target object that is used to store the method's result. + * @return {{ + * vertexStart:number,vertexCount:number,reservedVertexCount:number, + * indexStart:number,indexCount:number,reservedIndexCount:number, + * start:number,count:number + * }} The result object with range data. + */ + getGeometryRangeAt(geometryId: number, target?: Object): { + vertexStart: number; + vertexCount: number; + reservedVertexCount: number; + indexStart: number; + indexCount: number; + reservedIndexCount: number; + start: number; + count: number; + }; + /** + * Resizes the necessary buffers to support the provided number of instances. + * If the provided arguments shrink the number of instances but there are not enough + * unused Ids at the end of the list then an error is thrown. + * + * @param {number} maxInstanceCount - The max number of individual instances that can be added and rendered by the batch. + */ + setInstanceCount(maxInstanceCount: number): void; + /** + * Resizes the available space in the batch's vertex and index buffer attributes to the provided sizes. + * If the provided arguments shrink the geometry buffers but there is not enough unused space at the + * end of the geometry attributes then an error is thrown. + * + * @param {number} maxVertexCount - The maximum number of vertices to be used by all unique geometries to resize to. + * @param {number} maxIndexCount - The maximum number of indices to be used by all unique geometries to resize to. + */ + setGeometrySize(maxVertexCount: number, maxIndexCount: number): void; + raycast(raycaster: any, intersects: any): void; + copy(source: any): this; + onBeforeRender(renderer: any, scene: any, camera: any, geometry: any, material: any): void; + onBeforeShadow(renderer: any, object: any, camera: any, shadowCamera: any, geometry: any, depthMaterial: any): void; +} +import { Mesh } from './Mesh.js'; +import { Box3 } from '../math/Box3.js'; +import { Sphere } from '../math/Sphere.js'; +import { BufferGeometry } from '../core/BufferGeometry.js'; +import { Matrix4 } from '../math/Matrix4.js'; +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Bone.d.ts b/jsdoc-testing/jsdoc/src/objects/Bone.d.ts new file mode 100644 index 000000000..5d0be09bc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/Bone.d.ts @@ -0,0 +1,26 @@ +/** + * A bone which is part of a {@link Skeleton}. The skeleton in turn is used by + * the {@link SkinnedMesh}. + * + * ```js + * const root = new THREE.Bone(); + * const child = new THREE.Bone(); + * + * root.add( child ); + * child.position.y = 5; + * ``` + * + * @augments Object3D + */ +export class Bone extends Object3D { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBone: boolean; + type: string; +} +import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts b/jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts new file mode 100644 index 000000000..6183e90a1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts @@ -0,0 +1,50 @@ +/** + * In earlier three.js versions, clipping was defined globally + * on the renderer or on material level. This special version of + * `THREE.Group` allows to encode the clipping state into the scene + * graph. Meaning if you create an instance of this group, all + * descendant 3D objects will be affected by the respective clipping + * planes. + * + * Note: `ClippingGroup` can only be used with `WebGPURenderer`. + * + * @augments Group + */ +export class ClippingGroup extends Group { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isClippingGroup: boolean; + /** + * An array with clipping planes. + * + * @type {Array} + */ + clippingPlanes: Array; + /** + * Whether clipping should be enabled or not. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * Whether the intersection of the clipping planes is used to clip objects, rather than their union. + * + * @type {boolean} + * @default false + */ + clipIntersection: boolean; + /** + * Whether shadows should be clipped or not. + * + * @type {boolean} + * @default false + */ + clipShadows: boolean; +} +import { Group } from './Group.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Group.d.ts b/jsdoc-testing/jsdoc/src/objects/Group.d.ts new file mode 100644 index 000000000..4def40910 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/Group.d.ts @@ -0,0 +1,29 @@ +/** + * This is almost identical to an {@link Object3D}. Its purpose is to + * make working with groups of objects syntactically clearer. + * + * ```js + * // Create a group and add the two cubes. + * // These cubes can now be rotated / scaled etc as a group. + * const group = new THREE.Group(); + * + * group.add( meshA ); + * group.add( meshB ); + * + * scene.add( group ); + * ``` + * + * @augments Object3D + */ +export class Group extends Object3D { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isGroup: boolean; + type: string; +} +import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts b/jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts new file mode 100644 index 000000000..17bb69f8e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts @@ -0,0 +1,138 @@ +/** + * A special version of a mesh with instanced rendering support. Use + * this class if you have to render a large number of objects with the same + * geometry and material(s) but with different world transformations. The usage + * of 'InstancedMesh' will help you to reduce the number of draw calls and thus + * improve the overall rendering performance in your application. + * + * @augments Mesh + */ +export class InstancedMesh extends Mesh { + /** + * Constructs a new instanced mesh. + * + * @param {BufferGeometry} [geometry] - The mesh geometry. + * @param {Material|Array} [material] - The mesh material. + * @param {number} count - The number of instances. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array, count: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isInstancedMesh: boolean; + /** + * Represents the local transformation of all instances. You have to set its + * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data + * via {@link InstancedMesh#setMatrixAt}. + * + * @type {InstancedBufferAttribute} + */ + instanceMatrix: InstancedBufferAttribute; + /** + * Represents the color of all instances. You have to set its + * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data + * via {@link InstancedMesh#setColorAt}. + * + * @type {?InstancedBufferAttribute} + * @default null + */ + instanceColor: InstancedBufferAttribute | null; + /** + * Represents the morph target weights of all instances. You have to set its + * {@link Texture#needsUpdate} flag to true if you modify instanced data + * via {@link InstancedMesh#setMorphAt}. + * + * @type {?DataTexture} + * @default null + */ + morphTexture: DataTexture | null; + /** + * The bounding box of the instanced mesh. Can be computed via {@link InstancedMesh#computeBoundingBox}. + * + * @type {?Box3} + * @default null + */ + boundingBox: Box3 | null; + /** + * The bounding sphere of the instanced mesh. Can be computed via {@link InstancedMesh#computeBoundingSphere}. + * + * @type {?Sphere} + * @default null + */ + boundingSphere: Sphere | null; + /** + * Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}. + * The bounding box is not automatically computed by the engine; this method must be called by your app. + * You may need to recompute the bounding box if an instance is transformed via {@link InstancedMesh#setMatrixAt}. + */ + computeBoundingBox(): void; + /** + * Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere} + * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. + * You may need to recompute the bounding sphere if an instance is transformed via {@link InstancedMesh#setMatrixAt}. + */ + computeBoundingSphere(): void; + copy(source: any, recursive: any): this; + /** + * Gets the color of the defined instance. + * + * @param {number} index - The instance index. + * @param {Color} color - The target object that is used to store the method's result. + * @return {Color} A reference to the target color. + */ + getColorAt(index: number, color: Color): Color; + /** + * Gets the local transformation matrix of the defined instance. + * + * @param {number} index - The instance index. + * @param {Matrix4} matrix - The target object that is used to store the method's result. + * @return {Matrix4} A reference to the target matrix. + */ + getMatrixAt(index: number, matrix: Matrix4): Matrix4; + /** + * Gets the morph target weights of the defined instance. + * + * @param {number} index - The instance index. + * @param {Mesh} object - The target object that is used to store the method's result. + */ + getMorphAt(index: number, object: Mesh): void; + raycast(raycaster: any, intersects: any): void; + /** + * Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of + * {@link InstancedMesh#instanceColor} to `true` after updating all the colors. + * + * @param {number} index - The instance index. + * @param {Color} color - The instance color. + * @return {InstancedMesh} A reference to this instanced mesh. + */ + setColorAt(index: number, color: Color): InstancedMesh; + /** + * Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of + * {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices. + * + * @param {number} index - The instance index. + * @param {Matrix4} matrix - The local transformation. + * @return {InstancedMesh} A reference to this instanced mesh. + */ + setMatrixAt(index: number, matrix: Matrix4): InstancedMesh; + /** + * Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of + * {@link InstancedMesh#morphTexture} to `true` after updating all the influences. + * + * @param {number} index - The instance index. + * @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights + * of a single instance. + * @return {InstancedMesh} A reference to this instanced mesh. + */ + setMorphAt(index: number, object: Mesh): InstancedMesh; +} +import { Mesh } from './Mesh.js'; +import { InstancedBufferAttribute } from '../core/InstancedBufferAttribute.js'; +import { DataTexture } from '../textures/DataTexture.js'; +import { Box3 } from '../math/Box3.js'; +import { Sphere } from '../math/Sphere.js'; +import { Matrix4 } from '../math/Matrix4.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/LOD.d.ts b/jsdoc-testing/jsdoc/src/objects/LOD.d.ts new file mode 100644 index 000000000..d2f7d1004 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/LOD.d.ts @@ -0,0 +1,103 @@ +/** + * A component for providing a basic Level of Detail (LOD) mechanism. + * + * Every LOD level is associated with an object, and rendering can be switched + * between them at the distances specified. Typically you would create, say, + * three meshes, one for far away (low detail), one for mid range (medium + * detail) and one for close up (high detail). + * + * ```js + * const lod = new THREE.LOD(); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * + * //Create spheres with 3 levels of detail and create new LOD levels for them + * for( let i = 0; i < 3; i++ ) { + * + * const geometry = new THREE.IcosahedronGeometry( 10, 3 - i ); + * const mesh = new THREE.Mesh( geometry, material ); + * lod.addLevel( mesh, i * 75 ); + * + * } + * + * scene.add( lod ); + * ``` + * + * @augments Object3D + */ +export class LOD extends Object3D { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLOD: boolean; + /** + * The current LOD index. + * + * @private + * @type {number} + * @default 0 + */ + private _currentLevel; + type: string; + /** + * Whether the LOD object is updated automatically by the renderer per frame + * or not. If set to `false`, you have to call {@link LOD#update} in the + * render loop by yourself. + * + * @type {boolean} + * @default true + */ + autoUpdate: boolean; + copy(source: any): this; + /** + * Adds a mesh that will display at a certain distance and greater. Typically + * the further away the distance, the lower the detail on the mesh. + * + * @param {Object3D} object - The 3D object to display at this level. + * @param {number} [distance=0] - The distance at which to display this level of detail. + * @param {number} [hysteresis=0] - Threshold used to avoid flickering at LOD boundaries, as a fraction of distance. + * @return {LOD} A reference to this instance. + */ + addLevel(object: Object3D, distance?: number, hysteresis?: number): LOD; + /** + * Removes an existing level, based on the distance from the camera. + * Returns `true` when the level has been removed. Otherwise `false`. + * + * @param {number} distance - Distance of the level to remove. + * @return {boolean} Whether the level has been removed or not. + */ + removeLevel(distance: number): boolean; + /** + * Returns the currently active LOD level index. + * + * @return {number} The current active LOD level index. + */ + getCurrentLevel(): number; + /** + * Returns a reference to the first 3D object that is greater than + * the given distance. + * + * @param {number} distance - The LOD distance. + * @return {?Object3D} The found 3D object. `null` if no 3D object has been found. + */ + getObjectForDistance(distance: number): Object3D | null; + /** + * Computes intersection points between a casted ray and this LOD. + * + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - The target array that holds the intersection points. + */ + raycast(raycaster: Raycaster, intersects: Array): void; + /** + * Updates the LOD by computing which LOD level should be visible according + * to the current distance of the given camera. + * + * @param {Camera} camera - The camera the scene is rendered with. + */ + update(camera: Camera): void; + toJSON(meta: any): Object; +} +import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Line.d.ts b/jsdoc-testing/jsdoc/src/objects/Line.d.ts new file mode 100644 index 000000000..4cc9f90cd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/Line.d.ts @@ -0,0 +1,101 @@ +/** + * A continuous line. The line are rendered by connecting consecutive + * vertices with straight lines. + * + * ```js + * const material = new THREE.LineBasicMaterial( { color: 0x0000ff } ); + * + * const points = []; + * points.push( new THREE.Vector3( - 10, 0, 0 ) ); + * points.push( new THREE.Vector3( 0, 10, 0 ) ); + * points.push( new THREE.Vector3( 10, 0, 0 ) ); + * + * const geometry = new THREE.BufferGeometry().setFromPoints( points ); + * + * const line = new THREE.Line( geometry, material ); + * scene.add( line ); + * ``` + * + * @augments Object3D + */ +export class Line extends Object3D { + /** + * Constructs a new line. + * + * @param {BufferGeometry} [geometry] - The line geometry. + * @param {Material|Array} [material] - The line material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLine: boolean; + type: string; + /** + * The line geometry. + * + * @type {BufferGeometry} + */ + geometry: BufferGeometry; + /** + * The line material. + * + * @type {Material|Array} + * @default LineBasicMaterial + */ + material: Material | Array; + /** + * A dictionary representing the morph targets in the geometry. The key is the + * morph targets name, the value its attribute index. This member is `undefined` + * by default and only set when morph targets are detected in the geometry. + * + * @type {Object|undefined} + * @default undefined + */ + morphTargetDictionary: { + [x: string]: number; + } | undefined; + /** + * An array of weights typically in the range `[0,1]` that specify how much of the morph + * is applied. This member is `undefined` by default and only set when morph targets are + * detected in the geometry. + * + * @type {Array|undefined} + * @default undefined + */ + morphTargetInfluences: Array | undefined; + copy(source: any, recursive: any): this; + /** + * Computes an array of distance values which are necessary for rendering dashed lines. + * For each vertex in the geometry, the method calculates the cumulative length from the + * current point to the very beginning of the line. + * + * @return {Line} A reference to this line. + */ + computeLineDistances(): Line; + /** + * Returns `true` if this line intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this line intersects the given frustum or not. + */ + intersectsFrustum(frustum: Frustum | FrustumArray): boolean; + /** + * Computes intersection points between a casted ray and this line. + * + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - The target array that holds the intersection points. + */ + raycast(raycaster: Raycaster, intersects: Array): void; + /** + * Sets the values of {@link Line#morphTargetDictionary} and {@link Line#morphTargetInfluences} + * to make sure existing morph targets can influence this 3D object. + */ + updateMorphTargets(): void; +} +import { Object3D } from '../core/Object3D.js'; +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts b/jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts new file mode 100644 index 000000000..2f08cb084 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts @@ -0,0 +1,25 @@ +/** + * A continuous line. This is nearly the same as {@link Line} the only difference + * is that the last vertex is connected with the first vertex in order to close + * the line to form a loop. + * + * @augments Line + */ +export class LineLoop extends Line { + /** + * Constructs a new line loop. + * + * @param {BufferGeometry} [geometry] - The line geometry. + * @param {Material|Array} [material] - The line material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineLoop: boolean; +} +import { Line } from './Line.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts b/jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts new file mode 100644 index 000000000..88df8f57f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts @@ -0,0 +1,24 @@ +/** + * A series of lines drawn between pairs of vertices. + * + * @augments Line + */ +export class LineSegments extends Line { + /** + * Constructs a new line segments. + * + * @param {BufferGeometry} [geometry] - The line geometry. + * @param {Material|Array} [material] - The line material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isLineSegments: boolean; + computeLineDistances(): this; +} +import { Line } from './Line.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Mesh.d.ts b/jsdoc-testing/jsdoc/src/objects/Mesh.d.ts new file mode 100644 index 000000000..95ec4a1e1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/Mesh.d.ts @@ -0,0 +1,104 @@ +/** + * Class representing triangular polygon mesh based objects. + * + * ```js + * const geometry = new THREE.BoxGeometry( 1, 1, 1 ); + * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); + * const mesh = new THREE.Mesh( geometry, material ); + * scene.add( mesh ); + * ``` + * + * @augments Object3D + */ +export class Mesh extends Object3D { + /** + * Constructs a new mesh. + * + * @param {BufferGeometry} [geometry] - The mesh geometry. + * @param {Material|Array} [material] - The mesh material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMesh: boolean; + type: string; + /** + * The mesh geometry. + * + * @type {BufferGeometry} + */ + geometry: BufferGeometry; + /** + * The mesh material. + * + * @type {Material|Array} + * @default MeshBasicMaterial + */ + material: Material | Array; + /** + * A dictionary representing the morph targets in the geometry. The key is the + * morph targets name, the value its attribute index. This member is `undefined` + * by default and only set when morph targets are detected in the geometry. + * + * @type {Object|undefined} + * @default undefined + */ + morphTargetDictionary: { + [x: string]: number; + } | undefined; + /** + * An array of weights typically in the range `[0,1]` that specify how much of the morph + * is applied. This member is `undefined` by default and only set when morph targets are + * detected in the geometry. + * + * @type {Array|undefined} + * @default undefined + */ + morphTargetInfluences: Array | undefined; + /** + * The number of instances of this mesh. + * Can only be used with {@link WebGPURenderer}. + * + * @type {number} + * @default 1 + */ + count: number; + copy(source: any, recursive: any): this; + /** + * Sets the values of {@link Mesh#morphTargetDictionary} and {@link Mesh#morphTargetInfluences} + * to make sure existing morph targets can influence this 3D object. + */ + updateMorphTargets(): void; + /** + * Returns the local-space position of the vertex at the given index, taking into + * account the current animation state of both morph targets and skinning. + * + * @param {number} index - The vertex index. + * @param {Vector3} target - The target object that is used to store the method's result. + * @return {Vector3} The vertex position in local space. + */ + getVertexPosition(index: number, target: Vector3): Vector3; + /** + * Returns `true` if this mesh intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this mesh intersects the given frustum or not. + */ + intersectsFrustum(frustum: Frustum | FrustumArray): boolean; + /** + * Computes intersection points between a casted ray and this line. + * + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - The target array that holds the intersection points. + */ + raycast(raycaster: Raycaster, intersects: Array): void; + _computeIntersections(raycaster: any, intersects: any, rayLocalSpace: any): void; +} +import { Object3D } from '../core/Object3D.js'; +import { BufferGeometry } from '../core/BufferGeometry.js'; +import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Points.d.ts b/jsdoc-testing/jsdoc/src/objects/Points.d.ts new file mode 100644 index 000000000..1336406a3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/Points.d.ts @@ -0,0 +1,78 @@ +/** + * A class for displaying points or point clouds. + * + * @augments Object3D + */ +export class Points extends Object3D { + /** + * Constructs a new point cloud. + * + * @param {BufferGeometry} [geometry] - The points geometry. + * @param {Material|Array} [material] - The points material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isPoints: boolean; + type: string; + /** + * The points geometry. + * + * @type {BufferGeometry} + */ + geometry: BufferGeometry; + /** + * The line material. + * + * @type {Material|Array} + * @default PointsMaterial + */ + material: Material | Array; + /** + * A dictionary representing the morph targets in the geometry. The key is the + * morph targets name, the value its attribute index. This member is `undefined` + * by default and only set when morph targets are detected in the geometry. + * + * @type {Object|undefined} + * @default undefined + */ + morphTargetDictionary: { + [x: string]: number; + } | undefined; + /** + * An array of weights typically in the range `[0,1]` that specify how much of the morph + * is applied. This member is `undefined` by default and only set when morph targets are + * detected in the geometry. + * + * @type {Array|undefined} + * @default undefined + */ + morphTargetInfluences: Array | undefined; + copy(source: any, recursive: any): this; + /** + * Returns `true` if this point cloud intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this point cloud intersects the given frustum or not. + */ + intersectsFrustum(frustum: Frustum | FrustumArray): boolean; + /** + * Computes intersection points between a casted ray and this point cloud. + * + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - The target array that holds the intersection points. + */ + raycast(raycaster: Raycaster, intersects: Array): void; + /** + * Sets the values of {@link Points#morphTargetDictionary} and {@link Points#morphTargetInfluences} + * to make sure existing morph targets can influence this 3D object. + */ + updateMorphTargets(): void; +} +import { Object3D } from '../core/Object3D.js'; +import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts b/jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts new file mode 100644 index 000000000..02c01c61d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts @@ -0,0 +1,126 @@ +/** + * Class for representing the armatures in `three.js`. The skeleton + * is defined by a hierarchy of bones. + * + * ```js + * const bones = []; + * + * const shoulder = new THREE.Bone(); + * const elbow = new THREE.Bone(); + * const hand = new THREE.Bone(); + * + * shoulder.add( elbow ); + * elbow.add( hand ); + * + * bones.push( shoulder , elbow, hand); + * + * shoulder.position.y = -5; + * elbow.position.y = 0; + * hand.position.y = 5; + * + * const armSkeleton = new THREE.Skeleton( bones ); + * ``` + */ +export class Skeleton { + /** + * Constructs a new skeleton. + * + * @param {Array} [bones] - An array of bones. + * @param {Array} [boneInverses] - An array of bone inverse matrices. + * If not provided, these matrices will be computed automatically via {@link Skeleton#calculateInverses}. + */ + constructor(bones?: Array, boneInverses?: Array); + uuid: string; + /** + * An array of bones defining the skeleton. + * + * @type {Array} + */ + bones: Array; + /** + * An array of bone inverse matrices. + * + * @type {Array} + */ + boneInverses: Array; + /** + * An array buffer holding the bone data. + * Input data for {@link Skeleton#boneTexture}. + * + * @type {?Float32Array} + * @default null + */ + boneMatrices: Float32Array | null; + /** + * A texture holding the bone data for use + * in the vertex shader. + * + * @type {?DataTexture} + * @default null + */ + boneTexture: DataTexture | null; + /** + * Initializes the skeleton. This method gets automatically called by the constructor + * but depending on how the skeleton is created it might be necessary to call this method + * manually. + */ + init(): void; + /** + * Computes the bone inverse matrices. This method resets {@link Skeleton#boneInverses} + * and fills it with new matrices. + */ + calculateInverses(): void; + /** + * Resets the skeleton to the base pose. + */ + pose(): void; + /** + * Resets the skeleton to the base pose. + */ + update(): void; + /** + * Returns a new skeleton with copied values from this instance. + * + * @return {Skeleton} A clone of this instance. + */ + clone(): Skeleton; + /** + * Computes a data texture for passing bone data to the vertex shader. + * + * @return {Skeleton} A reference of this instance. + */ + computeBoneTexture(): Skeleton; + /** + * Searches through the skeleton's bone array and returns the first with a + * matching name. + * + * @param {string} name - The name of the bone. + * @return {Bone|undefined} The found bone. `undefined` if no bone has been found. + */ + getBoneByName(name: string): Bone | undefined; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + */ + dispose(): void; + /** + * Setups the skeleton by the given JSON and bones. + * + * @param {Object} json - The skeleton as serialized JSON. + * @param {Object} bones - An array of bones. + * @return {Skeleton} A reference of this instance. + */ + fromJSON(json: Object, bones: { + [x: string]: Bone; + }): Skeleton; + /** + * Serializes the skeleton into JSON. + * + * @return {Object} A JSON object representing the serialized skeleton. + * @see {@link ObjectLoader#parse} + */ + toJSON(): Object; +} +import { Bone } from './Bone.js'; +import { Matrix4 } from '../math/Matrix4.js'; +import { DataTexture } from '../textures/DataTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts b/jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts new file mode 100644 index 000000000..77cf71c4e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts @@ -0,0 +1,118 @@ +/** + * A mesh that has a {@link Skeleton} that can then be used to animate the + * vertices of the geometry with skinning/skeleton animation. + * + * Next to a valid skeleton, the skinned mesh requires skin indices and weights + * as buffer attributes in its geometry. These attribute define which bones affect a single + * vertex to a certain extend. + * + * Typically skinned meshes are not created manually but loaders like {@link GLTFLoader} + * or {@link FBXLoader } import respective models. + * + * @augments Mesh + * @demo scenes/bones-browser.html + */ +export class SkinnedMesh extends Mesh { + /** + * Constructs a new skinned mesh. + * + * @param {BufferGeometry} [geometry] - The mesh geometry. + * @param {Material|Array} [material] - The mesh material. + */ + constructor(geometry?: BufferGeometry, material?: Material | Array); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSkinnedMesh: boolean; + /** + * `AttachedBindMode` means the skinned mesh shares the same world space as the skeleton. + * This is not true when using `DetachedBindMode` which is useful when sharing a skeleton + * across multiple skinned meshes. + * + * @type {(AttachedBindMode|DetachedBindMode)} + * @default AttachedBindMode + */ + bindMode: (string | string); + /** + * The base matrix that is used for the bound bone transforms. + * + * @type {Matrix4} + */ + bindMatrix: Matrix4; + /** + * The base matrix that is used for resetting the bound bone transforms. + * + * @type {Matrix4} + */ + bindMatrixInverse: Matrix4; + /** + * The bounding box of the skinned mesh. Can be computed via {@link SkinnedMesh#computeBoundingBox}. + * + * @type {?Box3} + * @default null + */ + boundingBox: Box3 | null; + /** + * The bounding sphere of the skinned mesh. Can be computed via {@link SkinnedMesh#computeBoundingSphere}. + * + * @type {?Sphere} + * @default null + */ + boundingSphere: Sphere | null; + /** + * Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}. + * The bounding box is not automatically computed by the engine; this method must be called by your app. + * If the skinned mesh is animated, the bounding box should be recomputed per frame in order to reflect + * the current animation state. + */ + computeBoundingBox(): void; + /** + * Computes the bounding sphere of the skinned mesh, and updates {@link SkinnedMesh#boundingSphere}. + * The bounding sphere is automatically computed by the engine once when it is needed, e.g., for ray casting + * and view frustum culling. If the skinned mesh is animated, the bounding sphere should be recomputed + * per frame in order to reflect the current animation state. + */ + computeBoundingSphere(): void; + copy(source: any, recursive: any): this; + skeleton: any; + raycast(raycaster: any, intersects: any): void; + getVertexPosition(index: any, target: any): any; + /** + * Binds the given skeleton to the skinned mesh. + * + * @param {Skeleton} skeleton - The skeleton to bind. + * @param {Matrix4} [bindMatrix] - The bind matrix. If no bind matrix is provided, + * the skinned mesh's world matrix will be used instead. + */ + bind(skeleton: Skeleton, bindMatrix?: Matrix4): void; + /** + * This method sets the skinned mesh in the rest pose). + */ + pose(): void; + /** + * Normalizes the skin weights which are defined as a buffer attribute + * in the skinned mesh's geometry. + */ + normalizeSkinWeights(): void; + updateMatrixWorld(force: any): void; + /** + * Applies the bone transform associated with the given index to the given + * vector. Can be used to transform positions or direction vectors by providing + * a Vector4 with 1 or 0 in the w component respectively. Returns the updated vector. + * + * @param {number} index - The vertex index. + * @param {Vector3|Vector4} target - The target object that is used to store the method's result. + * @return {Vector3|Vector4} The updated vertex attribute data. + */ + applyBoneTransform(index: number, target: Vector3 | Vector4): Vector3 | Vector4; +} +import { Mesh } from './Mesh.js'; +import { Matrix4 } from '../math/Matrix4.js'; +import { Box3 } from '../math/Box3.js'; +import { Sphere } from '../math/Sphere.js'; +import { Vector3 } from '../math/Vector3.js'; +import { Vector4 } from '../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Sprite.d.ts b/jsdoc-testing/jsdoc/src/objects/Sprite.d.ts new file mode 100644 index 000000000..e250827d7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/objects/Sprite.d.ts @@ -0,0 +1,82 @@ +/** + * A sprite is a plane that always faces towards the camera, generally with a + * partially transparent texture applied. + * + * Sprites do not cast shadows, setting {@link Object3D#castShadow} to `true` will + * have no effect. + * + * ```js + * const map = new THREE.TextureLoader().load( 'sprite.png' ); + * const material = new THREE.SpriteMaterial( { map: map } ); + * + * const sprite = new THREE.Sprite( material ); + * scene.add( sprite ); + * ``` + * + * @augments Object3D + */ +export class Sprite extends Object3D { + /** + * Constructs a new sprite. + * + * @param {(SpriteMaterial|SpriteNodeMaterial)} [material] - The sprite material. + */ + constructor(material?: (SpriteMaterial | SpriteNodeMaterial)); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSprite: boolean; + type: string; + /** + * The sprite geometry. + * + * @type {BufferGeometry} + */ + geometry: BufferGeometry; + /** + * The sprite material. + * + * @type {(SpriteMaterial|SpriteNodeMaterial)} + */ + material: (SpriteMaterial | SpriteNodeMaterial); + /** + * The sprite's anchor point, and the point around which the sprite rotates. + * A value of `(0.5, 0.5)` corresponds to the midpoint of the sprite. A value + * of `(0, 0)` corresponds to the lower left corner of the sprite. + * + * @type {Vector2} + * @default (0.5,0.5) + */ + center: Vector2; + /** + * The number of instances of this sprite. + * Can only be used with {@link WebGPURenderer}. + * + * @type {number} + * @default 1 + */ + count: number; + /** + * Returns `true` if this sprite intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this sprite intersects the given frustum or not. + */ + intersectsFrustum(frustum: Frustum | FrustumArray): boolean; + /** + * Computes intersection points between a casted ray and this sprite. + * + * @param {Raycaster} raycaster - The raycaster. + * @param {Array} intersects - The target array that holds the intersection points. + */ + raycast(raycaster: Raycaster, intersects: Array): void; + copy(source: any, recursive: any): this; +} +import { Object3D } from '../core/Object3D.js'; +import { BufferGeometry } from '../core/BufferGeometry.js'; +import { SpriteMaterial } from '../materials/SpriteMaterial.js'; +import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts new file mode 100644 index 000000000..e27e8a964 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts @@ -0,0 +1,25 @@ +/** + * A 3D render target used in context of {@link WebGLRenderer}. + * + * @augments WebGLRenderTarget + */ +export class WebGL3DRenderTarget extends WebGLRenderTarget { + /** + * Constructs a new 3D render target. + * + * @param {number} [width=1] - The width of the render target. + * @param {number} [height=1] - The height of the render target. + * @param {number} [depth=1] - The height of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(width?: number, height?: number, depth?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGL3DRenderTarget: boolean; +} +import { WebGLRenderTarget } from './WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts new file mode 100644 index 000000000..22f9b0da1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts @@ -0,0 +1,25 @@ +/** + * An array render target used in context of {@link WebGLRenderer}. + * + * @augments WebGLRenderTarget + */ +export class WebGLArrayRenderTarget extends WebGLRenderTarget { + /** + * Constructs a new array render target. + * + * @param {number} [width=1] - The width of the render target. + * @param {number} [height=1] - The height of the render target. + * @param {number} [depth=1] - The height of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(width?: number, height?: number, depth?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLArrayRenderTarget: boolean; +} +import { WebGLRenderTarget } from './WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts new file mode 100644 index 000000000..c112d383d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts @@ -0,0 +1,40 @@ +/** + * A cube render target used in context of {@link WebGLRenderer}. + * + * @augments WebGLRenderTarget + */ +export class WebGLCubeRenderTarget extends WebGLRenderTarget { + /** + * Constructs a new cube render target. + * + * @param {number} [size=1] - The size of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(size?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLCubeRenderTarget: boolean; + /** + * Converts the given equirectangular texture to a cube map. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {Texture} texture - The equirectangular texture. + * @return {WebGLCubeRenderTarget} A reference to this cube render target. + */ + fromEquirectangularTexture(renderer: WebGLRenderer, texture: Texture): WebGLCubeRenderTarget; + /** + * Clears this cube render target. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear(renderer: WebGLRenderer, color?: boolean, depth?: boolean, stencil?: boolean): void; +} +import { WebGLRenderTarget } from './WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts new file mode 100644 index 000000000..f20262ff0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts @@ -0,0 +1,16 @@ +/** + * A render target used in context of {@link WebGLRenderer}. + * + * @augments RenderTarget + */ +export class WebGLRenderTarget extends RenderTarget { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLRenderTarget: boolean; +} +import { RenderTarget } from '../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts new file mode 100644 index 000000000..7ed2e8df3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts @@ -0,0 +1,580 @@ +/** + * ~Options + */ +export type WebGLRenderer = { + /** + * - A canvas element where the renderer draws its output. If not passed in here, a new canvas element will be created by the renderer. + */ + canvas?: HTMLCanvasElement | OffscreenCanvas | undefined; + /** + * - Can be used to attach an existing rendering context to this renderer. + */ + context?: WebGL2RenderingContext | undefined; + /** + * - The default shader precision. Uses `highp` if supported by the device. + */ + precision?: "highp" | "mediump" | "lowp" | undefined; + /** + * - Controls the default clear alpha value. When set to`true`, the value is `0`. Otherwise it's `1`. + */ + alpha?: boolean | undefined; + /** + * Whether the renderer will assume colors have premultiplied alpha or not. + */ + premultipliedAlpha?: boolean | undefined; + /** + * Whether to use the default MSAA or not. + */ + antialias?: boolean | undefined; + /** + * Whether the drawing buffer has a stencil buffer of at least 8 bits or not. + */ + stencil?: boolean | undefined; + /** + * Whether to preserve the buffer until manually cleared or overwritten. + */ + preserveDrawingBuffer?: boolean | undefined; + /** + * Provides a hint to the user agent indicating what configuration of GPU is suitable for this WebGL context. + */ + powerPreference?: "default" | "high-performance" | "low-power" | undefined; + /** + * Whether the renderer creation will fail upon low performance is detected. + */ + failIfMajorPerformanceCaveat?: boolean | undefined; + /** + * Whether the drawing buffer has a depth buffer of at least 16 bits. + */ + depth?: boolean | undefined; + /** + * Whether to use a logarithmic depth buffer. It may be necessary to use this if dealing with huge differences in scale in a single scene. + * Note that this setting uses `gl_FragDepth` if available which disables the Early Fragment Test optimization and can cause a decrease in performance. + */ + logarithmicDepthBuffer?: boolean | undefined; + /** + * Whether to use a reverse depth buffer. Requires the `EXT_clip_control` extension. + * This is a more faster and accurate version than logarithmic depth buffer. + */ + reversedDepthBuffer?: boolean | undefined; + /** + * Defines the type of the output buffer. Use `HalfFloatType` for HDR rendering with tone mapping and post-processing support. + */ + outputBufferType?: number | undefined; +}; +/** + * This renderer uses WebGL 2 to display scenes. + * + * WebGL 1 is not supported since `r163`. + */ +export class WebGLRenderer { + /** + * Constructs a new WebGL renderer. + * + * @param {WebGLRenderer~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLRenderer: boolean; + /** + * A canvas where the renderer draws its output. This is automatically created by the renderer + * in the constructor (if not provided already); you just need to add it to your page like so: + * ```js + * document.body.appendChild( renderer.domElement ); + * ``` + * + * @type {HTMLCanvasElement|OffscreenCanvas} + */ + domElement: HTMLCanvasElement | OffscreenCanvas; + /** + * A object with debug configuration settings. + * + * - `checkShaderErrors`: If it is `true`, defines whether material shader programs are + * checked for errors during compilation and linkage process. It may be useful to disable + * this check in production for performance gain. It is strongly recommended to keep these + * checks enabled during development. If the shader does not compile and link, it will not + * work and associated material will not render. + * - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that + * can be used for custom error reporting. The callback receives the WebGL context, an instance + * of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader. + * Assigning a custom function disables the default error reporting. + * + * @type {Object} + */ + debug: Object; + /** + * Whether the renderer should automatically clear its output before rendering a frame or not. + * + * @type {boolean} + * @default true + */ + autoClear: boolean; + /** + * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear + * the color buffer or not. + * + * @type {boolean} + * @default true + */ + autoClearColor: boolean; + /** + * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear + * the depth buffer or not. + * + * @type {boolean} + * @default true + */ + autoClearDepth: boolean; + /** + * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear + * the stencil buffer or not. + * + * @type {boolean} + * @default true + */ + autoClearStencil: boolean; + /** + * Whether the renderer should sort objects or not. + * + * Note: Sorting is used to attempt to properly render objects that have some + * degree of transparency. By definition, sorting objects may not work in all + * cases. Depending on the needs of application, it may be necessary to turn + * off sorting and use other methods to deal with transparency rendering e.g. + * manually determining each object's rendering order. + * + * @type {boolean} + * @default true + */ + sortObjects: boolean; + /** + * User-defined clipping planes specified in world space. These planes apply globally. + * Points in space whose dot product with the plane is negative are cut away. + * + * @type {Array} + */ + clippingPlanes: Array; + /** + * Whether the renderer respects object-level clipping planes or not. + * + * @type {boolean} + * @default false + */ + localClippingEnabled: boolean; + /** + * The tone mapping technique of the renderer. + * + * @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)} + * @default NoToneMapping + */ + toneMapping: (number | LinearToneMapping | ReinhardToneMapping | CineonToneMapping | ACESFilmicToneMapping | CustomToneMapping | AgXToneMapping | NeutralToneMapping); + /** + * Exposure level of tone mapping. + * + * @type {number} + * @default 1 + */ + toneMappingExposure: number; + /** + * The normalized resolution scale for the transmission render target, measured in percentage + * of viewport dimensions. Lowering this value can result in significant performance improvements + * when using {@link MeshPhysicalMaterial#transmission}. + * + * @type {number} + * @default 1 + */ + transmissionResolutionScale: number; + _outputColorSpace: string; + /** + * A reference to the XR manager. + * + * @type {WebXRManager} + */ + xr: WebXRManager; + /** + * Returns the rendering context. + * + * @return {WebGL2RenderingContext} The rendering context. + */ + getContext: () => WebGL2RenderingContext; + /** + * Returns the rendering context attributes. + * + * @return {WebGLContextAttributes} The rendering context attributes. + */ + getContextAttributes: () => WebGLContextAttributes; + /** + * Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension. + */ + forceContextLoss: () => void; + /** + * Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension. + */ + forceContextRestore: () => void; + /** + * Returns the pixel ratio. + * + * @return {number} The pixel ratio. + */ + getPixelRatio: () => number; + /** + * Sets the given pixel ratio and resizes the canvas if necessary. + * + * @param {number} value - The pixel ratio. + */ + setPixelRatio: (value: number) => void; + /** + * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The renderer's size in logical pixels. + */ + getSize: (target: Vector2) => Vector2; + /** + * Resizes the output canvas to (width, height) with device pixel ratio taken + * into account, and also sets the viewport to fit that size, starting in (0, + * 0). Setting `updateStyle` to false prevents any style changes to the output canvas. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. + */ + setSize: (width: number, height: number, updateStyle?: boolean) => void; + /** + * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize: (target: Vector2) => Vector2; + /** + * This method allows to define the drawing buffer size by specifying + * width, height and pixel ratio all at once. The size of the drawing + * buffer is computed with this formula: + * ```js + * size.x = width * pixelRatio; + * size.y = height * pixelRatio; + * ``` + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {number} pixelRatio - The pixel ratio. + */ + setDrawingBufferSize: (width: number, height: number, pixelRatio: number) => void; + /** + * Sets the post-processing effects to be applied after rendering. + * + * @param {Array} effects - An array of post-processing effects. + */ + setEffects: (effects: any[]) => void; + /** + * Returns the current viewport definition. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The current viewport definition. + */ + getCurrentViewport: (target: Vector2) => Vector2; + /** + * Returns the viewport definition. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The viewport definition. + */ + getViewport: (target: Vector4) => Vector4; + /** + * Sets the viewport to render from `(x, y)` to `(x + width, y + height)`. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + * Or alternatively a four-component vector specifying all the parameters of the viewport. + * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + */ + setViewport: (x: number | Vector4, y: number, width: number, height: number) => void; + /** + * Returns the scissor region. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The scissor region. + */ + getScissor: (target: Vector4) => Vector4; + /** + * Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit. + * Or alternatively a four-component vector specifying all the parameters of the scissor region. + * @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit. + * @param {number} width - The width of the scissor region in logical pixel unit. + * @param {number} height - The height of the scissor region in logical pixel unit. + */ + setScissor: (x: number | Vector4, y: number, width: number, height: number) => void; + /** + * Returns `true` if the scissor test is enabled. + * + * @return {boolean} Whether the scissor test is enabled or not. + */ + getScissorTest: () => boolean; + /** + * Enable or disable the scissor test. When this is enabled, only the pixels + * within the defined scissor area will be affected by further renderer + * actions. + * + * @param {boolean} boolean - Whether the scissor test is enabled or not. + */ + setScissorTest: (boolean: boolean) => void; + /** + * Sets a custom opaque sort function for the render lists. Pass `null` + * to use the default `painterSortStable` function. + * + * @param {?Function} method - The opaque sort function. + */ + setOpaqueSort: (method: Function | null) => void; + /** + * Sets a custom transparent sort function for the render lists. Pass `null` + * to use the default `reversePainterSortStable` function. + * + * @param {?Function} method - The opaque sort function. + */ + setTransparentSort: (method: Function | null) => void; + /** + * Returns the clear color. + * + * @param {Color} target - The method writes the result in this target object. + * @return {Color} The clear color. + */ + getClearColor: (target: Color) => Color; + /** + * Sets the clear color and alpha. + * + * @param {Color} color - The clear color. + * @param {number} [alpha=1] - The clear alpha. + */ + setClearColor: (...args: any[]) => void; + /** + * Returns the clear alpha. Ranges within `[0,1]`. + * + * @return {number} The clear alpha. + */ + getClearAlpha: () => number; + /** + * Sets the clear alpha. + * + * @param {number} alpha - The clear alpha. + */ + setClearAlpha: (...args: any[]) => void; + /** + * Tells the renderer to clear its color, depth or stencil drawing buffer(s). + * This method initializes the buffers to the current clear color values. + * + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear: (color?: boolean, depth?: boolean, stencil?: boolean) => void; + /** + * Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`. + */ + clearColor: () => void; + /** + * Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`. + */ + clearDepth: () => void; + /** + * Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`. + */ + clearStencil: () => void; + /** + * Sets a compatibility node builder for rendering node materials with WebGLRenderer. + * This enables using TSL (Three.js Shading Language) node materials to prepare + * for migration to WebGPURenderer. + * + * @param {WebGLNodesHandler} nodesHandler - The node builder instance. + */ + setNodesHandler: (nodesHandler: WebGLNodesHandler) => void; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + */ + dispose: () => void; + renderBufferDirect: (camera: any, scene: any, geometry: any, material: any, object: any, group: any) => void; + /** + * Compiles all materials in the scene with the camera. This is useful to precompile shaders + * before the first rendering. If you want to add a 3D object to an existing scene, use the third + * optional parameter for applying the target scene. + * + * Note that the (target) scene's lighting and environment must be configured before calling this method. + * + * @param {Object3D} scene - The scene or another type of 3D object to precompile. + * @param {Camera} camera - The camera. + * @param {?Scene} [targetScene=null] - The target scene. + * @return {Set} The precompiled materials. + */ + compile: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Set; + /** + * Asynchronous version of {@link WebGLRenderer#compile}. + * + * This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence, + * it is recommended to use this version of `compile()` whenever possible. + * + * @async + * @param {Object3D} scene - The scene or another type of 3D object to precompile. + * @param {Camera} camera - The camera. + * @param {?Scene} [targetScene=null] - The target scene. + * @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation. + */ + compileAsync: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise; + /** + * Applications are advised to always define the animation loop + * with this method and not manually with `requestAnimationFrame()` + * for best compatibility. + * + * @param {?onAnimationCallback} callback - The application's animation loop. + */ + setAnimationLoop: (callback: onAnimationCallback | null) => void; + /** + * Renders the given scene (or other type of 3D object) using the given camera. + * + * The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget} + * or to the canvas as usual. + * + * By default render buffers are cleared before rendering but you can prevent + * this by setting the property `autoClear` to `false`. If you want to prevent + * only certain buffers being cleared you can `autoClearColor`, `autoClearDepth` + * or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}. + * + * @param {Object3D} scene - The scene to render. + * @param {Camera} camera - The camera. + */ + render: (scene: Object3D, camera: Camera) => void; + /** + * Returns the active cube face. + * + * @return {number} The active cube face. + */ + getActiveCubeFace: () => number; + /** + * Returns the active mipmap level. + * + * @return {number} The active mipmap level. + */ + getActiveMipmapLevel: () => number; + /** + * Returns the active render target. + * + * @return {?WebGLRenderTarget} The active render target. Returns `null` if no render target + * is currently set. + */ + getRenderTarget: () => WebGLRenderTarget | null; + setRenderTargetTextures: (renderTarget: any, colorTexture: any, depthTexture: any) => void; + setRenderTargetFramebuffer: (renderTarget: any, defaultFramebuffer: any) => void; + /** + * Sets the active rendertarget. + * + * @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given, + * the canvas is set as the active render target instead. + * @param {number} [activeCubeFace=0] - The active cube face when using a cube render target. + * Indicates the z layer to render in to when using 3D or array render targets. + * @param {number} [activeMipmapLevel=0] - The active mipmap level. + */ + setRenderTarget: (renderTarget: WebGLRenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number) => void; + /** + * Reads the pixel data from the given render target into the given buffer. + * + * @param {WebGLRenderTarget} renderTarget - The render target to read from. + * @param {number} x - The `x` coordinate of the copy region's origin. + * @param {number} y - The `y` coordinate of the copy region's origin. + * @param {number} width - The width of the copy region. + * @param {number} height - The height of the copy region. + * @param {TypedArray} buffer - The result buffer. + * @param {number} [activeCubeFaceIndex] - The active cube face index. + * @param {number} [textureIndex=0] - The texture index of an MRT render target. + */ + readRenderTargetPixels: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => void; + /** + * Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}. + * + * It is recommended to use this version of `readRenderTargetPixels()` whenever possible. + * + * @async + * @param {WebGLRenderTarget} renderTarget - The render target to read from. + * @param {number} x - The `x` coordinate of the copy region's origin. + * @param {number} y - The `y` coordinate of the copy region's origin. + * @param {number} width - The width of the copy region. + * @param {number} height - The height of the copy region. + * @param {TypedArray} buffer - The result buffer. + * @param {number} [activeCubeFaceIndex] - The active cube face index. + * @param {number} [textureIndex=0] - The texture index of an MRT render target. + * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. + */ + readRenderTargetPixelsAsync: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => Promise; + /** + * Copies pixels from the current bound framebuffer into the given texture. + * + * @param {FramebufferTexture} texture - The texture. + * @param {?Vector2} [position=null] - The start position of the copy operation. + * @param {number} [level=0] - The mip level. The default represents the base mip. + */ + copyFramebufferToTexture: (texture: FramebufferTexture, position?: Vector2 | null, level?: number) => void; + /** + * Copies data of the given source texture into a destination texture. + * + * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized + * {@link WebGLRenderer#initRenderTarget}. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. + * @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. + * @param {number} [srcLevel=0] - The source mipmap level to copy. + * @param {?number} [dstLevel=0] - The destination mipmap level. + */ + copyTextureToTexture: (srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box2 | Box3) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number | null) => void; + /** + * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data + * can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been + * rendered to. + * + * @param {WebGLRenderTarget} target - The render target. + */ + initRenderTarget: (target: WebGLRenderTarget) => void; + /** + * Initializes the given texture. Useful for preloading a texture rather than waiting until first + * render (which can cause noticeable lags due to decode and GPU upload overhead). + * + * @param {Texture} texture - The texture. + */ + initTexture: (texture: Texture) => void; + /** + * Can be used to reset the internal WebGL state. This method is mostly + * relevant for applications which share a single WebGL context across + * multiple WebGL libraries. + */ + resetState: () => void; + /** + * Defines the coordinate system of the renderer. + * + * In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`. + * + * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem} + * @default WebGLCoordinateSystem + * @readonly + */ + readonly get coordinateSystem(): number | WebGPUCoordinateSystem; + set outputColorSpace(colorSpace: string | LinearSRGBColorSpace); + /** + * Defines the output color space of the renderer. + * + * @type {SRGBColorSpace|LinearSRGBColorSpace} + * @default SRGBColorSpace + */ + get outputColorSpace(): string | LinearSRGBColorSpace; +} +import { WebXRManager } from './webxr/WebXRManager.js'; +import { Vector4 } from '../math/Vector4.js'; +import { Color } from '../math/Color.js'; +import { WebGLRenderTarget } from './WebGLRenderTarget.js'; +import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts new file mode 100644 index 000000000..276e5a64c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts @@ -0,0 +1,92 @@ +export default Animation; +/** + * This module manages the internal animation loop of the renderer. + * + * @private + */ +declare class Animation { + /** + * Constructs a new animation loop management component. + * + * @param {Renderer} renderer - A reference to the main renderer. + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(renderer: Renderer, nodes: NodeManager, info: Info); + /** + * A reference to the main renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * Renderer component for managing nodes related logic. + * + * @type {NodeManager} + */ + nodes: NodeManager; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * A reference to the context from `requestAnimationFrame()` can + * be called (usually `window`). + * + * @type {?(Window|XRSession)} + */ + _context: (Window | XRSession) | null; + /** + * The user-defined animation loop. + * + * @type {?Function} + * @default null + */ + _animationLoop: Function | null; + /** + * The requestId which is returned from the `requestAnimationFrame()` call. + * Can be used to cancel the stop the animation loop. + * + * @type {?number} + * @default null + */ + _requestId: number | null; + /** + * Starts the internal animation loop. + */ + start(): void; + /** + * Stops the internal animation loop. + */ + stop(): void; + /** + * Returns the user-level animation loop. + * + * @return {?Function} The animation loop. + */ + getAnimationLoop(): Function | null; + /** + * Defines the user-level animation loop. + * + * @param {?Function} callback - The animation loop. + */ + setAnimationLoop(callback: Function | null): void; + /** + * Returns the animation context. + * + * @return {Window|XRSession} The animation context. + */ + getContext(): Window | XRSession; + /** + * Defines the context in which `requestAnimationFrame()` is executed. + * + * @param {Window|XRSession} context - The context to set. + */ + setContext(context: Window | XRSession): void; + /** + * Frees all internal resources and stops the animation loop. + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts new file mode 100644 index 000000000..40b80e84c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts @@ -0,0 +1,52 @@ +export default Attributes; +/** + * This renderer module manages geometry attributes. + * + * @private + * @augments DataMap + */ +declare class Attributes extends DataMap { + /** + * Constructs a new attribute management component. + * + * @param {Backend} backend - The renderer's backend. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(backend: Backend, info: Info); + /** + * The renderer's backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * Deletes the data for the given attribute. + * + * @param {BufferAttribute} attribute - The attribute. + * @return {?Object} The deleted attribute data. + */ + delete(attribute: BufferAttribute): Object | null; + /** + * Updates the given attribute. This method creates attribute buffers + * for new attributes and updates data for existing ones. + * + * @param {BufferAttribute} attribute - The attribute to update. + * @param {number} type - The attribute type. + */ + update(attribute: BufferAttribute, type: number): void; + /** + * Utility method for handling interleaved buffer attributes correctly. + * To process them, their `InterleavedBuffer` is returned. + * + * @param {BufferAttribute} attribute - The attribute. + * @return {BufferAttribute|InterleavedBuffer} + */ + _getBufferAttribute(attribute: BufferAttribute): BufferAttribute | InterleavedBuffer; +} +import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts new file mode 100644 index 000000000..d75563c24 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts @@ -0,0 +1,573 @@ +export default Backend; +/** + * Most of the rendering related logic is implemented in the + * {@link Renderer} module and related management components. + * Sometimes it is required though to execute commands which are + * specific to the current 3D backend (which is WebGPU or WebGL 2). + * This abstract base class defines an interface that encapsulates + * all backend-related logic. Derived classes for each backend must + * implement the interface. + * + * @abstract + */ +declare class Backend { + /** + * Constructs a new backend. + * + * @param {Object} parameters - An object holding parameters for the backend. + */ + constructor(parameters?: Object); + /** + * The parameters of the backend. + * + * @type {Object} + */ + parameters: Object; + /** + * This weak map holds backend-specific data of objects + * like textures, attributes or render targets. + * + * @type {WeakMap} + */ + data: WeakMap; + /** + * A reference to the renderer. + * + * @type {?Renderer} + * @default null + */ + renderer: Renderer | null; + /** + * A reference to the canvas element the renderer is drawing to. + * + * @type {?(HTMLCanvasElement|OffscreenCanvas)} + * @default null + */ + domElement: (HTMLCanvasElement | OffscreenCanvas) | null; + /** + * A reference to the timestamp query pool. + * + * @type {{render: ?TimestampQueryPool, compute: ?TimestampQueryPool}} + */ + timestampQueryPool: { + render: TimestampQueryPool | null; + compute: TimestampQueryPool | null; + }; + /** + * Whether to track timestamps with a Timestamp Query API or not. + * + * @type {boolean} + * @default false + */ + trackTimestamp: boolean; + /** + * Initializes the backend so it is ready for usage. Concrete backends + * are supposed to implement their rendering context creation and related + * operations in this method. + * + * @async + * @param {Renderer} renderer - The renderer. + * @return {Promise} A Promise that resolves when the backend has been initialized. + */ + init(renderer: Renderer): Promise; + /** + * The coordinate system of the backend. + * + * @abstract + * @type {number} + * @readonly + */ + readonly get coordinateSystem(): number; + /** + * This method is executed at the beginning of a render call and + * can be used by the backend to prepare the state for upcoming + * draw calls. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + beginRender(): void; + /** + * This method is executed at the end of a render call and + * can be used by the backend to finalize work after draw + * calls. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + finishRender(): void; + /** + * Sets the XR rendering destination. + * + * Backends that render directly into XR framebuffers can override this hook. + * + * @param {?Object} xrTarget - The XR rendering destination. + */ + setXRTarget(): void; + /** + * This method is executed at the beginning of a compute call and + * can be used by the backend to prepare the state for upcoming + * compute tasks. + * + * @abstract + * @param {Node|Array} computeGroup - The compute node(s). + */ + beginCompute(): void; + /** + * This method is executed at the end of a compute call and + * can be used by the backend to finalize work after compute + * tasks. + * + * @abstract + * @param {Node|Array} computeGroup - The compute node(s). + */ + finishCompute(): void; + /** + * Executes a draw command for the given render object. + * + * @abstract + * @param {RenderObject} renderObject - The render object to draw. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + */ + draw(): void; + /** + * Executes a compute command for the given compute node. + * + * @abstract + * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. + * @param {Node} computeNode - The compute node. + * @param {Array} bindings - The bindings. + * @param {ComputePipeline} computePipeline - The compute pipeline. + */ + compute(): void; + /** + * Creates a shader program from the given programmable stage. + * + * @abstract + * @param {ProgrammableStage} program - The programmable stage. + */ + createProgram(): void; + /** + * Destroys the shader program of the given programmable stage. + * + * @abstract + * @param {ProgrammableStage} program - The programmable stage. + */ + destroyProgram(): void; + /** + * Creates bindings from the given bind group definition. + * + * @abstract + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(): void; + /** + * Updates the given bind group definition. + * + * @abstract + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + updateBindings(): void; + /** + * Updates a buffer binding. + * + * @abstract + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(): void; + /** + * Creates a render pipeline for the given render object. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(): void; + /** + * Creates a compute pipeline for the given compute node. + * + * @abstract + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(): void; + /** + * Returns `true` if the render pipeline requires an update. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether the render pipeline requires an update or not. + */ + needsRenderUpdate(): boolean; + /** + * Returns a cache key that is used to identify render pipelines. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @return {string} The cache key. + */ + getRenderCacheKey(): string; + /** + * Returns a node builder for the given render object. + * + * @abstract + * @param {RenderObject} renderObject - The render object. + * @param {Renderer} renderer - The renderer. + * @return {NodeBuilder} The node builder. + */ + createNodeBuilder(): NodeBuilder; + /** + * Updates a GPU sampler for the given texture. + * + * @abstract + * @param {Sampler} binding - The sampler binding to update. + * @return {string} The current sampler key. + */ + updateSampler(): string; + /** + * Frees the GPU sampler for the given sampler binding. + * + * @abstract + * @param {Sampler} binding - The sampler binding to free. + */ + destroySampler(): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @abstract + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(): void; + /** + * Uploads the updated texture data to the GPU. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(): void; + /** + * Generates mipmaps for the given texture. + * + * @abstract + * @param {Texture} texture - The texture. + */ + generateMipmaps(): void; + /** + * Destroys the GPU data for the given texture object. + * + * @abstract + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(): void; + /** + * Returns texture data as a typed array. + * + * @abstract + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(): Promise; + /** + * Copies data of the given source texture to the given destination texture. + * + * @abstract + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @abstract + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(): void; + /** + * Creates the GPU buffer of a shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createAttribute(): void; + /** + * Creates the GPU buffer of an indexed shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The indexed buffer attribute. + */ + createIndexAttribute(): void; + /** + * Creates the GPU buffer of a storage attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createStorageAttribute(): void; + /** + * Creates a uniform buffer. + * + * @abstract + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + createUniformBuffer(): void; + /** + * Destroys a uniform buffer. + * + * @abstract + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + destroyUniformBuffer(): void; + /** + * Updates the GPU buffer of a shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute to update. + */ + updateAttribute(): void; + /** + * Destroys the GPU buffer of a shader attribute. + * + * @abstract + * @param {BufferAttribute} attribute - The buffer attribute to destroy. + */ + destroyAttribute(): void; + /** + * Returns the backend's rendering context. + * + * @abstract + * @return {Object} The rendering context. + */ + getContext(): Object; + /** + * Backends can use this method if they have to run + * logic when the renderer gets resized. + * + * @abstract + */ + updateSize(): void; + /** + * Updates the viewport with the values from the given render context. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + updateViewport(): void; + /** + * Updates a unique identifier for the given render context that can be used + * to allocate resources like occlusion queries or timestamp queries. + * + * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. + */ + updateTimeStampUID(abstractRenderContext: RenderContext | ComputeNode): void; + /** + * Returns a unique identifier for the given render context that can be used + * to allocate resources like occlusion queries or timestamp queries. + * + * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. + * @return {string} The unique identifier. + */ + getTimestampUID(abstractRenderContext: RenderContext | ComputeNode): string; + /** + * Returns all timestamp frames for the given type. + * + * @param {string} type - The type of the time stamp. + * @return {Array} The timestamp frames. + */ + getTimestampFrames(type: string): Array; + /** + * Returns the query pool for the given uid. + * + * @param {string} uid - The unique identifier. + * @return {TimestampQueryPool} The query pool. + */ + _getQueryPool(uid: string): TimestampQueryPool; + /** + * Returns the timestamp for the given uid. + * + * @param {string} uid - The unique identifier. + * @return {number} The timestamp. + */ + getTimestamp(uid: string): number; + /** + * Whether the backend supports query timestamps or not. + * + * @type {boolean} + * @readonly + */ + readonly get hasTimestamp(): boolean; + /** + * Returns `true` if a timestamp for the given uid is available. + * + * @param {string} uid - The unique identifier. + * @return {boolean} Whether the timestamp is available or not. + */ + hasTimestampQuery(uid: string): boolean; + /** + * Returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. Backends must implement this method by using + * a Occlusion Query API. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(): boolean; + /** + * Resolves the time stamp for the given render context and type. + * + * @async + * @abstract + * @param {string} [type='render'] - The type of the time stamp. + * @return {Promise} A Promise that resolves with the time stamp. + */ + resolveTimestampsAsync(type?: string): Promise; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. + * + * @async + * @param {StorageBufferAttribute} attribute - The storage buffer attribute. + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(): Promise; + /** + * Checks if the given feature is supported by the backend. + * + * @async + * @abstract + * @param {string} name - The feature's name. + * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. + */ + hasFeatureAsync(): Promise; + /** + * Checks if the given feature is supported by the backend. + * + * @abstract + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(): boolean; + /** + * Returns the drawing buffer size. + * + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize(): Vector2; + /** + * Defines the scissor test. + * + * @abstract + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(): void; + /** + * Resets the backend's internal state. A no-op for backends without a state cache (e.g. WebGPU). + * + * @abstract + */ + resetState(): void; + /** + * Returns the clear color and alpha into a single + * color object. + * + * @return {Color4} The clear color. + */ + getClearColor(): Color4; + /** + * Returns the DOM element. If no DOM element exists, the backend + * creates a new one. + * + * @return {HTMLCanvasElement} The DOM element. + */ + getDomElement(): HTMLCanvasElement; + /** + * Checks if the backend has the given compatibility. + * + * @abstract + * @param {string} name - The compatibility. + * @return {boolean} Whether the backend has the given compatibility or not. + */ + hasCompatibility(): boolean; + /** + * Initializes the render target defined in the given render context. + * + * @abstract + * @param {RenderContext} renderContext - The render context. + */ + initRenderTarget(): void; + /** + * Sets a dictionary for the given object into the + * internal data structure. + * + * @param {Object} object - The object. + * @param {Object} value - The dictionary to set. + */ + set(object: Object, value: Object): void; + /** + * Returns the dictionary for the given object. + * + * @param {Object} object - The object. + * @return {Object} The object's dictionary. + */ + get(object: Object): Object; + /** + * Checks if the given object has a dictionary + * with data defined. + * + * @param {Object} object - The object. + * @return {boolean} Whether a dictionary for the given object as been defined or not. + */ + has(object: Object): boolean; + /** + * Deletes an object from the internal data structure. + * + * @param {Object} object - The object to delete. + */ + delete(object: Object): void; + /** + * Delete GPU data associated with a bind group. + * + * @abstract + * @param {BindGroup} bindGroup - The bind group. + */ + deleteBindGroupData(): void; + /** + * Frees internal resources. + * + * @abstract + */ + dispose(): void; +} +import { Vector2 } from '../../math/Vector2.js'; +import Color4 from './Color4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts new file mode 100644 index 000000000..f8262c348 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts @@ -0,0 +1,40 @@ +export default Background; +/** + * This renderer module manages the background. + * + * @private + * @augments DataMap + */ +declare class Background extends DataMap { + /** + * Constructs a new background management component. + * + * @param {Renderer} renderer - The renderer. + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + */ + constructor(renderer: Renderer, nodes: NodeManager); + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * Renderer component for managing nodes related logic. + * + * @type {NodeManager} + */ + nodes: NodeManager; + /** + * Updates the background for the given scene. Depending on how `Scene.background` + * or `Scene.backgroundNode` are configured, this method might configure a simple clear + * or add a mesh to the render list for rendering the background as a textured plane + * or skybox. + * + * @param {Scene} scene - The scene. + * @param {RenderList} renderList - The current render list. + * @param {RenderContext} renderContext - The current render context. + */ + update(scene: Scene, renderList: RenderList, renderContext: RenderContext): void; +} +import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts new file mode 100644 index 000000000..3fe0a0480 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts @@ -0,0 +1,35 @@ +export default BindGroup; +/** + * A bind group represents a collection of bindings and thus a collection + * or resources. Bind groups are assigned to pipelines to provide them + * with the required resources (like uniform buffers or textures). + * + * @private + */ +declare class BindGroup { + /** + * Constructs a new bind group. + * + * @param {string} name - The bind group's name. + * @param {Array} bindings - An array of bindings. + */ + constructor(name?: string, bindings?: Array); + /** + * The bind group's name. + * + * @type {string} + */ + name: string; + /** + * An array of bindings. + * + * @type {Array} + */ + bindings: Array; + /** + * The group's ID. + * + * @type {number} + */ + id: number; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts new file mode 100644 index 000000000..46356fdc4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts @@ -0,0 +1,49 @@ +export default Binding; +/** + * A binding represents the connection between a resource (like a texture, sampler + * or uniform buffer) and the resource definition in a shader stage. + * + * This module is an abstract base class for all concrete bindings types. + * + * @abstract + * @private + */ +declare class Binding { + /** + * Constructs a new binding. + * + * @param {string} [name=''] - The binding's name. + */ + constructor(name?: string); + /** + * The binding's name. + * + * @type {string} + */ + name: string; + /** + * A bitmask that defines in what shader stages the + * binding's resource is accessible. + * + * @type {number} + */ + visibility: number; + /** + * Makes sure binding's resource is visible for the given shader stage. + * + * @param {number} visibility - The shader stage. + */ + setVisibility(visibility: number): void; + /** + * The shader stages in which the binding's resource is visible. + * + * @return {number} The visibility bitmask. + */ + getVisibility(): number; + /** + * Clones the binding. + * + * @return {Binding} The cloned binding. + */ + clone(): Binding; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts new file mode 100644 index 000000000..70fe07f98 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts @@ -0,0 +1,126 @@ +export default Bindings; +/** + * This renderer module manages the bindings of the renderer. + * + * @private + * @augments DataMap + */ +declare class Bindings extends DataMap { + /** + * Constructs a new bindings management component. + * + * @param {Backend} backend - The renderer's backend. + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + * @param {Textures} textures - Renderer component for managing textures. + * @param {Attributes} attributes - Renderer component for managing attributes. + * @param {Pipelines} pipelines - Renderer component for managing pipelines. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(backend: Backend, nodes: NodeManager, textures: Textures, attributes: Attributes, pipelines: Pipelines, info: Info); + /** + * The renderer's backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * Renderer component for managing textures. + * + * @type {Textures} + */ + textures: Textures; + /** + * Renderer component for managing pipelines. + * + * @type {Pipelines} + */ + pipelines: Pipelines; + /** + * Renderer component for managing attributes. + * + * @type {Attributes} + */ + attributes: Attributes; + /** + * Renderer component for managing nodes related logic. + * + * @type {NodeManager} + */ + nodes: NodeManager; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * Returns the bind groups for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {Array} The bind groups. + */ + getForRender(renderObject: RenderObject): Array; + /** + * Returns the bind groups for the given compute node. + * + * @param {Node} computeNode - The compute node. + * @return {Array} The bind groups. + */ + getForCompute(computeNode: Node): Array; + /** + * Updates the bindings for the given compute node. + * + * @param {Node} computeNode - The compute node. + */ + updateForCompute(computeNode: Node): void; + /** + * Updates the bindings for the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateForRender(renderObject: RenderObject): void; + /** + * Updates only the shared uniform buffers of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateSharedForRender(renderObject: RenderObject): void; + /** + * Deletes the bindings for the given compute node. + * + * @param {Node} computeNode - The compute node. + */ + deleteForCompute(computeNode: Node): void; + /** + * Deletes the bindings for the given renderObject node. + * + * @param {RenderObject} renderObject - The renderObject. + */ + deleteForRender(renderObject: RenderObject): void; + /** + * Creates the bindings for the given array of bindings. + * + * @param {Array} bindings - The bind groups. + */ + _createBindings(bindings: Array): void; + /** + * Deletes the given array of bindings. + * + * @param {Array} bindings - The bind groups. + */ + _destroyBindings(bindings: Array): void; + /** + * Updates the given array of bindings. + * + * @param {Array} bindings - The bind groups. + */ + _updateBindings(bindings: Array): void; + /** + * Updates the given bind group. + * + * @param {BindGroup} bindGroup - The bind group to update. + * @param {Array} bindings - The bind groups. + */ + _update(bindGroup: BindGroup, bindings: Array): void; +} +import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts new file mode 100644 index 000000000..29223086e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts @@ -0,0 +1,109 @@ +export default BlendMode; +/** + * Represents blending configuration. + * + * This class encapsulates all blending-related properties that control how + * a material's colors are combined with the colors already in the frame buffer. + */ +declare class BlendMode { + /** + * Constructs a new blending configuration. + * + * @param {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} [blending=NormalBlending] - The blending mode. + */ + constructor(blending?: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending | MaterialBlending)); + /** + * Defines the blending type. + * + * It must be set to `CustomBlending` if custom blending properties like + * {@link BlendMode#blendSrc}, {@link BlendMode#blendDst} or {@link BlendMode#blendEquation} + * should have any effect. + * + * @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} + * @default NormalBlending + */ + blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending | MaterialBlending); + /** + * Defines the blending source factor. + * + * This determines how the source (incoming) fragment color is factored before being added + * to the destination (existing) fragment color in the frame buffer. + * + * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default SrcAlphaFactor + */ + blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + /** + * Defines the blending destination factor. + * + * This determines how the destination (existing) fragment color in the frame buffer + * is factored before being combined with the source (incoming) fragment color. + * + * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default OneMinusSrcAlphaFactor + */ + blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); + /** + * Defines the blending equation. + * + * This determines how the source and destination colors are combined. + * + * @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} + * @default AddEquation + */ + blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); + /** + * Defines the blending source alpha factor. + * + * When set, this allows separate control of the alpha channel's source blending factor. + * If `null`, {@link BlendMode#blendSrc} is used for the alpha channel as well. + * + * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default null + */ + blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + /** + * Defines the blending destination alpha factor. + * + * When set, this allows separate control of the alpha channel's destination blending factor. + * If `null`, {@link BlendMode#blendDst} is used for the alpha channel as well. + * + * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} + * @default null + */ + blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; + /** + * Defines the blending equation of the alpha channel. + * + * When set, this allows separate control of the alpha channel's blending equation. + * If `null`, {@link BlendMode#blendEquation} is used for the alpha channel as well. + * + * @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} + * @default null + */ + blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; + /** + * Defines whether to premultiply the alpha (transparency) value. + * + * If `true`, the RGB color of the texture or material is multiplied by its alpha value. + * This is useful for transparent textures/materials where the color data + * should already include the transparency information. + * + * @type {boolean} + * @default false + */ + premultiplyAlpha: boolean; + /** + * Copies the blending properties from the given source to this instance. + * + * @param {BlendMode} source - The blending configuration to copy from. + * @return {BlendMode} A reference to this instance. + */ + copy(source: BlendMode): BlendMode; + /** + * Returns a clone of this blending configuration. + * + * @return {BlendMode} A new Blending instance with the same properties. + */ + clone(): BlendMode; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts new file mode 100644 index 000000000..907f0ad0b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts @@ -0,0 +1,91 @@ +export default Buffer; +/** + * Represents a buffer binding type. + * + * @private + * @abstract + * @augments Binding + */ +declare class Buffer extends Binding { + /** + * Constructs a new buffer. + * + * @param {string} name - The buffer's name. + * @param {TypedArray} [buffer=null] - The buffer. + */ + constructor(name: string, buffer?: TypedArray); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBuffer: boolean; + /** + * The bytes per element. + * + * @type {number} + */ + bytesPerElement: number; + /** + * A reference to the internal buffer. + * + * @private + * @type {TypedArray} + */ + private _buffer; + /** + * An array of update ranges. + * + * @private + * @type {Array<{start: number, count: number}>} + */ + private _updateRanges; + /** + * The array of update ranges. + * + * @type {Array<{start: number, count: number}>} + */ + get updateRanges(): Array<{ + start: number; + count: number; + }>; + /** + * Adds an update range. + * + * @param {number} start - The start index. + * @param {number} count - The number of elements. + */ + addUpdateRange(start: number, count: number): void; + /** + * Clears all update ranges. + */ + clearUpdateRanges(): void; + /** + * The buffer's byte length. + * + * @type {number} + * @readonly + */ + readonly get byteLength(): number; + /** + * A reference to the internal buffer. + * + * @type {Float32Array} + * @readonly + */ + readonly get buffer(): Float32Array; + /** + * Updates the binding. + * + * @return {boolean} Whether the buffer has been updated and must be + * uploaded to the GPU. + */ + update(): boolean; + /** + * Releases the buffer. + */ + release(): void; +} +import Binding from './Binding.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts new file mode 100644 index 000000000..4d149b3a7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts @@ -0,0 +1,28 @@ +/** + * This function is usually called with the length in bytes of an array buffer. + * It returns an padded value which ensure chunk size alignment according to STD140 layout. + * + * @function + * @param {number} floatLength - The buffer length. + * @return {number} The padded length. + */ +export function getFloatLength(floatLength: number): number; +/** + * Given the count of vectors and their vector length, this function computes + * a total length in bytes with buffer alignment according to STD140 layout. + * + * @function + * @param {number} count - The number of vectors. + * @param {number} [vectorLength=4] - The vector length. + * @return {number} The padded length. + */ +export function getVectorLength(count: number, vectorLength?: number): number; +/** + * This function is called with a vector length and ensure the computed length + * matches a predefined stride (in this case `4`). + * + * @function + * @param {number} vectorLength - The vector length. + * @return {number} The padded length. + */ +export function getStrideLength(vectorLength: number): number; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts new file mode 100644 index 000000000..b4f4b22f1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts @@ -0,0 +1,44 @@ +export default BundleGroup; +/** + * A specialized group which enables applications access to the + * Render Bundle API of WebGPU. The group with all its descendant nodes + * are considered as one render bundle and processed as such by + * the renderer. + * + * Only renderable 3D objects are allowed in a bundle group. Other + * types like lights are not supported and must be added to the scene + * outside of the group. + * + * This module is only fully supported by `WebGPURenderer` with a WebGPU backend. + * With a WebGL backend, the group can technically be rendered but without + * any performance improvements. + * + * @augments Group + */ +declare class BundleGroup extends Group { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isBundleGroup: boolean; + /** + * The bundle group's version. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly version: number; + /** + * Set this property to `true` when the bundle group has changed. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); +} +import { Group } from '../../objects/Group.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts new file mode 100644 index 000000000..9932067a0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts @@ -0,0 +1,189 @@ +export default CanvasTarget; +/** + * CanvasTarget is a class that represents the final output destination of the renderer. + * + * @augments EventDispatcher + */ +declare class CanvasTarget extends EventDispatcher { + /** + * Constructs a new CanvasTarget. + * + * @param {HTMLCanvasElement|OffscreenCanvas} domElement - The canvas element to render to. + */ + constructor(domElement: HTMLCanvasElement | OffscreenCanvas); + /** + * A reference to the canvas element the renderer is drawing to. + * This value of this property will automatically be created by + * the renderer. + * + * @type {HTMLCanvasElement|OffscreenCanvas} + */ + domElement: HTMLCanvasElement | OffscreenCanvas; + /** + * The renderer's pixel ratio. + * + * @private + * @type {number} + * @default 1 + */ + private _pixelRatio; + /** + * The width of the renderer's default framebuffer in logical pixel unit. + * + * @private + * @type {number} + */ + private _width; + /** + * The height of the renderer's default framebuffer in logical pixel unit. + * + * @private + * @type {number} + */ + private _height; + /** + * The viewport of the renderer in logical pixel unit. + * + * @private + * @type {Vector4} + */ + private _viewport; + /** + * The scissor rectangle of the renderer in logical pixel unit. + * + * @private + * @type {Vector4} + */ + private _scissor; + /** + * Whether the scissor test should be enabled or not. + * + * @private + * @type {boolean} + */ + private _scissorTest; + /** + * The color texture of the default framebuffer. + * + * @type {FramebufferTexture} + */ + colorTexture: FramebufferTexture; + /** + * The depth texture of the default framebuffer. + * + * @type {DepthTexture} + */ + depthTexture: DepthTexture; + /** + * Returns the pixel ratio. + * + * @return {number} The pixel ratio. + */ + getPixelRatio(): number; + /** + * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize(target: Vector2): Vector2; + /** + * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The renderer's size in logical pixels. + */ + getSize(target: Vector2): Vector2; + /** + * Sets the given pixel ratio and resizes the canvas if necessary. + * + * @param {number} [value=1] - The pixel ratio. + */ + setPixelRatio(value?: number): void; + /** + * This method allows to define the drawing buffer size by specifying + * width, height and pixel ratio all at once. The size of the drawing + * buffer is computed with this formula: + * ```js + * size.x = width * pixelRatio; + * size.y = height * pixelRatio; + * ``` + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {number} pixelRatio - The pixel ratio. + */ + setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; + /** + * Sets the size of the renderer. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. + */ + setSize(width: number, height: number, updateStyle?: boolean): void; + /** + * Returns the scissor rectangle. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The scissor rectangle. + */ + getScissor(target: Vector4): Vector4; + /** + * Defines the scissor rectangle. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. + * Instead of passing four arguments, the method also works with a single four-dimensional vector. + * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. + * @param {number} width - The width of the scissor box in logical pixel unit. + * @param {number} height - The height of the scissor box in logical pixel unit. + */ + setScissor(x: number | Vector4, y: number, width: number, height: number): void; + /** + * Returns the scissor test value. + * + * @return {boolean} Whether the scissor test should be enabled or not. + */ + getScissorTest(): boolean; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Returns the viewport definition. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The viewport definition. + */ + getViewport(target: Vector4): Vector4; + /** + * Defines the viewport. + * + * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. + * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. + */ + setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; + /** + * Dispatches the resize event. + * + * @private + */ + private _dispatchResize; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires RenderTarget#dispose + */ + dispose(): void; +} +import { EventDispatcher } from '../../core/EventDispatcher.js'; +import { FramebufferTexture } from '../../textures/FramebufferTexture.js'; +import { DepthTexture } from '../../textures/DepthTexture.js'; +import { Vector4 } from '../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts new file mode 100644 index 000000000..97e504734 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts @@ -0,0 +1,48 @@ +export default ChainMap; +/** + * Data structure for the renderer. It allows defining values + * with chained, hierarchical keys. Keys are meant to be + * objects since the module internally works with Weak Maps + * for performance reasons. + * + * @private + */ +declare class ChainMap { + /** + * A map of Weak Maps by their key length. + * + * @type {Object} + */ + weakMaps: { + [x: number]: WeakMap; + }; + /** + * Returns the Weak Map for the given keys. + * + * @param {Array} keys - List of keys. + * @return {WeakMap} The weak map. + */ + _getWeakMap(keys: Array): WeakMap; + /** + * Returns the value for the given array of keys. + * + * @param {Array} keys - List of keys. + * @return {any} The value. Returns `undefined` if no value was found. + */ + get(keys: Array): any; + /** + * Sets the value for the given keys. + * + * @param {Array} keys - List of keys. + * @param {any} value - The value to set. + * @return {ChainMap} A reference to this Chain Map. + */ + set(keys: Array, value: any): ChainMap; + /** + * Deletes a value for the given keys. + * + * @param {Array} keys - The keys. + * @return {boolean} Returns `true` if the value has been removed successfully and `false` if the value has not be found. + */ + delete(keys: Array): boolean; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts new file mode 100644 index 000000000..0bc37ff1c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts @@ -0,0 +1,129 @@ +export default ClippingContext; +/** + * Represents the state that is used to perform clipping via clipping planes. + * There is a default clipping context for each render context. When the + * scene holds instances of `ClippingGroup`, there will be a context for each + * group. + * + * @private + */ +declare class ClippingContext { + /** + * Constructs a new clipping context. + * + * @param {?ClippingContext} [parentContext=null] - A reference to the parent clipping context. + */ + constructor(parentContext?: ClippingContext | null); + /** + * The id of the clipping context. + * + * @type {number} + * @readonly + */ + readonly id: number; + /** + * The clipping context's version. + * + * @type {number} + * @readonly + */ + readonly version: number; + /** + * Whether the intersection of the clipping planes is used to clip objects, rather than their union. + * + * @type {?boolean} + * @default null + */ + clipIntersection: boolean | null; + /** + * The clipping context's cache key. + * + * @type {string} + */ + cacheKey: string; + /** + * Whether the shadow pass is active or not. + * + * @type {boolean} + * @default false + */ + shadowPass: boolean; + /** + * The view matrix. + * + * @type {Matrix4} + */ + viewMatrix: Matrix4; + /** + * The view normal matrix. + * + * @type {Matrix3} + */ + viewNormalMatrix: Matrix3; + /** + * Internal cache for maintaining clipping contexts. + * + * @type {WeakMap} + */ + clippingGroupContexts: WeakMap; + /** + * The intersection planes. + * + * @type {Array} + */ + intersectionPlanes: Array; + /** + * The intersection planes. + * + * @type {Array} + */ + unionPlanes: Array; + /** + * The version of the clipping context's parent context. + * + * @type {?number} + * @readonly + */ + readonly parentVersion: number | null; + /** + * Projects the given source clipping planes and writes the result into the + * destination array. + * + * @param {Array} source - The source clipping planes. + * @param {Array} destination - The destination. + * @param {number} offset - The offset. + */ + projectPlanes(source: Array, destination: Array, offset: number): void; + /** + * Updates the root clipping context of a scene. + * + * @param {Scene} scene - The scene. + * @param {Camera} camera - The camera that is used to render the scene. + */ + updateGlobal(scene: Scene, camera: Camera): void; + /** + * Updates the clipping context. + * + * @param {ClippingContext} parentContext - The parent context. + * @param {ClippingGroup} clippingGroup - The clipping group this context belongs to. + */ + update(parentContext: ClippingContext, clippingGroup: ClippingGroup): void; + /** + * Returns a clipping context for the given clipping group. + * + * @param {ClippingGroup} clippingGroup - The clipping group. + * @return {ClippingContext} The clipping context. + */ + getGroupContext(clippingGroup: ClippingGroup): ClippingContext; + /** + * The count of union clipping planes. + * + * @type {number} + * @readonly + */ + readonly get unionClippingCount(): number; +} +import { Matrix4 } from '../../math/Matrix4.js'; +import { Matrix3 } from '../../math/Matrix3.js'; +import { Vector4 } from '../../math/Vector4.js'; +import { Plane } from '../../math/Plane.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts new file mode 100644 index 000000000..6f01003df --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts @@ -0,0 +1,49 @@ +export default Color4; +/** + * A four-component version of {@link Color} which is internally + * used by the renderer to represents clear color with alpha as + * one object. + * + * @private + * @augments Color + */ +declare class Color4 extends Color { + /** + * Constructs a new four-component color. + * You can also pass a single THREE.Color, hex or + * string argument to this constructor. + * + * @param {number|string} [r=1] - The red value. + * @param {number} [g=1] - The green value. + * @param {number} [b=1] - The blue value. + * @param {number} [a=1] - The alpha value. + */ + constructor(r?: number | string, g?: number, b?: number, a?: number); + a: number; + /** + * Overwrites the default to honor alpha. + * You can also pass a single THREE.Color, hex or + * string argument to this method. + * + * @param {number|string|Color} r - The red value. + * @param {number} [g] - The green value. + * @param {number} [b] - The blue value. + * @param {number} [a=1] - The alpha value. + * @return {Color4} A reference to this object. + */ + set(r: number | string | Color, g?: number, b?: number, a?: number): Color4; + /** + * Overwrites the default to honor alpha. + * + * @param {Color4} color - The color to copy. + * @return {Color4} A reference to this object. + */ + copy(color: Color4): Color4; + /** + * Overwrites the default to honor alpha. + * + * @return {Color4} The cloned color. + */ + clone(): Color4; +} +import { Color } from '../../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts new file mode 100644 index 000000000..c8740c38d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts @@ -0,0 +1,31 @@ +export default ComputePipeline; +/** + * Class for representing compute pipelines. + * + * @private + * @augments Pipeline + */ +declare class ComputePipeline extends Pipeline { + /** + * Constructs a new compute pipeline. + * + * @param {string} cacheKey - The pipeline's cache key. + * @param {ProgrammableStage} computeProgram - The pipeline's compute shader. + */ + constructor(cacheKey: string, computeProgram: ProgrammableStage); + /** + * The pipeline's compute shader. + * + * @type {ProgrammableStage} + */ + computeProgram: ProgrammableStage; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isComputePipeline: boolean; +} +import Pipeline from './Pipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts new file mode 100644 index 000000000..0561bfadb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts @@ -0,0 +1,7 @@ +export namespace AttributeType { + let VERTEX: number; + let INDEX: number; + let STORAGE: number; + let INDIRECT: number; +} +export const GPU_CHUNK_BYTES: 16; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts new file mode 100644 index 000000000..e6cad71cf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts @@ -0,0 +1,42 @@ +export default CubeRenderTarget; +/** + * This class represents a cube render target. It is a special version + * of `WebGLCubeRenderTarget` which is compatible with `WebGPURenderer`. + * + * @augments RenderTarget + */ +declare class CubeRenderTarget extends RenderTarget { + /** + * Constructs a new cube render target. + * + * @param {number} [size=1] - The size of the render target. + * @param {RenderTarget~Options} [options] - The configuration object. + */ + constructor(size?: number, options?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeRenderTarget: boolean; + /** + * Converts the given equirectangular texture to a cube map. + * + * @param {Renderer} renderer - The renderer. + * @param {Texture} texture - The equirectangular texture. + * @return {CubeRenderTarget} A reference to this cube render target. + */ + fromEquirectangularTexture(renderer: Renderer, texture: Texture): CubeRenderTarget; + /** + * Clears this cube render target. + * + * @param {Renderer} renderer - The renderer. + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear(renderer: Renderer, color?: boolean, depth?: boolean, stencil?: boolean): void; +} +import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts new file mode 100644 index 000000000..5b407575a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts @@ -0,0 +1,41 @@ +export default DataMap; +/** + * Data structure for the renderer. It is intended to manage + * data of objects in dictionaries. + * + * @private + */ +declare class DataMap { + /** + * `DataMap` internally uses a weak map + * to manage its data. + * + * @type {WeakMap} + */ + data: WeakMap; + /** + * Returns the dictionary for the given object. + * + * @param {Object} object - The object. + * @return {Object} The dictionary. + */ + get(object: Object): Object; + /** + * Deletes the dictionary for the given object. + * + * @param {Object} object - The object. + * @return {?Object} The deleted dictionary. + */ + delete(object: Object): Object | null; + /** + * Returns `true` if the given object has a dictionary defined. + * + * @param {Object} object - The object to test. + * @return {boolean} Whether a dictionary is defined or not. + */ + has(object: Object): boolean; + /** + * Frees internal resources. + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts new file mode 100644 index 000000000..edb6ba183 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts @@ -0,0 +1,66 @@ +export default DirectRenderPipeline; +/** + * An alternative render pipeline that applies output processing directly in + * material shaders. This avoids the intermediate framebuffer and output pass + * used by {@link Renderer}, but changes blending and is not compatible with + * materials that sample the framebuffer, such as transmissive materials. + * + * ```js + * const renderPipeline = new DirectRenderPipeline( renderer ); + * renderPipeline.render( scene, camera ); + * ``` + * + * Note: This module can only be used with `WebGPURenderer`. + * + * @augments RenderPipeline + */ +declare class DirectRenderPipeline extends RenderPipeline { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isDirectRenderPipeline: boolean; + /** + * The context node used to apply output processing in material shaders. + * + * @private + * @type {?ContextNode} + * @default null + */ + private _contextNode; + /** + * The renderer context node wrapped by this pipeline. + * + * @private + * @type {?ContextNode} + * @default null + */ + private _rendererContextNode; + /** + * Cached node representations of solid scene backgrounds. + * + * @private + * @type {WeakMap} + */ + private _backgroundNodes; + /** + * Renders the scene with output processing applied directly in material shaders. + * + * @param {Object3D} scene - The scene or object to render. + * @param {Camera} camera - The camera. + */ + render(scene: Object3D, camera: Camera): void; + /** + * Returns a node representation of a solid scene background so it receives + * the same inline output processing as material fragments. + * + * @private + * @param {Object3D} scene - The scene or object to render. + * @return {?UniformNode} The background node. + */ + private _getBackgroundNode; +} +import RenderPipeline from './RenderPipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts new file mode 100644 index 000000000..a1cd970c9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts @@ -0,0 +1,103 @@ +export default Geometries; +/** + * This renderer module manages geometries. + * + * @private + * @augments DataMap + */ +declare class Geometries extends DataMap { + /** + * Constructs a new geometry management component. + * + * @param {Attributes} attributes - Renderer component for managing attributes. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(attributes: Attributes, info: Info); + /** + * Renderer component for managing attributes. + * + * @type {Attributes} + */ + attributes: Attributes; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * Weak Map for managing attributes for wireframe rendering. + * + * @type {WeakMap} + */ + wireframes: WeakMap; + /** + * This Weak Map is used to make sure buffer attributes are + * updated only once per render call. + * + * @type {WeakMap} + */ + attributeCall: WeakMap; + /** + * Stores the event listeners attached to geometries. + * + * @private + * @type {Map} + */ + private _geometryDisposeListeners; + /** + * Returns `true` if the given render object has an initialized geometry. + * + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether if the given render object has an initialized geometry or not. + */ + has(renderObject: RenderObject): boolean; + /** + * Prepares the geometry of the given render object for rendering. + * + * @param {RenderObject} renderObject - The render object. + */ + updateForRender(renderObject: RenderObject): void; + /** + * Initializes the geometry of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + initGeometry(renderObject: RenderObject): void; + /** + * Updates the geometry attributes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateAttributes(renderObject: RenderObject): void; + /** + * Updates the given attribute. + * + * @param {BufferAttribute} attribute - The attribute to update. + * @param {number} type - The attribute type. + */ + updateAttribute(attribute: BufferAttribute, type: number): void; + /** + * Returns the indirect buffer attribute of the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. + */ + getIndirect(renderObject: RenderObject): BufferAttribute | null; + /** + * Returns the byte offset into the indirect attribute buffer of the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {number} The byte offset into the indirect attribute buffer. + */ + getIndirectOffset(renderObject: RenderObject): number; + /** + * Returns the index of the given render object's geometry. This is implemented + * in a method to return a wireframe index if necessary. + * + * @param {RenderObject} renderObject - The render object. + * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. + */ + getIndex(renderObject: RenderObject): BufferAttribute | null; +} +import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts new file mode 100644 index 000000000..9084444e7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts @@ -0,0 +1,29 @@ +export default IndirectStorageBufferAttribute; +/** + * This special type of buffer attribute is intended for compute shaders. + * It can be used to encode draw parameters for indirect draw calls. + * + * Note: This type of buffer attribute can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments StorageBufferAttribute + */ +declare class IndirectStorageBufferAttribute extends StorageBufferAttribute { + /** + * Constructs a new storage buffer attribute. + * + * @param {number|Uint32Array} count - The item count. It is also valid to pass a `Uint32Array` as an argument. + * The subsequent parameter is then obsolete. + * @param {number} itemSize - The item size. + */ + constructor(count: number | Uint32Array, itemSize: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isIndirectStorageBufferAttribute: boolean; +} +import StorageBufferAttribute from './StorageBufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts new file mode 100644 index 000000000..8155740ab --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts @@ -0,0 +1,211 @@ +export default Info; +/** + * This renderer module provides a series of statistical information + * about the GPU memory and the rendering process. Useful for debugging + * and monitoring. + */ +declare class Info { + /** + * Whether frame related metrics should automatically + * be resetted or not. This property should be set to `false` + * by apps which manage their own animation loop. They must + * then call `renderer.info.reset()` once per frame manually. + * + * @type {boolean} + * @default true + */ + autoReset: boolean; + /** + * The current frame ID. This ID is managed + * by `NodeFrame`. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly frame: number; + /** + * The number of render calls since the + * app has been started. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly calls: number; + /** + * Render related metrics. + * + * @type {Object} + * @readonly + * @property {number} calls - The number of render calls since the app has been started. + * @property {number} frameCalls - The number of render calls of the current frame. + * @property {number} drawCalls - The number of draw calls of the current frame. + * @property {number} triangles - The number of rendered triangle primitives of the current frame. + * @property {number} points - The number of rendered point primitives of the current frame. + * @property {number} lines - The number of rendered line primitives of the current frame. + * @property {number} timestamp - The timestamp of the frame. + */ + readonly render: Object; + /** + * Compute related metrics. + * + * @type {Object} + * @readonly + * @property {number} calls - The number of compute calls since the app has been started. + * @property {number} frameCalls - The number of compute calls of the current frame. + * @property {number} timestamp - The timestamp of the frame when using `renderer.computeAsync()`. + */ + readonly compute: Object; + /** + * Memory related metrics. + * + * @type {Object} + * @readonly + * @property {number} attributes - The number of active attributes. + * @property {number} attributesSize - The memory size of active attributes in bytes. + * @property {number} geometries - The number of active geometries. + * @property {number} indexAttributes - The number of active index attributes. + * @property {number} indexAttributesSize - The memory size of active index attributes in bytes. + * @property {number} indirectStorageAttributes - The number of active indirect storage attributes. + * @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes. + * @property {number} programs - The number of active programs. + * @property {number} programsSize - The memory size of active programs in bytes. + * @property {number} readbackBuffers - The number of active readback buffers. + * @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes. + * @property {number} renderTargets - The number of active renderTargets. + * @property {number} storageAttributes - The number of active storage attributes. + * @property {number} storageAttributesSize - The memory size of active storage attributes in bytes. + * @property {number} textures - The number of active textures. + * @property {number} texturesSize - The memory size of active textures in bytes. + * @property {number} uniformBuffers - The number of active uniform buffers. + * @property {number} uniformBuffersSize - The memory size of active uniform buffers in bytes. + * @property {number} total - The total memory size in bytes. + */ + readonly memory: Object; + /** + * Map for storing calculated byte sizes of tracked objects. + * + * @type {WeakMap} + * @private + */ + private memoryMap; + /** + * This method should be executed per draw call and updates the corresponding metrics. + * + * @param {Object3D} object - The 3D object that is going to be rendered. + * @param {number} count - The vertex or index count. + * @param {number} instanceCount - The instance count. + */ + update(object: Object3D, count: number, instanceCount: number): void; + /** + * Resets frame related metrics. + */ + reset(): void; + /** + * Performs a complete reset of the object. + */ + dispose(): void; + /** + * Tracks texture memory explicitly, updating counts and byte tracking. + * + * @param {Texture} texture + */ + createTexture(texture: Texture): void; + /** + * Tracks texture memory explicitly, updating counts and byte tracking. + * + * @param {Texture} texture + */ + destroyTexture(texture: Texture): void; + /** + * Tracks attribute memory explicitly, updating counts and byte tracking. + * + * @param {BufferAttribute} attribute + * @param {string} type - type of attribute + * @private + */ + private _createAttribute; + /** + * Tracks a regular attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The attribute to track. + */ + createAttribute(attribute: BufferAttribute): void; + /** + * Tracks an index attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The index attribute to track. + */ + createIndexAttribute(attribute: BufferAttribute): void; + /** + * Tracks a storage attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The storage attribute to track. + */ + createStorageAttribute(attribute: BufferAttribute): void; + /** + * Tracks an indirect storage attribute memory explicitly. + * + * @param {BufferAttribute} attribute - The indirect storage attribute to track. + */ + createIndirectStorageAttribute(attribute: BufferAttribute): void; + /** + * Tracks attribute memory explicitly, updating counts and byte tracking. + * + * @param {BufferAttribute} attribute + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * Tracks a readback buffer memory explicitly. + * + * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. + */ + createReadbackBuffer(readbackBuffer: ReadbackBuffer): void; + /** + * Tracks a readback buffer memory explicitly. + * + * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. + */ + destroyReadbackBuffer(readbackBuffer: ReadbackBuffer): void; + /** + * Tracks a uniform buffer memory explicitly. + * + * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. + */ + createUniformBuffer(uniformBuffer: UniformBuffer): void; + /** + * Tracks a uniform buffer memory explicitly. + * + * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. + */ + destroyUniformBuffer(uniformBuffer: UniformBuffer): void; + /** + * Tracks program memory explicitly, updating counts and byte tracking. + * + * @param {ProgrammableStage} program - The program to track. + */ + createProgram(program: ProgrammableStage): void; + /** + * Tracks program memory explicitly, updating counts and byte tracking. + * + * @param {Object} program - The program to track. + */ + destroyProgram(program: Object): void; + /** + * Calculates the memory size of a texture in bytes. + * + * @param {Texture} texture - The texture to calculate the size for. + * @return {number} The calculated size in bytes. + * @private + */ + private _getTextureMemorySize; + /** + * Calculates the memory size of an attribute in bytes. + * + * @param {BufferAttribute} attribute - The attribute to calculate the size for. + * @return {number} The calculated size in bytes. + * @private + */ + private _getAttributeMemorySize; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts new file mode 100644 index 000000000..c35ecfabf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts @@ -0,0 +1,122 @@ +export default InspectorBase; +/** + * InspectorBase is the base class for all inspectors. + * + * @augments EventDispatcher + */ +declare class InspectorBase extends EventDispatcher { + /** + * The renderer associated with this inspector. + * + * @type {WebGLRenderer} + * @private + */ + private _renderer; + /** + * The current frame being processed. + * + * @type {Object} + */ + currentFrame: Object; + /** + * Indicates whether the inspector is running. + * + * @type {boolean} + * @default false + */ + isRunning: boolean; + /** + * Indicates whether the inspector is enabled. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * Returns the node frame for the current renderer. + * + * @return {Object} The node frame. + */ + get nodeFrame(): Object; + /** + * Sets the renderer for this inspector. + * + * @param {WebGLRenderer} renderer - The renderer to associate with this inspector. + * @return {InspectorBase} This inspector instance. + */ + setRenderer(renderer: WebGLRenderer): InspectorBase; + /** + * Returns the renderer associated with this inspector. + * + * @return {WebGLRenderer} The associated renderer. + */ + getRenderer(): WebGLRenderer; + /** + * Initializes the inspector. + */ + init(): void; + /** + * Called when a frame begins. + */ + begin(): void; + /** + * Called when a frame ends. + */ + finish(): void; + /** + * Inspects a node. + * + * @param {Node} node - The node to inspect. + */ + inspect(): void; + /** + * When a compute operation is performed. + * + * @param {ComputeNode} computeNode - The compute node being executed. + * @param {number|Array} dispatchSizeOrCount - The dispatch size or count. + */ + computeAsync(): void; + /** + * Called when a compute operation begins. + * + * @param {string} uid - A unique identifier for the render context. + * @param {ComputeNode} computeNode - The compute node being executed. + */ + beginCompute(): void; + /** + * Called when a compute operation ends. + * + * @param {string} uid - A unique identifier for the render context. + * @param {ComputeNode} computeNode - The compute node being executed. + */ + finishCompute(): void; + /** + * Called when a render operation begins. + * + * @param {string} uid - A unique identifier for the render context. + * @param {Scene} scene - The scene being rendered. + * @param {Camera} camera - The camera being used for rendering. + * @param {?WebGLRenderTarget} renderTarget - The render target, if any. + */ + beginRender(): void; + /** + * Called when an animation loop ends. + * + * @param {string} uid - A unique identifier for the render context. + */ + finishRender(): void; + /** + * Called when a texture copy operation is performed. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + */ + copyTextureToTexture(): void; + /** + * Called when a framebuffer copy operation is performed. + * + * @param {Texture} framebufferTexture - The texture associated with the framebuffer. + */ + copyFramebufferToTexture(): void; +} +import { EventDispatcher } from '../../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts new file mode 100644 index 000000000..ae4011fdf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts @@ -0,0 +1,65 @@ +export default Lighting; +/** + * This renderer module manages the lights nodes which are unique + * per scene + camera + lighting combination. + * + * The lights node itself is later configured in the render list + * with the actual lights from the scene. + * + * @private + */ +declare class Lighting { + /** + * Whether this lighting manager is enabled or not. + * + * @type {boolean} + * @default true + */ + enabled: boolean; + /** + * A stack of light arrays saved per render via {@link Lighting#beginRender}. + * + * @private + * @type {Array>} + */ + private _cache; + /** + * A map of lights nodes per scene. + * + * @private + * @type {WeakMap} + */ + private _lightsNodeMap; + /** + * Creates a new lights node for the given array of lights. + * + * @param {Array} lights - The render object. + * @return {LightsNode} The lights node. + */ + createNode(lights?: Array): LightsNode; + /** + * Returns a lights node for the given scene. + * + * @param {Scene} scene - The scene. + * @return {LightsNode} The lights node. + */ + getNode(scene: Scene): LightsNode; + /** + * Saves the current lights of the scene's lights node so they can be restored + * in {@link Lighting#finishRender}. Must be paired with a `finishRender()` call + * to avoid memory leaks. + * + * Nested render calls might mutate the lights array so a save/restore is required + * for each render call. + * + * @param {Scene} scene - The scene. + */ + beginRender(scene: Scene): void; + /** + * Restores the lights saved by the matching {@link Lighting#beginRender} call. + * + * @param {Scene} scene - The scene. + */ + finishRender(scene: Scene): void; +} +import { LightsNode } from '../../nodes/Nodes.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts new file mode 100644 index 000000000..db30b30a6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts @@ -0,0 +1,28 @@ +export default Pipeline; +/** + * Abstract class for representing pipelines. + * + * @private + * @abstract + */ +declare class Pipeline { + /** + * Constructs a new pipeline. + * + * @param {string} cacheKey - The pipeline's cache key. + */ + constructor(cacheKey: string); + /** + * The pipeline's cache key. + * + * @type {string} + */ + cacheKey: string; + /** + * How often the pipeline is currently in use. + * + * @type {number} + * @default 0 + */ + usedTimes: number; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts new file mode 100644 index 000000000..f314e54f4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts @@ -0,0 +1,176 @@ +export default Pipelines; +/** + * This renderer module manages the pipelines of the renderer. + * + * @private + * @augments DataMap + */ +declare class Pipelines extends DataMap { + /** + * Constructs a new pipeline management component. + * + * @param {Backend} backend - The renderer's backend. + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(backend: Backend, nodes: NodeManager, info: Info); + /** + * The renderer's backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * Renderer component for managing nodes related logic. + * + * @type {NodeManager} + */ + nodes: NodeManager; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * A references to the bindings management component. + * This reference will be set inside the `Bindings` + * constructor. + * + * @type {?Bindings} + * @default null + */ + bindings: Bindings | null; + /** + * Internal cache for maintaining pipelines. + * The key of the map is a cache key, the value the pipeline. + * + * @type {Map} + */ + caches: Map; + /** + * This dictionary maintains for each shader stage type (vertex, + * fragment and compute) the programmable stage objects which + * represent the actual shader code. + * + * @type {Object>} + */ + programs: { + [x: string]: Map; + }; + /** + * Returns a compute pipeline for the given compute node. + * + * @param {Node} computeNode - The compute node. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - An array of compilation promises which is only relevant in context of `Renderer.compileComputeAsync()`. + * @return {ComputePipeline} The compute pipeline. + */ + getForCompute(computeNode: Node, bindings: Array, promises?: Array> | null): ComputePipeline; + /** + * Returns a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {?Array} [promises=null] - An array of compilation promises which is only relevant in context of `Renderer.compileAsync()`. + * @return {RenderObjectPipeline} The render pipeline. + */ + getForRender(renderObject: RenderObject, promises?: Array> | null): RenderObjectPipeline; + /** + * Checks if the render pipeline for the given render object is ready for drawing. + * Returns false if the GPU pipeline is still being compiled asynchronously. + * + * @param {RenderObject} renderObject - The render object. + * @return {boolean} True if the pipeline is ready for drawing. + */ + isReady(renderObject: RenderObject): boolean; + /** + * Deletes the pipeline for the given render object. + * + * @param {RenderObject} object - The render object. + * @return {?Object} The deleted dictionary. + */ + delete(object: RenderObject): Object | null; + /** + * Updates the pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateForRender(renderObject: RenderObject): void; + /** + * Returns a compute pipeline for the given parameters. + * + * @private + * @param {Node} computeNode - The compute node. + * @param {ProgrammableStage} stageCompute - The programmable stage representing the compute shader. + * @param {string} cacheKey - The cache key. + * @param {Array} bindings - The bindings. + * @param {?Array} promises - An array of compilation promises which is only relevant in context of `Renderer.compileComputeAsync()`. + * @return {ComputePipeline} The compute pipeline. + */ + private _getComputePipeline; + /** + * Returns a render pipeline for the given parameters. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {ProgrammableStage} stageVertex - The programmable stage representing the vertex shader. + * @param {ProgrammableStage} stageFragment - The programmable stage representing the fragment shader. + * @param {string} cacheKey - The cache key. + * @param {?Array} promises - An array of compilation promises which is only relevant in context of `Renderer.compileAsync()`. + * @return {RenderObjectPipeline} The render pipeline. + */ + private _getRenderPipeline; + /** + * Computes a cache key representing a compute pipeline. + * + * @private + * @param {Node} computeNode - The compute node. + * @param {ProgrammableStage} stageCompute - The programmable stage representing the compute shader. + * @return {string} The cache key. + */ + private _getComputeCacheKey; + /** + * Computes a cache key representing a render pipeline. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {ProgrammableStage} stageVertex - The programmable stage representing the vertex shader. + * @param {ProgrammableStage} stageFragment - The programmable stage representing the fragment shader. + * @return {string} The cache key. + */ + private _getRenderCacheKey; + /** + * Releases the given pipeline. + * + * @private + * @param {Pipeline} pipeline - The pipeline to release. + */ + private _releasePipeline; + /** + * Releases the shader program. + * + * @private + * @param {Object} program - The shader program to release. + */ + private _releaseProgram; + /** + * Returns `true` if the compute pipeline for the given compute node requires an update. + * + * @private + * @param {Node} computeNode - The compute node. + * @return {boolean} Whether the compute pipeline for the given compute node requires an update or not. + */ + private _needsComputeUpdate; + /** + * Returns `true` if the render pipeline for the given render object requires an update. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether the render object for the given render object requires an update or not. + */ + private _needsRenderUpdate; +} +import DataMap from './DataMap.js'; +import ProgrammableStage from './ProgrammableStage.js'; +import ComputePipeline from './ComputePipeline.js'; +import RenderObjectPipeline from './RenderObjectPipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts new file mode 100644 index 000000000..7bf242f58 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts @@ -0,0 +1,17 @@ +export default PostProcessing; +/** + * @deprecated since r183. Use {@link RenderPipeline} instead. PostProcessing has been renamed to RenderPipeline. + * + * This class is a wrapper for backward compatibility and will be removed in a future version. + */ +declare class PostProcessing extends RenderPipeline { + /** + * Constructs a new post processing management module. + * + * @param {Renderer} renderer - A reference to the renderer. + * @param {Node} outputNode - An optional output node. + * @deprecated since r183. Use {@link RenderPipeline} instead. + */ + constructor(renderer: Renderer, outputNode: Node); +} +import RenderPipeline from './RenderPipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts new file mode 100644 index 000000000..5fdbd4d68 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts @@ -0,0 +1,64 @@ +export default ProgrammableStage; +/** + * Class for representing programmable stages which are vertex, + * fragment or compute shaders. Unlike fixed-function states (like blending), + * they represent the programmable part of a pipeline. + * + * @private + */ +declare class ProgrammableStage { + /** + * Constructs a new programmable stage. + * + * @param {string} code - The shader code. + * @param {('vertex'|'fragment'|'compute')} stage - The type of stage. + * @param {string} name - The name of the shader. + * @param {?Array} [transforms=null] - The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + * @param {?Array} [attributes=null] - The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + */ + constructor(code: string, stage: ("vertex" | "fragment" | "compute"), name: string, transforms?: Array | null, attributes?: Array | null); + /** + * The id of the programmable stage. + * + * @type {number} + */ + id: number; + /** + * The shader code. + * + * @type {string} + */ + code: string; + /** + * The type of stage. + * + * @type {string} + */ + stage: string; + /** + * The name of the stage. + * This is used for debugging purposes. + * + * @type {string} + */ + name: string; + /** + * The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + * + * @type {?Array} + */ + transforms: Array | null; + /** + * The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). + * + * @type {?Array} + */ + attributes: Array | null; + /** + * How often the programmable stage is currently in use. + * + * @type {number} + * @default 0 + */ + usedTimes: number; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts new file mode 100644 index 000000000..8bf6f8261 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts @@ -0,0 +1,52 @@ +export default QuadMesh; +/** + * This module is a helper for passes which need to render a full + * screen effect which is quite common in context of post processing. + * + * The intended usage is to reuse a single quad mesh for rendering + * subsequent passes by just reassigning the `material` reference. + * + * Note: This module can only be used with `WebGPURenderer`. + * + * @augments Mesh + */ +declare class QuadMesh extends Mesh { + /** + * Constructs a new quad mesh. + * + * @param {NodeMaterial} material - The material to render the quad mesh with. + */ + constructor(material: NodeMaterial); + /** + * The camera to render the quad mesh with. + * + * @type {OrthographicCamera} + * @readonly + */ + readonly camera: OrthographicCamera; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isQuadMesh: boolean; + /** + * Async version of `render()`. + * + * @async + * @deprecated + * @param {Renderer} renderer - The renderer. + * @return {Promise} A Promise that resolves when the render has been finished. + */ + renderAsync(renderer: Renderer): Promise; + /** + * Renders the quad mesh + * + * @param {Renderer} renderer - The renderer. + */ + render(renderer: Renderer): void; +} +import { Mesh } from '../../objects/Mesh.js'; +import { OrthographicCamera } from '../../cameras/OrthographicCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts new file mode 100644 index 000000000..70218d55a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts @@ -0,0 +1,55 @@ +export default ReadbackBuffer; +/** + * A readback buffer is used to transfer data from the GPU to the CPU. + * It is primarily used to read back compute shader results. + * + * @augments EventDispatcher + */ +declare class ReadbackBuffer extends EventDispatcher { + /** + * Constructs a new readback buffer. + * + * @param {number} maxByteLength - The maximum size of the buffer to be read back. + */ + constructor(maxByteLength: number); + /** + * Name used for debugging purposes. + * + * @type {string} + */ + name: string; + /** + * The mapped, read back array buffer. + * + * @type {ArrayBuffer|null} + */ + buffer: ArrayBuffer | null; + /** + * The maximum size of the buffer to be read back. + * + * @type {number} + */ + maxByteLength: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isReadbackBuffer: boolean; + _mapped: boolean; + /** + * Releases the mapped buffer data so the GPU buffer can be + * used by the GPU again. + * + * Note: Any `ArrayBuffer` data associated with this readback buffer + * are removed and no longer accessible after calling this method. + */ + release(): void; + /** + * Frees internal resources. + */ + dispose(): void; +} +import { EventDispatcher } from '../../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts new file mode 100644 index 000000000..aca8cbee1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts @@ -0,0 +1,20 @@ +export default RenderBundle; +/** + * This module is used to represent render bundles inside the renderer + * for further processing. + * + * @private + */ +declare class RenderBundle { + /** + * Constructs a new bundle group. + * + * @param {BundleGroup} bundleGroup - The bundle group. + * @param {Camera} camera - The camera the bundle group is rendered with. + * @param {RenderContext} renderContext - The render context the bundle is rendered with. + */ + constructor(bundleGroup: BundleGroup, camera: Camera, renderContext: RenderContext); + bundleGroup: BundleGroup; + camera: Camera; + renderContext: RenderContext; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts new file mode 100644 index 000000000..ec46ba6ca --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts @@ -0,0 +1,29 @@ +export default RenderBundles; +/** + * This renderer module manages render bundles. + * + * @private + */ +declare class RenderBundles { + /** + * A chain map for maintaining the render bundles. + * + * @type {ChainMap} + */ + bundles: ChainMap; + /** + * Returns a render bundle for the given bundle group and camera. + * + * @param {BundleGroup} bundleGroup - The bundle group. + * @param {Camera} camera - The camera the bundle group is rendered with. + * @param {RenderContext} renderContext - The render context the bundle is rendered with. + * @return {RenderBundle} The render bundle. + */ + get(bundleGroup: BundleGroup, camera: Camera, renderContext: RenderContext): RenderBundle; + /** + * Frees all internal resources. + */ + dispose(): void; +} +import ChainMap from './ChainMap.js'; +import RenderBundle from './RenderBundle.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts new file mode 100644 index 000000000..514d3ddc3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts @@ -0,0 +1,228 @@ +/** + * Computes a cache key for the given render context. This key + * should identify the render target state so it is possible to + * configure the correct attachments in the respective backend. + * + * @param {RenderContext} renderContext - The render context. + * @return {number} The cache key. + */ +export function getCacheKey(renderContext: RenderContext): number; +export default RenderContext; +/** + * Any render or compute command is executed in a specific context that defines + * the state of the renderer and its backend. Typical examples for such context + * data are the current clear values or data from the active framebuffer. This + * module is used to represent these contexts as objects. + * + * @private + */ +declare class RenderContext { + /** + * The context's ID. + * + * @type {number} + */ + id: number; + /** + * The MRT configuration. + * + * @type {?MRTNode} + * @default null + */ + mrt: MRTNode | null; + /** + * Whether the current active framebuffer has a color attachment. + * + * @type {boolean} + * @default true + */ + color: boolean; + /** + * Whether the color attachment should be cleared or not. + * + * @type {boolean} + * @default true + */ + clearColor: boolean; + /** + * The clear color value. + * + * @type {Object} + * @default true + */ + clearColorValue: Object; + /** + * Whether the current active framebuffer has a depth attachment. + * + * @type {boolean} + * @default true + */ + depth: boolean; + /** + * Whether the depth attachment should be cleared or not. + * + * @type {boolean} + * @default true + */ + clearDepth: boolean; + /** + * The clear depth value. + * + * @type {number} + * @default 1 + */ + clearDepthValue: number; + /** + * Whether the current active framebuffer has a stencil attachment. + * + * @type {boolean} + * @default false + */ + stencil: boolean; + /** + * Whether the stencil attachment should be cleared or not. + * + * @type {boolean} + * @default true + */ + clearStencil: boolean; + /** + * The clear stencil value. + * + * @type {number} + * @default 1 + */ + clearStencilValue: number; + /** + * By default the viewport encloses the entire framebuffer If a smaller + * viewport is manually defined, this property is to `true` by the renderer. + * + * @type {boolean} + * @default false + */ + viewport: boolean; + /** + * The viewport value. This value is in physical pixels meaning it incorporates + * the renderer's pixel ratio. The viewport property of render targets or + * the renderer is in logical pixels. + * + * @type {Vector4} + */ + viewportValue: Vector4; + /** + * When the scissor test is active and scissor rectangle smaller than the + * framebuffers dimensions, this property is to `true` by the renderer. + * + * @type {boolean} + * @default false + */ + scissor: boolean; + /** + * The scissor rectangle. + * + * @type {Vector4} + */ + scissorValue: Vector4; + /** + * The active render target. + * + * @type {?RenderTarget} + * @default null + */ + renderTarget: RenderTarget | null; + /** + * The textures of the active render target. + * `null` when no render target is set. + * + * @type {?Array} + * @default null + */ + textures: Array | null; + /** + * The depth texture of the active render target. + * `null` when no render target is set. + * + * @type {?DepthTexture} + * @default null + */ + depthTexture: DepthTexture | null; + /** + * The active cube face. + * + * @type {number} + * @default 0 + */ + activeCubeFace: number; + /** + * The active mipmap level. + * + * @type {number} + * @default 0 + */ + activeMipmapLevel: number; + /** + * The number of MSAA samples. This value is always `1` when + * MSAA isn't used. + * + * @type {number} + * @default 1 + */ + sampleCount: number; + /** + * The active render target's width in physical pixels. + * + * @type {number} + * @default 0 + */ + width: number; + /** + * The active render target's height in physical pixels. + * + * @type {number} + * @default 0 + */ + height: number; + /** + * The occlusion query count. + * + * @type {number} + * @default 0 + */ + occlusionQueryCount: number; + /** + * The current clipping context. + * + * @type {?ClippingContext} + * @default null + */ + clippingContext: ClippingContext | null; + /** + * The current camera. + * + * @type {?Camera} + * @default null + */ + camera: Camera | null; + /** + * Whether a fullscreen pass is rendered or not. + * + * @type {boolean} + * @default false + */ + fullscreenPass: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderContext: boolean; + /** + * Returns the cache key of this render context. + * + * @return {number} The cache key. + */ + getCacheKey(): number; +} +import { Vector4 } from '../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts new file mode 100644 index 000000000..ff6dfc870 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts @@ -0,0 +1,42 @@ +export default RenderContexts; +/** + * This module manages the render contexts of the renderer. + * + * @private + */ +declare class RenderContexts { + /** + * Constructs a new render context management component. + * + * @param {Renderer} renderer - The renderer. + */ + constructor(renderer: Renderer); + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * A dictionary that manages render contexts. + * + * @type {Object} + */ + _renderContexts: { + [x: string]: RenderContext; + }; + /** + * Returns a render context for the given scene, camera and render target. + * + * @param {?RenderTarget} [renderTarget=null] - The active render target. + * @param {?MRTNode} [mrt=null] - The MRT configuration + * @param {?number} [callDepth=0] - The call depth of the renderer. + * @return {RenderContext} The render context. + */ + get(renderTarget?: RenderTarget | null, mrt?: MRTNode | null, callDepth?: number | null): RenderContext; + /** + * Frees internal resources. + */ + dispose(): void; +} +import RenderContext from './RenderContext.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts new file mode 100644 index 000000000..f341a76ea --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts @@ -0,0 +1,197 @@ +export default RenderList; +/** + * When the renderer analyzes the scene at the beginning of a render call, + * it stores 3D object for further processing in render lists. Depending on the + * properties of a 3D objects (like their transformation or material state), the + * objects are maintained in ordered lists for the actual rendering. + * + * Render lists are unique per scene and camera combination. + * + * @private + * @augments Pipeline + */ +declare class RenderList { + /** + * Constructs a render list. + * + * @param {Lighting} lighting - The lighting management component. + * @param {Scene} scene - The scene. + * @param {Camera} camera - The camera the scene is rendered with. + */ + constructor(lighting: Lighting, scene: Scene, camera: Camera); + /** + * 3D objects are transformed into render items and stored in this array. + * + * @type {Array} + */ + renderItems: Array; + /** + * The current render items index. + * + * @type {number} + * @default 0 + */ + renderItemsIndex: number; + /** + * A list with opaque render items. + * + * @type {Array} + */ + opaque: Array; + /** + * A list with transparent render items which require + * double pass rendering (e.g. transmissive objects). + * + * @type {Array} + */ + transparentDoublePass: Array; + /** + * A list with transparent render items. + * + * @type {Array} + */ + transparent: Array; + /** + * A list with transparent render bundle data. + * + * @type {Array} + */ + bundles: Array; + /** + * The lighting management component. + * + * @type {Lighting} + */ + lighting: Lighting; + /** + * The render list's lights node. This node is later + * relevant for the actual analytical light nodes which + * compute the scene's lighting in the shader. + * + * @type {LightsNode} + */ + lightsNode: LightsNode; + /** + * The scene's lights stored in an array. This array + * is used to setup the lights node. + * + * @type {Array} + */ + lightsArray: Array; + /** + * The scene. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera the scene is rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * How many objects perform occlusion query tests. + * + * @type {number} + * @default 0 + */ + occlusionQueryCount: number; + /** + * The ID of the frame the render list was last used in. + * + * @type {number} + * @default -1 + */ + frameId: number; + /** + * The last object that was counted for occlusion query testing. Used to + * avoid counting an object more than once when it produces multiple render + * items (e.g. a mesh with multiple material groups), since such an object + * is covered by a single occlusion query. + * + * @private + * @type {?Object3D} + * @default null + */ + private _lastOcclusionObject; + /** + * This method is called right at the beginning of a render call + * before the scene is analyzed. It prepares the internal data + * structures for the upcoming render lists generation. + * + * @return {RenderList} A reference to this render list. + */ + begin(): RenderList; + /** + * Returns a render item for the giving render item state. The state is defined + * by a series of object-related parameters. + * + * The method avoids object creation by holding render items and reusing them in + * subsequent render calls (just with different property values). + * + * @param {Object3D} object - The 3D object. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Material} material - The 3D object's material. + * @param {number} groupOrder - The current group order. + * @param {number} z - Th 3D object's depth value (z value in clip space). + * @param {?number} group - {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {ClippingContext} clippingContext - The current clipping context. + * @return {Object} The render item. + */ + getNextRenderItem(object: Object3D, geometry: BufferGeometry, material: Material, groupOrder: number, z: number, group: number | null, clippingContext: ClippingContext): Object; + /** + * Pushes the given object as a render item to the internal render lists. + * The selected lists depend on the object properties. + * + * @param {Object3D} object - The 3D object. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Material} material - The 3D object's material. + * @param {number} groupOrder - The current group order. + * @param {number} z - Th 3D object's depth value (z value in clip space). + * @param {?number} group - {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {ClippingContext} clippingContext - The current clipping context. + */ + push(object: Object3D, geometry: BufferGeometry, material: Material, groupOrder: number, z: number, group: number | null, clippingContext: ClippingContext): void; + /** + * Inserts the given object as a render item at the start of the internal render lists. + * The selected lists depend on the object properties. + * + * @param {Object3D} object - The 3D object. + * @param {BufferGeometry} geometry - The 3D object's geometry. + * @param {Material} material - The 3D object's material. + * @param {number} groupOrder - The current group order. + * @param {number} z - Th 3D object's depth value (z value in clip space). + * @param {?number} group - {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {ClippingContext} clippingContext - The current clipping context. + */ + unshift(object: Object3D, geometry: BufferGeometry, material: Material, groupOrder: number, z: number, group: number | null, clippingContext: ClippingContext): void; + /** + * Pushes render bundle group data into the render list. + * + * @param {Object} group - Bundle group data. + */ + pushBundle(group: Object): void; + /** + * Pushes a light into the render list. + * + * @param {Light} light - The light. + */ + pushLight(light: Light): void; + /** + * Sorts the internal render lists. + * + * @param {?function(any, any): number} customOpaqueSort - A custom sort function for opaque objects. + * @param {?function(any, any): number} customTransparentSort - A custom sort function for transparent objects. + */ + sort(customOpaqueSort: ((arg0: any, arg1: any) => number) | null, customTransparentSort: ((arg0: any, arg1: any) => number) | null): void; + /** + * This method performs finalizing tasks right after the render lists + * have been generated. + */ + finish(): void; + /** + * This method is called when the render list has become inactive. + */ + clear(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts new file mode 100644 index 000000000..983aeccef --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts @@ -0,0 +1,51 @@ +export default RenderLists; +/** + * This renderer module manages the render lists which are unique + * per scene and camera combination. + * + * @private + */ +declare class RenderLists { + /** + * The internal chain map which holds the render lists. + * + * @type {ChainMap} + */ + lists: ChainMap; + /** + * The render lists which are currently in use. Lists are removed + * as soon as they become stale. + * + * @private + * @type {Set} + */ + private _activeLists; + /** + * The current frame ID. + * + * @private + * @type {number} + */ + private _frameId; + /** + * Returns a render list for the given scene and camera. + * + * @param {Scene} scene - The scene. + * @param {Camera} camera - The camera. + * @param {Lighting} lighting - The lighting manager. + * @return {RenderList} The render list. + */ + get(scene: Scene, camera: Camera, lighting: Lighting): RenderList; + /** + * Must be called when a new frame begins. + * + * @param {number} frameId - The current frame ID. + */ + update(frameId: number): void; + /** + * Frees all internal resources. + */ + dispose(): void; +} +import ChainMap from './ChainMap.js'; +import RenderList from './RenderList.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts new file mode 100644 index 000000000..90f05d5b8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts @@ -0,0 +1,425 @@ +export default RenderObject; +/** + * A render object is the renderer's representation of single entity that gets drawn + * with a draw command. There is no unique mapping of render objects to 3D objects in the + * scene since render objects also depend from the used material, the current render context + * and the current scene's lighting. + * + * In general, the basic process of the renderer is: + * + * - Analyze the 3D objects in the scene and generate render lists containing render items. + * - Process the render lists by calling one or more render commands for each render item. + * - For each render command, request a render object and perform the draw. + * + * The module provides an interface to get data required for the draw command like the actual + * draw parameters or vertex buffers. It also holds a series of caching related methods since + * creating render objects should only be done when necessary. + * + * @private + */ +declare class RenderObject { + /** + * Constructs a new render object. + * + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + * @param {Geometries} geometries - Renderer component for managing geometries. + * @param {Renderer} renderer - The renderer. + * @param {Object3D} object - The 3D object. + * @param {Material} material - The 3D object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {LightsNode} lightsNode - The lights node. + * @param {RenderContext} renderContext - The render context. + * @param {ClippingContext} clippingContext - The clipping context. + */ + constructor(nodes: NodeManager, geometries: Geometries, renderer: Renderer, object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext); + id: number; + /** + * Renderer component for managing nodes related logic. + * + * @type {NodeManager} + * @private + */ + private _nodes; + /** + * Renderer component for managing geometries. + * + * @type {Geometries} + * @private + */ + private _geometries; + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * The 3D object. + * + * @type {Object3D} + */ + object: Object3D; + /** + * The 3D object's material. + * + * @type {Material} + */ + material: Material; + /** + * The scene the 3D object belongs to. + * + * @type {Scene} + */ + scene: Scene; + /** + * The camera the 3D object should be rendered with. + * + * @type {Camera} + */ + camera: Camera; + /** + * The lights node. + * + * @type {LightsNode} + */ + lightsNode: LightsNode; + /** + * The render context. + * + * @type {RenderContext} + */ + context: RenderContext; + /** + * The 3D object's geometry. + * + * @type {BufferGeometry} + */ + geometry: BufferGeometry; + /** + * The render object's version. + * + * @type {number} + */ + version: number; + /** + * The draw range of the geometry. + * + * @type {?Object} + * @default null + */ + drawRange: Object | null; + /** + * An array holding the buffer attributes + * of the render object. This entails attribute + * definitions on geometry and node level. + * + * @type {?Array} + * @default null + */ + attributes: Array | null; + /** + * An object holding the version of the + * attributes. The keys are the attribute names + * and the values are the attribute versions. + * + * @type {?Object} + * @default null + */ + attributesId: { + [x: string]: number; + } | null; + /** + * A reference to a render pipeline the render + * object is processed with. + * + * @type {RenderPipeline} + * @default null + */ + pipeline: RenderPipeline; + /** + * Only relevant for objects using + * multiple materials. This represents a group entry + * from the respective `BufferGeometry`. + * + * @type {?{start: number, count: number}} + * @default null + */ + group: { + start: number; + count: number; + } | null; + /** + * An array holding the vertex buffers which can + * be buffer attributes but also interleaved buffers. + * + * @type {?Array} + * @default null + */ + vertexBuffers: Array | null; + /** + * The parameters for the draw command. + * + * @type {?Object} + * @default null + */ + drawParams: Object | null; + /** + * If this render object is used inside a render bundle, + * this property points to the respective bundle group. + * + * @type {?BundleGroup} + * @default null + */ + bundle: BundleGroup | null; + /** + * The clipping context. + * + * @type {ClippingContext} + */ + clippingContext: ClippingContext; + /** + * The clipping context's cache key. + * + * @type {string} + */ + clippingContextCacheKey: string; + /** + * The initial node cache key. + * + * @type {number} + */ + initialNodesCacheKey: number; + /** + * The initial cache key. + * + * @type {number} + */ + initialCacheKey: number; + /** + * The node builder state. + * + * @type {?NodeBuilderState} + * @private + * @default null + */ + private _nodeBuilderState; + /** + * An array of bindings. + * + * @type {?Array} + * @private + * @default null + */ + private _bindings; + /** + * Reference to the node material observer. + * + * @type {?NodeMaterialObserver} + * @private + * @default null + */ + private _monitor; + /** + * The object's original material when this render object is drawn with an + * override material. + * + * @type {?Material} + * @private + * @default null + */ + private _sourceMaterial; + /** + * An event listener which is defined by `RenderObjects`. It performs + * clean up tasks when `dispose()` on this render object. + * + * @method + */ + onDispose: any; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderObject: boolean; + /** + * An event listener which is executed when `dispose()` is called on + * the material of this render object. + * + * @method + */ + onMaterialDispose: () => void; + /** + * An event listener which is executed when `dispose()` is called on + * the geometry of this render object. + * + * @method + */ + onGeometryDispose: () => void; + /** + * An event listener which is executed when `dispose()` is called on + * the 3D object of this render object. + * + * @method + */ + onObjectDispose: () => void; + /** + * Updates the clipping context. + * + * @param {ClippingContext} context - The clipping context to set. + */ + updateClipping(context: ClippingContext): void; + /** + * Whether the clipping requires an update or not. + * + * @type {boolean} + * @readonly + */ + readonly get clippingNeedsUpdate(): boolean; + /** + * The number of clipping planes defined in context of hardware clipping. + * + * @type {number} + * @readonly + */ + readonly get hardwareClippingPlanes(): number; + /** + * Returns the node builder state of this render object. + * + * @return {NodeBuilderState} The node builder state. + */ + getNodeBuilderState(): NodeBuilderState; + /** + * Returns the node material observer of this render object. + * + * @return {NodeMaterialObserver} The node material observer. + */ + getMonitor(): NodeMaterialObserver; + /** + * Returns an array of bind groups of this render object. + * + * @return {Array} The bindings. + */ + getBindings(): Array; + /** + * Returns a binding group by group name of this render object. + * + * @param {string} name - The name of the binding group. + * @return {?BindGroup} The bindings. + */ + getBindingGroup(name: string): BindGroup | null; + /** + * Returns the index of the render object's geometry. + * + * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. + */ + getIndex(): BufferAttribute | null; + /** + * Returns the indirect buffer attribute. + * + * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. + */ + getIndirect(): BufferAttribute | null; + /** + * Returns the byte offset into the indirect attribute buffer. + * + * @return {number|Array} The byte offset into the indirect attribute buffer. + */ + getIndirectOffset(): number | Array; + /** + * Returns an array that acts as a key for identifying the render object in a chain map. + * + * @return {Array} An array with object references. + */ + getChainArray(): Array; + /** + * This method is used when the geometry of a 3D object has been exchanged and the + * respective render object now requires an update. + * + * @param {BufferGeometry} geometry - The geometry to set. + */ + setGeometry(geometry: BufferGeometry): void; + /** + * Returns the buffer attributes of the render object. The returned array holds + * attribute definitions on geometry and node level. + * + * @return {Array} An array with buffer attributes. + */ + getAttributes(): Array; + /** + * Returns the vertex buffers of the render object. + * + * @return {Array} An array with buffer attribute or interleaved buffers. + */ + getVertexBuffers(): Array; + /** + * Returns the draw parameters for the render object. + * + * @return {?{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} The draw parameters. + */ + getDrawParameters(): { + vertexCount: number; + firstVertex: number; + instanceCount: number; + firstInstance: number; + } | null; + /** + * Returns the render object's geometry cache key. + * + * The geometry cache key is part of the material cache key. + * + * @return {string} The geometry cache key. + */ + getGeometryCacheKey(): string; + /** + * Returns the render object's material cache key. + * + * The material cache key is part of the render object cache key. + * + * @return {number} The material cache key. + */ + getMaterialCacheKey(): number; + /** + * Whether the geometry requires an update or not. + * + * @type {boolean} + * @readonly + */ + readonly get needsGeometryUpdate(): boolean; + /** + * Whether the render object requires an update or not. + * + * Note: There are two distinct places where render objects are checked for an update. + * + * 1. In `RenderObjects.get()` which is executed when the render object is request. This + * method checks the `needsUpdate` flag and recreates the render object if necessary. + * 2. In `Renderer._renderObjectDirect()` right after getting the render object via + * `RenderObjects.get()`. The render object's NodeMaterialObserver is then used to detect + * a need for a refresh due to material, geometry or object related value changes. + * + * TODO: Investigate if it's possible to merge both steps so there is only a single place + * that performs the 'needsUpdate' check. + * + * @type {boolean} + * @readonly + */ + readonly get needsUpdate(): boolean; + /** + * Returns the dynamic cache key which represents a key that is computed per draw command. + * + * @return {number} The cache key. + */ + getDynamicCacheKey(): number; + /** + * Returns the render object's cache key. + * + * @return {number} The cache key. + */ + getCacheKey(): number; + /** + * Frees internal resources. + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts new file mode 100644 index 000000000..d9631c32e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts @@ -0,0 +1,30 @@ +export default RenderObjectPipeline; +/** + * Class for representing render pipelines. + * + * @private + * @augments Pipeline + */ +declare class RenderObjectPipeline extends Pipeline { + /** + * Constructs a new render object pipeline. + * + * @param {string} cacheKey - The pipeline's cache key. + * @param {ProgrammableStage} vertexProgram - The pipeline's vertex shader. + * @param {ProgrammableStage} fragmentProgram - The pipeline's fragment shader. + */ + constructor(cacheKey: string, vertexProgram: ProgrammableStage, fragmentProgram: ProgrammableStage); + /** + * The pipeline's vertex shader. + * + * @type {ProgrammableStage} + */ + vertexProgram: ProgrammableStage; + /** + * The pipeline's fragment shader. + * + * @type {ProgrammableStage} + */ + fragmentProgram: ProgrammableStage; +} +import Pipeline from './Pipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts new file mode 100644 index 000000000..fcb34a2e6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts @@ -0,0 +1,108 @@ +export default RenderObjects; +/** + * This module manages the render objects of the renderer. + * + * @private + */ +declare class RenderObjects { + /** + * Constructs a new render object management component. + * + * @param {Renderer} renderer - The renderer. + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + * @param {Geometries} geometries - Renderer component for managing geometries. + * @param {Pipelines} pipelines - Renderer component for managing pipelines. + * @param {Bindings} bindings - Renderer component for managing bindings. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(renderer: Renderer, nodes: NodeManager, geometries: Geometries, pipelines: Pipelines, bindings: Bindings, info: Info); + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * Renderer component for managing nodes related logic. + * + * @type {NodeManager} + */ + nodes: NodeManager; + /** + * Renderer component for managing geometries. + * + * @type {Geometries} + */ + geometries: Geometries; + /** + * Renderer component for managing pipelines. + * + * @type {Pipelines} + */ + pipelines: Pipelines; + /** + * Renderer component for managing bindings. + * + * @type {Bindings} + */ + bindings: Bindings; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * A dictionary that manages render contexts in chain maps + * for each pass ID. + * + * @type {Object} + */ + chainMaps: { + [x: string]: ChainMap; + }; + /** + * Returns a render object for the given object and state data. + * + * @param {Object3D} object - The 3D object. + * @param {Material} material - The 3D object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the 3D object should be rendered with. + * @param {LightsNode} lightsNode - The lights node. + * @param {RenderContext} renderContext - The render context. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {string} [passId] - An optional ID for identifying the pass. + * @return {RenderObject} The render object. + */ + get(object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext, passId?: string): RenderObject; + /** + * Returns a chain map for the given pass ID. + * + * @param {string} [passId='default'] - The pass ID. + * @return {ChainMap} The chain map. + */ + getChainMap(passId?: string): ChainMap; + /** + * Frees internal resources. + */ + dispose(): void; + /** + * Factory method for creating render objects with the given list of parameters. + * + * @param {NodeManager} nodes - Renderer component for managing nodes related logic. + * @param {Geometries} geometries - Renderer component for managing geometries. + * @param {Renderer} renderer - The renderer. + * @param {Object3D} object - The 3D object. + * @param {Material} material - The object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {LightsNode} lightsNode - The lights node. + * @param {RenderContext} renderContext - The render context. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {string} [passId] - An optional ID for identifying the pass. + * @return {RenderObject} The render object. + */ + createRenderObject(nodes: NodeManager, geometries: Geometries, renderer: Renderer, object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext, passId?: string): RenderObject; +} +import ChainMap from './ChainMap.js'; +import RenderObject from './RenderObject.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts new file mode 100644 index 000000000..b0528c37e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts @@ -0,0 +1,133 @@ +export default RenderPipeline; +/** + * This module is responsible to manage the rendering pipeline setups in apps. + * You usually create a single instance of this class and use it to define + * the output of your render pipeline and post processing effect chain. + * ```js + * const renderPipeline = new RenderPipeline( renderer ); + * + * const scenePass = pass( scene, camera ); + * + * renderPipeline.outputNode = scenePass; + * ``` + * + * Note: This module can only be used with `WebGPURenderer`. + */ +declare class RenderPipeline { + /** + * Constructs a new render pipeline management module. + * + * @param {Renderer} renderer - A reference to the renderer. + * @param {Node} outputNode - An optional output node. + */ + constructor(renderer: Renderer, outputNode?: Node); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderPipeline: boolean; + /** + * A reference to the renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * A node which defines the final output of the rendering + * pipeline. This is usually the last node in a chain + * of effect nodes. + * + * @type {Node} + */ + outputNode: Node; + /** + * Whether the default output tone mapping and color + * space transformation should be enabled or not. + * + * This is enabled by default but it must be disabled for + * effects that expect to be executed after tone mapping and color + * space conversion. A typical example is FXAA which + * requires sRGB input. + * + * When set to `false`, the app must control the output + * transformation with `RenderOutputNode`. + * + * ```js + * const outputPass = renderOutput( scenePass ); + * ``` + * + * @type {boolean} + */ + outputColorTransform: boolean; + /** + * Must be set to `true` when the output node changes. + * + * @type {Node} + */ + needsUpdate: Node; + /** + * The full screen quad that is used to render + * the effects. + * + * @private + * @type {QuadMesh} + */ + private _quadMesh; + /** + * The context data for the render pipeline. + * + * @private + * @type {?Object} + * @default null + */ + private _contextData; + /** + * The current tone mapping. + * + * @private + * @type {ToneMapping} + */ + private _toneMapping; + /** + * The current output color space. + * + * @private + * @type {ColorSpace} + */ + private _outputColorSpace; + /** + * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, + * the application must use this version of `render()` inside + * its animation loop (not the one from the renderer). + */ + render(): void; + /** + * Frees internal resources. + */ + dispose(): void; + /** + * Updates the context data. + * + * @private + */ + private _updateContext; + /** + * Updates the state of the module. + * + * @private + */ + private _update; + /** + * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, + * the application must use this version of `renderAsync()` inside + * its animation loop (not the one from the renderer). + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the render has been finished. + */ + renderAsync(): Promise; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts new file mode 100644 index 000000000..ef23054d1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts @@ -0,0 +1,1491 @@ +export default Renderer; +/** + * Animation loop parameter of `renderer.setAnimationLoop()`. + */ +export type onAnimationCallback = (time: DOMHighResTimeStamp, frame?: XRFrame) => any; +/** + * Base class for renderers. + */ +declare class Renderer { + /** + * Renderer options. + * + * @typedef {Object} Renderer~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0 + * to overwrite the default. + * @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. + * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best + * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. + * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. + */ + /** + * Constructs a new renderer. + * + * @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2). + * @param {Renderer~Options} [parameters] - The configuration parameter. + + */ + constructor(backend: Backend, parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isRenderer: boolean; + /** + * A reference to the current backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * Whether the renderer should automatically clear the current rendering target + * before execute a `render()` call. The target can be the canvas (default framebuffer) + * or the current bound render target (custom framebuffer). + * + * @type {boolean} + * @default true + */ + autoClear: boolean; + /** + * When `autoClear` is set to `true`, this property defines whether the renderer + * should clear the color buffer. + * + * @type {boolean} + * @default true + */ + autoClearColor: boolean; + /** + * When `autoClear` is set to `true`, this property defines whether the renderer + * should clear the depth buffer. + * + * @type {boolean} + * @default true + */ + autoClearDepth: boolean; + /** + * When `autoClear` is set to `true`, this property defines whether the renderer + * should clear the stencil buffer. + * + * @type {boolean} + * @default true + */ + autoClearStencil: boolean; + /** + * Whether the default framebuffer should be transparent or opaque. + * + * @type {boolean} + * @default true + */ + alpha: boolean; + /** + * Whether logarithmic depth buffer is enabled or not. + * + * @type {boolean} + * @default false + * @readonly + */ + readonly logarithmicDepthBuffer: boolean; + /** + * Whether reversed depth buffer is enabled or not. + * + * @type {boolean} + * @default false + * @readonly + */ + readonly reversedDepthBuffer: boolean; + /** + * Defines the output color space of the renderer. + * + * @type {string} + * @default SRGBColorSpace + */ + outputColorSpace: string; + /** + * Defines the tone mapping of the renderer. + * + * @type {number} + * @default NoToneMapping + */ + toneMapping: number; + /** + * Defines the tone mapping exposure. + * + * @type {number} + * @default 1 + */ + toneMappingExposure: number; + /** + * Whether the renderer should sort its render lists or not. + * + * Note: Sorting is used to attempt to properly render objects that have some degree of transparency. + * By definition, sorting objects may not work in all cases. Depending on the needs of application, + * it may be necessary to turn off sorting and use other methods to deal with transparency rendering + * e.g. manually determining each object's rendering order. + * + * @type {boolean} + * @default true + */ + sortObjects: boolean; + /** + * Whether the default framebuffer should have a depth buffer or not. + * + * @type {boolean} + * @default true + */ + depth: boolean; + /** + * Whether the default framebuffer should have a stencil buffer or not. + * + * @type {boolean} + * @default false + */ + stencil: boolean; + /** + * Holds a series of statistical information about the GPU memory + * and the rendering process. Useful for debugging and monitoring. + * + * @type {Info} + */ + info: Info; + /** + * A global context node that stores override nodes for specific transformations or calculations. + * These nodes can be used to replace default behavior in the rendering pipeline. + * + * @type {ContextNode} + * @property {Object} value - The context value object. + */ + contextNode: ContextNode; + /** + * The node library defines how certain library objects like materials, lights + * or tone mapping functions are mapped to node types. This is required since + * although instances of classes like `MeshBasicMaterial` or `PointLight` can + * be part of the scene graph, they are internally represented as nodes for + * further processing. + * + * @type {NodeLibrary} + */ + library: NodeLibrary; + /** + * A map-like data structure for managing lights. + * + * @type {Lighting} + */ + lighting: Lighting; + /** + * The number of MSAA samples. + * + * @private + * @type {number} + * @default 0 + */ + private _samples; + /** + * Callback when the canvas has been resized. + * + * @private + */ + private _onCanvasTargetResize; + /** + * The canvas target for rendering. + * + * @private + * @type {CanvasTarget} + */ + private _canvasTarget; + /** + * The inspector provides information about the internal renderer state. + * + * @private + * @type {InspectorBase} + */ + private _inspector; + /** + * This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. + * + * @private + * @type {?Function} + */ + private _getFallback; + /** + * A reference to a renderer module for managing shader attributes. + * + * @private + * @type {?Attributes} + * @default null + */ + private _attributes; + /** + * A reference to a renderer module for managing geometries. + * + * @private + * @type {?Geometries} + * @default null + */ + private _geometries; + /** + * A reference to a renderer module for managing node related logic. + * + * @private + * @type {?NodeManager} + * @default null + */ + private _nodes; + /** + * A reference to a renderer module for managing the internal animation loop. + * + * @private + * @type {?Animation} + * @default null + */ + private _animation; + /** + * A reference to a renderer module for managing shader program bindings. + * + * @private + * @type {?Bindings} + * @default null + */ + private _bindings; + /** + * A reference to a renderer module for managing render objects. + * + * @private + * @type {?RenderObjects} + * @default null + */ + private _objects; + /** + * A reference to a renderer module for managing render and compute pipelines. + * + * @private + * @type {?Pipelines} + * @default null + */ + private _pipelines; + /** + * A reference to a renderer module for managing render bundles. + * + * @private + * @type {?RenderBundles} + * @default null + */ + private _bundles; + /** + * A reference to a renderer module for managing render lists. + * + * @private + * @type {?RenderLists} + * @default null + */ + private _renderLists; + /** + * A reference to a renderer module for managing render contexts. + * + * @private + * @type {?RenderContexts} + * @default null + */ + private _renderContexts; + /** + * A reference to a renderer module for managing textures. + * + * @private + * @type {?Textures} + * @default null + */ + private _textures; + /** + * A reference to a renderer module for backgrounds. + * + * @private + * @type {?Background} + * @default null + */ + private _background; + /** + * Cache for the fullscreen quad. + * This fullscreen quad is used for internal render passes + * like the tone mapping and color space output pass. + * + * @private + * @type {Map} + */ + private _quadCache; + /** + * A reference to the current render context. + * + * @private + * @type {?RenderContext} + * @default null + */ + private _currentRenderContext; + /** + * A custom sort function for the opaque render list. + * + * @private + * @type {?Function} + * @default null + */ + private _opaqueSort; + /** + * A custom sort function for the transparent render list. + * + * @private + * @type {?Function} + * @default null + */ + private _transparentSort; + /** + * Cache of framebuffer targets per canvas target. + * + * @private + * @type {Map} + */ + private _frameBufferTargets; + /** + * The clear color value. + * + * @private + * @type {Color4} + */ + private _clearColor; + /** + * The clear depth value. + * + * @private + * @type {number} + * @default 1 + */ + private _clearDepth; + /** + * The clear stencil value. + * + * @private + * @type {number} + * @default 0 + */ + private _clearStencil; + /** + * The current render target. + * + * @private + * @type {?RenderTarget} + * @default null + */ + private _renderTarget; + /** + * The active cube face. + * + * @private + * @type {number} + * @default 0 + */ + private _activeCubeFace; + /** + * The active mipmap level. + * + * @private + * @type {number} + * @default 0 + */ + private _activeMipmapLevel; + /** + * The current output render target. + * + * @private + * @type {?RenderTarget} + * @default null + */ + private _outputRenderTarget; + /** + * The MRT setting. + * + * @private + * @type {?MRTNode} + * @default null + */ + private _mrt; + /** + * This function defines how a render object is going + * to be rendered. + * + * @private + * @type {?Function} + * @default null + */ + private _renderObjectFunction; + /** + * Used to keep track of the current render object function. + * + * @private + * @type {?Function} + * @default null + */ + private _currentRenderObjectFunction; + /** + * Used to keep track of the current render bundle. + * + * @private + * @type {?RenderBundle} + * @default null + */ + private _currentRenderBundle; + /** + * Next to `_renderObjectFunction()`, this function provides another hook + * for influencing the render process of a render object. It is meant for internal + * use and only relevant for `compileAsync()` right now. Instead of using + * the default logic of `_renderObjectDirect()` which actually draws the render object, + * a different function might be used which performs no draw but just the node + * and pipeline updates. + * + * @private + * @type {Function} + */ + private _handleObjectFunction; + /** + * Indicates whether the device has been lost or not. In WebGL terms, the device + * lost is considered as a context lost. When this is set to `true`, rendering + * isn't possible anymore. + * + * @private + * @type {boolean} + * @default false + */ + private _isDeviceLost; + /** + * A callback function that defines what should happen when a device/context lost occurs. + * + * @type {Function} + */ + onDeviceLost: Function; + /** + * A callback function that defines what should happen when an uncaptured + * backend error is reported (e.g. a WebGPU validation/out-of-memory/internal + * error raised outside an error scope). Applications can override this to + * surface errors in their own UI without letting them escalate to a device + * loss. The default implementation logs to the console. + * + * @type {Function} + */ + onError: Function; + /** + * Defines the type of output buffers. The default `HalfFloatType` is recommend for + * best quality. To save memory and bandwidth, `UnsignedByteType` might be used. + * This will reduce rendering quality though. + * + * @private + * @type {number} + * @default HalfFloatType + */ + private _outputBufferType; + /** + * A cache for shadow nodes per material + * + * @private + * @type {WeakMap} + */ + private _cacheShadowNodes; + /** + * Whether the renderer has been initialized or not. + * + * @private + * @type {boolean} + * @default false + */ + private _initialized; + /** + * The call depth of the renderer. Counts the number of + * nested render calls. + * + * @private + * @type {number} + * @default - 1 + */ + private _callDepth; + /** + * A reference to the promise which initializes the renderer. + * + * @private + * @type {?Promise} + * @default null + */ + private _initPromise; + /** + * An array of compilation promises which are used in `compileAsync()`. + * + * @private + * @type {?Array} + * @default null + */ + private _compilationPromises; + /** + * Whether the renderer is currently precompiling a render object in + * `compileAsync()`. + * + * @private + * @type {boolean} + * @default false + */ + private _isPreCompiling; + /** + * When an override material is in use, this property points to the current + * source material during the rendering of a render object. + * + * @private + * @type {?Material} + * @default null + */ + private _currentSourceMaterial; + /** + * Whether the renderer should render transparent render objects or not. + * + * @type {boolean} + * @default true + */ + transparent: boolean; + /** + * Whether the renderer should render opaque render objects or not. + * + * @type {boolean} + * @default true + */ + opaque: boolean; + /** + * Shadow map configuration + * @typedef {Object} ShadowMapConfig + * @property {boolean} enabled - Whether to globally enable shadows or not. + * @property {boolean} transmitted - Whether to enable light transmission through non-opaque materials. + * @property {number} type - The shadow map type. + */ + /** + * The renderer's shadow configuration. + * + * @type {ShadowMapConfig} + */ + shadowMap: { + /** + * - Whether to globally enable shadows or not. + */ + enabled: boolean; + /** + * - Whether to enable light transmission through non-opaque materials. + */ + transmitted: boolean; + /** + * - The shadow map type. + */ + type: number; + }; + /** + * XR configuration. + * @typedef {Object} XRConfig + * @property {boolean} enabled - Whether to globally enable XR or not. + */ + /** + * The renderer's XR manager. + * + * @type {XRManager} + */ + xr: XRManager; + /** + * Debug configuration. + * @typedef {Object} DebugConfig + * @property {boolean} checkShaderErrors - Whether shader errors should be checked or not. + * @property {Object} diagnostics - Diagnostics configuration for the shader generation. + * @property {boolean} diagnostics.keywords - Whether declaration names that collide with reserved keywords should be renamed or not. + * @property {?Function} onNodeBuilderCreated - A callback function that is executed after a node builder has been created and before it is built. + * @property {?Function} onShaderError - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. + * @property {Function} getShaderAsync - Allows the get the raw shader code for the given scene, camera and 3D object. + */ + /** + * The renderer's debug configuration. + * + * @type {DebugConfig} + */ + debug: { + /** + * - Whether shader errors should be checked or not. + */ + checkShaderErrors: boolean; + /** + * - Diagnostics configuration for the shader generation. + */ + diagnostics: { + keywords: boolean; + }; + /** + * - A callback function that is executed after a node builder has been created and before it is built. + */ + onNodeBuilderCreated: Function | null; + /** + * - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. + */ + onShaderError: Function | null; + /** + * - Allows the get the raw shader code for the given scene, camera and 3D object. + */ + getShaderAsync: Function; + }; + /** + * Initializes the renderer so it is ready for usage. + * + * @async + * @return {Promise} A Promise that resolves when the renderer has been initialized. + */ + init(): Promise; + /** + * A reference to the canvas element the renderer is drawing to. + * This value of this property will automatically be created by + * the renderer. + * + * @type {HTMLCanvasElement|OffscreenCanvas} + */ + get domElement(): HTMLCanvasElement | OffscreenCanvas; + /** + * The coordinate system of the renderer. The value of this property + * depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or + * `THREE.WebGPUCoordinateSystem`. + * + * @readonly + * @type {number} + */ + readonly get coordinateSystem(): number; + /** + * Compiles all materials in the given scene. This can be useful to avoid a + * phenomenon which is called "shader compilation stutter", which occurs when + * rendering an object with a new shader for the first time. + * + * If you want to add a 3D object to an existing scene, use the third optional + * parameter for applying the target scene. Note that the (target) scene's lighting + * and environment must be configured before calling this method. + * + * @async + * @param {Object3D} scene - The scene or 3D object to precompile. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {?Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. + * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. + * @return {Promise} A Promise that resolves when the compile has been finished. + */ + compileAsync(scene: Object3D, camera: Camera, targetScene?: Scene | null, onProgress?: onProgressCallback): Promise; + /** + * Compile compute programs. This can be useful to avoid a + * phenomenon which is called "shader compilation stutter", which occurs when + * rendering an object with a new shader for the first time. + * + * @async + * @param {Node|Array} computeNodes - The compute node(s). + * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. + * @return {Promise} A Promise that resolves when the compile has been finished. + */ + compileComputeAsync(computeNodes: Node | Array, onProgress?: onProgressCallback): Promise; + /** + * Renders the scene in an async fashion. + * + * @async + * @deprecated + * @param {Object3D} scene - The scene or 3D object to render. + * @param {Camera} camera - The camera. + * @return {Promise} A Promise that resolves when the render has been finished. + */ + renderAsync(scene: Object3D, camera: Camera): Promise; + /** + * Can be used to synchronize CPU operations with GPU tasks. So when this method is called, + * the CPU waits for the GPU to complete its operation (e.g. a compute task). + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when synchronization has been finished. + */ + waitForGPU(): Promise; + set inspector(value: InspectorBase); + /** + * The inspector instance. The inspector can be any class that extends from `InspectorBase`. + * + * @type {InspectorBase} + */ + get inspector(): InspectorBase; + /** + * Enables or disables high precision for model-view and normal-view matrices. + * When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance. + * + * NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`. + * + * @param {boolean} value - Whether to enable or disable high precision. + * @type {boolean} + */ + set highPrecision(value: boolean); + /** + * Returns whether high precision is enabled or not. + * + * @return {boolean} Whether high precision is enabled or not. + * @type {boolean} + */ + get highPrecision(): boolean; + /** + * Sets the given MRT configuration. + * + * @param {MRTNode} mrt - The MRT node to set. + * @return {Renderer} A reference to this renderer. + */ + setMRT(mrt: MRTNode): Renderer; + /** + * Returns the MRT configuration. + * + * @return {MRTNode} The MRT configuration. + */ + getMRT(): MRTNode; + /** + * Returns the output buffer type. + * + * @return {number} The output buffer type. + */ + getOutputBufferType(): number; + /** + * Returns the output buffer type. + * + * @deprecated since r182. Use `.getOutputBufferType()` instead. + * @return {number} The output buffer type. + */ + getColorBufferType(): number; + /** + * Default implementation of the device lost callback. + * + * @private + * @param {Object} info - Information about the context lost. + */ + private _onDeviceLost; + /** + * Default implementation of the uncaptured backend error callback. + * + * @private + * @param {Object} info - Information about the uncaptured error. + */ + private _onError; + /** + * Returns `true` if the cached GPU render bundle for the given bundle group is + * out-of-date and must be recorded again. + * + * @private + * @param {BundleGroup} bundleGroup - The bundle group. + * @param {Object} renderBundleData - The backend data of the render bundle. + * @return {boolean} Whether the cached render bundle needs an update. + */ + private _bundleNeedsUpdate; + /** + * Renders the given render bundle. + * + * @private + * @param {Object} bundle - Render bundle data. + * @param {Scene} sceneRef - The scene the render bundle belongs to. + * @param {LightsNode} lightsNode - The lights node. + */ + private _renderBundle; + /** + * Renders the scene or 3D object with the given camera. This method can only be called + * if the renderer has been initialized. When using `render()` inside an animation loop, + * it's guaranteed the renderer will be initialized. The animation loop must be defined + * with {@link Renderer#setAnimationLoop} though. + * + * For all other use cases (like when using on-demand rendering), you must call + * {@link Renderer#init} before rendering. + * + * The target of the method is the default framebuffer (meaning the canvas) + * or alternatively a render target when specified via `setRenderTarget()`. + * + * @param {Object3D} scene - The scene or 3D object to render. + * @param {Camera} camera - The camera to render the scene with. + */ + render(scene: Object3D, camera: Camera): void; + /** + * Returns whether the renderer has been initialized or not. + * + * @readonly + * @return {boolean} Whether the renderer has been initialized or not. + */ + readonly get initialized(): boolean; + _renderOutputLayers(quad: any, renderTarget: any): void; + /** + * Returns an internal render target which is used when computing the output tone mapping + * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render + * pass and not inline to achieve more correct results. + * + * @private + * @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied. + */ + private _getFrameBufferTarget; + /** + * Renders the scene or 3D object with the given camera. + * + * @private + * @param {Object3D} scene - The scene or 3D object to render. + * @param {Camera} camera - The camera to render the scene with. + * @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not. + * @return {RenderContext} The current render context. + */ + private _renderScene; + _setXRLayerSize(width: any, height: any): void; + /** + * The output pass performs tone mapping and color space conversion. + * + * @private + * @param {RenderTarget} renderTarget - The current render target. + */ + private _renderOutput; + /** + * Returns the maximum available anisotropy for texture filtering. + * + * @return {number} The maximum available anisotropy. + */ + getMaxAnisotropy(): number; + /** + * Returns the active cube face. + * + * @return {number} The active cube face. + */ + getActiveCubeFace(): number; + /** + * Returns the active mipmap level. + * + * @return {number} The active mipmap level. + */ + getActiveMipmapLevel(): number; + /** + * Applications are advised to always define the animation loop + * with this method and not manually with `requestAnimationFrame()` + * for best compatibility. + * + * @async + * @param {?onAnimationCallback} callback - The application's animation loop. + * @return {Promise} A Promise that resolves when the set has been executed. + */ + setAnimationLoop(callback: onAnimationCallback | null): Promise; + /** + * Returns the current animation loop callback. + * + * @return {?Function} The current animation loop callback. + */ + getAnimationLoop(): Function | null; + /** + * Can be used to transfer buffer data from a storage buffer attribute + * from the GPU to the CPU in context of compute shaders. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @param {number} offset - The storage buffer attribute. + * @param {number} count - The offset from which to start reading the + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Returns the rendering context. + * + * @return {GPUCanvasContext|WebGL2RenderingContext} The rendering context. + */ + getContext(): GPUCanvasContext | WebGL2RenderingContext; + /** + * Returns the pixel ratio. + * + * @return {number} The pixel ratio. + */ + getPixelRatio(): number; + /** + * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The drawing buffer size. + */ + getDrawingBufferSize(target: Vector2): Vector2; + /** + * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. + * + * @param {Vector2} target - The method writes the result in this target object. + * @return {Vector2} The renderer's size in logical pixels. + */ + getSize(target: Vector2): Vector2; + /** + * Sets the given pixel ratio and resizes the canvas if necessary. + * + * @param {number} [value=1] - The pixel ratio. + */ + setPixelRatio(value?: number): void; + /** + * This method allows to define the drawing buffer size by specifying + * width, height and pixel ratio all at once. The size of the drawing + * buffer is computed with this formula: + * ```js + * size.x = width * pixelRatio; + * size.y = height * pixelRatio; + * ``` + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {number} pixelRatio - The pixel ratio. + */ + setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; + /** + * Sets the size of the renderer. + * + * @param {number} width - The width in logical pixels. + * @param {number} height - The height in logical pixels. + * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. + */ + setSize(width: number, height: number, updateStyle?: boolean): void; + /** + * Defines a manual sort function for the opaque render list. + * Pass `null` to use the default sort. + * + * @param {Function} method - The sort function. + */ + setOpaqueSort(method: Function): void; + /** + * Defines a manual sort function for the transparent render list. + * Pass `null` to use the default sort. + * + * @param {Function} method - The sort function. + */ + setTransparentSort(method: Function): void; + /** + * Returns the scissor rectangle. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The scissor rectangle. + */ + getScissor(target: Vector4): Vector4; + /** + * Defines the scissor rectangle. + * + * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the box in logical pixel unit. + * Instead of passing four arguments, the method also works with a single four-dimensional vector. + * @param {number} y - The vertical coordinate for the upper left corner of the box in logical pixel unit. + * @param {number} width - The width of the scissor box in logical pixel unit. + * @param {number} height - The height of the scissor box in logical pixel unit. + */ + setScissor(x: number | Vector4, y: number, width: number, height: number): void; + /** + * Returns the scissor test value. + * + * @return {boolean} Whether the scissor test should be enabled or not. + */ + getScissorTest(): boolean; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Resets the backend's internal state cache. Useful when the rendering context is shared with + * other libraries that change the state. A no-op for the WebGPU backend. + */ + resetState(): void; + /** + * Returns the viewport definition. + * + * @param {Vector4} target - The method writes the result in this target object. + * @return {Vector4} The viewport definition. + */ + getViewport(target: Vector4): Vector4; + /** + * Defines the viewport. + * + * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the viewport origin in logical pixel unit. + * @param {number} y - The vertical coordinate for the upper left corner of the viewport origin in logical pixel unit. + * @param {number} width - The width of the viewport in logical pixel unit. + * @param {number} height - The height of the viewport in logical pixel unit. + * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. + * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. + */ + setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; + /** + * Returns the clear color. + * + * @param {Color} target - The method writes the result in this target object. + * @return {Color} The clear color. + */ + getClearColor(target: Color): Color; + /** + * Defines the clear color and optionally the clear alpha. + * + * @param {Color} color - The clear color. + * @param {number} [alpha=1] - The clear alpha. + */ + setClearColor(color: Color, alpha?: number): void; + /** + * Returns the clear alpha. + * + * @return {number} The clear alpha. + */ + getClearAlpha(): number; + /** + * Defines the clear alpha. + * + * @param {number} alpha - The clear alpha. + */ + setClearAlpha(alpha: number): void; + /** + * Returns the clear depth. + * + * @return {number} The clear depth. + */ + getClearDepth(): number; + /** + * Defines the clear depth. + * + * @param {number} depth - The clear depth. + */ + setClearDepth(depth: number): void; + /** + * Returns the clear stencil. + * + * @return {number} The clear stencil. + */ + getClearStencil(): number; + /** + * Defines the clear stencil. + * + * @param {number} stencil - The clear stencil. + */ + setClearStencil(stencil: number): void; + /** + * This method performs an occlusion query for the given 3D object. + * It returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. + * + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(object: Object3D): boolean; + /** + * Performs a manual clear operation. This method ignores `autoClear` properties. + * + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + */ + clear(color?: boolean, depth?: boolean, stencil?: boolean): void; + /** + * Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties. + */ + clearColor(): void; + /** + * Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties. + */ + clearDepth(): void; + /** + * Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties. + */ + clearStencil(): void; + /** + * Async version of {@link Renderer#clear}. + * + * @async + * @deprecated + * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. + * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. + * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise; + /** + * Async version of {@link Renderer#clearColor}. + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearColorAsync(): Promise; + /** + * Async version of {@link Renderer#clearDepth}. + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearDepthAsync(): Promise; + /** + * Async version of {@link Renderer#clearStencil}. + * + * @async + * @deprecated + * @return {Promise} A Promise that resolves when the clear operation has been executed. + */ + clearStencilAsync(): Promise; + /** + * Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion. + * If this is the case, the renderer allocates an internal render target for that purpose. + * + * @type {boolean} + */ + get needsFrameBufferTarget(): boolean; + /** + * The number of samples used for multi-sample anti-aliasing (MSAA). + * + * @type {number} + * @default 0 + */ + get samples(): number; + /** + * The current number of samples used for multi-sample anti-aliasing (MSAA). + * + * When rendering to a custom render target, the number of samples of that render target is used. + * The number of samples is set to 0 when the renderer needs an internal framebuffer target for + * tone mapping or color space conversion, or when rendering a fullscreen quad to screen. + * + * @type {number} + */ + get currentSamples(): number; + /** + * The current tone mapping of the renderer. When not producing screen output, + * the tone mapping is always `NoToneMapping`. + * + * @type {number} + */ + get currentToneMapping(): number; + /** + * The current color space of the renderer. When not producing screen output, + * the color space is always the working color space. + * + * @type {string} + */ + get currentColorSpace(): string; + /** + * Returns `true` if the rendering settings are set to screen output. + * + * @returns {boolean} True if the current render target is the same of output render target or `null`, otherwise false. + */ + get isOutputTarget(): boolean; + /** + * Frees all internal resources of the renderer. Call this method if the renderer + * is no longer in use by your app. + */ + dispose(): void; + /** + * Sets the given render target. Calling this method means the renderer does not + * target the default framebuffer (meaning the canvas) anymore but a custom framebuffer. + * Use `null` as the first argument to reset the state. + * + * @param {?RenderTarget} renderTarget - The render target to set. + * @param {number} [activeCubeFace=0] - The active cube face. + * @param {number} [activeMipmapLevel=0] - The active mipmap level. + */ + setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void; + /** + * Returns the current render target. + * + * @return {?RenderTarget} The render target. Returns `null` if no render target is set. + */ + getRenderTarget(): RenderTarget | null; + /** + * Sets the output render target for the renderer. + * + * @param {?RenderTarget} renderTarget - The render target to set as the output target. + */ + setOutputRenderTarget(renderTarget: RenderTarget | null): void; + /** + * Returns the current output target. + * + * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set. + */ + getOutputRenderTarget(): RenderTarget | null; + /** + * Sets the canvas target. The canvas target manages the HTML canvas + * or the offscreen canvas the renderer draws into. + * + * @param {CanvasTarget} canvasTarget - The canvas target. + */ + setCanvasTarget(canvasTarget: CanvasTarget): void; + /** + * Returns the current canvas target. + * + * @return {CanvasTarget} The current canvas target. + */ + getCanvasTarget(): CanvasTarget; + /** + * Resets the renderer to the initial state before WebXR started. + * + * @private + */ + private _resetXRState; + /** + * Callback for {@link Renderer#setRenderObjectFunction}. + * + * @callback renderObjectFunction + * @param {Object3D} object - The 3D object. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {BufferGeometry} geometry - The object's geometry. + * @param {Material} material - The object's material. + * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {LightsNode} lightsNode - The current lights node. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {?string} [passId=null] - An optional ID for identifying the pass. + */ + /** + * Sets the given render object function. Calling this method overwrites the default implementation + * which is {@link Renderer#renderObject}. Defining a custom function can be useful + * if you want to modify the way objects are rendered. For example you can define things like "every + * object that has material of a certain type should perform a pre-pass with a special overwrite material". + * The custom function must always call `renderObject()` in its implementation. + * + * Use `null` as the first argument to reset the state. + * + * @param {?renderObjectFunction} renderObjectFunction - The render object function. + */ + setRenderObjectFunction(renderObjectFunction: ((object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext: ClippingContext, passId?: string | null | undefined) => any) | null): void; + /** + * Returns the current render object function. + * + * @return {?Function} The current render object function. Returns `null` if no function is set. + */ + getRenderObjectFunction(): Function | null; + /** + * Execute a single or an array of compute nodes. This method can only be called + * if the renderer has been initialized. + * + * @param {Node|Array} computeNodes - The compute node(s). + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. + * @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized. + */ + compute(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise | undefined; + /** + * Execute a single or an array of compute nodes. + * + * @async + * @param {Node|Array} computeNodes - The compute node(s). + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. + * @return {Promise} A Promise that resolve when the compute has finished. + */ + computeAsync(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise; + /** + * Checks if the given feature is supported by the selected backend. + * + * @async + * @deprecated + * @param {string} name - The feature's name. + * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. + */ + hasFeatureAsync(name: string): Promise; + resolveTimestampsAsync(type?: string): Promise; + /** + * Checks if the given feature is supported by the selected backend. If the + * renderer has not been initialized, this method always returns `false`. + * + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(name: string): boolean; + /** + * Returns `true` when the renderer has been initialized. + * + * @return {boolean} Whether the renderer has been initialized or not. + */ + hasInitialized(): boolean; + /** + * Initializes the given textures. Useful for preloading a texture rather than waiting until first render + * (which can cause noticeable lags due to decode and GPU upload overhead). + * + * @async + * @deprecated + * @param {Texture} texture - The texture. + * @return {Promise} A Promise that resolves when the texture has been initialized. + */ + initTextureAsync(texture: Texture): Promise; + /** + * Initializes the given texture. Useful for preloading a texture rather than waiting until first render + * (which can cause noticeable lags due to decode and GPU upload overhead). + * + * This method can only be used if the renderer has been initialized. + * + * @param {Texture} texture - The texture. + */ + initTexture(texture: Texture): void; + /** + * Initializes the given render target. + * + * @param {RenderTarget} renderTarget - The render target to intialize. + */ + initRenderTarget(renderTarget: RenderTarget): void; + /** + * Copies the current bound framebuffer into the given texture. + * + * @param {FramebufferTexture} framebufferTexture - The texture. + * @param {?(Vector2|Vector4)} [rectangle=null] - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied. + */ + copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: (Vector2 | Vector4) | null): void; + /** + * Copies data of the given source texture into a destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. + * @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: Box2 | Box3, dstPosition?: Vector2 | Vector3, srcLevel?: number, dstLevel?: number): void; + /** + * Reads pixel data from the given render target. + * + * @async + * @param {RenderTarget} renderTarget - The render target to read from. + * @param {number} x - The `x` coordinate of the copy region's origin. + * @param {number} y - The `y` coordinate of the copy region's origin. + * @param {number} width - The width of the copy region. + * @param {number} height - The height of the copy region. + * @param {number} [textureIndex=0] - The texture index of a MRT render target. + * @param {number} [faceIndex=0] - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. + */ + readRenderTargetPixelsAsync(renderTarget: RenderTarget, x: number, y: number, width: number, height: number, textureIndex?: number, faceIndex?: number): Promise; + /** + * Analyzes the given 3D object's hierarchy and builds render lists from the + * processed hierarchy. + * + * @private + * @param {Object3D} object - The 3D object to process (usually a scene). + * @param {Camera} camera - The camera the object is rendered with. + * @param {number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups. + * @param {RenderList} renderList - The current render list. + * @param {ClippingContext} clippingContext - The current clipping context. + */ + private _projectObject; + /** + * Renders the given render bundles. + * + * @private + * @param {Array} bundles - Array with render bundle data. + * @param {Scene} sceneRef - The scene the render bundles belong to. + * @param {LightsNode} lightsNode - The current lights node. + */ + private _renderBundles; + /** + * Renders the transparent objects from the given render lists. + * + * @private + * @param {Array} renderList - The transparent render list. + * @param {Array} doublePassList - The list of transparent objects which require a double pass (e.g. because of transmission). + * @param {Camera} camera - The camera the render list should be rendered with. + * @param {Scene} scene - The scene the render list belongs to. + * @param {LightsNode} lightsNode - The current lights node. + */ + private _renderTransparents; + /** + * Renders the objects from the given render list. + * + * @private + * @param {Array} renderList - The render list. + * @param {Camera} camera - The camera the render list should be rendered with. + * @param {Scene} scene - The scene the render list belongs to. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?string} [passId=null] - An optional ID for identifying the pass. + */ + private _renderObjects; + /** + * Retrieves shadow nodes for the given material. This is used to setup shadow passes. + * The result is cached per material and updated when the material's version changes. + * + * @private + * @param {Material} material + * @returns {Object} - The shadow nodes for the material. + */ + private _getShadowNodes; + /** + * Updates the camera so it's prepared for rendering operations. + * + * @private + * @param {Camera} camera - The camera to update. + * @param {boolean} useXRCamera - Whether the XR camera should be used when presenting. + * @return {Camera} The returned camera might be different depending on whether XR is used or not. + */ + private _updateCamera; + /** + * This method represents the default render object function that manages the render lifecycle + * of the object. + * + * @param {Object3D} object - The 3D object. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {BufferGeometry} geometry - The object's geometry. + * @param {Material} material - The object's material. + * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?ClippingContext} clippingContext - The clipping context. + * @param {?string} [passId=null] - An optional ID for identifying the pass. + */ + renderObject(object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext?: ClippingContext | null, passId?: string | null): void; + /** + * Checks if the given compatibility is supported by the selected backend. + * + * @param {string} name - The compatibility's name. + * @return {boolean} Whether the compatibility is supported or not. + */ + hasCompatibility(name: string): boolean; + /** + * This method represents the default `_handleObjectFunction` implementation which creates + * a render object from the given data and performs the draw command with the selected backend. + * + * @private + * @param {Object3D} object - The 3D object. + * @param {Material} material - The object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {string} [passId] - An optional ID for identifying the pass. + */ + private _renderObjectDirect; + /** + * A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering. + * Used in `compileAsync()`. + * + * @private + * @param {Object3D} object - The 3D object. + * @param {Material} material - The object's material. + * @param {Scene} scene - The scene the 3D object belongs to. + * @param {Camera} camera - The camera the object should be rendered with. + * @param {LightsNode} lightsNode - The current lights node. + * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. + * @param {ClippingContext} clippingContext - The clipping context. + * @param {string} [passId] - An optional ID for identifying the pass. + */ + private _createObjectPipeline; + /** + * Alias for `compileAsync()`. + * + * @method + * @param {Object3D} scene - The scene or 3D object to precompile. + * @param {Camera} camera - The camera that is used to render the scene. + * @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. + * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. + * @return {function(Object3D, Camera, ?Scene, ?onProgressCallback): Promise|undefined} A Promise that resolves when the compile has been finished. + */ + get compile(): (arg0: Object3D, arg1: Camera, arg2: Scene | null, arg3: onProgressCallback | null) => Promise | undefined; +} +import Info from './Info.js'; +import NodeLibrary from './nodes/NodeLibrary.js'; +import Lighting from './Lighting.js'; +import XRManager from './XRManager.js'; +import { Scene } from '../../scenes/Scene.js'; +import InspectorBase from './InspectorBase.js'; +import { Vector2 } from '../../math/Vector2.js'; +import { Vector4 } from '../../math/Vector4.js'; +import { RenderTarget } from '../../core/RenderTarget.js'; +import CanvasTarget from './CanvasTarget.js'; +import ClippingContext from './ClippingContext.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts new file mode 100644 index 000000000..8809693b3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts @@ -0,0 +1,105 @@ +/** + * Saves the state of the given renderer and stores it into the given state object. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +export function saveRendererState(renderer: Renderer, state?: Object): Object; +/** + * Saves the state of the given renderer and stores it into the given state object. + * Besides, the function also resets the state of the renderer to its default values. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +export function resetRendererState(renderer: Renderer, state?: Object): Object; +/** + * Restores the state of the given renderer from the given state object. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Object} state - The state to restore. + */ +export function restoreRendererState(renderer: Renderer, state: Object): void; +/** + * Saves the state of the given scene and stores it into the given state object. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +export function saveSceneState(scene: Scene, state?: Object): Object; +/** + * Saves the state of the given scene and stores it into the given state object. + * Besides, the function also resets the state of the scene to its default values. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +export function resetSceneState(scene: Scene, state?: Object): Object; +/** + * Restores the state of the given scene from the given state object. + * + * @private + * @function + * @param {Scene} scene - The scene. + * @param {Object} state - The state to restore. + */ +export function restoreSceneState(scene: Scene, state: Object): void; +/** + * Saves the state of the given renderer and scene and stores it into the given state object. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +export function saveRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; +/** + * Saves the state of the given renderer and scene and stores it into the given state object. + * Besides, the function also resets the state of the renderer and scene to its default values. + * + * If not state object is provided, the function creates one. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Scene} scene - The scene. + * @param {Object} [state={}] - The state. + * @return {Object} The state. + */ +export function resetRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; +/** + * Restores the state of the given renderer and scene from the given state object. + * + * @private + * @function + * @param {Renderer} renderer - The renderer. + * @param {Scene} scene - The scene. + * @param {Object} state - The state to restore. + */ +export function restoreRendererAndSceneState(renderer: Renderer, scene: Scene, state: Object): void; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts new file mode 100644 index 000000000..990534644 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts @@ -0,0 +1,85 @@ +/** + * Represents a sampled texture binding type. + * + * @private + * @augments Sampler + */ +export class SampledTexture extends Sampler { + /** + * This identifier. + * + * @type {number} + */ + id: number; + /** + * Whether the texture is a storage texture or not. + * + * @type {boolean} + * @default false + */ + store: boolean; + /** + * The mip level to bind for storage textures. + * + * @type {number} + * @default 0 + */ + mipLevel: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampledTexture: boolean; +} +/** + * Represents a sampled array texture binding type. + * + * @private + * @augments SampledTexture + */ +export class SampledArrayTexture extends SampledTexture { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampledArrayTexture: boolean; +} +/** + * Represents a sampled 3D texture binding type. + * + * @private + * @augments SampledTexture + */ +export class Sampled3DTexture extends SampledTexture { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampled3DTexture: boolean; +} +/** + * Represents a sampled cube texture binding type. + * + * @private + * @augments SampledTexture + */ +export class SampledCubeTexture extends SampledTexture { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampledCubeTexture: boolean; +} +import Sampler from './Sampler.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts new file mode 100644 index 000000000..f79e15db7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts @@ -0,0 +1,80 @@ +export default Sampler; +/** + * Represents a sampler binding type. + * + * @private + * @augments Binding + */ +declare class Sampler extends Binding { + /** + * Constructs a new sampler. + * + * @param {string} name - The samplers's name. + * @param {?Texture} texture - The texture this binding is referring to. + */ + constructor(name: string, texture: Texture | null); + /** + * The texture the sampler is referring to. + * + * @private + * @type {?Texture} + */ + private _texture; + /** + * The binding's version. + * + * @type {number} + */ + version: number; + /** + * The binding's generation which is an additional version + * qualifier. + * + * @type {?number} + * @default null + */ + generation: number | null; + /** + * The binding's sampler key. + * + * @type {string} + * @default '' + */ + samplerKey: string; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampler: boolean; + /** + * Sets the texture of this sampler. + * + * @param {Texture} value - The texture to set. + */ + set texture(value: Texture); + /** + * Gets the texture of this sampler. + * @return {?Texture} The texture. + */ + get texture(): Texture | null; + /** + * Updates the binding. + * + * @return {boolean} Whether the texture has been updated and must be + * uploaded to the GPU. + */ + update(): boolean; + /** + * Resets the version and generation. This is used when the texture + * the binding is pointing to is disposed or exchanged. + */ + reset(): void; + /** + * Releases the texture reference. + */ + release(): void; +} +import Binding from './Binding.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts new file mode 100644 index 000000000..bb60fe38a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts @@ -0,0 +1,59 @@ +export default Storage3DTexture; +/** + * This special type of texture is intended for compute shaders. + * It can be used to compute the data of a texture with a compute shader. + * + * Note: This type of texture can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments Texture + */ +declare class Storage3DTexture extends Texture { + /** + * Constructs a new storage texture. + * + * @param {number} [width=1] - The storage texture's width. + * @param {number} [height=1] - The storage texture's height. + * @param {number} [depth=1] - The storage texture's depth. + */ + constructor(width?: number, height?: number, depth?: number); + isArrayTexture: boolean; + /** + * This defines how the texture is wrapped in the depth direction and corresponds to + * *W* in UVW mapping. + * + * @type {number} + */ + wrapR: number; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture: boolean; + /** + * Indicates whether this texture is a 3D texture. + * + * @type {boolean} + * + */ + is3DTexture: boolean; + /** + * Copies the values of the given texture to this instance. + * + * @param {Storage3DTexture} source - The texture to copy. + * @return {Storage3DTexture} A reference to this instance. + */ + copy(source: Storage3DTexture): Storage3DTexture; + /** + * Sets the size of the storage 3d texture. + * + * @param {number} width - The new width of the storage texture. + * @param {number} height - The new height of the storage texture. + * @param {number} depth - The new depth of the storage texture. + */ + setSize(width: number, height: number, depth: number): void; +} +import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts new file mode 100644 index 000000000..27581e2fc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts @@ -0,0 +1,38 @@ +export default StorageArrayTexture; +/** + * This special type of texture is intended for compute shaders. + * It can be used to compute the data of a texture with a compute shader. + * + * Note: This type of texture can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments Texture + */ +declare class StorageArrayTexture extends Texture { + /** + * Constructs a new storage texture. + * + * @param {number} [width=1] - The storage texture's width. + * @param {number} [height=1] - The storage texture's height. + * @param {number} [depth=1] - The storage texture's depth. + */ + constructor(width?: number, height?: number, depth?: number); + isArrayTexture: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture: boolean; + /** + * Sets the size of the storage array texture. + * + * @param {number} width - The new width of the storage texture. + * @param {number} height - The new height of the storage texture. + * @param {number} depth - The new depth of the storage texture. + */ + setSize(width: number, height: number, depth: number): void; +} +import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts new file mode 100644 index 000000000..d4de63398 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts @@ -0,0 +1,38 @@ +export default StorageBuffer; +/** + * Represents a storage buffer binding type. + * + * @private + * @augments Buffer + */ +declare class StorageBuffer extends Buffer { + /** + * Constructs a new uniform buffer. + * + * @param {string} name - The buffer's name. + * @param {BufferAttribute} attribute - The buffer attribute. + */ + constructor(name: string, attribute: BufferAttribute); + /** + * This flag can be used for type testing. + * + * @private + * @type {BufferAttribute} + */ + private _attribute; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageBuffer: boolean; + /** + * The storage buffer attribute. + * + * @type {BufferAttribute} + */ + get attribute(): BufferAttribute; +} +import Buffer from './Buffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts new file mode 100644 index 000000000..d53cac3dc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts @@ -0,0 +1,35 @@ +export default StorageBufferAttribute; +/** + * This special type of buffer attribute is intended for compute shaders. + * In earlier three.js versions it was only possible to update attribute data + * on the CPU via JavaScript and then upload the data to the GPU. With the + * new material system and renderer it is now possible to use compute shaders + * to compute the data for an attribute more efficiently on the GPU. + * + * The idea is to create an instance of this class and provide it as an input + * to {@link StorageBufferNode}. + * + * Note: This type of buffer attribute can only be used with `WebGPURenderer`. + * + * @augments BufferAttribute + */ +declare class StorageBufferAttribute extends BufferAttribute { + /** + * Constructs a new storage buffer attribute. + * + * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. + * The subsequent parameters are then obsolete. + * @param {number} itemSize - The item size. + * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. + */ + constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageBufferAttribute: boolean; +} +import { BufferAttribute } from '../../core/BufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts new file mode 100644 index 000000000..6f8614323 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts @@ -0,0 +1,35 @@ +export default StorageInstancedBufferAttribute; +/** + * This special type of instanced buffer attribute is intended for compute shaders. + * In earlier three.js versions it was only possible to update attribute data + * on the CPU via JavaScript and then upload the data to the GPU. With the + * new material system and renderer it is now possible to use compute shaders + * to compute the data for an attribute more efficiently on the GPU. + * + * The idea is to create an instance of this class and provide it as an input + * to {@link StorageBufferNode}. + * + * Note: This type of buffer attribute can only be used with `WebGPURenderer`. + * + * @augments InstancedBufferAttribute + */ +declare class StorageInstancedBufferAttribute extends InstancedBufferAttribute { + /** + * Constructs a new storage instanced buffer attribute. + * + * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. + * The subsequent parameters are then obsolete. + * @param {number} itemSize - The item size. + * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. + */ + constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageInstancedBufferAttribute: boolean; +} +import { InstancedBufferAttribute } from '../../core/InstancedBufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts new file mode 100644 index 000000000..a369bd6e8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts @@ -0,0 +1,43 @@ +export default StorageTexture; +/** + * This special type of texture is intended for compute shaders. + * It can be used to compute the data of a texture with a compute shader. + * + * Note: This type of texture can only be used with `WebGPURenderer` + * and a WebGPU backend. + * + * @augments Texture + */ +declare class StorageTexture extends Texture { + /** + * Constructs a new storage texture. + * + * @param {number} [width=1] - The storage texture's width. + * @param {number} [height=1] - The storage texture's height. + */ + constructor(width?: number, height?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isStorageTexture: boolean; + /** + * When `true`, mipmaps will be auto-generated after compute writes. + * When `false`, mipmaps must be written manually via compute shaders. + * + * @type {boolean} + * @default true + */ + mipmapsAutoUpdate: boolean; + /** + * Sets the size of the storage texture. + * + * @param {number} width - The new width of the storage texture. + * @param {number} height - The new height of the storage texture. + */ + setSize(width: number, height: number): void; +} +import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts new file mode 100644 index 000000000..859bd9b24 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts @@ -0,0 +1,116 @@ +export default Textures; +/** + * This module manages the textures of the renderer. + * + * @private + * @augments DataMap + */ +declare class Textures extends DataMap { + /** + * Constructs a new texture management component. + * + * @param {Renderer} renderer - The renderer. + * @param {Backend} backend - The renderer's backend. + * @param {Info} info - Renderer component for managing metrics and monitoring data. + */ + constructor(renderer: Renderer, backend: Backend, info: Info); + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * The backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * Renderer component for managing metrics and monitoring data. + * + * @type {Info} + */ + info: Info; + /** + * A set of HTMLTextures that need paint updates. + * + * @type {Set} + */ + _htmlTextures: Set; + /** + * Updates the given render target. Based on the given render target configuration, + * it updates the texture states representing the attachments of the framebuffer. + * + * @param {RenderTarget} renderTarget - The render target to update. + * @param {number} [activeMipmapLevel=0] - The active mipmap level. + */ + updateRenderTarget(renderTarget: RenderTarget, activeMipmapLevel?: number): void; + /** + * Updates the given texture. Depending on the texture state, this method + * triggers the upload of texture data to the GPU memory. If the texture data are + * not yet ready for the upload, it uses default texture data for as a placeholder. + * + * @param {Texture} texture - The texture to update. + * @param {Object} [options={}] - The options. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Updates the sampler for the given texture. This method has no effect + * for the WebGL backend since it has no concept of samplers. Texture + * parameters are configured with the `texParameter()` command for each + * texture. + * + * In WebGPU, samplers are objects like textures and it's possible to share + * them when the texture parameters match. + * + * @param {Sampler} binding - The sampler binding to update. + * @return {string} The current sampler key. + */ + updateSampler(binding: Sampler): string; + /** + * Computes the size of the given texture and writes the result + * into the target vector. This vector is also returned by the + * method. + * + * If no texture data are available for the compute yet, the method + * returns default size values. + * + * @param {Texture} texture - The texture to compute the size for. + * @param {Vector3} target - The target vector. + * @return {Vector3} The target vector. + */ + getSize(texture: Texture, target?: Vector3): Vector3; + /** + * Computes the number of mipmap levels for the given texture. + * + * @param {Texture} texture - The texture. + * @param {number} width - The texture's width. + * @param {number} height - The texture's height. + * @return {number} The number of mipmap levels. + */ + getMipLevels(texture: Texture, width: number, height: number): number; + /** + * Returns `true` if the given texture makes use of mipmapping. + * + * @param {Texture} texture - The texture. + * @return {boolean} Whether mipmaps are required or not. + */ + needsMipmaps(texture: Texture): boolean; + /** + * Frees internal resources when the given render target isn't + * required anymore. + * + * @param {RenderTarget} renderTarget - The render target to destroy. + */ + _destroyRenderTarget(renderTarget: RenderTarget): void; + /** + * Frees internal resource when the given texture isn't + * required anymore. + * + * @param {Texture} texture - The texture to destroy. + */ + _destroyTexture(texture: Texture): void; +} +import DataMap from './DataMap.js'; +import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts new file mode 100644 index 000000000..f18cad9f8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts @@ -0,0 +1,119 @@ +export default TimestampQueryPool; +/** + * Abstract base class of a timestamp query pool. + * + * @abstract + */ +declare class TimestampQueryPool { + /** + * Creates a new timestamp query pool. + * + * @param {number} [maxQueries=256] - Maximum number of queries this pool can hold. + */ + constructor(maxQueries?: number); + /** + * Whether to track timestamps or not. + * + * @type {boolean} + * @default true + */ + trackTimestamp: boolean; + /** + * Maximum number of queries this pool can hold. + * + * @type {number} + * @default 256 + */ + maxQueries: number; + /** + * How many queries allocated so far. + * + * @type {number} + * @default 0 + */ + currentQueryIndex: number; + /** + * Tracks offsets for different contexts. + * + * @type {Map} + */ + queryOffsets: Map; + /** + * Whether the pool has been disposed or not. + * + * @type {boolean} + * @default false + */ + isDisposed: boolean; + /** + * The total frame duration until the next update. + * + * @type {number} + * @default 0 + */ + lastValue: number; + /** + * Stores all timestamp frames. + * + * @type {Array} + */ + frames: Array; + /** + * This property is used to avoid multiple concurrent resolve operations. + * The WebGL backend uses it as a boolean flag. In context of WebGPU, it holds + * the promise of the current resolve operation. + * + * @type {boolean|Promise} + * @default false + */ + pendingResolve: boolean | Promise; + /** + * Stores the latest timestamp for each render context. + * + * @type {Map} + */ + timestamps: Map; + /** + * Returns all timestamp frames. + * + * @return {Array} The timestamp frames. + */ + getTimestampFrames(): Array; + /** + * Returns the timestamp for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @return {?number} The timestamp, or undefined if not available. + */ + getTimestamp(uid: string): number | null; + /** + * Returns whether a timestamp is available for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @return {boolean} True if a timestamp is available, false otherwise. + */ + hasTimestampQuery(uid: string): boolean; + /** + * Allocate queries for a specific uid. + * + * @abstract + * @param {string} uid - A unique identifier for the render context. + * @param {number} frameId - The current frame identifier. + * @returns {?number} + */ + allocateQueriesForContext(): number | null; + /** + * Resolve all timestamps and return data (or process them). + * + * @abstract + * @async + * @returns {Promise|number} The resolved timestamp value. + */ + resolveQueriesAsync(): Promise | number; + /** + * Dispose of the query pool. + * + * @abstract + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts new file mode 100644 index 000000000..d8d107299 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts @@ -0,0 +1,260 @@ +/** + * Represents a Number uniform. + * + * @private + * @augments Uniform + */ +export class NumberUniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {number} value - The uniform's value. + */ + constructor(name: string, value?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNumberUniform: boolean; +} +/** + * Represents a Vector2 uniform. + * + * @private + * @augments Uniform + */ +export class Vector2Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Vector2} value - The uniform's value. + */ + constructor(name: string, value?: Vector2); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVector2Uniform: boolean; +} +/** + * Represents a Vector3 uniform. + * + * @private + * @augments Uniform + */ +export class Vector3Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Vector3} value - The uniform's value. + */ + constructor(name: string, value?: Vector3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVector3Uniform: boolean; +} +/** + * Represents a Vector4 uniform. + * + * @private + * @augments Uniform + */ +export class Vector4Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Vector4} value - The uniform's value. + */ + constructor(name: string, value?: Vector4); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVector4Uniform: boolean; +} +/** + * Represents a Color uniform. + * + * @private + * @augments Uniform + */ +export class ColorUniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Color} value - The uniform's value. + */ + constructor(name: string, value?: Color); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isColorUniform: boolean; +} +/** + * Represents a Matrix2 uniform. + * + * @private + * @augments Uniform + */ +export class Matrix2Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Matrix2} value - The uniform's value. + */ + constructor(name: string, value?: Matrix2); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMatrix2Uniform: boolean; +} +/** + * Represents a Matrix3 uniform. + * + * @private + * @augments Uniform + */ +export class Matrix3Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Matrix3} value - The uniform's value. + */ + constructor(name: string, value?: Matrix3); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMatrix3Uniform: boolean; +} +/** + * Represents a Matrix4 uniform. + * + * @private + * @augments Uniform + */ +export class Matrix4Uniform extends Uniform { + /** + * Constructs a new Number uniform. + * + * @param {string} name - The uniform's name. + * @param {Matrix4} value - The uniform's value. + */ + constructor(name: string, value?: Matrix4); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isMatrix4Uniform: boolean; +} +/** + * Abstract base class for uniforms. + * + * @abstract + * @private + */ +declare class Uniform { + /** + * Constructs a new uniform. + * + * @param {string} name - The uniform's name. + * @param {any} value - The uniform's value. + */ + constructor(name: string, value: any); + /** + * The uniform's name. + * + * @type {string} + */ + name: string; + /** + * The uniform's value. + * + * @type {any} + */ + value: any; + /** + * Used to build the uniform buffer according to the STD140 layout. + * Derived uniforms will set this property to a data type specific + * value. + * + * @type {number} + */ + boundary: number; + /** + * The item size. Derived uniforms will set this property to a data + * type specific value. + * + * @type {number} + */ + itemSize: number; + /** + * This property is set by {@link UniformsGroup} and marks + * the start position in the uniform buffer. + * + * @type {number} + */ + offset: number; + /** + * This property is set by {@link UniformsGroup} and marks + * the index position in the uniform array. + * + * @type {number} + */ + index: number; + /** + * Sets the uniform's value. + * + * @param {any} value - The value to set. + */ + setValue(value: any): void; + /** + * Returns the uniform's value. + * + * @return {any} The value. + */ + getValue(): any; +} +import { Vector2 } from '../../math/Vector2.js'; +import { Vector3 } from '../../math/Vector3.js'; +import { Vector4 } from '../../math/Vector4.js'; +import { Color } from '../../math/Color.js'; +import { Matrix2 } from '../../math/Matrix2.js'; +import { Matrix3 } from '../../math/Matrix3.js'; +import { Matrix4 } from '../../math/Matrix4.js'; +export {}; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts new file mode 100644 index 000000000..15af25d88 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts @@ -0,0 +1,18 @@ +export default UniformBuffer; +/** + * Represents a uniform buffer binding type. + * + * @private + * @augments Buffer + */ +declare class UniformBuffer extends Buffer { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformBuffer: boolean; +} +import Buffer from './Buffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts new file mode 100644 index 000000000..8990101e7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts @@ -0,0 +1,147 @@ +export default UniformsGroup; +/** + * This class represents a uniform buffer binding but with + * an API that allows to maintain individual uniform objects. + * + * @private + * @augments UniformBuffer + */ +declare class UniformsGroup extends UniformBuffer { + /** + * Constructs a new uniforms group. + * + * @param {string} name - The group's name. + */ + constructor(name: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isUniformsGroup: boolean; + /** + * An array with the raw uniform values. + * + * @private + * @type {?Array} + * @default null + */ + private _values; + /** + * An array of uniform objects. + * + * The order of uniforms in this array must match the order of uniforms in the shader. + * + * @type {Array} + */ + uniforms: Array; + /** + * A cache for the uniform update ranges. + * + * @private + * @type {Map} + */ + private _updateRangeCache; + /** + * Uniform indices whose range has already been pushed into `updateRanges` + * during the current update cycle. Reset on `clearUpdateRanges()`. + * + * @private + * @type {Set} + */ + private _addedIndices; + /** + * Adds a uniform's update range to this buffer. + * + * @param {Uniform} uniform - The uniform. + */ + addUniformUpdateRange(uniform: Uniform): void; + /** + * Adds a uniform to this group. + * + * @param {Uniform} uniform - The uniform to add. + * @return {UniformsGroup} A reference to this group. + */ + addUniform(uniform: Uniform): UniformsGroup; + /** + * Removes a uniform from this group. + * + * @param {Uniform} uniform - The uniform to remove. + * @return {UniformsGroup} A reference to this group. + */ + removeUniform(uniform: Uniform): UniformsGroup; + /** + * An array with the raw uniform values. + * + * @type {Array} + */ + get values(): Array; + /** + * Updates a given uniform by calling an update method matching + * the uniforms type. + * + * @param {Uniform} uniform - The uniform to update. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateByType(uniform: Uniform): boolean; + /** + * Updates a given Number uniform. + * + * @param {NumberUniform} uniform - The Number uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateNumber(uniform: NumberUniform): boolean; + /** + * Updates a given Vector2 uniform. + * + * @param {Vector2Uniform} uniform - The Vector2 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateVector2(uniform: Vector2Uniform): boolean; + /** + * Updates a given Vector3 uniform. + * + * @param {Vector3Uniform} uniform - The Vector3 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateVector3(uniform: Vector3Uniform): boolean; + /** + * Updates a given Vector4 uniform. + * + * @param {Vector4Uniform} uniform - The Vector4 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateVector4(uniform: Vector4Uniform): boolean; + /** + * Updates a given Color uniform. + * + * @param {ColorUniform} uniform - The Color uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateColor(uniform: ColorUniform): boolean; + /** + * Updates a given Matrix3 uniform. + * + * @param {Matrix3Uniform} uniform - The Matrix3 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateMatrix3(uniform: Matrix3Uniform): boolean; + /** + * Updates a given Matrix4 uniform. + * + * @param {Matrix4Uniform} uniform - The Matrix4 uniform. + * @return {boolean} Whether the uniform has been updated or not. + */ + updateMatrix4(uniform: Matrix4Uniform): boolean; + /** + * Returns a typed array that matches the given data type. + * + * @private + * @param {string} type - The data type. + * @return {TypedArray} The typed array. + */ + private _getBufferForType; +} +import UniformBuffer from './UniformBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts new file mode 100644 index 000000000..8babeb489 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts @@ -0,0 +1,602 @@ +export default XRManager; +/** + * The XR manager is built on top of the WebXR Device API to + * manage XR sessions with renderer backends. + * + * @augments EventDispatcher + */ +declare class XRManager extends EventDispatcher { + /** + * Constructs a new XR manager. + * + * @param {Renderer} renderer - The renderer. + * @param {boolean} [multiview=false] - Enables multiview if the device supports it. + */ + constructor(renderer: Renderer, multiview?: boolean); + /** + * This flag globally enables XR rendering. + * + * @type {boolean} + * @default false + */ + enabled: boolean; + /** + * Whether the XR device is currently presenting or not. + * + * @type {boolean} + * @default false + * @readonly + */ + readonly isPresenting: boolean; + /** + * Whether the XR camera should automatically be updated or not. + * + * @type {boolean} + * @default true + */ + cameraAutoUpdate: boolean; + /** + * The renderer. + * + * @private + * @type {Renderer} + */ + private _renderer; + /** + * Represents the camera for the left eye. + * + * @private + * @type {PerspectiveCamera} + */ + private _cameraL; + /** + * Represents the camera for the right eye. + * + * @private + * @type {PerspectiveCamera} + */ + private _cameraR; + /** + * A list of cameras used for rendering the XR views. + * + * @private + * @type {Array} + */ + private _cameras; + /** + * The main XR camera. + * + * @private + * @type {ArrayCamera} + */ + private _cameraXR; + /** + * The current near value of the XR camera. + * + * @private + * @type {?number} + * @default null + */ + private _currentDepthNear; + /** + * The current far value of the XR camera. + * + * @private + * @type {?number} + * @default null + */ + private _currentDepthFar; + /** + * A list of WebXR controllers requested by the application. + * + * @private + * @type {Array} + */ + private _controllers; + /** + * A list of XR input source. Each input source belongs to + * an instance of WebXRController. + * + * @private + * @type {Array} + */ + private _controllerInputSources; + /** + * The XR render target that represents the rendering destination + * during an active XR session. + * + * @private + * @type {?RenderTarget} + * @default null + */ + private _xrRenderTarget; + /** + * An array holding all the non-projection layers + * + * @private + * @type {Array} + * @default [] + */ + private _layers; + /** + * Whether the XR session uses layers. + * + * @private + * @type {boolean} + * @default false + */ + private _sessionUsesLayers; + /** + * Whether the device supports binding gl objects. + * + * @private + * @type {boolean} + * @readonly + */ + private readonly _supportsGlBinding; + _supportsWebGPUBinding: boolean; + /** + * Helper function to create native WebXR Layer. + * + * @private + * @type {Function} + */ + private _createXRLayer; + /** + * The current WebGL context. + * + * @private + * @type {?WebGL2RenderingContext} + * @default null + */ + private _gl; + /** + * The current animation context. + * + * @private + * @type {?Window} + * @default null + */ + private _currentAnimationContext; + /** + * The current animation loop. + * + * @private + * @type {?Function} + * @default null + */ + private _currentAnimationLoop; + /** + * The current pixel ratio. + * + * @private + * @type {?number} + * @default null + */ + private _currentPixelRatio; + /** + * The current size of the renderer's canvas + * in logical pixel unit. + * + * @private + * @type {Vector2} + */ + private _currentSize; + /** + * Holds a reference to the user camera and its current settings. + * + * @private + * @type {?Object} + * @default null + */ + private _currentCameraSettings; + /** + * The default event listener for handling events inside a XR session. + * + * @private + * @type {Function} + */ + private _onSessionEvent; + /** + * The event listener for handling the end of a XR session. + * + * @private + * @type {Function} + */ + private _onSessionEnd; + /** + * The event listener for handling the `inputsourceschange` event. + * + * @private + * @type {Function} + */ + private _onInputSourcesChange; + /** + * The animation loop which is used as a replacement for the default + * animation loop of the application. It is only used when a XR session + * is active. + * + * @private + * @type {Function} + */ + private _onAnimationFrame; + /** + * The current XR reference space. + * + * @private + * @type {?XRReferenceSpace} + * @default null + */ + private _referenceSpace; + /** + * The current XR reference space type. + * + * @private + * @type {XRReferenceSpaceType} + * @default 'local-floor' + */ + private _referenceSpaceType; + /** + * A custom reference space defined by the application. + * + * @private + * @type {?XRReferenceSpace} + * @default null + */ + private _customReferenceSpace; + /** + * The framebuffer scale factor. + * + * @private + * @type {number} + * @default 1 + */ + private _framebufferScaleFactor; + /** + * The foveation factor. + * + * @private + * @type {number} + * @default 1 + */ + private _foveation; + /** + * A reference to the current XR session. + * + * @private + * @type {?XRSession} + * @default null + */ + private _session; + /** + * A reference to the current XR base layer. + * + * @private + * @type {?XRWebGLLayer} + * @default null + */ + private _glBaseLayer; + /** + * A reference to the current XR binding. + * + * @private + * @type {?XRWebGLBinding} + * @default null + */ + private _glBinding; + /** + * A reference to the current XR WebGPU binding. + * + * @private + * @type {?XRGPUBinding} + * @default null + */ + private _webgpuBinding; + /** + * A reference to the current XR projection layer. + * + * @private + * @type {?XRProjectionLayer} + * @default null + */ + private _glProjLayer; + /** + * A reference to the current XR frame. + * + * @private + * @type {?XRFrame} + * @default null + */ + private _xrFrame; + /** + * Whether the browser supports the APIs necessary to use XRProjectionLayers. + * + * Note: this does not represent XRSession explicitly requesting + * `'layers'` as a feature - see `_sessionUsesLayers` and #30112 + * + * @private + * @type {boolean} + * @readonly + */ + private readonly _supportsLayers; + /** + * Whether the usage of multiview has been requested by the application or not. + * + * @private + * @type {boolean} + * @default false + * @readonly + */ + private readonly _useMultiviewIfPossible; + /** + * Whether the usage of multiview is actually enabled. This flag only evaluates to `true` + * if multiview has been requested by the application and the `OVR_multiview2` is available. + * + * @private + * @type {boolean} + * @readonly + */ + private readonly _useMultiview; + /** + * Returns an instance of `THREE.Group` that represents the transformation + * of a XR controller in target ray space. The requested controller is defined + * by the given index. + * + * @param {number} index - The index of the XR controller. + * @return {Group} A group that represents the controller's transformation. + */ + getController(index: number): Group; + /** + * Returns an instance of `THREE.Group` that represents the transformation + * of a XR controller in grip space. The requested controller is defined + * by the given index. + * + * @param {number} index - The index of the XR controller. + * @return {Group} A group that represents the controller's transformation. + */ + getControllerGrip(index: number): Group; + /** + * Returns an instance of `THREE.Group` that represents the transformation + * of a XR controller in hand space. The requested controller is defined + * by the given index. + * + * @param {number} index - The index of the XR controller. + * @return {Group} A group that represents the controller's transformation. + */ + getHand(index: number): Group; + /** + * Returns the foveation value. + * + * @return {number|undefined} The foveation value. + */ + getFoveation(): number | undefined; + /** + * Sets the foveation value. + * + * @param {number} foveation - A number in the range `[0,1]` where `0` means no foveation (full resolution) + * and `1` means maximum foveation (the edges render at lower resolution). + */ + setFoveation(foveation: number): void; + /** + * Returns the framebuffer scale factor. + * + * @return {number} The framebuffer scale factor. + */ + getFramebufferScaleFactor(): number; + /** + * Sets the framebuffer scale factor. + * + * This method can not be used during a XR session. + * + * @param {number} factor - The framebuffer scale factor. + */ + setFramebufferScaleFactor(factor: number): void; + /** + * Returns the reference space type. + * + * @return {XRReferenceSpaceType} The reference space type. + */ + getReferenceSpaceType(): XRReferenceSpaceType; + /** + * Sets the reference space type. + * + * This method can not be used during a XR session. + * + * @param {XRReferenceSpaceType} type - The reference space type. + */ + setReferenceSpaceType(type: XRReferenceSpaceType): void; + /** + * Returns the XR reference space. + * + * @return {XRReferenceSpace} The XR reference space. + */ + getReferenceSpace(): XRReferenceSpace; + /** + * Sets a custom XR reference space. + * + * @param {XRReferenceSpace} space - The XR reference space. + */ + setReferenceSpace(space: XRReferenceSpace): void; + /** + * Returns the XR camera. + * + * @return {ArrayCamera} The XR camera. + */ + getCamera(): ArrayCamera; + /** + * Returns the environment blend mode from the current XR session. + * + * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. + */ + getEnvironmentBlendMode(): "opaque" | "additive" | "alpha-blend" | undefined; + /** + * Returns the current base layer. + * + * This is an `XRProjectionLayer` when the targeted XR device supports the + * WebXR Layers API, or an `XRWebGLLayer` otherwise. + * + * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. + */ + getBaseLayer(): (XRWebGLLayer | XRProjectionLayer) | null; + /** + * Returns the current XR binding. + * + * Creates a new binding if needed and the browser is + * capable of doing so. + * + * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. + */ + getBinding(): XRWebGLBinding | null; + /** + * Applies WebXR fixed foveation to the internal post-processing render target + * used by the first XR render pass before compositing into a projection layer. + * + * Browser-side `XRWebGLBinding.foveateBoundTexture()` failures are treated as + * non-fatal so they do not interrupt rendering. + * + * @param {?RenderTarget} renderTarget - The internal render target. + */ + foveateBoundTexture(renderTarget: RenderTarget | null): void; + /** + * Returns the current XR WebGPU binding. + * + * Creates a new binding if needed and the browser is + * capable of doing so. + * + * @return {?XRGPUBinding} The XR WebGPU binding. Returns `null` if one cannot be created. + */ + getWebGPUBinding(): XRGPUBinding | null; + /** + * Returns whether the current XR session is using WebGPU. + * + * @private + * @return {boolean} Whether the current session uses the WebGPU backend and the `webgpu` session feature. + */ + private _isWebGPUSession; + /** + * Validates the current WebGPU XR session requirements. + * + * @private + */ + private _validateWebGPUSession; + /** + * Initializes the WebGPU XR projection layer and render target. + * + * @private + * @async + * @param {XRSession} session - The XR session. + * @return {Promise} + */ + private _initWebGPUSession; + /** + * Releases WebGPU XR resources associated with the current session. + * + * @private + */ + private _disposeWebGPUSession; + /** + * Collects WebGPU XR sub-image data for the current frame. + * + * @private + * @param {Array} views - The XR views for the current pose. + * @return {{colorTexture:?GPUTexture, viewDescriptors:Array, viewports:Array}} The WebGPU XR view data. + */ + private _getWebGPUViewData; + /** + * Returns the current XR frame. + * + * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. + */ + getFrame(): XRFrame | null; + /** + * Returns `true` if the engine renders to a multiview target. + * + * @return {boolean} Whether the engine renders to a multiview render target or not. + */ + useMultiview(): boolean; + /** + * This method can be used in XR applications to create a quadratic layer that presents a separate + * rendered scene. + * + * @param {number} width - The width of the layer plane in world units. + * @param {number} height - The height of the layer plane in world units. + * @param {Vector3} translation - The position/translation of the layer plane in world units. + * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. + * @param {number} pixelwidth - The width of the layer's render target in pixels. + * @param {number} pixelheight - The height of the layer's render target in pixels. + * @param {Function} rendercall - A callback function that renders the layer. Similar to code in + * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. + * @param {Object} [attributes={}] - Allows to configure the layer's render target. + * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. + * @return {Mesh} A mesh representing the quadratic XR layer. This mesh should be added to the XR scene. + */ + createQuadLayer(width: number, height: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { + samples?: number | undefined; + }): Mesh; + /** + * This method can be used in XR applications to create a cylindrical layer that presents a separate + * rendered scene. + * + * @param {number} radius - The radius of the cylinder in world units. + * @param {number} centralAngle - The central angle of the cylinder in radians. + * @param {number} aspectratio - The aspect ratio. + * @param {Vector3} translation - The position/translation of the layer plane in world units. + * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. + * @param {number} pixelwidth - The width of the layer's render target in pixels. + * @param {number} pixelheight - The height of the layer's render target in pixels. + * @param {Function} rendercall - A callback function that renders the layer. Similar to code in + * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. + * @param {Object} [attributes={}] - Allows to configure the layer's render target. + * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. + * @return {Mesh} A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene. + */ + createCylinderLayer(radius: number, centralAngle: number, aspectratio: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { + samples?: number | undefined; + }): Mesh; + /** + * Renders the XR layers that have been previously added to the scene. + * + * This method is usually called in your animation loop before rendering + * the actual scene via `renderer.render( scene, camera );`. + */ + renderLayers(): void; + /** + * Returns the current XR session. + * + * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. + */ + getSession(): XRSession | null; + /** + * After a XR session has been requested usually with one of the `*Button` modules, it + * is injected into the renderer with this method. This method triggers the start of + * the actual XR rendering. + * + * @async + * @param {XRSession} session - The XR session to set. + * @return {Promise} A Promise that resolves when the session has been set. + */ + setSession(session: XRSession): Promise; + /** + * This method is called by the renderer per frame and updates the XR camera + * and it sub cameras based on the given camera. The given camera is the "user" + * camera created on application level and used for non-XR rendering. + * + * @param {PerspectiveCamera} camera - The camera. + */ + updateCamera(camera: PerspectiveCamera): void; + /** + * Returns a WebXR controller for the given controller index. + * + * @private + * @param {number} index - The controller index. + * @return {WebXRController} The XR controller. + */ + private _getController; +} +import { EventDispatcher } from '../../core/EventDispatcher.js'; +import { ArrayCamera } from '../../cameras/ArrayCamera.js'; +import { RenderTarget } from '../../core/RenderTarget.js'; +import { Vector3 } from '../../math/Vector3.js'; +import { Quaternion } from '../../math/Quaternion.js'; +import { Mesh } from '../../objects/Mesh.js'; +import { PerspectiveCamera } from '../../cameras/PerspectiveCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts new file mode 100644 index 000000000..e397d7c26 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts @@ -0,0 +1,66 @@ +/** + * A special type of render target that is used when rendering + * with the WebXR Device API. + * + * @private + * @augments RenderTarget + */ +export class XRRenderTarget extends RenderTarget { + /** + * Constructs a new XR render target. + * + * @param {number} [width=1] - The width of the render target. + * @param {number} [height=1] - The height of the render target. + * @param {Object} [options={}] - The configuration options. + */ + constructor(width?: number, height?: number, options?: Object); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isXRRenderTarget: boolean; + /** + * Whether the attachments of the render target + * are defined by external textures. This flag is + * set to `true` when using the WebXR Layers API. + * + * @private + * @type {boolean} + * @default false + */ + private _hasExternalTextures; + /** + * Whether a depth buffer should automatically be allocated + * for this XR render target or not. + * + * Allocating a depth buffer is the default behavior of XR render + * targets. However, when using the WebXR Layers API, this flag + * must be set to `false` when the `ignoreDepthValues` property of + * the projection layers evaluates to `false`. + * + * Reference: {@link https://www.w3.org/TR/webxrlayers-1/#dom-xrprojectionlayer-ignoredepthvalues}. + * + * @private + * @type {boolean} + * @default true + */ + private _autoAllocateDepthBuffer; + /** + * Whether this render target is associated with a XRWebGLLayer. + * + * A XRWebGLLayer points to an opaque framebuffer. Basically, + * this means that you don't have access to its bound color, + * stencil and depth buffers. We need to handle this framebuffer + * differently since its textures are always bound. + * + * @private + * @type {boolean} + * @default false + * */ + private _isOpaqueFramebuffer; + copy(source: any): this; +} +import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts new file mode 100644 index 000000000..4a90f691c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts @@ -0,0 +1,194 @@ +export default PMREMGenerator; +/** + * This class generates a Prefiltered, Mipmapped Radiance Environment Map + * (PMREM) from a cubeMap environment texture. This allows different levels of + * blur to be quickly accessed based on material roughness. It is packed into a + * special CubeUV format that allows us to perform custom interpolation so that + * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap + * chain, it only goes down to the LOD_MIN level (above), and then creates extra + * even more filtered 'mips' at the same LOD_MIN resolution, associated with + * higher roughness levels. In this way we maintain resolution to smoothly + * interpolate diffuse lighting while limiting sampling computation. + * + * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) + * importance sampling based on "Sampling the GGX Distribution of Visible Normals" + * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF + * used in material rendering for physically-based image-based lighting. + */ +declare class PMREMGenerator { + /** + * Constructs a new PMREM generator. + * + * @param {Renderer} renderer - The renderer. + */ + constructor(renderer: Renderer); + _renderer: Renderer; + _pingPongRenderTarget: RenderTarget | null; + _lodMax: number; + _cubeSize: number; + _sizeLods: any[]; + _lodMeshes: any[]; + _blurMaterial: NodeMaterial | null; + _ggxMaterial: NodeMaterial | null; + _cubemapMaterial: NodeMaterial | null; + _equirectMaterial: NodeMaterial | null; + _backgroundBox: Mesh | null; + get _hasInitialized(): any; + /** + * Generates a PMREM from a supplied Scene, which can be faster than using an + * image if networking bandwidth is low. Optional sigma specifies a blur radius + * in radians to be applied to the scene before PMREM generation. Optional near + * and far planes ensure the scene is rendered in its entirety. + * + * @param {Scene} scene - The scene to be captured. + * @param {number} [sigma=0] - The blur radius in radians. + * @param {number} [near=0.1] - The near plane distance. + * @param {number} [far=100] - The far plane distance. + * @param {Object} [options={}] - The configuration options. + * @param {number} [options.size=256] - The texture size of the PMREM. + * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. + * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. + * @return {RenderTarget} The resulting PMREM. + * @see {@link PMREMGenerator#fromScene} + */ + fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { + size?: number | undefined; + position?: Vector3 | undefined; + renderTarget?: RenderTarget | null | undefined; + }): RenderTarget; + /** + * Generates a PMREM from a supplied Scene, which can be faster than using an + * image if networking bandwidth is low. Optional sigma specifies a blur radius + * in radians to be applied to the scene before PMREM generation. Optional near + * and far planes ensure the scene is rendered in its entirety (the cubeCamera + * is placed at the origin). + * + * @deprecated + * @param {Scene} scene - The scene to be captured. + * @param {number} [sigma=0] - The blur radius in radians. + * @param {number} [near=0.1] - The near plane distance. + * @param {number} [far=100] - The far plane distance. + * @param {Object} [options={}] - The configuration options. + * @param {number} [options.size=256] - The texture size of the PMREM. + * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. + * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. + * @return {Promise} A Promise that resolve with the PMREM when the generation has been finished. + * @see {@link PMREMGenerator#fromScene} + */ + fromSceneAsync(scene: Scene, sigma?: number, near?: number, far?: number, options?: { + size?: number | undefined; + position?: Vector3 | undefined; + renderTarget?: RenderTarget | null | undefined; + }): Promise; + /** + * Generates a PMREM from an equirectangular texture, which can be either LDR + * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best + * with the 256 x 256 cubemap output. The minimum supported input image size + * is 64 x 32. + * + * @param {Texture} equirectangular - The equirectangular texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {RenderTarget} The resulting PMREM. + * @see {@link PMREMGenerator#fromEquirectangularAsync} + */ + fromEquirectangular(equirectangular: Texture, renderTarget?: RenderTarget | null): RenderTarget; + /** + * Generates a PMREM from an equirectangular texture, which can be either LDR + * or HDR. The ideal input image size is 1k (1024 x 512), + * as this matches best with the 256 x 256 cubemap output. + * + * @deprecated + * @param {Texture} equirectangular - The equirectangular texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {Promise} The resulting PMREM. + * @see {@link PMREMGenerator#fromEquirectangular} + */ + fromEquirectangularAsync(equirectangular: Texture, renderTarget?: RenderTarget | null): Promise; + /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, as this matches best + * with the 256 x 256 cubemap output. The minimum supported input cube + * size is 16 x 16 per face. + * + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {RenderTarget} The resulting PMREM. + * @see {@link PMREMGenerator#fromCubemapAsync} + */ + fromCubemap(cubemap: Texture, renderTarget?: RenderTarget | null): RenderTarget; + /** + * Generates a PMREM from an cubemap texture, which can be either LDR + * or HDR. The ideal input cube size is 256 x 256, + * with the 256 x 256 cubemap output. + * + * @deprecated + * @param {Texture} cubemap - The cubemap texture to be converted. + * @param {?RenderTarget} [renderTarget=null] - The render target to use. + * @return {Promise} The resulting PMREM. + * @see {@link PMREMGenerator#fromCubemap} + */ + fromCubemapAsync(cubemap: Texture, renderTarget?: RenderTarget | null): Promise; + /** + * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + * + * @returns {Promise} + */ + compileCubemapShader(): Promise; + /** + * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during + * your texture's network fetch for increased concurrency. + * + * @returns {Promise} + */ + compileEquirectangularShader(): Promise; + /** + * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, + * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on + * one of them will cause any others to also become unusable. + */ + dispose(): void; + _setSizeFromTexture(texture: any): void; + _setSize(cubeSize: any): void; + _dispose(): void; + _cleanup(outputTarget: any): void; + _fromTexture(texture: any, renderTarget: any): any; + _allocateTarget(depthBuffer: any): RenderTarget; + _init(renderTarget: any): void; + _compileMaterial(material: any): Promise; + _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; + _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; + _applyPMREM(cubeUVRenderTarget: any): void; + /** + * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. + * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the + * GGX BRDF for physically-based rendering. Reads from the previous LOD level and + * applies incremental roughness filtering to avoid over-blurring. + * + * @private + * @param {RenderTarget} cubeUVRenderTarget + * @param {number} lodIn - Source LOD level to read from + * @param {number} lodOut - Target LOD level to write to + */ + private _applyGGXFilter; + /** + * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples + * the Gaussian along a spiral kernel (Golden Angle), which distributes samples + * isotropically on the sphere (no pole artifacts). + * + * Used for initial scene blur in fromScene() method when sigma > 0. + * + * @private + * @param {RenderTarget} cubeUVRenderTarget - The cubemap render target. + * @param {number} lodIn - The input level-of-detail. + * @param {number} lodOut - The output level-of-detail. + * @param {number} sigma - The blur radius in radians. + */ + private _blur; + _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; + _setViewport(target: any, x: any, y: any, width: any, height: any): void; +} +import { RenderTarget } from '../../../core/RenderTarget.js'; +import NodeMaterial from '../../../materials/nodes/NodeMaterial.js'; +import { Mesh } from '../../../objects/Mesh.js'; +import { Vector3 } from '../../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts new file mode 100644 index 000000000..af3e23934 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts @@ -0,0 +1,112 @@ +export default NodeBuilderState; +/** + * This module represents the state of a node builder after it was + * used to build the nodes for a render object. The state holds the + * results of the build for further processing in the renderer. + * + * Render objects with identical cache keys share the same node builder state. + * + * @private + */ +declare class NodeBuilderState { + /** + * Constructs a new node builder state. + * + * @param {string} vertexShader - The native vertex shader code. + * @param {string} fragmentShader - The native fragment shader code. + * @param {string} computeShader - The native compute shader code. + * @param {Array} nodeAttributes - An array of node attributes. + * @param {Array} bindings - An array of bind groups. + * @param {Array} updateNodes - An array of nodes that implement their `update()` method. + * @param {Array} updateBeforeNodes - An array of nodes that implement their `updateBefore()` method. + * @param {Array} updateAfterNodes - An array of nodes that implement their `updateAfter()` method. + * @param {NodeMaterialObserver} observer - A node material observer. + * @param {boolean} hardwareClipping - Whether the built material uses hardware clipping or not. + * @param {Array} transforms - An array with transform attribute objects. Only relevant when using compute shaders with WebGL 2. + */ + constructor(vertexShader: string, fragmentShader: string, computeShader: string, nodeAttributes: Array, bindings: Array, updateNodes: Array, updateBeforeNodes: Array, updateAfterNodes: Array, observer: NodeMaterialObserver, hardwareClipping: boolean, transforms?: Array); + /** + * The native vertex shader code. + * + * @type {string} + */ + vertexShader: string; + /** + * The native fragment shader code. + * + * @type {string} + */ + fragmentShader: string; + /** + * The native compute shader code. + * + * @type {string} + */ + computeShader: string; + /** + * An array with transform attribute objects. + * Only relevant when using compute shaders with WebGL 2. + * + * @type {Array} + */ + transforms: Array; + /** + * An array of node attributes representing + * the attributes of the shaders. + * + * @type {Array} + */ + nodeAttributes: Array; + /** + * An array of bind groups representing the uniform or storage + * buffers, texture or samplers of the shader. + * + * @type {Array} + */ + bindings: Array; + /** + * An array of nodes that implement their `update()` method. + * + * @type {Array} + */ + updateNodes: Array; + /** + * An array of nodes that implement their `updateBefore()` method. + * + * @type {Array} + */ + updateBeforeNodes: Array; + /** + * An array of nodes that implement their `updateAfter()` method. + * + * @type {Array} + */ + updateAfterNodes: Array; + /** + * A node material observer. + * + * @type {NodeMaterialObserver} + */ + observer: NodeMaterialObserver; + /** + * Whether the built material uses hardware clipping or not. + * + * @type {boolean} + */ + hardwareClipping: boolean; + /** + * How often this state is used by render objects. + * + * @type {number} + */ + usedTimes: number; + /** + * This method is used to create a array of bind groups based + * on the existing bind groups of this state. Shared groups are + * not cloned. + * + * @return {Array} A array of bind groups. + */ + createBindings(): Array; +} +import BindGroup from '../BindGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts new file mode 100644 index 000000000..0121dd34b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts @@ -0,0 +1,99 @@ +export default NodeLibrary; +/** + * The purpose of a node library is to assign node implementations + * to existing library features. In `WebGPURenderer` lights, materials + * which are not based on `NodeMaterial` as well as tone mapping techniques + * are implemented with node-based modules. + * + * @private + */ +declare class NodeLibrary { + /** + * A weak map that maps lights to light nodes. + * + * @type {WeakMap} + */ + lightNodes: WeakMap; + /** + * A map that maps materials to node materials. + * + * @type {Map} + */ + materialNodes: Map; + /** + * A map that maps tone mapping techniques (constants) + * to tone mapping node functions. + * + * @type {Map} + */ + toneMappingNodes: Map; + /** + * Returns a matching node material instance for the given material object. + * + * This method also assigns/copies the properties of the given material object + * to the node material. This is done to make sure the current material + * configuration carries over to the node version. + * + * @param {Material} material - A material. + * @return {NodeMaterial} The corresponding node material. + */ + fromMaterial(material: Material): NodeMaterial; + /** + * Adds a tone mapping node function for a tone mapping technique (constant). + * + * @param {Function} toneMappingNode - The tone mapping node function. + * @param {number} toneMapping - The tone mapping. + */ + addToneMapping(toneMappingNode: Function, toneMapping: number): void; + /** + * Returns a tone mapping node function for a tone mapping technique (constant). + * + * @param {number} toneMapping - The tone mapping. + * @return {?Function} The tone mapping node function. Returns `null` if no node function is found. + */ + getToneMappingFunction(toneMapping: number): Function | null; + /** + * Returns a node material class definition for a material type. + * + * @param {string} materialType - The material type. + * @return {?NodeMaterial.constructor} The node material class definition. Returns `null` if no node material is found. + */ + getMaterialNodeClass(materialType: string): NodeMaterial.constructor | null; + /** + * Adds a node material class definition for a given material type. + * + * @param {NodeMaterial.constructor} materialNodeClass - The node material class definition. + * @param {string} materialClassType - The material type. + */ + addMaterial(materialNodeClass: NodeMaterial.constructor, materialClassType: string): void; + /** + * Returns a light node class definition for a light class definition. + * + * @param {Light.constructor} light - The light class definition. + * @return {?AnalyticLightNode.constructor} The light node class definition. Returns `null` if no light node is found. + */ + getLightNodeClass(light: Light.constructor): AnalyticLightNode.constructor | null; + /** + * Adds a light node class definition for a given light class definition. + * + * @param {AnalyticLightNode.constructor} lightNodeClass - The light node class definition. + * @param {Light.constructor} lightClass - The light class definition. + */ + addLight(lightNodeClass: AnalyticLightNode.constructor, lightClass: Light.constructor): void; + /** + * Adds a node class definition for the given type to the provided type library. + * + * @param {Node.constructor} nodeClass - The node class definition. + * @param {number|string} type - The object type. + * @param {Map} library - The type library. + */ + addType(nodeClass: Node.constructor, type: number | string, library: Map): void; + /** + * Adds a node class definition for the given class definition to the provided type library. + * + * @param {Node.constructor} nodeClass - The node class definition. + * @param {Node.constructor} baseClass - The class definition. + * @param {WeakMap} library - The type library. + */ + addClass(nodeClass: Node.constructor, baseClass: Node.constructor, library: WeakMap): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts new file mode 100644 index 000000000..64db1c627 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts @@ -0,0 +1,296 @@ +export default NodeManager; +/** + * This renderer module manages node-related objects and is the + * primary interface between the renderer and the node system. + * + * @private + * @augments DataMap + */ +declare class NodeManager extends DataMap { + /** + * Constructs a new nodes management component. + * + * @param {Renderer} renderer - The renderer. + * @param {Backend} backend - The renderer's backend. + */ + constructor(renderer: Renderer, backend: Backend); + /** + * The renderer. + * + * @type {Renderer} + */ + renderer: Renderer; + /** + * The renderer's backend. + * + * @type {Backend} + */ + backend: Backend; + /** + * The node frame. + * + * @type {Renderer} + */ + nodeFrame: Renderer; + /** + * A cache for managing node builder states. + * + * @type {Map} + */ + nodeBuilderCache: Map; + /** + * A cache for managing data cache key data. + * + * @type {ChainMap} + */ + callHashCache: ChainMap; + /** + * A cache for managing node uniforms group data. + * + * @type {ChainMap} + */ + groupsData: ChainMap; + /** + * Queue for pending async builds to limit concurrent compilation. + * + * @private + * @type {Array} + */ + private _buildQueue; + /** + * Whether an async build is currently in progress. + * + * @private + * @type {boolean} + */ + private _buildInProgress; + /** + * A cache for managing node objects of + * scene properties like fog or environments. + * + * @type {Object} + */ + cacheLib: { + [x: string]: WeakMap; + }; + /** + * Returns `true` if the given node uniforms group must be updated or not. + * + * @param {NodeUniformsGroup} nodeUniformsGroup - The node uniforms group. + * @return {boolean} Whether the node uniforms group requires an update or not. + */ + updateGroup(nodeUniformsGroup: NodeUniformsGroup): boolean; + /** + * Returns the cache key for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {number} The cache key. + */ + getForRenderCacheKey(renderObject: RenderObject): number; + /** + * Creates a node builder configured for the given render object and material. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {Material} material - The material to use. + * @return {NodeBuilder} The configured node builder. + */ + private _createNodeBuilder; + /** + * Returns a node builder state for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {boolean} [useAsync=false] - Whether to use async build with yielding. + * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). + */ + getForRender(renderObject: RenderObject, useAsync?: boolean): NodeBuilderState | Promise; + /** + * Async version of getForRender() that yields to main thread during build. + * Use this in compileAsync() to prevent blocking the main thread. + * + * @param {RenderObject} renderObject - The render object. + * @return {Promise} A promise that resolves to the node builder state. + */ + getForRenderAsync(renderObject: RenderObject): Promise; + /** + * Returns nodeBuilderState if ready, null if pending async build. + * Queues async build on first call for cache miss. + * Use this in render() path to enable non-blocking compilation. + * + * @param {RenderObject} renderObject - The render object. + * @return {?NodeBuilderState} The node builder state, or null if still building. + */ + getForRenderDeferred(renderObject: RenderObject): NodeBuilderState | null; + /** + * Processes the build queue one item at a time. + * This ensures builds don't all run simultaneously and freeze the main thread. + * + * @private + */ + private _processBuildQueue; + /** + * Deletes the given object from the internal data map + * + * @param {any} object - The object to delete. + * @return {?Object} The deleted dictionary. + */ + delete(object: any): Object | null; + /** + * Returns a node builder state for the given compute node. + * + * @param {Node} computeNode - The compute node. + * @param {boolean} [useAsync=false] - Whether to use async build with yielding. + * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). + */ + getForCompute(computeNode: Node, useAsync?: boolean): NodeBuilderState | Promise; + /** + * Async version of getForCompute() that yields to main thread during build. + * Use this in compileComputeAsync() to prevent blocking the main thread. + * + * @param {Node} computeNode - The compute node. + * @return {Promise} A promise that resolves to the node builder state. + */ + getForComputeAsync(computeNode: Node): Promise; + /** + * Creates a node builder state for the given node builder. + * + * @private + * @param {NodeBuilder} nodeBuilder - The node builder. + * @return {NodeBuilderState} The node builder state. + */ + private _createNodeBuilderState; + /** + * Returns an environment node for the current configured + * scene environment. + * + * @param {Scene} scene - The scene. + * @return {Node} A node representing the current scene environment. + */ + getEnvironmentNode(scene: Scene): Node; + /** + * Returns a background node for the current configured + * scene background. + * + * @param {Scene} scene - The scene. + * @return {Node} A node representing the current scene background. + */ + getBackgroundNode(scene: Scene): Node; + /** + * Returns a fog node for the current configured scene fog. + * + * @param {Scene} scene - The scene. + * @return {Node} A node representing the current scene fog. + */ + getFogNode(scene: Scene): Node; + /** + * Returns a cache key for the given scene and lights node. + * This key is used by `RenderObject` as a part of the dynamic + * cache key (a key that must be checked every time the render + * objects is drawn). + * + * @param {Scene} scene - The scene. + * @param {LightsNode} lightsNode - The lights node. + * @return {number} The cache key. + */ + getCacheKey(scene: Scene, lightsNode: LightsNode): number; + /** + * A boolean that indicates whether tone mapping should be enabled + * or not. + * + * @type {boolean} + */ + get isToneMappingState(): boolean; + /** + * If a scene background is configured, this method makes sure to + * represent the background with a corresponding node-based implementation. + * + * @param {Scene} scene - The scene. + */ + updateBackground(scene: Scene): void; + /** + * This method is part of the caching of nodes which are used to represents the + * scene's background, fog or environment. + * + * @param {string} type - The type of object to cache. + * @param {Object} object - The object. + * @param {Function} callback - A callback that produces a node representation for the given object. + * @param {boolean} [forceUpdate=false] - Whether an update should be enforced or not. + * @return {Node} The node representation. + */ + getCacheNode(type: string, object: Object, callback: Function, forceUpdate?: boolean): Node; + /** + * If a scene fog is configured, this method makes sure to + * represent the fog with a corresponding node-based implementation. + * + * @param {Scene} scene - The scene. + */ + updateFog(scene: Scene): void; + /** + * If a scene environment is configured, this method makes sure to + * represent the environment with a corresponding node-based implementation. + * + * @param {Scene} scene - The scene. + */ + updateEnvironment(scene: Scene): void; + getNodeFrame(renderer?: Renderer, scene?: null, object?: null, camera?: null, material?: null): Renderer; + getNodeFrameForRender(renderObject: any): Renderer; + /** + * Returns the current output cache key. + * + * @return {string} The output cache key. + */ + getOutputCacheKey(): string; + /** + * Returns a node that represents the output configuration (tone mapping and + * color space) for the current target. + * + * @param {Texture} outputTarget - The output target. + * @return {Node} The output node. + */ + getOutputNode(outputTarget: Texture): Node; + /** + * Sets the output layer index for array texture output pass. + * This should be called before each layer render during the output pass. + * + * @param {number} index - The layer index. + */ + setOutputLayerIndex(index: number): void; + /** + * Triggers the call of `updateBefore()` methods + * for all nodes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateBefore(renderObject: RenderObject): void; + /** + * Triggers the call of `updateAfter()` methods + * for all nodes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateAfter(renderObject: RenderObject): void; + /** + * Triggers the call of `update()` methods + * for all nodes of the given compute node. + * + * @param {Node} computeNode - The compute node. + */ + updateForCompute(computeNode: Node): void; + /** + * Triggers the call of `update()` methods + * for all nodes of the given render object. + * + * @param {RenderObject} renderObject - The render object. + */ + updateForRender(renderObject: RenderObject): void; + /** + * Returns the refresh type of the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {number} The refresh type, see `RenderObjectRefreshType`. + */ + needsRefresh(renderObject: RenderObject): number; +} +import DataMap from '../DataMap.js'; +import NodeBuilderState from './NodeBuilderState.js'; +import ChainMap from '../ChainMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts new file mode 100644 index 000000000..3c380c248 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts @@ -0,0 +1,72 @@ +/** + * A special form of sampled texture binding type. + * It's texture value is managed by a node object. + * + * @private + * @augments SampledTexture + */ +export class NodeSampledTexture extends SampledTexture { + /** + * Constructs a new node-based sampled texture. + * + * @param {string} name - The textures's name. + * @param {TextureNode} textureNode - The texture node. + * @param {UniformGroupNode} groupNode - The uniform group node. + * @param {?string} [access=null] - The access type. + */ + constructor(name: string, textureNode: TextureNode, groupNode: UniformGroupNode, access?: string | null); + /** + * The texture node. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * The uniform group node. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; + /** + * The access type. + * + * @type {?string} + * @default null + */ + access: string | null; +} +/** + * A special form of sampled cube texture binding type. + * It's texture value is managed by a node object. + * + * @private + * @augments NodeSampledTexture + */ +export class NodeSampledCubeTexture extends NodeSampledTexture { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampledCubeTexture: boolean; +} +/** + * A special form of sampled 3D texture binding type. + * It's texture value is managed by a node object. + * + * @private + * @augments NodeSampledTexture + */ +export class NodeSampledTexture3D extends NodeSampledTexture { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isSampledTexture3D: boolean; +} +import { SampledTexture } from '../SampledTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts new file mode 100644 index 000000000..b5ad4701d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts @@ -0,0 +1,31 @@ +export default NodeSampler; +/** + * A special form of sampler binding type. + * It's texture value is managed by a node object. + * + * @private + * @augments Sampler + */ +declare class NodeSampler extends Sampler { + /** + * Constructs a new node-based sampler. + * + * @param {string} name - The samplers's name. + * @param {TextureNode} textureNode - The texture node. + * @param {UniformGroupNode} groupNode - The uniform group node. + */ + constructor(name: string, textureNode: TextureNode, groupNode: UniformGroupNode); + /** + * The texture node. + * + * @type {TextureNode} + */ + textureNode: TextureNode; + /** + * The uniform group node. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; +} +import Sampler from '../Sampler.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts new file mode 100644 index 000000000..ca5196126 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts @@ -0,0 +1,36 @@ +export default NodeStorageBuffer; +/** + * A special form of storage buffer binding type. + * It's buffer value is managed by a node object. + * + * @private + * @augments StorageBuffer + */ +declare class NodeStorageBuffer extends StorageBuffer { + /** + * Constructs a new node-based storage buffer. + * + * @param {StorageBufferNode} nodeUniform - The storage buffer node. + * @param {UniformGroupNode} groupNode - The uniform group node. + */ + constructor(nodeUniform: StorageBufferNode, groupNode: UniformGroupNode); + /** + * The node uniform. + * + * @type {StorageBufferNode} + */ + nodeUniform: StorageBufferNode; + /** + * The access type. + * + * @type {string} + */ + access: string; + /** + * The uniform group node. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; +} +import StorageBuffer from '../StorageBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts new file mode 100644 index 000000000..47673f68d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts @@ -0,0 +1,230 @@ +/** + * A special form of Number uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments NumberUniform + */ +export class NumberNodeUniform extends NumberUniform { + /** + * Constructs a new node-based Number uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Overwritten to return the value of the node uniform. + * + * @return {number} The value. + */ + getValue(): number; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +/** + * A special form of Vector2 uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments Vector2Uniform + */ +export class Vector2NodeUniform extends Vector2Uniform { + /** + * Constructs a new node-based Vector2 uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +/** + * A special form of Vector3 uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments Vector3Uniform + */ +export class Vector3NodeUniform extends Vector3Uniform { + /** + * Constructs a new node-based Vector3 uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +/** + * A special form of Vector4 uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments Vector4Uniform + */ +export class Vector4NodeUniform extends Vector4Uniform { + /** + * Constructs a new node-based Vector4 uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +/** + * A special form of Color uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments ColorUniform + */ +export class ColorNodeUniform extends ColorUniform { + /** + * Constructs a new node-based Color uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +/** + * A special form of Matrix2 uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments Matrix2Uniform + */ +export class Matrix2NodeUniform extends Matrix2Uniform { + /** + * Constructs a new node-based Matrix2 uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +/** + * A special form of Matrix3 uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments Matrix3Uniform + */ +export class Matrix3NodeUniform extends Matrix3Uniform { + /** + * Constructs a new node-based Matrix3 uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +/** + * A special form of Matrix4 uniform binding type. + * It's value is managed by a node object. + * + * @private + * @augments Matrix4Uniform + */ +export class Matrix4NodeUniform extends Matrix4Uniform { + /** + * Constructs a new node-based Matrix4 uniform. + * + * @param {NodeUniform} nodeUniform - The node uniform. + */ + constructor(nodeUniform: NodeUniform); + /** + * The node uniform. + * + * @type {NodeUniform} + */ + nodeUniform: NodeUniform; + /** + * Returns the node uniform data type. + * + * @return {string} The data type. + */ + getType(): string; +} +import { NumberUniform } from '../Uniform.js'; +import { Vector2Uniform } from '../Uniform.js'; +import { Vector3Uniform } from '../Uniform.js'; +import { Vector4Uniform } from '../Uniform.js'; +import { ColorUniform } from '../Uniform.js'; +import { Matrix2Uniform } from '../Uniform.js'; +import { Matrix3Uniform } from '../Uniform.js'; +import { Matrix4Uniform } from '../Uniform.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts new file mode 100644 index 000000000..495dc5d8c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts @@ -0,0 +1,56 @@ +export default NodeUniformBuffer; +/** + * A special form of uniform buffer binding type. + * It's buffer value is managed by a node object. + * + * @private + * @augments UniformBuffer + */ +declare class NodeUniformBuffer extends UniformBuffer { + /** + * Constructs a new node-based uniform buffer. + * + * @param {BufferNode} nodeUniform - The uniform buffer node. + * @param {UniformGroupNode} groupNode - The uniform group node. + */ + constructor(nodeUniform: BufferNode, groupNode: UniformGroupNode); + /** + * The uniform buffer node. + * + * @type {BufferNode} + */ + nodeUniform: BufferNode; + /** + * The uniform group node. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeUniformBuffer: boolean; + /** + * The array of update ranges. + * + * @param {Array<{start: number, count: number}>} value - The update ranges. + */ + set updateRanges(value: Array<{ + start: number; + count: number; + }>); + /** + * The array of update ranges. + * + * @type {Array<{start: number, count: number}>} + */ + get updateRanges(): Array<{ + start: number; + count: number; + }>; +} +import UniformBuffer from '../UniformBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts new file mode 100644 index 000000000..c196bbe56 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts @@ -0,0 +1,38 @@ +export default NodeUniformsGroup; +/** + * A special form of uniforms group that represents + * the individual uniforms as node-based uniforms. + * + * @private + * @augments UniformsGroup + */ +declare class NodeUniformsGroup extends UniformsGroup { + /** + * Constructs a new node-based uniforms group. + * + * @param {string} name - The group's name. + * @param {UniformGroupNode} groupNode - The uniform group node. + */ + constructor(name: string, groupNode: UniformGroupNode); + /** + * The group's ID. + * + * @type {number} + */ + id: number; + /** + * The uniform group node. + * + * @type {UniformGroupNode} + */ + groupNode: UniformGroupNode; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isNodeUniformsGroup: boolean; +} +import UniformsGroup from '../UniformsGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts new file mode 100644 index 000000000..408609494 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts @@ -0,0 +1 @@ +export function getDFGLUT(): any; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts new file mode 100644 index 000000000..8fb607cb0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts @@ -0,0 +1,252 @@ +export namespace ShaderChunk { + export { alphahash_fragment }; + export { alphahash_pars_fragment }; + export { alphamap_fragment }; + export { alphamap_pars_fragment }; + export { alphatest_fragment }; + export { alphatest_pars_fragment }; + export { aomap_fragment }; + export { aomap_pars_fragment }; + export { batching_pars_vertex }; + export { batching_vertex }; + export { begin_vertex }; + export { beginnormal_vertex }; + export { bsdfs }; + export { iridescence_fragment }; + export { bumpmap_pars_fragment }; + export { clipping_planes_fragment }; + export { clipping_planes_pars_fragment }; + export { clipping_planes_pars_vertex }; + export { clipping_planes_vertex }; + export { color_fragment }; + export { color_pars_fragment }; + export { color_pars_vertex }; + export { color_vertex }; + export { common }; + export { cube_uv_reflection_fragment }; + export { defaultnormal_vertex }; + export { displacementmap_pars_vertex }; + export { displacementmap_vertex }; + export { emissivemap_fragment }; + export { emissivemap_pars_fragment }; + export { colorspace_fragment }; + export { colorspace_pars_fragment }; + export { envmap_fragment }; + export { envmap_common_pars_fragment }; + export { envmap_pars_fragment }; + export { envmap_pars_vertex }; + export { envmap_physical_pars_fragment }; + export { envmap_vertex }; + export { fog_vertex }; + export { fog_pars_vertex }; + export { fog_fragment }; + export { fog_pars_fragment }; + export { gradientmap_pars_fragment }; + export { lightmap_pars_fragment }; + export { lights_lambert_fragment }; + export { lights_lambert_pars_fragment }; + export { lights_pars_begin }; + export { lights_toon_fragment }; + export { lights_toon_pars_fragment }; + export { lights_phong_fragment }; + export { lights_phong_pars_fragment }; + export { lights_physical_fragment }; + export { lights_physical_pars_fragment }; + export { lights_fragment_begin }; + export { lights_fragment_maps }; + export { lights_fragment_end }; + export { lightprobes_pars_fragment }; + export { logdepthbuf_fragment }; + export { logdepthbuf_pars_fragment }; + export { logdepthbuf_pars_vertex }; + export { logdepthbuf_vertex }; + export { map_fragment }; + export { map_pars_fragment }; + export { map_particle_fragment }; + export { map_particle_pars_fragment }; + export { metalnessmap_fragment }; + export { metalnessmap_pars_fragment }; + export { morphinstance_vertex }; + export { morphcolor_vertex }; + export { morphnormal_vertex }; + export { morphtarget_pars_vertex }; + export { morphtarget_vertex }; + export { normal_fragment_begin }; + export { normal_fragment_maps }; + export { normal_pars_fragment }; + export { normal_pars_vertex }; + export { normal_vertex }; + export { normalmap_pars_fragment }; + export { clearcoat_normal_fragment_begin }; + export { clearcoat_normal_fragment_maps }; + export { clearcoat_pars_fragment }; + export { iridescence_pars_fragment }; + export { opaque_fragment }; + export { packing }; + export { premultiplied_alpha_fragment }; + export { project_vertex }; + export { dithering_fragment }; + export { dithering_pars_fragment }; + export { roughnessmap_fragment }; + export { roughnessmap_pars_fragment }; + export { shadowmap_pars_fragment }; + export { shadowmap_pars_vertex }; + export { shadowmap_vertex }; + export { shadowmask_pars_fragment }; + export { skinbase_vertex }; + export { skinning_pars_vertex }; + export { skinning_vertex }; + export { skinnormal_vertex }; + export { specularmap_fragment }; + export { specularmap_pars_fragment }; + export { tonemapping_fragment }; + export { tonemapping_pars_fragment }; + export { transmission_fragment }; + export { transmission_pars_fragment }; + export { uv_pars_fragment }; + export { uv_pars_vertex }; + export { uv_vertex }; + export { worldpos_vertex }; + export let background_vert: string; + export let background_frag: string; + export let backgroundCube_vert: string; + export let backgroundCube_frag: string; + export let cube_vert: string; + export let cube_frag: string; + export let depth_vert: string; + export let depth_frag: string; + export let distance_vert: string; + export let distance_frag: string; + export let equirect_vert: string; + export let equirect_frag: string; + export let linedashed_vert: string; + export let linedashed_frag: string; + export let meshbasic_vert: string; + export let meshbasic_frag: string; + export let meshlambert_vert: string; + export let meshlambert_frag: string; + export let meshmatcap_vert: string; + export let meshmatcap_frag: string; + export let meshnormal_vert: string; + export let meshnormal_frag: string; + export let meshphong_vert: string; + export let meshphong_frag: string; + export let meshphysical_vert: string; + export let meshphysical_frag: string; + export let meshtoon_vert: string; + export let meshtoon_frag: string; + export let points_vert: string; + export let points_frag: string; + export let shadow_vert: string; + export let shadow_frag: string; + export let sprite_vert: string; + export let sprite_frag: string; +} +import alphahash_fragment from './ShaderChunk/alphahash_fragment.glsl.js'; +import alphahash_pars_fragment from './ShaderChunk/alphahash_pars_fragment.glsl.js'; +import alphamap_fragment from './ShaderChunk/alphamap_fragment.glsl.js'; +import alphamap_pars_fragment from './ShaderChunk/alphamap_pars_fragment.glsl.js'; +import alphatest_fragment from './ShaderChunk/alphatest_fragment.glsl.js'; +import alphatest_pars_fragment from './ShaderChunk/alphatest_pars_fragment.glsl.js'; +import aomap_fragment from './ShaderChunk/aomap_fragment.glsl.js'; +import aomap_pars_fragment from './ShaderChunk/aomap_pars_fragment.glsl.js'; +import batching_pars_vertex from './ShaderChunk/batching_pars_vertex.glsl.js'; +import batching_vertex from './ShaderChunk/batching_vertex.glsl.js'; +import begin_vertex from './ShaderChunk/begin_vertex.glsl.js'; +import beginnormal_vertex from './ShaderChunk/beginnormal_vertex.glsl.js'; +import bsdfs from './ShaderChunk/bsdfs.glsl.js'; +import iridescence_fragment from './ShaderChunk/iridescence_fragment.glsl.js'; +import bumpmap_pars_fragment from './ShaderChunk/bumpmap_pars_fragment.glsl.js'; +import clipping_planes_fragment from './ShaderChunk/clipping_planes_fragment.glsl.js'; +import clipping_planes_pars_fragment from './ShaderChunk/clipping_planes_pars_fragment.glsl.js'; +import clipping_planes_pars_vertex from './ShaderChunk/clipping_planes_pars_vertex.glsl.js'; +import clipping_planes_vertex from './ShaderChunk/clipping_planes_vertex.glsl.js'; +import color_fragment from './ShaderChunk/color_fragment.glsl.js'; +import color_pars_fragment from './ShaderChunk/color_pars_fragment.glsl.js'; +import color_pars_vertex from './ShaderChunk/color_pars_vertex.glsl.js'; +import color_vertex from './ShaderChunk/color_vertex.glsl.js'; +import common from './ShaderChunk/common.glsl.js'; +import cube_uv_reflection_fragment from './ShaderChunk/cube_uv_reflection_fragment.glsl.js'; +import defaultnormal_vertex from './ShaderChunk/defaultnormal_vertex.glsl.js'; +import displacementmap_pars_vertex from './ShaderChunk/displacementmap_pars_vertex.glsl.js'; +import displacementmap_vertex from './ShaderChunk/displacementmap_vertex.glsl.js'; +import emissivemap_fragment from './ShaderChunk/emissivemap_fragment.glsl.js'; +import emissivemap_pars_fragment from './ShaderChunk/emissivemap_pars_fragment.glsl.js'; +import colorspace_fragment from './ShaderChunk/colorspace_fragment.glsl.js'; +import colorspace_pars_fragment from './ShaderChunk/colorspace_pars_fragment.glsl.js'; +import envmap_fragment from './ShaderChunk/envmap_fragment.glsl.js'; +import envmap_common_pars_fragment from './ShaderChunk/envmap_common_pars_fragment.glsl.js'; +import envmap_pars_fragment from './ShaderChunk/envmap_pars_fragment.glsl.js'; +import envmap_pars_vertex from './ShaderChunk/envmap_pars_vertex.glsl.js'; +import envmap_physical_pars_fragment from './ShaderChunk/envmap_physical_pars_fragment.glsl.js'; +import envmap_vertex from './ShaderChunk/envmap_vertex.glsl.js'; +import fog_vertex from './ShaderChunk/fog_vertex.glsl.js'; +import fog_pars_vertex from './ShaderChunk/fog_pars_vertex.glsl.js'; +import fog_fragment from './ShaderChunk/fog_fragment.glsl.js'; +import fog_pars_fragment from './ShaderChunk/fog_pars_fragment.glsl.js'; +import gradientmap_pars_fragment from './ShaderChunk/gradientmap_pars_fragment.glsl.js'; +import lightmap_pars_fragment from './ShaderChunk/lightmap_pars_fragment.glsl.js'; +import lights_lambert_fragment from './ShaderChunk/lights_lambert_fragment.glsl.js'; +import lights_lambert_pars_fragment from './ShaderChunk/lights_lambert_pars_fragment.glsl.js'; +import lights_pars_begin from './ShaderChunk/lights_pars_begin.glsl.js'; +import lights_toon_fragment from './ShaderChunk/lights_toon_fragment.glsl.js'; +import lights_toon_pars_fragment from './ShaderChunk/lights_toon_pars_fragment.glsl.js'; +import lights_phong_fragment from './ShaderChunk/lights_phong_fragment.glsl.js'; +import lights_phong_pars_fragment from './ShaderChunk/lights_phong_pars_fragment.glsl.js'; +import lights_physical_fragment from './ShaderChunk/lights_physical_fragment.glsl.js'; +import lights_physical_pars_fragment from './ShaderChunk/lights_physical_pars_fragment.glsl.js'; +import lights_fragment_begin from './ShaderChunk/lights_fragment_begin.glsl.js'; +import lights_fragment_maps from './ShaderChunk/lights_fragment_maps.glsl.js'; +import lights_fragment_end from './ShaderChunk/lights_fragment_end.glsl.js'; +import lightprobes_pars_fragment from './ShaderChunk/lightprobes_pars_fragment.glsl.js'; +import logdepthbuf_fragment from './ShaderChunk/logdepthbuf_fragment.glsl.js'; +import logdepthbuf_pars_fragment from './ShaderChunk/logdepthbuf_pars_fragment.glsl.js'; +import logdepthbuf_pars_vertex from './ShaderChunk/logdepthbuf_pars_vertex.glsl.js'; +import logdepthbuf_vertex from './ShaderChunk/logdepthbuf_vertex.glsl.js'; +import map_fragment from './ShaderChunk/map_fragment.glsl.js'; +import map_pars_fragment from './ShaderChunk/map_pars_fragment.glsl.js'; +import map_particle_fragment from './ShaderChunk/map_particle_fragment.glsl.js'; +import map_particle_pars_fragment from './ShaderChunk/map_particle_pars_fragment.glsl.js'; +import metalnessmap_fragment from './ShaderChunk/metalnessmap_fragment.glsl.js'; +import metalnessmap_pars_fragment from './ShaderChunk/metalnessmap_pars_fragment.glsl.js'; +import morphinstance_vertex from './ShaderChunk/morphinstance_vertex.glsl.js'; +import morphcolor_vertex from './ShaderChunk/morphcolor_vertex.glsl.js'; +import morphnormal_vertex from './ShaderChunk/morphnormal_vertex.glsl.js'; +import morphtarget_pars_vertex from './ShaderChunk/morphtarget_pars_vertex.glsl.js'; +import morphtarget_vertex from './ShaderChunk/morphtarget_vertex.glsl.js'; +import normal_fragment_begin from './ShaderChunk/normal_fragment_begin.glsl.js'; +import normal_fragment_maps from './ShaderChunk/normal_fragment_maps.glsl.js'; +import normal_pars_fragment from './ShaderChunk/normal_pars_fragment.glsl.js'; +import normal_pars_vertex from './ShaderChunk/normal_pars_vertex.glsl.js'; +import normal_vertex from './ShaderChunk/normal_vertex.glsl.js'; +import normalmap_pars_fragment from './ShaderChunk/normalmap_pars_fragment.glsl.js'; +import clearcoat_normal_fragment_begin from './ShaderChunk/clearcoat_normal_fragment_begin.glsl.js'; +import clearcoat_normal_fragment_maps from './ShaderChunk/clearcoat_normal_fragment_maps.glsl.js'; +import clearcoat_pars_fragment from './ShaderChunk/clearcoat_pars_fragment.glsl.js'; +import iridescence_pars_fragment from './ShaderChunk/iridescence_pars_fragment.glsl.js'; +import opaque_fragment from './ShaderChunk/opaque_fragment.glsl.js'; +import packing from './ShaderChunk/packing.glsl.js'; +import premultiplied_alpha_fragment from './ShaderChunk/premultiplied_alpha_fragment.glsl.js'; +import project_vertex from './ShaderChunk/project_vertex.glsl.js'; +import dithering_fragment from './ShaderChunk/dithering_fragment.glsl.js'; +import dithering_pars_fragment from './ShaderChunk/dithering_pars_fragment.glsl.js'; +import roughnessmap_fragment from './ShaderChunk/roughnessmap_fragment.glsl.js'; +import roughnessmap_pars_fragment from './ShaderChunk/roughnessmap_pars_fragment.glsl.js'; +import shadowmap_pars_fragment from './ShaderChunk/shadowmap_pars_fragment.glsl.js'; +import shadowmap_pars_vertex from './ShaderChunk/shadowmap_pars_vertex.glsl.js'; +import shadowmap_vertex from './ShaderChunk/shadowmap_vertex.glsl.js'; +import shadowmask_pars_fragment from './ShaderChunk/shadowmask_pars_fragment.glsl.js'; +import skinbase_vertex from './ShaderChunk/skinbase_vertex.glsl.js'; +import skinning_pars_vertex from './ShaderChunk/skinning_pars_vertex.glsl.js'; +import skinning_vertex from './ShaderChunk/skinning_vertex.glsl.js'; +import skinnormal_vertex from './ShaderChunk/skinnormal_vertex.glsl.js'; +import specularmap_fragment from './ShaderChunk/specularmap_fragment.glsl.js'; +import specularmap_pars_fragment from './ShaderChunk/specularmap_pars_fragment.glsl.js'; +import tonemapping_fragment from './ShaderChunk/tonemapping_fragment.glsl.js'; +import tonemapping_pars_fragment from './ShaderChunk/tonemapping_pars_fragment.glsl.js'; +import transmission_fragment from './ShaderChunk/transmission_fragment.glsl.js'; +import transmission_pars_fragment from './ShaderChunk/transmission_pars_fragment.glsl.js'; +import uv_pars_fragment from './ShaderChunk/uv_pars_fragment.glsl.js'; +import uv_pars_vertex from './ShaderChunk/uv_pars_vertex.glsl.js'; +import uv_vertex from './ShaderChunk/uv_vertex.glsl.js'; +import worldpos_vertex from './ShaderChunk/worldpos_vertex.glsl.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts new file mode 100644 index 000000000..2fbc8585e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ALPHAHASH\n\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..22f68c64c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ALPHAHASH\n\n\t/**\n\t * See: https://casual-effects.com/research/Wyman2017Hashed/index.html\n\t */\n\n\tconst float ALPHA_HASH_SCALE = 0.05; // Derived from trials only, and may be changed.\n\n\tfloat hash2D( vec2 value ) {\n\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\n\t}\n\n\tfloat hash3D( vec3 value ) {\n\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\n\t}\n\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\n\t\t// Find the discretized derivatives of our coordinates\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\n\t\t// Find two nearest log-discretized noise scales\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\n\t\t// Compute alpha thresholds at our two noise scales\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\n\t\t// Factor to interpolate lerp with\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\n\t\t// Interpolate alpha threshold from noise at two scales\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\n\t\t// Pass into CDF to compute uniformly distrib threshold\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\n\t\t// Find our final, uniformly distributed alpha threshold (\u03B1\u03C4)\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\n\t\t// Avoids \u03B1\u03C4 == 0. Could also do \u03B1\u03C4 =1-\u03B1\u03C4\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts new file mode 100644 index 000000000..307a3304f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..adb0fb573 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts new file mode 100644 index 000000000..92b21922a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ALPHATEST\n\n\t#ifdef ALPHA_TO_COVERAGE\n\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\n\t#else\n\n\tif ( diffuseColor.a < alphaTest ) discard;\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..af0e29861 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts new file mode 100644 index 000000000..13933984f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..3d9728bad --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..745b7477f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\n\t}\n\n\tfloat getIndirectIndex( const in int i ) {\n\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\n\t}\n\n#endif\n\n#ifdef USE_BATCHING_COLOR\n\n\tuniform sampler2D batchingColorTexture;\n\tvec4 getBatchingColor( const in float i ) {\n\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts new file mode 100644 index 000000000..b472ee778 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts new file mode 100644 index 000000000..06db803d3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvec3 transformed = vec3( position );\n\n#ifdef USE_ALPHAHASH\n\n\tvPosition = vec3( position );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts new file mode 100644 index 000000000..3da7db7fa --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvec3 objectNormal = vec3( normal );\n\n#ifdef USE_TANGENT\n\n\tvec3 objectTangent = vec3( tangent.xyz );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts new file mode 100644 index 000000000..2ad3ea62c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..f19431cdb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n\t\t// normalize is done to ensure that the bump map looks the same regardless of the texture's scale\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm; // normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts new file mode 100644 index 000000000..956542f38 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_CLEARCOAT\n\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts new file mode 100644 index 000000000..f16ddc371 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..2ca80fed2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts new file mode 100644 index 000000000..aaa2b23f9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#ifdef ALPHA_TO_COVERAGE\n\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\t\tfloat unionClipOpacity = 1.0;\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\n\t\t#endif\n\n\t\tdiffuseColor.a *= clipOpacity;\n\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\n\t#else\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\t\tbool clipped = true;\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\tif ( clipped ) discard;\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..ae5f26dfe --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..d5b3da410 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts new file mode 100644 index 000000000..20c123ce6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts new file mode 100644 index 000000000..8feede5ff --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\n\tdiffuseColor *= vColor;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..34020cf10 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..90280cde7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\n\tvarying vec4 vColor;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts new file mode 100644 index 000000000..18cabec6a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\n\tvColor = vec4( 1.0 );\n\n#endif\n\n#ifdef USE_COLOR_ALPHA\n\n\tvColor *= color;\n\n#elif defined( USE_COLOR )\n\n\tvColor.rgb *= color;\n\n#endif\n\n#ifdef USE_INSTANCING_COLOR\n\n\tvColor.rgb *= instanceColor.rgb;\n\n#endif\n\n#ifdef USE_BATCHING_COLOR\n\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts new file mode 100644 index 000000000..9046950c1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..0421d40c8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\n\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\n\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\n\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts new file mode 100644 index 000000000..43db5ac04 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n\treturn fract( sin( sn ) * c );\n\n}\n\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\n#ifdef USE_ALPHAHASH\n\n\tvarying vec3 vPosition;\n\n#endif\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\n#define inverseTransformDirection transformDirectionByInverseViewMatrix // @deprecated r185\n\nvec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {\n\n\t// upper-left 3x3 of view matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );\n\n}\n\nvec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {\n\n\t// upper-left 3x3 of view matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n\treturn m[ 2 ][ 3 ] == - 1.0;\n\n}\n\nvec2 equirectUv( in vec3 dir ) {\n\n\t// dir is assumed to be unit length\n\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\treturn vec2( u, v );\n\n}\n\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts new file mode 100644 index 000000000..679dc7c37 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\n\t// These shader functions convert between the UV coordinates of a single face of\n\t// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n\t// sampling a textureCube (not generally normalized ).\n\n\tfloat getFace( vec3 direction ) {\n\n\t\tvec3 absDirection = abs( direction );\n\n\t\tfloat face = - 1.0;\n\n\t\tif ( absDirection.x > absDirection.z ) {\n\n\t\t\tif ( absDirection.x > absDirection.y )\n\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t} else {\n\n\t\t\tif ( absDirection.z > absDirection.y )\n\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t}\n\n\t\treturn face;\n\n\t}\n\n\t// RH coordinate system; PMREM face-indexing convention\n\tvec2 getUV( vec3 direction, float face ) {\n\n\t\tvec2 uv;\n\n\t\tif ( face == 0.0 ) {\n\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n\n\t\t} else if ( face == 1.0 ) {\n\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n\n\t\t} else if ( face == 2.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n\n\t\t} else if ( face == 3.0 ) {\n\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n\n\t\t} else if ( face == 4.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n\n\t\t} else {\n\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n\n\t\t}\n\n\t\treturn 0.5 * ( uv + 1.0 );\n\n\t}\n\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\n\t\tfloat face = getFace( direction );\n\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\n\t\tfloat faceSize = exp2( mipInt );\n\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071\n\n\t\tif ( face > 2.0 ) {\n\n\t\t\tuv.y += faceSize;\n\n\t\t\tface -= 3.0;\n\n\t\t}\n\n\t\tuv.x += face * faceSize;\n\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\n\t\t#ifdef texture2DGradEXT\n\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering\n\n\t\t#else\n\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\n\t\t#endif\n\n\t}\n\n\t// These defines must match with PMREMGenerator\n\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\n\tfloat roughnessToMip( float roughness ) {\n\n\t\tfloat mip = 0.0;\n\n\t\tif ( roughness >= cubeUV_r1 ) {\n\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\n\t\t} else {\n\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25\n\t\t}\n\n\t\treturn mip;\n\n\t}\n\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\n\t\tfloat mipF = fract( mip );\n\n\t\tfloat mipInt = floor( mip );\n\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\n\t\tif ( mipF == 0.0 ) {\n\n\t\t\treturn vec4( color0, 1.0 );\n\n\t\t} else {\n\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\n\t\t}\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts new file mode 100644 index 000000000..0ec477406 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvoid main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts new file mode 100644 index 000000000..c8a2405ff --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvoid main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts new file mode 100644 index 000000000..ef2e87dc2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\nvec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = objectTangent;\n\n#endif\n\n#ifdef USE_BATCHING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// non-uniform scaling in the instance matrix is supported\n\t// shear transforms are not supported\n\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\ttransformedTangent = bm * transformedTangent;\n\n\t#endif\n\n#endif\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// non-uniform scaling in the instance matrix is supported\n\t// shear transforms are not supported\n\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\ttransformedTangent = im * transformedTangent;\n\n\t#endif\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..11548436c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts new file mode 100644 index 000000000..00cd8f00c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts new file mode 100644 index 000000000..79105cddc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..a209611c6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift according to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts new file mode 100644 index 000000000..c78635cd5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)\n\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\n\t#endif\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..a3cb247c1 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..b5a4b088e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts new file mode 100644 index 000000000..f91032c79 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..402c73014 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..9ff38842e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..6b2783dda --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ENVMAP\n\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\n\t\t\t// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\n\t\t\treflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\t // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\n\t\t\t#else\n\n\t\t\t\treturn vec3( 0.0 );\n\n\t\t\t#endif\n\n\t\t}\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts new file mode 100644 index 000000000..af6e18f7e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts new file mode 100644 index 000000000..a402de6ab --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..2d1b3c615 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..683bfb933 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_FOG\n\n\tvarying float vFogDepth;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts new file mode 100644 index 000000000..5193d77e2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_FOG\n\n\tvFogDepth = - mvPosition.z;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..64ffea6e5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\n\t#else\n\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\n\t#endif\n\n}\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts new file mode 100644 index 000000000..ee7f019ab --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\n#ifdef USE_IRIDESCENCE\n\n\t// XYZ to linear-sRGB color space\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\n\t// Assume air interface for top\n\t// Note: We don't handle the case fresnel0 == 1\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\n\t}\n\n\t// Conversion FO/IOR\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\n\t}\n\n\t// ior is a value between 1.0 and 3.0. 1.0 is air interface\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\n\t}\n\n\t// Fresnel equations for dielectric/dielectric interfaces.\n\t// Ref: https://belcour.github.io/blog/research/2017/05/01/brdf-thin-film.html\n\t// Evaluation XYZ sensitivity curves in Fourier space\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\n\t}\n\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\n\t\tvec3 I;\n\n\t\t// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\t// Evaluate the cosTheta on the base layer (Snell law)\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\n\t\t// Handle TIR:\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\n\t\t\treturn vec3( 1.0 );\n\n\t\t}\n\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\n\t\t// First interface\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\n\t\t// Second interface\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0\n\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\n\t\t// Phase shift\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\n\t\t// Compound terms\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\n\t\t// Reflectance term for m = 0 (DC term amplitude)\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\n\t\t// Reflectance term for m > 0 (pairs of diracs)\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\n\t\t}\n\n\t\t// Since out of gamut colors might be produced, negative color values are clamped to 0.\n\t\treturn max( I, vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..53cec2b86 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform sampler2D iridescenceMap;\n\n#endif\n\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform sampler2D iridescenceThicknessMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..16bdb81bf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..feb145c93 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_LIGHT_PROBES_GRID\n\n// Single atlas 3D texture that stores all 7 SH sub-volumes stacked along Z.\n// Atlas depth = 7 * ( nz + 2 ) where nz = probesResolution.z.\n// Each sub-volume occupies ( nz + 2 ) slices: 1 padding + nz data + 1 padding.\n// Padding is a copy of the first / last data slice and prevents color bleeding\n// when the hardware linear filter reads across a sub-volume boundary.\nuniform highp sampler3D probesSH;\n\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\n\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n\n\tvec3 res = probesResolution;\n\tvec3 gridRange = probesMax - probesMin;\n\tvec3 resMinusOne = res - 1.0;\n\tvec3 probeSpacing = gridRange / resMinusOne;\n\n\t// Offset sample position along normal by half a probe spacing\n\tvec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n\tvec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n\n\t// Remap to texel centers of the probe grid (XY and Z)\n\tuvw = uvw * resMinusOne / res + 0.5 / res;\n\n\t// Atlas UV mapping along Z:\n\t// paddedSlices = nz + 2 (1 padding texel at each end of every sub-volume)\n\t// atlasDepth = 7 * paddedSlices\n\t// For sub-volume t the first DATA texel sits at atlas slice t*paddedSlices + 1.\n\t// Given probe-grid texel-centre UVZ = ( iz + 0.5 ) / nz the atlas UV is:\n\t// atlasUvZ = ( uvw.z * nz + t * paddedSlices + 1 ) / atlasDepth\n\t//\n\t// uvZBase encodes the nz-scaled Z plus the intra-volume offset (+ 1 for padding),\n\t// so adding t*paddedSlices steps to each successive sub-volume.\n\tfloat nz = res.z;\n\tfloat paddedSlices = nz + 2.0;\n\tfloat atlasDepth = 7.0 * paddedSlices;\n\tfloat uvZBase = uvw.z * nz + 1.0;\n\n\tvec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n\tvec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n\tvec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n\n\t// Unpack 9 vec3 SH L2 coefficients\n\tvec3 c0 = s0.xyz;\n\tvec3 c1 = vec3( s0.w, s1.xy );\n\tvec3 c2 = vec3( s1.zw, s2.x );\n\tvec3 c3 = s2.yzw;\n\tvec3 c4 = s3.xyz;\n\tvec3 c5 = vec3( s3.w, s4.xy );\n\tvec3 c6 = vec3( s4.zw, s5.x );\n\tvec3 c7 = s5.yzw;\n\tvec3 c8 = s6.xyz;\n\n\t// Evaluate L2 irradiance\n\tfloat x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n\n\tvec3 result = c0 * 0.886227;\n\tresult += c1 * 2.0 * 0.511664 * y;\n\tresult += c2 * 2.0 * 0.511664 * z;\n\tresult += c3 * 2.0 * 0.511664 * x;\n\tresult += c4 * 2.0 * 0.429043 * x * y;\n\tresult += c5 * 2.0 * 0.429043 * y * z;\n\tresult += c6 * ( 0.743125 * z * z - 0.247708 );\n\tresult += c7 * 2.0 * 0.429043 * x * z;\n\tresult += c8 * 0.429043 * ( x * x - y * y );\n\n\treturn max( result, vec3( 0.0 ) );\n\n}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts new file mode 100644 index 000000000..2e93774d9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometryClearcoatNormal = clearcoatNormal;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\n\tif ( material.iridescenceThickness == 0.0 ) {\n\n\t\tmaterial.iridescence = 0.0;\n\n\t} else {\n\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\n\t}\n\n\tif ( material.iridescence > 0.0 ) {\n\n\t\tvec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tvec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\n\t\tmaterial.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );\n\n\t\t// Iridescence F0 approximation\n\t\tmaterial.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );\n\t\tmaterial.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );\n\n\t}\n\n#endif\n\n#ifdef STANDARD\n\n\tfloat dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );\n\n\tmaterial.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;\n\n\t#if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )\n\n\t\t// Multi-scattering energy compensation for direct lighting\n\t\t// Based on \"Practical Multiple Scattering Compensation for Microfacet Models\"\n\t\t// https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf\n\n\t\t// Energy of the single-scattering lobe in a white furnace ( F0 = F90 = 1 )\n\t\tfloat EssMs = material.dfg.x + material.dfg.y;\n\n\t\t// Compensate for the energy lost to multiple scattering, tinting the added term by F0 ( equation 16 )\n\t\tmaterial.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );\n\n\t#endif\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\n\t\t// spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSunLight sunLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0\n\tSunLightShadow sunLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {\n\n\t\tsunLight = sunLights[ i ];\n\n\t\tgetSunLightInfo( sunLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )\n\t\tsunLightShadow = sunLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\t#if defined( USE_LIGHT_PROBES )\n\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\n\t#endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#ifdef USE_LIGHT_PROBES_GRID\n\n\t\tvec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n\t\tvec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n\t\tirradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts new file mode 100644 index 000000000..247915d2a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( RE_IndirectDiffuse )\n\n\t#if defined( LAMBERT ) || defined( PHONG )\n\n\t\tirradiance += iblIrradiance;\n\n\t#endif\n\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts new file mode 100644 index 000000000..be37cbe29 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\n\t#else\n\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts new file mode 100644 index 000000000..7d7c7ceeb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nLambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..5ea7d176c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvarying vec3 vViewPosition;\n\nstruct LambertMaterial {\n\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts new file mode 100644 index 000000000..975cf1d75 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n\n#if defined( USE_LIGHT_PROBES )\n\n\tuniform vec3 lightProbe[ 9 ];\n\n#endif\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\treturn irradiance;\n\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\tif ( cutoffDistance > 0.0 ) {\n\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t}\n\n\treturn distanceFalloff;\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_SUN_LIGHTS > 0\n\n\tstruct SunLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform SunLight sunLights[ NUM_SUN_LIGHTS ];\n\n\tvoid getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {\n\n\t\tlight.color = sunLight.color;\n\t\tlight.direction = sunLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n\n#include \n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts new file mode 100644 index 000000000..da03357bf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..be47604ec --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts new file mode 100644 index 000000000..2ccf14523 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\n\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n\n#ifdef IOR\n\n\tmaterial.ior = ior;\n\n\t#ifdef USE_SPECULAR\n\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\n\t\t#endif\n\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\n\t\t#endif\n\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\n\t#else\n\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\n\t#endif\n\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_DISPERSION\n\n\tmaterial.dispersion = dispersion;\n\n#endif\n\n#ifdef USE_RETROREFLECTION\n\n\tmaterial.retroreflectivity = retroreflectivity;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\n\t#ifdef USE_IRIDESCENCEMAP\n\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\n\t#else\n\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\n\t#endif\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheenColor;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\n\t#endif\n\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\n\t#endif\n\n#endif\n\n#ifdef USE_ANISOTROPY\n\n\t#ifdef USE_ANISOTROPYMAP\n\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\n\t#else\n\n\t\tvec2 anisotropyV = anisotropyVector;\n\n\t#endif\n\n\tmaterial.anisotropy = length( anisotropyV );\n\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\n\t// Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy.\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..899c50ca2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\nuniform sampler2D dfgLUT;\n\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\tvec2 dfg;\n\tvec3 multiScatteringCompensation;\n\n\t#ifdef USE_RETROREFLECTION\n\t\tfloat retroreflectivity;\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0Dielectric;\n\t\tvec3 iridescenceF0Metallic;\n\t#endif\n\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\n\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf\n#ifdef USE_ANISOTROPY\n\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\treturn 0.5 / max( gv + gl, EPSILON );\n\n\t}\n\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\n\t}\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\t// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\n\t\tfloat alpha = pow2( roughness ); // UE4's roughness\n\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t\treturn F * ( V * D );\n\n\t}\n\n#endif\n\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\n\tfloat alpha = pow2( roughness ); // UE4's roughness\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\n\t#else\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t#endif\n\n\treturn F * ( V * D );\n\n}\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\n\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\n\t// transform rect\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\n\t// project rect onto sphere\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\n\t// calculate vector form factor\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see reference)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, \"Production Friendly Microfacet Sheen BRDF\"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, \"Crafting a Next-gen Material Pipeline for The Order: 1886\"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n\n// This is a curve-fit approximation to the \"Charlie sheen\" BRDF integrated over the hemisphere from\n// Estevez and Kulla 2017, \"Production Friendly Microfacet Sheen BRDF\".\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\n\tfloat DG = exp( a * dotNV + b );\n\n\treturn saturate( DG );\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Ag\u00FCera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\n\t#else\n\n\t\tvec3 Fr = specularColor;\n\n\t#endif\n\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t\t#ifdef USE_CLEARCOAT\n\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\n\t\t\t// LTC Fresnel Approximation for clearcoat\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\n\tvec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\n\t#ifdef USE_RETROREFLECTION\n\n\t\t// Minimal Retroreflective Microfacet Model:\n\t\t// https://jcgt.org/published/0015/01/04/\n\t\tvec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );\n\t\tvec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );\n\n\t\tspecularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );\n\n\t#endif\n\n\treflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;\n\n\t// Light reflected by the specular interface is not available to the diffuse layer ( glTF fresnel_mix )\n\tvec3 halfDir = normalize( directLight.direction + geometryViewDir );\n\tfloat dotVH = saturate( dot( geometryViewDir, halfDir ) );\n\tvec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );\n\n\t#ifdef USE_RETROREFLECTION\n\n\t\tvec3 retroHalfDir = normalize( directLight.direction + retroViewDir );\n\t\tfloat dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );\n\t\tvec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );\n\n\t\tF = mix( F, retroF, saturate( material.retroreflectivity ) );\n\n\t#endif\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t// Energy reflected by the specular lobe is not available to the diffuse layer\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );\n\n\t#else\n\n\t\tcomputeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );\n\n\t#endif\n\n\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );\n\n\t#ifdef USE_SHEEN\n\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;\n\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\n\t\tdiffuse *= sheenEnergyComp;\n\n\t#endif\n\n\treflectedLight.indirectDiffuse += diffuse;\n\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n\n \t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\t// Compute multiscattering separately for dielectric and metallic, then mix\n\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );\n\n\t#else\n\n\t\tcomputeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );\n\n\t#endif\n\n\t// Mix based on metalness\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\n\t// Diffuse energy conservation uses dielectric path\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\n\t#ifdef USE_SHEEN\n\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\n\t#endif\n\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts new file mode 100644 index 000000000..a113ed7ee --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..20ff9bef9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvarying vec3 vViewPosition;\n\nstruct ToonMaterial {\n\n\tvec3 diffuseColor;\n\n};\n\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts new file mode 100644 index 000000000..20e28af12 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..69a279337 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..ee342c244 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts new file mode 100644 index 000000000..582385491 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts new file mode 100644 index 000000000..c433444b0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_MAP\n\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)\n\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\n\t#endif\n\n\tdiffuseColor *= sampledDiffuseColor;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..1bcb0e9fd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts new file mode 100644 index 000000000..274c1350e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t#if defined( USE_POINTS_UV )\n\n\t\tvec2 uv = vUv;\n\n\t#else\n\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, uv );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..2cf3023a2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_POINTS_UV )\n\n\tvarying vec2 vUv;\n\n#else\n\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t\tuniform mat3 uvTransform;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts new file mode 100644 index 000000000..a1169d5f9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..1f17ea17d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts new file mode 100644 index 000000000..2bbdcb4bb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_MORPHCOLORS )\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tvColor *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t#if defined( USE_COLOR_ALPHA )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\n\t\t#elif defined( USE_COLOR )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\n\t\t#endif\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts new file mode 100644 index 000000000..e90281801 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_INSTANCING_MORPH\n\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\n\t}\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts new file mode 100644 index 000000000..9e1a7c480 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..66bb19332 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_INSTANCING_MORPH\n\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\n\t#endif\n\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts new file mode 100644 index 000000000..e65f0a031 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts new file mode 100644 index 000000000..190f1a744 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal *= faceDirection;\n\n\t#endif\n\n#endif\n\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 nonPerturbedNormal = normal;\n\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts new file mode 100644 index 000000000..69ee51c6d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\n\t#if defined( USE_PACKED_NORMALMAP )\n\n\t\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n\n\t#endif\n\n\tmapN.xy *= normalScale;\n\n\tnormal = normalize( tbn * mapN );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..069c529cd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..069c529cd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts new file mode 100644 index 000000000..7a77e535d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t\t#ifdef FLIP_SIDED\n\n\t\t\tvBitangent = - vBitangent;\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..34eba1c99 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\n\t// Normal Mapping Without Precomputed Tangents\n\t// http://www.thetenthplanet.de/archives/1180\n\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\n\t\tvec3 N = surf_norm; // normalized\n\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\n\t\treturn mat3( T * scale, B * scale, N );\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts new file mode 100644 index 000000000..30b98b9ed --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\n\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts new file mode 100644 index 000000000..3d9dc4d37 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\nconst float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\n\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\n\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\n\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\n\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\t// the 0.9999 tweak is unimportant, very tiny empirical improvement\n\t// return vec3( vuf * Inv255, gf * PackUpscale, bf * 0.9999 );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\n\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\n\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\n\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\n\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\n\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( viewZ + near ) / ( near - far );\n}\n\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\n\t#else\n\n\t\treturn depth * ( near - far ) - near;\n\n\t#endif\n}\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\n\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\n\t#else\n\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\n\t#endif\n}\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts new file mode 100644 index 000000000..72a909a98 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef PREMULTIPLIED_ALPHA\n\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts new file mode 100644 index 000000000..69daad77e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_BATCHING\n\n\tmvPosition = batchingMatrix * mvPosition;\n\n#endif\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts new file mode 100644 index 000000000..51df63905 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..41e9d78a5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..c2f2b1881 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#if NUM_SPOT_LIGHT_MAPS > 0\n\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n\n\t\t#else\n\n\t\t\tuniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tuniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * 4 ];\n\t\tuniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * 4 ];\n\t\tvarying vec4 vSunShadowWorldPosition;\n\t\tvarying vec3 vSunShadowWorldNormal;\n\n\t\tstruct SunLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\t#else\n\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\t#else\n\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t// Interleaved Gradient Noise for randomizing sampling patterns\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t}\n\n\t\t// Vogel disk sampling for uniform circular distribution\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\n\t\t}\n\n\t#endif\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\t\tif ( frustumTest ) {\n\n\t\t\t\t// Hardware PCF with LinearFilter gives us 4-tap filtering per sample\n\t\t\t\t// 5 samples using Vogel disk + IGN = effectively 20 filtered taps with better distribution\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\n\t\t\t\t// Use IGN to rotate sampling pattern per pixel\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\n\t\t\t}\n\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t\t}\n\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tshadowCoord.z -= shadowBias;\n\n\t\t\t#else\n\n\t\t\t\tshadowCoord.z += shadowBias;\n\n\t\t\t#endif\n\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\t\tif ( frustumTest ) {\n\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\n\t\t\t\t#else\n\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\t// Early return if fully lit\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\n\t\t\t\t\tshadow = 1.0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Variance must be non-zero to avoid division by zero\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\n\t\t\t\t\t// Distance from mean\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\n\t\t\t\t\t// Chebyshev's inequality for upper bound on probability\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\n\t\t\t\t\t// Reduce light bleeding by remapping [amount, 1] to [0, 1]\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t\t}\n\n\t#else // SHADOWMAP_TYPE_BASIC\n\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tshadowCoord.z -= shadowBias;\n\n\t\t\t#else\n\n\t\t\t\tshadowCoord.z += shadowBias;\n\n\t\t\t#endif\n\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\t\tif ( frustumTest ) {\n\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\n\t\t\t\t#else\n\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\n\t\t\t\t#endif\n\n\t\t\t}\n\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t\t}\n\n\t#endif\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\tfloat getSunShadow(\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\t\tsampler2DShadow shadowMap,\n\t\t\t#else\n\t\t\t\tsampler2D shadowMap,\n\t\t\t#endif\n\t\t\tSunLightShadow sunLightShadow,\n\t\t\tint shadowIndex\n\t\t) {\n\n\t\t\tvec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );\n\t\t\tfloat viewDepth = vSunShadowWorldPosition.w;\n\t\t\tint cascadeOffset = shadowIndex * 4;\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\t// walk the cascades back to front so each fade band can blend with the shadow behind it\n\n\t\t\tfor ( int i = 3; i >= 0; i -- ) {\n\n\t\t\t\t// ( begin, end, fade start ) view depths of the cascade\n\n\t\t\t\tvec4 cascade = sunShadowCascade[ cascadeOffset + i ];\n\n\t\t\t\tif ( viewDepth >= cascade.x && viewDepth < cascade.y ) {\n\n\t\t\t\t\tfloat cascadeShadow = getShadow( shadowMap, sunLightShadow.shadowMapSize, sunLightShadow.shadowIntensity, sunLightShadow.shadowBias, sunLightShadow.shadowRadius, sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition );\n\n\t\t\t\t\tshadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn shadow;\n\n\t\t}\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// Direction from light to fragment\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t// For cube shadow maps, depth is stored as distance along each face's view axis, not radial distance\n\t\t// The view-space depth is the maximum component of the direction vector (which face is sampled)\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\n\t\t\t// viewZ to perspective depth\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp -= shadowBias;\n\n\t\t\t#else\n\n\t\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp += shadowBias;\n\n\t\t\t#endif\n\n\t\t\t// Hardware PCF with LinearFilter gives us 4-tap filtering per sample\n\t\t\t// Use Vogel disk + IGN sampling for better quality\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\n\t\t\t// Build a tangent-space coordinate system for applying offsets\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\n\t\t\t// Use IGN to rotate sampling pattern per pixel\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\n\t\t\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\n\t\t\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\n\t\t\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\n\t\t\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\n\t\t\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\n\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\n\t\t}\n\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t}\n\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// For cube shadow maps, depth is stored as distance along each face's view axis, not radial distance\n\t\t// The view-space depth is the maximum component of the direction vector (which face is sampled)\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\n\t\t\t// viewZ to perspective depth\n\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\n\t\t\t// Direction from light to fragment\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tdepth = 1.0 - depth;\n\n\t\t\t#endif\n\n\t\t\tshadow = step( dp, depth );\n\n\t\t}\n\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t}\n\n\t#endif\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..e2403745a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\t// cascade selection and shadow coordinates are computed per fragment\n\n\t\tvarying vec4 vSunShadowWorldPosition;\n\t\tvarying vec3 vSunShadowWorldNormal;\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts new file mode 100644 index 000000000..9a6c7cbb0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n\n#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\n\t#ifdef HAS_NORMAL\n\n\t\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\n\t\tvec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n\n\t#else\n\n\t\tvec3 shadowWorldNormal = vec3( 0.0 ); // fallback, see #21483\n\n\t#endif\n\n\tvec4 shadowWorldPosition;\n\n#endif\n\n#if defined( USE_SHADOWMAP )\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\tvSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );\n\t\tvSunShadowWorldNormal = shadowWorldNormal;\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n\n// spot lights can be evaluated without active shadow mapping (when SpotLight.map is used)\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..2e96d8c70 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\tSunLightShadow sunLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {\n\n\t\tsunLight = sunLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts new file mode 100644 index 000000000..17f2cd5a8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..95a28ff80 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\tuniform highp sampler2D boneTexture;\n\n\tmat4 getBoneMatrix( const in float i ) {\n\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\n\t\treturn mat4( v1, v2, v3, v4 );\n\n\t}\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts new file mode 100644 index 000000000..34b9a3566 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts new file mode 100644 index 000000000..853e7bfd7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts new file mode 100644 index 000000000..cf125b322 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..c2212b978 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts new file mode 100644 index 000000000..a48659853 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..6f9412747 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn saturate( toneMappingExposure * color );\n\n}\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nvec3 CineonToneMapping( vec3 color ) {\n\n\t// filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nvec3 RRTAndODTFit( vec3 v ) {\n\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n\n}\n\n// this implementation of ACES is modified to accommodate a brighter viewing environment.\n// the scale factor of 1/0.6 is subjective. see discussion in #19621.\n\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\n\tcolor *= toneMappingExposure / 0.6;\n\n\tcolor = ACESInputMat * color;\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( color );\n\n\tcolor = ACESOutputMat * color;\n\n\t// Clamp to [0, 1]\n\treturn saturate( color );\n\n}\n\n// Matrices for rec 2020 <> rec 709 color space conversion\n// matrix provided in row-major order so it has been transposed\n// https://www.itu.int/pub/R-REP-BT.2407-2017\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\n\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\n\n// https://iolite-engine.com/blog_posts/minimal_agx_implementation\n// Mean error^2: 3.6705141e-06\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n\n}\n\n// AgX Tone Mapping implementation based on Filament, which in turn is based\n// on Blender's implementation using rec 2020 primaries\n// https://github.com/google/filament/pull/7236\n// Inputs and outputs are encoded as Linear-sRGB.\n\nvec3 AgXToneMapping( vec3 color ) {\n\n\t// AgX constants\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\n\t// explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\n\t// LOG2_MIN = -10.0\n\t// LOG2_MAX = +6.5\n\t// MIDDLE_GRAY = 0.18\n\tconst float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY )\n\tconst float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY )\n\n\tcolor *= toneMappingExposure;\n\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\n\tcolor = AgXInsetMatrix * color;\n\n\t// Log2 encoding\n\tcolor = max( color, 1e-10 ); // avoid 0 or negative numbers for log2\n\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\n\tcolor = clamp( color, 0.0, 1.0 );\n\n\t// Apply sigmoid\n\tcolor = agxDefaultContrastApprox( color );\n\n\t// Apply AgX look\n\t// v = agxLook(v, look);\n\n\tcolor = AgXOutsetMatrix * color;\n\n\t// Linearize\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\n\t// Gamut mapping. Simple clamp for now.\n\tcolor = clamp( color, 0.0, 1.0 );\n\n\treturn color;\n\n}\n\n// https://modelviewer.dev/examples/tone-mapping\n\nvec3 NeutralToneMapping( vec3 color ) {\n\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\n\tcolor *= toneMappingExposure;\n\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\n\tcolor -= offset;\n\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\n\tif ( peak < StartCompression ) return color;\n\n\tfloat d = 1. - StartCompression;\n\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\n\tcolor *= newPeak / peak;\n\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\n\treturn mix( color, vec3( newPeak ), g );\n\n}\n\nvec3 CustomToneMapping( vec3 color ) { return color; }\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts new file mode 100644 index 000000000..5fa885d5f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_TRANSMISSION\n\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\n\t#endif\n\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..a96404940 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#ifdef USE_TRANSMISSION\n\n\t// Transmission code is based on glTF-Sampler-Viewer\n\t// https://github.com/KhronosGroup/glTF-Sample-Viewer\n\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tuniform sampler2D transmissionMap;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tuniform sampler2D thicknessMap;\n\n\t#endif\n\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\n\tvarying vec3 vWorldPosition;\n\n\t// Mipped Bicubic Texture Filtering by N8\n\t// https://www.shadertoy.com/view/Dl2SDW\n\n\tfloat w0( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w1( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\n\t}\n\n\tfloat w2( float a ){\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w3( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\n\t}\n\n\t// g0 and g1 are the two amplitude functions\n\tfloat g0( float a ) {\n\n\t\treturn w0( a ) + w1( a );\n\n\t}\n\n\tfloat g1( float a ) {\n\n\t\treturn w2( a ) + w3( a );\n\n\t}\n\n\t// h0 and h1 are the two offset functions\n\tfloat h0( float a ) {\n\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\n\t}\n\n\tfloat h1( float a ) {\n\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\n\t}\n\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\n\t\tuv = uv * texelSize.zw + 0.5;\n\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\n\t}\n\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\n\t}\n\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\n\t\t// Direction of refracted light.\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\n\t\t// Compute rotation-independent scaling of the model matrix.\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t// The thickness is specified in local space.\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\n\t}\n\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\n\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\n\t}\n\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\n\t}\n\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tif ( isinf( attenuationDistance ) ) {\n\n\t\t\t// Attenuation distance is +\u221E, i.e. the transmitted color is not attenuated at all.\n\t\t\treturn vec3( 1.0 );\n\n\t\t} else {\n\n\t\t\t// Compute light attenuation using Beer's law.\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law\n\t\t\treturn transmittance;\n\n\t\t}\n\n\t}\n\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\n\t\t#ifdef USE_DISPERSION\n\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\n\t\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\n\t\t\t}\n\n\t\t\ttransmittedLight.a /= 3.0;\n\n\t\t#else\n\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\n\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\n\t\t#endif\n\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\n\t\t// Get the specular component.\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\n\t\t// As less light is transmitted, the opacity should be increased. This simple approximation does a decent job\n\t\t// of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color.\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\n\t}\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts new file mode 100644 index 000000000..aa5001c0e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts new file mode 100644 index 000000000..5439faba3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts new file mode 100644 index 000000000..62229e16f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvUv = vec3( uv, 1 ).xy;\n\n#endif\n#ifdef USE_MAP\n\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts new file mode 100644 index 000000000..83ecd5b37 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts @@ -0,0 +1,2 @@ +declare const _default: "\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_BATCHING\n\n\t\tworldPosition = batchingMatrix * worldPosition;\n\n\t#endif\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n"; +export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts new file mode 100644 index 000000000..7aeb3f49e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts @@ -0,0 +1,7 @@ +export namespace ShaderLib { + namespace physical { + let uniforms: Object; + let vertexShader: string; + let fragmentShader: string; + } +} diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts new file mode 100644 index 000000000..28f6e3d08 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n"; +export const fragment: "\nuniform sampler2D t2D;\nuniform float backgroundIntensity;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tvec4 texColor = texture2D( t2D, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures\n\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts new file mode 100644 index 000000000..1e2625bfe --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n"; +export const fragment: "\n\n#ifdef ENVMAP_TYPE_CUBE\n\n\tuniform samplerCube envMap;\n\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\tuniform sampler2D envMap;\n\n#endif\n\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\n\t#else\n\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts new file mode 100644 index 000000000..1db8a9081 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n"; +export const fragment: "\nuniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\nvoid main() {\n\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts new file mode 100644 index 000000000..b3c2e87e5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n"; +export const fragment: "\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\n\t// Higher precision equivalent of gl_FragCoord.z\n\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\n\t#else\n\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\n\t#endif\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\t// TODO Deprecate\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#elif DEPTH_PACKING == 3202\n\n\t\t// TODO Deprecate\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\n\t#elif DEPTH_PACKING == 3203\n\n\t\t// TODO Deprecate\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\n\t#endif\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts new file mode 100644 index 000000000..0c5024b11 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n"; +export const fragment: "\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts new file mode 100644 index 000000000..4e98c6662 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n}\n"; +export const fragment: "\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV = equirectUv( direction );\n\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts new file mode 100644 index 000000000..765f1bb14 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts new file mode 100644 index 000000000..23471acee --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts new file mode 100644 index 000000000..698ee0dd6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#define LAMBERT\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts new file mode 100644 index 000000000..a2e4cbe2e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n"; +export const fragment: "\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts new file mode 100644 index 000000000..1961afdbe --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n"; +export const fragment: "\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\n\t#ifdef OPAQUE\n\n\t\tgl_FragColor.a = 1.0;\n\n\t#endif\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts new file mode 100644 index 000000000..22dc16023 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts new file mode 100644 index 000000000..9cbf95666 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n"; +export const fragment: "\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n\n#ifdef USE_RETROREFLECTION\n\tuniform float retroreflectivity;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts new file mode 100644 index 000000000..bccb5d045 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts new file mode 100644 index 000000000..384b2516f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nuniform float size;\nuniform float scale;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_POINTS_UV\n\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n\n#endif\n\nvoid main() {\n\n\t#ifdef USE_POINTS_UV\n\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts new file mode 100644 index 000000000..49c051900 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\nuniform vec3 color;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts new file mode 100644 index 000000000..921ca31df --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nuniform float rotation;\nuniform vec2 center;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n"; +export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts new file mode 100644 index 000000000..b19167e8f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts @@ -0,0 +1,2 @@ +export const vertex: "\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n"; +export const fragment: "\nuniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n\nvoid main() {\n\n\tconst float samples = float( VSM_SAMPLES );\n\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\n\t\t#ifdef HORIZONTAL_PASS\n\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\n\t\t#else\n\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\n\t\t#endif\n\n\t}\n\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts new file mode 100644 index 000000000..8918d7709 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts @@ -0,0 +1,485 @@ +export namespace UniformsLib { + namespace common { + namespace diffuse { + let value: Color; + } + namespace opacity { + let value_1: number; + export { value_1 as value }; + } + namespace map { + let value_2: null; + export { value_2 as value }; + } + namespace mapTransform { + let value_3: Matrix3; + export { value_3 as value }; + } + namespace alphaMap { + let value_4: null; + export { value_4 as value }; + } + namespace alphaMapTransform { + let value_5: Matrix3; + export { value_5 as value }; + } + namespace alphaTest { + let value_6: number; + export { value_6 as value }; + } + } + namespace specularmap { + namespace specularMap { + let value_7: null; + export { value_7 as value }; + } + namespace specularMapTransform { + let value_8: Matrix3; + export { value_8 as value }; + } + } + namespace envmap { + namespace envMap { + let value_9: null; + export { value_9 as value }; + } + namespace envMapRotation { + let value_10: Matrix3; + export { value_10 as value }; + } + namespace reflectivity { + let value_11: number; + export { value_11 as value }; + } + namespace ior { + let value_12: number; + export { value_12 as value }; + } + namespace refractionRatio { + let value_13: number; + export { value_13 as value }; + } + namespace dfgLUT { + let value_14: null; + export { value_14 as value }; + } + } + namespace aomap { + namespace aoMap { + let value_15: null; + export { value_15 as value }; + } + namespace aoMapIntensity { + let value_16: number; + export { value_16 as value }; + } + namespace aoMapTransform { + let value_17: Matrix3; + export { value_17 as value }; + } + } + namespace lightmap { + namespace lightMap { + let value_18: null; + export { value_18 as value }; + } + namespace lightMapIntensity { + let value_19: number; + export { value_19 as value }; + } + namespace lightMapTransform { + let value_20: Matrix3; + export { value_20 as value }; + } + } + namespace bumpmap { + namespace bumpMap { + let value_21: null; + export { value_21 as value }; + } + namespace bumpMapTransform { + let value_22: Matrix3; + export { value_22 as value }; + } + namespace bumpScale { + let value_23: number; + export { value_23 as value }; + } + } + namespace normalmap { + namespace normalMap { + let value_24: null; + export { value_24 as value }; + } + namespace normalMapTransform { + let value_25: Matrix3; + export { value_25 as value }; + } + namespace normalScale { + let value_26: Vector2; + export { value_26 as value }; + } + } + namespace displacementmap { + namespace displacementMap { + let value_27: null; + export { value_27 as value }; + } + namespace displacementMapTransform { + let value_28: Matrix3; + export { value_28 as value }; + } + namespace displacementScale { + let value_29: number; + export { value_29 as value }; + } + namespace displacementBias { + let value_30: number; + export { value_30 as value }; + } + } + namespace emissivemap { + namespace emissiveMap { + let value_31: null; + export { value_31 as value }; + } + namespace emissiveMapTransform { + let value_32: Matrix3; + export { value_32 as value }; + } + } + namespace metalnessmap { + namespace metalnessMap { + let value_33: null; + export { value_33 as value }; + } + namespace metalnessMapTransform { + let value_34: Matrix3; + export { value_34 as value }; + } + } + namespace roughnessmap { + namespace roughnessMap { + let value_35: null; + export { value_35 as value }; + } + namespace roughnessMapTransform { + let value_36: Matrix3; + export { value_36 as value }; + } + } + namespace gradientmap { + namespace gradientMap { + let value_37: null; + export { value_37 as value }; + } + } + namespace fog { + namespace fogDensity { + let value_38: number; + export { value_38 as value }; + } + namespace fogNear { + let value_39: number; + export { value_39 as value }; + } + namespace fogFar { + let value_40: number; + export { value_40 as value }; + } + namespace fogColor { + let value_41: Color; + export { value_41 as value }; + } + } + namespace lights { + namespace ambientLightColor { + let value_42: never[]; + export { value_42 as value }; + } + namespace lightProbe { + let value_43: never[]; + export { value_43 as value }; + } + namespace sunLights { + let value_44: never[]; + export { value_44 as value }; + export namespace properties { + let direction: {}; + let color: {}; + } + } + namespace sunLightShadows { + let value_45: never[]; + export { value_45 as value }; + export namespace properties_1 { + let shadowIntensity: number; + let shadowBias: {}; + let shadowNormalBias: {}; + let shadowRadius: {}; + let shadowMapSize: {}; + } + export { properties_1 as properties }; + } + namespace sunShadowMatrix { + let value_46: never[]; + export { value_46 as value }; + } + namespace sunShadowCascade { + let value_47: never[]; + export { value_47 as value }; + } + namespace directionalLights { + let value_48: never[]; + export { value_48 as value }; + export namespace properties_2 { + let direction_1: {}; + export { direction_1 as direction }; + let color_1: {}; + export { color_1 as color }; + } + export { properties_2 as properties }; + } + namespace directionalLightShadows { + let value_49: never[]; + export { value_49 as value }; + export namespace properties_3 { + let shadowIntensity_1: number; + export { shadowIntensity_1 as shadowIntensity }; + let shadowBias_1: {}; + export { shadowBias_1 as shadowBias }; + let shadowNormalBias_1: {}; + export { shadowNormalBias_1 as shadowNormalBias }; + let shadowRadius_1: {}; + export { shadowRadius_1 as shadowRadius }; + let shadowMapSize_1: {}; + export { shadowMapSize_1 as shadowMapSize }; + } + export { properties_3 as properties }; + } + namespace directionalShadowMatrix { + let value_50: never[]; + export { value_50 as value }; + } + namespace spotLights { + let value_51: never[]; + export { value_51 as value }; + export namespace properties_4 { + let color_2: {}; + export { color_2 as color }; + export let position: {}; + let direction_2: {}; + export { direction_2 as direction }; + export let distance: {}; + export let coneCos: {}; + export let penumbraCos: {}; + export let decay: {}; + } + export { properties_4 as properties }; + } + namespace spotLightShadows { + let value_52: never[]; + export { value_52 as value }; + export namespace properties_5 { + let shadowIntensity_2: number; + export { shadowIntensity_2 as shadowIntensity }; + let shadowBias_2: {}; + export { shadowBias_2 as shadowBias }; + let shadowNormalBias_2: {}; + export { shadowNormalBias_2 as shadowNormalBias }; + let shadowRadius_2: {}; + export { shadowRadius_2 as shadowRadius }; + let shadowMapSize_2: {}; + export { shadowMapSize_2 as shadowMapSize }; + } + export { properties_5 as properties }; + } + namespace spotLightMap { + let value_53: never[]; + export { value_53 as value }; + } + namespace spotLightMatrix { + let value_54: never[]; + export { value_54 as value }; + } + namespace pointLights { + let value_55: never[]; + export { value_55 as value }; + export namespace properties_6 { + let color_3: {}; + export { color_3 as color }; + let position_1: {}; + export { position_1 as position }; + let decay_1: {}; + export { decay_1 as decay }; + let distance_1: {}; + export { distance_1 as distance }; + } + export { properties_6 as properties }; + } + namespace pointLightShadows { + let value_56: never[]; + export { value_56 as value }; + export namespace properties_7 { + let shadowIntensity_3: number; + export { shadowIntensity_3 as shadowIntensity }; + let shadowBias_3: {}; + export { shadowBias_3 as shadowBias }; + let shadowNormalBias_3: {}; + export { shadowNormalBias_3 as shadowNormalBias }; + let shadowRadius_3: {}; + export { shadowRadius_3 as shadowRadius }; + let shadowMapSize_3: {}; + export { shadowMapSize_3 as shadowMapSize }; + export let shadowCameraNear: {}; + export let shadowCameraFar: {}; + } + export { properties_7 as properties }; + } + namespace pointShadowMatrix { + let value_57: never[]; + export { value_57 as value }; + } + namespace hemisphereLights { + let value_58: never[]; + export { value_58 as value }; + export namespace properties_8 { + let direction_3: {}; + export { direction_3 as direction }; + export let skyColor: {}; + export let groundColor: {}; + } + export { properties_8 as properties }; + } + namespace rectAreaLights { + let value_59: never[]; + export { value_59 as value }; + export namespace properties_9 { + let color_4: {}; + export { color_4 as color }; + let position_2: {}; + export { position_2 as position }; + export let width: {}; + export let height: {}; + } + export { properties_9 as properties }; + } + namespace ltc_1 { + let value_60: null; + export { value_60 as value }; + } + namespace ltc_2 { + let value_61: null; + export { value_61 as value }; + } + namespace probesSH { + let value_62: null; + export { value_62 as value }; + } + namespace probesMin { + let value_63: Vector3; + export { value_63 as value }; + } + namespace probesMax { + let value_64: Vector3; + export { value_64 as value }; + } + namespace probesResolution { + let value_65: Vector3; + export { value_65 as value }; + } + } + namespace points { + export namespace diffuse_1 { + let value_66: Color; + export { value_66 as value }; + } + export { diffuse_1 as diffuse }; + export namespace opacity_1 { + let value_67: number; + export { value_67 as value }; + } + export { opacity_1 as opacity }; + export namespace size { + let value_68: number; + export { value_68 as value }; + } + export namespace scale { + let value_69: number; + export { value_69 as value }; + } + export namespace map_1 { + let value_70: null; + export { value_70 as value }; + } + export { map_1 as map }; + export namespace alphaMap_1 { + let value_71: null; + export { value_71 as value }; + } + export { alphaMap_1 as alphaMap }; + export namespace alphaMapTransform_1 { + let value_72: Matrix3; + export { value_72 as value }; + } + export { alphaMapTransform_1 as alphaMapTransform }; + export namespace alphaTest_1 { + let value_73: number; + export { value_73 as value }; + } + export { alphaTest_1 as alphaTest }; + export namespace uvTransform { + let value_74: Matrix3; + export { value_74 as value }; + } + } + namespace sprite { + export namespace diffuse_2 { + let value_75: Color; + export { value_75 as value }; + } + export { diffuse_2 as diffuse }; + export namespace opacity_2 { + let value_76: number; + export { value_76 as value }; + } + export { opacity_2 as opacity }; + export namespace center { + let value_77: Vector2; + export { value_77 as value }; + } + export namespace rotation { + let value_78: number; + export { value_78 as value }; + } + export namespace map_2 { + let value_79: null; + export { value_79 as value }; + } + export { map_2 as map }; + export namespace mapTransform_1 { + let value_80: Matrix3; + export { value_80 as value }; + } + export { mapTransform_1 as mapTransform }; + export namespace alphaMap_2 { + let value_81: null; + export { value_81 as value }; + } + export { alphaMap_2 as alphaMap }; + export namespace alphaMapTransform_2 { + let value_82: Matrix3; + export { value_82 as value }; + } + export { alphaMapTransform_2 as alphaMapTransform }; + export namespace alphaTest_2 { + let value_83: number; + export { value_83 as value }; + } + export { alphaTest_2 as alphaTest }; + } +} +import { Color } from '../../math/Color.js'; +import { Matrix3 } from '../../math/Matrix3.js'; +import { Vector2 } from '../../math/Vector2.js'; +import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts new file mode 100644 index 000000000..2789a045c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts @@ -0,0 +1,29 @@ +/** + * Provides utility functions for managing uniforms. + * + * @module UniformsUtils + */ +/** + * Clones the given uniform definitions by performing a deep-copy. That means + * if the value of a uniform refers to an object like a Vector3 or Texture, + * the cloned uniform will refer to a new object reference. + * + * @param {Object} src - An object representing uniform definitions. + * @return {Object} The cloned uniforms. + */ +export function cloneUniforms(src: Object): Object; +/** + * Merges the given uniform definitions into a single object. Since the + * method internally uses cloneUniforms(), it performs a deep-copy when + * producing the merged uniform definitions. + * + * @param {Array} uniforms - An array of objects containing uniform definitions. + * @return {Object} The merged uniforms. + */ +export function mergeUniforms(uniforms: any[]): Object; +export function cloneUniformsGroups(src: any): any[]; +export function getUnlitUniformColorSpace(renderer: any): any; +export namespace UniformsUtils { + export { cloneUniforms as clone }; + export { mergeUniforms as merge }; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts new file mode 100644 index 000000000..1e7af83d2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts @@ -0,0 +1,657 @@ +export default WebGLBackend; +/** + * A backend implementation targeting WebGL 2. + * + * @private + * @augments Backend + */ +declare class WebGLBackend extends Backend { + /** + * WebGLBackend options. + * + * @typedef {Object} WebGLBackend~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. + * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. + * @property {WebGL2RenderingContext} [context=undefined] - A WebGL 2 rendering context. + */ + /** + * Constructs a new WebGPU backend. + * + * @param {WebGLBackend~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGLBackend: boolean; + /** + * A reference to a backend module holding shader attribute-related + * utility functions. + * + * @type {?WebGLAttributeUtils} + * @default null + */ + attributeUtils: WebGLAttributeUtils | null; + /** + * A reference to a backend module holding extension-related + * utility functions. + * + * @type {?WebGLExtensions} + * @default null + */ + extensions: WebGLExtensions | null; + /** + * A reference to a backend module holding capability-related + * utility functions. + * + * @type {?WebGLCapabilities} + * @default null + */ + capabilities: WebGLCapabilities | null; + /** + * A reference to a backend module holding texture-related + * utility functions. + * + * @type {?WebGLTextureUtils} + * @default null + */ + textureUtils: WebGLTextureUtils | null; + /** + * A reference to a backend module holding renderer-related + * utility functions. + * + * @type {?WebGLBufferRenderer} + * @default null + */ + bufferRenderer: WebGLBufferRenderer | null; + /** + * A reference to the rendering context. + * + * @type {?WebGL2RenderingContext} + * @default null + */ + gl: WebGL2RenderingContext | null; + /** + * A reference to a backend module holding state-related + * utility functions. + * + * @type {?WebGLState} + * @default null + */ + state: WebGLState | null; + /** + * A reference to a backend module holding common + * utility functions. + * + * @type {?WebGLUtils} + * @default null + */ + utils: WebGLUtils | null; + /** + * Dictionary for caching VAOs. + * + * @type {Object} + */ + vaoCache: { + [x: string]: WebGLVertexArrayObject; + }; + /** + * Dictionary for caching transform feedback objects. + * + * @type {Object} + */ + transformFeedbackCache: { + [x: string]: WebGLTransformFeedback; + }; + /** + * Controls if `gl.RASTERIZER_DISCARD` should be enabled or not. + * Only relevant when using compute shaders. + * + * @type {boolean} + * @default false + */ + discard: boolean; + /** + * A reference to the `EXT_disjoint_timer_query_webgl2` extension. `null` if the + * device does not support the extension. + * + * @type {?EXTDisjointTimerQueryWebGL2} + * @default null + */ + disjoint: EXTDisjointTimerQueryWebGL2 | null; + /** + * A reference to the `KHR_parallel_shader_compile` extension. `null` if the + * device does not support the extension. + * + * @type {?KHRParallelShaderCompile} + * @default null + */ + parallel: KHRParallelShaderCompile | null; + /** + * A reference to the current render context. + * + * @private + * @type {RenderContext} + * @default null + */ + private _currentContext; + /** + * A unique collection of bindings. + * + * @private + * @type {WeakSet>} + */ + private _knownBindings; + /** + * Whether the device supports framebuffers invalidation or not. + * + * @private + * @type {boolean} + */ + private _supportsInvalidateFramebuffer; + /** + * The target framebuffer when rendering with + * the WebXR device API. + * + * @private + * @type {?WebGLFramebuffer} + * @default null + */ + private _xrFramebuffer; + /** + * Initializes the backend so it is ready for usage. + * + * @param {Renderer} renderer - The renderer. + */ + init(renderer: Renderer): void; + _onContextLost: ((event: any) => void) | undefined; + drawBuffersIndexedExt: Object | undefined; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @param {number} offset - The storage buffer attribute. + * @param {number} count - The offset from which to start reading the + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Ensures the backend is XR compatible. + * + * @async + * @return {Promise} A Promise that resolve when the renderer is XR compatible. + */ + makeXRCompatible(): Promise; + /** + * Sets the XR rendering destination. + * + * @param {WebGLFramebuffer} xrFramebuffer - The XR framebuffer. + */ + setXRTarget(xrFramebuffer: WebGLFramebuffer): void; + /** + * Configures the given XR render target with external textures. + * + * This method is only relevant when using the WebXR Layers API. + * + * @param {XRRenderTarget} renderTarget - The XR render target. + * @param {WebGLTexture} colorTexture - A native color texture. + * @param {?WebGLTexture} [depthTexture=null] - A native depth texture. + */ + setXRRenderTargetTextures(renderTarget: XRRenderTarget, colorTexture: WebGLTexture, depthTexture?: WebGLTexture | null): void; + /** + * Inits a time stamp query for the given render context. + * + * @param {string} type - The type of the timestamp query. + * @param {string} uid - A unique identifier for the timestamp query. + */ + initTimestampQuery(type: string, uid: string): void; + /** + * Prepares the timestamp buffer. + * + * @param {string} type - The type of the timestamp query. + * @param {string} uid - A unique identifier for the timestamp query. + */ + prepareTimestampBuffer(type: string, uid: string): void; + /** + * Returns the backend's rendering context. + * + * @return {WebGL2RenderingContext} The rendering context. + */ + getContext(): WebGL2RenderingContext; + /** + * This method is executed at the beginning of a render call and prepares + * the WebGL state for upcoming render calls + * + * @param {RenderContext} renderContext - The render context. + */ + beginRender(renderContext: RenderContext): void; + /** + * This method is executed at the end of a render call and finalizes work + * after draw calls. + * + * @param {RenderContext} renderContext - The render context. + */ + finishRender(renderContext: RenderContext): void; + /** + * This method processes the result of occlusion queries and writes it + * into render context data. + * + * @async + * @param {RenderContext} renderContext - The render context. + */ + resolveOccludedAsync(renderContext: RenderContext): void; + /** + * Returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(renderContext: RenderContext, object: Object3D): boolean; + /** + * Updates the viewport with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateViewport(renderContext: RenderContext): void; + /** + * Updates the scissor with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateScissor(renderContext: RenderContext): void; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Returns the clear color and alpha into a single + * color object. + * + * @return {Color4} The clear color. + */ + getClearColor(): Color4; + /** + * Performs a clear operation. + * + * @param {boolean} color - Whether the color buffer should be cleared or not. + * @param {boolean} depth - Whether the depth buffer should be cleared or not. + * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. + * @param {?Object} [descriptor=null] - The render context of the current set render target. + * @param {boolean} [setFrameBuffer=true] - Controls whether the intermediate framebuffer should be set or not. + * @param {boolean} [resolveRenderTarget=true] - Controls whether an active render target should be resolved + * or not. Only relevant for explicit clears. + */ + clear(color: boolean, depth: boolean, stencil: boolean, descriptor?: Object | null, setFrameBuffer?: boolean, resolveRenderTarget?: boolean): void; + /** + * This method is executed at the beginning of a compute call and + * prepares the state for upcoming compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + beginCompute(computeGroup: Node | Array): void; + /** + * Executes a compute command for the given compute node. + * + * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. + * @param {Node} computeNode - The compute node. + * @param {Array} bindings - The bindings. + * @param {ComputePipeline} pipeline - The compute pipeline. + * @param {?number} [count=null] - The count of compute invocations. If `null`, the count is determined by the compute node. + */ + compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, count?: number | null): void; + /** + * This method is executed at the end of a compute call and + * finalizes work after compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + finishCompute(computeGroup: Node | Array): void; + /** + * Internal to determine if the current render target is a render target array with depth 2D array texture. + * + * @param {RenderContext} renderContext - The render context. + * @return {boolean} Whether the render target is a render target array with depth 2D array texture. + * + * @private + */ + private _isRenderCameraDepthArray; + /** + * Internal draw function. + * + * @private + * @param {Object3D} object - The object to render. + * @param {WebGLBufferRenderer} renderer - The internal renderer. + * @param {number} firstVertex - The first vertex to render. + * @param {number} vertexCount - The vertex count. + * @param {number} instanceCount - The intance count. + * @param {WebGLProgram} programGPU - The raw WebGL shader program. + */ + private _draw; + /** + * Executes a draw command for the given render object. + * + * @param {RenderObject} renderObject - The render object to draw. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + */ + draw(renderObject: RenderObject): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(texture: Texture): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(texture: Texture, options?: Object): void; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + */ + generateMipmaps(texture: Texture): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Returns a node builder for the given render object. + * + * @param {RenderObject} object - The render object. + * @param {Renderer} renderer - The renderer. + * @return {GLSLNodeBuilder} The node builder. + */ + createNodeBuilder(object: RenderObject, renderer: Renderer): GLSLNodeBuilder; + /** + * Creates a shader program from the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + createProgram(program: ProgrammableStage): void; + /** + * Destroys the shader program of the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + destroyProgram(program: ProgrammableStage): void; + /** + * Creates a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(renderObject: RenderObject, promises: Array>): void; + /** + * Formats the source code of error messages. + * + * @private + * @param {string} string - The code. + * @param {number} errorLine - The error line. + * @return {string} The formatted code. + */ + private _handleSource; + /** + * Gets the shader compilation errors from the info log. + * + * @private + * @param {WebGL2RenderingContext} gl - The rendering context. + * @param {WebGLShader} shader - The WebGL shader object. + * @param {string} type - The shader type. + * @return {string} The shader errors. + */ + private _getShaderErrors; + /** + * Logs shader compilation errors. + * + * @private + * @param {WebGLProgram} programGPU - The WebGL program. + * @param {WebGLShader} glFragmentShader - The fragment shader as a native WebGL shader object. + * @param {WebGLShader} glVertexShader - The vertex shader as a native WebGL shader object. + */ + private _logProgramError; + /** + * Completes the shader program setup for the given render object. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {RenderPipeline} pipeline - The render pipeline. + */ + private _completeCompile; + /** + * Creates a compute pipeline for the given compute node. + * + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; + /** + * Completes the compute pipeline setup for the given compute pipeline. + * + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - Array of bind groups. + */ + _completeComputeCompile(computePipeline: ComputePipeline, bindings: Array): void; + /** + * Creates bindings from the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(bindGroup: BindGroup, bindings: Array): void; + /** + * Updates the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + updateBindings(bindGroup: BindGroup): void; + /** + * Updates a buffer binding. + * + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(binding: Buffer): void; + /** + * Creates a uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + createUniformBuffer(uniformBuffer: Buffer): void; + /** + * Destroys the GPU data for the given uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + destroyUniformBuffer(uniformBuffer: Buffer): void; + /** + * Creates the GPU buffer of an indexed shader attribute. + * + * @param {BufferAttribute} attribute - The indexed buffer attribute. + */ + createIndexAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a storage attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createStorageAttribute(attribute: BufferAttribute): void; + /** + * Updates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to update. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * Destroys the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to destroy. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * Checks if the given feature is supported by the backend. + * + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(name: string): boolean; + /** + * Copies data of the given source texture to the given destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; + /** + * Checks if the given compatibility is supported by the backend. + * + * @param {string} name - The compatibility name. + * @return {boolean} Whether the compatibility is supported or not. + */ + hasCompatibility(name: string): boolean; + /** + * Initializes the render target defined in the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + initRenderTarget(renderContext: RenderContext): void; + /** + * Configures the active framebuffer from the given render context. + * + * @private + * @param {RenderContext} descriptor - The render context. + */ + private _setFramebuffer; + /** + * Computes the VAO key for the given index and attributes. + * + * @private + * @param {Array} attributes - An array of buffer attributes. + * @return {string} The VAO key. + */ + private _getVaoKey; + /** + * Creates a VAO from the index and attributes. + * + * @private + * @param {Array} attributes - An array of buffer attributes. + * @return {Object} The VAO data. + */ + private _createVao; + /** + * Creates a transform feedback from the given transform buffers. + * + * @private + * @param {Array} transformBuffers - The transform buffers. + * @return {WebGLTransformFeedback} The transform feedback. + */ + private _getTransformFeedback; + /** + * Setups the given bindings. + * + * @private + * @param {Array} bindings - The bindings. + * @param {WebGLProgram} programGPU - The WebGL program. + */ + private _setupBindings; + /** + * Binds the given uniforms. + * + * @private + * @param {Array} bindings - The bindings. + */ + private _bindUniforms; + /** + * The method ensures multisampled render targets are resolved. + * + * @private + * @param {RenderContext} renderContext - The render context. + */ + private _resolveRenderTarget; + /** + * Returns `true` if the `WEBGL_multisampled_render_to_texture` extension + * should be used when MSAA is enabled. + * + * @private + * @param {RenderTarget} renderTarget - The render target that should be multisampled. + * @return {boolean} Whether to use the `WEBGL_multisampled_render_to_texture` extension for MSAA or not. + */ + private _useMultisampledExtension; +} +import Backend from '../common/Backend.js'; +import WebGLAttributeUtils from './utils/WebGLAttributeUtils.js'; +import WebGLExtensions from './utils/WebGLExtensions.js'; +import WebGLCapabilities from './utils/WebGLCapabilities.js'; +import WebGLTextureUtils from './utils/WebGLTextureUtils.js'; +import { WebGLBufferRenderer } from './WebGLBufferRenderer.js'; +import WebGLState from './utils/WebGLState.js'; +import WebGLUtils from './utils/WebGLUtils.js'; +import GLSLNodeBuilder from './nodes/GLSLNodeBuilder.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts new file mode 100644 index 000000000..c297252cb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts @@ -0,0 +1,13 @@ +export class WebGLBufferRenderer { + constructor(backend: any); + gl: any; + extensions: any; + info: any; + mode: any; + index: number; + type: any; + object: any; + render(start: any, count: any): void; + renderInstances(start: any, count: any, primcount: any): void; + renderMultiDraw(starts: any, counts: any, drawCount: any): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts new file mode 100644 index 000000000..ac6f8fd77 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts @@ -0,0 +1,402 @@ +export default GLSLNodeBuilder; +/** + * A node builder targeting GLSL. + * + * This module generates GLSL shader code from node materials and also + * generates the respective bindings and vertex buffer definitions. These + * data are later used by the renderer to create render and compute pipelines + * for render objects. + * + * @augments NodeBuilder + */ +declare class GLSLNodeBuilder extends NodeBuilder { + /** + * Constructs a new GLSL node builder renderer. + * + * @param {Object3D} object - The 3D object. + * @param {Renderer} renderer - The renderer. + */ + constructor(object: Object3D, renderer: Renderer); + /** + * A dictionary holds for each shader stage ('vertex', 'fragment', 'compute') + * another dictionary which manages UBOs per group ('render','frame','object'). + * + * @type {Object>} + */ + uniformGroups: { + [x: string]: { + [x: string]: NodeUniformsGroup; + }; + }; + /** + * An array that holds objects defining the varying and attribute data in + * context of Transform Feedback. + * + * @type {Array>} + */ + transforms: Array<{ + [x: string]: AttributeNode | string; + }>; + /** + * A dictionary that holds for each shader stage a Map of used extensions. + * + * @type {Object>} + */ + extensions: { + [x: string]: Map; + }; + /** + * A dictionary that holds for each shader stage an Array of used builtins. + * + * @type {Object>} + */ + builtins: { + [x: string]: string[]; + }; + /** + * Checks if the given texture requires a manual conversion to the working color space. + * + * @param {Texture} texture - The texture to check. + * @return {boolean} Whether the given texture requires a conversion to working color space or not. + */ + needsToWorkingColorSpace(texture: Texture): boolean; + /** + * Includes the given method name into the current + * function node. + * + * @private + * @param {string} name - The method name to include. + * @return {CodeNode} The respective code node. + */ + private _include; + /** + * Returns the bitcast method name for a given input and outputType. + * + * @param {string} type - The output type to bitcast to. + * @param {string} inputType - The input type of the. + * @return {string} The resolved GLSL bitcast invocation. + */ + getBitcastMethod(type: string, inputType: string): string; + /** + * Returns the float packing method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolved GLSL float packing method name. + */ + getFloatPackingMethod(encoding: string, layout?: string): string; + /** + * Returns the float unpacking method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolved GLSL float unpacking method name. + */ + getFloatUnpackingMethod(encoding: string, layout?: string): string; + /** + * Returns the native snippet for a ternary operation. + * + * @param {string} condSnippet - The condition determining which expression gets resolved. + * @param {string} ifSnippet - The expression to resolve to if the condition is true. + * @param {string} elseSnippet - The expression to resolve to if the condition is false. + * @return {string} The resolved method name. + */ + getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; + /** + * Builds the given shader node. + * + * @param {ShaderNodeInternal} shaderNode - The shader node. + * @return {string} The GLSL function code. + */ + buildFunctionCode(shaderNode: ShaderNodeInternal): string; + /** + * Setups the Pixel Buffer Object (PBO) for the given storage + * buffer node. + * + * @param {StorageBufferNode} storageBufferNode - The storage buffer node. + */ + setupPBO(storageBufferNode: StorageBufferNode): void; + /** + * Returns a GLSL snippet that represents the property name of the given node. + * + * @param {Node} node - The node. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The property name. + */ + getPropertyName(node: Node, shaderStage?: string): string; + /** + * Returns whether the given name is a reserved keyword of GLSL. + * + * @param {string} name - The name to test. + * @return {boolean} Whether the name is a reserved keyword or not. + */ + isReservedKeyword(name: string): boolean; + /** + * Setups the Pixel Buffer Object (PBO) for the given storage + * buffer node. + * + * @param {StorageArrayElementNode} storageArrayElementNode - The storage array element node. + * @return {string} The property name. + */ + generatePBO(storageArrayElementNode: StorageArrayElementNode): string; + /** + * Generates the GLSL snippet that reads a single texel from a texture without sampling or filtering. + * + * @param {?Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {?string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureLoad(texture: Texture | null, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet for sampling/loading the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet that resolves the dimensions of the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} levelSnippet - A GLSL snippet that represents the mip level. + * @return {string} The GLSL snippet. + */ + generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; + /** + * Generates the GLSL snippet when sampling textures with explicit mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet when sampling textures with a bias to the mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} biasSnippet - A GLSL snippet that represents the bias to apply to the mip level before sampling. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet for sampling/loading the given texture using explicit gradients. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {Array} gradSnippet - An array holding both gradient GLSL snippets. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The GLSL snippet. + */ + generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the GLSL snippet for sampling a depth texture and comparing the sampled depth values + * against a reference value. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A GLSL snippet that represents the reference value. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The GLSL snippet. + */ + generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the GLSL snippet for gathering four texels from the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} gatherSnippet - A GLSL snippet that represents the index of the channel to read. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. + * @return {string} The GLSL snippet. + */ + generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; + /** + * Generates the GLSL snippet for performing a depth comparison on four texels in the given depth texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A GLSL snippet that represents the reference value. + * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. + * @return {string} The GLSL snippet. + */ + generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; + /** + * Returns the uniforms of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the uniforms. + */ + getUniforms(shaderStage: string): string; + /** + * Returns the shader attributes of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the shader attributes. + */ + getAttributes(shaderStage: string): string; + /** + * Returns the members of the given struct type node as a GLSL string. + * + * @param {StructTypeNode} struct - The struct type node. + * @return {string} The GLSL snippet that defines the struct members. + */ + getStructMembers(struct: StructTypeNode): string; + /** + * Returns the structs of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the structs. + */ + getStructs(shaderStage: string): string; + /** + * Returns the varyings of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the varyings. + */ + getVaryings(shaderStage: string): string; + /** + * Returns a builtin representing the index of an invocation within its workgroup. + * + * @return {string} The invocation local index. + */ + getInvocationLocalIndex(): string; + /** + * Returns a builtin representing the size of a subgroup within the current shader. + */ + getSubgroupSize(): void; + /** + * Returns a builtin representing the index of an invocation within its subgroup. + */ + getInvocationSubgroupIndex(): void; + /** + * Returns a builtin representing the index of the current invocation's subgroup within its workgroup. + */ + getSubgroupIndex(): void; + /** + * Returns the frag depth builtin. + * + * @return {string} The frag depth builtin. + */ + getFragDepth(): string; + /** + * Enables the given extension. + * + * @param {string} name - The extension name. + * @param {string} behavior - The extension behavior. + * @param {string} [shaderStage=this.shaderStage] - The shader stage. + */ + enableExtension(name: string, behavior: string, shaderStage?: string): void; + /** + * Returns the enabled extensions of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the enabled extensions. + */ + getExtensions(shaderStage: string): string; + /** + * Returns the clip distances builtin. + * + * @return {string} The clip distances builtin. + */ + getClipDistance(): string; + /** + * Whether the requested feature is available or not. + * + * @param {string} name - The requested feature. + * @return {boolean} Whether the requested feature is supported or not. + */ + isAvailable(name: string): boolean; + /** + * Enables hardware clipping. + * + * @param {string} planeCount - The clipping plane count. + */ + enableHardwareClipping(planeCount: string): void; + /** + * Enables multiview. + */ + enableMultiview(): void; + /** + * Registers a transform in context of Transform Feedback. + * + * @param {string} varyingName - The varying name. + * @param {AttributeNode} attributeNode - The attribute node. + */ + registerTransform(varyingName: string, attributeNode: AttributeNode): void; + /** + * Returns the transforms of the given shader stage as a GLSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The GLSL snippet that defines the transforms. + */ + getTransforms(): string; + /** + * Returns a GLSL struct based on the given name and variables. + * + * @private + * @param {string} name - The struct name. + * @param {string} vars - The struct variables. + * @return {string} The GLSL snippet representing a struct. + */ + private _getGLSLUniformStruct; + /** + * Returns a GLSL vertex shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getGLSLVertexCode; + /** + * Returns a GLSL fragment shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getGLSLFragmentCode; + /** + * This method is one of the more important ones since it's responsible + * for generating a matching binding instance for the given uniform node. + * + * These bindings are later used in the renderer to create bind groups + * and layouts. + * + * @param {UniformNode} node - The uniform node. + * @param {string} type - The node data type. + * @param {string} shaderStage - The shader stage. + * @param {?string} [name=null] - An optional uniform name. + * @return {NodeUniform} The node uniform object. + */ + getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; +} +import { NodeBuilder } from '../../../nodes/Nodes.js'; +import NodeUniformsGroup from '../../common/nodes/NodeUniformsGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts new file mode 100644 index 000000000..80d81e2f3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts @@ -0,0 +1,64 @@ +export default WebGLAttributeUtils; +/** + * A WebGL 2 backend utility module for managing shader attributes. + * + * @private + */ +declare class WebGLAttributeUtils { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * Creates the GPU buffer for the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. + */ + createAttribute(attribute: BufferAttribute, bufferType: GLenum): void; + /** + * Updates the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * Destroys the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @param {number} offset - The storage buffer attribute. + * @param {number} count - The offset from which to start reading the + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Creates a WebGL buffer with the given data. + * + * @private + * @param {WebGL2RenderingContext} gl - The rendering context. + * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. + * @param {TypedArray} array - The array of the buffer attribute. + * @param {GLenum} usage - The usage. + * @return {WebGLBuffer} The WebGL buffer. + */ + private _createBuffer; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts new file mode 100644 index 000000000..095e4ee8c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts @@ -0,0 +1,48 @@ +export default WebGLCapabilities; +/** + * A WebGL 2 backend utility module for managing the device's capabilities. + * + * @private + */ +declare class WebGLCapabilities { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * This value holds the cached max anisotropy value. + * + * @type {?number} + * @default null + */ + maxAnisotropy: number | null; + /** + * This value holds the cached max uniform block size value. + * + * @type {?number} + * @default null + */ + maxUniformBlockSize: number | null; + /** + * Returns the maximum anisotropy texture filtering value. This value + * depends on the device and is reported by the `EXT_texture_filter_anisotropic` + * WebGL extension. + * + * @return {number} The maximum anisotropy texture filtering value. + */ + getMaxAnisotropy(): number; + /** + * Returns the maximum number of bytes available for uniform buffers. + * + * @return {number} The maximum number of bytes available for uniform buffers. + */ + getUniformBufferLimit(): number; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts new file mode 100644 index 000000000..d8093bad2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts @@ -0,0 +1,11 @@ +export namespace GLFeatureName { + let WEBGL_multi_draw: string; + let WEBGL_compressed_texture_astc: string; + let WEBGL_compressed_texture_etc: string; + let WEBGL_compressed_texture_etc1: string; + let WEBGL_compressed_texture_pvrtc: string; + let WEBGL_compressed_texture_s3tc: string; + let EXT_texture_compression_bptc: string; + let EXT_disjoint_timer_query_webgl2: string; + let OVR_multiview2: string; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts new file mode 100644 index 000000000..be5b14a6e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts @@ -0,0 +1,56 @@ +export default WebGLExtensions; +/** + * A WebGL 2 backend utility module for managing extensions. + * + * @private + */ +declare class WebGLExtensions { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + /** + * A list with all the supported WebGL extensions. + * + * @type {Array} + */ + availableExtensions: Array; + /** + * A dictionary with requested WebGL extensions. + * The key is the name of the extension, the value + * the requested extension object. + * + * @type {Object} + */ + extensions: { + [x: string]: Object; + }; + /** + * Returns the extension object for the given extension name. + * + * @param {string} name - The extension name. + * @return {Object} The extension object. + */ + get(name: string): Object; + /** + * Returns `true` if the requested extension is available. + * + * @param {string} name - The extension name. + * @return {boolean} Whether the given extension is available or not. + */ + has(name: string): boolean; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts new file mode 100644 index 000000000..e10da62e2 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts @@ -0,0 +1,382 @@ +export default WebGLState; +/** + * A WebGL 2 backend utility module for managing the WebGL state. + * + * The major goal of this module is to reduce the number of state changes + * by caching the WEbGL state with a series of variables. In this way, the + * renderer only executes state change commands when necessary which + * improves the overall performance. + * + * @private + */ +declare class WebGLState { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + enabled: {}; + parameters: {}; + currentFlipSided: any; + currentCullFace: any; + currentProgram: any; + currentBlendingEnabled: boolean; + currentBlending: any; + currentBlendEquation: any; + currentBlendEquationAlpha: number | null; + currentBlendSrc: any; + currentBlendDst: number | null; + currentBlendSrcAlpha: number | null; + currentBlendDstAlpha: number | null; + currentBlendColor: Color; + currentBlendAlpha: number; + currentPremultipledAlpha: boolean | null; + currentPolygonOffsetFactor: any; + currentPolygonOffsetUnits: number | null; + currentColorMask: any; + currentDepthReversed: boolean; + currentDepthFunc: any; + currentDepthMask: any; + currentStencilFunc: any; + currentStencilRef: number | null; + currentStencilFuncMask: number | null; + currentStencilFail: any; + currentStencilZFail: number | null; + currentStencilZPass: number | null; + currentStencilMask: any; + currentLineWidth: any; + currentClippingPlanes: number; + currentVAO: any; + currentIndex: WebGLBuffer | null; + currentBoundFramebuffers: {}; + currentDrawbuffers: WeakMap; + maxTextures: any; + currentTextureSlot: any; + currentBoundTextures: {}; + currentBoundBufferBases: {}; + /** + * Inits the state of the utility. + * + * @private + */ + private _init; + currentScissor: Vector4 | undefined; + currentViewport: Vector4 | undefined; + _tempVec4: Vector4 | undefined; + /** + * Enables the given WebGL capability. + * + * This method caches the capability state so + * `gl.enable()` is only called when necessary. + * + * @param {GLenum} id - The capability to enable. + */ + enable(id: GLenum): void; + /** + * Disables the given WebGL capability. + * + * This method caches the capability state so + * `gl.disable()` is only called when necessary. + * + * @param {GLenum} id - The capability to enable. + */ + disable(id: GLenum): void; + /** + * Specifies whether polygons are front- or back-facing + * by setting the winding orientation. + * + * This method caches the state so `gl.frontFace()` is only + * called when necessary. + * + * @param {boolean} flipSided - Whether triangles flipped their sides or not. + */ + setFlipSided(flipSided: boolean): void; + /** + * Specifies whether or not front- and/or back-facing + * polygons can be culled. + * + * This method caches the state so `gl.cullFace()` is only + * called when necessary. + * + * @param {number} cullFace - Defines which polygons are candidates for culling. + */ + setCullFace(cullFace: number): void; + /** + * Specifies the width of line primitives. + * + * This method caches the state so `gl.lineWidth()` is only + * called when necessary. + * + * @param {number} width - The line width. + */ + setLineWidth(width: number): void; + setMRTBlending(textures: any, mrt: any, material: any): void; + /** + * Applies blending configuration for a specific draw buffer index. + * + * @private + * @param {number} index - The draw buffer index. + * @param {Object} blending - The blending configuration (material or BlendMode). + */ + private _setMRTBlendingIndex; + /** + * Defines the blending. + * + * This method caches the state so `gl.blendEquation()`, `gl.blendEquationSeparate()`, + * `gl.blendFunc()`, `gl.blendFuncSeparate()` and `gl.blendColor()` are only called when necessary. + * + * @param {number} blending - The blending type. + * @param {number} blendEquation - The blending equation. + * @param {number} blendSrc - Only relevant for custom blending. The RGB source blending factor. + * @param {number} blendDst - Only relevant for custom blending. The RGB destination blending factor. + * @param {number} blendEquationAlpha - Only relevant for custom blending. The blending equation for alpha. + * @param {number} blendSrcAlpha - Only relevant for custom blending. The alpha source blending factor. + * @param {number} blendDstAlpha - Only relevant for custom blending. The alpha destination blending factor. + * @param {Color} blendColor - Only relevant for custom blending. The RGB values of the constant blend color. + * @param {number} blendAlpha - Only relevant for custom blending. The alpha value of the constant blend color. + * @param {boolean} premultipliedAlpha - Whether premultiplied alpha is enabled or not. + */ + setBlending(blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number, blendColor: Color, blendAlpha: number, premultipliedAlpha: boolean): void; + /** + * Specifies whether colors can be written when rendering + * into a framebuffer or not. + * + * This method caches the state so `gl.colorMask()` is only + * called when necessary. + * + * @param {boolean} colorMask - The color mask. + */ + setColorMask(colorMask: boolean): void; + /** + * Specifies whether the depth test is enabled or not. + * + * @param {boolean} depthTest - Whether the depth test is enabled or not. + */ + setDepthTest(depthTest: boolean): void; + /** + * Configures the WebGL state to use a reversed depth buffer. + * + * @param {boolean} reversed - Whether the depth buffer is reversed or not. + */ + setReversedDepth(reversed: boolean): void; + /** + * Specifies whether depth values can be written when rendering + * into a framebuffer or not. + * + * This method caches the state so `gl.depthMask()` is only + * called when necessary. + * + * @param {boolean} depthMask - The depth mask. + */ + setDepthMask(depthMask: boolean): void; + /** + * Specifies the depth compare function. + * + * This method caches the state so `gl.depthFunc()` is only + * called when necessary. + * + * @param {number} depthFunc - The depth compare function. + */ + setDepthFunc(depthFunc: number): void; + /** + * Specifies the scissor box. + * + * @param {number} x - The x-coordinate of the lower left corner of the viewport. + * @param {number} y - The y-coordinate of the lower left corner of the viewport. + * @param {number} width - The width of the viewport. + * @param {number} height - The height of the viewport. + * + */ + scissor(x: number, y: number, width: number, height: number): void; + /** + * Specifies the viewport. + * + * @param {number} x - The x-coordinate of the lower left corner of the viewport. + * @param {number} y - The y-coordinate of the lower left corner of the viewport. + * @param {number} width - The width of the viewport. + * @param {number} height - The height of the viewport. + * + */ + viewport(x: number, y: number, width: number, height: number): void; + /** + * Defines the scissor test. + * + * @param {boolean} boolean - Whether the scissor test should be enabled or not. + */ + setScissorTest(boolean: boolean): void; + /** + * Specifies whether the stencil test is enabled or not. + * + * @param {boolean} stencilTest - Whether the stencil test is enabled or not. + */ + setStencilTest(stencilTest: boolean): void; + /** + * Specifies whether stencil values can be written when rendering + * into a framebuffer or not. + * + * This method caches the state so `gl.stencilMask()` is only + * called when necessary. + * + * @param {boolean} stencilMask - The stencil mask. + */ + setStencilMask(stencilMask: boolean): void; + /** + * Specifies whether the stencil test functions. + * + * This method caches the state so `gl.stencilFunc()` is only + * called when necessary. + * + * @param {number} stencilFunc - The stencil compare function. + * @param {number} stencilRef - The reference value for the stencil test. + * @param {number} stencilMask - A bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. + */ + setStencilFunc(stencilFunc: number, stencilRef: number, stencilMask: number): void; + /** + * Specifies whether the stencil test operation. + * + * This method caches the state so `gl.stencilOp()` is only + * called when necessary. + * + * @param {number} stencilFail - The function to use when the stencil test fails. + * @param {number} stencilZFail - The function to use when the stencil test passes, but the depth test fail. + * @param {number} stencilZPass - The function to use when both the stencil test and the depth test pass, + * or when the stencil test passes and there is no depth buffer or depth testing is disabled. + */ + setStencilOp(stencilFail: number, stencilZFail: number, stencilZPass: number): void; + /** + * Configures the WebGL state for the given material. + * + * @param {Material} material - The material to configure the state for. + * @param {number} frontFaceCW - Whether the front faces are counter-clockwise or not. + * @param {number} hardwareClippingPlanes - The number of hardware clipping planes. + */ + setMaterial(material: Material, frontFaceCW: number, hardwareClippingPlanes: number): void; + /** + * Specifies the polygon offset. + * + * This method caches the state so `gl.polygonOffset()` is only + * called when necessary. + * + * @param {boolean} polygonOffset - Whether polygon offset is enabled or not. + * @param {number} factor - The scale factor for the variable depth offset for each polygon. + * @param {number} units - The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. + */ + setPolygonOffset(polygonOffset: boolean, factor: number, units: number): void; + /** + * Defines the usage of the given WebGL program. + * + * This method caches the state so `gl.useProgram()` is only + * called when necessary. + * + * @param {WebGLProgram} program - The WebGL program to use. + * @return {boolean} Whether a program change has been executed or not. + */ + useProgram(program: WebGLProgram): boolean; + /** + * Sets the vertex state by binding the given VAO and element buffer. + * + * @param {WebGLVertexArrayObject} vao - The VAO. + * @param {?WebGLBuffer} indexBuffer - The index buffer. + * @return {boolean} Whether a vertex state has been changed or not. + */ + setVertexState(vao: WebGLVertexArrayObject, indexBuffer?: WebGLBuffer | null): boolean; + /** + * Resets the vertex array state by resetting the VAO and element buffer. + */ + resetVertexState(): void; + /** + * Binds the given framebuffer. + * + * This method caches the state so `gl.bindFramebuffer()` is only + * called when necessary. + * + * @param {number} target - The binding point (target). + * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer to bind. + * @return {boolean} Whether a bind has been executed or not. + */ + bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): boolean; + /** + * Defines draw buffers to which fragment colors are written into. + * Configures the MRT setup of custom framebuffers. + * + * This method caches the state so `gl.drawBuffers()` is only + * called when necessary. + * + * @param {RenderContext} renderContext - The render context. + * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer. + */ + drawBuffers(renderContext: RenderContext, framebuffer: WebGLFramebuffer): void; + /** + * Makes the given texture unit active. + * + * This method caches the state so `gl.activeTexture()` is only + * called when necessary. + * + * @param {number} webglSlot - The texture unit to make active. + */ + activeTexture(webglSlot: number): void; + /** + * Binds the given WebGL texture to a target. + * + * This method caches the state so `gl.bindTexture()` is only + * called when necessary. + * + * @param {number} webglType - The binding point (target). + * @param {WebGLTexture} webglTexture - The WebGL texture to bind. + * @param {number} webglSlot - The texture. + */ + bindTexture(webglType: number, webglTexture: WebGLTexture, webglSlot: number): void; + /** + * Binds a given WebGL buffer to a given binding point (target) at a given index. + * + * This method caches the state so `gl.bindBufferBase()` is only + * called when necessary. + * + * @param {number} target - The target for the bind operation. + * @param {number} index - The index of the target. + * @param {WebGLBuffer} buffer - The WebGL buffer. + * @return {boolean} Whether a bind has been executed or not. + */ + bindBufferBase(target: number, index: number, buffer: WebGLBuffer): boolean; + /** + * Unbinds the current bound texture. + * + * This method caches the state so `gl.bindTexture()` is only + * called when necessary. + */ + unbindTexture(): void; + /** + * Returns the value for the given parameter. + * + * @param {number} name - The parameter to get the value for. + * @return {any} The value for the given parameter. + */ + getParameter(name: number): any; + /** + * Specifies a pixel storage mode. + * + * @param {number} name - The parameter to set. + * @param {any} value - A value to set the parameter to. + */ + pixelStorei(name: number, value: any): void; + /** + * Restores the WebGL state to its default and clears the cache so subsequent renderings + * re-apply the required state. Useful when the WebGL context is shared with other libraries. + */ + reset(): void; +} +import { Color } from '../../../math/Color.js'; +import { Vector4 } from '../../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts new file mode 100644 index 000000000..09a26d0f9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts @@ -0,0 +1,197 @@ +export default WebGLTextureUtils; +/** + * A WebGL 2 backend utility module for managing textures. + * + * @private + */ +declare class WebGLTextureUtils { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + /** + * A reference to a backend module holding extension-related + * utility functions. + * + * @type {WebGLExtensions} + */ + extensions: WebGLExtensions; + /** + * A dictionary for managing default textures. The key + * is the binding point (target), the value the WEbGL texture object. + * + * @type {Object} + */ + defaultTextures: any; + /** + * A scratch framebuffer used for attaching the source texture in + * {@link copyTextureToTexture}. + * + * @private + * @type {?WebGLFramebuffer} + */ + private _srcFramebuffer; + /** + * A scratch framebuffer used for attaching the destination texture in + * {@link copyTextureToTexture}. + * + * @private + * @type {?WebGLFramebuffer} + */ + private _dstFramebuffer; + /** + * Inits the state of the utility. + * + * @private + */ + private _init; + /** + * Returns the native texture type for the given texture. + * + * @param {Texture} texture - The texture. + * @return {GLenum} The native texture type. + */ + getGLTextureType(texture: Texture): GLenum; + /** + * Returns the native texture type for the given texture. + * + * @param {?string} internalFormatName - The internal format name. When `null`, the internal format is derived from the subsequent parameters. + * @param {GLenum} glFormat - The WebGL format. + * @param {GLenum} glType - The WebGL type. + * @param {string} colorSpace - The texture's color space. + * @param {boolean} [forceLinearTransfer=false] - Whether to force a linear transfer or not. + * @return {GLenum} The internal format. + */ + getInternalFormat(internalFormatName: string | null, glFormat: GLenum, glType: GLenum, normalized: any, colorSpace: string, forceLinearTransfer?: boolean): GLenum; + /** + * Sets the texture parameters for the given texture. + * + * @param {GLenum} textureType - The texture type. + * @param {Texture} texture - The texture. + */ + setTextureParameters(textureType: GLenum, texture: Texture): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(texture: Texture): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + * @return {undefined} + */ + createTexture(texture: Texture, options?: Object): undefined; + /** + * Uploads texture buffer data to the GPU memory. + * + * @param {WebGLBuffer} buffer - The buffer data. + * @param {Texture} texture - The texture, + */ + copyBufferToTexture(buffer: WebGLBuffer, texture: Texture): void; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + */ + generateMipmaps(texture: Texture): void; + /** + * Deallocates the render buffers of the given render target. + * + * @param {RenderTarget} renderTarget - The render target. + */ + deallocateRenderBuffers(renderTarget: RenderTarget): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Copies data of the given source texture to the given destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The source mip level to copy from. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; + /** + * SetupS storage for internal depth/stencil buffers and bind to correct framebuffer. + * + * @param {WebGLRenderbuffer} renderbuffer - The render buffer. + * @param {RenderContext} renderContext - The render context. + * @param {number} samples - The MSAA sample count. + * @param {boolean} [useMultisampledRTT=false] - Whether to use WEBGL_multisampled_render_to_texture or not. + */ + setupRenderBufferStorage(renderbuffer: WebGLRenderbuffer, renderContext: RenderContext, samples: number, useMultisampledRTT?: boolean): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Returns the corresponding typed array type for the given WebGL data type. + * + * @private + * @param {GLenum} glType - The WebGL data type. + * @return {TypedArray.constructor} The typed array type. + */ + private _getTypedArrayType; + /** + * Returns the bytes-per-texel value for the given WebGL data type and texture format. + * + * @private + * @param {GLenum} glType - The WebGL data type. + * @param {GLenum} glFormat - The WebGL texture format. + * @return {number} The bytes-per-texel. + */ + private _getBytesPerTexel; + /** + * Frees the internal resources. + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts new file mode 100644 index 000000000..c6a325c47 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts @@ -0,0 +1,58 @@ +export default WebGLTimestampQueryPool; +/** + * Manages a pool of WebGL timestamp queries for performance measurement. + * Handles creation, execution, and resolution of timer queries using WebGL extensions. + * + * @augments TimestampQueryPool + */ +declare class WebGLTimestampQueryPool extends TimestampQueryPool { + /** + * Creates a new WebGL timestamp query pool. + * + * @param {WebGLRenderingContext|WebGL2RenderingContext} gl - The WebGL context. + * @param {string} type - The type identifier for this query pool. + * @param {number} [maxQueries=2048] - Maximum number of queries this pool can hold. + */ + constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, type: string, maxQueries?: number); + gl: WebGLRenderingContext | WebGL2RenderingContext; + type: string; + ext: any; + queries: any[] | undefined; + activeQuery: number | null; + queryStates: Map | undefined; + /** + * Allocates a pair of queries for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @returns {?number} The base offset for the allocated queries, or null if allocation failed. + */ + allocateQueriesForContext(uid: string): number | null; + /** + * Begins a timestamp query for the specified render context. + * + * @param {string} uid - A unique identifier for the render context. + */ + beginQuery(uid: string): void; + /** + * Ends the active timestamp query for the specified render context. + * + * @param {string} uid - A unique identifier for the render context. + */ + endQuery(uid: string): void; + /** + * Asynchronously resolves all completed queries and returns the total duration. + * + * @async + * @returns {Promise} The total duration in milliseconds, or the last valid value if resolution fails. + */ + resolveQueriesAsync(): Promise; + /** + * Resolves a single query, checking for completion and disjoint operation. + * + * @async + * @param {WebGLQuery} query - The query object to resolve. + * @returns {Promise} The elapsed time in milliseconds. + */ + resolveQuery(query: WebGLQuery): Promise; +} +import TimestampQueryPool from '../../common/TimestampQueryPool.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts new file mode 100644 index 000000000..1f75ec7e8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts @@ -0,0 +1,51 @@ +export default WebGLUtils; +/** + * A WebGL 2 backend utility module with common helpers. + * + * @private + */ +declare class WebGLUtils { + /** + * Constructs a new utility object. + * + * @param {WebGLBackend} backend - The WebGL 2 backend. + */ + constructor(backend: WebGLBackend); + /** + * A reference to the WebGL 2 backend. + * + * @type {WebGLBackend} + */ + backend: WebGLBackend; + /** + * A reference to the rendering context. + * + * @type {WebGL2RenderingContext} + */ + gl: WebGL2RenderingContext; + /** + * A reference to a backend module holding extension-related + * utility functions. + * + * @type {WebGLExtensions} + */ + extensions: WebGLExtensions; + /** + * Converts the given three.js constant into a WebGL constant. + * The method currently supports the conversion of texture formats + * and types. + * + * @param {number} p - The three.js constant. + * @param {string} [colorSpace=NoColorSpace] - The color space. + * @return {?number} The corresponding WebGL constant. + */ + convert(p: number, colorSpace?: string): number | null; + /** + * This method can be used to synchronize the CPU with the GPU by waiting until + * ongoing GPU commands have been completed. + * + * @private + * @return {Promise} A promise that resolves when all ongoing GPU commands have been completed. + */ + private _clientWaitAsync; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts new file mode 100644 index 000000000..8c234dea3 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts @@ -0,0 +1,6 @@ +export function WebGLAnimation(): { + start: () => void; + stop: () => void; + setAnimationLoop: (callback: any) => void; + setContext: (value: any) => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts new file mode 100644 index 000000000..74dfcf7fd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts @@ -0,0 +1,5 @@ +export function WebGLAttributes(gl: any): { + get: (attribute: any) => any; + remove: (attribute: any) => void; + update: (attribute: any, bufferType: any) => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts new file mode 100644 index 000000000..a05a75907 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts @@ -0,0 +1,10 @@ +export function WebGLBackground(renderer: any, environments: any, state: any, objects: any, alpha: any, premultipliedAlpha: any): { + getClearColor: () => Color; + setClearColor: (color: any, alpha?: number) => void; + getClearAlpha: () => number; + setClearAlpha: (alpha: any) => void; + render: (scene: any) => void; + addToRenderList: (renderList: any, scene: any) => void; + dispose: () => void; +}; +import { Color } from '../../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts new file mode 100644 index 000000000..73ea033cc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts @@ -0,0 +1,12 @@ +export function WebGLBindingStates(gl: any, attributes: any): { + setup: (object: any, material: any, program: any, geometry: any, index: any) => void; + reset: () => void; + resetDefaultState: () => void; + dispose: () => void; + releaseStatesOfGeometry: (geometry: any) => void; + releaseStatesOfObject: (object: any) => void; + releaseStatesOfProgram: (program: any) => void; + initAttributes: () => void; + enableAttribute: (attribute: any) => void; + disableUnusedAttributes: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts new file mode 100644 index 000000000..8182d4ea9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts @@ -0,0 +1,8 @@ +export function WebGLBufferRenderer(gl: any, extensions: any, info: any): void; +export class WebGLBufferRenderer { + constructor(gl: any, extensions: any, info: any); + setMode: (value: any) => void; + render: (start: any, count: any) => void; + renderInstances: (start: any, count: any, primcount: any) => void; + renderMultiDraw: (starts: any, counts: any, drawCount: any) => void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts new file mode 100644 index 000000000..1367f224b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts @@ -0,0 +1,20 @@ +export function WebGLCapabilities(gl: any, extensions: any, parameters: any, utils: any): { + isWebGL2: boolean; + getMaxAnisotropy: () => any; + getMaxPrecision: (precision: any) => "highp" | "mediump" | "lowp"; + textureFormatReadable: (textureFormat: any) => boolean; + textureTypeReadable: (textureType: any) => boolean; + precision: any; + logarithmicDepthBuffer: boolean; + reversedDepthBuffer: any; + maxTextures: any; + maxVertexTextures: any; + maxTextureSize: any; + maxCubemapSize: any; + maxAttributes: any; + maxVertexUniforms: any; + maxVaryings: any; + maxFragmentUniforms: any; + maxSamples: any; + samples: any; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts new file mode 100644 index 000000000..5cda7553c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts @@ -0,0 +1,4 @@ +export function WebGLEnvironments(renderer: any): { + get: (texture: any, usePMREM?: boolean) => any; + dispose: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts new file mode 100644 index 000000000..485025fbb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts @@ -0,0 +1,5 @@ +export function WebGLExtensions(gl: any): { + has: (name: any) => boolean; + init: () => void; + get: (name: any) => any; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts new file mode 100644 index 000000000..6dc941500 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts @@ -0,0 +1,5 @@ +export function WebGLGeometries(gl: any, attributes: any, info: any, bindingStates: any): { + get: (object: any, geometry: any) => any; + update: (geometry: any) => void; + getWireframeAttribute: (geometry: any) => any; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts new file mode 100644 index 000000000..344fcb256 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts @@ -0,0 +1,9 @@ +export function WebGLIndexedBufferRenderer(gl: any, extensions: any, info: any): void; +export class WebGLIndexedBufferRenderer { + constructor(gl: any, extensions: any, info: any); + setMode: (value: any) => void; + setIndex: (value: any) => void; + render: (start: any, count: any) => void; + renderInstances: (start: any, count: any, primcount: any) => void; + renderMultiDraw: (starts: any, counts: any, drawCount: any) => void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts new file mode 100644 index 000000000..dd5ad7dac --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts @@ -0,0 +1,17 @@ +export function WebGLInfo(gl: any): { + memory: { + geometries: number; + textures: number; + }; + render: { + frame: number; + calls: number; + triangles: number; + points: number; + lines: number; + }; + programs: null; + autoReset: boolean; + reset: () => void; + update: (count: any, mode: any, instanceCount: any) => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts new file mode 100644 index 000000000..1a605e848 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts @@ -0,0 +1,47 @@ +export function WebGLLights(extensions: any): { + setup: (lights: any) => void; + setupView: (lights: any, camera: any) => void; + state: { + version: number; + hash: { + sunLength: number; + directionalLength: number; + pointLength: number; + spotLength: number; + rectAreaLength: number; + hemiLength: number; + numSunShadows: number; + numDirectionalShadows: number; + numPointShadows: number; + numSpotShadows: number; + numSpotMaps: number; + numLightProbes: number; + }; + ambient: number[]; + probe: never[]; + sun: never[]; + sunShadow: never[]; + sunShadowMap: never[]; + sunShadowMatrix: never[]; + sunShadowCascade: never[]; + directional: never[]; + directionalShadow: never[]; + directionalShadowMap: never[]; + directionalShadowMatrix: never[]; + spot: never[]; + spotLightMap: never[]; + spotShadow: never[]; + spotShadowMap: never[]; + spotLightMatrix: never[]; + rectArea: never[]; + rectAreaLTC1: null; + rectAreaLTC2: null; + point: never[]; + pointShadow: never[]; + pointShadowMap: never[]; + pointShadowMatrix: never[]; + hemi: never[]; + numSpotLightShadowsWithMaps: number; + numLightProbes: number; + }; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts new file mode 100644 index 000000000..2db593304 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts @@ -0,0 +1,4 @@ +export function WebGLMaterials(renderer: any, properties: any): { + refreshFogUniforms: (uniforms: any, fog: any) => void; + refreshMaterialUniforms: (uniforms: any, material: any, pixelRatio: any, height: any, transmissionRenderTarget: any) => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts new file mode 100644 index 000000000..1882f060b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts @@ -0,0 +1,3 @@ +export function WebGLMorphtargets(gl: any, capabilities: any, textures: any): { + update: (object: any, geometry: any, program: any) => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts new file mode 100644 index 000000000..50c005398 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts @@ -0,0 +1,4 @@ +export function WebGLObjects(gl: any, geometries: any, attributes: any, bindingStates: any, info: any): { + update: (object: any) => any; + dispose: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts new file mode 100644 index 000000000..2977b038f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts @@ -0,0 +1,11 @@ +export function WebGLOutput(type: any, width: any, height: any, antialias: any, depth: any, stencil: any): void; +export class WebGLOutput { + constructor(type: any, width: any, height: any, antialias: any, depth: any, stencil: any); + setSize: (width: any, height: any) => void; + setEffects: (effects: any) => void; + begin: (renderer: any, renderTarget: any) => boolean; + hasRenderPass: () => boolean; + end: (renderer: any, deltaTime: any) => void; + isCompositing: () => boolean; + dispose: () => void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts new file mode 100644 index 000000000..f89049df9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts @@ -0,0 +1,145 @@ +export function WebGLPrograms(renderer: any, environments: any, extensions: any, capabilities: any, bindingStates: any, clipping: any): { + getParameters: (material: any, lights: any, shadows: any, scene: any, object: any, lightProbeGrids: any) => { + shaderID: any; + shaderType: any; + shaderName: any; + vertexShader: any; + fragmentShader: any; + defines: any; + customVertexShaderID: any; + customFragmentShaderID: any; + isRawShaderMaterial: boolean; + glslVersion: any; + precision: any; + batching: boolean; + batchingColor: boolean; + instancing: boolean; + instancingColor: boolean; + instancingMorph: boolean; + outputColorSpace: any; + alphaToCoverage: boolean; + map: boolean; + matcap: boolean; + envMap: boolean; + envMapMode: any; + envMapCubeUVHeight: any; + aoMap: boolean; + lightMap: boolean; + bumpMap: boolean; + normalMap: boolean; + displacementMap: boolean; + emissiveMap: boolean; + normalMapObjectSpace: boolean; + normalMapTangentSpace: boolean; + packedNormalMap: boolean; + metalnessMap: boolean; + roughnessMap: boolean; + anisotropy: boolean; + anisotropyMap: boolean; + clearcoat: boolean; + clearcoatMap: boolean; + clearcoatNormalMap: boolean; + clearcoatRoughnessMap: boolean; + dispersion: boolean; + retroreflection: boolean; + iridescence: boolean; + iridescenceMap: boolean; + iridescenceThicknessMap: boolean; + sheen: boolean; + sheenColorMap: boolean; + sheenRoughnessMap: boolean; + specularMap: boolean; + specularColorMap: boolean; + specularIntensityMap: boolean; + transmission: boolean; + transmissionMap: boolean; + thicknessMap: boolean; + gradientMap: boolean; + opaque: boolean; + alphaMap: boolean; + alphaTest: boolean; + alphaHash: boolean; + combine: any; + mapUv: string | false; + aoMapUv: string | false; + lightMapUv: string | false; + bumpMapUv: string | false; + normalMapUv: string | false; + displacementMapUv: string | false; + emissiveMapUv: string | false; + metalnessMapUv: string | false; + roughnessMapUv: string | false; + anisotropyMapUv: string | false; + clearcoatMapUv: string | false; + clearcoatNormalMapUv: string | false; + clearcoatRoughnessMapUv: string | false; + iridescenceMapUv: string | false; + iridescenceThicknessMapUv: string | false; + sheenColorMapUv: string | false; + sheenRoughnessMapUv: string | false; + specularMapUv: string | false; + specularColorMapUv: string | false; + specularIntensityMapUv: string | false; + transmissionMapUv: string | false; + thicknessMapUv: string | false; + alphaMapUv: string | false; + vertexTangents: boolean; + vertexNormals: boolean; + vertexColors: any; + vertexAlphas: boolean; + pointsUvs: boolean; + fog: boolean; + useFog: boolean; + fogExp2: any; + flatShading: any; + sizeAttenuation: boolean; + logarithmicDepthBuffer: any; + reversedDepthBuffer: any; + skinning: boolean; + hasPositionAttribute: boolean; + morphTargets: boolean; + morphNormals: boolean; + morphColors: boolean; + morphTargetsCount: any; + morphTextureStride: number; + numSunLights: any; + numDirLights: any; + numPointLights: any; + numSpotLights: any; + numSpotLightMaps: any; + numRectAreaLights: any; + numHemiLights: any; + numSunLightShadows: any; + numDirLightShadows: any; + numPointLightShadows: any; + numSpotLightShadows: any; + numSpotLightShadowsWithMaps: any; + numLightProbes: any; + numLightProbeGrids: any; + numClippingPlanes: any; + numClipIntersection: any; + dithering: any; + shadowMapEnabled: any; + shadowMapType: any; + toneMapping: number; + decodeVideoTexture: boolean; + decodeVideoTextureEmissive: boolean; + premultipliedAlpha: any; + doubleSided: boolean; + flipSided: boolean; + useDepthPacking: boolean; + depthPacking: any; + index0AttributeName: any; + extensionClipCullDistance: any; + extensionMultiDraw: any; + rendererExtensionParallelShaderCompile: any; + customProgramCacheKey: any; + }; + getProgramCacheKey: (parameters: any) => string; + getUniforms: (material: any) => any; + acquireProgram: (parameters: any, cacheKey: any) => any; + releaseProgram: (program: any) => void; + releaseShaderCache: (material: any) => void; + programs: any[]; + dispose: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts new file mode 100644 index 000000000..85512905d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts @@ -0,0 +1,7 @@ +export function WebGLProperties(): { + has: (object: any) => boolean; + get: (object: any) => any; + remove: (object: any) => void; + update: (object: any, key: any, value: any) => void; + dispose: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts new file mode 100644 index 000000000..9ec930a02 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts @@ -0,0 +1,14 @@ +export function WebGLRenderLists(): { + get: (scene: any, renderCallDepth: any) => any; + dispose: () => void; +}; +export function WebGLRenderList(): { + opaque: any[]; + transmissive: any[]; + transparent: any[]; + init: () => void; + push: (object: any, geometry: any, material: any, groupOrder: any, z: any, group: any, camera: any) => void; + unshift: (object: any, geometry: any, material: any, groupOrder: any, z: any, group: any) => void; + finish: () => void; + sort: (customOpaqueSort: any, customTransparentSort: any) => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts new file mode 100644 index 000000000..f6d5a471a --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts @@ -0,0 +1,4 @@ +export function WebGLRenderStates(extensions: any): { + get: (scene: any, renderCallDepth?: number) => any; + dispose: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts new file mode 100644 index 000000000..c4b1be0cc --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts @@ -0,0 +1 @@ +export function WebGLShader(gl: any, type: any, string: any): any; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts new file mode 100644 index 000000000..7b4f6f540 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts @@ -0,0 +1,11 @@ +export class WebGLShaderCache { + shaderCache: Map; + materialCache: Map; + update(material: any, vertexShaderStage: any, fragmentShaderStage: any): this; + remove(material: any): this; + getVertexShaderStage(material: any): any; + getFragmentShaderStage(material: any): any; + dispose(): void; + _getShaderCacheForMaterial(material: any): any; + _getShaderStage(code: any): any; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts new file mode 100644 index 000000000..2915facbf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts @@ -0,0 +1,39 @@ +export function WebGLState(gl: any, extensions: any): { + buffers: { + color: any; + depth: any; + stencil: any; + }; + enable: (id: any) => void; + disable: (id: any) => void; + bindFramebuffer: (target: any, framebuffer: any) => boolean; + drawBuffers: (renderTarget: any, framebuffer: any) => void; + useProgram: (program: any) => boolean; + setBlending: (blending: any, blendEquation: any, blendSrc: any, blendDst: any, blendEquationAlpha: any, blendSrcAlpha: any, blendDstAlpha: any, blendColor: any, blendAlpha: any, premultipliedAlpha: any) => void; + setMaterial: (material: any, frontFaceCW: any) => void; + setFlipSided: (flipSided: any) => void; + setCullFace: (cullFace: any) => void; + setLineWidth: (width: any) => void; + setPolygonOffset: (polygonOffset: any, factor: any, units: any) => void; + setScissorTest: (scissorTest: any) => void; + activeTexture: (webglSlot: any) => void; + bindTexture: (webglType: any, webglTexture: any, webglSlot: any) => void; + unbindTexture: () => void; + compressedTexImage2D: (...args: any[]) => void; + compressedTexImage3D: (...args: any[]) => void; + texImage2D: (...args: any[]) => void; + texImage3D: (...args: any[]) => void; + pixelStorei: (name: any, value: any) => void; + getParameter: (name: any) => any; + updateUBOMapping: (uniformsGroup: any, program: any) => void; + uniformBlockBinding: (uniformsGroup: any, program: any) => void; + texStorage2D: (...args: any[]) => void; + texStorage3D: (...args: any[]) => void; + texSubImage2D: (...args: any[]) => void; + texSubImage3D: (...args: any[]) => void; + compressedTexSubImage2D: (...args: any[]) => void; + compressedTexSubImage3D: (...args: any[]) => void; + scissor: (scissor: any) => void; + viewport: (viewport: any) => void; + reset: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts new file mode 100644 index 000000000..8d958b7ae --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts @@ -0,0 +1,20 @@ +export function WebGLTextures(_gl: any, extensions: any, state: any, properties: any, capabilities: any, utils: any, info: any): void; +export class WebGLTextures { + constructor(_gl: any, extensions: any, state: any, properties: any, capabilities: any, utils: any, info: any); + allocateTextureUnit: () => number; + resetTextureUnits: () => void; + getTextureUnits: () => number; + setTextureUnits: (value: any) => void; + setTexture2D: (texture: any, slot: any) => void; + setTexture2DArray: (texture: any, slot: any) => void; + setTexture3D: (texture: any, slot: any) => void; + setTextureCube: (texture: any, slot: any) => void; + rebindTextures: (renderTarget: any, colorTexture: any, depthTexture: any) => void; + setupRenderTarget: (renderTarget: any) => void; + updateRenderTargetMipmap: (renderTarget: any) => void; + updateMultisampleRenderTarget: (renderTarget: any) => void; + setupDepthRenderbuffer: (renderTarget: any) => void; + setupFrameBufferTexture: (framebuffer: any, renderTarget: any, texture: any, attachment: any, textureTarget: any, level: any) => void; + useMultisampledRTT: (renderTarget: any) => boolean; + isReversedDepthBuffer: () => any; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts new file mode 100644 index 000000000..8535725df --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts @@ -0,0 +1,9 @@ +export class WebGLUniforms { + static upload(gl: any, seq: any, values: any, textures: any): void; + static seqWithValue(seq: any, values: any): any[]; + constructor(gl: any, program: any); + seq: any[]; + map: {}; + setValue(gl: any, name: any, value: any, textures: any): void; + setOptional(gl: any, object: any, name: any): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts new file mode 100644 index 000000000..3eb1deb18 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts @@ -0,0 +1,5 @@ +export function WebGLUniformsGroups(gl: any, info: any, capabilities: any, state: any): { + bind: (uniformsGroup: any, program: any) => void; + update: (uniformsGroup: any, program: any) => void; + dispose: () => void; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts new file mode 100644 index 000000000..4c3bac4b4 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts @@ -0,0 +1,3 @@ +export function WebGLUtils(gl: any, extensions: any): { + convert: (p: any, colorSpace?: string) => any; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts new file mode 100644 index 000000000..93dd58f9f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts @@ -0,0 +1,637 @@ +export default WebGPUBackend; +/** + * A backend implementation targeting WebGPU. + * + * @private + * @augments Backend + */ +declare class WebGPUBackend extends Backend { + /** + * WebGPUBackend options. + * + * @typedef {Object} WebGPUBackend~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. + * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. + * @property {boolean} [trackTimestamp=false] - Whether to track timestamps with a Timestamp Query API or not. + * @property {string} [powerPreference=undefined] - The power preference. + * @property {Object} [requiredLimits=undefined] - Specifies the limits that are required by the device request. The request will fail if the adapter cannot provide these limits. + * @property {GPUDevice} [device=undefined] - If there is an existing GPU device on app level, it can be passed to the renderer as a parameter. + * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. + */ + /** + * Constructs a new WebGPU backend. + * + * @param {WebGPUBackend~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGPUBackend: boolean; + /** + * Indicates whether the backend is in WebGPU compatibility mode or not. + * The backend must be initialized before the property can be evaluated. + * + * @type {?boolean} + * @readonly + * @default null + */ + readonly compatibilityMode: boolean | null; + /** + * A reference to the device. + * + * @type {?GPUDevice} + * @default null + */ + device: GPUDevice | null; + /** + * A reference to the default render pass descriptor. + * + * @type {?Object} + * @default null + */ + defaultRenderPassdescriptor: Object | null; + /** + * A reference to a backend module holding common utility functions. + * + * @type {WebGPUUtils} + */ + utils: WebGPUUtils; + /** + * A reference to a backend module holding shader attribute-related + * utility functions. + * + * @type {WebGPUAttributeUtils} + */ + attributeUtils: WebGPUAttributeUtils; + /** + * A reference to a backend module holding shader binding-related + * utility functions. + * + * @type {WebGPUBindingUtils} + */ + bindingUtils: WebGPUBindingUtils; + /** + * A reference to a backend module holding device capability related + * utility functions. + * + * @type {WebGPUCapabilities} + */ + capabilities: WebGPUCapabilities; + /** + * A reference to a backend module holding shader pipeline-related + * utility functions. + * + * @type {WebGPUPipelineUtils} + */ + pipelineUtils: WebGPUPipelineUtils; + /** + * A reference to a backend module holding shader texture-related + * utility functions. + * + * @type {WebGPUTextureUtils} + */ + textureUtils: WebGPUTextureUtils; + /** + * A map that manages the resolve buffers for occlusion queries. + * + * @type {Map} + */ + occludedResolveCache: Map; + /** + * A map of compatibility checks. + * + * @type {Object} + */ + _compatibility: Object; + /** + * Registers external GPU textures from `XRGPUBinding` for use in rendering. + * + * @param {RenderTarget} renderTarget - The render target to register the textures for. + * @param {GPUTexture} colorTexture - The shared XR color GPUTexture. + * @param {?Array} [viewDescriptors=null] - Optional view descriptors, one per XR view. + */ + setXRRenderTargetTextures(renderTarget: RenderTarget, colorTexture: GPUTexture, viewDescriptors?: Array | null): void; + /** + * A reference to the context. + * + * @type {?GPUCanvasContext} + * @default null + */ + get context(): GPUCanvasContext | null; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {number} count - The offset from which to start reading the + * @param {number} offset - The storage buffer attribute. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Returns the backend's rendering context. + * + * @return {GPUCanvasContext} The rendering context. + */ + getContext(): GPUCanvasContext; + /** + * Returns the default render pass descriptor. + * + * In WebGPU, the default framebuffer must be configured + * like custom framebuffers so the backend needs a render + * pass descriptor even when rendering directly to screen. + * + * @private + * @return {GPURenderPassDescriptor} The render pass descriptor. + */ + private _getDefaultRenderPassDescriptor; + /** + * Returns whether the render target is a render target array with depth 2D array texture. + * + * @param {RenderContext} renderContext - The render context. + * @return {boolean} Whether the render target is a render target array with depth 2D array texture. + * + * @private + */ + private _isRenderCameraDepthArray; + /** + * Returns whether the current render context references external textures. + * + * External textures can change every frame, so their descriptors must not be cached. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @return {boolean} Whether the render context uses external textures. + */ + private _hasExternalTexture; + /** + * Returns multisampled color textures for an external render target. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @param {Object} textureData - The backend data for the external texture. + * @param {number} count - The number of textures to create. + * @return {?Array} The multisampled textures. + */ + private _getExternalMSAATextures; + /** + * Creates attachment views for an external texture render target. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @param {Object} textureData - The backend data for the texture. + * @return {Array} The attachment view descriptors. + */ + private _createExternalTextureViews; + /** + * Returns the render pass descriptor for the given render context. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @param {Object} colorAttachmentsConfig - Configuration object for the color attachments. + * @return {Object} The render pass descriptor. + */ + private _getRenderPassDescriptor; + /** + * This method is executed at the beginning of a render call and prepares + * the WebGPU state for upcoming render calls + * + * @param {RenderContext} renderContext - The render context. + */ + beginRender(renderContext: RenderContext): void; + /** + * Resets the state cache of the given render context data. + * + * A new render pass encoder starts with a blend constant and a stencil reference + * of zero so the cached values must be reset as well. + * + * @private + * @param {Object} renderContextData - The render context data. + */ + private _resetRenderContextData; + /** + * Creates a render bundle encoder and state cache for each camera layer. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object} renderContextData - The render context data. + * @private + */ + private _createArrayCameraBundleEncoders; + /** + * Finishes the render bundle encoders for all camera layers. + * + * @param {Object} renderContextData - The render context data. + * @return {Array} The completed render bundles. + * @private + */ + private _finishArrayCameraBundleEncoders; + /** + * Creates render pass descriptors for each camera in an array camera. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object} renderContextData - The render context data. + * @param {Object} descriptor - The render pass descriptor. + * @param {ArrayCamera} cameras - The array camera. + * + * @private + */ + private _createArrayCameraLayerDescriptors; + /** + * Updates render pass descriptors for each camera in an array camera. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object} renderContextData - The render context data. + * @param {Object} descriptor - The render pass descriptor. + * @param {ArrayCamera} cameras - The array camera. + * + */ + _updateArrayCameraLayerDescriptors(renderContext: RenderContext, renderContextData: Object, descriptor: Object, cameras: ArrayCamera): void; + /** + * This method is executed at the end of a render call and finalizes work + * after draw calls. + * + * @param {RenderContext} renderContext - The render context. + */ + finishRender(renderContext: RenderContext): void; + /** + * Returns `true` if the given 3D object is fully occluded by other + * 3D objects in the scene. + * + * @param {RenderContext} renderContext - The render context. + * @param {Object3D} object - The 3D object to test. + * @return {boolean} Whether the 3D object is fully occluded or not. + */ + isOccluded(renderContext: RenderContext, object: Object3D): boolean; + /** + * This method processes the result of occlusion queries and writes it + * into render context data. + * + * @async + * @param {RenderContext} renderContext - The render context. + * @return {Promise} A Promise that resolves when the occlusion query results have been processed. + */ + resolveOccludedAsync(renderContext: RenderContext): Promise; + /** + * Updates the viewport with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateViewport(renderContext: RenderContext): void; + /** + * Updates the scissor with the values from the given render context. + * + * @param {RenderContext} renderContext - The render context. + */ + updateScissor(renderContext: RenderContext): void; + /** + * Returns the clear color and alpha into a single + * color object. + * + * @return {Color4} The clear color. + */ + getClearColor(): Color4; + /** + * Performs a clear operation. + * + * @param {boolean} color - Whether the color buffer should be cleared or not. + * @param {boolean} depth - Whether the depth buffer should be cleared or not. + * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. + * @param {?RenderContext} [renderTargetContext=null] - The render context of the current set render target. + */ + clear(color: boolean, depth: boolean, stencil: boolean, renderTargetContext?: RenderContext | null): void; + /** + * This method is executed at the beginning of a compute call and + * prepares the state for upcoming compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + beginCompute(computeGroup: Node | Array): void; + /** + * Executes a compute command for the given compute node. + * + * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. + * @param {Node} computeNode - The compute node. + * @param {Array} bindings - The bindings. + * @param {ComputePipeline} pipeline - The compute pipeline. + * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] + * - A single number representing count, or + * - An array [x, y, z] representing dispatch size, or + * - A IndirectStorageBufferAttribute for indirect dispatch size. + */ + compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, dispatchSize?: number | Array | IndirectStorageBufferAttribute): void; + /** + * This method is executed at the end of a compute call and + * finalizes work after compute tasks. + * + * @param {Node|Array} computeGroup - The compute node(s). + */ + finishCompute(computeGroup: Node | Array): void; + /** + * Internal draw function that performs the draw with the given pass encoder. + * + * @private + * @param {RenderObject} renderObject - The render object. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + * @param {Object} renderContextData - The render context data object, holding current pass state and occlusion query tracking. + * @param {GPURenderPipeline} pipelineGPU - The GPU render pipeline. + * @param {Array} bindings - The bind groups. + * @param {Array} vertexBuffers - The vertex buffers. + * @param {{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} drawParams - The draw parameters. + * @param {GPURenderPassEncoder|GPURenderBundleEncoder} passEncoderGPU - The GPU pass encoder used for recording draw commands. + * @param {Object} currentSets - Tracking object for currently set pipeline, attributes, bind groups, and index state. + * @param {number} [cameraIndexSlot=-1] - Index of the binding slot holding the camera index bind group. + */ + private _draw; + /** + * Executes a draw command for the given render object. + * + * @param {RenderObject} renderObject - The render object to draw. + * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. + */ + draw(renderObject: RenderObject, info: Info): void; + /** + * Returns `true` if the render pipeline requires an update. + * + * @param {RenderObject} renderObject - The render object. + * @return {boolean} Whether the render pipeline requires an update or not. + */ + needsRenderUpdate(renderObject: RenderObject): boolean; + /** + * Returns a cache key that is used to identify render pipelines. + * + * @param {RenderObject} renderObject - The render object. + * @return {string} The cache key. + */ + getRenderCacheKey(renderObject: RenderObject): string; + /** + * Updates a GPU sampler for the given texture. + * + * @param {Sampler} binding - The sampler binding to update. + * @return {string} The current sampler key. + */ + updateSampler(binding: Sampler): string; + /** + * Frees the GPU sampler for the given sampler binding. + * + * @param {Sampler} binding - The sampler binding to free. + */ + destroySampler(binding: Sampler): void; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + * @return {boolean} Whether the sampler has been updated or not. + */ + createDefaultTexture(texture: Texture): boolean; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(texture: Texture, options?: Object): void; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + */ + generateMipmaps(texture: Texture): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Inits a time stamp query for the given render context. + * + * @param {string} type - The type of the timestamp query (e.g. 'render', 'compute'). + * @param {number} uid - Unique id for the context (e.g. render context id). + * @param {Object} descriptor - The query descriptor. + */ + initTimestampQuery(type: string, uid: number, descriptor: Object): void; + /** + * Returns a node builder for the given render object. + * + * @param {RenderObject} object - The render object. + * @param {Renderer} renderer - The renderer. + * @return {WGSLNodeBuilder} The node builder. + */ + createNodeBuilder(object: RenderObject, renderer: Renderer): WGSLNodeBuilder; + /** + * Creates a shader program from the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + createProgram(program: ProgrammableStage): void; + /** + * Destroys the shader program of the given programmable stage. + * + * @param {ProgrammableStage} program - The programmable stage. + */ + destroyProgram(program: ProgrammableStage): void; + /** + * Creates a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(renderObject: RenderObject, promises: Array>): void; + /** + * Creates a compute pipeline for the given compute node. + * + * @param {ComputePipeline} computePipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; + /** + * Prepares the state for encoding render bundles. + * + * @param {RenderContext} renderContext - The render context. + */ + beginBundle(renderContext: RenderContext): void; + /** + * After processing render bundles this method finalizes related work. + * + * @param {RenderContext} renderContext - The render context. + * @param {RenderBundle} bundle - The render bundle. + */ + finishBundle(renderContext: RenderContext, bundle: RenderBundle): void; + /** + * Adds a render bundle to the render context data. + * + * @param {RenderContext} renderContext - The render context. + * @param {RenderBundle} bundle - The render bundle to add. + */ + addBundle(renderContext: RenderContext, bundle: RenderBundle): void; + /** + * Creates a uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + createUniformBuffer(uniformBuffer: Buffer): void; + /** + * Destroys the GPU data for the given uniform buffer. + * + * @param {Buffer} uniformBuffer - The uniform buffer. + */ + destroyUniformBuffer(uniformBuffer: Buffer): void; + /** + * Creates bindings from the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; + /** + * Updates the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + updateBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; + /** + * Updates a buffer binding. + * + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(binding: Buffer): void; + /** + * Delete data associated with the current bind group. + * + * @param {BindGroup} bindGroup - The bind group. + */ + deleteBindGroupData(bindGroup: BindGroup): void; + /** + * Creates the buffer of an indexed shader attribute. + * + * @param {BufferAttribute} attribute - The indexed buffer attribute. + */ + createIndexAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of a storage attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createStorageAttribute(attribute: BufferAttribute): void; + /** + * Creates the GPU buffer of an indirect storage attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + createIndirectStorageAttribute(attribute: BufferAttribute): void; + /** + * Updates the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to update. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * Destroys the GPU buffer of a shader attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute to destroy. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * Checks if the given feature is supported by the backend. + * + * @param {string} name - The feature's name. + * @return {boolean} Whether the feature is supported or not. + */ + hasFeature(name: string): boolean; + /** + * Copies data of the given source texture to the given destination texture. + * + * @param {Texture} srcTexture - The source texture. + * @param {Texture} dstTexture - The destination texture. + * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. + * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. + * @param {number} [srcLevel=0] - The mipmap level to copy. + * @param {number} [dstLevel=0] - The destination mip level to copy to. + */ + copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; + /** + * Copies the current bound framebuffer to the given texture. + * + * @param {Texture} texture - The destination texture. + * @param {RenderContext} renderContext - The render context. + * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. + */ + copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; + /** + * Encodes a framebuffer copy from a specific texture-array layer. + * + * @param {GPUCommandEncoder} encoder - The command encoder. + * @param {Texture} texture - The destination texture. + * @param {GPUTexture} sourceGPU - The source GPU texture. + * @param {GPUTexture} destinationGPU - The destination GPU texture. + * @param {Object} rectangle - The source rectangle. + * @param {number} [sourceLayer=0] - The source array layer. + * @param {boolean} [generateMipmaps=texture.generateMipmaps] - Whether mipmaps should be generated. + * @private + */ + private _copyFramebufferToTexture; + /** + * Checks if the given compatibility is supported by the backend. + * + * @param {string} name - The compatibility name. + * @return {boolean} Whether the compatibility is supported or not. + */ + hasCompatibility(name: string): boolean; +} +import Backend from '../common/Backend.js'; +import WebGPUUtils from './utils/WebGPUUtils.js'; +import WebGPUAttributeUtils from './utils/WebGPUAttributeUtils.js'; +import WebGPUBindingUtils from './utils/WebGPUBindingUtils.js'; +import WebGPUCapabilities from './utils/WebGPUCapabilities.js'; +import WebGPUPipelineUtils from './utils/WebGPUPipelineUtils.js'; +import WebGPUTextureUtils from './utils/WebGPUTextureUtils.js'; +import WGSLNodeBuilder from './nodes/WGSLNodeBuilder.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts new file mode 100644 index 000000000..dfbe8d022 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts @@ -0,0 +1,25 @@ +export default WebGPURenderer; +/** + * This alternative version of {@link WebGPURenderer} only supports node materials. + * So classes like `MeshBasicMaterial` are not compatible. + * + * @private + * @augments Renderer + */ +declare class WebGPURenderer extends Renderer { + /** + * Constructs a new WebGPU renderer. + * + * @param {WebGPURenderer~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGPURenderer: boolean; +} +import Renderer from '../common/Renderer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts new file mode 100644 index 000000000..546c6744b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts @@ -0,0 +1,42 @@ +export default WebGPURenderer; +/** + * This renderer is the new alternative of `WebGLRenderer`. `WebGPURenderer` has the ability + * to target different backends. By default, the renderer tries to use a WebGPU backend if the + * browser supports WebGPU. If not, `WebGPURenderer` falls backs to a WebGL 2 backend. + * + * @augments Renderer + */ +declare class WebGPURenderer extends Renderer { + /** + * WebGPURenderer options. + * + * @typedef {Object} WebGPURenderer~Options + * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. + * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. + * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. + * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. + * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. + * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. + * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. + * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. + * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. + * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. + * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best + * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. + */ + /** + * Constructs a new WebGPU renderer. + * + * @param {WebGPURenderer~Options} [parameters] - The configuration parameter. + */ + constructor(parameters?: {}); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isWebGPURenderer: boolean; +} +import Renderer from '../common/Renderer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts new file mode 100644 index 000000000..1bd559d39 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts @@ -0,0 +1,32 @@ +export default GPUBindGroupDescriptor; +/** + * Reusable descriptor for `GPUDevice.createBindGroup()`. + * + * @private + */ +declare class GPUBindGroupDescriptor { + /** + * The label of the bind group. + * + * @type {string} + */ + label: string; + /** + * The bind group layout the bind group conforms to. + * + * @type {?GPUBindGroupLayout} + * @default null + */ + layout: GPUBindGroupLayout | null; + /** + * The bind group entries. + * + * @type {Array} + */ + entries: Array; + /** + * Resets the descriptor to its default state. The internal `entries` array + * is emptied without releasing its backing storage. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts new file mode 100644 index 000000000..b53c868a8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts @@ -0,0 +1,39 @@ +export default GPUBufferDescriptor; +/** + * Reusable descriptor for `GPUDevice.createBuffer()`. + * + * @private + */ +declare class GPUBufferDescriptor { + /** + * The label of the buffer. + * + * @type {string} + */ + label: string; + /** + * The size of the buffer in bytes. + * + * @type {number} + * @default 0 + */ + size: number; + /** + * The allowed usages for the buffer. + * + * @type {number} + * @default 0 + */ + usage: number; + /** + * Whether the buffer is in the mapped state at creation. + * + * @type {boolean} + * @default false + */ + mappedAtCreation: boolean; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts new file mode 100644 index 000000000..3e3be9d44 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts @@ -0,0 +1,18 @@ +export default GPUCommandEncoderDescriptor; +/** + * Reusable descriptor for `GPUDevice.createCommandEncoder()`. + * + * @private + */ +declare class GPUCommandEncoderDescriptor { + /** + * The label of the command encoder. + * + * @type {string} + */ + label: string; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts new file mode 100644 index 000000000..ab1ccf90e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts @@ -0,0 +1,24 @@ +export default GPUComputePassDescriptor; +/** + * Reusable descriptor for `GPUCommandEncoder.beginComputePass()`. + * + * @private + */ +declare class GPUComputePassDescriptor { + /** + * The label of the compute pass. + * + * @type {string} + */ + label: string; + /** + * Defines which timestamp values are written and where. + * + * @type {Object|undefined} + */ + timestampWrites: Object | undefined; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts new file mode 100644 index 000000000..738679592 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts @@ -0,0 +1,32 @@ +export default GPUComputePipelineDescriptor; +/** + * Reusable descriptor for `GPUDevice.createComputePipeline()`. + * + * @private + */ +declare class GPUComputePipelineDescriptor { + /** + * The label of the compute pipeline. + * + * @type {string} + */ + label: string; + /** + * The pipeline layout the pipeline conforms to, or `'auto'`. + * + * @type {?GPUPipelineLayout|string} + * @default null + */ + layout: (GPUPipelineLayout | string) | null; + /** + * The programmable compute stage. + * + * @type {?Object} + * @default null + */ + compute: Object | null; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts new file mode 100644 index 000000000..49adfbc13 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts @@ -0,0 +1,25 @@ +export default GPUCopyExternalImageDestInfo; +/** + * Reusable descriptor for `GPUCopyExternalImageDestInfo`, the destination + * argument to `GPUQueue.copyExternalImageToTexture()`. + * + * @private + * @augments GPUTexelCopyTextureInfo + */ +declare class GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo { + /** + * The predefined color space the destination texture is interpreted in. + * + * @type {string} + * @default 'srgb' + */ + colorSpace: string; + /** + * Whether the destination texture has premultiplied alpha. + * + * @type {boolean} + * @default false + */ + premultipliedAlpha: boolean; +} +import GPUTexelCopyTextureInfo from './GPUTexelCopyTextureInfo.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts new file mode 100644 index 000000000..ade0e6661 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts @@ -0,0 +1,36 @@ +export default GPUCopyExternalImageSourceInfo; +/** + * Reusable descriptor for `GPUCopyExternalImageSourceInfo`, the source argument + * to `GPUQueue.copyExternalImageToTexture()`. + * + * @private + */ +declare class GPUCopyExternalImageSourceInfo { + /** + * The image-like source. + * + * @type {?(ImageBitmap|ImageData|HTMLImageElement|HTMLVideoElement|VideoFrame|HTMLCanvasElement|OffscreenCanvas)} + * @default null + */ + source: (ImageBitmap | ImageData | HTMLImageElement | HTMLVideoElement | VideoFrame | HTMLCanvasElement | OffscreenCanvas) | null; + /** + * The origin offset within the source. + * + * @type {{x: number, y: number}} + */ + origin: { + x: number; + y: number; + }; + /** + * Whether the source is flipped vertically before copying. + * + * @type {boolean} + * @default false + */ + flipY: boolean; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts new file mode 100644 index 000000000..ad73dea82 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts @@ -0,0 +1,35 @@ +export default GPUExtent3D; +/** + * Reusable descriptor for `GPUExtent3D` in its dictionary form, used by + * `GPUQueue.writeTexture()`, `GPUQueue.copyExternalImageToTexture()` and + * the various `GPUCommandEncoder` copy methods. + * + * @private + */ +declare class GPUExtent3D { + /** + * The width of the extent. + * + * @type {number} + * @default 0 + */ + width: number; + /** + * The height of the extent. + * + * @type {number} + * @default 1 + */ + height: number; + /** + * The depth (for 3D textures) or number of array layers. + * + * @type {number} + * @default 1 + */ + depthOrArrayLayers: number; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts new file mode 100644 index 000000000..a2263550f --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts @@ -0,0 +1,25 @@ +export default GPUPipelineLayoutDescriptor; +/** + * Reusable descriptor for `GPUDevice.createPipelineLayout()`. + * + * @private + */ +declare class GPUPipelineLayoutDescriptor { + /** + * The label of the pipeline layout. + * + * @type {string} + */ + label: string; + /** + * The set of bind group layouts the pipeline layout describes. + * + * @type {?Array} + * @default null + */ + bindGroupLayouts: Array | null; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts new file mode 100644 index 000000000..6e44a65da --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts @@ -0,0 +1,31 @@ +export default GPUQuerySetDescriptor; +/** + * Reusable descriptor for `GPUDevice.createQuerySet()`. + * + * @private + */ +declare class GPUQuerySetDescriptor { + /** + * The label of the query set. + * + * @type {string} + */ + label: string; + /** + * The type of queries managed by the set. + * + * @type {string|undefined} + */ + type: string | undefined; + /** + * The number of queries managed by the set. + * + * @type {number} + * @default 0 + */ + count: number; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts new file mode 100644 index 000000000..b027f82ca --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts @@ -0,0 +1,52 @@ +export default GPURenderBundleEncoderDescriptor; +/** + * Reusable descriptor for `GPUDevice.createRenderBundleEncoder()`. + * + * @private + */ +declare class GPURenderBundleEncoderDescriptor { + /** + * The label of the render bundle encoder. + * + * @type {string} + */ + label: string; + /** + * The formats of the color attachments the bundle is compatible with. + * + * @type {?Array} + * @default null + */ + colorFormats: Array | null; + /** + * The format of the depth/stencil attachment the bundle is compatible with. + * + * @type {string|undefined} + */ + depthStencilFormat: string | undefined; + /** + * The number of samples per pixel the bundle is compatible with. + * + * @type {number} + * @default 1 + */ + sampleCount: number; + /** + * Whether the depth attachment is read-only. + * + * @type {boolean} + * @default false + */ + depthReadOnly: boolean; + /** + * Whether the stencil attachment is read-only. + * + * @type {boolean} + * @default false + */ + stencilReadOnly: boolean; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts new file mode 100644 index 000000000..a6aa47714 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts @@ -0,0 +1,50 @@ +export default GPURenderPassColorAttachment; +/** + * Reusable descriptor for `GPURenderPassColorAttachment`, the type of each + * entry in `GPURenderPassDescriptor.colorAttachments`. + * + * @private + */ +declare class GPURenderPassColorAttachment { + /** + * The texture view the pass renders into. + * + * @type {?GPUTextureView} + * @default null + */ + view: GPUTextureView | null; + /** + * The depth slice the pass renders into. + * + * @type {number|undefined} + */ + depthSlice: number | undefined; + /** + * The texture view that receives the resolved output of multisampled rendering. + * + * @type {?GPUTextureView|undefined} + */ + resolveTarget: (GPUTextureView | undefined) | null; + /** + * The clear value used when `loadOp` is `'clear'`. + * + * @type {Object|undefined} + */ + clearValue: Object | undefined; + /** + * The load operation performed at the start of the pass. + * + * @type {string|undefined} + */ + loadOp: string | undefined; + /** + * The store operation performed at the end of the pass. + * + * @type {string|undefined} + */ + storeOp: string | undefined; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts new file mode 100644 index 000000000..3bc5d785d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts @@ -0,0 +1,71 @@ +export default GPURenderPassDepthStencilAttachment; +/** + * Reusable descriptor for `GPURenderPassDepthStencilAttachment`, the + * `depthStencilAttachment` field of `GPURenderPassDescriptor`. + * + * @private + */ +declare class GPURenderPassDepthStencilAttachment { + /** + * The depth/stencil texture view the pass renders into. + * + * @type {?GPUTextureView} + * @default null + */ + view: GPUTextureView | null; + /** + * The load operation applied to the depth aspect at the start of the pass. + * + * @type {string|undefined} + */ + depthLoadOp: string | undefined; + /** + * The store operation applied to the depth aspect at the end of the pass. + * + * @type {string|undefined} + */ + depthStoreOp: string | undefined; + /** + * The clear value used when `depthLoadOp` is `'clear'`. + * + * @type {number|undefined} + */ + depthClearValue: number | undefined; + /** + * Whether the depth aspect is read-only. + * + * @type {boolean} + * @default false + */ + depthReadOnly: boolean; + /** + * The load operation applied to the stencil aspect at the start of the pass. + * + * @type {string|undefined} + */ + stencilLoadOp: string | undefined; + /** + * The store operation applied to the stencil aspect at the end of the pass. + * + * @type {string|undefined} + */ + stencilStoreOp: string | undefined; + /** + * The clear value used when `stencilLoadOp` is `'clear'`. + * + * @type {number} + * @default 0 + */ + stencilClearValue: number; + /** + * Whether the stencil aspect is read-only. + * + * @type {boolean} + * @default false + */ + stencilReadOnly: boolean; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts new file mode 100644 index 000000000..34e775c38 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts @@ -0,0 +1,50 @@ +export default GPURenderPassDescriptor; +/** + * Reusable descriptor for `GPUCommandEncoder.beginRenderPass()`. + * + * @private + */ +declare class GPURenderPassDescriptor { + /** + * The label of the render pass. + * + * @type {string} + */ + label: string; + /** + * The color attachments of the render pass. + * + * @type {Array} + */ + colorAttachments: Array; + /** + * The depth-stencil attachment of the render pass. + * + * @type {Object|undefined} + */ + depthStencilAttachment: Object | undefined; + /** + * The query set used for occlusion queries during the pass. + * + * @type {?GPUQuerySet|undefined} + */ + occlusionQuerySet: (GPUQuerySet | undefined) | null; + /** + * Defines which timestamp values are written and where. + * + * @type {Object|undefined} + */ + timestampWrites: Object | undefined; + /** + * The maximum number of draw calls that can be issued during the pass. + * + * @type {number} + * @default 50000000 + */ + maxDrawCount: number; + /** + * Resets the descriptor to its default state. The internal `colorAttachments` + * array is emptied without releasing its backing storage. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts new file mode 100644 index 000000000..f7199f492 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts @@ -0,0 +1,33 @@ +export default GPURenderPassTimestampWrites; +/** + * Reusable descriptor for `GPURenderPassTimestampWrites`, the + * `timestampWrites` field of `GPURenderPassDescriptor`. The same shape is + * also accepted as `GPUComputePassTimestampWrites`. + * + * @private + */ +declare class GPURenderPassTimestampWrites { + /** + * The query set the timestamps are written to. + * + * @type {?GPUQuerySet} + * @default null + */ + querySet: GPUQuerySet | null; + /** + * The index in the query set the beginning timestamp is written to. + * + * @type {number|undefined} + */ + beginningOfPassWriteIndex: number | undefined; + /** + * The index in the query set the ending timestamp is written to. + * + * @type {number|undefined} + */ + endOfPassWriteIndex: number | undefined; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts new file mode 100644 index 000000000..e7139e818 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts @@ -0,0 +1,90 @@ +export default GPURenderPipelineDescriptor; +/** + * Reusable descriptor for `GPUDevice.createRenderPipeline()` and + * `createRenderPipelineAsync()`. + * + * @private + */ +declare class GPURenderPipelineDescriptor { + /** + * The label of the render pipeline. + * + * @type {string} + */ + label: string; + /** + * The pipeline layout the pipeline conforms to, or `'auto'`. + * + * @type {?GPUPipelineLayout|string} + * @default null + */ + layout: (GPUPipelineLayout | string) | null; + /** + * The programmable vertex stage. + * + * @type {?Object} + * @default null + */ + vertex: Object | null; + /** + * The primitive-assembly state. + * + * @type {Object} + */ + primitive: Object; + /** + * The depth/stencil state, omitted when the pipeline has no depth or stencil aspect. + * + * @type {Object|undefined} + */ + depthStencil: Object | undefined; + /** + * The multisample state. + * + * @type {GPUMultisampleState} + */ + multisample: GPUMultisampleState; + /** + * The programmable fragment stage. Omitted for vertex-only pipelines. + * + * @type {?Object} + * @default null + */ + fragment: Object | null; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} +/** + * Reusable nested state for `GPURenderPipelineDescriptor.multisample`. + * + * @private + */ +declare class GPUMultisampleState { + /** + * The number of samples per pixel. + * + * @type {number} + * @default 1 + */ + count: number; + /** + * A bitmask determining which samples are written to. + * + * @type {number} + * @default 0xFFFFFFFF + */ + mask: number; + /** + * Whether a fragment's alpha channel is used to generate a sample coverage mask. + * + * @type {boolean} + * @default false + */ + alphaToCoverageEnabled: boolean; + /** + * Resets the state to its default values. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts new file mode 100644 index 000000000..a3b28563b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts @@ -0,0 +1,87 @@ +export default GPUSamplerDescriptor; +/** + * Reusable descriptor for `GPUDevice.createSampler()`. + * + * @private + */ +declare class GPUSamplerDescriptor { + /** + * The label of the sampler. + * + * @type {string} + */ + label: string; + /** + * The address mode for the sampler's U coordinate. + * + * @type {string} + * @default 'clamp-to-edge' + */ + addressModeU: string; + /** + * The address mode for the sampler's V coordinate. + * + * @type {string} + * @default 'clamp-to-edge' + */ + addressModeV: string; + /** + * The address mode for the sampler's W coordinate. + * + * @type {string} + * @default 'clamp-to-edge' + */ + addressModeW: string; + /** + * The magnification filter mode. + * + * @type {string} + * @default 'nearest' + */ + magFilter: string; + /** + * The minification filter mode. + * + * @type {string} + * @default 'nearest' + */ + minFilter: string; + /** + * The mipmap filter mode. + * + * @type {string} + * @default 'nearest' + */ + mipmapFilter: string; + /** + * The minimum level of detail used to sample. + * + * @type {number} + * @default 0 + */ + lodMinClamp: number; + /** + * The maximum level of detail used to sample. + * + * @type {number} + * @default 32 + */ + lodMaxClamp: number; + /** + * The compare function used by the sampler. + * + * @type {string|undefined} + */ + compare: string | undefined; + /** + * The maximum allowed anisotropic filtering. + * + * @type {number} + * @default 1 + */ + maxAnisotropy: number; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts new file mode 100644 index 000000000..25b481010 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts @@ -0,0 +1,30 @@ +export default GPUShaderModuleDescriptor; +/** + * Reusable descriptor for `GPUDevice.createShaderModule()`. + * + * @private + */ +declare class GPUShaderModuleDescriptor { + /** + * The label of the shader module. + * + * @type {string} + */ + label: string; + /** + * The WGSL source code of the shader module. + * + * @type {string} + */ + code: string; + /** + * Compilation hints that may help the implementation produce optimized code. + * + * @type {Array} + */ + compilationHints: Array; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts new file mode 100644 index 000000000..8e7a5e2aa --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts @@ -0,0 +1,39 @@ +export default GPUTexelCopyBufferInfo; +/** + * Reusable descriptor for `GPUTexelCopyBufferInfo`, the buffer side of + * `GPUCommandEncoder.copyTextureToBuffer()` and `copyBufferToTexture()`. + * + * @private + */ +declare class GPUTexelCopyBufferInfo { + /** + * The target buffer. + * + * @type {?GPUBuffer} + * @default null + */ + buffer: GPUBuffer | null; + /** + * The byte offset within the buffer where the texel data begins. + * + * @type {number} + * @default 0 + */ + offset: number; + /** + * The stride, in bytes, between rows of texel blocks. + * + * @type {number|undefined} + */ + bytesPerRow: number | undefined; + /** + * The number of texel block rows per single image of the texture. + * + * @type {number|undefined} + */ + rowsPerImage: number | undefined; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts new file mode 100644 index 000000000..a78ad019e --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts @@ -0,0 +1,32 @@ +export default GPUTexelCopyBufferLayout; +/** + * Reusable descriptor for `GPUTexelCopyBufferLayout`, the data-layout argument + * to `GPUQueue.writeTexture()`. + * + * @private + */ +declare class GPUTexelCopyBufferLayout { + /** + * The byte offset within the source data where the texel data begins. + * + * @type {number} + * @default 0 + */ + offset: number; + /** + * The stride, in bytes, between rows of texel blocks. + * + * @type {number|undefined} + */ + bytesPerRow: number | undefined; + /** + * The number of texel block rows per single image of the texture. + * + * @type {number|undefined} + */ + rowsPerImage: number | undefined; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts new file mode 100644 index 000000000..b57669f02 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts @@ -0,0 +1,45 @@ +export default GPUTexelCopyTextureInfo; +/** + * Reusable descriptor for `GPUTexelCopyTextureInfo`, the texture side of + * `GPUCommandEncoder.copyTextureToTexture()`, `copyTextureToBuffer()` and + * `GPUQueue.writeTexture()`. + * + * @private + */ +declare class GPUTexelCopyTextureInfo { + /** + * The target texture. + * + * @type {?GPUTexture} + * @default null + */ + texture: GPUTexture | null; + /** + * The mipmap level of the texture. + * + * @type {number} + * @default 0 + */ + mipLevel: number; + /** + * The origin offset within the texture. + * + * @type {{x: number, y: number, z: number}} + */ + origin: { + x: number; + y: number; + z: number; + }; + /** + * Which aspect of the texture is referenced. + * + * @type {string} + * @default 'all' + */ + aspect: string; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts new file mode 100644 index 000000000..a9507b721 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts @@ -0,0 +1,73 @@ +export default GPUTextureDescriptor; +/** + * Reusable descriptor for `GPUDevice.createTexture()`. + * + * @private + */ +declare class GPUTextureDescriptor { + /** + * The label of the texture. + * + * @type {string} + */ + label: string; + /** + * The size of the texture. + * + * @type {{width: number, height: number, depthOrArrayLayers: number}} + */ + size: { + width: number; + height: number; + depthOrArrayLayers: number; + }; + /** + * The number of mip levels the texture will contain. + * + * @type {number} + * @default 1 + */ + mipLevelCount: number; + /** + * The sample count of the texture. + * + * @type {number} + * @default 1 + */ + sampleCount: number; + /** + * The dimension of the set of texel coordinates. + * + * @type {string} + * @default '2d' + */ + dimension: string; + /** + * The format of the texture. + * + * @type {string|undefined} + */ + format: string | undefined; + /** + * The allowed usages for the texture. + * + * @type {number|undefined} + */ + usage: number | undefined; + /** + * The formats that views of this texture may use. + * + * @type {Array} + */ + viewFormats: Array; + /** + * The view dimension to use when binding the texture (compatibility mode). + * + * @type {string|undefined} + */ + textureBindingViewDimension: string | undefined; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts new file mode 100644 index 000000000..a70410284 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts @@ -0,0 +1,78 @@ +export default GPUTextureViewDescriptor; +/** + * Reusable descriptor for `GPUTexture.createView()`. + * + * @private + */ +declare class GPUTextureViewDescriptor { + /** + * The label of the texture view. + * + * @type {string} + */ + label: string; + /** + * The format of the texture view. + * + * @type {string|undefined} + */ + format: string | undefined; + /** + * The dimension of the texture view. + * + * @type {string|undefined} + */ + dimension: string | undefined; + /** + * The allowed usages for the texture view. + * + * @type {number} + * @default 0 + */ + usage: number; + /** + * Which aspect of the texture is referenced. + * + * @type {string} + * @default 'all' + */ + aspect: string; + /** + * The first mip level accessible to the texture view. + * + * @type {number} + * @default 0 + */ + baseMipLevel: number; + /** + * The number of mip levels accessible to the texture view. + * + * @type {number|undefined} + */ + mipLevelCount: number | undefined; + /** + * The first array layer accessible to the texture view. + * + * @type {number} + * @default 0 + */ + baseArrayLayer: number; + /** + * The number of array layers accessible to the texture view. + * + * @type {number|undefined} + */ + arrayLayerCount: number | undefined; + /** + * The component swizzle to apply when sampling the texture view. + * Requires the `'texture-component-swizzle'` feature; ignored otherwise. + * + * @type {string} + * @default 'rgba' + */ + swizzle: string; + /** + * Resets the descriptor to its default state. + */ + reset(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts new file mode 100644 index 000000000..f6f699f14 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts @@ -0,0 +1,11 @@ +export default BasicNodeLibrary; +/** + * This version of a node library represents a basic version + * just focusing on lights and tone mapping techniques. + * + * @private + * @augments NodeLibrary + */ +declare class BasicNodeLibrary extends NodeLibrary { +} +import NodeLibrary from '../../common/nodes/NodeLibrary.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts new file mode 100644 index 000000000..ee01cd7e7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts @@ -0,0 +1,11 @@ +export default StandardNodeLibrary; +/** + * This version of a node library represents the standard version + * used in {@link WebGPURenderer}. It maps lights, tone mapping + * techniques and materials to node-based implementations. + * + * @augments NodeLibrary + */ +declare class StandardNodeLibrary extends NodeLibrary { +} +import NodeLibrary from '../../common/nodes/NodeLibrary.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts new file mode 100644 index 000000000..26127eaa9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts @@ -0,0 +1,648 @@ +export default WGSLNodeBuilder; +/** + * A node builder targeting WGSL. + * + * This module generates WGSL shader code from node materials and also + * generates the respective bindings and vertex buffer definitions. These + * data are later used by the renderer to create render and compute pipelines + * for render objects. + * + * @augments NodeBuilder + */ +declare class WGSLNodeBuilder extends NodeBuilder { + /** + * Constructs a new WGSL node builder renderer. + * + * @param {Object3D} object - The 3D object. + * @param {Renderer} renderer - The renderer. + */ + constructor(object: Object3D, renderer: Renderer); + /** + * A dictionary that holds for each shader stage ('vertex', 'fragment', 'compute') + * another dictionary which manages UBOs per group ('render','frame','object'). + * + * @type {Object>} + */ + uniformGroups: { + [x: string]: { + [x: string]: NodeUniformsGroup; + }; + }; + /** + * A dictionary that holds the assigned binding indices for each uniform group. + * This ensures the same binding index is used across all shader stages. + * + * @type {Object} + */ + uniformGroupsBindings: { + [x: string]: { + index: number; + id: number; + }; + }; + /** + * A dictionary that holds for each shader stage a Map of builtins. + * + * @type {Object>} + */ + builtins: { + [x: string]: Map; + }; + /** + * A dictionary that holds for each shader stage a Set of directives. + * + * @type {Object>} + */ + directives: { + [x: string]: Set; + }; + /** + * A map for managing scope arrays. Only relevant for when using + * {@link WorkgroupInfoNode} in context of compute shaders. + * + * @type {Map} + */ + scopedArrays: Map; + /** + * A flag that indicates that early returns are allowed. + * + * @type {boolean} + * @default true + */ + allowEarlyReturns: boolean; + /** + * A flag that indicates that global variables are allowed. + * + * @type {boolean} + * @default true + */ + allowGlobalVariables: boolean; + /** + * Generates the WGSL snippet for sampled textures. + * + * @private + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + private _generateTextureSample; + /** + * Generates the WGSL snippet when sampling textures with explicit mip level. + * + * @private + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + private generateTextureSampleLevel; + /** + * Generates a wrap function used in context of textures. + * + * @param {Texture} texture - The texture to generate the function for. + * @return {string} The name of the generated function. + */ + generateWrapFunction(texture: Texture): string; + /** + * Generates a WGSL variable that holds the texture dimension of the given texture. + * It also returns information about the number of layers (elements) of an arrayed + * texture as well as the cube face count of cube textures. + * + * @param {Texture} texture - The texture to generate the function for. + * @param {string} textureProperty - The name of the video texture uniform in the shader. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @return {string} The name of the dimension variable. + */ + generateTextureDimension(texture: Texture, textureProperty: string, levelSnippet: string): string; + /** + * Generates the WGSL snippet that resolves the dimensions of the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level. + * @return {string} The WGSL snippet. + */ + generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; + /** + * Generates the WGSL snippet for a manual filtered texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @return {string} The WGSL snippet. + */ + generateFilteredTexture(texture: Texture, textureProperty: string, uvSnippet: string, offsetSnippet: string | null, levelSnippet?: string, depthSnippet: string | null): string; + /** + * Generates the WGSL snippet for a texture lookup with explicit level-of-detail. + * Since it's a lookup, no sampling or filtering is applied. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @return {string} The WGSL snippet. + */ + generateTextureLod(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, levelSnippet?: string): string; + /** + * Generates the WGSL snippet that reads a single texel from a storage texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateStorageTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet that writes a single texel to a texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {string} valueSnippet - A WGSL snippet that represent the new texel value. + * @return {string} The WGSL snippet. + */ + generateTextureStore(texture: Texture, textureProperty: string, uvIndexSnippet: string, depthSnippet: string | null, valueSnippet: string): string; + /** + * Returns `true` if the sampled values of the given texture should be compared against a reference value. + * + * @param {Texture} texture - The texture. + * @return {boolean} Whether the sampled values of the given texture should be compared against a reference value or not. + */ + isSampleCompare(texture: Texture): boolean; + /** + * Returns `true` if the given texture is unfilterable. + * + * @param {Texture} texture - The texture. + * @return {boolean} Whether the given texture is unfilterable or not. + */ + isUnfilterable(texture: Texture): boolean; + /** + * Generates the WGSL snippet for sampling/loading the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the WGSL snippet for sampling/loading the given texture using explicit gradients. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {Array} gradSnippet - An array holding both gradient WGSL snippets. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values + * against a reference value. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A WGSL snippet that represents the reference value. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Generates the WGSL snippet for gathering four texels from the given texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} gatherSnippet - A WGSL snippet that represents the index of the channel to read. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet for performing a depth comparison on four texels in the given depth texture. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} compareSnippet - A WGSL snippet that represents the reference value. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet when sampling textures with explicit mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @return {string} The WGSL snippet. + */ + generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; + /** + * Generates the WGSL snippet when sampling textures with a bias to the mip level. + * + * @param {Texture} texture - The texture. + * @param {string} textureProperty - The name of the texture uniform in the shader. + * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. + * @param {string} biasSnippet - A WGSL snippet that represents the bias to apply to the mip level before sampling. + * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. + * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The WGSL snippet. + */ + generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; + /** + * Returns a WGSL snippet that represents the property name of the given node. + * + * @param {Node} node - The node. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The property name. + */ + getPropertyName(node: Node, shaderStage?: string): string; + /** + * Returns whether the given name is a reserved keyword of WGSL. + * + * @param {string} name - The name to test. + * @return {boolean} Whether the name is a reserved keyword or not. + */ + isReservedKeyword(name: string): boolean; + /** + * Returns the native shader operator name for a given generic name. + * + * @param {string} op - The operator name to resolve. + * @return {?string} The resolved operator name. + */ + getFunctionOperator(op: string): string | null; + /** + * Returns the node access for the given node and shader stage. + * + * @param {StorageTextureNode|StorageBufferNode} node - The storage node. + * @param {string} shaderStage - The shader stage. + * @return {string} The node access. + */ + getNodeAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; + /** + * Returns A WGSL snippet representing the storage access. + * + * @param {StorageTextureNode|StorageBufferNode} node - The storage node. + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet representing the storage access. + */ + getStorageAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; + /** + * This method is one of the more important ones since it's responsible + * for generating a matching binding instance for the given uniform node. + * + * These bindings are later used in the renderer to create bind groups + * and layouts. + * + * @param {UniformNode} node - The uniform node. + * @param {string} type - The node data type. + * @param {string} shaderStage - The shader stage. + * @param {?string} [name=null] - An optional uniform name. + * @return {NodeUniform} The node uniform object. + */ + getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; + /** + * This method should be used whenever builtins are required in nodes. + * The internal builtins data structure will make sure builtins are + * defined in the WGSL source. + * + * @param {string} name - The builtin name. + * @param {string} property - The property name. + * @param {string} type - The node data type. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {string} The property name. + */ + getBuiltin(name: string, property: string, type: string, shaderStage?: string): string; + /** + * Returns `true` if the given builtin is defined in the given shader stage. + * + * @param {string} name - The builtin name. + * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. + * @return {boolean} Whether the given builtin is defined in the given shader stage or not. + */ + hasBuiltin(name: string, shaderStage?: string): boolean; + /** + * Builds the given shader node. + * + * @param {ShaderNodeInternal} shaderNode - The shader node. + * @return {string} The WGSL function code. + */ + buildFunctionCode(shaderNode: ShaderNodeInternal): string; + /** + * Returns a builtin representing the index of a compute invocation within the scope of a workgroup load. + * + * @return {string} The invocation local index. + */ + getInvocationLocalIndex(): string; + /** + * Returns a builtin representing the size of a subgroup within the current shader. + * + * @return {string} The subgroup size. + */ + getSubgroupSize(): string; + /** + * Returns a builtin representing the index of a compute invocation within the scope of a subgroup. + * + * @return {string} The invocation subgroup index. + */ + getInvocationSubgroupIndex(): string; + /** + * Returns a builtin representing the index of a compute invocation's subgroup within its workgroup. + * + * @return {string} The subgroup index. + */ + getSubgroupIndex(): string; + /** + * Overwritten as a NOP since this method is intended for the WebGL 2 backend. + * + * @return {null} Null. + */ + getDrawIndex(): null; + /** + * Returns the frag depth builtin. + * + * @return {string} The frag depth builtin. + */ + getFragDepth(): string; + /** + * Returns the clip distances builtin. + * + * @return {string} The clip distances builtin. + */ + getClipDistance(): string; + /** + * Enables the given directive for the given shader stage. + * + * @param {string} name - The directive name. + * @param {string} [shaderStage=this.shaderStage] - The shader stage to enable the directive for. + */ + enableDirective(name: string, shaderStage?: string): void; + /** + * Returns the directives of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} A WGSL snippet that enables the directives of the given stage. + */ + getDirectives(shaderStage: string): string; + /** + * Enables the 'subgroups' directive. + */ + enableSubGroups(): void; + /** + * Enables the 'subgroups-f16' directive. + */ + enableSubgroupsF16(): void; + /** + * Enables the 'clip_distances' directive. + */ + enableClipDistances(): void; + /** + * Enables the 'f16' directive. + */ + enableShaderF16(): void; + /** + * Enables the 'dual_source_blending' directive. + */ + enableDualSourceBlending(): void; + /** + * Enables hardware clipping. + * + * @param {string} planeCount - The clipping plane count. + */ + enableHardwareClipping(planeCount: string): void; + /** + * Returns the builtins of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} A WGSL snippet that represents the builtins of the given stage. + */ + getBuiltins(shaderStage: string): string; + /** + * This method should be used when a new scoped buffer is used in context of + * compute shaders. It adds the array to the internal data structure which is + * later used to generate the respective WGSL. + * + * @param {string} name - The array name. + * @param {string} scope - The scope. + * @param {string} bufferType - The buffer type. + * @param {string} bufferCount - The buffer count. + * @return {string} The array name. + */ + getScopedArray(name: string, scope: string, bufferType: string, bufferCount: string): string; + /** + * Returns the scoped arrays of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string|undefined} The WGSL snippet that defines the scoped arrays. + * Returns `undefined` when used in the vertex or fragment stage. + */ + getScopedArrays(shaderStage: string): string | undefined; + /** + * Returns the shader attributes of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the shader attributes. + */ + getAttributes(shaderStage: string): string; + /** + * Returns the members of the given struct type node as a WGSL string. + * + * @param {StructTypeNode} struct - The struct type node. + * @return {string} The WGSL snippet that defines the struct members. + */ + getStructMembers(struct: StructTypeNode): string; + /** + * Returns the structs of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the structs. + */ + getStructs(shaderStage: string): string; + /** + * Returns a WGSL string representing a variable. + * + * @param {string} type - The variable's type. + * @param {string} name - The variable's name. + * @param {?number} [count=null] - The array length. + * @param {string} [qualifier=''] - The variable's qualifier. + * @return {string} The WGSL snippet that defines a variable. + */ + getVar(type: string, name: string, count?: number | null, qualifier?: string): string; + /** + * Returns the variables of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the variables. + */ + getVars(shaderStage: string, global?: boolean): string; + /** + * Returns the varyings of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the varyings. + */ + getVaryings(shaderStage: string): string; + isCustomStruct(nodeUniform: any): any; + /** + * Returns the uniforms of the given shader stage as a WGSL string. + * + * @param {string} shaderStage - The shader stage. + * @return {string} The WGSL snippet that defines the uniforms. + */ + getUniforms(shaderStage: string): string; + /** + * Returns the native shader method name for a given generic name. + * + * @param {string} method - The method name to resolve. + * @param {?string} [output=null] - An optional output. + * @return {string} The resolved WGSL method name. + */ + getMethod(method: string, output?: string | null): string; + /** + * Returns the bitcast method name for a given input and outputType. + * + * @param {string} type - The output type to bitcast to. + * @return {string} The resolved WGSL bitcast invocation. + */ + getBitcastMethod(type: string): string; + /** + * Returns the float packing method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolve WGSL float packing method name. + */ + getFloatPackingMethod(encoding: string, layout?: string): string; + /** + * Returns the float unpacking method name for a given numeric encoding. + * + * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. + * @param {string} [layout='2x16'] - The component layout of the packed integer. + * @returns {string} The resolve WGSL float unpacking method name. + */ + getFloatUnpackingMethod(encoding: string, layout?: string): string; + /** + * Returns the native snippet for a ternary operation. + * + * @param {string} condSnippet - The condition determining which expression gets resolved. + * @param {string} ifSnippet - The expression to resolve to if the condition is true. + * @param {string} elseSnippet - The expression to resolve to if the condition is false. + * @return {string} The resolved method name. + */ + getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; + /** + * Whether the requested feature is available or not. + * + * @param {string} name - The requested feature. + * @return {boolean} Whether the requested feature is supported or not. + */ + isAvailable(name: string): boolean; + /** + * Returns the native shader method name for a given generic name. + * + * @private + * @param {string} method - The method name to resolve. + * @return {string} The resolved WGSL method name. + */ + private _getWGSLMethod; + /** + * Includes the given method name into the current + * function node. + * + * @private + * @param {string} name - The method name to include. + * @return {CodeNode} The respective code node. + */ + private _include; + /** + * Returns a WGSL vertex shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getWGSLVertexCode; + /** + * Returns a WGSL fragment shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @return {string} The vertex shader. + */ + private _getWGSLFragmentCode; + /** + * Returns a WGSL compute shader based on the given shader data. + * + * @private + * @param {Object} shaderData - The shader data. + * @param {string} workgroupSize - The workgroup size. + * @return {string} The vertex shader. + */ + private _getWGSLComputeCode; + /** + * Returns a WGSL struct based on the given name and variables. + * + * @private + * @param {string} name - The struct name. + * @param {string} vars - The struct variables. + * @return {string} The WGSL snippet representing a struct. + */ + private _getWGSLStruct; + /** + * Returns a WGSL struct binding. + * + * @private + * @param {string} name - The struct name. + * @param {string} vars - The struct variables. + * @param {string} access - The access. + * @param {number} [binding=0] - The binding index. + * @param {number} [group=0] - The group index. + * @return {string} The WGSL snippet representing a struct binding. + */ + private _getWGSLStructBinding; +} +import { NodeBuilder } from '../../../nodes/Nodes.js'; +import NodeUniformsGroup from '../../common/nodes/NodeUniformsGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts new file mode 100644 index 000000000..3cbe9f2f5 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts @@ -0,0 +1,25 @@ +export default WGSLNodeFunction; +/** + * This class represents a WSL node function. + * + * @augments NodeFunction + */ +declare class WGSLNodeFunction extends NodeFunction { + /** + * Constructs a new WGSL node function. + * + * @param {string} source - The WGSL source. + */ + constructor(source: string); + inputsCode: any; + blockCode: any; + outputType: any; + /** + * This method returns the WGSL code of the node function. + * + * @param {string} [name=this.name] - The function's name. + * @return {string} The shader code. + */ + getCode(name?: string): string; +} +import NodeFunction from '../../../nodes/core/NodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts new file mode 100644 index 000000000..58ab25284 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts @@ -0,0 +1,17 @@ +export default WGSLNodeParser; +/** + * A WGSL node parser. + * + * @augments NodeParser + */ +declare class WGSLNodeParser extends NodeParser { + /** + * The method parses the given WGSL code an returns a node function. + * + * @param {string} source - The WGSL code. + * @return {WGSLNodeFunction} A node function. + */ + parseFunction(source: string): WGSLNodeFunction; +} +import NodeParser from '../../../nodes/core/NodeParser.js'; +import WGSLNodeFunction from './WGSLNodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts new file mode 100644 index 000000000..6f286dacf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts @@ -0,0 +1,78 @@ +export default WebGPUAttributeUtils; +/** + * A WebGPU backend utility module for managing shader attributes. + * + * @private + */ +declare class WebGPUAttributeUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Creates the GPU buffer for the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + * @param {GPUBufferUsage} usage - A flag that indicates how the buffer may be used after its creation. + */ + createAttribute(attribute: BufferAttribute, usage: GPUBufferUsage): void; + /** + * Updates the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + updateAttribute(attribute: BufferAttribute): void; + /** + * This method creates the vertex buffer layout data which are + * require when creating a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @return {Array} An array holding objects which describe the vertex buffer layout. + */ + createShaderVertexBuffers(renderObject: RenderObject): Array; + /** + * Destroys the GPU buffer of the given buffer attribute. + * + * @param {BufferAttribute} attribute - The buffer attribute. + */ + destroyAttribute(attribute: BufferAttribute): void; + /** + * This method performs a readback operation by moving buffer data from + * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can + * be used to retain and reuse handles to the intermediate buffers and prevent + * new allocation. + * + * @async + * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. + * @param {number} count - The offset from which to start reading the + * @param {number} offset - The storage buffer attribute. + * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. + * @return {Promise} A promise that resolves with the buffer data when the data are ready. + */ + getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; + /** + * Returns the vertex format of the given buffer attribute. + * + * @private + * @param {BufferAttribute} geometryAttribute - The buffer attribute. + * @return {string|undefined} The vertex format (e.g. 'float32x3'). + */ + private _getVertexFormat; + /** + * Utility method for handling interleaved buffer attributes correctly. + * To process them, their `InterleavedBuffer` is returned. + * + * @private + * @param {BufferAttribute} attribute - The attribute. + * @return {BufferAttribute|InterleavedBuffer} + */ + private _getBufferAttribute; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts new file mode 100644 index 000000000..ebe8cf500 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts @@ -0,0 +1,88 @@ +export default WebGPUBindingUtils; +/** + * A WebGPU backend utility module for managing bindings. + * + * When reading the documentation it's helpful to keep in mind that + * all class definitions starting with 'GPU*' are modules from the + * WebGPU API. So for example `BindGroup` is a class from the engine + * whereas `GPUBindGroup` is a class from WebGPU. + * + * @private + */ +declare class WebGPUBindingUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * A cache that maps combinations of layout entries to existing bind group layouts. + * + * @private + * @type {Map} + */ + private _bindGroupLayoutCache; + /** + * Creates a GPU bind group layout for the given bind group. + * + * @param {BindGroup} bindGroup - The bind group. + * @return {GPUBindGroupLayout} The GPU bind group layout. + */ + createBindingsLayout(bindGroup: BindGroup): GPUBindGroupLayout; + /** + * Creates bindings from the given bind group definition. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {Array} bindings - Array of bind groups. + * @param {string} cacheKey - The cache key. + * @param {number} version - The version. + */ + createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version?: number): void; + /** + * Updates a buffer binding. + * + * @param {Buffer} binding - The buffer binding to update. + */ + updateBinding(binding: Buffer): void; + /** + * Creates a GPU bind group for the camera index. + * + * @param {Uint32Array} data - The index data. + * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. + * @return {GPUBindGroup} The GPU bind group. + */ + createBindGroupIndex(data: Uint32Array, layoutGPU: GPUBindGroupLayout): GPUBindGroup; + /** + * Creates a GPU bind group for the given bind group and GPU layout. + * + * @param {BindGroup} bindGroup - The bind group. + * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. + * @return {GPUBindGroup} The GPU bind group. + */ + createBindGroup(bindGroup: BindGroup, layoutGPU: GPUBindGroupLayout): GPUBindGroup; + /** + * Creates a GPU bind group layout entries for the given bind group. + * + * @private + * @param {BindGroup} bindGroup - The bind group. + * @return {Array} The GPU bind group layout entries. + */ + private _createLayoutEntries; + /** + * Delete the data associated with a bind group. + * + * @param {BindGroup} bindGroup - The bind group. + */ + deleteBindGroupData(bindGroup: BindGroup): void; + /** + * Frees internal resources. + */ + dispose(): void; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts new file mode 100644 index 000000000..c56d99d65 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts @@ -0,0 +1,32 @@ +export default WebGPUCapabilities; +/** + * A WebGPU backend utility module for managing the device's capabilities. + * + * @private + */ +declare class WebGPUCapabilities { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Returns the maximum anisotropy texture filtering value. + * + * @return {number} The maximum anisotropy texture filtering value. + */ + getMaxAnisotropy(): number; + /** + * Returns the maximum number of bytes available for uniform buffers. + * + * @return {number} The maximum number of bytes available for uniform buffers. + */ + getUniformBufferLimit(): number; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts new file mode 100644 index 000000000..b8fc49536 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts @@ -0,0 +1,301 @@ +export namespace GPUPrimitiveTopology { + let PointList: string; + let LineList: string; + let LineStrip: string; + let TriangleList: string; + let TriangleStrip: string; +} +export const GPUShaderStage: any; +export namespace GPUCompareFunction { + let Never: string; + let Less: string; + let Equal: string; + let LessEqual: string; + let Greater: string; + let NotEqual: string; + let GreaterEqual: string; + let Always: string; +} +export namespace GPUStoreOp { + let Store: string; + let Discard: string; +} +export namespace GPULoadOp { + let Load: string; + let Clear: string; +} +export namespace GPUFrontFace { + let CCW: string; + let CW: string; +} +export namespace GPUCullMode { + let None: string; + let Front: string; + let Back: string; +} +export namespace GPUIndexFormat { + let Uint16: string; + let Uint32: string; +} +export namespace GPUVertexFormat { + export let Uint8x2: string; + export let Uint8x4: string; + export let Sint8x2: string; + export let Sint8x4: string; + export let Unorm8x2: string; + export let Unorm8x4: string; + export let Snorm8x2: string; + export let Snorm8x4: string; + export let Uint16x2: string; + export let Uint16x4: string; + export let Sint16x2: string; + export let Sint16x4: string; + export let Unorm16x2: string; + export let Unorm16x4: string; + export let Snorm16x2: string; + export let Snorm16x4: string; + export let Float16x2: string; + export let Float16x4: string; + export let Float32: string; + export let Float32x2: string; + export let Float32x3: string; + export let Float32x4: string; + let Uint32_1: string; + export { Uint32_1 as Uint32 }; + export let Uint32x2: string; + export let Uint32x3: string; + export let Uint32x4: string; + export let Sint32: string; + export let Sint32x2: string; + export let Sint32x3: string; + export let Sint32x4: string; +} +export namespace GPUTextureFormat { + let R8Unorm: string; + let R8Snorm: string; + let R8Uint: string; + let R8Sint: string; + let R16Uint: string; + let R16Sint: string; + let R16Float: string; + let RG8Unorm: string; + let RG8Snorm: string; + let RG8Uint: string; + let RG8Sint: string; + let R16Unorm: string; + let R16Snorm: string; + let R32Uint: string; + let R32Sint: string; + let R32Float: string; + let RG16Uint: string; + let RG16Sint: string; + let RG16Float: string; + let RGBA8Unorm: string; + let RGBA8UnormSRGB: string; + let RGBA8Snorm: string; + let RGBA8Uint: string; + let RGBA8Sint: string; + let BGRA8Unorm: string; + let BGRA8UnormSRGB: string; + let RG16Unorm: string; + let RG16Snorm: string; + let RGB9E5UFloat: string; + let RGB10A2Unorm: string; + let RG11B10UFloat: string; + let RG32Uint: string; + let RG32Sint: string; + let RG32Float: string; + let RGBA16Uint: string; + let RGBA16Sint: string; + let RGBA16Float: string; + let RGBA16Unorm: string; + let RGBA16Snorm: string; + let RGBA32Uint: string; + let RGBA32Sint: string; + let RGBA32Float: string; + let Stencil8: string; + let Depth16Unorm: string; + let Depth24Plus: string; + let Depth24PlusStencil8: string; + let Depth32Float: string; + let Depth32FloatStencil8: string; + let BC1RGBAUnorm: string; + let BC1RGBAUnormSRGB: string; + let BC2RGBAUnorm: string; + let BC2RGBAUnormSRGB: string; + let BC3RGBAUnorm: string; + let BC3RGBAUnormSRGB: string; + let BC4RUnorm: string; + let BC4RSnorm: string; + let BC5RGUnorm: string; + let BC5RGSnorm: string; + let BC6HRGBUFloat: string; + let BC6HRGBFloat: string; + let BC7RGBAUnorm: string; + let BC7RGBAUnormSRGB: string; + let ETC2RGB8Unorm: string; + let ETC2RGB8UnormSRGB: string; + let ETC2RGB8A1Unorm: string; + let ETC2RGB8A1UnormSRGB: string; + let ETC2RGBA8Unorm: string; + let ETC2RGBA8UnormSRGB: string; + let EACR11Unorm: string; + let EACR11Snorm: string; + let EACRG11Unorm: string; + let EACRG11Snorm: string; + let ASTC4x4Unorm: string; + let ASTC4x4UnormSRGB: string; + let ASTC5x4Unorm: string; + let ASTC5x4UnormSRGB: string; + let ASTC5x5Unorm: string; + let ASTC5x5UnormSRGB: string; + let ASTC6x5Unorm: string; + let ASTC6x5UnormSRGB: string; + let ASTC6x6Unorm: string; + let ASTC6x6UnormSRGB: string; + let ASTC8x5Unorm: string; + let ASTC8x5UnormSRGB: string; + let ASTC8x6Unorm: string; + let ASTC8x6UnormSRGB: string; + let ASTC8x8Unorm: string; + let ASTC8x8UnormSRGB: string; + let ASTC10x5Unorm: string; + let ASTC10x5UnormSRGB: string; + let ASTC10x6Unorm: string; + let ASTC10x6UnormSRGB: string; + let ASTC10x8Unorm: string; + let ASTC10x8UnormSRGB: string; + let ASTC10x10Unorm: string; + let ASTC10x10UnormSRGB: string; + let ASTC12x10Unorm: string; + let ASTC12x10UnormSRGB: string; + let ASTC12x12Unorm: string; + let ASTC12x12UnormSRGB: string; +} +export namespace GPUAddressMode { + let ClampToEdge: string; + let Repeat: string; + let MirrorRepeat: string; +} +export namespace GPUFilterMode { + let Linear: string; + let Nearest: string; +} +export namespace GPUBlendFactor { + let Zero: string; + let One: string; + let Src: string; + let OneMinusSrc: string; + let SrcAlpha: string; + let OneMinusSrcAlpha: string; + let Dst: string; + let OneMinusDst: string; + let DstAlpha: string; + let OneMinusDstAlpha: string; + let SrcAlphaSaturated: string; + let Constant: string; + let OneMinusConstant: string; +} +export namespace GPUBlendOperation { + let Add: string; + let Subtract: string; + let ReverseSubtract: string; + let Min: string; + let Max: string; +} +export namespace GPUColorWriteFlags { + let None_1: number; + export { None_1 as None }; + export let Red: number; + export let Green: number; + export let Blue: number; + export let Alpha: number; + export let All: number; +} +export namespace GPUStencilOperation { + export let Keep: string; + let Zero_1: string; + export { Zero_1 as Zero }; + export let Replace: string; + export let Invert: string; + export let IncrementClamp: string; + export let DecrementClamp: string; + export let IncrementWrap: string; + export let DecrementWrap: string; +} +export namespace GPUBufferBindingType { + let Uniform: string; + let Storage: string; + let ReadOnlyStorage: string; +} +export namespace GPUStorageTextureAccess { + let WriteOnly: string; + let ReadOnly: string; + let ReadWrite: string; +} +export namespace GPUSamplerBindingType { + let Filtering: string; + let NonFiltering: string; + let Comparison: string; +} +export namespace GPUTextureSampleType { + let Float: string; + let UnfilterableFloat: string; + let Depth: string; + let SInt: string; + let UInt: string; +} +export namespace GPUTextureDimension { + let OneD: string; + let TwoD: string; + let ThreeD: string; +} +export namespace GPUTextureViewDimension { + let OneD_1: string; + export { OneD_1 as OneD }; + let TwoD_1: string; + export { TwoD_1 as TwoD }; + export let TwoDArray: string; + export let Cube: string; + export let CubeArray: string; + let ThreeD_1: string; + export { ThreeD_1 as ThreeD }; +} +export namespace GPUTextureAspect { + let All_1: string; + export { All_1 as All }; + export let StencilOnly: string; + export let DepthOnly: string; +} +export namespace GPUInputStepMode { + let Vertex: string; + let Instance: string; +} +export namespace GPUFeatureName { + export let CoreFeaturesAndLimits: string; + export let DepthClipControl: string; + let Depth32FloatStencil8_1: string; + export { Depth32FloatStencil8_1 as Depth32FloatStencil8 }; + export let TextureCompressionBC: string; + export let TextureCompressionBCSliced3D: string; + export let TextureCompressionETC2: string; + export let TextureCompressionASTC: string; + export let TextureCompressionASTCSliced3D: string; + export let TimestampQuery: string; + export let IndirectFirstInstance: string; + export let ShaderF16: string; + let RG11B10UFloat_1: string; + export { RG11B10UFloat_1 as RG11B10UFloat }; + export let BGRA8UNormStorage: string; + export let Float32Filterable: string; + export let Float32Blendable: string; + export let ClipDistances: string; + export let DualSourceBlending: string; + export let Subgroups: string; + export let TextureFormatsTier1: string; + export let TextureFormatsTier2: string; +} +export const GPUFeatureMap: { + 'texture-compression-s3tc': string; + 'texture-compression-etc1': string; +}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts new file mode 100644 index 000000000..6e12e01ba --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts @@ -0,0 +1,130 @@ +export default WebGPUPipelineUtils; +/** + * A WebGPU backend utility module for managing pipelines. + * + * @private + */ +declare class WebGPUPipelineUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Returns the sample count derived from the given render context. + * + * @private + * @param {RenderContext} renderContext - The render context. + * @return {number} The sample count. + */ + private _getSampleCount; + /** + * Creates a render pipeline for the given render object. + * + * @param {RenderObject} renderObject - The render object. + * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. + */ + createRenderPipeline(renderObject: RenderObject, promises: Array>): void; + /** + * Creates GPU render bundle encoder for the given render context. + * + * @param {RenderContext} renderContext - The render context. + * @param {?string} [label='renderBundleEncoder'] - The label. + * @return {GPURenderBundleEncoder} The GPU render bundle encoder. + */ + createBundleEncoder(renderContext: RenderContext, label?: string | null): GPURenderBundleEncoder; + /** + * Creates a compute pipeline for the given compute node. + * + * @param {ComputePipeline} pipeline - The compute pipeline. + * @param {Array} bindings - The bindings. + * @param {?Array} [promises=null] - Optional compilation promises. + */ + createComputePipeline(pipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; + /** + * Reads line-accurate diagnostics from shader modules and logs them. + * Called from pipeline creation error paths to turn opaque validation + * failures into actionable WGSL feedback. + * + * @private + * @param {Array<{program: ProgrammableStage, module: GPUShaderModule}>} stages - Pairs of program + compiled shader module. + * @param {string} pipelineLabel - Label of the owning pipeline, used as log prefix. + * @return {Promise} + */ + private _reportShaderDiagnostics; + /** + * Returns the blending state as a descriptor object required + * for the pipeline creation. + * + * @private + * @param {Material|BlendMode} object - The object containing blending information. + * @return {Object} The blending state. + */ + private _getBlending; + /** + * Returns the GPU blend factor which is required for the pipeline creation. + * + * @private + * @param {number} blend - The blend factor as a three.js constant. + * @return {string} The GPU blend factor. + */ + private _getBlendFactor; + /** + * Returns the GPU stencil compare function which is required for the pipeline creation. + * + * @private + * @param {Material} material - The material. + * @return {string} The GPU stencil compare function. + */ + private _getStencilCompare; + /** + * Returns the GPU stencil operation which is required for the pipeline creation. + * + * @private + * @param {number} op - A three.js constant defining the stencil operation. + * @return {string} The GPU stencil operation. + */ + private _getStencilOperation; + /** + * Returns the GPU blend operation which is required for the pipeline creation. + * + * @private + * @param {number} blendEquation - A three.js constant defining the blend equation. + * @return {string} The GPU blend operation. + */ + private _getBlendOperation; + /** + * Returns the primitive state as a descriptor object required + * for the pipeline creation. + * + * @private + * @param {Object3D} object - The 3D object. + * @param {BufferGeometry} geometry - The geometry. + * @param {Material} material - The material. + * @return {Object} The primitive state. + */ + private _getPrimitiveState; + /** + * Returns the GPU color write mask which is required for the pipeline creation. + * + * @private + * @param {Material} material - The material. + * @return {number} The GPU color write mask. + */ + private _getColorWriteMask; + /** + * Returns the GPU depth compare function which is required for the pipeline creation. + * + * @private + * @param {Material} material - The material. + * @return {string} The GPU depth compare function. + */ + private _getDepthCompare; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts new file mode 100644 index 000000000..e2d05d692 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts @@ -0,0 +1,84 @@ +export default WebGPUTexturePassUtils; +/** + * A WebGPU backend utility module used by {@link WebGPUTextureUtils}. + * + * @private + */ +declare class WebGPUTexturePassUtils extends DataMap { + /** + * Constructs a new utility object. + * + * @param {GPUDevice} device - The WebGPU device. + */ + constructor(device: GPUDevice); + /** + * The WebGPU device. + * + * @type {GPUDevice} + */ + device: GPUDevice; + /** + * The mipmap GPU sampler. + * + * @type {GPUSampler} + */ + mipmapSampler: GPUSampler; + /** + * The flipY GPU sampler. + * + * @type {GPUSampler} + */ + flipYSampler: GPUSampler; + flipUniformBuffer: GPUBuffer; + noFlipUniformBuffer: GPUBuffer; + /** + * A cache for GPU render pipelines used for copy/transfer passes. + * Every texture format and textureBindingViewDimension combo requires a unique pipeline. + * + * @type {Object} + */ + transferPipelines: { + [x: string]: GPURenderPipeline; + }; + mipmapShaderModule: GPUShaderModule; + /** + * Returns a render pipeline for the internal copy render pass. The pass + * requires a unique render pipeline for each texture format. + * + * @param {string} format - The GPU texture format + * @param {string?} textureBindingViewDimension - The GPU texture binding view dimension + * @return {GPURenderPipeline} The GPU render pipeline. + */ + getTransferPipeline(format: string, textureBindingViewDimension: string | null): GPURenderPipeline; + /** + * Flip the contents of the given GPU texture along its vertical axis. + * + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {Object} textureGPUDescriptor - The texture descriptor. + * @param {number} [baseArrayLayer=0] - The index of the first array layer accessible to the texture view. + */ + flipY(textureGPU: GPUTexture, textureGPUDescriptor: Object, baseArrayLayer?: number): void; + /** + * Generates mipmaps for the given GPU texture. + * + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. + */ + generateMipmaps(textureGPU: GPUTexture, encoder?: GPUCommandEncoder | null): void; + /** + * Since multiple copy render passes are required to generate mipmaps, the passes + * are managed as render bundles to improve performance. + * + * @param {GPUTexture} textureGPU - The GPU texture object. + * @return {Array} An array of render bundles. + */ + _mipmapCreateBundles(textureGPU: GPUTexture): Array; + /** + * Executes the render bundles. + * + * @param {GPUCommandEncoder} commandEncoder - The GPU command encoder. + * @param {Array} passes - An array of render bundles. + */ + _mipmapRunBundles(commandEncoder: GPUCommandEncoder, passes: Array): void; +} +import DataMap from '../../common/DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts new file mode 100644 index 000000000..8ffa3ade9 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts @@ -0,0 +1,302 @@ +/** + * Returns the GPU format for the given texture. + * + * @param {Texture} texture - The texture. + * @param {GPUDevice} [device] - The GPU device which is used for feature detection. + * @return {string} The GPU format. + */ +export function getFormat(texture: Texture, device?: GPUDevice): string; +export default WebGPUTextureUtils; +import { Texture } from '../../../textures/Texture.js'; +/** + * A WebGPU backend utility module for managing textures. + * + * @private + */ +declare class WebGPUTextureUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * A reference to the pass utils. + * + * @type {?WebGPUTexturePassUtils} + * @default null + */ + _passUtils: WebGPUTexturePassUtils | null; + /** + * A dictionary for managing default textures. The key + * is the texture format, the value the texture object. + * + * @type {Object} + */ + defaultTexture: { + [x: string]: Texture; + }; + /** + * A dictionary for managing default cube textures. The key + * is the texture format, the value the texture object. + * + * @type {Object} + */ + defaultCubeTexture: { + [x: string]: CubeTexture; + }; + /** + * A default video frame. + * + * @type {?VideoFrame} + * @default null + */ + defaultVideoFrame: VideoFrame | null; + /** + * A cache of shared texture samplers. + * + * @type {Map} + */ + _samplerCache: Map; + /** + * Creates a GPU sampler for the given texture. + * + * @param {Sampler} binding - The sampler binding to update. + * @return {string} The current sampler key. + */ + updateSampler(binding: Sampler): string; + /** + * Frees the GPU sampler referenced by the given sampler binding. + * + * @param {Sampler} binding - The sampler binding to free. + */ + destroySampler(binding: Sampler): void; + /** + * Releases the pooled sampler referenced by the given binding data and + * removes it from the cache when no binding references it anymore. + * + * @private + * @param {Object} bindingData - The binding data holding the sampler reference. + */ + private _releaseSampler; + /** + * Creates a default texture for the given texture that can be used + * as a placeholder until the actual texture is ready for usage. + * + * @param {Texture} texture - The texture to create a default texture for. + */ + createDefaultTexture(texture: Texture): void; + /** + * Defines a texture on the GPU for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + createTexture(texture: Texture, options?: Object): void; + /** + * Destroys the GPU data for the given texture object. + * + * @param {Texture} texture - The texture. + * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. + */ + destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; + /** + * Generates mipmaps for the given texture. + * + * @param {Texture} texture - The texture. + * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. + */ + generateMipmaps(texture: Texture, encoder?: GPUCommandEncoder | null): void; + /** + * Returns the color buffer representing the color + * attachment of the default framebuffer. + * + * @return {GPUTexture} The color buffer. + */ + getColorBuffer(): GPUTexture; + /** + * Returns the depth buffer representing the depth + * attachment of the default framebuffer. + * + * @param {boolean} [depth=true] - Whether depth is enabled or not. + * @param {boolean} [stencil=false] - Whether stencil is enabled or not. + * @return {GPUTexture} The depth buffer. + */ + getDepthBuffer(depth?: boolean, stencil?: boolean): GPUTexture; + /** + * Uploads the updated texture data to the GPU. + * + * @param {Texture} texture - The texture. + * @param {Object} [options={}] - Optional configuration parameter. + */ + updateTexture(texture: Texture, options?: Object): void; + /** + * Returns texture data as a typed array. + * + * @async + * @param {Texture} texture - The texture to copy. + * @param {number} x - The x coordinate of the copy origin. + * @param {number} y - The y coordinate of the copy origin. + * @param {number} width - The width of the copy. + * @param {number} height - The height of the copy. + * @param {number} faceIndex - The cube face, depth slice or array layer index. + * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. + */ + copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; + /** + * Frees all internal resources. + */ + dispose(): void; + /** + * Returns the default GPU texture for the given format. + * + * @private + * @param {string} format - The GPU format. + * @return {GPUTexture} The GPU texture. + */ + private _getDefaultTextureGPU; + /** + * Returns the default GPU cube texture for the given format. + * + * @private + * @param {string} format - The GPU format. + * @return {GPUTexture} The GPU texture. + */ + private _getDefaultCubeTextureGPU; + /** + * Uploads cube texture image data to the GPU memory. + * + * @private + * @param {CubeTexture} texture - The cube texture. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + */ + private _copyCubeMapToTexture; + /** + * Uploads texture image data to the GPU memory. + * + * @private + * @param {HTMLImageElement|ImageBitmap|HTMLCanvasElement} image - The image data. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + * @param {number} originDepth - The origin depth. + * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. + * @param {boolean} premultiplyAlpha - Whether the texture should have its RGB channels premultiplied by the alpha channel or not. + * @param {number} [mipLevel=0] - The mip level where the data should be copied to. + */ + private _copyImageToTexture; + /** + * Returns the pass utils singleton. + * + * @private + * @return {WebGPUTexturePassUtils} The utils instance. + */ + private _getPassUtils; + /** + * Generates mipmaps for the given GPU texture. + * + * @private + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. + */ + private _generateMipmaps; + /** + * Flip the contents of the given GPU texture along its vertical axis. + * + * @private + * @param {GPUTexture} textureGPU - The GPU texture object. + * @param {Object} textureDescriptorGPU - The texture descriptor. + * @param {number} [originDepth=0] - The origin depth. + */ + private _flipY; + /** + * Uploads texture buffer data to the GPU memory. + * + * @private + * @param {Object} image - An object defining the image buffer data. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + * @param {number} originDepth - The origin depth. + * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. + * @param {number} [depth=0] - The depth offset when copying array or 3D texture data. + * @param {number} [mipLevel=0] - The mip level where the data should be copied to. + */ + private _copyBufferToTexture; + /** + * Uploads compressed texture data to the GPU memory. + * + * @private + * @param {Array} mipmaps - An array with mipmap data. + * @param {GPUTexture} textureGPU - The GPU texture. + * @param {Object} textureDescriptorGPU - The GPU texture descriptor. + * @param {?Set} [layerUpdates=null] - The layer indices to update. + */ + private _copyCompressedBufferToTexture; + /** + * This method is only relevant for compressed texture formats. It returns a block + * data descriptor for the given GPU compressed texture format. + * + * @private + * @param {string} format - The GPU compressed texture format. + * @return {Object} The block data descriptor. + */ + private _getBlockData; + /** + * Converts the three.js uv wrapping constants to GPU address mode constants. + * + * @private + * @param {number} value - The three.js constant defining a uv wrapping mode. + * @return {string} The GPU address mode. + */ + private _convertAddressMode; + /** + * Converts the three.js filter constants to GPU filter constants. + * + * @private + * @param {number} value - The three.js constant defining a filter mode. + * @return {string} The GPU filter mode. + */ + private _convertFilterMode; + /** + * Converts the three.js filter constants to a GPU mipmap filter constant. + * Unlike `_convertFilterMode`, this extracts the between-mip-level filtering + * axis from the combined three.js constant rather than the within-level axis. + * + * @private + * @param {number} value - The three.js constant defining a filter mode. + * @return {string} The GPU mipmap filter mode. + */ + private _convertMipmapFilterMode; + /** + * Returns the bytes-per-texel value for the given GPU texture format. + * + * @private + * @param {string} format - The GPU texture format. + * @return {number} The bytes-per-texel. + */ + private _getBytesPerTexel; + /** + * Returns the corresponding typed array type for the given GPU texture format. + * + * @private + * @param {string} format - The GPU texture format. + * @return {TypedArray.constructor} The typed array type. + */ + private _getTypedArrayType; + /** + * Returns the GPU dimensions for the given texture. + * + * @private + * @param {Texture} texture - The texture. + * @return {string} The GPU dimension. + */ + private _getDimension; +} +import WebGPUTexturePassUtils from './WebGPUTexturePassUtils.js'; +import { CubeTexture } from '../../../textures/CubeTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts new file mode 100644 index 000000000..dcc48eded --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts @@ -0,0 +1,53 @@ +export default WebGPUTimestampQueryPool; +/** + * Manages a pool of WebGPU timestamp queries for performance measurement. + * Extends the base TimestampQueryPool to provide WebGPU-specific implementation. + * + * @augments TimestampQueryPool + */ +declare class WebGPUTimestampQueryPool extends TimestampQueryPool { + /** + * Creates a new WebGPU timestamp query pool. + * + * @param {GPUDevice} device - The WebGPU device to create queries on. + * @param {string} type - The type identifier for this query pool. + * @param {number} [maxQueries=2048] - Maximum number of queries this pool can hold. + */ + constructor(device: GPUDevice, type: string, maxQueries?: number); + device: GPUDevice; + type: string; + querySet: GPUQuerySet; + resolveBuffer: GPUBuffer; + resultBuffer: GPUBuffer; + /** + * Allocates a pair of queries for a given render context. + * + * @param {string} uid - A unique identifier for the render context. + * @returns {?number} The base offset for the allocated queries, or null if allocation failed. + */ + allocateQueriesForContext(uid: string): number | null; + /** + * Asynchronously resolves all pending queries and returns the total duration. + * If there's already a pending resolve operation, returns that promise instead. + * + * @async + * @returns {Promise} The total duration in milliseconds, or the last valid value if resolution fails. + */ + resolveQueriesAsync(): Promise; + /** + * Internal method to resolve queries and calculate total duration. + * + * @async + * @private + * @returns {Promise} The total duration in milliseconds. + */ + private _resolveQueries; + /** + * Dispose of the query pool. + * + * @async + * @returns {Promise} A Promise that resolves when the dispose has been executed. + */ + dispose(): Promise; +} +import TimestampQueryPool from '../../common/TimestampQueryPool.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts new file mode 100644 index 000000000..1e208f66c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts @@ -0,0 +1,112 @@ +/** + * Submits a single GPU command to the device queue using a shared, module-scoped + * array to avoid per-call array allocations. + * + * @private + * @param {GPUDevice} device - The GPU device. + * @param {GPUCommandBuffer} command - The command buffer to submit. + */ +export function submit(device: GPUDevice, command: GPUCommandBuffer): void; +export default WebGPUUtils; +/** + * A WebGPU backend utility module with common helpers. + * + * @private + */ +declare class WebGPUUtils { + /** + * Constructs a new utility object. + * + * @param {WebGPUBackend} backend - The WebGPU backend. + */ + constructor(backend: WebGPUBackend); + /** + * A reference to the WebGPU backend. + * + * @type {WebGPUBackend} + */ + backend: WebGPUBackend; + /** + * Caches the preferred canvas format. + * + * @private + * @type {?string} + * @default null + */ + private _preferredCanvasFormat; + /** + * Returns the depth/stencil GPU format for the given render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {string} The depth/stencil GPU texture format. + */ + getCurrentDepthStencilFormat(renderContext: RenderContext): string; + /** + * Returns the GPU format for the given texture. + * + * @param {Texture} texture - The texture. + * @return {string} The GPU texture format. + */ + getTextureFormatGPU(texture: Texture): string; + /** + * Returns an object that defines the multi-sampling state of the given texture. + * + * @param {Texture} texture - The texture. + * @return {Object} The multi-sampling state. + */ + getTextureSampleData(texture: Texture): Object; + /** + * Returns the default color attachment's GPU format of the current render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {string} The GPU texture format of the default color attachment. + */ + getCurrentColorFormat(renderContext: RenderContext): string; + /** + * Returns the GPU formats of all color attachments of the current render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {Array} The GPU texture formats of all color attachments. + */ + getCurrentColorFormats(renderContext: RenderContext): Array; + /** + * Returns the output color space of the current render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {string} The output color space. + */ + getCurrentColorSpace(renderContext: RenderContext): string; + /** + * Returns GPU primitive topology for the given object and material. + * + * @param {Object3D} object - The 3D object. + * @param {Material} material - The material. + * @return {string} The GPU primitive topology. + */ + getPrimitiveTopology(object: Object3D, material: Material): string; + /** + * Returns a modified sample count from the given sample count value. + * + * That is required since WebGPU only supports either 1 or 4. + * + * @param {number} sampleCount - The input sample count. + * @return {number} The (potentially updated) output sample count. + */ + getSampleCount(sampleCount: number): number; + /** + * Returns the sample count of the given render context. + * + * @param {RenderContext} renderContext - The render context. + * @return {number} The sample count. + */ + getSampleCountRenderContext(renderContext: RenderContext): number; + /** + * Returns the preferred canvas format. + * + * There is a separate method for this so it's possible to + * honor edge cases for specific devices. + * + * @return {string} The GPU texture format of the canvas. + */ + getPreferredCanvasFormat(): string; +} diff --git a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts new file mode 100644 index 000000000..91dbb3340 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts @@ -0,0 +1,96 @@ +/** + * Class for representing a XR controller with its + * different coordinate systems. + * + * @private + */ +export class WebXRController { + /** + * A group representing the target ray space + * of the XR controller. + * + * @private + * @type {?Group} + * @default null + */ + private _targetRay; + /** + * A group representing the grip space + * of the XR controller. + * + * @private + * @type {?Group} + * @default null + */ + private _grip; + /** + * A group representing the hand space + * of the XR controller. + * + * @private + * @type {?Group} + * @default null + */ + private _hand; + /** + * Returns a group representing the hand space of the XR controller. + * + * @return {Group} A group representing the hand space of the XR controller. + */ + getHandSpace(): Group; + /** + * Returns a group representing the target ray space of the XR controller. + * + * @return {Group} A group representing the target ray space of the XR controller. + */ + getTargetRaySpace(): Group; + /** + * Returns a group representing the grip space of the XR controller. + * + * @return {Group} A group representing the grip space of the XR controller. + */ + getGripSpace(): Group; + /** + * Dispatches the given event to the groups representing + * the different coordinate spaces of the XR controller. + * + * @param {Object} event - The event to dispatch. + * @return {WebXRController} A reference to this instance. + */ + dispatchEvent(event: Object): WebXRController; + /** + * Connects the controller with the given XR input source. + * + * @param {XRInputSource} inputSource - The input source. + * @return {WebXRController} A reference to this instance. + */ + connect(inputSource: XRInputSource): WebXRController; + /** + * Disconnects the controller from the given XR input source. + * + * @param {XRInputSource} inputSource - The input source. + * @return {WebXRController} A reference to this instance. + */ + disconnect(inputSource: XRInputSource): WebXRController; + /** + * Updates the controller with the given input source, XR frame and reference space. + * This updates the transformations of the groups that represent the different + * coordinate systems of the controller. + * + * @param {XRInputSource} inputSource - The input source. + * @param {XRFrame} frame - The XR frame. + * @param {XRReferenceSpace} referenceSpace - The reference space. + * @return {WebXRController} A reference to this instance. + */ + update(inputSource: XRInputSource, frame: XRFrame, referenceSpace: XRReferenceSpace): WebXRController; + /** + * Returns a group representing the hand joint for the given input joint. + * + * @private + * @param {Group} hand - The group representing the hand space. + * @param {XRJointSpace} inputjoint - The hand joint data. + * @return {Group} A group representing the hand joint for the given input joint. + */ + private _getHandJoint; +} +import { Group } from '../../objects/Group.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts new file mode 100644 index 000000000..aaa8ad7cf --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts @@ -0,0 +1,55 @@ +/** + * A XR module that manages the access to the Depth Sensing API. + */ +export class WebXRDepthSensing { + /** + * An opaque texture representing the depth of the user's environment. + * + * @type {?ExternalTexture} + */ + texture: ExternalTexture | null; + /** + * A plane mesh for visualizing the depth texture. + * + * @type {?Mesh} + */ + mesh: Mesh | null; + /** + * The depth near value. + * + * @type {number} + */ + depthNear: number; + /** + * The depth near far. + * + * @type {number} + */ + depthFar: number; + /** + * Inits the depth sensing module + * + * @param {XRWebGLDepthInformation} depthData - The XR depth data. + * @param {XRRenderState} renderState - The XR render state. + */ + init(depthData: XRWebGLDepthInformation, renderState: XRRenderState): void; + /** + * Returns a plane mesh that visualizes the depth texture. + * + * @param {ArrayCamera} cameraXR - The XR camera. + * @return {?Mesh} The plane mesh. + */ + getMesh(cameraXR: ArrayCamera): Mesh | null; + /** + * Resets the module + */ + reset(): void; + /** + * Returns a texture representing the depth of the user's environment. + * + * @return {?ExternalTexture} The depth texture. + */ + getDepthTexture(): ExternalTexture | null; +} +import { ExternalTexture } from '../../textures/ExternalTexture.js'; +import { Mesh } from '../../objects/Mesh.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts new file mode 100644 index 000000000..edab6f90c --- /dev/null +++ b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts @@ -0,0 +1,220 @@ +/** + * This class represents an abstraction of the WebXR Device API and is + * internally used by {@link WebGLRenderer}. `WebXRManager` also provides a public + * interface that allows users to enable/disable XR and perform XR related + * tasks like for instance retrieving controllers. + * + * @augments EventDispatcher + * @hideconstructor + */ +export class WebXRManager extends EventDispatcher { + /** + * Constructs a new WebGL renderer. + * + * @param {WebGLRenderer} renderer - The renderer. + * @param {WebGL2RenderingContext} gl - The rendering context. + */ + constructor(renderer: WebGLRenderer, gl: WebGL2RenderingContext); + /** + * Whether the manager's XR camera should be automatically updated or not. + * + * @type {boolean} + * @default true + */ + cameraAutoUpdate: boolean; + /** + * This flag notifies the renderer to be ready for XR rendering. Set it to `true` + * if you are going to use XR in your app. + * + * @type {boolean} + * @default false + */ + enabled: boolean; + /** + * Whether XR presentation is active or not. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly isPresenting: boolean; + /** + * Returns a group representing the `target ray` space of the XR controller. + * Use this space for visualizing 3D objects that support the user in pointing + * tasks like UI interaction. + * + * @param {number} index - The index of the controller. + * @return {Group} A group representing the `target ray` space. + */ + getController: (index: number) => Group; + /** + * Returns a group representing the `grip` space of the XR controller. + * Use this space for visualizing 3D objects that support the user in pointing + * tasks like UI interaction. + * + * Note: If you want to show something in the user's hand AND offer a + * pointing ray at the same time, you'll want to attached the handheld object + * to the group returned by `getControllerGrip()` and the ray to the + * group returned by `getController()`. The idea is to have two + * different groups in two different coordinate spaces for the same WebXR + * controller. + * + * @param {number} index - The index of the controller. + * @return {Group} A group representing the `grip` space. + */ + getControllerGrip: (index: number) => Group; + /** + * Returns a group representing the `hand` space of the XR controller. + * Use this space for visualizing 3D objects that support the user in pointing + * tasks like UI interaction. + * + * @param {number} index - The index of the controller. + * @return {Group} A group representing the `hand` space. + */ + getHand: (index: number) => Group; + /** + * Sets the framebuffer scale factor. + * + * This method can not be used during a XR session. + * + * @param {number} value - The framebuffer scale factor. + */ + setFramebufferScaleFactor: (value: number) => void; + /** + * Sets the reference space type. Can be used to configure a spatial relationship with the user's physical + * environment. Depending on how the user moves in 3D space, setting an appropriate reference space can + * improve tracking. Default is `local-floor`. Valid values can be found here + * https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types. + * + * This method can not be used during a XR session. + * + * @param {string} value - The reference space type. + */ + setReferenceSpaceType: (value: string) => void; + /** + * Returns the XR reference space. + * + * @return {XRReferenceSpace} The XR reference space. + */ + getReferenceSpace: () => XRReferenceSpace; + /** + * Sets a custom XR reference space. + * + * @param {XRReferenceSpace} space - The XR reference space. + */ + setReferenceSpace: (space: XRReferenceSpace) => void; + /** + * Returns the current base layer. + * + * This is an `XRProjectionLayer` when the targeted XR device supports the + * WebXR Layers API, or an `XRWebGLLayer` otherwise. + * + * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. + */ + getBaseLayer: () => (XRWebGLLayer | XRProjectionLayer) | null; + /** + * Returns the current XR binding. + * + * Creates a new binding if needed and the browser is + * capable of doing so. + * + * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. + */ + getBinding: () => XRWebGLBinding | null; + /** + * Returns the current XR frame. + * + * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. + */ + getFrame: () => XRFrame | null; + /** + * Returns the current XR session. + * + * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. + */ + getSession: () => XRSession | null; + /** + * After a XR session has been requested usually with one of the `*Button` modules, it + * is injected into the renderer with this method. This method triggers the start of + * the actual XR rendering. + * + * @async + * @param {XRSession} value - The XR session to set. + * @return {Promise} A Promise that resolves when the session has been set. + */ + setSession: (value: XRSession) => Promise; + /** + * Returns the environment blend mode from the current XR session. + * + * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. + */ + getEnvironmentBlendMode: () => "opaque" | "additive" | "alpha-blend" | undefined; + /** + * Returns the current depth texture computed via depth sensing. + * + * See {@link WebXRDepthSensing#getDepthTexture}. + * + * @return {?Texture} The depth texture. + */ + getDepthTexture: () => Texture | null; + /** + * Updates the state of the XR camera. Use this method on app level if you + * set `cameraAutoUpdate` to `false`. The method requires the non-XR + * camera of the scene as a parameter. The passed in camera's transformation + * is automatically adjusted to the position of the XR camera when calling + * this method. + * + * @param {Camera} camera - The camera. + */ + updateCamera: (camera: Camera) => void; + /** + * Returns an instance of {@link ArrayCamera} which represents the XR camera + * of the active XR session. For each view it holds a separate camera object. + * + * The camera's `fov` is currently not used and does not reflect the fov of + * the XR camera. If you need the fov on app level, you have to compute in + * manually from the XR camera's projection matrices. + * + * @return {ArrayCamera} The XR camera. + */ + getCamera: () => ArrayCamera; + /** + * Returns the amount of foveation used by the XR compositor for the projection layer. + * + * @return {number|undefined} The amount of foveation. + */ + getFoveation: () => number | undefined; + /** + * Sets the foveation value. + * + * @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution) + * and `1` means maximum foveation (the edges render at lower resolution). + */ + setFoveation: (value: number) => void; + /** + * Returns `true` if depth sensing is supported. + * + * @return {boolean} Whether depth sensing is supported or not. + */ + hasDepthSensing: () => boolean; + /** + * Returns the depth sensing mesh. + * + * See {@link WebXRDepthSensing#getMesh}. + * + * @return {Mesh} The depth sensing mesh. + */ + getDepthSensingMesh: () => Mesh; + /** + * Retrieves an opaque texture from the view-aligned {@link XRCamera}. + * Only available during the current animation loop. + * + * @param {XRCamera} xrCamera - The camera to query. + * @return {?Texture} An opaque texture representing the current raw camera frame. + */ + getCameraTexture: (xrCamera: XRCamera) => Texture | null; + setAnimationLoop: (callback: any) => void; + dispose: () => void; +} +import { EventDispatcher } from '../../core/EventDispatcher.js'; +import { ArrayCamera } from '../../cameras/ArrayCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/scenes/Fog.d.ts b/jsdoc-testing/jsdoc/src/scenes/Fog.d.ts new file mode 100644 index 000000000..3c17089bd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/scenes/Fog.d.ts @@ -0,0 +1,70 @@ +/** + * This class can be used to define a linear fog that grows linearly denser + * with the distance. + * + * ```js + * const scene = new THREE.Scene(); + * scene.fog = new THREE.Fog( 0xcccccc, 10, 15 ); + * ``` + */ +export class Fog { + /** + * Constructs a new fog. + * + * @param {number|Color} color - The fog's color. + * @param {number} [near=1] - The minimum distance to start applying fog. + * @param {number} [far=1000] - The maximum distance at which fog stops being calculated and applied. + */ + constructor(color: number | Color, near?: number, far?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isFog: boolean; + /** + * The name of the fog. + * + * @type {string} + */ + name: string; + /** + * The fog's color. + * + * @type {Color} + */ + color: Color; + /** + * The minimum distance to start applying fog. Objects that are less than + * `near` units from the active camera won't be affected by fog. + * + * @type {number} + * @default 1 + */ + near: number; + /** + * The maximum distance at which fog stops being calculated and applied. + * Objects that are more than `far` units away from the active camera won't + * be affected by fog. + * + * @type {number} + * @default 1000 + */ + far: number; + /** + * Returns a new fog with copied values from this instance. + * + * @return {Fog} A clone of this instance. + */ + clone(): Fog; + /** + * Serializes the fog into JSON. + * + * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized fog + */ + toJSON(): Object; +} +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts b/jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts new file mode 100644 index 000000000..e11462391 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts @@ -0,0 +1,60 @@ +/** + * This class can be used to define an exponential squared fog, + * which gives a clear view near the camera and a faster than exponentially + * densening fog farther from the camera. + * + * ```js + * const scene = new THREE.Scene(); + * scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 ); + * ``` + */ +export class FogExp2 { + /** + * Constructs a new fog. + * + * @param {number|Color} color - The fog's color. + * @param {number} [density=0.00025] - Defines how fast the fog will grow dense. + */ + constructor(color: number | Color, density?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isFogExp2: boolean; + /** + * The name of the fog. + * + * @type {string} + */ + name: string; + /** + * The fog's color. + * + * @type {Color} + */ + color: Color; + /** + * Defines how fast the fog will grow dense. + * + * @type {number} + * @default 0.00025 + */ + density: number; + /** + * Returns a new fog with copied values from this instance. + * + * @return {FogExp2} A clone of this instance. + */ + clone(): FogExp2; + /** + * Serializes the fog into JSON. + * + * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized fog + */ + toJSON(): Object; +} +import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/scenes/Scene.d.ts b/jsdoc-testing/jsdoc/src/scenes/Scene.d.ts new file mode 100644 index 000000000..91ed09ab6 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/scenes/Scene.d.ts @@ -0,0 +1,97 @@ +/** + * Scenes allow you to set up what is to be rendered and where by three.js. + * This is where you place 3D objects like meshes, lines or lights. + * + * @augments Object3D + */ +export class Scene extends Object3D { + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isScene: boolean; + type: string; + /** + * Defines the background of the scene. Valid inputs are: + * + * - A color for defining a uniform colored background. + * - A texture for defining a (flat) textured background. + * - Cube textures or equirectangular textures for defining a skybox. + * + * @type {?(Color|Texture)} + * @default null + */ + background: (Color | Texture) | null; + /** + * Sets the environment map for all physical materials in the scene. However, + * it's not possible to overwrite an existing texture assigned to the `envMap` + * material property. + * + * @type {?Texture} + * @default null + */ + environment: Texture | null; + /** + * A fog instance defining the type of fog that affects everything + * rendered in the scene. + * + * @type {?(Fog|FogExp2)} + * @default null + */ + fog: (Fog | FogExp2) | null; + /** + * Sets the blurriness of the background. Only influences environment maps + * assigned to {@link Scene#background}. Valid input is a float between `0` + * and `1`. + * + * @type {number} + * @default 0 + */ + backgroundBlurriness: number; + /** + * Attenuates the color of the background. Only applies to background textures. + * + * @type {number} + * @default 1 + */ + backgroundIntensity: number; + /** + * The rotation of the background in radians. Only influences environment maps + * assigned to {@link Scene#background}. + * + * @type {Euler} + * @default (0,0,0) + */ + backgroundRotation: Euler; + /** + * Attenuates the color of the environment. Only influences environment maps + * assigned to {@link Scene#environment}. + * + * @type {number} + * @default 1 + */ + environmentIntensity: number; + /** + * The rotation of the environment map in radians. Only influences physical materials + * in the scene when {@link Scene#environment} is used. + * + * @type {Euler} + * @default (0,0,0) + */ + environmentRotation: Euler; + /** + * Forces everything in the scene to be rendered with the defined material. It is possible + * to exclude materials from override by setting {@link Material#allowOverride} to `false`. + * + * @type {?Material} + * @default null + */ + overrideMaterial: Material | null; + copy(source: any, recursive: any): this; + toJSON(meta: any): Object; +} +import { Object3D } from '../core/Object3D.js'; +import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts new file mode 100644 index 000000000..ee88d4d2b --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts @@ -0,0 +1,33 @@ +/** + * Creates a texture from a canvas element. + * + * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate} + * to `true` immediately since a canvas can directly be used for rendering. + * + * @augments Texture + */ +export class CanvasTexture extends Texture { + /** + * Constructs a new texture. + * + * @param {HTMLCanvasElement} [canvas] - The HTML canvas element. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + */ + constructor(canvas?: HTMLCanvasElement, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCanvasTexture: boolean; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts new file mode 100644 index 000000000..96dee3662 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts @@ -0,0 +1,65 @@ +/** + * Creates a texture 2D array based on data in compressed form. + * + * These texture are usually loaded with {@link CompressedTextureLoader}. + * + * @augments CompressedTexture + */ +export class CompressedArrayTexture extends CompressedTexture { + /** + * Constructs a new compressed array texture. + * + * @param {Array} mipmaps - This array holds for all mipmaps (including the bases mip) + * the data and dimensions. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} depth - The depth of the texture. + * @param {number} [format=RGBAFormat] - The min filter value. + * @param {number} [type=UnsignedByteType] - The min filter value. + */ + constructor(mipmaps: Array, width: number, height: number, depth: number, format?: number, type?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCompressedArrayTexture: boolean; + /** + * This defines how the texture is wrapped in the depth and corresponds to + * *W* in UVW mapping. + * + * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} + * @default ClampToEdgeWrapping + */ + wrapR: (RepeatWrapping | number | MirroredRepeatWrapping); + /** + * A set of all layers which need to be updated in the texture. + * + * @type {Set} + */ + layerUpdates: Set; + /** + * Copies the values of the given texture to this instance. + * + * @param {CompressedArrayTexture} source - The texture to copy. + * @return {CompressedArrayTexture} A reference to this instance. + */ + copy(source: CompressedArrayTexture): CompressedArrayTexture; + /** + * Describes that a specific layer of the texture needs to be updated. + * Normally when {@link Texture#needsUpdate} is set to `true`, the + * entire compressed texture array is sent to the GPU. Marking specific + * layers will only transmit subsets of all mipmaps associated with a + * specific depth in the array which is often much more performant. + * + * @param {number} layerIndex - The layer index that should be updated. + */ + addLayerUpdate(layerIndex: number): void; + /** + * Resets the layer updates registry. + */ + clearLayerUpdates(): void; +} +import { CompressedTexture } from './CompressedTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts new file mode 100644 index 000000000..05f09fbfb --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts @@ -0,0 +1,35 @@ +/** + * Creates a cube texture based on data in compressed form. + * + * These texture are usually loaded with {@link CompressedTextureLoader}. + * + * @augments CompressedTexture + */ +export class CompressedCubeTexture extends CompressedTexture { + /** + * Constructs a new compressed texture. + * + * @param {Array} images - An array of compressed textures. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + */ + constructor(images: Array, format?: number, type?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCompressedCubeTexture: boolean; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeTexture: boolean; + image: CompressedTexture[]; +} +import { CompressedTexture } from './CompressedTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts new file mode 100644 index 000000000..3d1d77673 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts @@ -0,0 +1,36 @@ +/** + * Creates a texture based on data in compressed form. + * + * These texture are usually loaded with {@link CompressedTextureLoader}. + * + * @augments Texture + */ +export class CompressedTexture extends Texture { + /** + * Constructs a new compressed texture. + * + * @param {Array} mipmaps - This array holds for all mipmaps (including the bases mip) + * the data and dimensions. + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + * @param {string} [colorSpace=NoColorSpace] - The color space. + */ + constructor(mipmaps: Array, width: number, height: number, format?: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, colorSpace?: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCompressedTexture: boolean; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts new file mode 100644 index 000000000..c436fb9e7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts @@ -0,0 +1,51 @@ +/** + * This class can be used to automatically save the depth information of a + * cube rendering into a cube texture with depth format. Used for PointLight shadows. + * + * @augments DepthTexture + */ +export class CubeDepthTexture extends DepthTexture { + /** + * Constructs a new cube depth texture. + * + * @param {number} size - The size (width and height) of each cube face. + * @param {number} [type=UnsignedIntType] - The texture type. + * @param {number} [mapping=CubeReflectionMapping] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=NearestFilter] - The mag filter value. + * @param {number} [minFilter=NearestFilter] - The min filter value. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + * @param {number} [format=DepthFormat] - The texture format. + */ + constructor(size: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, format?: number); + image: { + width: number; + height: number; + depth: number; + }[]; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeDepthTexture: boolean; + /** + * Set to true for cube texture handling in WebGLTextures. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeTexture: boolean; + set images(value: Array HTMLImageElement>); + /** + * Alias for {@link CubeDepthTexture#image}. + * + * @type {Array} + */ + get images(): Array HTMLImageElement>; +} +import { DepthTexture } from './DepthTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts new file mode 100644 index 000000000..76c1ce43d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts @@ -0,0 +1,49 @@ +/** + * Creates a cube texture made up of six images. + * + * ```js + * const loader = new THREE.CubeTextureLoader(); + * loader.setPath( 'textures/cube/pisa/' ); + * + * const textureCube = loader.load( [ + * 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' + * ] ); + * + * const material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } ); + * ``` + * + * @augments Texture + */ +export class CubeTexture extends Texture { + /** + * Constructs a new cube texture. + * + * @param {Array} [images=[]] - An array holding a image for each side of a cube. + * @param {number} [mapping=CubeReflectionMapping] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + * @param {string} [colorSpace=NoColorSpace] - The color space value. + */ + constructor(images?: Array HTMLImageElement>, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number, colorSpace?: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isCubeTexture: boolean; + set images(value: Array HTMLImageElement>); + /** + * Alias for {@link CubeTexture#image}. + * + * @type {Array} + */ + get images(): Array HTMLImageElement>; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts new file mode 100644 index 000000000..abdcba564 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts @@ -0,0 +1,41 @@ +/** + * Creates a three-dimensional texture from raw data, with parameters to + * divide it into width, height, and depth. + * + * @augments Texture + */ +export class Data3DTexture extends Texture { + /** + * Constructs a new data array texture. + * + * @param {?TypedArray} [data=null] - The buffer data. + * @param {number} [width=1] - The width of the texture. + * @param {number} [height=1] - The height of the texture. + * @param {number} [depth=1] - The depth of the texture. + */ + constructor(data?: TypedArray | null, width?: number, height?: number, depth?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isData3DTexture: boolean; + /** + * This defines how the texture is wrapped in the depth and corresponds to + * *W* in UVW mapping. + * + * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} + * @default ClampToEdgeWrapping + */ + wrapR: (RepeatWrapping | number | MirroredRepeatWrapping); + /** + * Copies the values of the given texture to this instance. + * + * @param {Data3DTexture} source - The texture to copy. + * @return {Data3DTexture} A reference to this instance. + */ + copy(source: Data3DTexture): Data3DTexture; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts new file mode 100644 index 000000000..c93a79f69 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts @@ -0,0 +1,60 @@ +/** + * Creates an array of textures directly from raw buffer data. + * + * @augments Texture + */ +export class DataArrayTexture extends Texture { + /** + * Constructs a new data array texture. + * + * @param {?TypedArray} [data=null] - The buffer data. + * @param {number} [width=1] - The width of the texture. + * @param {number} [height=1] - The height of the texture. + * @param {number} [depth=1] - The depth of the texture. + */ + constructor(data?: TypedArray | null, width?: number, height?: number, depth?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isDataArrayTexture: boolean; + /** + * This defines how the texture is wrapped in the depth and corresponds to + * *W* in UVW mapping. + * + * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} + * @default ClampToEdgeWrapping + */ + wrapR: (RepeatWrapping | number | MirroredRepeatWrapping); + /** + * A set of all layers which need to be updated in the texture. + * + * @type {Set} + */ + layerUpdates: Set; + /** + * Copies the values of the given texture to this instance. + * + * @param {DataArrayTexture} source - The texture to copy. + * @return {DataArrayTexture} A reference to this instance. + */ + copy(source: DataArrayTexture): DataArrayTexture; + /** + * Describes that a specific layer of the texture needs to be updated. + * Normally when {@link Texture#needsUpdate} is set to `true`, the + * entire data texture array is sent to the GPU. Marking specific + * layers will only transmit subsets of all mipmaps associated with a + * specific depth in the array which is often much more performant. + * + * @param {number} layerIndex - The layer index that should be updated. + */ + addLayerUpdate(layerIndex: number): void; + /** + * Resets the layer updates registry. + */ + clearLayerUpdates(): void; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts new file mode 100644 index 000000000..8bec07e5d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts @@ -0,0 +1,38 @@ +/** + * Creates a texture directly from raw buffer data. + * + * The interpretation of the data depends on type and format: If the type is + * `UnsignedByteType`, a `Uint8Array` will be useful for addressing the + * texel data. If the format is `RGBAFormat`, data needs four values for + * one texel; Red, Green, Blue and Alpha (typically the opacity). + * + * @augments Texture + */ +export class DataTexture extends Texture { + /** + * Constructs a new data texture. + * + * @param {?TypedArray} [data=null] - The buffer data. + * @param {number} [width=1] - The width of the texture. + * @param {number} [height=1] - The height of the texture. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=NearestFilter] - The mag filter value. + * @param {number} [minFilter=NearestFilter] - The min filter value. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + * @param {string} [colorSpace=NoColorSpace] - The color space. + */ + constructor(data?: TypedArray | null, width?: number, height?: number, format?: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, colorSpace?: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isDataTexture: boolean; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts new file mode 100644 index 000000000..7d3a969ed --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts @@ -0,0 +1,42 @@ +/** + * This class can be used to automatically save the depth information of a + * rendering into a texture. + * + * @augments Texture + */ +export class DepthTexture extends Texture { + /** + * Constructs a new depth texture. + * + * @param {number} width - The width of the texture. + * @param {number} height - The height of the texture. + * @param {number} [type=UnsignedIntType] - The texture type. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearFilter] - The min filter value. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + * @param {number} [format=DepthFormat] - The texture format. + * @param {number} [depth=1] - The depth of the texture. + */ + constructor(width: number, height: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, format?: number, depth?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isDepthTexture: boolean; + /** + * Code corresponding to the depth compare function. + * + * @type {?(NeverCompare|LessCompare|EqualCompare|LessEqualCompare|GreaterCompare|NotEqualCompare|GreaterEqualCompare|AlwaysCompare)} + * @default null + */ + compareFunction: (NeverCompare | LessCompare | EqualCompare | LessEqualCompare | GreaterCompare | NotEqualCompare | GreaterEqualCompare | AlwaysCompare) | null; + copy(source: any): this; + toJSON(meta: any): Object; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts new file mode 100644 index 000000000..f898755c0 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts @@ -0,0 +1,33 @@ +/** + * Represents a texture created externally with the same renderer context. + * + * This may be a texture from a protected media stream, device camera feed, + * or other data feeds like a depth sensor. + * + * @augments Texture + */ +export class ExternalTexture extends Texture { + /** + * Creates a new raw texture. + * + * @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture. + */ + constructor(sourceTexture?: (WebGLTexture | GPUTexture) | null); + /** + * The external source texture. + * + * @type {?(WebGLTexture|GPUTexture)} + * @default null + */ + sourceTexture: (WebGLTexture | GPUTexture) | null; + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isExternalTexture: boolean; + copy(source: any): this; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts new file mode 100644 index 000000000..0de9064c8 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts @@ -0,0 +1,42 @@ +/** + * This class can only be used in combination with `copyFramebufferToTexture()` methods + * of renderers. It extracts the contents of the current bound framebuffer and provides it + * as a texture for further usage. + * + * ```js + * const pixelRatio = window.devicePixelRatio; + * const textureSize = 128 * pixelRatio; + * + * const frameTexture = new FramebufferTexture( textureSize, textureSize ); + * + * // calculate start position for copying part of the frame data + * const vector = new Vector2(); + * vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 ); + * vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 ); + * + * renderer.render( scene, camera ); + * + * // copy part of the rendered frame into the framebuffer texture + * renderer.copyFramebufferToTexture( frameTexture, vector ); + * ``` + * + * @augments Texture + */ +export class FramebufferTexture extends Texture { + /** + * Constructs a new framebuffer texture. + * + * @param {number} [width] - The width of the texture. + * @param {number} [height] - The height of the texture. + */ + constructor(width?: number, height?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isFramebufferTexture: boolean; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts new file mode 100644 index 000000000..bdf594cf7 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts @@ -0,0 +1,33 @@ +/** + * Creates a texture from an HTML element. + * + * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate} + * to `true` immediately and listens for the parent canvas's paint events to trigger updates. + * + * @augments Texture + */ +export class HTMLTexture extends Texture { + /** + * Constructs a new texture. + * + * @param {HTMLElement} [element] - The HTML element. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + */ + constructor(element?: HTMLElement, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isHTMLTexture: boolean; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/Texture.d.ts b/jsdoc-testing/jsdoc/src/textures/Texture.d.ts new file mode 100644 index 000000000..bad56374d --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/Texture.d.ts @@ -0,0 +1,413 @@ +/** + * Base class for all textures. + * + * Note: After the initial use of a texture, its dimensions, format, and type + * cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one. + * + * @augments EventDispatcher + */ +export class Texture extends EventDispatcher { + /** + * Constructs a new texture. + * + * @param {?Object} [image=Texture.DEFAULT_IMAGE] - The image holding the texture data. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + * @param {string} [colorSpace=NoColorSpace] - The color space. + */ + constructor(image?: Object | null, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number, colorSpace?: string); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTexture: boolean; + /** + * The UUID of the texture. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * The name of the texture. + * + * @type {string} + */ + name: string; + /** + * The data definition of a texture. A reference to the data source can be + * shared across textures. This is often useful in context of spritesheets + * where multiple textures render the same data but with different texture + * transformations. + * + * @type {TextureSource} + */ + source: TextureSource; + /** + * An array holding user-defined mipmaps. + * + * @type {Array} + */ + mipmaps: Array; + /** + * How the texture is applied to the object. The value `UVMapping` + * is the default, where texture or uv coordinates are used to apply the map. + * + * @type {(UVMapping|CubeReflectionMapping|CubeRefractionMapping|EquirectangularReflectionMapping|EquirectangularRefractionMapping|CubeUVReflectionMapping)} + * @default UVMapping + */ + mapping: (number | CubeReflectionMapping | CubeRefractionMapping | EquirectangularReflectionMapping | EquirectangularRefractionMapping | CubeUVReflectionMapping); + /** + * Lets you select the uv attribute to map the texture to. `0` for `uv`, + * `1` for `uv1`, `2` for `uv2` and `3` for `uv3`. + * + * @type {number} + * @default 0 + */ + channel: number; + /** + * This defines how the texture is wrapped horizontally and corresponds to + * *U* in UV mapping. + * + * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} + * @default ClampToEdgeWrapping + */ + wrapS: (number | number | number); + /** + * This defines how the texture is wrapped horizontally and corresponds to + * *V* in UV mapping. + * + * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} + * @default ClampToEdgeWrapping + */ + wrapT: (number | number | number); + /** + * How the texture is sampled when a texel covers more than one pixel. + * + * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)} + * @default LinearFilter + */ + magFilter: (NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | number | LinearMipmapNearestFilter | number); + /** + * How the texture is sampled when a texel covers less than one pixel. + * + * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)} + * @default LinearMipmapLinearFilter + */ + minFilter: (NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | number | LinearMipmapNearestFilter | number); + /** + * The number of samples taken along the axis through the pixel that has the + * highest density of texels. By default, this value is `1`. A higher value + * gives a less blurry result than a basic mipmap, at the cost of more + * texture samples being used. + * + * @type {number} + * @default Texture.DEFAULT_ANISOTROPY + */ + anisotropy: number; + /** + * The format of the texture. + * + * @type {number} + * @default RGBAFormat + */ + format: number; + /** + * The default internal format is derived from {@link Texture#format} and {@link Texture#type} and + * defines how the texture data is going to be stored on the GPU. + * + * This property allows to overwrite the default format. + * + * @type {?string} + * @default null + */ + internalFormat: string | null; + /** + * The data type of the texture. + * + * @type {number} + * @default UnsignedByteType + */ + type: number; + /** + * How much a single repetition of the texture is offset from the beginning, + * in each direction U and V. Typical range is `0.0` to `1.0`. + * + * @type {Vector2} + * @default (0,0) + */ + offset: Vector2; + /** + * How many times the texture is repeated across the surface, in each + * direction U and V. If repeat is set greater than `1` in either direction, + * the corresponding wrap parameter should also be set to `RepeatWrapping` + * or `MirroredRepeatWrapping` to achieve the desired tiling effect. + * + * @type {Vector2} + * @default (1,1) + */ + repeat: Vector2; + /** + * The point around which rotation occurs. A value of `(0.5, 0.5)` corresponds + * to the center of the texture. Default is `(0, 0)`, the lower left. + * + * @type {Vector2} + * @default (0,0) + */ + center: Vector2; + /** + * How much the texture is rotated around the center point, in radians. + * Positive values are counter-clockwise. + * + * @type {number} + * @default 0 + */ + rotation: number; + /** + * Whether to update the texture's uv-transformation {@link Texture#matrix} + * from the properties {@link Texture#offset}, {@link Texture#repeat}, + * {@link Texture#rotation}, and {@link Texture#center}. + * + * Set this to `false` if you are specifying the uv-transform matrix directly. + * + * @type {boolean} + * @default true + */ + matrixAutoUpdate: boolean; + /** + * The uv-transformation matrix of the texture. + * + * @type {Matrix3} + */ + matrix: Matrix3; + /** + * Whether to generate mipmaps (if possible) for a texture. + * + * Set this to `false` if you are creating mipmaps manually. + * + * @type {boolean} + * @default true + */ + generateMipmaps: boolean; + /** + * If set to `true`, the alpha channel, if present, is multiplied into the + * color channels when the texture is uploaded to the GPU. + * + * Note that this property has no effect when using `ImageBitmap`. You need to + * configure premultiply alpha on bitmap creation instead. + * + * @type {boolean} + * @default false + */ + premultiplyAlpha: boolean; + /** + * If set to `true`, the texture is flipped along the vertical axis when + * uploaded to the GPU. + * + * Note that this property has no effect when using `ImageBitmap`. You need to + * configure the flip on bitmap creation instead. + * + * @type {boolean} + * @default true + */ + flipY: boolean; + /** + * Specifies the alignment requirements for the start of each pixel row in memory. + * The allowable values are `1` (byte-alignment), `2` (rows aligned to even-numbered bytes), + * `4` (word-alignment), and `8` (rows start on double-word boundaries). + * + * @type {number} + * @default 4 + */ + unpackAlignment: number; + /** + * Textures containing color data should be annotated with `SRGBColorSpace` or `LinearSRGBColorSpace`. + * + * @type {string} + * @default NoColorSpace + */ + colorSpace: string; + /** + * An object that can be used to store custom data about the texture. It + * should not hold references to functions as these will not be cloned. + * + * @type {Object} + */ + userData: Object; + /** + * This can be used to only update a subregion or specific rows of the texture (for example, just the + * first 3 rows). Use the `addUpdateRange()` function to add ranges to this array. + * + * @type {Array} + */ + updateRanges: Array; + /** + * This starts at `0` and counts how many times {@link Texture#needsUpdate} is set to `true`. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly version: number; + /** + * A callback function, called when the texture is updated (e.g., when + * {@link Texture#needsUpdate} has been set to true and then the texture is used). + * + * @type {?Function} + * @default null + */ + onUpdate: Function | null; + /** + * An optional back reference to the textures render target. + * + * @type {?(RenderTarget|WebGLRenderTarget)} + * @default null + */ + renderTarget: (RenderTarget | WebGLRenderTarget) | null; + /** + * Indicates whether a texture belongs to a render target or not. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly isRenderTargetTexture: boolean; + /** + * Indicates if a texture should be handled like a texture array. + * + * @type {boolean} + * @readonly + * @default false + */ + readonly isArrayTexture: boolean; + /** + * Indicates whether this texture should be processed by `PMREMGenerator` or not + * (only relevant for render target textures). + * + * @type {number} + * @readonly + * @default 0 + */ + readonly pmremVersion: number; + /** + * Whether the texture should use one of the 16 bit integer formats which are normalized + * to [0, 1] or [-1, 1] (depending on signed/unsigned) when sampled. + * + * @type {boolean} + * @default false + */ + normalized: boolean; + /** + * The width of the texture in pixels. + */ + get width(): any; + /** + * The height of the texture in pixels. + */ + get height(): any; + /** + * The depth of the texture in pixels. + */ + get depth(): any; + set image(value: Object | null); + /** + * The image object holding the texture data. + * + * @type {?Object} + */ + get image(): Object | null; + /** + * Updates the texture transformation matrix from the properties {@link Texture#offset}, + * {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}. + */ + updateMatrix(): void; + /** + * Adds a range of data in the data texture to be updated on the GPU. + * + * @param {number} start - Position at which to start update. + * @param {number} count - The number of components to update. + */ + addUpdateRange(start: number, count: number): void; + /** + * Clears the update ranges. + */ + clearUpdateRanges(): void; + /** + * Returns a new texture with copied values from this instance. + * + * @return {Texture} A clone of this instance. + */ + clone(): Texture; + /** + * Copies the values of the given texture to this instance. + * + * @param {Texture} source - The texture to copy. + * @return {Texture} A reference to this instance. + */ + copy(source: Texture): Texture; + /** + * Setting this property to `true` indicates the engine the texture + * must be updated in the next render. This triggers a texture upload + * to the GPU and ensures correct texture parameter configuration. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * Sets this texture's properties based on `values`. + * @param {Object} values - A container with texture parameters. + */ + setValues(values: Object): void; + /** + * Serializes the texture into JSON. + * + * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized texture. + * @see {@link ObjectLoader#parse} + */ + toJSON(meta: (Object | string) | null): Object; + /** + * Frees the GPU-related resources allocated by this instance. Call this + * method whenever this instance is no longer used in your app. + * + * @fires Texture#dispose + */ + dispose(): void; + /** + * Transforms the given uv vector with the textures uv transformation matrix. + * + * @param {Vector2} uv - The uv vector. + * @return {Vector2} The transformed uv vector. + */ + transformUv(uv: Vector2): Vector2; + /** + * Setting this property to `true` indicates the engine the PMREM + * must be regenerated. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsPMREMUpdate(value: boolean); +} +export namespace Texture { + export let DEFAULT_IMAGE: (new (width?: number, height?: number) => HTMLImageElement) | null; + export { UVMapping as DEFAULT_MAPPING }; + export let DEFAULT_ANISOTROPY: number; +} +import { EventDispatcher } from '../core/EventDispatcher.js'; +import { TextureSource } from './TextureSource.js'; +import { Vector2 } from '../math/Vector2.js'; +import { Matrix3 } from '../math/Matrix3.js'; +import { UVMapping } from '../constants.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts b/jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts new file mode 100644 index 000000000..a01902cee --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts @@ -0,0 +1,92 @@ +/** + * @deprecated since r186. Use {@link TextureSource} instead. `Source` has been renamed to `TextureSource`. + */ +export class Source extends TextureSource { + /** + * This flag can be used for type testing. + * + * @deprecated since r186. Use {@link TextureSource#isTextureSource} instead. + * @type {boolean} + * @readonly + * @default true + */ + readonly isSource: boolean; +} +/** + * Represents the data source of a texture. + * + * The main purpose of this class is to decouple the data definition from the texture + * definition so the same data can be used with multiple texture instances. + */ +export class TextureSource { + /** + * Constructs a new texture source. + * + * @param {any} [data=null] - The data definition of a texture. + */ + constructor(data?: any); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isTextureSource: boolean; + /** + * The UUID of the source. + * + * @type {string} + * @readonly + */ + readonly uuid: string; + /** + * The data definition of a texture. + * + * @type {any} + */ + data: any; + /** + * This property is only relevant when {@link TextureSource#needsUpdate} is set to `true` and + * provides more control on how texture data should be processed. When `dataReady` is set + * to `false`, the engine performs the memory allocation (if necessary) but does not transfer + * the data into the GPU memory. + * + * @type {boolean} + * @default true + */ + dataReady: boolean; + /** + * This starts at `0` and counts how many times {@link TextureSource#needsUpdate} is set to `true`. + * + * @type {number} + * @readonly + * @default 0 + */ + readonly version: number; + /** + * Returns the dimensions of the source into the given target vector. + * + * @param {(Vector2|Vector3)} target - The target object the result is written into. + * @return {(Vector2|Vector3)} The dimensions of the source. + */ + getSize(target: (Vector2 | Vector3)): (Vector2 | Vector3); + /** + * When the property is set to `true`, the engine allocates the memory + * for the texture (if necessary) and triggers the actual texture upload + * to the GPU next time the source is used. + * + * @type {boolean} + * @default false + * @param {boolean} value + */ + set needsUpdate(value: boolean); + /** + * Serializes the source into JSON. + * + * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. + * @return {Object} A JSON object representing the serialized source. + * @see {@link ObjectLoader#parse} + */ + toJSON(meta: (Object | string) | null): Object; +} diff --git a/jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts new file mode 100644 index 000000000..bd25d7d01 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts @@ -0,0 +1,44 @@ +/** + * This class can be used as an alternative way to define video data. Instead of using + * an instance of `HTMLVideoElement` like with `VideoTexture`, `VideoFrameTexture` expects each frame is + * defined manually via {@link VideoFrameTexture#setFrame}. A typical use case for this module is when + * video frames are decoded with the WebCodecs API. + * + * ```js + * const texture = new THREE.VideoFrameTexture(); + * texture.setFrame( frame ); + * ``` + * + * @augments VideoTexture + */ +export class VideoFrameTexture extends VideoTexture { + /** + * Constructs a new video frame texture. + * + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + */ + constructor(mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVideoFrameTexture: boolean; + /** + * Sets the current frame of the video. This will automatically update the texture + * so the data can be used for rendering. + * + * @param {VideoFrame} frame - The video frame. + */ + setFrame(frame: VideoFrame): void; +} +import { VideoTexture } from './VideoTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts new file mode 100644 index 000000000..d4ba7a0fd --- /dev/null +++ b/jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts @@ -0,0 +1,59 @@ +/** + * A texture for use with a video. + * + * ```js + * // assuming you have created a HTML video element with id="video" + * const video = document.getElementById( 'video' ); + * const texture = new THREE.VideoTexture( video ); + * ``` + * + * Note: When using video textures with {@link WebGPURenderer}, {@link Texture#colorSpace} must be + * set to THREE.SRGBColorSpace. + * + * Note: After the initial use of a texture, its dimensions, format, and type + * cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one. + * + * @augments Texture + */ +export class VideoTexture extends Texture { + /** + * Constructs a new video texture. + * + * @param {HTMLVideoElement} video - The video element to use as a data source for the texture. + * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. + * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. + * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. + * @param {number} [magFilter=LinearFilter] - The mag filter value. + * @param {number} [minFilter=LinearFilter] - The min filter value. + * @param {number} [format=RGBAFormat] - The texture format. + * @param {number} [type=UnsignedByteType] - The texture type. + * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. + */ + constructor(video: HTMLVideoElement, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); + /** + * This flag can be used for type testing. + * + * @type {boolean} + * @readonly + * @default true + */ + readonly isVideoTexture: boolean; + /** + * The video frame request callback identifier, which is a positive integer. + * + * Value of 0 represents no scheduled rVFC. + * + * @private + * @type {number} + */ + private _requestVideoFrameCallbackId; + clone(): any; + /** + * This method is called automatically by the renderer and sets {@link Texture#needsUpdate} + * to `true` every time a new frame is available. + * + * Only relevant if `requestVideoFrameCallback` is not supported in the browser. + */ + update(): void; +} +import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/utils.d.ts b/jsdoc-testing/jsdoc/src/utils.d.ts new file mode 100644 index 000000000..21c16ba39 --- /dev/null +++ b/jsdoc-testing/jsdoc/src/utils.d.ts @@ -0,0 +1,185 @@ +/** + * Finds the minimum value in an array. + * + * @private + * @param {Array} array - The array to search for the minimum value. + * @return {number} The minimum value in the array, or Infinity if the array is empty. + */ +export function arrayMin(array: Array): number; +/** + * Finds the maximum value in an array. + * + * @private + * @param {Array} array - The array to search for the maximum value. + * @return {number} The maximum value in the array, or -Infinity if the array is empty. + */ +export function arrayMax(array: Array): number; +/** + * Checks if an array contains values that require Uint32 representation. + * + * This function determines whether the array contains any values >= 65535, + * which would require a Uint32Array rather than a Uint16Array for proper storage. + * The function iterates from the end of the array, assuming larger values are + * typically located at the end. + * + * @private + * @param {Array} array - The array to check. + * @return {boolean} True if the array contains values >= 65535, false otherwise. + */ +export function arrayNeedsUint32(array: Array): boolean; +/** + * Creates a typed array of the specified type from the given buffer. + * + * @private + * @param {string} type - The name of the typed array type (e.g., 'Float32Array', 'Uint16Array'). + * @param {ArrayBuffer} buffer - The buffer to create the typed array from. + * @return {TypedArray} A new typed array of the specified type. + */ +export function getTypedArray(type: string, buffer: ArrayBuffer): TypedArray; +/** + * Creates an XHTML element with the specified tag name. + * + * This function uses the XHTML namespace to create DOM elements, + * ensuring proper element creation in XML-based contexts. + * + * @private + * @param {string} name - The tag name of the element to create (e.g., 'canvas', 'div'). + * @return {HTMLElement} The created XHTML element. + */ +export function createElementNS(name: string): HTMLElement; +/** + * Creates a canvas element configured for block display. + * + * This is a convenience function that creates a canvas element with + * display style set to 'block', which is commonly used in three.js + * rendering contexts to avoid inline element spacing issues. + * + * @return {HTMLCanvasElement} A canvas element with display set to 'block'. + */ +export function createCanvasElement(): HTMLCanvasElement; +/** + * Sets a custom function to handle console output. + * + * This allows external code to intercept and handle console.log, console.warn, + * and console.error calls made by three.js, which is useful for custom logging, + * testing, or debugging workflows. + * + * @param {Function} fn - The function to handle console output. Should accept + * (type, message, ...params) where type is 'log', 'warn', or 'error'. + */ +export function setConsoleFunction(fn: Function): void; +/** + * Gets the currently set custom console function. + * + * @return {Function|null} The custom console function, or null if not set. + */ +export function getConsoleFunction(): Function | null; +/** + * Logs an informational message with the 'THREE.' prefix. + * + * If a custom console function is set via setConsoleFunction(), it will be used + * instead of the native console.log. The first parameter is treated as the + * method name and is automatically prefixed with 'THREE.'. + * + * @param {...any} params - The message components. The first param is used as + * the method name and prefixed with 'THREE.'. + */ +export function log(...params: any[]): void; +/** + * Logs a warning message with the 'THREE.' prefix. + * + * If a custom console function is set via setConsoleFunction(), it will be used + * instead of the native console.warn. The first parameter is treated as the + * method name and is automatically prefixed with 'THREE.'. + * + * @param {...any} params - The message components. The first param is used as + * the method name and prefixed with 'THREE.'. + */ +export function warn(...params: any[]): void; +/** + * Logs an error message with the 'THREE.' prefix. + * + * If a custom console function is set via setConsoleFunction(), it will be used + * instead of the native console.error. The first parameter is treated as the + * method name and is automatically prefixed with 'THREE.'. + * + * @param {...any} params - The message components. The first param is used as + * the method name and prefixed with 'THREE.'. + */ +export function error(...params: any[]): void; +/** + * Logs a warning message only once, preventing duplicate warnings. + * + * This function maintains an internal cache of warning messages and will only + * output each unique warning message once. Useful for warnings that may be + * triggered repeatedly but should only be shown to the user once. + * + * @param {...any} params - The warning message components. + */ +export function warnOnce(...params: any[]): void; +/** + * Asynchronously probes for WebGL sync object completion. + * + * This function creates a promise that resolves when the WebGL sync object + * signals completion or rejects if the sync operation fails. It uses polling + * at the specified interval to check the sync status without blocking the + * main thread. This is useful for GPU-CPU synchronization in WebGL contexts. + * + * @private + * @param {WebGL2RenderingContext} gl - The WebGL rendering context. + * @param {WebGLSync} sync - The WebGL sync object to wait for. + * @param {number} interval - The polling interval in milliseconds. + * @return {Promise} A promise that resolves when the sync completes or rejects if it fails. + */ +export function probeAsync(gl: WebGL2RenderingContext, sync: WebGLSync, interval: number): Promise; +/** + * Yields execution to the main thread to allow rendering and other tasks. + * Uses scheduler.yield() when available (Chrome 115+), falls back to requestAnimationFrame. + * + * @return {Promise} + */ +export function yieldToMain(): Promise; +/** + * Converts a projection matrix from normalized device coordinates (NDC) + * range [-1, 1] to [0, 1]. + * + * This conversion is commonly needed when working with depth textures or + * render targets that expect depth values in the [0, 1] range rather than + * the standard OpenGL NDC range of [-1, 1]. The function modifies the + * projection matrix in place. + * + * @private + * @param {Matrix4} projectionMatrix - The projection matrix to convert (modified in place). + */ +export function toNormalizedProjectionMatrix(projectionMatrix: Matrix4): void; +/** + * Reverses the depth range of a projection matrix. + * + * This function inverts the depth mapping of a projection matrix, which is + * useful for reversed-Z depth buffer techniques that can improve depth + * precision. The function handles both perspective and orthographic projection + * matrices differently and modifies the matrix in place. + * + * For perspective matrices (where m[11] === -1), the depth mapping is + * reversed with an offset. For orthographic matrices, a simpler reversal + * is applied. + * + * @private + * @param {Matrix4} projectionMatrix - The projection matrix to reverse (modified in place). + */ +export function toReversedProjectionMatrix(projectionMatrix: Matrix4): void; +/** + * Returns `true` if the given object is a typed array. + * + * @param {any} array - The object to check. + * @return {boolean} Whether the given object is a typed array. + */ +export function isTypedArray(array: any): boolean; +/** + * Used to select the correct depth functions + * when reversed depth buffer is used. + * + * @private + * @type {Object} + */ +export const ReversedDepthFuncs: Object; From cab58e385b0f816125a010f610eb7e407546d282 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 22 Aug 2026 10:08:06 -0400 Subject: [PATCH 3/6] Update patch and delete jsdoc --- jsdoc-testing/changes.patch | 8 +- jsdoc-testing/jsdoc/build/three.module.d.ts | 1868 - jsdoc-testing/jsdoc/build/three.webgpu.d.ts | 24365 ----------- jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts | 275 - .../jsm/animation/AnimationClipCreator.d.ts | 62 - .../examples/jsm/animation/CCDIKSolver.d.ts | 147 - .../examples/jsm/capabilities/WebGL.d.ts | 31 - .../examples/jsm/capabilities/WebGPU.d.ts | 22 - .../jsm/controls/ArcballControls.d.ts | 676 - .../examples/jsm/controls/DragControls.d.ts | 93 - .../jsm/controls/FirstPersonControls.d.ts | 199 - .../examples/jsm/controls/FlyControls.d.ts | 101 - .../examples/jsm/controls/MapControls.d.ts | 18 - .../examples/jsm/controls/OrbitControls.d.ts | 458 - .../jsm/controls/PointerLockControls.d.ts | 105 - .../jsm/controls/TrackballControls.d.ts | 234 - .../jsm/controls/TransformControls.d.ts | 191 - jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts | 214 - .../jsdoc/examples/jsm/csm/CSMFrustum.d.ts | 81 - .../jsdoc/examples/jsm/csm/CSMHelper.d.ts | 55 - .../jsdoc/examples/jsm/csm/CSMShader.d.ts | 11 - .../jsdoc/examples/jsm/csm/CSMShadowNode.d.ts | 176 - .../examples/jsm/curves/CurveExtras.d.ts | 378 - .../jsdoc/examples/jsm/curves/NURBSCurve.d.ts | 70 - .../examples/jsm/curves/NURBSSurface.d.ts | 58 - .../jsdoc/examples/jsm/curves/NURBSUtils.d.ts | 112 - .../examples/jsm/curves/NURBSVolume.d.ts | 38 - .../examples/jsm/effects/AnaglyphEffect.d.ts | 68 - .../examples/jsm/effects/AsciiEffect.d.ts | 72 - .../examples/jsm/effects/OutlineEffect.d.ts | 89 - .../jsm/effects/ParallaxBarrierEffect.d.ts | 36 - .../examples/jsm/effects/StereoEffect.d.ts | 37 - .../jsm/environments/ColorEnvironment.d.ts | 26 - .../jsm/environments/DebugEnvironment.d.ts | 23 - .../jsm/environments/RoomEnvironment.d.ts | 23 - .../examples/jsm/exporters/DRACOExporter.d.ts | 86 - .../examples/jsm/exporters/EXRExporter.d.ts | 45 - .../examples/jsm/exporters/GLTFExporter.d.ts | 135 - .../examples/jsm/exporters/KTX2Exporter.d.ts | 26 - .../examples/jsm/exporters/OBJExporter.d.ts | 23 - .../examples/jsm/exporters/PLYExporter.d.ts | 56 - .../examples/jsm/exporters/STLExporter.d.ts | 36 - .../examples/jsm/exporters/USDZExporter.d.ts | 82 - .../jsm/generators/CityGenerator.d.ts | 72 - .../jsm/generators/ForestGenerator.d.ts | 87 - .../jsm/generators/TerrainGenerator.d.ts | 76 - .../jsm/generators/TreeGenerator.d.ts | 66 - .../generators/city/SidewalkGenerator.d.ts | 43 - .../generators/city/SkyscraperGenerator.d.ts | 65 - .../jsm/geometries/BoxLineGeometry.d.ts | 27 - .../jsm/geometries/ConvexGeometry.d.ts | 23 - .../jsm/geometries/DecalGeometry.d.ts | 40 - .../examples/jsm/geometries/LoftGeometry.d.ts | 75 - .../jsm/geometries/ParametricFunctions.d.ts | 36 - .../jsm/geometries/ParametricGeometry.d.ts | 40 - .../jsm/geometries/RoundedBoxGeometry.d.ts | 26 - .../jsm/geometries/TeapotGeometry.d.ts | 37 - .../examples/jsm/geometries/TextGeometry.d.ts | 92 - .../jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts | 263 - .../examples/jsm/gpgpu/CountingSort.d.ts | 141 - .../jsm/helpers/AnimationPathHelper.d.ts | 130 - .../jsm/helpers/LightProbeGridHelper.d.ts | 41 - .../helpers/LightProbeGridHelperWebGL.d.ts | 35 - .../jsm/helpers/LightProbeHelper.d.ts | 37 - .../jsm/helpers/LightProbeHelperGPU.d.ts | 40 - .../examples/jsm/helpers/OctreeHelper.d.ts | 38 - .../jsm/helpers/PositionalAudioHelper.d.ts | 61 - .../examples/jsm/helpers/RapierHelper.d.ts | 27 - .../jsm/helpers/RectAreaLightHelper.d.ts | 38 - .../examples/jsm/helpers/TextureHelper.d.ts | 29 - .../jsm/helpers/TextureHelperGPU.d.ts | 30 - .../jsm/helpers/VertexNormalsHelper.d.ts | 54 - .../jsm/helpers/VertexTangentsHelper.d.ts | 41 - .../examples/jsm/inspector/Extension.d.ts | 12 - .../examples/jsm/inspector/Inspector.d.ts | 88 - .../jsm/inspector/RendererInspector.d.ts | 44 - .../color-grading/ColorGrading.d.ts | 168 - .../extensions/color-grading/ColorWheel.d.ts | 27 - .../extensions/color-grading/CurveEditor.d.ts | 37 - .../extensions/color-grading/LUT3DStyle.d.ts | 6 - .../extensions/color-grading/LUTMath.d.ts | 505 - .../modules/BrightnessModule.d.ts | 6 - .../modules/ColorWheelModule.d.ts | 9 - .../color-grading/modules/ContrastModule.d.ts | 7 - .../color-grading/modules/CurvesModule.d.ts | 7 - .../modules/ExposureHueModule.d.ts | 7 - .../color-grading/modules/ExposureModule.d.ts | 6 - .../color-grading/modules/HueModule.d.ts | 6 - .../modules/ImportedCubeModule.d.ts | 7 - .../color-grading/modules/Module.d.ts | 48 - .../color-grading/modules/OutputModule.d.ts | 7 - .../color-grading/modules/RendererModule.d.ts | 11 - .../modules/SatVibranceModule.d.ts | 7 - .../modules/SaturationModule.d.ts | 6 - .../color-grading/modules/VibranceModule.d.ts | 6 - .../modules/WhiteBalanceModule.d.ts | 7 - .../extensions/tsl-graph/TSLGraphEditor.d.ts | 43 - .../extensions/tsl-graph/TSLGraphLoader.d.ts | 24 - .../examples/jsm/inspector/tabs/Console.d.ts | 31 - .../examples/jsm/inspector/tabs/Memory.d.ts | 20 - .../jsm/inspector/tabs/Parameters.d.ts | 39 - .../jsm/inspector/tabs/Performance.d.ts | 20 - .../examples/jsm/inspector/tabs/Settings.d.ts | 13 - .../examples/jsm/inspector/tabs/Timeline.d.ts | 153 - .../examples/jsm/inspector/tabs/Viewer.d.ts | 53 - .../examples/jsm/inspector/ui/Graph.d.ts | 23 - .../jsdoc/examples/jsm/inspector/ui/Item.d.ts | 23 - .../jsdoc/examples/jsm/inspector/ui/List.d.ts | 12 - .../examples/jsm/inspector/ui/Profiler.d.ts | 72 - .../examples/jsm/inspector/ui/Style.d.ts | 3 - .../jsdoc/examples/jsm/inspector/ui/Tab.d.ts | 54 - .../examples/jsm/inspector/ui/Values.d.ts | 82 - .../examples/jsm/inspector/ui/utils.d.ts | 10 - .../jsm/interaction/InteractionManager.d.ts | 77 - .../examples/jsm/interactive/HTMLMesh.d.ts | 26 - .../jsm/interactive/InteractiveGroup.d.ts | 81 - .../jsm/interactive/SelectionBox.d.ts | 83 - .../jsm/libs/basis/basis_transcoder.d.ts | 2 - .../jsm/libs/chevrotain.module.min.d.ts | 2 - .../jsdoc/examples/jsm/libs/demuxer_mp4.d.ts | 8 - .../jsm/libs/draco/draco_decoder.d.ts | 5 - .../jsm/libs/draco/draco_wasm_wrapper.d.ts | 5 - .../jsm/libs/draco/gltf/draco_decoder.d.ts | 5 - .../libs/draco/gltf/draco_wasm_wrapper.d.ts | 5 - .../jsdoc/examples/jsm/libs/ecsy.module.d.ts | 344 - .../examples/jsm/libs/ktx-parse.module.d.ts | 299 - .../jsm/libs/meshopt_clusterizer.module.d.ts | 77 - .../jsm/libs/meshopt_decoder.module.d.ts | 19 - .../jsm/libs/meshopt_simplifier.module.d.ts | 25 - .../examples/jsm/libs/mikktspace.module.d.ts | 16 - .../jsm/libs/motion-controllers.module.d.ts | 64 - .../examples/jsm/libs/potpack.module.d.ts | 34 - .../jsdoc/examples/jsm/libs/stats.module.d.ts | 18 - .../jsdoc/examples/jsm/libs/surfaceNet.d.ts | 15 - .../jsdoc/examples/jsm/libs/utif.module.d.ts | 156 - .../examples/jsm/libs/zstddec.module.d.ts | 6 - .../jsm/lighting/ClusteredLighting.d.ts | 42 - .../jsm/lighting/DynamicLighting.d.ts | 54 - .../examples/jsm/lighting/LightProbeGrid.d.ts | 143 - .../jsm/lighting/LightProbeGridWebGL.d.ts | 147 - .../jsm/lights/LightProbeGenerator.d.ts | 30 - .../jsm/lights/RectAreaLightTexturesLib.d.ts | 32 - .../jsm/lights/RectAreaLightUniformsLib.d.ts | 19 - .../jsdoc/examples/jsm/lines/Line2.d.ts | 44 - .../examples/jsm/lines/LineGeometry.d.ts | 58 - .../examples/jsm/lines/LineMaterial.d.ts | 98 - .../examples/jsm/lines/LineSegments2.d.ts | 60 - .../jsm/lines/LineSegmentsGeometry.d.ts | 73 - .../jsdoc/examples/jsm/lines/Wireframe.d.ts | 46 - .../jsm/lines/WireframeGeometry2.d.ts | 30 - .../examples/jsm/lines/webgpu/Line2.d.ts | 33 - .../jsm/lines/webgpu/LineSegments2.d.ts | 51 - .../examples/jsm/lines/webgpu/Wireframe.d.ts | 37 - .../jsdoc/examples/jsm/loaders/3DMLoader.d.ts | 135 - .../jsdoc/examples/jsm/loaders/3MFLoader.d.ts | 67 - .../jsdoc/examples/jsm/loaders/AMFLoader.d.ts | 43 - .../jsdoc/examples/jsm/loaders/BVHLoader.d.ts | 71 - .../examples/jsm/loaders/ColladaLoader.d.ts | 49 - .../jsdoc/examples/jsm/loaders/DDSLoader.d.ts | 30 - .../examples/jsm/loaders/DRACOLoader.d.ts | 125 - .../jsdoc/examples/jsm/loaders/EXRLoader.d.ts | 72 - .../jsdoc/examples/jsm/loaders/FBXLoader.d.ts | 61 - .../examples/jsm/loaders/FontLoader.d.ts | 75 - .../examples/jsm/loaders/GCodeLoader.d.ts | 48 - .../GLTFGaussianSplatLoaderExtension.d.ts | 36 - .../examples/jsm/loaders/GLTFLoader.d.ts | 396 - .../jsm/loaders/GaussianSplatPLYLoader.d.ts | 52 - .../jsm/loaders/HDRCubeTextureLoader.d.ts | 58 - .../jsdoc/examples/jsm/loaders/HDRLoader.d.ts | 44 - .../jsdoc/examples/jsm/loaders/IESLoader.d.ts | 51 - .../jsdoc/examples/jsm/loaders/KMZLoader.d.ts | 38 - .../examples/jsm/loaders/KSPLATLoader.d.ts | 44 - .../examples/jsm/loaders/KTX2Loader.d.ts | 188 - .../jsdoc/examples/jsm/loaders/KTXLoader.d.ts | 34 - .../examples/jsm/loaders/LDrawLoader.d.ts | 256 - .../examples/jsm/loaders/LUT3dlLoader.d.ts | 62 - .../examples/jsm/loaders/LUTCubeLoader.d.ts | 68 - .../examples/jsm/loaders/LUTImageLoader.d.ts | 58 - .../jsdoc/examples/jsm/loaders/LWOLoader.d.ts | 57 - .../jsdoc/examples/jsm/loaders/MD2Loader.d.ts | 43 - .../jsdoc/examples/jsm/loaders/MDDLoader.d.ts | 71 - .../jsdoc/examples/jsm/loaders/MTLLoader.d.ts | 107 - .../examples/jsm/loaders/MaterialXLoader.d.ts | 20 - .../examples/jsm/loaders/NRRDLoader.d.ts | 46 - .../jsdoc/examples/jsm/loaders/OBJLoader.d.ts | 58 - .../jsdoc/examples/jsm/loaders/PCDLoader.d.ts | 67 - .../jsdoc/examples/jsm/loaders/PDBLoader.d.ts | 45 - .../jsdoc/examples/jsm/loaders/PLYLoader.d.ts | 76 - .../jsdoc/examples/jsm/loaders/PVRLoader.d.ts | 30 - .../examples/jsm/loaders/RGBELoader.d.ts | 3 - .../examples/jsm/loaders/SPLATLoader.d.ts | 42 - .../jsdoc/examples/jsm/loaders/SPZLoader.d.ts | 62 - .../jsdoc/examples/jsm/loaders/STLLoader.d.ts | 69 - .../jsdoc/examples/jsm/loaders/SVGLoader.d.ts | 150 - .../jsdoc/examples/jsm/loaders/TDSLoader.d.ts | 141 - .../jsdoc/examples/jsm/loaders/TGALoader.d.ts | 28 - .../examples/jsm/loaders/TIFFLoader.d.ts | 28 - .../jsdoc/examples/jsm/loaders/TTFLoader.d.ts | 48 - .../jsdoc/examples/jsm/loaders/USDLoader.d.ts | 48 - .../examples/jsm/loaders/USDZLoader.d.ts | 3 - .../examples/jsm/loaders/UltraHDRLoader.d.ts | 82 - .../jsdoc/examples/jsm/loaders/VOXLoader.d.ts | 54 - .../examples/jsm/loaders/VRMLLoader.d.ts | 40 - .../jsdoc/examples/jsm/loaders/VTKLoader.d.ts | 48 - .../jsdoc/examples/jsm/loaders/XYZLoader.d.ts | 42 - .../jsm/loaders/collada/ColladaComposer.d.ts | 154 - .../jsm/loaders/collada/ColladaParser.d.ts | 234 - .../examples/jsm/loaders/lwo/IFFParser.d.ts | 121 - .../examples/jsm/loaders/lwo/LWO2Parser.d.ts | 5 - .../examples/jsm/loaders/lwo/LWO3Parser.d.ts | 5 - .../loaders/materialx/MaterialXArchive.d.ts | 10 - .../loaders/materialx/MaterialXDocument.d.ts | 41 - .../loaders/materialx/MaterialXHextile.d.ts | 7 - .../MaterialXInterfaceValidation.d.ts | 1 - .../jsm/loaders/materialx/MaterialXLog.d.ts | 54 - .../MaterialXNodeInterfaceRegistry.d.ts | 33497 ---------------- .../materialx/MaterialXNodeLibrary.d.ts | 1 - .../materialx/MaterialXSurfaceMappings.d.ts | 20 - .../jsm/loaders/materialx/MaterialXUtils.d.ts | 5 - .../compile/MaterialXCompileRegistry.d.ts | 2 - .../materialx/parse/MaterialXParser.d.ts | 2 - .../examples/jsm/loaders/usd/USDAParser.d.ts | 31 - .../examples/jsm/loaders/usd/USDCParser.d.ts | 70 - .../examples/jsm/loaders/usd/USDComposer.d.ts | 238 - .../LDrawConditionalLineMaterial.d.ts | 21 - .../LDrawConditionalLineNodeMaterial.d.ts | 34 - .../jsm/materials/WoodNodeMaterial.d.ts | 38 - .../jsdoc/examples/jsm/math/Capsule.d.ts | 82 - .../examples/jsm/math/ColorConverter.d.ts | 34 - .../jsdoc/examples/jsm/math/ColorSpaces.d.ts | 94 - .../jsdoc/examples/jsm/math/ConvexHull.d.ts | 533 - .../examples/jsm/math/ImprovedNoise.d.ts | 19 - .../jsdoc/examples/jsm/math/Lut.d.ts | 133 - .../examples/jsm/math/MeshSurfaceSampler.d.ts | 95 - .../jsdoc/examples/jsm/math/OBB.d.ts | 150 - .../jsdoc/examples/jsm/math/Octree.d.ts | 195 - .../jsdoc/examples/jsm/math/SimplexNoise.d.ts | 52 - .../jsm/misc/ConvexObjectBreaker.d.ts | 93 - .../jsdoc/examples/jsm/misc/Gyroscope.d.ts | 13 - .../jsdoc/examples/jsm/misc/MD2Character.d.ts | 133 - .../jsm/misc/MD2CharacterComplex.d.ts | 210 - .../examples/jsm/misc/MorphAnimMesh.d.ts | 55 - .../examples/jsm/misc/MorphBlendMesh.d.ts | 124 - .../jsm/misc/ProgressiveLightMap.d.ts | 87 - .../jsm/misc/ProgressiveLightMapGPU.d.ts | 83 - .../examples/jsm/misc/RollerCoaster.d.ts | 69 - .../jsm/misc/TileCreasedNormalsPlugin.d.ts | 49 - .../jsdoc/examples/jsm/misc/TubePainter.d.ts | 68 - .../jsdoc/examples/jsm/misc/Volume.d.ts | 163 - .../jsdoc/examples/jsm/misc/VolumeSlice.d.ts | 99 - .../examples/jsm/modifiers/CurveModifier.d.ts | 79 - .../jsm/modifiers/CurveModifierGPU.d.ts | 37 - .../jsm/modifiers/EdgeSplitModifier.d.ts | 24 - .../jsm/modifiers/SimplifyModifier.d.ts | 27 - .../jsm/modifiers/TessellateModifier.d.ts | 43 - .../examples/jsm/objects/GaussianSplat.d.ts | 126 - .../examples/jsm/objects/GroundedSkybox.d.ts | 30 - .../jsdoc/examples/jsm/objects/Lensflare.d.ts | 120 - .../examples/jsm/objects/LensflareMesh.d.ts | 54 - .../jsm/objects/ReflectorForSSRPass.d.ts | 134 - .../jsdoc/examples/jsm/objects/Refractor.d.ts | 107 - .../examples/jsm/objects/ShadowMesh.d.ts | 48 - .../jsdoc/examples/jsm/objects/Sky.d.ts | 108 - .../jsdoc/examples/jsm/objects/SkyMesh.d.ts | 127 - .../jsdoc/examples/jsm/objects/Water.d.ts | 92 - .../jsdoc/examples/jsm/objects/Water2.d.ts | 145 - .../examples/jsm/objects/Water2Mesh.d.ts | 72 - .../jsdoc/examples/jsm/objects/WaterMesh.d.ts | 127 - .../jsdoc/examples/jsm/offscreen/jank.d.ts | 2 - .../examples/jsm/offscreen/offscreen.d.ts | 1 - .../jsdoc/examples/jsm/offscreen/scene.d.ts | 2 - .../examples/jsm/physics/AmmoPhysics.d.ts | 52 - .../examples/jsm/physics/JoltPhysics.d.ts | 53 - .../examples/jsm/physics/RapierPhysics.d.ts | 98 - .../jsm/postprocessing/AfterimagePass.d.ts | 75 - .../jsm/postprocessing/BloomPass.d.ts | 79 - .../jsm/postprocessing/BokehPass.d.ts | 102 - .../jsm/postprocessing/ClearPass.d.ts | 50 - .../jsm/postprocessing/CubeTexturePass.d.ts | 61 - .../jsm/postprocessing/DotScreenPass.d.ts | 55 - .../jsm/postprocessing/EffectComposer.d.ts | 158 - .../examples/jsm/postprocessing/FXAAPass.d.ts | 25 - .../examples/jsm/postprocessing/FilmPass.d.ts | 53 - .../examples/jsm/postprocessing/GTAOPass.d.ts | 184 - .../jsm/postprocessing/GlitchPass.d.ts | 61 - .../jsm/postprocessing/HalftonePass.d.ts | 66 - .../examples/jsm/postprocessing/LUTPass.d.ts | 27 - .../examples/jsm/postprocessing/MaskPass.d.ts | 79 - .../jsm/postprocessing/OutlinePass.d.ts | 177 - .../jsm/postprocessing/OutputPass.d.ts | 56 - .../examples/jsm/postprocessing/Pass.d.ts | 115 - .../jsm/postprocessing/RenderPass.d.ts | 89 - .../postprocessing/RenderPixelatedPass.d.ts | 101 - .../postprocessing/RenderTransitionPass.d.ts | 107 - .../examples/jsm/postprocessing/SAOPass.d.ts | 97 - .../examples/jsm/postprocessing/SMAAPass.d.ts | 51 - .../jsm/postprocessing/SSAARenderPass.d.ts | 105 - .../examples/jsm/postprocessing/SSAOPass.d.ts | 137 - .../examples/jsm/postprocessing/SSRPass.d.ts | 218 - .../examples/jsm/postprocessing/SavePass.d.ts | 62 - .../jsm/postprocessing/ShaderPass.d.ts | 59 - .../jsm/postprocessing/TAARenderPass.d.ts | 59 - .../jsm/postprocessing/TexturePass.d.ts | 64 - .../jsm/postprocessing/UnrealBloomPass.d.ts | 112 - .../examples/jsm/renderers/CSS2DRenderer.d.ts | 117 - .../examples/jsm/renderers/CSS3DRenderer.d.ts | 121 - .../examples/jsm/renderers/Projector.d.ts | 75 - .../examples/jsm/renderers/SVGRenderer.d.ts | 150 - .../shaders/ACESFilmicToneMappingShader.d.ts | 15 - .../jsm/shaders/AfterimageShader.d.ts | 11 - .../examples/jsm/shaders/BasicShader.d.ts | 11 - .../jsm/shaders/BleachBypassShader.d.ts | 12 - .../examples/jsm/shaders/BlendShader.d.ts | 11 - .../examples/jsm/shaders/BokehShader.d.ts | 12 - .../examples/jsm/shaders/BokehShader2.d.ts | 28 - .../jsm/shaders/BrightnessContrastShader.d.ts | 13 - .../jsm/shaders/ColorCorrectionShader.d.ts | 11 - .../examples/jsm/shaders/ColorifyShader.d.ts | 11 - .../jsm/shaders/ConvolutionShader.d.ts | 11 - .../examples/jsm/shaders/CopyShader.d.ts | 11 - .../examples/jsm/shaders/DOFMipMapShader.d.ts | 13 - .../jsm/shaders/DepthLimitedBlurShader.d.ts | 21 - .../examples/jsm/shaders/DigitalGlitch.d.ts | 11 - .../examples/jsm/shaders/DotScreenShader.d.ts | 11 - .../examples/jsm/shaders/ExposureShader.d.ts | 11 - .../examples/jsm/shaders/FXAAShader.d.ts | 15 - .../examples/jsm/shaders/FilmShader.d.ts | 14 - .../examples/jsm/shaders/FocusShader.d.ts | 11 - .../examples/jsm/shaders/FreiChenShader.d.ts | 14 - .../examples/jsm/shaders/GTAOShader.d.ts | 31 - .../jsm/shaders/GammaCorrectionShader.d.ts | 14 - .../examples/jsm/shaders/HalftoneShader.d.ts | 16 - .../jsm/shaders/HorizontalBlurShader.d.ts | 18 - .../shaders/HorizontalTiltShiftShader.d.ts | 16 - .../jsm/shaders/HueSaturationShader.d.ts | 14 - .../examples/jsm/shaders/KaleidoShader.d.ts | 17 - .../jsm/shaders/LuminosityHighPassShader.d.ts | 11 - .../jsm/shaders/LuminosityShader.d.ts | 11 - .../examples/jsm/shaders/MirrorShader.d.ts | 13 - .../examples/jsm/shaders/NormalMapShader.d.ts | 10 - .../examples/jsm/shaders/OutputShader.d.ts | 14 - .../jsm/shaders/PoissonDenoiseShader.d.ts | 16 - .../examples/jsm/shaders/RGBShiftShader.d.ts | 17 - .../jsdoc/examples/jsm/shaders/SAOShader.d.ts | 13 - .../examples/jsm/shaders/SMAAShader.d.ts | 31 - .../examples/jsm/shaders/SSAOShader.d.ts | 30 - .../jsdoc/examples/jsm/shaders/SSRShader.d.ts | 30 - .../examples/jsm/shaders/SepiaShader.d.ts | 11 - .../jsm/shaders/SobelOperatorShader.d.ts | 13 - .../shaders/SubsurfaceScatteringShader.d.ts | 13 - .../jsm/shaders/TechnicolorShader.d.ts | 13 - .../examples/jsm/shaders/ToonShader.d.ts | 34 - .../jsm/shaders/TriangleBlurShader.d.ts | 15 - .../jsm/shaders/UnpackDepthRGBAShader.d.ts | 11 - .../examples/jsm/shaders/VelocityShader.d.ts | 11 - .../jsm/shaders/VerticalBlurShader.d.ts | 16 - .../jsm/shaders/VerticalTiltShiftShader.d.ts | 16 - .../examples/jsm/shaders/VignetteShader.d.ts | 11 - .../examples/jsm/shaders/VolumeShader.d.ts | 13 - .../jsm/shaders/WaterRefractionShader.d.ts | 11 - .../examples/jsm/textures/FlakesTexture.d.ts | 17 - .../jsdoc/examples/jsm/transpiler/AST.d.ts | 191 - .../examples/jsm/transpiler/GLSLDecoder.d.ts | 76 - .../jsdoc/examples/jsm/transpiler/Linker.d.ts | 17 - .../jsm/transpiler/ShaderToyDecoder.d.ts | 4 - .../examples/jsm/transpiler/TSLEncoder.d.ts | 31 - .../examples/jsm/transpiler/Transpiler.d.ts | 48 - .../jsm/transpiler/TranspilerUtils.d.ts | 4 - .../examples/jsm/transpiler/WGSLEncoder.d.ts | 24 - .../jsm/tsl/display/AfterImageNode.d.ts | 93 - .../jsm/tsl/display/AnaglyphPassNode.d.ts | 135 - .../jsm/tsl/display/BilateralBlurNode.d.ts | 138 - .../jsm/tsl/display/BleachBypass.d.ts | 10 - .../examples/jsm/tsl/display/BloomNode.d.ts | 247 - .../jsdoc/examples/jsm/tsl/display/CRT.d.ts | 58 - .../tsl/display/ChromaticAberrationNode.d.ts | 53 - .../examples/jsm/tsl/display/DenoiseNode.d.ts | 115 - .../jsm/tsl/display/DepthOfFieldNode.d.ts | 212 - .../jsm/tsl/display/DotScreenNode.d.ts | 44 - .../examples/jsm/tsl/display/FSR1Node.d.ts | 112 - .../examples/jsm/tsl/display/FXAANode.d.ts | 44 - .../examples/jsm/tsl/display/FilmNode.d.ts | 56 - .../examples/jsm/tsl/display/GTAONode.d.ts | 259 - .../jsm/tsl/display/GaussianBlurNode.d.ts | 168 - .../examples/jsm/tsl/display/GodraysNode.d.ts | 201 - .../display/ImportanceSampledEnvironment.d.ts | 102 - .../jsm/tsl/display/LensflareNode.d.ts | 132 - .../examples/jsm/tsl/display/Lut3DNode.d.ts | 51 - .../examples/jsm/tsl/display/MotionBlur.d.ts | 11 - .../examples/jsm/tsl/display/OITPassNode.d.ts | 105 - .../examples/jsm/tsl/display/OutlineNode.d.ts | 351 - .../tsl/display/ParallaxBarrierPassNode.d.ts | 26 - .../jsm/tsl/display/PixelationPassNode.d.ts | 134 - .../jsm/tsl/display/RGBShiftNode.d.ts | 45 - .../jsm/tsl/display/RetroPassNode.d.ts | 40 - .../examples/jsm/tsl/display/SMAANode.d.ts | 166 - .../jsm/tsl/display/SSAAPassNode.d.ts | 83 - .../examples/jsm/tsl/display/SSAONode.d.ts | 213 - .../examples/jsm/tsl/display/SSGINode.d.ts | 277 - .../examples/jsm/tsl/display/SSRNode.d.ts | 507 - .../examples/jsm/tsl/display/SSSNode.d.ts | 226 - .../jsdoc/examples/jsm/tsl/display/Sepia.d.ts | 9 - .../jsdoc/examples/jsm/tsl/display/Shape.d.ts | 12 - .../examples/jsm/tsl/display/SharpenNode.d.ts | 96 - .../jsm/tsl/display/SobelOperatorNode.d.ts | 45 - .../tsl/display/StereoCompositePassNode.d.ts | 87 - .../jsm/tsl/display/StereoPassNode.d.ts | 40 - .../examples/jsm/tsl/display/TAAUNode.d.ts | 275 - .../examples/jsm/tsl/display/TRAANode.d.ts | 239 - .../jsm/tsl/display/TransitionNode.d.ts | 65 - .../examples/jsm/tsl/display/boxBlur.d.ts | 24 - .../jsm/tsl/display/depthAwareBlend.d.ts | 17 - .../jsm/tsl/display/depthAwareBlur.d.ts | 20 - .../examples/jsm/tsl/display/hashBlur.d.ts | 22 - .../examples/jsm/tsl/display/radialBlur.d.ts | 20 - .../jsm/tsl/lighting/ClusteredLightsNode.d.ts | 80 - .../jsm/tsl/lighting/DynamicLightsNode.d.ts | 38 - .../jsm/tsl/lighting/LightProbeGridNode.d.ts | 21 - .../lighting/data/AmbientLightDataNode.d.ts | 17 - .../data/DirectionalLightDataNode.d.ts | 24 - .../data/HemisphereLightDataNode.d.ts | 24 - .../tsl/lighting/data/PointLightDataNode.d.ts | 26 - .../tsl/lighting/data/SpotLightDataNode.d.ts | 30 - .../jsdoc/examples/jsm/tsl/math/Bayer.d.ts | 29 - .../examples/jsm/tsl/math/curlNoise.d.ts | 36 - .../examples/jsm/tsl/math/voronoiNoise.d.ts | 50 - .../jsm/tsl/shadows/TileShadowNode.d.ts | 115 - .../jsm/tsl/shadows/TileShadowNodeHelper.d.ts | 29 - .../jsm/tsl/utils/GroundedSkybox.d.ts | 15 - .../jsdoc/examples/jsm/tsl/utils/RNoise.d.ts | 10 - .../examples/jsm/tsl/utils/Raymarching.d.ts | 1 - .../examples/jsm/tsl/utils/SoftParticles.d.ts | 19 - .../jsm/tsl/utils/SpecularHelpers.d.ts | 65 - .../jsm/utils/BufferGeometryUtils.d.ts | 124 - .../jsdoc/examples/jsm/utils/CameraUtils.d.ts | 14 - .../jsdoc/examples/jsm/utils/ColorUtils.d.ts | 20 - .../jsm/utils/GaussianSplatUtils.d.ts | 28 - .../jsm/utils/GeometryCompressionUtils.d.ts | 23 - .../examples/jsm/utils/GeometryUtils.d.ts | 48 - .../jsdoc/examples/jsm/utils/LDrawUtils.d.ts | 17 - .../examples/jsm/utils/SceneOptimizer.d.ts | 72 - .../jsdoc/examples/jsm/utils/SceneUtils.d.ts | 72 - .../examples/jsm/utils/ShadowMapViewer.d.ts | 72 - .../jsm/utils/ShadowMapViewerGPU.d.ts | 71 - .../examples/jsm/utils/SkeletonUtils.d.ts | 97 - .../jsdoc/examples/jsm/utils/SortUtils.d.ts | 1 - .../jsdoc/examples/jsm/utils/UVsDebug.d.ts | 16 - .../examples/jsm/utils/WebGLTextureUtils.d.ts | 14 - .../jsm/utils/WebGPUTextureUtils.d.ts | 15 - .../jsdoc/examples/jsm/utils/WorkerPool.d.ts | 79 - .../jsdoc/examples/jsm/webxr/ARButton.d.ts | 22 - .../examples/jsm/webxr/OculusHandModel.d.ts | 87 - .../jsm/webxr/OculusHandPointerModel.d.ts | 146 - .../jsdoc/examples/jsm/webxr/Text2D.d.ts | 15 - .../jsdoc/examples/jsm/webxr/VRButton.d.ts | 31 - .../examples/jsm/webxr/WebGLXRFallback.d.ts | 8 - .../jsdoc/examples/jsm/webxr/XRButton.d.ts | 26 - .../jsm/webxr/XRControllerModelFactory.d.ts | 96 - .../examples/jsm/webxr/XREstimatedLight.d.ts | 39 - .../examples/jsm/webxr/XRHandMeshModel.d.ts | 44 - .../jsm/webxr/XRHandModelFactory.d.ts | 102 - .../jsm/webxr/XRHandPrimitiveModel.d.ts | 54 - .../jsdoc/examples/jsm/webxr/XRPlanes.d.ts | 22 - jsdoc-testing/jsdoc/src/Three.Core.d.ts | 163 - jsdoc-testing/jsdoc/src/Three.Legacy.d.ts | 1 - .../jsdoc/src/Three.WebGPU.Nodes.d.ts | 30 - jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts | 40 - jsdoc-testing/jsdoc/src/Three.d.ts | 9 - .../jsdoc/src/animation/AnimationAction.d.ts | 311 - .../jsdoc/src/animation/AnimationClip.d.ts | 154 - .../jsdoc/src/animation/AnimationMixer.d.ts | 152 - .../src/animation/AnimationObjectGroup.d.ts | 77 - .../jsdoc/src/animation/AnimationUtils.d.ts | 131 - .../jsdoc/src/animation/KeyframeTrack.d.ts | 178 - .../jsdoc/src/animation/PropertyBinding.d.ts | 144 - .../jsdoc/src/animation/PropertyMixer.d.ts | 95 - .../tracks/BooleanKeyframeTrack.d.ts | 28 - .../animation/tracks/ColorKeyframeTrack.d.ts | 17 - .../animation/tracks/NumberKeyframeTrack.d.ts | 17 - .../tracks/QuaternionKeyframeTrack.d.ts | 18 - .../animation/tracks/StringKeyframeTrack.d.ts | 28 - .../animation/tracks/VectorKeyframeTrack.d.ts | 17 - jsdoc-testing/jsdoc/src/audio/Audio.d.ts | 379 - .../jsdoc/src/audio/AudioAnalyser.d.ts | 65 - .../jsdoc/src/audio/AudioContext.d.ts | 19 - .../jsdoc/src/audio/AudioListener.d.ts | 91 - .../jsdoc/src/audio/PositionalAudio.d.ts | 115 - .../jsdoc/src/cameras/ArrayCamera.d.ts | 42 - jsdoc-testing/jsdoc/src/cameras/Camera.d.ts | 56 - .../jsdoc/src/cameras/CubeCamera.d.ts | 74 - .../jsdoc/src/cameras/OrthographicCamera.d.ts | 122 - .../jsdoc/src/cameras/PerspectiveCamera.d.ts | 216 - .../jsdoc/src/cameras/StereoCamera.d.ts | 61 - jsdoc-testing/jsdoc/src/constants.d.ts | 1617 - .../jsdoc/src/core/BufferAttribute.d.ts | 487 - .../jsdoc/src/core/BufferGeometry.d.ts | 403 - jsdoc-testing/jsdoc/src/core/Clock.d.ts | 73 - .../jsdoc/src/core/EventDispatcher.d.ts | 53 - .../jsdoc/src/core/GLBufferAttribute.d.ts | 122 - .../src/core/InstancedBufferAttribute.d.ts | 36 - .../src/core/InstancedBufferGeometry.d.ts | 22 - .../src/core/InstancedInterleavedBuffer.d.ts | 35 - .../jsdoc/src/core/InterleavedBuffer.d.ts | 153 - .../src/core/InterleavedBufferAttribute.d.ts | 226 - jsdoc-testing/jsdoc/src/core/Layers.d.ts | 68 - jsdoc-testing/jsdoc/src/core/Object3D.d.ts | 606 - jsdoc-testing/jsdoc/src/core/Raycaster.d.ts | 149 - .../jsdoc/src/core/RenderTarget.d.ts | 269 - .../jsdoc/src/core/RenderTarget3D.d.ts | 25 - jsdoc-testing/jsdoc/src/core/Timer.d.ts | 86 - jsdoc-testing/jsdoc/src/core/Uniform.d.ts | 34 - .../jsdoc/src/core/UniformsGroup.d.ts | 87 - jsdoc-testing/jsdoc/src/extras/Controls.d.ts | 93 - jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts | 39 - jsdoc-testing/jsdoc/src/extras/Earcut.d.ts | 18 - .../jsdoc/src/extras/ImageUtils.d.ts | 22 - .../jsdoc/src/extras/PMREMGenerator.d.ts | 520 - .../jsdoc/src/extras/ShapeUtils.d.ts | 29 - .../jsdoc/src/extras/TextureUtils.d.ts | 81 - .../jsdoc/src/extras/core/Curve.d.ts | 170 - .../jsdoc/src/extras/core/CurvePath.d.ts | 56 - .../jsdoc/src/extras/core/Interpolations.d.ts | 39 - jsdoc-testing/jsdoc/src/extras/core/Path.d.ts | 151 - .../jsdoc/src/extras/core/Shape.d.ts | 76 - .../jsdoc/src/extras/core/ShapePath.d.ts | 93 - .../jsdoc/src/extras/curves/ArcCurve.d.ts | 27 - .../src/extras/curves/CatmullRomCurve3.d.ts | 83 - .../src/extras/curves/CubicBezierCurve.d.ts | 78 - .../src/extras/curves/CubicBezierCurve3.d.ts | 61 - .../jsdoc/src/extras/curves/Curves.d.ts | 10 - .../jsdoc/src/extras/curves/EllipseCurve.d.ts | 117 - .../jsdoc/src/extras/curves/LineCurve.d.ts | 50 - .../jsdoc/src/extras/curves/LineCurve3.d.ts | 50 - .../extras/curves/QuadraticBezierCurve.d.ts | 70 - .../extras/curves/QuadraticBezierCurve3.d.ts | 54 - .../jsdoc/src/extras/curves/SplineCurve.d.ts | 59 - .../jsdoc/src/extras/lib/earcut.d.ts | 7 - .../jsdoc/src/geometries/BoxGeometry.d.ts | 46 - .../jsdoc/src/geometries/CapsuleGeometry.d.ts | 43 - .../jsdoc/src/geometries/CircleGeometry.d.ts | 48 - .../jsdoc/src/geometries/ConeGeometry.d.ts | 29 - .../src/geometries/CylinderGeometry.d.ts | 47 - .../src/geometries/DodecahedronGeometry.d.ts | 23 - .../jsdoc/src/geometries/EdgesGeometry.d.ts | 34 - .../jsdoc/src/geometries/ExtrudeGeometry.d.ts | 97 - .../jsdoc/src/geometries/Geometries.d.ts | 21 - .../src/geometries/IcosahedronGeometry.d.ts | 23 - .../jsdoc/src/geometries/LatheGeometry.d.ts | 50 - .../src/geometries/OctahedronGeometry.d.ts | 23 - .../jsdoc/src/geometries/PlaneGeometry.d.ts | 42 - .../src/geometries/PolyhedronGeometry.d.ts | 36 - .../jsdoc/src/geometries/RingGeometry.d.ts | 44 - .../jsdoc/src/geometries/ShapeGeometry.d.ts | 47 - .../jsdoc/src/geometries/SphereGeometry.d.ts | 45 - .../src/geometries/TetrahedronGeometry.d.ts | 23 - .../jsdoc/src/geometries/TorusGeometry.d.ts | 45 - .../src/geometries/TorusKnotGeometry.d.ts | 46 - .../jsdoc/src/geometries/TubeGeometry.d.ts | 60 - .../src/geometries/WireframeGeometry.d.ts | 38 - .../jsdoc/src/helpers/ArrowHelper.d.ts | 70 - .../jsdoc/src/helpers/AxesHelper.d.ts | 30 - .../jsdoc/src/helpers/Box3Helper.d.ts | 30 - .../jsdoc/src/helpers/BoxHelper.d.ts | 39 - .../jsdoc/src/helpers/CameraHelper.d.ts | 59 - .../src/helpers/DirectionalLightHelper.d.ts | 63 - .../jsdoc/src/helpers/GridHelper.d.ts | 27 - .../src/helpers/HemisphereLightHelper.d.ts | 50 - .../jsdoc/src/helpers/PlaneHelper.d.ts | 36 - .../jsdoc/src/helpers/PointLightHelper.d.ts | 47 - .../jsdoc/src/helpers/PolarGridHelper.d.ts | 31 - .../jsdoc/src/helpers/SkeletonHelper.d.ts | 51 - .../jsdoc/src/helpers/SpotLightHelper.d.ts | 49 - .../jsdoc/src/lights/AmbientLight.d.ts | 30 - .../jsdoc/src/lights/DirectionalLight.d.ts | 67 - .../src/lights/DirectionalLightShadow.d.ts | 20 - .../jsdoc/src/lights/HemisphereLight.d.ts | 40 - jsdoc-testing/jsdoc/src/lights/Light.d.ts | 42 - .../jsdoc/src/lights/LightProbe.d.ts | 45 - .../jsdoc/src/lights/LightShadow.d.ts | 215 - .../jsdoc/src/lights/PointLight.d.ts | 70 - .../jsdoc/src/lights/PointLightShadow.d.ts | 20 - .../jsdoc/src/lights/RectAreaLight.d.ts | 68 - jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts | 116 - .../jsdoc/src/lights/SpotLightShadow.d.ts | 37 - jsdoc-testing/jsdoc/src/lights/SunLight.d.ts | 48 - .../jsdoc/src/lights/SunLightShadow.d.ts | 67 - .../jsdoc/src/lights/webgpu/IESSpotLight.d.ts | 18 - .../src/lights/webgpu/ProjectorLight.d.ts | 17 - .../jsdoc/src/loaders/AnimationLoader.d.ts | 32 - .../jsdoc/src/loaders/AudioLoader.d.ts | 30 - .../src/loaders/BufferGeometryLoader.d.ts | 35 - .../src/loaders/CompressedTextureLoader.d.ts | 61 - .../jsdoc/src/loaders/CubeTextureLoader.d.ts | 45 - .../jsdoc/src/loaders/DataTextureLoader.d.ts | 109 - .../jsdoc/src/loaders/FileLoader.d.ts | 68 - .../jsdoc/src/loaders/ImageBitmapLoader.d.ts | 79 - .../jsdoc/src/loaders/ImageLoader.d.ts | 29 - jsdoc-testing/jsdoc/src/loaders/Loader.d.ts | 141 - .../jsdoc/src/loaders/LoaderUtils.d.ts | 22 - .../jsdoc/src/loaders/MaterialLoader.d.ts | 72 - .../jsdoc/src/loaders/ObjectLoader.d.ts | 91 - .../jsdoc/src/loaders/TextureLoader.d.ts | 33 - .../jsdoc/src/loaders/nodes/NodeLoader.d.ts | 84 - .../src/loaders/nodes/NodeMaterialLoader.d.ts | 57 - .../src/loaders/nodes/NodeObjectLoader.d.ts | 96 - .../src/materials/LineBasicMaterial.d.ts | 90 - .../src/materials/LineDashedMaterial.d.ts | 49 - .../jsdoc/src/materials/Material.d.ts | 508 - .../jsdoc/src/materials/Materials.d.ts | 19 - .../src/materials/MeshBasicMaterial.d.ts | 208 - .../src/materials/MeshDepthMaterial.d.ts | 116 - .../src/materials/MeshDistanceMaterial.d.ts | 96 - .../src/materials/MeshLambertMaterial.d.ts | 344 - .../src/materials/MeshMatcapMaterial.d.ts | 204 - .../src/materials/MeshNormalMaterial.d.ts | 135 - .../src/materials/MeshPhongMaterial.d.ts | 359 - .../src/materials/MeshPhysicalMaterial.d.ts | 362 - .../src/materials/MeshStandardMaterial.d.ts | 367 - .../jsdoc/src/materials/MeshToonMaterial.d.ts | 275 - .../jsdoc/src/materials/PointsMaterial.d.ts | 109 - .../src/materials/RawShaderMaterial.d.ts | 111 - .../jsdoc/src/materials/ShaderMaterial.d.ts | 266 - .../jsdoc/src/materials/ShadowMaterial.d.ts | 56 - .../jsdoc/src/materials/SpriteMaterial.d.ts | 96 - .../materials/nodes/Line2NodeMaterial.d.ts | 87 - .../nodes/LineBasicNodeMaterial.d.ts | 23 - .../nodes/LineDashedNodeMaterial.d.ts | 78 - .../nodes/MeshBasicNodeMaterial.d.ts | 39 - .../nodes/MeshLambertNodeMaterial.d.ts | 39 - .../nodes/MeshMatcapNodeMaterial.d.ts | 29 - .../nodes/MeshNormalNodeMaterial.d.ts | 28 - .../nodes/MeshPhongNodeMaterial.d.ts | 63 - .../nodes/MeshPhysicalNodeMaterial.d.ts | 295 - .../materials/nodes/MeshSSSNodeMaterial.d.ts | 84 - .../nodes/MeshStandardNodeMaterial.d.ts | 80 - .../materials/nodes/MeshToonNodeMaterial.d.ts | 30 - .../src/materials/nodes/NodeMaterial.d.ts | 524 - .../src/materials/nodes/NodeMaterials.d.ts | 18 - .../materials/nodes/PointsNodeMaterial.d.ts | 49 - .../materials/nodes/ShadowNodeMaterial.d.ts | 30 - .../materials/nodes/SpriteNodeMaterial.d.ts | 61 - .../materials/nodes/VolumeNodeMaterial.d.ts | 48 - .../nodes/manager/NodeMaterialObserver.d.ts | 147 - jsdoc-testing/jsdoc/src/math/Box2.d.ts | 205 - jsdoc-testing/jsdoc/src/math/Box3.d.ts | 298 - jsdoc-testing/jsdoc/src/math/Color.d.ts | 538 - .../jsdoc/src/math/ColorManagement.d.ts | 21 - jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts | 74 - jsdoc-testing/jsdoc/src/math/Euler.d.ts | 164 - jsdoc-testing/jsdoc/src/math/Frustum.d.ts | 109 - .../jsdoc/src/math/FrustumArray.d.ts | 96 - jsdoc-testing/jsdoc/src/math/Interpolant.d.ts | 114 - jsdoc-testing/jsdoc/src/math/Line3.d.ts | 120 - jsdoc-testing/jsdoc/src/math/MathUtils.d.ts | 224 - jsdoc-testing/jsdoc/src/math/Matrix2.d.ts | 70 - jsdoc-testing/jsdoc/src/math/Matrix3.d.ts | 254 - jsdoc-testing/jsdoc/src/math/Matrix4.d.ts | 411 - jsdoc-testing/jsdoc/src/math/Plane.d.ts | 203 - jsdoc-testing/jsdoc/src/math/Quaternion.d.ts | 310 - jsdoc-testing/jsdoc/src/math/Ray.d.ts | 185 - jsdoc-testing/jsdoc/src/math/Sphere.d.ts | 185 - jsdoc-testing/jsdoc/src/math/Spherical.d.ts | 81 - .../jsdoc/src/math/SphericalHarmonics3.d.ts | 131 - jsdoc-testing/jsdoc/src/math/Triangle.d.ts | 231 - jsdoc-testing/jsdoc/src/math/Vector2.d.ts | 440 - jsdoc-testing/jsdoc/src/math/Vector3.d.ts | 613 - jsdoc-testing/jsdoc/src/math/Vector4.d.ts | 443 - .../math/interpolants/BezierInterpolant.d.ts | 21 - .../math/interpolants/CubicInterpolant.d.ts | 22 - .../interpolants/DiscreteInterpolant.d.ts | 10 - .../math/interpolants/LinearInterpolant.d.ts | 9 - .../QuaternionLinearInterpolant.d.ts | 9 - jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts | 138 - jsdoc-testing/jsdoc/src/nodes/TSL.d.ts | 144 - .../src/nodes/accessors/AccessorsUtils.d.ts | 23 - .../jsdoc/src/nodes/accessors/Arrays.d.ts | 2 - .../jsdoc/src/nodes/accessors/Batch.d.ts | 22 - .../jsdoc/src/nodes/accessors/Bitangent.d.ts | 28 - .../nodes/accessors/BufferAttributeNode.d.ts | 143 - .../jsdoc/src/nodes/accessors/BufferNode.d.ts | 75 - .../src/nodes/accessors/BuiltinNode.d.ts | 40 - .../jsdoc/src/nodes/accessors/Camera.d.ts | 70 - .../src/nodes/accessors/ClippingNode.d.ts | 65 - .../src/nodes/accessors/CubeTextureNode.d.ts | 48 - .../jsdoc/src/nodes/accessors/Instance.d.ts | 24 - .../jsdoc/src/nodes/accessors/Lights.d.ts | 48 - .../src/nodes/accessors/MaterialNode.d.ts | 392 - .../nodes/accessors/MaterialProperties.d.ts | 24 - .../accessors/MaterialReferenceNode.d.ts | 41 - .../jsdoc/src/nodes/accessors/ModelNode.d.ts | 104 - .../accessors/ModelViewProjectionNode.d.ts | 7 - .../jsdoc/src/nodes/accessors/Morph.d.ts | 9 - .../jsdoc/src/nodes/accessors/Normal.d.ts | 100 - .../src/nodes/accessors/Object3DNode.d.ts | 128 - .../src/nodes/accessors/PointUVNode.d.ts | 33 - .../jsdoc/src/nodes/accessors/Position.d.ts | 61 - .../nodes/accessors/ReferenceBaseNode.d.ts | 141 - .../nodes/accessors/ReferenceElementNode.d.ts | 42 - .../src/nodes/accessors/ReferenceNode.d.ts | 157 - .../src/nodes/accessors/ReflectVector.d.ts | 28 - .../accessors/RendererReferenceNode.d.ts | 33 - .../src/nodes/accessors/SceneProperties.d.ts | 21 - .../jsdoc/src/nodes/accessors/Skinning.d.ts | 19 - .../nodes/accessors/StorageBufferNode.d.ts | 183 - .../nodes/accessors/StorageTexture3DNode.d.ts | 36 - .../nodes/accessors/StorageTextureNode.d.ts | 146 - .../jsdoc/src/nodes/accessors/Tangent.d.ts | 28 - .../src/nodes/accessors/TangentUtils.d.ts | 20 - .../src/nodes/accessors/Texture3DNode.d.ts | 54 - .../src/nodes/accessors/TextureBicubic.d.ts | 20 - .../src/nodes/accessors/TextureNode.d.ts | 369 - .../src/nodes/accessors/TextureSizeNode.d.ts | 50 - .../jsdoc/src/nodes/accessors/UV.d.ts | 1 - .../src/nodes/accessors/UniformArrayNode.d.ts | 132 - .../src/nodes/accessors/UserDataNode.d.ts | 35 - .../src/nodes/accessors/VelocityNode.d.ts | 79 - .../src/nodes/accessors/VertexColorNode.d.ts | 31 - .../jsdoc/src/nodes/code/CodeNode.d.ts | 79 - .../jsdoc/src/nodes/code/ExpressionNode.d.ts | 35 - .../src/nodes/code/FunctionCallNode.d.ts | 70 - .../jsdoc/src/nodes/code/FunctionNode.d.ts | 70 - .../jsdoc/src/nodes/core/ArrayNode.d.ts | 76 - .../jsdoc/src/nodes/core/AssignNode.d.ts | 65 - .../jsdoc/src/nodes/core/AttributeNode.d.ts | 41 - .../jsdoc/src/nodes/core/BypassNode.d.ts | 54 - .../jsdoc/src/nodes/core/ConstNode.d.ts | 25 - .../jsdoc/src/nodes/core/ContextNode.d.ts | 107 - .../jsdoc/src/nodes/core/IndexNode.d.ts | 88 - .../jsdoc/src/nodes/core/InputNode.d.ts | 61 - .../jsdoc/src/nodes/core/InspectorNode.d.ts | 57 - .../jsdoc/src/nodes/core/IsolateNode.d.ts | 55 - .../jsdoc/src/nodes/core/LightingModel.d.ts | 59 - .../jsdoc/src/nodes/core/MRTNode.d.ts | 132 - jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts | 438 - .../jsdoc/src/nodes/core/NodeAttribute.d.ts | 44 - .../jsdoc/src/nodes/core/NodeBuilder.d.ts | 1380 - .../jsdoc/src/nodes/core/NodeCache.d.ts | 47 - .../jsdoc/src/nodes/core/NodeCode.d.ts | 36 - .../jsdoc/src/nodes/core/NodeError.d.ts | 13 - .../jsdoc/src/nodes/core/NodeFrame.d.ts | 133 - .../jsdoc/src/nodes/core/NodeFunction.d.ts | 55 - .../src/nodes/core/NodeFunctionInput.d.ts | 52 - .../jsdoc/src/nodes/core/NodeParser.d.ts | 15 - .../jsdoc/src/nodes/core/NodeUniform.d.ts | 62 - .../jsdoc/src/nodes/core/NodeUtils.d.ts | 103 - .../jsdoc/src/nodes/core/NodeVar.d.ts | 50 - .../jsdoc/src/nodes/core/NodeVarying.d.ts | 51 - .../src/nodes/core/OutputStructNode.d.ts | 41 - .../src/nodes/core/OverrideContextNode.d.ts | 67 - .../jsdoc/src/nodes/core/ParameterNode.d.ts | 35 - .../jsdoc/src/nodes/core/PropertyNode.d.ts | 277 - .../jsdoc/src/nodes/core/StackNode.d.ts | 150 - .../jsdoc/src/nodes/core/StackTrace.d.ts | 44 - .../jsdoc/src/nodes/core/StructNode.d.ts | 33 - .../jsdoc/src/nodes/core/StructType.d.ts | 7 - .../jsdoc/src/nodes/core/StructTypeNode.d.ts | 49 - .../jsdoc/src/nodes/core/SubBuildNode.d.ts | 30 - .../jsdoc/src/nodes/core/TempNode.d.ts | 28 - .../src/nodes/core/UniformGroupNode.d.ts | 78 - .../jsdoc/src/nodes/core/UniformNode.d.ts | 73 - .../jsdoc/src/nodes/core/VarNode.d.ts | 88 - .../jsdoc/src/nodes/core/VaryingNode.d.ts | 80 - .../jsdoc/src/nodes/core/constants.d.ts | 30 - .../jsdoc/src/nodes/display/BlendModes.d.ts | 67 - .../jsdoc/src/nodes/display/BumpMapNode.d.ts | 44 - .../src/nodes/display/ColorAdjustment.d.ts | 76 - .../nodes/display/ColorSpaceFunctions.d.ts | 18 - .../src/nodes/display/ColorSpaceNode.d.ts | 50 - .../src/nodes/display/FrontFacingNode.d.ts | 53 - .../src/nodes/display/NormalMapNode.d.ts | 58 - .../jsdoc/src/nodes/display/PassNode.d.ts | 432 - .../display/PremultiplyAlphaFunctions.d.ts | 28 - .../src/nodes/display/RenderOutputNode.d.ts | 79 - .../jsdoc/src/nodes/display/ScreenNode.d.ts | 113 - .../nodes/display/ToneMappingFunctions.d.ts | 68 - .../src/nodes/display/ToneMappingNode.d.ts | 60 - .../nodes/display/ToonOutlinePassNode.d.ts | 71 - .../src/nodes/display/ViewportDepthNode.d.ts | 105 - .../display/ViewportDepthTextureNode.d.ts | 31 - .../display/ViewportSharedTextureNode.d.ts | 37 - .../nodes/display/ViewportTextureNode.d.ts | 89 - jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts | 38 - .../src/nodes/functions/BSDF/BRDF_GGX.d.ts | 2 - .../nodes/functions/BSDF/BRDF_Lambert.d.ts | 2 - .../src/nodes/functions/BSDF/BRDF_Sheen.d.ts | 2 - .../src/nodes/functions/BSDF/DFGLUT.d.ts | 2 - .../jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts | 2 - .../functions/BSDF/D_GGX_Anisotropic.d.ts | 2 - .../nodes/functions/BSDF/EnvironmentBRDF.d.ts | 2 - .../src/nodes/functions/BSDF/F_Schlick.d.ts | 2 - .../jsdoc/src/nodes/functions/BSDF/LTC.d.ts | 3 - .../nodes/functions/BSDF/Schlick_to_F0.d.ts | 2 - .../functions/BSDF/V_GGX_SmithCorrelated.d.ts | 2 - .../V_GGX_SmithCorrelated_Anisotropic.d.ts | 2 - .../nodes/functions/BasicLightingModel.d.ts | 23 - .../nodes/functions/PhongLightingModel.d.ts | 31 - .../functions/PhysicalLightingModel.d.ts | 186 - .../src/nodes/functions/ShadowMaskModel.d.ts | 27 - .../nodes/functions/ToonLightingModel.d.ts | 23 - .../functions/VolumetricLightingModel.d.ts | 25 - .../material/getAlphaHashThreshold.d.ts | 2 - .../material/getGeometryRoughness.d.ts | 2 - .../material/getParallaxCorrectNormal.d.ts | 19 - .../functions/material/getRoughness.d.ts | 2 - .../functions/material/getShIrradianceAt.d.ts | 2 - .../jsdoc/src/nodes/geometry/RangeNode.d.ts | 68 - .../src/nodes/gpgpu/AtomicFunctionNode.d.ts | 78 - .../jsdoc/src/nodes/gpgpu/BarrierNode.d.ts | 24 - .../src/nodes/gpgpu/ComputeBuiltinNode.d.ts | 135 - .../jsdoc/src/nodes/gpgpu/ComputeNode.d.ts | 96 - .../src/nodes/gpgpu/SubgroupFunctionNode.d.ts | 303 - .../src/nodes/gpgpu/WorkgroupInfoNode.d.ts | 119 - .../jsdoc/src/nodes/lighting/AONode.d.ts | 25 - .../src/nodes/lighting/AmbientLightNode.d.ts | 12 - .../src/nodes/lighting/AnalyticLightNode.d.ts | 127 - .../nodes/lighting/BasicEnvironmentNode.d.ts | 26 - .../src/nodes/lighting/BasicLightMapNode.d.ts | 24 - .../nodes/lighting/DirectionalLightNode.d.ts | 13 - .../src/nodes/lighting/EnvironmentNode.d.ts | 33 - .../nodes/lighting/HemisphereLightNode.d.ts | 34 - .../src/nodes/lighting/IESSpotLightNode.d.ts | 16 - .../src/nodes/lighting/IrradianceNode.d.ts | 24 - .../src/nodes/lighting/LightProbeNode.d.ts | 22 - .../jsdoc/src/nodes/lighting/LightUtils.d.ts | 11 - .../nodes/lighting/LightingContextNode.d.ts | 89 - .../src/nodes/lighting/LightingNode.d.ts | 21 - .../jsdoc/src/nodes/lighting/LightsNode.d.ts | 125 - .../src/nodes/lighting/PointLightNode.d.ts | 40 - .../src/nodes/lighting/PointShadowNode.d.ts | 52 - .../nodes/lighting/ProjectorLightNode.d.ts | 17 - .../src/nodes/lighting/RectAreaLightNode.d.ts | 41 - .../src/nodes/lighting/ShadowBaseNode.d.ts | 68 - .../src/nodes/lighting/ShadowFilterNode.d.ts | 36 - .../jsdoc/src/nodes/lighting/ShadowNode.d.ts | 192 - .../src/nodes/lighting/SpotLightNode.d.ts | 52 - .../src/nodes/materialx/MaterialXColor.d.ts | 2 - .../materialx/MaterialXColorTransform.d.ts | 1 - .../src/nodes/materialx/MaterialXCore.d.ts | 2 - .../src/nodes/materialx/MaterialXNodes.d.ts | 50 - .../src/nodes/materialx/MaterialXNoise.d.ts | 74 - .../jsdoc/src/nodes/math/BitcastNode.d.ts | 62 - .../jsdoc/src/nodes/math/BitcountNode.d.ts | 111 - .../jsdoc/src/nodes/math/ConditionalNode.d.ts | 65 - jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts | 9 - .../jsdoc/src/nodes/math/MathNode.d.ts | 703 - .../jsdoc/src/nodes/math/MathUtils.d.ts | 4 - .../jsdoc/src/nodes/math/OperatorNode.d.ts | 312 - .../jsdoc/src/nodes/math/PackFloatNode.d.ts | 91 - .../jsdoc/src/nodes/math/TriNoise3D.d.ts | 11 - .../jsdoc/src/nodes/math/UnpackFloatNode.d.ts | 89 - .../src/nodes/parsers/GLSLNodeFunction.d.ts | 25 - .../src/nodes/parsers/GLSLNodeParser.d.ts | 17 - .../jsdoc/src/nodes/pmrem/PMREMNode.d.ts | 113 - .../jsdoc/src/nodes/pmrem/PMREMUtils.d.ts | 3 - .../jsdoc/src/nodes/procedural/Checker.d.ts | 9 - .../jsdoc/src/nodes/shapes/Shapes.d.ts | 9 - .../jsdoc/src/nodes/tsl/TSLBase.d.ts | 26 - .../jsdoc/src/nodes/tsl/TSLCore.d.ts | 74 - .../src/nodes/utils/ArrayElementNode.d.ts | 53 - .../jsdoc/src/nodes/utils/ConvertNode.d.ts | 41 - .../jsdoc/src/nodes/utils/CubeMapNode.d.ts | 57 - .../jsdoc/src/nodes/utils/DebugNode.d.ts | 12 - .../jsdoc/src/nodes/utils/Discard.d.ts | 2 - .../jsdoc/src/nodes/utils/EquirectUV.d.ts | 29 - .../jsdoc/src/nodes/utils/EventNode.d.ts | 42 - .../jsdoc/src/nodes/utils/FlipNode.d.ts | 46 - .../nodes/utils/FunctionOverloadingNode.d.ts | 60 - .../jsdoc/src/nodes/utils/JoinNode.d.ts | 33 - .../jsdoc/src/nodes/utils/LoopNode.d.ts | 68 - .../jsdoc/src/nodes/utils/MatcapUV.d.ts | 11 - .../src/nodes/utils/MaxMipLevelNode.d.ts | 51 - .../jsdoc/src/nodes/utils/MemberNode.d.ts | 41 - .../jsdoc/src/nodes/utils/Oscillators.d.ts | 4 - .../jsdoc/src/nodes/utils/Packing.d.ts | 5 - .../src/nodes/utils/PostProcessingUtils.d.ts | 75 - .../jsdoc/src/nodes/utils/RTTNode.d.ts | 128 - .../jsdoc/src/nodes/utils/ReflectorNode.d.ts | 237 - .../jsdoc/src/nodes/utils/Remap.d.ts | 30 - .../jsdoc/src/nodes/utils/RotateNode.d.ts | 49 - .../jsdoc/src/nodes/utils/SampleNode.d.ts | 46 - .../jsdoc/src/nodes/utils/SetNode.d.ts | 49 - .../jsdoc/src/nodes/utils/SplitNode.d.ts | 65 - .../jsdoc/src/nodes/utils/SpriteSheetUV.d.ts | 17 - .../jsdoc/src/nodes/utils/SpriteUtils.d.ts | 19 - .../nodes/utils/StorageArrayElementNode.d.ts | 51 - .../jsdoc/src/nodes/utils/Timer.d.ts | 21 - .../src/nodes/utils/TriplanarTextures.d.ts | 21 - .../jsdoc/src/nodes/utils/UVUtils.d.ts | 42 - .../jsdoc/src/nodes/utils/ViewportUtils.d.ts | 13 - .../jsdoc/src/objects/BatchedMesh.d.ts | 362 - jsdoc-testing/jsdoc/src/objects/Bone.d.ts | 26 - .../jsdoc/src/objects/ClippingGroup.d.ts | 50 - jsdoc-testing/jsdoc/src/objects/Group.d.ts | 29 - .../jsdoc/src/objects/InstancedMesh.d.ts | 138 - jsdoc-testing/jsdoc/src/objects/LOD.d.ts | 103 - jsdoc-testing/jsdoc/src/objects/Line.d.ts | 101 - jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts | 25 - .../jsdoc/src/objects/LineSegments.d.ts | 24 - jsdoc-testing/jsdoc/src/objects/Mesh.d.ts | 104 - jsdoc-testing/jsdoc/src/objects/Points.d.ts | 78 - jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts | 126 - .../jsdoc/src/objects/SkinnedMesh.d.ts | 118 - jsdoc-testing/jsdoc/src/objects/Sprite.d.ts | 82 - .../src/renderers/WebGL3DRenderTarget.d.ts | 25 - .../src/renderers/WebGLArrayRenderTarget.d.ts | 25 - .../src/renderers/WebGLCubeRenderTarget.d.ts | 40 - .../src/renderers/WebGLRenderTarget.d.ts | 16 - .../jsdoc/src/renderers/WebGLRenderer.d.ts | 580 - .../jsdoc/src/renderers/common/Animation.d.ts | 92 - .../src/renderers/common/Attributes.d.ts | 52 - .../jsdoc/src/renderers/common/Backend.d.ts | 573 - .../src/renderers/common/Background.d.ts | 40 - .../jsdoc/src/renderers/common/BindGroup.d.ts | 35 - .../jsdoc/src/renderers/common/Binding.d.ts | 49 - .../jsdoc/src/renderers/common/Bindings.d.ts | 126 - .../jsdoc/src/renderers/common/BlendMode.d.ts | 109 - .../jsdoc/src/renderers/common/Buffer.d.ts | 91 - .../src/renderers/common/BufferUtils.d.ts | 28 - .../src/renderers/common/BundleGroup.d.ts | 44 - .../src/renderers/common/CanvasTarget.d.ts | 189 - .../jsdoc/src/renderers/common/ChainMap.d.ts | 48 - .../src/renderers/common/ClippingContext.d.ts | 129 - .../jsdoc/src/renderers/common/Color4.d.ts | 49 - .../src/renderers/common/ComputePipeline.d.ts | 31 - .../jsdoc/src/renderers/common/Constants.d.ts | 7 - .../renderers/common/CubeRenderTarget.d.ts | 42 - .../jsdoc/src/renderers/common/DataMap.d.ts | 41 - .../common/DirectRenderPipeline.d.ts | 66 - .../src/renderers/common/Geometries.d.ts | 103 - .../IndirectStorageBufferAttribute.d.ts | 29 - .../jsdoc/src/renderers/common/Info.d.ts | 211 - .../src/renderers/common/InspectorBase.d.ts | 122 - .../jsdoc/src/renderers/common/Lighting.d.ts | 65 - .../jsdoc/src/renderers/common/Pipeline.d.ts | 28 - .../jsdoc/src/renderers/common/Pipelines.d.ts | 176 - .../src/renderers/common/PostProcessing.d.ts | 17 - .../renderers/common/ProgrammableStage.d.ts | 64 - .../jsdoc/src/renderers/common/QuadMesh.d.ts | 52 - .../src/renderers/common/ReadbackBuffer.d.ts | 55 - .../src/renderers/common/RenderBundle.d.ts | 20 - .../src/renderers/common/RenderBundles.d.ts | 29 - .../src/renderers/common/RenderContext.d.ts | 228 - .../src/renderers/common/RenderContexts.d.ts | 42 - .../src/renderers/common/RenderList.d.ts | 197 - .../src/renderers/common/RenderLists.d.ts | 51 - .../src/renderers/common/RenderObject.d.ts | 425 - .../common/RenderObjectPipeline.d.ts | 30 - .../src/renderers/common/RenderObjects.d.ts | 108 - .../src/renderers/common/RenderPipeline.d.ts | 133 - .../jsdoc/src/renderers/common/Renderer.d.ts | 1491 - .../src/renderers/common/RendererUtils.d.ts | 105 - .../src/renderers/common/SampledTexture.d.ts | 85 - .../jsdoc/src/renderers/common/Sampler.d.ts | 80 - .../renderers/common/Storage3DTexture.d.ts | 59 - .../renderers/common/StorageArrayTexture.d.ts | 38 - .../src/renderers/common/StorageBuffer.d.ts | 38 - .../common/StorageBufferAttribute.d.ts | 35 - .../StorageInstancedBufferAttribute.d.ts | 35 - .../src/renderers/common/StorageTexture.d.ts | 43 - .../jsdoc/src/renderers/common/Textures.d.ts | 116 - .../renderers/common/TimestampQueryPool.d.ts | 119 - .../jsdoc/src/renderers/common/Uniform.d.ts | 260 - .../src/renderers/common/UniformBuffer.d.ts | 18 - .../src/renderers/common/UniformsGroup.d.ts | 147 - .../jsdoc/src/renderers/common/XRManager.d.ts | 602 - .../src/renderers/common/XRRenderTarget.d.ts | 66 - .../common/extras/PMREMGenerator.d.ts | 194 - .../common/nodes/NodeBuilderState.d.ts | 112 - .../renderers/common/nodes/NodeLibrary.d.ts | 99 - .../renderers/common/nodes/NodeManager.d.ts | 296 - .../common/nodes/NodeSampledTexture.d.ts | 72 - .../renderers/common/nodes/NodeSampler.d.ts | 31 - .../common/nodes/NodeStorageBuffer.d.ts | 36 - .../renderers/common/nodes/NodeUniform.d.ts | 230 - .../common/nodes/NodeUniformBuffer.d.ts | 56 - .../common/nodes/NodeUniformsGroup.d.ts | 38 - .../src/renderers/shaders/DFGLUTData.d.ts | 1 - .../src/renderers/shaders/ShaderChunk.d.ts | 252 - .../ShaderChunk/alphahash_fragment.glsl.d.ts | 2 - .../alphahash_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/alphamap_fragment.glsl.d.ts | 2 - .../alphamap_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/alphatest_fragment.glsl.d.ts | 2 - .../alphatest_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/aomap_fragment.glsl.d.ts | 2 - .../ShaderChunk/aomap_pars_fragment.glsl.d.ts | 2 - .../batching_pars_vertex.glsl.d.ts | 2 - .../ShaderChunk/batching_vertex.glsl.d.ts | 2 - .../ShaderChunk/begin_vertex.glsl.d.ts | 2 - .../ShaderChunk/beginnormal_vertex.glsl.d.ts | 2 - .../shaders/ShaderChunk/bsdfs.glsl.d.ts | 2 - .../bumpmap_pars_fragment.glsl.d.ts | 2 - .../clearcoat_normal_fragment_begin.glsl.d.ts | 2 - .../clearcoat_normal_fragment_maps.glsl.d.ts | 2 - .../clearcoat_pars_fragment.glsl.d.ts | 2 - .../clipping_planes_fragment.glsl.d.ts | 2 - .../clipping_planes_pars_fragment.glsl.d.ts | 2 - .../clipping_planes_pars_vertex.glsl.d.ts | 2 - .../clipping_planes_vertex.glsl.d.ts | 2 - .../ShaderChunk/color_fragment.glsl.d.ts | 2 - .../ShaderChunk/color_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/color_pars_vertex.glsl.d.ts | 2 - .../ShaderChunk/color_vertex.glsl.d.ts | 2 - .../ShaderChunk/colorspace_fragment.glsl.d.ts | 2 - .../colorspace_pars_fragment.glsl.d.ts | 2 - .../shaders/ShaderChunk/common.glsl.d.ts | 2 - .../cube_uv_reflection_fragment.glsl.d.ts | 2 - .../ShaderChunk/default_fragment.glsl.d.ts | 2 - .../ShaderChunk/default_vertex.glsl.d.ts | 2 - .../defaultnormal_vertex.glsl.d.ts | 2 - .../displacementmap_pars_vertex.glsl.d.ts | 2 - .../displacementmap_vertex.glsl.d.ts | 2 - .../ShaderChunk/dithering_fragment.glsl.d.ts | 2 - .../dithering_pars_fragment.glsl.d.ts | 2 - .../emissivemap_fragment.glsl.d.ts | 2 - .../emissivemap_pars_fragment.glsl.d.ts | 2 - .../envmap_common_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/envmap_fragment.glsl.d.ts | 2 - .../envmap_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/envmap_pars_vertex.glsl.d.ts | 2 - .../envmap_physical_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/envmap_vertex.glsl.d.ts | 2 - .../ShaderChunk/fog_fragment.glsl.d.ts | 2 - .../ShaderChunk/fog_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/fog_pars_vertex.glsl.d.ts | 2 - .../shaders/ShaderChunk/fog_vertex.glsl.d.ts | 2 - .../gradientmap_pars_fragment.glsl.d.ts | 2 - .../iridescence_fragment.glsl.d.ts | 2 - .../iridescence_pars_fragment.glsl.d.ts | 2 - .../lightmap_pars_fragment.glsl.d.ts | 2 - .../lightprobes_pars_fragment.glsl.d.ts | 2 - .../lights_fragment_begin.glsl.d.ts | 2 - .../ShaderChunk/lights_fragment_end.glsl.d.ts | 2 - .../lights_fragment_maps.glsl.d.ts | 2 - .../lights_lambert_fragment.glsl.d.ts | 2 - .../lights_lambert_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/lights_pars_begin.glsl.d.ts | 2 - .../lights_phong_fragment.glsl.d.ts | 2 - .../lights_phong_pars_fragment.glsl.d.ts | 2 - .../lights_physical_fragment.glsl.d.ts | 2 - .../lights_physical_pars_fragment.glsl.d.ts | 2 - .../lights_toon_fragment.glsl.d.ts | 2 - .../lights_toon_pars_fragment.glsl.d.ts | 2 - .../logdepthbuf_fragment.glsl.d.ts | 2 - .../logdepthbuf_pars_fragment.glsl.d.ts | 2 - .../logdepthbuf_pars_vertex.glsl.d.ts | 2 - .../ShaderChunk/logdepthbuf_vertex.glsl.d.ts | 2 - .../ShaderChunk/map_fragment.glsl.d.ts | 2 - .../ShaderChunk/map_pars_fragment.glsl.d.ts | 2 - .../map_particle_fragment.glsl.d.ts | 2 - .../map_particle_pars_fragment.glsl.d.ts | 2 - .../metalnessmap_fragment.glsl.d.ts | 2 - .../metalnessmap_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/morphcolor_vertex.glsl.d.ts | 2 - .../morphinstance_vertex.glsl.d.ts | 2 - .../ShaderChunk/morphnormal_vertex.glsl.d.ts | 2 - .../morphtarget_pars_vertex.glsl.d.ts | 2 - .../ShaderChunk/morphtarget_vertex.glsl.d.ts | 2 - .../normal_fragment_begin.glsl.d.ts | 2 - .../normal_fragment_maps.glsl.d.ts | 2 - .../normal_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/normal_pars_vertex.glsl.d.ts | 2 - .../ShaderChunk/normal_vertex.glsl.d.ts | 2 - .../normalmap_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/opaque_fragment.glsl.d.ts | 2 - .../shaders/ShaderChunk/packing.glsl.d.ts | 2 - .../premultiplied_alpha_fragment.glsl.d.ts | 2 - .../ShaderChunk/project_vertex.glsl.d.ts | 2 - .../roughnessmap_fragment.glsl.d.ts | 2 - .../roughnessmap_pars_fragment.glsl.d.ts | 2 - .../shadowmap_pars_fragment.glsl.d.ts | 2 - .../shadowmap_pars_vertex.glsl.d.ts | 2 - .../ShaderChunk/shadowmap_vertex.glsl.d.ts | 2 - .../shadowmask_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/skinbase_vertex.glsl.d.ts | 2 - .../skinning_pars_vertex.glsl.d.ts | 2 - .../ShaderChunk/skinning_vertex.glsl.d.ts | 2 - .../ShaderChunk/skinnormal_vertex.glsl.d.ts | 2 - .../specularmap_fragment.glsl.d.ts | 2 - .../specularmap_pars_fragment.glsl.d.ts | 2 - .../tonemapping_fragment.glsl.d.ts | 2 - .../tonemapping_pars_fragment.glsl.d.ts | 2 - .../transmission_fragment.glsl.d.ts | 2 - .../transmission_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/uv_pars_fragment.glsl.d.ts | 2 - .../ShaderChunk/uv_pars_vertex.glsl.d.ts | 2 - .../shaders/ShaderChunk/uv_vertex.glsl.d.ts | 2 - .../ShaderChunk/worldpos_vertex.glsl.d.ts | 2 - .../src/renderers/shaders/ShaderLib.d.ts | 7 - .../shaders/ShaderLib/background.glsl.d.ts | 2 - .../ShaderLib/backgroundCube.glsl.d.ts | 2 - .../shaders/ShaderLib/cube.glsl.d.ts | 2 - .../shaders/ShaderLib/depth.glsl.d.ts | 2 - .../shaders/ShaderLib/distance.glsl.d.ts | 2 - .../shaders/ShaderLib/equirect.glsl.d.ts | 2 - .../shaders/ShaderLib/linedashed.glsl.d.ts | 2 - .../shaders/ShaderLib/meshbasic.glsl.d.ts | 2 - .../shaders/ShaderLib/meshlambert.glsl.d.ts | 2 - .../shaders/ShaderLib/meshmatcap.glsl.d.ts | 2 - .../shaders/ShaderLib/meshnormal.glsl.d.ts | 2 - .../shaders/ShaderLib/meshphong.glsl.d.ts | 2 - .../shaders/ShaderLib/meshphysical.glsl.d.ts | 2 - .../shaders/ShaderLib/meshtoon.glsl.d.ts | 2 - .../shaders/ShaderLib/points.glsl.d.ts | 2 - .../shaders/ShaderLib/shadow.glsl.d.ts | 2 - .../shaders/ShaderLib/sprite.glsl.d.ts | 2 - .../renderers/shaders/ShaderLib/vsm.glsl.d.ts | 2 - .../src/renderers/shaders/UniformsLib.d.ts | 485 - .../src/renderers/shaders/UniformsUtils.d.ts | 29 - .../webgl-fallback/WebGLBackend.d.ts | 657 - .../webgl-fallback/WebGLBufferRenderer.d.ts | 13 - .../webgl-fallback/nodes/GLSLNodeBuilder.d.ts | 402 - .../utils/WebGLAttributeUtils.d.ts | 64 - .../utils/WebGLCapabilities.d.ts | 48 - .../webgl-fallback/utils/WebGLConstants.d.ts | 11 - .../webgl-fallback/utils/WebGLExtensions.d.ts | 56 - .../webgl-fallback/utils/WebGLState.d.ts | 382 - .../utils/WebGLTextureUtils.d.ts | 197 - .../utils/WebGLTimestampQueryPool.d.ts | 58 - .../webgl-fallback/utils/WebGLUtils.d.ts | 51 - .../src/renderers/webgl/WebGLAnimation.d.ts | 6 - .../src/renderers/webgl/WebGLAttributes.d.ts | 5 - .../src/renderers/webgl/WebGLBackground.d.ts | 10 - .../renderers/webgl/WebGLBindingStates.d.ts | 12 - .../renderers/webgl/WebGLBufferRenderer.d.ts | 8 - .../renderers/webgl/WebGLCapabilities.d.ts | 20 - .../renderers/webgl/WebGLEnvironments.d.ts | 4 - .../src/renderers/webgl/WebGLExtensions.d.ts | 5 - .../src/renderers/webgl/WebGLGeometries.d.ts | 5 - .../webgl/WebGLIndexedBufferRenderer.d.ts | 9 - .../jsdoc/src/renderers/webgl/WebGLInfo.d.ts | 17 - .../src/renderers/webgl/WebGLLights.d.ts | 47 - .../src/renderers/webgl/WebGLMaterials.d.ts | 4 - .../renderers/webgl/WebGLMorphtargets.d.ts | 3 - .../src/renderers/webgl/WebGLObjects.d.ts | 4 - .../src/renderers/webgl/WebGLOutput.d.ts | 11 - .../src/renderers/webgl/WebGLPrograms.d.ts | 145 - .../src/renderers/webgl/WebGLProperties.d.ts | 7 - .../src/renderers/webgl/WebGLRenderLists.d.ts | 14 - .../renderers/webgl/WebGLRenderStates.d.ts | 4 - .../src/renderers/webgl/WebGLShader.d.ts | 1 - .../src/renderers/webgl/WebGLShaderCache.d.ts | 11 - .../jsdoc/src/renderers/webgl/WebGLState.d.ts | 39 - .../src/renderers/webgl/WebGLTextures.d.ts | 20 - .../src/renderers/webgl/WebGLUniforms.d.ts | 9 - .../renderers/webgl/WebGLUniformsGroups.d.ts | 5 - .../jsdoc/src/renderers/webgl/WebGLUtils.d.ts | 3 - .../src/renderers/webgpu/WebGPUBackend.d.ts | 637 - .../webgpu/WebGPURenderer.Nodes.d.ts | 25 - .../src/renderers/webgpu/WebGPURenderer.d.ts | 42 - .../descriptors/GPUBindGroupDescriptor.d.ts | 32 - .../descriptors/GPUBufferDescriptor.d.ts | 39 - .../GPUCommandEncoderDescriptor.d.ts | 18 - .../descriptors/GPUComputePassDescriptor.d.ts | 24 - .../GPUComputePipelineDescriptor.d.ts | 32 - .../GPUCopyExternalImageDestInfo.d.ts | 25 - .../GPUCopyExternalImageSourceInfo.d.ts | 36 - .../webgpu/descriptors/GPUExtent3D.d.ts | 35 - .../GPUPipelineLayoutDescriptor.d.ts | 25 - .../descriptors/GPUQuerySetDescriptor.d.ts | 31 - .../GPURenderBundleEncoderDescriptor.d.ts | 52 - .../GPURenderPassColorAttachment.d.ts | 50 - .../GPURenderPassDepthStencilAttachment.d.ts | 71 - .../descriptors/GPURenderPassDescriptor.d.ts | 50 - .../GPURenderPassTimestampWrites.d.ts | 33 - .../GPURenderPipelineDescriptor.d.ts | 90 - .../descriptors/GPUSamplerDescriptor.d.ts | 87 - .../GPUShaderModuleDescriptor.d.ts | 30 - .../descriptors/GPUTexelCopyBufferInfo.d.ts | 39 - .../descriptors/GPUTexelCopyBufferLayout.d.ts | 32 - .../descriptors/GPUTexelCopyTextureInfo.d.ts | 45 - .../descriptors/GPUTextureDescriptor.d.ts | 73 - .../descriptors/GPUTextureViewDescriptor.d.ts | 78 - .../webgpu/nodes/BasicNodeLibrary.d.ts | 11 - .../webgpu/nodes/StandardNodeLibrary.d.ts | 11 - .../webgpu/nodes/WGSLNodeBuilder.d.ts | 648 - .../webgpu/nodes/WGSLNodeFunction.d.ts | 25 - .../webgpu/nodes/WGSLNodeParser.d.ts | 17 - .../webgpu/utils/WebGPUAttributeUtils.d.ts | 78 - .../webgpu/utils/WebGPUBindingUtils.d.ts | 88 - .../webgpu/utils/WebGPUCapabilities.d.ts | 32 - .../webgpu/utils/WebGPUConstants.d.ts | 301 - .../webgpu/utils/WebGPUPipelineUtils.d.ts | 130 - .../webgpu/utils/WebGPUTexturePassUtils.d.ts | 84 - .../webgpu/utils/WebGPUTextureUtils.d.ts | 302 - .../utils/WebGPUTimestampQueryPool.d.ts | 53 - .../renderers/webgpu/utils/WebGPUUtils.d.ts | 112 - .../src/renderers/webxr/WebXRController.d.ts | 96 - .../renderers/webxr/WebXRDepthSensing.d.ts | 55 - .../src/renderers/webxr/WebXRManager.d.ts | 220 - jsdoc-testing/jsdoc/src/scenes/Fog.d.ts | 70 - jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts | 60 - jsdoc-testing/jsdoc/src/scenes/Scene.d.ts | 97 - .../jsdoc/src/textures/CanvasTexture.d.ts | 33 - .../src/textures/CompressedArrayTexture.d.ts | 65 - .../src/textures/CompressedCubeTexture.d.ts | 35 - .../jsdoc/src/textures/CompressedTexture.d.ts | 36 - .../jsdoc/src/textures/CubeDepthTexture.d.ts | 51 - .../jsdoc/src/textures/CubeTexture.d.ts | 49 - .../jsdoc/src/textures/Data3DTexture.d.ts | 41 - .../jsdoc/src/textures/DataArrayTexture.d.ts | 60 - .../jsdoc/src/textures/DataTexture.d.ts | 38 - .../jsdoc/src/textures/DepthTexture.d.ts | 42 - .../jsdoc/src/textures/ExternalTexture.d.ts | 33 - .../src/textures/FramebufferTexture.d.ts | 42 - .../jsdoc/src/textures/HTMLTexture.d.ts | 33 - jsdoc-testing/jsdoc/src/textures/Texture.d.ts | 413 - .../jsdoc/src/textures/TextureSource.d.ts | 92 - .../jsdoc/src/textures/VideoFrameTexture.d.ts | 44 - .../jsdoc/src/textures/VideoTexture.d.ts | 59 - jsdoc-testing/jsdoc/src/utils.d.ts | 185 - 1211 files changed, 4 insertions(+), 149985 deletions(-) delete mode 100644 jsdoc-testing/jsdoc/build/three.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/build/three.webgpu.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/Three.Core.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/Three.Legacy.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/Three.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/audio/Audio.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/cameras/Camera.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/constants.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/Clock.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/Layers.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/Object3D.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/Raycaster.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/Timer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/Uniform.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/Controls.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/Earcut.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/core/Path.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/Light.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/PointLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/SunLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/Loader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/Material.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/Materials.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Box2.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Box3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Color.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Euler.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Frustum.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Interpolant.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Line3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/MathUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Matrix2.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Matrix3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Matrix4.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Plane.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Quaternion.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Ray.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Sphere.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Spherical.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Triangle.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Vector2.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Vector3.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/Vector4.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/TSL.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/Bone.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/Group.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/LOD.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/Line.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/Mesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/Points.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/objects/Sprite.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/scenes/Fog.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/scenes/Scene.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/Texture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts delete mode 100644 jsdoc-testing/jsdoc/src/utils.d.ts diff --git a/jsdoc-testing/changes.patch b/jsdoc-testing/changes.patch index 4d1f04fa9..9687f0964 100644 --- a/jsdoc-testing/changes.patch +++ b/jsdoc-testing/changes.patch @@ -14637,7 +14637,7 @@ index 9932067a0..5eb392d78 100644 + +export default CanvasTarget; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts -index db3046a90..9a5928cef 100644 +index 0bc37ff1c..22902cb59 100644 --- a/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts +++ b/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts @@ -1,4 +1,11 @@ @@ -14653,7 +14653,7 @@ index db3046a90..9a5928cef 100644 /** * Represents the state that is used to perform clipping via clipping planes. * There is a default clipping context for each render context. When the -@@ -64,13 +71,13 @@ declare class ClippingContext { +@@ -71,13 +78,13 @@ declare class ClippingContext { * * @type {Array} */ @@ -14669,7 +14669,7 @@ index db3046a90..9a5928cef 100644 /** * The version of the clipping context's parent context. * -@@ -86,7 +93,7 @@ declare class ClippingContext { +@@ -93,7 +100,7 @@ declare class ClippingContext { * @param {Array} destination - The destination. * @param {number} offset - The offset. */ @@ -14678,7 +14678,7 @@ index db3046a90..9a5928cef 100644 /** * Updates the root clipping context of a scene. * -@@ -114,9 +121,7 @@ declare class ClippingContext { +@@ -121,9 +128,7 @@ declare class ClippingContext { * @type {number} * @readonly */ diff --git a/jsdoc-testing/jsdoc/build/three.module.d.ts b/jsdoc-testing/jsdoc/build/three.module.d.ts deleted file mode 100644 index 89418a42b..000000000 --- a/jsdoc-testing/jsdoc/build/three.module.d.ts +++ /dev/null @@ -1,1868 +0,0 @@ -import { ACESFilmicToneMapping } from './three.core.js'; -import { AddEquation } from './three.core.js'; -import { AddOperation } from './three.core.js'; -import { AdditiveBlending } from './three.core.js'; -import { AgXToneMapping } from './three.core.js'; -import { AlphaFormat } from './three.core.js'; -import { AlwaysCompare } from './three.core.js'; -import { AlwaysDepth } from './three.core.js'; -import { ArrayCamera } from './three.core.js'; -import { BackSide } from './three.core.js'; -import { BoxGeometry } from './three.core.js'; -import { BufferAttribute } from './three.core.js'; -import { BufferGeometry } from './three.core.js'; -import { ByteType } from './three.core.js'; -import { CineonToneMapping } from './three.core.js'; -import { ClampToEdgeWrapping } from './three.core.js'; -import { Color } from './three.core.js'; -import { ColorManagement } from './three.core.js'; -import { ConstantAlphaFactor } from './three.core.js'; -import { ConstantColorFactor } from './three.core.js'; -import { CubeCamera } from './three.core.js'; -import { CubeDepthTexture } from './three.core.js'; -import { CubeReflectionMapping } from './three.core.js'; -import { CubeRefractionMapping } from './three.core.js'; -import { CubeTexture } from './three.core.js'; -import { CubeUVReflectionMapping } from './three.core.js'; -import { CullFaceBack } from './three.core.js'; -import { CullFaceFront } from './three.core.js'; -import { CullFaceNone } from './three.core.js'; -import { CustomBlending } from './three.core.js'; -import { CustomToneMapping } from './three.core.js'; -import { Data3DTexture } from './three.core.js'; -import { DataArrayTexture } from './three.core.js'; -import { DataTexture } from './three.core.js'; -import { DepthFormat } from './three.core.js'; -import { DepthStencilFormat } from './three.core.js'; -import { DepthTexture } from './three.core.js'; -import { DoubleSide } from './three.core.js'; -import { DstAlphaFactor } from './three.core.js'; -import { DstColorFactor } from './three.core.js'; -import { EqualCompare } from './three.core.js'; -import { EqualDepth } from './three.core.js'; -import { EquirectangularReflectionMapping } from './three.core.js'; -import { EquirectangularRefractionMapping } from './three.core.js'; -import { EventDispatcher } from './three.core.js'; -import { ExternalTexture } from './three.core.js'; -import { Float32BufferAttribute } from './three.core.js'; -import { FloatType } from './three.core.js'; -import { FrontSide } from './three.core.js'; -import { Frustum } from './three.core.js'; -import { GLSL3 } from './three.core.js'; -import { GreaterCompare } from './three.core.js'; -import { GreaterDepth } from './three.core.js'; -import { GreaterEqualCompare } from './three.core.js'; -import { GreaterEqualDepth } from './three.core.js'; -import { HalfFloatType } from './three.core.js'; -import { IntType } from './three.core.js'; -import { Layers } from './three.core.js'; -import { LessCompare } from './three.core.js'; -import { LessDepth } from './three.core.js'; -import { LessEqualCompare } from './three.core.js'; -import { LessEqualDepth } from './three.core.js'; -import { LinearFilter } from './three.core.js'; -import { LinearMipmapLinearFilter } from './three.core.js'; -import { LinearMipmapNearestFilter } from './three.core.js'; -import { LinearSRGBColorSpace } from './three.core.js'; -import { LinearToneMapping } from './three.core.js'; -import { LinearTransfer } from './three.core.js'; -import { Matrix3 } from './three.core.js'; -import { Matrix4 } from './three.core.js'; -import { MaxEquation } from './three.core.js'; -import { Mesh } from './three.core.js'; -import { MeshBasicMaterial } from './three.core.js'; -import { MeshDepthMaterial } from './three.core.js'; -import { MeshDistanceMaterial } from './three.core.js'; -import { MinEquation } from './three.core.js'; -import { MirroredRepeatWrapping } from './three.core.js'; -import { MixOperation } from './three.core.js'; -import { MultiplyBlending } from './three.core.js'; -import { MultiplyOperation } from './three.core.js'; -import { NearestFilter } from './three.core.js'; -import { NearestMipmapLinearFilter } from './three.core.js'; -import { NearestMipmapNearestFilter } from './three.core.js'; -import { NeutralToneMapping } from './three.core.js'; -import { NeverCompare } from './three.core.js'; -import { NeverDepth } from './three.core.js'; -import { NoBlending } from './three.core.js'; -import { NoColorSpace } from './three.core.js'; -import { NoToneMapping } from './three.core.js'; -import { NormalBlending } from './three.core.js'; -import { NotEqualCompare } from './three.core.js'; -import { NotEqualDepth } from './three.core.js'; -import { ObjectSpaceNormalMap } from './three.core.js'; -import { OneFactor } from './three.core.js'; -import { OneMinusConstantAlphaFactor } from './three.core.js'; -import { OneMinusConstantColorFactor } from './three.core.js'; -import { OneMinusDstAlphaFactor } from './three.core.js'; -import { OneMinusDstColorFactor } from './three.core.js'; -import { OneMinusSrcAlphaFactor } from './three.core.js'; -import { OneMinusSrcColorFactor } from './three.core.js'; -import { OrthographicCamera } from './three.core.js'; -import { PCFShadowMap } from './three.core.js'; -import { PCFSoftShadowMap } from './three.core.js'; -/** - * This class generates a Prefiltered, Mipmapped Radiance Environment Map - * (PMREM) from a cubeMap environment texture. This allows different levels of - * blur to be quickly accessed based on material roughness. It is packed into a - * special CubeUV format that allows us to perform custom interpolation so that - * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap - * chain, it only goes down to the LOD_MIN level (above), and then creates extra - * even more filtered 'mips' at the same LOD_MIN resolution, associated with - * higher roughness levels. In this way we maintain resolution to smoothly - * interpolate diffuse lighting while limiting sampling computation. - * - * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) - * importance sampling based on "Sampling the GGX Distribution of Visible Normals" - * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF - * used in material rendering for physically-based image-based lighting. - */ -export class PMREMGenerator { - /** - * Constructs a new PMREM generator. - * - * @param {WebGLRenderer} renderer - The renderer. - */ - constructor(renderer: WebGLRenderer); - _renderer: WebGLRenderer; - _pingPongRenderTarget: any; - _lodMax: number; - _cubeSize: number; - _sizeLods: any[]; - _lodMeshes: any[]; - _backgroundBox: Mesh | null; - _cubemapMaterial: ShaderMaterial | null; - _equirectMaterial: ShaderMaterial | null; - _blurMaterial: ShaderMaterial | null; - _ggxMaterial: ShaderMaterial | null; - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety. - * - * @param {Scene} scene - The scene to be captured. - * @param {number} [sigma=0] - The blur radius in radians. - * @param {number} [near=0.1] - The near plane distance. - * @param {number} [far=100] - The far plane distance. - * @param {Object} [options={}] - The configuration options. - * @param {number} [options.size=256] - The texture size of the PMREM. - * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. - * @return {WebGLRenderTarget} The resulting PMREM. - */ - fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { - size?: number | undefined; - position?: Vector3 | undefined; - }): WebGLRenderTarget; - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best - * with the 256 x 256 cubemap output. The minimum supported input image size - * is 64 x 32. - * - * @param {Texture} equirectangular - The equirectangular texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ - fromEquirectangular(equirectangular: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ - fromCubemap(cubemap: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; - /** - * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileCubemapShader(): void; - /** - * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileEquirectangularShader(): void; - /** - * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, - * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on - * one of them will cause any others to also become unusable. - */ - dispose(): void; - _setSize(cubeSize: any): void; - _dispose(): void; - _cleanup(outputTarget: any): void; - _fromTexture(texture: any, renderTarget: any): any; - _allocateTargets(): WebGLRenderTarget; - _compileMaterial(material: any): void; - _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; - _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; - _applyPMREM(cubeUVRenderTarget: any): void; - /** - * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. - * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the - * GGX BRDF for physically-based rendering. Reads from the previous LOD level and - * applies incremental roughness filtering to avoid over-blurring. - * - * @private - * @param {WebGLRenderTarget} cubeUVRenderTarget - * @param {number} lodIn - Source LOD level to read from - * @param {number} lodOut - Target LOD level to write to - */ - private _applyGGXFilter; - /** - * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples - * the Gaussian along a spiral kernel (Golden Angle), which distributes samples - * isotropically on the sphere (no pole artifacts). - * - * Used for initial scene blur in fromScene() method when sigma > 0. - * - * @private - * @param {WebGLRenderTarget} cubeUVRenderTarget - * @param {number} lodIn - * @param {number} lodOut - * @param {number} sigma - */ - private _blur; - _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; -} -import { PerspectiveCamera } from './three.core.js'; -import { Plane } from './three.core.js'; -import { PlaneGeometry } from './three.core.js'; -import { R11_EAC_Format } from './three.core.js'; -import { RED_GREEN_RGTC2_Format } from './three.core.js'; -import { RED_RGTC1_Format } from './three.core.js'; -import { REVISION } from './three.core.js'; -import { RG11_EAC_Format } from './three.core.js'; -import { RGBAFormat } from './three.core.js'; -import { RGBAIntegerFormat } from './three.core.js'; -import { RGBA_ASTC_10x10_Format } from './three.core.js'; -import { RGBA_ASTC_10x5_Format } from './three.core.js'; -import { RGBA_ASTC_10x6_Format } from './three.core.js'; -import { RGBA_ASTC_10x8_Format } from './three.core.js'; -import { RGBA_ASTC_12x10_Format } from './three.core.js'; -import { RGBA_ASTC_12x12_Format } from './three.core.js'; -import { RGBA_ASTC_4x4_Format } from './three.core.js'; -import { RGBA_ASTC_5x4_Format } from './three.core.js'; -import { RGBA_ASTC_5x5_Format } from './three.core.js'; -import { RGBA_ASTC_6x5_Format } from './three.core.js'; -import { RGBA_ASTC_6x6_Format } from './three.core.js'; -import { RGBA_ASTC_8x5_Format } from './three.core.js'; -import { RGBA_ASTC_8x6_Format } from './three.core.js'; -import { RGBA_ASTC_8x8_Format } from './three.core.js'; -import { RGBA_BPTC_Format } from './three.core.js'; -import { RGBA_ETC2_EAC_Format } from './three.core.js'; -import { RGBA_PVRTC_2BPPV1_Format } from './three.core.js'; -import { RGBA_PVRTC_4BPPV1_Format } from './three.core.js'; -import { RGBA_S3TC_DXT1_Format } from './three.core.js'; -import { RGBA_S3TC_DXT3_Format } from './three.core.js'; -import { RGBA_S3TC_DXT5_Format } from './three.core.js'; -import { RGBFormat } from './three.core.js'; -import { RGB_BPTC_SIGNED_Format } from './three.core.js'; -import { RGB_BPTC_UNSIGNED_Format } from './three.core.js'; -import { RGB_ETC1_Format } from './three.core.js'; -import { RGB_ETC2_Format } from './three.core.js'; -import { RGB_PVRTC_2BPPV1_Format } from './three.core.js'; -import { RGB_PVRTC_4BPPV1_Format } from './three.core.js'; -import { RGB_S3TC_DXT1_Format } from './three.core.js'; -import { RGFormat } from './three.core.js'; -import { RGIntegerFormat } from './three.core.js'; -import { RawShaderMaterial } from './three.core.js'; -import { RedFormat } from './three.core.js'; -import { RedIntegerFormat } from './three.core.js'; -import { ReinhardToneMapping } from './three.core.js'; -import { RepeatWrapping } from './three.core.js'; -import { ReverseSubtractEquation } from './three.core.js'; -import { SIGNED_R11_EAC_Format } from './three.core.js'; -import { SIGNED_RED_GREEN_RGTC2_Format } from './three.core.js'; -import { SIGNED_RED_RGTC1_Format } from './three.core.js'; -import { SIGNED_RG11_EAC_Format } from './three.core.js'; -import { SRGBColorSpace } from './three.core.js'; -import { SRGBTransfer } from './three.core.js'; -export namespace ShaderChunk { - export { alphahash_fragment }; - export { alphahash_pars_fragment }; - export { alphamap_fragment }; - export { alphamap_pars_fragment }; - export { alphatest_fragment }; - export { alphatest_pars_fragment }; - export { aomap_fragment }; - export { aomap_pars_fragment }; - export { batching_pars_vertex }; - export { batching_vertex }; - export { begin_vertex }; - export { beginnormal_vertex }; - export { bsdfs }; - export { iridescence_fragment }; - export { bumpmap_pars_fragment }; - export { clipping_planes_fragment }; - export { clipping_planes_pars_fragment }; - export { clipping_planes_pars_vertex }; - export { clipping_planes_vertex }; - export { color_fragment }; - export { color_pars_fragment }; - export { color_pars_vertex }; - export { color_vertex }; - export { common }; - export { cube_uv_reflection_fragment }; - export { defaultnormal_vertex }; - export { displacementmap_pars_vertex }; - export { displacementmap_vertex }; - export { emissivemap_fragment }; - export { emissivemap_pars_fragment }; - export { colorspace_fragment }; - export { colorspace_pars_fragment }; - export { envmap_fragment }; - export { envmap_common_pars_fragment }; - export { envmap_pars_fragment }; - export { envmap_pars_vertex }; - export { envmap_physical_pars_fragment }; - export { envmap_vertex }; - export { fog_vertex }; - export { fog_pars_vertex }; - export { fog_fragment }; - export { fog_pars_fragment }; - export { gradientmap_pars_fragment }; - export { lightmap_pars_fragment }; - export { lights_lambert_fragment }; - export { lights_lambert_pars_fragment }; - export { lights_pars_begin }; - export { lights_toon_fragment }; - export { lights_toon_pars_fragment }; - export { lights_phong_fragment }; - export { lights_phong_pars_fragment }; - export { lights_physical_fragment }; - export { lights_physical_pars_fragment }; - export { lights_fragment_begin }; - export { lights_fragment_maps }; - export { lights_fragment_end }; - export { lightprobes_pars_fragment }; - export { logdepthbuf_fragment }; - export { logdepthbuf_pars_fragment }; - export { logdepthbuf_pars_vertex }; - export { logdepthbuf_vertex }; - export { map_fragment }; - export { map_pars_fragment }; - export { map_particle_fragment }; - export { map_particle_pars_fragment }; - export { metalnessmap_fragment }; - export { metalnessmap_pars_fragment }; - export { morphinstance_vertex }; - export { morphcolor_vertex }; - export { morphnormal_vertex }; - export { morphtarget_pars_vertex }; - export { morphtarget_vertex }; - export { normal_fragment_begin }; - export { normal_fragment_maps }; - export { normal_pars_fragment }; - export { normal_pars_vertex }; - export { normal_vertex }; - export { normalmap_pars_fragment }; - export { clearcoat_normal_fragment_begin }; - export { clearcoat_normal_fragment_maps }; - export { clearcoat_pars_fragment }; - export { iridescence_pars_fragment }; - export { opaque_fragment }; - export { packing }; - export { premultiplied_alpha_fragment }; - export { project_vertex }; - export { dithering_fragment }; - export { dithering_pars_fragment }; - export { roughnessmap_fragment }; - export { roughnessmap_pars_fragment }; - export { shadowmap_pars_fragment }; - export { shadowmap_pars_vertex }; - export { shadowmap_vertex }; - export { shadowmask_pars_fragment }; - export { skinbase_vertex }; - export { skinning_pars_vertex }; - export { skinning_vertex }; - export { skinnormal_vertex }; - export { specularmap_fragment }; - export { specularmap_pars_fragment }; - export { tonemapping_fragment }; - export { tonemapping_pars_fragment }; - export { transmission_fragment }; - export { transmission_pars_fragment }; - export { uv_pars_fragment }; - export { uv_pars_vertex }; - export { uv_vertex }; - export { worldpos_vertex }; - export { vertex$h as background_vert }; - export { fragment$h as background_frag }; - export { vertex$g as backgroundCube_vert }; - export { fragment$g as backgroundCube_frag }; - export { vertex$f as cube_vert }; - export { fragment$f as cube_frag }; - export { vertex$e as depth_vert }; - export { fragment$e as depth_frag }; - export { vertex$d as distance_vert }; - export { fragment$d as distance_frag }; - export { vertex$c as equirect_vert }; - export { fragment$c as equirect_frag }; - export { vertex$b as linedashed_vert }; - export { fragment$b as linedashed_frag }; - export { vertex$a as meshbasic_vert }; - export { fragment$a as meshbasic_frag }; - export { vertex$9 as meshlambert_vert }; - export { fragment$9 as meshlambert_frag }; - export { vertex$8 as meshmatcap_vert }; - export { fragment$8 as meshmatcap_frag }; - export { vertex$7 as meshnormal_vert }; - export { fragment$7 as meshnormal_frag }; - export { vertex$6 as meshphong_vert }; - export { fragment$6 as meshphong_frag }; - export { vertex$5 as meshphysical_vert }; - export { fragment$5 as meshphysical_frag }; - export { vertex$4 as meshtoon_vert }; - export { fragment$4 as meshtoon_frag }; - export { vertex$3 as points_vert }; - export { fragment$3 as points_frag }; - export { vertex$2 as shadow_vert }; - export { fragment$2 as shadow_frag }; - export { vertex$1 as sprite_vert }; - export { fragment$1 as sprite_frag }; -} -export namespace ShaderLib { - namespace physical { - export let uniforms: Object; - import vertexShader = ShaderChunk.meshphysical_vert; - export { vertexShader }; - import fragmentShader = ShaderChunk.meshphysical_frag; - export { fragmentShader }; - } -} -import { ShaderMaterial } from './three.core.js'; -import { ShortType } from './three.core.js'; -import { SrcAlphaFactor } from './three.core.js'; -import { SrcAlphaSaturateFactor } from './three.core.js'; -import { SrcColorFactor } from './three.core.js'; -import { SubtractEquation } from './three.core.js'; -import { SubtractiveBlending } from './three.core.js'; -import { TangentSpaceNormalMap } from './three.core.js'; -import { Texture } from './three.core.js'; -import { Uint16BufferAttribute } from './three.core.js'; -import { Uint32BufferAttribute } from './three.core.js'; -export namespace UniformsLib { - export namespace common_1 { - namespace diffuse { - let value: Color; - } - namespace opacity { - let value_1: number; - export { value_1 as value }; - } - namespace map { - let value_2: null; - export { value_2 as value }; - } - namespace mapTransform { - let value_3: Matrix3; - export { value_3 as value }; - } - namespace alphaMap { - let value_4: null; - export { value_4 as value }; - } - namespace alphaMapTransform { - let value_5: Matrix3; - export { value_5 as value }; - } - namespace alphaTest { - let value_6: number; - export { value_6 as value }; - } - } - export { common_1 as common }; - export namespace specularmap { - namespace specularMap { - let value_7: null; - export { value_7 as value }; - } - namespace specularMapTransform { - let value_8: Matrix3; - export { value_8 as value }; - } - } - export namespace envmap { - namespace envMap { - let value_9: null; - export { value_9 as value }; - } - namespace envMapRotation { - let value_10: Matrix3; - export { value_10 as value }; - } - namespace reflectivity { - let value_11: number; - export { value_11 as value }; - } - namespace ior { - let value_12: number; - export { value_12 as value }; - } - namespace refractionRatio { - let value_13: number; - export { value_13 as value }; - } - namespace dfgLUT { - let value_14: null; - export { value_14 as value }; - } - } - export namespace aomap { - namespace aoMap { - let value_15: null; - export { value_15 as value }; - } - namespace aoMapIntensity { - let value_16: number; - export { value_16 as value }; - } - namespace aoMapTransform { - let value_17: Matrix3; - export { value_17 as value }; - } - } - export namespace lightmap { - namespace lightMap { - let value_18: null; - export { value_18 as value }; - } - namespace lightMapIntensity { - let value_19: number; - export { value_19 as value }; - } - namespace lightMapTransform { - let value_20: Matrix3; - export { value_20 as value }; - } - } - export namespace bumpmap { - namespace bumpMap { - let value_21: null; - export { value_21 as value }; - } - namespace bumpMapTransform { - let value_22: Matrix3; - export { value_22 as value }; - } - namespace bumpScale { - let value_23: number; - export { value_23 as value }; - } - } - export namespace normalmap { - namespace normalMap { - let value_24: null; - export { value_24 as value }; - } - namespace normalMapTransform { - let value_25: Matrix3; - export { value_25 as value }; - } - namespace normalScale { - let value_26: Vector2; - export { value_26 as value }; - } - } - export namespace displacementmap { - namespace displacementMap { - let value_27: null; - export { value_27 as value }; - } - namespace displacementMapTransform { - let value_28: Matrix3; - export { value_28 as value }; - } - namespace displacementScale { - let value_29: number; - export { value_29 as value }; - } - namespace displacementBias { - let value_30: number; - export { value_30 as value }; - } - } - export namespace emissivemap { - namespace emissiveMap { - let value_31: null; - export { value_31 as value }; - } - namespace emissiveMapTransform { - let value_32: Matrix3; - export { value_32 as value }; - } - } - export namespace metalnessmap { - namespace metalnessMap { - let value_33: null; - export { value_33 as value }; - } - namespace metalnessMapTransform { - let value_34: Matrix3; - export { value_34 as value }; - } - } - export namespace roughnessmap { - namespace roughnessMap { - let value_35: null; - export { value_35 as value }; - } - namespace roughnessMapTransform { - let value_36: Matrix3; - export { value_36 as value }; - } - } - export namespace gradientmap { - namespace gradientMap { - let value_37: null; - export { value_37 as value }; - } - } - export namespace fog { - namespace fogDensity { - let value_38: number; - export { value_38 as value }; - } - namespace fogNear { - let value_39: number; - export { value_39 as value }; - } - namespace fogFar { - let value_40: number; - export { value_40 as value }; - } - namespace fogColor { - let value_41: Color; - export { value_41 as value }; - } - } - export namespace lights { - namespace ambientLightColor { - let value_42: never[]; - export { value_42 as value }; - } - namespace lightProbe { - let value_43: never[]; - export { value_43 as value }; - } - namespace sunLights { - let value_44: never[]; - export { value_44 as value }; - export namespace properties { - let direction: {}; - let color: {}; - } - } - namespace sunLightShadows { - let value_45: never[]; - export { value_45 as value }; - export namespace properties_1 { - let shadowIntensity: number; - let shadowBias: {}; - let shadowNormalBias: {}; - let shadowRadius: {}; - let shadowMapSize: {}; - } - export { properties_1 as properties }; - } - namespace sunShadowMatrix { - let value_46: never[]; - export { value_46 as value }; - } - namespace sunShadowCascade { - let value_47: never[]; - export { value_47 as value }; - } - namespace directionalLights { - let value_48: never[]; - export { value_48 as value }; - export namespace properties_2 { - let direction_1: {}; - export { direction_1 as direction }; - let color_1: {}; - export { color_1 as color }; - } - export { properties_2 as properties }; - } - namespace directionalLightShadows { - let value_49: never[]; - export { value_49 as value }; - export namespace properties_3 { - let shadowIntensity_1: number; - export { shadowIntensity_1 as shadowIntensity }; - let shadowBias_1: {}; - export { shadowBias_1 as shadowBias }; - let shadowNormalBias_1: {}; - export { shadowNormalBias_1 as shadowNormalBias }; - let shadowRadius_1: {}; - export { shadowRadius_1 as shadowRadius }; - let shadowMapSize_1: {}; - export { shadowMapSize_1 as shadowMapSize }; - } - export { properties_3 as properties }; - } - namespace directionalShadowMatrix { - let value_50: never[]; - export { value_50 as value }; - } - namespace spotLights { - let value_51: never[]; - export { value_51 as value }; - export namespace properties_4 { - let color_2: {}; - export { color_2 as color }; - export let position: {}; - let direction_2: {}; - export { direction_2 as direction }; - export let distance: {}; - export let coneCos: {}; - export let penumbraCos: {}; - export let decay: {}; - } - export { properties_4 as properties }; - } - namespace spotLightShadows { - let value_52: never[]; - export { value_52 as value }; - export namespace properties_5 { - let shadowIntensity_2: number; - export { shadowIntensity_2 as shadowIntensity }; - let shadowBias_2: {}; - export { shadowBias_2 as shadowBias }; - let shadowNormalBias_2: {}; - export { shadowNormalBias_2 as shadowNormalBias }; - let shadowRadius_2: {}; - export { shadowRadius_2 as shadowRadius }; - let shadowMapSize_2: {}; - export { shadowMapSize_2 as shadowMapSize }; - } - export { properties_5 as properties }; - } - namespace spotLightMap { - let value_53: never[]; - export { value_53 as value }; - } - namespace spotLightMatrix { - let value_54: never[]; - export { value_54 as value }; - } - namespace pointLights { - let value_55: never[]; - export { value_55 as value }; - export namespace properties_6 { - let color_3: {}; - export { color_3 as color }; - let position_1: {}; - export { position_1 as position }; - let decay_1: {}; - export { decay_1 as decay }; - let distance_1: {}; - export { distance_1 as distance }; - } - export { properties_6 as properties }; - } - namespace pointLightShadows { - let value_56: never[]; - export { value_56 as value }; - export namespace properties_7 { - let shadowIntensity_3: number; - export { shadowIntensity_3 as shadowIntensity }; - let shadowBias_3: {}; - export { shadowBias_3 as shadowBias }; - let shadowNormalBias_3: {}; - export { shadowNormalBias_3 as shadowNormalBias }; - let shadowRadius_3: {}; - export { shadowRadius_3 as shadowRadius }; - let shadowMapSize_3: {}; - export { shadowMapSize_3 as shadowMapSize }; - export let shadowCameraNear: {}; - export let shadowCameraFar: {}; - } - export { properties_7 as properties }; - } - namespace pointShadowMatrix { - let value_57: never[]; - export { value_57 as value }; - } - namespace hemisphereLights { - let value_58: never[]; - export { value_58 as value }; - export namespace properties_8 { - let direction_3: {}; - export { direction_3 as direction }; - export let skyColor: {}; - export let groundColor: {}; - } - export { properties_8 as properties }; - } - namespace rectAreaLights { - let value_59: never[]; - export { value_59 as value }; - export namespace properties_9 { - let color_4: {}; - export { color_4 as color }; - let position_2: {}; - export { position_2 as position }; - export let width: {}; - export let height: {}; - } - export { properties_9 as properties }; - } - namespace ltc_1 { - let value_60: null; - export { value_60 as value }; - } - namespace ltc_2 { - let value_61: null; - export { value_61 as value }; - } - namespace probesSH { - let value_62: null; - export { value_62 as value }; - } - namespace probesMin { - let value_63: Vector3; - export { value_63 as value }; - } - namespace probesMax { - let value_64: Vector3; - export { value_64 as value }; - } - namespace probesResolution { - let value_65: Vector3; - export { value_65 as value }; - } - } - export namespace points { - export namespace diffuse_1 { - let value_66: Color; - export { value_66 as value }; - } - export { diffuse_1 as diffuse }; - export namespace opacity_1 { - let value_67: number; - export { value_67 as value }; - } - export { opacity_1 as opacity }; - export namespace size { - let value_68: number; - export { value_68 as value }; - } - export namespace scale { - let value_69: number; - export { value_69 as value }; - } - export namespace map_1 { - let value_70: null; - export { value_70 as value }; - } - export { map_1 as map }; - export namespace alphaMap_1 { - let value_71: null; - export { value_71 as value }; - } - export { alphaMap_1 as alphaMap }; - export namespace alphaMapTransform_1 { - let value_72: Matrix3; - export { value_72 as value }; - } - export { alphaMapTransform_1 as alphaMapTransform }; - export namespace alphaTest_1 { - let value_73: number; - export { value_73 as value }; - } - export { alphaTest_1 as alphaTest }; - export namespace uvTransform { - let value_74: Matrix3; - export { value_74 as value }; - } - } - export namespace sprite { - export namespace diffuse_2 { - let value_75: Color; - export { value_75 as value }; - } - export { diffuse_2 as diffuse }; - export namespace opacity_2 { - let value_76: number; - export { value_76 as value }; - } - export { opacity_2 as opacity }; - export namespace center { - let value_77: Vector2; - export { value_77 as value }; - } - export namespace rotation { - let value_78: number; - export { value_78 as value }; - } - export namespace map_2 { - let value_79: null; - export { value_79 as value }; - } - export { map_2 as map }; - export namespace mapTransform_1 { - let value_80: Matrix3; - export { value_80 as value }; - } - export { mapTransform_1 as mapTransform }; - export namespace alphaMap_2 { - let value_81: null; - export { value_81 as value }; - } - export { alphaMap_2 as alphaMap }; - export namespace alphaMapTransform_2 { - let value_82: Matrix3; - export { value_82 as value }; - } - export { alphaMapTransform_2 as alphaMapTransform }; - export namespace alphaTest_2 { - let value_83: number; - export { value_83 as value }; - } - export { alphaTest_2 as alphaTest }; - } -} -import { UniformsUtils } from './three.core.js'; -import { UnsignedByteType } from './three.core.js'; -import { UnsignedInt101111Type } from './three.core.js'; -import { UnsignedInt248Type } from './three.core.js'; -import { UnsignedInt5999Type } from './three.core.js'; -import { UnsignedIntType } from './three.core.js'; -import { UnsignedShort4444Type } from './three.core.js'; -import { UnsignedShort5551Type } from './three.core.js'; -import { UnsignedShortType } from './three.core.js'; -import { VSMShadowMap } from './three.core.js'; -import { Vector2 } from './three.core.js'; -import { Vector3 } from './three.core.js'; -import { Vector4 } from './three.core.js'; -import { WebGLCoordinateSystem } from './three.core.js'; -/** - * A cube render target used in context of {@link WebGLRenderer}. - * - * @augments WebGLRenderTarget - */ -export class WebGLCubeRenderTarget extends WebGLRenderTarget { - /** - * Constructs a new cube render target. - * - * @param {number} [size=1] - The size of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(size?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLCubeRenderTarget: boolean; - /** - * Converts the given equirectangular texture to a cube map. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {Texture} texture - The equirectangular texture. - * @return {WebGLCubeRenderTarget} A reference to this cube render target. - */ - fromEquirectangularTexture(renderer: WebGLRenderer, texture: Texture): WebGLCubeRenderTarget; - /** - * Clears this cube render target. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear(renderer: WebGLRenderer, color?: boolean, depth?: boolean, stencil?: boolean): void; -} -import { WebGLRenderTarget } from './three.core.js'; -/** - * This renderer uses WebGL 2 to display scenes. - * - * WebGL 1 is not supported since `r163`. - */ -export class WebGLRenderer { - /** - * Constructs a new WebGL renderer. - * - * @param {WebGLRenderer~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLRenderer: boolean; - /** - * A canvas where the renderer draws its output. This is automatically created by the renderer - * in the constructor (if not provided already); you just need to add it to your page like so: - * ```js - * document.body.appendChild( renderer.domElement ); - * ``` - * - * @type {HTMLCanvasElement|OffscreenCanvas} - */ - domElement: HTMLCanvasElement | OffscreenCanvas; - /** - * A object with debug configuration settings. - * - * - `checkShaderErrors`: If it is `true`, defines whether material shader programs are - * checked for errors during compilation and linkage process. It may be useful to disable - * this check in production for performance gain. It is strongly recommended to keep these - * checks enabled during development. If the shader does not compile and link, it will not - * work and associated material will not render. - * - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that - * can be used for custom error reporting. The callback receives the WebGL context, an instance - * of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader. - * Assigning a custom function disables the default error reporting. - * - * @type {Object} - */ - debug: Object; - /** - * Whether the renderer should automatically clear its output before rendering a frame or not. - * - * @type {boolean} - * @default true - */ - autoClear: boolean; - /** - * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear - * the color buffer or not. - * - * @type {boolean} - * @default true - */ - autoClearColor: boolean; - /** - * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear - * the depth buffer or not. - * - * @type {boolean} - * @default true - */ - autoClearDepth: boolean; - /** - * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear - * the stencil buffer or not. - * - * @type {boolean} - * @default true - */ - autoClearStencil: boolean; - /** - * Whether the renderer should sort objects or not. - * - * Note: Sorting is used to attempt to properly render objects that have some - * degree of transparency. By definition, sorting objects may not work in all - * cases. Depending on the needs of application, it may be necessary to turn - * off sorting and use other methods to deal with transparency rendering e.g. - * manually determining each object's rendering order. - * - * @type {boolean} - * @default true - */ - sortObjects: boolean; - /** - * User-defined clipping planes specified in world space. These planes apply globally. - * Points in space whose dot product with the plane is negative are cut away. - * - * @type {Array} - */ - clippingPlanes: Array; - /** - * Whether the renderer respects object-level clipping planes or not. - * - * @type {boolean} - * @default false - */ - localClippingEnabled: boolean; - /** - * The tone mapping technique of the renderer. - * - * @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)} - * @default NoToneMapping - */ - toneMapping: (number | number | number | number | number | number | number | number); - /** - * Exposure level of tone mapping. - * - * @type {number} - * @default 1 - */ - toneMappingExposure: number; - /** - * The normalized resolution scale for the transmission render target, measured in percentage - * of viewport dimensions. Lowering this value can result in significant performance improvements - * when using {@link MeshPhysicalMaterial#transmission}. - * - * @type {number} - * @default 1 - */ - transmissionResolutionScale: number; - _outputColorSpace: string; - /** - * A reference to the XR manager. - * - * @type {WebXRManager} - */ - xr: WebXRManager; - /** - * Returns the rendering context. - * - * @return {WebGL2RenderingContext} The rendering context. - */ - getContext: () => WebGL2RenderingContext; - /** - * Returns the rendering context attributes. - * - * @return {WebGLContextAttributes} The rendering context attributes. - */ - getContextAttributes: () => WebGLContextAttributes; - /** - * Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension. - */ - forceContextLoss: () => void; - /** - * Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension. - */ - forceContextRestore: () => void; - /** - * Returns the pixel ratio. - * - * @return {number} The pixel ratio. - */ - getPixelRatio: () => number; - /** - * Sets the given pixel ratio and resizes the canvas if necessary. - * - * @param {number} value - The pixel ratio. - */ - setPixelRatio: (value: number) => void; - /** - * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The renderer's size in logical pixels. - */ - getSize: (target: Vector2) => Vector2; - /** - * Resizes the output canvas to (width, height) with device pixel ratio taken - * into account, and also sets the viewport to fit that size, starting in (0, - * 0). Setting `updateStyle` to false prevents any style changes to the output canvas. - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. - */ - setSize: (width: number, height: number, updateStyle?: boolean) => void; - /** - * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize: (target: Vector2) => Vector2; - /** - * This method allows to define the drawing buffer size by specifying - * width, height and pixel ratio all at once. The size of the drawing - * buffer is computed with this formula: - * ```js - * size.x = width * pixelRatio; - * size.y = height * pixelRatio; - * ``` - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {number} pixelRatio - The pixel ratio. - */ - setDrawingBufferSize: (width: number, height: number, pixelRatio: number) => void; - /** - * Sets the post-processing effects to be applied after rendering. - * - * @param {Array} effects - An array of post-processing effects. - */ - setEffects: (effects: any[]) => void; - /** - * Returns the current viewport definition. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The current viewport definition. - */ - getCurrentViewport: (target: Vector2) => Vector2; - /** - * Returns the viewport definition. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The viewport definition. - */ - getViewport: (target: Vector4) => Vector4; - /** - * Sets the viewport to render from `(x, y)` to `(x + width, y + height)`. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. - * Or alternatively a four-component vector specifying all the parameters of the viewport. - * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - */ - setViewport: (x: number | Vector4, y: number, width: number, height: number) => void; - /** - * Returns the scissor region. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The scissor region. - */ - getScissor: (target: Vector4) => Vector4; - /** - * Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit. - * Or alternatively a four-component vector specifying all the parameters of the scissor region. - * @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit. - * @param {number} width - The width of the scissor region in logical pixel unit. - * @param {number} height - The height of the scissor region in logical pixel unit. - */ - setScissor: (x: number | Vector4, y: number, width: number, height: number) => void; - /** - * Returns `true` if the scissor test is enabled. - * - * @return {boolean} Whether the scissor test is enabled or not. - */ - getScissorTest: () => boolean; - /** - * Enable or disable the scissor test. When this is enabled, only the pixels - * within the defined scissor area will be affected by further renderer - * actions. - * - * @param {boolean} boolean - Whether the scissor test is enabled or not. - */ - setScissorTest: (boolean: boolean) => void; - /** - * Sets a custom opaque sort function for the render lists. Pass `null` - * to use the default `painterSortStable` function. - * - * @param {?Function} method - The opaque sort function. - */ - setOpaqueSort: (method: Function | null) => void; - /** - * Sets a custom transparent sort function for the render lists. Pass `null` - * to use the default `reversePainterSortStable` function. - * - * @param {?Function} method - The opaque sort function. - */ - setTransparentSort: (method: Function | null) => void; - /** - * Returns the clear color. - * - * @param {Color} target - The method writes the result in this target object. - * @return {Color} The clear color. - */ - getClearColor: (target: Color) => Color; - /** - * Sets the clear color and alpha. - * - * @param {Color} color - The clear color. - * @param {number} [alpha=1] - The clear alpha. - */ - setClearColor: (...args: any[]) => void; - /** - * Returns the clear alpha. Ranges within `[0,1]`. - * - * @return {number} The clear alpha. - */ - getClearAlpha: () => number; - /** - * Sets the clear alpha. - * - * @param {number} alpha - The clear alpha. - */ - setClearAlpha: (...args: any[]) => void; - /** - * Tells the renderer to clear its color, depth or stencil drawing buffer(s). - * This method initializes the buffers to the current clear color values. - * - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear: (color?: boolean, depth?: boolean, stencil?: boolean) => void; - /** - * Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`. - */ - clearColor: () => void; - /** - * Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`. - */ - clearDepth: () => void; - /** - * Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`. - */ - clearStencil: () => void; - /** - * Sets a compatibility node builder for rendering node materials with WebGLRenderer. - * This enables using TSL (Three.js Shading Language) node materials to prepare - * for migration to WebGPURenderer. - * - * @param {WebGLNodesHandler} nodesHandler - The node builder instance. - */ - setNodesHandler: (nodesHandler: WebGLNodesHandler) => void; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - */ - dispose: () => void; - renderBufferDirect: (camera: any, scene: any, geometry: any, material: any, object: any, group: any) => void; - /** - * Compiles all materials in the scene with the camera. This is useful to precompile shaders - * before the first rendering. If you want to add a 3D object to an existing scene, use the third - * optional parameter for applying the target scene. - * - * Note that the (target) scene's lighting and environment must be configured before calling this method. - * - * @param {Object3D} scene - The scene or another type of 3D object to precompile. - * @param {Camera} camera - The camera. - * @param {?Scene} [targetScene=null] - The target scene. - * @return {Set} The precompiled materials. - */ - compile: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Set; - /** - * Asynchronous version of {@link WebGLRenderer#compile}. - * - * This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence, - * it is recommended to use this version of `compile()` whenever possible. - * - * @async - * @param {Object3D} scene - The scene or another type of 3D object to precompile. - * @param {Camera} camera - The camera. - * @param {?Scene} [targetScene=null] - The target scene. - * @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation. - */ - compileAsync: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise; - /** - * Applications are advised to always define the animation loop - * with this method and not manually with `requestAnimationFrame()` - * for best compatibility. - * - * @param {?onAnimationCallback} callback - The application's animation loop. - */ - setAnimationLoop: (callback: onAnimationCallback | null) => void; - /** - * Renders the given scene (or other type of 3D object) using the given camera. - * - * The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget} - * or to the canvas as usual. - * - * By default render buffers are cleared before rendering but you can prevent - * this by setting the property `autoClear` to `false`. If you want to prevent - * only certain buffers being cleared you can `autoClearColor`, `autoClearDepth` - * or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}. - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * Returns the active cube face. - * - * @return {number} The active cube face. - */ - getActiveCubeFace: () => number; - /** - * Returns the active mipmap level. - * - * @return {number} The active mipmap level. - */ - getActiveMipmapLevel: () => number; - /** - * Returns the active render target. - * - * @return {?WebGLRenderTarget} The active render target. Returns `null` if no render target - * is currently set. - */ - getRenderTarget: () => WebGLRenderTarget | null; - setRenderTargetTextures: (renderTarget: any, colorTexture: any, depthTexture: any) => void; - setRenderTargetFramebuffer: (renderTarget: any, defaultFramebuffer: any) => void; - /** - * Sets the active rendertarget. - * - * @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given, - * the canvas is set as the active render target instead. - * @param {number} [activeCubeFace=0] - The active cube face when using a cube render target. - * Indicates the z layer to render in to when using 3D or array render targets. - * @param {number} [activeMipmapLevel=0] - The active mipmap level. - */ - setRenderTarget: (renderTarget: WebGLRenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number) => void; - /** - * Reads the pixel data from the given render target into the given buffer. - * - * @param {WebGLRenderTarget} renderTarget - The render target to read from. - * @param {number} x - The `x` coordinate of the copy region's origin. - * @param {number} y - The `y` coordinate of the copy region's origin. - * @param {number} width - The width of the copy region. - * @param {number} height - The height of the copy region. - * @param {TypedArray} buffer - The result buffer. - * @param {number} [activeCubeFaceIndex] - The active cube face index. - * @param {number} [textureIndex=0] - The texture index of an MRT render target. - */ - readRenderTargetPixels: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => void; - /** - * Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}. - * - * It is recommended to use this version of `readRenderTargetPixels()` whenever possible. - * - * @async - * @param {WebGLRenderTarget} renderTarget - The render target to read from. - * @param {number} x - The `x` coordinate of the copy region's origin. - * @param {number} y - The `y` coordinate of the copy region's origin. - * @param {number} width - The width of the copy region. - * @param {number} height - The height of the copy region. - * @param {TypedArray} buffer - The result buffer. - * @param {number} [activeCubeFaceIndex] - The active cube face index. - * @param {number} [textureIndex=0] - The texture index of an MRT render target. - * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. - */ - readRenderTargetPixelsAsync: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => Promise; - /** - * Copies pixels from the current bound framebuffer into the given texture. - * - * @param {FramebufferTexture} texture - The texture. - * @param {?Vector2} [position=null] - The start position of the copy operation. - * @param {number} [level=0] - The mip level. The default represents the base mip. - */ - copyFramebufferToTexture: (texture: FramebufferTexture, position?: Vector2 | null, level?: number) => void; - /** - * Copies data of the given source texture into a destination texture. - * - * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized - * {@link WebGLRenderer#initRenderTarget}. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. - * @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. - * @param {number} [srcLevel=0] - The source mipmap level to copy. - * @param {?number} [dstLevel=0] - The destination mipmap level. - */ - copyTextureToTexture: (srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box2 | Box3) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number | null) => void; - /** - * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data - * can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been - * rendered to. - * - * @param {WebGLRenderTarget} target - The render target. - */ - initRenderTarget: (target: WebGLRenderTarget) => void; - /** - * Initializes the given texture. Useful for preloading a texture rather than waiting until first - * render (which can cause noticeable lags due to decode and GPU upload overhead). - * - * @param {Texture} texture - The texture. - */ - initTexture: (texture: Texture) => void; - /** - * Can be used to reset the internal WebGL state. This method is mostly - * relevant for applications which share a single WebGL context across - * multiple WebGL libraries. - */ - resetState: () => void; - /** - * Defines the coordinate system of the renderer. - * - * In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`. - * - * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem} - * @default WebGLCoordinateSystem - * @readonly - */ - readonly get coordinateSystem(): number | WebGPUCoordinateSystem; - set outputColorSpace(colorSpace: string | string); - /** - * Defines the output color space of the renderer. - * - * @type {SRGBColorSpace|LinearSRGBColorSpace} - * @default SRGBColorSpace - */ - get outputColorSpace(): string | string; -} -export function WebGLUtils(gl: any, extensions: any): { - convert: (p: any, colorSpace?: string) => any; -}; -import { WebXRController } from './three.core.js'; -import { ZeroFactor } from './three.core.js'; -import { createCanvasElement } from './three.core.js'; -import { error } from './three.core.js'; -import { log } from './three.core.js'; -import { warn } from './three.core.js'; -import { warnOnce } from './three.core.js'; -declare var alphahash_fragment: string; -declare var alphahash_pars_fragment: string; -declare var alphamap_fragment: string; -declare var alphamap_pars_fragment: string; -declare var alphatest_fragment: string; -declare var alphatest_pars_fragment: string; -declare var aomap_fragment: string; -declare var aomap_pars_fragment: string; -declare var batching_pars_vertex: string; -declare var batching_vertex: string; -declare var begin_vertex: string; -declare var beginnormal_vertex: string; -declare var bsdfs: string; -declare var iridescence_fragment: string; -declare var bumpmap_pars_fragment: string; -declare var clipping_planes_fragment: string; -declare var clipping_planes_pars_fragment: string; -declare var clipping_planes_pars_vertex: string; -declare var clipping_planes_vertex: string; -declare var color_fragment: string; -declare var color_pars_fragment: string; -declare var color_pars_vertex: string; -declare var color_vertex: string; -declare var common: string; -declare var cube_uv_reflection_fragment: string; -declare var defaultnormal_vertex: string; -declare var displacementmap_pars_vertex: string; -declare var displacementmap_vertex: string; -declare var emissivemap_fragment: string; -declare var emissivemap_pars_fragment: string; -declare var colorspace_fragment: string; -declare var colorspace_pars_fragment: string; -declare var envmap_fragment: string; -declare var envmap_common_pars_fragment: string; -declare var envmap_pars_fragment: string; -declare var envmap_pars_vertex: string; -declare var envmap_physical_pars_fragment: string; -declare var envmap_vertex: string; -declare var fog_vertex: string; -declare var fog_pars_vertex: string; -declare var fog_fragment: string; -declare var fog_pars_fragment: string; -declare var gradientmap_pars_fragment: string; -declare var lightmap_pars_fragment: string; -declare var lights_lambert_fragment: string; -declare var lights_lambert_pars_fragment: string; -declare var lights_pars_begin: string; -declare var lights_toon_fragment: string; -declare var lights_toon_pars_fragment: string; -declare var lights_phong_fragment: string; -declare var lights_phong_pars_fragment: string; -declare var lights_physical_fragment: string; -declare var lights_physical_pars_fragment: string; -declare var lights_fragment_begin: string; -declare var lights_fragment_maps: string; -declare var lights_fragment_end: string; -declare var lightprobes_pars_fragment: string; -declare var logdepthbuf_fragment: string; -declare var logdepthbuf_pars_fragment: string; -declare var logdepthbuf_pars_vertex: string; -declare var logdepthbuf_vertex: string; -declare var map_fragment: string; -declare var map_pars_fragment: string; -declare var map_particle_fragment: string; -declare var map_particle_pars_fragment: string; -declare var metalnessmap_fragment: string; -declare var metalnessmap_pars_fragment: string; -declare var morphinstance_vertex: string; -declare var morphcolor_vertex: string; -declare var morphnormal_vertex: string; -declare var morphtarget_pars_vertex: string; -declare var morphtarget_vertex: string; -declare var normal_fragment_begin: string; -declare var normal_fragment_maps: string; -declare var normal_pars_fragment: string; -declare var normal_pars_vertex: string; -declare var normal_vertex: string; -declare var normalmap_pars_fragment: string; -declare var clearcoat_normal_fragment_begin: string; -declare var clearcoat_normal_fragment_maps: string; -declare var clearcoat_pars_fragment: string; -declare var iridescence_pars_fragment: string; -declare var opaque_fragment: string; -declare var packing: string; -declare var premultiplied_alpha_fragment: string; -declare var project_vertex: string; -declare var dithering_fragment: string; -declare var dithering_pars_fragment: string; -declare var roughnessmap_fragment: string; -declare var roughnessmap_pars_fragment: string; -declare var shadowmap_pars_fragment: string; -declare var shadowmap_pars_vertex: string; -declare var shadowmap_vertex: string; -declare var shadowmask_pars_fragment: string; -declare var skinbase_vertex: string; -declare var skinning_pars_vertex: string; -declare var skinning_vertex: string; -declare var skinnormal_vertex: string; -declare var specularmap_fragment: string; -declare var specularmap_pars_fragment: string; -declare var tonemapping_fragment: string; -declare var tonemapping_pars_fragment: string; -declare var transmission_fragment: string; -declare var transmission_pars_fragment: string; -declare var uv_pars_fragment: string; -declare var uv_pars_vertex: string; -declare var uv_vertex: string; -declare var worldpos_vertex: string; -declare const vertex$h: "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}"; -declare const fragment$h: "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}"; -declare const vertex$g: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}"; -declare const fragment$g: "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}"; -declare const vertex$f: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}"; -declare const fragment$f: "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}"; -declare const vertex$e: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}"; -declare const fragment$e: "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}"; -declare const vertex$d: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}"; -declare const fragment$d: "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}"; -declare const vertex$c: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}"; -declare const fragment$c: "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}"; -declare const vertex$b: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$b: "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$a: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$a: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$9: "#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$9: "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$8: "#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}"; -declare const fragment$8: "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$7: "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}"; -declare const fragment$7: "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}"; -declare const vertex$6: "#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$6: "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$5: "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}"; -declare const fragment$5: "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n\tuniform float retroreflectivity;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$4: "#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$4: "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$3: "uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$3: "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$2: "#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$2: "uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n\t#include \n}"; -declare const vertex$1: "uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"; -declare const fragment$1: "uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"; -/** - * This class represents an abstraction of the WebXR Device API and is - * internally used by {@link WebGLRenderer}. `WebXRManager` also provides a public - * interface that allows users to enable/disable XR and perform XR related - * tasks like for instance retrieving controllers. - * - * @augments EventDispatcher - * @hideconstructor - */ -declare class WebXRManager extends EventDispatcher { - /** - * Constructs a new WebGL renderer. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGL2RenderingContext} gl - The rendering context. - */ - constructor(renderer: WebGLRenderer, gl: WebGL2RenderingContext); - /** - * Whether the manager's XR camera should be automatically updated or not. - * - * @type {boolean} - * @default true - */ - cameraAutoUpdate: boolean; - /** - * This flag notifies the renderer to be ready for XR rendering. Set it to `true` - * if you are going to use XR in your app. - * - * @type {boolean} - * @default false - */ - enabled: boolean; - /** - * Whether XR presentation is active or not. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly isPresenting: boolean; - /** - * Returns a group representing the `target ray` space of the XR controller. - * Use this space for visualizing 3D objects that support the user in pointing - * tasks like UI interaction. - * - * @param {number} index - The index of the controller. - * @return {Group} A group representing the `target ray` space. - */ - getController: (index: number) => Group; - /** - * Returns a group representing the `grip` space of the XR controller. - * Use this space for visualizing 3D objects that support the user in pointing - * tasks like UI interaction. - * - * Note: If you want to show something in the user's hand AND offer a - * pointing ray at the same time, you'll want to attached the handheld object - * to the group returned by `getControllerGrip()` and the ray to the - * group returned by `getController()`. The idea is to have two - * different groups in two different coordinate spaces for the same WebXR - * controller. - * - * @param {number} index - The index of the controller. - * @return {Group} A group representing the `grip` space. - */ - getControllerGrip: (index: number) => Group; - /** - * Returns a group representing the `hand` space of the XR controller. - * Use this space for visualizing 3D objects that support the user in pointing - * tasks like UI interaction. - * - * @param {number} index - The index of the controller. - * @return {Group} A group representing the `hand` space. - */ - getHand: (index: number) => Group; - /** - * Sets the framebuffer scale factor. - * - * This method can not be used during a XR session. - * - * @param {number} value - The framebuffer scale factor. - */ - setFramebufferScaleFactor: (value: number) => void; - /** - * Sets the reference space type. Can be used to configure a spatial relationship with the user's physical - * environment. Depending on how the user moves in 3D space, setting an appropriate reference space can - * improve tracking. Default is `local-floor`. Valid values can be found here - * https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types. - * - * This method can not be used during a XR session. - * - * @param {string} value - The reference space type. - */ - setReferenceSpaceType: (value: string) => void; - /** - * Returns the XR reference space. - * - * @return {XRReferenceSpace} The XR reference space. - */ - getReferenceSpace: () => XRReferenceSpace; - /** - * Sets a custom XR reference space. - * - * @param {XRReferenceSpace} space - The XR reference space. - */ - setReferenceSpace: (space: XRReferenceSpace) => void; - /** - * Returns the current base layer. - * - * This is an `XRProjectionLayer` when the targeted XR device supports the - * WebXR Layers API, or an `XRWebGLLayer` otherwise. - * - * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. - */ - getBaseLayer: () => (XRWebGLLayer | XRProjectionLayer) | null; - /** - * Returns the current XR binding. - * - * Creates a new binding if needed and the browser is - * capable of doing so. - * - * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. - */ - getBinding: () => XRWebGLBinding | null; - /** - * Returns the current XR frame. - * - * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. - */ - getFrame: () => XRFrame | null; - /** - * Returns the current XR session. - * - * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. - */ - getSession: () => XRSession | null; - /** - * After a XR session has been requested usually with one of the `*Button` modules, it - * is injected into the renderer with this method. This method triggers the start of - * the actual XR rendering. - * - * @async - * @param {XRSession} value - The XR session to set. - * @return {Promise} A Promise that resolves when the session has been set. - */ - setSession: (value: XRSession) => Promise; - /** - * Returns the environment blend mode from the current XR session. - * - * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. - */ - getEnvironmentBlendMode: () => "opaque" | "additive" | "alpha-blend" | undefined; - /** - * Returns the current depth texture computed via depth sensing. - * - * See {@link WebXRDepthSensing#getDepthTexture}. - * - * @return {?Texture} The depth texture. - */ - getDepthTexture: () => Texture | null; - /** - * Updates the state of the XR camera. Use this method on app level if you - * set `cameraAutoUpdate` to `false`. The method requires the non-XR - * camera of the scene as a parameter. The passed in camera's transformation - * is automatically adjusted to the position of the XR camera when calling - * this method. - * - * @param {Camera} camera - The camera. - */ - updateCamera: (camera: Camera) => void; - /** - * Returns an instance of {@link ArrayCamera} which represents the XR camera - * of the active XR session. For each view it holds a separate camera object. - * - * The camera's `fov` is currently not used and does not reflect the fov of - * the XR camera. If you need the fov on app level, you have to compute in - * manually from the XR camera's projection matrices. - * - * @return {ArrayCamera} The XR camera. - */ - getCamera: () => ArrayCamera; - /** - * Returns the amount of foveation used by the XR compositor for the projection layer. - * - * @return {number|undefined} The amount of foveation. - */ - getFoveation: () => number | undefined; - /** - * Sets the foveation value. - * - * @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution) - * and `1` means maximum foveation (the edges render at lower resolution). - */ - setFoveation: (value: number) => void; - /** - * Returns `true` if depth sensing is supported. - * - * @return {boolean} Whether depth sensing is supported or not. - */ - hasDepthSensing: () => boolean; - /** - * Returns the depth sensing mesh. - * - * See {@link WebXRDepthSensing#getMesh}. - * - * @return {Mesh} The depth sensing mesh. - */ - getDepthSensingMesh: () => Mesh; - /** - * Retrieves an opaque texture from the view-aligned {@link XRCamera}. - * Only available during the current animation loop. - * - * @param {XRCamera} xrCamera - The camera to query. - * @return {?Texture} An opaque texture representing the current raw camera frame. - */ - getCameraTexture: (xrCamera: XRCamera) => Texture | null; - setAnimationLoop: (callback: any) => void; - dispose: () => void; -} -export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, ArrayCamera, BackSide, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CustomToneMapping, Data3DTexture, DataArrayTexture, DataTexture, DepthFormat, DepthStencilFormat, DepthTexture, DoubleSide, DstAlphaFactor, DstColorFactor, EqualCompare, EqualDepth, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, ExternalTexture, Float32BufferAttribute, FloatType, FrontSide, Frustum, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, HalfFloatType, IntType, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NoBlending, NoColorSpace, NoToneMapping, NormalBlending, NotEqualCompare, NotEqualDepth, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PerspectiveCamera, Plane, PlaneGeometry, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReverseSubtractEquation, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, ShaderMaterial, ShortType, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, Uint16BufferAttribute, Uint32BufferAttribute, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGLRenderTarget, WebXRController, ZeroFactor, createCanvasElement, error, log, warn, warnOnce }; -export { AdditiveAnimationBlendMode, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CylinderGeometry, Cylindrical, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualStencilFunc, Euler, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Fog, FogExp2, FramebufferTexture, FrustumArray, GLBufferAttribute, GLSL1, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NeverStencilFunc, NoNormalPacking, NormalAnimationBlendMode, NormalGAPacking, NormalRGPacking, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, OctahedronGeometry, Path, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGBIntegerFormat, RGDepthPacking, Ray, Raycaster, RectAreaLight, RenderObjectRefreshType, RenderTarget, RenderTarget3D, ReplaceStencilOp, RingGeometry, Scene, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SunLight, TOUCH, TetrahedronGeometry, TextureLoader, TextureSource, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, ZeroStencilOp, getConsoleFunction, setConsoleFunction } from "./three.core.js"; diff --git a/jsdoc-testing/jsdoc/build/three.webgpu.d.ts b/jsdoc-testing/jsdoc/build/three.webgpu.d.ts deleted file mode 100644 index 5ffcc04aa..000000000 --- a/jsdoc-testing/jsdoc/build/three.webgpu.d.ts +++ /dev/null @@ -1,24365 +0,0 @@ -import { ACESFilmicToneMapping } from './three.core.js'; -/** - * A generic class that can be used by nodes which contribute - * ambient occlusion to the scene. E.g. an ambient occlusion map - * node can be used as input for this module. Used in {@link NodeMaterial}. - * - * @augments LightingNode - */ -export class AONode extends LightingNode { - /** - * Constructs a new AO node. - * - * @param {?Node} [aoNode=null] - The ambient occlusion node. - */ - constructor(aoNode?: Node | null); - /** - * The ambient occlusion node. - * - * @type {?Node} - * @default null - */ - aoNode: Node | null; - setup(builder: any): void; -} -import { AddEquation } from './three.core.js'; -import { AddOperation } from './three.core.js'; -import { AdditiveBlending } from './three.core.js'; -import { AgXToneMapping } from './three.core.js'; -import { AlphaFormat } from './three.core.js'; -import { AlwaysCompare } from './three.core.js'; -import { AlwaysDepth } from './three.core.js'; -import { AlwaysStencilFunc } from './three.core.js'; -import { AmbientLight } from './three.core.js'; -/** - * Module for representing ambient lights as nodes. - * - * @augments AnalyticLightNode - */ -export class AmbientLightNode extends AnalyticLightNode { - /** - * Constructs a new ambient light node. - * - * @param {?AmbientLight} [light=null] - The ambient light source. - */ - constructor(light?: AmbientLight | null); - setup({ context }: { - context: any; - }): void; -} -/** - * Base class for analytic light nodes. - * - * @augments LightingNode - */ -export class AnalyticLightNode extends LightingNode { - /** - * Constructs a new analytic light node. - * - * @param {?Light} [light=null] - The light source. - */ - constructor(light?: Light | null); - /** - * The light source. - * - * @type {?Light} - * @default null - */ - light: Light | null; - /** - * The light's color value. - * - * @type {Color} - */ - color: Color; - /** - * The light's color node. Points to `colorNode` of the light source, if set. Otherwise - * it creates a uniform node based on {@link AnalyticLightNode#color}. - * - * @type {Node} - */ - colorNode: Node; - /** - * This property is used to retain a reference to the original value of {@link AnalyticLightNode#colorNode}. - * The final color node is represented by a different node when using shadows. - * - * @type {?Node} - * @default null - */ - baseColorNode: Node | null; - /** - * Represents the light's shadow. - * - * @type {?ShadowNode} - * @default null - */ - shadowNode: ShadowNode | null; - /** - * Represents the light's shadow color. - * - * @type {?Node} - * @default null - */ - shadowColorNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAnalyticLightNode: boolean; - _shadowDisposeListener: (() => void) | undefined; - /** - * Frees internal resources related to shadows. - */ - disposeShadow(): void; - getHash(): any; - /** - * Returns a node representing a direction vector which points from the current - * position in view space to the light's position in view space. - * - * @param {NodeBuilder} builder - The builder object used for setting up the light. - * @return {Node} The light vector node. - */ - getLightVector(builder: NodeBuilder): Node; - /** - * Sets up the direct lighting for the analytic light node. - * - * @abstract - * @param {NodeBuilder} builder - The builder object used for setting up the light. - * @return {Object|undefined} The direct light data (color and direction). - */ - setupDirect(): Object | undefined; - /** - * Sets up the direct rect area lighting for the analytic light node. - * - * @abstract - * @param {NodeBuilder} builder - The builder object used for setting up the light. - * @return {Object|undefined} The direct rect area light data. - */ - setupDirectRectArea(): Object | undefined; - /** - * Setups the shadow node for this light. The method exists so concrete light classes - * can setup different types of shadow nodes. - * - * @return {ShadowNode} The created shadow node. - */ - setupShadowNode(): ShadowNode; - /** - * Setups the shadow for this light. This method is only executed if the light - * cast shadows and the current build object receives shadows. It incorporates - * shadows into the lighting computation. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupShadow(builder: NodeBuilder): void; - /** - * Unlike most other nodes, lighting nodes do not return a output node in {@link Node#setup}. - * The main purpose of lighting nodes is to configure the current {@link LightingModel} and/or - * invocate the respective interface methods. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * The update method is used to update light uniforms per frame. - * Potentially overwritten in concrete light nodes to update light - * specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(): void; -} -import { ArrayCamera } from './three.core.js'; -/** - * Base class for representing element access on an array-like - * node data structures. - * - * @augments Node - */ -export class ArrayElementNode extends Node { - /** - * Constructs an array element node. - * - * @param {Node} node - The array-like node. - * @param {Node} indexNode - The index node that defines the element access. - */ - constructor(node: Node, indexNode: Node); - /** - * The array-like node. - * - * @type {Node} - */ - node: Node; - /** - * The index node that defines the element access. - * - * @type {Node} - */ - indexNode: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayElementNode: boolean; - /** - * This method is overwritten since the node type is inferred from the array-like node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * This method is overwritten since the member type is inferred from the array-like node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The member name. - * @return {string} The member type. - */ - getMemberType(builder: NodeBuilder, name: string): string; - generate(builder: any): string; -} -/** - * ArrayNode represents a collection of nodes, typically created using the {@link array} function. - * ```js - * const colors = array( [ - * vec3( 1, 0, 0 ), - * vec3( 0, 1, 0 ), - * vec3( 0, 0, 1 ) - * ] ); - * - * const redColor = tintColors.element( 0 ); - * ``` - * - * @augments TempNode - */ -export class ArrayNode extends TempNode { - /** - * Constructs a new array node. - * - * @param {?string} nodeType - The data type of the elements. - * @param {number} count - Size of the array. - * @param {?Array} [values=null] - Array default values. - */ - constructor(nodeType: string | null, count: number, values?: Array | null); - /** - * Array size. - * - * @type {number} - */ - count: number; - /** - * Array default values. - * - * @type {?Array} - */ - values: Array | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayNode: boolean; - /** - * Returns the number of elements in the node array. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {number} The number of elements in the node array. - */ - getArrayCount(): number; - /** - * Returns the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The type of the node. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the type of a member variable. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member variable. - * @return {string} The type of the member variable. - */ - getMemberType(builder: NodeBuilder, name: string): string; - /** - * This method builds the output node and returns the resulting array as a shader string. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated shader string. - */ - generate(builder: NodeBuilder): string; -} -/** - * These node represents an assign operation. Meaning a node is assigned - * to another node. - * - * @augments TempNode - */ -export class AssignNode extends TempNode { - /** - * Constructs a new assign node. - * - * @param {Node} targetNode - The target node. - * @param {Node} sourceNode - The source type. - */ - constructor(targetNode: Node, sourceNode: Node); - /** - * The target node. - * - * @type {Node} - */ - targetNode: Node; - /** - * The source node. - * - * @type {Node} - */ - sourceNode: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAssignNode: boolean; - /** - * Whether this node is used more than once in context of other nodes. This method - * is overwritten since it always returns `false` (assigns are unique). - * - * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. Always `false`. - */ - hasDependencies(): boolean; - generateNodeType(builder: any, output: any): string; - /** - * Whether a split is required when assigning source to target. This can happen when the component length of - * target and source data type does not match. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether a split is required when assigning source to target. - */ - needsSplitAssign(builder: NodeBuilder): boolean; - setup(builder: any): void; - generate(builder: any, output: any): any; -} -/** - * `AtomicFunctionNode` represents any function that can operate on atomic variable types - * within a shader. In an atomic function, any modification to an atomic variable will - * occur as an indivisible step with a defined order relative to other modifications. - * Accordingly, even if multiple atomic functions are modifying an atomic variable at once - * atomic operations will not interfere with each other. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -export class AtomicFunctionNode extends Node { - /** - * Constructs a new atomic function node. - * - * @param {string} method - The signature of the atomic function to construct. - * @param {Node} pointerNode - An atomic variable or element of an atomic buffer. - * @param {Node} valueNode - The value that mutates the atomic variable. - */ - constructor(method: string, pointerNode: Node, valueNode: Node); - /** - * The signature of the atomic function to construct. - * - * @type {string} - */ - method: string; - /** - * An atomic variable or element of an atomic buffer. - * - * @type {Node} - */ - pointerNode: Node; - /** - * A value that modifies the atomic variable. - * - * @type {Node} - */ - valueNode: Node; - /** - * Overwrites the default implementation to return the type of - * the pointer node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(builder: NodeBuilder): string; - /** - * Overwritten since the node type is inferred from the input type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any): any; -} -export namespace AtomicFunctionNode { - let ATOMIC_LOAD: string; - let ATOMIC_STORE: string; - let ATOMIC_ADD: string; - let ATOMIC_SUB: string; - let ATOMIC_MAX: string; - let ATOMIC_MIN: string; - let ATOMIC_AND: string; - let ATOMIC_OR: string; - let ATOMIC_XOR: string; -} -/** - * Base class for representing shader attributes as nodes. - * - * @augments Node - */ -export class AttributeNode extends Node { - /** - * Constructs a new attribute node. - * - * @param {string} attributeName - The name of the attribute. - * @param {?string} nodeType - The node type. - */ - constructor(attributeName: string, nodeType?: string | null); - _attributeName: string; - getHash(builder: any): string; - generateNodeType(builder: any): string | null; - /** - * Sets the attribute name to the given value. The method can be - * overwritten in derived classes if the final name must be computed - * analytically. - * - * @param {string} attributeName - The name of the attribute. - * @return {AttributeNode} A reference to this node. - */ - setAttributeName(attributeName: string): AttributeNode; - /** - * Returns the attribute name of this node. The method can be - * overwritten in derived classes if the final name must be computed - * analytically. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The attribute name. - */ - getAttributeName(): string; - generate(builder: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import { BackSide } from './three.core.js'; -/** - * Most of the rendering related logic is implemented in the - * {@link Renderer} module and related management components. - * Sometimes it is required though to execute commands which are - * specific to the current 3D backend (which is WebGPU or WebGL 2). - * This abstract base class defines an interface that encapsulates - * all backend-related logic. Derived classes for each backend must - * implement the interface. - * - * @abstract - */ -export class Backend { - /** - * Constructs a new backend. - * - * @param {Object} parameters - An object holding parameters for the backend. - */ - constructor(parameters?: Object); - /** - * The parameters of the backend. - * - * @type {Object} - */ - parameters: Object; - /** - * This weak map holds backend-specific data of objects - * like textures, attributes or render targets. - * - * @type {WeakMap} - */ - data: WeakMap; - /** - * A reference to the renderer. - * - * @type {?Renderer} - * @default null - */ - renderer: Renderer | null; - /** - * A reference to the canvas element the renderer is drawing to. - * - * @type {?(HTMLCanvasElement|OffscreenCanvas)} - * @default null - */ - domElement: (HTMLCanvasElement | OffscreenCanvas) | null; - /** - * A reference to the timestamp query pool. - * - * @type {{render: ?TimestampQueryPool, compute: ?TimestampQueryPool}} - */ - timestampQueryPool: { - render: TimestampQueryPool | null; - compute: TimestampQueryPool | null; - }; - /** - * Whether to track timestamps with a Timestamp Query API or not. - * - * @type {boolean} - * @default false - */ - trackTimestamp: boolean; - /** - * Initializes the backend so it is ready for usage. Concrete backends - * are supposed to implement their rendering context creation and related - * operations in this method. - * - * @async - * @param {Renderer} renderer - The renderer. - * @return {Promise} A Promise that resolves when the backend has been initialized. - */ - init(renderer: Renderer): Promise; - /** - * The coordinate system of the backend. - * - * @abstract - * @type {number} - * @readonly - */ - readonly get coordinateSystem(): number; - /** - * This method is executed at the beginning of a render call and - * can be used by the backend to prepare the state for upcoming - * draw calls. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - beginRender(): void; - /** - * This method is executed at the end of a render call and - * can be used by the backend to finalize work after draw - * calls. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - finishRender(): void; - /** - * Sets the XR rendering destination. - * - * Backends that render directly into XR framebuffers can override this hook. - * - * @param {?Object} xrTarget - The XR rendering destination. - */ - setXRTarget(): void; - /** - * This method is executed at the beginning of a compute call and - * can be used by the backend to prepare the state for upcoming - * compute tasks. - * - * @abstract - * @param {Node|Array} computeGroup - The compute node(s). - */ - beginCompute(): void; - /** - * This method is executed at the end of a compute call and - * can be used by the backend to finalize work after compute - * tasks. - * - * @abstract - * @param {Node|Array} computeGroup - The compute node(s). - */ - finishCompute(): void; - /** - * Executes a draw command for the given render object. - * - * @abstract - * @param {RenderObject} renderObject - The render object to draw. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - */ - draw(): void; - /** - * Executes a compute command for the given compute node. - * - * @abstract - * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. - * @param {Node} computeNode - The compute node. - * @param {Array} bindings - The bindings. - * @param {ComputePipeline} computePipeline - The compute pipeline. - */ - compute(): void; - /** - * Creates a shader program from the given programmable stage. - * - * @abstract - * @param {ProgrammableStage} program - The programmable stage. - */ - createProgram(): void; - /** - * Destroys the shader program of the given programmable stage. - * - * @abstract - * @param {ProgrammableStage} program - The programmable stage. - */ - destroyProgram(): void; - /** - * Creates bindings from the given bind group definition. - * - * @abstract - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(): void; - /** - * Updates the given bind group definition. - * - * @abstract - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - updateBindings(): void; - /** - * Updates a buffer binding. - * - * @abstract - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(): void; - /** - * Creates a render pipeline for the given render object. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(): void; - /** - * Creates a compute pipeline for the given compute node. - * - * @abstract - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(): void; - /** - * Returns `true` if the render pipeline requires an update. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the render pipeline requires an update or not. - */ - needsRenderUpdate(): boolean; - /** - * Returns a cache key that is used to identify render pipelines. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @return {string} The cache key. - */ - getRenderCacheKey(): string; - /** - * Returns a node builder for the given render object. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @param {Renderer} renderer - The renderer. - * @return {NodeBuilder} The node builder. - */ - createNodeBuilder(): NodeBuilder; - /** - * Updates a GPU sampler for the given texture. - * - * @abstract - * @param {Sampler} binding - The sampler binding to update. - * @return {string} The current sampler key. - */ - updateSampler(): string; - /** - * Frees the GPU sampler for the given sampler binding. - * - * @abstract - * @param {Sampler} binding - The sampler binding to free. - */ - destroySampler(): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @abstract - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(): void; - /** - * Uploads the updated texture data to the GPU. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(): void; - /** - * Generates mipmaps for the given texture. - * - * @abstract - * @param {Texture} texture - The texture. - */ - generateMipmaps(): void; - /** - * Destroys the GPU data for the given texture object. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(): void; - /** - * Returns texture data as a typed array. - * - * @abstract - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(): Promise; - /** - * Copies data of the given source texture to the given destination texture. - * - * @abstract - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @abstract - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(): void; - /** - * Creates the GPU buffer of a shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createAttribute(): void; - /** - * Creates the GPU buffer of an indexed shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The indexed buffer attribute. - */ - createIndexAttribute(): void; - /** - * Creates the GPU buffer of a storage attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createStorageAttribute(): void; - /** - * Creates a uniform buffer. - * - * @abstract - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - createUniformBuffer(): void; - /** - * Destroys a uniform buffer. - * - * @abstract - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - destroyUniformBuffer(): void; - /** - * Updates the GPU buffer of a shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute to update. - */ - updateAttribute(): void; - /** - * Destroys the GPU buffer of a shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute to destroy. - */ - destroyAttribute(): void; - /** - * Returns the backend's rendering context. - * - * @abstract - * @return {Object} The rendering context. - */ - getContext(): Object; - /** - * Backends can use this method if they have to run - * logic when the renderer gets resized. - * - * @abstract - */ - updateSize(): void; - /** - * Updates the viewport with the values from the given render context. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - updateViewport(): void; - /** - * Updates a unique identifier for the given render context that can be used - * to allocate resources like occlusion queries or timestamp queries. - * - * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. - */ - updateTimeStampUID(abstractRenderContext: RenderContext | ComputeNode): void; - /** - * Returns a unique identifier for the given render context that can be used - * to allocate resources like occlusion queries or timestamp queries. - * - * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. - * @return {string} The unique identifier. - */ - getTimestampUID(abstractRenderContext: RenderContext | ComputeNode): string; - /** - * Returns all timestamp frames for the given type. - * - * @param {string} type - The type of the time stamp. - * @return {Array} The timestamp frames. - */ - getTimestampFrames(type: string): Array; - /** - * Returns the query pool for the given uid. - * - * @param {string} uid - The unique identifier. - * @return {TimestampQueryPool} The query pool. - */ - _getQueryPool(uid: string): TimestampQueryPool; - /** - * Returns the timestamp for the given uid. - * - * @param {string} uid - The unique identifier. - * @return {number} The timestamp. - */ - getTimestamp(uid: string): number; - /** - * Whether the backend supports query timestamps or not. - * - * @type {boolean} - * @readonly - */ - readonly get hasTimestamp(): boolean; - /** - * Returns `true` if a timestamp for the given uid is available. - * - * @param {string} uid - The unique identifier. - * @return {boolean} Whether the timestamp is available or not. - */ - hasTimestampQuery(uid: string): boolean; - /** - * Returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. Backends must implement this method by using - * a Occlusion Query API. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(): boolean; - /** - * Resolves the time stamp for the given render context and type. - * - * @async - * @abstract - * @param {string} [type='render'] - The type of the time stamp. - * @return {Promise} A Promise that resolves with the time stamp. - */ - resolveTimestampsAsync(type?: string): Promise; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. - * - * @async - * @param {StorageBufferAttribute} attribute - The storage buffer attribute. - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(): Promise; - /** - * Checks if the given feature is supported by the backend. - * - * @async - * @abstract - * @param {string} name - The feature's name. - * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. - */ - hasFeatureAsync(): Promise; - /** - * Checks if the given feature is supported by the backend. - * - * @abstract - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(): boolean; - /** - * Returns the drawing buffer size. - * - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize(): Vector2; - /** - * Defines the scissor test. - * - * @abstract - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(): void; - /** - * Resets the backend's internal state. A no-op for backends without a state cache (e.g. WebGPU). - * - * @abstract - */ - resetState(): void; - /** - * Returns the clear color and alpha into a single - * color object. - * - * @return {Color4} The clear color. - */ - getClearColor(): Color4; - /** - * Returns the DOM element. If no DOM element exists, the backend - * creates a new one. - * - * @return {HTMLCanvasElement} The DOM element. - */ - getDomElement(): HTMLCanvasElement; - /** - * Checks if the backend has the given compatibility. - * - * @abstract - * @param {string} name - The compatibility. - * @return {boolean} Whether the backend has the given compatibility or not. - */ - hasCompatibility(): boolean; - /** - * Initializes the render target defined in the given render context. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - initRenderTarget(): void; - /** - * Sets a dictionary for the given object into the - * internal data structure. - * - * @param {Object} object - The object. - * @param {Object} value - The dictionary to set. - */ - set(object: Object, value: Object): void; - /** - * Returns the dictionary for the given object. - * - * @param {Object} object - The object. - * @return {Object} The object's dictionary. - */ - get(object: Object): Object; - /** - * Checks if the given object has a dictionary - * with data defined. - * - * @param {Object} object - The object. - * @return {boolean} Whether a dictionary for the given object as been defined or not. - */ - has(object: Object): boolean; - /** - * Deletes an object from the internal data structure. - * - * @param {Object} object - The object to delete. - */ - delete(object: Object): void; - /** - * Delete GPU data associated with a bind group. - * - * @abstract - * @param {BindGroup} bindGroup - The bind group. - */ - deleteBindGroupData(): void; - /** - * Frees internal resources. - * - * @abstract - */ - dispose(): void; -} -/** - * Represents a GPU control barrier that synchronizes compute operations within a given scope. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -export class BarrierNode extends Node { - /** - * Constructs a new barrier node. - * - * @param {string} scope - The scope defines the behavior of the node. - */ - constructor(scope: string); - scope: string; - isBarrierNode: boolean; - setup(builder: any): void; - generate(builder: any): void; -} -/** - * Represents a basic model for Image-based lighting (IBL). The environment - * is defined via environment maps in the equirectangular or cube map format. - * `BasicEnvironmentNode` is intended for non-PBR materials like {@link MeshBasicNodeMaterial} - * or {@link MeshPhongNodeMaterial}. - * - * @augments LightingNode - */ -export class BasicEnvironmentNode extends LightingNode { - /** - * Constructs a new basic environment node. - * - * @param {Node} [envNode=null] - A node representing the environment. - */ - constructor(envNode?: Node); - /** - * A node representing the environment. - * - * @type {Node} - * @default null - */ - envNode: Node; - setup(builder: any): void; -} -/** - * A specific version of {@link IrradianceNode} that is only relevant - * for {@link MeshBasicNodeMaterial}. Since the material is unlit, it - * requires a special scaling factor for the light map. - * - * @augments LightingNode - */ -export class BasicLightMapNode extends LightingNode { - /** - * Constructs a new basic light map node. - * - * @param {?Node} [lightMapNode=null] - The light map node. - */ - constructor(lightMapNode?: Node | null); - /** - * The light map node. - * - * @type {?Node} - */ - lightMapNode: Node | null; - setup(builder: any): void; -} -/** - * This version of a node library represents a basic version - * just focusing on lights and tone mapping techniques. - * - * @private - * @augments NodeLibrary - */ -export class BasicNodeLibrary extends NodeLibrary { -} -import { BasicShadowMap } from './three.core.js'; -/** - * This node represents an operation that reinterprets the bit representation of a value - * in one type as a value in another type. - * - * @augments TempNode - */ -export class BitcastNode extends TempNode { - /** - * Constructs a new bitcast node. - * - * @param {Node} valueNode - The value to convert. - * @param {string} conversionType - The type to convert to. - * @param {?string} [inputType = null] - The expected input data type of the bitcast operation. - */ - constructor(valueNode: Node, conversionType: string, inputType?: string | null); - /** - * The data to bitcast to a new type. - * - * @type {Node} - */ - valueNode: Node; - /** - * The type the value will be converted to. - * - * @type {string} - */ - conversionType: string; - /** - * The expected input data type of the bitcast operation. - * - * - * @type {string} - * @default null - */ - inputType: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBitcastNode: boolean; - generateNodeType(builder: any): any; - generate(builder: any): string; -} -/** - * This node represents an operation that counts the bits of a piece of shader data. - * - * @augments MathNode - */ -export class BitcountNode extends MathNode { - /** - * Constructs a new math node. - * - * @param {'countTrailingZeros'|'countLeadingZeros'|'countOneBits'} method - The method name. - * @param {Node} aNode - The first input. - */ - constructor(method: "countTrailingZeros" | "countLeadingZeros" | "countOneBits", aNode: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBitcountNode: boolean; - /** - * Casts the input value of the function to an integer if necessary. - * - * @private - * @param {Node|Node} inputNode - The input value. - * @param {Node} outputNode - The output value. - * @param {string} elementType - The type of the input value. - */ - private _resolveElementType; - _returnDataNode(inputType: any): any; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of countTrailingZeros. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} elementType - The type of the input value. - * @returns {Function} - The generated function - */ - private _createTrailingZerosBaseLayout; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of countLeadingZeros. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} elementType - The type of the input value. - * @returns {Function} - The generated function - */ - private _createLeadingZerosBaseLayout; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of countOneBits. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} elementType - The type of the input value. - * @returns {Function} - The generated function - */ - private _createOneBitsBaseLayout; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of the specified bitcount function. - * including considerations for component-wise bitcounts on vector type inputs. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} inputType - The type of the input value. - * @param {number} typeLength - The vec length of the input value. - * @param {Function} baseFn - The base function that operates on an individual component of the vector. - * @returns {Function} - The alias function for the specified bitcount method. - */ - private _createMainLayout; -} -export namespace BitcountNode { - let COUNT_TRAILING_ZEROS: string; - let COUNT_LEADING_ZEROS: string; - let COUNT_ONE_BITS: string; -} -/** - * Represents blending configuration. - * - * This class encapsulates all blending-related properties that control how - * a material's colors are combined with the colors already in the frame buffer. - */ -export class BlendMode { - /** - * Constructs a new blending configuration. - * - * @param {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} [blending=NormalBlending] - The blending mode. - */ - constructor(blending?: (number | number | number | number | number | number | number)); - /** - * Defines the blending type. - * - * It must be set to `CustomBlending` if custom blending properties like - * {@link BlendMode#blendSrc}, {@link BlendMode#blendDst} or {@link BlendMode#blendEquation} - * should have any effect. - * - * @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} - * @default NormalBlending - */ - blending: (number | number | number | number | number | number | number); - /** - * Defines the blending source factor. - * - * This determines how the source (incoming) fragment color is factored before being added - * to the destination (existing) fragment color in the frame buffer. - * - * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default SrcAlphaFactor - */ - blendSrc: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number); - /** - * Defines the blending destination factor. - * - * This determines how the destination (existing) fragment color in the frame buffer - * is factored before being combined with the source (incoming) fragment color. - * - * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default OneMinusSrcAlphaFactor - */ - blendDst: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number); - /** - * Defines the blending equation. - * - * This determines how the source and destination colors are combined. - * - * @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} - * @default AddEquation - */ - blendEquation: (number | number | number | number | number); - /** - * Defines the blending source alpha factor. - * - * When set, this allows separate control of the alpha channel's source blending factor. - * If `null`, {@link BlendMode#blendSrc} is used for the alpha channel as well. - * - * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default null - */ - blendSrcAlpha: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number) | null; - /** - * Defines the blending destination alpha factor. - * - * When set, this allows separate control of the alpha channel's destination blending factor. - * If `null`, {@link BlendMode#blendDst} is used for the alpha channel as well. - * - * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default null - */ - blendDstAlpha: (number | number | number | number | number | number | number | number | number | number | number | number | number | number | number) | null; - /** - * Defines the blending equation of the alpha channel. - * - * When set, this allows separate control of the alpha channel's blending equation. - * If `null`, {@link BlendMode#blendEquation} is used for the alpha channel as well. - * - * @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} - * @default null - */ - blendEquationAlpha: (number | number | number | number | number) | null; - /** - * Defines whether to premultiply the alpha (transparency) value. - * - * If `true`, the RGB color of the texture or material is multiplied by its alpha value. - * This is useful for transparent textures/materials where the color data - * should already include the transparency information. - * - * @type {boolean} - * @default false - */ - premultiplyAlpha: boolean; - /** - * Copies the blending properties from the given source to this instance. - * - * @param {BlendMode} source - The blending configuration to copy from. - * @return {BlendMode} A reference to this instance. - */ - copy(source: BlendMode): BlendMode; - /** - * Returns a clone of this blending configuration. - * - * @return {BlendMode} A new Blending instance with the same properties. - */ - clone(): BlendMode; -} -import { BoxGeometry } from './three.core.js'; -import { BufferAttribute } from './three.core.js'; -/** - * In earlier `three.js` versions it was only possible to define attribute data - * on geometry level. With `BufferAttributeNode`, it is also possible to do this - * on the node level. - * ```js - * const geometry = new THREE.PlaneGeometry(); - * const positionAttribute = geometry.getAttribute( 'position' ); - * - * const colors = []; - * for ( let i = 0; i < position.count; i ++ ) { - * colors.push( 1, 0, 0 ); - * } - * - * material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) ); - * ``` - * This new approach is especially interesting when geometry data are generated via - * compute shaders. The below line converts a storage buffer into an attribute node. - * ```js - * material.positionNode = positionBuffer.toAttribute(); - * ``` - * @augments InputNode - */ -export class BufferAttributeNode extends InputNode { - /** - * Constructs a new buffer attribute node. - * - * @param {BufferAttribute|InterleavedBuffer|TypedArray} value - The attribute data. - * @param {?string} [bufferType=null] - The buffer type (e.g. `'vec3'`). - * @param {number} [bufferStride=0] - The buffer stride. - * @param {number} [bufferOffset=0] - The buffer offset. - */ - constructor(value: BufferAttribute | InterleavedBuffer | TypedArray, bufferType?: string | null, bufferStride?: number, bufferOffset?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBufferNode: boolean; - /** - * The buffer type (e.g. `'vec3'`). - * - * @type {?string} - * @default null - */ - bufferType: string | null; - /** - * The buffer stride. - * - * @type {number} - * @default 0 - */ - bufferStride: number; - /** - * The buffer offset. - * - * @type {number} - * @default 0 - */ - bufferOffset: number; - /** - * The usage property. Set this to `THREE.DynamicDrawUsage` via `.setUsage()`, - * if you are planning to update the attribute data per frame. - * - * @type {number} - * @default StaticDrawUsage - */ - usage: number; - /** - * Whether the attribute is instanced or not. - * - * @type {boolean} - * @default false - */ - instanced: boolean; - /** - * A reference to the buffer attribute. - * - * @type {?BufferAttribute} - * @default null - */ - attribute: BufferAttribute | null; - /** - * This method is overwritten since the attribute data might be shared - * and thus the hash should be shared as well. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(builder: NodeBuilder): string; - /** - * This method is overwritten since the node type is inferred from - * the buffer attribute. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Depending on which value was passed to the node, `setup()` behaves - * differently. If no instance of `BufferAttribute` was passed, the method - * creates an internal attribute and configures it respectively. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * Generates the code snippet of the buffer attribute node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder): string; - /** - * Overwrites the default implementation to return a fixed value `'bufferAttribute'`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; - /** - * Sets the `usage` property to the given value. - * - * @param {number} value - The usage to set. - * @return {BufferAttributeNode} A reference to this node. - */ - setUsage(value: number): BufferAttributeNode; - /** - * Sets the `instanced` property to the given value. - * - * @param {boolean} value - The value to set. - * @return {BufferAttributeNode} A reference to this node. - */ - setInstanced(value: boolean): BufferAttributeNode; -} -import { BufferGeometry } from './three.core.js'; -/** - * A special type of uniform node which represents array-like data - * as uniform buffers. The access usually happens via `element()` - * which returns an instance of {@link ArrayElementNode}. For example: - * - * ```js - * const bufferNode = buffer( array, 'mat4', count ); - * const matrixNode = bufferNode.element( index ); // access a matrix from the buffer - * ``` - * In general, it is recommended to use the more managed {@link UniformArrayNode} - * since it handles more input types and automatically cares about buffer paddings. - * - * @augments UniformNode - */ -export class BufferNode extends UniformNode { - /** - * Constructs a new buffer node. - * - * @param {Array} value - Array-like buffer data. - * @param {string} bufferType - The data type of the buffer. - * @param {number} [bufferCount=0] - The count of buffer elements. - */ - constructor(value: Array, bufferType: string, bufferCount?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBufferNode: boolean; - /** - * The data type of the buffer. - * - * @type {string} - */ - bufferType: string; - /** - * The uniform node that holds the value of the reference node. - * - * @type {number} - * @default 0 - */ - bufferCount: number; - /** - * An array of update ranges. - * - * @type {Array<{start: number, count: number}>} - */ - updateRanges: Array<{ - start: number; - count: number; - }>; - /** - * Adds a range of data in the data array to be updated on the GPU. - * - * @param {number} start - Position at which to start update. - * @param {number} count - The number of components to update. - */ - addUpdateRange(start: number, count: number): void; - /** - * Clears the update ranges. - */ - clearUpdateRanges(): void; - /** - * Overwrites the default implementation to return a fixed value `'buffer'`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; -} -/** - * The node allows to set values for built-in shader variables. That is - * required for features like hardware-accelerated vertex clipping. - * - * @augments Node - */ -export class BuiltinNode extends Node { - /** - * Constructs a new builtin node. - * - * @param {string} name - The name of the built-in shader variable. - */ - constructor(name: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBuiltinNode: boolean; - /** - * Generates the code snippet of the builtin node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(): string; -} -/** - * This class can be used for applying bump maps to materials. - * - * ```js - * material.normalNode = bumpMap( texture( bumpTex ) ); - * ``` - * - * @augments TempNode - */ -export class BumpMapNode extends TempNode { - /** - * Constructs a new bump map node. - * - * @param {Node} textureNode - Represents the bump map data. - * @param {?Node} [scaleNode=null] - Controls the intensity of the bump effect. - */ - constructor(textureNode: Node, scaleNode?: Node | null); - /** - * Represents the bump map data. - * - * @type {Node} - */ - textureNode: Node; - /** - * Controls the intensity of the bump effect. - * - * @type {?Node} - * @default null - */ - scaleNode: Node | null; - setup(builder: any): any; -} -/** - * A specialized group which enables applications access to the - * Render Bundle API of WebGPU. The group with all its descendant nodes - * are considered as one render bundle and processed as such by - * the renderer. - * - * Only renderable 3D objects are allowed in a bundle group. Other - * types like lights are not supported and must be added to the scene - * outside of the group. - * - * This module is only fully supported by `WebGPURenderer` with a WebGPU backend. - * With a WebGL backend, the group can technically be rendered but without - * any performance improvements. - * - * @augments Group - */ -export class BundleGroup extends Group { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBundleGroup: boolean; - /** - * The bundle group's version. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly version: number; - /** - * Set this property to `true` when the bundle group has changed. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); -} -/** - * The class generates the code of a given node but returns another node in the output. - * This can be used to call a method or node that does not return a value, i.e. - * type `void` on an input where returning a value is required. Example: - * - * ```js - * material.colorNode = myColor.bypass( runVoidFn() ) - *``` - * - * @augments Node - */ -export class BypassNode extends Node { - /** - * Constructs a new bypass node. - * - * @param {Node} outputNode - The output node. - * @param {Node} callNode - The call node. - */ - constructor(outputNode: Node, callNode: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBypassNode: boolean; - /** - * The output node. - * - * @type {Node} - */ - outputNode: Node; - /** - * The call node. - * - * @type {Node} - */ - callNode: Node; - generateNodeType(builder: any): string; - generate(builder: any): string | Node | null; -} -import { ByteType } from './three.core.js'; -/** - * CanvasTarget is a class that represents the final output destination of the renderer. - * - * @augments EventDispatcher - */ -export class CanvasTarget extends EventDispatcher { - /** - * Constructs a new CanvasTarget. - * - * @param {HTMLCanvasElement|OffscreenCanvas} domElement - The canvas element to render to. - */ - constructor(domElement: HTMLCanvasElement | OffscreenCanvas); - /** - * A reference to the canvas element the renderer is drawing to. - * This value of this property will automatically be created by - * the renderer. - * - * @type {HTMLCanvasElement|OffscreenCanvas} - */ - domElement: HTMLCanvasElement | OffscreenCanvas; - /** - * The renderer's pixel ratio. - * - * @private - * @type {number} - * @default 1 - */ - private _pixelRatio; - /** - * The width of the renderer's default framebuffer in logical pixel unit. - * - * @private - * @type {number} - */ - private _width; - /** - * The height of the renderer's default framebuffer in logical pixel unit. - * - * @private - * @type {number} - */ - private _height; - /** - * The viewport of the renderer in logical pixel unit. - * - * @private - * @type {Vector4} - */ - private _viewport; - /** - * The scissor rectangle of the renderer in logical pixel unit. - * - * @private - * @type {Vector4} - */ - private _scissor; - /** - * Whether the scissor test should be enabled or not. - * - * @private - * @type {boolean} - */ - private _scissorTest; - /** - * The color texture of the default framebuffer. - * - * @type {FramebufferTexture} - */ - colorTexture: FramebufferTexture; - /** - * The depth texture of the default framebuffer. - * - * @type {DepthTexture} - */ - depthTexture: DepthTexture; - /** - * Returns the pixel ratio. - * - * @return {number} The pixel ratio. - */ - getPixelRatio(): number; - /** - * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize(target: Vector2): Vector2; - /** - * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The renderer's size in logical pixels. - */ - getSize(target: Vector2): Vector2; - /** - * Sets the given pixel ratio and resizes the canvas if necessary. - * - * @param {number} [value=1] - The pixel ratio. - */ - setPixelRatio(value?: number): void; - /** - * This method allows to define the drawing buffer size by specifying - * width, height and pixel ratio all at once. The size of the drawing - * buffer is computed with this formula: - * ```js - * size.x = width * pixelRatio; - * size.y = height * pixelRatio; - * ``` - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {number} pixelRatio - The pixel ratio. - */ - setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; - /** - * Sets the size of the renderer. - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. - */ - setSize(width: number, height: number, updateStyle?: boolean): void; - /** - * Returns the scissor rectangle. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The scissor rectangle. - */ - getScissor(target: Vector4): Vector4; - /** - * Defines the scissor rectangle. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. - * Instead of passing four arguments, the method also works with a single four-dimensional vector. - * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. - * @param {number} width - The width of the scissor box in logical pixel unit. - * @param {number} height - The height of the scissor box in logical pixel unit. - */ - setScissor(x: number | Vector4, y: number, width: number, height: number): void; - /** - * Returns the scissor test value. - * - * @return {boolean} Whether the scissor test should be enabled or not. - */ - getScissorTest(): boolean; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Returns the viewport definition. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The viewport definition. - */ - getViewport(target: Vector4): Vector4; - /** - * Defines the viewport. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. - * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. - */ - setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; - /** - * Dispatches the resize event. - * - * @private - */ - private _dispatchResize; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * @fires RenderTarget#dispose - */ - dispose(): void; -} -import { CineonToneMapping } from './three.core.js'; -import { ClampToEdgeWrapping } from './three.core.js'; -/** - * In earlier three.js versions, clipping was defined globally - * on the renderer or on material level. This special version of - * `THREE.Group` allows to encode the clipping state into the scene - * graph. Meaning if you create an instance of this group, all - * descendant 3D objects will be affected by the respective clipping - * planes. - * - * Note: `ClippingGroup` can only be used with `WebGPURenderer`. - * - * @augments Group - */ -export class ClippingGroup extends Group { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isClippingGroup: boolean; - /** - * An array with clipping planes. - * - * @type {Array} - */ - clippingPlanes: Array; - /** - * Whether clipping should be enabled or not. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * Whether the intersection of the clipping planes is used to clip objects, rather than their union. - * - * @type {boolean} - * @default false - */ - clipIntersection: boolean; - /** - * Whether shadows should be clipped or not. - * - * @type {boolean} - * @default false - */ - clipShadows: boolean; -} -/** - * This node is used in {@link NodeMaterial} to setup the clipping - * which can happen hardware-accelerated (if supported) and optionally - * use alpha-to-coverage for anti-aliasing clipped edges. - * - * @augments Node - */ -export class ClippingNode extends Node { - /** - * Constructs a new clipping node. - * - * @param {('default'|'hardware'|'alphaToCoverage')} [scope='default'] - The node's scope. Similar to other nodes, - * the selected scope influences the behavior of the node and what type of code is generated. - */ - constructor(scope?: ("default" | "hardware" | "alphaToCoverage")); - /** - * The node's scope. Similar to other nodes, the selected scope influences - * the behavior of the node and what type of code is generated. - * - * @type {('default'|'hardware'|'alphaToCoverage')} - */ - scope: ("default" | "hardware" | "alphaToCoverage"); - /** - * Setups the node depending on the selected scope. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The result node. - */ - setup(builder: NodeBuilder): Node; - hardwareClipping: boolean | undefined; - /** - * Setups alpha to coverage. - * - * @param {Array} intersectionPlanes - The intersection planes. - * @param {Array} unionPlanes - The union planes. - * @return {Node} The result node. - */ - setupAlphaToCoverage(intersectionPlanes: Array, unionPlanes: Array): Node; - /** - * Setups the default clipping. - * - * @param {Array} intersectionPlanes - The intersection planes. - * @param {Array} unionPlanes - The union planes. - * @return {Node} The result node. - */ - setupDefault(intersectionPlanes: Array, unionPlanes: Array): Node; - /** - * Setups hardware clipping. - * - * @param {Array} unionPlanes - The union planes. - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The result node. - */ - setupHardwareClipping(unionPlanes: Array, builder: NodeBuilder): Node; -} -export namespace ClippingNode { - let ALPHA_TO_COVERAGE: string; - let DEFAULT: string; - let HARDWARE: string; -} -/** - * This class represents native code sections. It is the base - * class for modules like {@link FunctionNode} which allows to implement - * functions with native shader languages. - * - * @augments Node - */ -export class CodeNode extends Node { - /** - * Constructs a new code node. - * - * @param {string} [code=''] - The native code. - * @param {Array} [includes=[]] - An array of includes. - * @param {('js'|'wgsl'|'glsl')} [language=''] - The used language. - */ - constructor(code?: string, includes?: Array, language?: ("js" | "wgsl" | "glsl")); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCodeNode: boolean; - /** - * The native code. - * - * @type {string} - * @default '' - */ - code: string; - /** - * An array of includes - * - * @type {Array} - * @default [] - */ - includes: Array; - /** - * The used language. - * - * @type {('js'|'wgsl'|'glsl')} - * @default '' - */ - language: ("js" | "wgsl" | "glsl"); - /** - * Sets the includes of this code node. - * - * @param {Array} includes - The includes to set. - * @return {CodeNode} A reference to this node. - */ - setIncludes(includes: Array): CodeNode; - /** - * Returns the includes of this code node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Array} The includes. - */ - getIncludes(): Array; - generate(builder: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import { Color } from './three.core.js'; -import { ColorManagement } from './three.core.js'; -/** - * This node represents a color space conversion. Meaning it converts - * a color value from a source to a target color space. - * - * @augments TempNode - */ -export class ColorSpaceNode extends TempNode { - /** - * Constructs a new color space node. - * - * @param {Node} colorNode - Represents the color to convert. - * @param {string} source - The source color space. - * @param {string} target - The target color space. - */ - constructor(colorNode: Node, source: string, target: string); - /** - * Represents the color to convert. - * - * @type {Node} - */ - colorNode: Node; - /** - * The source color space. - * - * @type {string} - */ - source: string; - /** - * The target color space. - * - * @type {string} - */ - target: string; - /** - * This method resolves the constants `WORKING_COLOR_SPACE` and - * `OUTPUT_COLOR_SPACE` based on the current configuration of the - * color management and renderer. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} colorSpace - The color space to resolve. - * @return {string} The resolved color space. - */ - resolveColorSpace(builder: NodeBuilder, colorSpace: string): string; - setup(builder: any): Node; -} -import { Compatibility } from './three.core.js'; -/** - * `ComputeBuiltinNode` represents a compute-scope builtin value that expose information - * about the currently running dispatch and/or the device it is running on. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -export class ComputeBuiltinNode extends Node { - /** - * Constructs a new compute builtin node. - * - * @param {string} builtinName - The built-in name. - * @param {string} nodeType - The node type. - */ - constructor(builtinName: string, nodeType: string); - /** - * The built-in name. - * - * @private - * @type {string} - */ - private _builtinName; - /** - * This method is overwritten since hash is derived from the built-in name. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(builder: NodeBuilder): string; - /** - * This method is overwritten since the node type is simply derived from `nodeType`.. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(): string; - /** - * Sets the builtin name. - * - * @param {string} builtinName - The built-in name. - * @return {ComputeBuiltinNode} A reference to this node. - */ - setBuiltinName(builtinName: string): ComputeBuiltinNode; - /** - * Returns the builtin name. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The builtin name. - */ - getBuiltinName(): string; - /** - * Whether the current node builder has the builtin or not. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether the builder has the builtin or not. - */ - hasBuiltin(builder: NodeBuilder): boolean; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -/** - * Represents a compute shader node. - * - * @augments Node - */ -export class ComputeNode extends Node { - /** - * Constructs a new compute node. - * - * @param {Node} computeNode - The node that defines the compute shader logic. - * @param {Array} workgroupSize - An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. - */ - constructor(computeNode: Node, workgroupSize: Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isComputeNode: boolean; - /** - * The node that defines the compute shader logic. - * - * @type {Node} - */ - computeNode: Node; - /** - * An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. - * - * @type {Array} - * @default [ 64 ] - */ - workgroupSize: Array; - /** - * The total number of threads (invocations) to execute. If it is a number, it will be used - * to automatically generate bounds checking against `instanceIndex`. - * - * @type {number|Array} - */ - count: number | Array; - /** - * The dispatch size for workgroups on X, Y, and Z axes. - * Used directly if `count` is not provided. - * - * @type {number|Array} - */ - dispatchSize: number | Array; - /** - * A callback executed when the compute node finishes initialization. - * - * @type {?Function} - */ - onInitFunction: Function | null; - /** - * A uniform node holding the dispatch count for bounds checking. - * Created automatically when `count` is a number. - * - * @type {?UniformNode} - */ - countNode: UniformNode | null; - /** - * Sets the {@link ComputeNode#name} property. - * - * @param {string} name - The name of the uniform. - * @return {ComputeNode} A reference to this node. - */ - setName(name: string): ComputeNode; - /** - * Sets the {@link ComputeNode#name} property. - * - * @deprecated - * @param {string} name - The name of the uniform. - * @return {ComputeNode} A reference to this node. - */ - label(name: string): ComputeNode; - /** - * Sets the callback to run during initialization. - * - * @param {Function} callback - The callback function. - * @return {ComputeNode} A reference to this node. - */ - onInit(callback: Function): ComputeNode; - /** - * The method execute the compute for this node. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateBefore({ renderer }: NodeFrame): void; - setup(builder: any): string | Node | null; - generate(builder: any, output: any): any; -} -/** - * Represents a logical `if/else` statement. Can be used as an alternative - * to the `If()`/`Else()` syntax. - * - * The `select()` method is called in a chaining fashion on a condition. The parameter nodes of `select()` - * determine the outcome of the entire statement. - * - * ```js - * velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity ); - * ``` - * - * @augments Node - */ -export class ConditionalNode extends Node { - /** - * Constructs a new conditional node. - * - * @param {Node} condNode - The node that defines the condition. - * @param {Node} ifNode - The node that is evaluate when the condition ends up `true`. - * @param {?Node} [elseNode=null] - The node that is evaluate when the condition ends up `false`. - */ - constructor(condNode: Node, ifNode: Node, elseNode?: Node | null); - /** - * The node that defines the condition. - * - * @type {Node} - */ - condNode: Node; - /** - * The node that is evaluate when the condition ends up `true`. - * - * @type {Node} - */ - ifNode: Node; - /** - * The node that is evaluate when the condition ends up `false`. - * - * @type {?Node} - * @default null - */ - elseNode: Node | null; - /** - * This method is overwritten since the node type is inferred from the if/else - * nodes. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - setup(builder: any): void; - generate(builder: any, output: any): any; -} -/** - * Class for representing a constant value in the shader. - * - * @augments InputNode - */ -export class ConstNode extends InputNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isConstNode: boolean; - /** - * Generates the shader string of the value with the current node builder. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated value as a shader string. - */ - generateConst(builder: NodeBuilder): string; - generate(builder: any, output: any): any; -} -import { ConstantAlphaFactor } from './three.core.js'; -import { ConstantColorFactor } from './three.core.js'; -/** - * This node can be used as a context management component for another node. - * {@link NodeBuilder} performs its node building process in a specific context and - * this node allows the modify the context. A typical use case is to overwrite `getUV()` e.g.: - * - * ```js - *node.context( { getUV: () => customCoord } ); - *\// or - *material.contextNode = context( { getUV: () => customCoord } ); - *\// or - *renderer.contextNode = context( { getUV: () => customCoord } ); - *\// or - *scenePass.contextNode = context( { getUV: () => customCoord } ); - *``` - * @augments Node - */ -export class ContextNode extends Node { - /** - * Constructs a new context node. - * - * @param {Node} node - The node whose context should be modified. - * @param {Object} [value={}] - The modified context data. - */ - constructor(node?: Node, value?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isContextNode: boolean; - /** - * The node whose context should be modified. - * - * @type {Node} - */ - node: Node; - /** - * The modified context data. - * - * @type {Object} - * @default {} - */ - value: Object; - /** - * This method is overwritten to ensure it returns the type of {@link ContextNode#node}. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Gathers the context data from all parent context nodes. - * - * @return {Object} The gathered context data. - */ - getFlowContextData(): Object; - /** - * This method is overwritten to ensure it returns the member type of {@link ContextNode#node}. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The member name. - * @returns {string} The member type. - */ - getMemberType(builder: NodeBuilder, name: string): string; - analyze(builder: any): void; - setup(builder: any): string | Node | null; - generate(builder: any, output: any): string | Node | null; -} -/** - * This module is part of the TSL core and usually not used in app level code. - * It represents a convert operation during the shader generation process - * meaning it converts the data type of a node to a target data type. - * - * @augments Node - */ -export class ConvertNode extends Node { - /** - * Constructs a new convert node. - * - * @param {Node} node - The node which type should be converted. - * @param {string} convertTo - The target node type. Multiple types can be defined by separating them with a `|` sign. - */ - constructor(node: Node, convertTo: string); - /** - * The node which type should be converted. - * - * @type {Node} - */ - node: Node; - /** - * The target node type. Multiple types can be defined by separating them with a `|` sign. - * - * @type {string} - */ - convertTo: string; - /** - * This method is overwritten since the implementation tries to infer the best - * matching type from the {@link ConvertNode#convertTo} property. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - serialize(data: any): void; - deserialize(data: any): void; - generate(builder: any, output: any): any; -} -import { CubeCamera } from './three.core.js'; -import { CubeDepthTexture } from './three.core.js'; -/** - * This node can be used to automatically convert environment maps in the - * equirectangular format into the cube map format. - * - * @augments TempNode - */ -export class CubeMapNode extends TempNode { - /** - * Constructs a new cube map node. - * - * @param {Node} envNode - The node representing the environment map. - */ - constructor(envNode: Node); - /** - * The node representing the environment map. - * - * @type {Node} - */ - envNode: Node; - /** - * A reference to the internal cube texture. - * - * @private - * @type {?CubeTexture} - * @default null - */ - private _cubeTexture; - /** - * A reference to the internal cube texture node. - * - * @private - * @type {CubeTextureNode} - */ - private _cubeTextureNode; - /** - * A default cube texture that acts as a placeholder. - * It is used when the conversion from equirectangular to cube - * map has not finished yet for a given texture. - * - * @private - * @type {CubeTexture} - */ - private _defaultTexture; - updateBefore(frame: any): void; - setup(builder: any): CubeTextureNode; -} -import { CubeReflectionMapping } from './three.core.js'; -import { CubeRefractionMapping } from './three.core.js'; -/** - * This class represents a cube render target. It is a special version - * of `WebGLCubeRenderTarget` which is compatible with `WebGPURenderer`. - * - * @augments RenderTarget - */ -export class CubeRenderTarget extends RenderTarget { - /** - * Constructs a new cube render target. - * - * @param {number} [size=1] - The size of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(size?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeRenderTarget: boolean; - /** - * Converts the given equirectangular texture to a cube map. - * - * @param {Renderer} renderer - The renderer. - * @param {Texture} texture - The equirectangular texture. - * @return {CubeRenderTarget} A reference to this cube render target. - */ - fromEquirectangularTexture(renderer: Renderer, texture$1: any): CubeRenderTarget; - /** - * Clears this cube render target. - * - * @param {Renderer} renderer - The renderer. - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear(renderer: Renderer, color?: boolean, depth?: boolean, stencil?: boolean): void; -} -import { CubeTexture } from './three.core.js'; -/** - * This type of uniform node represents a cube texture. - * - * @augments TextureNode - */ -export class CubeTextureNode extends TextureNode { - /** - * Constructs a new cube texture node. - * - * @param {CubeTexture} value - The cube texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Node} [biasNode=null] - The bias node. - */ - constructor(value: CubeTexture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeTextureNode: boolean; - /** - * Overwritten with an empty implementation since the `updateMatrix` flag is ignored - * for cube textures. The uv transformation matrix is not applied to cube textures. - * - * @param {boolean} value - The update toggle. - */ - setUpdateMatrix(): void; -} -import { CubeUVReflectionMapping } from './three.core.js'; -import { CullFaceBack } from './three.core.js'; -import { CullFaceFront } from './three.core.js'; -import { CullFaceNone } from './three.core.js'; -import { CustomBlending } from './three.core.js'; -import { CylinderGeometry } from './three.core.js'; -import { DataArrayTexture } from './three.core.js'; -import { DataTexture } from './three.core.js'; -export class DebugNode extends TempNode { - constructor(node: any, callback?: null); - node: any; - callback: any; - generateNodeType(builder: any): any; - setup(builder: any): any; - analyze(builder: any): any; - generate(builder: any): any; -} -import { DecrementStencilOp } from './three.core.js'; -import { DecrementWrapStencilOp } from './three.core.js'; -import { DepthFormat } from './three.core.js'; -import { DepthStencilFormat } from './three.core.js'; -import { DepthTexture } from './three.core.js'; -/** - * An alternative render pipeline that applies output processing directly in - * material shaders. This avoids the intermediate framebuffer and output pass - * used by {@link Renderer}, but changes blending and is not compatible with - * materials that sample the framebuffer, such as transmissive materials. - * - * ```js - * const renderPipeline = new DirectRenderPipeline( renderer ); - * renderPipeline.render( scene, camera ); - * ``` - * - * Note: This module can only be used with `WebGPURenderer`. - * - * @augments RenderPipeline - */ -export class DirectRenderPipeline extends RenderPipeline { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isDirectRenderPipeline: boolean; - /** - * The context node used to apply output processing in material shaders. - * - * @private - * @type {?ContextNode} - * @default null - */ - private _contextNode; - /** - * The renderer context node wrapped by this pipeline. - * - * @private - * @type {?ContextNode} - * @default null - */ - private _rendererContextNode; - /** - * Cached node representations of solid scene backgrounds. - * - * @private - * @type {WeakMap} - */ - private _backgroundNodes; - /** - * Renders the scene with output processing applied directly in material shaders. - * - * @param {Object3D} scene - The scene or object to render. - * @param {Camera} camera - The camera. - */ - render(scene: Object3D, camera: Camera): void; - /** - * Returns a node representation of a solid scene background so it receives - * the same inline output processing as material fragments. - * - * @private - * @param {Object3D} scene - The scene or object to render. - * @return {?UniformNode} The background node. - */ - private _getBackgroundNode; -} -import { DirectionalLight } from './three.core.js'; -/** - * Module for representing directional lights as nodes. - * - * @augments AnalyticLightNode - */ -export class DirectionalLightNode extends AnalyticLightNode { - /** - * Constructs a new directional light node. - * - * @param {?DirectionalLight} [light=null] - The directional light source. - */ - constructor(light?: DirectionalLight | null); - setupDirect(): { - lightDirection: any; - lightColor: Node; - }; -} -import { DoubleSide } from './three.core.js'; -import { DstAlphaFactor } from './three.core.js'; -import { DstColorFactor } from './three.core.js'; -import { DynamicDrawUsage } from './three.core.js'; -/** - * Represents a physical model for Image-based lighting (IBL). The environment - * is defined via environment maps in the equirectangular, cube map or cubeUV (PMREM) format. - * `EnvironmentNode` is intended for PBR materials like {@link MeshStandardNodeMaterial}. - * - * @augments LightingNode - */ -export class EnvironmentNode extends LightingNode { - /** - * Constructs a new environment node. - * - * @param {Node} [envNode=null] - A node representing the environment. - */ - constructor(envNode?: Node); - /** - * A node representing the environment. - * - * @type {?Node} - * @default null - */ - envNode: Node | null; - setup(builder: any): void; - /** - * Returns the PMREM node cache of the current renderer. - * - * @private - * @param {Renderer} renderer - The current renderer. - * @return {WeakMap} The node cache. - */ - private _getPMREMNodeCache; -} -import { EqualCompare } from './three.core.js'; -import { EqualDepth } from './three.core.js'; -import { EqualStencilFunc } from './three.core.js'; -import { EquirectangularReflectionMapping } from './three.core.js'; -import { EquirectangularRefractionMapping } from './three.core.js'; -import { EventDispatcher } from './three.core.js'; -/** - * EventNode is a node that executes a callback during specific update phases. - * - * @augments Node - */ -export class EventNode extends Node { - /** - * Creates an EventNode. - * - * @param {string} eventType - The type of event - * @param {Function} callback - The callback to execute on update. - */ - constructor(eventType: string, callback: Function); - eventType: string; - callback: Function; - setup(builder: any): Node | null; - update(frame: any): void; - updateBefore(frame: any): void; - updateAfter(frame: any): void; -} -export namespace EventNode { - let OBJECT: string; - let MATERIAL: string; - let FRAME: string; - let AFTER_OBJECT: string; - let BEFORE_OBJECT: string; - let BEFORE_MATERIAL: string; - let BEFORE_FRAME: string; - let BEFORE_RENDER_PIPELINE: string; - let AFTER_RENDER_PIPELINE: string; -} -/** - * This class can be used to implement basic expressions in shader code. - * Basic examples for that are `return`, `continue` or `discard` statements. - * - * @augments Node - */ -export class ExpressionNode extends Node { - /** - * Constructs a new expression node. - * - * @param {string} [snippet=''] - The native code snippet. - * @param {string} [nodeType='void'] - The node type. - */ - constructor(snippet?: string, nodeType?: string); - /** - * The native code snippet. - * - * @type {string} - * @default '' - */ - snippet: string; - generate(builder: any, output: any): any; -} -import { FileLoader } from './three.core.js'; -/** - * This module is part of the TSL core and usually not used in app level code. - * It represents a flip operation during the shader generation process - * meaning it flips normalized values with the following formula: - * ``` - * x = 1 - x; - * ``` - * `FlipNode` is internally used to implement any `flipXYZW()`, `flipRGBA()` and - * `flipSTPQ()` method invocations on node objects. For example: - * ```js - * uvNode = uvNode.flipY(); - * ``` - * - * @augments TempNode - */ -export class FlipNode extends TempNode { - /** - * Constructs a new flip node. - * - * @param {Node} sourceNode - The node which component(s) should be flipped. - * @param {string} components - The components that should be flipped e.g. `'x'` or `'xy'`. - */ - constructor(sourceNode: Node, components: string); - /** - * The node which component(s) should be flipped. - * - * @type {Node} - */ - sourceNode: Node; - /** - * The components that should be flipped e.g. `'x'` or `'xy'`. - * - * @type {string} - */ - components: string; - /** - * This method is overwritten since the node type is inferred from the source node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any): string; -} -import { Float16BufferAttribute } from './three.core.js'; -import { Float32BufferAttribute } from './three.core.js'; -import { FloatType } from './three.core.js'; -import { FramebufferTexture } from './three.core.js'; -/** - * This node can be used to evaluate whether a primitive is front or back facing. - * - * @augments Node - */ -export class FrontFacingNode extends Node { - /** - * Constructs a new front facing node. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isFrontFacingNode: boolean; - generate(builder: any): any; -} -import { FrontSide } from './three.core.js'; -import { Frustum } from './three.core.js'; -import { FrustumArray } from './three.core.js'; -/** - * This module represents the call of a {@link FunctionNode}. Developers are usually not confronted - * with this module since they use the predefined TSL syntax `wgslFn` and `glslFn` which encapsulate - * this logic. - * - * @augments TempNode - */ -export class FunctionCallNode extends TempNode { - /** - * Constructs a new function call node. - * - * @param {?FunctionNode} functionNode - The function node. - * @param {Object} [parameters={}] - The parameters for the function call. - */ - constructor(functionNode?: FunctionNode | null, parameters?: { - [x: string]: Node; - }); - /** - * The function node. - * - * @type {?FunctionNode} - * @default null - */ - functionNode: FunctionNode | null; - /** - * The parameters of the function call. - * - * @type {Object} - * @default {} - */ - parameters: { - [x: string]: Node; - }; - /** - * Sets the parameters of the function call node. - * - * @param {Object} parameters - The parameters to set. - * @return {FunctionCallNode} A reference to this node. - */ - setParameters(parameters: { - [x: string]: Node; - }): FunctionCallNode; - /** - * Returns the parameters of the function call node. - * - * @return {Object} The parameters of this node. - */ - getParameters(): { - [x: string]: Node; - }; - /** - * Returns the type of this function call node. - * - * @param {NodeBuilder} builder - The current node builder. - * @returns {string} The type of this node. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the function node of this function call node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} [name] - The name of the member. - * @returns {string} The type of the member. - */ - getMemberType(builder: NodeBuilder, name?: string): string; - generate(builder: any): string; -} -/** - * This class represents a native shader function. It can be used to implement - * certain aspects of a node material with native shader code. There are two predefined - * TSL functions for easier usage. - * - * - `wgslFn`: Creates a WGSL function node. - * - `glslFn`: Creates a GLSL function node. - * - * A basic example with one include looks like so: - * - * ```js - * const desaturateWGSLFn = wgslFn( ` - * fn desaturate( color:vec3 ) -> vec3 { - * let lum = vec3( 0.299, 0.587, 0.114 ); - * return vec3( dot( lum, color ) ); - * }` - *); - * const someWGSLFn = wgslFn( ` - * fn someFn( color:vec3 ) -> vec3 { - * return desaturate( color ); - * } - * `, [ desaturateWGSLFn ] ); - * material.colorNode = someWGSLFn( { color: texture( map ) } ); - *``` - * @augments CodeNode - */ -export class FunctionNode extends CodeNode { - /** - * Returns the type of this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the type of a member of this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member. - * @return {string} The type of the member. - */ - getMemberType(builder: NodeBuilder, name: string): string; - /** - * Returns the inputs of this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Array} The inputs. - */ - getInputs(builder: NodeBuilder): Array; - /** - * Returns the node function for this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {NodeFunction} The node function. - */ - getNodeFunction(builder: NodeBuilder): NodeFunction; - generate(builder: any, output: any): any; -} -/** - * This class allows to define multiple overloaded versions - * of the same function. Depending on the parameters of the function - * call, the node picks the best-fit overloaded version. - * - * @augments Node - */ -export class FunctionOverloadingNode extends Node { - /** - * Constructs a new function overloading node. - * - * @param {Array} functionNodes - Array of `Fn` function definitions. - * @param {...Node} parametersNodes - A list of parameter nodes. - */ - constructor(functionNodes?: Array, ...parametersNodes: Node[]); - /** - * Array of `Fn` function definitions. - * - * @type {Array} - */ - functionNodes: Array; - /** - * A list of parameter nodes. - * - * @type {Array} - */ - parametersNodes: Array; - /** - * The selected overloaded function call. - * - * @private - * @type {ShaderCallNodeInternal} - */ - private _candidateFn; - /** - * This method is overwritten since the node type is inferred from - * the function's return type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the candidate function for the current parameters. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {FunctionNode} The candidate function. - */ - getCandidateFn(builder: NodeBuilder): FunctionNode; - /** - * Sets up the node for the current parameters. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The setup node. - */ - setup(builder: NodeBuilder): Node; -} -/** - * A node builder targeting GLSL. - * - * This module generates GLSL shader code from node materials and also - * generates the respective bindings and vertex buffer definitions. These - * data are later used by the renderer to create render and compute pipelines - * for render objects. - * - * @augments NodeBuilder - */ -export class GLSLNodeBuilder extends NodeBuilder { - /** - * Constructs a new GLSL node builder renderer. - * - * @param {Object3D} object - The 3D object. - * @param {Renderer} renderer - The renderer. - */ - constructor(object: Object3D, renderer: Renderer); - /** - * A dictionary holds for each shader stage ('vertex', 'fragment', 'compute') - * another dictionary which manages UBOs per group ('render','frame','object'). - * - * @type {Object>} - */ - uniformGroups: { - [x: string]: { - [x: string]: NodeUniformsGroup; - }; - }; - /** - * An array that holds objects defining the varying and attribute data in - * context of Transform Feedback. - * - * @type {Array>} - */ - transforms: Array<{ - [x: string]: AttributeNode | string; - }>; - /** - * A dictionary that holds for each shader stage a Map of used extensions. - * - * @type {Object>} - */ - extensions: { - [x: string]: Map; - }; - /** - * A dictionary that holds for each shader stage an Array of used builtins. - * - * @type {Object>} - */ - builtins: { - [x: string]: string[]; - }; - /** - * Checks if the given texture requires a manual conversion to the working color space. - * - * @param {Texture} texture - The texture to check. - * @return {boolean} Whether the given texture requires a conversion to working color space or not. - */ - needsToWorkingColorSpace(texture: Texture): boolean; - /** - * Includes the given method name into the current - * function node. - * - * @private - * @param {string} name - The method name to include. - * @return {CodeNode} The respective code node. - */ - private _include; - /** - * Returns the bitcast method name for a given input and outputType. - * - * @param {string} type - The output type to bitcast to. - * @param {string} inputType - The input type of the. - * @return {string} The resolved GLSL bitcast invocation. - */ - getBitcastMethod(type: string, inputType: string): string; - /** - * Returns the float packing method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolved GLSL float packing method name. - */ - getFloatPackingMethod(encoding: string, layout?: string): string; - /** - * Returns the float unpacking method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolved GLSL float unpacking method name. - */ - getFloatUnpackingMethod(encoding: string, layout?: string): string; - /** - * Returns the native snippet for a ternary operation. - * - * @param {string} condSnippet - The condition determining which expression gets resolved. - * @param {string} ifSnippet - The expression to resolve to if the condition is true. - * @param {string} elseSnippet - The expression to resolve to if the condition is false. - * @return {string} The resolved method name. - */ - getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; - /** - * Builds the given shader node. - * - * @param {ShaderNodeInternal} shaderNode - The shader node. - * @return {string} The GLSL function code. - */ - buildFunctionCode(shaderNode: ShaderNodeInternal): string; - /** - * Setups the Pixel Buffer Object (PBO) for the given storage - * buffer node. - * - * @param {StorageBufferNode} storageBufferNode - The storage buffer node. - */ - setupPBO(storageBufferNode: StorageBufferNode): void; - /** - * Returns a GLSL snippet that represents the property name of the given node. - * - * @param {Node} node - The node. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The property name. - */ - getPropertyName(node: Node, shaderStage?: string): string; - /** - * Returns whether the given name is a reserved keyword of GLSL. - * - * @param {string} name - The name to test. - * @return {boolean} Whether the name is a reserved keyword or not. - */ - isReservedKeyword(name: string): boolean; - /** - * Setups the Pixel Buffer Object (PBO) for the given storage - * buffer node. - * - * @param {StorageArrayElementNode} storageArrayElementNode - The storage array element node. - * @return {string} The property name. - */ - generatePBO(storageArrayElementNode: StorageArrayElementNode): string; - /** - * Generates the GLSL snippet that reads a single texel from a texture without sampling or filtering. - * - * @param {?Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {?string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureLoad(texture: Texture | null, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet for sampling/loading the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet that resolves the dimensions of the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} levelSnippet - A GLSL snippet that represents the mip level. - * @return {string} The GLSL snippet. - */ - generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; - /** - * Generates the GLSL snippet when sampling textures with explicit mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet when sampling textures with a bias to the mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} biasSnippet - A GLSL snippet that represents the bias to apply to the mip level before sampling. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet for sampling/loading the given texture using explicit gradients. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {Array} gradSnippet - An array holding both gradient GLSL snippets. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet for sampling a depth texture and comparing the sampled depth values - * against a reference value. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A GLSL snippet that represents the reference value. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The GLSL snippet. - */ - generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the GLSL snippet for gathering four texels from the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} gatherSnippet - A GLSL snippet that represents the index of the channel to read. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. - * @return {string} The GLSL snippet. - */ - generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; - /** - * Generates the GLSL snippet for performing a depth comparison on four texels in the given depth texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A GLSL snippet that represents the reference value. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. - * @return {string} The GLSL snippet. - */ - generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; - /** - * Returns the uniforms of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the uniforms. - */ - getUniforms(shaderStage: string): string; - /** - * Returns the shader attributes of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the shader attributes. - */ - getAttributes(shaderStage: string): string; - /** - * Returns the members of the given struct type node as a GLSL string. - * - * @param {StructTypeNode} struct - The struct type node. - * @return {string} The GLSL snippet that defines the struct members. - */ - getStructMembers(struct: StructTypeNode): string; - /** - * Returns the structs of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the structs. - */ - getStructs(shaderStage: string): string; - /** - * Returns the varyings of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the varyings. - */ - getVaryings(shaderStage: string): string; - /** - * Returns a builtin representing the index of an invocation within its workgroup. - * - * @return {string} The invocation local index. - */ - getInvocationLocalIndex(): string; - /** - * Returns a builtin representing the size of a subgroup within the current shader. - */ - getSubgroupSize(): void; - /** - * Returns a builtin representing the index of an invocation within its subgroup. - */ - getInvocationSubgroupIndex(): void; - /** - * Returns a builtin representing the index of the current invocation's subgroup within its workgroup. - */ - getSubgroupIndex(): void; - /** - * Returns the frag depth builtin. - * - * @return {string} The frag depth builtin. - */ - getFragDepth(): string; - /** - * Enables the given extension. - * - * @param {string} name - The extension name. - * @param {string} behavior - The extension behavior. - * @param {string} [shaderStage=this.shaderStage] - The shader stage. - */ - enableExtension(name: string, behavior: string, shaderStage?: string): void; - /** - * Returns the enabled extensions of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the enabled extensions. - */ - getExtensions(shaderStage: string): string; - /** - * Returns the clip distances builtin. - * - * @return {string} The clip distances builtin. - */ - getClipDistance(): string; - /** - * Whether the requested feature is available or not. - * - * @param {string} name - The requested feature. - * @return {boolean} Whether the requested feature is supported or not. - */ - isAvailable(name: string): boolean; - /** - * Enables hardware clipping. - * - * @param {string} planeCount - The clipping plane count. - */ - enableHardwareClipping(planeCount: string): void; - /** - * Enables multiview. - */ - enableMultiview(): void; - /** - * Registers a transform in context of Transform Feedback. - * - * @param {string} varyingName - The varying name. - * @param {AttributeNode} attributeNode - The attribute node. - */ - registerTransform(varyingName: string, attributeNode: AttributeNode): void; - /** - * Returns the transforms of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the transforms. - */ - getTransforms(): string; - /** - * Returns a GLSL struct based on the given name and variables. - * - * @private - * @param {string} name - The struct name. - * @param {string} vars - The struct variables. - * @return {string} The GLSL snippet representing a struct. - */ - private _getGLSLUniformStruct; - /** - * Returns a GLSL vertex shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getGLSLVertexCode; - /** - * Returns a GLSL fragment shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getGLSLFragmentCode; - /** - * This method is one of the more important ones since it's responsible - * for generating a matching binding instance for the given uniform node. - * - * These bindings are later used in the renderer to create bind groups - * and layouts. - * - * @param {UniformNode} node - The uniform node. - * @param {string} type - The node data type. - * @param {string} shaderStage - The shader stage. - * @param {?string} [name=null] - An optional uniform name. - * @return {NodeUniform} The node uniform object. - */ - getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; -} -/** - * A GLSL node parser. - * - * @augments NodeParser - */ -export class GLSLNodeParser extends NodeParser { - /** - * The method parses the given GLSL code an returns a node function. - * - * @param {string} source - The GLSL code. - * @return {GLSLNodeFunction} A node function. - */ - parseFunction(source: string): GLSLNodeFunction; -} -import { GreaterCompare } from './three.core.js'; -import { GreaterDepth } from './three.core.js'; -import { GreaterEqualCompare } from './three.core.js'; -import { GreaterEqualDepth } from './three.core.js'; -import { GreaterEqualStencilFunc } from './three.core.js'; -import { GreaterStencilFunc } from './three.core.js'; -import { Group } from './three.core.js'; -import { HalfFloatType } from './three.core.js'; -import { HemisphereLight } from './three.core.js'; -/** - * Module for representing hemisphere lights as nodes. - * - * @augments AnalyticLightNode - */ -export class HemisphereLightNode extends AnalyticLightNode { - /** - * Constructs a new hemisphere light node. - * - * @param {?HemisphereLight} [light=null] - The hemisphere light source. - */ - constructor(light?: HemisphereLight | null); - /** - * Uniform node representing the light's position. - * - * @type {UniformNode} - */ - lightPositionNode: UniformNode; - /** - * A node representing the light's direction. - * - * @type {Node} - */ - lightDirectionNode: Node; - /** - * Uniform node representing the light's ground color. - * - * @type {UniformNode} - */ - groundColorNode: UniformNode; - /** - * Overwritten to updated hemisphere light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - setup(builder: any): void; -} -/** - * A IES version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. - * - * @augments SpotLight - */ -export class IESSpotLight extends SpotLight { - /** - * The IES map. It's a lookup table that stores normalized attenuation factors - * (0.0 to 1.0) that represent the light's intensity at a specific angle. - * - * @type {?Texture} - * @default null - */ - iesMap: Texture | null; - copy(source: any, recursive: any): this; -} -/** - * An IES version of the default spot light node. - * - * @augments SpotLightNode - */ -export class IESSpotLightNode extends SpotLightNode { - /** - * The texture node representing the IES texture. - * - * @type {?TextureNode} - * @default null - */ - _iesTextureNode: TextureNode | null; -} -import { IncrementStencilOp } from './three.core.js'; -import { IncrementWrapStencilOp } from './three.core.js'; -/** - * This class represents shader indices of different types. The following predefined node - * objects cover frequent use cases: - * - * - `vertexIndex`: The index of a vertex within a mesh. - * - `instanceIndex`: The index of either a mesh instance or an invocation of a compute shader. - * - `drawIndex`: The index of a draw call. - * - `invocationLocalIndex`: The index of a compute invocation within the scope of a workgroup load. - * - `invocationSubgroupIndex`: The index of a compute invocation within the scope of a subgroup. - * - `subgroupIndex`: The index of a compute invocation's subgroup within its workgroup. - * - * @augments Node - */ -export class IndexNode extends Node { - /** - * Constructs a new index node. - * - * @param {('vertex'|'instance'|'subgroup'|'invocationLocal'|'invocationGlobal'|'invocationSubgroup'|'draw')} scope - The scope of the index node. - */ - constructor(scope: ("vertex" | "instance" | "subgroup" | "invocationLocal" | "invocationGlobal" | "invocationSubgroup" | "draw")); - /** - * The scope of the index node. - * - * @type {string} - */ - scope: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isIndexNode: boolean; - generate(builder: any): any; -} -export namespace IndexNode { - let VERTEX: string; - let INSTANCE: string; - let SUBGROUP: string; - let INVOCATION_LOCAL: string; - let INVOCATION_SUBGROUP: string; - let DRAW: string; -} -/** - * This special type of buffer attribute is intended for compute shaders. - * It can be used to encode draw parameters for indirect draw calls. - * - * Note: This type of buffer attribute can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments StorageBufferAttribute - */ -export class IndirectStorageBufferAttribute extends StorageBufferAttribute { - /** - * Constructs a new storage buffer attribute. - * - * @param {number|Uint32Array} count - The item count. It is also valid to pass a `Uint32Array` as an argument. - * The subsequent parameter is then obsolete. - * @param {number} itemSize - The item size. - */ - constructor(count: number | Uint32Array, itemSize: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isIndirectStorageBufferAttribute: boolean; -} -/** - * Base class for representing data input nodes. - * - * @augments Node - */ -export class InputNode extends Node { - /** - * Constructs a new input node. - * - * @param {any} value - The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). - * @param {?string} nodeType - The node type. If no explicit type is defined, the node tries to derive the type from its value. - */ - constructor(value: any, nodeType?: string | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInputNode: boolean; - /** - * The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). - * - * @type {any} - */ - value: any; - /** - * The precision of the value in the shader. - * - * @type {?('low'|'medium'|'high')} - * @default null - */ - precision: ("low" | "medium" | "high") | null; - generateNodeType(): string | null; - /** - * Returns the input type of the node which is by default the node type. Derived modules - * might overwrite this method and use a fixed type or compute one analytically. - * - * A typical example for different input and node types are textures. The input type of a - * normal RGBA texture is `texture` whereas its node type is `vec4`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(builder: NodeBuilder): string; - /** - * Sets the precision to the given value. The method can be - * overwritten in derived classes if the final precision must be computed - * analytically. - * - * @param {('low'|'medium'|'high')} precision - The precision of the input value in the shader. - * @return {InputNode} A reference to this node. - */ - setPrecision(precision: ("low" | "medium" | "high")): InputNode; - serialize(data: any): void; - deserialize(data: any): void; - generate(): void; -} -/** - * InspectorBase is the base class for all inspectors. - * - * @augments EventDispatcher - */ -export class InspectorBase extends EventDispatcher { - /** - * The renderer associated with this inspector. - * - * @type {WebGLRenderer} - * @private - */ - private _renderer; - /** - * The current frame being processed. - * - * @type {Object} - */ - currentFrame: Object; - /** - * Indicates whether the inspector is running. - * - * @type {boolean} - * @default false - */ - isRunning: boolean; - /** - * Indicates whether the inspector is enabled. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * Returns the node frame for the current renderer. - * - * @return {Object} The node frame. - */ - get nodeFrame(): Object; - /** - * Sets the renderer for this inspector. - * - * @param {WebGLRenderer} renderer - The renderer to associate with this inspector. - * @return {InspectorBase} This inspector instance. - */ - setRenderer(renderer: WebGLRenderer): InspectorBase; - /** - * Returns the renderer associated with this inspector. - * - * @return {WebGLRenderer} The associated renderer. - */ - getRenderer(): WebGLRenderer; - /** - * Initializes the inspector. - */ - init(): void; - /** - * Called when a frame begins. - */ - begin(): void; - /** - * Called when a frame ends. - */ - finish(): void; - /** - * Inspects a node. - * - * @param {Node} node - The node to inspect. - */ - inspect(): void; - /** - * When a compute operation is performed. - * - * @param {ComputeNode} computeNode - The compute node being executed. - * @param {number|Array} dispatchSizeOrCount - The dispatch size or count. - */ - computeAsync(): void; - /** - * Called when a compute operation begins. - * - * @param {string} uid - A unique identifier for the render context. - * @param {ComputeNode} computeNode - The compute node being executed. - */ - beginCompute(): void; - /** - * Called when a compute operation ends. - * - * @param {string} uid - A unique identifier for the render context. - * @param {ComputeNode} computeNode - The compute node being executed. - */ - finishCompute(): void; - /** - * Called when a render operation begins. - * - * @param {string} uid - A unique identifier for the render context. - * @param {Scene} scene - The scene being rendered. - * @param {Camera} camera - The camera being used for rendering. - * @param {?WebGLRenderTarget} renderTarget - The render target, if any. - */ - beginRender(): void; - /** - * Called when an animation loop ends. - * - * @param {string} uid - A unique identifier for the render context. - */ - finishRender(): void; - /** - * Called when a texture copy operation is performed. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - */ - copyTextureToTexture(): void; - /** - * Called when a framebuffer copy operation is performed. - * - * @param {Texture} framebufferTexture - The texture associated with the framebuffer. - */ - copyFramebufferToTexture(): void; -} -/** - * InspectorNode is a wrapper node that allows inspection of node values during rendering. - * It can be used to debug or analyze node outputs in the rendering pipeline. - * - * @augments Node - */ -export class InspectorNode extends Node { - /** - * Creates an InspectorNode. - * - * @param {Node} node - The node to inspect. - * @param {string} [name=''] - Optional name for the inspector node. - * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. - */ - constructor(node: Node, name?: string, callback?: Function | null); - node: Node; - callback: Function | null; - isInspectorNode: boolean; - /** - * Returns the name of the inspector node. - * - * @returns {string} - */ - getName(): string; - /** - * Updates the inspector node, allowing inspection of the wrapped node. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - /** - * Returns the type of the wrapped node. - * - * @param {NodeBuilder} builder - The node builder. - * @returns {string} - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Sets up the inspector node. - * - * @param {NodeBuilder} builder - The node builder. - * @returns {Node} The setup node. - */ - setup(builder: NodeBuilder): Node; -} -import { InstancedBufferAttribute } from './three.core.js'; -import { InstancedInterleavedBuffer } from './three.core.js'; -import { IntType } from './three.core.js'; -import { InterleavedBuffer } from './three.core.js'; -import { InterleavedBufferAttribute } from './three.core.js'; -import { InvertStencilOp } from './three.core.js'; -/** - * A generic class that can be used by nodes which contribute - * irradiance to the scene. E.g. a light map node can be used - * as input for this module. Used in {@link NodeMaterial}. - * - * @augments LightingNode - */ -export class IrradianceNode extends LightingNode { - /** - * Constructs a new irradiance node. - * - * @param {Node} node - A node contributing irradiance. - */ - constructor(node: Node); - /** - * A node contributing irradiance. - * - * @type {Node} - */ - node: Node; - setup(builder: any): void; -} -/** - * This node can be used as a cache management component for another node. - * Caching is in general used by default in {@link NodeBuilder} but this node - * allows the usage of a shared parent cache during the build process. - * - * @augments Node - */ -export class IsolateNode extends Node { - /** - * Constructs a new cache node. - * - * @param {Node} node - The node that should be cached. - * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. - */ - constructor(node: Node, parent?: boolean); - /** - * The node that should be cached. - * - * @type {Node} - */ - node: Node; - /** - * Whether this node refers to a shared parent cache or not. - * - * @type {boolean} - * @default true - */ - parent: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isIsolateNode: boolean; - generateNodeType(builder: any): string; - build(builder: any, ...params: any[]): string | Node | null; - setParent(parent: any): this; - getParent(): boolean; -} -/** - * This module is part of the TSL core and usually not used in app level code. - * It represents a join operation during the shader generation process. - * For example in can compose/join two single floats into a `vec2` type. - * - * @augments TempNode - */ -export class JoinNode extends TempNode { - /** - * Constructs a new join node. - * - * @param {Array} nodes - An array of nodes that should be joined. - * @param {?string} [nodeType=null] - The node type. - */ - constructor(nodes?: Array, nodeType?: string | null); - /** - * An array of nodes that should be joined. - * - * @type {Array} - */ - nodes: Array; - /** - * This method is overwritten since the node type must be inferred from the - * joined data length if not explicitly defined. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any, output: any): any; -} -import { KeepStencilOp } from './three.core.js'; -import { LessCompare } from './three.core.js'; -import { LessDepth } from './three.core.js'; -import { LessEqualCompare } from './three.core.js'; -import { LessEqualDepth } from './three.core.js'; -import { LessEqualStencilFunc } from './three.core.js'; -import { LessStencilFunc } from './three.core.js'; -import { LightProbe } from './three.core.js'; -/** - * Module for representing light probes as nodes. - * - * @augments AnalyticLightNode - */ -export class LightProbeNode extends AnalyticLightNode { - /** - * Constructs a new light probe node. - * - * @param {?LightProbe} [light=null] - The light probe. - */ - constructor(light?: LightProbe | null); - /** - * Light probe represented as a uniform of spherical harmonics. - * - * @type {UniformArrayNode} - */ - lightProbe: UniformArrayNode; - /** - * Overwritten to updated light probe specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - setup(builder: any): void; -} -/** - * This renderer module manages the lights nodes which are unique - * per scene + camera + lighting combination. - * - * The lights node itself is later configured in the render list - * with the actual lights from the scene. - * - * @private - */ -export class Lighting { - /** - * Whether this lighting manager is enabled or not. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * A stack of light arrays saved per render via {@link Lighting#beginRender}. - * - * @private - * @type {Array>} - */ - private _cache; - /** - * A map of lights nodes per scene. - * - * @private - * @type {WeakMap} - */ - private _lightsNodeMap; - /** - * Creates a new lights node for the given array of lights. - * - * @param {Array} lights - The render object. - * @return {LightsNode} The lights node. - */ - createNode(lights?: Array): LightsNode; - /** - * Returns a lights node for the given scene. - * - * @param {Scene} scene - The scene. - * @return {LightsNode} The lights node. - */ - getNode(scene: Scene): LightsNode; - /** - * Saves the current lights of the scene's lights node so they can be restored - * in {@link Lighting#finishRender}. Must be paired with a `finishRender()` call - * to avoid memory leaks. - * - * Nested render calls might mutate the lights array so a save/restore is required - * for each render call. - * - * @param {Scene} scene - The scene. - */ - beginRender(scene: Scene): void; - /** - * Restores the lights saved by the matching {@link Lighting#beginRender} call. - * - * @param {Scene} scene - The scene. - */ - finishRender(scene: Scene): void; -} -/** - * `LightingContextNode` represents an extension of the {@link ContextNode} module - * by adding lighting specific context data. It represents the runtime context of - * {@link LightsNode}. - * - * @augments ContextNode - */ -export class LightingContextNode extends ContextNode { - /** - * Constructs a new lighting context node. - * - * @param {LightsNode} lightsNode - The lights node. - * @param {?LightingModel} [lightingModel=null] - The current lighting model. - * @param {?Array} materialLightings - The material lightings nodes. - * @param {?Node} [backdropNode=null] - A backdrop node. - * @param {?Node} [backdropAlphaNode=null] - A backdrop alpha node. - */ - constructor(lightsNode: LightsNode, lightingModel?: LightingModel | null, materialLightings?: Array | null, backdropNode?: Node | null, backdropAlphaNode?: Node | null); - /** - * The current lighting model. - * - * @type {?LightingModel} - * @default null - */ - lightingModel: LightingModel | null; - /** - * @type {?Array} - * @default [] - */ - materialLightings: Array | null; - /** - * A backdrop node. - * - * @type {?Node} - * @default null - */ - backdropNode: Node | null; - /** - * A backdrop alpha node. - * - * @type {?Node} - * @default null - */ - backdropAlphaNode: Node | null; - _value: { - radiance: Node; - irradiance: Node; - iblIrradiance: Node; - ambientOcclusion: Node; - reflectedLight: { - directDiffuse: Node; - directSpecular: Node; - indirectDiffuse: Node; - indirectSpecular: Node; - }; - backdrop: Node; - backdropAlpha: Node; - } | null; - /** - * Returns a lighting context object. - * - * @return {{ - * radiance: Node, - * irradiance: Node, - * iblIrradiance: Node, - * ambientOcclusion: Node, - * reflectedLight: {directDiffuse: Node, directSpecular: Node, indirectDiffuse: Node, indirectSpecular: Node}, - * backdrop: Node, - * backdropAlpha: Node - * }} The lighting context object. - */ - getContext(): { - radiance: Node; - irradiance: Node; - iblIrradiance: Node; - ambientOcclusion: Node; - reflectedLight: { - directDiffuse: Node; - directSpecular: Node; - indirectDiffuse: Node; - indirectSpecular: Node; - }; - backdrop: Node; - backdropAlpha: Node; - }; -} -/** - * Abstract class for implementing lighting models. The module defines - * multiple methods that concrete lighting models can implement. These - * methods are executed at different points during the light evaluation - * process. - */ -export class LightingModel { - /** - * This method is intended for setting up lighting model and context data - * which are later used in the evaluation process. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - start(builder: NodeBuilder): void; - /** - * This method is intended for executing final tasks like final updates - * to the outgoing light. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - finish(): void; - /** - * This method is intended for implementing the direct light term and - * executed during the build process of directional, point and spot light nodes. - * - * @abstract - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct(): void; - /** - * This method is intended for implementing the direct light term for - * rect area light nodes. - * - * @abstract - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - directRectArea(): void; - /** - * This method is intended for implementing the indirect light term. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - indirect(): void; - /** - * This method is intended for implementing the ambient occlusion term. - * Unlike other methods, this method must be called manually by the lighting - * model in its indirect term. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - ambientOcclusion(): void; -} -/** - * Base class for lighting nodes. - * - * @augments Node - */ -export class LightingNode extends Node { - /** - * Constructs a new lighting node. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLightingNode: boolean; -} -/** - * This node represents the scene's lighting and manages the lighting model's life cycle - * for the current build 3D object. It is responsible for computing the total outgoing - * light in a given lighting context. - * - * @augments Node - */ -export class LightsNode extends Node { - /** - * Constructs a new lights node. - */ - constructor(); - /** - * A node representing the total diffuse light. - * - * @type {Node} - */ - totalDiffuseNode: Node; - /** - * A node representing the total specular light. - * - * @type {Node} - */ - totalSpecularNode: Node; - /** - * A node representing the outgoing light. - * - * @type {Node} - */ - outgoingLightNode: Node; - /** - * An array representing the lights in the scene. - * - * @private - * @type {Array} - */ - private _lights; - /** - * Computes a hash value for identifying the current light nodes setup. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {string} The computed hash. - */ - getHash(builder: NodeBuilder): string; - /** - * Analyzes the node's dependencies by building all nested light nodes - * and the output node. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - */ - analyze(builder: NodeBuilder): void; - /** - * Creates lighting nodes for each scene light. This makes it possible to further - * process lights in the node system. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Array} The array of lighting nodes. - */ - setupLightsNode(builder: NodeBuilder): Array; - /** - * Sets up a direct light in the lighting model. - * - * @param {Object} builder - The builder object containing the context and stack. - * @param {Object} lightNode - The light node. - * @param {Object} lightData - The light object containing color and direction properties. - */ - setupDirectLight(builder: Object, lightNode: Object, lightData: Object): void; - /** - * Sets up a direct rect area light in the lighting model. - * - * @param {Object} builder - The builder object containing the context and stack. - * @param {Object} lightNode - The light node. - * @param {Object} lightData - The light object containing color and area light properties. - */ - setupDirectRectAreaLight(builder: Object, lightNode: Object, lightData: Object): void; - /** - * Setups the internal lights by building all respective - * light nodes. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @param {Array} lightNodes - An array of lighting nodes. - */ - setupLights(builder: NodeBuilder, lightNodes: Array): void; - getLightNodes(builder: any): any; - /** - * The implementation makes sure that for each light in the scene - * there is a corresponding light node. By building the light nodes - * and evaluating the lighting model the outgoing light is computed. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Node} A node representing the outgoing light. - */ - setup(builder: NodeBuilder): Node; - /** - * Configures this node with an array of lights. - * - * @param {Array} lights - An array of lights. - * @return {LightsNode} A reference to this node. - */ - setLights(lights: Array): LightsNode; - /** - * Returns an array of the scene's lights. - * - * @return {Array} The scene's lights. - */ - getLights(): Array; - /** - * Returns an array of the scene's lights. - * - * The light variations are shader-dependent; - * if this array changes, the shader needs to be recreated. - * - * @return {Array} The scene's lights. - */ - getBuiltinLights(): Array; - /** - * Whether the scene has lights or not. - * - * @type {boolean} - */ - get hasLights(): boolean; -} -/** - * This node material can be used to render lines with a size larger than one - * by representing them as instanced meshes. - * - * @augments NodeMaterial - */ -export class Line2NodeMaterial extends NodeMaterial { - /** - * Constructs a new node material for wide line rendering. - * - * @param {Object} [parameters={}] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLine2NodeMaterial: boolean; - /** - * The dash offset. - * - * @type {number} - * @default 0 - */ - dashOffset: number; - /** - * Defines the offset. - * - * @type {?Node} - * @default null - */ - offsetNode: Node | null; - /** - * Defines the dash scale. - * - * @type {?Node} - * @default null - */ - dashScaleNode: Node | null; - /** - * Defines the dash size. - * - * @type {?Node} - * @default null - */ - dashSizeNode: Node | null; - /** - * Defines the gap size. - * - * @type {?Node} - * @default null - */ - gapSizeNode: Node | null; - _useDash: any; - _useAlphaToCoverage: boolean; - _useWorldUnits: boolean; - set lineColorNode(value: Node | null); - /** - * Defines the lines color. - * - * @deprecated since r185. Use {@link NodeMaterial#colorNode} instead. - * @type {?Node} - */ - get lineColorNode(): Node | null; - set worldUnits(value: boolean); - /** - * Whether the lines should sized in world units or not. - * When set to `false` the unit is pixel. - * - * @type {boolean} - * @default false - */ - get worldUnits(): boolean; - set dashed(value: boolean); - /** - * Whether the lines should be dashed or not. - * - * @type {boolean} - * @default false - */ - get dashed(): boolean; -} -import { LineBasicMaterial } from './three.core.js'; -/** - * Node material version of {@link LineBasicMaterial}. - * - * @augments NodeMaterial - */ -export class LineBasicNodeMaterial extends NodeMaterial { - /** - * Constructs a new line basic node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineBasicNodeMaterial: boolean; -} -import { LineDashedMaterial } from './three.core.js'; -/** - * Node material version of {@link LineDashedMaterial}. - * - * @augments NodeMaterial - */ -export class LineDashedNodeMaterial extends NodeMaterial { - /** - * Constructs a new line dashed node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineDashedNodeMaterial: boolean; - /** - * The dash offset. - * - * @type {number} - * @default 0 - */ - dashOffset: number; - /** - * The offset of dash materials is by default inferred from the `dashOffset` - * property. This node property allows to overwrite the default - * and define the offset with a node instead. - * - * If you don't want to overwrite the offset but modify the existing - * value instead, use {@link materialLineDashOffset}. - * - * @type {?Node} - * @default null - */ - offsetNode: Node | null; - /** - * The scale of dash materials is by default inferred from the `scale` - * property. This node property allows to overwrite the default - * and define the scale with a node instead. - * - * If you don't want to overwrite the scale but modify the existing - * value instead, use {@link materialLineScale}. - * - * @type {?Node} - * @default null - */ - dashScaleNode: Node | null; - /** - * The dash size of dash materials is by default inferred from the `dashSize` - * property. This node property allows to overwrite the default - * and define the dash size with a node instead. - * - * If you don't want to overwrite the dash size but modify the existing - * value instead, use {@link materialLineDashSize}. - * - * @type {?Node} - * @default null - */ - dashSizeNode: Node | null; - /** - * The gap size of dash materials is by default inferred from the `gapSize` - * property. This node property allows to overwrite the default - * and define the gap size with a node instead. - * - * If you don't want to overwrite the gap size but modify the existing - * value instead, use {@link materialLineGapSize}. - * - * @type {?Node} - * @default null - */ - gapSizeNode: Node | null; -} -import { LinearFilter } from './three.core.js'; -import { LinearMipMapLinearFilter } from './three.core.js'; -import { LinearMipmapLinearFilter } from './three.core.js'; -import { LinearMipmapNearestFilter } from './three.core.js'; -import { LinearSRGBColorSpace } from './three.core.js'; -import { LinearToneMapping } from './three.core.js'; -import { LinearTransfer } from './three.core.js'; -import { Loader } from './three.core.js'; -/** - * This module offers a variety of ways to implement loops in TSL. In it's basic form it's: - * ```js - * Loop( count, ( { i } ) => { - * - * } ); - * ``` - * However, it is also possible to define a start and end ranges, data types and loop conditions: - * ```js - * Loop( { start: int( 0 ), end: int( 10 ), type: 'int', condition: '<' }, ( { i } ) => { - * - * } ); - *``` - * Nested loops can be defined in a compacted form: - * ```js - * Loop( 10, 5, ( { i, j } ) => { - * - * } ); - * ``` - * Loops that should run backwards can be defined like so: - * ```js - * Loop( { start: 10 }, () => {} ); - * ``` - * It is possible to execute with boolean values, similar to the `while` syntax. - * ```js - * const value = float( 0 ).toVar(); - * - * Loop( value.lessThan( 10 ), () => { - * - * value.addAssign( 1 ); - * - * } ); - * ``` - * The module also provides `Break()` and `Continue()` TSL expression for loop control. - * @augments Node - */ -export class LoopNode extends Node { - /** - * Constructs a new loop node. - * - * @param {Array} params - Depending on the loop type, array holds different parameterization values for the loop. - */ - constructor(params?: Array); - params: any[]; - /** - * Returns a loop variable name based on an index. The pattern is - * `0` = `i`, `1`= `j`, `2`= `k` and so on. - * - * @param {number} index - The index. - * @return {string} The loop variable name. - */ - getVarName(index: number): string; - /** - * Returns properties about this node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Object} The node properties. - */ - getProperties(builder: NodeBuilder): Object; - _getInternalParams(): any[]; - setup(builder: any): void; - generate(builder: any): void; -} -/** - * This node can be used setup a MRT context for rendering. A typical MRT setup for - * post-processing is shown below: - * ```js - * const mrtNode = mrt( { - * output: output, - * normal: normalView - * } ) ; - * ``` - * The MRT output is defined as a dictionary. - * - * @augments OutputStructNode - */ -export class MRTNode extends OutputStructNode { - /** - * Constructs a new output struct node. - * - * @param {Object} outputNodes - The MRT outputs. - */ - constructor(outputNodes: { - [x: string]: Node; - }); - /** - * A dictionary representing the MRT outputs. The key - * is the name of the output, the value the node which produces - * the output result. - * - * @type {Object} - */ - outputNodes: { - [x: string]: Node; - }; - /** - * A dictionary storing the blend modes for each output. - * - * @type {Object} - */ - blendModes: { - [x: string]: BlendMode; - }; - /** - * A dictionary storing the clear colors for each output. - * - * @type {Object} - */ - clearColors: { - [x: string]: Color4; - }; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMRTNode: boolean; - /** - * Sets the blend mode for the given output name. - * - * @param {string} name - The name of the output. - * @param {BlendMode} blend - The blending mode. - * @return {MRTNode} The current MRT node. - */ - setBlendMode(name: string, blend: BlendMode): MRTNode; - /** - * Returns the blend mode for the given output name. - * - * @param {string} name - The name of the output. - * @return {BlendMode} The blend mode. - */ - getBlendMode(name: string): BlendMode; - /** - * Sets the clear color for the given output name. - * - * @param {string} name - The name of the output. - * @param {number|string|Color} color - The clear color. - * @param {number} [alpha=1] - The clear alpha. - * @return {MRTNode} The current MRT node. - */ - setClearColor(name: string, color: number | string | Color, alpha?: number): MRTNode; - /** - * Returns the clear color for the given output name. - * - * @param {string} name - The name of the output. - * @return {?Color4} The clear color. Returns `null` if no clear color is defined - * which means the renderer's default clear policy is applied. - */ - getClearColor(name: string): Color4 | null; - /** - * Returns `true` if the MRT node has an output with the given name. - * - * @param {string} name - The name of the output. - * @return {NodeBuilder} Whether the MRT node has an output for the given name or not. - */ - has(name: string): NodeBuilder; - /** - * Returns the output node for the given name. - * - * @param {string} name - The name of the output. - * @return {Node} The output node. - */ - get(name: string): Node; - /** - * Merges the outputs of the given MRT node with the outputs of this node. - * - * @param {MRTNode} mrtNode - The MRT to merge. - * @return {MRTNode} A new MRT node with merged outputs.. - */ - merge(mrtNode: MRTNode): MRTNode; - setup(builder: any): Node | null; -} -import { Material } from './three.core.js'; -import { MaterialBlending } from './three.core.js'; -import { MaterialLoader } from './three.core.js'; -/** - * This class should simplify the node access to material properties. - * It internal uses reference nodes to make sure changes to material - * properties are automatically reflected to predefined TSL objects - * like e.g. `materialColor`. - * - * @augments Node - */ -export class MaterialNode extends Node { - /** - * Constructs a new material node. - * - * @param {string} scope - The scope defines what kind of material property is referred by the node. - */ - constructor(scope: string); - /** - * The scope defines what material property is referred by the node. - * - * @type {string} - */ - scope: string; - /** - * Returns a cached reference node for the given property and type. - * - * @param {string} property - The name of the material property. - * @param {string} type - The uniform type of the property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getCache(property: string, type: string): MaterialReferenceNode; - /** - * Returns a float-typed material reference node for the given property name. - * - * @param {string} property - The name of the material property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getFloat(property: string): MaterialReferenceNode; - /** - * Returns a color-typed material reference node for the given property name. - * - * @param {string} property - The name of the material property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getColor(property: string): MaterialReferenceNode; - /** - * Returns a texture-typed material reference node for the given property name. - * - * @param {string} property - The name of the material property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getTexture(property: string): MaterialReferenceNode; - /** - * The node setup is done depending on the selected scope. Multiple material properties - * might be grouped into a single node composition if they logically belong together. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The node representing the selected scope. - */ - setup(builder: NodeBuilder): Node; -} -export namespace MaterialNode { - let ALPHA_TEST: string; - let COLOR: string; - let OPACITY: string; - let SHININESS: string; - let SPECULAR: string; - let SPECULAR_STRENGTH: string; - let SPECULAR_INTENSITY: string; - let SPECULAR_COLOR: string; - let REFLECTIVITY: string; - let ROUGHNESS: string; - let METALNESS: string; - let NORMAL: string; - let CLEARCOAT: string; - let CLEARCOAT_ROUGHNESS: string; - let CLEARCOAT_NORMAL: string; - let EMISSIVE: string; - let ROTATION: string; - let SHEEN: string; - let SHEEN_ROUGHNESS: string; - let ANISOTROPY: string; - let IRIDESCENCE: string; - let IRIDESCENCE_IOR: string; - let IRIDESCENCE_THICKNESS: string; - let IOR: string; - let TRANSMISSION: string; - let THICKNESS: string; - let ATTENUATION_DISTANCE: string; - let ATTENUATION_COLOR: string; - let LINE_SCALE: string; - let LINE_DASH_SIZE: string; - let LINE_GAP_SIZE: string; - let LINE_WIDTH: string; - let LINE_DASH_OFFSET: string; - let POINT_SIZE: string; - let DISPERSION: string; - let RETROREFLECTIVITY: string; - let LIGHT_MAP: string; - let AO: string; -} -/** - * This node is a special type of reference node which is intended - * for linking material properties with node values. - * ```js - * const opacityNode = materialReference( 'opacity', 'float', material ); - * ``` - * When changing `material.opacity`, the node value of `opacityNode` will - * automatically be updated. - * - * @augments ReferenceNode - */ -export class MaterialReferenceNode extends ReferenceNode { - /** - * Constructs a new material reference node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} inputType - The uniform type that should be used to represent the property value. - * @param {?Material} [material=null] - The material the property belongs to. When no material is set, - * the node refers to the material of the current rendered object. - */ - constructor(property: string, inputType: string, material?: Material | null); - /** - * The material the property belongs to. When no material is set, - * the node refers to the material of the current rendered object. - * - * @type {?Material} - * @default null - */ - material: Material | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMaterialReferenceNode: boolean; -} -/** - * This node represents a variety of mathematical methods available in shaders. - * They are divided into three categories: - * - * - Methods with one input like `sin`, `cos` or `normalize`. - * - Methods with two inputs like `dot`, `cross` or `pow`. - * - Methods with three inputs like `mix`, `clamp` or `smoothstep`. - * - * @augments TempNode - */ -export class MathNode extends TempNode { - /** - * Constructs a new math node. - * - * @param {string} method - The method name. - * @param {Node} aNode - The first input. - * @param {?Node} [bNode=null] - The second input. - * @param {?Node} [cNode=null] - The third input. - */ - constructor(method: string, aNode: Node, bNode?: Node | null, cNode?: Node | null, ...args: any[]); - /** - * The method name. - * - * @type {string} - */ - method: string; - /** - * The first input. - * - * @type {Node} - */ - aNode: Node; - /** - * The second input. - * - * @type {?Node} - * @default null - */ - bNode: Node | null; - /** - * The third input. - * - * @type {?Node} - * @default null - */ - cNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMathNode: boolean; - /** - * The input type is inferred from the node types of the input nodes. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(builder: NodeBuilder): string; - /** - * The selected method as well as the input type determine the node type of this node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - setup(builder: any): any; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -export namespace MathNode { - let ALL: string; - let ANY: string; - let RADIANS: string; - let DEGREES: string; - let EXP: string; - let EXP2: string; - let LOG: string; - let LOG2: string; - let SQRT: string; - let INVERSE_SQRT: string; - let FLOOR: string; - let CEIL: string; - let NORMALIZE: string; - let FRACT: string; - let SIN: string; - let SINH: string; - let COS: string; - let COSH: string; - let TAN: string; - let TANH: string; - let ASIN: string; - let ASINH: string; - let ACOS: string; - let ACOSH: string; - let ATAN: string; - let ATANH: string; - let ABS: string; - let SIGN: string; - let LENGTH: string; - let NEGATE: string; - let ONE_MINUS: string; - let DFDX: string; - let DFDY: string; - let ROUND: string; - let RECIPROCAL: string; - let TRUNC: string; - let FWIDTH: string; - let TRANSPOSE: string; - let DETERMINANT: string; - let INVERSE: string; - let EQUALS: string; - let MIN: string; - let MAX: string; - let STEP: string; - let REFLECT: string; - let DISTANCE: string; - let DIFFERENCE: string; - let DOT: string; - let CROSS: string; - let POW: string; - let TRANSFORM_DIRECTION: string; - let MIX: string; - let CLAMP: string; - let REFRACT: string; - let SMOOTHSTEP: string; - let FACEFORWARD: string; -} -import { MathUtils } from './three.core.js'; -import { Matrix2 } from './three.core.js'; -import { Matrix3 } from './three.core.js'; -import { Matrix4 } from './three.core.js'; -import { MaxEquation } from './three.core.js'; -/** - * A special type of uniform node that computes the - * maximum mipmap level for a given texture node. - * - * ```js - * const level = maxMipLevel( textureNode ); - * ``` - * - * @augments UniformNode - */ -export class MaxMipLevelNode extends UniformNode { - /** - * Constructs a new max mip level node. - * - * @param {TextureNode} textureNode - The texture node to compute the max mip level for. - */ - constructor(textureNode: TextureNode); - /** - * The texture node to compute the max mip level for. - * - * @private - * @type {TextureNode} - */ - private _textureNode; - /** - * The texture node to compute the max mip level for. - * - * @readonly - * @type {TextureNode} - */ - readonly get textureNode(): TextureNode; - /** - * The texture. - * - * @readonly - * @type {Texture} - */ - readonly get texture(): Texture; - update(): void; -} -/** - * Base class for representing member access on an object-like - * node data structures. - * - * @augments Node - */ -export class MemberNode extends Node { - /** - * Constructs a member node. - * - * @param {Node} structNode - The struct node. - * @param {string} property - The property name. - */ - constructor(structNode: Node, property: string); - /** - * The struct node. - * - * @type {Node} - */ - structNode: Node; - /** - * The property name. - * - * @type {Node} - */ - property: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMemberNode: boolean; - hasMember(builder: any): boolean; - generateNodeType(builder: any): string; - getMemberType(builder: any, name: any): any; - generate(builder: any): any; -} -import { Mesh } from './three.core.js'; -import { MeshBasicMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshBasicMaterial}. - * - * @augments NodeMaterial - */ -export class MeshBasicNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh basic node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshBasicNodeMaterial: boolean; - /** - * Overwritten since this type of material uses {@link BasicEnvironmentNode} - * to implement the default environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?BasicEnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {BasicLightingModel} The lighting model. - */ - setupLightingModel(): BasicLightingModel; -} -import { MeshLambertMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshLambertMaterial}. - * - * @augments NodeMaterial - */ -export class MeshLambertNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh lambert node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshLambertNodeMaterial: boolean; - /** - * Overwritten since this type of material uses {@link BasicEnvironmentNode} - * to implement the default environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?BasicEnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {PhongLightingModel} The lighting model. - */ - setupLightingModel(): PhongLightingModel; -} -import { MeshMatcapMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshMatcapMaterial}. - * - * @augments NodeMaterial - */ -export class MeshMatcapNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh normal node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshMatcapNodeMaterial: boolean; - /** - * Setups the matcap specific node variables. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupVariants(builder: NodeBuilder): void; -} -import { MeshNormalMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshNormalMaterial}. - * - * @augments NodeMaterial - */ -export class MeshNormalNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh normal node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshNormalNodeMaterial: boolean; - /** - * Overwrites the default implementation by computing the diffuse color - * based on the normal data. - */ - setupDiffuseColor(): void; -} -import { MeshPhongMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshPhongMaterial}. - * - * @augments NodeMaterial - */ -export class MeshPhongNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh lambert node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshPhongNodeMaterial: boolean; - /** - * The shininess of phong materials is by default inferred from the `shininess` - * property. This node property allows to overwrite the default - * and define the shininess with a node instead. - * - * If you don't want to overwrite the shininess but modify the existing - * value instead, use {@link materialShininess}. - * - * @type {?Node} - * @default null - */ - shininessNode: Node | null; - /** - * The specular color of phong materials is by default inferred from the - * `specular` property. This node property allows to overwrite the default - * and define the specular color with a node instead. - * - * If you don't want to overwrite the specular color but modify the existing - * value instead, use {@link materialSpecular}. - * - * @type {?Node} - * @default null - */ - specularNode: Node | null; - /** - * Overwritten since this type of material uses {@link BasicEnvironmentNode} - * to implement the default environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?BasicEnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {PhongLightingModel} The lighting model. - */ - setupLightingModel(): PhongLightingModel; -} -import { MeshPhysicalMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshPhysicalMaterial}. - * - * @augments MeshStandardNodeMaterial - */ -export class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshPhysicalNodeMaterial: boolean; - /** - * The clearcoat of physical materials is by default inferred from the `clearcoat` - * and `clearcoatMap` properties. This node property allows to overwrite the default - * and define the clearcoat with a node instead. - * - * If you don't want to overwrite the clearcoat but modify the existing - * value instead, use {@link materialClearcoat}. - * - * @type {?Node} - * @default null - */ - clearcoatNode: Node | null; - /** - * The clearcoat roughness of physical materials is by default inferred from the `clearcoatRoughness` - * and `clearcoatRoughnessMap` properties. This node property allows to overwrite the default - * and define the clearcoat roughness with a node instead. - * - * If you don't want to overwrite the clearcoat roughness but modify the existing - * value instead, use {@link materialClearcoatRoughness}. - * - * @type {?Node} - * @default null - */ - clearcoatRoughnessNode: Node | null; - /** - * The clearcoat normal of physical materials is by default inferred from the `clearcoatNormalMap` - * property. This node property allows to overwrite the default - * and define the clearcoat normal with a node instead. - * - * If you don't want to overwrite the clearcoat normal but modify the existing - * value instead, use {@link materialClearcoatNormal}. - * - * @type {?Node} - * @default null - */ - clearcoatNormalNode: Node | null; - /** - * The sheen of physical materials is by default inferred from the `sheen`, `sheenColor` - * and `sheenColorMap` properties. This node property allows to overwrite the default - * and define the sheen with a node instead. - * - * If you don't want to overwrite the sheen but modify the existing - * value instead, use {@link materialSheen}. - * - * @type {?Node} - * @default null - */ - sheenNode: Node | null; - /** - * The sheen roughness of physical materials is by default inferred from the `sheenRoughness` and - * `sheenRoughnessMap` properties. This node property allows to overwrite the default - * and define the sheen roughness with a node instead. - * - * If you don't want to overwrite the sheen roughness but modify the existing - * value instead, use {@link materialSheenRoughness}. - * - * @type {?Node} - * @default null - */ - sheenRoughnessNode: Node | null; - /** - * The iridescence of physical materials is by default inferred from the `iridescence` - * property. This node property allows to overwrite the default - * and define the iridescence with a node instead. - * - * If you don't want to overwrite the iridescence but modify the existing - * value instead, use {@link materialIridescence}. - * - * @type {?Node} - * @default null - */ - iridescenceNode: Node | null; - /** - * The iridescence IOR of physical materials is by default inferred from the `iridescenceIOR` - * property. This node property allows to overwrite the default - * and define the iridescence IOR with a node instead. - * - * If you don't want to overwrite the iridescence IOR but modify the existing - * value instead, use {@link materialIridescenceIOR}. - * - * @type {?Node} - * @default null - */ - iridescenceIORNode: Node | null; - /** - * The iridescence thickness of physical materials is by default inferred from the `iridescenceThicknessRange` - * and `iridescenceThicknessMap` properties. This node property allows to overwrite the default - * and define the iridescence thickness with a node instead. - * - * If you don't want to overwrite the iridescence thickness but modify the existing - * value instead, use {@link materialIridescenceThickness}. - * - * @type {?Node} - * @default null - */ - iridescenceThicknessNode: Node | null; - /** - * The specular intensity of physical materials is by default inferred from the `specularIntensity` - * and `specularIntensityMap` properties. This node property allows to overwrite the default - * and define the specular intensity with a node instead. - * - * If you don't want to overwrite the specular intensity but modify the existing - * value instead, use {@link materialSpecularIntensity}. - * - * @type {?Node} - * @default null - */ - specularIntensityNode: Node | null; - /** - * The specular color of physical materials is by default inferred from the `specularColor` - * and `specularColorMap` properties. This node property allows to overwrite the default - * and define the specular color with a node instead. - * - * If you don't want to overwrite the specular color but modify the existing - * value instead, use {@link materialSpecularColor}. - * - * @type {?Node} - * @default null - */ - specularColorNode: Node | null; - /** - * The ior of physical materials is by default inferred from the `ior` - * property. This node property allows to overwrite the default - * and define the ior with a node instead. - * - * If you don't want to overwrite the ior but modify the existing - * value instead, use {@link materialIOR}. - * - * @type {?Node} - * @default null - */ - iorNode: Node | null; - /** - * The transmission of physical materials is by default inferred from the `transmission` and - * `transmissionMap` properties. This node property allows to overwrite the default - * and define the transmission with a node instead. - * - * If you don't want to overwrite the transmission but modify the existing - * value instead, use {@link materialTransmission}. - * - * @type {?Node} - * @default null - */ - transmissionNode: Node | null; - /** - * The thickness of physical materials is by default inferred from the `thickness` and - * `thicknessMap` properties. This node property allows to overwrite the default - * and define the thickness with a node instead. - * - * If you don't want to overwrite the thickness but modify the existing - * value instead, use {@link materialThickness}. - * - * @type {?Node} - * @default null - */ - thicknessNode: Node | null; - /** - * The attenuation distance of physical materials is by default inferred from the - * `attenuationDistance` property. This node property allows to overwrite the default - * and define the attenuation distance with a node instead. - * - * If you don't want to overwrite the attenuation distance but modify the existing - * value instead, use {@link materialAttenuationDistance}. - * - * @type {?Node} - * @default null - */ - attenuationDistanceNode: Node | null; - /** - * The attenuation color of physical materials is by default inferred from the - * `attenuationColor` property. This node property allows to overwrite the default - * and define the attenuation color with a node instead. - * - * If you don't want to overwrite the attenuation color but modify the existing - * value instead, use {@link materialAttenuationColor}. - * - * @type {?Node} - * @default null - */ - attenuationColorNode: Node | null; - /** - * The dispersion of physical materials is by default inferred from the - * `dispersion` property. This node property allows to overwrite the default - * and define the dispersion with a node instead. - * - * If you don't want to overwrite the dispersion but modify the existing - * value instead, use {@link materialDispersion}. - * - * @type {?Node} - * @default null - */ - dispersionNode: Node | null; - /** - * The retroreflective strength of physical materials is by default inferred from the - * `retroreflectivity` property. This node property allows to overwrite the default - * and define the retroreflective strength with a node instead. - * - * If you don't want to overwrite the retroreflective strength but modify the existing - * value instead, use {@link materialRetroreflectivity}. - * - * @type {?Node} - * @default null - */ - retroreflectivityNode: Node | null; - /** - * The anisotropy of physical materials is by default inferred from the - * `anisotropy` property. This node property allows to overwrite the default - * and define the anisotropy with a node instead. - * - * If you don't want to overwrite the anisotropy but modify the existing - * value instead, use {@link materialAnisotropy}. - * - * @type {?Node} - * @default null - */ - anisotropyNode: Node | null; - /** - * Whether the lighting model should use clearcoat or not. - * - * @type {boolean} - * @default true - */ - get useClearcoat(): boolean; - /** - * Whether the lighting model should use iridescence or not. - * - * @type {boolean} - * @default true - */ - get useIridescence(): boolean; - /** - * Whether the lighting model should use sheen or not. - * - * @type {boolean} - * @default true - */ - get useSheen(): boolean; - /** - * Whether the lighting model should use anisotropy or not. - * - * @type {boolean} - * @default true - */ - get useAnisotropy(): boolean; - /** - * Whether the lighting model should use transmission or not. - * - * @type {boolean} - * @default true - */ - get useTransmission(): boolean; - /** - * Whether the lighting model should use dispersion or not. - * - * @type {boolean} - * @default true - */ - get useDispersion(): boolean; - /** - * Whether the lighting model should use retroreflection or not. - * - * @type {boolean} - * @default true - */ - get useRetroreflection(): boolean; - /** - * Setups the physical specific node variables. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupVariants(builder: NodeBuilder): void; - /** - * Setups the clearcoat normal node. - * - * @return {Node} The clearcoat normal. - */ - setupClearcoatNormal(): Node; - setup(builder: any): void; -} -/** - * This node material is an experimental extension of {@link MeshPhysicalNodeMaterial} - * that implements a Subsurface scattering (SSS) term. - * - * @augments MeshPhysicalNodeMaterial - */ -export class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial { - /** - * Represents the thickness color. - * - * @type {?Node} - * @default null - */ - thicknessColorNode: Node | null; - /** - * Represents the distortion factor. - * - * @type {?Node} - */ - thicknessDistortionNode: Node | null; - /** - * Represents the thickness ambient factor. - * - * @type {?Node} - */ - thicknessAmbientNode: Node | null; - /** - * Represents the thickness attenuation. - * - * @type {?Node} - */ - thicknessAttenuationNode: Node | null; - /** - * Represents the thickness power. - * - * @type {?Node} - */ - thicknessPowerNode: Node | null; - /** - * Represents the thickness scale. - * - * @type {?Node} - */ - thicknessScaleNode: Node | null; - /** - * Whether the lighting model should use SSS or not. - * - * @type {boolean} - * @default true - */ - get useSSS(): boolean; - /** - * Setups the lighting model. - * - * @return {SSSLightingModel} The lighting model. - */ - setupLightingModel(): SSSLightingModel; -} -import { MeshStandardMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshStandardMaterial}. - * - * @augments NodeMaterial - */ -export class MeshStandardNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh standard node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshStandardNodeMaterial: boolean; - /** - * The emissive color of standard materials is by default inferred from the `emissive`, - * `emissiveIntensity` and `emissiveMap` properties. This node property allows to - * overwrite the default and define the emissive color with a node instead. - * - * If you don't want to overwrite the emissive color but modify the existing - * value instead, use {@link materialEmissive}. - * - * @type {?Node} - * @default null - */ - emissiveNode: Node | null; - /** - * The metalness of standard materials is by default inferred from the `metalness`, - * and `metalnessMap` properties. This node property allows to - * overwrite the default and define the metalness with a node instead. - * - * If you don't want to overwrite the metalness but modify the existing - * value instead, use {@link materialMetalness}. - * - * @type {?Node} - * @default null - */ - metalnessNode: Node | null; - /** - * The roughness of standard materials is by default inferred from the `roughness`, - * and `roughnessMap` properties. This node property allows to - * overwrite the default and define the roughness with a node instead. - * - * If you don't want to overwrite the roughness but modify the existing - * value instead, use {@link materialRoughness}. - * - * @type {?Node} - * @default null - */ - roughnessNode: Node | null; - /** - * Overwritten since this type of material uses {@link EnvironmentNode} - * to implement the PBR (PMREM based) environment mapping. Besides, the - * method honors `Scene.environment`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?EnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): EnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {PhysicalLightingModel} The lighting model. - */ - setupLightingModel(): PhysicalLightingModel; - /** - * Setups the specular related node variables. - */ - setupSpecular(): void; -} -import { MeshToonMaterial } from './three.core.js'; -/** - * Node material version of {@link MeshToonMaterial}. - * - * @augments NodeMaterial - */ -export class MeshToonNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh toon node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshToonNodeMaterial: boolean; - /** - * Setups the lighting model. - * - * @return {ToonLightingModel} The lighting model. - */ - setupLightingModel(): ToonLightingModel; -} -import { MinEquation } from './three.core.js'; -import { MirroredRepeatWrapping } from './three.core.js'; -import { MixOperation } from './three.core.js'; -/** - * This type of node is a specialized version of `Object3DNode` - * with larger set of model related metrics. Unlike `Object3DNode`, - * `ModelNode` extracts the reference to the 3D object from the - * current node frame state. - * - * @augments Object3DNode - */ -export class ModelNode extends Object3DNode { - /** - * Constructs a new object model node. - * - * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. - */ - constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix")); -} -import { MultiplyBlending } from './three.core.js'; -import { MultiplyOperation } from './three.core.js'; -import { NearestFilter } from './three.core.js'; -import { NearestMipmapLinearFilter } from './three.core.js'; -import { NearestMipmapNearestFilter } from './three.core.js'; -import { NeutralToneMapping } from './three.core.js'; -import { NeverCompare } from './three.core.js'; -import { NeverDepth } from './three.core.js'; -import { NeverStencilFunc } from './three.core.js'; -import { NoBlending } from './three.core.js'; -import { NoColorSpace } from './three.core.js'; -import { NoNormalPacking } from './three.core.js'; -import { NoToneMapping } from './three.core.js'; -/** - * Base class for all nodes. - * - * @augments EventDispatcher - */ -export class Node extends EventDispatcher { - static get type(): string; - /** - * Constructs a new node. - * - * @param {?string} nodeType - The node type. - */ - constructor(nodeType?: string | null); - /** - * The node type. This represents the result type of the node (e.g. `float` or `vec3`). - * - * @type {?string} - * @default null - */ - nodeType: string | null; - /** - * The update type of the node's {@link Node#update} method. Possible values are listed in {@link NodeUpdateType}. - * - * @type {string} - * @default 'none' - */ - updateType: string; - /** - * The update type of the node's {@link Node#updateBefore} method. Possible values are listed in {@link NodeUpdateType}. - * - * @type {string} - * @default 'none' - */ - updateBeforeType: string; - /** - * The update type of the node's {@link Node#updateAfter} method. Possible values are listed in {@link NodeUpdateType}. - * - * @type {string} - * @default 'none' - */ - updateAfterType: string; - /** - * The version of the node. The version automatically is increased when {@link Node#needsUpdate} is set to `true`. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly version: number; - /** - * The name of the node. - * - * @type {string} - * @default '' - */ - name: string; - /** - * Whether this node is global or not. This property is relevant for the internal - * node caching system. All nodes which should be declared just once should - * set this flag to `true` (a typical example is {@link AttributeNode}). - * - * @type {boolean} - * @default false - */ - global: boolean; - /** - * Create a list of parents for this node during the build process. - * - * @type {boolean} - * @default false - */ - parents: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNode: boolean; - _beforeNodes: any; - /** - * The cache key of this node. - * - * @private - * @type {?number} - * @default null - */ - private _cacheKey; - /** - * The UUID of the node. - * - * @type {string} - * @default null - * @private - */ - private _uuid; - /** - * The cache key's version. - * - * @private - * @type {number} - * @default 0 - */ - private _cacheKeyVersion; - /** - * The unique ID of the node. - * - * @type {number} - * @readonly - */ - readonly id: number; - /** - * The stack trace of the node for debugging purposes. - * - * @type {?string} - * @default null - */ - stackTrace: string | null; - /** - * Set this property to `true` when the node should be regenerated. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * The UUID of the node. - * - * @type {string} - * @readonly - */ - readonly get uuid(): string; - /** - * The type of the class. The value is usually the constructor name. - * - * @type {string} - * @readonly - */ - readonly get type(): string; - /** - * Convenient method for defining {@link Node#update}. - * - * @param {Function} callback - The update method. - * @param {string} updateType - The update type. - * @return {Node} A reference to this node. - */ - onUpdate(callback: Function, updateType: string): Node; - /** - * The method can be implemented to update the node's internal state when it is used to render an object. - * The {@link Node#updateType} property defines how often the update is executed. - * - * @abstract - * @param {NodeFrame} frame - A reference to the current node frame. - * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). - */ - update(): boolean | null; - /** - * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but - * this method automatically sets the update type to `FRAME`. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onFrameUpdate(callback: Function): Node; - /** - * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but - * this method automatically sets the update type to `RENDER`. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onRenderUpdate(callback: Function): Node; - /** - * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but - * this method automatically sets the update type to `OBJECT`. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onObjectUpdate(callback: Function): Node; - /** - * Convenient method for defining {@link Node#updateReference}. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onReference(callback: Function): Node; - /** - * Nodes might refer to other objects like materials. This method allows to dynamically update the reference - * to such objects based on a given state (e.g. the current node frame or builder). - * - * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. - * @return {any} The updated reference. - */ - updateReference(): any; - /** - * By default this method returns the value of the {@link Node#global} flag. This method - * can be overwritten in derived classes if an analytical way is required to determine the - * global cache referring to the current shader-stage. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether this node is global or not. - */ - isGlobal(): boolean; - /** - * Generator function that can be used to iterate over the child nodes. - * - * @generator - * @yields {Node} A child node. - */ - getChildren(): Generator; - /** - * Calling this method dispatches the `dispose` event. This event can be used - * to register event listeners for clean up tasks. - */ - dispose(): void; - /** - * Callback for {@link Node#traverse}. - * - * @callback traverseCallback - * @param {Node} node - The current node. - */ - /** - * Can be used to traverse through the node's hierarchy. - * - * @param {traverseCallback} callback - A callback that is executed per node. - */ - traverse(callback: (node: Node) => any): void; - /** - * Returns the child nodes of this node. - * - * @private - * @param {Set} [ignores=new Set()] - A set of nodes to ignore during the search to avoid circular references. - * @returns {Array} An array of objects describing the child nodes. - */ - private _getChildren; - /** - * Returns the cache key for this node. - * - * @param {boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced. - * @param {Set} [ignores=null] - A set of nodes to ignore during the computation of the cache key. - * @return {number} The cache key of the node. - */ - getCacheKey(force?: boolean, ignores?: Set): number; - /** - * Generate a custom cache key for this node. - * - * @return {number} The cache key of the node. - */ - customCacheKey(): number; - /** - * Returns the references to this node which is by default `this`. - * - * @return {Node} A reference to this node. - */ - getScope(): Node; - /** - * Returns the hash of the node which is used to identify the node. By default it's - * the {@link Node#uuid} however derived node classes might have to overwrite this method - * depending on their implementation. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(): string; - /** - * Returns the update type of {@link Node#update}. - * - * @return {NodeUpdateType} The update type. - */ - getUpdateType(): { - NONE: string; - FRAME: string; - RENDER: string; - OBJECT: string; - }; - /** - * Returns the update type of {@link Node#updateBefore}. - * - * @return {NodeUpdateType} The update type. - */ - getUpdateBeforeType(): { - NONE: string; - FRAME: string; - RENDER: string; - OBJECT: string; - }; - /** - * Returns the update type of {@link Node#updateAfter}. - * - * @return {NodeUpdateType} The update type. - */ - getUpdateAfterType(): { - NONE: string; - FRAME: string; - RENDER: string; - OBJECT: string; - }; - /** - * Certain types are composed of multiple elements. For example a `vec3` - * is composed of three `float` values. This method returns the type of - * these elements. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The type of the node. - */ - getElementType(builder: NodeBuilder): string; - /** - * Returns the node member type for the given name. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member. - * @return {string} The type of the node. - */ - getMemberType(): string; - /** - * Returns the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} [output=null] - The output of the node. - * @return {string} The type of the node. - */ - getNodeType(builder: NodeBuilder, output?: string): string; - /** - * Returns the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} [output=null] - The output of the node. - * @return {string} The type of the node. - */ - generateNodeType(builder: NodeBuilder, output?: string): string; - /** - * This method is used during the build process of a node and ensures - * equal nodes are not built multiple times but just once. For example if - * `attribute( 'uv' )` is used multiple times by the user, the build - * process makes sure to process just the first node. It also handles - * node overrides if an override context is set. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The shared node if possible. Otherwise `this` is returned. - */ - getShared(builder: NodeBuilder): Node; - /** - * Returns the number of elements in the node array. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?number} The number of elements in the node array. - */ - getArrayCount(): number | null; - /** - * Represents the setup stage which is the first step of the build process, see {@link Node#build} method. - * This method is often overwritten in derived modules to prepare the node which is used as a node's output/result. - * If an output node is prepared, then it must be returned in the `return` statement of the derived module's setup function. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?Node} The output node. - */ - setup(builder: NodeBuilder): Node | null; - /** - * Represents the analyze stage which is the second step of the build process, see {@link Node#build} method. - * This stage analyzes the node hierarchy and ensures descendent nodes are built. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?Node} output - The target output node. - */ - analyze(builder: NodeBuilder, output?: Node | null): void; - /** - * Represents the generate stage which is the third step of the build process, see {@link Node#build} method. - * This state builds the output node and returns the resulting shader string. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?string} [output] - Can be used to define the output type. - * @return {?string} The generated shader string. - */ - generate(builder: NodeBuilder, output?: string | null): string | null; - /** - * The method can be implemented to update the node's internal state before it is used to render an object. - * The {@link Node#updateBeforeType} property defines how often the update is executed. - * - * @abstract - * @param {NodeFrame} frame - A reference to the current node frame. - * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). - */ - updateBefore(): boolean | null; - /** - * The method can be implemented to update the node's internal state after it was used to render an object. - * The {@link Node#updateAfterType} property defines how often the update is executed. - * - * @abstract - * @param {NodeFrame} frame - A reference to the current node frame. - * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). - */ - updateAfter(): boolean | null; - before(node: any): this; - /** - * This method performs the build of a node. The behavior and return value depend on the current build stage: - * - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant. - * - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`. - * - **generate**: Generates the shader code for the node. Returns the generated shader string. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?(string|Node)} [output=null] - Can be used to define the output type. - * @return {?(Node|string)} The result of the build process, depending on the build stage. - */ - build(builder: NodeBuilder, output?: (string | Node) | null): (Node | string) | null; - /** - * Returns the child nodes as a JSON object. - * - * @return {Generator} An iterable list of serialized child objects as JSON. - */ - getSerializeChildren(): Generator; - /** - * Serializes the node to JSON. - * - * @param {Object} json - The output JSON object. - */ - serialize(json: Object): void; - /** - * Deserializes the node from the given JSON. - * - * @param {Object} json - The JSON object. - */ - deserialize(json: Object): void; - /** - * Serializes the node into the three.js JSON Object/Scene format. - * - * @param {?Object} meta - An optional JSON object that already holds serialized data from other scene objects. - * @return {Object} The serialized node. - */ - toJSON(meta: Object | null): Object; - assign(...params: any[]): any; - toVarIntent(): Node; - get(value: any): MemberNode; -} -export namespace Node { - let captureStackTrace: boolean; -} -export namespace NodeAccess { - let READ_ONLY: string; - let WRITE_ONLY: string; - let READ_WRITE: string; -} -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader attributes that are going to be generated - * by the builder. Arrays of node attributes is maintained in {@link NodeBuilder#attributes} - * and {@link NodeBuilder#bufferAttributes} for this purpose. - */ -export class NodeAttribute { - /** - * Constructs a new node attribute. - * - * @param {string} name - The name of the attribute. - * @param {string} type - The type of the attribute. - * @param {?Node} node - An optional reference to the node. - */ - constructor(name: string, type: string, node?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeAttribute: boolean; - /** - * The name of the attribute. - * - * @type {string} - */ - name: string; - /** - * The type of the attribute. - * - * @type {string} - */ - type: string; - /** - * An optional reference to the node. - * - * @type {?Node} - * @default null - */ - node: Node | null; -} -/** - * Base class for builders which generate a shader program based - * on a 3D object and its node material definition. - */ -export class NodeBuilder { - /** - * Constructs a new node builder. - * - * @param {Object3D} object - The 3D object. - * @param {Renderer} renderer - The current renderer. - * @param {NodeParser} parser - A reference to a node parser. - */ - constructor(object: Object3D, renderer: Renderer, parser: NodeParser); - /** - * The 3D object. - * - * @type {Object3D} - */ - object: Object3D; - /** - * The material of the 3D object. - * - * @type {?Material} - */ - material: Material | null; - /** - * The geometry of the 3D object. - * - * @type {?BufferGeometry} - */ - geometry: BufferGeometry | null; - /** - * The current renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * A reference to a node parser. - * - * @type {NodeParser} - */ - parser: NodeParser; - /** - * The scene the 3D object belongs to. - * - * @type {?Scene} - * @default null - */ - scene: Scene | null; - /** - * The camera the 3D object is rendered with. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * A list of all nodes the builder is processing - * for this 3D object. - * - * @type {Set} - */ - nodes: Set; - /** - * A list of all nodes the builder is processing in sequential order. - * - * This is used to determine the update order of nodes, which is important for - * {@link NodeUpdateType#UPDATE_BEFORE} and {@link NodeUpdateType#UPDATE_AFTER}. - * - * @type {Set} - */ - sequentialNodes: Set; - /** - * A list of all nodes which {@link Node#update} method should be executed. - * - * @type {Array} - */ - updateNodes: Array; - /** - * A list of all nodes which {@link Node#updateBefore} method should be executed. - * - * @type {Array} - */ - updateBeforeNodes: Array; - /** - * A list of all nodes which {@link Node#updateAfter} method should be executed. - * - * @type {Array} - */ - updateAfterNodes: Array; - /** - * A dictionary that assigns each node to a unique hash. - * - * @type {Object} - */ - hashNodes: { - [x: number]: Node; - }; - /** - * A reference to a node material observer. - * - * @type {?NodeMaterialObserver} - * @default null - */ - observer: NodeMaterialObserver | null; - /** - * A reference to the current lights node. - * - * @type {?LightsNode} - * @default null - */ - lightsNode: LightsNode | null; - /** - * A reference to the current environment node. - * - * @type {?Node} - * @default null - */ - environmentNode: Node | null; - /** - * A reference to the current fog node. - * - * @type {?Node} - * @default null - */ - fogNode: Node | null; - /** - * The current clipping context. - * - * @type {?ClippingContext} - */ - clippingContext: ClippingContext | null; - /** - * Whether the built material uses hardware clipping or not. - * - * @type {boolean} - * @default false - */ - hardwareClipping: boolean; - /** - * The generated vertex shader. - * - * @type {?string} - */ - vertexShader: string | null; - /** - * The generated fragment shader. - * - * @type {?string} - */ - fragmentShader: string | null; - /** - * The generated compute shader. - * - * @type {?string} - */ - computeShader: string | null; - /** - * Nodes used in the primary flow of code generation. - * - * @type {Object>} - */ - flowNodes: { - [x: string]: Node[]; - }; - /** - * Nodes code from `.flowNodes`. - * - * @type {Object} - */ - flowCode: { - [x: string]: string; - }; - /** - * This dictionary holds the node uniforms of the builder. - * The uniforms are maintained in an array for each shader stage. - * - * @type {Object} - */ - uniforms: Object; - /** - * This dictionary holds the output structs of the builder. - * The structs are maintained in an array for each shader stage. - * - * @type {Object} - */ - structs: Object; - /** - * This dictionary holds the types of the builder. - * - * @type {Object} - */ - types: Object; - /** - * This dictionary holds the bindings for each shader stage. - * - * @type {Object} - */ - bindings: Object; - /** - * This dictionary maintains the binding indices per bind group. - * - * @type {Object} - */ - bindingsIndexes: Object; - /** - * Reference to the array of bind groups. - * - * @type {?Array} - */ - bindGroups: Array | null; - /** - * This array holds the node attributes of this builder - * created via {@link AttributeNode}. - * - * @type {Array} - */ - attributes: Array; - /** - * This array holds the node attributes of this builder - * created via {@link BufferAttributeNode}. - * - * @type {Array} - */ - bufferAttributes: Array; - /** - * This array holds the node varyings of this builder. - * - * @type {Array} - */ - varyings: Array; - /** - * This dictionary holds the (native) node codes of this builder. - * The codes are maintained in an array for each shader stage. - * - * @type {Object>} - */ - codes: { - [x: string]: NodeCode[]; - }; - /** - * This dictionary holds the node variables of this builder. - * The variables are maintained in an array for each shader stage. - * This dictionary is also used to count the number of variables - * according to their type (const, vars). - * - * @type {Object|number>} - */ - vars: { - [x: string]: number | NodeVar[]; - }; - /** - * This dictionary holds the declarations for each shader stage. - * - * @type {Object} - */ - declarations: Object; - /** - * Current code flow. - * All code generated in this stack will be stored in `.flow`. - * - * @type {{code: string}} - */ - flow: { - code: string; - }; - /** - * A chain of nodes. - * Used to check recursive calls in node-graph. - * - * @type {Array} - */ - chaining: Array; - /** - * The current stack. - * This reflects the current process in the code block hierarchy, - * it is useful to know if the current process is inside a conditional for example. - * - * @type {StackNode} - */ - stack: StackNode; - /** - * List of stack nodes. - * The current stack hierarchy is stored in an array. - * - * @type {Array} - */ - stacks: Array; - /** - * A tab value. Used for shader string generation. - * - * @type {string} - * @default '\t' - */ - tab: string; - /** - * Reference to the current function node. - * - * @type {?FunctionNode} - * @default null - */ - currentFunctionNode: FunctionNode | null; - /** - * The builder's context. - * - * @type {Object} - */ - context: Object; - /** - * The builder's cache. - * - * @type {NodeCache} - */ - cache: NodeCache; - /** - * Since the {@link NodeBuilder#cache} might be temporarily - * overwritten by other caches, this member retains the reference - * to the builder's own cache. - * - * @type {NodeCache} - * @default this.cache - */ - globalCache: NodeCache; - flowsData: WeakMap; - /** - * The current shader stage. - * - * @type {?('vertex'|'fragment'|'compute'|'any')} - */ - shaderStage: ("vertex" | "fragment" | "compute" | "any") | null; - /** - * The current build stage. - * - * @type {?('setup'|'analyze'|'generate')} - */ - buildStage: ("setup" | "analyze" | "generate") | null; - /** - * The sub-build layers. - * - * @type {Array} - * @default [] - */ - subBuildLayers: Array; - /** - * The active stack nodes. - * - * @type {Array} - */ - activeStacks: Array; - /** - * The current sub-build TSL function(Fn). - * - * @type {?string} - * @default null - */ - subBuildFn: string | null; - /** - * The current TSL function(Fn) call node. - * - * @type {?Node} - * @default null - */ - fnCall: Node | null; - /** - * Whether the material is using flat shading or not. - * - * @returns {boolean} Whether the material is using flat shading or not. - */ - isFlatShading(): boolean; - /** - * Whether the material is opaque or not. - * - * @return {boolean} Whether the material is opaque or not. - */ - isOpaque(): boolean; - /** - * Factory method for creating an instance of {@link RenderTarget} with the given - * dimensions and options. - * - * @param {number} width - The width of the render target. - * @param {number} height - The height of the render target. - * @param {Object} options - The options of the render target. - * @return {RenderTarget} The render target. - */ - createRenderTarget(width: number, height: number, options: Object): RenderTarget; - /** - * Factory method for creating an instance of {@link CubeRenderTarget} with the given - * dimensions and options. - * - * @param {number} size - The size of the cube render target. - * @param {Object} options - The options of the cube render target. - * @return {CubeRenderTarget} The cube render target. - */ - createCubeRenderTarget(size: number, options: Object): CubeRenderTarget; - /** - * Whether the given node is included in the internal array of nodes or not. - * - * @param {Node} node - The node to test. - * @return {boolean} Whether the given node is included in the internal array of nodes or not. - */ - includes(node: Node): boolean; - /** - * Returns the type of the color output based on the renderer's render target. - * - * @param {number} [index=0] - The index of the render target texture. - * @return {string} The type. - */ - getOutputType(index?: number): string; - /** - * Returns the output struct name which is required by - * {@link OutputStructNode}. - * - * @abstract - * @return {string} The name of the output struct. - */ - getOutputStructName(): string; - /** - * Returns a bind group for the given group name and binding. - * - * @private - * @param {string} groupName - The group name. - * @param {Array} bindings - List of bindings. - * @return {BindGroup} The bind group - */ - private _getBindGroup; - /** - * Returns an array of node uniform groups for the given group name and shader stage. - * - * @param {string} groupName - The group name. - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {Array} The array of node uniform groups. - */ - getBindGroupArray(groupName: string, shaderStage: ("vertex" | "fragment" | "compute" | "any")): Array; - /** - * Returns a list bindings of all shader stages separated by groups. - * - * @return {Array} The list of bindings. - */ - getBindings(): Array; - /** - * Sorts the bind groups and updates {@link NodeBuilder#bindingsIndexes}. - */ - sortBindingGroups(): void; - /** - * The builder maintains each node in a hash-based dictionary. - * This method sets the given node (value) with the given hash (key) into this dictionary. - * - * @param {Node} node - The node to add. - * @param {number} hash - The hash of the node. - */ - setHashNode(node: Node, hash: number): void; - /** - * Adds a node to this builder. - * - * @param {Node} node - The node to add. - */ - addNode(node: Node): void; - /** - * It is used to add Nodes that will be used as FRAME and RENDER events, - * and need to follow a certain sequence in the calls to work correctly. - * This function should be called after 'setup()' in the 'build()' process to ensure that the child nodes are processed first. - * - * @param {Node} node - The node to add. - */ - addSequentialNode(node: Node): void; - /** - * Checks the update types of nodes - */ - buildUpdateNodes(): void; - /** - * A reference the current node which is the - * last node in the chain of nodes. - * - * @type {Node} - */ - get currentNode(): Node; - /** - * A reference to the render pipeline. - * - * @type {RenderPipeline} - */ - get renderPipeline(): RenderPipeline; - /** - * Whether the given texture is filtered or not. - * - * @param {Texture} texture - The texture to check. - * @return {boolean} Whether the given texture is filtered or not. - */ - isFilteredTexture(texture: Texture): boolean; - /** - * Returns the maximum number of bytes available for uniform buffers. - * - * @return {number} The maximum number of bytes available for uniform buffers. - */ - getUniformBufferLimit(): number; - /** - * Adds the given node to the internal node chain. - * This is used to check recursive calls in node-graph. - * - * @param {Node} node - The node to add. - */ - addChain(node: Node): void; - /** - * Removes the given node from the internal node chain. - * - * @param {Node} node - The node to remove. - */ - removeChain(node: Node): void; - /** - * Returns the native shader method name for a given generic name. E.g. - * the method name `textureDimensions` matches the WGSL name but must be - * resolved to `textureSize` in GLSL. - * - * @abstract - * @param {string} method - The method name to resolve. - * @return {string} The resolved method name. - */ - getMethod(method: string): string; - /** - * Returns the native snippet for a ternary operation. E.g. GLSL would output - * a ternary op as `cond ? x : y` whereas WGSL would output it as `select(y, x, cond)` - * - * @abstract - * @param {string} condSnippet - The condition determining which expression gets resolved. - * @param {string} ifSnippet - The expression to resolve to if the condition is true. - * @param {string} elseSnippet - The expression to resolve to if the condition is false. - * @return {string} The resolved method name. - */ - getTernary(): string; - /** - * Returns a node for the given hash, see {@link NodeBuilder#setHashNode}. - * - * @param {number} hash - The hash of the node. - * @return {Node} The found node. - */ - getNodeFromHash(hash: number): Node; - /** - * Adds the Node to a target flow so that it can generate code in the 'generate' process. - * - * @param {('vertex'|'fragment'|'compute')} shaderStage - The shader stage. - * @param {Node} node - The node to add. - * @return {Node} The node. - */ - addFlow(shaderStage: ("vertex" | "fragment" | "compute"), node: Node): Node; - /** - * Sets builder's context. - * - * @param {Object} context - The context to set. - */ - setContext(context: Object): void; - /** - * Returns the builder's current context. - * - * @return {Object} The builder's current context. - */ - getContext(): Object; - /** - * Adds context data to the builder's current context. - * - * @param {Object} context - The context to add. - * @return {Object} The previous context. - */ - addContext(context: Object): Object; - /** - * Gets a context used in shader construction that can be shared across different materials. - * This is necessary since the renderer cache can reuse shaders generated in one material and use them in another. - * - * @return {Object} The builder's current context without material. - */ - getSharedContext(): Object; - /** - * Sets builder's cache. - * - * @param {NodeCache} cache - The cache to set. - */ - setCache(cache: NodeCache): void; - /** - * Returns the builder's current cache. - * - * @return {NodeCache} The builder's current cache. - */ - getCache(): NodeCache; - /** - * Returns a cache for the given node. - * - * @param {Node} node - The node. - * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. - * @return {NodeCache} The cache. - */ - getCacheFromNode(node: Node, parent?: boolean): NodeCache; - /** - * Whether the requested feature is available or not. - * - * @abstract - * @param {string} name - The requested feature. - * @return {boolean} Whether the requested feature is supported or not. - */ - isAvailable(): boolean; - /** - * Returns the vertexIndex input variable as a native shader string. - * - * @abstract - * @return {string} The instanceIndex shader string. - */ - getVertexIndex(): string; - /** - * Contextually returns either the vertex stage instance index builtin - * or the linearized index of an compute invocation within a grid of workgroups. - * - * @abstract - * @return {string} The instanceIndex shader string. - */ - getInstanceIndex(): string; - /** - * Returns the drawIndex input variable as a native shader string. - * Only relevant for WebGL and its `WEBGL_multi_draw` extension. - * - * @abstract - * @return {?string} The drawIndex shader string. - */ - getDrawIndex(): string | null; - /** - * Returns the frontFacing input variable as a native shader string. - * - * @abstract - * @return {string} The frontFacing shader string. - */ - getFrontFacing(): string; - /** - * Returns the fragCoord input variable as a native shader string. - * - * @abstract - * @return {string} The fragCoord shader string. - */ - getFragCoord(): string; - /** - * Whether to flip texture data along its vertical axis or not. WebGL needs - * this method evaluate to `true`, WebGPU to `false`. - * - * @abstract - * @return {boolean} Whether to flip texture data along its vertical axis or not. - */ - isFlipY(): boolean; - /** - * Returns whether the builder is currently in an assignment context. - * - * @return {boolean} Whether the builder is in an assignment context. - */ - isContextAssign(): boolean; - /** - * Calling this method increases the usage count for the given node by one. - * - * @param {Node} node - The node to increase the usage count for. - * @return {number} The updated usage count. - */ - increaseUsage(node: Node): number; - /** - * Returns whether the given node has been written to in any shader stage. - * - * @param {Node} node - The node to check. - * @return {boolean} Whether the node has been written to. - */ - hasWriteUsage(node: Node): boolean; - /** - * Generates a texture sample shader string for the given texture data. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The texture property name. - * @param {string} uvSnippet - Snippet defining the texture coordinates. - * @return {string} The generated shader string. - */ - generateTexture(): string; - /** - * Generates a texture LOD shader string for the given texture data. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The texture property name. - * @param {string} uvSnippet - Snippet defining the texture coordinates. - * @param {?string} depthSnippet - Snippet defining the 0-based texture array index to sample. - * @param {string} levelSnippet - Snippet defining the mip level. - * @return {string} The generated shader string. - */ - generateTextureLod(): string; - /** - * Generates a texture size shader string for the given texture data. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The texture property name. - * @param {string} levelSnippet - Snippet defining the mip level. - * @return {string} The generated shader string. - */ - generateTextureSize(): string; - /** - * Generates the array declaration string. - * - * @param {string} type - The type. - * @param {?number} [count] - The count. - * @return {string} The generated value as a shader string. - */ - generateArrayDeclaration(type: string, count?: number | null): string; - /** - * Generates the array shader string for the given type and value. - * - * @param {string} type - The type. - * @param {?number} [count] - The count. - * @param {?Array} [values=null] - The default values. - * @return {string} The generated value as a shader string. - */ - generateArray(type: string, count?: number | null, values?: Array | null): string; - /** - * Generates the struct shader string. - * - * @param {string} type - The type. - * @param {Array} [membersLayout] - The count. - * @param {?Array} [values=null] - The default values. - * @return {string} The generated value as a shader string. - */ - generateStruct(type: string, membersLayout?: Array, values?: Array | null): string; - /** - * Generates the shader string for the given type and value. - * - * @param {string} type - The type. - * @param {?any} [value=null] - The value. - * @return {string} The generated value as a shader string. - */ - generateConst(type: string, value?: any | null): string; - /** - * It might be necessary to convert certain data types to different ones - * so this method can be used to hide the conversion. - * - * @param {string} type - The type. - * @return {string} The updated type. - */ - getType(type: string): string; - /** - * Whether the given attribute name is defined in the geometry or not. - * - * @param {string} name - The attribute name. - * @return {boolean} Whether the given attribute name is defined in the geometry. - */ - hasGeometryAttribute(name: string): boolean; - /** - * Returns a node attribute for the given name and type. - * - * @param {string} name - The attribute's name. - * @param {string} type - The attribute's type. - * @return {NodeAttribute} The node attribute. - */ - getAttribute(name: string, type: string): NodeAttribute; - /** - * Returns for the given node and shader stage the property name for the shader. - * - * @param {Node} node - The node. - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The property name. - */ - getPropertyName(node: Node): string; - /** - * Returns whether the given name is a reserved keyword of the backend's - * shading language. Backends override this method to provide their - * language-specific keywords. - * - * @param {string} name - The name to test. - * @return {boolean} Whether the name is a reserved keyword or not. - */ - isReservedKeyword(): boolean; - /** - * Whether the given type is a vector type or not. - * - * @param {string} type - The type to check. - * @return {boolean} Whether the given type is a vector type or not. - */ - isVector(type: string): boolean; - /** - * Whether the given type is a matrix type or not. - * - * @param {string} type - The type to check. - * @return {boolean} Whether the given type is a matrix type or not. - */ - isMatrix(type: string): boolean; - /** - * Whether the given type is a reference type or not. - * - * @param {string} type - The type to check. - * @return {boolean} Whether the given type is a reference type or not. - */ - isReference(type: string): boolean; - /** - * Checks if the given texture requires a manual conversion to the working color space. - * - * @abstract - * @param {Texture} texture - The texture to check. - * @return {boolean} Whether the given texture requires a conversion to working color space or not. - */ - needsToWorkingColorSpace(): boolean; - /** - * Returns the component type of a given texture. - * - * @param {Texture} texture - The texture. - * @return {string} The component type. - */ - getComponentTypeFromTexture(texture: Texture): string; - /** - * Returns the element type for a given type. - * - * @param {string} type - The type. - * @return {string} The element type. - */ - getElementType(type: string): string; - /** - * Returns the component type for a given type. - * - * @param {string} type - The type. - * @return {string} The component type. - */ - getComponentType(type: string): string; - /** - * Returns the vector type for a given type. - * - * @param {string} type - The type. - * @return {string} The vector type. - */ - getVectorType(type: string): string; - /** - * Returns the data type for the given the length and component type. - * - * @param {number} length - The length. - * @param {string} [componentType='float'] - The component type. - * @return {string} The type. - */ - getTypeFromLength(length: number, componentType?: string): string; - /** - * Returns the type for a given typed array. - * - * @param {TypedArray} array - The typed array. - * @return {string} The type. - */ - getTypeFromArray(array: TypedArray): string; - /** - * Returns the type is an integer type. - * - * @param {string} type - The type. - * @return {boolean} Whether the type is an integer type or not. - */ - isInteger(type: string): boolean; - /** - * Returns the type for a given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - * @return {string} The type. - */ - getTypeFromAttribute(attribute: BufferAttribute): string; - /** - * Returns the length for the given data type. - * - * @param {string} type - The data type. - * @return {number} The length. - */ - getTypeLength(type: string): number; - /** - * Returns the vector type for a given matrix type. - * - * @param {string} type - The matrix type. - * @return {string} The vector type. - */ - getVectorFromMatrix(type: string): string; - /** - * For a given type this method changes the component type to the - * given value. E.g. `vec4` should be changed to the new component type - * `uint` which results in `uvec4`. - * - * @param {string} type - The type. - * @param {string} newComponentType - The new component type. - * @return {string} The new type. - */ - changeComponentType(type: string, newComponentType: string): string; - /** - * Returns the integer type pendant for the given type. - * - * @param {string} type - The type. - * @return {string} The integer type. - */ - getIntegerType(type: string): string; - /** - * Adds an active stack to the internal stack. - * - * @param {StackNode} stack - The stack node to add. - */ - setActiveStack(stack: StackNode): void; - /** - * Removes the active stack from the internal stack. - * - * @param {StackNode} stack - The stack node to remove. - */ - removeActiveStack(stack: StackNode): void; - /** - * Returns the active stack. - * - * @return {StackNode} The active stack. - */ - getActiveStack(): StackNode; - /** - * Returns the base stack. - * - * @return {StackNode} The base stack. - */ - getBaseStack(): StackNode; - /** - * Adds a stack node to the internal stack. - * - * @return {StackNode} The added stack node. - */ - addStack(): StackNode; - /** - * Removes the last stack node from the internal stack. - * - * @return {StackNode} The removed stack node. - */ - removeStack(): StackNode; - /** - * The builder maintains (cached) data for each node during the building process. This method - * can be used to get these data for a specific shader stage and cache. - * - * @param {Node} node - The node to get the data for. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @param {?NodeCache} cache - An optional cache. - * @return {Object} The node data. - */ - getDataFromNode(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), cache?: NodeCache | null): Object; - /** - * Returns the properties for the given node and shader stage. - * - * Properties are typically used within a build stage to reference a node's - * child node or nodes manually assigned to the properties in a separate build stage. - * A typical usage pattern for defining nodes manually would be assigning dependency nodes - * to the current node's properties in the setup stage and building those properties in the generate stage. - * - * @param {Node} node - The node to get the properties for. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage='any'] - The shader stage. - * @return {Object} The node properties. - */ - getNodeProperties(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): Object; - /** - * Returns an instance of {@link NodeAttribute} for the given buffer attribute node. - * - * @param {BufferAttributeNode} node - The buffer attribute node. - * @param {string} type - The node type. - * @param {?string} [name=null] - The name of the buffer attribute. - * @return {NodeAttribute} The node attribute. - */ - getBufferAttributeFromNode(node: BufferAttributeNode, type: string, name?: string | null): NodeAttribute; - /** - * Returns an instance of {@link StructType} for the given struct name and shader stage - * or null if not found. - * - * @param {string} name - The name of the struct. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @return {?StructType} The struct type or null if not found. - */ - getStructTypeNode(name: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType | null; - /** - * Returns an instance of {@link StructType} for the given output struct node. - * - * @param {OutputStructNode} node - The output struct node. - * @param {Array} membersLayout - The output struct types. - * @param {?string} [name=null] - The name of the struct. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @return {StructType} The struct type attribute. - */ - getStructTypeFromNode(node: OutputStructNode, membersLayout: Array, name?: string | null, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType; - /** - * Returns an instance of {@link StructType} for the given output struct node. - * - * @param {OutputStructNode} node - The output struct node. - * @param {Array} membersLayout - The output struct types. - * @return {StructType} The struct type attribute. - */ - getOutputStructTypeFromNode(node: OutputStructNode, membersLayout: Array): StructType; - /** - * Returns an instance of {@link NodeUniform} for the given uniform node. - * - * @param {UniformNode} node - The uniform node. - * @param {string} type - The uniform type. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @param {?string} name - The name of the uniform. - * @return {NodeUniform} The node uniform. - */ - getUniformFromNode(node: UniformNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), name?: string | null): NodeUniform; - /** - * Returns an instance of {@link NodeVar} for the given variable node. - * - * @param {VarNode} node - The variable node. - * @param {?string} name - The variable's name. - * @param {string} [type=node.getNodeType( this )] - The variable's type. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @param {boolean} [readOnly=false] - Whether the variable is read-only or not. - * - * @return {NodeVar} The node variable. - */ - getVarFromNode(node: VarNode, name?: string | null, type?: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), readOnly?: boolean): NodeVar; - /** - * Returns whether a Node or its flow is deterministic, useful for use in `const`. - * - * @param {Node} node - The varying node. - * @return {boolean} Returns true if deterministic. - */ - isDeterministic(node: Node): boolean; - /** - * Returns an instance of {@link NodeVarying} for the given varying node. - * - * @param {(VaryingNode|PropertyNode)} node - The varying node. - * @param {?string} name - The varying's name. - * @param {string} [type=node.getNodeType( this )] - The varying's type. - * @param {?string} interpolationType - The interpolation type of the varying. - * @param {?string} interpolationSampling - The interpolation sampling type of the varying. - * @return {NodeVar} The node varying. - */ - getVaryingFromNode(node: (VaryingNode | PropertyNode), name?: string | null, type?: string, interpolationType?: string | null, interpolationSampling?: string | null): NodeVar; - /** - * Registers a node declaration in the current shader stage. - * - * @param {Object} node - The node to be registered. - */ - registerDeclaration(node: Object): void; - /** - * Returns an instance of {@link NodeCode} for the given code node. - * - * @param {CodeNode} node - The code node. - * @param {string} type - The node type. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @return {NodeCode} The node code. - */ - getCodeFromNode(node: CodeNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): NodeCode; - /** - * Adds a code flow based on the code-block hierarchy. - - * This is used so that code-blocks like If,Else create their variables locally if the Node - * is only used inside one of these conditionals in the current shader stage. - * - * @param {Node} node - The node to add. - * @param {Node} nodeBlock - Node-based code-block. Usually 'ConditionalNode'. - */ - addFlowCodeHierarchy(node: Node, nodeBlock: Node): void; - /** - * Add a inline-code to the current flow code-block. - * - * @param {Node} node - The node to add. - * @param {string} code - The code to add. - * @param {Node} nodeBlock - Current ConditionalNode - */ - addLineFlowCodeBlock(node: Node, code: string, nodeBlock: Node): void; - /** - * Add a inline-code to the current flow. - * - * @param {string} code - The code to add. - * @param {?Node} [node= null] - Optional Node, can help the system understand if the Node is part of a code-block. - * @return {NodeBuilder} A reference to this node builder. - */ - addLineFlowCode(code: string, node?: Node | null): NodeBuilder; - /** - * Adds a code to the current code flow. - * - * @param {string} code - Shader code. - * @return {NodeBuilder} A reference to this node builder. - */ - addFlowCode(code: string): NodeBuilder; - /** - * Add tab in the code that will be generated so that other snippets respect the current tabulation. - * Typically used in codes with If,Else. - * - * @return {NodeBuilder} A reference to this node builder. - */ - addFlowTab(): NodeBuilder; - /** - * Removes a tab. - * - * @return {NodeBuilder} A reference to this node builder. - */ - removeFlowTab(): NodeBuilder; - /** - * Gets the current flow data based on a Node. - * - * @param {Node} node - Node that the flow was started. - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {Object} The flow data. - */ - getFlowData(node: Node): Object; - /** - * Executes the node flow based on a root node to generate the final shader code. - * - * @param {Node} node - The node to execute. - * @return {Object} The code flow. - */ - flowNode(node: Node): Object; - /** - * Includes a node in the current function node. - * - * @param {Node} node - The node to include. - * @returns {void} - */ - addInclude(node: Node): void; - /** - * Returns the native shader operator name for a given generic name. - * It is a similar type of method like {@link NodeBuilder#getMethod}. - * - * @param {ShaderNodeInternal} shaderNode - The shader node to build the function node with. - * @return {FunctionNode} The build function node. - */ - buildFunctionNode(shaderNode: ShaderNodeInternal): FunctionNode; - /** - * Generates a code flow based on a TSL function: Fn(). - * - * @param {ShaderNodeInternal} shaderNode - A function code will be generated based on the input. - * @return {Object} - */ - flowShaderNode(shaderNode: ShaderNodeInternal): Object; - /** - * Executes the node in a specific build stage. - * - * This function can be used to arbitrarily execute the specified build stage - * outside of the standard build process. For instance, if a node's type depends - * on properties created by the 'setup' stage, then flowBuildStage(node, 'setup') - * can be used to execute the setup build stage and access its generated nodes - * before the standard build process begins. - * - * @param {Node} node - The node to execute. - * @param {string} buildStage - The build stage to execute the node in. - * @param {?(Node|string)} [output=null] - Expected output type. For example 'vec3'. - * @return {?(Node|string)} The result of the node build. - */ - flowBuildStage(node: Node, buildStage: string, output?: (Node | string) | null): (Node | string) | null; - /** - * Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'. - * - * @param {Node} node - The node to execute. - * @param {?string} output - Expected output type. For example 'vec3'. - * @return {Object} - */ - flowStagesNode(node: Node, output?: string | null): Object; - /** - * Returns the native shader operator name for a given generic name. - * It is a similar type of method like {@link NodeBuilder#getMethod}. - * - * @abstract - * @param {string} op - The operator name to resolve. - * @return {?string} The resolved operator name. - */ - getFunctionOperator(): string | null; - /** - * Builds the given shader node. - * - * @abstract - * @param {ShaderNodeInternal} shaderNode - The shader node. - * @return {string} The function code. - */ - buildFunctionCode(): string; - /** - * Generates a code flow based on a child Node. - * - * @param {Node} node - The node to execute. - * @param {?string} output - Expected output type. For example 'vec3'. - * @return {Object} The code flow. - */ - flowChildNode(node: Node, output?: string | null): Object; - /** - * Executes a flow of code in a different stage. - * - * Some nodes like `varying()` have the ability to compute code in vertex-stage and - * return the value in fragment-stage even if it is being executed in an input fragment. - * - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @param {Node} node - The node to execute. - * @param {?string} output - Expected output type. For example 'vec3'. - * @param {?string} propertyName - The property name to assign the result. - * @return {?(Object|Node)} The code flow or node.build() result. - */ - flowNodeFromShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any"), node: Node, output?: string | null, propertyName?: string | null): (Object | Node) | null; - /** - * Returns an array holding all node attributes of this node builder. - * - * @return {Array} The node attributes of this builder. - */ - getAttributesArray(): Array; - /** - * Returns the attribute definitions as a shader string for the given shader stage. - * - * @abstract - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The attribute code section. - */ - getAttributes(): string; - /** - * Returns the varying definitions as a shader string for the given shader stage. - * - * @abstract - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The varying code section. - */ - getVaryings(): string; - /** - * Returns a single variable definition as a shader string for the given variable type and name. - * - * @param {string} type - The variable's type. - * @param {string} name - The variable's name. - * @param {?number} [count=null] - The array length. - * @return {string} The shader string. - */ - getVar(type: string, name: string, count?: number | null): string; - /** - * Returns the variable definitions as a shader string for the given shader stage. - * - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @param {boolean} [global=false] - Whether the variables are global. - * @return {string} The variable code section. - */ - getVars(shaderStage: ("vertex" | "fragment" | "compute" | "any"), global?: boolean): string; - /** - * Returns the uniform definitions as a shader string for the given shader stage. - * - * @abstract - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The uniform code section. - */ - getUniforms(): string; - /** - * Returns the native code definitions as a shader string for the given shader stage. - * - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The native code section. - */ - getCodes(shaderStage: ("vertex" | "fragment" | "compute" | "any")): string; - /** - * Returns the hash of this node builder. - * - * @return {string} The hash. - */ - getHash(): string; - /** - * Sets the current shader stage. - * - * @param {?('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage to set. - */ - setShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any") | null): void; - /** - * Returns the current shader stage. - * - * @return {?('vertex'|'fragment'|'compute'|'any')} The current shader stage. - */ - getShaderStage(): ("vertex" | "fragment" | "compute" | "any") | null; - /** - * Sets the current build stage. - * - * @param {?('setup'|'analyze'|'generate')} buildStage - The build stage to set. - */ - setBuildStage(buildStage: ("setup" | "analyze" | "generate") | null): void; - /** - * Returns the current build stage. - * - * @return {?('setup'|'analyze'|'generate')} The current build stage. - */ - getBuildStage(): ("setup" | "analyze" | "generate") | null; - /** - * Controls the code build of the shader stages. - * - * @abstract - */ - buildCode(): void; - /** - * Returns the current sub-build layer. - * - * @return {SubBuildNode} The current sub-build layers. - */ - get subBuild(): SubBuildNode; - /** - * Adds a sub-build layer to the node builder. - * - * @param {SubBuildNode} subBuild - The sub-build layer to add. - */ - addSubBuild(subBuild: SubBuildNode): void; - /** - * Removes the last sub-build layer from the node builder. - * - * @return {SubBuildNode} The removed sub-build layer. - */ - removeSubBuild(): SubBuildNode; - /** - * Returns the closest sub-build layer for the given data. - * - * @param {Node|Set|Array} data - The data to get the closest sub-build layer from. - * @return {?string} The closest sub-build name or null if none found. - */ - getClosestSubBuild(data: Node | Set | Array): string | null; - /** - * Returns the output node of a sub-build layer. - * - * @param {Node} node - The node to get the output from. - * @return {string} The output node name. - */ - getSubBuildOutput(node: Node): string; - /** - * Returns the sub-build property name for the given property and node. - * - * @param {string} [property=''] - The property name. - * @param {?Node} [node=null] - The node to get the sub-build from. - * @return {string} The sub-build property name. - */ - getSubBuildProperty(property?: string, node?: Node | null): string; - /** - * Prebuild the node builder. - */ - prebuild(): void; - /** - * Central build method which controls the build for the given object. - * - * @return {NodeBuilder} A reference to this node builder. - */ - build(): NodeBuilder; - /** - * Async version of build() that yields to main thread between shader stages. - * Use this in compileAsync() to prevent blocking the main thread. - * - * @return {Promise} A promise that resolves to this node builder. - */ - buildAsync(): Promise; - /** - * Returns shared data object for the given node. - * - * @param {Node} node - The node to get shared data from. - * @return {Object} The shared data. - */ - getSharedDataFromNode(node: Node): Object; - /** - * Returns a uniform representation which is later used for UBO generation and rendering. - * - * @param {NodeUniform} uniformNode - The uniform node. - * @param {string} type - The requested type. - * @return {Uniform} The uniform. - */ - getNodeUniform(uniformNode: NodeUniform, type: string): Uniform; - /** - * Formats the given shader snippet from a given type into another one. E.g. - * this method might be used to convert a simple float string `"1.0"` into a - * `vec3` representation: `"vec3( 1.0 )"`. - * - * @param {string} snippet - The shader snippet. - * @param {string} fromType - The source type. - * @param {string} toType - The target type. - * @return {string} The updated shader string. - */ - format(snippet: string, fromType: string, toType: string): string; - /** - * Returns a signature with the engine's current revision. - * - * @return {string} The signature. - */ - getSignature(): string; - /** - * Returns `true` if data from the previous frame are required. Relevant - * when computing motion vectors with {@link VelocityNode}. - * - * @return {boolean} Whether data from the previous frame are required or not. - */ - needsPreviousData(): boolean; -} -/** - * This utility class is used in {@link NodeBuilder} as an internal - * cache data structure for node data. - */ -export class NodeCache { - /** - * Constructs a new node cache. - * - * @param {?NodeCache} parent - A reference to a parent cache. - */ - constructor(parent?: NodeCache | null); - /** - * The id of the cache. - * - * @type {number} - * @readonly - */ - readonly id: number; - /** - * A weak map for managing node data. - * - * @type {WeakMap} - */ - nodesData: WeakMap; - /** - * Reference to a parent node cache. - * - * @type {?NodeCache} - * @default null - */ - parent: NodeCache | null; - /** - * Returns the data for the given node. - * - * @param {Node} node - The node. - * @return {?Object} The data for the node. - */ - getData(node: Node): Object | null; - /** - * Sets the data for a given node. - * - * @param {Node} node - The node. - * @param {Object} data - The data that should be cached. - */ - setData(node: Node, data: Object): void; -} -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent user-defined, native shader code portions that are going to be - * injected by the builder. A dictionary of node codes is maintained in {@link NodeBuilder#codes} - * for this purpose. - */ -export class NodeCode { - /** - * Constructs a new code node. - * - * @param {string} name - The name of the code. - * @param {string} type - The node type. - * @param {string} [code=''] - The native shader code. - */ - constructor(name: string, type: string, code?: string); - /** - * The name of the code. - * - * @type {string} - */ - name: string; - /** - * The node type. - * - * @type {string} - */ - type: string; - /** - * The native shader code. - * - * @type {string} - * @default '' - */ - code: string; -} -/** - * Custom error class for node-related errors, including stack trace information. - */ -export class NodeError extends Error { - constructor(message: any, stackTrace?: null); - /** - * The stack trace associated with the error. - * - * @type {?StackTrace} - */ - stackTrace: StackTrace | null; -} -/** - * Management class for updating nodes. The module tracks metrics like - * the elapsed time, delta time, the render and frame ID to correctly - * call the node update methods {@link Node#updateBefore}, {@link Node#update} - * and {@link Node#updateAfter} depending on the node's configuration. - */ -export class NodeFrame { - /** - * The elapsed time in seconds. - * - * @type {number} - * @default 0 - */ - time: number; - /** - * The delta time in seconds. - * - * @type {number} - * @default 0 - */ - deltaTime: number; - /** - * The frame ID. - * - * @type {number} - * @default 0 - */ - frameId: number; - /** - * The render ID. - * - * @type {number} - * @default 0 - */ - renderId: number; - /** - * Used to control the {@link Node#update} call. - * - * @type {WeakMap} - */ - updateMap: WeakMap; - /** - * Used to control the {@link Node#updateBefore} call. - * - * @type {WeakMap} - */ - updateBeforeMap: WeakMap; - /** - * Used to control the {@link Node#updateAfter} call. - * - * @type {WeakMap} - */ - updateAfterMap: WeakMap; - /** - * A reference to the current renderer. - * - * @type {?Renderer} - * @default null - */ - renderer: Renderer | null; - /** - * A reference to the current material. - * - * @type {?Material} - * @default null - */ - material: Material | null; - /** - * A reference to the current camera. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * A reference to the current 3D object. - * - * @type {?Object3D} - * @default null - */ - object: Object3D | null; - /** - * A reference to the current scene. - * - * @type {?Scene} - * @default null - */ - scene: Scene | null; - /** - * Returns a dictionary for a given node and update map which - * is used to correctly call node update methods per frame or render. - * - * @private - * @param {WeakMap} referenceMap - The reference weak map. - * @param {Node} nodeRef - The reference to the current node. - * @return {Object>} The dictionary. - */ - private _getMaps; - /** - * This method executes the {@link Node#updateBefore} for the given node. - * It makes sure {@link Node#updateBeforeType} is honored meaning the update - * is only executed once per frame, render or object depending on the update - * type. - * - * @param {Node} node - The node that should be updated. - */ - updateBeforeNode(node: Node): void; - /** - * This method executes the {@link Node#updateAfter} for the given node. - * It makes sure {@link Node#updateAfterType} is honored meaning the update - * is only executed once per frame, render or object depending on the update - * type. - * - * @param {Node} node - The node that should be updated. - */ - updateAfterNode(node: Node): void; - /** - * This method executes the {@link Node#update} for the given node. - * It makes sure {@link Node#updateType} is honored meaning the update - * is only executed once per frame, render or object depending on the update - * type. - * - * @param {Node} node - The node that should be updated. - */ - updateNode(node: Node): void; - /** - * Updates the internal state of the node frame. This method is - * called by the renderer in its internal animation loop. - */ - update(): void; - lastTime: number | undefined; -} -/** - * Describes the input of a {@link NodeFunction}. - */ -export class NodeFunctionInput { - /** - * Constructs a new node function input. - * - * @param {string} type - The input type. - * @param {string} name - The input name. - * @param {?number} [count=null] - If the input is an Array, count will be the length. - * @param {('in'|'out'|'inout')} [qualifier=''] - The parameter qualifier (only relevant for GLSL). - * @param {boolean} [isConst=false] - Whether the input uses a const qualifier or not (only relevant for GLSL). - */ - constructor(type: string, name: string, count?: number | null, qualifier?: ("in" | "out" | "inout"), isConst?: boolean); - /** - * The input type. - * - * @type {string} - */ - type: string; - /** - * The input name. - * - * @type {string} - */ - name: string; - /** - * If the input is an Array, count will be the length. - * - * @type {?number} - * @default null - */ - count: number | null; - /** - *The parameter qualifier (only relevant for GLSL). - * - * @type {('in'|'out'|'inout')} - * @default '' - */ - qualifier: ("in" | "out" | "inout"); - /** - * Whether the input uses a const qualifier or not (only relevant for GLSL). - * - * @type {boolean} - * @default false - */ - isConst: boolean; -} -export namespace NodeFunctionInput { - let isNodeFunctionInput: boolean; -} -/** - * A loader for loading node objects in the three.js JSON Object/Scene format. - * - * @augments Loader - */ -export class NodeLoader extends Loader { - /** - * Constructs a new node loader. - * - * @param {LoadingManager} [manager] - A reference to a loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Represents a dictionary of textures. - * - * @type {Object} - */ - textures: { - [x: string]: Texture; - }; - /** - * Represents a dictionary of node types. - * - * @type {Object} - */ - nodes: { - [x: string]: Node.constructor; - }; - /** - * Loads the node definitions from the given URL. - * - * @param {string} url - The path/URL of the file to be loaded. - * @param {Function} onLoad - Will be called when load completes. - * @param {Function} onProgress - Will be called while load progresses. - * @param {Function} onError - Will be called when errors are thrown during the loading process. - */ - load(url: string, onLoad: Function, onProgress: Function, onError: Function): void; - /** - * Parse the node dependencies for the loaded node. - * - * @param {Array} [json] - The JSON definition - * @return {Object} A dictionary with node dependencies. - */ - parseNodes(json?: Array): { - [x: string]: Node; - }; - /** - * Parses the node from the given JSON. - * - * @param {Object} json - The JSON definition - * @param {string} json.type - The node type. - * @param {string} json.uuid - The node UUID. - * @param {Array} [json.nodes] - The node dependencies. - * @param {Object} [json.meta] - The meta data. - * @return {Node} The parsed node. - */ - parse(json: { - type: string; - uuid: string; - nodes?: Object[] | undefined; - meta?: Object | undefined; - }): Node; - /** - * Defines the dictionary of textures. - * - * @param {Object} value - The texture library defines as ``. - * @return {NodeLoader} A reference to this loader. - */ - setTextures(value: { - [x: string]: Texture; - }): NodeLoader; - /** - * Defines the dictionary of node types. - * - * @param {Object} value - The node library defined as ``. - * @return {NodeLoader} A reference to this loader. - */ - setNodes(value: { - [x: string]: Node.constructor; - }): NodeLoader; - /** - * Creates a node object from the given type. - * - * @param {string} type - The node type. - * @return {Node} The created node instance. - */ - createNodeFromType(type: string): Node; -} -/** - * Base class for all node materials. - * - * @augments Material - */ -export class NodeMaterial extends Material { - static get type(): string; - set type(_value: string); - /** - * Represents the type of the node material. - * - * @type {string} - */ - get type(): string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeMaterial: boolean; - /** - * Whether this material is affected by lights or not. - * - * @type {boolean} - * @default false - */ - lights: boolean; - /** - * Node materials which set their `lights` property to `true` - * are affected by all lights of the scene. Sometimes selective - * lighting is wanted which means only _some_ lights in the scene - * affect a material. This can be achieved by creating an instance - * of {@link LightsNode} with a list of selective - * lights and assign the node to this property. - * - * ```js - * const customLightsNode = lights( [ light1, light2 ] ); - * material.lightsNode = customLightsNode; - * ``` - * - * @type {?LightsNode} - * @default null - */ - lightsNode: LightsNode | null; - /** - * The environment of node materials can be defined by an environment - * map assigned to the `envMap` property or by `Scene.environment` - * if the node material is a PBR material. This node property allows to overwrite - * the default behavior and define the environment with a custom node. - * - * ```js - * material.envNode = pmremTexture( renderTarget.texture ); - * ``` - * - * @type {?Node} - * @default null - */ - envNode: Node | null; - /** - * The lighting of node materials might be influenced by ambient occlusion. - * The default AO is inferred from an ambient occlusion map assigned to `aoMap` - * and the respective `aoMapIntensity`. This node property allows to overwrite - * the default and define the ambient occlusion with a custom node instead. - * - * If you don't want to overwrite the diffuse color but modify the existing - * values instead, use {@link materialAO}. - * - * @type {?Node} - * @default null - */ - aoNode: Node | null; - /** - * The diffuse color of node materials is by default inferred from the - * `color` and `map` properties. This node property allows to overwrite the default - * and define the diffuse color with a node instead. - * - * ```js - * material.colorNode = color( 0xff0000 ); // define red color - * ``` - * - * If you don't want to overwrite the diffuse color but modify the existing - * values instead, use {@link materialColor}. - * - * ```js - * material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint - * ``` - * - * @type {?Node} - * @default null - */ - colorNode: Node | null; - /** - * The normals of node materials are by default inferred from the `normalMap`/`normalScale` - * or `bumpMap`/`bumpScale` properties. This node property allows to overwrite the default - * and define the normals with a node instead. - * - * If you don't want to overwrite the normals but modify the existing values instead, - * use {@link materialNormal}. - * - * @type {?Node} - * @default null - */ - normalNode: Node | null; - /** - * The opacity of node materials is by default inferred from the `opacity` - * and `alphaMap` properties. This node property allows to overwrite the default - * and define the opacity with a node instead. - * - * If you don't want to overwrite the opacity but modify the existing - * value instead, use {@link materialOpacity}. - * - * @type {?Node} - * @default null - */ - opacityNode: Node | null; - /** - * This node can be used to implement a variety of filter-like effects. The idea is - * to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it - * to create an arbitrary effect and then assign the node composition to this property. - * Everything behind the object using this material will now be affected by a filter. - * - * ```js - * const material = new NodeMaterial() - * material.transparent = true; - * - * // everything behind the object will be monochromatic - * material.backdropNode = saturation( viewportSharedTexture().rgb, 0 ); - * ``` - * - * Backdrop computations are part of the lighting so only lit materials can use this property. - * - * @type {?Node} - * @default null - */ - backdropNode: Node | null; - /** - * This node allows to modulate the influence of `backdropNode` to the outgoing light. - * - * @type {?Node} - * @default null - */ - backdropAlphaNode: Node | null; - /** - * The alpha test of node materials is by default inferred from the `alphaTest` - * property. This node property allows to overwrite the default and define the - * alpha test with a node instead. - * - * If you don't want to overwrite the alpha test but modify the existing - * value instead, use {@link materialAlphaTest}. - * - * @type {?Node} - * @default null - */ - alphaTestNode: Node | null; - /** - * Discards the fragment if the mask value is `false`. - * - * @type {?Node} - * @default null - */ - maskNode: Node | null; - /** - * This node can be used to implement a shadow mask for the material. - * - * @type {?Node} - * @default null - */ - maskShadowNode: Node | null; - /** - * The local vertex positions are computed based on multiple factors like the - * attribute data, morphing or skinning. This node property allows to overwrite - * the default and define local vertex positions with nodes instead. - * - * If you don't want to overwrite the vertex positions but modify the existing - * values instead, use {@link positionLocal}. - * - *```js - * material.positionNode = positionLocal.add( displace ); - * ``` - * - * @type {?Node} - * @default null - */ - positionNode: Node | null; - /** - * This node property is intended for logic which modifies geometry data once or per animation step. - * Apps usually place such logic randomly in initialization routines or in the animation loop. - * `geometryNode` is intended as a dedicated API so there is an intended spot where geometry modifications - * can be implemented. - * - * The idea is to assign a `Fn` definition that holds the geometry modification logic. A typical example - * would be a GPU based particle system that provides a node material for usage on app level. The particle - * simulation would be implemented as compute shaders and managed inside a `Fn` function. This function is - * eventually assigned to `geometryNode`. - * - * @type {?Function} - * @default null - */ - geometryNode: Function | null; - /** - * Allows to overwrite depth values in the fragment shader. - * - * @type {?Node} - * @default null - */ - depthNode: Node | null; - /** - * Allows to overwrite the position used for shadow map rendering which - * is by default {@link positionWorld}, the vertex position - * in world space. - * - * @type {?Node} - * @default null - */ - receivedShadowPositionNode: Node | null; - /** - * Allows to overwrite the geometry position used for shadow map projection which - * is by default {@link positionLocal}, the vertex position in local space. - * - * @type {?Node} - * @default null - */ - castShadowPositionNode: Node | null; - /** - * This node can be used to influence how an object using this node material - * receive shadows. - * - * ```js - * const totalShadows = float( 1 ).toVar(); - * material.receivedShadowNode = Fn( ( [ shadow ] ) => { - * totalShadows.mulAssign( shadow ); - * //return float( 1 ); // bypass received shadows - * return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color - * } ); - * - * @type {?(Function|FunctionNode)} - * @default null - */ - receivedShadowNode: (Function | FunctionNode) | null; - /** - * This node can be used to influence how an object using this node material - * casts shadows. To apply a color to shadows, you can simply do: - * - * ```js - * material.castShadowNode = vec4( 1, 0, 0, 1 ); - * ``` - * - * Which can be nice to fake colored shadows of semi-transparent objects. It - * is also common to use the property with `Fn` function so checks are performed - * per fragment. - * - * ```js - * materialCustomShadow.castShadowNode = Fn( () => { - * hash( vertexIndex ).greaterThan( 0.5 ).discard(); - * return materialColor; - * } )(); - * ``` - * - * @type {?Node} - * @default null - */ - castShadowNode: Node | null; - /** - * This node can be used to overwrite the final output of the material. - * - * Unlike {@link NodeMaterial#fragmentNode}, the built-in material logic - * (diffuse color, lighting, etc.) is still evaluated; assigning a node - * only replaces the resulting output color. - * - * @type {?Node} - * @default null - */ - outputNode: Node | null; - /** - * MRT configuration is done on renderer or pass level. This node allows to - * overwrite what values are written into MRT targets on material level. This - * can be useful for implementing selective FX features that should only affect - * specific objects. - * - * @type {?MRTNode} - * @default null - */ - mrtNode: MRTNode | null; - /** - * This node property can be used if you need complete freedom in implementing - * the fragment shader. Assigning a node will replace the built-in material - * logic used in the fragment stage. - * - * @type {?Node} - * @default null - */ - fragmentNode: Node | null; - /** - * This node property can be used if you need complete freedom in implementing - * the vertex shader. Assigning a node will replace the built-in material logic - * used in the vertex stage. - * - * @type {?Node} - * @default null - */ - vertexNode: Node | null; - /** - * This node can be used as a global context management component for this material. - * - * @type {?ContextNode} - * @default null - */ - contextNode: ContextNode | null; - /** - * Returns an array of child nodes for this material. - * - * @private - * @returns {Array<{property: string, childNode: Node}>} - */ - private _getNodeChildren; - /** - * Builds this material with the given node builder. - * - * @param {NodeBuilder} builder - The current node builder. - */ - build(builder: NodeBuilder): void; - /** - * Setups a node material observer with the given builder. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {NodeMaterialObserver} The node material observer. - */ - setupObserver(builder: NodeBuilder): NodeMaterialObserver; - /** - * Setups the vertex and fragment stage of this node material. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * Setups the clipping node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ClippingNode} The clipping node. - */ - setupClipping(builder: NodeBuilder): ClippingNode; - /** - * Setups the hardware clipping if available on the current device. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupHardwareClipping(builder: NodeBuilder): void; - /** - * Setups the depth of this material. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupDepth(builder: NodeBuilder): void; - /** - * Setups the position node in view space. This method exists - * so derived node materials can modify the implementation e.g. sprite materials. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in view space. - */ - setupPositionView(): Node; - /** - * Setups the position in clip space. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in view space. - */ - setupModelViewProjection(): Node; - /** - * Setups the logic for the vertex stage. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in clip space. - */ - setupVertex(builder: NodeBuilder): Node; - /** - * Setups the computation of the position in local space. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in local space. - */ - setupPosition(builder: NodeBuilder): Node; - /** - * Setups the computation of the material's diffuse color. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupDiffuseColor(builder: NodeBuilder): void; - /** - * Abstract interface method that can be implemented by derived materials - * to setup material-specific node variables. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - setupVariants(): void; - /** - * Setups the outgoing light node variable - * - * @return {Node} The outgoing light node. - */ - setupOutgoingLight(): Node; - /** - * Setups the normal node from the material. - * - * @return {Node} The normal node. - */ - setupNormal(): Node; - /** - * Setups the environment node from the material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The environment node. - */ - setupEnvironment(): Node; - /** - * Setups the light map node from the material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The light map node. - */ - setupLightMap(builder: NodeBuilder): Node; - /** - * Setups the lights node based on the scene, environment and material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {LightingNode} The lights node. - */ - setupMaterialLightings(builder: NodeBuilder): LightingNode; - /** - * Setups the ambient occlusion node from the material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The ambient occlusion node. - */ - setupAmbientOcclusion(builder: NodeBuilder): Node; - /** - * This method should be implemented by most derived materials - * since it defines the material's lighting model. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - * @return {LightingModel} The lighting model. - */ - setupLightingModel(): LightingModel; - /** - * Setups the outgoing light node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The outgoing light node. - */ - setupLighting(builder: NodeBuilder): Node; - /** - * Setup the fog. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} outputNode - The existing output node. - * @return {Node} The output node. - */ - setupFog(builder: NodeBuilder, outputNode: Node): Node; - /** - * Setups premultiplied alpha. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} outputNode - The existing output node. - * @return {Node} The output node. - */ - setupPremultipliedAlpha(builder: NodeBuilder, outputNode: Node): Node; - /** - * Setups the output node. - * - * This method can be implemented by derived materials to extend the functionality - * of the material's output or replace it altogether. - * - * ```js - * class ColoredShadowMaterial extends MeshPhongNodeMaterial { - * constructor( parameters ) { - * super( parameters ); - * this._shadeColor = uniform( new Color( parameters.shadeColor ?? 0xff0000 ) ); - * } - * - * setupOutput( builder, outputNode ) { - * // Modify the native output of the MeshPhongNodeMaterial fragment shader - * const brightness = min( outputNode.r, 1.0 ); - * const mixedColor = mix( this._shadeColor, diffuseColor.rgb, brightness ); - * // Return new output back into NodeMaterial flow - * return super.setupOutput( builder, vec4( mixedColor, outputNode.a ) ); - * } - * } - * ``` - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} outputNode - The existing output node. - * @return {Node} The output node. - */ - setupOutput(builder: NodeBuilder, outputNode: Node): Node; - /** - * Most classic material types have a node pendant e.g. for `MeshBasicMaterial` - * there is `MeshBasicNodeMaterial`. This utility method is intended for - * defining all material properties of the classic type in the node type. - * - * @param {Material} material - The material to copy properties with their values to this node material. - */ - setDefaultValues(material: Material): void; - /** - * Copies the common properties of the given material to this instance. - * - * @param {Material} source - The material to copy. - * @return {NodeMaterial} A reference to this node material. - */ - copy(source: Material): NodeMaterial; -} -/** - * A special type of material loader for loading node materials. - * - * @augments MaterialLoader - */ -export class NodeMaterialLoader extends MaterialLoader { - /** - * Constructs a new node material loader. - * - * @param {LoadingManager} [manager] - A reference to a loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Represents a dictionary of node types. - * - * @type {Object} - */ - nodes: { - [x: string]: Node.constructor; - }; - /** - * Represents a dictionary of node material types. - * - * @type {Object} - */ - nodeMaterials: { - [x: string]: NodeMaterial.constructor; - }; - /** - * Parses the node material from the given JSON. - * - * @param {Object} json - The JSON definition - * @return {NodeMaterial}. The parsed material. - */ - parse(json: Object): NodeMaterial; - /** - * Defines the dictionary of node types. - * - * @param {Object} value - The node library defined as ``. - * @return {NodeLoader} A reference to this loader. - */ - setNodes(value: { - [x: string]: Node.constructor; - }): NodeLoader; - /** - * Defines the dictionary of node material types. - * - * @param {Object} value - The node material library defined as ``. - * @return {NodeLoader} A reference to this loader. - */ - setNodeMaterials(value: { - [x: string]: NodeMaterial.constructor; - }): NodeLoader; - /** - * Creates a node material from the given type. - * - * @param {string} type - The node material type. - * @return {Node} The created node material instance. - */ - createMaterialFromType(type: string): Node; -} -/** - * This class is used by {@link WebGPURenderer} as management component. - * It's primary purpose is to determine whether render objects require a - * refresh right before they are going to be rendered or not. - */ -export class NodeMaterialObserver { - /** - * Constructs a new node material observer. - * - * @param {NodeBuilder} builder - The node builder. - */ - constructor(builder: NodeBuilder); - /** - * A node material can be used by more than one render object so the - * monitor must maintain a list of render objects. - * - * @type {WeakMap} - */ - renderObjects: WeakMap; - /** - * Whether the material uses node objects or not. - * - * @type {boolean} - */ - hasNode: boolean; - /** - * Whether the node builder's 3D object is animated or not. - * - * @type {boolean} - */ - hasAnimation: boolean; - /** - * A list of all possible material uniforms - * - * @type {Array} - */ - refreshUniforms: Array; - /** - * Holds the current render ID from the node frame. - * - * @type {number} - * @default 0 - */ - renderId: number; - /** - * Returns `true` if the given render object is verified for the first time of this observer. - * - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the given render object is verified for the first time of this observer. - */ - firstInitialization(renderObject: RenderObject): boolean; - /** - * Returns `true` if the given 3D object uses instance buffers with dynamic draw usage. - * Such buffers must be uploaded once per render so the render object requires a full refresh. - * - * @param {Object3D} object - The 3D object. - * @return {boolean} Whether the given 3D object uses instance buffers with dynamic draw usage or not. - */ - hasDynamicInstancing(object: Object3D): boolean; - /** - * Returns `true` if the current rendering produces motion vectors. - * - * @param {Renderer} renderer - The renderer. - * @return {boolean} Whether the current rendering produces motion vectors or not. - */ - needsVelocity(renderer: Renderer): boolean; - /** - * Returns monitoring data for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {Object} The monitoring data. - */ - getRenderObjectData(renderObject: RenderObject): Object; - /** - * Returns an attribute data structure holding the attributes versions for - * monitoring. - * - * @param {Object} attributes - The geometry attributes. - * @return {Object} An object for monitoring the versions of attributes. - */ - getAttributesData(attributes: Object): Object; - /** - * Returns `true` if the node builder's material uses - * node properties. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether the node builder's material uses node properties or not. - */ - containsNode(builder: NodeBuilder): boolean; - /** - * Returns a geometry data structure holding the geometry property values for - * monitoring. - * - * @param {BufferGeometry} geometry - The geometry. - * @return {Object} An object for monitoring geometry properties. - */ - getGeometryData(geometry: BufferGeometry): Object; - /** - * Returns a texture data structure holding the texture state for - * monitoring. - * - * @param {Texture} texture - The texture. - * @return {Object} An object for monitoring the texture. - */ - getTextureData(texture: Texture): Object; - /** - * Returns a material data structure holding the material property values for - * monitoring. - * - * @param {Material} material - The material. - * @return {Object} An object for monitoring material properties. - */ - getMaterialData(material: Material): Object; - /** - * Returns `true` if the given render object has not changed its state. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} lightsData - The current material lights. - * @param {number} renderId - The current render ID. - * @return {boolean} Whether the given render object is equal to its cached state or not. - */ - equals(renderObject: RenderObject, lightsData: Array, renderId: number): boolean; - /** - * Returns the lights data for the given material lights. - * - * @param {Array} materialLights - The material lights. - * @return {Array} The lights data for the given material lights. - */ - getLightsData(materialLights: Array, lights: any): Array; - /** - * Returns the lights for the given lights node and render ID. - * - * @param {LightsNode} lightsNode - The lights node. - * @param {number} renderId - The render ID. - * @return {Array} The lights for the given lights node and render ID. - */ - getLights(lightsNode: LightsNode, renderId: number): Array; - /** - * Checks if the given render object requires a refresh. - * - * @param {RenderObject} renderObject - The render object. - * @param {NodeFrame} nodeFrame - The current node frame. - * @return {number} The refresh type, see {@link RenderObjectRefreshType}. - */ - needsRefresh(renderObject: RenderObject, nodeFrame: NodeFrame): number; -} -/** - * A special type of object loader for loading 3D objects using - * node materials. - * - * @augments ObjectLoader - */ -export class NodeObjectLoader extends ObjectLoader { - /** - * Constructs a new node object loader. - * - * @param {LoadingManager} [manager] - A reference to a loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Represents a dictionary of node types. - * - * @type {Object} - */ - nodes: { - [x: string]: Node.constructor; - }; - /** - * Represents a dictionary of node material types. - * - * @type {Object} - */ - nodeMaterials: { - [x: string]: NodeMaterial.constructor; - }; - /** - * A reference to hold the `nodes` JSON property. - * - * @private - * @type {?Object[]} - */ - private _nodesJSON; - /** - * Defines the dictionary of node types. - * - * @param {Object} value - The node library defined as ``. - * @return {NodeObjectLoader} A reference to this loader. - */ - setNodes(value: { - [x: string]: Node.constructor; - }): NodeObjectLoader; - /** - * Defines the dictionary of node material types. - * - * @param {Object} value - The node material library defined as ``. - * @return {NodeObjectLoader} A reference to this loader. - */ - setNodeMaterials(value: { - [x: string]: NodeMaterial.constructor; - }): NodeObjectLoader; - /** - * Parses the node objects from the given JSON. - * - * @param {Object} json - The JSON definition - * @param {Function} onLoad - The onLoad callback function. - * @return {Object3D}. The parsed 3D object. - */ - parse(json: Object, onLoad: Function): Object3D; - /** - * Parses the node objects from the given JSON and textures. - * - * @param {Object[]} json - The JSON definition - * @param {Object} textures - The texture library. - * @return {Object}. The parsed nodes. - */ - parseNodes(json: Object[], textures: { - [x: string]: Texture; - }): { - [x: string]: Node; - }; - /** - * Parses the node objects from the given JSON and textures. - * - * @param {Object} json - The JSON definition - * @param {Object} textures - The texture library. - * @return {Object}. The parsed materials. - */ - parseMaterials(json: Object, textures: { - [x: string]: Texture; - }): { - [x: string]: NodeMaterial; - }; -} -export namespace NodeShaderStage { - let VERTEX_1: string; - export { VERTEX_1 as VERTEX }; - export let FRAGMENT: string; -} -export namespace NodeType { - let BOOLEAN: string; - let INTEGER: string; - let FLOAT: string; - let VECTOR2: string; - let VECTOR3: string; - let VECTOR4: string; - let MATRIX2: string; - let MATRIX3: string; - let MATRIX4: string; -} -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader uniforms that are going to be generated - * by the builder. A dictionary of node uniforms is maintained in {@link NodeBuilder#uniforms} - * for this purpose. - */ -export class NodeUniform { - /** - * Constructs a new node uniform. - * - * @param {string} name - The name of the uniform. - * @param {string} type - The type of the uniform. - * @param {UniformNode} node - An reference to the node. - */ - constructor(name: string, type: string, node: UniformNode); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeUniform: boolean; - /** - * The name of the uniform. - * - * @type {string} - */ - name: string; - /** - * The type of the uniform. - * - * @type {string} - */ - type: string; - /** - * An reference to the node. - * - * @type {UniformNode} - */ - node: UniformNode; - set value(val: any); - /** - * The value of the uniform node. - * - * @type {any} - */ - get value(): any; - /** - * The id of the uniform node. - * - * @type {number} - */ - get id(): number; - /** - * The uniform node's group. - * - * @type {UniformGroupNode} - */ - get groupNode(): UniformGroupNode; -} -export namespace NodeUpdateType { - export let NONE: string; - let FRAME_1: string; - export { FRAME_1 as FRAME }; - export let RENDER: string; - let OBJECT_1: string; - export { OBJECT_1 as OBJECT }; -} -export var NodeUtils: Readonly<{ - __proto__: null; - arrayBufferToBase64: typeof arrayBufferToBase64; - base64ToArrayBuffer: typeof base64ToArrayBuffer; - getAlignmentFromType: typeof getAlignmentFromType; - getDataFromObject: typeof getDataFromObject; - getLengthFromType: typeof getLengthFromType; - getMemoryLengthFromType: typeof getMemoryLengthFromType; - getTextureType: typeof getTextureType; - getTypeFromLength: typeof getTypeFromLength; - getTypedArrayFromType: typeof getTypedArrayFromType; - getValueFromType: typeof getValueFromType; - getValueType: typeof getValueType; - hash: (...params: number[]) => number; - hashArray: (array: Array) => number; - hashString: (str: string) => number; - isArrayAsParameter: typeof isArrayAsParameter; -}>; -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader variables that are going to be generated - * by the builder. A dictionary of node variables is maintained in {@link NodeBuilder#vars} for - * this purpose. - */ -export class NodeVar { - /** - * Constructs a new node variable. - * - * @param {string} name - The name of the variable. - * @param {string} type - The type of the variable. - * @param {boolean} [readOnly=false] - The read-only flag. - * @param {?number} [count=null] - The size. - */ - constructor(name: string, type: string, readOnly?: boolean, count?: number | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeVar: boolean; - /** - * The name of the variable. - * - * @type {string} - */ - name: string; - /** - * The type of the variable. - * - * @type {string} - */ - type: string; - /** - * The read-only flag. - * - * @type {boolean} - */ - readOnly: boolean; - /** - * The size. - * - * @type {?number} - */ - count: number | null; -} -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader varyings that are going to be generated - * by the builder. An array of node varyings is maintained in {@link NodeBuilder#varyings} for - * this purpose. - * - * @augments NodeVar - */ -export class NodeVarying extends NodeVar { - /** - * Constructs a new node varying. - * - * @param {string} name - The name of the varying. - * @param {string} type - The type of the varying. - * @param {?string} interpolationType - The interpolation type of the varying. - * @param {?string} interpolationSampling - The interpolation sampling type of the varying. - */ - constructor(name: string, type: string, interpolationType?: string | null, interpolationSampling?: string | null); - /** - * Whether this varying requires interpolation or not. This property can be used - * to check if the varying can be optimized for a variable. - * - * @type {boolean} - * @default false - */ - needsInterpolation: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeVarying: boolean; - /** - * The interpolation type of the varying data. - * - * @type {?string} - * @default null - */ - interpolationType: string | null; - /** - * The interpolation sampling type of varying data. - * - * @type {?string} - * @default null - */ - interpolationSampling: string | null; -} -import { NormalBlending } from './three.core.js'; -import { NormalGAPacking } from './three.core.js'; -/** - * This class can be used for applying normals maps to materials. - * - * ```js - * material.normalNode = normalMap( texture( normalTex ) ); - * ``` - * - * @augments TempNode - */ -export class NormalMapNode extends TempNode { - /** - * Constructs a new normal map node. - * - * @param {Node} node - Represents the normal map data. - * @param {?Node} [scaleNode=null] - Controls the intensity of the effect. - */ - constructor(node: Node, scaleNode?: Node | null); - /** - * Represents the normal map data. - * - * @type {Node} - */ - node: Node; - /** - * Controls the intensity of the effect. - * - * @type {?Node} - * @default null - */ - scaleNode: Node | null; - /** - * The normal map type. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | number); - /** - * Controls how to unpack the sampled normal map values. - * - * @type {string} - * @default NoNormalPacking - */ - unpackNormalMode: string; - setup(builder: any): any; -} -import { NormalRGPacking } from './three.core.js'; -import { NotEqualCompare } from './three.core.js'; -import { NotEqualDepth } from './three.core.js'; -import { NotEqualStencilFunc } from './three.core.js'; -import { Object3D } from './three.core.js'; -/** - * This node can be used to access transformation related metrics of 3D objects. - * Depending on the selected scope, a different metric is represented as a uniform - * in the shader. The following scopes are supported: - * - * - `POSITION`: The object's position in world space. - * - `VIEW_POSITION`: The object's position in view/camera space. - * - `DIRECTION`: The object's direction in world space. - * - `SCALE`: The object's scale in world space. - * - `WORLD_MATRIX`: The object's matrix in world space. - * - * @augments Node - */ -export class Object3DNode extends Node { - /** - * Constructs a new object 3D node. - * - * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. - * @param {?Object3D} [object3d=null] - The 3D object. - */ - constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"), object3d?: Object3D | null); - /** - * The node reports a different type of transformation depending on the scope. - * - * @type {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} - */ - scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"); - /** - * The 3D object. - * - * @type {?Object3D} - * @default null - */ - object3d: Object3D | null; - /** - * Holds the value of the node as a uniform. - * - * @type {UniformNode} - */ - uniformNode: UniformNode; - /** - * Overwritten since the node type is inferred from the scope. - * - * @return {('mat4'|'vec3'|'float')} The node type. - */ - generateNodeType(): ("mat4" | "vec3" | "float"); - /** - * Updates the uniform value depending on the scope. - * - * @param {NodeFrame} frame - The current node frame. - */ - update(frame: NodeFrame): void; - /** - * Generates the code snippet of the uniform node. The node type of the uniform - * node also depends on the selected scope. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder): string; - serialize(data: any): void; - deserialize(data: any): void; -} -export namespace Object3DNode { - let WORLD_MATRIX: string; - let POSITION: string; - let SCALE: string; - let VIEW_POSITION: string; - let DIRECTION: string; - let RADIUS: string; -} -import { ObjectLoader } from './three.core.js'; -import { ObjectSpaceNormalMap } from './three.core.js'; -import { OneFactor } from './three.core.js'; -import { OneMinusConstantAlphaFactor } from './three.core.js'; -import { OneMinusConstantColorFactor } from './three.core.js'; -import { OneMinusDstAlphaFactor } from './three.core.js'; -import { OneMinusDstColorFactor } from './three.core.js'; -import { OneMinusSrcAlphaFactor } from './three.core.js'; -import { OneMinusSrcColorFactor } from './three.core.js'; -/** - * This node represents basic mathematical and logical operations like addition, - * subtraction or comparisons (e.g. `equal()`). - * - * @augments TempNode - */ -export class OperatorNode extends TempNode { - /** - * Constructs a new operator node. - * - * @param {string} op - The operator. - * @param {Node} aNode - The first input. - * @param {Node} bNode - The second input. - * @param {...Node} params - Additional input parameters. - */ - constructor(op: string, aNode: Node, bNode: Node, ...params: Node[]); - /** - * The operator. - * - * @type {string} - */ - op: string; - /** - * The first input. - * - * @type {Node} - */ - aNode: Node; - /** - * The second input. - * - * @type {Node} - */ - bNode: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOperatorNode: boolean; - /** - * Returns the operator method name. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} output - The output type. - * @returns {string} The operator method name. - */ - getOperatorMethod(builder: NodeBuilder, output: string): string; - /** - * This method is overwritten since the node type is inferred from the operator - * and the input node types. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?string} [output=null] - The output type. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder, output?: string | null): string; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import { OrthographicCamera } from './three.core.js'; -/** - * This node can be used to define multiple outputs in a shader programs. - * - * @augments Node - */ -export class OutputStructNode extends Node { - /** - * Constructs a new output struct node. The constructor can be invoked with an - * arbitrary number of nodes representing the members. - * - * @param {...Node} members - A parameter list of nodes. - */ - constructor(...members: Node[]); - /** - * An array of nodes which defines the output. - * - * @type {Array} - */ - members: Array; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOutputStructNode: boolean; - generateNodeType(): string; - generate(builder: any): any; -} -/** - * A specialized context node designed to override specific target nodes within a - * node sub-graph or flow. This allows replacing specific inputs (e.g., normal - * and position vectors) dynamically during compilation for a specific flow node, - * without having to reconstruct or duplicate the source nodes. - * - * ```js - * // Method chaining example: - * node.overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); - * - * // Context assignment example: - * material.contextNode = overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); - * ``` - * - * @augments ContextNode - */ -export class OverrideContextNode extends ContextNode { - /** - * Constructs a new override context node. - * - * @param {Map} overrideNodes - A map mapping target nodes to their respective override callback functions. - * @param {Node|null} [flowNode=null] - The node whose context should be modified. - */ - constructor(overrideNodes: Map, flowNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOverrideContextNode: boolean; -} -import { PCFShadowMap } from './three.core.js'; -import { PCFSoftShadowMap } from './three.core.js'; -/** - * This class generates a Prefiltered, Mipmapped Radiance Environment Map - * (PMREM) from a cubeMap environment texture. This allows different levels of - * blur to be quickly accessed based on material roughness. It is packed into a - * special CubeUV format that allows us to perform custom interpolation so that - * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap - * chain, it only goes down to the LOD_MIN level (above), and then creates extra - * even more filtered 'mips' at the same LOD_MIN resolution, associated with - * higher roughness levels. In this way we maintain resolution to smoothly - * interpolate diffuse lighting while limiting sampling computation. - * - * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) - * importance sampling based on "Sampling the GGX Distribution of Visible Normals" - * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF - * used in material rendering for physically-based image-based lighting. - */ -export class PMREMGenerator { - /** - * Constructs a new PMREM generator. - * - * @param {Renderer} renderer - The renderer. - */ - constructor(renderer: Renderer); - _renderer: Renderer; - _pingPongRenderTarget: RenderTarget | null; - _lodMax: number; - _cubeSize: number; - _sizeLods: any[]; - _lodMeshes: any[]; - _blurMaterial: NodeMaterial | null; - _ggxMaterial: NodeMaterial | null; - _cubemapMaterial: NodeMaterial | null; - _equirectMaterial: NodeMaterial | null; - _backgroundBox: Mesh | null; - get _hasInitialized(): boolean; - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety. - * - * @param {Scene} scene - The scene to be captured. - * @param {number} [sigma=0] - The blur radius in radians. - * @param {number} [near=0.1] - The near plane distance. - * @param {number} [far=100] - The far plane distance. - * @param {Object} [options={}] - The configuration options. - * @param {number} [options.size=256] - The texture size of the PMREM. - * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. - * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. - * @return {RenderTarget} The resulting PMREM. - * @see {@link PMREMGenerator#fromScene} - */ - fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { - size?: number | undefined; - position?: Vector3 | undefined; - renderTarget?: RenderTarget | null | undefined; - }): RenderTarget; - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety (the cubeCamera - * is placed at the origin). - * - * @deprecated - * @param {Scene} scene - The scene to be captured. - * @param {number} [sigma=0] - The blur radius in radians. - * @param {number} [near=0.1] - The near plane distance. - * @param {number} [far=100] - The far plane distance. - * @param {Object} [options={}] - The configuration options. - * @param {number} [options.size=256] - The texture size of the PMREM. - * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. - * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. - * @return {Promise} A Promise that resolve with the PMREM when the generation has been finished. - * @see {@link PMREMGenerator#fromScene} - */ - fromSceneAsync(scene: Scene, sigma?: number, near?: number, far?: number, options?: { - size?: number | undefined; - position?: Vector3 | undefined; - renderTarget?: RenderTarget | null | undefined; - }): Promise; - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best - * with the 256 x 256 cubemap output. The minimum supported input image size - * is 64 x 32. - * - * @param {Texture} equirectangular - The equirectangular texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {RenderTarget} The resulting PMREM. - * @see {@link PMREMGenerator#fromEquirectangularAsync} - */ - fromEquirectangular(equirectangular: Texture, renderTarget?: RenderTarget | null): RenderTarget; - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), - * as this matches best with the 256 x 256 cubemap output. - * - * @deprecated - * @param {Texture} equirectangular - The equirectangular texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {Promise} The resulting PMREM. - * @see {@link PMREMGenerator#fromEquirectangular} - */ - fromEquirectangularAsync(equirectangular: Texture, renderTarget?: RenderTarget | null): Promise; - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {RenderTarget} The resulting PMREM. - * @see {@link PMREMGenerator#fromCubemapAsync} - */ - fromCubemap(cubemap: Texture, renderTarget?: RenderTarget | null): RenderTarget; - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, - * with the 256 x 256 cubemap output. - * - * @deprecated - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {Promise} The resulting PMREM. - * @see {@link PMREMGenerator#fromCubemap} - */ - fromCubemapAsync(cubemap: Texture, renderTarget?: RenderTarget | null): Promise; - /** - * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - * - * @returns {Promise} - */ - compileCubemapShader(): Promise; - /** - * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - * - * @returns {Promise} - */ - compileEquirectangularShader(): Promise; - /** - * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, - * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on - * one of them will cause any others to also become unusable. - */ - dispose(): void; - _setSizeFromTexture(texture: any): void; - _setSize(cubeSize: any): void; - _dispose(): void; - _cleanup(outputTarget: any): void; - _fromTexture(texture: any, renderTarget: any): any; - _allocateTarget(depthBuffer: any): RenderTarget; - _init(renderTarget: any): void; - _compileMaterial(material: any): Promise; - _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; - _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; - _applyPMREM(cubeUVRenderTarget: any): void; - /** - * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. - * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the - * GGX BRDF for physically-based rendering. Reads from the previous LOD level and - * applies incremental roughness filtering to avoid over-blurring. - * - * @private - * @param {RenderTarget} cubeUVRenderTarget - * @param {number} lodIn - Source LOD level to read from - * @param {number} lodOut - Target LOD level to write to - */ - private _applyGGXFilter; - /** - * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples - * the Gaussian along a spiral kernel (Golden Angle), which distributes samples - * isotropically on the sphere (no pole artifacts). - * - * Used for initial scene blur in fromScene() method when sigma > 0. - * - * @private - * @param {RenderTarget} cubeUVRenderTarget - The cubemap render target. - * @param {number} lodIn - The input level-of-detail. - * @param {number} lodOut - The output level-of-detail. - * @param {number} sigma - The blur radius in radians. - */ - private _blur; - _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; - _setViewport(target: any, x: any, y: any, width: any, height: any): void; -} -/** - * This node represents a PMREM which is a special type of preprocessed - * environment map intended for PBR materials. - * - * ```js - * const material = new MeshStandardNodeMaterial(); - * material.envNode = pmremTexture( envMap ); - * ``` - * - * @augments TempNode - */ -export class PMREMNode extends TempNode { - /** - * Constructs a new function overloading node. - * - * @param {Texture} value - The input texture. - * @param {Node} [uvNode=null] - The uv node. - * @param {Node} [levelNode=null] - The level node. - */ - constructor(value: Texture, uvNode?: Node, levelNode?: Node); - /** - * Reference to the input texture. - * - * @private - * @type {Texture} - */ - private _value; - /** - * Reference to the generated PMREM. - * - * @private - * @type {Texture | null} - * @default null - */ - private _pmrem; - /** - * The uv node. - * - * @type {Node} - */ - uvNode: Node; - /** - * The level node. - * - * @type {Node} - */ - levelNode: Node; - /** - * Reference to a PMREM generator. - * - * @private - * @type {?PMREMGenerator} - * @default null - */ - private _generator; - /** - * The texture node holding the generated PMREM. - * - * @private - * @type {TextureNode} - */ - private _texture; - /** - * A uniform representing the PMREM's width. - * - * @private - * @type {UniformNode} - */ - private _width; - /** - * A uniform representing the PMREM's height. - * - * @private - * @type {UniformNode} - */ - private _height; - /** - * A uniform representing the PMREM's max Mip. - * - * @private - * @type {UniformNode} - */ - private _maxMip; - set value(value: Texture); - /** - * The node's texture value. - * - * @type {Texture} - */ - get value(): Texture; - /** - * Uses the given PMREM texture to update internal values. - * - * @param {Texture} texture - The PMREM texture. - */ - updateFromTexture(texture: Texture): void; - updateBefore(frame: any): void; - setup(builder: any): void; -} -/** - * This node represents an operation that packs floating-point values of a vector into an unsigned 32-bit integer - * - * @augments TempNode - */ -export class PackFloatNode extends TempNode { - /** - * - * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the float values are mapped to the integer range. - * @param {Node} vectorNode - The vector node to be packed - */ - constructor(encoding: "snorm" | "unorm" | "float16", vectorNode: Node); - /** - * The vector to be packed. - * - * @type {Node} - */ - vectorNode: Node; - /** - * The numeric encoding. - * - * @type {string} - */ - encoding: string; - /** - * The component layout of the packed integer. - * - * @type {'2x16' | '4x8'} - * @default '2x16' - */ - layout: "2x16" | "4x8"; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPackFloatNode: boolean; - generateNodeType(): string; - generate(builder: any): string; -} -/** - * Special version of {@link PropertyNode} which is used for parameters. - * - * @augments PropertyNode - */ -export class ParameterNode extends PropertyNode { - /** - * Constructs a new parameter node. - * - * @param {string} nodeType - The type of the node. - * @param {?string} [name=null] - The name of the parameter in the shader. - */ - constructor(nodeType: string, name?: string | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isParameterNode: boolean; - /** - * Gets the type of a member variable in the parameter node. - * - * @param {NodeBuilder} builder - The node builder. - * @param {string} name - The name of the member variable. - * @returns {string} - */ - getMemberType(builder: NodeBuilder, name: string): string; - getHash(): string; - generate(): string; -} -/** - * Represents a render pass (sometimes called beauty pass) in context of post processing. - * This pass produces a render for the given scene and camera and can provide multiple outputs - * via MRT for further processing. - * - * ```js - * const postProcessing = new RenderPipeline( renderer ); - * - * const scenePass = pass( scene, camera ); - * - * postProcessing.outputNode = scenePass; - * ``` - * - * @augments TempNode - */ -export class PassNode extends TempNode { - /** - * Constructs a new pass node. - * - * @param {('color'|'depth')} scope - The scope of the pass. The scope determines whether the node outputs color or depth. - * @param {Scene} scene - A reference to the scene. - * @param {Camera} camera - A reference to the camera. - * @param {Object} options - Options for the internal render target. - */ - constructor(scope: ("color" | "depth"), scene: Scene, camera: Camera, options?: Object); - /** - * The scope of the pass. The scope determines whether the node outputs color or depth. - * - * @type {('color'|'depth')} - */ - scope: ("color" | "depth"); - /** - * A reference to the scene. - * - * @type {Scene} - */ - scene: Scene; - /** - * A reference to the camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * Options for the internal render target. - * - * @type {Object} - */ - options: Object; - /** - * The pass's pixel width. Will be kept automatically kept in sync with the renderer's width. - * @private - * @type {number} - * @default 1 - */ - private _width; - /** - * The pass's pixel height. Will be kept automatically kept in sync with the renderer's height. - * @private - * @type {number} - * @default 1 - */ - private _height; - /** - * The pass's render target. - * - * @type {RenderTarget} - */ - renderTarget: RenderTarget; - /** - * An optional override material for the pass. - * - * @type {Material|null} - */ - overrideMaterial: Material | null; - /** - * Whether the pass is transparent. - * - * @type {boolean} - * @default false - */ - transparent: boolean; - /** - * Whether the pass is opaque. - * - * @type {boolean} - * @default true - */ - opaque: boolean; - lighting: any; - /** - * Whether the renderer should automatically clear before rendering the pass. - * - * @type {boolean} - * @default true - */ - autoClear: boolean; - /** - * Whether the color buffer should be cleared. - * - * @type {boolean} - * @default true - */ - autoClearColor: boolean; - /** - * Whether the depth buffer should be cleared. - * - * @type {boolean} - * @default true - */ - autoClearDepth: boolean; - /** - * Whether the stencil buffer should be cleared. - * - * @type {boolean} - * @default true - */ - autoClearStencil: boolean; - /** - * An optional global context for the pass. - * - * @type {ContextNode|null} - */ - contextNode: ContextNode | null; - /** - * A cache for the context node. - * - * @private - * @type {?Object} - * @default null - */ - private _contextNodeCache; - /** - * A dictionary holding the internal result textures. - * - * @private - * @type {{ output: Texture, depth: ?DepthTexture }} - */ - private _textures; - /** - * A dictionary holding the internal texture nodes. - * - * @private - * @type {Object} - */ - private _textureNodes; - /** - * A dictionary holding the internal depth nodes. - * - * @private - * @type {Object} - */ - private _linearDepthNodes; - /** - * A dictionary holding the internal viewZ nodes. - * - * @private - * @type {Object} - */ - private _viewZNodes; - /** - * A dictionary holding the texture data of the previous frame. - * Used for computing velocity/motion vectors. - * - * @private - * @type {Object} - */ - private _previousTextures; - /** - * A dictionary holding the texture nodes of the previous frame. - * Used for computing velocity/motion vectors. - * - * @private - * @type {Object} - */ - private _previousTextureNodes; - /** - * The `near` property of the camera as a uniform. - * - * @private - * @type {UniformNode} - */ - private _cameraNear; - /** - * The `far` property of the camera as a uniform. - * - * @private - * @type {UniformNode} - */ - private _cameraFar; - /** - * A MRT node configuring the MRT settings. - * - * @private - * @type {?MRTNode} - * @default null - */ - private _mrt; - /** - * Layer object for configuring the camera that is used - * to produce the pass. - * - * @private - * @type {?Layers} - * @default null - */ - private _layers; - /** - * Scales the resolution of the internal render target. - * - * @private - * @type {number} - * @default 1 - */ - private _resolutionScale; - /** - * Custom viewport definition. - * - * @private - * @type {?Vector4} - * @default null - */ - private _viewport; - /** - * Custom scissor definition. - * - * @private - * @type {?Vector4} - * @default null - */ - private _scissor; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPassNode: boolean; - /** - * Sets the resolution scale for the pass. - * The resolution scale is a factor that is multiplied with the renderer's width and height. - * - * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. - * @return {PassNode} A reference to this pass. - */ - setResolutionScale(resolutionScale: number): PassNode; - /** - * Gets the current resolution scale of the pass. - * - * @return {number} The current resolution scale. A value of `1` means full resolution. - */ - getResolutionScale(): number; - /** - * Sets the resolution for the pass. - * The resolution is a factor that is multiplied with the renderer's width and height. - * - * @param {number} resolution - The resolution to set. A value of `1` means full resolution. - * @return {PassNode} A reference to this pass. - * @deprecated since r181. Use {@link PassNode#setResolutionScale `setResolutionScale()`} instead. - */ - setResolution(resolution: number): PassNode; - /** - * Gets the current resolution of the pass. - * - * @return {number} The current resolution. A value of `1` means full resolution. - * @deprecated since r181. Use {@link PassNode#getResolutionScale `getResolutionScale()`} instead. - */ - getResolution(): number; - /** - * Sets the layer configuration that should be used when rendering the pass. - * - * @param {Layers} layers - The layers object to set. - * @return {PassNode} A reference to this pass. - */ - setLayers(layers: Layers): PassNode; - /** - * Gets the current layer configuration of the pass. - * - * @return {?Layers} . - */ - getLayers(): Layers | null; - /** - * Sets the given MRT node to setup MRT for this pass. - * - * @param {MRTNode} mrt - The MRT object. - * @return {PassNode} A reference to this pass. - */ - setMRT(mrt: MRTNode): PassNode; - /** - * Returns the current MRT node. - * - * @return {MRTNode} The current MRT node. - */ - getMRT(): MRTNode; - /** - * Returns the texture for the given output name. - * - * @param {string} name - The output name to get the texture for. - * @return {Texture} The texture. - */ - getTexture(name: string): Texture; - /** - * Returns the texture holding the data of the previous frame for the given output name. - * - * @param {string} name - The output name to get the texture for. - * @return {Texture} The texture holding the data of the previous frame. - */ - getPreviousTexture(name: string): Texture; - /** - * Switches current and previous textures for the given output name. - * - * @param {string} name - The output name. - */ - toggleTexture(name: string): void; - /** - * Returns the texture node for the given output name. - * - * @param {string} [name='output'] - The output name to get the texture node for. - * @return {TextureNode} The texture node. - */ - getTextureNode(name?: string): TextureNode; - /** - * Returns the previous texture node for the given output name. - * - * @param {string} [name='output'] - The output name to get the previous texture node for. - * @return {TextureNode} The previous texture node. - */ - getPreviousTextureNode(name?: string): TextureNode; - /** - * Returns a viewZ node of this pass. - * - * @param {string} [name='depth'] - The output name to get the viewZ node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. - * @return {Node} The viewZ node. - */ - getViewZNode(name?: string): Node; - /** - * Returns a linear depth node of this pass. - * - * @param {string} [name='depth'] - The output name to get the linear depth node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. - * @return {Node} The linear depth node. - */ - getLinearDepthNode(name?: string): Node; - /** - * Precompiles the pass. - * - * Note that this method must be called after the pass configuration is complete. - * So calls like `setMRT()` and `getTextureNode()` must proceed the precompilation. - * - * @async - * @param {Renderer} renderer - The renderer. - * @return {Promise} A Promise that resolves when the compile has been finished. - * @see {@link Renderer#compileAsync} - */ - compileAsync(renderer: Renderer): Promise; - setup({ renderer }: { - renderer: any; - }): Node | TextureNode; - updateBefore(frame: any): void; - /** - * Sets the size of the pass's render target. Honors the pixel ratio. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * This method allows to define the pass's scissor rectangle. By default, the scissor rectangle is kept - * in sync with the pass's dimensions. To reverse the process and use auto-sizing again, call the method - * with `null` as the single argument. - * - * @param {?(number | Vector4)} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. - * Instead of passing four arguments, the method also works with a single four-dimensional vector. - * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. - * @param {number} width - The width of the scissor box in logical pixel unit. - * @param {number} height - The height of the scissor box in logical pixel unit. - */ - setScissor(x: (number | Vector4) | null, y: number, width: number, height: number): void; - /** - * This method allows to define the pass's viewport. By default, the viewport is kept in sync - * with the pass's dimensions. To reverse the process and use auto-sizing again, call the method - * with `null` as the single argument. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - */ - setViewport(x: number | Vector4, y: number, width: number, height: number): void; -} -export namespace PassNode { - let COLOR_1: "color"; - export { COLOR_1 as COLOR }; - export let DEPTH: "depth"; -} -import { PerspectiveCamera } from './three.core.js'; -/** - * Represents the lighting model for a phong material. Used in {@link MeshPhongNodeMaterial}. - * - * @augments BasicLightingModel - */ -export class PhongLightingModel extends BasicLightingModel { - /** - * Constructs a new phong lighting model. - * - * @param {boolean} [specular=true] - Whether specular is supported or not. - */ - constructor(specular?: boolean); - /** - * Whether specular is supported or not. Set this to `false` if you are - * looking for a Lambert-like material meaning a material for non-shiny - * surfaces, without specular highlights. - * - * @type {boolean} - * @default true - */ - specular: boolean; - /** - * Implements the direct lighting. The specular portion is optional and can be controlled - * with the {@link PhongLightingModel#specular} flag. - * - * @param {Object} lightData - The light data. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object): void; -} -/** - * Represents the lighting model for a PBR material. - * - * @augments LightingModel - */ -export class PhysicalLightingModel extends LightingModel { - /** - * Constructs a new physical lighting model. - * - * @param {boolean} [clearcoat=false] - Whether clearcoat is supported or not. - * @param {boolean} [sheen=false] - Whether sheen is supported or not. - * @param {boolean} [iridescence=false] - Whether iridescence is supported or not. - * @param {boolean} [anisotropy=false] - Whether anisotropy is supported or not. - * @param {boolean} [transmission=false] - Whether transmission is supported or not. - * @param {boolean} [dispersion=false] - Whether dispersion is supported or not. - * @param {boolean} [retroreflection=false] - Whether retroreflection is supported or not. - */ - constructor(clearcoat?: boolean, sheen?: boolean, iridescence?: boolean, anisotropy?: boolean, transmission?: boolean, dispersion?: boolean, retroreflection?: boolean); - /** - * Whether clearcoat is supported or not. - * - * @type {boolean} - * @default false - */ - clearcoat: boolean; - /** - * Whether sheen is supported or not. - * - * @type {boolean} - * @default false - */ - sheen: boolean; - /** - * Whether iridescence is supported or not. - * - * @type {boolean} - * @default false - */ - iridescence: boolean; - /** - * Whether anisotropy is supported or not. - * - * @type {boolean} - * @default false - */ - anisotropy: boolean; - /** - * Whether transmission is supported or not. - * - * @type {boolean} - * @default false - */ - transmission: boolean; - /** - * Whether dispersion is supported or not. - * - * @type {boolean} - * @default false - */ - dispersion: boolean; - /** - * Whether retroreflection is supported or not. - * - * @type {boolean} - * @default false - */ - retroreflection: boolean; - /** - * The clear coat radiance. - * - * @type {?Node} - * @default null - */ - clearcoatRadiance: Node | null; - /** - * The clear coat specular direct. - * - * @type {?Node} - * @default null - */ - clearcoatSpecularDirect: Node | null; - /** - * The clear coat specular indirect. - * - * @type {?Node} - * @default null - */ - clearcoatSpecularIndirect: Node | null; - /** - * The sheen specular direct. - * - * @type {?Node} - * @default null - */ - sheenSpecularDirect: Node | null; - /** - * The sheen specular indirect. - * - * @type {?Node} - * @default null - */ - sheenSpecularIndirect: Node | null; - /** - * The iridescence Fresnel. - * - * @type {?Node} - * @default null - */ - iridescenceFresnel: Node | null; - /** - * The iridescence F0 dielectric. - * - * @type {?Node} - * @default null - */ - iridescenceF0Dielectric: Node | null; - /** - * The iridescence F0 metallic. - * - * @type {?Node} - * @default null - */ - iridescenceF0Metallic: Node | null; - /** - * The sampled DFG LUT value, shared by the direct and indirect lighting paths. - * - * @type {?Node} - * @default null - */ - dfg: Node | null; - /** - * The multi-scattering energy compensation for direct lighting. - * - * @type {?Node} - * @default null - */ - multiScatteringCompensation: Node | null; - computeMultiscattering(singleScatter: any, multiScatter: any, specularF90: any, f0: any, iridescenceF0?: null): void; - /** - * Implements the direct light. - * - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object): void; - /** - * This method is intended for implementing the direct light term for - * rect area light nodes. - * - * @param {Object} input - The input data. - * @param {NodeBuilder} builder - The current node builder. - */ - directRectArea({ lightColor, lightPosition, halfWidth, halfHeight, reflectedLight, ltc_1, ltc_2 }: Object): void; - /** - * Implements the indirect lighting. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirect(builder: NodeBuilder): void; - /** - * Implements the indirect diffuse term. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirectDiffuse(builder: NodeBuilder): void; - /** - * Implements the indirect specular term. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirectSpecular(builder: NodeBuilder): void; - /** - * Implements the ambient occlusion term. - * - * @param {NodeBuilder} builder - The current node builder. - */ - ambientOcclusion(builder: NodeBuilder): void; - /** - * Used for final lighting accumulations depending on the requested features. - * - * @param {NodeBuilder} builder - The current node builder. - */ - finish({ context }: NodeBuilder): void; -} -import { Plane } from './three.core.js'; -import { PlaneGeometry } from './three.core.js'; -import { PointLight } from './three.core.js'; -/** - * Module for representing point lights as nodes. - * - * @augments AnalyticLightNode - */ -export class PointLightNode extends AnalyticLightNode { - /** - * Constructs a new point light node. - * - * @param {?PointLight} [light=null] - The point light source. - */ - constructor(light?: PointLight | null); - /** - * Uniform node representing the cutoff distance. - * - * @type {UniformNode} - */ - cutoffDistanceNode: UniformNode; - /** - * Uniform node representing the decay exponent. - * - * @type {UniformNode} - */ - decayExponentNode: UniformNode; - /** - * Overwritten to updated point light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - /** - * Overwritten to setup point light specific shadow. - * - * @return {PointShadowNode} - */ - setupShadowNode(): PointShadowNode; - setupDirect(builder: any): { - lightDirection: any; - lightColor: any; - }; -} -/** - * Represents the shadow implementation for point light nodes. - * - * @augments ShadowNode - */ -export class PointShadowNode extends ShadowNode { - /** - * Constructs a new point shadow node. - * - * @param {PointLight} light - The shadow casting point light. - * @param {?PointLightShadow} [shadow=null] - An optional point light shadow. - */ - constructor(light: PointLight, shadow?: PointLightShadow | null); - /** - * Overwrites the default implementation to create a CubeRenderTarget with CubeDepthTexture. - * - * @param {LightShadow} shadow - The light shadow object. - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Object} An object containing the shadow map and depth texture. - */ - setupRenderTarget(shadow: LightShadow, builder: NodeBuilder): Object; -} -/** - * A node for representing the uv coordinates of points. - * - * Can only be used with a WebGL backend. In WebGPU, point - * primitives always have the size of one pixel and can thus - * can't be used as sprite-like objects that display textures. - * - * @augments Node - */ -export class PointUVNode extends Node { - /** - * Constructs a new point uv node. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPointUVNode: boolean; - generate(): string; -} -import { PointsMaterial } from './three.core.js'; -/** - * Node material version of {@link PointsMaterial}. - * - * This material can be used in two ways: - * - * - By rendering point primitives with {@link Points}. Since WebGPU only supports point primitives - * with a pixel size of `1`, it's not possible to define a size. - * - * ```js - * const pointCloud = new THREE.Points( geometry, new THREE.PointsNodeMaterial() ); - * ``` - * - * - By rendering point primitives with {@link Sprites}. In this case, size is honored, - * see {@link PointsNodeMaterial#sizeNode}. - * - * ```js - * const instancedPoints = new THREE.Sprite( new THREE.PointsNodeMaterial( { positionNode: instancedBufferAttribute( positionAttribute ) } ) ); - * ``` - * - * @augments SpriteNodeMaterial - */ -export class PointsNodeMaterial extends SpriteNodeMaterial { - /** - * This node property provides an additional way to set the point size. - * - * Note that WebGPU only supports point primitives with 1 pixel size. Consequently, - * this node has no effect when the material is used with {@link Points} and a WebGPU - * backend. If an application wants to render points with a size larger than 1 pixel, - * the material should be used with {@link Sprite} and instancing. - * - * @type {?Node} - * @default null - */ - sizeNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPointsNodeMaterial: boolean; - setupPositionView(): any; - setupVertexSprite(builder: any): any; - setupVertex(builder: any): any; - _useAlphaToCoverage: any; -} -/** - * @deprecated since r183. Use {@link RenderPipeline} instead. PostProcessing has been renamed to RenderPipeline. - * - * This class is a wrapper for backward compatibility and will be removed in a future version. - */ -export class PostProcessing extends RenderPipeline { - /** - * Constructs a new post processing management module. - * - * @param {Renderer} renderer - A reference to the renderer. - * @param {Node} outputNode - An optional output node. - * @deprecated since r183. Use {@link RenderPipeline} instead. - */ - constructor(renderer: Renderer, outputNode: Node); -} -/** - * A projector light version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. - * - * @augments SpotLight - */ -export class ProjectorLight extends SpotLight { - /** - * Aspect ratio of the light. Set to `null` to use the texture aspect ratio. - * - * @type {?number} - * @default null - */ - aspect: number | null; - copy(source: any, recursive: any): this; -} -/** - * An implementation of a projector light node. - * - * @augments SpotLightNode - */ -export class ProjectorLightNode extends SpotLightNode { - update(frame: any): void; - /** - * Overwrites the default implementation to compute projection attenuation. - * - * @param {NodeBuilder} builder - The node builder. - * @return {Node} The spot attenuation. - */ - getSpotAttenuation(builder: NodeBuilder): Node; -} -/** - * This class represents a shader property. It can be used - * to explicitly define a property and assign a value to it. - * - * ```js - * const threshold = property( 'float', 'threshold' ).assign( THRESHOLD ); - *``` - * `PropertyNode` is used by the engine to predefined common material properties - * for TSL code. - * - * @augments Node - */ -export class PropertyNode extends Node { - /** - * Constructs a new property node. - * - * @param {string} nodeType - The type of the node. - * @param {?string} [name=null] - The name of the property in the shader. - * @param {boolean} [varying=false] - Whether this property is a varying or not. - * @param {?Node} [placeholderNode=null] - The placeholder node if not assigned. - */ - constructor(nodeType: string, name?: string | null, varying?: boolean, placeholderNode?: Node | null); - /** - * Whether this property is a varying or not. - * - * @type {boolean} - * @default false - */ - varying: boolean; - /** - * The placeholder node of the property if it is not assigned. - * - * @type {?Node} - * @default null - */ - placeholderNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPropertyNode: boolean; - getNodeType(builder: any): any; - getHash(builder: any): string; - generate(builder: any): any; -} -/** - * This module is a helper for passes which need to render a full - * screen effect which is quite common in context of post processing. - * - * The intended usage is to reuse a single quad mesh for rendering - * subsequent passes by just reassigning the `material` reference. - * - * Note: This module can only be used with `WebGPURenderer`. - * - * @augments Mesh - */ -export class QuadMesh extends Mesh { - /** - * Constructs a new quad mesh. - * - * @param {NodeMaterial} material - The material to render the quad mesh with. - */ - constructor(material: NodeMaterial); - /** - * The camera to render the quad mesh with. - * - * @type {OrthographicCamera} - * @readonly - */ - readonly camera: OrthographicCamera; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isQuadMesh: boolean; - /** - * Async version of `render()`. - * - * @async - * @deprecated - * @param {Renderer} renderer - The renderer. - * @return {Promise} A Promise that resolves when the render has been finished. - */ - renderAsync(renderer: Renderer): Promise; - /** - * Renders the quad mesh - * - * @param {Renderer} renderer - The renderer. - */ - render(renderer: Renderer): void; -} -import { Quaternion } from './three.core.js'; -import { R11_EAC_Format } from './three.core.js'; -import { RED_GREEN_RGTC2_Format } from './three.core.js'; -import { RED_RGTC1_Format } from './three.core.js'; -import { REVISION } from './three.core.js'; -import { RG11_EAC_Format } from './three.core.js'; -import { RGBAFormat } from './three.core.js'; -import { RGBAIntegerFormat } from './three.core.js'; -import { RGBA_ASTC_10x10_Format } from './three.core.js'; -import { RGBA_ASTC_10x5_Format } from './three.core.js'; -import { RGBA_ASTC_10x6_Format } from './three.core.js'; -import { RGBA_ASTC_10x8_Format } from './three.core.js'; -import { RGBA_ASTC_12x10_Format } from './three.core.js'; -import { RGBA_ASTC_12x12_Format } from './three.core.js'; -import { RGBA_ASTC_4x4_Format } from './three.core.js'; -import { RGBA_ASTC_5x4_Format } from './three.core.js'; -import { RGBA_ASTC_5x5_Format } from './three.core.js'; -import { RGBA_ASTC_6x5_Format } from './three.core.js'; -import { RGBA_ASTC_6x6_Format } from './three.core.js'; -import { RGBA_ASTC_8x5_Format } from './three.core.js'; -import { RGBA_ASTC_8x6_Format } from './three.core.js'; -import { RGBA_ASTC_8x8_Format } from './three.core.js'; -import { RGBA_BPTC_Format } from './three.core.js'; -import { RGBA_ETC2_EAC_Format } from './three.core.js'; -import { RGBA_PVRTC_2BPPV1_Format } from './three.core.js'; -import { RGBA_PVRTC_4BPPV1_Format } from './three.core.js'; -import { RGBA_S3TC_DXT1_Format } from './three.core.js'; -import { RGBA_S3TC_DXT3_Format } from './three.core.js'; -import { RGBA_S3TC_DXT5_Format } from './three.core.js'; -import { RGBFormat } from './three.core.js'; -import { RGBIntegerFormat } from './three.core.js'; -import { RGB_BPTC_SIGNED_Format } from './three.core.js'; -import { RGB_BPTC_UNSIGNED_Format } from './three.core.js'; -import { RGB_ETC1_Format } from './three.core.js'; -import { RGB_ETC2_Format } from './three.core.js'; -import { RGB_PVRTC_2BPPV1_Format } from './three.core.js'; -import { RGB_PVRTC_4BPPV1_Format } from './three.core.js'; -import { RGB_S3TC_DXT1_Format } from './three.core.js'; -import { RGFormat } from './three.core.js'; -import { RGIntegerFormat } from './three.core.js'; -/** - * `RTTNode` takes another node and uses it with a `QuadMesh` to render into a texture (RTT). - * This module is especially relevant in context of post processing where certain nodes require - * texture input for their effects. With the helper function `convertToTexture()` which is based - * on this module, the node system can automatically ensure texture input if required. - * - * @augments TextureNode - */ -export class RTTNode extends TextureNode { - /** - * Constructs a new RTT node. - * - * @param {Node} node - The node to render a texture with. - * @param {?number} [width=null] - The width of the internal render target. If not width is applied, the render target is automatically resized. - * @param {?number} [height=null] - The height of the internal render target. - * @param {Object} [options={}] - The options for the internal render target. - * @param {number} [options.type=HalfFloatType] - The texture type. - * @param {boolean} [options.autoUpdate=true] - Whether the texture should automatically be updated or not. - * @param {number} [options.resolutionScale=1] - The resolution scale. - */ - constructor(node: Node, width?: number | null, height?: number | null, options?: { - type?: number | undefined; - autoUpdate?: boolean | undefined; - resolutionScale?: number | undefined; - }); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRTTNode: boolean; - /** - * The node to render a texture with. - * - * @type {Node} - */ - node: Node; - /** - * The width of the internal render target. - * If not width is applied, the render target is automatically resized. - * - * @type {?number} - * @default null - */ - width: number | null; - /** - * The height of the internal render target. - * - * @type {?number} - * @default null - */ - height: number | null; - /** - * The render target - * - * @type {RenderTarget} - */ - renderTarget: RenderTarget; - /** - * Whether the texture requires an update or not. - * - * @type {boolean} - * @default true - */ - textureNeedsUpdate: boolean; - /** - * Whether the texture should automatically be updated or not. - * - * @type {boolean} - * @default true - */ - autoUpdate: boolean; - /** - * The resolution scale - * - * @private - * @type {number} - * @default 1 - */ - private _resolutionScale; - /** - * The internal quad mesh for RTT. - * - * @private - * @type {QuadMesh} - */ - private _quadMesh; - /** - * Whether the internal render target should automatically be resized or not. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly get autoResize(): boolean; - setup(builder: any): void; - /** - * Sets the size of the internal render target - * - * @param {number} width - The width to set. - * @param {number} height - The width to set. - */ - setSize(width: number, height: number): void; - /** - * Sets the resolution scale. - * The resolution scale is a factor that is multiplied with the renderer's width and height. - * - * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. - * @returns {RTTNode} A reference to this node. - */ - setResolutionScale(resolutionScale: number): RTTNode; - /** - * Gets the resolution scale. - * - * @returns {number} The resolution scale. - */ - getResolutionScale(): number; - updateBefore({ renderer }: { - renderer: any; - }): void; -} -/** - * `RangeNode` generates random instanced attribute data in a defined range. - * An exemplary use case for this utility node is to generate random per-instance - * colors: - * ```js - * const material = new MeshBasicNodeMaterial(); - * material.colorNode = range( new Color( 0x000000 ), new Color( 0xFFFFFF ) ); - * const mesh = new InstancedMesh( geometry, material, count ); - * ``` - * @augments Node - */ -export class RangeNode extends Node { - /** - * Constructs a new range node. - * - * @param {Node} [minNode=float()] - A node defining the lower bound of the range. - * @param {Node} [maxNode=float()] - A node defining the upper bound of the range. - */ - constructor(minNode?: Node, maxNode?: Node); - /** - * A node defining the lower bound of the range. - * - * @type {Node} - * @default float() - */ - minNode: Node; - /** - * A node defining the upper bound of the range. - * - * @type {Node} - * @default float() - */ - maxNode: Node; - /** - * Returns the vector length which is computed based on the range definition. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {number} The vector length. - */ - getVectorLength(builder: NodeBuilder): number; - /** - * This method is overwritten since the node type is inferred from range definition. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns a constant node from the given node by traversing it. - * - * @param {Node} node - The node to traverse. - * @returns {Node} The constant node, if found. - */ - getConstNode(node: Node): Node; - setup(builder: any): any; -} -/** - * A readback buffer is used to transfer data from the GPU to the CPU. - * It is primarily used to read back compute shader results. - * - * @augments EventDispatcher - */ -export class ReadbackBuffer extends EventDispatcher { - /** - * Constructs a new readback buffer. - * - * @param {number} maxByteLength - The maximum size of the buffer to be read back. - */ - constructor(maxByteLength: number); - /** - * Name used for debugging purposes. - * - * @type {string} - */ - name: string; - /** - * The mapped, read back array buffer. - * - * @type {ArrayBuffer|null} - */ - buffer: ArrayBuffer | null; - /** - * The maximum size of the buffer to be read back. - * - * @type {number} - */ - maxByteLength: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isReadbackBuffer: boolean; - _mapped: boolean; - /** - * Releases the mapped buffer data so the GPU buffer can be - * used by the GPU again. - * - * Note: Any `ArrayBuffer` data associated with this readback buffer - * are removed and no longer accessible after calling this method. - */ - release(): void; - /** - * Frees internal resources. - */ - dispose(): void; -} -import { RectAreaLight } from './three.core.js'; -/** - * Module for representing rect area lights as nodes. - * - * @augments AnalyticLightNode - */ -export class RectAreaLightNode extends AnalyticLightNode { - /** - * Used to configure the internal BRDF approximation texture data. - * - * @param {RectAreaLightTexturesLib} ltc - The BRDF approximation texture data. - */ - static setLTC(ltc: RectAreaLightTexturesLib): void; - /** - * Constructs a new rect area light node. - * - * @param {?RectAreaLight} [light=null] - The rect area light source. - */ - constructor(light?: RectAreaLight | null); - /** - * Uniform node representing the half height of the are light. - * - * @type {UniformNode} - */ - halfHeight: UniformNode; - /** - * Uniform node representing the half width of the are light. - * - * @type {UniformNode} - */ - halfWidth: UniformNode; - /** - * Overwritten to updated rect area light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - setupDirectRectArea(builder: any): { - lightColor: Node; - lightPosition: any; - halfWidth: any; - halfHeight: any; - ltc_1: TextureNode; - ltc_2: TextureNode; - }; -} -import { RedFormat } from './three.core.js'; -import { RedIntegerFormat } from './three.core.js'; -/** - * Base class for nodes which establishes a reference to a property of another object. - * In this way, the value of the node is automatically linked to the value of - * referenced object. Reference nodes internally represent the linked value - * as a uniform. - * - * @augments Node - */ -export class ReferenceBaseNode extends Node { - /** - * Constructs a new reference base node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} uniformType - The uniform type that should be used to represent the property value. - * @param {?Object} [object=null] - The object the property belongs to. - * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. - */ - constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); - /** - * The name of the property the node refers to. - * - * @type {string} - */ - property: string; - /** - * The uniform type that should be used to represent the property value. - * - * @type {string} - */ - uniformType: string; - /** - * The object the property belongs to. - * - * @type {?Object} - * @default null - */ - object: Object | null; - /** - * When the linked property is an array, this parameter defines its length. - * - * @type {?number} - * @default null - */ - count: number | null; - /** - * The property name might have dots so nested properties can be referred. - * The hierarchy of the names is stored inside this array. - * - * @type {Array} - */ - properties: Array; - /** - * Points to the current referred object. This property exists next to {@link ReferenceNode#object} - * since the final reference might be updated from calling code. - * - * @type {?Object} - * @default null - */ - reference: Object | null; - /** - * The uniform node that holds the value of the reference node. - * - * @type {UniformNode} - * @default null - */ - node: UniformNode; - /** - * The uniform group of the internal uniform. - * - * @type {UniformGroupNode} - * @default null - */ - group: UniformGroupNode; - /** - * Sets the uniform group for this reference node. - * - * @param {UniformGroupNode} group - The uniform group to set. - * @return {ReferenceBaseNode} A reference to this node. - */ - setGroup(group: UniformGroupNode): ReferenceBaseNode; - /** - * When the referred property is array-like, this method can be used - * to access elements via an index node. - * - * @param {IndexNode} indexNode - indexNode. - * @return {ReferenceElementNode} A reference to an element. - */ - element(indexNode: IndexNode): ReferenceElementNode; - /** - * Sets the node type which automatically defines the internal - * uniform type. - * - * @param {string} uniformType - The type to set. - */ - setNodeType(uniformType: string): void; - /** - * This method is overwritten since the node type is inferred from - * the type of the reference node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the property value from the given referred object. - * - * @param {Object} [object=this.reference] - The object to retrieve the property value from. - * @return {any} The value. - */ - getValueFromReference(object?: Object): any; - /** - * Allows to update the reference based on the given state. The state is only - * evaluated {@link ReferenceBaseNode#object} is not set. - * - * @param {(NodeFrame|NodeBuilder)} state - The current state. - * @return {Object} The updated reference. - */ - updateReference(state: (NodeFrame | NodeBuilder)): Object; - /** - * The output of the reference node is the internal uniform node. - * - * @return {UniformNode} The output node. - */ - setup(): UniformNode; - /** - * Overwritten to update the internal uniform value. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(): void; - /** - * Retrieves the value from the referred object property and uses it - * to updated the internal uniform. - */ - updateValue(): void; -} -/** - * This class is only relevant if the referenced property is array-like. - * In this case, `ReferenceElementNode` allows to refer to a specific - * element inside the data structure via an index. - * - * @augments ArrayElementNode - */ -export class ReferenceElementNode extends ArrayElementNode { - /** - * Constructs a new reference element node. - * - * @param {(ReferenceBaseNode|ReferenceNode)} referenceNode - The reference node. - * @param {Node} indexNode - The index node that defines the element access. - */ - constructor(referenceNode: (ReferenceBaseNode | ReferenceNode), indexNode: Node); - /** - * Similar to {@link ReferenceNode#reference}, an additional - * property references to the current node. - * - * @type {?(ReferenceBaseNode|ReferenceNode)} - * @default null - */ - referenceNode: (ReferenceBaseNode | ReferenceNode) | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isReferenceElementNode: boolean; - /** - * This method is overwritten since the node type is inferred from - * the uniform type of the reference node. - * - * @return {string} The node type. - */ - generateNodeType(): string; - generate(builder: any): any; -} -/** - * This type of node establishes a reference to a property of another object. - * In this way, the value of the node is automatically linked to the value of - * referenced object. Reference nodes internally represent the linked value - * as a uniform. - * - * @augments Node - */ -export class ReferenceNode extends Node { - /** - * Constructs a new reference node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} uniformType - The uniform type that should be used to represent the property value. - * @param {?Object} [object=null] - The object the property belongs to. - * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. - */ - constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); - /** - * The name of the property the node refers to. - * - * @type {string} - */ - property: string; - /** - * The uniform type that should be used to represent the property value. - * - * @type {string} - */ - uniformType: string; - /** - * The object the property belongs to. - * - * @type {?Object} - * @default null - */ - object: Object | null; - /** - * When the linked property is an array, this parameter defines its length. - * - * @type {?number} - * @default null - */ - count: number | null; - /** - * The property name might have dots so nested properties can be referred. - * The hierarchy of the names is stored inside this array. - * - * @type {Array} - */ - properties: Array; - /** - * Points to the current referred object. This property exists next to {@link ReferenceNode#object} - * since the final reference might be updated from calling code. - * - * @type {?Object} - * @default null - */ - reference: Object | null; - /** - * The uniform node that holds the value of the reference node. - * - * @type {UniformNode} - * @default null - */ - node: UniformNode; - /** - * The uniform group of the internal uniform. - * - * @type {UniformGroupNode} - * @default null - */ - group: UniformGroupNode; - /** - * When the referred property is array-like, this method can be used - * to access elements via an index node. - * - * @param {IndexNode} indexNode - indexNode. - * @return {ReferenceElementNode} A reference to an element. - */ - element(indexNode: IndexNode): ReferenceElementNode; - /** - * Sets the uniform group for this reference node. - * - * @param {UniformGroupNode} group - The uniform group to set. - * @return {ReferenceNode} A reference to this node. - */ - setGroup(group: UniformGroupNode): ReferenceNode; - /** - * Sets the name for the internal uniform. - * - * @param {string} name - The label to set. - * @return {ReferenceNode} A reference to this node. - */ - setName(name: string): ReferenceNode; - /** - * Sets the label for the internal uniform. - * - * @deprecated - * @param {string} name - The label to set. - * @return {ReferenceNode} A reference to this node. - */ - label(name: string): ReferenceNode; - /** - * Sets the node type which automatically defines the internal - * uniform type. - * - * @param {string} uniformType - The type to set. - */ - setNodeType(uniformType: string): void; - /** - * This method is overwritten since the node type is inferred from - * the type of the reference node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the property value from the given referred object. - * - * @param {Object} [object=this.reference] - The object to retrieve the property value from. - * @return {any} The value. - */ - getValueFromReference(object?: Object): any; - /** - * Allows to update the reference based on the given state. The state is only - * evaluated {@link ReferenceNode#object} is not set. - * - * @param {(NodeFrame|NodeBuilder)} state - The current state. - * @return {Object} The updated reference. - */ - updateReference(state: (NodeFrame | NodeBuilder)): Object; - /** - * The output of the reference node is the internal uniform node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {UniformNode} The output node. - */ - setup(): UniformNode; - /** - * Overwritten to update the internal uniform value. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(): void; - /** - * Retrieves the value from the referred object property and uses it - * to updated the internal uniform. - */ - updateValue(): void; -} -/** - * This node can be used to implement mirror-like flat reflective surfaces. - * - * ```js - * const groundReflector = reflector(); - * material.colorNode = groundReflector; - * - * const plane = new Mesh( geometry, material ); - * plane.add( groundReflector.target ); - * ``` - * - * @augments TextureNode - */ -export class ReflectorNode extends TextureNode { - /** - * Constructs a new reflector node. - * - * @param {Object} [parameters={}] - An object holding configuration parameters. - * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. - * @param {number} [parameters.resolutionScale=1] - The resolution scale. - * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. - * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. - * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. - * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. - * @param {TextureNode} [parameters.defaultTexture] - The default texture node. - * @param {ReflectorBaseNode} [parameters.reflector] - The reflector base node. - */ - constructor(parameters?: { - target?: Object3D | undefined; - resolutionScale?: number | undefined; - generateMipmaps?: boolean | undefined; - bounces?: boolean | undefined; - depth?: boolean | undefined; - samples?: number | undefined; - defaultTexture?: TextureNode | undefined; - reflector?: ReflectorBaseNode | undefined; - }); - /** - * A reference to the internal reflector base node which holds the actual implementation. - * - * @private - * @type {ReflectorBaseNode} - * @default ReflectorBaseNode - */ - private _reflectorBaseNode; - /** - * A reference to the internal depth node. - * - * @private - * @type {?Node} - * @default null - */ - private _depthNode; - /** - * A reference to the internal reflector node. - * - * @type {ReflectorBaseNode} - */ - get reflector(): ReflectorBaseNode; - /** - * A reference to 3D object the reflector is linked to. - * - * @type {Object3D} - */ - get target(): Object3D; - /** - * Returns a node representing the mirror's depth. That can be used - * to implement more advanced reflection effects like distance attenuation. - * - * @return {Node} The depth node. - */ - getDepthNode(): Node; - setup(builder: any): void; - clone(): any; -} -import { ReinhardToneMapping } from './three.core.js'; -import { RenderObjectRefreshType } from './three.core.js'; -/** - * Normally, tone mapping and color conversion happens automatically just - * before outputting a pixel to the default (screen) framebuffer. In certain - * post processing setups this is too late because some effects such as FXAA - * require e.g. sRGB input. For such scenarios, `RenderOutputNode` can be used - * to apply tone mapping and color space conversion at an arbitrary point - * in the effect chain. - * - * When applying tone mapping and color space conversion manually with this node, - * you have to set {@link RenderPipeline#outputColorTransform} to `false`. - * - * ```js - * const postProcessing = new RenderPipeline( renderer ); - * postProcessing.outputColorTransform = false; - * - * const scenePass = pass( scene, camera ); - * const outputPass = renderOutput( scenePass ); - * - * postProcessing.outputNode = outputPass; - * ``` - * - * @augments TempNode - */ -export class RenderOutputNode extends TempNode { - /** - * Constructs a new render output node. - * - * @param {Node} colorNode - The color node to process. - * @param {?number} toneMapping - The tone mapping type. - * @param {?string} outputColorSpace - The output color space. - */ - constructor(colorNode: Node, toneMapping: number | null, outputColorSpace: string | null); - /** - * The color node to process. - * - * @type {Node} - */ - colorNode: Node; - /** - * The tone mapping type. - * - * @private - * @type {?number} - */ - private _toneMapping; - /** - * The output color space. - * - * @type {?string} - */ - outputColorSpace: string | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderOutputNode: boolean; - /** - * Sets the tone mapping type. - * - * @param {number} value - The tone mapping type. - * @return {ToneMappingNode} A reference to this node. - */ - setToneMapping(value: number): ToneMappingNode; - /** - * Gets the tone mapping type. - * - * @returns {number} The tone mapping type. - */ - getToneMapping(): number; - setup({ context }: { - context: any; - }): Node; -} -/** - * This module is responsible to manage the rendering pipeline setups in apps. - * You usually create a single instance of this class and use it to define - * the output of your render pipeline and post processing effect chain. - * ```js - * const renderPipeline = new RenderPipeline( renderer ); - * - * const scenePass = pass( scene, camera ); - * - * renderPipeline.outputNode = scenePass; - * ``` - * - * Note: This module can only be used with `WebGPURenderer`. - */ -export class RenderPipeline { - /** - * Constructs a new render pipeline management module. - * - * @param {Renderer} renderer - A reference to the renderer. - * @param {Node} outputNode - An optional output node. - */ - constructor(renderer: Renderer, outputNode?: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderPipeline: boolean; - /** - * A reference to the renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * A node which defines the final output of the rendering - * pipeline. This is usually the last node in a chain - * of effect nodes. - * - * @type {Node} - */ - outputNode: Node; - /** - * Whether the default output tone mapping and color - * space transformation should be enabled or not. - * - * This is enabled by default but it must be disabled for - * effects that expect to be executed after tone mapping and color - * space conversion. A typical example is FXAA which - * requires sRGB input. - * - * When set to `false`, the app must control the output - * transformation with `RenderOutputNode`. - * - * ```js - * const outputPass = renderOutput( scenePass ); - * ``` - * - * @type {boolean} - */ - outputColorTransform: boolean; - /** - * Must be set to `true` when the output node changes. - * - * @type {Node} - */ - needsUpdate: Node; - /** - * The full screen quad that is used to render - * the effects. - * - * @private - * @type {QuadMesh} - */ - private _quadMesh; - /** - * The context data for the render pipeline. - * - * @private - * @type {?Object} - * @default null - */ - private _contextData; - /** - * The current tone mapping. - * - * @private - * @type {ToneMapping} - */ - private _toneMapping; - /** - * The current output color space. - * - * @private - * @type {ColorSpace} - */ - private _outputColorSpace; - /** - * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, - * the application must use this version of `render()` inside - * its animation loop (not the one from the renderer). - */ - render(): void; - /** - * Frees internal resources. - */ - dispose(): void; - /** - * Updates the context data. - * - * @private - */ - private _updateContext; - /** - * Updates the state of the module. - * - * @private - */ - private _update; - /** - * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, - * the application must use this version of `renderAsync()` inside - * its animation loop (not the one from the renderer). - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the render has been finished. - */ - renderAsync(): Promise; -} -import { RenderTarget } from './three.core.js'; -/** - * Base class for renderers. - */ -export class Renderer { - /** - * Renderer options. - * - * @typedef {Object} Renderer~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0 - * to overwrite the default. - * @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. - * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best - * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. - * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. - */ - /** - * Constructs a new renderer. - * - * @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2). - * @param {Renderer~Options} [parameters] - The configuration parameter. - - */ - constructor(backend: Backend, parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderer: boolean; - /** - * A reference to the current backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * Whether the renderer should automatically clear the current rendering target - * before execute a `render()` call. The target can be the canvas (default framebuffer) - * or the current bound render target (custom framebuffer). - * - * @type {boolean} - * @default true - */ - autoClear: boolean; - /** - * When `autoClear` is set to `true`, this property defines whether the renderer - * should clear the color buffer. - * - * @type {boolean} - * @default true - */ - autoClearColor: boolean; - /** - * When `autoClear` is set to `true`, this property defines whether the renderer - * should clear the depth buffer. - * - * @type {boolean} - * @default true - */ - autoClearDepth: boolean; - /** - * When `autoClear` is set to `true`, this property defines whether the renderer - * should clear the stencil buffer. - * - * @type {boolean} - * @default true - */ - autoClearStencil: boolean; - /** - * Whether the default framebuffer should be transparent or opaque. - * - * @type {boolean} - * @default true - */ - alpha: boolean; - /** - * Whether logarithmic depth buffer is enabled or not. - * - * @type {boolean} - * @default false - * @readonly - */ - readonly logarithmicDepthBuffer: boolean; - /** - * Whether reversed depth buffer is enabled or not. - * - * @type {boolean} - * @default false - * @readonly - */ - readonly reversedDepthBuffer: boolean; - /** - * Defines the output color space of the renderer. - * - * @type {string} - * @default SRGBColorSpace - */ - outputColorSpace: string; - /** - * Defines the tone mapping of the renderer. - * - * @type {number} - * @default NoToneMapping - */ - toneMapping: number; - /** - * Defines the tone mapping exposure. - * - * @type {number} - * @default 1 - */ - toneMappingExposure: number; - /** - * Whether the renderer should sort its render lists or not. - * - * Note: Sorting is used to attempt to properly render objects that have some degree of transparency. - * By definition, sorting objects may not work in all cases. Depending on the needs of application, - * it may be necessary to turn off sorting and use other methods to deal with transparency rendering - * e.g. manually determining each object's rendering order. - * - * @type {boolean} - * @default true - */ - sortObjects: boolean; - /** - * Whether the default framebuffer should have a depth buffer or not. - * - * @type {boolean} - * @default true - */ - depth: boolean; - /** - * Whether the default framebuffer should have a stencil buffer or not. - * - * @type {boolean} - * @default false - */ - stencil: boolean; - /** - * Holds a series of statistical information about the GPU memory - * and the rendering process. Useful for debugging and monitoring. - * - * @type {Info} - */ - info: Info; - /** - * A global context node that stores override nodes for specific transformations or calculations. - * These nodes can be used to replace default behavior in the rendering pipeline. - * - * @type {ContextNode} - * @property {Object} value - The context value object. - */ - contextNode: ContextNode; - /** - * The node library defines how certain library objects like materials, lights - * or tone mapping functions are mapped to node types. This is required since - * although instances of classes like `MeshBasicMaterial` or `PointLight` can - * be part of the scene graph, they are internally represented as nodes for - * further processing. - * - * @type {NodeLibrary} - */ - library: NodeLibrary; - /** - * A map-like data structure for managing lights. - * - * @type {Lighting} - */ - lighting: Lighting; - /** - * The number of MSAA samples. - * - * @private - * @type {number} - * @default 0 - */ - private _samples; - /** - * Callback when the canvas has been resized. - * - * @private - */ - private _onCanvasTargetResize; - /** - * The canvas target for rendering. - * - * @private - * @type {CanvasTarget} - */ - private _canvasTarget; - /** - * The inspector provides information about the internal renderer state. - * - * @private - * @type {InspectorBase} - */ - private _inspector; - /** - * This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. - * - * @private - * @type {?Function} - */ - private _getFallback; - /** - * A reference to a renderer module for managing shader attributes. - * - * @private - * @type {?Attributes} - * @default null - */ - private _attributes; - /** - * A reference to a renderer module for managing geometries. - * - * @private - * @type {?Geometries} - * @default null - */ - private _geometries; - /** - * A reference to a renderer module for managing node related logic. - * - * @private - * @type {?NodeManager} - * @default null - */ - private _nodes; - /** - * A reference to a renderer module for managing the internal animation loop. - * - * @private - * @type {?Animation} - * @default null - */ - private _animation; - /** - * A reference to a renderer module for managing shader program bindings. - * - * @private - * @type {?Bindings} - * @default null - */ - private _bindings; - /** - * A reference to a renderer module for managing render objects. - * - * @private - * @type {?RenderObjects} - * @default null - */ - private _objects; - /** - * A reference to a renderer module for managing render and compute pipelines. - * - * @private - * @type {?Pipelines} - * @default null - */ - private _pipelines; - /** - * A reference to a renderer module for managing render bundles. - * - * @private - * @type {?RenderBundles} - * @default null - */ - private _bundles; - /** - * A reference to a renderer module for managing render lists. - * - * @private - * @type {?RenderLists} - * @default null - */ - private _renderLists; - /** - * A reference to a renderer module for managing render contexts. - * - * @private - * @type {?RenderContexts} - * @default null - */ - private _renderContexts; - /** - * A reference to a renderer module for managing textures. - * - * @private - * @type {?Textures} - * @default null - */ - private _textures; - /** - * A reference to a renderer module for backgrounds. - * - * @private - * @type {?Background} - * @default null - */ - private _background; - /** - * Cache for the fullscreen quad. - * This fullscreen quad is used for internal render passes - * like the tone mapping and color space output pass. - * - * @private - * @type {Map} - */ - private _quadCache; - /** - * A reference to the current render context. - * - * @private - * @type {?RenderContext} - * @default null - */ - private _currentRenderContext; - /** - * A custom sort function for the opaque render list. - * - * @private - * @type {?Function} - * @default null - */ - private _opaqueSort; - /** - * A custom sort function for the transparent render list. - * - * @private - * @type {?Function} - * @default null - */ - private _transparentSort; - /** - * Cache of framebuffer targets per canvas target. - * - * @private - * @type {Map} - */ - private _frameBufferTargets; - /** - * The clear color value. - * - * @private - * @type {Color4} - */ - private _clearColor; - /** - * The clear depth value. - * - * @private - * @type {number} - * @default 1 - */ - private _clearDepth; - /** - * The clear stencil value. - * - * @private - * @type {number} - * @default 0 - */ - private _clearStencil; - /** - * The current render target. - * - * @private - * @type {?RenderTarget} - * @default null - */ - private _renderTarget; - /** - * The active cube face. - * - * @private - * @type {number} - * @default 0 - */ - private _activeCubeFace; - /** - * The active mipmap level. - * - * @private - * @type {number} - * @default 0 - */ - private _activeMipmapLevel; - /** - * The current output render target. - * - * @private - * @type {?RenderTarget} - * @default null - */ - private _outputRenderTarget; - /** - * The MRT setting. - * - * @private - * @type {?MRTNode} - * @default null - */ - private _mrt; - /** - * This function defines how a render object is going - * to be rendered. - * - * @private - * @type {?Function} - * @default null - */ - private _renderObjectFunction; - /** - * Used to keep track of the current render object function. - * - * @private - * @type {?Function} - * @default null - */ - private _currentRenderObjectFunction; - /** - * Used to keep track of the current render bundle. - * - * @private - * @type {?RenderBundle} - * @default null - */ - private _currentRenderBundle; - /** - * Next to `_renderObjectFunction()`, this function provides another hook - * for influencing the render process of a render object. It is meant for internal - * use and only relevant for `compileAsync()` right now. Instead of using - * the default logic of `_renderObjectDirect()` which actually draws the render object, - * a different function might be used which performs no draw but just the node - * and pipeline updates. - * - * @private - * @type {Function} - */ - private _handleObjectFunction; - /** - * Indicates whether the device has been lost or not. In WebGL terms, the device - * lost is considered as a context lost. When this is set to `true`, rendering - * isn't possible anymore. - * - * @private - * @type {boolean} - * @default false - */ - private _isDeviceLost; - /** - * A callback function that defines what should happen when a device/context lost occurs. - * - * @type {Function} - */ - onDeviceLost: Function; - /** - * A callback function that defines what should happen when an uncaptured - * backend error is reported (e.g. a WebGPU validation/out-of-memory/internal - * error raised outside an error scope). Applications can override this to - * surface errors in their own UI without letting them escalate to a device - * loss. The default implementation logs to the console. - * - * @type {Function} - */ - onError: Function; - /** - * Defines the type of output buffers. The default `HalfFloatType` is recommend for - * best quality. To save memory and bandwidth, `UnsignedByteType` might be used. - * This will reduce rendering quality though. - * - * @private - * @type {number} - * @default HalfFloatType - */ - private _outputBufferType; - /** - * A cache for shadow nodes per material - * - * @private - * @type {WeakMap} - */ - private _cacheShadowNodes; - /** - * Whether the renderer has been initialized or not. - * - * @private - * @type {boolean} - * @default false - */ - private _initialized; - /** - * The call depth of the renderer. Counts the number of - * nested render calls. - * - * @private - * @type {number} - * @default - 1 - */ - private _callDepth; - /** - * A reference to the promise which initializes the renderer. - * - * @private - * @type {?Promise} - * @default null - */ - private _initPromise; - /** - * An array of compilation promises which are used in `compileAsync()`. - * - * @private - * @type {?Array} - * @default null - */ - private _compilationPromises; - /** - * Whether the renderer is currently precompiling a render object in - * `compileAsync()`. - * - * @private - * @type {boolean} - * @default false - */ - private _isPreCompiling; - /** - * When an override material is in use, this property points to the current - * source material during the rendering of a render object. - * - * @private - * @type {?Material} - * @default null - */ - private _currentSourceMaterial; - /** - * Whether the renderer should render transparent render objects or not. - * - * @type {boolean} - * @default true - */ - transparent: boolean; - /** - * Whether the renderer should render opaque render objects or not. - * - * @type {boolean} - * @default true - */ - opaque: boolean; - /** - * Shadow map configuration - * @typedef {Object} ShadowMapConfig - * @property {boolean} enabled - Whether to globally enable shadows or not. - * @property {boolean} transmitted - Whether to enable light transmission through non-opaque materials. - * @property {number} type - The shadow map type. - */ - /** - * The renderer's shadow configuration. - * - * @type {ShadowMapConfig} - */ - shadowMap: { - /** - * - Whether to globally enable shadows or not. - */ - enabled: boolean; - /** - * - Whether to enable light transmission through non-opaque materials. - */ - transmitted: boolean; - /** - * - The shadow map type. - */ - type: number; - }; - /** - * XR configuration. - * @typedef {Object} XRConfig - * @property {boolean} enabled - Whether to globally enable XR or not. - */ - /** - * The renderer's XR manager. - * - * @type {XRManager} - */ - xr: XRManager; - /** - * Debug configuration. - * @typedef {Object} DebugConfig - * @property {boolean} checkShaderErrors - Whether shader errors should be checked or not. - * @property {Object} diagnostics - Diagnostics configuration for the shader generation. - * @property {boolean} diagnostics.keywords - Whether declaration names that collide with reserved keywords should be renamed or not. - * @property {?Function} onNodeBuilderCreated - A callback function that is executed after a node builder has been created and before it is built. - * @property {?Function} onShaderError - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. - * @property {Function} getShaderAsync - Allows the get the raw shader code for the given scene, camera and 3D object. - */ - /** - * The renderer's debug configuration. - * - * @type {DebugConfig} - */ - debug: { - /** - * - Whether shader errors should be checked or not. - */ - checkShaderErrors: boolean; - /** - * - Diagnostics configuration for the shader generation. - */ - diagnostics: { - keywords: boolean; - }; - /** - * - A callback function that is executed after a node builder has been created and before it is built. - */ - onNodeBuilderCreated: Function | null; - /** - * - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. - */ - onShaderError: Function | null; - /** - * - Allows the get the raw shader code for the given scene, camera and 3D object. - */ - getShaderAsync: Function; - }; - /** - * Initializes the renderer so it is ready for usage. - * - * @async - * @return {Promise} A Promise that resolves when the renderer has been initialized. - */ - init(): Promise; - /** - * A reference to the canvas element the renderer is drawing to. - * This value of this property will automatically be created by - * the renderer. - * - * @type {HTMLCanvasElement|OffscreenCanvas} - */ - get domElement(): HTMLCanvasElement | OffscreenCanvas; - /** - * The coordinate system of the renderer. The value of this property - * depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or - * `THREE.WebGPUCoordinateSystem`. - * - * @readonly - * @type {number} - */ - readonly get coordinateSystem(): number; - /** - * Compiles all materials in the given scene. This can be useful to avoid a - * phenomenon which is called "shader compilation stutter", which occurs when - * rendering an object with a new shader for the first time. - * - * If you want to add a 3D object to an existing scene, use the third optional - * parameter for applying the target scene. Note that the (target) scene's lighting - * and environment must be configured before calling this method. - * - * @async - * @param {Object3D} scene - The scene or 3D object to precompile. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {?Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. - * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. - * @return {Promise} A Promise that resolves when the compile has been finished. - */ - compileAsync(scene: Object3D, camera: Camera, targetScene?: Scene | null, onProgress?: onProgressCallback): Promise; - /** - * Compile compute programs. This can be useful to avoid a - * phenomenon which is called "shader compilation stutter", which occurs when - * rendering an object with a new shader for the first time. - * - * @async - * @param {Node|Array} computeNodes - The compute node(s). - * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. - * @return {Promise} A Promise that resolves when the compile has been finished. - */ - compileComputeAsync(computeNodes: Node | Array, onProgress?: onProgressCallback): Promise; - /** - * Renders the scene in an async fashion. - * - * @async - * @deprecated - * @param {Object3D} scene - The scene or 3D object to render. - * @param {Camera} camera - The camera. - * @return {Promise} A Promise that resolves when the render has been finished. - */ - renderAsync(scene: Object3D, camera: Camera): Promise; - /** - * Can be used to synchronize CPU operations with GPU tasks. So when this method is called, - * the CPU waits for the GPU to complete its operation (e.g. a compute task). - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when synchronization has been finished. - */ - waitForGPU(): Promise; - set inspector(value: InspectorBase); - /** - * The inspector instance. The inspector can be any class that extends from `InspectorBase`. - * - * @type {InspectorBase} - */ - get inspector(): InspectorBase; - /** - * Enables or disables high precision for model-view and normal-view matrices. - * When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance. - * - * NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`. - * - * @param {boolean} value - Whether to enable or disable high precision. - * @type {boolean} - */ - set highPrecision(value: boolean); - /** - * Returns whether high precision is enabled or not. - * - * @return {boolean} Whether high precision is enabled or not. - * @type {boolean} - */ - get highPrecision(): boolean; - /** - * Sets the given MRT configuration. - * - * @param {MRTNode} mrt - The MRT node to set. - * @return {Renderer} A reference to this renderer. - */ - setMRT(mrt: MRTNode): Renderer; - /** - * Returns the MRT configuration. - * - * @return {MRTNode} The MRT configuration. - */ - getMRT(): MRTNode; - /** - * Returns the output buffer type. - * - * @return {number} The output buffer type. - */ - getOutputBufferType(): number; - /** - * Returns the output buffer type. - * - * @deprecated since r182. Use `.getOutputBufferType()` instead. - * @return {number} The output buffer type. - */ - getColorBufferType(): number; - /** - * Default implementation of the device lost callback. - * - * @private - * @param {Object} info - Information about the context lost. - */ - private _onDeviceLost; - /** - * Default implementation of the uncaptured backend error callback. - * - * @private - * @param {Object} info - Information about the uncaptured error. - */ - private _onError; - /** - * Returns `true` if the cached GPU render bundle for the given bundle group is - * out-of-date and must be recorded again. - * - * @private - * @param {BundleGroup} bundleGroup - The bundle group. - * @param {Object} renderBundleData - The backend data of the render bundle. - * @return {boolean} Whether the cached render bundle needs an update. - */ - private _bundleNeedsUpdate; - /** - * Renders the given render bundle. - * - * @private - * @param {Object} bundle - Render bundle data. - * @param {Scene} sceneRef - The scene the render bundle belongs to. - * @param {LightsNode} lightsNode - The lights node. - */ - private _renderBundle; - /** - * Renders the scene or 3D object with the given camera. This method can only be called - * if the renderer has been initialized. When using `render()` inside an animation loop, - * it's guaranteed the renderer will be initialized. The animation loop must be defined - * with {@link Renderer#setAnimationLoop} though. - * - * For all other use cases (like when using on-demand rendering), you must call - * {@link Renderer#init} before rendering. - * - * The target of the method is the default framebuffer (meaning the canvas) - * or alternatively a render target when specified via `setRenderTarget()`. - * - * @param {Object3D} scene - The scene or 3D object to render. - * @param {Camera} camera - The camera to render the scene with. - */ - render(scene: Object3D, camera: Camera): void; - /** - * Returns whether the renderer has been initialized or not. - * - * @readonly - * @return {boolean} Whether the renderer has been initialized or not. - */ - readonly get initialized(): boolean; - _renderOutputLayers(quad: any, renderTarget: any): void; - /** - * Returns an internal render target which is used when computing the output tone mapping - * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render - * pass and not inline to achieve more correct results. - * - * @private - * @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied. - */ - private _getFrameBufferTarget; - /** - * Renders the scene or 3D object with the given camera. - * - * @private - * @param {Object3D} scene - The scene or 3D object to render. - * @param {Camera} camera - The camera to render the scene with. - * @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not. - * @return {RenderContext} The current render context. - */ - private _renderScene; - _setXRLayerSize(width: any, height: any): void; - /** - * The output pass performs tone mapping and color space conversion. - * - * @private - * @param {RenderTarget} renderTarget - The current render target. - */ - private _renderOutput; - /** - * Returns the maximum available anisotropy for texture filtering. - * - * @return {number} The maximum available anisotropy. - */ - getMaxAnisotropy(): number; - /** - * Returns the active cube face. - * - * @return {number} The active cube face. - */ - getActiveCubeFace(): number; - /** - * Returns the active mipmap level. - * - * @return {number} The active mipmap level. - */ - getActiveMipmapLevel(): number; - /** - * Applications are advised to always define the animation loop - * with this method and not manually with `requestAnimationFrame()` - * for best compatibility. - * - * @async - * @param {?onAnimationCallback} callback - The application's animation loop. - * @return {Promise} A Promise that resolves when the set has been executed. - */ - setAnimationLoop(callback: onAnimationCallback | null): Promise; - /** - * Returns the current animation loop callback. - * - * @return {?Function} The current animation loop callback. - */ - getAnimationLoop(): Function | null; - /** - * Can be used to transfer buffer data from a storage buffer attribute - * from the GPU to the CPU in context of compute shaders. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @param {number} offset - The storage buffer attribute. - * @param {number} count - The offset from which to start reading the - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Returns the rendering context. - * - * @return {GPUCanvasContext|WebGL2RenderingContext} The rendering context. - */ - getContext(): GPUCanvasContext | WebGL2RenderingContext; - /** - * Returns the pixel ratio. - * - * @return {number} The pixel ratio. - */ - getPixelRatio(): number; - /** - * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize(target: Vector2): Vector2; - /** - * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The renderer's size in logical pixels. - */ - getSize(target: Vector2): Vector2; - /** - * Sets the given pixel ratio and resizes the canvas if necessary. - * - * @param {number} [value=1] - The pixel ratio. - */ - setPixelRatio(value?: number): void; - /** - * This method allows to define the drawing buffer size by specifying - * width, height and pixel ratio all at once. The size of the drawing - * buffer is computed with this formula: - * ```js - * size.x = width * pixelRatio; - * size.y = height * pixelRatio; - * ``` - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {number} pixelRatio - The pixel ratio. - */ - setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; - /** - * Sets the size of the renderer. - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. - */ - setSize(width: number, height: number, updateStyle?: boolean): void; - /** - * Defines a manual sort function for the opaque render list. - * Pass `null` to use the default sort. - * - * @param {Function} method - The sort function. - */ - setOpaqueSort(method: Function): void; - /** - * Defines a manual sort function for the transparent render list. - * Pass `null` to use the default sort. - * - * @param {Function} method - The sort function. - */ - setTransparentSort(method: Function): void; - /** - * Returns the scissor rectangle. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The scissor rectangle. - */ - getScissor(target: Vector4): Vector4; - /** - * Defines the scissor rectangle. - * - * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the box in logical pixel unit. - * Instead of passing four arguments, the method also works with a single four-dimensional vector. - * @param {number} y - The vertical coordinate for the upper left corner of the box in logical pixel unit. - * @param {number} width - The width of the scissor box in logical pixel unit. - * @param {number} height - The height of the scissor box in logical pixel unit. - */ - setScissor(x: number | Vector4, y: number, width: number, height: number): void; - /** - * Returns the scissor test value. - * - * @return {boolean} Whether the scissor test should be enabled or not. - */ - getScissorTest(): boolean; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Resets the backend's internal state cache. Useful when the rendering context is shared with - * other libraries that change the state. A no-op for the WebGPU backend. - */ - resetState(): void; - /** - * Returns the viewport definition. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The viewport definition. - */ - getViewport(target: Vector4): Vector4; - /** - * Defines the viewport. - * - * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the viewport origin in logical pixel unit. - * @param {number} y - The vertical coordinate for the upper left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. - * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. - */ - setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; - /** - * Returns the clear color. - * - * @param {Color} target - The method writes the result in this target object. - * @return {Color} The clear color. - */ - getClearColor(target: Color): Color; - /** - * Defines the clear color and optionally the clear alpha. - * - * @param {Color} color - The clear color. - * @param {number} [alpha=1] - The clear alpha. - */ - setClearColor(color: Color, alpha?: number): void; - /** - * Returns the clear alpha. - * - * @return {number} The clear alpha. - */ - getClearAlpha(): number; - /** - * Defines the clear alpha. - * - * @param {number} alpha - The clear alpha. - */ - setClearAlpha(alpha: number): void; - /** - * Returns the clear depth. - * - * @return {number} The clear depth. - */ - getClearDepth(): number; - /** - * Defines the clear depth. - * - * @param {number} depth - The clear depth. - */ - setClearDepth(depth: number): void; - /** - * Returns the clear stencil. - * - * @return {number} The clear stencil. - */ - getClearStencil(): number; - /** - * Defines the clear stencil. - * - * @param {number} stencil - The clear stencil. - */ - setClearStencil(stencil: number): void; - /** - * This method performs an occlusion query for the given 3D object. - * It returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. - * - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(object: Object3D): boolean; - /** - * Performs a manual clear operation. This method ignores `autoClear` properties. - * - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear(color?: boolean, depth?: boolean, stencil?: boolean): void; - /** - * Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties. - */ - clearColor(): void; - /** - * Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties. - */ - clearDepth(): void; - /** - * Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties. - */ - clearStencil(): void; - /** - * Async version of {@link Renderer#clear}. - * - * @async - * @deprecated - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise; - /** - * Async version of {@link Renderer#clearColor}. - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearColorAsync(): Promise; - /** - * Async version of {@link Renderer#clearDepth}. - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearDepthAsync(): Promise; - /** - * Async version of {@link Renderer#clearStencil}. - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearStencilAsync(): Promise; - /** - * Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion. - * If this is the case, the renderer allocates an internal render target for that purpose. - * - * @type {boolean} - */ - get needsFrameBufferTarget(): boolean; - /** - * The number of samples used for multi-sample anti-aliasing (MSAA). - * - * @type {number} - * @default 0 - */ - get samples(): number; - /** - * The current number of samples used for multi-sample anti-aliasing (MSAA). - * - * When rendering to a custom render target, the number of samples of that render target is used. - * The number of samples is set to 0 when the renderer needs an internal framebuffer target for - * tone mapping or color space conversion, or when rendering a fullscreen quad to screen. - * - * @type {number} - */ - get currentSamples(): number; - /** - * The current tone mapping of the renderer. When not producing screen output, - * the tone mapping is always `NoToneMapping`. - * - * @type {number} - */ - get currentToneMapping(): number; - /** - * The current color space of the renderer. When not producing screen output, - * the color space is always the working color space. - * - * @type {string} - */ - get currentColorSpace(): string; - /** - * Returns `true` if the rendering settings are set to screen output. - * - * @returns {boolean} True if the current render target is the same of output render target or `null`, otherwise false. - */ - get isOutputTarget(): boolean; - /** - * Frees all internal resources of the renderer. Call this method if the renderer - * is no longer in use by your app. - */ - dispose(): void; - /** - * Sets the given render target. Calling this method means the renderer does not - * target the default framebuffer (meaning the canvas) anymore but a custom framebuffer. - * Use `null` as the first argument to reset the state. - * - * @param {?RenderTarget} renderTarget - The render target to set. - * @param {number} [activeCubeFace=0] - The active cube face. - * @param {number} [activeMipmapLevel=0] - The active mipmap level. - */ - setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void; - /** - * Returns the current render target. - * - * @return {?RenderTarget} The render target. Returns `null` if no render target is set. - */ - getRenderTarget(): RenderTarget | null; - /** - * Sets the output render target for the renderer. - * - * @param {?RenderTarget} renderTarget - The render target to set as the output target. - */ - setOutputRenderTarget(renderTarget: RenderTarget | null): void; - /** - * Returns the current output target. - * - * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set. - */ - getOutputRenderTarget(): RenderTarget | null; - /** - * Sets the canvas target. The canvas target manages the HTML canvas - * or the offscreen canvas the renderer draws into. - * - * @param {CanvasTarget} canvasTarget - The canvas target. - */ - setCanvasTarget(canvasTarget: CanvasTarget): void; - /** - * Returns the current canvas target. - * - * @return {CanvasTarget} The current canvas target. - */ - getCanvasTarget(): CanvasTarget; - /** - * Resets the renderer to the initial state before WebXR started. - * - * @private - */ - private _resetXRState; - /** - * Callback for {@link Renderer#setRenderObjectFunction}. - * - * @callback renderObjectFunction - * @param {Object3D} object - The 3D object. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {BufferGeometry} geometry - The object's geometry. - * @param {Material} material - The object's material. - * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {LightsNode} lightsNode - The current lights node. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {?string} [passId=null] - An optional ID for identifying the pass. - */ - /** - * Sets the given render object function. Calling this method overwrites the default implementation - * which is {@link Renderer#renderObject}. Defining a custom function can be useful - * if you want to modify the way objects are rendered. For example you can define things like "every - * object that has material of a certain type should perform a pre-pass with a special overwrite material". - * The custom function must always call `renderObject()` in its implementation. - * - * Use `null` as the first argument to reset the state. - * - * @param {?renderObjectFunction} renderObjectFunction - The render object function. - */ - setRenderObjectFunction(renderObjectFunction: ((object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext: ClippingContext, passId?: string | null | undefined) => any) | null): void; - /** - * Returns the current render object function. - * - * @return {?Function} The current render object function. Returns `null` if no function is set. - */ - getRenderObjectFunction(): Function | null; - /** - * Execute a single or an array of compute nodes. This method can only be called - * if the renderer has been initialized. - * - * @param {Node|Array} computeNodes - The compute node(s). - * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] - * - A single number representing count, or - * - An array [x, y, z] representing dispatch size, or - * - A IndirectStorageBufferAttribute for indirect dispatch size. - * @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized. - */ - compute(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise | undefined; - /** - * Execute a single or an array of compute nodes. - * - * @async - * @param {Node|Array} computeNodes - The compute node(s). - * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] - * - A single number representing count, or - * - An array [x, y, z] representing dispatch size, or - * - A IndirectStorageBufferAttribute for indirect dispatch size. - * @return {Promise} A Promise that resolve when the compute has finished. - */ - computeAsync(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise; - /** - * Checks if the given feature is supported by the selected backend. - * - * @async - * @deprecated - * @param {string} name - The feature's name. - * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. - */ - hasFeatureAsync(name: string): Promise; - resolveTimestampsAsync(type?: string): Promise; - /** - * Checks if the given feature is supported by the selected backend. If the - * renderer has not been initialized, this method always returns `false`. - * - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(name: string): boolean; - /** - * Returns `true` when the renderer has been initialized. - * - * @return {boolean} Whether the renderer has been initialized or not. - */ - hasInitialized(): boolean; - /** - * Initializes the given textures. Useful for preloading a texture rather than waiting until first render - * (which can cause noticeable lags due to decode and GPU upload overhead). - * - * @async - * @deprecated - * @param {Texture} texture - The texture. - * @return {Promise} A Promise that resolves when the texture has been initialized. - */ - initTextureAsync(texture: Texture): Promise; - /** - * Initializes the given texture. Useful for preloading a texture rather than waiting until first render - * (which can cause noticeable lags due to decode and GPU upload overhead). - * - * This method can only be used if the renderer has been initialized. - * - * @param {Texture} texture - The texture. - */ - initTexture(texture: Texture): void; - /** - * Initializes the given render target. - * - * @param {RenderTarget} renderTarget - The render target to intialize. - */ - initRenderTarget(renderTarget: RenderTarget): void; - /** - * Copies the current bound framebuffer into the given texture. - * - * @param {FramebufferTexture} framebufferTexture - The texture. - * @param {?(Vector2|Vector4)} [rectangle=null] - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied. - */ - copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: (Vector2 | Vector4) | null): void; - /** - * Copies data of the given source texture into a destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. - * @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: Box2 | Box3, dstPosition?: Vector2 | Vector3, srcLevel?: number, dstLevel?: number): void; - /** - * Reads pixel data from the given render target. - * - * @async - * @param {RenderTarget} renderTarget - The render target to read from. - * @param {number} x - The `x` coordinate of the copy region's origin. - * @param {number} y - The `y` coordinate of the copy region's origin. - * @param {number} width - The width of the copy region. - * @param {number} height - The height of the copy region. - * @param {number} [textureIndex=0] - The texture index of a MRT render target. - * @param {number} [faceIndex=0] - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. - */ - readRenderTargetPixelsAsync(renderTarget: RenderTarget, x: number, y: number, width: number, height: number, textureIndex?: number, faceIndex?: number): Promise; - /** - * Analyzes the given 3D object's hierarchy and builds render lists from the - * processed hierarchy. - * - * @private - * @param {Object3D} object - The 3D object to process (usually a scene). - * @param {Camera} camera - The camera the object is rendered with. - * @param {number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups. - * @param {RenderList} renderList - The current render list. - * @param {ClippingContext} clippingContext - The current clipping context. - */ - private _projectObject; - /** - * Renders the given render bundles. - * - * @private - * @param {Array} bundles - Array with render bundle data. - * @param {Scene} sceneRef - The scene the render bundles belong to. - * @param {LightsNode} lightsNode - The current lights node. - */ - private _renderBundles; - /** - * Renders the transparent objects from the given render lists. - * - * @private - * @param {Array} renderList - The transparent render list. - * @param {Array} doublePassList - The list of transparent objects which require a double pass (e.g. because of transmission). - * @param {Camera} camera - The camera the render list should be rendered with. - * @param {Scene} scene - The scene the render list belongs to. - * @param {LightsNode} lightsNode - The current lights node. - */ - private _renderTransparents; - /** - * Renders the objects from the given render list. - * - * @private - * @param {Array} renderList - The render list. - * @param {Camera} camera - The camera the render list should be rendered with. - * @param {Scene} scene - The scene the render list belongs to. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?string} [passId=null] - An optional ID for identifying the pass. - */ - private _renderObjects; - /** - * Retrieves shadow nodes for the given material. This is used to setup shadow passes. - * The result is cached per material and updated when the material's version changes. - * - * @private - * @param {Material} material - * @returns {Object} - The shadow nodes for the material. - */ - private _getShadowNodes; - /** - * Updates the camera so it's prepared for rendering operations. - * - * @private - * @param {Camera} camera - The camera to update. - * @param {boolean} useXRCamera - Whether the XR camera should be used when presenting. - * @return {Camera} The returned camera might be different depending on whether XR is used or not. - */ - private _updateCamera; - /** - * This method represents the default render object function that manages the render lifecycle - * of the object. - * - * @param {Object3D} object - The 3D object. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {BufferGeometry} geometry - The object's geometry. - * @param {Material} material - The object's material. - * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?ClippingContext} clippingContext - The clipping context. - * @param {?string} [passId=null] - An optional ID for identifying the pass. - */ - renderObject(object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext?: ClippingContext | null, passId?: string | null): void; - /** - * Checks if the given compatibility is supported by the selected backend. - * - * @param {string} name - The compatibility's name. - * @return {boolean} Whether the compatibility is supported or not. - */ - hasCompatibility(name: string): boolean; - /** - * This method represents the default `_handleObjectFunction` implementation which creates - * a render object from the given data and performs the draw command with the selected backend. - * - * @private - * @param {Object3D} object - The 3D object. - * @param {Material} material - The object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {string} [passId] - An optional ID for identifying the pass. - */ - private _renderObjectDirect; - /** - * A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering. - * Used in `compileAsync()`. - * - * @private - * @param {Object3D} object - The 3D object. - * @param {Material} material - The object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {string} [passId] - An optional ID for identifying the pass. - */ - private _createObjectPipeline; - /** - * Alias for `compileAsync()`. - * - * @method - * @param {Object3D} scene - The scene or 3D object to precompile. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. - * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. - * @return {function(Object3D, Camera, ?Scene, ?onProgressCallback): Promise|undefined} A Promise that resolves when the compile has been finished. - */ - get compile(): (arg0: Object3D, arg1: Camera, arg2: Scene | null, arg3: onProgressCallback | null) => Promise | undefined; -} -/** - * This node is a special type of reference node which is intended - * for linking renderer properties with node values. - * ```js - * const exposureNode = rendererReference( 'toneMappingExposure', 'float', renderer ); - * ``` - * When changing `renderer.toneMappingExposure`, the node value of `exposureNode` will - * automatically be updated. - * - * @augments ReferenceBaseNode - */ -export class RendererReferenceNode extends ReferenceBaseNode { - /** - * Constructs a new renderer reference node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} inputType - The uniform type that should be used to represent the property value. - * @param {?Renderer} [renderer=null] - The renderer the property belongs to. When no renderer is set, - * the node refers to the renderer of the current state. - */ - constructor(property: string, inputType: string, renderer?: Renderer | null); - /** - * The renderer the property belongs to. When no renderer is set, - * the node refers to the renderer of the current state. - * - * @type {?Renderer} - * @default null - */ - renderer: Renderer | null; -} -export var RendererUtils: Readonly<{ - __proto__: null; - resetRendererAndSceneState: typeof resetRendererAndSceneState; - resetRendererState: typeof resetRendererState; - resetSceneState: typeof resetSceneState; - restoreRendererAndSceneState: typeof restoreRendererAndSceneState; - restoreRendererState: typeof restoreRendererState; - restoreSceneState: typeof restoreSceneState; - saveRendererAndSceneState: typeof saveRendererAndSceneState; - saveRendererState: typeof saveRendererState; - saveSceneState: typeof saveSceneState; -}>; -import { RepeatWrapping } from './three.core.js'; -import { ReplaceStencilOp } from './three.core.js'; -import { ReverseSubtractEquation } from './three.core.js'; -/** - * Applies a rotation to the given position node. - * - * @augments TempNode - */ -export class RotateNode extends TempNode { - /** - * Constructs a new rotate node. - * - * @param {Node} positionNode - The position node. - * @param {Node} rotationNode - Represents the rotation that is applied to the position node. Depending - * on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. - */ - constructor(positionNode: Node, rotationNode: Node); - /** - * The position node. - * - * @type {Node} - */ - positionNode: Node; - /** - * Represents the rotation that is applied to the position node. - * Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. - * - * @type {Node} - */ - rotationNode: Node; - /** - * The type of the {@link RotateNode#positionNode} defines the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node's type. - */ - generateNodeType(builder: NodeBuilder): string; - setup(builder: any): any; -} -import { SIGNED_R11_EAC_Format } from './three.core.js'; -import { SIGNED_RED_GREEN_RGTC2_Format } from './three.core.js'; -import { SIGNED_RED_RGTC1_Format } from './three.core.js'; -import { SIGNED_RG11_EAC_Format } from './three.core.js'; -import { SRGBColorSpace } from './three.core.js'; -import { SRGBTransfer } from './three.core.js'; -/** - * Class representing a node that samples a value using a provided callback function. - * - * @extends Node - */ -export class SampleNode extends Node { - /** - * Creates an instance of SampleNode. - * - * @param {Function} callback - The function to be called when sampling. Should accept a UV node and return a value. - * @param {?Node} [uvNode=null] - The UV node to be used in the texture sampling. - */ - constructor(callback: Function, uvNode?: Node | null); - callback: Function; - /** - * Represents the texture coordinates. - * - * @type {?Node} - * @default null - */ - uvNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampleNode: boolean; - /** - * Sets up the node by sampling with the default UV accessor. - * - * @returns {Node} The result of the callback function when called with the UV node. - */ - setup(): Node; - /** - * Calls the callback function with the provided UV node. - * - * @param {Node} uv - The UV node or value to be passed to the callback. - * @returns {Node} The result of the callback function. - */ - sample(uv: Node): Node; -} -import { Scene } from './three.core.js'; -/** - * This node provides a collection of screen related metrics. - * Depending on {@link ScreenNode#scope}, the nodes can represent - * resolution or viewport data as well as fragment or uv coordinates. - * - * @augments Node - */ -export class ScreenNode extends Node { - /** - * Constructs a new screen node. - * - * @param {('coordinate'|'viewport'|'size'|'uv')} scope - The node's scope. - */ - constructor(scope: ("coordinate" | "viewport" | "size" | "uv")); - /** - * The node represents different metric depending on which scope is selected. - * - * - `ScreenNode.COORDINATE`: Window-relative coordinates of the current fragment according to WebGPU standards. - * - `ScreenNode.VIEWPORT`: The current viewport defined as a four-dimensional vector. - * - `ScreenNode.SIZE`: The dimensions of the current bound framebuffer. - * - `ScreenNode.UV`: Normalized coordinates. - * - * @type {('coordinate'|'viewport'|'size'|'uv')} - */ - scope: ("coordinate" | "viewport" | "size" | "uv"); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isViewportNode: boolean; - /** - * This method is overwritten since the node type depends on the selected scope. - * - * @return {('vec2'|'vec4')} The node type. - */ - generateNodeType(): ("vec2" | "vec4"); - /** - * `ScreenNode` implements {@link Node#update} to retrieve viewport and size information - * from the current renderer. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update({ renderer }: NodeFrame): void; - setup(): any; - generate(builder: any): any; -} -export namespace ScreenNode { - let COORDINATE: string; - let VIEWPORT: string; - let SIZE: string; - let UV: string; -} -/** - * This module is part of the TSL core and usually not used in app level code. - * `SetNode` represents a set operation which means it is used to implement any - * `setXYZW()`, `setRGBA()` and `setSTPQ()` method invocations on node objects. - * For example: - * ```js - * materialLine.colorNode = color( 0, 0, 0 ).setR( float( 1 ) ); - * ``` - * - * @augments TempNode - */ -export class SetNode extends TempNode { - /** - * Constructs a new set node. - * - * @param {Node} sourceNode - The node that should be updated. - * @param {string} components - The components that should be updated. - * @param {Node} targetNode - The value node. - */ - constructor(sourceNode: Node, components: string, targetNode: Node); - /** - * The node that should be updated. - * - * @type {Node} - */ - sourceNode: Node; - /** - * The components that should be updated. - * - * @type {string} - */ - components: string; - /** - * The value node. - * - * @type {Node} - */ - targetNode: Node; - /** - * This method is overwritten since the node type is inferred from {@link SetNode#sourceNode}. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any): string; -} -/** - * Base class for all shadow nodes. - * - * Shadow nodes encapsulate shadow related logic and are always coupled to lighting nodes. - * Lighting nodes might share the same shadow node type or use specific ones depending on - * their requirements. - * - * @augments Node - */ -export class ShadowBaseNode extends Node { - /** - * Constructs a new shadow base node. - * - * @param {Light} light - The shadow casting light. - */ - constructor(light: Light); - /** - * The shadow casting light. - * - * @type {Light} - */ - light: Light; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowBaseNode: boolean; - /** - * Retrieves or creates a shadow material for the shadow casting light source. - * - * This method checks if a shadow material already exists for the provided light in the internal library. - * If not, it creates a new `NodeMaterial` configured for shadow rendering and stores it for future use. - * - * @return {NodeMaterial} The shadow material associated with the given light. - */ - getShadowMaterial(): NodeMaterial; - /** - * Disposes the shadow material for the shadow casting light source. - */ - disposeShadowMaterial(): void; - /** - * Returns a function to render shadow objects in a scene for the given light shadow and renderer. - * - * @param {Renderer} renderer - The renderer. - * @param {LightShadow} [shadow=this.light.shadow] - The light shadow object containing shadow properties. - * @return {Function} A function that renders shadow objects. - */ - getShadowRenderObjectFunction(renderer: Renderer, shadow?: LightShadow): Function; - /** - * Setups the shadow position node which is by default the predefined TSL node object `shadowPositionWorld`. - * - * @param {NodeBuilder} object - A configuration object that must at least hold a material reference. - */ - setupShadowPosition({ context, material }: NodeBuilder): void; -} -import { ShadowMaterial } from './three.core.js'; -/** - * Represents the default shadow implementation for lighting nodes. - * - * @augments ShadowBaseNode - */ -export class ShadowNode extends ShadowBaseNode { - /** - * Constructs a new shadow node. - * - * @param {Light} light - The shadow casting light. - * @param {?LightShadow} [shadow=null] - An optional light shadow. - */ - constructor(light: Light, shadow?: LightShadow | null); - /** - * The light shadow which defines the properties light's - * shadow. - * - * @type {?LightShadow} - * @default null - */ - shadow: LightShadow | null; - /** - * A reference to the shadow map which is a render target. - * - * @type {?RenderTarget} - * @default null - */ - shadowMap: RenderTarget | null; - /** - * Only relevant for VSM shadows. Render target for the - * first VSM render pass. - * - * @type {?RenderTarget} - * @default null - */ - vsmShadowMapVertical: RenderTarget | null; - /** - * Only relevant for VSM shadows. Render target for the - * second VSM render pass. - * - * @type {?RenderTarget} - * @default null - */ - vsmShadowMapHorizontal: RenderTarget | null; - /** - * Only relevant for VSM shadows. Node material which - * is used to render the first VSM pass. - * - * @type {?NodeMaterial} - * @default null - */ - vsmMaterialVertical: NodeMaterial | null; - /** - * Only relevant for VSM shadows. Node material which - * is used to render the second VSM pass. - * - * @type {?NodeMaterial} - * @default null - */ - vsmMaterialHorizontal: NodeMaterial | null; - /** - * A reference to the output node which defines the - * final result of this shadow node. - * - * @type {?Node} - * @private - * @default null - */ - private _node; - /** - * The current shadow map type of this shadow node. - * - * @type {?number} - * @private - * @default null - */ - private _currentShadowType; - /** - * A Weak Map holding the current frame ID per camera. Used - * to control the update of shadow maps. - * - * @type {WeakMap} - * @private - */ - private _cameraFrameId; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowNode: boolean; - /** - * This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer. - * - * @type {number} - * @readonly - * @default true - */ - readonly depthLayer: number; - /** - * Setups the shadow filtering. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @param {Object} inputs - A configuration object that defines the shadow filtering. - * @param {Function} inputs.filterFn - This function defines the filtering type of the shadow map e.g. PCF. - * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. - * @param {Node} inputs.shadowCoord - Shadow coordinates which are used to sample from the shadow map. - * @param {LightShadow} inputs.shadow - The light shadow. - * @return {Node} The result node of the shadow filtering. - */ - setupShadowFilter(builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow, depthLayer }: { - filterFn: Function; - depthTexture: DepthTexture; - shadowCoord: Node; - shadow: LightShadow; - }): Node; - /** - * Setups the shadow coordinates. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @param {Node} shadowPosition - A node representing the shadow position. - * @return {Node} The shadow coordinates. - */ - setupShadowCoord(builder: NodeBuilder, shadowPosition: Node): Node; - /** - * Returns the shadow filtering function for the given shadow type. - * - * @param {number} type - The shadow type. - * @return {Function} The filtering function. - */ - getShadowFilterFn(type: number): Function; - setupRenderTarget(shadow: any, builder: any): { - shadowMap: any; - depthTexture: DepthTexture; - }; - /** - * Setups the shadow output node. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Node} The shadow output node. - */ - setupShadow(builder: NodeBuilder): Node; - /** - * The implementation performs the setup of the output node. An output is only - * produces if shadow mapping is globally enabled in the renderer. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {ShaderCallNodeInternal} The output node. - */ - setup(builder: NodeBuilder): ShaderCallNodeInternal; - /** - * Renders the shadow. The logic of this function could be included - * into {@link ShadowNode#updateShadow} however more specialized shadow - * nodes might require a custom shadow map rendering. By having a - * dedicated method, it's easier to overwrite the default behavior. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - renderShadow(frame: NodeFrame): void; - /** - * Updates the shadow. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateShadow(frame: NodeFrame): void; - _depthVersionCached: number | undefined; - /** - * For VSM additional render passes are required. - * - * @param {Renderer} renderer - A reference to the current renderer. - */ - vsmPass(renderer: Renderer): void; - /** - * Resets the resouce state of this shadow node. - * - * @private - */ - private _reset; - /** - * The implementation performs the update of the shadow map if necessary. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateBefore(frame: NodeFrame): void; -} -/** - * Node material version of {@link ShadowMaterial}. - * - * @augments NodeMaterial - */ -export class ShadowNodeMaterial extends NodeMaterial { - /** - * Constructs a new shadow node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowNodeMaterial: boolean; - /** - * Setups the lighting model. - * - * @return {ShadowMaskModel} The lighting model. - */ - setupLightingModel(): ShadowMaskModel; -} -import { ShortType } from './three.core.js'; -import { Sphere } from './three.core.js'; -import { SphereGeometry } from './three.core.js'; -/** - * This module is part of the TSL core and usually not used in app level code. - * `SplitNode` represents a property access operation which means it is - * used to implement any `.xyzw`, `.rgba` and `stpq` usage on node objects. - * For example: - * ```js - * const redValue = color.r; - * ``` - * - * @augments Node - */ -export class SplitNode extends Node { - /** - * Constructs a new split node. - * - * @param {Node} node - The node that should be accessed. - * @param {string} [components='x'] - The components that should be accessed. - */ - constructor(node: Node, components?: string); - /** - * The node that should be accessed. - * - * @type {Node} - */ - node: Node; - /** - * The components that should be accessed. - * - * @type {string} - */ - components: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSplitNode: boolean; - /** - * Returns the vector length which is computed based on the requested components. - * - * @return {number} The vector length. - */ - getVectorLength(): number; - /** - * Returns the component type of the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The component type. - */ - getComponentType(builder: NodeBuilder): string; - /** - * This method is overwritten since the node type is inferred from requested components. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import { SpotLight } from './three.core.js'; -/** - * Module for representing spot lights as nodes. - * - * @augments AnalyticLightNode - */ -export class SpotLightNode extends AnalyticLightNode { - /** - * Constructs a new spot light node. - * - * @param {?SpotLight} [light=null] - The spot light source. - */ - constructor(light?: SpotLight | null); - /** - * Uniform node representing the cone cosine. - * - * @type {UniformNode} - */ - coneCosNode: UniformNode; - /** - * Uniform node representing the penumbra cosine. - * - * @type {UniformNode} - */ - penumbraCosNode: UniformNode; - /** - * Uniform node representing the cutoff distance. - * - * @type {UniformNode} - */ - cutoffDistanceNode: UniformNode; - /** - * Uniform node representing the decay exponent. - * - * @type {UniformNode} - */ - decayExponentNode: UniformNode; - /** - * Overwritten to updated spot light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - /** - * Computes the spot attenuation for the given angle. - * - * @param {NodeBuilder} builder - The node builder. - * @param {Node} angleCosine - The angle to compute the spot attenuation for. - * @return {Node} The spot attenuation. - */ - getSpotAttenuation(builder: NodeBuilder, angleCosine: Node): Node; - getLightCoord(builder: any): any; - setupDirect(builder: any): { - lightColor: any; - lightDirection: any; - }; -} -import { SpriteMaterial } from './three.core.js'; -/** - * Node material version of {@link SpriteMaterial}. - * - * @augments NodeMaterial - */ -export class SpriteNodeMaterial extends NodeMaterial { - /** - * Constructs a new sprite node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSpriteNodeMaterial: boolean; - _useSizeAttenuation: boolean; - /** - * The rotation of sprite materials is by default inferred from the `rotation`, - * property. This node property allows to overwrite the default and define - * the rotation with a node instead. - * - * If you don't want to overwrite the rotation but modify the existing - * value instead, use {@link materialRotation}. - * - * @type {?Node} - * @default null - */ - rotationNode: Node | null; - /** - * This node property provides an additional way to scale sprites next to - * `Object3D.scale`. The scale transformation based in `Object3D.scale` - * is multiplied with the scale value of this node in the vertex shader. - * - * @type {?Node} - * @default null - */ - scaleNode: Node | null; - /** - * Setups the position node in view space. This method implements - * the sprite specific vertex shader. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in view space. - */ - setupPositionView(builder: NodeBuilder): Node; - set sizeAttenuation(value: boolean); - /** - * Whether to use size attenuation or not. - * - * @type {boolean} - * @default true - */ - get sizeAttenuation(): boolean; -} -import { SrcAlphaFactor } from './three.core.js'; -import { SrcAlphaSaturateFactor } from './three.core.js'; -import { SrcColorFactor } from './three.core.js'; -/** - * Stack is a helper for Nodes that need to produce stack-based code instead of continuous flow. - * They are usually needed in cases like `If`, `Else`. - * - * @augments Node - */ -export class StackNode extends Node { - /** - * Constructs a new stack node. - * - * @param {?StackNode} [parent=null] - The parent stack node. - */ - constructor(parent?: StackNode | null); - /** - * List of nodes. - * - * @type {Array} - */ - nodes: Array; - /** - * The output node. - * - * @type {?Node} - * @default null - */ - outputNode: Node | null; - /** - * The parent stack node. - * - * @type {?StackNode} - * @default null - */ - parent: StackNode | null; - /** - * The current conditional node. - * - * @private - * @type {ConditionalNode} - * @default null - */ - private _currentCond; - /** - * The expression node. Only - * relevant for Switch/Case. - * - * @private - * @type {Node} - * @default null - */ - private _expressionNode; - /** - * The current node being processed. - * - * @private - * @type {Node} - * @default null - */ - private _currentNode; - /** - * Stores additional data for nodes that are added to the stack. - * - * @private - * @type {Map} - */ - private _nodeDataLibrary; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStackNode: boolean; - getElementType(builder: any): string; - generateNodeType(builder: any): string; - getMemberType(builder: any, name: any): string; - /** - * Adds a node to this stack. - * - * @param {Node} node - The node to add. - * @param {number} [index=-1] - The index of the node. If not specified, the node will be added to the end of the stack. - * @return {StackNode} A reference to this stack node. - */ - addToStack(node: Node, index?: number): StackNode; - /** - * Adds a node to the stack before the current node. - * - * @param {Node} node - The node to add. - * @return {StackNode} A reference to this stack node. - */ - addToStackBefore(node: Node): StackNode; - /** - * Represent an `if` statement in TSL. - * - * @param {Node} boolNode - Represents the condition. - * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. - * @return {StackNode} A reference to this stack node. - */ - If(boolNode: Node, method: Function): StackNode; - /** - * Represent an `elseif` statement in TSL. - * - * @param {Node} boolNode - Represents the condition. - * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. - * @return {StackNode} A reference to this stack node. - */ - ElseIf(boolNode: Node, method: Function): StackNode; - /** - * Represent an `else` statement in TSL. - * - * @param {Function} method - TSL code which is executed in the `else` case. - * @return {StackNode} A reference to this stack node. - */ - Else(method: Function): StackNode; - /** - * Represents a `switch` statement in TSL. - * - * @param {any} expression - Represents the expression. - * @return {StackNode} A reference to this stack node. - */ - Switch(expression: any): StackNode; - /** - * Represents a `case` statement in TSL. The TSL version accepts an arbitrary numbers of values. - * The last parameter must be the callback method that should be executed in the `true` case. - * - * @param {...any} params - The values of the `Case()` statement as well as the callback method. - * @return {StackNode} A reference to this stack node. - */ - Case(...params: any[]): StackNode; - /** - * Represents the default code block of a Switch/Case statement. - * - * @param {Function} method - TSL code which is executed in the `else` case. - * @return {StackNode} A reference to this stack node. - */ - Default(method: Function): StackNode; - setup(builder: any): any; - build(builder: any, ...params: any[]): string | Node | null | undefined; -} -/** - * Class representing a stack trace for debugging purposes. - */ -export class StackTrace { - /** - * Creates a StackTrace instance by capturing and filtering the current stack trace. - * - * @param {Error|string|null} stackMessage - An optional stack trace to use instead of capturing a new one. - */ - constructor(stackMessage?: Error | string | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStackTrace: boolean; - /** - * The stack trace. - * - * @type {Array<{fn: string, file: string, line: number, column: number}>} - */ - stack: Array<{ - fn: string; - file: string; - line: number; - column: number; - }>; - /** - * Returns a formatted location string of the top stack frame. - * - * @returns {string} The formatted stack trace message. - */ - getLocation(): string; - /** - * Returns the full error message including the stack trace. - * - * @param {string} message - The error message. - * @returns {string} The full error message with stack trace. - */ - getError(message: string): string; -} -/** - * This version of a node library represents the standard version - * used in {@link WebGPURenderer}. It maps lights, tone mapping - * techniques and materials to node-based implementations. - * - * @augments NodeLibrary - */ -export class StandardNodeLibrary extends NodeLibrary { -} -import { StaticDrawUsage } from './three.core.js'; -/** - * This special type of texture is intended for compute shaders. - * It can be used to compute the data of a texture with a compute shader. - * - * Note: This type of texture can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments Texture - */ -export class Storage3DTexture extends Texture { - /** - * Constructs a new storage texture. - * - * @param {number} [width=1] - The storage texture's width. - * @param {number} [height=1] - The storage texture's height. - * @param {number} [depth=1] - The storage texture's depth. - */ - constructor(width?: number, height?: number, depth?: number); - isArrayTexture: boolean; - /** - * This defines how the texture is wrapped in the depth direction and corresponds to - * *W* in UVW mapping. - * - * @type {number} - */ - wrapR: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture: boolean; - /** - * Indicates whether this texture is a 3D texture. - * - * @type {boolean} - * - */ - is3DTexture: boolean; - /** - * Copies the values of the given texture to this instance. - * - * @param {Storage3DTexture} source - The texture to copy. - * @return {Storage3DTexture} A reference to this instance. - */ - copy(source: Storage3DTexture): Storage3DTexture; - /** - * Sets the size of the storage 3d texture. - * - * @param {number} width - The new width of the storage texture. - * @param {number} height - The new height of the storage texture. - * @param {number} depth - The new depth of the storage texture. - */ - setSize(width: number, height: number, depth: number): void; -} -/** - * This class enables element access on instances of {@link StorageBufferNode}. - * In most cases, it is indirectly used when accessing elements with the - * {@link StorageBufferNode#element} method. - * - * ```js - * const position = positionStorage.element( instanceIndex ); - * ``` - * - * @augments ArrayElementNode - */ -export class StorageArrayElementNode extends ArrayElementNode { - /** - * Constructs storage buffer element node. - * - * @param {StorageBufferNode} storageBufferNode - The storage buffer node. - * @param {Node} indexNode - The index node that defines the element access. - */ - constructor(storageBufferNode: StorageBufferNode, indexNode: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageArrayElementNode: boolean; - /** - * The storage buffer node. - * - * @param {Node} value - * @type {StorageBufferNode} - */ - set storageBufferNode(value: Node); - get storageBufferNode(): Node; - getMemberType(builder: any, name: any): any; - setup(builder: any): Node | null; - generate(builder: any, output: any): any; -} -/** - * This special type of texture is intended for compute shaders. - * It can be used to compute the data of a texture with a compute shader. - * - * Note: This type of texture can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments Texture - */ -export class StorageArrayTexture extends Texture { - /** - * Constructs a new storage texture. - * - * @param {number} [width=1] - The storage texture's width. - * @param {number} [height=1] - The storage texture's height. - * @param {number} [depth=1] - The storage texture's depth. - */ - constructor(width?: number, height?: number, depth?: number); - isArrayTexture: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture: boolean; - /** - * Sets the size of the storage array texture. - * - * @param {number} width - The new width of the storage texture. - * @param {number} height - The new height of the storage texture. - * @param {number} depth - The new depth of the storage texture. - */ - setSize(width: number, height: number, depth: number): void; -} -/** - * This special type of buffer attribute is intended for compute shaders. - * In earlier three.js versions it was only possible to update attribute data - * on the CPU via JavaScript and then upload the data to the GPU. With the - * new material system and renderer it is now possible to use compute shaders - * to compute the data for an attribute more efficiently on the GPU. - * - * The idea is to create an instance of this class and provide it as an input - * to {@link StorageBufferNode}. - * - * Note: This type of buffer attribute can only be used with `WebGPURenderer`. - * - * @augments BufferAttribute - */ -export class StorageBufferAttribute extends BufferAttribute { - /** - * Constructs a new storage buffer attribute. - * - * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. - * The subsequent parameters are then obsolete. - * @param {number} itemSize - The item size. - * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. - */ - constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageBufferAttribute: boolean; -} -/** - * This node is used in context of compute shaders and allows to define a - * storage buffer for data. A typical workflow is to create instances of - * this node with the convenience functions `attributeArray()` or `instancedArray()`, - * setup up a compute shader that writes into the buffers and then convert - * the storage buffers to attribute nodes for rendering. - * - * ```js - * const positionBuffer = instancedArray( particleCount, 'vec3' ); // the storage buffer node - * - * const computeInit = Fn( () => { // the compute shader - * - * const position = positionBuffer.element( instanceIndex ); - * - * // compute position data - * - * position.x = 1; - * position.y = 1; - * position.z = 1; - * - * } )().compute( particleCount ); - * - * const particleMaterial = new THREE.SpriteNodeMaterial(); - * particleMaterial.positionNode = positionBuffer.toAttribute(); - * - * renderer.computeAsync( computeInit ); - * - * ``` - * - * @augments BufferNode - */ -export class StorageBufferNode extends BufferNode { - /** - * Constructs a new storage buffer node. - * - * @param {StorageBufferAttribute|StorageInstancedBufferAttribute|BufferAttribute} value - The buffer data. - * @param {?(string|Struct)} [bufferType=null] - The buffer type (e.g. `'vec3'`). - * @param {number} [bufferCount=0] - The buffer count. - */ - constructor(value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, bufferType?: (string | Struct) | null, bufferCount?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageBufferNode: boolean; - /** - * The buffer struct type. - * - * @type {?StructTypeNode} - * @default null - */ - structTypeNode: StructTypeNode | null; - /** - * The access type of the texture node. - * - * @type {string} - * @default 'readWrite' - */ - access: string; - /** - * Whether the node is atomic or not. - * - * @type {boolean} - * @default false - */ - isAtomic: boolean; - /** - * Whether the node represents a PBO or not. - * Only relevant for WebGL. - * - * @type {boolean} - * @default false - */ - isPBO: boolean; - /** - * A reference to the internal buffer attribute node. - * - * @private - * @type {?BufferAttributeNode} - * @default null - */ - private _attribute; - /** - * A reference to the internal varying node. - * - * @private - * @type {?VaryingNode} - * @default null - */ - private _varying; - /** - * This method is overwritten since the buffer data might be shared - * and thus the hash should be shared as well. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(builder: NodeBuilder): string; - /** - * Enables element access with the given index node. - * - * @param {IndexNode} indexNode - The index node. - * @return {StorageArrayElementNode} A node representing the element access. - */ - element(indexNode: IndexNode): StorageArrayElementNode; - /** - * Defines whether this node is a PBO or not. Only relevant for WebGL. - * - * @param {boolean} value - The value so set. - * @return {StorageBufferNode} A reference to this node. - */ - setPBO(value: boolean): StorageBufferNode; - /** - * Returns the `isPBO` value. - * - * @return {boolean} Whether the node represents a PBO or not. - */ - getPBO(): boolean; - /** - * Defines the node access. - * - * @param {string} value - The node access. - * @return {StorageBufferNode} A reference to this node. - */ - setAccess(value: string): StorageBufferNode; - /** - * Convenience method for configuring a read-only node access. - * - * @return {StorageBufferNode} A reference to this node. - */ - toReadOnly(): StorageBufferNode; - /** - * Defines whether the node is atomic or not. - * - * @param {boolean} value - The atomic flag. - * @return {StorageBufferNode} A reference to this node. - */ - setAtomic(value: boolean): StorageBufferNode; - /** - * Convenience method for making this node atomic. - * - * @return {StorageBufferNode} A reference to this node. - */ - toAtomic(): StorageBufferNode; - /** - * Returns attribute data for this storage buffer node. - * - * @return {{attribute: BufferAttributeNode, varying: VaryingNode}} The attribute data. - */ - getAttributeData(): { - attribute: BufferAttributeNode; - varying: VaryingNode; - }; - /** - * This method is overwritten since the node type from the availability of storage buffers - * and the attribute data. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the type of a member of the struct. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member. - * @return {string} The type of the member. - */ - getMemberType(builder: NodeBuilder, name: string): string; - /** - * Generates the code snippet of the storage buffer node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder): string; -} -/** - * This special type of instanced buffer attribute is intended for compute shaders. - * In earlier three.js versions it was only possible to update attribute data - * on the CPU via JavaScript and then upload the data to the GPU. With the - * new material system and renderer it is now possible to use compute shaders - * to compute the data for an attribute more efficiently on the GPU. - * - * The idea is to create an instance of this class and provide it as an input - * to {@link StorageBufferNode}. - * - * Note: This type of buffer attribute can only be used with `WebGPURenderer`. - * - * @augments InstancedBufferAttribute - */ -export class StorageInstancedBufferAttribute extends InstancedBufferAttribute { - /** - * Constructs a new storage instanced buffer attribute. - * - * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. - * The subsequent parameters are then obsolete. - * @param {number} itemSize - The item size. - * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. - */ - constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageInstancedBufferAttribute: boolean; -} -/** - * This special type of texture is intended for compute shaders. - * It can be used to compute the data of a texture with a compute shader. - * - * Note: This type of texture can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments Texture - */ -export class StorageTexture extends Texture { - /** - * Constructs a new storage texture. - * - * @param {number} [width=1] - The storage texture's width. - * @param {number} [height=1] - The storage texture's height. - */ - constructor(width?: number, height?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture: boolean; - /** - * When `true`, mipmaps will be auto-generated after compute writes. - * When `false`, mipmaps must be written manually via compute shaders. - * - * @type {boolean} - * @default true - */ - mipmapsAutoUpdate: boolean; - /** - * Sets the size of the storage texture. - * - * @param {number} width - The new width of the storage texture. - * @param {number} height - The new height of the storage texture. - */ - setSize(width: number, height: number): void; -} -/** - * This special version of a texture node can be used to - * write data into a 3D storage texture with a compute shader. - * - * @augments StorageTextureNode - */ -export class StorageTexture3DNode extends StorageTextureNode { - /** - * Constructs a new 3D storage texture node. - * - * @param {Storage3DTexture} value - The 3D storage texture. - * @param {Node} uvNode - The uv node. - * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. - */ - constructor(value: Storage3DTexture, uvNode: Node, storeNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture3DNode: boolean; - /** - * Overwritten with an empty implementation since the `updateMatrix` flag is ignored - * for 3D textures. The uv transformation matrix is not applied to 3D textures. - * - * @param {boolean} value - The update toggle. - */ - setUpdateMatrix(): void; -} -/** - * This special version of a texture node can be used to - * write data into a storage texture with a compute shader. - * - * ```js - * const storageTexture = new THREE.StorageTexture( width, height ); - * - * const computeTexture = Fn( ( { storageTexture } ) => { - * - * const posX = instanceIndex.mod( width ); - * const posY = instanceIndex.div( width ); - * const indexUV = uvec2( posX, posY ); - * - * // generate RGB values - * - * const r = 1; - * const g = 1; - * const b = 1; - * - * textureStore( storageTexture, indexUV, vec4( r, g, b, 1 ) ).toWriteOnly(); - * - * } ); - * - * const computeNode = computeTexture( { storageTexture } ).compute( width * height ); - * renderer.computeAsync( computeNode ); - * ``` - * - * This node can only be used with a WebGPU backend. - * - * @augments TextureNode - */ -export class StorageTextureNode extends TextureNode { - /** - * Constructs a new storage texture node. - * - * @param {StorageTexture} value - The storage texture. - * @param {Node} uvNode - The uv node. - * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. - */ - constructor(value: StorageTexture, uvNode: Node, storeNode?: Node | null); - /** - * The value node that should be stored in the texture. - * - * @type {?Node} - * @default null - */ - storeNode: Node | null; - /** - * The mip level to write to for storage textures. - * - * @type {number} - * @default 0 - */ - mipLevel: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTextureNode: boolean; - /** - * The access type of the texture node. - * - * @type {string} - * @default 'writeOnly' - */ - access: string; - setup(builder: any): any; - /** - * Defines the node access. - * - * @param {string} value - The node access. - * @return {StorageTextureNode} A reference to this node. - */ - setAccess(value: string): StorageTextureNode; - /** - * Sets the mip level to write to. - * - * @param {number} level - The mip level. - * @return {StorageTextureNode} A reference to this node. - */ - setMipLevel(level: number): StorageTextureNode; - /** - * Generates the snippet for the storage texture. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} textureProperty - The texture property. - * @param {string} uvSnippet - The uv snippet. - * @param {?string} levelSnippet - The level snippet. - * @param {?string} biasSnippet - The bias snippet. - * @param {?string} depthSnippet - The depth snippet. - * @param {?string} compareSnippet - The compare snippet. - * @param {?Array} gradSnippet - The grad snippet. - * @param {?string} offsetSnippet - The offset snippet. - * @return {string} The generated code snippet. - */ - generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, offsetSnippet: string | null): string; - /** - * Convenience method for configuring a read/write node access. - * - * @return {StorageTextureNode} A reference to this node. - */ - toReadWrite(): StorageTextureNode; - /** - * Convenience method for configuring a read-only node access. - * - * @return {StorageTextureNode} A reference to this node. - */ - toReadOnly(): StorageTextureNode; - /** - * Convenience method for configuring a write-only node access. - * - * @return {StorageTextureNode} A reference to this node. - */ - toWriteOnly(): StorageTextureNode; - /** - * Stores a value in this storage texture at the given coordinates. - * - * @param {Node} uvNode - The storage texture coordinates. - * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. - * @return {StorageTextureNode} A storage texture node representing the store operation. - */ - store(uvNode: Node, storeNode?: Node | null): StorageTextureNode; - /** - * Generates the code snippet of the storage texture node. - * - * @param {NodeBuilder} builder - The current node builder. - */ - generateStore(builder: NodeBuilder): void; -} -/** - * StructNode allows to create custom structures with multiple members. - * This can also be used to define structures in attribute and uniform data. - * - * ```js - * // Define a custom struct - * const BoundingBox = struct( { min: 'vec3', max: 'vec3' } ); - * - * // Create a new instance of the struct - * const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1 - * const bb = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2 - * - * // Access the struct members - * const min = bb.get( 'min' ); - * - * // Assign a new value to a member - * min.assign( vec3() ); - * ``` - * @augments Node - */ -export class StructNode extends Node { - constructor(structTypeNode: any, values: any); - structTypeNode: any; - values: any; - isStructNode: boolean; - generateNodeType(builder: any): any; - getMemberType(builder: any, name: any): any; - _getChildren(): Object[]; - generate(builder: any): any; -} -/** - * Represents a struct type node in the node-based system. - * This class is used to define and manage the layout and types of struct members. - * It extends the base Node class and provides methods to get the length of the struct, - * retrieve member types, and generate the struct type for a builder. - * - * @augments Node - */ -export class StructTypeNode extends Node { - /** - * Creates an instance of StructTypeNode. - * - * @param {Object} membersLayout - The layout of the members for the struct. - * @param {?string} [name=null] - The optional name of the struct. - */ - constructor(membersLayout: Object, name?: string | null); - /** - * The layout of the members for the struct - * - * @type {Array.<{name: string, type: string, atomic: boolean}>} - */ - membersLayout: Array<{ - name: string; - type: string; - atomic: boolean; - }>; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStructTypeNode: boolean; - /** - * Returns the length of the struct in 4-byte elements (e.g. float or int components). - * The length is calculated by summing the lengths of the struct's members, accounting for memory alignment. - * To get the size in bytes, multiply the returned value by 4. - * - * @returns {number} The length of the struct in 4-byte elements. - */ - getLength(): number; - getMemberType(builder: any, name: any): string; - generateNodeType(builder: any): any; - setup(builder: any): void; - generate(builder: any): string; -} -/** - * This node is used to build a sub-build in the node system. - * - * @augments Node - * @param {Node} node - The node to be built in the sub-build. - * @param {string} name - The name of the sub-build. - * @param {?string} [nodeType=null] - The type of the node, if known. - */ -export class SubBuildNode extends Node { - constructor(node: any, name: any, nodeType?: null); - /** - * The node to be built in the sub-build. - * - * @type {Node} - */ - node: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSubBuildNode: boolean; - generateNodeType(builder: any): string; - build(builder: any, ...params: any[]): string | Node | null; -} -/** - * This class represents a set of built in WGSL shader functions that sync - * synchronously execute an operation across a subgroup, or 'warp', of compute - * or fragment shader invocations within a workgroup. Typically, these functions - * will synchronously execute an operation using data from all active invocations - * within the subgroup, then broadcast that result to all active invocations. In - * other graphics APIs, subgroup functions are also referred to as wave intrinsics - * (DirectX/HLSL) or warp intrinsics (CUDA). - * - * @augments TempNode - */ -export class SubgroupFunctionNode extends TempNode { - /** - * Constructs a new function node. - * - * @param {string} method - The subgroup/wave intrinsic method to construct. - * @param {Node} [aNode=null] - The method's first argument. - * @param {Node} [bNode=null] - The method's second argument. - */ - constructor(method: string, aNode?: Node, bNode?: Node); - /** - * The subgroup/wave intrinsic method to construct. - * - * @type {string} - */ - method: string; - /** - * The method's first argument. - * - * @type {Node} - */ - aNode: Node; - /** - * The method's second argument. - * - * @type {Node} - */ - bNode: Node; - getInputType(builder: any): string | null; - generateNodeType(builder: any): string | null; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -export namespace SubgroupFunctionNode { - let SUBGROUP_ELECT: string; - let SUBGROUP_BALLOT: string; - let SUBGROUP_ADD: string; - let SUBGROUP_INCLUSIVE_ADD: string; - let SUBGROUP_EXCLUSIVE_AND: string; - let SUBGROUP_MUL: string; - let SUBGROUP_INCLUSIVE_MUL: string; - let SUBGROUP_EXCLUSIVE_MUL: string; - let SUBGROUP_AND: string; - let SUBGROUP_OR: string; - let SUBGROUP_XOR: string; - let SUBGROUP_MIN: string; - let SUBGROUP_MAX: string; - let SUBGROUP_ALL: string; - let SUBGROUP_ANY: string; - let SUBGROUP_BROADCAST_FIRST: string; - let QUAD_SWAP_X: string; - let QUAD_SWAP_Y: string; - let QUAD_SWAP_DIAGONAL: string; - let SUBGROUP_BROADCAST: string; - let SUBGROUP_SHUFFLE: string; - let SUBGROUP_SHUFFLE_XOR: string; - let SUBGROUP_SHUFFLE_UP: string; - let SUBGROUP_SHUFFLE_DOWN: string; - let QUAD_BROADCAST: string; -} -import { SubtractEquation } from './three.core.js'; -import { SubtractiveBlending } from './three.core.js'; -export var TSL: Readonly<{ - __proto__: null; - BRDF_GGX: () => void; - BRDF_Lambert: () => void; - BasicPointShadowFilter: () => void; - BasicShadowFilter: () => void; - Break: () => ExpressionNode; - Const: (node: Node, name?: string | null) => VarNode; - Continue: () => ExpressionNode; - DFGLUT: () => void; - D_GGX: any; - Discard: (conditional: ConditionalNode | null) => Node; - EPSILON: any; - F_Schlick: () => void; - Fn: typeof Fn; - HALF_PI: any; - INFINITY: any; - If: (...params: any[]) => StackNode; - Loop: (...params: any[]) => LoopNode; - NodeAccess: { - READ_ONLY: string; - WRITE_ONLY: string; - READ_WRITE: string; - }; - NodeShaderStage: { - VERTEX: string; - FRAGMENT: string; - }; - NodeType: { - BOOLEAN: string; - INTEGER: string; - FLOAT: string; - VECTOR2: string; - VECTOR3: string; - VECTOR4: string; - MATRIX2: string; - MATRIX3: string; - MATRIX4: string; - }; - NodeUpdateType: { - NONE: string; - FRAME: string; - RENDER: string; - OBJECT: string; - }; - OnAfterObjectUpdate: (callback: Function) => EventNode; - OnAfterRenderPipeline: (callback: Function) => EventNode; - OnBeforeFrameUpdate: (callback: Function) => EventNode; - OnBeforeMaterialUpdate: (callback: Function) => EventNode; - OnBeforeObjectUpdate: (callback: Function) => EventNode; - OnBeforeRenderPipeline: (callback: Function) => EventNode; - OnFrameUpdate: (callback: Function) => EventNode; - OnMaterialUpdate: (callback: Function) => EventNode; - OnObjectUpdate: (callback: Function) => EventNode; - PCFShadowFilter: () => void; - PI: any; - PI2: any; - PointShadowFilter: () => void; - Return: () => ExpressionNode; - Schlick_to_F0: any; - ShaderNode: typeof ShaderNode; - Stack: typeof Stack; - Switch: (...params: any[]) => StackNode; - TBNViewMatrix: any; - TWO_PI: any; - VSMShadowFilter: () => void; - V_GGX_SmithCorrelated: any; - Var: (node: Node, name?: string | null) => VarNode; - VarIntent: (node: Node) => VarNode; - abs: any; - acesFilmicToneMapping: any; - acos: any; - acosh: any; - add: any; - addMethodChaining: typeof addMethodChaining; - addNodeElement: typeof addNodeElement; - agxToneMapping: any; - all: any; - alphaT: any; - ambientOcclusion: any; - and: any; - anisotropy: any; - anisotropyB: any; - anisotropyT: any; - any: any; - array: (...params: any[]) => ArrayNode; - asin: any; - asinh: any; - assign: any; - atan: any; - atanh: any; - atomicAdd: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicAnd: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicFunc: (method: string, pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicLoad: (pointerNode: Node) => AtomicFunctionNode; - atomicMax: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicMin: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicOr: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicStore: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicSub: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - atomicXor: (pointerNode: Node, valueNode: Node) => AtomicFunctionNode; - attenuationColor: any; - attenuationDistance: any; - attribute: (name: string, nodeType?: string | null) => AttributeNode; - attributeArray: (count: number | TypedArray, type?: string | Struct) => StorageBufferNode; - backgroundBlurriness: any; - backgroundIntensity: any; - backgroundRotation: any; - batch: () => void; - batchColor: any; - batchIndirectIndex: any; - bentNormalView: any; - billboarding: () => void; - bitAnd: any; - bitNot: any; - bitOr: any; - bitXor: any; - bitangentGeometry: any; - bitangentLocal: any; - bitangentView: any; - bitangentWorld: any; - bitcast: any; - blendBurn: any; - blendColor: any; - blendDodge: any; - blendOverlay: any; - blendScreen: any; - bool: any; - buffer: (value: Array, type: string, count: number) => BufferNode; - bufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; - builtin: any; - builtinAOContext: typeof builtinAOContext; - builtinShadowContext: typeof builtinShadowContext; - bumpMap: any; - bvec2: any; - bvec3: any; - bvec4: any; - bypass: any; - cache: typeof cache; - call: (func: any, ...params: any[]) => FunctionCallNode; - cameraFar: any; - cameraIndex: any; - cameraNear: any; - cameraNormalMatrix: any; - cameraPosition: any; - cameraProjectionMatrix: any; - cameraProjectionMatrixInverse: any; - cameraViewMatrix: any; - cameraViewport: any; - cameraWorldMatrix: any; - cbrt: (a: Node | number) => Node; - cdl: () => void; - ceil: any; - checker: () => void; - cineonToneMapping: any; - clamp: (value: Node | number, low?: Node | number, high?: Node | number) => Node; - clearcoat: any; - clearcoatNormalView: any; - clearcoatRoughness: any; - clipSpace: any; - code: any; - color: any; - colorSpaceToWorking: (node: Node, sourceColorSpace: string) => ColorSpaceNode; - colorToDirection: (node: Node) => Node; - compute: (node: Node, count: number | Array, workgroupSize?: Array) => ComputeNode; - computeKernel: (node: Node, workgroupSize?: Array) => ComputeNode; - computeSkinning: () => void; - context: (nodeOrValue?: Node | Object, value?: Object) => ContextNode; - convert: (node: any, types: any) => ConvertNode; - convertColorSpace: (node: Node, sourceColorSpace: string, targetColorSpace: string) => ColorSpaceNode; - convertToTexture: (node: Node, ...params: any[]) => RTTNode; - cos: any; - cosh: any; - countLeadingZeros: any; - countOneBits: any; - countTrailingZeros: any; - cross: any; - cubeTexture: (value?: (CubeTexture | CubeTextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null) => CubeTextureNode; - cubeTextureBase: any; - dFdx: any; - dFdy: any; - dashSize: any; - debug: (node: Node, callback?: Function | null) => DebugNode; - decrement: () => void; - decrementBefore: () => void; - defaultBuildStages: string[]; - defaultShaderStages: string[]; - defined: typeof defined; - degrees: any; - deltaTime: any; - densityFogFactor: () => void; - depth: ViewportDepthNode; - depthPass: (scene: Scene, camera: Camera, options: Object) => PassNode; - determinant: any; - difference: any; - diffuseColor: any; - diffuseContribution: any; - directPointLight: ({ color, lightVector, cutoffDistance, decayExponent }: { - color: any; - lightVector: any; - cutoffDistance: any; - decayExponent: any; - }) => { - lightDirection: any; - lightColor: any; - }; - directionToColor: (node: Node) => Node; - directionToFaceDirection: (vector: Node) => Node; - dispersion: any; - distance: any; - div: any; - dot: any; - drawIndex: IndexNode; - dynamicBufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; - element: any; - emissive: any; - equal: any; - equirectDirection: () => void; - equirectUV: () => void; - exp: any; - exp2: any; - exponentialHeightFogFactor: () => void; - expression: any; - faceDirection: any; - faceForward: any; - faceforward: any; - float: any; - floatBitsToInt: (value: Node) => BitcastNode; - floatBitsToUint: (value: Node) => BitcastNode; - floor: any; - fog: () => void; - fract: any; - frameGroup: UniformGroupNode; - frameId: any; - frontFacing: any; - fwidth: any; - gain: (x: Node, k: Node) => Node; - gapSize: any; - getConstNodeType: (value: any) => any; - getCurrentStack: () => any; - getDistanceAttenuation: () => void; - getGeometryRoughness: () => void; - getNormalFromDepth: () => void; - getParallaxCorrectNormal: () => void; - getRoughness: () => void; - getScreenPosition: () => void; - getScreenPositionFromClip: any; - getShIrradianceAt: () => void; - getTextureIndex: typeof getTextureIndex; - getViewPosition: () => void; - globalId: any; - glsl: (src: string, includes: Array) => CodeNode; - glslFn: (code: any, includes: any) => any; - grayscale: () => void; - greaterThan: any; - greaterThanEqual: any; - hash: () => void; - highpModelNormalViewMatrix: any; - highpModelViewMatrix: any; - hue: () => void; - increment: () => void; - incrementBefore: () => void; - inspector: typeof inspector; - instance: () => void; - instanceColor: any; - instanceIndex: IndexNode; - instancedArray: (count: number | TypedArray, type?: string | Struct) => StorageBufferNode; - instancedBufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; - instancedDynamicBufferAttribute: (array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number) => BufferAttributeNode | Node; - instancedMesh: () => void; - int: any; - intBitsToFloat: (value: Node) => BitcastNode; - interleavedGradientNoise: any; - inverse: any; - inverseSqrt: any; - inversesqrt: any; - invocationLocalIndex: IndexNode; - invocationSubgroupIndex: IndexNode; - ior: any; - iridescence: any; - iridescenceIOR: any; - iridescenceThickness: any; - isolate: (node: Node) => IsolateNode; - ivec2: any; - ivec3: any; - ivec4: any; - js: (src: string, includes: Array) => CodeNode; - label: typeof label; - length: any; - lengthSq: (a: Node) => Node; - lessThan: any; - lessThanEqual: any; - lightPosition: typeof lightPosition; - lightProjectionUV: typeof lightProjectionUV; - lightShadowMatrix: typeof lightShadowMatrix; - lightTargetDirection: (light: Light) => Node; - lightTargetPosition: typeof lightTargetPosition; - lightViewPosition: typeof lightViewPosition; - lightingContext: any; - lights: (lights?: Array) => LightsNode; - linearDepth: any; - linearToneMapping: any; - localId: any; - log: any; - log2: any; - logarithmicDepthToViewZ: (depth: Node, near: Node, far: Node) => Node; - luminance: (color: Node, luminanceCoefficients?: Node | null) => Node; - mat2: any; - mat3: any; - mat4: any; - matcapUV: any; - materialAO: any; - materialAlphaTest: any; - materialAnisotropy: any; - materialAnisotropyVector: any; - materialAttenuationColor: any; - materialAttenuationDistance: any; - materialClearcoat: any; - materialClearcoatNormal: any; - materialClearcoatRoughness: any; - materialColor: any; - materialDispersion: any; - materialEmissive: any; - materialEnvIntensity: any; - materialEnvRotation: any; - materialIOR: any; - materialIridescence: any; - materialIridescenceIOR: any; - materialIridescenceThickness: any; - materialLightMap: any; - materialLineDashOffset: any; - materialLineDashSize: any; - materialLineGapSize: any; - materialLineScale: any; - materialLineWidth: any; - materialMetalness: any; - materialNormal: any; - materialOpacity: any; - materialPointSize: any; - materialReference: (name: string, type: string, material?: Material | null) => MaterialReferenceNode; - materialReflectivity: any; - materialRefractionRatio: any; - materialRetroreflectivity: any; - materialRotation: any; - materialRoughness: any; - materialSheen: any; - materialSheenRoughness: any; - materialShininess: any; - materialSpecular: any; - materialSpecularColor: any; - materialSpecularIntensity: any; - materialSpecularStrength: any; - materialThickness: any; - materialTransmission: any; - max: any; - maxMipLevel: any; - mediumpModelViewMatrix: any; - metalness: any; - min: any; - mix: any; - mixElement: (t: Node | number, e1: Node | number, e2: Node | number) => Node; - mod: any; - modelDirection: any; - modelNormalMatrix: any; - modelPosition: any; - modelRadius: any; - modelScale: any; - modelViewMatrix: any; - modelViewPosition: any; - modelViewProjection: any; - modelWorldMatrix: any; - modelWorldMatrixInverse: any; - morphReference: () => void; - mrt: any; - mul: any; - mx_aastep: (threshold: any, value: any) => any; - mx_add: (in1: any, in2?: any) => any; - mx_atan2: (in1?: any, in2?: any) => any; - mx_cell_noise_float: (texcoord?: any) => any; - mx_cell_noise_vec3: (texcoord?: any) => any; - mx_contrast: (input: any, amount?: number, pivot?: number) => any; - mx_divide: (in1: any, in2?: any) => any; - mx_fractal_noise_float: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; - mx_fractal_noise_float_2d: (texcoord?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; - mx_fractal_noise_vec2: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; - mx_fractal_noise_vec3: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; - mx_fractal_noise_vec4: (position?: any, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number) => any; - mx_frame: () => any; - mx_heighttonormal: (input: any, scale?: number, texcoord?: any) => any; - mx_hsvtorgb: any; - mx_ifequal: (value1: any, value2: any, in1: any, in2: any) => any; - mx_ifgreater: (value1: any, value2: any, in1: any, in2: any) => any; - mx_ifgreatereq: (value1: any, value2: any, in1: any, in2: any) => any; - mx_invert: (in1: any, amount?: any) => any; - mx_modulo: (in1: any, in2?: any) => any; - mx_multiply: (in1: any, in2?: any) => any; - mx_noise_float: (texcoord?: any, amplitude?: number, pivot?: number) => any; - mx_noise_vec3: (texcoord?: any, amplitude?: number, pivot?: number) => any; - mx_noise_vec4: (texcoord?: any, amplitude?: number, pivot?: number) => any; - mx_place2d: (texcoord: any, pivot?: any, scale?: any, rotate?: any, offset?: any, operationorder?: any) => any; - mx_power: (in1: any, in2?: any) => any; - mx_ramp4: (valuetl: any, valuetr: any, valuebl: any, valuebr: any, texcoord?: any) => any; - mx_ramplr: (valuel: any, valuer: any, texcoord?: any) => any; - mx_ramptb: (valueb: any, valuet: any, texcoord?: any) => any; - mx_rgbtohsv: any; - mx_rotate2d: (input: any, amount?: number) => any; - mx_rotate3d: (input: any, amount?: number, axis?: any) => any; - mx_safepower: (in1: any, in2?: number) => any; - mx_separate: (in1: any, channelOrOut?: null) => any; - mx_smoothstep: (inNode: any, low?: number, high?: number) => any; - mx_splitlr: (valuel: any, valuer: any, center: any, texcoord?: any) => any; - mx_splittb: (valueb: any, valuet: any, center: any, texcoord?: any) => any; - mx_srgb_texture_to_lin_rec709: any; - mx_subtract: (in1: any, in2?: any) => any; - mx_timer: () => any; - mx_transform_uv: (uv_scale?: number, uv_offset?: number, uv_geo?: any) => any; - mx_unifiednoise2d: (noiseType: any, texcoord?: any, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number) => void; - mx_unifiednoise3d: (noiseType: any, texcoord?: any, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number) => void; - mx_worley_noise_float: (texcoord?: any, jitter?: number, style?: number) => void; - mx_worley_noise_float_2d: (texcoord?: any, jitter?: number, style?: number) => void; - mx_worley_noise_float_3d: (texcoord?: any, jitter?: number, style?: number) => void; - mx_worley_noise_vec2: (texcoord?: any, jitter?: number) => any; - mx_worley_noise_vec3: (texcoord?: any, jitter?: number, metric?: number) => any; - mx_worley_noise_vec3_style: (texcoord?: any, jitter?: number, style?: number, metric?: number) => any; - negate: any; - negateOnBackSide: () => void; - neutralToneMapping: any; - nodeArray: (val: any, altType?: null) => any; - nodeImmutable: (NodeClass: any, ...params: any[]) => any; - nodeObject: (val: any, altType?: null) => any; - nodeObjectIntent: (val: any, altType?: null) => any; - nodeObjects: (val: any, altType?: null) => any; - nodeProxy: (NodeClass: any, scope?: null, factor?: null, settings?: null) => any; - nodeProxyConstructor: (constructorFunction: any, nodeInstance: any) => any; - nodeProxyIntent: (NodeClass: any, scope?: null, factor?: null, settings?: {}) => any; - normalFlat: any; - normalGeometry: any; - normalLocal: any; - normalMap: any; - normalView: any; - normalViewGeometry: any; - normalWorld: any; - normalWorldGeometry: any; - normalize: any; - not: any; - notEqual: any; - numWorkgroups: any; - objectDirection: any; - objectGroup: UniformGroupNode; - objectPosition: any; - objectRadius: any; - objectScale: any; - objectViewPosition: any; - objectWorldMatrix: any; - oneMinus: any; - or: any; - orthographicDepthToViewZ: () => void; - oscSawtooth: (t?: Node) => Node; - oscSine: (t?: Node) => Node; - oscSquare: (t?: Node) => Node; - oscTriangle: (t?: Node) => Node; - output: any; - outputStruct: any; - overloadingFn: (functionNodes: Array) => FunctionOverloadingNode; - overrideNode: typeof overrideNode; - overrideNodes: typeof overrideNodes; - packHalf2x16: any; - packNormalToRGB: (node: Node) => Node; - packSnorm2x16: any; - packSnorm4x8: any; - packUnorm2x16: any; - packUnorm4x8: any; - parabola: (x: Node, k: Node) => Node; - parallaxDirection: any; - parallaxUV: (uv: Node, scale: Node) => Node; - parameter: (type: string, name: string | null) => ParameterNode; - pass: (scene: Scene, camera: Camera, options: Object) => PassNode; - passTexture: (pass: PassNode, texture: Texture) => PassTextureNode; - pcurve: (x: Node, a: Node, b: Node) => Node; - perspectiveDepthToViewZ: () => void; - pmremTexture: any; - pointShadow: (light: PointLight, shadow?: PointLightShadow | null) => PointShadowNode; - pointUV: PointUVNode; - pointWidth: any; - positionGeometry: any; - positionLocal: any; - positionPrevious: any; - positionView: any; - positionViewDirection: any; - positionWorld: any; - positionWorldDirection: any; - posterize: () => void; - pow: any; - pow2: (x: Node | number) => Node; - pow3: (x: Node | number) => Node; - pow4: (x: Node | number) => Node; - premultiplyAlpha: () => void; - property: (type: string, name?: string | null, placeholderNode?: Node | null) => PropertyNode; - quadBroadcast: any; - quadSwapDiagonal: any; - quadSwapX: any; - quadSwapY: any; - radians: any; - rand: () => void; - range: any; - rangeFogFactor: () => void; - reciprocal: any; - reference: (name: string, type: string, object?: Object | null) => ReferenceNode; - referenceBuffer: (name: string, type: string, count: number, object: Object) => ReferenceNode; - reflect: any; - reflectVector: any; - reflectView: any; - reflector: (parameters?: { - target?: Object3D | undefined; - resolution?: number | undefined; - generateMipmaps?: boolean | undefined; - bounces?: boolean | undefined; - depth?: boolean | undefined; - samples?: number | undefined; - defaultTexture?: TextureNode | undefined; - reflector?: ReflectorBaseNode | undefined; - }) => ReflectorNode; - refract: any; - refractVector: any; - refractView: any; - reinhardToneMapping: any; - remap: () => void; - remapClamp: typeof remapClamp; - renderGroup: UniformGroupNode; - renderOutput: (color: Node, toneMapping?: number | null, outputColorSpace?: string | null) => RenderOutputNode; - rendererReference: (name: string, type: string, renderer?: Renderer | null) => RendererReferenceNode; - replaceDefaultUV: typeof replaceDefaultUV; - retroreflectivity: any; - rotate: any; - rotateUV: () => void; - roughness: any; - round: any; - rtt: (node: Node, ...params: any[]) => RTTNode; - sRGBTransferEOTF: any; - sRGBTransferOETF: any; - sample: (callback: Function, uv?: Node | null) => SampleNode; - sampler: (value: TextureNode | Texture) => Node; - samplerComparison: (value: TextureNode | Texture) => Node; - saturate: (value: Node | number) => Node; - saturation: () => void; - screenCoordinate: any; - screenDPR: any; - screenSize: any; - screenUV: any; - select: any; - setCurrentStack: (stack: any) => void; - setName: (node: Node, name: string) => ContextNode; - shaderStages: string[]; - shadow: (light: Light, shadow?: LightShadow | null) => ShadowNode; - shadowPositionWorld: any; - shapeCircle: () => void; - sharedUniformGroup: (name: string, order?: number, updateType?: null) => UniformGroupNode; - sheen: any; - sheenRoughness: any; - shiftLeft: any; - shiftRight: any; - shininess: any; - sign: any; - sin: any; - sinc: (x: Node, k: Node) => Node; - sinh: any; - skinning: () => void; - smoothstep: any; - smoothstepElement: (x: Node | number, low: Node | number, high: Node | number) => Node; - specularColor: any; - specularColorBlended: any; - specularF90: any; - spherizeUV: () => void; - split: (node: any, channels: any) => SplitNode; - spritesheetUV: () => void; - sqrt: any; - stack: any; - step: any; - stepElement: (x: Node | number, edge: Node | number) => Node; - storage: (value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, type?: (string | Struct) | null, count?: number) => StorageBufferNode; - storageBarrier: () => BarrierNode; - storageTexture: any; - storageTexture3D: any; - struct: (membersLayout: Object, name?: string | null) => Function; - sub: any; - subBuild: (node: Node, name: string, type?: string | null) => Node; - subgroupAdd: any; - subgroupAll: any; - subgroupAnd: any; - subgroupAny: any; - subgroupBallot: any; - subgroupBroadcast: any; - subgroupBroadcastFirst: any; - subgroupElect: any; - subgroupExclusiveAdd: any; - subgroupExclusiveMul: any; - subgroupInclusiveAdd: any; - subgroupInclusiveMul: any; - subgroupIndex: IndexNode; - subgroupMax: any; - subgroupMin: any; - subgroupMul: any; - subgroupOr: any; - subgroupShuffle: any; - subgroupShuffleDown: any; - subgroupShuffleUp: any; - subgroupShuffleXor: any; - subgroupSize: any; - subgroupXor: any; - tan: any; - tangentGeometry: any; - tangentLocal: any; - tangentView: any; - tangentWorld: any; - tanh: any; - texture: (value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null) => TextureNode; - texture3D: any; - texture3DLevel: (value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null) => TextureNode; - texture3DLoad: (...params: any[]) => TextureNode; - textureBarrier: () => BarrierNode; - textureBicubic: () => void; - textureBicubicLevel: () => void; - textureLevel: (value: any, uv: any, level: any) => TextureNode; - textureLoad: (...params: any[]) => TextureNode; - textureSize: any; - textureStore: (value: StorageTexture | StorageTextureNode, uvNode: Node, storeNode?: Node | null) => StorageTextureNode; - thickness: any; - time: any; - toneMapping: (mapping: number, exposure: Node | number, color: Node | Color) => ToneMappingNode; - toneMappingExposure: any; - toonOutlinePass: (scene: Scene, camera: Camera, color?: Color, thickness?: number, alpha?: number) => ToonOutlinePassNode; - transformDirection: any; - transformNormal: () => void; - transformNormalByInverseViewMatrix: (normal: Node, viewMatrix: Node) => Node; - transformNormalByViewMatrix: (normal: Node, viewMatrix: Node) => Node; - transformNormalToView: () => void; - transformedClearcoatNormalView: any; - transformedNormalView: any; - transformedNormalWorld: any; - transmission: any; - transpose: any; - triNoise3D: any; - triplanarTexture: (...params: any[]) => Node; - triplanarTextures: () => void; - trunc: any; - uint: any; - uintBitsToFloat: (value: Node) => BitcastNode; - uniform: (value: any | string, type?: string) => UniformNode; - uniformArray: (values: Array, nodeType?: string | null) => UniformArrayNode; - uniformCubeTexture: (value?: CubeTexture | null) => CubeTextureNode; - uniformFlow: (node: Node) => ContextNode; - uniformGroup: (name: string, order?: number, updateType?: null) => UniformGroupNode; - uniformTexture: (value?: Texture | null) => TextureNode; - unpackHalf2x16: any; - unpackNormal: (xy: Node) => Node; - unpackRGBToNormal: (node: Node) => Node; - unpackSnorm2x16: any; - unpackSnorm4x8: any; - unpackUnorm2x16: any; - unpackUnorm4x8: any; - unpremultiplyAlpha: () => void; - userData: (name: string, inputType: string, userData: Object | null) => UserDataNode; - uv: (index?: number) => AttributeNode; - uvec2: any; - uvec3: any; - uvec4: any; - varying: any; - varyingProperty: (type: string, name?: string | null, placeholderNode?: Node | null) => PropertyNode; - vec2: any; - vec3: any; - vec4: any; - vectorComponents: string[]; - velocity: VelocityNode; - vertexColor: (index?: number) => VertexColorNode; - vertexIndex: IndexNode; - vertexStage: (node: Node) => VaryingNode; - vibrance: () => void; - viewZToLogarithmicDepth: (viewZ: Node, near: Node, far: Node) => Node; - viewZToOrthographicDepth: (viewZ: Node, near: Node, far: Node) => Node; - viewZToPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => Node; - viewZToReversedOrthographicDepth: (viewZ: Node, near: Node, far: Node) => Node; - viewZToReversedPerspectiveDepth: (viewZ: Node, near: Node, far: Node) => Node; - viewport: any; - viewportCoordinate: any; - viewportDepthTexture: any; - viewportLinearDepth: ViewportDepthNode; - viewportMipTexture: any; - viewportOpaqueMipTexture: (uv?: Node | null, level?: Node | null) => ViewportTextureNode; - viewportSafeUV: () => void; - viewportSharedTexture: any; - viewportSize: any; - viewportTexture: any; - viewportUV: any; - vogelDiskSample: any; - wgsl: (src: string, includes: Array) => CodeNode; - wgslFn: (code: any, includes: any) => any; - workgroupArray: (type: string, count?: number) => WorkgroupInfoNode; - workgroupBarrier: () => BarrierNode; - workgroupId: any; - workingToColorSpace: (node: Node, targetColorSpace: string) => ColorSpaceNode; - xor: any; -}>; -import { TangentSpaceNormalMap } from './three.core.js'; -/** - * This module uses cache management to create temporary variables - * if the node is used more than once to prevent duplicate calculations. - * - * The class acts as a base class for many other nodes types. - * - * @augments Node - */ -export class TempNode extends Node { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTempNode: boolean; - /** - * Whether this node is used more than once in context of other nodes. - * - * @param {NodeBuilder} builder - The node builder. - * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. - */ - hasDependencies(builder: NodeBuilder): boolean; - build(builder: any, output: any): any; -} -import { Texture } from './three.core.js'; -/** - * This type of uniform node represents a 3D texture. - * - * @augments TextureNode - */ -export class Texture3DNode extends TextureNode { - /** - * Constructs a new 3D texture node. - * - * @param {Data3DTexture} value - The 3D texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - */ - constructor(value: Data3DTexture, uvNode?: Node | null, levelNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTexture3DNode: boolean; - /** - * Overwritten with an empty implementation since the `updateMatrix` flag is ignored - * for 3D textures. The uv transformation matrix is not applied to 3D textures. - * - * @param {boolean} value - The update toggle. - */ - setUpdateMatrix(): void; - /** - * Computes the normal for the given uv. These texture coordiantes represent a - * position inside the 3D texture. Unlike geometric normals, this normal - * represents a slope or gradient of scalar data inside the 3D texture. - * - * @param {Node} uvNode - The uv node that defines a position in the 3D texture. - * @return {Node} The normal representing the slope/gradient in the data. - */ - normal(uvNode: Node): Node; -} -/** - * This type of uniform node represents a 2D texture. - * - * @augments UniformNode - */ -export class TextureNode extends UniformNode { - /** - * Constructs a new texture node. - * - * @param {Texture} [value=EmptyTexture] - The texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Node} [biasNode=null] - The bias node. - */ - constructor(value?: Texture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTextureNode: boolean; - /** - * Represents the texture coordinates. - * - * @type {?Node} - * @default null - */ - uvNode: Node | null; - /** - * Represents the mip level that should be selected. - * - * @type {?Node} - * @default null - */ - levelNode: Node | null; - /** - * Represents the bias to be applied during level-of-detail computation. - * - * @type {?Node} - * @default null - */ - biasNode: Node | null; - /** - * Represents a reference value a texture sample is compared to. - * - * @type {?Node} - * @default null - */ - compareNode: Node | null; - /** - * When using texture arrays, the depth node defines the layer to select. - * - * @type {?Node} - * @default null - */ - depthNode: Node | null; - /** - * When defined, a texture is sampled using explicit gradients. - * - * @type {?Array>} - * @default null - */ - gradNode: Array> | null; - /** - * Represents the optional index constant of the channel to gather. - * This must be in range [0, 3] and a compile-time constant. - * - * @type {?Node} - * @default null - */ - gatherNode: Node | null; - /** - * Represents the optional texel offset applied to the unnormalized texture - * coordinate before sampling the texture. - * - * @type {?Node} - * @default null - */ - offsetNode: Node | null; - /** - * Whether texture values should be sampled or fetched. - * - * @type {boolean} - * @default true - */ - sampler: boolean; - /** - * Whether the uv transformation matrix should be - * automatically updated or not. Use `setUpdateMatrix()` - * if you want to change the value of the property. - * - * @type {boolean} - * @default false - */ - updateMatrix: boolean; - /** - * The reference node. - * - * @type {?Node} - * @default null - */ - referenceNode: Node | null; - /** - * The texture value is stored in a private property. - * - * @private - * @type {Texture} - */ - private _value; - /** - * The uniform node that represents the uv transformation matrix. - * - * @private - * @type {?UniformNode} - * @default null - */ - private _matrixUniform; - /** - * The uniform node that represents the y-flip. Only required for WebGL. - * - * @private - * @type {?UniformNode} - * @default null - */ - private _flipYUniform; - /** - * Whether the node is used as a comparison sampler, e.g. via `samplerComparison()`. - * - * @private - * @type {boolean} - * @default false - */ - private _samplerComparison; - set value(value: Texture); - /** - * The texture value. - * - * @type {Texture} - */ - get value(): Texture; - /** - * Overwritten since the uniform hash is defined by the texture's UUID. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The uniform hash. - */ - getUniformHash(): string; - /** - * Overwritten since the node type is inferred from the texture type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(): string; - /** - * Overwrites the default implementation to return a fixed value `'texture'`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; - /** - * Returns a default uvs based on the current texture's channel. - * - * @return {AttributeNode} The default uvs. - */ - getDefaultUV(): AttributeNode; - /** - * Overwritten to always return the texture reference of the node. - * - * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. - * @return {Texture} The texture reference. - */ - updateReference(): Texture; - /** - * Transforms the given uv node with the texture transformation matrix. - * - * @param {Node} uvNode - The uv node to transform. - * @return {Node} The transformed uv node. - */ - getTransformedUV(uvNode: Node): Node; - /** - * Defines whether the uv transformation matrix should automatically be updated or not. - * - * @param {boolean} value - The update toggle. - * @return {TextureNode} A reference to this node. - */ - setUpdateMatrix(value: boolean): TextureNode; - /** - * Setups the uv node. Depending on the backend as well as texture's image and type, it might be necessary - * to modify the uv node for correct sampling. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} uvNode - The uv node to setup. - * @return {Node} The updated uv node. - */ - setupUV(builder: NodeBuilder, uvNode: Node): Node; - /** - * Setups texture node by preparing the internal nodes for code generation. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * Generates the uv code snippet. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} uvNode - The uv node to generate code for. - * @return {string} The generated code snippet. - */ - generateUV(builder: NodeBuilder, uvNode: Node): string; - /** - * Generates the offset code snippet. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} offsetNode - The offset node to generate code for. - * @return {string} The generated code snippet. - */ - generateOffset(builder: NodeBuilder, offsetNode: Node): string; - /** - * Generates the snippet for the texture sampling. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} textureProperty - The texture property. - * @param {string} uvSnippet - The uv snippet. - * @param {?string} levelSnippet - The level snippet. - * @param {?string} biasSnippet - The bias snippet. - * @param {?string} depthSnippet - The depth snippet. - * @param {?string} compareSnippet - The compare snippet. - * @param {?Array} gradSnippet - The grad snippet. - * @param {?string} gatherSnippet - The gather snippet. - * @param {?string} offsetSnippet - The offset snippet. - * @param {?string} flipYSnippet - The y-flip snippet. Only used for WebGL. - * @return {string} The generated code snippet. - */ - generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, gatherSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; - /** - * Generates the code snippet of the texture node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} output - The current output. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder, output: string): string; - /** - * Sets the sampler value. - * - * @param {boolean} value - The sampler value to set. - * @return {TextureNode} A reference to this texture node. - */ - setSampler(value: boolean): TextureNode; - /** - * Returns the sampler value. - * - * @return {boolean} The sampler value. - */ - getSampler(): boolean; - /** - * Samples the texture with the given uv node. - * - * @param {Node} uvNode - The uv node. - * @return {TextureNode} A texture node representing the texture sample. - */ - sample(uvNode: Node): TextureNode; - /** - * TSL function for creating a texture node that fetches/loads texels without interpolation. - * - * @param {Node} uvNode - The uv node. - * @returns {TextureNode} A texture node representing the texture load. - */ - load(uvNode: Node): TextureNode; - /** - * Samples a blurred version of the texture by defining an internal bias. - * - * @param {Node} amountNode - How blurred the texture should be. - * @return {TextureNode} A texture node representing the texture sample. - */ - blur(amountNode: Node): TextureNode; - /** - * Samples a specific mip of the texture. - * - * @param {Node} levelNode - The mip level to sample. - * @return {TextureNode} A texture node representing the texture sample. - */ - level(levelNode: Node): TextureNode; - /** - * Returns the texture size of the requested level. - * - * @param {Node} levelNode - The level to compute the size for. - * @return {TextureSizeNode} The texture size. - */ - size(levelNode: Node): TextureSizeNode; - /** - * Samples the texture with the given bias. - * - * @param {Node} biasNode - The bias node. - * @return {TextureNode} A texture node representing the texture sample. - */ - bias(biasNode: Node): TextureNode; - /** - * Returns the base texture of this node. - * @return {TextureNode} The base texture node. - */ - getBase(): TextureNode; - /** - * Samples the texture by executing a compare operation. - * - * @param {Node} compareNode - The node that defines the compare value. - * @return {TextureNode} A texture node representing the texture sample. - */ - compare(compareNode: Node): TextureNode; - /** - * Samples the texture using an explicit gradient. - * - * @param {Node} gradNodeX - The gradX node. - * @param {Node} gradNodeY - The gradY node. - * @return {TextureNode} A texture node representing the texture sample. - */ - grad(gradNodeX: Node, gradNodeY: Node): TextureNode; - /** - * Gathers four texels from the texture. - * - * @param {Node} gatherNode - The index of the channel to read. This must be in range [0, 3] and a compile-time constant. - * @return {TextureNode} A texture node representing the texture sample. - */ - gather(gatherNode?: Node): TextureNode; - /** - * Returns `true` if the texture is sampled with a depth comparison, - * meaning the node must be bound with a comparison sampler. - * - * @return {boolean} Whether comparison sampling is used or not. - */ - isSampleCompare(): boolean; - /** - * Samples the texture by defining a depth node. - * - * @param {Node} depthNode - The depth node. - * @return {TextureNode} A texture node representing the texture sample. - */ - depth(depthNode: Node): TextureNode; - /** - * Samples the texture by defining an offset node. - * - * @param {Node} offsetNode - The offset node. - * @return {TextureNode} A texture node representing the texture sample. - */ - offset(offsetNode: Node): TextureNode; - /** - * The update is used to implement the update of the uv transformation matrix. - */ - update(): void; - /** - * Clones the texture node. - * - * @return {TextureNode} The cloned texture node. - */ - clone(): TextureNode; -} -/** - * A node that represents the dimensions of a texture. The texture size is - * retrieved in the shader via built-in shader functions like `textureDimensions()` - * or `textureSize()`. - * - * @augments Node - */ -export class TextureSizeNode extends Node { - /** - * Constructs a new texture size node. - * - * @param {TextureNode} textureNode - A texture node which size should be retrieved. - * @param {?Node} [levelNode=null] - A level node which defines the requested mip. - */ - constructor(textureNode: TextureNode, levelNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTextureSizeNode: boolean; - /** - * A texture node which size should be retrieved. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * A level node which defines the requested mip. - * - * @type {Node} - * @default null - */ - levelNode: Node; - generate(builder: any): any; -} -import { TimestampQuery } from './three.core.js'; -/** - * This node represents a tone mapping operation. - * - * @augments TempNode - */ -export class ToneMappingNode extends TempNode { - /** - * Constructs a new tone mapping node. - * - * @param {number} toneMapping - The tone mapping type. - * @param {Node} exposureNode - The tone mapping exposure. - * @param {Node} [colorNode=null] - The color node to process. - */ - constructor(toneMapping: number, exposureNode?: Node, colorNode?: Node); - /** - * The tone mapping type. - * - * @private - * @type {number} - */ - private _toneMapping; - /** - * The tone mapping exposure. - * - * @type {Node} - * @default null - */ - exposureNode: Node; - /** - * Represents the color to process. - * - * @type {?Node} - * @default null - */ - colorNode: Node | null; - /** - * Sets the tone mapping type. - * - * @param {number} value - The tone mapping type. - * @return {ToneMappingNode} A reference to this node. - */ - setToneMapping(value: number): ToneMappingNode; - /** - * Gets the tone mapping type. - * - * @returns {number} The tone mapping type. - */ - getToneMapping(): number; - setup(builder: any): any; -} -/** - * Represents a render pass for producing a toon outline effect on compatible objects. - * Only 3D objects with materials of type `MeshToonMaterial` and `MeshToonNodeMaterial` - * will receive the outline. - * - * ```js - * const postProcessing = new RenderPipeline( renderer ); - * - * const scenePass = toonOutlinePass( scene, camera ); - * - * postProcessing.outputNode = scenePass; - * ``` - * @augments PassNode - */ -export class ToonOutlinePassNode extends PassNode { - /** - * Constructs a new outline pass node. - * - * @param {Scene} scene - A reference to the scene. - * @param {Camera} camera - A reference to the camera. - * @param {Node} colorNode - Defines the outline's color. - * @param {Node} thicknessNode - Defines the outline's thickness. - * @param {Node} alphaNode - Defines the outline's alpha. - */ - constructor(scene: Scene, camera: Camera, colorNode: Node, thicknessNode: Node, alphaNode: Node); - /** - * Defines the outline's color. - * - * @type {Node} - */ - colorNode: Node; - /** - * Defines the outline's thickness. - * - * @type {Node} - */ - thicknessNode: Node; - /** - * Defines the outline's alpha. - * - * @type {Node} - */ - alphaNode: Node; - /** - * An internal material cache. - * - * @private - * @type {WeakMap} - */ - private _materialCache; - /** - * Creates the material used for outline rendering. - * - * @private - * @return {NodeMaterial} The outline material. - */ - private _createMaterial; - /** - * For the given toon material, this method returns a corresponding - * outline material. - * - * @private - * @param {(MeshToonMaterial|MeshToonNodeMaterial)} originalMaterial - The toon material. - * @return {NodeMaterial} The outline material. - */ - private _getOutlineMaterial; -} -import { UVMapping } from './three.core.js'; -import { Uint16BufferAttribute } from './three.core.js'; -import { Uint32BufferAttribute } from './three.core.js'; -/** - * Similar to {@link BufferNode} this module represents array-like data as - * uniform buffers. Unlike {@link BufferNode}, it can handle more common - * data types in the array (e.g `three.js` primitives) and automatically - * manage buffer padding. It should be the first choice when working with - * uniforms buffers. - * ```js - * const tintColors = uniformArray( [ - * new Color( 1, 0, 0 ), - * new Color( 0, 1, 0 ), - * new Color( 0, 0, 1 ) - * ], 'color' ); - * - * const redColor = tintColors.element( 0 ); - * - * @augments BufferNode - */ -export class UniformArrayNode extends BufferNode { - /** - * Constructs a new uniform array node. - * - * @param {Array} value - Array holding the buffer data. - * @param {?string} [elementType=null] - The data type of a buffer element. - */ - constructor(value: Array, elementType?: string | null); - /** - * Array holding the buffer data. Unlike {@link BufferNode}, the array can - * hold number primitives as well as three.js objects like vectors, matrices - * or colors. - * - * @type {Array} - */ - array: Array; - /** - * The data type of an array element. - * - * @type {string} - */ - elementType: string; - /** - * The padded type. Uniform buffers must conform to a certain buffer layout - * so a separate type is computed to ensure correct buffer size. - * - * @type {string} - */ - paddedType: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayBufferNode: boolean; - /** - * This method is overwritten since the node type is inferred from the - * {@link UniformArrayNode#paddedType}. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(): string; - /** - * The data type of the array elements. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The element type. - */ - getElementType(): string; - /** - * Returns the padded type based on the element type. - * - * @return {string} The padded type. - */ - getPaddedType(): string; - update(): void; - /** - * Composes a user-defined update with the buffer transfer. - * - * @param {Function} callback - The update function. - * @param {string} updateType - The update type. - * @return {UniformArrayNode} A reference to this node. - */ - onUpdate(callback: Function, updateType: string): UniformArrayNode; - /** - * The method makes sure to correctly transfer the data from the (complex) objects - * in the array to the internal, correctly padded value buffer. - */ - updateBuffer(): void; - /** - * Implement the value buffer creation based on the array data. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {null} - */ - setup(builder: NodeBuilder): null; - /** - * Overwrites the default `element()` method to provide element access - * based on {@link UniformArrayNode}. - * - * @param {IndexNode} indexNode - The index node. - * @return {UniformArrayElementNode} - */ - element(indexNode: IndexNode): UniformArrayElementNode; -} -/** - * This node can be used to group single instances of {@link UniformNode} - * and manage them as a uniform buffer. - * - * In most cases, the predefined nodes `objectGroup`, `renderGroup` and `frameGroup` - * will be used when defining the {@link UniformNode#groupNode} property. - * - * - `objectGroup`: Uniform buffer per object. - * - `renderGroup`: Shared uniform buffer, updated once per render call. - * - `frameGroup`: Shared uniform buffer, updated once per frame. - * - * @augments Node - */ -export class UniformGroupNode extends Node { - /** - * Constructs a new uniform group node. - * - * @param {string} name - The name of the uniform group node. - * @param {boolean} [shared=false] - Whether this uniform group node is shared or not. - * @param {number} [order=1] - Influences the internal sorting. - * @param {string|null} [updateType=null] - The update type of the uniform group node. - */ - constructor(name: string, shared?: boolean, order?: number, updateType?: string | null); - /** - * Whether this uniform group node is shared or not. - * - * @type {boolean} - * @default false - */ - shared: boolean; - /** - * The sort key that determines the order of this group relative to other - * uniform groups. Groups with a lower order are placed first. Shared groups - * typically use a lower order so they precede regular per-object groups. - * - * @type {number} - * @default 1 - */ - order: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformGroup: boolean; - /** - * Marks the uniform group node as needing an update. - * This will trigger the necessary updates in the rendering process. - */ - update(): void; -} -/** - * Class for representing a uniform. - * - * @augments InputNode - */ -export class UniformNode extends InputNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformNode: boolean; - /** - * The uniform group of this uniform. By default, uniforms are - * managed per object but they might belong to a shared group - * which is updated per frame or render call. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; - /** - * Sets the {@link UniformNode#name} property. - * - * @param {string} name - The name of the uniform. - * @return {UniformNode} A reference to this node. - */ - setName(name: string): UniformNode; - /** - * Sets the {@link UniformNode#name} property. - * - * @deprecated - * @param {string} name - The name of the uniform. - * @return {UniformNode} A reference to this node. - */ - label(name: string): UniformNode; - /** - * Sets the {@link UniformNode#groupNode} property. - * - * @param {UniformGroupNode} group - The uniform group. - * @return {UniformNode} A reference to this node. - */ - setGroup(group: UniformGroupNode): UniformNode; - /** - * Returns the {@link UniformNode#groupNode}. - * - * @return {UniformGroupNode} The uniform group. - */ - getGroup(): UniformGroupNode; - /** - * By default, this method returns the result of {@link Node#getHash} but derived - * classes might overwrite this method with a different implementation. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The uniform hash. - */ - getUniformHash(builder: NodeBuilder): string; - /** - * Uniform nodes with the same hash share a single uniform. This method returns the node - * the shared uniform refers to which is the first node registered for the hash. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {UniformNode} The node the shared uniform refers to. - */ - getSharedNode(builder: NodeBuilder): UniformNode; - onUpdate(callback: any, updateType: any): Node; - getInputType(builder: any): string; - generate(builder: any, output: any): any; -} -/** - * This node represents an operation that unpacks values from a 32-bit unsigned integer, reinterpreting the results as a floating-point vector - * - * @augments TempNode - */ -export class UnpackFloatNode extends TempNode { - /** - * - * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the integer values are mapped to the float range - * @param {Node} uintNode - The uint node to be unpacked - */ - constructor(encoding: "snorm" | "unorm" | "float16", uintNode: Node); - /** - * The unsigned integer to be unpacked. - * - * @type {Node} - */ - uintNode: Node; - /** - * The numeric encoding. - * - * @type {string} - */ - encoding: string; - /** - * The component layout of the packed integer. - * - * @type {'2x16' | '4x8'} - * @default '2x16' - */ - layout: "2x16" | "4x8"; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUnpackFloatNode: boolean; - generateNodeType(): "vec2" | "vec4"; - generate(builder: any): string; -} -import { UnsignedByteType } from './three.core.js'; -import { UnsignedInt101111Type } from './three.core.js'; -import { UnsignedInt248Type } from './three.core.js'; -import { UnsignedInt5999Type } from './three.core.js'; -import { UnsignedIntType } from './three.core.js'; -import { UnsignedShort4444Type } from './three.core.js'; -import { UnsignedShort5551Type } from './three.core.js'; -import { UnsignedShortType } from './three.core.js'; -/** - * A special type of reference node that allows to link values in - * `userData` fields to node objects. - * ```js - * sprite.userData.rotation = 1; // stores individual rotation per sprite - * - * const material = new THREE.SpriteNodeMaterial(); - * material.rotationNode = userData( 'rotation', 'float' ); - * ``` - * Since `UserDataNode` is extended from {@link ReferenceNode}, the node value - * will automatically be updated when the `rotation` user data field changes. - * - * @augments ReferenceNode - */ -export class UserDataNode extends ReferenceNode { - /** - * Constructs a new user data node. - * - * @param {string} property - The property name that should be referenced by the node. - * @param {string} inputType - The node data type of the reference. - * @param {?Object} [userData=null] - A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated. - */ - constructor(property: string, inputType: string, userData?: Object | null); - /** - * A reference to the `userData` object. If not provided, the `userData` - * property of the 3D object that uses the node material is evaluated. - * - * @type {?Object} - * @default null - */ - userData: Object | null; -} -import { VSMShadowMap } from './three.core.js'; -/** - * Class for representing shader variables as nodes. Variables are created from - * existing nodes like the following: - * - * ```js - * const depth = sampleDepth( uvNode ).toVar( 'depth' ); - * ``` - * - * @augments Node - */ -export class VarNode extends Node { - /** - * Constructs a new variable node. - * - * @param {Node} node - The node for which a variable should be created. - * @param {?string} [name=null] - The name of the variable in the shader. - * @param {boolean} [readOnly=false] - The read-only flag. - */ - constructor(node: Node, name?: string | null, readOnly?: boolean); - /** - * The node for which a variable should be created. - * - * @type {Node} - */ - node: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVarNode: boolean; - /** - * - * The read-only flag. - * - * @type {boolean} - * @default false - */ - readOnly: boolean; - /** - * This flag is used to indicate that this node is used for intent. - * - * @type {boolean} - * @default false - */ - intent: boolean; - /** - * Sets the intent flag for this node. - * - * This flag is used to indicate that this node is used for intent - * and should not be built directly. Instead, it is used to indicate that - * the node should be treated as a variable intent. - * - * It's useful for assigning variables without needing creating a new variable node. - * - * @param {boolean} value - The value to set for the intent flag. - * @returns {VarNode} This node. - */ - setIntent(value: boolean): VarNode; - /** - * Checks if this node is used for intent. - * - * @param {NodeBuilder} builder - The node builder. - * @returns {boolean} Whether this node is used for intent. - */ - isIntent(builder: NodeBuilder): boolean; - /** - * Returns the intent flag of this node. - * - * @return {boolean} The intent flag. - */ - getIntent(): boolean; - getMemberType(builder: any, name: any): string; - getElementType(builder: any): string; - generateNodeType(builder: any): string; - getArrayCount(builder: any): number | null; - isAssign(builder: any): any; - build(...params: any[]): string | Node | null; - generate(builder: any): any; - _hasStack(builder: any): boolean; -} -/** - * Class for representing shader varyings as nodes. Varyings are create from - * existing nodes like the following: - * - * ```js - * const positionLocal = positionGeometry.toVarying( 'vPositionLocal' ); - * ``` - * - * @augments Node - */ -export class VaryingNode extends Node { - /** - * Constructs a new varying node. - * - * @param {Node} node - The node for which a varying should be created. - * @param {?string} name - The name of the varying in the shader. - */ - constructor(node: Node, name?: string | null); - /** - * The node for which a varying should be created. - * - * @type {Node} - */ - node: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVaryingNode: boolean; - /** - * The interpolation type of the varying data. - * - * @type {?string} - * @default null - */ - interpolationType: string | null; - /** - * The interpolation sampling type of varying data. - * - * @type {?string} - * @default null - */ - interpolationSampling: string | null; - /** - * Defines the interpolation type of the varying. - * - * @param {string} type - The interpolation type. - * @param {?string} sampling - The interpolation sampling type - * @return {VaryingNode} A reference to this node. - */ - setInterpolation(type: string, sampling?: string | null): VaryingNode; - getHash(builder: any): string; - generateNodeType(builder: any): string; - /** - * This method performs the setup of a varying node with the current node builder. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {NodeVarying} The node varying from the node builder. - */ - setupVarying(builder: NodeBuilder): NodeVarying; - setup(builder: any): void; - analyze(builder: any): void; - generate(builder: any): any; -} -import { Vector2 } from './three.core.js'; -import { Vector3 } from './three.core.js'; -import { Vector4 } from './three.core.js'; -/** - * A node for representing motion or velocity vectors. Foundation - * for advanced post processing effects like motion blur or TRAA. - * - * The node keeps track of the model, view and projection matrices - * of the previous frame and uses them to compute offsets in NDC space. - * These offsets represent the final velocity. - * - * @augments TempNode - */ -export class VelocityNode extends TempNode { - /** - * Constructs a new vertex color node. - */ - constructor(); - /** - * The current projection matrix. - * - * @type {?Matrix4} - * @default null - */ - projectionMatrix: Matrix4 | null; - /** - * Uniform node representing the previous model matrix in world space. - * - * @type {UniformNode} - * @default null - */ - previousModelWorldMatrix: UniformNode; - /** - * Uniform node representing the previous projection matrix. - * - * @type {UniformNode} - * @default null - */ - previousProjectionMatrix: UniformNode; - /** - * Uniform node representing the previous view matrix. - * - * @type {UniformNode} - * @default null - */ - previousCameraViewMatrix: UniformNode; - /** - * Sets the given projection matrix. - * - * @param {Matrix4} projectionMatrix - The projection matrix to set. - */ - setProjectionMatrix(projectionMatrix: Matrix4): void; - /** - * Updates velocity specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update({ frameId, camera, object }: NodeFrame): void; - /** - * Overwritten to updated velocity specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateAfter({ object }: NodeFrame): void; - /** - * Implements the velocity computation based on the previous and current vertex data. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Node} The motion vector. - */ - setup(): Node; -} -/** - * An attribute node for representing vertex colors. - * - * @augments AttributeNode - */ -export class VertexColorNode extends AttributeNode { - /** - * Constructs a new vertex color node. - * - * @param {number} index - The attribute index. - */ - constructor(index: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVertexColorNode: boolean; - /** - * The attribute index to enable more than one sets of vertex colors. - * - * @type {number} - * @default 0 - */ - index: number; -} -/** - * This node offers a collection of features in context of the depth logic in the fragment shader. - * Depending on {@link ViewportDepthNode#scope}, it can be used to define a depth value for the current - * fragment or for depth evaluation purposes. - * - * @augments Node - */ -export class ViewportDepthNode extends Node { - /** - * Constructs a new viewport depth node. - * - * @param {('depth'|'depthBase'|'linearDepth')} scope - The node's scope. - * @param {?Node} [valueNode=null] - The value node. - */ - constructor(scope: ("depth" | "depthBase" | "linearDepth"), valueNode?: Node | null); - /** - * The node behaves differently depending on which scope is selected. - * - * - `ViewportDepthNode.DEPTH_BASE`: Allows to define a value for the current fragment's depth. - * - `ViewportDepthNode.DEPTH`: Represents the depth value for the current fragment (`valueNode` is ignored). - * - `ViewportDepthNode.LINEAR_DEPTH`: Represents the linear (orthographic) depth value of the current fragment. - * If a `valueNode` is set, the scope can be used to convert perspective depth data to linear data. - * - * @type {('depth'|'depthBase'|'linearDepth')} - */ - scope: ("depth" | "depthBase" | "linearDepth"); - /** - * Can be used to define a custom depth value. - * The property is ignored in the `ViewportDepthNode.DEPTH` scope. - * - * @type {?Node} - * @default null - */ - valueNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isViewportDepthNode: boolean; - generate(builder: any): any; - setup({ camera }: { - camera: any; - }): any; -} -export namespace ViewportDepthNode { - export let DEPTH_BASE: string; - let DEPTH_1: string; - export { DEPTH_1 as DEPTH }; - export let LINEAR_DEPTH: string; -} -/** - * Represents the depth of the current viewport as a texture. This module - * can be used in combination with viewport texture to achieve effects - * that require depth evaluation. - * - * @augments ViewportTextureNode - */ -export class ViewportDepthTextureNode extends ViewportTextureNode { - /** - * Constructs a new viewport depth texture node. - * - * @param {Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, uses a shared depth texture. - */ - constructor(uvNode?: Node, levelNode?: Node | null, depthTexture?: DepthTexture | null); -} -/** - * `ViewportTextureNode` creates an internal texture for each node instance. This module - * shares a texture across all instances of `ViewportSharedTextureNode`. It should - * be the first choice when using data of the default/screen framebuffer for performance reasons. - * - * @augments ViewportTextureNode - */ -export class ViewportSharedTextureNode extends ViewportTextureNode { - /** - * Constructs a new viewport shared texture node. - * - * @param {Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - */ - constructor(uvNode?: Node, levelNode?: Node | null); - /** - * Overwritten so the method always returns the unique shared - * framebuffer texture. - * - * @return {FramebufferTexture} The shared framebuffer texture. - */ - getTextureForReference(): FramebufferTexture; - updateReference(): this; -} -/** - * A special type of texture node which represents the data of the current viewport - * as a texture. The module extracts data from the current bound framebuffer with - * a copy operation so no extra render pass is required to produce the texture data - * (which is good for performance). `ViewportTextureNode` can be used as an input for a - * variety of effects like refractive or transmissive materials. - * - * @augments TextureNode - */ -export class ViewportTextureNode extends TextureNode { - /** - * Constructs a new viewport texture node. - * - * @param {Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. - */ - constructor(uvNode?: Node, levelNode?: Node | null, framebufferTexture?: Texture | null); - /** - * Whether to generate mipmaps or not. - * - * @type {boolean} - * @default false - */ - generateMipmaps: boolean; - /** - * The reference framebuffer texture. This is used to store the framebuffer texture - * for the current render target. If the render target changes, a new framebuffer texture - * is created automatically. - * - * @type {FramebufferTexture} - * @default null - */ - defaultFramebuffer: FramebufferTexture; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOutputTextureNode: boolean; - /** - * The framebuffer texture for the current renderer context. - * - * @type {WeakMap} - * @private - */ - private _cacheTextures; - /** - * This methods returns a texture for the given render target or canvas target reference. - * - * To avoid rendering errors, `ViewportTextureNode` must use unique framebuffer textures - * for different render contexts. - * - * @param {?(RenderTarget|CanvasTarget)} [reference=null] - The render target or canvas target reference. - * @return {Texture} The framebuffer texture. - */ - getTextureForReference(reference?: (RenderTarget | CanvasTarget) | null): Texture; - updateReference(frame: any): Texture; - updateBefore(frame: any): void; - clone(): any; -} -/** - * Volume node material. - * - * @augments NodeMaterial - */ -export class VolumeNodeMaterial extends NodeMaterial { - /** - * Constructs a new volume node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVolumeNodeMaterial: boolean; - /** - * Number of steps used for raymarching. - * - * @type {number} - * @default 25 - */ - steps: number; - /** - * Offsets the distance a ray has been traveled through a volume. - * Can be used to implement dithering to reduce banding. - * - * @type {Node} - * @default null - */ - offsetNode: Node; - /** - * Node used for scattering calculations. - * - * @type {Function|FunctionNode} - * @default null - */ - scatteringNode: Function | FunctionNode; - setupLightingModel(): VolumetricLightingModel; -} -/** - * A node builder targeting WGSL. - * - * This module generates WGSL shader code from node materials and also - * generates the respective bindings and vertex buffer definitions. These - * data are later used by the renderer to create render and compute pipelines - * for render objects. - * - * @augments NodeBuilder - */ -export class WGSLNodeBuilder extends NodeBuilder { - /** - * Constructs a new WGSL node builder renderer. - * - * @param {Object3D} object - The 3D object. - * @param {Renderer} renderer - The renderer. - */ - constructor(object: Object3D, renderer: Renderer); - /** - * A dictionary that holds for each shader stage ('vertex', 'fragment', 'compute') - * another dictionary which manages UBOs per group ('render','frame','object'). - * - * @type {Object>} - */ - uniformGroups: { - [x: string]: { - [x: string]: NodeUniformsGroup; - }; - }; - /** - * A dictionary that holds the assigned binding indices for each uniform group. - * This ensures the same binding index is used across all shader stages. - * - * @type {Object} - */ - uniformGroupsBindings: { - [x: string]: { - index: number; - id: number; - }; - }; - /** - * A dictionary that holds for each shader stage a Map of builtins. - * - * @type {Object>} - */ - builtins: { - [x: string]: Map; - }; - /** - * A dictionary that holds for each shader stage a Set of directives. - * - * @type {Object>} - */ - directives: { - [x: string]: Set; - }; - /** - * A map for managing scope arrays. Only relevant for when using - * {@link WorkgroupInfoNode} in context of compute shaders. - * - * @type {Map} - */ - scopedArrays: Map; - /** - * A flag that indicates that early returns are allowed. - * - * @type {boolean} - * @default true - */ - allowEarlyReturns: boolean; - /** - * A flag that indicates that global variables are allowed. - * - * @type {boolean} - * @default true - */ - allowGlobalVariables: boolean; - /** - * Generates the WGSL snippet for sampled textures. - * - * @private - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - private _generateTextureSample; - /** - * Generates the WGSL snippet when sampling textures with explicit mip level. - * - * @private - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - private generateTextureSampleLevel; - /** - * Generates a wrap function used in context of textures. - * - * @param {Texture} texture - The texture to generate the function for. - * @return {string} The name of the generated function. - */ - generateWrapFunction(texture: Texture): string; - /** - * Generates a WGSL variable that holds the texture dimension of the given texture. - * It also returns information about the number of layers (elements) of an arrayed - * texture as well as the cube face count of cube textures. - * - * @param {Texture} texture - The texture to generate the function for. - * @param {string} textureProperty - The name of the video texture uniform in the shader. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @return {string} The name of the dimension variable. - */ - generateTextureDimension(texture: Texture, textureProperty: string, levelSnippet: string): string; - /** - * Generates the WGSL snippet that resolves the dimensions of the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level. - * @return {string} The WGSL snippet. - */ - generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; - /** - * Generates the WGSL snippet for a manual filtered texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @return {string} The WGSL snippet. - */ - generateFilteredTexture(texture: Texture, textureProperty: string, uvSnippet: string, offsetSnippet: string | null, levelSnippet?: string, depthSnippet: string | null): string; - /** - * Generates the WGSL snippet for a texture lookup with explicit level-of-detail. - * Since it's a lookup, no sampling or filtering is applied. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @return {string} The WGSL snippet. - */ - generateTextureLod(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, levelSnippet?: string): string; - /** - * Generates the WGSL snippet that reads a single texel from a storage texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateStorageTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet that writes a single texel to a texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {string} valueSnippet - A WGSL snippet that represent the new texel value. - * @return {string} The WGSL snippet. - */ - generateTextureStore(texture: Texture, textureProperty: string, uvIndexSnippet: string, depthSnippet: string | null, valueSnippet: string): string; - /** - * Returns `true` if the sampled values of the given texture should be compared against a reference value. - * - * @param {Texture} texture - The texture. - * @return {boolean} Whether the sampled values of the given texture should be compared against a reference value or not. - */ - isSampleCompare(texture: Texture): boolean; - /** - * Returns `true` if the given texture is unfilterable. - * - * @param {Texture} texture - The texture. - * @return {boolean} Whether the given texture is unfilterable or not. - */ - isUnfilterable(texture: Texture): boolean; - /** - * Generates the WGSL snippet for sampling/loading the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the WGSL snippet for sampling/loading the given texture using explicit gradients. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {Array} gradSnippet - An array holding both gradient WGSL snippets. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values - * against a reference value. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A WGSL snippet that represents the reference value. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the WGSL snippet for gathering four texels from the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} gatherSnippet - A WGSL snippet that represents the index of the channel to read. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet for performing a depth comparison on four texels in the given depth texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A WGSL snippet that represents the reference value. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet when sampling textures with explicit mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet when sampling textures with a bias to the mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} biasSnippet - A WGSL snippet that represents the bias to apply to the mip level before sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Returns a WGSL snippet that represents the property name of the given node. - * - * @param {Node} node - The node. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The property name. - */ - getPropertyName(node: Node, shaderStage?: string): string; - /** - * Returns whether the given name is a reserved keyword of WGSL. - * - * @param {string} name - The name to test. - * @return {boolean} Whether the name is a reserved keyword or not. - */ - isReservedKeyword(name: string): boolean; - /** - * Returns the native shader operator name for a given generic name. - * - * @param {string} op - The operator name to resolve. - * @return {?string} The resolved operator name. - */ - getFunctionOperator(op: string): string | null; - /** - * Returns the node access for the given node and shader stage. - * - * @param {StorageTextureNode|StorageBufferNode} node - The storage node. - * @param {string} shaderStage - The shader stage. - * @return {string} The node access. - */ - getNodeAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; - /** - * Returns A WGSL snippet representing the storage access. - * - * @param {StorageTextureNode|StorageBufferNode} node - The storage node. - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet representing the storage access. - */ - getStorageAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; - /** - * This method is one of the more important ones since it's responsible - * for generating a matching binding instance for the given uniform node. - * - * These bindings are later used in the renderer to create bind groups - * and layouts. - * - * @param {UniformNode} node - The uniform node. - * @param {string} type - The node data type. - * @param {string} shaderStage - The shader stage. - * @param {?string} [name=null] - An optional uniform name. - * @return {NodeUniform} The node uniform object. - */ - getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; - /** - * This method should be used whenever builtins are required in nodes. - * The internal builtins data structure will make sure builtins are - * defined in the WGSL source. - * - * @param {string} name - The builtin name. - * @param {string} property - The property name. - * @param {string} type - The node data type. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The property name. - */ - getBuiltin(name: string, property: string, type: string, shaderStage?: string): string; - /** - * Returns `true` if the given builtin is defined in the given shader stage. - * - * @param {string} name - The builtin name. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {boolean} Whether the given builtin is defined in the given shader stage or not. - */ - hasBuiltin(name: string, shaderStage?: string): boolean; - /** - * Builds the given shader node. - * - * @param {ShaderNodeInternal} shaderNode - The shader node. - * @return {string} The WGSL function code. - */ - buildFunctionCode(shaderNode: ShaderNodeInternal): string; - /** - * Returns a builtin representing the index of a compute invocation within the scope of a workgroup load. - * - * @return {string} The invocation local index. - */ - getInvocationLocalIndex(): string; - /** - * Returns a builtin representing the size of a subgroup within the current shader. - * - * @return {string} The subgroup size. - */ - getSubgroupSize(): string; - /** - * Returns a builtin representing the index of a compute invocation within the scope of a subgroup. - * - * @return {string} The invocation subgroup index. - */ - getInvocationSubgroupIndex(): string; - /** - * Returns a builtin representing the index of a compute invocation's subgroup within its workgroup. - * - * @return {string} The subgroup index. - */ - getSubgroupIndex(): string; - /** - * Overwritten as a NOP since this method is intended for the WebGL 2 backend. - * - * @return {null} Null. - */ - getDrawIndex(): null; - /** - * Returns the frag depth builtin. - * - * @return {string} The frag depth builtin. - */ - getFragDepth(): string; - /** - * Returns the clip distances builtin. - * - * @return {string} The clip distances builtin. - */ - getClipDistance(): string; - /** - * Enables the given directive for the given shader stage. - * - * @param {string} name - The directive name. - * @param {string} [shaderStage=this.shaderStage] - The shader stage to enable the directive for. - */ - enableDirective(name: string, shaderStage?: string): void; - /** - * Returns the directives of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} A WGSL snippet that enables the directives of the given stage. - */ - getDirectives(shaderStage: string): string; - /** - * Enables the 'subgroups' directive. - */ - enableSubGroups(): void; - /** - * Enables the 'subgroups-f16' directive. - */ - enableSubgroupsF16(): void; - /** - * Enables the 'clip_distances' directive. - */ - enableClipDistances(): void; - /** - * Enables the 'f16' directive. - */ - enableShaderF16(): void; - /** - * Enables the 'dual_source_blending' directive. - */ - enableDualSourceBlending(): void; - /** - * Enables hardware clipping. - * - * @param {string} planeCount - The clipping plane count. - */ - enableHardwareClipping(planeCount: string): void; - /** - * Returns the builtins of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} A WGSL snippet that represents the builtins of the given stage. - */ - getBuiltins(shaderStage: string): string; - /** - * This method should be used when a new scoped buffer is used in context of - * compute shaders. It adds the array to the internal data structure which is - * later used to generate the respective WGSL. - * - * @param {string} name - The array name. - * @param {string} scope - The scope. - * @param {string} bufferType - The buffer type. - * @param {string} bufferCount - The buffer count. - * @return {string} The array name. - */ - getScopedArray(name: string, scope: string, bufferType: string, bufferCount: string): string; - /** - * Returns the scoped arrays of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string|undefined} The WGSL snippet that defines the scoped arrays. - * Returns `undefined` when used in the vertex or fragment stage. - */ - getScopedArrays(shaderStage: string): string | undefined; - /** - * Returns the shader attributes of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the shader attributes. - */ - getAttributes(shaderStage: string): string; - /** - * Returns the members of the given struct type node as a WGSL string. - * - * @param {StructTypeNode} struct - The struct type node. - * @return {string} The WGSL snippet that defines the struct members. - */ - getStructMembers(struct: StructTypeNode): string; - /** - * Returns the structs of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the structs. - */ - getStructs(shaderStage: string): string; - /** - * Returns a WGSL string representing a variable. - * - * @param {string} type - The variable's type. - * @param {string} name - The variable's name. - * @param {?number} [count=null] - The array length. - * @param {string} [qualifier=''] - The variable's qualifier. - * @return {string} The WGSL snippet that defines a variable. - */ - getVar(type: string, name: string, count?: number | null, qualifier?: string): string; - /** - * Returns the variables of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the variables. - */ - getVars(shaderStage: string, global?: boolean): string; - /** - * Returns the varyings of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the varyings. - */ - getVaryings(shaderStage: string): string; - isCustomStruct(nodeUniform: any): any; - /** - * Returns the uniforms of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the uniforms. - */ - getUniforms(shaderStage: string): string; - /** - * Returns the native shader method name for a given generic name. - * - * @param {string} method - The method name to resolve. - * @param {?string} [output=null] - An optional output. - * @return {string} The resolved WGSL method name. - */ - getMethod(method: string, output?: string | null): string; - /** - * Returns the bitcast method name for a given input and outputType. - * - * @param {string} type - The output type to bitcast to. - * @return {string} The resolved WGSL bitcast invocation. - */ - getBitcastMethod(type: string): string; - /** - * Returns the float packing method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolve WGSL float packing method name. - */ - getFloatPackingMethod(encoding: string, layout?: string): string; - /** - * Returns the float unpacking method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolve WGSL float unpacking method name. - */ - getFloatUnpackingMethod(encoding: string, layout?: string): string; - /** - * Returns the native snippet for a ternary operation. - * - * @param {string} condSnippet - The condition determining which expression gets resolved. - * @param {string} ifSnippet - The expression to resolve to if the condition is true. - * @param {string} elseSnippet - The expression to resolve to if the condition is false. - * @return {string} The resolved method name. - */ - getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; - /** - * Whether the requested feature is available or not. - * - * @param {string} name - The requested feature. - * @return {boolean} Whether the requested feature is supported or not. - */ - isAvailable(name: string): boolean; - /** - * Returns the native shader method name for a given generic name. - * - * @private - * @param {string} method - The method name to resolve. - * @return {string} The resolved WGSL method name. - */ - private _getWGSLMethod; - /** - * Includes the given method name into the current - * function node. - * - * @private - * @param {string} name - The method name to include. - * @return {CodeNode} The respective code node. - */ - private _include; - /** - * Returns a WGSL vertex shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getWGSLVertexCode; - /** - * Returns a WGSL fragment shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getWGSLFragmentCode; - /** - * Returns a WGSL compute shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @param {string} workgroupSize - The workgroup size. - * @return {string} The vertex shader. - */ - private _getWGSLComputeCode; - /** - * Returns a WGSL struct based on the given name and variables. - * - * @private - * @param {string} name - The struct name. - * @param {string} vars - The struct variables. - * @return {string} The WGSL snippet representing a struct. - */ - private _getWGSLStruct; - /** - * Returns a WGSL struct binding. - * - * @private - * @param {string} name - The struct name. - * @param {string} vars - The struct variables. - * @param {string} access - The access. - * @param {number} [binding=0] - The binding index. - * @param {number} [group=0] - The group index. - * @return {string} The WGSL snippet representing a struct binding. - */ - private _getWGSLStructBinding; -} -/** - * A backend implementation targeting WebGL 2. - * - * @private - * @augments Backend - */ -export class WebGLBackend extends Backend { - /** - * WebGLBackend options. - * - * @typedef {Object} WebGLBackend~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. - * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. - * @property {WebGL2RenderingContext} [context=undefined] - A WebGL 2 rendering context. - */ - /** - * Constructs a new WebGPU backend. - * - * @param {WebGLBackend~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLBackend: boolean; - /** - * A reference to a backend module holding shader attribute-related - * utility functions. - * - * @type {?WebGLAttributeUtils} - * @default null - */ - attributeUtils: WebGLAttributeUtils | null; - /** - * A reference to a backend module holding extension-related - * utility functions. - * - * @type {?WebGLExtensions} - * @default null - */ - extensions: WebGLExtensions | null; - /** - * A reference to a backend module holding capability-related - * utility functions. - * - * @type {?WebGLCapabilities} - * @default null - */ - capabilities: WebGLCapabilities | null; - /** - * A reference to a backend module holding texture-related - * utility functions. - * - * @type {?WebGLTextureUtils} - * @default null - */ - textureUtils: WebGLTextureUtils | null; - /** - * A reference to a backend module holding renderer-related - * utility functions. - * - * @type {?WebGLBufferRenderer} - * @default null - */ - bufferRenderer: WebGLBufferRenderer | null; - /** - * A reference to the rendering context. - * - * @type {?WebGL2RenderingContext} - * @default null - */ - gl: WebGL2RenderingContext | null; - /** - * A reference to a backend module holding state-related - * utility functions. - * - * @type {?WebGLState} - * @default null - */ - state: WebGLState | null; - /** - * A reference to a backend module holding common - * utility functions. - * - * @type {?WebGLUtils} - * @default null - */ - utils: WebGLUtils | null; - /** - * Dictionary for caching VAOs. - * - * @type {Object} - */ - vaoCache: { - [x: string]: WebGLVertexArrayObject; - }; - /** - * Dictionary for caching transform feedback objects. - * - * @type {Object} - */ - transformFeedbackCache: { - [x: string]: WebGLTransformFeedback; - }; - /** - * Controls if `gl.RASTERIZER_DISCARD` should be enabled or not. - * Only relevant when using compute shaders. - * - * @type {boolean} - * @default false - */ - discard: boolean; - /** - * A reference to the `EXT_disjoint_timer_query_webgl2` extension. `null` if the - * device does not support the extension. - * - * @type {?EXTDisjointTimerQueryWebGL2} - * @default null - */ - disjoint: EXTDisjointTimerQueryWebGL2 | null; - /** - * A reference to the `KHR_parallel_shader_compile` extension. `null` if the - * device does not support the extension. - * - * @type {?KHRParallelShaderCompile} - * @default null - */ - parallel: KHRParallelShaderCompile | null; - /** - * A reference to the current render context. - * - * @private - * @type {RenderContext} - * @default null - */ - private _currentContext; - /** - * A unique collection of bindings. - * - * @private - * @type {WeakSet>} - */ - private _knownBindings; - /** - * Whether the device supports framebuffers invalidation or not. - * - * @private - * @type {boolean} - */ - private _supportsInvalidateFramebuffer; - /** - * The target framebuffer when rendering with - * the WebXR device API. - * - * @private - * @type {?WebGLFramebuffer} - * @default null - */ - private _xrFramebuffer; - /** - * Initializes the backend so it is ready for usage. - * - * @param {Renderer} renderer - The renderer. - */ - init(renderer: Renderer): void; - _onContextLost: ((event: any) => void) | undefined; - drawBuffersIndexedExt: Object | undefined; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @param {number} offset - The storage buffer attribute. - * @param {number} count - The offset from which to start reading the - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Ensures the backend is XR compatible. - * - * @async - * @return {Promise} A Promise that resolve when the renderer is XR compatible. - */ - makeXRCompatible(): Promise; - /** - * Sets the XR rendering destination. - * - * @param {WebGLFramebuffer} xrFramebuffer - The XR framebuffer. - */ - setXRTarget(xrFramebuffer: WebGLFramebuffer): void; - /** - * Configures the given XR render target with external textures. - * - * This method is only relevant when using the WebXR Layers API. - * - * @param {XRRenderTarget} renderTarget - The XR render target. - * @param {WebGLTexture} colorTexture - A native color texture. - * @param {?WebGLTexture} [depthTexture=null] - A native depth texture. - */ - setXRRenderTargetTextures(renderTarget: XRRenderTarget, colorTexture: WebGLTexture, depthTexture?: WebGLTexture | null): void; - /** - * Inits a time stamp query for the given render context. - * - * @param {string} type - The type of the timestamp query. - * @param {string} uid - A unique identifier for the timestamp query. - */ - initTimestampQuery(type: string, uid: string): void; - /** - * Prepares the timestamp buffer. - * - * @param {string} type - The type of the timestamp query. - * @param {string} uid - A unique identifier for the timestamp query. - */ - prepareTimestampBuffer(type: string, uid: string): void; - /** - * Returns the backend's rendering context. - * - * @return {WebGL2RenderingContext} The rendering context. - */ - getContext(): WebGL2RenderingContext; - /** - * This method is executed at the beginning of a render call and prepares - * the WebGL state for upcoming render calls - * - * @param {RenderContext} renderContext - The render context. - */ - beginRender(renderContext: RenderContext): void; - /** - * This method is executed at the end of a render call and finalizes work - * after draw calls. - * - * @param {RenderContext} renderContext - The render context. - */ - finishRender(renderContext: RenderContext): void; - /** - * This method processes the result of occlusion queries and writes it - * into render context data. - * - * @async - * @param {RenderContext} renderContext - The render context. - */ - resolveOccludedAsync(renderContext: RenderContext): void; - /** - * Returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(renderContext: RenderContext, object: Object3D): boolean; - /** - * Updates the viewport with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateViewport(renderContext: RenderContext): void; - /** - * Updates the scissor with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateScissor(renderContext: RenderContext): void; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Performs a clear operation. - * - * @param {boolean} color - Whether the color buffer should be cleared or not. - * @param {boolean} depth - Whether the depth buffer should be cleared or not. - * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. - * @param {?Object} [descriptor=null] - The render context of the current set render target. - * @param {boolean} [setFrameBuffer=true] - Controls whether the intermediate framebuffer should be set or not. - * @param {boolean} [resolveRenderTarget=true] - Controls whether an active render target should be resolved - * or not. Only relevant for explicit clears. - */ - clear(color: boolean, depth: boolean, stencil: boolean, descriptor?: Object | null, setFrameBuffer?: boolean, resolveRenderTarget?: boolean): void; - /** - * This method is executed at the beginning of a compute call and - * prepares the state for upcoming compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - beginCompute(computeGroup: Node | Array): void; - /** - * Executes a compute command for the given compute node. - * - * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. - * @param {Node} computeNode - The compute node. - * @param {Array} bindings - The bindings. - * @param {ComputePipeline} pipeline - The compute pipeline. - * @param {?number} [count=null] - The count of compute invocations. If `null`, the count is determined by the compute node. - */ - compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, count?: number | null): void; - /** - * This method is executed at the end of a compute call and - * finalizes work after compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - finishCompute(computeGroup: Node | Array): void; - /** - * Internal to determine if the current render target is a render target array with depth 2D array texture. - * - * @param {RenderContext} renderContext - The render context. - * @return {boolean} Whether the render target is a render target array with depth 2D array texture. - * - * @private - */ - private _isRenderCameraDepthArray; - /** - * Internal draw function. - * - * @private - * @param {Object3D} object - The object to render. - * @param {WebGLBufferRenderer} renderer - The internal renderer. - * @param {number} firstVertex - The first vertex to render. - * @param {number} vertexCount - The vertex count. - * @param {number} instanceCount - The intance count. - * @param {WebGLProgram} programGPU - The raw WebGL shader program. - */ - private _draw; - /** - * Executes a draw command for the given render object. - * - * @param {RenderObject} renderObject - The render object to draw. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - */ - draw(renderObject: RenderObject): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(texture: Texture): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(texture: Texture, options?: Object): void; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - */ - generateMipmaps(texture: Texture): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Returns a node builder for the given render object. - * - * @param {RenderObject} object - The render object. - * @param {Renderer} renderer - The renderer. - * @return {GLSLNodeBuilder} The node builder. - */ - createNodeBuilder(object: RenderObject, renderer: Renderer): GLSLNodeBuilder; - /** - * Creates a shader program from the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - createProgram(program: ProgrammableStage): void; - /** - * Destroys the shader program of the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - destroyProgram(program: ProgrammableStage): void; - /** - * Creates a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(renderObject: RenderObject, promises: Array>): void; - /** - * Formats the source code of error messages. - * - * @private - * @param {string} string - The code. - * @param {number} errorLine - The error line. - * @return {string} The formatted code. - */ - private _handleSource; - /** - * Gets the shader compilation errors from the info log. - * - * @private - * @param {WebGL2RenderingContext} gl - The rendering context. - * @param {WebGLShader} shader - The WebGL shader object. - * @param {string} type - The shader type. - * @return {string} The shader errors. - */ - private _getShaderErrors; - /** - * Logs shader compilation errors. - * - * @private - * @param {WebGLProgram} programGPU - The WebGL program. - * @param {WebGLShader} glFragmentShader - The fragment shader as a native WebGL shader object. - * @param {WebGLShader} glVertexShader - The vertex shader as a native WebGL shader object. - */ - private _logProgramError; - /** - * Completes the shader program setup for the given render object. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {RenderPipeline} pipeline - The render pipeline. - */ - private _completeCompile; - /** - * Creates a compute pipeline for the given compute node. - * - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; - /** - * Completes the compute pipeline setup for the given compute pipeline. - * - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - Array of bind groups. - */ - _completeComputeCompile(computePipeline: ComputePipeline, bindings: Array): void; - /** - * Creates bindings from the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(bindGroup: BindGroup, bindings: Array): void; - /** - * Updates the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - updateBindings(bindGroup: BindGroup): void; - /** - * Updates a buffer binding. - * - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(binding: Buffer): void; - /** - * Creates a uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - createUniformBuffer(uniformBuffer: Buffer): void; - /** - * Destroys the GPU data for the given uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - destroyUniformBuffer(uniformBuffer: Buffer): void; - /** - * Creates the GPU buffer of an indexed shader attribute. - * - * @param {BufferAttribute} attribute - The indexed buffer attribute. - */ - createIndexAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a storage attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createStorageAttribute(attribute: BufferAttribute): void; - /** - * Updates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to update. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * Destroys the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to destroy. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * Checks if the given feature is supported by the backend. - * - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(name: string): boolean; - /** - * Copies data of the given source texture to the given destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; - /** - * Checks if the given compatibility is supported by the backend. - * - * @param {string} name - The compatibility name. - * @return {boolean} Whether the compatibility is supported or not. - */ - hasCompatibility(name: string): boolean; - /** - * Initializes the render target defined in the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - initRenderTarget(renderContext: RenderContext): void; - /** - * Configures the active framebuffer from the given render context. - * - * @private - * @param {RenderContext} descriptor - The render context. - */ - private _setFramebuffer; - /** - * Computes the VAO key for the given index and attributes. - * - * @private - * @param {Array} attributes - An array of buffer attributes. - * @return {string} The VAO key. - */ - private _getVaoKey; - /** - * Creates a VAO from the index and attributes. - * - * @private - * @param {Array} attributes - An array of buffer attributes. - * @return {Object} The VAO data. - */ - private _createVao; - /** - * Creates a transform feedback from the given transform buffers. - * - * @private - * @param {Array} transformBuffers - The transform buffers. - * @return {WebGLTransformFeedback} The transform feedback. - */ - private _getTransformFeedback; - /** - * Setups the given bindings. - * - * @private - * @param {Array} bindings - The bindings. - * @param {WebGLProgram} programGPU - The WebGL program. - */ - private _setupBindings; - /** - * Binds the given uniforms. - * - * @private - * @param {Array} bindings - The bindings. - */ - private _bindUniforms; - /** - * The method ensures multisampled render targets are resolved. - * - * @private - * @param {RenderContext} renderContext - The render context. - */ - private _resolveRenderTarget; - /** - * Returns `true` if the `WEBGL_multisampled_render_to_texture` extension - * should be used when MSAA is enabled. - * - * @private - * @param {RenderTarget} renderTarget - The render target that should be multisampled. - * @return {boolean} Whether to use the `WEBGL_multisampled_render_to_texture` extension for MSAA or not. - */ - private _useMultisampledExtension; -} -/** - * A WebGL 2 backend utility module for managing the device's capabilities. - * - * @private - */ -export class WebGLCapabilities { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * This value holds the cached max anisotropy value. - * - * @type {?number} - * @default null - */ - maxAnisotropy: number | null; - /** - * This value holds the cached max uniform block size value. - * - * @type {?number} - * @default null - */ - maxUniformBlockSize: number | null; - /** - * Returns the maximum anisotropy texture filtering value. This value - * depends on the device and is reported by the `EXT_texture_filter_anisotropic` - * WebGL extension. - * - * @return {number} The maximum anisotropy texture filtering value. - */ - getMaxAnisotropy(): number; - /** - * Returns the maximum number of bytes available for uniform buffers. - * - * @return {number} The maximum number of bytes available for uniform buffers. - */ - getUniformBufferLimit(): number; -} -import { WebGLCoordinateSystem } from './three.core.js'; -/** - * A backend implementation targeting WebGPU. - * - * @private - * @augments Backend - */ -export class WebGPUBackend extends Backend { - /** - * WebGPUBackend options. - * - * @typedef {Object} WebGPUBackend~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. - * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. - * @property {boolean} [trackTimestamp=false] - Whether to track timestamps with a Timestamp Query API or not. - * @property {string} [powerPreference=undefined] - The power preference. - * @property {Object} [requiredLimits=undefined] - Specifies the limits that are required by the device request. The request will fail if the adapter cannot provide these limits. - * @property {GPUDevice} [device=undefined] - If there is an existing GPU device on app level, it can be passed to the renderer as a parameter. - * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. - */ - /** - * Constructs a new WebGPU backend. - * - * @param {WebGPUBackend~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGPUBackend: boolean; - /** - * Indicates whether the backend is in WebGPU compatibility mode or not. - * The backend must be initialized before the property can be evaluated. - * - * @type {?boolean} - * @readonly - * @default null - */ - readonly compatibilityMode: boolean | null; - /** - * A reference to the device. - * - * @type {?GPUDevice} - * @default null - */ - device: GPUDevice | null; - /** - * A reference to the default render pass descriptor. - * - * @type {?Object} - * @default null - */ - defaultRenderPassdescriptor: Object | null; - /** - * A reference to a backend module holding common utility functions. - * - * @type {WebGPUUtils} - */ - utils: WebGPUUtils; - /** - * A reference to a backend module holding shader attribute-related - * utility functions. - * - * @type {WebGPUAttributeUtils} - */ - attributeUtils: WebGPUAttributeUtils; - /** - * A reference to a backend module holding shader binding-related - * utility functions. - * - * @type {WebGPUBindingUtils} - */ - bindingUtils: WebGPUBindingUtils; - /** - * A reference to a backend module holding device capability related - * utility functions. - * - * @type {WebGPUCapabilities} - */ - capabilities: WebGPUCapabilities; - /** - * A reference to a backend module holding shader pipeline-related - * utility functions. - * - * @type {WebGPUPipelineUtils} - */ - pipelineUtils: WebGPUPipelineUtils; - /** - * A reference to a backend module holding shader texture-related - * utility functions. - * - * @type {WebGPUTextureUtils} - */ - textureUtils: WebGPUTextureUtils; - /** - * A map that manages the resolve buffers for occlusion queries. - * - * @type {Map} - */ - occludedResolveCache: Map; - /** - * A map of compatibility checks. - * - * @type {Object} - */ - _compatibility: Object; - /** - * Registers external GPU textures from `XRGPUBinding` for use in rendering. - * - * @param {RenderTarget} renderTarget - The render target to register the textures for. - * @param {GPUTexture} colorTexture - The shared XR color GPUTexture. - * @param {?Array} [viewDescriptors=null] - Optional view descriptors, one per XR view. - */ - setXRRenderTargetTextures(renderTarget: RenderTarget, colorTexture: GPUTexture, viewDescriptors?: Array | null): void; - /** - * A reference to the context. - * - * @type {?GPUCanvasContext} - * @default null - */ - get context(): GPUCanvasContext | null; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {number} count - The offset from which to start reading the - * @param {number} offset - The storage buffer attribute. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Returns the backend's rendering context. - * - * @return {GPUCanvasContext} The rendering context. - */ - getContext(): GPUCanvasContext; - /** - * Returns the default render pass descriptor. - * - * In WebGPU, the default framebuffer must be configured - * like custom framebuffers so the backend needs a render - * pass descriptor even when rendering directly to screen. - * - * @private - * @return {GPURenderPassDescriptor} The render pass descriptor. - */ - private _getDefaultRenderPassDescriptor; - /** - * Returns whether the render target is a render target array with depth 2D array texture. - * - * @param {RenderContext} renderContext - The render context. - * @return {boolean} Whether the render target is a render target array with depth 2D array texture. - * - * @private - */ - private _isRenderCameraDepthArray; - /** - * Returns whether the current render context references external textures. - * - * External textures can change every frame, so their descriptors must not be cached. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @return {boolean} Whether the render context uses external textures. - */ - private _hasExternalTexture; - /** - * Returns multisampled color textures for an external render target. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @param {Object} textureData - The backend data for the external texture. - * @param {number} count - The number of textures to create. - * @return {?Array} The multisampled textures. - */ - private _getExternalMSAATextures; - /** - * Creates attachment views for an external texture render target. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @param {Object} textureData - The backend data for the texture. - * @return {Array} The attachment view descriptors. - */ - private _createExternalTextureViews; - /** - * Returns the render pass descriptor for the given render context. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @param {Object} colorAttachmentsConfig - Configuration object for the color attachments. - * @return {Object} The render pass descriptor. - */ - private _getRenderPassDescriptor; - /** - * This method is executed at the beginning of a render call and prepares - * the WebGPU state for upcoming render calls - * - * @param {RenderContext} renderContext - The render context. - */ - beginRender(renderContext: RenderContext): void; - /** - * Resets the state cache of the given render context data. - * - * A new render pass encoder starts with a blend constant and a stencil reference - * of zero so the cached values must be reset as well. - * - * @private - * @param {Object} renderContextData - The render context data. - */ - private _resetRenderContextData; - /** - * Creates a render bundle encoder and state cache for each camera layer. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object} renderContextData - The render context data. - * @private - */ - private _createArrayCameraBundleEncoders; - /** - * Finishes the render bundle encoders for all camera layers. - * - * @param {Object} renderContextData - The render context data. - * @return {Array} The completed render bundles. - * @private - */ - private _finishArrayCameraBundleEncoders; - /** - * Creates render pass descriptors for each camera in an array camera. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object} renderContextData - The render context data. - * @param {Object} descriptor - The render pass descriptor. - * @param {ArrayCamera} cameras - The array camera. - * - * @private - */ - private _createArrayCameraLayerDescriptors; - /** - * Updates render pass descriptors for each camera in an array camera. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object} renderContextData - The render context data. - * @param {Object} descriptor - The render pass descriptor. - * @param {ArrayCamera} cameras - The array camera. - * - */ - _updateArrayCameraLayerDescriptors(renderContext: RenderContext, renderContextData: Object, descriptor: Object, cameras: ArrayCamera): void; - /** - * This method is executed at the end of a render call and finalizes work - * after draw calls. - * - * @param {RenderContext} renderContext - The render context. - */ - finishRender(renderContext: RenderContext): void; - /** - * Returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(renderContext: RenderContext, object: Object3D): boolean; - /** - * This method processes the result of occlusion queries and writes it - * into render context data. - * - * @async - * @param {RenderContext} renderContext - The render context. - * @return {Promise} A Promise that resolves when the occlusion query results have been processed. - */ - resolveOccludedAsync(renderContext: RenderContext): Promise; - /** - * Updates the viewport with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateViewport(renderContext: RenderContext): void; - /** - * Updates the scissor with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateScissor(renderContext: RenderContext): void; - /** - * Performs a clear operation. - * - * @param {boolean} color - Whether the color buffer should be cleared or not. - * @param {boolean} depth - Whether the depth buffer should be cleared or not. - * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. - * @param {?RenderContext} [renderTargetContext=null] - The render context of the current set render target. - */ - clear(color: boolean, depth: boolean, stencil: boolean, renderTargetContext?: RenderContext | null): void; - /** - * This method is executed at the beginning of a compute call and - * prepares the state for upcoming compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - beginCompute(computeGroup: Node | Array): void; - /** - * Executes a compute command for the given compute node. - * - * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. - * @param {Node} computeNode - The compute node. - * @param {Array} bindings - The bindings. - * @param {ComputePipeline} pipeline - The compute pipeline. - * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] - * - A single number representing count, or - * - An array [x, y, z] representing dispatch size, or - * - A IndirectStorageBufferAttribute for indirect dispatch size. - */ - compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, dispatchSize?: number | Array | IndirectStorageBufferAttribute): void; - /** - * This method is executed at the end of a compute call and - * finalizes work after compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - finishCompute(computeGroup: Node | Array): void; - /** - * Internal draw function that performs the draw with the given pass encoder. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - * @param {Object} renderContextData - The render context data object, holding current pass state and occlusion query tracking. - * @param {GPURenderPipeline} pipelineGPU - The GPU render pipeline. - * @param {Array} bindings - The bind groups. - * @param {Array} vertexBuffers - The vertex buffers. - * @param {{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} drawParams - The draw parameters. - * @param {GPURenderPassEncoder|GPURenderBundleEncoder} passEncoderGPU - The GPU pass encoder used for recording draw commands. - * @param {Object} currentSets - Tracking object for currently set pipeline, attributes, bind groups, and index state. - * @param {number} [cameraIndexSlot=-1] - Index of the binding slot holding the camera index bind group. - */ - private _draw; - /** - * Executes a draw command for the given render object. - * - * @param {RenderObject} renderObject - The render object to draw. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - */ - draw(renderObject: RenderObject, info: Info): void; - /** - * Returns `true` if the render pipeline requires an update. - * - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the render pipeline requires an update or not. - */ - needsRenderUpdate(renderObject: RenderObject): boolean; - /** - * Returns a cache key that is used to identify render pipelines. - * - * @param {RenderObject} renderObject - The render object. - * @return {string} The cache key. - */ - getRenderCacheKey(renderObject: RenderObject): string; - /** - * Updates a GPU sampler for the given texture. - * - * @param {Sampler} binding - The sampler binding to update. - * @return {string} The current sampler key. - */ - updateSampler(binding: Sampler): string; - /** - * Frees the GPU sampler for the given sampler binding. - * - * @param {Sampler} binding - The sampler binding to free. - */ - destroySampler(binding: Sampler): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - * @return {boolean} Whether the sampler has been updated or not. - */ - createDefaultTexture(texture: Texture): boolean; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(texture: Texture, options?: Object): void; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - */ - generateMipmaps(texture: Texture): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Inits a time stamp query for the given render context. - * - * @param {string} type - The type of the timestamp query (e.g. 'render', 'compute'). - * @param {number} uid - Unique id for the context (e.g. render context id). - * @param {Object} descriptor - The query descriptor. - */ - initTimestampQuery(type: string, uid: number, descriptor: Object): void; - /** - * Returns a node builder for the given render object. - * - * @param {RenderObject} object - The render object. - * @param {Renderer} renderer - The renderer. - * @return {WGSLNodeBuilder} The node builder. - */ - createNodeBuilder(object: RenderObject, renderer: Renderer): WGSLNodeBuilder; - /** - * Creates a shader program from the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - createProgram(program: ProgrammableStage): void; - /** - * Destroys the shader program of the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - destroyProgram(program: ProgrammableStage): void; - /** - * Creates a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(renderObject: RenderObject, promises: Array>): void; - /** - * Creates a compute pipeline for the given compute node. - * - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; - /** - * Prepares the state for encoding render bundles. - * - * @param {RenderContext} renderContext - The render context. - */ - beginBundle(renderContext: RenderContext): void; - /** - * After processing render bundles this method finalizes related work. - * - * @param {RenderContext} renderContext - The render context. - * @param {RenderBundle} bundle - The render bundle. - */ - finishBundle(renderContext: RenderContext, bundle: RenderBundle): void; - /** - * Adds a render bundle to the render context data. - * - * @param {RenderContext} renderContext - The render context. - * @param {RenderBundle} bundle - The render bundle to add. - */ - addBundle(renderContext: RenderContext, bundle: RenderBundle): void; - /** - * Creates a uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - createUniformBuffer(uniformBuffer: Buffer): void; - /** - * Destroys the GPU data for the given uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - destroyUniformBuffer(uniformBuffer: Buffer): void; - /** - * Creates bindings from the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; - /** - * Updates the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - updateBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; - /** - * Updates a buffer binding. - * - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(binding: Buffer): void; - /** - * Delete data associated with the current bind group. - * - * @param {BindGroup} bindGroup - The bind group. - */ - deleteBindGroupData(bindGroup: BindGroup): void; - /** - * Creates the buffer of an indexed shader attribute. - * - * @param {BufferAttribute} attribute - The indexed buffer attribute. - */ - createIndexAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a storage attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createStorageAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of an indirect storage attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createIndirectStorageAttribute(attribute: BufferAttribute): void; - /** - * Updates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to update. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * Destroys the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to destroy. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * Checks if the given feature is supported by the backend. - * - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(name: string): boolean; - /** - * Copies data of the given source texture to the given destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The mipmap level to copy. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; - /** - * Encodes a framebuffer copy from a specific texture-array layer. - * - * @param {GPUCommandEncoder} encoder - The command encoder. - * @param {Texture} texture - The destination texture. - * @param {GPUTexture} sourceGPU - The source GPU texture. - * @param {GPUTexture} destinationGPU - The destination GPU texture. - * @param {Object} rectangle - The source rectangle. - * @param {number} [sourceLayer=0] - The source array layer. - * @param {boolean} [generateMipmaps=texture.generateMipmaps] - Whether mipmaps should be generated. - * @private - */ - private _copyFramebufferToTexture; - /** - * Checks if the given compatibility is supported by the backend. - * - * @param {string} name - The compatibility name. - * @return {boolean} Whether the compatibility is supported or not. - */ - hasCompatibility(name: string): boolean; -} -import { WebGPUCoordinateSystem } from './three.core.js'; -/** - * This renderer is the new alternative of `WebGLRenderer`. `WebGPURenderer` has the ability - * to target different backends. By default, the renderer tries to use a WebGPU backend if the - * browser supports WebGPU. If not, `WebGPURenderer` falls backs to a WebGL 2 backend. - * - * @augments Renderer - */ -export class WebGPURenderer extends Renderer { - /** - * WebGPURenderer options. - * - * @typedef {Object} WebGPURenderer~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. - * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. - * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. - * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. - * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best - * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. - */ - /** - * Constructs a new WebGPU renderer. - * - * @param {WebGPURenderer~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGPURenderer: boolean; -} -import { WebXRController } from './three.core.js'; -/** - * A node allowing the user to create a 'workgroup' scoped buffer within the - * context of a compute shader. Typically, workgroup scoped buffers are - * created to hold data that is transferred from a global storage scope into - * a local workgroup scope. For invocations within a workgroup, data - * access speeds on 'workgroup' scoped buffers can be significantly faster - * than similar access operations on globally accessible storage buffers. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -export class WorkgroupInfoNode extends Node { - /** - * Constructs a new workgroup info node. - * - * @param {string} scope - The address space the buffer is scoped to. Currently only `'Workgroup'` is used. - * @param {string} bufferType - The data type of a 'workgroup' scoped buffer element. - * @param {number} [bufferCount=0] - The number of elements in the buffer. - */ - constructor(scope: string, bufferType: string, bufferCount?: number); - /** - * The buffer type. - * - * @type {string} - */ - bufferType: string; - /** - * The buffer count. - * - * @type {number} - * @default 0 - */ - bufferCount: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWorkgroupInfoNode: boolean; - /** - * The data type of the array buffer. - * - * @type {string} - */ - elementType: string; - /** - * The address space the buffer is scoped to. Currently only `'Workgroup'` is used. - * - * @type {string} - */ - scope: string; - /** - * Sets the name of this node. - * - * @param {string} name - The name to set. - * @return {WorkgroupInfoNode} A reference to this node. - */ - setName(name: string): WorkgroupInfoNode; - /** - * Sets the name/label of this node. - * - * @deprecated - * @param {string} name - The name to set. - * @return {WorkgroupInfoNode} A reference to this node. - */ - label(name: string): WorkgroupInfoNode; - /** - * Sets the scope of this node. - * - * @param {string} scope - The scope to set. - * @return {WorkgroupInfoNode} A reference to this node. - */ - setScope(scope: string): WorkgroupInfoNode; - /** - * The data type of the array buffer. - * - * @return {string} The element type. - */ - getElementType(): string; - /** - * Overwrites the default implementation since the input type - * is inferred from the scope. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; - /** - * This method can be used to access elements via an index node. - * - * @param {IndexNode} indexNode - indexNode. - * @return {WorkgroupInfoElementNode} A reference to an element. - */ - element(indexNode: IndexNode): WorkgroupInfoElementNode; - generate(builder: any): any; -} -import { ZeroFactor } from './three.core.js'; -import { ZeroStencilOp } from './three.core.js'; -import { createCanvasElement } from './three.core.js'; -export const defaultBuildStages: string[]; -export const defaultShaderStages: string[]; -import { error } from './three.core.js'; -import { log as log$1 } from './three.core.js'; -export const shaderStages: string[]; -export const vectorComponents: string[]; -import { warn } from './three.core.js'; -import { warnOnce } from './three.core.js'; -/** - * Abstract base class of a timestamp query pool. - * - * @abstract - */ -declare class TimestampQueryPool { - /** - * Creates a new timestamp query pool. - * - * @param {number} [maxQueries=256] - Maximum number of queries this pool can hold. - */ - constructor(maxQueries?: number); - /** - * Whether to track timestamps or not. - * - * @type {boolean} - * @default true - */ - trackTimestamp: boolean; - /** - * Maximum number of queries this pool can hold. - * - * @type {number} - * @default 256 - */ - maxQueries: number; - /** - * How many queries allocated so far. - * - * @type {number} - * @default 0 - */ - currentQueryIndex: number; - /** - * Tracks offsets for different contexts. - * - * @type {Map} - */ - queryOffsets: Map; - /** - * Whether the pool has been disposed or not. - * - * @type {boolean} - * @default false - */ - isDisposed: boolean; - /** - * The total frame duration until the next update. - * - * @type {number} - * @default 0 - */ - lastValue: number; - /** - * Stores all timestamp frames. - * - * @type {Array} - */ - frames: Array; - /** - * This property is used to avoid multiple concurrent resolve operations. - * The WebGL backend uses it as a boolean flag. In context of WebGPU, it holds - * the promise of the current resolve operation. - * - * @type {boolean|Promise} - * @default false - */ - pendingResolve: boolean | Promise; - /** - * Stores the latest timestamp for each render context. - * - * @type {Map} - */ - timestamps: Map; - /** - * Returns all timestamp frames. - * - * @return {Array} The timestamp frames. - */ - getTimestampFrames(): Array; - /** - * Returns the timestamp for a given render context. - * - * @param {string} uid - A unique identifier for the render context. - * @return {?number} The timestamp, or undefined if not available. - */ - getTimestamp(uid: string): number | null; - /** - * Returns whether a timestamp is available for a given render context. - * - * @param {string} uid - A unique identifier for the render context. - * @return {boolean} True if a timestamp is available, false otherwise. - */ - hasTimestampQuery(uid: string): boolean; - /** - * Allocate queries for a specific uid. - * - * @abstract - * @param {string} uid - A unique identifier for the render context. - * @param {number} frameId - The current frame identifier. - * @returns {?number} - */ - allocateQueriesForContext(): number | null; - /** - * Resolve all timestamps and return data (or process them). - * - * @abstract - * @async - * @returns {Promise|number} The resolved timestamp value. - */ - resolveQueriesAsync(): Promise | number; - /** - * Dispose of the query pool. - * - * @abstract - */ - dispose(): void; -} -/** - * Any render or compute command is executed in a specific context that defines - * the state of the renderer and its backend. Typical examples for such context - * data are the current clear values or data from the active framebuffer. This - * module is used to represent these contexts as objects. - * - * @private - */ -declare class RenderContext { - /** - * The context's ID. - * - * @type {number} - */ - id: number; - /** - * The MRT configuration. - * - * @type {?MRTNode} - * @default null - */ - mrt: MRTNode | null; - /** - * Whether the current active framebuffer has a color attachment. - * - * @type {boolean} - * @default true - */ - color: boolean; - /** - * Whether the color attachment should be cleared or not. - * - * @type {boolean} - * @default true - */ - clearColor: boolean; - /** - * The clear color value. - * - * @type {Object} - * @default true - */ - clearColorValue: Object; - /** - * Whether the current active framebuffer has a depth attachment. - * - * @type {boolean} - * @default true - */ - depth: boolean; - /** - * Whether the depth attachment should be cleared or not. - * - * @type {boolean} - * @default true - */ - clearDepth: boolean; - /** - * The clear depth value. - * - * @type {number} - * @default 1 - */ - clearDepthValue: number; - /** - * Whether the current active framebuffer has a stencil attachment. - * - * @type {boolean} - * @default false - */ - stencil: boolean; - /** - * Whether the stencil attachment should be cleared or not. - * - * @type {boolean} - * @default true - */ - clearStencil: boolean; - /** - * The clear stencil value. - * - * @type {number} - * @default 1 - */ - clearStencilValue: number; - /** - * By default the viewport encloses the entire framebuffer If a smaller - * viewport is manually defined, this property is to `true` by the renderer. - * - * @type {boolean} - * @default false - */ - viewport: boolean; - /** - * The viewport value. This value is in physical pixels meaning it incorporates - * the renderer's pixel ratio. The viewport property of render targets or - * the renderer is in logical pixels. - * - * @type {Vector4} - */ - viewportValue: Vector4; - /** - * When the scissor test is active and scissor rectangle smaller than the - * framebuffers dimensions, this property is to `true` by the renderer. - * - * @type {boolean} - * @default false - */ - scissor: boolean; - /** - * The scissor rectangle. - * - * @type {Vector4} - */ - scissorValue: Vector4; - /** - * The active render target. - * - * @type {?RenderTarget} - * @default null - */ - renderTarget: RenderTarget | null; - /** - * The textures of the active render target. - * `null` when no render target is set. - * - * @type {?Array} - * @default null - */ - textures: Array | null; - /** - * The depth texture of the active render target. - * `null` when no render target is set. - * - * @type {?DepthTexture} - * @default null - */ - depthTexture: DepthTexture | null; - /** - * The active cube face. - * - * @type {number} - * @default 0 - */ - activeCubeFace: number; - /** - * The active mipmap level. - * - * @type {number} - * @default 0 - */ - activeMipmapLevel: number; - /** - * The number of MSAA samples. This value is always `1` when - * MSAA isn't used. - * - * @type {number} - * @default 1 - */ - sampleCount: number; - /** - * The active render target's width in physical pixels. - * - * @type {number} - * @default 0 - */ - width: number; - /** - * The active render target's height in physical pixels. - * - * @type {number} - * @default 0 - */ - height: number; - /** - * The occlusion query count. - * - * @type {number} - * @default 0 - */ - occlusionQueryCount: number; - /** - * The current clipping context. - * - * @type {?ClippingContext} - * @default null - */ - clippingContext: ClippingContext | null; - /** - * The current camera. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * Whether a fullscreen pass is rendered or not. - * - * @type {boolean} - * @default false - */ - fullscreenPass: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderContext: boolean; - /** - * Returns the cache key of this render context. - * - * @return {number} The cache key. - */ - getCacheKey(): number; -} -/** - * A four-component version of {@link Color} which is internally - * used by the renderer to represents clear color with alpha as - * one object. - * - * @private - * @augments Color - */ -declare class Color4 extends Color { - /** - * Constructs a new four-component color. - * You can also pass a single THREE.Color, hex or - * string argument to this constructor. - * - * @param {number|string} [r=1] - The red value. - * @param {number} [g=1] - The green value. - * @param {number} [b=1] - The blue value. - * @param {number} [a=1] - The alpha value. - */ - constructor(r?: number | string, g?: number, b?: number, a?: number); - a: number; - /** - * Overwrites the default to honor alpha. - * You can also pass a single THREE.Color, hex or - * string argument to this method. - * - * @param {number|string|Color} r - The red value. - * @param {number} [g] - The green value. - * @param {number} [b] - The blue value. - * @param {number} [a=1] - The alpha value. - * @return {Color4} A reference to this object. - */ - set(r: number | string | Color, g?: number, b?: number, a?: number): Color4; - /** - * Overwrites the default to honor alpha. - * - * @param {Color4} color - The color to copy. - * @return {Color4} A reference to this object. - */ - copy(color: Color4): Color4; - /** - * Overwrites the default to honor alpha. - * - * @return {Color4} The cloned color. - */ - clone(): Color4; -} -/** - * The purpose of a node library is to assign node implementations - * to existing library features. In `WebGPURenderer` lights, materials - * which are not based on `NodeMaterial` as well as tone mapping techniques - * are implemented with node-based modules. - * - * @private - */ -declare class NodeLibrary { - /** - * A weak map that maps lights to light nodes. - * - * @type {WeakMap} - */ - lightNodes: WeakMap; - /** - * A map that maps materials to node materials. - * - * @type {Map} - */ - materialNodes: Map; - /** - * A map that maps tone mapping techniques (constants) - * to tone mapping node functions. - * - * @type {Map} - */ - toneMappingNodes: Map; - /** - * Returns a matching node material instance for the given material object. - * - * This method also assigns/copies the properties of the given material object - * to the node material. This is done to make sure the current material - * configuration carries over to the node version. - * - * @param {Material} material - A material. - * @return {NodeMaterial} The corresponding node material. - */ - fromMaterial(material: Material): NodeMaterial; - /** - * Adds a tone mapping node function for a tone mapping technique (constant). - * - * @param {Function} toneMappingNode - The tone mapping node function. - * @param {number} toneMapping - The tone mapping. - */ - addToneMapping(toneMappingNode: Function, toneMapping: number): void; - /** - * Returns a tone mapping node function for a tone mapping technique (constant). - * - * @param {number} toneMapping - The tone mapping. - * @return {?Function} The tone mapping node function. Returns `null` if no node function is found. - */ - getToneMappingFunction(toneMapping: number): Function | null; - /** - * Returns a node material class definition for a material type. - * - * @param {string} materialType - The material type. - * @return {?NodeMaterial.constructor} The node material class definition. Returns `null` if no node material is found. - */ - getMaterialNodeClass(materialType: string): NodeMaterial.constructor | null; - /** - * Adds a node material class definition for a given material type. - * - * @param {NodeMaterial.constructor} materialNodeClass - The node material class definition. - * @param {string} materialClassType - The material type. - */ - addMaterial(materialNodeClass: NodeMaterial.constructor, materialClassType: string): void; - /** - * Returns a light node class definition for a light class definition. - * - * @param {Light.constructor} light - The light class definition. - * @return {?AnalyticLightNode.constructor} The light node class definition. Returns `null` if no light node is found. - */ - getLightNodeClass(light: Light.constructor): AnalyticLightNode.constructor | null; - /** - * Adds a light node class definition for a given light class definition. - * - * @param {AnalyticLightNode.constructor} lightNodeClass - The light node class definition. - * @param {Light.constructor} lightClass - The light class definition. - */ - addLight(lightNodeClass: AnalyticLightNode.constructor, lightClass: Light.constructor): void; - /** - * Adds a node class definition for the given type to the provided type library. - * - * @param {Node.constructor} nodeClass - The node class definition. - * @param {number|string} type - The object type. - * @param {Map} library - The type library. - */ - addType(nodeClass: Node.constructor, type: number | string, library: Map): void; - /** - * Adds a node class definition for the given class definition to the provided type library. - * - * @param {Node.constructor} nodeClass - The node class definition. - * @param {Node.constructor} baseClass - The class definition. - * @param {WeakMap} library - The type library. - */ - addClass(nodeClass: Node.constructor, baseClass: Node.constructor, library: WeakMap): void; -} -/** - * Base class for node functions. A derived module must be implemented - * for each supported native shader language. Similar to other `Node*` modules, - * this class is only relevant during the building process and not used - * in user-level code. - */ -declare class NodeFunction { - /** - * Constructs a new node function. - * - * @param {string} type - The node type. This type is the return type of the node function. - * @param {Array} inputs - The function's inputs. - * @param {string} [name=''] - The function's name. - * @param {string} [precision=''] - The precision qualifier. - */ - constructor(type: string, inputs: Array, name?: string, precision?: string); - /** - * The node type. This type is the return type of the node function. - * - * @type {string} - */ - type: string; - /** - * The function's inputs. - * - * @type {Array} - */ - inputs: Array; - /** - * The name of the uniform. - * - * @type {string} - * @default '' - */ - name: string; - /** - * The precision qualifier. - * - * @type {string} - * @default '' - */ - precision: string; - /** - * This method returns the native code of the node function. - * - * @abstract - * @param {string} name - The function's name. - * @return {string} A shader code. - */ - getCode(): string; -} -declare namespace NodeFunction { - let isNodeFunction: boolean; -} -/** - * A special form of uniforms group that represents - * the individual uniforms as node-based uniforms. - * - * @private - * @augments UniformsGroup - */ -declare class NodeUniformsGroup extends UniformsGroup { - /** - * Constructs a new node-based uniforms group. - * - * @param {string} name - The group's name. - * @param {UniformGroupNode} groupNode - The uniform group node. - */ - constructor(name: string, groupNode: UniformGroupNode); - /** - * The group's ID. - * - * @type {number} - */ - id: number; - /** - * The uniform group node. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeUniformsGroup: boolean; -} -declare class ShaderNodeInternal extends Node { - constructor(jsFunc: any, nodeType: any); - jsFunc: any; - layout: any; - once: boolean; - setLayout(layout: any): this; - getLayout(): any; - call(rawInputs?: null): ShaderCallNodeInternal; - setup(): ShaderCallNodeInternal; -} -/** - * Base class for node parsers. A derived parser must be implemented - * for each supported native shader language. - */ -declare class NodeParser { - /** - * The method parses the given native code an returns a node function. - * - * @abstract - * @param {string} source - The native shader code. - * @return {NodeFunction} A node function. - */ - parseFunction(): NodeFunction; -} -/** - * This class represents a GLSL node function. - * - * @augments NodeFunction - */ -declare class GLSLNodeFunction extends NodeFunction { - /** - * Constructs a new GLSL node function. - * - * @param {string} source - The GLSL source. - */ - constructor(source: string); - inputsCode: any; - blockCode: any; - headerCode: any; - /** - * This method returns the GLSL code of the node function. - * - * @param {string} [name=this.name] - The function's name. - * @return {string} The shader code. - */ - getCode(name?: string): string; -} -/** - * Represents the lighting model for unlit materials. The only light contribution - * is baked indirect lighting modulated with ambient occlusion and the material's - * diffuse color. Environment mapping is supported. Used in {@link MeshBasicNodeMaterial}. - * - * @augments LightingModel - */ -declare class BasicLightingModel extends LightingModel { - /** - * Implements the baked indirect lighting with its modulation. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirect({ context }: NodeBuilder): void; - /** - * Implements the environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - */ - finish(builder: NodeBuilder): void; -} -/** - * Represents the lighting model for {@link MeshSSSNodeMaterial}. - * - * @augments PhysicalLightingModel - */ -declare class SSSLightingModel extends PhysicalLightingModel { - /** - * Whether the lighting model should use SSS or not. - * - * @type {boolean} - * @default false - */ - useSSS: boolean; - /** - * Extends the default implementation with a SSS term. - * - * Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) - * - * @param {Object} input - The input data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; -} -/** - * Represents the lighting model for a toon material. Used in {@link MeshToonNodeMaterial}. - * - * @augments LightingModel - */ -declare class ToonLightingModel extends LightingModel { - /** - * Implements the direct lighting. Instead of using a conventional smooth irradiance, the irradiance is - * reduced to a small number of discrete shades to create a comic-like, flat look. - * - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; - /** - * Implements the indirect lighting. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirect(builder: NodeBuilder): void; -} -/** - * Represents the state that is used to perform clipping via clipping planes. - * There is a default clipping context for each render context. When the - * scene holds instances of `ClippingGroup`, there will be a context for each - * group. - * - * @private - */ -declare class ClippingContext { - /** - * Constructs a new clipping context. - * - * @param {?ClippingContext} [parentContext=null] - A reference to the parent clipping context. - */ - constructor(parentContext?: ClippingContext | null); - /** - * The clipping context's version. - * - * @type {number} - * @readonly - */ - readonly version: number; - /** - * Whether the intersection of the clipping planes is used to clip objects, rather than their union. - * - * @type {?boolean} - * @default null - */ - clipIntersection: boolean | null; - /** - * The clipping context's cache key. - * - * @type {string} - */ - cacheKey: string; - /** - * Whether the shadow pass is active or not. - * - * @type {boolean} - * @default false - */ - shadowPass: boolean; - /** - * The view matrix. - * - * @type {Matrix4} - */ - viewMatrix: Matrix4; - /** - * The view normal matrix. - * - * @type {Matrix3} - */ - viewNormalMatrix: Matrix3; - /** - * Internal cache for maintaining clipping contexts. - * - * @type {WeakMap} - */ - clippingGroupContexts: WeakMap; - /** - * The intersection planes. - * - * @type {Array} - */ - intersectionPlanes: Array; - /** - * The intersection planes. - * - * @type {Array} - */ - unionPlanes: Array; - /** - * The version of the clipping context's parent context. - * - * @type {?number} - * @readonly - */ - readonly parentVersion: number | null; - /** - * Projects the given source clipping planes and writes the result into the - * destination array. - * - * @param {Array} source - The source clipping planes. - * @param {Array} destination - The destination. - * @param {number} offset - The offset. - */ - projectPlanes(source: Array, destination: Array, offset: number): void; - /** - * Updates the root clipping context of a scene. - * - * @param {Scene} scene - The scene. - * @param {Camera} camera - The camera that is used to render the scene. - */ - updateGlobal(scene: Scene, camera: Camera): void; - /** - * Updates the clipping context. - * - * @param {ClippingContext} parentContext - The parent context. - * @param {ClippingGroup} clippingGroup - The clipping group this context belongs to. - */ - update(parentContext: ClippingContext, clippingGroup: ClippingGroup): void; - /** - * Returns a clipping context for the given clipping group. - * - * @param {ClippingGroup} clippingGroup - The clipping group. - * @return {ClippingContext} The clipping context. - */ - getGroupContext(clippingGroup: ClippingGroup): ClippingContext; - /** - * The count of union clipping planes. - * - * @type {number} - * @readonly - */ - readonly get unionClippingCount(): number; -} -/** - * A bind group represents a collection of bindings and thus a collection - * or resources. Bind groups are assigned to pipelines to provide them - * with the required resources (like uniform buffers or textures). - * - * @private - */ -declare class BindGroup { - /** - * Constructs a new bind group. - * - * @param {string} name - The bind group's name. - * @param {Array} bindings - An array of bindings. - */ - constructor(name?: string, bindings?: Array); - /** - * The bind group's name. - * - * @type {string} - */ - name: string; - /** - * An array of bindings. - * - * @type {Array} - */ - bindings: Array; - /** - * The group's ID. - * - * @type {number} - */ - id: number; -} -declare class StructType { - constructor(name: any, members: any); - name: any; - members: any; - output: boolean; -} -/** - * Abstract base class for uniforms. - * - * @abstract - * @private - */ -declare class Uniform { - /** - * Constructs a new uniform. - * - * @param {string} name - The uniform's name. - * @param {any} value - The uniform's value. - */ - constructor(name: string, value: any); - /** - * The uniform's name. - * - * @type {string} - */ - name: string; - /** - * The uniform's value. - * - * @type {any} - */ - value: any; - /** - * Used to build the uniform buffer according to the STD140 layout. - * Derived uniforms will set this property to a data type specific - * value. - * - * @type {number} - */ - boundary: number; - /** - * The item size. Derived uniforms will set this property to a data - * type specific value. - * - * @type {number} - */ - itemSize: number; - /** - * This property is set by {@link UniformsGroup} and marks - * the start position in the uniform buffer. - * - * @type {number} - */ - offset: number; - /** - * This property is set by {@link UniformsGroup} and marks - * the index position in the uniform array. - * - * @type {number} - */ - index: number; - /** - * Sets the uniform's value. - * - * @param {any} value - The value to set. - */ - setValue(value: any): void; - /** - * Returns the uniform's value. - * - * @return {any} The value. - */ - getValue(): any; -} -/** - * A render object is the renderer's representation of single entity that gets drawn - * with a draw command. There is no unique mapping of render objects to 3D objects in the - * scene since render objects also depend from the used material, the current render context - * and the current scene's lighting. - * - * In general, the basic process of the renderer is: - * - * - Analyze the 3D objects in the scene and generate render lists containing render items. - * - Process the render lists by calling one or more render commands for each render item. - * - For each render command, request a render object and perform the draw. - * - * The module provides an interface to get data required for the draw command like the actual - * draw parameters or vertex buffers. It also holds a series of caching related methods since - * creating render objects should only be done when necessary. - * - * @private - */ -declare class RenderObject { - /** - * Constructs a new render object. - * - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - * @param {Geometries} geometries - Renderer component for managing geometries. - * @param {Renderer} renderer - The renderer. - * @param {Object3D} object - The 3D object. - * @param {Material} material - The 3D object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {LightsNode} lightsNode - The lights node. - * @param {RenderContext} renderContext - The render context. - * @param {ClippingContext} clippingContext - The clipping context. - */ - constructor(nodes: NodeManager, geometries: Geometries, renderer: Renderer, object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext); - id: number; - /** - * Renderer component for managing nodes related logic. - * - * @type {NodeManager} - * @private - */ - private _nodes; - /** - * Renderer component for managing geometries. - * - * @type {Geometries} - * @private - */ - private _geometries; - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * The 3D object. - * - * @type {Object3D} - */ - object: Object3D; - /** - * The 3D object's material. - * - * @type {Material} - */ - material: Material; - /** - * The scene the 3D object belongs to. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera the 3D object should be rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * The lights node. - * - * @type {LightsNode} - */ - lightsNode: LightsNode; - /** - * The render context. - * - * @type {RenderContext} - */ - context: RenderContext; - /** - * The 3D object's geometry. - * - * @type {BufferGeometry} - */ - geometry: BufferGeometry; - /** - * The render object's version. - * - * @type {number} - */ - version: number; - /** - * The draw range of the geometry. - * - * @type {?Object} - * @default null - */ - drawRange: Object | null; - /** - * An array holding the buffer attributes - * of the render object. This entails attribute - * definitions on geometry and node level. - * - * @type {?Array} - * @default null - */ - attributes: Array | null; - /** - * An object holding the version of the - * attributes. The keys are the attribute names - * and the values are the attribute versions. - * - * @type {?Object} - * @default null - */ - attributesId: { - [x: string]: number; - } | null; - /** - * A reference to a render pipeline the render - * object is processed with. - * - * @type {RenderPipeline} - * @default null - */ - pipeline: RenderPipeline; - /** - * Only relevant for objects using - * multiple materials. This represents a group entry - * from the respective `BufferGeometry`. - * - * @type {?{start: number, count: number}} - * @default null - */ - group: { - start: number; - count: number; - } | null; - /** - * An array holding the vertex buffers which can - * be buffer attributes but also interleaved buffers. - * - * @type {?Array} - * @default null - */ - vertexBuffers: Array | null; - /** - * The parameters for the draw command. - * - * @type {?Object} - * @default null - */ - drawParams: Object | null; - /** - * If this render object is used inside a render bundle, - * this property points to the respective bundle group. - * - * @type {?BundleGroup} - * @default null - */ - bundle: BundleGroup | null; - /** - * The clipping context. - * - * @type {ClippingContext} - */ - clippingContext: ClippingContext; - /** - * The clipping context's cache key. - * - * @type {string} - */ - clippingContextCacheKey: string; - /** - * The initial node cache key. - * - * @type {number} - */ - initialNodesCacheKey: number; - /** - * The initial cache key. - * - * @type {number} - */ - initialCacheKey: number; - /** - * The node builder state. - * - * @type {?NodeBuilderState} - * @private - * @default null - */ - private _nodeBuilderState; - /** - * An array of bindings. - * - * @type {?Array} - * @private - * @default null - */ - private _bindings; - /** - * Reference to the node material observer. - * - * @type {?NodeMaterialObserver} - * @private - * @default null - */ - private _monitor; - /** - * The object's original material when this render object is drawn with an - * override material. - * - * @type {?Material} - * @private - * @default null - */ - private _sourceMaterial; - /** - * An event listener which is defined by `RenderObjects`. It performs - * clean up tasks when `dispose()` on this render object. - * - * @method - */ - onDispose: any; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderObject: boolean; - /** - * An event listener which is executed when `dispose()` is called on - * the material of this render object. - * - * @method - */ - onMaterialDispose: () => void; - /** - * An event listener which is executed when `dispose()` is called on - * the geometry of this render object. - * - * @method - */ - onGeometryDispose: () => void; - /** - * An event listener which is executed when `dispose()` is called on - * the 3D object of this render object. - * - * @method - */ - onObjectDispose: () => void; - /** - * Updates the clipping context. - * - * @param {ClippingContext} context - The clipping context to set. - */ - updateClipping(context: ClippingContext): void; - /** - * Whether the clipping requires an update or not. - * - * @type {boolean} - * @readonly - */ - readonly get clippingNeedsUpdate(): boolean; - /** - * The number of clipping planes defined in context of hardware clipping. - * - * @type {number} - * @readonly - */ - readonly get hardwareClippingPlanes(): number; - /** - * Returns the node builder state of this render object. - * - * @return {NodeBuilderState} The node builder state. - */ - getNodeBuilderState(): NodeBuilderState; - /** - * Returns the node material observer of this render object. - * - * @return {NodeMaterialObserver} The node material observer. - */ - getMonitor(): NodeMaterialObserver; - /** - * Returns an array of bind groups of this render object. - * - * @return {Array} The bindings. - */ - getBindings(): Array; - /** - * Returns a binding group by group name of this render object. - * - * @param {string} name - The name of the binding group. - * @return {?BindGroup} The bindings. - */ - getBindingGroup(name: string): BindGroup | null; - /** - * Returns the index of the render object's geometry. - * - * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. - */ - getIndex(): BufferAttribute | null; - /** - * Returns the indirect buffer attribute. - * - * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. - */ - getIndirect(): BufferAttribute | null; - /** - * Returns the byte offset into the indirect attribute buffer. - * - * @return {number|Array} The byte offset into the indirect attribute buffer. - */ - getIndirectOffset(): number | Array; - /** - * Returns an array that acts as a key for identifying the render object in a chain map. - * - * @return {Array} An array with object references. - */ - getChainArray(): Array; - /** - * This method is used when the geometry of a 3D object has been exchanged and the - * respective render object now requires an update. - * - * @param {BufferGeometry} geometry - The geometry to set. - */ - setGeometry(geometry: BufferGeometry): void; - /** - * Returns the buffer attributes of the render object. The returned array holds - * attribute definitions on geometry and node level. - * - * @return {Array} An array with buffer attributes. - */ - getAttributes(): Array; - /** - * Returns the vertex buffers of the render object. - * - * @return {Array} An array with buffer attribute or interleaved buffers. - */ - getVertexBuffers(): Array; - /** - * Returns the draw parameters for the render object. - * - * @return {?{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} The draw parameters. - */ - getDrawParameters(): { - vertexCount: number; - firstVertex: number; - instanceCount: number; - firstInstance: number; - } | null; - /** - * Returns the render object's geometry cache key. - * - * The geometry cache key is part of the material cache key. - * - * @return {string} The geometry cache key. - */ - getGeometryCacheKey(): string; - /** - * Returns the render object's material cache key. - * - * The material cache key is part of the render object cache key. - * - * @return {number} The material cache key. - */ - getMaterialCacheKey(): number; - /** - * Whether the geometry requires an update or not. - * - * @type {boolean} - * @readonly - */ - readonly get needsGeometryUpdate(): boolean; - /** - * Whether the render object requires an update or not. - * - * Note: There are two distinct places where render objects are checked for an update. - * - * 1. In `RenderObjects.get()` which is executed when the render object is request. This - * method checks the `needsUpdate` flag and recreates the render object if necessary. - * 2. In `Renderer._renderObjectDirect()` right after getting the render object via - * `RenderObjects.get()`. The render object's NodeMaterialObserver is then used to detect - * a need for a refresh due to material, geometry or object related value changes. - * - * TODO: Investigate if it's possible to merge both steps so there is only a single place - * that performs the 'needsUpdate' check. - * - * @type {boolean} - * @readonly - */ - readonly get needsUpdate(): boolean; - /** - * Returns the dynamic cache key which represents a key that is computed per draw command. - * - * @return {number} The cache key. - */ - getDynamicCacheKey(): number; - /** - * Returns the render object's cache key. - * - * @return {number} The cache key. - */ - getCacheKey(): number; - /** - * Frees internal resources. - */ - dispose(): void; -} -/** - * Converts the given array buffer to a Base64 string. - * - * @private - * @method - * @param {ArrayBuffer} arrayBuffer - The array buffer. - * @return {string} The Base64 string. - */ -declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string; -/** - * Converts the given Base64 string to an array buffer. - * - * @private - * @method - * @param {string} base64 - The Base64 string. - * @return {ArrayBuffer} The array buffer. - */ -declare function base64ToArrayBuffer(base64: string): ArrayBuffer; -/** - * Returns the alignment requirement for the given data type in 4-byte elements. - * - * @private - * @method - * @param {string} type - The data type. - * @return {number} The alignment requirement in 4-byte elements. - */ -declare function getAlignmentFromType(type: string): number; -/** - * Gets the object data that can be shared between different rendering steps. - * - * @private - * @param {Object} object - The object to get the data for. - * @return {Object} The object data. - */ -declare function getDataFromObject(object: Object): Object; -/** - * Returns the length for the given data type. - * - * @private - * @method - * @param {string} type - The data type. - * @return {number} The length. - */ -declare function getLengthFromType(type: string): number; -/** - * Returns the gpu memory length for the given data type in 4-byte elements. - * - * @private - * @method - * @param {string} type - The data type. - * @return {number} The memory length in 4-byte elements. - */ -declare function getMemoryLengthFromType(type: string): number; -/** - * Returns the node data type for the given texture. - * - * @private - * @method - * @param {Texture} texture - The texture. - * @return {string} The data type. - */ -declare function getTextureType(texture: Texture): string; -/** - * Returns the data type for the given the length. - * - * @private - * @method - * @param {number} length - The length. - * @return {string} The data type. - */ -declare function getTypeFromLength(length: number): string; -/** - * Returns the typed array for the given data type. - * - * @private - * @method - * @param {string} type - The data type. - * @return {TypedArray} The typed array. - */ -declare function getTypedArrayFromType(type: string): TypedArray; -/** - * Returns the value/object for the given data type and parameters. - * - * @private - * @method - * @param {string} type - The given type. - * @param {...any} params - A parameter list. - * @return {any} The value/object. - */ -declare function getValueFromType(type: string, ...params: any[]): any; -/** - * Returns the data type for the given value. - * - * @private - * @method - * @param {any} value - The value. - * @return {?string} The data type. - */ -declare function getValueType(value: any): string | null; -declare function isArrayAsParameter(params: any): any; -/** - * Holds the actual implementation of the reflector (virtual cameras, render - * targets and the reflection rendering). - * - * This logic is kept separate from {@link ReflectorNode} because the latter is - * a {@link TextureNode} representing a single texture view. A reflector can be - * sampled by multiple texture nodes at once - e.g. one for color and one for - * depth (see {@link ReflectorNode#getDepthNode}) - which all reference the same - * base node so the reflection is rendered only once. - * - * @private - * @augments Node - */ -declare class ReflectorBaseNode extends Node { - /** - * Constructs a new reflector base node. - * - * @param {TextureNode} textureNode - Represents the rendered reflections as a texture node. - * @param {Object} [parameters={}] - An object holding configuration parameters. - * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. - * @param {number} [parameters.resolutionScale=1] - The resolution scale. - * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. - * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. - * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. - * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. - */ - constructor(textureNode: TextureNode, parameters?: { - target?: Object3D | undefined; - resolutionScale?: number | undefined; - generateMipmaps?: boolean | undefined; - bounces?: boolean | undefined; - depth?: boolean | undefined; - samples?: number | undefined; - }); - /** - * Represents the rendered reflections as a texture node. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * The 3D object the reflector is linked to. - * - * @type {Object3D} - * @default {new Object3D()} - */ - target: Object3D; - /** - * The resolution scale. - * - * @type {number} - * @default {1} - */ - resolutionScale: number; - /** - * Whether mipmaps should be generated or not. - * - * @type {boolean} - * @default {false} - */ - generateMipmaps: boolean; - /** - * Whether reflectors can render other reflector nodes or not. - * - * @type {boolean} - * @default {true} - */ - bounces: boolean; - /** - * Whether depth data should be generated or not. - * - * @type {boolean} - * @default {false} - */ - depth: boolean; - /** - * The number of anti-aliasing samples for the render-target - * - * @type {number} - * @default {0} - */ - samples: number; - /** - * Weak map for managing virtual cameras. - * - * @type {WeakMap} - */ - virtualCameras: WeakMap; - /** - * Weak map for managing render targets. - * - * @type {Map} - */ - renderTargets: Map; - /** - * Force render even if reflector is facing away from camera. - * - * @type {boolean} - * @default {false} - */ - forceUpdate: boolean; - /** - * Whether the reflector has been rendered or not. - * - * When the reflector is facing away from the camera, - * this flag is set to `false` and the texture will be empty(black). - * - * @type {boolean} - * @default {false} - */ - hasOutput: boolean; - /** - * Updates the resolution of the internal render target. - * - * @private - * @param {RenderTarget} renderTarget - The render target to resize. - * @param {Renderer} renderer - The renderer that is used to determine the new size. - */ - private _updateResolution; - setup(builder: any): Node | null; - /** - * Returns a virtual camera for the given camera. The virtual camera is used to - * render the scene from the reflector's view so correct reflections can be produced. - * - * @param {Camera} camera - The scene's camera. - * @return {Camera} The corresponding virtual camera. - */ - getVirtualCamera(camera: Camera): Camera; - /** - * Returns a render target for the given camera. The reflections are rendered - * into this render target. - * - * @param {Camera} camera - The scene's camera. - * @return {RenderTarget} The render target. - */ - getRenderTarget(camera: Camera): RenderTarget; - updateBefore(frame: any): false | undefined; - set resolution(value: number); - /** - * The resolution scale. - * - * @deprecated - * @type {number} - * @default {1} - */ - get resolution(): number; -} -/** - * This renderer module provides a series of statistical information - * about the GPU memory and the rendering process. Useful for debugging - * and monitoring. - */ -declare class Info { - /** - * Whether frame related metrics should automatically - * be resetted or not. This property should be set to `false` - * by apps which manage their own animation loop. They must - * then call `renderer.info.reset()` once per frame manually. - * - * @type {boolean} - * @default true - */ - autoReset: boolean; - /** - * The current frame ID. This ID is managed - * by `NodeFrame`. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly frame: number; - /** - * The number of render calls since the - * app has been started. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly calls: number; - /** - * Render related metrics. - * - * @type {Object} - * @readonly - * @property {number} calls - The number of render calls since the app has been started. - * @property {number} frameCalls - The number of render calls of the current frame. - * @property {number} drawCalls - The number of draw calls of the current frame. - * @property {number} triangles - The number of rendered triangle primitives of the current frame. - * @property {number} points - The number of rendered point primitives of the current frame. - * @property {number} lines - The number of rendered line primitives of the current frame. - * @property {number} timestamp - The timestamp of the frame. - */ - readonly render: Object; - /** - * Compute related metrics. - * - * @type {Object} - * @readonly - * @property {number} calls - The number of compute calls since the app has been started. - * @property {number} frameCalls - The number of compute calls of the current frame. - * @property {number} timestamp - The timestamp of the frame when using `renderer.computeAsync()`. - */ - readonly compute: Object; - /** - * Memory related metrics. - * - * @type {Object} - * @readonly - * @property {number} attributes - The number of active attributes. - * @property {number} attributesSize - The memory size of active attributes in bytes. - * @property {number} geometries - The number of active geometries. - * @property {number} indexAttributes - The number of active index attributes. - * @property {number} indexAttributesSize - The memory size of active index attributes in bytes. - * @property {number} indirectStorageAttributes - The number of active indirect storage attributes. - * @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes. - * @property {number} programs - The number of active programs. - * @property {number} programsSize - The memory size of active programs in bytes. - * @property {number} readbackBuffers - The number of active readback buffers. - * @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes. - * @property {number} renderTargets - The number of active renderTargets. - * @property {number} storageAttributes - The number of active storage attributes. - * @property {number} storageAttributesSize - The memory size of active storage attributes in bytes. - * @property {number} textures - The number of active textures. - * @property {number} texturesSize - The memory size of active textures in bytes. - * @property {number} uniformBuffers - The number of active uniform buffers. - * @property {number} uniformBuffersSize - The memory size of active uniform buffers in bytes. - * @property {number} total - The total memory size in bytes. - */ - readonly memory: Object; - /** - * Map for storing calculated byte sizes of tracked objects. - * - * @type {WeakMap} - * @private - */ - private memoryMap; - /** - * This method should be executed per draw call and updates the corresponding metrics. - * - * @param {Object3D} object - The 3D object that is going to be rendered. - * @param {number} count - The vertex or index count. - * @param {number} instanceCount - The instance count. - */ - update(object: Object3D, count: number, instanceCount: number): void; - /** - * Resets frame related metrics. - */ - reset(): void; - /** - * Performs a complete reset of the object. - */ - dispose(): void; - /** - * Tracks texture memory explicitly, updating counts and byte tracking. - * - * @param {Texture} texture - */ - createTexture(texture: Texture): void; - /** - * Tracks texture memory explicitly, updating counts and byte tracking. - * - * @param {Texture} texture - */ - destroyTexture(texture: Texture): void; - /** - * Tracks attribute memory explicitly, updating counts and byte tracking. - * - * @param {BufferAttribute} attribute - * @param {string} type - type of attribute - * @private - */ - private _createAttribute; - /** - * Tracks a regular attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The attribute to track. - */ - createAttribute(attribute: BufferAttribute): void; - /** - * Tracks an index attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The index attribute to track. - */ - createIndexAttribute(attribute: BufferAttribute): void; - /** - * Tracks a storage attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The storage attribute to track. - */ - createStorageAttribute(attribute: BufferAttribute): void; - /** - * Tracks an indirect storage attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The indirect storage attribute to track. - */ - createIndirectStorageAttribute(attribute: BufferAttribute): void; - /** - * Tracks attribute memory explicitly, updating counts and byte tracking. - * - * @param {BufferAttribute} attribute - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * Tracks a readback buffer memory explicitly. - * - * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. - */ - createReadbackBuffer(readbackBuffer: ReadbackBuffer): void; - /** - * Tracks a readback buffer memory explicitly. - * - * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. - */ - destroyReadbackBuffer(readbackBuffer: ReadbackBuffer): void; - /** - * Tracks a uniform buffer memory explicitly. - * - * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. - */ - createUniformBuffer(uniformBuffer: UniformBuffer): void; - /** - * Tracks a uniform buffer memory explicitly. - * - * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. - */ - destroyUniformBuffer(uniformBuffer: UniformBuffer): void; - /** - * Tracks program memory explicitly, updating counts and byte tracking. - * - * @param {ProgrammableStage} program - The program to track. - */ - createProgram(program: ProgrammableStage): void; - /** - * Tracks program memory explicitly, updating counts and byte tracking. - * - * @param {Object} program - The program to track. - */ - destroyProgram(program: Object): void; - /** - * Calculates the memory size of a texture in bytes. - * - * @param {Texture} texture - The texture to calculate the size for. - * @return {number} The calculated size in bytes. - * @private - */ - private _getTextureMemorySize; - /** - * Calculates the memory size of an attribute in bytes. - * - * @param {BufferAttribute} attribute - The attribute to calculate the size for. - * @return {number} The calculated size in bytes. - * @private - */ - private _getAttributeMemorySize; -} -/** - * The XR manager is built on top of the WebXR Device API to - * manage XR sessions with renderer backends. - * - * @augments EventDispatcher - */ -declare class XRManager extends EventDispatcher { - /** - * Constructs a new XR manager. - * - * @param {Renderer} renderer - The renderer. - * @param {boolean} [multiview=false] - Enables multiview if the device supports it. - */ - constructor(renderer: Renderer, multiview?: boolean); - /** - * This flag globally enables XR rendering. - * - * @type {boolean} - * @default false - */ - enabled: boolean; - /** - * Whether the XR device is currently presenting or not. - * - * @type {boolean} - * @default false - * @readonly - */ - readonly isPresenting: boolean; - /** - * Whether the XR camera should automatically be updated or not. - * - * @type {boolean} - * @default true - */ - cameraAutoUpdate: boolean; - /** - * The renderer. - * - * @private - * @type {Renderer} - */ - private _renderer; - /** - * Represents the camera for the left eye. - * - * @private - * @type {PerspectiveCamera} - */ - private _cameraL; - /** - * Represents the camera for the right eye. - * - * @private - * @type {PerspectiveCamera} - */ - private _cameraR; - /** - * A list of cameras used for rendering the XR views. - * - * @private - * @type {Array} - */ - private _cameras; - /** - * The main XR camera. - * - * @private - * @type {ArrayCamera} - */ - private _cameraXR; - /** - * The current near value of the XR camera. - * - * @private - * @type {?number} - * @default null - */ - private _currentDepthNear; - /** - * The current far value of the XR camera. - * - * @private - * @type {?number} - * @default null - */ - private _currentDepthFar; - /** - * A list of WebXR controllers requested by the application. - * - * @private - * @type {Array} - */ - private _controllers; - /** - * A list of XR input source. Each input source belongs to - * an instance of WebXRController. - * - * @private - * @type {Array} - */ - private _controllerInputSources; - /** - * The XR render target that represents the rendering destination - * during an active XR session. - * - * @private - * @type {?RenderTarget} - * @default null - */ - private _xrRenderTarget; - /** - * An array holding all the non-projection layers - * - * @private - * @type {Array} - * @default [] - */ - private _layers; - /** - * Whether the XR session uses layers. - * - * @private - * @type {boolean} - * @default false - */ - private _sessionUsesLayers; - /** - * Whether the device supports binding gl objects. - * - * @private - * @type {boolean} - * @readonly - */ - private readonly _supportsGlBinding; - _supportsWebGPUBinding: boolean; - /** - * Helper function to create native WebXR Layer. - * - * @private - * @type {Function} - */ - private _createXRLayer; - /** - * The current WebGL context. - * - * @private - * @type {?WebGL2RenderingContext} - * @default null - */ - private _gl; - /** - * The current animation context. - * - * @private - * @type {?Window} - * @default null - */ - private _currentAnimationContext; - /** - * The current animation loop. - * - * @private - * @type {?Function} - * @default null - */ - private _currentAnimationLoop; - /** - * The current pixel ratio. - * - * @private - * @type {?number} - * @default null - */ - private _currentPixelRatio; - /** - * The current size of the renderer's canvas - * in logical pixel unit. - * - * @private - * @type {Vector2} - */ - private _currentSize; - /** - * Holds a reference to the user camera and its current settings. - * - * @private - * @type {?Object} - * @default null - */ - private _currentCameraSettings; - /** - * The default event listener for handling events inside a XR session. - * - * @private - * @type {Function} - */ - private _onSessionEvent; - /** - * The event listener for handling the end of a XR session. - * - * @private - * @type {Function} - */ - private _onSessionEnd; - /** - * The event listener for handling the `inputsourceschange` event. - * - * @private - * @type {Function} - */ - private _onInputSourcesChange; - /** - * The animation loop which is used as a replacement for the default - * animation loop of the application. It is only used when a XR session - * is active. - * - * @private - * @type {Function} - */ - private _onAnimationFrame; - /** - * The current XR reference space. - * - * @private - * @type {?XRReferenceSpace} - * @default null - */ - private _referenceSpace; - /** - * The current XR reference space type. - * - * @private - * @type {XRReferenceSpaceType} - * @default 'local-floor' - */ - private _referenceSpaceType; - /** - * A custom reference space defined by the application. - * - * @private - * @type {?XRReferenceSpace} - * @default null - */ - private _customReferenceSpace; - /** - * The framebuffer scale factor. - * - * @private - * @type {number} - * @default 1 - */ - private _framebufferScaleFactor; - /** - * The foveation factor. - * - * @private - * @type {number} - * @default 1 - */ - private _foveation; - /** - * A reference to the current XR session. - * - * @private - * @type {?XRSession} - * @default null - */ - private _session; - /** - * A reference to the current XR base layer. - * - * @private - * @type {?XRWebGLLayer} - * @default null - */ - private _glBaseLayer; - /** - * A reference to the current XR binding. - * - * @private - * @type {?XRWebGLBinding} - * @default null - */ - private _glBinding; - /** - * A reference to the current XR WebGPU binding. - * - * @private - * @type {?XRGPUBinding} - * @default null - */ - private _webgpuBinding; - /** - * A reference to the current XR projection layer. - * - * @private - * @type {?XRProjectionLayer} - * @default null - */ - private _glProjLayer; - /** - * A reference to the current XR frame. - * - * @private - * @type {?XRFrame} - * @default null - */ - private _xrFrame; - /** - * Whether the browser supports the APIs necessary to use XRProjectionLayers. - * - * Note: this does not represent XRSession explicitly requesting - * `'layers'` as a feature - see `_sessionUsesLayers` and #30112 - * - * @private - * @type {boolean} - * @readonly - */ - private readonly _supportsLayers; - /** - * Whether the usage of multiview has been requested by the application or not. - * - * @private - * @type {boolean} - * @default false - * @readonly - */ - private readonly _useMultiviewIfPossible; - /** - * Whether the usage of multiview is actually enabled. This flag only evaluates to `true` - * if multiview has been requested by the application and the `OVR_multiview2` is available. - * - * @private - * @type {boolean} - * @readonly - */ - private readonly _useMultiview; - /** - * Returns an instance of `THREE.Group` that represents the transformation - * of a XR controller in target ray space. The requested controller is defined - * by the given index. - * - * @param {number} index - The index of the XR controller. - * @return {Group} A group that represents the controller's transformation. - */ - getController(index: number): Group; - /** - * Returns an instance of `THREE.Group` that represents the transformation - * of a XR controller in grip space. The requested controller is defined - * by the given index. - * - * @param {number} index - The index of the XR controller. - * @return {Group} A group that represents the controller's transformation. - */ - getControllerGrip(index: number): Group; - /** - * Returns an instance of `THREE.Group` that represents the transformation - * of a XR controller in hand space. The requested controller is defined - * by the given index. - * - * @param {number} index - The index of the XR controller. - * @return {Group} A group that represents the controller's transformation. - */ - getHand(index: number): Group; - /** - * Returns the foveation value. - * - * @return {number|undefined} The foveation value. - */ - getFoveation(): number | undefined; - /** - * Sets the foveation value. - * - * @param {number} foveation - A number in the range `[0,1]` where `0` means no foveation (full resolution) - * and `1` means maximum foveation (the edges render at lower resolution). - */ - setFoveation(foveation: number): void; - /** - * Returns the framebuffer scale factor. - * - * @return {number} The framebuffer scale factor. - */ - getFramebufferScaleFactor(): number; - /** - * Sets the framebuffer scale factor. - * - * This method can not be used during a XR session. - * - * @param {number} factor - The framebuffer scale factor. - */ - setFramebufferScaleFactor(factor: number): void; - /** - * Returns the reference space type. - * - * @return {XRReferenceSpaceType} The reference space type. - */ - getReferenceSpaceType(): XRReferenceSpaceType; - /** - * Sets the reference space type. - * - * This method can not be used during a XR session. - * - * @param {XRReferenceSpaceType} type - The reference space type. - */ - setReferenceSpaceType(type: XRReferenceSpaceType): void; - /** - * Returns the XR reference space. - * - * @return {XRReferenceSpace} The XR reference space. - */ - getReferenceSpace(): XRReferenceSpace; - /** - * Sets a custom XR reference space. - * - * @param {XRReferenceSpace} space - The XR reference space. - */ - setReferenceSpace(space: XRReferenceSpace): void; - /** - * Returns the XR camera. - * - * @return {ArrayCamera} The XR camera. - */ - getCamera(): ArrayCamera; - /** - * Returns the environment blend mode from the current XR session. - * - * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. - */ - getEnvironmentBlendMode(): "opaque" | "additive" | "alpha-blend" | undefined; - /** - * Returns the current base layer. - * - * This is an `XRProjectionLayer` when the targeted XR device supports the - * WebXR Layers API, or an `XRWebGLLayer` otherwise. - * - * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. - */ - getBaseLayer(): (XRWebGLLayer | XRProjectionLayer) | null; - /** - * Returns the current XR binding. - * - * Creates a new binding if needed and the browser is - * capable of doing so. - * - * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. - */ - getBinding(): XRWebGLBinding | null; - /** - * Applies WebXR fixed foveation to the internal post-processing render target - * used by the first XR render pass before compositing into a projection layer. - * - * Browser-side `XRWebGLBinding.foveateBoundTexture()` failures are treated as - * non-fatal so they do not interrupt rendering. - * - * @param {?RenderTarget} renderTarget - The internal render target. - */ - foveateBoundTexture(renderTarget: RenderTarget | null): void; - /** - * Returns the current XR WebGPU binding. - * - * Creates a new binding if needed and the browser is - * capable of doing so. - * - * @return {?XRGPUBinding} The XR WebGPU binding. Returns `null` if one cannot be created. - */ - getWebGPUBinding(): XRGPUBinding | null; - /** - * Returns whether the current XR session is using WebGPU. - * - * @private - * @return {boolean} Whether the current session uses the WebGPU backend and the `webgpu` session feature. - */ - private _isWebGPUSession; - /** - * Validates the current WebGPU XR session requirements. - * - * @private - */ - private _validateWebGPUSession; - /** - * Initializes the WebGPU XR projection layer and render target. - * - * @private - * @async - * @param {XRSession} session - The XR session. - * @return {Promise} - */ - private _initWebGPUSession; - /** - * Releases WebGPU XR resources associated with the current session. - * - * @private - */ - private _disposeWebGPUSession; - /** - * Collects WebGPU XR sub-image data for the current frame. - * - * @private - * @param {Array} views - The XR views for the current pose. - * @return {{colorTexture:?GPUTexture, viewDescriptors:Array, viewports:Array}} The WebGPU XR view data. - */ - private _getWebGPUViewData; - /** - * Returns the current XR frame. - * - * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. - */ - getFrame(): XRFrame | null; - /** - * Returns `true` if the engine renders to a multiview target. - * - * @return {boolean} Whether the engine renders to a multiview render target or not. - */ - useMultiview(): boolean; - /** - * This method can be used in XR applications to create a quadratic layer that presents a separate - * rendered scene. - * - * @param {number} width - The width of the layer plane in world units. - * @param {number} height - The height of the layer plane in world units. - * @param {Vector3} translation - The position/translation of the layer plane in world units. - * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. - * @param {number} pixelwidth - The width of the layer's render target in pixels. - * @param {number} pixelheight - The height of the layer's render target in pixels. - * @param {Function} rendercall - A callback function that renders the layer. Similar to code in - * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. - * @param {Object} [attributes={}] - Allows to configure the layer's render target. - * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. - * @return {Mesh} A mesh representing the quadratic XR layer. This mesh should be added to the XR scene. - */ - createQuadLayer(width: number, height: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { - samples?: number | undefined; - }): Mesh; - /** - * This method can be used in XR applications to create a cylindrical layer that presents a separate - * rendered scene. - * - * @param {number} radius - The radius of the cylinder in world units. - * @param {number} centralAngle - The central angle of the cylinder in radians. - * @param {number} aspectratio - The aspect ratio. - * @param {Vector3} translation - The position/translation of the layer plane in world units. - * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. - * @param {number} pixelwidth - The width of the layer's render target in pixels. - * @param {number} pixelheight - The height of the layer's render target in pixels. - * @param {Function} rendercall - A callback function that renders the layer. Similar to code in - * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. - * @param {Object} [attributes={}] - Allows to configure the layer's render target. - * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. - * @return {Mesh} A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene. - */ - createCylinderLayer(radius: number, centralAngle: number, aspectratio: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { - samples?: number | undefined; - }): Mesh; - /** - * Renders the XR layers that have been previously added to the scene. - * - * This method is usually called in your animation loop before rendering - * the actual scene via `renderer.render( scene, camera );`. - */ - renderLayers(): void; - /** - * Returns the current XR session. - * - * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. - */ - getSession(): XRSession | null; - /** - * After a XR session has been requested usually with one of the `*Button` modules, it - * is injected into the renderer with this method. This method triggers the start of - * the actual XR rendering. - * - * @async - * @param {XRSession} session - The XR session to set. - * @return {Promise} A Promise that resolves when the session has been set. - */ - setSession(session: XRSession): Promise; - /** - * This method is called by the renderer per frame and updates the XR camera - * and it sub cameras based on the given camera. The given camera is the "user" - * camera created on application level and used for non-XR rendering. - * - * @param {PerspectiveCamera} camera - The camera. - */ - updateCamera(camera: PerspectiveCamera): void; - /** - * Returns a WebXR controller for the given controller index. - * - * @private - * @param {number} index - The controller index. - * @return {WebXRController} The XR controller. - */ - private _getController; -} -/** - * Saves the state of the given renderer and scene and stores it into the given state object. - * Besides, the function also resets the state of the renderer and scene to its default values. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -declare function resetRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; -/** - * Saves the state of the given renderer and stores it into the given state object. - * Besides, the function also resets the state of the renderer to its default values. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -declare function resetRendererState(renderer: Renderer, state?: Object): Object; -/** - * Saves the state of the given scene and stores it into the given state object. - * Besides, the function also resets the state of the scene to its default values. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -declare function resetSceneState(scene: Scene, state?: Object): Object; -/** - * Restores the state of the given renderer and scene from the given state object. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Scene} scene - The scene. - * @param {Object} state - The state to restore. - */ -declare function restoreRendererAndSceneState(renderer: Renderer, scene: Scene, state: Object): void; -/** - * Restores the state of the given renderer from the given state object. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Object} state - The state to restore. - */ -declare function restoreRendererState(renderer: Renderer, state: Object): void; -/** - * Restores the state of the given scene from the given state object. - * - * @private - * @function - * @param {Scene} scene - The scene. - * @param {Object} state - The state to restore. - */ -declare function restoreSceneState(scene: Scene, state: Object): void; -/** - * Saves the state of the given renderer and scene and stores it into the given state object. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -declare function saveRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; -/** - * Saves the state of the given renderer and stores it into the given state object. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -declare function saveRendererState(renderer: Renderer, state?: Object): Object; -/** - * Saves the state of the given scene and stores it into the given state object. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -declare function saveSceneState(scene: Scene, state?: Object): Object; -declare class ShaderCallNodeInternal extends Node { - constructor(shaderNode: any, rawInputs: any); - shaderNode: any; - rawInputs: any; - isShaderCallNodeInternal: boolean; - generateNodeType(builder: any): any; - getElementType(builder: any): any; - getMemberType(builder: any, name: any): any; - call(builder: any): any; - setupOutput(builder: any): any; - getOutputNode(builder: any): any; - build(builder: any, output?: null): any; -} -/** - * Represents lighting model for a shadow material. Used in {@link ShadowNodeMaterial}. - * - * @augments LightingModel - */ -declare class ShadowMaskModel extends LightingModel { - /** - * The shadow mask node. - * - * @type {Node} - */ - shadowNode: Node; - /** - * Only used to save the shadow mask. - * - * @param {Object} input - The input data. - */ - direct({ lightNode }: Object): void; - /** - * Uses the shadow mask to produce the final color. - * - * @param {NodeBuilder} builder - The current node builder. - */ - finish({ context }: NodeBuilder): void; -} -declare function Fn(jsFunc: any, layout?: null): () => void; -declare function ShaderNode(jsFunc: any, nodeType: any): ShaderNodeInternal; -/** - * Add the given node to the current stack. - * - * @param {Node} node - The node to add. - * @returns {Node} The node that was added to the stack. - */ -declare function Stack(node: Node): Node; -declare function addMethodChaining(name: any, nodeElement: any): void; -declare function addNodeElement(name: any): void; -/** - * TSL function for defining a built-in ambient occlusion context for a given node. - * - * @tsl - * @function - * @param {Node} aoNode - The ambient occlusion value node to apply. - * @param {Node} [node=null] - The node whose context should be modified. - * @returns {ContextNode} - */ -declare function builtinAOContext(aoNode: Node, node?: Node): ContextNode; -/** - * TSL function for defining a built-in shadow context for a given node. - * - * @tsl - * @function - * @param {ShadowNode} shadowNode - The shadow node representing the light's shadow. - * @param {Light} light - The light associated with the shadow. - * @param {Node} [node=null] - The node whose context should be modified. - * @returns {ContextNode} - */ -declare function builtinShadowContext(shadowNode: ShadowNode, light: Light, node?: Node): ContextNode; -/** - * TSL function for creating a cache node. - * - * @tsl - * @function - * @deprecated - * @param {Node} node - The node that should be cached. - * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. - * @returns {IsolateNode} - */ -declare function cache(node: Node, parent?: boolean): IsolateNode; -declare function defined(value: any): boolean; -/** - * Returns the MRT texture index for the given name. - * - * @param {Array} textures - The textures of a MRT-configured render target. - * @param {string} name - The name of the MRT texture which index is requested. - * @return {number} The texture index. - */ -declare function getTextureIndex(textures: Array, name: string): number; -/** - * Creates an inspector node to wrap around a given node for inspection purposes. - * - * @tsl - * @param {Node} node - The node to inspect. - * @param {string} [name=''] - Optional name for the inspector node. - * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. - * @returns {Node} The inspector node. - */ -declare function inspector(node: Node, name?: string, callback?: Function | null): Node; -/** - * TSL function for defining a label context value for a given node. - * - * @tsl - * @function - * @deprecated - * @param {Node} node - The node whose context should be modified. - * @param {string} name - The name/label to set. - * @returns {ContextNode} - */ -declare function label(node: Node, name: string): ContextNode; -/** - * TSL function for getting the position in world space for the given light. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @returns {UniformNode} The light's position in world space. - */ -declare function lightPosition(light: Light): UniformNode; -/** - * TSL function for getting projected uv coordinates for the given light. - * Relevant when using maps with spot lights. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @param {Node} [position=positionWorld] -The position to project. - * @returns {Node} The projected uvs. - */ -declare function lightProjectionUV(light: Light, position?: Node): Node; -/** - * TSL function for getting a shadow matrix uniform node for the given light. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @returns {UniformNode} The shadow matrix uniform node. - */ -declare function lightShadowMatrix(light: Light): UniformNode; -/** - * TSL function for getting the light target position in world space for the given light. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @returns {UniformNode} The light target position in world space. - */ -declare function lightTargetPosition(light: Light): UniformNode; -/** - * TSL function for getting the position in view space for the given light. - * - * @tsl - * @function - * @param {Light} light - The light source. - * @returns {UniformNode} The light's position in view space. - */ -declare function lightViewPosition(light: Light): UniformNode; -/** - * TSL function for creating an `OverrideContextNode` to override a single target node. - * - * ```js - * material.contextNode = overrideNode( positionLocal, ( builder ) => positionLocal.add( vec3( 1, 0, 0 ) ) ); - * ``` - * - * @tsl - * @function - * @param {Node} targetNode - The target node that should be overridden. - * @param {Function|Node|null} [callback=null] - A callback function returning the overriding node (which receives the builder as its argument), or the overriding node itself. - * @param {Node|null} [flowNode=null] - The node whose context should be modified. - * @return {OverrideContextNode} The created override context node. - */ -declare function overrideNode(targetNode: Node, callback?: Function | Node | null, flowNode?: Node | null): OverrideContextNode; -/** - * TSL function for creating an `OverrideContextNode` to override multiple target nodes. - * - * ```js - * material.contextNode = overrideNodes( [ - * [ positionView, customPositionView ], - * [ positionViewDirection, ( builder ) => customPositionViewDirection ] - * ] ); - * ``` - * - * @tsl - * @function - * @param {Map|Array>} overrides - The overrides mapping target nodes to callback functions or overriding nodes. - * @param {Node|null} [flowNode=null] - The node whose context should be modified. - * @return {OverrideContextNode} The created override context node. - */ -declare function overrideNodes(overrides: Map | Array>, flowNode?: Node | null): OverrideContextNode; -/** - * Represents the texture of a pass node. - * - * @augments TextureNode - */ -declare class PassTextureNode extends TextureNode { - /** - * Constructs a new pass texture node. - * - * @param {PassNode} passNode - The pass node. - * @param {Texture} texture - The output texture. - */ - constructor(passNode: PassNode, texture: Texture); - /** - * A reference to the pass node. - * - * @type {PassNode} - */ - passNode: PassNode; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @default true - * @readonly - */ - readonly isPassTextureNode: boolean; - setup(builder: any): void; - clone(): any; -} -/** - * This node allows to remap a node value from one range into another but with enabled clamping. E.g a value of - * `0.4` in the range `[ 0.3, 0.5 ]` should be remapped into the normalized range `[ 0, 1 ]`. - * `remapClamp` takes care of that and converts the original value of `0.4` to `0.5`. - * - * @tsl - * @function - * @param {Node} node - The node that should be remapped. - * @param {Node} inLowNode - The source or current lower bound of the range. - * @param {Node} inHighNode - The source or current upper bound of the range. - * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. - * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. - * @returns {Node} - */ -declare function remapClamp(node: Node, inLowNode: Node, inHighNode: Node, outLowNode?: Node | null, outHighNode?: Node | null): Node; -/** - * Replaces the default UV coordinates used in texture lookups. - * - * ```js - *material.contextNode = replaceDefaultUV( ( textureNode ) => { - * - * // ... - * return customUVCoordinates; - * - *} ); - *``` - * - * @tsl - * @function - * @param {function(Node):Node|Node} callback - A callback that receives the texture node - * and must return the new uv coordinates. - * @param {Node} [node=null] - An optional node to which the context will be applied. - * @return {ContextNode} A context node that replaces the default UV coordinates. - */ -declare function replaceDefaultUV(callback: (arg0: Node) => Node | Node, node?: Node): ContextNode; -/** - * Represents the element access on uniform array nodes. - * - * @augments ArrayElementNode - */ -declare class UniformArrayElementNode extends ArrayElementNode { - /** - * Constructs a new buffer node. - * - * @param {UniformArrayNode} uniformArrayNode - The uniform array node to access. - * @param {IndexNode} indexNode - The index data that define the position of the accessed element in the array. - */ - constructor(uniformArrayNode: UniformArrayNode, indexNode: IndexNode); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayBufferElementNode: boolean; - generate(builder: any): any; -} -/** - * VolumetricLightingModel class extends the LightingModel to implement volumetric lighting effects. - * This model calculates the scattering and transmittance of light through a volumetric medium. - * It dynamically adjusts the direction of the ray based on the camera and object positions. - * The model supports custom scattering and depth nodes to enhance the lighting effects. - * - * @augments LightingModel - */ -declare class VolumetricLightingModel extends LightingModel { - start(builder: any): void; - scatteringLight(lightColor: any, builder: any): void; - direct({ lightNode, lightColor }: { - lightNode: any; - lightColor: any; - }, builder: any): void; - directRectArea({ lightColor, lightPosition, halfWidth, halfHeight }: { - lightColor: any; - lightPosition: any; - halfWidth: any; - halfHeight: any; - }, builder: any): void; - finish(builder: any): void; -} -/** - * A WebGL 2 backend utility module for managing shader attributes. - * - * @private - */ -declare class WebGLAttributeUtils { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * Creates the GPU buffer for the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. - */ - createAttribute(attribute: BufferAttribute, bufferType: GLenum): void; - /** - * Updates the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * Destroys the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @param {number} offset - The storage buffer attribute. - * @param {number} count - The offset from which to start reading the - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Creates a WebGL buffer with the given data. - * - * @private - * @param {WebGL2RenderingContext} gl - The rendering context. - * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. - * @param {TypedArray} array - The array of the buffer attribute. - * @param {GLenum} usage - The usage. - * @return {WebGLBuffer} The WebGL buffer. - */ - private _createBuffer; -} -/** - * A WebGL 2 backend utility module for managing extensions. - * - * @private - */ -declare class WebGLExtensions { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - /** - * A list with all the supported WebGL extensions. - * - * @type {Array} - */ - availableExtensions: Array; - /** - * A dictionary with requested WebGL extensions. - * The key is the name of the extension, the value - * the requested extension object. - * - * @type {Object} - */ - extensions: { - [x: string]: Object; - }; - /** - * Returns the extension object for the given extension name. - * - * @param {string} name - The extension name. - * @return {Object} The extension object. - */ - get(name: string): Object; - /** - * Returns `true` if the requested extension is available. - * - * @param {string} name - The extension name. - * @return {boolean} Whether the given extension is available or not. - */ - has(name: string): boolean; -} -/** - * A WebGL 2 backend utility module for managing textures. - * - * @private - */ -declare class WebGLTextureUtils { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - /** - * A reference to a backend module holding extension-related - * utility functions. - * - * @type {WebGLExtensions} - */ - extensions: WebGLExtensions; - /** - * A dictionary for managing default textures. The key - * is the binding point (target), the value the WEbGL texture object. - * - * @type {Object} - */ - defaultTextures: any; - /** - * A scratch framebuffer used for attaching the source texture in - * {@link copyTextureToTexture}. - * - * @private - * @type {?WebGLFramebuffer} - */ - private _srcFramebuffer; - /** - * A scratch framebuffer used for attaching the destination texture in - * {@link copyTextureToTexture}. - * - * @private - * @type {?WebGLFramebuffer} - */ - private _dstFramebuffer; - /** - * Inits the state of the utility. - * - * @private - */ - private _init; - /** - * Returns the native texture type for the given texture. - * - * @param {Texture} texture - The texture. - * @return {GLenum} The native texture type. - */ - getGLTextureType(texture: Texture): GLenum; - /** - * Returns the native texture type for the given texture. - * - * @param {?string} internalFormatName - The internal format name. When `null`, the internal format is derived from the subsequent parameters. - * @param {GLenum} glFormat - The WebGL format. - * @param {GLenum} glType - The WebGL type. - * @param {string} colorSpace - The texture's color space. - * @param {boolean} [forceLinearTransfer=false] - Whether to force a linear transfer or not. - * @return {GLenum} The internal format. - */ - getInternalFormat(internalFormatName: string | null, glFormat: GLenum, glType: GLenum, normalized: any, colorSpace: string, forceLinearTransfer?: boolean): GLenum; - /** - * Sets the texture parameters for the given texture. - * - * @param {GLenum} textureType - The texture type. - * @param {Texture} texture - The texture. - */ - setTextureParameters(textureType: GLenum, texture: Texture): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(texture: Texture): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - * @return {undefined} - */ - createTexture(texture: Texture, options?: Object): undefined; - /** - * Uploads texture buffer data to the GPU memory. - * - * @param {WebGLBuffer} buffer - The buffer data. - * @param {Texture} texture - The texture, - */ - copyBufferToTexture(buffer: WebGLBuffer, texture: Texture): void; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - */ - generateMipmaps(texture: Texture): void; - /** - * Deallocates the render buffers of the given render target. - * - * @param {RenderTarget} renderTarget - The render target. - */ - deallocateRenderBuffers(renderTarget: RenderTarget): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Copies data of the given source texture to the given destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; - /** - * SetupS storage for internal depth/stencil buffers and bind to correct framebuffer. - * - * @param {WebGLRenderbuffer} renderbuffer - The render buffer. - * @param {RenderContext} renderContext - The render context. - * @param {number} samples - The MSAA sample count. - * @param {boolean} [useMultisampledRTT=false] - Whether to use WEBGL_multisampled_render_to_texture or not. - */ - setupRenderBufferStorage(renderbuffer: WebGLRenderbuffer, renderContext: RenderContext, samples: number, useMultisampledRTT?: boolean): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Returns the corresponding typed array type for the given WebGL data type. - * - * @private - * @param {GLenum} glType - The WebGL data type. - * @return {TypedArray.constructor} The typed array type. - */ - private _getTypedArrayType; - /** - * Returns the bytes-per-texel value for the given WebGL data type and texture format. - * - * @private - * @param {GLenum} glType - The WebGL data type. - * @param {GLenum} glFormat - The WebGL texture format. - * @return {number} The bytes-per-texel. - */ - private _getBytesPerTexel; - /** - * Frees the internal resources. - */ - dispose(): void; -} -declare class WebGLBufferRenderer { - constructor(backend: any); - gl: any; - extensions: any; - info: any; - mode: any; - index: number; - type: any; - object: any; - render(start: any, count: any): void; - renderInstances(start: any, count: any, primcount: any): void; - renderMultiDraw(starts: any, counts: any, drawCount: any): void; -} -/** - * A WebGL 2 backend utility module for managing the WebGL state. - * - * The major goal of this module is to reduce the number of state changes - * by caching the WEbGL state with a series of variables. In this way, the - * renderer only executes state change commands when necessary which - * improves the overall performance. - * - * @private - */ -declare class WebGLState { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - enabled: {}; - parameters: {}; - currentFlipSided: any; - currentCullFace: any; - currentProgram: any; - currentBlendingEnabled: boolean; - currentBlending: any; - currentBlendEquation: any; - currentBlendEquationAlpha: number | null; - currentBlendSrc: any; - currentBlendDst: number | null; - currentBlendSrcAlpha: number | null; - currentBlendDstAlpha: number | null; - currentBlendColor: Color; - currentBlendAlpha: number; - currentPremultipledAlpha: boolean | null; - currentPolygonOffsetFactor: any; - currentPolygonOffsetUnits: number | null; - currentColorMask: any; - currentDepthReversed: boolean; - currentDepthFunc: any; - currentDepthMask: any; - currentStencilFunc: any; - currentStencilRef: number | null; - currentStencilFuncMask: number | null; - currentStencilFail: any; - currentStencilZFail: number | null; - currentStencilZPass: number | null; - currentStencilMask: any; - currentLineWidth: any; - currentClippingPlanes: number; - currentVAO: any; - currentIndex: WebGLBuffer | null; - currentBoundFramebuffers: {}; - currentDrawbuffers: WeakMap; - maxTextures: any; - currentTextureSlot: any; - currentBoundTextures: {}; - currentBoundBufferBases: {}; - /** - * Inits the state of the utility. - * - * @private - */ - private _init; - currentScissor: Vector4 | undefined; - currentViewport: Vector4 | undefined; - _tempVec4: Vector4 | undefined; - /** - * Enables the given WebGL capability. - * - * This method caches the capability state so - * `gl.enable()` is only called when necessary. - * - * @param {GLenum} id - The capability to enable. - */ - enable(id: GLenum): void; - /** - * Disables the given WebGL capability. - * - * This method caches the capability state so - * `gl.disable()` is only called when necessary. - * - * @param {GLenum} id - The capability to enable. - */ - disable(id: GLenum): void; - /** - * Specifies whether polygons are front- or back-facing - * by setting the winding orientation. - * - * This method caches the state so `gl.frontFace()` is only - * called when necessary. - * - * @param {boolean} flipSided - Whether triangles flipped their sides or not. - */ - setFlipSided(flipSided: boolean): void; - /** - * Specifies whether or not front- and/or back-facing - * polygons can be culled. - * - * This method caches the state so `gl.cullFace()` is only - * called when necessary. - * - * @param {number} cullFace - Defines which polygons are candidates for culling. - */ - setCullFace(cullFace: number): void; - /** - * Specifies the width of line primitives. - * - * This method caches the state so `gl.lineWidth()` is only - * called when necessary. - * - * @param {number} width - The line width. - */ - setLineWidth(width: number): void; - setMRTBlending(textures: any, mrt: any, material: any): void; - /** - * Applies blending configuration for a specific draw buffer index. - * - * @private - * @param {number} index - The draw buffer index. - * @param {Object} blending - The blending configuration (material or BlendMode). - */ - private _setMRTBlendingIndex; - /** - * Defines the blending. - * - * This method caches the state so `gl.blendEquation()`, `gl.blendEquationSeparate()`, - * `gl.blendFunc()`, `gl.blendFuncSeparate()` and `gl.blendColor()` are only called when necessary. - * - * @param {number} blending - The blending type. - * @param {number} blendEquation - The blending equation. - * @param {number} blendSrc - Only relevant for custom blending. The RGB source blending factor. - * @param {number} blendDst - Only relevant for custom blending. The RGB destination blending factor. - * @param {number} blendEquationAlpha - Only relevant for custom blending. The blending equation for alpha. - * @param {number} blendSrcAlpha - Only relevant for custom blending. The alpha source blending factor. - * @param {number} blendDstAlpha - Only relevant for custom blending. The alpha destination blending factor. - * @param {Color} blendColor - Only relevant for custom blending. The RGB values of the constant blend color. - * @param {number} blendAlpha - Only relevant for custom blending. The alpha value of the constant blend color. - * @param {boolean} premultipliedAlpha - Whether premultiplied alpha is enabled or not. - */ - setBlending(blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number, blendColor: Color, blendAlpha: number, premultipliedAlpha: boolean): void; - /** - * Specifies whether colors can be written when rendering - * into a framebuffer or not. - * - * This method caches the state so `gl.colorMask()` is only - * called when necessary. - * - * @param {boolean} colorMask - The color mask. - */ - setColorMask(colorMask: boolean): void; - /** - * Specifies whether the depth test is enabled or not. - * - * @param {boolean} depthTest - Whether the depth test is enabled or not. - */ - setDepthTest(depthTest: boolean): void; - /** - * Configures the WebGL state to use a reversed depth buffer. - * - * @param {boolean} reversed - Whether the depth buffer is reversed or not. - */ - setReversedDepth(reversed: boolean): void; - /** - * Specifies whether depth values can be written when rendering - * into a framebuffer or not. - * - * This method caches the state so `gl.depthMask()` is only - * called when necessary. - * - * @param {boolean} depthMask - The depth mask. - */ - setDepthMask(depthMask: boolean): void; - /** - * Specifies the depth compare function. - * - * This method caches the state so `gl.depthFunc()` is only - * called when necessary. - * - * @param {number} depthFunc - The depth compare function. - */ - setDepthFunc(depthFunc: number): void; - /** - * Specifies the scissor box. - * - * @param {number} x - The x-coordinate of the lower left corner of the viewport. - * @param {number} y - The y-coordinate of the lower left corner of the viewport. - * @param {number} width - The width of the viewport. - * @param {number} height - The height of the viewport. - * - */ - scissor(x: number, y: number, width: number, height: number): void; - /** - * Specifies the viewport. - * - * @param {number} x - The x-coordinate of the lower left corner of the viewport. - * @param {number} y - The y-coordinate of the lower left corner of the viewport. - * @param {number} width - The width of the viewport. - * @param {number} height - The height of the viewport. - * - */ - viewport(x: number, y: number, width: number, height: number): void; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Specifies whether the stencil test is enabled or not. - * - * @param {boolean} stencilTest - Whether the stencil test is enabled or not. - */ - setStencilTest(stencilTest: boolean): void; - /** - * Specifies whether stencil values can be written when rendering - * into a framebuffer or not. - * - * This method caches the state so `gl.stencilMask()` is only - * called when necessary. - * - * @param {boolean} stencilMask - The stencil mask. - */ - setStencilMask(stencilMask: boolean): void; - /** - * Specifies whether the stencil test functions. - * - * This method caches the state so `gl.stencilFunc()` is only - * called when necessary. - * - * @param {number} stencilFunc - The stencil compare function. - * @param {number} stencilRef - The reference value for the stencil test. - * @param {number} stencilMask - A bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. - */ - setStencilFunc(stencilFunc: number, stencilRef: number, stencilMask: number): void; - /** - * Specifies whether the stencil test operation. - * - * This method caches the state so `gl.stencilOp()` is only - * called when necessary. - * - * @param {number} stencilFail - The function to use when the stencil test fails. - * @param {number} stencilZFail - The function to use when the stencil test passes, but the depth test fail. - * @param {number} stencilZPass - The function to use when both the stencil test and the depth test pass, - * or when the stencil test passes and there is no depth buffer or depth testing is disabled. - */ - setStencilOp(stencilFail: number, stencilZFail: number, stencilZPass: number): void; - /** - * Configures the WebGL state for the given material. - * - * @param {Material} material - The material to configure the state for. - * @param {number} frontFaceCW - Whether the front faces are counter-clockwise or not. - * @param {number} hardwareClippingPlanes - The number of hardware clipping planes. - */ - setMaterial(material: Material, frontFaceCW: number, hardwareClippingPlanes: number): void; - /** - * Specifies the polygon offset. - * - * This method caches the state so `gl.polygonOffset()` is only - * called when necessary. - * - * @param {boolean} polygonOffset - Whether polygon offset is enabled or not. - * @param {number} factor - The scale factor for the variable depth offset for each polygon. - * @param {number} units - The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. - */ - setPolygonOffset(polygonOffset: boolean, factor: number, units: number): void; - /** - * Defines the usage of the given WebGL program. - * - * This method caches the state so `gl.useProgram()` is only - * called when necessary. - * - * @param {WebGLProgram} program - The WebGL program to use. - * @return {boolean} Whether a program change has been executed or not. - */ - useProgram(program: WebGLProgram): boolean; - /** - * Sets the vertex state by binding the given VAO and element buffer. - * - * @param {WebGLVertexArrayObject} vao - The VAO. - * @param {?WebGLBuffer} indexBuffer - The index buffer. - * @return {boolean} Whether a vertex state has been changed or not. - */ - setVertexState(vao: WebGLVertexArrayObject, indexBuffer?: WebGLBuffer | null): boolean; - /** - * Resets the vertex array state by resetting the VAO and element buffer. - */ - resetVertexState(): void; - /** - * Binds the given framebuffer. - * - * This method caches the state so `gl.bindFramebuffer()` is only - * called when necessary. - * - * @param {number} target - The binding point (target). - * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer to bind. - * @return {boolean} Whether a bind has been executed or not. - */ - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): boolean; - /** - * Defines draw buffers to which fragment colors are written into. - * Configures the MRT setup of custom framebuffers. - * - * This method caches the state so `gl.drawBuffers()` is only - * called when necessary. - * - * @param {RenderContext} renderContext - The render context. - * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer. - */ - drawBuffers(renderContext: RenderContext, framebuffer: WebGLFramebuffer): void; - /** - * Makes the given texture unit active. - * - * This method caches the state so `gl.activeTexture()` is only - * called when necessary. - * - * @param {number} webglSlot - The texture unit to make active. - */ - activeTexture(webglSlot: number): void; - /** - * Binds the given WebGL texture to a target. - * - * This method caches the state so `gl.bindTexture()` is only - * called when necessary. - * - * @param {number} webglType - The binding point (target). - * @param {WebGLTexture} webglTexture - The WebGL texture to bind. - * @param {number} webglSlot - The texture. - */ - bindTexture(webglType: number, webglTexture: WebGLTexture, webglSlot: number): void; - /** - * Binds a given WebGL buffer to a given binding point (target) at a given index. - * - * This method caches the state so `gl.bindBufferBase()` is only - * called when necessary. - * - * @param {number} target - The target for the bind operation. - * @param {number} index - The index of the target. - * @param {WebGLBuffer} buffer - The WebGL buffer. - * @return {boolean} Whether a bind has been executed or not. - */ - bindBufferBase(target: number, index: number, buffer: WebGLBuffer): boolean; - /** - * Unbinds the current bound texture. - * - * This method caches the state so `gl.bindTexture()` is only - * called when necessary. - */ - unbindTexture(): void; - /** - * Returns the value for the given parameter. - * - * @param {number} name - The parameter to get the value for. - * @return {any} The value for the given parameter. - */ - getParameter(name: number): any; - /** - * Specifies a pixel storage mode. - * - * @param {number} name - The parameter to set. - * @param {any} value - A value to set the parameter to. - */ - pixelStorei(name: number, value: any): void; - /** - * Restores the WebGL state to its default and clears the cache so subsequent renderings - * re-apply the required state. Useful when the WebGL context is shared with other libraries. - */ - reset(): void; -} -/** - * A WebGL 2 backend utility module with common helpers. - * - * @private - */ -declare class WebGLUtils { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - /** - * A reference to a backend module holding extension-related - * utility functions. - * - * @type {WebGLExtensions} - */ - extensions: WebGLExtensions; - /** - * Converts the given three.js constant into a WebGL constant. - * The method currently supports the conversion of texture formats - * and types. - * - * @param {number} p - The three.js constant. - * @param {string} [colorSpace=NoColorSpace] - The color space. - * @return {?number} The corresponding WebGL constant. - */ - convert(p: number, colorSpace?: string): number | null; - /** - * This method can be used to synchronize the CPU with the GPU by waiting until - * ongoing GPU commands have been completed. - * - * @private - * @return {Promise} A promise that resolves when all ongoing GPU commands have been completed. - */ - private _clientWaitAsync; -} -/** - * A special type of render target that is used when rendering - * with the WebXR Device API. - * - * @private - * @augments RenderTarget - */ -declare class XRRenderTarget extends RenderTarget { - /** - * Constructs a new XR render target. - * - * @param {number} [width=1] - The width of the render target. - * @param {number} [height=1] - The height of the render target. - * @param {Object} [options={}] - The configuration options. - */ - constructor(width?: number, height?: number, options?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isXRRenderTarget: boolean; - /** - * Whether the attachments of the render target - * are defined by external textures. This flag is - * set to `true` when using the WebXR Layers API. - * - * @private - * @type {boolean} - * @default false - */ - private _hasExternalTextures; - /** - * Whether a depth buffer should automatically be allocated - * for this XR render target or not. - * - * Allocating a depth buffer is the default behavior of XR render - * targets. However, when using the WebXR Layers API, this flag - * must be set to `false` when the `ignoreDepthValues` property of - * the projection layers evaluates to `false`. - * - * Reference: {@link https://www.w3.org/TR/webxrlayers-1/#dom-xrprojectionlayer-ignoredepthvalues}. - * - * @private - * @type {boolean} - * @default true - */ - private _autoAllocateDepthBuffer; - /** - * Whether this render target is associated with a XRWebGLLayer. - * - * A XRWebGLLayer points to an opaque framebuffer. Basically, - * this means that you don't have access to its bound color, - * stencil and depth buffers. We need to handle this framebuffer - * differently since its textures are always bound. - * - * @private - * @type {boolean} - * @default false - * */ - private _isOpaqueFramebuffer; - copy(source: any): this; -} -/** - * Class for representing compute pipelines. - * - * @private - * @augments Pipeline - */ -declare class ComputePipeline extends Pipeline { - /** - * Constructs a new compute pipeline. - * - * @param {string} cacheKey - The pipeline's cache key. - * @param {ProgrammableStage} computeProgram - The pipeline's compute shader. - */ - constructor(cacheKey: string, computeProgram: ProgrammableStage); - /** - * The pipeline's compute shader. - * - * @type {ProgrammableStage} - */ - computeProgram: ProgrammableStage; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isComputePipeline: boolean; -} -/** - * Class for representing programmable stages which are vertex, - * fragment or compute shaders. Unlike fixed-function states (like blending), - * they represent the programmable part of a pipeline. - * - * @private - */ -declare class ProgrammableStage { - /** - * Constructs a new programmable stage. - * - * @param {string} code - The shader code. - * @param {('vertex'|'fragment'|'compute')} stage - The type of stage. - * @param {string} name - The name of the shader. - * @param {?Array} [transforms=null] - The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - * @param {?Array} [attributes=null] - The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - */ - constructor(code: string, stage: ("vertex" | "fragment" | "compute"), name: string, transforms?: Array | null, attributes?: Array | null); - /** - * The id of the programmable stage. - * - * @type {number} - */ - id: number; - /** - * The shader code. - * - * @type {string} - */ - code: string; - /** - * The type of stage. - * - * @type {string} - */ - stage: string; - /** - * The name of the stage. - * This is used for debugging purposes. - * - * @type {string} - */ - name: string; - /** - * The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - * - * @type {?Array} - */ - transforms: Array | null; - /** - * The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - * - * @type {?Array} - */ - attributes: Array | null; - /** - * How often the programmable stage is currently in use. - * - * @type {number} - * @default 0 - */ - usedTimes: number; -} -/** - * Represents a buffer binding type. - * - * @private - * @abstract - * @augments Binding - */ -declare class Buffer extends Binding { - /** - * Constructs a new buffer. - * - * @param {string} name - The buffer's name. - * @param {TypedArray} [buffer=null] - The buffer. - */ - constructor(name: string, buffer?: TypedArray); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBuffer: boolean; - /** - * The bytes per element. - * - * @type {number} - */ - bytesPerElement: number; - /** - * A reference to the internal buffer. - * - * @private - * @type {TypedArray} - */ - private _buffer; - /** - * An array of update ranges. - * - * @private - * @type {Array<{start: number, count: number}>} - */ - private _updateRanges; - /** - * The array of update ranges. - * - * @type {Array<{start: number, count: number}>} - */ - get updateRanges(): Array<{ - start: number; - count: number; - }>; - /** - * Adds an update range. - * - * @param {number} start - The start index. - * @param {number} count - The number of elements. - */ - addUpdateRange(start: number, count: number): void; - /** - * Clears all update ranges. - */ - clearUpdateRanges(): void; - /** - * The buffer's byte length. - * - * @type {number} - * @readonly - */ - readonly get byteLength(): number; - /** - * A reference to the internal buffer. - * - * @type {Float32Array} - * @readonly - */ - readonly get buffer(): Float32Array; - /** - * Updates the binding. - * - * @return {boolean} Whether the buffer has been updated and must be - * uploaded to the GPU. - */ - update(): boolean; - /** - * Releases the buffer. - */ - release(): void; -} -/** - * A WebGPU backend utility module with common helpers. - * - * @private - */ -declare class WebGPUUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Caches the preferred canvas format. - * - * @private - * @type {?string} - * @default null - */ - private _preferredCanvasFormat; - /** - * Returns the depth/stencil GPU format for the given render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {string} The depth/stencil GPU texture format. - */ - getCurrentDepthStencilFormat(renderContext: RenderContext): string; - /** - * Returns the GPU format for the given texture. - * - * @param {Texture} texture - The texture. - * @return {string} The GPU texture format. - */ - getTextureFormatGPU(texture: Texture): string; - /** - * Returns an object that defines the multi-sampling state of the given texture. - * - * @param {Texture} texture - The texture. - * @return {Object} The multi-sampling state. - */ - getTextureSampleData(texture: Texture): Object; - /** - * Returns the default color attachment's GPU format of the current render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {string} The GPU texture format of the default color attachment. - */ - getCurrentColorFormat(renderContext: RenderContext): string; - /** - * Returns the GPU formats of all color attachments of the current render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {Array} The GPU texture formats of all color attachments. - */ - getCurrentColorFormats(renderContext: RenderContext): Array; - /** - * Returns the output color space of the current render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {string} The output color space. - */ - getCurrentColorSpace(renderContext: RenderContext): string; - /** - * Returns GPU primitive topology for the given object and material. - * - * @param {Object3D} object - The 3D object. - * @param {Material} material - The material. - * @return {string} The GPU primitive topology. - */ - getPrimitiveTopology(object: Object3D, material: Material): string; - /** - * Returns a modified sample count from the given sample count value. - * - * That is required since WebGPU only supports either 1 or 4. - * - * @param {number} sampleCount - The input sample count. - * @return {number} The (potentially updated) output sample count. - */ - getSampleCount(sampleCount: number): number; - /** - * Returns the sample count of the given render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {number} The sample count. - */ - getSampleCountRenderContext(renderContext: RenderContext): number; - /** - * Returns the preferred canvas format. - * - * There is a separate method for this so it's possible to - * honor edge cases for specific devices. - * - * @return {string} The GPU texture format of the canvas. - */ - getPreferredCanvasFormat(): string; -} -/** - * A WebGPU backend utility module for managing shader attributes. - * - * @private - */ -declare class WebGPUAttributeUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Creates the GPU buffer for the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - * @param {GPUBufferUsage} usage - A flag that indicates how the buffer may be used after its creation. - */ - createAttribute(attribute: BufferAttribute, usage: GPUBufferUsage): void; - /** - * Updates the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * This method creates the vertex buffer layout data which are - * require when creating a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {Array} An array holding objects which describe the vertex buffer layout. - */ - createShaderVertexBuffers(renderObject: RenderObject): Array; - /** - * Destroys the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {number} count - The offset from which to start reading the - * @param {number} offset - The storage buffer attribute. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Returns the vertex format of the given buffer attribute. - * - * @private - * @param {BufferAttribute} geometryAttribute - The buffer attribute. - * @return {string|undefined} The vertex format (e.g. 'float32x3'). - */ - private _getVertexFormat; - /** - * Utility method for handling interleaved buffer attributes correctly. - * To process them, their `InterleavedBuffer` is returned. - * - * @private - * @param {BufferAttribute} attribute - The attribute. - * @return {BufferAttribute|InterleavedBuffer} - */ - private _getBufferAttribute; -} -/** - * A WebGPU backend utility module for managing bindings. - * - * When reading the documentation it's helpful to keep in mind that - * all class definitions starting with 'GPU*' are modules from the - * WebGPU API. So for example `BindGroup` is a class from the engine - * whereas `GPUBindGroup` is a class from WebGPU. - * - * @private - */ -declare class WebGPUBindingUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * A cache that maps combinations of layout entries to existing bind group layouts. - * - * @private - * @type {Map} - */ - private _bindGroupLayoutCache; - /** - * Creates a GPU bind group layout for the given bind group. - * - * @param {BindGroup} bindGroup - The bind group. - * @return {GPUBindGroupLayout} The GPU bind group layout. - */ - createBindingsLayout(bindGroup: BindGroup): GPUBindGroupLayout; - /** - * Creates bindings from the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version?: number): void; - /** - * Updates a buffer binding. - * - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(binding: Buffer): void; - /** - * Creates a GPU bind group for the camera index. - * - * @param {Uint32Array} data - The index data. - * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. - * @return {GPUBindGroup} The GPU bind group. - */ - createBindGroupIndex(data: Uint32Array, layoutGPU: GPUBindGroupLayout): GPUBindGroup; - /** - * Creates a GPU bind group for the given bind group and GPU layout. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. - * @return {GPUBindGroup} The GPU bind group. - */ - createBindGroup(bindGroup: BindGroup, layoutGPU: GPUBindGroupLayout): GPUBindGroup; - /** - * Creates a GPU bind group layout entries for the given bind group. - * - * @private - * @param {BindGroup} bindGroup - The bind group. - * @return {Array} The GPU bind group layout entries. - */ - private _createLayoutEntries; - /** - * Delete the data associated with a bind group. - * - * @param {BindGroup} bindGroup - The bind group. - */ - deleteBindGroupData(bindGroup: BindGroup): void; - /** - * Frees internal resources. - */ - dispose(): void; -} -/** - * A WebGPU backend utility module for managing the device's capabilities. - * - * @private - */ -declare class WebGPUCapabilities { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Returns the maximum anisotropy texture filtering value. - * - * @return {number} The maximum anisotropy texture filtering value. - */ - getMaxAnisotropy(): number; - /** - * Returns the maximum number of bytes available for uniform buffers. - * - * @return {number} The maximum number of bytes available for uniform buffers. - */ - getUniformBufferLimit(): number; -} -/** - * A WebGPU backend utility module for managing pipelines. - * - * @private - */ -declare class WebGPUPipelineUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Returns the sample count derived from the given render context. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @return {number} The sample count. - */ - private _getSampleCount; - /** - * Creates a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(renderObject: RenderObject, promises: Array>): void; - /** - * Creates GPU render bundle encoder for the given render context. - * - * @param {RenderContext} renderContext - The render context. - * @param {?string} [label='renderBundleEncoder'] - The label. - * @return {GPURenderBundleEncoder} The GPU render bundle encoder. - */ - createBundleEncoder(renderContext: RenderContext, label?: string | null): GPURenderBundleEncoder; - /** - * Creates a compute pipeline for the given compute node. - * - * @param {ComputePipeline} pipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(pipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; - /** - * Reads line-accurate diagnostics from shader modules and logs them. - * Called from pipeline creation error paths to turn opaque validation - * failures into actionable WGSL feedback. - * - * @private - * @param {Array<{program: ProgrammableStage, module: GPUShaderModule}>} stages - Pairs of program + compiled shader module. - * @param {string} pipelineLabel - Label of the owning pipeline, used as log prefix. - * @return {Promise} - */ - private _reportShaderDiagnostics; - /** - * Returns the blending state as a descriptor object required - * for the pipeline creation. - * - * @private - * @param {Material|BlendMode} object - The object containing blending information. - * @return {Object} The blending state. - */ - private _getBlending; - /** - * Returns the GPU blend factor which is required for the pipeline creation. - * - * @private - * @param {number} blend - The blend factor as a three.js constant. - * @return {string} The GPU blend factor. - */ - private _getBlendFactor; - /** - * Returns the GPU stencil compare function which is required for the pipeline creation. - * - * @private - * @param {Material} material - The material. - * @return {string} The GPU stencil compare function. - */ - private _getStencilCompare; - /** - * Returns the GPU stencil operation which is required for the pipeline creation. - * - * @private - * @param {number} op - A three.js constant defining the stencil operation. - * @return {string} The GPU stencil operation. - */ - private _getStencilOperation; - /** - * Returns the GPU blend operation which is required for the pipeline creation. - * - * @private - * @param {number} blendEquation - A three.js constant defining the blend equation. - * @return {string} The GPU blend operation. - */ - private _getBlendOperation; - /** - * Returns the primitive state as a descriptor object required - * for the pipeline creation. - * - * @private - * @param {Object3D} object - The 3D object. - * @param {BufferGeometry} geometry - The geometry. - * @param {Material} material - The material. - * @return {Object} The primitive state. - */ - private _getPrimitiveState; - /** - * Returns the GPU color write mask which is required for the pipeline creation. - * - * @private - * @param {Material} material - The material. - * @return {number} The GPU color write mask. - */ - private _getColorWriteMask; - /** - * Returns the GPU depth compare function which is required for the pipeline creation. - * - * @private - * @param {Material} material - The material. - * @return {string} The GPU depth compare function. - */ - private _getDepthCompare; -} -/** - * A WebGPU backend utility module for managing textures. - * - * @private - */ -declare class WebGPUTextureUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * A reference to the pass utils. - * - * @type {?WebGPUTexturePassUtils} - * @default null - */ - _passUtils: WebGPUTexturePassUtils | null; - /** - * A dictionary for managing default textures. The key - * is the texture format, the value the texture object. - * - * @type {Object} - */ - defaultTexture: { - [x: string]: Texture; - }; - /** - * A dictionary for managing default cube textures. The key - * is the texture format, the value the texture object. - * - * @type {Object} - */ - defaultCubeTexture: { - [x: string]: CubeTexture; - }; - /** - * A default video frame. - * - * @type {?VideoFrame} - * @default null - */ - defaultVideoFrame: VideoFrame | null; - /** - * A cache of shared texture samplers. - * - * @type {Map} - */ - _samplerCache: Map; - /** - * Creates a GPU sampler for the given texture. - * - * @param {Sampler} binding - The sampler binding to update. - * @return {string} The current sampler key. - */ - updateSampler(binding: Sampler): string; - /** - * Frees the GPU sampler referenced by the given sampler binding. - * - * @param {Sampler} binding - The sampler binding to free. - */ - destroySampler(binding: Sampler): void; - /** - * Releases the pooled sampler referenced by the given binding data and - * removes it from the cache when no binding references it anymore. - * - * @private - * @param {Object} bindingData - The binding data holding the sampler reference. - */ - private _releaseSampler; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(texture: Texture): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(texture: Texture, options?: Object): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. - */ - generateMipmaps(texture: Texture, encoder?: GPUCommandEncoder | null): void; - /** - * Returns the color buffer representing the color - * attachment of the default framebuffer. - * - * @return {GPUTexture} The color buffer. - */ - getColorBuffer(): GPUTexture; - /** - * Returns the depth buffer representing the depth - * attachment of the default framebuffer. - * - * @param {boolean} [depth=true] - Whether depth is enabled or not. - * @param {boolean} [stencil=false] - Whether stencil is enabled or not. - * @return {GPUTexture} The depth buffer. - */ - getDepthBuffer(depth?: boolean, stencil?: boolean): GPUTexture; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Frees all internal resources. - */ - dispose(): void; - /** - * Returns the default GPU texture for the given format. - * - * @private - * @param {string} format - The GPU format. - * @return {GPUTexture} The GPU texture. - */ - private _getDefaultTextureGPU; - /** - * Returns the default GPU cube texture for the given format. - * - * @private - * @param {string} format - The GPU format. - * @return {GPUTexture} The GPU texture. - */ - private _getDefaultCubeTextureGPU; - /** - * Uploads cube texture image data to the GPU memory. - * - * @private - * @param {CubeTexture} texture - The cube texture. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - */ - private _copyCubeMapToTexture; - /** - * Uploads texture image data to the GPU memory. - * - * @private - * @param {HTMLImageElement|ImageBitmap|HTMLCanvasElement} image - The image data. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - * @param {number} originDepth - The origin depth. - * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. - * @param {boolean} premultiplyAlpha - Whether the texture should have its RGB channels premultiplied by the alpha channel or not. - * @param {number} [mipLevel=0] - The mip level where the data should be copied to. - */ - private _copyImageToTexture; - /** - * Returns the pass utils singleton. - * - * @private - * @return {WebGPUTexturePassUtils} The utils instance. - */ - private _getPassUtils; - /** - * Generates mipmaps for the given GPU texture. - * - * @private - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. - */ - private _generateMipmaps; - /** - * Flip the contents of the given GPU texture along its vertical axis. - * - * @private - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {Object} textureDescriptorGPU - The texture descriptor. - * @param {number} [originDepth=0] - The origin depth. - */ - private _flipY; - /** - * Uploads texture buffer data to the GPU memory. - * - * @private - * @param {Object} image - An object defining the image buffer data. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - * @param {number} originDepth - The origin depth. - * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. - * @param {number} [depth=0] - The depth offset when copying array or 3D texture data. - * @param {number} [mipLevel=0] - The mip level where the data should be copied to. - */ - private _copyBufferToTexture; - /** - * Uploads compressed texture data to the GPU memory. - * - * @private - * @param {Array} mipmaps - An array with mipmap data. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - * @param {?Set} [layerUpdates=null] - The layer indices to update. - */ - private _copyCompressedBufferToTexture; - /** - * This method is only relevant for compressed texture formats. It returns a block - * data descriptor for the given GPU compressed texture format. - * - * @private - * @param {string} format - The GPU compressed texture format. - * @return {Object} The block data descriptor. - */ - private _getBlockData; - /** - * Converts the three.js uv wrapping constants to GPU address mode constants. - * - * @private - * @param {number} value - The three.js constant defining a uv wrapping mode. - * @return {string} The GPU address mode. - */ - private _convertAddressMode; - /** - * Converts the three.js filter constants to GPU filter constants. - * - * @private - * @param {number} value - The three.js constant defining a filter mode. - * @return {string} The GPU filter mode. - */ - private _convertFilterMode; - /** - * Converts the three.js filter constants to a GPU mipmap filter constant. - * Unlike `_convertFilterMode`, this extracts the between-mip-level filtering - * axis from the combined three.js constant rather than the within-level axis. - * - * @private - * @param {number} value - The three.js constant defining a filter mode. - * @return {string} The GPU mipmap filter mode. - */ - private _convertMipmapFilterMode; - /** - * Returns the bytes-per-texel value for the given GPU texture format. - * - * @private - * @param {string} format - The GPU texture format. - * @return {number} The bytes-per-texel. - */ - private _getBytesPerTexel; - /** - * Returns the corresponding typed array type for the given GPU texture format. - * - * @private - * @param {string} format - The GPU texture format. - * @return {TypedArray.constructor} The typed array type. - */ - private _getTypedArrayType; - /** - * Returns the GPU dimensions for the given texture. - * - * @private - * @param {Texture} texture - The texture. - * @return {string} The GPU dimension. - */ - private _getDimension; -} -/** - * Represents a sampler binding type. - * - * @private - * @augments Binding - */ -declare class Sampler extends Binding { - /** - * Constructs a new sampler. - * - * @param {string} name - The samplers's name. - * @param {?Texture} texture - The texture this binding is referring to. - */ - constructor(name: string, texture: Texture | null); - /** - * The texture the sampler is referring to. - * - * @private - * @type {?Texture} - */ - private _texture; - /** - * The binding's version. - * - * @type {number} - */ - version: number; - /** - * The binding's generation which is an additional version - * qualifier. - * - * @type {?number} - * @default null - */ - generation: number | null; - /** - * The binding's sampler key. - * - * @type {string} - * @default '' - */ - samplerKey: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampler: boolean; - /** - * Sets the texture of this sampler. - * - * @param {Texture} value - The texture to set. - */ - set texture(value: Texture); - /** - * Gets the texture of this sampler. - * @return {?Texture} The texture. - */ - get texture(): Texture | null; - /** - * Updates the binding. - * - * @return {boolean} Whether the texture has been updated and must be - * uploaded to the GPU. - */ - update(): boolean; - /** - * Resets the version and generation. This is used when the texture - * the binding is pointing to is disposed or exchanged. - */ - reset(): void; - /** - * Releases the texture reference. - */ - release(): void; -} -/** - * This module is used to represent render bundles inside the renderer - * for further processing. - * - * @private - */ -declare class RenderBundle { - /** - * Constructs a new bundle group. - * - * @param {BundleGroup} bundleGroup - The bundle group. - * @param {Camera} camera - The camera the bundle group is rendered with. - * @param {RenderContext} renderContext - The render context the bundle is rendered with. - */ - constructor(bundleGroup: BundleGroup, camera: Camera, renderContext: RenderContext); - bundleGroup: BundleGroup; - camera: Camera; - renderContext: RenderContext; -} -/** - * Represents an element of a 'workgroup' scoped buffer. - * - * @augments ArrayElementNode - */ -declare class WorkgroupInfoElementNode extends ArrayElementNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWorkgroupInfoElementNode: boolean; - generate(builder: any, output: any): any; -} -/** - * This class represents a uniform buffer binding but with - * an API that allows to maintain individual uniform objects. - * - * @private - * @augments UniformBuffer - */ -declare class UniformsGroup extends UniformBuffer { - /** - * Constructs a new uniforms group. - * - * @param {string} name - The group's name. - */ - constructor(name: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformsGroup: boolean; - /** - * An array with the raw uniform values. - * - * @private - * @type {?Array} - * @default null - */ - private _values; - /** - * An array of uniform objects. - * - * The order of uniforms in this array must match the order of uniforms in the shader. - * - * @type {Array} - */ - uniforms: Array; - /** - * A cache for the uniform update ranges. - * - * @private - * @type {Map} - */ - private _updateRangeCache; - /** - * Uniform indices whose range has already been pushed into `updateRanges` - * during the current update cycle. Reset on `clearUpdateRanges()`. - * - * @private - * @type {Set} - */ - private _addedIndices; - /** - * Adds a uniform's update range to this buffer. - * - * @param {Uniform} uniform - The uniform. - */ - addUniformUpdateRange(uniform: Uniform): void; - /** - * Adds a uniform to this group. - * - * @param {Uniform} uniform - The uniform to add. - * @return {UniformsGroup} A reference to this group. - */ - addUniform(uniform: Uniform): UniformsGroup; - /** - * Removes a uniform from this group. - * - * @param {Uniform} uniform - The uniform to remove. - * @return {UniformsGroup} A reference to this group. - */ - removeUniform(uniform: Uniform): UniformsGroup; - /** - * An array with the raw uniform values. - * - * @type {Array} - */ - get values(): Array; - /** - * Updates a given uniform by calling an update method matching - * the uniforms type. - * - * @param {Uniform} uniform - The uniform to update. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateByType(uniform: Uniform): boolean; - /** - * Updates a given Number uniform. - * - * @param {NumberUniform} uniform - The Number uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateNumber(uniform: NumberUniform): boolean; - /** - * Updates a given Vector2 uniform. - * - * @param {Vector2Uniform} uniform - The Vector2 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateVector2(uniform: Vector2Uniform): boolean; - /** - * Updates a given Vector3 uniform. - * - * @param {Vector3Uniform} uniform - The Vector3 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateVector3(uniform: Vector3Uniform): boolean; - /** - * Updates a given Vector4 uniform. - * - * @param {Vector4Uniform} uniform - The Vector4 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateVector4(uniform: Vector4Uniform): boolean; - /** - * Updates a given Color uniform. - * - * @param {ColorUniform} uniform - The Color uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateColor(uniform: ColorUniform): boolean; - /** - * Updates a given Matrix3 uniform. - * - * @param {Matrix3Uniform} uniform - The Matrix3 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateMatrix3(uniform: Matrix3Uniform): boolean; - /** - * Updates a given Matrix4 uniform. - * - * @param {Matrix4Uniform} uniform - The Matrix4 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateMatrix4(uniform: Matrix4Uniform): boolean; - /** - * Returns a typed array that matches the given data type. - * - * @private - * @param {string} type - The data type. - * @return {TypedArray} The typed array. - */ - private _getBufferForType; -} -/** - * A binding represents the connection between a resource (like a texture, sampler - * or uniform buffer) and the resource definition in a shader stage. - * - * This module is an abstract base class for all concrete bindings types. - * - * @abstract - * @private - */ -declare class Binding { - /** - * Constructs a new binding. - * - * @param {string} [name=''] - The binding's name. - */ - constructor(name?: string); - /** - * The binding's name. - * - * @type {string} - */ - name: string; - /** - * A bitmask that defines in what shader stages the - * binding's resource is accessible. - * - * @type {number} - */ - visibility: number; - /** - * Makes sure binding's resource is visible for the given shader stage. - * - * @param {number} visibility - The shader stage. - */ - setVisibility(visibility: number): void; - /** - * The shader stages in which the binding's resource is visible. - * - * @return {number} The visibility bitmask. - */ - getVisibility(): number; - /** - * Clones the binding. - * - * @return {Binding} The cloned binding. - */ - clone(): Binding; -} -/** - * This module represents the state of a node builder after it was - * used to build the nodes for a render object. The state holds the - * results of the build for further processing in the renderer. - * - * Render objects with identical cache keys share the same node builder state. - * - * @private - */ -declare class NodeBuilderState { - /** - * Constructs a new node builder state. - * - * @param {string} vertexShader - The native vertex shader code. - * @param {string} fragmentShader - The native fragment shader code. - * @param {string} computeShader - The native compute shader code. - * @param {Array} nodeAttributes - An array of node attributes. - * @param {Array} bindings - An array of bind groups. - * @param {Array} updateNodes - An array of nodes that implement their `update()` method. - * @param {Array} updateBeforeNodes - An array of nodes that implement their `updateBefore()` method. - * @param {Array} updateAfterNodes - An array of nodes that implement their `updateAfter()` method. - * @param {NodeMaterialObserver} observer - A node material observer. - * @param {boolean} hardwareClipping - Whether the built material uses hardware clipping or not. - * @param {Array} transforms - An array with transform attribute objects. Only relevant when using compute shaders with WebGL 2. - */ - constructor(vertexShader: string, fragmentShader: string, computeShader: string, nodeAttributes: Array, bindings: Array, updateNodes: Array, updateBeforeNodes: Array, updateAfterNodes: Array, observer: NodeMaterialObserver, hardwareClipping: boolean, transforms?: Array); - /** - * The native vertex shader code. - * - * @type {string} - */ - vertexShader: string; - /** - * The native fragment shader code. - * - * @type {string} - */ - fragmentShader: string; - /** - * The native compute shader code. - * - * @type {string} - */ - computeShader: string; - /** - * An array with transform attribute objects. - * Only relevant when using compute shaders with WebGL 2. - * - * @type {Array} - */ - transforms: Array; - /** - * An array of node attributes representing - * the attributes of the shaders. - * - * @type {Array} - */ - nodeAttributes: Array; - /** - * An array of bind groups representing the uniform or storage - * buffers, texture or samplers of the shader. - * - * @type {Array} - */ - bindings: Array; - /** - * An array of nodes that implement their `update()` method. - * - * @type {Array} - */ - updateNodes: Array; - /** - * An array of nodes that implement their `updateBefore()` method. - * - * @type {Array} - */ - updateBeforeNodes: Array; - /** - * An array of nodes that implement their `updateAfter()` method. - * - * @type {Array} - */ - updateAfterNodes: Array; - /** - * A node material observer. - * - * @type {NodeMaterialObserver} - */ - observer: NodeMaterialObserver; - /** - * Whether the built material uses hardware clipping or not. - * - * @type {boolean} - */ - hardwareClipping: boolean; - /** - * How often this state is used by render objects. - * - * @type {number} - */ - usedTimes: number; - /** - * This method is used to create a array of bind groups based - * on the existing bind groups of this state. Shared groups are - * not cloned. - * - * @return {Array} A array of bind groups. - */ - createBindings(): Array; -} -/** - * This renderer module manages node-related objects and is the - * primary interface between the renderer and the node system. - * - * @private - * @augments DataMap - */ -declare class NodeManager extends DataMap { - /** - * Constructs a new nodes management component. - * - * @param {Renderer} renderer - The renderer. - * @param {Backend} backend - The renderer's backend. - */ - constructor(renderer: Renderer, backend: Backend); - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * The renderer's backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * The node frame. - * - * @type {Renderer} - */ - nodeFrame: Renderer; - /** - * A cache for managing node builder states. - * - * @type {Map} - */ - nodeBuilderCache: Map; - /** - * A cache for managing data cache key data. - * - * @type {ChainMap} - */ - callHashCache: ChainMap; - /** - * A cache for managing node uniforms group data. - * - * @type {ChainMap} - */ - groupsData: ChainMap; - /** - * Queue for pending async builds to limit concurrent compilation. - * - * @private - * @type {Array} - */ - private _buildQueue; - /** - * Whether an async build is currently in progress. - * - * @private - * @type {boolean} - */ - private _buildInProgress; - /** - * A cache for managing node objects of - * scene properties like fog or environments. - * - * @type {Object} - */ - cacheLib: { - [x: string]: WeakMap; - }; - /** - * Returns `true` if the given node uniforms group must be updated or not. - * - * @param {NodeUniformsGroup} nodeUniformsGroup - The node uniforms group. - * @return {boolean} Whether the node uniforms group requires an update or not. - */ - updateGroup(nodeUniformsGroup: NodeUniformsGroup): boolean; - /** - * Returns the cache key for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {number} The cache key. - */ - getForRenderCacheKey(renderObject: RenderObject): number; - /** - * Creates a node builder configured for the given render object and material. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {Material} material - The material to use. - * @return {NodeBuilder} The configured node builder. - */ - private _createNodeBuilder; - /** - * Returns a node builder state for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {boolean} [useAsync=false] - Whether to use async build with yielding. - * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). - */ - getForRender(renderObject: RenderObject, useAsync?: boolean): NodeBuilderState | Promise; - /** - * Async version of getForRender() that yields to main thread during build. - * Use this in compileAsync() to prevent blocking the main thread. - * - * @param {RenderObject} renderObject - The render object. - * @return {Promise} A promise that resolves to the node builder state. - */ - getForRenderAsync(renderObject: RenderObject): Promise; - /** - * Returns nodeBuilderState if ready, null if pending async build. - * Queues async build on first call for cache miss. - * Use this in render() path to enable non-blocking compilation. - * - * @param {RenderObject} renderObject - The render object. - * @return {?NodeBuilderState} The node builder state, or null if still building. - */ - getForRenderDeferred(renderObject: RenderObject): NodeBuilderState | null; - /** - * Processes the build queue one item at a time. - * This ensures builds don't all run simultaneously and freeze the main thread. - * - * @private - */ - private _processBuildQueue; - /** - * Deletes the given object from the internal data map - * - * @param {any} object - The object to delete. - * @return {?Object} The deleted dictionary. - */ - delete(object: any): Object | null; - /** - * Returns a node builder state for the given compute node. - * - * @param {Node} computeNode - The compute node. - * @param {boolean} [useAsync=false] - Whether to use async build with yielding. - * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). - */ - getForCompute(computeNode: Node, useAsync?: boolean): NodeBuilderState | Promise; - /** - * Async version of getForCompute() that yields to main thread during build. - * Use this in compileComputeAsync() to prevent blocking the main thread. - * - * @param {Node} computeNode - The compute node. - * @return {Promise} A promise that resolves to the node builder state. - */ - getForComputeAsync(computeNode: Node): Promise; - /** - * Creates a node builder state for the given node builder. - * - * @private - * @param {NodeBuilder} nodeBuilder - The node builder. - * @return {NodeBuilderState} The node builder state. - */ - private _createNodeBuilderState; - /** - * Returns an environment node for the current configured - * scene environment. - * - * @param {Scene} scene - The scene. - * @return {Node} A node representing the current scene environment. - */ - getEnvironmentNode(scene: Scene): Node; - /** - * Returns a background node for the current configured - * scene background. - * - * @param {Scene} scene - The scene. - * @return {Node} A node representing the current scene background. - */ - getBackgroundNode(scene: Scene): Node; - /** - * Returns a fog node for the current configured scene fog. - * - * @param {Scene} scene - The scene. - * @return {Node} A node representing the current scene fog. - */ - getFogNode(scene: Scene): Node; - /** - * Returns a cache key for the given scene and lights node. - * This key is used by `RenderObject` as a part of the dynamic - * cache key (a key that must be checked every time the render - * objects is drawn). - * - * @param {Scene} scene - The scene. - * @param {LightsNode} lightsNode - The lights node. - * @return {number} The cache key. - */ - getCacheKey(scene: Scene, lightsNode: LightsNode): number; - /** - * A boolean that indicates whether tone mapping should be enabled - * or not. - * - * @type {boolean} - */ - get isToneMappingState(): boolean; - /** - * If a scene background is configured, this method makes sure to - * represent the background with a corresponding node-based implementation. - * - * @param {Scene} scene - The scene. - */ - updateBackground(scene: Scene): void; - /** - * This method is part of the caching of nodes which are used to represents the - * scene's background, fog or environment. - * - * @param {string} type - The type of object to cache. - * @param {Object} object - The object. - * @param {Function} callback - A callback that produces a node representation for the given object. - * @param {boolean} [forceUpdate=false] - Whether an update should be enforced or not. - * @return {Node} The node representation. - */ - getCacheNode(type: string, object: Object, callback: Function, forceUpdate?: boolean): Node; - /** - * If a scene fog is configured, this method makes sure to - * represent the fog with a corresponding node-based implementation. - * - * @param {Scene} scene - The scene. - */ - updateFog(scene: Scene): void; - /** - * If a scene environment is configured, this method makes sure to - * represent the environment with a corresponding node-based implementation. - * - * @param {Scene} scene - The scene. - */ - updateEnvironment(scene: Scene): void; - getNodeFrame(renderer?: Renderer, scene?: null, object?: null, camera?: null, material?: null): Renderer; - getNodeFrameForRender(renderObject: any): Renderer; - /** - * Returns the current output cache key. - * - * @return {string} The output cache key. - */ - getOutputCacheKey(): string; - /** - * Returns a node that represents the output configuration (tone mapping and - * color space) for the current target. - * - * @param {Texture} outputTarget - The output target. - * @return {Node} The output node. - */ - getOutputNode(outputTarget: Texture): Node; - /** - * Sets the output layer index for array texture output pass. - * This should be called before each layer render during the output pass. - * - * @param {number} index - The layer index. - */ - setOutputLayerIndex(index: number): void; - /** - * Triggers the call of `updateBefore()` methods - * for all nodes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateBefore(renderObject: RenderObject): void; - /** - * Triggers the call of `updateAfter()` methods - * for all nodes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateAfter(renderObject: RenderObject): void; - /** - * Triggers the call of `update()` methods - * for all nodes of the given compute node. - * - * @param {Node} computeNode - The compute node. - */ - updateForCompute(computeNode: Node): void; - /** - * Triggers the call of `update()` methods - * for all nodes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateForRender(renderObject: RenderObject): void; - /** - * Returns the refresh type of the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {number} The refresh type, see `RenderObjectRefreshType`. - */ - needsRefresh(renderObject: RenderObject): number; -} -/** - * This renderer module manages geometries. - * - * @private - * @augments DataMap - */ -declare class Geometries extends DataMap { - /** - * Constructs a new geometry management component. - * - * @param {Attributes} attributes - Renderer component for managing attributes. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(attributes: Attributes, info: Info); - /** - * Renderer component for managing attributes. - * - * @type {Attributes} - */ - attributes: Attributes; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * Weak Map for managing attributes for wireframe rendering. - * - * @type {WeakMap} - */ - wireframes: WeakMap; - /** - * This Weak Map is used to make sure buffer attributes are - * updated only once per render call. - * - * @type {WeakMap} - */ - attributeCall: WeakMap; - /** - * Stores the event listeners attached to geometries. - * - * @private - * @type {Map} - */ - private _geometryDisposeListeners; - /** - * Returns `true` if the given render object has an initialized geometry. - * - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether if the given render object has an initialized geometry or not. - */ - has(renderObject: RenderObject): boolean; - /** - * Prepares the geometry of the given render object for rendering. - * - * @param {RenderObject} renderObject - The render object. - */ - updateForRender(renderObject: RenderObject): void; - /** - * Initializes the geometry of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - initGeometry(renderObject: RenderObject): void; - /** - * Updates the geometry attributes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateAttributes(renderObject: RenderObject): void; - /** - * Updates the given attribute. - * - * @param {BufferAttribute} attribute - The attribute to update. - * @param {number} type - The attribute type. - */ - updateAttribute(attribute: BufferAttribute, type: number): void; - /** - * Returns the indirect buffer attribute of the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. - */ - getIndirect(renderObject: RenderObject): BufferAttribute | null; - /** - * Returns the byte offset into the indirect attribute buffer of the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {number} The byte offset into the indirect attribute buffer. - */ - getIndirectOffset(renderObject: RenderObject): number; - /** - * Returns the index of the given render object's geometry. This is implemented - * in a method to return a wireframe index if necessary. - * - * @param {RenderObject} renderObject - The render object. - * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. - */ - getIndex(renderObject: RenderObject): BufferAttribute | null; -} -/** - * Represents a uniform buffer binding type. - * - * @private - * @augments Buffer - */ -declare class UniformBuffer extends Buffer { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformBuffer: boolean; -} -/** - * Abstract class for representing pipelines. - * - * @private - * @abstract - */ -declare class Pipeline { - /** - * Constructs a new pipeline. - * - * @param {string} cacheKey - The pipeline's cache key. - */ - constructor(cacheKey: string); - /** - * The pipeline's cache key. - * - * @type {string} - */ - cacheKey: string; - /** - * How often the pipeline is currently in use. - * - * @type {number} - * @default 0 - */ - usedTimes: number; -} -/** - * A WebGPU backend utility module used by {@link WebGPUTextureUtils}. - * - * @private - */ -declare class WebGPUTexturePassUtils extends DataMap { - /** - * Constructs a new utility object. - * - * @param {GPUDevice} device - The WebGPU device. - */ - constructor(device: GPUDevice); - /** - * The WebGPU device. - * - * @type {GPUDevice} - */ - device: GPUDevice; - /** - * The mipmap GPU sampler. - * - * @type {GPUSampler} - */ - mipmapSampler: GPUSampler; - /** - * The flipY GPU sampler. - * - * @type {GPUSampler} - */ - flipYSampler: GPUSampler; - flipUniformBuffer: GPUBuffer; - noFlipUniformBuffer: GPUBuffer; - /** - * A cache for GPU render pipelines used for copy/transfer passes. - * Every texture format and textureBindingViewDimension combo requires a unique pipeline. - * - * @type {Object} - */ - transferPipelines: { - [x: string]: GPURenderPipeline; - }; - mipmapShaderModule: GPUShaderModule; - /** - * Returns a render pipeline for the internal copy render pass. The pass - * requires a unique render pipeline for each texture format. - * - * @param {string} format - The GPU texture format - * @param {string?} textureBindingViewDimension - The GPU texture binding view dimension - * @return {GPURenderPipeline} The GPU render pipeline. - */ - getTransferPipeline(format: string, textureBindingViewDimension: string | null): GPURenderPipeline; - /** - * Flip the contents of the given GPU texture along its vertical axis. - * - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {Object} textureGPUDescriptor - The texture descriptor. - * @param {number} [baseArrayLayer=0] - The index of the first array layer accessible to the texture view. - */ - flipY(textureGPU: GPUTexture, textureGPUDescriptor: Object, baseArrayLayer?: number): void; - /** - * Generates mipmaps for the given GPU texture. - * - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. - */ - generateMipmaps(textureGPU: GPUTexture, encoder?: GPUCommandEncoder | null): void; - /** - * Since multiple copy render passes are required to generate mipmaps, the passes - * are managed as render bundles to improve performance. - * - * @param {GPUTexture} textureGPU - The GPU texture object. - * @return {Array} An array of render bundles. - */ - _mipmapCreateBundles(textureGPU: GPUTexture): Array; - /** - * Executes the render bundles. - * - * @param {GPUCommandEncoder} commandEncoder - The GPU command encoder. - * @param {Array} passes - An array of render bundles. - */ - _mipmapRunBundles(commandEncoder: GPUCommandEncoder, passes: Array): void; -} -/** - * Represents a Number uniform. - * - * @private - * @augments Uniform - */ -declare class NumberUniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {number} value - The uniform's value. - */ - constructor(name: string, value?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNumberUniform: boolean; -} -/** - * Represents a Vector2 uniform. - * - * @private - * @augments Uniform - */ -declare class Vector2Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Vector2} value - The uniform's value. - */ - constructor(name: string, value?: Vector2); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVector2Uniform: boolean; -} -/** - * Represents a Vector3 uniform. - * - * @private - * @augments Uniform - */ -declare class Vector3Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Vector3} value - The uniform's value. - */ - constructor(name: string, value?: Vector3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVector3Uniform: boolean; -} -/** - * Represents a Vector4 uniform. - * - * @private - * @augments Uniform - */ -declare class Vector4Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Vector4} value - The uniform's value. - */ - constructor(name: string, value?: Vector4); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVector4Uniform: boolean; -} -/** - * Represents a Color uniform. - * - * @private - * @augments Uniform - */ -declare class ColorUniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Color} value - The uniform's value. - */ - constructor(name: string, value?: Color); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isColorUniform: boolean; -} -/** - * Represents a Matrix3 uniform. - * - * @private - * @augments Uniform - */ -declare class Matrix3Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Matrix3} value - The uniform's value. - */ - constructor(name: string, value?: Matrix3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMatrix3Uniform: boolean; -} -/** - * Represents a Matrix4 uniform. - * - * @private - * @augments Uniform - */ -declare class Matrix4Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Matrix4} value - The uniform's value. - */ - constructor(name: string, value?: Matrix4); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMatrix4Uniform: boolean; -} -/** - * Data structure for the renderer. It is intended to manage - * data of objects in dictionaries. - * - * @private - */ -declare class DataMap { - /** - * `DataMap` internally uses a weak map - * to manage its data. - * - * @type {WeakMap} - */ - data: WeakMap; - /** - * Returns the dictionary for the given object. - * - * @param {Object} object - The object. - * @return {Object} The dictionary. - */ - get(object: Object): Object; - /** - * Deletes the dictionary for the given object. - * - * @param {Object} object - The object. - * @return {?Object} The deleted dictionary. - */ - delete(object: Object): Object | null; - /** - * Returns `true` if the given object has a dictionary defined. - * - * @param {Object} object - The object to test. - * @return {boolean} Whether a dictionary is defined or not. - */ - has(object: Object): boolean; - /** - * Frees internal resources. - */ - dispose(): void; -} -/** - * Data structure for the renderer. It allows defining values - * with chained, hierarchical keys. Keys are meant to be - * objects since the module internally works with Weak Maps - * for performance reasons. - * - * @private - */ -declare class ChainMap { - /** - * A map of Weak Maps by their key length. - * - * @type {Object} - */ - weakMaps: { - [x: number]: WeakMap; - }; - /** - * Returns the Weak Map for the given keys. - * - * @param {Array} keys - List of keys. - * @return {WeakMap} The weak map. - */ - _getWeakMap(keys: Array): WeakMap; - /** - * Returns the value for the given array of keys. - * - * @param {Array} keys - List of keys. - * @return {any} The value. Returns `undefined` if no value was found. - */ - get(keys: Array): any; - /** - * Sets the value for the given keys. - * - * @param {Array} keys - List of keys. - * @param {any} value - The value to set. - * @return {ChainMap} A reference to this Chain Map. - */ - set(keys: Array, value: any): ChainMap; - /** - * Deletes a value for the given keys. - * - * @param {Array} keys - The keys. - * @return {boolean} Returns `true` if the value has been removed successfully and `false` if the value has not be found. - */ - delete(keys: Array): boolean; -} -/** - * This renderer module manages geometry attributes. - * - * @private - * @augments DataMap - */ -declare class Attributes extends DataMap { - /** - * Constructs a new attribute management component. - * - * @param {Backend} backend - The renderer's backend. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(backend: Backend, info: Info); - /** - * The renderer's backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * Deletes the data for the given attribute. - * - * @param {BufferAttribute} attribute - The attribute. - * @return {?Object} The deleted attribute data. - */ - delete(attribute: BufferAttribute): Object | null; - /** - * Updates the given attribute. This method creates attribute buffers - * for new attributes and updates data for existing ones. - * - * @param {BufferAttribute} attribute - The attribute to update. - * @param {number} type - The attribute type. - */ - update(attribute: BufferAttribute, type: number): void; - /** - * Utility method for handling interleaved buffer attributes correctly. - * To process them, their `InterleavedBuffer` is returned. - * - * @param {BufferAttribute} attribute - The attribute. - * @return {BufferAttribute|InterleavedBuffer} - */ - _getBufferAttribute(attribute: BufferAttribute): BufferAttribute | InterleavedBuffer; -} -export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, ArrayCamera, BackSide, BasicShadowMap, BoxGeometry, BufferAttribute, BufferGeometry, ByteType, CineonToneMapping, ClampToEdgeWrapping, Color, ColorManagement, Compatibility, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeUVReflectionMapping, CullFaceBack, CullFaceFront, CullFaceNone, CustomBlending, CylinderGeometry, DataArrayTexture, DataTexture, DecrementStencilOp, DecrementWrapStencilOp, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicDrawUsage, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, EventDispatcher, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, FramebufferTexture, FrontSide, Frustum, FrustumArray, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, Group, HalfFloatType, HemisphereLight, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedInterleavedBuffer, IntType, InterleavedBuffer, InterleavedBufferAttribute, InvertStencilOp, KeepStencilOp, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, LightProbe, LineBasicMaterial, LineDashedMaterial, LinearFilter, LinearMipMapLinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, Object3D, ObjectLoader, ObjectSpaceNormalMap, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PerspectiveCamera, Plane, PlaneGeometry, PointLight, PointsMaterial, Quaternion, R11_EAC_Format, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderObjectRefreshType, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShadowMaterial, ShortType, Sphere, SphereGeometry, SpotLight, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticDrawUsage, SubtractEquation, SubtractiveBlending, TangentSpaceNormalMap, Texture, TimestampQuery, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, WebGLCoordinateSystem, WebGPUCoordinateSystem, WebXRController, ZeroFactor, ZeroStencilOp, createCanvasElement, error, log$1 as log, warn, warnOnce }; -export { AdditiveAnimationBlendMode, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BasicDepthPacking, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxHelper, BufferGeometryLoader, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CircleGeometry, Clock, ColorKeyframeTrack, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, Controls, CubeTextureLoader, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceFrontBack, Curve, CurvePath, CustomToneMapping, Cylindrical, Data3DTexture, DataTextureLoader, DataUtils, DefaultLoadingManager, DetachedBindMode, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DynamicCopyUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, Euler, ExternalTexture, ExtrudeGeometry, Fog, FogExp2, GLBufferAttribute, GLSL1, GLSL3, GridHelper, HTMLTexture, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, InstancedBufferGeometry, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, KeyframeTrack, LOD, LatheGeometry, Layers, Light, Line, Line3, LineCurve, LineCurve3, LineLoop, LineSegments, LinearInterpolant, LinearMipMapNearestFilter, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, MeshDepthMaterial, MeshDistanceMaterial, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NormalAnimationBlendMode, NumberKeyframeTrack, OctahedronGeometry, Path, PlaneHelper, PointLightHelper, Points, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RGBADepthPacking, RGBDepthPacking, RGDepthPacking, RawShaderMaterial, Ray, Raycaster, RenderTarget3D, RingGeometry, ShaderMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, Skeleton, SkeletonHelper, SkinnedMesh, Source, Spherical, SphericalHarmonics3, SplineCurve, SpotLightHelper, Sprite, StaticCopyUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SunLight, TOUCH, TetrahedronGeometry, TextureLoader, TextureSource, TextureUtils, Timer, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLRenderTarget, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroSlopeEnding, getConsoleFunction, setConsoleFunction } from "./three.core.js"; diff --git a/jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts b/jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts deleted file mode 100644 index 4c5bd3dc3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/Addons.d.ts +++ /dev/null @@ -1,275 +0,0 @@ -export * from "./animation/AnimationClipCreator.js"; -export * from "./animation/CCDIKSolver.js"; -export * from "./controls/ArcballControls.js"; -export * from "./controls/DragControls.js"; -export * from "./controls/FirstPersonControls.js"; -export * from "./controls/FlyControls.js"; -export * from "./controls/MapControls.js"; -export * from "./controls/OrbitControls.js"; -export * from "./controls/PointerLockControls.js"; -export * from "./controls/TrackballControls.js"; -export * from "./controls/TransformControls.js"; -export * from "./csm/CSM.js"; -export * from "./csm/CSMFrustum.js"; -export * from "./csm/CSMHelper.js"; -export * from "./csm/CSMShader.js"; -export * from "./curves/NURBSCurve.js"; -export * from "./curves/NURBSSurface.js"; -export * from "./curves/NURBSVolume.js"; -export * from "./effects/AnaglyphEffect.js"; -export * from "./effects/AsciiEffect.js"; -export * from "./effects/OutlineEffect.js"; -export * from "./effects/ParallaxBarrierEffect.js"; -export * from "./effects/StereoEffect.js"; -export * from "./environments/ColorEnvironment.js"; -export * from "./environments/DebugEnvironment.js"; -export * from "./environments/RoomEnvironment.js"; -export * from "./exporters/DRACOExporter.js"; -export * from "./exporters/EXRExporter.js"; -export * from "./exporters/GLTFExporter.js"; -export * from "./exporters/KTX2Exporter.js"; -export * from "./exporters/OBJExporter.js"; -export * from "./exporters/PLYExporter.js"; -export * from "./exporters/STLExporter.js"; -export * from "./exporters/USDZExporter.js"; -export * from "./geometries/BoxLineGeometry.js"; -export * from "./geometries/ConvexGeometry.js"; -export * from "./geometries/DecalGeometry.js"; -export * from "./geometries/LoftGeometry.js"; -export * from "./geometries/ParametricFunctions.js"; -export * from "./geometries/ParametricGeometry.js"; -export * from "./geometries/RoundedBoxGeometry.js"; -export * from "./geometries/TeapotGeometry.js"; -export * from "./geometries/TextGeometry.js"; -export * from "./helpers/AnimationPathHelper.js"; -export * from "./helpers/LightProbeHelper.js"; -export * from "./helpers/OctreeHelper.js"; -export * from "./helpers/PositionalAudioHelper.js"; -export * from "./helpers/RapierHelper.js"; -export * from "./helpers/RectAreaLightHelper.js"; -export * from "./helpers/TextureHelper.js"; -export * from "./helpers/VertexNormalsHelper.js"; -export * from "./helpers/VertexTangentsHelper.js"; -export * from "./helpers/ViewHelper.js"; -export * from "./interactive/HTMLMesh.js"; -export * from "./interactive/InteractiveGroup.js"; -export * from "./interactive/SelectionBox.js"; -export * from "./interactive/SelectionHelper.js"; -export * from "./lights/LightProbeGenerator.js"; -export * from "./lights/RectAreaLightTexturesLib.js"; -export * from "./lights/RectAreaLightUniformsLib.js"; -export * from "./lines/Line2.js"; -export * from "./lines/LineGeometry.js"; -export * from "./lines/LineMaterial.js"; -export * from "./lines/LineSegments2.js"; -export * from "./lines/LineSegmentsGeometry.js"; -export * from "./lines/Wireframe.js"; -export * from "./lines/WireframeGeometry2.js"; -export * from "./loaders/3DMLoader.js"; -export * from "./loaders/3MFLoader.js"; -export * from "./loaders/AMFLoader.js"; -export * from "./loaders/BVHLoader.js"; -export * from "./loaders/ColladaLoader.js"; -export * from "./loaders/DDSLoader.js"; -export * from "./loaders/DRACOLoader.js"; -export * from "./loaders/EXRLoader.js"; -export * from "./loaders/FBXLoader.js"; -export * from "./loaders/FontLoader.js"; -export * from "./loaders/GCodeLoader.js"; -export * from "./loaders/GLTFGaussianSplatLoaderExtension.js"; -export * from "./loaders/GLTFLoader.js"; -export * from "./loaders/HDRLoader.js"; -export * from "./loaders/HDRCubeTextureLoader.js"; -export * from "./loaders/IESLoader.js"; -export * from "./loaders/KMZLoader.js"; -export * from "./loaders/KSPLATLoader.js"; -export * from "./loaders/KTX2Loader.js"; -export * from "./loaders/KTXLoader.js"; -export * from "./loaders/LDrawLoader.js"; -export * from "./loaders/LUT3dlLoader.js"; -export * from "./loaders/LUTCubeLoader.js"; -export * from "./loaders/LUTImageLoader.js"; -export * from "./loaders/LWOLoader.js"; -export * from "./loaders/MD2Loader.js"; -export * from "./loaders/MDDLoader.js"; -export * from "./loaders/MTLLoader.js"; -export * from "./loaders/NRRDLoader.js"; -export * from "./loaders/OBJLoader.js"; -export * from "./loaders/PCDLoader.js"; -export * from "./loaders/PDBLoader.js"; -export * from "./loaders/PLYLoader.js"; -export * from "./loaders/PVRLoader.js"; -export * from "./loaders/RGBELoader.js"; -export * from "./loaders/SPLATLoader.js"; -export * from "./loaders/SPZLoader.js"; -export * from "./loaders/UltraHDRLoader.js"; -export * from "./loaders/STLLoader.js"; -export * from "./loaders/SVGLoader.js"; -export * from "./loaders/TDSLoader.js"; -export * from "./loaders/TGALoader.js"; -export * from "./loaders/TIFFLoader.js"; -export * from "./loaders/TTFLoader.js"; -export * from "./loaders/USDLoader.js"; -export * from "./loaders/VOXLoader.js"; -export * from "./loaders/VRMLLoader.js"; -export * from "./loaders/VTKLoader.js"; -export * from "./loaders/XYZLoader.js"; -export * from "./materials/LDrawConditionalLineMaterial.js"; -export * from "./math/Capsule.js"; -export * from "./math/ColorConverter.js"; -export * from "./math/ConvexHull.js"; -export * from "./math/ImprovedNoise.js"; -export * from "./math/Lut.js"; -export * from "./math/MeshSurfaceSampler.js"; -export * from "./math/OBB.js"; -export * from "./math/Octree.js"; -export * from "./math/SimplexNoise.js"; -export * from "./misc/ConvexObjectBreaker.js"; -export * from "./misc/GPUComputationRenderer.js"; -export * from "./misc/Gyroscope.js"; -export * from "./misc/MD2Character.js"; -export * from "./misc/MD2CharacterComplex.js"; -export * from "./misc/MorphAnimMesh.js"; -export * from "./misc/MorphBlendMesh.js"; -export * from "./misc/ProgressiveLightMap.js"; -export * from "./misc/RollerCoaster.js"; -export * from "./misc/TileCreasedNormalsPlugin.js"; -export * from "./misc/TubePainter.js"; -export * from "./misc/Volume.js"; -export * from "./misc/VolumeSlice.js"; -export * from "./modifiers/CurveModifier.js"; -export * from "./modifiers/EdgeSplitModifier.js"; -export * from "./modifiers/SimplifyModifier.js"; -export * from "./modifiers/TessellateModifier.js"; -export * from "./objects/GroundedSkybox.js"; -export * from "./objects/GaussianSplat.js"; -export * from "./objects/Lensflare.js"; -export * from "./objects/MarchingCubes.js"; -export * from "./objects/Reflector.js"; -export * from "./objects/ReflectorForSSRPass.js"; -export * from "./objects/Refractor.js"; -export * from "./objects/ShadowMesh.js"; -export * from "./objects/Sky.js"; -export * from "./objects/Water.js"; -export * from "./physics/AmmoPhysics.js"; -export * from "./physics/JoltPhysics.js"; -export * from "./physics/RapierPhysics.js"; -export * from "./postprocessing/AfterimagePass.js"; -export * from "./postprocessing/BloomPass.js"; -export * from "./postprocessing/BokehPass.js"; -export * from "./postprocessing/ClearPass.js"; -export * from "./postprocessing/CubeTexturePass.js"; -export * from "./postprocessing/DotScreenPass.js"; -export * from "./postprocessing/EffectComposer.js"; -export * from "./postprocessing/FXAAPass.js"; -export * from "./postprocessing/FilmPass.js"; -export * from "./postprocessing/GlitchPass.js"; -export * from "./postprocessing/GTAOPass.js"; -export * from "./postprocessing/HalftonePass.js"; -export * from "./postprocessing/LUTPass.js"; -export * from "./postprocessing/MaskPass.js"; -export * from "./postprocessing/OutlinePass.js"; -export * from "./postprocessing/OutputPass.js"; -export * from "./postprocessing/Pass.js"; -export * from "./postprocessing/RenderPass.js"; -export * from "./postprocessing/RenderPixelatedPass.js"; -export * from "./postprocessing/RenderTransitionPass.js"; -export * from "./postprocessing/SAOPass.js"; -export * from "./postprocessing/SMAAPass.js"; -export * from "./postprocessing/SSAARenderPass.js"; -export * from "./postprocessing/SSAOPass.js"; -export * from "./postprocessing/SSRPass.js"; -export * from "./postprocessing/SavePass.js"; -export * from "./postprocessing/ShaderPass.js"; -export * from "./postprocessing/TAARenderPass.js"; -export * from "./postprocessing/TexturePass.js"; -export * from "./postprocessing/UnrealBloomPass.js"; -export * from "./renderers/CSS2DRenderer.js"; -export * from "./renderers/CSS3DRenderer.js"; -export * from "./renderers/Projector.js"; -export * from "./renderers/SVGRenderer.js"; -export * from "./shaders/ACESFilmicToneMappingShader.js"; -export * from "./shaders/AfterimageShader.js"; -export * from "./shaders/BasicShader.js"; -export * from "./shaders/BleachBypassShader.js"; -export * from "./shaders/BlendShader.js"; -export * from "./shaders/BokehShader.js"; -export * from "./shaders/BrightnessContrastShader.js"; -export * from "./shaders/ColorCorrectionShader.js"; -export * from "./shaders/ColorifyShader.js"; -export * from "./shaders/ConvolutionShader.js"; -export * from "./shaders/CopyShader.js"; -export * from "./shaders/DOFMipMapShader.js"; -export * from "./shaders/DepthLimitedBlurShader.js"; -export * from "./shaders/DigitalGlitch.js"; -export * from "./shaders/DotScreenShader.js"; -export * from "./shaders/ExposureShader.js"; -export * from "./shaders/FXAAShader.js"; -export * from "./shaders/FilmShader.js"; -export * from "./shaders/FocusShader.js"; -export * from "./shaders/FreiChenShader.js"; -export * from "./shaders/GammaCorrectionShader.js"; -export * from "./shaders/GTAOShader.js"; -export * from "./shaders/HalftoneShader.js"; -export * from "./shaders/HorizontalBlurShader.js"; -export * from "./shaders/HorizontalTiltShiftShader.js"; -export * from "./shaders/HueSaturationShader.js"; -export * from "./shaders/KaleidoShader.js"; -export * from "./shaders/LuminosityHighPassShader.js"; -export * from "./shaders/LuminosityShader.js"; -export * from "./shaders/MirrorShader.js"; -export * from "./shaders/NormalMapShader.js"; -export * from "./shaders/OutputShader.js"; -export * from "./shaders/PoissonDenoiseShader.js"; -export * from "./shaders/RGBShiftShader.js"; -export * from "./shaders/SAOShader.js"; -export * from "./shaders/SMAAShader.js"; -export * from "./shaders/SSAOShader.js"; -export * from "./shaders/SSRShader.js"; -export * from "./shaders/SepiaShader.js"; -export * from "./shaders/SobelOperatorShader.js"; -export * from "./shaders/SubsurfaceScatteringShader.js"; -export * from "./shaders/TechnicolorShader.js"; -export * from "./shaders/ToonShader.js"; -export * from "./shaders/TriangleBlurShader.js"; -export * from "./shaders/UnpackDepthRGBAShader.js"; -export * from "./shaders/VelocityShader.js"; -export * from "./shaders/VerticalBlurShader.js"; -export * from "./shaders/VerticalTiltShiftShader.js"; -export * from "./shaders/VignetteShader.js"; -export * from "./shaders/VolumeShader.js"; -export * from "./shaders/WaterRefractionShader.js"; -export * from "./textures/FlakesTexture.js"; -export * from "./utils/LDrawUtils.js"; -export * from "./utils/SceneOptimizer.js"; -export * from "./utils/ShadowMapViewer.js"; -export * from "./utils/WebGLTextureUtils.js"; -export * from "./utils/UVsDebug.js"; -export * from "./utils/WorkerPool.js"; -export * from "./webxr/ARButton.js"; -export * from "./webxr/OculusHandModel.js"; -export * from "./webxr/OculusHandPointerModel.js"; -export * from "./webxr/Text2D.js"; -export * from "./webxr/VRButton.js"; -export * from "./webxr/WebGLXRFallback.js"; -export * from "./webxr/XRButton.js"; -export * from "./webxr/XRControllerModelFactory.js"; -export * from "./webxr/XREstimatedLight.js"; -export * from "./webxr/XRHandMeshModel.js"; -export * from "./webxr/XRHandModelFactory.js"; -export * from "./webxr/XRHandPrimitiveModel.js"; -export * from "./webxr/XRPlanes.js"; -export { default as WebGL } from "./capabilities/WebGL.js"; -export * as Curves from "./curves/CurveExtras.js"; -export * as NURBSUtils from "./curves/NURBSUtils.js"; -export * as ColorSpaces from "./math/ColorSpaces.js"; -export { Water as Water2 } from "./objects/Water2.js"; -export { BokehShader as BokehShader2 } from "./shaders/BokehShader2.js"; -export * as BufferGeometryUtils from "./utils/BufferGeometryUtils.js"; -export * as CameraUtils from "./utils/CameraUtils.js"; -export * as ColorUtils from "./utils/ColorUtils.js"; -export * as GeometryCompressionUtils from "./utils/GeometryCompressionUtils.js"; -export * as GeometryUtils from "./utils/GeometryUtils.js"; -export * as SceneUtils from "./utils/SceneUtils.js"; -export * as SkeletonUtils from "./utils/SkeletonUtils.js"; -export * as SortUtils from "./utils/SortUtils.js"; diff --git a/jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts deleted file mode 100644 index 11c23e792..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/animation/AnimationClipCreator.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * A utility class with factory methods for creating basic animation clips. - * - * @hideconstructor - * @three_import import { AnimationClipCreator } from 'three/addons/animation/AnimationClipCreator.js'; - */ -export class AnimationClipCreator { - /** - * Creates an animation clip that rotates a 3D object 360 degrees - * in the given period of time around the given axis. - * - * @param {number} period - The duration of the animation. - * @param {('x'|'y'|'z')} [axis='x'] - The axis of rotation. - * @return {AnimationClip} The created animation clip. - */ - static CreateRotationAnimation(period: number, axis?: ("x" | "y" | "z")): AnimationClip; - /** - * Creates an animation clip that scales a 3D object from `0` to `1` - * in the given period of time along the given axis. - * - * @param {number} period - The duration of the animation. - * @param {('x'|'y'|'z')} [axis='x'] - The axis to scale the 3D object along. - * @return {AnimationClip} The created animation clip. - */ - static CreateScaleAxisAnimation(period: number, axis?: ("x" | "y" | "z")): AnimationClip; - /** - * Creates an animation clip that translates a 3D object in a shake pattern - * in the given period. - * - * @param {number} duration - The duration of the animation. - * @param {Vector3} shakeScale - The scale of the shake. - * @return {AnimationClip} The created animation clip. - */ - static CreateShakeAnimation(duration: number, shakeScale: Vector3): AnimationClip; - /** - * Creates an animation clip that scales a 3D object in a pulse pattern - * in the given period. - * - * @param {number} duration - The duration of the animation. - * @param {number} pulseScale - The scale of the pulse. - * @return {AnimationClip} The created animation clip. - */ - static CreatePulsationAnimation(duration: number, pulseScale: number): AnimationClip; - /** - * Creates an animation clip that toggles the visibility of a 3D object. - * - * @param {number} duration - The duration of the animation. - * @return {AnimationClip} The created animation clip. - */ - static CreateVisibilityAnimation(duration: number): AnimationClip; - /** - * Creates an animation clip that animates the `color` property of a 3D object's - * material. - * - * @param {number} duration - The duration of the animation. - * @param {Array} colors - An array of colors that should be sequentially animated. - * @return {AnimationClip} The created animation clip. - */ - static CreateMaterialColorAnimation(duration: number, colors: Array): AnimationClip; -} -import { AnimationClip } from 'three'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts b/jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts deleted file mode 100644 index a66b1fd70..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/animation/CCDIKSolver.d.ts +++ /dev/null @@ -1,147 +0,0 @@ -/** - * ~IK - */ -export type CCDIKSolver = { - /** - * - The target bone index which refers to a bone in the `Skeleton.bones` array. - */ - target: number; - /** - * - The effector bone index which refers to a bone in the `Skeleton.bones` array. - */ - effector: number; - /** - * ~BoneLink>} links - An array of bone links. - */ - "": Array; - /** - * - Iteration number of calculation. Smaller is faster but less precise. - */ - iteration?: number | undefined; - /** - * - Minimum rotation angle in a step in radians. - */ - minAngle?: number | undefined; - /** - * - Minimum rotation angle in a step in radians. - */ - maxAngle?: number | undefined; - /** - * - The blend factor. - */ - blendFactor?: number | undefined; -}; -/** - * This class solves the Inverse Kinematics Problem with a [CCD Algorithm](https://web.archive.org/web/20221206080850/https://sites.google.com/site/auraliusproject/ccd-algorithm). - * - * `CCDIKSolver` is designed to work with instances of {@link SkinnedMesh}. - * - * @three_import import { CCDIKSolver } from 'three/addons/animation/CCDIKSolver.js'; - */ -export class CCDIKSolver { - /** - * @param {SkinnedMesh} mesh - The skinned mesh. - * @param {Array} [iks=[]] - The IK objects. - */ - constructor(mesh: SkinnedMesh, iks?: any[]); - /** - * The skinned mesh. - * - * @type {SkinnedMesh} - */ - mesh: SkinnedMesh; - /** - * The IK objects. - * - * @type {Array} - */ - iks: Array; - _initialQuaternions: Quaternion[][]; - _workingQuaternion: Quaternion; - /** - * Updates all IK bones by solving the CCD algorithm. - * - * @param {number} [globalBlendFactor=1.0] - Blend factor applied if an IK chain doesn't have its own .blendFactor. - * @return {CCDIKSolver} A reference to this instance. - */ - update(globalBlendFactor?: number): CCDIKSolver; - /** - * Updates one IK bone solving the CCD algorithm. - * - * @param {CCDIKSolver~IK} ik - The IK to update. - * @param {number} [overrideBlend=1.0] - If the IK object does not define `blendFactor`, this value is used. - * @return {CCDIKSolver} A reference to this instance. - */ - updateOne(ik: any, overrideBlend?: number): CCDIKSolver; - /** - * Creates a helper for visualizing the CCDIK. - * - * @param {number} sphereSize - The sphere size. - * @return {CCDIKHelper} The created helper. - */ - createHelper(sphereSize: number): CCDIKHelper; - _valid(): void; -} -/** - * Helper for visualizing IK bones. - * - * @augments Object3D - * @three_import import { CCDIKHelper } from 'three/addons/animation/CCDIKSolver.js'; - */ -export class CCDIKHelper extends Object3D { - /** - * @param {SkinnedMesh} mesh - The skinned mesh. - * @param {Array} [iks=[]] - The IK objects. - * @param {number} [sphereSize=0.25] - The sphere size. - */ - constructor(mesh: SkinnedMesh, iks?: any[], sphereSize?: number); - /** - * The skinned mesh this helper refers to. - * - * @type {SkinnedMesh} - */ - root: SkinnedMesh; - /** - * The IK objects. - * - * @type {Array} - */ - iks: Array; - /** - * The helpers sphere geometry. - * - * @type {SphereGeometry} - */ - sphereGeometry: SphereGeometry; - /** - * The material for the target spheres. - * - * @type {MeshBasicMaterial} - */ - targetSphereMaterial: MeshBasicMaterial; - /** - * The material for the effector spheres. - * - * @type {MeshBasicMaterial} - */ - effectorSphereMaterial: MeshBasicMaterial; - /** - * The material for the link spheres. - * - * @type {MeshBasicMaterial} - */ - linkSphereMaterial: MeshBasicMaterial; - /** - * A global line material. - * - * @type {LineBasicMaterial} - */ - lineMaterial: LineBasicMaterial; - updateMatrixWorld(force: any): void; - _init(): void; -} -import { Quaternion } from 'three'; -import { Object3D } from 'three'; -import { SphereGeometry } from 'three'; -import { MeshBasicMaterial } from 'three'; -import { LineBasicMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts b/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts deleted file mode 100644 index 7a5082970..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGL.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default WebGL; -/** - * A utility module with basic WebGL 2 capability testing. - * - * @hideconstructor - * @three_import import WebGL from 'three/addons/capabilities/WebGL.js'; - */ -declare class WebGL { - /** - * Returns `true` if WebGL 2 is available. - * - * @return {boolean} Whether WebGL 2 is available or not. - */ - static isWebGL2Available(): boolean; - /** - * Returns `true` if the given color space is available. This method can only be used - * if WebGL 2 is supported. - * - * @param {string} colorSpace - The color space to test. - * @return {boolean} Whether the given color space is available or not. - */ - static isColorSpaceAvailable(colorSpace: string): boolean; - /** - * Returns a `div` element representing a formatted error message that can be appended in - * web sites if WebGL 2 isn't supported. - * - * @return {HTMLDivElement} A `div` element representing a formatted error message that WebGL 2 isn't supported. - */ - static getWebGL2ErrorMessage(): HTMLDivElement; - static _getErrorMessage(version: any): HTMLDivElement; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts deleted file mode 100644 index 410375a5f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/capabilities/WebGPU.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default WebGPU; -/** - * A utility module with basic WebGPU capability testing. - * - * @hideconstructor - * @three_import import WebGPU from 'three/addons/capabilities/WebGPU.js'; - */ -declare class WebGPU { - /** - * Returns `true` if WebGPU is available. - * - * @return {boolean} Whether WebGPU is available or not. - */ - static isAvailable(): boolean; - /** - * Returns a `div` element representing a formatted error message that can be appended in - * web sites if WebGPU isn't supported. - * - * @return {HTMLDivElement} A `div` element representing a formatted error message that WebGPU isn't supported. - */ - static getErrorMessage(): HTMLDivElement; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts deleted file mode 100644 index 430f1cff8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/ArcballControls.d.ts +++ /dev/null @@ -1,676 +0,0 @@ -/** - * Arcball controls allow the camera to be controlled by a virtual trackball with full touch support and advanced navigation functionality. - * Cursor/finger positions and movements are mapped over a virtual trackball surface represented by a gizmo and mapped in intuitive and - * consistent camera movements. Dragging cursor/fingers will cause camera to orbit around the center of the trackball in a conservative - * way (returning to the starting point will make the camera return to its starting orientation). - * - * In addition to supporting pan, zoom and pinch gestures, double clicking/tapping focuses on a point, intuitively moving the object's - * point of interest to the center of the virtual trackball. Focus allows a much better inspection and navigation in complex environment. - * Moreover Arcball controls allow FOV manipulation (in a vertigo-style method) and z-rotation. Saving and restoring of Camera State - * is supported also through clipboard (use ctrl+c and ctrl+v shortcuts for copy and paste the state). - * - * Unlike {@link OrbitControls} and {@link TrackballControls}, `ArcballControls` doesn't require `update()` to be called externally in an - * animation loop when animations are on. - * - * @augments Controls - * @three_import import { ArcballControls } from 'three/addons/controls/ArcballControls.js'; - */ -export class ArcballControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Camera} camera - The camera to be controlled. The camera must not be a child of another object, unless that object is the scene itself. - * @param {?HTMLElement} [domElement=null] - The HTML element used for event listeners. - * @param {?Scene} [scene=null] The scene rendered by the camera. If not given, gizmos cannot be shown. - */ - constructor(camera: Camera, domElement?: HTMLElement | null, scene?: Scene | null); - /** - * The scene rendered by the camera. If not given, gizmos cannot be shown. - * - * @type {?Scene} - * @default null - */ - scene: Scene | null; - /** - * The control's focus point. - * - * @type {Vector3} - */ - target: Vector3; - _currentTarget: Vector3; - /** - * The size of the gizmo relative to the screen width and height. - * - * @type {number} - * @default 0.67 - */ - radiusFactor: number; - /** - * Holds the mouse actions of this controls. This property is maintained by the methods - * `setMouseAction()` and `unsetMouseAction()`. - * - * @type {Array} - */ - mouseActions: Array; - _mouseOp: any; - _v2_1: Vector2; - _v3_1: Vector3; - _v3_2: Vector3; - _m4_1: Matrix4; - _m4_2: Matrix4; - _quat: Quaternion; - _translationMatrix: Matrix4; - _rotationMatrix: Matrix4; - _scaleMatrix: Matrix4; - _rotationAxis: Vector3; - _cameraMatrixState: Matrix4; - _cameraProjectionState: Matrix4; - _fovState: number; - _upState: Vector3; - _zoomState: number; - _nearPos: number; - _farPos: number; - _gizmoMatrixState: Matrix4; - _up0: Vector3; - _zoom0: number; - _fov0: number; - _initialNear: number; - _nearPos0: number; - _initialFar: number; - _farPos0: number; - _cameraMatrixState0: Matrix4; - _gizmoMatrixState0: Matrix4; - _target0: Vector3; - _button: number; - _touchStart: any[]; - _touchCurrent: any[]; - _input: symbol; - _switchSensibility: number; - _startFingerDistance: number; - _currentFingerDistance: number; - _startFingerRotation: number; - _currentFingerRotation: number; - _devPxRatio: number; - _downValid: boolean; - _nclicks: number; - _downEvents: any[]; - _downStart: number; - _clickStart: number; - _maxDownTime: number; - _maxInterval: number; - _posThreshold: number; - _movementThreshold: number; - _currentCursorPosition: Vector3; - _startCursorPosition: Vector3; - _grid: GridHelper | null; - _gridPosition: Vector3; - _gizmos: Group; - _curvePts: number; - _timeStart: number; - _animationId: number; - /** - * Duration of focus animations in ms. - * - * @type {number} - * @default 500 - */ - focusAnimationTime: number; - _timePrev: number; - _timeCurrent: number; - _anglePrev: number; - _angleCurrent: number; - _cursorPosPrev: Vector3; - _cursorPosCurr: Vector3; - _wPrev: number; - _wCurr: number; - /** - * If set to `true`, the camera's near and far values will be adjusted every time zoom is - * performed trying to maintain the same visible portion given by initial near and far - * values. Only works with perspective cameras. - * - * This feature only works as expected if the camera's initial state (position, near and far values) - * is correctly configured before creating the controls. Otherwise {@link ArcballControls#setCamera} - * must be called by the application. - * - * @type {boolean} - * @default false - */ - adjustNearFar: boolean; - /** - * The scaling factor used when performing zoom operation. - * - * @type {number} - * @default 1.1 - */ - scaleFactor: number; - /** - * The damping inertia used if 'enableAnimations` is set to `true`. - * - * @type {number} - * @default 25 - */ - dampingFactor: number; - /** - * Maximum angular velocity allowed on rotation animation start. - * - * @type {number} - * @default 20 - */ - wMax: number; - /** - * Set to `true` to enable animations for rotation (damping) and focus operation. - * - * @type {boolean} - * @default true - */ - enableAnimations: boolean; - /** - * If set to `true`, a grid will appear when panning operation is being performed - * (desktop interaction only). - * - * @type {boolean} - * @default false - */ - enableGrid: boolean; - /** - * Set to `true` to make zoom become cursor centered. - * - * @type {boolean} - * @default false - */ - cursorZoom: boolean; - /** - * The minimum FOV in degrees. - * - * @type {number} - * @default 5 - */ - minFov: number; - /** - * The maximum FOV in degrees. - * - * @type {number} - * @default 90 - */ - maxFov: number; - /** - * Speed of rotation. - * - * @type {number} - * @default 1 - */ - rotateSpeed: number; - /** - * Enable or disable camera panning. - * - * @type {boolean} - * @default true - */ - enablePan: boolean; - /** - * Enable or disable camera rotation. - * - * @type {boolean} - * @default true - */ - enableRotate: boolean; - /** - * Enable or disable camera zoom. - * - * @type {boolean} - * @default true - */ - enableZoom: boolean; - /** - * Enable or disable gizmos. - * - * @type {boolean} - * @default true - */ - enableGizmos: boolean; - /** - * Enable or disable camera focusing on double-tap (or click) operations. - * - * @type {boolean} - * @default true - */ - enableFocus: boolean; - /** - * How far you can dolly in. For perspective cameras only. - * - * @type {number} - * @default 0 - */ - minDistance: number; - /** - * How far you can dolly out. For perspective cameras only. - * - * @type {number} - * @default Infinity - */ - maxDistance: number; - /** - * How far you can zoom in. For orthographic cameras only. - * - * @type {number} - * @default 0 - */ - minZoom: number; - /** - * How far you can zoom out. For orthographic cameras only. - * - * @type {number} - * @default Infinity - */ - maxZoom: number; - _tbRadius: number; - _state: symbol; - _onContextMenu: typeof onContextMenu; - _onWheel: typeof onWheel; - _onPointerUp: typeof onPointerUp; - _onPointerMove: typeof onPointerMove; - _onPointerDown: typeof onPointerDown; - _onPointerCancel: typeof onPointerCancel; - _onWindowResize: typeof onWindowResize; - connect(element: any): void; - onSinglePanStart(event: any, operation: any): void; - onSinglePanMove(event: any, opState: any): void; - onSinglePanEnd(): void; - onDoubleTap(event: any): void; - onDoublePanStart(): void; - onDoublePanMove(): void; - onDoublePanEnd(): void; - onRotateStart(): void; - onRotateMove(): void; - onRotateEnd(): void; - onPinchStart(): void; - onPinchMove(): void; - onPinchEnd(): void; - onTriplePanStart(): void; - onTriplePanMove(): void; - onTriplePanEnd(): void; - /** - * Set _center's x/y coordinates. - * - * @private - * @param {number} clientX - The x coordinate. - * @param {number} clientY - The y coordinate. - */ - private setCenter; - /** - * Set default mouse actions. - * - * @private - */ - private initializeMouseActions; - /** - * Compare two mouse actions. - * - * @private - * @param {Object} action1 - The first mouse action. - * @param {Object} action2 - The second mouse action. - * @returns {boolean} `true` if action1 and action 2 are the same mouse action, `false` otherwise. - */ - private compareMouseAction; - /** - * Set a new mouse action by specifying the operation to be performed and a mouse/key combination. In case of conflict, replaces the existing one. - * - * @param {'PAN'|'ROTATE'|'ZOOM'|'FOV'} operation - The operation to be performed ('PAN', 'ROTATE', 'ZOOM', 'FOV'). - * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches. - * @param {?('CTRL'|'SHIFT')} [key=null] - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed. - * @returns {boolean} `true` if the mouse action has been successfully added, `false` otherwise. - */ - setMouseAction(operation: "PAN" | "ROTATE" | "ZOOM" | "FOV", mouse: 0 | 1 | 2 | "WHEEL", key?: ("CTRL" | "SHIFT") | null): boolean; - /** - * Remove a mouse action by specifying its mouse/key combination. - * - * @param {0|1|2|'WHEEL'} mouse - A mouse button (0, 1, 2) or 'WHEEL' for wheel notches. - * @param {?('CTRL'|'SHIFT')} key - The keyboard modifier ('CTRL', 'SHIFT') or null if key is not needed. - * @returns {boolean} `true` if the operation has been successfully removed, `false` otherwise. - */ - unsetMouseAction(mouse: 0 | 1 | 2 | "WHEEL", key?: ("CTRL" | "SHIFT") | null): boolean; - /** - * Return the operation associated to a mouse/keyboard combination. - * - * @private - * @param {0|1|2|'WHEEL'} mouse - Mouse button index (0, 1, 2) or 'WHEEL' for wheel notches. - * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier. - * @returns {?('PAN'|'ROTATE'|'ZOOM'|'FOV')} The operation if it has been found, `null` otherwise. - */ - private getOpFromAction; - /** - * Get the operation associated to mouse and key combination and returns the corresponding FSA state. - * - * @private - * @param {0|1|2} mouse - Mouse button index (0, 1, 2) - * @param {?('CTRL'|'SHIFT')} key - Keyboard modifier - * @returns {?STATE} The FSA state obtained from the operation associated to mouse/keyboard combination. - */ - private getOpStateFromAction; - /** - * Calculate the angle between two pointers. - * - * @private - * @param {PointerEvent} p1 - The first pointer event. - * @param {PointerEvent} p2 - The second pointer event. - * @returns {number} The angle between two pointers in degrees. - */ - private getAngle; - /** - * Updates a PointerEvent inside current pointerevents array. - * - * @private - * @param {PointerEvent} event - The pointer event. - */ - private updateTouchEvent; - /** - * Applies a transformation matrix, to the camera and gizmos. - * - * @private - * @param {Object} transformation - Object containing matrices to apply to camera and gizmos. - */ - private applyTransformMatrix; - /** - * Calculates the angular speed. - * - * @private - * @param {number} p0 - Position at t0. - * @param {number} p1 - Position at t1. - * @param {number} t0 - Initial time in milliseconds. - * @param {number} t1 - Ending time in milliseconds. - * @returns {number} The angular speed. - */ - private calculateAngularSpeed; - /** - * Calculates the distance between two pointers. - * - * @private - * @param {PointerEvent} p0 - The first pointer. - * @param {PointerEvent} p1 - The second pointer. - * @returns {number} The distance between the two pointers. - */ - private calculatePointersDistance; - /** - * Calculates the rotation axis as the vector perpendicular between two vectors. - * - * @private - * @param {Vector3} vec1 - The first vector. - * @param {Vector3} vec2 - The second vector. - * @returns {Vector3} The normalized rotation axis. - */ - private calculateRotationAxis; - /** - * Calculates the trackball radius so that gizmo's diameter will be 2/3 of the minimum side of the camera frustum. - * - * @private - * @param {Camera} camera - The camera. - * @returns {number} The trackball radius. - */ - private calculateTbRadius; - /** - * Focus operation consist of positioning the point of interest in front of the camera and a slightly zoom in. - * - * @private - * @param {Vector3} point - The point of interest. - * @param {number} size - Scale factor. - * @param {number} [amount=1] - Amount of operation to be completed (used for focus animations, default is complete full operation). - */ - private focus; - /** - * Creates a grid if necessary and adds it to the scene. - * - * @private - */ - private drawGrid; - /** - * Removes the grid from the scene. - */ - disposeGrid(): void; - /** - * Computes the easing out cubic function for ease out effect in animation. - * - * @private - * @param {number} t - The absolute progress of the animation in the bound of `0` (beginning of the) and `1` (ending of animation). - * @returns {number} Result of easing out cubic at time `t`. - */ - private easeOutCubic; - /** - * Makes rotation gizmos more or less visible. - * - * @param {boolean} isActive - If set to `true`, gizmos are more visible. - */ - activateGizmos(isActive: boolean): void; - /** - * Calculates the cursor position in NDC. - * - * @private - * @param {number} cursorX - Cursor horizontal coordinate within the canvas. - * @param {number} cursorY - Cursor vertical coordinate within the canvas. - * @param {HTMLElement} canvas - The canvas where the renderer draws its output. - * @returns {Vector2} Cursor normalized position inside the canvas. - */ - private getCursorNDC; - /** - * Calculates the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas. - * - * @private - * @param {number} cursorX - Cursor horizontal coordinate within the canvas. - * @param {number} cursorY - Cursor vertical coordinate within the canvas. - * @param {HTMLElement} canvas - The canvas where the renderer draws its output. - * @returns {Vector2} Cursor position inside the canvas. - */ - private getCursorPosition; - /** - * Sets the camera to be controlled. Must be called in order to set a new camera to be controlled. - * - * @param {Camera} camera - The camera to be controlled. - */ - setCamera(camera: Camera): void; - /** - * Sets gizmos visibility. - * - * @param {boolean} value - Value of gizmos visibility. - */ - setGizmosVisible(value: boolean): void; - /** - * Sets gizmos radius factor and redraws gizmos. - * - * @param {number} value - Value of radius factor. - */ - setTbRadius(value: number): void; - /** - * Creates the rotation gizmos matching trackball center and radius. - * - * @private - * @param {Vector3} tbCenter - The trackball center. - * @param {number} tbRadius - The trackball radius. - */ - private makeGizmos; - /** - * Performs animation for focus operation. - * - * @private - * @param {number} time - Instant in which this function is called as performance.now(). - * @param {Vector3} point - Point of interest for focus operation. - * @param {Matrix4} cameraMatrix - Camera matrix. - * @param {Matrix4} gizmoMatrix - Gizmos matrix. - */ - private onFocusAnim; - /** - * Performs animation for rotation operation. - * - * @private - * @param {number} time - Instant in which this function is called as performance.now(). - * @param {Vector3} rotationAxis - Rotation axis. - * @param {number} w0 - Initial angular velocity. - */ - private onRotationAnim; - /** - * Performs pan operation moving camera between two points. - * - * @private - * @param {Vector3} p0 - Initial point. - * @param {Vector3} p1 - Ending point. - * @param {boolean} [adjust=false] - If movement should be adjusted considering camera distance (Perspective only). - * @returns {Object} - */ - private pan; - /** - * Resets the controls. - */ - reset(): void; - /** - * Rotates the camera around an axis passing by trackball's center. - * - * @private - * @param {Vector3} axis - Rotation axis. - * @param {number} angle - Angle in radians. - * @returns {Object} Object with 'camera' field containing transformation matrix resulting from the operation to be applied to the camera. - */ - private rotate; - /** - * Copy the current state to clipboard (as a readable JSON text). - */ - copyState(): void; - /** - * Set the controls state from the clipboard, assumes that the clipboard stores a JSON - * text as saved from `copyState()`. - */ - pasteState(): void; - /** - * Saves the current state of the control. This can later be recover with `reset()`. - */ - saveState(): void; - /** - * Performs uniform scale operation around a given point. - * - * @private - * @param {number} size - Scale factor. - * @param {Vector3} point - Point around which scale. - * @param {boolean} scaleGizmos - If gizmos should be scaled (Perspective only). - * @returns {Object} Object with 'camera' and 'gizmo' fields containing transformation matrices resulting from the operation to be applied to the camera and gizmos. - */ - private scale; - /** - * Sets camera fov. - * - * @private - * @param {number} value - The FOV to be set. - */ - private setFov; - /** - * Sets values in transformation object. - * - * @private - * @param {?Matrix4} [camera=null] - Transformation to be applied to the camera. - * @param {?Matrix4} [gizmos=null] - Transformation to be applied to gizmos. - */ - private setTransformationMatrices; - /** - * Rotates camera around its direction axis passing by a given point by a given angle. - * - * @private - * @param {Vector3} point - The point where the rotation axis is passing through. - * @param {number} angle - Angle in radians. - * @returns {Object} The computed transformation matrix. - */ - private zRotate; - /** - * Returns the raycaster that is used for user interaction. This object is shared between all - * instances of `ArcballControls`. - * - * @returns {Raycaster} The internal raycaster. - */ - getRaycaster(): Raycaster; - /** - * Unprojects the cursor on the 3D object surface. - * - * @private - * @param {Vector2} cursor - Cursor coordinates in NDC. - * @param {Camera} camera - Virtual camera. - * @returns {?Vector3} The point of intersection with the model, if exist, null otherwise. - */ - private unprojectOnObj; - /** - * Unproject the cursor on the trackball surface. - * - * @private - * @param {Camera} camera - The virtual camera. - * @param {number} cursorX - Cursor horizontal coordinate on screen. - * @param {number} cursorY - Cursor vertical coordinate on screen. - * @param {HTMLElement} canvas - The canvas where the renderer draws its output. - * @param {number} tbRadius - The trackball radius. - * @returns {Vector3} The unprojected point on the trackball surface. - */ - private unprojectOnTbSurface; - /** - * Unprojects the cursor on the plane passing through the center of the trackball orthogonal to the camera. - * - * @private - * @param {Camera} camera - The virtual camera. - * @param {number} cursorX - Cursor horizontal coordinate on screen. - * @param {number} cursorY - Cursor vertical coordinate on screen. - * @param {HTMLElement} canvas - The canvas where the renderer draws its output. - * @param {boolean} [initialDistance=false] - If initial distance between camera and gizmos should be used for calculations instead of current (Perspective only). - * @returns {Vector3} The unprojected point on the trackball plane. - */ - private unprojectOnTbPlane; - /** - * Updates camera and gizmos state. - * - * @private - */ - private updateMatrixState; - /** - * Updates the trackball FSA. - * - * @private - * @param {STATE} newState - New state of the FSA. - * @param {boolean} updateMatrices - If matrices state should be updated. - */ - private updateTbState; - setStateFromJSON(json: any): void; -} -import { Controls } from 'three'; -import { Vector3 } from 'three'; -import { Vector2 } from 'three'; -import { Matrix4 } from 'three'; -import { Quaternion } from 'three'; -import { GridHelper } from 'three'; -import { Group } from 'three'; -declare function onContextMenu(event: any): void; -declare function onWheel(event: any): void; -declare function onPointerUp(event: any): void; -declare class onPointerUp { - constructor(event: any); - _input: symbol | undefined; - _button: number | undefined; - _nclicks: number | undefined; - _clickStart: number | undefined; - _downValid: boolean | undefined; -} -declare function onPointerMove(event: any): void; -declare class onPointerMove { - constructor(event: any); - _input: symbol | undefined; - _downValid: boolean | undefined; -} -declare function onPointerDown(event: any): void; -declare class onPointerDown { - constructor(event: any); - _downValid: boolean; - _downStart: number | undefined; - _input: symbol | undefined; - _mouseOp: any; - _button: any; -} -declare function onPointerCancel(): void; -declare class onPointerCancel { - _input: symbol; -} -declare function onWindowResize(): void; -declare class onWindowResize { - _tbRadius: any; -} -import { Raycaster } from 'three'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts deleted file mode 100644 index 8457f57fb..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/DragControls.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This class can be used to provide a drag'n'drop interaction. - * - * ```js - * const controls = new DragControls( objects, camera, renderer.domElement ); - * - * // add event listener to highlight dragged objects - * controls.addEventListener( 'dragstart', function ( event ) { - * - * event.object.material.emissive.set( 0xaaaaaa ); - * - * } ); - * - * controls.addEventListener( 'dragend', function ( event ) { - * - * event.object.material.emissive.set( 0x000000 ); - * - * } ); - * ``` - * - * @augments Controls - * @three_import import { DragControls } from 'three/addons/controls/DragControls.js'; - */ -export class DragControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Array} objects - An array of draggable 3D objects. - * @param {Camera} camera - The camera of the rendered scene. - * @param {?HTMLElement} [domElement=null] - The HTML DOM element used for event listeners. - */ - constructor(objects: Array, camera: Camera, domElement?: HTMLElement | null); - /** - * An array of draggable 3D objects. - * - * @type {Array} - */ - objects: Array; - /** - * Whether children of draggable objects can be dragged independently from their parent. - * - * @type {boolean} - * @default true - */ - recursive: boolean; - /** - * This option only works if the `objects` array contains a single draggable group object. - * If set to `true`, the controls does not transform individual objects but the entire group. - * - * @type {boolean} - * @default false - */ - transformGroup: boolean; - /** - * The speed at which the object will rotate when dragged in `rotate` mode. - * The higher the number the faster the rotation. - * - * @type {number} - * @default 1 - */ - rotateSpeed: number; - /** - * The raycaster used for detecting 3D objects. - * - * @type {Raycaster} - */ - raycaster: Raycaster; - mouseButtons: { - LEFT: number; - MIDDLE: number; - RIGHT: number; - }; - touches: { - ONE: number; - }; - _onPointerMove: typeof onPointerMove; - _onPointerDown: typeof onPointerDown; - _onPointerCancel: typeof onPointerCancel; - _onContextMenu: typeof onContextMenu; - connect(element: any): void; - _updatePointer(event: any): void; - _updateState(event: any): void; -} -import { Controls } from 'three'; -import { Raycaster } from 'three'; -declare function onPointerMove(event: any): void; -declare function onPointerDown(event: any): void; -declare function onPointerCancel(): void; -declare class onPointerCancel { - state: number | undefined; -} -declare function onContextMenu(event: any): void; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts deleted file mode 100644 index 83dd31c48..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/FirstPersonControls.d.ts +++ /dev/null @@ -1,199 +0,0 @@ -/** - * This class is an alternative implementation of {@link FlyControls}. - * - * @augments Controls - * @three_import import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; - */ -export class FirstPersonControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Object3D} object - The object that is managed by the controls. - * @param {?HTMLElement} domElement - The HTML element used for event listeners. - */ - constructor(object: Object3D, domElement?: HTMLElement | null); - /** - * The movement speed. - * - * @type {number} - * @default 1 - */ - movementSpeed: number; - /** - * The look around speed. - * - * @type {number} - * @default 0.005 - */ - lookSpeed: number; - /** - * How quickly the movement and look velocity catches up to the input. Lower - * values feel heavier (more inertia), `1` disables damping. - * - * @type {number} - * @default 0.1 - */ - dampingFactor: number; - /** - * Whether it's possible to vertically look around or not. - * - * @type {boolean} - * @default true - */ - lookVertical: boolean; - /** - * Whether the camera is automatically moved forward or not. - * - * @type {boolean} - * @default false - */ - autoForward: boolean; - /** - * Whether or not the camera's height influences the forward movement speed. - * Use the properties `heightCoef`, `heightMin` and `heightMax` for configuration. - * - * @type {boolean} - * @default false - */ - heightSpeed: boolean; - /** - * Determines how much faster the camera moves when it's y-component is near `heightMax`. - * - * @type {number} - * @default 1 - */ - heightCoef: number; - /** - * Lower camera height limit used for movement speed adjustment. - * - * @type {number} - * @default 0 - */ - heightMin: number; - /** - * Upper camera height limit used for movement speed adjustment. - * - * @type {number} - * @default 1 - */ - heightMax: number; - /** - * Whether or not looking around is vertically constrained by `verticalMin` and `verticalMax`. - * - * @type {boolean} - * @default false - */ - constrainVertical: boolean; - /** - * How far you can vertically look around, lower limit. Range is `0` to `Math.PI` in radians. - * - * @type {number} - * @default 0 - */ - verticalMin: number; - /** - * How far you can vertically look around, upper limit. Range is `0` to `Math.PI` in radians. - * - * @type {number} - * @default 0 - */ - verticalMax: number; - /** - * Whether the mouse is pressed down or not. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly mouseDragOn: boolean; - _velocity: Vector3; - _pointerX: number; - _pointerY: number; - _pointerDownX: number; - _pointerDownY: number; - _pointerCount: number; - _keyForward: boolean; - _keyBackward: boolean; - _pointerForward: boolean; - _pointerBackward: boolean; - _moveLeft: boolean; - _moveRight: boolean; - _moveUp: boolean; - _moveDown: boolean; - _lat: number; - _lon: number; - _lonVelocity: number; - _latVelocity: number; - _onPointerMove: typeof onPointerMove; - _onPointerDown: typeof onPointerDown; - _onPointerUp: typeof onPointerUp; - _onContextMenu: typeof onContextMenu; - _onKeyDown: typeof onKeyDown; - _onKeyUp: typeof onKeyUp; - connect(element: any): void; - /** - * Rotates the camera towards the defined target position. - * - * @param {number|Vector3} x - The x coordinate of the target position or alternatively a vector representing the target position. - * @param {number} y - The y coordinate of the target position. - * @param {number} z - The z coordinate of the target position. - * @return {FirstPersonControls} A reference to this controls. - */ - lookAt(x: number | Vector3, y: number, z: number): FirstPersonControls; - update(delta: any): void; - _setOrientation(): void; - /** - * @deprecated, r184. This method is no longer needed. - */ - handleResize(): void; -} -import { Controls } from 'three'; -import { Vector3 } from 'three'; -declare function onPointerMove(event: any): void; -declare class onPointerMove { - constructor(event: any); - _pointerX: number | undefined; - _pointerY: number | undefined; -} -declare function onPointerDown(event: any): void; -declare class onPointerDown { - constructor(event: any); - _pointerForward: boolean | undefined; - _pointerBackward: boolean | undefined; - _pointerDownX: any; - _pointerDownY: any; - _pointerX: number; - _pointerY: number; - mouseDragOn: boolean; -} -declare function onPointerUp(event: any): void; -declare class onPointerUp { - constructor(event: any); - _pointerForward: boolean | undefined; - _pointerBackward: boolean | undefined; - _pointerX: number | undefined; - _pointerY: number | undefined; - mouseDragOn: boolean | undefined; -} -declare function onContextMenu(event: any): void; -declare function onKeyDown(event: any): void; -declare class onKeyDown { - constructor(event: any); - _keyForward: boolean | undefined; - _moveLeft: boolean | undefined; - _keyBackward: boolean | undefined; - _moveRight: boolean | undefined; - _moveUp: boolean | undefined; - _moveDown: boolean | undefined; -} -declare function onKeyUp(event: any): void; -declare class onKeyUp { - constructor(event: any); - _keyForward: boolean | undefined; - _moveLeft: boolean | undefined; - _keyBackward: boolean | undefined; - _moveRight: boolean | undefined; - _moveUp: boolean | undefined; - _moveDown: boolean | undefined; -} -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts deleted file mode 100644 index aa87bbefe..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/FlyControls.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * This class enables a navigation similar to fly modes in DCC tools like Blender. - * You can arbitrarily transform the camera in 3D space without any limitations - * (e.g. focus on a specific target). - * - * @augments Controls - * @three_import import { FlyControls } from 'three/addons/controls/FlyControls.js'; - */ -export class FlyControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Object3D} object - The object that is managed by the controls. - * @param {?HTMLElement} domElement - The HTML element used for event listeners. - */ - constructor(object: Object3D, domElement?: HTMLElement | null); - /** - * The movement speed. - * - * @type {number} - * @default 1 - */ - movementSpeed: number; - /** - * The rotation speed. - * - * @type {number} - * @default 0.005 - */ - rollSpeed: number; - /** - * If set to `true`, you can only look around by performing a drag interaction. - * - * @type {boolean} - * @default false - */ - dragToLook: boolean; - /** - * If set to `true`, the camera automatically moves forward (and does not stop) when initially translated. - * - * @type {boolean} - * @default false - */ - autoForward: boolean; - _moveState: { - up: number; - down: number; - left: number; - right: number; - forward: number; - back: number; - pitchUp: number; - pitchDown: number; - yawLeft: number; - yawRight: number; - rollLeft: number; - rollRight: number; - }; - _moveVector: Vector3; - _rotationVector: Vector3; - _lastQuaternion: Quaternion; - _lastPosition: Vector3; - _status: number; - _onKeyDown: typeof onKeyDown; - _onKeyUp: typeof onKeyUp; - _onPointerMove: typeof onPointerMove; - _onPointerDown: typeof onPointerDown; - _onPointerUp: typeof onPointerUp; - _onPointerCancel: typeof onPointerCancel; - _onContextMenu: typeof onContextMenu; - connect(element: any): void; - update(delta: any): void; - _updateMovementVector(): void; - _updateRotationVector(): void; - _getContainerDimensions(): { - size: number[]; - offset: number[]; - }; -} -import { Controls } from 'three'; -import { Vector3 } from 'three'; -import { Quaternion } from 'three'; -declare function onKeyDown(event: any): void; -declare class onKeyDown { - constructor(event: any); - movementSpeedMultiplier: number | undefined; -} -declare function onKeyUp(event: any): void; -declare class onKeyUp { - constructor(event: any); - movementSpeedMultiplier: number | undefined; -} -declare function onPointerMove(event: any): void; -declare function onPointerDown(event: any): void; -declare function onPointerUp(event: any): void; -declare function onPointerCancel(): void; -declare class onPointerCancel { - _status: number | undefined; -} -declare function onContextMenu(event: any): void; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts deleted file mode 100644 index f3b2f1265..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/MapControls.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This class is intended for transforming a camera over a map from bird's eye perspective. - * The class shares its implementation with {@link OrbitControls} but uses a specific preset - * for mouse/touch interaction and disables screen space panning by default. - * - * - Orbit: Right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate. - * - Zoom: Middle mouse, or mousewheel / touch: two-finger spread or squish. - * - Pan: Left mouse, or arrow keys / touch: one-finger move. - * - * @augments OrbitControls - * @three_import import { MapControls } from 'three/addons/controls/MapControls.js'; - */ -export class MapControls extends OrbitControls { - constructor(object: any, domElement: any); - _panWorldStart: Vector3; -} -import { OrbitControls } from './OrbitControls.js'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts deleted file mode 100644 index 0c5ffd8b8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/OrbitControls.d.ts +++ /dev/null @@ -1,458 +0,0 @@ -/** - * Orbit controls allow the camera to orbit around a target. - * - * OrbitControls performs orbiting, dollying (zooming), and panning. Unlike {@link TrackballControls}, - * it maintains the "up" direction `object.up` (+Y by default). - * - * - Orbit: Left mouse / touch: one-finger move. - * - Zoom: Middle mouse, or mousewheel / touch: two-finger spread or squish. - * - Pan: Right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move. - * - * ```js - * const controls = new OrbitControls( camera, renderer.domElement ); - * - * // controls.update() must be called after any manual changes to the camera's transform - * camera.position.set( 0, 20, 100 ); - * controls.update(); - * - * function animate() { - * - * // required if controls.enableDamping or controls.autoRotate are set to true - * controls.update(); - * - * renderer.render( scene, camera ); - * - * } - * ``` - * - * @augments Controls - * @three_import import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - */ -export class OrbitControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Object3D} object - The object that is managed by the controls. - * @param {?HTMLElement} domElement - The HTML element used for event listeners. - */ - constructor(object: Object3D, domElement?: HTMLElement | null); - /** - * The focus point of the controls, the `object` orbits around this. - * It can be updated manually at any point to change the focus of the controls. - * - * @type {Vector3} - */ - target: Vector3; - /** - * The focus point of the `minTargetRadius` and `maxTargetRadius` limits. - * It can be updated manually at any point to change the center of interest - * for the `target`. - * - * @type {Vector3} - */ - cursor: Vector3; - /** - * How far you can dolly in (perspective camera only). - * - * @type {number} - * @default 0 - */ - minDistance: number; - /** - * How far you can dolly out (perspective camera only). - * - * @type {number} - * @default Infinity - */ - maxDistance: number; - /** - * How far you can zoom in (orthographic camera only). - * - * @type {number} - * @default 0 - */ - minZoom: number; - /** - * How far you can zoom out (orthographic camera only). - * - * @type {number} - * @default Infinity - */ - maxZoom: number; - /** - * How close you can get the target to the 3D `cursor`. - * - * @type {number} - * @default 0 - */ - minTargetRadius: number; - /** - * How far you can move the target from the 3D `cursor`. - * - * @type {number} - * @default Infinity - */ - maxTargetRadius: number; - /** - * How far you can orbit vertically, lower limit. Range is `[0, Math.PI]` radians. - * - * @type {number} - * @default 0 - */ - minPolarAngle: number; - /** - * How far you can orbit vertically, upper limit. Range is `[0, Math.PI]` radians. - * - * @type {number} - * @default Math.PI - */ - maxPolarAngle: number; - /** - * How far you can orbit horizontally, lower limit. If set, the interval `[ min, max ]` - * must be a sub-interval of `[ - 2 PI, 2 PI ]`, with `( max - min < 2 PI )`. - * - * @type {number} - * @default -Infinity - */ - minAzimuthAngle: number; - /** - * How far you can orbit horizontally, upper limit. If set, the interval `[ min, max ]` - * must be a sub-interval of `[ - 2 PI, 2 PI ]`, with `( max - min < 2 PI )`. - * - * @type {number} - * @default -Infinity - */ - maxAzimuthAngle: number; - /** - * Set to `true` to enable damping (inertia), which can be used to give a sense of weight - * to the controls. Note that if this is enabled, you must call `update()` in your animation - * loop. - * - * @type {boolean} - * @default false - */ - enableDamping: boolean; - /** - * The damping inertia used if `enableDamping` is set to `true`. - * - * Note that for this to work, you must call `update()` in your animation loop. - * - * @type {number} - * @default 0.05 - */ - dampingFactor: number; - /** - * Enable or disable zooming (dollying) of the camera. - * - * @type {boolean} - * @default true - */ - enableZoom: boolean; - /** - * Speed of zooming / dollying. - * - * @type {number} - * @default 1 - */ - zoomSpeed: number; - /** - * Enable or disable horizontal and vertical rotation of the camera. - * - * Note that it is possible to disable a single axis by setting the min and max of the - * `minPolarAngle` or `minAzimuthAngle` to the same value, which will cause the vertical - * or horizontal rotation to be fixed at that value. - * - * @type {boolean} - * @default true - */ - enableRotate: boolean; - /** - * Speed of rotation. - * - * @type {number} - * @default 1 - */ - rotateSpeed: number; - /** - * How fast to rotate the camera when the keyboard is used. - * - * @type {number} - * @default 1 - */ - keyRotateSpeed: number; - /** - * Enable or disable camera panning. - * - * @type {boolean} - * @default true - */ - enablePan: boolean; - /** - * Speed of panning. - * - * @type {number} - * @default 1 - */ - panSpeed: number; - /** - * Defines how the camera's position is translated when panning. If `true`, the camera pans - * in screen space. Otherwise, the camera pans in the plane orthogonal to the camera's up - * direction. - * - * @type {boolean} - * @default true - */ - screenSpacePanning: boolean; - /** - * How fast to pan the camera when the keyboard is used in - * pixels per keypress. - * - * @type {number} - * @default 7 - */ - keyPanSpeed: number; - /** - * Setting this property to `true` allows to zoom to the cursor's position. - * - * @type {boolean} - * @default false - */ - zoomToCursor: boolean; - /** - * Set to true to automatically rotate around the target - * - * Note that if this is enabled, you must call `update()` in your animation loop. - * If you want the auto-rotate speed to be independent of the frame rate (the refresh - * rate of the display), you must pass the time `deltaTime`, in seconds, to `update()`. - * - * @type {boolean} - * @default false - */ - autoRotate: boolean; - /** - * How fast to rotate around the target if `autoRotate` is `true`. The default equates to 30 seconds - * per orbit at 60fps. - * - * Note that if `autoRotate` is enabled, you must call `update()` in your animation loop. - * - * @type {number} - * @default 2 - */ - autoRotateSpeed: number; - /** - * Used internally by `saveState()` and `reset()`. - * - * @type {Vector3} - */ - target0: Vector3; - /** - * Used internally by `saveState()` and `reset()`. - * - * @type {Vector3} - */ - position0: Vector3; - /** - * Used internally by `saveState()` and `reset()`. - * - * @type {number} - */ - zoom0: number; - _cursorStyle: string; - _domElementKeyEvents: HTMLElement | null; - _lastPosition: Vector3; - _lastQuaternion: Quaternion; - _lastTargetPosition: Vector3; - _quat: Quaternion; - _quatInverse: Quaternion; - _spherical: Spherical; - _sphericalDelta: Spherical; - _scale: number; - _panOffset: Vector3; - _rotateStart: Vector2; - _rotateEnd: Vector2; - _rotateDelta: Vector2; - _panStart: Vector2; - _panEnd: Vector2; - _panDelta: Vector2; - _dollyStart: Vector2; - _dollyEnd: Vector2; - _dollyDelta: Vector2; - _dollyDirection: Vector3; - _mouse: Vector2; - _performCursorZoom: boolean; - _pointers: any[]; - _pointerPositions: {}; - _controlActive: boolean; - _onPointerMove: typeof onPointerMove; - _onPointerDown: typeof onPointerDown; - _onPointerUp: typeof onPointerUp; - _onContextMenu: typeof onContextMenu; - _onMouseWheel: typeof onMouseWheel; - _onKeyDown: typeof onKeyDown; - _onTouchStart: typeof onTouchStart; - _onTouchMove: typeof onTouchMove; - _onMouseDown: typeof onMouseDown; - _onMouseMove: typeof onMouseMove; - _interceptControlDown: typeof interceptControlDown; - _interceptControlUp: typeof interceptControlUp; - /** - * Defines the visual representation of the cursor. - * - * @type {('auto'|'grab')} - * @default 'auto' - */ - set cursorStyle(type: string); - get cursorStyle(): string; - connect(element: any): void; - /** - * Get the current vertical rotation, in radians. - * - * @return {number} The current vertical rotation, in radians. - */ - getPolarAngle(): number; - /** - * Get the current horizontal rotation, in radians. - * - * @return {number} The current horizontal rotation, in radians. - */ - getAzimuthalAngle(): number; - /** - * Returns the distance from the camera to the target. - * - * @return {number} The distance from the camera to the target. - */ - getDistance(): number; - /** - * Adds key event listeners to the given DOM element. - * `window` is a recommended argument for using this method. - * - * @param {HTMLElement} domElement - The DOM element - */ - listenToKeyEvents(domElement: HTMLElement): void; - /** - * Removes the key event listener previously defined with `listenToKeyEvents()`. - */ - stopListenToKeyEvents(): void; - /** - * Save the current state of the controls. This can later be recovered with `reset()`. - */ - saveState(): void; - /** - * Reset the controls to their state from either the last time the `saveState()` - * was called, or the initial state. - */ - reset(): void; - /** - * Programmatically pan the camera. - * - * @param {number} deltaX - The horizontal pan amount in pixels. - * @param {number} deltaY - The vertical pan amount in pixels. - */ - pan(deltaX: number, deltaY: number): void; - /** - * Programmatically dolly in (zoom in for perspective camera). - * - * @param {number} dollyScale - The dolly scale factor. - */ - dollyIn(dollyScale: number): void; - /** - * Programmatically dolly out (zoom out for perspective camera). - * - * @param {number} dollyScale - The dolly scale factor. - */ - dollyOut(dollyScale: number): void; - /** - * Programmatically rotate the camera left (around the vertical axis). - * - * @param {number} angle - The rotation angle in radians. - */ - rotateLeft(angle: number): void; - /** - * Programmatically rotate the camera up (around the horizontal axis). - * - * @param {number} angle - The rotation angle in radians. - */ - rotateUp(angle: number): void; - update(deltaTime?: null): boolean; - _getAutoRotationAngle(deltaTime: any): number; - _getZoomScale(delta: any): number; - _rotateLeft(angle: any): void; - _rotateUp(angle: any): void; - _panLeft(distance: any, objectMatrix: any): void; - _panUp(distance: any, objectMatrix: any): void; - _pan(deltaX: any, deltaY: any): void; - _dollyOut(dollyScale: any): void; - _dollyIn(dollyScale: any): void; - _updateZoomParameters(x: any, y: any): void; - _clampDistance(dist: any): number; - _handleMouseDownRotate(event: any): void; - _handleMouseDownDolly(event: any): void; - _handleMouseDownPan(event: any): void; - _handleMouseMoveRotate(event: any): void; - _handleMouseMoveDolly(event: any): void; - _handleMouseMovePan(event: any): void; - _handleMouseWheel(event: any): void; - _handleKeyDown(event: any): void; - _handleTouchStartRotate(event: any): void; - _handleTouchStartPan(event: any): void; - _handleTouchStartDolly(event: any): void; - _handleTouchStartDollyPan(event: any): void; - _handleTouchStartDollyRotate(event: any): void; - _handleTouchMoveRotate(event: any): void; - _handleTouchMovePan(event: any): void; - _handleTouchMoveDolly(event: any): void; - _handleTouchMoveDollyPan(event: any): void; - _handleTouchMoveDollyRotate(event: any): void; - _addPointer(event: any): void; - _removePointer(event: any): void; - _isTrackingPointer(event: any): boolean; - _trackPointer(event: any): void; - _getSecondPointerPosition(event: any): any; - _customWheelEvent(event: any): { - clientX: any; - clientY: any; - deltaY: any; - }; -} -import { Controls } from 'three'; -import { Vector3 } from 'three'; -import { Quaternion } from 'three'; -import { Spherical } from 'three'; -import { Vector2 } from 'three'; -declare function onPointerMove(event: any): void; -declare function onPointerDown(event: any): void; -declare function onPointerUp(event: any): void; -declare class onPointerUp { - constructor(event: any); - state: number | undefined; -} -declare function onContextMenu(event: any): void; -declare function onMouseWheel(event: any): void; -declare function onKeyDown(event: any): void; -declare function onTouchStart(event: any): void; -declare class onTouchStart { - constructor(event: any); - state: number | undefined; -} -declare function onTouchMove(event: any): void; -declare class onTouchMove { - constructor(event: any); - state: number; -} -declare function onMouseDown(event: any): void; -declare class onMouseDown { - constructor(event: any); - state: number | undefined; -} -declare function onMouseMove(event: any): void; -declare function interceptControlDown(event: any): void; -declare class interceptControlDown { - constructor(event: any); - _controlActive: boolean | undefined; -} -declare function interceptControlUp(event: any): void; -declare class interceptControlUp { - constructor(event: any); - _controlActive: boolean | undefined; -} -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts deleted file mode 100644 index 7cfa4f7b6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/PointerLockControls.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * The implementation of this class is based on the [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API). - * `PointerLockControls` is a perfect choice for first person 3D games. - * - * ```js - * const controls = new PointerLockControls( camera, document.body ); - * - * // add event listener to show/hide a UI (e.g. the game's menu) - * controls.addEventListener( 'lock', function () { - * - * menu.style.display = 'none'; - * - * } ); - * - * controls.addEventListener( 'unlock', function () { - * - * menu.style.display = 'block'; - * - * } ); - * ``` - * - * @augments Controls - * @three_import import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js'; - */ -export class PointerLockControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Camera} camera - The camera that is managed by the controls. - * @param {?HTMLElement} domElement - The HTML element used for event listeners. - */ - constructor(camera: Camera, domElement?: HTMLElement | null); - /** - * Whether the controls are locked or not. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly isLocked: boolean; - /** - * Camera pitch, lower limit. Range is '[0, Math.PI]' in radians. - * - * @type {number} - * @default 0 - */ - minPolarAngle: number; - /** - * Camera pitch, upper limit. Range is '[0, Math.PI]' in radians. - * - * @type {number} - * @default Math.PI - */ - maxPolarAngle: number; - /** - * Multiplier for how much the pointer movement influences the camera rotation. - * - * @type {number} - * @default 1 - */ - pointerSpeed: number; - _onMouseMove: typeof onMouseMove; - _onPointerlockChange: typeof onPointerlockChange; - _onPointerlockError: typeof onPointerlockError; - connect(element: any): void; - /** - * Returns the look direction of the camera. - * - * @param {Vector3} v - The target vector that is used to store the method's result. - * @return {Vector3} The normalized direction vector. - */ - getDirection(v: Vector3): Vector3; - /** - * Moves the camera forward parallel to the xz-plane. Assumes camera.up is y-up. - * - * @param {number} distance - The signed distance. - */ - moveForward(distance: number): void; - /** - * Moves the camera sidewards parallel to the xz-plane. - * - * @param {number} distance - The signed distance. - */ - moveRight(distance: number): void; - /** - * Activates the pointer lock. - * - * @param {boolean} [unadjustedMovement=false] - Disables OS-level adjustment for mouse acceleration, and accesses raw mouse input instead. - * Setting it to true will disable mouse acceleration. - */ - lock(unadjustedMovement?: boolean): void; - /** - * Exits the pointer lock. - */ - unlock(): void; -} -import { Controls } from 'three'; -declare function onMouseMove(event: any): void; -declare function onPointerlockChange(): void; -declare class onPointerlockChange { - isLocked: boolean; -} -declare function onPointerlockError(): void; -import { Vector3 } from 'three'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts deleted file mode 100644 index e10874ec1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/TrackballControls.d.ts +++ /dev/null @@ -1,234 +0,0 @@ -/** - * This class is similar to {@link OrbitControls}. However, it does not maintain a constant camera - * `up` vector. That means if the camera orbits over the “north” and “south” poles, it does not flip - * to stay "right side up". - * - * @augments Controls - * @three_import import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; - */ -export class TrackballControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Object3D} object - The object that is managed by the controls. - * @param {?HTMLElement} domElement - The HTML element used for event listeners. - */ - constructor(object: Object3D, domElement?: HTMLElement | null); - /** - * Represents the properties of the screen. Automatically set when `handleResize()` is called. - * - * @type {Object} - * @readonly - */ - readonly screen: Object; - /** - * The rotation speed. - * - * @type {number} - * @default 1 - */ - rotateSpeed: number; - /** - * The zoom speed. - * - * @type {number} - * @default 1.2 - */ - zoomSpeed: number; - /** - * The pan speed. - * - * @type {number} - * @default 0.3 - */ - panSpeed: number; - /** - * The roll speed used for multi-touch roll. - * - * @type {number} - * @default 1 - */ - rollSpeed: number; - /** - * Whether rotation is disabled or not. - * - * @type {boolean} - * @default false - */ - noRotate: boolean; - /** - * Whether zooming is disabled or not. - * - * @type {boolean} - * @default false - */ - noZoom: boolean; - /** - * Whether panning is disabled or not. - * - * @type {boolean} - * @default false - */ - noPan: boolean; - /** - * Whether two finger twist gesture rolls - * the camera around its view axis or not. - * - * @type {boolean} - * @default false - */ - multiTouchRoll: boolean; - /** - * Whether damping is disabled or not. - * - * @type {boolean} - * @default false - */ - staticMoving: boolean; - /** - * Defines the intensity of damping. Only considered if `staticMoving` is set to `false`. - * - * @type {number} - * @default 0.2 - */ - dynamicDampingFactor: number; - /** - * How far you can dolly in (perspective camera only). - * - * @type {number} - * @default 0 - */ - minDistance: number; - /** - * How far you can dolly out (perspective camera only). - * - * @type {number} - * @default Infinity - */ - maxDistance: number; - /** - * How far you can zoom in (orthographic camera only). - * - * @type {number} - * @default 0 - */ - minZoom: number; - /** - * How far you can zoom out (orthographic camera only). - * - * @type {number} - * @default Infinity - */ - maxZoom: number; - /** - * The focus point of the controls. - * - * @type {Vector3} - */ - target: Vector3; - keyState: number; - _lastPosition: Vector3; - _lastUp: Vector3; - _lastZoom: number; - _touchZoomDistanceStart: number; - _touchZoomDistanceEnd: number; - _touchRollAngle: number; - _touchRollPointerIds: string; - _lastAngle: number; - _lastRollAngle: number; - _eye: Vector3; - _movePrev: Vector2; - _moveCurr: Vector2; - _lastAxis: Vector3; - _zoomStart: Vector2; - _zoomEnd: Vector2; - _panStart: Vector2; - _panEnd: Vector2; - _pointers: any[]; - _pointerPositions: {}; - _onPointerMove: typeof onPointerMove; - _onPointerDown: typeof onPointerDown; - _onPointerUp: typeof onPointerUp; - _onPointerCancel: typeof onPointerCancel; - _onContextMenu: typeof onContextMenu; - _onMouseWheel: typeof onMouseWheel; - _onKeyDown: typeof onKeyDown; - _onKeyUp: typeof onKeyUp; - _onTouchStart: typeof onTouchStart; - _onTouchMove: typeof onTouchMove; - _onTouchEnd: typeof onTouchEnd; - _onMouseDown: typeof onMouseDown; - _onMouseMove: typeof onMouseMove; - _onMouseUp: typeof onMouseUp; - _target0: Vector3; - _position0: any; - _up0: Vector3; - _zoom0: any; - connect(element: any): void; - /** - * Must be called if the application window is resized. - */ - handleResize(): void; - /** - * Resets the controls to its initial state. - */ - reset(): void; - _panCamera(): void; - _rotateCamera(): void; - _rollCamera(): void; - _getTouchRollAngle(): number; - _zoomCamera(): void; - _getMouseOnScreen(pageX: any, pageY: any): Vector2; - _getMouseOnCircle(pageX: any, pageY: any): Vector2; - _addPointer(event: any): void; - _removePointer(event: any): void; - _trackPointer(event: any): void; - _getSecondPointerPosition(event: any): any; - _checkDistances(): void; -} -import { Controls } from 'three'; -import { Vector3 } from 'three'; -import { Vector2 } from 'three'; -declare function onPointerMove(event: any): void; -declare function onPointerDown(event: any): void; -declare function onPointerUp(event: any): void; -declare function onPointerCancel(event: any): void; -declare function onContextMenu(event: any): void; -declare function onMouseWheel(event: any): void; -declare function onKeyDown(event: any): void; -declare class onKeyDown { - constructor(event: any); - keyState: number | undefined; -} -declare function onKeyUp(): void; -declare class onKeyUp { - keyState: number | undefined; -} -declare function onTouchStart(event: any): void; -declare class onTouchStart { - constructor(event: any); - state: number; - _touchZoomDistanceEnd: number | undefined; - _touchZoomDistanceStart: number | undefined; -} -declare function onTouchMove(event: any): void; -declare class onTouchMove { - constructor(event: any); - _touchZoomDistanceEnd: number | undefined; -} -declare function onTouchEnd(event: any): void; -declare class onTouchEnd { - constructor(event: any); - state: number | undefined; -} -declare function onMouseDown(event: any): void; -declare class onMouseDown { - constructor(event: any); - state: number; -} -declare function onMouseMove(event: any): void; -declare function onMouseUp(): void; -declare class onMouseUp { - state: number; -} -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts b/jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts deleted file mode 100644 index 1595900fb..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/controls/TransformControls.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -/** - * This class can be used to transform objects in 3D space by adapting a similar interaction model - * of DCC tools like Blender. Unlike other controls, it is not intended to transform the scene's camera. - * - * `TransformControls` expects that its attached 3D object is part of the scene graph. - * - * @augments Controls - * @three_import import { TransformControls } from 'three/addons/controls/TransformControls.js'; - */ -export class TransformControls extends Controls { - /** - * Constructs a new controls instance. - * - * @param {Camera} camera - The camera of the rendered scene. - * @param {?HTMLElement} domElement - The HTML element used for event listeners. - */ - constructor(camera: Camera, domElement?: HTMLElement | null); - _root: TransformControlsRoot; - _gizmo: TransformControlsGizmo; - _plane: TransformControlsPlane; - /** - * The viewport rectangle, in logical (CSS) pixels with the origin at the lower-left - * of the canvas. Set this when the renderer uses a sub-canvas viewport so pointer - * coordinates map to the correct region. If `null`, the full canvas is used. - * - * @name TransformControls#viewport - * @type {?Vector4} - * @default null - */ - viewport: Vector4 | null; - _offset: Vector3; - _startNorm: Vector3; - _endNorm: Vector3; - _cameraScale: Vector3; - _parentPosition: Vector3; - _parentQuaternion: Quaternion; - _parentQuaternionInv: Quaternion; - _parentScale: Vector3; - _worldScaleStart: Vector3; - _worldQuaternionInv: Quaternion; - _worldScale: Vector3; - _positionStart: Vector3; - _quaternionStart: Quaternion; - _scaleStart: Vector3; - _getPointer: typeof getPointer; - _onPointerDown: typeof onPointerDown; - _onPointerHover: typeof onPointerHover; - _onPointerMove: typeof onPointerMove; - _onPointerUp: typeof onPointerUp; - connect(element: any): void; - /** - * Returns the visual representation of the controls. Add the helper to your scene to - * visually transform the attached 3D object. - * - * @return {TransformControlsRoot} The helper. - */ - getHelper(): TransformControlsRoot; - pointerHover(pointer: any): void; - axis: any; - pointerDown(pointer: any): void; - dragging: boolean | undefined; - pointerMove(pointer: any): void; - rotationAngle: any; - pointerUp(pointer: any): void; - /** - * Sets the 3D object that should be transformed and ensures the controls UI is visible. - * - * @param {Object3D} object - The 3D object that should be transformed. - * @return {TransformControls} A reference to this controls. - */ - attach(object: Object3D): TransformControls; - /** - * Removes the current 3D object from the controls and makes the helper UI invisible. - * - * @return {TransformControls} A reference to this controls. - */ - detach(): TransformControls; - /** - * Resets the object's position, rotation and scale to when the current transform began. - */ - reset(): void; - /** - * Returns the raycaster that is used for user interaction. This object is shared between all - * instances of `TransformControls`. - * - * @returns {Raycaster} The internal raycaster. - */ - getRaycaster(): Raycaster; - /** - * Returns the transformation mode. - * - * @returns {'translate'|'rotate'|'scale'} The transformation mode. - */ - getMode(): "translate" | "rotate" | "scale"; - /** - * Sets the given transformation mode. - * - * @param {'translate'|'rotate'|'scale'} mode - The transformation mode to set. - */ - setMode(mode: "translate" | "rotate" | "scale"): void; - mode: "rotate" | "scale" | "translate" | undefined; - /** - * Sets the translation snap. - * - * @param {?number} translationSnap - The translation snap to set. - */ - setTranslationSnap(translationSnap: number | null): void; - translationSnap: number | null | undefined; - /** - * Sets the rotation snap. - * - * @param {?number} rotationSnap - The rotation snap to set. - */ - setRotationSnap(rotationSnap: number | null): void; - rotationSnap: number | null | undefined; - /** - * Sets the scale snap. - * - * @param {?number} scaleSnap - The scale snap to set. - */ - setScaleSnap(scaleSnap: number | null): void; - scaleSnap: number | null | undefined; - /** - * Sets the size of the helper UI. - * - * @param {number} size - The size to set. - */ - setSize(size: number): void; - size: number | undefined; - /** - * Sets the coordinate space in which transformations are applied. - * - * @param {'world'|'local'} space - The space to set. - */ - setSpace(space: "world" | "local"): void; - space: "world" | "local" | undefined; - /** - * Sets the colors of the control's gizmo. - * - * @param {number|Color|string} xAxis - The x-axis color. - * @param {number|Color|string} yAxis - The y-axis color. - * @param {number|Color|string} zAxis - The z-axis color. - * @param {number|Color|string} active - The color for active elements. - */ - setColors(xAxis: number | Color | string, yAxis: number | Color | string, zAxis: number | Color | string, active: number | Color | string): void; -} -export class TransformControlsGizmo extends Object3D { - isTransformControlsGizmo: boolean; - type: string; - materialLib: { - xAxis: import("three").Material; - yAxis: import("three").Material; - zAxis: import("three").Material; - active: import("three").Material; - xAxisTransparent: import("three").Material; - yAxisTransparent: import("three").Material; - zAxisTransparent: import("three").Material; - activeTransparent: import("three").Material; - }; - gizmo: {}; - picker: {}; - helper: {}; - updateMatrixWorld(force: any): void; -} -export class TransformControlsPlane extends Mesh { - constructor(); - isTransformControlsPlane: boolean; - updateMatrixWorld(force: any): void; -} -import { Controls } from 'three'; -declare class TransformControlsRoot extends Object3D { - constructor(controls: any); - isTransformControlsRoot: boolean; - controls: any; - updateMatrixWorld(force: any): void; -} -import { Vector3 } from 'three'; -import { Quaternion } from 'three'; -declare function getPointer(event: any): { - x: number; - y: number; - button: any; -}; -declare function onPointerDown(event: any): void; -declare function onPointerHover(event: any): void; -declare function onPointerMove(event: any): void; -declare function onPointerUp(event: any): void; -import { Object3D } from 'three'; -import { Raycaster } from 'three'; -import { Mesh } from 'three'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts deleted file mode 100644 index ed5c7f8ee..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/csm/CSM.d.ts +++ /dev/null @@ -1,214 +0,0 @@ -/** - * An implementation of Cascade Shadow Maps (CSM). - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * use {@link CSMShadowNode} instead. - * - * @three_import import { CSM } from 'three/addons/csm/CSM.js'; - */ -export class CSM { - /** - * Constructs a new CSM instance. - * - * @param {CSM~Data} data - The CSM data. - */ - constructor(data: any); - /** - * The scene's camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * The parent object, usually the scene. - * - * @type {Object3D} - */ - parent: Object3D; - /** - * The number of cascades. - * - * @type {number} - * @default 3 - */ - cascades: number; - /** - * The maximum far value. - * - * @type {number} - * @default 100000 - */ - maxFar: number; - /** - * The frustum split mode. - * - * @type {('practical'|'uniform'|'logarithmic'|'custom')} - * @default 'practical' - */ - mode: ("practical" | "uniform" | "logarithmic" | "custom"); - /** - * The shadow map size. - * - * @type {number} - * @default 2048 - */ - shadowMapSize: number; - /** - * The shadow bias. - * - * @type {number} - * @default 0.000001 - */ - shadowBias: number; - /** - * The light direction. - * - * @type {Vector3} - */ - lightDirection: Vector3; - /** - * The light intensity. - * - * @type {number} - * @default 3 - */ - lightIntensity: number; - /** - * The light near value. - * - * @type {number} - * @default 1 - */ - lightNear: number; - /** - * The light far value. - * - * @type {number} - * @default 2000 - */ - lightFar: number; - /** - * The light margin. - * - * @type {number} - * @default 200 - */ - lightMargin: number; - /** - * Custom split callback when using `mode='custom'`. - * - * @type {Function} - */ - customSplitsCallback: Function; - /** - * Whether to fade between cascades or not. - * - * @type {boolean} - * @default false - */ - fade: boolean; - /** - * The main frustum. - * - * @type {CSMFrustum} - */ - mainFrustum: CSMFrustum; - /** - * An array of frustums representing the cascades. - * - * @type {Array} - */ - frustums: Array; - /** - * An array of numbers in the range `[0,1]` the defines how the - * mainCSM frustum should be split up. - * - * @type {Array} - */ - breaks: Array; - /** - * An array of directional lights which cast the shadows for - * the different cascades. There is one directional light for each - * cascade. - * - * @type {Array} - */ - lights: Array; - /** - * A Map holding enhanced material shaders. - * - * @type {Map} - */ - shaders: Map; - /** - * Creates the directional lights of this CSM instance. - * - * @private - */ - private _createLights; - /** - * Inits the cascades according to the scene's camera and breaks configuration. - * - * @private - */ - private _initCascades; - /** - * Updates the shadow bounds of this CSM instance. - * - * @private - */ - private _updateShadowBounds; - /** - * Computes the breaks of this CSM instance based on the scene's camera, number of cascades - * and the selected split mode. - * - * @private - */ - private _getBreaks; - /** - * Updates the CSM. This method must be called in your animation loop before - * calling `renderer.render()`. - */ - update(): void; - /** - * Injects the CSM shader enhancements into the built-in materials. - * - * @private - */ - private _injectInclude; - /** - * Applications must call this method for all materials that should be affected by CSM. - * - * @param {Material} material - The material to setup for CSM support. - */ - setupMaterial(material: Material): void; - /** - * Updates the CSM uniforms. - * - * @private - */ - private _updateUniforms; - /** - * Computes the extended breaks for the CSM uniforms. - * - * @private - * @param {Array} target - The target array that holds the extended breaks. - */ - private _getExtendedBreaks; - /** - * Applications must call this method every time they change camera or CSM settings. - */ - updateFrustums(): void; - /** - * Applications must call this method when they remove the CSM usage from their scene. - */ - remove(): void; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - */ - dispose(): void; -} -import { Vector3 } from 'three'; -import { CSMFrustum } from './CSMFrustum.js'; -import { DirectionalLight } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts deleted file mode 100644 index d3c23f934..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMFrustum.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * ~Data - */ -export type CSMFrustum = { - /** - * - Whether this CSM frustum is used with WebGL or WebGPU. - */ - webGL?: boolean | undefined; - /** - * - Whether reversed depth buffer is enabled. - */ - reversedDepth?: boolean | undefined; - /** - * - A projection matrix usually of the scene's camera. - */ - projectionMatrix?: Matrix4 | undefined; - /** - * - The maximum far value. - */ - maxFar?: number | undefined; -}; -import { Matrix4 } from 'three'; -/** - * Represents the frustum of a CSM instance. - * - * @three_import import { CSMFrustum } from 'three/addons/csm/CSMFrustum.js'; - */ -export class CSMFrustum { - /** - * Constructs a new CSM frustum. - * - * @param {CSMFrustum~Data} [data] - The CSM data. - */ - constructor(data: any); - /** - * The zNear value. This value depends on whether the CSM - * is used with WebGL or WebGPU. Both API use different - * conventions for their projection matrices. - * - * @type {number} - */ - zNear: number; - /** - * The zFar value. - * - * @type {number} - */ - zFar: number; - /** - * An object representing the vertices of the near and - * far plane in view space. - * - * @type {Object} - */ - vertices: Object; - /** - * Setups this CSM frustum from the given projection matrix and max far value. - * - * @param {Matrix4} projectionMatrix - The projection matrix, usually of the scene's camera. - * @param {number} maxFar - The maximum far value. - * @returns {Object} An object representing the vertices of the near and far plane in view space. - */ - setFromProjectionMatrix(projectionMatrix: Matrix4, maxFar: number): Object; - /** - * Splits the CSM frustum by the given array. The new CSM frustum are pushed into the given - * target array. - * - * @param {Array} breaks - An array of numbers in the range `[0,1]` the defines how the - * CSM frustum should be split up. - * @param {Array} target - The target array that holds the new CSM frustums. - */ - split(breaks: Array, target: Array): void; - /** - * Transforms the given target CSM frustum into the different coordinate system defined by the - * given camera matrix. - * - * @param {Matrix4} cameraMatrix - The matrix that defines the new coordinate system. - * @param {CSMFrustum} target - The CSM to convert. - */ - toSpace(cameraMatrix: Matrix4, target: CSMFrustum): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts deleted file mode 100644 index 92be72fdf..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMHelper.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * A helper for visualizing the cascades of a CSM instance. - * - * @augments Group - * @three_import import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; - */ -export class CSMHelper extends Group { - /** - * Constructs a new CSM helper. - * - * @param {CSM|CSMShadowNode} csm - The CSM instance to visualize. - */ - constructor(csm: CSM | CSMShadowNode); - /** - * The CSM instance to visualize. - * - * @type {CSM|CSMShadowNode} - */ - csm: CSM | CSMShadowNode; - /** - * Whether to display the CSM frustum or not. - * - * @type {boolean} - * @default true - */ - displayFrustum: boolean; - /** - * Whether to display the cascade planes or not. - * - * @type {boolean} - * @default true - */ - displayPlanes: boolean; - /** - * Whether to display the shadow bounds or not. - * - * @type {boolean} - * @default true - */ - displayShadowBounds: boolean; - frustumLines: LineSegments; - cascadeLines: any[]; - cascadePlanes: any[]; - shadowLines: any[]; - /** - * This method must be called if one of the `display*` properties is changed at runtime. - */ - updateVisibility(): void; - /** - * Updates the helper. This method should be called in the app's animation loop. - */ - update(): void; -} -import { Group } from 'three'; -import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts deleted file mode 100644 index 8bcc7f719..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module CSMShader - * @three_import import { CSMShader } from 'three/addons/csm/CSMShader.js'; - */ -/** - * The object that holds the GLSL enhancements to enable CSM. This - * code is injected into the built-in material shaders by {@link CSM}. - * - * @type {Object} - */ -export const CSMShader: Object; diff --git a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts deleted file mode 100644 index 6c42c9ff2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/csm/CSMShadowNode.d.ts +++ /dev/null @@ -1,176 +0,0 @@ -/** - * ~Data - */ -export type CSMShadowNode = { - /** - * - The number of cascades. - */ - cascades?: number | undefined; - /** - * - The maximum far value. - */ - maxFar?: number | undefined; - /** - * - The frustum split mode. - */ - mode?: "uniform" | "custom" | "practical" | "logarithmic" | undefined; - /** - * - Custom split callback when using `mode='custom'`. - */ - customSplitsCallback?: Function | undefined; - /** - * - The light margin. - */ - lightMargin?: number | undefined; -}; -/** - * An implementation of Cascade Shadow Maps (CSM). - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * use {@link CSM} instead. - * - * @augments ShadowBaseNode - * @three_import import { CSMShadowNode } from 'three/addons/csm/CSMShadowNode.js'; - */ -export class CSMShadowNode extends ShadowBaseNode { - /** - * Constructs a new CSM shadow node. - * - * @param {DirectionalLight} light - The CSM light. - * @param {CSMShadowNode~Data} [data={}] - The CSM data. - */ - constructor(light: DirectionalLight, data?: {}); - /** - * The scene's camera. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * The number of cascades. - * - * @type {number} - * @default 3 - */ - cascades: number; - /** - * The maximum far value. - * - * @type {number} - * @default 100000 - */ - maxFar: number; - /** - * The frustum split mode. - * - * @type {('practical'|'uniform'|'logarithmic'|'custom')} - * @default 'practical' - */ - mode: ("practical" | "uniform" | "logarithmic" | "custom"); - /** - * The light margin. - * - * @type {number} - * @default 200 - */ - lightMargin: number; - /** - * Custom split callback when using `mode='custom'`. - * - * @type {Function} - */ - customSplitsCallback: Function; - /** - * Whether to fade between cascades or not. - * - * @type {boolean} - * @default false - */ - fade: boolean; - /** - * An array of numbers in the range `[0,1]` the defines how the - * mainCSM frustum should be split up. - * - * @type {Array} - */ - breaks: Array; - _cascades: any[]; - /** - * The main frustum. - * - * @type {?CSMFrustum} - * @default null - */ - mainFrustum: CSMFrustum | null; - /** - * An array of frustums representing the cascades. - * - * @type {Array} - */ - frustums: Array; - /** - * An array of directional lights which cast the shadows for - * the different cascades. There is one directional light for each - * cascade. - * - * @type {Array} - */ - lights: Array; - _shadowNodes: any[]; - /** - * Inits the CSM shadow node. - * - * @private - * @param {NodeBuilder} builder - The node builder. - */ - private _init; - /** - * Inits the cascades according to the scene's camera and breaks configuration. - * - * @private - */ - private _initCascades; - /** - * Computes the breaks of this CSM instance based on the scene's camera, number of cascades - * and the selected split mode. - * - * @private - */ - private _getBreaks; - /** - * Sets the light breaks. - * - * @private - */ - private _setLightBreaks; - /** - * Updates the shadow bounds of this CSM instance. - * - * @private - */ - private _updateShadowBounds; - /** - * Applications must call this method every time they change camera or CSM settings. - */ - updateFrustums(): void; - /** - * Setups the TSL when using fading. - * - * @private - * @return {ShaderCallNodeInternal} - */ - private _setupFade; - /** - * Setups the TSL when no fading (default). - * - * @private - * @return {ShaderCallNodeInternal} - */ - private _setupStandard; - build(builder: any): string | import("three/webgpu").Node | null; - setup(builder: any): any; - updateBefore(): void; -} -import { ShadowBaseNode } from 'three/webgpu'; -import { CSMFrustum } from './CSMFrustum.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts deleted file mode 100644 index 98cb8b3f6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/curves/CurveExtras.d.ts +++ /dev/null @@ -1,378 +0,0 @@ -/** - * A bunch of parametric curves - * - * Formulas collected from various sources - * http://mathworld.wolfram.com/HeartCurve.html - * http://en.wikipedia.org/wiki/Viviani%27s_curve - * http://www.mi.sanu.ac.rs/vismath/taylorapril2011/Taylor.pdf - * https://prideout.net/blog/old/blog/index.html@p=44.html - */ -/** - * A Granny Knot curve. - * - * @augments Curve - * @three_import import { GrannyKnot } from 'three/addons/curves/CurveExtras.js'; - */ -export class GrannyKnot extends Curve { - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A heart curve. - * - * @augments Curve - * @three_import import { HeartCurve } from 'three/addons/curves/CurveExtras.js'; - */ -export class HeartCurve extends Curve { - /** - * Constructs a new heart curve. - * - * @param {number} [scale=5] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 5 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Viviani curve. - * - * @augments Curve - * @three_import import { VivianiCurve } from 'three/addons/curves/CurveExtras.js'; - */ -export class VivianiCurve extends Curve { - /** - * Constructs a new Viviani curve. - * - * @param {number} [scale=70] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 70 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A knot curve. - * - * @augments Curve - * @three_import import { KnotCurve } from 'three/addons/curves/CurveExtras.js'; - */ -export class KnotCurve extends Curve { - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A helix curve. - * - * @augments Curve - * @three_import import { HelixCurve } from 'three/addons/curves/CurveExtras.js'; - */ -export class HelixCurve extends Curve { - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Trefoil Knot. - * - * @augments Curve - * @three_import import { TrefoilKnot } from 'three/addons/curves/CurveExtras.js'; - */ -export class TrefoilKnot extends Curve { - /** - * Constructs a new Trefoil Knot. - * - * @param {number} [scale=10] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 10 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A torus knot. - * - * @augments Curve - * @three_import import { TorusKnot } from 'three/addons/curves/CurveExtras.js'; - */ -export class TorusKnot extends Curve { - /** - * Constructs a new torus knot. - * - * @param {number} [scale=10] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 10 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Cinquefoil Knot. - * - * @augments Curve - * @three_import import { CinquefoilKnot } from 'three/addons/curves/CurveExtras.js'; - */ -export class CinquefoilKnot extends Curve { - /** - * Constructs a new Cinquefoil Knot. - * - * @param {number} [scale=10] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 10 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Trefoil Polynomial Knot. - * - * @augments Curve - * @three_import import { TrefoilPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; - */ -export class TrefoilPolynomialKnot extends Curve { - /** - * Constructs a new Trefoil Polynomial Knot. - * - * @param {number} [scale=10] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 10 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Figure Eight Polynomial Knot. - * - * @augments Curve - * @three_import import { FigureEightPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; - */ -export class FigureEightPolynomialKnot extends Curve { - /** - * Constructs a new Figure Eight Polynomial Knot. - * - * @param {number} [scale=1] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 1 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Decorated Torus Knot 4a. - * - * @augments Curve - * @three_import import { DecoratedTorusKnot4a } from 'three/addons/curves/CurveExtras.js'; - */ -export class DecoratedTorusKnot4a extends Curve { - /** - * Constructs a new Decorated Torus Knot 4a. - * - * @param {number} [scale=1] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 40 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Decorated Torus Knot 4b. - * - * @augments Curve - * @three_import import { DecoratedTorusKnot4b } from 'three/addons/curves/CurveExtras.js'; - */ -export class DecoratedTorusKnot4b extends Curve { - /** - * Constructs a new Decorated Torus Knot 4b. - * - * @param {number} [scale=1] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 40 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Decorated Torus Knot 5a. - * - * @augments Curve - * @three_import import { DecoratedTorusKnot5a } from 'three/addons/curves/CurveExtras.js'; - */ -export class DecoratedTorusKnot5a extends Curve { - /** - * Constructs a new Decorated Torus Knot 5a. - * - * @param {number} [scale=1] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 40 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -/** - * A Decorated Torus Knot 5c. - * - * @augments Curve - * @three_import import { DecoratedTorusKnot5c } from 'three/addons/curves/CurveExtras.js'; - */ -export class DecoratedTorusKnot5c extends Curve { - /** - * Constructs a new Decorated Torus Knot 5c. - * - * @param {number} [scale=1] - The curve's scale. - */ - constructor(scale?: number); - /** - * The curve's scale. - * - * @type {number} - * @default 40 - */ - scale: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; -} -import { Curve } from 'three'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts deleted file mode 100644 index 3a2af704a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSCurve.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * This class represents a NURBS curve. - * - * Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. - * - * @augments Curve - * @three_import import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js'; - */ -export class NURBSCurve extends Curve { - /** - * Constructs a new NURBS curve. - * - * @param {number} degree - The NURBS degree. - * @param {Array} knots - The knots as a flat array of numbers. - * @param {Array} controlPoints - An array holding control points. - * @param {number} [startKnot] - Index of the start knot into the `knots` array. - * @param {number} [endKnot] - Index of the end knot into the `knots` array. - */ - constructor(degree: number, knots: Array, controlPoints: Array, startKnot?: number, endKnot?: number); - /** - * The NURBS degree. - * - * @type {number} - */ - degree: number; - /** - * The knots as a flat array of numbers. - * - * @type {Array} - */ - knots: Array; - /** - * An array of control points. - * - * @type {Array} - */ - controlPoints: Array; - /** - * Index of the start knot into the `knots` array. - * - * @type {number} - */ - startKnot: number; - /** - * Index of the end knot into the `knots` array. - * - * @type {number} - */ - endKnot: number; - /** - * This method returns a vector in 3D space for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; - /** - * Returns a unit vector tangent for the given interpolation factor. - * - * @param {number} t - The interpolation factor. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The tangent vector. - */ - getTangent(t: number, optionalTarget?: Vector3): Vector3; - fromJSON(json: any): this; -} -import { Curve } from 'three'; -import { Vector4 } from 'three'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts deleted file mode 100644 index f55a5954a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSSurface.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * This class represents a NURBS surface. - * - * Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. - * - * @three_import import { NURBSSurface } from 'three/addons/curves/NURBSSurface.js'; - */ -export class NURBSSurface { - /** - * Constructs a new NURBS surface. - * - * @param {number} degree1 - The first NURBS degree. - * @param {number} degree2 - The second NURBS degree. - * @param {Array} knots1 - The first knots as a flat array of numbers. - * @param {Array} knots2 - The second knots as a flat array of numbers. - * @param {Array>} controlPoints - An array^2 holding control points. - */ - constructor(degree1: number, degree2: number, knots1: Array, knots2: Array, controlPoints: Array>); - /** - * The first NURBS degree. - * - * @type {number} - */ - degree1: number; - /** - * The second NURBS degree. - * - * @type {number} - */ - degree2: number; - /** - * The first knots as a flat array of numbers. - * - * @type {Array} - */ - knots1: Array; - /** - * The second knots as a flat array of numbers. - * - * @type {Array} - */ - knots2: Array; - /** - * An array holding arrays of control points. - * - * @type {Array>} - */ - controlPoints: Array>; - /** - * This method returns a vector in 3D space for the given interpolation factor. This vector lies on the NURBS surface. - * - * @param {number} t1 - The first interpolation factor representing the `u` position on the surface. Must be in the range `[0,1]`. - * @param {number} t2 - The second interpolation factor representing the `v` position on the surface. Must be in the range `[0,1]`. - * @param {Vector3} target - The target vector the result is written to. - */ - getPoint(t1: number, t2: number, target: Vector3): void; -} -import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts deleted file mode 100644 index 94b6a50e5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSUtils.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @module NURBSUtils - * @three_import import * as NURBSUtils from 'three/addons/curves/NURBSUtils.js'; - */ -/** - * Finds knot vector span. - * - * @param {number} p - The degree. - * @param {number} u - The parametric value. - * @param {Array} U - The knot vector. - * @return {number} The span. - */ -export function findSpan(p: number, u: number, U: Array): number; -/** - * Calculates basis functions. See The NURBS Book, page 70, algorithm A2.2. - * - * @param {number} span - The span in which `u` lies. - * @param {number} u - The parametric value. - * @param {number} p - The degree. - * @param {Array} U - The knot vector. - * @return {Array} Array[p+1] with basis functions values. - */ -export function calcBasisFunctions(span: number, u: number, p: number, U: Array): Array; -/** - * Calculates B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1. - * - * @param {number} p - The degree of the B-Spline. - * @param {Array} U - The knot vector. - * @param {Array} P - The control points - * @param {number} u - The parametric point. - * @return {Vector4} The point for given `u`. - */ -export function calcBSplinePoint(p: number, U: Array, P: Array, u: number): Vector4; -/** - * Calculates basis functions derivatives. See The NURBS Book, page 72, algorithm A2.3. - * - * @param {number} span - The span in which `u` lies. - * @param {number} u - The parametric point. - * @param {number} p - The degree. - * @param {number} n - number of derivatives to calculate - * @param {Array} U - The knot vector. - * @return {Array>} An array[n+1][p+1] with basis functions derivatives. - */ -export function calcBasisFunctionDerivatives(span: number, u: number, p: number, n: number, U: Array): Array>; -/** - * Calculates derivatives of a B-Spline. See The NURBS Book, page 93, algorithm A3.2. - * - * @param {number} p - The degree. - * @param {Array} U - The knot vector. - * @param {Array} P - The control points - * @param {number} u - The parametric point. - * @param {number} nd - The number of derivatives. - * @return {Array} An array[d+1] with derivatives. - */ -export function calcBSplineDerivatives(p: number, U: Array, P: Array, u: number, nd: number): Array; -/** - * Calculates "K over I". - * - * @param {number} k - The K value. - * @param {number} i - The I value. - * @return {number} k!/(i!(k-i)!) - */ -export function calcKoverI(k: number, i: number): number; -/** - * Calculates derivatives (0-nd) of rational curve. See The NURBS Book, page 127, algorithm A4.2. - * - * @param {Array} Pders - Array with derivatives. - * @return {Array} An array with derivatives for rational curve. - */ -export function calcRationalCurveDerivatives(Pders: Array): Array; -/** - * Calculates NURBS curve derivatives. See The NURBS Book, page 127, algorithm A4.2. - * - * @param {number} p - The degree. - * @param {Array} U - The knot vector. - * @param {Array} P - The control points in homogeneous space. - * @param {number} u - The parametric point. - * @param {number} nd - The number of derivatives. - * @return {Array} array with derivatives for rational curve. - */ -export function calcNURBSDerivatives(p: number, U: Array, P: Array, u: number, nd: number): Array; -/** - * Calculates a rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3. - * - * @param {number} p - The first degree of B-Spline surface. - * @param {number} q - The second degree of B-Spline surface. - * @param {Array} U - The first knot vector. - * @param {Array} V - The second knot vector. - * @param {Array>} P - The control points in homogeneous space. - * @param {number} u - The first parametric point. - * @param {number} v - The second parametric point. - * @param {Vector3} target - The target vector. - */ -export function calcSurfacePoint(p: number, q: number, U: Array, V: Array, P: Array>, u: number, v: number, target: Vector3): void; -/** - * Calculates a rational B-Spline volume point. See The NURBS Book, page 134, algorithm A4.3. - * - * @param {number} p - The first degree of B-Spline surface. - * @param {number} q - The second degree of B-Spline surface. - * @param {number} r - The third degree of B-Spline surface. - * @param {Array} U - The first knot vector. - * @param {Array} V - The second knot vector. - * @param {Array} W - The third knot vector. - * @param {Array>>} P - The control points in homogeneous space. - * @param {number} u - The first parametric point. - * @param {number} v - The second parametric point. - * @param {number} w - The third parametric point. - * @param {Vector3} target - The target vector. - */ -export function calcVolumePoint(p: number, q: number, r: number, U: Array, V: Array, W: Array, P: Array>>, u: number, v: number, w: number, target: Vector3): void; -import { Vector4 } from 'three'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts b/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts deleted file mode 100644 index a0ca96016..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/curves/NURBSVolume.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This class represents a NURBS volume. - * - * Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. - * - * @three_import import { NURBSVolume } from 'three/addons/curves/NURBSVolume.js'; - */ -export class NURBSVolume { - /** - * Constructs a new NURBS surface. - * - * @param {number} degree1 - The first NURBS degree. - * @param {number} degree2 - The second NURBS degree. - * @param {number} degree3 - The third NURBS degree. - * @param {Array} knots1 - The first knots as a flat array of numbers. - * @param {Array} knots2 - The second knots as a flat array of numbers. - * @param {Array} knots3 - The third knots as a flat array of numbers. - * @param {Array>>} controlPoints - An array^3 holding control points. - */ - constructor(degree1: number, degree2: number, degree3: number, knots1: Array, knots2: Array, knots3: Array, controlPoints: Array>>); - degree1: number; - degree2: number; - degree3: number; - knots1: number[]; - knots2: number[]; - knots3: number[]; - controlPoints: never[][]; - /** - * This method returns a vector in 3D space for the given interpolation factor. This vector lies within the NURBS volume. - * - * @param {number} t1 - The first interpolation factor representing the `u` position within the volume. Must be in the range `[0,1]`. - * @param {number} t2 - The second interpolation factor representing the `v` position within the volume. Must be in the range `[0,1]`. - * @param {number} t3 - The third interpolation factor representing the `w` position within the volume. Must be in the range `[0,1]`. - * @param {Vector3} target - The target vector the result is written to. - */ - getPoint(t1: number, t2: number, t3: number, target: Vector3): void; -} -import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts deleted file mode 100644 index 5b7946284..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/effects/AnaglyphEffect.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * A class that creates an anaglyph effect using physically-correct - * off-axis stereo projection. - * - * This implementation uses CameraUtils.frameCorners() to align stereo - * camera frustums to a virtual screen plane, providing accurate depth - * perception with zero parallax at the plane distance. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link AnaglyphPassNode}. - * - * @three_import import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js'; - */ -export class AnaglyphEffect { - /** - * Constructs a new anaglyph effect. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {number} width - The width of the effect in physical pixels. - * @param {number} height - The height of the effect in physical pixels. - */ - constructor(renderer: WebGLRenderer, width?: number, height?: number); - colorMatrixLeft: Matrix3; - colorMatrixRight: Matrix3; - /** - * The interpupillary distance (eye separation) in world units. - * Typical human IPD is 0.064 meters (64mm). - * - * @type {number} - * @default 0.064 - */ - eyeSep: number; - /** - * The distance in world units from the viewer to the virtual - * screen plane where zero parallax (screen depth) occurs. - * Objects at this distance appear at the screen surface. - * Objects closer appear in front of the screen (negative parallax). - * Objects further appear behind the screen (positive parallax). - * - * The screen dimensions are derived from the camera's FOV and aspect ratio - * at this distance, ensuring the stereo view matches the camera's field of view. - * - * @type {number} - * @default 0.5 - */ - planeDistance: number; - /** - * Resizes the effect. - * - * @param {number} width - The width of the effect in logical pixels. - * @param {number} height - The height of the effect in logical pixels. - */ - setSize: (width: number, height: number) => void; - /** - * When using this effect, this method should be called instead of the - * default {@link WebGLRenderer#render}. - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * Frees internal resources. This method should be called - * when the effect is no longer required. - */ - dispose: () => void; -} -import { Matrix3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts deleted file mode 100644 index 2da2a39de..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/effects/AsciiEffect.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * ~Options - */ -export type AsciiEffect = { - /** - * - A higher value leads to more details. - */ - resolution?: number | undefined; - /** - * - The scale of the effect. - */ - scale?: number | undefined; - /** - * - Whether colors should be enabled or not. Better quality but slows down rendering. - */ - color?: boolean | undefined; - /** - * - Whether transparency should be enabled or not. - */ - alpha?: boolean | undefined; - /** - * - Whether blocked characters should be enabled or not. - */ - block?: boolean | undefined; - /** - * - Whether colors should be inverted or not. - */ - invert?: boolean | undefined; - /** - * - The string resolution. - */ - strResolution?: "high" | "low" | "medium" | undefined; -}; -/** - * A class that creates an ASCII effect. - * - * The ASCII generation is based on [jsascii](https://github.com/hassadee/jsascii/blob/master/jsascii.js). - * - * @three_import import { AsciiEffect } from 'three/addons/effects/AsciiEffect.js'; - */ -export class AsciiEffect { - /** - * Constructs a new ASCII effect. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {string} [charSet=' .:-=+*#%@'] - The char set. - * @param {AsciiEffect~Options} [options] - The configuration parameter. - */ - constructor(renderer: WebGLRenderer, charSet?: string, options?: {}); - /** - * Resizes the effect. - * - * @param {number} w - The width of the effect in logical pixels. - * @param {number} h - The height of the effect in logical pixels. - */ - setSize: (w: number, h: number) => void; - /** - * When using this effect, this method should be called instead of the - * default {@link WebGLRenderer#render}. - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * The DOM element of the effect. This element must be used instead of the - * default {@link WebGLRenderer#domElement}. - * - * @type {HTMLDivElement} - */ - domElement: HTMLDivElement; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts deleted file mode 100644 index 1d5312135..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/effects/OutlineEffect.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * ~Options - */ -export type OutlineEffect = { - /** - * - The outline thickness. - */ - defaultThickness?: number | undefined; - /** - * - The outline color. - */ - defaultColor?: number[] | undefined; - /** - * - The outline alpha value. - */ - defaultAlpha?: number | undefined; - /** - * - Whether to keep alive cached internal materials or not. - */ - defaultKeepAlive?: boolean | undefined; -}; -/** - * An outline effect for toon shaders. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link ToonOutlinePassNode}. - * - * ```js - * const effect = new OutlineEffect( renderer ); - * - * function render() { - * - * effect.render( scene, camera ); - * - * } - * ``` - * - * @three_import import { OutlineEffect } from 'three/addons/effects/OutlineEffect.js'; - */ -export class OutlineEffect { - /** - * Constructs a new outline effect. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {OutlineEffect~Options} [parameters] - The configuration parameter. - */ - constructor(renderer: WebGLRenderer, parameters?: {}); - enabled: boolean; - /** - * When using this effect, this method should be called instead of the - * default {@link WebGLRenderer#render}. - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * This method can be used to render outlines in VR. - * - * ```js - * const effect = new OutlineEffect( renderer ); - * let renderingOutline = false; - * - * scene.onAfterRender = function () { - * - * if ( renderingOutline ) return; - * - * renderingOutline = true; - * effect.renderOutline( scene, camera ); - * renderingOutline = false; - * }; - * - * function render() { - * renderer.render( scene, camera ); - * } - * ``` - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - renderOutline: (scene: Object3D, camera: Camera) => void; - /** - * Resizes the effect. - * - * @param {number} width - The width of the effect in logical pixels. - * @param {number} height - The height of the effect in logical pixels. - */ - setSize: (width: number, height: number) => void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts deleted file mode 100644 index 7fc021f50..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/effects/ParallaxBarrierEffect.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A class that creates an parallax barrier effect. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link ParallaxBarrierPassNode}. - * - * @three_import import { ParallaxBarrierEffect } from 'three/addons/effects/ParallaxBarrierEffect.js'; - */ -export class ParallaxBarrierEffect { - /** - * Constructs a new parallax barrier effect. - * - * @param {WebGLRenderer} renderer - The renderer. - */ - constructor(renderer: WebGLRenderer); - /** - * Resizes the effect. - * - * @param {number} width - The width of the effect in logical pixels. - * @param {number} height - The height of the effect in logical pixels. - */ - setSize: (width: number, height: number) => void; - /** - * When using this effect, this method should be called instead of the - * default {@link WebGLRenderer#render}. - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * Frees internal resources. This method should be called - * when the effect is no longer required. - */ - dispose: () => void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts b/jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts deleted file mode 100644 index b76fcfce7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/effects/StereoEffect.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * A class that creates an stereo effect. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link StereoPassNode}. - * - * @three_import import { StereoEffect } from 'three/addons/effects/StereoEffect.js'; - */ -export class StereoEffect { - /** - * Constructs a new stereo effect. - * - * @param {WebGLRenderer} renderer - The renderer. - */ - constructor(renderer: WebGLRenderer); - /** - * Sets the given eye separation. - * - * @param {number} eyeSep - The eye separation to set. - */ - setEyeSeparation: (eyeSep: number) => void; - /** - * Resizes the effect. - * - * @param {number} width - The width of the effect in logical pixels. - * @param {number} height - The height of the effect in logical pixels. - */ - setSize: (width: number, height: number) => void; - /** - * When using this effect, this method should be called instead of the - * default {@link WebGLRenderer#render}. - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts deleted file mode 100644 index 55febdcd8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/environments/ColorEnvironment.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This class represents a scene with a uniform color that can be used as - * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents - * uniform ambient lighting and can be used for Image Based Lighting by - * assigning it to {@link Scene#environment}. - * - * ```js - * const environment = new ColorEnvironment( 0x00ff00 ); - * const pmremGenerator = new THREE.PMREMGenerator( renderer ); - * - * const envMap = pmremGenerator.fromScene( environment ).texture; - * scene.environment = envMap; - * ``` - * - * @augments Scene - * @three_import import { ColorEnvironment } from 'three/addons/environments/ColorEnvironment.js'; - */ -export class ColorEnvironment extends Scene { - /** - * Constructs a new color environment. - * - * @param {number|Color} color - The color of the environment. - */ - constructor(color?: number | Color); -} -import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts deleted file mode 100644 index 6b78297f3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/environments/DebugEnvironment.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This class represents a scene with a very basic room setup that can be used as - * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's - * lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment} - * or directly as an environment map to PBR materials. - * - * This class uses a simple room setup and should only be used for development purposes. - * A more appropriate setup for production is {@link RoomEnvironment}. - * - * ```js - * const environment = new DebugEnvironment(); - * const pmremGenerator = new THREE.PMREMGenerator( renderer ); - * - * const envMap = pmremGenerator.fromScene( environment ).texture; - * scene.environment = envMap; - * ``` - * - * @augments Scene - * @three_import import { DebugEnvironment } from 'three/addons/environments/DebugEnvironment.js'; - */ -export class DebugEnvironment extends Scene { -} -import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts deleted file mode 100644 index dae7d7c67..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/environments/RoomEnvironment.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This class represents a scene with a basic room setup that can be used as - * input for {@link PMREMGenerator#fromScene}. The resulting PMREM represents the room's - * lighting and can be used for Image Based Lighting by assigning it to {@link Scene#environment} - * or directly as an environment map to PBR materials. - * - * The implementation is based on the [EnvironmentScene](https://github.com/google/model-viewer/blob/master/packages/model-viewer/src/three-components/EnvironmentScene.ts) - * component from the `model-viewer` project. - * - * ```js - * const environment = new RoomEnvironment(); - * const pmremGenerator = new THREE.PMREMGenerator( renderer ); - * - * const envMap = pmremGenerator.fromScene( environment ).texture; - * scene.environment = envMap; - * ``` - * - * @augments Scene - * @three_import import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - */ -export class RoomEnvironment extends Scene { -} -import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts deleted file mode 100644 index 05a373538..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/DRACOExporter.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * ~Options - */ -export type DRACOExporter = { - /** - * - Indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality). - */ - decodeSpeed?: number | undefined; - /** - * - Indicates how to tune the encoder parameters (0 gives better speed but worst quality). - */ - encodeSpeed?: number | undefined; - /** - * - Either sequential (very little compression) or Edgebreaker. Edgebreaker traverses the triangles of the mesh in a deterministic, spiral-like way which provides most of the benefits of this data format. - */ - encoderMethod?: number | undefined; - /** - * - Indicates the precision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC). - */ - quantization?: number[] | undefined; - /** - * - Whether to export UVs or not. - */ - exportUvs?: boolean | undefined; - /** - * - Whether to export normals or not. - */ - exportNormals?: boolean | undefined; - /** - * - Whether to export colors or not. - */ - exportColor?: boolean | undefined; -}; -/** - * An exporter to compress geometry with the Draco library. - * - * [Draco](https://google.github.io/draco/) is an open source library for compressing and - * decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller, - * at the cost of additional decoding time on the client device. - * - * Standalone Draco files have a `.drc` extension, and contain vertex positions, - * normals, colors, and other attributes. Draco files *do not* contain materials, - * textures, animation, or node hierarchies – to use these features, embed Draco geometry - * inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file - * using [glTF-Pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline). - * - * The exporter requires the Draco encoder to be loaded as a global script in advance: - * - * ```html - * - * ``` - * - * ```js - * const exporter = new DRACOExporter(); - * const data = await exporter.parseAsync( mesh, options ); - * ``` - * - * @three_import import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js'; - */ -export class DRACOExporter { - /** - * Parses the given mesh or point cloud and generates the Draco output. - * - * @async - * @param {(Mesh|Points)} object - The mesh or point cloud to export. - * @param {DRACOExporter~Options} options - The export options. - * @return {Promise} A Promise that resolves with the exported Draco. - */ - parseAsync(object: (Mesh | Points), options?: {}): Promise; - /** - * @deprecated Use {@link DRACOExporter#parseAsync} instead. - */ - parse(): void; -} -export namespace DRACOExporter { - let MESH_EDGEBREAKER_ENCODING: number; - let MESH_SEQUENTIAL_ENCODING: number; - let POINT_CLOUD: number; - let TRIANGULAR_MESH: number; - let INVALID: number; - let POSITION: number; - let NORMAL: number; - let COLOR: number; - let TEX_COORD: number; - let GENERIC: number; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts deleted file mode 100644 index 9bd21a485..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/EXRExporter.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * ~Options - */ -export type EXRExporter = { - /** - * - Output data type. - */ - type?: number | undefined; -}; -/** - * An exporter for EXR. - * - * EXR ( Extended Dynamic Range) is an [open format specification](https://github.com/AcademySoftwareFoundation/openexr) - * for professional-grade image storage format of the motion picture industry. The purpose of - * format is to accurately and efficiently represent high-dynamic-range scene-linear image data - * and associated metadata. The library is widely used in host application software where accuracy - * is critical, such as photorealistic rendering, texture access, image compositing, deep compositing, - * and DI. - * - * ```js - * const exporter = new EXRExporter(); - * const result = await exporter.parse( renderer, options ); - * ``` - * - * @three_import import { EXRExporter } from 'three/addons/exporters/EXRExporter.js'; - */ -export class EXRExporter { - /** - * This method has two variants. - * - * - When exporting a data texture, it receives two parameters. The texture and the exporter options. - * - When exporting a render target (e.g. a PMREM), it receives three parameters. The renderer, the - * render target and the exporter options. - * - * @async - * @param {(DataTexture|WebGPURenderer|WebGLRenderer)} arg1 - The data texture to export or a renderer. - * @param {(EXRExporter~Options|RenderTarget)} arg2 - The exporter options or a render target. - * @param {EXRExporter~Options} [arg3] - The exporter options. - * @return {Promise} A Promise that resolves with the exported EXR. - */ - parse(arg1: (DataTexture | WebGPURenderer | WebGLRenderer), arg2: any, arg3: any): Promise; -} -export const NO_COMPRESSION: 0; -export const ZIP_COMPRESSION: 3; -export const ZIPS_COMPRESSION: 2; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts deleted file mode 100644 index 00ab20b4f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/GLTFExporter.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * ~Options - */ -export type GLTFExporter = { - /** - * - Export position, rotation and scale instead of matrix per node. - */ - trs?: boolean | undefined; - /** - * - Export only visible 3D objects. - */ - onlyVisible?: boolean | undefined; - /** - * - Export in binary (.glb) format, returning an ArrayBuffer. - */ - binary?: boolean | undefined; - /** - * - Restricts the image maximum size (both width and height) to the given value. - */ - maxTextureSize?: number | undefined; - /** - * - List of animations to be included in the export. When exporting a single 3D object or scene, this is a flat list of clips. - * When exporting an array of multiple scenes, this must be a nested array with one list of clips per scene, matched to the input by index. - */ - animations?: AnimationClip[] | AnimationClip[][] | undefined; - /** - * - Export custom glTF extensions defined on an object's `userData.gltfExtensions` property. - */ - includeCustomExtensions?: boolean | undefined; - /** - * - Export with a copyright notice embedded in the glTF. - */ - copyright?: string | undefined; -}; -/** - * An exporter for `glTF` 2.0. - * - * glTF (GL Transmission Format) is an [open format specification](https://github.com/KhronosGroup/glTF/tree/master/specification/2.0) - * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) - * or binary (.glb) format. External files store textures (.jpg, .png) and additional binary - * data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials, - * textures, skins, skeletons, morph targets, animations, lights, and/or cameras. - * - * GLTFExporter supports the [glTF 2.0 extensions](https://github.com/KhronosGroup/glTF/tree/master/extensions/): - * - * - KHR_lights_punctual - * - KHR_materials_clearcoat - * - KHR_materials_dispersion - * - KHR_materials_emissive_strength - * - KHR_materials_ior - * - KHR_materials_iridescence - * - KHR_materials_specular - * - KHR_materials_sheen - * - KHR_materials_transmission - * - KHR_materials_unlit - * - KHR_materials_volume - * - KHR_mesh_quantization - * - KHR_texture_transform - * - EXT_materials_bump - * - EXT_mesh_gpu_instancing - * - EXT_texture_webp - * - * The following glTF 2.0 extension is supported by an external user plugin: - * - * - [KHR_materials_variants](https://github.com/takahirox/three-gltf-extensions) - * - * ```js - * const exporter = new GLTFExporter(); - * const data = await exporter.parseAsync( scene, options ); - * ``` - * - * @three_import import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js'; - */ -export class GLTFExporter { - /** - * A reference to a texture utils module. - * - * @type {?(WebGLTextureUtils|WebGPUTextureUtils)} - * @default null - */ - textureUtils: (WebGLTextureUtils | WebGPUTextureUtils) | null; - pluginCallbacks: any[]; - /** - * Registers a plugin callback. This API is internally used to implement the various - * glTF extensions but can also used by third-party code to add additional logic - * to the exporter. - * - * @param {function(writer:GLTFWriter)} callback - The callback function to register. - * @return {GLTFExporter} A reference to this exporter. - */ - register(callback: any): GLTFExporter; - /** - * Unregisters a plugin callback. - * - * @param {Function} callback - The callback function to unregister. - * @return {GLTFExporter} A reference to this exporter. - */ - unregister(callback: Function): GLTFExporter; - /** - * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported. - * - * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the - * corresponding texture utils {@link module:WebGLTextureUtils} or {@link module:WebGPUTextureUtils}. - * - * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils. - * @return {GLTFExporter} A reference to this exporter. - */ - setTextureUtils(utils: WebGLTextureUtils | WebGPUTextureUtils): GLTFExporter; - /** - * Parses the given scenes and generates the glTF output. - * - * @param {Scene|Array} input - A scene or an array of scenes. - * @param {GLTFExporter~OnDone} onDone - A callback function that is executed when the export has finished. - * @param {GLTFExporter~OnError} onError - A callback function that is executed when an error happens. - * @param {GLTFExporter~Options} options - options - */ - parse(input: Scene | Array, onDone: any, onError: any, options: any): void; - /** - * Async version of {@link GLTFExporter#parse}. - * - * @param {Scene|Array} input - A scene or an array of scenes. - * @param {GLTFExporter~Options} options - options. - * @return {Promise} A Promise that resolved with the exported glTF data. - */ - parseAsync(input: Scene | Array, options: any): Promise; -} -export namespace GLTFExporter { - namespace Utils { - function insertKeyframe(track: any, time: any): number | undefined; - function mergeMorphTargetTracks(clip: any, root: any): any; - function toTypedBufferAttribute(srcAttribute: any, TypedArray: any): BufferAttribute; - } -} -import { Scene } from 'three'; -import { BufferAttribute } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts deleted file mode 100644 index 3c5367230..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/KTX2Exporter.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * An exporter for KTX2. - * - * ```js - * const exporter = new KTX2Exporter(); - * const result = await exporter.parse( dataTexture ); - * ``` - * - * @three_import import { KTX2Exporter } from 'three/addons/exporters/KTX2Exporter.js'; - */ -export class KTX2Exporter { - /** - * This method has two variants. - * - * - When exporting a data texture, it receives one parameter. The data or 3D data texture. - * - When exporting a render target (e.g. a PMREM), it receives two parameters. The renderer and the - * render target. - * - * @async - * @param {(DataTexture|Data3DTexture|WebGPURenderer|WebGLRenderer)} arg1 - The data texture to export or a renderer. - * @param {RenderTarget} [arg2] - The render target that should be exported - * @return {Promise} A Promise that resolves with the exported KTX2. - */ - parse(arg1: (DataTexture | Data3DTexture | WebGPURenderer | WebGLRenderer), arg2?: RenderTarget): Promise; -} -import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts deleted file mode 100644 index ce14c5604..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/OBJExporter.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * An exporter for OBJ. - * - * `OBJExporter` is not able to export material data into MTL files so only geometry data are supported. - * - * ```js - * const exporter = new OBJExporter(); - * const data = exporter.parse( scene ); - * ``` - * - * @three_import import { OBJExporter } from 'three/addons/exporters/OBJExporter.js'; - */ -export class OBJExporter { - /** - * Parses the given 3D object and generates the OBJ output. - * - * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. - * - * @param {Object3D} object - The 3D object to export. - * @return {string} The exported OBJ. - */ - parse(object: Object3D): string; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts deleted file mode 100644 index 09942d1f4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/PLYExporter.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * ~Options - */ -export type PLYExporter = { - /** - * - Whether to export in binary format or ASCII. - */ - binary?: boolean | undefined; - /** - * - Which properties to explicitly exclude from - * the exported PLY file. Valid values are `'color'`, `'normal'`, `'uv'`, and `'index'`. If triangle - * indices are excluded, then a point cloud is exported. - */ - excludeAttributes?: string[] | undefined; - /** - * - Whether the binary export uses little or big endian. - */ - littleEndian?: boolean | undefined; - /** - * - A mapping that allows - * exporting custom buffer attributes as PLY vertex properties. Each entry maps a buffer attribute - * name to an array of PLY property names. The number of property names must match the item size - * of the buffer attribute. This is the inverse of `PLYLoader.setCustomPropertyNameMapping()`. - */ - customPropertyMapping?: { - [x: string]: string[]; - } | undefined; -}; -/** - * An exporter for PLY. - * - * PLY (Polygon or Stanford Triangle Format) is a file format for efficient delivery and - * loading of simple, static 3D content in a dense format. Both binary and ascii formats are - * supported. PLY can store vertex positions, colors, normals and uv coordinates. No textures - * or texture references are saved. - * - * ```js - * const exporter = new PLYExporter(); - * const data = exporter.parse( scene, options ); - * ``` - * - * @three_import import { PLYExporter } from 'three/addons/exporters/PLYExporter.js'; - */ -export class PLYExporter { - /** - * Parses the given 3D object and generates the PLY output. - * - * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. - * - * @param {Object3D} object - The 3D object to export. - * @param {PLYExporter~OnDone} onDone - A callback function that is executed when the export has finished. - * @param {PLYExporter~Options} options - The export options. - * @return {?(string|ArrayBuffer)} The exported PLY. - */ - parse(object: Object3D, onDone: any, options?: {}): (string | ArrayBuffer) | null; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts deleted file mode 100644 index e72db8c3d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/STLExporter.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * ~Options - */ -export type STLExporter = { - /** - * - Whether to export in binary format or ASCII. - */ - binary?: boolean | undefined; -}; -/** - * An exporter for STL. - * - * STL files describe only the surface geometry of a three-dimensional object without - * any representation of color, texture or other common model attributes. The STL format - * specifies both ASCII and binary representations, with binary being more compact. - * STL files contain no scale information or indexes, and the units are arbitrary. - * - * ```js - * const exporter = new STLExporter(); - * const data = exporter.parse( mesh, { binary: true } ); - * ``` - * - * @three_import import { STLExporter } from 'three/addons/exporters/STLExporter.js'; - */ -export class STLExporter { - /** - * Parses the given 3D object and generates the STL output. - * - * If the 3D object is composed of multiple children and geometry, they are merged into a single mesh in the file. - * - * @param {Object3D} scene - A scene, mesh or any other 3D object containing meshes to encode. - * @param {STLExporter~Options} options - The export options. - * @return {string|ArrayBuffer} The exported STL. - */ - parse(scene: Object3D, options?: {}): string | ArrayBuffer; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts deleted file mode 100644 index 33d54405c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/exporters/USDZExporter.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * ~Options - */ -export type USDZExporter = { - /** - * - The maximum texture size that is going to be exported. - */ - maxTextureSize?: number | undefined; - /** - * - Whether to include anchoring properties or not. - */ - includeAnchoringProperties?: boolean | undefined; - /** - * - Export only visible 3D objects. - */ - onlyVisible?: boolean | undefined; - /** - * - If `includeAnchoringProperties` is set to `true`, the anchoring type and alignment - * can be configured via `ar.anchoring.type` and `ar.planeAnchoring.alignment`. - */ - ar?: Object | undefined; - /** - * - Whether to make the exported USDZ compatible to QuickLook - * which means the asset is modified to accommodate the bugs FB10036297 and FB11442287 (Apple Feedback). - */ - quickLookCompatible?: boolean | undefined; - /** - * - Animation clips to bake into `xformOp` time samples on the - * targeted objects. Only `position`, `quaternion`, and `scale` tracks are exported. - */ - animations?: AnimationClip[] | undefined; - /** - * - Time codes per second used when writing animation samples. - */ - animationFrameRate?: number | undefined; -}; -/** - * An exporter for USDZ. - * - * ```js - * const exporter = new USDZExporter(); - * const arraybuffer = await exporter.parseAsync( scene ); - * ``` - * - * @three_import import { USDZExporter } from 'three/addons/exporters/USDZExporter.js'; - */ -export class USDZExporter { - /** - * A reference to a texture utils module. - * - * @type {?(WebGLTextureUtils|WebGPUTextureUtils)} - * @default null - */ - textureUtils: (WebGLTextureUtils | WebGPUTextureUtils) | null; - /** - * Sets the texture utils for this exporter. Only relevant when compressed textures have to be exported. - * - * Depending on whether you use {@link WebGLRenderer} or {@link WebGPURenderer}, you must inject the - * corresponding texture utils {@link module:WebGLTextureUtils} or {@link module:WebGPUTextureUtils}. - * - * @param {WebGLTextureUtils|WebGPUTextureUtils} utils - The texture utils. - */ - setTextureUtils(utils: WebGLTextureUtils | WebGPUTextureUtils): void; - /** - * Parse the given 3D object and generates the USDZ output. - * - * @param {Object3D} scene - The 3D object to export. - * @param {USDZExporter~OnDone} onDone - A callback function that is executed when the export has finished. - * @param {USDZExporter~OnError} onError - A callback function that is executed when an error happens. - * @param {USDZExporter~Options} options - The export options. - */ - parse(scene: Object3D, onDone: any, onError: any, options: any): void; - /** - * Async version of {@link USDZExporter#parse}. - * - * @async - * @param {Object3D} scene - The 3D object to export. - * @param {USDZExporter~Options} options - The export options. - * @return {Promise} A Promise that resolved with the exported USDZ data. - */ - parseAsync(scene: Object3D, options?: {}): Promise; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts deleted file mode 100644 index baf210642..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/generators/CityGenerator.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Lays out a grid of city blocks and fills each lot with a {@link SkyscraperGenerator} - * tower of its own seed, height and footprint, optionally on raised sidewalk - * slabs (curbs). Returns a `THREE.Group` ready to add to a scene. - * - * Pass a building material to dress the towers; the sidewalks dress themselves - * via {@link SidewalkGenerator}. The layout is exposed as - * {@link CityGenerator#layout} so the surrounding scene (road markings, etc.) - * can align to the same grid. - * - * ```js - * const city = new CityGenerator( { seed: 1 } ); - * scene.add( city.build( materials ) ); - * ``` - */ -export class CityGenerator { - constructor(parameters?: {}); - parameters: { - seed: number; - street: number; - lot: number; - lotsX: number; - lotsZ: number; - blocksX: number; - blocksZ: number; - curbHeight: number; - curbRadius: number; - }; - layout: { - street: any; - lot: any; - lotsX: any; - lotsZ: any; - blocksX: any; - blocksZ: any; - blockW: number; - blockD: number; - cityW: number; - cityD: number; - }; - generators: any[]; - sidewalk: SidewalkGenerator; - group: Group | null; - build(materials?: {}): Group; - dispose(): void; -} -export namespace CityGenerator { - namespace defaults { - let seed: number; - let street: number; - let lot: number; - let lotsX: number; - let lotsZ: number; - let blocksX: number; - let blocksZ: number; - let curbHeight: number; - let curbRadius: number; - } -} -/** - * The shared material every tower in a {@link CityGenerator} is dressed with: one flat - * masonry colour per lot, picked from a palette by hashing the lot's grid cell. - */ -export function createBuildingMaterial(layout: any, seed?: number): MeshStandardNodeMaterial; -/** - * The road surface: wet asphalt with lane lines and crosswalks aligned to a - * {@link CityGenerator} layout. Apply it to a ground plane sized to the city. - */ -export function createRoadMaterial(layout: any): MeshStandardNodeMaterial; -import { SidewalkGenerator } from './city/SidewalkGenerator.js'; -import { Group } from 'three'; -import { MeshStandardNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts deleted file mode 100644 index 4b2772243..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/generators/ForestGenerator.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Carpets a {@link TerrainGenerator} ( or anything exposing `sampleHeight`, - * `sampleSlope`, `minY`, `maxY` and `parameters.size` ) with a forest of hundreds - * of thousands of trees in a single draw call. - * - * Each tree is the cheapest thing that still reads as a tree: a ~20-face icosphere - * squashed into a tapered teardrop and lumped with a little noise, carrying a baked - * dark-base / bright-top gradient. Tens of triangles each, so a single - * {@link THREE.InstancedMesh} of half a million of them costs one draw call. Trees - * are placed by rejection sampling against ecological rules — a min/max altitude - * band ( above the mist floor, below the snowline ), a slope limit ( none on - * cliffs ) and a low-frequency density mask that opens clearings — then jittered in - * yaw, lean and ( squared-biased ) scale so the stand never reads as copies. - * - * ```js - * const forest = new ForestGenerator( { count: 500000 } ); - * scene.add( forest.build( terrain ) ); - * ``` - */ -export class ForestGenerator { - constructor(parameters?: {}); - parameters: { - seed: number; - count: number; - detail: number; - radius: number; - height: number; - distortion: number; - sink: number; - altitudeMin: number; - altitudeMax: number; - minSlope: number; - densityFrequency: number; - minScale: number; - maxScale: number; - from: number; - to: number; - castShadow: boolean; - }; - from: import("three/webgpu").UniformNode; - to: import("three/webgpu").UniformNode; - _cameraPosition: import("three/webgpu").UniformNode; - material: MeshStandardNodeMaterial; - mesh: InstancedMesh | null; - group: Group | null; - build(terrain: any): Group; - setCameraPosition(position: any): void; - dispose(): void; -} -export namespace ForestGenerator { - namespace defaults { - let seed: number; - let count: number; - let detail: number; - let radius: number; - let height: number; - let distortion: number; - let sink: number; - let altitudeMin: number; - let altitudeMax: number; - let minSlope: number; - let densityFrequency: number; - let minScale: number; - let maxScale: number; - let from: number; - let to: number; - let castShadow: boolean; - } -} -/** - * The single material shared by every tree in a {@link ForestGenerator}. A plain - * MeshStandardNodeMaterial lit by the scene — only the surface is authored: deep - * shadowed green in the recesses rising to a bright, yellow-green sunlit crown, - * mottled into needle clumps by 3D noise, with a matching bump so the clumps catch - * the light. Half a million instanced blobs makes this mesh vertex-bound, so the - * regional colour drift is baked to a per-instance attribute ( no shader noise for it ), - * and the costly clump noise + bump are **gated by distance** — full detail on the near - * trees ( where it reads ), skipped on the far canopy ( where it is sub-pixel ). - * - * @param {Node} from - distance within which every tree is drawn. - * @param {Node} to - distance past which no tree is drawn. - * @return {MeshStandardNodeMaterial} - */ -export function createForestMaterial(from: Node, to: Node, camPos: any): MeshStandardNodeMaterial; -import { MeshStandardNodeMaterial } from 'three/webgpu'; -import { InstancedMesh } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts deleted file mode 100644 index a5b279bf6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/generators/TerrainGenerator.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Bakes a procedural mountain range into a single {@link THREE.BufferGeometry} and - * returns a `THREE.Group` ready to add to a scene. - * - * The heightfield is a derivative-damped fractal sum ( Quilez's fake erosion ): each - * octave is suppressed where the running slope is already steep, concentrating detail - * into weathered ridgelines, and a low-frequency domain warp makes those ridges - * meander. A few passes of thermal ( talus ) erosion then relax any slope past the - * angle of repose, settling the fractal's needle-spikes into real crests. - * - * The grid is triangulated with alternating quad diagonals ( a diamond pattern ), so a - * coarse mesh holds its silhouette without a one-way grain. The surface shades itself - * from altitude and slope in TSL — grass, forest, rock, scree and snow, with detail - * normals and aerial perspective — so no material or textures are needed. - * - * The baked height grid is exposed through {@link TerrainGenerator#sampleHeight} so a - * scattered forest ( or anything else ) can sit exactly on the surface. - * - * ```js - * const terrain = new TerrainGenerator( { seed: 1 } ); - * scene.add( terrain.build() ); - * ``` - */ -export class TerrainGenerator { - constructor(parameters?: {}); - parameters: { - seed: number; - size: number; - segments: number; - heightScale: number; - frequency: number; - octaves: number; - lacunarity: number; - gain: number; - erosion: number; - warp: number; - valleyBias: number; - seaLevel: number; - talus: number; - talusPasses: number; - }; - minHeight: import("three/webgpu").UniformNode; - maxHeight: import("three/webgpu").UniformNode; - material: MeshStandardNodeMaterial; - geometry: BufferGeometry | null; - group: Group | null; - build(): Group; - heights: Float32Array | undefined; - gridSize: number | undefined; - minY: number | undefined; - maxY: number | undefined; - sampleHeight(x: any, z: any): number; - sampleSlope(x: any, z: any): number; - dispose(): void; -} -export namespace TerrainGenerator { - namespace defaults { - let seed: number; - let size: number; - let segments: number; - let heightScale: number; - let frequency: number; - let octaves: number; - let lacunarity: number; - let gain: number; - let erosion: number; - let warp: number; - let valleyBias: number; - let seaLevel: number; - let talus: number; - let talusPasses: number; - } -} -import { MeshStandardNodeMaterial } from 'three/webgpu'; -import { BufferGeometry } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts deleted file mode 100644 index 48708c301..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/generators/TreeGenerator.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Grows a procedural tree skeleton — trunk, branches and twigs, each swept as a tapered - * tube — and bakes it into one non-indexed {@link BufferGeometry} (position and normal - * only), ready to instance into a forest. It produces *branches only*; add foliage as a - * separate layer. - * - * The branching is deterministic for a given `seed`: a recursive sweep lays down gently - * curved tubes with a parallel-transport frame (so they never twist), forking by the - * pipe model (each child much thinner than its parent), spreading children along the - * upper part of each branch with a golden-angle roll, and pulling them back up toward - * the light. A flared root, non-linear taper and gravity droop fill in the character. - * - * Parameters are set with a fluent builder: a `set()` exists for every default - * ( `setSeed`, `setLevels`, `setChildren`, … ), each returning `this` for chaining. - * - * Each `build()` returns a fresh, independent mesh that the caller owns, so one - * generator can be re-parametrized and built repeatedly to grow a varied stand: - * - * ```js - * const generator = new TreeGenerator( material ); - * const oak = generator.setSeed( 1 ).setLevels( 4 ).build(); - * const pine = generator.setSeed( 2 ).setLevels( 5 ).build(); - * ``` - */ -export class TreeGenerator { - constructor(material?: null); - material: any; - parameters: {}; - build(): Mesh; -} -export namespace TreeGenerator { - namespace defaults { - let seed: number; - let levels: number; - let children: number[]; - let branchAngle: number[]; - let angleVariance: number; - let lengthRatio: number; - let trunkLength: number; - let trunkRadius: number; - let taper: number; - let taperCurve: number; - let rootFlare: number; - let flareFrac: number; - let radiusExponent: number; - let minRadius: number; - let minLength: number; - let droop: number; - let upPull: number; - let gnarl: number[]; - let radialSegments: number; - let sectionLength: number; - let childStart: number; - let trunkClear: number; - } -} -/** - * A simple bark material for a {@link TreeGenerator} mesh: a low-saturation brown with a - * faint, vertically-stretched grain, so trunks read near-black against bright fog. - * - * @param {Object} [parameters] - `barkColor` ( a hex, THREE.Color or TSL node ). - * @return {MeshStandardNodeMaterial} - */ -export function createTreeMaterial(parameters?: Object): MeshStandardNodeMaterial; -import { Mesh } from 'three'; -import { MeshStandardNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts deleted file mode 100644 index 81c1a0ec9..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/generators/city/SidewalkGenerator.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Generates the raised sidewalk for a city's blocks: per block, a rounded-corner concrete - * slab rimmed by a distinct granite kerbstone that stands proud of the walking surface and - * drops to the road. Instanced across a list of placements and dressed with its own - * procedural material ( poured concrete flags, scored expansion joints, granite curb ). - * Returns a `THREE.Group` of two instanced meshes — the walking slab and the curb. - * - * Unlike the building generator, this one owns its materials: the slab and curb - * geometry and the TSL that shades them live together here. - * - * ```js - * const sidewalk = new SidewalkGenerator( { width: 90, depth: 60, height: 0.5 } ); - * scene.add( sidewalk.build( placements ) ); // placements: Matrix4[] - * ``` - */ -export class SidewalkGenerator { - constructor(parameters?: {}); - parameters: { - width: number; - depth: number; - height: number; - radius: number; - curbWidth: number; - curbLip: number; - }; - material: MeshStandardNodeMaterial | null; - curbMaterial: MeshStandardNodeMaterial | null; - mesh: Group | null; - build(placements: any): Group; - dispose(): void; -} -export namespace SidewalkGenerator { - namespace defaults { - let width: number; - let depth: number; - let height: number; - let radius: number; - let curbWidth: number; - let curbLip: number; - } -} -import { MeshStandardNodeMaterial } from 'three/webgpu'; -import { Group } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts deleted file mode 100644 index cfca639f0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/generators/city/SkyscraperGenerator.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Generates intricate, tripartite "Beaux-Arts / Neo-Gothic" terracotta - * skyscrapers from a small set of parameters. - * - * The mass is read as a footprint polygon (a rectangle with one chamfered - * corner) split into vertical faces, each split into three tiers — a tall - * arcaded base, a repeating shaft and an ornate crown — then into floors and - * bays. A handful of authored pieces (a pier, a window, a cornice profile, a - * gothic arch) are instanced across the whole tower, then baked — together with - * the bespoke base arcade — into a single non-indexed BufferGeometry tagged with - * a per-vertex `partId` ({@link PartId}) so one material can shade every zone. - * - * The generator is material agnostic — it only produces geometry. Pass a single - * material (e.g. a TSL node material that branches on `partId`) to dress it. - * - * ```js - * const generator = new SkyscraperGenerator( { seed: 35, totalHeight: 140 }, material ); - * scene.add( generator.build() ); // a single Mesh - * ``` - */ -export class SkyscraperGenerator { - constructor(parameters?: {}, material?: null); - parameters: {}; - material: any; - mesh: Mesh | null; - setParameters(parameters: any): this; - build(): Mesh; - rebuild(): Mesh; - dispose(): void; -} -export namespace SkyscraperGenerator { - namespace defaults { - let seed: number; - let totalHeight: number; - let floorHeight: number; - let bayWidth: number; - let stringCourseEvery: number; - let chamferWidth: number; - let chamferCornerX: number; - let chamferCornerZ: number; - let setbackDepth: number; - let acChance: number; - } -} -/** - * The facade material: a single MeshStandardNodeMaterial that reads the baked - * per-vertex `partId` and reproduces every zone — procedural terracotta brickwork - * on the walls and piers, smooth dressed stone on the window frames and ornament, - * dark glazing, and grey AC units — all dressed with world-space - * weathering. One material covers the whole building ( and a whole city ), which is - * what makes it compute-rasterizer friendly. `buildingBase` is the tower's flat - * masonry colour as a TSL node: pass a `uniform( Color )` for a single tower, or a - * per-fragment palette pick for a city, so the same material dresses both. - */ -export function createSkyscraperMaterial(buildingBase?: any): MeshStandardNodeMaterial; -/** - * The NYC masonry palette every tower is dressed from ( hex colours ): limestone-dominant - * with terracotta accents. Shared by the single-tower example and {@link CityGenerator}'s - * building material so both stay in sync. - */ -export const buildingPalette: number[]; -/** Picks one {@link buildingPalette} colour ( a hex number ) for a tower from its seed. */ -export function pickBuildingColor(seed: any): number; -import { Mesh } from 'three'; -import { MeshStandardNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts deleted file mode 100644 index 12c45383b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/BoxLineGeometry.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * A special type of box geometry intended for {@link LineSegments}. - * - * ```js - * const geometry = new BoxLineGeometry(); - * const material = new THREE.LineBasicMaterial( { color: 0x00ff00 } ); - * const lines = new THREE.LineSegments( geometry, material ); - * scene.add( lines ); - * ``` - * - * @augments BufferGeometry - * @three_import import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; - */ -export class BoxLineGeometry extends BufferGeometry { - /** - * Constructs a new box line geometry. - * - * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis. - * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis. - * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis. - * @param {number} [widthSegments=1] - Number of segmented rectangular sections along the width of the sides. - * @param {number} [heightSegments=1] - Number of segmented rectangular sections along the height of the sides. - * @param {number} [depthSegments=1] - Number of segmented rectangular sections along the depth of the sides. - */ - constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts deleted file mode 100644 index e5e6dacf7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/ConvexGeometry.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This class can be used to generate a convex hull for a given array of 3D points. - * The average time complexity for this task is considered to be O(nlog(n)). - * - * ```js - * const geometry = new ConvexGeometry( points ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * ``` - * - * @augments BufferGeometry - * @three_import import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js'; - */ -export class ConvexGeometry extends BufferGeometry { - /** - * Constructs a new convex geometry. - * - * @param {Array} points - An array of points in 3D space which should be enclosed by the convex hull. - */ - constructor(points?: Array); -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts deleted file mode 100644 index 382bd6e37..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/DecalGeometry.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This class can be used to create a decal mesh that serves different kinds of purposes e.g. - * adding unique details to models, performing dynamic visual environmental changes or covering seams. - * - * Please not that decal projections can be distorted when used around corners. More information at - * this GitHub issue: [Decal projections without distortions](https://github.com/mrdoob/three.js/issues/21187). - * - * Reference: [How to project decals](http://blog.wolfire.com/2009/06/how-to-project-decals/) - * - * ```js - * const geometry = new DecalGeometry( mesh, position, orientation, size ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * ``` - * - * @augments BufferGeometry - * @three_import import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js'; - */ -export class DecalGeometry extends BufferGeometry { - /** - * Constructs a new decal geometry. - * - * @param {Mesh} [mesh] - The base mesh the decal should be projected on. - * @param {Vector3} [position] - The position of the decal projector. - * @param {Euler} [orientation] - The orientation of the decal projector. - * @param {Vector3} [size] - The scale of the decal projector. - */ - constructor(mesh?: Mesh, position?: Vector3, orientation?: Euler, size?: Vector3); -} -export class DecalVertex { - constructor(position: any, normal?: null); - position: any; - normal: any; - clone(): any; -} -import { BufferGeometry } from 'three'; -import { Mesh } from 'three'; -import { Vector3 } from 'three'; -import { Euler } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts deleted file mode 100644 index 1e007e460..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/LoftGeometry.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This class can be used to generate a geometry by lofting (skinning) a surface - * through a series of cross sections. Each section is an array of points in 3D - * space and all sections must have the same number of points. - * - * `LoftGeometry` is the general case of geometries like {@link LatheGeometry} - * (which revolves a fixed profile around an axis) or {@link TubeGeometry} - * (which sweeps a circular section along a path): the sections can have any - * shape, and can change shape, size, position and orientation from one - * section to the next. - * - * Sections wind around the loft so the resulting face normals point outwards - * when each section is ordered counterclockwise as seen from the end of the - * loft, looking back towards the start. If the surface appears inside out, - * reverse the point order of each section. - * - * ```js - * const sections = []; - * - * for ( let i = 0; i <= 10; i ++ ) { - * - * const points = []; - * const radius = 2 + Math.sin( i * 0.8 ); - * - * for ( let j = 0; j < 32; j ++ ) { - * - * const angle = j / 32 * Math.PI * 2; - * points.push( new THREE.Vector3( Math.sin( angle ) * radius, i, Math.cos( angle ) * radius ) ); - * - * } - * - * sections.push( points ); - * - * } - * - * const geometry = new LoftGeometry( sections, { capStart: true, capEnd: true } ); - * const material = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ); - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * ``` - * - * @augments BufferGeometry - * @three_import import { LoftGeometry } from 'three/addons/geometries/LoftGeometry.js'; - */ -export class LoftGeometry extends BufferGeometry { - /** - * Constructs a new loft geometry. - * - * @param {Array>} sections - The cross sections to skin. At least - * two sections are required and all sections must have the same number of points. - * @param {Object} [options={}] - The loft options. - * @param {boolean} [options.closed=true] - Whether each section is treated as a - * closed ring (e.g. a fuselage) or an open strip (e.g. a ribbon). - * @param {boolean} [options.capStart=false] - Whether the first section is closed - * with a cap or not. - * @param {boolean} [options.capEnd=false] - Whether the last section is closed - * with a cap or not. - */ - constructor(sections?: Array>, options?: { - closed?: boolean | undefined; - capStart?: boolean | undefined; - capEnd?: boolean | undefined; - }); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from 'three'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts deleted file mode 100644 index db21efb1c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricFunctions.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @module ParametricFunctions - * @three_import import * as ParametricFunctions from 'three/addons/geometries/ParametricFunctions.js'; - */ -/** - * A parametric function representing the Klein bottle. - * - * @param {number} v - The `v` coordinate on the surface in the range `[0,1]`. - * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. - * @param {Vector3} target - The target vector that is used to store the method's result. - */ -export function klein(v: number, u: number, target: Vector3): void; -/** - * A parametric function representing a flat plane. - * - * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. - * @param {number} v - The `v` coordinate on the surface in the range `[0,1]`. - * @param {Vector3} target - The target vector that is used to store the method's result. - */ -export function plane(u: number, v: number, target: Vector3): void; -/** - * A parametric function representing a flat mobius strip. - * - * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. - * @param {number} t - The `v` coordinate on the surface in the range `[0,1]`. - * @param {Vector3} target - The target vector that is used to store the method's result. - */ -export function mobius(u: number, t: number, target: Vector3): void; -/** - * A parametric function representing a volumetric mobius strip. - * - * @param {number} u - The `u` coordinate on the surface in the range `[0,1]`. - * @param {number} t - The `v` coordinate on the surface in the range `[0,1]`. - * @param {Vector3} target - The target vector that is used to store the method's result. - */ -export function mobius3d(u: number, t: number, target: Vector3): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts deleted file mode 100644 index dbf4ca6a3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/ParametricGeometry.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * ~Func - */ -export type ParametricGeometry = (u: number, v: number, target: Vector3) => any; -import { Vector3 } from 'three'; -/** - * This class can be used to generate a geometry based on a parametric surface. - * - * Reference: [Mesh Generation with Python](https://prideout.net/blog/old/blog/index.html@p=44.html) - * - * ```js - * const geometry = new ParametricGeometry( klein, 25, 25 ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const klein = new THREE.Mesh( geometry, material ); - * scene.add( klein ); - * ``` - * - * @augments BufferGeometry - * @three_import import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; - */ -export class ParametricGeometry extends BufferGeometry { - /** - * Constructs a new parametric geometry. - * - * @param {ParametricGeometry~Func} func - The parametric function. Default is a function that generates a curved plane surface. - * @param {number} [slices=8] - The number of slices to use for the parametric function. - * @param {number} [stacks=8] - The stacks of slices to use for the parametric function. - */ - constructor(func?: (u: any, v: any, target: any) => any, slices?: number, stacks?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts deleted file mode 100644 index 75c6ccace..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/RoundedBoxGeometry.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * A special type of box geometry with rounded corners and edges. - * - * ```js - * const geometry = new RoundedBoxGeometry(); - * const material = new THREE.MeshStandardMaterial( { color: 0x00ff00 } ); - * const cube = new THREE.Mesh( geometry, material ); - * scene.add( cube ); - * ``` - * - * @augments BoxGeometry - * @three_import import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; - */ -export class RoundedBoxGeometry extends BoxGeometry { - /** - * Constructs a new rounded box geometry. - * - * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis. - * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis. - * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis. - * @param {number} [segments=2] - Number of segments that form the rounded corners. - * @param {number} [radius=0.1] - The radius of the rounded corners. - */ - constructor(width?: number, height?: number, depth?: number, segments?: number, radius?: number); -} -import { BoxGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts deleted file mode 100644 index f555f1a36..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/TeapotGeometry.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Tessellates the famous Utah teapot database by Martin Newell into triangles. - * - * The teapot should normally be rendered as a double sided object, since for some - * patches both sides can be seen, e.g., the gap around the lid and inside the spout. - * - * Segments 'n' determines the number of triangles output. Total triangles = 32*2*n*n - 8*n - * (degenerates at the top and bottom cusps are deleted). - * - * Code based on [SPD software](http://tog.acm.org/resources/SPD/) - * Created for the Udacity course [Interactive Rendering](http://bit.ly/ericity) - * - * ```js - * const geometry = new TeapotGeometry( 50, 18 ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const teapot = new THREE.Mesh( geometry, material ); - * scene.add( teapot ); - * ``` - * - * @augments BufferGeometry - * @three_import import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - */ -export class TeapotGeometry extends BufferGeometry { - /** - * Constructs a new teapot geometry. - * - * @param {number} [size=50] - Relative scale of the teapot. - * @param {number} [segments=10] - Number of line segments to subdivide each patch edge. - * @param {boolean} [bottom=true] - Whether the bottom of the teapot is generated or not. - * @param {boolean} [lid=true] - Whether the lid is generated or not. - * @param {boolean} [body=true] - Whether the body is generated or not. - * @param {boolean} [fitLid=true] - Whether the lid is slightly stretched to prevent gaps between the body and lid or not. - * @param {boolean} [blinn=true] - Whether the teapot is scaled vertically for better aesthetics or not. - */ - constructor(size?: number, segments?: number, bottom?: boolean, lid?: boolean, body?: boolean, fitLid?: boolean, blinn?: boolean); -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts deleted file mode 100644 index 70f1d0791..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/geometries/TextGeometry.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * ~Options - */ -export type TextGeometry = { - /** - * - The font. - */ - font?: Font | undefined; - /** - * - The text size. - */ - size?: number | undefined; - /** - * - Depth to extrude the shape. - */ - depth?: number | undefined; - /** - * - Number of points on the curves. - */ - curveSegments?: number | undefined; - /** - * - Number of points used for subdividing segments along the depth of the extruded spline. - */ - steps?: number | undefined; - /** - * - Whether to beveling to the shape or not. - */ - bevelEnabled?: boolean | undefined; - /** - * - How deep into the original shape the bevel goes. - */ - bevelThickness?: number | undefined; - /** - * - Distance from the shape outline that the bevel extends. - */ - bevelSize?: number | undefined; - /** - * - Distance from the shape outline that the bevel starts. - */ - bevelOffset?: number | undefined; - /** - * - Number of bevel layers. - */ - bevelSegments?: number | undefined; - /** - * - Char direction: ltr(left to right), rtl(right to left) & tb(top bottom). - */ - direction?: string | undefined; - /** - * - A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion. - */ - extrudePath?: Curve | null; - /** - * - An object that provides UV generator functions for custom UV generation. - */ - UVGenerator?: Object | undefined; -}; -import { Font } from '../loaders/FontLoader.js'; -/** - * A class for generating text as a single geometry. It is constructed by providing a string of text, and a set of - * parameters consisting of a loaded font and extrude settings. - * - * See the {@link FontLoader} page for additional details. - * - * `TextGeometry` uses [typeface.json](http://gero3.github.io/facetype.js/) generated fonts. - * Some existing fonts can be found located in `/examples/fonts`. - * - * ```js - * const loader = new FontLoader(); - * const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' ); - * const geometry = new TextGeometry( 'Hello three.js!', { - * font: font, - * size: 80, - * depth: 5, - * curveSegments: 12 - * } ); - * ``` - * - * @augments ExtrudeGeometry - * @three_import import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - */ -export class TextGeometry extends ExtrudeGeometry { - static fromJSON(data: any): TextGeometry; - /** - * Constructs a new text geometry. - * - * @param {string} text - The text that should be transformed into a geometry. - * @param {TextGeometry~Options} [parameters] - The text settings. - */ - constructor(text: string, parameters?: {}); -} -import { ExtrudeGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts b/jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts deleted file mode 100644 index 8115e72d5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/gpgpu/BitonicSort.d.ts +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Returns the indices that will be compared in a bitonic flip operation. - * - * @tsl - * @private - * @param {Node} index - The compute thread's invocation id. - * @param {Node} blockHeight - The height of the block within which elements are being swapped. - * @returns {Node} The indices of the elements in the data buffer being compared. - */ -export const getBitonicFlipIndices: any; -/** - * Returns the indices that will be compared in a bitonic sort's disperse operation. - * - * @tsl - * @private - * @param {Node} index - The compute thread's invocation id. - * @param {Node} swapSpan - The maximum span over which elements are being swapped. - * @returns {Node} The indices of the elements in the data buffer being compared. - */ -export const getBitonicDisperseIndices: any; -export class BitonicSort { - /** - * Constructs a new light probe helper. - * - * @param {Renderer} renderer - The current scene's renderer. - * @param {StorageBufferNode} dataBuffer - The data buffer to sort. - * @param {Object} [options={}] - Options that modify the bitonic sort. - */ - constructor(renderer: Renderer, dataBuffer: StorageBufferNode, options?: Object); - /** - * A reference to the renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * A reference to the StorageBufferNode holding the data that will be sorted . - * - * @type {StorageBufferNode} - */ - dataBuffer: StorageBufferNode; - /** - * The size of the data. - * - * @type {StorageBufferNode} - */ - count: StorageBufferNode; - /** - * - * The size of each compute dispatch. - * @type {number} - */ - dispatchSize: number; - /** - * The workgroup size of the compute shaders executed during the sort. - * - * @type {StorageBufferNode} - */ - workgroupSize: StorageBufferNode; - /** - * A node representing a workgroup scoped buffer that holds locally sorted elements. - * - * @type {WorkgroupInfoNode} - */ - localStorage: WorkgroupInfoNode; - _tempArray: Uint32Array; - /** - * A node representing a storage buffer used for transferring the result of the global sort back to the original data buffer. - * - * @type {StorageBufferNode} - */ - tempBuffer: StorageBufferNode; - /** - * A node containing the current algorithm type, the current swap span, and the highest swap span. - * - * @type {StorageBufferNode} - */ - infoStorage: StorageBufferNode; - /** - * The number of distinct swap operations ('flips' and 'disperses') executed in an in-place - * bitonic sort of the current data buffer. - * - * @type {number} - */ - swapOpCount: number; - /** - * The number of steps (i.e prepping and/or executing a swap) needed to fully execute an in-place bitonic sort of the current data buffer. - * - * @type {number} - */ - stepCount: number; - /** - * The number of the buffer being read from. - * - * @type {string} - */ - readBufferName: string; - /** - * An object containing compute shaders that execute a 'flip' swap within a global address space on elements in the data buffer. - * - * @type {Object} - */ - flipGlobalNodes: { - [x: string]: ComputeNode; - }; - /** - * An object containing compute shaders that execute a 'disperse' swap within a global address space on elements in the data buffer. - * - * @type {Object} - */ - disperseGlobalNodes: { - [x: string]: ComputeNode; - }; - /** - * A compute shader that executes a sequence of flip and disperse swaps within a local address space on elements in the data buffer. - * - * @type {ComputeNode} - */ - swapLocalFn: ComputeNode; - /** - * A compute shader that executes a sequence of disperse swaps within a local address space on elements in the data buffer. - * - * @type {Object} - */ - disperseLocalNodes: { - [x: string]: ComputeNode; - }; - /** - * A compute shader that sets up the algorithm and the swap span for the next swap operation. - * - * @type {ComputeNode} - */ - setAlgoFn: ComputeNode; - /** - * A compute shader that aligns the result of the global swap operation with the current buffer. - * - * @type {ComputeNode} - */ - alignFn: ComputeNode; - /** - * A compute shader that resets the algorithm and swap span information. - * - * @type {ComputeNode} - */ - resetFn: ComputeNode; - /** - * The current compute shader dispatch within the list of dispatches needed to complete the sort. - * - * @type {number} - */ - currentDispatch: number; - /** - * The number of global swap operations that must be executed before the sort - * can swap in local address space. - * - * @type {number} - */ - globalOpsRemaining: number; - /** - * The total number of global operations needed to sort elements within the current swap span. - * - * @type {number} - */ - globalOpsInSpan: number; - /** - * Get total number of distinct swaps that occur in a bitonic sort. - * - * @private - * @returns {number} - The total number of distinct swaps in a bitonic sort - */ - private _getSwapOpCount; - /** - * Get the number of steps it takes to execute a complete bitonic sort. - * - * @private - * @returns {number} The number of steps it takes to execute a complete bitonic sort. - */ - private _getStepCount; - /** - * Compares and swaps two data points in the data buffer within the global address space. - * @param {Node} idxBefore - The index of the first data element in the data buffer. - * @param {Node} idxAfter - The index of the second data element in the data buffer. - * @param {StorageBufferNode} dataBuffer - The buffer of data to read from. - * @param {StorageBufferNode} tempBuffer - The buffer of data to write to. - * @private - * - */ - private _globalCompareAndSwapTSL; - /** - * Compares and swaps two data points in the data buffer within the local address space. - * - * @private - * @param {Node} idxBefore - The index of the first data element in the data buffer. - * @param {Node} idxAfter - The index of the second data element in the data buffer - */ - private _localCompareAndSwapTSL; - /** - * Create the compute shader that performs a global disperse swap on the data buffer. - * - * @private - * @param {StorageBufferNode} readBuffer - The data buffer to read from. - * @param {StorageBufferNode} writeBuffer - The data buffer to read from. - * @returns {ComputeNode} - A compute shader that performs a global disperse swap on the data buffer. - */ - private _getDisperseGlobal; - /** - * Create the compute shader that performs a global flip swap on the data buffer. - * - * @private - * @param {StorageBufferNode} readBuffer - The data buffer to read from. - * @param {StorageBufferNode} writeBuffer - The data buffer to read from. - * @returns {ComputeNode} - A compute shader that executes a global flip swap. - */ - private _getFlipGlobal; - /** - * Create the compute shader that performs a complete local swap on the data buffer. - * - * @private - * @returns {ComputeNode} - A compute shader that executes a full local swap. - */ - private _getSwapLocal; - /** - * Create the compute shader that performs a local disperse swap on the data buffer. - * - * @private - * @param {StorageBufferNode} readWriteBuffer - The data buffer to read from and write to. - * @returns {ComputeNode} - A compute shader that executes a local disperse swap. - */ - private _getDisperseLocal; - /** - * Create the compute shader that resets the sort's algorithm information. - * - * @private - * @returns {ComputeNode} - A compute shader that resets the bitonic sort's algorithm information. - */ - private _getResetFn; - /** - * Create the compute shader that copies the state of the last global swap to the data buffer. - * - * @private - * @returns {ComputeNode} - A compute shader that copies the state of the last global swap to the data buffer. - */ - private _getAlignFn; - /** - * Create the compute shader that sets the bitonic sort algorithm's information. - * - * @private - * @returns {ComputeNode} - A compute shader that sets the bitonic sort algorithm's information. - */ - private _getSetAlgoFn; - /** - * Executes a step of the bitonic sort operation. - * - * @param {Renderer} renderer - The current scene's renderer. - */ - computeStep(renderer: Renderer): void; - /** - * Executes a complete bitonic sort on the data buffer. - * - * @param {Renderer} renderer - The current scene's renderer. - */ - compute(renderer: Renderer): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts b/jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts deleted file mode 100644 index d2c1974c6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/gpgpu/CountingSort.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * A reusable GPU counting sort. - * - * This computes a stable-ish permutation of the integers `[0, count)` that orders them by an - * arbitrary, user supplied `uint` key ("bin") in the range `[0, binCount)`. It is a good fit for - * approximate ordering of large element counts (hundreds of thousands to millions) where an exact - * comparison sort such as a bitonic sort (see {@link BitonicSort}) would be too slow: a counting - * sort only requires a fixed number of passes (reset, histogram, prefix sum, scatter) regardless of - * `count`, at the cost of only being accurate to the resolution of `binCount` - elements that land - * in the same bin end up in an unspecified relative order. - * - * This class does not compute the sort key itself. Instead, a TSL function is supplied via - * {@link CountingSort#setBinNode} that maps the current `instanceIndex` to a bin, and an equivalent - * plain JavaScript function can be supplied to {@link CountingSort#computeCPU} for platforms without - * compute shader support (e.g. the WebGL backend of {@link WebGPURenderer}). - * - * ```js - * const sort = new CountingSort( count, { binCount: 4096 } ); - * sort.setBinNode( () => { - * - * // return a `Node` bin index for `instanceIndex`, e.g. derived from a depth value. - * - * } ); - * - * sort.compute( renderer ); - * - * // `sort.orderRead` now holds a storage buffer of `count` indices, ordered by bin. - * ``` - * - * @three_import import { CountingSort } from 'three/addons/gpgpu/CountingSort.js'; - */ -export class CountingSort { - /** - * Constructs a new counting sort. - * - * @param {number} count - The number of elements to sort. - * @param {Object} [options={}] - Options that modify the counting sort. - * @param {number} [options.binCount=4096] - The number of bins/buckets the sort key is quantized into. Larger values improve sort accuracy at the cost of a longer (but still single-pass) prefix sum. - * @param {number} [options.workgroupSize=256] - The workgroup size of the compute shaders executed during the sort. - */ - constructor(count: number, { binCount, workgroupSize }?: { - binCount?: number | undefined; - workgroupSize?: number | undefined; - }); - /** - * The number of elements to sort. - * - * @type {number} - */ - count: number; - /** - * The number of bins/buckets the sort key is quantized into. - * - * @type {number} - */ - binCount: number; - /** - * The workgroup size of the compute shaders executed during the sort. - * - * @type {number} - */ - workgroupSize: number; - /** - * The buffer attribute holding the sorted order (a permutation of `[0, count)`). This is - * also the attribute that is kept up to date by {@link CountingSort#computeCPU}. - * - * @type {StorageBufferAttribute} - */ - orderAttribute: StorageBufferAttribute; - /** - * A read-only storage node for the sorted order buffer. - * - * @type {StorageBufferNode} - */ - orderRead: StorageBufferNode; - /** - * A writable storage node for the sorted order buffer. - * - * @type {StorageBufferNode} - */ - orderWrite: StorageBufferNode; - /** - * A read-only storage node holding each element's bin, computed during the histogram pass. - * - * @type {StorageBufferNode} - */ - binRead: StorageBufferNode; - /** - * A writable storage node holding each element's bin. - * - * @type {StorageBufferNode} - */ - binWrite: StorageBufferNode; - /** - * An atomic storage node used to accumulate the per-bin histogram. - * - * @type {StorageBufferNode} - */ - histogramAtomic: StorageBufferNode; - /** - * An atomic storage node used both for the exclusive prefix sum of the histogram and, during - * the scatter pass, as a per-bin write cursor. - * - * @type {StorageBufferNode} - */ - offsetAtomic: StorageBufferNode; - _webGLBuffersEnabled: boolean; - _cpuBins: Uint32Array; - _cpuCounts: Uint32Array; - _cpuOffsets: Uint32Array; - _resetNode: any; - _histogramNode: any; - _prefixNode: any; - _scatterNode: any; - /** - * Sets the TSL function used to compute the bin of the element currently referenced by - * `instanceIndex`, and (re)builds the compute nodes used by {@link CountingSort#compute}. - * - * @param {Function} binNode - A parameterless function returning a `Node` in `[0, binCount)`. - */ - setBinNode(binNode: Function): void; - /** - * Executes a complete counting sort on the GPU, updating {@link CountingSort#orderRead}. - * - * @param {Renderer} renderer - The current scene's renderer. - */ - compute(renderer: Renderer): void; - /** - * Executes a complete counting sort on the CPU, updating {@link CountingSort#orderAttribute}. - * Intended as a fallback for backends without compute shader support. - * - * @param {Function} binFn - A function taking an element index and returning its bin (a plain number in `[0, binCount)`). - */ - computeCPU(binFn: Function): void; - /** - * Enables the WebGL-specific storage buffer path (PBO + dynamic draw usage) for the order buffer. - * Only needed when {@link CountingSort#computeCPU} is used with the WebGL backend of {@link WebGPURenderer}. - */ - enableWebGLBuffers(): void; -} -import { StorageBufferAttribute } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts deleted file mode 100644 index acab0752f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/AnimationPathHelper.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Visualizes the motion path of an animated object based on position keyframes - * from an AnimationClip. - * - * ```js - * const clip = model.animations[ 0 ]; - * const helper = new AnimationPathHelper( model, clip, object ); - * scene.add( helper ); - * ``` - * - * @augments Object3D - * @three_import import { AnimationPathHelper } from 'three/addons/helpers/AnimationPathHelper.js'; - */ -export class AnimationPathHelper extends Object3D { - /** - * Constructs a new animation path helper. - * - * @param {Object3D} root - The root object containing the animation clips. - * @param {AnimationClip} clip - The animation clip containing position keyframes. - * @param {Object3D} object - The specific object to show the path for. - * @param {Object} [options={}] - Configuration options. - * @param {number|Color|string} [options.color=0x00ff00] - The path line color. - * @param {number|Color|string} [options.markerColor=0xff0000] - The keyframe marker color. - * @param {number} [options.divisions=100] - Number of samples for smooth path interpolation. - * @param {boolean} [options.showMarkers=true] - Whether to show markers at keyframe positions. - * @param {number} [options.markerSize=5] - Size of keyframe markers in pixels. - */ - constructor(root: Object3D, clip: AnimationClip, object: Object3D, options?: { - color?: number | Color | string; - markerColor?: number | Color | string; - divisions?: number | undefined; - showMarkers?: boolean | undefined; - markerSize?: number | undefined; - }); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAnimationPathHelper: boolean; - type: string; - /** - * The root object containing the animation clips. - * - * @type {Object3D} - */ - root: Object3D; - /** - * The animation clip containing position keyframes. - * - * @type {AnimationClip} - */ - clip: AnimationClip; - /** - * The object whose path is being visualized. - * - * @type {Object3D} - */ - object: Object3D; - /** - * Number of samples for smooth path interpolation. - * - * @type {number} - * @default 100 - */ - divisions: number; - /** - * The position track for the object. - * - * @type {KeyframeTrack|null} - * @private - */ - private _track; - /** - * The line representing the animation path. - * - * @type {Line} - */ - line: Line; - /** - * Points marking keyframe positions. - * - * @type {Points|null} - */ - points: Points | null; - /** - * Finds the position track for the given object. - * - * @private - * @param {Object3D} object - The object to find the track for. - * @returns {KeyframeTrack|null} The position track, or null if not found. - */ - private _findTrackForObject; - /** - * Samples the track at regular intervals. - * - * @private - * @returns {Float32Array} Array of sampled positions. - */ - private _sampleTrack; - /** - * Updates the geometry with sampled path data. - * - * @private - */ - private _updateGeometry; - /** - * Updates the helper's transform to match the object's parent. - * - * @param {boolean} force - Force matrix update. - */ - updateMatrixWorld(force: boolean): void; - /** - * Sets the path line color. - * - * @param {number|Color|string} color - The new color. - */ - setColor(color: number | Color | string): void; - /** - * Sets the keyframe marker color. - * - * @param {number|Color|string} color - The new color. - */ - setMarkerColor(color: number | Color | string): void; -} -import { Object3D } from 'three'; -import { Line } from 'three'; -import { Points } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts deleted file mode 100644 index 1c84bfd19..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelper.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Visualizes a {@link LightProbeGrid} by rendering a sphere at each probe - * position, shaded with the probe's L2 spherical harmonics. Uses a single - * `InstancedMesh` draw call for all probes. - * - * This helper can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, import from `LightProbeGridHelperWebGL.js`. - * - * ```js - * const helper = new LightProbeGridHelper( probes ); - * scene.add( helper ); - * ``` - * - * @private - * @augments InstancedMesh - * @three_import import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; - */ -export class LightProbeGridHelper extends InstancedMesh { - /** - * Constructs a new irradiance probe grid helper. - * - * @param {LightProbeGrid} probes - The probe grid to visualize. - * @param {number} [sphereSize=0.12] - The radius of each probe sphere. - */ - constructor(probes: LightProbeGrid, sphereSize?: number); - /** - * The probe grid to visualize. - * - * @type {LightProbeGrid} - */ - probes: LightProbeGrid; - _atlas: any; - _resolution: import("three/webgpu").UniformNode; - /** - * Rebuilds instance matrices and UVW attributes from the current probe grid, - * and rebinds the shading node to its atlas. Call this after changing - * `probes` or after re-baking. - */ - update(): void; -} -import { InstancedMesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts deleted file mode 100644 index 53dce264a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeGridHelperWebGL.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Visualizes an {@link LightProbeGridWebGL} by rendering a sphere at each - * probe position, shaded with the probe's L2 spherical harmonics. - * - * Uses a single `InstancedMesh` draw call for all probes. - * - * ```js - * const helper = new LightProbeGridHelperWebGL( probes ); - * scene.add( helper ); - * ``` - * - * @augments InstancedMesh - * @three_import import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; - */ -export class LightProbeGridHelperWebGL extends InstancedMesh { - /** - * Constructs a new irradiance probe grid helper. - * - * @param {LightProbeGridWebGL} probes - The probe grid to visualize. - * @param {number} [sphereSize=0.12] - The radius of each probe sphere. - */ - constructor(probes: LightProbeGridWebGL, sphereSize?: number); - /** - * The probe grid to visualize. - * - * @type {LightProbeGridWebGL} - */ - probes: LightProbeGridWebGL; - /** - * Rebuilds instance matrices and UVW attributes from the current probe grid. - * Call this after changing `probes` or after re-baking. - */ - update(): void; -} -import { InstancedMesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts deleted file mode 100644 index e34f6b4d0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelper.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Renders a sphere to visualize a light probe in the scene. - * - * This helper can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, import from `LightProbeHelperGPU.js`. - * - * ```js - * const helper = new LightProbeHelper( lightProbe ); - * scene.add( helper ); - * ``` - * - * @augments Mesh - * @three_import import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; - */ -export class LightProbeHelper extends Mesh { - /** - * Constructs a new light probe helper. - * - * @param {LightProbe} lightProbe - The light probe to visualize. - * @param {number} [size=1] - The size of the helper. - */ - constructor(lightProbe: LightProbe, size?: number); - /** - * The light probe to visualize. - * - * @type {LightProbe} - */ - lightProbe: LightProbe; - /** - * The size of the helper. - * - * @type {number} - * @default 1 - */ - size: number; -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts deleted file mode 100644 index 7ecb5ec21..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/LightProbeHelperGPU.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Renders a sphere to visualize a light probe in the scene. - * - * This helper can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, import from `LightProbeHelper.js`. - * - * ```js - * const helper = new LightProbeHelper( lightProbe ); - * scene.add( helper ); - * ``` - * - * @private - * @augments Mesh - * @three_import import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js'; - */ -export class LightProbeHelper extends Mesh { - /** - * Constructs a new light probe helper. - * - * @param {LightProbe} lightProbe - The light probe to visualize. - * @param {number} [size=1] - The size of the helper. - */ - constructor(lightProbe: LightProbe, size?: number); - /** - * The light probe to visualize. - * - * @type {LightProbe} - */ - lightProbe: LightProbe; - /** - * The size of the helper. - * - * @type {number} - * @default 1 - */ - size: number; - _intensity: import("three/webgpu").UniformNode; - _sh: import("three/webgpu").UniformArrayNode; -} -import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts deleted file mode 100644 index 274120242..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/OctreeHelper.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * A helper for visualizing an Octree. - * - * ```js - * const helper = new OctreeHelper( octree ); - * scene.add( helper ); - * ``` - * - * @augments LineSegments - * @three_import import { OctreeHelper } from 'three/addons/helpers/OctreeHelper.js'; - */ -export class OctreeHelper extends LineSegments { - /** - * Constructs a new Octree helper. - * - * @param {Octree} octree - The octree to visualize. - * @param {number|Color|string} [color=0xffff00] - The helper's color. - */ - constructor(octree: Octree, color?: number | Color | string); - /** - * The octree to visualize. - * - * @type {Octree} - */ - octree: Octree; - /** - * The helper's color. - * - * @type {number|Color|string} - */ - color: number | Color | string; - /** - * Updates the helper. This method must be called whenever the Octree's - * structure is changed. - */ - update(): void; -} -import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts deleted file mode 100644 index cd81fe886..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/PositionalAudioHelper.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This helper displays the directional cone of a positional audio. - * - * `PositionalAudioHelper` must be added as a child of the positional audio. - * - * ```js - * const positionalAudio = new THREE.PositionalAudio( listener ); - * positionalAudio.setDirectionalCone( 180, 230, 0.1 ); - * scene.add( positionalAudio ); - * - * const helper = new PositionalAudioHelper( positionalAudio ); - * positionalAudio.add( helper ); - * ``` - * - * @augments Line - * @three_import import { PositionalAudioHelper } from 'three/addons/helpers/PositionalAudioHelper.js'; - */ -export class PositionalAudioHelper extends Line { - /** - * Constructs a new positional audio helper. - * - * @param {PositionalAudio} audio - The audio to visualize. - * @param {number} [range=1] - The range of the directional cone. - * @param {number} [divisionsInnerAngle=16] - The number of divisions of the inner part of the directional cone. - * @param {number} [divisionsOuterAngle=2] The number of divisions of the outer part of the directional cone. - */ - constructor(audio: PositionalAudio, range?: number, divisionsInnerAngle?: number, divisionsOuterAngle?: number); - /** - * The audio to visualize. - * - * @type {PositionalAudio} - */ - audio: PositionalAudio; - /** - * The range of the directional cone. - * - * @type {number} - * @default 1 - */ - range: number; - /** - * The number of divisions of the inner part of the directional cone. - * - * @type {number} - * @default 16 - */ - divisionsInnerAngle: number; - /** - * The number of divisions of the outer part of the directional cone. - * - * @type {number} - * @default 2 - */ - divisionsOuterAngle: number; - /** - * Updates the helper. This method must be called whenever the directional cone - * of the positional audio is changed. - */ - update(): void; -} -import { Line } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts deleted file mode 100644 index c7f78d4d4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/RapierHelper.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This class displays all Rapier Colliders in outline. - * - * @augments LineSegments - * @three_import import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; - */ -export class RapierHelper extends LineSegments { - /** - * Constructs a new Rapier debug helper. - * - * @param {RAPIER.world} world - The Rapier world to visualize. - */ - constructor(world: RAPIER.world); - /** - * The Rapier world to visualize. - * - * @type {RAPIER.world} - */ - world: RAPIER.world; - material: LineBasicMaterial; - /** - * Call this in the render loop to update the outlines. - */ - update(): void; -} -import { LineSegments } from 'three'; -import { LineBasicMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts deleted file mode 100644 index c5f28b95a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/RectAreaLightHelper.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Creates a visual aid for rect area lights. - * - * `RectAreaLightHelper` must be added as a child of the light. - * - * ```js - * const light = new THREE.RectAreaLight( 0xffffbb, 1.0, 5, 5 ); - * const helper = new RectAreaLightHelper( light ); - * light.add( helper ); - * ``` - * - * @augments Line - * @three_import import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; - */ -export class RectAreaLightHelper extends Line { - /** - * Constructs a new rect area light helper. - * - * @param {RectAreaLight} light - The light to visualize. - * @param {number|Color|string} [color] - The helper's color. - * If this is not the set, the helper will take the color of the light. - */ - constructor(light: RectAreaLight, color?: number | Color | string); - /** - * The light to visualize. - * - * @type {RectAreaLight} - */ - light: RectAreaLight; - /** - * The helper's color. If `undefined`, the helper will take the color of the light. - * - * @type {number|Color|string|undefined} - */ - color: number | Color | string | undefined; - updateMatrixWorld(): void; -} -import { Line } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts deleted file mode 100644 index 42e13839d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelper.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * A helper that can be used to display any type of texture for - * debugging purposes. Depending on the type of texture (2D, 3D, Array), - * the helper becomes a plane or box mesh. - * - * This helper can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, import from `TextureHelperGPU.js`. - * - * @augments Mesh - * @three_import import { TextureHelper } from 'three/addons/helpers/TextureHelper.js'; - */ -export class TextureHelper extends Mesh { - /** - * Constructs a new texture helper. - * - * @param {Texture} texture - The texture to visualize. - * @param {number} [width=1] - The helper's width. - * @param {number} [height=1] - The helper's height. - * @param {number} [depth=1] - The helper's depth. - */ - constructor(texture: Texture, width?: number, height?: number, depth?: number); - /** - * The texture to visualize. - * - * @type {Texture} - */ - texture: Texture; -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts deleted file mode 100644 index 0e9151974..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/TextureHelperGPU.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A helper that can be used to display any type of texture for - * debugging purposes. Depending on the type of texture (2D, 3D, Array), - * the helper becomes a plane or box mesh. - * - * This helper can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, import from `TextureHelper.js`. - * - * @private - * @augments Mesh - * @three_import import { TextureHelper } from 'three/addons/helpers/TextureHelperGPU.js'; - */ -export class TextureHelper extends Mesh { - /** - * Constructs a new texture helper. - * - * @param {Texture} texture - The texture to visualize. - * @param {number} [width=1] - The helper's width. - * @param {number} [height=1] - The helper's height. - * @param {number} [depth=1] - The helper's depth. - */ - constructor(texture: Texture, width?: number, height?: number, depth?: number); - /** - * The texture to visualize. - * - * @type {Texture} - */ - texture: Texture; -} -import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts deleted file mode 100644 index 7bd41d0b5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexNormalsHelper.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Visualizes an object's vertex normals. - * - * Requires that normals have been specified in the geometry as a buffer attribute or - * have been calculated using {@link BufferGeometry#computeVertexNormals}. - * ```js - * const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 ); - * const material = new THREE.MeshStandardMaterial(); - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * - * const helper = new VertexNormalsHelper( mesh, 1, 0xff0000 ); - * scene.add( helper ); - * ``` - * - * @augments LineSegments - * @three_import import { VertexNormalsHelper } from 'three/addons/helpers/VertexNormalsHelper.js'; - */ -export class VertexNormalsHelper extends LineSegments { - /** - * Constructs a new vertex normals helper. - * - * @param {Object3D} object - The object for which to visualize vertex normals. - * @param {number} [size=1] - The helper's size. - * @param {number|Color|string} [color=0xff0000] - The helper's color. - */ - constructor(object: Object3D, size?: number, color?: number | Color | string); - /** - * The object for which to visualize vertex normals. - * - * @type {Object3D} - */ - object: Object3D; - /** - * The helper's size. - * - * @type {number} - * @default 1 - */ - size: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVertexNormalsHelper: boolean; - /** - * Updates the vertex normals preview based on the object's world transform. - */ - update(): void; -} -import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts deleted file mode 100644 index 3fbf40dbc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/helpers/VertexTangentsHelper.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Visualizes an object's vertex tangents. - * - * Requires that tangents have been specified in the geometry as a buffer attribute or - * have been calculated using {@link BufferGeometry#computeTangents}. - * ```js - * const helper = new VertexTangentsHelper( mesh, 1, 0xff0000 ); - * scene.add( helper ); - * ``` - * - * @augments LineSegments - * @three_import import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js'; - */ -export class VertexTangentsHelper extends LineSegments { - /** - * Constructs a new vertex tangents helper. - * - * @param {Object3D} object - The object for which to visualize vertex tangents. - * @param {number} [size=1] - The helper's size. - * @param {number|Color|string} [color=0xff0000] - The helper's color. - */ - constructor(object: Object3D, size?: number, color?: number | Color | string); - /** - * The object for which to visualize vertex tangents. - * - * @type {Object3D} - */ - object: Object3D; - /** - * The helper's size. - * - * @type {number} - * @default 1 - */ - size: number; - /** - * Updates the vertex normals preview based on the object's world transform. - */ - update(): void; -} -import { LineSegments } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts deleted file mode 100644 index 48b0f2be8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/Extension.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export class Extension extends Tab { - isExtension: boolean; - init(inspector: any): void; - _inspector: any; - _handleLayout: ((event: any) => void) | null | undefined; - serialize(): {}; - deserialize(): void; - save(): void; - onOrientationChange(): void; - onLayoutChange(): void; -} -import { Tab } from 'three/addons/inspector/ui/Tab.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts deleted file mode 100644 index ff84aa49f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/Inspector.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -export class Inspector extends RendererInspector { - statsData: Map; - profiler: Profiler; - performance: Performance; - memory: Memory; - console: Console; - parameters: Parameters; - viewer: Viewer; - timeline: Timeline; - settings: Settings; - once: {}; - extensionsData: WeakMap; - displayCycle: { - text: { - needsUpdate: boolean; - duration: number; - time: number; - }; - graph: { - needsUpdate: boolean; - duration: number; - time: number; - }; - toggleGraph: { - needsUpdate: boolean; - duration: number; - time: number; - }; - }; - get domElement(): HTMLDivElement | undefined; - isVertical(): boolean | undefined; - onExtension(name: any, callback: any): this; - hide(): void; - show(): void; - setVisible(value: any): this; - getVisible(): boolean; - getSize(): { - width: number; - height: number; - }; - setActiveTab(tab: any): this; - setHorizontalAlign(value: any): this; - setVerticalAlign(value: any): this; - addTab(tab: any): this; - removeTab(tab: any): this; - setActiveExtension(name: any, value: any): this; - resolveConsoleOnce(type: any, message: any): void; - resolveConsole(type: any, message: any, stackTrace?: null): void; - setRenderer(renderer: any): this; - createParameters(name: any): { - parameters: any; - paramList: import("./ui/Item.js").Item; - objects: any[]; - close(): /*elided*/ any; - name(name: any): /*elided*/ any; - show(): /*elided*/ any; - hide(): /*elided*/ any; - add(object: any, property: any, ...params: any[]): import("./ui/Values.js").ValueNumber | import("./ui/Values.js").ValueCheckbox | import("./ui/Values.js").ValueSlider | import("./ui/Values.js").ValueSelect | import("./ui/Values.js").ValueButton | import("./ui/Values.js").ValueString | null; - _addInfo(editor: any, itemNode: any): void; - _addParameter(object: any, property: any, editor: any, subItem: any): void; - _registerParameter(object: any, property: any, editor: any, subItem: any): void; - addString(object: any, property: any): import("./ui/Values.js").ValueString; - addFolder(name: any): /*elided*/ any; - addBoolean(object: any, property: any): import("./ui/Values.js").ValueCheckbox; - addSelect(object: any, property: any, options: any): import("./ui/Values.js").ValueSelect; - addColor(object: any, property: any): import("./ui/Values.js").ValueColor; - addSlider(object: any, property: any, min?: number, max?: number, step?: number): import("./ui/Values.js").ValueSlider; - addNumber(object: any, property: any, ...params: any[]): import("./ui/Values.js").ValueNumber; - addButton(object: any, property: any): import("./ui/Values.js").ValueButton; - }; - getStatsData(cid: any): any; - resolveStats(stats: any): void; - getNodes(): any[] | null; - getAverageDeltaTime(statsData: any, property: any, frames?: number | undefined): number; - resolveFrame(frame: any): void; - updateCycle(cycle: any): void; -} -export function getItem(id: any): any; -export function setItem(id: any, state: any): void; -import { RendererInspector } from './RendererInspector.js'; -import { Profiler } from './ui/Profiler.js'; -import { Performance } from './tabs/Performance.js'; -import { Memory } from './tabs/Memory.js'; -import { Console } from './tabs/Console.js'; -import { Parameters } from './tabs/Parameters.js'; -import { Viewer } from './tabs/Viewer.js'; -import { Timeline } from './tabs/Timeline.js'; -import { Settings } from './tabs/Settings.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts deleted file mode 100644 index 92a67d64f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/RendererInspector.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export class RendererInspector extends InspectorBase { - currentFrame: Object | null; - currentRender: any; - currentNodes: any[] | null; - lastFrame: Object | null; - frames: any[]; - framesLib: {}; - maxFrames: number; - _lastFinishTime: number; - _resolveTimestampPromise: any; - overdraw: boolean; - _overdrawMaterial: MeshBasicNodeMaterial | null; - isRendererInspector: boolean; - getParent(): any; - fps: number | undefined; - _renderOverdraw(): void; - _getFPS(): number; - _createFrame(): { - frameId: any; - resolvedCompute: boolean; - resolvedRender: boolean; - deltaTime: number; - startTime: number; - finishTime: number; - miscellaneous: number; - children: never[]; - renders: never[]; - computes: never[]; - }; - getPrimaryPass(): any; - getFrame(): Object | null; - getFrameById(frameId: any): any; - updateTabs(): void; - resolveFrame(): void; - resolveTimestamp(): Promise; - get isAvailable(): boolean; - addFrame(frame: any): void; - inspect(node: any): void; - beginCompute(uid: any, computeNode: any): void; - currentCompute: any; - beginRender(uid: any, scene: any, camera: any, renderTarget: any): void; -} -import { InspectorBase } from 'three/webgpu'; -import { MeshBasicNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts deleted file mode 100644 index ec6f7dec5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorGrading.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -export class ColorGrading extends Extension { - constructor(options?: {}); - params: { - exposure: number; - brightness: number; - contrast: number; - contrastPivot: number; - gamma: number; - saturation: number; - vibrance: number; - temperature: number; - tint: number; - hueShift: number; - lift: { - r: number; - g: number; - b: number; - y: number; - }; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - gain: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; - }; - lutSize: number; - lutTexture: Data3DTexture | null; - lutPassNode: import("three/addons/tsl/display/Lut3DNode.js").default | null; - sceneGradingEnabled: boolean; - selectedToneMapping: number; - _lutNeedsUpdate: boolean; - _lutSizeChanged: boolean; - activeTab: string; - modulesMap: Map; - cardsMap: Map; - _createSvgIcon(svgPath: any, width?: number, height?: number, strokeWidth?: number): SVGSVGElement; - _buildHeader(): void; - _buildMainView(): void; - viewContainer: HTMLDivElement | undefined; - dockContainer: HTMLDivElement | undefined; - lutSizeSelect: HTMLSelectElement | undefined; - gradingBtn: HTMLButtonElement | undefined; - updateGradingBtnState: (() => void) | undefined; - pipelineOrder: any[] | string[] | undefined; - cardsRow: HTMLDivElement | undefined; - _cardsResizeObserver: ResizeObserver | null | undefined; - _windowResizeHandler: (() => void) | null | undefined; - _isVerticalMode(): boolean | null; - _updateCardsRowAlignment(): void; - _setupPanAndWheelScroll(container: any, cardsRow: any): void; - _renderCardsFlow(): void; - _updateLiveFlowConnectors(): void; - _openAddCardModal(insertIndex: any): void; - _activeModalOverlay: HTMLDivElement | null | undefined; - _modalKeyDownHandler: ((e: any) => void) | null | undefined; - _closeAddCardModal(): void; - _addCardAt(type: any, insertIndex: any, initialParams?: {}, customId?: null): WhiteBalanceModule | ExposureModule | BrightnessModule | HueModule | ColorWheelModule | CurvesModule | ContrastModule | SaturationModule | VibranceModule | null; - _removeCard(modId: any): void; - _setupCardDragAndDrop(card: any, moduleId: any): void; - _draggedModuleId: any; - _updateRendererCardState(): void; - _onParamChange(): void; - generate3DLUTData(size?: number, buffer?: null): null; - _getExportFileName(defaultBase?: string): any; - _exportCubeFile(): void; - _exportPngFile(): void; - toJSON(): { - version: number; - lutSize: number; - selectedToneMapping: number; - sceneGradingEnabled: boolean; - pipelineOrder: any[]; - modules: {}; - params: {}; - }; - serialize(): { - version: number; - lutSize: number; - selectedToneMapping: number; - sceneGradingEnabled: boolean; - pipelineOrder: any[]; - modules: {}; - params: {}; - }; - deserialize(data: any): void; - _applyParamsToModule(modId: any, params: any): void; - load(data: any): void; - _exportJsonFile(): void; - _importJsonFile(): void; - _createImportedCubeCard(modId: any): HTMLDivElement; - _removeImportedCubeCard(modId: any): void; - _importCubeFileAt(insertIndex: any): void; - _importCubeFile(): void; - onOrientationChange(event: any): void; - update(inspector: any): void; - _getRenderPipeline(renderer: any): any; - _toggleSceneGrading(enable: any): void; - _updateLiveGrading(): void; - _applyLiveGrading(): void; - _createdPipeline: RenderPipeline | null | undefined; - _origRendererRender: any; - _originalPipelineSettings: { - outputNode: any; - outputColorTransform: any; - rendererToneMapping: any; - } | null | undefined; - _removeLiveGrading(): void; -} -import { Extension } from 'three/addons/inspector/Extension.js'; -import { Data3DTexture } from 'three/webgpu'; -import { WhiteBalanceModule } from './modules/WhiteBalanceModule.js'; -import { ExposureModule } from './modules/ExposureModule.js'; -import { BrightnessModule } from './modules/BrightnessModule.js'; -import { HueModule } from './modules/HueModule.js'; -import { ColorWheelModule } from './modules/ColorWheelModule.js'; -import { CurvesModule } from './modules/CurvesModule.js'; -import { ContrastModule } from './modules/ContrastModule.js'; -import { SaturationModule } from './modules/SaturationModule.js'; -import { VibranceModule } from './modules/VibranceModule.js'; -import { RenderPipeline } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts deleted file mode 100644 index cb729200f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/ColorWheel.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * ColorWheel.js - DaVinci Resolve style interactive Color Wheel control widget - */ -export class ColorWheel { - constructor(title: any, initialValues: { - r: number; - g: number; - b: number; - } | undefined, onChange: any, onRemove?: null); - title: any; - values: { - r: number; - g: number; - b: number; - }; - onChange: any; - onRemove: any; - domElement: HTMLDivElement; - _buildUI(): void; - canvas: HTMLCanvasElement | undefined; - ctx: CanvasRenderingContext2D | null | undefined; - ySlider: HTMLInputElement | undefined; - inputs: {} | undefined; - setValues(r: any, g: any, b: any, y?: undefined): void; - draw(): void; - _initEvents(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts deleted file mode 100644 index 1573d894b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/CurveEditor.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -export class CurveEditor { - constructor(options?: {}); - curves: any; - activeChannel: any; - onChange: any; - selectedIndex: number; - isDragging: boolean; - pointRadius: number; - domElement: HTMLDivElement; - _buildUI(): void; - channelBtns: {} | undefined; - canvasContainer: HTMLDivElement | undefined; - canvas: HTMLCanvasElement | undefined; - ctx: CanvasRenderingContext2D | null | undefined; - _onResize(): void; - setChannel(channelId: any): void; - setCurves(curves: any): void; - getCurves(): { - rgb: any; - red: any; - green: any; - blue: any; - }; - _getChannelColor(channelId?: any): "#e0e0e0" | "#ff3344" | "#22dd55" | "#3388ff"; - _normToCanvas(point: any): { - x: number; - y: number; - }; - _canvasToNorm(px: any, py: any): { - x: number; - y: number; - }; - _initEvents(): void; - _dragStartSnapshot: any; - notifyChange(): void; - render(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts deleted file mode 100644 index e6c350e7e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * LUT3DStyle.js - Unified CSS stylesheet module for 3D LUT Generator extension - */ -export class LUT3DStyle { - static init(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts deleted file mode 100644 index bb74403b7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/LUTMath.d.ts +++ /dev/null @@ -1,505 +0,0 @@ -export function evaluateSpline(t: any, points: any): any; -export function rgbToHsv(r: any, g: any, b: any): number[]; -export function hsvToRgb(h: any, s: any, v: any): number[]; -export function sample3DLUT(r: any, g: any, b: any, size: any, dataLines: any): number[]; -export function applyColorTransform(r: any, g: any, b: any, params: any, pipelineOrder?: null): number[]; -export function generate3DLUTData(params: any, size?: number, buffer?: null, pipelineOrder?: null): null; -export function exportCubeFormat(paramsOrBuffer: any, size?: number, title?: string, pipelineOrder?: null): string; -export function parseCubeFormat(text: any): { - title: string; - size: number; - data: any[][]; - dataLines: any[][]; -}; -export function exportLUTCanvas(paramsOrBuffer: any, size?: number, pipelineOrder?: null): HTMLCanvasElement; -export function createDefaultParams(): { - exposure: number; - brightness: number; - contrast: number; - contrastPivot: number; - gamma: number; - saturation: number; - vibrance: number; - temperature: number; - tint: number; - hueShift: number; - lift: { - r: number; - g: number; - b: number; - y: number; - }; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - gain: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; -}; -export const LUT_PRESETS: { - 'Neutral (Default)': { - exposure: number; - brightness: number; - contrast: number; - contrastPivot: number; - gamma: number; - saturation: number; - vibrance: number; - temperature: number; - tint: number; - hueShift: number; - lift: { - r: number; - g: number; - b: number; - y: number; - }; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - gain: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; - }; - 'Cinematic Teal & Orange': { - contrast: number; - temperature: number; - lift: { - r: number; - g: number; - b: number; - }; - gain: { - r: number; - g: number; - b: number; - }; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; - exposure: number; - brightness: number; - contrastPivot: number; - gamma: number; - saturation: number; - vibrance: number; - tint: number; - hueShift: number; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - }; - 'Vintage Warm Film': { - exposure: number; - contrast: number; - saturation: number; - temperature: number; - tint: number; - lift: { - r: number; - g: number; - b: number; - }; - gain: { - r: number; - g: number; - b: number; - }; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; - brightness: number; - contrastPivot: number; - gamma: number; - vibrance: number; - hueShift: number; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - }; - 'Cold Sci-Fi Blue': { - contrast: number; - temperature: number; - tint: number; - lift: { - r: number; - g: number; - b: number; - }; - gain: { - r: number; - g: number; - b: number; - }; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; - exposure: number; - brightness: number; - contrastPivot: number; - gamma: number; - saturation: number; - vibrance: number; - hueShift: number; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - }; - 'Cyberpunk Neon': { - contrast: number; - saturation: number; - vibrance: number; - lift: { - r: number; - g: number; - b: number; - }; - gain: { - r: number; - g: number; - b: number; - }; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; - exposure: number; - brightness: number; - contrastPivot: number; - gamma: number; - temperature: number; - tint: number; - hueShift: number; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - }; - 'High Contrast B&W': { - contrast: number; - saturation: number; - curves: { - rgb: { - x: number; - y: number; - }[]; - red: { - x: number; - y: number; - }[]; - green: { - x: number; - y: number; - }[]; - blue: { - x: number; - y: number; - }[]; - }; - exposure: number; - brightness: number; - contrastPivot: number; - gamma: number; - vibrance: number; - temperature: number; - tint: number; - hueShift: number; - lift: { - r: number; - g: number; - b: number; - y: number; - }; - gammaBal: { - r: number; - g: number; - b: number; - y: number; - }; - gain: { - r: number; - g: number; - b: number; - y: number; - }; - offset: { - r: number; - g: number; - b: number; - y: number; - }; - channelMixer: { - red: { - r: number; - g: number; - b: number; - }; - green: { - r: number; - g: number; - b: number; - }; - blue: { - r: number; - g: number; - b: number; - }; - }; - }; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts deleted file mode 100644 index 5c90157c1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class BrightnessModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - brightnessControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts deleted file mode 100644 index 07497e82d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class ColorWheelModule extends Module { - constructor(mode: any, title: any, initialParams?: {}, onChange?: null, onRemove?: null, id?: null); - mode: any; - onRemove: any; - wheel: ColorWheel; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; -import { ColorWheel } from '../ColorWheel.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts deleted file mode 100644 index 8837f191c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class ContrastModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - contrastControl: HTMLDivElement; - pivotControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts deleted file mode 100644 index 8bd0fec18..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class CurvesModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - curveEditor: CurveEditor; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; -import { CurveEditor } from '../CurveEditor.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts deleted file mode 100644 index 88dbafbbc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class ExposureHueModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - exposureControl: HTMLDivElement; - hueShiftControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts deleted file mode 100644 index 535efeeff..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class ExposureModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - exposureControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts deleted file mode 100644 index 1122af211..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/HueModule.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class HueModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - hueShiftControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts deleted file mode 100644 index 60792eb70..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class ImportedCubeModule extends Module { - constructor(id: any, cubeInfo?: {}, onChange?: null, onRemove?: null); - onRemove: any; - weightControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts deleted file mode 100644 index e2790372f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/Module.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Module.js - Base class for LUT 3D Generator Card Modules - */ -export class Module { - constructor(id: any, name: any, params?: {}); - id: any; - name: any; - params: {}; - enabled: boolean; - domElement: any; - onChange: any; - dragAndDrop: boolean; - /** - * Applies module transformation directly onto a Float32Array 3D LUT buffer. - * @param {Float32Array} buffer - Buffer of size x size x size x 4 RGBA elements - * @param {number} size - LUT grid dimension - * @returns {Float32Array} - */ - apply(buffer: Float32Array): Float32Array; - /** - * Transforms a single RGB color pixel (0..1 range) into a reusable target array. - * Virtual method to be overridden by sub-classes. - */ - applyPixel(r: any, g: any, b: any, target?: number[]): number[]; - /** - * Helper to create standard card header with title, reset button, and optional remove button. - */ - createCardHeader(titleText: any, onReset: any, onRemove?: null): HTMLDivElement; - /** - * Helper to create parameter box with label, draggable number input, and range slider. - */ - createSliderControl({ key, label, min, max, step, def }: { - key: any; - label: any; - min: any; - max: any; - step: any; - def: any; - }): HTMLDivElement; - onParamChange(): void; - reset(): void; - updateUI(): void; - toJSON(): { - id: any; - params: any; - }; - fromJSON(json: any): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts deleted file mode 100644 index 0fb86f029..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class OutputModule extends Module { - constructor(params?: {}, onChange?: null); - nameInput: HTMLInputElement; - resVal: HTMLSpanElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts deleted file mode 100644 index 4641fc424..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export class RendererModule extends Module { - constructor(params?: {}, onChange?: null, onRendererChange?: null); - defaultToneMapping: any; - defaultExposure: any; - onRendererChange: any; - toneMappingSelect: HTMLSelectElement; - exposureNumInput: HTMLInputElement; - exposureSlider: HTMLInputElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts deleted file mode 100644 index 9257e9de3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class SatVibranceModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - saturationControl: HTMLDivElement; - vibranceControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts deleted file mode 100644 index fbbb63167..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class SaturationModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - saturationControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts deleted file mode 100644 index 89d143771..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class VibranceModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - vibranceControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts deleted file mode 100644 index dedd0da3a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class WhiteBalanceModule extends Module { - constructor(params?: {}, onChange?: null, onRemove?: null, id?: string); - temperatureControl: HTMLDivElement; - tintControl: HTMLDivElement; - domElement: HTMLDivElement; -} -import { Module } from './Module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts deleted file mode 100644 index aa4aa8bc4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -export default TSLGraphEditor; -declare class TSLGraphEditor extends Extension { - constructor(options?: {}); - autoGraphId: boolean; - iframe: HTMLIFrameElement; - editorOrigin: string; - material: any; - uniforms: any; - isReady: boolean; - _codeData: any; - _codeSaveTimeout: number | null; - _pending: Map; - _resolveReady: ((value: any) => void) | null; - _editorReady: Promise; - get hasGraphs(): boolean; - _initPicker(inspector: any): void; - apply(scene: any): this; - restoreMaterial(material: any): void; - setMaterial(material: any): Promise; - loadGraph(graphData: any): Promise; - command(type: any, payload: any): Promise; - getCode(): Promise; - getTSLFunction(): Promise; - getGraph(): Promise; - onResponse(): Promise; - onEvent(type: any, payload: any): Promise; - onMessage(event: any): Promise; - _setMaterial(material: any): Promise; - materialDefault: any; - _getGraphType(material: any): "material/physical" | "material/standard" | "material/phong" | "material/basic" | "material/sprite" | "material/node"; - _showManagerModal(): void; - _exportData(): void; - _importData(): void; - getCodes(): any; - _saveCode(): void; - _restoreMaterial(): void; - _updateMaterial(): Promise; - _updateUniforms(uniforms: any): void; - _isEditorMessage(value: any): boolean; - _makeRequestId(): string; - _post(message: any): void; -} -import { Extension } from 'three/addons/inspector/Extension.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts deleted file mode 100644 index 85c1dc7fc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export class TSLGraphLoader extends FileLoader { - static get hasGraphs(): boolean; - static getCodes(): any; - static setCodes(codes: any): void; - static setGraph(graphId: any, graphData: any): void; - static getGraph(graphId: any): any; - static deleteGraph(graphId: any): void; - static setGraphs(json: any): any; - static clearGraphs(): void; - constructor(manager: any); - load(url: any, onLoad: any, onProgress: any, onError: any): void; - parseMaterial(json: any): any; - parseMaterials(json: any): any; - parse(json: any): TSLGraphLoaderApplier; - _generateMaterialCode(json: any, name?: string, imports?: {}): any; - _generateCode(materials: any, imports: any): string; -} -import { FileLoader } from 'three'; -declare class TSLGraphLoaderApplier { - constructor(tslGraphFns: any); - tslGraphFns: any; - apply(scene: any): void; -} -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts deleted file mode 100644 index d52a3e94c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Console.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export class Console extends Tab { - constructor(options?: {}); - filters: { - info: boolean; - warn: boolean; - error: boolean; - }; - filterText: string; - unreadErrors: number; - unreadWarns: number; - tabBadgeContainer: HTMLSpanElement; - tabErrorBadge: HTMLSpanElement; - tabWarnBadge: HTMLSpanElement; - logContainer: HTMLDivElement; - lastMessage: { - type: any; - text: any; - count: number; - element: HTMLDivElement; - countBadge: HTMLSpanElement; - } | null; - buildHeader(): void; - applyFilters(): void; - copyAll(button: any): void; - _getIcon(type: any, subType: any): string | undefined; - _formatMessage(type: any, text: any): DocumentFragment; - clearUnread(): void; - updateBadges(): void; - addMessage(type: any, text: any): void; -} -import { Tab } from '../ui/Tab.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts deleted file mode 100644 index 934bb1515..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Memory.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export class Memory extends Tab { - constructor(options?: {}); - memoryStats: Item; - attributes: Item; - geometries: Item; - indexAttributes: Item; - indirectStorageAttributes: Item; - programs: Item; - readbackBuffers: Item; - renderTargets: Item; - storageAttributes: Item; - textures: Item; - uniformBuffers: Item; - graph: Graph; - updateGraph(inspector: any): void; - updateText(inspector: any): void; -} -import { Tab } from '../ui/Tab.js'; -import { Item } from '../ui/Item.js'; -import { Graph } from '../ui/Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts deleted file mode 100644 index 2e7363ffa..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Parameters.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export class Parameters extends Tab { - constructor(options?: {}); - paramList: List; - groups: any[]; - createGroup(name: any): ParametersGroup; -} -import { Tab } from '../ui/Tab.js'; -import { List } from '../ui/List.js'; -declare class ParametersGroup { - constructor(parameters: any, name: any); - parameters: any; - paramList: Item; - objects: any[]; - close(): this; - name(name: any): this; - show(): this; - hide(): this; - add(object: any, property: any, ...params: any[]): ValueNumber | ValueCheckbox | ValueSlider | ValueSelect | ValueButton | ValueString | null; - _addInfo(editor: any, itemNode: any): void; - _addParameter(object: any, property: any, editor: any, subItem: any): void; - _registerParameter(object: any, property: any, editor: any, subItem: any): void; - addString(object: any, property: any): ValueString; - addFolder(name: any): ParametersGroup; - addBoolean(object: any, property: any): ValueCheckbox; - addSelect(object: any, property: any, options: any): ValueSelect; - addColor(object: any, property: any): ValueColor; - addSlider(object: any, property: any, min?: number, max?: number, step?: number): ValueSlider; - addNumber(object: any, property: any, ...params: any[]): ValueNumber; - addButton(object: any, property: any): ValueButton; -} -import { Item } from '../ui/Item.js'; -import { ValueNumber } from '../ui/Values.js'; -import { ValueCheckbox } from '../ui/Values.js'; -import { ValueSlider } from '../ui/Values.js'; -import { ValueSelect } from '../ui/Values.js'; -import { ValueButton } from '../ui/Values.js'; -import { ValueString } from '../ui/Values.js'; -import { ValueColor } from '../ui/Values.js'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts deleted file mode 100644 index af834317e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Performance.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export class Performance extends Tab { - constructor(options?: {}); - graphFpsCounter: HTMLSpanElement; - notInUse: Map; - frameStats: Item; - graphStats: Item; - graph: Graph; - miscellaneous: Item; - currentRender: any; - currentItem: any; - frameItems: Map; - resolveStats(inspector: any, stats: any): void; - updateGraph(inspector: any, frame: any): void; - addNotInUse(cid: any, item: any): void; - updateNotInUse(cid: any): void; - updateText(inspector: any, frame: any): void; -} -import { Tab } from '../ui/Tab.js'; -import { Item } from '../ui/Item.js'; -import { Graph } from '../ui/Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts deleted file mode 100644 index 46e23ec45..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Settings.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export class Settings extends Parameters { - constructor(); - extensions: {}; - setActiveExtension(name: any, value: any): Promise; - _updateExtensionUI(extension: any): void; - _unloadExtension(inspector: any, extension: any): Promise; - _loadExtension(inspector: any, extension: any): Promise; - _getExtensions(): Promise<{ - name: string; - url: string; - }[]>; -} -import { Parameters } from './Parameters.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts deleted file mode 100644 index 1ff4fdac0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Timeline.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -export class Timeline extends Tab { - constructor(options?: {}); - isRecording: boolean; - frames: any[]; - baseTriangles: number; - currentFrame: { - id: any; - calls: never[]; - fps: number; - triangles: number; - } | null; - isHierarchicalView: boolean; - activeBlocks: Map; - domPool: any[]; - originalBackend: any; - originalMethods: Map; - renderer: any; - graph: Graph; - init(inspector: any): void; - buildHeader(): void; - recordButton: HTMLButtonElement | undefined; - viewModeSelect: HTMLSelectElement | undefined; - recordRefreshButton: HTMLButtonElement | undefined; - exportButton: HTMLButtonElement | undefined; - frameInfo: HTMLSpanElement | undefined; - buildUI(): void; - graphSlider: HTMLDivElement | undefined; - hoverIndicator: HTMLDivElement | undefined; - playhead: HTMLDivElement | undefined; - fixedScreenX: number | undefined; - isTrackingLatest: boolean | undefined; - isManualScrubbing: boolean | undefined; - timelineTrack: HTMLDivElement | undefined; - timelineContent: HTMLDivElement | undefined; - setRenderer(renderer: any): void; - toggleRecording(): void; - startRecording(): void; - selectedFrameIndex: any; - stopRecording(): void; - clear(): void; - exportData(): void; - getRenderTargetDetails(renderTarget: any): { - [x: string]: any; - target: any; - }; - getCallDetail(method: any, args: any): { - scene: any; - camera: any; - } | { - compute: any; - } | { - color: any; - depth: any; - stencil: any; - } | { - group: any; - count: any; - } | { - group: any; - size: string; - } | { - object: any; - } | { - name: any; - count: any; - itemSize: any; - } | { - target: any; - width: any; - height: any; - } | { - source: any; - destination: any; - } | { - magFilter: any; - minFilter: any; - wrapS: any; - wrapT: any; - anisotropy: any; - } | { - texture: any; - } | { - node: any; - bindings: number; - dispatch: any; - group?: undefined; - x?: undefined; - y?: undefined; - width?: undefined; - height?: undefined; - stage?: undefined; - name?: undefined; - } | { - group: any; - node?: undefined; - bindings?: undefined; - dispatch?: undefined; - x?: undefined; - y?: undefined; - width?: undefined; - height?: undefined; - stage?: undefined; - name?: undefined; - } | { - x: any; - y: any; - width: any; - height: any; - node?: undefined; - bindings?: undefined; - dispatch?: undefined; - group?: undefined; - stage?: undefined; - name?: undefined; - } | { - stage: any; - name: any; - node?: undefined; - bindings?: undefined; - dispatch?: undefined; - group?: undefined; - x?: undefined; - y?: undefined; - width?: undefined; - height?: undefined; - } | { - name: any; - node?: undefined; - bindings?: undefined; - dispatch?: undefined; - group?: undefined; - x?: undefined; - y?: undefined; - width?: undefined; - height?: undefined; - stage?: undefined; - } | null; - getTextureName(texture: any): any; - getTextureFilterName(filter: any): any; - getTextureWrapName(wrap: any): any; - formatDetails(details: any): string; - renderSlider(): void; - selectFrame(index: any): void; - createBlock(): HTMLDivElement; - clearActiveBlocks(): void; - updateVisibleBlocks(): void; - renderTimelineTrack(frame: any): void; - flatList: any[] | undefined; - collapsedGroups: Set | undefined; - getColorForMethod(method: any): "var(--color-green)" | "var(--text-secondary)" | "var(--color-red)" | "var(--color-yellow)"; -} -import { Tab } from '../ui/Tab.js'; -import { Graph } from '../ui/Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts deleted file mode 100644 index 11a73a479..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/tabs/Viewer.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -export class Viewer extends Tab { - constructor(options?: {}); - maximizedByFullscreenButton: boolean; - nodeList: List; - itemLibrary: Map; - folderLibrary: Map; - canvasNodes: Map; - currentDataList: any[]; - nodes: Item; - scrollWrapper: HTMLDivElement; - fullViewerContainer: HTMLDivElement; - select: HTMLSelectElement; - backBtn: HTMLButtonElement; - activeFullNodeId: any; - pendingRestoreView: boolean; - splitActive: boolean; - splitCanvasData: any; - splitOverlay: HTMLDivElement | null; - splitLine: HTMLDivElement | null; - splitQuad: QuadMesh | null; - splitMaterial: NodeMaterial | null; - splitUniforms: { - splitX: import("three/webgpu").UniformNode; - viewportWidth: import("three/webgpu").UniformNode; - } | null; - splitCanvas: HTMLCanvasElement | null; - splitCanvasTarget: CanvasTarget | null; - isDraggingThumbnail: boolean; - activeSourceCanvas: any; - activePointerIds: Set; - getFolder(name: any): any; - addNodeItem(canvasData: any): any; - splitFullscreen: boolean | undefined; - setupEventForwarding(sourceCanvas: any): void; - forwardEvent(event: any, sourceCanvas: any, targetCanvas: any): void; - init(inspector: any): void; - setViewMode(mode: any): void; - showListView(): void; - showNodeView(nodeId: any): void; - startSplitMode(canvasData: any): void; - splitX: number | undefined; - stopSplitMode(): void; - updateSplitButtonsState(): void; - getCanvasDataByNode(renderer: any, node: any): any; - update(inspector: any): void; - saveLastView(): void; -} -import { Tab } from '../ui/Tab.js'; -import { List } from '../ui/List.js'; -import { Item } from '../ui/Item.js'; -import { QuadMesh } from 'three/webgpu'; -import { NodeMaterial } from 'three/webgpu'; -import { CanvasTarget } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts deleted file mode 100644 index 6982acfd8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Graph.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export class Graph { - constructor(maxPoints?: number); - maxPoints: number; - lines: {}; - limit: number; - limitIndex: number; - domElement: HTMLCanvasElement; - ctx: CanvasRenderingContext2D | null; - width: number; - height: number; - devicePixelRatio: number; - resize(width: any, height: any): void; - addLine(id: any, color: any): void; - addPoint(lineId: any, value: any): void; - resetLimit(): void; - update(): void; - draw(): void; - _resolveColor(color: any): { - color: any; - transparent: string; - } | null; - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts deleted file mode 100644 index 768c71a81..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Item.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export class Item { - constructor(...data: any[]); - children: any[]; - isOpen: boolean; - isCollapsible: boolean; - childrenContainer: HTMLDivElement | null; - parent: any; - domElement: HTMLDivElement; - itemRow: HTMLDivElement; - userData: {}; - data: any[]; - onItemClick(e: any): void; - add(item: any, index?: number): this; - remove(item: any): this; - updateToggler(): void; - setCollapsible(collapsible: any): this; - toggle(): this; - close(): this; - show(): this; - hide(): this; - setValue(index: any, value: any): this; - getValue(index: any): any; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts deleted file mode 100644 index 864106ae1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/List.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export class List { - constructor(...headers: any[]); - headers: any[]; - children: any[]; - domElement: HTMLDivElement; - id: string; - gridStyleElement: HTMLStyleElement; - setGridStyle(gridTemplate: any): void; - setViewMode(mode: any): void; - add(item: any): void; - remove(item: any): this; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts deleted file mode 100644 index d08b8bdb1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Profiler.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -export class Profiler extends EventDispatcher { - constructor(inspector: any); - inspector: any; - tabs: {}; - activeTabId: any; - isResizing: boolean; - lastHeightBottom: number; - lastWidthRight: number; - position: string; - detachedWindows: any[]; - maxZIndex: number; - nextTabOriginalIndex: number; - horizontalAlign: string; - verticalAlign: string; - getSize(): { - width: number; - height: number; - }; - get isMobile(): boolean; - get isSmallScreen(): boolean; - detectMobile(): boolean; - setupOrientationListener(): void; - setupWindowResizeListener(): void; - constrainWindowToBounds(windowPanel: any): void; - setupShell(): void; - domElement: HTMLDivElement | undefined; - toggleButton: HTMLButtonElement | undefined; - builtinTabsContainer: Element | null | undefined; - miniPanel: HTMLDivElement | undefined; - panel: HTMLDivElement | undefined; - tabsContainer: HTMLDivElement | undefined; - floatingBtn: HTMLButtonElement | undefined; - maximizeBtn: HTMLButtonElement | undefined; - contentWrapper: HTMLDivElement | undefined; - toggleGraph: Graph | undefined; - setupResizing(): void; - toggleMaximize(): void; - hide(): void; - show(tab: any): void; - addTab(tab: any): void; - addBuiltinTab(tab: any): void; - removeTab(tab: any): void; - updatePanelSize(): void; - checkHeaderScroll(): void; - setupTabDragAndDrop(tab: any): void; - createPreviewWindow(tab: any, x: any, y: any): HTMLDivElement; - detachTab(tab: any, x: any, y: any): void; - createDetachedWindow(tab: any, x: any, y: any): { - panel: HTMLDivElement; - tab: any; - }; - bringWindowToFront(windowPanel: any): void; - setupDetachedWindowDrag(windowPanel: any, header: any, tab: any): void; - setupDetachedWindowResize(windowPanel: any, resizerTop: any, resizerRight: any, resizerBottom: any, resizerLeft: any, resizerCorner: any): void; - reattachTab(tab: any): void; - setActiveTab(id: any): void; - togglePanel(): void; - togglePosition(): void; - setPosition(targetPosition: any): void; - saveLayout(): void; - loadLayout(): void; - isLoadingLayout: boolean | undefined; - pendingDetachedTabs: any; - restoreDetachedTabs(): void; - setHorizontalAlign(value: any): this; - setVerticalAlign(value: any): this; - updateWidgetPosition(): void; - isVertical(): boolean | undefined; - notifyLayoutChange(): void; -} -import { EventDispatcher } from 'three'; -import { Graph } from './Graph.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts deleted file mode 100644 index 7889785be..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Style.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class Style { - static init(container: any): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts deleted file mode 100644 index e878fe9c8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Tab.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Tab class - * @param {string} title - The title of the tab - * @param {Object} options - Options for the tab - * @param {boolean} [options.allowDetach=true] - Whether the tab can be detached into a separate window - * @param {boolean} [options.builtin=false] - Whether the tab should appear in the profiler-toggle button - * @param {string} [options.icon] - SVG icon HTML for the builtin button - * - * @example - * // Create a tab that can be detached (default behavior) - * const tab1 = new Tab('My Tab'); - * - * // Create a tab that cannot be detached - * const tab2 = new Tab('Fixed Tab', { allowDetach: false }); - * - * // Create a builtin tab that appears in the profiler-toggle - * const tab3 = new Tab('Builtin Tab', { builtin: true }); - * - * // Create a builtin tab with custom icon - * const tab4 = new Tab('Settings', { builtin: true, icon: '...' }); - * - * // Control builtin tab visibility - * tab3.showBuiltin(); // Show the builtin button and mini-content - * tab3.hideBuiltin(); // Hide the builtin button and mini-content - */ -export class Tab extends EventDispatcher { - constructor(title: any, options?: {}); - id: any; - button: HTMLButtonElement; - content: HTMLDivElement; - _isActive: boolean; - isVisible: boolean; - isDetached: boolean; - detachedWindow: any; - allowDetach: any; - builtin: any; - icon: any; - builtinButton: any; - miniContent: any; - profiler: any; - onVisibilityChange: any; - get inspector(): any; - set isActive(value: boolean); - get isActive(): boolean; - init(): void; - update(): void; - setActive(isActive: any): void; - show(): void; - hide(): void; - showBuiltin(): void; - hideBuiltin(): void; - dispose(): void; -} -import { EventDispatcher } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts deleted file mode 100644 index 53a513e13..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/Values.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -export class Value extends EventDispatcher { - domElement: HTMLDivElement; - _onChangeFunction: any; - _changeTimeout: number | null; - _debounceTime: number; - setValue(): this; - getValue(): null; - dispatchChange(): void; - onChange(callback: any): this; - debounce(time: any): this; - show(): this; - hide(): this; -} -export class ValueNumber extends Value { - constructor({ value, step, min, max }: { - value?: number | undefined; - step?: number | undefined; - min?: number | undefined; - max?: number | undefined; - }); - input: HTMLInputElement; - _onChangeValue(): void; - addDragHandler(): void; - setValue(val: any): this; - getValue(): number; -} -export class ValueString extends Value { - constructor({ value }: { - value?: string | undefined; - }); - input: HTMLInputElement; - setValue(val: any): this; - getValue(): string; -} -export class ValueCheckbox extends Value { - constructor({ value }: { - value?: boolean | undefined; - }); - checkbox: HTMLInputElement; - setValue(val: any): this; - getValue(): boolean; -} -export class ValueSlider extends Value { - constructor({ value, min, max, step }: { - value?: number | undefined; - min?: number | undefined; - max?: number | undefined; - step?: number | undefined; - }); - slider: HTMLInputElement; - numberInput: HTMLInputElement; - setValue(val: any): this; - getValue(): number; - step(value: any): this; -} -export class ValueSelect extends Value { - constructor({ options, value }: { - options?: never[] | undefined; - value?: string | undefined; - }); - options: any[]; - select: HTMLSelectElement; - setValue(val: any): this; - getValue(): any; -} -export class ValueColor extends Value { - constructor({ value }: { - value?: string | undefined; - }); - colorInput: HTMLInputElement; - _value: string; - setValue(val: any): this; - _getColorHex(color: any): any; - getValue(): string; -} -export class ValueButton extends Value { - constructor({ text, value }: { - text?: string | undefined; - value?: (() => void) | undefined; - }); -} -import { EventDispatcher } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts deleted file mode 100644 index f1d15efe0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/inspector/ui/utils.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function createValueSpan(): HTMLSpanElement; -export function setText(element: any, text: any): void; -export function getText(element: any): any; -export function splitPath(fullPath: any): { - path: any; - name: any; -}; -export function splitCamelCase(str: any): any; -export function formatBytes(bytes: any, decimals?: number): string; -export function info(parentNode: any, text: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts deleted file mode 100644 index b71532d01..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/interaction/InteractionManager.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Manages interaction for 3D objects independently of the scene graph. - * - * For objects with an {@link HTMLTexture}, the manager computes CSS `matrix3d` - * transforms each frame so the underlying HTML elements stay aligned with - * their meshes. Because the elements are children of the canvas, the browser - * dispatches pointer events to them natively. - * - * ```js - * const interactions = new InteractionManager(); - * interactions.connect( renderer, camera ); - * - * // Objects live anywhere in the scene graph - * scene.add( mesh ); - * - * // Register for interaction separately - * interactions.add( mesh ); - * - * // In the animation loop - * interactions.update(); - * ``` - * @three_import import { InteractionManager } from 'three/addons/interaction/InteractionManager.js'; - */ -export class InteractionManager { - /** - * The registered interactive objects. - * - * @type {Array} - */ - objects: Array; - /** - * The canvas element. - * - * @type {?HTMLCanvasElement} - * @default null - */ - element: HTMLCanvasElement | null; - /** - * The camera used for computing the element transforms. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - _cachedCssW: number; - _cachedCssH: number; - /** - * Adds one or more objects to the manager. - * - * @param {...Object3D} objects - The objects to add. - * @return {this} - */ - add(...objects: Object3D[]): this; - /** - * Removes one or more objects from the manager. - * - * @param {...Object3D} objects - The objects to remove. - * @return {this} - */ - remove(...objects: Object3D[]): this; - /** - * Stores the renderer and camera needed for computing element transforms. - * - * @param {(WebGPURenderer|WebGLRenderer)} renderer - The renderer. - * @param {Camera} camera - The camera. - */ - connect(renderer: (WebGPURenderer | WebGLRenderer), camera: Camera): void; - /** - * Updates the element transforms for all registered objects. - * Call this once per frame in the animation loop. - */ - update(): void; - /** - * Disconnects this manager, clearing the renderer and camera references. - */ - disconnect(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts deleted file mode 100644 index 1c95f087f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/interactive/HTMLMesh.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This class can be used to render a DOM element onto a canvas and use it as a texture - * for a plane mesh. - * - * A typical use case for this class is to render the GUI of `lil-gui` as a texture so it - * is compatible for VR. - * - * ```js - * const gui = new GUI( { width: 300 } ); // create lil-gui instance - * - * const mesh = new HTMLMesh( gui.domElement ); - * scene.add( mesh ); - * ``` - * - * @augments Mesh - * @three_import import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; - */ -export class HTMLMesh extends Mesh { - /** - * Constructs a new HTML mesh. - * - * @param {HTMLElement} dom - The DOM element to display as a plane mesh. - */ - constructor(dom: HTMLElement); -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts deleted file mode 100644 index f05136dc0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/interactive/InteractiveGroup.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This class can be used to group 3D objects in an interactive group. - * The group itself can listen to Pointer, Mouse or XR controller events to - * detect selections of descendant 3D objects. If a 3D object is selected, - * the respective event is going to dispatched to it. - * - * ```js - * const group = new InteractiveGroup(); - * group.listenToPointerEvents( renderer, camera ); - * group.listenToXRControllerEvents( controller1 ); - * group.listenToXRControllerEvents( controller2 ); - * scene.add( group ); - * - * // now add objects that should be interactive - * group.add( mesh1, mesh2, mesh3 ); - * ``` - * @augments Group - * @three_import import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; - */ -export class InteractiveGroup extends Group { - /** - * The internal raycaster. - * - * @type {Raycaster} - */ - raycaster: Raycaster; - /** - * The internal raycaster. - * - * @type {?HTMLElement} - * @default null - */ - element: HTMLElement | null; - /** - * The camera used for raycasting. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * An array of XR controllers. - * - * @type {Array} - */ - controllers: Array; - _onPointerEvent: (event: any) => void; - _onXRControllerEvent: (event: any) => void; - onPointerEvent(event: any): void; - onXRControllerEvent(event: any): void; - /** - * Calling this method makes sure the interactive group listens to Pointer and Mouse events. - * The target is the `domElement` of the given renderer. The camera is required for the internal - * raycasting so 3D objects can be detected based on the events. - * - * @param {(WebGPURenderer|WebGLRenderer)} renderer - The renderer. - * @param {Camera} camera - The camera. - */ - listenToPointerEvents(renderer: (WebGPURenderer | WebGLRenderer), camera: Camera): void; - /** - * Disconnects this interactive group from all Pointer and Mouse Events. - */ - disconnectionPointerEvents(): void; - /** - * Calling this method makes sure the interactive group listens to events of - * the given XR controller. - * - * @param {Group} controller - The XR controller. - */ - listenToXRControllerEvents(controller: Group): void; - /** - * Disconnects this interactive group from all XR controllers. - */ - disconnectXrControllerEvents(): void; - /** - * Disconnects this interactive group from the DOM and all XR controllers. - */ - disconnect(): void; -} -import { Group } from 'three'; -import { Raycaster } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts b/jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts deleted file mode 100644 index 7bd19c5bc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/interactive/SelectionBox.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This class can be used to select 3D objects in a scene with a selection box. - * It is recommended to visualize the selected area with the help of {@link SelectionHelper}. - * - * ```js - * const selectionBox = new SelectionBox( camera, scene ); - * const selectedObjects = selectionBox.select( startPoint, endPoint ); - * ``` - * - * @three_import import { SelectionBox } from 'three/addons/interactive/SelectionBox.js'; - */ -export class SelectionBox { - /** - * Constructs a new selection box. - * - * @param {Camera} camera - The camera the scene is rendered with. - * @param {Scene} scene - The scene. - * @param {number} [deep=Number.MAX_VALUE] - How deep the selection frustum of perspective cameras should extend. - */ - constructor(camera: Camera, scene: Scene, deep?: number); - /** - * The camera the scene is rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * The camera the scene is rendered with. - * - * @type {Scene} - */ - scene: Scene; - /** - * The start point of the selection. - * - * @type {Vector3} - */ - startPoint: Vector3; - /** - * The end point of the selection. - * - * @type {Vector3} - */ - endPoint: Vector3; - /** - * The selected 3D objects. - * - * @type {Array} - */ - collection: Array; - /** - * The selected instance IDs of instanced meshes. - * - * @type {Object} - */ - instances: Object; - /** - * The selected batches of batched meshes. - * - * @type {Object} - */ - batches: Object; - /** - * How deep the selection frustum of perspective cameras should extend. - * - * @type {number} - * @default Number.MAX_VALUE - */ - deep: number; - /** - * This method selects 3D objects in the scene based on the given start - * and end point. If no parameters are provided, the method uses the start - * and end values of the respective members. - * - * @param {Vector3} [startPoint] - The start point. - * @param {Vector3} [endPoint] - The end point. - * @return {Array} The selected 3D objects. - */ - select(startPoint?: Vector3, endPoint?: Vector3): Array; - _updateFrustum(startPoint: any, endPoint: any): void; - _searchChildInFrustum(frustum: any, object: any): void; -} -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts deleted file mode 100644 index a141857f4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/basis/basis_transcoder.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export = BASIS; -declare function BASIS(moduleArg?: {}): Promise; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts deleted file mode 100644 index 5298df7f0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/chevrotain.module.min.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: any; -export default _default; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts deleted file mode 100644 index 007913507..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/demuxer_mp4.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export class MP4Demuxer { - constructor(uri: any, { onConfig, onChunk, setStatus }: { - onConfig: any; - onChunk: any; - setStatus: any; - }); - #private; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts deleted file mode 100644 index 8367943c4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_decoder.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export = DracoDecoderModule; -declare function DracoDecoderModule(DracoDecoderModule?: {}): any; -declare namespace DracoDecoderModule { - export { DracoDecoderModule }; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts deleted file mode 100644 index e973d4a6a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/draco_wasm_wrapper.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export = DracoDecoderModule; -declare function DracoDecoderModule(n: any): any; -declare namespace DracoDecoderModule { - export { DracoDecoderModule }; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts deleted file mode 100644 index 8367943c4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_decoder.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export = DracoDecoderModule; -declare function DracoDecoderModule(DracoDecoderModule?: {}): any; -declare namespace DracoDecoderModule { - export { DracoDecoderModule }; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts deleted file mode 100644 index e973d4a6a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/draco/gltf/draco_wasm_wrapper.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export = DracoDecoderModule; -declare function DracoDecoderModule(n: any): any; -declare namespace DracoDecoderModule { - export { DracoDecoderModule }; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts deleted file mode 100644 index 092baee43..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/ecsy.module.d.ts +++ /dev/null @@ -1,344 +0,0 @@ -export class Component { - constructor(props: any); - _pool: any; - copy(source: any): this; - clone(): any; - reset(): void; - dispose(): void; - getName(): any; - checkUndefinedAttributes(src: any): void; -} -export namespace Component { - let schema: {}; - let isComponent: boolean; - function getName(): any; -} -export function Not(Component: any): { - operator: string; - Component: any; -}; -export class ObjectPool { - constructor(T: any, initialSize: any); - freeList: any[]; - count: number; - T: any; - isObjectPool: boolean; - acquire(): any; - release(item: any): void; - expand(count: any): void; - totalSize(): number; - totalFree(): number; - totalUsed(): number; -} -export class System { - constructor(world: any, attributes: any); - canExecute(): boolean; - getName(): any; - world: any; - enabled: boolean; - _queries: {}; - queries: {}; - priority: any; - executeTime: number; - _mandatoryQueries: any[]; - initialized: boolean; - stop(): void; - play(): void; - clearEvents(): void; - toJSON(): { - name: any; - enabled: boolean; - executeTime: number; - priority: any; - queries: {}; - }; -} -export namespace System { - let isSystem: boolean; - function getName(): any; -} -export class SystemStateComponent extends Component { -} -export namespace SystemStateComponent { - let isSystemStateComponent: boolean; -} -export class TagComponent extends Component { - constructor(); -} -export namespace TagComponent { - let isTagComponent: boolean; -} -export namespace Types { - let Number: any; - let Boolean: any; - let String: any; - let Array: any; - let Ref: any; - let JSON: any; -} -export const Version: "0.3.1"; -export class World { - constructor(options?: {}); - options: { - entityPoolSize: number; - entityClass: typeof Entity; - }; - componentsManager: ComponentManager; - entityManager: EntityManager; - systemManager: SystemManager; - enabled: boolean; - eventQueues: {}; - lastTime: number; - registerComponent(Component: any, objectPool: any): this; - registerSystem(System: any, attributes: any): this; - hasRegisteredComponent(Component: any): boolean; - unregisterSystem(System: any): this; - getSystem(SystemClass: any): any; - getSystems(): any[]; - execute(delta: any, time: any): void; - stop(): void; - play(): void; - createEntity(name: any): any; - stats(): { - entities: { - numEntities: number; - numQueries: number; - queries: {}; - numComponentPool: number; - componentPool: {}; - eventDispatcher: { - fired: number; - handled: number; - }; - }; - system: { - numSystems: number; - systems: {}; - }; - }; -} -declare class Entity { - constructor(entityManager: any); - _entityManager: any; - id: number; - _ComponentTypes: any[]; - _components: {}; - _componentsToRemove: {}; - queries: any[]; - _ComponentTypesToRemove: any[]; - alive: boolean; - numStateComponents: number; - getComponent(Component: any, includeRemoved: any): any; - getRemovedComponent(Component: any): any; - getComponents(): {}; - getComponentsToRemove(): {}; - getComponentTypes(): any[]; - getMutableComponent(Component: any): any; - addComponent(Component: any, values: any): this; - removeComponent(Component: any, forceImmediate: any): this; - hasComponent(Component: any, includeRemoved: any): boolean; - hasRemovedComponent(Component: any): boolean; - hasAllComponents(Components: any): boolean; - hasAnyComponents(Components: any): boolean; - removeAllComponents(forceImmediate: any): any; - copy(src: any): this; - clone(): Entity; - reset(): void; - remove(forceImmediate: any): any; -} -export function cloneArray(src: any): any; -export function cloneClonable(src: any): any; -export function cloneJSON(src: any): any; -export function cloneValue(src: any): any; -export function copyArray(src: any, dest: any): any; -export function copyCopyable(src: any, dest: any): any; -export function copyJSON(src: any): any; -export function copyValue(src: any): any; -export function createType(typeDefinition: any): any; -export function enableRemoteDevtools(remoteId: any): void; -declare class ComponentManager { - Components: any[]; - _ComponentsMap: {}; - _componentPool: {}; - numComponents: {}; - nextComponentId: number; - hasComponent(Component: any): boolean; - registerComponent(Component: any, objectPool: any): void; - componentAddedToEntity(Component: any): void; - componentRemovedFromEntity(Component: any): void; - getComponentsPool(Component: any): any; -} -/** - * @private - * @class EntityManager - */ -declare class EntityManager { - constructor(world: any); - world: any; - componentsManager: any; - _entities: any[]; - _nextEntityId: number; - _entitiesByNames: {}; - _queryManager: QueryManager; - eventDispatcher: EventDispatcher; - _entityPool: EntityPool; - entitiesWithComponentsToRemove: any[]; - entitiesToRemove: any[]; - deferredRemovalEnabled: boolean; - getEntityByName(name: any): any; - /** - * Create a new entity - */ - createEntity(name: any): any; - /** - * Add a component to an entity - * @param {Entity} entity Entity where the component will be added - * @param {Component} Component Component to be added to the entity - * @param {Object} values Optional values to replace the default attributes - */ - entityAddComponent(entity: Entity, Component: Component, values: Object): void; - /** - * Remove a component from an entity - * @param {Entity} entity Entity which will get removed the component - * @param {*} Component Component to remove from the entity - * @param {Bool} immediately If you want to remove the component immediately instead of deferred (Default is false) - */ - entityRemoveComponent(entity: Entity, Component: any, immediately: Bool): void; - _entityRemoveComponentSync(entity: any, Component: any, index: any): void; - /** - * Remove all the components from an entity - * @param {Entity} entity Entity from which the components will be removed - */ - entityRemoveAllComponents(entity: Entity, immediately: any): void; - /** - * Remove the entity from this manager. It will clear also its components - * @param {Entity} entity Entity to remove from the manager - * @param {Bool} immediately If you want to remove the component immediately instead of deferred (Default is false) - */ - removeEntity(entity: Entity, immediately: Bool): void; - _releaseEntity(entity: any, index: any): void; - /** - * Remove all entities from this manager - */ - removeAllEntities(): void; - processDeferredRemoval(): void; - /** - * Get a query based on a list of components - * @param {Array(Component)} Components List of components that will form the query - */ - queryComponents(Components: any): any; - /** - * Return number of entities - */ - count(): number; - /** - * Return some stats - */ - stats(): { - numEntities: number; - numQueries: number; - queries: {}; - numComponentPool: number; - componentPool: {}; - eventDispatcher: { - fired: number; - handled: number; - }; - }; -} -declare class SystemManager { - constructor(world: any); - _systems: any[]; - _executeSystems: any[]; - world: any; - lastExecutedSystem: any; - registerSystem(SystemClass: any, attributes: any): this; - unregisterSystem(SystemClass: any): this; - sortSystems(): void; - getSystem(SystemClass: any): any; - getSystems(): any[]; - removeSystem(SystemClass: any): void; - executeSystem(system: any, delta: any, time: any): void; - stop(): void; - execute(delta: any, time: any, forcePlay: any): void; - stats(): { - numSystems: number; - systems: {}; - }; -} -/** - * @private - * @class QueryManager - */ -declare class QueryManager { - constructor(world: any); - _world: any; - _queries: {}; - onEntityRemoved(entity: any): void; - /** - * Callback when a component is added to an entity - * @param {Entity} entity Entity that just got the new component - * @param {Component} Component Component added to the entity - */ - onEntityComponentAdded(entity: Entity, Component: Component): void; - /** - * Callback when a component is removed from an entity - * @param {Entity} entity Entity to remove the component from - * @param {Component} Component Component to remove from the entity - */ - onEntityComponentRemoved(entity: Entity, Component: Component): void; - /** - * Get a query for the specified components - * @param {Component} Components Components that the query should have - */ - getQuery(Components: Component): any; - /** - * Return some stats from this class - */ - stats(): {}; -} -/** - * @private - * @class EventDispatcher - */ -declare class EventDispatcher { - _listeners: {}; - stats: { - fired: number; - handled: number; - }; - /** - * Add an event listener - * @param {String} eventName Name of the event to listen - * @param {Function} listener Callback to trigger when the event is fired - */ - addEventListener(eventName: string, listener: Function): void; - /** - * Check if an event listener is already added to the list of listeners - * @param {String} eventName Name of the event to check - * @param {Function} listener Callback for the specified event - */ - hasEventListener(eventName: string, listener: Function): boolean; - /** - * Remove an event listener - * @param {String} eventName Name of the event to remove - * @param {Function} listener Callback for the specified event - */ - removeEventListener(eventName: string, listener: Function): void; - /** - * Dispatch an event - * @param {String} eventName Name of the event to dispatch - * @param {Entity} entity (Optional) Entity to emit - * @param {Component} component - */ - dispatchEvent(eventName: string, entity: Entity, component: Component): void; - /** - * Reset stats counters - */ - resetCounters(): void; -} -declare class EntityPool extends ObjectPool { - constructor(entityManager: any, entityClass: any, initialSize: any); - entityManager: any; -} -export { Entity as _Entity }; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts deleted file mode 100644 index 40983ceda..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/ktx-parse.module.d.ts +++ /dev/null @@ -1,299 +0,0 @@ -declare const Z: 15; -declare const q: 2; -declare const Q: 14; -declare const G: 1; -declare const R: 0; -declare const J: 13; -declare const u: 1; -declare const _: 0; -declare const s: 0; -declare const U: 162; -declare const f: 160; -declare const h: 163; -declare const c: 161; -declare const l: 1; -declare const p: 166; -declare const o: 0; -declare const H: 6; -declare const z: 7; -declare const Y: 11; -declare const N: 4; -declare const P: 2; -declare const M: 3; -declare const E: 1; -declare const W: 5; -declare const X: 10; -declare const j: 8; -declare const K: 9; -declare const S: 0; -declare const et: 32; -declare const $: 128; -declare const nt: 16; -declare const tt: 64; -declare const F: 16; -declare const O: 17; -declare const T: 18; -declare const w: 7; -declare const k: 12; -declare const B: 9; -declare const v: 8; -declare const b: 3; -declare const x: 1; -declare const m: 4; -declare const V: 14; -declare const I: 13; -declare const L: 10; -declare const A: 11; -declare const d: 5; -declare const D: 6; -declare const y: 2; -declare const C: 15; -declare const g: 0; -declare const a: 0; -declare const r: 2; -declare const e: 1; -declare const t: 0; -declare const i: 3; -declare const n: 2; -declare const Ut: 8; -declare const qt: 69; -declare const Rt: 65; -declare const Gt: 68; -declare const Yt: 64; -declare const Xt: 63; -declare const jt: 59; -declare const Kt: 62; -declare const zt: 58; -declare const Ii: 1000340001; -declare const ki: 1000340000; -declare const Bi: 1000066011; -declare const Xn: 180; -declare const Kn: 179; -declare const Di: 1000066008; -declare const Nn: 174; -declare const Mn: 173; -declare const wi: 1000066009; -declare const Hn: 176; -declare const Wn: 175; -declare const vi: 1000066010; -declare const jn: 178; -declare const zn: 177; -declare const Li: 1000066012; -declare const Rn: 182; -declare const Yn: 181; -declare const Ai: 1000066013; -declare const qn: 184; -declare const Gn: 183; -declare const _i: 1000066000; -declare const wn: 158; -declare const Dn: 157; -declare const ui: 1000066001; -declare const Bn: 160; -declare const vn: 159; -declare const gi: 1000066002; -declare const An: 162; -declare const Ln: 161; -declare const xi: 1000066003; -declare const In: 164; -declare const kn: 163; -declare const yi: 1000066004; -declare const Cn: 166; -declare const Vn: 165; -declare const bi: 1000066005; -declare const On: 168; -declare const Fn: 167; -declare const mi: 1000066006; -declare const Sn: 170; -declare const Tn: 169; -declare const di: 1000066007; -declare const Pn: 172; -declare const En: 171; -declare const We: 122; -declare const ti: 1000156011; -declare const ai: 1000156021; -declare const rt: 3; -declare const ct: 7; -declare const lt: 5; -declare const Wt: 49; -declare const Mt: 45; -declare const Ht: 50; -declare const Nt: 48; -declare const Pt: 44; -declare const Vt: 35; -declare const kt: 31; -declare const Ct: 36; -declare const It: 34; -declare const At: 30; -declare const Ze: 134; -declare const Qe: 133; -declare const Je: 132; -declare const qe: 131; -declare const tn: 136; -declare const $e: 135; -declare const nn: 138; -declare const en: 137; -declare const an: 140; -declare const sn: 139; -declare const on: 142; -declare const rn: 141; -declare const fn: 144; -declare const ln: 143; -declare const Un: 146; -declare const cn: 145; -declare const ze: 124; -declare const Ye: 128; -declare const Re: 129; -declare const Ke: 126; -declare const Ge: 130; -declare const He: 123; -declare const dn: 156; -declare const mn: 155; -declare const bn: 154; -declare const yn: 153; -declare const un: 150; -declare const _n: 149; -declare const xn: 152; -declare const gn: 151; -declare const pn: 148; -declare const hn: 147; -declare const $n: 1000156010; -declare const si: 1000156020; -declare const ci: 1000054004; -declare const ri: 1000054000; -declare const Ui: 1000054005; -declare const oi: 1000054001; -declare const hi: 1000054006; -declare const li: 1000054002; -declare const pi: 1000054007; -declare const fi: 1000054003; -declare const Zn: 1000156009; -declare const Qn: 1000156008; -declare const Jn: 1000156007; -declare const ii: 1000156019; -declare const ni: 1000156018; -declare const ei: 1000156017; -declare const ue: 97; -declare const _e: 96; -declare const he: 92; -declare const pe: 95; -declare const Ue: 91; -declare const ce: 90; -declare const fe: 89; -declare const oe: 85; -declare const le: 88; -declare const re: 84; -declare const ae: 83; -declare const se: 82; -declare const ne: 78; -declare const ie: 81; -declare const ee: 77; -declare const te: 76; -declare const $t: 75; -declare const Qt: 71; -declare const Zt: 74; -declare const Jt: 70; -declare const Ae: 109; -declare const Le: 108; -declare const Be: 107; -declare const ve: 106; -declare const we: 105; -declare const De: 104; -declare const de: 103; -declare const me: 102; -declare const be: 101; -declare const ye: 100; -declare const xe: 99; -declare const ge: 98; -declare const at: 2; -declare const st: 1; -declare const ft: 6; -declare const ot: 4; -declare const Ne: 121; -declare const Me: 120; -declare const Pe: 119; -declare const Ee: 118; -declare const Se: 117; -declare const Te: 116; -declare const Oe: 115; -declare const Fe: 114; -declare const Ce: 113; -declare const Ve: 112; -declare const Ie: 111; -declare const ke: 110; -declare const St: 42; -declare const Ot: 38; -declare const Et: 43; -declare const Tt: 41; -declare const Ft: 37; -declare const Bt: 28; -declare const wt: 24; -declare const Lt: 29; -declare const vt: 27; -declare const Dt: 23; -declare const mt: 21; -declare const yt: 17; -declare const dt: 22; -declare const bt: 20; -declare const xt: 16; -declare const ut: 14; -declare const pt: 10; -declare const gt: 15; -declare const _t: 13; -declare const ht: 9; -declare const Xe: 127; -declare const it: 0; -declare const je: 125; -declare function Vi(): { - vkFormat: number; - typeSize: number; - pixelWidth: number; - pixelHeight: number; - pixelDepth: number; - layerCount: number; - faceCount: number; - levelCount: number; - supercompressionScheme: number; - levels: never[]; - dataFormatDescriptor: { - vendorId: number; - descriptorType: number; - versionNumber: number; - colorModel: number; - colorPrimaries: number; - transferFunction: number; - flags: number; - texelBlockDimension: number[]; - bytesPlane: number[]; - samples: never[]; - }[]; - keyValue: {}; - globalData: null; -}; -declare function Mi(t: any): { - vkFormat: number; - typeSize: number; - pixelWidth: number; - pixelHeight: number; - pixelDepth: number; - layerCount: number; - faceCount: number; - levelCount: number; - supercompressionScheme: number; - levels: never[]; - dataFormatDescriptor: { - vendorId: number; - descriptorType: number; - versionNumber: number; - colorModel: number; - colorPrimaries: number; - transferFunction: number; - flags: number; - texelBlockDimension: number[]; - bytesPlane: number[]; - samples: never[]; - }[]; - keyValue: {}; - globalData: null; -}; -declare function Hi(t: any, e?: {}): Uint8Array; -export { Z as KHR_DF_CHANNEL_RGBSDA_ALPHA, q as KHR_DF_CHANNEL_RGBSDA_BLUE, Q as KHR_DF_CHANNEL_RGBSDA_DEPTH, G as KHR_DF_CHANNEL_RGBSDA_GREEN, R as KHR_DF_CHANNEL_RGBSDA_RED, J as KHR_DF_CHANNEL_RGBSDA_STENCIL, u as KHR_DF_FLAG_ALPHA_PREMULTIPLIED, _ as KHR_DF_FLAG_ALPHA_STRAIGHT, s as KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT, U as KHR_DF_MODEL_ASTC, f as KHR_DF_MODEL_ETC1, h as KHR_DF_MODEL_ETC1S, c as KHR_DF_MODEL_ETC2, l as KHR_DF_MODEL_RGBSDA, p as KHR_DF_MODEL_UASTC, o as KHR_DF_MODEL_UNSPECIFIED, H as KHR_DF_PRIMARIES_ACES, z as KHR_DF_PRIMARIES_ACESCC, Y as KHR_DF_PRIMARIES_ADOBERGB, N as KHR_DF_PRIMARIES_BT2020, P as KHR_DF_PRIMARIES_BT601_EBU, M as KHR_DF_PRIMARIES_BT601_SMPTE, E as KHR_DF_PRIMARIES_BT709, W as KHR_DF_PRIMARIES_CIEXYZ, X as KHR_DF_PRIMARIES_DISPLAYP3, j as KHR_DF_PRIMARIES_NTSC1953, K as KHR_DF_PRIMARIES_PAL525, S as KHR_DF_PRIMARIES_UNSPECIFIED, et as KHR_DF_SAMPLE_DATATYPE_EXPONENT, $ as KHR_DF_SAMPLE_DATATYPE_FLOAT, nt as KHR_DF_SAMPLE_DATATYPE_LINEAR, tt as KHR_DF_SAMPLE_DATATYPE_SIGNED, F as KHR_DF_TRANSFER_ACESCC, O as KHR_DF_TRANSFER_ACESCCT, T as KHR_DF_TRANSFER_ADOBERGB, w as KHR_DF_TRANSFER_BT1886, k as KHR_DF_TRANSFER_DCIP3, B as KHR_DF_TRANSFER_HLG_EOTF, v as KHR_DF_TRANSFER_HLG_OETF, b as KHR_DF_TRANSFER_ITU, x as KHR_DF_TRANSFER_LINEAR, m as KHR_DF_TRANSFER_NTSC, V as KHR_DF_TRANSFER_PAL625_EOTF, I as KHR_DF_TRANSFER_PAL_OETF, L as KHR_DF_TRANSFER_PQ_EOTF, A as KHR_DF_TRANSFER_PQ_OETF, d as KHR_DF_TRANSFER_SLOG, D as KHR_DF_TRANSFER_SLOG2, y as KHR_DF_TRANSFER_SRGB, C as KHR_DF_TRANSFER_ST240, g as KHR_DF_TRANSFER_UNSPECIFIED, a as KHR_DF_VENDORID_KHRONOS, r as KHR_DF_VERSION, e as KHR_SUPERCOMPRESSION_BASISLZ, t as KHR_SUPERCOMPRESSION_NONE, i as KHR_SUPERCOMPRESSION_ZLIB, n as KHR_SUPERCOMPRESSION_ZSTD, Ut as VK_FORMAT_A1R5G5B5_UNORM_PACK16, qt as VK_FORMAT_A2B10G10R10_SINT_PACK32, Rt as VK_FORMAT_A2B10G10R10_SNORM_PACK32, Gt as VK_FORMAT_A2B10G10R10_UINT_PACK32, Yt as VK_FORMAT_A2B10G10R10_UNORM_PACK32, Xt as VK_FORMAT_A2R10G10B10_SINT_PACK32, jt as VK_FORMAT_A2R10G10B10_SNORM_PACK32, Kt as VK_FORMAT_A2R10G10B10_UINT_PACK32, zt as VK_FORMAT_A2R10G10B10_UNORM_PACK32, Ii as VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT, ki as VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT, Bi as VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT, Xn as VK_FORMAT_ASTC_10x10_SRGB_BLOCK, Kn as VK_FORMAT_ASTC_10x10_UNORM_BLOCK, Di as VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT, Nn as VK_FORMAT_ASTC_10x5_SRGB_BLOCK, Mn as VK_FORMAT_ASTC_10x5_UNORM_BLOCK, wi as VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT, Hn as VK_FORMAT_ASTC_10x6_SRGB_BLOCK, Wn as VK_FORMAT_ASTC_10x6_UNORM_BLOCK, vi as VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT, jn as VK_FORMAT_ASTC_10x8_SRGB_BLOCK, zn as VK_FORMAT_ASTC_10x8_UNORM_BLOCK, Li as VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT, Rn as VK_FORMAT_ASTC_12x10_SRGB_BLOCK, Yn as VK_FORMAT_ASTC_12x10_UNORM_BLOCK, Ai as VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT, qn as VK_FORMAT_ASTC_12x12_SRGB_BLOCK, Gn as VK_FORMAT_ASTC_12x12_UNORM_BLOCK, _i as VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT, wn as VK_FORMAT_ASTC_4x4_SRGB_BLOCK, Dn as VK_FORMAT_ASTC_4x4_UNORM_BLOCK, ui as VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT, Bn as VK_FORMAT_ASTC_5x4_SRGB_BLOCK, vn as VK_FORMAT_ASTC_5x4_UNORM_BLOCK, gi as VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT, An as VK_FORMAT_ASTC_5x5_SRGB_BLOCK, Ln as VK_FORMAT_ASTC_5x5_UNORM_BLOCK, xi as VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT, In as VK_FORMAT_ASTC_6x5_SRGB_BLOCK, kn as VK_FORMAT_ASTC_6x5_UNORM_BLOCK, yi as VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT, Cn as VK_FORMAT_ASTC_6x6_SRGB_BLOCK, Vn as VK_FORMAT_ASTC_6x6_UNORM_BLOCK, bi as VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT, On as VK_FORMAT_ASTC_8x5_SRGB_BLOCK, Fn as VK_FORMAT_ASTC_8x5_UNORM_BLOCK, mi as VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT, Sn as VK_FORMAT_ASTC_8x6_SRGB_BLOCK, Tn as VK_FORMAT_ASTC_8x6_UNORM_BLOCK, di as VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT, Pn as VK_FORMAT_ASTC_8x8_SRGB_BLOCK, En as VK_FORMAT_ASTC_8x8_UNORM_BLOCK, We as VK_FORMAT_B10G11R11_UFLOAT_PACK32, ti as VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16, ai as VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16, rt as VK_FORMAT_B4G4R4A4_UNORM_PACK16, ct as VK_FORMAT_B5G5R5A1_UNORM_PACK16, lt as VK_FORMAT_B5G6R5_UNORM_PACK16, Wt as VK_FORMAT_B8G8R8A8_SINT, Mt as VK_FORMAT_B8G8R8A8_SNORM, Ht as VK_FORMAT_B8G8R8A8_SRGB, Nt as VK_FORMAT_B8G8R8A8_UINT, Pt as VK_FORMAT_B8G8R8A8_UNORM, Vt as VK_FORMAT_B8G8R8_SINT, kt as VK_FORMAT_B8G8R8_SNORM, Ct as VK_FORMAT_B8G8R8_SRGB, It as VK_FORMAT_B8G8R8_UINT, At as VK_FORMAT_B8G8R8_UNORM, Ze as VK_FORMAT_BC1_RGBA_SRGB_BLOCK, Qe as VK_FORMAT_BC1_RGBA_UNORM_BLOCK, Je as VK_FORMAT_BC1_RGB_SRGB_BLOCK, qe as VK_FORMAT_BC1_RGB_UNORM_BLOCK, tn as VK_FORMAT_BC2_SRGB_BLOCK, $e as VK_FORMAT_BC2_UNORM_BLOCK, nn as VK_FORMAT_BC3_SRGB_BLOCK, en as VK_FORMAT_BC3_UNORM_BLOCK, an as VK_FORMAT_BC4_SNORM_BLOCK, sn as VK_FORMAT_BC4_UNORM_BLOCK, on as VK_FORMAT_BC5_SNORM_BLOCK, rn as VK_FORMAT_BC5_UNORM_BLOCK, fn as VK_FORMAT_BC6H_SFLOAT_BLOCK, ln as VK_FORMAT_BC6H_UFLOAT_BLOCK, Un as VK_FORMAT_BC7_SRGB_BLOCK, cn as VK_FORMAT_BC7_UNORM_BLOCK, ze as VK_FORMAT_D16_UNORM, Ye as VK_FORMAT_D16_UNORM_S8_UINT, Re as VK_FORMAT_D24_UNORM_S8_UINT, Ke as VK_FORMAT_D32_SFLOAT, Ge as VK_FORMAT_D32_SFLOAT_S8_UINT, He as VK_FORMAT_E5B9G9R9_UFLOAT_PACK32, dn as VK_FORMAT_EAC_R11G11_SNORM_BLOCK, mn as VK_FORMAT_EAC_R11G11_UNORM_BLOCK, bn as VK_FORMAT_EAC_R11_SNORM_BLOCK, yn as VK_FORMAT_EAC_R11_UNORM_BLOCK, un as VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK, _n as VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK, xn as VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK, gn as VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK, pn as VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, hn as VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK, $n as VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16, si as VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16, ci as VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG, ri as VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG, Ui as VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG, oi as VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG, hi as VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG, li as VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG, pi as VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG, fi as VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG, Zn as VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16, Qn as VK_FORMAT_R10X6G10X6_UNORM_2PACK16, Jn as VK_FORMAT_R10X6_UNORM_PACK16, ii as VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16, ni as VK_FORMAT_R12X4G12X4_UNORM_2PACK16, ei as VK_FORMAT_R12X4_UNORM_PACK16, ue as VK_FORMAT_R16G16B16A16_SFLOAT, _e as VK_FORMAT_R16G16B16A16_SINT, he as VK_FORMAT_R16G16B16A16_SNORM, pe as VK_FORMAT_R16G16B16A16_UINT, Ue as VK_FORMAT_R16G16B16A16_UNORM, ce as VK_FORMAT_R16G16B16_SFLOAT, fe as VK_FORMAT_R16G16B16_SINT, oe as VK_FORMAT_R16G16B16_SNORM, le as VK_FORMAT_R16G16B16_UINT, re as VK_FORMAT_R16G16B16_UNORM, ae as VK_FORMAT_R16G16_SFLOAT, se as VK_FORMAT_R16G16_SINT, ne as VK_FORMAT_R16G16_SNORM, ie as VK_FORMAT_R16G16_UINT, ee as VK_FORMAT_R16G16_UNORM, te as VK_FORMAT_R16_SFLOAT, $t as VK_FORMAT_R16_SINT, Qt as VK_FORMAT_R16_SNORM, Zt as VK_FORMAT_R16_UINT, Jt as VK_FORMAT_R16_UNORM, Ae as VK_FORMAT_R32G32B32A32_SFLOAT, Le as VK_FORMAT_R32G32B32A32_SINT, Be as VK_FORMAT_R32G32B32A32_UINT, ve as VK_FORMAT_R32G32B32_SFLOAT, we as VK_FORMAT_R32G32B32_SINT, De as VK_FORMAT_R32G32B32_UINT, de as VK_FORMAT_R32G32_SFLOAT, me as VK_FORMAT_R32G32_SINT, be as VK_FORMAT_R32G32_UINT, ye as VK_FORMAT_R32_SFLOAT, xe as VK_FORMAT_R32_SINT, ge as VK_FORMAT_R32_UINT, at as VK_FORMAT_R4G4B4A4_UNORM_PACK16, st as VK_FORMAT_R4G4_UNORM_PACK8, ft as VK_FORMAT_R5G5B5A1_UNORM_PACK16, ot as VK_FORMAT_R5G6B5_UNORM_PACK16, Ne as VK_FORMAT_R64G64B64A64_SFLOAT, Me as VK_FORMAT_R64G64B64A64_SINT, Pe as VK_FORMAT_R64G64B64A64_UINT, Ee as VK_FORMAT_R64G64B64_SFLOAT, Se as VK_FORMAT_R64G64B64_SINT, Te as VK_FORMAT_R64G64B64_UINT, Oe as VK_FORMAT_R64G64_SFLOAT, Fe as VK_FORMAT_R64G64_SINT, Ce as VK_FORMAT_R64G64_UINT, Ve as VK_FORMAT_R64_SFLOAT, Ie as VK_FORMAT_R64_SINT, ke as VK_FORMAT_R64_UINT, St as VK_FORMAT_R8G8B8A8_SINT, Ot as VK_FORMAT_R8G8B8A8_SNORM, Et as VK_FORMAT_R8G8B8A8_SRGB, Tt as VK_FORMAT_R8G8B8A8_UINT, Ft as VK_FORMAT_R8G8B8A8_UNORM, Bt as VK_FORMAT_R8G8B8_SINT, wt as VK_FORMAT_R8G8B8_SNORM, Lt as VK_FORMAT_R8G8B8_SRGB, vt as VK_FORMAT_R8G8B8_UINT, Dt as VK_FORMAT_R8G8B8_UNORM, mt as VK_FORMAT_R8G8_SINT, yt as VK_FORMAT_R8G8_SNORM, dt as VK_FORMAT_R8G8_SRGB, bt as VK_FORMAT_R8G8_UINT, xt as VK_FORMAT_R8G8_UNORM, ut as VK_FORMAT_R8_SINT, pt as VK_FORMAT_R8_SNORM, gt as VK_FORMAT_R8_SRGB, _t as VK_FORMAT_R8_UINT, ht as VK_FORMAT_R8_UNORM, Xe as VK_FORMAT_S8_UINT, it as VK_FORMAT_UNDEFINED, je as VK_FORMAT_X8_D24_UNORM_PACK32, Vi as createDefaultContainer, Mi as read, Hi as write }; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts deleted file mode 100644 index 2a69ddc7e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_clusterizer.module.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -export var MeshoptClusterizer: { - supported: boolean; - ready?: undefined; - buildMeshlets?: undefined; - buildMeshletsFlex?: undefined; - buildMeshletsSpatial?: undefined; - extractMeshlet?: undefined; - encodeMeshlet?: undefined; - computeClusterBounds?: undefined; - computeMeshletBounds?: undefined; - computeSphereBounds?: undefined; -} | { - ready: Promise; - supported: boolean; - buildMeshlets: (indices: any, vertex_positions: any, vertex_positions_stride: any, max_vertices: any, max_triangles: any, cone_weight: any) => { - meshlets: Uint32Array; - vertices: Uint32Array; - triangles: Uint8Array; - meshletCount: any; - }; - buildMeshletsFlex: (indices: any, vertex_positions: any, vertex_positions_stride: any, max_vertices: any, min_triangles: any, max_triangles: any, cone_weight: any, split_factor: any) => { - meshlets: Uint32Array; - vertices: Uint32Array; - triangles: Uint8Array; - meshletCount: any; - }; - buildMeshletsSpatial: (indices: any, vertex_positions: any, vertex_positions_stride: any, max_vertices: any, min_triangles: any, max_triangles: any, fill_weight: any) => { - meshlets: Uint32Array; - vertices: Uint32Array; - triangles: Uint8Array; - meshletCount: any; - }; - extractMeshlet: (buffers: any, index: any) => { - vertices: any; - triangles: any; - }; - encodeMeshlet: (vertices: any, triangles: any, level: any) => Uint8Array; - computeClusterBounds: (indices: any, vertex_positions: any, vertex_positions_stride: any) => { - centerX: number; - centerY: number; - centerZ: number; - radius: number; - coneApexX: number; - coneApexY: number; - coneApexZ: number; - coneAxisX: number; - coneAxisY: number; - coneAxisZ: number; - coneCutoff: number; - }; - computeMeshletBounds: (buffers: any, vertex_positions: any, vertex_positions_stride: any) => { - centerX: number; - centerY: number; - centerZ: number; - radius: number; - coneApexX: number; - coneApexY: number; - coneApexZ: number; - coneAxisX: number; - coneAxisY: number; - coneAxisZ: number; - coneCutoff: number; - }[]; - computeSphereBounds: (positions: any, positions_stride: any, radii: any, radii_stride: any) => { - centerX: number; - centerY: number; - centerZ: number; - radius: number; - coneApexX: number; - coneApexY: number; - coneApexZ: number; - coneAxisX: number; - coneAxisY: number; - coneAxisZ: number; - coneCutoff: number; - }; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts deleted file mode 100644 index a2637cd13..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_decoder.module.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export var MeshoptDecoder: { - supported: boolean; - ready?: undefined; - useWorkers?: undefined; - decodeVertexBuffer?: undefined; - decodeIndexBuffer?: undefined; - decodeIndexSequence?: undefined; - decodeGltfBuffer?: undefined; - decodeGltfBufferAsync?: undefined; -} | { - ready: Promise; - supported: boolean; - useWorkers: (count: any) => void; - decodeVertexBuffer: (target: any, count: any, size: any, source: any, filter: any) => void; - decodeIndexBuffer: (target: any, count: any, size: any, source: any) => void; - decodeIndexSequence: (target: any, count: any, size: any, source: any) => void; - decodeGltfBuffer: (target: any, count: any, size: any, source: any, mode: any, filter: any) => void; - decodeGltfBufferAsync: (count: any, size: any, source: any, mode: any, filter: any) => Promise; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts deleted file mode 100644 index 307df7a41..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/meshopt_simplifier.module.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export var MeshoptSimplifier: { - supported: boolean; - ready?: undefined; - compactMesh?: undefined; - generatePositionRemap?: undefined; - simplify?: undefined; - simplifyWithAttributes?: undefined; - simplifyWithUpdate?: undefined; - getScale?: undefined; - simplifyPoints?: undefined; - simplifySloppy?: undefined; - simplifyPrune?: undefined; -} | { - ready: Promise; - supported: boolean; - compactMesh: (indices: any) => any[]; - generatePositionRemap: (vertex_positions: any, vertex_positions_stride: any) => Uint32Array; - simplify: (indices: any, vertex_positions: any, vertex_positions_stride: any, target_index_count: any, target_error: any, flags: any) => (number | Uint32Array)[]; - simplifyWithAttributes: (indices: any, vertex_positions: any, vertex_positions_stride: any, vertex_attributes: any, vertex_attributes_stride: any, attribute_weights: any, vertex_lock: any, target_index_count: any, target_error: any, flags: any) => (number | Uint32Array)[]; - simplifyWithUpdate: (indices: any, vertex_positions: any, vertex_positions_stride: any, vertex_attributes: any, vertex_attributes_stride: any, attribute_weights: any, vertex_lock: any, target_index_count: any, target_error: any, flags: any) => any[]; - getScale: (vertex_positions: any, vertex_positions_stride: any) => any; - simplifyPoints: (vertex_positions: any, vertex_positions_stride: any, target_vertex_count: any, vertex_colors: any, vertex_colors_stride: any, color_weight: any) => Uint32Array; - simplifySloppy: (indices: any, vertex_positions: any, vertex_positions_stride: any, vertex_lock: any, target_index_count: any, target_error: any) => (number | Uint32Array)[]; - simplifyPrune: (indices: any, vertex_positions: any, vertex_positions_stride: any, target_error: any) => Uint32Array; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts deleted file mode 100644 index 8bee20d6e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/mikktspace.module.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** -* Generates vertex tangents for the given position/normal/texcoord attributes. -* @param {Float32Array} position -* @param {Float32Array} normal -* @param {Float32Array} texcoord -* @returns {Float32Array} -*/ -export function generateTangents(position: Float32Array, normal: Float32Array, texcoord: Float32Array): Float32Array; -export function dispose(): void; -export function __wbindgen_string_new(arg0: any, arg1: any): number; -export function __wbindgen_rethrow(arg0: any): never; -export let wasm: any; -export let isReady: boolean; -export namespace ready { - function then(onFulfilled: any, onRejected: any): any; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts deleted file mode 100644 index 105f5023d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/motion-controllers.module.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export namespace Constants { - let Handedness: Readonly<{ - NONE: "none"; - LEFT: "left"; - RIGHT: "right"; - }>; - let ComponentState: Readonly<{ - DEFAULT: "default"; - TOUCHED: "touched"; - PRESSED: "pressed"; - }>; - let ComponentProperty: Readonly<{ - BUTTON: "button"; - X_AXIS: "xAxis"; - Y_AXIS: "yAxis"; - STATE: "state"; - }>; - let ComponentType: Readonly<{ - TRIGGER: "trigger"; - SQUEEZE: "squeeze"; - TOUCHPAD: "touchpad"; - THUMBSTICK: "thumbstick"; - BUTTON: "button"; - }>; - let ButtonTouchThreshold: number; - let AxisTouchThreshold: number; - let VisualResponseProperty: Readonly<{ - TRANSFORM: "transform"; - VISIBILITY: "visibility"; - }>; -} -/** - * @description Builds a motion controller with components and visual responses based on the - * supplied profile description. Data is polled from the xrInputSource's gamepad. - * @author Nell Waliczek / https://github.com/NellWaliczek -*/ -export class MotionController { - /** - * @param {Object} xrInputSource - The XRInputSource to build the MotionController around - * @param {Object} profile - The best matched profile description for the supplied xrInputSource - * @param {string} assetUrl - */ - constructor(xrInputSource: Object, profile: Object, assetUrl: string); - xrInputSource: Object; - assetUrl: string; - id: any; - layoutDescription: any; - components: {}; - get gripSpace(): any; - get targetRaySpace(): any; - /** - * @description Returns a subset of component data for simplified debugging - */ - get data(): any[]; - /** - * @description Poll for updated data based on current gamepad state - */ - updateFromGamepad(): void; -} -export function fetchProfile(xrInputSource: any, basePath: any, defaultProfile?: null, getAssetPath?: boolean): Promise<{ - profile: any; - assetPath: string | undefined; -}>; -export function fetchProfilesList(basePath: any): Promise; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts deleted file mode 100644 index 2830d6809..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/potpack.module.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * potpack - by [@mourner](https://github.com/mourner) - * - * A tiny JavaScript function for packing 2D rectangles into a near-square container, - * which is useful for generating CSS sprites and WebGL textures. Similar to - * [shelf-pack](https://github.com/mapbox/shelf-pack), but static (you can't add items - * once a layout is generated), and aims for maximal space utilization. - * - * A variation of algorithms used in [rectpack2D](https://github.com/TeamHypersomnia/rectpack2D) - * and [bin-pack](https://github.com/bryanburgers/bin-pack), which are in turn based - * on [this article by Blackpawn](http://blackpawn.com/texts/lightmaps/default.html). - * - * @license - * ISC License - * - * Copyright (c) 2018, Mapbox - * - * Permission to use, copy, modify, and/or distribute this software for any purpose - * with or without fee is hereby granted, provided that the above copyright notice - * and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF - * THIS SOFTWARE. - */ -export function potpack(boxes: any): { - w: number; - h: number; - fill: number; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts deleted file mode 100644 index aeae725f1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/stats.module.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export default Stats; -declare function Stats(): { - REVISION: number; - dom: HTMLDivElement; - addPanel: (panel: any) => any; - showPanel: (id: any) => void; - begin: () => void; - end: () => number; - update: () => void; - domElement: HTMLDivElement; - setMode: (id: any) => void; -}; -declare namespace Stats { - function Panel(name: any, fg: any, bg: any): { - dom: HTMLCanvasElement; - update: (value: any, maxValue: any) => void; - }; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts deleted file mode 100644 index 4c6302df7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/surfaceNet.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * SurfaceNets in JavaScript - * - * Written by Mikola Lysenko (C) 2012 - * - * MIT License - * - * Based on: S.F. Gibson, 'Constrained Elastic Surface Nets'. (1998) MERL Tech Report. - * from https://github.com/mikolalysenko/isosurface/tree/master - * - */ -export function surfaceNet(dims: any, potential: any, bounds: any): { - positions: number[][]; - cells: any[][]; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts deleted file mode 100644 index d3233f736..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/utif.module.d.ts +++ /dev/null @@ -1,156 +0,0 @@ -export default UTIF; -declare namespace UTIF { - function encodeImage(rgba: any, w: any, h: any, metadata: any): ArrayBuffer; - function encode(ifds: any): ArrayBuffer; - function decode(buff: any, prm: any): any[]; - namespace decode { - function _decompress(img: any, ifds: any, data: any, off: any, len: any, cmpr: any, tgt: any, toff: any, fo: any, w: any, h: any): void; - function _decodePanasonic(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; - function _decodeVC5(t: any, E: any, h: any, L: any, g: any, n: any): void; - function _decodeLogLuv32(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; - function _ljpeg_diff(data: any, prm: any, huff: any): number; - function _decodeARW(img: any, inp: any, off: any, src_length: any, tgt: any, toff: any): void; - function _decodeNikon(img: any, imgs: any, data: any, off: any, src_length: any, tgt: any, toff: any): void; - function _putsF(dt: any, pos: any, val: any): void; - function _getbithuff(data: any, prm: any, nbits: any, huff: any): number; - function _make_decoder(source: any): number[]; - function _decodeNewJPEG(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; - function _decodeOldJPEGInit(img: any, data: any, off: any, len: any): { - jpegOffset: any; - tables?: undefined; - sosMarker?: undefined; - sofPosition?: undefined; - } | { - jpegOffset: any; - tables: Uint8Array; - sosMarker: Uint8Array; - sofPosition: number; - }; - function _decodeOldJPEG(img: any, data: any, off: any, len: any, tgt: any, toff: any): void; - function _decodePackBits(data: any, off: any, len: any, tgt: any, toff: any): any; - function _decodeThunder(data: any, off: any, len: any, tgt: any, toff: any): void; - let _dmap: { - "1": number; - "011": number; - "000011": number; - "0000011": number; - "010": number; - "000010": number; - "0000010": number; - }; - let _lens: {}[]; - function _decodeG4(data: any, off: any, slen: any, tgt: any, toff: any, w: any, fo: any): void; - function _findDiff(line: any, x: any, clr: any): any; - function _makeDiff(line: any): any[]; - function _decodeG2(data: any, off: any, slen: any, tgt: any, toff: any, w: any, fo: any): void; - function _decodeG3(data: any, off: any, slen: any, tgt: any, toff: any, w: any, fo: any, twoDim: any): void; - function _addNtimes(arr: any, n: any, val: any): void; - function _writeBits(bits: any, tgt: any, boff: any): void; - let _decodeLZW: any; - } - function decodeImage(buff: any, img: any, ifds: any): void; - let tags: {}; - namespace _types { - namespace basic { - export { main }; - export { rest }; - } - namespace gps { - let main_1: number[]; - export { main_1 as main }; - let rest_1: { - 18: number; - 29: number; - }; - export { rest_1 as rest }; - } - } - function _readIFD(bin: any, data: any, offset: any, ifds: any, depth: any, prm: any): any; - function _writeIFD(bin: any, types: any, data: any, offset: any, ifd: any): any[]; - function toRGBA8(out: any, scl: any): Uint8Array; - function replaceIMG(imgs: any): void; - let _xhrs: any[]; - let _imgs: any[]; - function _imgLoaded(e: any): void; - function bufferToURI(buff: any): string; - namespace _binBE { - let ui8: Uint8Array; - let i16: Int16Array; - let i32: Int32Array; - let ui32: Uint32Array; - let fl32: Float32Array; - let fl64: Float64Array; - } - namespace _binLE { - import nextZero = nextZero; - export { nextZero }; - export function readUshort(buff: any, p: any): number; - export function readShort(buff: any, p: any): any; - export function readInt(buff: any, p: any): any; - export function readUint(buff: any, p: any): any; - import readASCII = readASCII; - export { readASCII }; - export function readFloat(buff: any, p: any): any; - export function readDouble(buff: any, p: any): any; - export function writeUshort(buff: any, p: any, n: any): void; - export function writeInt(buff: any, p: any, n: any): void; - export function writeUint(buff: any, p: any, n: any): void; - import writeASCII = writeASCII; - export { writeASCII }; - } - function _copyTile(tb: any, tw: any, th: any, b: any, w: any, h: any, xoff: any, yoff: any): void; - function _inflateRaw(N: any, W: any): any; - function LosslessJpegDecode(h: any): Uint8Array | Uint16Array; -} -declare var main: any[]; -declare var rest: { - 33432: number; - 33434: number; - 33437: number; - 34665: number; - 34850: number; - 34853: number; - 34855: number; - 34864: number; - 34866: number; - 36864: number; - 36867: number; - 36868: number; - 37121: number; - 37377: number; - 37378: number; - 37380: number; - 37381: number; - 37383: number; - 37384: number; - 37385: number; - 37386: number; - 37510: number; - 37520: number; - 37521: number; - 37522: number; - 40960: number; - 40961: number; - 40962: number; - 40963: number; - 40965: number; - 41486: number; - 41487: number; - 41488: number; - 41985: number; - 41986: number; - 41987: number; - 41988: number; - 41989: number; - 41990: number; - 41993: number; - 41994: number; - 41995: number; - 41996: number; - 42032: number; - 42033: number; - 42034: number; - 42036: number; - 42037: number; - 59932: number; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts b/jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts deleted file mode 100644 index 6486bf3f1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/libs/zstddec.module.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { Q as ZSTDDecoder }; -declare class Q { - init(): any; - _init(A: any): void; - decode(A: any, g?: number): any; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts deleted file mode 100644 index 66ac1de37..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lighting/ClusteredLighting.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * A custom lighting implementation based on Forward+ Clustered Shading that - * overwrites the default lighting system in {@link WebGPURenderer}. Suitable - * for 3D scenes with many point lights and real depth complexity — the view - * frustum is partitioned into a 3D cluster grid so only the lights actually - * reaching each fragment are evaluated. - * - * ```js - * const lighting = new ClusteredLighting(); - * renderer.lighting = lighting; // set lighting system - * ``` - * - * @augments Lighting - * @three_import import { ClusteredLighting } from 'three/addons/lighting/ClusteredLighting.js'; - */ -export class ClusteredLighting extends Lighting { - /** - * Constructs a new clustered lighting system. - * - * @param {number} [maxLights=1024] - Maximum number of point lights. - * @param {number} [tileSize=32] - Screen tile size in pixels (cluster XY size). - * @param {number} [zSlices=24] - Number of exponential depth slices. - * @param {number} [maxLightsPerCluster=64] - Per-cluster light-list capacity. - */ - constructor(maxLights?: number, tileSize?: number, zSlices?: number, maxLightsPerCluster?: number); - maxLights: number; - tileSize: number; - zSlices: number; - maxLightsPerCluster: number; - /** - * Creates a new clustered lights node for the given array of lights. - * - * This method is called internally by the renderer and must be overwritten by - * all custom lighting implementations. - * - * @param {Array} lights - The lights. - * @return {ClusteredLightsNode} The clustered lights node. - */ - createNode(lights?: Array): ClusteredLightsNode; -} -import { Lighting } from 'three/webgpu'; -import ClusteredLightsNode from '../tsl/lighting/ClusteredLightsNode.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts deleted file mode 100644 index 1dd73c216..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lighting/DynamicLighting.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * A custom lighting implementation that batches supported analytic lights into - * uniform arrays so light count changes do not recompile materials. - * - * ```js - * const lighting = new DynamicLighting( { maxPointLights: 64 } ); - * renderer.lighting = lighting; - * ``` - * - * @augments Lighting - * @three_import import { DynamicLighting } from 'three/addons/lighting/DynamicLighting.js'; - */ -export class DynamicLighting extends Lighting { - /** - * Constructs a new dynamic lighting system. - * - * @param {Object} [options={}] - Dynamic lighting configuration. - * @param {number} [options.maxDirectionalLights=8] - Maximum number of batched directional lights. - * @param {number} [options.maxPointLights=16] - Maximum number of batched point lights. - * @param {number} [options.maxSpotLights=16] - Maximum number of batched spot lights. - * @param {number} [options.maxHemisphereLights=4] - Maximum number of batched hemisphere lights. - */ - constructor(options?: { - maxDirectionalLights?: number | undefined; - maxPointLights?: number | undefined; - maxSpotLights?: number | undefined; - maxHemisphereLights?: number | undefined; - }); - options: { - maxDirectionalLights: number; - maxPointLights: number; - maxSpotLights: number; - maxHemisphereLights: number; - }; - _nodes: WeakMap; - /** - * Creates a new dynamic lights node for the given array of lights. - * - * @param {Array} lights - The lights to bind to the node. - * @return {DynamicLightsNode} The dynamic lights node. - */ - createNode(lights?: Array): DynamicLightsNode; - /** - * Returns a lights node for the given scene. - * - * @param {Scene} scene - The scene. - * @return {LightsNode} The lights node. - */ - getNode(scene: Scene): LightsNode; -} -export default DynamicLighting; -import { Lighting } from 'three/webgpu'; -import DynamicLightsNode from '../tsl/lighting/DynamicLightsNode.js'; -import { LightsNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts deleted file mode 100644 index b4dd1eaec..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGrid.d.ts +++ /dev/null @@ -1,143 +0,0 @@ -/** - * A 3D grid of L2 Spherical Harmonic irradiance probes that provides - * position-dependent diffuse global illumination. - * - * This is the {@link WebGPURenderer} version of `LightProbeGrid`. The grid is a - * {@link Light}, so adding it to the scene applies its baked irradiance to every - * lit node material automatically. When using {@link WebGLRenderer}, import the - * grid from `LightProbeGridWebGL.js` instead. - * - * The baked data is stored in a single RGBA `RenderTarget3D` atlas that packs - * the nine L2 SH coefficients into seven sub-volumes stacked along Z. Baking is - * fully GPU-resident: cubemap rendering, SH projection, and texture packing all - * happen on the GPU with zero CPU readback. - * - * @augments Light - * @three_import import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; - */ -export class LightProbeGrid extends Light { - /** - * Constructs a new irradiance probe grid. - * - * The volume is centered at the object's position. - * - * @param {number} [width=1] - Full width of the volume along X. - * @param {number} [height=1] - Full height of the volume along Y. - * @param {number} [depth=1] - Full depth of the volume along Z. - * @param {number} [widthProbes] - Number of probes along X. Defaults to `Math.max( 2, Math.round( width ) + 1 )`. - * @param {number} [heightProbes] - Number of probes along Y. Defaults to `Math.max( 2, Math.round( height ) + 1 )`. - * @param {number} [depthProbes] - Number of probes along Z. Defaults to `Math.max( 2, Math.round( depth ) + 1 )`. - */ - constructor(width?: number, height?: number, depth?: number, widthProbes?: number, heightProbes?: number, depthProbes?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLightProbeGrid: boolean; - /** - * The full width of the volume along X. - * - * @type {number} - */ - width: number; - /** - * The full height of the volume along Y. - * - * @type {number} - */ - height: number; - /** - * The full depth of the volume along Z. - * - * @type {number} - */ - depth: number; - /** - * The number of probes along each axis. - * - * @type {Vector3} - */ - resolution: Vector3; - /** - * The world-space bounding box for the grid. Updated automatically - * by {@link LightProbeGrid#bake}. - * - * @type {Box3} - */ - boundingBox: Box3; - /** - * Distance in world units over which the grid contribution fades out - * past the volume boundary. `0` applies the contribution everywhere - * (clamped), which matches a single-volume setup. Use a small positive - * value to blend multiple overlapping grids. - * - * @type {number} - * @default 0 - */ - falloff: number; - /** - * The single RGBA atlas 3D texture storing all seven packed SH - * sub-volumes stacked along Z. - * - * @type {?Data3DTexture} - * @default null - */ - texture: Data3DTexture | null; - /** - * Internal render target for GPU-resident baking. - * - * @private - * @type {?RenderTarget3D} - * @default null - */ - private _renderTarget; - /** - * Returns the world-space position of the probe at grid indices (ix, iy, iz). - * - * @param {number} ix - X index. - * @param {number} iy - Y index. - * @param {number} iz - Z index. - * @param {Vector3} target - The target vector. - * @return {Vector3} The world-space position. - */ - getProbePosition(ix: number, iy: number, iz: number, target: Vector3): Vector3; - /** - * Updates the world-space bounding box from the current position and size. - */ - updateBoundingBox(): void; - /** - * Bakes all probes by rendering cubemaps at each probe position and - * projecting to L2 SH. Optionally iterates additional passes to capture - * indirect bounces: each extra pass samples the previous pass's data as - * indirect light, so a grid added to the scene before baking accumulates - * one bounce per extra pass. - * - * @param {WebGPURenderer} renderer - The renderer. - * @param {Scene} scene - The scene to render. - * @param {Object} [options] - Bake options. - * @param {number} [options.cubemapSize=8] - Resolution of each cubemap face. - * @param {number} [options.near=0.1] - Near plane for the cube camera. - * @param {number} [options.far=100] - Far plane for the cube camera. - * @param {number} [options.bounces=0] - Additional bounce passes after the initial direct pass. - * @param {number} [options.sampleCount=512] - Directions integrated when projecting each cubemap to SH. - */ - bake(renderer: WebGPURenderer, scene: Scene, options?: { - cubemapSize?: number | undefined; - near?: number | undefined; - far?: number | undefined; - bounces?: number | undefined; - sampleCount?: number | undefined; - }): void; - /** - * Ensures the atlas 3D texture exists with the correct dimensions. - * - * @private - */ - private _ensureTextures; -} -import { Light } from 'three/webgpu'; -import { Vector3 } from 'three/webgpu'; -import { Box3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts deleted file mode 100644 index d1ad9cd51..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lighting/LightProbeGridWebGL.d.ts +++ /dev/null @@ -1,147 +0,0 @@ -/** - * A 3D grid of L2 Spherical Harmonic irradiance probes that provides - * position-dependent diffuse global illumination. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * A version for {@link WebGPURenderer} will be added at a later point. - * - * All seven packed SH sub-volumes are stored in a **single** RGBA - * `WebGL3DRenderTarget` using a texture-atlas layout along the Z axis. - * Each sub-volume occupies `( nz + 2 )` atlas slices: one padding slice at - * each end (a copy of the nearest edge data slice) to prevent color bleeding - * when the hardware trilinear filter reads across a sub-volume boundary. - * - * Atlas layout (nz = resolution.z, PADDING = 1): - * ``` - * slice 0 : padding (copy of sub-volume 0, data slice 0) - * slices 1 … nz : sub-volume 0 data - * slice nz + 1 : padding (copy of sub-volume 0, data slice nz-1) - * slice nz + 2 : padding (copy of sub-volume 1, data slice 0) - * slices nz+3 … 2*nz+2 : sub-volume 1 data - * … - * ``` - * Total atlas depth = `7 * ( nz + 2 )`. - * - * Baking is fully GPU-resident: cubemap rendering, SH projection, and - * texture packing all happen on the GPU with zero CPU readback. - * - * @three_import import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; - */ -export class LightProbeGridWebGL extends Object3D { - /** - * Constructs a new irradiance probe grid. - * - * The volume is centered at the object's position. - * - * @param {number} [width=1] - Full width of the volume along X. - * @param {number} [height=1] - Full height of the volume along Y. - * @param {number} [depth=1] - Full depth of the volume along Z. - * @param {number} [widthProbes] - Number of probes along X. Defaults to `Math.max( 2, Math.round( width ) + 1 )`. - * @param {number} [heightProbes] - Number of probes along Y. Defaults to `Math.max( 2, Math.round( height ) + 1 )`. - * @param {number} [depthProbes] - Number of probes along Z. Defaults to `Math.max( 2, Math.round( depth ) + 1 )`. - */ - constructor(width?: number, height?: number, depth?: number, widthProbes?: number, heightProbes?: number, depthProbes?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLightProbeGrid: boolean; - /** - * The full width of the volume along X. - * - * @type {number} - */ - width: number; - /** - * The full height of the volume along Y. - * - * @type {number} - */ - height: number; - /** - * The full depth of the volume along Z. - * - * @type {number} - */ - depth: number; - /** - * The number of probes along each axis. - * - * @type {Vector3} - */ - resolution: Vector3; - /** - * The world-space bounding box for the grid. Updated automatically - * by {@link LightProbeGridWebGL#bake}. - * - * @type {Box3} - */ - boundingBox: Box3; - /** - * The single RGBA atlas 3D texture storing all seven packed SH sub-volumes. - * - * @type {?Data3DTexture} - * @default null - */ - texture: Data3DTexture | null; - /** - * Internal render target for GPU-resident baking. - * - * @private - * @type {?WebGL3DRenderTarget} - * @default null - */ - private _renderTarget; - /** - * Returns the world-space position of the probe at grid indices (ix, iy, iz). - * - * @param {number} ix - X index. - * @param {number} iy - Y index. - * @param {number} iz - Z index. - * @param {Vector3} target - The target vector. - * @return {Vector3} The world-space position. - */ - getProbePosition(ix: number, iy: number, iz: number, target: Vector3): Vector3; - /** - * Updates the world-space bounding box from the current position and size. - */ - updateBoundingBox(): void; - /** - * Bakes all probes by rendering cubemaps at each probe position - * and projecting to L2 SH. Optionally iterates additional passes to - * capture indirect bounces — each extra pass samples the previous pass's - * atlas as indirect light, so a grid added to the scene before baking - * accumulates one bounce per extra pass. - * - * Shadow-casting instances of `SunLight` are temporarily replaced with - * equivalent directional lights, since their view-fitted shadow cascades - * cannot be frozen across probe renders. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {Scene} scene - The scene to render. - * @param {Object} [options] - Bake options. - * @param {number} [options.cubemapSize=8] - Resolution of each cubemap face. - * @param {number} [options.near=0.1] - Near plane for the cube camera. - * @param {number} [options.far=100] - Far plane for the cube camera. - * @param {number} [options.bounces=0] - Additional bounce passes after the initial direct pass. - */ - bake(renderer: WebGLRenderer, scene: Scene, options?: { - cubemapSize?: number | undefined; - near?: number | undefined; - far?: number | undefined; - bounces?: number | undefined; - }): void; - /** - * Ensures the atlas 3D render target exists with the correct dimensions. - * - * @private - */ - private _ensureTextures; -} -import { Object3D } from 'three'; -import { Vector3 } from 'three'; -import { Box3 } from 'three'; -import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts deleted file mode 100644 index b1ccbcbd9..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lights/LightProbeGenerator.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Utility class for creating instances of {@link LightProbe}. - * - * @hideconstructor - * @three_import import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; - */ -export class LightProbeGenerator { - /** - * Creates a light probe from the given (radiance) environment map. - * The method expects that the environment map is represented as a cube texture. - * - * @param {CubeTexture} cubeTexture - The environment map. - * @return {LightProbe} The created light probe. - */ - static fromCubeTexture(cubeTexture: CubeTexture): LightProbe; - /** - * Creates a light probe from the given (radiance) environment map. - * The method expects that the environment map is represented as a cube render target. - * - * The cube render target must be in RGBA so `cubeRenderTarget.texture.format` must be - * set to {@link RGBAFormat}. - * - * @async - * @param {WebGPURenderer|WebGLRenderer} renderer - The renderer. - * @param {CubeRenderTarget|WebGLCubeRenderTarget} cubeRenderTarget - The environment map. - * @return {Promise} A Promise that resolves with the created light probe. - */ - static fromCubeRenderTarget(renderer: WebGPURenderer | WebGLRenderer, cubeRenderTarget: CubeRenderTarget | WebGLCubeRenderTarget): Promise; -} -import { LightProbe } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts deleted file mode 100644 index 833559dbc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightTexturesLib.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Texture library for {@link RectAreaLight}. This class holds the LTC BRDF data - * in data textures for further use in the renderer. - * - * Reference: Real-Time Polygonal-Light Shading with Linearly Transformed Cosines - * by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. [Code](https://github.com/selfshadow/ltc_code/). - * - * NOTE: This is a temporary location for the BRDF approximation texture data - * based off of Eric Heitz's work (see citation). BRDF data for - * `RectAreaLight` is currently approximated using a precomputed texture - * of roughly 80kb in size. The hope is to find a better way to include - * the large texture data before including the full RectAreaLight implementation - * in the main build files. - * - * @hideconstructor - * @three_import import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; - */ -export class RectAreaLightTexturesLib { - /** - * Inits the texture library. - * - * @return {RectAreaLightTexturesLib} - */ - static init(): RectAreaLightTexturesLib; -} -export namespace RectAreaLightTexturesLib { - let LTC_HALF_1: DataTexture | null | undefined; - let LTC_HALF_2: DataTexture | null | undefined; - let LTC_FLOAT_1: DataTexture | null | undefined; - let LTC_FLOAT_2: DataTexture | null | undefined; -} -import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts deleted file mode 100644 index 4e8ec37f6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lights/RectAreaLightUniformsLib.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This class is only relevant when using {@link RectAreaLight} with {@link WebGLRenderer}. - * - * Before rect area lights can be used, the internal uniform library of the renderer must be - * enhanced with the following code. - * - * ```js - * RectAreaLightUniformsLib.init(); - * ``` - * - * @hideconstructor - * @three_import import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js'; - */ -export class RectAreaLightUniformsLib { - /** - * Inits the uniform library required when using rect area lights. - */ - static init(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts deleted file mode 100644 index a1cdac05d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/Line2.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * A polyline drawn between vertices. - * - * This adds functionality beyond {@link Line}, like arbitrary line width and changing width to - * be in world units.It extends {@link LineSegments2}, simplifying constructing segments from a - * chain of points. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * import the class from `lines/webgpu/Line2.js`. - * - * ```js - * const geometry = new LineGeometry(); - * geometry.setPositions( positions ); - * geometry.setColors( colors ); - * - * const material = new LineMaterial( { linewidth: 5, vertexColors: true } }; - * - * const line = new Line2( geometry, material ); - * scene.add( line ); - * ``` - * - * @augments LineSegments2 - * @three_import import { Line2 } from 'three/addons/lines/Line2.js'; - */ -export class Line2 extends LineSegments2 { - /** - * Constructs a new wide line. - * - * @param {LineGeometry} [geometry] - The line geometry. - * @param {LineMaterial} [material] - The line material. - */ - constructor(geometry?: LineGeometry, material?: LineMaterial); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLine2: boolean; -} -import { LineSegments2 } from './LineSegments2.js'; -import { LineGeometry } from './LineGeometry.js'; -import { LineMaterial } from './LineMaterial.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts deleted file mode 100644 index 2564da5ce..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/LineGeometry.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * A chain of vertices, forming a polyline. - * - * This is used in {@link Line2} to describe the shape. - * - * ```js - * const points = [ - * new THREE.Vector3( - 10, 0, 0 ), - * new THREE.Vector3( 0, 5, 0 ), - * new THREE.Vector3( 10, 0, 0 ), - * ]; - * - * const geometry = new LineGeometry(); - * geometry.setFromPoints( points ); - * ``` - * - * @augments LineSegmentsGeometry - * @three_import import { LineLineGeometry2 } from 'three/addons/lines/LineGeometry.js'; - */ -export class LineGeometry extends LineSegmentsGeometry { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineGeometry: boolean; - /** - * Sets the given line positions for this geometry. - * - * @param {Float32Array|Array} array - The position data to set. - * @return {LineGeometry} A reference to this geometry. - */ - setPositions(array: Float32Array | Array): LineGeometry; - /** - * Sets the given line colors for this geometry. - * - * @param {Float32Array|Array} array - The position data to set. - * @return {LineGeometry} A reference to this geometry. - */ - setColors(array: Float32Array | Array): LineGeometry; - /** - * Setups this line segments geometry from the given sequence of points. - * - * @param {Array} points - An array of points in 2D or 3D space. - * @return {LineGeometry} A reference to this geometry. - */ - setFromPoints(points: Array): LineGeometry; - /** - * Setups this line segments geometry from the given line. - * - * @param {Line} line - The line that should be used as a data source for this geometry. - * @return {LineGeometry} A reference to this geometry. - */ - fromLine(line: Line): LineGeometry; -} -import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts deleted file mode 100644 index 9d03e1c0c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/LineMaterial.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * A material for drawing wireframe-style geometries. - * - * Unlike {@link LineBasicMaterial}, it supports arbitrary line widths and allows using world units - * instead of screen space units. This material is used with {@link LineSegments2} and {@link Line2}. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * use {@link Line2NodeMaterial}. - * - * @augments ShaderMaterial - * @three_import import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; - */ -export class LineMaterial extends ShaderMaterial { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineMaterial: boolean; - set color(value: Color); - /** - * The material's color. - * - * @type {Color} - * @default (1,1,1) - */ - get color(): Color; - set worldUnits(value: boolean); - /** - * Whether the material's sizes (width, dash gaps) are in world units. - * - * @type {boolean} - * @default false - */ - get worldUnits(): boolean; - set linewidth(value: number); - /** - * Controls line thickness in CSS pixel units when `worldUnits` is `false` (default), - * or in world units when `worldUnits` is `true`. - * - * @type {number} - * @default 1 - */ - get linewidth(): number; - set dashed(value: boolean); - /** - * Whether the line is dashed, or solid. - * - * @type {boolean} - * @default false - */ - get dashed(): boolean; - set dashScale(value: number); - /** - * The scale of the dashes and gaps. - * - * @type {number} - * @default 1 - */ - get dashScale(): number; - set dashSize(value: number); - /** - * The size of the dash. - * - * @type {number} - * @default 1 - */ - get dashSize(): number; - set dashOffset(value: number); - /** - * Where in the dash cycle the dash starts. - * - * @type {number} - * @default 0 - */ - get dashOffset(): number; - set gapSize(value: number); - /** - * The size of the gap. - * - * @type {number} - * @default 0 - */ - get gapSize(): number; - set resolution(value: Vector2); - /** - * The size of the viewport, in screen pixels. This must be kept updated to make - * screen-space rendering accurate. The `LineSegments2.onBeforeRender` callback - * performs the update for visible objects. - * - * @type {Vector2} - */ - get resolution(): Vector2; -} -import { ShaderMaterial } from 'three'; -import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts deleted file mode 100644 index 7dd0b3b2d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegments2.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * A series of lines drawn between pairs of vertices. - * - * This adds functionality beyond {@link LineSegments}, like arbitrary line width and changing width - * to be in world units. {@link Line2} extends this object, forming a polyline instead of individual - * segments. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * import the class from `lines/webgpu/LineSegments2.js`. - * - * ```js - * const geometry = new LineSegmentsGeometry(); - * geometry.setPositions( positions ); - * geometry.setColors( colors ); - * - * const material = new LineMaterial( { linewidth: 5, vertexColors: true } }; - * - * const lineSegments = new LineSegments2( geometry, material ); - * scene.add( lineSegments ); - * ``` - * - * @augments Mesh - * @three_import import { LineSegments2 } from 'three/addons/lines/LineSegments2.js'; - */ -export class LineSegments2 extends Mesh { - /** - * Constructs a new wide line. - * - * @param {LineSegmentsGeometry} [geometry] - The line geometry. - * @param {LineMaterial} [material] - The line material. - */ - constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineSegments2: boolean; - /** - * Computes an array of distance values which are necessary for rendering dashed lines. - * For each vertex in the geometry, the method calculates the cumulative length from the - * current point to the very beginning of the line. - * - * @return {LineSegments2} A reference to this instance. - */ - computeLineDistances(): LineSegments2; - /** - * Computes intersection points between a casted ray and this instance. - * - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - The target array that holds the intersection points. - */ - raycast(raycaster: Raycaster, intersects: Array): void; - onBeforeRender(renderer: any): void; -} -import { Mesh } from 'three'; -import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; -import { LineMaterial } from './LineMaterial.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts deleted file mode 100644 index 4845d8410..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/LineSegmentsGeometry.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * A series of vertex pairs, forming line segments. - * - * This is used in {@link LineSegments2} to describe the shape. - * - * @augments InstancedBufferGeometry - * @three_import import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; - */ -export class LineSegmentsGeometry extends InstancedBufferGeometry { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineSegmentsGeometry: boolean; - /** - * Applies the given 4x4 transformation matrix to the geometry. - * - * @param {Matrix4} matrix - The matrix to apply. - * @return {LineSegmentsGeometry} A reference to this instance. - */ - applyMatrix4(matrix: Matrix4): LineSegmentsGeometry; - /** - * Sets the given line positions for this geometry. The length must be a multiple of six since - * each line segment is defined by a start end vertex in the pattern `(xyz xyz)`. - * - * @param {Float32Array|Array} array - The position data to set. - * @return {LineSegmentsGeometry} A reference to this geometry. - */ - setPositions(array: Float32Array | Array): LineSegmentsGeometry; - /** - * Sets the given line colors for this geometry. The length must be a multiple of six since - * each line segment is defined by a start end color in the pattern `(rgb rgb)`. - * - * @param {Float32Array|Array} array - The position data to set. - * @return {LineSegmentsGeometry} A reference to this geometry. - */ - setColors(array: Float32Array | Array): LineSegmentsGeometry; - /** - * Setups this line segments geometry from the given wireframe geometry. - * - * @param {WireframeGeometry} geometry - The geometry that should be used as a data source for this geometry. - * @return {LineSegmentsGeometry} A reference to this geometry. - */ - fromWireframeGeometry(geometry: WireframeGeometry): LineSegmentsGeometry; - /** - * Setups this line segments geometry from the given edges geometry. - * - * @param {EdgesGeometry} geometry - The geometry that should be used as a data source for this geometry. - * @return {LineSegmentsGeometry} A reference to this geometry. - */ - fromEdgesGeometry(geometry: EdgesGeometry): LineSegmentsGeometry; - /** - * Setups this line segments geometry from the given mesh. - * - * @param {Mesh} mesh - The mesh geometry that should be used as a data source for this geometry. - * @return {LineSegmentsGeometry} A reference to this geometry. - */ - fromMesh(mesh: Mesh): LineSegmentsGeometry; - /** - * Setups this line segments geometry from the given line segments. - * - * @param {LineSegments} lineSegments - The line segments that should be used as a data source for this geometry. - * Assumes the source geometry is not using indices. - * @return {LineSegmentsGeometry} A reference to this geometry. - */ - fromLineSegments(lineSegments: LineSegments): LineSegmentsGeometry; - toJSON(): void; -} -import { InstancedBufferGeometry } from 'three'; -import { WireframeGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts deleted file mode 100644 index a40c88984..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/Wireframe.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * A class for creating wireframes based on wide lines. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * import the class from `lines/webgpu/Wireframe.js`. - * - * ```js - * const geometry = new THREE.IcosahedronGeometry(); - * const wireframeGeometry = new WireframeGeometry2( geo ); - * - * const wireframe = new Wireframe( wireframeGeometry, material ); - * scene.add( wireframe ); - * ``` - * - * @augments Mesh - * @three_import import { Wireframe } from 'three/addons/lines/Wireframe.js'; - */ -export class Wireframe extends Mesh { - /** - * Constructs a new wireframe. - * - * @param {LineSegmentsGeometry} [geometry] - The line geometry. - * @param {LineMaterial} [material] - The line material. - */ - constructor(geometry?: LineSegmentsGeometry, material?: LineMaterial); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWireframe: boolean; - /** - * Computes an array of distance values which are necessary for rendering dashed lines. - * For each vertex in the geometry, the method calculates the cumulative length from the - * current point to the very beginning of the line. - * - * @return {Wireframe} A reference to this instance. - */ - computeLineDistances(): Wireframe; - onBeforeRender(renderer: any): void; -} -import { Mesh } from 'three'; -import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; -import { LineMaterial } from './LineMaterial.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts deleted file mode 100644 index 61bb232cf..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/WireframeGeometry2.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A special type of line segments geometry intended for wireframe rendering. - * - * This is used in {@link Wireframe} to describe the shape. - * - * ```js - * const geometry = new THREE.IcosahedronGeometry(); - * const wireframeGeometry = new WireframeGeometry2( geo ); - * ``` - * - * @augments LineSegmentsGeometry - * @three_import import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; - */ -export class WireframeGeometry2 extends LineSegmentsGeometry { - /** - * Constructs a new wireframe geometry. - * - * @param {BufferGeometry} [geometry] - The geometry to render the wireframe for. - */ - constructor(geometry?: BufferGeometry); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWireframeGeometry2: boolean; -} -import { LineSegmentsGeometry } from './LineSegmentsGeometry.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts deleted file mode 100644 index 99fa543d7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Line2.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * A polyline drawn between vertices. - * - * This adds functionality beyond {@link Line}, like arbitrary line width and changing width to - * be in world units.It extends {@link LineSegments2}, simplifying constructing segments from a - * chain of points. - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * import the class from `lines/Line2.js`. - * - * @augments LineSegments2 - * @three_import import { Line2 } from 'three/addons/lines/webgpu/Line2.js'; - */ -export class Line2 extends LineSegments2 { - /** - * Constructs a new wide line. - * - * @param {LineGeometry} [geometry] - The line geometry. - * @param {Line2NodeMaterial} [material] - The line material. - */ - constructor(geometry?: LineGeometry, material?: Line2NodeMaterial); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLine2: boolean; -} -import { LineSegments2 } from './LineSegments2.js'; -import { LineGeometry } from '../LineGeometry.js'; -import { Line2NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts deleted file mode 100644 index b78c3ec1e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/LineSegments2.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * A series of lines drawn between pairs of vertices. - * - * This adds functionality beyond {@link LineSegments}, like arbitrary line width and changing width - * to be in world units. {@link Line2} extends this object, forming a polyline instead of individual - * segments. - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * import the class from `lines/LineSegments2.js`. - * - * @augments Mesh - * @three_import import { LineSegments2 } from 'three/addons/lines/webgpu/LineSegments2.js'; - */ -export class LineSegments2 extends Mesh { - /** - * Constructs a new wide line. - * - * @param {LineSegmentsGeometry} [geometry] - The line geometry. - * @param {Line2NodeMaterial} [material] - The line material. - */ - constructor(geometry?: LineSegmentsGeometry, material?: Line2NodeMaterial); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineSegments2: boolean; - _resolution: Vector2; - /** - * Computes an array of distance values which are necessary for rendering dashed lines. - * For each vertex in the geometry, the method calculates the cumulative length from the - * current point to the very beginning of the line. - * - * @return {LineSegments2} A reference to this instance. - */ - computeLineDistances(): LineSegments2; - onBeforeRender(renderer: any): void; - /** - * Computes intersection points between a casted ray and this instance. - * - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - The target array that holds the intersection points. - */ - raycast(raycaster: Raycaster, intersects: Array): void; -} -import { Mesh } from 'three/webgpu'; -import { Vector2 } from 'three/webgpu'; -import { LineSegmentsGeometry } from '../LineSegmentsGeometry.js'; -import { Line2NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts b/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts deleted file mode 100644 index 5c34f7a30..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/lines/webgpu/Wireframe.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * A class for creating wireframes based on wide lines. - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * import the class from `lines/Wireframe.js`. - * - * @augments Mesh - * @three_import import { Wireframe } from 'three/addons/lines/webgpu/Wireframe.js'; - */ -export class Wireframe extends Mesh { - /** - * Constructs a new wireframe. - * - * @param {LineSegmentsGeometry} [geometry] - The line geometry. - * @param {Line2NodeMaterial} [material] - The line material. - */ - constructor(geometry?: LineSegmentsGeometry, material?: Line2NodeMaterial); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWireframe: boolean; - /** - * Computes an array of distance values which are necessary for rendering dashed lines. - * For each vertex in the geometry, the method calculates the cumulative length from the - * current point to the very beginning of the line. - * - * @return {Wireframe} A reference to this instance. - */ - computeLineDistances(): Wireframe; -} -import { Mesh } from 'three/webgpu'; -import { LineSegmentsGeometry } from '../LineSegmentsGeometry.js'; -import { Line2NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts deleted file mode 100644 index 4ee616be2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/3DMLoader.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * A loader for Rhinoceros 3D files and objects. - * - * Rhinoceros is a 3D modeler used to create, edit, analyze, document, render, - * animate, and translate NURBS curves, surfaces, breps, extrusions, point clouds, - * as well as polygon meshes and SubD objects. `rhino3dm.js` is compiled to WebAssembly - * from the open source geometry library `openNURBS`. The loader currently uses - * `rhino3dm.js 8.32.1`. - * - * ```js - * const loader = new Rhino3dmLoader(); - * loader.setLibraryPath( 'https://cdn.jsdelivr.net/npm/rhino3dm@8.32.1/' ); - * - * const object = await loader.loadAsync( 'models/3dm/Rhino_Logo.3dm' ); - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js'; - */ -export class Rhino3dmLoader extends Loader { - /** - * Constructs a new Rhino 3DM loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - libraryPath: string; - libraryPending: Promise | null; - libraryBinary: any; - libraryConfig: {}; - url: string; - workerLimit: number; - workerPool: any[]; - workerNextTaskID: number; - workerSourceURL: string; - workerConfig: {}; - subdivisionLevel: number; - materials: any[]; - warnings: any[]; - /** - * Path to a folder containing the JS and WASM libraries. - * - * @param {string} path - The library path to set. - * @return {Rhino3dmLoader} A reference to this loader. - */ - setLibraryPath(path: string): Rhino3dmLoader; - /** - * Sets the maximum number of Web Workers to be used during decoding. - * A lower limit may be preferable if workers are also for other - * tasks in the application. - * - * @param {number} workerLimit - The worker limit. - * @return {Rhino3dmLoader} A reference to this loader. - */ - setWorkerLimit(workerLimit: number): Rhino3dmLoader; - /** - * Sets the number of global subdivisions applied to SubD objects before they are - * meshed for display. The default is `3`. Large models with many SubD objects may - * benefit from a lower value to keep vertex counts manageable. - * - * @param {number} level - The subdivision level. - * @return {Rhino3dmLoader} A reference to this loader. - */ - setSubdivisionLevel(level: number): Rhino3dmLoader; - /** - * Starts loading from the given URL and passes the loaded 3DM asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Object3D)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Object3D) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Prints debug messages to the browser console. - */ - debug(): void; - /** - * Decodes the 3DM asset data with a Web Worker. - * - * @param {ArrayBuffer} buffer - The raw 3DM asset data as an array buffer. - * @param {string} url - The asset URL. - * @return {Promise} A Promise that resolved with the decoded 3D object. - */ - decodeObjects(buffer: ArrayBuffer, url: string): Promise; - /** - * Parses the given 3DM data and passes the loaded 3DM asset - * to the `onLoad()` callback. - * - * @param {ArrayBuffer} data - The raw 3DM asset data as an array buffer. - * @param {function(Object3D)} onLoad - Executed when the loading process has been finished. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - parse(data: ArrayBuffer, onLoad: (arg0: Object3D) => any, onError: onErrorCallback): void; - /** - * Parses the given 3DM data and returns a Promise that resolves with the loaded asset. - * - * @param {ArrayBuffer} data - The raw 3DM asset data as an array buffer. - * @return {Promise} A Promise that resolves with the decoded 3D object. - */ - parseAsync(data: ArrayBuffer): Promise; - _compareMaterials(material: any): any; - _createMaterial(material: any, renderEnvironment: any): MeshStandardMaterial; - _createGeometry(data: any): Object3D; - /** - * Builds a BufferGeometry from a worker payload. Meshes decoded via the fast path - * arrive as transferable typed arrays (`format: 'buffers'`) and are assembled directly; - * everything else falls back to the three.js BufferGeometry JSON produced by - * `toThreejsJSON()` (older rhino3dm, point clouds, curves, …). - */ - _geometryFromData(data: any): BufferGeometry; - _createObject(obj: any, mat: any): Sprite | Mesh | Line | Points | SpotLight | PointLight | DirectionalLight | RectAreaLight | undefined; - _initLibrary(): Promise; - _getWorker(taskCost: any): Promise; - _releaseTask(worker: any, taskID: any): void; - /** - * Frees internal resources. This method should be called - * when the loader is no longer required. - */ - dispose(): void; -} -import { Loader } from 'three'; -import { Object3D } from 'three'; -import { MeshStandardMaterial } from 'three'; -import { BufferGeometry } from 'three'; -import { Sprite } from 'three'; -import { Mesh } from 'three'; -import { Line } from 'three'; -import { Points } from 'three'; -import { SpotLight } from 'three'; -import { PointLight } from 'three'; -import { DirectionalLight } from 'three'; -import { RectAreaLight } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts deleted file mode 100644 index a47c187be..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/3MFLoader.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * A loader for the [3D Manufacturing Format (3MF)](https://3mf.io/specification/) format. - * - * The following features from the core specification are supported: - * - * - 3D Models - * - Object Resources (Meshes and Components) - * - Material Resources (Base Materials) - * - * 3MF Materials and Properties Extension are only partially supported. - * - * - Texture 2D - * - Texture 2D Groups - * - Color Groups (Vertex Colors) - * - Metallic Display Properties (PBR) - * - Beam Lattice - * - * ```js - * const loader = new ThreeMFLoader(); - * - * const object = await loader.loadAsync( './models/3mf/truck.3mf' ); - * object.rotation.set( - Math.PI / 2, 0, 0 ); // z-up conversion - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; - */ -export class ThreeMFLoader extends Loader { - /** - * Constructs a new 3MF loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * An array of available extensions. - * - * @type {Array} - */ - availableExtensions: Array; - /** - * Starts loading from the given URL and passes the loaded 3MF asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given 3MF data and returns the resulting group. - * - * @param {ArrayBuffer} data - The raw 3MF asset data as an array buffer. - * @return {Group} A group representing the parsed asset. - */ - parse(data: ArrayBuffer): Group; - /** - * Adds a 3MF extension. - * - * @param {Object} extension - The extension to add. - */ - addExtension(extension: Object): void; -} -import { Loader } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts deleted file mode 100644 index ab0d0f496..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/AMFLoader.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * A loader for the AMF format. - * - * The loader supports materials, color and ZIP compressed files. - * No constellation support (yet). - * - * ```js - * const loader = new AMFLoader(); - * - * const object = await loader.loadAsync( './models/amf/rook.amf' ); - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { AMFLoader } from 'three/addons/loaders/AMFLoader.js'; - */ -export class AMFLoader extends Loader { - /** - * Constructs a new AMF loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded AMF asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given AMF data and returns the resulting group. - * - * @param {ArrayBuffer} data - The raw AMF asset data as an array buffer. - * @return {Group} A group representing the parsed asset. - */ - parse(data: ArrayBuffer): Group; -} -import { Loader } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts deleted file mode 100644 index a63bd7f6c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/BVHLoader.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * A loader for the BVH format. - * - * Imports BVH files and outputs a single {@link Skeleton} and {@link AnimationClip}. - * The loader only supports BVH files containing a single root right now. - * - * ```js - * const loader = new BVHLoader(); - * const result = await loader.loadAsync( 'models/bvh/pirouette.bvh' ); - * - * // visualize skeleton - * const skeletonHelper = new THREE.SkeletonHelper( result.skeleton.bones[ 0 ] ); - * scene.add( result.skeleton.bones[ 0 ] ); - * scene.add( skeletonHelper ); - * - * // play animation clip - * mixer = new THREE.AnimationMixer( result.skeleton.bones[ 0 ] ); - * mixer.clipAction( result.clip ).play(); - * ``` - * - * @augments Loader - * @three_import import { BVHLoader } from 'three/addons/loaders/BVHLoader.js'; - */ -export class BVHLoader extends Loader { - /** - * Constructs a new BVH loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Whether to animate bone positions or not. - * - * @type {boolean} - * @default true - */ - animateBonePositions: boolean; - /** - * Whether to animate bone rotations or not. - * - * @type {boolean} - * @default true - */ - animateBoneRotations: boolean; - /** - * Starts loading from the given URL and passes the loaded BVH asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({skeleton:Skeleton,clip:AnimationClip})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - skeleton: Skeleton; - clip: AnimationClip; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given BVH data and returns the resulting data. - * - * @param {string} text - The raw BVH data as a string. - * @return {{skeleton:Skeleton,clip:AnimationClip}} An object representing the parsed asset. - */ - parse(text: string): { - skeleton: Skeleton; - clip: AnimationClip; - }; -} -import { Loader } from 'three'; -import { Skeleton } from 'three'; -import { AnimationClip } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts deleted file mode 100644 index 6eff80f62..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/ColladaLoader.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * A loader for the Collada format. - * - * The Collada format is very complex so this loader only supports a subset of what - * is defined in the [official specification](https://www.khronos.org/files/collada_spec_1_5.pdf). - * - * Assets with a Z-UP coordinate system are transformed it into Y-UP by a simple rotation. - * The vertex data are not converted. - * - * ```js - * const loader = new ColladaLoader(); - * - * const result = await loader.loadAsync( './models/collada/elf/elf.dae' ); - * scene.add( result.scene ); - * ``` - * - * @augments Loader - * @three_import import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js'; - */ -export class ColladaLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded Collada asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({scene:Group,animations:Array,kinematics:Object})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - scene: Group; - animations: Array; - kinematics: Object; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given Collada data and returns a result object holding the parsed scene, - * an array of animation clips and kinematics. - * - * @param {string} text - The raw Collada data as a string. - * @param {string} [path] - The asset path. - * @return {?{scene:Group,animations:Array,kinematics:Object}} An object representing the parsed asset. - */ - parse(text: string, path?: string): { - scene: Group; - animations: Array; - kinematics: Object; - } | null; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts deleted file mode 100644 index 1042415d7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/DDSLoader.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A loader for the S3TC texture compression format. - * - * ```js - * const loader = new DDSLoader(); - * - * const map = loader.load( 'textures/compressed/disturb_dxt1_nomip.dds' ); - * map.colorSpace = THREE.SRGBColorSpace; // only for color textures - * ``` - * - * @augments CompressedTextureLoader - * @three_import import { DDSLoader } from 'three/addons/loaders/DDSLoader.js'; - */ -export class DDSLoader extends CompressedTextureLoader { - /** - * Constructs a new DDS loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Parses the given S3TC texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @param {boolean} loadMipmaps - Whether to load mipmaps or not. - * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data. - */ - parse(buffer: ArrayBuffer, loadMipmaps: boolean): CompressedTextureLoader; -} -import { CompressedTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts deleted file mode 100644 index 890f47cc5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/DRACOLoader.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -/** - * A loader for the Draco format. - * - * [Draco](https://google.github.io/draco/) is an open source library for compressing - * and decompressing 3D meshes and point clouds. Compressed geometry can be significantly smaller, - * at the cost of additional decoding time on the client device. - * - * Standalone Draco files have a `.drc` extension, and contain vertex positions, normals, colors, - * and other attributes. Draco files do not contain materials, textures, animation, or node hierarchies – - * to use these features, embed Draco geometry inside of a glTF file. A normal glTF file can be converted - * to a Draco-compressed glTF file using [glTF-Pipeline](https://github.com/CesiumGS/gltf-pipeline). - * When using Draco with glTF, an instance of `DRACOLoader` will be used internally by {@link GLTFLoader}. - * - * It is recommended to create one DRACOLoader instance and reuse it to avoid loading and creating - * multiple decoder instances. - * - * `DRACOLoader` will automatically use either the JS or the WASM decoding library, based on - * browser capabilities. - * - * ```js - * const loader = new DRACOLoader(); - * const geometry = await loader.loadAsync( 'models/draco/bunny.drc' ); - * geometry.computeVertexNormals(); // optional - * - * loader.dispose(); - * ``` - * - * @augments Loader - * @three_import import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; - */ -export class DRACOLoader extends Loader { - /** - * Constructs a new Draco loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - decoderPaths: { - js: string; - wasm: string; - dep_js: string; - }; - decoderConfig: {}; - decoderBinary: any; - decoderPending: Promise | null; - workerLimit: number; - workerPool: any[]; - workerNextTaskID: number; - workerSourceURL: string; - defaultAttributeIDs: { - position: string; - normal: string; - color: string; - uv: string; - }; - defaultAttributeTypes: { - position: string; - normal: string; - color: string; - uv: string; - }; - /** - * Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins. - * - * @param {string|{js:string, wasm:string}} path - The decoder path, or a config object with explicit URLs for each decoder file. - * @return {DRACOLoader} A reference to this loader. - */ - setDecoderPath(path: string | { - js: string; - wasm: string; - }): DRACOLoader; - /** - * Provides configuration for the decoder libraries. Configuration cannot be changed after decoding begins. - * - * @deprecated - * @param {{type:('js'|'wasm')}} config - The decoder config. - * @return {DRACOLoader} A reference to this loader. - */ - setDecoderConfig(config: { - type: ("js" | "wasm"); - }): DRACOLoader; - /** - * Sets the maximum number of Web Workers to be used during decoding. - * A lower limit may be preferable if workers are also for other tasks in the application. - * - * @param {number} workerLimit - The worker limit. - * @return {DRACOLoader} A reference to this loader. - */ - setWorkerLimit(workerLimit: number): DRACOLoader; - /** - * Starts loading from the given URL and passes the loaded Draco asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given Draco data. - * - * @param {ArrayBuffer} buffer - The raw Draco data as an array buffer. - * @param {function(BufferGeometry)} onLoad - Executed when the loading/parsing process has been finished. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - parse(buffer: ArrayBuffer, onLoad: (arg0: BufferGeometry) => any, onError?: onErrorCallback): void; - decodeDracoFile(buffer: any, callback: any, attributeIDs: any, attributeTypes: any, vertexColorSpace?: string, onError?: () => void): any; - decodeGeometry(buffer: any, taskConfig: any): any; - _createGeometry(geometryData: any): BufferGeometry; - _assignVertexColorSpace(attribute: any, inputColorSpace: any): void; - _loadLibrary(url: any, responseType: any): Promise; - preload(): this; - _initDecoder(): Promise; - _getWorker(taskID: any, taskCost: any): Promise; - _releaseTask(worker: any, taskID: any): void; - debug(): void; - dispose(): this; -} -export namespace DRACO_GLTF_CONFIG { - let js: string; - let wasm: string; -} -import { Loader } from 'three'; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts deleted file mode 100644 index 4c061b02d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/EXRLoader.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * A loader for the OpenEXR texture format. - * - * `EXRLoader` currently supports uncompressed, ZIP(S), RLE, PIZ, B44/A and DWA/B compression. - * Supports reading as UnsignedByte, HalfFloat and Float type data texture. - * - * ```js - * const loader = new EXRLoader(); - * const texture = await loader.loadAsync( 'textures/memorial.exr' ); - * ``` - * - * @augments DataTextureLoader - * @three_import import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; - */ -export class EXRLoader extends DataTextureLoader { - /** - * Constructs a new EXR loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The texture type. - * - * @type {(HalfFloatType|FloatType)} - * @default HalfFloatType - */ - type: (number | number); - /** - * Texture output format. - * - * @type {(RGBAFormat|RGFormat|RedFormat)} - * @default RGBAFormat - */ - outputFormat: (number | number | number); - /** - * For multi-part EXR files, the index of the part to load. - * - * @type {number} - * @default 0 - */ - part: number; - /** - * Parses the given EXR texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @return {DataTextureLoader~TexData} An object representing the parsed texture data. - */ - parse(buffer: ArrayBuffer): DataTextureLoader; - /** - * Sets the texture type. - * - * @param {(HalfFloatType|FloatType)} value - The texture type to set. - * @return {EXRLoader} A reference to this loader. - */ - setDataType(value: (number | number)): EXRLoader; - /** - * Sets texture output format. Defaults to `RGBAFormat`. - * - * @param {(RGBAFormat|RGFormat|RedFormat)} value - Texture output format. - * @return {EXRLoader} A reference to this loader. - */ - setOutputFormat(value: (number | number | number)): EXRLoader; - /** - * For multi-part EXR files, sets which part to load. - * - * @param {number} value - The part index to load. - * @return {EXRLoader} A reference to this loader. - */ - setPart(value: number): EXRLoader; -} -import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts deleted file mode 100644 index eb6f58adf..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/FBXLoader.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * A loader for the FBX format. - * - * Requires FBX file to be >= 7.0 and in ASCII or >= 6400 in Binary format. - * Versions lower than this may load but will probably have errors. - * - * Needs Support: - * - Morph normals / blend shape normals - * - * FBX format references: - * - [C++ SDK reference](https://help.autodesk.com/view/FBX/2017/ENU/?guid=__cpp_ref_index_html) - * - * Binary format specification: - * - [FBX binary file format specification](https://code.blender.org/2013/08/fbx-binary-file-format-specification/) - * - * ```js - * const loader = new FBXLoader(); - * const object = await loader.loadAsync( 'models/fbx/stanford-bunny.fbx' ); - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; - */ -export class FBXLoader extends Loader { - /** - * Constructs a new FBX loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Whether to trim animation clips to the time range of their - * animation stacks and shift them to start at time zero. Useful - * for assets that define multiple clips on a single timeline. - * - * @type {boolean} - * @default false - */ - trimAnimationClips: boolean; - /** - * Starts loading from the given URL and passes the loaded FBX asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given FBX data and returns the resulting group. - * - * @param {ArrayBuffer} FBXBuffer - The raw FBX data as an array buffer. - * @param {string} path - The URL base path. - * @return {Group} An object representing the parsed asset. - */ - parse(FBXBuffer: ArrayBuffer, path: string): Group; -} -import { Loader } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts deleted file mode 100644 index 0771ff5cc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/FontLoader.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * A loader for loading fonts. - * - * You can convert fonts online using [facetype.js](https://gero3.github.io/facetype.js/). - * - * ```js - * const loader = new FontLoader(); - * const font = await loader.loadAsync( 'fonts/helvetiker_regular.typeface.json' ); - * ``` - * - * @augments Loader - * @three_import import { FontLoader } from 'three/addons/loaders/FontLoader.js'; - */ -export class FontLoader extends Loader { - /** - * Constructs a new font loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded font - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Font)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Font) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given font data and returns the resulting font. - * - * @param {Object} json - The raw font data as a JSON object. - * @return {Font} The font. - */ - parse(json: Object): Font; -} -/** - * Class representing a font. - */ -export class Font { - /** - * Constructs a new font. - * - * @param {Object} data - The font data as JSON. - */ - constructor(data: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isFont: boolean; - type: string; - /** - * The font data as JSON. - * - * @type {Object} - */ - data: Object; - /** - * Generates geometry shapes from the given text and size. The result of this method - * should be used with {@link ShapeGeometry} to generate the actual geometry data. - * - * @param {string} text - The text. - * @param {number} [size=100] - The text size. - * @param {string} [direction='ltr'] - Char direction: ltr(left to right), rtl(right to left) & tb(top bottom). - * @return {Array} An array of shapes representing the text. - */ - generateShapes(text: string, size?: number, direction?: string): Array; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts deleted file mode 100644 index 5c0f7df3a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/GCodeLoader.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A loader for the GCode format. - * - * GCode files are usually used for 3D printing or CNC applications. - * - * ```js - * const loader = new GCodeLoader(); - * const object = await loader.loadAsync( 'models/gcode/benchy.gcode' ); - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js'; - */ -export class GCodeLoader extends Loader { - /** - * Constructs a new GCode loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Whether to split layers or not. - * - * @type {boolean} - * @default false - */ - splitLayer: boolean; - /** - * Starts loading from the given URL and passes the loaded GCode asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given GCode data and returns a group with lines. - * - * @param {string} data - The raw Gcode data as a string. - * @return {Group} The parsed GCode asset. - */ - parse(data: string): Group; -} -import { Loader } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts deleted file mode 100644 index 3d6d9392f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A glTF loader plugin for `KHR_gaussian_splatting`. - * - * This plugin must be registered explicitly because {@link GaussianSplat} - * requires {@link WebGPURenderer}. - * - * ```js - * const loader = new GLTFLoader(); - * loader.register( function ( parser ) { - * - * return new GLTFGaussianSplatLoaderExtension( parser ); - * - * } ); - * ``` - * - * @three_import import { GLTFGaussianSplatLoaderExtension } from 'three/addons/loaders/GLTFGaussianSplatLoaderExtension.js'; - */ -export class GLTFGaussianSplatLoaderExtension { - /** - * Constructs a new glTF gaussian splatting extension plugin. - * - * @param {GLTFParser} parser - The glTF parser. - */ - constructor(parser: GLTFParser); - name: string; - parser: GLTFParser; - /** - * Loads a glTF mesh containing gaussian splat primitives. - * - * @param {number} meshIndex - The mesh index. - * @return {?Promise} The loaded mesh or `null` when the mesh does not use this extension. - */ - loadMesh(meshIndex: number): Promise | null; -} -import { Group } from 'three'; -import { GaussianSplat } from '../objects/GaussianSplat.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts deleted file mode 100644 index d29a15880..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/GLTFLoader.d.ts +++ /dev/null @@ -1,396 +0,0 @@ -/** - * ~LoadObject - */ -export type GLTFLoader = { - /** - * - An array of animation clips. - */ - animations: Array; - /** - * - Meta data about the loaded asset. - */ - asset: Object; - /** - * - An array of cameras. - */ - cameras: Array; - /** - * - A reference to the internal parser. - */ - parser: GLTFParser; - /** - * - The default scene. - */ - scene: Group; - /** - * - glTF assets might define multiple scenes. - */ - scenes: Array; - /** - * - Additional data. - */ - userData: Object; -}; -import { AnimationClip } from 'three'; -declare class GLTFParser { - constructor(json?: {}, options?: {}); - json: {}; - extensions: {}; - plugins: {}; - options: {}; - cache: any; - associations: Map; - primitiveCache: {}; - nodeCache: {}; - meshCache: { - refs: {}; - uses: {}; - }; - cameraCache: { - refs: {}; - uses: {}; - }; - lightCache: { - refs: {}; - uses: {}; - }; - sourceCache: {}; - textureCache: {}; - nodeNamesUsed: {}; - textureLoader: TextureLoader | ImageBitmapLoader; - fileLoader: FileLoader; - setExtensions(extensions: any): void; - setPlugins(plugins: any): void; - parse(onLoad: any, onError: any): void; - /** - * Marks the special nodes/meshes in json for efficient parse. - * - * @private - */ - private _markDefs; - /** - * Counts references to shared node / Object3D resources. These resources - * can be reused, or "instantiated", at multiple nodes in the scene - * hierarchy. Mesh, Camera, and Light instances are instantiated and must - * be marked. Non-scenegraph resources (like Materials, Geometries, and - * Textures) can be reused directly and are not marked here. - * - * Example: CesiumMilkTruck sample model reuses "Wheel" meshes. - * - * @private - * @param {Object} cache - * @param {Object3D} index - */ - private _addNodeRef; - /** - * Returns a reference to a shared resource, cloning it if necessary. - * - * @private - * @param {Object} cache - * @param {number} index - * @param {Object} object - * @return {Object} - */ - private _getNodeRef; - _invokeOne(func: any): any; - _invokeAll(func: any): any[]; - /** - * Requests the specified dependency asynchronously, with caching. - * - * @private - * @param {string} type - * @param {number} index - * @return {Promise} - */ - private getDependency; - /** - * Requests all dependencies of the specified type asynchronously, with caching. - * - * @private - * @param {string} type - * @return {Promise>} - */ - private getDependencies; - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views - * - * @private - * @param {number} bufferIndex - * @return {Promise} - */ - private loadBuffer; - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views - * - * @private - * @param {number} bufferViewIndex - * @return {Promise} - */ - private loadBufferView; - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors - * - * @private - * @param {number} accessorIndex - * @return {Promise} - */ - private loadAccessor; - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures - * - * @private - * @param {number} textureIndex - * @return {Promise} - */ - private loadTexture; - loadTextureImage(textureIndex: any, sourceIndex: any, loader: any): any; - loadImageSource(sourceIndex: any, loader: any): any; - /** - * Asynchronously assigns a texture to the given material parameters. - * - * @private - * @param {Object} materialParams - * @param {string} mapName - * @param {Object} mapDef - * @param {string} [colorSpace] - * @return {Promise} - */ - private assignTexture; - /** - * Assigns final material to a Mesh, Line, or Points instance. The instance - * already has a material (generated from the glTF material options alone) - * but reuse of the same glTF material may require multiple threejs materials - * to accommodate different primitive types, defines, etc. New materials will - * be created if necessary, and reused from a cache. - * - * @private - * @param {Object3D} mesh Mesh, Line, or Points instance. - */ - private assignFinalMaterial; - getMaterialType(): typeof MeshStandardMaterial; - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials - * - * @private - * @param {number} materialIndex - * @return {Promise} - */ - private loadMaterial; - /** - * When Object3D instances are targeted by animation, they need unique names. - * - * @private - * @param {string} originalName - * @return {string} - */ - private createUniqueName; - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry - * - * Creates BufferGeometries from primitives. - * - * @private - * @param {Array} primitives - * @return {Promise>} - */ - private loadGeometries; - /** - * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes - * - * @private - * @param {number} meshIndex - * @return {Promise} - */ - private loadMesh; - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras - * - * @private - * @param {number} cameraIndex - * @return {Promise|undefined} - */ - private loadCamera; - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins - * - * @private - * @param {number} skinIndex - * @return {Promise} - */ - private loadSkin; - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations - * - * @private - * @param {number} animationIndex - * @return {Promise} - */ - private loadAnimation; - createNodeMesh(nodeIndex: any): Promise | null; - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy - * - * @private - * @param {number} nodeIndex - * @return {Promise} - */ - private loadNode; - _loadNodeShallow(nodeIndex: any): any; - /** - * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes - * - * @private - * @param {number} sceneIndex - * @return {Promise} - */ - private loadScene; - _createAnimationTracks(node: any, inputAccessor: any, outputAccessor: any, sampler: any, target: any): QuaternionKeyframeTrack[]; - _getArrayFromAccessor(accessor: any): any; - _createCubicSplineTrackInterpolant(track: any): void; -} -import { Group } from 'three'; -/** - * A loader for the glTF 2.0 format. - * - * [glTF](https://www.khronos.org/gltf/) (GL Transmission Format) is an [open format specification]{@link https://github.com/KhronosGroup/glTF/tree/main/specification/2.0) - * for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb) - * format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver - * one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights, - * and/or cameras. - * - * `GLTFLoader` uses {@link ImageBitmapLoader} whenever possible. Be advised that image bitmaps are not - * automatically GC-collected when they are no longer referenced, and they require special handling during - * the disposal process. - * - * `GLTFLoader` supports the following glTF 2.0 extensions: - * - KHR_draco_mesh_compression - * - KHR_lights_punctual - * - KHR_materials_anisotropy - * - KHR_materials_clearcoat - * - KHR_materials_dispersion - * - KHR_materials_emissive_strength - * - KHR_materials_ior - * - KHR_materials_specular - * - KHR_materials_transmission - * - KHR_materials_iridescence - * - KHR_materials_unlit - * - KHR_materials_volume - * - KHR_mesh_quantization - * - KHR_meshopt_compression - * - KHR_texture_basisu - * - KHR_texture_transform - * - EXT_materials_bump - * - EXT_meshopt_compression - * - EXT_mesh_gpu_instancing - * - EXT_texture_avif - * - EXT_texture_webp - * - * The following glTF 2.0 extensions are supported by separately registered plugins: - * - KHR_gaussian_splatting - * - [KHR_materials_variants](https://github.com/takahirox/three-gltf-extensions) - * - [MSFT_texture_dds](https://github.com/takahirox/three-gltf-extensions) - * - [KHR_animation_pointer](https://github.com/needle-tools/three-animation-pointer) - * - [NEEDLE_progressive](https://github.com/needle-tools/gltf-progressive) - * - * ```js - * const loader = new GLTFLoader(); - * - * // Optional: Provide a DRACOLoader instance to decode compressed mesh data - * const dracoLoader = new DRACOLoader(); - * dracoLoader.setDecoderPath( '/examples/jsm/libs/draco/' ); - * loader.setDRACOLoader( dracoLoader ); - * - * const gltf = await loader.loadAsync( 'models/gltf/duck/duck.gltf' ); - * scene.add( gltf.scene ); - * ``` - * - * @augments Loader - * @three_import import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - */ -export class GLTFLoader extends Loader { - /** - * Constructs a new glTF loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - dracoLoader: any; - ktx2Loader: any; - meshoptDecoder: Object | null; - pluginCallbacks: any[]; - /** - * Starts loading from the given URL and passes the loaded glTF asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Sets the given Draco loader to this loader. Required for decoding assets - * compressed with the `KHR_draco_mesh_compression` extension. - * - * @param {DRACOLoader} dracoLoader - The Draco loader to set. - * @return {GLTFLoader} A reference to this loader. - */ - setDRACOLoader(dracoLoader: DRACOLoader): GLTFLoader; - /** - * Sets the given KTX2 loader to this loader. Required for loading KTX2 - * compressed textures. - * - * @param {KTX2Loader} ktx2Loader - The KTX2 loader to set. - * @return {GLTFLoader} A reference to this loader. - */ - setKTX2Loader(ktx2Loader: KTX2Loader): GLTFLoader; - /** - * Sets the given meshopt decoder. Required for decoding assets - * compressed with the `EXT_meshopt_compression` extension. - * - * @param {Object} meshoptDecoder - The meshopt decoder to set. - * @return {GLTFLoader} A reference to this loader. - */ - setMeshoptDecoder(meshoptDecoder: Object): GLTFLoader; - /** - * Registers a plugin callback. This API is internally used to implement the various - * glTF extensions but can also used by third-party code to add additional logic - * to the loader. - * - * @param {function(parser:GLTFParser)} callback - The callback function to register. - * @return {GLTFLoader} A reference to this loader. - */ - register(callback: any): GLTFLoader; - /** - * Unregisters a plugin callback. - * - * @param {Function} callback - The callback function to unregister. - * @return {GLTFLoader} A reference to this loader. - */ - unregister(callback: Function): GLTFLoader; - /** - * Parses the given glTF data and returns the resulting group. - * - * @param {string|ArrayBuffer} data - The raw glTF data. - * @param {string} path - The URL base path. - * @param {function(GLTFLoader~LoadObject)} onLoad - Executed when the loading process has been finished. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - parse(data: string | ArrayBuffer, path: string, onLoad: any, onError: onErrorCallback): void; - /** - * Async version of {@link GLTFLoader#parse}. - * - * @async - * @param {string|ArrayBuffer} data - The raw glTF data. - * @param {string} path - The URL base path. - * @return {Promise} A Promise that resolves with the loaded glTF when the parsing has been finished. - */ - parseAsync(data: string | ArrayBuffer, path: string): Promise; -} -import { TextureLoader } from 'three'; -import { ImageBitmapLoader } from 'three'; -import { FileLoader } from 'three'; -import { MeshStandardMaterial } from 'three'; -import { QuaternionKeyframeTrack } from 'three'; -import { Loader } from 'three'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts deleted file mode 100644 index 5d05d065a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/GaussianSplatPLYLoader.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * A loader for Gaussian splat PLY files, e.g. as exported by the original - * GraphDECO/INRIA 3D Gaussian Splatting implementation. - * - * PLY itself is a generic format, so the caller would normally have to know - * the file's spherical harmonics (SH) degree ahead of time to configure - * `PLYLoader` with the right custom property mapping before parsing. This - * loader avoids that by scanning the plain-text PLY header for `f_rest_N` - * properties first, since SH degree maps to a fixed, closed table of - * `f_rest` counts (0/9/24/45 -> degree 0/1/2/3), and configuring an - * internal `PLYLoader` accordingly before converting the result into - * Gaussian splat geometry. - * - * ```js - * const loader = new GaussianSplatPLYLoader(); - * const geometry = await loader.loadAsync( './models/gsplat/point_cloud.ply' ); - * scene.add( new GaussianSplat( geometry ) ); - * ``` - * - * @augments Loader - * @three_import import { GaussianSplatPLYLoader } from 'three/addons/loaders/GaussianSplatPLYLoader.js'; - */ -export class GaussianSplatPLYLoader extends Loader { - /** - * Constructs a new Gaussian splat PLY loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded Gaussian splat - * geometry to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given Gaussian splat PLY data and returns the resulting - * Gaussian splat geometry. - * - * This scans the PLY header for the file's spherical harmonics degree, - * so unlike a plain `PLYLoader`, no prior setup is required. - * - * @param {ArrayBuffer|string} data - The raw PLY data, as an array buffer or string. - * @return {BufferGeometry} The parsed Gaussian splat geometry. - */ - parse(data: ArrayBuffer | string): BufferGeometry; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts deleted file mode 100644 index 2ca2298ee..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRCubeTextureLoader.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * A loader for loading HDR cube textures. - * - * ```js - * const loader = new HDRCubeTextureLoader(); - * loader.setPath( 'textures/cube/pisaHDR/' ); - * const cubeTexture = await loader.loadAsync( [ 'px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr' ] ); - * - * scene.background = cubeTexture; - * scene.environment = cubeTexture; - * ``` - * - * @augments Loader - * @three_import import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; - */ -export class HDRCubeTextureLoader extends Loader { - /** - * Constructs a new HDR cube texture loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The internal HDR loader that loads the - * individual textures for each cube face. - * - * @type {HDRLoader} - */ - hdrLoader: HDRLoader; - /** - * The texture type. - * - * @type {(HalfFloatType|FloatType)} - * @default HalfFloatType - */ - type: (number | number); - /** - * Starts loading from the given URLs and passes the loaded HDR cube texture - * to the `onLoad()` callback. - * - * @param {Array} urls - The paths/URLs of the files to be loaded. This can also be a data URIs. - * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - * @return {CubeTexture} The HDR cube texture. - */ - load(urls: Array, onLoad: (arg0: CubeTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): CubeTexture; - /** - * Sets the texture type. - * - * @param {(HalfFloatType|FloatType)} value - The texture type to set. - * @return {HDRCubeTextureLoader} A reference to this loader. - */ - setDataType(value: (number | number)): HDRCubeTextureLoader; -} -import { Loader } from 'three'; -import { HDRLoader } from '../loaders/HDRLoader.js'; -import { CubeTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts deleted file mode 100644 index ac05b5206..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/HDRLoader.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * A loader for the RGBE HDR texture format. - * - * ```js - * const loader = new HDRLoader(); - * const envMap = await loader.loadAsync( 'textures/equirectangular/blouberg_sunrise_2_1k.hdr' ); - * envMap.mapping = THREE.EquirectangularReflectionMapping; - * - * scene.environment = envMap; - * ``` - * - * @augments DataTextureLoader - * @three_import import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - */ -export class HDRLoader extends DataTextureLoader { - /** - * Constructs a new RGBE/HDR loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The texture type. - * - * @type {(HalfFloatType|FloatType)} - * @default HalfFloatType - */ - type: (number | number); - /** - * Parses the given RGBE texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @return {DataTextureLoader~TexData} An object representing the parsed texture data. - */ - parse(buffer: ArrayBuffer): DataTextureLoader; - /** - * Sets the texture type. - * - * @param {(HalfFloatType|FloatType)} value - The texture type to set. - * @return {HDRLoader} A reference to this loader. - */ - setDataType(value: (number | number)): HDRLoader; -} -import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts deleted file mode 100644 index 15453e42e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/IESLoader.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * A loader for the IES format. - * - * The loaded texture should be assigned to {@link IESSpotLight#map}. - * - * ```js - * const loader = new IESLoader(); - * const texture = await loader.loadAsync( 'ies/007cfb11e343e2f42e3b476be4ab684e.ies' ); - * - * const spotLight = new THREE.IESSpotLight( 0xff0000, 500 ); - * spotLight.iesMap = texture; - * ``` - * - * @augments Loader - * @three_import import { IESLoader } from 'three/addons/loaders/IESLoader.js'; - */ -export class IESLoader extends Loader { - /** - * Constructs a new IES loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The texture type. - * - * @type {(HalfFloatType|FloatType)} - * @default HalfFloatType - */ - type: (number | number); - _getIESValues(iesLamp: any, type: any): Uint8Array | Uint16Array | Float32Array | null; - /** - * Starts loading from the given URL and passes the loaded IES texture - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: DataTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given IES data. - * - * @param {string} text - The raw IES data. - * @return {DataTexture} THE IES data as a texture. - */ - parse(text: string): DataTexture; -} -import { Loader } from 'three'; -import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts deleted file mode 100644 index 17775a709..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/KMZLoader.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * A loader for the KMZ format. - * - * ```js - * const loader = new KMZLoader(); - * const kmz = await loader.loadAsync( './models/kmz/Box.kmz' ); - * - * scene.add( kmz.scene ); - * ``` - * - * @augments Loader - * @three_import import { KMZLoader } from 'three/addons/loaders/KMZLoader.js'; - */ -export class KMZLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded KMZ asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({scene:Group})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - scene: Group; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given KMZ data and returns an object holding the scene. - * - * @param {ArrayBuffer} data - The raw KMZ data as an array buffer. - * @return {{scene:Group}} The parsed KMZ asset. - */ - parse(data: ArrayBuffer): { - scene: Group; - }; -} -import { Loader } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts deleted file mode 100644 index 3100ddd36..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/KSPLATLoader.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * A loader for GaussianSplats3D `.ksplat` files. - * - * This loader decodes the format into `BufferGeometry` for use with - * `GaussianSplat`. Higher-order spherical harmonics are exposed as optional - * `sphericalHarmonics1` through `sphericalHarmonics3` packed uint32 geometry - * attributes (`SH_BAND_WORDS[ degree ]` words per splat). Coefficients use the - * clamped-byte encoding `( value - 128 ) / 128`, four bytes per word. - * - * ```js - * const loader = new KSPLATLoader(); - * const data = await loader.loadAsync( './models/gsplat/example.ksplat' ); - * scene.add( new GaussianSplat( data ) ); - * ``` - * - * @augments Loader - * @three_import import { KSPLATLoader } from 'three/addons/loaders/KSPLATLoader.js'; - */ -export class KSPLATLoader extends Loader { - /** - * Constructs a new Gaussian splat KSPLAT loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded splat data to - * the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given `.ksplat` data. - * - * @param {ArrayBuffer} buffer - The raw KSPLAT file as an array buffer. - * @return {BufferGeometry} The parsed splat geometry. - */ - parse(buffer: ArrayBuffer): BufferGeometry; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts deleted file mode 100644 index 064241afc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/KTX2Loader.d.ts +++ /dev/null @@ -1,188 +0,0 @@ -/** - * A loader for KTX 2.0 GPU Texture containers. - * - * KTX 2.0 is a container format for various GPU texture formats. The loader supports Basis Universal GPU textures, - * which can be quickly transcoded to a wide variety of GPU texture compression formats. While KTX 2.0 also allows - * other hardware-specific formats, this loader does not yet parse them. - * - * This loader parses the KTX 2.0 container and transcodes to a supported GPU compressed texture format. - * The required WASM transcoder and JS wrapper are available from the `examples/jsm/libs/basis` directory. - * - * This loader relies on Web Assembly which is not supported in older browsers. - * - * References: - * - [KTX specification](http://github.khronos.org/KTX-Specification/) - * - [DFD](https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor) - * - [BasisU HDR](https://github.com/BinomialLLC/basis_universal/wiki/UASTC-HDR-Texture-Specification-v1.0) - * - * ```js - * const loader = new KTX2Loader(); - * loader.setTranscoderPath( 'examples/jsm/libs/basis/' ); - * loader.detectSupport( renderer ); - * const texture = loader.loadAsync( 'diffuse.ktx2' ); - * ``` - * - * @augments Loader - * @three_import import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; - */ -export class KTX2Loader extends Loader { - /** - * Constructs a new KTX2 loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - transcoderPath: string; - transcoderBinary: any; - transcoderPending: Promise | null; - workerPool: WorkerPool; - workerSourceURL: string; - workerConfig: { - astcSupported: any; - astcHDRSupported: boolean; - etc1Supported: any; - etc2Supported: any; - dxtSupported: any; - bptcSupported: any; - pvrtcSupported: any; - } | { - astcSupported: any; - astcHDRSupported: any; - etc1Supported: any; - etc2Supported: any; - dxtSupported: any; - bptcSupported: any; - pvrtcSupported: any; - } | null; - /** - * Sets the transcoder path to optionally set the decoder load path from a CDN. - * - * By default The WASM transcoder and JS wrapper are loaded from the `examples/jsm/libs/basis` directory. - * - * @param {string} path - The transcoder path to set. - * @return {KTX2Loader} A reference to this loader. - */ - setTranscoderPath(path: string): KTX2Loader; - /** - * Sets the maximum number of Web Workers to be allocated by this instance. - * - * @param {number} workerLimit - The worker limit. - * @return {KTX2Loader} A reference to this loader. - */ - setWorkerLimit(workerLimit: number): KTX2Loader; - /** - * Async version of {@link KTX2Loader#detectSupport}. - * - * @async - * @deprecated - * @param {WebGPURenderer} renderer - The renderer. - * @return {Promise} A Promise that resolves when the support has been detected. - */ - detectSupportAsync(renderer: WebGPURenderer): Promise; - /** - * Detects hardware support for available compressed texture formats, to determine - * the output format for the transcoder. Must be called before loading a texture. - * - * @param {WebGPURenderer|WebGLRenderer} renderer - The renderer. - * @return {KTX2Loader} A reference to this loader. - */ - detectSupport(renderer: WebGPURenderer | WebGLRenderer): KTX2Loader; - init(): Promise; - /** - * Starts loading from the given URL and passes the loaded KTX2 texture - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(CompressedTexture)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: CompressedTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given KTX2 data. - * - * @param {ArrayBuffer} buffer - The raw KTX2 data as an array buffer. - * @param {function(CompressedTexture)} onLoad - Executed when the loading/parsing process has been finished. - * @param {onErrorCallback} onError - Executed when errors occur. - * @returns {Promise} A Promise that resolves when the parsing has been finished. - */ - parse(buffer: ArrayBuffer, onLoad: (arg0: CompressedTexture) => any, onError: onErrorCallback): Promise; - _createTextureFrom(transcodeResult: any, container: any): CompressedTexture | Promise; - /** - * @private - * @param {ArrayBuffer} buffer - * @param {?Object} config - * @return {Promise} - */ - private _createTexture; - /** - * Frees internal resources. This method should be called - * when the loader is no longer required. - */ - dispose(): void; -} -export namespace KTX2Loader { - namespace BasisFormat { - let ETC1S: number; - let UASTC: number; - let UASTC_HDR: number; - } - namespace TranscoderFormat { - let ETC1: number; - let ETC2: number; - let BC1: number; - let BC3: number; - let BC4: number; - let BC5: number; - let BC7_M6_OPAQUE_ONLY: number; - let BC7_M5: number; - let PVRTC1_4_RGB: number; - let PVRTC1_4_RGBA: number; - let ASTC_4x4: number; - let ATC_RGB: number; - let ATC_RGBA_INTERPOLATED_ALPHA: number; - let RGBA32: number; - let RGB565: number; - let BGR565: number; - let RGBA4444: number; - let BC6H: number; - let RGB_HALF: number; - let RGBA_HALF: number; - } - namespace EngineFormat { - export { RGBAFormat }; - export { RGBA_ASTC_4x4_Format }; - export { RGB_BPTC_UNSIGNED_Format }; - export { RGBA_BPTC_Format }; - export { RGBA_ETC2_EAC_Format }; - export { RGBA_PVRTC_4BPPV1_Format }; - export { RGBA_S3TC_DXT5_Format }; - export { RGB_ETC1_Format }; - export { RGB_ETC2_Format }; - export { RGB_PVRTC_4BPPV1_Format }; - export { RGBA_S3TC_DXT1_Format }; - } - namespace EngineType { - export { UnsignedByteType }; - export { HalfFloatType }; - export { FloatType }; - } - function BasisWorker(): void; -} -import { Loader } from 'three'; -import { WorkerPool } from '../utils/WorkerPool.js'; -import { CompressedTexture } from 'three'; -import { RGBAFormat } from 'three'; -import { RGBA_ASTC_4x4_Format } from 'three'; -import { RGB_BPTC_UNSIGNED_Format } from 'three'; -import { RGBA_BPTC_Format } from 'three'; -import { RGBA_ETC2_EAC_Format } from 'three'; -import { RGBA_PVRTC_4BPPV1_Format } from 'three'; -import { RGBA_S3TC_DXT5_Format } from 'three'; -import { RGB_ETC1_Format } from 'three'; -import { RGB_ETC2_Format } from 'three'; -import { RGB_PVRTC_4BPPV1_Format } from 'three'; -import { RGBA_S3TC_DXT1_Format } from 'three'; -import { UnsignedByteType } from 'three'; -import { HalfFloatType } from 'three'; -import { FloatType } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts deleted file mode 100644 index 931e4f47a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/KTXLoader.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * A loader for the KTX texture compression format. - * - * References: - * - [The KTX File Format and Tools](https://www.khronos.org/opengles/sdk/tools/KTX/) - * - [Babylon.JS khronosTextureContainer.ts](https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts) - * - * ```js - * const loader = new KTXLoader(); - * - * const map = loader.load( 'textures/compressed/lensflare_ASTC8x8.ktx' ) - * map.colorSpace = THREE.SRGBColorSpace; // only for color textures - * ``` - * - * @augments CompressedTextureLoader - * @three_import import { KTXLoader } from 'three/addons/loaders/KTXLoader.js'; - */ -export class KTXLoader extends CompressedTextureLoader { - /** - * Constructs a new KTX loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Parses the given KTX texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @param {boolean} loadMipmaps - Whether to load mipmaps or not. - * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data. - */ - parse(buffer: ArrayBuffer, loadMipmaps: boolean): CompressedTextureLoader; -} -import { CompressedTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts deleted file mode 100644 index 53f42fbe0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/LDrawLoader.d.ts +++ /dev/null @@ -1,256 +0,0 @@ -/** - * A loader for the LDraw format. - * - * [LDraw](https://ldraw.org/} (LEGO Draw) is an [open format specification](https://ldraw.org/article/218.html) - * for describing LEGO and other construction set 3D models. - * - * An LDraw asset (a text file usually with extension .ldr, .dat or .txt) can describe just a single construction - * piece, or an entire model. In the case of a model the LDraw file can reference other LDraw files, which are - * loaded from a library path set with `setPartsLibraryPath`. You usually download the LDraw official parts library, - * extract to a folder and point setPartsLibraryPath to it. - * - * Library parts will be loaded by trial and error in subfolders 'parts', 'p' and 'models'. These file accesses - * are not optimal for web environment, so a script tool has been made to pack an LDraw file with all its dependencies - * into a single file, which loads much faster. See section 'Packing LDraw models'. The LDrawLoader example loads - * several packed files. The official parts library is not included due to its large size. - * - * `LDrawLoader` supports the following extensions: - * - !COLOUR: Color and surface finish declarations. - * - BFC: Back Face Culling specification. - * - !CATEGORY: Model/part category declarations. - * - !KEYWORDS: Model/part keywords declarations. - * - * ```js - * const loader = new LDrawLoader(); - * loader.setConditionalLineMaterial( LDrawConditionalLineMaterial ); // the type of line material depends on the used renderer - * const object = await loader.loadAsync( 'models/ldraw/officialLibrary/models/car.ldr_Packed.mpd' ); - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { LDrawLoader } from 'three/addons/loaders/LDrawLoader.js'; - */ -export class LDrawLoader extends Loader { - /** - * Constructs a new LDraw loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - materials: any[]; - materialLibrary: {}; - edgeMaterialCache: WeakMap; - conditionalEdgeMaterialCache: WeakMap; - partsCache: LDrawPartsGeometryCache; - fileMap: {}; - smoothNormals: boolean; - partsLibraryPath: string; - ConditionalLineMaterial: any; - missingColorMaterial: MeshStandardMaterial; - missingEdgeColorMaterial: LineBasicMaterial; - missingConditionalEdgeColorMaterial: any; - /** - * This method must be called prior to `load()` unless the model to load does not reference - * library parts (usually it will be a model with all its parts packed in a single file). - * - * @param {string} path - Path to library parts files to load referenced parts from. - * This is different from Loader.setPath, which indicates the path to load the main asset from. - * @return {LDrawLoader} A reference to this loader. - */ - setPartsLibraryPath(path: string): LDrawLoader; - /** - * Sets the conditional line material type which depends on the used renderer. - * Use {@link LDrawConditionalLineMaterial} when using `WebGLRenderer` and - * {@link LDrawConditionalLineNodeMaterial} when using `WebGPURenderer`. - * - * @param {(LDrawConditionalLineMaterial.constructor|LDrawConditionalLineNodeMaterial.constructor)} type - The conditional line material type. - * @return {LDrawLoader} A reference to this loader. - */ - setConditionalLineMaterial(type: (LDrawConditionalLineMaterial.constructor | LDrawConditionalLineNodeMaterial.constructor)): LDrawLoader; - /** - * This async method preloads materials from a single LDraw file. In the official - * parts library there is a special file which is loaded always the first (LDConfig.ldr) - * and contains all the standard color codes. This method is intended to be used with - * not packed files, for example in an editor where materials are preloaded and parts - * are loaded on demand. - * - * @async - * @param {string} url - Path of the LDraw materials asset. - * @return {Promise} A Promise that resolves when the preload has finished. - */ - preloadMaterials(url: string): Promise; - /** - * Starts loading from the given URL and passes the loaded LDraw asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given LDraw data and returns the resulting group. - * - * @param {string} text - The raw VRML data as a string. - * @param {function(Group)} onLoad - Executed when the loading/parsing process has been finished. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - parse(text: string, onLoad: (arg0: Group) => any, onError: onErrorCallback): void; - /** - * Sets the loader's material library. This method clears existing - * material definitions. - * - * @param {Array} materials - The materials to set. - * @return {LDrawLoader} A reference to this loader. - */ - setMaterials(materials: Array): LDrawLoader; - /** - * Clears the loader's material library. - * - * @return {LDrawLoader} A reference to this loader. - */ - clearMaterials(): LDrawLoader; - /** - * Adds a list of materials to the loader's material library. - * - * @param {Array} materials - The materials to add. - * @return {LDrawLoader} A reference to this loader. - */ - addMaterials(materials: Array): LDrawLoader; - /** - * Initializes the loader with default materials. - * - * @return {LDrawLoader} A reference to this loader. - */ - addDefaultMaterials(): LDrawLoader; - /** - * Sets a map which maps referenced library filenames to new filenames. - * If a fileMap is not specified (the default), library parts will be accessed by trial and - * error in subfolders 'parts', 'p' and 'models'. - * - * @param {Object} fileMap - The file map to set. - * @return {LDrawLoader} A reference to this loader. - */ - setFileMap(fileMap: { - [x: string]: string; - }): LDrawLoader; - /** - * Adds a single material to the loader's material library. - * - * @param {Material} material - The material to add. - * @return {LDrawLoader} A reference to this loader. - */ - addMaterial(material: Material): LDrawLoader; - /** - * Returns a material for the given color code. - * - * @param {string} colorCode - The color code. - * @return {?Material} The material. Returns `null` if no material has been found. - */ - getMaterial(colorCode: string): Material | null; - applyMaterialsToMesh(group: any, parentColorCode: any, materialHierarchy: any, finalMaterialPass?: boolean): void; - /** - * Returns the Material for the main LDraw color. - * - * For an already loaded LDraw asset, returns the Material associated with the main color code. - * This method can be useful to modify the main material of a model or part that exposes it. - * - * The main color code is the standard way to color an LDraw part. It is '16' for triangles and - * '24' for edges. Usually a complete model will not expose the main color (that is, no part - * uses the code '16' at the top level, because they are assigned other specific colors) An LDraw - * part file on the other hand will expose the code '16' to be colored, and can have additional - * fixed colors. - * - * @return {?Material} The material. Returns `null` if no material has been found. - */ - getMainMaterial(): Material | null; - /** - * Returns the material for the edges main LDraw color. - * - * @return {?Material} The material. Returns `null` if no material has been found. - */ - getMainEdgeMaterial(): Material | null; - parseColorMetaDirective(lineParser: any): MeshStandardMaterial | null; - computeBuildingSteps(model: any): void; -} -import { Loader } from 'three'; -declare class LDrawPartsGeometryCache { - constructor(loader: any); - loader: any; - parseCache: LDrawParsedCache; - _cache: {}; - processIntoMesh(info: any): Promise; - hasCachedModel(fileName: any): boolean; - getCachedModel(fileName: any): Promise; - loadModel(fileName: any): Promise; - parseModel(text: any): Promise; -} -import { MeshStandardMaterial } from 'three'; -import { LineBasicMaterial } from 'three'; -import { Group } from 'three'; -declare class LDrawParsedCache { - constructor(loader: any); - loader: any; - _cache: {}; - cloneResult(original: any): { - faces: any; - conditionalSegments: any; - lineSegments: any; - type: any; - category: any; - keywords: any; - author: any; - subobjects: any; - fileName: any; - totalFaces: any; - startingBuildingStep: any; - materials: any; - group: any; - }; - fetchData(fileName: any): Promise; - parse(text: any, fileName?: null): { - faces: { - material: any; - colorCode: any; - faceNormal: null; - vertices: Vector3[]; - normals: null[]; - doubleSided: boolean; - }[]; - conditionalSegments: { - material: any; - colorCode: any; - vertices: Vector3[]; - controlPoints: Vector3[]; - }[]; - lineSegments: { - material: any; - colorCode: any; - vertices: Vector3[]; - }[]; - type: string; - category: any; - keywords: any[] | null; - author: any; - subobjects: { - material: any; - colorCode: any; - matrix: Matrix4; - fileName: any; - inverted: boolean; - startingBuildingStep: boolean; - }[]; - totalFaces: number; - startingBuildingStep: boolean; - materials: {}; - fileName: null; - group: null; - }; - getData(fileName: any, clone?: boolean): any; - ensureDataLoaded(fileName: any): Promise; - setData(fileName: any, text: any): void; -} -import { Vector3 } from 'three'; -import { Matrix4 } from 'three'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts deleted file mode 100644 index 86866f649..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUT3dlLoader.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * A loader for the 3DL LUT format. - * - * References: - * - [3D LUTs](http://download.autodesk.com/us/systemdocs/help/2011/lustre/index.html?url=./files/WSc4e151a45a3b785a24c3d9a411df9298473-7ffd.htm,topicNumber=d0e9492) - * - [Format Spec for .3dl](https://community.foundry.com/discuss/topic/103636/format-spec-for-3dl?mode=Post&postID=895258) - * - * ```js - * const loader = new LUT3dlLoader(); - * const map = loader.loadAsync( 'luts/Presetpro-Cinematic.3dl' ); - * ``` - * - * @augments Loader - * @three_import import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js'; - */ -export class LUT3dlLoader extends Loader { - /** - * Constructs a new 3DL LUT loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The texture type. - * - * @type {(UnsignedByteType|FloatType)} - * @default UnsignedByteType - */ - type: (number | FloatType); - /** - * Sets the texture type. - * - * @param {(UnsignedByteType|FloatType)} type - The texture type to set. - * @return {LUT3dlLoader} A reference to this loader. - */ - setType(type: (number | FloatType)): LUT3dlLoader; - /** - * Starts loading from the given URL and passes the loaded 3DL LUT asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({size:number,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - size: number; - texture3D: Data3DTexture; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given 3DL LUT data and returns the resulting 3D data texture. - * - * @param {string} input - The raw 3DL LUT data as a string. - * @return {{size:number,texture3D:Data3DTexture}} The parsed 3DL LUT. - */ - parse(input: string): { - size: number; - texture3D: Data3DTexture; - }; -} -import { Loader } from 'three'; -import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts deleted file mode 100644 index 9632d7613..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTCubeLoader.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * A loader for the Cube LUT format. - * - * References: - * - [Cube LUT Specification](https://web.archive.org/web/20220220033515/https://wwwimages2.adobe.com/content/dam/acom/en/products/speedgrade/cc/pdfs/cube-lut-specification-1.0.pdf) - * - * ```js - * const loader = new LUTCubeLoader(); - * const map = loader.loadAsync( 'luts/Bourbon 64.CUBE' ); - * ``` - * - * @augments Loader - * @three_import import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js'; - */ -export class LUTCubeLoader extends Loader { - /** - * Constructs a new Cube LUT loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The texture type. - * - * @type {(UnsignedByteType|FloatType)} - * @default UnsignedByteType - */ - type: (number | FloatType); - /** - * Sets the texture type. - * - * @param {(UnsignedByteType|FloatType)} type - The texture type to set. - * @return {LUTCubeLoader} A reference to this loader. - */ - setType(type: (number | FloatType)): LUTCubeLoader; - /** - * Starts loading from the given URL and passes the loaded Cube LUT asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - title: string; - size: number; - domainMin: Vector3; - domainMax: Vector3; - texture3D: Data3DTexture; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given Cube LUT data and returns the resulting 3D data texture. - * - * @param {string} input - The raw Cube LUT data as a string. - * @return {{title:string,size:number,domainMin:Vector3,domainMax:Vector3,texture3D:Data3DTexture}} The parsed Cube LUT. - */ - parse(input: string): { - title: string; - size: number; - domainMin: Vector3; - domainMax: Vector3; - texture3D: Data3DTexture; - }; -} -import { Loader } from 'three'; -import { Vector3 } from 'three'; -import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts deleted file mode 100644 index 82ad5b541..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/LUTImageLoader.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * A loader for loading LUT images. - * - * ```js - * const loader = new LUTImageLoader(); - * const map = loader.loadAsync( 'luts/NeutralLUT.png' ); - * ``` - * - * @augments Loader - * @three_import import { LUTImageLoader } from 'three/addons/loaders/LUTImageLoader.js'; - */ -export class LUTImageLoader extends Loader { - /** - * Constructs a new LUT loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Whether to vertically flip the LUT or not. - * - * Depending on the LUT's origin, the texture has green at the bottom (e.g. for Unreal) - * or green at the top (e.g. for Unity URP Color Lookup). If you're using lut image strips - * from a Unity pipeline, then set this property to `true`. - * - * @type {boolean} - * @default false - */ - flip: boolean; - /** - * Starts loading from the given URL and passes the loaded LUT - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({size:number,texture3D:Data3DTexture})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - size: number; - texture3D: Data3DTexture; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given LUT data and returns the resulting 3D data texture. - * - * @param {Uint8ClampedArray} dataArray - The raw LUT data. - * @param {number} size - The LUT size. - * @return {{size:number,texture3D:Data3DTexture}} An object representing the parsed LUT. - */ - parse(dataArray: Uint8ClampedArray, size: number): { - size: number; - texture3D: Data3DTexture; - }; - _getImageData(texture: any): ImageData; - _horz2Vert(texture: any): ImageData; -} -import { Loader } from 'three'; -import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts deleted file mode 100644 index d41e3dac0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/LWOLoader.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * A loader for the LWO format. - * - * LWO3 and LWO2 formats are supported. - * - * References: - * - [LWO3 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html) - * - [LWO2 format specification](https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html) - * - * ```js - * const loader = new LWOLoader(); - * const lwoData = await loader.loadAsync( 'models/lwo/Objects/LWO3/Demo.lwo' ); - * - * const mesh = object.meshes[ 0 ]; - * scene.add( mesh ); - * ``` - * - * @augments Loader - * @three_import import { LWOLoader } from 'three/addons/loaders/LWOLoader.js'; - * @deprecated since r185. - */ -export class LWOLoader extends Loader { - /** - * Constructs a new LWO loader. - * - * @param {LoadingManager} [manager] - The loading manager. - * @deprecated since r185. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded LWO asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({meshes:Array,materials:Array})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - meshes: Array; - materials: Array; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given LWO data and returns the resulting meshes and materials. - * - * @param {ArrayBuffer} iffBuffer - The raw LWO data as an array buffer. - * @param {string} path - The URL base path. - * @param {string} modelName - The model name. - * @return {{meshes:Array,materials:Array}} An object holding the parse meshes and materials. - */ - parse(iffBuffer: ArrayBuffer, path: string, modelName: string): { - meshes: Array; - materials: Array; - }; -} -import { Loader } from 'three'; -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts deleted file mode 100644 index 8a30bffd1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/MD2Loader.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * A loader for the MD2 format. - * - * The loader represents the animations of the MD2 asset as an array of animation - * clips and stores them in the `animations` property of the geometry. - * - * ```js - * const loader = new MD2Loader(); - * const geometry = await loader.loadAsync( './models/md2/ogro/ogro.md2' ); - * - * const animations = geometry.animations; - * ``` - * - * @augments Loader - * @three_import import { MD2Loader } from 'three/addons/loaders/MD2Loader.js'; - */ -export class MD2Loader extends Loader { - /** - * Constructs a new MD2 loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded MD2 asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. - * @param {onErrorCallback} [onError] - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress?: onProgressCallback, onError?: onErrorCallback): void; - /** - * Parses the given MD2 data and returns a geometry. - * - * @param {ArrayBuffer} buffer - The raw MD2 data as an array buffer. - * @return {BufferGeometry} The parsed geometry data. - */ - parse(buffer: ArrayBuffer): BufferGeometry; -} -import { Loader } from 'three'; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts deleted file mode 100644 index 428e8f4ad..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/MDDLoader.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * A loader for the MDD format. - * - * MDD stores a position for every vertex in a model for every frame in an animation. - * Similar to BVH, it can be used to transfer animation data between different 3D applications or engines. - * - * MDD stores its data in binary format (big endian) in the following way: - * - * - number of frames (a single uint32) - * - number of vertices (a single uint32) - * - time values for each frame (sequence of float32) - * - vertex data for each frame (sequence of float32) - * - * ```js - * const loader = new MDDLoader(); - * const result = await loader.loadAsync( 'models/mdd/cube.mdd' ); - * - * const morphTargets = result.morphTargets; - * const clip = result.clip; - * // clip.optimize(); // optional - * - * const geometry = new THREE.BoxGeometry(); - * geometry.morphAttributes.position = morphTargets; // apply morph targets (vertex data must match) - * - * const material = new THREE.MeshBasicMaterial(); - * - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * - * const mixer = new THREE.AnimationMixer( mesh ); - * mixer.clipAction( clip ).play(); - * ``` - * - * @augments Loader - * @three_import import { MDDLoader } from 'three/addons/loaders/MDDLoader.js'; - */ -export class MDDLoader extends Loader { - /** - * Constructs a new MDD loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded MDD asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({clip:AnimationClip, morphTargets:Array})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - clip: AnimationClip; - morphTargets: Array; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given MDD data and returns an object holding the animation clip and the respective - * morph targets. - * - * @param {ArrayBuffer} data - The raw XYZ data as an array buffer. - * @return {{clip:AnimationClip, morphTargets:Array}} The result object. - */ - parse(data: ArrayBuffer): { - clip: AnimationClip; - morphTargets: Array; - }; -} -import { Loader } from 'three'; -import { AnimationClip } from 'three'; -import { BufferAttribute } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts deleted file mode 100644 index c4443bb17..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/MTLLoader.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * ~MaterialOptions - */ -export type MTLLoader = { - /** - * - Which side to apply the material. - */ - side?: (number | BackSide | DoubleSide); - /** - * - What type of wrapping to apply for textures. - */ - wrap?: (number | ClampToEdgeWrapping | MirroredRepeatWrapping); - /** - * - Whether RGB colors should be normalized to `0-1` from `0-255`. - */ - normalizeRGB?: boolean | undefined; - /** - * - Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. - */ - ignoreZeroRGBs?: boolean | undefined; -}; -/** - * A loader for the MTL format. - * - * The Material Template Library format (MTL) or .MTL File Format is a companion file format - * to OBJ that describes surface shading (material) properties of objects within one or more - * OBJ files. - * - * ```js - * const loader = new MTLLoader(); - * const materials = await loader.loadAsync( 'models/obj/male02/male02.mtl' ); - * - * const objLoader = new OBJLoader(); - * objLoader.setMaterials( materials ); - * ``` - * - * @augments Loader - * @three_import import { MTLLoader } from 'three/addons/loaders/MTLLoader.js'; - */ -export class MTLLoader extends Loader { - constructor(manager: any); - /** - * Starts loading from the given URL and passes the loaded MTL asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(MaterialCreator)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: MaterialCreator) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Sets the material options. - * - * @param {MTLLoader~MaterialOptions} value - The material options. - * @return {MTLLoader} A reference to this loader. - */ - setMaterialOptions(value: any): MTLLoader; - materialOptions: any; - /** - * Parses the given MTL data and returns the resulting material creator. - * - * @param {string} text - The raw MTL data as a string. - * @param {string} path - The URL base path. - * @return {MaterialCreator} The material creator. - */ - parse(text: string, path: string): MaterialCreator; -} -import { Loader } from 'three'; -/** - * Material options of `MTLLoader`. - * - * @typedef {Object} MTLLoader~MaterialOptions - * @property {(FrontSide|BackSide|DoubleSide)} [side=FrontSide] - Which side to apply the material. - * @property {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} [wrap=RepeatWrapping] - What type of wrapping to apply for textures. - * @property {boolean} [normalizeRGB=false] - Whether RGB colors should be normalized to `0-1` from `0-255`. - * @property {boolean} [ignoreZeroRGBs=false] - Ignore values of RGBs (Ka,Kd,Ks) that are all 0's. - */ -declare class MaterialCreator { - constructor(baseUrl?: string, options?: {}); - baseUrl: string; - options: {}; - materialsInfo: {}; - materials: {}; - materialsArray: any[]; - nameLookup: {}; - crossOrigin: string; - side: any; - wrap: any; - setCrossOrigin(value: any): this; - setManager(value: any): void; - manager: any; - setMaterials(materialsInfo: any): void; - convert(materialsInfo: any): any; - preload(): void; - getIndex(materialName: any): any; - getAsArray(): any[]; - create(materialName: any): any; - createMaterial_(materialName: any): any; - getTextureParams(value: any, matParams: any): { - scale: Vector2; - offset: Vector2; - }; - loadTexture(url: any, mapping: any, onLoad: any, onProgress: any, onError: any): any; -} -import { Vector2 } from 'three'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts deleted file mode 100644 index 1386a8f0a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/MaterialXLoader.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export class MaterialXLoader extends Loader { - constructor(manager: any); - archiveDisposer: (() => void) | null; - dispose(): this; - load(url: any, onLoad: any, onProgress: any, onError: any, options?: {}): this; - loadAsync(url: any, onProgress: any, options?: {}): Promise; - parseBuffer(data: any, url?: string, options?: {}): { - materials: any; - log: any; - errors: any; - warnings: any; - }; - parse(text: any, options?: {}): { - materials: any; - log: any; - errors: any; - warnings: any; - }; -} -import { Loader } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts deleted file mode 100644 index 1ffe169c3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/NRRDLoader.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * A loader for the NRRD format. - * - * ```js - * const loader = new NRRDLoader(); - * const volume = await loader.loadAsync( 'models/nrrd/I.nrrd' ); - * ``` - * - * @augments Loader - * @three_import import { NRRDLoader } from 'three/addons/loaders/NRRDLoader.js'; - */ -export class NRRDLoader extends Loader { - /** - * Constructs a new NRRD loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded NRRD asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Volume)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Volume) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Toggles the segmentation mode. - * - * @param {boolean} segmentation - Whether to use segmentation mode or not. - */ - setSegmentation(segmentation: boolean): void; - segmentation: boolean | undefined; - /** - * Parses the given NRRD data and returns the resulting volume data. - * - * @param {ArrayBuffer} data - The raw NRRD data as an array buffer. - * @return {Volume} The parsed volume. - */ - parse(data: ArrayBuffer): Volume; - _parseChars(array: any, start: any, end: any): string; -} -import { Loader } from 'three'; -import { Volume } from '../misc/Volume.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts deleted file mode 100644 index b35f787d0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/OBJLoader.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * A loader for the OBJ format. - * - * The [OBJ format](https://en.wikipedia.org/wiki/Wavefront_.obj_file) is a simple data-format that - * represents 3D geometry in a human readable format as the position of each vertex, the UV position of - * each texture coordinate vertex, vertex normals, and the faces that make each polygon defined as a list - * of vertices, and texture vertices. - * - * ```js - * const loader = new OBJLoader(); - * const object = await loader.loadAsync( 'models/monster.obj' ); - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; - */ -export class OBJLoader extends Loader { - /** - * Constructs a new OBJ loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * A reference to a material creator. - * - * @type {?MaterialCreator} - * @default null - */ - materials: MaterialCreator | null; - /** - * Starts loading from the given URL and passes the loaded OBJ asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Sets the material creator for this OBJ. This object is loaded via {@link MTLLoader}. - * - * @param {MaterialCreator} materials - An object that creates the materials for this OBJ. - * @return {OBJLoader} A reference to this loader. - */ - setMaterials(materials: MaterialCreator): OBJLoader; - /** - * Parses the given OBJ data and returns the resulting group. - * - * @param {string} text - The raw OBJ data as a string. - * @return {Group} The parsed OBJ. - */ - parse(text: string): Group; -} -import { Loader } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts deleted file mode 100644 index e11b512de..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/PCDLoader.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * A loader for the Point Cloud Data (PCD) format. - * - * PCDLoader supports ASCII and (compressed) binary files as well as the following PCD fields: - * - x y z - * - rgb - * - normal_x normal_y normal_z - * - intensity - * - label - * - * ```js - * const loader = new PCDLoader(); - * - * const points = await loader.loadAsync( './models/pcd/binary/Zaghetto.pcd' ); - * points.geometry.center(); // optional - * points.geometry.rotateX( Math.PI ); // optional - * scene.add( points ); - * ``` - * - * @augments Loader - * @three_import import { PCDLoader } from 'three/addons/loaders/PCDLoader.js'; - */ -export class PCDLoader extends Loader { - /** - * Constructs a new PCD loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Whether to use little Endian or not. - * - * @type {boolean} - * @default true - */ - littleEndian: boolean; - /** - * Starts loading from the given URL and passes the loaded PCD asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Points)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Points) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Get dataview value by field type and size. - * - * @private - * @param {DataView} dataview - The DataView to read from. - * @param {number} offset - The offset to start reading from. - * @param {'F' | 'U' | 'I'} type - Field type. - * @param {number} size - Field size. - * @returns {number} Field value. - */ - private _getDataView; - /** - * Parses the given PCD data and returns a point cloud. - * - * @param {ArrayBuffer} data - The raw PCD data as an array buffer. - * @return {Points} The parsed point cloud. - */ - parse(data: ArrayBuffer): Points; -} -import { Loader } from 'three'; -import { Points } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts deleted file mode 100644 index 9502d6e8e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/PDBLoader.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A loader for the PDB format. - * - * The [Protein Data Bank](https://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)) - * file format is a textual file describing the three-dimensional structures of molecules. - * - * ```js - * const loader = new PDBLoader(); - * const pdb = await loader.loadAsync( 'models/pdb/ethanol.pdb' ); - * - * const geometryAtoms = pdb.geometryAtoms; - * const geometryBonds = pdb.geometryBonds; - * const json = pdb.json; - * ``` - * - * @augments Loader - * @three_import import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; - */ -export class PDBLoader extends Loader { - /** - * Constructs a new PDB loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded PDB asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Object)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given PDB data and returns an object holding the atoms and - * bond geometries as well as the raw atom data as JSON. - * - * @param {string} text - The raw PDB data as a string. - * @return {Object} The result object. - */ - parse(text: string): Object; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts deleted file mode 100644 index c03afd50c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/PLYLoader.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * A loader for PLY the PLY format (known as the Polygon - * File Format or the Stanford Triangle Format). - * - * Limitations: - * - ASCII decoding assumes file is UTF-8. - * - * ```js - * const loader = new PLYLoader(); - * const geometry = await loader.loadAsync( './models/ply/ascii/dolphins.ply' ); - * scene.add( new THREE.Mesh( geometry ) ); - * ``` - * - * @augments Loader - * @three_import import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; - */ -export class PLYLoader extends Loader { - /** - * Constructs a new PLY loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - propertyNameMapping: {}; - customPropertyMapping: {}; - /** - * Starts loading from the given URL and passes the loaded PLY asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Sets a property name mapping that maps default property names - * to custom ones. For example, the following maps the properties - * “diffuse_(red|green|blue)” in the file to standard color names. - * - * ```js - * loader.setPropertyNameMapping( { - * diffuse_red: 'red', - * diffuse_green: 'green', - * diffuse_blue: 'blue' - * } ); - * ``` - * - * @param {Object} mapping - The mapping dictionary. - */ - setPropertyNameMapping(mapping: Object): void; - /** - * Custom properties outside of the defaults for position, uv, normal - * and color attributes can be added using the setCustomPropertyNameMapping method. - * For example, the following maps the element properties “custom_property_a” - * and “custom_property_b” to an attribute “customAttribute” with an item size of 2. - * Attribute item sizes are set from the number of element properties in the property array. - * - * ```js - * loader.setCustomPropertyNameMapping( { - * customAttribute: ['custom_property_a', 'custom_property_b'], - * } ); - * ``` - * @param {Object} mapping - The mapping dictionary. - */ - setCustomPropertyNameMapping(mapping: Object): void; - /** - * Parses the given PLY data and returns the resulting geometry. - * - * @param {ArrayBuffer} data - The raw PLY data as an array buffer. - * @return {BufferGeometry} The parsed geometry. - */ - parse(data: ArrayBuffer): BufferGeometry; -} -import { Loader } from 'three'; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts deleted file mode 100644 index e8f73618d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/PVRLoader.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A loader for the PVRTC texture compression format. - * - * ```js - * const loader = new PVRLoader(); - * - * const map = loader.load( 'textures/compressed/disturb_4bpp_rgb.pvr' ); - * map.colorSpace = THREE.SRGBColorSpace; // only for color textures - * ``` - * - * @augments CompressedTextureLoader - * @three_import import { PVRLoader } from 'three/addons/loaders/PVRLoader.js'; - */ -export class PVRLoader extends CompressedTextureLoader { - /** - * Constructs a new PVR loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Parses the given PVRTC texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @param {boolean} loadMipmaps - Whether to load mipmaps or not. This option is not yet supported by the loader. - * @return {CompressedTextureLoader~TexData} An object representing the parsed texture data. - */ - parse(buffer: ArrayBuffer, loadMipmaps: boolean): CompressedTextureLoader; -} -import { CompressedTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts deleted file mode 100644 index 692cc5d8e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/RGBELoader.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class RGBELoader extends HDRLoader { -} -import { HDRLoader } from './HDRLoader.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts deleted file mode 100644 index 4bffcabde..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/SPLATLoader.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * A loader for standard fixed-width Gaussian splat `.splat` files. - * - * This loader decodes the format into `BufferGeometry` for use with - * `GaussianSplat`. Each 32-byte row stores center, scale, color and - * rotation data for one splat. - * - * ```js - * const loader = new SPLATLoader(); - * const data = await loader.loadAsync( './models/gsplat/example.splat' ); - * scene.add( new GaussianSplat( data ) ); - * ``` - * - * @augments Loader - * @three_import import { SPLATLoader } from 'three/addons/loaders/SPLATLoader.js'; - */ -export class SPLATLoader extends Loader { - /** - * Constructs a new Gaussian splat loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded splat data to - * the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given fixed-width `.splat` data. - * - * @param {ArrayBuffer} buffer - The raw `.splat` file as an array buffer. - * @return {BufferGeometry} The parsed splat geometry. - */ - parse(buffer: ArrayBuffer): BufferGeometry; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts deleted file mode 100644 index 723c0925c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/SPZLoader.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * A loader for compressed Gaussian splat `.spz` files. - * - * This loader decodes the format into `BufferGeometry` for use with - * `GaussianSplat`. Higher-order spherical harmonics are exposed as optional - * `sphericalHarmonics1` through `sphericalHarmonics3` packed uint32 geometry - * attributes (`SH_BAND_WORDS[ degree ]` words per splat). Coefficients use the - * clamped-byte encoding `( value - 128 ) / 128`, four bytes per word. - * - * ```js - * const loader = new SPZLoader(); - * const data = await loader.loadAsync( './models/gsplat/example.spz' ); - * scene.add( new GaussianSplat( data ) ); - * ``` - * - * @augments Loader - * @three_import import { SPZLoader } from 'three/addons/loaders/SPZLoader.js'; - */ -export class SPZLoader extends Loader { - /** - * Constructs a new Gaussian splat SPZ loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded splat data to - * the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Decompresses and parses the given `.spz` data. - * - * @param {ArrayBuffer} buffer - The raw SPZ file as an array buffer. - * @param {function(BufferGeometry)} [onLoad] - Executed when the parsing process has been finished. - * @param {onErrorCallback} [onError] - Executed when errors occur. - * @return {BufferGeometry|Promise|undefined} The parsed splat geometry, or a promise for SPZ v4 data. - */ - parse(buffer: ArrayBuffer, onLoad?: (arg0: BufferGeometry) => any, onError?: onErrorCallback): BufferGeometry | Promise | undefined; - /** - * Parses raw SPZ data after gzip decompression. - * - * @param {Uint8Array} bytes - The decompressed SPZ data. - * @return {BufferGeometry} The parsed splat geometry. - */ - parseRawSPZ(bytes: Uint8Array): BufferGeometry; - /** - * Parses raw SPZ v4 data. - * - * @param {Uint8Array} bytes - The raw SPZ v4 data. - * @param {ZSTDDecoder} zstd - The initialized ZSTD decoder. - * @return {BufferGeometry} The parsed splat geometry. - */ - parseRawSPZV4(bytes: Uint8Array, zstd: ZSTDDecoder): BufferGeometry; -} -import { Loader } from 'three'; -import { ZSTDDecoder } from '../libs/zstddec.module.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts deleted file mode 100644 index aae8f96aa..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/STLLoader.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * A loader for the STL format, as created by Solidworks and other CAD programs. - * - * Supports both binary and ASCII encoded files. The loader returns a non-indexed buffer geometry. - * - * Limitations: - * - Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL). - * - There is perhaps some question as to how valid it is to always assume little-endian-ness. - * - ASCII decoding assumes file is UTF-8. - * - * ```js - * const loader = new STLLoader(); - * const geometry = await loader.loadAsync( './models/stl/slotted_disk.stl' ) - * scene.add( new THREE.Mesh( geometry ) ); - * ``` - * For binary STLs geometry might contain colors for vertices. To use it: - * ```js - * // use the same code to load STL as above - * if ( geometry.hasColors ) { - * material = new THREE.MeshPhongMaterial( { opacity: geometry.alpha, vertexColors: true } ); - * } - * const mesh = new THREE.Mesh( geometry, material ); - * ``` - * For ASCII STLs containing multiple solids, each solid is assigned to a different group. - * Groups can be used to assign a different color by defining an array of materials with the same length of - * geometry.groups and passing it to the Mesh constructor: - * - * ```js - * const materials = []; - * const nGeometryGroups = geometry.groups.length; - * - * for ( let i = 0; i < nGeometryGroups; i ++ ) { - * const material = new THREE.MeshPhongMaterial( { color: colorMap[ i ], wireframe: false } ); - * materials.push( material ); - * } - * - * const mesh = new THREE.Mesh(geometry, materials); - * ``` - * - * @augments Loader - * @three_import import { STLLoader } from 'three/addons/loaders/STLLoader.js'; - */ -export class STLLoader extends Loader { - /** - * Constructs a new STL loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded STL asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given STL data and returns the resulting geometry. - * - * @param {ArrayBuffer} data - The raw STL data as an array buffer. - * @return {BufferGeometry} The parsed geometry. - */ - parse(data: ArrayBuffer): BufferGeometry; -} -import { Loader } from 'three'; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts deleted file mode 100644 index b11481bc5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/SVGLoader.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** - * A loader for the SVG format. - * - * Scalable Vector Graphics is an XML-based vector image format for two-dimensional graphics - * with support for interactivity and animation. - * - * ```js - * const loader = new SVGLoader(); - * const data = await loader.loadAsync( 'data/svgSample.svg' ); - * - * const paths = data.paths; - * const group = new THREE.Group(); - * - * for ( let i = 0; i < paths.length; i ++ ) { - * - * const path = paths[ i ]; - * const material = new THREE.MeshBasicMaterial( { - * color: path.color, - * side: THREE.DoubleSide, - * depthWrite: false - * } ); - * - * const shapes = SVGLoader.createShapes( path ); - * - * for ( let j = 0; j < shapes.length; j ++ ) { - * - * const shape = shapes[ j ]; - * const geometry = new THREE.ShapeGeometry( shape ); - * const mesh = new THREE.Mesh( geometry, material ); - * group.add( mesh ); - * - * } - * - * } - * - * scene.add( group ); - * ``` - * - * @augments Loader - * @three_import import { SVGLoader } from 'three/addons/loaders/SVGLoader.js'; - */ -export class SVGLoader extends Loader { - /** - * Creates a material for rendering the fill of the given path. - * - * @param {ShapePath} shapePath - The shape path. - * @return {?MeshBasicMaterial} The fill material. `null` if the path has no fill. - */ - static createFillMaterial(shapePath: ShapePath): MeshBasicMaterial | null; - /** - * Creates a material for rendering the stroke of the given path. - * - * @param {ShapePath} shapePath - The shape path. - * @return {?MeshBasicMaterial} The stroke material. `null` if the path has no stroke. - */ - static createStrokeMaterial(shapePath: ShapePath): MeshBasicMaterial | null; - /** - * Creates from the given shape path and array of shapes. - * - * @deprecated since 185. - * @param {ShapePath} shapePath - The shape path. - * @return {Array} An array of shapes. - */ - static createShapes(shapePath: ShapePath): Array; - /** - * Returns a stroke style object from the given parameters. - * - * @param {number} [width=1] - The stroke width. - * @param {string} [color='#000'] - The stroke color, as returned by {@link Color#getStyle}. - * @param {'round'|'bevel'|'miter'|'miter-limit'} [lineJoin='miter'] - The line join style. - * @param {'round'|'square'|'butt'} [lineCap='butt'] - The line cap style. - * @param {number} [miterLimit=4] - Maximum join length, in multiples of the `width` parameter (join is truncated if it exceeds that distance). - * @return {Object} The style object. - */ - static getStrokeStyle(width?: number, color?: string, lineJoin?: "round" | "bevel" | "miter" | "miter-limit", lineCap?: "round" | "square" | "butt", miterLimit?: number): Object; - /** - * Creates a stroke from an array of points. - * - * @param {Array} points - The points in 2D space. Minimum 2 points. The path can be open or closed (last point equals to first point). - * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object. - * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps. - * @param {number} [minDistance=0.001] - Points closer to this distance will be merged. - * @return {?BufferGeometry} The stroke geometry. UV coordinates are generated ('u' along path. 'v' across it, from left to right). - * Returns `null` if not geometry was generated. - */ - static pointsToStroke(points: Array, style: Object, arcDivisions?: number, minDistance?: number): BufferGeometry | null; - /** - * Creates a stroke from an array of points. - * - * @param {Array} points - The points in 2D space. Minimum 2 points. - * @param {Object} style - Object with SVG properties as returned by `SVGLoader.getStrokeStyle()`, or `SVGLoader.parse()` in the `path.userData.style` object. - * @param {number} [arcDivisions=12] - Arc divisions for round joins and endcaps. - * @param {number} [minDistance=0.001] - Points closer to this distance will be merged. - * @param {Array} vertices - An array holding vertices. - * @param {Array} normals - An array holding normals. - * @param {Array} uvs - An array holding uvs. - * @param {number} [vertexOffset=0] - The vertex offset. - * @return {number} The number of vertices. - */ - static pointsToStrokeWithBuffers(points: Array, style: Object, arcDivisions?: number, minDistance?: number, vertices: Array, normals: Array, uvs: Array, vertexOffset?: number): number; - /** - * Constructs a new SVG loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Default dots per inch. - * - * @type {number} - * @default 90 - */ - defaultDPI: number; - /** - * Default unit. - * - * @type {('mm'|'cm'|'in'|'pt'|'pc'|'px')} - * @default 'px' - */ - defaultUnit: ("mm" | "cm" | "in" | "pt" | "pc" | "px"); - /** - * Starts loading from the given URL and passes the loaded SVG asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function({paths:Array,xml:string})} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: { - paths: Array; - xml: string; - }) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given SVG data and returns the resulting data. - * - * @param {string} text - The raw SVG data as a string. - * @return {{paths:Array,xml:string}} An object holding an array of shape paths and the - * SVG XML document. - */ - parse(text: string): { - paths: Array; - xml: string; - }; -} -import { Loader } from 'three'; -import { ShapePath } from 'three'; -import { MeshBasicMaterial } from 'three'; -import { Vector2 } from 'three'; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts deleted file mode 100644 index 819ba7cd6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/TDSLoader.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * A loader for the 3DS format, based on lib3ds. - * - * Loads geometry with uv and materials basic properties with texture support. - * - * ```js - * const loader = new TDSLoader(); - * loader.setResourcePath( 'models/3ds/portalgun/textures/' ); - * const object = await loader.loadAsync( 'models/3ds/portalgun/portalgun.3ds' ); - * scene.add( object ); - * - * @augments Loader - * @three_import import { TDSLoader } from 'three/addons/loaders/TDSLoader.js'; - */ -export class TDSLoader extends Loader { - /** - * Constructs a new 3DS loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Whether debug mode should be enabled or not. - * - * @type {boolean} - * @default false - */ - debug: boolean; - group: Group | null; - materials: any[]; - meshes: any[]; - /** - * Starts loading from the given URL and passes the loaded 3DS asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given 3DS data and returns the resulting data. - * - * @param {ArrayBuffer} arraybuffer - The raw 3DS data as an array buffer. - * @param {string} path - The asset path. - * @return {Group} The parsed asset represented as a group. - */ - parse(arraybuffer: ArrayBuffer, path: string): Group; - /** - * Decode file content to read 3ds data. - * - * @private - * @param {ArrayBuffer} arraybuffer - Arraybuffer data to be loaded. - * @param {string} path - Path for external resources. - */ - private readFile; - /** - * Read mesh data chunk. - * - * @private - * @param {Chunk} chunk - to read mesh from - * @param {string} path - Path for external resources. - */ - private readMeshData; - /** - * Read named object chunk. - * - * @private - * @param {Chunk} chunk - Chunk in use. - */ - private readNamedObject; - /** - * Read material data chunk and add it to the material list. - * - * @private - * @param {Chunk} chunk - Chunk in use. - * @param {string} path - Path for external resources. - */ - private readMaterialEntry; - /** - * Read mesh data chunk. - * - * @private - * @param {Chunk} chunk - Chunk in use. - * @return {Mesh} - The parsed mesh. - */ - private readMesh; - /** - * Read face array data chunk. - * - * @private - * @param {Chunk} chunk - Chunk in use. - * @param {Mesh} mesh - Mesh to be filled with the data read. - */ - private readFaceArray; - /** - * Read texture map data chunk. - * - * @private - * @param {Chunk} chunk - Chunk in use. - * @param {string} path - Path for external resources. - * @return {Texture} Texture read from this data chunk. - */ - private readMap; - /** - * Read material group data chunk. - * - * @private - * @param {Chunk} chunk - Chunk in use. - * @return {Object} Object with name and index of the object. - */ - private readMaterialGroup; - /** - * Read a color value. - * - * @private - * @param {Chunk} chunk - Chunk. - * @return {Color} Color value read. - */ - private readColor; - /** - * Read percentage value. - * - * @private - * @param {Chunk} chunk - Chunk to read data from. - * @return {number} Data read from the dataview. - */ - private readPercentage; - /** - * Print debug message to the console. - * - * Is controlled by a flag to show or hide debug messages. - * - * @private - * @param {Object} message - Debug message to print to the console. - */ - private debugMessage; -} -import { Loader } from 'three'; -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts deleted file mode 100644 index 56f74907c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/TGALoader.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * A loader for the TGA texture format. - * - * ```js - * const loader = new TGALoader(); - * const texture = await loader.loadAsync( 'textures/crate_color8.tga' ); - * texture.colorSpace = THREE.SRGBColorSpace; // only for color textures - * ``` - * - * @augments DataTextureLoader - * @three_import import { TGALoader } from 'three/addons/loaders/TGALoader.js'; - */ -export class TGALoader extends DataTextureLoader { - /** - * Constructs a new TGA loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Parses the given TGA texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @return {DataTextureLoader~TexData} An object representing the parsed texture data. - */ - parse(buffer: ArrayBuffer): DataTextureLoader; -} -import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts deleted file mode 100644 index 3291f03ea..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/TIFFLoader.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * A loader for the TIFF texture format. - * - * ```js - * const loader = new TIFFLoader(); - * const texture = await loader.loadAsync( 'textures/tiff/crate_lzw.tif' ); - * texture.colorSpace = THREE.SRGBColorSpace; - * ``` - * - * @augments DataTextureLoader - * @three_import import { TIFFLoader } from 'three/addons/loaders/TIFFLoader.js'; - */ -export class TIFFLoader extends DataTextureLoader { - /** - * Constructs a new TIFF loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Parses the given TIFF texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @return {DataTextureLoader~TexData} An object representing the parsed texture data. - */ - parse(buffer: ArrayBuffer): DataTextureLoader; -} -import { DataTextureLoader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts deleted file mode 100644 index a9a9483c9..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/TTFLoader.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A loader for the TTF format. - * - * Loads TTF files and converts them into typeface JSON that can be used directly - * to create THREE.Font objects. - * - * ```js - * const loader = new TTFLoader(); - * const json = await loader.loadAsync( 'fonts/ttf/kenpixel.ttf' ); - * const font = new Font( json ); - * ``` - * - * @augments Loader - * @three_import import { TTFLoader } from 'three/addons/loaders/TTFLoader.js'; - */ -export class TTFLoader extends Loader { - /** - * Constructs a new TTF loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Whether the TTF commands should be reversed or not. - * - * @type {boolean} - * @default false - */ - reversed: boolean; - /** - * Starts loading from the given URL and passes the loaded TTF asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Object)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given TTF data and returns a JSON for creating a font. - * - * @param {ArrayBuffer} arraybuffer - The raw TTF data as an array buffer. - * @return {Object} The result JSON. - */ - parse(arraybuffer: ArrayBuffer): Object; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts deleted file mode 100644 index 247a6b36a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/USDLoader.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A loader for the USD format (USD, USDA, USDC, USDZ). - * - * Supports both ASCII (USDA) and binary (USDC) USD files, as well as - * USDZ archives containing either format. - * - * ```js - * const loader = new USDLoader(); - * const model = await loader.loadAsync( 'model.usdz' ); - * scene.add( model ); - * ``` - * - * @augments Loader - * @three_import import { USDLoader } from 'three/addons/loaders/USDLoader.js'; - */ -export class USDLoader extends Loader { - /** - * Constructs a new USDZ loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded USDZ asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Group)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Group) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given USDZ data and returns the resulting group. - * - * The returned group is created synchronously, but any referenced textures - * are loaded asynchronously. Provide `onLoad` to be notified once all - * textures have finished loading. - * - * @param {ArrayBuffer|string} buffer - The raw USDZ data as an array buffer. - * @param {string} [path=''] - The URL base path. - * @param {function(Group)} [onLoad] - Executed once the group and all of its textures are ready. - * @param {onErrorCallback} [onError] - Executed when errors occur. - * @return {Group} The parsed asset as a group. - */ - parse(buffer: ArrayBuffer | string, path?: string, onLoad?: (arg0: Group) => any, onError?: onErrorCallback): Group; -} -import { Loader } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts deleted file mode 100644 index 843c08a50..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/USDZLoader.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class USDZLoader extends USDLoader { -} -import { USDLoader } from './USDLoader.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts deleted file mode 100644 index 91c2888d6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/UltraHDRLoader.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * A loader for the Ultra HDR Image Format. - * - * Existing HDR or EXR textures can be converted to Ultra HDR with this [tool](https://gainmap-creator.monogrid.com/). - * - * Current feature set: - * - JPEG headers (required) - * - XMP metadata (legacy format, supported) - * - ISO 21496-1 metadata (current standard, supported) - * - XMP validation (not implemented) - * - EXIF profile (not implemented) - * - ICC profile (not implemented) - * - Binary storage for SDR & HDR images (required) - * - Gainmap metadata (required) - * - Non-JPEG image formats (not implemented) - * - Primary image as an HDR image (not implemented) - * - * ```js - * const loader = new UltraHDRLoader(); - * const texture = await loader.loadAsync( 'textures/equirectangular/ice_planet_close.jpg' ); - * texture.mapping = THREE.EquirectangularReflectionMapping; - * - * scene.background = texture; - * scene.environment = texture; - * ``` - * - * @augments Loader - * @three_import import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - */ -export class UltraHDRLoader extends Loader { - /** - * Constructs a new Ultra HDR loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The texture type. - * - * @type {(HalfFloatType|FloatType)} - * @default HalfFloatType - */ - type: (number | FloatType); - /** - * Sets the texture type. - * - * @param {(HalfFloatType|FloatType)} value - The texture type to set. - * @return {UltraHDRLoader} A reference to this loader. - */ - setDataType(value: (number | FloatType)): UltraHDRLoader; - /** - * Parses the given Ultra HDR texture data. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @param {Function} onLoad - The `onLoad` callback. - */ - parse(buffer: ArrayBuffer, onLoad: Function): void; - /** - * Parses ISO 21496-1 gainmap metadata from binary data. - * - * @private - * @param {Uint8Array} data - The binary ISO metadata. - * @param {Object} metadata - The metadata object to populate. - */ - private _parseISOMetadata; - /** - * Starts loading from the given URL and passes the loaded Ultra HDR texture - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the files to be loaded. This can also be a data URI. - * @param {function(DataTexture, Object)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - * @return {DataTexture} The Ultra HDR texture. - */ - load(url: string, onLoad: (arg0: DataTexture, arg1: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): DataTexture; - _parseXMPMetadata(xmpDataString: any, metadata: any): void; - _srgbToLinear(value: any): number; - _applyGainmapToSDR(metadata: any, sdrBuffer: any, gainmapBuffer: any, onSuccess: any, onError: any): void; -} -import { Loader } from 'three'; -import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts deleted file mode 100644 index 4db620acb..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/VOXLoader.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * A loader for the VOX format. - * - * ```js - * const loader = new VOXLoader(); - * const result = await loader.loadAsync( 'models/vox/monu10.vox' ); - * - * scene.add( result.scene.children[ 0 ] ); - * ``` - * @augments Loader - * @three_import import { VOXLoader } from 'three/addons/loaders/VOXLoader.js'; - */ -export class VOXLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded VOX asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Object)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Object) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given VOX data and returns the result object. - * - * @param {ArrayBuffer} buffer - The raw VOX data as an array buffer. - * @return {Object} The parsed VOX data with properties: chunks, scene. - */ - parse(buffer: ArrayBuffer): Object; -} -/** - * Builds a mesh from a VOX chunk. - * - * @param {Object} chunk - A VOX chunk loaded via {@link VOXLoader}. - * @return {Mesh} The generated mesh. - */ -export function buildMesh(chunk: Object): Mesh; -/** - * Builds a 3D texture from a VOX chunk. - * - * @param {Object} chunk - A VOX chunk loaded via {@link VOXLoader}. - * @return {Data3DTexture} The generated 3D texture. - */ -export function buildData3DTexture(chunk: Object): Data3DTexture; -export class VOXMesh extends Mesh { - constructor(chunk: any); -} -export class VOXData3DTexture extends Data3DTexture { - constructor(chunk: any); -} -import { Loader } from 'three'; -import { Mesh } from 'three'; -import { Data3DTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts deleted file mode 100644 index 08d9f2b94..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/VRMLLoader.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * A loader for the VRML format. - * - * ```js - * const loader = new VRMLLoader(); - * const object = await loader.loadAsync( 'models/vrml/house.wrl' ); - * scene.add( object ); - * ``` - * - * @augments Loader - * @three_import import { VRMLLoader } from 'three/addons/loaders/VRMLLoader.js'; - */ -export class VRMLLoader extends Loader { - /** - * Constructs a new VRML loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded VRML asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Scene)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Scene) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given VRML data and returns the resulting scene. - * - * @param {string} data - The raw VRML data as a string. - * @param {string} path - The URL base path. - * @return {Scene} The parsed scene. - */ - parse(data: string, path: string): Scene; -} -import { Loader } from 'three'; -import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts deleted file mode 100644 index daeaecfb0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/VTKLoader.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A loader for the VTK format. - * - * This loader only supports the `POLYDATA` dataset format so far. Other formats - * (structured points, structured grid, rectilinear grid, unstructured grid, appended) - * are not supported. - * - * ```js - * const loader = new VTKLoader(); - * const geometry = await loader.loadAsync( 'models/vtk/liver.vtk' ); - * geometry.computeVertexNormals(); - * - * const mesh = new THREE.Mesh( geometry, new THREE.MeshLambertMaterial() ); - * scene.add( mesh ); - * ``` - * - * @augments Loader - * @three_import import { VTKLoader } from 'three/addons/loaders/VTKLoader.js'; - * @deprecated since r184. - */ -export class VTKLoader extends Loader { - /** - * Constructs a new VTK loader. - * - * @param {LoadingManager} [manager] - The loading manager. - * @deprecated since r184. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and passes the loaded VTK asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given VTK data and returns the resulting geometry. - * - * @param {ArrayBuffer} data - The raw VTK data as an array buffer - * @return {BufferGeometry} The parsed geometry. - */ - parse(data: ArrayBuffer): BufferGeometry; -} -import { Loader } from 'three'; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts deleted file mode 100644 index e1565591d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/XYZLoader.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * A loader for the XYZ format. - * - * XYZ is a very simple format for storing point clouds. The layouts - * `XYZ` (points) and `XYZRGB` (points + colors) are supported. - * - * ```js - * const loader = new XYZLoader(); - * const geometry = await loader.loadAsync( 'models/xyz/helix_201.xyz' ); - * geometry.center(); - * - * const vertexColors = ( geometry.hasAttribute( 'color' ) === true ); - * const material = new THREE.PointsMaterial( { size: 0.1, vertexColors: vertexColors } ); - * - * const points = new THREE.Points( geometry, material ); - * scene.add( points ); - * ``` - * - * @augments Loader - * @three_import import { XYZLoader } from 'three/addons/loaders/XYZLoader.js'; - */ -export class XYZLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded XYZ asset - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given XYZ data and returns the resulting geometry. - * - * @param {string} text - The raw XYZ data as a string. - * @return {BufferGeometry} The geometry representing the point cloud. - */ - parse(text: string): BufferGeometry; -} -import { Loader } from 'three'; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts deleted file mode 100644 index 3113bc0a5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaComposer.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * ColladaComposer converts parsed library data into Three.js objects. - */ -export class ColladaComposer { - constructor(library: any, collada: any, textureLoader: any, tgaLoader: any); - library: any; - collada: any; - textureLoader: any; - tgaLoader: any; - tempColor: Color; - animations: any[]; - kinematics: {}; - position: Vector3; - scale: Vector3; - quaternion: Quaternion; - matrix: Matrix4; - deferredPivotAnimations: {}; - transformNodes: {}; - compose(): { - scene: any; - animations: any[]; - kinematics: {}; - }; - buildLibrary(data: any, builder: any): void; - getBuild(data: any, builder: any): any; - isEmpty(object: any): boolean; - buildAnimation(data: any): any[]; - collectDeferredPivotAnimation(nodeId: any, nodeChannels: any): void; - hasPivotTransforms(nodeData: any): boolean; - getAnimation(id: any): any; - aggregateAnimationChannels(channels: any, samplers: any, sources: any): {}; - buildMatrixTracks(object3D: any, channelData: any, nodeData: any, tracks: any): void; - buildTranslateTrack(object3D: any, channelData: any, transformInfo: any, tracks: any): void; - buildRotateTrack(object3D: any, sid: any, channelData: any, transformInfo: any, nodeData: any, tracks: any): void; - buildScaleTrack(object3D: any, channelData: any, transformInfo: any, tracks: any): void; - getTimesForAllAxes(channelData: any): any[]; - getValueAtTime(componentData: any, time: any, defaultValue: any): any; - evaluateBezierComponent(componentData: any, i0: any, i1: any, t0: any, t1: any, time: any): number; - getInterpolationInfo(channelData: any): { - type: any; - uniform: boolean; - }; - applyInterpolation(track: any, interpolationInfo: any, channelData?: null): void; - prepareAnimationData(data: any, defaultMatrix: any): { - time: number; - value: any; - }[]; - createKeyframeTracks(animation: any, tracks: any): any; - transformAnimationData(keyframes: any, property: any, defaultValue: any): void; - createMissingKeyframes(keyframes: any, property: any): void; - getPrev(keyframes: any, i: any, property: any): any; - getNext(keyframes: any, i: any, property: any): any; - interpolate(key: any, prev: any, next: any, property: any): void; - buildAnimationClip(data: any): AnimationClip; - getAnimationClip(id: any): any; - buildController(data: any): { - id: any; - }; - buildSkin(data: any): { - joints: never[]; - indices: { - array: never[]; - stride: number; - }; - weights: { - array: never[]; - stride: number; - }; - }; - getController(id: any): any; - buildImage(data: any): any; - getImage(id: any): any; - buildEffect(data: any): any; - getEffect(id: any): any; - getTextureLoader(image: any): any; - buildMaterial(data: any): MeshBasicMaterial | MeshPhongMaterial | MeshLambertMaterial; - getMaterial(id: any): any; - buildCamera(data: any): PerspectiveCamera | OrthographicCamera; - getCamera(id: any): any; - buildLight(data: any): SpotLight | PointLight | DirectionalLight | AmbientLight | undefined; - getLight(id: any): any; - groupPrimitives(primitives: any): {}; - checkUVCoordinates(primitives: any): void; - buildGeometry(data: any): {}; - buildGeometryType(primitives: any, sources: any, vertices: any): { - data: BufferGeometry; - type: any; - materialKeys: any[]; - }; - buildGeometryData(primitive: any, source: any, offset: any, array: any, isColor?: boolean): void; - getGeometry(id: any): any; - buildKinematicsModel(data: any): any; - getKinematicsModel(id: any): any; - buildKinematicsScene(data: any): any; - getKinematicsScene(id: any): any; - setupKinematics(): void; - buildTransformList(node: any): ({ - sid: any; - type: any; - obj: Matrix4; - angle?: undefined; - } | { - sid: any; - type: any; - obj: Vector3; - angle?: undefined; - } | { - sid: any; - type: any; - obj: Vector3; - angle: number; - })[]; - buildSkeleton(skeletons: any, joints: any): Skeleton; - buildBoneHierarchy(root: any, joints: any, boneData: any): void; - buildNode(data: any): any; - wrapWithTransformHierarchy(contentObject: any, nodeData: any): Group; - resolveMaterialBinding(keys: any, instanceMaterials: any): any[]; - get fallbackMaterial(): MeshBasicMaterial; - _fallbackMaterial: MeshBasicMaterial | undefined; - buildObjects(geometries: any, instanceMaterials: any): (Mesh | SkinnedMesh | Line | undefined)[]; - hasNode(id: any): boolean; - getNode(id: any): any; - buildVisualScene(data: any): Group; - hasVisualScene(id: any): boolean; - getVisualScene(id: any): any; - parseScene(xml: any): any; - parseId(text: any): any; - setupAnimations(): void; - buildDeferredPivotAnimationTracks(tracks: any): void; - buildTransformHierarchyTracks(nodeId: any, nodeChannels: any, nodeData: any, tracks: any): void; - buildHierarchyTranslateTrack(transformNode: any, channelData: any, transformInfo: any, tracks: any): void; - buildHierarchyRotateTrack(transformNode: any, channelData: any, transformInfo: any, tracks: any): void; - buildHierarchyScaleTrack(transformNode: any, channelData: any, transformInfo: any, tracks: any): void; -} -import { Color } from 'three'; -import { Vector3 } from 'three'; -import { Quaternion } from 'three'; -import { Matrix4 } from 'three'; -import { AnimationClip } from 'three'; -import { MeshBasicMaterial } from 'three'; -import { MeshPhongMaterial } from 'three'; -import { MeshLambertMaterial } from 'three'; -import { PerspectiveCamera } from 'three'; -import { OrthographicCamera } from 'three'; -import { SpotLight } from 'three'; -import { PointLight } from 'three'; -import { DirectionalLight } from 'three'; -import { AmbientLight } from 'three'; -import { BufferGeometry } from 'three'; -import { Skeleton } from 'three'; -import { Group } from 'three'; -import { Mesh } from 'three'; -import { SkinnedMesh } from 'three'; -import { Line } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts deleted file mode 100644 index fbf3e6e77..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/collada/ColladaParser.d.ts +++ /dev/null @@ -1,234 +0,0 @@ -/** - * ColladaParser handles XML parsing and converts Collada XML to intermediate data structures. - */ -export class ColladaParser { - count: number; - generateId(): string; - parse(text: any): { - library: { - animations: {}; - clips: {}; - controllers: {}; - images: {}; - effects: {}; - materials: {}; - cameras: {}; - lights: {}; - geometries: {}; - nodes: {}; - visualScenes: {}; - kinematicsModels: {}; - physicsModels: {}; - kinematicsScenes: {}; - joints: {}; - }; - asset: { - unit: number; - upAxis: any; - }; - collada: any; - } | null; - library: { - animations: {}; - clips: {}; - controllers: {}; - images: {}; - effects: {}; - materials: {}; - cameras: {}; - lights: {}; - geometries: {}; - nodes: {}; - visualScenes: {}; - kinematicsModels: {}; - physicsModels: {}; - kinematicsScenes: {}; - joints: {}; - } | undefined; - collada: any; - parserErrorToText(parserError: any): string; - parseAsset(xml: any): { - unit: number; - upAxis: any; - }; - parseAssetUnit(xml: any): number; - parseAssetUpAxis(xml: any): any; - parseLibrary(xml: any, libraryName: any, nodeName: any, parser: any): void; - parseAnimation(xml: any): void; - parseAnimationSampler(xml: any): { - inputs: {}; - }; - parseAnimationChannel(xml: any): { - member: any; - indices: any; - id: any; - sid: any; - arraySyntax: boolean; - memberSyntax: boolean; - sampler: any; - }; - parseAnimationClip(xml: any): void; - parseController(xml: any): void; - parseSkin(xml: any): { - sources: {}; - }; - parseJoints(xml: any): { - inputs: {}; - }; - parseVertexWeights(xml: any): { - inputs: {}; - }; - parseImage(xml: any): void; - parseEffect(xml: any): void; - parseEffectProfileCOMMON(xml: any): { - surfaces: {}; - samplers: {}; - }; - parseEffectNewparam(xml: any, data: any): void; - parseEffectSurface(xml: any): { - init_from: any; - }; - parseEffectSampler(xml: any): { - source: any; - }; - parseEffectTechnique(xml: any): { - type: any; - parameters: {}; - extra: { - technique: {}; - }; - }; - parseEffectParameters(xml: any): {}; - parseEffectParameter(xml: any): {}; - parseEffectParameterTexture(xml: any): { - technique: {}; - }; - parseEffectParameterTextureExtra(xml: any, data: any): void; - parseEffectParameterTextureExtraTechnique(xml: any, data: any): void; - parseEffectExtra(xml: any): { - technique: {}; - }; - parseEffectExtraTechnique(xml: any): {}; - parseEffectExtraTechniqueBump(xml: any): {}; - parseMaterial(xml: any): void; - parseCamera(xml: any): void; - parseCameraOptics(xml: any): {}; - parseCameraTechnique(xml: any): { - technique: any; - parameters: {}; - }; - parseCameraParameters(xml: any): {}; - parseLight(xml: any): void; - parseLightTechnique(xml: any): { - technique: any; - parameters: { - color: Color; - falloffAngle: number; - distance: number; - }; - }; - parseLightParameters(xml: any): { - color: Color; - falloffAngle: number; - distance: number; - }; - parseGeometry(xml: any): void; - parseSource(xml: any): { - array: never[]; - stride: number; - }; - parseGeometryVertices(xml: any): {}; - parseGeometryPrimitive(xml: any): { - type: any; - material: any; - count: number; - inputs: {}; - stride: number; - hasUV: boolean; - }; - parseLibraryJoint(xml: any): void; - parseKinematicsModel(xml: any): void; - parseKinematicsTechniqueCommon(xml: any, data: any): void; - parseKinematicsJoint(xml: any): { - sid: any; - name: any; - axis: Vector3; - limits: { - min: number; - max: number; - }; - type: any; - static: boolean; - zeroPosition: number; - middlePosition: number; - } | undefined; - parseKinematicsJointParameter(xml: any): { - sid: any; - name: any; - axis: Vector3; - limits: { - min: number; - max: number; - }; - type: any; - static: boolean; - zeroPosition: number; - middlePosition: number; - }; - parseKinematicsLink(xml: any): { - sid: any; - name: any; - attachments: never[]; - transforms: never[]; - }; - parseKinematicsAttachment(xml: any): { - joint: any; - transforms: never[]; - links: never[]; - }; - parseKinematicsTransform(xml: any): { - type: any; - }; - parsePhysicsModel(xml: any): void; - parsePhysicsRigidBody(xml: any, data: any): void; - parsePhysicsTechniqueCommon(xml: any, data: any): void; - parseKinematicsScene(xml: any): void; - parseKinematicsBindJointAxis(xml: any): { - target: any; - }; - prepareNodes(xml: any): void; - parseNode(xml: any): { - name: any; - type: any; - id: any; - sid: any; - matrix: Matrix4; - nodes: never[]; - instanceCameras: never[]; - instanceControllers: never[]; - instanceLights: never[]; - instanceGeometries: never[]; - instanceNodes: never[]; - transforms: {}; - transformData: {}; - transformOrder: never[]; - }; - parseNodeInstance(xml: any): { - id: any; - materials: {}; - skeletons: never[]; - }; - parseVisualScene(xml: any): void; - hasNode(id: any): boolean; -} -/** - * Utility functions for parsing - */ -export function getElementsByTagName(xml: any, name: any): any[]; -export function parseStrings(text: any): any; -export function parseFloats(text: any): any; -export function parseInts(text: any): any; -export function parseId(text: any): any; -import { Color } from 'three'; -import { Vector3 } from 'three'; -import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts deleted file mode 100644 index 93747f8df..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/IFFParser.d.ts +++ /dev/null @@ -1,121 +0,0 @@ -export class IFFParser { - debugger: Debugger; - parse(buffer: any): { - materials: {}; - layers: never[]; - tags: never[]; - textures: never[]; - } | undefined; - reader: DataViewReader | undefined; - tree: { - materials: {}; - layers: never[]; - tags: never[]; - textures: never[]; - } | undefined; - currentLayer: { - materials: {}; - layers: never[]; - tags: never[]; - textures: never[]; - } | { - number: number; - flags: number; - pivot: number[]; - name: string | undefined; - } | undefined; - currentForm: any; - parser: LWO2Parser | LWO3Parser | undefined; - parseTopForm(): void; - parseForm(length: any): void; - parentForm: any; - setupForm(type: any, length: any): void; - currentFormEnd: any; - skipForm(length: any): void; - parseUnknownForm(type: any, length: any): void; - parseSurfaceForm(length: any): void; - currentSurface: { - attributes: {}; - connections: {}; - name: string | undefined; - inputName: string | undefined; - nodes: {}; - source: string | undefined; - } | { - attributes: {}; - connections: {}; - name: string | undefined; - nodes: {}; - source: string | undefined; - } | undefined; - parseSurfaceLwo2(length: any): void; - parseSubNode(length: any): void; - currentNode: { - name: string | undefined; - } | undefined; - parseConnections(length: any): void; - parseEntryForm(length: any): void; - parseValueForm(): void; - parseImageStateForm(): void; - parseImageMap(length: any): void; - parseTextureNodeAttribute(type: any): void; - parseEnvelope(length: any): void; - parseClip(length: any): void; - parseClipLwo2(length: any): void; - parseImage(): void; - parseXVAL(type: any, length: any): void; - parseXVAL3(type: any, length: any): void; - parseObjectTag(): void; - parseLayer(length: any): void; - parsePoints(length: any): void; - currentPoints: any[] | undefined; - parseVertexMapping(length: any, discontinuous: any): void; - parseUVMapping(name: any, finalOffset: any, discontinuous: any): void; - parseMorphTargets(name: any, finalOffset: any, type: any): void; - parsePolygonList(length: any): void; - parseTagStrings(length: any): void; - parsePolygonTagMapping(length: any): void; - parseMaterialIndices(finalOffset: any): void; - parseUnknownCHUNK(blockID: any, length: any): void; -} -declare class Debugger { - active: boolean; - depth: number; - formList: any[]; - offset: number; - node: number; - nodeID: string; - dataOffset: number; - length: number; - skipped: boolean; - enable(): void; - log(): void; - closeForms(): void; -} -declare class DataViewReader { - constructor(buffer: any); - dv: DataView; - offset: number; - _textDecoder: TextDecoder; - _bytes: Uint8Array; - size(): any; - setOffset(offset: any): void; - endOfFile(): boolean; - skip(length: any): void; - getUint8(): number; - getUint16(): number; - getInt32(): number; - getUint32(): number; - getUint64(): number; - getFloat32(): number; - getFloat32Array(size: any): number[]; - getFloat64(): number; - getFloat64Array(size: any): number[]; - getVariableLengthIndex(): number; - getIDTag(): string | undefined; - getString(size: any): string | undefined; - getStringArray(size: any): any; -} -import { LWO2Parser } from './LWO2Parser.js'; -import { LWO3Parser } from './LWO3Parser.js'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts deleted file mode 100644 index dc1f38872..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO2Parser.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export class LWO2Parser { - constructor(IFFParser: any); - IFF: any; - parseBlock(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts deleted file mode 100644 index e5fbcedbf..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/lwo/LWO3Parser.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export class LWO3Parser { - constructor(IFFParser: any); - IFF: any; - parseBlock(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts deleted file mode 100644 index 5af253bb2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXArchive.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function isZipBuffer(buffer: any): boolean; -export function readMtlxArchive(buffer: any): { - text: string; - mtlxPath: any; - files: Map; -}; -export function createArchiveResolver(files: any): { - resolve: (uri: any) => any; - dispose: () => void; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts deleted file mode 100644 index 35c99e5bb..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXDocument.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export class MaterialXDocument { - constructor(manager: any, path: any, log: any, archiveResolver?: null, uvSpace?: string); - manager: any; - path: any; - log: any; - archiveResolver: any; - uvSpace: any; - nodesXLib: Map; - imageLoader: ImageLoader; - textureLoader: ImageBitmapLoader; - textureCache: Map; - compileContext: { - mxTransformUv: (uv_scale?: number, uv_offset?: number, uv_geo?: any) => any; - mxHextileCoord: typeof mxHextileCoord; - mxHextileComputeBlendWeights: typeof mxHextileComputeBlendWeights; - invertConstantMatrixValues: typeof invertConstantMatrixValues; - IDENTITY_MAT3_VALUES: number[]; - IDENTITY_MAT4_VALUES: number[]; - mxToBottomLeftUvSpace: typeof mxFlipUvY; - mxFromBottomLeftUvSpace: typeof mxFlipUvY; - compileRegistry: Map; - nodeLibrary: any; - }; - resolveTextureURI(uri: any): any; - addMaterialXNode(materialXNode: any): void; - getMaterialXNode(...names: any[]): any; - parseNode(nodeXML: any, nodePath?: string): any; - parse(text: any, materialName?: null, options?: {}): { - materials: any; - log: any; - errors: any; - warnings: any; - }; -} -import { ImageLoader } from 'three/webgpu'; -import { ImageBitmapLoader } from 'three/webgpu'; -import { mxHextileCoord } from './MaterialXHextile.js'; -import { mxHextileComputeBlendWeights } from './MaterialXHextile.js'; -declare function invertConstantMatrixValues(values: any, size: any): any; -declare function mxFlipUvY(uvNode: any): any; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts deleted file mode 100644 index dd1c81594..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXHextile.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function mxHextileComputeBlendWeights(luminanceWeights: any, tileWeights: any, falloff: any): any; -export function mxHextileCoord(coord: any, rotation: any, rotationRange: any, scale: any, scaleRange: any, offset: any, offsetRange: any): { - coords: any[]; - ddx: any[]; - ddy: any[]; - weights: any; -}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts deleted file mode 100644 index 6feba6fb2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function createStrictInterfaceValidator(): (rootNode: any, log: any) => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts deleted file mode 100644 index 22d92ea25..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXLog.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -export namespace MaterialXLogCodes { - namespace UNSUPPORTED_NODE { - let label: string; - let severity: string; - } - namespace IGNORED_SURFACE_INPUT { - let label_1: string; - export { label_1 as label }; - let severity_1: string; - export { severity_1 as severity }; - } - namespace MISSING_REFERENCE { - let label_2: string; - export { label_2 as label }; - let severity_2: string; - export { severity_2 as severity }; - } - namespace MISSING_MATERIAL { - let label_3: string; - export { label_3 as label }; - let severity_3: string; - export { severity_3 as severity }; - } - namespace INVALID_VALUE { - let label_4: string; - export { label_4 as label }; - let severity_4: string; - export { severity_4 as severity }; - } - namespace UNKNOWN_INPUT { - let label_5: string; - export { label_5 as label }; - let severity_5: string; - export { severity_5 as severity }; - } - namespace INVALID_OUTPUT_CONNECTION { - let label_6: string; - export { label_6 as label }; - let severity_6: string; - export { severity_6 as severity }; - } - namespace TYPE_MISMATCH { - let label_7: string; - export { label_7 as label }; - let severity_7: string; - export { severity_7 as severity }; - } -} -export class MaterialXLog { - entries: any[]; - get errors(): any[]; - get warnings(): any[]; - add(code: any, message: any, nodeName: any): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts deleted file mode 100644 index 6f917f61d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.d.ts +++ /dev/null @@ -1,33497 +0,0 @@ -export default registryData; -declare namespace registryData { - namespace nodedefs { - namespace ND_oren_nayar_diffuse_bsdf { - let node: string; - let inherit: null; - namespace inputs { - let weight: string; - let color: string; - let roughness: string; - let normal: string; - let energy_compensation: string; - } - namespace outputs { - let out: string; - } - } - namespace ND_burley_diffuse_bsdf { - let node_1: string; - export { node_1 as node }; - let inherit_1: null; - export { inherit_1 as inherit }; - export namespace inputs_1 { - let weight_1: string; - export { weight_1 as weight }; - let color_1: string; - export { color_1 as color }; - let roughness_1: string; - export { roughness_1 as roughness }; - let normal_1: string; - export { normal_1 as normal }; - } - export { inputs_1 as inputs }; - export namespace outputs_1 { - let out_1: string; - export { out_1 as out }; - } - export { outputs_1 as outputs }; - } - namespace ND_translucent_bsdf { - let node_2: string; - export { node_2 as node }; - let inherit_2: null; - export { inherit_2 as inherit }; - export namespace inputs_2 { - let weight_2: string; - export { weight_2 as weight }; - let color_2: string; - export { color_2 as color }; - let normal_2: string; - export { normal_2 as normal }; - } - export { inputs_2 as inputs }; - export namespace outputs_2 { - let out_2: string; - export { out_2 as out }; - } - export { outputs_2 as outputs }; - } - namespace ND_dielectric_bsdf { - let node_3: string; - export { node_3 as node }; - let inherit_3: null; - export { inherit_3 as inherit }; - export namespace inputs_3 { - let weight_3: string; - export { weight_3 as weight }; - export let tint: string; - export let ior: string; - let roughness_2: string; - export { roughness_2 as roughness }; - export let retroreflective: string; - export let thinfilm_thickness: string; - export let thinfilm_ior: string; - let normal_3: string; - export { normal_3 as normal }; - export let tangent: string; - export let distribution: string; - export let scatter_mode: string; - } - export { inputs_3 as inputs }; - export namespace outputs_3 { - let out_3: string; - export { out_3 as out }; - } - export { outputs_3 as outputs }; - } - namespace ND_conductor_bsdf { - let node_4: string; - export { node_4 as node }; - let inherit_4: null; - export { inherit_4 as inherit }; - export namespace inputs_4 { - let weight_4: string; - export { weight_4 as weight }; - let ior_1: string; - export { ior_1 as ior }; - export let extinction: string; - let roughness_3: string; - export { roughness_3 as roughness }; - let retroreflective_1: string; - export { retroreflective_1 as retroreflective }; - let thinfilm_thickness_1: string; - export { thinfilm_thickness_1 as thinfilm_thickness }; - let thinfilm_ior_1: string; - export { thinfilm_ior_1 as thinfilm_ior }; - let normal_4: string; - export { normal_4 as normal }; - let tangent_1: string; - export { tangent_1 as tangent }; - let distribution_1: string; - export { distribution_1 as distribution }; - } - export { inputs_4 as inputs }; - export namespace outputs_4 { - let out_4: string; - export { out_4 as out }; - } - export { outputs_4 as outputs }; - } - namespace ND_generalized_schlick_bsdf { - let node_5: string; - export { node_5 as node }; - let inherit_5: null; - export { inherit_5 as inherit }; - export namespace inputs_5 { - let weight_5: string; - export { weight_5 as weight }; - export let color0: string; - export let color82: string; - export let color90: string; - export let exponent: string; - let roughness_4: string; - export { roughness_4 as roughness }; - let retroreflective_2: string; - export { retroreflective_2 as retroreflective }; - let thinfilm_thickness_2: string; - export { thinfilm_thickness_2 as thinfilm_thickness }; - let thinfilm_ior_2: string; - export { thinfilm_ior_2 as thinfilm_ior }; - let normal_5: string; - export { normal_5 as normal }; - let tangent_2: string; - export { tangent_2 as tangent }; - let distribution_2: string; - export { distribution_2 as distribution }; - let scatter_mode_1: string; - export { scatter_mode_1 as scatter_mode }; - } - export { inputs_5 as inputs }; - export namespace outputs_5 { - let out_5: string; - export { out_5 as out }; - } - export { outputs_5 as outputs }; - } - namespace ND_subsurface_bsdf { - let node_6: string; - export { node_6 as node }; - let inherit_6: null; - export { inherit_6 as inherit }; - export namespace inputs_6 { - let weight_6: string; - export { weight_6 as weight }; - let color_3: string; - export { color_3 as color }; - export let radius: string; - export let anisotropy: string; - let normal_6: string; - export { normal_6 as normal }; - } - export { inputs_6 as inputs }; - export namespace outputs_6 { - let out_6: string; - export { out_6 as out }; - } - export { outputs_6 as outputs }; - } - namespace ND_sheen_bsdf { - let node_7: string; - export { node_7 as node }; - let inherit_7: null; - export { inherit_7 as inherit }; - export namespace inputs_7 { - let weight_7: string; - export { weight_7 as weight }; - let color_4: string; - export { color_4 as color }; - let roughness_5: string; - export { roughness_5 as roughness }; - let normal_7: string; - export { normal_7 as normal }; - export let mode: string; - } - export { inputs_7 as inputs }; - export namespace outputs_7 { - let out_7: string; - export { out_7 as out }; - } - export { outputs_7 as outputs }; - } - namespace ND_chiang_hair_bsdf { - let node_8: string; - export { node_8 as node }; - let inherit_8: null; - export { inherit_8 as inherit }; - export namespace inputs_8 { - export let tint_R: string; - export let tint_TT: string; - export let tint_TRT: string; - let ior_2: string; - export { ior_2 as ior }; - export let roughness_R: string; - export let roughness_TT: string; - export let roughness_TRT: string; - export let cuticle_angle: string; - export let absorption_coefficient: string; - let normal_8: string; - export { normal_8 as normal }; - export let curve_direction: string; - } - export { inputs_8 as inputs }; - export namespace outputs_8 { - let out_8: string; - export { out_8 as out }; - } - export { outputs_8 as outputs }; - } - namespace ND_uniform_edf { - let node_9: string; - export { node_9 as node }; - let inherit_9: null; - export { inherit_9 as inherit }; - export namespace inputs_9 { - let color_5: string; - export { color_5 as color }; - } - export { inputs_9 as inputs }; - export namespace outputs_9 { - let out_9: string; - export { out_9 as out }; - } - export { outputs_9 as outputs }; - } - namespace ND_conical_edf { - let node_10: string; - export { node_10 as node }; - let inherit_10: null; - export { inherit_10 as inherit }; - export namespace inputs_10 { - let color_6: string; - export { color_6 as color }; - let normal_9: string; - export { normal_9 as normal }; - export let inner_angle: string; - export let outer_angle: string; - } - export { inputs_10 as inputs }; - export namespace outputs_10 { - let out_10: string; - export { out_10 as out }; - } - export { outputs_10 as outputs }; - } - namespace ND_measured_edf { - let node_11: string; - export { node_11 as node }; - let inherit_11: null; - export { inherit_11 as inherit }; - export namespace inputs_11 { - let color_7: string; - export { color_7 as color }; - let normal_10: string; - export { normal_10 as normal }; - export let file: string; - } - export { inputs_11 as inputs }; - export namespace outputs_11 { - let out_11: string; - export { out_11 as out }; - } - export { outputs_11 as outputs }; - } - namespace ND_generalized_schlick_edf { - let node_12: string; - export { node_12 as node }; - let inherit_12: null; - export { inherit_12 as inherit }; - export namespace inputs_12 { - let color0_1: string; - export { color0_1 as color0 }; - let color90_1: string; - export { color90_1 as color90 }; - let exponent_1: string; - export { exponent_1 as exponent }; - export let base: string; - } - export { inputs_12 as inputs }; - export namespace outputs_12 { - let out_12: string; - export { out_12 as out }; - } - export { outputs_12 as outputs }; - } - namespace ND_absorption_vdf { - let node_13: string; - export { node_13 as node }; - let inherit_13: null; - export { inherit_13 as inherit }; - export namespace inputs_13 { - let absorption: string; - } - export { inputs_13 as inputs }; - export namespace outputs_13 { - let out_13: string; - export { out_13 as out }; - } - export { outputs_13 as outputs }; - } - namespace ND_anisotropic_vdf { - let node_14: string; - export { node_14 as node }; - let inherit_14: null; - export { inherit_14 as inherit }; - export namespace inputs_14 { - let absorption_1: string; - export { absorption_1 as absorption }; - export let scattering: string; - let anisotropy_1: string; - export { anisotropy_1 as anisotropy }; - } - export { inputs_14 as inputs }; - export namespace outputs_14 { - let out_14: string; - export { out_14 as out }; - } - export { outputs_14 as outputs }; - } - namespace ND_surface { - let node_15: string; - export { node_15 as node }; - let inherit_15: null; - export { inherit_15 as inherit }; - export namespace inputs_15 { - let bsdf: string; - let edf: string; - let opacity: string; - let thin_walled: string; - } - export { inputs_15 as inputs }; - export namespace outputs_15 { - let out_15: string; - export { out_15 as out }; - } - export { outputs_15 as outputs }; - } - namespace ND_volume { - let node_16: string; - export { node_16 as node }; - let inherit_16: null; - export { inherit_16 as inherit }; - export namespace inputs_16 { - export let vdf: string; - let edf_1: string; - export { edf_1 as edf }; - } - export { inputs_16 as inputs }; - export namespace outputs_16 { - let out_16: string; - export { out_16 as out }; - } - export { outputs_16 as outputs }; - } - namespace ND_light { - let node_17: string; - export { node_17 as node }; - let inherit_17: null; - export { inherit_17 as inherit }; - export namespace inputs_17 { - let edf_2: string; - export { edf_2 as edf }; - export let intensity: string; - export let exposure: string; - } - export { inputs_17 as inputs }; - export namespace outputs_17 { - let out_17: string; - export { out_17 as out }; - } - export { outputs_17 as outputs }; - } - namespace ND_displacement_float { - let node_18: string; - export { node_18 as node }; - let inherit_18: null; - export { inherit_18 as inherit }; - export namespace inputs_18 { - let displacement: string; - let scale: string; - } - export { inputs_18 as inputs }; - export namespace outputs_18 { - let out_18: string; - export { out_18 as out }; - } - export { outputs_18 as outputs }; - } - namespace ND_displacement_vector3 { - let node_19: string; - export { node_19 as node }; - let inherit_19: null; - export { inherit_19 as inherit }; - export namespace inputs_19 { - let displacement_1: string; - export { displacement_1 as displacement }; - let scale_1: string; - export { scale_1 as scale }; - } - export { inputs_19 as inputs }; - export namespace outputs_19 { - let out_19: string; - export { out_19 as out }; - } - export { outputs_19 as outputs }; - } - namespace ND_layer_bsdf { - let node_20: string; - export { node_20 as node }; - let inherit_20: null; - export { inherit_20 as inherit }; - export namespace inputs_20 { - export let top: string; - let base_1: string; - export { base_1 as base }; - } - export { inputs_20 as inputs }; - export namespace outputs_20 { - let out_20: string; - export { out_20 as out }; - } - export { outputs_20 as outputs }; - } - namespace ND_layer_vdf { - let node_21: string; - export { node_21 as node }; - let inherit_21: null; - export { inherit_21 as inherit }; - export namespace inputs_21 { - let top_1: string; - export { top_1 as top }; - let base_2: string; - export { base_2 as base }; - } - export { inputs_21 as inputs }; - export namespace outputs_21 { - let out_21: string; - export { out_21 as out }; - } - export { outputs_21 as outputs }; - } - namespace ND_mix_bsdf { - let node_22: string; - export { node_22 as node }; - let inherit_22: null; - export { inherit_22 as inherit }; - export namespace inputs_22 { - let fg: string; - let bg: string; - let mix: string; - } - export { inputs_22 as inputs }; - export namespace outputs_22 { - let out_22: string; - export { out_22 as out }; - } - export { outputs_22 as outputs }; - } - namespace ND_mix_edf { - let node_23: string; - export { node_23 as node }; - let inherit_23: null; - export { inherit_23 as inherit }; - export namespace inputs_23 { - let fg_1: string; - export { fg_1 as fg }; - let bg_1: string; - export { bg_1 as bg }; - let mix_1: string; - export { mix_1 as mix }; - } - export { inputs_23 as inputs }; - export namespace outputs_23 { - let out_23: string; - export { out_23 as out }; - } - export { outputs_23 as outputs }; - } - namespace ND_mix_vdf { - let node_24: string; - export { node_24 as node }; - let inherit_24: null; - export { inherit_24 as inherit }; - export namespace inputs_24 { - let fg_2: string; - export { fg_2 as fg }; - let bg_2: string; - export { bg_2 as bg }; - let mix_2: string; - export { mix_2 as mix }; - } - export { inputs_24 as inputs }; - export namespace outputs_24 { - let out_24: string; - export { out_24 as out }; - } - export { outputs_24 as outputs }; - } - namespace ND_add_bsdf { - let node_25: string; - export { node_25 as node }; - let inherit_25: null; - export { inherit_25 as inherit }; - export namespace inputs_25 { - let in1: string; - let in2: string; - } - export { inputs_25 as inputs }; - export namespace outputs_25 { - let out_25: string; - export { out_25 as out }; - } - export { outputs_25 as outputs }; - } - namespace ND_add_edf { - let node_26: string; - export { node_26 as node }; - let inherit_26: null; - export { inherit_26 as inherit }; - export namespace inputs_26 { - let in1_1: string; - export { in1_1 as in1 }; - let in2_1: string; - export { in2_1 as in2 }; - } - export { inputs_26 as inputs }; - export namespace outputs_26 { - let out_26: string; - export { out_26 as out }; - } - export { outputs_26 as outputs }; - } - namespace ND_add_vdf { - let node_27: string; - export { node_27 as node }; - let inherit_27: null; - export { inherit_27 as inherit }; - export namespace inputs_27 { - let in1_2: string; - export { in1_2 as in1 }; - let in2_2: string; - export { in2_2 as in2 }; - } - export { inputs_27 as inputs }; - export namespace outputs_27 { - let out_27: string; - export { out_27 as out }; - } - export { outputs_27 as outputs }; - } - namespace ND_multiply_bsdfC { - let node_28: string; - export { node_28 as node }; - let inherit_28: null; - export { inherit_28 as inherit }; - export namespace inputs_28 { - let in1_3: string; - export { in1_3 as in1 }; - let in2_3: string; - export { in2_3 as in2 }; - } - export { inputs_28 as inputs }; - export namespace outputs_28 { - let out_28: string; - export { out_28 as out }; - } - export { outputs_28 as outputs }; - } - namespace ND_multiply_bsdfF { - let node_29: string; - export { node_29 as node }; - let inherit_29: null; - export { inherit_29 as inherit }; - export namespace inputs_29 { - let in1_4: string; - export { in1_4 as in1 }; - let in2_4: string; - export { in2_4 as in2 }; - } - export { inputs_29 as inputs }; - export namespace outputs_29 { - let out_29: string; - export { out_29 as out }; - } - export { outputs_29 as outputs }; - } - namespace ND_multiply_edfC { - let node_30: string; - export { node_30 as node }; - let inherit_30: null; - export { inherit_30 as inherit }; - export namespace inputs_30 { - let in1_5: string; - export { in1_5 as in1 }; - let in2_5: string; - export { in2_5 as in2 }; - } - export { inputs_30 as inputs }; - export namespace outputs_30 { - let out_30: string; - export { out_30 as out }; - } - export { outputs_30 as outputs }; - } - namespace ND_multiply_edfF { - let node_31: string; - export { node_31 as node }; - let inherit_31: null; - export { inherit_31 as inherit }; - export namespace inputs_31 { - let in1_6: string; - export { in1_6 as in1 }; - let in2_6: string; - export { in2_6 as in2 }; - } - export { inputs_31 as inputs }; - export namespace outputs_31 { - let out_31: string; - export { out_31 as out }; - } - export { outputs_31 as outputs }; - } - namespace ND_multiply_vdfC { - let node_32: string; - export { node_32 as node }; - let inherit_32: null; - export { inherit_32 as inherit }; - export namespace inputs_32 { - let in1_7: string; - export { in1_7 as in1 }; - let in2_7: string; - export { in2_7 as in2 }; - } - export { inputs_32 as inputs }; - export namespace outputs_32 { - let out_32: string; - export { out_32 as out }; - } - export { outputs_32 as outputs }; - } - namespace ND_multiply_vdfF { - let node_33: string; - export { node_33 as node }; - let inherit_33: null; - export { inherit_33 as inherit }; - export namespace inputs_33 { - let in1_8: string; - export { in1_8 as in1 }; - let in2_8: string; - export { in2_8 as in2 }; - } - export { inputs_33 as inputs }; - export namespace outputs_33 { - let out_33: string; - export { out_33 as out }; - } - export { outputs_33 as outputs }; - } - namespace ND_roughness_anisotropy { - let node_34: string; - export { node_34 as node }; - let inherit_34: null; - export { inherit_34 as inherit }; - export namespace inputs_34 { - let roughness_6: string; - export { roughness_6 as roughness }; - let anisotropy_2: string; - export { anisotropy_2 as anisotropy }; - } - export { inputs_34 as inputs }; - export namespace outputs_34 { - let out_34: string; - export { out_34 as out }; - } - export { outputs_34 as outputs }; - } - namespace ND_roughness_dual { - let node_35: string; - export { node_35 as node }; - let inherit_35: null; - export { inherit_35 as inherit }; - export namespace inputs_35 { - let roughness_7: string; - export { roughness_7 as roughness }; - } - export { inputs_35 as inputs }; - export namespace outputs_35 { - let out_35: string; - export { out_35 as out }; - } - export { outputs_35 as outputs }; - } - namespace ND_glossiness_anisotropy { - let node_36: string; - export { node_36 as node }; - let inherit_36: null; - export { inherit_36 as inherit }; - export namespace inputs_36 { - export let glossiness: string; - let anisotropy_3: string; - export { anisotropy_3 as anisotropy }; - } - export { inputs_36 as inputs }; - export namespace outputs_36 { - let out_36: string; - export { out_36 as out }; - } - export { outputs_36 as outputs }; - } - namespace ND_blackbody { - let node_37: string; - export { node_37 as node }; - let inherit_37: null; - export { inherit_37 as inherit }; - export namespace inputs_37 { - let temperature: string; - } - export { inputs_37 as inputs }; - export namespace outputs_37 { - let out_37: string; - export { out_37 as out }; - } - export { outputs_37 as outputs }; - } - namespace ND_artistic_ior { - let node_38: string; - export { node_38 as node }; - let inherit_38: null; - export { inherit_38 as inherit }; - export namespace inputs_38 { - let reflectivity: string; - let edge_color: string; - } - export { inputs_38 as inputs }; - export namespace outputs_38 { - let ior_3: string; - export { ior_3 as ior }; - let extinction_1: string; - export { extinction_1 as extinction }; - } - export { outputs_38 as outputs }; - } - namespace ND_deon_hair_absorption_from_melanin { - let node_39: string; - export { node_39 as node }; - let inherit_39: null; - export { inherit_39 as inherit }; - export namespace inputs_39 { - let melanin_concentration: string; - let melanin_redness: string; - let eumelanin_color: string; - let pheomelanin_color: string; - } - export { inputs_39 as inputs }; - export namespace outputs_39 { - let absorption_2: string; - export { absorption_2 as absorption }; - } - export { outputs_39 as outputs }; - } - namespace ND_chiang_hair_absorption_from_color { - let node_40: string; - export { node_40 as node }; - let inherit_40: null; - export { inherit_40 as inherit }; - export namespace inputs_40 { - let color_8: string; - export { color_8 as color }; - export let azimuthal_roughness: string; - } - export { inputs_40 as inputs }; - export namespace outputs_40 { - let absorption_3: string; - export { absorption_3 as absorption }; - } - export { outputs_40 as outputs }; - } - namespace ND_chiang_hair_roughness { - let node_41: string; - export { node_41 as node }; - let inherit_41: null; - export { inherit_41 as inherit }; - export namespace inputs_41 { - let longitudinal: string; - let azimuthal: string; - let scale_TT: string; - let scale_TRT: string; - } - export { inputs_41 as inputs }; - export namespace outputs_41 { - let roughness_R_1: string; - export { roughness_R_1 as roughness_R }; - let roughness_TT_1: string; - export { roughness_TT_1 as roughness_TT }; - let roughness_TRT_1: string; - export { roughness_TRT_1 as roughness_TRT }; - } - export { outputs_41 as outputs }; - } - namespace ND_disney_principled { - let node_42: string; - export { node_42 as node }; - let inherit_42: null; - export { inherit_42 as inherit }; - export namespace inputs_42 { - export let baseColor: string; - export let metallic: string; - let roughness_8: string; - export { roughness_8 as roughness }; - export let anisotropic: string; - export let specular: string; - export let specularTint: string; - export let sheen: string; - export let sheenTint: string; - export let clearcoat: string; - export let clearcoatGloss: string; - export let specTrans: string; - let ior_4: string; - export { ior_4 as ior }; - export let subsurface: string; - export let subsurfaceDistance: string; - } - export { inputs_42 as inputs }; - export namespace outputs_42 { - let out_38: string; - export { out_38 as out }; - } - export { outputs_42 as outputs }; - } - namespace ND_open_pbr_surface_surfaceshader { - let node_43: string; - export { node_43 as node }; - let inherit_43: null; - export { inherit_43 as inherit }; - export namespace inputs_43 { - let base_weight: string; - let base_color: string; - let base_diffuse_roughness: string; - let base_metalness: string; - let specular_weight: string; - let specular_color: string; - let specular_roughness: string; - let specular_ior: string; - let specular_roughness_anisotropy: string; - let transmission_weight: string; - let transmission_color: string; - let transmission_depth: string; - let transmission_scatter: string; - let transmission_scatter_anisotropy: string; - let transmission_dispersion_scale: string; - let transmission_dispersion_abbe_number: string; - let subsurface_weight: string; - let subsurface_color: string; - let subsurface_radius: string; - let subsurface_radius_scale: string; - let subsurface_scatter_anisotropy: string; - let fuzz_weight: string; - let fuzz_color: string; - let fuzz_roughness: string; - let coat_weight: string; - let coat_color: string; - let coat_roughness: string; - let coat_roughness_anisotropy: string; - let coat_ior: string; - let coat_darkening: string; - let thin_film_weight: string; - let thin_film_thickness: string; - let thin_film_ior: string; - let emission_luminance: string; - let emission_color: string; - let geometry_opacity: string; - let geometry_thin_walled: string; - let geometry_normal: string; - let geometry_coat_normal: string; - let geometry_tangent: string; - let geometry_coat_tangent: string; - } - export { inputs_43 as inputs }; - export namespace outputs_43 { - let out_39: string; - export { out_39 as out }; - } - export { outputs_43 as outputs }; - } - namespace ND_open_pbr_anisotropy { - let node_44: string; - export { node_44 as node }; - let inherit_44: null; - export { inherit_44 as inherit }; - export namespace inputs_44 { - let roughness_9: string; - export { roughness_9 as roughness }; - let anisotropy_4: string; - export { anisotropy_4 as anisotropy }; - } - export { inputs_44 as inputs }; - export namespace outputs_44 { - let out_40: string; - export { out_40 as out }; - } - export { outputs_44 as outputs }; - } - namespace ND_UsdPreviewSurface_surfaceshader { - let node_45: string; - export { node_45 as node }; - let inherit_45: null; - export { inherit_45 as inherit }; - export namespace inputs_45 { - export let diffuseColor: string; - export let emissiveColor: string; - export let useSpecularWorkflow: string; - export let specularColor: string; - let metallic_1: string; - export { metallic_1 as metallic }; - let roughness_10: string; - export { roughness_10 as roughness }; - let clearcoat_1: string; - export { clearcoat_1 as clearcoat }; - export let clearcoatRoughness: string; - let opacity_1: string; - export { opacity_1 as opacity }; - export let opacityMode: string; - export let opacityThreshold: string; - let ior_5: string; - export { ior_5 as ior }; - let normal_11: string; - export { normal_11 as normal }; - let displacement_2: string; - export { displacement_2 as displacement }; - export let occlusion: string; - } - export { inputs_45 as inputs }; - export namespace outputs_45 { - let out_41: string; - export { out_41 as out }; - } - export { outputs_45 as outputs }; - } - namespace ND_UsdUVTexture { - let node_46: string; - export { node_46 as node }; - let inherit_46: string; - export { inherit_46 as inherit }; - let inputs_46: {}; - export { inputs_46 as inputs }; - export namespace outputs_46 { - let r: string; - let g: string; - let b: string; - let a: string; - let rgb: string; - let rgba: string; - } - export { outputs_46 as outputs }; - } - namespace ND_UsdUVTexture_23 { - let node_47: string; - export { node_47 as node }; - let inherit_47: null; - export { inherit_47 as inherit }; - export namespace inputs_47 { - let file_1: string; - export { file_1 as file }; - export let st: string; - export let wrapS: string; - export let wrapT: string; - export let fallback: string; - let scale_2: string; - export { scale_2 as scale }; - export let bias: string; - } - export { inputs_47 as inputs }; - export namespace outputs_47 { - let r_1: string; - export { r_1 as r }; - let g_1: string; - export { g_1 as g }; - let b_1: string; - export { b_1 as b }; - let a_1: string; - export { a_1 as a }; - let rgb_1: string; - export { rgb_1 as rgb }; - } - export { outputs_47 as outputs }; - } - namespace ND_UsdPrimvarReader_integer { - let node_48: string; - export { node_48 as node }; - let inherit_48: null; - export { inherit_48 as inherit }; - export namespace inputs_48 { - export let varname: string; - let fallback_1: string; - export { fallback_1 as fallback }; - } - export { inputs_48 as inputs }; - export namespace outputs_48 { - let out_42: string; - export { out_42 as out }; - } - export { outputs_48 as outputs }; - } - namespace ND_UsdPrimvarReader_boolean { - let node_49: string; - export { node_49 as node }; - let inherit_49: null; - export { inherit_49 as inherit }; - export namespace inputs_49 { - let varname_1: string; - export { varname_1 as varname }; - let fallback_2: string; - export { fallback_2 as fallback }; - } - export { inputs_49 as inputs }; - export namespace outputs_49 { - let out_43: string; - export { out_43 as out }; - } - export { outputs_49 as outputs }; - } - namespace ND_UsdPrimvarReader_string { - let node_50: string; - export { node_50 as node }; - let inherit_50: null; - export { inherit_50 as inherit }; - export namespace inputs_50 { - let varname_2: string; - export { varname_2 as varname }; - let fallback_3: string; - export { fallback_3 as fallback }; - } - export { inputs_50 as inputs }; - export namespace outputs_50 { - let out_44: string; - export { out_44 as out }; - } - export { outputs_50 as outputs }; - } - namespace ND_UsdPrimvarReader_filename { - let node_51: string; - export { node_51 as node }; - let inherit_51: null; - export { inherit_51 as inherit }; - export namespace inputs_51 { - let varname_3: string; - export { varname_3 as varname }; - let fallback_4: string; - export { fallback_4 as fallback }; - } - export { inputs_51 as inputs }; - export namespace outputs_51 { - let out_45: string; - export { out_45 as out }; - } - export { outputs_51 as outputs }; - } - namespace ND_UsdPrimvarReader_float { - let node_52: string; - export { node_52 as node }; - let inherit_52: null; - export { inherit_52 as inherit }; - export namespace inputs_52 { - let varname_4: string; - export { varname_4 as varname }; - let fallback_5: string; - export { fallback_5 as fallback }; - } - export { inputs_52 as inputs }; - export namespace outputs_52 { - let out_46: string; - export { out_46 as out }; - } - export { outputs_52 as outputs }; - } - namespace ND_UsdPrimvarReader_vector2 { - let node_53: string; - export { node_53 as node }; - let inherit_53: null; - export { inherit_53 as inherit }; - export namespace inputs_53 { - let varname_5: string; - export { varname_5 as varname }; - let fallback_6: string; - export { fallback_6 as fallback }; - } - export { inputs_53 as inputs }; - export namespace outputs_53 { - let out_47: string; - export { out_47 as out }; - } - export { outputs_53 as outputs }; - } - namespace ND_UsdPrimvarReader_vector3 { - let node_54: string; - export { node_54 as node }; - let inherit_54: null; - export { inherit_54 as inherit }; - export namespace inputs_54 { - let varname_6: string; - export { varname_6 as varname }; - let fallback_7: string; - export { fallback_7 as fallback }; - } - export { inputs_54 as inputs }; - export namespace outputs_54 { - let out_48: string; - export { out_48 as out }; - } - export { outputs_54 as outputs }; - } - namespace ND_UsdPrimvarReader_vector4 { - let node_55: string; - export { node_55 as node }; - let inherit_55: null; - export { inherit_55 as inherit }; - export namespace inputs_55 { - let varname_7: string; - export { varname_7 as varname }; - let fallback_8: string; - export { fallback_8 as fallback }; - } - export { inputs_55 as inputs }; - export namespace outputs_55 { - let out_49: string; - export { out_49 as out }; - } - export { outputs_55 as outputs }; - } - namespace ND_UsdTransform2d { - let node_56: string; - export { node_56 as node }; - let inherit_56: null; - export { inherit_56 as inherit }; - export namespace inputs_56 { - let _in: string; - export { _in as in }; - export let rotation: string; - let scale_3: string; - export { scale_3 as scale }; - export let translation: string; - } - export { inputs_56 as inputs }; - export namespace outputs_56 { - let out_50: string; - export { out_50 as out }; - } - export { outputs_56 as outputs }; - } - namespace ND_standard_surface_surfaceshader { - let node_57: string; - export { node_57 as node }; - let inherit_57: string; - export { inherit_57 as inherit }; - export namespace inputs_57 { - let base_3: string; - export { base_3 as base }; - let base_color_1: string; - export { base_color_1 as base_color }; - } - export { inputs_57 as inputs }; - let outputs_57: {}; - export { outputs_57 as outputs }; - } - namespace ND_standard_surface_surfaceshader_100 { - let node_58: string; - export { node_58 as node }; - let inherit_58: null; - export { inherit_58 as inherit }; - export namespace inputs_58 { - let base_4: string; - export { base_4 as base }; - let base_color_2: string; - export { base_color_2 as base_color }; - export let diffuse_roughness: string; - export let metalness: string; - let specular_1: string; - export { specular_1 as specular }; - let specular_color_1: string; - export { specular_color_1 as specular_color }; - let specular_roughness_1: string; - export { specular_roughness_1 as specular_roughness }; - export let specular_IOR: string; - export let specular_anisotropy: string; - export let specular_rotation: string; - export let transmission: string; - let transmission_color_1: string; - export { transmission_color_1 as transmission_color }; - let transmission_depth_1: string; - export { transmission_depth_1 as transmission_depth }; - let transmission_scatter_1: string; - export { transmission_scatter_1 as transmission_scatter }; - let transmission_scatter_anisotropy_1: string; - export { transmission_scatter_anisotropy_1 as transmission_scatter_anisotropy }; - export let transmission_dispersion: string; - export let transmission_extra_roughness: string; - let subsurface_1: string; - export { subsurface_1 as subsurface }; - let subsurface_color_1: string; - export { subsurface_color_1 as subsurface_color }; - let subsurface_radius_1: string; - export { subsurface_radius_1 as subsurface_radius }; - export let subsurface_scale: string; - export let subsurface_anisotropy: string; - let sheen_1: string; - export { sheen_1 as sheen }; - export let sheen_color: string; - export let sheen_roughness: string; - export let coat: string; - let coat_color_1: string; - export { coat_color_1 as coat_color }; - let coat_roughness_1: string; - export { coat_roughness_1 as coat_roughness }; - export let coat_anisotropy: string; - export let coat_rotation: string; - export let coat_IOR: string; - export let coat_normal: string; - export let coat_affect_color: string; - export let coat_affect_roughness: string; - let thin_film_thickness_1: string; - export { thin_film_thickness_1 as thin_film_thickness }; - export let thin_film_IOR: string; - export let emission: string; - let emission_color_1: string; - export { emission_color_1 as emission_color }; - let opacity_2: string; - export { opacity_2 as opacity }; - let thin_walled_1: string; - export { thin_walled_1 as thin_walled }; - let normal_12: string; - export { normal_12 as normal }; - let tangent_3: string; - export { tangent_3 as tangent }; - } - export { inputs_58 as inputs }; - export namespace outputs_58 { - let out_51: string; - export { out_51 as out }; - } - export { outputs_58 as outputs }; - } - namespace ND_gltf_pbr_surfaceshader { - let node_59: string; - export { node_59 as node }; - let inherit_59: null; - export { inherit_59 as inherit }; - export namespace inputs_59 { - let base_color_3: string; - export { base_color_3 as base_color }; - let metallic_2: string; - export { metallic_2 as metallic }; - let roughness_11: string; - export { roughness_11 as roughness }; - let normal_13: string; - export { normal_13 as normal }; - let tangent_4: string; - export { tangent_4 as tangent }; - let occlusion_1: string; - export { occlusion_1 as occlusion }; - let transmission_1: string; - export { transmission_1 as transmission }; - let specular_2: string; - export { specular_2 as specular }; - let specular_color_2: string; - export { specular_color_2 as specular_color }; - let ior_6: string; - export { ior_6 as ior }; - export let alpha: string; - export let alpha_mode: string; - export let alpha_cutoff: string; - export let iridescence: string; - export let iridescence_ior: string; - export let iridescence_thickness: string; - let sheen_color_1: string; - export { sheen_color_1 as sheen_color }; - let sheen_roughness_1: string; - export { sheen_roughness_1 as sheen_roughness }; - let clearcoat_2: string; - export { clearcoat_2 as clearcoat }; - export let clearcoat_roughness: string; - export let clearcoat_normal: string; - export let emissive: string; - export let emissive_strength: string; - export let thickness: string; - export let attenuation_distance: string; - export let attenuation_color: string; - export let anisotropy_strength: string; - export let anisotropy_rotation: string; - export let dispersion: string; - } - export { inputs_59 as inputs }; - export namespace outputs_59 { - let out_52: string; - export { out_52 as out }; - } - export { outputs_59 as outputs }; - } - namespace ND_gltf_colorimage { - let node_60: string; - export { node_60 as node }; - let inherit_60: null; - export { inherit_60 as inherit }; - export namespace inputs_60 { - let file_2: string; - export { file_2 as file }; - let _default: string; - export { _default as default }; - export let texcoord: string; - export let pivot: string; - let scale_4: string; - export { scale_4 as scale }; - export let rotate: string; - export let offset: string; - export let operationorder: string; - export let uaddressmode: string; - export let vaddressmode: string; - export let filtertype: string; - let color_9: string; - export { color_9 as color }; - export let geomcolor: string; - } - export { inputs_60 as inputs }; - export namespace outputs_60 { - let outcolor: string; - let outa: string; - } - export { outputs_60 as outputs }; - } - namespace ND_gltf_image_color3_color3_1_0 { - let node_61: string; - export { node_61 as node }; - let inherit_61: null; - export { inherit_61 as inherit }; - export namespace inputs_61 { - let file_3: string; - export { file_3 as file }; - export let factor: string; - let _default_1: string; - export { _default_1 as default }; - let texcoord_1: string; - export { texcoord_1 as texcoord }; - let pivot_1: string; - export { pivot_1 as pivot }; - let scale_5: string; - export { scale_5 as scale }; - let rotate_1: string; - export { rotate_1 as rotate }; - let offset_1: string; - export { offset_1 as offset }; - let operationorder_1: string; - export { operationorder_1 as operationorder }; - let uaddressmode_1: string; - export { uaddressmode_1 as uaddressmode }; - let vaddressmode_1: string; - export { vaddressmode_1 as vaddressmode }; - let filtertype_1: string; - export { filtertype_1 as filtertype }; - } - export { inputs_61 as inputs }; - export namespace outputs_61 { - let out_53: string; - export { out_53 as out }; - } - export { outputs_61 as outputs }; - } - namespace ND_gltf_image_color4_color4_1_0 { - let node_62: string; - export { node_62 as node }; - let inherit_62: null; - export { inherit_62 as inherit }; - export namespace inputs_62 { - let file_4: string; - export { file_4 as file }; - let factor_1: string; - export { factor_1 as factor }; - let _default_2: string; - export { _default_2 as default }; - let texcoord_2: string; - export { texcoord_2 as texcoord }; - let pivot_2: string; - export { pivot_2 as pivot }; - let scale_6: string; - export { scale_6 as scale }; - let rotate_2: string; - export { rotate_2 as rotate }; - let offset_2: string; - export { offset_2 as offset }; - let operationorder_2: string; - export { operationorder_2 as operationorder }; - let uaddressmode_2: string; - export { uaddressmode_2 as uaddressmode }; - let vaddressmode_2: string; - export { vaddressmode_2 as vaddressmode }; - let filtertype_2: string; - export { filtertype_2 as filtertype }; - } - export { inputs_62 as inputs }; - export namespace outputs_62 { - let out_54: string; - export { out_54 as out }; - } - export { outputs_62 as outputs }; - } - namespace ND_gltf_image_float_float_1_0 { - let node_63: string; - export { node_63 as node }; - let inherit_63: null; - export { inherit_63 as inherit }; - export namespace inputs_63 { - let file_5: string; - export { file_5 as file }; - let factor_2: string; - export { factor_2 as factor }; - let _default_3: string; - export { _default_3 as default }; - let texcoord_3: string; - export { texcoord_3 as texcoord }; - let pivot_3: string; - export { pivot_3 as pivot }; - let scale_7: string; - export { scale_7 as scale }; - let rotate_3: string; - export { rotate_3 as rotate }; - let offset_3: string; - export { offset_3 as offset }; - let operationorder_3: string; - export { operationorder_3 as operationorder }; - let uaddressmode_3: string; - export { uaddressmode_3 as uaddressmode }; - let vaddressmode_3: string; - export { vaddressmode_3 as vaddressmode }; - let filtertype_3: string; - export { filtertype_3 as filtertype }; - } - export { inputs_63 as inputs }; - export namespace outputs_63 { - let out_55: string; - export { out_55 as out }; - } - export { outputs_63 as outputs }; - } - namespace ND_gltf_image_vector3_vector3_1_0 { - let node_64: string; - export { node_64 as node }; - let inherit_64: null; - export { inherit_64 as inherit }; - export namespace inputs_64 { - let file_6: string; - export { file_6 as file }; - let _default_4: string; - export { _default_4 as default }; - let texcoord_4: string; - export { texcoord_4 as texcoord }; - let pivot_4: string; - export { pivot_4 as pivot }; - let scale_8: string; - export { scale_8 as scale }; - let rotate_4: string; - export { rotate_4 as rotate }; - let offset_4: string; - export { offset_4 as offset }; - let operationorder_4: string; - export { operationorder_4 as operationorder }; - let uaddressmode_4: string; - export { uaddressmode_4 as uaddressmode }; - let vaddressmode_4: string; - export { vaddressmode_4 as vaddressmode }; - let filtertype_4: string; - export { filtertype_4 as filtertype }; - } - export { inputs_64 as inputs }; - export namespace outputs_64 { - let out_56: string; - export { out_56 as out }; - } - export { outputs_64 as outputs }; - } - namespace ND_gltf_normalmap_vector3_1_0 { - let node_65: string; - export { node_65 as node }; - let inherit_65: null; - export { inherit_65 as inherit }; - export namespace inputs_65 { - let file_7: string; - export { file_7 as file }; - let _default_5: string; - export { _default_5 as default }; - let texcoord_5: string; - export { texcoord_5 as texcoord }; - let pivot_5: string; - export { pivot_5 as pivot }; - let scale_9: string; - export { scale_9 as scale }; - let rotate_5: string; - export { rotate_5 as rotate }; - let offset_5: string; - export { offset_5 as offset }; - let operationorder_5: string; - export { operationorder_5 as operationorder }; - let uaddressmode_5: string; - export { uaddressmode_5 as uaddressmode }; - let vaddressmode_5: string; - export { vaddressmode_5 as vaddressmode }; - let filtertype_5: string; - export { filtertype_5 as filtertype }; - } - export { inputs_65 as inputs }; - export namespace outputs_65 { - let out_57: string; - export { out_57 as out }; - } - export { outputs_65 as outputs }; - } - namespace ND_gltf_iridescence_thickness_float_1_0 { - let node_66: string; - export { node_66 as node }; - let inherit_66: null; - export { inherit_66 as inherit }; - export namespace inputs_66 { - let file_8: string; - export { file_8 as file }; - let _default_6: string; - export { _default_6 as default }; - let texcoord_6: string; - export { texcoord_6 as texcoord }; - let pivot_6: string; - export { pivot_6 as pivot }; - let scale_10: string; - export { scale_10 as scale }; - let rotate_6: string; - export { rotate_6 as rotate }; - let offset_6: string; - export { offset_6 as offset }; - let uaddressmode_6: string; - export { uaddressmode_6 as uaddressmode }; - let vaddressmode_6: string; - export { vaddressmode_6 as vaddressmode }; - let filtertype_6: string; - export { filtertype_6 as filtertype }; - export let thicknessMin: string; - export let thicknessMax: string; - } - export { inputs_66 as inputs }; - export namespace outputs_66 { - let out_58: string; - export { out_58 as out }; - } - export { outputs_66 as outputs }; - } - namespace ND_gltf_anisotropy_image { - let node_67: string; - export { node_67 as node }; - let inherit_67: null; - export { inherit_67 as inherit }; - export namespace inputs_67 { - let file_9: string; - export { file_9 as file }; - let _default_7: string; - export { _default_7 as default }; - let texcoord_7: string; - export { texcoord_7 as texcoord }; - let pivot_7: string; - export { pivot_7 as pivot }; - let scale_11: string; - export { scale_11 as scale }; - let rotate_7: string; - export { rotate_7 as rotate }; - let offset_7: string; - export { offset_7 as offset }; - let operationorder_6: string; - export { operationorder_6 as operationorder }; - let uaddressmode_7: string; - export { uaddressmode_7 as uaddressmode }; - let vaddressmode_7: string; - export { vaddressmode_7 as vaddressmode }; - let filtertype_7: string; - export { filtertype_7 as filtertype }; - let anisotropy_strength_1: string; - export { anisotropy_strength_1 as anisotropy_strength }; - let anisotropy_rotation_1: string; - export { anisotropy_rotation_1 as anisotropy_rotation }; - } - export { inputs_67 as inputs }; - export namespace outputs_67 { - let anisotropy_strength_out: string; - let anisotropy_rotation_out: string; - } - export { outputs_67 as outputs }; - } - namespace ND_viewdirection_vector3 { - let node_68: string; - export { node_68 as node }; - let inherit_68: null; - export { inherit_68 as inherit }; - export namespace inputs_68 { - let space: string; - } - export { inputs_68 as inputs }; - export namespace outputs_68 { - let out_59: string; - export { out_59 as out }; - } - export { outputs_68 as outputs }; - } - namespace ND_facingratio_float { - let node_69: string; - export { node_69 as node }; - let inherit_69: null; - export { inherit_69 as inherit }; - export namespace inputs_69 { - export let viewdirection: string; - let normal_14: string; - export { normal_14 as normal }; - export let faceforward: string; - export let invert: string; - } - export { inputs_69 as inputs }; - export namespace outputs_69 { - let out_60: string; - export { out_60 as out }; - } - export { outputs_69 as outputs }; - } - namespace ND_gooch_shade { - let node_70: string; - export { node_70 as node }; - let inherit_70: null; - export { inherit_70 as inherit }; - export namespace inputs_70 { - let warm_color: string; - let cool_color: string; - let specular_intensity: string; - let shininess: string; - let light_direction: string; - } - export { inputs_70 as inputs }; - export namespace outputs_70 { - let out_61: string; - export { out_61 as out }; - } - export { outputs_70 as outputs }; - } - namespace ND_g18_rec709_to_lin_rec709_color3 { - let node_71: string; - export { node_71 as node }; - let inherit_71: null; - export { inherit_71 as inherit }; - export namespace inputs_71 { - let _in_1: string; - export { _in_1 as in }; - } - export { inputs_71 as inputs }; - export namespace outputs_71 { - let out_62: string; - export { out_62 as out }; - } - export { outputs_71 as outputs }; - } - namespace ND_g18_rec709_to_lin_rec709_color4 { - let node_72: string; - export { node_72 as node }; - let inherit_72: null; - export { inherit_72 as inherit }; - export namespace inputs_72 { - let _in_2: string; - export { _in_2 as in }; - } - export { inputs_72 as inputs }; - export namespace outputs_72 { - let out_63: string; - export { out_63 as out }; - } - export { outputs_72 as outputs }; - } - namespace ND_g22_rec709_to_lin_rec709_color3 { - let node_73: string; - export { node_73 as node }; - let inherit_73: null; - export { inherit_73 as inherit }; - export namespace inputs_73 { - let _in_3: string; - export { _in_3 as in }; - } - export { inputs_73 as inputs }; - export namespace outputs_73 { - let out_64: string; - export { out_64 as out }; - } - export { outputs_73 as outputs }; - } - namespace ND_g22_rec709_to_lin_rec709_color4 { - let node_74: string; - export { node_74 as node }; - let inherit_74: null; - export { inherit_74 as inherit }; - export namespace inputs_74 { - let _in_4: string; - export { _in_4 as in }; - } - export { inputs_74 as inputs }; - export namespace outputs_74 { - let out_65: string; - export { out_65 as out }; - } - export { outputs_74 as outputs }; - } - namespace ND_rec709_display_to_lin_rec709_color3 { - let node_75: string; - export { node_75 as node }; - let inherit_75: null; - export { inherit_75 as inherit }; - export namespace inputs_75 { - let _in_5: string; - export { _in_5 as in }; - } - export { inputs_75 as inputs }; - export namespace outputs_75 { - let out_66: string; - export { out_66 as out }; - } - export { outputs_75 as outputs }; - } - namespace ND_rec709_display_to_lin_rec709_color4 { - let node_76: string; - export { node_76 as node }; - let inherit_76: null; - export { inherit_76 as inherit }; - export namespace inputs_76 { - let _in_6: string; - export { _in_6 as in }; - } - export { inputs_76 as inputs }; - export namespace outputs_76 { - let out_67: string; - export { out_67 as out }; - } - export { outputs_76 as outputs }; - } - namespace ND_acescg_to_lin_rec709_color3 { - let node_77: string; - export { node_77 as node }; - let inherit_77: null; - export { inherit_77 as inherit }; - export namespace inputs_77 { - let _in_7: string; - export { _in_7 as in }; - } - export { inputs_77 as inputs }; - export namespace outputs_77 { - let out_68: string; - export { out_68 as out }; - } - export { outputs_77 as outputs }; - } - namespace ND_acescg_to_lin_rec709_color4 { - let node_78: string; - export { node_78 as node }; - let inherit_78: null; - export { inherit_78 as inherit }; - export namespace inputs_78 { - let _in_8: string; - export { _in_8 as in }; - } - export { inputs_78 as inputs }; - export namespace outputs_78 { - let out_69: string; - export { out_69 as out }; - } - export { outputs_78 as outputs }; - } - namespace ND_g22_ap1_to_lin_rec709_color3 { - let node_79: string; - export { node_79 as node }; - let inherit_79: null; - export { inherit_79 as inherit }; - export namespace inputs_79 { - let _in_9: string; - export { _in_9 as in }; - } - export { inputs_79 as inputs }; - export namespace outputs_79 { - let out_70: string; - export { out_70 as out }; - } - export { outputs_79 as outputs }; - } - namespace ND_g22_ap1_to_lin_rec709_color4 { - let node_80: string; - export { node_80 as node }; - let inherit_80: null; - export { inherit_80 as inherit }; - export namespace inputs_80 { - let _in_10: string; - export { _in_10 as in }; - } - export { inputs_80 as inputs }; - export namespace outputs_80 { - let out_71: string; - export { out_71 as out }; - } - export { outputs_80 as outputs }; - } - namespace ND_srgb_texture_to_lin_rec709_color3 { - let node_81: string; - export { node_81 as node }; - let inherit_81: null; - export { inherit_81 as inherit }; - export namespace inputs_81 { - let _in_11: string; - export { _in_11 as in }; - } - export { inputs_81 as inputs }; - export namespace outputs_81 { - let out_72: string; - export { out_72 as out }; - } - export { outputs_81 as outputs }; - } - namespace ND_srgb_texture_to_lin_rec709_color4 { - let node_82: string; - export { node_82 as node }; - let inherit_82: null; - export { inherit_82 as inherit }; - export namespace inputs_82 { - let _in_12: string; - export { _in_12 as in }; - } - export { inputs_82 as inputs }; - export namespace outputs_82 { - let out_73: string; - export { out_73 as out }; - } - export { outputs_82 as outputs }; - } - namespace ND_lin_adobergb_to_lin_rec709_color3 { - let node_83: string; - export { node_83 as node }; - let inherit_83: null; - export { inherit_83 as inherit }; - export namespace inputs_83 { - let _in_13: string; - export { _in_13 as in }; - } - export { inputs_83 as inputs }; - export namespace outputs_83 { - let out_74: string; - export { out_74 as out }; - } - export { outputs_83 as outputs }; - } - namespace ND_lin_adobergb_to_lin_rec709_color4 { - let node_84: string; - export { node_84 as node }; - let inherit_84: null; - export { inherit_84 as inherit }; - export namespace inputs_84 { - let _in_14: string; - export { _in_14 as in }; - } - export { inputs_84 as inputs }; - export namespace outputs_84 { - let out_75: string; - export { out_75 as out }; - } - export { outputs_84 as outputs }; - } - namespace ND_adobergb_to_lin_rec709_color3 { - let node_85: string; - export { node_85 as node }; - let inherit_85: null; - export { inherit_85 as inherit }; - export namespace inputs_85 { - let _in_15: string; - export { _in_15 as in }; - } - export { inputs_85 as inputs }; - export namespace outputs_85 { - let out_76: string; - export { out_76 as out }; - } - export { outputs_85 as outputs }; - } - namespace ND_adobergb_to_lin_rec709_color4 { - let node_86: string; - export { node_86 as node }; - let inherit_86: null; - export { inherit_86 as inherit }; - export namespace inputs_86 { - let _in_16: string; - export { _in_16 as in }; - } - export { inputs_86 as inputs }; - export namespace outputs_86 { - let out_77: string; - export { out_77 as out }; - } - export { outputs_86 as outputs }; - } - namespace ND_srgb_displayp3_to_lin_rec709_color3 { - let node_87: string; - export { node_87 as node }; - let inherit_87: null; - export { inherit_87 as inherit }; - export namespace inputs_87 { - let _in_17: string; - export { _in_17 as in }; - } - export { inputs_87 as inputs }; - export namespace outputs_87 { - let out_78: string; - export { out_78 as out }; - } - export { outputs_87 as outputs }; - } - namespace ND_srgb_displayp3_to_lin_rec709_color4 { - let node_88: string; - export { node_88 as node }; - let inherit_88: null; - export { inherit_88 as inherit }; - export namespace inputs_88 { - let _in_18: string; - export { _in_18 as in }; - } - export { inputs_88 as inputs }; - export namespace outputs_88 { - let out_79: string; - export { out_79 as out }; - } - export { outputs_88 as outputs }; - } - namespace ND_lin_displayp3_to_lin_rec709_color3 { - let node_89: string; - export { node_89 as node }; - let inherit_89: null; - export { inherit_89 as inherit }; - export namespace inputs_89 { - let _in_19: string; - export { _in_19 as in }; - } - export { inputs_89 as inputs }; - export namespace outputs_89 { - let out_80: string; - export { out_80 as out }; - } - export { outputs_89 as outputs }; - } - namespace ND_lin_displayp3_to_lin_rec709_color4 { - let node_90: string; - export { node_90 as node }; - let inherit_90: null; - export { inherit_90 as inherit }; - export namespace inputs_90 { - let _in_20: string; - export { _in_20 as in }; - } - export { inputs_90 as inputs }; - export namespace outputs_90 { - let out_81: string; - export { out_81 as out }; - } - export { outputs_90 as outputs }; - } - namespace ND_surfacematerial { - let node_91: string; - export { node_91 as node }; - let inherit_91: null; - export { inherit_91 as inherit }; - export namespace inputs_91 { - let surfaceshader: string; - let backsurfaceshader: string; - let displacementshader: string; - } - export { inputs_91 as inputs }; - export namespace outputs_91 { - let out_82: string; - export { out_82 as out }; - } - export { outputs_91 as outputs }; - } - namespace ND_volumematerial { - let node_92: string; - export { node_92 as node }; - let inherit_92: null; - export { inherit_92 as inherit }; - export namespace inputs_92 { - let volumeshader: string; - } - export { inputs_92 as inputs }; - export namespace outputs_92 { - let out_83: string; - export { out_83 as out }; - } - export { outputs_92 as outputs }; - } - namespace ND_surface_unlit { - let node_93: string; - export { node_93 as node }; - let inherit_93: null; - export { inherit_93 as inherit }; - export namespace inputs_93 { - let emission_1: string; - export { emission_1 as emission }; - let emission_color_2: string; - export { emission_color_2 as emission_color }; - let transmission_2: string; - export { transmission_2 as transmission }; - let transmission_color_2: string; - export { transmission_color_2 as transmission_color }; - let opacity_3: string; - export { opacity_3 as opacity }; - } - export { inputs_93 as inputs }; - export namespace outputs_93 { - let out_84: string; - export { out_84 as out }; - } - export { outputs_93 as outputs }; - } - namespace ND_image_float { - let node_94: string; - export { node_94 as node }; - let inherit_94: null; - export { inherit_94 as inherit }; - export namespace inputs_94 { - let file_10: string; - export { file_10 as file }; - export let layer: string; - let _default_8: string; - export { _default_8 as default }; - let texcoord_8: string; - export { texcoord_8 as texcoord }; - let uaddressmode_8: string; - export { uaddressmode_8 as uaddressmode }; - let vaddressmode_8: string; - export { vaddressmode_8 as vaddressmode }; - let filtertype_8: string; - export { filtertype_8 as filtertype }; - export let framerange: string; - export let frameoffset: string; - export let frameendaction: string; - } - export { inputs_94 as inputs }; - export namespace outputs_94 { - let out_85: string; - export { out_85 as out }; - } - export { outputs_94 as outputs }; - } - namespace ND_image_color3 { - let node_95: string; - export { node_95 as node }; - let inherit_95: null; - export { inherit_95 as inherit }; - export namespace inputs_95 { - let file_11: string; - export { file_11 as file }; - let layer_1: string; - export { layer_1 as layer }; - let _default_9: string; - export { _default_9 as default }; - let texcoord_9: string; - export { texcoord_9 as texcoord }; - let uaddressmode_9: string; - export { uaddressmode_9 as uaddressmode }; - let vaddressmode_9: string; - export { vaddressmode_9 as vaddressmode }; - let filtertype_9: string; - export { filtertype_9 as filtertype }; - let framerange_1: string; - export { framerange_1 as framerange }; - let frameoffset_1: string; - export { frameoffset_1 as frameoffset }; - let frameendaction_1: string; - export { frameendaction_1 as frameendaction }; - } - export { inputs_95 as inputs }; - export namespace outputs_95 { - let out_86: string; - export { out_86 as out }; - } - export { outputs_95 as outputs }; - } - namespace ND_image_color4 { - let node_96: string; - export { node_96 as node }; - let inherit_96: null; - export { inherit_96 as inherit }; - export namespace inputs_96 { - let file_12: string; - export { file_12 as file }; - let layer_2: string; - export { layer_2 as layer }; - let _default_10: string; - export { _default_10 as default }; - let texcoord_10: string; - export { texcoord_10 as texcoord }; - let uaddressmode_10: string; - export { uaddressmode_10 as uaddressmode }; - let vaddressmode_10: string; - export { vaddressmode_10 as vaddressmode }; - let filtertype_10: string; - export { filtertype_10 as filtertype }; - let framerange_2: string; - export { framerange_2 as framerange }; - let frameoffset_2: string; - export { frameoffset_2 as frameoffset }; - let frameendaction_2: string; - export { frameendaction_2 as frameendaction }; - } - export { inputs_96 as inputs }; - export namespace outputs_96 { - let out_87: string; - export { out_87 as out }; - } - export { outputs_96 as outputs }; - } - namespace ND_image_vector2 { - let node_97: string; - export { node_97 as node }; - let inherit_97: null; - export { inherit_97 as inherit }; - export namespace inputs_97 { - let file_13: string; - export { file_13 as file }; - let layer_3: string; - export { layer_3 as layer }; - let _default_11: string; - export { _default_11 as default }; - let texcoord_11: string; - export { texcoord_11 as texcoord }; - let uaddressmode_11: string; - export { uaddressmode_11 as uaddressmode }; - let vaddressmode_11: string; - export { vaddressmode_11 as vaddressmode }; - let filtertype_11: string; - export { filtertype_11 as filtertype }; - let framerange_3: string; - export { framerange_3 as framerange }; - let frameoffset_3: string; - export { frameoffset_3 as frameoffset }; - let frameendaction_3: string; - export { frameendaction_3 as frameendaction }; - } - export { inputs_97 as inputs }; - export namespace outputs_97 { - let out_88: string; - export { out_88 as out }; - } - export { outputs_97 as outputs }; - } - namespace ND_image_vector3 { - let node_98: string; - export { node_98 as node }; - let inherit_98: null; - export { inherit_98 as inherit }; - export namespace inputs_98 { - let file_14: string; - export { file_14 as file }; - let layer_4: string; - export { layer_4 as layer }; - let _default_12: string; - export { _default_12 as default }; - let texcoord_12: string; - export { texcoord_12 as texcoord }; - let uaddressmode_12: string; - export { uaddressmode_12 as uaddressmode }; - let vaddressmode_12: string; - export { vaddressmode_12 as vaddressmode }; - let filtertype_12: string; - export { filtertype_12 as filtertype }; - let framerange_4: string; - export { framerange_4 as framerange }; - let frameoffset_4: string; - export { frameoffset_4 as frameoffset }; - let frameendaction_4: string; - export { frameendaction_4 as frameendaction }; - } - export { inputs_98 as inputs }; - export namespace outputs_98 { - let out_89: string; - export { out_89 as out }; - } - export { outputs_98 as outputs }; - } - namespace ND_image_vector4 { - let node_99: string; - export { node_99 as node }; - let inherit_99: null; - export { inherit_99 as inherit }; - export namespace inputs_99 { - let file_15: string; - export { file_15 as file }; - let layer_5: string; - export { layer_5 as layer }; - let _default_13: string; - export { _default_13 as default }; - let texcoord_13: string; - export { texcoord_13 as texcoord }; - let uaddressmode_13: string; - export { uaddressmode_13 as uaddressmode }; - let vaddressmode_13: string; - export { vaddressmode_13 as vaddressmode }; - let filtertype_13: string; - export { filtertype_13 as filtertype }; - let framerange_5: string; - export { framerange_5 as framerange }; - let frameoffset_5: string; - export { frameoffset_5 as frameoffset }; - let frameendaction_5: string; - export { frameendaction_5 as frameendaction }; - } - export { inputs_99 as inputs }; - export namespace outputs_99 { - let out_90: string; - export { out_90 as out }; - } - export { outputs_99 as outputs }; - } - namespace ND_tiledimage_float { - let node_100: string; - export { node_100 as node }; - let inherit_100: null; - export { inherit_100 as inherit }; - export namespace inputs_100 { - let file_16: string; - export { file_16 as file }; - let _default_14: string; - export { _default_14 as default }; - let texcoord_14: string; - export { texcoord_14 as texcoord }; - export let uvtiling: string; - export let uvoffset: string; - export let realworldimagesize: string; - export let realworldtilesize: string; - let filtertype_14: string; - export { filtertype_14 as filtertype }; - let framerange_6: string; - export { framerange_6 as framerange }; - let frameoffset_6: string; - export { frameoffset_6 as frameoffset }; - let frameendaction_6: string; - export { frameendaction_6 as frameendaction }; - } - export { inputs_100 as inputs }; - export namespace outputs_100 { - let out_91: string; - export { out_91 as out }; - } - export { outputs_100 as outputs }; - } - namespace ND_tiledimage_color3 { - let node_101: string; - export { node_101 as node }; - let inherit_101: null; - export { inherit_101 as inherit }; - export namespace inputs_101 { - let file_17: string; - export { file_17 as file }; - let _default_15: string; - export { _default_15 as default }; - let texcoord_15: string; - export { texcoord_15 as texcoord }; - let uvtiling_1: string; - export { uvtiling_1 as uvtiling }; - let uvoffset_1: string; - export { uvoffset_1 as uvoffset }; - let realworldimagesize_1: string; - export { realworldimagesize_1 as realworldimagesize }; - let realworldtilesize_1: string; - export { realworldtilesize_1 as realworldtilesize }; - let filtertype_15: string; - export { filtertype_15 as filtertype }; - let framerange_7: string; - export { framerange_7 as framerange }; - let frameoffset_7: string; - export { frameoffset_7 as frameoffset }; - let frameendaction_7: string; - export { frameendaction_7 as frameendaction }; - } - export { inputs_101 as inputs }; - export namespace outputs_101 { - let out_92: string; - export { out_92 as out }; - } - export { outputs_101 as outputs }; - } - namespace ND_tiledimage_color4 { - let node_102: string; - export { node_102 as node }; - let inherit_102: null; - export { inherit_102 as inherit }; - export namespace inputs_102 { - let file_18: string; - export { file_18 as file }; - let _default_16: string; - export { _default_16 as default }; - let texcoord_16: string; - export { texcoord_16 as texcoord }; - let uvtiling_2: string; - export { uvtiling_2 as uvtiling }; - let uvoffset_2: string; - export { uvoffset_2 as uvoffset }; - let realworldimagesize_2: string; - export { realworldimagesize_2 as realworldimagesize }; - let realworldtilesize_2: string; - export { realworldtilesize_2 as realworldtilesize }; - let filtertype_16: string; - export { filtertype_16 as filtertype }; - let framerange_8: string; - export { framerange_8 as framerange }; - let frameoffset_8: string; - export { frameoffset_8 as frameoffset }; - let frameendaction_8: string; - export { frameendaction_8 as frameendaction }; - } - export { inputs_102 as inputs }; - export namespace outputs_102 { - let out_93: string; - export { out_93 as out }; - } - export { outputs_102 as outputs }; - } - namespace ND_tiledimage_vector2 { - let node_103: string; - export { node_103 as node }; - let inherit_103: null; - export { inherit_103 as inherit }; - export namespace inputs_103 { - let file_19: string; - export { file_19 as file }; - let _default_17: string; - export { _default_17 as default }; - let texcoord_17: string; - export { texcoord_17 as texcoord }; - let uvtiling_3: string; - export { uvtiling_3 as uvtiling }; - let uvoffset_3: string; - export { uvoffset_3 as uvoffset }; - let realworldimagesize_3: string; - export { realworldimagesize_3 as realworldimagesize }; - let realworldtilesize_3: string; - export { realworldtilesize_3 as realworldtilesize }; - let filtertype_17: string; - export { filtertype_17 as filtertype }; - let framerange_9: string; - export { framerange_9 as framerange }; - let frameoffset_9: string; - export { frameoffset_9 as frameoffset }; - let frameendaction_9: string; - export { frameendaction_9 as frameendaction }; - } - export { inputs_103 as inputs }; - export namespace outputs_103 { - let out_94: string; - export { out_94 as out }; - } - export { outputs_103 as outputs }; - } - namespace ND_tiledimage_vector3 { - let node_104: string; - export { node_104 as node }; - let inherit_104: null; - export { inherit_104 as inherit }; - export namespace inputs_104 { - let file_20: string; - export { file_20 as file }; - let _default_18: string; - export { _default_18 as default }; - let texcoord_18: string; - export { texcoord_18 as texcoord }; - let uvtiling_4: string; - export { uvtiling_4 as uvtiling }; - let uvoffset_4: string; - export { uvoffset_4 as uvoffset }; - let realworldimagesize_4: string; - export { realworldimagesize_4 as realworldimagesize }; - let realworldtilesize_4: string; - export { realworldtilesize_4 as realworldtilesize }; - let filtertype_18: string; - export { filtertype_18 as filtertype }; - let framerange_10: string; - export { framerange_10 as framerange }; - let frameoffset_10: string; - export { frameoffset_10 as frameoffset }; - let frameendaction_10: string; - export { frameendaction_10 as frameendaction }; - } - export { inputs_104 as inputs }; - export namespace outputs_104 { - let out_95: string; - export { out_95 as out }; - } - export { outputs_104 as outputs }; - } - namespace ND_tiledimage_vector4 { - let node_105: string; - export { node_105 as node }; - let inherit_105: null; - export { inherit_105 as inherit }; - export namespace inputs_105 { - let file_21: string; - export { file_21 as file }; - let _default_19: string; - export { _default_19 as default }; - let texcoord_19: string; - export { texcoord_19 as texcoord }; - let uvtiling_5: string; - export { uvtiling_5 as uvtiling }; - let uvoffset_5: string; - export { uvoffset_5 as uvoffset }; - let realworldimagesize_5: string; - export { realworldimagesize_5 as realworldimagesize }; - let realworldtilesize_5: string; - export { realworldtilesize_5 as realworldtilesize }; - let filtertype_19: string; - export { filtertype_19 as filtertype }; - let framerange_11: string; - export { framerange_11 as framerange }; - let frameoffset_11: string; - export { frameoffset_11 as frameoffset }; - let frameendaction_11: string; - export { frameendaction_11 as frameendaction }; - } - export { inputs_105 as inputs }; - export namespace outputs_105 { - let out_96: string; - export { out_96 as out }; - } - export { outputs_105 as outputs }; - } - namespace ND_latlongimage { - let node_106: string; - export { node_106 as node }; - let inherit_106: null; - export { inherit_106 as inherit }; - export namespace inputs_106 { - let file_22: string; - export { file_22 as file }; - let _default_20: string; - export { _default_20 as default }; - export let viewdir: string; - let rotation_1: string; - export { rotation_1 as rotation }; - } - export { inputs_106 as inputs }; - export namespace outputs_106 { - let out_97: string; - export { out_97 as out }; - } - export { outputs_106 as outputs }; - } - namespace ND_hextiledimage_color3 { - let node_107: string; - export { node_107 as node }; - let inherit_107: null; - export { inherit_107 as inherit }; - export namespace inputs_107 { - let file_23: string; - export { file_23 as file }; - let _default_21: string; - export { _default_21 as default }; - let texcoord_20: string; - export { texcoord_20 as texcoord }; - export let tiling: string; - let rotation_2: string; - export { rotation_2 as rotation }; - export let rotationrange: string; - let scale_12: string; - export { scale_12 as scale }; - export let scalerange: string; - let offset_8: string; - export { offset_8 as offset }; - export let offsetrange: string; - export let falloff: string; - export let falloffcontrast: string; - export let lumacoeffs: string; - } - export { inputs_107 as inputs }; - export namespace outputs_107 { - let out_98: string; - export { out_98 as out }; - } - export { outputs_107 as outputs }; - } - namespace ND_hextiledimage_color4 { - let node_108: string; - export { node_108 as node }; - let inherit_108: null; - export { inherit_108 as inherit }; - export namespace inputs_108 { - let file_24: string; - export { file_24 as file }; - let _default_22: string; - export { _default_22 as default }; - let texcoord_21: string; - export { texcoord_21 as texcoord }; - let tiling_1: string; - export { tiling_1 as tiling }; - let rotation_3: string; - export { rotation_3 as rotation }; - let rotationrange_1: string; - export { rotationrange_1 as rotationrange }; - let scale_13: string; - export { scale_13 as scale }; - let scalerange_1: string; - export { scalerange_1 as scalerange }; - let offset_9: string; - export { offset_9 as offset }; - let offsetrange_1: string; - export { offsetrange_1 as offsetrange }; - let falloff_1: string; - export { falloff_1 as falloff }; - let falloffcontrast_1: string; - export { falloffcontrast_1 as falloffcontrast }; - let lumacoeffs_1: string; - export { lumacoeffs_1 as lumacoeffs }; - } - export { inputs_108 as inputs }; - export namespace outputs_108 { - let out_99: string; - export { out_99 as out }; - } - export { outputs_108 as outputs }; - } - namespace ND_triplanarprojection_float { - let node_109: string; - export { node_109 as node }; - let inherit_109: null; - export { inherit_109 as inherit }; - export namespace inputs_109 { - export let filex: string; - export let filey: string; - export let filez: string; - export let layerx: string; - export let layery: string; - export let layerz: string; - let _default_23: string; - export { _default_23 as default }; - export let position: string; - let normal_15: string; - export { normal_15 as normal }; - export let upaxis: string; - export let blend: string; - let filtertype_20: string; - export { filtertype_20 as filtertype }; - let framerange_12: string; - export { framerange_12 as framerange }; - let frameoffset_12: string; - export { frameoffset_12 as frameoffset }; - let frameendaction_12: string; - export { frameendaction_12 as frameendaction }; - } - export { inputs_109 as inputs }; - export namespace outputs_109 { - let out_100: string; - export { out_100 as out }; - } - export { outputs_109 as outputs }; - } - namespace ND_triplanarprojection_color3 { - let node_110: string; - export { node_110 as node }; - let inherit_110: null; - export { inherit_110 as inherit }; - export namespace inputs_110 { - let filex_1: string; - export { filex_1 as filex }; - let filey_1: string; - export { filey_1 as filey }; - let filez_1: string; - export { filez_1 as filez }; - let layerx_1: string; - export { layerx_1 as layerx }; - let layery_1: string; - export { layery_1 as layery }; - let layerz_1: string; - export { layerz_1 as layerz }; - let _default_24: string; - export { _default_24 as default }; - let position_1: string; - export { position_1 as position }; - let normal_16: string; - export { normal_16 as normal }; - let upaxis_1: string; - export { upaxis_1 as upaxis }; - let blend_1: string; - export { blend_1 as blend }; - let filtertype_21: string; - export { filtertype_21 as filtertype }; - let framerange_13: string; - export { framerange_13 as framerange }; - let frameoffset_13: string; - export { frameoffset_13 as frameoffset }; - let frameendaction_13: string; - export { frameendaction_13 as frameendaction }; - } - export { inputs_110 as inputs }; - export namespace outputs_110 { - let out_101: string; - export { out_101 as out }; - } - export { outputs_110 as outputs }; - } - namespace ND_triplanarprojection_color4 { - let node_111: string; - export { node_111 as node }; - let inherit_111: null; - export { inherit_111 as inherit }; - export namespace inputs_111 { - let filex_2: string; - export { filex_2 as filex }; - let filey_2: string; - export { filey_2 as filey }; - let filez_2: string; - export { filez_2 as filez }; - let layerx_2: string; - export { layerx_2 as layerx }; - let layery_2: string; - export { layery_2 as layery }; - let layerz_2: string; - export { layerz_2 as layerz }; - let _default_25: string; - export { _default_25 as default }; - let position_2: string; - export { position_2 as position }; - let normal_17: string; - export { normal_17 as normal }; - let upaxis_2: string; - export { upaxis_2 as upaxis }; - let blend_2: string; - export { blend_2 as blend }; - let filtertype_22: string; - export { filtertype_22 as filtertype }; - let framerange_14: string; - export { framerange_14 as framerange }; - let frameoffset_14: string; - export { frameoffset_14 as frameoffset }; - let frameendaction_14: string; - export { frameendaction_14 as frameendaction }; - } - export { inputs_111 as inputs }; - export namespace outputs_111 { - let out_102: string; - export { out_102 as out }; - } - export { outputs_111 as outputs }; - } - namespace ND_triplanarprojection_vector2 { - let node_112: string; - export { node_112 as node }; - let inherit_112: null; - export { inherit_112 as inherit }; - export namespace inputs_112 { - let filex_3: string; - export { filex_3 as filex }; - let filey_3: string; - export { filey_3 as filey }; - let filez_3: string; - export { filez_3 as filez }; - let layerx_3: string; - export { layerx_3 as layerx }; - let layery_3: string; - export { layery_3 as layery }; - let layerz_3: string; - export { layerz_3 as layerz }; - let _default_26: string; - export { _default_26 as default }; - let position_3: string; - export { position_3 as position }; - let normal_18: string; - export { normal_18 as normal }; - let upaxis_3: string; - export { upaxis_3 as upaxis }; - let blend_3: string; - export { blend_3 as blend }; - let filtertype_23: string; - export { filtertype_23 as filtertype }; - let framerange_15: string; - export { framerange_15 as framerange }; - let frameoffset_15: string; - export { frameoffset_15 as frameoffset }; - let frameendaction_15: string; - export { frameendaction_15 as frameendaction }; - } - export { inputs_112 as inputs }; - export namespace outputs_112 { - let out_103: string; - export { out_103 as out }; - } - export { outputs_112 as outputs }; - } - namespace ND_triplanarprojection_vector3 { - let node_113: string; - export { node_113 as node }; - let inherit_113: null; - export { inherit_113 as inherit }; - export namespace inputs_113 { - let filex_4: string; - export { filex_4 as filex }; - let filey_4: string; - export { filey_4 as filey }; - let filez_4: string; - export { filez_4 as filez }; - let layerx_4: string; - export { layerx_4 as layerx }; - let layery_4: string; - export { layery_4 as layery }; - let layerz_4: string; - export { layerz_4 as layerz }; - let _default_27: string; - export { _default_27 as default }; - let position_4: string; - export { position_4 as position }; - let normal_19: string; - export { normal_19 as normal }; - let upaxis_4: string; - export { upaxis_4 as upaxis }; - let blend_4: string; - export { blend_4 as blend }; - let filtertype_24: string; - export { filtertype_24 as filtertype }; - let framerange_16: string; - export { framerange_16 as framerange }; - let frameoffset_16: string; - export { frameoffset_16 as frameoffset }; - let frameendaction_16: string; - export { frameendaction_16 as frameendaction }; - } - export { inputs_113 as inputs }; - export namespace outputs_113 { - let out_104: string; - export { out_104 as out }; - } - export { outputs_113 as outputs }; - } - namespace ND_triplanarprojection_vector4 { - let node_114: string; - export { node_114 as node }; - let inherit_114: null; - export { inherit_114 as inherit }; - export namespace inputs_114 { - let filex_5: string; - export { filex_5 as filex }; - let filey_5: string; - export { filey_5 as filey }; - let filez_5: string; - export { filez_5 as filez }; - let layerx_5: string; - export { layerx_5 as layerx }; - let layery_5: string; - export { layery_5 as layery }; - let layerz_5: string; - export { layerz_5 as layerz }; - let _default_28: string; - export { _default_28 as default }; - let position_5: string; - export { position_5 as position }; - let normal_20: string; - export { normal_20 as normal }; - let upaxis_5: string; - export { upaxis_5 as upaxis }; - let blend_5: string; - export { blend_5 as blend }; - let filtertype_25: string; - export { filtertype_25 as filtertype }; - let framerange_17: string; - export { framerange_17 as framerange }; - let frameoffset_17: string; - export { frameoffset_17 as frameoffset }; - let frameendaction_17: string; - export { frameendaction_17 as frameendaction }; - } - export { inputs_114 as inputs }; - export namespace outputs_114 { - let out_105: string; - export { out_105 as out }; - } - export { outputs_114 as outputs }; - } - namespace ND_constant_float { - let node_115: string; - export { node_115 as node }; - let inherit_115: null; - export { inherit_115 as inherit }; - export namespace inputs_115 { - let value: string; - } - export { inputs_115 as inputs }; - export namespace outputs_115 { - let out_106: string; - export { out_106 as out }; - } - export { outputs_115 as outputs }; - } - namespace ND_constant_color3 { - let node_116: string; - export { node_116 as node }; - let inherit_116: null; - export { inherit_116 as inherit }; - export namespace inputs_116 { - let value_1: string; - export { value_1 as value }; - } - export { inputs_116 as inputs }; - export namespace outputs_116 { - let out_107: string; - export { out_107 as out }; - } - export { outputs_116 as outputs }; - } - namespace ND_constant_color4 { - let node_117: string; - export { node_117 as node }; - let inherit_117: null; - export { inherit_117 as inherit }; - export namespace inputs_117 { - let value_2: string; - export { value_2 as value }; - } - export { inputs_117 as inputs }; - export namespace outputs_117 { - let out_108: string; - export { out_108 as out }; - } - export { outputs_117 as outputs }; - } - namespace ND_constant_vector2 { - let node_118: string; - export { node_118 as node }; - let inherit_118: null; - export { inherit_118 as inherit }; - export namespace inputs_118 { - let value_3: string; - export { value_3 as value }; - } - export { inputs_118 as inputs }; - export namespace outputs_118 { - let out_109: string; - export { out_109 as out }; - } - export { outputs_118 as outputs }; - } - namespace ND_constant_vector3 { - let node_119: string; - export { node_119 as node }; - let inherit_119: null; - export { inherit_119 as inherit }; - export namespace inputs_119 { - let value_4: string; - export { value_4 as value }; - } - export { inputs_119 as inputs }; - export namespace outputs_119 { - let out_110: string; - export { out_110 as out }; - } - export { outputs_119 as outputs }; - } - namespace ND_constant_vector4 { - let node_120: string; - export { node_120 as node }; - let inherit_120: null; - export { inherit_120 as inherit }; - export namespace inputs_120 { - let value_5: string; - export { value_5 as value }; - } - export { inputs_120 as inputs }; - export namespace outputs_120 { - let out_111: string; - export { out_111 as out }; - } - export { outputs_120 as outputs }; - } - namespace ND_constant_boolean { - let node_121: string; - export { node_121 as node }; - let inherit_121: null; - export { inherit_121 as inherit }; - export namespace inputs_121 { - let value_6: string; - export { value_6 as value }; - } - export { inputs_121 as inputs }; - export namespace outputs_121 { - let out_112: string; - export { out_112 as out }; - } - export { outputs_121 as outputs }; - } - namespace ND_constant_integer { - let node_122: string; - export { node_122 as node }; - let inherit_122: null; - export { inherit_122 as inherit }; - export namespace inputs_122 { - let value_7: string; - export { value_7 as value }; - } - export { inputs_122 as inputs }; - export namespace outputs_122 { - let out_113: string; - export { out_113 as out }; - } - export { outputs_122 as outputs }; - } - namespace ND_constant_matrix33 { - let node_123: string; - export { node_123 as node }; - let inherit_123: null; - export { inherit_123 as inherit }; - export namespace inputs_123 { - let value_8: string; - export { value_8 as value }; - } - export { inputs_123 as inputs }; - export namespace outputs_123 { - let out_114: string; - export { out_114 as out }; - } - export { outputs_123 as outputs }; - } - namespace ND_constant_matrix44 { - let node_124: string; - export { node_124 as node }; - let inherit_124: null; - export { inherit_124 as inherit }; - export namespace inputs_124 { - let value_9: string; - export { value_9 as value }; - } - export { inputs_124 as inputs }; - export namespace outputs_124 { - let out_115: string; - export { out_115 as out }; - } - export { outputs_124 as outputs }; - } - namespace ND_constant_string { - let node_125: string; - export { node_125 as node }; - let inherit_125: null; - export { inherit_125 as inherit }; - export namespace inputs_125 { - let value_10: string; - export { value_10 as value }; - } - export { inputs_125 as inputs }; - export namespace outputs_125 { - let out_116: string; - export { out_116 as out }; - } - export { outputs_125 as outputs }; - } - namespace ND_constant_filename { - let node_126: string; - export { node_126 as node }; - let inherit_126: null; - export { inherit_126 as inherit }; - export namespace inputs_126 { - let value_11: string; - export { value_11 as value }; - } - export { inputs_126 as inputs }; - export namespace outputs_126 { - let out_117: string; - export { out_117 as out }; - } - export { outputs_126 as outputs }; - } - namespace ND_ramp { - let node_127: string; - export { node_127 as node }; - let inherit_127: null; - export { inherit_127 as inherit }; - export namespace inputs_127 { - let texcoord_22: string; - export { texcoord_22 as texcoord }; - export let type: string; - export let interpolation: string; - export let num_intervals: string; - export let interval1: string; - export let color1: string; - export let interval2: string; - export let color2: string; - export let interval3: string; - export let color3: string; - export let interval4: string; - export let color4: string; - export let interval5: string; - export let color5: string; - export let interval6: string; - export let color6: string; - export let interval7: string; - export let color7: string; - export let interval8: string; - export let color8: string; - export let interval9: string; - export let color9: string; - export let interval10: string; - export let color10: string; - } - export { inputs_127 as inputs }; - export namespace outputs_127 { - let out_118: string; - export { out_118 as out }; - } - export { outputs_127 as outputs }; - } - namespace ND_ramp_gradient { - let node_128: string; - export { node_128 as node }; - let inherit_128: null; - export { inherit_128 as inherit }; - export namespace inputs_128 { - export let x: string; - let interval1_1: string; - export { interval1_1 as interval1 }; - let interval2_1: string; - export { interval2_1 as interval2 }; - let color1_1: string; - export { color1_1 as color1 }; - let color2_1: string; - export { color2_1 as color2 }; - let interpolation_1: string; - export { interpolation_1 as interpolation }; - export let prev_color: string; - export let interval_num: string; - let num_intervals_1: string; - export { num_intervals_1 as num_intervals }; - } - export { inputs_128 as inputs }; - export namespace outputs_128 { - let out_119: string; - export { out_119 as out }; - } - export { outputs_128 as outputs }; - } - namespace ND_ramplr_float { - let node_129: string; - export { node_129 as node }; - let inherit_129: null; - export { inherit_129 as inherit }; - export namespace inputs_129 { - export let valuel: string; - export let valuer: string; - let texcoord_23: string; - export { texcoord_23 as texcoord }; - } - export { inputs_129 as inputs }; - export namespace outputs_129 { - let out_120: string; - export { out_120 as out }; - } - export { outputs_129 as outputs }; - } - namespace ND_ramplr_color3 { - let node_130: string; - export { node_130 as node }; - let inherit_130: null; - export { inherit_130 as inherit }; - export namespace inputs_130 { - let valuel_1: string; - export { valuel_1 as valuel }; - let valuer_1: string; - export { valuer_1 as valuer }; - let texcoord_24: string; - export { texcoord_24 as texcoord }; - } - export { inputs_130 as inputs }; - export namespace outputs_130 { - let out_121: string; - export { out_121 as out }; - } - export { outputs_130 as outputs }; - } - namespace ND_ramplr_color4 { - let node_131: string; - export { node_131 as node }; - let inherit_131: null; - export { inherit_131 as inherit }; - export namespace inputs_131 { - let valuel_2: string; - export { valuel_2 as valuel }; - let valuer_2: string; - export { valuer_2 as valuer }; - let texcoord_25: string; - export { texcoord_25 as texcoord }; - } - export { inputs_131 as inputs }; - export namespace outputs_131 { - let out_122: string; - export { out_122 as out }; - } - export { outputs_131 as outputs }; - } - namespace ND_ramplr_vector2 { - let node_132: string; - export { node_132 as node }; - let inherit_132: null; - export { inherit_132 as inherit }; - export namespace inputs_132 { - let valuel_3: string; - export { valuel_3 as valuel }; - let valuer_3: string; - export { valuer_3 as valuer }; - let texcoord_26: string; - export { texcoord_26 as texcoord }; - } - export { inputs_132 as inputs }; - export namespace outputs_132 { - let out_123: string; - export { out_123 as out }; - } - export { outputs_132 as outputs }; - } - namespace ND_ramplr_vector3 { - let node_133: string; - export { node_133 as node }; - let inherit_133: null; - export { inherit_133 as inherit }; - export namespace inputs_133 { - let valuel_4: string; - export { valuel_4 as valuel }; - let valuer_4: string; - export { valuer_4 as valuer }; - let texcoord_27: string; - export { texcoord_27 as texcoord }; - } - export { inputs_133 as inputs }; - export namespace outputs_133 { - let out_124: string; - export { out_124 as out }; - } - export { outputs_133 as outputs }; - } - namespace ND_ramplr_vector4 { - let node_134: string; - export { node_134 as node }; - let inherit_134: null; - export { inherit_134 as inherit }; - export namespace inputs_134 { - let valuel_5: string; - export { valuel_5 as valuel }; - let valuer_5: string; - export { valuer_5 as valuer }; - let texcoord_28: string; - export { texcoord_28 as texcoord }; - } - export { inputs_134 as inputs }; - export namespace outputs_134 { - let out_125: string; - export { out_125 as out }; - } - export { outputs_134 as outputs }; - } - namespace ND_ramptb_float { - let node_135: string; - export { node_135 as node }; - let inherit_135: null; - export { inherit_135 as inherit }; - export namespace inputs_135 { - export let valuet: string; - export let valueb: string; - let texcoord_29: string; - export { texcoord_29 as texcoord }; - } - export { inputs_135 as inputs }; - export namespace outputs_135 { - let out_126: string; - export { out_126 as out }; - } - export { outputs_135 as outputs }; - } - namespace ND_ramptb_color3 { - let node_136: string; - export { node_136 as node }; - let inherit_136: null; - export { inherit_136 as inherit }; - export namespace inputs_136 { - let valuet_1: string; - export { valuet_1 as valuet }; - let valueb_1: string; - export { valueb_1 as valueb }; - let texcoord_30: string; - export { texcoord_30 as texcoord }; - } - export { inputs_136 as inputs }; - export namespace outputs_136 { - let out_127: string; - export { out_127 as out }; - } - export { outputs_136 as outputs }; - } - namespace ND_ramptb_color4 { - let node_137: string; - export { node_137 as node }; - let inherit_137: null; - export { inherit_137 as inherit }; - export namespace inputs_137 { - let valuet_2: string; - export { valuet_2 as valuet }; - let valueb_2: string; - export { valueb_2 as valueb }; - let texcoord_31: string; - export { texcoord_31 as texcoord }; - } - export { inputs_137 as inputs }; - export namespace outputs_137 { - let out_128: string; - export { out_128 as out }; - } - export { outputs_137 as outputs }; - } - namespace ND_ramptb_vector2 { - let node_138: string; - export { node_138 as node }; - let inherit_138: null; - export { inherit_138 as inherit }; - export namespace inputs_138 { - let valuet_3: string; - export { valuet_3 as valuet }; - let valueb_3: string; - export { valueb_3 as valueb }; - let texcoord_32: string; - export { texcoord_32 as texcoord }; - } - export { inputs_138 as inputs }; - export namespace outputs_138 { - let out_129: string; - export { out_129 as out }; - } - export { outputs_138 as outputs }; - } - namespace ND_ramptb_vector3 { - let node_139: string; - export { node_139 as node }; - let inherit_139: null; - export { inherit_139 as inherit }; - export namespace inputs_139 { - let valuet_4: string; - export { valuet_4 as valuet }; - let valueb_4: string; - export { valueb_4 as valueb }; - let texcoord_33: string; - export { texcoord_33 as texcoord }; - } - export { inputs_139 as inputs }; - export namespace outputs_139 { - let out_130: string; - export { out_130 as out }; - } - export { outputs_139 as outputs }; - } - namespace ND_ramptb_vector4 { - let node_140: string; - export { node_140 as node }; - let inherit_140: null; - export { inherit_140 as inherit }; - export namespace inputs_140 { - let valuet_5: string; - export { valuet_5 as valuet }; - let valueb_5: string; - export { valueb_5 as valueb }; - let texcoord_34: string; - export { texcoord_34 as texcoord }; - } - export { inputs_140 as inputs }; - export namespace outputs_140 { - let out_131: string; - export { out_131 as out }; - } - export { outputs_140 as outputs }; - } - namespace ND_ramp4_float { - let node_141: string; - export { node_141 as node }; - let inherit_141: null; - export { inherit_141 as inherit }; - export namespace inputs_141 { - export let valuetl: string; - export let valuetr: string; - export let valuebl: string; - export let valuebr: string; - let texcoord_35: string; - export { texcoord_35 as texcoord }; - } - export { inputs_141 as inputs }; - export namespace outputs_141 { - let out_132: string; - export { out_132 as out }; - } - export { outputs_141 as outputs }; - } - namespace ND_ramp4_color3 { - let node_142: string; - export { node_142 as node }; - let inherit_142: null; - export { inherit_142 as inherit }; - export namespace inputs_142 { - let valuetl_1: string; - export { valuetl_1 as valuetl }; - let valuetr_1: string; - export { valuetr_1 as valuetr }; - let valuebl_1: string; - export { valuebl_1 as valuebl }; - let valuebr_1: string; - export { valuebr_1 as valuebr }; - let texcoord_36: string; - export { texcoord_36 as texcoord }; - } - export { inputs_142 as inputs }; - export namespace outputs_142 { - let out_133: string; - export { out_133 as out }; - } - export { outputs_142 as outputs }; - } - namespace ND_ramp4_color4 { - let node_143: string; - export { node_143 as node }; - let inherit_143: null; - export { inherit_143 as inherit }; - export namespace inputs_143 { - let valuetl_2: string; - export { valuetl_2 as valuetl }; - let valuetr_2: string; - export { valuetr_2 as valuetr }; - let valuebl_2: string; - export { valuebl_2 as valuebl }; - let valuebr_2: string; - export { valuebr_2 as valuebr }; - let texcoord_37: string; - export { texcoord_37 as texcoord }; - } - export { inputs_143 as inputs }; - export namespace outputs_143 { - let out_134: string; - export { out_134 as out }; - } - export { outputs_143 as outputs }; - } - namespace ND_ramp4_vector2 { - let node_144: string; - export { node_144 as node }; - let inherit_144: null; - export { inherit_144 as inherit }; - export namespace inputs_144 { - let valuetl_3: string; - export { valuetl_3 as valuetl }; - let valuetr_3: string; - export { valuetr_3 as valuetr }; - let valuebl_3: string; - export { valuebl_3 as valuebl }; - let valuebr_3: string; - export { valuebr_3 as valuebr }; - let texcoord_38: string; - export { texcoord_38 as texcoord }; - } - export { inputs_144 as inputs }; - export namespace outputs_144 { - let out_135: string; - export { out_135 as out }; - } - export { outputs_144 as outputs }; - } - namespace ND_ramp4_vector3 { - let node_145: string; - export { node_145 as node }; - let inherit_145: null; - export { inherit_145 as inherit }; - export namespace inputs_145 { - let valuetl_4: string; - export { valuetl_4 as valuetl }; - let valuetr_4: string; - export { valuetr_4 as valuetr }; - let valuebl_4: string; - export { valuebl_4 as valuebl }; - let valuebr_4: string; - export { valuebr_4 as valuebr }; - let texcoord_39: string; - export { texcoord_39 as texcoord }; - } - export { inputs_145 as inputs }; - export namespace outputs_145 { - let out_136: string; - export { out_136 as out }; - } - export { outputs_145 as outputs }; - } - namespace ND_ramp4_vector4 { - let node_146: string; - export { node_146 as node }; - let inherit_146: null; - export { inherit_146 as inherit }; - export namespace inputs_146 { - let valuetl_5: string; - export { valuetl_5 as valuetl }; - let valuetr_5: string; - export { valuetr_5 as valuetr }; - let valuebl_5: string; - export { valuebl_5 as valuebl }; - let valuebr_5: string; - export { valuebr_5 as valuebr }; - let texcoord_40: string; - export { texcoord_40 as texcoord }; - } - export { inputs_146 as inputs }; - export namespace outputs_146 { - let out_137: string; - export { out_137 as out }; - } - export { outputs_146 as outputs }; - } - namespace ND_splitlr_float { - let node_147: string; - export { node_147 as node }; - let inherit_147: null; - export { inherit_147 as inherit }; - export namespace inputs_147 { - let valuel_6: string; - export { valuel_6 as valuel }; - let valuer_6: string; - export { valuer_6 as valuer }; - export let center: string; - let texcoord_41: string; - export { texcoord_41 as texcoord }; - } - export { inputs_147 as inputs }; - export namespace outputs_147 { - let out_138: string; - export { out_138 as out }; - } - export { outputs_147 as outputs }; - } - namespace ND_splitlr_color3 { - let node_148: string; - export { node_148 as node }; - let inherit_148: null; - export { inherit_148 as inherit }; - export namespace inputs_148 { - let valuel_7: string; - export { valuel_7 as valuel }; - let valuer_7: string; - export { valuer_7 as valuer }; - let center_1: string; - export { center_1 as center }; - let texcoord_42: string; - export { texcoord_42 as texcoord }; - } - export { inputs_148 as inputs }; - export namespace outputs_148 { - let out_139: string; - export { out_139 as out }; - } - export { outputs_148 as outputs }; - } - namespace ND_splitlr_color4 { - let node_149: string; - export { node_149 as node }; - let inherit_149: null; - export { inherit_149 as inherit }; - export namespace inputs_149 { - let valuel_8: string; - export { valuel_8 as valuel }; - let valuer_8: string; - export { valuer_8 as valuer }; - let center_2: string; - export { center_2 as center }; - let texcoord_43: string; - export { texcoord_43 as texcoord }; - } - export { inputs_149 as inputs }; - export namespace outputs_149 { - let out_140: string; - export { out_140 as out }; - } - export { outputs_149 as outputs }; - } - namespace ND_splitlr_vector2 { - let node_150: string; - export { node_150 as node }; - let inherit_150: null; - export { inherit_150 as inherit }; - export namespace inputs_150 { - let valuel_9: string; - export { valuel_9 as valuel }; - let valuer_9: string; - export { valuer_9 as valuer }; - let center_3: string; - export { center_3 as center }; - let texcoord_44: string; - export { texcoord_44 as texcoord }; - } - export { inputs_150 as inputs }; - export namespace outputs_150 { - let out_141: string; - export { out_141 as out }; - } - export { outputs_150 as outputs }; - } - namespace ND_splitlr_vector3 { - let node_151: string; - export { node_151 as node }; - let inherit_151: null; - export { inherit_151 as inherit }; - export namespace inputs_151 { - let valuel_10: string; - export { valuel_10 as valuel }; - let valuer_10: string; - export { valuer_10 as valuer }; - let center_4: string; - export { center_4 as center }; - let texcoord_45: string; - export { texcoord_45 as texcoord }; - } - export { inputs_151 as inputs }; - export namespace outputs_151 { - let out_142: string; - export { out_142 as out }; - } - export { outputs_151 as outputs }; - } - namespace ND_splitlr_vector4 { - let node_152: string; - export { node_152 as node }; - let inherit_152: null; - export { inherit_152 as inherit }; - export namespace inputs_152 { - let valuel_11: string; - export { valuel_11 as valuel }; - let valuer_11: string; - export { valuer_11 as valuer }; - let center_5: string; - export { center_5 as center }; - let texcoord_46: string; - export { texcoord_46 as texcoord }; - } - export { inputs_152 as inputs }; - export namespace outputs_152 { - let out_143: string; - export { out_143 as out }; - } - export { outputs_152 as outputs }; - } - namespace ND_splittb_float { - let node_153: string; - export { node_153 as node }; - let inherit_153: null; - export { inherit_153 as inherit }; - export namespace inputs_153 { - let valuet_6: string; - export { valuet_6 as valuet }; - let valueb_6: string; - export { valueb_6 as valueb }; - let center_6: string; - export { center_6 as center }; - let texcoord_47: string; - export { texcoord_47 as texcoord }; - } - export { inputs_153 as inputs }; - export namespace outputs_153 { - let out_144: string; - export { out_144 as out }; - } - export { outputs_153 as outputs }; - } - namespace ND_splittb_color3 { - let node_154: string; - export { node_154 as node }; - let inherit_154: null; - export { inherit_154 as inherit }; - export namespace inputs_154 { - let valuet_7: string; - export { valuet_7 as valuet }; - let valueb_7: string; - export { valueb_7 as valueb }; - let center_7: string; - export { center_7 as center }; - let texcoord_48: string; - export { texcoord_48 as texcoord }; - } - export { inputs_154 as inputs }; - export namespace outputs_154 { - let out_145: string; - export { out_145 as out }; - } - export { outputs_154 as outputs }; - } - namespace ND_splittb_color4 { - let node_155: string; - export { node_155 as node }; - let inherit_155: null; - export { inherit_155 as inherit }; - export namespace inputs_155 { - let valuet_8: string; - export { valuet_8 as valuet }; - let valueb_8: string; - export { valueb_8 as valueb }; - let center_8: string; - export { center_8 as center }; - let texcoord_49: string; - export { texcoord_49 as texcoord }; - } - export { inputs_155 as inputs }; - export namespace outputs_155 { - let out_146: string; - export { out_146 as out }; - } - export { outputs_155 as outputs }; - } - namespace ND_splittb_vector2 { - let node_156: string; - export { node_156 as node }; - let inherit_156: null; - export { inherit_156 as inherit }; - export namespace inputs_156 { - let valuet_9: string; - export { valuet_9 as valuet }; - let valueb_9: string; - export { valueb_9 as valueb }; - let center_9: string; - export { center_9 as center }; - let texcoord_50: string; - export { texcoord_50 as texcoord }; - } - export { inputs_156 as inputs }; - export namespace outputs_156 { - let out_147: string; - export { out_147 as out }; - } - export { outputs_156 as outputs }; - } - namespace ND_splittb_vector3 { - let node_157: string; - export { node_157 as node }; - let inherit_157: null; - export { inherit_157 as inherit }; - export namespace inputs_157 { - let valuet_10: string; - export { valuet_10 as valuet }; - let valueb_10: string; - export { valueb_10 as valueb }; - let center_10: string; - export { center_10 as center }; - let texcoord_51: string; - export { texcoord_51 as texcoord }; - } - export { inputs_157 as inputs }; - export namespace outputs_157 { - let out_148: string; - export { out_148 as out }; - } - export { outputs_157 as outputs }; - } - namespace ND_splittb_vector4 { - let node_158: string; - export { node_158 as node }; - let inherit_158: null; - export { inherit_158 as inherit }; - export namespace inputs_158 { - let valuet_11: string; - export { valuet_11 as valuet }; - let valueb_11: string; - export { valueb_11 as valueb }; - let center_11: string; - export { center_11 as center }; - let texcoord_52: string; - export { texcoord_52 as texcoord }; - } - export { inputs_158 as inputs }; - export namespace outputs_158 { - let out_149: string; - export { out_149 as out }; - } - export { outputs_158 as outputs }; - } - namespace ND_noise2d_float { - let node_159: string; - export { node_159 as node }; - let inherit_159: null; - export { inherit_159 as inherit }; - export namespace inputs_159 { - export let amplitude: string; - let pivot_8: string; - export { pivot_8 as pivot }; - let texcoord_53: string; - export { texcoord_53 as texcoord }; - } - export { inputs_159 as inputs }; - export namespace outputs_159 { - let out_150: string; - export { out_150 as out }; - } - export { outputs_159 as outputs }; - } - namespace ND_noise2d_color3 { - let node_160: string; - export { node_160 as node }; - let inherit_160: null; - export { inherit_160 as inherit }; - export namespace inputs_160 { - let amplitude_1: string; - export { amplitude_1 as amplitude }; - let pivot_9: string; - export { pivot_9 as pivot }; - let texcoord_54: string; - export { texcoord_54 as texcoord }; - } - export { inputs_160 as inputs }; - export namespace outputs_160 { - let out_151: string; - export { out_151 as out }; - } - export { outputs_160 as outputs }; - } - namespace ND_noise2d_color4 { - let node_161: string; - export { node_161 as node }; - let inherit_161: null; - export { inherit_161 as inherit }; - export namespace inputs_161 { - let amplitude_2: string; - export { amplitude_2 as amplitude }; - let pivot_10: string; - export { pivot_10 as pivot }; - let texcoord_55: string; - export { texcoord_55 as texcoord }; - } - export { inputs_161 as inputs }; - export namespace outputs_161 { - let out_152: string; - export { out_152 as out }; - } - export { outputs_161 as outputs }; - } - namespace ND_noise2d_vector2 { - let node_162: string; - export { node_162 as node }; - let inherit_162: null; - export { inherit_162 as inherit }; - export namespace inputs_162 { - let amplitude_3: string; - export { amplitude_3 as amplitude }; - let pivot_11: string; - export { pivot_11 as pivot }; - let texcoord_56: string; - export { texcoord_56 as texcoord }; - } - export { inputs_162 as inputs }; - export namespace outputs_162 { - let out_153: string; - export { out_153 as out }; - } - export { outputs_162 as outputs }; - } - namespace ND_noise2d_vector3 { - let node_163: string; - export { node_163 as node }; - let inherit_163: null; - export { inherit_163 as inherit }; - export namespace inputs_163 { - let amplitude_4: string; - export { amplitude_4 as amplitude }; - let pivot_12: string; - export { pivot_12 as pivot }; - let texcoord_57: string; - export { texcoord_57 as texcoord }; - } - export { inputs_163 as inputs }; - export namespace outputs_163 { - let out_154: string; - export { out_154 as out }; - } - export { outputs_163 as outputs }; - } - namespace ND_noise2d_vector4 { - let node_164: string; - export { node_164 as node }; - let inherit_164: null; - export { inherit_164 as inherit }; - export namespace inputs_164 { - let amplitude_5: string; - export { amplitude_5 as amplitude }; - let pivot_13: string; - export { pivot_13 as pivot }; - let texcoord_58: string; - export { texcoord_58 as texcoord }; - } - export { inputs_164 as inputs }; - export namespace outputs_164 { - let out_155: string; - export { out_155 as out }; - } - export { outputs_164 as outputs }; - } - namespace ND_noise2d_color3FA { - let node_165: string; - export { node_165 as node }; - let inherit_165: null; - export { inherit_165 as inherit }; - export namespace inputs_165 { - let amplitude_6: string; - export { amplitude_6 as amplitude }; - let pivot_14: string; - export { pivot_14 as pivot }; - let texcoord_59: string; - export { texcoord_59 as texcoord }; - } - export { inputs_165 as inputs }; - export namespace outputs_165 { - let out_156: string; - export { out_156 as out }; - } - export { outputs_165 as outputs }; - } - namespace ND_noise2d_color4FA { - let node_166: string; - export { node_166 as node }; - let inherit_166: null; - export { inherit_166 as inherit }; - export namespace inputs_166 { - let amplitude_7: string; - export { amplitude_7 as amplitude }; - let pivot_15: string; - export { pivot_15 as pivot }; - let texcoord_60: string; - export { texcoord_60 as texcoord }; - } - export { inputs_166 as inputs }; - export namespace outputs_166 { - let out_157: string; - export { out_157 as out }; - } - export { outputs_166 as outputs }; - } - namespace ND_noise2d_vector2FA { - let node_167: string; - export { node_167 as node }; - let inherit_167: null; - export { inherit_167 as inherit }; - export namespace inputs_167 { - let amplitude_8: string; - export { amplitude_8 as amplitude }; - let pivot_16: string; - export { pivot_16 as pivot }; - let texcoord_61: string; - export { texcoord_61 as texcoord }; - } - export { inputs_167 as inputs }; - export namespace outputs_167 { - let out_158: string; - export { out_158 as out }; - } - export { outputs_167 as outputs }; - } - namespace ND_noise2d_vector3FA { - let node_168: string; - export { node_168 as node }; - let inherit_168: null; - export { inherit_168 as inherit }; - export namespace inputs_168 { - let amplitude_9: string; - export { amplitude_9 as amplitude }; - let pivot_17: string; - export { pivot_17 as pivot }; - let texcoord_62: string; - export { texcoord_62 as texcoord }; - } - export { inputs_168 as inputs }; - export namespace outputs_168 { - let out_159: string; - export { out_159 as out }; - } - export { outputs_168 as outputs }; - } - namespace ND_noise2d_vector4FA { - let node_169: string; - export { node_169 as node }; - let inherit_169: null; - export { inherit_169 as inherit }; - export namespace inputs_169 { - let amplitude_10: string; - export { amplitude_10 as amplitude }; - let pivot_18: string; - export { pivot_18 as pivot }; - let texcoord_63: string; - export { texcoord_63 as texcoord }; - } - export { inputs_169 as inputs }; - export namespace outputs_169 { - let out_160: string; - export { out_160 as out }; - } - export { outputs_169 as outputs }; - } - namespace ND_noise3d_float { - let node_170: string; - export { node_170 as node }; - let inherit_170: null; - export { inherit_170 as inherit }; - export namespace inputs_170 { - let amplitude_11: string; - export { amplitude_11 as amplitude }; - let pivot_19: string; - export { pivot_19 as pivot }; - let position_6: string; - export { position_6 as position }; - } - export { inputs_170 as inputs }; - export namespace outputs_170 { - let out_161: string; - export { out_161 as out }; - } - export { outputs_170 as outputs }; - } - namespace ND_noise3d_color3 { - let node_171: string; - export { node_171 as node }; - let inherit_171: null; - export { inherit_171 as inherit }; - export namespace inputs_171 { - let amplitude_12: string; - export { amplitude_12 as amplitude }; - let pivot_20: string; - export { pivot_20 as pivot }; - let position_7: string; - export { position_7 as position }; - } - export { inputs_171 as inputs }; - export namespace outputs_171 { - let out_162: string; - export { out_162 as out }; - } - export { outputs_171 as outputs }; - } - namespace ND_noise3d_color4 { - let node_172: string; - export { node_172 as node }; - let inherit_172: null; - export { inherit_172 as inherit }; - export namespace inputs_172 { - let amplitude_13: string; - export { amplitude_13 as amplitude }; - let pivot_21: string; - export { pivot_21 as pivot }; - let position_8: string; - export { position_8 as position }; - } - export { inputs_172 as inputs }; - export namespace outputs_172 { - let out_163: string; - export { out_163 as out }; - } - export { outputs_172 as outputs }; - } - namespace ND_noise3d_vector2 { - let node_173: string; - export { node_173 as node }; - let inherit_173: null; - export { inherit_173 as inherit }; - export namespace inputs_173 { - let amplitude_14: string; - export { amplitude_14 as amplitude }; - let pivot_22: string; - export { pivot_22 as pivot }; - let position_9: string; - export { position_9 as position }; - } - export { inputs_173 as inputs }; - export namespace outputs_173 { - let out_164: string; - export { out_164 as out }; - } - export { outputs_173 as outputs }; - } - namespace ND_noise3d_vector3 { - let node_174: string; - export { node_174 as node }; - let inherit_174: null; - export { inherit_174 as inherit }; - export namespace inputs_174 { - let amplitude_15: string; - export { amplitude_15 as amplitude }; - let pivot_23: string; - export { pivot_23 as pivot }; - let position_10: string; - export { position_10 as position }; - } - export { inputs_174 as inputs }; - export namespace outputs_174 { - let out_165: string; - export { out_165 as out }; - } - export { outputs_174 as outputs }; - } - namespace ND_noise3d_vector4 { - let node_175: string; - export { node_175 as node }; - let inherit_175: null; - export { inherit_175 as inherit }; - export namespace inputs_175 { - let amplitude_16: string; - export { amplitude_16 as amplitude }; - let pivot_24: string; - export { pivot_24 as pivot }; - let position_11: string; - export { position_11 as position }; - } - export { inputs_175 as inputs }; - export namespace outputs_175 { - let out_166: string; - export { out_166 as out }; - } - export { outputs_175 as outputs }; - } - namespace ND_noise3d_color3FA { - let node_176: string; - export { node_176 as node }; - let inherit_176: null; - export { inherit_176 as inherit }; - export namespace inputs_176 { - let amplitude_17: string; - export { amplitude_17 as amplitude }; - let pivot_25: string; - export { pivot_25 as pivot }; - let position_12: string; - export { position_12 as position }; - } - export { inputs_176 as inputs }; - export namespace outputs_176 { - let out_167: string; - export { out_167 as out }; - } - export { outputs_176 as outputs }; - } - namespace ND_noise3d_color4FA { - let node_177: string; - export { node_177 as node }; - let inherit_177: null; - export { inherit_177 as inherit }; - export namespace inputs_177 { - let amplitude_18: string; - export { amplitude_18 as amplitude }; - let pivot_26: string; - export { pivot_26 as pivot }; - let position_13: string; - export { position_13 as position }; - } - export { inputs_177 as inputs }; - export namespace outputs_177 { - let out_168: string; - export { out_168 as out }; - } - export { outputs_177 as outputs }; - } - namespace ND_noise3d_vector2FA { - let node_178: string; - export { node_178 as node }; - let inherit_178: null; - export { inherit_178 as inherit }; - export namespace inputs_178 { - let amplitude_19: string; - export { amplitude_19 as amplitude }; - let pivot_27: string; - export { pivot_27 as pivot }; - let position_14: string; - export { position_14 as position }; - } - export { inputs_178 as inputs }; - export namespace outputs_178 { - let out_169: string; - export { out_169 as out }; - } - export { outputs_178 as outputs }; - } - namespace ND_noise3d_vector3FA { - let node_179: string; - export { node_179 as node }; - let inherit_179: null; - export { inherit_179 as inherit }; - export namespace inputs_179 { - let amplitude_20: string; - export { amplitude_20 as amplitude }; - let pivot_28: string; - export { pivot_28 as pivot }; - let position_15: string; - export { position_15 as position }; - } - export { inputs_179 as inputs }; - export namespace outputs_179 { - let out_170: string; - export { out_170 as out }; - } - export { outputs_179 as outputs }; - } - namespace ND_noise3d_vector4FA { - let node_180: string; - export { node_180 as node }; - let inherit_180: null; - export { inherit_180 as inherit }; - export namespace inputs_180 { - let amplitude_21: string; - export { amplitude_21 as amplitude }; - let pivot_29: string; - export { pivot_29 as pivot }; - let position_16: string; - export { position_16 as position }; - } - export { inputs_180 as inputs }; - export namespace outputs_180 { - let out_171: string; - export { out_171 as out }; - } - export { outputs_180 as outputs }; - } - namespace ND_fractal2d_float { - let node_181: string; - export { node_181 as node }; - let inherit_181: null; - export { inherit_181 as inherit }; - export namespace inputs_181 { - let amplitude_22: string; - export { amplitude_22 as amplitude }; - export let octaves: string; - export let lacunarity: string; - export let diminish: string; - let texcoord_64: string; - export { texcoord_64 as texcoord }; - } - export { inputs_181 as inputs }; - export namespace outputs_181 { - let out_172: string; - export { out_172 as out }; - } - export { outputs_181 as outputs }; - } - namespace ND_fractal2d_color3 { - let node_182: string; - export { node_182 as node }; - let inherit_182: null; - export { inherit_182 as inherit }; - export namespace inputs_182 { - let amplitude_23: string; - export { amplitude_23 as amplitude }; - let octaves_1: string; - export { octaves_1 as octaves }; - let lacunarity_1: string; - export { lacunarity_1 as lacunarity }; - let diminish_1: string; - export { diminish_1 as diminish }; - let texcoord_65: string; - export { texcoord_65 as texcoord }; - } - export { inputs_182 as inputs }; - export namespace outputs_182 { - let out_173: string; - export { out_173 as out }; - } - export { outputs_182 as outputs }; - } - namespace ND_fractal2d_color4 { - let node_183: string; - export { node_183 as node }; - let inherit_183: null; - export { inherit_183 as inherit }; - export namespace inputs_183 { - let amplitude_24: string; - export { amplitude_24 as amplitude }; - let octaves_2: string; - export { octaves_2 as octaves }; - let lacunarity_2: string; - export { lacunarity_2 as lacunarity }; - let diminish_2: string; - export { diminish_2 as diminish }; - let texcoord_66: string; - export { texcoord_66 as texcoord }; - } - export { inputs_183 as inputs }; - export namespace outputs_183 { - let out_174: string; - export { out_174 as out }; - } - export { outputs_183 as outputs }; - } - namespace ND_fractal2d_vector2 { - let node_184: string; - export { node_184 as node }; - let inherit_184: null; - export { inherit_184 as inherit }; - export namespace inputs_184 { - let amplitude_25: string; - export { amplitude_25 as amplitude }; - let octaves_3: string; - export { octaves_3 as octaves }; - let lacunarity_3: string; - export { lacunarity_3 as lacunarity }; - let diminish_3: string; - export { diminish_3 as diminish }; - let texcoord_67: string; - export { texcoord_67 as texcoord }; - } - export { inputs_184 as inputs }; - export namespace outputs_184 { - let out_175: string; - export { out_175 as out }; - } - export { outputs_184 as outputs }; - } - namespace ND_fractal2d_vector3 { - let node_185: string; - export { node_185 as node }; - let inherit_185: null; - export { inherit_185 as inherit }; - export namespace inputs_185 { - let amplitude_26: string; - export { amplitude_26 as amplitude }; - let octaves_4: string; - export { octaves_4 as octaves }; - let lacunarity_4: string; - export { lacunarity_4 as lacunarity }; - let diminish_4: string; - export { diminish_4 as diminish }; - let texcoord_68: string; - export { texcoord_68 as texcoord }; - } - export { inputs_185 as inputs }; - export namespace outputs_185 { - let out_176: string; - export { out_176 as out }; - } - export { outputs_185 as outputs }; - } - namespace ND_fractal2d_vector4 { - let node_186: string; - export { node_186 as node }; - let inherit_186: null; - export { inherit_186 as inherit }; - export namespace inputs_186 { - let amplitude_27: string; - export { amplitude_27 as amplitude }; - let octaves_5: string; - export { octaves_5 as octaves }; - let lacunarity_5: string; - export { lacunarity_5 as lacunarity }; - let diminish_5: string; - export { diminish_5 as diminish }; - let texcoord_69: string; - export { texcoord_69 as texcoord }; - } - export { inputs_186 as inputs }; - export namespace outputs_186 { - let out_177: string; - export { out_177 as out }; - } - export { outputs_186 as outputs }; - } - namespace ND_fractal2d_color3FA { - let node_187: string; - export { node_187 as node }; - let inherit_187: null; - export { inherit_187 as inherit }; - export namespace inputs_187 { - let amplitude_28: string; - export { amplitude_28 as amplitude }; - let octaves_6: string; - export { octaves_6 as octaves }; - let lacunarity_6: string; - export { lacunarity_6 as lacunarity }; - let diminish_6: string; - export { diminish_6 as diminish }; - let texcoord_70: string; - export { texcoord_70 as texcoord }; - } - export { inputs_187 as inputs }; - export namespace outputs_187 { - let out_178: string; - export { out_178 as out }; - } - export { outputs_187 as outputs }; - } - namespace ND_fractal2d_color4FA { - let node_188: string; - export { node_188 as node }; - let inherit_188: null; - export { inherit_188 as inherit }; - export namespace inputs_188 { - let amplitude_29: string; - export { amplitude_29 as amplitude }; - let octaves_7: string; - export { octaves_7 as octaves }; - let lacunarity_7: string; - export { lacunarity_7 as lacunarity }; - let diminish_7: string; - export { diminish_7 as diminish }; - let texcoord_71: string; - export { texcoord_71 as texcoord }; - } - export { inputs_188 as inputs }; - export namespace outputs_188 { - let out_179: string; - export { out_179 as out }; - } - export { outputs_188 as outputs }; - } - namespace ND_fractal2d_vector2FA { - let node_189: string; - export { node_189 as node }; - let inherit_189: null; - export { inherit_189 as inherit }; - export namespace inputs_189 { - let amplitude_30: string; - export { amplitude_30 as amplitude }; - let octaves_8: string; - export { octaves_8 as octaves }; - let lacunarity_8: string; - export { lacunarity_8 as lacunarity }; - let diminish_8: string; - export { diminish_8 as diminish }; - let texcoord_72: string; - export { texcoord_72 as texcoord }; - } - export { inputs_189 as inputs }; - export namespace outputs_189 { - let out_180: string; - export { out_180 as out }; - } - export { outputs_189 as outputs }; - } - namespace ND_fractal2d_vector3FA { - let node_190: string; - export { node_190 as node }; - let inherit_190: null; - export { inherit_190 as inherit }; - export namespace inputs_190 { - let amplitude_31: string; - export { amplitude_31 as amplitude }; - let octaves_9: string; - export { octaves_9 as octaves }; - let lacunarity_9: string; - export { lacunarity_9 as lacunarity }; - let diminish_9: string; - export { diminish_9 as diminish }; - let texcoord_73: string; - export { texcoord_73 as texcoord }; - } - export { inputs_190 as inputs }; - export namespace outputs_190 { - let out_181: string; - export { out_181 as out }; - } - export { outputs_190 as outputs }; - } - namespace ND_fractal2d_vector4FA { - let node_191: string; - export { node_191 as node }; - let inherit_191: null; - export { inherit_191 as inherit }; - export namespace inputs_191 { - let amplitude_32: string; - export { amplitude_32 as amplitude }; - let octaves_10: string; - export { octaves_10 as octaves }; - let lacunarity_10: string; - export { lacunarity_10 as lacunarity }; - let diminish_10: string; - export { diminish_10 as diminish }; - let texcoord_74: string; - export { texcoord_74 as texcoord }; - } - export { inputs_191 as inputs }; - export namespace outputs_191 { - let out_182: string; - export { out_182 as out }; - } - export { outputs_191 as outputs }; - } - namespace ND_fractal3d_float { - let node_192: string; - export { node_192 as node }; - let inherit_192: null; - export { inherit_192 as inherit }; - export namespace inputs_192 { - let amplitude_33: string; - export { amplitude_33 as amplitude }; - let octaves_11: string; - export { octaves_11 as octaves }; - let lacunarity_11: string; - export { lacunarity_11 as lacunarity }; - let diminish_11: string; - export { diminish_11 as diminish }; - let position_17: string; - export { position_17 as position }; - } - export { inputs_192 as inputs }; - export namespace outputs_192 { - let out_183: string; - export { out_183 as out }; - } - export { outputs_192 as outputs }; - } - namespace ND_fractal3d_color3 { - let node_193: string; - export { node_193 as node }; - let inherit_193: null; - export { inherit_193 as inherit }; - export namespace inputs_193 { - let amplitude_34: string; - export { amplitude_34 as amplitude }; - let octaves_12: string; - export { octaves_12 as octaves }; - let lacunarity_12: string; - export { lacunarity_12 as lacunarity }; - let diminish_12: string; - export { diminish_12 as diminish }; - let position_18: string; - export { position_18 as position }; - } - export { inputs_193 as inputs }; - export namespace outputs_193 { - let out_184: string; - export { out_184 as out }; - } - export { outputs_193 as outputs }; - } - namespace ND_fractal3d_color4 { - let node_194: string; - export { node_194 as node }; - let inherit_194: null; - export { inherit_194 as inherit }; - export namespace inputs_194 { - let amplitude_35: string; - export { amplitude_35 as amplitude }; - let octaves_13: string; - export { octaves_13 as octaves }; - let lacunarity_13: string; - export { lacunarity_13 as lacunarity }; - let diminish_13: string; - export { diminish_13 as diminish }; - let position_19: string; - export { position_19 as position }; - } - export { inputs_194 as inputs }; - export namespace outputs_194 { - let out_185: string; - export { out_185 as out }; - } - export { outputs_194 as outputs }; - } - namespace ND_fractal3d_vector2 { - let node_195: string; - export { node_195 as node }; - let inherit_195: null; - export { inherit_195 as inherit }; - export namespace inputs_195 { - let amplitude_36: string; - export { amplitude_36 as amplitude }; - let octaves_14: string; - export { octaves_14 as octaves }; - let lacunarity_14: string; - export { lacunarity_14 as lacunarity }; - let diminish_14: string; - export { diminish_14 as diminish }; - let position_20: string; - export { position_20 as position }; - } - export { inputs_195 as inputs }; - export namespace outputs_195 { - let out_186: string; - export { out_186 as out }; - } - export { outputs_195 as outputs }; - } - namespace ND_fractal3d_vector3 { - let node_196: string; - export { node_196 as node }; - let inherit_196: null; - export { inherit_196 as inherit }; - export namespace inputs_196 { - let amplitude_37: string; - export { amplitude_37 as amplitude }; - let octaves_15: string; - export { octaves_15 as octaves }; - let lacunarity_15: string; - export { lacunarity_15 as lacunarity }; - let diminish_15: string; - export { diminish_15 as diminish }; - let position_21: string; - export { position_21 as position }; - } - export { inputs_196 as inputs }; - export namespace outputs_196 { - let out_187: string; - export { out_187 as out }; - } - export { outputs_196 as outputs }; - } - namespace ND_fractal3d_vector4 { - let node_197: string; - export { node_197 as node }; - let inherit_197: null; - export { inherit_197 as inherit }; - export namespace inputs_197 { - let amplitude_38: string; - export { amplitude_38 as amplitude }; - let octaves_16: string; - export { octaves_16 as octaves }; - let lacunarity_16: string; - export { lacunarity_16 as lacunarity }; - let diminish_16: string; - export { diminish_16 as diminish }; - let position_22: string; - export { position_22 as position }; - } - export { inputs_197 as inputs }; - export namespace outputs_197 { - let out_188: string; - export { out_188 as out }; - } - export { outputs_197 as outputs }; - } - namespace ND_fractal3d_color3FA { - let node_198: string; - export { node_198 as node }; - let inherit_198: null; - export { inherit_198 as inherit }; - export namespace inputs_198 { - let amplitude_39: string; - export { amplitude_39 as amplitude }; - let octaves_17: string; - export { octaves_17 as octaves }; - let lacunarity_17: string; - export { lacunarity_17 as lacunarity }; - let diminish_17: string; - export { diminish_17 as diminish }; - let position_23: string; - export { position_23 as position }; - } - export { inputs_198 as inputs }; - export namespace outputs_198 { - let out_189: string; - export { out_189 as out }; - } - export { outputs_198 as outputs }; - } - namespace ND_fractal3d_color4FA { - let node_199: string; - export { node_199 as node }; - let inherit_199: null; - export { inherit_199 as inherit }; - export namespace inputs_199 { - let amplitude_40: string; - export { amplitude_40 as amplitude }; - let octaves_18: string; - export { octaves_18 as octaves }; - let lacunarity_18: string; - export { lacunarity_18 as lacunarity }; - let diminish_18: string; - export { diminish_18 as diminish }; - let position_24: string; - export { position_24 as position }; - } - export { inputs_199 as inputs }; - export namespace outputs_199 { - let out_190: string; - export { out_190 as out }; - } - export { outputs_199 as outputs }; - } - namespace ND_fractal3d_vector2FA { - let node_200: string; - export { node_200 as node }; - let inherit_200: null; - export { inherit_200 as inherit }; - export namespace inputs_200 { - let amplitude_41: string; - export { amplitude_41 as amplitude }; - let octaves_19: string; - export { octaves_19 as octaves }; - let lacunarity_19: string; - export { lacunarity_19 as lacunarity }; - let diminish_19: string; - export { diminish_19 as diminish }; - let position_25: string; - export { position_25 as position }; - } - export { inputs_200 as inputs }; - export namespace outputs_200 { - let out_191: string; - export { out_191 as out }; - } - export { outputs_200 as outputs }; - } - namespace ND_fractal3d_vector3FA { - let node_201: string; - export { node_201 as node }; - let inherit_201: null; - export { inherit_201 as inherit }; - export namespace inputs_201 { - let amplitude_42: string; - export { amplitude_42 as amplitude }; - let octaves_20: string; - export { octaves_20 as octaves }; - let lacunarity_20: string; - export { lacunarity_20 as lacunarity }; - let diminish_20: string; - export { diminish_20 as diminish }; - let position_26: string; - export { position_26 as position }; - } - export { inputs_201 as inputs }; - export namespace outputs_201 { - let out_192: string; - export { out_192 as out }; - } - export { outputs_201 as outputs }; - } - namespace ND_fractal3d_vector4FA { - let node_202: string; - export { node_202 as node }; - let inherit_202: null; - export { inherit_202 as inherit }; - export namespace inputs_202 { - let amplitude_43: string; - export { amplitude_43 as amplitude }; - let octaves_21: string; - export { octaves_21 as octaves }; - let lacunarity_21: string; - export { lacunarity_21 as lacunarity }; - let diminish_21: string; - export { diminish_21 as diminish }; - let position_27: string; - export { position_27 as position }; - } - export { inputs_202 as inputs }; - export namespace outputs_202 { - let out_193: string; - export { out_193 as out }; - } - export { outputs_202 as outputs }; - } - namespace ND_cellnoise2d_float { - let node_203: string; - export { node_203 as node }; - let inherit_203: null; - export { inherit_203 as inherit }; - export namespace inputs_203 { - let texcoord_75: string; - export { texcoord_75 as texcoord }; - } - export { inputs_203 as inputs }; - export namespace outputs_203 { - let out_194: string; - export { out_194 as out }; - } - export { outputs_203 as outputs }; - } - namespace ND_cellnoise3d_float { - let node_204: string; - export { node_204 as node }; - let inherit_204: null; - export { inherit_204 as inherit }; - export namespace inputs_204 { - let position_28: string; - export { position_28 as position }; - } - export { inputs_204 as inputs }; - export namespace outputs_204 { - let out_195: string; - export { out_195 as out }; - } - export { outputs_204 as outputs }; - } - namespace ND_worleynoise2d_float { - let node_205: string; - export { node_205 as node }; - let inherit_205: null; - export { inherit_205 as inherit }; - export namespace inputs_205 { - let texcoord_76: string; - export { texcoord_76 as texcoord }; - export let jitter: string; - export let style: string; - } - export { inputs_205 as inputs }; - export namespace outputs_205 { - let out_196: string; - export { out_196 as out }; - } - export { outputs_205 as outputs }; - } - namespace ND_worleynoise2d_vector2 { - let node_206: string; - export { node_206 as node }; - let inherit_206: null; - export { inherit_206 as inherit }; - export namespace inputs_206 { - let texcoord_77: string; - export { texcoord_77 as texcoord }; - let jitter_1: string; - export { jitter_1 as jitter }; - let style_1: string; - export { style_1 as style }; - } - export { inputs_206 as inputs }; - export namespace outputs_206 { - let out_197: string; - export { out_197 as out }; - } - export { outputs_206 as outputs }; - } - namespace ND_worleynoise2d_vector3 { - let node_207: string; - export { node_207 as node }; - let inherit_207: null; - export { inherit_207 as inherit }; - export namespace inputs_207 { - let texcoord_78: string; - export { texcoord_78 as texcoord }; - let jitter_2: string; - export { jitter_2 as jitter }; - let style_2: string; - export { style_2 as style }; - } - export { inputs_207 as inputs }; - export namespace outputs_207 { - let out_198: string; - export { out_198 as out }; - } - export { outputs_207 as outputs }; - } - namespace ND_worleynoise3d_float { - let node_208: string; - export { node_208 as node }; - let inherit_208: null; - export { inherit_208 as inherit }; - export namespace inputs_208 { - let position_29: string; - export { position_29 as position }; - let jitter_3: string; - export { jitter_3 as jitter }; - let style_3: string; - export { style_3 as style }; - } - export { inputs_208 as inputs }; - export namespace outputs_208 { - let out_199: string; - export { out_199 as out }; - } - export { outputs_208 as outputs }; - } - namespace ND_worleynoise3d_vector2 { - let node_209: string; - export { node_209 as node }; - let inherit_209: null; - export { inherit_209 as inherit }; - export namespace inputs_209 { - let position_30: string; - export { position_30 as position }; - let jitter_4: string; - export { jitter_4 as jitter }; - let style_4: string; - export { style_4 as style }; - } - export { inputs_209 as inputs }; - export namespace outputs_209 { - let out_200: string; - export { out_200 as out }; - } - export { outputs_209 as outputs }; - } - namespace ND_worleynoise3d_vector3 { - let node_210: string; - export { node_210 as node }; - let inherit_210: null; - export { inherit_210 as inherit }; - export namespace inputs_210 { - let position_31: string; - export { position_31 as position }; - let jitter_5: string; - export { jitter_5 as jitter }; - let style_5: string; - export { style_5 as style }; - } - export { inputs_210 as inputs }; - export namespace outputs_210 { - let out_201: string; - export { out_201 as out }; - } - export { outputs_210 as outputs }; - } - namespace ND_unifiednoise2d_float { - let node_211: string; - export { node_211 as node }; - let inherit_211: null; - export { inherit_211 as inherit }; - export namespace inputs_211 { - let texcoord_79: string; - export { texcoord_79 as texcoord }; - export let freq: string; - let offset_10: string; - export { offset_10 as offset }; - let jitter_6: string; - export { jitter_6 as jitter }; - export let outmin: string; - export let outmax: string; - export let clampoutput: string; - let octaves_22: string; - export { octaves_22 as octaves }; - let lacunarity_22: string; - export { lacunarity_22 as lacunarity }; - let diminish_22: string; - export { diminish_22 as diminish }; - let type_1: string; - export { type_1 as type }; - let style_6: string; - export { style_6 as style }; - } - export { inputs_211 as inputs }; - export namespace outputs_211 { - let out_202: string; - export { out_202 as out }; - } - export { outputs_211 as outputs }; - } - namespace ND_unifiednoise3d_float { - let node_212: string; - export { node_212 as node }; - let inherit_212: null; - export { inherit_212 as inherit }; - export namespace inputs_212 { - let position_32: string; - export { position_32 as position }; - let freq_1: string; - export { freq_1 as freq }; - let offset_11: string; - export { offset_11 as offset }; - let jitter_7: string; - export { jitter_7 as jitter }; - let outmin_1: string; - export { outmin_1 as outmin }; - let outmax_1: string; - export { outmax_1 as outmax }; - let clampoutput_1: string; - export { clampoutput_1 as clampoutput }; - let octaves_23: string; - export { octaves_23 as octaves }; - let lacunarity_23: string; - export { lacunarity_23 as lacunarity }; - let diminish_23: string; - export { diminish_23 as diminish }; - let type_2: string; - export { type_2 as type }; - let style_7: string; - export { style_7 as style }; - } - export { inputs_212 as inputs }; - export namespace outputs_212 { - let out_203: string; - export { out_203 as out }; - } - export { outputs_212 as outputs }; - } - namespace ND_flake2d { - let node_213: string; - export { node_213 as node }; - let inherit_213: null; - export { inherit_213 as inherit }; - export namespace inputs_213 { - export let size: string; - let roughness_12: string; - export { roughness_12 as roughness }; - export let coverage: string; - let texcoord_80: string; - export { texcoord_80 as texcoord }; - let normal_21: string; - export { normal_21 as normal }; - let tangent_5: string; - export { tangent_5 as tangent }; - export let bitangent: string; - } - export { inputs_213 as inputs }; - export namespace outputs_213 { - let id: string; - let rand: string; - let presence: string; - let flakenormal: string; - } - export { outputs_213 as outputs }; - } - namespace ND_flake3d { - let node_214: string; - export { node_214 as node }; - let inherit_214: null; - export { inherit_214 as inherit }; - export namespace inputs_214 { - let size_1: string; - export { size_1 as size }; - let roughness_13: string; - export { roughness_13 as roughness }; - let coverage_1: string; - export { coverage_1 as coverage }; - let position_33: string; - export { position_33 as position }; - let normal_22: string; - export { normal_22 as normal }; - let tangent_6: string; - export { tangent_6 as tangent }; - let bitangent_1: string; - export { bitangent_1 as bitangent }; - } - export { inputs_214 as inputs }; - export namespace outputs_214 { - let id_1: string; - export { id_1 as id }; - let rand_1: string; - export { rand_1 as rand }; - let presence_1: string; - export { presence_1 as presence }; - let flakenormal_1: string; - export { flakenormal_1 as flakenormal }; - } - export { outputs_214 as outputs }; - } - namespace ND_randomfloat_float { - let node_215: string; - export { node_215 as node }; - let inherit_215: null; - export { inherit_215 as inherit }; - export namespace inputs_215 { - let _in_21: string; - export { _in_21 as in }; - export let min: string; - export let max: string; - export let seed: string; - } - export { inputs_215 as inputs }; - export namespace outputs_215 { - let out_204: string; - export { out_204 as out }; - } - export { outputs_215 as outputs }; - } - namespace ND_randomfloat_integer { - let node_216: string; - export { node_216 as node }; - let inherit_216: null; - export { inherit_216 as inherit }; - export namespace inputs_216 { - let _in_22: string; - export { _in_22 as in }; - let min_1: string; - export { min_1 as min }; - let max_1: string; - export { max_1 as max }; - let seed_1: string; - export { seed_1 as seed }; - } - export { inputs_216 as inputs }; - export namespace outputs_216 { - let out_205: string; - export { out_205 as out }; - } - export { outputs_216 as outputs }; - } - namespace ND_randomcolor_float { - let node_217: string; - export { node_217 as node }; - let inherit_217: null; - export { inherit_217 as inherit }; - export namespace inputs_217 { - let _in_23: string; - export { _in_23 as in }; - export let huelow: string; - export let huehigh: string; - export let saturationlow: string; - export let saturationhigh: string; - export let brightnesslow: string; - export let brightnesshigh: string; - let seed_2: string; - export { seed_2 as seed }; - } - export { inputs_217 as inputs }; - export namespace outputs_217 { - let out_206: string; - export { out_206 as out }; - } - export { outputs_217 as outputs }; - } - namespace ND_randomcolor_integer { - let node_218: string; - export { node_218 as node }; - let inherit_218: null; - export { inherit_218 as inherit }; - export namespace inputs_218 { - let _in_24: string; - export { _in_24 as in }; - let huelow_1: string; - export { huelow_1 as huelow }; - let huehigh_1: string; - export { huehigh_1 as huehigh }; - let saturationlow_1: string; - export { saturationlow_1 as saturationlow }; - let saturationhigh_1: string; - export { saturationhigh_1 as saturationhigh }; - let brightnesslow_1: string; - export { brightnesslow_1 as brightnesslow }; - let brightnesshigh_1: string; - export { brightnesshigh_1 as brightnesshigh }; - let seed_3: string; - export { seed_3 as seed }; - } - export { inputs_218 as inputs }; - export namespace outputs_218 { - let out_207: string; - export { out_207 as out }; - } - export { outputs_218 as outputs }; - } - namespace ND_checkerboard_color3 { - let node_219: string; - export { node_219 as node }; - let inherit_219: null; - export { inherit_219 as inherit }; - export namespace inputs_219 { - let color1_2: string; - export { color1_2 as color1 }; - let color2_2: string; - export { color2_2 as color2 }; - let uvtiling_6: string; - export { uvtiling_6 as uvtiling }; - let uvoffset_6: string; - export { uvoffset_6 as uvoffset }; - let texcoord_81: string; - export { texcoord_81 as texcoord }; - } - export { inputs_219 as inputs }; - export namespace outputs_219 { - let out_208: string; - export { out_208 as out }; - } - export { outputs_219 as outputs }; - } - namespace ND_line_float { - let node_220: string; - export { node_220 as node }; - let inherit_220: null; - export { inherit_220 as inherit }; - export namespace inputs_220 { - let texcoord_82: string; - export { texcoord_82 as texcoord }; - let center_12: string; - export { center_12 as center }; - let radius_1: string; - export { radius_1 as radius }; - export let point1: string; - export let point2: string; - } - export { inputs_220 as inputs }; - export namespace outputs_220 { - let out_209: string; - export { out_209 as out }; - } - export { outputs_220 as outputs }; - } - namespace ND_circle_float { - let node_221: string; - export { node_221 as node }; - let inherit_221: null; - export { inherit_221 as inherit }; - export namespace inputs_221 { - let texcoord_83: string; - export { texcoord_83 as texcoord }; - let center_13: string; - export { center_13 as center }; - let radius_2: string; - export { radius_2 as radius }; - } - export { inputs_221 as inputs }; - export namespace outputs_221 { - let out_210: string; - export { out_210 as out }; - } - export { outputs_221 as outputs }; - } - namespace ND_cloverleaf_float { - let node_222: string; - export { node_222 as node }; - let inherit_222: null; - export { inherit_222 as inherit }; - export namespace inputs_222 { - let texcoord_84: string; - export { texcoord_84 as texcoord }; - let center_14: string; - export { center_14 as center }; - let radius_3: string; - export { radius_3 as radius }; - } - export { inputs_222 as inputs }; - export namespace outputs_222 { - let out_211: string; - export { out_211 as out }; - } - export { outputs_222 as outputs }; - } - namespace ND_hexagon_float { - let node_223: string; - export { node_223 as node }; - let inherit_223: null; - export { inherit_223 as inherit }; - export namespace inputs_223 { - let texcoord_85: string; - export { texcoord_85 as texcoord }; - let center_15: string; - export { center_15 as center }; - let radius_4: string; - export { radius_4 as radius }; - } - export { inputs_223 as inputs }; - export namespace outputs_223 { - let out_212: string; - export { out_212 as out }; - } - export { outputs_223 as outputs }; - } - namespace ND_grid_color3 { - let node_224: string; - export { node_224 as node }; - let inherit_224: null; - export { inherit_224 as inherit }; - export namespace inputs_224 { - let texcoord_86: string; - export { texcoord_86 as texcoord }; - let uvtiling_7: string; - export { uvtiling_7 as uvtiling }; - let uvoffset_7: string; - export { uvoffset_7 as uvoffset }; - let thickness_1: string; - export { thickness_1 as thickness }; - export let staggered: string; - } - export { inputs_224 as inputs }; - export namespace outputs_224 { - let out_213: string; - export { out_213 as out }; - } - export { outputs_224 as outputs }; - } - namespace ND_crosshatch_color3 { - let node_225: string; - export { node_225 as node }; - let inherit_225: null; - export { inherit_225 as inherit }; - export namespace inputs_225 { - let texcoord_87: string; - export { texcoord_87 as texcoord }; - let uvtiling_8: string; - export { uvtiling_8 as uvtiling }; - let uvoffset_8: string; - export { uvoffset_8 as uvoffset }; - let thickness_2: string; - export { thickness_2 as thickness }; - let staggered_1: string; - export { staggered_1 as staggered }; - } - export { inputs_225 as inputs }; - export namespace outputs_225 { - let out_214: string; - export { out_214 as out }; - } - export { outputs_225 as outputs }; - } - namespace ND_tiledcircles_color3 { - let node_226: string; - export { node_226 as node }; - let inherit_226: null; - export { inherit_226 as inherit }; - export namespace inputs_226 { - let texcoord_88: string; - export { texcoord_88 as texcoord }; - let uvtiling_9: string; - export { uvtiling_9 as uvtiling }; - let uvoffset_9: string; - export { uvoffset_9 as uvoffset }; - let size_2: string; - export { size_2 as size }; - let staggered_2: string; - export { staggered_2 as staggered }; - } - export { inputs_226 as inputs }; - export namespace outputs_226 { - let out_215: string; - export { out_215 as out }; - } - export { outputs_226 as outputs }; - } - namespace ND_tiledcloverleafs_color3 { - let node_227: string; - export { node_227 as node }; - let inherit_227: null; - export { inherit_227 as inherit }; - export namespace inputs_227 { - let texcoord_89: string; - export { texcoord_89 as texcoord }; - let uvtiling_10: string; - export { uvtiling_10 as uvtiling }; - let uvoffset_10: string; - export { uvoffset_10 as uvoffset }; - let size_3: string; - export { size_3 as size }; - let staggered_3: string; - export { staggered_3 as staggered }; - } - export { inputs_227 as inputs }; - export namespace outputs_227 { - let out_216: string; - export { out_216 as out }; - } - export { outputs_227 as outputs }; - } - namespace ND_tiledhexagons_color3 { - let node_228: string; - export { node_228 as node }; - let inherit_228: null; - export { inherit_228 as inherit }; - export namespace inputs_228 { - let texcoord_90: string; - export { texcoord_90 as texcoord }; - let uvtiling_11: string; - export { uvtiling_11 as uvtiling }; - let uvoffset_11: string; - export { uvoffset_11 as uvoffset }; - let size_4: string; - export { size_4 as size }; - let staggered_4: string; - export { staggered_4 as staggered }; - } - export { inputs_228 as inputs }; - export namespace outputs_228 { - let out_217: string; - export { out_217 as out }; - } - export { outputs_228 as outputs }; - } - namespace ND_position_vector3 { - let node_229: string; - export { node_229 as node }; - let inherit_229: null; - export { inherit_229 as inherit }; - export namespace inputs_229 { - let space_1: string; - export { space_1 as space }; - } - export { inputs_229 as inputs }; - export namespace outputs_229 { - let out_218: string; - export { out_218 as out }; - } - export { outputs_229 as outputs }; - } - namespace ND_normal_vector3 { - let node_230: string; - export { node_230 as node }; - let inherit_230: null; - export { inherit_230 as inherit }; - export namespace inputs_230 { - let space_2: string; - export { space_2 as space }; - } - export { inputs_230 as inputs }; - export namespace outputs_230 { - let out_219: string; - export { out_219 as out }; - } - export { outputs_230 as outputs }; - } - namespace ND_tangent_vector3 { - let node_231: string; - export { node_231 as node }; - let inherit_231: null; - export { inherit_231 as inherit }; - export namespace inputs_231 { - let space_3: string; - export { space_3 as space }; - export let index: string; - } - export { inputs_231 as inputs }; - export namespace outputs_231 { - let out_220: string; - export { out_220 as out }; - } - export { outputs_231 as outputs }; - } - namespace ND_bitangent_vector3 { - let node_232: string; - export { node_232 as node }; - let inherit_232: null; - export { inherit_232 as inherit }; - export namespace inputs_232 { - let space_4: string; - export { space_4 as space }; - let index_1: string; - export { index_1 as index }; - } - export { inputs_232 as inputs }; - export namespace outputs_232 { - let out_221: string; - export { out_221 as out }; - } - export { outputs_232 as outputs }; - } - namespace ND_texcoord_vector2 { - let node_233: string; - export { node_233 as node }; - let inherit_233: null; - export { inherit_233 as inherit }; - export namespace inputs_233 { - let index_2: string; - export { index_2 as index }; - } - export { inputs_233 as inputs }; - export namespace outputs_233 { - let out_222: string; - export { out_222 as out }; - } - export { outputs_233 as outputs }; - } - namespace ND_texcoord_vector3 { - let node_234: string; - export { node_234 as node }; - let inherit_234: null; - export { inherit_234 as inherit }; - export namespace inputs_234 { - let index_3: string; - export { index_3 as index }; - } - export { inputs_234 as inputs }; - export namespace outputs_234 { - let out_223: string; - export { out_223 as out }; - } - export { outputs_234 as outputs }; - } - namespace ND_geomcolor_float { - let node_235: string; - export { node_235 as node }; - let inherit_235: null; - export { inherit_235 as inherit }; - export namespace inputs_235 { - let index_4: string; - export { index_4 as index }; - } - export { inputs_235 as inputs }; - export namespace outputs_235 { - let out_224: string; - export { out_224 as out }; - } - export { outputs_235 as outputs }; - } - namespace ND_geomcolor_color3 { - let node_236: string; - export { node_236 as node }; - let inherit_236: null; - export { inherit_236 as inherit }; - export namespace inputs_236 { - let index_5: string; - export { index_5 as index }; - } - export { inputs_236 as inputs }; - export namespace outputs_236 { - let out_225: string; - export { out_225 as out }; - } - export { outputs_236 as outputs }; - } - namespace ND_geomcolor_color4 { - let node_237: string; - export { node_237 as node }; - let inherit_237: null; - export { inherit_237 as inherit }; - export namespace inputs_237 { - let index_6: string; - export { index_6 as index }; - } - export { inputs_237 as inputs }; - export namespace outputs_237 { - let out_226: string; - export { out_226 as out }; - } - export { outputs_237 as outputs }; - } - namespace ND_geompropvalue_integer { - let node_238: string; - export { node_238 as node }; - let inherit_238: null; - export { inherit_238 as inherit }; - export namespace inputs_238 { - export let geomprop: string; - let _default_29: string; - export { _default_29 as default }; - } - export { inputs_238 as inputs }; - export namespace outputs_238 { - let out_227: string; - export { out_227 as out }; - } - export { outputs_238 as outputs }; - } - namespace ND_geompropvalue_boolean { - let node_239: string; - export { node_239 as node }; - let inherit_239: null; - export { inherit_239 as inherit }; - export namespace inputs_239 { - let geomprop_1: string; - export { geomprop_1 as geomprop }; - let _default_30: string; - export { _default_30 as default }; - } - export { inputs_239 as inputs }; - export namespace outputs_239 { - let out_228: string; - export { out_228 as out }; - } - export { outputs_239 as outputs }; - } - namespace ND_geompropvalue_float { - let node_240: string; - export { node_240 as node }; - let inherit_240: null; - export { inherit_240 as inherit }; - export namespace inputs_240 { - let geomprop_2: string; - export { geomprop_2 as geomprop }; - let _default_31: string; - export { _default_31 as default }; - } - export { inputs_240 as inputs }; - export namespace outputs_240 { - let out_229: string; - export { out_229 as out }; - } - export { outputs_240 as outputs }; - } - namespace ND_geompropvalue_color3 { - let node_241: string; - export { node_241 as node }; - let inherit_241: null; - export { inherit_241 as inherit }; - export namespace inputs_241 { - let geomprop_3: string; - export { geomprop_3 as geomprop }; - let _default_32: string; - export { _default_32 as default }; - } - export { inputs_241 as inputs }; - export namespace outputs_241 { - let out_230: string; - export { out_230 as out }; - } - export { outputs_241 as outputs }; - } - namespace ND_geompropvalue_color4 { - let node_242: string; - export { node_242 as node }; - let inherit_242: null; - export { inherit_242 as inherit }; - export namespace inputs_242 { - let geomprop_4: string; - export { geomprop_4 as geomprop }; - let _default_33: string; - export { _default_33 as default }; - } - export { inputs_242 as inputs }; - export namespace outputs_242 { - let out_231: string; - export { out_231 as out }; - } - export { outputs_242 as outputs }; - } - namespace ND_geompropvalue_vector2 { - let node_243: string; - export { node_243 as node }; - let inherit_243: null; - export { inherit_243 as inherit }; - export namespace inputs_243 { - let geomprop_5: string; - export { geomprop_5 as geomprop }; - let _default_34: string; - export { _default_34 as default }; - } - export { inputs_243 as inputs }; - export namespace outputs_243 { - let out_232: string; - export { out_232 as out }; - } - export { outputs_243 as outputs }; - } - namespace ND_geompropvalue_vector3 { - let node_244: string; - export { node_244 as node }; - let inherit_244: null; - export { inherit_244 as inherit }; - export namespace inputs_244 { - let geomprop_6: string; - export { geomprop_6 as geomprop }; - let _default_35: string; - export { _default_35 as default }; - } - export { inputs_244 as inputs }; - export namespace outputs_244 { - let out_233: string; - export { out_233 as out }; - } - export { outputs_244 as outputs }; - } - namespace ND_geompropvalue_vector4 { - let node_245: string; - export { node_245 as node }; - let inherit_245: null; - export { inherit_245 as inherit }; - export namespace inputs_245 { - let geomprop_7: string; - export { geomprop_7 as geomprop }; - let _default_36: string; - export { _default_36 as default }; - } - export { inputs_245 as inputs }; - export namespace outputs_245 { - let out_234: string; - export { out_234 as out }; - } - export { outputs_245 as outputs }; - } - namespace ND_geompropvalueuniform_string { - let node_246: string; - export { node_246 as node }; - let inherit_246: null; - export { inherit_246 as inherit }; - export namespace inputs_246 { - let geomprop_8: string; - export { geomprop_8 as geomprop }; - let _default_37: string; - export { _default_37 as default }; - } - export { inputs_246 as inputs }; - export namespace outputs_246 { - let out_235: string; - export { out_235 as out }; - } - export { outputs_246 as outputs }; - } - namespace ND_geompropvalueuniform_filename { - let node_247: string; - export { node_247 as node }; - let inherit_247: null; - export { inherit_247 as inherit }; - export namespace inputs_247 { - let geomprop_9: string; - export { geomprop_9 as geomprop }; - let _default_38: string; - export { _default_38 as default }; - } - export { inputs_247 as inputs }; - export namespace outputs_247 { - let out_236: string; - export { out_236 as out }; - } - export { outputs_247 as outputs }; - } - namespace ND_bump_vector3 { - let node_248: string; - export { node_248 as node }; - let inherit_248: null; - export { inherit_248 as inherit }; - export namespace inputs_248 { - export let height: string; - let scale_14: string; - export { scale_14 as scale }; - let normal_23: string; - export { normal_23 as normal }; - let tangent_7: string; - export { tangent_7 as tangent }; - let bitangent_2: string; - export { bitangent_2 as bitangent }; - } - export { inputs_248 as inputs }; - export namespace outputs_248 { - let out_237: string; - export { out_237 as out }; - } - export { outputs_248 as outputs }; - } - namespace ND_frame_float { - let node_249: string; - export { node_249 as node }; - let inherit_249: null; - export { inherit_249 as inherit }; - let inputs_249: {}; - export { inputs_249 as inputs }; - export namespace outputs_249 { - let out_238: string; - export { out_238 as out }; - } - export { outputs_249 as outputs }; - } - namespace ND_time_float { - let node_250: string; - export { node_250 as node }; - let inherit_250: null; - export { inherit_250 as inherit }; - export namespace inputs_250 { - let fps: string; - } - export { inputs_250 as inputs }; - export namespace outputs_250 { - let out_239: string; - export { out_239 as out }; - } - export { outputs_250 as outputs }; - } - namespace ND_add_float { - let node_251: string; - export { node_251 as node }; - let inherit_251: null; - export { inherit_251 as inherit }; - export namespace inputs_251 { - let in1_9: string; - export { in1_9 as in1 }; - let in2_9: string; - export { in2_9 as in2 }; - } - export { inputs_251 as inputs }; - export namespace outputs_251 { - let out_240: string; - export { out_240 as out }; - } - export { outputs_251 as outputs }; - } - namespace ND_add_integer { - let node_252: string; - export { node_252 as node }; - let inherit_252: null; - export { inherit_252 as inherit }; - export namespace inputs_252 { - let in1_10: string; - export { in1_10 as in1 }; - let in2_10: string; - export { in2_10 as in2 }; - } - export { inputs_252 as inputs }; - export namespace outputs_252 { - let out_241: string; - export { out_241 as out }; - } - export { outputs_252 as outputs }; - } - namespace ND_add_color3 { - let node_253: string; - export { node_253 as node }; - let inherit_253: null; - export { inherit_253 as inherit }; - export namespace inputs_253 { - let in1_11: string; - export { in1_11 as in1 }; - let in2_11: string; - export { in2_11 as in2 }; - } - export { inputs_253 as inputs }; - export namespace outputs_253 { - let out_242: string; - export { out_242 as out }; - } - export { outputs_253 as outputs }; - } - namespace ND_add_color4 { - let node_254: string; - export { node_254 as node }; - let inherit_254: null; - export { inherit_254 as inherit }; - export namespace inputs_254 { - let in1_12: string; - export { in1_12 as in1 }; - let in2_12: string; - export { in2_12 as in2 }; - } - export { inputs_254 as inputs }; - export namespace outputs_254 { - let out_243: string; - export { out_243 as out }; - } - export { outputs_254 as outputs }; - } - namespace ND_add_vector2 { - let node_255: string; - export { node_255 as node }; - let inherit_255: null; - export { inherit_255 as inherit }; - export namespace inputs_255 { - let in1_13: string; - export { in1_13 as in1 }; - let in2_13: string; - export { in2_13 as in2 }; - } - export { inputs_255 as inputs }; - export namespace outputs_255 { - let out_244: string; - export { out_244 as out }; - } - export { outputs_255 as outputs }; - } - namespace ND_add_vector3 { - let node_256: string; - export { node_256 as node }; - let inherit_256: null; - export { inherit_256 as inherit }; - export namespace inputs_256 { - let in1_14: string; - export { in1_14 as in1 }; - let in2_14: string; - export { in2_14 as in2 }; - } - export { inputs_256 as inputs }; - export namespace outputs_256 { - let out_245: string; - export { out_245 as out }; - } - export { outputs_256 as outputs }; - } - namespace ND_add_vector4 { - let node_257: string; - export { node_257 as node }; - let inherit_257: null; - export { inherit_257 as inherit }; - export namespace inputs_257 { - let in1_15: string; - export { in1_15 as in1 }; - let in2_15: string; - export { in2_15 as in2 }; - } - export { inputs_257 as inputs }; - export namespace outputs_257 { - let out_246: string; - export { out_246 as out }; - } - export { outputs_257 as outputs }; - } - namespace ND_add_matrix33 { - let node_258: string; - export { node_258 as node }; - let inherit_258: null; - export { inherit_258 as inherit }; - export namespace inputs_258 { - let in1_16: string; - export { in1_16 as in1 }; - let in2_16: string; - export { in2_16 as in2 }; - } - export { inputs_258 as inputs }; - export namespace outputs_258 { - let out_247: string; - export { out_247 as out }; - } - export { outputs_258 as outputs }; - } - namespace ND_add_matrix44 { - let node_259: string; - export { node_259 as node }; - let inherit_259: null; - export { inherit_259 as inherit }; - export namespace inputs_259 { - let in1_17: string; - export { in1_17 as in1 }; - let in2_17: string; - export { in2_17 as in2 }; - } - export { inputs_259 as inputs }; - export namespace outputs_259 { - let out_248: string; - export { out_248 as out }; - } - export { outputs_259 as outputs }; - } - namespace ND_add_color3FA { - let node_260: string; - export { node_260 as node }; - let inherit_260: null; - export { inherit_260 as inherit }; - export namespace inputs_260 { - let in1_18: string; - export { in1_18 as in1 }; - let in2_18: string; - export { in2_18 as in2 }; - } - export { inputs_260 as inputs }; - export namespace outputs_260 { - let out_249: string; - export { out_249 as out }; - } - export { outputs_260 as outputs }; - } - namespace ND_add_color4FA { - let node_261: string; - export { node_261 as node }; - let inherit_261: null; - export { inherit_261 as inherit }; - export namespace inputs_261 { - let in1_19: string; - export { in1_19 as in1 }; - let in2_19: string; - export { in2_19 as in2 }; - } - export { inputs_261 as inputs }; - export namespace outputs_261 { - let out_250: string; - export { out_250 as out }; - } - export { outputs_261 as outputs }; - } - namespace ND_add_vector2FA { - let node_262: string; - export { node_262 as node }; - let inherit_262: null; - export { inherit_262 as inherit }; - export namespace inputs_262 { - let in1_20: string; - export { in1_20 as in1 }; - let in2_20: string; - export { in2_20 as in2 }; - } - export { inputs_262 as inputs }; - export namespace outputs_262 { - let out_251: string; - export { out_251 as out }; - } - export { outputs_262 as outputs }; - } - namespace ND_add_vector3FA { - let node_263: string; - export { node_263 as node }; - let inherit_263: null; - export { inherit_263 as inherit }; - export namespace inputs_263 { - let in1_21: string; - export { in1_21 as in1 }; - let in2_21: string; - export { in2_21 as in2 }; - } - export { inputs_263 as inputs }; - export namespace outputs_263 { - let out_252: string; - export { out_252 as out }; - } - export { outputs_263 as outputs }; - } - namespace ND_add_vector4FA { - let node_264: string; - export { node_264 as node }; - let inherit_264: null; - export { inherit_264 as inherit }; - export namespace inputs_264 { - let in1_22: string; - export { in1_22 as in1 }; - let in2_22: string; - export { in2_22 as in2 }; - } - export { inputs_264 as inputs }; - export namespace outputs_264 { - let out_253: string; - export { out_253 as out }; - } - export { outputs_264 as outputs }; - } - namespace ND_add_matrix33FA { - let node_265: string; - export { node_265 as node }; - let inherit_265: null; - export { inherit_265 as inherit }; - export namespace inputs_265 { - let in1_23: string; - export { in1_23 as in1 }; - let in2_23: string; - export { in2_23 as in2 }; - } - export { inputs_265 as inputs }; - export namespace outputs_265 { - let out_254: string; - export { out_254 as out }; - } - export { outputs_265 as outputs }; - } - namespace ND_add_matrix44FA { - let node_266: string; - export { node_266 as node }; - let inherit_266: null; - export { inherit_266 as inherit }; - export namespace inputs_266 { - let in1_24: string; - export { in1_24 as in1 }; - let in2_24: string; - export { in2_24 as in2 }; - } - export { inputs_266 as inputs }; - export namespace outputs_266 { - let out_255: string; - export { out_255 as out }; - } - export { outputs_266 as outputs }; - } - namespace ND_subtract_float { - let node_267: string; - export { node_267 as node }; - let inherit_267: null; - export { inherit_267 as inherit }; - export namespace inputs_267 { - let in1_25: string; - export { in1_25 as in1 }; - let in2_25: string; - export { in2_25 as in2 }; - } - export { inputs_267 as inputs }; - export namespace outputs_267 { - let out_256: string; - export { out_256 as out }; - } - export { outputs_267 as outputs }; - } - namespace ND_subtract_integer { - let node_268: string; - export { node_268 as node }; - let inherit_268: null; - export { inherit_268 as inherit }; - export namespace inputs_268 { - let in1_26: string; - export { in1_26 as in1 }; - let in2_26: string; - export { in2_26 as in2 }; - } - export { inputs_268 as inputs }; - export namespace outputs_268 { - let out_257: string; - export { out_257 as out }; - } - export { outputs_268 as outputs }; - } - namespace ND_subtract_color3 { - let node_269: string; - export { node_269 as node }; - let inherit_269: null; - export { inherit_269 as inherit }; - export namespace inputs_269 { - let in1_27: string; - export { in1_27 as in1 }; - let in2_27: string; - export { in2_27 as in2 }; - } - export { inputs_269 as inputs }; - export namespace outputs_269 { - let out_258: string; - export { out_258 as out }; - } - export { outputs_269 as outputs }; - } - namespace ND_subtract_color4 { - let node_270: string; - export { node_270 as node }; - let inherit_270: null; - export { inherit_270 as inherit }; - export namespace inputs_270 { - let in1_28: string; - export { in1_28 as in1 }; - let in2_28: string; - export { in2_28 as in2 }; - } - export { inputs_270 as inputs }; - export namespace outputs_270 { - let out_259: string; - export { out_259 as out }; - } - export { outputs_270 as outputs }; - } - namespace ND_subtract_vector2 { - let node_271: string; - export { node_271 as node }; - let inherit_271: null; - export { inherit_271 as inherit }; - export namespace inputs_271 { - let in1_29: string; - export { in1_29 as in1 }; - let in2_29: string; - export { in2_29 as in2 }; - } - export { inputs_271 as inputs }; - export namespace outputs_271 { - let out_260: string; - export { out_260 as out }; - } - export { outputs_271 as outputs }; - } - namespace ND_subtract_vector3 { - let node_272: string; - export { node_272 as node }; - let inherit_272: null; - export { inherit_272 as inherit }; - export namespace inputs_272 { - let in1_30: string; - export { in1_30 as in1 }; - let in2_30: string; - export { in2_30 as in2 }; - } - export { inputs_272 as inputs }; - export namespace outputs_272 { - let out_261: string; - export { out_261 as out }; - } - export { outputs_272 as outputs }; - } - namespace ND_subtract_vector4 { - let node_273: string; - export { node_273 as node }; - let inherit_273: null; - export { inherit_273 as inherit }; - export namespace inputs_273 { - let in1_31: string; - export { in1_31 as in1 }; - let in2_31: string; - export { in2_31 as in2 }; - } - export { inputs_273 as inputs }; - export namespace outputs_273 { - let out_262: string; - export { out_262 as out }; - } - export { outputs_273 as outputs }; - } - namespace ND_subtract_matrix33 { - let node_274: string; - export { node_274 as node }; - let inherit_274: null; - export { inherit_274 as inherit }; - export namespace inputs_274 { - let in1_32: string; - export { in1_32 as in1 }; - let in2_32: string; - export { in2_32 as in2 }; - } - export { inputs_274 as inputs }; - export namespace outputs_274 { - let out_263: string; - export { out_263 as out }; - } - export { outputs_274 as outputs }; - } - namespace ND_subtract_matrix44 { - let node_275: string; - export { node_275 as node }; - let inherit_275: null; - export { inherit_275 as inherit }; - export namespace inputs_275 { - let in1_33: string; - export { in1_33 as in1 }; - let in2_33: string; - export { in2_33 as in2 }; - } - export { inputs_275 as inputs }; - export namespace outputs_275 { - let out_264: string; - export { out_264 as out }; - } - export { outputs_275 as outputs }; - } - namespace ND_subtract_color3FA { - let node_276: string; - export { node_276 as node }; - let inherit_276: null; - export { inherit_276 as inherit }; - export namespace inputs_276 { - let in1_34: string; - export { in1_34 as in1 }; - let in2_34: string; - export { in2_34 as in2 }; - } - export { inputs_276 as inputs }; - export namespace outputs_276 { - let out_265: string; - export { out_265 as out }; - } - export { outputs_276 as outputs }; - } - namespace ND_subtract_color4FA { - let node_277: string; - export { node_277 as node }; - let inherit_277: null; - export { inherit_277 as inherit }; - export namespace inputs_277 { - let in1_35: string; - export { in1_35 as in1 }; - let in2_35: string; - export { in2_35 as in2 }; - } - export { inputs_277 as inputs }; - export namespace outputs_277 { - let out_266: string; - export { out_266 as out }; - } - export { outputs_277 as outputs }; - } - namespace ND_subtract_vector2FA { - let node_278: string; - export { node_278 as node }; - let inherit_278: null; - export { inherit_278 as inherit }; - export namespace inputs_278 { - let in1_36: string; - export { in1_36 as in1 }; - let in2_36: string; - export { in2_36 as in2 }; - } - export { inputs_278 as inputs }; - export namespace outputs_278 { - let out_267: string; - export { out_267 as out }; - } - export { outputs_278 as outputs }; - } - namespace ND_subtract_vector3FA { - let node_279: string; - export { node_279 as node }; - let inherit_279: null; - export { inherit_279 as inherit }; - export namespace inputs_279 { - let in1_37: string; - export { in1_37 as in1 }; - let in2_37: string; - export { in2_37 as in2 }; - } - export { inputs_279 as inputs }; - export namespace outputs_279 { - let out_268: string; - export { out_268 as out }; - } - export { outputs_279 as outputs }; - } - namespace ND_subtract_vector4FA { - let node_280: string; - export { node_280 as node }; - let inherit_280: null; - export { inherit_280 as inherit }; - export namespace inputs_280 { - let in1_38: string; - export { in1_38 as in1 }; - let in2_38: string; - export { in2_38 as in2 }; - } - export { inputs_280 as inputs }; - export namespace outputs_280 { - let out_269: string; - export { out_269 as out }; - } - export { outputs_280 as outputs }; - } - namespace ND_subtract_matrix33FA { - let node_281: string; - export { node_281 as node }; - let inherit_281: null; - export { inherit_281 as inherit }; - export namespace inputs_281 { - let in1_39: string; - export { in1_39 as in1 }; - let in2_39: string; - export { in2_39 as in2 }; - } - export { inputs_281 as inputs }; - export namespace outputs_281 { - let out_270: string; - export { out_270 as out }; - } - export { outputs_281 as outputs }; - } - namespace ND_subtract_matrix44FA { - let node_282: string; - export { node_282 as node }; - let inherit_282: null; - export { inherit_282 as inherit }; - export namespace inputs_282 { - let in1_40: string; - export { in1_40 as in1 }; - let in2_40: string; - export { in2_40 as in2 }; - } - export { inputs_282 as inputs }; - export namespace outputs_282 { - let out_271: string; - export { out_271 as out }; - } - export { outputs_282 as outputs }; - } - namespace ND_multiply_float { - let node_283: string; - export { node_283 as node }; - let inherit_283: null; - export { inherit_283 as inherit }; - export namespace inputs_283 { - let in1_41: string; - export { in1_41 as in1 }; - let in2_41: string; - export { in2_41 as in2 }; - } - export { inputs_283 as inputs }; - export namespace outputs_283 { - let out_272: string; - export { out_272 as out }; - } - export { outputs_283 as outputs }; - } - namespace ND_multiply_color3 { - let node_284: string; - export { node_284 as node }; - let inherit_284: null; - export { inherit_284 as inherit }; - export namespace inputs_284 { - let in1_42: string; - export { in1_42 as in1 }; - let in2_42: string; - export { in2_42 as in2 }; - } - export { inputs_284 as inputs }; - export namespace outputs_284 { - let out_273: string; - export { out_273 as out }; - } - export { outputs_284 as outputs }; - } - namespace ND_multiply_color4 { - let node_285: string; - export { node_285 as node }; - let inherit_285: null; - export { inherit_285 as inherit }; - export namespace inputs_285 { - let in1_43: string; - export { in1_43 as in1 }; - let in2_43: string; - export { in2_43 as in2 }; - } - export { inputs_285 as inputs }; - export namespace outputs_285 { - let out_274: string; - export { out_274 as out }; - } - export { outputs_285 as outputs }; - } - namespace ND_multiply_vector2 { - let node_286: string; - export { node_286 as node }; - let inherit_286: null; - export { inherit_286 as inherit }; - export namespace inputs_286 { - let in1_44: string; - export { in1_44 as in1 }; - let in2_44: string; - export { in2_44 as in2 }; - } - export { inputs_286 as inputs }; - export namespace outputs_286 { - let out_275: string; - export { out_275 as out }; - } - export { outputs_286 as outputs }; - } - namespace ND_multiply_vector3 { - let node_287: string; - export { node_287 as node }; - let inherit_287: null; - export { inherit_287 as inherit }; - export namespace inputs_287 { - let in1_45: string; - export { in1_45 as in1 }; - let in2_45: string; - export { in2_45 as in2 }; - } - export { inputs_287 as inputs }; - export namespace outputs_287 { - let out_276: string; - export { out_276 as out }; - } - export { outputs_287 as outputs }; - } - namespace ND_multiply_vector4 { - let node_288: string; - export { node_288 as node }; - let inherit_288: null; - export { inherit_288 as inherit }; - export namespace inputs_288 { - let in1_46: string; - export { in1_46 as in1 }; - let in2_46: string; - export { in2_46 as in2 }; - } - export { inputs_288 as inputs }; - export namespace outputs_288 { - let out_277: string; - export { out_277 as out }; - } - export { outputs_288 as outputs }; - } - namespace ND_multiply_matrix33 { - let node_289: string; - export { node_289 as node }; - let inherit_289: null; - export { inherit_289 as inherit }; - export namespace inputs_289 { - let in1_47: string; - export { in1_47 as in1 }; - let in2_47: string; - export { in2_47 as in2 }; - } - export { inputs_289 as inputs }; - export namespace outputs_289 { - let out_278: string; - export { out_278 as out }; - } - export { outputs_289 as outputs }; - } - namespace ND_multiply_matrix44 { - let node_290: string; - export { node_290 as node }; - let inherit_290: null; - export { inherit_290 as inherit }; - export namespace inputs_290 { - let in1_48: string; - export { in1_48 as in1 }; - let in2_48: string; - export { in2_48 as in2 }; - } - export { inputs_290 as inputs }; - export namespace outputs_290 { - let out_279: string; - export { out_279 as out }; - } - export { outputs_290 as outputs }; - } - namespace ND_multiply_color3FA { - let node_291: string; - export { node_291 as node }; - let inherit_291: null; - export { inherit_291 as inherit }; - export namespace inputs_291 { - let in1_49: string; - export { in1_49 as in1 }; - let in2_49: string; - export { in2_49 as in2 }; - } - export { inputs_291 as inputs }; - export namespace outputs_291 { - let out_280: string; - export { out_280 as out }; - } - export { outputs_291 as outputs }; - } - namespace ND_multiply_color4FA { - let node_292: string; - export { node_292 as node }; - let inherit_292: null; - export { inherit_292 as inherit }; - export namespace inputs_292 { - let in1_50: string; - export { in1_50 as in1 }; - let in2_50: string; - export { in2_50 as in2 }; - } - export { inputs_292 as inputs }; - export namespace outputs_292 { - let out_281: string; - export { out_281 as out }; - } - export { outputs_292 as outputs }; - } - namespace ND_multiply_vector2FA { - let node_293: string; - export { node_293 as node }; - let inherit_293: null; - export { inherit_293 as inherit }; - export namespace inputs_293 { - let in1_51: string; - export { in1_51 as in1 }; - let in2_51: string; - export { in2_51 as in2 }; - } - export { inputs_293 as inputs }; - export namespace outputs_293 { - let out_282: string; - export { out_282 as out }; - } - export { outputs_293 as outputs }; - } - namespace ND_multiply_vector3FA { - let node_294: string; - export { node_294 as node }; - let inherit_294: null; - export { inherit_294 as inherit }; - export namespace inputs_294 { - let in1_52: string; - export { in1_52 as in1 }; - let in2_52: string; - export { in2_52 as in2 }; - } - export { inputs_294 as inputs }; - export namespace outputs_294 { - let out_283: string; - export { out_283 as out }; - } - export { outputs_294 as outputs }; - } - namespace ND_multiply_vector4FA { - let node_295: string; - export { node_295 as node }; - let inherit_295: null; - export { inherit_295 as inherit }; - export namespace inputs_295 { - let in1_53: string; - export { in1_53 as in1 }; - let in2_53: string; - export { in2_53 as in2 }; - } - export { inputs_295 as inputs }; - export namespace outputs_295 { - let out_284: string; - export { out_284 as out }; - } - export { outputs_295 as outputs }; - } - namespace ND_divide_float { - let node_296: string; - export { node_296 as node }; - let inherit_296: null; - export { inherit_296 as inherit }; - export namespace inputs_296 { - let in1_54: string; - export { in1_54 as in1 }; - let in2_54: string; - export { in2_54 as in2 }; - } - export { inputs_296 as inputs }; - export namespace outputs_296 { - let out_285: string; - export { out_285 as out }; - } - export { outputs_296 as outputs }; - } - namespace ND_divide_color3 { - let node_297: string; - export { node_297 as node }; - let inherit_297: null; - export { inherit_297 as inherit }; - export namespace inputs_297 { - let in1_55: string; - export { in1_55 as in1 }; - let in2_55: string; - export { in2_55 as in2 }; - } - export { inputs_297 as inputs }; - export namespace outputs_297 { - let out_286: string; - export { out_286 as out }; - } - export { outputs_297 as outputs }; - } - namespace ND_divide_color4 { - let node_298: string; - export { node_298 as node }; - let inherit_298: null; - export { inherit_298 as inherit }; - export namespace inputs_298 { - let in1_56: string; - export { in1_56 as in1 }; - let in2_56: string; - export { in2_56 as in2 }; - } - export { inputs_298 as inputs }; - export namespace outputs_298 { - let out_287: string; - export { out_287 as out }; - } - export { outputs_298 as outputs }; - } - namespace ND_divide_vector2 { - let node_299: string; - export { node_299 as node }; - let inherit_299: null; - export { inherit_299 as inherit }; - export namespace inputs_299 { - let in1_57: string; - export { in1_57 as in1 }; - let in2_57: string; - export { in2_57 as in2 }; - } - export { inputs_299 as inputs }; - export namespace outputs_299 { - let out_288: string; - export { out_288 as out }; - } - export { outputs_299 as outputs }; - } - namespace ND_divide_vector3 { - let node_300: string; - export { node_300 as node }; - let inherit_300: null; - export { inherit_300 as inherit }; - export namespace inputs_300 { - let in1_58: string; - export { in1_58 as in1 }; - let in2_58: string; - export { in2_58 as in2 }; - } - export { inputs_300 as inputs }; - export namespace outputs_300 { - let out_289: string; - export { out_289 as out }; - } - export { outputs_300 as outputs }; - } - namespace ND_divide_vector4 { - let node_301: string; - export { node_301 as node }; - let inherit_301: null; - export { inherit_301 as inherit }; - export namespace inputs_301 { - let in1_59: string; - export { in1_59 as in1 }; - let in2_59: string; - export { in2_59 as in2 }; - } - export { inputs_301 as inputs }; - export namespace outputs_301 { - let out_290: string; - export { out_290 as out }; - } - export { outputs_301 as outputs }; - } - namespace ND_divide_matrix33 { - let node_302: string; - export { node_302 as node }; - let inherit_302: null; - export { inherit_302 as inherit }; - export namespace inputs_302 { - let in1_60: string; - export { in1_60 as in1 }; - let in2_60: string; - export { in2_60 as in2 }; - } - export { inputs_302 as inputs }; - export namespace outputs_302 { - let out_291: string; - export { out_291 as out }; - } - export { outputs_302 as outputs }; - } - namespace ND_divide_matrix44 { - let node_303: string; - export { node_303 as node }; - let inherit_303: null; - export { inherit_303 as inherit }; - export namespace inputs_303 { - let in1_61: string; - export { in1_61 as in1 }; - let in2_61: string; - export { in2_61 as in2 }; - } - export { inputs_303 as inputs }; - export namespace outputs_303 { - let out_292: string; - export { out_292 as out }; - } - export { outputs_303 as outputs }; - } - namespace ND_divide_color3FA { - let node_304: string; - export { node_304 as node }; - let inherit_304: null; - export { inherit_304 as inherit }; - export namespace inputs_304 { - let in1_62: string; - export { in1_62 as in1 }; - let in2_62: string; - export { in2_62 as in2 }; - } - export { inputs_304 as inputs }; - export namespace outputs_304 { - let out_293: string; - export { out_293 as out }; - } - export { outputs_304 as outputs }; - } - namespace ND_divide_color4FA { - let node_305: string; - export { node_305 as node }; - let inherit_305: null; - export { inherit_305 as inherit }; - export namespace inputs_305 { - let in1_63: string; - export { in1_63 as in1 }; - let in2_63: string; - export { in2_63 as in2 }; - } - export { inputs_305 as inputs }; - export namespace outputs_305 { - let out_294: string; - export { out_294 as out }; - } - export { outputs_305 as outputs }; - } - namespace ND_divide_vector2FA { - let node_306: string; - export { node_306 as node }; - let inherit_306: null; - export { inherit_306 as inherit }; - export namespace inputs_306 { - let in1_64: string; - export { in1_64 as in1 }; - let in2_64: string; - export { in2_64 as in2 }; - } - export { inputs_306 as inputs }; - export namespace outputs_306 { - let out_295: string; - export { out_295 as out }; - } - export { outputs_306 as outputs }; - } - namespace ND_divide_vector3FA { - let node_307: string; - export { node_307 as node }; - let inherit_307: null; - export { inherit_307 as inherit }; - export namespace inputs_307 { - let in1_65: string; - export { in1_65 as in1 }; - let in2_65: string; - export { in2_65 as in2 }; - } - export { inputs_307 as inputs }; - export namespace outputs_307 { - let out_296: string; - export { out_296 as out }; - } - export { outputs_307 as outputs }; - } - namespace ND_divide_vector4FA { - let node_308: string; - export { node_308 as node }; - let inherit_308: null; - export { inherit_308 as inherit }; - export namespace inputs_308 { - let in1_66: string; - export { in1_66 as in1 }; - let in2_66: string; - export { in2_66 as in2 }; - } - export { inputs_308 as inputs }; - export namespace outputs_308 { - let out_297: string; - export { out_297 as out }; - } - export { outputs_308 as outputs }; - } - namespace ND_modulo_float { - let node_309: string; - export { node_309 as node }; - let inherit_309: null; - export { inherit_309 as inherit }; - export namespace inputs_309 { - let in1_67: string; - export { in1_67 as in1 }; - let in2_67: string; - export { in2_67 as in2 }; - } - export { inputs_309 as inputs }; - export namespace outputs_309 { - let out_298: string; - export { out_298 as out }; - } - export { outputs_309 as outputs }; - } - namespace ND_modulo_color3 { - let node_310: string; - export { node_310 as node }; - let inherit_310: null; - export { inherit_310 as inherit }; - export namespace inputs_310 { - let in1_68: string; - export { in1_68 as in1 }; - let in2_68: string; - export { in2_68 as in2 }; - } - export { inputs_310 as inputs }; - export namespace outputs_310 { - let out_299: string; - export { out_299 as out }; - } - export { outputs_310 as outputs }; - } - namespace ND_modulo_color4 { - let node_311: string; - export { node_311 as node }; - let inherit_311: null; - export { inherit_311 as inherit }; - export namespace inputs_311 { - let in1_69: string; - export { in1_69 as in1 }; - let in2_69: string; - export { in2_69 as in2 }; - } - export { inputs_311 as inputs }; - export namespace outputs_311 { - let out_300: string; - export { out_300 as out }; - } - export { outputs_311 as outputs }; - } - namespace ND_modulo_vector2 { - let node_312: string; - export { node_312 as node }; - let inherit_312: null; - export { inherit_312 as inherit }; - export namespace inputs_312 { - let in1_70: string; - export { in1_70 as in1 }; - let in2_70: string; - export { in2_70 as in2 }; - } - export { inputs_312 as inputs }; - export namespace outputs_312 { - let out_301: string; - export { out_301 as out }; - } - export { outputs_312 as outputs }; - } - namespace ND_modulo_vector3 { - let node_313: string; - export { node_313 as node }; - let inherit_313: null; - export { inherit_313 as inherit }; - export namespace inputs_313 { - let in1_71: string; - export { in1_71 as in1 }; - let in2_71: string; - export { in2_71 as in2 }; - } - export { inputs_313 as inputs }; - export namespace outputs_313 { - let out_302: string; - export { out_302 as out }; - } - export { outputs_313 as outputs }; - } - namespace ND_modulo_vector4 { - let node_314: string; - export { node_314 as node }; - let inherit_314: null; - export { inherit_314 as inherit }; - export namespace inputs_314 { - let in1_72: string; - export { in1_72 as in1 }; - let in2_72: string; - export { in2_72 as in2 }; - } - export { inputs_314 as inputs }; - export namespace outputs_314 { - let out_303: string; - export { out_303 as out }; - } - export { outputs_314 as outputs }; - } - namespace ND_modulo_color3FA { - let node_315: string; - export { node_315 as node }; - let inherit_315: null; - export { inherit_315 as inherit }; - export namespace inputs_315 { - let in1_73: string; - export { in1_73 as in1 }; - let in2_73: string; - export { in2_73 as in2 }; - } - export { inputs_315 as inputs }; - export namespace outputs_315 { - let out_304: string; - export { out_304 as out }; - } - export { outputs_315 as outputs }; - } - namespace ND_modulo_color4FA { - let node_316: string; - export { node_316 as node }; - let inherit_316: null; - export { inherit_316 as inherit }; - export namespace inputs_316 { - let in1_74: string; - export { in1_74 as in1 }; - let in2_74: string; - export { in2_74 as in2 }; - } - export { inputs_316 as inputs }; - export namespace outputs_316 { - let out_305: string; - export { out_305 as out }; - } - export { outputs_316 as outputs }; - } - namespace ND_modulo_vector2FA { - let node_317: string; - export { node_317 as node }; - let inherit_317: null; - export { inherit_317 as inherit }; - export namespace inputs_317 { - let in1_75: string; - export { in1_75 as in1 }; - let in2_75: string; - export { in2_75 as in2 }; - } - export { inputs_317 as inputs }; - export namespace outputs_317 { - let out_306: string; - export { out_306 as out }; - } - export { outputs_317 as outputs }; - } - namespace ND_modulo_vector3FA { - let node_318: string; - export { node_318 as node }; - let inherit_318: null; - export { inherit_318 as inherit }; - export namespace inputs_318 { - let in1_76: string; - export { in1_76 as in1 }; - let in2_76: string; - export { in2_76 as in2 }; - } - export { inputs_318 as inputs }; - export namespace outputs_318 { - let out_307: string; - export { out_307 as out }; - } - export { outputs_318 as outputs }; - } - namespace ND_modulo_vector4FA { - let node_319: string; - export { node_319 as node }; - let inherit_319: null; - export { inherit_319 as inherit }; - export namespace inputs_319 { - let in1_77: string; - export { in1_77 as in1 }; - let in2_77: string; - export { in2_77 as in2 }; - } - export { inputs_319 as inputs }; - export namespace outputs_319 { - let out_308: string; - export { out_308 as out }; - } - export { outputs_319 as outputs }; - } - namespace ND_fract_float { - let node_320: string; - export { node_320 as node }; - let inherit_320: null; - export { inherit_320 as inherit }; - export namespace inputs_320 { - let _in_25: string; - export { _in_25 as in }; - } - export { inputs_320 as inputs }; - export namespace outputs_320 { - let out_309: string; - export { out_309 as out }; - } - export { outputs_320 as outputs }; - } - namespace ND_fract_color3 { - let node_321: string; - export { node_321 as node }; - let inherit_321: null; - export { inherit_321 as inherit }; - export namespace inputs_321 { - let _in_26: string; - export { _in_26 as in }; - } - export { inputs_321 as inputs }; - export namespace outputs_321 { - let out_310: string; - export { out_310 as out }; - } - export { outputs_321 as outputs }; - } - namespace ND_fract_color4 { - let node_322: string; - export { node_322 as node }; - let inherit_322: null; - export { inherit_322 as inherit }; - export namespace inputs_322 { - let _in_27: string; - export { _in_27 as in }; - } - export { inputs_322 as inputs }; - export namespace outputs_322 { - let out_311: string; - export { out_311 as out }; - } - export { outputs_322 as outputs }; - } - namespace ND_fract_vector2 { - let node_323: string; - export { node_323 as node }; - let inherit_323: null; - export { inherit_323 as inherit }; - export namespace inputs_323 { - let _in_28: string; - export { _in_28 as in }; - } - export { inputs_323 as inputs }; - export namespace outputs_323 { - let out_312: string; - export { out_312 as out }; - } - export { outputs_323 as outputs }; - } - namespace ND_fract_vector3 { - let node_324: string; - export { node_324 as node }; - let inherit_324: null; - export { inherit_324 as inherit }; - export namespace inputs_324 { - let _in_29: string; - export { _in_29 as in }; - } - export { inputs_324 as inputs }; - export namespace outputs_324 { - let out_313: string; - export { out_313 as out }; - } - export { outputs_324 as outputs }; - } - namespace ND_fract_vector4 { - let node_325: string; - export { node_325 as node }; - let inherit_325: null; - export { inherit_325 as inherit }; - export namespace inputs_325 { - let _in_30: string; - export { _in_30 as in }; - } - export { inputs_325 as inputs }; - export namespace outputs_325 { - let out_314: string; - export { out_314 as out }; - } - export { outputs_325 as outputs }; - } - namespace ND_invert_float { - let node_326: string; - export { node_326 as node }; - let inherit_326: null; - export { inherit_326 as inherit }; - export namespace inputs_326 { - let _in_31: string; - export { _in_31 as in }; - export let amount: string; - } - export { inputs_326 as inputs }; - export namespace outputs_326 { - let out_315: string; - export { out_315 as out }; - } - export { outputs_326 as outputs }; - } - namespace ND_invert_color3 { - let node_327: string; - export { node_327 as node }; - let inherit_327: null; - export { inherit_327 as inherit }; - export namespace inputs_327 { - let _in_32: string; - export { _in_32 as in }; - let amount_1: string; - export { amount_1 as amount }; - } - export { inputs_327 as inputs }; - export namespace outputs_327 { - let out_316: string; - export { out_316 as out }; - } - export { outputs_327 as outputs }; - } - namespace ND_invert_color4 { - let node_328: string; - export { node_328 as node }; - let inherit_328: null; - export { inherit_328 as inherit }; - export namespace inputs_328 { - let _in_33: string; - export { _in_33 as in }; - let amount_2: string; - export { amount_2 as amount }; - } - export { inputs_328 as inputs }; - export namespace outputs_328 { - let out_317: string; - export { out_317 as out }; - } - export { outputs_328 as outputs }; - } - namespace ND_invert_vector2 { - let node_329: string; - export { node_329 as node }; - let inherit_329: null; - export { inherit_329 as inherit }; - export namespace inputs_329 { - let _in_34: string; - export { _in_34 as in }; - let amount_3: string; - export { amount_3 as amount }; - } - export { inputs_329 as inputs }; - export namespace outputs_329 { - let out_318: string; - export { out_318 as out }; - } - export { outputs_329 as outputs }; - } - namespace ND_invert_vector3 { - let node_330: string; - export { node_330 as node }; - let inherit_330: null; - export { inherit_330 as inherit }; - export namespace inputs_330 { - let _in_35: string; - export { _in_35 as in }; - let amount_4: string; - export { amount_4 as amount }; - } - export { inputs_330 as inputs }; - export namespace outputs_330 { - let out_319: string; - export { out_319 as out }; - } - export { outputs_330 as outputs }; - } - namespace ND_invert_vector4 { - let node_331: string; - export { node_331 as node }; - let inherit_331: null; - export { inherit_331 as inherit }; - export namespace inputs_331 { - let _in_36: string; - export { _in_36 as in }; - let amount_5: string; - export { amount_5 as amount }; - } - export { inputs_331 as inputs }; - export namespace outputs_331 { - let out_320: string; - export { out_320 as out }; - } - export { outputs_331 as outputs }; - } - namespace ND_invert_color3FA { - let node_332: string; - export { node_332 as node }; - let inherit_332: null; - export { inherit_332 as inherit }; - export namespace inputs_332 { - let _in_37: string; - export { _in_37 as in }; - let amount_6: string; - export { amount_6 as amount }; - } - export { inputs_332 as inputs }; - export namespace outputs_332 { - let out_321: string; - export { out_321 as out }; - } - export { outputs_332 as outputs }; - } - namespace ND_invert_color4FA { - let node_333: string; - export { node_333 as node }; - let inherit_333: null; - export { inherit_333 as inherit }; - export namespace inputs_333 { - let _in_38: string; - export { _in_38 as in }; - let amount_7: string; - export { amount_7 as amount }; - } - export { inputs_333 as inputs }; - export namespace outputs_333 { - let out_322: string; - export { out_322 as out }; - } - export { outputs_333 as outputs }; - } - namespace ND_invert_vector2FA { - let node_334: string; - export { node_334 as node }; - let inherit_334: null; - export { inherit_334 as inherit }; - export namespace inputs_334 { - let _in_39: string; - export { _in_39 as in }; - let amount_8: string; - export { amount_8 as amount }; - } - export { inputs_334 as inputs }; - export namespace outputs_334 { - let out_323: string; - export { out_323 as out }; - } - export { outputs_334 as outputs }; - } - namespace ND_invert_vector3FA { - let node_335: string; - export { node_335 as node }; - let inherit_335: null; - export { inherit_335 as inherit }; - export namespace inputs_335 { - let _in_40: string; - export { _in_40 as in }; - let amount_9: string; - export { amount_9 as amount }; - } - export { inputs_335 as inputs }; - export namespace outputs_335 { - let out_324: string; - export { out_324 as out }; - } - export { outputs_335 as outputs }; - } - namespace ND_invert_vector4FA { - let node_336: string; - export { node_336 as node }; - let inherit_336: null; - export { inherit_336 as inherit }; - export namespace inputs_336 { - let _in_41: string; - export { _in_41 as in }; - let amount_10: string; - export { amount_10 as amount }; - } - export { inputs_336 as inputs }; - export namespace outputs_336 { - let out_325: string; - export { out_325 as out }; - } - export { outputs_336 as outputs }; - } - namespace ND_absval_float { - let node_337: string; - export { node_337 as node }; - let inherit_337: null; - export { inherit_337 as inherit }; - export namespace inputs_337 { - let _in_42: string; - export { _in_42 as in }; - } - export { inputs_337 as inputs }; - export namespace outputs_337 { - let out_326: string; - export { out_326 as out }; - } - export { outputs_337 as outputs }; - } - namespace ND_absval_color3 { - let node_338: string; - export { node_338 as node }; - let inherit_338: null; - export { inherit_338 as inherit }; - export namespace inputs_338 { - let _in_43: string; - export { _in_43 as in }; - } - export { inputs_338 as inputs }; - export namespace outputs_338 { - let out_327: string; - export { out_327 as out }; - } - export { outputs_338 as outputs }; - } - namespace ND_absval_color4 { - let node_339: string; - export { node_339 as node }; - let inherit_339: null; - export { inherit_339 as inherit }; - export namespace inputs_339 { - let _in_44: string; - export { _in_44 as in }; - } - export { inputs_339 as inputs }; - export namespace outputs_339 { - let out_328: string; - export { out_328 as out }; - } - export { outputs_339 as outputs }; - } - namespace ND_absval_vector2 { - let node_340: string; - export { node_340 as node }; - let inherit_340: null; - export { inherit_340 as inherit }; - export namespace inputs_340 { - let _in_45: string; - export { _in_45 as in }; - } - export { inputs_340 as inputs }; - export namespace outputs_340 { - let out_329: string; - export { out_329 as out }; - } - export { outputs_340 as outputs }; - } - namespace ND_absval_vector3 { - let node_341: string; - export { node_341 as node }; - let inherit_341: null; - export { inherit_341 as inherit }; - export namespace inputs_341 { - let _in_46: string; - export { _in_46 as in }; - } - export { inputs_341 as inputs }; - export namespace outputs_341 { - let out_330: string; - export { out_330 as out }; - } - export { outputs_341 as outputs }; - } - namespace ND_absval_vector4 { - let node_342: string; - export { node_342 as node }; - let inherit_342: null; - export { inherit_342 as inherit }; - export namespace inputs_342 { - let _in_47: string; - export { _in_47 as in }; - } - export { inputs_342 as inputs }; - export namespace outputs_342 { - let out_331: string; - export { out_331 as out }; - } - export { outputs_342 as outputs }; - } - namespace ND_floor_float { - let node_343: string; - export { node_343 as node }; - let inherit_343: null; - export { inherit_343 as inherit }; - export namespace inputs_343 { - let _in_48: string; - export { _in_48 as in }; - } - export { inputs_343 as inputs }; - export namespace outputs_343 { - let out_332: string; - export { out_332 as out }; - } - export { outputs_343 as outputs }; - } - namespace ND_floor_color3 { - let node_344: string; - export { node_344 as node }; - let inherit_344: null; - export { inherit_344 as inherit }; - export namespace inputs_344 { - let _in_49: string; - export { _in_49 as in }; - } - export { inputs_344 as inputs }; - export namespace outputs_344 { - let out_333: string; - export { out_333 as out }; - } - export { outputs_344 as outputs }; - } - namespace ND_floor_color4 { - let node_345: string; - export { node_345 as node }; - let inherit_345: null; - export { inherit_345 as inherit }; - export namespace inputs_345 { - let _in_50: string; - export { _in_50 as in }; - } - export { inputs_345 as inputs }; - export namespace outputs_345 { - let out_334: string; - export { out_334 as out }; - } - export { outputs_345 as outputs }; - } - namespace ND_floor_vector2 { - let node_346: string; - export { node_346 as node }; - let inherit_346: null; - export { inherit_346 as inherit }; - export namespace inputs_346 { - let _in_51: string; - export { _in_51 as in }; - } - export { inputs_346 as inputs }; - export namespace outputs_346 { - let out_335: string; - export { out_335 as out }; - } - export { outputs_346 as outputs }; - } - namespace ND_floor_vector3 { - let node_347: string; - export { node_347 as node }; - let inherit_347: null; - export { inherit_347 as inherit }; - export namespace inputs_347 { - let _in_52: string; - export { _in_52 as in }; - } - export { inputs_347 as inputs }; - export namespace outputs_347 { - let out_336: string; - export { out_336 as out }; - } - export { outputs_347 as outputs }; - } - namespace ND_floor_vector4 { - let node_348: string; - export { node_348 as node }; - let inherit_348: null; - export { inherit_348 as inherit }; - export namespace inputs_348 { - let _in_53: string; - export { _in_53 as in }; - } - export { inputs_348 as inputs }; - export namespace outputs_348 { - let out_337: string; - export { out_337 as out }; - } - export { outputs_348 as outputs }; - } - namespace ND_floor_integer { - let node_349: string; - export { node_349 as node }; - let inherit_349: null; - export { inherit_349 as inherit }; - export namespace inputs_349 { - let _in_54: string; - export { _in_54 as in }; - } - export { inputs_349 as inputs }; - export namespace outputs_349 { - let out_338: string; - export { out_338 as out }; - } - export { outputs_349 as outputs }; - } - namespace ND_ceil_float { - let node_350: string; - export { node_350 as node }; - let inherit_350: null; - export { inherit_350 as inherit }; - export namespace inputs_350 { - let _in_55: string; - export { _in_55 as in }; - } - export { inputs_350 as inputs }; - export namespace outputs_350 { - let out_339: string; - export { out_339 as out }; - } - export { outputs_350 as outputs }; - } - namespace ND_ceil_color3 { - let node_351: string; - export { node_351 as node }; - let inherit_351: null; - export { inherit_351 as inherit }; - export namespace inputs_351 { - let _in_56: string; - export { _in_56 as in }; - } - export { inputs_351 as inputs }; - export namespace outputs_351 { - let out_340: string; - export { out_340 as out }; - } - export { outputs_351 as outputs }; - } - namespace ND_ceil_color4 { - let node_352: string; - export { node_352 as node }; - let inherit_352: null; - export { inherit_352 as inherit }; - export namespace inputs_352 { - let _in_57: string; - export { _in_57 as in }; - } - export { inputs_352 as inputs }; - export namespace outputs_352 { - let out_341: string; - export { out_341 as out }; - } - export { outputs_352 as outputs }; - } - namespace ND_ceil_vector2 { - let node_353: string; - export { node_353 as node }; - let inherit_353: null; - export { inherit_353 as inherit }; - export namespace inputs_353 { - let _in_58: string; - export { _in_58 as in }; - } - export { inputs_353 as inputs }; - export namespace outputs_353 { - let out_342: string; - export { out_342 as out }; - } - export { outputs_353 as outputs }; - } - namespace ND_ceil_vector3 { - let node_354: string; - export { node_354 as node }; - let inherit_354: null; - export { inherit_354 as inherit }; - export namespace inputs_354 { - let _in_59: string; - export { _in_59 as in }; - } - export { inputs_354 as inputs }; - export namespace outputs_354 { - let out_343: string; - export { out_343 as out }; - } - export { outputs_354 as outputs }; - } - namespace ND_ceil_vector4 { - let node_355: string; - export { node_355 as node }; - let inherit_355: null; - export { inherit_355 as inherit }; - export namespace inputs_355 { - let _in_60: string; - export { _in_60 as in }; - } - export { inputs_355 as inputs }; - export namespace outputs_355 { - let out_344: string; - export { out_344 as out }; - } - export { outputs_355 as outputs }; - } - namespace ND_ceil_integer { - let node_356: string; - export { node_356 as node }; - let inherit_356: null; - export { inherit_356 as inherit }; - export namespace inputs_356 { - let _in_61: string; - export { _in_61 as in }; - } - export { inputs_356 as inputs }; - export namespace outputs_356 { - let out_345: string; - export { out_345 as out }; - } - export { outputs_356 as outputs }; - } - namespace ND_round_float { - let node_357: string; - export { node_357 as node }; - let inherit_357: null; - export { inherit_357 as inherit }; - export namespace inputs_357 { - let _in_62: string; - export { _in_62 as in }; - } - export { inputs_357 as inputs }; - export namespace outputs_357 { - let out_346: string; - export { out_346 as out }; - } - export { outputs_357 as outputs }; - } - namespace ND_round_color3 { - let node_358: string; - export { node_358 as node }; - let inherit_358: null; - export { inherit_358 as inherit }; - export namespace inputs_358 { - let _in_63: string; - export { _in_63 as in }; - } - export { inputs_358 as inputs }; - export namespace outputs_358 { - let out_347: string; - export { out_347 as out }; - } - export { outputs_358 as outputs }; - } - namespace ND_round_color4 { - let node_359: string; - export { node_359 as node }; - let inherit_359: null; - export { inherit_359 as inherit }; - export namespace inputs_359 { - let _in_64: string; - export { _in_64 as in }; - } - export { inputs_359 as inputs }; - export namespace outputs_359 { - let out_348: string; - export { out_348 as out }; - } - export { outputs_359 as outputs }; - } - namespace ND_round_vector2 { - let node_360: string; - export { node_360 as node }; - let inherit_360: null; - export { inherit_360 as inherit }; - export namespace inputs_360 { - let _in_65: string; - export { _in_65 as in }; - } - export { inputs_360 as inputs }; - export namespace outputs_360 { - let out_349: string; - export { out_349 as out }; - } - export { outputs_360 as outputs }; - } - namespace ND_round_vector3 { - let node_361: string; - export { node_361 as node }; - let inherit_361: null; - export { inherit_361 as inherit }; - export namespace inputs_361 { - let _in_66: string; - export { _in_66 as in }; - } - export { inputs_361 as inputs }; - export namespace outputs_361 { - let out_350: string; - export { out_350 as out }; - } - export { outputs_361 as outputs }; - } - namespace ND_round_vector4 { - let node_362: string; - export { node_362 as node }; - let inherit_362: null; - export { inherit_362 as inherit }; - export namespace inputs_362 { - let _in_67: string; - export { _in_67 as in }; - } - export { inputs_362 as inputs }; - export namespace outputs_362 { - let out_351: string; - export { out_351 as out }; - } - export { outputs_362 as outputs }; - } - namespace ND_round_integer { - let node_363: string; - export { node_363 as node }; - let inherit_363: null; - export { inherit_363 as inherit }; - export namespace inputs_363 { - let _in_68: string; - export { _in_68 as in }; - } - export { inputs_363 as inputs }; - export namespace outputs_363 { - let out_352: string; - export { out_352 as out }; - } - export { outputs_363 as outputs }; - } - namespace ND_power_float { - let node_364: string; - export { node_364 as node }; - let inherit_364: null; - export { inherit_364 as inherit }; - export namespace inputs_364 { - let in1_78: string; - export { in1_78 as in1 }; - let in2_78: string; - export { in2_78 as in2 }; - } - export { inputs_364 as inputs }; - export namespace outputs_364 { - let out_353: string; - export { out_353 as out }; - } - export { outputs_364 as outputs }; - } - namespace ND_power_color3 { - let node_365: string; - export { node_365 as node }; - let inherit_365: null; - export { inherit_365 as inherit }; - export namespace inputs_365 { - let in1_79: string; - export { in1_79 as in1 }; - let in2_79: string; - export { in2_79 as in2 }; - } - export { inputs_365 as inputs }; - export namespace outputs_365 { - let out_354: string; - export { out_354 as out }; - } - export { outputs_365 as outputs }; - } - namespace ND_power_color4 { - let node_366: string; - export { node_366 as node }; - let inherit_366: null; - export { inherit_366 as inherit }; - export namespace inputs_366 { - let in1_80: string; - export { in1_80 as in1 }; - let in2_80: string; - export { in2_80 as in2 }; - } - export { inputs_366 as inputs }; - export namespace outputs_366 { - let out_355: string; - export { out_355 as out }; - } - export { outputs_366 as outputs }; - } - namespace ND_power_vector2 { - let node_367: string; - export { node_367 as node }; - let inherit_367: null; - export { inherit_367 as inherit }; - export namespace inputs_367 { - let in1_81: string; - export { in1_81 as in1 }; - let in2_81: string; - export { in2_81 as in2 }; - } - export { inputs_367 as inputs }; - export namespace outputs_367 { - let out_356: string; - export { out_356 as out }; - } - export { outputs_367 as outputs }; - } - namespace ND_power_vector3 { - let node_368: string; - export { node_368 as node }; - let inherit_368: null; - export { inherit_368 as inherit }; - export namespace inputs_368 { - let in1_82: string; - export { in1_82 as in1 }; - let in2_82: string; - export { in2_82 as in2 }; - } - export { inputs_368 as inputs }; - export namespace outputs_368 { - let out_357: string; - export { out_357 as out }; - } - export { outputs_368 as outputs }; - } - namespace ND_power_vector4 { - let node_369: string; - export { node_369 as node }; - let inherit_369: null; - export { inherit_369 as inherit }; - export namespace inputs_369 { - let in1_83: string; - export { in1_83 as in1 }; - let in2_83: string; - export { in2_83 as in2 }; - } - export { inputs_369 as inputs }; - export namespace outputs_369 { - let out_358: string; - export { out_358 as out }; - } - export { outputs_369 as outputs }; - } - namespace ND_power_color3FA { - let node_370: string; - export { node_370 as node }; - let inherit_370: null; - export { inherit_370 as inherit }; - export namespace inputs_370 { - let in1_84: string; - export { in1_84 as in1 }; - let in2_84: string; - export { in2_84 as in2 }; - } - export { inputs_370 as inputs }; - export namespace outputs_370 { - let out_359: string; - export { out_359 as out }; - } - export { outputs_370 as outputs }; - } - namespace ND_power_color4FA { - let node_371: string; - export { node_371 as node }; - let inherit_371: null; - export { inherit_371 as inherit }; - export namespace inputs_371 { - let in1_85: string; - export { in1_85 as in1 }; - let in2_85: string; - export { in2_85 as in2 }; - } - export { inputs_371 as inputs }; - export namespace outputs_371 { - let out_360: string; - export { out_360 as out }; - } - export { outputs_371 as outputs }; - } - namespace ND_power_vector2FA { - let node_372: string; - export { node_372 as node }; - let inherit_372: null; - export { inherit_372 as inherit }; - export namespace inputs_372 { - let in1_86: string; - export { in1_86 as in1 }; - let in2_86: string; - export { in2_86 as in2 }; - } - export { inputs_372 as inputs }; - export namespace outputs_372 { - let out_361: string; - export { out_361 as out }; - } - export { outputs_372 as outputs }; - } - namespace ND_power_vector3FA { - let node_373: string; - export { node_373 as node }; - let inherit_373: null; - export { inherit_373 as inherit }; - export namespace inputs_373 { - let in1_87: string; - export { in1_87 as in1 }; - let in2_87: string; - export { in2_87 as in2 }; - } - export { inputs_373 as inputs }; - export namespace outputs_373 { - let out_362: string; - export { out_362 as out }; - } - export { outputs_373 as outputs }; - } - namespace ND_power_vector4FA { - let node_374: string; - export { node_374 as node }; - let inherit_374: null; - export { inherit_374 as inherit }; - export namespace inputs_374 { - let in1_88: string; - export { in1_88 as in1 }; - let in2_88: string; - export { in2_88 as in2 }; - } - export { inputs_374 as inputs }; - export namespace outputs_374 { - let out_363: string; - export { out_363 as out }; - } - export { outputs_374 as outputs }; - } - namespace ND_safepower_float { - let node_375: string; - export { node_375 as node }; - let inherit_375: null; - export { inherit_375 as inherit }; - export namespace inputs_375 { - let in1_89: string; - export { in1_89 as in1 }; - let in2_89: string; - export { in2_89 as in2 }; - } - export { inputs_375 as inputs }; - export namespace outputs_375 { - let out_364: string; - export { out_364 as out }; - } - export { outputs_375 as outputs }; - } - namespace ND_safepower_color3 { - let node_376: string; - export { node_376 as node }; - let inherit_376: null; - export { inherit_376 as inherit }; - export namespace inputs_376 { - let in1_90: string; - export { in1_90 as in1 }; - let in2_90: string; - export { in2_90 as in2 }; - } - export { inputs_376 as inputs }; - export namespace outputs_376 { - let out_365: string; - export { out_365 as out }; - } - export { outputs_376 as outputs }; - } - namespace ND_safepower_color4 { - let node_377: string; - export { node_377 as node }; - let inherit_377: null; - export { inherit_377 as inherit }; - export namespace inputs_377 { - let in1_91: string; - export { in1_91 as in1 }; - let in2_91: string; - export { in2_91 as in2 }; - } - export { inputs_377 as inputs }; - export namespace outputs_377 { - let out_366: string; - export { out_366 as out }; - } - export { outputs_377 as outputs }; - } - namespace ND_safepower_vector2 { - let node_378: string; - export { node_378 as node }; - let inherit_378: null; - export { inherit_378 as inherit }; - export namespace inputs_378 { - let in1_92: string; - export { in1_92 as in1 }; - let in2_92: string; - export { in2_92 as in2 }; - } - export { inputs_378 as inputs }; - export namespace outputs_378 { - let out_367: string; - export { out_367 as out }; - } - export { outputs_378 as outputs }; - } - namespace ND_safepower_vector3 { - let node_379: string; - export { node_379 as node }; - let inherit_379: null; - export { inherit_379 as inherit }; - export namespace inputs_379 { - let in1_93: string; - export { in1_93 as in1 }; - let in2_93: string; - export { in2_93 as in2 }; - } - export { inputs_379 as inputs }; - export namespace outputs_379 { - let out_368: string; - export { out_368 as out }; - } - export { outputs_379 as outputs }; - } - namespace ND_safepower_vector4 { - let node_380: string; - export { node_380 as node }; - let inherit_380: null; - export { inherit_380 as inherit }; - export namespace inputs_380 { - let in1_94: string; - export { in1_94 as in1 }; - let in2_94: string; - export { in2_94 as in2 }; - } - export { inputs_380 as inputs }; - export namespace outputs_380 { - let out_369: string; - export { out_369 as out }; - } - export { outputs_380 as outputs }; - } - namespace ND_safepower_color3FA { - let node_381: string; - export { node_381 as node }; - let inherit_381: null; - export { inherit_381 as inherit }; - export namespace inputs_381 { - let in1_95: string; - export { in1_95 as in1 }; - let in2_95: string; - export { in2_95 as in2 }; - } - export { inputs_381 as inputs }; - export namespace outputs_381 { - let out_370: string; - export { out_370 as out }; - } - export { outputs_381 as outputs }; - } - namespace ND_safepower_color4FA { - let node_382: string; - export { node_382 as node }; - let inherit_382: null; - export { inherit_382 as inherit }; - export namespace inputs_382 { - let in1_96: string; - export { in1_96 as in1 }; - let in2_96: string; - export { in2_96 as in2 }; - } - export { inputs_382 as inputs }; - export namespace outputs_382 { - let out_371: string; - export { out_371 as out }; - } - export { outputs_382 as outputs }; - } - namespace ND_safepower_vector2FA { - let node_383: string; - export { node_383 as node }; - let inherit_383: null; - export { inherit_383 as inherit }; - export namespace inputs_383 { - let in1_97: string; - export { in1_97 as in1 }; - let in2_97: string; - export { in2_97 as in2 }; - } - export { inputs_383 as inputs }; - export namespace outputs_383 { - let out_372: string; - export { out_372 as out }; - } - export { outputs_383 as outputs }; - } - namespace ND_safepower_vector3FA { - let node_384: string; - export { node_384 as node }; - let inherit_384: null; - export { inherit_384 as inherit }; - export namespace inputs_384 { - let in1_98: string; - export { in1_98 as in1 }; - let in2_98: string; - export { in2_98 as in2 }; - } - export { inputs_384 as inputs }; - export namespace outputs_384 { - let out_373: string; - export { out_373 as out }; - } - export { outputs_384 as outputs }; - } - namespace ND_safepower_vector4FA { - let node_385: string; - export { node_385 as node }; - let inherit_385: null; - export { inherit_385 as inherit }; - export namespace inputs_385 { - let in1_99: string; - export { in1_99 as in1 }; - let in2_99: string; - export { in2_99 as in2 }; - } - export { inputs_385 as inputs }; - export namespace outputs_385 { - let out_374: string; - export { out_374 as out }; - } - export { outputs_385 as outputs }; - } - namespace ND_sin_float { - let node_386: string; - export { node_386 as node }; - let inherit_386: null; - export { inherit_386 as inherit }; - export namespace inputs_386 { - let _in_69: string; - export { _in_69 as in }; - } - export { inputs_386 as inputs }; - export namespace outputs_386 { - let out_375: string; - export { out_375 as out }; - } - export { outputs_386 as outputs }; - } - namespace ND_cos_float { - let node_387: string; - export { node_387 as node }; - let inherit_387: null; - export { inherit_387 as inherit }; - export namespace inputs_387 { - let _in_70: string; - export { _in_70 as in }; - } - export { inputs_387 as inputs }; - export namespace outputs_387 { - let out_376: string; - export { out_376 as out }; - } - export { outputs_387 as outputs }; - } - namespace ND_tan_float { - let node_388: string; - export { node_388 as node }; - let inherit_388: null; - export { inherit_388 as inherit }; - export namespace inputs_388 { - let _in_71: string; - export { _in_71 as in }; - } - export { inputs_388 as inputs }; - export namespace outputs_388 { - let out_377: string; - export { out_377 as out }; - } - export { outputs_388 as outputs }; - } - namespace ND_asin_float { - let node_389: string; - export { node_389 as node }; - let inherit_389: null; - export { inherit_389 as inherit }; - export namespace inputs_389 { - let _in_72: string; - export { _in_72 as in }; - } - export { inputs_389 as inputs }; - export namespace outputs_389 { - let out_378: string; - export { out_378 as out }; - } - export { outputs_389 as outputs }; - } - namespace ND_acos_float { - let node_390: string; - export { node_390 as node }; - let inherit_390: null; - export { inherit_390 as inherit }; - export namespace inputs_390 { - let _in_73: string; - export { _in_73 as in }; - } - export { inputs_390 as inputs }; - export namespace outputs_390 { - let out_379: string; - export { out_379 as out }; - } - export { outputs_390 as outputs }; - } - namespace ND_atan2_float { - let node_391: string; - export { node_391 as node }; - let inherit_391: null; - export { inherit_391 as inherit }; - export namespace inputs_391 { - let iny: string; - let inx: string; - } - export { inputs_391 as inputs }; - export namespace outputs_391 { - let out_380: string; - export { out_380 as out }; - } - export { outputs_391 as outputs }; - } - namespace ND_sin_vector2 { - let node_392: string; - export { node_392 as node }; - let inherit_392: null; - export { inherit_392 as inherit }; - export namespace inputs_392 { - let _in_74: string; - export { _in_74 as in }; - } - export { inputs_392 as inputs }; - export namespace outputs_392 { - let out_381: string; - export { out_381 as out }; - } - export { outputs_392 as outputs }; - } - namespace ND_cos_vector2 { - let node_393: string; - export { node_393 as node }; - let inherit_393: null; - export { inherit_393 as inherit }; - export namespace inputs_393 { - let _in_75: string; - export { _in_75 as in }; - } - export { inputs_393 as inputs }; - export namespace outputs_393 { - let out_382: string; - export { out_382 as out }; - } - export { outputs_393 as outputs }; - } - namespace ND_tan_vector2 { - let node_394: string; - export { node_394 as node }; - let inherit_394: null; - export { inherit_394 as inherit }; - export namespace inputs_394 { - let _in_76: string; - export { _in_76 as in }; - } - export { inputs_394 as inputs }; - export namespace outputs_394 { - let out_383: string; - export { out_383 as out }; - } - export { outputs_394 as outputs }; - } - namespace ND_asin_vector2 { - let node_395: string; - export { node_395 as node }; - let inherit_395: null; - export { inherit_395 as inherit }; - export namespace inputs_395 { - let _in_77: string; - export { _in_77 as in }; - } - export { inputs_395 as inputs }; - export namespace outputs_395 { - let out_384: string; - export { out_384 as out }; - } - export { outputs_395 as outputs }; - } - namespace ND_acos_vector2 { - let node_396: string; - export { node_396 as node }; - let inherit_396: null; - export { inherit_396 as inherit }; - export namespace inputs_396 { - let _in_78: string; - export { _in_78 as in }; - } - export { inputs_396 as inputs }; - export namespace outputs_396 { - let out_385: string; - export { out_385 as out }; - } - export { outputs_396 as outputs }; - } - namespace ND_atan2_vector2 { - let node_397: string; - export { node_397 as node }; - let inherit_397: null; - export { inherit_397 as inherit }; - export namespace inputs_397 { - let iny_1: string; - export { iny_1 as iny }; - let inx_1: string; - export { inx_1 as inx }; - } - export { inputs_397 as inputs }; - export namespace outputs_397 { - let out_386: string; - export { out_386 as out }; - } - export { outputs_397 as outputs }; - } - namespace ND_sin_vector3 { - let node_398: string; - export { node_398 as node }; - let inherit_398: null; - export { inherit_398 as inherit }; - export namespace inputs_398 { - let _in_79: string; - export { _in_79 as in }; - } - export { inputs_398 as inputs }; - export namespace outputs_398 { - let out_387: string; - export { out_387 as out }; - } - export { outputs_398 as outputs }; - } - namespace ND_cos_vector3 { - let node_399: string; - export { node_399 as node }; - let inherit_399: null; - export { inherit_399 as inherit }; - export namespace inputs_399 { - let _in_80: string; - export { _in_80 as in }; - } - export { inputs_399 as inputs }; - export namespace outputs_399 { - let out_388: string; - export { out_388 as out }; - } - export { outputs_399 as outputs }; - } - namespace ND_tan_vector3 { - let node_400: string; - export { node_400 as node }; - let inherit_400: null; - export { inherit_400 as inherit }; - export namespace inputs_400 { - let _in_81: string; - export { _in_81 as in }; - } - export { inputs_400 as inputs }; - export namespace outputs_400 { - let out_389: string; - export { out_389 as out }; - } - export { outputs_400 as outputs }; - } - namespace ND_asin_vector3 { - let node_401: string; - export { node_401 as node }; - let inherit_401: null; - export { inherit_401 as inherit }; - export namespace inputs_401 { - let _in_82: string; - export { _in_82 as in }; - } - export { inputs_401 as inputs }; - export namespace outputs_401 { - let out_390: string; - export { out_390 as out }; - } - export { outputs_401 as outputs }; - } - namespace ND_acos_vector3 { - let node_402: string; - export { node_402 as node }; - let inherit_402: null; - export { inherit_402 as inherit }; - export namespace inputs_402 { - let _in_83: string; - export { _in_83 as in }; - } - export { inputs_402 as inputs }; - export namespace outputs_402 { - let out_391: string; - export { out_391 as out }; - } - export { outputs_402 as outputs }; - } - namespace ND_atan2_vector3 { - let node_403: string; - export { node_403 as node }; - let inherit_403: null; - export { inherit_403 as inherit }; - export namespace inputs_403 { - let iny_2: string; - export { iny_2 as iny }; - let inx_2: string; - export { inx_2 as inx }; - } - export { inputs_403 as inputs }; - export namespace outputs_403 { - let out_392: string; - export { out_392 as out }; - } - export { outputs_403 as outputs }; - } - namespace ND_sin_vector4 { - let node_404: string; - export { node_404 as node }; - let inherit_404: null; - export { inherit_404 as inherit }; - export namespace inputs_404 { - let _in_84: string; - export { _in_84 as in }; - } - export { inputs_404 as inputs }; - export namespace outputs_404 { - let out_393: string; - export { out_393 as out }; - } - export { outputs_404 as outputs }; - } - namespace ND_cos_vector4 { - let node_405: string; - export { node_405 as node }; - let inherit_405: null; - export { inherit_405 as inherit }; - export namespace inputs_405 { - let _in_85: string; - export { _in_85 as in }; - } - export { inputs_405 as inputs }; - export namespace outputs_405 { - let out_394: string; - export { out_394 as out }; - } - export { outputs_405 as outputs }; - } - namespace ND_tan_vector4 { - let node_406: string; - export { node_406 as node }; - let inherit_406: null; - export { inherit_406 as inherit }; - export namespace inputs_406 { - let _in_86: string; - export { _in_86 as in }; - } - export { inputs_406 as inputs }; - export namespace outputs_406 { - let out_395: string; - export { out_395 as out }; - } - export { outputs_406 as outputs }; - } - namespace ND_asin_vector4 { - let node_407: string; - export { node_407 as node }; - let inherit_407: null; - export { inherit_407 as inherit }; - export namespace inputs_407 { - let _in_87: string; - export { _in_87 as in }; - } - export { inputs_407 as inputs }; - export namespace outputs_407 { - let out_396: string; - export { out_396 as out }; - } - export { outputs_407 as outputs }; - } - namespace ND_acos_vector4 { - let node_408: string; - export { node_408 as node }; - let inherit_408: null; - export { inherit_408 as inherit }; - export namespace inputs_408 { - let _in_88: string; - export { _in_88 as in }; - } - export { inputs_408 as inputs }; - export namespace outputs_408 { - let out_397: string; - export { out_397 as out }; - } - export { outputs_408 as outputs }; - } - namespace ND_atan2_vector4 { - let node_409: string; - export { node_409 as node }; - let inherit_409: null; - export { inherit_409 as inherit }; - export namespace inputs_409 { - let iny_3: string; - export { iny_3 as iny }; - let inx_3: string; - export { inx_3 as inx }; - } - export { inputs_409 as inputs }; - export namespace outputs_409 { - let out_398: string; - export { out_398 as out }; - } - export { outputs_409 as outputs }; - } - namespace ND_sqrt_float { - let node_410: string; - export { node_410 as node }; - let inherit_410: null; - export { inherit_410 as inherit }; - export namespace inputs_410 { - let _in_89: string; - export { _in_89 as in }; - } - export { inputs_410 as inputs }; - export namespace outputs_410 { - let out_399: string; - export { out_399 as out }; - } - export { outputs_410 as outputs }; - } - namespace ND_ln_float { - let node_411: string; - export { node_411 as node }; - let inherit_411: null; - export { inherit_411 as inherit }; - export namespace inputs_411 { - let _in_90: string; - export { _in_90 as in }; - } - export { inputs_411 as inputs }; - export namespace outputs_411 { - let out_400: string; - export { out_400 as out }; - } - export { outputs_411 as outputs }; - } - namespace ND_exp_float { - let node_412: string; - export { node_412 as node }; - let inherit_412: null; - export { inherit_412 as inherit }; - export namespace inputs_412 { - let _in_91: string; - export { _in_91 as in }; - } - export { inputs_412 as inputs }; - export namespace outputs_412 { - let out_401: string; - export { out_401 as out }; - } - export { outputs_412 as outputs }; - } - namespace ND_sqrt_vector2 { - let node_413: string; - export { node_413 as node }; - let inherit_413: null; - export { inherit_413 as inherit }; - export namespace inputs_413 { - let _in_92: string; - export { _in_92 as in }; - } - export { inputs_413 as inputs }; - export namespace outputs_413 { - let out_402: string; - export { out_402 as out }; - } - export { outputs_413 as outputs }; - } - namespace ND_ln_vector2 { - let node_414: string; - export { node_414 as node }; - let inherit_414: null; - export { inherit_414 as inherit }; - export namespace inputs_414 { - let _in_93: string; - export { _in_93 as in }; - } - export { inputs_414 as inputs }; - export namespace outputs_414 { - let out_403: string; - export { out_403 as out }; - } - export { outputs_414 as outputs }; - } - namespace ND_exp_vector2 { - let node_415: string; - export { node_415 as node }; - let inherit_415: null; - export { inherit_415 as inherit }; - export namespace inputs_415 { - let _in_94: string; - export { _in_94 as in }; - } - export { inputs_415 as inputs }; - export namespace outputs_415 { - let out_404: string; - export { out_404 as out }; - } - export { outputs_415 as outputs }; - } - namespace ND_sqrt_vector3 { - let node_416: string; - export { node_416 as node }; - let inherit_416: null; - export { inherit_416 as inherit }; - export namespace inputs_416 { - let _in_95: string; - export { _in_95 as in }; - } - export { inputs_416 as inputs }; - export namespace outputs_416 { - let out_405: string; - export { out_405 as out }; - } - export { outputs_416 as outputs }; - } - namespace ND_ln_vector3 { - let node_417: string; - export { node_417 as node }; - let inherit_417: null; - export { inherit_417 as inherit }; - export namespace inputs_417 { - let _in_96: string; - export { _in_96 as in }; - } - export { inputs_417 as inputs }; - export namespace outputs_417 { - let out_406: string; - export { out_406 as out }; - } - export { outputs_417 as outputs }; - } - namespace ND_exp_vector3 { - let node_418: string; - export { node_418 as node }; - let inherit_418: null; - export { inherit_418 as inherit }; - export namespace inputs_418 { - let _in_97: string; - export { _in_97 as in }; - } - export { inputs_418 as inputs }; - export namespace outputs_418 { - let out_407: string; - export { out_407 as out }; - } - export { outputs_418 as outputs }; - } - namespace ND_sqrt_vector4 { - let node_419: string; - export { node_419 as node }; - let inherit_419: null; - export { inherit_419 as inherit }; - export namespace inputs_419 { - let _in_98: string; - export { _in_98 as in }; - } - export { inputs_419 as inputs }; - export namespace outputs_419 { - let out_408: string; - export { out_408 as out }; - } - export { outputs_419 as outputs }; - } - namespace ND_ln_vector4 { - let node_420: string; - export { node_420 as node }; - let inherit_420: null; - export { inherit_420 as inherit }; - export namespace inputs_420 { - let _in_99: string; - export { _in_99 as in }; - } - export { inputs_420 as inputs }; - export namespace outputs_420 { - let out_409: string; - export { out_409 as out }; - } - export { outputs_420 as outputs }; - } - namespace ND_exp_vector4 { - let node_421: string; - export { node_421 as node }; - let inherit_421: null; - export { inherit_421 as inherit }; - export namespace inputs_421 { - let _in_100: string; - export { _in_100 as in }; - } - export { inputs_421 as inputs }; - export namespace outputs_421 { - let out_410: string; - export { out_410 as out }; - } - export { outputs_421 as outputs }; - } - namespace ND_sign_float { - let node_422: string; - export { node_422 as node }; - let inherit_422: null; - export { inherit_422 as inherit }; - export namespace inputs_422 { - let _in_101: string; - export { _in_101 as in }; - } - export { inputs_422 as inputs }; - export namespace outputs_422 { - let out_411: string; - export { out_411 as out }; - } - export { outputs_422 as outputs }; - } - namespace ND_sign_color3 { - let node_423: string; - export { node_423 as node }; - let inherit_423: null; - export { inherit_423 as inherit }; - export namespace inputs_423 { - let _in_102: string; - export { _in_102 as in }; - } - export { inputs_423 as inputs }; - export namespace outputs_423 { - let out_412: string; - export { out_412 as out }; - } - export { outputs_423 as outputs }; - } - namespace ND_sign_color4 { - let node_424: string; - export { node_424 as node }; - let inherit_424: null; - export { inherit_424 as inherit }; - export namespace inputs_424 { - let _in_103: string; - export { _in_103 as in }; - } - export { inputs_424 as inputs }; - export namespace outputs_424 { - let out_413: string; - export { out_413 as out }; - } - export { outputs_424 as outputs }; - } - namespace ND_sign_vector2 { - let node_425: string; - export { node_425 as node }; - let inherit_425: null; - export { inherit_425 as inherit }; - export namespace inputs_425 { - let _in_104: string; - export { _in_104 as in }; - } - export { inputs_425 as inputs }; - export namespace outputs_425 { - let out_414: string; - export { out_414 as out }; - } - export { outputs_425 as outputs }; - } - namespace ND_sign_vector3 { - let node_426: string; - export { node_426 as node }; - let inherit_426: null; - export { inherit_426 as inherit }; - export namespace inputs_426 { - let _in_105: string; - export { _in_105 as in }; - } - export { inputs_426 as inputs }; - export namespace outputs_426 { - let out_415: string; - export { out_415 as out }; - } - export { outputs_426 as outputs }; - } - namespace ND_sign_vector4 { - let node_427: string; - export { node_427 as node }; - let inherit_427: null; - export { inherit_427 as inherit }; - export namespace inputs_427 { - let _in_106: string; - export { _in_106 as in }; - } - export { inputs_427 as inputs }; - export namespace outputs_427 { - let out_416: string; - export { out_416 as out }; - } - export { outputs_427 as outputs }; - } - namespace ND_clamp_float { - let node_428: string; - export { node_428 as node }; - let inherit_428: null; - export { inherit_428 as inherit }; - export namespace inputs_428 { - let _in_107: string; - export { _in_107 as in }; - export let low: string; - export let high: string; - } - export { inputs_428 as inputs }; - export namespace outputs_428 { - let out_417: string; - export { out_417 as out }; - } - export { outputs_428 as outputs }; - } - namespace ND_clamp_color3 { - let node_429: string; - export { node_429 as node }; - let inherit_429: null; - export { inherit_429 as inherit }; - export namespace inputs_429 { - let _in_108: string; - export { _in_108 as in }; - let low_1: string; - export { low_1 as low }; - let high_1: string; - export { high_1 as high }; - } - export { inputs_429 as inputs }; - export namespace outputs_429 { - let out_418: string; - export { out_418 as out }; - } - export { outputs_429 as outputs }; - } - namespace ND_clamp_color4 { - let node_430: string; - export { node_430 as node }; - let inherit_430: null; - export { inherit_430 as inherit }; - export namespace inputs_430 { - let _in_109: string; - export { _in_109 as in }; - let low_2: string; - export { low_2 as low }; - let high_2: string; - export { high_2 as high }; - } - export { inputs_430 as inputs }; - export namespace outputs_430 { - let out_419: string; - export { out_419 as out }; - } - export { outputs_430 as outputs }; - } - namespace ND_clamp_vector2 { - let node_431: string; - export { node_431 as node }; - let inherit_431: null; - export { inherit_431 as inherit }; - export namespace inputs_431 { - let _in_110: string; - export { _in_110 as in }; - let low_3: string; - export { low_3 as low }; - let high_3: string; - export { high_3 as high }; - } - export { inputs_431 as inputs }; - export namespace outputs_431 { - let out_420: string; - export { out_420 as out }; - } - export { outputs_431 as outputs }; - } - namespace ND_clamp_vector3 { - let node_432: string; - export { node_432 as node }; - let inherit_432: null; - export { inherit_432 as inherit }; - export namespace inputs_432 { - let _in_111: string; - export { _in_111 as in }; - let low_4: string; - export { low_4 as low }; - let high_4: string; - export { high_4 as high }; - } - export { inputs_432 as inputs }; - export namespace outputs_432 { - let out_421: string; - export { out_421 as out }; - } - export { outputs_432 as outputs }; - } - namespace ND_clamp_vector4 { - let node_433: string; - export { node_433 as node }; - let inherit_433: null; - export { inherit_433 as inherit }; - export namespace inputs_433 { - let _in_112: string; - export { _in_112 as in }; - let low_5: string; - export { low_5 as low }; - let high_5: string; - export { high_5 as high }; - } - export { inputs_433 as inputs }; - export namespace outputs_433 { - let out_422: string; - export { out_422 as out }; - } - export { outputs_433 as outputs }; - } - namespace ND_clamp_color3FA { - let node_434: string; - export { node_434 as node }; - let inherit_434: null; - export { inherit_434 as inherit }; - export namespace inputs_434 { - let _in_113: string; - export { _in_113 as in }; - let low_6: string; - export { low_6 as low }; - let high_6: string; - export { high_6 as high }; - } - export { inputs_434 as inputs }; - export namespace outputs_434 { - let out_423: string; - export { out_423 as out }; - } - export { outputs_434 as outputs }; - } - namespace ND_clamp_color4FA { - let node_435: string; - export { node_435 as node }; - let inherit_435: null; - export { inherit_435 as inherit }; - export namespace inputs_435 { - let _in_114: string; - export { _in_114 as in }; - let low_7: string; - export { low_7 as low }; - let high_7: string; - export { high_7 as high }; - } - export { inputs_435 as inputs }; - export namespace outputs_435 { - let out_424: string; - export { out_424 as out }; - } - export { outputs_435 as outputs }; - } - namespace ND_clamp_vector2FA { - let node_436: string; - export { node_436 as node }; - let inherit_436: null; - export { inherit_436 as inherit }; - export namespace inputs_436 { - let _in_115: string; - export { _in_115 as in }; - let low_8: string; - export { low_8 as low }; - let high_8: string; - export { high_8 as high }; - } - export { inputs_436 as inputs }; - export namespace outputs_436 { - let out_425: string; - export { out_425 as out }; - } - export { outputs_436 as outputs }; - } - namespace ND_clamp_vector3FA { - let node_437: string; - export { node_437 as node }; - let inherit_437: null; - export { inherit_437 as inherit }; - export namespace inputs_437 { - let _in_116: string; - export { _in_116 as in }; - let low_9: string; - export { low_9 as low }; - let high_9: string; - export { high_9 as high }; - } - export { inputs_437 as inputs }; - export namespace outputs_437 { - let out_426: string; - export { out_426 as out }; - } - export { outputs_437 as outputs }; - } - namespace ND_clamp_vector4FA { - let node_438: string; - export { node_438 as node }; - let inherit_438: null; - export { inherit_438 as inherit }; - export namespace inputs_438 { - let _in_117: string; - export { _in_117 as in }; - let low_10: string; - export { low_10 as low }; - let high_10: string; - export { high_10 as high }; - } - export { inputs_438 as inputs }; - export namespace outputs_438 { - let out_427: string; - export { out_427 as out }; - } - export { outputs_438 as outputs }; - } - namespace ND_min_float { - let node_439: string; - export { node_439 as node }; - let inherit_439: null; - export { inherit_439 as inherit }; - export namespace inputs_439 { - let in1_100: string; - export { in1_100 as in1 }; - let in2_100: string; - export { in2_100 as in2 }; - } - export { inputs_439 as inputs }; - export namespace outputs_439 { - let out_428: string; - export { out_428 as out }; - } - export { outputs_439 as outputs }; - } - namespace ND_min_color3 { - let node_440: string; - export { node_440 as node }; - let inherit_440: null; - export { inherit_440 as inherit }; - export namespace inputs_440 { - let in1_101: string; - export { in1_101 as in1 }; - let in2_101: string; - export { in2_101 as in2 }; - } - export { inputs_440 as inputs }; - export namespace outputs_440 { - let out_429: string; - export { out_429 as out }; - } - export { outputs_440 as outputs }; - } - namespace ND_min_color4 { - let node_441: string; - export { node_441 as node }; - let inherit_441: null; - export { inherit_441 as inherit }; - export namespace inputs_441 { - let in1_102: string; - export { in1_102 as in1 }; - let in2_102: string; - export { in2_102 as in2 }; - } - export { inputs_441 as inputs }; - export namespace outputs_441 { - let out_430: string; - export { out_430 as out }; - } - export { outputs_441 as outputs }; - } - namespace ND_min_vector2 { - let node_442: string; - export { node_442 as node }; - let inherit_442: null; - export { inherit_442 as inherit }; - export namespace inputs_442 { - let in1_103: string; - export { in1_103 as in1 }; - let in2_103: string; - export { in2_103 as in2 }; - } - export { inputs_442 as inputs }; - export namespace outputs_442 { - let out_431: string; - export { out_431 as out }; - } - export { outputs_442 as outputs }; - } - namespace ND_min_vector3 { - let node_443: string; - export { node_443 as node }; - let inherit_443: null; - export { inherit_443 as inherit }; - export namespace inputs_443 { - let in1_104: string; - export { in1_104 as in1 }; - let in2_104: string; - export { in2_104 as in2 }; - } - export { inputs_443 as inputs }; - export namespace outputs_443 { - let out_432: string; - export { out_432 as out }; - } - export { outputs_443 as outputs }; - } - namespace ND_min_vector4 { - let node_444: string; - export { node_444 as node }; - let inherit_444: null; - export { inherit_444 as inherit }; - export namespace inputs_444 { - let in1_105: string; - export { in1_105 as in1 }; - let in2_105: string; - export { in2_105 as in2 }; - } - export { inputs_444 as inputs }; - export namespace outputs_444 { - let out_433: string; - export { out_433 as out }; - } - export { outputs_444 as outputs }; - } - namespace ND_min_color3FA { - let node_445: string; - export { node_445 as node }; - let inherit_445: null; - export { inherit_445 as inherit }; - export namespace inputs_445 { - let in1_106: string; - export { in1_106 as in1 }; - let in2_106: string; - export { in2_106 as in2 }; - } - export { inputs_445 as inputs }; - export namespace outputs_445 { - let out_434: string; - export { out_434 as out }; - } - export { outputs_445 as outputs }; - } - namespace ND_min_color4FA { - let node_446: string; - export { node_446 as node }; - let inherit_446: null; - export { inherit_446 as inherit }; - export namespace inputs_446 { - let in1_107: string; - export { in1_107 as in1 }; - let in2_107: string; - export { in2_107 as in2 }; - } - export { inputs_446 as inputs }; - export namespace outputs_446 { - let out_435: string; - export { out_435 as out }; - } - export { outputs_446 as outputs }; - } - namespace ND_min_vector2FA { - let node_447: string; - export { node_447 as node }; - let inherit_447: null; - export { inherit_447 as inherit }; - export namespace inputs_447 { - let in1_108: string; - export { in1_108 as in1 }; - let in2_108: string; - export { in2_108 as in2 }; - } - export { inputs_447 as inputs }; - export namespace outputs_447 { - let out_436: string; - export { out_436 as out }; - } - export { outputs_447 as outputs }; - } - namespace ND_min_vector3FA { - let node_448: string; - export { node_448 as node }; - let inherit_448: null; - export { inherit_448 as inherit }; - export namespace inputs_448 { - let in1_109: string; - export { in1_109 as in1 }; - let in2_109: string; - export { in2_109 as in2 }; - } - export { inputs_448 as inputs }; - export namespace outputs_448 { - let out_437: string; - export { out_437 as out }; - } - export { outputs_448 as outputs }; - } - namespace ND_min_vector4FA { - let node_449: string; - export { node_449 as node }; - let inherit_449: null; - export { inherit_449 as inherit }; - export namespace inputs_449 { - let in1_110: string; - export { in1_110 as in1 }; - let in2_110: string; - export { in2_110 as in2 }; - } - export { inputs_449 as inputs }; - export namespace outputs_449 { - let out_438: string; - export { out_438 as out }; - } - export { outputs_449 as outputs }; - } - namespace ND_max_float { - let node_450: string; - export { node_450 as node }; - let inherit_450: null; - export { inherit_450 as inherit }; - export namespace inputs_450 { - let in1_111: string; - export { in1_111 as in1 }; - let in2_111: string; - export { in2_111 as in2 }; - } - export { inputs_450 as inputs }; - export namespace outputs_450 { - let out_439: string; - export { out_439 as out }; - } - export { outputs_450 as outputs }; - } - namespace ND_max_color3 { - let node_451: string; - export { node_451 as node }; - let inherit_451: null; - export { inherit_451 as inherit }; - export namespace inputs_451 { - let in1_112: string; - export { in1_112 as in1 }; - let in2_112: string; - export { in2_112 as in2 }; - } - export { inputs_451 as inputs }; - export namespace outputs_451 { - let out_440: string; - export { out_440 as out }; - } - export { outputs_451 as outputs }; - } - namespace ND_max_color4 { - let node_452: string; - export { node_452 as node }; - let inherit_452: null; - export { inherit_452 as inherit }; - export namespace inputs_452 { - let in1_113: string; - export { in1_113 as in1 }; - let in2_113: string; - export { in2_113 as in2 }; - } - export { inputs_452 as inputs }; - export namespace outputs_452 { - let out_441: string; - export { out_441 as out }; - } - export { outputs_452 as outputs }; - } - namespace ND_max_vector2 { - let node_453: string; - export { node_453 as node }; - let inherit_453: null; - export { inherit_453 as inherit }; - export namespace inputs_453 { - let in1_114: string; - export { in1_114 as in1 }; - let in2_114: string; - export { in2_114 as in2 }; - } - export { inputs_453 as inputs }; - export namespace outputs_453 { - let out_442: string; - export { out_442 as out }; - } - export { outputs_453 as outputs }; - } - namespace ND_max_vector3 { - let node_454: string; - export { node_454 as node }; - let inherit_454: null; - export { inherit_454 as inherit }; - export namespace inputs_454 { - let in1_115: string; - export { in1_115 as in1 }; - let in2_115: string; - export { in2_115 as in2 }; - } - export { inputs_454 as inputs }; - export namespace outputs_454 { - let out_443: string; - export { out_443 as out }; - } - export { outputs_454 as outputs }; - } - namespace ND_max_vector4 { - let node_455: string; - export { node_455 as node }; - let inherit_455: null; - export { inherit_455 as inherit }; - export namespace inputs_455 { - let in1_116: string; - export { in1_116 as in1 }; - let in2_116: string; - export { in2_116 as in2 }; - } - export { inputs_455 as inputs }; - export namespace outputs_455 { - let out_444: string; - export { out_444 as out }; - } - export { outputs_455 as outputs }; - } - namespace ND_max_color3FA { - let node_456: string; - export { node_456 as node }; - let inherit_456: null; - export { inherit_456 as inherit }; - export namespace inputs_456 { - let in1_117: string; - export { in1_117 as in1 }; - let in2_117: string; - export { in2_117 as in2 }; - } - export { inputs_456 as inputs }; - export namespace outputs_456 { - let out_445: string; - export { out_445 as out }; - } - export { outputs_456 as outputs }; - } - namespace ND_max_color4FA { - let node_457: string; - export { node_457 as node }; - let inherit_457: null; - export { inherit_457 as inherit }; - export namespace inputs_457 { - let in1_118: string; - export { in1_118 as in1 }; - let in2_118: string; - export { in2_118 as in2 }; - } - export { inputs_457 as inputs }; - export namespace outputs_457 { - let out_446: string; - export { out_446 as out }; - } - export { outputs_457 as outputs }; - } - namespace ND_max_vector2FA { - let node_458: string; - export { node_458 as node }; - let inherit_458: null; - export { inherit_458 as inherit }; - export namespace inputs_458 { - let in1_119: string; - export { in1_119 as in1 }; - let in2_119: string; - export { in2_119 as in2 }; - } - export { inputs_458 as inputs }; - export namespace outputs_458 { - let out_447: string; - export { out_447 as out }; - } - export { outputs_458 as outputs }; - } - namespace ND_max_vector3FA { - let node_459: string; - export { node_459 as node }; - let inherit_459: null; - export { inherit_459 as inherit }; - export namespace inputs_459 { - let in1_120: string; - export { in1_120 as in1 }; - let in2_120: string; - export { in2_120 as in2 }; - } - export { inputs_459 as inputs }; - export namespace outputs_459 { - let out_448: string; - export { out_448 as out }; - } - export { outputs_459 as outputs }; - } - namespace ND_max_vector4FA { - let node_460: string; - export { node_460 as node }; - let inherit_460: null; - export { inherit_460 as inherit }; - export namespace inputs_460 { - let in1_121: string; - export { in1_121 as in1 }; - let in2_121: string; - export { in2_121 as in2 }; - } - export { inputs_460 as inputs }; - export namespace outputs_460 { - let out_449: string; - export { out_449 as out }; - } - export { outputs_460 as outputs }; - } - namespace ND_normalize_vector2 { - let node_461: string; - export { node_461 as node }; - let inherit_461: null; - export { inherit_461 as inherit }; - export namespace inputs_461 { - let _in_118: string; - export { _in_118 as in }; - } - export { inputs_461 as inputs }; - export namespace outputs_461 { - let out_450: string; - export { out_450 as out }; - } - export { outputs_461 as outputs }; - } - namespace ND_normalize_vector3 { - let node_462: string; - export { node_462 as node }; - let inherit_462: null; - export { inherit_462 as inherit }; - export namespace inputs_462 { - let _in_119: string; - export { _in_119 as in }; - } - export { inputs_462 as inputs }; - export namespace outputs_462 { - let out_451: string; - export { out_451 as out }; - } - export { outputs_462 as outputs }; - } - namespace ND_normalize_vector4 { - let node_463: string; - export { node_463 as node }; - let inherit_463: null; - export { inherit_463 as inherit }; - export namespace inputs_463 { - let _in_120: string; - export { _in_120 as in }; - } - export { inputs_463 as inputs }; - export namespace outputs_463 { - let out_452: string; - export { out_452 as out }; - } - export { outputs_463 as outputs }; - } - namespace ND_magnitude_vector2 { - let node_464: string; - export { node_464 as node }; - let inherit_464: null; - export { inherit_464 as inherit }; - export namespace inputs_464 { - let _in_121: string; - export { _in_121 as in }; - } - export { inputs_464 as inputs }; - export namespace outputs_464 { - let out_453: string; - export { out_453 as out }; - } - export { outputs_464 as outputs }; - } - namespace ND_magnitude_vector3 { - let node_465: string; - export { node_465 as node }; - let inherit_465: null; - export { inherit_465 as inherit }; - export namespace inputs_465 { - let _in_122: string; - export { _in_122 as in }; - } - export { inputs_465 as inputs }; - export namespace outputs_465 { - let out_454: string; - export { out_454 as out }; - } - export { outputs_465 as outputs }; - } - namespace ND_magnitude_vector4 { - let node_466: string; - export { node_466 as node }; - let inherit_466: null; - export { inherit_466 as inherit }; - export namespace inputs_466 { - let _in_123: string; - export { _in_123 as in }; - } - export { inputs_466 as inputs }; - export namespace outputs_466 { - let out_455: string; - export { out_455 as out }; - } - export { outputs_466 as outputs }; - } - namespace ND_distance_vector2 { - let node_467: string; - export { node_467 as node }; - let inherit_467: null; - export { inherit_467 as inherit }; - export namespace inputs_467 { - let in1_122: string; - export { in1_122 as in1 }; - let in2_122: string; - export { in2_122 as in2 }; - } - export { inputs_467 as inputs }; - export namespace outputs_467 { - let out_456: string; - export { out_456 as out }; - } - export { outputs_467 as outputs }; - } - namespace ND_distance_vector3 { - let node_468: string; - export { node_468 as node }; - let inherit_468: null; - export { inherit_468 as inherit }; - export namespace inputs_468 { - let in1_123: string; - export { in1_123 as in1 }; - let in2_123: string; - export { in2_123 as in2 }; - } - export { inputs_468 as inputs }; - export namespace outputs_468 { - let out_457: string; - export { out_457 as out }; - } - export { outputs_468 as outputs }; - } - namespace ND_distance_vector4 { - let node_469: string; - export { node_469 as node }; - let inherit_469: null; - export { inherit_469 as inherit }; - export namespace inputs_469 { - let in1_124: string; - export { in1_124 as in1 }; - let in2_124: string; - export { in2_124 as in2 }; - } - export { inputs_469 as inputs }; - export namespace outputs_469 { - let out_458: string; - export { out_458 as out }; - } - export { outputs_469 as outputs }; - } - namespace ND_dotproduct_vector2 { - let node_470: string; - export { node_470 as node }; - let inherit_470: null; - export { inherit_470 as inherit }; - export namespace inputs_470 { - let in1_125: string; - export { in1_125 as in1 }; - let in2_125: string; - export { in2_125 as in2 }; - } - export { inputs_470 as inputs }; - export namespace outputs_470 { - let out_459: string; - export { out_459 as out }; - } - export { outputs_470 as outputs }; - } - namespace ND_dotproduct_vector3 { - let node_471: string; - export { node_471 as node }; - let inherit_471: null; - export { inherit_471 as inherit }; - export namespace inputs_471 { - let in1_126: string; - export { in1_126 as in1 }; - let in2_126: string; - export { in2_126 as in2 }; - } - export { inputs_471 as inputs }; - export namespace outputs_471 { - let out_460: string; - export { out_460 as out }; - } - export { outputs_471 as outputs }; - } - namespace ND_dotproduct_vector4 { - let node_472: string; - export { node_472 as node }; - let inherit_472: null; - export { inherit_472 as inherit }; - export namespace inputs_472 { - let in1_127: string; - export { in1_127 as in1 }; - let in2_127: string; - export { in2_127 as in2 }; - } - export { inputs_472 as inputs }; - export namespace outputs_472 { - let out_461: string; - export { out_461 as out }; - } - export { outputs_472 as outputs }; - } - namespace ND_crossproduct_vector3 { - let node_473: string; - export { node_473 as node }; - let inherit_473: null; - export { inherit_473 as inherit }; - export namespace inputs_473 { - let in1_128: string; - export { in1_128 as in1 }; - let in2_128: string; - export { in2_128 as in2 }; - } - export { inputs_473 as inputs }; - export namespace outputs_473 { - let out_462: string; - export { out_462 as out }; - } - export { outputs_473 as outputs }; - } - namespace ND_transformpoint_vector3 { - let node_474: string; - export { node_474 as node }; - let inherit_474: null; - export { inherit_474 as inherit }; - export namespace inputs_474 { - let _in_124: string; - export { _in_124 as in }; - export let fromspace: string; - export let tospace: string; - } - export { inputs_474 as inputs }; - export namespace outputs_474 { - let out_463: string; - export { out_463 as out }; - } - export { outputs_474 as outputs }; - } - namespace ND_transformvector_vector3 { - let node_475: string; - export { node_475 as node }; - let inherit_475: null; - export { inherit_475 as inherit }; - export namespace inputs_475 { - let _in_125: string; - export { _in_125 as in }; - let fromspace_1: string; - export { fromspace_1 as fromspace }; - let tospace_1: string; - export { tospace_1 as tospace }; - } - export { inputs_475 as inputs }; - export namespace outputs_475 { - let out_464: string; - export { out_464 as out }; - } - export { outputs_475 as outputs }; - } - namespace ND_transformnormal_vector3 { - let node_476: string; - export { node_476 as node }; - let inherit_476: null; - export { inherit_476 as inherit }; - export namespace inputs_476 { - let _in_126: string; - export { _in_126 as in }; - let fromspace_2: string; - export { fromspace_2 as fromspace }; - let tospace_2: string; - export { tospace_2 as tospace }; - } - export { inputs_476 as inputs }; - export namespace outputs_476 { - let out_465: string; - export { out_465 as out }; - } - export { outputs_476 as outputs }; - } - namespace ND_transformmatrix_vector2M3 { - let node_477: string; - export { node_477 as node }; - let inherit_477: null; - export { inherit_477 as inherit }; - export namespace inputs_477 { - let _in_127: string; - export { _in_127 as in }; - export let mat: string; - } - export { inputs_477 as inputs }; - export namespace outputs_477 { - let out_466: string; - export { out_466 as out }; - } - export { outputs_477 as outputs }; - } - namespace ND_transformmatrix_vector3 { - let node_478: string; - export { node_478 as node }; - let inherit_478: null; - export { inherit_478 as inherit }; - export namespace inputs_478 { - let _in_128: string; - export { _in_128 as in }; - let mat_1: string; - export { mat_1 as mat }; - } - export { inputs_478 as inputs }; - export namespace outputs_478 { - let out_467: string; - export { out_467 as out }; - } - export { outputs_478 as outputs }; - } - namespace ND_transformmatrix_vector3M4 { - let node_479: string; - export { node_479 as node }; - let inherit_479: null; - export { inherit_479 as inherit }; - export namespace inputs_479 { - let _in_129: string; - export { _in_129 as in }; - let mat_2: string; - export { mat_2 as mat }; - } - export { inputs_479 as inputs }; - export namespace outputs_479 { - let out_468: string; - export { out_468 as out }; - } - export { outputs_479 as outputs }; - } - namespace ND_transformmatrix_vector4 { - let node_480: string; - export { node_480 as node }; - let inherit_480: null; - export { inherit_480 as inherit }; - export namespace inputs_480 { - let _in_130: string; - export { _in_130 as in }; - let mat_3: string; - export { mat_3 as mat }; - } - export { inputs_480 as inputs }; - export namespace outputs_480 { - let out_469: string; - export { out_469 as out }; - } - export { outputs_480 as outputs }; - } - namespace ND_normalmap_float { - let node_481: string; - export { node_481 as node }; - let inherit_481: null; - export { inherit_481 as inherit }; - export namespace inputs_481 { - let _in_131: string; - export { _in_131 as in }; - let scale_15: string; - export { scale_15 as scale }; - let normal_24: string; - export { normal_24 as normal }; - let tangent_8: string; - export { tangent_8 as tangent }; - let bitangent_3: string; - export { bitangent_3 as bitangent }; - } - export { inputs_481 as inputs }; - export namespace outputs_481 { - let out_470: string; - export { out_470 as out }; - } - export { outputs_481 as outputs }; - } - namespace ND_normalmap_vector2 { - let node_482: string; - export { node_482 as node }; - let inherit_482: null; - export { inherit_482 as inherit }; - export namespace inputs_482 { - let _in_132: string; - export { _in_132 as in }; - let scale_16: string; - export { scale_16 as scale }; - let normal_25: string; - export { normal_25 as normal }; - let tangent_9: string; - export { tangent_9 as tangent }; - let bitangent_4: string; - export { bitangent_4 as bitangent }; - } - export { inputs_482 as inputs }; - export namespace outputs_482 { - let out_471: string; - export { out_471 as out }; - } - export { outputs_482 as outputs }; - } - namespace ND_hextilednormalmap_vector3 { - let node_483: string; - export { node_483 as node }; - let inherit_483: null; - export { inherit_483 as inherit }; - export namespace inputs_483 { - let file_25: string; - export { file_25 as file }; - let _default_39: string; - export { _default_39 as default }; - let texcoord_91: string; - export { texcoord_91 as texcoord }; - let tiling_2: string; - export { tiling_2 as tiling }; - let rotation_4: string; - export { rotation_4 as rotation }; - let rotationrange_2: string; - export { rotationrange_2 as rotationrange }; - let scale_17: string; - export { scale_17 as scale }; - let scalerange_2: string; - export { scalerange_2 as scalerange }; - let offset_12: string; - export { offset_12 as offset }; - let offsetrange_2: string; - export { offsetrange_2 as offsetrange }; - let falloff_2: string; - export { falloff_2 as falloff }; - export let strength: string; - export let flip_g: string; - let normal_26: string; - export { normal_26 as normal }; - let tangent_10: string; - export { tangent_10 as tangent }; - let bitangent_5: string; - export { bitangent_5 as bitangent }; - } - export { inputs_483 as inputs }; - export namespace outputs_483 { - let out_472: string; - export { out_472 as out }; - } - export { outputs_483 as outputs }; - } - namespace ND_transpose_matrix33 { - let node_484: string; - export { node_484 as node }; - let inherit_484: null; - export { inherit_484 as inherit }; - export namespace inputs_484 { - let _in_133: string; - export { _in_133 as in }; - } - export { inputs_484 as inputs }; - export namespace outputs_484 { - let out_473: string; - export { out_473 as out }; - } - export { outputs_484 as outputs }; - } - namespace ND_transpose_matrix44 { - let node_485: string; - export { node_485 as node }; - let inherit_485: null; - export { inherit_485 as inherit }; - export namespace inputs_485 { - let _in_134: string; - export { _in_134 as in }; - } - export { inputs_485 as inputs }; - export namespace outputs_485 { - let out_474: string; - export { out_474 as out }; - } - export { outputs_485 as outputs }; - } - namespace ND_determinant_matrix33 { - let node_486: string; - export { node_486 as node }; - let inherit_486: null; - export { inherit_486 as inherit }; - export namespace inputs_486 { - let _in_135: string; - export { _in_135 as in }; - } - export { inputs_486 as inputs }; - export namespace outputs_486 { - let out_475: string; - export { out_475 as out }; - } - export { outputs_486 as outputs }; - } - namespace ND_determinant_matrix44 { - let node_487: string; - export { node_487 as node }; - let inherit_487: null; - export { inherit_487 as inherit }; - export namespace inputs_487 { - let _in_136: string; - export { _in_136 as in }; - } - export { inputs_487 as inputs }; - export namespace outputs_487 { - let out_476: string; - export { out_476 as out }; - } - export { outputs_487 as outputs }; - } - namespace ND_invertmatrix_matrix33 { - let node_488: string; - export { node_488 as node }; - let inherit_488: null; - export { inherit_488 as inherit }; - export namespace inputs_488 { - let _in_137: string; - export { _in_137 as in }; - } - export { inputs_488 as inputs }; - export namespace outputs_488 { - let out_477: string; - export { out_477 as out }; - } - export { outputs_488 as outputs }; - } - namespace ND_invertmatrix_matrix44 { - let node_489: string; - export { node_489 as node }; - let inherit_489: null; - export { inherit_489 as inherit }; - export namespace inputs_489 { - let _in_138: string; - export { _in_138 as in }; - } - export { inputs_489 as inputs }; - export namespace outputs_489 { - let out_478: string; - export { out_478 as out }; - } - export { outputs_489 as outputs }; - } - namespace ND_rotate2d_vector2 { - let node_490: string; - export { node_490 as node }; - let inherit_490: null; - export { inherit_490 as inherit }; - export namespace inputs_490 { - let _in_139: string; - export { _in_139 as in }; - let amount_11: string; - export { amount_11 as amount }; - } - export { inputs_490 as inputs }; - export namespace outputs_490 { - let out_479: string; - export { out_479 as out }; - } - export { outputs_490 as outputs }; - } - namespace ND_rotate3d_vector3 { - let node_491: string; - export { node_491 as node }; - let inherit_491: null; - export { inherit_491 as inherit }; - export namespace inputs_491 { - let _in_140: string; - export { _in_140 as in }; - let amount_12: string; - export { amount_12 as amount }; - export let axis: string; - } - export { inputs_491 as inputs }; - export namespace outputs_491 { - let out_480: string; - export { out_480 as out }; - } - export { outputs_491 as outputs }; - } - namespace ND_place2d_vector2 { - let node_492: string; - export { node_492 as node }; - let inherit_492: null; - export { inherit_492 as inherit }; - export namespace inputs_492 { - let texcoord_92: string; - export { texcoord_92 as texcoord }; - let pivot_30: string; - export { pivot_30 as pivot }; - let scale_18: string; - export { scale_18 as scale }; - let rotate_8: string; - export { rotate_8 as rotate }; - let offset_13: string; - export { offset_13 as offset }; - let operationorder_7: string; - export { operationorder_7 as operationorder }; - } - export { inputs_492 as inputs }; - export namespace outputs_492 { - let out_481: string; - export { out_481 as out }; - } - export { outputs_492 as outputs }; - } - namespace ND_trianglewave_float { - let node_493: string; - export { node_493 as node }; - let inherit_493: null; - export { inherit_493 as inherit }; - export namespace inputs_493 { - let _in_141: string; - export { _in_141 as in }; - } - export { inputs_493 as inputs }; - export namespace outputs_493 { - let out_482: string; - export { out_482 as out }; - } - export { outputs_493 as outputs }; - } - namespace ND_reflect_vector3 { - let node_494: string; - export { node_494 as node }; - let inherit_494: null; - export { inherit_494 as inherit }; - export namespace inputs_494 { - let _in_142: string; - export { _in_142 as in }; - let normal_27: string; - export { normal_27 as normal }; - } - export { inputs_494 as inputs }; - export namespace outputs_494 { - let out_483: string; - export { out_483 as out }; - } - export { outputs_494 as outputs }; - } - namespace ND_refract_vector3 { - let node_495: string; - export { node_495 as node }; - let inherit_495: null; - export { inherit_495 as inherit }; - export namespace inputs_495 { - let _in_143: string; - export { _in_143 as in }; - let normal_28: string; - export { normal_28 as normal }; - let ior_7: string; - export { ior_7 as ior }; - } - export { inputs_495 as inputs }; - export namespace outputs_495 { - let out_484: string; - export { out_484 as out }; - } - export { outputs_495 as outputs }; - } - namespace ND_remap_float { - let node_496: string; - export { node_496 as node }; - let inherit_496: null; - export { inherit_496 as inherit }; - export namespace inputs_496 { - let _in_144: string; - export { _in_144 as in }; - export let inlow: string; - export let inhigh: string; - export let outlow: string; - export let outhigh: string; - } - export { inputs_496 as inputs }; - export namespace outputs_496 { - let out_485: string; - export { out_485 as out }; - } - export { outputs_496 as outputs }; - } - namespace ND_remap_color3 { - let node_497: string; - export { node_497 as node }; - let inherit_497: null; - export { inherit_497 as inherit }; - export namespace inputs_497 { - let _in_145: string; - export { _in_145 as in }; - let inlow_1: string; - export { inlow_1 as inlow }; - let inhigh_1: string; - export { inhigh_1 as inhigh }; - let outlow_1: string; - export { outlow_1 as outlow }; - let outhigh_1: string; - export { outhigh_1 as outhigh }; - } - export { inputs_497 as inputs }; - export namespace outputs_497 { - let out_486: string; - export { out_486 as out }; - } - export { outputs_497 as outputs }; - } - namespace ND_remap_color4 { - let node_498: string; - export { node_498 as node }; - let inherit_498: null; - export { inherit_498 as inherit }; - export namespace inputs_498 { - let _in_146: string; - export { _in_146 as in }; - let inlow_2: string; - export { inlow_2 as inlow }; - let inhigh_2: string; - export { inhigh_2 as inhigh }; - let outlow_2: string; - export { outlow_2 as outlow }; - let outhigh_2: string; - export { outhigh_2 as outhigh }; - } - export { inputs_498 as inputs }; - export namespace outputs_498 { - let out_487: string; - export { out_487 as out }; - } - export { outputs_498 as outputs }; - } - namespace ND_remap_vector2 { - let node_499: string; - export { node_499 as node }; - let inherit_499: null; - export { inherit_499 as inherit }; - export namespace inputs_499 { - let _in_147: string; - export { _in_147 as in }; - let inlow_3: string; - export { inlow_3 as inlow }; - let inhigh_3: string; - export { inhigh_3 as inhigh }; - let outlow_3: string; - export { outlow_3 as outlow }; - let outhigh_3: string; - export { outhigh_3 as outhigh }; - } - export { inputs_499 as inputs }; - export namespace outputs_499 { - let out_488: string; - export { out_488 as out }; - } - export { outputs_499 as outputs }; - } - namespace ND_remap_vector3 { - let node_500: string; - export { node_500 as node }; - let inherit_500: null; - export { inherit_500 as inherit }; - export namespace inputs_500 { - let _in_148: string; - export { _in_148 as in }; - let inlow_4: string; - export { inlow_4 as inlow }; - let inhigh_4: string; - export { inhigh_4 as inhigh }; - let outlow_4: string; - export { outlow_4 as outlow }; - let outhigh_4: string; - export { outhigh_4 as outhigh }; - } - export { inputs_500 as inputs }; - export namespace outputs_500 { - let out_489: string; - export { out_489 as out }; - } - export { outputs_500 as outputs }; - } - namespace ND_remap_vector4 { - let node_501: string; - export { node_501 as node }; - let inherit_501: null; - export { inherit_501 as inherit }; - export namespace inputs_501 { - let _in_149: string; - export { _in_149 as in }; - let inlow_5: string; - export { inlow_5 as inlow }; - let inhigh_5: string; - export { inhigh_5 as inhigh }; - let outlow_5: string; - export { outlow_5 as outlow }; - let outhigh_5: string; - export { outhigh_5 as outhigh }; - } - export { inputs_501 as inputs }; - export namespace outputs_501 { - let out_490: string; - export { out_490 as out }; - } - export { outputs_501 as outputs }; - } - namespace ND_remap_color3FA { - let node_502: string; - export { node_502 as node }; - let inherit_502: null; - export { inherit_502 as inherit }; - export namespace inputs_502 { - let _in_150: string; - export { _in_150 as in }; - let inlow_6: string; - export { inlow_6 as inlow }; - let inhigh_6: string; - export { inhigh_6 as inhigh }; - let outlow_6: string; - export { outlow_6 as outlow }; - let outhigh_6: string; - export { outhigh_6 as outhigh }; - } - export { inputs_502 as inputs }; - export namespace outputs_502 { - let out_491: string; - export { out_491 as out }; - } - export { outputs_502 as outputs }; - } - namespace ND_remap_color4FA { - let node_503: string; - export { node_503 as node }; - let inherit_503: null; - export { inherit_503 as inherit }; - export namespace inputs_503 { - let _in_151: string; - export { _in_151 as in }; - let inlow_7: string; - export { inlow_7 as inlow }; - let inhigh_7: string; - export { inhigh_7 as inhigh }; - let outlow_7: string; - export { outlow_7 as outlow }; - let outhigh_7: string; - export { outhigh_7 as outhigh }; - } - export { inputs_503 as inputs }; - export namespace outputs_503 { - let out_492: string; - export { out_492 as out }; - } - export { outputs_503 as outputs }; - } - namespace ND_remap_vector2FA { - let node_504: string; - export { node_504 as node }; - let inherit_504: null; - export { inherit_504 as inherit }; - export namespace inputs_504 { - let _in_152: string; - export { _in_152 as in }; - let inlow_8: string; - export { inlow_8 as inlow }; - let inhigh_8: string; - export { inhigh_8 as inhigh }; - let outlow_8: string; - export { outlow_8 as outlow }; - let outhigh_8: string; - export { outhigh_8 as outhigh }; - } - export { inputs_504 as inputs }; - export namespace outputs_504 { - let out_493: string; - export { out_493 as out }; - } - export { outputs_504 as outputs }; - } - namespace ND_remap_vector3FA { - let node_505: string; - export { node_505 as node }; - let inherit_505: null; - export { inherit_505 as inherit }; - export namespace inputs_505 { - let _in_153: string; - export { _in_153 as in }; - let inlow_9: string; - export { inlow_9 as inlow }; - let inhigh_9: string; - export { inhigh_9 as inhigh }; - let outlow_9: string; - export { outlow_9 as outlow }; - let outhigh_9: string; - export { outhigh_9 as outhigh }; - } - export { inputs_505 as inputs }; - export namespace outputs_505 { - let out_494: string; - export { out_494 as out }; - } - export { outputs_505 as outputs }; - } - namespace ND_remap_vector4FA { - let node_506: string; - export { node_506 as node }; - let inherit_506: null; - export { inherit_506 as inherit }; - export namespace inputs_506 { - let _in_154: string; - export { _in_154 as in }; - let inlow_10: string; - export { inlow_10 as inlow }; - let inhigh_10: string; - export { inhigh_10 as inhigh }; - let outlow_10: string; - export { outlow_10 as outlow }; - let outhigh_10: string; - export { outhigh_10 as outhigh }; - } - export { inputs_506 as inputs }; - export namespace outputs_506 { - let out_495: string; - export { out_495 as out }; - } - export { outputs_506 as outputs }; - } - namespace ND_smoothstep_float { - let node_507: string; - export { node_507 as node }; - let inherit_507: null; - export { inherit_507 as inherit }; - export namespace inputs_507 { - let _in_155: string; - export { _in_155 as in }; - let low_11: string; - export { low_11 as low }; - let high_11: string; - export { high_11 as high }; - } - export { inputs_507 as inputs }; - export namespace outputs_507 { - let out_496: string; - export { out_496 as out }; - } - export { outputs_507 as outputs }; - } - namespace ND_smoothstep_color3 { - let node_508: string; - export { node_508 as node }; - let inherit_508: null; - export { inherit_508 as inherit }; - export namespace inputs_508 { - let _in_156: string; - export { _in_156 as in }; - let low_12: string; - export { low_12 as low }; - let high_12: string; - export { high_12 as high }; - } - export { inputs_508 as inputs }; - export namespace outputs_508 { - let out_497: string; - export { out_497 as out }; - } - export { outputs_508 as outputs }; - } - namespace ND_smoothstep_color4 { - let node_509: string; - export { node_509 as node }; - let inherit_509: null; - export { inherit_509 as inherit }; - export namespace inputs_509 { - let _in_157: string; - export { _in_157 as in }; - let low_13: string; - export { low_13 as low }; - let high_13: string; - export { high_13 as high }; - } - export { inputs_509 as inputs }; - export namespace outputs_509 { - let out_498: string; - export { out_498 as out }; - } - export { outputs_509 as outputs }; - } - namespace ND_smoothstep_vector2 { - let node_510: string; - export { node_510 as node }; - let inherit_510: null; - export { inherit_510 as inherit }; - export namespace inputs_510 { - let _in_158: string; - export { _in_158 as in }; - let low_14: string; - export { low_14 as low }; - let high_14: string; - export { high_14 as high }; - } - export { inputs_510 as inputs }; - export namespace outputs_510 { - let out_499: string; - export { out_499 as out }; - } - export { outputs_510 as outputs }; - } - namespace ND_smoothstep_vector3 { - let node_511: string; - export { node_511 as node }; - let inherit_511: null; - export { inherit_511 as inherit }; - export namespace inputs_511 { - let _in_159: string; - export { _in_159 as in }; - let low_15: string; - export { low_15 as low }; - let high_15: string; - export { high_15 as high }; - } - export { inputs_511 as inputs }; - export namespace outputs_511 { - let out_500: string; - export { out_500 as out }; - } - export { outputs_511 as outputs }; - } - namespace ND_smoothstep_vector4 { - let node_512: string; - export { node_512 as node }; - let inherit_512: null; - export { inherit_512 as inherit }; - export namespace inputs_512 { - let _in_160: string; - export { _in_160 as in }; - let low_16: string; - export { low_16 as low }; - let high_16: string; - export { high_16 as high }; - } - export { inputs_512 as inputs }; - export namespace outputs_512 { - let out_501: string; - export { out_501 as out }; - } - export { outputs_512 as outputs }; - } - namespace ND_smoothstep_color3FA { - let node_513: string; - export { node_513 as node }; - let inherit_513: null; - export { inherit_513 as inherit }; - export namespace inputs_513 { - let _in_161: string; - export { _in_161 as in }; - let low_17: string; - export { low_17 as low }; - let high_17: string; - export { high_17 as high }; - } - export { inputs_513 as inputs }; - export namespace outputs_513 { - let out_502: string; - export { out_502 as out }; - } - export { outputs_513 as outputs }; - } - namespace ND_smoothstep_color4FA { - let node_514: string; - export { node_514 as node }; - let inherit_514: null; - export { inherit_514 as inherit }; - export namespace inputs_514 { - let _in_162: string; - export { _in_162 as in }; - let low_18: string; - export { low_18 as low }; - let high_18: string; - export { high_18 as high }; - } - export { inputs_514 as inputs }; - export namespace outputs_514 { - let out_503: string; - export { out_503 as out }; - } - export { outputs_514 as outputs }; - } - namespace ND_smoothstep_vector2FA { - let node_515: string; - export { node_515 as node }; - let inherit_515: null; - export { inherit_515 as inherit }; - export namespace inputs_515 { - let _in_163: string; - export { _in_163 as in }; - let low_19: string; - export { low_19 as low }; - let high_19: string; - export { high_19 as high }; - } - export { inputs_515 as inputs }; - export namespace outputs_515 { - let out_504: string; - export { out_504 as out }; - } - export { outputs_515 as outputs }; - } - namespace ND_smoothstep_vector3FA { - let node_516: string; - export { node_516 as node }; - let inherit_516: null; - export { inherit_516 as inherit }; - export namespace inputs_516 { - let _in_164: string; - export { _in_164 as in }; - let low_20: string; - export { low_20 as low }; - let high_20: string; - export { high_20 as high }; - } - export { inputs_516 as inputs }; - export namespace outputs_516 { - let out_505: string; - export { out_505 as out }; - } - export { outputs_516 as outputs }; - } - namespace ND_smoothstep_vector4FA { - let node_517: string; - export { node_517 as node }; - let inherit_517: null; - export { inherit_517 as inherit }; - export namespace inputs_517 { - let _in_165: string; - export { _in_165 as in }; - let low_21: string; - export { low_21 as low }; - let high_21: string; - export { high_21 as high }; - } - export { inputs_517 as inputs }; - export namespace outputs_517 { - let out_506: string; - export { out_506 as out }; - } - export { outputs_517 as outputs }; - } - namespace ND_luminance_color3 { - let node_518: string; - export { node_518 as node }; - let inherit_518: null; - export { inherit_518 as inherit }; - export namespace inputs_518 { - let _in_166: string; - export { _in_166 as in }; - let lumacoeffs_2: string; - export { lumacoeffs_2 as lumacoeffs }; - } - export { inputs_518 as inputs }; - export namespace outputs_518 { - let out_507: string; - export { out_507 as out }; - } - export { outputs_518 as outputs }; - } - namespace ND_luminance_color4 { - let node_519: string; - export { node_519 as node }; - let inherit_519: null; - export { inherit_519 as inherit }; - export namespace inputs_519 { - let _in_167: string; - export { _in_167 as in }; - let lumacoeffs_3: string; - export { lumacoeffs_3 as lumacoeffs }; - } - export { inputs_519 as inputs }; - export namespace outputs_519 { - let out_508: string; - export { out_508 as out }; - } - export { outputs_519 as outputs }; - } - namespace ND_rgbtohsv_color3 { - let node_520: string; - export { node_520 as node }; - let inherit_520: null; - export { inherit_520 as inherit }; - export namespace inputs_520 { - let _in_168: string; - export { _in_168 as in }; - } - export { inputs_520 as inputs }; - export namespace outputs_520 { - let out_509: string; - export { out_509 as out }; - } - export { outputs_520 as outputs }; - } - namespace ND_rgbtohsv_color4 { - let node_521: string; - export { node_521 as node }; - let inherit_521: null; - export { inherit_521 as inherit }; - export namespace inputs_521 { - let _in_169: string; - export { _in_169 as in }; - } - export { inputs_521 as inputs }; - export namespace outputs_521 { - let out_510: string; - export { out_510 as out }; - } - export { outputs_521 as outputs }; - } - namespace ND_hsvtorgb_color3 { - let node_522: string; - export { node_522 as node }; - let inherit_522: null; - export { inherit_522 as inherit }; - export namespace inputs_522 { - let _in_170: string; - export { _in_170 as in }; - } - export { inputs_522 as inputs }; - export namespace outputs_522 { - let out_511: string; - export { out_511 as out }; - } - export { outputs_522 as outputs }; - } - namespace ND_hsvtorgb_color4 { - let node_523: string; - export { node_523 as node }; - let inherit_523: null; - export { inherit_523 as inherit }; - export namespace inputs_523 { - let _in_171: string; - export { _in_171 as in }; - } - export { inputs_523 as inputs }; - export namespace outputs_523 { - let out_512: string; - export { out_512 as out }; - } - export { outputs_523 as outputs }; - } - namespace ND_contrast_float { - let node_524: string; - export { node_524 as node }; - let inherit_524: null; - export { inherit_524 as inherit }; - export namespace inputs_524 { - let _in_172: string; - export { _in_172 as in }; - let amount_13: string; - export { amount_13 as amount }; - let pivot_31: string; - export { pivot_31 as pivot }; - } - export { inputs_524 as inputs }; - export namespace outputs_524 { - let out_513: string; - export { out_513 as out }; - } - export { outputs_524 as outputs }; - } - namespace ND_contrast_color3 { - let node_525: string; - export { node_525 as node }; - let inherit_525: null; - export { inherit_525 as inherit }; - export namespace inputs_525 { - let _in_173: string; - export { _in_173 as in }; - let amount_14: string; - export { amount_14 as amount }; - let pivot_32: string; - export { pivot_32 as pivot }; - } - export { inputs_525 as inputs }; - export namespace outputs_525 { - let out_514: string; - export { out_514 as out }; - } - export { outputs_525 as outputs }; - } - namespace ND_contrast_color4 { - let node_526: string; - export { node_526 as node }; - let inherit_526: null; - export { inherit_526 as inherit }; - export namespace inputs_526 { - let _in_174: string; - export { _in_174 as in }; - let amount_15: string; - export { amount_15 as amount }; - let pivot_33: string; - export { pivot_33 as pivot }; - } - export { inputs_526 as inputs }; - export namespace outputs_526 { - let out_515: string; - export { out_515 as out }; - } - export { outputs_526 as outputs }; - } - namespace ND_contrast_vector2 { - let node_527: string; - export { node_527 as node }; - let inherit_527: null; - export { inherit_527 as inherit }; - export namespace inputs_527 { - let _in_175: string; - export { _in_175 as in }; - let amount_16: string; - export { amount_16 as amount }; - let pivot_34: string; - export { pivot_34 as pivot }; - } - export { inputs_527 as inputs }; - export namespace outputs_527 { - let out_516: string; - export { out_516 as out }; - } - export { outputs_527 as outputs }; - } - namespace ND_contrast_vector3 { - let node_528: string; - export { node_528 as node }; - let inherit_528: null; - export { inherit_528 as inherit }; - export namespace inputs_528 { - let _in_176: string; - export { _in_176 as in }; - let amount_17: string; - export { amount_17 as amount }; - let pivot_35: string; - export { pivot_35 as pivot }; - } - export { inputs_528 as inputs }; - export namespace outputs_528 { - let out_517: string; - export { out_517 as out }; - } - export { outputs_528 as outputs }; - } - namespace ND_contrast_vector4 { - let node_529: string; - export { node_529 as node }; - let inherit_529: null; - export { inherit_529 as inherit }; - export namespace inputs_529 { - let _in_177: string; - export { _in_177 as in }; - let amount_18: string; - export { amount_18 as amount }; - let pivot_36: string; - export { pivot_36 as pivot }; - } - export { inputs_529 as inputs }; - export namespace outputs_529 { - let out_518: string; - export { out_518 as out }; - } - export { outputs_529 as outputs }; - } - namespace ND_contrast_color3FA { - let node_530: string; - export { node_530 as node }; - let inherit_530: null; - export { inherit_530 as inherit }; - export namespace inputs_530 { - let _in_178: string; - export { _in_178 as in }; - let amount_19: string; - export { amount_19 as amount }; - let pivot_37: string; - export { pivot_37 as pivot }; - } - export { inputs_530 as inputs }; - export namespace outputs_530 { - let out_519: string; - export { out_519 as out }; - } - export { outputs_530 as outputs }; - } - namespace ND_contrast_color4FA { - let node_531: string; - export { node_531 as node }; - let inherit_531: null; - export { inherit_531 as inherit }; - export namespace inputs_531 { - let _in_179: string; - export { _in_179 as in }; - let amount_20: string; - export { amount_20 as amount }; - let pivot_38: string; - export { pivot_38 as pivot }; - } - export { inputs_531 as inputs }; - export namespace outputs_531 { - let out_520: string; - export { out_520 as out }; - } - export { outputs_531 as outputs }; - } - namespace ND_contrast_vector2FA { - let node_532: string; - export { node_532 as node }; - let inherit_532: null; - export { inherit_532 as inherit }; - export namespace inputs_532 { - let _in_180: string; - export { _in_180 as in }; - let amount_21: string; - export { amount_21 as amount }; - let pivot_39: string; - export { pivot_39 as pivot }; - } - export { inputs_532 as inputs }; - export namespace outputs_532 { - let out_521: string; - export { out_521 as out }; - } - export { outputs_532 as outputs }; - } - namespace ND_contrast_vector3FA { - let node_533: string; - export { node_533 as node }; - let inherit_533: null; - export { inherit_533 as inherit }; - export namespace inputs_533 { - let _in_181: string; - export { _in_181 as in }; - let amount_22: string; - export { amount_22 as amount }; - let pivot_40: string; - export { pivot_40 as pivot }; - } - export { inputs_533 as inputs }; - export namespace outputs_533 { - let out_522: string; - export { out_522 as out }; - } - export { outputs_533 as outputs }; - } - namespace ND_contrast_vector4FA { - let node_534: string; - export { node_534 as node }; - let inherit_534: null; - export { inherit_534 as inherit }; - export namespace inputs_534 { - let _in_182: string; - export { _in_182 as in }; - let amount_23: string; - export { amount_23 as amount }; - let pivot_41: string; - export { pivot_41 as pivot }; - } - export { inputs_534 as inputs }; - export namespace outputs_534 { - let out_523: string; - export { out_523 as out }; - } - export { outputs_534 as outputs }; - } - namespace ND_range_float { - let node_535: string; - export { node_535 as node }; - let inherit_535: null; - export { inherit_535 as inherit }; - export namespace inputs_535 { - let _in_183: string; - export { _in_183 as in }; - let inlow_11: string; - export { inlow_11 as inlow }; - let inhigh_11: string; - export { inhigh_11 as inhigh }; - export let gamma: string; - let outlow_11: string; - export { outlow_11 as outlow }; - let outhigh_11: string; - export { outhigh_11 as outhigh }; - export let doclamp: string; - } - export { inputs_535 as inputs }; - export namespace outputs_535 { - let out_524: string; - export { out_524 as out }; - } - export { outputs_535 as outputs }; - } - namespace ND_range_color3 { - let node_536: string; - export { node_536 as node }; - let inherit_536: null; - export { inherit_536 as inherit }; - export namespace inputs_536 { - let _in_184: string; - export { _in_184 as in }; - let inlow_12: string; - export { inlow_12 as inlow }; - let inhigh_12: string; - export { inhigh_12 as inhigh }; - let gamma_1: string; - export { gamma_1 as gamma }; - let outlow_12: string; - export { outlow_12 as outlow }; - let outhigh_12: string; - export { outhigh_12 as outhigh }; - let doclamp_1: string; - export { doclamp_1 as doclamp }; - } - export { inputs_536 as inputs }; - export namespace outputs_536 { - let out_525: string; - export { out_525 as out }; - } - export { outputs_536 as outputs }; - } - namespace ND_range_color4 { - let node_537: string; - export { node_537 as node }; - let inherit_537: null; - export { inherit_537 as inherit }; - export namespace inputs_537 { - let _in_185: string; - export { _in_185 as in }; - let inlow_13: string; - export { inlow_13 as inlow }; - let inhigh_13: string; - export { inhigh_13 as inhigh }; - let gamma_2: string; - export { gamma_2 as gamma }; - let outlow_13: string; - export { outlow_13 as outlow }; - let outhigh_13: string; - export { outhigh_13 as outhigh }; - let doclamp_2: string; - export { doclamp_2 as doclamp }; - } - export { inputs_537 as inputs }; - export namespace outputs_537 { - let out_526: string; - export { out_526 as out }; - } - export { outputs_537 as outputs }; - } - namespace ND_range_vector2 { - let node_538: string; - export { node_538 as node }; - let inherit_538: null; - export { inherit_538 as inherit }; - export namespace inputs_538 { - let _in_186: string; - export { _in_186 as in }; - let inlow_14: string; - export { inlow_14 as inlow }; - let inhigh_14: string; - export { inhigh_14 as inhigh }; - let gamma_3: string; - export { gamma_3 as gamma }; - let outlow_14: string; - export { outlow_14 as outlow }; - let outhigh_14: string; - export { outhigh_14 as outhigh }; - let doclamp_3: string; - export { doclamp_3 as doclamp }; - } - export { inputs_538 as inputs }; - export namespace outputs_538 { - let out_527: string; - export { out_527 as out }; - } - export { outputs_538 as outputs }; - } - namespace ND_range_vector3 { - let node_539: string; - export { node_539 as node }; - let inherit_539: null; - export { inherit_539 as inherit }; - export namespace inputs_539 { - let _in_187: string; - export { _in_187 as in }; - let inlow_15: string; - export { inlow_15 as inlow }; - let inhigh_15: string; - export { inhigh_15 as inhigh }; - let gamma_4: string; - export { gamma_4 as gamma }; - let outlow_15: string; - export { outlow_15 as outlow }; - let outhigh_15: string; - export { outhigh_15 as outhigh }; - let doclamp_4: string; - export { doclamp_4 as doclamp }; - } - export { inputs_539 as inputs }; - export namespace outputs_539 { - let out_528: string; - export { out_528 as out }; - } - export { outputs_539 as outputs }; - } - namespace ND_range_vector4 { - let node_540: string; - export { node_540 as node }; - let inherit_540: null; - export { inherit_540 as inherit }; - export namespace inputs_540 { - let _in_188: string; - export { _in_188 as in }; - let inlow_16: string; - export { inlow_16 as inlow }; - let inhigh_16: string; - export { inhigh_16 as inhigh }; - let gamma_5: string; - export { gamma_5 as gamma }; - let outlow_16: string; - export { outlow_16 as outlow }; - let outhigh_16: string; - export { outhigh_16 as outhigh }; - let doclamp_5: string; - export { doclamp_5 as doclamp }; - } - export { inputs_540 as inputs }; - export namespace outputs_540 { - let out_529: string; - export { out_529 as out }; - } - export { outputs_540 as outputs }; - } - namespace ND_range_color3FA { - let node_541: string; - export { node_541 as node }; - let inherit_541: null; - export { inherit_541 as inherit }; - export namespace inputs_541 { - let _in_189: string; - export { _in_189 as in }; - let inlow_17: string; - export { inlow_17 as inlow }; - let inhigh_17: string; - export { inhigh_17 as inhigh }; - let gamma_6: string; - export { gamma_6 as gamma }; - let outlow_17: string; - export { outlow_17 as outlow }; - let outhigh_17: string; - export { outhigh_17 as outhigh }; - let doclamp_6: string; - export { doclamp_6 as doclamp }; - } - export { inputs_541 as inputs }; - export namespace outputs_541 { - let out_530: string; - export { out_530 as out }; - } - export { outputs_541 as outputs }; - } - namespace ND_range_color4FA { - let node_542: string; - export { node_542 as node }; - let inherit_542: null; - export { inherit_542 as inherit }; - export namespace inputs_542 { - let _in_190: string; - export { _in_190 as in }; - let inlow_18: string; - export { inlow_18 as inlow }; - let inhigh_18: string; - export { inhigh_18 as inhigh }; - let gamma_7: string; - export { gamma_7 as gamma }; - let outlow_18: string; - export { outlow_18 as outlow }; - let outhigh_18: string; - export { outhigh_18 as outhigh }; - let doclamp_7: string; - export { doclamp_7 as doclamp }; - } - export { inputs_542 as inputs }; - export namespace outputs_542 { - let out_531: string; - export { out_531 as out }; - } - export { outputs_542 as outputs }; - } - namespace ND_range_vector2FA { - let node_543: string; - export { node_543 as node }; - let inherit_543: null; - export { inherit_543 as inherit }; - export namespace inputs_543 { - let _in_191: string; - export { _in_191 as in }; - let inlow_19: string; - export { inlow_19 as inlow }; - let inhigh_19: string; - export { inhigh_19 as inhigh }; - let gamma_8: string; - export { gamma_8 as gamma }; - let outlow_19: string; - export { outlow_19 as outlow }; - let outhigh_19: string; - export { outhigh_19 as outhigh }; - let doclamp_8: string; - export { doclamp_8 as doclamp }; - } - export { inputs_543 as inputs }; - export namespace outputs_543 { - let out_532: string; - export { out_532 as out }; - } - export { outputs_543 as outputs }; - } - namespace ND_range_vector3FA { - let node_544: string; - export { node_544 as node }; - let inherit_544: null; - export { inherit_544 as inherit }; - export namespace inputs_544 { - let _in_192: string; - export { _in_192 as in }; - let inlow_20: string; - export { inlow_20 as inlow }; - let inhigh_20: string; - export { inhigh_20 as inhigh }; - let gamma_9: string; - export { gamma_9 as gamma }; - let outlow_20: string; - export { outlow_20 as outlow }; - let outhigh_20: string; - export { outhigh_20 as outhigh }; - let doclamp_9: string; - export { doclamp_9 as doclamp }; - } - export { inputs_544 as inputs }; - export namespace outputs_544 { - let out_533: string; - export { out_533 as out }; - } - export { outputs_544 as outputs }; - } - namespace ND_range_vector4FA { - let node_545: string; - export { node_545 as node }; - let inherit_545: null; - export { inherit_545 as inherit }; - export namespace inputs_545 { - let _in_193: string; - export { _in_193 as in }; - let inlow_21: string; - export { inlow_21 as inlow }; - let inhigh_21: string; - export { inhigh_21 as inhigh }; - let gamma_10: string; - export { gamma_10 as gamma }; - let outlow_21: string; - export { outlow_21 as outlow }; - let outhigh_21: string; - export { outhigh_21 as outhigh }; - let doclamp_10: string; - export { doclamp_10 as doclamp }; - } - export { inputs_545 as inputs }; - export namespace outputs_545 { - let out_534: string; - export { out_534 as out }; - } - export { outputs_545 as outputs }; - } - namespace ND_hsvadjust_color3 { - let node_546: string; - export { node_546 as node }; - let inherit_546: null; - export { inherit_546 as inherit }; - export namespace inputs_546 { - let _in_194: string; - export { _in_194 as in }; - let amount_24: string; - export { amount_24 as amount }; - } - export { inputs_546 as inputs }; - export namespace outputs_546 { - let out_535: string; - export { out_535 as out }; - } - export { outputs_546 as outputs }; - } - namespace ND_hsvadjust_color4 { - let node_547: string; - export { node_547 as node }; - let inherit_547: null; - export { inherit_547 as inherit }; - export namespace inputs_547 { - let _in_195: string; - export { _in_195 as in }; - let amount_25: string; - export { amount_25 as amount }; - } - export { inputs_547 as inputs }; - export namespace outputs_547 { - let out_536: string; - export { out_536 as out }; - } - export { outputs_547 as outputs }; - } - namespace ND_saturate_color3 { - let node_548: string; - export { node_548 as node }; - let inherit_548: null; - export { inherit_548 as inherit }; - export namespace inputs_548 { - let _in_196: string; - export { _in_196 as in }; - let amount_26: string; - export { amount_26 as amount }; - let lumacoeffs_4: string; - export { lumacoeffs_4 as lumacoeffs }; - } - export { inputs_548 as inputs }; - export namespace outputs_548 { - let out_537: string; - export { out_537 as out }; - } - export { outputs_548 as outputs }; - } - namespace ND_saturate_color4 { - let node_549: string; - export { node_549 as node }; - let inherit_549: null; - export { inherit_549 as inherit }; - export namespace inputs_549 { - let _in_197: string; - export { _in_197 as in }; - let amount_27: string; - export { amount_27 as amount }; - let lumacoeffs_5: string; - export { lumacoeffs_5 as lumacoeffs }; - } - export { inputs_549 as inputs }; - export namespace outputs_549 { - let out_538: string; - export { out_538 as out }; - } - export { outputs_549 as outputs }; - } - namespace ND_colorcorrect_color3 { - let node_550: string; - export { node_550 as node }; - let inherit_550: null; - export { inherit_550 as inherit }; - export namespace inputs_550 { - let _in_198: string; - export { _in_198 as in }; - export let hue: string; - export let saturation: string; - let gamma_11: string; - export { gamma_11 as gamma }; - export let lift: string; - export let gain: string; - export let contrast: string; - export let contrastpivot: string; - let exposure_1: string; - export { exposure_1 as exposure }; - } - export { inputs_550 as inputs }; - export namespace outputs_550 { - let out_539: string; - export { out_539 as out }; - } - export { outputs_550 as outputs }; - } - namespace ND_colorcorrect_color4 { - let node_551: string; - export { node_551 as node }; - let inherit_551: null; - export { inherit_551 as inherit }; - export namespace inputs_551 { - let _in_199: string; - export { _in_199 as in }; - let hue_1: string; - export { hue_1 as hue }; - let saturation_1: string; - export { saturation_1 as saturation }; - let gamma_12: string; - export { gamma_12 as gamma }; - let lift_1: string; - export { lift_1 as lift }; - let gain_1: string; - export { gain_1 as gain }; - let contrast_1: string; - export { contrast_1 as contrast }; - let contrastpivot_1: string; - export { contrastpivot_1 as contrastpivot }; - let exposure_2: string; - export { exposure_2 as exposure }; - } - export { inputs_551 as inputs }; - export namespace outputs_551 { - let out_540: string; - export { out_540 as out }; - } - export { outputs_551 as outputs }; - } - namespace ND_premult_color4 { - let node_552: string; - export { node_552 as node }; - let inherit_552: null; - export { inherit_552 as inherit }; - export namespace inputs_552 { - let _in_200: string; - export { _in_200 as in }; - } - export { inputs_552 as inputs }; - export namespace outputs_552 { - let out_541: string; - export { out_541 as out }; - } - export { outputs_552 as outputs }; - } - namespace ND_unpremult_color4 { - let node_553: string; - export { node_553 as node }; - let inherit_553: null; - export { inherit_553 as inherit }; - export namespace inputs_553 { - let _in_201: string; - export { _in_201 as in }; - } - export { inputs_553 as inputs }; - export namespace outputs_553 { - let out_542: string; - export { out_542 as out }; - } - export { outputs_553 as outputs }; - } - namespace ND_plus_float { - let node_554: string; - export { node_554 as node }; - let inherit_554: null; - export { inherit_554 as inherit }; - export namespace inputs_554 { - let fg_3: string; - export { fg_3 as fg }; - let bg_3: string; - export { bg_3 as bg }; - let mix_3: string; - export { mix_3 as mix }; - } - export { inputs_554 as inputs }; - export namespace outputs_554 { - let out_543: string; - export { out_543 as out }; - } - export { outputs_554 as outputs }; - } - namespace ND_plus_color3 { - let node_555: string; - export { node_555 as node }; - let inherit_555: null; - export { inherit_555 as inherit }; - export namespace inputs_555 { - let fg_4: string; - export { fg_4 as fg }; - let bg_4: string; - export { bg_4 as bg }; - let mix_4: string; - export { mix_4 as mix }; - } - export { inputs_555 as inputs }; - export namespace outputs_555 { - let out_544: string; - export { out_544 as out }; - } - export { outputs_555 as outputs }; - } - namespace ND_plus_color4 { - let node_556: string; - export { node_556 as node }; - let inherit_556: null; - export { inherit_556 as inherit }; - export namespace inputs_556 { - let fg_5: string; - export { fg_5 as fg }; - let bg_5: string; - export { bg_5 as bg }; - let mix_5: string; - export { mix_5 as mix }; - } - export { inputs_556 as inputs }; - export namespace outputs_556 { - let out_545: string; - export { out_545 as out }; - } - export { outputs_556 as outputs }; - } - namespace ND_minus_float { - let node_557: string; - export { node_557 as node }; - let inherit_557: null; - export { inherit_557 as inherit }; - export namespace inputs_557 { - let fg_6: string; - export { fg_6 as fg }; - let bg_6: string; - export { bg_6 as bg }; - let mix_6: string; - export { mix_6 as mix }; - } - export { inputs_557 as inputs }; - export namespace outputs_557 { - let out_546: string; - export { out_546 as out }; - } - export { outputs_557 as outputs }; - } - namespace ND_minus_color3 { - let node_558: string; - export { node_558 as node }; - let inherit_558: null; - export { inherit_558 as inherit }; - export namespace inputs_558 { - let fg_7: string; - export { fg_7 as fg }; - let bg_7: string; - export { bg_7 as bg }; - let mix_7: string; - export { mix_7 as mix }; - } - export { inputs_558 as inputs }; - export namespace outputs_558 { - let out_547: string; - export { out_547 as out }; - } - export { outputs_558 as outputs }; - } - namespace ND_minus_color4 { - let node_559: string; - export { node_559 as node }; - let inherit_559: null; - export { inherit_559 as inherit }; - export namespace inputs_559 { - let fg_8: string; - export { fg_8 as fg }; - let bg_8: string; - export { bg_8 as bg }; - let mix_8: string; - export { mix_8 as mix }; - } - export { inputs_559 as inputs }; - export namespace outputs_559 { - let out_548: string; - export { out_548 as out }; - } - export { outputs_559 as outputs }; - } - namespace ND_difference_float { - let node_560: string; - export { node_560 as node }; - let inherit_560: null; - export { inherit_560 as inherit }; - export namespace inputs_560 { - let fg_9: string; - export { fg_9 as fg }; - let bg_9: string; - export { bg_9 as bg }; - let mix_9: string; - export { mix_9 as mix }; - } - export { inputs_560 as inputs }; - export namespace outputs_560 { - let out_549: string; - export { out_549 as out }; - } - export { outputs_560 as outputs }; - } - namespace ND_difference_color3 { - let node_561: string; - export { node_561 as node }; - let inherit_561: null; - export { inherit_561 as inherit }; - export namespace inputs_561 { - let fg_10: string; - export { fg_10 as fg }; - let bg_10: string; - export { bg_10 as bg }; - let mix_10: string; - export { mix_10 as mix }; - } - export { inputs_561 as inputs }; - export namespace outputs_561 { - let out_550: string; - export { out_550 as out }; - } - export { outputs_561 as outputs }; - } - namespace ND_difference_color4 { - let node_562: string; - export { node_562 as node }; - let inherit_562: null; - export { inherit_562 as inherit }; - export namespace inputs_562 { - let fg_11: string; - export { fg_11 as fg }; - let bg_11: string; - export { bg_11 as bg }; - let mix_11: string; - export { mix_11 as mix }; - } - export { inputs_562 as inputs }; - export namespace outputs_562 { - let out_551: string; - export { out_551 as out }; - } - export { outputs_562 as outputs }; - } - namespace ND_burn_float { - let node_563: string; - export { node_563 as node }; - let inherit_563: null; - export { inherit_563 as inherit }; - export namespace inputs_563 { - let fg_12: string; - export { fg_12 as fg }; - let bg_12: string; - export { bg_12 as bg }; - let mix_12: string; - export { mix_12 as mix }; - } - export { inputs_563 as inputs }; - export namespace outputs_563 { - let out_552: string; - export { out_552 as out }; - } - export { outputs_563 as outputs }; - } - namespace ND_burn_color3 { - let node_564: string; - export { node_564 as node }; - let inherit_564: null; - export { inherit_564 as inherit }; - export namespace inputs_564 { - let fg_13: string; - export { fg_13 as fg }; - let bg_13: string; - export { bg_13 as bg }; - let mix_13: string; - export { mix_13 as mix }; - } - export { inputs_564 as inputs }; - export namespace outputs_564 { - let out_553: string; - export { out_553 as out }; - } - export { outputs_564 as outputs }; - } - namespace ND_burn_color4 { - let node_565: string; - export { node_565 as node }; - let inherit_565: null; - export { inherit_565 as inherit }; - export namespace inputs_565 { - let fg_14: string; - export { fg_14 as fg }; - let bg_14: string; - export { bg_14 as bg }; - let mix_14: string; - export { mix_14 as mix }; - } - export { inputs_565 as inputs }; - export namespace outputs_565 { - let out_554: string; - export { out_554 as out }; - } - export { outputs_565 as outputs }; - } - namespace ND_dodge_float { - let node_566: string; - export { node_566 as node }; - let inherit_566: null; - export { inherit_566 as inherit }; - export namespace inputs_566 { - let fg_15: string; - export { fg_15 as fg }; - let bg_15: string; - export { bg_15 as bg }; - let mix_15: string; - export { mix_15 as mix }; - } - export { inputs_566 as inputs }; - export namespace outputs_566 { - let out_555: string; - export { out_555 as out }; - } - export { outputs_566 as outputs }; - } - namespace ND_dodge_color3 { - let node_567: string; - export { node_567 as node }; - let inherit_567: null; - export { inherit_567 as inherit }; - export namespace inputs_567 { - let fg_16: string; - export { fg_16 as fg }; - let bg_16: string; - export { bg_16 as bg }; - let mix_16: string; - export { mix_16 as mix }; - } - export { inputs_567 as inputs }; - export namespace outputs_567 { - let out_556: string; - export { out_556 as out }; - } - export { outputs_567 as outputs }; - } - namespace ND_dodge_color4 { - let node_568: string; - export { node_568 as node }; - let inherit_568: null; - export { inherit_568 as inherit }; - export namespace inputs_568 { - let fg_17: string; - export { fg_17 as fg }; - let bg_17: string; - export { bg_17 as bg }; - let mix_17: string; - export { mix_17 as mix }; - } - export { inputs_568 as inputs }; - export namespace outputs_568 { - let out_557: string; - export { out_557 as out }; - } - export { outputs_568 as outputs }; - } - namespace ND_screen_float { - let node_569: string; - export { node_569 as node }; - let inherit_569: null; - export { inherit_569 as inherit }; - export namespace inputs_569 { - let fg_18: string; - export { fg_18 as fg }; - let bg_18: string; - export { bg_18 as bg }; - let mix_18: string; - export { mix_18 as mix }; - } - export { inputs_569 as inputs }; - export namespace outputs_569 { - let out_558: string; - export { out_558 as out }; - } - export { outputs_569 as outputs }; - } - namespace ND_screen_color3 { - let node_570: string; - export { node_570 as node }; - let inherit_570: null; - export { inherit_570 as inherit }; - export namespace inputs_570 { - let fg_19: string; - export { fg_19 as fg }; - let bg_19: string; - export { bg_19 as bg }; - let mix_19: string; - export { mix_19 as mix }; - } - export { inputs_570 as inputs }; - export namespace outputs_570 { - let out_559: string; - export { out_559 as out }; - } - export { outputs_570 as outputs }; - } - namespace ND_screen_color4 { - let node_571: string; - export { node_571 as node }; - let inherit_571: null; - export { inherit_571 as inherit }; - export namespace inputs_571 { - let fg_20: string; - export { fg_20 as fg }; - let bg_20: string; - export { bg_20 as bg }; - let mix_20: string; - export { mix_20 as mix }; - } - export { inputs_571 as inputs }; - export namespace outputs_571 { - let out_560: string; - export { out_560 as out }; - } - export { outputs_571 as outputs }; - } - namespace ND_overlay_float { - let node_572: string; - export { node_572 as node }; - let inherit_572: null; - export { inherit_572 as inherit }; - export namespace inputs_572 { - let fg_21: string; - export { fg_21 as fg }; - let bg_21: string; - export { bg_21 as bg }; - let mix_21: string; - export { mix_21 as mix }; - } - export { inputs_572 as inputs }; - export namespace outputs_572 { - let out_561: string; - export { out_561 as out }; - } - export { outputs_572 as outputs }; - } - namespace ND_overlay_color3 { - let node_573: string; - export { node_573 as node }; - let inherit_573: null; - export { inherit_573 as inherit }; - export namespace inputs_573 { - let fg_22: string; - export { fg_22 as fg }; - let bg_22: string; - export { bg_22 as bg }; - let mix_22: string; - export { mix_22 as mix }; - } - export { inputs_573 as inputs }; - export namespace outputs_573 { - let out_562: string; - export { out_562 as out }; - } - export { outputs_573 as outputs }; - } - namespace ND_overlay_color4 { - let node_574: string; - export { node_574 as node }; - let inherit_574: null; - export { inherit_574 as inherit }; - export namespace inputs_574 { - let fg_23: string; - export { fg_23 as fg }; - let bg_23: string; - export { bg_23 as bg }; - let mix_23: string; - export { mix_23 as mix }; - } - export { inputs_574 as inputs }; - export namespace outputs_574 { - let out_563: string; - export { out_563 as out }; - } - export { outputs_574 as outputs }; - } - namespace ND_disjointover_color4 { - let node_575: string; - export { node_575 as node }; - let inherit_575: null; - export { inherit_575 as inherit }; - export namespace inputs_575 { - let fg_24: string; - export { fg_24 as fg }; - let bg_24: string; - export { bg_24 as bg }; - let mix_24: string; - export { mix_24 as mix }; - } - export { inputs_575 as inputs }; - export namespace outputs_575 { - let out_564: string; - export { out_564 as out }; - } - export { outputs_575 as outputs }; - } - namespace ND_in_color4 { - let node_576: string; - export { node_576 as node }; - let inherit_576: null; - export { inherit_576 as inherit }; - export namespace inputs_576 { - let fg_25: string; - export { fg_25 as fg }; - let bg_25: string; - export { bg_25 as bg }; - let mix_25: string; - export { mix_25 as mix }; - } - export { inputs_576 as inputs }; - export namespace outputs_576 { - let out_565: string; - export { out_565 as out }; - } - export { outputs_576 as outputs }; - } - namespace ND_mask_color4 { - let node_577: string; - export { node_577 as node }; - let inherit_577: null; - export { inherit_577 as inherit }; - export namespace inputs_577 { - let fg_26: string; - export { fg_26 as fg }; - let bg_26: string; - export { bg_26 as bg }; - let mix_26: string; - export { mix_26 as mix }; - } - export { inputs_577 as inputs }; - export namespace outputs_577 { - let out_566: string; - export { out_566 as out }; - } - export { outputs_577 as outputs }; - } - namespace ND_matte_color4 { - let node_578: string; - export { node_578 as node }; - let inherit_578: null; - export { inherit_578 as inherit }; - export namespace inputs_578 { - let fg_27: string; - export { fg_27 as fg }; - let bg_27: string; - export { bg_27 as bg }; - let mix_27: string; - export { mix_27 as mix }; - } - export { inputs_578 as inputs }; - export namespace outputs_578 { - let out_567: string; - export { out_567 as out }; - } - export { outputs_578 as outputs }; - } - namespace ND_out_color4 { - let node_579: string; - export { node_579 as node }; - let inherit_579: null; - export { inherit_579 as inherit }; - export namespace inputs_579 { - let fg_28: string; - export { fg_28 as fg }; - let bg_28: string; - export { bg_28 as bg }; - let mix_28: string; - export { mix_28 as mix }; - } - export { inputs_579 as inputs }; - export namespace outputs_579 { - let out_568: string; - export { out_568 as out }; - } - export { outputs_579 as outputs }; - } - namespace ND_over_color4 { - let node_580: string; - export { node_580 as node }; - let inherit_580: null; - export { inherit_580 as inherit }; - export namespace inputs_580 { - let fg_29: string; - export { fg_29 as fg }; - let bg_29: string; - export { bg_29 as bg }; - let mix_29: string; - export { mix_29 as mix }; - } - export { inputs_580 as inputs }; - export namespace outputs_580 { - let out_569: string; - export { out_569 as out }; - } - export { outputs_580 as outputs }; - } - namespace ND_inside_float { - let node_581: string; - export { node_581 as node }; - let inherit_581: null; - export { inherit_581 as inherit }; - export namespace inputs_581 { - let _in_202: string; - export { _in_202 as in }; - export let mask: string; - } - export { inputs_581 as inputs }; - export namespace outputs_581 { - let out_570: string; - export { out_570 as out }; - } - export { outputs_581 as outputs }; - } - namespace ND_inside_color3 { - let node_582: string; - export { node_582 as node }; - let inherit_582: null; - export { inherit_582 as inherit }; - export namespace inputs_582 { - let _in_203: string; - export { _in_203 as in }; - let mask_1: string; - export { mask_1 as mask }; - } - export { inputs_582 as inputs }; - export namespace outputs_582 { - let out_571: string; - export { out_571 as out }; - } - export { outputs_582 as outputs }; - } - namespace ND_inside_color4 { - let node_583: string; - export { node_583 as node }; - let inherit_583: null; - export { inherit_583 as inherit }; - export namespace inputs_583 { - let _in_204: string; - export { _in_204 as in }; - let mask_2: string; - export { mask_2 as mask }; - } - export { inputs_583 as inputs }; - export namespace outputs_583 { - let out_572: string; - export { out_572 as out }; - } - export { outputs_583 as outputs }; - } - namespace ND_outside_float { - let node_584: string; - export { node_584 as node }; - let inherit_584: null; - export { inherit_584 as inherit }; - export namespace inputs_584 { - let _in_205: string; - export { _in_205 as in }; - let mask_3: string; - export { mask_3 as mask }; - } - export { inputs_584 as inputs }; - export namespace outputs_584 { - let out_573: string; - export { out_573 as out }; - } - export { outputs_584 as outputs }; - } - namespace ND_outside_color3 { - let node_585: string; - export { node_585 as node }; - let inherit_585: null; - export { inherit_585 as inherit }; - export namespace inputs_585 { - let _in_206: string; - export { _in_206 as in }; - let mask_4: string; - export { mask_4 as mask }; - } - export { inputs_585 as inputs }; - export namespace outputs_585 { - let out_574: string; - export { out_574 as out }; - } - export { outputs_585 as outputs }; - } - namespace ND_outside_color4 { - let node_586: string; - export { node_586 as node }; - let inherit_586: null; - export { inherit_586 as inherit }; - export namespace inputs_586 { - let _in_207: string; - export { _in_207 as in }; - let mask_5: string; - export { mask_5 as mask }; - } - export { inputs_586 as inputs }; - export namespace outputs_586 { - let out_575: string; - export { out_575 as out }; - } - export { outputs_586 as outputs }; - } - namespace ND_mix_float { - let node_587: string; - export { node_587 as node }; - let inherit_587: null; - export { inherit_587 as inherit }; - export namespace inputs_587 { - let fg_30: string; - export { fg_30 as fg }; - let bg_30: string; - export { bg_30 as bg }; - let mix_30: string; - export { mix_30 as mix }; - } - export { inputs_587 as inputs }; - export namespace outputs_587 { - let out_576: string; - export { out_576 as out }; - } - export { outputs_587 as outputs }; - } - namespace ND_mix_color3 { - let node_588: string; - export { node_588 as node }; - let inherit_588: null; - export { inherit_588 as inherit }; - export namespace inputs_588 { - let fg_31: string; - export { fg_31 as fg }; - let bg_31: string; - export { bg_31 as bg }; - let mix_31: string; - export { mix_31 as mix }; - } - export { inputs_588 as inputs }; - export namespace outputs_588 { - let out_577: string; - export { out_577 as out }; - } - export { outputs_588 as outputs }; - } - namespace ND_mix_color3_color3 { - let node_589: string; - export { node_589 as node }; - let inherit_589: null; - export { inherit_589 as inherit }; - export namespace inputs_589 { - let fg_32: string; - export { fg_32 as fg }; - let bg_32: string; - export { bg_32 as bg }; - let mix_32: string; - export { mix_32 as mix }; - } - export { inputs_589 as inputs }; - export namespace outputs_589 { - let out_578: string; - export { out_578 as out }; - } - export { outputs_589 as outputs }; - } - namespace ND_mix_color4 { - let node_590: string; - export { node_590 as node }; - let inherit_590: null; - export { inherit_590 as inherit }; - export namespace inputs_590 { - let fg_33: string; - export { fg_33 as fg }; - let bg_33: string; - export { bg_33 as bg }; - let mix_33: string; - export { mix_33 as mix }; - } - export { inputs_590 as inputs }; - export namespace outputs_590 { - let out_579: string; - export { out_579 as out }; - } - export { outputs_590 as outputs }; - } - namespace ND_mix_color4_color4 { - let node_591: string; - export { node_591 as node }; - let inherit_591: null; - export { inherit_591 as inherit }; - export namespace inputs_591 { - let fg_34: string; - export { fg_34 as fg }; - let bg_34: string; - export { bg_34 as bg }; - let mix_34: string; - export { mix_34 as mix }; - } - export { inputs_591 as inputs }; - export namespace outputs_591 { - let out_580: string; - export { out_580 as out }; - } - export { outputs_591 as outputs }; - } - namespace ND_mix_vector2 { - let node_592: string; - export { node_592 as node }; - let inherit_592: null; - export { inherit_592 as inherit }; - export namespace inputs_592 { - let fg_35: string; - export { fg_35 as fg }; - let bg_35: string; - export { bg_35 as bg }; - let mix_35: string; - export { mix_35 as mix }; - } - export { inputs_592 as inputs }; - export namespace outputs_592 { - let out_581: string; - export { out_581 as out }; - } - export { outputs_592 as outputs }; - } - namespace ND_mix_vector2_vector2 { - let node_593: string; - export { node_593 as node }; - let inherit_593: null; - export { inherit_593 as inherit }; - export namespace inputs_593 { - let fg_36: string; - export { fg_36 as fg }; - let bg_36: string; - export { bg_36 as bg }; - let mix_36: string; - export { mix_36 as mix }; - } - export { inputs_593 as inputs }; - export namespace outputs_593 { - let out_582: string; - export { out_582 as out }; - } - export { outputs_593 as outputs }; - } - namespace ND_mix_vector3 { - let node_594: string; - export { node_594 as node }; - let inherit_594: null; - export { inherit_594 as inherit }; - export namespace inputs_594 { - let fg_37: string; - export { fg_37 as fg }; - let bg_37: string; - export { bg_37 as bg }; - let mix_37: string; - export { mix_37 as mix }; - } - export { inputs_594 as inputs }; - export namespace outputs_594 { - let out_583: string; - export { out_583 as out }; - } - export { outputs_594 as outputs }; - } - namespace ND_mix_vector3_vector3 { - let node_595: string; - export { node_595 as node }; - let inherit_595: null; - export { inherit_595 as inherit }; - export namespace inputs_595 { - let fg_38: string; - export { fg_38 as fg }; - let bg_38: string; - export { bg_38 as bg }; - let mix_38: string; - export { mix_38 as mix }; - } - export { inputs_595 as inputs }; - export namespace outputs_595 { - let out_584: string; - export { out_584 as out }; - } - export { outputs_595 as outputs }; - } - namespace ND_mix_vector4 { - let node_596: string; - export { node_596 as node }; - let inherit_596: null; - export { inherit_596 as inherit }; - export namespace inputs_596 { - let fg_39: string; - export { fg_39 as fg }; - let bg_39: string; - export { bg_39 as bg }; - let mix_39: string; - export { mix_39 as mix }; - } - export { inputs_596 as inputs }; - export namespace outputs_596 { - let out_585: string; - export { out_585 as out }; - } - export { outputs_596 as outputs }; - } - namespace ND_mix_vector4_vector4 { - let node_597: string; - export { node_597 as node }; - let inherit_597: null; - export { inherit_597 as inherit }; - export namespace inputs_597 { - let fg_40: string; - export { fg_40 as fg }; - let bg_40: string; - export { bg_40 as bg }; - let mix_40: string; - export { mix_40 as mix }; - } - export { inputs_597 as inputs }; - export namespace outputs_597 { - let out_586: string; - export { out_586 as out }; - } - export { outputs_597 as outputs }; - } - namespace ND_mix_surfaceshader { - let node_598: string; - export { node_598 as node }; - let inherit_598: null; - export { inherit_598 as inherit }; - export namespace inputs_598 { - let fg_41: string; - export { fg_41 as fg }; - let bg_41: string; - export { bg_41 as bg }; - let mix_41: string; - export { mix_41 as mix }; - } - export { inputs_598 as inputs }; - export namespace outputs_598 { - let out_587: string; - export { out_587 as out }; - } - export { outputs_598 as outputs }; - } - namespace ND_mix_displacementshader { - let node_599: string; - export { node_599 as node }; - let inherit_599: null; - export { inherit_599 as inherit }; - export namespace inputs_599 { - let fg_42: string; - export { fg_42 as fg }; - let bg_42: string; - export { bg_42 as bg }; - let mix_42: string; - export { mix_42 as mix }; - } - export { inputs_599 as inputs }; - export namespace outputs_599 { - let out_588: string; - export { out_588 as out }; - } - export { outputs_599 as outputs }; - } - namespace ND_mix_volumeshader { - let node_600: string; - export { node_600 as node }; - let inherit_600: null; - export { inherit_600 as inherit }; - export namespace inputs_600 { - let fg_43: string; - export { fg_43 as fg }; - let bg_43: string; - export { bg_43 as bg }; - let mix_43: string; - export { mix_43 as mix }; - } - export { inputs_600 as inputs }; - export namespace outputs_600 { - let out_589: string; - export { out_589 as out }; - } - export { outputs_600 as outputs }; - } - namespace ND_ifgreater_float { - let node_601: string; - export { node_601 as node }; - let inherit_601: null; - export { inherit_601 as inherit }; - export namespace inputs_601 { - export let value1: string; - export let value2: string; - let in1_129: string; - export { in1_129 as in1 }; - let in2_129: string; - export { in2_129 as in2 }; - } - export { inputs_601 as inputs }; - export namespace outputs_601 { - let out_590: string; - export { out_590 as out }; - } - export { outputs_601 as outputs }; - } - namespace ND_ifgreater_integer { - let node_602: string; - export { node_602 as node }; - let inherit_602: null; - export { inherit_602 as inherit }; - export namespace inputs_602 { - let value1_1: string; - export { value1_1 as value1 }; - let value2_1: string; - export { value2_1 as value2 }; - let in1_130: string; - export { in1_130 as in1 }; - let in2_130: string; - export { in2_130 as in2 }; - } - export { inputs_602 as inputs }; - export namespace outputs_602 { - let out_591: string; - export { out_591 as out }; - } - export { outputs_602 as outputs }; - } - namespace ND_ifgreater_color3 { - let node_603: string; - export { node_603 as node }; - let inherit_603: null; - export { inherit_603 as inherit }; - export namespace inputs_603 { - let value1_2: string; - export { value1_2 as value1 }; - let value2_2: string; - export { value2_2 as value2 }; - let in1_131: string; - export { in1_131 as in1 }; - let in2_131: string; - export { in2_131 as in2 }; - } - export { inputs_603 as inputs }; - export namespace outputs_603 { - let out_592: string; - export { out_592 as out }; - } - export { outputs_603 as outputs }; - } - namespace ND_ifgreater_color4 { - let node_604: string; - export { node_604 as node }; - let inherit_604: null; - export { inherit_604 as inherit }; - export namespace inputs_604 { - let value1_3: string; - export { value1_3 as value1 }; - let value2_3: string; - export { value2_3 as value2 }; - let in1_132: string; - export { in1_132 as in1 }; - let in2_132: string; - export { in2_132 as in2 }; - } - export { inputs_604 as inputs }; - export namespace outputs_604 { - let out_593: string; - export { out_593 as out }; - } - export { outputs_604 as outputs }; - } - namespace ND_ifgreater_vector2 { - let node_605: string; - export { node_605 as node }; - let inherit_605: null; - export { inherit_605 as inherit }; - export namespace inputs_605 { - let value1_4: string; - export { value1_4 as value1 }; - let value2_4: string; - export { value2_4 as value2 }; - let in1_133: string; - export { in1_133 as in1 }; - let in2_133: string; - export { in2_133 as in2 }; - } - export { inputs_605 as inputs }; - export namespace outputs_605 { - let out_594: string; - export { out_594 as out }; - } - export { outputs_605 as outputs }; - } - namespace ND_ifgreater_vector3 { - let node_606: string; - export { node_606 as node }; - let inherit_606: null; - export { inherit_606 as inherit }; - export namespace inputs_606 { - let value1_5: string; - export { value1_5 as value1 }; - let value2_5: string; - export { value2_5 as value2 }; - let in1_134: string; - export { in1_134 as in1 }; - let in2_134: string; - export { in2_134 as in2 }; - } - export { inputs_606 as inputs }; - export namespace outputs_606 { - let out_595: string; - export { out_595 as out }; - } - export { outputs_606 as outputs }; - } - namespace ND_ifgreater_vector4 { - let node_607: string; - export { node_607 as node }; - let inherit_607: null; - export { inherit_607 as inherit }; - export namespace inputs_607 { - let value1_6: string; - export { value1_6 as value1 }; - let value2_6: string; - export { value2_6 as value2 }; - let in1_135: string; - export { in1_135 as in1 }; - let in2_135: string; - export { in2_135 as in2 }; - } - export { inputs_607 as inputs }; - export namespace outputs_607 { - let out_596: string; - export { out_596 as out }; - } - export { outputs_607 as outputs }; - } - namespace ND_ifgreater_matrix33 { - let node_608: string; - export { node_608 as node }; - let inherit_608: null; - export { inherit_608 as inherit }; - export namespace inputs_608 { - let value1_7: string; - export { value1_7 as value1 }; - let value2_7: string; - export { value2_7 as value2 }; - let in1_136: string; - export { in1_136 as in1 }; - let in2_136: string; - export { in2_136 as in2 }; - } - export { inputs_608 as inputs }; - export namespace outputs_608 { - let out_597: string; - export { out_597 as out }; - } - export { outputs_608 as outputs }; - } - namespace ND_ifgreater_matrix44 { - let node_609: string; - export { node_609 as node }; - let inherit_609: null; - export { inherit_609 as inherit }; - export namespace inputs_609 { - let value1_8: string; - export { value1_8 as value1 }; - let value2_8: string; - export { value2_8 as value2 }; - let in1_137: string; - export { in1_137 as in1 }; - let in2_137: string; - export { in2_137 as in2 }; - } - export { inputs_609 as inputs }; - export namespace outputs_609 { - let out_598: string; - export { out_598 as out }; - } - export { outputs_609 as outputs }; - } - namespace ND_ifgreater_boolean { - let node_610: string; - export { node_610 as node }; - let inherit_610: null; - export { inherit_610 as inherit }; - export namespace inputs_610 { - let value1_9: string; - export { value1_9 as value1 }; - let value2_9: string; - export { value2_9 as value2 }; - } - export { inputs_610 as inputs }; - export namespace outputs_610 { - let out_599: string; - export { out_599 as out }; - } - export { outputs_610 as outputs }; - } - namespace ND_ifgreater_floatI { - let node_611: string; - export { node_611 as node }; - let inherit_611: null; - export { inherit_611 as inherit }; - export namespace inputs_611 { - let value1_10: string; - export { value1_10 as value1 }; - let value2_10: string; - export { value2_10 as value2 }; - let in1_138: string; - export { in1_138 as in1 }; - let in2_138: string; - export { in2_138 as in2 }; - } - export { inputs_611 as inputs }; - export namespace outputs_611 { - let out_600: string; - export { out_600 as out }; - } - export { outputs_611 as outputs }; - } - namespace ND_ifgreater_integerI { - let node_612: string; - export { node_612 as node }; - let inherit_612: null; - export { inherit_612 as inherit }; - export namespace inputs_612 { - let value1_11: string; - export { value1_11 as value1 }; - let value2_11: string; - export { value2_11 as value2 }; - let in1_139: string; - export { in1_139 as in1 }; - let in2_139: string; - export { in2_139 as in2 }; - } - export { inputs_612 as inputs }; - export namespace outputs_612 { - let out_601: string; - export { out_601 as out }; - } - export { outputs_612 as outputs }; - } - namespace ND_ifgreater_color3I { - let node_613: string; - export { node_613 as node }; - let inherit_613: null; - export { inherit_613 as inherit }; - export namespace inputs_613 { - let value1_12: string; - export { value1_12 as value1 }; - let value2_12: string; - export { value2_12 as value2 }; - let in1_140: string; - export { in1_140 as in1 }; - let in2_140: string; - export { in2_140 as in2 }; - } - export { inputs_613 as inputs }; - export namespace outputs_613 { - let out_602: string; - export { out_602 as out }; - } - export { outputs_613 as outputs }; - } - namespace ND_ifgreater_color4I { - let node_614: string; - export { node_614 as node }; - let inherit_614: null; - export { inherit_614 as inherit }; - export namespace inputs_614 { - let value1_13: string; - export { value1_13 as value1 }; - let value2_13: string; - export { value2_13 as value2 }; - let in1_141: string; - export { in1_141 as in1 }; - let in2_141: string; - export { in2_141 as in2 }; - } - export { inputs_614 as inputs }; - export namespace outputs_614 { - let out_603: string; - export { out_603 as out }; - } - export { outputs_614 as outputs }; - } - namespace ND_ifgreater_vector2I { - let node_615: string; - export { node_615 as node }; - let inherit_615: null; - export { inherit_615 as inherit }; - export namespace inputs_615 { - let value1_14: string; - export { value1_14 as value1 }; - let value2_14: string; - export { value2_14 as value2 }; - let in1_142: string; - export { in1_142 as in1 }; - let in2_142: string; - export { in2_142 as in2 }; - } - export { inputs_615 as inputs }; - export namespace outputs_615 { - let out_604: string; - export { out_604 as out }; - } - export { outputs_615 as outputs }; - } - namespace ND_ifgreater_vector3I { - let node_616: string; - export { node_616 as node }; - let inherit_616: null; - export { inherit_616 as inherit }; - export namespace inputs_616 { - let value1_15: string; - export { value1_15 as value1 }; - let value2_15: string; - export { value2_15 as value2 }; - let in1_143: string; - export { in1_143 as in1 }; - let in2_143: string; - export { in2_143 as in2 }; - } - export { inputs_616 as inputs }; - export namespace outputs_616 { - let out_605: string; - export { out_605 as out }; - } - export { outputs_616 as outputs }; - } - namespace ND_ifgreater_vector4I { - let node_617: string; - export { node_617 as node }; - let inherit_617: null; - export { inherit_617 as inherit }; - export namespace inputs_617 { - let value1_16: string; - export { value1_16 as value1 }; - let value2_16: string; - export { value2_16 as value2 }; - let in1_144: string; - export { in1_144 as in1 }; - let in2_144: string; - export { in2_144 as in2 }; - } - export { inputs_617 as inputs }; - export namespace outputs_617 { - let out_606: string; - export { out_606 as out }; - } - export { outputs_617 as outputs }; - } - namespace ND_ifgreater_matrix33I { - let node_618: string; - export { node_618 as node }; - let inherit_618: null; - export { inherit_618 as inherit }; - export namespace inputs_618 { - let value1_17: string; - export { value1_17 as value1 }; - let value2_17: string; - export { value2_17 as value2 }; - let in1_145: string; - export { in1_145 as in1 }; - let in2_145: string; - export { in2_145 as in2 }; - } - export { inputs_618 as inputs }; - export namespace outputs_618 { - let out_607: string; - export { out_607 as out }; - } - export { outputs_618 as outputs }; - } - namespace ND_ifgreater_matrix44I { - let node_619: string; - export { node_619 as node }; - let inherit_619: null; - export { inherit_619 as inherit }; - export namespace inputs_619 { - let value1_18: string; - export { value1_18 as value1 }; - let value2_18: string; - export { value2_18 as value2 }; - let in1_146: string; - export { in1_146 as in1 }; - let in2_146: string; - export { in2_146 as in2 }; - } - export { inputs_619 as inputs }; - export namespace outputs_619 { - let out_608: string; - export { out_608 as out }; - } - export { outputs_619 as outputs }; - } - namespace ND_ifgreater_booleanI { - let node_620: string; - export { node_620 as node }; - let inherit_620: null; - export { inherit_620 as inherit }; - export namespace inputs_620 { - let value1_19: string; - export { value1_19 as value1 }; - let value2_19: string; - export { value2_19 as value2 }; - } - export { inputs_620 as inputs }; - export namespace outputs_620 { - let out_609: string; - export { out_609 as out }; - } - export { outputs_620 as outputs }; - } - namespace ND_ifgreatereq_float { - let node_621: string; - export { node_621 as node }; - let inherit_621: null; - export { inherit_621 as inherit }; - export namespace inputs_621 { - let value1_20: string; - export { value1_20 as value1 }; - let value2_20: string; - export { value2_20 as value2 }; - let in1_147: string; - export { in1_147 as in1 }; - let in2_147: string; - export { in2_147 as in2 }; - } - export { inputs_621 as inputs }; - export namespace outputs_621 { - let out_610: string; - export { out_610 as out }; - } - export { outputs_621 as outputs }; - } - namespace ND_ifgreatereq_integer { - let node_622: string; - export { node_622 as node }; - let inherit_622: null; - export { inherit_622 as inherit }; - export namespace inputs_622 { - let value1_21: string; - export { value1_21 as value1 }; - let value2_21: string; - export { value2_21 as value2 }; - let in1_148: string; - export { in1_148 as in1 }; - let in2_148: string; - export { in2_148 as in2 }; - } - export { inputs_622 as inputs }; - export namespace outputs_622 { - let out_611: string; - export { out_611 as out }; - } - export { outputs_622 as outputs }; - } - namespace ND_ifgreatereq_color3 { - let node_623: string; - export { node_623 as node }; - let inherit_623: null; - export { inherit_623 as inherit }; - export namespace inputs_623 { - let value1_22: string; - export { value1_22 as value1 }; - let value2_22: string; - export { value2_22 as value2 }; - let in1_149: string; - export { in1_149 as in1 }; - let in2_149: string; - export { in2_149 as in2 }; - } - export { inputs_623 as inputs }; - export namespace outputs_623 { - let out_612: string; - export { out_612 as out }; - } - export { outputs_623 as outputs }; - } - namespace ND_ifgreatereq_color4 { - let node_624: string; - export { node_624 as node }; - let inherit_624: null; - export { inherit_624 as inherit }; - export namespace inputs_624 { - let value1_23: string; - export { value1_23 as value1 }; - let value2_23: string; - export { value2_23 as value2 }; - let in1_150: string; - export { in1_150 as in1 }; - let in2_150: string; - export { in2_150 as in2 }; - } - export { inputs_624 as inputs }; - export namespace outputs_624 { - let out_613: string; - export { out_613 as out }; - } - export { outputs_624 as outputs }; - } - namespace ND_ifgreatereq_vector2 { - let node_625: string; - export { node_625 as node }; - let inherit_625: null; - export { inherit_625 as inherit }; - export namespace inputs_625 { - let value1_24: string; - export { value1_24 as value1 }; - let value2_24: string; - export { value2_24 as value2 }; - let in1_151: string; - export { in1_151 as in1 }; - let in2_151: string; - export { in2_151 as in2 }; - } - export { inputs_625 as inputs }; - export namespace outputs_625 { - let out_614: string; - export { out_614 as out }; - } - export { outputs_625 as outputs }; - } - namespace ND_ifgreatereq_vector3 { - let node_626: string; - export { node_626 as node }; - let inherit_626: null; - export { inherit_626 as inherit }; - export namespace inputs_626 { - let value1_25: string; - export { value1_25 as value1 }; - let value2_25: string; - export { value2_25 as value2 }; - let in1_152: string; - export { in1_152 as in1 }; - let in2_152: string; - export { in2_152 as in2 }; - } - export { inputs_626 as inputs }; - export namespace outputs_626 { - let out_615: string; - export { out_615 as out }; - } - export { outputs_626 as outputs }; - } - namespace ND_ifgreatereq_vector4 { - let node_627: string; - export { node_627 as node }; - let inherit_627: null; - export { inherit_627 as inherit }; - export namespace inputs_627 { - let value1_26: string; - export { value1_26 as value1 }; - let value2_26: string; - export { value2_26 as value2 }; - let in1_153: string; - export { in1_153 as in1 }; - let in2_153: string; - export { in2_153 as in2 }; - } - export { inputs_627 as inputs }; - export namespace outputs_627 { - let out_616: string; - export { out_616 as out }; - } - export { outputs_627 as outputs }; - } - namespace ND_ifgreatereq_matrix33 { - let node_628: string; - export { node_628 as node }; - let inherit_628: null; - export { inherit_628 as inherit }; - export namespace inputs_628 { - let value1_27: string; - export { value1_27 as value1 }; - let value2_27: string; - export { value2_27 as value2 }; - let in1_154: string; - export { in1_154 as in1 }; - let in2_154: string; - export { in2_154 as in2 }; - } - export { inputs_628 as inputs }; - export namespace outputs_628 { - let out_617: string; - export { out_617 as out }; - } - export { outputs_628 as outputs }; - } - namespace ND_ifgreatereq_matrix44 { - let node_629: string; - export { node_629 as node }; - let inherit_629: null; - export { inherit_629 as inherit }; - export namespace inputs_629 { - let value1_28: string; - export { value1_28 as value1 }; - let value2_28: string; - export { value2_28 as value2 }; - let in1_155: string; - export { in1_155 as in1 }; - let in2_155: string; - export { in2_155 as in2 }; - } - export { inputs_629 as inputs }; - export namespace outputs_629 { - let out_618: string; - export { out_618 as out }; - } - export { outputs_629 as outputs }; - } - namespace ND_ifgreatereq_boolean { - let node_630: string; - export { node_630 as node }; - let inherit_630: null; - export { inherit_630 as inherit }; - export namespace inputs_630 { - let value1_29: string; - export { value1_29 as value1 }; - let value2_29: string; - export { value2_29 as value2 }; - } - export { inputs_630 as inputs }; - export namespace outputs_630 { - let out_619: string; - export { out_619 as out }; - } - export { outputs_630 as outputs }; - } - namespace ND_ifgreatereq_floatI { - let node_631: string; - export { node_631 as node }; - let inherit_631: null; - export { inherit_631 as inherit }; - export namespace inputs_631 { - let value1_30: string; - export { value1_30 as value1 }; - let value2_30: string; - export { value2_30 as value2 }; - let in1_156: string; - export { in1_156 as in1 }; - let in2_156: string; - export { in2_156 as in2 }; - } - export { inputs_631 as inputs }; - export namespace outputs_631 { - let out_620: string; - export { out_620 as out }; - } - export { outputs_631 as outputs }; - } - namespace ND_ifgreatereq_integerI { - let node_632: string; - export { node_632 as node }; - let inherit_632: null; - export { inherit_632 as inherit }; - export namespace inputs_632 { - let value1_31: string; - export { value1_31 as value1 }; - let value2_31: string; - export { value2_31 as value2 }; - let in1_157: string; - export { in1_157 as in1 }; - let in2_157: string; - export { in2_157 as in2 }; - } - export { inputs_632 as inputs }; - export namespace outputs_632 { - let out_621: string; - export { out_621 as out }; - } - export { outputs_632 as outputs }; - } - namespace ND_ifgreatereq_color3I { - let node_633: string; - export { node_633 as node }; - let inherit_633: null; - export { inherit_633 as inherit }; - export namespace inputs_633 { - let value1_32: string; - export { value1_32 as value1 }; - let value2_32: string; - export { value2_32 as value2 }; - let in1_158: string; - export { in1_158 as in1 }; - let in2_158: string; - export { in2_158 as in2 }; - } - export { inputs_633 as inputs }; - export namespace outputs_633 { - let out_622: string; - export { out_622 as out }; - } - export { outputs_633 as outputs }; - } - namespace ND_ifgreatereq_color4I { - let node_634: string; - export { node_634 as node }; - let inherit_634: null; - export { inherit_634 as inherit }; - export namespace inputs_634 { - let value1_33: string; - export { value1_33 as value1 }; - let value2_33: string; - export { value2_33 as value2 }; - let in1_159: string; - export { in1_159 as in1 }; - let in2_159: string; - export { in2_159 as in2 }; - } - export { inputs_634 as inputs }; - export namespace outputs_634 { - let out_623: string; - export { out_623 as out }; - } - export { outputs_634 as outputs }; - } - namespace ND_ifgreatereq_vector2I { - let node_635: string; - export { node_635 as node }; - let inherit_635: null; - export { inherit_635 as inherit }; - export namespace inputs_635 { - let value1_34: string; - export { value1_34 as value1 }; - let value2_34: string; - export { value2_34 as value2 }; - let in1_160: string; - export { in1_160 as in1 }; - let in2_160: string; - export { in2_160 as in2 }; - } - export { inputs_635 as inputs }; - export namespace outputs_635 { - let out_624: string; - export { out_624 as out }; - } - export { outputs_635 as outputs }; - } - namespace ND_ifgreatereq_vector3I { - let node_636: string; - export { node_636 as node }; - let inherit_636: null; - export { inherit_636 as inherit }; - export namespace inputs_636 { - let value1_35: string; - export { value1_35 as value1 }; - let value2_35: string; - export { value2_35 as value2 }; - let in1_161: string; - export { in1_161 as in1 }; - let in2_161: string; - export { in2_161 as in2 }; - } - export { inputs_636 as inputs }; - export namespace outputs_636 { - let out_625: string; - export { out_625 as out }; - } - export { outputs_636 as outputs }; - } - namespace ND_ifgreatereq_vector4I { - let node_637: string; - export { node_637 as node }; - let inherit_637: null; - export { inherit_637 as inherit }; - export namespace inputs_637 { - let value1_36: string; - export { value1_36 as value1 }; - let value2_36: string; - export { value2_36 as value2 }; - let in1_162: string; - export { in1_162 as in1 }; - let in2_162: string; - export { in2_162 as in2 }; - } - export { inputs_637 as inputs }; - export namespace outputs_637 { - let out_626: string; - export { out_626 as out }; - } - export { outputs_637 as outputs }; - } - namespace ND_ifgreatereq_matrix33I { - let node_638: string; - export { node_638 as node }; - let inherit_638: null; - export { inherit_638 as inherit }; - export namespace inputs_638 { - let value1_37: string; - export { value1_37 as value1 }; - let value2_37: string; - export { value2_37 as value2 }; - let in1_163: string; - export { in1_163 as in1 }; - let in2_163: string; - export { in2_163 as in2 }; - } - export { inputs_638 as inputs }; - export namespace outputs_638 { - let out_627: string; - export { out_627 as out }; - } - export { outputs_638 as outputs }; - } - namespace ND_ifgreatereq_matrix44I { - let node_639: string; - export { node_639 as node }; - let inherit_639: null; - export { inherit_639 as inherit }; - export namespace inputs_639 { - let value1_38: string; - export { value1_38 as value1 }; - let value2_38: string; - export { value2_38 as value2 }; - let in1_164: string; - export { in1_164 as in1 }; - let in2_164: string; - export { in2_164 as in2 }; - } - export { inputs_639 as inputs }; - export namespace outputs_639 { - let out_628: string; - export { out_628 as out }; - } - export { outputs_639 as outputs }; - } - namespace ND_ifgreatereq_booleanI { - let node_640: string; - export { node_640 as node }; - let inherit_640: null; - export { inherit_640 as inherit }; - export namespace inputs_640 { - let value1_39: string; - export { value1_39 as value1 }; - let value2_39: string; - export { value2_39 as value2 }; - } - export { inputs_640 as inputs }; - export namespace outputs_640 { - let out_629: string; - export { out_629 as out }; - } - export { outputs_640 as outputs }; - } - namespace ND_ifequal_float { - let node_641: string; - export { node_641 as node }; - let inherit_641: null; - export { inherit_641 as inherit }; - export namespace inputs_641 { - let value1_40: string; - export { value1_40 as value1 }; - let value2_40: string; - export { value2_40 as value2 }; - let in1_165: string; - export { in1_165 as in1 }; - let in2_165: string; - export { in2_165 as in2 }; - } - export { inputs_641 as inputs }; - export namespace outputs_641 { - let out_630: string; - export { out_630 as out }; - } - export { outputs_641 as outputs }; - } - namespace ND_ifequal_integer { - let node_642: string; - export { node_642 as node }; - let inherit_642: null; - export { inherit_642 as inherit }; - export namespace inputs_642 { - let value1_41: string; - export { value1_41 as value1 }; - let value2_41: string; - export { value2_41 as value2 }; - let in1_166: string; - export { in1_166 as in1 }; - let in2_166: string; - export { in2_166 as in2 }; - } - export { inputs_642 as inputs }; - export namespace outputs_642 { - let out_631: string; - export { out_631 as out }; - } - export { outputs_642 as outputs }; - } - namespace ND_ifequal_color3 { - let node_643: string; - export { node_643 as node }; - let inherit_643: null; - export { inherit_643 as inherit }; - export namespace inputs_643 { - let value1_42: string; - export { value1_42 as value1 }; - let value2_42: string; - export { value2_42 as value2 }; - let in1_167: string; - export { in1_167 as in1 }; - let in2_167: string; - export { in2_167 as in2 }; - } - export { inputs_643 as inputs }; - export namespace outputs_643 { - let out_632: string; - export { out_632 as out }; - } - export { outputs_643 as outputs }; - } - namespace ND_ifequal_color4 { - let node_644: string; - export { node_644 as node }; - let inherit_644: null; - export { inherit_644 as inherit }; - export namespace inputs_644 { - let value1_43: string; - export { value1_43 as value1 }; - let value2_43: string; - export { value2_43 as value2 }; - let in1_168: string; - export { in1_168 as in1 }; - let in2_168: string; - export { in2_168 as in2 }; - } - export { inputs_644 as inputs }; - export namespace outputs_644 { - let out_633: string; - export { out_633 as out }; - } - export { outputs_644 as outputs }; - } - namespace ND_ifequal_vector2 { - let node_645: string; - export { node_645 as node }; - let inherit_645: null; - export { inherit_645 as inherit }; - export namespace inputs_645 { - let value1_44: string; - export { value1_44 as value1 }; - let value2_44: string; - export { value2_44 as value2 }; - let in1_169: string; - export { in1_169 as in1 }; - let in2_169: string; - export { in2_169 as in2 }; - } - export { inputs_645 as inputs }; - export namespace outputs_645 { - let out_634: string; - export { out_634 as out }; - } - export { outputs_645 as outputs }; - } - namespace ND_ifequal_vector3 { - let node_646: string; - export { node_646 as node }; - let inherit_646: null; - export { inherit_646 as inherit }; - export namespace inputs_646 { - let value1_45: string; - export { value1_45 as value1 }; - let value2_45: string; - export { value2_45 as value2 }; - let in1_170: string; - export { in1_170 as in1 }; - let in2_170: string; - export { in2_170 as in2 }; - } - export { inputs_646 as inputs }; - export namespace outputs_646 { - let out_635: string; - export { out_635 as out }; - } - export { outputs_646 as outputs }; - } - namespace ND_ifequal_vector4 { - let node_647: string; - export { node_647 as node }; - let inherit_647: null; - export { inherit_647 as inherit }; - export namespace inputs_647 { - let value1_46: string; - export { value1_46 as value1 }; - let value2_46: string; - export { value2_46 as value2 }; - let in1_171: string; - export { in1_171 as in1 }; - let in2_171: string; - export { in2_171 as in2 }; - } - export { inputs_647 as inputs }; - export namespace outputs_647 { - let out_636: string; - export { out_636 as out }; - } - export { outputs_647 as outputs }; - } - namespace ND_ifequal_matrix33 { - let node_648: string; - export { node_648 as node }; - let inherit_648: null; - export { inherit_648 as inherit }; - export namespace inputs_648 { - let value1_47: string; - export { value1_47 as value1 }; - let value2_47: string; - export { value2_47 as value2 }; - let in1_172: string; - export { in1_172 as in1 }; - let in2_172: string; - export { in2_172 as in2 }; - } - export { inputs_648 as inputs }; - export namespace outputs_648 { - let out_637: string; - export { out_637 as out }; - } - export { outputs_648 as outputs }; - } - namespace ND_ifequal_matrix44 { - let node_649: string; - export { node_649 as node }; - let inherit_649: null; - export { inherit_649 as inherit }; - export namespace inputs_649 { - let value1_48: string; - export { value1_48 as value1 }; - let value2_48: string; - export { value2_48 as value2 }; - let in1_173: string; - export { in1_173 as in1 }; - let in2_173: string; - export { in2_173 as in2 }; - } - export { inputs_649 as inputs }; - export namespace outputs_649 { - let out_638: string; - export { out_638 as out }; - } - export { outputs_649 as outputs }; - } - namespace ND_ifequal_boolean { - let node_650: string; - export { node_650 as node }; - let inherit_650: null; - export { inherit_650 as inherit }; - export namespace inputs_650 { - let value1_49: string; - export { value1_49 as value1 }; - let value2_49: string; - export { value2_49 as value2 }; - } - export { inputs_650 as inputs }; - export namespace outputs_650 { - let out_639: string; - export { out_639 as out }; - } - export { outputs_650 as outputs }; - } - namespace ND_ifequal_floatI { - let node_651: string; - export { node_651 as node }; - let inherit_651: null; - export { inherit_651 as inherit }; - export namespace inputs_651 { - let value1_50: string; - export { value1_50 as value1 }; - let value2_50: string; - export { value2_50 as value2 }; - let in1_174: string; - export { in1_174 as in1 }; - let in2_174: string; - export { in2_174 as in2 }; - } - export { inputs_651 as inputs }; - export namespace outputs_651 { - let out_640: string; - export { out_640 as out }; - } - export { outputs_651 as outputs }; - } - namespace ND_ifequal_integerI { - let node_652: string; - export { node_652 as node }; - let inherit_652: null; - export { inherit_652 as inherit }; - export namespace inputs_652 { - let value1_51: string; - export { value1_51 as value1 }; - let value2_51: string; - export { value2_51 as value2 }; - let in1_175: string; - export { in1_175 as in1 }; - let in2_175: string; - export { in2_175 as in2 }; - } - export { inputs_652 as inputs }; - export namespace outputs_652 { - let out_641: string; - export { out_641 as out }; - } - export { outputs_652 as outputs }; - } - namespace ND_ifequal_color3I { - let node_653: string; - export { node_653 as node }; - let inherit_653: null; - export { inherit_653 as inherit }; - export namespace inputs_653 { - let value1_52: string; - export { value1_52 as value1 }; - let value2_52: string; - export { value2_52 as value2 }; - let in1_176: string; - export { in1_176 as in1 }; - let in2_176: string; - export { in2_176 as in2 }; - } - export { inputs_653 as inputs }; - export namespace outputs_653 { - let out_642: string; - export { out_642 as out }; - } - export { outputs_653 as outputs }; - } - namespace ND_ifequal_color4I { - let node_654: string; - export { node_654 as node }; - let inherit_654: null; - export { inherit_654 as inherit }; - export namespace inputs_654 { - let value1_53: string; - export { value1_53 as value1 }; - let value2_53: string; - export { value2_53 as value2 }; - let in1_177: string; - export { in1_177 as in1 }; - let in2_177: string; - export { in2_177 as in2 }; - } - export { inputs_654 as inputs }; - export namespace outputs_654 { - let out_643: string; - export { out_643 as out }; - } - export { outputs_654 as outputs }; - } - namespace ND_ifequal_vector2I { - let node_655: string; - export { node_655 as node }; - let inherit_655: null; - export { inherit_655 as inherit }; - export namespace inputs_655 { - let value1_54: string; - export { value1_54 as value1 }; - let value2_54: string; - export { value2_54 as value2 }; - let in1_178: string; - export { in1_178 as in1 }; - let in2_178: string; - export { in2_178 as in2 }; - } - export { inputs_655 as inputs }; - export namespace outputs_655 { - let out_644: string; - export { out_644 as out }; - } - export { outputs_655 as outputs }; - } - namespace ND_ifequal_vector3I { - let node_656: string; - export { node_656 as node }; - let inherit_656: null; - export { inherit_656 as inherit }; - export namespace inputs_656 { - let value1_55: string; - export { value1_55 as value1 }; - let value2_55: string; - export { value2_55 as value2 }; - let in1_179: string; - export { in1_179 as in1 }; - let in2_179: string; - export { in2_179 as in2 }; - } - export { inputs_656 as inputs }; - export namespace outputs_656 { - let out_645: string; - export { out_645 as out }; - } - export { outputs_656 as outputs }; - } - namespace ND_ifequal_vector4I { - let node_657: string; - export { node_657 as node }; - let inherit_657: null; - export { inherit_657 as inherit }; - export namespace inputs_657 { - let value1_56: string; - export { value1_56 as value1 }; - let value2_56: string; - export { value2_56 as value2 }; - let in1_180: string; - export { in1_180 as in1 }; - let in2_180: string; - export { in2_180 as in2 }; - } - export { inputs_657 as inputs }; - export namespace outputs_657 { - let out_646: string; - export { out_646 as out }; - } - export { outputs_657 as outputs }; - } - namespace ND_ifequal_matrix33I { - let node_658: string; - export { node_658 as node }; - let inherit_658: null; - export { inherit_658 as inherit }; - export namespace inputs_658 { - let value1_57: string; - export { value1_57 as value1 }; - let value2_57: string; - export { value2_57 as value2 }; - let in1_181: string; - export { in1_181 as in1 }; - let in2_181: string; - export { in2_181 as in2 }; - } - export { inputs_658 as inputs }; - export namespace outputs_658 { - let out_647: string; - export { out_647 as out }; - } - export { outputs_658 as outputs }; - } - namespace ND_ifequal_matrix44I { - let node_659: string; - export { node_659 as node }; - let inherit_659: null; - export { inherit_659 as inherit }; - export namespace inputs_659 { - let value1_58: string; - export { value1_58 as value1 }; - let value2_58: string; - export { value2_58 as value2 }; - let in1_182: string; - export { in1_182 as in1 }; - let in2_182: string; - export { in2_182 as in2 }; - } - export { inputs_659 as inputs }; - export namespace outputs_659 { - let out_648: string; - export { out_648 as out }; - } - export { outputs_659 as outputs }; - } - namespace ND_ifequal_booleanI { - let node_660: string; - export { node_660 as node }; - let inherit_660: null; - export { inherit_660 as inherit }; - export namespace inputs_660 { - let value1_59: string; - export { value1_59 as value1 }; - let value2_59: string; - export { value2_59 as value2 }; - } - export { inputs_660 as inputs }; - export namespace outputs_660 { - let out_649: string; - export { out_649 as out }; - } - export { outputs_660 as outputs }; - } - namespace ND_ifequal_floatB { - let node_661: string; - export { node_661 as node }; - let inherit_661: null; - export { inherit_661 as inherit }; - export namespace inputs_661 { - let value1_60: string; - export { value1_60 as value1 }; - let value2_60: string; - export { value2_60 as value2 }; - let in1_183: string; - export { in1_183 as in1 }; - let in2_183: string; - export { in2_183 as in2 }; - } - export { inputs_661 as inputs }; - export namespace outputs_661 { - let out_650: string; - export { out_650 as out }; - } - export { outputs_661 as outputs }; - } - namespace ND_ifequal_integerB { - let node_662: string; - export { node_662 as node }; - let inherit_662: null; - export { inherit_662 as inherit }; - export namespace inputs_662 { - let value1_61: string; - export { value1_61 as value1 }; - let value2_61: string; - export { value2_61 as value2 }; - let in1_184: string; - export { in1_184 as in1 }; - let in2_184: string; - export { in2_184 as in2 }; - } - export { inputs_662 as inputs }; - export namespace outputs_662 { - let out_651: string; - export { out_651 as out }; - } - export { outputs_662 as outputs }; - } - namespace ND_ifequal_color3B { - let node_663: string; - export { node_663 as node }; - let inherit_663: null; - export { inherit_663 as inherit }; - export namespace inputs_663 { - let value1_62: string; - export { value1_62 as value1 }; - let value2_62: string; - export { value2_62 as value2 }; - let in1_185: string; - export { in1_185 as in1 }; - let in2_185: string; - export { in2_185 as in2 }; - } - export { inputs_663 as inputs }; - export namespace outputs_663 { - let out_652: string; - export { out_652 as out }; - } - export { outputs_663 as outputs }; - } - namespace ND_ifequal_color4B { - let node_664: string; - export { node_664 as node }; - let inherit_664: null; - export { inherit_664 as inherit }; - export namespace inputs_664 { - let value1_63: string; - export { value1_63 as value1 }; - let value2_63: string; - export { value2_63 as value2 }; - let in1_186: string; - export { in1_186 as in1 }; - let in2_186: string; - export { in2_186 as in2 }; - } - export { inputs_664 as inputs }; - export namespace outputs_664 { - let out_653: string; - export { out_653 as out }; - } - export { outputs_664 as outputs }; - } - namespace ND_ifequal_vector2B { - let node_665: string; - export { node_665 as node }; - let inherit_665: null; - export { inherit_665 as inherit }; - export namespace inputs_665 { - let value1_64: string; - export { value1_64 as value1 }; - let value2_64: string; - export { value2_64 as value2 }; - let in1_187: string; - export { in1_187 as in1 }; - let in2_187: string; - export { in2_187 as in2 }; - } - export { inputs_665 as inputs }; - export namespace outputs_665 { - let out_654: string; - export { out_654 as out }; - } - export { outputs_665 as outputs }; - } - namespace ND_ifequal_vector3B { - let node_666: string; - export { node_666 as node }; - let inherit_666: null; - export { inherit_666 as inherit }; - export namespace inputs_666 { - let value1_65: string; - export { value1_65 as value1 }; - let value2_65: string; - export { value2_65 as value2 }; - let in1_188: string; - export { in1_188 as in1 }; - let in2_188: string; - export { in2_188 as in2 }; - } - export { inputs_666 as inputs }; - export namespace outputs_666 { - let out_655: string; - export { out_655 as out }; - } - export { outputs_666 as outputs }; - } - namespace ND_ifequal_vector4B { - let node_667: string; - export { node_667 as node }; - let inherit_667: null; - export { inherit_667 as inherit }; - export namespace inputs_667 { - let value1_66: string; - export { value1_66 as value1 }; - let value2_66: string; - export { value2_66 as value2 }; - let in1_189: string; - export { in1_189 as in1 }; - let in2_189: string; - export { in2_189 as in2 }; - } - export { inputs_667 as inputs }; - export namespace outputs_667 { - let out_656: string; - export { out_656 as out }; - } - export { outputs_667 as outputs }; - } - namespace ND_ifequal_matrix33B { - let node_668: string; - export { node_668 as node }; - let inherit_668: null; - export { inherit_668 as inherit }; - export namespace inputs_668 { - let value1_67: string; - export { value1_67 as value1 }; - let value2_67: string; - export { value2_67 as value2 }; - let in1_190: string; - export { in1_190 as in1 }; - let in2_190: string; - export { in2_190 as in2 }; - } - export { inputs_668 as inputs }; - export namespace outputs_668 { - let out_657: string; - export { out_657 as out }; - } - export { outputs_668 as outputs }; - } - namespace ND_ifequal_matrix44B { - let node_669: string; - export { node_669 as node }; - let inherit_669: null; - export { inherit_669 as inherit }; - export namespace inputs_669 { - let value1_68: string; - export { value1_68 as value1 }; - let value2_68: string; - export { value2_68 as value2 }; - let in1_191: string; - export { in1_191 as in1 }; - let in2_191: string; - export { in2_191 as in2 }; - } - export { inputs_669 as inputs }; - export namespace outputs_669 { - let out_658: string; - export { out_658 as out }; - } - export { outputs_669 as outputs }; - } - namespace ND_ifequal_booleanB { - let node_670: string; - export { node_670 as node }; - let inherit_670: null; - export { inherit_670 as inherit }; - export namespace inputs_670 { - let value1_69: string; - export { value1_69 as value1 }; - let value2_69: string; - export { value2_69 as value2 }; - } - export { inputs_670 as inputs }; - export namespace outputs_670 { - let out_659: string; - export { out_659 as out }; - } - export { outputs_670 as outputs }; - } - namespace ND_switch_float { - let node_671: string; - export { node_671 as node }; - let inherit_671: null; - export { inherit_671 as inherit }; - export namespace inputs_671 { - let in1_192: string; - export { in1_192 as in1 }; - let in2_192: string; - export { in2_192 as in2 }; - export let in3: string; - export let in4: string; - export let in5: string; - export let in6: string; - export let in7: string; - export let in8: string; - export let in9: string; - export let in10: string; - export let which: string; - } - export { inputs_671 as inputs }; - export namespace outputs_671 { - let out_660: string; - export { out_660 as out }; - } - export { outputs_671 as outputs }; - } - namespace ND_switch_color3 { - let node_672: string; - export { node_672 as node }; - let inherit_672: null; - export { inherit_672 as inherit }; - export namespace inputs_672 { - let in1_193: string; - export { in1_193 as in1 }; - let in2_193: string; - export { in2_193 as in2 }; - let in3_1: string; - export { in3_1 as in3 }; - let in4_1: string; - export { in4_1 as in4 }; - let in5_1: string; - export { in5_1 as in5 }; - let in6_1: string; - export { in6_1 as in6 }; - let in7_1: string; - export { in7_1 as in7 }; - let in8_1: string; - export { in8_1 as in8 }; - let in9_1: string; - export { in9_1 as in9 }; - let in10_1: string; - export { in10_1 as in10 }; - let which_1: string; - export { which_1 as which }; - } - export { inputs_672 as inputs }; - export namespace outputs_672 { - let out_661: string; - export { out_661 as out }; - } - export { outputs_672 as outputs }; - } - namespace ND_switch_color4 { - let node_673: string; - export { node_673 as node }; - let inherit_673: null; - export { inherit_673 as inherit }; - export namespace inputs_673 { - let in1_194: string; - export { in1_194 as in1 }; - let in2_194: string; - export { in2_194 as in2 }; - let in3_2: string; - export { in3_2 as in3 }; - let in4_2: string; - export { in4_2 as in4 }; - let in5_2: string; - export { in5_2 as in5 }; - let in6_2: string; - export { in6_2 as in6 }; - let in7_2: string; - export { in7_2 as in7 }; - let in8_2: string; - export { in8_2 as in8 }; - let in9_2: string; - export { in9_2 as in9 }; - let in10_2: string; - export { in10_2 as in10 }; - let which_2: string; - export { which_2 as which }; - } - export { inputs_673 as inputs }; - export namespace outputs_673 { - let out_662: string; - export { out_662 as out }; - } - export { outputs_673 as outputs }; - } - namespace ND_switch_vector2 { - let node_674: string; - export { node_674 as node }; - let inherit_674: null; - export { inherit_674 as inherit }; - export namespace inputs_674 { - let in1_195: string; - export { in1_195 as in1 }; - let in2_195: string; - export { in2_195 as in2 }; - let in3_3: string; - export { in3_3 as in3 }; - let in4_3: string; - export { in4_3 as in4 }; - let in5_3: string; - export { in5_3 as in5 }; - let in6_3: string; - export { in6_3 as in6 }; - let in7_3: string; - export { in7_3 as in7 }; - let in8_3: string; - export { in8_3 as in8 }; - let in9_3: string; - export { in9_3 as in9 }; - let in10_3: string; - export { in10_3 as in10 }; - let which_3: string; - export { which_3 as which }; - } - export { inputs_674 as inputs }; - export namespace outputs_674 { - let out_663: string; - export { out_663 as out }; - } - export { outputs_674 as outputs }; - } - namespace ND_switch_vector3 { - let node_675: string; - export { node_675 as node }; - let inherit_675: null; - export { inherit_675 as inherit }; - export namespace inputs_675 { - let in1_196: string; - export { in1_196 as in1 }; - let in2_196: string; - export { in2_196 as in2 }; - let in3_4: string; - export { in3_4 as in3 }; - let in4_4: string; - export { in4_4 as in4 }; - let in5_4: string; - export { in5_4 as in5 }; - let in6_4: string; - export { in6_4 as in6 }; - let in7_4: string; - export { in7_4 as in7 }; - let in8_4: string; - export { in8_4 as in8 }; - let in9_4: string; - export { in9_4 as in9 }; - let in10_4: string; - export { in10_4 as in10 }; - let which_4: string; - export { which_4 as which }; - } - export { inputs_675 as inputs }; - export namespace outputs_675 { - let out_664: string; - export { out_664 as out }; - } - export { outputs_675 as outputs }; - } - namespace ND_switch_vector4 { - let node_676: string; - export { node_676 as node }; - let inherit_676: null; - export { inherit_676 as inherit }; - export namespace inputs_676 { - let in1_197: string; - export { in1_197 as in1 }; - let in2_197: string; - export { in2_197 as in2 }; - let in3_5: string; - export { in3_5 as in3 }; - let in4_5: string; - export { in4_5 as in4 }; - let in5_5: string; - export { in5_5 as in5 }; - let in6_5: string; - export { in6_5 as in6 }; - let in7_5: string; - export { in7_5 as in7 }; - let in8_5: string; - export { in8_5 as in8 }; - let in9_5: string; - export { in9_5 as in9 }; - let in10_5: string; - export { in10_5 as in10 }; - let which_5: string; - export { which_5 as which }; - } - export { inputs_676 as inputs }; - export namespace outputs_676 { - let out_665: string; - export { out_665 as out }; - } - export { outputs_676 as outputs }; - } - namespace ND_switch_matrix33 { - let node_677: string; - export { node_677 as node }; - let inherit_677: null; - export { inherit_677 as inherit }; - export namespace inputs_677 { - let in1_198: string; - export { in1_198 as in1 }; - let in2_198: string; - export { in2_198 as in2 }; - let in3_6: string; - export { in3_6 as in3 }; - let in4_6: string; - export { in4_6 as in4 }; - let in5_6: string; - export { in5_6 as in5 }; - let in6_6: string; - export { in6_6 as in6 }; - let in7_6: string; - export { in7_6 as in7 }; - let in8_6: string; - export { in8_6 as in8 }; - let in9_6: string; - export { in9_6 as in9 }; - let in10_6: string; - export { in10_6 as in10 }; - let which_6: string; - export { which_6 as which }; - } - export { inputs_677 as inputs }; - export namespace outputs_677 { - let out_666: string; - export { out_666 as out }; - } - export { outputs_677 as outputs }; - } - namespace ND_switch_matrix44 { - let node_678: string; - export { node_678 as node }; - let inherit_678: null; - export { inherit_678 as inherit }; - export namespace inputs_678 { - let in1_199: string; - export { in1_199 as in1 }; - let in2_199: string; - export { in2_199 as in2 }; - let in3_7: string; - export { in3_7 as in3 }; - let in4_7: string; - export { in4_7 as in4 }; - let in5_7: string; - export { in5_7 as in5 }; - let in6_7: string; - export { in6_7 as in6 }; - let in7_7: string; - export { in7_7 as in7 }; - let in8_7: string; - export { in8_7 as in8 }; - let in9_7: string; - export { in9_7 as in9 }; - let in10_7: string; - export { in10_7 as in10 }; - let which_7: string; - export { which_7 as which }; - } - export { inputs_678 as inputs }; - export namespace outputs_678 { - let out_667: string; - export { out_667 as out }; - } - export { outputs_678 as outputs }; - } - namespace ND_switch_floatI { - let node_679: string; - export { node_679 as node }; - let inherit_679: null; - export { inherit_679 as inherit }; - export namespace inputs_679 { - let in1_200: string; - export { in1_200 as in1 }; - let in2_200: string; - export { in2_200 as in2 }; - let in3_8: string; - export { in3_8 as in3 }; - let in4_8: string; - export { in4_8 as in4 }; - let in5_8: string; - export { in5_8 as in5 }; - let in6_8: string; - export { in6_8 as in6 }; - let in7_8: string; - export { in7_8 as in7 }; - let in8_8: string; - export { in8_8 as in8 }; - let in9_8: string; - export { in9_8 as in9 }; - let in10_8: string; - export { in10_8 as in10 }; - let which_8: string; - export { which_8 as which }; - } - export { inputs_679 as inputs }; - export namespace outputs_679 { - let out_668: string; - export { out_668 as out }; - } - export { outputs_679 as outputs }; - } - namespace ND_switch_color3I { - let node_680: string; - export { node_680 as node }; - let inherit_680: null; - export { inherit_680 as inherit }; - export namespace inputs_680 { - let in1_201: string; - export { in1_201 as in1 }; - let in2_201: string; - export { in2_201 as in2 }; - let in3_9: string; - export { in3_9 as in3 }; - let in4_9: string; - export { in4_9 as in4 }; - let in5_9: string; - export { in5_9 as in5 }; - let in6_9: string; - export { in6_9 as in6 }; - let in7_9: string; - export { in7_9 as in7 }; - let in8_9: string; - export { in8_9 as in8 }; - let in9_9: string; - export { in9_9 as in9 }; - let in10_9: string; - export { in10_9 as in10 }; - let which_9: string; - export { which_9 as which }; - } - export { inputs_680 as inputs }; - export namespace outputs_680 { - let out_669: string; - export { out_669 as out }; - } - export { outputs_680 as outputs }; - } - namespace ND_switch_color4I { - let node_681: string; - export { node_681 as node }; - let inherit_681: null; - export { inherit_681 as inherit }; - export namespace inputs_681 { - let in1_202: string; - export { in1_202 as in1 }; - let in2_202: string; - export { in2_202 as in2 }; - let in3_10: string; - export { in3_10 as in3 }; - let in4_10: string; - export { in4_10 as in4 }; - let in5_10: string; - export { in5_10 as in5 }; - let in6_10: string; - export { in6_10 as in6 }; - let in7_10: string; - export { in7_10 as in7 }; - let in8_10: string; - export { in8_10 as in8 }; - let in9_10: string; - export { in9_10 as in9 }; - let in10_10: string; - export { in10_10 as in10 }; - let which_10: string; - export { which_10 as which }; - } - export { inputs_681 as inputs }; - export namespace outputs_681 { - let out_670: string; - export { out_670 as out }; - } - export { outputs_681 as outputs }; - } - namespace ND_switch_vector2I { - let node_682: string; - export { node_682 as node }; - let inherit_682: null; - export { inherit_682 as inherit }; - export namespace inputs_682 { - let in1_203: string; - export { in1_203 as in1 }; - let in2_203: string; - export { in2_203 as in2 }; - let in3_11: string; - export { in3_11 as in3 }; - let in4_11: string; - export { in4_11 as in4 }; - let in5_11: string; - export { in5_11 as in5 }; - let in6_11: string; - export { in6_11 as in6 }; - let in7_11: string; - export { in7_11 as in7 }; - let in8_11: string; - export { in8_11 as in8 }; - let in9_11: string; - export { in9_11 as in9 }; - let in10_11: string; - export { in10_11 as in10 }; - let which_11: string; - export { which_11 as which }; - } - export { inputs_682 as inputs }; - export namespace outputs_682 { - let out_671: string; - export { out_671 as out }; - } - export { outputs_682 as outputs }; - } - namespace ND_switch_vector3I { - let node_683: string; - export { node_683 as node }; - let inherit_683: null; - export { inherit_683 as inherit }; - export namespace inputs_683 { - let in1_204: string; - export { in1_204 as in1 }; - let in2_204: string; - export { in2_204 as in2 }; - let in3_12: string; - export { in3_12 as in3 }; - let in4_12: string; - export { in4_12 as in4 }; - let in5_12: string; - export { in5_12 as in5 }; - let in6_12: string; - export { in6_12 as in6 }; - let in7_12: string; - export { in7_12 as in7 }; - let in8_12: string; - export { in8_12 as in8 }; - let in9_12: string; - export { in9_12 as in9 }; - let in10_12: string; - export { in10_12 as in10 }; - let which_12: string; - export { which_12 as which }; - } - export { inputs_683 as inputs }; - export namespace outputs_683 { - let out_672: string; - export { out_672 as out }; - } - export { outputs_683 as outputs }; - } - namespace ND_switch_vector4I { - let node_684: string; - export { node_684 as node }; - let inherit_684: null; - export { inherit_684 as inherit }; - export namespace inputs_684 { - let in1_205: string; - export { in1_205 as in1 }; - let in2_205: string; - export { in2_205 as in2 }; - let in3_13: string; - export { in3_13 as in3 }; - let in4_13: string; - export { in4_13 as in4 }; - let in5_13: string; - export { in5_13 as in5 }; - let in6_13: string; - export { in6_13 as in6 }; - let in7_13: string; - export { in7_13 as in7 }; - let in8_13: string; - export { in8_13 as in8 }; - let in9_13: string; - export { in9_13 as in9 }; - let in10_13: string; - export { in10_13 as in10 }; - let which_13: string; - export { which_13 as which }; - } - export { inputs_684 as inputs }; - export namespace outputs_684 { - let out_673: string; - export { out_673 as out }; - } - export { outputs_684 as outputs }; - } - namespace ND_switch_matrix33I { - let node_685: string; - export { node_685 as node }; - let inherit_685: null; - export { inherit_685 as inherit }; - export namespace inputs_685 { - let in1_206: string; - export { in1_206 as in1 }; - let in2_206: string; - export { in2_206 as in2 }; - let in3_14: string; - export { in3_14 as in3 }; - let in4_14: string; - export { in4_14 as in4 }; - let in5_14: string; - export { in5_14 as in5 }; - let in6_14: string; - export { in6_14 as in6 }; - let in7_14: string; - export { in7_14 as in7 }; - let in8_14: string; - export { in8_14 as in8 }; - let in9_14: string; - export { in9_14 as in9 }; - let in10_14: string; - export { in10_14 as in10 }; - let which_14: string; - export { which_14 as which }; - } - export { inputs_685 as inputs }; - export namespace outputs_685 { - let out_674: string; - export { out_674 as out }; - } - export { outputs_685 as outputs }; - } - namespace ND_switch_matrix44I { - let node_686: string; - export { node_686 as node }; - let inherit_686: null; - export { inherit_686 as inherit }; - export namespace inputs_686 { - let in1_207: string; - export { in1_207 as in1 }; - let in2_207: string; - export { in2_207 as in2 }; - let in3_15: string; - export { in3_15 as in3 }; - let in4_15: string; - export { in4_15 as in4 }; - let in5_15: string; - export { in5_15 as in5 }; - let in6_15: string; - export { in6_15 as in6 }; - let in7_15: string; - export { in7_15 as in7 }; - let in8_15: string; - export { in8_15 as in8 }; - let in9_15: string; - export { in9_15 as in9 }; - let in10_15: string; - export { in10_15 as in10 }; - let which_15: string; - export { which_15 as which }; - } - export { inputs_686 as inputs }; - export namespace outputs_686 { - let out_675: string; - export { out_675 as out }; - } - export { outputs_686 as outputs }; - } - namespace ND_convert_float_color3 { - let node_687: string; - export { node_687 as node }; - let inherit_687: null; - export { inherit_687 as inherit }; - export namespace inputs_687 { - let _in_208: string; - export { _in_208 as in }; - } - export { inputs_687 as inputs }; - export namespace outputs_687 { - let out_676: string; - export { out_676 as out }; - } - export { outputs_687 as outputs }; - } - namespace ND_convert_float_color4 { - let node_688: string; - export { node_688 as node }; - let inherit_688: null; - export { inherit_688 as inherit }; - export namespace inputs_688 { - let _in_209: string; - export { _in_209 as in }; - } - export { inputs_688 as inputs }; - export namespace outputs_688 { - let out_677: string; - export { out_677 as out }; - } - export { outputs_688 as outputs }; - } - namespace ND_convert_float_vector2 { - let node_689: string; - export { node_689 as node }; - let inherit_689: null; - export { inherit_689 as inherit }; - export namespace inputs_689 { - let _in_210: string; - export { _in_210 as in }; - } - export { inputs_689 as inputs }; - export namespace outputs_689 { - let out_678: string; - export { out_678 as out }; - } - export { outputs_689 as outputs }; - } - namespace ND_convert_float_vector3 { - let node_690: string; - export { node_690 as node }; - let inherit_690: null; - export { inherit_690 as inherit }; - export namespace inputs_690 { - let _in_211: string; - export { _in_211 as in }; - } - export { inputs_690 as inputs }; - export namespace outputs_690 { - let out_679: string; - export { out_679 as out }; - } - export { outputs_690 as outputs }; - } - namespace ND_convert_float_vector4 { - let node_691: string; - export { node_691 as node }; - let inherit_691: null; - export { inherit_691 as inherit }; - export namespace inputs_691 { - let _in_212: string; - export { _in_212 as in }; - } - export { inputs_691 as inputs }; - export namespace outputs_691 { - let out_680: string; - export { out_680 as out }; - } - export { outputs_691 as outputs }; - } - namespace ND_convert_color3_color4 { - let node_692: string; - export { node_692 as node }; - let inherit_692: null; - export { inherit_692 as inherit }; - export namespace inputs_692 { - let _in_213: string; - export { _in_213 as in }; - } - export { inputs_692 as inputs }; - export namespace outputs_692 { - let out_681: string; - export { out_681 as out }; - } - export { outputs_692 as outputs }; - } - namespace ND_convert_color3_vector2 { - let node_693: string; - export { node_693 as node }; - let inherit_693: null; - export { inherit_693 as inherit }; - export namespace inputs_693 { - let _in_214: string; - export { _in_214 as in }; - } - export { inputs_693 as inputs }; - export namespace outputs_693 { - let out_682: string; - export { out_682 as out }; - } - export { outputs_693 as outputs }; - } - namespace ND_convert_color3_vector3 { - let node_694: string; - export { node_694 as node }; - let inherit_694: null; - export { inherit_694 as inherit }; - export namespace inputs_694 { - let _in_215: string; - export { _in_215 as in }; - } - export { inputs_694 as inputs }; - export namespace outputs_694 { - let out_683: string; - export { out_683 as out }; - } - export { outputs_694 as outputs }; - } - namespace ND_convert_color3_vector4 { - let node_695: string; - export { node_695 as node }; - let inherit_695: null; - export { inherit_695 as inherit }; - export namespace inputs_695 { - let _in_216: string; - export { _in_216 as in }; - } - export { inputs_695 as inputs }; - export namespace outputs_695 { - let out_684: string; - export { out_684 as out }; - } - export { outputs_695 as outputs }; - } - namespace ND_convert_color4_color3 { - let node_696: string; - export { node_696 as node }; - let inherit_696: null; - export { inherit_696 as inherit }; - export namespace inputs_696 { - let _in_217: string; - export { _in_217 as in }; - } - export { inputs_696 as inputs }; - export namespace outputs_696 { - let out_685: string; - export { out_685 as out }; - } - export { outputs_696 as outputs }; - } - namespace ND_convert_color4_vector2 { - let node_697: string; - export { node_697 as node }; - let inherit_697: null; - export { inherit_697 as inherit }; - export namespace inputs_697 { - let _in_218: string; - export { _in_218 as in }; - } - export { inputs_697 as inputs }; - export namespace outputs_697 { - let out_686: string; - export { out_686 as out }; - } - export { outputs_697 as outputs }; - } - namespace ND_convert_color4_vector3 { - let node_698: string; - export { node_698 as node }; - let inherit_698: null; - export { inherit_698 as inherit }; - export namespace inputs_698 { - let _in_219: string; - export { _in_219 as in }; - } - export { inputs_698 as inputs }; - export namespace outputs_698 { - let out_687: string; - export { out_687 as out }; - } - export { outputs_698 as outputs }; - } - namespace ND_convert_color4_vector4 { - let node_699: string; - export { node_699 as node }; - let inherit_699: null; - export { inherit_699 as inherit }; - export namespace inputs_699 { - let _in_220: string; - export { _in_220 as in }; - } - export { inputs_699 as inputs }; - export namespace outputs_699 { - let out_688: string; - export { out_688 as out }; - } - export { outputs_699 as outputs }; - } - namespace ND_convert_vector2_color3 { - let node_700: string; - export { node_700 as node }; - let inherit_700: null; - export { inherit_700 as inherit }; - export namespace inputs_700 { - let _in_221: string; - export { _in_221 as in }; - } - export { inputs_700 as inputs }; - export namespace outputs_700 { - let out_689: string; - export { out_689 as out }; - } - export { outputs_700 as outputs }; - } - namespace ND_convert_vector2_color4 { - let node_701: string; - export { node_701 as node }; - let inherit_701: null; - export { inherit_701 as inherit }; - export namespace inputs_701 { - let _in_222: string; - export { _in_222 as in }; - } - export { inputs_701 as inputs }; - export namespace outputs_701 { - let out_690: string; - export { out_690 as out }; - } - export { outputs_701 as outputs }; - } - namespace ND_convert_vector2_vector3 { - let node_702: string; - export { node_702 as node }; - let inherit_702: null; - export { inherit_702 as inherit }; - export namespace inputs_702 { - let _in_223: string; - export { _in_223 as in }; - } - export { inputs_702 as inputs }; - export namespace outputs_702 { - let out_691: string; - export { out_691 as out }; - } - export { outputs_702 as outputs }; - } - namespace ND_convert_vector2_vector4 { - let node_703: string; - export { node_703 as node }; - let inherit_703: null; - export { inherit_703 as inherit }; - export namespace inputs_703 { - let _in_224: string; - export { _in_224 as in }; - } - export { inputs_703 as inputs }; - export namespace outputs_703 { - let out_692: string; - export { out_692 as out }; - } - export { outputs_703 as outputs }; - } - namespace ND_convert_vector3_color3 { - let node_704: string; - export { node_704 as node }; - let inherit_704: null; - export { inherit_704 as inherit }; - export namespace inputs_704 { - let _in_225: string; - export { _in_225 as in }; - } - export { inputs_704 as inputs }; - export namespace outputs_704 { - let out_693: string; - export { out_693 as out }; - } - export { outputs_704 as outputs }; - } - namespace ND_convert_vector3_color4 { - let node_705: string; - export { node_705 as node }; - let inherit_705: null; - export { inherit_705 as inherit }; - export namespace inputs_705 { - let _in_226: string; - export { _in_226 as in }; - } - export { inputs_705 as inputs }; - export namespace outputs_705 { - let out_694: string; - export { out_694 as out }; - } - export { outputs_705 as outputs }; - } - namespace ND_convert_vector3_vector2 { - let node_706: string; - export { node_706 as node }; - let inherit_706: null; - export { inherit_706 as inherit }; - export namespace inputs_706 { - let _in_227: string; - export { _in_227 as in }; - } - export { inputs_706 as inputs }; - export namespace outputs_706 { - let out_695: string; - export { out_695 as out }; - } - export { outputs_706 as outputs }; - } - namespace ND_convert_vector3_vector4 { - let node_707: string; - export { node_707 as node }; - let inherit_707: null; - export { inherit_707 as inherit }; - export namespace inputs_707 { - let _in_228: string; - export { _in_228 as in }; - } - export { inputs_707 as inputs }; - export namespace outputs_707 { - let out_696: string; - export { out_696 as out }; - } - export { outputs_707 as outputs }; - } - namespace ND_convert_vector4_color3 { - let node_708: string; - export { node_708 as node }; - let inherit_708: null; - export { inherit_708 as inherit }; - export namespace inputs_708 { - let _in_229: string; - export { _in_229 as in }; - } - export { inputs_708 as inputs }; - export namespace outputs_708 { - let out_697: string; - export { out_697 as out }; - } - export { outputs_708 as outputs }; - } - namespace ND_convert_vector4_color4 { - let node_709: string; - export { node_709 as node }; - let inherit_709: null; - export { inherit_709 as inherit }; - export namespace inputs_709 { - let _in_230: string; - export { _in_230 as in }; - } - export { inputs_709 as inputs }; - export namespace outputs_709 { - let out_698: string; - export { out_698 as out }; - } - export { outputs_709 as outputs }; - } - namespace ND_convert_vector4_vector2 { - let node_710: string; - export { node_710 as node }; - let inherit_710: null; - export { inherit_710 as inherit }; - export namespace inputs_710 { - let _in_231: string; - export { _in_231 as in }; - } - export { inputs_710 as inputs }; - export namespace outputs_710 { - let out_699: string; - export { out_699 as out }; - } - export { outputs_710 as outputs }; - } - namespace ND_convert_vector4_vector3 { - let node_711: string; - export { node_711 as node }; - let inherit_711: null; - export { inherit_711 as inherit }; - export namespace inputs_711 { - let _in_232: string; - export { _in_232 as in }; - } - export { inputs_711 as inputs }; - export namespace outputs_711 { - let out_700: string; - export { out_700 as out }; - } - export { outputs_711 as outputs }; - } - namespace ND_convert_boolean_float { - let node_712: string; - export { node_712 as node }; - let inherit_712: null; - export { inherit_712 as inherit }; - export namespace inputs_712 { - let _in_233: string; - export { _in_233 as in }; - } - export { inputs_712 as inputs }; - export namespace outputs_712 { - let out_701: string; - export { out_701 as out }; - } - export { outputs_712 as outputs }; - } - namespace ND_convert_boolean_color3 { - let node_713: string; - export { node_713 as node }; - let inherit_713: null; - export { inherit_713 as inherit }; - export namespace inputs_713 { - let _in_234: string; - export { _in_234 as in }; - } - export { inputs_713 as inputs }; - export namespace outputs_713 { - let out_702: string; - export { out_702 as out }; - } - export { outputs_713 as outputs }; - } - namespace ND_convert_boolean_color4 { - let node_714: string; - export { node_714 as node }; - let inherit_714: null; - export { inherit_714 as inherit }; - export namespace inputs_714 { - let _in_235: string; - export { _in_235 as in }; - } - export { inputs_714 as inputs }; - export namespace outputs_714 { - let out_703: string; - export { out_703 as out }; - } - export { outputs_714 as outputs }; - } - namespace ND_convert_boolean_vector2 { - let node_715: string; - export { node_715 as node }; - let inherit_715: null; - export { inherit_715 as inherit }; - export namespace inputs_715 { - let _in_236: string; - export { _in_236 as in }; - } - export { inputs_715 as inputs }; - export namespace outputs_715 { - let out_704: string; - export { out_704 as out }; - } - export { outputs_715 as outputs }; - } - namespace ND_convert_boolean_vector3 { - let node_716: string; - export { node_716 as node }; - let inherit_716: null; - export { inherit_716 as inherit }; - export namespace inputs_716 { - let _in_237: string; - export { _in_237 as in }; - } - export { inputs_716 as inputs }; - export namespace outputs_716 { - let out_705: string; - export { out_705 as out }; - } - export { outputs_716 as outputs }; - } - namespace ND_convert_boolean_vector4 { - let node_717: string; - export { node_717 as node }; - let inherit_717: null; - export { inherit_717 as inherit }; - export namespace inputs_717 { - let _in_238: string; - export { _in_238 as in }; - } - export { inputs_717 as inputs }; - export namespace outputs_717 { - let out_706: string; - export { out_706 as out }; - } - export { outputs_717 as outputs }; - } - namespace ND_convert_boolean_integer { - let node_718: string; - export { node_718 as node }; - let inherit_718: null; - export { inherit_718 as inherit }; - export namespace inputs_718 { - let _in_239: string; - export { _in_239 as in }; - } - export { inputs_718 as inputs }; - export namespace outputs_718 { - let out_707: string; - export { out_707 as out }; - } - export { outputs_718 as outputs }; - } - namespace ND_convert_integer_float { - let node_719: string; - export { node_719 as node }; - let inherit_719: null; - export { inherit_719 as inherit }; - export namespace inputs_719 { - let _in_240: string; - export { _in_240 as in }; - } - export { inputs_719 as inputs }; - export namespace outputs_719 { - let out_708: string; - export { out_708 as out }; - } - export { outputs_719 as outputs }; - } - namespace ND_convert_integer_color3 { - let node_720: string; - export { node_720 as node }; - let inherit_720: null; - export { inherit_720 as inherit }; - export namespace inputs_720 { - let _in_241: string; - export { _in_241 as in }; - } - export { inputs_720 as inputs }; - export namespace outputs_720 { - let out_709: string; - export { out_709 as out }; - } - export { outputs_720 as outputs }; - } - namespace ND_convert_integer_color4 { - let node_721: string; - export { node_721 as node }; - let inherit_721: null; - export { inherit_721 as inherit }; - export namespace inputs_721 { - let _in_242: string; - export { _in_242 as in }; - } - export { inputs_721 as inputs }; - export namespace outputs_721 { - let out_710: string; - export { out_710 as out }; - } - export { outputs_721 as outputs }; - } - namespace ND_convert_integer_vector2 { - let node_722: string; - export { node_722 as node }; - let inherit_722: null; - export { inherit_722 as inherit }; - export namespace inputs_722 { - let _in_243: string; - export { _in_243 as in }; - } - export { inputs_722 as inputs }; - export namespace outputs_722 { - let out_711: string; - export { out_711 as out }; - } - export { outputs_722 as outputs }; - } - namespace ND_convert_integer_vector3 { - let node_723: string; - export { node_723 as node }; - let inherit_723: null; - export { inherit_723 as inherit }; - export namespace inputs_723 { - let _in_244: string; - export { _in_244 as in }; - } - export { inputs_723 as inputs }; - export namespace outputs_723 { - let out_712: string; - export { out_712 as out }; - } - export { outputs_723 as outputs }; - } - namespace ND_convert_integer_vector4 { - let node_724: string; - export { node_724 as node }; - let inherit_724: null; - export { inherit_724 as inherit }; - export namespace inputs_724 { - let _in_245: string; - export { _in_245 as in }; - } - export { inputs_724 as inputs }; - export namespace outputs_724 { - let out_713: string; - export { out_713 as out }; - } - export { outputs_724 as outputs }; - } - namespace ND_convert_integer_boolean { - let node_725: string; - export { node_725 as node }; - let inherit_725: null; - export { inherit_725 as inherit }; - export namespace inputs_725 { - let _in_246: string; - export { _in_246 as in }; - } - export { inputs_725 as inputs }; - export namespace outputs_725 { - let out_714: string; - export { out_714 as out }; - } - export { outputs_725 as outputs }; - } - namespace ND_convert_color3_surfaceshader { - let node_726: string; - export { node_726 as node }; - let inherit_726: null; - export { inherit_726 as inherit }; - export namespace inputs_726 { - let _in_247: string; - export { _in_247 as in }; - } - export { inputs_726 as inputs }; - export namespace outputs_726 { - let out_715: string; - export { out_715 as out }; - } - export { outputs_726 as outputs }; - } - namespace ND_convert_color4_surfaceshader { - let node_727: string; - export { node_727 as node }; - let inherit_727: null; - export { inherit_727 as inherit }; - export namespace inputs_727 { - let _in_248: string; - export { _in_248 as in }; - } - export { inputs_727 as inputs }; - export namespace outputs_727 { - let out_716: string; - export { out_716 as out }; - } - export { outputs_727 as outputs }; - } - namespace ND_convert_float_surfaceshader { - let node_728: string; - export { node_728 as node }; - let inherit_728: null; - export { inherit_728 as inherit }; - export namespace inputs_728 { - let _in_249: string; - export { _in_249 as in }; - } - export { inputs_728 as inputs }; - export namespace outputs_728 { - let out_717: string; - export { out_717 as out }; - } - export { outputs_728 as outputs }; - } - namespace ND_convert_vector2_surfaceshader { - let node_729: string; - export { node_729 as node }; - let inherit_729: null; - export { inherit_729 as inherit }; - export namespace inputs_729 { - let _in_250: string; - export { _in_250 as in }; - } - export { inputs_729 as inputs }; - export namespace outputs_729 { - let out_718: string; - export { out_718 as out }; - } - export { outputs_729 as outputs }; - } - namespace ND_convert_vector3_surfaceshader { - let node_730: string; - export { node_730 as node }; - let inherit_730: null; - export { inherit_730 as inherit }; - export namespace inputs_730 { - let _in_251: string; - export { _in_251 as in }; - } - export { inputs_730 as inputs }; - export namespace outputs_730 { - let out_719: string; - export { out_719 as out }; - } - export { outputs_730 as outputs }; - } - namespace ND_convert_vector4_surfaceshader { - let node_731: string; - export { node_731 as node }; - let inherit_731: null; - export { inherit_731 as inherit }; - export namespace inputs_731 { - let _in_252: string; - export { _in_252 as in }; - } - export { inputs_731 as inputs }; - export namespace outputs_731 { - let out_720: string; - export { out_720 as out }; - } - export { outputs_731 as outputs }; - } - namespace ND_convert_integer_surfaceshader { - let node_732: string; - export { node_732 as node }; - let inherit_732: null; - export { inherit_732 as inherit }; - export namespace inputs_732 { - let _in_253: string; - export { _in_253 as in }; - } - export { inputs_732 as inputs }; - export namespace outputs_732 { - let out_721: string; - export { out_721 as out }; - } - export { outputs_732 as outputs }; - } - namespace ND_convert_boolean_surfaceshader { - let node_733: string; - export { node_733 as node }; - let inherit_733: null; - export { inherit_733 as inherit }; - export namespace inputs_733 { - let _in_254: string; - export { _in_254 as in }; - } - export { inputs_733 as inputs }; - export namespace outputs_733 { - let out_722: string; - export { out_722 as out }; - } - export { outputs_733 as outputs }; - } - namespace ND_combine2_vector2 { - let node_734: string; - export { node_734 as node }; - let inherit_734: null; - export { inherit_734 as inherit }; - export namespace inputs_734 { - let in1_208: string; - export { in1_208 as in1 }; - let in2_208: string; - export { in2_208 as in2 }; - } - export { inputs_734 as inputs }; - export namespace outputs_734 { - let out_723: string; - export { out_723 as out }; - } - export { outputs_734 as outputs }; - } - namespace ND_combine2_color4CF { - let node_735: string; - export { node_735 as node }; - let inherit_735: null; - export { inherit_735 as inherit }; - export namespace inputs_735 { - let in1_209: string; - export { in1_209 as in1 }; - let in2_209: string; - export { in2_209 as in2 }; - } - export { inputs_735 as inputs }; - export namespace outputs_735 { - let out_724: string; - export { out_724 as out }; - } - export { outputs_735 as outputs }; - } - namespace ND_combine2_vector4VF { - let node_736: string; - export { node_736 as node }; - let inherit_736: null; - export { inherit_736 as inherit }; - export namespace inputs_736 { - let in1_210: string; - export { in1_210 as in1 }; - let in2_210: string; - export { in2_210 as in2 }; - } - export { inputs_736 as inputs }; - export namespace outputs_736 { - let out_725: string; - export { out_725 as out }; - } - export { outputs_736 as outputs }; - } - namespace ND_combine2_vector4VV { - let node_737: string; - export { node_737 as node }; - let inherit_737: null; - export { inherit_737 as inherit }; - export namespace inputs_737 { - let in1_211: string; - export { in1_211 as in1 }; - let in2_211: string; - export { in2_211 as in2 }; - } - export { inputs_737 as inputs }; - export namespace outputs_737 { - let out_726: string; - export { out_726 as out }; - } - export { outputs_737 as outputs }; - } - namespace ND_combine3_color3 { - let node_738: string; - export { node_738 as node }; - let inherit_738: null; - export { inherit_738 as inherit }; - export namespace inputs_738 { - let in1_212: string; - export { in1_212 as in1 }; - let in2_212: string; - export { in2_212 as in2 }; - let in3_16: string; - export { in3_16 as in3 }; - } - export { inputs_738 as inputs }; - export namespace outputs_738 { - let out_727: string; - export { out_727 as out }; - } - export { outputs_738 as outputs }; - } - namespace ND_combine3_vector3 { - let node_739: string; - export { node_739 as node }; - let inherit_739: null; - export { inherit_739 as inherit }; - export namespace inputs_739 { - let in1_213: string; - export { in1_213 as in1 }; - let in2_213: string; - export { in2_213 as in2 }; - let in3_17: string; - export { in3_17 as in3 }; - } - export { inputs_739 as inputs }; - export namespace outputs_739 { - let out_728: string; - export { out_728 as out }; - } - export { outputs_739 as outputs }; - } - namespace ND_combine4_color4 { - let node_740: string; - export { node_740 as node }; - let inherit_740: null; - export { inherit_740 as inherit }; - export namespace inputs_740 { - let in1_214: string; - export { in1_214 as in1 }; - let in2_214: string; - export { in2_214 as in2 }; - let in3_18: string; - export { in3_18 as in3 }; - let in4_16: string; - export { in4_16 as in4 }; - } - export { inputs_740 as inputs }; - export namespace outputs_740 { - let out_729: string; - export { out_729 as out }; - } - export { outputs_740 as outputs }; - } - namespace ND_combine4_vector4 { - let node_741: string; - export { node_741 as node }; - let inherit_741: null; - export { inherit_741 as inherit }; - export namespace inputs_741 { - let in1_215: string; - export { in1_215 as in1 }; - let in2_215: string; - export { in2_215 as in2 }; - let in3_19: string; - export { in3_19 as in3 }; - let in4_17: string; - export { in4_17 as in4 }; - } - export { inputs_741 as inputs }; - export namespace outputs_741 { - let out_730: string; - export { out_730 as out }; - } - export { outputs_741 as outputs }; - } - namespace ND_creatematrix_vector3_matrix33 { - let node_742: string; - export { node_742 as node }; - let inherit_742: null; - export { inherit_742 as inherit }; - export namespace inputs_742 { - let in1_216: string; - export { in1_216 as in1 }; - let in2_216: string; - export { in2_216 as in2 }; - let in3_20: string; - export { in3_20 as in3 }; - } - export { inputs_742 as inputs }; - export namespace outputs_742 { - let out_731: string; - export { out_731 as out }; - } - export { outputs_742 as outputs }; - } - namespace ND_creatematrix_vector3_matrix44 { - let node_743: string; - export { node_743 as node }; - let inherit_743: null; - export { inherit_743 as inherit }; - export namespace inputs_743 { - let in1_217: string; - export { in1_217 as in1 }; - let in2_217: string; - export { in2_217 as in2 }; - let in3_21: string; - export { in3_21 as in3 }; - let in4_18: string; - export { in4_18 as in4 }; - } - export { inputs_743 as inputs }; - export namespace outputs_743 { - let out_732: string; - export { out_732 as out }; - } - export { outputs_743 as outputs }; - } - namespace ND_creatematrix_vector4_matrix44 { - let node_744: string; - export { node_744 as node }; - let inherit_744: null; - export { inherit_744 as inherit }; - export namespace inputs_744 { - let in1_218: string; - export { in1_218 as in1 }; - let in2_218: string; - export { in2_218 as in2 }; - let in3_22: string; - export { in3_22 as in3 }; - let in4_19: string; - export { in4_19 as in4 }; - } - export { inputs_744 as inputs }; - export namespace outputs_744 { - let out_733: string; - export { out_733 as out }; - } - export { outputs_744 as outputs }; - } - namespace ND_extract_color3 { - let node_745: string; - export { node_745 as node }; - let inherit_745: null; - export { inherit_745 as inherit }; - export namespace inputs_745 { - let _in_255: string; - export { _in_255 as in }; - let index_7: string; - export { index_7 as index }; - } - export { inputs_745 as inputs }; - export namespace outputs_745 { - let out_734: string; - export { out_734 as out }; - } - export { outputs_745 as outputs }; - } - namespace ND_extract_color4 { - let node_746: string; - export { node_746 as node }; - let inherit_746: null; - export { inherit_746 as inherit }; - export namespace inputs_746 { - let _in_256: string; - export { _in_256 as in }; - let index_8: string; - export { index_8 as index }; - } - export { inputs_746 as inputs }; - export namespace outputs_746 { - let out_735: string; - export { out_735 as out }; - } - export { outputs_746 as outputs }; - } - namespace ND_extract_vector2 { - let node_747: string; - export { node_747 as node }; - let inherit_747: null; - export { inherit_747 as inherit }; - export namespace inputs_747 { - let _in_257: string; - export { _in_257 as in }; - let index_9: string; - export { index_9 as index }; - } - export { inputs_747 as inputs }; - export namespace outputs_747 { - let out_736: string; - export { out_736 as out }; - } - export { outputs_747 as outputs }; - } - namespace ND_extract_vector3 { - let node_748: string; - export { node_748 as node }; - let inherit_748: null; - export { inherit_748 as inherit }; - export namespace inputs_748 { - let _in_258: string; - export { _in_258 as in }; - let index_10: string; - export { index_10 as index }; - } - export { inputs_748 as inputs }; - export namespace outputs_748 { - let out_737: string; - export { out_737 as out }; - } - export { outputs_748 as outputs }; - } - namespace ND_extract_vector4 { - let node_749: string; - export { node_749 as node }; - let inherit_749: null; - export { inherit_749 as inherit }; - export namespace inputs_749 { - let _in_259: string; - export { _in_259 as in }; - let index_11: string; - export { index_11 as index }; - } - export { inputs_749 as inputs }; - export namespace outputs_749 { - let out_738: string; - export { out_738 as out }; - } - export { outputs_749 as outputs }; - } - namespace ND_extract_matrix33 { - let node_750: string; - export { node_750 as node }; - let inherit_750: null; - export { inherit_750 as inherit }; - export namespace inputs_750 { - let _in_260: string; - export { _in_260 as in }; - let index_12: string; - export { index_12 as index }; - } - export { inputs_750 as inputs }; - export namespace outputs_750 { - let out_739: string; - export { out_739 as out }; - } - export { outputs_750 as outputs }; - } - namespace ND_extract_matrix44 { - let node_751: string; - export { node_751 as node }; - let inherit_751: null; - export { inherit_751 as inherit }; - export namespace inputs_751 { - let _in_261: string; - export { _in_261 as in }; - let index_13: string; - export { index_13 as index }; - } - export { inputs_751 as inputs }; - export namespace outputs_751 { - let out_740: string; - export { out_740 as out }; - } - export { outputs_751 as outputs }; - } - namespace ND_separate2_vector2 { - let node_752: string; - export { node_752 as node }; - let inherit_752: null; - export { inherit_752 as inherit }; - export namespace inputs_752 { - let _in_262: string; - export { _in_262 as in }; - } - export { inputs_752 as inputs }; - export namespace outputs_752 { - let outx: string; - let outy: string; - } - export { outputs_752 as outputs }; - } - namespace ND_separate3_color3 { - let node_753: string; - export { node_753 as node }; - let inherit_753: null; - export { inherit_753 as inherit }; - export namespace inputs_753 { - let _in_263: string; - export { _in_263 as in }; - } - export { inputs_753 as inputs }; - export namespace outputs_753 { - let outr: string; - let outg: string; - let outb: string; - } - export { outputs_753 as outputs }; - } - namespace ND_separate3_vector3 { - let node_754: string; - export { node_754 as node }; - let inherit_754: null; - export { inherit_754 as inherit }; - export namespace inputs_754 { - let _in_264: string; - export { _in_264 as in }; - } - export { inputs_754 as inputs }; - export namespace outputs_754 { - let outx_1: string; - export { outx_1 as outx }; - let outy_1: string; - export { outy_1 as outy }; - export let outz: string; - } - export { outputs_754 as outputs }; - } - namespace ND_separate4_color4 { - let node_755: string; - export { node_755 as node }; - let inherit_755: null; - export { inherit_755 as inherit }; - export namespace inputs_755 { - let _in_265: string; - export { _in_265 as in }; - } - export { inputs_755 as inputs }; - export namespace outputs_755 { - let outr_1: string; - export { outr_1 as outr }; - let outg_1: string; - export { outg_1 as outg }; - let outb_1: string; - export { outb_1 as outb }; - let outa_1: string; - export { outa_1 as outa }; - } - export { outputs_755 as outputs }; - } - namespace ND_separate4_vector4 { - let node_756: string; - export { node_756 as node }; - let inherit_756: null; - export { inherit_756 as inherit }; - export namespace inputs_756 { - let _in_266: string; - export { _in_266 as in }; - } - export { inputs_756 as inputs }; - export namespace outputs_756 { - let outx_2: string; - export { outx_2 as outx }; - let outy_2: string; - export { outy_2 as outy }; - let outz_1: string; - export { outz_1 as outz }; - export let outw: string; - } - export { outputs_756 as outputs }; - } - namespace ND_blur_float { - let node_757: string; - export { node_757 as node }; - let inherit_757: null; - export { inherit_757 as inherit }; - export namespace inputs_757 { - let _in_267: string; - export { _in_267 as in }; - let size_5: string; - export { size_5 as size }; - let filtertype_26: string; - export { filtertype_26 as filtertype }; - } - export { inputs_757 as inputs }; - export namespace outputs_757 { - let out_741: string; - export { out_741 as out }; - } - export { outputs_757 as outputs }; - } - namespace ND_blur_color3 { - let node_758: string; - export { node_758 as node }; - let inherit_758: null; - export { inherit_758 as inherit }; - export namespace inputs_758 { - let _in_268: string; - export { _in_268 as in }; - let size_6: string; - export { size_6 as size }; - let filtertype_27: string; - export { filtertype_27 as filtertype }; - } - export { inputs_758 as inputs }; - export namespace outputs_758 { - let out_742: string; - export { out_742 as out }; - } - export { outputs_758 as outputs }; - } - namespace ND_blur_color4 { - let node_759: string; - export { node_759 as node }; - let inherit_759: null; - export { inherit_759 as inherit }; - export namespace inputs_759 { - let _in_269: string; - export { _in_269 as in }; - let size_7: string; - export { size_7 as size }; - let filtertype_28: string; - export { filtertype_28 as filtertype }; - } - export { inputs_759 as inputs }; - export namespace outputs_759 { - let out_743: string; - export { out_743 as out }; - } - export { outputs_759 as outputs }; - } - namespace ND_blur_vector2 { - let node_760: string; - export { node_760 as node }; - let inherit_760: null; - export { inherit_760 as inherit }; - export namespace inputs_760 { - let _in_270: string; - export { _in_270 as in }; - let size_8: string; - export { size_8 as size }; - let filtertype_29: string; - export { filtertype_29 as filtertype }; - } - export { inputs_760 as inputs }; - export namespace outputs_760 { - let out_744: string; - export { out_744 as out }; - } - export { outputs_760 as outputs }; - } - namespace ND_blur_vector3 { - let node_761: string; - export { node_761 as node }; - let inherit_761: null; - export { inherit_761 as inherit }; - export namespace inputs_761 { - let _in_271: string; - export { _in_271 as in }; - let size_9: string; - export { size_9 as size }; - let filtertype_30: string; - export { filtertype_30 as filtertype }; - } - export { inputs_761 as inputs }; - export namespace outputs_761 { - let out_745: string; - export { out_745 as out }; - } - export { outputs_761 as outputs }; - } - namespace ND_blur_vector4 { - let node_762: string; - export { node_762 as node }; - let inherit_762: null; - export { inherit_762 as inherit }; - export namespace inputs_762 { - let _in_272: string; - export { _in_272 as in }; - let size_10: string; - export { size_10 as size }; - let filtertype_31: string; - export { filtertype_31 as filtertype }; - } - export { inputs_762 as inputs }; - export namespace outputs_762 { - let out_746: string; - export { out_746 as out }; - } - export { outputs_762 as outputs }; - } - namespace ND_heighttonormal_vector3 { - let node_763: string; - export { node_763 as node }; - let inherit_763: null; - export { inherit_763 as inherit }; - export namespace inputs_763 { - let _in_273: string; - export { _in_273 as in }; - let scale_19: string; - export { scale_19 as scale }; - let texcoord_93: string; - export { texcoord_93 as texcoord }; - } - export { inputs_763 as inputs }; - export namespace outputs_763 { - let out_747: string; - export { out_747 as out }; - } - export { outputs_763 as outputs }; - } - namespace ND_logical_and { - let node_764: string; - export { node_764 as node }; - let inherit_764: null; - export { inherit_764 as inherit }; - export namespace inputs_764 { - let in1_219: string; - export { in1_219 as in1 }; - let in2_219: string; - export { in2_219 as in2 }; - } - export { inputs_764 as inputs }; - export namespace outputs_764 { - let out_748: string; - export { out_748 as out }; - } - export { outputs_764 as outputs }; - } - namespace ND_logical_or { - let node_765: string; - export { node_765 as node }; - let inherit_765: null; - export { inherit_765 as inherit }; - export namespace inputs_765 { - let in1_220: string; - export { in1_220 as in1 }; - let in2_220: string; - export { in2_220 as in2 }; - } - export { inputs_765 as inputs }; - export namespace outputs_765 { - let out_749: string; - export { out_749 as out }; - } - export { outputs_765 as outputs }; - } - namespace ND_logical_xor { - let node_766: string; - export { node_766 as node }; - let inherit_766: null; - export { inherit_766 as inherit }; - export namespace inputs_766 { - let in1_221: string; - export { in1_221 as in1 }; - let in2_221: string; - export { in2_221 as in2 }; - } - export { inputs_766 as inputs }; - export namespace outputs_766 { - let out_750: string; - export { out_750 as out }; - } - export { outputs_766 as outputs }; - } - namespace ND_logical_not { - let node_767: string; - export { node_767 as node }; - let inherit_767: null; - export { inherit_767 as inherit }; - export namespace inputs_767 { - let _in_274: string; - export { _in_274 as in }; - } - export { inputs_767 as inputs }; - export namespace outputs_767 { - let out_751: string; - export { out_751 as out }; - } - export { outputs_767 as outputs }; - } - namespace ND_dot_float { - let node_768: string; - export { node_768 as node }; - let inherit_768: null; - export { inherit_768 as inherit }; - export namespace inputs_768 { - let _in_275: string; - export { _in_275 as in }; - export let note: string; - } - export { inputs_768 as inputs }; - export namespace outputs_768 { - let out_752: string; - export { out_752 as out }; - } - export { outputs_768 as outputs }; - } - namespace ND_dot_color3 { - let node_769: string; - export { node_769 as node }; - let inherit_769: null; - export { inherit_769 as inherit }; - export namespace inputs_769 { - let _in_276: string; - export { _in_276 as in }; - let note_1: string; - export { note_1 as note }; - } - export { inputs_769 as inputs }; - export namespace outputs_769 { - let out_753: string; - export { out_753 as out }; - } - export { outputs_769 as outputs }; - } - namespace ND_dot_color4 { - let node_770: string; - export { node_770 as node }; - let inherit_770: null; - export { inherit_770 as inherit }; - export namespace inputs_770 { - let _in_277: string; - export { _in_277 as in }; - let note_2: string; - export { note_2 as note }; - } - export { inputs_770 as inputs }; - export namespace outputs_770 { - let out_754: string; - export { out_754 as out }; - } - export { outputs_770 as outputs }; - } - namespace ND_dot_vector2 { - let node_771: string; - export { node_771 as node }; - let inherit_771: null; - export { inherit_771 as inherit }; - export namespace inputs_771 { - let _in_278: string; - export { _in_278 as in }; - let note_3: string; - export { note_3 as note }; - } - export { inputs_771 as inputs }; - export namespace outputs_771 { - let out_755: string; - export { out_755 as out }; - } - export { outputs_771 as outputs }; - } - namespace ND_dot_vector3 { - let node_772: string; - export { node_772 as node }; - let inherit_772: null; - export { inherit_772 as inherit }; - export namespace inputs_772 { - let _in_279: string; - export { _in_279 as in }; - let note_4: string; - export { note_4 as note }; - } - export { inputs_772 as inputs }; - export namespace outputs_772 { - let out_756: string; - export { out_756 as out }; - } - export { outputs_772 as outputs }; - } - namespace ND_dot_vector4 { - let node_773: string; - export { node_773 as node }; - let inherit_773: null; - export { inherit_773 as inherit }; - export namespace inputs_773 { - let _in_280: string; - export { _in_280 as in }; - let note_5: string; - export { note_5 as note }; - } - export { inputs_773 as inputs }; - export namespace outputs_773 { - let out_757: string; - export { out_757 as out }; - } - export { outputs_773 as outputs }; - } - namespace ND_dot_boolean { - let node_774: string; - export { node_774 as node }; - let inherit_774: null; - export { inherit_774 as inherit }; - export namespace inputs_774 { - let _in_281: string; - export { _in_281 as in }; - let note_6: string; - export { note_6 as note }; - } - export { inputs_774 as inputs }; - export namespace outputs_774 { - let out_758: string; - export { out_758 as out }; - } - export { outputs_774 as outputs }; - } - namespace ND_dot_integer { - let node_775: string; - export { node_775 as node }; - let inherit_775: null; - export { inherit_775 as inherit }; - export namespace inputs_775 { - let _in_282: string; - export { _in_282 as in }; - let note_7: string; - export { note_7 as note }; - } - export { inputs_775 as inputs }; - export namespace outputs_775 { - let out_759: string; - export { out_759 as out }; - } - export { outputs_775 as outputs }; - } - namespace ND_dot_matrix33 { - let node_776: string; - export { node_776 as node }; - let inherit_776: null; - export { inherit_776 as inherit }; - export namespace inputs_776 { - let _in_283: string; - export { _in_283 as in }; - let note_8: string; - export { note_8 as note }; - } - export { inputs_776 as inputs }; - export namespace outputs_776 { - let out_760: string; - export { out_760 as out }; - } - export { outputs_776 as outputs }; - } - namespace ND_dot_matrix44 { - let node_777: string; - export { node_777 as node }; - let inherit_777: null; - export { inherit_777 as inherit }; - export namespace inputs_777 { - let _in_284: string; - export { _in_284 as in }; - let note_9: string; - export { note_9 as note }; - } - export { inputs_777 as inputs }; - export namespace outputs_777 { - let out_761: string; - export { out_761 as out }; - } - export { outputs_777 as outputs }; - } - namespace ND_dot_string { - let node_778: string; - export { node_778 as node }; - let inherit_778: null; - export { inherit_778 as inherit }; - export namespace inputs_778 { - let _in_285: string; - export { _in_285 as in }; - let note_10: string; - export { note_10 as note }; - } - export { inputs_778 as inputs }; - export namespace outputs_778 { - let out_762: string; - export { out_762 as out }; - } - export { outputs_778 as outputs }; - } - namespace ND_dot_filename { - let node_779: string; - export { node_779 as node }; - let inherit_779: null; - export { inherit_779 as inherit }; - export namespace inputs_779 { - let _in_286: string; - export { _in_286 as in }; - let note_11: string; - export { note_11 as note }; - } - export { inputs_779 as inputs }; - export namespace outputs_779 { - let out_763: string; - export { out_763 as out }; - } - export { outputs_779 as outputs }; - } - namespace ND_dot_surfaceshader { - let node_780: string; - export { node_780 as node }; - let inherit_780: null; - export { inherit_780 as inherit }; - export namespace inputs_780 { - let _in_287: string; - export { _in_287 as in }; - let note_12: string; - export { note_12 as note }; - } - export { inputs_780 as inputs }; - export namespace outputs_780 { - let out_764: string; - export { out_764 as out }; - } - export { outputs_780 as outputs }; - } - namespace ND_dot_displacementshader { - let node_781: string; - export { node_781 as node }; - let inherit_781: null; - export { inherit_781 as inherit }; - export namespace inputs_781 { - let _in_288: string; - export { _in_288 as in }; - let note_13: string; - export { note_13 as note }; - } - export { inputs_781 as inputs }; - export namespace outputs_781 { - let out_765: string; - export { out_765 as out }; - } - export { outputs_781 as outputs }; - } - namespace ND_dot_volumeshader { - let node_782: string; - export { node_782 as node }; - let inherit_782: null; - export { inherit_782 as inherit }; - export namespace inputs_782 { - let _in_289: string; - export { _in_289 as in }; - let note_14: string; - export { note_14 as note }; - } - export { inputs_782 as inputs }; - export namespace outputs_782 { - let out_766: string; - export { out_766 as out }; - } - export { outputs_782 as outputs }; - } - namespace ND_dot_lightshader { - let node_783: string; - export { node_783 as node }; - let inherit_783: null; - export { inherit_783 as inherit }; - export namespace inputs_783 { - let _in_290: string; - export { _in_290 as in }; - let note_15: string; - export { note_15 as note }; - } - export { inputs_783 as inputs }; - export namespace outputs_783 { - let out_767: string; - export { out_767 as out }; - } - export { outputs_783 as outputs }; - } - namespace ND_point_light { - let node_784: string; - export { node_784 as node }; - let inherit_784: null; - export { inherit_784 as inherit }; - export namespace inputs_784 { - let position_34: string; - export { position_34 as position }; - let color_10: string; - export { color_10 as color }; - let intensity_1: string; - export { intensity_1 as intensity }; - export let decay_rate: string; - } - export { inputs_784 as inputs }; - export namespace outputs_784 { - let out_768: string; - export { out_768 as out }; - } - export { outputs_784 as outputs }; - } - namespace ND_directional_light { - let node_785: string; - export { node_785 as node }; - let inherit_785: null; - export { inherit_785 as inherit }; - export namespace inputs_785 { - export let direction: string; - let color_11: string; - export { color_11 as color }; - let intensity_2: string; - export { intensity_2 as intensity }; - } - export { inputs_785 as inputs }; - export namespace outputs_785 { - let out_769: string; - export { out_769 as out }; - } - export { outputs_785 as outputs }; - } - namespace ND_spot_light { - let node_786: string; - export { node_786 as node }; - let inherit_786: null; - export { inherit_786 as inherit }; - export namespace inputs_786 { - let position_35: string; - export { position_35 as position }; - let direction_1: string; - export { direction_1 as direction }; - let color_12: string; - export { color_12 as color }; - let intensity_3: string; - export { intensity_3 as intensity }; - let decay_rate_1: string; - export { decay_rate_1 as decay_rate }; - let inner_angle_1: string; - export { inner_angle_1 as inner_angle }; - let outer_angle_1: string; - export { outer_angle_1 as outer_angle }; - } - export { inputs_786 as inputs }; - export namespace outputs_786 { - let out_770: string; - export { out_770 as out }; - } - export { outputs_786 as outputs }; - } - namespace ND_open_pbr_surface_to_standard_surface { - let node_787: string; - export { node_787 as node }; - let inherit_787: null; - export { inherit_787 as inherit }; - export namespace inputs_787 { - let base_weight_1: string; - export { base_weight_1 as base_weight }; - let base_color_4: string; - export { base_color_4 as base_color }; - let base_diffuse_roughness_1: string; - export { base_diffuse_roughness_1 as base_diffuse_roughness }; - let base_metalness_1: string; - export { base_metalness_1 as base_metalness }; - let specular_weight_1: string; - export { specular_weight_1 as specular_weight }; - let specular_color_3: string; - export { specular_color_3 as specular_color }; - let specular_roughness_2: string; - export { specular_roughness_2 as specular_roughness }; - let specular_ior_1: string; - export { specular_ior_1 as specular_ior }; - let specular_roughness_anisotropy_1: string; - export { specular_roughness_anisotropy_1 as specular_roughness_anisotropy }; - let transmission_weight_1: string; - export { transmission_weight_1 as transmission_weight }; - let transmission_color_3: string; - export { transmission_color_3 as transmission_color }; - let transmission_depth_2: string; - export { transmission_depth_2 as transmission_depth }; - let transmission_scatter_2: string; - export { transmission_scatter_2 as transmission_scatter }; - let transmission_scatter_anisotropy_2: string; - export { transmission_scatter_anisotropy_2 as transmission_scatter_anisotropy }; - let transmission_dispersion_scale_1: string; - export { transmission_dispersion_scale_1 as transmission_dispersion_scale }; - let subsurface_weight_1: string; - export { subsurface_weight_1 as subsurface_weight }; - let subsurface_color_2: string; - export { subsurface_color_2 as subsurface_color }; - let subsurface_radius_2: string; - export { subsurface_radius_2 as subsurface_radius }; - let subsurface_radius_scale_1: string; - export { subsurface_radius_scale_1 as subsurface_radius_scale }; - let subsurface_scatter_anisotropy_1: string; - export { subsurface_scatter_anisotropy_1 as subsurface_scatter_anisotropy }; - let fuzz_weight_1: string; - export { fuzz_weight_1 as fuzz_weight }; - let fuzz_color_1: string; - export { fuzz_color_1 as fuzz_color }; - let fuzz_roughness_1: string; - export { fuzz_roughness_1 as fuzz_roughness }; - let coat_weight_1: string; - export { coat_weight_1 as coat_weight }; - let coat_color_2: string; - export { coat_color_2 as coat_color }; - let coat_roughness_2: string; - export { coat_roughness_2 as coat_roughness }; - let coat_roughness_anisotropy_1: string; - export { coat_roughness_anisotropy_1 as coat_roughness_anisotropy }; - let coat_ior_1: string; - export { coat_ior_1 as coat_ior }; - let coat_darkening_1: string; - export { coat_darkening_1 as coat_darkening }; - let thin_film_weight_1: string; - export { thin_film_weight_1 as thin_film_weight }; - let thin_film_thickness_2: string; - export { thin_film_thickness_2 as thin_film_thickness }; - let thin_film_ior_1: string; - export { thin_film_ior_1 as thin_film_ior }; - let emission_luminance_1: string; - export { emission_luminance_1 as emission_luminance }; - let emission_color_3: string; - export { emission_color_3 as emission_color }; - let geometry_opacity_1: string; - export { geometry_opacity_1 as geometry_opacity }; - let geometry_thin_walled_1: string; - export { geometry_thin_walled_1 as geometry_thin_walled }; - } - export { inputs_787 as inputs }; - export namespace outputs_787 { - let base_out: string; - let base_color_out: string; - let diffuse_roughness_out: string; - let metalness_out: string; - let specular_out: string; - let specular_color_out: string; - let specular_roughness_out: string; - let specular_IOR_out: string; - let specular_anisotropy_out: string; - let transmission_out: string; - let transmission_color_out: string; - let transmission_depth_out: string; - let transmission_scatter_out: string; - let transmission_scatter_anisotropy_out: string; - let transmission_dispersion_out: string; - let subsurface_out: string; - let subsurface_color_out: string; - let subsurface_radius_out: string; - let subsurface_scale_out: string; - let subsurface_anisotropy_out: string; - let sheen_out: string; - let sheen_color_out: string; - let sheen_roughness_out: string; - let coat_out: string; - let coat_color_out: string; - let coat_roughness_out: string; - let coat_anisotropy_out: string; - let coat_IOR_out: string; - let coat_affect_roughness_out: string; - let thin_film_thickness_out: string; - let thin_film_IOR_out: string; - let emission_out: string; - let emission_color_out: string; - let opacity_out: string; - let thin_walled_out: string; - } - export { outputs_787 as outputs }; - } - namespace ND_standard_surface_to_open_pbr_surface { - let node_788: string; - export { node_788 as node }; - let inherit_788: null; - export { inherit_788 as inherit }; - export namespace inputs_788 { - let base_5: string; - export { base_5 as base }; - let base_color_5: string; - export { base_color_5 as base_color }; - let diffuse_roughness_1: string; - export { diffuse_roughness_1 as diffuse_roughness }; - let metalness_1: string; - export { metalness_1 as metalness }; - let specular_3: string; - export { specular_3 as specular }; - let specular_color_4: string; - export { specular_color_4 as specular_color }; - let specular_roughness_3: string; - export { specular_roughness_3 as specular_roughness }; - let specular_IOR_1: string; - export { specular_IOR_1 as specular_IOR }; - let specular_anisotropy_1: string; - export { specular_anisotropy_1 as specular_anisotropy }; - let transmission_3: string; - export { transmission_3 as transmission }; - let transmission_color_4: string; - export { transmission_color_4 as transmission_color }; - let transmission_depth_3: string; - export { transmission_depth_3 as transmission_depth }; - let transmission_scatter_3: string; - export { transmission_scatter_3 as transmission_scatter }; - let transmission_scatter_anisotropy_3: string; - export { transmission_scatter_anisotropy_3 as transmission_scatter_anisotropy }; - let transmission_dispersion_1: string; - export { transmission_dispersion_1 as transmission_dispersion }; - let subsurface_2: string; - export { subsurface_2 as subsurface }; - let subsurface_color_3: string; - export { subsurface_color_3 as subsurface_color }; - let subsurface_radius_3: string; - export { subsurface_radius_3 as subsurface_radius }; - let subsurface_scale_1: string; - export { subsurface_scale_1 as subsurface_scale }; - let subsurface_anisotropy_1: string; - export { subsurface_anisotropy_1 as subsurface_anisotropy }; - let sheen_2: string; - export { sheen_2 as sheen }; - let sheen_color_2: string; - export { sheen_color_2 as sheen_color }; - let sheen_roughness_2: string; - export { sheen_roughness_2 as sheen_roughness }; - let coat_1: string; - export { coat_1 as coat }; - let coat_color_3: string; - export { coat_color_3 as coat_color }; - let coat_roughness_3: string; - export { coat_roughness_3 as coat_roughness }; - let coat_anisotropy_1: string; - export { coat_anisotropy_1 as coat_anisotropy }; - let coat_IOR_1: string; - export { coat_IOR_1 as coat_IOR }; - let coat_affect_roughness_1: string; - export { coat_affect_roughness_1 as coat_affect_roughness }; - let thin_film_thickness_3: string; - export { thin_film_thickness_3 as thin_film_thickness }; - let thin_film_IOR_1: string; - export { thin_film_IOR_1 as thin_film_IOR }; - let emission_2: string; - export { emission_2 as emission }; - let emission_color_4: string; - export { emission_color_4 as emission_color }; - let opacity_4: string; - export { opacity_4 as opacity }; - let thin_walled_2: string; - export { thin_walled_2 as thin_walled }; - } - export { inputs_788 as inputs }; - export namespace outputs_788 { - export let base_weight_out: string; - let base_color_out_1: string; - export { base_color_out_1 as base_color_out }; - export let base_diffuse_roughness_out: string; - export let base_metalness_out: string; - export let specular_weight_out: string; - let specular_color_out_1: string; - export { specular_color_out_1 as specular_color_out }; - let specular_roughness_out_1: string; - export { specular_roughness_out_1 as specular_roughness_out }; - export let specular_ior_out: string; - export let specular_roughness_anisotropy_out: string; - export let transmission_weight_out: string; - let transmission_color_out_1: string; - export { transmission_color_out_1 as transmission_color_out }; - let transmission_depth_out_1: string; - export { transmission_depth_out_1 as transmission_depth_out }; - let transmission_scatter_out_1: string; - export { transmission_scatter_out_1 as transmission_scatter_out }; - let transmission_scatter_anisotropy_out_1: string; - export { transmission_scatter_anisotropy_out_1 as transmission_scatter_anisotropy_out }; - export let transmission_dispersion_scale_out: string; - export let subsurface_weight_out: string; - let subsurface_color_out_1: string; - export { subsurface_color_out_1 as subsurface_color_out }; - let subsurface_radius_out_1: string; - export { subsurface_radius_out_1 as subsurface_radius_out }; - export let subsurface_radius_scale_out: string; - export let subsurface_scatter_anisotropy_out: string; - export let fuzz_weight_out: string; - export let fuzz_color_out: string; - export let fuzz_roughness_out: string; - export let coat_weight_out: string; - let coat_color_out_1: string; - export { coat_color_out_1 as coat_color_out }; - let coat_roughness_out_1: string; - export { coat_roughness_out_1 as coat_roughness_out }; - export let coat_roughness_anisotropy_out: string; - export let coat_ior_out: string; - export let coat_darkening_out: string; - export let thin_film_weight_out: string; - let thin_film_thickness_out_1: string; - export { thin_film_thickness_out_1 as thin_film_thickness_out }; - export let thin_film_ior_out: string; - export let emission_luminance_out: string; - let emission_color_out_1: string; - export { emission_color_out_1 as emission_color_out }; - export let geometry_opacity_out: string; - export let geometry_thin_walled_out: string; - } - export { outputs_788 as outputs }; - } - namespace ND_standard_surface_to_UsdPreviewSurface { - let node_789: string; - export { node_789 as node }; - let inherit_789: null; - export { inherit_789 as inherit }; - export namespace inputs_789 { - let metalness_2: string; - export { metalness_2 as metalness }; - let base_6: string; - export { base_6 as base }; - let base_color_6: string; - export { base_color_6 as base_color }; - let specular_4: string; - export { specular_4 as specular }; - let specular_color_5: string; - export { specular_color_5 as specular_color }; - let specular_IOR_2: string; - export { specular_IOR_2 as specular_IOR }; - let specular_roughness_4: string; - export { specular_roughness_4 as specular_roughness }; - let coat_2: string; - export { coat_2 as coat }; - let coat_color_4: string; - export { coat_color_4 as coat_color }; - let coat_roughness_4: string; - export { coat_roughness_4 as coat_roughness }; - let subsurface_3: string; - export { subsurface_3 as subsurface }; - let subsurface_color_4: string; - export { subsurface_color_4 as subsurface_color }; - let emission_3: string; - export { emission_3 as emission }; - let emission_color_5: string; - export { emission_color_5 as emission_color }; - let opacity_5: string; - export { opacity_5 as opacity }; - let normal_29: string; - export { normal_29 as normal }; - } - export { inputs_789 as inputs }; - export namespace outputs_789 { - export let diffuseColor_out: string; - export let emissiveColor_out: string; - export let metallic_out: string; - export let roughness_out: string; - export let clearcoat_out: string; - export let clearcoatRoughness_out: string; - let opacity_out_1: string; - export { opacity_out_1 as opacity_out }; - export let ior_out: string; - export let normal_out: string; - } - export { outputs_789 as outputs }; - } - namespace ND_standard_surface_to_gltf_pbr { - let node_790: string; - export { node_790 as node }; - let inherit_790: null; - export { inherit_790 as inherit }; - export namespace inputs_790 { - let base_7: string; - export { base_7 as base }; - let base_color_7: string; - export { base_color_7 as base_color }; - let metalness_3: string; - export { metalness_3 as metalness }; - let specular_5: string; - export { specular_5 as specular }; - let specular_color_6: string; - export { specular_color_6 as specular_color }; - let specular_anisotropy_2: string; - export { specular_anisotropy_2 as specular_anisotropy }; - let specular_rotation_1: string; - export { specular_rotation_1 as specular_rotation }; - let specular_roughness_5: string; - export { specular_roughness_5 as specular_roughness }; - let specular_IOR_3: string; - export { specular_IOR_3 as specular_IOR }; - let transmission_4: string; - export { transmission_4 as transmission }; - let transmission_color_5: string; - export { transmission_color_5 as transmission_color }; - let transmission_depth_4: string; - export { transmission_depth_4 as transmission_depth }; - let transmission_dispersion_2: string; - export { transmission_dispersion_2 as transmission_dispersion }; - let sheen_3: string; - export { sheen_3 as sheen }; - let sheen_color_3: string; - export { sheen_color_3 as sheen_color }; - let sheen_roughness_3: string; - export { sheen_roughness_3 as sheen_roughness }; - let coat_3: string; - export { coat_3 as coat }; - let coat_color_5: string; - export { coat_color_5 as coat_color }; - let coat_roughness_5: string; - export { coat_roughness_5 as coat_roughness }; - let emission_4: string; - export { emission_4 as emission }; - let emission_color_6: string; - export { emission_color_6 as emission_color }; - let normal_30: string; - export { normal_30 as normal }; - let tangent_11: string; - export { tangent_11 as tangent }; - let opacity_6: string; - export { opacity_6 as opacity }; - let thin_walled_3: string; - export { thin_walled_3 as thin_walled }; - } - export { inputs_790 as inputs }; - export namespace outputs_790 { - let base_color_out_2: string; - export { base_color_out_2 as base_color_out }; - let metallic_out_1: string; - export { metallic_out_1 as metallic_out }; - let roughness_out_1: string; - export { roughness_out_1 as roughness_out }; - let specular_out_1: string; - export { specular_out_1 as specular_out }; - let specular_color_out_2: string; - export { specular_color_out_2 as specular_color_out }; - let ior_out_1: string; - export { ior_out_1 as ior_out }; - let anisotropy_strength_out_1: string; - export { anisotropy_strength_out_1 as anisotropy_strength_out }; - let anisotropy_rotation_out_1: string; - export { anisotropy_rotation_out_1 as anisotropy_rotation_out }; - let transmission_out_1: string; - export { transmission_out_1 as transmission_out }; - export let thickness_out: string; - export let attenuation_color_out: string; - export let attenuation_distance_out: string; - let sheen_color_out_1: string; - export { sheen_color_out_1 as sheen_color_out }; - let sheen_roughness_out_1: string; - export { sheen_roughness_out_1 as sheen_roughness_out }; - let clearcoat_out_1: string; - export { clearcoat_out_1 as clearcoat_out }; - export let clearcoat_roughness_out: string; - export let dispersion_out: string; - export let emissive_out: string; - export let emissive_strength_out: string; - let normal_out_1: string; - export { normal_out_1 as normal_out }; - export let tangent_out: string; - export let alpha_out: string; - export let alpha_mode_out: string; - } - export { outputs_790 as outputs }; - } - namespace ND_lama_sheen { - let node_791: string; - export { node_791 as node }; - let inherit_791: null; - export { inherit_791 as inherit }; - export namespace inputs_791 { - let color_13: string; - export { color_13 as color }; - let roughness_14: string; - export { roughness_14 as roughness }; - let normal_31: string; - export { normal_31 as normal }; - } - export { inputs_791 as inputs }; - export namespace outputs_791 { - let out_771: string; - export { out_771 as out }; - } - export { outputs_791 as outputs }; - } - namespace ND_lama_sss { - let node_792: string; - export { node_792 as node }; - let inherit_792: null; - export { inherit_792 as inherit }; - export namespace inputs_792 { - let color_14: string; - export { color_14 as color }; - let normal_32: string; - export { normal_32 as normal }; - export let sssRadius: string; - export let sssScale: string; - export let sssMode: string; - export let sssIOR: string; - export let sssAnisotropy: string; - export let sssBleed: string; - export let sssFollowTopology: string; - export let sssSubset: string; - export let sssContinuationRays: string; - export let sssUnitLength: string; - let mode_1: string; - export { mode_1 as mode }; - export let albedoInversionMethod: string; - } - export { inputs_792 as inputs }; - export namespace outputs_792 { - let out_772: string; - export { out_772 as out }; - } - export { outputs_792 as outputs }; - } - namespace ND_lama_dielectric { - let node_793: string; - export { node_793 as node }; - let inherit_793: null; - export { inherit_793 as inherit }; - export namespace inputs_793 { - export let reflectionTint: string; - export let transmissionTint: string; - export let fresnelMode: string; - export let IOR: string; - let reflectivity_1: string; - export { reflectivity_1 as reflectivity }; - let roughness_15: string; - export { roughness_15 as roughness }; - let normal_33: string; - export { normal_33 as normal }; - let anisotropy_5: string; - export { anisotropy_5 as anisotropy }; - let direction_2: string; - export { direction_2 as direction }; - let rotation_5: string; - export { rotation_5 as rotation }; - export let absorptionColor: string; - export let absorptionRadius: string; - export let scatterColor: string; - export let scatterAnisotropy: string; - } - export { inputs_793 as inputs }; - export namespace outputs_793 { - let out_773: string; - export { out_773 as out }; - } - export { outputs_793 as outputs }; - } - namespace ND_lama_iridescence { - let node_794: string; - export { node_794 as node }; - let inherit_794: null; - export { inherit_794 as inherit }; - export namespace inputs_794 { - let roughness_16: string; - export { roughness_16 as roughness }; - let anisotropy_6: string; - export { anisotropy_6 as anisotropy }; - export let anisotropyDirection: string; - export let anisotropyRotation: string; - export let relativeFilmThickness: string; - export let minFilmThickness: string; - export let maxFilmThickness: string; - export let filmIOR: string; - } - export { inputs_794 as inputs }; - export namespace outputs_794 { - let out_774: string; - export { out_774 as out }; - } - export { outputs_794 as outputs }; - } - namespace ND_lama_diffuse { - let node_795: string; - export { node_795 as node }; - let inherit_795: null; - export { inherit_795 as inherit }; - export namespace inputs_795 { - let color_15: string; - export { color_15 as color }; - let roughness_17: string; - export { roughness_17 as roughness }; - let normal_34: string; - export { normal_34 as normal }; - export let energyCompensation: string; - } - export { inputs_795 as inputs }; - export namespace outputs_795 { - let out_775: string; - export { out_775 as out }; - } - export { outputs_795 as outputs }; - } - namespace ND_lama_mix_bsdf { - let node_796: string; - export { node_796 as node }; - let inherit_796: null; - export { inherit_796 as inherit }; - export namespace inputs_796 { - export let material1: string; - export let material2: string; - let mix_44: string; - export { mix_44 as mix }; - } - export { inputs_796 as inputs }; - export namespace outputs_796 { - let out_776: string; - export { out_776 as out }; - } - export { outputs_796 as outputs }; - } - namespace ND_lama_mix_edf { - let node_797: string; - export { node_797 as node }; - let inherit_797: null; - export { inherit_797 as inherit }; - export namespace inputs_797 { - let material1_1: string; - export { material1_1 as material1 }; - let material2_1: string; - export { material2_1 as material2 }; - let mix_45: string; - export { mix_45 as mix }; - } - export { inputs_797 as inputs }; - export namespace outputs_797 { - let out_777: string; - export { out_777 as out }; - } - export { outputs_797 as outputs }; - } - namespace ND_lama_add_bsdf { - let node_798: string; - export { node_798 as node }; - let inherit_798: null; - export { inherit_798 as inherit }; - export namespace inputs_798 { - let material1_2: string; - export { material1_2 as material1 }; - let material2_2: string; - export { material2_2 as material2 }; - export let weight1: string; - export let weight2: string; - } - export { inputs_798 as inputs }; - export namespace outputs_798 { - let out_778: string; - export { out_778 as out }; - } - export { outputs_798 as outputs }; - } - namespace ND_lama_add_edf { - let node_799: string; - export { node_799 as node }; - let inherit_799: null; - export { inherit_799 as inherit }; - export namespace inputs_799 { - let material1_3: string; - export { material1_3 as material1 }; - let material2_3: string; - export { material2_3 as material2 }; - let weight1_1: string; - export { weight1_1 as weight1 }; - let weight2_1: string; - export { weight2_1 as weight2 }; - } - export { inputs_799 as inputs }; - export namespace outputs_799 { - let out_779: string; - export { out_779 as out }; - } - export { outputs_799 as outputs }; - } - namespace ND_lama_conductor { - let node_800: string; - export { node_800 as node }; - let inherit_800: null; - export { inherit_800 as inherit }; - export namespace inputs_800 { - let tint_1: string; - export { tint_1 as tint }; - let fresnelMode_1: string; - export { fresnelMode_1 as fresnelMode }; - let IOR_1: string; - export { IOR_1 as IOR }; - let extinction_2: string; - export { extinction_2 as extinction }; - let reflectivity_2: string; - export { reflectivity_2 as reflectivity }; - export let edgeColor: string; - let roughness_18: string; - export { roughness_18 as roughness }; - let normal_35: string; - export { normal_35 as normal }; - let anisotropy_7: string; - export { anisotropy_7 as anisotropy }; - let anisotropyDirection_1: string; - export { anisotropyDirection_1 as anisotropyDirection }; - let anisotropyRotation_1: string; - export { anisotropyRotation_1 as anisotropyRotation }; - } - export { inputs_800 as inputs }; - export namespace outputs_800 { - let out_780: string; - export { out_780 as out }; - } - export { outputs_800 as outputs }; - } - namespace ND_lama_emission { - let node_801: string; - export { node_801 as node }; - let inherit_801: null; - export { inherit_801 as inherit }; - export namespace inputs_801 { - let color_16: string; - export { color_16 as color }; - } - export { inputs_801 as inputs }; - export namespace outputs_801 { - let out_781: string; - export { out_781 as out }; - } - export { outputs_801 as outputs }; - } - namespace ND_lama_surface { - let node_802: string; - export { node_802 as node }; - let inherit_802: null; - export { inherit_802 as inherit }; - export namespace inputs_802 { - export let materialFront: string; - export let materialBack: string; - let presence_2: string; - export { presence_2 as presence }; - } - export { inputs_802 as inputs }; - export namespace outputs_802 { - let out_782: string; - export { out_782 as out }; - } - export { outputs_802 as outputs }; - } - namespace ND_lama_generalized_schlick { - let node_803: string; - export { node_803 as node }; - let inherit_803: null; - export { inherit_803 as inherit }; - export namespace inputs_803 { - let reflectionTint_1: string; - export { reflectionTint_1 as reflectionTint }; - let transmissionTint_1: string; - export { transmissionTint_1 as transmissionTint }; - let fresnelMode_2: string; - export { fresnelMode_2 as fresnelMode }; - let IOR_2: string; - export { IOR_2 as IOR }; - let reflectivity_3: string; - export { reflectivity_3 as reflectivity }; - export let reflectivity90: string; - export let reflectivityProfile: string; - let roughness_19: string; - export { roughness_19 as roughness }; - let normal_36: string; - export { normal_36 as normal }; - let anisotropy_8: string; - export { anisotropy_8 as anisotropy }; - let anisotropyDirection_2: string; - export { anisotropyDirection_2 as anisotropyDirection }; - let anisotropyRotation_2: string; - export { anisotropyRotation_2 as anisotropyRotation }; - let absorptionColor_1: string; - export { absorptionColor_1 as absorptionColor }; - let absorptionRadius_1: string; - export { absorptionRadius_1 as absorptionRadius }; - let scatterColor_1: string; - export { scatterColor_1 as scatterColor }; - let scatterAnisotropy_1: string; - export { scatterAnisotropy_1 as scatterAnisotropy }; - } - export { inputs_803 as inputs }; - export namespace outputs_803 { - let out_783: string; - export { out_783 as out }; - } - export { outputs_803 as outputs }; - } - namespace ND_lama_translucent { - let node_804: string; - export { node_804 as node }; - let inherit_804: null; - export { inherit_804 as inherit }; - export namespace inputs_804 { - let color_17: string; - export { color_17 as color }; - let roughness_20: string; - export { roughness_20 as roughness }; - let normal_37: string; - export { normal_37 as normal }; - let energyCompensation_1: string; - export { energyCompensation_1 as energyCompensation }; - } - export { inputs_804 as inputs }; - export namespace outputs_804 { - let out_784: string; - export { out_784 as out }; - } - export { outputs_804 as outputs }; - } - namespace ND_lama_layer_bsdf { - let node_805: string; - export { node_805 as node }; - let inherit_805: null; - export { inherit_805 as inherit }; - export namespace inputs_805 { - let materialTop: string; - let materialBase: string; - let topMix: string; - let topThickness: string; - } - export { inputs_805 as inputs }; - export namespace outputs_805 { - let out_785: string; - export { out_785 as out }; - } - export { outputs_805 as outputs }; - } - } - namespace resolved { - export namespace ND_oren_nayar_diffuse_bsdf_1 { - let node_806: string; - export { node_806 as node }; - export namespace inputs_806 { - let weight_8: string; - export { weight_8 as weight }; - let color_18: string; - export { color_18 as color }; - let roughness_21: string; - export { roughness_21 as roughness }; - let normal_38: string; - export { normal_38 as normal }; - let energy_compensation_1: string; - export { energy_compensation_1 as energy_compensation }; - } - export { inputs_806 as inputs }; - export namespace outputs_806 { - let out_786: string; - export { out_786 as out }; - } - export { outputs_806 as outputs }; - } - export { ND_oren_nayar_diffuse_bsdf_1 as ND_oren_nayar_diffuse_bsdf }; - export namespace ND_burley_diffuse_bsdf_1 { - let node_807: string; - export { node_807 as node }; - export namespace inputs_807 { - let weight_9: string; - export { weight_9 as weight }; - let color_19: string; - export { color_19 as color }; - let roughness_22: string; - export { roughness_22 as roughness }; - let normal_39: string; - export { normal_39 as normal }; - } - export { inputs_807 as inputs }; - export namespace outputs_807 { - let out_787: string; - export { out_787 as out }; - } - export { outputs_807 as outputs }; - } - export { ND_burley_diffuse_bsdf_1 as ND_burley_diffuse_bsdf }; - export namespace ND_translucent_bsdf_1 { - let node_808: string; - export { node_808 as node }; - export namespace inputs_808 { - let weight_10: string; - export { weight_10 as weight }; - let color_20: string; - export { color_20 as color }; - let normal_40: string; - export { normal_40 as normal }; - } - export { inputs_808 as inputs }; - export namespace outputs_808 { - let out_788: string; - export { out_788 as out }; - } - export { outputs_808 as outputs }; - } - export { ND_translucent_bsdf_1 as ND_translucent_bsdf }; - export namespace ND_dielectric_bsdf_1 { - let node_809: string; - export { node_809 as node }; - export namespace inputs_809 { - let weight_11: string; - export { weight_11 as weight }; - let tint_2: string; - export { tint_2 as tint }; - let ior_8: string; - export { ior_8 as ior }; - let roughness_23: string; - export { roughness_23 as roughness }; - let retroreflective_3: string; - export { retroreflective_3 as retroreflective }; - let thinfilm_thickness_3: string; - export { thinfilm_thickness_3 as thinfilm_thickness }; - let thinfilm_ior_3: string; - export { thinfilm_ior_3 as thinfilm_ior }; - let normal_41: string; - export { normal_41 as normal }; - let tangent_12: string; - export { tangent_12 as tangent }; - let distribution_3: string; - export { distribution_3 as distribution }; - let scatter_mode_2: string; - export { scatter_mode_2 as scatter_mode }; - } - export { inputs_809 as inputs }; - export namespace outputs_809 { - let out_789: string; - export { out_789 as out }; - } - export { outputs_809 as outputs }; - } - export { ND_dielectric_bsdf_1 as ND_dielectric_bsdf }; - export namespace ND_conductor_bsdf_1 { - let node_810: string; - export { node_810 as node }; - export namespace inputs_810 { - let weight_12: string; - export { weight_12 as weight }; - let ior_9: string; - export { ior_9 as ior }; - let extinction_3: string; - export { extinction_3 as extinction }; - let roughness_24: string; - export { roughness_24 as roughness }; - let retroreflective_4: string; - export { retroreflective_4 as retroreflective }; - let thinfilm_thickness_4: string; - export { thinfilm_thickness_4 as thinfilm_thickness }; - let thinfilm_ior_4: string; - export { thinfilm_ior_4 as thinfilm_ior }; - let normal_42: string; - export { normal_42 as normal }; - let tangent_13: string; - export { tangent_13 as tangent }; - let distribution_4: string; - export { distribution_4 as distribution }; - } - export { inputs_810 as inputs }; - export namespace outputs_810 { - let out_790: string; - export { out_790 as out }; - } - export { outputs_810 as outputs }; - } - export { ND_conductor_bsdf_1 as ND_conductor_bsdf }; - export namespace ND_generalized_schlick_bsdf_1 { - let node_811: string; - export { node_811 as node }; - export namespace inputs_811 { - let weight_13: string; - export { weight_13 as weight }; - let color0_2: string; - export { color0_2 as color0 }; - let color82_1: string; - export { color82_1 as color82 }; - let color90_2: string; - export { color90_2 as color90 }; - let exponent_2: string; - export { exponent_2 as exponent }; - let roughness_25: string; - export { roughness_25 as roughness }; - let retroreflective_5: string; - export { retroreflective_5 as retroreflective }; - let thinfilm_thickness_5: string; - export { thinfilm_thickness_5 as thinfilm_thickness }; - let thinfilm_ior_5: string; - export { thinfilm_ior_5 as thinfilm_ior }; - let normal_43: string; - export { normal_43 as normal }; - let tangent_14: string; - export { tangent_14 as tangent }; - let distribution_5: string; - export { distribution_5 as distribution }; - let scatter_mode_3: string; - export { scatter_mode_3 as scatter_mode }; - } - export { inputs_811 as inputs }; - export namespace outputs_811 { - let out_791: string; - export { out_791 as out }; - } - export { outputs_811 as outputs }; - } - export { ND_generalized_schlick_bsdf_1 as ND_generalized_schlick_bsdf }; - export namespace ND_subsurface_bsdf_1 { - let node_812: string; - export { node_812 as node }; - export namespace inputs_812 { - let weight_14: string; - export { weight_14 as weight }; - let color_21: string; - export { color_21 as color }; - let radius_5: string; - export { radius_5 as radius }; - let anisotropy_9: string; - export { anisotropy_9 as anisotropy }; - let normal_44: string; - export { normal_44 as normal }; - } - export { inputs_812 as inputs }; - export namespace outputs_812 { - let out_792: string; - export { out_792 as out }; - } - export { outputs_812 as outputs }; - } - export { ND_subsurface_bsdf_1 as ND_subsurface_bsdf }; - export namespace ND_sheen_bsdf_1 { - let node_813: string; - export { node_813 as node }; - export namespace inputs_813 { - let weight_15: string; - export { weight_15 as weight }; - let color_22: string; - export { color_22 as color }; - let roughness_26: string; - export { roughness_26 as roughness }; - let normal_45: string; - export { normal_45 as normal }; - let mode_2: string; - export { mode_2 as mode }; - } - export { inputs_813 as inputs }; - export namespace outputs_813 { - let out_793: string; - export { out_793 as out }; - } - export { outputs_813 as outputs }; - } - export { ND_sheen_bsdf_1 as ND_sheen_bsdf }; - export namespace ND_chiang_hair_bsdf_1 { - let node_814: string; - export { node_814 as node }; - export namespace inputs_814 { - let tint_R_1: string; - export { tint_R_1 as tint_R }; - let tint_TT_1: string; - export { tint_TT_1 as tint_TT }; - let tint_TRT_1: string; - export { tint_TRT_1 as tint_TRT }; - let ior_10: string; - export { ior_10 as ior }; - let roughness_R_2: string; - export { roughness_R_2 as roughness_R }; - let roughness_TT_2: string; - export { roughness_TT_2 as roughness_TT }; - let roughness_TRT_2: string; - export { roughness_TRT_2 as roughness_TRT }; - let cuticle_angle_1: string; - export { cuticle_angle_1 as cuticle_angle }; - let absorption_coefficient_1: string; - export { absorption_coefficient_1 as absorption_coefficient }; - let normal_46: string; - export { normal_46 as normal }; - let curve_direction_1: string; - export { curve_direction_1 as curve_direction }; - } - export { inputs_814 as inputs }; - export namespace outputs_814 { - let out_794: string; - export { out_794 as out }; - } - export { outputs_814 as outputs }; - } - export { ND_chiang_hair_bsdf_1 as ND_chiang_hair_bsdf }; - export namespace ND_uniform_edf_1 { - let node_815: string; - export { node_815 as node }; - export namespace inputs_815 { - let color_23: string; - export { color_23 as color }; - } - export { inputs_815 as inputs }; - export namespace outputs_815 { - let out_795: string; - export { out_795 as out }; - } - export { outputs_815 as outputs }; - } - export { ND_uniform_edf_1 as ND_uniform_edf }; - export namespace ND_conical_edf_1 { - let node_816: string; - export { node_816 as node }; - export namespace inputs_816 { - let color_24: string; - export { color_24 as color }; - let normal_47: string; - export { normal_47 as normal }; - let inner_angle_2: string; - export { inner_angle_2 as inner_angle }; - let outer_angle_2: string; - export { outer_angle_2 as outer_angle }; - } - export { inputs_816 as inputs }; - export namespace outputs_816 { - let out_796: string; - export { out_796 as out }; - } - export { outputs_816 as outputs }; - } - export { ND_conical_edf_1 as ND_conical_edf }; - export namespace ND_measured_edf_1 { - let node_817: string; - export { node_817 as node }; - export namespace inputs_817 { - let color_25: string; - export { color_25 as color }; - let normal_48: string; - export { normal_48 as normal }; - let file_26: string; - export { file_26 as file }; - } - export { inputs_817 as inputs }; - export namespace outputs_817 { - let out_797: string; - export { out_797 as out }; - } - export { outputs_817 as outputs }; - } - export { ND_measured_edf_1 as ND_measured_edf }; - export namespace ND_generalized_schlick_edf_1 { - let node_818: string; - export { node_818 as node }; - export namespace inputs_818 { - let color0_3: string; - export { color0_3 as color0 }; - let color90_3: string; - export { color90_3 as color90 }; - let exponent_3: string; - export { exponent_3 as exponent }; - let base_8: string; - export { base_8 as base }; - } - export { inputs_818 as inputs }; - export namespace outputs_818 { - let out_798: string; - export { out_798 as out }; - } - export { outputs_818 as outputs }; - } - export { ND_generalized_schlick_edf_1 as ND_generalized_schlick_edf }; - export namespace ND_absorption_vdf_1 { - let node_819: string; - export { node_819 as node }; - export namespace inputs_819 { - let absorption_4: string; - export { absorption_4 as absorption }; - } - export { inputs_819 as inputs }; - export namespace outputs_819 { - let out_799: string; - export { out_799 as out }; - } - export { outputs_819 as outputs }; - } - export { ND_absorption_vdf_1 as ND_absorption_vdf }; - export namespace ND_anisotropic_vdf_1 { - let node_820: string; - export { node_820 as node }; - export namespace inputs_820 { - let absorption_5: string; - export { absorption_5 as absorption }; - let scattering_1: string; - export { scattering_1 as scattering }; - let anisotropy_10: string; - export { anisotropy_10 as anisotropy }; - } - export { inputs_820 as inputs }; - export namespace outputs_820 { - let out_800: string; - export { out_800 as out }; - } - export { outputs_820 as outputs }; - } - export { ND_anisotropic_vdf_1 as ND_anisotropic_vdf }; - export namespace ND_surface_1 { - let node_821: string; - export { node_821 as node }; - export namespace inputs_821 { - let bsdf_1: string; - export { bsdf_1 as bsdf }; - let edf_3: string; - export { edf_3 as edf }; - let opacity_7: string; - export { opacity_7 as opacity }; - let thin_walled_4: string; - export { thin_walled_4 as thin_walled }; - } - export { inputs_821 as inputs }; - export namespace outputs_821 { - let out_801: string; - export { out_801 as out }; - } - export { outputs_821 as outputs }; - } - export { ND_surface_1 as ND_surface }; - export namespace ND_volume_1 { - let node_822: string; - export { node_822 as node }; - export namespace inputs_822 { - let vdf_1: string; - export { vdf_1 as vdf }; - let edf_4: string; - export { edf_4 as edf }; - } - export { inputs_822 as inputs }; - export namespace outputs_822 { - let out_802: string; - export { out_802 as out }; - } - export { outputs_822 as outputs }; - } - export { ND_volume_1 as ND_volume }; - export namespace ND_light_1 { - let node_823: string; - export { node_823 as node }; - export namespace inputs_823 { - let edf_5: string; - export { edf_5 as edf }; - let intensity_4: string; - export { intensity_4 as intensity }; - let exposure_3: string; - export { exposure_3 as exposure }; - } - export { inputs_823 as inputs }; - export namespace outputs_823 { - let out_803: string; - export { out_803 as out }; - } - export { outputs_823 as outputs }; - } - export { ND_light_1 as ND_light }; - export namespace ND_displacement_float_1 { - let node_824: string; - export { node_824 as node }; - export namespace inputs_824 { - let displacement_3: string; - export { displacement_3 as displacement }; - let scale_20: string; - export { scale_20 as scale }; - } - export { inputs_824 as inputs }; - export namespace outputs_824 { - let out_804: string; - export { out_804 as out }; - } - export { outputs_824 as outputs }; - } - export { ND_displacement_float_1 as ND_displacement_float }; - export namespace ND_displacement_vector3_1 { - let node_825: string; - export { node_825 as node }; - export namespace inputs_825 { - let displacement_4: string; - export { displacement_4 as displacement }; - let scale_21: string; - export { scale_21 as scale }; - } - export { inputs_825 as inputs }; - export namespace outputs_825 { - let out_805: string; - export { out_805 as out }; - } - export { outputs_825 as outputs }; - } - export { ND_displacement_vector3_1 as ND_displacement_vector3 }; - export namespace ND_layer_bsdf_1 { - let node_826: string; - export { node_826 as node }; - export namespace inputs_826 { - let top_2: string; - export { top_2 as top }; - let base_9: string; - export { base_9 as base }; - } - export { inputs_826 as inputs }; - export namespace outputs_826 { - let out_806: string; - export { out_806 as out }; - } - export { outputs_826 as outputs }; - } - export { ND_layer_bsdf_1 as ND_layer_bsdf }; - export namespace ND_layer_vdf_1 { - let node_827: string; - export { node_827 as node }; - export namespace inputs_827 { - let top_3: string; - export { top_3 as top }; - let base_10: string; - export { base_10 as base }; - } - export { inputs_827 as inputs }; - export namespace outputs_827 { - let out_807: string; - export { out_807 as out }; - } - export { outputs_827 as outputs }; - } - export { ND_layer_vdf_1 as ND_layer_vdf }; - export namespace ND_mix_bsdf_1 { - let node_828: string; - export { node_828 as node }; - export namespace inputs_828 { - let fg_44: string; - export { fg_44 as fg }; - let bg_44: string; - export { bg_44 as bg }; - let mix_46: string; - export { mix_46 as mix }; - } - export { inputs_828 as inputs }; - export namespace outputs_828 { - let out_808: string; - export { out_808 as out }; - } - export { outputs_828 as outputs }; - } - export { ND_mix_bsdf_1 as ND_mix_bsdf }; - export namespace ND_mix_edf_1 { - let node_829: string; - export { node_829 as node }; - export namespace inputs_829 { - let fg_45: string; - export { fg_45 as fg }; - let bg_45: string; - export { bg_45 as bg }; - let mix_47: string; - export { mix_47 as mix }; - } - export { inputs_829 as inputs }; - export namespace outputs_829 { - let out_809: string; - export { out_809 as out }; - } - export { outputs_829 as outputs }; - } - export { ND_mix_edf_1 as ND_mix_edf }; - export namespace ND_mix_vdf_1 { - let node_830: string; - export { node_830 as node }; - export namespace inputs_830 { - let fg_46: string; - export { fg_46 as fg }; - let bg_46: string; - export { bg_46 as bg }; - let mix_48: string; - export { mix_48 as mix }; - } - export { inputs_830 as inputs }; - export namespace outputs_830 { - let out_810: string; - export { out_810 as out }; - } - export { outputs_830 as outputs }; - } - export { ND_mix_vdf_1 as ND_mix_vdf }; - export namespace ND_add_bsdf_1 { - let node_831: string; - export { node_831 as node }; - export namespace inputs_831 { - let in1_222: string; - export { in1_222 as in1 }; - let in2_222: string; - export { in2_222 as in2 }; - } - export { inputs_831 as inputs }; - export namespace outputs_831 { - let out_811: string; - export { out_811 as out }; - } - export { outputs_831 as outputs }; - } - export { ND_add_bsdf_1 as ND_add_bsdf }; - export namespace ND_add_edf_1 { - let node_832: string; - export { node_832 as node }; - export namespace inputs_832 { - let in1_223: string; - export { in1_223 as in1 }; - let in2_223: string; - export { in2_223 as in2 }; - } - export { inputs_832 as inputs }; - export namespace outputs_832 { - let out_812: string; - export { out_812 as out }; - } - export { outputs_832 as outputs }; - } - export { ND_add_edf_1 as ND_add_edf }; - export namespace ND_add_vdf_1 { - let node_833: string; - export { node_833 as node }; - export namespace inputs_833 { - let in1_224: string; - export { in1_224 as in1 }; - let in2_224: string; - export { in2_224 as in2 }; - } - export { inputs_833 as inputs }; - export namespace outputs_833 { - let out_813: string; - export { out_813 as out }; - } - export { outputs_833 as outputs }; - } - export { ND_add_vdf_1 as ND_add_vdf }; - export namespace ND_multiply_bsdfC_1 { - let node_834: string; - export { node_834 as node }; - export namespace inputs_834 { - let in1_225: string; - export { in1_225 as in1 }; - let in2_225: string; - export { in2_225 as in2 }; - } - export { inputs_834 as inputs }; - export namespace outputs_834 { - let out_814: string; - export { out_814 as out }; - } - export { outputs_834 as outputs }; - } - export { ND_multiply_bsdfC_1 as ND_multiply_bsdfC }; - export namespace ND_multiply_bsdfF_1 { - let node_835: string; - export { node_835 as node }; - export namespace inputs_835 { - let in1_226: string; - export { in1_226 as in1 }; - let in2_226: string; - export { in2_226 as in2 }; - } - export { inputs_835 as inputs }; - export namespace outputs_835 { - let out_815: string; - export { out_815 as out }; - } - export { outputs_835 as outputs }; - } - export { ND_multiply_bsdfF_1 as ND_multiply_bsdfF }; - export namespace ND_multiply_edfC_1 { - let node_836: string; - export { node_836 as node }; - export namespace inputs_836 { - let in1_227: string; - export { in1_227 as in1 }; - let in2_227: string; - export { in2_227 as in2 }; - } - export { inputs_836 as inputs }; - export namespace outputs_836 { - let out_816: string; - export { out_816 as out }; - } - export { outputs_836 as outputs }; - } - export { ND_multiply_edfC_1 as ND_multiply_edfC }; - export namespace ND_multiply_edfF_1 { - let node_837: string; - export { node_837 as node }; - export namespace inputs_837 { - let in1_228: string; - export { in1_228 as in1 }; - let in2_228: string; - export { in2_228 as in2 }; - } - export { inputs_837 as inputs }; - export namespace outputs_837 { - let out_817: string; - export { out_817 as out }; - } - export { outputs_837 as outputs }; - } - export { ND_multiply_edfF_1 as ND_multiply_edfF }; - export namespace ND_multiply_vdfC_1 { - let node_838: string; - export { node_838 as node }; - export namespace inputs_838 { - let in1_229: string; - export { in1_229 as in1 }; - let in2_229: string; - export { in2_229 as in2 }; - } - export { inputs_838 as inputs }; - export namespace outputs_838 { - let out_818: string; - export { out_818 as out }; - } - export { outputs_838 as outputs }; - } - export { ND_multiply_vdfC_1 as ND_multiply_vdfC }; - export namespace ND_multiply_vdfF_1 { - let node_839: string; - export { node_839 as node }; - export namespace inputs_839 { - let in1_230: string; - export { in1_230 as in1 }; - let in2_230: string; - export { in2_230 as in2 }; - } - export { inputs_839 as inputs }; - export namespace outputs_839 { - let out_819: string; - export { out_819 as out }; - } - export { outputs_839 as outputs }; - } - export { ND_multiply_vdfF_1 as ND_multiply_vdfF }; - export namespace ND_roughness_anisotropy_1 { - let node_840: string; - export { node_840 as node }; - export namespace inputs_840 { - let roughness_27: string; - export { roughness_27 as roughness }; - let anisotropy_11: string; - export { anisotropy_11 as anisotropy }; - } - export { inputs_840 as inputs }; - export namespace outputs_840 { - let out_820: string; - export { out_820 as out }; - } - export { outputs_840 as outputs }; - } - export { ND_roughness_anisotropy_1 as ND_roughness_anisotropy }; - export namespace ND_roughness_dual_1 { - let node_841: string; - export { node_841 as node }; - export namespace inputs_841 { - let roughness_28: string; - export { roughness_28 as roughness }; - } - export { inputs_841 as inputs }; - export namespace outputs_841 { - let out_821: string; - export { out_821 as out }; - } - export { outputs_841 as outputs }; - } - export { ND_roughness_dual_1 as ND_roughness_dual }; - export namespace ND_glossiness_anisotropy_1 { - let node_842: string; - export { node_842 as node }; - export namespace inputs_842 { - let glossiness_1: string; - export { glossiness_1 as glossiness }; - let anisotropy_12: string; - export { anisotropy_12 as anisotropy }; - } - export { inputs_842 as inputs }; - export namespace outputs_842 { - let out_822: string; - export { out_822 as out }; - } - export { outputs_842 as outputs }; - } - export { ND_glossiness_anisotropy_1 as ND_glossiness_anisotropy }; - export namespace ND_blackbody_1 { - let node_843: string; - export { node_843 as node }; - export namespace inputs_843 { - let temperature_1: string; - export { temperature_1 as temperature }; - } - export { inputs_843 as inputs }; - export namespace outputs_843 { - let out_823: string; - export { out_823 as out }; - } - export { outputs_843 as outputs }; - } - export { ND_blackbody_1 as ND_blackbody }; - export namespace ND_artistic_ior_1 { - let node_844: string; - export { node_844 as node }; - export namespace inputs_844 { - let reflectivity_4: string; - export { reflectivity_4 as reflectivity }; - let edge_color_1: string; - export { edge_color_1 as edge_color }; - } - export { inputs_844 as inputs }; - export namespace outputs_844 { - let ior_11: string; - export { ior_11 as ior }; - let extinction_4: string; - export { extinction_4 as extinction }; - } - export { outputs_844 as outputs }; - } - export { ND_artistic_ior_1 as ND_artistic_ior }; - export namespace ND_deon_hair_absorption_from_melanin_1 { - let node_845: string; - export { node_845 as node }; - export namespace inputs_845 { - let melanin_concentration_1: string; - export { melanin_concentration_1 as melanin_concentration }; - let melanin_redness_1: string; - export { melanin_redness_1 as melanin_redness }; - let eumelanin_color_1: string; - export { eumelanin_color_1 as eumelanin_color }; - let pheomelanin_color_1: string; - export { pheomelanin_color_1 as pheomelanin_color }; - } - export { inputs_845 as inputs }; - export namespace outputs_845 { - let absorption_6: string; - export { absorption_6 as absorption }; - } - export { outputs_845 as outputs }; - } - export { ND_deon_hair_absorption_from_melanin_1 as ND_deon_hair_absorption_from_melanin }; - export namespace ND_chiang_hair_absorption_from_color_1 { - let node_846: string; - export { node_846 as node }; - export namespace inputs_846 { - let color_26: string; - export { color_26 as color }; - let azimuthal_roughness_1: string; - export { azimuthal_roughness_1 as azimuthal_roughness }; - } - export { inputs_846 as inputs }; - export namespace outputs_846 { - let absorption_7: string; - export { absorption_7 as absorption }; - } - export { outputs_846 as outputs }; - } - export { ND_chiang_hair_absorption_from_color_1 as ND_chiang_hair_absorption_from_color }; - export namespace ND_chiang_hair_roughness_1 { - let node_847: string; - export { node_847 as node }; - export namespace inputs_847 { - let longitudinal_1: string; - export { longitudinal_1 as longitudinal }; - let azimuthal_1: string; - export { azimuthal_1 as azimuthal }; - let scale_TT_1: string; - export { scale_TT_1 as scale_TT }; - let scale_TRT_1: string; - export { scale_TRT_1 as scale_TRT }; - } - export { inputs_847 as inputs }; - export namespace outputs_847 { - let roughness_R_3: string; - export { roughness_R_3 as roughness_R }; - let roughness_TT_3: string; - export { roughness_TT_3 as roughness_TT }; - let roughness_TRT_3: string; - export { roughness_TRT_3 as roughness_TRT }; - } - export { outputs_847 as outputs }; - } - export { ND_chiang_hair_roughness_1 as ND_chiang_hair_roughness }; - export namespace ND_disney_principled_1 { - let node_848: string; - export { node_848 as node }; - export namespace inputs_848 { - let baseColor_1: string; - export { baseColor_1 as baseColor }; - let metallic_3: string; - export { metallic_3 as metallic }; - let roughness_29: string; - export { roughness_29 as roughness }; - let anisotropic_1: string; - export { anisotropic_1 as anisotropic }; - let specular_6: string; - export { specular_6 as specular }; - let specularTint_1: string; - export { specularTint_1 as specularTint }; - let sheen_4: string; - export { sheen_4 as sheen }; - let sheenTint_1: string; - export { sheenTint_1 as sheenTint }; - let clearcoat_3: string; - export { clearcoat_3 as clearcoat }; - let clearcoatGloss_1: string; - export { clearcoatGloss_1 as clearcoatGloss }; - let specTrans_1: string; - export { specTrans_1 as specTrans }; - let ior_12: string; - export { ior_12 as ior }; - let subsurface_4: string; - export { subsurface_4 as subsurface }; - let subsurfaceDistance_1: string; - export { subsurfaceDistance_1 as subsurfaceDistance }; - } - export { inputs_848 as inputs }; - export namespace outputs_848 { - let out_824: string; - export { out_824 as out }; - } - export { outputs_848 as outputs }; - } - export { ND_disney_principled_1 as ND_disney_principled }; - export namespace ND_open_pbr_surface_surfaceshader_1 { - let node_849: string; - export { node_849 as node }; - export namespace inputs_849 { - let base_weight_2: string; - export { base_weight_2 as base_weight }; - let base_color_8: string; - export { base_color_8 as base_color }; - let base_diffuse_roughness_2: string; - export { base_diffuse_roughness_2 as base_diffuse_roughness }; - let base_metalness_2: string; - export { base_metalness_2 as base_metalness }; - let specular_weight_2: string; - export { specular_weight_2 as specular_weight }; - let specular_color_7: string; - export { specular_color_7 as specular_color }; - let specular_roughness_6: string; - export { specular_roughness_6 as specular_roughness }; - let specular_ior_2: string; - export { specular_ior_2 as specular_ior }; - let specular_roughness_anisotropy_2: string; - export { specular_roughness_anisotropy_2 as specular_roughness_anisotropy }; - let transmission_weight_2: string; - export { transmission_weight_2 as transmission_weight }; - let transmission_color_6: string; - export { transmission_color_6 as transmission_color }; - let transmission_depth_5: string; - export { transmission_depth_5 as transmission_depth }; - let transmission_scatter_4: string; - export { transmission_scatter_4 as transmission_scatter }; - let transmission_scatter_anisotropy_4: string; - export { transmission_scatter_anisotropy_4 as transmission_scatter_anisotropy }; - let transmission_dispersion_scale_2: string; - export { transmission_dispersion_scale_2 as transmission_dispersion_scale }; - let transmission_dispersion_abbe_number_1: string; - export { transmission_dispersion_abbe_number_1 as transmission_dispersion_abbe_number }; - let subsurface_weight_2: string; - export { subsurface_weight_2 as subsurface_weight }; - let subsurface_color_5: string; - export { subsurface_color_5 as subsurface_color }; - let subsurface_radius_4: string; - export { subsurface_radius_4 as subsurface_radius }; - let subsurface_radius_scale_2: string; - export { subsurface_radius_scale_2 as subsurface_radius_scale }; - let subsurface_scatter_anisotropy_2: string; - export { subsurface_scatter_anisotropy_2 as subsurface_scatter_anisotropy }; - let fuzz_weight_2: string; - export { fuzz_weight_2 as fuzz_weight }; - let fuzz_color_2: string; - export { fuzz_color_2 as fuzz_color }; - let fuzz_roughness_2: string; - export { fuzz_roughness_2 as fuzz_roughness }; - let coat_weight_2: string; - export { coat_weight_2 as coat_weight }; - let coat_color_6: string; - export { coat_color_6 as coat_color }; - let coat_roughness_6: string; - export { coat_roughness_6 as coat_roughness }; - let coat_roughness_anisotropy_2: string; - export { coat_roughness_anisotropy_2 as coat_roughness_anisotropy }; - let coat_ior_2: string; - export { coat_ior_2 as coat_ior }; - let coat_darkening_2: string; - export { coat_darkening_2 as coat_darkening }; - let thin_film_weight_2: string; - export { thin_film_weight_2 as thin_film_weight }; - let thin_film_thickness_4: string; - export { thin_film_thickness_4 as thin_film_thickness }; - let thin_film_ior_2: string; - export { thin_film_ior_2 as thin_film_ior }; - let emission_luminance_2: string; - export { emission_luminance_2 as emission_luminance }; - let emission_color_7: string; - export { emission_color_7 as emission_color }; - let geometry_opacity_2: string; - export { geometry_opacity_2 as geometry_opacity }; - let geometry_thin_walled_2: string; - export { geometry_thin_walled_2 as geometry_thin_walled }; - let geometry_normal_1: string; - export { geometry_normal_1 as geometry_normal }; - let geometry_coat_normal_1: string; - export { geometry_coat_normal_1 as geometry_coat_normal }; - let geometry_tangent_1: string; - export { geometry_tangent_1 as geometry_tangent }; - let geometry_coat_tangent_1: string; - export { geometry_coat_tangent_1 as geometry_coat_tangent }; - } - export { inputs_849 as inputs }; - export namespace outputs_849 { - let out_825: string; - export { out_825 as out }; - } - export { outputs_849 as outputs }; - } - export { ND_open_pbr_surface_surfaceshader_1 as ND_open_pbr_surface_surfaceshader }; - export namespace ND_open_pbr_anisotropy_1 { - let node_850: string; - export { node_850 as node }; - export namespace inputs_850 { - let roughness_30: string; - export { roughness_30 as roughness }; - let anisotropy_13: string; - export { anisotropy_13 as anisotropy }; - } - export { inputs_850 as inputs }; - export namespace outputs_850 { - let out_826: string; - export { out_826 as out }; - } - export { outputs_850 as outputs }; - } - export { ND_open_pbr_anisotropy_1 as ND_open_pbr_anisotropy }; - export namespace ND_UsdPreviewSurface_surfaceshader_1 { - let node_851: string; - export { node_851 as node }; - export namespace inputs_851 { - let diffuseColor_1: string; - export { diffuseColor_1 as diffuseColor }; - let emissiveColor_1: string; - export { emissiveColor_1 as emissiveColor }; - let useSpecularWorkflow_1: string; - export { useSpecularWorkflow_1 as useSpecularWorkflow }; - let specularColor_1: string; - export { specularColor_1 as specularColor }; - let metallic_4: string; - export { metallic_4 as metallic }; - let roughness_31: string; - export { roughness_31 as roughness }; - let clearcoat_4: string; - export { clearcoat_4 as clearcoat }; - let clearcoatRoughness_1: string; - export { clearcoatRoughness_1 as clearcoatRoughness }; - let opacity_8: string; - export { opacity_8 as opacity }; - let opacityMode_1: string; - export { opacityMode_1 as opacityMode }; - let opacityThreshold_1: string; - export { opacityThreshold_1 as opacityThreshold }; - let ior_13: string; - export { ior_13 as ior }; - let normal_49: string; - export { normal_49 as normal }; - let displacement_5: string; - export { displacement_5 as displacement }; - let occlusion_2: string; - export { occlusion_2 as occlusion }; - } - export { inputs_851 as inputs }; - export namespace outputs_851 { - let out_827: string; - export { out_827 as out }; - } - export { outputs_851 as outputs }; - } - export { ND_UsdPreviewSurface_surfaceshader_1 as ND_UsdPreviewSurface_surfaceshader }; - export namespace ND_UsdUVTexture_23_1 { - let node_852: string; - export { node_852 as node }; - export namespace inputs_852 { - let file_27: string; - export { file_27 as file }; - let st_1: string; - export { st_1 as st }; - let wrapS_1: string; - export { wrapS_1 as wrapS }; - let wrapT_1: string; - export { wrapT_1 as wrapT }; - let fallback_9: string; - export { fallback_9 as fallback }; - let scale_22: string; - export { scale_22 as scale }; - let bias_1: string; - export { bias_1 as bias }; - } - export { inputs_852 as inputs }; - export namespace outputs_852 { - let r_2: string; - export { r_2 as r }; - let g_2: string; - export { g_2 as g }; - let b_2: string; - export { b_2 as b }; - let a_2: string; - export { a_2 as a }; - let rgb_2: string; - export { rgb_2 as rgb }; - } - export { outputs_852 as outputs }; - } - export { ND_UsdUVTexture_23_1 as ND_UsdUVTexture_23 }; - export namespace ND_UsdUVTexture_1 { - let node_853: string; - export { node_853 as node }; - export namespace inputs_853 { - let file_28: string; - export { file_28 as file }; - let st_2: string; - export { st_2 as st }; - let wrapS_2: string; - export { wrapS_2 as wrapS }; - let wrapT_2: string; - export { wrapT_2 as wrapT }; - let fallback_10: string; - export { fallback_10 as fallback }; - let scale_23: string; - export { scale_23 as scale }; - let bias_2: string; - export { bias_2 as bias }; - } - export { inputs_853 as inputs }; - export namespace outputs_853 { - let r_3: string; - export { r_3 as r }; - let g_3: string; - export { g_3 as g }; - let b_3: string; - export { b_3 as b }; - let a_3: string; - export { a_3 as a }; - let rgb_3: string; - export { rgb_3 as rgb }; - let rgba_1: string; - export { rgba_1 as rgba }; - } - export { outputs_853 as outputs }; - } - export { ND_UsdUVTexture_1 as ND_UsdUVTexture }; - export namespace ND_UsdPrimvarReader_integer_1 { - let node_854: string; - export { node_854 as node }; - export namespace inputs_854 { - let varname_8: string; - export { varname_8 as varname }; - let fallback_11: string; - export { fallback_11 as fallback }; - } - export { inputs_854 as inputs }; - export namespace outputs_854 { - let out_828: string; - export { out_828 as out }; - } - export { outputs_854 as outputs }; - } - export { ND_UsdPrimvarReader_integer_1 as ND_UsdPrimvarReader_integer }; - export namespace ND_UsdPrimvarReader_boolean_1 { - let node_855: string; - export { node_855 as node }; - export namespace inputs_855 { - let varname_9: string; - export { varname_9 as varname }; - let fallback_12: string; - export { fallback_12 as fallback }; - } - export { inputs_855 as inputs }; - export namespace outputs_855 { - let out_829: string; - export { out_829 as out }; - } - export { outputs_855 as outputs }; - } - export { ND_UsdPrimvarReader_boolean_1 as ND_UsdPrimvarReader_boolean }; - export namespace ND_UsdPrimvarReader_string_1 { - let node_856: string; - export { node_856 as node }; - export namespace inputs_856 { - let varname_10: string; - export { varname_10 as varname }; - let fallback_13: string; - export { fallback_13 as fallback }; - } - export { inputs_856 as inputs }; - export namespace outputs_856 { - let out_830: string; - export { out_830 as out }; - } - export { outputs_856 as outputs }; - } - export { ND_UsdPrimvarReader_string_1 as ND_UsdPrimvarReader_string }; - export namespace ND_UsdPrimvarReader_filename_1 { - let node_857: string; - export { node_857 as node }; - export namespace inputs_857 { - let varname_11: string; - export { varname_11 as varname }; - let fallback_14: string; - export { fallback_14 as fallback }; - } - export { inputs_857 as inputs }; - export namespace outputs_857 { - let out_831: string; - export { out_831 as out }; - } - export { outputs_857 as outputs }; - } - export { ND_UsdPrimvarReader_filename_1 as ND_UsdPrimvarReader_filename }; - export namespace ND_UsdPrimvarReader_float_1 { - let node_858: string; - export { node_858 as node }; - export namespace inputs_858 { - let varname_12: string; - export { varname_12 as varname }; - let fallback_15: string; - export { fallback_15 as fallback }; - } - export { inputs_858 as inputs }; - export namespace outputs_858 { - let out_832: string; - export { out_832 as out }; - } - export { outputs_858 as outputs }; - } - export { ND_UsdPrimvarReader_float_1 as ND_UsdPrimvarReader_float }; - export namespace ND_UsdPrimvarReader_vector2_1 { - let node_859: string; - export { node_859 as node }; - export namespace inputs_859 { - let varname_13: string; - export { varname_13 as varname }; - let fallback_16: string; - export { fallback_16 as fallback }; - } - export { inputs_859 as inputs }; - export namespace outputs_859 { - let out_833: string; - export { out_833 as out }; - } - export { outputs_859 as outputs }; - } - export { ND_UsdPrimvarReader_vector2_1 as ND_UsdPrimvarReader_vector2 }; - export namespace ND_UsdPrimvarReader_vector3_1 { - let node_860: string; - export { node_860 as node }; - export namespace inputs_860 { - let varname_14: string; - export { varname_14 as varname }; - let fallback_17: string; - export { fallback_17 as fallback }; - } - export { inputs_860 as inputs }; - export namespace outputs_860 { - let out_834: string; - export { out_834 as out }; - } - export { outputs_860 as outputs }; - } - export { ND_UsdPrimvarReader_vector3_1 as ND_UsdPrimvarReader_vector3 }; - export namespace ND_UsdPrimvarReader_vector4_1 { - let node_861: string; - export { node_861 as node }; - export namespace inputs_861 { - let varname_15: string; - export { varname_15 as varname }; - let fallback_18: string; - export { fallback_18 as fallback }; - } - export { inputs_861 as inputs }; - export namespace outputs_861 { - let out_835: string; - export { out_835 as out }; - } - export { outputs_861 as outputs }; - } - export { ND_UsdPrimvarReader_vector4_1 as ND_UsdPrimvarReader_vector4 }; - export namespace ND_UsdTransform2d_1 { - let node_862: string; - export { node_862 as node }; - export namespace inputs_862 { - let _in_291: string; - export { _in_291 as in }; - let rotation_6: string; - export { rotation_6 as rotation }; - let scale_24: string; - export { scale_24 as scale }; - let translation_1: string; - export { translation_1 as translation }; - } - export { inputs_862 as inputs }; - export namespace outputs_862 { - let out_836: string; - export { out_836 as out }; - } - export { outputs_862 as outputs }; - } - export { ND_UsdTransform2d_1 as ND_UsdTransform2d }; - export namespace ND_standard_surface_surfaceshader_100_1 { - let node_863: string; - export { node_863 as node }; - export namespace inputs_863 { - let base_11: string; - export { base_11 as base }; - let base_color_9: string; - export { base_color_9 as base_color }; - let diffuse_roughness_2: string; - export { diffuse_roughness_2 as diffuse_roughness }; - let metalness_4: string; - export { metalness_4 as metalness }; - let specular_7: string; - export { specular_7 as specular }; - let specular_color_8: string; - export { specular_color_8 as specular_color }; - let specular_roughness_7: string; - export { specular_roughness_7 as specular_roughness }; - let specular_IOR_4: string; - export { specular_IOR_4 as specular_IOR }; - let specular_anisotropy_3: string; - export { specular_anisotropy_3 as specular_anisotropy }; - let specular_rotation_2: string; - export { specular_rotation_2 as specular_rotation }; - let transmission_5: string; - export { transmission_5 as transmission }; - let transmission_color_7: string; - export { transmission_color_7 as transmission_color }; - let transmission_depth_6: string; - export { transmission_depth_6 as transmission_depth }; - let transmission_scatter_5: string; - export { transmission_scatter_5 as transmission_scatter }; - let transmission_scatter_anisotropy_5: string; - export { transmission_scatter_anisotropy_5 as transmission_scatter_anisotropy }; - let transmission_dispersion_3: string; - export { transmission_dispersion_3 as transmission_dispersion }; - let transmission_extra_roughness_1: string; - export { transmission_extra_roughness_1 as transmission_extra_roughness }; - let subsurface_5: string; - export { subsurface_5 as subsurface }; - let subsurface_color_6: string; - export { subsurface_color_6 as subsurface_color }; - let subsurface_radius_5: string; - export { subsurface_radius_5 as subsurface_radius }; - let subsurface_scale_2: string; - export { subsurface_scale_2 as subsurface_scale }; - let subsurface_anisotropy_2: string; - export { subsurface_anisotropy_2 as subsurface_anisotropy }; - let sheen_5: string; - export { sheen_5 as sheen }; - let sheen_color_4: string; - export { sheen_color_4 as sheen_color }; - let sheen_roughness_4: string; - export { sheen_roughness_4 as sheen_roughness }; - let coat_4: string; - export { coat_4 as coat }; - let coat_color_7: string; - export { coat_color_7 as coat_color }; - let coat_roughness_7: string; - export { coat_roughness_7 as coat_roughness }; - let coat_anisotropy_2: string; - export { coat_anisotropy_2 as coat_anisotropy }; - let coat_rotation_1: string; - export { coat_rotation_1 as coat_rotation }; - let coat_IOR_2: string; - export { coat_IOR_2 as coat_IOR }; - let coat_normal_1: string; - export { coat_normal_1 as coat_normal }; - let coat_affect_color_1: string; - export { coat_affect_color_1 as coat_affect_color }; - let coat_affect_roughness_2: string; - export { coat_affect_roughness_2 as coat_affect_roughness }; - let thin_film_thickness_5: string; - export { thin_film_thickness_5 as thin_film_thickness }; - let thin_film_IOR_2: string; - export { thin_film_IOR_2 as thin_film_IOR }; - let emission_5: string; - export { emission_5 as emission }; - let emission_color_8: string; - export { emission_color_8 as emission_color }; - let opacity_9: string; - export { opacity_9 as opacity }; - let thin_walled_5: string; - export { thin_walled_5 as thin_walled }; - let normal_50: string; - export { normal_50 as normal }; - let tangent_15: string; - export { tangent_15 as tangent }; - } - export { inputs_863 as inputs }; - export namespace outputs_863 { - let out_837: string; - export { out_837 as out }; - } - export { outputs_863 as outputs }; - } - export { ND_standard_surface_surfaceshader_100_1 as ND_standard_surface_surfaceshader_100 }; - export namespace ND_standard_surface_surfaceshader_1 { - let node_864: string; - export { node_864 as node }; - export namespace inputs_864 { - let base_12: string; - export { base_12 as base }; - let base_color_10: string; - export { base_color_10 as base_color }; - let diffuse_roughness_3: string; - export { diffuse_roughness_3 as diffuse_roughness }; - let metalness_5: string; - export { metalness_5 as metalness }; - let specular_8: string; - export { specular_8 as specular }; - let specular_color_9: string; - export { specular_color_9 as specular_color }; - let specular_roughness_8: string; - export { specular_roughness_8 as specular_roughness }; - let specular_IOR_5: string; - export { specular_IOR_5 as specular_IOR }; - let specular_anisotropy_4: string; - export { specular_anisotropy_4 as specular_anisotropy }; - let specular_rotation_3: string; - export { specular_rotation_3 as specular_rotation }; - let transmission_6: string; - export { transmission_6 as transmission }; - let transmission_color_8: string; - export { transmission_color_8 as transmission_color }; - let transmission_depth_7: string; - export { transmission_depth_7 as transmission_depth }; - let transmission_scatter_6: string; - export { transmission_scatter_6 as transmission_scatter }; - let transmission_scatter_anisotropy_6: string; - export { transmission_scatter_anisotropy_6 as transmission_scatter_anisotropy }; - let transmission_dispersion_4: string; - export { transmission_dispersion_4 as transmission_dispersion }; - let transmission_extra_roughness_2: string; - export { transmission_extra_roughness_2 as transmission_extra_roughness }; - let subsurface_6: string; - export { subsurface_6 as subsurface }; - let subsurface_color_7: string; - export { subsurface_color_7 as subsurface_color }; - let subsurface_radius_6: string; - export { subsurface_radius_6 as subsurface_radius }; - let subsurface_scale_3: string; - export { subsurface_scale_3 as subsurface_scale }; - let subsurface_anisotropy_3: string; - export { subsurface_anisotropy_3 as subsurface_anisotropy }; - let sheen_6: string; - export { sheen_6 as sheen }; - let sheen_color_5: string; - export { sheen_color_5 as sheen_color }; - let sheen_roughness_5: string; - export { sheen_roughness_5 as sheen_roughness }; - let coat_5: string; - export { coat_5 as coat }; - let coat_color_8: string; - export { coat_color_8 as coat_color }; - let coat_roughness_8: string; - export { coat_roughness_8 as coat_roughness }; - let coat_anisotropy_3: string; - export { coat_anisotropy_3 as coat_anisotropy }; - let coat_rotation_2: string; - export { coat_rotation_2 as coat_rotation }; - let coat_IOR_3: string; - export { coat_IOR_3 as coat_IOR }; - let coat_normal_2: string; - export { coat_normal_2 as coat_normal }; - let coat_affect_color_2: string; - export { coat_affect_color_2 as coat_affect_color }; - let coat_affect_roughness_3: string; - export { coat_affect_roughness_3 as coat_affect_roughness }; - let thin_film_thickness_6: string; - export { thin_film_thickness_6 as thin_film_thickness }; - let thin_film_IOR_3: string; - export { thin_film_IOR_3 as thin_film_IOR }; - let emission_6: string; - export { emission_6 as emission }; - let emission_color_9: string; - export { emission_color_9 as emission_color }; - let opacity_10: string; - export { opacity_10 as opacity }; - let thin_walled_6: string; - export { thin_walled_6 as thin_walled }; - let normal_51: string; - export { normal_51 as normal }; - let tangent_16: string; - export { tangent_16 as tangent }; - } - export { inputs_864 as inputs }; - export namespace outputs_864 { - let out_838: string; - export { out_838 as out }; - } - export { outputs_864 as outputs }; - } - export { ND_standard_surface_surfaceshader_1 as ND_standard_surface_surfaceshader }; - export namespace ND_gltf_pbr_surfaceshader_1 { - let node_865: string; - export { node_865 as node }; - export namespace inputs_865 { - let base_color_11: string; - export { base_color_11 as base_color }; - let metallic_5: string; - export { metallic_5 as metallic }; - let roughness_32: string; - export { roughness_32 as roughness }; - let normal_52: string; - export { normal_52 as normal }; - let tangent_17: string; - export { tangent_17 as tangent }; - let occlusion_3: string; - export { occlusion_3 as occlusion }; - let transmission_7: string; - export { transmission_7 as transmission }; - let specular_9: string; - export { specular_9 as specular }; - let specular_color_10: string; - export { specular_color_10 as specular_color }; - let ior_14: string; - export { ior_14 as ior }; - let alpha_1: string; - export { alpha_1 as alpha }; - let alpha_mode_1: string; - export { alpha_mode_1 as alpha_mode }; - let alpha_cutoff_1: string; - export { alpha_cutoff_1 as alpha_cutoff }; - let iridescence_1: string; - export { iridescence_1 as iridescence }; - let iridescence_ior_1: string; - export { iridescence_ior_1 as iridescence_ior }; - let iridescence_thickness_1: string; - export { iridescence_thickness_1 as iridescence_thickness }; - let sheen_color_6: string; - export { sheen_color_6 as sheen_color }; - let sheen_roughness_6: string; - export { sheen_roughness_6 as sheen_roughness }; - let clearcoat_5: string; - export { clearcoat_5 as clearcoat }; - let clearcoat_roughness_1: string; - export { clearcoat_roughness_1 as clearcoat_roughness }; - let clearcoat_normal_1: string; - export { clearcoat_normal_1 as clearcoat_normal }; - let emissive_1: string; - export { emissive_1 as emissive }; - let emissive_strength_1: string; - export { emissive_strength_1 as emissive_strength }; - let thickness_3: string; - export { thickness_3 as thickness }; - let attenuation_distance_1: string; - export { attenuation_distance_1 as attenuation_distance }; - let attenuation_color_1: string; - export { attenuation_color_1 as attenuation_color }; - let anisotropy_strength_2: string; - export { anisotropy_strength_2 as anisotropy_strength }; - let anisotropy_rotation_2: string; - export { anisotropy_rotation_2 as anisotropy_rotation }; - let dispersion_1: string; - export { dispersion_1 as dispersion }; - } - export { inputs_865 as inputs }; - export namespace outputs_865 { - let out_839: string; - export { out_839 as out }; - } - export { outputs_865 as outputs }; - } - export { ND_gltf_pbr_surfaceshader_1 as ND_gltf_pbr_surfaceshader }; - export namespace ND_gltf_colorimage_1 { - let node_866: string; - export { node_866 as node }; - export namespace inputs_866 { - let file_29: string; - export { file_29 as file }; - let _default_40: string; - export { _default_40 as default }; - let texcoord_94: string; - export { texcoord_94 as texcoord }; - let pivot_42: string; - export { pivot_42 as pivot }; - let scale_25: string; - export { scale_25 as scale }; - let rotate_9: string; - export { rotate_9 as rotate }; - let offset_14: string; - export { offset_14 as offset }; - let operationorder_8: string; - export { operationorder_8 as operationorder }; - let uaddressmode_14: string; - export { uaddressmode_14 as uaddressmode }; - let vaddressmode_14: string; - export { vaddressmode_14 as vaddressmode }; - let filtertype_32: string; - export { filtertype_32 as filtertype }; - let color_27: string; - export { color_27 as color }; - let geomcolor_1: string; - export { geomcolor_1 as geomcolor }; - } - export { inputs_866 as inputs }; - export namespace outputs_866 { - let outcolor_1: string; - export { outcolor_1 as outcolor }; - let outa_2: string; - export { outa_2 as outa }; - } - export { outputs_866 as outputs }; - } - export { ND_gltf_colorimage_1 as ND_gltf_colorimage }; - export namespace ND_gltf_image_color3_color3_1_0_1 { - let node_867: string; - export { node_867 as node }; - export namespace inputs_867 { - let file_30: string; - export { file_30 as file }; - let factor_3: string; - export { factor_3 as factor }; - let _default_41: string; - export { _default_41 as default }; - let texcoord_95: string; - export { texcoord_95 as texcoord }; - let pivot_43: string; - export { pivot_43 as pivot }; - let scale_26: string; - export { scale_26 as scale }; - let rotate_10: string; - export { rotate_10 as rotate }; - let offset_15: string; - export { offset_15 as offset }; - let operationorder_9: string; - export { operationorder_9 as operationorder }; - let uaddressmode_15: string; - export { uaddressmode_15 as uaddressmode }; - let vaddressmode_15: string; - export { vaddressmode_15 as vaddressmode }; - let filtertype_33: string; - export { filtertype_33 as filtertype }; - } - export { inputs_867 as inputs }; - export namespace outputs_867 { - let out_840: string; - export { out_840 as out }; - } - export { outputs_867 as outputs }; - } - export { ND_gltf_image_color3_color3_1_0_1 as ND_gltf_image_color3_color3_1_0 }; - export namespace ND_gltf_image_color4_color4_1_0_1 { - let node_868: string; - export { node_868 as node }; - export namespace inputs_868 { - let file_31: string; - export { file_31 as file }; - let factor_4: string; - export { factor_4 as factor }; - let _default_42: string; - export { _default_42 as default }; - let texcoord_96: string; - export { texcoord_96 as texcoord }; - let pivot_44: string; - export { pivot_44 as pivot }; - let scale_27: string; - export { scale_27 as scale }; - let rotate_11: string; - export { rotate_11 as rotate }; - let offset_16: string; - export { offset_16 as offset }; - let operationorder_10: string; - export { operationorder_10 as operationorder }; - let uaddressmode_16: string; - export { uaddressmode_16 as uaddressmode }; - let vaddressmode_16: string; - export { vaddressmode_16 as vaddressmode }; - let filtertype_34: string; - export { filtertype_34 as filtertype }; - } - export { inputs_868 as inputs }; - export namespace outputs_868 { - let out_841: string; - export { out_841 as out }; - } - export { outputs_868 as outputs }; - } - export { ND_gltf_image_color4_color4_1_0_1 as ND_gltf_image_color4_color4_1_0 }; - export namespace ND_gltf_image_float_float_1_0_1 { - let node_869: string; - export { node_869 as node }; - export namespace inputs_869 { - let file_32: string; - export { file_32 as file }; - let factor_5: string; - export { factor_5 as factor }; - let _default_43: string; - export { _default_43 as default }; - let texcoord_97: string; - export { texcoord_97 as texcoord }; - let pivot_45: string; - export { pivot_45 as pivot }; - let scale_28: string; - export { scale_28 as scale }; - let rotate_12: string; - export { rotate_12 as rotate }; - let offset_17: string; - export { offset_17 as offset }; - let operationorder_11: string; - export { operationorder_11 as operationorder }; - let uaddressmode_17: string; - export { uaddressmode_17 as uaddressmode }; - let vaddressmode_17: string; - export { vaddressmode_17 as vaddressmode }; - let filtertype_35: string; - export { filtertype_35 as filtertype }; - } - export { inputs_869 as inputs }; - export namespace outputs_869 { - let out_842: string; - export { out_842 as out }; - } - export { outputs_869 as outputs }; - } - export { ND_gltf_image_float_float_1_0_1 as ND_gltf_image_float_float_1_0 }; - export namespace ND_gltf_image_vector3_vector3_1_0_1 { - let node_870: string; - export { node_870 as node }; - export namespace inputs_870 { - let file_33: string; - export { file_33 as file }; - let _default_44: string; - export { _default_44 as default }; - let texcoord_98: string; - export { texcoord_98 as texcoord }; - let pivot_46: string; - export { pivot_46 as pivot }; - let scale_29: string; - export { scale_29 as scale }; - let rotate_13: string; - export { rotate_13 as rotate }; - let offset_18: string; - export { offset_18 as offset }; - let operationorder_12: string; - export { operationorder_12 as operationorder }; - let uaddressmode_18: string; - export { uaddressmode_18 as uaddressmode }; - let vaddressmode_18: string; - export { vaddressmode_18 as vaddressmode }; - let filtertype_36: string; - export { filtertype_36 as filtertype }; - } - export { inputs_870 as inputs }; - export namespace outputs_870 { - let out_843: string; - export { out_843 as out }; - } - export { outputs_870 as outputs }; - } - export { ND_gltf_image_vector3_vector3_1_0_1 as ND_gltf_image_vector3_vector3_1_0 }; - export namespace ND_gltf_normalmap_vector3_1_0_1 { - let node_871: string; - export { node_871 as node }; - export namespace inputs_871 { - let file_34: string; - export { file_34 as file }; - let _default_45: string; - export { _default_45 as default }; - let texcoord_99: string; - export { texcoord_99 as texcoord }; - let pivot_47: string; - export { pivot_47 as pivot }; - let scale_30: string; - export { scale_30 as scale }; - let rotate_14: string; - export { rotate_14 as rotate }; - let offset_19: string; - export { offset_19 as offset }; - let operationorder_13: string; - export { operationorder_13 as operationorder }; - let uaddressmode_19: string; - export { uaddressmode_19 as uaddressmode }; - let vaddressmode_19: string; - export { vaddressmode_19 as vaddressmode }; - let filtertype_37: string; - export { filtertype_37 as filtertype }; - } - export { inputs_871 as inputs }; - export namespace outputs_871 { - let out_844: string; - export { out_844 as out }; - } - export { outputs_871 as outputs }; - } - export { ND_gltf_normalmap_vector3_1_0_1 as ND_gltf_normalmap_vector3_1_0 }; - export namespace ND_gltf_iridescence_thickness_float_1_0_1 { - let node_872: string; - export { node_872 as node }; - export namespace inputs_872 { - let file_35: string; - export { file_35 as file }; - let _default_46: string; - export { _default_46 as default }; - let texcoord_100: string; - export { texcoord_100 as texcoord }; - let pivot_48: string; - export { pivot_48 as pivot }; - let scale_31: string; - export { scale_31 as scale }; - let rotate_15: string; - export { rotate_15 as rotate }; - let offset_20: string; - export { offset_20 as offset }; - let uaddressmode_20: string; - export { uaddressmode_20 as uaddressmode }; - let vaddressmode_20: string; - export { vaddressmode_20 as vaddressmode }; - let filtertype_38: string; - export { filtertype_38 as filtertype }; - let thicknessMin_1: string; - export { thicknessMin_1 as thicknessMin }; - let thicknessMax_1: string; - export { thicknessMax_1 as thicknessMax }; - } - export { inputs_872 as inputs }; - export namespace outputs_872 { - let out_845: string; - export { out_845 as out }; - } - export { outputs_872 as outputs }; - } - export { ND_gltf_iridescence_thickness_float_1_0_1 as ND_gltf_iridescence_thickness_float_1_0 }; - export namespace ND_gltf_anisotropy_image_1 { - let node_873: string; - export { node_873 as node }; - export namespace inputs_873 { - let file_36: string; - export { file_36 as file }; - let _default_47: string; - export { _default_47 as default }; - let texcoord_101: string; - export { texcoord_101 as texcoord }; - let pivot_49: string; - export { pivot_49 as pivot }; - let scale_32: string; - export { scale_32 as scale }; - let rotate_16: string; - export { rotate_16 as rotate }; - let offset_21: string; - export { offset_21 as offset }; - let operationorder_14: string; - export { operationorder_14 as operationorder }; - let uaddressmode_21: string; - export { uaddressmode_21 as uaddressmode }; - let vaddressmode_21: string; - export { vaddressmode_21 as vaddressmode }; - let filtertype_39: string; - export { filtertype_39 as filtertype }; - let anisotropy_strength_3: string; - export { anisotropy_strength_3 as anisotropy_strength }; - let anisotropy_rotation_3: string; - export { anisotropy_rotation_3 as anisotropy_rotation }; - } - export { inputs_873 as inputs }; - export namespace outputs_873 { - let anisotropy_strength_out_2: string; - export { anisotropy_strength_out_2 as anisotropy_strength_out }; - let anisotropy_rotation_out_2: string; - export { anisotropy_rotation_out_2 as anisotropy_rotation_out }; - } - export { outputs_873 as outputs }; - } - export { ND_gltf_anisotropy_image_1 as ND_gltf_anisotropy_image }; - export namespace ND_viewdirection_vector3_1 { - let node_874: string; - export { node_874 as node }; - export namespace inputs_874 { - let space_5: string; - export { space_5 as space }; - } - export { inputs_874 as inputs }; - export namespace outputs_874 { - let out_846: string; - export { out_846 as out }; - } - export { outputs_874 as outputs }; - } - export { ND_viewdirection_vector3_1 as ND_viewdirection_vector3 }; - export namespace ND_facingratio_float_1 { - let node_875: string; - export { node_875 as node }; - export namespace inputs_875 { - let viewdirection_1: string; - export { viewdirection_1 as viewdirection }; - let normal_53: string; - export { normal_53 as normal }; - let faceforward_1: string; - export { faceforward_1 as faceforward }; - let invert_1: string; - export { invert_1 as invert }; - } - export { inputs_875 as inputs }; - export namespace outputs_875 { - let out_847: string; - export { out_847 as out }; - } - export { outputs_875 as outputs }; - } - export { ND_facingratio_float_1 as ND_facingratio_float }; - export namespace ND_gooch_shade_1 { - let node_876: string; - export { node_876 as node }; - export namespace inputs_876 { - let warm_color_1: string; - export { warm_color_1 as warm_color }; - let cool_color_1: string; - export { cool_color_1 as cool_color }; - let specular_intensity_1: string; - export { specular_intensity_1 as specular_intensity }; - let shininess_1: string; - export { shininess_1 as shininess }; - let light_direction_1: string; - export { light_direction_1 as light_direction }; - } - export { inputs_876 as inputs }; - export namespace outputs_876 { - let out_848: string; - export { out_848 as out }; - } - export { outputs_876 as outputs }; - } - export { ND_gooch_shade_1 as ND_gooch_shade }; - export namespace ND_g18_rec709_to_lin_rec709_color3_1 { - let node_877: string; - export { node_877 as node }; - export namespace inputs_877 { - let _in_292: string; - export { _in_292 as in }; - } - export { inputs_877 as inputs }; - export namespace outputs_877 { - let out_849: string; - export { out_849 as out }; - } - export { outputs_877 as outputs }; - } - export { ND_g18_rec709_to_lin_rec709_color3_1 as ND_g18_rec709_to_lin_rec709_color3 }; - export namespace ND_g18_rec709_to_lin_rec709_color4_1 { - let node_878: string; - export { node_878 as node }; - export namespace inputs_878 { - let _in_293: string; - export { _in_293 as in }; - } - export { inputs_878 as inputs }; - export namespace outputs_878 { - let out_850: string; - export { out_850 as out }; - } - export { outputs_878 as outputs }; - } - export { ND_g18_rec709_to_lin_rec709_color4_1 as ND_g18_rec709_to_lin_rec709_color4 }; - export namespace ND_g22_rec709_to_lin_rec709_color3_1 { - let node_879: string; - export { node_879 as node }; - export namespace inputs_879 { - let _in_294: string; - export { _in_294 as in }; - } - export { inputs_879 as inputs }; - export namespace outputs_879 { - let out_851: string; - export { out_851 as out }; - } - export { outputs_879 as outputs }; - } - export { ND_g22_rec709_to_lin_rec709_color3_1 as ND_g22_rec709_to_lin_rec709_color3 }; - export namespace ND_g22_rec709_to_lin_rec709_color4_1 { - let node_880: string; - export { node_880 as node }; - export namespace inputs_880 { - let _in_295: string; - export { _in_295 as in }; - } - export { inputs_880 as inputs }; - export namespace outputs_880 { - let out_852: string; - export { out_852 as out }; - } - export { outputs_880 as outputs }; - } - export { ND_g22_rec709_to_lin_rec709_color4_1 as ND_g22_rec709_to_lin_rec709_color4 }; - export namespace ND_rec709_display_to_lin_rec709_color3_1 { - let node_881: string; - export { node_881 as node }; - export namespace inputs_881 { - let _in_296: string; - export { _in_296 as in }; - } - export { inputs_881 as inputs }; - export namespace outputs_881 { - let out_853: string; - export { out_853 as out }; - } - export { outputs_881 as outputs }; - } - export { ND_rec709_display_to_lin_rec709_color3_1 as ND_rec709_display_to_lin_rec709_color3 }; - export namespace ND_rec709_display_to_lin_rec709_color4_1 { - let node_882: string; - export { node_882 as node }; - export namespace inputs_882 { - let _in_297: string; - export { _in_297 as in }; - } - export { inputs_882 as inputs }; - export namespace outputs_882 { - let out_854: string; - export { out_854 as out }; - } - export { outputs_882 as outputs }; - } - export { ND_rec709_display_to_lin_rec709_color4_1 as ND_rec709_display_to_lin_rec709_color4 }; - export namespace ND_acescg_to_lin_rec709_color3_1 { - let node_883: string; - export { node_883 as node }; - export namespace inputs_883 { - let _in_298: string; - export { _in_298 as in }; - } - export { inputs_883 as inputs }; - export namespace outputs_883 { - let out_855: string; - export { out_855 as out }; - } - export { outputs_883 as outputs }; - } - export { ND_acescg_to_lin_rec709_color3_1 as ND_acescg_to_lin_rec709_color3 }; - export namespace ND_acescg_to_lin_rec709_color4_1 { - let node_884: string; - export { node_884 as node }; - export namespace inputs_884 { - let _in_299: string; - export { _in_299 as in }; - } - export { inputs_884 as inputs }; - export namespace outputs_884 { - let out_856: string; - export { out_856 as out }; - } - export { outputs_884 as outputs }; - } - export { ND_acescg_to_lin_rec709_color4_1 as ND_acescg_to_lin_rec709_color4 }; - export namespace ND_g22_ap1_to_lin_rec709_color3_1 { - let node_885: string; - export { node_885 as node }; - export namespace inputs_885 { - let _in_300: string; - export { _in_300 as in }; - } - export { inputs_885 as inputs }; - export namespace outputs_885 { - let out_857: string; - export { out_857 as out }; - } - export { outputs_885 as outputs }; - } - export { ND_g22_ap1_to_lin_rec709_color3_1 as ND_g22_ap1_to_lin_rec709_color3 }; - export namespace ND_g22_ap1_to_lin_rec709_color4_1 { - let node_886: string; - export { node_886 as node }; - export namespace inputs_886 { - let _in_301: string; - export { _in_301 as in }; - } - export { inputs_886 as inputs }; - export namespace outputs_886 { - let out_858: string; - export { out_858 as out }; - } - export { outputs_886 as outputs }; - } - export { ND_g22_ap1_to_lin_rec709_color4_1 as ND_g22_ap1_to_lin_rec709_color4 }; - export namespace ND_srgb_texture_to_lin_rec709_color3_1 { - let node_887: string; - export { node_887 as node }; - export namespace inputs_887 { - let _in_302: string; - export { _in_302 as in }; - } - export { inputs_887 as inputs }; - export namespace outputs_887 { - let out_859: string; - export { out_859 as out }; - } - export { outputs_887 as outputs }; - } - export { ND_srgb_texture_to_lin_rec709_color3_1 as ND_srgb_texture_to_lin_rec709_color3 }; - export namespace ND_srgb_texture_to_lin_rec709_color4_1 { - let node_888: string; - export { node_888 as node }; - export namespace inputs_888 { - let _in_303: string; - export { _in_303 as in }; - } - export { inputs_888 as inputs }; - export namespace outputs_888 { - let out_860: string; - export { out_860 as out }; - } - export { outputs_888 as outputs }; - } - export { ND_srgb_texture_to_lin_rec709_color4_1 as ND_srgb_texture_to_lin_rec709_color4 }; - export namespace ND_lin_adobergb_to_lin_rec709_color3_1 { - let node_889: string; - export { node_889 as node }; - export namespace inputs_889 { - let _in_304: string; - export { _in_304 as in }; - } - export { inputs_889 as inputs }; - export namespace outputs_889 { - let out_861: string; - export { out_861 as out }; - } - export { outputs_889 as outputs }; - } - export { ND_lin_adobergb_to_lin_rec709_color3_1 as ND_lin_adobergb_to_lin_rec709_color3 }; - export namespace ND_lin_adobergb_to_lin_rec709_color4_1 { - let node_890: string; - export { node_890 as node }; - export namespace inputs_890 { - let _in_305: string; - export { _in_305 as in }; - } - export { inputs_890 as inputs }; - export namespace outputs_890 { - let out_862: string; - export { out_862 as out }; - } - export { outputs_890 as outputs }; - } - export { ND_lin_adobergb_to_lin_rec709_color4_1 as ND_lin_adobergb_to_lin_rec709_color4 }; - export namespace ND_adobergb_to_lin_rec709_color3_1 { - let node_891: string; - export { node_891 as node }; - export namespace inputs_891 { - let _in_306: string; - export { _in_306 as in }; - } - export { inputs_891 as inputs }; - export namespace outputs_891 { - let out_863: string; - export { out_863 as out }; - } - export { outputs_891 as outputs }; - } - export { ND_adobergb_to_lin_rec709_color3_1 as ND_adobergb_to_lin_rec709_color3 }; - export namespace ND_adobergb_to_lin_rec709_color4_1 { - let node_892: string; - export { node_892 as node }; - export namespace inputs_892 { - let _in_307: string; - export { _in_307 as in }; - } - export { inputs_892 as inputs }; - export namespace outputs_892 { - let out_864: string; - export { out_864 as out }; - } - export { outputs_892 as outputs }; - } - export { ND_adobergb_to_lin_rec709_color4_1 as ND_adobergb_to_lin_rec709_color4 }; - export namespace ND_srgb_displayp3_to_lin_rec709_color3_1 { - let node_893: string; - export { node_893 as node }; - export namespace inputs_893 { - let _in_308: string; - export { _in_308 as in }; - } - export { inputs_893 as inputs }; - export namespace outputs_893 { - let out_865: string; - export { out_865 as out }; - } - export { outputs_893 as outputs }; - } - export { ND_srgb_displayp3_to_lin_rec709_color3_1 as ND_srgb_displayp3_to_lin_rec709_color3 }; - export namespace ND_srgb_displayp3_to_lin_rec709_color4_1 { - let node_894: string; - export { node_894 as node }; - export namespace inputs_894 { - let _in_309: string; - export { _in_309 as in }; - } - export { inputs_894 as inputs }; - export namespace outputs_894 { - let out_866: string; - export { out_866 as out }; - } - export { outputs_894 as outputs }; - } - export { ND_srgb_displayp3_to_lin_rec709_color4_1 as ND_srgb_displayp3_to_lin_rec709_color4 }; - export namespace ND_lin_displayp3_to_lin_rec709_color3_1 { - let node_895: string; - export { node_895 as node }; - export namespace inputs_895 { - let _in_310: string; - export { _in_310 as in }; - } - export { inputs_895 as inputs }; - export namespace outputs_895 { - let out_867: string; - export { out_867 as out }; - } - export { outputs_895 as outputs }; - } - export { ND_lin_displayp3_to_lin_rec709_color3_1 as ND_lin_displayp3_to_lin_rec709_color3 }; - export namespace ND_lin_displayp3_to_lin_rec709_color4_1 { - let node_896: string; - export { node_896 as node }; - export namespace inputs_896 { - let _in_311: string; - export { _in_311 as in }; - } - export { inputs_896 as inputs }; - export namespace outputs_896 { - let out_868: string; - export { out_868 as out }; - } - export { outputs_896 as outputs }; - } - export { ND_lin_displayp3_to_lin_rec709_color4_1 as ND_lin_displayp3_to_lin_rec709_color4 }; - export namespace ND_surfacematerial_1 { - let node_897: string; - export { node_897 as node }; - export namespace inputs_897 { - let surfaceshader_1: string; - export { surfaceshader_1 as surfaceshader }; - let backsurfaceshader_1: string; - export { backsurfaceshader_1 as backsurfaceshader }; - let displacementshader_1: string; - export { displacementshader_1 as displacementshader }; - } - export { inputs_897 as inputs }; - export namespace outputs_897 { - let out_869: string; - export { out_869 as out }; - } - export { outputs_897 as outputs }; - } - export { ND_surfacematerial_1 as ND_surfacematerial }; - export namespace ND_volumematerial_1 { - let node_898: string; - export { node_898 as node }; - export namespace inputs_898 { - let volumeshader_1: string; - export { volumeshader_1 as volumeshader }; - } - export { inputs_898 as inputs }; - export namespace outputs_898 { - let out_870: string; - export { out_870 as out }; - } - export { outputs_898 as outputs }; - } - export { ND_volumematerial_1 as ND_volumematerial }; - export namespace ND_surface_unlit_1 { - let node_899: string; - export { node_899 as node }; - export namespace inputs_899 { - let emission_7: string; - export { emission_7 as emission }; - let emission_color_10: string; - export { emission_color_10 as emission_color }; - let transmission_8: string; - export { transmission_8 as transmission }; - let transmission_color_9: string; - export { transmission_color_9 as transmission_color }; - let opacity_11: string; - export { opacity_11 as opacity }; - } - export { inputs_899 as inputs }; - export namespace outputs_899 { - let out_871: string; - export { out_871 as out }; - } - export { outputs_899 as outputs }; - } - export { ND_surface_unlit_1 as ND_surface_unlit }; - export namespace ND_image_float_1 { - let node_900: string; - export { node_900 as node }; - export namespace inputs_900 { - let file_37: string; - export { file_37 as file }; - let layer_6: string; - export { layer_6 as layer }; - let _default_48: string; - export { _default_48 as default }; - let texcoord_102: string; - export { texcoord_102 as texcoord }; - let uaddressmode_22: string; - export { uaddressmode_22 as uaddressmode }; - let vaddressmode_22: string; - export { vaddressmode_22 as vaddressmode }; - let filtertype_40: string; - export { filtertype_40 as filtertype }; - let framerange_18: string; - export { framerange_18 as framerange }; - let frameoffset_18: string; - export { frameoffset_18 as frameoffset }; - let frameendaction_18: string; - export { frameendaction_18 as frameendaction }; - } - export { inputs_900 as inputs }; - export namespace outputs_900 { - let out_872: string; - export { out_872 as out }; - } - export { outputs_900 as outputs }; - } - export { ND_image_float_1 as ND_image_float }; - export namespace ND_image_color3_1 { - let node_901: string; - export { node_901 as node }; - export namespace inputs_901 { - let file_38: string; - export { file_38 as file }; - let layer_7: string; - export { layer_7 as layer }; - let _default_49: string; - export { _default_49 as default }; - let texcoord_103: string; - export { texcoord_103 as texcoord }; - let uaddressmode_23: string; - export { uaddressmode_23 as uaddressmode }; - let vaddressmode_23: string; - export { vaddressmode_23 as vaddressmode }; - let filtertype_41: string; - export { filtertype_41 as filtertype }; - let framerange_19: string; - export { framerange_19 as framerange }; - let frameoffset_19: string; - export { frameoffset_19 as frameoffset }; - let frameendaction_19: string; - export { frameendaction_19 as frameendaction }; - } - export { inputs_901 as inputs }; - export namespace outputs_901 { - let out_873: string; - export { out_873 as out }; - } - export { outputs_901 as outputs }; - } - export { ND_image_color3_1 as ND_image_color3 }; - export namespace ND_image_color4_1 { - let node_902: string; - export { node_902 as node }; - export namespace inputs_902 { - let file_39: string; - export { file_39 as file }; - let layer_8: string; - export { layer_8 as layer }; - let _default_50: string; - export { _default_50 as default }; - let texcoord_104: string; - export { texcoord_104 as texcoord }; - let uaddressmode_24: string; - export { uaddressmode_24 as uaddressmode }; - let vaddressmode_24: string; - export { vaddressmode_24 as vaddressmode }; - let filtertype_42: string; - export { filtertype_42 as filtertype }; - let framerange_20: string; - export { framerange_20 as framerange }; - let frameoffset_20: string; - export { frameoffset_20 as frameoffset }; - let frameendaction_20: string; - export { frameendaction_20 as frameendaction }; - } - export { inputs_902 as inputs }; - export namespace outputs_902 { - let out_874: string; - export { out_874 as out }; - } - export { outputs_902 as outputs }; - } - export { ND_image_color4_1 as ND_image_color4 }; - export namespace ND_image_vector2_1 { - let node_903: string; - export { node_903 as node }; - export namespace inputs_903 { - let file_40: string; - export { file_40 as file }; - let layer_9: string; - export { layer_9 as layer }; - let _default_51: string; - export { _default_51 as default }; - let texcoord_105: string; - export { texcoord_105 as texcoord }; - let uaddressmode_25: string; - export { uaddressmode_25 as uaddressmode }; - let vaddressmode_25: string; - export { vaddressmode_25 as vaddressmode }; - let filtertype_43: string; - export { filtertype_43 as filtertype }; - let framerange_21: string; - export { framerange_21 as framerange }; - let frameoffset_21: string; - export { frameoffset_21 as frameoffset }; - let frameendaction_21: string; - export { frameendaction_21 as frameendaction }; - } - export { inputs_903 as inputs }; - export namespace outputs_903 { - let out_875: string; - export { out_875 as out }; - } - export { outputs_903 as outputs }; - } - export { ND_image_vector2_1 as ND_image_vector2 }; - export namespace ND_image_vector3_1 { - let node_904: string; - export { node_904 as node }; - export namespace inputs_904 { - let file_41: string; - export { file_41 as file }; - let layer_10: string; - export { layer_10 as layer }; - let _default_52: string; - export { _default_52 as default }; - let texcoord_106: string; - export { texcoord_106 as texcoord }; - let uaddressmode_26: string; - export { uaddressmode_26 as uaddressmode }; - let vaddressmode_26: string; - export { vaddressmode_26 as vaddressmode }; - let filtertype_44: string; - export { filtertype_44 as filtertype }; - let framerange_22: string; - export { framerange_22 as framerange }; - let frameoffset_22: string; - export { frameoffset_22 as frameoffset }; - let frameendaction_22: string; - export { frameendaction_22 as frameendaction }; - } - export { inputs_904 as inputs }; - export namespace outputs_904 { - let out_876: string; - export { out_876 as out }; - } - export { outputs_904 as outputs }; - } - export { ND_image_vector3_1 as ND_image_vector3 }; - export namespace ND_image_vector4_1 { - let node_905: string; - export { node_905 as node }; - export namespace inputs_905 { - let file_42: string; - export { file_42 as file }; - let layer_11: string; - export { layer_11 as layer }; - let _default_53: string; - export { _default_53 as default }; - let texcoord_107: string; - export { texcoord_107 as texcoord }; - let uaddressmode_27: string; - export { uaddressmode_27 as uaddressmode }; - let vaddressmode_27: string; - export { vaddressmode_27 as vaddressmode }; - let filtertype_45: string; - export { filtertype_45 as filtertype }; - let framerange_23: string; - export { framerange_23 as framerange }; - let frameoffset_23: string; - export { frameoffset_23 as frameoffset }; - let frameendaction_23: string; - export { frameendaction_23 as frameendaction }; - } - export { inputs_905 as inputs }; - export namespace outputs_905 { - let out_877: string; - export { out_877 as out }; - } - export { outputs_905 as outputs }; - } - export { ND_image_vector4_1 as ND_image_vector4 }; - export namespace ND_tiledimage_float_1 { - let node_906: string; - export { node_906 as node }; - export namespace inputs_906 { - let file_43: string; - export { file_43 as file }; - let _default_54: string; - export { _default_54 as default }; - let texcoord_108: string; - export { texcoord_108 as texcoord }; - let uvtiling_12: string; - export { uvtiling_12 as uvtiling }; - let uvoffset_12: string; - export { uvoffset_12 as uvoffset }; - let realworldimagesize_6: string; - export { realworldimagesize_6 as realworldimagesize }; - let realworldtilesize_6: string; - export { realworldtilesize_6 as realworldtilesize }; - let filtertype_46: string; - export { filtertype_46 as filtertype }; - let framerange_24: string; - export { framerange_24 as framerange }; - let frameoffset_24: string; - export { frameoffset_24 as frameoffset }; - let frameendaction_24: string; - export { frameendaction_24 as frameendaction }; - } - export { inputs_906 as inputs }; - export namespace outputs_906 { - let out_878: string; - export { out_878 as out }; - } - export { outputs_906 as outputs }; - } - export { ND_tiledimage_float_1 as ND_tiledimage_float }; - export namespace ND_tiledimage_color3_1 { - let node_907: string; - export { node_907 as node }; - export namespace inputs_907 { - let file_44: string; - export { file_44 as file }; - let _default_55: string; - export { _default_55 as default }; - let texcoord_109: string; - export { texcoord_109 as texcoord }; - let uvtiling_13: string; - export { uvtiling_13 as uvtiling }; - let uvoffset_13: string; - export { uvoffset_13 as uvoffset }; - let realworldimagesize_7: string; - export { realworldimagesize_7 as realworldimagesize }; - let realworldtilesize_7: string; - export { realworldtilesize_7 as realworldtilesize }; - let filtertype_47: string; - export { filtertype_47 as filtertype }; - let framerange_25: string; - export { framerange_25 as framerange }; - let frameoffset_25: string; - export { frameoffset_25 as frameoffset }; - let frameendaction_25: string; - export { frameendaction_25 as frameendaction }; - } - export { inputs_907 as inputs }; - export namespace outputs_907 { - let out_879: string; - export { out_879 as out }; - } - export { outputs_907 as outputs }; - } - export { ND_tiledimage_color3_1 as ND_tiledimage_color3 }; - export namespace ND_tiledimage_color4_1 { - let node_908: string; - export { node_908 as node }; - export namespace inputs_908 { - let file_45: string; - export { file_45 as file }; - let _default_56: string; - export { _default_56 as default }; - let texcoord_110: string; - export { texcoord_110 as texcoord }; - let uvtiling_14: string; - export { uvtiling_14 as uvtiling }; - let uvoffset_14: string; - export { uvoffset_14 as uvoffset }; - let realworldimagesize_8: string; - export { realworldimagesize_8 as realworldimagesize }; - let realworldtilesize_8: string; - export { realworldtilesize_8 as realworldtilesize }; - let filtertype_48: string; - export { filtertype_48 as filtertype }; - let framerange_26: string; - export { framerange_26 as framerange }; - let frameoffset_26: string; - export { frameoffset_26 as frameoffset }; - let frameendaction_26: string; - export { frameendaction_26 as frameendaction }; - } - export { inputs_908 as inputs }; - export namespace outputs_908 { - let out_880: string; - export { out_880 as out }; - } - export { outputs_908 as outputs }; - } - export { ND_tiledimage_color4_1 as ND_tiledimage_color4 }; - export namespace ND_tiledimage_vector2_1 { - let node_909: string; - export { node_909 as node }; - export namespace inputs_909 { - let file_46: string; - export { file_46 as file }; - let _default_57: string; - export { _default_57 as default }; - let texcoord_111: string; - export { texcoord_111 as texcoord }; - let uvtiling_15: string; - export { uvtiling_15 as uvtiling }; - let uvoffset_15: string; - export { uvoffset_15 as uvoffset }; - let realworldimagesize_9: string; - export { realworldimagesize_9 as realworldimagesize }; - let realworldtilesize_9: string; - export { realworldtilesize_9 as realworldtilesize }; - let filtertype_49: string; - export { filtertype_49 as filtertype }; - let framerange_27: string; - export { framerange_27 as framerange }; - let frameoffset_27: string; - export { frameoffset_27 as frameoffset }; - let frameendaction_27: string; - export { frameendaction_27 as frameendaction }; - } - export { inputs_909 as inputs }; - export namespace outputs_909 { - let out_881: string; - export { out_881 as out }; - } - export { outputs_909 as outputs }; - } - export { ND_tiledimage_vector2_1 as ND_tiledimage_vector2 }; - export namespace ND_tiledimage_vector3_1 { - let node_910: string; - export { node_910 as node }; - export namespace inputs_910 { - let file_47: string; - export { file_47 as file }; - let _default_58: string; - export { _default_58 as default }; - let texcoord_112: string; - export { texcoord_112 as texcoord }; - let uvtiling_16: string; - export { uvtiling_16 as uvtiling }; - let uvoffset_16: string; - export { uvoffset_16 as uvoffset }; - let realworldimagesize_10: string; - export { realworldimagesize_10 as realworldimagesize }; - let realworldtilesize_10: string; - export { realworldtilesize_10 as realworldtilesize }; - let filtertype_50: string; - export { filtertype_50 as filtertype }; - let framerange_28: string; - export { framerange_28 as framerange }; - let frameoffset_28: string; - export { frameoffset_28 as frameoffset }; - let frameendaction_28: string; - export { frameendaction_28 as frameendaction }; - } - export { inputs_910 as inputs }; - export namespace outputs_910 { - let out_882: string; - export { out_882 as out }; - } - export { outputs_910 as outputs }; - } - export { ND_tiledimage_vector3_1 as ND_tiledimage_vector3 }; - export namespace ND_tiledimage_vector4_1 { - let node_911: string; - export { node_911 as node }; - export namespace inputs_911 { - let file_48: string; - export { file_48 as file }; - let _default_59: string; - export { _default_59 as default }; - let texcoord_113: string; - export { texcoord_113 as texcoord }; - let uvtiling_17: string; - export { uvtiling_17 as uvtiling }; - let uvoffset_17: string; - export { uvoffset_17 as uvoffset }; - let realworldimagesize_11: string; - export { realworldimagesize_11 as realworldimagesize }; - let realworldtilesize_11: string; - export { realworldtilesize_11 as realworldtilesize }; - let filtertype_51: string; - export { filtertype_51 as filtertype }; - let framerange_29: string; - export { framerange_29 as framerange }; - let frameoffset_29: string; - export { frameoffset_29 as frameoffset }; - let frameendaction_29: string; - export { frameendaction_29 as frameendaction }; - } - export { inputs_911 as inputs }; - export namespace outputs_911 { - let out_883: string; - export { out_883 as out }; - } - export { outputs_911 as outputs }; - } - export { ND_tiledimage_vector4_1 as ND_tiledimage_vector4 }; - export namespace ND_latlongimage_1 { - let node_912: string; - export { node_912 as node }; - export namespace inputs_912 { - let file_49: string; - export { file_49 as file }; - let _default_60: string; - export { _default_60 as default }; - let viewdir_1: string; - export { viewdir_1 as viewdir }; - let rotation_7: string; - export { rotation_7 as rotation }; - } - export { inputs_912 as inputs }; - export namespace outputs_912 { - let out_884: string; - export { out_884 as out }; - } - export { outputs_912 as outputs }; - } - export { ND_latlongimage_1 as ND_latlongimage }; - export namespace ND_hextiledimage_color3_1 { - let node_913: string; - export { node_913 as node }; - export namespace inputs_913 { - let file_50: string; - export { file_50 as file }; - let _default_61: string; - export { _default_61 as default }; - let texcoord_114: string; - export { texcoord_114 as texcoord }; - let tiling_3: string; - export { tiling_3 as tiling }; - let rotation_8: string; - export { rotation_8 as rotation }; - let rotationrange_3: string; - export { rotationrange_3 as rotationrange }; - let scale_33: string; - export { scale_33 as scale }; - let scalerange_3: string; - export { scalerange_3 as scalerange }; - let offset_22: string; - export { offset_22 as offset }; - let offsetrange_3: string; - export { offsetrange_3 as offsetrange }; - let falloff_3: string; - export { falloff_3 as falloff }; - let falloffcontrast_2: string; - export { falloffcontrast_2 as falloffcontrast }; - let lumacoeffs_6: string; - export { lumacoeffs_6 as lumacoeffs }; - } - export { inputs_913 as inputs }; - export namespace outputs_913 { - let out_885: string; - export { out_885 as out }; - } - export { outputs_913 as outputs }; - } - export { ND_hextiledimage_color3_1 as ND_hextiledimage_color3 }; - export namespace ND_hextiledimage_color4_1 { - let node_914: string; - export { node_914 as node }; - export namespace inputs_914 { - let file_51: string; - export { file_51 as file }; - let _default_62: string; - export { _default_62 as default }; - let texcoord_115: string; - export { texcoord_115 as texcoord }; - let tiling_4: string; - export { tiling_4 as tiling }; - let rotation_9: string; - export { rotation_9 as rotation }; - let rotationrange_4: string; - export { rotationrange_4 as rotationrange }; - let scale_34: string; - export { scale_34 as scale }; - let scalerange_4: string; - export { scalerange_4 as scalerange }; - let offset_23: string; - export { offset_23 as offset }; - let offsetrange_4: string; - export { offsetrange_4 as offsetrange }; - let falloff_4: string; - export { falloff_4 as falloff }; - let falloffcontrast_3: string; - export { falloffcontrast_3 as falloffcontrast }; - let lumacoeffs_7: string; - export { lumacoeffs_7 as lumacoeffs }; - } - export { inputs_914 as inputs }; - export namespace outputs_914 { - let out_886: string; - export { out_886 as out }; - } - export { outputs_914 as outputs }; - } - export { ND_hextiledimage_color4_1 as ND_hextiledimage_color4 }; - export namespace ND_triplanarprojection_float_1 { - let node_915: string; - export { node_915 as node }; - export namespace inputs_915 { - let filex_6: string; - export { filex_6 as filex }; - let filey_6: string; - export { filey_6 as filey }; - let filez_6: string; - export { filez_6 as filez }; - let layerx_6: string; - export { layerx_6 as layerx }; - let layery_6: string; - export { layery_6 as layery }; - let layerz_6: string; - export { layerz_6 as layerz }; - let _default_63: string; - export { _default_63 as default }; - let position_36: string; - export { position_36 as position }; - let normal_54: string; - export { normal_54 as normal }; - let upaxis_6: string; - export { upaxis_6 as upaxis }; - let blend_6: string; - export { blend_6 as blend }; - let filtertype_52: string; - export { filtertype_52 as filtertype }; - let framerange_30: string; - export { framerange_30 as framerange }; - let frameoffset_30: string; - export { frameoffset_30 as frameoffset }; - let frameendaction_30: string; - export { frameendaction_30 as frameendaction }; - } - export { inputs_915 as inputs }; - export namespace outputs_915 { - let out_887: string; - export { out_887 as out }; - } - export { outputs_915 as outputs }; - } - export { ND_triplanarprojection_float_1 as ND_triplanarprojection_float }; - export namespace ND_triplanarprojection_color3_1 { - let node_916: string; - export { node_916 as node }; - export namespace inputs_916 { - let filex_7: string; - export { filex_7 as filex }; - let filey_7: string; - export { filey_7 as filey }; - let filez_7: string; - export { filez_7 as filez }; - let layerx_7: string; - export { layerx_7 as layerx }; - let layery_7: string; - export { layery_7 as layery }; - let layerz_7: string; - export { layerz_7 as layerz }; - let _default_64: string; - export { _default_64 as default }; - let position_37: string; - export { position_37 as position }; - let normal_55: string; - export { normal_55 as normal }; - let upaxis_7: string; - export { upaxis_7 as upaxis }; - let blend_7: string; - export { blend_7 as blend }; - let filtertype_53: string; - export { filtertype_53 as filtertype }; - let framerange_31: string; - export { framerange_31 as framerange }; - let frameoffset_31: string; - export { frameoffset_31 as frameoffset }; - let frameendaction_31: string; - export { frameendaction_31 as frameendaction }; - } - export { inputs_916 as inputs }; - export namespace outputs_916 { - let out_888: string; - export { out_888 as out }; - } - export { outputs_916 as outputs }; - } - export { ND_triplanarprojection_color3_1 as ND_triplanarprojection_color3 }; - export namespace ND_triplanarprojection_color4_1 { - let node_917: string; - export { node_917 as node }; - export namespace inputs_917 { - let filex_8: string; - export { filex_8 as filex }; - let filey_8: string; - export { filey_8 as filey }; - let filez_8: string; - export { filez_8 as filez }; - let layerx_8: string; - export { layerx_8 as layerx }; - let layery_8: string; - export { layery_8 as layery }; - let layerz_8: string; - export { layerz_8 as layerz }; - let _default_65: string; - export { _default_65 as default }; - let position_38: string; - export { position_38 as position }; - let normal_56: string; - export { normal_56 as normal }; - let upaxis_8: string; - export { upaxis_8 as upaxis }; - let blend_8: string; - export { blend_8 as blend }; - let filtertype_54: string; - export { filtertype_54 as filtertype }; - let framerange_32: string; - export { framerange_32 as framerange }; - let frameoffset_32: string; - export { frameoffset_32 as frameoffset }; - let frameendaction_32: string; - export { frameendaction_32 as frameendaction }; - } - export { inputs_917 as inputs }; - export namespace outputs_917 { - let out_889: string; - export { out_889 as out }; - } - export { outputs_917 as outputs }; - } - export { ND_triplanarprojection_color4_1 as ND_triplanarprojection_color4 }; - export namespace ND_triplanarprojection_vector2_1 { - let node_918: string; - export { node_918 as node }; - export namespace inputs_918 { - let filex_9: string; - export { filex_9 as filex }; - let filey_9: string; - export { filey_9 as filey }; - let filez_9: string; - export { filez_9 as filez }; - let layerx_9: string; - export { layerx_9 as layerx }; - let layery_9: string; - export { layery_9 as layery }; - let layerz_9: string; - export { layerz_9 as layerz }; - let _default_66: string; - export { _default_66 as default }; - let position_39: string; - export { position_39 as position }; - let normal_57: string; - export { normal_57 as normal }; - let upaxis_9: string; - export { upaxis_9 as upaxis }; - let blend_9: string; - export { blend_9 as blend }; - let filtertype_55: string; - export { filtertype_55 as filtertype }; - let framerange_33: string; - export { framerange_33 as framerange }; - let frameoffset_33: string; - export { frameoffset_33 as frameoffset }; - let frameendaction_33: string; - export { frameendaction_33 as frameendaction }; - } - export { inputs_918 as inputs }; - export namespace outputs_918 { - let out_890: string; - export { out_890 as out }; - } - export { outputs_918 as outputs }; - } - export { ND_triplanarprojection_vector2_1 as ND_triplanarprojection_vector2 }; - export namespace ND_triplanarprojection_vector3_1 { - let node_919: string; - export { node_919 as node }; - export namespace inputs_919 { - let filex_10: string; - export { filex_10 as filex }; - let filey_10: string; - export { filey_10 as filey }; - let filez_10: string; - export { filez_10 as filez }; - let layerx_10: string; - export { layerx_10 as layerx }; - let layery_10: string; - export { layery_10 as layery }; - let layerz_10: string; - export { layerz_10 as layerz }; - let _default_67: string; - export { _default_67 as default }; - let position_40: string; - export { position_40 as position }; - let normal_58: string; - export { normal_58 as normal }; - let upaxis_10: string; - export { upaxis_10 as upaxis }; - let blend_10: string; - export { blend_10 as blend }; - let filtertype_56: string; - export { filtertype_56 as filtertype }; - let framerange_34: string; - export { framerange_34 as framerange }; - let frameoffset_34: string; - export { frameoffset_34 as frameoffset }; - let frameendaction_34: string; - export { frameendaction_34 as frameendaction }; - } - export { inputs_919 as inputs }; - export namespace outputs_919 { - let out_891: string; - export { out_891 as out }; - } - export { outputs_919 as outputs }; - } - export { ND_triplanarprojection_vector3_1 as ND_triplanarprojection_vector3 }; - export namespace ND_triplanarprojection_vector4_1 { - let node_920: string; - export { node_920 as node }; - export namespace inputs_920 { - let filex_11: string; - export { filex_11 as filex }; - let filey_11: string; - export { filey_11 as filey }; - let filez_11: string; - export { filez_11 as filez }; - let layerx_11: string; - export { layerx_11 as layerx }; - let layery_11: string; - export { layery_11 as layery }; - let layerz_11: string; - export { layerz_11 as layerz }; - let _default_68: string; - export { _default_68 as default }; - let position_41: string; - export { position_41 as position }; - let normal_59: string; - export { normal_59 as normal }; - let upaxis_11: string; - export { upaxis_11 as upaxis }; - let blend_11: string; - export { blend_11 as blend }; - let filtertype_57: string; - export { filtertype_57 as filtertype }; - let framerange_35: string; - export { framerange_35 as framerange }; - let frameoffset_35: string; - export { frameoffset_35 as frameoffset }; - let frameendaction_35: string; - export { frameendaction_35 as frameendaction }; - } - export { inputs_920 as inputs }; - export namespace outputs_920 { - let out_892: string; - export { out_892 as out }; - } - export { outputs_920 as outputs }; - } - export { ND_triplanarprojection_vector4_1 as ND_triplanarprojection_vector4 }; - export namespace ND_constant_float_1 { - let node_921: string; - export { node_921 as node }; - export namespace inputs_921 { - let value_12: string; - export { value_12 as value }; - } - export { inputs_921 as inputs }; - export namespace outputs_921 { - let out_893: string; - export { out_893 as out }; - } - export { outputs_921 as outputs }; - } - export { ND_constant_float_1 as ND_constant_float }; - export namespace ND_constant_color3_1 { - let node_922: string; - export { node_922 as node }; - export namespace inputs_922 { - let value_13: string; - export { value_13 as value }; - } - export { inputs_922 as inputs }; - export namespace outputs_922 { - let out_894: string; - export { out_894 as out }; - } - export { outputs_922 as outputs }; - } - export { ND_constant_color3_1 as ND_constant_color3 }; - export namespace ND_constant_color4_1 { - let node_923: string; - export { node_923 as node }; - export namespace inputs_923 { - let value_14: string; - export { value_14 as value }; - } - export { inputs_923 as inputs }; - export namespace outputs_923 { - let out_895: string; - export { out_895 as out }; - } - export { outputs_923 as outputs }; - } - export { ND_constant_color4_1 as ND_constant_color4 }; - export namespace ND_constant_vector2_1 { - let node_924: string; - export { node_924 as node }; - export namespace inputs_924 { - let value_15: string; - export { value_15 as value }; - } - export { inputs_924 as inputs }; - export namespace outputs_924 { - let out_896: string; - export { out_896 as out }; - } - export { outputs_924 as outputs }; - } - export { ND_constant_vector2_1 as ND_constant_vector2 }; - export namespace ND_constant_vector3_1 { - let node_925: string; - export { node_925 as node }; - export namespace inputs_925 { - let value_16: string; - export { value_16 as value }; - } - export { inputs_925 as inputs }; - export namespace outputs_925 { - let out_897: string; - export { out_897 as out }; - } - export { outputs_925 as outputs }; - } - export { ND_constant_vector3_1 as ND_constant_vector3 }; - export namespace ND_constant_vector4_1 { - let node_926: string; - export { node_926 as node }; - export namespace inputs_926 { - let value_17: string; - export { value_17 as value }; - } - export { inputs_926 as inputs }; - export namespace outputs_926 { - let out_898: string; - export { out_898 as out }; - } - export { outputs_926 as outputs }; - } - export { ND_constant_vector4_1 as ND_constant_vector4 }; - export namespace ND_constant_boolean_1 { - let node_927: string; - export { node_927 as node }; - export namespace inputs_927 { - let value_18: string; - export { value_18 as value }; - } - export { inputs_927 as inputs }; - export namespace outputs_927 { - let out_899: string; - export { out_899 as out }; - } - export { outputs_927 as outputs }; - } - export { ND_constant_boolean_1 as ND_constant_boolean }; - export namespace ND_constant_integer_1 { - let node_928: string; - export { node_928 as node }; - export namespace inputs_928 { - let value_19: string; - export { value_19 as value }; - } - export { inputs_928 as inputs }; - export namespace outputs_928 { - let out_900: string; - export { out_900 as out }; - } - export { outputs_928 as outputs }; - } - export { ND_constant_integer_1 as ND_constant_integer }; - export namespace ND_constant_matrix33_1 { - let node_929: string; - export { node_929 as node }; - export namespace inputs_929 { - let value_20: string; - export { value_20 as value }; - } - export { inputs_929 as inputs }; - export namespace outputs_929 { - let out_901: string; - export { out_901 as out }; - } - export { outputs_929 as outputs }; - } - export { ND_constant_matrix33_1 as ND_constant_matrix33 }; - export namespace ND_constant_matrix44_1 { - let node_930: string; - export { node_930 as node }; - export namespace inputs_930 { - let value_21: string; - export { value_21 as value }; - } - export { inputs_930 as inputs }; - export namespace outputs_930 { - let out_902: string; - export { out_902 as out }; - } - export { outputs_930 as outputs }; - } - export { ND_constant_matrix44_1 as ND_constant_matrix44 }; - export namespace ND_constant_string_1 { - let node_931: string; - export { node_931 as node }; - export namespace inputs_931 { - let value_22: string; - export { value_22 as value }; - } - export { inputs_931 as inputs }; - export namespace outputs_931 { - let out_903: string; - export { out_903 as out }; - } - export { outputs_931 as outputs }; - } - export { ND_constant_string_1 as ND_constant_string }; - export namespace ND_constant_filename_1 { - let node_932: string; - export { node_932 as node }; - export namespace inputs_932 { - let value_23: string; - export { value_23 as value }; - } - export { inputs_932 as inputs }; - export namespace outputs_932 { - let out_904: string; - export { out_904 as out }; - } - export { outputs_932 as outputs }; - } - export { ND_constant_filename_1 as ND_constant_filename }; - export namespace ND_ramp_1 { - let node_933: string; - export { node_933 as node }; - export namespace inputs_933 { - let texcoord_116: string; - export { texcoord_116 as texcoord }; - let type_3: string; - export { type_3 as type }; - let interpolation_2: string; - export { interpolation_2 as interpolation }; - let num_intervals_2: string; - export { num_intervals_2 as num_intervals }; - let interval1_2: string; - export { interval1_2 as interval1 }; - let color1_3: string; - export { color1_3 as color1 }; - let interval2_2: string; - export { interval2_2 as interval2 }; - let color2_3: string; - export { color2_3 as color2 }; - let interval3_1: string; - export { interval3_1 as interval3 }; - let color3_1: string; - export { color3_1 as color3 }; - let interval4_1: string; - export { interval4_1 as interval4 }; - let color4_1: string; - export { color4_1 as color4 }; - let interval5_1: string; - export { interval5_1 as interval5 }; - let color5_1: string; - export { color5_1 as color5 }; - let interval6_1: string; - export { interval6_1 as interval6 }; - let color6_1: string; - export { color6_1 as color6 }; - let interval7_1: string; - export { interval7_1 as interval7 }; - let color7_1: string; - export { color7_1 as color7 }; - let interval8_1: string; - export { interval8_1 as interval8 }; - let color8_1: string; - export { color8_1 as color8 }; - let interval9_1: string; - export { interval9_1 as interval9 }; - let color9_1: string; - export { color9_1 as color9 }; - let interval10_1: string; - export { interval10_1 as interval10 }; - let color10_1: string; - export { color10_1 as color10 }; - } - export { inputs_933 as inputs }; - export namespace outputs_933 { - let out_905: string; - export { out_905 as out }; - } - export { outputs_933 as outputs }; - } - export { ND_ramp_1 as ND_ramp }; - export namespace ND_ramp_gradient_1 { - let node_934: string; - export { node_934 as node }; - export namespace inputs_934 { - let x_1: string; - export { x_1 as x }; - let interval1_3: string; - export { interval1_3 as interval1 }; - let interval2_3: string; - export { interval2_3 as interval2 }; - let color1_4: string; - export { color1_4 as color1 }; - let color2_4: string; - export { color2_4 as color2 }; - let interpolation_3: string; - export { interpolation_3 as interpolation }; - let prev_color_1: string; - export { prev_color_1 as prev_color }; - let interval_num_1: string; - export { interval_num_1 as interval_num }; - let num_intervals_3: string; - export { num_intervals_3 as num_intervals }; - } - export { inputs_934 as inputs }; - export namespace outputs_934 { - let out_906: string; - export { out_906 as out }; - } - export { outputs_934 as outputs }; - } - export { ND_ramp_gradient_1 as ND_ramp_gradient }; - export namespace ND_ramplr_float_1 { - let node_935: string; - export { node_935 as node }; - export namespace inputs_935 { - let valuel_12: string; - export { valuel_12 as valuel }; - let valuer_12: string; - export { valuer_12 as valuer }; - let texcoord_117: string; - export { texcoord_117 as texcoord }; - } - export { inputs_935 as inputs }; - export namespace outputs_935 { - let out_907: string; - export { out_907 as out }; - } - export { outputs_935 as outputs }; - } - export { ND_ramplr_float_1 as ND_ramplr_float }; - export namespace ND_ramplr_color3_1 { - let node_936: string; - export { node_936 as node }; - export namespace inputs_936 { - let valuel_13: string; - export { valuel_13 as valuel }; - let valuer_13: string; - export { valuer_13 as valuer }; - let texcoord_118: string; - export { texcoord_118 as texcoord }; - } - export { inputs_936 as inputs }; - export namespace outputs_936 { - let out_908: string; - export { out_908 as out }; - } - export { outputs_936 as outputs }; - } - export { ND_ramplr_color3_1 as ND_ramplr_color3 }; - export namespace ND_ramplr_color4_1 { - let node_937: string; - export { node_937 as node }; - export namespace inputs_937 { - let valuel_14: string; - export { valuel_14 as valuel }; - let valuer_14: string; - export { valuer_14 as valuer }; - let texcoord_119: string; - export { texcoord_119 as texcoord }; - } - export { inputs_937 as inputs }; - export namespace outputs_937 { - let out_909: string; - export { out_909 as out }; - } - export { outputs_937 as outputs }; - } - export { ND_ramplr_color4_1 as ND_ramplr_color4 }; - export namespace ND_ramplr_vector2_1 { - let node_938: string; - export { node_938 as node }; - export namespace inputs_938 { - let valuel_15: string; - export { valuel_15 as valuel }; - let valuer_15: string; - export { valuer_15 as valuer }; - let texcoord_120: string; - export { texcoord_120 as texcoord }; - } - export { inputs_938 as inputs }; - export namespace outputs_938 { - let out_910: string; - export { out_910 as out }; - } - export { outputs_938 as outputs }; - } - export { ND_ramplr_vector2_1 as ND_ramplr_vector2 }; - export namespace ND_ramplr_vector3_1 { - let node_939: string; - export { node_939 as node }; - export namespace inputs_939 { - let valuel_16: string; - export { valuel_16 as valuel }; - let valuer_16: string; - export { valuer_16 as valuer }; - let texcoord_121: string; - export { texcoord_121 as texcoord }; - } - export { inputs_939 as inputs }; - export namespace outputs_939 { - let out_911: string; - export { out_911 as out }; - } - export { outputs_939 as outputs }; - } - export { ND_ramplr_vector3_1 as ND_ramplr_vector3 }; - export namespace ND_ramplr_vector4_1 { - let node_940: string; - export { node_940 as node }; - export namespace inputs_940 { - let valuel_17: string; - export { valuel_17 as valuel }; - let valuer_17: string; - export { valuer_17 as valuer }; - let texcoord_122: string; - export { texcoord_122 as texcoord }; - } - export { inputs_940 as inputs }; - export namespace outputs_940 { - let out_912: string; - export { out_912 as out }; - } - export { outputs_940 as outputs }; - } - export { ND_ramplr_vector4_1 as ND_ramplr_vector4 }; - export namespace ND_ramptb_float_1 { - let node_941: string; - export { node_941 as node }; - export namespace inputs_941 { - let valuet_12: string; - export { valuet_12 as valuet }; - let valueb_12: string; - export { valueb_12 as valueb }; - let texcoord_123: string; - export { texcoord_123 as texcoord }; - } - export { inputs_941 as inputs }; - export namespace outputs_941 { - let out_913: string; - export { out_913 as out }; - } - export { outputs_941 as outputs }; - } - export { ND_ramptb_float_1 as ND_ramptb_float }; - export namespace ND_ramptb_color3_1 { - let node_942: string; - export { node_942 as node }; - export namespace inputs_942 { - let valuet_13: string; - export { valuet_13 as valuet }; - let valueb_13: string; - export { valueb_13 as valueb }; - let texcoord_124: string; - export { texcoord_124 as texcoord }; - } - export { inputs_942 as inputs }; - export namespace outputs_942 { - let out_914: string; - export { out_914 as out }; - } - export { outputs_942 as outputs }; - } - export { ND_ramptb_color3_1 as ND_ramptb_color3 }; - export namespace ND_ramptb_color4_1 { - let node_943: string; - export { node_943 as node }; - export namespace inputs_943 { - let valuet_14: string; - export { valuet_14 as valuet }; - let valueb_14: string; - export { valueb_14 as valueb }; - let texcoord_125: string; - export { texcoord_125 as texcoord }; - } - export { inputs_943 as inputs }; - export namespace outputs_943 { - let out_915: string; - export { out_915 as out }; - } - export { outputs_943 as outputs }; - } - export { ND_ramptb_color4_1 as ND_ramptb_color4 }; - export namespace ND_ramptb_vector2_1 { - let node_944: string; - export { node_944 as node }; - export namespace inputs_944 { - let valuet_15: string; - export { valuet_15 as valuet }; - let valueb_15: string; - export { valueb_15 as valueb }; - let texcoord_126: string; - export { texcoord_126 as texcoord }; - } - export { inputs_944 as inputs }; - export namespace outputs_944 { - let out_916: string; - export { out_916 as out }; - } - export { outputs_944 as outputs }; - } - export { ND_ramptb_vector2_1 as ND_ramptb_vector2 }; - export namespace ND_ramptb_vector3_1 { - let node_945: string; - export { node_945 as node }; - export namespace inputs_945 { - let valuet_16: string; - export { valuet_16 as valuet }; - let valueb_16: string; - export { valueb_16 as valueb }; - let texcoord_127: string; - export { texcoord_127 as texcoord }; - } - export { inputs_945 as inputs }; - export namespace outputs_945 { - let out_917: string; - export { out_917 as out }; - } - export { outputs_945 as outputs }; - } - export { ND_ramptb_vector3_1 as ND_ramptb_vector3 }; - export namespace ND_ramptb_vector4_1 { - let node_946: string; - export { node_946 as node }; - export namespace inputs_946 { - let valuet_17: string; - export { valuet_17 as valuet }; - let valueb_17: string; - export { valueb_17 as valueb }; - let texcoord_128: string; - export { texcoord_128 as texcoord }; - } - export { inputs_946 as inputs }; - export namespace outputs_946 { - let out_918: string; - export { out_918 as out }; - } - export { outputs_946 as outputs }; - } - export { ND_ramptb_vector4_1 as ND_ramptb_vector4 }; - export namespace ND_ramp4_float_1 { - let node_947: string; - export { node_947 as node }; - export namespace inputs_947 { - let valuetl_6: string; - export { valuetl_6 as valuetl }; - let valuetr_6: string; - export { valuetr_6 as valuetr }; - let valuebl_6: string; - export { valuebl_6 as valuebl }; - let valuebr_6: string; - export { valuebr_6 as valuebr }; - let texcoord_129: string; - export { texcoord_129 as texcoord }; - } - export { inputs_947 as inputs }; - export namespace outputs_947 { - let out_919: string; - export { out_919 as out }; - } - export { outputs_947 as outputs }; - } - export { ND_ramp4_float_1 as ND_ramp4_float }; - export namespace ND_ramp4_color3_1 { - let node_948: string; - export { node_948 as node }; - export namespace inputs_948 { - let valuetl_7: string; - export { valuetl_7 as valuetl }; - let valuetr_7: string; - export { valuetr_7 as valuetr }; - let valuebl_7: string; - export { valuebl_7 as valuebl }; - let valuebr_7: string; - export { valuebr_7 as valuebr }; - let texcoord_130: string; - export { texcoord_130 as texcoord }; - } - export { inputs_948 as inputs }; - export namespace outputs_948 { - let out_920: string; - export { out_920 as out }; - } - export { outputs_948 as outputs }; - } - export { ND_ramp4_color3_1 as ND_ramp4_color3 }; - export namespace ND_ramp4_color4_1 { - let node_949: string; - export { node_949 as node }; - export namespace inputs_949 { - let valuetl_8: string; - export { valuetl_8 as valuetl }; - let valuetr_8: string; - export { valuetr_8 as valuetr }; - let valuebl_8: string; - export { valuebl_8 as valuebl }; - let valuebr_8: string; - export { valuebr_8 as valuebr }; - let texcoord_131: string; - export { texcoord_131 as texcoord }; - } - export { inputs_949 as inputs }; - export namespace outputs_949 { - let out_921: string; - export { out_921 as out }; - } - export { outputs_949 as outputs }; - } - export { ND_ramp4_color4_1 as ND_ramp4_color4 }; - export namespace ND_ramp4_vector2_1 { - let node_950: string; - export { node_950 as node }; - export namespace inputs_950 { - let valuetl_9: string; - export { valuetl_9 as valuetl }; - let valuetr_9: string; - export { valuetr_9 as valuetr }; - let valuebl_9: string; - export { valuebl_9 as valuebl }; - let valuebr_9: string; - export { valuebr_9 as valuebr }; - let texcoord_132: string; - export { texcoord_132 as texcoord }; - } - export { inputs_950 as inputs }; - export namespace outputs_950 { - let out_922: string; - export { out_922 as out }; - } - export { outputs_950 as outputs }; - } - export { ND_ramp4_vector2_1 as ND_ramp4_vector2 }; - export namespace ND_ramp4_vector3_1 { - let node_951: string; - export { node_951 as node }; - export namespace inputs_951 { - let valuetl_10: string; - export { valuetl_10 as valuetl }; - let valuetr_10: string; - export { valuetr_10 as valuetr }; - let valuebl_10: string; - export { valuebl_10 as valuebl }; - let valuebr_10: string; - export { valuebr_10 as valuebr }; - let texcoord_133: string; - export { texcoord_133 as texcoord }; - } - export { inputs_951 as inputs }; - export namespace outputs_951 { - let out_923: string; - export { out_923 as out }; - } - export { outputs_951 as outputs }; - } - export { ND_ramp4_vector3_1 as ND_ramp4_vector3 }; - export namespace ND_ramp4_vector4_1 { - let node_952: string; - export { node_952 as node }; - export namespace inputs_952 { - let valuetl_11: string; - export { valuetl_11 as valuetl }; - let valuetr_11: string; - export { valuetr_11 as valuetr }; - let valuebl_11: string; - export { valuebl_11 as valuebl }; - let valuebr_11: string; - export { valuebr_11 as valuebr }; - let texcoord_134: string; - export { texcoord_134 as texcoord }; - } - export { inputs_952 as inputs }; - export namespace outputs_952 { - let out_924: string; - export { out_924 as out }; - } - export { outputs_952 as outputs }; - } - export { ND_ramp4_vector4_1 as ND_ramp4_vector4 }; - export namespace ND_splitlr_float_1 { - let node_953: string; - export { node_953 as node }; - export namespace inputs_953 { - let valuel_18: string; - export { valuel_18 as valuel }; - let valuer_18: string; - export { valuer_18 as valuer }; - let center_16: string; - export { center_16 as center }; - let texcoord_135: string; - export { texcoord_135 as texcoord }; - } - export { inputs_953 as inputs }; - export namespace outputs_953 { - let out_925: string; - export { out_925 as out }; - } - export { outputs_953 as outputs }; - } - export { ND_splitlr_float_1 as ND_splitlr_float }; - export namespace ND_splitlr_color3_1 { - let node_954: string; - export { node_954 as node }; - export namespace inputs_954 { - let valuel_19: string; - export { valuel_19 as valuel }; - let valuer_19: string; - export { valuer_19 as valuer }; - let center_17: string; - export { center_17 as center }; - let texcoord_136: string; - export { texcoord_136 as texcoord }; - } - export { inputs_954 as inputs }; - export namespace outputs_954 { - let out_926: string; - export { out_926 as out }; - } - export { outputs_954 as outputs }; - } - export { ND_splitlr_color3_1 as ND_splitlr_color3 }; - export namespace ND_splitlr_color4_1 { - let node_955: string; - export { node_955 as node }; - export namespace inputs_955 { - let valuel_20: string; - export { valuel_20 as valuel }; - let valuer_20: string; - export { valuer_20 as valuer }; - let center_18: string; - export { center_18 as center }; - let texcoord_137: string; - export { texcoord_137 as texcoord }; - } - export { inputs_955 as inputs }; - export namespace outputs_955 { - let out_927: string; - export { out_927 as out }; - } - export { outputs_955 as outputs }; - } - export { ND_splitlr_color4_1 as ND_splitlr_color4 }; - export namespace ND_splitlr_vector2_1 { - let node_956: string; - export { node_956 as node }; - export namespace inputs_956 { - let valuel_21: string; - export { valuel_21 as valuel }; - let valuer_21: string; - export { valuer_21 as valuer }; - let center_19: string; - export { center_19 as center }; - let texcoord_138: string; - export { texcoord_138 as texcoord }; - } - export { inputs_956 as inputs }; - export namespace outputs_956 { - let out_928: string; - export { out_928 as out }; - } - export { outputs_956 as outputs }; - } - export { ND_splitlr_vector2_1 as ND_splitlr_vector2 }; - export namespace ND_splitlr_vector3_1 { - let node_957: string; - export { node_957 as node }; - export namespace inputs_957 { - let valuel_22: string; - export { valuel_22 as valuel }; - let valuer_22: string; - export { valuer_22 as valuer }; - let center_20: string; - export { center_20 as center }; - let texcoord_139: string; - export { texcoord_139 as texcoord }; - } - export { inputs_957 as inputs }; - export namespace outputs_957 { - let out_929: string; - export { out_929 as out }; - } - export { outputs_957 as outputs }; - } - export { ND_splitlr_vector3_1 as ND_splitlr_vector3 }; - export namespace ND_splitlr_vector4_1 { - let node_958: string; - export { node_958 as node }; - export namespace inputs_958 { - let valuel_23: string; - export { valuel_23 as valuel }; - let valuer_23: string; - export { valuer_23 as valuer }; - let center_21: string; - export { center_21 as center }; - let texcoord_140: string; - export { texcoord_140 as texcoord }; - } - export { inputs_958 as inputs }; - export namespace outputs_958 { - let out_930: string; - export { out_930 as out }; - } - export { outputs_958 as outputs }; - } - export { ND_splitlr_vector4_1 as ND_splitlr_vector4 }; - export namespace ND_splittb_float_1 { - let node_959: string; - export { node_959 as node }; - export namespace inputs_959 { - let valuet_18: string; - export { valuet_18 as valuet }; - let valueb_18: string; - export { valueb_18 as valueb }; - let center_22: string; - export { center_22 as center }; - let texcoord_141: string; - export { texcoord_141 as texcoord }; - } - export { inputs_959 as inputs }; - export namespace outputs_959 { - let out_931: string; - export { out_931 as out }; - } - export { outputs_959 as outputs }; - } - export { ND_splittb_float_1 as ND_splittb_float }; - export namespace ND_splittb_color3_1 { - let node_960: string; - export { node_960 as node }; - export namespace inputs_960 { - let valuet_19: string; - export { valuet_19 as valuet }; - let valueb_19: string; - export { valueb_19 as valueb }; - let center_23: string; - export { center_23 as center }; - let texcoord_142: string; - export { texcoord_142 as texcoord }; - } - export { inputs_960 as inputs }; - export namespace outputs_960 { - let out_932: string; - export { out_932 as out }; - } - export { outputs_960 as outputs }; - } - export { ND_splittb_color3_1 as ND_splittb_color3 }; - export namespace ND_splittb_color4_1 { - let node_961: string; - export { node_961 as node }; - export namespace inputs_961 { - let valuet_20: string; - export { valuet_20 as valuet }; - let valueb_20: string; - export { valueb_20 as valueb }; - let center_24: string; - export { center_24 as center }; - let texcoord_143: string; - export { texcoord_143 as texcoord }; - } - export { inputs_961 as inputs }; - export namespace outputs_961 { - let out_933: string; - export { out_933 as out }; - } - export { outputs_961 as outputs }; - } - export { ND_splittb_color4_1 as ND_splittb_color4 }; - export namespace ND_splittb_vector2_1 { - let node_962: string; - export { node_962 as node }; - export namespace inputs_962 { - let valuet_21: string; - export { valuet_21 as valuet }; - let valueb_21: string; - export { valueb_21 as valueb }; - let center_25: string; - export { center_25 as center }; - let texcoord_144: string; - export { texcoord_144 as texcoord }; - } - export { inputs_962 as inputs }; - export namespace outputs_962 { - let out_934: string; - export { out_934 as out }; - } - export { outputs_962 as outputs }; - } - export { ND_splittb_vector2_1 as ND_splittb_vector2 }; - export namespace ND_splittb_vector3_1 { - let node_963: string; - export { node_963 as node }; - export namespace inputs_963 { - let valuet_22: string; - export { valuet_22 as valuet }; - let valueb_22: string; - export { valueb_22 as valueb }; - let center_26: string; - export { center_26 as center }; - let texcoord_145: string; - export { texcoord_145 as texcoord }; - } - export { inputs_963 as inputs }; - export namespace outputs_963 { - let out_935: string; - export { out_935 as out }; - } - export { outputs_963 as outputs }; - } - export { ND_splittb_vector3_1 as ND_splittb_vector3 }; - export namespace ND_splittb_vector4_1 { - let node_964: string; - export { node_964 as node }; - export namespace inputs_964 { - let valuet_23: string; - export { valuet_23 as valuet }; - let valueb_23: string; - export { valueb_23 as valueb }; - let center_27: string; - export { center_27 as center }; - let texcoord_146: string; - export { texcoord_146 as texcoord }; - } - export { inputs_964 as inputs }; - export namespace outputs_964 { - let out_936: string; - export { out_936 as out }; - } - export { outputs_964 as outputs }; - } - export { ND_splittb_vector4_1 as ND_splittb_vector4 }; - export namespace ND_noise2d_float_1 { - let node_965: string; - export { node_965 as node }; - export namespace inputs_965 { - let amplitude_44: string; - export { amplitude_44 as amplitude }; - let pivot_50: string; - export { pivot_50 as pivot }; - let texcoord_147: string; - export { texcoord_147 as texcoord }; - } - export { inputs_965 as inputs }; - export namespace outputs_965 { - let out_937: string; - export { out_937 as out }; - } - export { outputs_965 as outputs }; - } - export { ND_noise2d_float_1 as ND_noise2d_float }; - export namespace ND_noise2d_color3_1 { - let node_966: string; - export { node_966 as node }; - export namespace inputs_966 { - let amplitude_45: string; - export { amplitude_45 as amplitude }; - let pivot_51: string; - export { pivot_51 as pivot }; - let texcoord_148: string; - export { texcoord_148 as texcoord }; - } - export { inputs_966 as inputs }; - export namespace outputs_966 { - let out_938: string; - export { out_938 as out }; - } - export { outputs_966 as outputs }; - } - export { ND_noise2d_color3_1 as ND_noise2d_color3 }; - export namespace ND_noise2d_color4_1 { - let node_967: string; - export { node_967 as node }; - export namespace inputs_967 { - let amplitude_46: string; - export { amplitude_46 as amplitude }; - let pivot_52: string; - export { pivot_52 as pivot }; - let texcoord_149: string; - export { texcoord_149 as texcoord }; - } - export { inputs_967 as inputs }; - export namespace outputs_967 { - let out_939: string; - export { out_939 as out }; - } - export { outputs_967 as outputs }; - } - export { ND_noise2d_color4_1 as ND_noise2d_color4 }; - export namespace ND_noise2d_vector2_1 { - let node_968: string; - export { node_968 as node }; - export namespace inputs_968 { - let amplitude_47: string; - export { amplitude_47 as amplitude }; - let pivot_53: string; - export { pivot_53 as pivot }; - let texcoord_150: string; - export { texcoord_150 as texcoord }; - } - export { inputs_968 as inputs }; - export namespace outputs_968 { - let out_940: string; - export { out_940 as out }; - } - export { outputs_968 as outputs }; - } - export { ND_noise2d_vector2_1 as ND_noise2d_vector2 }; - export namespace ND_noise2d_vector3_1 { - let node_969: string; - export { node_969 as node }; - export namespace inputs_969 { - let amplitude_48: string; - export { amplitude_48 as amplitude }; - let pivot_54: string; - export { pivot_54 as pivot }; - let texcoord_151: string; - export { texcoord_151 as texcoord }; - } - export { inputs_969 as inputs }; - export namespace outputs_969 { - let out_941: string; - export { out_941 as out }; - } - export { outputs_969 as outputs }; - } - export { ND_noise2d_vector3_1 as ND_noise2d_vector3 }; - export namespace ND_noise2d_vector4_1 { - let node_970: string; - export { node_970 as node }; - export namespace inputs_970 { - let amplitude_49: string; - export { amplitude_49 as amplitude }; - let pivot_55: string; - export { pivot_55 as pivot }; - let texcoord_152: string; - export { texcoord_152 as texcoord }; - } - export { inputs_970 as inputs }; - export namespace outputs_970 { - let out_942: string; - export { out_942 as out }; - } - export { outputs_970 as outputs }; - } - export { ND_noise2d_vector4_1 as ND_noise2d_vector4 }; - export namespace ND_noise2d_color3FA_1 { - let node_971: string; - export { node_971 as node }; - export namespace inputs_971 { - let amplitude_50: string; - export { amplitude_50 as amplitude }; - let pivot_56: string; - export { pivot_56 as pivot }; - let texcoord_153: string; - export { texcoord_153 as texcoord }; - } - export { inputs_971 as inputs }; - export namespace outputs_971 { - let out_943: string; - export { out_943 as out }; - } - export { outputs_971 as outputs }; - } - export { ND_noise2d_color3FA_1 as ND_noise2d_color3FA }; - export namespace ND_noise2d_color4FA_1 { - let node_972: string; - export { node_972 as node }; - export namespace inputs_972 { - let amplitude_51: string; - export { amplitude_51 as amplitude }; - let pivot_57: string; - export { pivot_57 as pivot }; - let texcoord_154: string; - export { texcoord_154 as texcoord }; - } - export { inputs_972 as inputs }; - export namespace outputs_972 { - let out_944: string; - export { out_944 as out }; - } - export { outputs_972 as outputs }; - } - export { ND_noise2d_color4FA_1 as ND_noise2d_color4FA }; - export namespace ND_noise2d_vector2FA_1 { - let node_973: string; - export { node_973 as node }; - export namespace inputs_973 { - let amplitude_52: string; - export { amplitude_52 as amplitude }; - let pivot_58: string; - export { pivot_58 as pivot }; - let texcoord_155: string; - export { texcoord_155 as texcoord }; - } - export { inputs_973 as inputs }; - export namespace outputs_973 { - let out_945: string; - export { out_945 as out }; - } - export { outputs_973 as outputs }; - } - export { ND_noise2d_vector2FA_1 as ND_noise2d_vector2FA }; - export namespace ND_noise2d_vector3FA_1 { - let node_974: string; - export { node_974 as node }; - export namespace inputs_974 { - let amplitude_53: string; - export { amplitude_53 as amplitude }; - let pivot_59: string; - export { pivot_59 as pivot }; - let texcoord_156: string; - export { texcoord_156 as texcoord }; - } - export { inputs_974 as inputs }; - export namespace outputs_974 { - let out_946: string; - export { out_946 as out }; - } - export { outputs_974 as outputs }; - } - export { ND_noise2d_vector3FA_1 as ND_noise2d_vector3FA }; - export namespace ND_noise2d_vector4FA_1 { - let node_975: string; - export { node_975 as node }; - export namespace inputs_975 { - let amplitude_54: string; - export { amplitude_54 as amplitude }; - let pivot_60: string; - export { pivot_60 as pivot }; - let texcoord_157: string; - export { texcoord_157 as texcoord }; - } - export { inputs_975 as inputs }; - export namespace outputs_975 { - let out_947: string; - export { out_947 as out }; - } - export { outputs_975 as outputs }; - } - export { ND_noise2d_vector4FA_1 as ND_noise2d_vector4FA }; - export namespace ND_noise3d_float_1 { - let node_976: string; - export { node_976 as node }; - export namespace inputs_976 { - let amplitude_55: string; - export { amplitude_55 as amplitude }; - let pivot_61: string; - export { pivot_61 as pivot }; - let position_42: string; - export { position_42 as position }; - } - export { inputs_976 as inputs }; - export namespace outputs_976 { - let out_948: string; - export { out_948 as out }; - } - export { outputs_976 as outputs }; - } - export { ND_noise3d_float_1 as ND_noise3d_float }; - export namespace ND_noise3d_color3_1 { - let node_977: string; - export { node_977 as node }; - export namespace inputs_977 { - let amplitude_56: string; - export { amplitude_56 as amplitude }; - let pivot_62: string; - export { pivot_62 as pivot }; - let position_43: string; - export { position_43 as position }; - } - export { inputs_977 as inputs }; - export namespace outputs_977 { - let out_949: string; - export { out_949 as out }; - } - export { outputs_977 as outputs }; - } - export { ND_noise3d_color3_1 as ND_noise3d_color3 }; - export namespace ND_noise3d_color4_1 { - let node_978: string; - export { node_978 as node }; - export namespace inputs_978 { - let amplitude_57: string; - export { amplitude_57 as amplitude }; - let pivot_63: string; - export { pivot_63 as pivot }; - let position_44: string; - export { position_44 as position }; - } - export { inputs_978 as inputs }; - export namespace outputs_978 { - let out_950: string; - export { out_950 as out }; - } - export { outputs_978 as outputs }; - } - export { ND_noise3d_color4_1 as ND_noise3d_color4 }; - export namespace ND_noise3d_vector2_1 { - let node_979: string; - export { node_979 as node }; - export namespace inputs_979 { - let amplitude_58: string; - export { amplitude_58 as amplitude }; - let pivot_64: string; - export { pivot_64 as pivot }; - let position_45: string; - export { position_45 as position }; - } - export { inputs_979 as inputs }; - export namespace outputs_979 { - let out_951: string; - export { out_951 as out }; - } - export { outputs_979 as outputs }; - } - export { ND_noise3d_vector2_1 as ND_noise3d_vector2 }; - export namespace ND_noise3d_vector3_1 { - let node_980: string; - export { node_980 as node }; - export namespace inputs_980 { - let amplitude_59: string; - export { amplitude_59 as amplitude }; - let pivot_65: string; - export { pivot_65 as pivot }; - let position_46: string; - export { position_46 as position }; - } - export { inputs_980 as inputs }; - export namespace outputs_980 { - let out_952: string; - export { out_952 as out }; - } - export { outputs_980 as outputs }; - } - export { ND_noise3d_vector3_1 as ND_noise3d_vector3 }; - export namespace ND_noise3d_vector4_1 { - let node_981: string; - export { node_981 as node }; - export namespace inputs_981 { - let amplitude_60: string; - export { amplitude_60 as amplitude }; - let pivot_66: string; - export { pivot_66 as pivot }; - let position_47: string; - export { position_47 as position }; - } - export { inputs_981 as inputs }; - export namespace outputs_981 { - let out_953: string; - export { out_953 as out }; - } - export { outputs_981 as outputs }; - } - export { ND_noise3d_vector4_1 as ND_noise3d_vector4 }; - export namespace ND_noise3d_color3FA_1 { - let node_982: string; - export { node_982 as node }; - export namespace inputs_982 { - let amplitude_61: string; - export { amplitude_61 as amplitude }; - let pivot_67: string; - export { pivot_67 as pivot }; - let position_48: string; - export { position_48 as position }; - } - export { inputs_982 as inputs }; - export namespace outputs_982 { - let out_954: string; - export { out_954 as out }; - } - export { outputs_982 as outputs }; - } - export { ND_noise3d_color3FA_1 as ND_noise3d_color3FA }; - export namespace ND_noise3d_color4FA_1 { - let node_983: string; - export { node_983 as node }; - export namespace inputs_983 { - let amplitude_62: string; - export { amplitude_62 as amplitude }; - let pivot_68: string; - export { pivot_68 as pivot }; - let position_49: string; - export { position_49 as position }; - } - export { inputs_983 as inputs }; - export namespace outputs_983 { - let out_955: string; - export { out_955 as out }; - } - export { outputs_983 as outputs }; - } - export { ND_noise3d_color4FA_1 as ND_noise3d_color4FA }; - export namespace ND_noise3d_vector2FA_1 { - let node_984: string; - export { node_984 as node }; - export namespace inputs_984 { - let amplitude_63: string; - export { amplitude_63 as amplitude }; - let pivot_69: string; - export { pivot_69 as pivot }; - let position_50: string; - export { position_50 as position }; - } - export { inputs_984 as inputs }; - export namespace outputs_984 { - let out_956: string; - export { out_956 as out }; - } - export { outputs_984 as outputs }; - } - export { ND_noise3d_vector2FA_1 as ND_noise3d_vector2FA }; - export namespace ND_noise3d_vector3FA_1 { - let node_985: string; - export { node_985 as node }; - export namespace inputs_985 { - let amplitude_64: string; - export { amplitude_64 as amplitude }; - let pivot_70: string; - export { pivot_70 as pivot }; - let position_51: string; - export { position_51 as position }; - } - export { inputs_985 as inputs }; - export namespace outputs_985 { - let out_957: string; - export { out_957 as out }; - } - export { outputs_985 as outputs }; - } - export { ND_noise3d_vector3FA_1 as ND_noise3d_vector3FA }; - export namespace ND_noise3d_vector4FA_1 { - let node_986: string; - export { node_986 as node }; - export namespace inputs_986 { - let amplitude_65: string; - export { amplitude_65 as amplitude }; - let pivot_71: string; - export { pivot_71 as pivot }; - let position_52: string; - export { position_52 as position }; - } - export { inputs_986 as inputs }; - export namespace outputs_986 { - let out_958: string; - export { out_958 as out }; - } - export { outputs_986 as outputs }; - } - export { ND_noise3d_vector4FA_1 as ND_noise3d_vector4FA }; - export namespace ND_fractal2d_float_1 { - let node_987: string; - export { node_987 as node }; - export namespace inputs_987 { - let amplitude_66: string; - export { amplitude_66 as amplitude }; - let octaves_24: string; - export { octaves_24 as octaves }; - let lacunarity_24: string; - export { lacunarity_24 as lacunarity }; - let diminish_24: string; - export { diminish_24 as diminish }; - let texcoord_158: string; - export { texcoord_158 as texcoord }; - } - export { inputs_987 as inputs }; - export namespace outputs_987 { - let out_959: string; - export { out_959 as out }; - } - export { outputs_987 as outputs }; - } - export { ND_fractal2d_float_1 as ND_fractal2d_float }; - export namespace ND_fractal2d_color3_1 { - let node_988: string; - export { node_988 as node }; - export namespace inputs_988 { - let amplitude_67: string; - export { amplitude_67 as amplitude }; - let octaves_25: string; - export { octaves_25 as octaves }; - let lacunarity_25: string; - export { lacunarity_25 as lacunarity }; - let diminish_25: string; - export { diminish_25 as diminish }; - let texcoord_159: string; - export { texcoord_159 as texcoord }; - } - export { inputs_988 as inputs }; - export namespace outputs_988 { - let out_960: string; - export { out_960 as out }; - } - export { outputs_988 as outputs }; - } - export { ND_fractal2d_color3_1 as ND_fractal2d_color3 }; - export namespace ND_fractal2d_color4_1 { - let node_989: string; - export { node_989 as node }; - export namespace inputs_989 { - let amplitude_68: string; - export { amplitude_68 as amplitude }; - let octaves_26: string; - export { octaves_26 as octaves }; - let lacunarity_26: string; - export { lacunarity_26 as lacunarity }; - let diminish_26: string; - export { diminish_26 as diminish }; - let texcoord_160: string; - export { texcoord_160 as texcoord }; - } - export { inputs_989 as inputs }; - export namespace outputs_989 { - let out_961: string; - export { out_961 as out }; - } - export { outputs_989 as outputs }; - } - export { ND_fractal2d_color4_1 as ND_fractal2d_color4 }; - export namespace ND_fractal2d_vector2_1 { - let node_990: string; - export { node_990 as node }; - export namespace inputs_990 { - let amplitude_69: string; - export { amplitude_69 as amplitude }; - let octaves_27: string; - export { octaves_27 as octaves }; - let lacunarity_27: string; - export { lacunarity_27 as lacunarity }; - let diminish_27: string; - export { diminish_27 as diminish }; - let texcoord_161: string; - export { texcoord_161 as texcoord }; - } - export { inputs_990 as inputs }; - export namespace outputs_990 { - let out_962: string; - export { out_962 as out }; - } - export { outputs_990 as outputs }; - } - export { ND_fractal2d_vector2_1 as ND_fractal2d_vector2 }; - export namespace ND_fractal2d_vector3_1 { - let node_991: string; - export { node_991 as node }; - export namespace inputs_991 { - let amplitude_70: string; - export { amplitude_70 as amplitude }; - let octaves_28: string; - export { octaves_28 as octaves }; - let lacunarity_28: string; - export { lacunarity_28 as lacunarity }; - let diminish_28: string; - export { diminish_28 as diminish }; - let texcoord_162: string; - export { texcoord_162 as texcoord }; - } - export { inputs_991 as inputs }; - export namespace outputs_991 { - let out_963: string; - export { out_963 as out }; - } - export { outputs_991 as outputs }; - } - export { ND_fractal2d_vector3_1 as ND_fractal2d_vector3 }; - export namespace ND_fractal2d_vector4_1 { - let node_992: string; - export { node_992 as node }; - export namespace inputs_992 { - let amplitude_71: string; - export { amplitude_71 as amplitude }; - let octaves_29: string; - export { octaves_29 as octaves }; - let lacunarity_29: string; - export { lacunarity_29 as lacunarity }; - let diminish_29: string; - export { diminish_29 as diminish }; - let texcoord_163: string; - export { texcoord_163 as texcoord }; - } - export { inputs_992 as inputs }; - export namespace outputs_992 { - let out_964: string; - export { out_964 as out }; - } - export { outputs_992 as outputs }; - } - export { ND_fractal2d_vector4_1 as ND_fractal2d_vector4 }; - export namespace ND_fractal2d_color3FA_1 { - let node_993: string; - export { node_993 as node }; - export namespace inputs_993 { - let amplitude_72: string; - export { amplitude_72 as amplitude }; - let octaves_30: string; - export { octaves_30 as octaves }; - let lacunarity_30: string; - export { lacunarity_30 as lacunarity }; - let diminish_30: string; - export { diminish_30 as diminish }; - let texcoord_164: string; - export { texcoord_164 as texcoord }; - } - export { inputs_993 as inputs }; - export namespace outputs_993 { - let out_965: string; - export { out_965 as out }; - } - export { outputs_993 as outputs }; - } - export { ND_fractal2d_color3FA_1 as ND_fractal2d_color3FA }; - export namespace ND_fractal2d_color4FA_1 { - let node_994: string; - export { node_994 as node }; - export namespace inputs_994 { - let amplitude_73: string; - export { amplitude_73 as amplitude }; - let octaves_31: string; - export { octaves_31 as octaves }; - let lacunarity_31: string; - export { lacunarity_31 as lacunarity }; - let diminish_31: string; - export { diminish_31 as diminish }; - let texcoord_165: string; - export { texcoord_165 as texcoord }; - } - export { inputs_994 as inputs }; - export namespace outputs_994 { - let out_966: string; - export { out_966 as out }; - } - export { outputs_994 as outputs }; - } - export { ND_fractal2d_color4FA_1 as ND_fractal2d_color4FA }; - export namespace ND_fractal2d_vector2FA_1 { - let node_995: string; - export { node_995 as node }; - export namespace inputs_995 { - let amplitude_74: string; - export { amplitude_74 as amplitude }; - let octaves_32: string; - export { octaves_32 as octaves }; - let lacunarity_32: string; - export { lacunarity_32 as lacunarity }; - let diminish_32: string; - export { diminish_32 as diminish }; - let texcoord_166: string; - export { texcoord_166 as texcoord }; - } - export { inputs_995 as inputs }; - export namespace outputs_995 { - let out_967: string; - export { out_967 as out }; - } - export { outputs_995 as outputs }; - } - export { ND_fractal2d_vector2FA_1 as ND_fractal2d_vector2FA }; - export namespace ND_fractal2d_vector3FA_1 { - let node_996: string; - export { node_996 as node }; - export namespace inputs_996 { - let amplitude_75: string; - export { amplitude_75 as amplitude }; - let octaves_33: string; - export { octaves_33 as octaves }; - let lacunarity_33: string; - export { lacunarity_33 as lacunarity }; - let diminish_33: string; - export { diminish_33 as diminish }; - let texcoord_167: string; - export { texcoord_167 as texcoord }; - } - export { inputs_996 as inputs }; - export namespace outputs_996 { - let out_968: string; - export { out_968 as out }; - } - export { outputs_996 as outputs }; - } - export { ND_fractal2d_vector3FA_1 as ND_fractal2d_vector3FA }; - export namespace ND_fractal2d_vector4FA_1 { - let node_997: string; - export { node_997 as node }; - export namespace inputs_997 { - let amplitude_76: string; - export { amplitude_76 as amplitude }; - let octaves_34: string; - export { octaves_34 as octaves }; - let lacunarity_34: string; - export { lacunarity_34 as lacunarity }; - let diminish_34: string; - export { diminish_34 as diminish }; - let texcoord_168: string; - export { texcoord_168 as texcoord }; - } - export { inputs_997 as inputs }; - export namespace outputs_997 { - let out_969: string; - export { out_969 as out }; - } - export { outputs_997 as outputs }; - } - export { ND_fractal2d_vector4FA_1 as ND_fractal2d_vector4FA }; - export namespace ND_fractal3d_float_1 { - let node_998: string; - export { node_998 as node }; - export namespace inputs_998 { - let amplitude_77: string; - export { amplitude_77 as amplitude }; - let octaves_35: string; - export { octaves_35 as octaves }; - let lacunarity_35: string; - export { lacunarity_35 as lacunarity }; - let diminish_35: string; - export { diminish_35 as diminish }; - let position_53: string; - export { position_53 as position }; - } - export { inputs_998 as inputs }; - export namespace outputs_998 { - let out_970: string; - export { out_970 as out }; - } - export { outputs_998 as outputs }; - } - export { ND_fractal3d_float_1 as ND_fractal3d_float }; - export namespace ND_fractal3d_color3_1 { - let node_999: string; - export { node_999 as node }; - export namespace inputs_999 { - let amplitude_78: string; - export { amplitude_78 as amplitude }; - let octaves_36: string; - export { octaves_36 as octaves }; - let lacunarity_36: string; - export { lacunarity_36 as lacunarity }; - let diminish_36: string; - export { diminish_36 as diminish }; - let position_54: string; - export { position_54 as position }; - } - export { inputs_999 as inputs }; - export namespace outputs_999 { - let out_971: string; - export { out_971 as out }; - } - export { outputs_999 as outputs }; - } - export { ND_fractal3d_color3_1 as ND_fractal3d_color3 }; - export namespace ND_fractal3d_color4_1 { - let node_1000: string; - export { node_1000 as node }; - export namespace inputs_1000 { - let amplitude_79: string; - export { amplitude_79 as amplitude }; - let octaves_37: string; - export { octaves_37 as octaves }; - let lacunarity_37: string; - export { lacunarity_37 as lacunarity }; - let diminish_37: string; - export { diminish_37 as diminish }; - let position_55: string; - export { position_55 as position }; - } - export { inputs_1000 as inputs }; - export namespace outputs_1000 { - let out_972: string; - export { out_972 as out }; - } - export { outputs_1000 as outputs }; - } - export { ND_fractal3d_color4_1 as ND_fractal3d_color4 }; - export namespace ND_fractal3d_vector2_1 { - let node_1001: string; - export { node_1001 as node }; - export namespace inputs_1001 { - let amplitude_80: string; - export { amplitude_80 as amplitude }; - let octaves_38: string; - export { octaves_38 as octaves }; - let lacunarity_38: string; - export { lacunarity_38 as lacunarity }; - let diminish_38: string; - export { diminish_38 as diminish }; - let position_56: string; - export { position_56 as position }; - } - export { inputs_1001 as inputs }; - export namespace outputs_1001 { - let out_973: string; - export { out_973 as out }; - } - export { outputs_1001 as outputs }; - } - export { ND_fractal3d_vector2_1 as ND_fractal3d_vector2 }; - export namespace ND_fractal3d_vector3_1 { - let node_1002: string; - export { node_1002 as node }; - export namespace inputs_1002 { - let amplitude_81: string; - export { amplitude_81 as amplitude }; - let octaves_39: string; - export { octaves_39 as octaves }; - let lacunarity_39: string; - export { lacunarity_39 as lacunarity }; - let diminish_39: string; - export { diminish_39 as diminish }; - let position_57: string; - export { position_57 as position }; - } - export { inputs_1002 as inputs }; - export namespace outputs_1002 { - let out_974: string; - export { out_974 as out }; - } - export { outputs_1002 as outputs }; - } - export { ND_fractal3d_vector3_1 as ND_fractal3d_vector3 }; - export namespace ND_fractal3d_vector4_1 { - let node_1003: string; - export { node_1003 as node }; - export namespace inputs_1003 { - let amplitude_82: string; - export { amplitude_82 as amplitude }; - let octaves_40: string; - export { octaves_40 as octaves }; - let lacunarity_40: string; - export { lacunarity_40 as lacunarity }; - let diminish_40: string; - export { diminish_40 as diminish }; - let position_58: string; - export { position_58 as position }; - } - export { inputs_1003 as inputs }; - export namespace outputs_1003 { - let out_975: string; - export { out_975 as out }; - } - export { outputs_1003 as outputs }; - } - export { ND_fractal3d_vector4_1 as ND_fractal3d_vector4 }; - export namespace ND_fractal3d_color3FA_1 { - let node_1004: string; - export { node_1004 as node }; - export namespace inputs_1004 { - let amplitude_83: string; - export { amplitude_83 as amplitude }; - let octaves_41: string; - export { octaves_41 as octaves }; - let lacunarity_41: string; - export { lacunarity_41 as lacunarity }; - let diminish_41: string; - export { diminish_41 as diminish }; - let position_59: string; - export { position_59 as position }; - } - export { inputs_1004 as inputs }; - export namespace outputs_1004 { - let out_976: string; - export { out_976 as out }; - } - export { outputs_1004 as outputs }; - } - export { ND_fractal3d_color3FA_1 as ND_fractal3d_color3FA }; - export namespace ND_fractal3d_color4FA_1 { - let node_1005: string; - export { node_1005 as node }; - export namespace inputs_1005 { - let amplitude_84: string; - export { amplitude_84 as amplitude }; - let octaves_42: string; - export { octaves_42 as octaves }; - let lacunarity_42: string; - export { lacunarity_42 as lacunarity }; - let diminish_42: string; - export { diminish_42 as diminish }; - let position_60: string; - export { position_60 as position }; - } - export { inputs_1005 as inputs }; - export namespace outputs_1005 { - let out_977: string; - export { out_977 as out }; - } - export { outputs_1005 as outputs }; - } - export { ND_fractal3d_color4FA_1 as ND_fractal3d_color4FA }; - export namespace ND_fractal3d_vector2FA_1 { - let node_1006: string; - export { node_1006 as node }; - export namespace inputs_1006 { - let amplitude_85: string; - export { amplitude_85 as amplitude }; - let octaves_43: string; - export { octaves_43 as octaves }; - let lacunarity_43: string; - export { lacunarity_43 as lacunarity }; - let diminish_43: string; - export { diminish_43 as diminish }; - let position_61: string; - export { position_61 as position }; - } - export { inputs_1006 as inputs }; - export namespace outputs_1006 { - let out_978: string; - export { out_978 as out }; - } - export { outputs_1006 as outputs }; - } - export { ND_fractal3d_vector2FA_1 as ND_fractal3d_vector2FA }; - export namespace ND_fractal3d_vector3FA_1 { - let node_1007: string; - export { node_1007 as node }; - export namespace inputs_1007 { - let amplitude_86: string; - export { amplitude_86 as amplitude }; - let octaves_44: string; - export { octaves_44 as octaves }; - let lacunarity_44: string; - export { lacunarity_44 as lacunarity }; - let diminish_44: string; - export { diminish_44 as diminish }; - let position_62: string; - export { position_62 as position }; - } - export { inputs_1007 as inputs }; - export namespace outputs_1007 { - let out_979: string; - export { out_979 as out }; - } - export { outputs_1007 as outputs }; - } - export { ND_fractal3d_vector3FA_1 as ND_fractal3d_vector3FA }; - export namespace ND_fractal3d_vector4FA_1 { - let node_1008: string; - export { node_1008 as node }; - export namespace inputs_1008 { - let amplitude_87: string; - export { amplitude_87 as amplitude }; - let octaves_45: string; - export { octaves_45 as octaves }; - let lacunarity_45: string; - export { lacunarity_45 as lacunarity }; - let diminish_45: string; - export { diminish_45 as diminish }; - let position_63: string; - export { position_63 as position }; - } - export { inputs_1008 as inputs }; - export namespace outputs_1008 { - let out_980: string; - export { out_980 as out }; - } - export { outputs_1008 as outputs }; - } - export { ND_fractal3d_vector4FA_1 as ND_fractal3d_vector4FA }; - export namespace ND_cellnoise2d_float_1 { - let node_1009: string; - export { node_1009 as node }; - export namespace inputs_1009 { - let texcoord_169: string; - export { texcoord_169 as texcoord }; - } - export { inputs_1009 as inputs }; - export namespace outputs_1009 { - let out_981: string; - export { out_981 as out }; - } - export { outputs_1009 as outputs }; - } - export { ND_cellnoise2d_float_1 as ND_cellnoise2d_float }; - export namespace ND_cellnoise3d_float_1 { - let node_1010: string; - export { node_1010 as node }; - export namespace inputs_1010 { - let position_64: string; - export { position_64 as position }; - } - export { inputs_1010 as inputs }; - export namespace outputs_1010 { - let out_982: string; - export { out_982 as out }; - } - export { outputs_1010 as outputs }; - } - export { ND_cellnoise3d_float_1 as ND_cellnoise3d_float }; - export namespace ND_worleynoise2d_float_1 { - let node_1011: string; - export { node_1011 as node }; - export namespace inputs_1011 { - let texcoord_170: string; - export { texcoord_170 as texcoord }; - let jitter_8: string; - export { jitter_8 as jitter }; - let style_8: string; - export { style_8 as style }; - } - export { inputs_1011 as inputs }; - export namespace outputs_1011 { - let out_983: string; - export { out_983 as out }; - } - export { outputs_1011 as outputs }; - } - export { ND_worleynoise2d_float_1 as ND_worleynoise2d_float }; - export namespace ND_worleynoise2d_vector2_1 { - let node_1012: string; - export { node_1012 as node }; - export namespace inputs_1012 { - let texcoord_171: string; - export { texcoord_171 as texcoord }; - let jitter_9: string; - export { jitter_9 as jitter }; - let style_9: string; - export { style_9 as style }; - } - export { inputs_1012 as inputs }; - export namespace outputs_1012 { - let out_984: string; - export { out_984 as out }; - } - export { outputs_1012 as outputs }; - } - export { ND_worleynoise2d_vector2_1 as ND_worleynoise2d_vector2 }; - export namespace ND_worleynoise2d_vector3_1 { - let node_1013: string; - export { node_1013 as node }; - export namespace inputs_1013 { - let texcoord_172: string; - export { texcoord_172 as texcoord }; - let jitter_10: string; - export { jitter_10 as jitter }; - let style_10: string; - export { style_10 as style }; - } - export { inputs_1013 as inputs }; - export namespace outputs_1013 { - let out_985: string; - export { out_985 as out }; - } - export { outputs_1013 as outputs }; - } - export { ND_worleynoise2d_vector3_1 as ND_worleynoise2d_vector3 }; - export namespace ND_worleynoise3d_float_1 { - let node_1014: string; - export { node_1014 as node }; - export namespace inputs_1014 { - let position_65: string; - export { position_65 as position }; - let jitter_11: string; - export { jitter_11 as jitter }; - let style_11: string; - export { style_11 as style }; - } - export { inputs_1014 as inputs }; - export namespace outputs_1014 { - let out_986: string; - export { out_986 as out }; - } - export { outputs_1014 as outputs }; - } - export { ND_worleynoise3d_float_1 as ND_worleynoise3d_float }; - export namespace ND_worleynoise3d_vector2_1 { - let node_1015: string; - export { node_1015 as node }; - export namespace inputs_1015 { - let position_66: string; - export { position_66 as position }; - let jitter_12: string; - export { jitter_12 as jitter }; - let style_12: string; - export { style_12 as style }; - } - export { inputs_1015 as inputs }; - export namespace outputs_1015 { - let out_987: string; - export { out_987 as out }; - } - export { outputs_1015 as outputs }; - } - export { ND_worleynoise3d_vector2_1 as ND_worleynoise3d_vector2 }; - export namespace ND_worleynoise3d_vector3_1 { - let node_1016: string; - export { node_1016 as node }; - export namespace inputs_1016 { - let position_67: string; - export { position_67 as position }; - let jitter_13: string; - export { jitter_13 as jitter }; - let style_13: string; - export { style_13 as style }; - } - export { inputs_1016 as inputs }; - export namespace outputs_1016 { - let out_988: string; - export { out_988 as out }; - } - export { outputs_1016 as outputs }; - } - export { ND_worleynoise3d_vector3_1 as ND_worleynoise3d_vector3 }; - export namespace ND_unifiednoise2d_float_1 { - let node_1017: string; - export { node_1017 as node }; - export namespace inputs_1017 { - let texcoord_173: string; - export { texcoord_173 as texcoord }; - let freq_2: string; - export { freq_2 as freq }; - let offset_24: string; - export { offset_24 as offset }; - let jitter_14: string; - export { jitter_14 as jitter }; - let outmin_2: string; - export { outmin_2 as outmin }; - let outmax_2: string; - export { outmax_2 as outmax }; - let clampoutput_2: string; - export { clampoutput_2 as clampoutput }; - let octaves_46: string; - export { octaves_46 as octaves }; - let lacunarity_46: string; - export { lacunarity_46 as lacunarity }; - let diminish_46: string; - export { diminish_46 as diminish }; - let type_4: string; - export { type_4 as type }; - let style_14: string; - export { style_14 as style }; - } - export { inputs_1017 as inputs }; - export namespace outputs_1017 { - let out_989: string; - export { out_989 as out }; - } - export { outputs_1017 as outputs }; - } - export { ND_unifiednoise2d_float_1 as ND_unifiednoise2d_float }; - export namespace ND_unifiednoise3d_float_1 { - let node_1018: string; - export { node_1018 as node }; - export namespace inputs_1018 { - let position_68: string; - export { position_68 as position }; - let freq_3: string; - export { freq_3 as freq }; - let offset_25: string; - export { offset_25 as offset }; - let jitter_15: string; - export { jitter_15 as jitter }; - let outmin_3: string; - export { outmin_3 as outmin }; - let outmax_3: string; - export { outmax_3 as outmax }; - let clampoutput_3: string; - export { clampoutput_3 as clampoutput }; - let octaves_47: string; - export { octaves_47 as octaves }; - let lacunarity_47: string; - export { lacunarity_47 as lacunarity }; - let diminish_47: string; - export { diminish_47 as diminish }; - let type_5: string; - export { type_5 as type }; - let style_15: string; - export { style_15 as style }; - } - export { inputs_1018 as inputs }; - export namespace outputs_1018 { - let out_990: string; - export { out_990 as out }; - } - export { outputs_1018 as outputs }; - } - export { ND_unifiednoise3d_float_1 as ND_unifiednoise3d_float }; - export namespace ND_flake2d_1 { - let node_1019: string; - export { node_1019 as node }; - export namespace inputs_1019 { - let size_11: string; - export { size_11 as size }; - let roughness_33: string; - export { roughness_33 as roughness }; - let coverage_2: string; - export { coverage_2 as coverage }; - let texcoord_174: string; - export { texcoord_174 as texcoord }; - let normal_60: string; - export { normal_60 as normal }; - let tangent_18: string; - export { tangent_18 as tangent }; - let bitangent_6: string; - export { bitangent_6 as bitangent }; - } - export { inputs_1019 as inputs }; - export namespace outputs_1019 { - let id_2: string; - export { id_2 as id }; - let rand_2: string; - export { rand_2 as rand }; - let presence_3: string; - export { presence_3 as presence }; - let flakenormal_2: string; - export { flakenormal_2 as flakenormal }; - } - export { outputs_1019 as outputs }; - } - export { ND_flake2d_1 as ND_flake2d }; - export namespace ND_flake3d_1 { - let node_1020: string; - export { node_1020 as node }; - export namespace inputs_1020 { - let size_12: string; - export { size_12 as size }; - let roughness_34: string; - export { roughness_34 as roughness }; - let coverage_3: string; - export { coverage_3 as coverage }; - let position_69: string; - export { position_69 as position }; - let normal_61: string; - export { normal_61 as normal }; - let tangent_19: string; - export { tangent_19 as tangent }; - let bitangent_7: string; - export { bitangent_7 as bitangent }; - } - export { inputs_1020 as inputs }; - export namespace outputs_1020 { - let id_3: string; - export { id_3 as id }; - let rand_3: string; - export { rand_3 as rand }; - let presence_4: string; - export { presence_4 as presence }; - let flakenormal_3: string; - export { flakenormal_3 as flakenormal }; - } - export { outputs_1020 as outputs }; - } - export { ND_flake3d_1 as ND_flake3d }; - export namespace ND_randomfloat_float_1 { - let node_1021: string; - export { node_1021 as node }; - export namespace inputs_1021 { - let _in_312: string; - export { _in_312 as in }; - let min_2: string; - export { min_2 as min }; - let max_2: string; - export { max_2 as max }; - let seed_4: string; - export { seed_4 as seed }; - } - export { inputs_1021 as inputs }; - export namespace outputs_1021 { - let out_991: string; - export { out_991 as out }; - } - export { outputs_1021 as outputs }; - } - export { ND_randomfloat_float_1 as ND_randomfloat_float }; - export namespace ND_randomfloat_integer_1 { - let node_1022: string; - export { node_1022 as node }; - export namespace inputs_1022 { - let _in_313: string; - export { _in_313 as in }; - let min_3: string; - export { min_3 as min }; - let max_3: string; - export { max_3 as max }; - let seed_5: string; - export { seed_5 as seed }; - } - export { inputs_1022 as inputs }; - export namespace outputs_1022 { - let out_992: string; - export { out_992 as out }; - } - export { outputs_1022 as outputs }; - } - export { ND_randomfloat_integer_1 as ND_randomfloat_integer }; - export namespace ND_randomcolor_float_1 { - let node_1023: string; - export { node_1023 as node }; - export namespace inputs_1023 { - let _in_314: string; - export { _in_314 as in }; - let huelow_2: string; - export { huelow_2 as huelow }; - let huehigh_2: string; - export { huehigh_2 as huehigh }; - let saturationlow_2: string; - export { saturationlow_2 as saturationlow }; - let saturationhigh_2: string; - export { saturationhigh_2 as saturationhigh }; - let brightnesslow_2: string; - export { brightnesslow_2 as brightnesslow }; - let brightnesshigh_2: string; - export { brightnesshigh_2 as brightnesshigh }; - let seed_6: string; - export { seed_6 as seed }; - } - export { inputs_1023 as inputs }; - export namespace outputs_1023 { - let out_993: string; - export { out_993 as out }; - } - export { outputs_1023 as outputs }; - } - export { ND_randomcolor_float_1 as ND_randomcolor_float }; - export namespace ND_randomcolor_integer_1 { - let node_1024: string; - export { node_1024 as node }; - export namespace inputs_1024 { - let _in_315: string; - export { _in_315 as in }; - let huelow_3: string; - export { huelow_3 as huelow }; - let huehigh_3: string; - export { huehigh_3 as huehigh }; - let saturationlow_3: string; - export { saturationlow_3 as saturationlow }; - let saturationhigh_3: string; - export { saturationhigh_3 as saturationhigh }; - let brightnesslow_3: string; - export { brightnesslow_3 as brightnesslow }; - let brightnesshigh_3: string; - export { brightnesshigh_3 as brightnesshigh }; - let seed_7: string; - export { seed_7 as seed }; - } - export { inputs_1024 as inputs }; - export namespace outputs_1024 { - let out_994: string; - export { out_994 as out }; - } - export { outputs_1024 as outputs }; - } - export { ND_randomcolor_integer_1 as ND_randomcolor_integer }; - export namespace ND_checkerboard_color3_1 { - let node_1025: string; - export { node_1025 as node }; - export namespace inputs_1025 { - let color1_5: string; - export { color1_5 as color1 }; - let color2_5: string; - export { color2_5 as color2 }; - let uvtiling_18: string; - export { uvtiling_18 as uvtiling }; - let uvoffset_18: string; - export { uvoffset_18 as uvoffset }; - let texcoord_175: string; - export { texcoord_175 as texcoord }; - } - export { inputs_1025 as inputs }; - export namespace outputs_1025 { - let out_995: string; - export { out_995 as out }; - } - export { outputs_1025 as outputs }; - } - export { ND_checkerboard_color3_1 as ND_checkerboard_color3 }; - export namespace ND_line_float_1 { - let node_1026: string; - export { node_1026 as node }; - export namespace inputs_1026 { - let texcoord_176: string; - export { texcoord_176 as texcoord }; - let center_28: string; - export { center_28 as center }; - let radius_6: string; - export { radius_6 as radius }; - let point1_1: string; - export { point1_1 as point1 }; - let point2_1: string; - export { point2_1 as point2 }; - } - export { inputs_1026 as inputs }; - export namespace outputs_1026 { - let out_996: string; - export { out_996 as out }; - } - export { outputs_1026 as outputs }; - } - export { ND_line_float_1 as ND_line_float }; - export namespace ND_circle_float_1 { - let node_1027: string; - export { node_1027 as node }; - export namespace inputs_1027 { - let texcoord_177: string; - export { texcoord_177 as texcoord }; - let center_29: string; - export { center_29 as center }; - let radius_7: string; - export { radius_7 as radius }; - } - export { inputs_1027 as inputs }; - export namespace outputs_1027 { - let out_997: string; - export { out_997 as out }; - } - export { outputs_1027 as outputs }; - } - export { ND_circle_float_1 as ND_circle_float }; - export namespace ND_cloverleaf_float_1 { - let node_1028: string; - export { node_1028 as node }; - export namespace inputs_1028 { - let texcoord_178: string; - export { texcoord_178 as texcoord }; - let center_30: string; - export { center_30 as center }; - let radius_8: string; - export { radius_8 as radius }; - } - export { inputs_1028 as inputs }; - export namespace outputs_1028 { - let out_998: string; - export { out_998 as out }; - } - export { outputs_1028 as outputs }; - } - export { ND_cloverleaf_float_1 as ND_cloverleaf_float }; - export namespace ND_hexagon_float_1 { - let node_1029: string; - export { node_1029 as node }; - export namespace inputs_1029 { - let texcoord_179: string; - export { texcoord_179 as texcoord }; - let center_31: string; - export { center_31 as center }; - let radius_9: string; - export { radius_9 as radius }; - } - export { inputs_1029 as inputs }; - export namespace outputs_1029 { - let out_999: string; - export { out_999 as out }; - } - export { outputs_1029 as outputs }; - } - export { ND_hexagon_float_1 as ND_hexagon_float }; - export namespace ND_grid_color3_1 { - let node_1030: string; - export { node_1030 as node }; - export namespace inputs_1030 { - let texcoord_180: string; - export { texcoord_180 as texcoord }; - let uvtiling_19: string; - export { uvtiling_19 as uvtiling }; - let uvoffset_19: string; - export { uvoffset_19 as uvoffset }; - let thickness_4: string; - export { thickness_4 as thickness }; - let staggered_5: string; - export { staggered_5 as staggered }; - } - export { inputs_1030 as inputs }; - export namespace outputs_1030 { - let out_1000: string; - export { out_1000 as out }; - } - export { outputs_1030 as outputs }; - } - export { ND_grid_color3_1 as ND_grid_color3 }; - export namespace ND_crosshatch_color3_1 { - let node_1031: string; - export { node_1031 as node }; - export namespace inputs_1031 { - let texcoord_181: string; - export { texcoord_181 as texcoord }; - let uvtiling_20: string; - export { uvtiling_20 as uvtiling }; - let uvoffset_20: string; - export { uvoffset_20 as uvoffset }; - let thickness_5: string; - export { thickness_5 as thickness }; - let staggered_6: string; - export { staggered_6 as staggered }; - } - export { inputs_1031 as inputs }; - export namespace outputs_1031 { - let out_1001: string; - export { out_1001 as out }; - } - export { outputs_1031 as outputs }; - } - export { ND_crosshatch_color3_1 as ND_crosshatch_color3 }; - export namespace ND_tiledcircles_color3_1 { - let node_1032: string; - export { node_1032 as node }; - export namespace inputs_1032 { - let texcoord_182: string; - export { texcoord_182 as texcoord }; - let uvtiling_21: string; - export { uvtiling_21 as uvtiling }; - let uvoffset_21: string; - export { uvoffset_21 as uvoffset }; - let size_13: string; - export { size_13 as size }; - let staggered_7: string; - export { staggered_7 as staggered }; - } - export { inputs_1032 as inputs }; - export namespace outputs_1032 { - let out_1002: string; - export { out_1002 as out }; - } - export { outputs_1032 as outputs }; - } - export { ND_tiledcircles_color3_1 as ND_tiledcircles_color3 }; - export namespace ND_tiledcloverleafs_color3_1 { - let node_1033: string; - export { node_1033 as node }; - export namespace inputs_1033 { - let texcoord_183: string; - export { texcoord_183 as texcoord }; - let uvtiling_22: string; - export { uvtiling_22 as uvtiling }; - let uvoffset_22: string; - export { uvoffset_22 as uvoffset }; - let size_14: string; - export { size_14 as size }; - let staggered_8: string; - export { staggered_8 as staggered }; - } - export { inputs_1033 as inputs }; - export namespace outputs_1033 { - let out_1003: string; - export { out_1003 as out }; - } - export { outputs_1033 as outputs }; - } - export { ND_tiledcloverleafs_color3_1 as ND_tiledcloverleafs_color3 }; - export namespace ND_tiledhexagons_color3_1 { - let node_1034: string; - export { node_1034 as node }; - export namespace inputs_1034 { - let texcoord_184: string; - export { texcoord_184 as texcoord }; - let uvtiling_23: string; - export { uvtiling_23 as uvtiling }; - let uvoffset_23: string; - export { uvoffset_23 as uvoffset }; - let size_15: string; - export { size_15 as size }; - let staggered_9: string; - export { staggered_9 as staggered }; - } - export { inputs_1034 as inputs }; - export namespace outputs_1034 { - let out_1004: string; - export { out_1004 as out }; - } - export { outputs_1034 as outputs }; - } - export { ND_tiledhexagons_color3_1 as ND_tiledhexagons_color3 }; - export namespace ND_position_vector3_1 { - let node_1035: string; - export { node_1035 as node }; - export namespace inputs_1035 { - let space_6: string; - export { space_6 as space }; - } - export { inputs_1035 as inputs }; - export namespace outputs_1035 { - let out_1005: string; - export { out_1005 as out }; - } - export { outputs_1035 as outputs }; - } - export { ND_position_vector3_1 as ND_position_vector3 }; - export namespace ND_normal_vector3_1 { - let node_1036: string; - export { node_1036 as node }; - export namespace inputs_1036 { - let space_7: string; - export { space_7 as space }; - } - export { inputs_1036 as inputs }; - export namespace outputs_1036 { - let out_1006: string; - export { out_1006 as out }; - } - export { outputs_1036 as outputs }; - } - export { ND_normal_vector3_1 as ND_normal_vector3 }; - export namespace ND_tangent_vector3_1 { - let node_1037: string; - export { node_1037 as node }; - export namespace inputs_1037 { - let space_8: string; - export { space_8 as space }; - let index_14: string; - export { index_14 as index }; - } - export { inputs_1037 as inputs }; - export namespace outputs_1037 { - let out_1007: string; - export { out_1007 as out }; - } - export { outputs_1037 as outputs }; - } - export { ND_tangent_vector3_1 as ND_tangent_vector3 }; - export namespace ND_bitangent_vector3_1 { - let node_1038: string; - export { node_1038 as node }; - export namespace inputs_1038 { - let space_9: string; - export { space_9 as space }; - let index_15: string; - export { index_15 as index }; - } - export { inputs_1038 as inputs }; - export namespace outputs_1038 { - let out_1008: string; - export { out_1008 as out }; - } - export { outputs_1038 as outputs }; - } - export { ND_bitangent_vector3_1 as ND_bitangent_vector3 }; - export namespace ND_texcoord_vector2_1 { - let node_1039: string; - export { node_1039 as node }; - export namespace inputs_1039 { - let index_16: string; - export { index_16 as index }; - } - export { inputs_1039 as inputs }; - export namespace outputs_1039 { - let out_1009: string; - export { out_1009 as out }; - } - export { outputs_1039 as outputs }; - } - export { ND_texcoord_vector2_1 as ND_texcoord_vector2 }; - export namespace ND_texcoord_vector3_1 { - let node_1040: string; - export { node_1040 as node }; - export namespace inputs_1040 { - let index_17: string; - export { index_17 as index }; - } - export { inputs_1040 as inputs }; - export namespace outputs_1040 { - let out_1010: string; - export { out_1010 as out }; - } - export { outputs_1040 as outputs }; - } - export { ND_texcoord_vector3_1 as ND_texcoord_vector3 }; - export namespace ND_geomcolor_float_1 { - let node_1041: string; - export { node_1041 as node }; - export namespace inputs_1041 { - let index_18: string; - export { index_18 as index }; - } - export { inputs_1041 as inputs }; - export namespace outputs_1041 { - let out_1011: string; - export { out_1011 as out }; - } - export { outputs_1041 as outputs }; - } - export { ND_geomcolor_float_1 as ND_geomcolor_float }; - export namespace ND_geomcolor_color3_1 { - let node_1042: string; - export { node_1042 as node }; - export namespace inputs_1042 { - let index_19: string; - export { index_19 as index }; - } - export { inputs_1042 as inputs }; - export namespace outputs_1042 { - let out_1012: string; - export { out_1012 as out }; - } - export { outputs_1042 as outputs }; - } - export { ND_geomcolor_color3_1 as ND_geomcolor_color3 }; - export namespace ND_geomcolor_color4_1 { - let node_1043: string; - export { node_1043 as node }; - export namespace inputs_1043 { - let index_20: string; - export { index_20 as index }; - } - export { inputs_1043 as inputs }; - export namespace outputs_1043 { - let out_1013: string; - export { out_1013 as out }; - } - export { outputs_1043 as outputs }; - } - export { ND_geomcolor_color4_1 as ND_geomcolor_color4 }; - export namespace ND_geompropvalue_integer_1 { - let node_1044: string; - export { node_1044 as node }; - export namespace inputs_1044 { - let geomprop_10: string; - export { geomprop_10 as geomprop }; - let _default_69: string; - export { _default_69 as default }; - } - export { inputs_1044 as inputs }; - export namespace outputs_1044 { - let out_1014: string; - export { out_1014 as out }; - } - export { outputs_1044 as outputs }; - } - export { ND_geompropvalue_integer_1 as ND_geompropvalue_integer }; - export namespace ND_geompropvalue_boolean_1 { - let node_1045: string; - export { node_1045 as node }; - export namespace inputs_1045 { - let geomprop_11: string; - export { geomprop_11 as geomprop }; - let _default_70: string; - export { _default_70 as default }; - } - export { inputs_1045 as inputs }; - export namespace outputs_1045 { - let out_1015: string; - export { out_1015 as out }; - } - export { outputs_1045 as outputs }; - } - export { ND_geompropvalue_boolean_1 as ND_geompropvalue_boolean }; - export namespace ND_geompropvalue_float_1 { - let node_1046: string; - export { node_1046 as node }; - export namespace inputs_1046 { - let geomprop_12: string; - export { geomprop_12 as geomprop }; - let _default_71: string; - export { _default_71 as default }; - } - export { inputs_1046 as inputs }; - export namespace outputs_1046 { - let out_1016: string; - export { out_1016 as out }; - } - export { outputs_1046 as outputs }; - } - export { ND_geompropvalue_float_1 as ND_geompropvalue_float }; - export namespace ND_geompropvalue_color3_1 { - let node_1047: string; - export { node_1047 as node }; - export namespace inputs_1047 { - let geomprop_13: string; - export { geomprop_13 as geomprop }; - let _default_72: string; - export { _default_72 as default }; - } - export { inputs_1047 as inputs }; - export namespace outputs_1047 { - let out_1017: string; - export { out_1017 as out }; - } - export { outputs_1047 as outputs }; - } - export { ND_geompropvalue_color3_1 as ND_geompropvalue_color3 }; - export namespace ND_geompropvalue_color4_1 { - let node_1048: string; - export { node_1048 as node }; - export namespace inputs_1048 { - let geomprop_14: string; - export { geomprop_14 as geomprop }; - let _default_73: string; - export { _default_73 as default }; - } - export { inputs_1048 as inputs }; - export namespace outputs_1048 { - let out_1018: string; - export { out_1018 as out }; - } - export { outputs_1048 as outputs }; - } - export { ND_geompropvalue_color4_1 as ND_geompropvalue_color4 }; - export namespace ND_geompropvalue_vector2_1 { - let node_1049: string; - export { node_1049 as node }; - export namespace inputs_1049 { - let geomprop_15: string; - export { geomprop_15 as geomprop }; - let _default_74: string; - export { _default_74 as default }; - } - export { inputs_1049 as inputs }; - export namespace outputs_1049 { - let out_1019: string; - export { out_1019 as out }; - } - export { outputs_1049 as outputs }; - } - export { ND_geompropvalue_vector2_1 as ND_geompropvalue_vector2 }; - export namespace ND_geompropvalue_vector3_1 { - let node_1050: string; - export { node_1050 as node }; - export namespace inputs_1050 { - let geomprop_16: string; - export { geomprop_16 as geomprop }; - let _default_75: string; - export { _default_75 as default }; - } - export { inputs_1050 as inputs }; - export namespace outputs_1050 { - let out_1020: string; - export { out_1020 as out }; - } - export { outputs_1050 as outputs }; - } - export { ND_geompropvalue_vector3_1 as ND_geompropvalue_vector3 }; - export namespace ND_geompropvalue_vector4_1 { - let node_1051: string; - export { node_1051 as node }; - export namespace inputs_1051 { - let geomprop_17: string; - export { geomprop_17 as geomprop }; - let _default_76: string; - export { _default_76 as default }; - } - export { inputs_1051 as inputs }; - export namespace outputs_1051 { - let out_1021: string; - export { out_1021 as out }; - } - export { outputs_1051 as outputs }; - } - export { ND_geompropvalue_vector4_1 as ND_geompropvalue_vector4 }; - export namespace ND_geompropvalueuniform_string_1 { - let node_1052: string; - export { node_1052 as node }; - export namespace inputs_1052 { - let geomprop_18: string; - export { geomprop_18 as geomprop }; - let _default_77: string; - export { _default_77 as default }; - } - export { inputs_1052 as inputs }; - export namespace outputs_1052 { - let out_1022: string; - export { out_1022 as out }; - } - export { outputs_1052 as outputs }; - } - export { ND_geompropvalueuniform_string_1 as ND_geompropvalueuniform_string }; - export namespace ND_geompropvalueuniform_filename_1 { - let node_1053: string; - export { node_1053 as node }; - export namespace inputs_1053 { - let geomprop_19: string; - export { geomprop_19 as geomprop }; - let _default_78: string; - export { _default_78 as default }; - } - export { inputs_1053 as inputs }; - export namespace outputs_1053 { - let out_1023: string; - export { out_1023 as out }; - } - export { outputs_1053 as outputs }; - } - export { ND_geompropvalueuniform_filename_1 as ND_geompropvalueuniform_filename }; - export namespace ND_bump_vector3_1 { - let node_1054: string; - export { node_1054 as node }; - export namespace inputs_1054 { - let height_1: string; - export { height_1 as height }; - let scale_35: string; - export { scale_35 as scale }; - let normal_62: string; - export { normal_62 as normal }; - let tangent_20: string; - export { tangent_20 as tangent }; - let bitangent_8: string; - export { bitangent_8 as bitangent }; - } - export { inputs_1054 as inputs }; - export namespace outputs_1054 { - let out_1024: string; - export { out_1024 as out }; - } - export { outputs_1054 as outputs }; - } - export { ND_bump_vector3_1 as ND_bump_vector3 }; - export namespace ND_frame_float_1 { - let node_1055: string; - export { node_1055 as node }; - let inputs_1055: {}; - export { inputs_1055 as inputs }; - export namespace outputs_1055 { - let out_1025: string; - export { out_1025 as out }; - } - export { outputs_1055 as outputs }; - } - export { ND_frame_float_1 as ND_frame_float }; - export namespace ND_time_float_1 { - let node_1056: string; - export { node_1056 as node }; - export namespace inputs_1056 { - let fps_1: string; - export { fps_1 as fps }; - } - export { inputs_1056 as inputs }; - export namespace outputs_1056 { - let out_1026: string; - export { out_1026 as out }; - } - export { outputs_1056 as outputs }; - } - export { ND_time_float_1 as ND_time_float }; - export namespace ND_add_float_1 { - let node_1057: string; - export { node_1057 as node }; - export namespace inputs_1057 { - let in1_231: string; - export { in1_231 as in1 }; - let in2_231: string; - export { in2_231 as in2 }; - } - export { inputs_1057 as inputs }; - export namespace outputs_1057 { - let out_1027: string; - export { out_1027 as out }; - } - export { outputs_1057 as outputs }; - } - export { ND_add_float_1 as ND_add_float }; - export namespace ND_add_integer_1 { - let node_1058: string; - export { node_1058 as node }; - export namespace inputs_1058 { - let in1_232: string; - export { in1_232 as in1 }; - let in2_232: string; - export { in2_232 as in2 }; - } - export { inputs_1058 as inputs }; - export namespace outputs_1058 { - let out_1028: string; - export { out_1028 as out }; - } - export { outputs_1058 as outputs }; - } - export { ND_add_integer_1 as ND_add_integer }; - export namespace ND_add_color3_1 { - let node_1059: string; - export { node_1059 as node }; - export namespace inputs_1059 { - let in1_233: string; - export { in1_233 as in1 }; - let in2_233: string; - export { in2_233 as in2 }; - } - export { inputs_1059 as inputs }; - export namespace outputs_1059 { - let out_1029: string; - export { out_1029 as out }; - } - export { outputs_1059 as outputs }; - } - export { ND_add_color3_1 as ND_add_color3 }; - export namespace ND_add_color4_1 { - let node_1060: string; - export { node_1060 as node }; - export namespace inputs_1060 { - let in1_234: string; - export { in1_234 as in1 }; - let in2_234: string; - export { in2_234 as in2 }; - } - export { inputs_1060 as inputs }; - export namespace outputs_1060 { - let out_1030: string; - export { out_1030 as out }; - } - export { outputs_1060 as outputs }; - } - export { ND_add_color4_1 as ND_add_color4 }; - export namespace ND_add_vector2_1 { - let node_1061: string; - export { node_1061 as node }; - export namespace inputs_1061 { - let in1_235: string; - export { in1_235 as in1 }; - let in2_235: string; - export { in2_235 as in2 }; - } - export { inputs_1061 as inputs }; - export namespace outputs_1061 { - let out_1031: string; - export { out_1031 as out }; - } - export { outputs_1061 as outputs }; - } - export { ND_add_vector2_1 as ND_add_vector2 }; - export namespace ND_add_vector3_1 { - let node_1062: string; - export { node_1062 as node }; - export namespace inputs_1062 { - let in1_236: string; - export { in1_236 as in1 }; - let in2_236: string; - export { in2_236 as in2 }; - } - export { inputs_1062 as inputs }; - export namespace outputs_1062 { - let out_1032: string; - export { out_1032 as out }; - } - export { outputs_1062 as outputs }; - } - export { ND_add_vector3_1 as ND_add_vector3 }; - export namespace ND_add_vector4_1 { - let node_1063: string; - export { node_1063 as node }; - export namespace inputs_1063 { - let in1_237: string; - export { in1_237 as in1 }; - let in2_237: string; - export { in2_237 as in2 }; - } - export { inputs_1063 as inputs }; - export namespace outputs_1063 { - let out_1033: string; - export { out_1033 as out }; - } - export { outputs_1063 as outputs }; - } - export { ND_add_vector4_1 as ND_add_vector4 }; - export namespace ND_add_matrix33_1 { - let node_1064: string; - export { node_1064 as node }; - export namespace inputs_1064 { - let in1_238: string; - export { in1_238 as in1 }; - let in2_238: string; - export { in2_238 as in2 }; - } - export { inputs_1064 as inputs }; - export namespace outputs_1064 { - let out_1034: string; - export { out_1034 as out }; - } - export { outputs_1064 as outputs }; - } - export { ND_add_matrix33_1 as ND_add_matrix33 }; - export namespace ND_add_matrix44_1 { - let node_1065: string; - export { node_1065 as node }; - export namespace inputs_1065 { - let in1_239: string; - export { in1_239 as in1 }; - let in2_239: string; - export { in2_239 as in2 }; - } - export { inputs_1065 as inputs }; - export namespace outputs_1065 { - let out_1035: string; - export { out_1035 as out }; - } - export { outputs_1065 as outputs }; - } - export { ND_add_matrix44_1 as ND_add_matrix44 }; - export namespace ND_add_color3FA_1 { - let node_1066: string; - export { node_1066 as node }; - export namespace inputs_1066 { - let in1_240: string; - export { in1_240 as in1 }; - let in2_240: string; - export { in2_240 as in2 }; - } - export { inputs_1066 as inputs }; - export namespace outputs_1066 { - let out_1036: string; - export { out_1036 as out }; - } - export { outputs_1066 as outputs }; - } - export { ND_add_color3FA_1 as ND_add_color3FA }; - export namespace ND_add_color4FA_1 { - let node_1067: string; - export { node_1067 as node }; - export namespace inputs_1067 { - let in1_241: string; - export { in1_241 as in1 }; - let in2_241: string; - export { in2_241 as in2 }; - } - export { inputs_1067 as inputs }; - export namespace outputs_1067 { - let out_1037: string; - export { out_1037 as out }; - } - export { outputs_1067 as outputs }; - } - export { ND_add_color4FA_1 as ND_add_color4FA }; - export namespace ND_add_vector2FA_1 { - let node_1068: string; - export { node_1068 as node }; - export namespace inputs_1068 { - let in1_242: string; - export { in1_242 as in1 }; - let in2_242: string; - export { in2_242 as in2 }; - } - export { inputs_1068 as inputs }; - export namespace outputs_1068 { - let out_1038: string; - export { out_1038 as out }; - } - export { outputs_1068 as outputs }; - } - export { ND_add_vector2FA_1 as ND_add_vector2FA }; - export namespace ND_add_vector3FA_1 { - let node_1069: string; - export { node_1069 as node }; - export namespace inputs_1069 { - let in1_243: string; - export { in1_243 as in1 }; - let in2_243: string; - export { in2_243 as in2 }; - } - export { inputs_1069 as inputs }; - export namespace outputs_1069 { - let out_1039: string; - export { out_1039 as out }; - } - export { outputs_1069 as outputs }; - } - export { ND_add_vector3FA_1 as ND_add_vector3FA }; - export namespace ND_add_vector4FA_1 { - let node_1070: string; - export { node_1070 as node }; - export namespace inputs_1070 { - let in1_244: string; - export { in1_244 as in1 }; - let in2_244: string; - export { in2_244 as in2 }; - } - export { inputs_1070 as inputs }; - export namespace outputs_1070 { - let out_1040: string; - export { out_1040 as out }; - } - export { outputs_1070 as outputs }; - } - export { ND_add_vector4FA_1 as ND_add_vector4FA }; - export namespace ND_add_matrix33FA_1 { - let node_1071: string; - export { node_1071 as node }; - export namespace inputs_1071 { - let in1_245: string; - export { in1_245 as in1 }; - let in2_245: string; - export { in2_245 as in2 }; - } - export { inputs_1071 as inputs }; - export namespace outputs_1071 { - let out_1041: string; - export { out_1041 as out }; - } - export { outputs_1071 as outputs }; - } - export { ND_add_matrix33FA_1 as ND_add_matrix33FA }; - export namespace ND_add_matrix44FA_1 { - let node_1072: string; - export { node_1072 as node }; - export namespace inputs_1072 { - let in1_246: string; - export { in1_246 as in1 }; - let in2_246: string; - export { in2_246 as in2 }; - } - export { inputs_1072 as inputs }; - export namespace outputs_1072 { - let out_1042: string; - export { out_1042 as out }; - } - export { outputs_1072 as outputs }; - } - export { ND_add_matrix44FA_1 as ND_add_matrix44FA }; - export namespace ND_subtract_float_1 { - let node_1073: string; - export { node_1073 as node }; - export namespace inputs_1073 { - let in1_247: string; - export { in1_247 as in1 }; - let in2_247: string; - export { in2_247 as in2 }; - } - export { inputs_1073 as inputs }; - export namespace outputs_1073 { - let out_1043: string; - export { out_1043 as out }; - } - export { outputs_1073 as outputs }; - } - export { ND_subtract_float_1 as ND_subtract_float }; - export namespace ND_subtract_integer_1 { - let node_1074: string; - export { node_1074 as node }; - export namespace inputs_1074 { - let in1_248: string; - export { in1_248 as in1 }; - let in2_248: string; - export { in2_248 as in2 }; - } - export { inputs_1074 as inputs }; - export namespace outputs_1074 { - let out_1044: string; - export { out_1044 as out }; - } - export { outputs_1074 as outputs }; - } - export { ND_subtract_integer_1 as ND_subtract_integer }; - export namespace ND_subtract_color3_1 { - let node_1075: string; - export { node_1075 as node }; - export namespace inputs_1075 { - let in1_249: string; - export { in1_249 as in1 }; - let in2_249: string; - export { in2_249 as in2 }; - } - export { inputs_1075 as inputs }; - export namespace outputs_1075 { - let out_1045: string; - export { out_1045 as out }; - } - export { outputs_1075 as outputs }; - } - export { ND_subtract_color3_1 as ND_subtract_color3 }; - export namespace ND_subtract_color4_1 { - let node_1076: string; - export { node_1076 as node }; - export namespace inputs_1076 { - let in1_250: string; - export { in1_250 as in1 }; - let in2_250: string; - export { in2_250 as in2 }; - } - export { inputs_1076 as inputs }; - export namespace outputs_1076 { - let out_1046: string; - export { out_1046 as out }; - } - export { outputs_1076 as outputs }; - } - export { ND_subtract_color4_1 as ND_subtract_color4 }; - export namespace ND_subtract_vector2_1 { - let node_1077: string; - export { node_1077 as node }; - export namespace inputs_1077 { - let in1_251: string; - export { in1_251 as in1 }; - let in2_251: string; - export { in2_251 as in2 }; - } - export { inputs_1077 as inputs }; - export namespace outputs_1077 { - let out_1047: string; - export { out_1047 as out }; - } - export { outputs_1077 as outputs }; - } - export { ND_subtract_vector2_1 as ND_subtract_vector2 }; - export namespace ND_subtract_vector3_1 { - let node_1078: string; - export { node_1078 as node }; - export namespace inputs_1078 { - let in1_252: string; - export { in1_252 as in1 }; - let in2_252: string; - export { in2_252 as in2 }; - } - export { inputs_1078 as inputs }; - export namespace outputs_1078 { - let out_1048: string; - export { out_1048 as out }; - } - export { outputs_1078 as outputs }; - } - export { ND_subtract_vector3_1 as ND_subtract_vector3 }; - export namespace ND_subtract_vector4_1 { - let node_1079: string; - export { node_1079 as node }; - export namespace inputs_1079 { - let in1_253: string; - export { in1_253 as in1 }; - let in2_253: string; - export { in2_253 as in2 }; - } - export { inputs_1079 as inputs }; - export namespace outputs_1079 { - let out_1049: string; - export { out_1049 as out }; - } - export { outputs_1079 as outputs }; - } - export { ND_subtract_vector4_1 as ND_subtract_vector4 }; - export namespace ND_subtract_matrix33_1 { - let node_1080: string; - export { node_1080 as node }; - export namespace inputs_1080 { - let in1_254: string; - export { in1_254 as in1 }; - let in2_254: string; - export { in2_254 as in2 }; - } - export { inputs_1080 as inputs }; - export namespace outputs_1080 { - let out_1050: string; - export { out_1050 as out }; - } - export { outputs_1080 as outputs }; - } - export { ND_subtract_matrix33_1 as ND_subtract_matrix33 }; - export namespace ND_subtract_matrix44_1 { - let node_1081: string; - export { node_1081 as node }; - export namespace inputs_1081 { - let in1_255: string; - export { in1_255 as in1 }; - let in2_255: string; - export { in2_255 as in2 }; - } - export { inputs_1081 as inputs }; - export namespace outputs_1081 { - let out_1051: string; - export { out_1051 as out }; - } - export { outputs_1081 as outputs }; - } - export { ND_subtract_matrix44_1 as ND_subtract_matrix44 }; - export namespace ND_subtract_color3FA_1 { - let node_1082: string; - export { node_1082 as node }; - export namespace inputs_1082 { - let in1_256: string; - export { in1_256 as in1 }; - let in2_256: string; - export { in2_256 as in2 }; - } - export { inputs_1082 as inputs }; - export namespace outputs_1082 { - let out_1052: string; - export { out_1052 as out }; - } - export { outputs_1082 as outputs }; - } - export { ND_subtract_color3FA_1 as ND_subtract_color3FA }; - export namespace ND_subtract_color4FA_1 { - let node_1083: string; - export { node_1083 as node }; - export namespace inputs_1083 { - let in1_257: string; - export { in1_257 as in1 }; - let in2_257: string; - export { in2_257 as in2 }; - } - export { inputs_1083 as inputs }; - export namespace outputs_1083 { - let out_1053: string; - export { out_1053 as out }; - } - export { outputs_1083 as outputs }; - } - export { ND_subtract_color4FA_1 as ND_subtract_color4FA }; - export namespace ND_subtract_vector2FA_1 { - let node_1084: string; - export { node_1084 as node }; - export namespace inputs_1084 { - let in1_258: string; - export { in1_258 as in1 }; - let in2_258: string; - export { in2_258 as in2 }; - } - export { inputs_1084 as inputs }; - export namespace outputs_1084 { - let out_1054: string; - export { out_1054 as out }; - } - export { outputs_1084 as outputs }; - } - export { ND_subtract_vector2FA_1 as ND_subtract_vector2FA }; - export namespace ND_subtract_vector3FA_1 { - let node_1085: string; - export { node_1085 as node }; - export namespace inputs_1085 { - let in1_259: string; - export { in1_259 as in1 }; - let in2_259: string; - export { in2_259 as in2 }; - } - export { inputs_1085 as inputs }; - export namespace outputs_1085 { - let out_1055: string; - export { out_1055 as out }; - } - export { outputs_1085 as outputs }; - } - export { ND_subtract_vector3FA_1 as ND_subtract_vector3FA }; - export namespace ND_subtract_vector4FA_1 { - let node_1086: string; - export { node_1086 as node }; - export namespace inputs_1086 { - let in1_260: string; - export { in1_260 as in1 }; - let in2_260: string; - export { in2_260 as in2 }; - } - export { inputs_1086 as inputs }; - export namespace outputs_1086 { - let out_1056: string; - export { out_1056 as out }; - } - export { outputs_1086 as outputs }; - } - export { ND_subtract_vector4FA_1 as ND_subtract_vector4FA }; - export namespace ND_subtract_matrix33FA_1 { - let node_1087: string; - export { node_1087 as node }; - export namespace inputs_1087 { - let in1_261: string; - export { in1_261 as in1 }; - let in2_261: string; - export { in2_261 as in2 }; - } - export { inputs_1087 as inputs }; - export namespace outputs_1087 { - let out_1057: string; - export { out_1057 as out }; - } - export { outputs_1087 as outputs }; - } - export { ND_subtract_matrix33FA_1 as ND_subtract_matrix33FA }; - export namespace ND_subtract_matrix44FA_1 { - let node_1088: string; - export { node_1088 as node }; - export namespace inputs_1088 { - let in1_262: string; - export { in1_262 as in1 }; - let in2_262: string; - export { in2_262 as in2 }; - } - export { inputs_1088 as inputs }; - export namespace outputs_1088 { - let out_1058: string; - export { out_1058 as out }; - } - export { outputs_1088 as outputs }; - } - export { ND_subtract_matrix44FA_1 as ND_subtract_matrix44FA }; - export namespace ND_multiply_float_1 { - let node_1089: string; - export { node_1089 as node }; - export namespace inputs_1089 { - let in1_263: string; - export { in1_263 as in1 }; - let in2_263: string; - export { in2_263 as in2 }; - } - export { inputs_1089 as inputs }; - export namespace outputs_1089 { - let out_1059: string; - export { out_1059 as out }; - } - export { outputs_1089 as outputs }; - } - export { ND_multiply_float_1 as ND_multiply_float }; - export namespace ND_multiply_color3_1 { - let node_1090: string; - export { node_1090 as node }; - export namespace inputs_1090 { - let in1_264: string; - export { in1_264 as in1 }; - let in2_264: string; - export { in2_264 as in2 }; - } - export { inputs_1090 as inputs }; - export namespace outputs_1090 { - let out_1060: string; - export { out_1060 as out }; - } - export { outputs_1090 as outputs }; - } - export { ND_multiply_color3_1 as ND_multiply_color3 }; - export namespace ND_multiply_color4_1 { - let node_1091: string; - export { node_1091 as node }; - export namespace inputs_1091 { - let in1_265: string; - export { in1_265 as in1 }; - let in2_265: string; - export { in2_265 as in2 }; - } - export { inputs_1091 as inputs }; - export namespace outputs_1091 { - let out_1061: string; - export { out_1061 as out }; - } - export { outputs_1091 as outputs }; - } - export { ND_multiply_color4_1 as ND_multiply_color4 }; - export namespace ND_multiply_vector2_1 { - let node_1092: string; - export { node_1092 as node }; - export namespace inputs_1092 { - let in1_266: string; - export { in1_266 as in1 }; - let in2_266: string; - export { in2_266 as in2 }; - } - export { inputs_1092 as inputs }; - export namespace outputs_1092 { - let out_1062: string; - export { out_1062 as out }; - } - export { outputs_1092 as outputs }; - } - export { ND_multiply_vector2_1 as ND_multiply_vector2 }; - export namespace ND_multiply_vector3_1 { - let node_1093: string; - export { node_1093 as node }; - export namespace inputs_1093 { - let in1_267: string; - export { in1_267 as in1 }; - let in2_267: string; - export { in2_267 as in2 }; - } - export { inputs_1093 as inputs }; - export namespace outputs_1093 { - let out_1063: string; - export { out_1063 as out }; - } - export { outputs_1093 as outputs }; - } - export { ND_multiply_vector3_1 as ND_multiply_vector3 }; - export namespace ND_multiply_vector4_1 { - let node_1094: string; - export { node_1094 as node }; - export namespace inputs_1094 { - let in1_268: string; - export { in1_268 as in1 }; - let in2_268: string; - export { in2_268 as in2 }; - } - export { inputs_1094 as inputs }; - export namespace outputs_1094 { - let out_1064: string; - export { out_1064 as out }; - } - export { outputs_1094 as outputs }; - } - export { ND_multiply_vector4_1 as ND_multiply_vector4 }; - export namespace ND_multiply_matrix33_1 { - let node_1095: string; - export { node_1095 as node }; - export namespace inputs_1095 { - let in1_269: string; - export { in1_269 as in1 }; - let in2_269: string; - export { in2_269 as in2 }; - } - export { inputs_1095 as inputs }; - export namespace outputs_1095 { - let out_1065: string; - export { out_1065 as out }; - } - export { outputs_1095 as outputs }; - } - export { ND_multiply_matrix33_1 as ND_multiply_matrix33 }; - export namespace ND_multiply_matrix44_1 { - let node_1096: string; - export { node_1096 as node }; - export namespace inputs_1096 { - let in1_270: string; - export { in1_270 as in1 }; - let in2_270: string; - export { in2_270 as in2 }; - } - export { inputs_1096 as inputs }; - export namespace outputs_1096 { - let out_1066: string; - export { out_1066 as out }; - } - export { outputs_1096 as outputs }; - } - export { ND_multiply_matrix44_1 as ND_multiply_matrix44 }; - export namespace ND_multiply_color3FA_1 { - let node_1097: string; - export { node_1097 as node }; - export namespace inputs_1097 { - let in1_271: string; - export { in1_271 as in1 }; - let in2_271: string; - export { in2_271 as in2 }; - } - export { inputs_1097 as inputs }; - export namespace outputs_1097 { - let out_1067: string; - export { out_1067 as out }; - } - export { outputs_1097 as outputs }; - } - export { ND_multiply_color3FA_1 as ND_multiply_color3FA }; - export namespace ND_multiply_color4FA_1 { - let node_1098: string; - export { node_1098 as node }; - export namespace inputs_1098 { - let in1_272: string; - export { in1_272 as in1 }; - let in2_272: string; - export { in2_272 as in2 }; - } - export { inputs_1098 as inputs }; - export namespace outputs_1098 { - let out_1068: string; - export { out_1068 as out }; - } - export { outputs_1098 as outputs }; - } - export { ND_multiply_color4FA_1 as ND_multiply_color4FA }; - export namespace ND_multiply_vector2FA_1 { - let node_1099: string; - export { node_1099 as node }; - export namespace inputs_1099 { - let in1_273: string; - export { in1_273 as in1 }; - let in2_273: string; - export { in2_273 as in2 }; - } - export { inputs_1099 as inputs }; - export namespace outputs_1099 { - let out_1069: string; - export { out_1069 as out }; - } - export { outputs_1099 as outputs }; - } - export { ND_multiply_vector2FA_1 as ND_multiply_vector2FA }; - export namespace ND_multiply_vector3FA_1 { - let node_1100: string; - export { node_1100 as node }; - export namespace inputs_1100 { - let in1_274: string; - export { in1_274 as in1 }; - let in2_274: string; - export { in2_274 as in2 }; - } - export { inputs_1100 as inputs }; - export namespace outputs_1100 { - let out_1070: string; - export { out_1070 as out }; - } - export { outputs_1100 as outputs }; - } - export { ND_multiply_vector3FA_1 as ND_multiply_vector3FA }; - export namespace ND_multiply_vector4FA_1 { - let node_1101: string; - export { node_1101 as node }; - export namespace inputs_1101 { - let in1_275: string; - export { in1_275 as in1 }; - let in2_275: string; - export { in2_275 as in2 }; - } - export { inputs_1101 as inputs }; - export namespace outputs_1101 { - let out_1071: string; - export { out_1071 as out }; - } - export { outputs_1101 as outputs }; - } - export { ND_multiply_vector4FA_1 as ND_multiply_vector4FA }; - export namespace ND_divide_float_1 { - let node_1102: string; - export { node_1102 as node }; - export namespace inputs_1102 { - let in1_276: string; - export { in1_276 as in1 }; - let in2_276: string; - export { in2_276 as in2 }; - } - export { inputs_1102 as inputs }; - export namespace outputs_1102 { - let out_1072: string; - export { out_1072 as out }; - } - export { outputs_1102 as outputs }; - } - export { ND_divide_float_1 as ND_divide_float }; - export namespace ND_divide_color3_1 { - let node_1103: string; - export { node_1103 as node }; - export namespace inputs_1103 { - let in1_277: string; - export { in1_277 as in1 }; - let in2_277: string; - export { in2_277 as in2 }; - } - export { inputs_1103 as inputs }; - export namespace outputs_1103 { - let out_1073: string; - export { out_1073 as out }; - } - export { outputs_1103 as outputs }; - } - export { ND_divide_color3_1 as ND_divide_color3 }; - export namespace ND_divide_color4_1 { - let node_1104: string; - export { node_1104 as node }; - export namespace inputs_1104 { - let in1_278: string; - export { in1_278 as in1 }; - let in2_278: string; - export { in2_278 as in2 }; - } - export { inputs_1104 as inputs }; - export namespace outputs_1104 { - let out_1074: string; - export { out_1074 as out }; - } - export { outputs_1104 as outputs }; - } - export { ND_divide_color4_1 as ND_divide_color4 }; - export namespace ND_divide_vector2_1 { - let node_1105: string; - export { node_1105 as node }; - export namespace inputs_1105 { - let in1_279: string; - export { in1_279 as in1 }; - let in2_279: string; - export { in2_279 as in2 }; - } - export { inputs_1105 as inputs }; - export namespace outputs_1105 { - let out_1075: string; - export { out_1075 as out }; - } - export { outputs_1105 as outputs }; - } - export { ND_divide_vector2_1 as ND_divide_vector2 }; - export namespace ND_divide_vector3_1 { - let node_1106: string; - export { node_1106 as node }; - export namespace inputs_1106 { - let in1_280: string; - export { in1_280 as in1 }; - let in2_280: string; - export { in2_280 as in2 }; - } - export { inputs_1106 as inputs }; - export namespace outputs_1106 { - let out_1076: string; - export { out_1076 as out }; - } - export { outputs_1106 as outputs }; - } - export { ND_divide_vector3_1 as ND_divide_vector3 }; - export namespace ND_divide_vector4_1 { - let node_1107: string; - export { node_1107 as node }; - export namespace inputs_1107 { - let in1_281: string; - export { in1_281 as in1 }; - let in2_281: string; - export { in2_281 as in2 }; - } - export { inputs_1107 as inputs }; - export namespace outputs_1107 { - let out_1077: string; - export { out_1077 as out }; - } - export { outputs_1107 as outputs }; - } - export { ND_divide_vector4_1 as ND_divide_vector4 }; - export namespace ND_divide_matrix33_1 { - let node_1108: string; - export { node_1108 as node }; - export namespace inputs_1108 { - let in1_282: string; - export { in1_282 as in1 }; - let in2_282: string; - export { in2_282 as in2 }; - } - export { inputs_1108 as inputs }; - export namespace outputs_1108 { - let out_1078: string; - export { out_1078 as out }; - } - export { outputs_1108 as outputs }; - } - export { ND_divide_matrix33_1 as ND_divide_matrix33 }; - export namespace ND_divide_matrix44_1 { - let node_1109: string; - export { node_1109 as node }; - export namespace inputs_1109 { - let in1_283: string; - export { in1_283 as in1 }; - let in2_283: string; - export { in2_283 as in2 }; - } - export { inputs_1109 as inputs }; - export namespace outputs_1109 { - let out_1079: string; - export { out_1079 as out }; - } - export { outputs_1109 as outputs }; - } - export { ND_divide_matrix44_1 as ND_divide_matrix44 }; - export namespace ND_divide_color3FA_1 { - let node_1110: string; - export { node_1110 as node }; - export namespace inputs_1110 { - let in1_284: string; - export { in1_284 as in1 }; - let in2_284: string; - export { in2_284 as in2 }; - } - export { inputs_1110 as inputs }; - export namespace outputs_1110 { - let out_1080: string; - export { out_1080 as out }; - } - export { outputs_1110 as outputs }; - } - export { ND_divide_color3FA_1 as ND_divide_color3FA }; - export namespace ND_divide_color4FA_1 { - let node_1111: string; - export { node_1111 as node }; - export namespace inputs_1111 { - let in1_285: string; - export { in1_285 as in1 }; - let in2_285: string; - export { in2_285 as in2 }; - } - export { inputs_1111 as inputs }; - export namespace outputs_1111 { - let out_1081: string; - export { out_1081 as out }; - } - export { outputs_1111 as outputs }; - } - export { ND_divide_color4FA_1 as ND_divide_color4FA }; - export namespace ND_divide_vector2FA_1 { - let node_1112: string; - export { node_1112 as node }; - export namespace inputs_1112 { - let in1_286: string; - export { in1_286 as in1 }; - let in2_286: string; - export { in2_286 as in2 }; - } - export { inputs_1112 as inputs }; - export namespace outputs_1112 { - let out_1082: string; - export { out_1082 as out }; - } - export { outputs_1112 as outputs }; - } - export { ND_divide_vector2FA_1 as ND_divide_vector2FA }; - export namespace ND_divide_vector3FA_1 { - let node_1113: string; - export { node_1113 as node }; - export namespace inputs_1113 { - let in1_287: string; - export { in1_287 as in1 }; - let in2_287: string; - export { in2_287 as in2 }; - } - export { inputs_1113 as inputs }; - export namespace outputs_1113 { - let out_1083: string; - export { out_1083 as out }; - } - export { outputs_1113 as outputs }; - } - export { ND_divide_vector3FA_1 as ND_divide_vector3FA }; - export namespace ND_divide_vector4FA_1 { - let node_1114: string; - export { node_1114 as node }; - export namespace inputs_1114 { - let in1_288: string; - export { in1_288 as in1 }; - let in2_288: string; - export { in2_288 as in2 }; - } - export { inputs_1114 as inputs }; - export namespace outputs_1114 { - let out_1084: string; - export { out_1084 as out }; - } - export { outputs_1114 as outputs }; - } - export { ND_divide_vector4FA_1 as ND_divide_vector4FA }; - export namespace ND_modulo_float_1 { - let node_1115: string; - export { node_1115 as node }; - export namespace inputs_1115 { - let in1_289: string; - export { in1_289 as in1 }; - let in2_289: string; - export { in2_289 as in2 }; - } - export { inputs_1115 as inputs }; - export namespace outputs_1115 { - let out_1085: string; - export { out_1085 as out }; - } - export { outputs_1115 as outputs }; - } - export { ND_modulo_float_1 as ND_modulo_float }; - export namespace ND_modulo_color3_1 { - let node_1116: string; - export { node_1116 as node }; - export namespace inputs_1116 { - let in1_290: string; - export { in1_290 as in1 }; - let in2_290: string; - export { in2_290 as in2 }; - } - export { inputs_1116 as inputs }; - export namespace outputs_1116 { - let out_1086: string; - export { out_1086 as out }; - } - export { outputs_1116 as outputs }; - } - export { ND_modulo_color3_1 as ND_modulo_color3 }; - export namespace ND_modulo_color4_1 { - let node_1117: string; - export { node_1117 as node }; - export namespace inputs_1117 { - let in1_291: string; - export { in1_291 as in1 }; - let in2_291: string; - export { in2_291 as in2 }; - } - export { inputs_1117 as inputs }; - export namespace outputs_1117 { - let out_1087: string; - export { out_1087 as out }; - } - export { outputs_1117 as outputs }; - } - export { ND_modulo_color4_1 as ND_modulo_color4 }; - export namespace ND_modulo_vector2_1 { - let node_1118: string; - export { node_1118 as node }; - export namespace inputs_1118 { - let in1_292: string; - export { in1_292 as in1 }; - let in2_292: string; - export { in2_292 as in2 }; - } - export { inputs_1118 as inputs }; - export namespace outputs_1118 { - let out_1088: string; - export { out_1088 as out }; - } - export { outputs_1118 as outputs }; - } - export { ND_modulo_vector2_1 as ND_modulo_vector2 }; - export namespace ND_modulo_vector3_1 { - let node_1119: string; - export { node_1119 as node }; - export namespace inputs_1119 { - let in1_293: string; - export { in1_293 as in1 }; - let in2_293: string; - export { in2_293 as in2 }; - } - export { inputs_1119 as inputs }; - export namespace outputs_1119 { - let out_1089: string; - export { out_1089 as out }; - } - export { outputs_1119 as outputs }; - } - export { ND_modulo_vector3_1 as ND_modulo_vector3 }; - export namespace ND_modulo_vector4_1 { - let node_1120: string; - export { node_1120 as node }; - export namespace inputs_1120 { - let in1_294: string; - export { in1_294 as in1 }; - let in2_294: string; - export { in2_294 as in2 }; - } - export { inputs_1120 as inputs }; - export namespace outputs_1120 { - let out_1090: string; - export { out_1090 as out }; - } - export { outputs_1120 as outputs }; - } - export { ND_modulo_vector4_1 as ND_modulo_vector4 }; - export namespace ND_modulo_color3FA_1 { - let node_1121: string; - export { node_1121 as node }; - export namespace inputs_1121 { - let in1_295: string; - export { in1_295 as in1 }; - let in2_295: string; - export { in2_295 as in2 }; - } - export { inputs_1121 as inputs }; - export namespace outputs_1121 { - let out_1091: string; - export { out_1091 as out }; - } - export { outputs_1121 as outputs }; - } - export { ND_modulo_color3FA_1 as ND_modulo_color3FA }; - export namespace ND_modulo_color4FA_1 { - let node_1122: string; - export { node_1122 as node }; - export namespace inputs_1122 { - let in1_296: string; - export { in1_296 as in1 }; - let in2_296: string; - export { in2_296 as in2 }; - } - export { inputs_1122 as inputs }; - export namespace outputs_1122 { - let out_1092: string; - export { out_1092 as out }; - } - export { outputs_1122 as outputs }; - } - export { ND_modulo_color4FA_1 as ND_modulo_color4FA }; - export namespace ND_modulo_vector2FA_1 { - let node_1123: string; - export { node_1123 as node }; - export namespace inputs_1123 { - let in1_297: string; - export { in1_297 as in1 }; - let in2_297: string; - export { in2_297 as in2 }; - } - export { inputs_1123 as inputs }; - export namespace outputs_1123 { - let out_1093: string; - export { out_1093 as out }; - } - export { outputs_1123 as outputs }; - } - export { ND_modulo_vector2FA_1 as ND_modulo_vector2FA }; - export namespace ND_modulo_vector3FA_1 { - let node_1124: string; - export { node_1124 as node }; - export namespace inputs_1124 { - let in1_298: string; - export { in1_298 as in1 }; - let in2_298: string; - export { in2_298 as in2 }; - } - export { inputs_1124 as inputs }; - export namespace outputs_1124 { - let out_1094: string; - export { out_1094 as out }; - } - export { outputs_1124 as outputs }; - } - export { ND_modulo_vector3FA_1 as ND_modulo_vector3FA }; - export namespace ND_modulo_vector4FA_1 { - let node_1125: string; - export { node_1125 as node }; - export namespace inputs_1125 { - let in1_299: string; - export { in1_299 as in1 }; - let in2_299: string; - export { in2_299 as in2 }; - } - export { inputs_1125 as inputs }; - export namespace outputs_1125 { - let out_1095: string; - export { out_1095 as out }; - } - export { outputs_1125 as outputs }; - } - export { ND_modulo_vector4FA_1 as ND_modulo_vector4FA }; - export namespace ND_fract_float_1 { - let node_1126: string; - export { node_1126 as node }; - export namespace inputs_1126 { - let _in_316: string; - export { _in_316 as in }; - } - export { inputs_1126 as inputs }; - export namespace outputs_1126 { - let out_1096: string; - export { out_1096 as out }; - } - export { outputs_1126 as outputs }; - } - export { ND_fract_float_1 as ND_fract_float }; - export namespace ND_fract_color3_1 { - let node_1127: string; - export { node_1127 as node }; - export namespace inputs_1127 { - let _in_317: string; - export { _in_317 as in }; - } - export { inputs_1127 as inputs }; - export namespace outputs_1127 { - let out_1097: string; - export { out_1097 as out }; - } - export { outputs_1127 as outputs }; - } - export { ND_fract_color3_1 as ND_fract_color3 }; - export namespace ND_fract_color4_1 { - let node_1128: string; - export { node_1128 as node }; - export namespace inputs_1128 { - let _in_318: string; - export { _in_318 as in }; - } - export { inputs_1128 as inputs }; - export namespace outputs_1128 { - let out_1098: string; - export { out_1098 as out }; - } - export { outputs_1128 as outputs }; - } - export { ND_fract_color4_1 as ND_fract_color4 }; - export namespace ND_fract_vector2_1 { - let node_1129: string; - export { node_1129 as node }; - export namespace inputs_1129 { - let _in_319: string; - export { _in_319 as in }; - } - export { inputs_1129 as inputs }; - export namespace outputs_1129 { - let out_1099: string; - export { out_1099 as out }; - } - export { outputs_1129 as outputs }; - } - export { ND_fract_vector2_1 as ND_fract_vector2 }; - export namespace ND_fract_vector3_1 { - let node_1130: string; - export { node_1130 as node }; - export namespace inputs_1130 { - let _in_320: string; - export { _in_320 as in }; - } - export { inputs_1130 as inputs }; - export namespace outputs_1130 { - let out_1100: string; - export { out_1100 as out }; - } - export { outputs_1130 as outputs }; - } - export { ND_fract_vector3_1 as ND_fract_vector3 }; - export namespace ND_fract_vector4_1 { - let node_1131: string; - export { node_1131 as node }; - export namespace inputs_1131 { - let _in_321: string; - export { _in_321 as in }; - } - export { inputs_1131 as inputs }; - export namespace outputs_1131 { - let out_1101: string; - export { out_1101 as out }; - } - export { outputs_1131 as outputs }; - } - export { ND_fract_vector4_1 as ND_fract_vector4 }; - export namespace ND_invert_float_1 { - let node_1132: string; - export { node_1132 as node }; - export namespace inputs_1132 { - let _in_322: string; - export { _in_322 as in }; - let amount_28: string; - export { amount_28 as amount }; - } - export { inputs_1132 as inputs }; - export namespace outputs_1132 { - let out_1102: string; - export { out_1102 as out }; - } - export { outputs_1132 as outputs }; - } - export { ND_invert_float_1 as ND_invert_float }; - export namespace ND_invert_color3_1 { - let node_1133: string; - export { node_1133 as node }; - export namespace inputs_1133 { - let _in_323: string; - export { _in_323 as in }; - let amount_29: string; - export { amount_29 as amount }; - } - export { inputs_1133 as inputs }; - export namespace outputs_1133 { - let out_1103: string; - export { out_1103 as out }; - } - export { outputs_1133 as outputs }; - } - export { ND_invert_color3_1 as ND_invert_color3 }; - export namespace ND_invert_color4_1 { - let node_1134: string; - export { node_1134 as node }; - export namespace inputs_1134 { - let _in_324: string; - export { _in_324 as in }; - let amount_30: string; - export { amount_30 as amount }; - } - export { inputs_1134 as inputs }; - export namespace outputs_1134 { - let out_1104: string; - export { out_1104 as out }; - } - export { outputs_1134 as outputs }; - } - export { ND_invert_color4_1 as ND_invert_color4 }; - export namespace ND_invert_vector2_1 { - let node_1135: string; - export { node_1135 as node }; - export namespace inputs_1135 { - let _in_325: string; - export { _in_325 as in }; - let amount_31: string; - export { amount_31 as amount }; - } - export { inputs_1135 as inputs }; - export namespace outputs_1135 { - let out_1105: string; - export { out_1105 as out }; - } - export { outputs_1135 as outputs }; - } - export { ND_invert_vector2_1 as ND_invert_vector2 }; - export namespace ND_invert_vector3_1 { - let node_1136: string; - export { node_1136 as node }; - export namespace inputs_1136 { - let _in_326: string; - export { _in_326 as in }; - let amount_32: string; - export { amount_32 as amount }; - } - export { inputs_1136 as inputs }; - export namespace outputs_1136 { - let out_1106: string; - export { out_1106 as out }; - } - export { outputs_1136 as outputs }; - } - export { ND_invert_vector3_1 as ND_invert_vector3 }; - export namespace ND_invert_vector4_1 { - let node_1137: string; - export { node_1137 as node }; - export namespace inputs_1137 { - let _in_327: string; - export { _in_327 as in }; - let amount_33: string; - export { amount_33 as amount }; - } - export { inputs_1137 as inputs }; - export namespace outputs_1137 { - let out_1107: string; - export { out_1107 as out }; - } - export { outputs_1137 as outputs }; - } - export { ND_invert_vector4_1 as ND_invert_vector4 }; - export namespace ND_invert_color3FA_1 { - let node_1138: string; - export { node_1138 as node }; - export namespace inputs_1138 { - let _in_328: string; - export { _in_328 as in }; - let amount_34: string; - export { amount_34 as amount }; - } - export { inputs_1138 as inputs }; - export namespace outputs_1138 { - let out_1108: string; - export { out_1108 as out }; - } - export { outputs_1138 as outputs }; - } - export { ND_invert_color3FA_1 as ND_invert_color3FA }; - export namespace ND_invert_color4FA_1 { - let node_1139: string; - export { node_1139 as node }; - export namespace inputs_1139 { - let _in_329: string; - export { _in_329 as in }; - let amount_35: string; - export { amount_35 as amount }; - } - export { inputs_1139 as inputs }; - export namespace outputs_1139 { - let out_1109: string; - export { out_1109 as out }; - } - export { outputs_1139 as outputs }; - } - export { ND_invert_color4FA_1 as ND_invert_color4FA }; - export namespace ND_invert_vector2FA_1 { - let node_1140: string; - export { node_1140 as node }; - export namespace inputs_1140 { - let _in_330: string; - export { _in_330 as in }; - let amount_36: string; - export { amount_36 as amount }; - } - export { inputs_1140 as inputs }; - export namespace outputs_1140 { - let out_1110: string; - export { out_1110 as out }; - } - export { outputs_1140 as outputs }; - } - export { ND_invert_vector2FA_1 as ND_invert_vector2FA }; - export namespace ND_invert_vector3FA_1 { - let node_1141: string; - export { node_1141 as node }; - export namespace inputs_1141 { - let _in_331: string; - export { _in_331 as in }; - let amount_37: string; - export { amount_37 as amount }; - } - export { inputs_1141 as inputs }; - export namespace outputs_1141 { - let out_1111: string; - export { out_1111 as out }; - } - export { outputs_1141 as outputs }; - } - export { ND_invert_vector3FA_1 as ND_invert_vector3FA }; - export namespace ND_invert_vector4FA_1 { - let node_1142: string; - export { node_1142 as node }; - export namespace inputs_1142 { - let _in_332: string; - export { _in_332 as in }; - let amount_38: string; - export { amount_38 as amount }; - } - export { inputs_1142 as inputs }; - export namespace outputs_1142 { - let out_1112: string; - export { out_1112 as out }; - } - export { outputs_1142 as outputs }; - } - export { ND_invert_vector4FA_1 as ND_invert_vector4FA }; - export namespace ND_absval_float_1 { - let node_1143: string; - export { node_1143 as node }; - export namespace inputs_1143 { - let _in_333: string; - export { _in_333 as in }; - } - export { inputs_1143 as inputs }; - export namespace outputs_1143 { - let out_1113: string; - export { out_1113 as out }; - } - export { outputs_1143 as outputs }; - } - export { ND_absval_float_1 as ND_absval_float }; - export namespace ND_absval_color3_1 { - let node_1144: string; - export { node_1144 as node }; - export namespace inputs_1144 { - let _in_334: string; - export { _in_334 as in }; - } - export { inputs_1144 as inputs }; - export namespace outputs_1144 { - let out_1114: string; - export { out_1114 as out }; - } - export { outputs_1144 as outputs }; - } - export { ND_absval_color3_1 as ND_absval_color3 }; - export namespace ND_absval_color4_1 { - let node_1145: string; - export { node_1145 as node }; - export namespace inputs_1145 { - let _in_335: string; - export { _in_335 as in }; - } - export { inputs_1145 as inputs }; - export namespace outputs_1145 { - let out_1115: string; - export { out_1115 as out }; - } - export { outputs_1145 as outputs }; - } - export { ND_absval_color4_1 as ND_absval_color4 }; - export namespace ND_absval_vector2_1 { - let node_1146: string; - export { node_1146 as node }; - export namespace inputs_1146 { - let _in_336: string; - export { _in_336 as in }; - } - export { inputs_1146 as inputs }; - export namespace outputs_1146 { - let out_1116: string; - export { out_1116 as out }; - } - export { outputs_1146 as outputs }; - } - export { ND_absval_vector2_1 as ND_absval_vector2 }; - export namespace ND_absval_vector3_1 { - let node_1147: string; - export { node_1147 as node }; - export namespace inputs_1147 { - let _in_337: string; - export { _in_337 as in }; - } - export { inputs_1147 as inputs }; - export namespace outputs_1147 { - let out_1117: string; - export { out_1117 as out }; - } - export { outputs_1147 as outputs }; - } - export { ND_absval_vector3_1 as ND_absval_vector3 }; - export namespace ND_absval_vector4_1 { - let node_1148: string; - export { node_1148 as node }; - export namespace inputs_1148 { - let _in_338: string; - export { _in_338 as in }; - } - export { inputs_1148 as inputs }; - export namespace outputs_1148 { - let out_1118: string; - export { out_1118 as out }; - } - export { outputs_1148 as outputs }; - } - export { ND_absval_vector4_1 as ND_absval_vector4 }; - export namespace ND_floor_float_1 { - let node_1149: string; - export { node_1149 as node }; - export namespace inputs_1149 { - let _in_339: string; - export { _in_339 as in }; - } - export { inputs_1149 as inputs }; - export namespace outputs_1149 { - let out_1119: string; - export { out_1119 as out }; - } - export { outputs_1149 as outputs }; - } - export { ND_floor_float_1 as ND_floor_float }; - export namespace ND_floor_color3_1 { - let node_1150: string; - export { node_1150 as node }; - export namespace inputs_1150 { - let _in_340: string; - export { _in_340 as in }; - } - export { inputs_1150 as inputs }; - export namespace outputs_1150 { - let out_1120: string; - export { out_1120 as out }; - } - export { outputs_1150 as outputs }; - } - export { ND_floor_color3_1 as ND_floor_color3 }; - export namespace ND_floor_color4_1 { - let node_1151: string; - export { node_1151 as node }; - export namespace inputs_1151 { - let _in_341: string; - export { _in_341 as in }; - } - export { inputs_1151 as inputs }; - export namespace outputs_1151 { - let out_1121: string; - export { out_1121 as out }; - } - export { outputs_1151 as outputs }; - } - export { ND_floor_color4_1 as ND_floor_color4 }; - export namespace ND_floor_vector2_1 { - let node_1152: string; - export { node_1152 as node }; - export namespace inputs_1152 { - let _in_342: string; - export { _in_342 as in }; - } - export { inputs_1152 as inputs }; - export namespace outputs_1152 { - let out_1122: string; - export { out_1122 as out }; - } - export { outputs_1152 as outputs }; - } - export { ND_floor_vector2_1 as ND_floor_vector2 }; - export namespace ND_floor_vector3_1 { - let node_1153: string; - export { node_1153 as node }; - export namespace inputs_1153 { - let _in_343: string; - export { _in_343 as in }; - } - export { inputs_1153 as inputs }; - export namespace outputs_1153 { - let out_1123: string; - export { out_1123 as out }; - } - export { outputs_1153 as outputs }; - } - export { ND_floor_vector3_1 as ND_floor_vector3 }; - export namespace ND_floor_vector4_1 { - let node_1154: string; - export { node_1154 as node }; - export namespace inputs_1154 { - let _in_344: string; - export { _in_344 as in }; - } - export { inputs_1154 as inputs }; - export namespace outputs_1154 { - let out_1124: string; - export { out_1124 as out }; - } - export { outputs_1154 as outputs }; - } - export { ND_floor_vector4_1 as ND_floor_vector4 }; - export namespace ND_floor_integer_1 { - let node_1155: string; - export { node_1155 as node }; - export namespace inputs_1155 { - let _in_345: string; - export { _in_345 as in }; - } - export { inputs_1155 as inputs }; - export namespace outputs_1155 { - let out_1125: string; - export { out_1125 as out }; - } - export { outputs_1155 as outputs }; - } - export { ND_floor_integer_1 as ND_floor_integer }; - export namespace ND_ceil_float_1 { - let node_1156: string; - export { node_1156 as node }; - export namespace inputs_1156 { - let _in_346: string; - export { _in_346 as in }; - } - export { inputs_1156 as inputs }; - export namespace outputs_1156 { - let out_1126: string; - export { out_1126 as out }; - } - export { outputs_1156 as outputs }; - } - export { ND_ceil_float_1 as ND_ceil_float }; - export namespace ND_ceil_color3_1 { - let node_1157: string; - export { node_1157 as node }; - export namespace inputs_1157 { - let _in_347: string; - export { _in_347 as in }; - } - export { inputs_1157 as inputs }; - export namespace outputs_1157 { - let out_1127: string; - export { out_1127 as out }; - } - export { outputs_1157 as outputs }; - } - export { ND_ceil_color3_1 as ND_ceil_color3 }; - export namespace ND_ceil_color4_1 { - let node_1158: string; - export { node_1158 as node }; - export namespace inputs_1158 { - let _in_348: string; - export { _in_348 as in }; - } - export { inputs_1158 as inputs }; - export namespace outputs_1158 { - let out_1128: string; - export { out_1128 as out }; - } - export { outputs_1158 as outputs }; - } - export { ND_ceil_color4_1 as ND_ceil_color4 }; - export namespace ND_ceil_vector2_1 { - let node_1159: string; - export { node_1159 as node }; - export namespace inputs_1159 { - let _in_349: string; - export { _in_349 as in }; - } - export { inputs_1159 as inputs }; - export namespace outputs_1159 { - let out_1129: string; - export { out_1129 as out }; - } - export { outputs_1159 as outputs }; - } - export { ND_ceil_vector2_1 as ND_ceil_vector2 }; - export namespace ND_ceil_vector3_1 { - let node_1160: string; - export { node_1160 as node }; - export namespace inputs_1160 { - let _in_350: string; - export { _in_350 as in }; - } - export { inputs_1160 as inputs }; - export namespace outputs_1160 { - let out_1130: string; - export { out_1130 as out }; - } - export { outputs_1160 as outputs }; - } - export { ND_ceil_vector3_1 as ND_ceil_vector3 }; - export namespace ND_ceil_vector4_1 { - let node_1161: string; - export { node_1161 as node }; - export namespace inputs_1161 { - let _in_351: string; - export { _in_351 as in }; - } - export { inputs_1161 as inputs }; - export namespace outputs_1161 { - let out_1131: string; - export { out_1131 as out }; - } - export { outputs_1161 as outputs }; - } - export { ND_ceil_vector4_1 as ND_ceil_vector4 }; - export namespace ND_ceil_integer_1 { - let node_1162: string; - export { node_1162 as node }; - export namespace inputs_1162 { - let _in_352: string; - export { _in_352 as in }; - } - export { inputs_1162 as inputs }; - export namespace outputs_1162 { - let out_1132: string; - export { out_1132 as out }; - } - export { outputs_1162 as outputs }; - } - export { ND_ceil_integer_1 as ND_ceil_integer }; - export namespace ND_round_float_1 { - let node_1163: string; - export { node_1163 as node }; - export namespace inputs_1163 { - let _in_353: string; - export { _in_353 as in }; - } - export { inputs_1163 as inputs }; - export namespace outputs_1163 { - let out_1133: string; - export { out_1133 as out }; - } - export { outputs_1163 as outputs }; - } - export { ND_round_float_1 as ND_round_float }; - export namespace ND_round_color3_1 { - let node_1164: string; - export { node_1164 as node }; - export namespace inputs_1164 { - let _in_354: string; - export { _in_354 as in }; - } - export { inputs_1164 as inputs }; - export namespace outputs_1164 { - let out_1134: string; - export { out_1134 as out }; - } - export { outputs_1164 as outputs }; - } - export { ND_round_color3_1 as ND_round_color3 }; - export namespace ND_round_color4_1 { - let node_1165: string; - export { node_1165 as node }; - export namespace inputs_1165 { - let _in_355: string; - export { _in_355 as in }; - } - export { inputs_1165 as inputs }; - export namespace outputs_1165 { - let out_1135: string; - export { out_1135 as out }; - } - export { outputs_1165 as outputs }; - } - export { ND_round_color4_1 as ND_round_color4 }; - export namespace ND_round_vector2_1 { - let node_1166: string; - export { node_1166 as node }; - export namespace inputs_1166 { - let _in_356: string; - export { _in_356 as in }; - } - export { inputs_1166 as inputs }; - export namespace outputs_1166 { - let out_1136: string; - export { out_1136 as out }; - } - export { outputs_1166 as outputs }; - } - export { ND_round_vector2_1 as ND_round_vector2 }; - export namespace ND_round_vector3_1 { - let node_1167: string; - export { node_1167 as node }; - export namespace inputs_1167 { - let _in_357: string; - export { _in_357 as in }; - } - export { inputs_1167 as inputs }; - export namespace outputs_1167 { - let out_1137: string; - export { out_1137 as out }; - } - export { outputs_1167 as outputs }; - } - export { ND_round_vector3_1 as ND_round_vector3 }; - export namespace ND_round_vector4_1 { - let node_1168: string; - export { node_1168 as node }; - export namespace inputs_1168 { - let _in_358: string; - export { _in_358 as in }; - } - export { inputs_1168 as inputs }; - export namespace outputs_1168 { - let out_1138: string; - export { out_1138 as out }; - } - export { outputs_1168 as outputs }; - } - export { ND_round_vector4_1 as ND_round_vector4 }; - export namespace ND_round_integer_1 { - let node_1169: string; - export { node_1169 as node }; - export namespace inputs_1169 { - let _in_359: string; - export { _in_359 as in }; - } - export { inputs_1169 as inputs }; - export namespace outputs_1169 { - let out_1139: string; - export { out_1139 as out }; - } - export { outputs_1169 as outputs }; - } - export { ND_round_integer_1 as ND_round_integer }; - export namespace ND_power_float_1 { - let node_1170: string; - export { node_1170 as node }; - export namespace inputs_1170 { - let in1_300: string; - export { in1_300 as in1 }; - let in2_300: string; - export { in2_300 as in2 }; - } - export { inputs_1170 as inputs }; - export namespace outputs_1170 { - let out_1140: string; - export { out_1140 as out }; - } - export { outputs_1170 as outputs }; - } - export { ND_power_float_1 as ND_power_float }; - export namespace ND_power_color3_1 { - let node_1171: string; - export { node_1171 as node }; - export namespace inputs_1171 { - let in1_301: string; - export { in1_301 as in1 }; - let in2_301: string; - export { in2_301 as in2 }; - } - export { inputs_1171 as inputs }; - export namespace outputs_1171 { - let out_1141: string; - export { out_1141 as out }; - } - export { outputs_1171 as outputs }; - } - export { ND_power_color3_1 as ND_power_color3 }; - export namespace ND_power_color4_1 { - let node_1172: string; - export { node_1172 as node }; - export namespace inputs_1172 { - let in1_302: string; - export { in1_302 as in1 }; - let in2_302: string; - export { in2_302 as in2 }; - } - export { inputs_1172 as inputs }; - export namespace outputs_1172 { - let out_1142: string; - export { out_1142 as out }; - } - export { outputs_1172 as outputs }; - } - export { ND_power_color4_1 as ND_power_color4 }; - export namespace ND_power_vector2_1 { - let node_1173: string; - export { node_1173 as node }; - export namespace inputs_1173 { - let in1_303: string; - export { in1_303 as in1 }; - let in2_303: string; - export { in2_303 as in2 }; - } - export { inputs_1173 as inputs }; - export namespace outputs_1173 { - let out_1143: string; - export { out_1143 as out }; - } - export { outputs_1173 as outputs }; - } - export { ND_power_vector2_1 as ND_power_vector2 }; - export namespace ND_power_vector3_1 { - let node_1174: string; - export { node_1174 as node }; - export namespace inputs_1174 { - let in1_304: string; - export { in1_304 as in1 }; - let in2_304: string; - export { in2_304 as in2 }; - } - export { inputs_1174 as inputs }; - export namespace outputs_1174 { - let out_1144: string; - export { out_1144 as out }; - } - export { outputs_1174 as outputs }; - } - export { ND_power_vector3_1 as ND_power_vector3 }; - export namespace ND_power_vector4_1 { - let node_1175: string; - export { node_1175 as node }; - export namespace inputs_1175 { - let in1_305: string; - export { in1_305 as in1 }; - let in2_305: string; - export { in2_305 as in2 }; - } - export { inputs_1175 as inputs }; - export namespace outputs_1175 { - let out_1145: string; - export { out_1145 as out }; - } - export { outputs_1175 as outputs }; - } - export { ND_power_vector4_1 as ND_power_vector4 }; - export namespace ND_power_color3FA_1 { - let node_1176: string; - export { node_1176 as node }; - export namespace inputs_1176 { - let in1_306: string; - export { in1_306 as in1 }; - let in2_306: string; - export { in2_306 as in2 }; - } - export { inputs_1176 as inputs }; - export namespace outputs_1176 { - let out_1146: string; - export { out_1146 as out }; - } - export { outputs_1176 as outputs }; - } - export { ND_power_color3FA_1 as ND_power_color3FA }; - export namespace ND_power_color4FA_1 { - let node_1177: string; - export { node_1177 as node }; - export namespace inputs_1177 { - let in1_307: string; - export { in1_307 as in1 }; - let in2_307: string; - export { in2_307 as in2 }; - } - export { inputs_1177 as inputs }; - export namespace outputs_1177 { - let out_1147: string; - export { out_1147 as out }; - } - export { outputs_1177 as outputs }; - } - export { ND_power_color4FA_1 as ND_power_color4FA }; - export namespace ND_power_vector2FA_1 { - let node_1178: string; - export { node_1178 as node }; - export namespace inputs_1178 { - let in1_308: string; - export { in1_308 as in1 }; - let in2_308: string; - export { in2_308 as in2 }; - } - export { inputs_1178 as inputs }; - export namespace outputs_1178 { - let out_1148: string; - export { out_1148 as out }; - } - export { outputs_1178 as outputs }; - } - export { ND_power_vector2FA_1 as ND_power_vector2FA }; - export namespace ND_power_vector3FA_1 { - let node_1179: string; - export { node_1179 as node }; - export namespace inputs_1179 { - let in1_309: string; - export { in1_309 as in1 }; - let in2_309: string; - export { in2_309 as in2 }; - } - export { inputs_1179 as inputs }; - export namespace outputs_1179 { - let out_1149: string; - export { out_1149 as out }; - } - export { outputs_1179 as outputs }; - } - export { ND_power_vector3FA_1 as ND_power_vector3FA }; - export namespace ND_power_vector4FA_1 { - let node_1180: string; - export { node_1180 as node }; - export namespace inputs_1180 { - let in1_310: string; - export { in1_310 as in1 }; - let in2_310: string; - export { in2_310 as in2 }; - } - export { inputs_1180 as inputs }; - export namespace outputs_1180 { - let out_1150: string; - export { out_1150 as out }; - } - export { outputs_1180 as outputs }; - } - export { ND_power_vector4FA_1 as ND_power_vector4FA }; - export namespace ND_safepower_float_1 { - let node_1181: string; - export { node_1181 as node }; - export namespace inputs_1181 { - let in1_311: string; - export { in1_311 as in1 }; - let in2_311: string; - export { in2_311 as in2 }; - } - export { inputs_1181 as inputs }; - export namespace outputs_1181 { - let out_1151: string; - export { out_1151 as out }; - } - export { outputs_1181 as outputs }; - } - export { ND_safepower_float_1 as ND_safepower_float }; - export namespace ND_safepower_color3_1 { - let node_1182: string; - export { node_1182 as node }; - export namespace inputs_1182 { - let in1_312: string; - export { in1_312 as in1 }; - let in2_312: string; - export { in2_312 as in2 }; - } - export { inputs_1182 as inputs }; - export namespace outputs_1182 { - let out_1152: string; - export { out_1152 as out }; - } - export { outputs_1182 as outputs }; - } - export { ND_safepower_color3_1 as ND_safepower_color3 }; - export namespace ND_safepower_color4_1 { - let node_1183: string; - export { node_1183 as node }; - export namespace inputs_1183 { - let in1_313: string; - export { in1_313 as in1 }; - let in2_313: string; - export { in2_313 as in2 }; - } - export { inputs_1183 as inputs }; - export namespace outputs_1183 { - let out_1153: string; - export { out_1153 as out }; - } - export { outputs_1183 as outputs }; - } - export { ND_safepower_color4_1 as ND_safepower_color4 }; - export namespace ND_safepower_vector2_1 { - let node_1184: string; - export { node_1184 as node }; - export namespace inputs_1184 { - let in1_314: string; - export { in1_314 as in1 }; - let in2_314: string; - export { in2_314 as in2 }; - } - export { inputs_1184 as inputs }; - export namespace outputs_1184 { - let out_1154: string; - export { out_1154 as out }; - } - export { outputs_1184 as outputs }; - } - export { ND_safepower_vector2_1 as ND_safepower_vector2 }; - export namespace ND_safepower_vector3_1 { - let node_1185: string; - export { node_1185 as node }; - export namespace inputs_1185 { - let in1_315: string; - export { in1_315 as in1 }; - let in2_315: string; - export { in2_315 as in2 }; - } - export { inputs_1185 as inputs }; - export namespace outputs_1185 { - let out_1155: string; - export { out_1155 as out }; - } - export { outputs_1185 as outputs }; - } - export { ND_safepower_vector3_1 as ND_safepower_vector3 }; - export namespace ND_safepower_vector4_1 { - let node_1186: string; - export { node_1186 as node }; - export namespace inputs_1186 { - let in1_316: string; - export { in1_316 as in1 }; - let in2_316: string; - export { in2_316 as in2 }; - } - export { inputs_1186 as inputs }; - export namespace outputs_1186 { - let out_1156: string; - export { out_1156 as out }; - } - export { outputs_1186 as outputs }; - } - export { ND_safepower_vector4_1 as ND_safepower_vector4 }; - export namespace ND_safepower_color3FA_1 { - let node_1187: string; - export { node_1187 as node }; - export namespace inputs_1187 { - let in1_317: string; - export { in1_317 as in1 }; - let in2_317: string; - export { in2_317 as in2 }; - } - export { inputs_1187 as inputs }; - export namespace outputs_1187 { - let out_1157: string; - export { out_1157 as out }; - } - export { outputs_1187 as outputs }; - } - export { ND_safepower_color3FA_1 as ND_safepower_color3FA }; - export namespace ND_safepower_color4FA_1 { - let node_1188: string; - export { node_1188 as node }; - export namespace inputs_1188 { - let in1_318: string; - export { in1_318 as in1 }; - let in2_318: string; - export { in2_318 as in2 }; - } - export { inputs_1188 as inputs }; - export namespace outputs_1188 { - let out_1158: string; - export { out_1158 as out }; - } - export { outputs_1188 as outputs }; - } - export { ND_safepower_color4FA_1 as ND_safepower_color4FA }; - export namespace ND_safepower_vector2FA_1 { - let node_1189: string; - export { node_1189 as node }; - export namespace inputs_1189 { - let in1_319: string; - export { in1_319 as in1 }; - let in2_319: string; - export { in2_319 as in2 }; - } - export { inputs_1189 as inputs }; - export namespace outputs_1189 { - let out_1159: string; - export { out_1159 as out }; - } - export { outputs_1189 as outputs }; - } - export { ND_safepower_vector2FA_1 as ND_safepower_vector2FA }; - export namespace ND_safepower_vector3FA_1 { - let node_1190: string; - export { node_1190 as node }; - export namespace inputs_1190 { - let in1_320: string; - export { in1_320 as in1 }; - let in2_320: string; - export { in2_320 as in2 }; - } - export { inputs_1190 as inputs }; - export namespace outputs_1190 { - let out_1160: string; - export { out_1160 as out }; - } - export { outputs_1190 as outputs }; - } - export { ND_safepower_vector3FA_1 as ND_safepower_vector3FA }; - export namespace ND_safepower_vector4FA_1 { - let node_1191: string; - export { node_1191 as node }; - export namespace inputs_1191 { - let in1_321: string; - export { in1_321 as in1 }; - let in2_321: string; - export { in2_321 as in2 }; - } - export { inputs_1191 as inputs }; - export namespace outputs_1191 { - let out_1161: string; - export { out_1161 as out }; - } - export { outputs_1191 as outputs }; - } - export { ND_safepower_vector4FA_1 as ND_safepower_vector4FA }; - export namespace ND_sin_float_1 { - let node_1192: string; - export { node_1192 as node }; - export namespace inputs_1192 { - let _in_360: string; - export { _in_360 as in }; - } - export { inputs_1192 as inputs }; - export namespace outputs_1192 { - let out_1162: string; - export { out_1162 as out }; - } - export { outputs_1192 as outputs }; - } - export { ND_sin_float_1 as ND_sin_float }; - export namespace ND_cos_float_1 { - let node_1193: string; - export { node_1193 as node }; - export namespace inputs_1193 { - let _in_361: string; - export { _in_361 as in }; - } - export { inputs_1193 as inputs }; - export namespace outputs_1193 { - let out_1163: string; - export { out_1163 as out }; - } - export { outputs_1193 as outputs }; - } - export { ND_cos_float_1 as ND_cos_float }; - export namespace ND_tan_float_1 { - let node_1194: string; - export { node_1194 as node }; - export namespace inputs_1194 { - let _in_362: string; - export { _in_362 as in }; - } - export { inputs_1194 as inputs }; - export namespace outputs_1194 { - let out_1164: string; - export { out_1164 as out }; - } - export { outputs_1194 as outputs }; - } - export { ND_tan_float_1 as ND_tan_float }; - export namespace ND_asin_float_1 { - let node_1195: string; - export { node_1195 as node }; - export namespace inputs_1195 { - let _in_363: string; - export { _in_363 as in }; - } - export { inputs_1195 as inputs }; - export namespace outputs_1195 { - let out_1165: string; - export { out_1165 as out }; - } - export { outputs_1195 as outputs }; - } - export { ND_asin_float_1 as ND_asin_float }; - export namespace ND_acos_float_1 { - let node_1196: string; - export { node_1196 as node }; - export namespace inputs_1196 { - let _in_364: string; - export { _in_364 as in }; - } - export { inputs_1196 as inputs }; - export namespace outputs_1196 { - let out_1166: string; - export { out_1166 as out }; - } - export { outputs_1196 as outputs }; - } - export { ND_acos_float_1 as ND_acos_float }; - export namespace ND_atan2_float_1 { - let node_1197: string; - export { node_1197 as node }; - export namespace inputs_1197 { - let iny_4: string; - export { iny_4 as iny }; - let inx_4: string; - export { inx_4 as inx }; - } - export { inputs_1197 as inputs }; - export namespace outputs_1197 { - let out_1167: string; - export { out_1167 as out }; - } - export { outputs_1197 as outputs }; - } - export { ND_atan2_float_1 as ND_atan2_float }; - export namespace ND_sin_vector2_1 { - let node_1198: string; - export { node_1198 as node }; - export namespace inputs_1198 { - let _in_365: string; - export { _in_365 as in }; - } - export { inputs_1198 as inputs }; - export namespace outputs_1198 { - let out_1168: string; - export { out_1168 as out }; - } - export { outputs_1198 as outputs }; - } - export { ND_sin_vector2_1 as ND_sin_vector2 }; - export namespace ND_cos_vector2_1 { - let node_1199: string; - export { node_1199 as node }; - export namespace inputs_1199 { - let _in_366: string; - export { _in_366 as in }; - } - export { inputs_1199 as inputs }; - export namespace outputs_1199 { - let out_1169: string; - export { out_1169 as out }; - } - export { outputs_1199 as outputs }; - } - export { ND_cos_vector2_1 as ND_cos_vector2 }; - export namespace ND_tan_vector2_1 { - let node_1200: string; - export { node_1200 as node }; - export namespace inputs_1200 { - let _in_367: string; - export { _in_367 as in }; - } - export { inputs_1200 as inputs }; - export namespace outputs_1200 { - let out_1170: string; - export { out_1170 as out }; - } - export { outputs_1200 as outputs }; - } - export { ND_tan_vector2_1 as ND_tan_vector2 }; - export namespace ND_asin_vector2_1 { - let node_1201: string; - export { node_1201 as node }; - export namespace inputs_1201 { - let _in_368: string; - export { _in_368 as in }; - } - export { inputs_1201 as inputs }; - export namespace outputs_1201 { - let out_1171: string; - export { out_1171 as out }; - } - export { outputs_1201 as outputs }; - } - export { ND_asin_vector2_1 as ND_asin_vector2 }; - export namespace ND_acos_vector2_1 { - let node_1202: string; - export { node_1202 as node }; - export namespace inputs_1202 { - let _in_369: string; - export { _in_369 as in }; - } - export { inputs_1202 as inputs }; - export namespace outputs_1202 { - let out_1172: string; - export { out_1172 as out }; - } - export { outputs_1202 as outputs }; - } - export { ND_acos_vector2_1 as ND_acos_vector2 }; - export namespace ND_atan2_vector2_1 { - let node_1203: string; - export { node_1203 as node }; - export namespace inputs_1203 { - let iny_5: string; - export { iny_5 as iny }; - let inx_5: string; - export { inx_5 as inx }; - } - export { inputs_1203 as inputs }; - export namespace outputs_1203 { - let out_1173: string; - export { out_1173 as out }; - } - export { outputs_1203 as outputs }; - } - export { ND_atan2_vector2_1 as ND_atan2_vector2 }; - export namespace ND_sin_vector3_1 { - let node_1204: string; - export { node_1204 as node }; - export namespace inputs_1204 { - let _in_370: string; - export { _in_370 as in }; - } - export { inputs_1204 as inputs }; - export namespace outputs_1204 { - let out_1174: string; - export { out_1174 as out }; - } - export { outputs_1204 as outputs }; - } - export { ND_sin_vector3_1 as ND_sin_vector3 }; - export namespace ND_cos_vector3_1 { - let node_1205: string; - export { node_1205 as node }; - export namespace inputs_1205 { - let _in_371: string; - export { _in_371 as in }; - } - export { inputs_1205 as inputs }; - export namespace outputs_1205 { - let out_1175: string; - export { out_1175 as out }; - } - export { outputs_1205 as outputs }; - } - export { ND_cos_vector3_1 as ND_cos_vector3 }; - export namespace ND_tan_vector3_1 { - let node_1206: string; - export { node_1206 as node }; - export namespace inputs_1206 { - let _in_372: string; - export { _in_372 as in }; - } - export { inputs_1206 as inputs }; - export namespace outputs_1206 { - let out_1176: string; - export { out_1176 as out }; - } - export { outputs_1206 as outputs }; - } - export { ND_tan_vector3_1 as ND_tan_vector3 }; - export namespace ND_asin_vector3_1 { - let node_1207: string; - export { node_1207 as node }; - export namespace inputs_1207 { - let _in_373: string; - export { _in_373 as in }; - } - export { inputs_1207 as inputs }; - export namespace outputs_1207 { - let out_1177: string; - export { out_1177 as out }; - } - export { outputs_1207 as outputs }; - } - export { ND_asin_vector3_1 as ND_asin_vector3 }; - export namespace ND_acos_vector3_1 { - let node_1208: string; - export { node_1208 as node }; - export namespace inputs_1208 { - let _in_374: string; - export { _in_374 as in }; - } - export { inputs_1208 as inputs }; - export namespace outputs_1208 { - let out_1178: string; - export { out_1178 as out }; - } - export { outputs_1208 as outputs }; - } - export { ND_acos_vector3_1 as ND_acos_vector3 }; - export namespace ND_atan2_vector3_1 { - let node_1209: string; - export { node_1209 as node }; - export namespace inputs_1209 { - let iny_6: string; - export { iny_6 as iny }; - let inx_6: string; - export { inx_6 as inx }; - } - export { inputs_1209 as inputs }; - export namespace outputs_1209 { - let out_1179: string; - export { out_1179 as out }; - } - export { outputs_1209 as outputs }; - } - export { ND_atan2_vector3_1 as ND_atan2_vector3 }; - export namespace ND_sin_vector4_1 { - let node_1210: string; - export { node_1210 as node }; - export namespace inputs_1210 { - let _in_375: string; - export { _in_375 as in }; - } - export { inputs_1210 as inputs }; - export namespace outputs_1210 { - let out_1180: string; - export { out_1180 as out }; - } - export { outputs_1210 as outputs }; - } - export { ND_sin_vector4_1 as ND_sin_vector4 }; - export namespace ND_cos_vector4_1 { - let node_1211: string; - export { node_1211 as node }; - export namespace inputs_1211 { - let _in_376: string; - export { _in_376 as in }; - } - export { inputs_1211 as inputs }; - export namespace outputs_1211 { - let out_1181: string; - export { out_1181 as out }; - } - export { outputs_1211 as outputs }; - } - export { ND_cos_vector4_1 as ND_cos_vector4 }; - export namespace ND_tan_vector4_1 { - let node_1212: string; - export { node_1212 as node }; - export namespace inputs_1212 { - let _in_377: string; - export { _in_377 as in }; - } - export { inputs_1212 as inputs }; - export namespace outputs_1212 { - let out_1182: string; - export { out_1182 as out }; - } - export { outputs_1212 as outputs }; - } - export { ND_tan_vector4_1 as ND_tan_vector4 }; - export namespace ND_asin_vector4_1 { - let node_1213: string; - export { node_1213 as node }; - export namespace inputs_1213 { - let _in_378: string; - export { _in_378 as in }; - } - export { inputs_1213 as inputs }; - export namespace outputs_1213 { - let out_1183: string; - export { out_1183 as out }; - } - export { outputs_1213 as outputs }; - } - export { ND_asin_vector4_1 as ND_asin_vector4 }; - export namespace ND_acos_vector4_1 { - let node_1214: string; - export { node_1214 as node }; - export namespace inputs_1214 { - let _in_379: string; - export { _in_379 as in }; - } - export { inputs_1214 as inputs }; - export namespace outputs_1214 { - let out_1184: string; - export { out_1184 as out }; - } - export { outputs_1214 as outputs }; - } - export { ND_acos_vector4_1 as ND_acos_vector4 }; - export namespace ND_atan2_vector4_1 { - let node_1215: string; - export { node_1215 as node }; - export namespace inputs_1215 { - let iny_7: string; - export { iny_7 as iny }; - let inx_7: string; - export { inx_7 as inx }; - } - export { inputs_1215 as inputs }; - export namespace outputs_1215 { - let out_1185: string; - export { out_1185 as out }; - } - export { outputs_1215 as outputs }; - } - export { ND_atan2_vector4_1 as ND_atan2_vector4 }; - export namespace ND_sqrt_float_1 { - let node_1216: string; - export { node_1216 as node }; - export namespace inputs_1216 { - let _in_380: string; - export { _in_380 as in }; - } - export { inputs_1216 as inputs }; - export namespace outputs_1216 { - let out_1186: string; - export { out_1186 as out }; - } - export { outputs_1216 as outputs }; - } - export { ND_sqrt_float_1 as ND_sqrt_float }; - export namespace ND_ln_float_1 { - let node_1217: string; - export { node_1217 as node }; - export namespace inputs_1217 { - let _in_381: string; - export { _in_381 as in }; - } - export { inputs_1217 as inputs }; - export namespace outputs_1217 { - let out_1187: string; - export { out_1187 as out }; - } - export { outputs_1217 as outputs }; - } - export { ND_ln_float_1 as ND_ln_float }; - export namespace ND_exp_float_1 { - let node_1218: string; - export { node_1218 as node }; - export namespace inputs_1218 { - let _in_382: string; - export { _in_382 as in }; - } - export { inputs_1218 as inputs }; - export namespace outputs_1218 { - let out_1188: string; - export { out_1188 as out }; - } - export { outputs_1218 as outputs }; - } - export { ND_exp_float_1 as ND_exp_float }; - export namespace ND_sqrt_vector2_1 { - let node_1219: string; - export { node_1219 as node }; - export namespace inputs_1219 { - let _in_383: string; - export { _in_383 as in }; - } - export { inputs_1219 as inputs }; - export namespace outputs_1219 { - let out_1189: string; - export { out_1189 as out }; - } - export { outputs_1219 as outputs }; - } - export { ND_sqrt_vector2_1 as ND_sqrt_vector2 }; - export namespace ND_ln_vector2_1 { - let node_1220: string; - export { node_1220 as node }; - export namespace inputs_1220 { - let _in_384: string; - export { _in_384 as in }; - } - export { inputs_1220 as inputs }; - export namespace outputs_1220 { - let out_1190: string; - export { out_1190 as out }; - } - export { outputs_1220 as outputs }; - } - export { ND_ln_vector2_1 as ND_ln_vector2 }; - export namespace ND_exp_vector2_1 { - let node_1221: string; - export { node_1221 as node }; - export namespace inputs_1221 { - let _in_385: string; - export { _in_385 as in }; - } - export { inputs_1221 as inputs }; - export namespace outputs_1221 { - let out_1191: string; - export { out_1191 as out }; - } - export { outputs_1221 as outputs }; - } - export { ND_exp_vector2_1 as ND_exp_vector2 }; - export namespace ND_sqrt_vector3_1 { - let node_1222: string; - export { node_1222 as node }; - export namespace inputs_1222 { - let _in_386: string; - export { _in_386 as in }; - } - export { inputs_1222 as inputs }; - export namespace outputs_1222 { - let out_1192: string; - export { out_1192 as out }; - } - export { outputs_1222 as outputs }; - } - export { ND_sqrt_vector3_1 as ND_sqrt_vector3 }; - export namespace ND_ln_vector3_1 { - let node_1223: string; - export { node_1223 as node }; - export namespace inputs_1223 { - let _in_387: string; - export { _in_387 as in }; - } - export { inputs_1223 as inputs }; - export namespace outputs_1223 { - let out_1193: string; - export { out_1193 as out }; - } - export { outputs_1223 as outputs }; - } - export { ND_ln_vector3_1 as ND_ln_vector3 }; - export namespace ND_exp_vector3_1 { - let node_1224: string; - export { node_1224 as node }; - export namespace inputs_1224 { - let _in_388: string; - export { _in_388 as in }; - } - export { inputs_1224 as inputs }; - export namespace outputs_1224 { - let out_1194: string; - export { out_1194 as out }; - } - export { outputs_1224 as outputs }; - } - export { ND_exp_vector3_1 as ND_exp_vector3 }; - export namespace ND_sqrt_vector4_1 { - let node_1225: string; - export { node_1225 as node }; - export namespace inputs_1225 { - let _in_389: string; - export { _in_389 as in }; - } - export { inputs_1225 as inputs }; - export namespace outputs_1225 { - let out_1195: string; - export { out_1195 as out }; - } - export { outputs_1225 as outputs }; - } - export { ND_sqrt_vector4_1 as ND_sqrt_vector4 }; - export namespace ND_ln_vector4_1 { - let node_1226: string; - export { node_1226 as node }; - export namespace inputs_1226 { - let _in_390: string; - export { _in_390 as in }; - } - export { inputs_1226 as inputs }; - export namespace outputs_1226 { - let out_1196: string; - export { out_1196 as out }; - } - export { outputs_1226 as outputs }; - } - export { ND_ln_vector4_1 as ND_ln_vector4 }; - export namespace ND_exp_vector4_1 { - let node_1227: string; - export { node_1227 as node }; - export namespace inputs_1227 { - let _in_391: string; - export { _in_391 as in }; - } - export { inputs_1227 as inputs }; - export namespace outputs_1227 { - let out_1197: string; - export { out_1197 as out }; - } - export { outputs_1227 as outputs }; - } - export { ND_exp_vector4_1 as ND_exp_vector4 }; - export namespace ND_sign_float_1 { - let node_1228: string; - export { node_1228 as node }; - export namespace inputs_1228 { - let _in_392: string; - export { _in_392 as in }; - } - export { inputs_1228 as inputs }; - export namespace outputs_1228 { - let out_1198: string; - export { out_1198 as out }; - } - export { outputs_1228 as outputs }; - } - export { ND_sign_float_1 as ND_sign_float }; - export namespace ND_sign_color3_1 { - let node_1229: string; - export { node_1229 as node }; - export namespace inputs_1229 { - let _in_393: string; - export { _in_393 as in }; - } - export { inputs_1229 as inputs }; - export namespace outputs_1229 { - let out_1199: string; - export { out_1199 as out }; - } - export { outputs_1229 as outputs }; - } - export { ND_sign_color3_1 as ND_sign_color3 }; - export namespace ND_sign_color4_1 { - let node_1230: string; - export { node_1230 as node }; - export namespace inputs_1230 { - let _in_394: string; - export { _in_394 as in }; - } - export { inputs_1230 as inputs }; - export namespace outputs_1230 { - let out_1200: string; - export { out_1200 as out }; - } - export { outputs_1230 as outputs }; - } - export { ND_sign_color4_1 as ND_sign_color4 }; - export namespace ND_sign_vector2_1 { - let node_1231: string; - export { node_1231 as node }; - export namespace inputs_1231 { - let _in_395: string; - export { _in_395 as in }; - } - export { inputs_1231 as inputs }; - export namespace outputs_1231 { - let out_1201: string; - export { out_1201 as out }; - } - export { outputs_1231 as outputs }; - } - export { ND_sign_vector2_1 as ND_sign_vector2 }; - export namespace ND_sign_vector3_1 { - let node_1232: string; - export { node_1232 as node }; - export namespace inputs_1232 { - let _in_396: string; - export { _in_396 as in }; - } - export { inputs_1232 as inputs }; - export namespace outputs_1232 { - let out_1202: string; - export { out_1202 as out }; - } - export { outputs_1232 as outputs }; - } - export { ND_sign_vector3_1 as ND_sign_vector3 }; - export namespace ND_sign_vector4_1 { - let node_1233: string; - export { node_1233 as node }; - export namespace inputs_1233 { - let _in_397: string; - export { _in_397 as in }; - } - export { inputs_1233 as inputs }; - export namespace outputs_1233 { - let out_1203: string; - export { out_1203 as out }; - } - export { outputs_1233 as outputs }; - } - export { ND_sign_vector4_1 as ND_sign_vector4 }; - export namespace ND_clamp_float_1 { - let node_1234: string; - export { node_1234 as node }; - export namespace inputs_1234 { - let _in_398: string; - export { _in_398 as in }; - let low_22: string; - export { low_22 as low }; - let high_22: string; - export { high_22 as high }; - } - export { inputs_1234 as inputs }; - export namespace outputs_1234 { - let out_1204: string; - export { out_1204 as out }; - } - export { outputs_1234 as outputs }; - } - export { ND_clamp_float_1 as ND_clamp_float }; - export namespace ND_clamp_color3_1 { - let node_1235: string; - export { node_1235 as node }; - export namespace inputs_1235 { - let _in_399: string; - export { _in_399 as in }; - let low_23: string; - export { low_23 as low }; - let high_23: string; - export { high_23 as high }; - } - export { inputs_1235 as inputs }; - export namespace outputs_1235 { - let out_1205: string; - export { out_1205 as out }; - } - export { outputs_1235 as outputs }; - } - export { ND_clamp_color3_1 as ND_clamp_color3 }; - export namespace ND_clamp_color4_1 { - let node_1236: string; - export { node_1236 as node }; - export namespace inputs_1236 { - let _in_400: string; - export { _in_400 as in }; - let low_24: string; - export { low_24 as low }; - let high_24: string; - export { high_24 as high }; - } - export { inputs_1236 as inputs }; - export namespace outputs_1236 { - let out_1206: string; - export { out_1206 as out }; - } - export { outputs_1236 as outputs }; - } - export { ND_clamp_color4_1 as ND_clamp_color4 }; - export namespace ND_clamp_vector2_1 { - let node_1237: string; - export { node_1237 as node }; - export namespace inputs_1237 { - let _in_401: string; - export { _in_401 as in }; - let low_25: string; - export { low_25 as low }; - let high_25: string; - export { high_25 as high }; - } - export { inputs_1237 as inputs }; - export namespace outputs_1237 { - let out_1207: string; - export { out_1207 as out }; - } - export { outputs_1237 as outputs }; - } - export { ND_clamp_vector2_1 as ND_clamp_vector2 }; - export namespace ND_clamp_vector3_1 { - let node_1238: string; - export { node_1238 as node }; - export namespace inputs_1238 { - let _in_402: string; - export { _in_402 as in }; - let low_26: string; - export { low_26 as low }; - let high_26: string; - export { high_26 as high }; - } - export { inputs_1238 as inputs }; - export namespace outputs_1238 { - let out_1208: string; - export { out_1208 as out }; - } - export { outputs_1238 as outputs }; - } - export { ND_clamp_vector3_1 as ND_clamp_vector3 }; - export namespace ND_clamp_vector4_1 { - let node_1239: string; - export { node_1239 as node }; - export namespace inputs_1239 { - let _in_403: string; - export { _in_403 as in }; - let low_27: string; - export { low_27 as low }; - let high_27: string; - export { high_27 as high }; - } - export { inputs_1239 as inputs }; - export namespace outputs_1239 { - let out_1209: string; - export { out_1209 as out }; - } - export { outputs_1239 as outputs }; - } - export { ND_clamp_vector4_1 as ND_clamp_vector4 }; - export namespace ND_clamp_color3FA_1 { - let node_1240: string; - export { node_1240 as node }; - export namespace inputs_1240 { - let _in_404: string; - export { _in_404 as in }; - let low_28: string; - export { low_28 as low }; - let high_28: string; - export { high_28 as high }; - } - export { inputs_1240 as inputs }; - export namespace outputs_1240 { - let out_1210: string; - export { out_1210 as out }; - } - export { outputs_1240 as outputs }; - } - export { ND_clamp_color3FA_1 as ND_clamp_color3FA }; - export namespace ND_clamp_color4FA_1 { - let node_1241: string; - export { node_1241 as node }; - export namespace inputs_1241 { - let _in_405: string; - export { _in_405 as in }; - let low_29: string; - export { low_29 as low }; - let high_29: string; - export { high_29 as high }; - } - export { inputs_1241 as inputs }; - export namespace outputs_1241 { - let out_1211: string; - export { out_1211 as out }; - } - export { outputs_1241 as outputs }; - } - export { ND_clamp_color4FA_1 as ND_clamp_color4FA }; - export namespace ND_clamp_vector2FA_1 { - let node_1242: string; - export { node_1242 as node }; - export namespace inputs_1242 { - let _in_406: string; - export { _in_406 as in }; - let low_30: string; - export { low_30 as low }; - let high_30: string; - export { high_30 as high }; - } - export { inputs_1242 as inputs }; - export namespace outputs_1242 { - let out_1212: string; - export { out_1212 as out }; - } - export { outputs_1242 as outputs }; - } - export { ND_clamp_vector2FA_1 as ND_clamp_vector2FA }; - export namespace ND_clamp_vector3FA_1 { - let node_1243: string; - export { node_1243 as node }; - export namespace inputs_1243 { - let _in_407: string; - export { _in_407 as in }; - let low_31: string; - export { low_31 as low }; - let high_31: string; - export { high_31 as high }; - } - export { inputs_1243 as inputs }; - export namespace outputs_1243 { - let out_1213: string; - export { out_1213 as out }; - } - export { outputs_1243 as outputs }; - } - export { ND_clamp_vector3FA_1 as ND_clamp_vector3FA }; - export namespace ND_clamp_vector4FA_1 { - let node_1244: string; - export { node_1244 as node }; - export namespace inputs_1244 { - let _in_408: string; - export { _in_408 as in }; - let low_32: string; - export { low_32 as low }; - let high_32: string; - export { high_32 as high }; - } - export { inputs_1244 as inputs }; - export namespace outputs_1244 { - let out_1214: string; - export { out_1214 as out }; - } - export { outputs_1244 as outputs }; - } - export { ND_clamp_vector4FA_1 as ND_clamp_vector4FA }; - export namespace ND_min_float_1 { - let node_1245: string; - export { node_1245 as node }; - export namespace inputs_1245 { - let in1_322: string; - export { in1_322 as in1 }; - let in2_322: string; - export { in2_322 as in2 }; - } - export { inputs_1245 as inputs }; - export namespace outputs_1245 { - let out_1215: string; - export { out_1215 as out }; - } - export { outputs_1245 as outputs }; - } - export { ND_min_float_1 as ND_min_float }; - export namespace ND_min_color3_1 { - let node_1246: string; - export { node_1246 as node }; - export namespace inputs_1246 { - let in1_323: string; - export { in1_323 as in1 }; - let in2_323: string; - export { in2_323 as in2 }; - } - export { inputs_1246 as inputs }; - export namespace outputs_1246 { - let out_1216: string; - export { out_1216 as out }; - } - export { outputs_1246 as outputs }; - } - export { ND_min_color3_1 as ND_min_color3 }; - export namespace ND_min_color4_1 { - let node_1247: string; - export { node_1247 as node }; - export namespace inputs_1247 { - let in1_324: string; - export { in1_324 as in1 }; - let in2_324: string; - export { in2_324 as in2 }; - } - export { inputs_1247 as inputs }; - export namespace outputs_1247 { - let out_1217: string; - export { out_1217 as out }; - } - export { outputs_1247 as outputs }; - } - export { ND_min_color4_1 as ND_min_color4 }; - export namespace ND_min_vector2_1 { - let node_1248: string; - export { node_1248 as node }; - export namespace inputs_1248 { - let in1_325: string; - export { in1_325 as in1 }; - let in2_325: string; - export { in2_325 as in2 }; - } - export { inputs_1248 as inputs }; - export namespace outputs_1248 { - let out_1218: string; - export { out_1218 as out }; - } - export { outputs_1248 as outputs }; - } - export { ND_min_vector2_1 as ND_min_vector2 }; - export namespace ND_min_vector3_1 { - let node_1249: string; - export { node_1249 as node }; - export namespace inputs_1249 { - let in1_326: string; - export { in1_326 as in1 }; - let in2_326: string; - export { in2_326 as in2 }; - } - export { inputs_1249 as inputs }; - export namespace outputs_1249 { - let out_1219: string; - export { out_1219 as out }; - } - export { outputs_1249 as outputs }; - } - export { ND_min_vector3_1 as ND_min_vector3 }; - export namespace ND_min_vector4_1 { - let node_1250: string; - export { node_1250 as node }; - export namespace inputs_1250 { - let in1_327: string; - export { in1_327 as in1 }; - let in2_327: string; - export { in2_327 as in2 }; - } - export { inputs_1250 as inputs }; - export namespace outputs_1250 { - let out_1220: string; - export { out_1220 as out }; - } - export { outputs_1250 as outputs }; - } - export { ND_min_vector4_1 as ND_min_vector4 }; - export namespace ND_min_color3FA_1 { - let node_1251: string; - export { node_1251 as node }; - export namespace inputs_1251 { - let in1_328: string; - export { in1_328 as in1 }; - let in2_328: string; - export { in2_328 as in2 }; - } - export { inputs_1251 as inputs }; - export namespace outputs_1251 { - let out_1221: string; - export { out_1221 as out }; - } - export { outputs_1251 as outputs }; - } - export { ND_min_color3FA_1 as ND_min_color3FA }; - export namespace ND_min_color4FA_1 { - let node_1252: string; - export { node_1252 as node }; - export namespace inputs_1252 { - let in1_329: string; - export { in1_329 as in1 }; - let in2_329: string; - export { in2_329 as in2 }; - } - export { inputs_1252 as inputs }; - export namespace outputs_1252 { - let out_1222: string; - export { out_1222 as out }; - } - export { outputs_1252 as outputs }; - } - export { ND_min_color4FA_1 as ND_min_color4FA }; - export namespace ND_min_vector2FA_1 { - let node_1253: string; - export { node_1253 as node }; - export namespace inputs_1253 { - let in1_330: string; - export { in1_330 as in1 }; - let in2_330: string; - export { in2_330 as in2 }; - } - export { inputs_1253 as inputs }; - export namespace outputs_1253 { - let out_1223: string; - export { out_1223 as out }; - } - export { outputs_1253 as outputs }; - } - export { ND_min_vector2FA_1 as ND_min_vector2FA }; - export namespace ND_min_vector3FA_1 { - let node_1254: string; - export { node_1254 as node }; - export namespace inputs_1254 { - let in1_331: string; - export { in1_331 as in1 }; - let in2_331: string; - export { in2_331 as in2 }; - } - export { inputs_1254 as inputs }; - export namespace outputs_1254 { - let out_1224: string; - export { out_1224 as out }; - } - export { outputs_1254 as outputs }; - } - export { ND_min_vector3FA_1 as ND_min_vector3FA }; - export namespace ND_min_vector4FA_1 { - let node_1255: string; - export { node_1255 as node }; - export namespace inputs_1255 { - let in1_332: string; - export { in1_332 as in1 }; - let in2_332: string; - export { in2_332 as in2 }; - } - export { inputs_1255 as inputs }; - export namespace outputs_1255 { - let out_1225: string; - export { out_1225 as out }; - } - export { outputs_1255 as outputs }; - } - export { ND_min_vector4FA_1 as ND_min_vector4FA }; - export namespace ND_max_float_1 { - let node_1256: string; - export { node_1256 as node }; - export namespace inputs_1256 { - let in1_333: string; - export { in1_333 as in1 }; - let in2_333: string; - export { in2_333 as in2 }; - } - export { inputs_1256 as inputs }; - export namespace outputs_1256 { - let out_1226: string; - export { out_1226 as out }; - } - export { outputs_1256 as outputs }; - } - export { ND_max_float_1 as ND_max_float }; - export namespace ND_max_color3_1 { - let node_1257: string; - export { node_1257 as node }; - export namespace inputs_1257 { - let in1_334: string; - export { in1_334 as in1 }; - let in2_334: string; - export { in2_334 as in2 }; - } - export { inputs_1257 as inputs }; - export namespace outputs_1257 { - let out_1227: string; - export { out_1227 as out }; - } - export { outputs_1257 as outputs }; - } - export { ND_max_color3_1 as ND_max_color3 }; - export namespace ND_max_color4_1 { - let node_1258: string; - export { node_1258 as node }; - export namespace inputs_1258 { - let in1_335: string; - export { in1_335 as in1 }; - let in2_335: string; - export { in2_335 as in2 }; - } - export { inputs_1258 as inputs }; - export namespace outputs_1258 { - let out_1228: string; - export { out_1228 as out }; - } - export { outputs_1258 as outputs }; - } - export { ND_max_color4_1 as ND_max_color4 }; - export namespace ND_max_vector2_1 { - let node_1259: string; - export { node_1259 as node }; - export namespace inputs_1259 { - let in1_336: string; - export { in1_336 as in1 }; - let in2_336: string; - export { in2_336 as in2 }; - } - export { inputs_1259 as inputs }; - export namespace outputs_1259 { - let out_1229: string; - export { out_1229 as out }; - } - export { outputs_1259 as outputs }; - } - export { ND_max_vector2_1 as ND_max_vector2 }; - export namespace ND_max_vector3_1 { - let node_1260: string; - export { node_1260 as node }; - export namespace inputs_1260 { - let in1_337: string; - export { in1_337 as in1 }; - let in2_337: string; - export { in2_337 as in2 }; - } - export { inputs_1260 as inputs }; - export namespace outputs_1260 { - let out_1230: string; - export { out_1230 as out }; - } - export { outputs_1260 as outputs }; - } - export { ND_max_vector3_1 as ND_max_vector3 }; - export namespace ND_max_vector4_1 { - let node_1261: string; - export { node_1261 as node }; - export namespace inputs_1261 { - let in1_338: string; - export { in1_338 as in1 }; - let in2_338: string; - export { in2_338 as in2 }; - } - export { inputs_1261 as inputs }; - export namespace outputs_1261 { - let out_1231: string; - export { out_1231 as out }; - } - export { outputs_1261 as outputs }; - } - export { ND_max_vector4_1 as ND_max_vector4 }; - export namespace ND_max_color3FA_1 { - let node_1262: string; - export { node_1262 as node }; - export namespace inputs_1262 { - let in1_339: string; - export { in1_339 as in1 }; - let in2_339: string; - export { in2_339 as in2 }; - } - export { inputs_1262 as inputs }; - export namespace outputs_1262 { - let out_1232: string; - export { out_1232 as out }; - } - export { outputs_1262 as outputs }; - } - export { ND_max_color3FA_1 as ND_max_color3FA }; - export namespace ND_max_color4FA_1 { - let node_1263: string; - export { node_1263 as node }; - export namespace inputs_1263 { - let in1_340: string; - export { in1_340 as in1 }; - let in2_340: string; - export { in2_340 as in2 }; - } - export { inputs_1263 as inputs }; - export namespace outputs_1263 { - let out_1233: string; - export { out_1233 as out }; - } - export { outputs_1263 as outputs }; - } - export { ND_max_color4FA_1 as ND_max_color4FA }; - export namespace ND_max_vector2FA_1 { - let node_1264: string; - export { node_1264 as node }; - export namespace inputs_1264 { - let in1_341: string; - export { in1_341 as in1 }; - let in2_341: string; - export { in2_341 as in2 }; - } - export { inputs_1264 as inputs }; - export namespace outputs_1264 { - let out_1234: string; - export { out_1234 as out }; - } - export { outputs_1264 as outputs }; - } - export { ND_max_vector2FA_1 as ND_max_vector2FA }; - export namespace ND_max_vector3FA_1 { - let node_1265: string; - export { node_1265 as node }; - export namespace inputs_1265 { - let in1_342: string; - export { in1_342 as in1 }; - let in2_342: string; - export { in2_342 as in2 }; - } - export { inputs_1265 as inputs }; - export namespace outputs_1265 { - let out_1235: string; - export { out_1235 as out }; - } - export { outputs_1265 as outputs }; - } - export { ND_max_vector3FA_1 as ND_max_vector3FA }; - export namespace ND_max_vector4FA_1 { - let node_1266: string; - export { node_1266 as node }; - export namespace inputs_1266 { - let in1_343: string; - export { in1_343 as in1 }; - let in2_343: string; - export { in2_343 as in2 }; - } - export { inputs_1266 as inputs }; - export namespace outputs_1266 { - let out_1236: string; - export { out_1236 as out }; - } - export { outputs_1266 as outputs }; - } - export { ND_max_vector4FA_1 as ND_max_vector4FA }; - export namespace ND_normalize_vector2_1 { - let node_1267: string; - export { node_1267 as node }; - export namespace inputs_1267 { - let _in_409: string; - export { _in_409 as in }; - } - export { inputs_1267 as inputs }; - export namespace outputs_1267 { - let out_1237: string; - export { out_1237 as out }; - } - export { outputs_1267 as outputs }; - } - export { ND_normalize_vector2_1 as ND_normalize_vector2 }; - export namespace ND_normalize_vector3_1 { - let node_1268: string; - export { node_1268 as node }; - export namespace inputs_1268 { - let _in_410: string; - export { _in_410 as in }; - } - export { inputs_1268 as inputs }; - export namespace outputs_1268 { - let out_1238: string; - export { out_1238 as out }; - } - export { outputs_1268 as outputs }; - } - export { ND_normalize_vector3_1 as ND_normalize_vector3 }; - export namespace ND_normalize_vector4_1 { - let node_1269: string; - export { node_1269 as node }; - export namespace inputs_1269 { - let _in_411: string; - export { _in_411 as in }; - } - export { inputs_1269 as inputs }; - export namespace outputs_1269 { - let out_1239: string; - export { out_1239 as out }; - } - export { outputs_1269 as outputs }; - } - export { ND_normalize_vector4_1 as ND_normalize_vector4 }; - export namespace ND_magnitude_vector2_1 { - let node_1270: string; - export { node_1270 as node }; - export namespace inputs_1270 { - let _in_412: string; - export { _in_412 as in }; - } - export { inputs_1270 as inputs }; - export namespace outputs_1270 { - let out_1240: string; - export { out_1240 as out }; - } - export { outputs_1270 as outputs }; - } - export { ND_magnitude_vector2_1 as ND_magnitude_vector2 }; - export namespace ND_magnitude_vector3_1 { - let node_1271: string; - export { node_1271 as node }; - export namespace inputs_1271 { - let _in_413: string; - export { _in_413 as in }; - } - export { inputs_1271 as inputs }; - export namespace outputs_1271 { - let out_1241: string; - export { out_1241 as out }; - } - export { outputs_1271 as outputs }; - } - export { ND_magnitude_vector3_1 as ND_magnitude_vector3 }; - export namespace ND_magnitude_vector4_1 { - let node_1272: string; - export { node_1272 as node }; - export namespace inputs_1272 { - let _in_414: string; - export { _in_414 as in }; - } - export { inputs_1272 as inputs }; - export namespace outputs_1272 { - let out_1242: string; - export { out_1242 as out }; - } - export { outputs_1272 as outputs }; - } - export { ND_magnitude_vector4_1 as ND_magnitude_vector4 }; - export namespace ND_distance_vector2_1 { - let node_1273: string; - export { node_1273 as node }; - export namespace inputs_1273 { - let in1_344: string; - export { in1_344 as in1 }; - let in2_344: string; - export { in2_344 as in2 }; - } - export { inputs_1273 as inputs }; - export namespace outputs_1273 { - let out_1243: string; - export { out_1243 as out }; - } - export { outputs_1273 as outputs }; - } - export { ND_distance_vector2_1 as ND_distance_vector2 }; - export namespace ND_distance_vector3_1 { - let node_1274: string; - export { node_1274 as node }; - export namespace inputs_1274 { - let in1_345: string; - export { in1_345 as in1 }; - let in2_345: string; - export { in2_345 as in2 }; - } - export { inputs_1274 as inputs }; - export namespace outputs_1274 { - let out_1244: string; - export { out_1244 as out }; - } - export { outputs_1274 as outputs }; - } - export { ND_distance_vector3_1 as ND_distance_vector3 }; - export namespace ND_distance_vector4_1 { - let node_1275: string; - export { node_1275 as node }; - export namespace inputs_1275 { - let in1_346: string; - export { in1_346 as in1 }; - let in2_346: string; - export { in2_346 as in2 }; - } - export { inputs_1275 as inputs }; - export namespace outputs_1275 { - let out_1245: string; - export { out_1245 as out }; - } - export { outputs_1275 as outputs }; - } - export { ND_distance_vector4_1 as ND_distance_vector4 }; - export namespace ND_dotproduct_vector2_1 { - let node_1276: string; - export { node_1276 as node }; - export namespace inputs_1276 { - let in1_347: string; - export { in1_347 as in1 }; - let in2_347: string; - export { in2_347 as in2 }; - } - export { inputs_1276 as inputs }; - export namespace outputs_1276 { - let out_1246: string; - export { out_1246 as out }; - } - export { outputs_1276 as outputs }; - } - export { ND_dotproduct_vector2_1 as ND_dotproduct_vector2 }; - export namespace ND_dotproduct_vector3_1 { - let node_1277: string; - export { node_1277 as node }; - export namespace inputs_1277 { - let in1_348: string; - export { in1_348 as in1 }; - let in2_348: string; - export { in2_348 as in2 }; - } - export { inputs_1277 as inputs }; - export namespace outputs_1277 { - let out_1247: string; - export { out_1247 as out }; - } - export { outputs_1277 as outputs }; - } - export { ND_dotproduct_vector3_1 as ND_dotproduct_vector3 }; - export namespace ND_dotproduct_vector4_1 { - let node_1278: string; - export { node_1278 as node }; - export namespace inputs_1278 { - let in1_349: string; - export { in1_349 as in1 }; - let in2_349: string; - export { in2_349 as in2 }; - } - export { inputs_1278 as inputs }; - export namespace outputs_1278 { - let out_1248: string; - export { out_1248 as out }; - } - export { outputs_1278 as outputs }; - } - export { ND_dotproduct_vector4_1 as ND_dotproduct_vector4 }; - export namespace ND_crossproduct_vector3_1 { - let node_1279: string; - export { node_1279 as node }; - export namespace inputs_1279 { - let in1_350: string; - export { in1_350 as in1 }; - let in2_350: string; - export { in2_350 as in2 }; - } - export { inputs_1279 as inputs }; - export namespace outputs_1279 { - let out_1249: string; - export { out_1249 as out }; - } - export { outputs_1279 as outputs }; - } - export { ND_crossproduct_vector3_1 as ND_crossproduct_vector3 }; - export namespace ND_transformpoint_vector3_1 { - let node_1280: string; - export { node_1280 as node }; - export namespace inputs_1280 { - let _in_415: string; - export { _in_415 as in }; - let fromspace_3: string; - export { fromspace_3 as fromspace }; - let tospace_3: string; - export { tospace_3 as tospace }; - } - export { inputs_1280 as inputs }; - export namespace outputs_1280 { - let out_1250: string; - export { out_1250 as out }; - } - export { outputs_1280 as outputs }; - } - export { ND_transformpoint_vector3_1 as ND_transformpoint_vector3 }; - export namespace ND_transformvector_vector3_1 { - let node_1281: string; - export { node_1281 as node }; - export namespace inputs_1281 { - let _in_416: string; - export { _in_416 as in }; - let fromspace_4: string; - export { fromspace_4 as fromspace }; - let tospace_4: string; - export { tospace_4 as tospace }; - } - export { inputs_1281 as inputs }; - export namespace outputs_1281 { - let out_1251: string; - export { out_1251 as out }; - } - export { outputs_1281 as outputs }; - } - export { ND_transformvector_vector3_1 as ND_transformvector_vector3 }; - export namespace ND_transformnormal_vector3_1 { - let node_1282: string; - export { node_1282 as node }; - export namespace inputs_1282 { - let _in_417: string; - export { _in_417 as in }; - let fromspace_5: string; - export { fromspace_5 as fromspace }; - let tospace_5: string; - export { tospace_5 as tospace }; - } - export { inputs_1282 as inputs }; - export namespace outputs_1282 { - let out_1252: string; - export { out_1252 as out }; - } - export { outputs_1282 as outputs }; - } - export { ND_transformnormal_vector3_1 as ND_transformnormal_vector3 }; - export namespace ND_transformmatrix_vector2M3_1 { - let node_1283: string; - export { node_1283 as node }; - export namespace inputs_1283 { - let _in_418: string; - export { _in_418 as in }; - let mat_4: string; - export { mat_4 as mat }; - } - export { inputs_1283 as inputs }; - export namespace outputs_1283 { - let out_1253: string; - export { out_1253 as out }; - } - export { outputs_1283 as outputs }; - } - export { ND_transformmatrix_vector2M3_1 as ND_transformmatrix_vector2M3 }; - export namespace ND_transformmatrix_vector3_1 { - let node_1284: string; - export { node_1284 as node }; - export namespace inputs_1284 { - let _in_419: string; - export { _in_419 as in }; - let mat_5: string; - export { mat_5 as mat }; - } - export { inputs_1284 as inputs }; - export namespace outputs_1284 { - let out_1254: string; - export { out_1254 as out }; - } - export { outputs_1284 as outputs }; - } - export { ND_transformmatrix_vector3_1 as ND_transformmatrix_vector3 }; - export namespace ND_transformmatrix_vector3M4_1 { - let node_1285: string; - export { node_1285 as node }; - export namespace inputs_1285 { - let _in_420: string; - export { _in_420 as in }; - let mat_6: string; - export { mat_6 as mat }; - } - export { inputs_1285 as inputs }; - export namespace outputs_1285 { - let out_1255: string; - export { out_1255 as out }; - } - export { outputs_1285 as outputs }; - } - export { ND_transformmatrix_vector3M4_1 as ND_transformmatrix_vector3M4 }; - export namespace ND_transformmatrix_vector4_1 { - let node_1286: string; - export { node_1286 as node }; - export namespace inputs_1286 { - let _in_421: string; - export { _in_421 as in }; - let mat_7: string; - export { mat_7 as mat }; - } - export { inputs_1286 as inputs }; - export namespace outputs_1286 { - let out_1256: string; - export { out_1256 as out }; - } - export { outputs_1286 as outputs }; - } - export { ND_transformmatrix_vector4_1 as ND_transformmatrix_vector4 }; - export namespace ND_normalmap_float_1 { - let node_1287: string; - export { node_1287 as node }; - export namespace inputs_1287 { - let _in_422: string; - export { _in_422 as in }; - let scale_36: string; - export { scale_36 as scale }; - let normal_63: string; - export { normal_63 as normal }; - let tangent_21: string; - export { tangent_21 as tangent }; - let bitangent_9: string; - export { bitangent_9 as bitangent }; - } - export { inputs_1287 as inputs }; - export namespace outputs_1287 { - let out_1257: string; - export { out_1257 as out }; - } - export { outputs_1287 as outputs }; - } - export { ND_normalmap_float_1 as ND_normalmap_float }; - export namespace ND_normalmap_vector2_1 { - let node_1288: string; - export { node_1288 as node }; - export namespace inputs_1288 { - let _in_423: string; - export { _in_423 as in }; - let scale_37: string; - export { scale_37 as scale }; - let normal_64: string; - export { normal_64 as normal }; - let tangent_22: string; - export { tangent_22 as tangent }; - let bitangent_10: string; - export { bitangent_10 as bitangent }; - } - export { inputs_1288 as inputs }; - export namespace outputs_1288 { - let out_1258: string; - export { out_1258 as out }; - } - export { outputs_1288 as outputs }; - } - export { ND_normalmap_vector2_1 as ND_normalmap_vector2 }; - export namespace ND_hextilednormalmap_vector3_1 { - let node_1289: string; - export { node_1289 as node }; - export namespace inputs_1289 { - let file_52: string; - export { file_52 as file }; - let _default_79: string; - export { _default_79 as default }; - let texcoord_185: string; - export { texcoord_185 as texcoord }; - let tiling_5: string; - export { tiling_5 as tiling }; - let rotation_10: string; - export { rotation_10 as rotation }; - let rotationrange_5: string; - export { rotationrange_5 as rotationrange }; - let scale_38: string; - export { scale_38 as scale }; - let scalerange_5: string; - export { scalerange_5 as scalerange }; - let offset_26: string; - export { offset_26 as offset }; - let offsetrange_5: string; - export { offsetrange_5 as offsetrange }; - let falloff_5: string; - export { falloff_5 as falloff }; - let strength_1: string; - export { strength_1 as strength }; - let flip_g_1: string; - export { flip_g_1 as flip_g }; - let normal_65: string; - export { normal_65 as normal }; - let tangent_23: string; - export { tangent_23 as tangent }; - let bitangent_11: string; - export { bitangent_11 as bitangent }; - } - export { inputs_1289 as inputs }; - export namespace outputs_1289 { - let out_1259: string; - export { out_1259 as out }; - } - export { outputs_1289 as outputs }; - } - export { ND_hextilednormalmap_vector3_1 as ND_hextilednormalmap_vector3 }; - export namespace ND_transpose_matrix33_1 { - let node_1290: string; - export { node_1290 as node }; - export namespace inputs_1290 { - let _in_424: string; - export { _in_424 as in }; - } - export { inputs_1290 as inputs }; - export namespace outputs_1290 { - let out_1260: string; - export { out_1260 as out }; - } - export { outputs_1290 as outputs }; - } - export { ND_transpose_matrix33_1 as ND_transpose_matrix33 }; - export namespace ND_transpose_matrix44_1 { - let node_1291: string; - export { node_1291 as node }; - export namespace inputs_1291 { - let _in_425: string; - export { _in_425 as in }; - } - export { inputs_1291 as inputs }; - export namespace outputs_1291 { - let out_1261: string; - export { out_1261 as out }; - } - export { outputs_1291 as outputs }; - } - export { ND_transpose_matrix44_1 as ND_transpose_matrix44 }; - export namespace ND_determinant_matrix33_1 { - let node_1292: string; - export { node_1292 as node }; - export namespace inputs_1292 { - let _in_426: string; - export { _in_426 as in }; - } - export { inputs_1292 as inputs }; - export namespace outputs_1292 { - let out_1262: string; - export { out_1262 as out }; - } - export { outputs_1292 as outputs }; - } - export { ND_determinant_matrix33_1 as ND_determinant_matrix33 }; - export namespace ND_determinant_matrix44_1 { - let node_1293: string; - export { node_1293 as node }; - export namespace inputs_1293 { - let _in_427: string; - export { _in_427 as in }; - } - export { inputs_1293 as inputs }; - export namespace outputs_1293 { - let out_1263: string; - export { out_1263 as out }; - } - export { outputs_1293 as outputs }; - } - export { ND_determinant_matrix44_1 as ND_determinant_matrix44 }; - export namespace ND_invertmatrix_matrix33_1 { - let node_1294: string; - export { node_1294 as node }; - export namespace inputs_1294 { - let _in_428: string; - export { _in_428 as in }; - } - export { inputs_1294 as inputs }; - export namespace outputs_1294 { - let out_1264: string; - export { out_1264 as out }; - } - export { outputs_1294 as outputs }; - } - export { ND_invertmatrix_matrix33_1 as ND_invertmatrix_matrix33 }; - export namespace ND_invertmatrix_matrix44_1 { - let node_1295: string; - export { node_1295 as node }; - export namespace inputs_1295 { - let _in_429: string; - export { _in_429 as in }; - } - export { inputs_1295 as inputs }; - export namespace outputs_1295 { - let out_1265: string; - export { out_1265 as out }; - } - export { outputs_1295 as outputs }; - } - export { ND_invertmatrix_matrix44_1 as ND_invertmatrix_matrix44 }; - export namespace ND_rotate2d_vector2_1 { - let node_1296: string; - export { node_1296 as node }; - export namespace inputs_1296 { - let _in_430: string; - export { _in_430 as in }; - let amount_39: string; - export { amount_39 as amount }; - } - export { inputs_1296 as inputs }; - export namespace outputs_1296 { - let out_1266: string; - export { out_1266 as out }; - } - export { outputs_1296 as outputs }; - } - export { ND_rotate2d_vector2_1 as ND_rotate2d_vector2 }; - export namespace ND_rotate3d_vector3_1 { - let node_1297: string; - export { node_1297 as node }; - export namespace inputs_1297 { - let _in_431: string; - export { _in_431 as in }; - let amount_40: string; - export { amount_40 as amount }; - let axis_1: string; - export { axis_1 as axis }; - } - export { inputs_1297 as inputs }; - export namespace outputs_1297 { - let out_1267: string; - export { out_1267 as out }; - } - export { outputs_1297 as outputs }; - } - export { ND_rotate3d_vector3_1 as ND_rotate3d_vector3 }; - export namespace ND_place2d_vector2_1 { - let node_1298: string; - export { node_1298 as node }; - export namespace inputs_1298 { - let texcoord_186: string; - export { texcoord_186 as texcoord }; - let pivot_72: string; - export { pivot_72 as pivot }; - let scale_39: string; - export { scale_39 as scale }; - let rotate_17: string; - export { rotate_17 as rotate }; - let offset_27: string; - export { offset_27 as offset }; - let operationorder_15: string; - export { operationorder_15 as operationorder }; - } - export { inputs_1298 as inputs }; - export namespace outputs_1298 { - let out_1268: string; - export { out_1268 as out }; - } - export { outputs_1298 as outputs }; - } - export { ND_place2d_vector2_1 as ND_place2d_vector2 }; - export namespace ND_trianglewave_float_1 { - let node_1299: string; - export { node_1299 as node }; - export namespace inputs_1299 { - let _in_432: string; - export { _in_432 as in }; - } - export { inputs_1299 as inputs }; - export namespace outputs_1299 { - let out_1269: string; - export { out_1269 as out }; - } - export { outputs_1299 as outputs }; - } - export { ND_trianglewave_float_1 as ND_trianglewave_float }; - export namespace ND_reflect_vector3_1 { - let node_1300: string; - export { node_1300 as node }; - export namespace inputs_1300 { - let _in_433: string; - export { _in_433 as in }; - let normal_66: string; - export { normal_66 as normal }; - } - export { inputs_1300 as inputs }; - export namespace outputs_1300 { - let out_1270: string; - export { out_1270 as out }; - } - export { outputs_1300 as outputs }; - } - export { ND_reflect_vector3_1 as ND_reflect_vector3 }; - export namespace ND_refract_vector3_1 { - let node_1301: string; - export { node_1301 as node }; - export namespace inputs_1301 { - let _in_434: string; - export { _in_434 as in }; - let normal_67: string; - export { normal_67 as normal }; - let ior_15: string; - export { ior_15 as ior }; - } - export { inputs_1301 as inputs }; - export namespace outputs_1301 { - let out_1271: string; - export { out_1271 as out }; - } - export { outputs_1301 as outputs }; - } - export { ND_refract_vector3_1 as ND_refract_vector3 }; - export namespace ND_remap_float_1 { - let node_1302: string; - export { node_1302 as node }; - export namespace inputs_1302 { - let _in_435: string; - export { _in_435 as in }; - let inlow_22: string; - export { inlow_22 as inlow }; - let inhigh_22: string; - export { inhigh_22 as inhigh }; - let outlow_22: string; - export { outlow_22 as outlow }; - let outhigh_22: string; - export { outhigh_22 as outhigh }; - } - export { inputs_1302 as inputs }; - export namespace outputs_1302 { - let out_1272: string; - export { out_1272 as out }; - } - export { outputs_1302 as outputs }; - } - export { ND_remap_float_1 as ND_remap_float }; - export namespace ND_remap_color3_1 { - let node_1303: string; - export { node_1303 as node }; - export namespace inputs_1303 { - let _in_436: string; - export { _in_436 as in }; - let inlow_23: string; - export { inlow_23 as inlow }; - let inhigh_23: string; - export { inhigh_23 as inhigh }; - let outlow_23: string; - export { outlow_23 as outlow }; - let outhigh_23: string; - export { outhigh_23 as outhigh }; - } - export { inputs_1303 as inputs }; - export namespace outputs_1303 { - let out_1273: string; - export { out_1273 as out }; - } - export { outputs_1303 as outputs }; - } - export { ND_remap_color3_1 as ND_remap_color3 }; - export namespace ND_remap_color4_1 { - let node_1304: string; - export { node_1304 as node }; - export namespace inputs_1304 { - let _in_437: string; - export { _in_437 as in }; - let inlow_24: string; - export { inlow_24 as inlow }; - let inhigh_24: string; - export { inhigh_24 as inhigh }; - let outlow_24: string; - export { outlow_24 as outlow }; - let outhigh_24: string; - export { outhigh_24 as outhigh }; - } - export { inputs_1304 as inputs }; - export namespace outputs_1304 { - let out_1274: string; - export { out_1274 as out }; - } - export { outputs_1304 as outputs }; - } - export { ND_remap_color4_1 as ND_remap_color4 }; - export namespace ND_remap_vector2_1 { - let node_1305: string; - export { node_1305 as node }; - export namespace inputs_1305 { - let _in_438: string; - export { _in_438 as in }; - let inlow_25: string; - export { inlow_25 as inlow }; - let inhigh_25: string; - export { inhigh_25 as inhigh }; - let outlow_25: string; - export { outlow_25 as outlow }; - let outhigh_25: string; - export { outhigh_25 as outhigh }; - } - export { inputs_1305 as inputs }; - export namespace outputs_1305 { - let out_1275: string; - export { out_1275 as out }; - } - export { outputs_1305 as outputs }; - } - export { ND_remap_vector2_1 as ND_remap_vector2 }; - export namespace ND_remap_vector3_1 { - let node_1306: string; - export { node_1306 as node }; - export namespace inputs_1306 { - let _in_439: string; - export { _in_439 as in }; - let inlow_26: string; - export { inlow_26 as inlow }; - let inhigh_26: string; - export { inhigh_26 as inhigh }; - let outlow_26: string; - export { outlow_26 as outlow }; - let outhigh_26: string; - export { outhigh_26 as outhigh }; - } - export { inputs_1306 as inputs }; - export namespace outputs_1306 { - let out_1276: string; - export { out_1276 as out }; - } - export { outputs_1306 as outputs }; - } - export { ND_remap_vector3_1 as ND_remap_vector3 }; - export namespace ND_remap_vector4_1 { - let node_1307: string; - export { node_1307 as node }; - export namespace inputs_1307 { - let _in_440: string; - export { _in_440 as in }; - let inlow_27: string; - export { inlow_27 as inlow }; - let inhigh_27: string; - export { inhigh_27 as inhigh }; - let outlow_27: string; - export { outlow_27 as outlow }; - let outhigh_27: string; - export { outhigh_27 as outhigh }; - } - export { inputs_1307 as inputs }; - export namespace outputs_1307 { - let out_1277: string; - export { out_1277 as out }; - } - export { outputs_1307 as outputs }; - } - export { ND_remap_vector4_1 as ND_remap_vector4 }; - export namespace ND_remap_color3FA_1 { - let node_1308: string; - export { node_1308 as node }; - export namespace inputs_1308 { - let _in_441: string; - export { _in_441 as in }; - let inlow_28: string; - export { inlow_28 as inlow }; - let inhigh_28: string; - export { inhigh_28 as inhigh }; - let outlow_28: string; - export { outlow_28 as outlow }; - let outhigh_28: string; - export { outhigh_28 as outhigh }; - } - export { inputs_1308 as inputs }; - export namespace outputs_1308 { - let out_1278: string; - export { out_1278 as out }; - } - export { outputs_1308 as outputs }; - } - export { ND_remap_color3FA_1 as ND_remap_color3FA }; - export namespace ND_remap_color4FA_1 { - let node_1309: string; - export { node_1309 as node }; - export namespace inputs_1309 { - let _in_442: string; - export { _in_442 as in }; - let inlow_29: string; - export { inlow_29 as inlow }; - let inhigh_29: string; - export { inhigh_29 as inhigh }; - let outlow_29: string; - export { outlow_29 as outlow }; - let outhigh_29: string; - export { outhigh_29 as outhigh }; - } - export { inputs_1309 as inputs }; - export namespace outputs_1309 { - let out_1279: string; - export { out_1279 as out }; - } - export { outputs_1309 as outputs }; - } - export { ND_remap_color4FA_1 as ND_remap_color4FA }; - export namespace ND_remap_vector2FA_1 { - let node_1310: string; - export { node_1310 as node }; - export namespace inputs_1310 { - let _in_443: string; - export { _in_443 as in }; - let inlow_30: string; - export { inlow_30 as inlow }; - let inhigh_30: string; - export { inhigh_30 as inhigh }; - let outlow_30: string; - export { outlow_30 as outlow }; - let outhigh_30: string; - export { outhigh_30 as outhigh }; - } - export { inputs_1310 as inputs }; - export namespace outputs_1310 { - let out_1280: string; - export { out_1280 as out }; - } - export { outputs_1310 as outputs }; - } - export { ND_remap_vector2FA_1 as ND_remap_vector2FA }; - export namespace ND_remap_vector3FA_1 { - let node_1311: string; - export { node_1311 as node }; - export namespace inputs_1311 { - let _in_444: string; - export { _in_444 as in }; - let inlow_31: string; - export { inlow_31 as inlow }; - let inhigh_31: string; - export { inhigh_31 as inhigh }; - let outlow_31: string; - export { outlow_31 as outlow }; - let outhigh_31: string; - export { outhigh_31 as outhigh }; - } - export { inputs_1311 as inputs }; - export namespace outputs_1311 { - let out_1281: string; - export { out_1281 as out }; - } - export { outputs_1311 as outputs }; - } - export { ND_remap_vector3FA_1 as ND_remap_vector3FA }; - export namespace ND_remap_vector4FA_1 { - let node_1312: string; - export { node_1312 as node }; - export namespace inputs_1312 { - let _in_445: string; - export { _in_445 as in }; - let inlow_32: string; - export { inlow_32 as inlow }; - let inhigh_32: string; - export { inhigh_32 as inhigh }; - let outlow_32: string; - export { outlow_32 as outlow }; - let outhigh_32: string; - export { outhigh_32 as outhigh }; - } - export { inputs_1312 as inputs }; - export namespace outputs_1312 { - let out_1282: string; - export { out_1282 as out }; - } - export { outputs_1312 as outputs }; - } - export { ND_remap_vector4FA_1 as ND_remap_vector4FA }; - export namespace ND_smoothstep_float_1 { - let node_1313: string; - export { node_1313 as node }; - export namespace inputs_1313 { - let _in_446: string; - export { _in_446 as in }; - let low_33: string; - export { low_33 as low }; - let high_33: string; - export { high_33 as high }; - } - export { inputs_1313 as inputs }; - export namespace outputs_1313 { - let out_1283: string; - export { out_1283 as out }; - } - export { outputs_1313 as outputs }; - } - export { ND_smoothstep_float_1 as ND_smoothstep_float }; - export namespace ND_smoothstep_color3_1 { - let node_1314: string; - export { node_1314 as node }; - export namespace inputs_1314 { - let _in_447: string; - export { _in_447 as in }; - let low_34: string; - export { low_34 as low }; - let high_34: string; - export { high_34 as high }; - } - export { inputs_1314 as inputs }; - export namespace outputs_1314 { - let out_1284: string; - export { out_1284 as out }; - } - export { outputs_1314 as outputs }; - } - export { ND_smoothstep_color3_1 as ND_smoothstep_color3 }; - export namespace ND_smoothstep_color4_1 { - let node_1315: string; - export { node_1315 as node }; - export namespace inputs_1315 { - let _in_448: string; - export { _in_448 as in }; - let low_35: string; - export { low_35 as low }; - let high_35: string; - export { high_35 as high }; - } - export { inputs_1315 as inputs }; - export namespace outputs_1315 { - let out_1285: string; - export { out_1285 as out }; - } - export { outputs_1315 as outputs }; - } - export { ND_smoothstep_color4_1 as ND_smoothstep_color4 }; - export namespace ND_smoothstep_vector2_1 { - let node_1316: string; - export { node_1316 as node }; - export namespace inputs_1316 { - let _in_449: string; - export { _in_449 as in }; - let low_36: string; - export { low_36 as low }; - let high_36: string; - export { high_36 as high }; - } - export { inputs_1316 as inputs }; - export namespace outputs_1316 { - let out_1286: string; - export { out_1286 as out }; - } - export { outputs_1316 as outputs }; - } - export { ND_smoothstep_vector2_1 as ND_smoothstep_vector2 }; - export namespace ND_smoothstep_vector3_1 { - let node_1317: string; - export { node_1317 as node }; - export namespace inputs_1317 { - let _in_450: string; - export { _in_450 as in }; - let low_37: string; - export { low_37 as low }; - let high_37: string; - export { high_37 as high }; - } - export { inputs_1317 as inputs }; - export namespace outputs_1317 { - let out_1287: string; - export { out_1287 as out }; - } - export { outputs_1317 as outputs }; - } - export { ND_smoothstep_vector3_1 as ND_smoothstep_vector3 }; - export namespace ND_smoothstep_vector4_1 { - let node_1318: string; - export { node_1318 as node }; - export namespace inputs_1318 { - let _in_451: string; - export { _in_451 as in }; - let low_38: string; - export { low_38 as low }; - let high_38: string; - export { high_38 as high }; - } - export { inputs_1318 as inputs }; - export namespace outputs_1318 { - let out_1288: string; - export { out_1288 as out }; - } - export { outputs_1318 as outputs }; - } - export { ND_smoothstep_vector4_1 as ND_smoothstep_vector4 }; - export namespace ND_smoothstep_color3FA_1 { - let node_1319: string; - export { node_1319 as node }; - export namespace inputs_1319 { - let _in_452: string; - export { _in_452 as in }; - let low_39: string; - export { low_39 as low }; - let high_39: string; - export { high_39 as high }; - } - export { inputs_1319 as inputs }; - export namespace outputs_1319 { - let out_1289: string; - export { out_1289 as out }; - } - export { outputs_1319 as outputs }; - } - export { ND_smoothstep_color3FA_1 as ND_smoothstep_color3FA }; - export namespace ND_smoothstep_color4FA_1 { - let node_1320: string; - export { node_1320 as node }; - export namespace inputs_1320 { - let _in_453: string; - export { _in_453 as in }; - let low_40: string; - export { low_40 as low }; - let high_40: string; - export { high_40 as high }; - } - export { inputs_1320 as inputs }; - export namespace outputs_1320 { - let out_1290: string; - export { out_1290 as out }; - } - export { outputs_1320 as outputs }; - } - export { ND_smoothstep_color4FA_1 as ND_smoothstep_color4FA }; - export namespace ND_smoothstep_vector2FA_1 { - let node_1321: string; - export { node_1321 as node }; - export namespace inputs_1321 { - let _in_454: string; - export { _in_454 as in }; - let low_41: string; - export { low_41 as low }; - let high_41: string; - export { high_41 as high }; - } - export { inputs_1321 as inputs }; - export namespace outputs_1321 { - let out_1291: string; - export { out_1291 as out }; - } - export { outputs_1321 as outputs }; - } - export { ND_smoothstep_vector2FA_1 as ND_smoothstep_vector2FA }; - export namespace ND_smoothstep_vector3FA_1 { - let node_1322: string; - export { node_1322 as node }; - export namespace inputs_1322 { - let _in_455: string; - export { _in_455 as in }; - let low_42: string; - export { low_42 as low }; - let high_42: string; - export { high_42 as high }; - } - export { inputs_1322 as inputs }; - export namespace outputs_1322 { - let out_1292: string; - export { out_1292 as out }; - } - export { outputs_1322 as outputs }; - } - export { ND_smoothstep_vector3FA_1 as ND_smoothstep_vector3FA }; - export namespace ND_smoothstep_vector4FA_1 { - let node_1323: string; - export { node_1323 as node }; - export namespace inputs_1323 { - let _in_456: string; - export { _in_456 as in }; - let low_43: string; - export { low_43 as low }; - let high_43: string; - export { high_43 as high }; - } - export { inputs_1323 as inputs }; - export namespace outputs_1323 { - let out_1293: string; - export { out_1293 as out }; - } - export { outputs_1323 as outputs }; - } - export { ND_smoothstep_vector4FA_1 as ND_smoothstep_vector4FA }; - export namespace ND_luminance_color3_1 { - let node_1324: string; - export { node_1324 as node }; - export namespace inputs_1324 { - let _in_457: string; - export { _in_457 as in }; - let lumacoeffs_8: string; - export { lumacoeffs_8 as lumacoeffs }; - } - export { inputs_1324 as inputs }; - export namespace outputs_1324 { - let out_1294: string; - export { out_1294 as out }; - } - export { outputs_1324 as outputs }; - } - export { ND_luminance_color3_1 as ND_luminance_color3 }; - export namespace ND_luminance_color4_1 { - let node_1325: string; - export { node_1325 as node }; - export namespace inputs_1325 { - let _in_458: string; - export { _in_458 as in }; - let lumacoeffs_9: string; - export { lumacoeffs_9 as lumacoeffs }; - } - export { inputs_1325 as inputs }; - export namespace outputs_1325 { - let out_1295: string; - export { out_1295 as out }; - } - export { outputs_1325 as outputs }; - } - export { ND_luminance_color4_1 as ND_luminance_color4 }; - export namespace ND_rgbtohsv_color3_1 { - let node_1326: string; - export { node_1326 as node }; - export namespace inputs_1326 { - let _in_459: string; - export { _in_459 as in }; - } - export { inputs_1326 as inputs }; - export namespace outputs_1326 { - let out_1296: string; - export { out_1296 as out }; - } - export { outputs_1326 as outputs }; - } - export { ND_rgbtohsv_color3_1 as ND_rgbtohsv_color3 }; - export namespace ND_rgbtohsv_color4_1 { - let node_1327: string; - export { node_1327 as node }; - export namespace inputs_1327 { - let _in_460: string; - export { _in_460 as in }; - } - export { inputs_1327 as inputs }; - export namespace outputs_1327 { - let out_1297: string; - export { out_1297 as out }; - } - export { outputs_1327 as outputs }; - } - export { ND_rgbtohsv_color4_1 as ND_rgbtohsv_color4 }; - export namespace ND_hsvtorgb_color3_1 { - let node_1328: string; - export { node_1328 as node }; - export namespace inputs_1328 { - let _in_461: string; - export { _in_461 as in }; - } - export { inputs_1328 as inputs }; - export namespace outputs_1328 { - let out_1298: string; - export { out_1298 as out }; - } - export { outputs_1328 as outputs }; - } - export { ND_hsvtorgb_color3_1 as ND_hsvtorgb_color3 }; - export namespace ND_hsvtorgb_color4_1 { - let node_1329: string; - export { node_1329 as node }; - export namespace inputs_1329 { - let _in_462: string; - export { _in_462 as in }; - } - export { inputs_1329 as inputs }; - export namespace outputs_1329 { - let out_1299: string; - export { out_1299 as out }; - } - export { outputs_1329 as outputs }; - } - export { ND_hsvtorgb_color4_1 as ND_hsvtorgb_color4 }; - export namespace ND_contrast_float_1 { - let node_1330: string; - export { node_1330 as node }; - export namespace inputs_1330 { - let _in_463: string; - export { _in_463 as in }; - let amount_41: string; - export { amount_41 as amount }; - let pivot_73: string; - export { pivot_73 as pivot }; - } - export { inputs_1330 as inputs }; - export namespace outputs_1330 { - let out_1300: string; - export { out_1300 as out }; - } - export { outputs_1330 as outputs }; - } - export { ND_contrast_float_1 as ND_contrast_float }; - export namespace ND_contrast_color3_1 { - let node_1331: string; - export { node_1331 as node }; - export namespace inputs_1331 { - let _in_464: string; - export { _in_464 as in }; - let amount_42: string; - export { amount_42 as amount }; - let pivot_74: string; - export { pivot_74 as pivot }; - } - export { inputs_1331 as inputs }; - export namespace outputs_1331 { - let out_1301: string; - export { out_1301 as out }; - } - export { outputs_1331 as outputs }; - } - export { ND_contrast_color3_1 as ND_contrast_color3 }; - export namespace ND_contrast_color4_1 { - let node_1332: string; - export { node_1332 as node }; - export namespace inputs_1332 { - let _in_465: string; - export { _in_465 as in }; - let amount_43: string; - export { amount_43 as amount }; - let pivot_75: string; - export { pivot_75 as pivot }; - } - export { inputs_1332 as inputs }; - export namespace outputs_1332 { - let out_1302: string; - export { out_1302 as out }; - } - export { outputs_1332 as outputs }; - } - export { ND_contrast_color4_1 as ND_contrast_color4 }; - export namespace ND_contrast_vector2_1 { - let node_1333: string; - export { node_1333 as node }; - export namespace inputs_1333 { - let _in_466: string; - export { _in_466 as in }; - let amount_44: string; - export { amount_44 as amount }; - let pivot_76: string; - export { pivot_76 as pivot }; - } - export { inputs_1333 as inputs }; - export namespace outputs_1333 { - let out_1303: string; - export { out_1303 as out }; - } - export { outputs_1333 as outputs }; - } - export { ND_contrast_vector2_1 as ND_contrast_vector2 }; - export namespace ND_contrast_vector3_1 { - let node_1334: string; - export { node_1334 as node }; - export namespace inputs_1334 { - let _in_467: string; - export { _in_467 as in }; - let amount_45: string; - export { amount_45 as amount }; - let pivot_77: string; - export { pivot_77 as pivot }; - } - export { inputs_1334 as inputs }; - export namespace outputs_1334 { - let out_1304: string; - export { out_1304 as out }; - } - export { outputs_1334 as outputs }; - } - export { ND_contrast_vector3_1 as ND_contrast_vector3 }; - export namespace ND_contrast_vector4_1 { - let node_1335: string; - export { node_1335 as node }; - export namespace inputs_1335 { - let _in_468: string; - export { _in_468 as in }; - let amount_46: string; - export { amount_46 as amount }; - let pivot_78: string; - export { pivot_78 as pivot }; - } - export { inputs_1335 as inputs }; - export namespace outputs_1335 { - let out_1305: string; - export { out_1305 as out }; - } - export { outputs_1335 as outputs }; - } - export { ND_contrast_vector4_1 as ND_contrast_vector4 }; - export namespace ND_contrast_color3FA_1 { - let node_1336: string; - export { node_1336 as node }; - export namespace inputs_1336 { - let _in_469: string; - export { _in_469 as in }; - let amount_47: string; - export { amount_47 as amount }; - let pivot_79: string; - export { pivot_79 as pivot }; - } - export { inputs_1336 as inputs }; - export namespace outputs_1336 { - let out_1306: string; - export { out_1306 as out }; - } - export { outputs_1336 as outputs }; - } - export { ND_contrast_color3FA_1 as ND_contrast_color3FA }; - export namespace ND_contrast_color4FA_1 { - let node_1337: string; - export { node_1337 as node }; - export namespace inputs_1337 { - let _in_470: string; - export { _in_470 as in }; - let amount_48: string; - export { amount_48 as amount }; - let pivot_80: string; - export { pivot_80 as pivot }; - } - export { inputs_1337 as inputs }; - export namespace outputs_1337 { - let out_1307: string; - export { out_1307 as out }; - } - export { outputs_1337 as outputs }; - } - export { ND_contrast_color4FA_1 as ND_contrast_color4FA }; - export namespace ND_contrast_vector2FA_1 { - let node_1338: string; - export { node_1338 as node }; - export namespace inputs_1338 { - let _in_471: string; - export { _in_471 as in }; - let amount_49: string; - export { amount_49 as amount }; - let pivot_81: string; - export { pivot_81 as pivot }; - } - export { inputs_1338 as inputs }; - export namespace outputs_1338 { - let out_1308: string; - export { out_1308 as out }; - } - export { outputs_1338 as outputs }; - } - export { ND_contrast_vector2FA_1 as ND_contrast_vector2FA }; - export namespace ND_contrast_vector3FA_1 { - let node_1339: string; - export { node_1339 as node }; - export namespace inputs_1339 { - let _in_472: string; - export { _in_472 as in }; - let amount_50: string; - export { amount_50 as amount }; - let pivot_82: string; - export { pivot_82 as pivot }; - } - export { inputs_1339 as inputs }; - export namespace outputs_1339 { - let out_1309: string; - export { out_1309 as out }; - } - export { outputs_1339 as outputs }; - } - export { ND_contrast_vector3FA_1 as ND_contrast_vector3FA }; - export namespace ND_contrast_vector4FA_1 { - let node_1340: string; - export { node_1340 as node }; - export namespace inputs_1340 { - let _in_473: string; - export { _in_473 as in }; - let amount_51: string; - export { amount_51 as amount }; - let pivot_83: string; - export { pivot_83 as pivot }; - } - export { inputs_1340 as inputs }; - export namespace outputs_1340 { - let out_1310: string; - export { out_1310 as out }; - } - export { outputs_1340 as outputs }; - } - export { ND_contrast_vector4FA_1 as ND_contrast_vector4FA }; - export namespace ND_range_float_1 { - let node_1341: string; - export { node_1341 as node }; - export namespace inputs_1341 { - let _in_474: string; - export { _in_474 as in }; - let inlow_33: string; - export { inlow_33 as inlow }; - let inhigh_33: string; - export { inhigh_33 as inhigh }; - let gamma_13: string; - export { gamma_13 as gamma }; - let outlow_33: string; - export { outlow_33 as outlow }; - let outhigh_33: string; - export { outhigh_33 as outhigh }; - let doclamp_11: string; - export { doclamp_11 as doclamp }; - } - export { inputs_1341 as inputs }; - export namespace outputs_1341 { - let out_1311: string; - export { out_1311 as out }; - } - export { outputs_1341 as outputs }; - } - export { ND_range_float_1 as ND_range_float }; - export namespace ND_range_color3_1 { - let node_1342: string; - export { node_1342 as node }; - export namespace inputs_1342 { - let _in_475: string; - export { _in_475 as in }; - let inlow_34: string; - export { inlow_34 as inlow }; - let inhigh_34: string; - export { inhigh_34 as inhigh }; - let gamma_14: string; - export { gamma_14 as gamma }; - let outlow_34: string; - export { outlow_34 as outlow }; - let outhigh_34: string; - export { outhigh_34 as outhigh }; - let doclamp_12: string; - export { doclamp_12 as doclamp }; - } - export { inputs_1342 as inputs }; - export namespace outputs_1342 { - let out_1312: string; - export { out_1312 as out }; - } - export { outputs_1342 as outputs }; - } - export { ND_range_color3_1 as ND_range_color3 }; - export namespace ND_range_color4_1 { - let node_1343: string; - export { node_1343 as node }; - export namespace inputs_1343 { - let _in_476: string; - export { _in_476 as in }; - let inlow_35: string; - export { inlow_35 as inlow }; - let inhigh_35: string; - export { inhigh_35 as inhigh }; - let gamma_15: string; - export { gamma_15 as gamma }; - let outlow_35: string; - export { outlow_35 as outlow }; - let outhigh_35: string; - export { outhigh_35 as outhigh }; - let doclamp_13: string; - export { doclamp_13 as doclamp }; - } - export { inputs_1343 as inputs }; - export namespace outputs_1343 { - let out_1313: string; - export { out_1313 as out }; - } - export { outputs_1343 as outputs }; - } - export { ND_range_color4_1 as ND_range_color4 }; - export namespace ND_range_vector2_1 { - let node_1344: string; - export { node_1344 as node }; - export namespace inputs_1344 { - let _in_477: string; - export { _in_477 as in }; - let inlow_36: string; - export { inlow_36 as inlow }; - let inhigh_36: string; - export { inhigh_36 as inhigh }; - let gamma_16: string; - export { gamma_16 as gamma }; - let outlow_36: string; - export { outlow_36 as outlow }; - let outhigh_36: string; - export { outhigh_36 as outhigh }; - let doclamp_14: string; - export { doclamp_14 as doclamp }; - } - export { inputs_1344 as inputs }; - export namespace outputs_1344 { - let out_1314: string; - export { out_1314 as out }; - } - export { outputs_1344 as outputs }; - } - export { ND_range_vector2_1 as ND_range_vector2 }; - export namespace ND_range_vector3_1 { - let node_1345: string; - export { node_1345 as node }; - export namespace inputs_1345 { - let _in_478: string; - export { _in_478 as in }; - let inlow_37: string; - export { inlow_37 as inlow }; - let inhigh_37: string; - export { inhigh_37 as inhigh }; - let gamma_17: string; - export { gamma_17 as gamma }; - let outlow_37: string; - export { outlow_37 as outlow }; - let outhigh_37: string; - export { outhigh_37 as outhigh }; - let doclamp_15: string; - export { doclamp_15 as doclamp }; - } - export { inputs_1345 as inputs }; - export namespace outputs_1345 { - let out_1315: string; - export { out_1315 as out }; - } - export { outputs_1345 as outputs }; - } - export { ND_range_vector3_1 as ND_range_vector3 }; - export namespace ND_range_vector4_1 { - let node_1346: string; - export { node_1346 as node }; - export namespace inputs_1346 { - let _in_479: string; - export { _in_479 as in }; - let inlow_38: string; - export { inlow_38 as inlow }; - let inhigh_38: string; - export { inhigh_38 as inhigh }; - let gamma_18: string; - export { gamma_18 as gamma }; - let outlow_38: string; - export { outlow_38 as outlow }; - let outhigh_38: string; - export { outhigh_38 as outhigh }; - let doclamp_16: string; - export { doclamp_16 as doclamp }; - } - export { inputs_1346 as inputs }; - export namespace outputs_1346 { - let out_1316: string; - export { out_1316 as out }; - } - export { outputs_1346 as outputs }; - } - export { ND_range_vector4_1 as ND_range_vector4 }; - export namespace ND_range_color3FA_1 { - let node_1347: string; - export { node_1347 as node }; - export namespace inputs_1347 { - let _in_480: string; - export { _in_480 as in }; - let inlow_39: string; - export { inlow_39 as inlow }; - let inhigh_39: string; - export { inhigh_39 as inhigh }; - let gamma_19: string; - export { gamma_19 as gamma }; - let outlow_39: string; - export { outlow_39 as outlow }; - let outhigh_39: string; - export { outhigh_39 as outhigh }; - let doclamp_17: string; - export { doclamp_17 as doclamp }; - } - export { inputs_1347 as inputs }; - export namespace outputs_1347 { - let out_1317: string; - export { out_1317 as out }; - } - export { outputs_1347 as outputs }; - } - export { ND_range_color3FA_1 as ND_range_color3FA }; - export namespace ND_range_color4FA_1 { - let node_1348: string; - export { node_1348 as node }; - export namespace inputs_1348 { - let _in_481: string; - export { _in_481 as in }; - let inlow_40: string; - export { inlow_40 as inlow }; - let inhigh_40: string; - export { inhigh_40 as inhigh }; - let gamma_20: string; - export { gamma_20 as gamma }; - let outlow_40: string; - export { outlow_40 as outlow }; - let outhigh_40: string; - export { outhigh_40 as outhigh }; - let doclamp_18: string; - export { doclamp_18 as doclamp }; - } - export { inputs_1348 as inputs }; - export namespace outputs_1348 { - let out_1318: string; - export { out_1318 as out }; - } - export { outputs_1348 as outputs }; - } - export { ND_range_color4FA_1 as ND_range_color4FA }; - export namespace ND_range_vector2FA_1 { - let node_1349: string; - export { node_1349 as node }; - export namespace inputs_1349 { - let _in_482: string; - export { _in_482 as in }; - let inlow_41: string; - export { inlow_41 as inlow }; - let inhigh_41: string; - export { inhigh_41 as inhigh }; - let gamma_21: string; - export { gamma_21 as gamma }; - let outlow_41: string; - export { outlow_41 as outlow }; - let outhigh_41: string; - export { outhigh_41 as outhigh }; - let doclamp_19: string; - export { doclamp_19 as doclamp }; - } - export { inputs_1349 as inputs }; - export namespace outputs_1349 { - let out_1319: string; - export { out_1319 as out }; - } - export { outputs_1349 as outputs }; - } - export { ND_range_vector2FA_1 as ND_range_vector2FA }; - export namespace ND_range_vector3FA_1 { - let node_1350: string; - export { node_1350 as node }; - export namespace inputs_1350 { - let _in_483: string; - export { _in_483 as in }; - let inlow_42: string; - export { inlow_42 as inlow }; - let inhigh_42: string; - export { inhigh_42 as inhigh }; - let gamma_22: string; - export { gamma_22 as gamma }; - let outlow_42: string; - export { outlow_42 as outlow }; - let outhigh_42: string; - export { outhigh_42 as outhigh }; - let doclamp_20: string; - export { doclamp_20 as doclamp }; - } - export { inputs_1350 as inputs }; - export namespace outputs_1350 { - let out_1320: string; - export { out_1320 as out }; - } - export { outputs_1350 as outputs }; - } - export { ND_range_vector3FA_1 as ND_range_vector3FA }; - export namespace ND_range_vector4FA_1 { - let node_1351: string; - export { node_1351 as node }; - export namespace inputs_1351 { - let _in_484: string; - export { _in_484 as in }; - let inlow_43: string; - export { inlow_43 as inlow }; - let inhigh_43: string; - export { inhigh_43 as inhigh }; - let gamma_23: string; - export { gamma_23 as gamma }; - let outlow_43: string; - export { outlow_43 as outlow }; - let outhigh_43: string; - export { outhigh_43 as outhigh }; - let doclamp_21: string; - export { doclamp_21 as doclamp }; - } - export { inputs_1351 as inputs }; - export namespace outputs_1351 { - let out_1321: string; - export { out_1321 as out }; - } - export { outputs_1351 as outputs }; - } - export { ND_range_vector4FA_1 as ND_range_vector4FA }; - export namespace ND_hsvadjust_color3_1 { - let node_1352: string; - export { node_1352 as node }; - export namespace inputs_1352 { - let _in_485: string; - export { _in_485 as in }; - let amount_52: string; - export { amount_52 as amount }; - } - export { inputs_1352 as inputs }; - export namespace outputs_1352 { - let out_1322: string; - export { out_1322 as out }; - } - export { outputs_1352 as outputs }; - } - export { ND_hsvadjust_color3_1 as ND_hsvadjust_color3 }; - export namespace ND_hsvadjust_color4_1 { - let node_1353: string; - export { node_1353 as node }; - export namespace inputs_1353 { - let _in_486: string; - export { _in_486 as in }; - let amount_53: string; - export { amount_53 as amount }; - } - export { inputs_1353 as inputs }; - export namespace outputs_1353 { - let out_1323: string; - export { out_1323 as out }; - } - export { outputs_1353 as outputs }; - } - export { ND_hsvadjust_color4_1 as ND_hsvadjust_color4 }; - export namespace ND_saturate_color3_1 { - let node_1354: string; - export { node_1354 as node }; - export namespace inputs_1354 { - let _in_487: string; - export { _in_487 as in }; - let amount_54: string; - export { amount_54 as amount }; - let lumacoeffs_10: string; - export { lumacoeffs_10 as lumacoeffs }; - } - export { inputs_1354 as inputs }; - export namespace outputs_1354 { - let out_1324: string; - export { out_1324 as out }; - } - export { outputs_1354 as outputs }; - } - export { ND_saturate_color3_1 as ND_saturate_color3 }; - export namespace ND_saturate_color4_1 { - let node_1355: string; - export { node_1355 as node }; - export namespace inputs_1355 { - let _in_488: string; - export { _in_488 as in }; - let amount_55: string; - export { amount_55 as amount }; - let lumacoeffs_11: string; - export { lumacoeffs_11 as lumacoeffs }; - } - export { inputs_1355 as inputs }; - export namespace outputs_1355 { - let out_1325: string; - export { out_1325 as out }; - } - export { outputs_1355 as outputs }; - } - export { ND_saturate_color4_1 as ND_saturate_color4 }; - export namespace ND_colorcorrect_color3_1 { - let node_1356: string; - export { node_1356 as node }; - export namespace inputs_1356 { - let _in_489: string; - export { _in_489 as in }; - let hue_2: string; - export { hue_2 as hue }; - let saturation_2: string; - export { saturation_2 as saturation }; - let gamma_24: string; - export { gamma_24 as gamma }; - let lift_2: string; - export { lift_2 as lift }; - let gain_2: string; - export { gain_2 as gain }; - let contrast_2: string; - export { contrast_2 as contrast }; - let contrastpivot_2: string; - export { contrastpivot_2 as contrastpivot }; - let exposure_4: string; - export { exposure_4 as exposure }; - } - export { inputs_1356 as inputs }; - export namespace outputs_1356 { - let out_1326: string; - export { out_1326 as out }; - } - export { outputs_1356 as outputs }; - } - export { ND_colorcorrect_color3_1 as ND_colorcorrect_color3 }; - export namespace ND_colorcorrect_color4_1 { - let node_1357: string; - export { node_1357 as node }; - export namespace inputs_1357 { - let _in_490: string; - export { _in_490 as in }; - let hue_3: string; - export { hue_3 as hue }; - let saturation_3: string; - export { saturation_3 as saturation }; - let gamma_25: string; - export { gamma_25 as gamma }; - let lift_3: string; - export { lift_3 as lift }; - let gain_3: string; - export { gain_3 as gain }; - let contrast_3: string; - export { contrast_3 as contrast }; - let contrastpivot_3: string; - export { contrastpivot_3 as contrastpivot }; - let exposure_5: string; - export { exposure_5 as exposure }; - } - export { inputs_1357 as inputs }; - export namespace outputs_1357 { - let out_1327: string; - export { out_1327 as out }; - } - export { outputs_1357 as outputs }; - } - export { ND_colorcorrect_color4_1 as ND_colorcorrect_color4 }; - export namespace ND_premult_color4_1 { - let node_1358: string; - export { node_1358 as node }; - export namespace inputs_1358 { - let _in_491: string; - export { _in_491 as in }; - } - export { inputs_1358 as inputs }; - export namespace outputs_1358 { - let out_1328: string; - export { out_1328 as out }; - } - export { outputs_1358 as outputs }; - } - export { ND_premult_color4_1 as ND_premult_color4 }; - export namespace ND_unpremult_color4_1 { - let node_1359: string; - export { node_1359 as node }; - export namespace inputs_1359 { - let _in_492: string; - export { _in_492 as in }; - } - export { inputs_1359 as inputs }; - export namespace outputs_1359 { - let out_1329: string; - export { out_1329 as out }; - } - export { outputs_1359 as outputs }; - } - export { ND_unpremult_color4_1 as ND_unpremult_color4 }; - export namespace ND_plus_float_1 { - let node_1360: string; - export { node_1360 as node }; - export namespace inputs_1360 { - let fg_47: string; - export { fg_47 as fg }; - let bg_47: string; - export { bg_47 as bg }; - let mix_49: string; - export { mix_49 as mix }; - } - export { inputs_1360 as inputs }; - export namespace outputs_1360 { - let out_1330: string; - export { out_1330 as out }; - } - export { outputs_1360 as outputs }; - } - export { ND_plus_float_1 as ND_plus_float }; - export namespace ND_plus_color3_1 { - let node_1361: string; - export { node_1361 as node }; - export namespace inputs_1361 { - let fg_48: string; - export { fg_48 as fg }; - let bg_48: string; - export { bg_48 as bg }; - let mix_50: string; - export { mix_50 as mix }; - } - export { inputs_1361 as inputs }; - export namespace outputs_1361 { - let out_1331: string; - export { out_1331 as out }; - } - export { outputs_1361 as outputs }; - } - export { ND_plus_color3_1 as ND_plus_color3 }; - export namespace ND_plus_color4_1 { - let node_1362: string; - export { node_1362 as node }; - export namespace inputs_1362 { - let fg_49: string; - export { fg_49 as fg }; - let bg_49: string; - export { bg_49 as bg }; - let mix_51: string; - export { mix_51 as mix }; - } - export { inputs_1362 as inputs }; - export namespace outputs_1362 { - let out_1332: string; - export { out_1332 as out }; - } - export { outputs_1362 as outputs }; - } - export { ND_plus_color4_1 as ND_plus_color4 }; - export namespace ND_minus_float_1 { - let node_1363: string; - export { node_1363 as node }; - export namespace inputs_1363 { - let fg_50: string; - export { fg_50 as fg }; - let bg_50: string; - export { bg_50 as bg }; - let mix_52: string; - export { mix_52 as mix }; - } - export { inputs_1363 as inputs }; - export namespace outputs_1363 { - let out_1333: string; - export { out_1333 as out }; - } - export { outputs_1363 as outputs }; - } - export { ND_minus_float_1 as ND_minus_float }; - export namespace ND_minus_color3_1 { - let node_1364: string; - export { node_1364 as node }; - export namespace inputs_1364 { - let fg_51: string; - export { fg_51 as fg }; - let bg_51: string; - export { bg_51 as bg }; - let mix_53: string; - export { mix_53 as mix }; - } - export { inputs_1364 as inputs }; - export namespace outputs_1364 { - let out_1334: string; - export { out_1334 as out }; - } - export { outputs_1364 as outputs }; - } - export { ND_minus_color3_1 as ND_minus_color3 }; - export namespace ND_minus_color4_1 { - let node_1365: string; - export { node_1365 as node }; - export namespace inputs_1365 { - let fg_52: string; - export { fg_52 as fg }; - let bg_52: string; - export { bg_52 as bg }; - let mix_54: string; - export { mix_54 as mix }; - } - export { inputs_1365 as inputs }; - export namespace outputs_1365 { - let out_1335: string; - export { out_1335 as out }; - } - export { outputs_1365 as outputs }; - } - export { ND_minus_color4_1 as ND_minus_color4 }; - export namespace ND_difference_float_1 { - let node_1366: string; - export { node_1366 as node }; - export namespace inputs_1366 { - let fg_53: string; - export { fg_53 as fg }; - let bg_53: string; - export { bg_53 as bg }; - let mix_55: string; - export { mix_55 as mix }; - } - export { inputs_1366 as inputs }; - export namespace outputs_1366 { - let out_1336: string; - export { out_1336 as out }; - } - export { outputs_1366 as outputs }; - } - export { ND_difference_float_1 as ND_difference_float }; - export namespace ND_difference_color3_1 { - let node_1367: string; - export { node_1367 as node }; - export namespace inputs_1367 { - let fg_54: string; - export { fg_54 as fg }; - let bg_54: string; - export { bg_54 as bg }; - let mix_56: string; - export { mix_56 as mix }; - } - export { inputs_1367 as inputs }; - export namespace outputs_1367 { - let out_1337: string; - export { out_1337 as out }; - } - export { outputs_1367 as outputs }; - } - export { ND_difference_color3_1 as ND_difference_color3 }; - export namespace ND_difference_color4_1 { - let node_1368: string; - export { node_1368 as node }; - export namespace inputs_1368 { - let fg_55: string; - export { fg_55 as fg }; - let bg_55: string; - export { bg_55 as bg }; - let mix_57: string; - export { mix_57 as mix }; - } - export { inputs_1368 as inputs }; - export namespace outputs_1368 { - let out_1338: string; - export { out_1338 as out }; - } - export { outputs_1368 as outputs }; - } - export { ND_difference_color4_1 as ND_difference_color4 }; - export namespace ND_burn_float_1 { - let node_1369: string; - export { node_1369 as node }; - export namespace inputs_1369 { - let fg_56: string; - export { fg_56 as fg }; - let bg_56: string; - export { bg_56 as bg }; - let mix_58: string; - export { mix_58 as mix }; - } - export { inputs_1369 as inputs }; - export namespace outputs_1369 { - let out_1339: string; - export { out_1339 as out }; - } - export { outputs_1369 as outputs }; - } - export { ND_burn_float_1 as ND_burn_float }; - export namespace ND_burn_color3_1 { - let node_1370: string; - export { node_1370 as node }; - export namespace inputs_1370 { - let fg_57: string; - export { fg_57 as fg }; - let bg_57: string; - export { bg_57 as bg }; - let mix_59: string; - export { mix_59 as mix }; - } - export { inputs_1370 as inputs }; - export namespace outputs_1370 { - let out_1340: string; - export { out_1340 as out }; - } - export { outputs_1370 as outputs }; - } - export { ND_burn_color3_1 as ND_burn_color3 }; - export namespace ND_burn_color4_1 { - let node_1371: string; - export { node_1371 as node }; - export namespace inputs_1371 { - let fg_58: string; - export { fg_58 as fg }; - let bg_58: string; - export { bg_58 as bg }; - let mix_60: string; - export { mix_60 as mix }; - } - export { inputs_1371 as inputs }; - export namespace outputs_1371 { - let out_1341: string; - export { out_1341 as out }; - } - export { outputs_1371 as outputs }; - } - export { ND_burn_color4_1 as ND_burn_color4 }; - export namespace ND_dodge_float_1 { - let node_1372: string; - export { node_1372 as node }; - export namespace inputs_1372 { - let fg_59: string; - export { fg_59 as fg }; - let bg_59: string; - export { bg_59 as bg }; - let mix_61: string; - export { mix_61 as mix }; - } - export { inputs_1372 as inputs }; - export namespace outputs_1372 { - let out_1342: string; - export { out_1342 as out }; - } - export { outputs_1372 as outputs }; - } - export { ND_dodge_float_1 as ND_dodge_float }; - export namespace ND_dodge_color3_1 { - let node_1373: string; - export { node_1373 as node }; - export namespace inputs_1373 { - let fg_60: string; - export { fg_60 as fg }; - let bg_60: string; - export { bg_60 as bg }; - let mix_62: string; - export { mix_62 as mix }; - } - export { inputs_1373 as inputs }; - export namespace outputs_1373 { - let out_1343: string; - export { out_1343 as out }; - } - export { outputs_1373 as outputs }; - } - export { ND_dodge_color3_1 as ND_dodge_color3 }; - export namespace ND_dodge_color4_1 { - let node_1374: string; - export { node_1374 as node }; - export namespace inputs_1374 { - let fg_61: string; - export { fg_61 as fg }; - let bg_61: string; - export { bg_61 as bg }; - let mix_63: string; - export { mix_63 as mix }; - } - export { inputs_1374 as inputs }; - export namespace outputs_1374 { - let out_1344: string; - export { out_1344 as out }; - } - export { outputs_1374 as outputs }; - } - export { ND_dodge_color4_1 as ND_dodge_color4 }; - export namespace ND_screen_float_1 { - let node_1375: string; - export { node_1375 as node }; - export namespace inputs_1375 { - let fg_62: string; - export { fg_62 as fg }; - let bg_62: string; - export { bg_62 as bg }; - let mix_64: string; - export { mix_64 as mix }; - } - export { inputs_1375 as inputs }; - export namespace outputs_1375 { - let out_1345: string; - export { out_1345 as out }; - } - export { outputs_1375 as outputs }; - } - export { ND_screen_float_1 as ND_screen_float }; - export namespace ND_screen_color3_1 { - let node_1376: string; - export { node_1376 as node }; - export namespace inputs_1376 { - let fg_63: string; - export { fg_63 as fg }; - let bg_63: string; - export { bg_63 as bg }; - let mix_65: string; - export { mix_65 as mix }; - } - export { inputs_1376 as inputs }; - export namespace outputs_1376 { - let out_1346: string; - export { out_1346 as out }; - } - export { outputs_1376 as outputs }; - } - export { ND_screen_color3_1 as ND_screen_color3 }; - export namespace ND_screen_color4_1 { - let node_1377: string; - export { node_1377 as node }; - export namespace inputs_1377 { - let fg_64: string; - export { fg_64 as fg }; - let bg_64: string; - export { bg_64 as bg }; - let mix_66: string; - export { mix_66 as mix }; - } - export { inputs_1377 as inputs }; - export namespace outputs_1377 { - let out_1347: string; - export { out_1347 as out }; - } - export { outputs_1377 as outputs }; - } - export { ND_screen_color4_1 as ND_screen_color4 }; - export namespace ND_overlay_float_1 { - let node_1378: string; - export { node_1378 as node }; - export namespace inputs_1378 { - let fg_65: string; - export { fg_65 as fg }; - let bg_65: string; - export { bg_65 as bg }; - let mix_67: string; - export { mix_67 as mix }; - } - export { inputs_1378 as inputs }; - export namespace outputs_1378 { - let out_1348: string; - export { out_1348 as out }; - } - export { outputs_1378 as outputs }; - } - export { ND_overlay_float_1 as ND_overlay_float }; - export namespace ND_overlay_color3_1 { - let node_1379: string; - export { node_1379 as node }; - export namespace inputs_1379 { - let fg_66: string; - export { fg_66 as fg }; - let bg_66: string; - export { bg_66 as bg }; - let mix_68: string; - export { mix_68 as mix }; - } - export { inputs_1379 as inputs }; - export namespace outputs_1379 { - let out_1349: string; - export { out_1349 as out }; - } - export { outputs_1379 as outputs }; - } - export { ND_overlay_color3_1 as ND_overlay_color3 }; - export namespace ND_overlay_color4_1 { - let node_1380: string; - export { node_1380 as node }; - export namespace inputs_1380 { - let fg_67: string; - export { fg_67 as fg }; - let bg_67: string; - export { bg_67 as bg }; - let mix_69: string; - export { mix_69 as mix }; - } - export { inputs_1380 as inputs }; - export namespace outputs_1380 { - let out_1350: string; - export { out_1350 as out }; - } - export { outputs_1380 as outputs }; - } - export { ND_overlay_color4_1 as ND_overlay_color4 }; - export namespace ND_disjointover_color4_1 { - let node_1381: string; - export { node_1381 as node }; - export namespace inputs_1381 { - let fg_68: string; - export { fg_68 as fg }; - let bg_68: string; - export { bg_68 as bg }; - let mix_70: string; - export { mix_70 as mix }; - } - export { inputs_1381 as inputs }; - export namespace outputs_1381 { - let out_1351: string; - export { out_1351 as out }; - } - export { outputs_1381 as outputs }; - } - export { ND_disjointover_color4_1 as ND_disjointover_color4 }; - export namespace ND_in_color4_1 { - let node_1382: string; - export { node_1382 as node }; - export namespace inputs_1382 { - let fg_69: string; - export { fg_69 as fg }; - let bg_69: string; - export { bg_69 as bg }; - let mix_71: string; - export { mix_71 as mix }; - } - export { inputs_1382 as inputs }; - export namespace outputs_1382 { - let out_1352: string; - export { out_1352 as out }; - } - export { outputs_1382 as outputs }; - } - export { ND_in_color4_1 as ND_in_color4 }; - export namespace ND_mask_color4_1 { - let node_1383: string; - export { node_1383 as node }; - export namespace inputs_1383 { - let fg_70: string; - export { fg_70 as fg }; - let bg_70: string; - export { bg_70 as bg }; - let mix_72: string; - export { mix_72 as mix }; - } - export { inputs_1383 as inputs }; - export namespace outputs_1383 { - let out_1353: string; - export { out_1353 as out }; - } - export { outputs_1383 as outputs }; - } - export { ND_mask_color4_1 as ND_mask_color4 }; - export namespace ND_matte_color4_1 { - let node_1384: string; - export { node_1384 as node }; - export namespace inputs_1384 { - let fg_71: string; - export { fg_71 as fg }; - let bg_71: string; - export { bg_71 as bg }; - let mix_73: string; - export { mix_73 as mix }; - } - export { inputs_1384 as inputs }; - export namespace outputs_1384 { - let out_1354: string; - export { out_1354 as out }; - } - export { outputs_1384 as outputs }; - } - export { ND_matte_color4_1 as ND_matte_color4 }; - export namespace ND_out_color4_1 { - let node_1385: string; - export { node_1385 as node }; - export namespace inputs_1385 { - let fg_72: string; - export { fg_72 as fg }; - let bg_72: string; - export { bg_72 as bg }; - let mix_74: string; - export { mix_74 as mix }; - } - export { inputs_1385 as inputs }; - export namespace outputs_1385 { - let out_1355: string; - export { out_1355 as out }; - } - export { outputs_1385 as outputs }; - } - export { ND_out_color4_1 as ND_out_color4 }; - export namespace ND_over_color4_1 { - let node_1386: string; - export { node_1386 as node }; - export namespace inputs_1386 { - let fg_73: string; - export { fg_73 as fg }; - let bg_73: string; - export { bg_73 as bg }; - let mix_75: string; - export { mix_75 as mix }; - } - export { inputs_1386 as inputs }; - export namespace outputs_1386 { - let out_1356: string; - export { out_1356 as out }; - } - export { outputs_1386 as outputs }; - } - export { ND_over_color4_1 as ND_over_color4 }; - export namespace ND_inside_float_1 { - let node_1387: string; - export { node_1387 as node }; - export namespace inputs_1387 { - let _in_493: string; - export { _in_493 as in }; - let mask_6: string; - export { mask_6 as mask }; - } - export { inputs_1387 as inputs }; - export namespace outputs_1387 { - let out_1357: string; - export { out_1357 as out }; - } - export { outputs_1387 as outputs }; - } - export { ND_inside_float_1 as ND_inside_float }; - export namespace ND_inside_color3_1 { - let node_1388: string; - export { node_1388 as node }; - export namespace inputs_1388 { - let _in_494: string; - export { _in_494 as in }; - let mask_7: string; - export { mask_7 as mask }; - } - export { inputs_1388 as inputs }; - export namespace outputs_1388 { - let out_1358: string; - export { out_1358 as out }; - } - export { outputs_1388 as outputs }; - } - export { ND_inside_color3_1 as ND_inside_color3 }; - export namespace ND_inside_color4_1 { - let node_1389: string; - export { node_1389 as node }; - export namespace inputs_1389 { - let _in_495: string; - export { _in_495 as in }; - let mask_8: string; - export { mask_8 as mask }; - } - export { inputs_1389 as inputs }; - export namespace outputs_1389 { - let out_1359: string; - export { out_1359 as out }; - } - export { outputs_1389 as outputs }; - } - export { ND_inside_color4_1 as ND_inside_color4 }; - export namespace ND_outside_float_1 { - let node_1390: string; - export { node_1390 as node }; - export namespace inputs_1390 { - let _in_496: string; - export { _in_496 as in }; - let mask_9: string; - export { mask_9 as mask }; - } - export { inputs_1390 as inputs }; - export namespace outputs_1390 { - let out_1360: string; - export { out_1360 as out }; - } - export { outputs_1390 as outputs }; - } - export { ND_outside_float_1 as ND_outside_float }; - export namespace ND_outside_color3_1 { - let node_1391: string; - export { node_1391 as node }; - export namespace inputs_1391 { - let _in_497: string; - export { _in_497 as in }; - let mask_10: string; - export { mask_10 as mask }; - } - export { inputs_1391 as inputs }; - export namespace outputs_1391 { - let out_1361: string; - export { out_1361 as out }; - } - export { outputs_1391 as outputs }; - } - export { ND_outside_color3_1 as ND_outside_color3 }; - export namespace ND_outside_color4_1 { - let node_1392: string; - export { node_1392 as node }; - export namespace inputs_1392 { - let _in_498: string; - export { _in_498 as in }; - let mask_11: string; - export { mask_11 as mask }; - } - export { inputs_1392 as inputs }; - export namespace outputs_1392 { - let out_1362: string; - export { out_1362 as out }; - } - export { outputs_1392 as outputs }; - } - export { ND_outside_color4_1 as ND_outside_color4 }; - export namespace ND_mix_float_1 { - let node_1393: string; - export { node_1393 as node }; - export namespace inputs_1393 { - let fg_74: string; - export { fg_74 as fg }; - let bg_74: string; - export { bg_74 as bg }; - let mix_76: string; - export { mix_76 as mix }; - } - export { inputs_1393 as inputs }; - export namespace outputs_1393 { - let out_1363: string; - export { out_1363 as out }; - } - export { outputs_1393 as outputs }; - } - export { ND_mix_float_1 as ND_mix_float }; - export namespace ND_mix_color3_1 { - let node_1394: string; - export { node_1394 as node }; - export namespace inputs_1394 { - let fg_75: string; - export { fg_75 as fg }; - let bg_75: string; - export { bg_75 as bg }; - let mix_77: string; - export { mix_77 as mix }; - } - export { inputs_1394 as inputs }; - export namespace outputs_1394 { - let out_1364: string; - export { out_1364 as out }; - } - export { outputs_1394 as outputs }; - } - export { ND_mix_color3_1 as ND_mix_color3 }; - export namespace ND_mix_color3_color3_1 { - let node_1395: string; - export { node_1395 as node }; - export namespace inputs_1395 { - let fg_76: string; - export { fg_76 as fg }; - let bg_76: string; - export { bg_76 as bg }; - let mix_78: string; - export { mix_78 as mix }; - } - export { inputs_1395 as inputs }; - export namespace outputs_1395 { - let out_1365: string; - export { out_1365 as out }; - } - export { outputs_1395 as outputs }; - } - export { ND_mix_color3_color3_1 as ND_mix_color3_color3 }; - export namespace ND_mix_color4_1 { - let node_1396: string; - export { node_1396 as node }; - export namespace inputs_1396 { - let fg_77: string; - export { fg_77 as fg }; - let bg_77: string; - export { bg_77 as bg }; - let mix_79: string; - export { mix_79 as mix }; - } - export { inputs_1396 as inputs }; - export namespace outputs_1396 { - let out_1366: string; - export { out_1366 as out }; - } - export { outputs_1396 as outputs }; - } - export { ND_mix_color4_1 as ND_mix_color4 }; - export namespace ND_mix_color4_color4_1 { - let node_1397: string; - export { node_1397 as node }; - export namespace inputs_1397 { - let fg_78: string; - export { fg_78 as fg }; - let bg_78: string; - export { bg_78 as bg }; - let mix_80: string; - export { mix_80 as mix }; - } - export { inputs_1397 as inputs }; - export namespace outputs_1397 { - let out_1367: string; - export { out_1367 as out }; - } - export { outputs_1397 as outputs }; - } - export { ND_mix_color4_color4_1 as ND_mix_color4_color4 }; - export namespace ND_mix_vector2_1 { - let node_1398: string; - export { node_1398 as node }; - export namespace inputs_1398 { - let fg_79: string; - export { fg_79 as fg }; - let bg_79: string; - export { bg_79 as bg }; - let mix_81: string; - export { mix_81 as mix }; - } - export { inputs_1398 as inputs }; - export namespace outputs_1398 { - let out_1368: string; - export { out_1368 as out }; - } - export { outputs_1398 as outputs }; - } - export { ND_mix_vector2_1 as ND_mix_vector2 }; - export namespace ND_mix_vector2_vector2_1 { - let node_1399: string; - export { node_1399 as node }; - export namespace inputs_1399 { - let fg_80: string; - export { fg_80 as fg }; - let bg_80: string; - export { bg_80 as bg }; - let mix_82: string; - export { mix_82 as mix }; - } - export { inputs_1399 as inputs }; - export namespace outputs_1399 { - let out_1369: string; - export { out_1369 as out }; - } - export { outputs_1399 as outputs }; - } - export { ND_mix_vector2_vector2_1 as ND_mix_vector2_vector2 }; - export namespace ND_mix_vector3_1 { - let node_1400: string; - export { node_1400 as node }; - export namespace inputs_1400 { - let fg_81: string; - export { fg_81 as fg }; - let bg_81: string; - export { bg_81 as bg }; - let mix_83: string; - export { mix_83 as mix }; - } - export { inputs_1400 as inputs }; - export namespace outputs_1400 { - let out_1370: string; - export { out_1370 as out }; - } - export { outputs_1400 as outputs }; - } - export { ND_mix_vector3_1 as ND_mix_vector3 }; - export namespace ND_mix_vector3_vector3_1 { - let node_1401: string; - export { node_1401 as node }; - export namespace inputs_1401 { - let fg_82: string; - export { fg_82 as fg }; - let bg_82: string; - export { bg_82 as bg }; - let mix_84: string; - export { mix_84 as mix }; - } - export { inputs_1401 as inputs }; - export namespace outputs_1401 { - let out_1371: string; - export { out_1371 as out }; - } - export { outputs_1401 as outputs }; - } - export { ND_mix_vector3_vector3_1 as ND_mix_vector3_vector3 }; - export namespace ND_mix_vector4_1 { - let node_1402: string; - export { node_1402 as node }; - export namespace inputs_1402 { - let fg_83: string; - export { fg_83 as fg }; - let bg_83: string; - export { bg_83 as bg }; - let mix_85: string; - export { mix_85 as mix }; - } - export { inputs_1402 as inputs }; - export namespace outputs_1402 { - let out_1372: string; - export { out_1372 as out }; - } - export { outputs_1402 as outputs }; - } - export { ND_mix_vector4_1 as ND_mix_vector4 }; - export namespace ND_mix_vector4_vector4_1 { - let node_1403: string; - export { node_1403 as node }; - export namespace inputs_1403 { - let fg_84: string; - export { fg_84 as fg }; - let bg_84: string; - export { bg_84 as bg }; - let mix_86: string; - export { mix_86 as mix }; - } - export { inputs_1403 as inputs }; - export namespace outputs_1403 { - let out_1373: string; - export { out_1373 as out }; - } - export { outputs_1403 as outputs }; - } - export { ND_mix_vector4_vector4_1 as ND_mix_vector4_vector4 }; - export namespace ND_mix_surfaceshader_1 { - let node_1404: string; - export { node_1404 as node }; - export namespace inputs_1404 { - let fg_85: string; - export { fg_85 as fg }; - let bg_85: string; - export { bg_85 as bg }; - let mix_87: string; - export { mix_87 as mix }; - } - export { inputs_1404 as inputs }; - export namespace outputs_1404 { - let out_1374: string; - export { out_1374 as out }; - } - export { outputs_1404 as outputs }; - } - export { ND_mix_surfaceshader_1 as ND_mix_surfaceshader }; - export namespace ND_mix_displacementshader_1 { - let node_1405: string; - export { node_1405 as node }; - export namespace inputs_1405 { - let fg_86: string; - export { fg_86 as fg }; - let bg_86: string; - export { bg_86 as bg }; - let mix_88: string; - export { mix_88 as mix }; - } - export { inputs_1405 as inputs }; - export namespace outputs_1405 { - let out_1375: string; - export { out_1375 as out }; - } - export { outputs_1405 as outputs }; - } - export { ND_mix_displacementshader_1 as ND_mix_displacementshader }; - export namespace ND_mix_volumeshader_1 { - let node_1406: string; - export { node_1406 as node }; - export namespace inputs_1406 { - let fg_87: string; - export { fg_87 as fg }; - let bg_87: string; - export { bg_87 as bg }; - let mix_89: string; - export { mix_89 as mix }; - } - export { inputs_1406 as inputs }; - export namespace outputs_1406 { - let out_1376: string; - export { out_1376 as out }; - } - export { outputs_1406 as outputs }; - } - export { ND_mix_volumeshader_1 as ND_mix_volumeshader }; - export namespace ND_ifgreater_float_1 { - let node_1407: string; - export { node_1407 as node }; - export namespace inputs_1407 { - let value1_70: string; - export { value1_70 as value1 }; - let value2_70: string; - export { value2_70 as value2 }; - let in1_351: string; - export { in1_351 as in1 }; - let in2_351: string; - export { in2_351 as in2 }; - } - export { inputs_1407 as inputs }; - export namespace outputs_1407 { - let out_1377: string; - export { out_1377 as out }; - } - export { outputs_1407 as outputs }; - } - export { ND_ifgreater_float_1 as ND_ifgreater_float }; - export namespace ND_ifgreater_integer_1 { - let node_1408: string; - export { node_1408 as node }; - export namespace inputs_1408 { - let value1_71: string; - export { value1_71 as value1 }; - let value2_71: string; - export { value2_71 as value2 }; - let in1_352: string; - export { in1_352 as in1 }; - let in2_352: string; - export { in2_352 as in2 }; - } - export { inputs_1408 as inputs }; - export namespace outputs_1408 { - let out_1378: string; - export { out_1378 as out }; - } - export { outputs_1408 as outputs }; - } - export { ND_ifgreater_integer_1 as ND_ifgreater_integer }; - export namespace ND_ifgreater_color3_1 { - let node_1409: string; - export { node_1409 as node }; - export namespace inputs_1409 { - let value1_72: string; - export { value1_72 as value1 }; - let value2_72: string; - export { value2_72 as value2 }; - let in1_353: string; - export { in1_353 as in1 }; - let in2_353: string; - export { in2_353 as in2 }; - } - export { inputs_1409 as inputs }; - export namespace outputs_1409 { - let out_1379: string; - export { out_1379 as out }; - } - export { outputs_1409 as outputs }; - } - export { ND_ifgreater_color3_1 as ND_ifgreater_color3 }; - export namespace ND_ifgreater_color4_1 { - let node_1410: string; - export { node_1410 as node }; - export namespace inputs_1410 { - let value1_73: string; - export { value1_73 as value1 }; - let value2_73: string; - export { value2_73 as value2 }; - let in1_354: string; - export { in1_354 as in1 }; - let in2_354: string; - export { in2_354 as in2 }; - } - export { inputs_1410 as inputs }; - export namespace outputs_1410 { - let out_1380: string; - export { out_1380 as out }; - } - export { outputs_1410 as outputs }; - } - export { ND_ifgreater_color4_1 as ND_ifgreater_color4 }; - export namespace ND_ifgreater_vector2_1 { - let node_1411: string; - export { node_1411 as node }; - export namespace inputs_1411 { - let value1_74: string; - export { value1_74 as value1 }; - let value2_74: string; - export { value2_74 as value2 }; - let in1_355: string; - export { in1_355 as in1 }; - let in2_355: string; - export { in2_355 as in2 }; - } - export { inputs_1411 as inputs }; - export namespace outputs_1411 { - let out_1381: string; - export { out_1381 as out }; - } - export { outputs_1411 as outputs }; - } - export { ND_ifgreater_vector2_1 as ND_ifgreater_vector2 }; - export namespace ND_ifgreater_vector3_1 { - let node_1412: string; - export { node_1412 as node }; - export namespace inputs_1412 { - let value1_75: string; - export { value1_75 as value1 }; - let value2_75: string; - export { value2_75 as value2 }; - let in1_356: string; - export { in1_356 as in1 }; - let in2_356: string; - export { in2_356 as in2 }; - } - export { inputs_1412 as inputs }; - export namespace outputs_1412 { - let out_1382: string; - export { out_1382 as out }; - } - export { outputs_1412 as outputs }; - } - export { ND_ifgreater_vector3_1 as ND_ifgreater_vector3 }; - export namespace ND_ifgreater_vector4_1 { - let node_1413: string; - export { node_1413 as node }; - export namespace inputs_1413 { - let value1_76: string; - export { value1_76 as value1 }; - let value2_76: string; - export { value2_76 as value2 }; - let in1_357: string; - export { in1_357 as in1 }; - let in2_357: string; - export { in2_357 as in2 }; - } - export { inputs_1413 as inputs }; - export namespace outputs_1413 { - let out_1383: string; - export { out_1383 as out }; - } - export { outputs_1413 as outputs }; - } - export { ND_ifgreater_vector4_1 as ND_ifgreater_vector4 }; - export namespace ND_ifgreater_matrix33_1 { - let node_1414: string; - export { node_1414 as node }; - export namespace inputs_1414 { - let value1_77: string; - export { value1_77 as value1 }; - let value2_77: string; - export { value2_77 as value2 }; - let in1_358: string; - export { in1_358 as in1 }; - let in2_358: string; - export { in2_358 as in2 }; - } - export { inputs_1414 as inputs }; - export namespace outputs_1414 { - let out_1384: string; - export { out_1384 as out }; - } - export { outputs_1414 as outputs }; - } - export { ND_ifgreater_matrix33_1 as ND_ifgreater_matrix33 }; - export namespace ND_ifgreater_matrix44_1 { - let node_1415: string; - export { node_1415 as node }; - export namespace inputs_1415 { - let value1_78: string; - export { value1_78 as value1 }; - let value2_78: string; - export { value2_78 as value2 }; - let in1_359: string; - export { in1_359 as in1 }; - let in2_359: string; - export { in2_359 as in2 }; - } - export { inputs_1415 as inputs }; - export namespace outputs_1415 { - let out_1385: string; - export { out_1385 as out }; - } - export { outputs_1415 as outputs }; - } - export { ND_ifgreater_matrix44_1 as ND_ifgreater_matrix44 }; - export namespace ND_ifgreater_boolean_1 { - let node_1416: string; - export { node_1416 as node }; - export namespace inputs_1416 { - let value1_79: string; - export { value1_79 as value1 }; - let value2_79: string; - export { value2_79 as value2 }; - } - export { inputs_1416 as inputs }; - export namespace outputs_1416 { - let out_1386: string; - export { out_1386 as out }; - } - export { outputs_1416 as outputs }; - } - export { ND_ifgreater_boolean_1 as ND_ifgreater_boolean }; - export namespace ND_ifgreater_floatI_1 { - let node_1417: string; - export { node_1417 as node }; - export namespace inputs_1417 { - let value1_80: string; - export { value1_80 as value1 }; - let value2_80: string; - export { value2_80 as value2 }; - let in1_360: string; - export { in1_360 as in1 }; - let in2_360: string; - export { in2_360 as in2 }; - } - export { inputs_1417 as inputs }; - export namespace outputs_1417 { - let out_1387: string; - export { out_1387 as out }; - } - export { outputs_1417 as outputs }; - } - export { ND_ifgreater_floatI_1 as ND_ifgreater_floatI }; - export namespace ND_ifgreater_integerI_1 { - let node_1418: string; - export { node_1418 as node }; - export namespace inputs_1418 { - let value1_81: string; - export { value1_81 as value1 }; - let value2_81: string; - export { value2_81 as value2 }; - let in1_361: string; - export { in1_361 as in1 }; - let in2_361: string; - export { in2_361 as in2 }; - } - export { inputs_1418 as inputs }; - export namespace outputs_1418 { - let out_1388: string; - export { out_1388 as out }; - } - export { outputs_1418 as outputs }; - } - export { ND_ifgreater_integerI_1 as ND_ifgreater_integerI }; - export namespace ND_ifgreater_color3I_1 { - let node_1419: string; - export { node_1419 as node }; - export namespace inputs_1419 { - let value1_82: string; - export { value1_82 as value1 }; - let value2_82: string; - export { value2_82 as value2 }; - let in1_362: string; - export { in1_362 as in1 }; - let in2_362: string; - export { in2_362 as in2 }; - } - export { inputs_1419 as inputs }; - export namespace outputs_1419 { - let out_1389: string; - export { out_1389 as out }; - } - export { outputs_1419 as outputs }; - } - export { ND_ifgreater_color3I_1 as ND_ifgreater_color3I }; - export namespace ND_ifgreater_color4I_1 { - let node_1420: string; - export { node_1420 as node }; - export namespace inputs_1420 { - let value1_83: string; - export { value1_83 as value1 }; - let value2_83: string; - export { value2_83 as value2 }; - let in1_363: string; - export { in1_363 as in1 }; - let in2_363: string; - export { in2_363 as in2 }; - } - export { inputs_1420 as inputs }; - export namespace outputs_1420 { - let out_1390: string; - export { out_1390 as out }; - } - export { outputs_1420 as outputs }; - } - export { ND_ifgreater_color4I_1 as ND_ifgreater_color4I }; - export namespace ND_ifgreater_vector2I_1 { - let node_1421: string; - export { node_1421 as node }; - export namespace inputs_1421 { - let value1_84: string; - export { value1_84 as value1 }; - let value2_84: string; - export { value2_84 as value2 }; - let in1_364: string; - export { in1_364 as in1 }; - let in2_364: string; - export { in2_364 as in2 }; - } - export { inputs_1421 as inputs }; - export namespace outputs_1421 { - let out_1391: string; - export { out_1391 as out }; - } - export { outputs_1421 as outputs }; - } - export { ND_ifgreater_vector2I_1 as ND_ifgreater_vector2I }; - export namespace ND_ifgreater_vector3I_1 { - let node_1422: string; - export { node_1422 as node }; - export namespace inputs_1422 { - let value1_85: string; - export { value1_85 as value1 }; - let value2_85: string; - export { value2_85 as value2 }; - let in1_365: string; - export { in1_365 as in1 }; - let in2_365: string; - export { in2_365 as in2 }; - } - export { inputs_1422 as inputs }; - export namespace outputs_1422 { - let out_1392: string; - export { out_1392 as out }; - } - export { outputs_1422 as outputs }; - } - export { ND_ifgreater_vector3I_1 as ND_ifgreater_vector3I }; - export namespace ND_ifgreater_vector4I_1 { - let node_1423: string; - export { node_1423 as node }; - export namespace inputs_1423 { - let value1_86: string; - export { value1_86 as value1 }; - let value2_86: string; - export { value2_86 as value2 }; - let in1_366: string; - export { in1_366 as in1 }; - let in2_366: string; - export { in2_366 as in2 }; - } - export { inputs_1423 as inputs }; - export namespace outputs_1423 { - let out_1393: string; - export { out_1393 as out }; - } - export { outputs_1423 as outputs }; - } - export { ND_ifgreater_vector4I_1 as ND_ifgreater_vector4I }; - export namespace ND_ifgreater_matrix33I_1 { - let node_1424: string; - export { node_1424 as node }; - export namespace inputs_1424 { - let value1_87: string; - export { value1_87 as value1 }; - let value2_87: string; - export { value2_87 as value2 }; - let in1_367: string; - export { in1_367 as in1 }; - let in2_367: string; - export { in2_367 as in2 }; - } - export { inputs_1424 as inputs }; - export namespace outputs_1424 { - let out_1394: string; - export { out_1394 as out }; - } - export { outputs_1424 as outputs }; - } - export { ND_ifgreater_matrix33I_1 as ND_ifgreater_matrix33I }; - export namespace ND_ifgreater_matrix44I_1 { - let node_1425: string; - export { node_1425 as node }; - export namespace inputs_1425 { - let value1_88: string; - export { value1_88 as value1 }; - let value2_88: string; - export { value2_88 as value2 }; - let in1_368: string; - export { in1_368 as in1 }; - let in2_368: string; - export { in2_368 as in2 }; - } - export { inputs_1425 as inputs }; - export namespace outputs_1425 { - let out_1395: string; - export { out_1395 as out }; - } - export { outputs_1425 as outputs }; - } - export { ND_ifgreater_matrix44I_1 as ND_ifgreater_matrix44I }; - export namespace ND_ifgreater_booleanI_1 { - let node_1426: string; - export { node_1426 as node }; - export namespace inputs_1426 { - let value1_89: string; - export { value1_89 as value1 }; - let value2_89: string; - export { value2_89 as value2 }; - } - export { inputs_1426 as inputs }; - export namespace outputs_1426 { - let out_1396: string; - export { out_1396 as out }; - } - export { outputs_1426 as outputs }; - } - export { ND_ifgreater_booleanI_1 as ND_ifgreater_booleanI }; - export namespace ND_ifgreatereq_float_1 { - let node_1427: string; - export { node_1427 as node }; - export namespace inputs_1427 { - let value1_90: string; - export { value1_90 as value1 }; - let value2_90: string; - export { value2_90 as value2 }; - let in1_369: string; - export { in1_369 as in1 }; - let in2_369: string; - export { in2_369 as in2 }; - } - export { inputs_1427 as inputs }; - export namespace outputs_1427 { - let out_1397: string; - export { out_1397 as out }; - } - export { outputs_1427 as outputs }; - } - export { ND_ifgreatereq_float_1 as ND_ifgreatereq_float }; - export namespace ND_ifgreatereq_integer_1 { - let node_1428: string; - export { node_1428 as node }; - export namespace inputs_1428 { - let value1_91: string; - export { value1_91 as value1 }; - let value2_91: string; - export { value2_91 as value2 }; - let in1_370: string; - export { in1_370 as in1 }; - let in2_370: string; - export { in2_370 as in2 }; - } - export { inputs_1428 as inputs }; - export namespace outputs_1428 { - let out_1398: string; - export { out_1398 as out }; - } - export { outputs_1428 as outputs }; - } - export { ND_ifgreatereq_integer_1 as ND_ifgreatereq_integer }; - export namespace ND_ifgreatereq_color3_1 { - let node_1429: string; - export { node_1429 as node }; - export namespace inputs_1429 { - let value1_92: string; - export { value1_92 as value1 }; - let value2_92: string; - export { value2_92 as value2 }; - let in1_371: string; - export { in1_371 as in1 }; - let in2_371: string; - export { in2_371 as in2 }; - } - export { inputs_1429 as inputs }; - export namespace outputs_1429 { - let out_1399: string; - export { out_1399 as out }; - } - export { outputs_1429 as outputs }; - } - export { ND_ifgreatereq_color3_1 as ND_ifgreatereq_color3 }; - export namespace ND_ifgreatereq_color4_1 { - let node_1430: string; - export { node_1430 as node }; - export namespace inputs_1430 { - let value1_93: string; - export { value1_93 as value1 }; - let value2_93: string; - export { value2_93 as value2 }; - let in1_372: string; - export { in1_372 as in1 }; - let in2_372: string; - export { in2_372 as in2 }; - } - export { inputs_1430 as inputs }; - export namespace outputs_1430 { - let out_1400: string; - export { out_1400 as out }; - } - export { outputs_1430 as outputs }; - } - export { ND_ifgreatereq_color4_1 as ND_ifgreatereq_color4 }; - export namespace ND_ifgreatereq_vector2_1 { - let node_1431: string; - export { node_1431 as node }; - export namespace inputs_1431 { - let value1_94: string; - export { value1_94 as value1 }; - let value2_94: string; - export { value2_94 as value2 }; - let in1_373: string; - export { in1_373 as in1 }; - let in2_373: string; - export { in2_373 as in2 }; - } - export { inputs_1431 as inputs }; - export namespace outputs_1431 { - let out_1401: string; - export { out_1401 as out }; - } - export { outputs_1431 as outputs }; - } - export { ND_ifgreatereq_vector2_1 as ND_ifgreatereq_vector2 }; - export namespace ND_ifgreatereq_vector3_1 { - let node_1432: string; - export { node_1432 as node }; - export namespace inputs_1432 { - let value1_95: string; - export { value1_95 as value1 }; - let value2_95: string; - export { value2_95 as value2 }; - let in1_374: string; - export { in1_374 as in1 }; - let in2_374: string; - export { in2_374 as in2 }; - } - export { inputs_1432 as inputs }; - export namespace outputs_1432 { - let out_1402: string; - export { out_1402 as out }; - } - export { outputs_1432 as outputs }; - } - export { ND_ifgreatereq_vector3_1 as ND_ifgreatereq_vector3 }; - export namespace ND_ifgreatereq_vector4_1 { - let node_1433: string; - export { node_1433 as node }; - export namespace inputs_1433 { - let value1_96: string; - export { value1_96 as value1 }; - let value2_96: string; - export { value2_96 as value2 }; - let in1_375: string; - export { in1_375 as in1 }; - let in2_375: string; - export { in2_375 as in2 }; - } - export { inputs_1433 as inputs }; - export namespace outputs_1433 { - let out_1403: string; - export { out_1403 as out }; - } - export { outputs_1433 as outputs }; - } - export { ND_ifgreatereq_vector4_1 as ND_ifgreatereq_vector4 }; - export namespace ND_ifgreatereq_matrix33_1 { - let node_1434: string; - export { node_1434 as node }; - export namespace inputs_1434 { - let value1_97: string; - export { value1_97 as value1 }; - let value2_97: string; - export { value2_97 as value2 }; - let in1_376: string; - export { in1_376 as in1 }; - let in2_376: string; - export { in2_376 as in2 }; - } - export { inputs_1434 as inputs }; - export namespace outputs_1434 { - let out_1404: string; - export { out_1404 as out }; - } - export { outputs_1434 as outputs }; - } - export { ND_ifgreatereq_matrix33_1 as ND_ifgreatereq_matrix33 }; - export namespace ND_ifgreatereq_matrix44_1 { - let node_1435: string; - export { node_1435 as node }; - export namespace inputs_1435 { - let value1_98: string; - export { value1_98 as value1 }; - let value2_98: string; - export { value2_98 as value2 }; - let in1_377: string; - export { in1_377 as in1 }; - let in2_377: string; - export { in2_377 as in2 }; - } - export { inputs_1435 as inputs }; - export namespace outputs_1435 { - let out_1405: string; - export { out_1405 as out }; - } - export { outputs_1435 as outputs }; - } - export { ND_ifgreatereq_matrix44_1 as ND_ifgreatereq_matrix44 }; - export namespace ND_ifgreatereq_boolean_1 { - let node_1436: string; - export { node_1436 as node }; - export namespace inputs_1436 { - let value1_99: string; - export { value1_99 as value1 }; - let value2_99: string; - export { value2_99 as value2 }; - } - export { inputs_1436 as inputs }; - export namespace outputs_1436 { - let out_1406: string; - export { out_1406 as out }; - } - export { outputs_1436 as outputs }; - } - export { ND_ifgreatereq_boolean_1 as ND_ifgreatereq_boolean }; - export namespace ND_ifgreatereq_floatI_1 { - let node_1437: string; - export { node_1437 as node }; - export namespace inputs_1437 { - let value1_100: string; - export { value1_100 as value1 }; - let value2_100: string; - export { value2_100 as value2 }; - let in1_378: string; - export { in1_378 as in1 }; - let in2_378: string; - export { in2_378 as in2 }; - } - export { inputs_1437 as inputs }; - export namespace outputs_1437 { - let out_1407: string; - export { out_1407 as out }; - } - export { outputs_1437 as outputs }; - } - export { ND_ifgreatereq_floatI_1 as ND_ifgreatereq_floatI }; - export namespace ND_ifgreatereq_integerI_1 { - let node_1438: string; - export { node_1438 as node }; - export namespace inputs_1438 { - let value1_101: string; - export { value1_101 as value1 }; - let value2_101: string; - export { value2_101 as value2 }; - let in1_379: string; - export { in1_379 as in1 }; - let in2_379: string; - export { in2_379 as in2 }; - } - export { inputs_1438 as inputs }; - export namespace outputs_1438 { - let out_1408: string; - export { out_1408 as out }; - } - export { outputs_1438 as outputs }; - } - export { ND_ifgreatereq_integerI_1 as ND_ifgreatereq_integerI }; - export namespace ND_ifgreatereq_color3I_1 { - let node_1439: string; - export { node_1439 as node }; - export namespace inputs_1439 { - let value1_102: string; - export { value1_102 as value1 }; - let value2_102: string; - export { value2_102 as value2 }; - let in1_380: string; - export { in1_380 as in1 }; - let in2_380: string; - export { in2_380 as in2 }; - } - export { inputs_1439 as inputs }; - export namespace outputs_1439 { - let out_1409: string; - export { out_1409 as out }; - } - export { outputs_1439 as outputs }; - } - export { ND_ifgreatereq_color3I_1 as ND_ifgreatereq_color3I }; - export namespace ND_ifgreatereq_color4I_1 { - let node_1440: string; - export { node_1440 as node }; - export namespace inputs_1440 { - let value1_103: string; - export { value1_103 as value1 }; - let value2_103: string; - export { value2_103 as value2 }; - let in1_381: string; - export { in1_381 as in1 }; - let in2_381: string; - export { in2_381 as in2 }; - } - export { inputs_1440 as inputs }; - export namespace outputs_1440 { - let out_1410: string; - export { out_1410 as out }; - } - export { outputs_1440 as outputs }; - } - export { ND_ifgreatereq_color4I_1 as ND_ifgreatereq_color4I }; - export namespace ND_ifgreatereq_vector2I_1 { - let node_1441: string; - export { node_1441 as node }; - export namespace inputs_1441 { - let value1_104: string; - export { value1_104 as value1 }; - let value2_104: string; - export { value2_104 as value2 }; - let in1_382: string; - export { in1_382 as in1 }; - let in2_382: string; - export { in2_382 as in2 }; - } - export { inputs_1441 as inputs }; - export namespace outputs_1441 { - let out_1411: string; - export { out_1411 as out }; - } - export { outputs_1441 as outputs }; - } - export { ND_ifgreatereq_vector2I_1 as ND_ifgreatereq_vector2I }; - export namespace ND_ifgreatereq_vector3I_1 { - let node_1442: string; - export { node_1442 as node }; - export namespace inputs_1442 { - let value1_105: string; - export { value1_105 as value1 }; - let value2_105: string; - export { value2_105 as value2 }; - let in1_383: string; - export { in1_383 as in1 }; - let in2_383: string; - export { in2_383 as in2 }; - } - export { inputs_1442 as inputs }; - export namespace outputs_1442 { - let out_1412: string; - export { out_1412 as out }; - } - export { outputs_1442 as outputs }; - } - export { ND_ifgreatereq_vector3I_1 as ND_ifgreatereq_vector3I }; - export namespace ND_ifgreatereq_vector4I_1 { - let node_1443: string; - export { node_1443 as node }; - export namespace inputs_1443 { - let value1_106: string; - export { value1_106 as value1 }; - let value2_106: string; - export { value2_106 as value2 }; - let in1_384: string; - export { in1_384 as in1 }; - let in2_384: string; - export { in2_384 as in2 }; - } - export { inputs_1443 as inputs }; - export namespace outputs_1443 { - let out_1413: string; - export { out_1413 as out }; - } - export { outputs_1443 as outputs }; - } - export { ND_ifgreatereq_vector4I_1 as ND_ifgreatereq_vector4I }; - export namespace ND_ifgreatereq_matrix33I_1 { - let node_1444: string; - export { node_1444 as node }; - export namespace inputs_1444 { - let value1_107: string; - export { value1_107 as value1 }; - let value2_107: string; - export { value2_107 as value2 }; - let in1_385: string; - export { in1_385 as in1 }; - let in2_385: string; - export { in2_385 as in2 }; - } - export { inputs_1444 as inputs }; - export namespace outputs_1444 { - let out_1414: string; - export { out_1414 as out }; - } - export { outputs_1444 as outputs }; - } - export { ND_ifgreatereq_matrix33I_1 as ND_ifgreatereq_matrix33I }; - export namespace ND_ifgreatereq_matrix44I_1 { - let node_1445: string; - export { node_1445 as node }; - export namespace inputs_1445 { - let value1_108: string; - export { value1_108 as value1 }; - let value2_108: string; - export { value2_108 as value2 }; - let in1_386: string; - export { in1_386 as in1 }; - let in2_386: string; - export { in2_386 as in2 }; - } - export { inputs_1445 as inputs }; - export namespace outputs_1445 { - let out_1415: string; - export { out_1415 as out }; - } - export { outputs_1445 as outputs }; - } - export { ND_ifgreatereq_matrix44I_1 as ND_ifgreatereq_matrix44I }; - export namespace ND_ifgreatereq_booleanI_1 { - let node_1446: string; - export { node_1446 as node }; - export namespace inputs_1446 { - let value1_109: string; - export { value1_109 as value1 }; - let value2_109: string; - export { value2_109 as value2 }; - } - export { inputs_1446 as inputs }; - export namespace outputs_1446 { - let out_1416: string; - export { out_1416 as out }; - } - export { outputs_1446 as outputs }; - } - export { ND_ifgreatereq_booleanI_1 as ND_ifgreatereq_booleanI }; - export namespace ND_ifequal_float_1 { - let node_1447: string; - export { node_1447 as node }; - export namespace inputs_1447 { - let value1_110: string; - export { value1_110 as value1 }; - let value2_110: string; - export { value2_110 as value2 }; - let in1_387: string; - export { in1_387 as in1 }; - let in2_387: string; - export { in2_387 as in2 }; - } - export { inputs_1447 as inputs }; - export namespace outputs_1447 { - let out_1417: string; - export { out_1417 as out }; - } - export { outputs_1447 as outputs }; - } - export { ND_ifequal_float_1 as ND_ifequal_float }; - export namespace ND_ifequal_integer_1 { - let node_1448: string; - export { node_1448 as node }; - export namespace inputs_1448 { - let value1_111: string; - export { value1_111 as value1 }; - let value2_111: string; - export { value2_111 as value2 }; - let in1_388: string; - export { in1_388 as in1 }; - let in2_388: string; - export { in2_388 as in2 }; - } - export { inputs_1448 as inputs }; - export namespace outputs_1448 { - let out_1418: string; - export { out_1418 as out }; - } - export { outputs_1448 as outputs }; - } - export { ND_ifequal_integer_1 as ND_ifequal_integer }; - export namespace ND_ifequal_color3_1 { - let node_1449: string; - export { node_1449 as node }; - export namespace inputs_1449 { - let value1_112: string; - export { value1_112 as value1 }; - let value2_112: string; - export { value2_112 as value2 }; - let in1_389: string; - export { in1_389 as in1 }; - let in2_389: string; - export { in2_389 as in2 }; - } - export { inputs_1449 as inputs }; - export namespace outputs_1449 { - let out_1419: string; - export { out_1419 as out }; - } - export { outputs_1449 as outputs }; - } - export { ND_ifequal_color3_1 as ND_ifequal_color3 }; - export namespace ND_ifequal_color4_1 { - let node_1450: string; - export { node_1450 as node }; - export namespace inputs_1450 { - let value1_113: string; - export { value1_113 as value1 }; - let value2_113: string; - export { value2_113 as value2 }; - let in1_390: string; - export { in1_390 as in1 }; - let in2_390: string; - export { in2_390 as in2 }; - } - export { inputs_1450 as inputs }; - export namespace outputs_1450 { - let out_1420: string; - export { out_1420 as out }; - } - export { outputs_1450 as outputs }; - } - export { ND_ifequal_color4_1 as ND_ifequal_color4 }; - export namespace ND_ifequal_vector2_1 { - let node_1451: string; - export { node_1451 as node }; - export namespace inputs_1451 { - let value1_114: string; - export { value1_114 as value1 }; - let value2_114: string; - export { value2_114 as value2 }; - let in1_391: string; - export { in1_391 as in1 }; - let in2_391: string; - export { in2_391 as in2 }; - } - export { inputs_1451 as inputs }; - export namespace outputs_1451 { - let out_1421: string; - export { out_1421 as out }; - } - export { outputs_1451 as outputs }; - } - export { ND_ifequal_vector2_1 as ND_ifequal_vector2 }; - export namespace ND_ifequal_vector3_1 { - let node_1452: string; - export { node_1452 as node }; - export namespace inputs_1452 { - let value1_115: string; - export { value1_115 as value1 }; - let value2_115: string; - export { value2_115 as value2 }; - let in1_392: string; - export { in1_392 as in1 }; - let in2_392: string; - export { in2_392 as in2 }; - } - export { inputs_1452 as inputs }; - export namespace outputs_1452 { - let out_1422: string; - export { out_1422 as out }; - } - export { outputs_1452 as outputs }; - } - export { ND_ifequal_vector3_1 as ND_ifequal_vector3 }; - export namespace ND_ifequal_vector4_1 { - let node_1453: string; - export { node_1453 as node }; - export namespace inputs_1453 { - let value1_116: string; - export { value1_116 as value1 }; - let value2_116: string; - export { value2_116 as value2 }; - let in1_393: string; - export { in1_393 as in1 }; - let in2_393: string; - export { in2_393 as in2 }; - } - export { inputs_1453 as inputs }; - export namespace outputs_1453 { - let out_1423: string; - export { out_1423 as out }; - } - export { outputs_1453 as outputs }; - } - export { ND_ifequal_vector4_1 as ND_ifequal_vector4 }; - export namespace ND_ifequal_matrix33_1 { - let node_1454: string; - export { node_1454 as node }; - export namespace inputs_1454 { - let value1_117: string; - export { value1_117 as value1 }; - let value2_117: string; - export { value2_117 as value2 }; - let in1_394: string; - export { in1_394 as in1 }; - let in2_394: string; - export { in2_394 as in2 }; - } - export { inputs_1454 as inputs }; - export namespace outputs_1454 { - let out_1424: string; - export { out_1424 as out }; - } - export { outputs_1454 as outputs }; - } - export { ND_ifequal_matrix33_1 as ND_ifequal_matrix33 }; - export namespace ND_ifequal_matrix44_1 { - let node_1455: string; - export { node_1455 as node }; - export namespace inputs_1455 { - let value1_118: string; - export { value1_118 as value1 }; - let value2_118: string; - export { value2_118 as value2 }; - let in1_395: string; - export { in1_395 as in1 }; - let in2_395: string; - export { in2_395 as in2 }; - } - export { inputs_1455 as inputs }; - export namespace outputs_1455 { - let out_1425: string; - export { out_1425 as out }; - } - export { outputs_1455 as outputs }; - } - export { ND_ifequal_matrix44_1 as ND_ifequal_matrix44 }; - export namespace ND_ifequal_boolean_1 { - let node_1456: string; - export { node_1456 as node }; - export namespace inputs_1456 { - let value1_119: string; - export { value1_119 as value1 }; - let value2_119: string; - export { value2_119 as value2 }; - } - export { inputs_1456 as inputs }; - export namespace outputs_1456 { - let out_1426: string; - export { out_1426 as out }; - } - export { outputs_1456 as outputs }; - } - export { ND_ifequal_boolean_1 as ND_ifequal_boolean }; - export namespace ND_ifequal_floatI_1 { - let node_1457: string; - export { node_1457 as node }; - export namespace inputs_1457 { - let value1_120: string; - export { value1_120 as value1 }; - let value2_120: string; - export { value2_120 as value2 }; - let in1_396: string; - export { in1_396 as in1 }; - let in2_396: string; - export { in2_396 as in2 }; - } - export { inputs_1457 as inputs }; - export namespace outputs_1457 { - let out_1427: string; - export { out_1427 as out }; - } - export { outputs_1457 as outputs }; - } - export { ND_ifequal_floatI_1 as ND_ifequal_floatI }; - export namespace ND_ifequal_integerI_1 { - let node_1458: string; - export { node_1458 as node }; - export namespace inputs_1458 { - let value1_121: string; - export { value1_121 as value1 }; - let value2_121: string; - export { value2_121 as value2 }; - let in1_397: string; - export { in1_397 as in1 }; - let in2_397: string; - export { in2_397 as in2 }; - } - export { inputs_1458 as inputs }; - export namespace outputs_1458 { - let out_1428: string; - export { out_1428 as out }; - } - export { outputs_1458 as outputs }; - } - export { ND_ifequal_integerI_1 as ND_ifequal_integerI }; - export namespace ND_ifequal_color3I_1 { - let node_1459: string; - export { node_1459 as node }; - export namespace inputs_1459 { - let value1_122: string; - export { value1_122 as value1 }; - let value2_122: string; - export { value2_122 as value2 }; - let in1_398: string; - export { in1_398 as in1 }; - let in2_398: string; - export { in2_398 as in2 }; - } - export { inputs_1459 as inputs }; - export namespace outputs_1459 { - let out_1429: string; - export { out_1429 as out }; - } - export { outputs_1459 as outputs }; - } - export { ND_ifequal_color3I_1 as ND_ifequal_color3I }; - export namespace ND_ifequal_color4I_1 { - let node_1460: string; - export { node_1460 as node }; - export namespace inputs_1460 { - let value1_123: string; - export { value1_123 as value1 }; - let value2_123: string; - export { value2_123 as value2 }; - let in1_399: string; - export { in1_399 as in1 }; - let in2_399: string; - export { in2_399 as in2 }; - } - export { inputs_1460 as inputs }; - export namespace outputs_1460 { - let out_1430: string; - export { out_1430 as out }; - } - export { outputs_1460 as outputs }; - } - export { ND_ifequal_color4I_1 as ND_ifequal_color4I }; - export namespace ND_ifequal_vector2I_1 { - let node_1461: string; - export { node_1461 as node }; - export namespace inputs_1461 { - let value1_124: string; - export { value1_124 as value1 }; - let value2_124: string; - export { value2_124 as value2 }; - let in1_400: string; - export { in1_400 as in1 }; - let in2_400: string; - export { in2_400 as in2 }; - } - export { inputs_1461 as inputs }; - export namespace outputs_1461 { - let out_1431: string; - export { out_1431 as out }; - } - export { outputs_1461 as outputs }; - } - export { ND_ifequal_vector2I_1 as ND_ifequal_vector2I }; - export namespace ND_ifequal_vector3I_1 { - let node_1462: string; - export { node_1462 as node }; - export namespace inputs_1462 { - let value1_125: string; - export { value1_125 as value1 }; - let value2_125: string; - export { value2_125 as value2 }; - let in1_401: string; - export { in1_401 as in1 }; - let in2_401: string; - export { in2_401 as in2 }; - } - export { inputs_1462 as inputs }; - export namespace outputs_1462 { - let out_1432: string; - export { out_1432 as out }; - } - export { outputs_1462 as outputs }; - } - export { ND_ifequal_vector3I_1 as ND_ifequal_vector3I }; - export namespace ND_ifequal_vector4I_1 { - let node_1463: string; - export { node_1463 as node }; - export namespace inputs_1463 { - let value1_126: string; - export { value1_126 as value1 }; - let value2_126: string; - export { value2_126 as value2 }; - let in1_402: string; - export { in1_402 as in1 }; - let in2_402: string; - export { in2_402 as in2 }; - } - export { inputs_1463 as inputs }; - export namespace outputs_1463 { - let out_1433: string; - export { out_1433 as out }; - } - export { outputs_1463 as outputs }; - } - export { ND_ifequal_vector4I_1 as ND_ifequal_vector4I }; - export namespace ND_ifequal_matrix33I_1 { - let node_1464: string; - export { node_1464 as node }; - export namespace inputs_1464 { - let value1_127: string; - export { value1_127 as value1 }; - let value2_127: string; - export { value2_127 as value2 }; - let in1_403: string; - export { in1_403 as in1 }; - let in2_403: string; - export { in2_403 as in2 }; - } - export { inputs_1464 as inputs }; - export namespace outputs_1464 { - let out_1434: string; - export { out_1434 as out }; - } - export { outputs_1464 as outputs }; - } - export { ND_ifequal_matrix33I_1 as ND_ifequal_matrix33I }; - export namespace ND_ifequal_matrix44I_1 { - let node_1465: string; - export { node_1465 as node }; - export namespace inputs_1465 { - let value1_128: string; - export { value1_128 as value1 }; - let value2_128: string; - export { value2_128 as value2 }; - let in1_404: string; - export { in1_404 as in1 }; - let in2_404: string; - export { in2_404 as in2 }; - } - export { inputs_1465 as inputs }; - export namespace outputs_1465 { - let out_1435: string; - export { out_1435 as out }; - } - export { outputs_1465 as outputs }; - } - export { ND_ifequal_matrix44I_1 as ND_ifequal_matrix44I }; - export namespace ND_ifequal_booleanI_1 { - let node_1466: string; - export { node_1466 as node }; - export namespace inputs_1466 { - let value1_129: string; - export { value1_129 as value1 }; - let value2_129: string; - export { value2_129 as value2 }; - } - export { inputs_1466 as inputs }; - export namespace outputs_1466 { - let out_1436: string; - export { out_1436 as out }; - } - export { outputs_1466 as outputs }; - } - export { ND_ifequal_booleanI_1 as ND_ifequal_booleanI }; - export namespace ND_ifequal_floatB_1 { - let node_1467: string; - export { node_1467 as node }; - export namespace inputs_1467 { - let value1_130: string; - export { value1_130 as value1 }; - let value2_130: string; - export { value2_130 as value2 }; - let in1_405: string; - export { in1_405 as in1 }; - let in2_405: string; - export { in2_405 as in2 }; - } - export { inputs_1467 as inputs }; - export namespace outputs_1467 { - let out_1437: string; - export { out_1437 as out }; - } - export { outputs_1467 as outputs }; - } - export { ND_ifequal_floatB_1 as ND_ifequal_floatB }; - export namespace ND_ifequal_integerB_1 { - let node_1468: string; - export { node_1468 as node }; - export namespace inputs_1468 { - let value1_131: string; - export { value1_131 as value1 }; - let value2_131: string; - export { value2_131 as value2 }; - let in1_406: string; - export { in1_406 as in1 }; - let in2_406: string; - export { in2_406 as in2 }; - } - export { inputs_1468 as inputs }; - export namespace outputs_1468 { - let out_1438: string; - export { out_1438 as out }; - } - export { outputs_1468 as outputs }; - } - export { ND_ifequal_integerB_1 as ND_ifequal_integerB }; - export namespace ND_ifequal_color3B_1 { - let node_1469: string; - export { node_1469 as node }; - export namespace inputs_1469 { - let value1_132: string; - export { value1_132 as value1 }; - let value2_132: string; - export { value2_132 as value2 }; - let in1_407: string; - export { in1_407 as in1 }; - let in2_407: string; - export { in2_407 as in2 }; - } - export { inputs_1469 as inputs }; - export namespace outputs_1469 { - let out_1439: string; - export { out_1439 as out }; - } - export { outputs_1469 as outputs }; - } - export { ND_ifequal_color3B_1 as ND_ifequal_color3B }; - export namespace ND_ifequal_color4B_1 { - let node_1470: string; - export { node_1470 as node }; - export namespace inputs_1470 { - let value1_133: string; - export { value1_133 as value1 }; - let value2_133: string; - export { value2_133 as value2 }; - let in1_408: string; - export { in1_408 as in1 }; - let in2_408: string; - export { in2_408 as in2 }; - } - export { inputs_1470 as inputs }; - export namespace outputs_1470 { - let out_1440: string; - export { out_1440 as out }; - } - export { outputs_1470 as outputs }; - } - export { ND_ifequal_color4B_1 as ND_ifequal_color4B }; - export namespace ND_ifequal_vector2B_1 { - let node_1471: string; - export { node_1471 as node }; - export namespace inputs_1471 { - let value1_134: string; - export { value1_134 as value1 }; - let value2_134: string; - export { value2_134 as value2 }; - let in1_409: string; - export { in1_409 as in1 }; - let in2_409: string; - export { in2_409 as in2 }; - } - export { inputs_1471 as inputs }; - export namespace outputs_1471 { - let out_1441: string; - export { out_1441 as out }; - } - export { outputs_1471 as outputs }; - } - export { ND_ifequal_vector2B_1 as ND_ifequal_vector2B }; - export namespace ND_ifequal_vector3B_1 { - let node_1472: string; - export { node_1472 as node }; - export namespace inputs_1472 { - let value1_135: string; - export { value1_135 as value1 }; - let value2_135: string; - export { value2_135 as value2 }; - let in1_410: string; - export { in1_410 as in1 }; - let in2_410: string; - export { in2_410 as in2 }; - } - export { inputs_1472 as inputs }; - export namespace outputs_1472 { - let out_1442: string; - export { out_1442 as out }; - } - export { outputs_1472 as outputs }; - } - export { ND_ifequal_vector3B_1 as ND_ifequal_vector3B }; - export namespace ND_ifequal_vector4B_1 { - let node_1473: string; - export { node_1473 as node }; - export namespace inputs_1473 { - let value1_136: string; - export { value1_136 as value1 }; - let value2_136: string; - export { value2_136 as value2 }; - let in1_411: string; - export { in1_411 as in1 }; - let in2_411: string; - export { in2_411 as in2 }; - } - export { inputs_1473 as inputs }; - export namespace outputs_1473 { - let out_1443: string; - export { out_1443 as out }; - } - export { outputs_1473 as outputs }; - } - export { ND_ifequal_vector4B_1 as ND_ifequal_vector4B }; - export namespace ND_ifequal_matrix33B_1 { - let node_1474: string; - export { node_1474 as node }; - export namespace inputs_1474 { - let value1_137: string; - export { value1_137 as value1 }; - let value2_137: string; - export { value2_137 as value2 }; - let in1_412: string; - export { in1_412 as in1 }; - let in2_412: string; - export { in2_412 as in2 }; - } - export { inputs_1474 as inputs }; - export namespace outputs_1474 { - let out_1444: string; - export { out_1444 as out }; - } - export { outputs_1474 as outputs }; - } - export { ND_ifequal_matrix33B_1 as ND_ifequal_matrix33B }; - export namespace ND_ifequal_matrix44B_1 { - let node_1475: string; - export { node_1475 as node }; - export namespace inputs_1475 { - let value1_138: string; - export { value1_138 as value1 }; - let value2_138: string; - export { value2_138 as value2 }; - let in1_413: string; - export { in1_413 as in1 }; - let in2_413: string; - export { in2_413 as in2 }; - } - export { inputs_1475 as inputs }; - export namespace outputs_1475 { - let out_1445: string; - export { out_1445 as out }; - } - export { outputs_1475 as outputs }; - } - export { ND_ifequal_matrix44B_1 as ND_ifequal_matrix44B }; - export namespace ND_ifequal_booleanB_1 { - let node_1476: string; - export { node_1476 as node }; - export namespace inputs_1476 { - let value1_139: string; - export { value1_139 as value1 }; - let value2_139: string; - export { value2_139 as value2 }; - } - export { inputs_1476 as inputs }; - export namespace outputs_1476 { - let out_1446: string; - export { out_1446 as out }; - } - export { outputs_1476 as outputs }; - } - export { ND_ifequal_booleanB_1 as ND_ifequal_booleanB }; - export namespace ND_switch_float_1 { - let node_1477: string; - export { node_1477 as node }; - export namespace inputs_1477 { - let in1_414: string; - export { in1_414 as in1 }; - let in2_414: string; - export { in2_414 as in2 }; - let in3_23: string; - export { in3_23 as in3 }; - let in4_20: string; - export { in4_20 as in4 }; - let in5_16: string; - export { in5_16 as in5 }; - let in6_16: string; - export { in6_16 as in6 }; - let in7_16: string; - export { in7_16 as in7 }; - let in8_16: string; - export { in8_16 as in8 }; - let in9_16: string; - export { in9_16 as in9 }; - let in10_16: string; - export { in10_16 as in10 }; - let which_16: string; - export { which_16 as which }; - } - export { inputs_1477 as inputs }; - export namespace outputs_1477 { - let out_1447: string; - export { out_1447 as out }; - } - export { outputs_1477 as outputs }; - } - export { ND_switch_float_1 as ND_switch_float }; - export namespace ND_switch_color3_1 { - let node_1478: string; - export { node_1478 as node }; - export namespace inputs_1478 { - let in1_415: string; - export { in1_415 as in1 }; - let in2_415: string; - export { in2_415 as in2 }; - let in3_24: string; - export { in3_24 as in3 }; - let in4_21: string; - export { in4_21 as in4 }; - let in5_17: string; - export { in5_17 as in5 }; - let in6_17: string; - export { in6_17 as in6 }; - let in7_17: string; - export { in7_17 as in7 }; - let in8_17: string; - export { in8_17 as in8 }; - let in9_17: string; - export { in9_17 as in9 }; - let in10_17: string; - export { in10_17 as in10 }; - let which_17: string; - export { which_17 as which }; - } - export { inputs_1478 as inputs }; - export namespace outputs_1478 { - let out_1448: string; - export { out_1448 as out }; - } - export { outputs_1478 as outputs }; - } - export { ND_switch_color3_1 as ND_switch_color3 }; - export namespace ND_switch_color4_1 { - let node_1479: string; - export { node_1479 as node }; - export namespace inputs_1479 { - let in1_416: string; - export { in1_416 as in1 }; - let in2_416: string; - export { in2_416 as in2 }; - let in3_25: string; - export { in3_25 as in3 }; - let in4_22: string; - export { in4_22 as in4 }; - let in5_18: string; - export { in5_18 as in5 }; - let in6_18: string; - export { in6_18 as in6 }; - let in7_18: string; - export { in7_18 as in7 }; - let in8_18: string; - export { in8_18 as in8 }; - let in9_18: string; - export { in9_18 as in9 }; - let in10_18: string; - export { in10_18 as in10 }; - let which_18: string; - export { which_18 as which }; - } - export { inputs_1479 as inputs }; - export namespace outputs_1479 { - let out_1449: string; - export { out_1449 as out }; - } - export { outputs_1479 as outputs }; - } - export { ND_switch_color4_1 as ND_switch_color4 }; - export namespace ND_switch_vector2_1 { - let node_1480: string; - export { node_1480 as node }; - export namespace inputs_1480 { - let in1_417: string; - export { in1_417 as in1 }; - let in2_417: string; - export { in2_417 as in2 }; - let in3_26: string; - export { in3_26 as in3 }; - let in4_23: string; - export { in4_23 as in4 }; - let in5_19: string; - export { in5_19 as in5 }; - let in6_19: string; - export { in6_19 as in6 }; - let in7_19: string; - export { in7_19 as in7 }; - let in8_19: string; - export { in8_19 as in8 }; - let in9_19: string; - export { in9_19 as in9 }; - let in10_19: string; - export { in10_19 as in10 }; - let which_19: string; - export { which_19 as which }; - } - export { inputs_1480 as inputs }; - export namespace outputs_1480 { - let out_1450: string; - export { out_1450 as out }; - } - export { outputs_1480 as outputs }; - } - export { ND_switch_vector2_1 as ND_switch_vector2 }; - export namespace ND_switch_vector3_1 { - let node_1481: string; - export { node_1481 as node }; - export namespace inputs_1481 { - let in1_418: string; - export { in1_418 as in1 }; - let in2_418: string; - export { in2_418 as in2 }; - let in3_27: string; - export { in3_27 as in3 }; - let in4_24: string; - export { in4_24 as in4 }; - let in5_20: string; - export { in5_20 as in5 }; - let in6_20: string; - export { in6_20 as in6 }; - let in7_20: string; - export { in7_20 as in7 }; - let in8_20: string; - export { in8_20 as in8 }; - let in9_20: string; - export { in9_20 as in9 }; - let in10_20: string; - export { in10_20 as in10 }; - let which_20: string; - export { which_20 as which }; - } - export { inputs_1481 as inputs }; - export namespace outputs_1481 { - let out_1451: string; - export { out_1451 as out }; - } - export { outputs_1481 as outputs }; - } - export { ND_switch_vector3_1 as ND_switch_vector3 }; - export namespace ND_switch_vector4_1 { - let node_1482: string; - export { node_1482 as node }; - export namespace inputs_1482 { - let in1_419: string; - export { in1_419 as in1 }; - let in2_419: string; - export { in2_419 as in2 }; - let in3_28: string; - export { in3_28 as in3 }; - let in4_25: string; - export { in4_25 as in4 }; - let in5_21: string; - export { in5_21 as in5 }; - let in6_21: string; - export { in6_21 as in6 }; - let in7_21: string; - export { in7_21 as in7 }; - let in8_21: string; - export { in8_21 as in8 }; - let in9_21: string; - export { in9_21 as in9 }; - let in10_21: string; - export { in10_21 as in10 }; - let which_21: string; - export { which_21 as which }; - } - export { inputs_1482 as inputs }; - export namespace outputs_1482 { - let out_1452: string; - export { out_1452 as out }; - } - export { outputs_1482 as outputs }; - } - export { ND_switch_vector4_1 as ND_switch_vector4 }; - export namespace ND_switch_matrix33_1 { - let node_1483: string; - export { node_1483 as node }; - export namespace inputs_1483 { - let in1_420: string; - export { in1_420 as in1 }; - let in2_420: string; - export { in2_420 as in2 }; - let in3_29: string; - export { in3_29 as in3 }; - let in4_26: string; - export { in4_26 as in4 }; - let in5_22: string; - export { in5_22 as in5 }; - let in6_22: string; - export { in6_22 as in6 }; - let in7_22: string; - export { in7_22 as in7 }; - let in8_22: string; - export { in8_22 as in8 }; - let in9_22: string; - export { in9_22 as in9 }; - let in10_22: string; - export { in10_22 as in10 }; - let which_22: string; - export { which_22 as which }; - } - export { inputs_1483 as inputs }; - export namespace outputs_1483 { - let out_1453: string; - export { out_1453 as out }; - } - export { outputs_1483 as outputs }; - } - export { ND_switch_matrix33_1 as ND_switch_matrix33 }; - export namespace ND_switch_matrix44_1 { - let node_1484: string; - export { node_1484 as node }; - export namespace inputs_1484 { - let in1_421: string; - export { in1_421 as in1 }; - let in2_421: string; - export { in2_421 as in2 }; - let in3_30: string; - export { in3_30 as in3 }; - let in4_27: string; - export { in4_27 as in4 }; - let in5_23: string; - export { in5_23 as in5 }; - let in6_23: string; - export { in6_23 as in6 }; - let in7_23: string; - export { in7_23 as in7 }; - let in8_23: string; - export { in8_23 as in8 }; - let in9_23: string; - export { in9_23 as in9 }; - let in10_23: string; - export { in10_23 as in10 }; - let which_23: string; - export { which_23 as which }; - } - export { inputs_1484 as inputs }; - export namespace outputs_1484 { - let out_1454: string; - export { out_1454 as out }; - } - export { outputs_1484 as outputs }; - } - export { ND_switch_matrix44_1 as ND_switch_matrix44 }; - export namespace ND_switch_floatI_1 { - let node_1485: string; - export { node_1485 as node }; - export namespace inputs_1485 { - let in1_422: string; - export { in1_422 as in1 }; - let in2_422: string; - export { in2_422 as in2 }; - let in3_31: string; - export { in3_31 as in3 }; - let in4_28: string; - export { in4_28 as in4 }; - let in5_24: string; - export { in5_24 as in5 }; - let in6_24: string; - export { in6_24 as in6 }; - let in7_24: string; - export { in7_24 as in7 }; - let in8_24: string; - export { in8_24 as in8 }; - let in9_24: string; - export { in9_24 as in9 }; - let in10_24: string; - export { in10_24 as in10 }; - let which_24: string; - export { which_24 as which }; - } - export { inputs_1485 as inputs }; - export namespace outputs_1485 { - let out_1455: string; - export { out_1455 as out }; - } - export { outputs_1485 as outputs }; - } - export { ND_switch_floatI_1 as ND_switch_floatI }; - export namespace ND_switch_color3I_1 { - let node_1486: string; - export { node_1486 as node }; - export namespace inputs_1486 { - let in1_423: string; - export { in1_423 as in1 }; - let in2_423: string; - export { in2_423 as in2 }; - let in3_32: string; - export { in3_32 as in3 }; - let in4_29: string; - export { in4_29 as in4 }; - let in5_25: string; - export { in5_25 as in5 }; - let in6_25: string; - export { in6_25 as in6 }; - let in7_25: string; - export { in7_25 as in7 }; - let in8_25: string; - export { in8_25 as in8 }; - let in9_25: string; - export { in9_25 as in9 }; - let in10_25: string; - export { in10_25 as in10 }; - let which_25: string; - export { which_25 as which }; - } - export { inputs_1486 as inputs }; - export namespace outputs_1486 { - let out_1456: string; - export { out_1456 as out }; - } - export { outputs_1486 as outputs }; - } - export { ND_switch_color3I_1 as ND_switch_color3I }; - export namespace ND_switch_color4I_1 { - let node_1487: string; - export { node_1487 as node }; - export namespace inputs_1487 { - let in1_424: string; - export { in1_424 as in1 }; - let in2_424: string; - export { in2_424 as in2 }; - let in3_33: string; - export { in3_33 as in3 }; - let in4_30: string; - export { in4_30 as in4 }; - let in5_26: string; - export { in5_26 as in5 }; - let in6_26: string; - export { in6_26 as in6 }; - let in7_26: string; - export { in7_26 as in7 }; - let in8_26: string; - export { in8_26 as in8 }; - let in9_26: string; - export { in9_26 as in9 }; - let in10_26: string; - export { in10_26 as in10 }; - let which_26: string; - export { which_26 as which }; - } - export { inputs_1487 as inputs }; - export namespace outputs_1487 { - let out_1457: string; - export { out_1457 as out }; - } - export { outputs_1487 as outputs }; - } - export { ND_switch_color4I_1 as ND_switch_color4I }; - export namespace ND_switch_vector2I_1 { - let node_1488: string; - export { node_1488 as node }; - export namespace inputs_1488 { - let in1_425: string; - export { in1_425 as in1 }; - let in2_425: string; - export { in2_425 as in2 }; - let in3_34: string; - export { in3_34 as in3 }; - let in4_31: string; - export { in4_31 as in4 }; - let in5_27: string; - export { in5_27 as in5 }; - let in6_27: string; - export { in6_27 as in6 }; - let in7_27: string; - export { in7_27 as in7 }; - let in8_27: string; - export { in8_27 as in8 }; - let in9_27: string; - export { in9_27 as in9 }; - let in10_27: string; - export { in10_27 as in10 }; - let which_27: string; - export { which_27 as which }; - } - export { inputs_1488 as inputs }; - export namespace outputs_1488 { - let out_1458: string; - export { out_1458 as out }; - } - export { outputs_1488 as outputs }; - } - export { ND_switch_vector2I_1 as ND_switch_vector2I }; - export namespace ND_switch_vector3I_1 { - let node_1489: string; - export { node_1489 as node }; - export namespace inputs_1489 { - let in1_426: string; - export { in1_426 as in1 }; - let in2_426: string; - export { in2_426 as in2 }; - let in3_35: string; - export { in3_35 as in3 }; - let in4_32: string; - export { in4_32 as in4 }; - let in5_28: string; - export { in5_28 as in5 }; - let in6_28: string; - export { in6_28 as in6 }; - let in7_28: string; - export { in7_28 as in7 }; - let in8_28: string; - export { in8_28 as in8 }; - let in9_28: string; - export { in9_28 as in9 }; - let in10_28: string; - export { in10_28 as in10 }; - let which_28: string; - export { which_28 as which }; - } - export { inputs_1489 as inputs }; - export namespace outputs_1489 { - let out_1459: string; - export { out_1459 as out }; - } - export { outputs_1489 as outputs }; - } - export { ND_switch_vector3I_1 as ND_switch_vector3I }; - export namespace ND_switch_vector4I_1 { - let node_1490: string; - export { node_1490 as node }; - export namespace inputs_1490 { - let in1_427: string; - export { in1_427 as in1 }; - let in2_427: string; - export { in2_427 as in2 }; - let in3_36: string; - export { in3_36 as in3 }; - let in4_33: string; - export { in4_33 as in4 }; - let in5_29: string; - export { in5_29 as in5 }; - let in6_29: string; - export { in6_29 as in6 }; - let in7_29: string; - export { in7_29 as in7 }; - let in8_29: string; - export { in8_29 as in8 }; - let in9_29: string; - export { in9_29 as in9 }; - let in10_29: string; - export { in10_29 as in10 }; - let which_29: string; - export { which_29 as which }; - } - export { inputs_1490 as inputs }; - export namespace outputs_1490 { - let out_1460: string; - export { out_1460 as out }; - } - export { outputs_1490 as outputs }; - } - export { ND_switch_vector4I_1 as ND_switch_vector4I }; - export namespace ND_switch_matrix33I_1 { - let node_1491: string; - export { node_1491 as node }; - export namespace inputs_1491 { - let in1_428: string; - export { in1_428 as in1 }; - let in2_428: string; - export { in2_428 as in2 }; - let in3_37: string; - export { in3_37 as in3 }; - let in4_34: string; - export { in4_34 as in4 }; - let in5_30: string; - export { in5_30 as in5 }; - let in6_30: string; - export { in6_30 as in6 }; - let in7_30: string; - export { in7_30 as in7 }; - let in8_30: string; - export { in8_30 as in8 }; - let in9_30: string; - export { in9_30 as in9 }; - let in10_30: string; - export { in10_30 as in10 }; - let which_30: string; - export { which_30 as which }; - } - export { inputs_1491 as inputs }; - export namespace outputs_1491 { - let out_1461: string; - export { out_1461 as out }; - } - export { outputs_1491 as outputs }; - } - export { ND_switch_matrix33I_1 as ND_switch_matrix33I }; - export namespace ND_switch_matrix44I_1 { - let node_1492: string; - export { node_1492 as node }; - export namespace inputs_1492 { - let in1_429: string; - export { in1_429 as in1 }; - let in2_429: string; - export { in2_429 as in2 }; - let in3_38: string; - export { in3_38 as in3 }; - let in4_35: string; - export { in4_35 as in4 }; - let in5_31: string; - export { in5_31 as in5 }; - let in6_31: string; - export { in6_31 as in6 }; - let in7_31: string; - export { in7_31 as in7 }; - let in8_31: string; - export { in8_31 as in8 }; - let in9_31: string; - export { in9_31 as in9 }; - let in10_31: string; - export { in10_31 as in10 }; - let which_31: string; - export { which_31 as which }; - } - export { inputs_1492 as inputs }; - export namespace outputs_1492 { - let out_1462: string; - export { out_1462 as out }; - } - export { outputs_1492 as outputs }; - } - export { ND_switch_matrix44I_1 as ND_switch_matrix44I }; - export namespace ND_convert_float_color3_1 { - let node_1493: string; - export { node_1493 as node }; - export namespace inputs_1493 { - let _in_499: string; - export { _in_499 as in }; - } - export { inputs_1493 as inputs }; - export namespace outputs_1493 { - let out_1463: string; - export { out_1463 as out }; - } - export { outputs_1493 as outputs }; - } - export { ND_convert_float_color3_1 as ND_convert_float_color3 }; - export namespace ND_convert_float_color4_1 { - let node_1494: string; - export { node_1494 as node }; - export namespace inputs_1494 { - let _in_500: string; - export { _in_500 as in }; - } - export { inputs_1494 as inputs }; - export namespace outputs_1494 { - let out_1464: string; - export { out_1464 as out }; - } - export { outputs_1494 as outputs }; - } - export { ND_convert_float_color4_1 as ND_convert_float_color4 }; - export namespace ND_convert_float_vector2_1 { - let node_1495: string; - export { node_1495 as node }; - export namespace inputs_1495 { - let _in_501: string; - export { _in_501 as in }; - } - export { inputs_1495 as inputs }; - export namespace outputs_1495 { - let out_1465: string; - export { out_1465 as out }; - } - export { outputs_1495 as outputs }; - } - export { ND_convert_float_vector2_1 as ND_convert_float_vector2 }; - export namespace ND_convert_float_vector3_1 { - let node_1496: string; - export { node_1496 as node }; - export namespace inputs_1496 { - let _in_502: string; - export { _in_502 as in }; - } - export { inputs_1496 as inputs }; - export namespace outputs_1496 { - let out_1466: string; - export { out_1466 as out }; - } - export { outputs_1496 as outputs }; - } - export { ND_convert_float_vector3_1 as ND_convert_float_vector3 }; - export namespace ND_convert_float_vector4_1 { - let node_1497: string; - export { node_1497 as node }; - export namespace inputs_1497 { - let _in_503: string; - export { _in_503 as in }; - } - export { inputs_1497 as inputs }; - export namespace outputs_1497 { - let out_1467: string; - export { out_1467 as out }; - } - export { outputs_1497 as outputs }; - } - export { ND_convert_float_vector4_1 as ND_convert_float_vector4 }; - export namespace ND_convert_color3_color4_1 { - let node_1498: string; - export { node_1498 as node }; - export namespace inputs_1498 { - let _in_504: string; - export { _in_504 as in }; - } - export { inputs_1498 as inputs }; - export namespace outputs_1498 { - let out_1468: string; - export { out_1468 as out }; - } - export { outputs_1498 as outputs }; - } - export { ND_convert_color3_color4_1 as ND_convert_color3_color4 }; - export namespace ND_convert_color3_vector2_1 { - let node_1499: string; - export { node_1499 as node }; - export namespace inputs_1499 { - let _in_505: string; - export { _in_505 as in }; - } - export { inputs_1499 as inputs }; - export namespace outputs_1499 { - let out_1469: string; - export { out_1469 as out }; - } - export { outputs_1499 as outputs }; - } - export { ND_convert_color3_vector2_1 as ND_convert_color3_vector2 }; - export namespace ND_convert_color3_vector3_1 { - let node_1500: string; - export { node_1500 as node }; - export namespace inputs_1500 { - let _in_506: string; - export { _in_506 as in }; - } - export { inputs_1500 as inputs }; - export namespace outputs_1500 { - let out_1470: string; - export { out_1470 as out }; - } - export { outputs_1500 as outputs }; - } - export { ND_convert_color3_vector3_1 as ND_convert_color3_vector3 }; - export namespace ND_convert_color3_vector4_1 { - let node_1501: string; - export { node_1501 as node }; - export namespace inputs_1501 { - let _in_507: string; - export { _in_507 as in }; - } - export { inputs_1501 as inputs }; - export namespace outputs_1501 { - let out_1471: string; - export { out_1471 as out }; - } - export { outputs_1501 as outputs }; - } - export { ND_convert_color3_vector4_1 as ND_convert_color3_vector4 }; - export namespace ND_convert_color4_color3_1 { - let node_1502: string; - export { node_1502 as node }; - export namespace inputs_1502 { - let _in_508: string; - export { _in_508 as in }; - } - export { inputs_1502 as inputs }; - export namespace outputs_1502 { - let out_1472: string; - export { out_1472 as out }; - } - export { outputs_1502 as outputs }; - } - export { ND_convert_color4_color3_1 as ND_convert_color4_color3 }; - export namespace ND_convert_color4_vector2_1 { - let node_1503: string; - export { node_1503 as node }; - export namespace inputs_1503 { - let _in_509: string; - export { _in_509 as in }; - } - export { inputs_1503 as inputs }; - export namespace outputs_1503 { - let out_1473: string; - export { out_1473 as out }; - } - export { outputs_1503 as outputs }; - } - export { ND_convert_color4_vector2_1 as ND_convert_color4_vector2 }; - export namespace ND_convert_color4_vector3_1 { - let node_1504: string; - export { node_1504 as node }; - export namespace inputs_1504 { - let _in_510: string; - export { _in_510 as in }; - } - export { inputs_1504 as inputs }; - export namespace outputs_1504 { - let out_1474: string; - export { out_1474 as out }; - } - export { outputs_1504 as outputs }; - } - export { ND_convert_color4_vector3_1 as ND_convert_color4_vector3 }; - export namespace ND_convert_color4_vector4_1 { - let node_1505: string; - export { node_1505 as node }; - export namespace inputs_1505 { - let _in_511: string; - export { _in_511 as in }; - } - export { inputs_1505 as inputs }; - export namespace outputs_1505 { - let out_1475: string; - export { out_1475 as out }; - } - export { outputs_1505 as outputs }; - } - export { ND_convert_color4_vector4_1 as ND_convert_color4_vector4 }; - export namespace ND_convert_vector2_color3_1 { - let node_1506: string; - export { node_1506 as node }; - export namespace inputs_1506 { - let _in_512: string; - export { _in_512 as in }; - } - export { inputs_1506 as inputs }; - export namespace outputs_1506 { - let out_1476: string; - export { out_1476 as out }; - } - export { outputs_1506 as outputs }; - } - export { ND_convert_vector2_color3_1 as ND_convert_vector2_color3 }; - export namespace ND_convert_vector2_color4_1 { - let node_1507: string; - export { node_1507 as node }; - export namespace inputs_1507 { - let _in_513: string; - export { _in_513 as in }; - } - export { inputs_1507 as inputs }; - export namespace outputs_1507 { - let out_1477: string; - export { out_1477 as out }; - } - export { outputs_1507 as outputs }; - } - export { ND_convert_vector2_color4_1 as ND_convert_vector2_color4 }; - export namespace ND_convert_vector2_vector3_1 { - let node_1508: string; - export { node_1508 as node }; - export namespace inputs_1508 { - let _in_514: string; - export { _in_514 as in }; - } - export { inputs_1508 as inputs }; - export namespace outputs_1508 { - let out_1478: string; - export { out_1478 as out }; - } - export { outputs_1508 as outputs }; - } - export { ND_convert_vector2_vector3_1 as ND_convert_vector2_vector3 }; - export namespace ND_convert_vector2_vector4_1 { - let node_1509: string; - export { node_1509 as node }; - export namespace inputs_1509 { - let _in_515: string; - export { _in_515 as in }; - } - export { inputs_1509 as inputs }; - export namespace outputs_1509 { - let out_1479: string; - export { out_1479 as out }; - } - export { outputs_1509 as outputs }; - } - export { ND_convert_vector2_vector4_1 as ND_convert_vector2_vector4 }; - export namespace ND_convert_vector3_color3_1 { - let node_1510: string; - export { node_1510 as node }; - export namespace inputs_1510 { - let _in_516: string; - export { _in_516 as in }; - } - export { inputs_1510 as inputs }; - export namespace outputs_1510 { - let out_1480: string; - export { out_1480 as out }; - } - export { outputs_1510 as outputs }; - } - export { ND_convert_vector3_color3_1 as ND_convert_vector3_color3 }; - export namespace ND_convert_vector3_color4_1 { - let node_1511: string; - export { node_1511 as node }; - export namespace inputs_1511 { - let _in_517: string; - export { _in_517 as in }; - } - export { inputs_1511 as inputs }; - export namespace outputs_1511 { - let out_1481: string; - export { out_1481 as out }; - } - export { outputs_1511 as outputs }; - } - export { ND_convert_vector3_color4_1 as ND_convert_vector3_color4 }; - export namespace ND_convert_vector3_vector2_1 { - let node_1512: string; - export { node_1512 as node }; - export namespace inputs_1512 { - let _in_518: string; - export { _in_518 as in }; - } - export { inputs_1512 as inputs }; - export namespace outputs_1512 { - let out_1482: string; - export { out_1482 as out }; - } - export { outputs_1512 as outputs }; - } - export { ND_convert_vector3_vector2_1 as ND_convert_vector3_vector2 }; - export namespace ND_convert_vector3_vector4_1 { - let node_1513: string; - export { node_1513 as node }; - export namespace inputs_1513 { - let _in_519: string; - export { _in_519 as in }; - } - export { inputs_1513 as inputs }; - export namespace outputs_1513 { - let out_1483: string; - export { out_1483 as out }; - } - export { outputs_1513 as outputs }; - } - export { ND_convert_vector3_vector4_1 as ND_convert_vector3_vector4 }; - export namespace ND_convert_vector4_color3_1 { - let node_1514: string; - export { node_1514 as node }; - export namespace inputs_1514 { - let _in_520: string; - export { _in_520 as in }; - } - export { inputs_1514 as inputs }; - export namespace outputs_1514 { - let out_1484: string; - export { out_1484 as out }; - } - export { outputs_1514 as outputs }; - } - export { ND_convert_vector4_color3_1 as ND_convert_vector4_color3 }; - export namespace ND_convert_vector4_color4_1 { - let node_1515: string; - export { node_1515 as node }; - export namespace inputs_1515 { - let _in_521: string; - export { _in_521 as in }; - } - export { inputs_1515 as inputs }; - export namespace outputs_1515 { - let out_1485: string; - export { out_1485 as out }; - } - export { outputs_1515 as outputs }; - } - export { ND_convert_vector4_color4_1 as ND_convert_vector4_color4 }; - export namespace ND_convert_vector4_vector2_1 { - let node_1516: string; - export { node_1516 as node }; - export namespace inputs_1516 { - let _in_522: string; - export { _in_522 as in }; - } - export { inputs_1516 as inputs }; - export namespace outputs_1516 { - let out_1486: string; - export { out_1486 as out }; - } - export { outputs_1516 as outputs }; - } - export { ND_convert_vector4_vector2_1 as ND_convert_vector4_vector2 }; - export namespace ND_convert_vector4_vector3_1 { - let node_1517: string; - export { node_1517 as node }; - export namespace inputs_1517 { - let _in_523: string; - export { _in_523 as in }; - } - export { inputs_1517 as inputs }; - export namespace outputs_1517 { - let out_1487: string; - export { out_1487 as out }; - } - export { outputs_1517 as outputs }; - } - export { ND_convert_vector4_vector3_1 as ND_convert_vector4_vector3 }; - export namespace ND_convert_boolean_float_1 { - let node_1518: string; - export { node_1518 as node }; - export namespace inputs_1518 { - let _in_524: string; - export { _in_524 as in }; - } - export { inputs_1518 as inputs }; - export namespace outputs_1518 { - let out_1488: string; - export { out_1488 as out }; - } - export { outputs_1518 as outputs }; - } - export { ND_convert_boolean_float_1 as ND_convert_boolean_float }; - export namespace ND_convert_boolean_color3_1 { - let node_1519: string; - export { node_1519 as node }; - export namespace inputs_1519 { - let _in_525: string; - export { _in_525 as in }; - } - export { inputs_1519 as inputs }; - export namespace outputs_1519 { - let out_1489: string; - export { out_1489 as out }; - } - export { outputs_1519 as outputs }; - } - export { ND_convert_boolean_color3_1 as ND_convert_boolean_color3 }; - export namespace ND_convert_boolean_color4_1 { - let node_1520: string; - export { node_1520 as node }; - export namespace inputs_1520 { - let _in_526: string; - export { _in_526 as in }; - } - export { inputs_1520 as inputs }; - export namespace outputs_1520 { - let out_1490: string; - export { out_1490 as out }; - } - export { outputs_1520 as outputs }; - } - export { ND_convert_boolean_color4_1 as ND_convert_boolean_color4 }; - export namespace ND_convert_boolean_vector2_1 { - let node_1521: string; - export { node_1521 as node }; - export namespace inputs_1521 { - let _in_527: string; - export { _in_527 as in }; - } - export { inputs_1521 as inputs }; - export namespace outputs_1521 { - let out_1491: string; - export { out_1491 as out }; - } - export { outputs_1521 as outputs }; - } - export { ND_convert_boolean_vector2_1 as ND_convert_boolean_vector2 }; - export namespace ND_convert_boolean_vector3_1 { - let node_1522: string; - export { node_1522 as node }; - export namespace inputs_1522 { - let _in_528: string; - export { _in_528 as in }; - } - export { inputs_1522 as inputs }; - export namespace outputs_1522 { - let out_1492: string; - export { out_1492 as out }; - } - export { outputs_1522 as outputs }; - } - export { ND_convert_boolean_vector3_1 as ND_convert_boolean_vector3 }; - export namespace ND_convert_boolean_vector4_1 { - let node_1523: string; - export { node_1523 as node }; - export namespace inputs_1523 { - let _in_529: string; - export { _in_529 as in }; - } - export { inputs_1523 as inputs }; - export namespace outputs_1523 { - let out_1493: string; - export { out_1493 as out }; - } - export { outputs_1523 as outputs }; - } - export { ND_convert_boolean_vector4_1 as ND_convert_boolean_vector4 }; - export namespace ND_convert_boolean_integer_1 { - let node_1524: string; - export { node_1524 as node }; - export namespace inputs_1524 { - let _in_530: string; - export { _in_530 as in }; - } - export { inputs_1524 as inputs }; - export namespace outputs_1524 { - let out_1494: string; - export { out_1494 as out }; - } - export { outputs_1524 as outputs }; - } - export { ND_convert_boolean_integer_1 as ND_convert_boolean_integer }; - export namespace ND_convert_integer_float_1 { - let node_1525: string; - export { node_1525 as node }; - export namespace inputs_1525 { - let _in_531: string; - export { _in_531 as in }; - } - export { inputs_1525 as inputs }; - export namespace outputs_1525 { - let out_1495: string; - export { out_1495 as out }; - } - export { outputs_1525 as outputs }; - } - export { ND_convert_integer_float_1 as ND_convert_integer_float }; - export namespace ND_convert_integer_color3_1 { - let node_1526: string; - export { node_1526 as node }; - export namespace inputs_1526 { - let _in_532: string; - export { _in_532 as in }; - } - export { inputs_1526 as inputs }; - export namespace outputs_1526 { - let out_1496: string; - export { out_1496 as out }; - } - export { outputs_1526 as outputs }; - } - export { ND_convert_integer_color3_1 as ND_convert_integer_color3 }; - export namespace ND_convert_integer_color4_1 { - let node_1527: string; - export { node_1527 as node }; - export namespace inputs_1527 { - let _in_533: string; - export { _in_533 as in }; - } - export { inputs_1527 as inputs }; - export namespace outputs_1527 { - let out_1497: string; - export { out_1497 as out }; - } - export { outputs_1527 as outputs }; - } - export { ND_convert_integer_color4_1 as ND_convert_integer_color4 }; - export namespace ND_convert_integer_vector2_1 { - let node_1528: string; - export { node_1528 as node }; - export namespace inputs_1528 { - let _in_534: string; - export { _in_534 as in }; - } - export { inputs_1528 as inputs }; - export namespace outputs_1528 { - let out_1498: string; - export { out_1498 as out }; - } - export { outputs_1528 as outputs }; - } - export { ND_convert_integer_vector2_1 as ND_convert_integer_vector2 }; - export namespace ND_convert_integer_vector3_1 { - let node_1529: string; - export { node_1529 as node }; - export namespace inputs_1529 { - let _in_535: string; - export { _in_535 as in }; - } - export { inputs_1529 as inputs }; - export namespace outputs_1529 { - let out_1499: string; - export { out_1499 as out }; - } - export { outputs_1529 as outputs }; - } - export { ND_convert_integer_vector3_1 as ND_convert_integer_vector3 }; - export namespace ND_convert_integer_vector4_1 { - let node_1530: string; - export { node_1530 as node }; - export namespace inputs_1530 { - let _in_536: string; - export { _in_536 as in }; - } - export { inputs_1530 as inputs }; - export namespace outputs_1530 { - let out_1500: string; - export { out_1500 as out }; - } - export { outputs_1530 as outputs }; - } - export { ND_convert_integer_vector4_1 as ND_convert_integer_vector4 }; - export namespace ND_convert_integer_boolean_1 { - let node_1531: string; - export { node_1531 as node }; - export namespace inputs_1531 { - let _in_537: string; - export { _in_537 as in }; - } - export { inputs_1531 as inputs }; - export namespace outputs_1531 { - let out_1501: string; - export { out_1501 as out }; - } - export { outputs_1531 as outputs }; - } - export { ND_convert_integer_boolean_1 as ND_convert_integer_boolean }; - export namespace ND_convert_color3_surfaceshader_1 { - let node_1532: string; - export { node_1532 as node }; - export namespace inputs_1532 { - let _in_538: string; - export { _in_538 as in }; - } - export { inputs_1532 as inputs }; - export namespace outputs_1532 { - let out_1502: string; - export { out_1502 as out }; - } - export { outputs_1532 as outputs }; - } - export { ND_convert_color3_surfaceshader_1 as ND_convert_color3_surfaceshader }; - export namespace ND_convert_color4_surfaceshader_1 { - let node_1533: string; - export { node_1533 as node }; - export namespace inputs_1533 { - let _in_539: string; - export { _in_539 as in }; - } - export { inputs_1533 as inputs }; - export namespace outputs_1533 { - let out_1503: string; - export { out_1503 as out }; - } - export { outputs_1533 as outputs }; - } - export { ND_convert_color4_surfaceshader_1 as ND_convert_color4_surfaceshader }; - export namespace ND_convert_float_surfaceshader_1 { - let node_1534: string; - export { node_1534 as node }; - export namespace inputs_1534 { - let _in_540: string; - export { _in_540 as in }; - } - export { inputs_1534 as inputs }; - export namespace outputs_1534 { - let out_1504: string; - export { out_1504 as out }; - } - export { outputs_1534 as outputs }; - } - export { ND_convert_float_surfaceshader_1 as ND_convert_float_surfaceshader }; - export namespace ND_convert_vector2_surfaceshader_1 { - let node_1535: string; - export { node_1535 as node }; - export namespace inputs_1535 { - let _in_541: string; - export { _in_541 as in }; - } - export { inputs_1535 as inputs }; - export namespace outputs_1535 { - let out_1505: string; - export { out_1505 as out }; - } - export { outputs_1535 as outputs }; - } - export { ND_convert_vector2_surfaceshader_1 as ND_convert_vector2_surfaceshader }; - export namespace ND_convert_vector3_surfaceshader_1 { - let node_1536: string; - export { node_1536 as node }; - export namespace inputs_1536 { - let _in_542: string; - export { _in_542 as in }; - } - export { inputs_1536 as inputs }; - export namespace outputs_1536 { - let out_1506: string; - export { out_1506 as out }; - } - export { outputs_1536 as outputs }; - } - export { ND_convert_vector3_surfaceshader_1 as ND_convert_vector3_surfaceshader }; - export namespace ND_convert_vector4_surfaceshader_1 { - let node_1537: string; - export { node_1537 as node }; - export namespace inputs_1537 { - let _in_543: string; - export { _in_543 as in }; - } - export { inputs_1537 as inputs }; - export namespace outputs_1537 { - let out_1507: string; - export { out_1507 as out }; - } - export { outputs_1537 as outputs }; - } - export { ND_convert_vector4_surfaceshader_1 as ND_convert_vector4_surfaceshader }; - export namespace ND_convert_integer_surfaceshader_1 { - let node_1538: string; - export { node_1538 as node }; - export namespace inputs_1538 { - let _in_544: string; - export { _in_544 as in }; - } - export { inputs_1538 as inputs }; - export namespace outputs_1538 { - let out_1508: string; - export { out_1508 as out }; - } - export { outputs_1538 as outputs }; - } - export { ND_convert_integer_surfaceshader_1 as ND_convert_integer_surfaceshader }; - export namespace ND_convert_boolean_surfaceshader_1 { - let node_1539: string; - export { node_1539 as node }; - export namespace inputs_1539 { - let _in_545: string; - export { _in_545 as in }; - } - export { inputs_1539 as inputs }; - export namespace outputs_1539 { - let out_1509: string; - export { out_1509 as out }; - } - export { outputs_1539 as outputs }; - } - export { ND_convert_boolean_surfaceshader_1 as ND_convert_boolean_surfaceshader }; - export namespace ND_combine2_vector2_1 { - let node_1540: string; - export { node_1540 as node }; - export namespace inputs_1540 { - let in1_430: string; - export { in1_430 as in1 }; - let in2_430: string; - export { in2_430 as in2 }; - } - export { inputs_1540 as inputs }; - export namespace outputs_1540 { - let out_1510: string; - export { out_1510 as out }; - } - export { outputs_1540 as outputs }; - } - export { ND_combine2_vector2_1 as ND_combine2_vector2 }; - export namespace ND_combine2_color4CF_1 { - let node_1541: string; - export { node_1541 as node }; - export namespace inputs_1541 { - let in1_431: string; - export { in1_431 as in1 }; - let in2_431: string; - export { in2_431 as in2 }; - } - export { inputs_1541 as inputs }; - export namespace outputs_1541 { - let out_1511: string; - export { out_1511 as out }; - } - export { outputs_1541 as outputs }; - } - export { ND_combine2_color4CF_1 as ND_combine2_color4CF }; - export namespace ND_combine2_vector4VF_1 { - let node_1542: string; - export { node_1542 as node }; - export namespace inputs_1542 { - let in1_432: string; - export { in1_432 as in1 }; - let in2_432: string; - export { in2_432 as in2 }; - } - export { inputs_1542 as inputs }; - export namespace outputs_1542 { - let out_1512: string; - export { out_1512 as out }; - } - export { outputs_1542 as outputs }; - } - export { ND_combine2_vector4VF_1 as ND_combine2_vector4VF }; - export namespace ND_combine2_vector4VV_1 { - let node_1543: string; - export { node_1543 as node }; - export namespace inputs_1543 { - let in1_433: string; - export { in1_433 as in1 }; - let in2_433: string; - export { in2_433 as in2 }; - } - export { inputs_1543 as inputs }; - export namespace outputs_1543 { - let out_1513: string; - export { out_1513 as out }; - } - export { outputs_1543 as outputs }; - } - export { ND_combine2_vector4VV_1 as ND_combine2_vector4VV }; - export namespace ND_combine3_color3_1 { - let node_1544: string; - export { node_1544 as node }; - export namespace inputs_1544 { - let in1_434: string; - export { in1_434 as in1 }; - let in2_434: string; - export { in2_434 as in2 }; - let in3_39: string; - export { in3_39 as in3 }; - } - export { inputs_1544 as inputs }; - export namespace outputs_1544 { - let out_1514: string; - export { out_1514 as out }; - } - export { outputs_1544 as outputs }; - } - export { ND_combine3_color3_1 as ND_combine3_color3 }; - export namespace ND_combine3_vector3_1 { - let node_1545: string; - export { node_1545 as node }; - export namespace inputs_1545 { - let in1_435: string; - export { in1_435 as in1 }; - let in2_435: string; - export { in2_435 as in2 }; - let in3_40: string; - export { in3_40 as in3 }; - } - export { inputs_1545 as inputs }; - export namespace outputs_1545 { - let out_1515: string; - export { out_1515 as out }; - } - export { outputs_1545 as outputs }; - } - export { ND_combine3_vector3_1 as ND_combine3_vector3 }; - export namespace ND_combine4_color4_1 { - let node_1546: string; - export { node_1546 as node }; - export namespace inputs_1546 { - let in1_436: string; - export { in1_436 as in1 }; - let in2_436: string; - export { in2_436 as in2 }; - let in3_41: string; - export { in3_41 as in3 }; - let in4_36: string; - export { in4_36 as in4 }; - } - export { inputs_1546 as inputs }; - export namespace outputs_1546 { - let out_1516: string; - export { out_1516 as out }; - } - export { outputs_1546 as outputs }; - } - export { ND_combine4_color4_1 as ND_combine4_color4 }; - export namespace ND_combine4_vector4_1 { - let node_1547: string; - export { node_1547 as node }; - export namespace inputs_1547 { - let in1_437: string; - export { in1_437 as in1 }; - let in2_437: string; - export { in2_437 as in2 }; - let in3_42: string; - export { in3_42 as in3 }; - let in4_37: string; - export { in4_37 as in4 }; - } - export { inputs_1547 as inputs }; - export namespace outputs_1547 { - let out_1517: string; - export { out_1517 as out }; - } - export { outputs_1547 as outputs }; - } - export { ND_combine4_vector4_1 as ND_combine4_vector4 }; - export namespace ND_creatematrix_vector3_matrix33_1 { - let node_1548: string; - export { node_1548 as node }; - export namespace inputs_1548 { - let in1_438: string; - export { in1_438 as in1 }; - let in2_438: string; - export { in2_438 as in2 }; - let in3_43: string; - export { in3_43 as in3 }; - } - export { inputs_1548 as inputs }; - export namespace outputs_1548 { - let out_1518: string; - export { out_1518 as out }; - } - export { outputs_1548 as outputs }; - } - export { ND_creatematrix_vector3_matrix33_1 as ND_creatematrix_vector3_matrix33 }; - export namespace ND_creatematrix_vector3_matrix44_1 { - let node_1549: string; - export { node_1549 as node }; - export namespace inputs_1549 { - let in1_439: string; - export { in1_439 as in1 }; - let in2_439: string; - export { in2_439 as in2 }; - let in3_44: string; - export { in3_44 as in3 }; - let in4_38: string; - export { in4_38 as in4 }; - } - export { inputs_1549 as inputs }; - export namespace outputs_1549 { - let out_1519: string; - export { out_1519 as out }; - } - export { outputs_1549 as outputs }; - } - export { ND_creatematrix_vector3_matrix44_1 as ND_creatematrix_vector3_matrix44 }; - export namespace ND_creatematrix_vector4_matrix44_1 { - let node_1550: string; - export { node_1550 as node }; - export namespace inputs_1550 { - let in1_440: string; - export { in1_440 as in1 }; - let in2_440: string; - export { in2_440 as in2 }; - let in3_45: string; - export { in3_45 as in3 }; - let in4_39: string; - export { in4_39 as in4 }; - } - export { inputs_1550 as inputs }; - export namespace outputs_1550 { - let out_1520: string; - export { out_1520 as out }; - } - export { outputs_1550 as outputs }; - } - export { ND_creatematrix_vector4_matrix44_1 as ND_creatematrix_vector4_matrix44 }; - export namespace ND_extract_color3_1 { - let node_1551: string; - export { node_1551 as node }; - export namespace inputs_1551 { - let _in_546: string; - export { _in_546 as in }; - let index_21: string; - export { index_21 as index }; - } - export { inputs_1551 as inputs }; - export namespace outputs_1551 { - let out_1521: string; - export { out_1521 as out }; - } - export { outputs_1551 as outputs }; - } - export { ND_extract_color3_1 as ND_extract_color3 }; - export namespace ND_extract_color4_1 { - let node_1552: string; - export { node_1552 as node }; - export namespace inputs_1552 { - let _in_547: string; - export { _in_547 as in }; - let index_22: string; - export { index_22 as index }; - } - export { inputs_1552 as inputs }; - export namespace outputs_1552 { - let out_1522: string; - export { out_1522 as out }; - } - export { outputs_1552 as outputs }; - } - export { ND_extract_color4_1 as ND_extract_color4 }; - export namespace ND_extract_vector2_1 { - let node_1553: string; - export { node_1553 as node }; - export namespace inputs_1553 { - let _in_548: string; - export { _in_548 as in }; - let index_23: string; - export { index_23 as index }; - } - export { inputs_1553 as inputs }; - export namespace outputs_1553 { - let out_1523: string; - export { out_1523 as out }; - } - export { outputs_1553 as outputs }; - } - export { ND_extract_vector2_1 as ND_extract_vector2 }; - export namespace ND_extract_vector3_1 { - let node_1554: string; - export { node_1554 as node }; - export namespace inputs_1554 { - let _in_549: string; - export { _in_549 as in }; - let index_24: string; - export { index_24 as index }; - } - export { inputs_1554 as inputs }; - export namespace outputs_1554 { - let out_1524: string; - export { out_1524 as out }; - } - export { outputs_1554 as outputs }; - } - export { ND_extract_vector3_1 as ND_extract_vector3 }; - export namespace ND_extract_vector4_1 { - let node_1555: string; - export { node_1555 as node }; - export namespace inputs_1555 { - let _in_550: string; - export { _in_550 as in }; - let index_25: string; - export { index_25 as index }; - } - export { inputs_1555 as inputs }; - export namespace outputs_1555 { - let out_1525: string; - export { out_1525 as out }; - } - export { outputs_1555 as outputs }; - } - export { ND_extract_vector4_1 as ND_extract_vector4 }; - export namespace ND_extract_matrix33_1 { - let node_1556: string; - export { node_1556 as node }; - export namespace inputs_1556 { - let _in_551: string; - export { _in_551 as in }; - let index_26: string; - export { index_26 as index }; - } - export { inputs_1556 as inputs }; - export namespace outputs_1556 { - let out_1526: string; - export { out_1526 as out }; - } - export { outputs_1556 as outputs }; - } - export { ND_extract_matrix33_1 as ND_extract_matrix33 }; - export namespace ND_extract_matrix44_1 { - let node_1557: string; - export { node_1557 as node }; - export namespace inputs_1557 { - let _in_552: string; - export { _in_552 as in }; - let index_27: string; - export { index_27 as index }; - } - export { inputs_1557 as inputs }; - export namespace outputs_1557 { - let out_1527: string; - export { out_1527 as out }; - } - export { outputs_1557 as outputs }; - } - export { ND_extract_matrix44_1 as ND_extract_matrix44 }; - export namespace ND_separate2_vector2_1 { - let node_1558: string; - export { node_1558 as node }; - export namespace inputs_1558 { - let _in_553: string; - export { _in_553 as in }; - } - export { inputs_1558 as inputs }; - export namespace outputs_1558 { - let outx_3: string; - export { outx_3 as outx }; - let outy_3: string; - export { outy_3 as outy }; - } - export { outputs_1558 as outputs }; - } - export { ND_separate2_vector2_1 as ND_separate2_vector2 }; - export namespace ND_separate3_color3_1 { - let node_1559: string; - export { node_1559 as node }; - export namespace inputs_1559 { - let _in_554: string; - export { _in_554 as in }; - } - export { inputs_1559 as inputs }; - export namespace outputs_1559 { - let outr_2: string; - export { outr_2 as outr }; - let outg_2: string; - export { outg_2 as outg }; - let outb_2: string; - export { outb_2 as outb }; - } - export { outputs_1559 as outputs }; - } - export { ND_separate3_color3_1 as ND_separate3_color3 }; - export namespace ND_separate3_vector3_1 { - let node_1560: string; - export { node_1560 as node }; - export namespace inputs_1560 { - let _in_555: string; - export { _in_555 as in }; - } - export { inputs_1560 as inputs }; - export namespace outputs_1560 { - let outx_4: string; - export { outx_4 as outx }; - let outy_4: string; - export { outy_4 as outy }; - let outz_2: string; - export { outz_2 as outz }; - } - export { outputs_1560 as outputs }; - } - export { ND_separate3_vector3_1 as ND_separate3_vector3 }; - export namespace ND_separate4_color4_1 { - let node_1561: string; - export { node_1561 as node }; - export namespace inputs_1561 { - let _in_556: string; - export { _in_556 as in }; - } - export { inputs_1561 as inputs }; - export namespace outputs_1561 { - let outr_3: string; - export { outr_3 as outr }; - let outg_3: string; - export { outg_3 as outg }; - let outb_3: string; - export { outb_3 as outb }; - let outa_3: string; - export { outa_3 as outa }; - } - export { outputs_1561 as outputs }; - } - export { ND_separate4_color4_1 as ND_separate4_color4 }; - export namespace ND_separate4_vector4_1 { - let node_1562: string; - export { node_1562 as node }; - export namespace inputs_1562 { - let _in_557: string; - export { _in_557 as in }; - } - export { inputs_1562 as inputs }; - export namespace outputs_1562 { - let outx_5: string; - export { outx_5 as outx }; - let outy_5: string; - export { outy_5 as outy }; - let outz_3: string; - export { outz_3 as outz }; - let outw_1: string; - export { outw_1 as outw }; - } - export { outputs_1562 as outputs }; - } - export { ND_separate4_vector4_1 as ND_separate4_vector4 }; - export namespace ND_blur_float_1 { - let node_1563: string; - export { node_1563 as node }; - export namespace inputs_1563 { - let _in_558: string; - export { _in_558 as in }; - let size_16: string; - export { size_16 as size }; - let filtertype_58: string; - export { filtertype_58 as filtertype }; - } - export { inputs_1563 as inputs }; - export namespace outputs_1563 { - let out_1528: string; - export { out_1528 as out }; - } - export { outputs_1563 as outputs }; - } - export { ND_blur_float_1 as ND_blur_float }; - export namespace ND_blur_color3_1 { - let node_1564: string; - export { node_1564 as node }; - export namespace inputs_1564 { - let _in_559: string; - export { _in_559 as in }; - let size_17: string; - export { size_17 as size }; - let filtertype_59: string; - export { filtertype_59 as filtertype }; - } - export { inputs_1564 as inputs }; - export namespace outputs_1564 { - let out_1529: string; - export { out_1529 as out }; - } - export { outputs_1564 as outputs }; - } - export { ND_blur_color3_1 as ND_blur_color3 }; - export namespace ND_blur_color4_1 { - let node_1565: string; - export { node_1565 as node }; - export namespace inputs_1565 { - let _in_560: string; - export { _in_560 as in }; - let size_18: string; - export { size_18 as size }; - let filtertype_60: string; - export { filtertype_60 as filtertype }; - } - export { inputs_1565 as inputs }; - export namespace outputs_1565 { - let out_1530: string; - export { out_1530 as out }; - } - export { outputs_1565 as outputs }; - } - export { ND_blur_color4_1 as ND_blur_color4 }; - export namespace ND_blur_vector2_1 { - let node_1566: string; - export { node_1566 as node }; - export namespace inputs_1566 { - let _in_561: string; - export { _in_561 as in }; - let size_19: string; - export { size_19 as size }; - let filtertype_61: string; - export { filtertype_61 as filtertype }; - } - export { inputs_1566 as inputs }; - export namespace outputs_1566 { - let out_1531: string; - export { out_1531 as out }; - } - export { outputs_1566 as outputs }; - } - export { ND_blur_vector2_1 as ND_blur_vector2 }; - export namespace ND_blur_vector3_1 { - let node_1567: string; - export { node_1567 as node }; - export namespace inputs_1567 { - let _in_562: string; - export { _in_562 as in }; - let size_20: string; - export { size_20 as size }; - let filtertype_62: string; - export { filtertype_62 as filtertype }; - } - export { inputs_1567 as inputs }; - export namespace outputs_1567 { - let out_1532: string; - export { out_1532 as out }; - } - export { outputs_1567 as outputs }; - } - export { ND_blur_vector3_1 as ND_blur_vector3 }; - export namespace ND_blur_vector4_1 { - let node_1568: string; - export { node_1568 as node }; - export namespace inputs_1568 { - let _in_563: string; - export { _in_563 as in }; - let size_21: string; - export { size_21 as size }; - let filtertype_63: string; - export { filtertype_63 as filtertype }; - } - export { inputs_1568 as inputs }; - export namespace outputs_1568 { - let out_1533: string; - export { out_1533 as out }; - } - export { outputs_1568 as outputs }; - } - export { ND_blur_vector4_1 as ND_blur_vector4 }; - export namespace ND_heighttonormal_vector3_1 { - let node_1569: string; - export { node_1569 as node }; - export namespace inputs_1569 { - let _in_564: string; - export { _in_564 as in }; - let scale_40: string; - export { scale_40 as scale }; - let texcoord_187: string; - export { texcoord_187 as texcoord }; - } - export { inputs_1569 as inputs }; - export namespace outputs_1569 { - let out_1534: string; - export { out_1534 as out }; - } - export { outputs_1569 as outputs }; - } - export { ND_heighttonormal_vector3_1 as ND_heighttonormal_vector3 }; - export namespace ND_logical_and_1 { - let node_1570: string; - export { node_1570 as node }; - export namespace inputs_1570 { - let in1_441: string; - export { in1_441 as in1 }; - let in2_441: string; - export { in2_441 as in2 }; - } - export { inputs_1570 as inputs }; - export namespace outputs_1570 { - let out_1535: string; - export { out_1535 as out }; - } - export { outputs_1570 as outputs }; - } - export { ND_logical_and_1 as ND_logical_and }; - export namespace ND_logical_or_1 { - let node_1571: string; - export { node_1571 as node }; - export namespace inputs_1571 { - let in1_442: string; - export { in1_442 as in1 }; - let in2_442: string; - export { in2_442 as in2 }; - } - export { inputs_1571 as inputs }; - export namespace outputs_1571 { - let out_1536: string; - export { out_1536 as out }; - } - export { outputs_1571 as outputs }; - } - export { ND_logical_or_1 as ND_logical_or }; - export namespace ND_logical_xor_1 { - let node_1572: string; - export { node_1572 as node }; - export namespace inputs_1572 { - let in1_443: string; - export { in1_443 as in1 }; - let in2_443: string; - export { in2_443 as in2 }; - } - export { inputs_1572 as inputs }; - export namespace outputs_1572 { - let out_1537: string; - export { out_1537 as out }; - } - export { outputs_1572 as outputs }; - } - export { ND_logical_xor_1 as ND_logical_xor }; - export namespace ND_logical_not_1 { - let node_1573: string; - export { node_1573 as node }; - export namespace inputs_1573 { - let _in_565: string; - export { _in_565 as in }; - } - export { inputs_1573 as inputs }; - export namespace outputs_1573 { - let out_1538: string; - export { out_1538 as out }; - } - export { outputs_1573 as outputs }; - } - export { ND_logical_not_1 as ND_logical_not }; - export namespace ND_dot_float_1 { - let node_1574: string; - export { node_1574 as node }; - export namespace inputs_1574 { - let _in_566: string; - export { _in_566 as in }; - let note_16: string; - export { note_16 as note }; - } - export { inputs_1574 as inputs }; - export namespace outputs_1574 { - let out_1539: string; - export { out_1539 as out }; - } - export { outputs_1574 as outputs }; - } - export { ND_dot_float_1 as ND_dot_float }; - export namespace ND_dot_color3_1 { - let node_1575: string; - export { node_1575 as node }; - export namespace inputs_1575 { - let _in_567: string; - export { _in_567 as in }; - let note_17: string; - export { note_17 as note }; - } - export { inputs_1575 as inputs }; - export namespace outputs_1575 { - let out_1540: string; - export { out_1540 as out }; - } - export { outputs_1575 as outputs }; - } - export { ND_dot_color3_1 as ND_dot_color3 }; - export namespace ND_dot_color4_1 { - let node_1576: string; - export { node_1576 as node }; - export namespace inputs_1576 { - let _in_568: string; - export { _in_568 as in }; - let note_18: string; - export { note_18 as note }; - } - export { inputs_1576 as inputs }; - export namespace outputs_1576 { - let out_1541: string; - export { out_1541 as out }; - } - export { outputs_1576 as outputs }; - } - export { ND_dot_color4_1 as ND_dot_color4 }; - export namespace ND_dot_vector2_1 { - let node_1577: string; - export { node_1577 as node }; - export namespace inputs_1577 { - let _in_569: string; - export { _in_569 as in }; - let note_19: string; - export { note_19 as note }; - } - export { inputs_1577 as inputs }; - export namespace outputs_1577 { - let out_1542: string; - export { out_1542 as out }; - } - export { outputs_1577 as outputs }; - } - export { ND_dot_vector2_1 as ND_dot_vector2 }; - export namespace ND_dot_vector3_1 { - let node_1578: string; - export { node_1578 as node }; - export namespace inputs_1578 { - let _in_570: string; - export { _in_570 as in }; - let note_20: string; - export { note_20 as note }; - } - export { inputs_1578 as inputs }; - export namespace outputs_1578 { - let out_1543: string; - export { out_1543 as out }; - } - export { outputs_1578 as outputs }; - } - export { ND_dot_vector3_1 as ND_dot_vector3 }; - export namespace ND_dot_vector4_1 { - let node_1579: string; - export { node_1579 as node }; - export namespace inputs_1579 { - let _in_571: string; - export { _in_571 as in }; - let note_21: string; - export { note_21 as note }; - } - export { inputs_1579 as inputs }; - export namespace outputs_1579 { - let out_1544: string; - export { out_1544 as out }; - } - export { outputs_1579 as outputs }; - } - export { ND_dot_vector4_1 as ND_dot_vector4 }; - export namespace ND_dot_boolean_1 { - let node_1580: string; - export { node_1580 as node }; - export namespace inputs_1580 { - let _in_572: string; - export { _in_572 as in }; - let note_22: string; - export { note_22 as note }; - } - export { inputs_1580 as inputs }; - export namespace outputs_1580 { - let out_1545: string; - export { out_1545 as out }; - } - export { outputs_1580 as outputs }; - } - export { ND_dot_boolean_1 as ND_dot_boolean }; - export namespace ND_dot_integer_1 { - let node_1581: string; - export { node_1581 as node }; - export namespace inputs_1581 { - let _in_573: string; - export { _in_573 as in }; - let note_23: string; - export { note_23 as note }; - } - export { inputs_1581 as inputs }; - export namespace outputs_1581 { - let out_1546: string; - export { out_1546 as out }; - } - export { outputs_1581 as outputs }; - } - export { ND_dot_integer_1 as ND_dot_integer }; - export namespace ND_dot_matrix33_1 { - let node_1582: string; - export { node_1582 as node }; - export namespace inputs_1582 { - let _in_574: string; - export { _in_574 as in }; - let note_24: string; - export { note_24 as note }; - } - export { inputs_1582 as inputs }; - export namespace outputs_1582 { - let out_1547: string; - export { out_1547 as out }; - } - export { outputs_1582 as outputs }; - } - export { ND_dot_matrix33_1 as ND_dot_matrix33 }; - export namespace ND_dot_matrix44_1 { - let node_1583: string; - export { node_1583 as node }; - export namespace inputs_1583 { - let _in_575: string; - export { _in_575 as in }; - let note_25: string; - export { note_25 as note }; - } - export { inputs_1583 as inputs }; - export namespace outputs_1583 { - let out_1548: string; - export { out_1548 as out }; - } - export { outputs_1583 as outputs }; - } - export { ND_dot_matrix44_1 as ND_dot_matrix44 }; - export namespace ND_dot_string_1 { - let node_1584: string; - export { node_1584 as node }; - export namespace inputs_1584 { - let _in_576: string; - export { _in_576 as in }; - let note_26: string; - export { note_26 as note }; - } - export { inputs_1584 as inputs }; - export namespace outputs_1584 { - let out_1549: string; - export { out_1549 as out }; - } - export { outputs_1584 as outputs }; - } - export { ND_dot_string_1 as ND_dot_string }; - export namespace ND_dot_filename_1 { - let node_1585: string; - export { node_1585 as node }; - export namespace inputs_1585 { - let _in_577: string; - export { _in_577 as in }; - let note_27: string; - export { note_27 as note }; - } - export { inputs_1585 as inputs }; - export namespace outputs_1585 { - let out_1550: string; - export { out_1550 as out }; - } - export { outputs_1585 as outputs }; - } - export { ND_dot_filename_1 as ND_dot_filename }; - export namespace ND_dot_surfaceshader_1 { - let node_1586: string; - export { node_1586 as node }; - export namespace inputs_1586 { - let _in_578: string; - export { _in_578 as in }; - let note_28: string; - export { note_28 as note }; - } - export { inputs_1586 as inputs }; - export namespace outputs_1586 { - let out_1551: string; - export { out_1551 as out }; - } - export { outputs_1586 as outputs }; - } - export { ND_dot_surfaceshader_1 as ND_dot_surfaceshader }; - export namespace ND_dot_displacementshader_1 { - let node_1587: string; - export { node_1587 as node }; - export namespace inputs_1587 { - let _in_579: string; - export { _in_579 as in }; - let note_29: string; - export { note_29 as note }; - } - export { inputs_1587 as inputs }; - export namespace outputs_1587 { - let out_1552: string; - export { out_1552 as out }; - } - export { outputs_1587 as outputs }; - } - export { ND_dot_displacementshader_1 as ND_dot_displacementshader }; - export namespace ND_dot_volumeshader_1 { - let node_1588: string; - export { node_1588 as node }; - export namespace inputs_1588 { - let _in_580: string; - export { _in_580 as in }; - let note_30: string; - export { note_30 as note }; - } - export { inputs_1588 as inputs }; - export namespace outputs_1588 { - let out_1553: string; - export { out_1553 as out }; - } - export { outputs_1588 as outputs }; - } - export { ND_dot_volumeshader_1 as ND_dot_volumeshader }; - export namespace ND_dot_lightshader_1 { - let node_1589: string; - export { node_1589 as node }; - export namespace inputs_1589 { - let _in_581: string; - export { _in_581 as in }; - let note_31: string; - export { note_31 as note }; - } - export { inputs_1589 as inputs }; - export namespace outputs_1589 { - let out_1554: string; - export { out_1554 as out }; - } - export { outputs_1589 as outputs }; - } - export { ND_dot_lightshader_1 as ND_dot_lightshader }; - export namespace ND_point_light_1 { - let node_1590: string; - export { node_1590 as node }; - export namespace inputs_1590 { - let position_70: string; - export { position_70 as position }; - let color_28: string; - export { color_28 as color }; - let intensity_5: string; - export { intensity_5 as intensity }; - let decay_rate_2: string; - export { decay_rate_2 as decay_rate }; - } - export { inputs_1590 as inputs }; - export namespace outputs_1590 { - let out_1555: string; - export { out_1555 as out }; - } - export { outputs_1590 as outputs }; - } - export { ND_point_light_1 as ND_point_light }; - export namespace ND_directional_light_1 { - let node_1591: string; - export { node_1591 as node }; - export namespace inputs_1591 { - let direction_3: string; - export { direction_3 as direction }; - let color_29: string; - export { color_29 as color }; - let intensity_6: string; - export { intensity_6 as intensity }; - } - export { inputs_1591 as inputs }; - export namespace outputs_1591 { - let out_1556: string; - export { out_1556 as out }; - } - export { outputs_1591 as outputs }; - } - export { ND_directional_light_1 as ND_directional_light }; - export namespace ND_spot_light_1 { - let node_1592: string; - export { node_1592 as node }; - export namespace inputs_1592 { - let position_71: string; - export { position_71 as position }; - let direction_4: string; - export { direction_4 as direction }; - let color_30: string; - export { color_30 as color }; - let intensity_7: string; - export { intensity_7 as intensity }; - let decay_rate_3: string; - export { decay_rate_3 as decay_rate }; - let inner_angle_3: string; - export { inner_angle_3 as inner_angle }; - let outer_angle_3: string; - export { outer_angle_3 as outer_angle }; - } - export { inputs_1592 as inputs }; - export namespace outputs_1592 { - let out_1557: string; - export { out_1557 as out }; - } - export { outputs_1592 as outputs }; - } - export { ND_spot_light_1 as ND_spot_light }; - export namespace ND_open_pbr_surface_to_standard_surface_1 { - let node_1593: string; - export { node_1593 as node }; - export namespace inputs_1593 { - let base_weight_3: string; - export { base_weight_3 as base_weight }; - let base_color_12: string; - export { base_color_12 as base_color }; - let base_diffuse_roughness_3: string; - export { base_diffuse_roughness_3 as base_diffuse_roughness }; - let base_metalness_3: string; - export { base_metalness_3 as base_metalness }; - let specular_weight_3: string; - export { specular_weight_3 as specular_weight }; - let specular_color_11: string; - export { specular_color_11 as specular_color }; - let specular_roughness_9: string; - export { specular_roughness_9 as specular_roughness }; - let specular_ior_3: string; - export { specular_ior_3 as specular_ior }; - let specular_roughness_anisotropy_3: string; - export { specular_roughness_anisotropy_3 as specular_roughness_anisotropy }; - let transmission_weight_3: string; - export { transmission_weight_3 as transmission_weight }; - let transmission_color_10: string; - export { transmission_color_10 as transmission_color }; - let transmission_depth_8: string; - export { transmission_depth_8 as transmission_depth }; - let transmission_scatter_7: string; - export { transmission_scatter_7 as transmission_scatter }; - let transmission_scatter_anisotropy_7: string; - export { transmission_scatter_anisotropy_7 as transmission_scatter_anisotropy }; - let transmission_dispersion_scale_3: string; - export { transmission_dispersion_scale_3 as transmission_dispersion_scale }; - let subsurface_weight_3: string; - export { subsurface_weight_3 as subsurface_weight }; - let subsurface_color_8: string; - export { subsurface_color_8 as subsurface_color }; - let subsurface_radius_7: string; - export { subsurface_radius_7 as subsurface_radius }; - let subsurface_radius_scale_3: string; - export { subsurface_radius_scale_3 as subsurface_radius_scale }; - let subsurface_scatter_anisotropy_3: string; - export { subsurface_scatter_anisotropy_3 as subsurface_scatter_anisotropy }; - let fuzz_weight_3: string; - export { fuzz_weight_3 as fuzz_weight }; - let fuzz_color_3: string; - export { fuzz_color_3 as fuzz_color }; - let fuzz_roughness_3: string; - export { fuzz_roughness_3 as fuzz_roughness }; - let coat_weight_3: string; - export { coat_weight_3 as coat_weight }; - let coat_color_9: string; - export { coat_color_9 as coat_color }; - let coat_roughness_9: string; - export { coat_roughness_9 as coat_roughness }; - let coat_roughness_anisotropy_3: string; - export { coat_roughness_anisotropy_3 as coat_roughness_anisotropy }; - let coat_ior_3: string; - export { coat_ior_3 as coat_ior }; - let coat_darkening_3: string; - export { coat_darkening_3 as coat_darkening }; - let thin_film_weight_3: string; - export { thin_film_weight_3 as thin_film_weight }; - let thin_film_thickness_7: string; - export { thin_film_thickness_7 as thin_film_thickness }; - let thin_film_ior_3: string; - export { thin_film_ior_3 as thin_film_ior }; - let emission_luminance_3: string; - export { emission_luminance_3 as emission_luminance }; - let emission_color_11: string; - export { emission_color_11 as emission_color }; - let geometry_opacity_3: string; - export { geometry_opacity_3 as geometry_opacity }; - let geometry_thin_walled_3: string; - export { geometry_thin_walled_3 as geometry_thin_walled }; - } - export { inputs_1593 as inputs }; - export namespace outputs_1593 { - let base_out_1: string; - export { base_out_1 as base_out }; - let base_color_out_3: string; - export { base_color_out_3 as base_color_out }; - let diffuse_roughness_out_1: string; - export { diffuse_roughness_out_1 as diffuse_roughness_out }; - let metalness_out_1: string; - export { metalness_out_1 as metalness_out }; - let specular_out_2: string; - export { specular_out_2 as specular_out }; - let specular_color_out_3: string; - export { specular_color_out_3 as specular_color_out }; - let specular_roughness_out_2: string; - export { specular_roughness_out_2 as specular_roughness_out }; - let specular_IOR_out_1: string; - export { specular_IOR_out_1 as specular_IOR_out }; - let specular_anisotropy_out_1: string; - export { specular_anisotropy_out_1 as specular_anisotropy_out }; - let transmission_out_2: string; - export { transmission_out_2 as transmission_out }; - let transmission_color_out_2: string; - export { transmission_color_out_2 as transmission_color_out }; - let transmission_depth_out_2: string; - export { transmission_depth_out_2 as transmission_depth_out }; - let transmission_scatter_out_2: string; - export { transmission_scatter_out_2 as transmission_scatter_out }; - let transmission_scatter_anisotropy_out_2: string; - export { transmission_scatter_anisotropy_out_2 as transmission_scatter_anisotropy_out }; - let transmission_dispersion_out_1: string; - export { transmission_dispersion_out_1 as transmission_dispersion_out }; - let subsurface_out_1: string; - export { subsurface_out_1 as subsurface_out }; - let subsurface_color_out_2: string; - export { subsurface_color_out_2 as subsurface_color_out }; - let subsurface_radius_out_2: string; - export { subsurface_radius_out_2 as subsurface_radius_out }; - let subsurface_scale_out_1: string; - export { subsurface_scale_out_1 as subsurface_scale_out }; - let subsurface_anisotropy_out_1: string; - export { subsurface_anisotropy_out_1 as subsurface_anisotropy_out }; - let sheen_out_1: string; - export { sheen_out_1 as sheen_out }; - let sheen_color_out_2: string; - export { sheen_color_out_2 as sheen_color_out }; - let sheen_roughness_out_2: string; - export { sheen_roughness_out_2 as sheen_roughness_out }; - let coat_out_1: string; - export { coat_out_1 as coat_out }; - let coat_color_out_2: string; - export { coat_color_out_2 as coat_color_out }; - let coat_roughness_out_2: string; - export { coat_roughness_out_2 as coat_roughness_out }; - let coat_anisotropy_out_1: string; - export { coat_anisotropy_out_1 as coat_anisotropy_out }; - let coat_IOR_out_1: string; - export { coat_IOR_out_1 as coat_IOR_out }; - let coat_affect_roughness_out_1: string; - export { coat_affect_roughness_out_1 as coat_affect_roughness_out }; - let thin_film_thickness_out_2: string; - export { thin_film_thickness_out_2 as thin_film_thickness_out }; - let thin_film_IOR_out_1: string; - export { thin_film_IOR_out_1 as thin_film_IOR_out }; - let emission_out_1: string; - export { emission_out_1 as emission_out }; - let emission_color_out_2: string; - export { emission_color_out_2 as emission_color_out }; - let opacity_out_2: string; - export { opacity_out_2 as opacity_out }; - let thin_walled_out_1: string; - export { thin_walled_out_1 as thin_walled_out }; - } - export { outputs_1593 as outputs }; - } - export { ND_open_pbr_surface_to_standard_surface_1 as ND_open_pbr_surface_to_standard_surface }; - export namespace ND_standard_surface_to_open_pbr_surface_1 { - let node_1594: string; - export { node_1594 as node }; - export namespace inputs_1594 { - let base_13: string; - export { base_13 as base }; - let base_color_13: string; - export { base_color_13 as base_color }; - let diffuse_roughness_4: string; - export { diffuse_roughness_4 as diffuse_roughness }; - let metalness_6: string; - export { metalness_6 as metalness }; - let specular_10: string; - export { specular_10 as specular }; - let specular_color_12: string; - export { specular_color_12 as specular_color }; - let specular_roughness_10: string; - export { specular_roughness_10 as specular_roughness }; - let specular_IOR_6: string; - export { specular_IOR_6 as specular_IOR }; - let specular_anisotropy_5: string; - export { specular_anisotropy_5 as specular_anisotropy }; - let transmission_9: string; - export { transmission_9 as transmission }; - let transmission_color_11: string; - export { transmission_color_11 as transmission_color }; - let transmission_depth_9: string; - export { transmission_depth_9 as transmission_depth }; - let transmission_scatter_8: string; - export { transmission_scatter_8 as transmission_scatter }; - let transmission_scatter_anisotropy_8: string; - export { transmission_scatter_anisotropy_8 as transmission_scatter_anisotropy }; - let transmission_dispersion_5: string; - export { transmission_dispersion_5 as transmission_dispersion }; - let subsurface_7: string; - export { subsurface_7 as subsurface }; - let subsurface_color_9: string; - export { subsurface_color_9 as subsurface_color }; - let subsurface_radius_8: string; - export { subsurface_radius_8 as subsurface_radius }; - let subsurface_scale_4: string; - export { subsurface_scale_4 as subsurface_scale }; - let subsurface_anisotropy_4: string; - export { subsurface_anisotropy_4 as subsurface_anisotropy }; - let sheen_7: string; - export { sheen_7 as sheen }; - let sheen_color_7: string; - export { sheen_color_7 as sheen_color }; - let sheen_roughness_7: string; - export { sheen_roughness_7 as sheen_roughness }; - let coat_6: string; - export { coat_6 as coat }; - let coat_color_10: string; - export { coat_color_10 as coat_color }; - let coat_roughness_10: string; - export { coat_roughness_10 as coat_roughness }; - let coat_anisotropy_4: string; - export { coat_anisotropy_4 as coat_anisotropy }; - let coat_IOR_4: string; - export { coat_IOR_4 as coat_IOR }; - let coat_affect_roughness_4: string; - export { coat_affect_roughness_4 as coat_affect_roughness }; - let thin_film_thickness_8: string; - export { thin_film_thickness_8 as thin_film_thickness }; - let thin_film_IOR_4: string; - export { thin_film_IOR_4 as thin_film_IOR }; - let emission_8: string; - export { emission_8 as emission }; - let emission_color_12: string; - export { emission_color_12 as emission_color }; - let opacity_12: string; - export { opacity_12 as opacity }; - let thin_walled_7: string; - export { thin_walled_7 as thin_walled }; - } - export { inputs_1594 as inputs }; - export namespace outputs_1594 { - let base_weight_out_1: string; - export { base_weight_out_1 as base_weight_out }; - let base_color_out_4: string; - export { base_color_out_4 as base_color_out }; - let base_diffuse_roughness_out_1: string; - export { base_diffuse_roughness_out_1 as base_diffuse_roughness_out }; - let base_metalness_out_1: string; - export { base_metalness_out_1 as base_metalness_out }; - let specular_weight_out_1: string; - export { specular_weight_out_1 as specular_weight_out }; - let specular_color_out_4: string; - export { specular_color_out_4 as specular_color_out }; - let specular_roughness_out_3: string; - export { specular_roughness_out_3 as specular_roughness_out }; - let specular_ior_out_1: string; - export { specular_ior_out_1 as specular_ior_out }; - let specular_roughness_anisotropy_out_1: string; - export { specular_roughness_anisotropy_out_1 as specular_roughness_anisotropy_out }; - let transmission_weight_out_1: string; - export { transmission_weight_out_1 as transmission_weight_out }; - let transmission_color_out_3: string; - export { transmission_color_out_3 as transmission_color_out }; - let transmission_depth_out_3: string; - export { transmission_depth_out_3 as transmission_depth_out }; - let transmission_scatter_out_3: string; - export { transmission_scatter_out_3 as transmission_scatter_out }; - let transmission_scatter_anisotropy_out_3: string; - export { transmission_scatter_anisotropy_out_3 as transmission_scatter_anisotropy_out }; - let transmission_dispersion_scale_out_1: string; - export { transmission_dispersion_scale_out_1 as transmission_dispersion_scale_out }; - let subsurface_weight_out_1: string; - export { subsurface_weight_out_1 as subsurface_weight_out }; - let subsurface_color_out_3: string; - export { subsurface_color_out_3 as subsurface_color_out }; - let subsurface_radius_out_3: string; - export { subsurface_radius_out_3 as subsurface_radius_out }; - let subsurface_radius_scale_out_1: string; - export { subsurface_radius_scale_out_1 as subsurface_radius_scale_out }; - let subsurface_scatter_anisotropy_out_1: string; - export { subsurface_scatter_anisotropy_out_1 as subsurface_scatter_anisotropy_out }; - let fuzz_weight_out_1: string; - export { fuzz_weight_out_1 as fuzz_weight_out }; - let fuzz_color_out_1: string; - export { fuzz_color_out_1 as fuzz_color_out }; - let fuzz_roughness_out_1: string; - export { fuzz_roughness_out_1 as fuzz_roughness_out }; - let coat_weight_out_1: string; - export { coat_weight_out_1 as coat_weight_out }; - let coat_color_out_3: string; - export { coat_color_out_3 as coat_color_out }; - let coat_roughness_out_3: string; - export { coat_roughness_out_3 as coat_roughness_out }; - let coat_roughness_anisotropy_out_1: string; - export { coat_roughness_anisotropy_out_1 as coat_roughness_anisotropy_out }; - let coat_ior_out_1: string; - export { coat_ior_out_1 as coat_ior_out }; - let coat_darkening_out_1: string; - export { coat_darkening_out_1 as coat_darkening_out }; - let thin_film_weight_out_1: string; - export { thin_film_weight_out_1 as thin_film_weight_out }; - let thin_film_thickness_out_3: string; - export { thin_film_thickness_out_3 as thin_film_thickness_out }; - let thin_film_ior_out_1: string; - export { thin_film_ior_out_1 as thin_film_ior_out }; - let emission_luminance_out_1: string; - export { emission_luminance_out_1 as emission_luminance_out }; - let emission_color_out_3: string; - export { emission_color_out_3 as emission_color_out }; - let geometry_opacity_out_1: string; - export { geometry_opacity_out_1 as geometry_opacity_out }; - let geometry_thin_walled_out_1: string; - export { geometry_thin_walled_out_1 as geometry_thin_walled_out }; - } - export { outputs_1594 as outputs }; - } - export { ND_standard_surface_to_open_pbr_surface_1 as ND_standard_surface_to_open_pbr_surface }; - export namespace ND_standard_surface_to_UsdPreviewSurface_1 { - let node_1595: string; - export { node_1595 as node }; - export namespace inputs_1595 { - let metalness_7: string; - export { metalness_7 as metalness }; - let base_14: string; - export { base_14 as base }; - let base_color_14: string; - export { base_color_14 as base_color }; - let specular_11: string; - export { specular_11 as specular }; - let specular_color_13: string; - export { specular_color_13 as specular_color }; - let specular_IOR_7: string; - export { specular_IOR_7 as specular_IOR }; - let specular_roughness_11: string; - export { specular_roughness_11 as specular_roughness }; - let coat_7: string; - export { coat_7 as coat }; - let coat_color_11: string; - export { coat_color_11 as coat_color }; - let coat_roughness_11: string; - export { coat_roughness_11 as coat_roughness }; - let subsurface_8: string; - export { subsurface_8 as subsurface }; - let subsurface_color_10: string; - export { subsurface_color_10 as subsurface_color }; - let emission_9: string; - export { emission_9 as emission }; - let emission_color_13: string; - export { emission_color_13 as emission_color }; - let opacity_13: string; - export { opacity_13 as opacity }; - let normal_68: string; - export { normal_68 as normal }; - } - export { inputs_1595 as inputs }; - export namespace outputs_1595 { - let diffuseColor_out_1: string; - export { diffuseColor_out_1 as diffuseColor_out }; - let emissiveColor_out_1: string; - export { emissiveColor_out_1 as emissiveColor_out }; - let metallic_out_2: string; - export { metallic_out_2 as metallic_out }; - let roughness_out_2: string; - export { roughness_out_2 as roughness_out }; - let clearcoat_out_2: string; - export { clearcoat_out_2 as clearcoat_out }; - let clearcoatRoughness_out_1: string; - export { clearcoatRoughness_out_1 as clearcoatRoughness_out }; - let opacity_out_3: string; - export { opacity_out_3 as opacity_out }; - let ior_out_2: string; - export { ior_out_2 as ior_out }; - let normal_out_2: string; - export { normal_out_2 as normal_out }; - } - export { outputs_1595 as outputs }; - } - export { ND_standard_surface_to_UsdPreviewSurface_1 as ND_standard_surface_to_UsdPreviewSurface }; - export namespace ND_standard_surface_to_gltf_pbr_1 { - let node_1596: string; - export { node_1596 as node }; - export namespace inputs_1596 { - let base_15: string; - export { base_15 as base }; - let base_color_15: string; - export { base_color_15 as base_color }; - let metalness_8: string; - export { metalness_8 as metalness }; - let specular_12: string; - export { specular_12 as specular }; - let specular_color_14: string; - export { specular_color_14 as specular_color }; - let specular_anisotropy_6: string; - export { specular_anisotropy_6 as specular_anisotropy }; - let specular_rotation_4: string; - export { specular_rotation_4 as specular_rotation }; - let specular_roughness_12: string; - export { specular_roughness_12 as specular_roughness }; - let specular_IOR_8: string; - export { specular_IOR_8 as specular_IOR }; - let transmission_10: string; - export { transmission_10 as transmission }; - let transmission_color_12: string; - export { transmission_color_12 as transmission_color }; - let transmission_depth_10: string; - export { transmission_depth_10 as transmission_depth }; - let transmission_dispersion_6: string; - export { transmission_dispersion_6 as transmission_dispersion }; - let sheen_8: string; - export { sheen_8 as sheen }; - let sheen_color_8: string; - export { sheen_color_8 as sheen_color }; - let sheen_roughness_8: string; - export { sheen_roughness_8 as sheen_roughness }; - let coat_8: string; - export { coat_8 as coat }; - let coat_color_12: string; - export { coat_color_12 as coat_color }; - let coat_roughness_12: string; - export { coat_roughness_12 as coat_roughness }; - let emission_10: string; - export { emission_10 as emission }; - let emission_color_14: string; - export { emission_color_14 as emission_color }; - let normal_69: string; - export { normal_69 as normal }; - let tangent_24: string; - export { tangent_24 as tangent }; - let opacity_14: string; - export { opacity_14 as opacity }; - let thin_walled_8: string; - export { thin_walled_8 as thin_walled }; - } - export { inputs_1596 as inputs }; - export namespace outputs_1596 { - let base_color_out_5: string; - export { base_color_out_5 as base_color_out }; - let metallic_out_3: string; - export { metallic_out_3 as metallic_out }; - let roughness_out_3: string; - export { roughness_out_3 as roughness_out }; - let specular_out_3: string; - export { specular_out_3 as specular_out }; - let specular_color_out_5: string; - export { specular_color_out_5 as specular_color_out }; - let ior_out_3: string; - export { ior_out_3 as ior_out }; - let anisotropy_strength_out_3: string; - export { anisotropy_strength_out_3 as anisotropy_strength_out }; - let anisotropy_rotation_out_3: string; - export { anisotropy_rotation_out_3 as anisotropy_rotation_out }; - let transmission_out_3: string; - export { transmission_out_3 as transmission_out }; - let thickness_out_1: string; - export { thickness_out_1 as thickness_out }; - let attenuation_color_out_1: string; - export { attenuation_color_out_1 as attenuation_color_out }; - let attenuation_distance_out_1: string; - export { attenuation_distance_out_1 as attenuation_distance_out }; - let sheen_color_out_3: string; - export { sheen_color_out_3 as sheen_color_out }; - let sheen_roughness_out_3: string; - export { sheen_roughness_out_3 as sheen_roughness_out }; - let clearcoat_out_3: string; - export { clearcoat_out_3 as clearcoat_out }; - let clearcoat_roughness_out_1: string; - export { clearcoat_roughness_out_1 as clearcoat_roughness_out }; - let dispersion_out_1: string; - export { dispersion_out_1 as dispersion_out }; - let emissive_out_1: string; - export { emissive_out_1 as emissive_out }; - let emissive_strength_out_1: string; - export { emissive_strength_out_1 as emissive_strength_out }; - let normal_out_3: string; - export { normal_out_3 as normal_out }; - let tangent_out_1: string; - export { tangent_out_1 as tangent_out }; - let alpha_out_1: string; - export { alpha_out_1 as alpha_out }; - let alpha_mode_out_1: string; - export { alpha_mode_out_1 as alpha_mode_out }; - } - export { outputs_1596 as outputs }; - } - export { ND_standard_surface_to_gltf_pbr_1 as ND_standard_surface_to_gltf_pbr }; - export namespace ND_lama_sheen_1 { - let node_1597: string; - export { node_1597 as node }; - export namespace inputs_1597 { - let color_31: string; - export { color_31 as color }; - let roughness_35: string; - export { roughness_35 as roughness }; - let normal_70: string; - export { normal_70 as normal }; - } - export { inputs_1597 as inputs }; - export namespace outputs_1597 { - let out_1558: string; - export { out_1558 as out }; - } - export { outputs_1597 as outputs }; - } - export { ND_lama_sheen_1 as ND_lama_sheen }; - export namespace ND_lama_sss_1 { - let node_1598: string; - export { node_1598 as node }; - export namespace inputs_1598 { - let color_32: string; - export { color_32 as color }; - let normal_71: string; - export { normal_71 as normal }; - let sssRadius_1: string; - export { sssRadius_1 as sssRadius }; - let sssScale_1: string; - export { sssScale_1 as sssScale }; - let sssMode_1: string; - export { sssMode_1 as sssMode }; - let sssIOR_1: string; - export { sssIOR_1 as sssIOR }; - let sssAnisotropy_1: string; - export { sssAnisotropy_1 as sssAnisotropy }; - let sssBleed_1: string; - export { sssBleed_1 as sssBleed }; - let sssFollowTopology_1: string; - export { sssFollowTopology_1 as sssFollowTopology }; - let sssSubset_1: string; - export { sssSubset_1 as sssSubset }; - let sssContinuationRays_1: string; - export { sssContinuationRays_1 as sssContinuationRays }; - let sssUnitLength_1: string; - export { sssUnitLength_1 as sssUnitLength }; - let mode_3: string; - export { mode_3 as mode }; - let albedoInversionMethod_1: string; - export { albedoInversionMethod_1 as albedoInversionMethod }; - } - export { inputs_1598 as inputs }; - export namespace outputs_1598 { - let out_1559: string; - export { out_1559 as out }; - } - export { outputs_1598 as outputs }; - } - export { ND_lama_sss_1 as ND_lama_sss }; - export namespace ND_lama_dielectric_1 { - let node_1599: string; - export { node_1599 as node }; - export namespace inputs_1599 { - let reflectionTint_2: string; - export { reflectionTint_2 as reflectionTint }; - let transmissionTint_2: string; - export { transmissionTint_2 as transmissionTint }; - let fresnelMode_3: string; - export { fresnelMode_3 as fresnelMode }; - let IOR_3: string; - export { IOR_3 as IOR }; - let reflectivity_5: string; - export { reflectivity_5 as reflectivity }; - let roughness_36: string; - export { roughness_36 as roughness }; - let normal_72: string; - export { normal_72 as normal }; - let anisotropy_14: string; - export { anisotropy_14 as anisotropy }; - let direction_5: string; - export { direction_5 as direction }; - let rotation_11: string; - export { rotation_11 as rotation }; - let absorptionColor_2: string; - export { absorptionColor_2 as absorptionColor }; - let absorptionRadius_2: string; - export { absorptionRadius_2 as absorptionRadius }; - let scatterColor_2: string; - export { scatterColor_2 as scatterColor }; - let scatterAnisotropy_2: string; - export { scatterAnisotropy_2 as scatterAnisotropy }; - } - export { inputs_1599 as inputs }; - export namespace outputs_1599 { - let out_1560: string; - export { out_1560 as out }; - } - export { outputs_1599 as outputs }; - } - export { ND_lama_dielectric_1 as ND_lama_dielectric }; - export namespace ND_lama_iridescence_1 { - let node_1600: string; - export { node_1600 as node }; - export namespace inputs_1600 { - let roughness_37: string; - export { roughness_37 as roughness }; - let anisotropy_15: string; - export { anisotropy_15 as anisotropy }; - let anisotropyDirection_3: string; - export { anisotropyDirection_3 as anisotropyDirection }; - let anisotropyRotation_3: string; - export { anisotropyRotation_3 as anisotropyRotation }; - let relativeFilmThickness_1: string; - export { relativeFilmThickness_1 as relativeFilmThickness }; - let minFilmThickness_1: string; - export { minFilmThickness_1 as minFilmThickness }; - let maxFilmThickness_1: string; - export { maxFilmThickness_1 as maxFilmThickness }; - let filmIOR_1: string; - export { filmIOR_1 as filmIOR }; - } - export { inputs_1600 as inputs }; - export namespace outputs_1600 { - let out_1561: string; - export { out_1561 as out }; - } - export { outputs_1600 as outputs }; - } - export { ND_lama_iridescence_1 as ND_lama_iridescence }; - export namespace ND_lama_diffuse_1 { - let node_1601: string; - export { node_1601 as node }; - export namespace inputs_1601 { - let color_33: string; - export { color_33 as color }; - let roughness_38: string; - export { roughness_38 as roughness }; - let normal_73: string; - export { normal_73 as normal }; - let energyCompensation_2: string; - export { energyCompensation_2 as energyCompensation }; - } - export { inputs_1601 as inputs }; - export namespace outputs_1601 { - let out_1562: string; - export { out_1562 as out }; - } - export { outputs_1601 as outputs }; - } - export { ND_lama_diffuse_1 as ND_lama_diffuse }; - export namespace ND_lama_mix_bsdf_1 { - let node_1602: string; - export { node_1602 as node }; - export namespace inputs_1602 { - let material1_4: string; - export { material1_4 as material1 }; - let material2_4: string; - export { material2_4 as material2 }; - let mix_90: string; - export { mix_90 as mix }; - } - export { inputs_1602 as inputs }; - export namespace outputs_1602 { - let out_1563: string; - export { out_1563 as out }; - } - export { outputs_1602 as outputs }; - } - export { ND_lama_mix_bsdf_1 as ND_lama_mix_bsdf }; - export namespace ND_lama_mix_edf_1 { - let node_1603: string; - export { node_1603 as node }; - export namespace inputs_1603 { - let material1_5: string; - export { material1_5 as material1 }; - let material2_5: string; - export { material2_5 as material2 }; - let mix_91: string; - export { mix_91 as mix }; - } - export { inputs_1603 as inputs }; - export namespace outputs_1603 { - let out_1564: string; - export { out_1564 as out }; - } - export { outputs_1603 as outputs }; - } - export { ND_lama_mix_edf_1 as ND_lama_mix_edf }; - export namespace ND_lama_add_bsdf_1 { - let node_1604: string; - export { node_1604 as node }; - export namespace inputs_1604 { - let material1_6: string; - export { material1_6 as material1 }; - let material2_6: string; - export { material2_6 as material2 }; - let weight1_2: string; - export { weight1_2 as weight1 }; - let weight2_2: string; - export { weight2_2 as weight2 }; - } - export { inputs_1604 as inputs }; - export namespace outputs_1604 { - let out_1565: string; - export { out_1565 as out }; - } - export { outputs_1604 as outputs }; - } - export { ND_lama_add_bsdf_1 as ND_lama_add_bsdf }; - export namespace ND_lama_add_edf_1 { - let node_1605: string; - export { node_1605 as node }; - export namespace inputs_1605 { - let material1_7: string; - export { material1_7 as material1 }; - let material2_7: string; - export { material2_7 as material2 }; - let weight1_3: string; - export { weight1_3 as weight1 }; - let weight2_3: string; - export { weight2_3 as weight2 }; - } - export { inputs_1605 as inputs }; - export namespace outputs_1605 { - let out_1566: string; - export { out_1566 as out }; - } - export { outputs_1605 as outputs }; - } - export { ND_lama_add_edf_1 as ND_lama_add_edf }; - export namespace ND_lama_conductor_1 { - let node_1606: string; - export { node_1606 as node }; - export namespace inputs_1606 { - let tint_3: string; - export { tint_3 as tint }; - let fresnelMode_4: string; - export { fresnelMode_4 as fresnelMode }; - let IOR_4: string; - export { IOR_4 as IOR }; - let extinction_5: string; - export { extinction_5 as extinction }; - let reflectivity_6: string; - export { reflectivity_6 as reflectivity }; - let edgeColor_1: string; - export { edgeColor_1 as edgeColor }; - let roughness_39: string; - export { roughness_39 as roughness }; - let normal_74: string; - export { normal_74 as normal }; - let anisotropy_16: string; - export { anisotropy_16 as anisotropy }; - let anisotropyDirection_4: string; - export { anisotropyDirection_4 as anisotropyDirection }; - let anisotropyRotation_4: string; - export { anisotropyRotation_4 as anisotropyRotation }; - } - export { inputs_1606 as inputs }; - export namespace outputs_1606 { - let out_1567: string; - export { out_1567 as out }; - } - export { outputs_1606 as outputs }; - } - export { ND_lama_conductor_1 as ND_lama_conductor }; - export namespace ND_lama_emission_1 { - let node_1607: string; - export { node_1607 as node }; - export namespace inputs_1607 { - let color_34: string; - export { color_34 as color }; - } - export { inputs_1607 as inputs }; - export namespace outputs_1607 { - let out_1568: string; - export { out_1568 as out }; - } - export { outputs_1607 as outputs }; - } - export { ND_lama_emission_1 as ND_lama_emission }; - export namespace ND_lama_surface_1 { - let node_1608: string; - export { node_1608 as node }; - export namespace inputs_1608 { - let materialFront_1: string; - export { materialFront_1 as materialFront }; - let materialBack_1: string; - export { materialBack_1 as materialBack }; - let presence_5: string; - export { presence_5 as presence }; - } - export { inputs_1608 as inputs }; - export namespace outputs_1608 { - let out_1569: string; - export { out_1569 as out }; - } - export { outputs_1608 as outputs }; - } - export { ND_lama_surface_1 as ND_lama_surface }; - export namespace ND_lama_generalized_schlick_1 { - let node_1609: string; - export { node_1609 as node }; - export namespace inputs_1609 { - let reflectionTint_3: string; - export { reflectionTint_3 as reflectionTint }; - let transmissionTint_3: string; - export { transmissionTint_3 as transmissionTint }; - let fresnelMode_5: string; - export { fresnelMode_5 as fresnelMode }; - let IOR_5: string; - export { IOR_5 as IOR }; - let reflectivity_7: string; - export { reflectivity_7 as reflectivity }; - let reflectivity90_1: string; - export { reflectivity90_1 as reflectivity90 }; - let reflectivityProfile_1: string; - export { reflectivityProfile_1 as reflectivityProfile }; - let roughness_40: string; - export { roughness_40 as roughness }; - let normal_75: string; - export { normal_75 as normal }; - let anisotropy_17: string; - export { anisotropy_17 as anisotropy }; - let anisotropyDirection_5: string; - export { anisotropyDirection_5 as anisotropyDirection }; - let anisotropyRotation_5: string; - export { anisotropyRotation_5 as anisotropyRotation }; - let absorptionColor_3: string; - export { absorptionColor_3 as absorptionColor }; - let absorptionRadius_3: string; - export { absorptionRadius_3 as absorptionRadius }; - let scatterColor_3: string; - export { scatterColor_3 as scatterColor }; - let scatterAnisotropy_3: string; - export { scatterAnisotropy_3 as scatterAnisotropy }; - } - export { inputs_1609 as inputs }; - export namespace outputs_1609 { - let out_1570: string; - export { out_1570 as out }; - } - export { outputs_1609 as outputs }; - } - export { ND_lama_generalized_schlick_1 as ND_lama_generalized_schlick }; - export namespace ND_lama_translucent_1 { - let node_1610: string; - export { node_1610 as node }; - export namespace inputs_1610 { - let color_35: string; - export { color_35 as color }; - let roughness_41: string; - export { roughness_41 as roughness }; - let normal_76: string; - export { normal_76 as normal }; - let energyCompensation_3: string; - export { energyCompensation_3 as energyCompensation }; - } - export { inputs_1610 as inputs }; - export namespace outputs_1610 { - let out_1571: string; - export { out_1571 as out }; - } - export { outputs_1610 as outputs }; - } - export { ND_lama_translucent_1 as ND_lama_translucent }; - export namespace ND_lama_layer_bsdf_1 { - let node_1611: string; - export { node_1611 as node }; - export namespace inputs_1611 { - let materialTop_1: string; - export { materialTop_1 as materialTop }; - let materialBase_1: string; - export { materialBase_1 as materialBase }; - let topMix_1: string; - export { topMix_1 as topMix }; - let topThickness_1: string; - export { topThickness_1 as topThickness }; - } - export { inputs_1611 as inputs }; - export namespace outputs_1611 { - let out_1572: string; - export { out_1572 as out }; - } - export { outputs_1611 as outputs }; - } - export { ND_lama_layer_bsdf_1 as ND_lama_layer_bsdf }; - } - namespace byNode { - export let oren_nayar_diffuse_bsdf: string[]; - export let burley_diffuse_bsdf: string[]; - export let translucent_bsdf: string[]; - export let dielectric_bsdf: string[]; - export let conductor_bsdf: string[]; - export let generalized_schlick_bsdf: string[]; - export let subsurface_bsdf: string[]; - export let sheen_bsdf: string[]; - export let chiang_hair_bsdf: string[]; - export let uniform_edf: string[]; - export let conical_edf: string[]; - export let measured_edf: string[]; - export let generalized_schlick_edf: string[]; - export let absorption_vdf: string[]; - export let anisotropic_vdf: string[]; - export let surface: string[]; - export let volume: string[]; - export let light: string[]; - let displacement_6: string[]; - export { displacement_6 as displacement }; - let layer_12: string[]; - export { layer_12 as layer }; - let mix_92: string[]; - export { mix_92 as mix }; - export let add: string[]; - export let multiply: string[]; - export let roughness_anisotropy: string[]; - export let roughness_dual: string[]; - export let glossiness_anisotropy: string[]; - export let blackbody: string[]; - export let artistic_ior: string[]; - export let deon_hair_absorption_from_melanin: string[]; - export let chiang_hair_absorption_from_color: string[]; - export let chiang_hair_roughness: string[]; - export let disney_principled: string[]; - export let open_pbr_surface: string[]; - export let open_pbr_anisotropy: string[]; - export let UsdPreviewSurface: string[]; - export let UsdUVTexture: string[]; - export let UsdPrimvarReader: string[]; - export let UsdTransform2d: string[]; - export let standard_surface: string[]; - export let gltf_pbr: string[]; - export let gltf_colorimage: string[]; - export let gltf_image: string[]; - export let gltf_normalmap: string[]; - export let gltf_iridescence_thickness: string[]; - export let gltf_anisotropy_image: string[]; - let viewdirection_2: string[]; - export { viewdirection_2 as viewdirection }; - export let facingratio: string[]; - export let gooch_shade: string[]; - export let g18_rec709_to_lin_rec709: string[]; - export let g22_rec709_to_lin_rec709: string[]; - export let rec709_display_to_lin_rec709: string[]; - export let acescg_to_lin_rec709: string[]; - export let g22_ap1_to_lin_rec709: string[]; - export let srgb_texture_to_lin_rec709: string[]; - export let lin_adobergb_to_lin_rec709: string[]; - export let adobergb_to_lin_rec709: string[]; - export let srgb_displayp3_to_lin_rec709: string[]; - export let lin_displayp3_to_lin_rec709: string[]; - export let surfacematerial: string[]; - export let volumematerial: string[]; - export let surface_unlit: string[]; - export let image: string[]; - export let tiledimage: string[]; - export let latlongimage: string[]; - export let hextiledimage: string[]; - export let triplanarprojection: string[]; - export let constant: string[]; - export let ramp: string[]; - export let ramp_gradient: string[]; - export let ramplr: string[]; - export let ramptb: string[]; - export let ramp4: string[]; - export let splitlr: string[]; - export let splittb: string[]; - export let noise2d: string[]; - export let noise3d: string[]; - export let fractal2d: string[]; - export let fractal3d: string[]; - export let cellnoise2d: string[]; - export let cellnoise3d: string[]; - export let worleynoise2d: string[]; - export let worleynoise3d: string[]; - export let unifiednoise2d: string[]; - export let unifiednoise3d: string[]; - export let flake2d: string[]; - export let flake3d: string[]; - export let randomfloat: string[]; - export let randomcolor: string[]; - export let checkerboard: string[]; - export let line: string[]; - export let circle: string[]; - export let cloverleaf: string[]; - export let hexagon: string[]; - export let grid: string[]; - export let crosshatch: string[]; - export let tiledcircles: string[]; - export let tiledcloverleafs: string[]; - export let tiledhexagons: string[]; - let position_72: string[]; - export { position_72 as position }; - let normal_77: string[]; - export { normal_77 as normal }; - let tangent_25: string[]; - export { tangent_25 as tangent }; - let bitangent_12: string[]; - export { bitangent_12 as bitangent }; - let texcoord_188: string[]; - export { texcoord_188 as texcoord }; - let geomcolor_2: string[]; - export { geomcolor_2 as geomcolor }; - export let geompropvalue: string[]; - export let geompropvalueuniform: string[]; - export let bump: string[]; - export let frame: string[]; - export let time: string[]; - export let subtract: string[]; - export let divide: string[]; - export let modulo: string[]; - export let fract: string[]; - let invert_2: string[]; - export { invert_2 as invert }; - export let absval: string[]; - export let floor: string[]; - export let ceil: string[]; - export let round: string[]; - export let power: string[]; - export let safepower: string[]; - export let sin: string[]; - export let cos: string[]; - export let tan: string[]; - export let asin: string[]; - export let acos: string[]; - export let atan2: string[]; - export let sqrt: string[]; - export let ln: string[]; - export let exp: string[]; - export let sign: string[]; - export let clamp: string[]; - let min_4: string[]; - export { min_4 as min }; - let max_4: string[]; - export { max_4 as max }; - export let normalize: string[]; - export let magnitude: string[]; - export let distance: string[]; - export let dotproduct: string[]; - export let crossproduct: string[]; - export let transformpoint: string[]; - export let transformvector: string[]; - export let transformnormal: string[]; - export let transformmatrix: string[]; - export let normalmap: string[]; - export let hextilednormalmap: string[]; - export let transpose: string[]; - export let determinant: string[]; - export let invertmatrix: string[]; - export let rotate2d: string[]; - export let rotate3d: string[]; - export let place2d: string[]; - export let trianglewave: string[]; - export let reflect: string[]; - export let refract: string[]; - export let remap: string[]; - export let smoothstep: string[]; - export let luminance: string[]; - export let rgbtohsv: string[]; - export let hsvtorgb: string[]; - let contrast_4: string[]; - export { contrast_4 as contrast }; - export let range: string[]; - export let hsvadjust: string[]; - export let saturate: string[]; - export let colorcorrect: string[]; - export let premult: string[]; - export let unpremult: string[]; - export let plus: string[]; - export let minus: string[]; - export let difference: string[]; - export let burn: string[]; - export let dodge: string[]; - export let screen: string[]; - export let overlay: string[]; - export let disjointover: string[]; - let _in_582: string[]; - export { _in_582 as in }; - let mask_12: string[]; - export { mask_12 as mask }; - export let matte: string[]; - let out_1573: string[]; - export { out_1573 as out }; - export let over: string[]; - export let inside: string[]; - export let outside: string[]; - export let ifgreater: string[]; - export let ifgreatereq: string[]; - export let ifequal: string[]; - let _switch: string[]; - export { _switch as switch }; - export let convert: string[]; - export let combine2: string[]; - export let combine3: string[]; - export let combine4: string[]; - export let creatematrix: string[]; - export let extract: string[]; - export let separate2: string[]; - export let separate3: string[]; - export let separate4: string[]; - export let blur: string[]; - export let heighttonormal: string[]; - export let and: string[]; - export let or: string[]; - export let xor: string[]; - export let not: string[]; - export let dot: string[]; - export let point_light: string[]; - export let directional_light: string[]; - export let spot_light: string[]; - export let open_pbr_surface_to_standard_surface: string[]; - export let standard_surface_to_open_pbr_surface: string[]; - export let standard_surface_to_UsdPreviewSurface: string[]; - export let standard_surface_to_gltf_pbr: string[]; - export let LamaSheen: string[]; - export let LamaSSS: string[]; - export let LamaDielectric: string[]; - export let LamaIridescence: string[]; - export let LamaDiffuse: string[]; - export let LamaMix: string[]; - export let LamaAdd: string[]; - export let LamaConductor: string[]; - export let LamaEmission: string[]; - export let LamaSurface: string[]; - export let LamaGeneralizedSchlick: string[]; - export let LamaTranslucent: string[]; - export let LamaLayer: string[]; - } -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts deleted file mode 100644 index 1cfdb7798..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXNodeLibrary.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const MtlXLibrary: any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts deleted file mode 100644 index e5538624b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export namespace MaterialXSurfaceMappings { - export { applyStandardSurface as standard_surface }; - export { applyGltfPbrSurface as gltf_pbr }; - export { applyOpenPbrSurface as open_pbr_surface }; -} -export const surfaceMapperRegistry: Map; -export function getSurfaceMapper(category: any): { - category: string; - apply: typeof applyStandardSurface | typeof applyGltfPbrSurface | typeof applyOpenPbrSurface; -} | undefined; -export function getSupportedSurfaceCategories(): string[]; -export function applyStandardSurface(material: any, inputs: any, log: any, nodeName: any): void; -export function applyGltfPbrSurface(material: any, inputs: any, log: any, nodeName: any): void; -export function applyOpenPbrSurface(material: any, inputs: any, log: any, nodeName: any): void; -export const mappedStandardSurfaceInputs: Set; -export const mappedGltfPbrInputs: Set; -export const mappedOpenPbrInputs: Set; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts deleted file mode 100644 index 221cf1eb2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/MaterialXUtils.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function getComponentCountForType(type: any): 2 | 3 | 4; -export function isBooleanNode(node: any): any; -export function normalizeSpaceName(value: any, fallback?: string): string; -export function toBooleanNode(node: any): any; -export function toVec3Channels(input: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts deleted file mode 100644 index 79aeef441..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function createMaterialXCompileRegistry(): Map; -export function compileNodeFromRegistry(nodeX: any, out: any, compileContext: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts deleted file mode 100644 index 7f139c8c3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/materialx/parse/MaterialXParser.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function parseMaterialXNodeTree(nodeXML: any, createNode: any, addNode: any, nodePath?: string): any; -export function parseMaterialXText(text: any, createNode: any, addNode: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts deleted file mode 100644 index fae9e0192..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDAParser.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export class USDAParser { - parseText(text: any): {}; - _preprocess(text: any): string; - _stripBlockComments(text: any): string; - _collapseTripleQuotedStrings(text: any): string; - _stripInlineComment(line: any): any; - _findAssignmentOperator(line: any): number; - /** - * Parse USDA text and return raw spec data in specsByPath format. - * Used by USDComposer for unified scene composition. - */ - parseData(text: any): { - specsByPath: { - '/': { - specType: number; - fields: { - upAxis: any; - defaultPrim: any; - metersPerUnit: number; - framesPerSecond: number; - timeCodesPerSecond: number; - }; - }; - }; - }; - _inferSkelElementSize(specsByPath: any): void; - _inferElementSize(attrSpec: any, numVertices: any): void; - _extractPrimData(data: any, path: any, primFields: any, specsByPath: any, SpecType: any): void; - _parseAttributeValue(valueType: any, rawValue: any): any; - _parseString(str: any): string; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts deleted file mode 100644 index 546010819..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDCParser.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -export class USDCParser { - /** - * Parse USDC file and return raw spec data without building Three.js scene. - * Used by USDComposer for unified scene composition. - */ - parseData(buffer: any): { - specsByPath: {}; - }; - buffer: any; - reader: BinaryReader | undefined; - version: { - major: number; - minor: number; - patch: number; - } | undefined; - _conversionBuffer: ArrayBuffer | undefined; - _conversionView: DataView | undefined; - specsByPath: {} | undefined; - _readBootstrap(): void; - tocOffset: number | undefined; - _readTOC(): void; - sections: {} | undefined; - _readTokens(): void; - tokens: any[] | undefined; - _readStrings(): void; - strings: any[] | undefined; - _readFields(): void; - fields: any[] | undefined; - _readFieldSets(): void; - fieldSets: any[] | undefined; - _readPaths(): void; - paths: any[] | undefined; - _readPathsRecursive(parentPath: any, depth?: number): void; - _buildPathsFromCompressed(pathIndices: any, elementTokenIndices: any, jumps: any): void; - _readSpecs(): void; - specs: any[] | undefined; - _readValue(valueRep: any): any; - _readInlinedValue(valueRep: any): any; - _readTimeSamples(valueRep: any): { - times: any; - values: any[]; - }; - _readScalarValue(type: any): any; - _readArrayValue(valueRep: any): any[] | Uint32Array | Float64Array | Float32Array | Int32Array; - _readCompressedArray(type: any, size: any): never[] | Float32Array | Int32Array; - _readHalf(): number; - _halfToFloat(h: any): number; - _getFieldsForSpec(spec: any): {}; -} -declare class BinaryReader { - constructor(buffer: any); - buffer: any; - view: DataView; - offset: number; - seek(offset: any): void; - tell(): number; - readUint8(): number; - readInt8(): number; - readUint16(): number; - readInt16(): number; - readUint32(): number; - readInt32(): number; - readUint64(): number; - readInt64(): number; - readFloat32(): number; - readFloat64(): number; - readBytes(length: any): Uint8Array; - readString(length: any): string; -} -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts deleted file mode 100644 index 87c5cbf83..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/loaders/usd/USDComposer.d.ts +++ /dev/null @@ -1,238 +0,0 @@ -/** - * USDComposer handles scene composition from parsed USD data. - * This includes reference resolution, variant selection, transform handling, - * and building the Three.js scene graph. - * - * Works with specsByPath format from USDCParser. - */ -export class USDComposer { - constructor(manager?: null); - textureCache: {}; - skinnedMeshes: any[]; - manager: any; - texturePromises: any[]; - /** - * Compose a Three.js scene from parsed USD data. - * @param {Object} parsedData - Data from USDCParser or USDAParser - * @param {Object} assets - Dictionary of referenced assets (specsByPath or blob URLs) - * @param {Object} variantSelections - External variant selections - * @param {string} basePath - Base path for resolving relative references - * @returns {Group} Three.js scene graph - */ - compose(parsedData: Object, assets?: Object, variantSelections?: Object, basePath?: string): Group; - specsByPath: any; - assets: Object | undefined; - externalVariantSelections: Object | undefined; - basePath: string | undefined; - skeletons: {} | undefined; - fps: any; - /** - * Apply USD transforms to a Three.js object. - * Handles xformOpOrder with proper matrix composition. - * USD uses row-vector convention, Three.js uses column-vector. - */ - applyTransform(obj: any, fields: any, attrs?: {}): void; - /** - * Build indexes for efficient lookups. - * Called once during compose() to avoid O(n) scans per lookup. - */ - _buildIndexes(): void; - childrenByPath: Map | undefined; - attributesByPrimPath: Map | undefined; - materialsByRoot: Map | undefined; - shadersByMaterialPath: Map | undefined; - geomSubsetsByMeshPath: Map | undefined; - /** - * Check if a path is a direct child of parentPath. - */ - _isDirectChild(parentPath: any, path: any, prefix: any): boolean; - /** - * Build the scene hierarchy recursively. - * Uses childrenByPath index for O(1) child lookup instead of O(n) iteration. - */ - _buildHierarchy(parent: any, parentPath: any): void; - /** - * Get variant paths for a parent path based on variant selections. - */ - _getVariantPaths(parentPath: any): any[]; - /** - * Resolve a file path relative to basePath. - */ - _resolveFilePath(refPath: any): any; - /** - * Resolve a USD reference and return the composed content. - * @param {string} refValue - Reference value like "@./path/to/file.usdc@" - * @param {Object} localVariants - Variant selections to apply - * @returns {Group|null} Composed content or null - */ - _resolveReference(refValue: string, localVariants?: Object): Group | null; - /** - * Find a single mesh in the group's shallow hierarchy. - * Only returns a mesh if it's at depth 0 or 1, not deeply nested. - * This preserves transforms in complex hierarchies like Kitchen Set - * while supporting USDZExporter round-trip (Xform > Xform > Mesh pattern). - */ - _findSingleMesh(group: any): any; - /** - * Check if an object has a non-identity local transform. - */ - _hasNonIdentityTransform(obj: any): boolean; - /** - * Get the base path (directory) from a file path. - */ - _getBasePath(filePath: any): any; - /** - * Extract variant selections from a spec's fields. - */ - _getLocalVariantSelections(fields: any): {}; - /** - * Get all reference values from a prim spec. - * @returns {string[]} Array of reference strings like "@path@" or "@path@" - */ - _getReferences(spec: any): string[]; - /** - * Resolve an attribute's authored value, following connections before using - * local fallback values. - */ - _resolveAttributeValue(path: any, visited?: Set): any; - /** - * Get attributes for a path from attribute specs. - */ - _getAttributes(path: any): {}; - _collectAttributesFromPath(path: any, attrs: any): void; - /** - * Build a mesh from a USD geometric primitive (Cube, Sphere, Cylinder, Cone, Capsule). - */ - _buildGeomPrimitive(path: any, spec: any, typeName: any): Mesh; - /** - * Build a mesh from a Mesh spec. - */ - _buildMesh(path: any, spec: any): Mesh | SkinnedMesh; - /** - * Build a camera from a Camera spec. - */ - _buildCamera(path: any): PerspectiveCamera | OrthographicCamera; - /** - * Build a light from a UsdLux light spec. - */ - _buildLight(path: any, typeName: any): SpotLight | PointLight | DirectionalLight | RectAreaLight | undefined; - /** - * Convert a color temperature in Kelvin to an RGB Color. - * Based on Tanner Helland's algorithm. - */ - _colorTemperature(kelvin: any): Color; - _parseNumber(value: any, fallback: any): any; - _getGeomSubsets(meshPath: any): any[]; - /** - * Get the material binding relationship for a prim, including overrides from - * active variants. - */ - _getMaterialBindingSpec(primPath: any): any; - /** - * Get the resolved material binding target for a prim. Material bindings are - * inherited, and an ancestor marked strongerThanDescendants takes precedence - * over bindings authored on its descendants. - */ - _getMaterialBindingTarget(primPath: any): any; - _buildGeometry(path: any, fields: any, hasSkinning?: boolean): BufferGeometry; - _buildGeometryWithSubsets(fields: any, geomSubsets: any, hasSkinning?: boolean): BufferGeometry; - _selectTopWeights(srcIndices: any, srcWeights: any, elementSize: any, numVertices: any, dstIndices: any, dstWeights: any): void; - _findUVPrimvar(fields: any): { - uvs: any; - uvIndices: any; - }; - _findUV2Primvar(fields: any): { - uvs2: any; - uv2Indices: any; - }; - _buildHoleMap(polygonHoles: any): { - parentToHoles: Map; - holeFaces: Set; - }; - _triangulateIndicesWithPattern(indices: any, counts: any, points?: null, holeMap?: null): { - indices: any[]; - pattern: any[]; - }; - _applyTriangulationPattern(indices: any, pattern: any): any[]; - _triangulateNGon(faceIndices: any, points: any): any[][]; - _triangulateNGonWithHoles(outerIndices: any, holeContours: any, points: any): any[][]; - _triangulateIndices(indices: any, counts: any): any[]; - _expandAttribute(data: any, indices: any, itemSize: any): any[]; - /** - * Compute per-vertex normals from indexed triangle data. - * Accumulates area-weighted face normals at each shared vertex and normalizes. - */ - _computeVertexNormals(points: any, indices: any): Float32Array; - /** - * Get the material path for a mesh, checking various binding sources. - */ - _getMaterialPath(meshPath: any, fields: any): any; - _buildMaterial(meshPath: any, fields: any): MeshPhysicalMaterial; - _buildMaterialForPath(materialPath: any): MeshPhysicalMaterial; - /** - * Apply material binding from a prim path to a mesh. - * Used when merging referenced geometry into a prim that has material binding. - */ - _applyMaterialBinding(mesh: any, primPath: any): void; - _pickBestMaterial(materialPaths: any): any; - _applyMaterial(material: any, materialPath: any): void; - /** - * Shared helper for applying texture or value from shader attribute. - * Reduces duplication between _applyPreviewSurface and _applyOpenPBRSurface. - */ - _applyTextureOrValue(material: any, shaderPath: any, fields: any, attrName: any, textureProperty: any, colorSpace: any, valueCallback: any, textureGetter: any): boolean; - _applyPreviewSurface(material: any, shaderPath: any): void; - _applyOpenPBRSurface(material: any, shaderPath: any): void; - _getTextureFromOpenPBRConnection(connPath: any): any; - _loadTextureFromPath(filePath: any): any; - _getTextureFromConnection(connPath: any): any; - _applyTextureTransforms(texture: any, attrs: any): void; - _loadTexture(filePath: any, textureAttrs: any, transformAttrs: any): Texture | null; - _createTextureFromData(data: any, textureAttrs: any, transformAttrs: any): Texture | null; - _getWrapMode(wrapValue: any): number; - _buildSkeleton(path: any): { - skeleton: Skeleton; - joints: any; - rootBones: Bone[]; - animationPath: any; - path: any; - } | null; - _bindSkeletons(): void; - _buildAnimations(): AnimationClip[]; - _buildTransformAnimations(): (QuaternionKeyframeTrack | VectorKeyframeTrack)[]; - _buildAnimationClip(path: any): AnimationClip | null; - _getTimeSampledAttribute(primPath: any, attrName: any): any; - _flattenMatrixArray(matrices: any, numMatrices: any): any; -} -export namespace SpecType { - let Unknown: number; - let Attribute: number; - let Connection: number; - let Expression: number; - let Mapper: number; - let MapperArg: number; - let Prim: number; - let PseudoRoot: number; - let Relationship: number; - let RelationshipTarget: number; - let Variant: number; - let VariantSet: number; -} -import { Group } from 'three'; -import { Mesh } from 'three'; -import { SkinnedMesh } from 'three'; -import { PerspectiveCamera } from 'three'; -import { OrthographicCamera } from 'three'; -import { SpotLight } from 'three'; -import { PointLight } from 'three'; -import { DirectionalLight } from 'three'; -import { RectAreaLight } from 'three'; -import { Color } from 'three'; -import { BufferGeometry } from 'three'; -import { MeshPhysicalMaterial } from 'three'; -import { Texture } from 'three'; -import { Skeleton } from 'three'; -import { Bone } from 'three'; -import { AnimationClip } from 'three'; -import { QuaternionKeyframeTrack } from 'three'; -import { VectorKeyframeTrack } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts deleted file mode 100644 index d0c825fab..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineMaterial.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A special line material for meshes loaded via {@link LDrawLoader}. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * import the class from `LDrawConditionalLineNodeMaterial.js`. - * - * @augments ShaderMaterial - * @three_import import { LDrawConditionalLineMaterial } from 'three/addons/materials/LDrawConditionalLineMaterial.js'; - */ -export class LDrawConditionalLineMaterial extends ShaderMaterial { - static get type(): string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLDrawConditionalLineMaterial: boolean; -} -import { ShaderMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts deleted file mode 100644 index 2115b2f70..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/materials/LDrawConditionalLineNodeMaterial.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * A special line material for meshes loaded via {@link LDrawLoader}. - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * import the class from `LDrawConditionalLineMaterial.js`. - * - * @augments NodeMaterial - * @three_import import { LDrawConditionalLineMaterial } from 'three/addons/materials/LDrawConditionalLineMaterial.js'; - */ -export class LDrawConditionalLineMaterial extends NodeMaterial { - /** - * Constructs a new conditional line material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - vertexNode: void; - fragmentNode: void; - _diffuseUniform: import("three/webgpu").UniformNode; - _opacityUniform: import("three/webgpu").UniformNode; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLDrawConditionalLineMaterial: boolean; -} -import { NodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts b/jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts deleted file mode 100644 index ce5f59442..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/materials/WoodNodeMaterial.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export function GetWoodPreset(genus: any, finish: any): any; -export const WoodGenuses: string[]; -export const Finishes: string[]; -/** - * Procedural wood material using TSL (Three.js Shading Language). - * - * Usage examples: - * - * // Using presets (recommended for common wood types) - * const material = WoodNodeMaterial.fromPreset('walnut', 'gloss'); - * - * // Using custom parameters (for advanced customization) - * const material = new WoodNodeMaterial({ - * centerSize: 1.2, - * ringThickness: 1/40, - * darkGrainColor: new THREE.Color('#2a1a0a'), - * lightGrainColor: new THREE.Color('#8b4513'), - * clearcoat: 1, - * clearcoatRoughness: 0.3 - * }); - * - * // Mixing presets with custom overrides - * const walnutParams = GetWoodPreset('walnut', 'raw'); - * const material = new WoodNodeMaterial({ - * ...walnutParams, - * ringThickness: 1/50, // Override specific parameter - * clearcoat: 1 // Add finish - * }); - */ -export class WoodNodeMaterial extends THREE.MeshPhysicalMaterial { - static get type(): string; - static fromPreset(genus?: string, finish?: string): WoodNodeMaterial; - constructor(params?: {}); - isWoodNodeMaterial: boolean; - colorNode: any; - clearcoatNode: any; -} -import * as THREE from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts deleted file mode 100644 index 8eac33066..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/Capsule.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * A capsule is essentially a cylinder with hemispherical caps at both ends. - * It can be thought of as a swept sphere, where a sphere is moved along a line segment. - * - * Capsules are often used as bounding volumes (next to AABBs and bounding spheres). - * - * @three_import import { Capsule } from 'three/addons/math/Capsule.js'; - */ -export class Capsule { - /** - * Constructs a new capsule. - * - * @param {Vector3} [start] - The start vector. - * @param {Vector3} [end] - The end vector. - * @param {number} [radius=1] - The capsule's radius. - */ - constructor(start?: Vector3, end?: Vector3, radius?: number); - /** - * The start vector. - * - * @type {Vector3} - */ - start: Vector3; - /** - * The end vector. - * - * @type {Vector3} - */ - end: Vector3; - /** - * The capsule's radius. - * - * @type {number} - * @default 1 - */ - radius: number; - /** - * Returns a new capsule with copied values from this instance. - * - * @return {Capsule} A clone of this instance. - */ - clone(): Capsule; - /** - * Sets the capsule components to the given values. - * Please note that this method only copies the values from the given objects. - * - * @param {Vector3} start - The start vector. - * @param {Vector3} end - The end vector - * @param {number} radius - The capsule's radius. - * @return {Capsule} A reference to this capsule. - */ - set(start: Vector3, end: Vector3, radius: number): Capsule; - /** - * Copies the values of the given capsule to this instance. - * - * @param {Capsule} capsule - The capsule to copy. - * @return {Capsule} A reference to this capsule. - */ - copy(capsule: Capsule): Capsule; - /** - * Returns the center point of this capsule. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The center point. - */ - getCenter(target: Vector3): Vector3; - /** - * Adds the given offset to this capsule, effectively moving it in 3D space. - * - * @param {Vector3} v - The offset that should be used to translate the capsule. - * @return {Capsule} A reference to this capsule. - */ - translate(v: Vector3): Capsule; - /** - * Returns `true` if the given bounding box intersects with this capsule. - * - * @param {Box3} box - The bounding box to test. - * @return {boolean} Whether the given bounding box intersects with this capsule. - */ - intersectsBox(box: Box3): boolean; -} -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts deleted file mode 100644 index a730f9728..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/ColorConverter.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * A utility class with helper functions for color conversion. - * - * @hideconstructor - * @three_import import { ColorConverter } from 'three/addons/math/ColorConverter.js'; - */ -export class ColorConverter { - /** - * Sets the given HSV color definition to the given color object. - * - * @param {Color} color - The color to set. - * @param {number} h - The hue. - * @param {number} s - The saturation. - * @param {number} v - The value. - * @return {Color} The update color. - */ - static setHSV(color: Color, h: number, s: number, v: number): Color; - /** - * Returns a HSV color representation of the given color object. - * - * @param {Color} color - The color to get HSV values from. - * @param {{h:number,s:number,v:number}} target - The target object that is used to store the method's result. - * @return {{h:number,s:number,v:number}} The HSV color. - */ - static getHSV(color: Color, target: { - h: number; - s: number; - v: number; - }): { - h: number; - s: number; - v: number; - }; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts deleted file mode 100644 index e7c282d5b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/ColorSpaces.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Display-P3 color space. - * - * @type {string} - * @constant - */ -export const DisplayP3ColorSpace: string; -/** - * Display-P3-Linear color space. - * - * @type {string} - * @constant - */ -export const LinearDisplayP3ColorSpace: string; -/** - * Implementation object for the Display-P3 color space. - * - * @type {module:ColorSpaces~ColorSpaceImpl} - * @constant - */ -export const DisplayP3ColorSpaceImpl: any; -/** - * Implementation object for the Display-P3-Linear color space. - * - * @type {module:ColorSpaces~ColorSpaceImpl} - * @constant - */ -export const LinearDisplayP3ColorSpaceImpl: any; -/** - * Rec2020-Linear color space. - * - * @type {string} - * @constant - */ -export const LinearRec2020ColorSpace: string; -/** - * Implementation object for the Rec2020-Linear color space. - * - * @type {module:ColorSpaces~ColorSpaceImpl} - * @constant - */ -export const LinearRec2020ColorSpaceImpl: any; -/** - * Extended-sRGB color space. - * - * @type {string} - * @constant - */ -export const ExtendedSRGBColorSpace: string; -/** - * Implementation object for the Extended-sRGB color space. - * - * @type {module:ColorSpaces~ColorSpaceImpl} - * @constant - */ -export const ExtendedSRGBColorSpaceImpl: any; -/** - * :ColorSpaces~ColorSpaceImpl - */ -export type module = { - /** - * - The primaries. - */ - primaries: Array; - /** - * - The white point. - */ - whitePoint: Array; - /** - * - A color space conversion matrix, converting to CIE XYZ. - */ - toXYZ: Matrix3; - /** - * - A color space conversion matrix, converting from CIE XYZ. - */ - fromXYZ: Matrix3; - /** - * - The luminance coefficients. - */ - luminanceCoefficients: Array; - /** - * - The working color space config. - */ - workingColorSpaceConfig?: { - unpackColorSpace: string; - } | undefined; - /** - * - The drawing buffer color space config. - */ - outputColorSpaceConfig?: { - drawingBufferColorSpace: string; - } | undefined; -}; -import { Matrix3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts deleted file mode 100644 index ca53b31bc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/ConvexHull.d.ts +++ /dev/null @@ -1,533 +0,0 @@ -/** - * Can be used to compute the convex hull in 3D space for a given set of points. It - * is primarily intended for {@link ConvexGeometry}. - * - * This Quickhull 3D implementation is a port of [quickhull3d](https://github.com/maurizzzio/quickhull3d/) - * by Mauricio Poppe. - * - * @three_import import { ConvexHull } from 'three/addons/math/ConvexHull.js'; - */ -export class ConvexHull { - tolerance: number; - faces: any[]; - newFaces: any[]; - assigned: VertexList; - unassigned: VertexList; - vertices: any[]; - /** - * Computes to convex hull for the given array of points. - * - * @param {Array} points - The array of points in 3D space. - * @return {ConvexHull} A reference to this convex hull. - */ - setFromPoints(points: Array): ConvexHull; - /** - * Computes the convex hull of the given 3D object (including its descendants), - * accounting for the world transforms of both the 3D object and its descendants. - * - * @param {Object3D} object - The 3D object to compute the convex hull for. - * @return {ConvexHull} A reference to this convex hull. - */ - setFromObject(object: Object3D): ConvexHull; - /** - * Returns `true` if the given point lies in the convex hull. - * - * @param {Vector3} point - The point to test. - * @return {boolean} Whether the given point lies in the convex hull or not. - */ - containsPoint(point: Vector3): boolean; - /** - * Computes the intersections point of the given ray and this convex hull. - * - * @param {Ray} ray - The ray to test. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The intersection point. Returns `null` if not intersection was detected. - */ - intersectRay(ray: Ray, target: Vector3): Vector3 | null; - /** - * Returns `true` if the given ray intersects with this convex hull. - * - * @param {Ray} ray - The ray to test. - * @return {boolean} Whether the given ray intersects with this convex hull or not. - */ - intersectsRay(ray: Ray): boolean; - /** - * Makes the convex hull empty. - * - * @return {ConvexHull} A reference to this convex hull. - */ - makeEmpty(): ConvexHull; - /** - * Adds a vertex to the 'assigned' list of vertices and assigns it to the given face. - * - * @private - * @param {VertexNode} vertex - The vertex to add. - * @param {Face} face - The target face. - * @return {ConvexHull} A reference to this convex hull. - */ - private _addVertexToFace; - /** - * Removes a vertex from the 'assigned' list of vertices and from the given face. - * It also makes sure that the link from 'face' to the first vertex it sees in 'assigned' - * is linked correctly after the removal. - * - * @private - * @param {VertexNode} vertex - The vertex to remove. - * @param {Face} face - The target face. - * @return {ConvexHull} A reference to this convex hull. - */ - private _removeVertexFromFace; - /** - * Removes all the visible vertices that a given face is able to see which are stored in - * the 'assigned' vertex list. - * - * @private - * @param {Face} face - The target face. - * @return {VertexNode|undefined} A reference to this convex hull. - */ - private _removeAllVerticesFromFace; - /** - * Removes all the visible vertices that `face` is able to see. - * - * - If `absorbingFace` doesn't exist, then all the removed vertices will be added to the 'unassigned' vertex list. - * - If `absorbingFace` exists, then this method will assign all the vertices of 'face' that can see 'absorbingFace'. - * - If a vertex cannot see `absorbingFace`, it's added to the 'unassigned' vertex list. - * - * @private - * @param {Face} face - The given face. - * @param {Face} [absorbingFace] - An optional face that tries to absorb the vertices of the first face. - * @return {ConvexHull} A reference to this convex hull. - */ - private _deleteFaceVertices; - /** - * Reassigns as many vertices as possible from the unassigned list to the new faces. - * - * @private - * @param {Array} newFaces - The new faces. - * @return {ConvexHull} A reference to this convex hull. - */ - private _resolveUnassignedPoints; - /** - * Computes the extremes values (min/max vectors) which will be used to - * compute the initial hull. - * - * @private - * @return {Object} The extremes. - */ - private _computeExtremes; - /** - * Computes the initial simplex assigning to its faces all the points that are - * candidates to form part of the hull. - * - * @private - * @return {ConvexHull} A reference to this convex hull. - */ - private _computeInitialHull; - /** - * Removes inactive (e.g. deleted) faces from the internal face list. - * - * @private - * @return {ConvexHull} A reference to this convex hull. - */ - private _reindexFaces; - /** - * Finds the next vertex to create faces with the current hull. - * - * - Let the initial face be the first face existing in the 'assigned' vertex list. - * - If a face doesn't exist then return since there're no vertices left. - * - Otherwise for each vertex that face sees find the one furthest away from it. - * - * @private - * @return {?VertexNode} The next vertex to add. - */ - private _nextVertexToAdd; - /** - * Computes a chain of half edges in CCW order called the 'horizon'. For an edge - * to be part of the horizon it must join a face that can see 'eyePoint' and a face - * that cannot see 'eyePoint'. - * - * @private - * @param {Vector3} eyePoint - The 3D-coordinates of a point. - * @param {HalfEdge} crossEdge - The edge used to jump to the current face. - * @param {Face} face - The current face being tested. - * @param {Array} horizon - The edges that form part of the horizon in CCW order. - * @return {ConvexHull} A reference to this convex hull. - */ - private _computeHorizon; - /** - * Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' - * in CCW order. All the half edges are created in CCW order thus the face is always pointing - * outside the hull. - * - * @private - * @param {VertexNode} eyeVertex - The vertex that is added to the hull. - * @param {HalfEdge} horizonEdge - A single edge of the horizon. - * @return {HalfEdge} The half edge whose vertex is the eyeVertex. - */ - private _addAdjoiningFace; - /** - * Adds 'horizon.length' faces to the hull, each face will be linked with the horizon - * opposite face and the face on the left/right. - * - * @private - * @param {VertexNode} eyeVertex - The vertex that is added to the hull. - * @param {Array} horizon - The horizon. - * @return {ConvexHull} A reference to this convex hull. - */ - private _addNewFaces; - /** - * Adds a vertex to the hull with the following algorithm: - * - * - Compute the 'horizon' which is a chain of half edges. For an edge to belong to this group - * it must be the edge connecting a face that can see 'eyeVertex' and a face which cannot see 'eyeVertex'. - * - All the faces that can see 'eyeVertex' have its visible vertices removed from the assigned vertex list. - * - A new set of faces is created with each edge of the 'horizon' and 'eyeVertex'. Each face is connected - * with the opposite horizon face and the face on the left/right. - * - The vertices removed from all the visible faces are assigned to the new faces if possible. - * - * @private - * @param {VertexNode} eyeVertex - The vertex to add. - * @return {ConvexHull} A reference to this convex hull. - */ - private _addVertexToHull; - /** - * Cleans up internal properties after computing the convex hull. - * - * @private - * @return {ConvexHull} A reference to this convex hull. - */ - private _cleanup; - /** - * Starts the execution of the quick hull algorithm. - * - * @private - * @return {ConvexHull} A reference to this convex hull. - */ - private _compute; -} -/** - * Represents a section bounded by a specific amount of half-edges. - * The current implementation assumes that a face always consist of three edges. - * - * @private - */ -export class Face { - /** - * Creates a face from the given vertex nodes. - * - * @private - * @param {VertexNode} a - The first vertex node. - * @param {VertexNode} b - The second vertex node. - * @param {VertexNode} c - The third vertex node. - * @return {Face} The created face. - */ - private static create; - /** - * The normal vector of the face. - * - * @private - * @type {Vector3} - */ - private normal; - /** - * The midpoint or centroid of the face. - * - * @private - * @type {Vector3} - */ - private midpoint; - /** - * The area of the face. - * - * @private - * @type {number} - * @default 0 - */ - private area; - /** - * Signed distance from face to the origin. - * - * @private - * @type {number} - * @default 0 - */ - private constant; - /** - * Reference to a vertex in a vertex list this face can see. - * - * @private - * @type {?VertexNode} - * @default null - */ - private outside; - mark: number; - /** - * Reference to the base edge of a face. To retrieve all edges, you can use the - * `next` reference of the current edge. - * - * @private - * @type {?HalfEdge} - * @default null - */ - private edge; - /** - * Returns an edge by the given index. - * - * @private - * @param {number} i - The edge index. - * @return {HalfEdge} The edge. - */ - private getEdge; - /** - * Computes all properties of the face. - * - * @private - * @return {Face} A reference to this face. - */ - private compute; - /** - * Returns the signed distance from a given point to the plane representation of this face. - * - * @private - * @param {Vector3} point - The point to compute the distance to. - * @return {number} The distance. - */ - private distanceToPoint; -} -/** - * The basis for a half-edge data structure, also known as doubly - * connected edge list (DCEL). - * - * @private - */ -export class HalfEdge { - /** - * Constructs a new half edge. - * - * @param {VertexNode} vertex - A reference to its destination vertex. - * @param {Face} face - A reference to its face. - */ - constructor(vertex: VertexNode, face: Face); - /** - * A reference to its destination vertex. - * - * @private - * @type {VertexNode} - */ - private vertex; - /** - * Reference to the previous half-edge of the same face. - * - * @private - * @type {?HalfEdge} - * @default null - */ - private prev; - /** - * Reference to the next half-edge of the same face. - * - * @private - * @type {?HalfEdge} - * @default null - */ - private next; - /** - * Reference to the twin half-edge to reach the opposite face. - * - * @private - * @type {?HalfEdge} - * @default null - */ - private twin; - /** - * A reference to its face. - * - * @private - * @type {Face} - */ - private face; - /** - * Returns the destination vertex. - * - * @private - * @return {VertexNode} The destination vertex. - */ - private head; - /** - * Returns the origin vertex. - * - * @private - * @return {?VertexNode} The destination vertex. - */ - private tail; - /** - * Returns the Euclidean length (straight-line length) of the edge. - * - * @private - * @return {number} The edge's length. - */ - private length; - /** - * Returns the square of the Euclidean length (straight-line length) of the edge. - * - * @private - * @return {number} The square of the edge's length. - */ - private lengthSquared; - /** - * Sets the twin edge of this half-edge. It also ensures that the twin reference - * of the given half-edge is correctly set. - * - * @private - * @param {HalfEdge} edge - The twin edge to set. - * @return {HalfEdge} A reference to this edge. - */ - private setTwin; -} -/** - * A vertex as a double linked list node. - * - * @private - */ -export class VertexNode { - /** - * Constructs a new vertex node. - * - * @param {Vector3} point - A point in 3D space. - */ - constructor(point: Vector3); - /** - * A point in 3D space. - * - * @private - * @type {Vector3} - */ - private point; - /** - * Reference to the previous vertex in the double linked list. - * - * @private - * @type {?VertexNode} - * @default null - */ - private prev; - /** - * Reference to the next vertex in the double linked list. - * - * @private - * @type {?VertexNode} - * @default null - */ - private next; - /** - * Reference to the face that is able to see this vertex. - * - * @private - * @type {?Face} - * @default null - */ - private face; -} -/** - * A doubly linked list of vertices. - * - * @private - */ -export class VertexList { - /** - * Reference to the first vertex of the linked list. - * - * @private - * @type {?VertexNode} - * @default null - */ - private head; - /** - * Reference to the last vertex of the linked list. - * - * @private - * @type {?VertexNode} - * @default null - */ - private tail; - /** - * Returns the head reference. - * - * @private - * @return {VertexNode} The head reference. - */ - private first; - /** - * Returns the tail reference. - * - * @private - * @return {VertexNode} The tail reference. - */ - private last; - /** - * Clears the linked list. - * - * @private - * @return {VertexList} A reference to this vertex list. - */ - private clear; - /** - * Inserts a vertex before a target vertex. - * - * @private - * @param {VertexNode} target - The target. - * @param {VertexNode} vertex - The vertex to insert. - * @return {VertexList} A reference to this vertex list. - */ - private insertBefore; - /** - * Inserts a vertex after a target vertex. - * - * @private - * @param {VertexNode} target - The target. - * @param {VertexNode} vertex - The vertex to insert. - * @return {VertexList} A reference to this vertex list. - */ - private insertAfter; - /** - * Appends a vertex to this vertex list. - * - * @private - * @param {VertexNode} vertex - The vertex to append. - * @return {VertexList} A reference to this vertex list. - */ - private append; - /** - * Appends a chain of vertices where the given vertex is the head. - * - * @private - * @param {VertexNode} vertex - The head vertex of a chain of vertices. - * @return {VertexList} A reference to this vertex list. - */ - private appendChain; - /** - * Removes a vertex from the linked list. - * - * @private - * @param {VertexNode} vertex - The vertex to remove. - * @return {VertexList} A reference to this vertex list. - */ - private remove; - /** - * Removes a sublist of vertices from the linked list. - * - * @private - * @param {VertexNode} a - The head of the sublist. - * @param {VertexNode} b - The tail of the sublist. - * @return {VertexList} A reference to this vertex list. - */ - private removeSubList; - /** - * Returns `true` if the linked list is empty. - * - * @private - * @return {boolean} Whether the linked list is empty or not. - */ - private isEmpty; -} -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts deleted file mode 100644 index 85ce6eb37..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/ImprovedNoise.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * A utility class providing a 3D noise function. - * - * The code is based on [IMPROVED NOISE](https://cs.nyu.edu/~perlin/noise/) - * by Ken Perlin, 2002. - * - * @three_import import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - */ -export class ImprovedNoise { - /** - * Returns a noise value for the given parameters. - * - * @param {number} x - The x coordinate. - * @param {number} y - The y coordinate. - * @param {number} z - The z coordinate. - * @return {number} The noise value. - */ - noise(x: number, y: number, z: number): number; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts deleted file mode 100644 index 2650ec61f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/Lut.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Represents a lookup table for colormaps. It is used to determine the color - * values from a range of data values. - * - * ```js - * const lut = new Lut( 'rainbow', 512 ); - * const color = lut.getColor( 0.5 ); - * ``` - * - * @three_import import { Lut } from 'three/addons/math/Lut.js'; - */ -export class Lut { - /** - * Constructs a new Lut. - * - * @param {('rainbow'|'cooltowarm'|'blackbody'|'grayscale')} [colormap='rainbow'] - Sets a colormap from predefined list of colormaps. - * @param {number} [count=32] - Sets the number of colors used to represent the data array. - */ - constructor(colormap?: ("rainbow" | "cooltowarm" | "blackbody" | "grayscale"), count?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLut: boolean; - /** - * The lookup table for the selected color map - * - * @type {Array} - */ - lut: Array; - /** - * The currently selected color map. - * - * @type {Array>} - */ - map: Array>; - /** - * The number of colors of the current selected color map. - * - * @type {number} - * @default 32 - */ - n: number; - /** - * The minimum value to be represented with the lookup table. - * - * @type {number} - * @default 0 - */ - minV: number; - /** - * The maximum value to be represented with the lookup table. - * - * @type {number} - * @default 1 - */ - maxV: number; - /** - * Sets the given LUT. - * - * @param {Lut} value - The LUT to set. - * @return {Lut} A reference to this LUT. - */ - set(value: Lut): Lut; - /** - * Sets the minimum value to be represented with this LUT. - * - * @param {number} min - The minimum value to be represented with the lookup table. - * @return {Lut} A reference to this LUT. - */ - setMin(min: number): Lut; - /** - * Sets the maximum value to be represented with this LUT. - * - * @param {number} max - The maximum value to be represented with the lookup table. - * @return {Lut} A reference to this LUT. - */ - setMax(max: number): Lut; - /** - * Configure the lookup table for the given color map and number of colors. - * - * @param {string} colormap - The name of the color map. - * @param {number} [count=32] - The number of colors. - * @return {Lut} A reference to this LUT. - */ - setColorMap(colormap: string, count?: number): Lut; - /** - * Copies the given lut. - * - * @param {Lut} lut - The LUT to copy. - * @return {Lut} A reference to this LUT. - */ - copy(lut: Lut): Lut; - /** - * Returns an instance of Color for the given data value. - * - * @param {number} alpha - The value to lookup. - * @return {Color} The color from the LUT. - */ - getColor(alpha: number): Color; - /** - * Adds a color map to this Lut instance. - * - * @param {string} name - The name of the color map. - * @param {Array>} arrayOfColors - An array of color values. Each value is an array - * holding a threshold and the actual color value as a hexadecimal number. - * @return {Lut} A reference to this LUT. - */ - addColorMap(name: string, arrayOfColors: Array>): Lut; - /** - * Creates a canvas in order to visualize the lookup table as a texture. - * - * @return {HTMLCanvasElement} The created canvas. - */ - createCanvas(): HTMLCanvasElement; - /** - * Updates the given canvas with the Lut's data. - * - * @param {HTMLCanvasElement} canvas - The canvas to update. - * @return {HTMLCanvasElement} The updated canvas. - */ - updateCanvas(canvas: HTMLCanvasElement): HTMLCanvasElement; -} -export namespace ColorMapKeywords { - let rainbow: number[][]; - let cooltowarm: number[][]; - let blackbody: number[][]; - let grayscale: number[][]; -} -import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts deleted file mode 100644 index c430c18dd..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/MeshSurfaceSampler.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Utility class for sampling weighted random points on the surface of a mesh. - * - * Building the sampler is a one-time O(n) operation. Once built, any number of - * random samples may be selected in O(logn) time. Memory usage is O(n). - * - * References: - * - {@link http://www.joesfer.com/?p=84} - * - {@link https://stackoverflow.com/a/4322940/1314762} - * - * ```js - * const sampler = new MeshSurfaceSampler( surfaceMesh ) - * .setWeightAttribute( 'color' ) - * .build(); - * - * const mesh = new THREE.InstancedMesh( sampleGeometry, sampleMaterial, 100 ); - * - * const position = new THREE.Vector3(); - * const matrix = new THREE.Matrix4(); - * - * // Sample randomly from the surface, creating an instance of the sample geometry at each sample point. - * - * for ( let i = 0; i < 100; i ++ ) { - * - * sampler.sample( position ); - * matrix.makeTranslation( position.x, position.y, position.z ); - * mesh.setMatrixAt( i, matrix ); - * - * } - * - * scene.add( mesh ); - * ``` - * - * @three_import import { MeshSurfaceSampler } from 'three/addons/math/MeshSurfaceSampler.js'; - */ -export class MeshSurfaceSampler { - /** - * Constructs a mesh surface sampler. - * - * @param {Mesh} mesh - Surface mesh from which to sample. - */ - constructor(mesh: Mesh); - geometry: any; - randomFunction: () => number; - indexAttribute: any; - positionAttribute: any; - normalAttribute: any; - colorAttribute: any; - uvAttribute: any; - weightAttribute: any; - distribution: Float32Array | null; - /** - * Specifies a vertex attribute to be used as a weight when sampling from the surface. - * Faces with higher weights are more likely to be sampled, and those with weights of - * zero will not be sampled at all. For vector attributes, only .x is used in sampling. - * - * If no weight attribute is selected, sampling is randomly distributed by area. - * - * @param {string} name - The attribute name. - * @return {MeshSurfaceSampler} A reference to this sampler. - */ - setWeightAttribute(name: string): MeshSurfaceSampler; - /** - * Processes the input geometry and prepares to return samples. Any configuration of the - * geometry or sampler must occur before this method is called. Time complexity is O(n) - * for a surface with n faces. - * - * @return {MeshSurfaceSampler} A reference to this sampler. - */ - build(): MeshSurfaceSampler; - /** - * Allows to set a custom random number generator. Default is `Math.random()`. - * - * @param {Function} randomFunction - A random number generator. - * @return {MeshSurfaceSampler} A reference to this sampler. - */ - setRandomGenerator(randomFunction: Function): MeshSurfaceSampler; - /** - * Selects a random point on the surface of the input geometry, returning the - * position and optionally the normal vector, color and UV Coordinate at that point. - * Time complexity is O(log n) for a surface with n faces. - * - * @param {Vector3} targetPosition - The target object holding the sampled position. - * @param {Vector3} targetNormal - The target object holding the sampled normal. - * @param {Color} targetColor - The target object holding the sampled color. - * @param {Vector2} targetUV - The target object holding the sampled uv coordinates. - * @return {MeshSurfaceSampler} A reference to this sampler. - */ - sample(targetPosition: Vector3, targetNormal: Vector3, targetColor: Color, targetUV: Vector2): MeshSurfaceSampler; - _sampleFaceIndex(): number; - _binarySearch(x: any): number; - _sampleFace(faceIndex: any, targetPosition: any, targetNormal: any, targetColor: any, targetUV: any): this; -} -import { Vector3 } from 'three'; -import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts deleted file mode 100644 index de304fef8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/OBB.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Represents an oriented bounding box (OBB) in 3D space. - * - * @three_import import { OBB } from 'three/addons/math/OBB.js'; - */ -export class OBB { - /** - * Constructs a new OBB. - * - * @param {Vector3} [center] - The center of the OBB. - * @param {Vector3} [halfSize] - Positive halfwidth extents of the OBB along each axis. - * @param {Matrix3} [rotation] - The rotation of the OBB. - */ - constructor(center?: Vector3, halfSize?: Vector3, rotation?: Matrix3); - /** - * The center of the OBB. - * - * @type {Vector3} - */ - center: Vector3; - /** - * Positive halfwidth extents of the OBB along each axis. - * - * @type {Vector3} - */ - halfSize: Vector3; - /** - * The rotation of the OBB. - * - * @type {Matrix3} - */ - rotation: Matrix3; - /** - * Sets the OBBs components to the given values. - * - * @param {Vector3} [center] - The center of the OBB. - * @param {Vector3} [halfSize] - Positive halfwidth extents of the OBB along each axis. - * @param {Matrix3} [rotation] - The rotation of the OBB. - * @return {OBB} A reference to this OBB. - */ - set(center?: Vector3, halfSize?: Vector3, rotation?: Matrix3): OBB; - /** - * Copies the values of the given OBB to this instance. - * - * @param {OBB} obb - The OBB to copy. - * @return {OBB} A reference to this OBB. - */ - copy(obb: OBB): OBB; - /** - * Returns a new OBB with copied values from this instance. - * - * @return {OBB} A clone of this instance. - */ - clone(): OBB; - /** - * Returns the size of this OBB. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The size. - */ - getSize(target: Vector3): Vector3; - /** - * Clamps the given point within the bounds of this OBB. - * - * @param {Vector3} point - The point that should be clamped within the bounds of this OBB. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @returns {Vector3} - The clamped point. - */ - clampPoint(point: Vector3, target: Vector3): Vector3; - /** - * Returns `true` if the given point lies within this OBB. - * - * @param {Vector3} point - The point to test. - * @returns {boolean} - Whether the given point lies within this OBB or not. - */ - containsPoint(point: Vector3): boolean; - /** - * Returns `true` if the given AABB intersects this OBB. - * - * @param {Box3} box3 - The AABB to test. - * @returns {boolean} - Whether the given AABB intersects this OBB or not. - */ - intersectsBox3(box3: Box3): boolean; - /** - * Returns `true` if the given bounding sphere intersects this OBB. - * - * @param {Sphere} sphere - The bounding sphere to test. - * @returns {boolean} - Whether the given bounding sphere intersects this OBB or not. - */ - intersectsSphere(sphere: Sphere): boolean; - /** - * Returns `true` if the given OBB intersects this OBB. - * - * @param {OBB} obb - The OBB to test. - * @param {number} [epsilon=Number.EPSILON] - A small value to prevent arithmetic errors. - * @returns {boolean} - Whether the given OBB intersects this OBB or not. - */ - intersectsOBB(obb: OBB, epsilon?: number): boolean; - /** - * Returns `true` if the given plane intersects this OBB. - * - * @param {Plane} plane - The plane to test. - * @returns {boolean} Whether the given plane intersects this OBB or not. - */ - intersectsPlane(plane: Plane): boolean; - /** - * Performs a ray/OBB intersection test and stores the intersection point - * in the given 3D vector. - * - * @param {Ray} ray - The ray to test. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The intersection point. If no intersection is detected, `null` is returned. - */ - intersectRay(ray: Ray, target: Vector3): Vector3 | null; - /** - * Returns `true` if the given ray intersects this OBB. - * - * @param {Ray} ray - The ray to test. - * @returns {boolean} Whether the given ray intersects this OBB or not. - */ - intersectsRay(ray: Ray): boolean; - /** - * Defines an OBB based on the given AABB. - * - * @param {Box3} box3 - The AABB to setup the OBB from. - * @return {OBB} A reference of this OBB. - */ - fromBox3(box3: Box3): OBB; - /** - * Returns `true` if the given OBB is equal to this OBB. - * - * @param {OBB} obb - The OBB to test. - * @returns {boolean} Whether the given OBB is equal to this OBB or not. - */ - equals(obb: OBB): boolean; - /** - * Applies the given transformation matrix to this OBB. This method can be - * used to transform the bounding volume with the world matrix of a 3D object - * in order to keep both entities in sync. - * - * @param {Matrix4} matrix - The matrix to apply. - * @return {OBB} A reference of this OBB. - */ - applyMatrix4(matrix: Matrix4): OBB; -} -import { Vector3 } from 'three'; -import { Matrix3 } from 'three'; -import { Box3 } from 'three'; -import { Ray } from 'three'; -import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts deleted file mode 100644 index 234a0bd1d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/Octree.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -/** - * An octree is a hierarchical tree data structure used to partition a three-dimensional - * space by recursively subdividing it into eight octants. - * - * This particular implementation can have up to sixteen levels and stores up to eight triangles - * in leaf nodes. - * - * `Octree` can be used in games to compute collision between the game world and colliders from - * the player or other dynamic 3D objects. - * - * - * ```js - * const octree = new Octree().fromGraphNode( scene ); - * const result = octree.capsuleIntersect( playerCollider ); // collision detection - * ``` - * - * @three_import import { Octree } from 'three/addons/math/Octree.js'; - */ -export class Octree { - /** - * Constructs a new Octree. - * - * @param {Box3} [box] - The base box with enclose the entire Octree. - */ - constructor(box?: Box3); - /** - * The base box with enclose the entire Octree. - * - * @type {Box3} - */ - box: Box3; - /** - * The bounds of the Octree. Compared to {@link Octree#box}, no - * margin is applied. - * - * @type {Box3} - */ - bounds: Box3; - /** - * Can by used for layers configuration for refine testing. - * - * @type {Layers} - */ - layers: Layers; - /** - * The number of triangles a leaf can store before it is split. - * - * @type {number} - * @default 8 - */ - trianglesPerLeaf: number; - /** - * The maximum level of the Octree. It defines the maximum - * hierarchical depth of the data structure. - * - * @type {number} - * @default 16 - */ - maxLevel: number; - subTrees: any[]; - triangles: any[]; - /** - * Adds the given triangle to the Octree. The triangle vertices are clamped if they exceed - * the bounds of the Octree. - * - * @param {Triangle} triangle - The triangle to add. - * @return {Octree} A reference to this Octree. - */ - addTriangle(triangle: Triangle): Octree; - /** - * Prepares {@link Octree#box} for the build. - * - * @return {Octree} A reference to this Octree. - */ - calcBox(): Octree; - /** - * Splits the Octree. This method is used recursively when - * building the Octree. - * - * @param {number} level - The current level. - * @return {Octree} A reference to this Octree. - */ - split(level: number): Octree; - /** - * Builds the Octree. - * - * @return {Octree} A reference to this Octree. - */ - build(): Octree; - /** - * Computes the triangles that potentially intersect with the given ray. - * - * @param {Ray} ray - The ray to test. - * @param {Array} triangles - The target array that holds the triangles. - */ - getRayTriangles(ray: Ray, triangles: Array): void; - /** - * Computes the intersection between the given capsule and triangle. - * - * @param {Capsule} capsule - The capsule to test. - * @param {Triangle} triangle - The triangle to test. - * @return {Object|false} The intersection object. If no intersection - * is detected, the method returns `false`. - */ - triangleCapsuleIntersect(capsule: Capsule, triangle: Triangle): Object | false; - /** - * Computes the intersection between the given bounding box and triangle. - * - * @param {Box3} box - The bounding box to test. - * @param {Triangle} triangle - The triangle to test. - * @return {Object|false} The intersection object. If no intersection - * is detected, the method returns `false`. - */ - triangleBoxIntersect(box: Box3, triangle: Triangle): Object | false; - /** - * Computes the intersection between the given sphere and triangle. - * - * @param {Sphere} sphere - The sphere to test. - * @param {Triangle} triangle - The triangle to test. - * @return {Object|false} The intersection object. If no intersection - * is detected, the method returns `false`. - */ - triangleSphereIntersect(sphere: Sphere, triangle: Triangle): Object | false; - /** - * Computes the triangles that potentially intersect with the given bounding sphere. - * - * @param {Sphere} sphere - The sphere to test. - * @param {Array} triangles - The target array that holds the triangles. - */ - getSphereTriangles(sphere: Sphere, triangles: Array): void; - /** - * Computes the triangles that potentially intersect with the given bounding box. - * - * @param {Box3} box - The bounding box. - * @param {Array} triangles - The target array that holds the triangles. - */ - getBoxTriangles(box: Box3, triangles: Array): void; - /** - * Computes the triangles that potentially intersect with the given capsule. - * - * @param {Capsule} capsule - The capsule to test. - * @param {Array} triangles - The target array that holds the triangles. - */ - getCapsuleTriangles(capsule: Capsule, triangles: Array): void; - /** - * Performs a bounding box intersection test with this Octree. - * - * @param {Box3} box - The bounding box to test. - * @return {Object|boolean} The intersection object. If no intersection - * is detected, the method returns `false`. - */ - boxIntersect(box: Box3): Object | boolean; - /** - * Performs a bounding sphere intersection test with this Octree. - * - * @param {Sphere} sphere - The bounding sphere to test. - * @return {Object|boolean} The intersection object. If no intersection - * is detected, the method returns `false`. - */ - sphereIntersect(sphere: Sphere): Object | boolean; - /** - * Performs a capsule intersection test with this Octree. - * - * @param {Capsule} capsule - The capsule to test. - * @return {Object|boolean} The intersection object. If no intersection - * is detected, the method returns `false`. - */ - capsuleIntersect(capsule: Capsule): Object | boolean; - /** - * Performs a ray intersection test with this Octree. - * - * @param {Ray} ray - The ray to test. - * @return {Object|boolean} The nearest intersection object. If no intersection - * is detected, the method returns `false`. - */ - rayIntersect(ray: Ray): Object | boolean; - /** - * Constructs the Octree from the given 3D object. - * - * @param {Object3D} group - The scene graph node. - * @return {Octree} A reference to this Octree. - */ - fromGraphNode(group: Object3D): Octree; - /** - * Clears the Octree by making it empty. - * - * @return {Octree} A reference to this Octree. - */ - clear(): Octree; -} -import { Box3 } from 'three'; -import { Layers } from 'three'; -import { Triangle } from 'three'; -import { Capsule } from '../math/Capsule.js'; -import { Sphere } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts deleted file mode 100644 index b6ba529db..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/math/SimplexNoise.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * A utility class providing noise functions. - * - * The code is based on [Simplex noise demystified](https://web.archive.org/web/20210210162332/http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf) - * by Stefan Gustavson, 2005. - * - * @three_import import { SimplexNoise } from 'three/addons/math/SimplexNoise.js'; - */ -export class SimplexNoise { - /** - * Constructs a new simplex noise object. - * - * @param {Object} [r=Math] - A math utility class that holds a `random()` method. This makes it - * possible to pass in custom random number generator. - */ - constructor(r?: Object); - grad3: number[][]; - grad4: number[][]; - p: number[]; - perm: number[]; - simplex: number[][]; - /** - * A 2D simplex noise method. - * - * @param {number} xin - The x coordinate. - * @param {number} yin - The y coordinate. - * @return {number} The noise value. - */ - noise(xin: number, yin: number): number; - /** - * A 3D simplex noise method. - * - * @param {number} xin - The x coordinate. - * @param {number} yin - The y coordinate. - * @param {number} zin - The z coordinate. - * @return {number} The noise value. - */ - noise3d(xin: number, yin: number, zin: number): number; - /** - * A 4D simplex noise method. - * - * @param {number} x - The x coordinate. - * @param {number} y - The y coordinate. - * @param {number} z - The z coordinate. - * @param {number} w - The w coordinate. - * @return {number} The noise value. - */ - noise4d(x: number, y: number, z: number, w: number): number; - _dot(g: any, x: any, y: any): number; - _dot3(g: any, x: any, y: any, z: any): number; - _dot4(g: any, x: any, y: any, z: any, w: any): number; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts deleted file mode 100644 index f1201ad74..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/ConvexObjectBreaker.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This class can be used to subdivide a convex Geometry object into pieces. - * - * Use the function prepareBreakableObject to prepare a Mesh object to be broken. - * Then, call the various functions to subdivide the object (subdivideByImpact, cutByPlane). - * Sub-objects that are product of subdivision don't need prepareBreakableObject to be called on them. - * - * Requisites for the object: - * - Mesh object must have a buffer geometry and a material. - * - Vertex normals must be planar (not smoothed). - * - The geometry must be convex (this is not checked in the library). You can create convex - * geometries with {@link ConvexGeometry}. The {@link BoxGeometry}, {@link SphereGeometry} and other - * convex primitives can also be used. - * - * Note: This lib adds member variables to object's userData member (see prepareBreakableObject function) - * Use with caution and read the code when using with other libs. - * - * @three_import import { ConvexObjectBreaker } from 'three/addons/misc/ConvexObjectBreaker.js'; - */ -export class ConvexObjectBreaker { - static transformFreeVector(v: any, m: any): any; - static transformFreeVectorInverse(v: any, m: any): any; - static transformTiedVectorInverse(v: any, m: any): any; - static transformPlaneToLocalSpace(plane: any, m: any, resultPlane: any): void; - /** - * Constructs a new convex object breaker. - * - * @param {number} [minSizeForBreak=1.4] - Min size a debris can have to break. - * @param {number} [smallDelta=0.0001] - Max distance to consider that a point belongs to a plane. - */ - constructor(minSizeForBreak?: number, smallDelta?: number); - minSizeForBreak: number; - smallDelta: number; - tempLine1: Line3; - tempPlane1: Plane; - tempPlane2: Plane; - tempPlane_Cut: Plane; - tempCM1: Vector3; - tempCM2: Vector3; - tempVector3: Vector3; - tempVector3_2: Vector3; - tempVector3_3: Vector3; - tempVector3_P0: Vector3; - tempVector3_P1: Vector3; - tempVector3_P2: Vector3; - tempVector3_N0: Vector3; - tempVector3_N1: Vector3; - tempVector3_AB: Vector3; - tempVector3_CB: Vector3; - tempResultObjects: { - object1: null; - object2: null; - }; - segments: boolean[]; - /** - * Must be called for all 3D objects that should be breakable. - * - * @param {Object3D} object - The 3D object. It must have a convex geometry. - * @param {number} mass - The 3D object's mass in kg. Must be greater than `0`. - * @param {Vector3} velocity - The 3D object's velocity. - * @param {Vector3} angularVelocity - The 3D object's angular velocity. - * @param {boolean} breakable - Whether the 3D object is breakable or not. - */ - prepareBreakableObject(object: Object3D, mass: number, velocity: Vector3, angularVelocity: Vector3, breakable: boolean): void; - /** - * Subdivides the given 3D object into pieces by an impact (meaning another object hits - * the given 3D object at a certain surface point). - * - * @param {Object3D} object - The 3D object to subdivide. - * @param {Vector3} pointOfImpact - The point of impact. - * @param {Vector3} normal - The impact normal. - * @param {number} maxRadialIterations - Iterations for radial cuts. - * @param {number} maxRandomIterations - Max random iterations for not-radial cuts. - * @return {Array} The array of pieces. - */ - subdivideByImpact(object: Object3D, pointOfImpact: Vector3, normal: Vector3, maxRadialIterations: number, maxRandomIterations: number): Array; - /** - * Subdivides the given 3D object into pieces by a plane. - * - * @param {Object3D} object - The 3D object to subdivide. - * @param {Plane} plane - The plane to cut the 3D object. - * @param {{object1:?Mesh,object2:?Mesh}} output - An object that stores the pieces. - * @return {number} The number of pieces. - */ - cutByPlane(object: Object3D, plane: Plane, output: { - object1: Mesh | null; - object2: Mesh | null; - }): number; -} -import { Line3 } from 'three'; -import { Plane } from 'three'; -import { Vector3 } from 'three'; -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts deleted file mode 100644 index 783a39ef5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/Gyroscope.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * A special type of 3D object that takes a position from the scene graph hierarchy - * but uses its local rotation as world rotation. It works like real-world gyroscope - - * you can move it around using hierarchy while its orientation stays fixed with - * respect to the world. - * - * @augments Object3D - * @three_import import { Gyroscope } from 'three/addons/misc/Gyroscope.js'; - */ -export class Gyroscope extends Object3D { - updateMatrixWorld(force: any): void; -} -import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts deleted file mode 100644 index 39a32d240..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/MD2Character.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * This class represents a management component for animated MD2 - * character assets. - * - * @three_import import { MD2Character } from 'three/addons/misc/MD2Character.js'; - */ -export class MD2Character { - /** - * The mesh scale. - * - * @type {number} - * @default 1 - */ - scale: number; - /** - * The FPS - * - * @type {number} - * @default 6 - */ - animationFPS: number; - /** - * The root 3D object - * - * @type {Object3D} - */ - root: Object3D; - /** - * The body mesh. - * - * @type {?Mesh} - * @default null - */ - meshBody: Mesh | null; - /** - * The weapon mesh. - * - * @type {?Mesh} - * @default null - */ - meshWeapon: Mesh | null; - /** - * The body skins. - * - * @type {Array} - */ - skinsBody: Array; - /** - * The weapon skins. - * - * @type {Array} - */ - skinsWeapon: Array; - /** - * The weapon meshes. - * - * @type {Array} - */ - weapons: Array; - /** - * The name of the active animation clip. - * - * @type {?string} - * @default null - */ - activeAnimationClipName: string | null; - /** - * The animation mixer. - * - * @type {?AnimationMixer} - * @default null - */ - mixer: AnimationMixer | null; - /** - * The `onLoad` callback function. - * - * @type {Function} - */ - onLoadComplete: Function; - loadCounter: number; - /** - * Loads the character model for the given config. - * - * @param {Object} config - The config which defines the model and textures paths. - */ - loadParts(config: Object): void; - /** - * Sets the animation playback rate. - * - * @param {number} rate - The playback rate to set. - */ - setPlaybackRate(rate: number): void; - /** - * Sets the wireframe material flag. - * - * @param {boolean} wireframeEnabled - Whether to enable wireframe rendering or not. - */ - setWireframe(wireframeEnabled: boolean): void; - /** - * Sets the skin defined by the given skin index. This will result in a different texture - * for the body mesh. - * - * @param {number} index - The skin index. - */ - setSkin(index: number): void; - /** - * Sets the weapon defined by the given weapon index. This will result in a different weapon - * hold by the character. - * - * @param {number} index - The weapon index. - */ - setWeapon(index: number): void; - /** - * Sets the defined animation clip as the active animation. - * - * @param {string} clipName - The name of the animation clip. - */ - setAnimation(clipName: string): void; - activeClipName: string | undefined; - /** - * Synchronizes the weapon with the body animation. - */ - syncWeaponAnimation(): void; - /** - * Updates the animations of the mesh. Must be called inside the animation loop. - * - * @param {number} delta - The delta time in seconds. - */ - update(delta: number): void; -} -import { Object3D } from 'three'; -import { Mesh } from 'three'; -import { AnimationMixer } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts deleted file mode 100644 index 9ccc09604..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/MD2CharacterComplex.d.ts +++ /dev/null @@ -1,210 +0,0 @@ -/** - * This class represents a management component for animated MD2 - * character assets. It provides a larger API compared to {@link MD2Character}. - * - * @three_import import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js'; - */ -export class MD2CharacterComplex { - /** - * The mesh scale. - * - * @type {number} - * @default 1 - */ - scale: number; - /** - * The FPS - * - * @type {number} - * @default 6 - */ - animationFPS: number; - /** - * The transition frames. - * - * @type {number} - * @default 15 - */ - transitionFrames: number; - /** - * The character's maximum speed. - * - * @type {number} - * @default 275 - */ - maxSpeed: number; - /** - * The character's maximum reverse speed. - * - * @type {number} - * @default - 275 - */ - maxReverseSpeed: number; - /** - * The character's front acceleration. - * - * @type {number} - * @default 600 - */ - frontAcceleration: number; - /** - * The character's back acceleration. - * - * @type {number} - * @default 600 - */ - backAcceleration: number; - /** - * The character's front deceleration. - * - * @type {number} - * @default 600 - */ - frontDeceleration: number; - /** - * The character's angular speed. - * - * @type {number} - * @default 2.5 - */ - angularSpeed: number; - /** - * The root 3D object - * - * @type {Object3D} - */ - root: Object3D; - /** - * The body mesh. - * - * @type {?Mesh} - * @default null - */ - meshBody: Mesh | null; - /** - * The weapon mesh. - * - * @type {?Mesh} - * @default null - */ - meshWeapon: Mesh | null; - /** - * The movement controls. - * - * @type {?Object} - * @default null - */ - controls: Object | null; - /** - * The body skins. - * - * @type {Array} - */ - skinsBody: Array; - /** - * The weapon skins. - * - * @type {Array} - */ - skinsWeapon: Array; - /** - * The weapon meshes. - * - * @type {Array} - */ - weapons: Array; - /** - * The current skin. - * - * @type {Texture} - * @default undefined - */ - currentSkin: Texture; - onLoadComplete: () => void; - meshes: any[]; - animations: {}; - loadCounter: number; - speed: number; - bodyOrientation: number; - walkSpeed: number; - crouchSpeed: number; - activeAnimation: any; - oldAnimation: any; - /** - * Toggles shadow casting and receiving on the character's meshes. - * - * @param {boolean} enable - Whether to enable shadows or not. - */ - enableShadows(enable: boolean): void; - /** - * Toggles visibility on the character's meshes. - * - * @param {boolean} enable - Whether the character is visible or not. - */ - setVisible(enable: boolean): void; - /** - * Shares certain resources from a different character model. - * - * @param {MD2CharacterComplex} original - The original MD2 character. - */ - shareParts(original: MD2CharacterComplex): void; - /** - * Loads the character model for the given config. - * - * @param {Object} config - The config which defines the model and textures paths. - */ - loadParts(config: Object): void; - /** - * Sets the animation playback rate. - * - * @param {number} rate - The playback rate to set. - */ - setPlaybackRate(rate: number): void; - /** - * Sets the wireframe material flag. - * - * @param {boolean} wireframeEnabled - Whether to enable wireframe rendering or not. - */ - setWireframe(wireframeEnabled: boolean): void; - /** - * Sets the skin defined by the given skin index. This will result in a different texture - * for the body mesh. - * - * @param {number} index - The skin index. - */ - setSkin(index: number): void; - /** - * Sets the weapon defined by the given weapon index. This will result in a different weapon - * hold by the character. - * - * @param {number} index - The weapon index. - */ - setWeapon(index: number): void; - /** - * Sets the defined animation clip as the active animation. - * - * @param {string} animationName - The name of the animation clip. - */ - setAnimation(animationName: string): void; - blendCounter: number | undefined; - update(delta: any): void; - /** - * Updates the animations of the mesh. Must be called inside the animation loop. - * - * @param {number} delta - The delta time in seconds. - */ - updateAnimations(delta: number): void; - /** - * Updates the animation state based on the control inputs. - */ - updateBehaviors(): void; - /** - * Transforms the character model based on the control input. - * - * @param {number} delta - The delta time in seconds. - */ - updateMovementModel(delta: number): void; - _createPart(geometry: any, skinMap: any): MorphBlendMesh; -} -import { Object3D } from 'three'; -import { MorphBlendMesh } from '../misc/MorphBlendMesh.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts deleted file mode 100644 index 565013827..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/MorphAnimMesh.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * A special type of an animated mesh with a simple interface - * for animation playback. It allows to playback just one animation - * without any transitions or fading between animation changes. - * - * @augments Mesh - * @three_import import { MorphAnimMesh } from 'three/addons/misc/MorphAnimMesh.js'; - */ -export class MorphAnimMesh extends Mesh { - /** - * Constructs a new morph anim mesh. - * - * @param {BufferGeometry} [geometry] - The mesh geometry. - * @param {Material|Array} [material] - The mesh material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * The internal animation mixer. - * - * @type {AnimationMixer} - */ - mixer: AnimationMixer; - /** - * The current active animation action. - * - * @type {?AnimationAction} - * @default null - */ - activeAction: AnimationAction | null; - /** - * Sets the animation playback direction to "forward". - */ - setDirectionForward(): void; - /** - * Sets the animation playback direction to "backward". - */ - setDirectionBackward(): void; - /** - * Plays the defined animation clip. The implementation assumes the animation - * clips are stored in {@link Object3D#animations} or the geometry. - * - * @param {string} label - The name of the animation clip. - * @param {number} fps - The FPS of the animation clip. - */ - playAnimation(label: string, fps: number): void; - /** - * Updates the animations of the mesh. Must be called inside the animation loop. - * - * @param {number} delta - The delta time in seconds. - */ - updateAnimation(delta: number): void; - copy(source: any, recursive: any): this; -} -import { Mesh } from 'three'; -import { AnimationMixer } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts deleted file mode 100644 index 153109c6a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/MorphBlendMesh.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/** - * A special type of an animated mesh with a more advanced interface - * for animation playback. Unlike {@link MorphAnimMesh}. It allows to - * playback more than one morph animation at the same time but without - * fading options. - * - * @augments Mesh - * @three_import import { MorphBlendMesh } from 'three/addons/misc/MorphBlendMesh.js'; - */ -export class MorphBlendMesh extends Mesh { - /** - * Constructs a new morph blend mesh. - * - * @param {BufferGeometry} [geometry] - The mesh geometry. - * @param {Material|Array} [material] - The mesh material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * A dictionary of animations. - * - * @type {Object} - */ - animationsMap: { - [x: string]: Object; - }; - /** - * A list of animations. - * - * @type {Array} - */ - animationsList: Array; - /** - * Creates a new animation. - * - * @param {string} name - The animation name. - * @param {number} start - The start time. - * @param {number} end - The end time. - * @param {number} fps - The FPS. - */ - createAnimation(name: string, start: number, end: number, fps: number): void; - /** - * Automatically creates animations based on the values in - * {@link Mesh#morphTargetDictionary}. - * - * @param {number} fps - The FPS of all animations. - */ - autoCreateAnimations(fps: number): void; - firstAnimation: string | undefined; - /** - * Sets the animation playback direction to "forward" for the - * defined animation. - * - * @param {string} name - The animation name. - */ - setAnimationDirectionForward(name: string): void; - /** - * Sets the animation playback direction to "backward" for the - * defined animation. - * - * @param {string} name - The animation name. - */ - setAnimationDirectionBackward(name: string): void; - /** - * Sets the FPS to the given value for the defined animation. - * - * @param {string} name - The animation name. - * @param {number} fps - The FPS to set. - */ - setAnimationFPS(name: string, fps: number): void; - /** - * Sets the duration to the given value for the defined animation. - * - * @param {string} name - The animation name. - * @param {number} duration - The duration to set. - */ - setAnimationDuration(name: string, duration: number): void; - /** - * Sets the weight to the given value for the defined animation. - * - * @param {string} name - The animation name. - * @param {number} weight - The weight to set. - */ - setAnimationWeight(name: string, weight: number): void; - /** - * Sets the time to the given value for the defined animation. - * - * @param {string} name - The animation name. - * @param {number} time - The time to set. - */ - setAnimationTime(name: string, time: number): void; - /** - * Returns the time for the defined animation. - * - * @param {string} name - The animation name. - * @return {number} The time. - */ - getAnimationTime(name: string): number; - /** - * Returns the duration for the defined animation. - * - * @param {string} name - The animation name. - * @return {number} The duration. - */ - getAnimationDuration(name: string): number; - /** - * Plays the defined animation. - * - * @param {string} name - The animation name. - */ - playAnimation(name: string): void; - /** - * Stops the defined animation. - * - * @param {string} name - The animation name. - */ - stopAnimation(name: string): void; - /** - * Updates the animations of the mesh. - * - * @param {number} delta - The delta time in seconds. - */ - update(delta: number): void; -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts deleted file mode 100644 index ce7c04e65..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMap.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/). - * - * To use, simply construct a `ProgressiveLightMap` object, - * `plmap.addObjectsToLightMap(object)` an array of semi-static - * objects and lights to the class once, and then call - * `plmap.update(camera)` every frame to begin accumulating - * lighting samples. - * - * This should begin accumulating lightmaps which apply to - * your objects, so you can start jittering lighting to achieve - * the texture-space effect you're looking for. - * - * This class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, import from `ProgressiveLightMapGPU.js`. - * - * @three_import import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js'; - */ -export class ProgressiveLightMap { - /** - * Constructs a new progressive light map. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {number} [res=1024] - The side-long dimension of the total lightmap. - */ - constructor(renderer: WebGLRenderer, res?: number); - /** - * The renderer. - * - * @type {WebGLRenderer} - */ - renderer: WebGLRenderer; - /** - * The side-long dimension of the total lightmap. - * - * @type {number} - * @default 1024 - */ - res: number; - lightMapContainers: any[]; - scene: Scene; - buffer1Active: boolean; - firstUpdate: boolean; - labelMesh: Mesh | null; - blurringPlane: Mesh | null; - progressiveLightMap1: WebGLRenderTarget; - progressiveLightMap2: WebGLRenderTarget; - uvMat: MeshPhongMaterial; - /** - * Sets these objects' materials' lightmaps and modifies their uv1's. - * - * @param {Array} objects - An array of objects and lights to set up your lightmap. - */ - addObjectsToLightMap(objects: Array): void; - uv_boxes: any[] | undefined; - /** - * This function renders each mesh one at a time into their respective surface maps. - * - * @param {Camera} camera - The camera the scene is rendered with. - * @param {number} [blendWindow=100] - When >1, samples will accumulate over time. - * @param {boolean} [blurEdges=true] - Whether to fix UV Edges via blurring. - */ - update(camera: Camera, blendWindow?: number, blurEdges?: boolean): void; - /** - * Draws the lightmap in the main scene. Call this after adding the objects to it. - * - * @param {boolean} visible - Whether the debug plane should be visible - * @param {Vector3} [position] - Where the debug plane should be drawn - */ - showDebugLightmap(visible: boolean, position?: Vector3): void; - /** - * Creates the Blurring Plane. - * - * @private - * @param {number} res - The square resolution of this object's lightMap. - * @param {WebGLRenderTarget} lightMap - The lightmap to initialize the plane with. - */ - private _initializeBlurPlane; - /** - * Frees all internal resources. - */ - dispose(): void; -} -import { Scene } from 'three'; -import { Mesh } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { MeshPhongMaterial } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts deleted file mode 100644 index f6dcf6335..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/ProgressiveLightMapGPU.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Progressive Light Map Accumulator, by [zalo](https://github.com/zalo/). - * - * To use, simply construct a `ProgressiveLightMap` object, - * `plmap.addObjectsToLightMap(object)` an array of semi-static - * objects and lights to the class once, and then call - * `plmap.update(camera)` every frame to begin accumulating - * lighting samples. - * - * This should begin accumulating lightmaps which apply to - * your objects, so you can start jittering lighting to achieve - * the texture-space effect you're looking for. - * - * This class can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, import from `ProgressiveLightMap.js`. - * - * @three_import import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMapGPU.js'; - */ -export class ProgressiveLightMap { - /** - * @param {WebGPURenderer} renderer - The renderer. - * @param {number} [resolution=1024] - The side-long dimension of the total lightmap. - */ - constructor(renderer: WebGPURenderer, resolution?: number); - /** - * The renderer. - * - * @type {WebGPURenderer} - */ - renderer: WebGPURenderer; - /** - * The side-long dimension of the total lightmap. - * - * @type {number} - * @default 1024 - */ - resolution: number; - _lightMapContainers: any[]; - _scene: Scene; - _buffer1Active: boolean; - _labelMesh: Mesh | null; - _blurringPlane: Mesh | null; - _progressiveLightMap1: RenderTarget; - _progressiveLightMap2: RenderTarget; - _averagingWindow: import("three/webgpu").UniformNode; - _previousShadowMap: import("three/webgpu").TextureNode; - _uvMat: MeshPhongNodeMaterial; - /** - * Sets these objects' materials' lightmaps and modifies their uv1's. - * - * @param {Array} objects - An array of objects and lights to set up your lightmap. - */ - addObjectsToLightMap(objects: Array): void; - /** - * Frees all internal resources. - */ - dispose(): void; - /** - * This function renders each mesh one at a time into their respective surface maps. - * - * @param {Camera} camera - The camera the scene is rendered with. - * @param {number} [blendWindow=100] - When >1, samples will accumulate over time. - * @param {boolean} [blurEdges=true] - Whether to fix UV Edges via blurring. - */ - update(camera: Camera, blendWindow?: number, blurEdges?: boolean): void; - /** - * Draws the lightmap in the main scene. Call this after adding the objects to it. - * - * @param {boolean} visible - Whether the debug plane should be visible - * @param {Vector3} [position] - Where the debug plane should be drawn - */ - showDebugLightmap(visible: boolean, position?: Vector3): void; - /** - * Creates the Blurring Plane. - * - * @private - */ - private _initializeBlurPlane; -} -import { Scene } from 'three/webgpu'; -import { Mesh } from 'three/webgpu'; -import { RenderTarget } from 'three/webgpu'; -import { MeshPhongNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts deleted file mode 100644 index 5e3866664..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/RollerCoaster.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * A procedural roller coaster geometry. - * - * @augments BufferGeometry - * @three_import import { RollerCoasterGeometry } from 'three/addons/misc/RollerCoaster.js'; - */ -export class RollerCoasterGeometry extends BufferGeometry { - /** - * Constructs a new geometry. - * - * @param {Curve} curve - The curve to generate the geometry along. - * @param {number} divisions - The number of divisions which defines the detail of the geometry. - */ - constructor(curve: Curve, divisions: number); -} -/** - * A procedural roller coaster lifters geometry. - * - * @augments BufferGeometry - * @three_import import { RollerCoasterLiftersGeometry } from 'three/addons/misc/RollerCoaster.js'; - */ -export class RollerCoasterLiftersGeometry extends BufferGeometry { - /** - * Constructs a new geometry. - * - * @param {Curve} curve - The curve to generate the geometry along. - * @param {number} divisions - The number of divisions which defines the detail of the geometry. - */ - constructor(curve: Curve, divisions: number); -} -/** - * A procedural roller coaster shadow geometry. - * - * @augments BufferGeometry - * @three_import import { RollerCoasterShadowGeometry } from 'three/addons/misc/RollerCoaster.js'; - */ -export class RollerCoasterShadowGeometry extends BufferGeometry { - /** - * Constructs a new geometry. - * - * @param {Curve} curve - The curve to generate the geometry along. - * @param {number} divisions - The number of divisions which defines the detail of the geometry. - */ - constructor(curve: Curve, divisions: number); -} -/** - * A procedural sky geometry. - * - * @augments BufferGeometry - * @three_import import { SkyGeometry } from 'three/addons/misc/RollerCoaster.js'; - */ -export class SkyGeometry extends BufferGeometry { -} -/** - * A procedural trees geometry. - * - * @augments BufferGeometry - * @three_import import { TreesGeometry } from 'three/addons/misc/RollerCoaster.js'; - */ -export class TreesGeometry extends BufferGeometry { - /** - * Constructs a new geometry. - * - * @param {Mesh} landscape - A mesh representing the landscape. Trees will be positioned - * randomly on the landscape's surface. - */ - constructor(landscape: Mesh); -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts deleted file mode 100644 index 3a794d7df..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/TileCreasedNormalsPlugin.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * A plugin for `3d-tiles-renderer` that computes creased vertex normals for the - * geometry of each loaded tile: smooth normals everywhere except where faces meet - * at an angle greater than the crease angle. Useful for photogrammetry tile sets - * like Google Photorealistic 3D Tiles which come without vertex normals. - * - * The normals are computed in a Web Worker so tile processing doesn't block the - * main thread. Tiles are displayed once their normals are ready. - * - * ```js - * tiles.registerPlugin( new TileCreasedNormalsPlugin( { creaseAngle: Math.PI / 6 } ) ); - * ``` - * - * @three_import import { TileCreasedNormalsPlugin } from 'three/addons/misc/TileCreasedNormalsPlugin.js'; - */ -export class TileCreasedNormalsPlugin { - /** - * Constructs a new plugin. - * - * @param {Object} [options] - The configuration options. - * @param {number} [options.creaseAngle=Math.PI/3] - The crease angle in radians. - */ - constructor({ creaseAngle }?: { - creaseAngle?: number | undefined; - }); - /** - * The crease angle in radians. - * - * @type {number} - */ - creaseAngle: number; - _requestId: number; - _pending: Map; - _worker: Worker; - /** - * Called by the tiles renderer for each loaded tile model. The tile is - * displayed once the returned promise resolves. - * - * @param {Object3D} scene - The tile model. - * @return {Promise} A promise that resolves when all geometries have creased normals. - */ - processTileModel(scene: Object3D): Promise; - _processMesh(mesh: any): Promise; - /** - * Called by the tiles renderer when the plugin is unregistered or the - * tiles renderer is disposed. - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts deleted file mode 100644 index 398fe3186..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/TubePainter.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @classdesc This module can be used to paint tube-like meshes - * along a sequence of points. This module is used in a XR - * painter demo. - * - * ```js - * const painter = new TubePainter(); - * scene.add( painter.mesh ); - * ``` - * - * @name TubePainter - * @class - * @three_import import { TubePainter } from 'three/addons/misc/TubePainter.js'; - */ -export function TubePainter(): { - /** - * The "painted" tube mesh. Must be added to the scene. - * - * @name TubePainter#mesh - * @type {Mesh} - */ - mesh: Mesh; - /** - * Moves the current painting position to the given value. - * - * @method - * @name TubePainter#moveTo - * @param {Vector3} position The new painting position. - */ - moveTo: (position: any) => void; - /** - * Draw a stroke from the current position to the given one. - * This method extends the tube while drawing with the XR - * controllers. - * - * @method - * @name TubePainter#lineTo - * @param {Vector3} position The destination position. - */ - lineTo: (position: any) => void; - /** - * Sets the size of newly rendered tube segments. - * - * @method - * @name TubePainter#setSize - * @param {number} size The size. - */ - setSize: (value: any) => void; - /** - * Sets the color of newly rendered tube segments. - * - * @method - * @name TubePainter#setColor - * @param {Color} color The color. - */ - setColor: (value: any) => void; - /** - * Updates the internal geometry buffers so the new painted - * segments are rendered. - * - * @method - * @name TubePainter#update - */ - update: () => void; -}; -export class TubePainter { -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts deleted file mode 100644 index 87012184d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/Volume.d.ts +++ /dev/null @@ -1,163 +0,0 @@ -/** - * This class had been written to handle the output of the {@link NRRDLoader}. - * It contains a volume of data and information about it. For now it only handles 3 dimensional data. - * - * @three_import import { Volume } from 'three/addons/misc/Volume.js'; - */ -export class Volume { - /** - * Constructs a new volume. - * - * @param {number} [xLength] - Width of the volume. - * @param {number} [yLength] - Length of the volume. - * @param {number} [zLength] - Depth of the volume. - * @param {string} [type] - The type of data (uint8, uint16, ...). - * @param {ArrayBuffer} [arrayBuffer] - The buffer with volume data. - */ - constructor(xLength?: number, yLength?: number, zLength?: number, type?: string, arrayBuffer?: ArrayBuffer); - /** - * Width of the volume in the IJK coordinate system. - * - * @type {number} - * @default 1 - */ - xLength: number; - /** - * Height of the volume in the IJK coordinate system. - * - * @type {number} - * @default 1 - */ - yLength: number; - /** - * Depth of the volume in the IJK coordinate system. - * - * @type {number} - * @default 1 - */ - zLength: number; - /** - * The order of the Axis dictated by the NRRD header - * - * @type {Array} - */ - axisOrder: Array; - /** - * The data of the volume. - * - * @type {TypedArray} - */ - data: TypedArray; - /** - * Spacing to apply to the volume from IJK to RAS coordinate system - * - * @type {Array} - */ - spacing: Array; - /** - * Offset of the volume in the RAS coordinate system - * - * @type {Array} - */ - offset: Array; - /** - * The IJK to RAS matrix. - * - * @type {Martrix3} - */ - matrix: Martrix3; - /** - * The RAS to IJK matrix. - * - * @type {Martrix3} - */ - inverseMatrix: Martrix3; - /** - * The list of all the slices associated to this volume - * - * @type {Array} - */ - sliceList: Array; - /** - * Whether to use segmentation mode or not. - * It can load 16-bits nrrds correctly. - * - * @type {boolean} - * @default false - */ - segmentation: boolean; - /** - * This array holds the dimensions of the volume in the RAS space - * - * @type {Array} - */ - RASDimensions: Array; - /** - * Shortcut for data[access(i,j,k)]. - * - * @param {number} i - First coordinate. - * @param {number} j - Second coordinate. - * @param {number} k - Third coordinate. - * @returns {number} The value in the data array. - */ - getData(i: number, j: number, k: number): number; - /** - * Compute the index in the data array corresponding to the given coordinates in IJK system. - * - * @param {number} i - First coordinate. - * @param {number} j - Second coordinate. - * @param {number} k - Third coordinate. - * @returns {number} The index. - */ - access(i: number, j: number, k: number): number; - /** - * Retrieve the IJK coordinates of the voxel corresponding of the given index in the data. - * - * @param {number} index - Index of the voxel. - * @returns {Array} The IJK coordinates as `[x,y,z]`. - */ - reverseAccess(index: number): Array; - /** - * Apply a function to all the voxels, be careful, the value will be replaced. - * - * @param {Function} functionToMap A function to apply to every voxel, will be called with the following parameters: - * value of the voxel, index of the voxel, the data (TypedArray). - * @param {Object} context - You can specify a context in which call the function, default if this Volume. - * @returns {Volume} A reference to this instance. - */ - map(functionToMap: Function, context: Object): Volume; - /** - * Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, - * the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system. - * - * @param {('x'|'y'|'z')} axis - The normal axis to the slice. - * @param {number} RASIndex - The index of the slice. - * @returns {Object} An object containing all the useful information on the geometry of the slice. - */ - extractPerpendicularPlane(axis: ("x" | "y" | "z"), RASIndex: number): Object; - /** - * Returns a slice corresponding to the given axis and index. - * The coordinate are given in the Right Anterior Superior coordinate format. - * - * @param {('x'|'y'|'z')} axis - The normal axis to the slice. - * @param {number} index - The index of the slice. - * @returns {VolumeSlice} The extracted slice. - */ - extractSlice(axis: ("x" | "y" | "z"), index: number): VolumeSlice; - /** - * Call repaint on all the slices extracted from this volume. - * - * @see {@link VolumeSlice#repaint} - * @returns {Volume} A reference to this volume. - */ - repaintAllSlices(): Volume; - /** - * Compute the minimum and the maximum of the data in the volume. - * - * @returns {Array} The min/max data as `[min,max]`. - */ - computeMinMax(): Array; - min: number | undefined; - max: number | undefined; -} -import { VolumeSlice } from '../misc/VolumeSlice.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts b/jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts deleted file mode 100644 index a6b927a05..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/misc/VolumeSlice.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -/** - * This class has been made to hold a slice of a volume data. - * - * @see {@link Volume} - * @three_import import { VolumeSlice } from 'three/addons/misc/VolumeSlice.js'; - */ -export class VolumeSlice { - /** - * Constructs a new volume slice. - * - * @param {Volume} volume - The associated volume. - * @param {number} [index=0] - The index of the slice. - * @param {('x'|'y'|'z')} [axis='z'] - For now only 'x', 'y' or 'z' but later it will change to a normal vector. - */ - constructor(volume: Volume, index?: number, axis?: ("x" | "y" | "z")); - /** - * The associated volume. - * - * @type {Volume} - */ - volume: Volume; - /** - * The normal axis. - * - * @type {('x'|'y'|'z')} - */ - axis: ("x" | "y" | "z"); - /** - * The final canvas used for the texture. - * - * @type {HTMLCanvasElement} - */ - canvas: HTMLCanvasElement; - /** - * The rendering context of the canvas. - * - * @type {CanvasRenderingContext2D} - */ - ctx: CanvasRenderingContext2D; - /** - * The intermediary canvas used to paint the data. - * - * @type {HTMLCanvasElement} - */ - canvasBuffer: HTMLCanvasElement; - /** - * The rendering context of the canvas buffer, - * - * @type {CanvasRenderingContext2D} - */ - ctxBuffer: CanvasRenderingContext2D; - /** - * Width of slice in the original coordinate system, corresponds to the width of the buffer canvas. - * - * @type {number} - * @default 0 - */ - iLength: number; - /** - * Height of slice in the original coordinate system, corresponds to the height of the buffer canvas. - * - * @type {number} - * @default 0 - */ - jLength: number; - /** - * Function that allow the slice to access right data. - * - * @type {?Function} - * @see {@link Volume#extractPerpendicularPlane} - */ - sliceAccess: Function | null; - /** - * The mesh ready to get used in the scene. - * - * @type {Mesh} - */ - mesh: Mesh; - /** - * If set to `true`, `updateGeometry()` will be triggered at the next repaint. - * - * @type {boolean} - * @default true - */ - geometryNeedsUpdate: boolean; - /** - * Refresh the texture and the geometry if geometryNeedsUpdate is set to `true`. - */ - repaint(): void; - /** - * Refresh the geometry according to axis and index. - * @see {@link Volume#extractPerpendicularPlane} - */ - updateGeometry(): void; - matrix: any; - geometry: PlaneGeometry | undefined; -} -import { Mesh } from 'three'; -import { PlaneGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts deleted file mode 100644 index 9fd45f091..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifier.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * A modifier for making meshes bend around curves. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * import the class from `CurveModifierGPU.js`. - * - * @three_import import { Flow } from 'three/addons/modifiers/CurveModifier.js'; - */ -export class Flow { - /** - * Constructs a new Flow instance. - * - * @param {Mesh} mesh - The mesh to clone and modify to bend around the curve. - * @param {number} numberOfCurves - The amount of space that should preallocated for additional curves. - */ - constructor(mesh: Mesh, numberOfCurves?: number); - curveArray: any[]; - curveLengthArray: any[]; - object3D: import("three").Object3D; - splineTexture: DataTexture; - uniforms: Object; - /** - * Updates the curve for the given curve index. - * - * @param {number} index - The curve index. - * @param {Curve} curve - The curve that should be used to bend the mesh. - */ - updateCurve(index: number, curve: Curve): void; - /** - * Moves the mesh along the curve. - * - * @param {number} amount - The offset. - */ - moveAlongCurve(amount: number): void; -} -/** - * An instanced version of {@link Flow} for making meshes bend around curves, where the instances are placed on the curve. - * - * This module can only be used with {@link WebGLRenderer}. - * - * @augments Flow - * @three_import import { InstancedFlow } from 'three/addons/modifiers/CurveModifier.js'; - */ -export class InstancedFlow extends Flow { - /** - * Constructs a new InstancedFlow instance. - * - * @param {number} count - The number of instanced elements. - * @param {number} curveCount - The number of curves to preallocate for. - * @param {Geometry} geometry - The geometry to use for the instanced mesh. - * @param {Material} material - The material to use for the instanced mesh. - */ - constructor(count: number, curveCount: number, geometry: Geometry, material: Material); - offsets: any[]; - whichCurve: any[]; - /** - * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects - * This writes that information to the matrix and marks it as needing update. - * - * @param {number} index - The index of tge instanced element to update. - */ - writeChanges(index: number): void; - /** - * Move an individual element along the curve by a specific amount. - * - * @param {number} index - Which element to update. - * @param {number} offset - The offset. - */ - moveIndividualAlongCurve(index: number, offset: number): void; - /** - * Select which curve to use for an element. - * - * @param {number} index - The index of the instanced element to update. - * @param {number} curveNo - The index of the curve it should use. - */ - setCurve(index: number, curveNo: number): void; -} -import { DataTexture } from 'three'; -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts deleted file mode 100644 index c88b4f893..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/modifiers/CurveModifierGPU.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * A modifier for making meshes bend around curves. - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * import the class from `CurveModifier.js`. - * - * @three_import import { Flow } from 'three/addons/modifiers/CurveModifierGPU.js'; - */ -export class Flow { - /** - * Constructs a new Flow instance. - * - * @param {Mesh} mesh - The mesh to clone and modify to bend around the curve. - * @param {number} numberOfCurves - The amount of space that should preallocated for additional curves. - */ - constructor(mesh: Mesh, numberOfCurves?: number); - curveArray: any[]; - curveLengthArray: any[]; - object3D: import("three").Object3D; - splineTexture: DataTexture; - uniforms: Object; - /** - * Updates the curve for the given curve index. - * - * @param {number} index - The curve index. - * @param {Curve} curve - The curve that should be used to bend the mesh. - */ - updateCurve(index: number, curve: Curve): void; - /** - * Moves the mesh along the curve. - * - * @param {number} amount - The offset. - */ - moveAlongCurve(amount: number): void; -} -import { DataTexture } from 'three'; -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts deleted file mode 100644 index 65a5f1d5a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/modifiers/EdgeSplitModifier.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * The modifier can be used to split faces at sharp edges. This allows to compute - * normals without smoothing the edges which can lead to an improved visual result. - * - * ```js - * const modifier = new EdgeSplitModifier(); - * geometry = modifier.modify( geometry, Math.PI * 0.4 ); - * ``` - * - * @three_import import { EdgeSplitModifier } from 'three/addons/modifiers/EdgeSplitModifier.js'; - */ -export class EdgeSplitModifier { - /** - * Returns a new, modified version of the given geometry by applying an edge-split operation. - * Please note that the resulting geometry is always indexed. - * - * @param {BufferGeometry} geometry - The geometry to modify. - * @param {number} cutOffAngle - The cut off angle in radians. - * @param {boolean} [tryKeepNormals=true] - Whether to try to keep normals or not. - * @return {BufferGeometry} A new, modified geometry. - */ - modify(geometry: BufferGeometry, cutOffAngle: number, tryKeepNormals?: boolean): BufferGeometry; -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts deleted file mode 100644 index e15a42f5e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/modifiers/SimplifyModifier.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This class can be used to modify a geometry by simplifying it. A typical use - * case for such a modifier is automatic LOD generation. - * - * The implementation is based on [meshoptimizer]{@link https://github.com/zeux/meshoptimizer}. - * If you only need a simplified index buffer, use {@link MeshoptSimplifier} directly. - * - * ```js - * const modifier = new SimplifyModifier(); - * geometry = await modifier.modify( geometry, count ); - * ``` - * - * @three_import import { SimplifyModifier } from 'three/addons/modifiers/SimplifyModifier.js'; - */ -export class SimplifyModifier { - /** - * Returns a new, simplified version of the given geometry. The vertex buffers - * of the result only contain vertices referenced by the simplified index. - * - * @async - * @param {BufferGeometry} geometry - The geometry to modify. - * @param {number} count - The approximate number of vertices to remove. - * @return {Promise} A promise that resolves with the new, modified geometry. - */ - modify(geometry: BufferGeometry, count: number): Promise; -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts b/jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts deleted file mode 100644 index 58e45c699..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/modifiers/TessellateModifier.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This class can be used to modify a geometry by breaking its edges if they - * are longer than maximum length. - * - * ```js - * const modifier = new TessellateModifier( 8, 6 ); - * geometry = modifier.modify( geometry ); - * ``` - * - * @three_import import { TessellateModifier } from 'three/addons/modifiers/TessellateModifier.js'; - */ -export class TessellateModifier { - /** - * Constructs a new Tessellate modifier. - * - * @param {number} [maxEdgeLength=0.1] - The maximum edge length. - * @param {number} [maxIterations=6] - The number of iterations. - */ - constructor(maxEdgeLength?: number, maxIterations?: number); - /** - * The maximum edge length. - * - * @type {number} - * @default 0.1 - */ - maxEdgeLength: number; - /** - * The maximum edge length. - * - * @type {number} - * @default 0.1 - */ - maxIterations: number; - /** - * Returns a new, modified version of the given geometry by applying a tessellation. - * Please note that the resulting geometry is always non-indexed. - * - * @param {BufferGeometry} geometry - The geometry to modify. - * @return {BufferGeometry} A new, modified geometry. - */ - modify(geometry: BufferGeometry): BufferGeometry; -} -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts deleted file mode 100644 index 17efc123e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/GaussianSplat.d.ts +++ /dev/null @@ -1,126 +0,0 @@ -/** - * A minimal renderer for 3D Gaussian splat geometry. - * - * Note that this class can only be used with {@link WebGPURenderer}. The - * `forceWebGL` fallback of {@link WebGPURenderer} is supported, but - * {@link WebGLRenderer} is not. Import maps or package exports must resolve - * both `three/webgpu` and `three/tsl`. - * - * ```js - * const splats = new GaussianSplat( geometry ); - * scene.add( splats ); - * ``` - * - * @augments Mesh - * @three_import import { GaussianSplat } from 'three/addons/objects/GaussianSplat.js'; - */ -export class GaussianSplat extends Mesh { - /** - * Constructs a new Gaussian splat mesh. - * - * @param {BufferGeometry} splatGeometry - The splat geometry to render. Higher-order spherical harmonics attributes must use packed `Uint32Array` words from {@link createGaussianSplatGeometry} (`SH_BAND_WORDS[ degree ]` words per splat, four clamped-byte coefficients per word). - * @param {Object} [options] - Options. - * @param {boolean} [options.autoSort=true] - Whether to sort automatically in `onBeforeRender`. - */ - constructor(splatGeometry: BufferGeometry, { autoSort }?: { - autoSort?: boolean | undefined; - }); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isGaussianSplat: boolean; - /** - * The source splat geometry. - * - * @type {BufferGeometry} - */ - splatGeometry: BufferGeometry; - /** - * The bounding box of the splats. Can be computed via {@link GaussianSplat#computeBoundingBox}. - * - * @type {?Box3} - * @default null - */ - boundingBox: Box3 | null; - /** - * The bounding sphere of the splats. Can be computed via {@link GaussianSplat#computeBoundingSphere}. - * - * @type {?Sphere} - * @default null - */ - boundingSphere: Sphere | null; - /** - * Whether to sort automatically in `onBeforeRender`. - * - * @type {boolean} - */ - autoSort: boolean; - _buffers: { - count: any; - sphericalHarmonicsDegree: any; - webGLBuffersEnabled: boolean; - centerRead: import("three/webgpu").StorageBufferNode; - covarianceARead: import("three/webgpu").StorageBufferNode; - covarianceBRead: import("three/webgpu").StorageBufferNode; - colorRead: import("three/webgpu").StorageBufferNode; - }; - _sort: CountingSort; - _sortMatrix: import("three/webgpu").UniformNode; - _sortDepthRange: import("three/webgpu").UniformNode; - _sortInitialized: boolean; - _lastSortDirection: Vector3; - _localCameraPosition: import("three/webgpu").UniformNode; - _sphericalHarmonicsComputeNode: any; - _sphericalHarmonicsInitialized: boolean; - _lastSphericalHarmonicsCameraMatrix: Matrix4; - _lastSphericalHarmonicsWorldMatrix: Matrix4; - _sphericalHarmonicsVertexNode: void | null; - _precomputedSphericalHarmonicsVertexNode: void; - _positionAttribute: any; - onBeforeRender: (renderer: any, scene: any, camera: any) => void; - /** - * Updates the view-dependent spherical harmonics colors if the camera or - * mesh transform has changed. - * - * @param {Renderer} renderer - The renderer. - * @param {Camera} camera - The camera used for rendering. - * @return {boolean} Whether a compute pass was dispatched this call. - */ - updateSphericalHarmonics(renderer: Renderer, camera: Camera): boolean; - /** - * Computes the bounding box of the splats, updating {@link GaussianSplat#boundingBox}. - * - * Each splat is expanded by its own extent rather than treated as a point, so the bounds cover - * what is drawn. - */ - computeBoundingBox(): void; - /** - * Computes the bounding sphere of the splats, updating {@link GaussianSplat#boundingSphere}. - * - * Each splat is expanded by its own extent rather than treated as a point, so the bounds cover - * what is drawn. - */ - computeBoundingSphere(): void; - /** - * Updates the draw order if the camera or mesh orientation has changed enough - * to need a new sort. - * - * @param {Renderer} renderer - The renderer. - * @param {Camera} camera - The camera used for rendering. - * @return {boolean} Whether a sort was dispatched this call. - */ - updateSort(renderer: Renderer, camera: Camera): boolean; - _needsSort(camera: any): boolean; - _updateSortUniforms(camera: any): void; - _sortCPU(): void; -} -import { Mesh } from 'three/webgpu'; -import { Box3 } from 'three/webgpu'; -import { Sphere } from 'three/webgpu'; -import { CountingSort } from '../gpgpu/CountingSort.js'; -import { Vector3 } from 'three/webgpu'; -import { Matrix4 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts deleted file mode 100644 index 51d43e1ef..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/GroundedSkybox.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A ground-projected skybox. - * - * By default the object is centered at the camera, so it is often helpful to set - * `skybox.position.y = height` to put the ground at the origin. - * - * ```js - * const height = 15, radius = 100; - * - * const skybox = new GroundedSkybox( envMap, height, radius ); - * skybox.position.y = height; - * scene.add( skybox ); - * ``` - * - * @augments Mesh - * @three_import import { GroundedSkybox } from 'three/addons/objects/GroundedSkybox.js'; - */ -export class GroundedSkybox extends Mesh { - /** - * Constructs a new ground-projected skybox. - * - * @param {Texture} map - The environment map to use. - * @param {number} height - The height is how far the camera that took the photo was above the ground. - * A larger value will magnify the downward part of the image. - * @param {number} radius - The radius of the skybox. Must be large enough to ensure the scene's camera stays inside. - * @param {number} [resolution=128] - The geometry resolution of the skybox. - */ - constructor(map: Texture, height: number, radius: number, resolution?: number); -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts deleted file mode 100644 index 589ce3fc6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/Lensflare.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Creates a simulated lens flare that tracks a light. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link LensflareMesh}. - * - * ```js - * const light = new THREE.PointLight( 0xffffff, 1.5, 2000 ); - * - * const lensflare = new Lensflare(); - * lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) ); - * lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) ); - * lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) ); - * - * light.add( lensflare ); - * ``` - * - * @augments Mesh - * @three_import import { Lensflare } from 'three/addons/objects/Lensflare.js'; - */ -export class Lensflare extends Mesh { - /** - * Constructs a new lensflare. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLensflare: boolean; - /** - * Adds the given lensflare element to this instance. - * - * @param {LensflareElement} element - The element to add. - */ - addElement: (element: LensflareElement) => void; - onBeforeRender: (renderer: any, scene: any, camera: any) => void; -} -export namespace Lensflare { - let Geometry: BufferGeometry; -} -/** - * Represents a single flare that can be added to a {@link Lensflare} container. - * - * @three_import import { LensflareElement } from 'three/addons/objects/Lensflare.js'; - */ -export class LensflareElement { - /** - * Constructs a new lensflare element. - * - * @param {Texture} texture - The flare's texture. - * @param {number} [size=1] - The size in pixels. - * @param {number} [distance=0] - The normalized distance (`[0,1]`) from the light source. - * A value of `0` means the flare is located at light source. - * @param {Color} [color] - The flare's color - */ - constructor(texture: Texture, size?: number, distance?: number, color?: Color); - /** - * The flare's texture. - * - * @type {Texture} - */ - texture: Texture; - /** - * The size in pixels. - * - * @type {number} - * @default 1 - */ - size: number; - /** - * The normalized distance (`[0,1]`) from the light source. - * A value of `0` means the flare is located at light source. - * - * @type {number} - * @default 0 - */ - distance: number; - /** - * The flare's color - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; -} -export namespace LensflareElement { - namespace Shader { - let name: string; - namespace uniforms { - namespace map { - let value: null; - } - namespace occlusionMap { - let value_1: null; - export { value_1 as value }; - } - namespace color { - let value_2: null; - export { value_2 as value }; - } - namespace scale { - let value_3: null; - export { value_3 as value }; - } - namespace screenPosition { - let value_4: null; - export { value_4 as value }; - } - } - let vertexShader: string; - let fragmentShader: string; - } -} -import { Mesh } from 'three'; -import { BufferGeometry } from 'three'; -import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts deleted file mode 100644 index e42352db3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/LensflareMesh.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Creates a simulated lens flare that tracks a light. - * - * Note that this class can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, use {@link Lensflare}. - * - * ```js - * const light = new THREE.PointLight( 0xffffff, 1.5, 2000 ); - * - * const lensflare = new LensflareMesh(); - * lensflare.addElement( new LensflareElement( textureFlare0, 512, 0 ) ); - * lensflare.addElement( new LensflareElement( textureFlare1, 512, 0 ) ); - * lensflare.addElement( new LensflareElement( textureFlare2, 60, 0.6 ) ); - * - * light.add( lensflare ); - * ``` - * - * @augments Mesh - * @three_import import { LensflareMesh } from 'three/addons/objects/LensflareMesh.js'; - */ -export class LensflareMesh extends Mesh { - /** - * Constructs a new lensflare mesh. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLensflareMesh: boolean; - /** - * Adds the given lensflare element to this instance. - * - * @param {LensflareElement} element - The element to add. - */ - addElement: (element: LensflareElement) => void; - onBeforeRender: (renderer: any, scene: any, camera: any) => void; -} -export namespace LensflareMesh { - let Geometry: BufferGeometry; -} -export class LensflareElement { - constructor(texture: any, size?: number, distance?: number, color?: Color); - texture: any; - size: number; - distance: number; - color: Color; -} -import { Mesh } from 'three/webgpu'; -import { BufferGeometry } from 'three/webgpu'; -import { Color } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts deleted file mode 100644 index 8c6880e9f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/ReflectorForSSRPass.d.ts +++ /dev/null @@ -1,134 +0,0 @@ -/** - * ~Options - */ -export type ReflectorForSSRPass = { - /** - * - The reflector's color. - */ - color?: string | number | Color | undefined; - /** - * - The texture width. A higher value results in more clear reflections but is also more expensive. - */ - textureWidth?: number | undefined; - /** - * - The texture height. A higher value results in more clear reflections but is also more expensive. - */ - textureHeight?: number | undefined; - /** - * - The clip bias. - */ - clipBias?: number | undefined; - /** - * - Can be used to pass in a custom shader that defines how the reflective view is projected onto the reflector's geometry. - */ - shader?: Object | undefined; - /** - * - Whether to store depth values in a texture or not. - */ - useDepthTexture?: boolean | undefined; - /** - * - Resolution for the Reflector Pass. - */ - resolution?: Vector2 | undefined; -}; -import { Color } from 'three'; -import { Vector2 } from 'three'; -/** - * A special version of {@link Reflector} for usage with {@link SSRPass}. - * - * @augments Mesh - * @three_import import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js'; - */ -export class ReflectorForSSRPass extends Mesh { - /** - * Constructs a new reflector. - * - * @param {BufferGeometry} geometry - The reflector's geometry. - * @param {ReflectorForSSRPass~Options} [options] - The configuration options. - */ - constructor(geometry: BufferGeometry, options?: {}); - isReflectorForSSRPass: boolean; - needsUpdate: boolean; - maxDistance: number; - opacity: number; - color: Color; - resolution: any; - _distanceAttenuation: boolean; - _fresnel: boolean; - material: ShaderMaterial; - doRender: (renderer: any, scene: any, camera: any) => void; - /** - * Returns the reflector's internal render target. - * - * @return {WebGLRenderTarget} The internal render target - */ - getRenderTarget: () => WebGLRenderTarget; -} -export namespace ReflectorForSSRPass { - namespace ReflectorShader { - let name: string; - namespace defines { - let DISTANCE_ATTENUATION: boolean; - let FRESNEL: boolean; - } - namespace uniforms { - namespace color { - let value: null; - } - namespace tDiffuse { - let value_1: null; - export { value_1 as value }; - } - namespace tDepth { - let value_2: null; - export { value_2 as value }; - } - namespace textureMatrix { - let value_3: Matrix4; - export { value_3 as value }; - } - namespace maxDistance { - let value_4: number; - export { value_4 as value }; - } - namespace opacity { - let value_5: number; - export { value_5 as value }; - } - namespace fresnelCoe { - let value_6: null; - export { value_6 as value }; - } - namespace virtualCameraNear { - let value_7: null; - export { value_7 as value }; - } - namespace virtualCameraFar { - let value_8: null; - export { value_8 as value }; - } - namespace virtualCameraProjectionMatrix { - let value_9: Matrix4; - export { value_9 as value }; - } - namespace virtualCameraMatrixWorld { - let value_10: Matrix4; - export { value_10 as value }; - } - namespace virtualCameraProjectionMatrixInverse { - let value_11: Matrix4; - export { value_11 as value }; - } - namespace resolution { - let value_12: Vector2; - export { value_12 as value }; - } - } - let vertexShader: string; - let fragmentShader: string; - } -} -import { Mesh } from 'three'; -import { ShaderMaterial } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts deleted file mode 100644 index c55ab301e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/Refractor.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * ~Options - */ -export type Refractor = { - /** - * - The refractor's color. - */ - color?: string | number | Color | undefined; - /** - * - The texture width. A higher value results in more clear refractions but is also more expensive. - */ - textureWidth?: number | undefined; - /** - * - The texture height. A higher value results in more clear refractions but is also more expensive. - */ - textureHeight?: number | undefined; - /** - * - The clip bias. - */ - clipBias?: number | undefined; - /** - * - Can be used to pass in a custom shader that defines how the refractive view is projected onto the reflector's geometry. - */ - shader?: Object | undefined; - /** - * - How many samples to use for MSAA. `0` disables MSAA. - */ - multisample?: number | undefined; -}; -import { Color } from 'three'; -/** - * Can be used to create a flat, refractive surface like for special - * windows or water effects. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link viewportSharedTexture}. - * - * ```js - * const geometry = new THREE.PlaneGeometry( 100, 100 ); - * - * const refractor = new Refractor( refractorGeometry, { - * color: 0xcbcbcb, - * textureWidth: 1024, - * textureHeight: 1024 - * } ); - * - * scene.add( refractor ); - * ``` - * - * @augments Mesh - * @three_import import { Refractor } from 'three/addons/objects/Refractor.js'; - */ -export class Refractor extends Mesh { - /** - * Constructs a new refractor. - * - * @param {BufferGeometry} geometry - The refractor's geometry. - * @param {Refractor~Options} [options] - The configuration options. - */ - constructor(geometry: BufferGeometry, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRefractor: boolean; - /** - * The reflector's virtual camera. - * - * @type {PerspectiveCamera} - */ - camera: PerspectiveCamera; - material: ShaderMaterial; - onBeforeRender: (renderer: any, scene: any, camera: any) => void; - /** - * Returns the reflector's internal render target. - * - * @return {WebGLRenderTarget} The internal render target - */ - getRenderTarget: () => WebGLRenderTarget; -} -export namespace Refractor { - namespace RefractorShader { - let name: string; - namespace uniforms { - namespace color { - let value: null; - } - namespace tDiffuse { - let value_1: null; - export { value_1 as value }; - } - namespace textureMatrix { - let value_2: null; - export { value_2 as value }; - } - } - let vertexShader: string; - let fragmentShader: string; - } -} -import { Mesh } from 'three'; -import { PerspectiveCamera } from 'three'; -import { ShaderMaterial } from 'three'; -import { WebGLRenderTarget } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts deleted file mode 100644 index 41e8e275f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/ShadowMesh.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A Shadow Mesh that follows a shadow-casting mesh in the scene, - * but is confined to a single plane. This technique can be used as - * a very performant alternative to classic shadow mapping. However, - * it has serious limitations like: - * - * - Shadows can only be casted on flat planes. - * - No soft shadows support. - * - * ```js - * const cubeShadow = new ShadowMesh( cube ); - * scene.add( cubeShadow ); - * ``` - * - * @augments Mesh - * @three_import import { ShadowMesh } from 'three/addons/objects/ShadowMesh.js'; - */ -export class ShadowMesh extends Mesh { - /** - * Constructs a new shadow mesh. - * - * @param {Mesh} mesh - The shadow-casting reference mesh. - */ - constructor(mesh: Mesh); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowMesh: boolean; - /** - * Represent the world matrix of the reference mesh. - * - * @type {Matrix4} - */ - meshMatrix: Matrix4; - /** - * Updates the shadow mesh so it follows its shadow-casting reference mesh. - * - * @param {Plane} plane - The plane onto the shadow mesh is projected. - * @param {Vector4} lightPosition4D - The light position. - */ - update(plane: Plane, lightPosition4D: Vector4): void; -} -import { Mesh } from 'three'; -import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts deleted file mode 100644 index dbd0641e6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/Sky.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Represents a skydome for scene backgrounds. Based on [A Practical Analytic Model for Daylight](https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight) - * aka The Preetham Model, the de facto standard for analytical skydomes. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link SkyMesh}. - * - * More references: - * - * - {@link http://simonwallner.at/project/atmospheric-scattering/} - * - {@link http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR} - * - * - * ```js - * const sky = new Sky(); - * sky.scale.setScalar( 10000 ); - * scene.add( sky ); - * ``` - * - * It can be useful to hide the sun disc when generating an environment map to avoid artifacts - * - * ```js - * // disable before rendering environment map - * sky.material.uniforms.showSunDisc.value = false; - * // ... - * // re-enable before scene sky box rendering - * sky.material.uniforms.showSunDisc.value = true; - * ``` - * - * @augments Mesh - * @three_import import { Sky } from 'three/addons/objects/Sky.js'; - */ -export class Sky extends Mesh { - /** - * Constructs a new skydome. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSky: boolean; -} -export namespace Sky { - namespace SkyShader { - let name: string; - namespace uniforms { - namespace turbidity { - let value: number; - } - namespace rayleigh { - let value_1: number; - export { value_1 as value }; - } - namespace mieCoefficient { - let value_2: number; - export { value_2 as value }; - } - namespace mieDirectionalG { - let value_3: number; - export { value_3 as value }; - } - namespace sunPosition { - let value_4: Vector3; - export { value_4 as value }; - } - namespace up { - let value_5: Vector3; - export { value_5 as value }; - } - namespace cloudScale { - let value_6: number; - export { value_6 as value }; - } - namespace cloudSpeed { - let value_7: number; - export { value_7 as value }; - } - namespace cloudCoverage { - let value_8: number; - export { value_8 as value }; - } - namespace cloudDensity { - let value_9: number; - export { value_9 as value }; - } - namespace cloudElevation { - let value_10: number; - export { value_10 as value }; - } - namespace showSunDisc { - let value_11: number; - export { value_11 as value }; - } - namespace time { - let value_12: number; - export { value_12 as value }; - } - } - let vertexShader: string; - let fragmentShader: string; - } -} -import { Mesh } from 'three'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts deleted file mode 100644 index 825c2c2f7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/SkyMesh.d.ts +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Represents a skydome for scene backgrounds. Based on [A Practical Analytic Model for Daylight](https://www.researchgate.net/publication/220720443_A_Practical_Analytic_Model_for_Daylight) - * aka The Preetham Model, the de facto standard for analytical skydomes. - * - * Note that this class can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, use {@link Sky}. - * - * More references: - * - * - {@link http://simonwallner.at/project/atmospheric-scattering/} - * - {@link http://blenderartists.org/forum/showthread.php?245954-preethams-sky-impementation-HDR} - * - * ```js - * const sky = new SkyMesh(); - * sky.scale.setScalar( 10000 ); - * scene.add( sky ); - * ``` - * - * It can be useful to hide the sun disc when generating an environment map to avoid artifacts - * - * ```js - * // disable before rendering environment map - * sky.showSunDisc.value = false; - * // ... - * // re-enable before scene sky box rendering - * sky.showSunDisc.value = true; - * ``` - * - * @augments Mesh - * @three_import import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; - */ -export class SkyMesh extends Mesh { - /** - * Constructs a new skydome. - */ - constructor(); - /** - * The turbidity uniform. - * - * @type {UniformNode} - */ - turbidity: UniformNode; - /** - * The rayleigh uniform. - * - * @type {UniformNode} - */ - rayleigh: UniformNode; - /** - * The mieCoefficient uniform. - * - * @type {UniformNode} - */ - mieCoefficient: UniformNode; - /** - * The mieDirectionalG uniform. - * - * @type {UniformNode} - */ - mieDirectionalG: UniformNode; - /** - * The sun position uniform. - * - * @type {UniformNode} - */ - sunPosition: UniformNode; - /** - * The up position. - * - * @type {UniformNode} - */ - upUniform: UniformNode; - /** - * The cloud scale uniform. - * - * @type {UniformNode} - */ - cloudScale: UniformNode; - /** - * The cloud speed uniform. - * - * @type {UniformNode} - */ - cloudSpeed: UniformNode; - /** - * The cloud coverage uniform. - * - * @type {UniformNode} - */ - cloudCoverage: UniformNode; - /** - * The cloud density uniform. - * - * @type {UniformNode} - */ - cloudDensity: UniformNode; - /** - * The cloud elevation uniform. - * - * @type {UniformNode} - */ - cloudElevation: UniformNode; - /** - * Whether to render the solar disc. - * - * @type {UniformNode} - */ - showSunDisc: UniformNode; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - * @deprecated Use isSkyMesh instead. - */ - readonly isSky: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSkyMesh: boolean; -} -import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts deleted file mode 100644 index 4cbedafa7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/Water.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * ~Options - */ -export type Water = { - /** - * - The texture width. A higher value results in more clear reflections but is also more expensive. - */ - textureWidth?: number | undefined; - /** - * - The texture height. A higher value results in more clear reflections but is also more expensive. - */ - textureHeight?: number | undefined; - /** - * - The clip bias. - */ - clipBias?: number | undefined; - /** - * - The alpha value. - */ - alpha?: number | undefined; - /** - * - The time value. - */ - time?: number | undefined; - /** - * - The water's normal map. - */ - waterNormals?: Texture | null; - /** - * - The sun direction. - */ - sunDirection?: Vector3 | undefined; - /** - * - The sun color. - */ - sunColor?: string | number | Color | undefined; - /** - * - The water color. - */ - waterColor?: string | number | Color | undefined; - /** - * - The eye vector. - */ - eye?: Vector3 | undefined; - /** - * - The distortion scale. - */ - distortionScale?: number | undefined; - /** - * - The water material's `side` property. - */ - side?: (number | BackSide | DoubleSide); - /** - * - Whether the water should be affected by fog or not. - */ - fog?: boolean | undefined; -}; -import { Vector3 } from 'three'; -import { Color } from 'three'; -/** - * A basic flat, reflective water effect. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link WaterMesh}. - * - * References: - * - * - [Flat mirror for three.js](https://github.com/Slayvin) - * - [An implementation of water shader based on the flat mirror](https://home.adelphi.edu/~stemkoski/) - * - [Water shader explanations in WebGL](http://29a.ch/slides/2012/webglwater/ ) - * - * @augments Mesh - * @three_import import { Water } from 'three/addons/objects/Water.js'; - */ -export class Water extends Mesh { - /** - * Constructs a new water instance. - * - * @param {BufferGeometry} geometry - The water's geometry. - * @param {Water~Options} [options] - The configuration options. - */ - constructor(geometry: BufferGeometry, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWater: boolean; -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts deleted file mode 100644 index 515f144a6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/Water2.d.ts +++ /dev/null @@ -1,145 +0,0 @@ -/** - * :Water2~Options - */ -export type module = { - /** - * - The water color. - */ - color?: string | number | Color | undefined; - /** - * - The texture width. A higher value results in better quality but is also more expensive. - */ - textureWidth?: number | undefined; - /** - * - The texture height. A higher value results in better quality but is also more expensive. - */ - textureHeight?: number | undefined; - /** - * - The clip bias. - */ - clipBias?: number | undefined; - /** - * - The water's flow direction. - */ - flowDirection?: Vector2 | undefined; - /** - * - The water's flow speed. - */ - flowSpeed?: number | undefined; - /** - * - The water's reflectivity. - */ - reflectivity?: number | undefined; - /** - * - The water's scale. - */ - scale?: number | undefined; - /** - * - A custom water shader. - */ - shader?: Object | undefined; - /** - * - The flow map. If no flow map is assigned, the water flow is defined by `flowDirection`. - */ - flowMap?: Texture | null; - /** - * - The first water normal map. - */ - normalMap0?: Texture | null; - /** - * - The second water normal map. - */ - normalMap1?: Texture | null; -}; -/** @module Water2 */ -/** - * An advanced water effect that supports reflections, refractions and flow maps. - * - * Note that this class can only be used with {@link WebGLRenderer}. - * When using {@link WebGPURenderer}, use {@link module:Water2Mesh}. - * - * References: - * - * - {@link https://alex.vlachos.com/graphics/Vlachos-SIGGRAPH10-WaterFlow.pdf} - * - {@link http://graphicsrunner.blogspot.de/2010/08/water-using-flow-maps.html} - * - * @augments Mesh - * @three_import import { Water } from 'three/addons/objects/Water2.js'; - */ -export class Water extends Mesh { - /** - * Constructs a new water instance. - * - * @param {BufferGeometry} geometry - The water's geometry. - * @param {module:Water2~Options} [options] - The configuration options. - */ - constructor(geometry: BufferGeometry, options?: any); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWater: boolean; - onBeforeRender: (renderer: any, scene: any, camera: any) => void; -} -export namespace Water { - namespace WaterShader { - let name: string; - namespace uniforms { - namespace color { - let type: string; - let value: null; - } - namespace reflectivity { - let type_1: string; - export { type_1 as type }; - let value_1: number; - export { value_1 as value }; - } - namespace tReflectionMap { - let type_2: string; - export { type_2 as type }; - let value_2: null; - export { value_2 as value }; - } - namespace tRefractionMap { - let type_3: string; - export { type_3 as type }; - let value_3: null; - export { value_3 as value }; - } - namespace tNormalMap0 { - let type_4: string; - export { type_4 as type }; - let value_4: null; - export { value_4 as value }; - } - namespace tNormalMap1 { - let type_5: string; - export { type_5 as type }; - let value_5: null; - export { value_5 as value }; - } - namespace textureMatrix { - let type_6: string; - export { type_6 as type }; - let value_6: null; - export { value_6 as value }; - } - namespace config { - let type_7: string; - export { type_7 as type }; - let value_7: Vector4; - export { value_7 as value }; - } - } - let vertexShader: string; - let fragmentShader: string; - } -} -import { Color } from 'three'; -import { Vector2 } from 'three'; -import { Mesh } from 'three'; -import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts deleted file mode 100644 index 92371b2fd..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/Water2Mesh.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * :Water2Mesh~Options - */ -export type module = { - /** - * - The water color. - */ - color?: string | number | Color | undefined; - /** - * - The water's flow direction. - */ - flowDirection?: Vector2 | undefined; - /** - * - The water's flow speed. - */ - flowSpeed?: number | undefined; - /** - * - The water's reflectivity. - */ - reflectivity?: number | undefined; - /** - * - The water's scale. - */ - scale?: number | undefined; - /** - * - The flow map. If no flow map is assigned, the water flow is defined by `flowDirection`. - */ - flowMap?: Texture | null; - /** - * - The first water normal map. - */ - normalMap0: Texture; - /** - * - The second water normal map. - */ - normalMap1: Texture; -}; -/** @module Water2Mesh */ -/** - * An advanced water effect that supports reflections, refractions and flow maps. - * - * Note that this class can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, use {@link module:Water2}. - * - * References: - * - * - {@link https://alex.vlachos.com/graphics/Vlachos-SIGGRAPH10-WaterFlow.pdf} - * - {@link http://graphicsrunner.blogspot.de/2010/08/water-using-flow-maps.html} - * - * @augments Mesh - * @three_import import { WaterMesh } from 'three/addons/objects/Water2Mesh.js'; - */ -export class WaterMesh extends Mesh { - /** - * Constructs a new water mesh. - * - * @param {BufferGeometry} geometry - The water's geometry. - * @param {module:Water2~Options} [options] - The configuration options. - */ - constructor(geometry: BufferGeometry, options?: any); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWater: boolean; -} -import { Color } from 'three/webgpu'; -import { Vector2 } from 'three/webgpu'; -import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts b/jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts deleted file mode 100644 index 4fb266691..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/objects/WaterMesh.d.ts +++ /dev/null @@ -1,127 +0,0 @@ -/** - * ~Options - */ -export type WaterMesh = { - /** - * - The resolution scale. - */ - resolutionScale?: number | undefined; - /** - * - The water's normal map. - */ - waterNormals?: Texture | null; - /** - * - The alpha value. - */ - alpha?: number | undefined; - /** - * - The size value. - */ - size?: number | undefined; - /** - * - The sun color. - */ - sunColor?: string | number | Color | undefined; - /** - * - The sun direction. - */ - sunDirection?: Vector3 | undefined; - /** - * - The water color. - */ - waterColor?: string | number | Color | undefined; - /** - * - The distortion scale. - */ - distortionScale?: number | undefined; -}; -import { Color } from 'three/webgpu'; -import { Vector3 } from 'three/webgpu'; -/** - * A basic flat, reflective water effect. - * - * Note that this class can only be used with {@link WebGPURenderer}. - * When using {@link WebGLRenderer}, use {@link Water}. - * - * References: - * - * - [Flat mirror for three.js](https://github.com/Slayvin) - * - [An implementation of water shader based on the flat mirror](https://home.adelphi.edu/~stemkoski/) - * - [Water shader explanations in WebGL](http://29a.ch/slides/2012/webglwater/ ) - * - * @augments Mesh - * @three_import import { WaterMesh } from 'three/addons/objects/WaterMesh.js'; - */ -export class WaterMesh extends Mesh { - /** - * Constructs a new water mesh. - * - * @param {BufferGeometry} geometry - The water mesh's geometry. - * @param {WaterMesh~Options} [options] - The configuration options. - */ - constructor(geometry: BufferGeometry, options: any); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWaterMesh: boolean; - /** - * The effect's resolution scale. - * - * @type {number} - * @default 0.5 - */ - resolutionScale: number; - /** - * The water's normal map. - * - * @type {TextureNode} - */ - waterNormals: TextureNode; - /** - * The alpha value. - * - * @type {UniformNode} - * @default 1 - */ - alpha: UniformNode; - /** - * The size value. - * - * @type {UniformNode} - * @default 1 - */ - size: UniformNode; - /** - * The sun color. - * - * @type {UniformNode} - * @default 0xffffff - */ - sunColor: UniformNode; - /** - * The sun direction. - * - * @type {UniformNode} - * @default (0.70707,0.70707,0.0) - */ - sunDirection: UniformNode; - /** - * The water color. - * - * @type {UniformNode} - * @default 0x7f7f7f - */ - waterColor: UniformNode; - /** - * The distortion scale. - * - * @type {UniformNode} - * @default 20 - */ - distortionScale: UniformNode; -} -import { Mesh } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts b/jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts deleted file mode 100644 index 7729eb4da..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/offscreen/jank.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default initJank; -declare function initJank(): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts b/jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/offscreen/offscreen.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts b/jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts deleted file mode 100644 index 4f3b99c71..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/offscreen/scene.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default init; -declare function init(canvas: any, width: any, height: any, pixelRatio: any, path: any): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts b/jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts deleted file mode 100644 index 9494a16be..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/physics/AmmoPhysics.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @classdesc Can be used to include Ammo.js as a Physics engine into - * `three.js` apps. The API can be initialized via: - * ```js - * const physics = await AmmoPhysics(); - * ``` - * The component automatically imports Ammo.js from a CDN so make sure - * to use the component with an active Internet connection. - * - * @name AmmoPhysics - * @class - * @hideconstructor - * @three_import import { AmmoPhysics } from 'three/addons/physics/AmmoPhysics.js'; - */ -export function AmmoPhysics(): Promise<{ - /** - * Adds the given scene to this physics simulation. Only meshes with a - * `physics` object in their {@link Object3D#userData} field will be honored. - * The object can be used to store the mass of the mesh. E.g.: - * ```js - * box.userData.physics = { mass: 1 }; - * ``` - * - * @method - * @name AmmoPhysics#addScene - * @param {Object3D} scene The scene or any type of 3D object to add. - */ - addScene: (scene: any) => void; - /** - * Adds the given mesh to this physics simulation. - * - * @method - * @name AmmoPhysics#addMesh - * @param {Mesh} mesh The mesh to add. - * @param {number} [mass=0] The mass in kg of the mesh. - * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. - */ - addMesh: (mesh: any, mass?: number, restitution?: number) => void; - /** - * Set the position of the given mesh which is part of the physics simulation. Calling this - * method will reset the current simulated velocity of the mesh. - * - * @method - * @name AmmoPhysics#setMeshPosition - * @param {Mesh} mesh The mesh to update the position for. - * @param {Vector3} position - The new position. - * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. - */ - setMeshPosition: (mesh: any, position: any, index?: number) => void; -}>; -export class AmmoPhysics { -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts b/jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts deleted file mode 100644 index d6ab661fe..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/physics/JoltPhysics.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @classdesc Can be used to include Jolt as a Physics engine into - * `three.js` apps. The API can be initialized via: - * ```js - * const physics = await JoltPhysics(); - * ``` - * The component automatically imports Jolt from a CDN so make sure - * to use the component with an active Internet connection. - * - * @name JoltPhysics - * @class - * @hideconstructor - * @three_import import { JoltPhysics } from 'three/addons/physics/JoltPhysics.js'; - */ -export function JoltPhysics(): Promise<{ - /** - * Adds the given scene to this physics simulation. Only meshes with a - * `physics` object in their {@link Object3D#userData} field will be honored. - * The object can be used to store the mass and restitution of the mesh. E.g.: - * ```js - * box.userData.physics = { mass: 1, restitution: 0 }; - * ``` - * - * @method - * @name JoltPhysics#addScene - * @param {Object3D} scene The scene or any type of 3D object to add. - */ - addScene: (scene: any) => void; - /** - * Adds the given mesh to this physics simulation. - * - * @method - * @name JoltPhysics#addMesh - * @param {Mesh} mesh The mesh to add. - * @param {number} [mass=0] The mass in kg of the mesh. - * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. - */ - addMesh: (mesh: any, mass?: number, restitution?: number) => void; - /** - * Set the position of the given mesh which is part of the physics simulation. Calling this - * method will reset the current simulated velocity of the mesh. - * - * @method - * @name JoltPhysics#setMeshPosition - * @param {Mesh} mesh The mesh to update the position for. - * @param {Vector3} position - The new position. - * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. - */ - setMeshPosition: (mesh: any, position: any, index?: number) => void; - setMeshVelocity: () => void; -}>; -export class JoltPhysics { -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts b/jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts deleted file mode 100644 index cf3f9fb28..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/physics/RapierPhysics.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @classdesc Can be used to include Rapier as a Physics engine into - * `three.js` apps. The API can be initialized via: - * ```js - * const physics = await RapierPhysics(); - * ``` - * The component automatically imports Rapier from a CDN so make sure - * to use the component with an active Internet connection. - * - * @name RapierPhysics - * @class - * @hideconstructor - * @three_import import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; - */ -export function RapierPhysics(): Promise<{ - RAPIER: any; - world: any; - /** - * Adds the given scene to this physics simulation. Only meshes with a - * `physics` object in their {@link Object3D#userData} field will be honored. - * The object can be used to store the mass and restitution of the mesh. E.g.: - * ```js - * box.userData.physics = { mass: 1, restitution: 0 }; - * ``` - * - * @method - * @name RapierPhysics#addScene - * @param {Object3D} scene The scene or any type of 3D object to add. - */ - addScene: (scene: any) => void; - /** - * Adds the given mesh to this physics simulation. - * - * @method - * @name RapierPhysics#addMesh - * @param {Mesh} mesh The mesh to add. - * @param {number} [mass=0] The mass in kg of the mesh. - * @param {number} [restitution=0] The restitution of the mesh, usually from 0 to 1. Represents how "bouncy" objects are when they collide with each other. - */ - addMesh: (mesh: any, mass?: number, restitution?: number) => void; - /** - * Removes the given mesh from this physics simulation. - * - * @method - * @name RapierPhysics#removeMesh - * @param {Mesh} mesh The mesh to remove. - */ - removeMesh: (mesh: any) => void; - /** - * Set the position of the given mesh which is part of the physics simulation. Calling this - * method will reset the current simulated velocity of the mesh. - * - * @method - * @name RapierPhysics#setMeshPosition - * @param {Mesh} mesh The mesh to update the position for. - * @param {Vector3} position - The new position. - * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. - */ - setMeshPosition: (mesh: any, position: any, index?: number) => void; - /** - * Set the velocity of the given mesh which is part of the physics simulation. - * - * @method - * @name RapierPhysics#setMeshVelocity - * @param {Mesh} mesh The mesh to update the velocity for. - * @param {Vector3} velocity - The new velocity. - * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. - */ - setMeshVelocity: (mesh: any, velocity: any, index?: number) => void; - /** - * Adds a heightfield terrain to the physics simulation. - * - * @method - * @name RapierPhysics#addHeightfield - * @param {Mesh} mesh - The Three.js mesh representing the terrain. - * @param {number} width - The number of vertices along the width (x-axis) of the heightfield. - * @param {number} depth - The number of vertices along the depth (z-axis) of the heightfield. - * @param {Float32Array} heights - Array of height values for each vertex in the heightfield. - * @param {Object} scale - Scale factors for the heightfield dimensions. - * @param {number} scale.x - Scale factor for width. - * @param {number} scale.y - Scale factor for height. - * @param {number} scale.z - Scale factor for depth. - * @returns {RigidBody} The created Rapier rigid body for the heightfield. - */ - addHeightfield: (mesh: any, width: any, depth: any, heights: any, scale: any) => any; - /** - * Applies an impulse to the given mesh which is part of the physics simulation. - * - * @method - * @name RapierPhysics#applyImpulse - * @param {Mesh} mesh - The mesh to apply the impulse to. - * @param {Vector3} impulse - The impulse to apply. - * @param {number} [index=0] - If the mesh is instanced, the index represents the instanced ID. - */ - applyImpulse: (mesh: any, impulse: any, index?: number) => void; -}>; -export class RapierPhysics { -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts deleted file mode 100644 index ce505f2d5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/AfterimagePass.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Pass for a basic after image effect. - * - * ```js - * const afterimagePass = new AfterimagePass( 0.9 ); - * composer.addPass( afterimagePass ); - * ``` - * - * @augments Pass - * @three_import import { AfterimagePass } from 'three/addons/postprocessing/AfterimagePass.js'; - */ -export class AfterimagePass extends Pass { - /** - * Constructs a new after image pass. - * - * @param {number} [damp=0.96] - The damping intensity. A higher value means a stronger after image effect. - */ - constructor(damp?: number); - /** - * The pass uniforms. Use this object if you want to update the - * `damp` value at runtime. - * ```js - * pass.uniforms.damp.value = 0.9; - * ``` - * - * @type {Object} - */ - uniforms: Object; - set damp(value: number); - /** - * The damping intensity, from 0.0 to 1.0. A higher value means a stronger after image effect. - * - * @type {number} - */ - get damp(): number; - /** - * The composition material. - * - * @type {ShaderMaterial} - */ - compFsMaterial: ShaderMaterial; - /** - * The copy material. - * - * @type {ShaderMaterial} - */ - copyFsMaterial: ShaderMaterial; - _textureComp: WebGLRenderTarget; - _textureOld: WebGLRenderTarget; - _compFsQuad: FullScreenQuad; - _copyFsQuad: FullScreenQuad; - /** - * Performs the after image pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts deleted file mode 100644 index 97155abd9..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BloomPass.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * A pass for a basic Bloom effect. - * - * {@link UnrealBloomPass} produces a more advanced Bloom but is also - * more expensive. - * - * ```js - * const effectBloom = new BloomPass( 0.75 ); - * composer.addPass( effectBloom ); - * ``` - * - * @augments Pass - * @three_import import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; - */ -export class BloomPass extends Pass { - /** - * Constructs a new Bloom pass. - * - * @param {number} [strength=1] - The Bloom strength. - * @param {number} [kernelSize=25] - The kernel size. - * @param {number} [sigma=4] - The sigma. - */ - constructor(strength?: number, kernelSize?: number, sigma?: number); - /** - * The combine pass uniforms. - * - * @type {Object} - */ - combineUniforms: Object; - /** - * The combine pass material. - * - * @type {ShaderMaterial} - */ - materialCombine: ShaderMaterial; - /** - * The convolution pass uniforms. - * - * @type {Object} - */ - convolutionUniforms: Object; - /** - * The convolution pass material. - * - * @type {ShaderMaterial} - */ - materialConvolution: ShaderMaterial; - _renderTargetX: WebGLRenderTarget; - _renderTargetY: WebGLRenderTarget; - _fsQuad: FullScreenQuad; - /** - * Performs the Bloom pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; -} -export namespace BloomPass { - let blurX: Vector2; - let blurY: Vector2; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { FullScreenQuad } from './Pass.js'; -import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts deleted file mode 100644 index 22a5e5f4a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/BokehPass.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * ~Options - */ -export type BokehPass = { - /** - * - Defines the effect's focus which is the distance along the camera's look direction in world units. - */ - focus?: number | undefined; - /** - * - Defines the effect's aperture. - */ - aperture?: number | undefined; - /** - * - Defines the effect's maximum blur. - */ - maxblur?: number | undefined; -}; -/** - * Pass for creating depth of field (DOF) effect. - * - * ```js - * const bokehPass = new BokehPass( scene, camera, { - * focus: 500 - * aperture: 5, - * maxblur: 0.01 - * } ); - * composer.addPass( bokehPass ); - * ``` - * - * @augments Pass - * @three_import import { BokehPass } from 'three/addons/postprocessing/BokehPass.js'; - */ -export class BokehPass extends Pass { - /** - * Constructs a new Bokeh pass. - * - * @param {Scene} scene - The scene to render the DOF for. - * @param {Camera} camera - The camera. - * @param {BokehPass~Options} params - The pass options. - */ - constructor(scene: Scene, camera: Camera, params: any); - /** - * The scene to render the DOF for. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - _renderTargetDepth: WebGLRenderTarget; - _materialDepth: MeshDepthMaterial; - /** - * The pass bokeh material. - * - * @type {ShaderMaterial} - */ - materialBokeh: ShaderMaterial; - /** - * The pass uniforms. Use this object if you want to update the - * `focus`, `aperture` or `maxblur` values at runtime. - * - * ```js - * pass.uniforms.focus.value = focus; - * pass.uniforms.aperture.value = aperture; - * pass.uniforms.maxblur.value = maxblur; - * ``` - * - * @type {Object} - */ - uniforms: Object; - _fsQuad: FullScreenQuad; - _oldClearColor: Color; - /** - * Performs the Bokeh pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; -} -import { Pass } from './Pass.js'; -import { WebGLRenderTarget } from 'three'; -import { MeshDepthMaterial } from 'three'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; -import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts deleted file mode 100644 index 1e974da1b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ClearPass.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * This class can be used to force a clear operation for the current read or - * default framebuffer (when rendering to screen). - * - * ```js - * const clearPass = new ClearPass(); - * composer.addPass( clearPass ); - * ``` - * - * @augments Pass - * @three_import import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; - */ -export class ClearPass extends Pass { - /** - * Constructs a new clear pass. - * - * @param {(number|Color|string)} [clearColor=0x000000] - The clear color. - * @param {number} [clearAlpha=0] - The clear alpha. - */ - constructor(clearColor?: (number | Color | string), clearAlpha?: number); - /** - * The clear color. - * - * @type {(number|Color|string)} - * @default 0x000000 - */ - clearColor: (number | Color | string); - /** - * The clear alpha. - * - * @type {number} - * @default 0 - */ - clearAlpha: number; - _oldClearColor: Color; - /** - * Performs the clear operation. This affects the current read or the default framebuffer. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts deleted file mode 100644 index e67221297..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/CubeTexturePass.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This pass can be used to render a cube texture over the entire screen. - * - * ```js - * const cubeMap = new THREE.CubeTextureLoader().load( urls ); - * - * const cubeTexturePass = new CubeTexturePass( camera, cubemap ); - * composer.addPass( cubeTexturePass ); - * ``` - * - * @augments Pass - * @three_import import { CubeTexturePass } from 'three/addons/postprocessing/CubeTexturePass.js'; - */ -export class CubeTexturePass extends Pass { - /** - * Constructs a new cube texture pass. - * - * @param {PerspectiveCamera} camera - The camera. - * @param {CubeTexture} tCube - The cube texture to render. - * @param {number} [opacity=1] - The opacity. - */ - constructor(camera: PerspectiveCamera, tCube: CubeTexture, opacity?: number); - /** - * The camera. - * - * @type {PerspectiveCamera} - */ - camera: PerspectiveCamera; - /** - * The cube texture to render. - * - * @type {CubeTexture} - */ - tCube: CubeTexture; - /** - * The opacity. - * - * @type {number} - * @default 1 - */ - opacity: number; - _cubeMesh: Mesh; - _cubeScene: Scene; - _cubeCamera: PerspectiveCamera; - /** - * Performs the cube texture pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { PerspectiveCamera } from 'three'; -import { Mesh } from 'three'; -import { Scene } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts deleted file mode 100644 index 295052177..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/DotScreenPass.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Pass for creating a dot-screen effect. - * - * ```js - * const pass = new DotScreenPass( new THREE.Vector2( 0, 0 ), 0.5, 0.8 ); - * composer.addPass( pass ); - * ``` - * - * @augments Pass - * @three_import import { DotScreenPass } from 'three/addons/postprocessing/DotScreenPass.js'; - */ -export class DotScreenPass extends Pass { - /** - * Constructs a new dot screen pass. - * - * @param {Vector2} center - The center point. - * @param {number} angle - The rotation of the effect in radians. - * @param {number} scale - The scale of the effect. A higher value means smaller dots. - */ - constructor(center: Vector2, angle: number, scale: number); - /** - * The pass uniforms. Use this object if you want to update the - * `center`, `angle` or `scale` values at runtime. - * ```js - * pass.uniforms.center.value.copy( center ); - * pass.uniforms.angle.value = 0; - * pass.uniforms.scale.value = 0.5; - * ``` - * - * @type {Object} - */ - uniforms: Object; - /** - * The pass material. - * - * @type {ShaderMaterial} - */ - material: ShaderMaterial; - _fsQuad: FullScreenQuad; - /** - * Performs the dot screen pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts deleted file mode 100644 index ba4d2c368..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/EffectComposer.d.ts +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Used to implement post-processing effects in three.js. - * The class manages a chain of post-processing passes to produce the final visual result. - * Post-processing passes are executed in order of their addition/insertion. - * The last pass is automatically rendered to screen. - * - * This module can only be used with {@link WebGLRenderer}. - * - * ```js - * const composer = new EffectComposer( renderer ); - * - * // adding some passes - * const renderPass = new RenderPass( scene, camera ); - * composer.addPass( renderPass ); - * - * const glitchPass = new GlitchPass(); - * composer.addPass( glitchPass ); - * - * const outputPass = new OutputPass() - * composer.addPass( outputPass ); - * - * function animate() { - * - * composer.render(); // instead of renderer.render() - * - * } - * ``` - * - * @three_import import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; - */ -export class EffectComposer { - /** - * Constructs a new effect composer. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} [renderTarget] - This render target and a clone will - * be used as the internal read and write buffers. If not given, the composer creates - * the buffers automatically. - */ - constructor(renderer: WebGLRenderer, renderTarget?: WebGLRenderTarget); - /** - * The renderer. - * - * @type {WebGLRenderer} - */ - renderer: WebGLRenderer; - _pixelRatio: any; - _width: any; - _height: any; - renderTarget1: WebGLRenderTarget; - renderTarget2: import("three").RenderTarget; - /** - * A reference to the internal write buffer. Passes usually write - * their result into this buffer. - * - * @type {WebGLRenderTarget} - */ - writeBuffer: WebGLRenderTarget; - /** - * A reference to the internal read buffer. Passes usually read - * the previous render result from this buffer. - * - * @type {WebGLRenderTarget} - */ - readBuffer: WebGLRenderTarget; - /** - * Whether the final pass is rendered to the screen (default framebuffer) or not. - * - * @type {boolean} - * @default true - */ - renderToScreen: boolean; - /** - * An array representing the (ordered) chain of post-processing passes. - * - * @type {Array} - */ - passes: Array; - /** - * A copy pass used for internal swap operations. - * - * @private - * @type {ShaderPass} - */ - private copyPass; - /** - * The internal timer for managing time data. - * - * @private - * @type {Timer} - */ - private timer; - /** - * Swaps the internal read/write buffers. - */ - swapBuffers(): void; - /** - * Adds the given pass to the pass chain. - * - * @param {Pass} pass - The pass to add. - */ - addPass(pass: Pass): void; - /** - * Inserts the given pass at a given index. - * - * @param {Pass} pass - The pass to insert. - * @param {number} index - The index into the pass chain. - */ - insertPass(pass: Pass, index: number): void; - /** - * Removes the given pass from the pass chain. - * - * @param {Pass} pass - The pass to remove. - */ - removePass(pass: Pass): void; - /** - * Returns `true` if the pass for the given index is the last enabled pass in the pass chain. - * - * @param {number} passIndex - The pass index. - * @return {boolean} Whether the pass for the given index is the last pass in the pass chain. - */ - isLastEnabledPass(passIndex: number): boolean; - /** - * Executes all enabled post-processing passes in order to produce the final frame. - * - * @param {number} deltaTime - The delta time in seconds. If not given, the composer computes - * its own time delta value. - */ - render(deltaTime: number): void; - /** - * Resets the internal state of the EffectComposer. - * - * @param {WebGLRenderTarget} [renderTarget] - This render target has the same purpose like - * the one from the constructor. If set, it is used to setup the read and write buffers. - */ - reset(renderTarget?: WebGLRenderTarget): void; - /** - * Resizes the internal read and write buffers as well as all passes. Similar to {@link WebGLRenderer#setSize}, - * this method honors the current pixel ration. - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - */ - setSize(width: number, height: number): void; - /** - * Sets device pixel ratio. This is usually used for HiDPI device to prevent blurring output. - * Setting the pixel ratio will automatically resize the composer. - * - * @param {number} pixelRatio - The pixel ratio to set. - */ - setPixelRatio(pixelRatio: number): void; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever the composer is no longer used in your app. - */ - dispose(): void; -} -import { WebGLRenderTarget } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts deleted file mode 100644 index 9bcbeed49..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FXAAPass.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A pass for applying FXAA. - * - * ```js - * const fxaaPass = new FXAAPass(); - * composer.addPass( fxaaPass ); - * ``` - * - * @augments ShaderPass - * @three_import import { FXAAPass } from 'three/addons/postprocessing/FXAAPass.js'; - */ -export class FXAAPass extends ShaderPass { - /** - * Constructs a new FXAA pass. - */ - constructor(); - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; -} -import { ShaderPass } from './ShaderPass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts deleted file mode 100644 index 14d8c1255..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/FilmPass.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This pass can be used to create a film grain effect. - * - * ```js - * const filmPass = new FilmPass(); - * composer.addPass( filmPass ); - * ``` - * - * @augments Pass - * @three_import import { FilmPass } from 'three/addons/postprocessing/FilmPass.js'; - */ -export class FilmPass extends Pass { - /** - * Constructs a new film pass. - * - * @param {number} [intensity=0.5] - The grain intensity in the range `[0,1]` (0 = no effect, 1 = full effect). - * @param {boolean} [grayscale=false] - Whether to apply a grayscale effect or not. - */ - constructor(intensity?: number, grayscale?: boolean); - /** - * The pass uniforms. Use this object if you want to update the - * `intensity` or `grayscale` values at runtime. - * ```js - * pass.uniforms.intensity.value = 1; - * pass.uniforms.grayscale.value = true; - * ``` - * - * @type {Object} - */ - uniforms: Object; - /** - * The pass material. - * - * @type {ShaderMaterial} - */ - material: ShaderMaterial; - _fsQuad: FullScreenQuad; - /** - * Performs the film pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number): void; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts deleted file mode 100644 index 5188ebe80..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GTAOPass.d.ts +++ /dev/null @@ -1,184 +0,0 @@ -/** - * A pass for an GTAO effect. - * - * `GTAOPass` provides better quality than {@link SSAOPass} but is also more expensive. - * - * ```js - * const gtaoPass = new GTAOPass( scene, camera, width, height ); - * gtaoPass.output = GTAOPass.OUTPUT.Denoise; - * composer.addPass( gtaoPass ); - * ``` - * - * @augments Pass - * @three_import import { GTAOPass } from 'three/addons/postprocessing/GTAOPass.js'; - */ -export class GTAOPass extends Pass { - /** - * Constructs a new GTAO pass. - * - * @param {Scene} scene - The scene to compute the AO for. - * @param {Camera} camera - The camera. - * @param {number} [width=512] - The width of the effect. - * @param {number} [height=512] - The height of the effect. - * @param {Object} [parameters] - The pass parameters. - * @param {Object} [aoParameters] - The AO parameters. - * @param {Object} [pdParameters] - The denoise parameters. - */ - constructor(scene: Scene, camera: Camera, width?: number, height?: number, parameters?: Object, aoParameters?: Object, pdParameters?: Object); - /** - * The width of the effect. - * - * @type {number} - * @default 512 - */ - width: number; - /** - * The height of the effect. - * - * @type {number} - * @default 512 - */ - height: number; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * The scene to render the AO for. - * - * @type {Scene} - */ - scene: Scene; - /** - * The output configuration. - * - * @type {number} - * @default 0 - */ - output: number; - _renderGBuffer: boolean; - _visibilityCache: any[]; - /** - * The AO blend intensity. - * - * @type {number} - * @default 1 - */ - blendIntensity: number; - /** - * The number of Poisson Denoise rings. - * - * @type {number} - * @default 2 - */ - pdRings: number; - /** - * The Poisson Denoise radius exponent. - * - * @type {number} - * @default 2 - */ - pdRadiusExponent: number; - /** - * The Poisson Denoise sample count. - * - * @type {number} - * @default 16 - */ - pdSamples: number; - gtaoNoiseTexture: DataTexture; - pdNoiseTexture: DataTexture; - gtaoRenderTarget: WebGLRenderTarget; - pdRenderTarget: import("three").RenderTarget; - gtaoMaterial: ShaderMaterial; - normalMaterial: MeshNormalMaterial; - pdMaterial: ShaderMaterial; - depthRenderMaterial: ShaderMaterial; - copyMaterial: ShaderMaterial; - blendMaterial: ShaderMaterial; - _fsQuad: FullScreenQuad; - _originalClearColor: Color; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * A texture holding the computed AO. - * - * @type {Texture} - * @readonly - */ - readonly get gtaoMap(): Texture; - /** - * Configures the GBuffer of this pass. If no arguments are passed, - * the pass creates an internal render target for holding depth - * and normal data. - * - * @param {DepthTexture} [depthTexture] - The depth texture. - * @param {DepthTexture} [normalTexture] - The normal texture. - */ - setGBuffer(depthTexture?: DepthTexture, normalTexture?: DepthTexture): void; - depthTexture: DepthTexture | undefined; - normalTexture: import("three").Texture | DepthTexture | undefined; - normalRenderTarget: WebGLRenderTarget | undefined; - /** - * Configures the clip box of the GTAO shader with the given AABB. - * - * @param {?Box3} box - The AABB enclosing the scene that should receive AO. When passing - * `null`, to clip box is used. - */ - setSceneClipBox(box: Box3 | null): void; - /** - * Updates the GTAO material from the given parameter object. - * - * @param {Object} parameters - The GTAO material parameters. - */ - updateGtaoMaterial(parameters: Object): void; - /** - * Updates the Denoise material from the given parameter object. - * - * @param {Object} parameters - The denoise parameters. - */ - updatePdMaterial(parameters: Object): void; - /** - * Performs the GTAO pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; - _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; - _overrideVisibility(): void; - _restoreVisibility(): void; - _generateNoise(size?: number): DataTexture; -} -export namespace GTAOPass { - namespace OUTPUT { - let Off: number; - let Default: number; - let Diffuse: number; - let Depth: number; - let Normal: number; - let AO: number; - let Denoise: number; - } -} -import { Pass } from './Pass.js'; -import { DataTexture } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { ShaderMaterial } from 'three'; -import { MeshNormalMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; -import { Color } from 'three'; -import { DepthTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts deleted file mode 100644 index 2ca364516..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/GlitchPass.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Pass for creating a glitch effect. - * - * ```js - * const glitchPass = new GlitchPass(); - * composer.addPass( glitchPass ); - * ``` - * - * @augments Pass - * @three_import import { GlitchPass } from 'three/addons/postprocessing/GlitchPass.js'; - */ -export class GlitchPass extends Pass { - /** - * Constructs a new glitch pass. - * - * @param {number} [dt_size=64] - The size of the displacement texture - * for digital glitch squares. - */ - constructor(dt_size?: number); - /** - * The pass uniforms. - * - * @type {Object} - */ - uniforms: Object; - /** - * The pass material. - * - * @type {ShaderMaterial} - */ - material: ShaderMaterial; - /** - * Whether to noticeably increase the effect intensity or not. - * - * @type {boolean} - * @default false - */ - goWild: boolean; - _heightMap: DataTexture; - _fsQuad: FullScreenQuad; - _curF: number; - _randX: number; - /** - * Performs the glitch pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - _generateTrigger(): void; - _generateHeightmap(dt_size: any): DataTexture; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { DataTexture } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts deleted file mode 100644 index a3907b4d1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/HalftonePass.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Pass for creating a RGB halftone effect. - * - * ```js - * const params = { - * shape: 1, - * radius: 4, - * rotateR: Math.PI / 12, - * rotateB: Math.PI / 12 * 2, - * rotateG: Math.PI / 12 * 3, - * scatter: 0, - * blending: 1, - * blendingMode: 1, - * greyscale: false, - * disable: false - * }; - * const halftonePass = new HalftonePass( params ); - * composer.addPass( halftonePass ); - * ``` - * - * @augments Pass - * @three_import import { HalftonePass } from 'three/addons/postprocessing/HalftonePass.js'; - */ -export class HalftonePass extends Pass { - /** - * Constructs a new halftone pass. - * - * @param {Object} params - The halftone shader parameter. - */ - constructor(params: Object); - /** - * The pass uniforms. - * - * @type {Object} - */ - uniforms: Object; - /** - * The pass material. - * - * @type {ShaderMaterial} - */ - material: ShaderMaterial; - _fsQuad: FullScreenQuad; - /** - * Performs the halftone pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts deleted file mode 100644 index 0cc065935..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/LUTPass.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Pass for color grading via lookup tables. - * - * ```js - * const lutPass = new LUTPass( { lut: lut.texture3D } ); - * composer.addPass( lutPass ); - * ``` - * - * @augments ShaderPass - * @three_import import { LUTPass } from 'three/addons/postprocessing/LUTPass.js'; - */ -export class LUTPass extends ShaderPass { - /** - * Constructs a LUT pass. - * - * @param {{lut:Data3DTexture,intensity:number}} [options={}] - The pass options. - */ - constructor(options?: { - lut: Data3DTexture; - intensity: number; - }); - set lut(v: any); - get lut(): any; - set intensity(v: any); - get intensity(): any; -} -import { ShaderPass } from './ShaderPass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts deleted file mode 100644 index 2563d270d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/MaskPass.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * This pass can be used to define a mask during post processing. - * Meaning only areas of subsequent post processing are affected - * which lie in the masking area of this pass. Internally, the masking - * is implemented with the stencil buffer. - * - * ```js - * const maskPass = new MaskPass( scene, camera ); - * composer.addPass( maskPass ); - * ``` - * - * @augments Pass - * @three_import import { MaskPass } from 'three/addons/postprocessing/MaskPass.js'; - */ -export class MaskPass extends Pass { - /** - * Constructs a new mask pass. - * - * @param {Scene} scene - The 3D objects in this scene will define the mask. - * @param {Camera} camera - The camera. - */ - constructor(scene: Scene, camera: Camera); - /** - * The scene that defines the mask. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * Whether to inverse the mask or not. - * - * @type {boolean} - * @default false - */ - inverse: boolean; - /** - * Performs a mask pass with the configured scene and camera. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -/** - * This pass can be used to clear a mask previously defined with {@link MaskPass}. - * - * ```js - * const clearPass = new ClearMaskPass(); - * composer.addPass( clearPass ); - * ``` - * - * @augments Pass - */ -export class ClearMaskPass extends Pass { - /** - * Performs the clear of the currently defined mask. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer): void; -} -import { Pass } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts deleted file mode 100644 index 9e237fdea..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutlinePass.d.ts +++ /dev/null @@ -1,177 +0,0 @@ -/** - * A pass for rendering outlines around selected objects. - * - * ```js - * const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight ); - * const outlinePass = new OutlinePass( resolution, scene, camera ); - * composer.addPass( outlinePass ); - * ``` - * - * @augments Pass - * @three_import import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js'; - */ -export class OutlinePass extends Pass { - /** - * Constructs a new outline pass. - * - * @param {Vector2} [resolution] - The effect's resolution. - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera. - * @param {Array} [selectedObjects] - The selected 3D objects that should receive an outline. - * - */ - constructor(resolution?: Vector2, scene: Scene, camera: Camera, selectedObjects?: Array); - /** - * The scene to render. - * - * @type {Object} - */ - renderScene: Object; - /** - * The camera. - * - * @type {Object} - */ - renderCamera: Object; - /** - * The selected 3D objects that should receive an outline. - * - * @type {Array} - */ - selectedObjects: Array; - /** - * The visible edge color. - * - * @type {Color} - * @default (1,1,1) - */ - visibleEdgeColor: Color; - /** - * The hidden edge color. - * - * @type {Color} - * @default (0.1,0.04,0.02) - */ - hiddenEdgeColor: Color; - /** - * Can be used for an animated glow/pulse effect. - * - * @type {number} - * @default 0 - */ - edgeGlow: number; - /** - * Whether to use a pattern texture for to highlight selected - * 3D objects or not. - * - * @type {boolean} - * @default false - */ - usePatternTexture: boolean; - /** - * Can be used to highlight selected 3D objects. Requires to set - * {@link OutlinePass#usePatternTexture} to `true`. - * - * @type {?Texture} - * @default null - */ - patternTexture: Texture | null; - /** - * The edge thickness. - * - * @type {number} - * @default 1 - */ - edgeThickness: number; - /** - * The edge strength. - * - * @type {number} - * @default 3 - */ - edgeStrength: number; - /** - * The downsample ratio. The effect can be rendered in a much - * lower resolution than the beauty pass. - * - * @type {number} - * @default 2 - */ - downSampleRatio: number; - /** - * The pulse period. - * - * @type {number} - * @default 0 - */ - pulsePeriod: number; - _visibilityCache: Map; - _selectionCache: Set; - /** - * The effect's resolution. - * - * @type {Vector2} - * @default (256,256) - */ - resolution: Vector2; - renderTargetMaskBuffer: WebGLRenderTarget; - depthMaterial: MeshDepthMaterial; - prepareMaskMaterial: ShaderMaterial; - renderTargetDepthBuffer: WebGLRenderTarget; - renderTargetMaskDownSampleBuffer: WebGLRenderTarget; - renderTargetBlurBuffer1: WebGLRenderTarget; - renderTargetBlurBuffer2: WebGLRenderTarget; - edgeDetectionMaterial: ShaderMaterial; - renderTargetEdgeBuffer1: WebGLRenderTarget; - renderTargetEdgeBuffer2: WebGLRenderTarget; - separableBlurMaterial1: ShaderMaterial; - separableBlurMaterial2: ShaderMaterial; - overlayMaterial: ShaderMaterial; - copyUniforms: Object; - materialCopy: ShaderMaterial; - _oldClearColor: Color; - oldClearAlpha: number; - _fsQuad: FullScreenQuad; - tempPulseColor1: Color; - tempPulseColor2: Color; - textureMatrix: Matrix4; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * Performs the Outline pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean): void; - _updateSelectionCache(): void; - _changeVisibilityOfSelectedObjects(bVisible: any): void; - _changeVisibilityOfNonSelectedObjects(bVisible: any): void; - _updateTextureMatrix(): void; - _getPrepareMaskMaterial(): ShaderMaterial; - _getEdgeDetectionMaterial(): ShaderMaterial; - _getSeparableBlurMaterial(maxRadius: any): ShaderMaterial; - _getOverlayMaterial(): ShaderMaterial; -} -export namespace OutlinePass { - let BlurDirectionX: Vector2; - let BlurDirectionY: Vector2; -} -import { Pass } from './Pass.js'; -import { Color } from 'three'; -import { Vector2 } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { MeshDepthMaterial } from 'three'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; -import { Matrix4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts deleted file mode 100644 index a4b3d2594..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/OutputPass.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * This pass is responsible for including tone mapping and color space conversion - * into your pass chain. In most cases, this pass should be included at the end - * of each pass chain. If a pass requires sRGB input (e.g. like FXAA), the pass - * must follow `OutputPass` in the pass chain. - * - * The tone mapping and color space settings are extracted from the renderer. - * - * ```js - * const outputPass = new OutputPass(); - * composer.addPass( outputPass ); - * ``` - * - * @augments Pass - * @three_import import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - */ -export class OutputPass extends Pass { - /** - * This flag indicates that this is an output pass. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOutputPass: boolean; - /** - * The pass uniforms. - * - * @type {Object} - */ - uniforms: Object; - /** - * The pass material. - * - * @type {RawShaderMaterial} - */ - material: RawShaderMaterial; - _fsQuad: FullScreenQuad; - _outputColorSpace: any; - _toneMapping: any; - /** - * Performs the output pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { RawShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts deleted file mode 100644 index 77af31f08..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/Pass.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Abstract base class for all post processing passes. - * - * This module is only relevant for post processing with {@link WebGLRenderer}. - * - * @abstract - * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js'; - */ -export class Pass { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPass: boolean; - /** - * If set to `true`, the pass is processed by the composer. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * If set to `true`, the pass indicates to swap read and write buffer after rendering. - * - * @type {boolean} - * @default true - */ - needsSwap: boolean; - /** - * If set to `true`, the pass clears its buffer before rendering - * - * @type {boolean} - * @default false - */ - clear: boolean; - /** - * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers - * pass chain gets automatically rendered to screen, no matter how this property is configured. - * - * @type {boolean} - * @default false - */ - renderToScreen: boolean; - /** - * Sets the size of the pass. - * - * @abstract - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(): void; - /** - * This method holds the render logic of a pass. It must be implemented in all derived classes. - * - * @abstract - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(): void; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever the pass is no longer used in your app. - * - * @abstract - */ - dispose(): void; -} -/** - * This module is a helper for passes which need to render a full - * screen effect which is quite common in context of post processing. - * - * The intended usage is to reuse a single full screen quad for rendering - * subsequent passes by just reassigning the `material` reference. - * - * This module can only be used with {@link WebGLRenderer}. - * - * @augments Mesh - * @three_import import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js'; - */ -export class FullScreenQuad { - /** - * Constructs a new full screen quad. - * - * @param {?Material} material - The material to render te full screen quad with. - */ - constructor(material: Material | null); - _mesh: Mesh; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever the instance is no longer used in your app. - */ - dispose(): void; - /** - * Renders the full screen quad. - * - * @param {WebGLRenderer} renderer - The renderer. - */ - render(renderer: WebGLRenderer): void; - set material(value: Material | null); - /** - * The quad's material. - * - * @type {?Material} - */ - get material(): Material | null; -} -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts deleted file mode 100644 index 9e9147843..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPass.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -/** - * This class represents a render pass. It takes a camera and a scene and produces - * a beauty pass for subsequent post processing effects. - * - * ```js - * const renderPass = new RenderPass( scene, camera ); - * composer.addPass( renderPass ); - * ``` - * - * @augments Pass - * @three_import import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; - */ -export class RenderPass extends Pass { - /** - * Constructs a new render pass. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera. - * @param {?Material} [overrideMaterial=null] - The override material. If set, this material is used - * for all objects in the scene. - * @param {?(number|Color|string)} [clearColor=null] - The clear color of the render pass. - * @param {?number} [clearAlpha=null] - The clear alpha of the render pass. - */ - constructor(scene: Scene, camera: Camera, overrideMaterial?: Material | null, clearColor?: (number | Color | string) | null, clearAlpha?: number | null); - /** - * The scene to render. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * The override material. If set, this material is used - * for all objects in the scene. - * - * @type {?Material} - * @default null - */ - overrideMaterial: Material | null; - /** - * The clear color of the render pass. - * - * @type {?(number|Color|string)} - * @default null - */ - clearColor: (number | Color | string) | null; - /** - * The clear alpha of the render pass. - * - * @type {?number} - * @default null - */ - clearAlpha: number | null; - /** - * If set to `true`, only the depth can be cleared when `clear` is to `false`. - * - * @type {boolean} - * @default false - */ - clearDepth: boolean; - /** - * This flag indicates that this pass renders the scene itself. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderPass: boolean; - _oldClearColor: Color; - /** - * Performs a beauty pass with the configured scene and camera. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts deleted file mode 100644 index 5d7439be4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderPixelatedPass.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * A special type of render pass that produces a pixelated beauty pass. - * - * ```js - * const renderPixelatedPass = new RenderPixelatedPass( 6, scene, camera ); - * composer.addPass( renderPixelatedPass ); - * ``` - * - * @augments Pass - * @three_import import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js'; - */ -export class RenderPixelatedPass extends Pass { - /** - * Constructs a new render pixelated pass. - * - * @param {number} pixelSize - The effect's pixel size. - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera. - * @param {{normalEdgeStrength:number,depthEdgeStrength:number}} options - The pass options. - */ - constructor(pixelSize: number, scene: Scene, camera: Camera, options?: { - normalEdgeStrength: number; - depthEdgeStrength: number; - }); - /** - * The effect's pixel size. - * - * @type {number} - */ - pixelSize: number; - /** - * The scene to render. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * The normal edge strength. - * - * @type {number} - * @default 0.3 - */ - normalEdgeStrength: number; - /** - * The normal edge strength. - * - * @type {number} - * @default 0.4 - */ - depthEdgeStrength: number; - /** - * The pixelated material. - * - * @type {ShaderMaterial} - */ - pixelatedMaterial: ShaderMaterial; - _resolution: Vector2; - _renderResolution: Vector2; - _normalMaterial: MeshNormalMaterial; - _beautyRenderTarget: WebGLRenderTarget; - _normalRenderTarget: WebGLRenderTarget; - _fsQuad: FullScreenQuad; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * Sets the effect's pixel size. - * - * @param {number} pixelSize - The pixel size to set. - */ - setPixelSize(pixelSize: number): void; - /** - * Performs the pixelation pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void; - _createPixelatedMaterial(): ShaderMaterial; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { Vector2 } from 'three'; -import { MeshNormalMaterial } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts deleted file mode 100644 index 4f782a095..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/RenderTransitionPass.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * A special type of render pass for implementing transition effects. - * When active, the pass will transition from scene A to scene B. - * - * ```js - * const renderTransitionPass = new RenderTransitionPass( fxSceneA.scene, fxSceneA.camera, fxSceneB.scene, fxSceneB.camera ); - * renderTransitionPass.setTexture( textures[ 0 ] ); - * composer.addPass( renderTransitionPass ); - * ``` - * - * @augments Pass - * @three_import import { RenderTransitionPass } from 'three/addons/postprocessing/RenderTransitionPass.js'; - */ -export class RenderTransitionPass extends Pass { - /** - * Constructs a render transition pass. - * - * @param {Scene} sceneA - The first scene. - * @param {Camera} cameraA - The camera of the first scene. - * @param {Scene} sceneB - The second scene. - * @param {Camera} cameraB - The camera of the second scene. - */ - constructor(sceneA: Scene, cameraA: Camera, sceneB: Scene, cameraB: Camera); - /** - * The first scene. - * - * @type {Scene} - */ - sceneA: Scene; - /** - * The camera of the first scene. - * - * @type {Camera} - */ - cameraA: Camera; - /** - * The second scene. - * - * @type {Scene} - */ - sceneB: Scene; - /** - * The camera of the second scene. - * - * @type {Camera} - */ - cameraB: Camera; - /** - * The pass material. - * - * @type {ShaderMaterial} - */ - material: ShaderMaterial; - _renderTargetA: WebGLRenderTarget; - _renderTargetB: WebGLRenderTarget; - _fsQuad: FullScreenQuad; - /** - * Sets the transition factor. Must be in the range `[0,1]`. - * This value determines to what degree both scenes are mixed. - * - * @param {boolean|number} value - The transition factor. - */ - setTransition(value: boolean | number): void; - /** - * Toggles the usage of a texture for the effect. - * - * @param {boolean} value - Whether to use a texture for the transition effect or not. - */ - useTexture(value: boolean): void; - /** - * Sets the effect texture. - * - * @param {Texture} value - The effect texture. - */ - setTexture(value: Texture): void; - /** - * Sets the texture threshold. This value defines how strong the texture effects - * the transition. Must be in the range `[0,1]` (0 means full effect, 1 means no effect). - * - * @param {boolean|number} value - The threshold value. - */ - setTextureThreshold(value: boolean | number): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * Performs the transition pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void; - _createMaterial(): ShaderMaterial; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts deleted file mode 100644 index 5bc6ace74..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SAOPass.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * A SAO implementation inspired from @bhouston previous SAO work. - * - * `SAOPass` provides better quality than {@link SSAOPass} but is also more expensive. - * - * ```js - * const saoPass = new SAOPass( scene, camera ); - * composer.addPass( saoPass ); - * ``` - * - * @augments Pass - * @three_import import { SAOPass } from 'three/addons/postprocessing/SAOPass.js'; - */ -export class SAOPass extends Pass { - /** - * Constructs a new SAO pass. - * - * @param {Scene} scene - The scene to compute the AO for. - * @param {Camera} camera - The camera. - * @param {Vector2} [resolution] - The effect's resolution. - */ - constructor(scene: Scene, camera: Camera, resolution?: Vector2); - /** - * The scene to render the AO for. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - _originalClearColor: Color; - _oldClearColor: Color; - _oldClearAlpha: number; - /** - * The SAO parameter. - * - * @type {Object} - */ - params: Object; - /** - * The effect's resolution. - * - * @type {Vector2} - * @default (256,256) - */ - resolution: Vector2; - saoRenderTarget: WebGLRenderTarget; - blurIntermediateRenderTarget: import("three").RenderTarget; - normalRenderTarget: WebGLRenderTarget; - normalMaterial: MeshNormalMaterial; - saoMaterial: ShaderMaterial; - vBlurMaterial: ShaderMaterial; - hBlurMaterial: ShaderMaterial; - materialCopy: ShaderMaterial; - fsQuad: FullScreenQuad; - /** - * Performs the SAO pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - prevStdDev: any; - prevNumSamples: any; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; - _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; -} -export namespace SAOPass { - namespace OUTPUT { - let Default: number; - let SAO: number; - let Normal: number; - } -} -import { Pass } from './Pass.js'; -import { Color } from 'three'; -import { Vector2 } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { MeshNormalMaterial } from 'three'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts deleted file mode 100644 index fbdc709b6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SMAAPass.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * A pass for applying SMAA. Unlike {@link FXAAPass}, `SMAAPass` operates in - * `linear-srgb` so this pass must be executed before {@link OutputPass}. - * - * ```js - * const smaaPass = new SMAAPass(); - * composer.addPass( smaaPass ); - * ``` - * - * @augments Pass - * @three_import import { SMAAPass } from 'three/addons/postprocessing/SMAAPass.js'; - */ -export class SMAAPass extends Pass { - _edgesRT: WebGLRenderTarget; - _weightsRT: WebGLRenderTarget; - _areaTexture: Texture; - _searchTexture: Texture; - _uniformsEdges: Object; - _materialEdges: ShaderMaterial; - _uniformsWeights: Object; - _materialWeights: ShaderMaterial; - _uniformsBlend: Object; - _materialBlend: ShaderMaterial; - _fsQuad: FullScreenQuad; - /** - * Performs the SMAA pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - _getAreaTexture(): string; - _getSearchTexture(): string; -} -import { Pass } from './Pass.js'; -import { WebGLRenderTarget } from 'three'; -import { Texture } from 'three'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts deleted file mode 100644 index 7dad6594f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAARenderPass.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Supersample Anti-Aliasing Render Pass. - * - * This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results. - * - * ```js - * const ssaaRenderPass = new SSAARenderPass( scene, camera ); - * ssaaRenderPass.sampleLevel = 3; - * composer.addPass( ssaaRenderPass ); - * ``` - * - * @augments Pass - * @three_import import { SSAARenderPass } from 'three/addons/postprocessing/SSAARenderPass.js'; - */ -export class SSAARenderPass extends Pass { - /** - * Constructs a new SSAA render pass. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera. - * @param {?(number|Color|string)} [clearColor=0x000000] - The clear color of the render pass. - * @param {?number} [clearAlpha=0] - The clear alpha of the render pass. - */ - constructor(scene: Scene, camera: Camera, clearColor?: (number | Color | string) | null, clearAlpha?: number | null); - /** - * The scene to render. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * The sample level. Specified as n, where the number of - * samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16. - * - * @type {number} - * @default 4 - */ - sampleLevel: number; - /** - * Whether the pass should be unbiased or not. This property has the most - * visible effect when rendering to a RGBA8 buffer because it mitigates - * rounding errors. By default RGBA16F is used. - * - * @type {boolean} - * @default true - */ - unbiased: boolean; - /** - * Whether to use a stencil buffer or not. This property can't - * be changed after the first render. - * - * @type {boolean} - * @default false - */ - stencilBuffer: boolean; - /** - * The clear color of the render pass. - * - * @type {?(number|Color|string)} - * @default 0x000000 - */ - clearColor: (number | Color | string) | null; - /** - * The clear alpha of the render pass. - * - * @type {?number} - * @default 0 - */ - clearAlpha: number | null; - _sampleRenderTarget: WebGLRenderTarget | null; - _oldClearColor: Color; - _copyUniforms: Object; - _copyMaterial: ShaderMaterial; - _fsQuad: FullScreenQuad; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * Performs the SSAA render pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { Color } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts deleted file mode 100644 index e26c2ac62..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSAOPass.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -/** - * A pass for a basic SSAO effect. - * - * {@link SAOPass} and {@link GTAPass} produce a more advanced AO but are also - * more expensive. - * - * ```js - * const ssaoPass = new SSAOPass( scene, camera, width, height ); - * composer.addPass( ssaoPass ); - * ``` - * - * @augments Pass - * @three_import import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js'; - */ -export class SSAOPass extends Pass { - /** - * Constructs a new SSAO pass. - * - * @param {Scene} scene - The scene to compute the AO for. - * @param {Camera} camera - The camera. - * @param {number} [width=512] - The width of the effect. - * @param {number} [height=512] - The height of the effect. - * @param {number} [kernelSize=32] - The kernel size. - */ - constructor(scene: Scene, camera: Camera, width?: number, height?: number, kernelSize?: number); - /** - * The width of the effect. - * - * @type {number} - * @default 512 - */ - width: number; - /** - * The height of the effect. - * - * @type {number} - * @default 512 - */ - height: number; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * The scene to render the AO for. - * - * @type {Scene} - */ - scene: Scene; - /** - * The kernel radius controls how wide the - * AO spreads. - * - * @type {number} - * @default 8 - */ - kernelRadius: number; - kernel: any[]; - noiseTexture: DataTexture | null; - /** - * The output configuration. - * - * @type {number} - * @default 0 - */ - output: number; - /** - * Defines the minimum distance that should be - * affected by the AO. - * - * @type {number} - * @default 0.005 - */ - minDistance: number; - /** - * Defines the maximum distance that should be - * affected by the AO. - * - * @type {number} - * @default 0.1 - */ - maxDistance: number; - _visibilityCache: any[]; - normalRenderTarget: WebGLRenderTarget; - ssaoRenderTarget: WebGLRenderTarget; - blurRenderTarget: import("three").RenderTarget; - ssaoMaterial: ShaderMaterial; - normalMaterial: MeshNormalMaterial; - blurMaterial: ShaderMaterial; - depthRenderMaterial: ShaderMaterial; - copyMaterial: ShaderMaterial; - _fsQuad: FullScreenQuad; - _originalClearColor: Color; - /** - * Performs the SSAO pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; - _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; - _generateSampleKernel(kernelSize: any): void; - _generateRandomKernelRotations(): void; - _overrideVisibility(): void; - _restoreVisibility(): void; -} -export namespace SSAOPass { - namespace OUTPUT { - let Default: number; - let SSAO: number; - let Blur: number; - let Depth: number; - let Normal: number; - } -} -import { Pass } from './Pass.js'; -import { DataTexture } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { ShaderMaterial } from 'three'; -import { MeshNormalMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; -import { Color } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts deleted file mode 100644 index 02504603f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SSRPass.d.ts +++ /dev/null @@ -1,218 +0,0 @@ -/** - * ~Options - */ -export type SSRPass = { - /** - * - The renderer. - */ - renderer: WebGLRenderer; - /** - * - The scene to render. - */ - scene: Scene; - /** - * - The camera. - */ - camera: Camera; - /** - * - The width of the effect. - */ - width?: number | undefined; - /** - * - The width of the effect. - */ - height?: number | undefined; - /** - * - Which 3D objects should be affected by SSR. If not set, the entire scene is affected. - */ - selects?: Object3D[] | null | undefined; - /** - * - Whether bouncing is enabled or not. - */ - bouncing?: boolean | undefined; - /** - * - A ground reflector. - */ - groundReflector?: ReflectorForSSRPass | null; -}; -/** - * A pass for a basic SSR effect. - * - * ```js - * const ssrPass = new SSRPass( { - * renderer, - * scene, - * camera, - * width: innerWidth, - * height: innerHeight - * } ); - * composer.addPass( ssrPass ); - * ``` - * - * @augments Pass - * @three_import import { SSRPass } from 'three/addons/postprocessing/SSRPass.js'; - */ -export class SSRPass extends Pass { - /** - * Constructs a new SSR pass. - * - * @param {SSRPass~Options} options - The pass options. - */ - constructor({ renderer, scene, camera, width, height, selects, bouncing, groundReflector }: SSRPass); - /** - * The width of the effect. - * - * @type {number} - * @default 512 - */ - width: number; - /** - * The height of the effect. - * - * @type {number} - * @default 512 - */ - height: number; - /** - * The renderer. - * - * @type {WebGLRenderer} - */ - renderer: WebGLRenderer; - /** - * The scene to render. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * The ground reflector. - * - * @type {?ReflectorForSSRPass} - * @default 0 - */ - groundReflector: ReflectorForSSRPass | null; - /** - * The opacity. - * - * @type {number} - * @default 0.5 - */ - opacity: number; - /** - * The output configuration. - * - * @type {number} - * @default 0 - */ - output: number; - /** - * Controls how far a fragment can reflect. - * - * @type {number} - * @default 180 - */ - maxDistance: number; - /** - * Controls the cutoff between what counts as a - * possible reflection hit and what does not. - * - * @type {number} - * @default .018 - */ - thickness: number; - tempColor: Color; - _selects: any; - _resolutionScale: number; - /** - * Whether the pass is selective or not. - * - * @type {boolean} - * @default false - */ - selective: boolean; - _bouncing: any; - /** - * Whether to blur reflections or not. - * - * @type {boolean} - * @default true - */ - blur: boolean; - _distanceAttenuation: any; - _fresnel: any; - _infiniteThick: any; - beautyRenderTarget: WebGLRenderTarget; - prevRenderTarget: WebGLRenderTarget; - normalRenderTarget: WebGLRenderTarget; - metalnessRenderTarget: WebGLRenderTarget; - ssrRenderTarget: WebGLRenderTarget; - blurRenderTarget: import("three").RenderTarget; - blurRenderTarget2: import("three").RenderTarget; - ssrMaterial: ShaderMaterial; - normalMaterial: MeshNormalMaterial; - metalnessOnMaterial: MeshBasicMaterial; - metalnessOffMaterial: MeshBasicMaterial; - blurMaterial: ShaderMaterial; - blurMaterial2: ShaderMaterial; - depthRenderMaterial: ShaderMaterial; - copyMaterial: ShaderMaterial; - fsQuad: FullScreenQuad; - originalClearColor: Color; - set resolutionScale(value: number); - /** - * The resolution scale. Valid values are in the range - * `[0,1]`. `1` means best quality but also results in - * more computational overhead. Setting to `0.5` means - * the effect is computed in half-resolution. - * - * @type {number} - * @default 1 - */ - get resolutionScale(): number; - /** - * Performs the SSR pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - _renderPass(renderer: any, passMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; - _renderOverride(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; - _renderMetalness(renderer: any, overrideMaterial: any, renderTarget: any, clearColor: any, clearAlpha: any): void; -} -export namespace SSRPass { - namespace OUTPUT { - let Default: number; - let SSR: number; - let Beauty: number; - let Depth: number; - let Normal: number; - let Metalness: number; - } -} -import { Pass } from './Pass.js'; -import { Color } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { ShaderMaterial } from 'three'; -import { MeshNormalMaterial } from 'three'; -import { MeshBasicMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts deleted file mode 100644 index 658d5124e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/SavePass.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/** - * A pass that saves the contents of the current read buffer in a render target. - * - * ```js - * const savePass = new SavePass( customRenderTarget ); - * composer.addPass( savePass ); - * ``` - * - * @augments Pass - * @three_import import { SavePass } from 'three/addons/postprocessing/SavePass.js'; - */ -export class SavePass extends Pass { - /** - * Constructs a new save pass. - * - * @param {WebGLRenderTarget} [renderTarget] - The render target for saving the read buffer. - * If not provided, the pass automatically creates a render target. - */ - constructor(renderTarget?: WebGLRenderTarget); - /** - * The pass uniforms. - * - * @type {Object} - */ - uniforms: Object; - /** - * The pass material. - * - * @type {ShaderMaterial} - */ - material: ShaderMaterial; - /** - * The render target which is used to save the read buffer. - * - * @type {WebGLRenderTarget} - */ - renderTarget: WebGLRenderTarget; - _fsQuad: FullScreenQuad; - /** - * Performs the save pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts deleted file mode 100644 index f88751cd7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/ShaderPass.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This pass can be used to create a post processing effect - * with a raw GLSL shader object. Useful for implementing custom - * effects. - * - * ```js - * const fxaaPass = new ShaderPass( FXAAShader ); - * composer.addPass( fxaaPass ); - * ``` - * - * @augments Pass - * @three_import import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; - */ -export class ShaderPass extends Pass { - /** - * Constructs a new shader pass. - * - * @param {Object|ShaderMaterial} [shader] - A shader object holding vertex and fragment shader as well as - * defines and uniforms. It's also valid to pass a custom shader material. - * @param {string} [textureID='tDiffuse'] - The name of the texture uniform that should sample - * the read buffer. - */ - constructor(shader?: Object | ShaderMaterial, textureID?: string); - /** - * The name of the texture uniform that should sample the read buffer. - * - * @type {string} - * @default 'tDiffuse' - */ - textureID: string; - /** - * The pass uniforms. - * - * @type {?Object} - */ - uniforms: Object | null; - /** - * The pass material. - * - * @type {?ShaderMaterial} - */ - material: ShaderMaterial | null; - _fsQuad: FullScreenQuad; - /** - * Performs the shader pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts deleted file mode 100644 index c70de7eda..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TAARenderPass.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * - * Temporal Anti-Aliasing Render Pass. - * - * When there is no motion in the scene, the TAA render pass accumulates jittered camera - * samples across frames to create a high quality anti-aliased result. - * - * Note: This effect uses no reprojection so it is no TRAA implementation. - * - * ```js - * const taaRenderPass = new TAARenderPass( scene, camera ); - * taaRenderPass.unbiased = false; - * composer.addPass( taaRenderPass ); - * ``` - * - * @augments SSAARenderPass - * @three_import import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; - */ -export class TAARenderPass extends SSAARenderPass { - /** - * Constructs a new TAA render pass. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera. - * @param {?(number|Color|string)} [clearColor=0x000000] - The clear color of the render pass. - * @param {?number} [clearAlpha=0] - The clear alpha of the render pass. - */ - constructor(scene: Scene, camera: Camera, clearColor?: (number | Color | string) | null, clearAlpha?: number | null); - /** - * Whether to accumulate frames or not. This enables - * the TAA. - * - * @type {boolean} - * @default false - */ - accumulate: boolean; - /** - * The accumulation index. - * - * @type {number} - * @default -1 - */ - accumulateIndex: number; - _holdRenderTarget: WebGLRenderTarget | null; - /** - * Performs the TAA render pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number): void; -} -import { SSAARenderPass } from './SSAARenderPass.js'; -import { WebGLRenderTarget } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts deleted file mode 100644 index 77a24d54f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/TexturePass.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * This pass can be used to render a texture over the entire screen. - * - * ```js - * const texture = new THREE.TextureLoader().load( 'textures/2294472375_24a3b8ef46_o.jpg' ); - * texture.colorSpace = THREE.SRGBColorSpace; - * - * const texturePass = new TexturePass( texture ); - * composer.addPass( texturePass ); - * ``` - * - * @augments Pass - * @three_import import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; - */ -export class TexturePass extends Pass { - /** - * Constructs a new texture pass. - * - * @param {Texture} map - The texture to render. - * @param {number} [opacity=1] - The opacity. - */ - constructor(map: Texture, opacity?: number); - /** - * The texture to render. - * - * @type {Texture} - */ - map: Texture; - /** - * The opacity. - * - * @type {number} - * @default 1 - */ - opacity: number; - /** - * The pass uniforms. - * - * @type {Object} - */ - uniforms: Object; - /** - * The pass material. - * - * @type {ShaderMaterial} - */ - material: ShaderMaterial; - _fsQuad: FullScreenQuad; - /** - * Performs the texture pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget): void; -} -import { Pass } from './Pass.js'; -import { ShaderMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts deleted file mode 100644 index e16437efd..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/postprocessing/UnrealBloomPass.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * This pass is inspired by the bloom pass of Unreal Engine. It creates a - * mip map chain of bloom textures and blurs them with different radii. Because - * of the weighted combination of mips, and because larger blurs are done on - * higher mips, this effect provides good quality and performance. - * - * When using this pass, tone mapping must be enabled in the renderer settings. - * - * Reference: - * - [Bloom in Unreal Engine](https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/) - * - * ```js - * const resolution = new THREE.Vector2( window.innerWidth, window.innerHeight ); - * const bloomPass = new UnrealBloomPass( resolution, 1.5, 0.4, 0.85 ); - * composer.addPass( bloomPass ); - * ``` - * - * @augments Pass - * @three_import import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; - */ -export class UnrealBloomPass extends Pass { - /** - * Constructs a new Unreal Bloom pass. - * - * @param {Vector2} [resolution] - The effect's resolution. - * @param {number} [strength=1] - The Bloom strength. - * @param {number} radius - The Bloom radius. - * @param {number} threshold - The luminance threshold limits which bright areas contribute to the Bloom effect. - */ - constructor(resolution?: Vector2, strength?: number, radius: number, threshold: number); - /** - * The Bloom strength. - * - * @type {number} - * @default 1 - */ - strength: number; - /** - * The Bloom radius. Must be in the range `[0,1]`. - * - * @type {number} - */ - radius: number; - /** - * The luminance threshold limits which bright areas contribute to the Bloom effect. - * - * @type {number} - */ - threshold: number; - /** - * The effect's resolution. - * - * @type {Vector2} - * @default (256,256) - */ - resolution: Vector2; - /** - * The effect's clear color - * - * @type {Color} - * @default (0,0,0) - */ - clearColor: Color; - renderTargetsHorizontal: WebGLRenderTarget[]; - renderTargetsVertical: WebGLRenderTarget[]; - nMips: number; - renderTargetBright: WebGLRenderTarget; - highPassUniforms: Object; - materialHighPassFilter: ShaderMaterial; - separableBlurMaterials: ShaderMaterial[]; - compositeMaterial: ShaderMaterial; - bloomTintColors: Vector3[]; - copyUniforms: Object; - blendMaterial: ShaderMaterial; - _oldClearColor: Color; - _oldClearAlpha: number; - _basic: MeshBasicMaterial; - _fsQuad: FullScreenQuad; - /** - * Sets the size of the pass. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * Performs the Bloom pass. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering - * destination for the pass. - * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the - * previous pass from this buffer. - * @param {number} deltaTime - The delta time in seconds. - * @param {boolean} maskActive - Whether masking is active or not. - */ - render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget, readBuffer: WebGLRenderTarget, deltaTime: number, maskActive: boolean): void; - _getSeparableBlurMaterial(kernelRadius: any): ShaderMaterial; - _getCompositeMaterial(nMips: any): ShaderMaterial; -} -export namespace UnrealBloomPass { - let BlurDirectionX: Vector2; - let BlurDirectionY: Vector2; -} -import { Pass } from './Pass.js'; -import { Vector2 } from 'three'; -import { Color } from 'three'; -import { WebGLRenderTarget } from 'three'; -import { ShaderMaterial } from 'three'; -import { Vector3 } from 'three'; -import { MeshBasicMaterial } from 'three'; -import { FullScreenQuad } from './Pass.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts deleted file mode 100644 index 73d34035e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS2DRenderer.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * ~Parameters - */ -export type CSS2DRenderer = { - /** - * - A DOM element where the renderer appends its child-elements. - * If not passed in here, a new div element will be created. - */ - element?: HTMLElement | undefined; -}; -/** - * The only type of 3D object that is supported by {@link CSS2DRenderer}. - * - * @augments Object3D - * @three_import import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; - */ -export class CSS2DObject extends Object3D { - /** - * Constructs a new CSS2D object. - * - * @param {HTMLElement} [element] - The DOM element. - */ - constructor(element?: HTMLElement); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCSS2DObject: boolean; - /** - * The DOM element which defines the appearance of this 3D object. - * - * @type {HTMLElement} - * @readonly - * @default true - */ - readonly element: HTMLElement; - /** - * The object's anchor point, and the point around which the object rotates. - * A value of `(0.5, 0.5)` corresponds to the midpoint of the object. A value - * of `(0, 0)` corresponds to the upper left corner of the object. - * - * @type {Vector2} - * @default (0.5,0.5) - */ - center: Vector2; - /** - * The object's angle of rotation, counterclockwise, in radians. - * - * @type {number} - * @default 0 - */ - rotation2D: number; - copy(source: any, recursive: any): this; -} -/** - * This renderer is a simplified version of {@link CSS3DRenderer}. The only transformations that - * are supported are translation and 2D rotation. - * - * The renderer is very useful if you want to combine HTML based labels with 3D objects. Here too, - * the respective DOM elements are wrapped into an instance of {@link CSS2DObject} and added to the - * scene graph. All other types of renderable 3D objects (like meshes or point clouds) are ignored. - * - * `CSS2DRenderer` only supports 100% browser and display zoom. - * - * @three_import import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js'; - */ -export class CSS2DRenderer { - /** - * Constructs a new CSS2D renderer. - * - * @param {CSS2DRenderer~Parameters} [parameters] - The parameters. - */ - constructor(parameters?: {}); - /** - * The DOM where the renderer appends its child-elements. - * - * @type {HTMLElement} - */ - domElement: HTMLElement; - /** - * Controls whether the renderer assigns `z-index` values to CSS2DObject DOM elements. - * If set to `true`, z-index values are assigned first based on the `renderOrder` - * and secondly - the distance to the camera. If set to `false`, no z-index values are assigned. - * - * @type {boolean} - * @default true - */ - sortObjects: boolean; - /** - * Returns an object containing the width and height of the renderer. - * - * @return {{width:number,height:number}} The size of the renderer. - */ - getSize: () => { - width: number; - height: number; - }; - /** - * Renders the given scene using the given camera. - * - * @param {Object3D} scene - A scene or any other type of 3D object. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * Resizes the renderer to the given width and height. - * - * @param {number} width - The width of the renderer. - * @param {number} height - The height of the renderer. - */ - setSize: (width: number, height: number) => void; -} -import { Object3D } from 'three'; -import { Vector2 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts deleted file mode 100644 index 0cf3ed245..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/renderers/CSS3DRenderer.d.ts +++ /dev/null @@ -1,121 +0,0 @@ -/** - * ~Parameters - */ -export type CSS3DRenderer = { - /** - * - A DOM element where the renderer appends its child-elements. - * If not passed in here, a new div element will be created. - */ - element?: HTMLElement | undefined; -}; -/** - * The base 3D object that is supported by {@link CSS3DRenderer}. - * - * @augments Object3D - * @three_import import { CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; - */ -export class CSS3DObject extends Object3D { - /** - * Constructs a new CSS3D object. - * - * @param {HTMLElement} [element] - The DOM element. - */ - constructor(element?: HTMLElement); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCSS3DObject: boolean; - /** - * The DOM element which defines the appearance of this 3D object. - * - * @type {HTMLElement} - * @readonly - * @default true - */ - readonly element: HTMLElement; - copy(source: any, recursive: any): this; -} -/** - * A specialized version of {@link CSS3DObject} that represents - * DOM elements as sprites. - * - * @augments CSS3DObject - * @three_import import { CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; - */ -export class CSS3DSprite extends CSS3DObject { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCSS3DSprite: boolean; - /** - * The sprite's rotation in radians. - * - * @type {number} - * @default 0 - */ - rotation2D: number; - copy(source: any, recursive: any): this; -} -/** - * This renderer can be used to apply hierarchical 3D transformations to DOM elements - * via the CSS3 [transform](https://www.w3schools.com/cssref/css3_pr_transform.asp) property. - * `CSS3DRenderer` is particularly interesting if you want to apply 3D effects to a website without - * canvas based rendering. It can also be used in order to combine DOM elements with WebGL content. - * - * There are, however, some important limitations: - * - * - It's not possible to use the material system of *three.js*. - * - It's also not possible to use geometries. - * - The renderer only supports 100% browser and display zoom. - * - * So `CSS3DRenderer` is just focused on ordinary DOM elements. These elements are wrapped into special - * 3D objects ({@link CSS3DObject} or {@link CSS3DSprite}) and then added to the scene graph. - * - * @three_import import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js'; - */ -export class CSS3DRenderer { - /** - * Constructs a new CSS3D renderer. - * - * @param {CSS3DRenderer~Parameters} [parameters] - The parameters. - */ - constructor(parameters?: {}); - /** - * The DOM where the renderer appends its child-elements. - * - * @type {HTMLElement} - */ - domElement: HTMLElement; - /** - * Returns an object containing the width and height of the renderer. - * - * @return {{width:number,height:number}} The size of the renderer. - */ - getSize: () => { - width: number; - height: number; - }; - /** - * Renders the given scene using the given camera. - * - * @param {Object3D} scene - A scene or any other type of 3D object. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * Resizes the renderer to the given width and height. - * - * @param {number} width - The width of the renderer. - * @param {number} height - The height of the renderer. - */ - setSize: (width: number, height: number) => void; -} -import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts deleted file mode 100644 index 32084b049..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/renderers/Projector.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -export class RenderableObject { - id: number; - object: any; - z: number; - renderOrder: number; -} -export class RenderableFace { - id: number; - v1: RenderableVertex; - v2: RenderableVertex; - v3: RenderableVertex; - normalModel: Vector3; - vertexNormalsModel: Vector3[]; - vertexNormalsLength: number; - color: Color; - material: any; - uvs: Vector2[]; - z: number; - renderOrder: number; -} -export class RenderableVertex { - position: Vector3; - positionWorld: Vector3; - positionScreen: Vector4; - visible: boolean; - copy(vertex: any): void; -} -export class RenderableLine { - id: number; - v1: RenderableVertex; - v2: RenderableVertex; - vertexColors: Color[]; - material: any; - z: number; - renderOrder: number; -} -export class RenderableSprite { - id: number; - object: any; - x: number; - y: number; - z: number; - rotation: number; - scale: Vector2; - material: any; - renderOrder: number; -} -/** - * This class can project a given scene in 3D space into a 2D representation - * used for rendering with a 2D API. `Projector` is currently used by {@link SVGRenderer} - * and was previously used by the legacy `CanvasRenderer`. - * - * @three_import import { Projector } from 'three/addons/renderers/Projector.js'; - */ -export class Projector { - /** - * Projects the given scene in 3D space into a 2D representation. The result - * is an object with renderable items. - * - * @param {Object3D} scene - A scene or any other type of 3D object. - * @param {Camera} camera - The camera. - * @param {boolean} sortObjects - Whether to sort objects or not. - * @param {boolean} sortElements - Whether to sort elements (faces, lines and sprites) or not. - * @return {{objects:Array,lights:Array,elements:Array}} The projected scene as renderable objects. - */ - projectScene: (scene: Object3D, camera: Camera, sortObjects: boolean, sortElements: boolean) => { - objects: Array; - lights: Array; - elements: Array; - }; -} -import { Vector3 } from 'three'; -import { Color } from 'three'; -import { Vector2 } from 'three'; -import { Vector4 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts deleted file mode 100644 index a9813dd1b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/renderers/SVGRenderer.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Can be used to wrap SVG elements into a 3D object. - * - * @augments Object3D - * @three_import import { SVGObject } from 'three/addons/renderers/SVGRenderer.js'; - */ -export class SVGObject extends Object3D { - /** - * Constructs a new SVG object. - * - * @param {SVGElement} node - The SVG element. - */ - constructor(node: SVGElement); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSVGObject: boolean; - /** - * This SVG element. - * - * @type {SVGElement} - */ - node: SVGElement; -} -/** - * This renderer an be used to render geometric data using SVG. The produced vector - * graphics are particular useful in the following use cases: - * - * - Animated logos or icons. - * - Interactive 2D/3D diagrams or graphs. - * - Interactive maps. - * - Complex or animated user interfaces. - * - * `SVGRenderer` has various advantages. It produces crystal-clear and sharp output which - * is independent of the actual viewport resolution.SVG elements can be styled via CSS. - * And they have good accessibility since it's possible to add metadata like title or description - * (useful for search engines or screen readers). - * - * There are, however, some important limitations: - * - No advanced shading. - * - No texture support. - * - No shadow support. - * - * @three_import import { SVGRenderer } from 'three/addons/renderers/SVGRenderer.js'; - */ -export class SVGRenderer { - /** - * The DOM where the renderer appends its child-elements. - * - * @type {SVGSVGElement} - */ - domElement: SVGSVGElement; - /** - * Whether to automatically perform a clear before a render call or not. - * - * @type {boolean} - * @default true - */ - autoClear: boolean; - /** - * Whether to sort 3D objects or not. - * - * @type {boolean} - * @default true - */ - sortObjects: boolean; - /** - * Whether to sort elements or not. - * - * @type {boolean} - * @default true - */ - sortElements: boolean; - /** - * Number of fractional pixels to enlarge polygons in order to - * prevent anti-aliasing gaps. Range is `[0,1]`. - * - * @type {number} - * @default 0.5 - */ - overdraw: number; - /** - * The output color space. - * - * @type {(SRGBColorSpace|LinearSRGBColorSpace)} - * @default SRGBColorSpace - */ - outputColorSpace: (string | LinearSRGBColorSpace); - /** - * Provides information about the number of - * rendered vertices and faces. - * - * @type {Object} - */ - info: Object; - /** - * Sets the render quality. Setting to `high` makes the browser improve SVG quality - * over rendering speed and geometric precision. - * - * @param {('low'|'high')} quality - The quality. - */ - setQuality: (quality: ("low" | "high")) => void; - /** - * Sets the clear color. - * - * @param {(number|Color|string)} color - The clear color to set. - */ - setClearColor: (color: (number | Color | string)) => void; - setPixelRatio: () => void; - /** - * Resizes the renderer to the given width and height. - * - * @param {number} width - The width of the renderer. - * @param {number} height - The height of the renderer. - */ - setSize: (width: number, height: number) => void; - /** - * Returns an object containing the width and height of the renderer. - * - * @return {{width:number,height:number}} The size of the renderer. - */ - getSize: () => { - width: number; - height: number; - }; - /** - * Sets the precision of the data used to create a paths. - * - * @param {number} precision - The precision to set. - */ - setPrecision: (precision: number) => void; - /** - * Performs a manual clear with the defined clear color. - */ - clear: () => void; - /** - * Renders the given scene using the given camera. - * - * @param {Object3D} scene - A scene or any other type of 3D object. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; -} -import { Object3D } from 'three'; -import { Color } from 'three'; -import { Camera } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts deleted file mode 100644 index 31079d7c7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/ACESFilmicToneMappingShader.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @module ACESFilmicToneMappingShader - * @three_import import { ACESFilmicToneMappingShader } from 'three/addons/shaders/ACESFilmicToneMappingShader.js'; - */ -/** - * ACES Filmic Tone Mapping Shader by Stephen Hill. - * Reference: [ltc_blit.fs](https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs) - * - * This implementation of ACES is modified to accommodate a brighter viewing environment. - * The scale factor of 1/0.6 is subjective. See discussion in #19621. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const ACESFilmicToneMappingShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts deleted file mode 100644 index 440b592fa..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/AfterimageShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module AfterimageShader - * @three_import import { AfterimageShader } from 'three/addons/shaders/AfterimageShader.js'; - */ -/** - * Inspired by [Three.js FBO motion trails](https://codepen.io/brunoimbrizi/pen/MoRJaN?page=1&). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const AfterimageShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts deleted file mode 100644 index 18bfeb90b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/BasicShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module BasicShader - * @three_import import { BasicShader } from 'three/addons/shaders/BasicShader.js'; - */ -/** - * Simple shader for testing. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const BasicShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts deleted file mode 100644 index a1ccf8066..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/BleachBypassShader.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @module BleachBypassShader - * @three_import import { BleachBypassShader } from 'three/addons/shaders/BleachBypassShader.js'; - */ -/** - * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass] based on - * [Nvidia Shader library](http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const BleachBypassShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts deleted file mode 100644 index e611c0440..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/BlendShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module BlendShader - * @three_import import { BlendShader } from 'three/addons/shaders/BlendShader.js'; - */ -/** - * Blends two textures. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const BlendShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts deleted file mode 100644 index 8f1a07d14..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * @module BokehShader - * @three_import import { BokehShader } from 'three/addons/shaders/BokehShader.js'; - */ -/** - * Depth-of-field shader with bokeh ported from - * [GLSL shader by Martins Upitis](http://artmartinsh.blogspot.com/2010/02/glsl-lens-blur-filter-with-bokeh.html). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const BokehShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts deleted file mode 100644 index ee60e93f0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/BokehShader2.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @module BokehShader2 - * @three_import import { BokehShader, BokehDepthShader } from 'three/addons/shaders/BokehShader2.js'; - */ -/** - * Depth-of-field shader with bokeh ported from - * [GLSL shader by Martins Upitis](http://blenderartists.org/forum/showthread.php?237488-GLSL-depth-of-field-with-bokeh-v2-4-(update)). - * - * Requires #define RINGS and SAMPLES integers - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const BokehShader: ShaderMaterial; -export namespace BokehDepthShader { - let name: string; - namespace uniforms { - namespace mNear { - let value: number; - } - namespace mFar { - let value_1: number; - export { value_1 as value }; - } - } - let vertexShader: string; - let fragmentShader: string; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts deleted file mode 100644 index cab589f4b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/BrightnessContrastShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module BrightnessContrastShader - * @three_import import { BrightnessContrastShader } from 'three/addons/shaders/BrightnessContrastShader.js'; - */ -/** - * Brightness and contrast adjustment {@link https://github.com/evanw/glfx.js}. - * Brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white) - * Contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const BrightnessContrastShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts deleted file mode 100644 index 1172081b2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorCorrectionShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module ColorCorrectionShader - * @three_import import { ColorCorrectionShader } from 'three/addons/shaders/ColorCorrectionShader.js'; - */ -/** - * Color correction shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const ColorCorrectionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts deleted file mode 100644 index ad6864f45..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/ColorifyShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module ColorifyShader - * @three_import import { ColorifyShader } from 'three/addons/shaders/ColorifyShader.js'; - */ -/** - * Colorify shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const ColorifyShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts deleted file mode 100644 index f272adf10..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/ConvolutionShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module ConvolutionShader - * @three_import import { ConvolutionShader } from 'three/addons/shaders/ConvolutionShader.js'; - */ -/** - * Convolution shader ported from o3d sample to WebGL / GLSL. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const ConvolutionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts deleted file mode 100644 index 9afca73ca..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/CopyShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module CopyShader - * @three_import import { CopyShader } from 'three/addons/shaders/CopyShader.js'; - */ -/** - * Full-screen copy shader pass. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const CopyShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts deleted file mode 100644 index be1d0dc76..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/DOFMipMapShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module DOFMipMapShader - * @three_import import { DOFMipMapShader } from 'three/addons/shaders/DOFMipMapShader.js'; - */ -/** - * Depth-of-field shader using mipmaps from Matt Handley @applmak. - * - * Requires power-of-2 sized render target with enabled mipmaps. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const DOFMipMapShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts deleted file mode 100644 index 7d7e8b717..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/DepthLimitedBlurShader.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @module DepthLimitedBlurShader - * @three_import import { DepthLimitedBlurShader, BlurShaderUtils } from 'three/addons/shaders/DepthLimitedBlurShader.js'; - */ -/** - * A separable Gaussian blur shader that limits blurring across depth - * discontinuities, stopping when the view-space depth difference to a - * neighboring sample exceeds `depthCutoff`. This preserves edges and - * avoids bleeding across them. - * - * Used by {@link SAOPass}. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const DepthLimitedBlurShader: ShaderMaterial; -export namespace BlurShaderUtils { - function createSampleWeights(kernelRadius: any, stdDev: any): number[]; - function createSampleOffsets(kernelRadius: any, uvIncrement: any): any[]; - function configure(material: any, kernelRadius: any, stdDev: any, uvIncrement: any): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts deleted file mode 100644 index 2e3ea3fc5..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/DigitalGlitch.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module DigitalGlitch - * @three_import import { DigitalGlitch } from 'three/addons/shaders/DigitalGlitch.js'; - */ -/** - * Digital glitch shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const DigitalGlitch: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts deleted file mode 100644 index 1b7a05f1b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/DotScreenShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module DotScreenShader - * @three_import import { DotScreenShader } from 'three/addons/shaders/DotScreenShader.js'; - */ -/** - * Dot screen shader based on [glfx.js sepia shader](https://github.com/evanw/glfx.js). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const DotScreenShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts deleted file mode 100644 index 72e9b2951..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/ExposureShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module ExposureShader - * @three_import import { ExposureShader } from 'three/addons/shaders/ExposureShader.js'; - */ -/** - * Exposure shader that scales the image color by an exposure factor. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const ExposureShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts deleted file mode 100644 index 069ce39da..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/FXAAShader.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @module FXAAShader - * @three_import import { FXAAShader } from 'three/addons/shaders/FXAAShader.js'; - */ -/** - * FXAA algorithm from NVIDIA, C# implementation by Jasper Flick, GLSL port by Dave Hoskins. - * - * References: - * - {@link http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf}. - * - {@link https://catlikecoding.com/unity/tutorials/advanced-rendering/fxaa/}. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const FXAAShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts deleted file mode 100644 index 57764b36b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/FilmShader.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @module FilmShader - * @three_import import { FilmShader } from 'three/addons/shaders/FilmShader.js'; - */ -/** - * Film grain shader that adds animated noise to the image, with an optional - * grayscale conversion. - * - * Used by {@link FilmPass}. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const FilmShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts deleted file mode 100644 index 350ddb21f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/FocusShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module FocusShader - * @three_import import { FocusShader } from 'three/addons/shaders/FocusShader.js'; - */ -/** - * Focus shader based on [PaintEffect postprocess from ro.me](http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const FocusShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts deleted file mode 100644 index 90085fb50..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/FreiChenShader.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @module FreiChenShader - * @three_import import { FreiChenShader } from 'three/addons/shaders/FreiChenShader.js'; - */ -/** - * Edge Detection Shader using Frei-Chen filter. - * Based on {@link http://rastergrid.com/blog/2011/01/frei-chen-edge-detector}. - * - * aspect: vec2 of (1/width, 1/height) - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const FreiChenShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts deleted file mode 100644 index ffb41db2f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/GTAOShader.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export function generateMagicSquareNoise(size?: number): DataTexture; -/** - * @module GTAOShader - * @three_import import { GTAOShader } from 'three/addons/shaders/GTAOShader.js'; - */ -/** - * GTAO shader. Use by {@link GTAOPass}. - * - * References: - * - [Practical Realtime Strategies for Accurate Indirect Occlusion](https://iryoku.com/downloads/Practical-Realtime-Strategies-for-Accurate-Indirect-Occlusion.pdf). - * - [Horizon-Based Indirect Lighting (HBIL)](https://github.com/Patapom/GodComplex/blob/master/Tests/TestHBIL/2018%20Mayaux%20-%20Horizon-Based%20Indirect%20Lighting%20(HBIL).pdf) - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const GTAOShader: ShaderMaterial; -/** - * GTAO depth shader. Use by {@link GTAOPass}. - * - * @constant - * @type {Object} - */ -export const GTAODepthShader: Object; -/** - * GTAO blend shader. Use by {@link GTAOPass}. - * - * @constant - * @type {Object} - */ -export const GTAOBlendShader: Object; -import { DataTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts deleted file mode 100644 index 283eb77b0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/GammaCorrectionShader.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @module GammaCorrectionShader - * @three_import import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js'; - */ -/** - * Gamma Correction Shader - * - * References: - * - {@link http://en.wikipedia.org/wiki/gamma_correction}. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const GammaCorrectionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts deleted file mode 100644 index 2114cfc0f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/HalftoneShader.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @module HalftoneShader - * @three_import import { HalftoneShader } from 'three/addons/shaders/HalftoneShader.js'; - */ -/** - * RGB Halftone shader. - * - * Used by {@link HalftonePass}. - * - * Shape (1 = Dot, 2 = Ellipse, 3 = Line, 4 = Square, 5 = Diamond) - * Blending Mode (1 = Linear, 2 = Multiply, 3 = Add, 4 = Lighter, 5 = Darker) - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const HalftoneShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts deleted file mode 100644 index 28377f8a9..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalBlurShader.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @module HorizontalBlurShader - * @three_import import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; - */ -/** - * Two pass Gaussian blur filter (horizontal and vertical blur shaders). - * - * References: - * - {@link http://www.cake23.de/traveling-wavefronts-lit-up.html}. - * - * - 9 samples per pass - * - standard deviation 2.7 - * - "h" and "v" parameters should be set to "1 / width" and "1 / height" - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const HorizontalBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts deleted file mode 100644 index f50eb117e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/HorizontalTiltShiftShader.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @module HorizontalTiltShiftShader - * @three_import import { HorizontalTiltShiftShader } from 'three/addons/shaders/HorizontalTiltShiftShader.js'; - */ -/** - * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position. - * - * - 9 samples per pass - * - standard deviation 2.7 - * - "h" and "v" parameters should be set to "1 / width" and "1 / height" - * - "r" parameter control where "focused" horizontal line lies - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const HorizontalTiltShiftShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts deleted file mode 100644 index 7447091f8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/HueSaturationShader.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @module HueSaturationShader - * @three_import import { HueSaturationShader } from 'three/addons/shaders/HueSaturationShader.js'; - */ -/** - * Hue and saturation adjustment, {@link https://github.com/evanw/glfx.js}. - * - * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc. - * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const HueSaturationShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts deleted file mode 100644 index 15e4c2f5d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/KaleidoShader.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @module KaleidoShader - * @three_import import { KaleidoShader } from 'three/addons/shaders/KaleidoShader.js'; - */ -/** - * Kaleidoscope Shader. - * Radial reflection around center point - * Ported from: {@link http://pixelshaders.com/editor/} - * by [Toby Schachman](http://tobyschachman.com/) - * - * sides: number of reflections - * angle: initial angle in radians - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const KaleidoShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts deleted file mode 100644 index 921107772..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityHighPassShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module LuminosityHighPassShader - * @three_import import { LuminosityHighPassShader } from 'three/addons/shaders/LuminosityHighPassShader.js'; - */ -/** - * Luminosity high pass shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const LuminosityHighPassShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts deleted file mode 100644 index 846896a76..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/LuminosityShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module LuminosityShader - * @three_import import { LuminosityShader } from 'three/addons/shaders/LuminosityShader.js'; - */ -/** - * Luminosity shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const LuminosityShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts deleted file mode 100644 index 418c2ee5b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/MirrorShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module MirrorShader - * @three_import import { MirrorShader } from 'three/addons/shaders/MirrorShader.js'; - */ -/** - * Copies half the input to the other half. - * - * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const MirrorShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts deleted file mode 100644 index 8a3269372..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/NormalMapShader.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @module NormalMapShader - * @three_import import { NormalMapShader } from 'three/addons/shaders/NormalMapShader.js'; - */ -/** - * Normal map shader, compute normals from heightmap. - * @constant - * @type {ShaderMaterial~Shader} - */ -export const NormalMapShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts deleted file mode 100644 index 92a0cb17a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/OutputShader.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @module OutputShader - * @three_import import { OutputShader } from 'three/addons/shaders/OutputShader.js'; - */ -/** - * Performs tone mapping and color space conversion for - * FX workflows. - * - * Used by {@link OutputPass}. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const OutputShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts deleted file mode 100644 index 096d7a99f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/PoissonDenoiseShader.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export function generatePdSamplePointInitializer(samples: any, rings: any, radiusExponent: any): string; -/** - * @module PoissonDenoiseShader - * @three_import import { PoissonDenoiseShader } from 'three/addons/shaders/PoissonDenoiseShader.js'; - */ -/** - * Poisson Denoise Shader. - * - * References: - * - [Self-Supervised Poisson-Gaussian Denoising](https://openaccess.thecvf.com/content/WACV2021/papers/Khademi_Self-Supervised_Poisson-Gaussian_Denoising_WACV_2021_paper.pdf). - * - [Poisson2Sparse: Self-Supervised Poisson Denoising From a Single Image](https://arxiv.org/pdf/2206.01856.pdf) - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const PoissonDenoiseShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts deleted file mode 100644 index 18ef03581..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/RGBShiftShader.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @module RGBShiftShader - * @three_import import { RGBShiftShader } from 'three/addons/shaders/RGBShiftShader.js'; - */ -/** - * RGB Shift Shader - * Shifts red and blue channels from center in opposite directions - * Ported from https://web.archive.org/web/20090820185047/http://kriss.cx/tom/2009/05/rgb-shift/ - * by Tom Butterworth / https://web.archive.org/web/20090810054752/http://kriss.cx/tom/ - * - * amount: shift distance (1 is width of input) - * angle: shift angle in radians - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const RGBShiftShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts deleted file mode 100644 index b6bcb6d30..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/SAOShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module SAOShader - * @three_import import { SAOShader } from 'three/addons/shaders/SAOShader.js'; - */ -/** - * SAO shader. - * - * Used by {@link SAOPass}. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SAOShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts deleted file mode 100644 index 62c115472..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/SMAAShader.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * WebGL port of Subpixel Morphological Antialiasing (SMAA) v2.8 - * Preset: SMAA 1x Medium (with color edge detection) - * - * References: - * - {@link https://github.com/iryoku/smaa/releases/tag/v2.8} - * - * @module SMAAShader - * @three_import import { SMAAShader } from 'three/addons/shaders/SMAAShader.js'; - */ -/** - * SMAA Edges shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SMAAEdgesShader: ShaderMaterial; -/** - * SMAA Weights shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SMAAWeightsShader: ShaderMaterial; -/** - * SMAA Blend shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SMAABlendShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts deleted file mode 100644 index eeb9afa46..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/SSAOShader.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @module SSAOShader - * @three_import import { SSAOShader } from 'three/addons/shaders/SSAOShader.js'; - */ -/** - * SSAO shader. - * - * References: - * - {@link http://john-chapman-graphics.blogspot.com/2013/01/ssao-tutorial.html} - * - {@link https://learnopengl.com/Advanced-Lighting/SSAO} - * - {@link https://github.com/McNopper/OpenGL/blob/master/Example28/shader/ssao.frag.glsl} - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SSAOShader: ShaderMaterial; -/** - * SSAO depth shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SSAODepthShader: ShaderMaterial; -/** - * SSAO blur shader. - * - * @constant - * @type {Object} - */ -export const SSAOBlurShader: Object; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts deleted file mode 100644 index 6bb69e4d6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/SSRShader.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A collection of shaders used for SSR. - * - * References: - * - [3D Game Shaders For Beginners, Screen Space Reflection (SSR)](https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html). - * - * @module SSRShader - * @three_import import * as SSRShader from 'three/addons/shaders/SSRShader.js'; - */ -/** - * SSR shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SSRShader: ShaderMaterial; -/** - * SSR Depth shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SSRDepthShader: ShaderMaterial; -/** - * SSR Blur shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SSRBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts deleted file mode 100644 index 28750538f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/SepiaShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module SepiaShader - * @three_import import { SepiaShader } from 'three/addons/shaders/SepiaShader.js'; - */ -/** - * Sepia tone shader based on [glfx.js sepia shader](https://github.com/evanw/glfx.js). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SepiaShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts deleted file mode 100644 index 6eba3a4ca..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/SobelOperatorShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module SobelOperatorShader - * @three_import import { SobelOperatorShader } from 'three/addons/shaders/SobelOperatorShader.js'; - */ -/** - * Sobel Edge Detection (see {@link https://youtu.be/uihBwtPIBxM}). - * - * As mentioned in the video the Sobel operator expects a grayscale image as input. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SobelOperatorShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts deleted file mode 100644 index b9f7b54f7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/SubsurfaceScatteringShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module SubsurfaceScatteringShader - * @three_import import { SubsurfaceScatteringShader } from 'three/addons/shaders/SubsurfaceScatteringShader.js'; - */ -/** - * Subsurface Scattering shader. - * - * Based on GDC 2011 – [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const SubsurfaceScatteringShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts deleted file mode 100644 index 5b94f59de..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/TechnicolorShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module TriangleBlurShader - * @three_import import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; - */ -/** - * Simulates the look of the two-strip technicolor process popular in early 20th century films. - * More historical info here: {@link http://www.widescreenmuseum.com/oldcolor/technicolor1.htm} - * Demo here: {@link http://charliehoey.com/technicolor_shader/shader_test.html} - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const TechnicolorShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts deleted file mode 100644 index 27e8ccfa4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/ToonShader.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Collection of toon shaders. - * - * @module TriangleBlurShader - * @three_import import * as ToonShader from 'three/addons/shaders/ToonShader.js'; - */ -/** - * Toon1 shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const ToonShader1: ShaderMaterial; -/** - * Toon2 shader. - * - * @constant - * @type {Object} - */ -export const ToonShader2: Object; -/** - * Toon Hatching shader. - * - * @constant - * @type {Object} - */ -export const ToonShaderHatching: Object; -/** - * Toon Dotted shader. - * - * @constant - * @type {Object} - */ -export const ToonShaderDotted: Object; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts deleted file mode 100644 index ead206593..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/TriangleBlurShader.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @module TriangleBlurShader - * @three_import import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; - */ -/** - * Triangle blur shader based on [glfx.js triangle blur shader](https://github.com/evanw/glfx.js). - * - * A basic blur filter, which convolves the image with a - * pyramid filter. The pyramid filter is separable and is applied as two - * perpendicular triangle filters. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const TriangleBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts deleted file mode 100644 index f351e2dd6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/UnpackDepthRGBAShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module UnpackDepthRGBAShader - * @three_import import { UnpackDepthRGBAShader } from 'three/addons/shaders/UnpackDepthRGBAShader.js'; - */ -/** - * Depth visualization shader that shows depth values as monochrome color. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const UnpackDepthRGBAShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts deleted file mode 100644 index db4b5800b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/VelocityShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module VelocityShader - * @three_import import { VelocityShader } from 'three/addons/shaders/VelocityShader.js'; - */ -/** - * Mesh velocity shader by @bhouston. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const VelocityShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts deleted file mode 100644 index ff448f282..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalBlurShader.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @module VerticalBlurShader - * @three_import import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; - */ -/** - * Two pass Gaussian blur filter (horizontal and vertical blur shaders) - * - see {@link http://www.cake23.de/traveling-wavefronts-lit-up.html} - * - * - 9 samples per pass - * - standard deviation 2.7 - * - "h" and "v" parameters should be set to "1 / width" and "1 / height" - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const VerticalBlurShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts deleted file mode 100644 index 341f5b80c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/VerticalTiltShiftShader.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @module VerticalTiltShiftShader - * @three_import import { VerticalTiltShiftShader } from 'three/addons/shaders/VerticalTiltShiftShader.js'; - */ -/** - * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position - * - * - 9 samples per pass - * - standard deviation 2.7 - * - "h" and "v" parameters should be set to "1 / width" and "1 / height" - * - "r" parameter control where "focused" horizontal line lies - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const VerticalTiltShiftShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts deleted file mode 100644 index 9461b9018..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/VignetteShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module VignetteShader - * @three_import import { VignetteShader } from 'three/addons/shaders/VignetteShader.js'; - */ -/** - * Based on [PaintEffect postprocess from ro.me](https://github.com/dataarts/3-dreams-of-black/blob/master/deploy/js/effects/PaintEffect.js). - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const VignetteShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts deleted file mode 100644 index 04bbdc80d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/VolumeShader.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @module VolumeShader - * @three_import import { VolumeRenderShader1 } from 'three/addons/shaders/VolumeShader.js'; - */ -/** - * Shaders to render 3D volumes using raycasting. - * The applied techniques are based on similar implementations in the Visvis and Vispy projects. - * This is not the only approach, therefore it's marked 1. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const VolumeRenderShader1: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts b/jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts deleted file mode 100644 index 5b5c7ff3a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/shaders/WaterRefractionShader.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @module WaterRefractionShader - * @three_import import { WaterRefractionShader } from 'three/addons/shaders/WaterRefractionShader.js'; - */ -/** - * Basic water refraction shader. - * - * @constant - * @type {ShaderMaterial~Shader} - */ -export const WaterRefractionShader: ShaderMaterial; diff --git a/jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts b/jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts deleted file mode 100644 index 40226d8e3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/textures/FlakesTexture.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Utility class for generating a flakes texture image. This image might be used - * as a normal map to produce a car paint like effect. - * - * @three_import import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; - */ -export class FlakesTexture { - /** - * Generates a new flakes texture image. The result is a canvas - * that can be used as an input for {@link CanvasTexture}. - * - * @param {number} [width=512] - The width of the image. - * @param {number} [height=512] - The height of the image. - * @return {HTMLCanvasElement} The generated image. - */ - constructor(width?: number, height?: number); -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts deleted file mode 100644 index 59d646aaf..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/AST.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -export class ASTNode { - isASTNode: boolean; - linker: { - reference: null; - accesses: never[]; - assignments: never[]; - }; - parent: any; - get isNumericExpression(): boolean; - get hasAssignment(): any; - getType(): any; - getProgram(): this | null; - getParent(parents?: any[]): any; - initialize(): void; -} -export class Comment extends ASTNode { - constructor(comment: any); - comment: any; - isComment: boolean; -} -export class Program extends ASTNode { - constructor(body?: any[]); - body: any[]; - structTypes: Map; - isProgram: boolean; -} -export class VariableDeclaration extends ASTNode { - constructor(type: any, name: any, value?: null, next?: null, immutable?: boolean); - type: any; - name: any; - value: any; - next: any; - immutable: boolean; - isVariableDeclaration: boolean; - get isAssignment(): boolean; -} -export class Uniform extends ASTNode { - constructor(type: any, name: any); - type: any; - name: any; - isUniform: boolean; -} -export class Varying extends ASTNode { - constructor(type: any, name: any); - type: any; - name: any; - isVarying: boolean; -} -export class FunctionParameter extends ASTNode { - constructor(type: any, name: any, qualifier?: null, immutable?: boolean); - type: any; - name: any; - qualifier: any; - immutable: boolean; - isFunctionParameter: boolean; -} -export class FunctionDeclaration extends ASTNode { - constructor(type: any, name: any, params?: any[], body?: any[]); - type: any; - name: any; - params: any[]; - body: any[]; - isFunctionDeclaration: boolean; -} -export class Expression extends ASTNode { - constructor(expression: any); - expression: any; - isExpression: boolean; -} -export class Ternary extends ASTNode { - constructor(cond: any, left: any, right: any); - cond: any; - left: any; - right: any; - isTernary: boolean; -} -export class Operator extends ASTNode { - constructor(type: any, left: any, right: any); - type: any; - left: any; - right: any; - isOperator: boolean; - get isAssignment(): boolean; -} -export class Unary extends ASTNode { - constructor(type: any, expression: any, after?: boolean); - type: any; - expression: any; - after: boolean; - isUnary: boolean; - get isAssignment(): boolean; -} -export class Number extends ASTNode { - constructor(value: any, type?: string); - type: string; - value: any; - isNumber: boolean; -} -export class String extends ASTNode { - constructor(value: any); - value: any; - isString: boolean; -} -export class Conditional extends ASTNode { - constructor(cond?: null, body?: any[]); - cond: any; - body: any[]; - elseConditional: any; - isConditional: boolean; -} -export class FunctionCall extends ASTNode { - constructor(name: any, params?: any[]); - name: any; - params: any[]; - isFunctionCall: boolean; -} -export class Return extends ASTNode { - constructor(value: any); - value: any; - isReturn: boolean; -} -export class Discard extends ASTNode { - isDiscard: boolean; -} -export class Continue extends ASTNode { - isContinue: boolean; -} -export class Break extends ASTNode { - isBreak: boolean; -} -export class Accessor extends ASTNode { - constructor(property: any); - property: any; - isAccessor: boolean; -} -export class StaticElement extends ASTNode { - constructor(value: any); - value: any; - isStaticElement: boolean; -} -export class DynamicElement extends ASTNode { - constructor(value: any); - value: any; - isDynamicElement: boolean; -} -export class AccessorElements extends ASTNode { - constructor(object: any, elements?: any[]); - object: any; - elements: any[]; - isAccessorElements: boolean; -} -export class For extends ASTNode { - constructor(initialization: any, condition: any, afterthought: any, body?: any[]); - initialization: any; - condition: any; - afterthought: any; - body: any[]; - isFor: boolean; -} -export class While extends ASTNode { - constructor(condition: any, body?: any[], doWhile?: boolean); - condition: any; - body: any[]; - doWhile: boolean; - isWhile: boolean; -} -export class Switch extends ASTNode { - constructor(discriminant: any, cases: any); - discriminant: any; - cases: any; - isSwitch: boolean; -} -export class SwitchCase extends ASTNode { - constructor(body: any, conditions?: null); - body: any; - conditions: any; - isDefault: boolean; - isSwitchCase: boolean; -} -export class StructMember { - constructor(type: any, name: any); - type: any; - name: any; - isStructMember: boolean; -} -export class StructDefinition extends ASTNode { - constructor(name: any, members?: any[]); - name: any; - members: any[]; - isStructDefinition: boolean; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts deleted file mode 100644 index b347373ec..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/GLSLDecoder.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -export default GLSLDecoder; -declare class GLSLDecoder { - index: number; - tokenizer: Tokenizer | null; - keywords: any[]; - structTypes: Map; - addPolyfill(name: any, polyfill: any): this; - get tokens(): any[]; - readToken(): any; - getTokenPosition(token: any): string; - getToken(offset?: number): any; - getTokensUntil(str: any, tokens: any, offset?: number): any[]; - readTokensUntil(str: any): any[]; - parseExpressionFromTokens(tokens: any): any; - parseAccessorElementsFromTokens(tokens: any): any; - parseFunctionParametersFromTokens(tokens: any): any; - parseExpression(): any; - parseFunctionParams(tokens: any): FunctionParameter[]; - parseFunction(): any; - parseVariablesFromToken(tokens: any, type: any): any; - parseVariables(): any; - parseUniform(): Uniform; - parseVarying(): Varying; - parseStructDefinition(): StructDefinition; - parseReturn(): Return; - parseWhile(): any; - parseDoWhile(): any; - parseFor(): any; - parseSwitch(): any; - parseSwitchCases(): any; - parseIf(): any; - parseBlock(): any; - evaluateCondition(expr: any, macros: any): boolean; - extractMacroArgs(str: any): string[]; - expandMacros(line: any, macros: any): any; - preprocess(source: any): string; - parse(source: any): Program; -} -declare class Tokenizer { - constructor(source: any); - source: any; - position: number; - tokens: any[]; - tokenize(): this; - skip(...params: any[]): any; - nextToken(): Token | undefined; - readToken(): Token | undefined; -} -import { FunctionParameter } from './AST.js'; -import { Uniform } from './AST.js'; -import { Varying } from './AST.js'; -import { StructDefinition } from './AST.js'; -import { Return } from './AST.js'; -import { Program } from './AST.js'; -declare class Token { - constructor(tokenizer: any, type: any, str: any, pos: any); - tokenizer: any; - type: any; - str: any; - pos: any; - isTag: boolean; - tags: any; - get endPos(): any; - get isNumber(): boolean; - get isString(): boolean; - get isLiteral(): boolean; - get isOperator(): boolean; -} -declare namespace Token { - let LINE: string; - let COMMENT: string; - let NUMBER: string; - let STRING: string; - let LITERAL: string; - let OPERATOR: string; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts deleted file mode 100644 index 41d776add..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/Linker.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export default Linker; -declare class Linker { - block: any; - addBlock(node: any): void; - removeBlock(node: any): void; - processVariables(node: any): void; - processUniform(node: any): void; - processVarying(node: any): void; - evalProperty(node: any): string; - processExpression(node: any): void; - processBody(body: any): void; - processConditional(node: any): void; - processForWhile(node: any): void; - processSwitch(switchNode: any): void; - processFunction(node: any): void; - process(ast: any): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts deleted file mode 100644 index e38bd27ca..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/ShaderToyDecoder.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export default ShaderToyDecoder; -declare class ShaderToyDecoder extends GLSLDecoder { -} -import GLSLDecoder from './GLSLDecoder.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts deleted file mode 100644 index 0bf5232f6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/TSLEncoder.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default TSLEncoder; -declare class TSLEncoder { - tab: string; - imports: Set; - global: Set; - overloadings: Map; - iife: boolean; - reference: boolean; - block: any; - addImport(name: any): void; - emitUniform(node: any): string; - emitExpression(node: any, output?: null): any; - emitBody(body: any): string; - emitTernary(node: any): string; - emitConditional(node: any): any; - isVariableUsed(node: any, varName: any): boolean; - emitLoop(node: any): any; - emitSwitch(switchNode: any): any; - emitFor(node: any): any; - emitForWhile(node: any): any; - emitDoWhile(node: any): any; - emitWhile(node: any): any; - emitVariables(node: any, isRoot?: boolean): string; - emitVarying(node: any): string; - emitStructDefinition(node: any): string; - emitOverloadingFunction(nodes: any): string; - emitFunction(node: any): string; - emitComment(statement: any, body: any): string; - emitExtraLine(statement: any, body: any): "" | "\n"; - emit(ast: any): string; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts deleted file mode 100644 index ff77458cb..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/Transpiler.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -export default Transpiler; -/** - * A class that transpiles shader code from one language into another. - * - * `Transpiler` can only be used to convert GLSL into TSL right now. It is intended - * to support developers when they want to migrate their custom materials from the - * current to the new node-based material system. - * - * @three_import import Transpiler from 'three/addons/transpiler/Transpiler.js'; - */ -declare class Transpiler { - /** - * Constructs a new transpiler. - * - * @param {GLSLDecoder} decoder - The GLSL decoder. - * @param {TSLEncoder} encoder - The TSL encoder. - */ - constructor(decoder: GLSLDecoder, encoder: TSLEncoder); - /** - * The GLSL decoder. This component parse GLSL and produces - * a language-independent AST for further processing. - * - * @type {GLSLDecoder} - */ - decoder: GLSLDecoder; - /** - * The TSL encoder. It takes the AST and emits TSL code. - * - * @type {TSLEncoder} - */ - encoder: TSLEncoder; - /** - * The linker. It processes the AST and resolves - * variable and function references, ensuring that all - * dependencies are properly linked. - * - * @type {Linker} - */ - linker: Linker; - /** - * Parses the given GLSL source and returns TSL syntax. - * - * @param {string} source - The GLSL source. - * @return {string} The TSL code. - */ - parse(source: string): string; -} -import Linker from './Linker.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts deleted file mode 100644 index ec88472ef..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/TranspilerUtils.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function isExpression(st: any): boolean; -export function isPrimitive(value: any): boolean; -export function isBuiltinType(str: any): boolean; -export function toFloatType(type: any): any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts b/jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts deleted file mode 100644 index 2e43a1d74..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/transpiler/WGSLEncoder.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default WGSLEncoder; -declare class WGSLEncoder { - tab: string; - functions: Map; - uniforms: any[]; - varyings: any[]; - structs: Map; - polyfills: Map; - groupIndex: number; - getWgslType(type: any): any; - emitExpression(node: any): any; - emitTextureAccess(node: any): any; - emitBody(body: any): string; - emitConditional(node: any): any; - emitFor(node: any): string; - emitWhile(node: any): any; - emitSwitch(node: any): any; - emitVariables(node: any): string; - emitStructDefinition(node: any): string; - emitFunction(node: any): string; - emitComment(statement: any, body: any): string; - emitExtraLine(statement: any, body: any): "" | "\n"; - emit(ast: any): string; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts deleted file mode 100644 index 755c8d91e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AfterImageNode.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -export function afterImage(node: Node, damp?: (Node | number)): AfterImageNode; -export default AfterImageNode; -/** - * Post processing node for creating an after image effect. - * - * @augments TempNode - * @three_import import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; - */ -declare class AfterImageNode extends TempNode { - /** - * Constructs a new after image node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {Node} [damp=0.96] - The damping intensity. A higher value means a stronger after image effect. - */ - constructor(textureNode: TextureNode, damp?: Node); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * How quickly the after-image fades. A higher value means the after-image - * persists longer, while a lower value means it fades faster. Should be in - * the range `[0, 1]`. - * - * @type {Node} - */ - damp: Node; - /** - * The render target used for compositing the effect. - * - * @private - * @type {RenderTarget} - */ - private _compRT; - /** - * The render target that represents the previous frame. - * - * @private - * @type {RenderTarget} - */ - private _oldRT; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * The texture represents the pervious frame. - * - * @private - * @type {TextureNode} - */ - private _textureNodeOld; - /** - * The material for the composite pass. - * - * @private - * @type {?NodeMaterial} - */ - private _materialComposed; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts deleted file mode 100644 index bb4019473..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -export default AnaglyphPassNode; -export function anaglyphPass(scene: Scene, camera: Camera): AnaglyphPassNode; -/** - * A render pass node that creates an anaglyph effect using physically-correct - * off-axis stereo projection. - * - * This implementation uses CameraUtils.frameCorners() to align stereo - * camera frustums to a virtual screen plane, providing accurate depth - * perception with zero parallax at the plane distance. - * - * @augments StereoCompositePassNode - * @three_import import { anaglyphPass, AnaglyphAlgorithm, AnaglyphColorMode } from 'three/addons/tsl/display/AnaglyphPassNode.js'; - */ -declare class AnaglyphPassNode extends StereoCompositePassNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAnaglyphPassNode: boolean; - /** - * The interpupillary distance (eye separation) in world units. - * Typical human IPD is 0.064 meters (64mm). - * - * @type {number} - * @default 0.064 - */ - eyeSep: number; - /** - * The distance in world units from the viewer to the virtual - * screen plane where zero parallax (screen depth) occurs. - * Objects at this distance appear at the screen surface. - * Objects closer appear in front of the screen (negative parallax). - * Objects further appear behind the screen (positive parallax). - * - * The screen dimensions are derived from the camera's FOV and aspect ratio - * at this distance, ensuring the stereo view matches the camera's field of view. - * - * @type {number} - * @default 0.5 - */ - planeDistance: number; - /** - * The current anaglyph algorithm. - * - * @private - * @type {string} - * @default 'dubois' - */ - private _algorithm; - /** - * The current color mode. - * - * @private - * @type {string} - * @default 'redCyan' - */ - private _colorMode; - /** - * Color matrix node for the left eye. - * - * @private - * @type {UniformNode} - */ - private _colorMatrixLeft; - /** - * Color matrix node for the right eye. - * - * @private - * @type {UniformNode} - */ - private _colorMatrixRight; - /** - * Sets the anaglyph algorithm. - * - * @type {string} - */ - set algorithm(value: string); - /** - * Gets the current anaglyph algorithm. - * - * @type {string} - */ - get algorithm(): string; - /** - * Sets the color mode. - * - * @type {string} - */ - set colorMode(value: string); - /** - * Gets the current color mode. - * - * @type {string} - */ - get colorMode(): string; - /** - * Updates the color matrices based on current algorithm and color mode. - * - * @private - */ - private _updateMatrices; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -/** - * Anaglyph algorithm types. - */ -export type AnaglyphAlgorithm = string; -export namespace AnaglyphAlgorithm { - let TRUE: string; - let GREY: string; - let COLOUR: string; - let HALF_COLOUR: string; - let DUBOIS: string; - let OPTIMISED: string; - let COMPROMISE: string; -} -/** - * Anaglyph color modes. - */ -export type AnaglyphColorMode = string; -export namespace AnaglyphColorMode { - let RED_CYAN: string; - let MAGENTA_CYAN: string; - let MAGENTA_GREEN: string; -} -import StereoCompositePassNode from './StereoCompositePassNode.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts deleted file mode 100644 index 6bc590e84..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BilateralBlurNode.d.ts +++ /dev/null @@ -1,138 +0,0 @@ -export default BilateralBlurNode; -export function bilateralBlur(node: Node, directionNode: Node, sigma: number, sigmaColor: number): BilateralBlurNode; -/** - * Post processing node for creating a bilateral blur effect. - * - * Bilateral blur smooths an image while preserving sharp edges. Unlike a - * standard Gaussian blur which blurs everything equally, bilateral blur - * analyzes the intensity/color of neighboring pixels. If a neighbor is too - * different from the center pixel (indicating an edge), it is excluded - * from the blurring process. - * - * Reference: {@link https://en.wikipedia.org/wiki/Bilateral_filter} - * - * @augments TempNode - * @three_import import { bilateralBlur } from 'three/addons/tsl/display/BilateralBlurNode.js'; - */ -declare class BilateralBlurNode extends TempNode { - /** - * Constructs a new bilateral blur node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {Node} directionNode - Defines the direction and radius of the blur. - * @param {number} sigma - Controls the spatial kernel of the blur filter. Higher values mean a wider blur radius. - * @param {number} sigmaColor - Controls the intensity kernel. Higher values allow more color difference to be blurred together. - */ - constructor(textureNode: TextureNode, directionNode?: Node, sigma?: number, sigmaColor?: number); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * Defines the direction and radius of the blur. - * - * @type {Node} - */ - directionNode: Node; - /** - * Controls the spatial kernel of the blur filter. Higher values mean a wider blur radius. - * - * @type {number} - */ - sigma: number; - /** - * Controls the color/intensity kernel. Higher values allow more color difference - * to be blurred together. Lower values preserve edges more strictly. - * - * @type {number} - */ - sigmaColor: number; - /** - * A uniform node holding the inverse resolution value. - * - * @private - * @type {UniformNode} - */ - private _invSize; - /** - * Bilateral blur is applied in two passes (horizontal, vertical). - * This node controls the direction of each pass. - * - * @private - * @type {UniformNode} - */ - private _passDirection; - /** - * The render target used for the horizontal pass. - * - * @private - * @type {RenderTarget} - */ - private _horizontalRT; - /** - * The render target used for the vertical pass. - * - * @private - * @type {RenderTarget} - */ - private _verticalRT; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * The material for the blur pass. - * - * @private - * @type {?NodeMaterial} - */ - private _material; - /** - * The resolution scale. - * - * @type {number} - * @default 1 - */ - resolutionScale: number; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; - /** - * Computes spatial (Gaussian) coefficients depending on the given kernel radius. - * These coefficients are used for the spatial component of the bilateral filter. - * - * @private - * @param {number} kernelRadius - The kernel radius. - * @return {Array} - */ - private _getSpatialCoefficients; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts deleted file mode 100644 index 638306ce2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BleachBypass.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Applies a bleach bypass effect to the given color node. - * - * @tsl - * @function - * @param {Node} color - The color node to apply the sepia for. - * @param {Node} [opacity=1] - Influences how strong the effect is blended with the original color. - * @return {Node} The updated color node. - */ -export const bleach: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts deleted file mode 100644 index 056cd15a0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/BloomNode.d.ts +++ /dev/null @@ -1,247 +0,0 @@ -export function bloom(node: Node, strength?: number, radius?: number, threshold?: number): BloomNode; -export default BloomNode; -/** - * Post processing node for creating a bloom effect. - * ```js - * const renderPipeline = new THREE.RenderPipeline( renderer ); - * - * const scenePass = pass( scene, camera ); - * const scenePassColor = scenePass.getTextureNode( 'output' ); - * - * const bloomPass = bloom( scenePassColor ); - * - * renderPipeline.outputNode = scenePassColor.add( bloomPass ); - * ``` - * By default, the node affects the entire image. For a selective bloom, - * use the `emissive` material property to control which objects should - * contribute to bloom or not. This can be achieved via MRT. - * ```js - * const renderPipeline = new THREE.RenderPipeline( renderer ); - * - * const scenePass = pass( scene, camera ); - * scenePass.setMRT( mrt( { - * output, - * emissive - * } ) ); - * - * const scenePassColor = scenePass.getTextureNode( 'output' ); - * const emissivePass = scenePass.getTextureNode( 'emissive' ); - * - * const bloomPass = bloom( emissivePass ); - * renderPipeline.outputNode = scenePassColor.add( bloomPass ); - * ``` - * @augments TempNode - * @three_import import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - */ -declare class BloomNode extends TempNode { - /** - * Constructs a new bloom node. - * - * @param {Node} inputNode - The node that represents the input of the effect. - * @param {number} [strength=1] - The strength of the bloom. - * @param {number} [radius=0] - The radius of the bloom. - * @param {number} [threshold=0] - The luminance threshold limits which bright areas contribute to the bloom effect. - */ - constructor(inputNode: Node, strength?: number, radius?: number, threshold?: number); - /** - * The node that represents the input of the effect. - * - * @type {Node} - */ - inputNode: Node; - /** - * The strength of the bloom. - * - * @type {UniformNode} - */ - strength: UniformNode; - /** - * The radius of the bloom. Must be in the range `[0,1]`. - * - * @type {UniformNode} - */ - radius: UniformNode; - /** - * The luminance threshold limits which bright areas contribute to the bloom effect. - * - * @type {UniformNode} - */ - threshold: UniformNode; - /** - * Can be used to tweak the extracted luminance from the scene. - * - * @type {UniformNode} - */ - smoothWidth: UniformNode; - /** - * A per-mip tint color for the bloom, applied during the composite pass. - * Defaults to white (no tint) for each of the mips. Mutate the vectors to - * colorize the bloom (e.g. for a warm or anamorphic look). - * - * @type {Array} - */ - bloomTintColors: Array; - /** - * Scale factor for the internal render targets. - * - * @private - * @type {number} - * @default 0.5 - */ - private _resolutionScale; - /** - * Can be used to inject a custom high pass filter (e.g., for anamorphic effects). - * - * @type {Function} - */ - highPassFn: Function; - /** - * An array that holds the render targets for the horizontal blur passes. - * - * @private - * @type {Array} - */ - private _renderTargetsHorizontal; - /** - * An array that holds the render targets for the vertical blur passes. - * - * @private - * @type {Array} - */ - private _renderTargetsVertical; - /** - * The number if blur mips. - * - * @private - * @type {number} - */ - private _nMips; - /** - * The render target for the luminance pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetBright; - /** - * The material for the composite pass. - * - * @private - * @type {?NodeMaterial} - */ - private _compositeMaterial; - /** - * The material for the luminance pass. - * - * @private - * @type {?NodeMaterial} - */ - private _highPassFilterMaterial; - /** - * The materials for the blur pass. - * - * @private - * @type {Array} - */ - private _separableBlurMaterials; - /** - * The result of the luminance pass as a texture node for further processing. - * - * @private - * @type {TextureNode} - */ - private _textureNodeBright; - /** - * The result of the first blur pass as a texture node for further processing. - * - * @private - * @type {TextureNode} - */ - private _textureNodeBlur0; - /** - * The result of the second blur pass as a texture node for further processing. - * - * @private - * @type {TextureNode} - */ - private _textureNodeBlur1; - /** - * The result of the third blur pass as a texture node for further processing. - * - * @private - * @type {TextureNode} - */ - private _textureNodeBlur2; - /** - * The result of the fourth blur pass as a texture node for further processing. - * - * @private - * @type {TextureNode} - */ - private _textureNodeBlur3; - /** - * The result of the fifth blur pass as a texture node for further processing. - * - * @private - * @type {TextureNode} - */ - private _textureNodeBlur4; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureOutput; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the resolution scale for the pass. - * The resolution scale is a factor that is multiplied with the renderer's width and height. - * - * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. - * @return {BloomNode} A reference to this node. - */ - setResolutionScale(resolutionScale: number): BloomNode; - /** - * Gets the current resolution scale of the pass. - * - * @return {number} The current resolution scale. A value of `1` means full resolution. - */ - getResolutionScale(): number; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; - /** - * Create a separable blur material for the given kernel radius. - * - * @private - * @param {NodeContext} sharedContext - * @param {number} kernelRadius - The kernel radius. - * @return {NodeMaterial} - */ - private _getSeparableBlurMaterial; -} -import { TempNode } from 'three/webgpu'; -import { Vector3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts deleted file mode 100644 index 8fa82745a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/CRT.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Creates barrel-distorted UV coordinates. - * The center of the screen appears to bulge outward (convex distortion). - * - * @tsl - * @function - * @param {Node} [curvature=0.1] - The amount of curvature (0 = flat, 0.5 = very curved). - * @param {Node} [coord=uv()] - The input UV coordinates. - * @return {Node} The distorted UV coordinates. - */ -export const barrelUV: () => void; -/** - * Checks if UV coordinates are inside the valid 0-1 range. - * Useful for masking areas inside the distorted screen. - * - * @tsl - * @function - * @param {Node} coord - The UV coordinates to check. - * @return {Node} 1.0 if inside bounds, 0.0 if outside. - */ -export const barrelMask: () => void; -/** - * Applies color bleeding effect to simulate horizontal color smearing. - * Simulates the analog signal bleeding in CRT displays where colors - * "leak" into adjacent pixels horizontally. - * - * @tsl - * @function - * @param {Node} color - The input texture node. - * @param {Node} [amount=0.002] - The amount of color bleeding (0-0.01). - * @return {Node} The color with bleeding effect applied. - */ -export const colorBleeding: () => void; -/** - * Applies scanline effect to simulate CRT monitor horizontal lines with animation. - * - * @tsl - * @function - * @param {Node} color - The input color. - * @param {Node} [intensity=0.3] - The intensity of the scanlines (0-1). - * @param {Node} [count=240] - The number of scanlines (typically matches vertical resolution). - * @param {Node} [speed=0.0] - The scroll speed of scanlines (0 = static, 1 = normal CRT roll). - * @param {Node} [coord=uv()] - The UV coordinates to use for scanlines. - * @return {Node} The color with scanlines applied. - */ -export const scanlines: () => void; -/** - * Applies vignette effect to darken the edges of the screen. - * - * @tsl - * @function - * @param {Node} color - The input color. - * @param {Node} [intensity=0.4] - The intensity of the vignette (0-1). - * @param {Node} [smoothness=0.5] - The smoothness of the vignette falloff. - * @param {Node} [coord=uv()] - The UV coordinates to use for vignette calculation. - * @return {Node} The color with vignette applied. - */ -export const vignette: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts deleted file mode 100644 index 564bed21b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ChromaticAberrationNode.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -export default ChromaticAberrationNode; -export function chromaticAberration(node: Node, strength?: Node | number, center?: (Node | Vector2) | null, scale?: Node | number): ChromaticAberrationNode; -/** - * Post processing node for applying chromatic aberration effect. - * This effect simulates the color fringing that occurs in real camera lenses - * by separating and offsetting the red, green, and blue channels. - * - * @augments TempNode - * @three_import import { chromaticAberration } from 'three/addons/tsl/display/ChromaticAberrationNode.js'; - */ -declare class ChromaticAberrationNode extends TempNode { - /** - * Constructs a new chromatic aberration node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {Node} strengthNode - The strength of the chromatic aberration effect as a node. - * @param {Node} centerNode - The center point of the effect as a node. - * @param {Node} scaleNode - The scale factor for stepped scaling from center as a node. - */ - constructor(textureNode: TextureNode, strengthNode: Node, centerNode: Node, scaleNode: Node); - /** - * The texture node that represents the input of the effect. - * - * @type {texture} - */ - textureNode: texture; - /** - * A node holding the strength of the effect. - * - * @type {Node} - */ - strengthNode: Node; - /** - * A node holding the center point of the effect. - * - * @type {Node} - */ - centerNode: Node; - /** - * A node holding the scale factor for stepped scaling. - * - * @type {Node} - */ - scaleNode: Node; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts deleted file mode 100644 index 26cac984d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DenoiseNode.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -export default DenoiseNode; -export function denoise(node: Node, depthNode: Node, normalNode: Node | null, camera: Camera): DenoiseNode; -/** - * Post processing node for denoising data like raw screen-space ambient occlusion output. - * Denoise can noticeably improve the quality of ambient occlusion but also add quite some - * overhead to the post processing setup. It's best to make its usage optional (e.g. via - * graphic settings). - * - * Reference: {@link https://openaccess.thecvf.com/content/WACV2021/papers/Khademi_Self-Supervised_Poisson-Gaussian_Denoising_WACV_2021_paper.pdf}. - * - * @augments TempNode - * @three_import import { denoise } from 'three/addons/tsl/display/DenoiseNode.js'; - */ -declare class DenoiseNode extends TempNode { - /** - * Constructs a new denoise node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect (e.g. AO). - * @param {Node} depthNode - A node that represents the scene's depth. - * @param {?Node} normalNode - A node that represents the scene's normals. - * @param {Camera} camera - The camera the scene is rendered with. - */ - constructor(textureNode: TextureNode, depthNode: Node, normalNode: Node | null, camera: Camera); - /** - * The texture node that represents the input of the effect (e.g. AO). - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * A node that represents the scene's depth. - * - * @type {Node} - */ - depthNode: Node; - /** - * A node that represents the scene's normals. If no normals are passed to the - * constructor (because MRT is not available), normals can be automatically - * reconstructed from depth values in the shader. - * - * @type {?Node} - */ - normalNode: Node | null; - /** - * The node represents the internal noise texture. - * - * @type {TextureNode} - */ - noiseNode: TextureNode; - /** - * The luma Phi value. - * - * @type {UniformNode} - */ - lumaPhi: UniformNode; - /** - * The depth Phi value. - * - * @type {UniformNode} - */ - depthPhi: UniformNode; - /** - * The normal Phi value. - * - * @type {UniformNode} - */ - normalPhi: UniformNode; - /** - * The radius. - * - * @type {UniformNode} - */ - radius: UniformNode; - /** - * The index. - * - * @type {UniformNode} - */ - index: UniformNode; - /** - * The resolution of the effect. - * - * @private - * @type {UniformNode} - */ - private _resolution; - /** - * An array of sample vectors. - * - * @private - * @type {UniformArrayNode} - */ - private _sampleVectors; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * This method is used to update internal uniforms once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts deleted file mode 100644 index 0a33cfff6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DepthOfFieldNode.d.ts +++ /dev/null @@ -1,212 +0,0 @@ -export default DepthOfFieldNode; -export function dof(node: Node, viewZNode: Node, focusDistance?: Node | number, focalLength?: Node | number, bokehScale?: Node | number): DepthOfFieldNode; -/** - * Post processing node for creating depth of field (DOF) effect. - * - * References: - * - {@link https://pixelmischiefblog.wordpress.com/2016/11/25/bokeh-depth-of-field/} - * - {@link https://www.adriancourreges.com/blog/2016/09/09/doom-2016-graphics-study/} - * - * @augments TempNode - * @three_import import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js'; - */ -declare class DepthOfFieldNode extends TempNode { - /** - * Constructs a new DOF node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {Node} viewZNode - Represents the viewZ depth values of the scene. - * @param {Node} focusDistanceNode - Defines the effect's focus which is the distance along the camera's look direction in world units. - * @param {Node} focalLengthNode - How far an object can be from the focal plane before it goes completely out-of-focus in world units. - * @param {Node} bokehScaleNode - A unitless value for artistic purposes to adjust the size of the bokeh. - */ - constructor(textureNode: TextureNode, viewZNode: Node, focusDistanceNode: Node, focalLengthNode: Node, bokehScaleNode: Node); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * Represents the viewZ depth values of the scene. - * - * @type {Node} - */ - viewZNode: Node; - /** - * Defines the effect's focus which is the distance along the camera's look direction in world units. - * - * @type {Node} - */ - focusDistanceNode: Node; - /** - * How far an object can be from the focal plane before it goes completely out-of-focus in world units. - * - * @type {Node} - */ - focalLengthNode: Node; - /** - * A unitless value for artistic purposes to adjust the size of the bokeh. - * - * @type {Node} - */ - bokehScaleNode: Node; - /** - * The inverse size of the resolution. - * - * @private - * @type {UniformNode} - */ - private _invSize; - /** - * The render target used for the near and far field. - * - * @private - * @type {RenderTarget} - */ - private _CoCRT; - /** - * The render target used for blurring the near field. - * - * @private - * @type {RenderTarget} - */ - private _CoCBlurredRT; - /** - * The render target used for the first blur pass. - * - * @private - * @type {RenderTarget} - */ - private _blur64RT; - /** - * The render target used for the near field's second blur pass. - * - * @private - * @type {RenderTarget} - */ - private _blur16NearRT; - /** - * The render target used for the far field's second blur pass. - * - * @private - * @type {RenderTarget} - */ - private _blur16FarRT; - /** - * The render target used for the composite - * - * @private - * @type {RenderTarget} - */ - private _compositeRT; - /** - * The material used for the CoC/near and far fields. - * - * @private - * @type {NodeMaterial} - */ - private _CoCMaterial; - /** - * The material used for blurring the near field. - * - * @private - * @type {NodeMaterial} - */ - private _CoCBlurredMaterial; - /** - * The material used for the 64 tap blur. - * - * @private - * @type {NodeMaterial} - */ - private _blur64Material; - /** - * The material used for the 16 tap blur. - * - * @private - * @type {NodeMaterial} - */ - private _blur16Material; - /** - * The material used for the final composite. - * - * @private - * @type {NodeMaterial} - */ - private _compositeMaterial; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {TextureNode} - */ - private _textureNode; - /** - * The result of the CoC pass as a texture node. - * - * @private - * @type {TextureNode} - */ - private _CoCTextureNode; - /** - * The Gaussian blur node used to blur the near field's circle of confusion. - * - * @private - * @type {GaussianBlurNode} - */ - private _CoCBlurNode; - /** - * The result of the blur64 pass as a texture node. - * - * @private - * @type {TextureNode} - */ - private _blur64TextureNode; - /** - * The result of the near field's blur16 pass as a texture node. - * - * @private - * @type {TextureNode} - */ - private _blur16NearTextureNode; - /** - * The result of the far field's blur16 pass as a texture node. - * - * @private - * @type {TextureNode} - */ - private _blur16FarTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * This method is used to update the effect's uniforms once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(builder: NodeBuilder): ShaderCallNodeInternal; - _generateKernels(): { - points16: Vector2[]; - points64: Vector2[]; - }; -} -import { TempNode } from 'three/webgpu'; -import { Vector2 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts deleted file mode 100644 index c3e37fe86..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/DotScreenNode.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export default DotScreenNode; -export function dotScreen(node: Node, angle?: number, scale?: number): DotScreenNode; -/** - * Post processing node for creating dot-screen effect. - * - * @augments TempNode - * @three_import import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js'; - */ -declare class DotScreenNode extends TempNode { - /** - * Constructs a new dot screen node. - * - * @param {Node} inputNode - The node that represents the input of the effect. - * @param {number} [angle=1.57] - The rotation of the effect in radians. - * @param {number} [scale=1] - The scale of the effect. A higher value means smaller dots. - */ - constructor(inputNode: Node, angle?: number, scale?: number); - /** - * The node that represents the input of the effect. - * - * @type {Node} - */ - inputNode: Node; - /** - * A uniform node that represents the rotation of the effect in radians. - * - * @type {UniformNode} - */ - angle: UniformNode; - /** - * A uniform node that represents the scale of the effect. A higher value means smaller dots. - * - * @type {UniformNode} - */ - scale: UniformNode; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts deleted file mode 100644 index ce9465982..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FSR1Node.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -export default FSR1Node; -export function fsr1(node: Node, sharpness?: (number | Node), denoise?: (boolean | Node)): FSR1Node; -/** - * Post processing node for applying AMD FidelityFX Super Resolution 1 (FSR 1). - * - * Combines two passes: - * - **EASU** (Edge-Adaptive Spatial Upsampling): Uses 12 texture samples in a cross pattern - * to detect local edge direction, then shapes an approximate Lanczos2 kernel into an - * ellipse aligned with the detected edge. - * - **RCAS** (Robust Contrast-Adaptive Sharpening): Uses a 5-tap cross pattern to apply - * contrast-aware sharpening that is automatically limited per-pixel to avoid artifacts. - * - * Note: Only use FSR 1 if your application is fragment-shader bound and cannot afford to render - * at full resolution. FSR 1 adds its own overhead, so simply shaded scenes will render faster - * at native resolution without it. Besides, FSR 1 should always be used with an anti-aliased - * source image. - * - * Reference: {@link https://gpuopen.com/fidelityfx-superresolution/}. - * - * @augments TempNode - * @three_import import { fsr1 } from 'three/addons/tsl/display/fsr1/FSR1Node.js'; - */ -declare class FSR1Node extends TempNode { - /** - * Constructs a new FSR 1 node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {Node} [sharpness=0.2] - RCAS sharpening strength. 0 = maximum sharpening, 2 = no sharpening. - * @param {Node} [denoise=false] - Whether to attenuate RCAS sharpening in noisy areas. - */ - constructor(textureNode: TextureNode, sharpness?: Node, denoise?: Node); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * RCAS sharpening strength. 0 = maximum, 2 = none. - * - * @type {Node} - */ - sharpness: Node; - /** - * Whether to attenuate RCAS sharpening in noisy areas. - * - * @type {Node} - */ - denoise: Node; - /** - * The render target for the EASU upscale pass. - * - * @private - * @type {RenderTarget} - */ - private _easuRT; - /** - * The render target for the RCAS sharpen pass. - * - * @private - * @type {RenderTarget} - */ - private _rcasRT; - /** - * The result of the effect as a texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * The material for the EASU pass. - * - * @private - * @type {?NodeMaterial} - */ - private _easuMaterial; - /** - * The material for the RCAS pass. - * - * @private - * @type {?NodeMaterial} - */ - private _rcasMaterial; - /** - * Sets the output size of the effect. - * - * @param {number} width - The width in pixels. - * @param {number} height - The height in pixels. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts deleted file mode 100644 index aa6c1cc3a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FXAANode.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export default FXAANode; -export function fxaa(node: Node): FXAANode; -/** - * Post processing node for applying FXAA. This node requires sRGB input - * so tone mapping and color space conversion must happen before the anti-aliasing. - * - * @augments TempNode - * @three_import import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; - */ -declare class FXAANode extends TempNode { - /** - * Constructs a new FXAA node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - */ - constructor(textureNode: TextureNode); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * A uniform node holding the inverse resolution value. - * - * @private - * @type {UniformNode} - */ - private _invSize; - /** - * This method is used to update the effect's uniforms once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts deleted file mode 100644 index 0cac52e90..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/FilmNode.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -export default FilmNode; -/** - * TSL function for creating a film node for post processing. - * - * @tsl - * @function - * @param {Node} inputNode - The node that represents the input of the effect. - * @param {?Node} [intensityNode=null] - A node that represents the effect's intensity. - * @param {?Node} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data. - * @returns {FilmNode} - */ -export const film: any; -/** - * Post processing node for creating a film grain effect. - * - * @augments TempNode - * @three_import import { film } from 'three/addons/tsl/display/FilmNode.js'; - */ -declare class FilmNode extends TempNode { - /** - * Constructs a new film node. - * - * @param {Node} inputNode - The node that represents the input of the effect. - * @param {?Node} [intensityNode=null] - A node that represents the effect's intensity. - * @param {?Node} [uvNode=null] - A node that allows to pass custom (e.g. animated) uv data. - */ - constructor(inputNode: Node, intensityNode?: Node | null, uvNode?: Node | null); - /** - * The node that represents the input of the effect. - * - * @type {Node} - */ - inputNode: Node; - /** - * A node that represents the effect's intensity. - * - * @type {?Node} - * @default null - */ - intensityNode: Node | null; - /** - * A node that allows to pass custom (e.g. animated) uv data. - * - * @type {?Node} - * @default null - */ - uvNode: Node | null; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts deleted file mode 100644 index e0d8e5bc3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GTAONode.d.ts +++ /dev/null @@ -1,259 +0,0 @@ -export default GTAONode; -export function ao(depthNode: Node, normalNode: Node | null, camera: Camera): GTAONode; -/** - * Post processing node for applying Ground Truth Ambient Occlusion (GTAO) to a scene. - * ```js - * const renderPipeline = new THREE.RenderPipeline( renderer ); - * - * // pre-pass for normals and depth - * - * const prePass = pass( scene, camera ); - * prePass.setMRT( mrt( { - * output: normalView - * } ) ); - * - * const prePassNormal = prePass.getTextureNode(); - * const prePassDepth = prePass.getTextureNode( 'depth' ); - * - * // scene pass - * - * const scenePass = pass( scene, camera ); - * - * // ao - * - * const aoPass = ao( prePassDepth, prePassNormal, camera ); - * const aoPassOutput = aoPass.getTextureNode(); - * - * // apply the ambient occlusion to the scene - * - * scenePass.contextNode = builtinAOContext( aoPassOutput.sample( screenUV ).r ); - * - * renderPipeline.outputNode = scenePass; - * ``` - * - * Reference: [Practical Real-Time Strategies for Accurate Indirect Occlusion](https://www.activision.com/cdn/research/Practical_Real_Time_Strategies_for_Accurate_Indirect_Occlusion_NEW%20VERSION_COLOR.pdf). - * - * @augments TempNode - * @three_import import { ao } from 'three/addons/tsl/display/GTAONode.js'; - */ -declare class GTAONode extends TempNode { - /** - * Constructs a new GTAO node. - * - * @param {Node} depthNode - A node that represents the scene's depth. - * @param {?Node} normalNode - A node that represents the scene's normals. - * @param {Camera} camera - The camera the scene is rendered with. - */ - constructor(depthNode: Node, normalNode: Node | null, camera: Camera); - /** - * A node that represents the scene's depth. - * - * @type {Node} - */ - depthNode: Node; - /** - * A node that represents the scene's normals. If no normals are passed to the - * constructor (because MRT is not available), normals can be automatically - * reconstructed from depth values in the shader. - * - * @type {?Node} - */ - normalNode: Node | null; - /** - * The resolution scale. By default the effect is rendered in full resolution - * for best quality but a value of `0.5` should be sufficient for most scenes. - * - * @type {number} - * @default 1 - */ - resolutionScale: number; - /** - * The render target the ambient occlusion is rendered into. - * - * @private - * @type {RenderTarget} - */ - private _aoRenderTarget; - /** - * The radius of the ambient occlusion. - * - * @type {UniformNode} - */ - radius: UniformNode; - /** - * The thickness of the ambient occlusion. - * - * @type {UniformNode} - */ - thickness: UniformNode; - /** - * @deprecated since r186. The new distance model "Quadratic Ray Stepping" - * does not need it anymore. - * - * @type {UniformNode} - */ - distanceExponent: UniformNode; - /** - * @deprecated since r186. The new distance model "Quadratic Ray Stepping" - * does not need it anymore. - * - * @type {UniformNode} - */ - distanceFallOff: UniformNode; - /** - * The scale of the ambient occlusion. - * - * @type {UniformNode} - */ - scale: UniformNode; - /** - * How many samples are used to compute the AO. - * A higher value results in better quality but also - * in a more expensive runtime behavior. - * - * Note: Changing this member triggers a shader recompilation. - * - * @type {UniformNode} - */ - samples: UniformNode; - /** - * Whether to use temporal filtering or not. Setting this property to - * `true` requires the usage of `TRAANode`. This will help to reduce noise - * although it introduces typical TAA artifacts like ghosting and temporal - * instabilities. - * - * If setting this property to `false`, a manual denoise via `DenoiseNode` - * might be required. - * - * @type {boolean} - * @default false - */ - useTemporalFiltering: boolean; - /** - * The resolution of the effect. Can be scaled via `resolutionScale`. - * - * @private - * @type {UniformNode} - */ - private _resolution; - /** - * The node represents the internal noise texture used by the AO. - * - * @private - * @type {TextureNode} - */ - private _noiseNode; - /** - * Represents the projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrix; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * Represents the near value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraNear; - /** - * Represents the far value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraFar; - /** - * Temporal direction that influences the rotation angle for each slice. - * - * @private - * @type {UniformNode} - */ - private _temporalDirection; - /** - * Temporal offset added to the initial ray step. - * - * @private - * @type {UniformNode} - */ - private _temporalOffset; - /** - * Resolution scale uniform. - * - * @private - * @type {UniformNode} - */ - private _resolutionScale; - /** - * The TSL function that computes the AO. Required for rebuild. - * - * @private - * @type {?Function} - * @default null - */ - private _ao; - /** - * The sample count currently baked into the shader. - * - * @private - * @type {number} - */ - private _currentSamples; - /** - * The shared builder context. Required for rebuild. - * - * @private - * @type {?Object} - * @default null - */ - private _sharedContext; - /** - * The material that is used to render the effect. - * - * @private - * @type {NodeMaterial} - */ - private _material; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts deleted file mode 100644 index 7d9e95355..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GaussianBlurNode.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -/** - * TSL function for creating a gaussian blur node for post processing with enabled premultiplied alpha. - * - * @tsl - * @function - * @deprecated since r180. Use `gaussianBlur()` with `premultipliedAlpha: true` option instead. - * @param {Node} node - The node that represents the input of the effect. - * @param {Node} directionNode - Defines the direction and radius of the blur. - * @param {number} sigma - Controls the kernel of the blur filter. Higher values mean a wider blur radius. - * @returns {GaussianBlurNode} - */ -export function premultipliedGaussianBlur(node: Node, directionNode: Node, sigma: number): GaussianBlurNode; -export default GaussianBlurNode; -export function gaussianBlur(node: Node, directionNode: Node, sigma: number, options?: { - premultipliedAlpha?: boolean | undefined; - resolutionScale?: number | undefined; -}): GaussianBlurNode; -/** - * Post processing node for creating a gaussian blur effect. - * - * @augments TempNode - * @three_import import { gaussianBlur, premultipliedGaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - */ -declare class GaussianBlurNode extends TempNode { - /** - * Constructs a new gaussian blur node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {Node} directionNode - Defines the direction and radius of the blur. - * @param {number} sigma - Controls the kernel of the blur filter. Higher values mean a wider blur radius. - * @param {Object} [options={}] - Additional options for the gaussian blur effect. - * @param {boolean} [options.premultipliedAlpha=false] - Whether to use premultiplied alpha for the blur effect. - * @param {number} [options.resolutionScale=1] - The resolution of the effect. 0.5 means half the resolution of the texture node. - */ - constructor(textureNode: TextureNode, directionNode?: Node, sigma?: number, options?: { - premultipliedAlpha?: boolean | undefined; - resolutionScale?: number | undefined; - }); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * Defines the direction and radius of the blur. - * - * @type {Node} - */ - directionNode: Node; - /** - * Controls the kernel of the blur filter. Higher values mean a wider blur radius. - * - * @type {number} - */ - sigma: number; - /** - * A uniform node holding the inverse resolution value. - * - * @private - * @type {UniformNode} - */ - private _invSize; - /** - * Gaussian blur is applied in two passes (horizontal, vertical). - * This node controls the direction of each pass. - * - * @private - * @type {UniformNode} - */ - private _passDirection; - /** - * The render target used for the horizontal pass. - * - * @private - * @type {RenderTarget} - */ - private _horizontalRT; - /** - * The render target used for the vertical pass. - * - * @private - * @type {RenderTarget} - */ - private _verticalRT; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * The material for the blur pass. - * - * @private - * @type {?NodeMaterial} - */ - private _material; - /** - * The resolution scale. - * - * @type {number} - * @default (1) - */ - resolutionScale: number; - /** - * Whether the effect should use premultiplied alpha or not. Set this to `true` - * if you are going to blur texture input with transparency. - * - * @type {boolean} - * @default false - */ - premultipliedAlpha: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @default true - * @readonly - */ - readonly isGaussianBlurNode: boolean; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; - /** - * Computes gaussian coefficients depending on the given kernel radius. - * - * @private - * @param {number} kernelRadius - The kernel radius. - * @return {Array} - */ - private _getCoefficients; - set resolution(value: Vector2); - /** - * The resolution scale. - * - * @deprecated - * @type {Vector2} - * @default {(1,1)} - */ - get resolution(): Vector2; -} -import { TempNode } from 'three/webgpu'; -import { Vector2 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts deleted file mode 100644 index dfd74ef47..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/GodraysNode.d.ts +++ /dev/null @@ -1,201 +0,0 @@ -export default GodraysNode; -export function godrays(depthNode: TextureNode, camera: Camera, light: (DirectionalLight | PointLight)): GodraysNode; -/** - * Post-Processing node for apply Screen-space raymarched godrays to a scene. - * - * After the godrays have been computed, it's recommened to apply a Bilateral - * Blur to the result to mitigate raymarching and noise artifacts. - * - * The composite with the scene pass is ideally done with `depthAwareBlend()`, - * which mitigates aliasing and light leaking. - * - * ```js - * const godraysPass = godrays( scenePassDepth, camera, light ); - * - * const blurPass = bilateralBlur( godraysPassColor ); // optional blur - * - * const outputBlurred = depthAwareBlend( scenePassColor, blurPassColor, scenePassDepth, camera, { blendColor, edgeRadius, edgeStrength } ); // composite - * ``` - * - * Limitations: - * - * - Only point and directional lights are currently supported. - * - The effect requires a full shadow setup. Meaning shadows must be enabled in the renderer, - * 3D objects must cast and receive shadows and the main light must cast shadows. - * - * Reference: This Node is a part of [three-good-godrays](https://github.com/Ameobea/three-good-godrays). - * - * @augments TempNode - * @three_import import { godrays } from 'three/addons/tsl/display/GodraysNode.js'; - */ -declare class GodraysNode extends TempNode { - /** - * Constructs a new Godrays node. - * - * @param {TextureNode} depthNode - A texture node that represents the scene's depth. - * @param {Camera} camera - The camera the scene is rendered with. - * @param {(DirectionalLight|PointLight)} light - The light the godrays are rendered for. - */ - constructor(depthNode: TextureNode, camera: Camera, light: (DirectionalLight | PointLight)); - /** - * A node that represents the beauty pass's depth. - * - * @type {TextureNode} - */ - depthNode: TextureNode; - /** - * The number of raymarching steps - * - * @type {UniformNode} - * @default 60 - */ - raymarchSteps: UniformNode; - /** - * The rate of accumulation for the godrays. Higher values roughly equate to more humid air/denser fog. - * - * @type {UniformNode} - * @default 0.7 - */ - density: UniformNode; - /** - * The maximum density of the godrays. Limits the maximum brightness of the godrays. - * - * @type {UniformNode} - * @default 0.5 - */ - maxDensity: UniformNode; - /** - * Higher values decrease the accumulation of godrays the further away they are from the light source. - * - * @type {UniformNode} - * @default 2 - */ - distanceAttenuation: UniformNode; - /** - * The resolution scale. - * - * @type {number} - */ - resolutionScale: number; - /** - * Represents the world matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraMatrixWorld; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _premultipliedLightCameraMatrix; - /** - * Represents the world position of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraPosition; - /** - * Represents the near value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraNear; - /** - * Represents the far value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraFar; - /** - * The near value of the shadow camera. - * - * @private - * @type {ReferenceNode} - */ - private _shadowCameraNear; - /** - * The far value of the shadow camera. - * - * @private - * @type {ReferenceNode} - */ - private _shadowCameraFar; - _fNormals: import("three/webgpu").UniformArrayNode; - _fConstants: import("three/webgpu").UniformArrayNode; - /** - * The light the godrays are rendered for. - * - * @private - * @type {(DirectionalLight|PointLight)} - */ - private _light; - /** - * The camera the scene is rendered with. - * - * @private - * @type {Camera} - */ - private _camera; - /** - * The render target the godrays are rendered into. - * - * @private - * @type {RenderTarget} - */ - private _godraysRenderTarget; - /** - * The material that is used to render the effect. - * - * @private - * @type {NodeMaterial} - */ - private _material; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - _updateLightParams(): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts deleted file mode 100644 index 6e6e3a603..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ImportanceSampledEnvironment.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -export default ImportanceSampledEnvironment; -/** - * Manages a preprocessed HDR environment map (CDF textures, uniforms) and exposes - * TSL helpers for BRDF-direction lookups and MIS importance sampling. - * - * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} - */ -declare class ImportanceSampledEnvironment { - /** - * @param {boolean} [importanceSampling=false] - When `true`, builds luminance CDF tables and enables MIS env sampling. - */ - constructor(importanceSampling?: boolean); - _importanceSampling: boolean; - _cdf: EnvMapCDFGenerator; - _totalSum: import("three/webgpu").UniformNode; - _size: import("three/webgpu").UniformNode; - intensity: import("three/webgpu").UniformNode; - _mapNode: import("three/webgpu").TextureNode | null; - _marginalNode: import("three/webgpu").TextureNode | null; - _conditionalNode: import("three/webgpu").TextureNode | null; - /** - * @param {Texture} hdr - Equirectangular HDR environment map. - */ - updateFrom(hdr: Texture): void; - clear(): void; - /** - * Simple environment lookup along the reflected direction (no MIS). - * - * @param {Object} params - * @param {UniformNode} params.cameraWorldMatrix - * @param {Node} params.viewReflectDir - * @param {Node} [params.sampleWeight] - Optional radiance scale (defaults to 1). - * @return {Node} - */ - sampleReflect({ cameraWorldMatrix, viewReflectDir, sampleWeight }: { - cameraWorldMatrix: UniformNode; - viewReflectDir: Node; - sampleWeight?: Node; - }): Node; - /** - * Environment reflection for a screen-space miss using only the BRDF / reflected-ray direction. - * - * @param {Object} params - * @param {UniformNode} params.cameraWorldMatrix - * @param {Node} params.viewReflectDir - View-space GGX-sampled reflected ray. - * @param {Node} params.N - View-space shading normal. - * @param {Node} params.V - View-space direction to camera. - * @param {Node} params.alpha - GGX roughness (alpha). - * @param {Node} params.f0 - * @return {Node} - */ - sampleEnvironmentBRDF({ cameraWorldMatrix, viewReflectDir, N, V, alpha, f0 }: { - cameraWorldMatrix: UniformNode; - viewReflectDir: Node; - N: Node; - V: Node; - alpha: Node; - f0: Node; - }): Node; - /** - * Environment reflection for a screen-space miss, estimated with multiple importance - * sampling (MIS) between the BRDF / reflected-ray direction and the env-luminance CDF - * direction. Both techniques use consistent solid-angle PDFs (`D·G1(N·V)/(4·N·V)`), so - * the power heuristic is unbiased. Adapted from three-gpu-pathtracer. - * - * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} - * - * @param {Object} params - * @param {UniformNode} params.cameraWorldMatrix - * @param {Node} params.viewReflectDir - View-space GGX-sampled reflected ray. - * @param {Node} params.N - View-space shading normal. - * @param {Node} params.V - View-space direction to camera. - * @param {Node} params.alpha - GGX roughness (alpha). - * @param {Node} params.f0 - * @param {Node} params.Xi2 - Second blue-noise sample (zw used for the CDF). - * @return {Node} - */ - sampleEnvironmentMIS({ cameraWorldMatrix, viewReflectDir, N, V, alpha, f0, Xi2 }: { - cameraWorldMatrix: UniformNode; - viewReflectDir: Node; - N: Node; - V: Node; - alpha: Node; - f0: Node; - Xi2: Node; - }): Node; - dispose(): void; -} -/** - * Precomputes marginal and conditional CDF textures from an equirectangular HDR environment map - * for luminance importance sampling. - */ -declare class EnvMapCDFGenerator { - map: any; - marginalWeights: DataTexture | null; - conditionalWeights: DataTexture | null; - totalSum: number; - updateFrom(hdr: any): void; - updateMapOnly(hdr: any): void; - dispose(): void; -} -import { DataTexture } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts deleted file mode 100644 index 924f98774..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/LensflareNode.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -export default LensflareNode; -export function lensflare(node: TextureNode, params: { - ghostTint?: Node | Color; - threshold?: Node | number; - ghostSamples?: Node | number; - ghostSpacing?: Node | number; - ghostAttenuationFactor?: Node | number; - downSampleRatio?: number | undefined; -}): LensflareNode; -/** - * Post processing node for adding a bloom-based lens flare effect. This effect - * requires that you extract the bloom of the scene via a bloom pass first. - * - * References: - * - {@link https://john-chapman-graphics.blogspot.com/2013/02/pseudo-lens-flare.html}. - * - {@link https://john-chapman.github.io/2017/11/05/pseudo-lens-flare.html}. - * - * @augments TempNode - * @three_import import { lensflare } from 'three/addons/tsl/display/LensflareNode.js'; - */ -declare class LensflareNode extends TempNode { - /** - * Constructs a new lens flare node. - * - * @param {TextureNode} textureNode - The texture node that represents the scene's bloom. - * @param {Object} params - The parameter object for configuring the effect. - * @param {Node | Color} [params.ghostTint=vec3(1, 1, 1)] - Defines the tint of the flare/ghosts. - * @param {Node | number} [params.threshold=float(0.5)] - Controls the size and strength of the effect. A higher threshold results in smaller flares. - * @param {Node | number} [params.ghostSamples=float(4)] - Represents the number of flares/ghosts per bright spot which pivot around the center. - * @param {Node | number} [params.ghostSpacing=float(0.25)] - Defines the spacing of the flares/ghosts. - * @param {Node | number} [params.ghostAttenuationFactor=float(25)] - Defines the attenuation factor of flares/ghosts. - * @param {number} [params.downSampleRatio=4] - Defines how downsampling since the effect is usually not rendered at full resolution. - */ - constructor(textureNode: TextureNode, params?: { - ghostTint?: Node | Color; - threshold?: Node | number; - ghostSamples?: Node | number; - ghostSpacing?: Node | number; - ghostAttenuationFactor?: Node | number; - downSampleRatio?: number | undefined; - }); - /** - * The texture node that represents the scene's bloom. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * Defines the tint of the flare/ghosts. - * - * @type {Node} - */ - ghostTintNode: Node; - /** - * Controls the size and strength of the effect. A higher threshold results in smaller flares. - * - * @type {Node} - */ - thresholdNode: Node; - /** - * Represents the number of flares/ghosts per bright spot which pivot around the center. - * - * @type {Node} - */ - ghostSamplesNode: Node; - /** - * Defines the spacing of the flares/ghosts. - * - * @type {Node} - */ - ghostSpacingNode: Node; - /** - * Defines the attenuation factor of flares/ghosts. - * - * @type {Node} - */ - ghostAttenuationFactorNode: Node; - /** - * Defines how downsampling since the effect is usually not rendered at full resolution. - * - * @type {number} - */ - downSampleRatio: number; - /** - * The internal render target of the effect. - * - * @private - * @type {RenderTarget} - */ - private _renderTarget; - /** - * The node material that holds the effect's TSL code. - * - * @private - * @type {NodeMaterial} - */ - private _material; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts deleted file mode 100644 index 29e3620ff..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Lut3DNode.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export default Lut3DNode; -export function lut3D(node: Node, lut: TextureNode, size: number, intensity: Node | number): Lut3DNode; -/** - * A post processing node for color grading via lookup tables. - * - * @augments TempNode - * @three_import import { lut3D } from 'three/addons/tsl/display/Lut3DNode.js'; - */ -declare class Lut3DNode extends TempNode { - /** - * Constructs a new LUT node. - * - * @param {Node} inputNode - The node that represents the input of the effect. - * @param {TextureNode} lutNode - A texture node that represents the lookup table. - * @param {number} size - The size of the lookup table. - * @param {Node} intensityNode - Controls the intensity of the effect. - */ - constructor(inputNode: Node, lutNode: TextureNode, size: number, intensityNode: Node); - /** - * The node that represents the input of the effect. - * - * @type {Node} - */ - inputNode: Node; - /** - * A texture node that represents the lookup table. - * - * @type {TextureNode} - */ - lutNode: TextureNode; - /** - * The size of the lookup table. - * - * @type {UniformNode} - */ - size: UniformNode; - /** - * Controls the intensity of the effect. - * - * @type {Node} - */ - intensityNode: Node; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts deleted file mode 100644 index 618927b5d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/MotionBlur.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Applies a motion blur effect to the given input node. - * - * @tsl - * @function - * @param {Node} inputNode - The input node to apply the motion blur for. - * @param {Node} velocity - The motion vectors of the beauty pass. - * @param {Node} [numSamples=int(16)] - How many samples the effect should use. A higher value results in better quality but is also more expensive. - * @return {Node} The input node with the motion blur effect applied. - */ -export const motionBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts deleted file mode 100644 index d15fa4427..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OITPassNode.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -export default OITPassNode; -export function oitPass(scene: Scene, camera: Camera, options?: Object): OITPassNode; -/** - * A render pass node that renders the scene with Order-Independent Transparency - * based on the Weighted Blended OIT technique by McGuire and Bavoil. - * - * Transparent objects are rendered in a separate pass into two accumulation - * targets (a weighted color sum and the pixel's revealage) which are - * then composited over the rest of the scene. Since the result does not depend - * on the draw order, artifacts from sorting-based transparency like popping or - * incorrectly resolved intersecting geometry are avoided. - * - * Only transparent materials using `NormalBlending` and no transmission qualify - * for OIT. All other objects are rendered as usual. - * - * MSAA is only supported with the WebGPU backend. - * - * MRT configurations assigned via `setMRT()` apply to the default pass only. - * OIT-qualified objects contribute to the color output but not to custom - * MRT outputs since a pixel may accumulate multiple transparent surfaces. - * - * ```js - * const renderPipeline = new THREE.RenderPipeline( renderer ); - * renderPipeline.outputNode = oitPass( scene, camera ); - * ``` - * - * References: - * - {@link https://jcgt.org/published/0002/02/09/} - * - {@link https://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html} - * - * @augments PassNode - * @three_import import { oitPass } from 'three/addons/tsl/display/OITPassNode.js'; - */ -declare class OITPassNode extends PassNode { - /** - * Constructs a new OIT pass node. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera to render the scene with. - * @param {Object} [options={}] - Options for the internal render target. - */ - constructor(scene: Scene, camera: Camera, options?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOITPassNode: boolean; - /** - * The depth-based weight of a transparent fragment, see equations (7) to (9) - * in the paper. When `null`, equation (9) is used. Must be assigned before - * the first render. - * - * @type {?Node} - * @default null - */ - weightNode: Node | null; - /** - * The render target holding the OIT accumulation textures. - * - * @private - * @type {RenderTarget} - */ - private _oitRenderTarget; - /** - * The MRT configuration for the OIT pass. - * - * @private - * @type {?MRTNode} - */ - private _oitMRTNode; - /** - * The renderer of the current frame. - * - * @private - * @type {?Renderer} - */ - private _renderer; - /** - * Renders opaque objects and transparent objects that do not qualify for OIT. - * - * @private - * @type {Function} - */ - private _defaultRenderObjectFunction; - /** - * Renders OIT-qualified objects into the accumulation targets. - * - * @private - * @type {Function} - */ - private _oitRenderObjectFunction; - /** - * Returns the MRT configuration for the OIT pass. - * - * @private - * @return {MRTNode} The MRT node. - */ - private _getMRTNode; - setSize(width: any, height: any): void; - setup(builder: any): any; -} -import { PassNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts deleted file mode 100644 index a7b2befe2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/OutlineNode.d.ts +++ /dev/null @@ -1,351 +0,0 @@ -export default OutlineNode; -export function outline(scene: Scene, camera: Camera, params: { - selectedObjects?: Object3D[] | undefined; - edgeThickness?: Node; - edgeGlow?: Node; - downSampleRatio?: number | undefined; -}): OutlineNode; -/** - * Post processing node for rendering outlines around selected objects. The node - * gives you great flexibility in composing the final outline look depending on - * your requirements. - * ```js - * const renderPipeline = new THREE.RenderPipeline( renderer ); - * - * const scenePass = pass( scene, camera ); - * - * // outline parameter - * - * const edgeStrength = uniform( 3.0 ); - * const edgeGlow = uniform( 0.0 ); - * const edgeThickness = uniform( 1.0 ); - * const visibleEdgeColor = uniform( new THREE.Color( 0xffffff ) ); - * const hiddenEdgeColor = uniform( new THREE.Color( 0x4e3636 ) ); - * - * outlinePass = outline( scene, camera, { - * selectedObjects, - * edgeGlow, - * edgeThickness - * } ); - * - * // compose custom outline - * - * const { visibleEdge, hiddenEdge } = outlinePass; - * const outlineColor = visibleEdge.mul( visibleEdgeColor ).add( hiddenEdge.mul( hiddenEdgeColor ) ).mul( edgeStrength ); - * - * renderPipeline.outputNode = outlineColor.add( scenePass ); - * ``` - * - * @augments TempNode - * @three_import import { outline } from 'three/addons/tsl/display/OutlineNode.js'; - */ -declare class OutlineNode extends TempNode { - /** - * Constructs a new outline node. - * - * @param {Scene} scene - A reference to the scene. - * @param {Camera} camera - The camera the scene is rendered with. - * @param {Object} params - The configuration parameters. - * @param {Array} [params.selectedObjects] - An array of selected objects. - * @param {Node} [params.edgeThickness=float(1)] - The thickness of the edges. - * @param {Node} [params.edgeGlow=float(0)] - Can be used for an animated glow/pulse effects. - * @param {number} [params.downSampleRatio=2] - The downsample ratio. - */ - constructor(scene: Scene, camera: Camera, params?: { - selectedObjects?: Object3D[] | undefined; - edgeThickness?: Node; - edgeGlow?: Node; - downSampleRatio?: number | undefined; - }); - /** - * A reference to the scene. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera the scene is rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * An array of selected objects. - * - * @type {Array} - */ - selectedObjects: Array; - /** - * The thickness of the edges. - * - * @type {Node} - */ - edgeThicknessNode: Node; - /** - * Can be used for an animated glow/pulse effect. - * - * @type {Node} - */ - edgeGlowNode: Node; - /** - * The downsample ratio. - * - * @type {number} - * @default 2 - */ - downSampleRatio: number; - /** - * The render target for the depth pre-pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetDepthBuffer; - /** - * The render target for the mask pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetMaskBuffer; - /** - * The render target for the mask downsample. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetMaskDownSampleBuffer; - /** - * The first render target for the edge detection. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetEdgeBuffer1; - /** - * The second render target for the edge detection. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetEdgeBuffer2; - /** - * The first render target for the blur pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetBlurBuffer1; - /** - * The second render target for the blur pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetBlurBuffer2; - /** - * The render target for the final composite. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetComposite; - /** - * Represents the near value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraNear; - /** - * Represents the far value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraFar; - /** - * Uniform that represents the blur direction of the pass. - * - * @private - * @type {UniformNode} - */ - private _blurDirection; - /** - * Texture node that holds the data from the depth pre-pass. - * - * @private - * @type {TextureNode} - */ - private _depthTextureUniform; - /** - * Texture node that holds the data from the mask pass. - * - * @private - * @type {TextureNode} - */ - private _maskTextureUniform; - /** - * Texture node that holds the data from the mask downsample pass. - * - * @private - * @type {TextureNode} - */ - private _maskTextureDownsSampleUniform; - /** - * Texture node that holds the data from the first edge detection pass. - * - * @private - * @type {TextureNode} - */ - private _edge1TextureUniform; - /** - * Texture node that holds the data from the second edge detection pass. - * - * @private - * @type {TextureNode} - */ - private _edge2TextureUniform; - /** - * Texture node that holds the current blurred color data. - * - * @private - * @type {TextureNode} - */ - private _blurColorTextureUniform; - /** - * Visible edge color. - * - * @private - * @type {Node} - */ - private _visibleEdgeColor; - /** - * Hidden edge color. - * - * @private - * @type {Node} - */ - private _hiddenEdgeColor; - /** - * The material for the depth pre-pass. - * - * @private - * @type {NodeMaterial} - */ - private _depthMaterial; - _depthSpriteMaterial: SpriteNodeMaterial; - /** - * The material for preparing the mask. - * - * @private - * @type {NodeMaterial} - */ - private _prepareMaskMaterial; - _prepareMaskSpriteMaterial: SpriteNodeMaterial; - /** - * The copy material - * - * @private - * @type {NodeMaterial} - */ - private _materialCopy; - /** - * The edge detection material. - * - * @private - * @type {NodeMaterial} - */ - private _edgeDetectionMaterial; - /** - * The material that is used to render in the blur pass. - * - * @private - * @type {NodeMaterial} - */ - private _separableBlurMaterial; - /** - * The material that is used to render in the blur pass. - * - * @private - * @type {NodeMaterial} - */ - private _separableBlurMaterial2; - /** - * The final composite material. - * - * @private - * @type {NodeMaterial} - */ - private _compositeMaterial; - /** - * A set to cache selected objects in the scene. - * - * @private - * @type {Set} - */ - private _selectionCache; - /** - * The number of selected objects from the previous frame. Used to detect - * the transition to an empty selection so the composite render target can - * be cleared once and avoid leaving a stale outline on screen. - * - * @private - * @type {number} - * @default 0 - */ - private _lastSelectionCount; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * A mask value that represents the visible edge. - * - * @return {Node} The visible edge. - */ - get visibleEdge(): Node; - /** - * A mask value that represents the hidden edge. - * - * @return {Node} The hidden edge. - */ - get hiddenEdge(): Node; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(): PassTextureNode; - /** - * Updates the selection cache based on the selected objects. - * - * @private - */ - private _updateSelectionCache; -} -import { TempNode } from 'three/webgpu'; -import { SpriteNodeMaterial } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts deleted file mode 100644 index a63395293..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/ParallaxBarrierPassNode.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export default ParallaxBarrierPassNode; -export function parallaxBarrierPass(scene: Scene, camera: Camera): ParallaxBarrierPassNode; -/** - * A render pass node that creates a parallax barrier effect. - * - * @augments StereoCompositePassNode - * @three_import import { parallaxBarrierPass } from 'three/addons/tsl/display/ParallaxBarrierPassNode.js'; - */ -declare class ParallaxBarrierPassNode extends StereoCompositePassNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isParallaxBarrierPassNode: boolean; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import StereoCompositePassNode from './StereoCompositePassNode.js'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts deleted file mode 100644 index 8e2a1b56e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/PixelationPassNode.d.ts +++ /dev/null @@ -1,134 +0,0 @@ -export function pixelationPass(scene: Scene, camera: Camera, pixelSize?: Node | number, normalEdgeStrength?: Node | number, depthEdgeStrength?: Node | number): PixelationPassNode; -export default PixelationPassNode; -/** - * A special render pass node that renders the scene with a pixelation effect. - * - * @augments PassNode - * @three_import import { pixelationPass } from 'three/addons/tsl/display/PixelationPassNode.js'; - */ -declare class PixelationPassNode extends PassNode { - /** - * Constructs a new pixelation pass node. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera to render the scene with. - * @param {Node | number} [pixelSize=6] - The pixel size. - * @param {Node | number} [normalEdgeStrength=0.3] - The normal edge strength. - * @param {Node | number} [depthEdgeStrength=0.4] - The depth edge strength. - */ - constructor(scene: Scene, camera: Camera, pixelSize?: Node | number, normalEdgeStrength?: Node | number, depthEdgeStrength?: Node | number); - /** - * The pixel size. - * - * @type {number} - * @default 6 - */ - pixelSize: number; - /** - * The normal edge strength. - * - * @type {number} - * @default 0.3 - */ - normalEdgeStrength: number; - /** - * The depth edge strength. - * - * @type {number} - * @default 0.4 - */ - depthEdgeStrength: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPixelationPassNode: boolean; - _mrt: any; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PixelationNode} - */ - setup(): PixelationNode; -} -import { PassNode } from 'three/webgpu'; -/** - * A inner node definition that implements the actual pixelation TSL code. - * - * @inner - * @augments TempNode - */ -declare class PixelationNode extends TempNode { - /** - * Constructs a new pixelation node. - * - * @param {TextureNode} textureNode - The texture node that represents the beauty pass. - * @param {TextureNode} depthNode - The texture that represents the beauty's depth. - * @param {TextureNode} normalNode - The texture that represents the beauty's normals. - * @param {Node} pixelSize - The pixel size. - * @param {Node} normalEdgeStrength - The normal edge strength. - * @param {Node} depthEdgeStrength - The depth edge strength. - */ - constructor(textureNode: TextureNode, depthNode: TextureNode, normalNode: TextureNode, pixelSize: Node, normalEdgeStrength: Node, depthEdgeStrength: Node); - /** - * The texture node that represents the beauty pass. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * The texture that represents the beauty's depth. - * - * @type {TextureNode} - */ - depthNode: TextureNode; - /** - * The texture that represents the beauty's normals. - * - * @type {TextureNode} - */ - normalNode: TextureNode; - /** - * The pixel size. - * - * @type {Node} - */ - pixelSize: Node; - /** - * The pixel size. - * - * @type {Node} - */ - normalEdgeStrength: Node; - /** - * The depth edge strength. - * - * @type {Node} - */ - depthEdgeStrength: Node; - /** - * Uniform node that represents the resolution. - * - * @private - * @type {Node} - */ - private _resolution; - /** - * This method is used to update uniforms once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - update(): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts deleted file mode 100644 index efcef8e20..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RGBShiftNode.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -export default RGBShiftNode; -export function rgbShift(node: Node, amount?: number, angle?: number): RGBShiftNode; -/** - * Post processing node for shifting/splitting RGB color channels. The effect - * separates color channels and offsets them from each other. - * - * @augments TempNode - * @three_import import { rgbShift } from 'three/addons/tsl/display/RGBShiftNode.js'; - */ -declare class RGBShiftNode extends TempNode { - /** - * Constructs a new RGB shift node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {number} [amount=0.005] - The amount of the RGB shift. - * @param {number} [angle=0] - Defines the orientation in which colors are shifted. - */ - constructor(textureNode: TextureNode, amount?: number, angle?: number); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * The amount of the RGB shift. - * - * @type {UniformNode} - */ - amount: UniformNode; - /** - * Defines in which direction colors are shifted. - * - * @type {UniformNode} - */ - angle: UniformNode; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts deleted file mode 100644 index 26e36a922..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/RetroPassNode.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export default RetroPassNode; -export function retroPass(scene: Scene, camera: Camera, options?: { - affineDistortion?: Node | undefined; -}): RetroPassNode; -/** - * A post-processing pass that applies a retro PS1-style effect to the scene. - * - * This node renders the scene with classic PlayStation 1 visual characteristics: - * - **Vertex snapping**: Vertices are snapped to screen pixels, creating the iconic "wobbly" geometry - * - **Affine texture mapping**: Textures are sampled without perspective correction, resulting in distortion effects - * - **Low resolution**: Default 0.25 scale (typical 320x240 equivalent) - * - **Nearest-neighbor filtering**: Sharp pixelated textures without smoothing - * - * @augments PassNode - */ -declare class RetroPassNode extends PassNode { - /** - * Creates a new RetroPassNode instance. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera to render from. - * @param {Object} [options={}] - Additional options for the retro pass. - * @param {Node} [options.affineDistortion=null] - An optional node to apply affine distortion to UVs. - */ - constructor(scene: Scene, camera: Camera, options?: { - affineDistortion?: Node | undefined; - }); - affineDistortionNode: Node | null; - filterTextures: any; - _materialCache: Map; - /** - * Updates the retro pass before rendering. - * - * @override - * @param {Frame} frame - The current frame information. - * @returns {void} - */ - override updateBefore(frame: Frame): void; -} -import { PassNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts deleted file mode 100644 index 412d29a3a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SMAANode.d.ts +++ /dev/null @@ -1,166 +0,0 @@ -export default SMAANode; -export function smaa(node: Node): SMAANode; -/** - * Post processing node for applying SMAA. Unlike FXAA, this node - * should be applied before converting colors to sRGB. SMAA should produce - * better results than FXAA but is also more expensive to execute. - * - * Used Preset: SMAA 1x Medium (with color edge detection) - * Reference: {@link https://github.com/iryoku/smaa/releases/tag/v2.8}. - * - * @augments TempNode - * @three_import import { smaa } from 'three/addons/tsl/display/SMAANode.js'; - */ -declare class SMAANode extends TempNode { - /** - * Constructs a new SMAA node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - */ - constructor(textureNode: TextureNode); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * The render target used for the edges pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetEdges; - /** - * The render target used for the weights pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetWeights; - /** - * The render target used for the blend pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetBlend; - /** - * Represents the "area" texture used by the SMAA implementation. - * - * @private - * @type {RenderTarget} - */ - private _areaTexture; - /** - * Represents the "search" texture used by the SMAA implementation. - * - * @private - * @type {RenderTarget} - */ - private _searchTexture; - /** - * A uniform node holding the inverse resolution value. - * - * @private - * @type {UniformNode} - */ - private _invSize; - /** - * A uniform texture node holding the area texture. - * - * @private - * @type {TextureNode} - */ - private _areaTextureUniform; - /** - * A uniform texture node holding the search texture. - * - * @private - * @type {TextureNode} - */ - private _searchTextureUniform; - /** - * A uniform texture node representing the edges pass. - * - * @private - * @type {TextureNode} - */ - private _edgesTextureUniform; - /** - * A uniform texture node representing the weights pass. - * - * @private - * @type {TextureNode} - */ - private _weightsTextureUniform; - /** - * The node material that holds the TSL for rendering the edges pass. - * - * @private - * @type {NodeMaterial} - */ - private _materialEdges; - /** - * The node material that holds the TSL for rendering the weights pass. - * - * @private - * @type {NodeMaterial} - */ - private _materialWeights; - /** - * The node material that holds the TSL for rendering the blend pass. - * - * @private - * @type {NodeMaterial} - */ - private _materialBlend; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; - /** - * Returns the area texture as a Base64 string. - * - * @private - * @return {string} The area texture. - */ - private _getAreaTexture; - /** - * Returns the search texture as a Base64 string.. - * - * @private - * @return {string} The search texture. - */ - private _getSearchTexture; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts deleted file mode 100644 index 82cbc0ef6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAAPassNode.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -export default SSAAPassNode; -export function ssaaPass(scene: Scene, camera: Camera): SSAAPassNode; -/** - * A special render pass node that renders the scene with SSAA (Supersampling Anti-Aliasing). - * This manual SSAA approach re-renders the scene ones for each sample with camera jitter and accumulates the results. - * - * This node produces a high-quality anti-aliased output but is also extremely expensive because of - * its brute-force approach of re-rendering the entire scene multiple times. - * - * Reference: {@link https://en.wikipedia.org/wiki/Supersampling} - * - * @augments PassNode - * @three_import import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; - */ -declare class SSAAPassNode extends PassNode { - /** - * Constructs a new SSAA pass node. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera to render the scene with. - */ - constructor(scene: Scene, camera: Camera); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSSAAPassNode: boolean; - /** - * The sample level specified as n, where the number of samples is 2^n, - * so sampleLevel = 4, is 2^4 samples, 16. - * - * @type {number} - * @default 4 - */ - sampleLevel: number; - /** - * Whether rounding errors should be mitigated or not. - * - * @type {boolean} - * @default true - */ - unbiased: boolean; - /** - * A uniform node representing the sample weight. - * - * @type {UniformNode} - * @default 1 - */ - sampleWeight: UniformNode; - /** - * Reference to the internal render target that holds the current sample. - * - * @private - * @type {?RenderTarget} - * @default null - */ - private _sampleRenderTarget; - /** - * Reference to the internal quad mesh. - * - * @private - * @type {QuadMesh} - */ - private _quadMesh; - /** - * This method is used to render the SSAA effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - _pixelRatio: any; - /** - * This method is used to setup the effect's MRT configuration and quad mesh. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { PassNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts deleted file mode 100644 index 83bcbea9c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSAONode.d.ts +++ /dev/null @@ -1,213 +0,0 @@ -export default SSAONode; -export function ssao(depthNode: Node, normalNode: Node, camera: Camera): SSAONode; -/** - * Post processing node for a fast, screen-space ambient occlusion (SSAO). - * - * It point-samples a per-pixel rotated Vogel disk and estimates obscurance with a single depth tap - * per sample, trading the ground-truth accuracy of {@link GTAONode}'s horizon ray-marching for - * lower cost. A built-in separable, depth-aware blur denoises the result so it can be used without - * temporal accumulation. - * ```js - * const scenePass = pass( scene, camera ); - * scenePass.setMRT( mrt( { output, normal: normalView } ) ); - * const scenePassColor = scenePass.getTextureNode( 'output' ); - * const scenePassDepth = scenePass.getTextureNode( 'depth' ); - * const scenePassNormal = scenePass.getTextureNode( 'normal' ); - * - * const aoPass = ssao( scenePassDepth, scenePassNormal, camera ); - * - * renderPipeline.outputNode = scenePassColor.mul( aoPass.r ); - * ``` - * - * @augments TempNode - * @three_import import { ssao } from 'three/addons/tsl/display/SSAONode.js'; - */ -declare class SSAONode extends TempNode { - /** - * Constructs a new SSAO node. - * - * @param {Node} depthNode - A node that represents the scene's depth. - * @param {Node} normalNode - A node that represents the scene's normals. - * @param {Camera} camera - The camera the scene is rendered with. - */ - constructor(depthNode: Node, normalNode: Node, camera: Camera); - /** - * A node that represents the scene's depth. - * - * @type {Node} - */ - depthNode: Node; - /** - * A node that represents the scene's normals. - * - * @type {Node} - */ - normalNode: Node; - /** - * The resolution scale. The effect renders at a fraction of the drawing buffer - * for extra speed; `0.5` is a good default for a low-frequency signal like AO. - * - * @type {number} - * @default 0.5 - */ - resolutionScale: number; - /** - * The world-space radius the occlusion is gathered within. - * - * @type {UniformNode} - */ - radius: UniformNode; - /** - * The strength of the occlusion. - * - * @type {UniformNode} - */ - intensity: UniformNode; - /** - * An angle bias that suppresses self-occlusion on near-flat surfaces. - * - * @type {UniformNode} - */ - bias: UniformNode; - /** - * How many samples are used to estimate the occlusion. A higher value - * results in a smoother result at a higher runtime cost. - * - * @type {UniformNode} - */ - samples: UniformNode; - /** - * Whether the depth-aware blur that denoises the raw AO is applied or not. - * - * @type {boolean} - * @default true - */ - blurEnabled: boolean; - /** - * How strongly the blur rejects samples across depth discontinuities, - * relative to the AO radius. A higher value keeps edges crisper. - * - * @type {UniformNode} - */ - blurSharpness: UniformNode; - /** - * The resolution of the effect. Set from the drawing buffer size and `resolutionScale`. - * - * @type {Vector2} - */ - resolution: Vector2; - /** - * The render target the raw ambient occlusion is rendered into. Also holds the - * final result after the separable blur has ping-ponged back into it. - * - * @private - * @type {RenderTarget} - */ - private _aoRenderTarget; - /** - * The render target the intermediate (horizontally blurred) result is rendered into. - * - * @private - * @type {RenderTarget} - */ - private _blurRenderTarget; - /** - * Represents the projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrix; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * Represents the near value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraNear; - /** - * Represents the far value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraFar; - /** - * The camera the scene is rendered with. - * - * @private - * @type {Camera} - */ - private _camera; - /** - * The input texture the blur material reads from. Swapped between the two render - * targets to run the horizontal and vertical passes with a single material. - * - * @private - * @type {TextureNode} - */ - private _blurInput; - /** - * The blur direction (one texel along x or y). - * - * @private - * @type {UniformNode} - */ - private _blurDirection; - /** - * The material that computes the raw ambient occlusion. - * - * @private - * @type {NodeMaterial} - */ - private _aoMaterial; - /** - * The material that applies the separable, depth-aware blur. - * - * @private - * @type {NodeMaterial} - */ - private _blurMaterial; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; -import { Vector2 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts deleted file mode 100644 index e1a9735aa..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSGINode.d.ts +++ /dev/null @@ -1,277 +0,0 @@ -export default SSGINode; -export function ssgi(beautyNode: TextureNode, depthNode: TextureNode, normalNode: TextureNode, camera: Camera): SSGINode; -/** - * Post processing node for applying Screen Space Global Illumination (SSGI) to a scene. - * - * References: - * - {@link https://github.com/cdrinmatane/SSRT3}. - * - {@link https://cdrinmatane.github.io/posts/ssaovb-code/}. - * - {@link https://cdrinmatane.github.io/cgspotlight-slides/ssilvb_slides.pdf}. - * - * The quality and performance of the effect mainly depend on `sliceCount` and `stepCount`. - * The total number of samples taken per pixel is `sliceCount` * `stepCount` * `2`. Here are some - * recommended presets depending on whether temporal filtering is used or not. - * - * With temporal filtering (recommended): - * - * - Low: `sliceCount` of `1`, `stepCount` of `12`. - * - Medium: `sliceCount` of `2`, `stepCount` of `8`. - * - High: `sliceCount` of `3`, `stepCount` of `16`. - * - * Use for a higher slice count if you notice temporal instabilities like flickering. Reduce the sample - * count then to mitigate the performance lost. - * - * Without temporal filtering: - * - * - Low: `sliceCount` of `2`, `stepCount` of `6`. - * - Medium: `sliceCount` of `3`, `stepCount` of `8`. - * - High: `sliceCount` of `4`, `stepCount` of `12`. - * - * @augments TempNode - * @three_import import { ssgi } from 'three/addons/tsl/display/SSGINode.js'; - */ -declare class SSGINode extends TempNode { - /** - * Constructs a new SSGI node. - * - * @param {TextureNode} beautyNode - A texture node that represents the beauty or scene pass. - * @param {TextureNode} depthNode - A texture node that represents the scene's depth. - * @param {TextureNode} normalNode - A texture node that represents the scene's normals. - * @param {PerspectiveCamera} camera - The camera the scene is rendered with. - */ - constructor(beautyNode: TextureNode, depthNode: TextureNode, normalNode: TextureNode, camera: PerspectiveCamera); - /** - * A texture node that represents the beauty or scene pass. - * - * @type {TextureNode} - */ - beautyNode: TextureNode; - /** - * A node that represents the scene's depth. - * - * @type {TextureNode} - */ - depthNode: TextureNode; - /** - * A node that represents the scene's normals. If no normals are passed to the - * constructor (because MRT is not available), normals can be automatically - * reconstructed from depth values in the shader. - * - * @type {TextureNode} - */ - normalNode: TextureNode; - /** - * Number of per-pixel hemisphere slices. This has a big performance cost and should be kept as low as possible. - * Should be in the range `[1, 4]`. - * - * @type {UniformNode} - * @default 1 - */ - sliceCount: UniformNode; - /** - * Number of samples taken along one side of a given hemisphere slice. This has a big performance cost and should - * be kept as low as possible. Should be in the range `[1, 32]`. - * - * @type {UniformNode} - * @default 12 - */ - stepCount: UniformNode; - /** - * Power function applied to AO to make it appear darker/lighter. Should be in the range `[0, 4]`. - * - * @type {UniformNode} - * @default 1 - */ - aoIntensity: UniformNode; - /** - * Intensity of the indirect diffuse light. Should be in the range `[0, 100]`. - * - * @type {UniformNode} - * @default 10 - */ - giIntensity: UniformNode; - /** - * Effective sampling radius in world space. AO and GI can only have influence within that radius. - * Should be in the range `[1, 25]`. - * - * @type {UniformNode} - * @default 12 - */ - radius: UniformNode; - /** - * Makes the sample distance in screen space instead of world-space (helps having more detail up close). - * - * @type {UniformNode} - * @default true - */ - useScreenSpaceSampling: UniformNode; - /** - * Controls samples distribution. It's an exponent applied at each step get increasing step size over the distance. - * Should be in the range `[1, 3]`. - * - * @type {UniformNode} - * @default 2 - */ - expFactor: UniformNode; - /** - * Constant thickness value of objects on the screen in world units. Allows light to pass behind surfaces past that thickness value. - * Should be in the range `[0.01, 10]`. - * - * @type {UniformNode} - * @default 1 - */ - thickness: UniformNode; - /** - * Whether to increase thickness linearly over distance or not (avoid losing detail over the distance). - * - * @type {UniformNode} - * @default false - */ - useLinearThickness: UniformNode; - /** - * How much light backface surfaces emit. - * Should be in the range `[0, 1]`. - * - * @type {UniformNode} - * @default 0 - */ - backfaceLighting: UniformNode; - /** - * Whether to use temporal filtering or not. Setting this property to - * `true` requires the usage of `TRAANode`. This will help to reduce noise - * although it introduces typical TAA artifacts like ghosting and temporal - * instabilities. - * - * If setting this property to `false`, a manual denoise via `DenoiseNode` - * is required. - * - * @type {boolean} - * @default true - */ - useTemporalFiltering: boolean; - /** - * The resolution of the effect. - * - * @private - * @type {UniformNode} - */ - private _resolution; - /** - * Used to compute the effective step radius when viewSpaceSampling is `false`. - * - * @private - * @type {UniformNode} - */ - private _halfProjScale; - /** - * Temporal direction that influences the rotation angle for each slice. - * - * @private - * @type {UniformNode} - */ - private _temporalDirection; - /** - * Temporal offset added to the initial ray step. - * - * @private - * @type {UniformNode} - */ - private _temporalOffset; - /** - * Represents the projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrix; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * Represents the near value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraNear; - /** - * Represents the far value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraFar; - /** - * A reference to the scene's camera. - * - * @private - * @type {PerspectiveCamera} - */ - private _camera; - /** - * The render target the effect is rendered into. The first texture holds the GI, - * the second one the AO. - * - * @private - * @type {RenderTarget} - */ - private _ssgiRenderTarget; - /** - * The material that is used to render the effect. - * - * @private - * @type {NodeMaterial} - */ - private _material; - /** - * The AO result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _aoNode; - /** - * The GI result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _giNode; - /** - * Returns the AO result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the AO result of the effect. - */ - getAONode(): PassTextureNode; - /** - * Returns the GI result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the GI result of the effect. - */ - getGINode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts deleted file mode 100644 index f607c677e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSRNode.d.ts +++ /dev/null @@ -1,507 +0,0 @@ -export default SSRNode; -export function ssr(colorNode: Node, depthNode: Node, normalNode: Node, options?: SSRNodeOptions): SSRNode; -export type SSRNodeOptions = { - /** - * - When `false`, traces a single mirror reflection and softens roughness with a blur pass (first-generation SSR). When `true`, varies the reflection direction per pixel with stochastic GGX rays (second-generation SSR); higher quality on rough/glossy surfaces but noisier, so it expects a temporal/spatial denoiser downstream. - */ - stochastic?: boolean | undefined; - /** - * - Per-pixel metalness. Drives GGX reflection sampling and, with `reflectNonMetals=false`, the non-metal early-out. - */ - metalnessNode?: Node; - /** - * - Per-pixel roughness. Drives GGX sampling and the blur mip selection. - */ - roughnessNode?: Node; - /** - * - Only used when `stochastic=false`. When `false`, non-metallic surfaces are discarded for a noticeable performance gain; set `true` to also reflect dielectrics (e.g. marble, polished wood, plastic). - */ - reflectNonMetals?: boolean | undefined; - /** - * - Equirectangular HDR environment map with CPU-side `image.data` (e.g. from RGBELoader). Not compatible with PMREM / `scene.environment` cubemaps. - */ - environmentNode?: Texture; - /** - * - When `true`, precomputes env-luminance CDF tables and uses MIS for environment misses. Build-time only. - */ - envImportanceSampling?: boolean | undefined; - /** - * - Scene diffuse / base color. Defaults to `vec3(1)` in the shader when omitted. - */ - diffuseNode?: Node | undefined; - /** - * - Sub-step binary-search refinement of detected hits. Compile-time constant (baked into the shader at construction). - */ - binaryRefine?: boolean | undefined; - /** - * - Camera the scene is rendered with. Inferred from the color pass when omitted. - */ - camera?: Camera; -}; -/** - * @typedef {Object} SSRNodeOptions - * @property {boolean} [stochastic=false] - When `false`, traces a single mirror reflection and softens roughness with a blur pass (first-generation SSR). When `true`, varies the reflection direction per pixel with stochastic GGX rays (second-generation SSR); higher quality on rough/glossy surfaces but noisier, so it expects a temporal/spatial denoiser downstream. - * @property {Node} [metalnessNode=null] - Per-pixel metalness. Drives GGX reflection sampling and, with `reflectNonMetals=false`, the non-metal early-out. - * @property {Node} [roughnessNode=null] - Per-pixel roughness. Drives GGX sampling and the blur mip selection. - * @property {boolean} [reflectNonMetals=false] - Only used when `stochastic=false`. When `false`, non-metallic surfaces are discarded for a noticeable performance gain; set `true` to also reflect dielectrics (e.g. marble, polished wood, plastic). - * @property {Texture} [environmentNode=null] - Equirectangular HDR environment map with CPU-side `image.data` (e.g. from RGBELoader). Not compatible with PMREM / `scene.environment` cubemaps. - * @property {boolean} [envImportanceSampling=false] - When `true`, precomputes env-luminance CDF tables and uses MIS for environment misses. Build-time only. - * @property {Node} [diffuseNode=null] - Scene diffuse / base color. Defaults to `vec3(1)` in the shader when omitted. - * @property {boolean} [binaryRefine=false] - Sub-step binary-search refinement of detected hits. Compile-time constant (baked into the shader at construction). - * @property {Camera} [camera=null] - Camera the scene is rendered with. Inferred from the color pass when omitted. - */ -/** - * Post processing node for computing screen space reflections (SSR). - * - * Reference: {@link https://lettier.github.io/3d-game-shaders-for-beginners/screen-space-reflection.html} - * - * @augments TempNode - * @three_import import { ssr } from 'three/addons/tsl/display/SSRNode.js'; - */ -declare class SSRNode extends TempNode { - /** - * Constructs a new SSR node. - * - * @param {Node} colorNode - The node that represents the beauty pass. - * @param {Node} depthNode - A node that represents the beauty pass's depth. - * @param {Node} normalNode - A node that represents the beauty pass's normals. - * @param {SSRNodeOptions} [options] - Optional inputs for material and environment data. - */ - constructor(colorNode: Node, depthNode: Node, normalNode: Node, options?: SSRNodeOptions); - /** - * When `true`, the reflection direction is varied per pixel with stochastic GGX rays - * (second-generation SSR). When `false`, a single mirror reflection is traced and - * roughness is softened with a blur pass (first-generation SSR). - * - * @type {boolean} - */ - stochastic: boolean; - /** - * When `true`, env-luminance CDF tables are built and MIS is used for environment misses. - * Fixed at construction time. - * - * @type {boolean} - */ - envImportanceSampling: boolean; - /** - * The node that represents the beauty pass. - * - * @type {Node} - */ - colorNode: Node; - /** - * A node that represents the scene's diffuse color (typically the MRT `diffuseColor` attachment). - * When `null`, the shader uses `vec3(1)`. - * - * @type {?Node} - */ - diffuseNode: Node | null; - /** - * A node that represents the beauty pass's depth. - * - * @type {Node} - */ - depthNode: Node; - /** - * A node that represents the beauty pass's normals. - * - * @type {Node} - */ - normalNode: Node; - /** - * Per-pixel metalness, used to drive the GGX reflection sampling and the non-metal - * early-out. When `null`, the shader treats surfaces as non-metallic. - * - * @type {?Node} - */ - metalnessNode: Node | null; - /** - * Per-pixel roughness, used to drive the GGX reflection sampling and the blur mip - * selection. When `null`, the shader treats surfaces as fully smooth. - * - * @type {?Node} - */ - roughnessNode: Node | null; - /** - * Only used when {@link SSRNode#stochastic} is `false`. When `false`, non-metallic - * surfaces are discarded for a noticeable performance gain; set `true` to also - * reflect dielectrics. Baked into the shader as a compile-time constant; assigning a - * new value recompiles the SSR material. - * - * @type {boolean} - * @default false - */ - _reflectNonMetals: boolean; - /** - * The resolution scale. Valid values are in the range - * `[0,1]`. `1` means best quality but also results in - * more computational overhead. Setting to `0.5` means - * the effect is computed in half-resolution. - * - * @type {number} - * @default 1 - */ - resolutionScale: number; - /** - * Controls how far a fragment can reflect. Increasing this value result in more - * computational overhead but also increases the reflection distance. - * - * @type {UniformNode} - */ - maxDistance: UniformNode; - /** - * Controls the cutoff between what counts as a possible reflection hit and what does not. - * - * @type {UniformNode} - */ - thickness: UniformNode; - /** - * A multiplier for the overall reflection intensity. `1` leaves the - * reflections unchanged, lower values dim them and higher values boost them. - * - * @type {UniformNode} - * @default 1 - */ - intensity: UniformNode; - /** - * Screen-edge fade width, in UV units. As a screen-space hit approaches a screen - * border, the reflection is faded over this distance — either toward the environment - * reflection ({@link SSRNode#screenEdgeFadeBlack} `false`) or to zero intensity - * (`true`). `0` disables it. - * - * @type {UniformNode} - * @default 0.2 - */ - screenEdgeFade: UniformNode; - /** - * When `true`, SSR fades to zero near screen borders instead of blending toward - * the environment map. Hits are faded by the reflection sample UV; misses are - * faded by the surface pixel UV. - * - * Baked into the shader as a compile-time constant so the unused fade branch is - * eliminated; assigning a new value recompiles the SSR material. - * - * @type {boolean} - * @default false - */ - _screenEdgeFadeBlack: boolean; - /** - * Absolute env luminance cap. HDR env samples above this are scaled down (hue preserved). - * - * @type {UniformNode} - * @default 10 - */ - maxLuminance: UniformNode; - /** - * This parameter controls how detailed the raymarching process works. - * The value ranges is `[0,1]` where `1` means best quality (the maximum number - * of raymarching iterations/samples) and `0` means no samples at all. - * - * A quality of `0.5` is usually sufficient for most use cases. Try to keep - * this parameter as low as possible. Larger values result in noticeable more - * overhead. - * - * @type {UniformNode} - */ - quality: UniformNode; - /** - * Mirror bias for the stochastic GGX sampling. Concentrates the reflected rays toward - * the lobe's narrow (near-mirror) core, trading a small amount of bias for less noise. - * `0` samples the full VNDF lobe; values toward `1` tighten the cone. Range `[0,1]`. - * - * @type {UniformNode} - * @default 0.5 - */ - mirrorBias: UniformNode; - /** - * The quality of the blur. Must be an integer in the range `[1,3]`. - * - * Baked into the blur shader as a compile-time constant so the `(size*2+1)²` - * sample loop unrolls; assigning a new value recompiles the blur material. - * - * @type {number} - * @default 2 - */ - _blurQuality: number; - /** - * Enables sub-step binary-search refinement of a detected hit. When on, a coarse - * crossing is bisected toward the exact intersection (sharper hits, less step - * aliasing) at the cost of extra depth samples. Baked into the shader as a - * compile-time constant; assigning a new value rebuilds the SSR material. - * - * @type {boolean} - * @default false - */ - _binaryRefine: boolean; - /** - * Non-linear step distribution exponent. `1` = uniform steps; `> 1` concentrates - * samples near the ray origin — where most short-range reflections are missed — and - * spaces them out toward maxDistance, as `s = (i / steps) ^ stepExponent`. - * - * Baked into the shader as a compile-time constant so `pow()` folds to a few - * multiplies; assigning a new value recompiles the SSR material. Only used by the - * stochastic reflection path. - * - * @type {number} - * @default 2 - */ - _stepExponent: number; - /** - * HDR environment map for screen-space misses. - * - * @type {?Texture} - */ - environmentNode: Texture | null; - /** - * A node that represents the history texture for multi-bounce reflections. - * - * @type {?Texture} - */ - historyTexture: Texture | null; - /** - * A node that represents the velocity texture for reprojection. - * - * @type {?Node} - */ - velocityTexture: Node | null; - /** - * The camera the scene is rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * The spread of the blur. Automatically set when generating mips. - * - * @private - * @type {UniformNode} - */ - private _blurSpread; - /** - * Represents the projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrix; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * Represents the near value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraNear; - /** - * Represents the far value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraFar; - _cameraWorldMatrix: import("three/webgpu").UniformNode; - _cameraWorldPosition: import("three/webgpu").UniformNode; - _cameraViewMatrix: import("three/webgpu").UniformNode; - _cameraViewMatrixInverse: import("three/webgpu").UniformNode; - /** - * The resolution of the pass. - * - * @private - * @type {UniformNode} - */ - private _resolution; - _noiseIndex: import("three/webgpu").UniformNode; - /** - * CDF-backed environment sampler. Created when {@link setEnvMap} is called. - * - * @private - * @type {?ImportanceSampledEnvironment} - */ - private _importanceEnvironment; - /** - * Intensity multiplier applied to environment-map reflections on screen-space - * misses and at screen edges. Defaults to π to match the former hardcoded multiplier. - * - * @type {UniformNode} - * @default Math.PI - */ - environmentIntensity: UniformNode; - /** - * The render target the SSR is rendered into. - * - * @private - * @type {RenderTarget} - */ - private _ssrRenderTarget; - /** - * The render target for the blurred SSR reflections. - * - * @private - * @type {RenderTarget} - */ - private _blurRenderTarget; - /** - * The material that is used to render the effect. - * - * @private - * @type {NodeMaterial} - */ - private _ssrMaterial; - /** - * The SSR fragment `Fn` and its shared context, captured in {@link SSRNode#setup}. - * Re-invoking the `Fn` produces a fresh node graph, which is how the baked - * compile-time constants are re-applied when they change (see {@link SSRNode#_buildSSRMaterial}). - * - * @private - */ - private _ssrFn; - _sharedContext: any; - /** - * The blur material. - * - * @private - * @type {NodeMaterial} - */ - private _blurMaterial; - /** - * The copy material. - * - * @private - * @type {NodeMaterial} - */ - private _copyMaterial; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Holds the blurred SSR reflections. - * - * @private - * @type {?PassTextureNode} - */ - private _blurredTextureNode; - set stepExponent(value: number); - /** - * Non-linear step distribution exponent (compile-time constant). See the backing - * field for details. Assigning a new value recompiles the SSR material. - * - * @type {number} - */ - get stepExponent(): number; - set blurQuality(value: number); - /** - * Blur kernel size (compile-time constant). Assigning a new value recompiles the - * blur material. - * - * @type {number} - */ - get blurQuality(): number; - /** - * Builds (or rebuilds) the blur material's node graph, baking the current - * {@link SSRNode#blurQuality} as the kernel size so the sample loop unrolls. - * - * @private - */ - private _buildBlurMaterial; - set screenEdgeFadeBlack(value: boolean); - /** - * Whether SSR fades to black near screen borders (compile-time constant). Assigning - * a new value recompiles the SSR material. - * - * @type {boolean} - */ - get screenEdgeFadeBlack(): boolean; - set binaryRefine(value: boolean); - /** - * Whether sub-step binary-search hit refinement is enabled (compile-time constant). - * Assigning a new value rebuilds the SSR material. - * - * @type {boolean} - */ - get binaryRefine(): boolean; - set reflectNonMetals(value: boolean); - /** - * Whether dielectrics are reflected in the non-stochastic path (compile-time constant). - * Assigning a new value rebuilds the SSR material. - * - * @type {boolean} - */ - get reflectNonMetals(): boolean; - /** - * Rebuilds the SSR material's node graph by re-invoking the fragment `Fn`, which - * re-bakes the compile-time constants ({@link SSRNode#binaryRefine}, - * {@link SSRNode#stepExponent}, {@link SSRNode#screenEdgeFadeBlack}) at their current - * values. A no-op until {@link SSRNode#setup} has captured the `Fn`. - * - * @private - */ - private _buildSSRMaterial; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * Wires the feedback inputs for multi-bounce reflections: the previous frame's - * denoised result (`history`) and the velocity buffer used to reproject it - * (`velocity`). `history` accepts the producing node (e.g. a - * {@link RecurrentDenoiseNode}) — its output render target is used — or a raw - * texture. Pass `null` for both to disable multi-bounce. - * - * @param {Texture} history - * @param {Node} velocity - */ - setHistory(history: Texture, velocity: Node): void; - /** - * Sets the environment map for importance-sampled env lighting when - * screen-space rays miss. Call this whenever the scene's env map changes. - * - * Uses {@link ImportanceSampledEnvironment} (CDF + MIS adapted from - * [three-gpu-pathtracer](https://github.com/gkjohnson/three-gpu-pathtracer)). - * - * @param {Texture|null} hdr - The equirectangular HDR environment map, or null to disable. - * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} - */ - setEnvMap(hdr: Texture | null): void; - /** - * Intensity multiplier for the importance-sampled env contribution. - * Only available after {@link setEnvMap} has been called. - * - * @type {?UniformNode} - */ - get envMapIntensity(): UniformNode | null; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; - getRenderTarget(): RenderTarget; -} -import { TempNode } from 'three/webgpu'; -import { RenderTarget } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts deleted file mode 100644 index 6137e2373..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SSSNode.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -export default SSSNode; -export function sss(depthNode: TextureNode, camera: Camera, mainLight: DirectionalLight): SSSNode; -/** - * Post processing node for applying Screen-Space Shadows (SSS) to a scene. - * - * Screen-Space Shadows (also known as Contact Shadows) should ideally be used to complement - * traditional shadow maps. They are best suited for rendering detailed shadows of smaller - * objects at a closer scale like intricate shadowing on highly detailed models. In other words: - * Use Shadow Maps for the foundation and Screen-Space Shadows for the details. - * - * The shadows produced by this implementation might have too hard edges for certain use cases. - * Use a box, gaussian or hash blur to soften the edges before doing the composite with the - * beauty pass. Code example: - * - * ```js - * const sssPass = sss( scenePassDepth, camera, mainLight ); - * - * const sssBlur = boxBlur( sssPass.r, { size: 2, separation: 1 } ); // optional blur - * ``` - * - * Limitations: - * - * - Ideally the maximum shadow length should not exceed `1` meter. Otherwise the effect gets - * computationally very expensive since more samples during the ray marching process are evaluated. - * You can mitigate this issue by reducing the `quality` parameter. - * - The effect can only be used with a single directional light, the main light of your scene. - * This main light usually represents the sun or daylight. - * - Like other Screen-Space techniques SSS can only honor objects in the shadowing computation that - * are currently visible within the camera's view. - * - * References: - * - {@link https://panoskarabelas.com/posts/screen_space_shadows/}. - * - {@link https://www.bendstudio.com/blog/inside-bend-screen-space-shadows/}. - * - * @augments TempNode - * @three_import import { sss } from 'three/addons/tsl/display/SSSNode.js'; - */ -declare class SSSNode extends TempNode { - /** - * Constructs a new SSS node. - * - * @param {TextureNode} depthNode - A texture node that represents the scene's depth. - * @param {Camera} camera - The camera the scene is rendered with. - * @param {DirectionalLight} mainLight - The main directional light of the scene. - */ - constructor(depthNode: TextureNode, camera: Camera, mainLight: DirectionalLight); - /** - * A node that represents the beauty pass's depth. - * - * @type {TextureNode} - */ - depthNode: TextureNode; - /** - * Maximum shadow length in world units. Longer shadows result in more computational - * overhead. - * - * @type {UniformNode} - * @default 0.1 - */ - maxDistance: UniformNode; - /** - * Depth testing thickness. - * - * @type {UniformNode} - * @default 0.01 - */ - thickness: UniformNode; - /** - * Shadow intensity. Must be in the range `[0, 1]`. - * - * @type {UniformNode} - * @default 1.0 - */ - shadowIntensity: UniformNode; - /** - * This parameter controls how detailed the raymarching process works. - * The value ranges is `[0,1]` where `1` means best quality (the maximum number - * of raymarching iterations/samples) and `0` means no samples at all. - * - * A quality of `0.5` is usually sufficient for most use cases. Try to keep - * this parameter as low as possible. Larger values result in noticeable more - * overhead. - * - * @type {UniformNode} - * @default 0.5 - */ - quality: UniformNode; - /** - * The resolution scale. Valid values are in the range - * `[0,1]`. `1` means best quality but also results in - * more computational overhead. Setting to `0.5` means - * the effect is computed in half-resolution. - * - * @type {number} - * @default 1 - */ - resolutionScale: number; - /** - * Whether to use temporal filtering or not. Setting this property to - * `true` requires the usage of `TRAANode`. This will help to reduce noise - * although it introduces typical TAA artifacts like ghosting and temporal - * instabilities. - * - * @type {boolean} - * @default false - */ - useTemporalFiltering: boolean; - /** - * Represents the view matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraViewMatrix; - /** - * Represents the projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrix; - /** - * Represents the inverse projection matrix of the scene's camera. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * Represents the near value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraNear; - /** - * Represents the far value of the scene's camera. - * - * @private - * @type {ReferenceNode} - */ - private _cameraFar; - /** - * The resolution of the pass. - * - * @private - * @type {UniformNode} - */ - private _resolution; - /** - * Temporal offset added to the initial ray step. - * - * @private - * @type {UniformNode} - */ - private _temporalOffset; - /** - * The frame ID use when temporal filtering is enabled. - * - * @private - * @type {UniformNode} - */ - private _frameId; - /** - * A reference to the scene's main light. - * - * @private - * @type {DirectionalLight} - */ - private _mainLight; - /** - * The camera the scene is rendered with. - * - * @private - * @type {Camera} - */ - private _camera; - /** - * The render target the SSS is rendered into. - * - * @private - * @type {RenderTarget} - */ - private _sssRenderTarget; - /** - * The material that is used to render the effect. - * - * @private - * @type {NodeMaterial} - */ - private _material; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts deleted file mode 100644 index a1ddcf38d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Sepia.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Applies a sepia effect to the given color node. - * - * @tsl - * @function - * @param {Node} color - The color node to apply the sepia for. - * @return {Node} The updated color node. - */ -export const sepia: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts deleted file mode 100644 index 2df2ca224..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/Shape.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Returns a radial gradient from center (white) to edges (black). - * Useful for masking effects based on distance from center. - * - * @tsl - * @function - * @param {Node} [scale=1.0] - Controls the size of the gradient (0 = all black, 1 = full circle). - * @param {Node} [softness=0.5] - Controls the edge softness (0 = hard edge, 1 = soft gradient). - * @param {Node} [coord=uv()] - The input UV coordinates. - * @return {Node} 1.0 at center, 0.0 at edges. - */ -export const circle: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts deleted file mode 100644 index c6886ab8a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SharpenNode.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -export default SharpenNode; -export function sharpen(node: Node, sharpness?: (number | Node), denoise?: (boolean | Node)): SharpenNode; -/** - * Post processing node for contrast-adaptive sharpening (RCAS). - * - * Reference: {@link https://gpuopen.com/fidelityfx-superresolution/}. - * - * @augments TempNode - * @three_import import { sharpen } from 'three/addons/tsl/display/SharpenNode.js'; - */ -declare class SharpenNode extends TempNode { - /** - * Constructs a new sharpen node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - * @param {Node} [sharpness=0.2] - Sharpening strength. 0 = maximum sharpening, 2 = no sharpening. - * @param {Node} [denoise=false] - Whether to attenuate sharpening in noisy areas. - */ - constructor(textureNode: TextureNode, sharpness?: Node, denoise?: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSharpenNode: boolean; - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * Sharpening strength. 0 = maximum, 2 = none. - * - * @type {Node} - * @default 0.2 - */ - sharpness: Node; - /** - * Whether to attenuate sharpening in noisy areas. - * - * @type {Node} - * @default false - */ - denoise: Node; - /** - * The render target for the sharpening pass. - * - * @private - * @type {RenderTarget} - */ - private _renderTarget; - /** - * The result of the effect as a texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * The material for the sharpening pass. - * - * @private - * @type {?NodeMaterial} - */ - private _material; - /** - * Sets the output size of the effect. - * - * @param {number} width - The width in pixels. - * @param {number} height - The height in pixels. - */ - setSize(width: number, height: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts deleted file mode 100644 index 251c245d8..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/SobelOperatorNode.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -export default SobelOperatorNode; -export function sobel(node: Node): SobelOperatorNode; -/** - * Post processing node for detecting edges with a sobel filter. - * A sobel filter should be applied after tone mapping and output color - * space conversion. - * - * @augments TempNode - * @three_import import { sobel } from 'three/addons/tsl/display/SobelOperatorNode.js'; - */ -declare class SobelOperatorNode extends TempNode { - /** - * Constructs a new sobel operator node. - * - * @param {TextureNode} textureNode - The texture node that represents the input of the effect. - */ - constructor(textureNode: TextureNode); - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * A uniform node holding the inverse resolution value. - * - * @private - * @type {UniformNode} - */ - private _invSize; - /** - * This method is used to update the effect's uniforms once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(): void; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts deleted file mode 100644 index 1a310b73f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoCompositePassNode.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -export default StereoCompositePassNode; -/** - * A special (abstract) render pass node that renders the scene - * as a stereoscopic image. Unlike {@link StereoPassNode}, this - * node merges the image for the left and right eye - * into a single one. That is required for effects like - * anaglyph or parallax barrier. - * - * @abstract - * @augments PassNode - * @three_import import { StereoCompositePassNode } from 'three/addons/tsl/display/StereoCompositePassNode.js'; - */ -declare class StereoCompositePassNode extends PassNode { - /** - * Constructs a new stereo composite pass node. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera to render the scene with. - */ - constructor(scene: Scene, camera: Camera); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStereoCompositePassNode: boolean; - /** - * The internal stereo camera that is used to render the scene. - * - * @type {StereoCamera} - */ - stereo: StereoCamera; - /** - * The render target for rendering the left eye's view. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetL; - /** - * The render target for rendering the right eye's view. - * - * @private - * @type {RenderTarget} - */ - private _renderTargetR; - /** - * A texture node representing the left's eye view. - * - * @private - * @type {TextureNode} - */ - private _mapLeft; - /** - * A texture node representing the right's eye view. - * - * @private - * @type {TextureNode} - */ - private _mapRight; - /** - * The node material that implements the composite. All - * derived effect passes must provide an instance for rendering. - * - * @private - * @type {?NodeMaterial} - * @default null - */ - private _material; - /** - * Updates the internal stereo camera. - * - * @param {number} coordinateSystem - The current coordinate system. - */ - updateStereoCamera(coordinateSystem: number): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - _pixelRatio: any; -} -import { PassNode } from 'three/webgpu'; -import { StereoCamera } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts deleted file mode 100644 index e6d848c84..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/StereoPassNode.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export default StereoPassNode; -export function stereoPass(scene: Scene, camera: Camera): StereoPassNode; -/** - * A special render pass node that renders the scene as a stereoscopic image. - * - * @augments PassNode - * @three_import import { stereoPass } from 'three/addons/tsl/display/StereoPassNode.js'; - */ -declare class StereoPassNode extends PassNode { - /** - * Constructs a new stereo pass node. - * - * @param {Scene} scene - The scene to render. - * @param {Camera} camera - The camera to render the scene with. - */ - constructor(scene: Scene, camera: Camera); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStereoPassNode: boolean; - /** - * The internal stereo camera that is used to render the scene. - * - * @type {StereoCamera} - */ - stereo: StereoCamera; - /** - * This method is used to render the stereo effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - _pixelRatio: any; -} -import { PassNode } from 'three/webgpu'; -import { StereoCamera } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts deleted file mode 100644 index b2315c1b2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TAAUNode.d.ts +++ /dev/null @@ -1,275 +0,0 @@ -export default TAAUNode; -export function taau(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera): TAAUNode; -/** - * A special node that performs Temporal Anti-Aliasing Upscaling (TAAU). - * - * Like TRAA, the node accumulates jittered samples over multiple frames and - * reprojects history with motion vectors. Unlike TRAA, the input buffers - * (beauty, depth, velocity) are expected to be rendered at a lower resolution - * than the renderer's drawing buffer — typically by lowering the upstream - * pass's resolution via {@link PassNode#setResolutionScale} — and the resolve - * pass reconstructs an output-resolution image using a 9-tap Blackman-Harris - * filter (Gaussian approximation) over the jittered input samples. The result - * is an alternative to FSR2/3 that does anti-aliasing and upscaling in a - * single pass. - * - * References: - * - Karis, "High Quality Temporal Supersampling", SIGGRAPH 2014, {@link https://advances.realtimerendering.com/s2014/} - * - Riley/Arcila, FidelityFX Super Resolution 2, GDC 2022, {@link https://gpuopen.com/download/GDC_FidelityFX_Super_Resolution_2_0.pdf} - * - * Note: MSAA must be disabled when TAAU is in use. - * - * @augments TempNode - * @three_import import { taau } from 'three/addons/tsl/display/TAAUNode.js'; - */ -declare class TAAUNode extends TempNode { - /** - * Constructs a new TAAU node. - * - * @param {TextureNode} beautyNode - The texture node that represents the input of the effect. - * @param {TextureNode} depthNode - A node that represents the scene's depth. - * @param {TextureNode} velocityNode - A node that represents the scene's velocity. - * @param {Camera} camera - The camera the scene is rendered with. - */ - constructor(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTAAUNode: boolean; - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - beautyNode: TextureNode; - /** - * A node that represents the scene's depth. - * - * @type {TextureNode} - */ - depthNode: TextureNode; - /** - * A node that represents the scene's velocity. - * - * @type {TextureNode} - */ - velocityNode: TextureNode; - /** - * The camera the scene is rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * When the difference between the current and previous depth goes above this threshold, - * the history is considered invalid. - * - * @type {number} - * @default 0.0005 - */ - depthThreshold: number; - /** - * The depth difference within the 3×3 neighborhood to consider a pixel as an edge. - * - * @type {number} - * @default 0.001 - */ - edgeDepthDiff: number; - /** - * The history becomes invalid as the pixel length of the velocity approaches this value. - * - * @type {number} - * @default 128 - */ - maxVelocityLength: number; - /** - * Baseline weight applied to the current frame in the resolve. Lower - * values produce smoother results with longer accumulation but slower - * convergence on disoccluded regions; the motion factor is added on - * top, so fast-moving pixels still respond quickly. - * - * @type {number} - * @default 0.025 - */ - currentFrameWeight: number; - /** - * The jitter index selects the current camera offset value. - * - * @private - * @type {number} - * @default 0 - */ - private _jitterIndex; - /** - * A uniform node holding the current jitter offset in input-pixel - * units. The shader needs this to know where each input sample was - * actually rendered when computing per-tap reconstruction weights. - * - * @private - * @type {UniformNode} - */ - private _jitterOffset; - /** - * The render target that represents the history of frame data. - * Sized to the renderer's drawing buffer (the output resolution). - * - * @private - * @type {?RenderTarget} - */ - private _historyRenderTarget; - /** - * The render target for the resolve. Sized to the renderer's drawing - * buffer (the output resolution). - * - * @private - * @type {?RenderTarget} - */ - private _resolveRenderTarget; - /** - * Render target whose depth attachment holds the previous frame's - * depth buffer. The depth texture must be owned by a render target - * so that `copyTextureToTexture` can copy into it on the WebGL - * backend, which uses a framebuffer blit and therefore needs the - * destination depth texture to be attached to a framebuffer. This - * render target is sized independently of the history target so it - * can match the (lower-resolution) input depth texture. - * - * @private - * @type {RenderTarget} - */ - private _previousDepthRenderTarget; - /** - * Material used for the resolve step. - * - * @private - * @type {NodeMaterial} - */ - private _resolveMaterial; - /** - * Material used to seed the history render target on resize. It - * performs a bilinear upscale of the current beauty buffer into the - * output-sized history target so that the first frames after a - * resize do not fade in from black. - * - * @private - * @type {NodeMaterial} - */ - private _seedMaterial; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Used to save the original/unjittered projection matrix. - * - * @private - * @type {Matrix4} - */ - private _originalProjectionMatrix; - /** - * A uniform node holding the camera's near and far. - * - * @private - * @type {UniformNode} - */ - private _cameraNearFar; - /** - * A uniform node holding the camera world matrix. - * - * @private - * @type {UniformNode} - */ - private _cameraWorldMatrix; - /** - * A uniform node holding the camera world matrix inverse. - * - * @private - * @type {UniformNode} - */ - private _cameraWorldMatrixInverse; - /** - * A uniform node holding the camera projection matrix inverse. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * A uniform node holding the previous frame's view matrix. - * - * @private - * @type {UniformNode} - */ - private _previousCameraWorldMatrix; - /** - * A uniform node holding the previous frame's projection matrix inverse. - * - * @private - * @type {UniformNode} - */ - private _previousCameraProjectionMatrixInverse; - /** - * A texture node for the previous depth buffer. - * - * @private - * @type {TextureNode} - */ - private _previousDepthNode; - /** - * Sync the post processing stack with the TAAU node. - * - * @private - * @type {boolean} - */ - private _needsPostProcessingSync; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the output size of the effect (history and resolve targets). The - * previous-depth texture is sized independently in `updateBefore()` to - * track the scene's current depth texture. - * - * @param {number} outputWidth - The output width (drawing buffer width). - * @param {number} outputHeight - The output height (drawing buffer height). - */ - setSize(outputWidth: number, outputHeight: number): void; - /** - * Defines the TAAU's current jitter as a view offset to the scene's - * camera. The jitter is shrunk to one *output* pixel (rather than one - * input pixel) so that the halton sequence gradually fills the output - * sub-pixel grid over multiple frames. - * - * @param {number} inputWidth - The width of the input buffers the camera renders into. - * @param {number} inputHeight - The height of the input buffers the camera renders into. - */ - setViewOffset(inputWidth: number, inputHeight: number): void; - /** - * Clears the view offset from the scene's camera. - */ - clearViewOffset(): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's render targets and TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts deleted file mode 100644 index 56581bb40..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TRAANode.d.ts +++ /dev/null @@ -1,239 +0,0 @@ -export default TRAANode; -export function traa(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera): TRAANode; -/** - * A special node that applies TRAA (Temporal Reprojection Anti-Aliasing). - * - * References: - * - {@link https://alextardif.com/TAA.html} - * - {@link https://www.elopezr.com/temporal-aa-and-the-quest-for-the-holy-trail/} - * - * Note: MSAA must be disabled when TRAA is in use. - * - * @augments TempNode - * @three_import import { traa } from 'three/addons/tsl/display/TRAANode.js'; - */ -declare class TRAANode extends TempNode { - /** - * Constructs a new TRAA node. - * - * @param {TextureNode} beautyNode - The texture node that represents the input of the effect. - * @param {TextureNode} depthNode - A node that represents the scene's depth. - * @param {TextureNode} velocityNode - A node that represents the scene's velocity. - * @param {Camera} camera - The camera the scene is rendered with. - */ - constructor(beautyNode: TextureNode, depthNode: TextureNode, velocityNode: TextureNode, camera: Camera); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTRAANode: boolean; - /** - * The texture node that represents the input of the effect. - * - * @type {TextureNode} - */ - beautyNode: TextureNode; - /** - * A node that represents the scene's velocity. - * - * @type {TextureNode} - */ - depthNode: TextureNode; - /** - * A node that represents the scene's velocity. - * - * @type {TextureNode} - */ - velocityNode: TextureNode; - /** - * The camera the scene is rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * When the difference between the current and previous depth goes above this threshold, - * the history is considered invalid. - * - * @type {number} - * @default 0.0005 - */ - depthThreshold: number; - /** - * The depth difference within the 3×3 neighborhood to consider a pixel as an edge. - * - * @type {number} - * @default 0.001 - */ - edgeDepthDiff: number; - /** - * The history becomes invalid as the pixel length of the velocity approaches this value. - * - * @type {number} - * @default 128 - */ - maxVelocityLength: number; - /** - * Whether to decrease the weight on the current frame when the velocity is more subpixel. - * This reduces blurriness under motion, but can introduce a square pattern artifact. - * - * @type {boolean} - * @default true - */ - useSubpixelCorrection: boolean; - /** - * The jitter index selects the current camera offset value. - * - * @private - * @type {number} - * @default 0 - */ - private _jitterIndex; - /** - * A uniform node holding the inverse resolution value. - * - * @private - * @type {UniformNode} - */ - private _invSize; - /** - * The render target that represents the history of frame data. - * - * @private - * @type {?RenderTarget} - */ - private _historyRenderTarget; - /** - * The render target for the resolve. - * - * @private - * @type {?RenderTarget} - */ - private _resolveRenderTarget; - /** - * Material used for the resolve step. - * - * @private - * @type {NodeMaterial} - */ - private _resolveMaterial; - /** - * The result of the effect is represented as a separate texture node. - * - * @private - * @type {PassTextureNode} - */ - private _textureNode; - /** - * Used to save the original/unjittered projection matrix. - * - * @private - * @type {Matrix4} - */ - private _originalProjectionMatrix; - /** - * A uniform node holding the camera's near and far. - * - * @private - * @type {UniformNode} - */ - private _cameraNearFar; - /** - * A uniform node holding the camera world matrix. - * - * @private - * @type {UniformNode} - */ - private _cameraWorldMatrix; - /** - * A uniform node holding the camera world matrix inverse. - * - * @private - * @type {UniformNode} - */ - private _cameraWorldMatrixInverse; - /** - * A uniform node holding the camera projection matrix inverse. - * - * @private - * @type {UniformNode} - */ - private _cameraProjectionMatrixInverse; - /** - * A uniform node holding the previous frame's view matrix. - * - * @private - * @type {UniformNode} - */ - private _previousCameraWorldMatrix; - /** - * A uniform node holding the previous frame's projection matrix inverse. - * - * @private - * @type {UniformNode} - */ - private _previousCameraProjectionMatrixInverse; - /** - * A texture node for the previous depth buffer. - * - * @private - * @type {TextureNode} - */ - private _previousDepthNode; - /** - * Sync the post processing stack with the TRAA node. - * - * @private - * @type {boolean} - */ - private _needsPostProcessingSync; - /** - * The node used to render the scene's velocity. - * - * @private - * @type {?VelocityNode} - */ - private _velocityNode; - /** - * Returns the result of the effect as a texture node. - * - * @return {PassTextureNode} A texture node that represents the result of the effect. - */ - getTextureNode(): PassTextureNode; - /** - * Sets the size of the effect. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setSize(width: number, height: number): void; - /** - * Defines the TRAA's current jitter as a view offset - * to the scene's camera. - * - * @param {number} width - The width of the effect. - * @param {number} height - The height of the effect. - */ - setViewOffset(width: number, height: number): void; - /** - * Clears the view offset from the scene's camera. - */ - clearViewOffset(): void; - /** - * This method is used to render the effect once per frame. - * - * @param {NodeFrame} frame - The current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * This method is used to setup the effect's render targets and TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {PassTextureNode} - */ - setup(builder: NodeBuilder): PassTextureNode; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts deleted file mode 100644 index 71665d855..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/TransitionNode.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -export default TransitionNode; -export function transition(nodeA: Node, nodeB: Node, mixTextureNode: Node, mixRatio: Node | number, threshold: Node | number, useTexture: Node | number): TransitionNode; -/** - * Post processing node for creating a transition effect between scenes. - * - * @augments TempNode - * @three_import import { transition } from 'three/addons/tsl/display/TransitionNode.js'; - */ -declare class TransitionNode extends TempNode { - /** - * Constructs a new transition node. - * - * @param {TextureNode} textureNodeA - A texture node that represents the beauty pass of the first scene. - * @param {TextureNode} textureNodeB - A texture node that represents the beauty pass of the second scene. - * @param {TextureNode} mixTextureNode - A texture node that defines how the transition effect should look like. - * @param {Node} mixRatioNode - The interpolation factor that controls the mix. - * @param {Node} thresholdNode - Can be used to tweak the linear interpolation. - * @param {Node} useTextureNode - Whether `mixTextureNode` should influence the transition or not. - */ - constructor(textureNodeA: TextureNode, textureNodeB: TextureNode, mixTextureNode: TextureNode, mixRatioNode: Node, thresholdNode: Node, useTextureNode: Node); - /** - * A texture node that represents the beauty pass of the first scene. - * - * @type {TextureNode} - */ - textureNodeA: TextureNode; - /** - * A texture node that represents the beauty pass of the second scene. - * - * @type {TextureNode} - */ - textureNodeB: TextureNode; - /** - * A texture that defines how the transition effect should look like. - * - * @type {TextureNode} - */ - mixTextureNode: TextureNode; - /** - * The interpolation factor that controls the mix. - * - * @type {Node} - */ - mixRatioNode: Node; - /** - * Can be used to tweak the linear interpolation. - * - * @type {Node} - */ - thresholdNode: Node; - /** - * Whether `mixTextureNode` should influence the transition or not. - * - * @type {Node} - */ - useTextureNode: Node; - /** - * This method is used to setup the effect's TSL code. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ShaderCallNodeInternal} - */ - setup(): ShaderCallNodeInternal; -} -import { TempNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts deleted file mode 100644 index db00aa0d9..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/boxBlur.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Applies a box blur effect to the given texture node. - * - * Compared to Gaussian blur, box blur produces a more blocky result but with better performance when correctly - * configured. It is intended for mobile devices or performance restricted use cases where Gaussian is too heavy. - * - * The (kernel) `size` parameter should be small (1, 2 or 3) since it determines the number of samples based on (size * 2 + 1)^2. - * This implementation uses a single pass approach so the kernel is not applied as a separable filter. That means larger - * kernels won't perform well. Use Gaussian instead if you need a more high-quality blur. - * - * To produce wider blurs, increase the `separation` parameter instead which has no influence on the performance. - * - * Reference: {@link https://github.com/lettier/3d-game-shaders-for-beginners/blob/master/demonstration/shaders/fragment/box-blur.frag}. - * - * @tsl - * @function - * @param {Node} textureNode - The texture node that should be blurred. - * @param {Object} [options={}] - Additional options for the hash blur effect. - * @param {Node} [options.size=int(1)] - Controls the blur's kernel. For performant results, the range should within [1, 3]. - * @param {Node} [options.separation=int(1)] - Spreads out the blur without having to sample additional fragments. Ranges from [1, Infinity]. - * @param {boolean} [options.premultipliedAlpha=false] - Whether to use premultiplied alpha for the blur effect. - * @return {Node} The blurred texture node. - */ -export const boxBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts deleted file mode 100644 index 7027dea2f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlend.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Performs a depth-aware blend between a base scene and a secondary effect (like godrays). - * This function uses a Poisson disk sampling pattern to detect depth discontinuities - * in the neighborhood of the current pixel. If an edge is detected, it shifts the - * sampling coordinate for the blend node away from the edge to prevent light leaking/haloing. - * - * @param {Node} baseNode - The main scene/beauty pass texture node. - * @param {Node} blendNode - The effect to be blended (e.g., Godrays, Bloom). - * @param {Node} depthNode - The scene depth texture node. - * @param {Camera} camera - The camera used for the scene. - * @param {Object} [options={}] - Configuration for the blend effect. - * @param {Node|Color} [options.blendColor=Color(0xff0000)] - The color applied to the blend node. - * @param {Node | number} [options.edgeRadius=2] - The search radius (in pixels) for detecting depth edges. - * @param {Node | number} [options.edgeStrength=2] - How far to "push" the UV away from detected edges. - * @returns {Node} The resulting blended color node. - */ -export const depthAwareBlend: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts deleted file mode 100644 index 16a271336..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/depthAwareBlur.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Applies one pass of a separable, depth-aware (bilateral) blur to a screen-space signal. - * - * The spatial term is a fixed 5-tap gaussian along `directionNode`; the edge-stopping term - * rejects neighbours whose view-space depth differs from the center, so the signal is smoothed - * across surfaces but not across silhouettes. Depth rejection is measured relative to `radius`, - * which keeps it scale invariant. Run it twice (horizontal then vertical) for a full separable - * blur. Handy for denoising a half-resolution effect such as ambient occlusion. - * - * @tsl - * @function - * @param {Node} inputNode - The texture node to blur; its red channel is filtered. - * @param {Node} depthNode - The scene depth texture node. - * @param {Node} directionNode - One texel step along the blur axis, e.g. `vec2( 1 / width, 0 )`. - * @param {Camera} camera - The camera the scene is rendered with. - * @param {Node | number} [sharpness=2] - How strongly a depth difference rejects a neighbour. - * @param {Node | number} [radius=1] - The world-space scale the depth rejection is relative to. - * @returns {Node} The blurred value. - */ -export const depthAwareBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts deleted file mode 100644 index e02a15356..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/hashBlur.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Applies a hash blur effect to the given texture node. - * - * The approach of this blur is different compared to Gaussian and box blur since - * it does not rely on a kernel to apply a convolution. Instead, it reads the base - * texture multiple times in a random pattern and then averages the samples. A - * typical artifact of this technique is a slightly noisy appearance of the blur which - * can be mitigated by increasing the number of iterations (see `repeats` parameter). - * Compared to Gaussian blur, hash blur requires just a single pass. - * - * Reference: {@link https://www.shadertoy.com/view/4lXXWn}. - * - * @tsl - * @function - * @param {Node} textureNode - The texture node that should be blurred. - * @param {Node} [bluramount=float(0.1)] - This node determines the amount of blur. - * @param {Object} [options={}] - Additional options for the hash blur effect. - * @param {Node} [options.repeats=float(45)] - The number of iterations for the blur effect. - * @param {boolean} [options.premultipliedAlpha=false] - Whether to use premultiplied alpha for the blur effect. - * @return {Node} The blurred texture node. - */ -export const hashBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts deleted file mode 100644 index 0450409a0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/display/radialBlur.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * This TSL function blurs an image in a circular pattern, radiating from a configurable center point in screen space. - * - * Radial blurs can be used for different kind of effects like producing simple faked lighting effects also known as - * "light shafts". The major limitation of this specific usage is the center point can only be defined in 2D so the - * effect does not honor the depth of 3D objects. Consequently, it is not intended for physically correct lit scenes. - * - * @tsl - * @function - * @param {Node} textureNode - The texture node that should be blurred. - * @param {Object} [options={}] - Additional options for the radial blur effect. - * @param {Node} [options.center=vec2(0.5, 0.5)] - The center of the light in screen uvs. - * @param {Node} [options.weight=float(0.9)] - Base weight factor for each sample in the range `[0,1]`. - * @param {Node} [options.decay=float(0.95)] - Decreases the weight factor so each iteration adds less to the sum. Must be in the range `[0,1]`. - * If you increase the sample count, you have to increase this option as well to avoid a darking effect. - * @param {Node} [options.count=int(32)] - The number if iterations. Should be in the range `[16,64]`. - * @param {Node} [options.exposure=float(5)] - Exposure control of the blur. - * @return {Node} The blurred texture node. - */ -export const radialBlur: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts deleted file mode 100644 index 3fc0b16d1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/ClusteredLightsNode.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -export default ClusteredLightsNode; -/** - * TSL function that creates a clustered lights node. - * - * @tsl - * @function - * @param {number} [maxLights=1024] - Maximum number of point lights. - * @param {number} [tileSize=32] - Screen tile size in pixels. - * @param {number} [zSlices=24] - Depth slice count. - * @param {number} [maxLightsPerCluster=64] - Per-cluster light-list capacity. - * @return {ClusteredLightsNode} The clustered lights node. - */ -export const clusteredLights: any; -/** - * A custom version of `LightsNode` implementing Forward+ clustered shading: - * the view frustum is subdivided into a 3D grid of clusters (X × Y screen tiles - * times an exponentially-spaced set of Z depth slices), and each cluster holds - * only the point lights whose spheres intersect it. At shading time each fragment - * looks up its cluster and loops over just that cluster's lights. Unlike 2D tiled - * lighting, clustered shading culls lights that share screen pixels but lie at - * different depths — suitable for 3D scenes with real depth complexity. - * - * @augments LightsNode - * @three_import import { clusteredLights } from 'three/addons/tsl/lighting/ClusteredLightsNode.js'; - */ -declare class ClusteredLightsNode extends LightsNode { - /** - * Constructs a new clustered lights node. - * - * @param {number} [maxLights=1024] - Maximum number of point lights. - * @param {number} [tileSize=32] - Screen tile size in pixels (cluster XY size). - * @param {number} [zSlices=24] - Number of exponential depth slices. - * @param {number} [maxLightsPerCluster=64] - Per-cluster light-list capacity. - */ - constructor(maxLights?: number, tileSize?: number, zSlices?: number, maxLightsPerCluster?: number); - materialLights: any[]; - clusteredLights: any[]; - maxLights: number; - tileSize: number; - zSlices: number; - maxLightsPerCluster: number; - _chunksPerCluster: number; - _bufferSize: Vector2 | null; - _lightIndexes: import("three/webgpu").UniformNode | null; - _screenClusterIndex: any; - _compute: any; - _lightsTexture: DataTexture | null; - _zSliceRangesTexture: DataTexture | null; - _zSliceRangesData: Float32Array | null; - _lightViewZ: Float32Array; - _lightSortOrder: any[]; - _lightsCount: import("three/webgpu").UniformNode; - _cameraNear: import("three/webgpu").UniformNode; - _cameraFar: import("three/webgpu").UniformNode; - _cameraViewMatrix: import("three/webgpu").UniformNode; - _cameraProjectionMatrix: import("three/webgpu").UniformNode; - _gridDimensions: import("three/webgpu").UniformNode; - customCacheKey(): any; - updateLightsTexture(camera: any): void; - updateBefore(frame: any): void; - setLights(lights: any): LightsNode; - getBlock(): any; - getTile(element: any): any; - getClusterLightCount(zSliceNode: any): void; - getLightData(index: any): { - position: any; - viewPosition: any; - distance: any; - color: any; - decay: any; - }; - setupLights(builder: any, lightNodes: any): void; - getBufferFitSize(value: any): number; - setSize(width: any, height: any): this; - updateProgram(renderer: any): void; - create(width: any, height: any): void; -} -import { LightsNode } from 'three/webgpu'; -import { Vector2 } from 'three/webgpu'; -import { DataTexture } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts deleted file mode 100644 index 4deed63b4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/DynamicLightsNode.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export default DynamicLightsNode; -export function dynamicLights(options?: Object): DynamicLightsNode; -/** - * A custom version of `LightsNode` that batches supported analytic lights into - * uniform arrays and loops. - * - * Unsupported lights, node lights, shadow-casting lights, and projected spot - * lights keep the default per-light path. - * - * @augments LightsNode - * @three_import import { DynamicLightsNode } from 'three/addons/tsl/lighting/DynamicLightsNode.js'; - */ -declare class DynamicLightsNode extends LightsNode { - /** - * Constructs a new dynamic lights node. - * - * @param {Object} [options={}] - Dynamic lighting configuration. - * @param {number} [options.maxDirectionalLights=8] - Maximum number of batched directional lights. - * @param {number} [options.maxPointLights=16] - Maximum number of batched point lights. - * @param {number} [options.maxSpotLights=16] - Maximum number of batched spot lights. - * @param {number} [options.maxHemisphereLights=4] - Maximum number of batched hemisphere lights. - */ - constructor(options?: { - maxDirectionalLights?: number | undefined; - maxPointLights?: number | undefined; - maxSpotLights?: number | undefined; - maxHemisphereLights?: number | undefined; - }); - maxDirectionalLights: number; - maxPointLights: number; - maxSpotLights: number; - maxHemisphereLights: number; - _dataNodes: Map; - setupLightsNode(builder: any): any[]; - setLights(lights: any): this; - _updateDataNodeLights(lights: any): void; -} -import { LightsNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts deleted file mode 100644 index 86407abb2..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/LightProbeGridNode.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const ATLAS_PADDING: 1; -/** - * The light node that applies a {@link LightProbeGrid} to the scene. It samples - * the baked L2 spherical-harmonic atlas at the surface position and adds the - * resulting irradiance to the lighting context, so every standard node material - * picks up the grid automatically (same role as the WebGL `lights_fragment_begin` - * integration). - * - * @private - * @augments AnalyticLightNode - */ -export class LightProbeGridNode extends AnalyticLightNode { - constructor(light?: null); - _min: import("three/webgpu").UniformNode; - _max: import("three/webgpu").UniformNode; - _resolution: import("three/webgpu").UniformNode; - _intensity: import("three/webgpu").UniformNode; - _falloff: import("three/webgpu").UniformNode; - setup(builder: any): void; -} -import { AnalyticLightNode } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts deleted file mode 100644 index fe894a9c0..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/AmbientLightDataNode.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export default AmbientLightDataNode; -/** - * Batched data node for ambient lights in dynamic lighting mode. - * - * @augments Node - */ -declare class AmbientLightDataNode extends Node { - constructor(); - _color: Color; - _lights: any[]; - colorNode: import("three/webgpu").UniformNode; - setLights(lights: any): this; - update(): void; - setup(builder: any): void; -} -import { Node } from 'three/webgpu'; -import { Color } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts deleted file mode 100644 index 8aefc7b47..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/DirectionalLightDataNode.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default DirectionalLightDataNode; -/** - * Batched data node for directional lights in dynamic lighting mode. - * - * @augments Node - */ -declare class DirectionalLightDataNode extends Node { - constructor(maxCount?: number); - maxCount: number; - _lights: any[]; - _colors: Color[]; - _directions: Vector3[]; - colorsNode: import("three/webgpu").UniformNode; - directionsNode: import("three/webgpu").UniformNode; - countNode: import("three/webgpu").UniformNode; - setLights(lights: any): this; - update({ camera }: { - camera: any; - }): void; - setup(builder: any): void; -} -import { Node } from 'three/webgpu'; -import { Color } from 'three/webgpu'; -import { Vector3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts deleted file mode 100644 index 20c3132df..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/HemisphereLightDataNode.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default HemisphereLightDataNode; -/** - * Batched data node for hemisphere lights in dynamic lighting mode. - * - * @augments Node - */ -declare class HemisphereLightDataNode extends Node { - constructor(maxCount?: number); - maxCount: number; - _lights: any[]; - _skyColors: Color[]; - _groundColors: Color[]; - _directions: Vector3[]; - skyColorsNode: import("three/webgpu").UniformNode; - groundColorsNode: import("three/webgpu").UniformNode; - directionsNode: import("three/webgpu").UniformNode; - countNode: import("three/webgpu").UniformNode; - setLights(lights: any): this; - update(): void; - setup(builder: any): void; -} -import { Node } from 'three/webgpu'; -import { Color } from 'three/webgpu'; -import { Vector3 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts deleted file mode 100644 index 693924670..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/PointLightDataNode.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export default PointLightDataNode; -/** - * Batched data node for point lights in dynamic lighting mode. - * - * @augments Node - */ -declare class PointLightDataNode extends Node { - constructor(maxCount?: number); - maxCount: number; - _lights: any[]; - _colors: Color[]; - _positionsAndCutoff: Vector4[]; - _decays: Vector4[]; - colorsNode: import("three/webgpu").UniformNode; - positionsAndCutoffNode: import("three/webgpu").UniformNode; - decaysNode: import("three/webgpu").UniformNode; - countNode: import("three/webgpu").UniformNode; - setLights(lights: any): this; - update({ camera }: { - camera: any; - }): void; - setup(builder: any): void; -} -import { Node } from 'three/webgpu'; -import { Color } from 'three/webgpu'; -import { Vector4 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts deleted file mode 100644 index b46db542a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/lighting/data/SpotLightDataNode.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export default SpotLightDataNode; -/** - * Batched data node for simple spot lights in dynamic lighting mode. - * - * Projected spot lights keep the default per-light path. - * - * @augments Node - */ -declare class SpotLightDataNode extends Node { - constructor(maxCount?: number); - maxCount: number; - _lights: any[]; - _colors: Color[]; - _positionsAndCutoff: Vector4[]; - _directionsAndDecay: Vector4[]; - _cones: Vector4[]; - colorsNode: import("three/webgpu").UniformNode; - positionsAndCutoffNode: import("three/webgpu").UniformNode; - directionsAndDecayNode: import("three/webgpu").UniformNode; - conesNode: import("three/webgpu").UniformNode; - countNode: import("three/webgpu").UniformNode; - setLights(lights: any): this; - update({ camera }: { - camera: any; - }): void; - setup(builder: any): void; -} -import { Node } from 'three/webgpu'; -import { Color } from 'three/webgpu'; -import { Vector4 } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts deleted file mode 100644 index 87b7fcb02..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/Bayer.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This TSL function can be used to sample a Bayer16 texture which is a 16x16 texture with a Bayer Matrix pattern. - * It can be used for dithering effects but also as an alternative to blue-noise. When used with Ray Marching - * specifically in {@link VolumeNodeMaterial#offsetNode}, it reduces banding problem, thus being able to use - * fewer steps without affecting the visuals as much. - * - * @tsl - * @function - * @param {Node} uv - The uv to sample the bayer16 texture. - * @return {Node} The sampled bayer value. - */ -export const bayer16: () => void; -/** - * This TSL function applies Bayer dithering to a color input. It uses a 4x4 Bayer matrix - * pattern to add structured noise before color quantization, which helps reduce visible - * color banding when limiting color depth. - * - * @tsl - * @function - * @param {Node} color - The input color to apply dithering to. - * @param {Node} [steps=32] - The number of color steps per channel. - * @return {Node} The dithered color ready for quantization. - * - * @example - * // Apply dithering with posterize - * const ditheredColor = bayerDither( inputColor, 32 ); - * const finalColor = posterize( ditheredColor, 32 ); - */ -export const bayerDither: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts deleted file mode 100644 index a6101efb7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/curlNoise.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Permutation polynomial for noise generation. - * - * @tsl - * @function - * @param {Node} x - Input vector. - * @return {Node} Permuted vector. - */ -export const permute: () => void; -/** - * 3D Simplex noise implementation in TSL. - * - * @tsl - * @function - * @param {Node} v - Input coordinate vector. - * @return {Node} Simplex noise value. - */ -export const snoise: () => void; -/** - * 3D Simplex noise vector. Returns a vec3 containing three independent noise samples. - * - * @tsl - * @function - * @param {Node} x - Input coordinate vector. - * @return {Node} Vector of three noise values. - */ -export const snoiseVec3: () => void; -/** - * 3D Curl noise in TSL. Generates a divergence-free vector field from simplex noise. - * - * @tsl - * @function - * @param {Node} p - Input coordinate vector. - * @return {Node} Curl noise vector. - */ -export const curlNoise: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts deleted file mode 100644 index 02872393c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/math/voronoiNoise.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @module VoronoiNoise - * @three_import import { voronoi2d, voronoi3d } from 'three/addons/tsl/math/voronoiNoise.js'; - */ -/** - * Generates a pseudo-random vec2 from the given coordinate. - * - * Reference: {@link https://www.shadertoy.com/view/MslGD8}. - * - * @tsl - * @function - * @param {Node} p - The input coordinate. - * @return {Node} A pseudo-random value in the range `[0, 1]`. - */ -export const hash2d: () => void; -/** - * Animated 2D Voronoi noise. The feature points orbit inside their cells so the - * resulting pattern morphs over time. - * - * Reference: {@link https://www.shadertoy.com/view/MslGD8}. - * - * @tsl - * @function - * @param {Node} p - The input coordinate. - * @param {Node} time - The animation time. - * @return {Node} The squared distance to the closest feature point, roughly in the range `[0, 1]`. - */ -export const voronoi2d: () => void; -/** - * Generates a pseudo-random vec3 from the given coordinate. - * - * @tsl - * @function - * @param {Node} p - The input coordinate. - * @return {Node} A pseudo-random value in the range `[0, 1]`. - */ -export const hash3d: () => void; -/** - * Animated 3D Voronoi noise. Like {@link voronoi2d} but with a volumetric input - * coordinate so the pattern can be applied to arbitrary surfaces without - * projection artifacts. Evaluates 27 cells instead of 9 and is therefore - * considerably more expensive than the 2D version. - * - * @tsl - * @function - * @param {Node} p - The input coordinate. - * @param {Node} time - The animation time. - * @return {Node} The squared distance to the closest feature point, roughly in the range `[0, 1]`. - */ -export const voronoi3d: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts deleted file mode 100644 index 70c1b42db..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNode.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * A class that extends `ShadowBaseNode` to implement tiled shadow mapping. - * This allows splitting a shadow map into multiple tiles, each with its own light and camera, - * to improve shadow quality and performance for large scenes. - * - * **Note:** This class does not support `VSMShadowMap` at the moment. - * - * @class - * @augments ShadowBaseNode - * @three_import import { TileShadowNode } from 'three/addons/tsl/shadows/TileShadowNode.js'; - */ -export class TileShadowNode extends ShadowBaseNode { - /** - * Creates an instance of `TileShadowNode`. - * - * @param {Light} light - The original light source used for shadow mapping. - * @param {Object} [options={}] - Configuration options for the tiled shadow node. - * @param {number} [options.tilesX=2] - The number of tiles along the X-axis. - * @param {number} [options.tilesY=2] - The number of tiles along the Y-axis. - * @param {Object} [options.resolution] - The resolution of the shadow map. - * @param {boolean} [options.debug=false] - Whether to enable debug mode. - */ - constructor(light: Light, options?: { - tilesX?: number | undefined; - tilesY?: number | undefined; - resolution?: Object | undefined; - debug?: boolean | undefined; - }); - config: { - tilesX: number; - tilesY: number; - resolution: any; - debug: boolean; - }; - debug: boolean; - originalLight: Light; - lightPlane: Plane; - line: Line3; - initialLightDirection: Vector3; - _cameraFrameId: WeakMap; - shadowSize: { - top: any; - bottom: any; - left: any; - right: any; - }; - lights: any[]; - _shadowNodes: any[]; - tiles: Object[]; - /** - * Generates the tiles for the shadow map based on the specified number of tiles along the X and Y axes. - * - * @param {number} tilesX - The number of tiles along the X-axis. - * @param {number} tilesY - The number of tiles along the Y-axis. - * @returns {Array} An array of tile objects, each containing the tile's bounds and index. - */ - generateTiles(tilesX: number, tilesY: number): Array; - /** - * Updates the initial light direction based on the light's target position. - */ - updateLightDirection(): void; - /** - * Initializes the tiled shadow node by creating lights, cameras, and shadow maps for each tile. - * - * @param {Builder} builder - The builder used to create render targets and other resources. - */ - init(builder: Builder): void; - shadowMap: any; - cameraArray: ArrayCamera | undefined; - /** - * Updates the light transformations and shadow cameras for each tile. - */ - update(): void; - /** - * Updates the shadow map rendering. - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateShadow(frame: NodeFrame): void; - _depthVersionCached: any; - /** - * The implementation performs the update of the shadow map if necessary. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateBefore(frame: NodeFrame): void; - /** - * Synchronizes the transformation of a tile light with the source light. - * - * @param {LwLight} lwLight - The tile light to synchronize. - * @param {Light} sourceLight - The source light to copy transformations from. - */ - syncLightTransformation(lwLight: LwLight, sourceLight: Light): void; - /** - * Sets up the shadow node for rendering. - * - * @param {Builder} builder - The builder used to set up the shadow node. - * @returns {Node} A node representing the shadow value. - */ - setup(builder: Builder): Node; - /** - * Helper method to remove lights and associated nodes/targets. - * Used internally during dispose and potential re-initialization. - */ - disposeLightsAndNodes(): void; -} -import { ShadowBaseNode } from 'three/webgpu'; -import { Plane } from 'three/webgpu'; -import { Line3 } from 'three/webgpu'; -import { Vector3 } from 'three/webgpu'; -import { ArrayCamera } from 'three/webgpu'; -declare class LwLight extends Object3D { - target: Object3D; -} -import { Object3D } from 'three/webgpu'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts deleted file mode 100644 index cc99f0e70..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/shadows/TileShadowNodeHelper.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Helper class to manage and display debug visuals for TileShadowNode. - * - * @augments Group - * @three_import import { TileShadowNodeHelper } from 'three/addons/tsl/shadows/TileShadowNodeHelper.js'; - */ -export class TileShadowNodeHelper extends Group { - /** - * @param {TileShadowNode} tileShadowNode The TileShadowNode instance to debug. - */ - constructor(tileShadowNode: TileShadowNode); - tileShadowNode: any; - config: any; - tiles: any; - _debugMeshes: any[]; - _shadowCamHelpers: any[]; - initialized: boolean; - /** - * Initializes the debug displays (planes and camera helpers). - * Should be called after TileShadowNode has initialized its lights and shadow nodes. - */ - init(): void; - /** - * Updates the debug visuals (specifically camera helpers). - * Should be called within TileShadowNode's update method. - */ - update(): void; -} -import { Group } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts deleted file mode 100644 index e49e7c2b6..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/GroundedSkybox.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @module GroundedSkybox - * @three_import import { getGroundProjectedNormal } from 'three/addons/tsl/utils/GroundedSkybox.js'; - */ -/** - * Projects the world position onto a sphere whose bottom is clipped by a ground disk, - * then returns a vector usable for sampling an environment cube map. - * - * @tsl - * @function - * @param {Node} radiusNode - The radius of the projection sphere. Must be large enough to ensure the scene's camera stays inside. - * @param {Node} heightNode - The height is how far the camera that took the photo was above the ground. A larger value will magnify the downward part of the image. - * @return {Node} A direction vector for sampling the environment cube map. - */ -export const getGroundProjectedNormal: () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts deleted file mode 100644 index bf4cfffe4..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/RNoise.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Returns a TSL function that samples texture-free analytic R² noise. - * Index 0 uses continuous screen pixels; other indices tile-shift with an R² - * sequence into a 64×64 period. Values are four independent R² dimensions - * hashed from the sample coordinates. - * - * @param {UniformNode} resolution - * @param {number} [seed=0] - Added to the coordinate hash so each pass gets an independent R² phase. - */ -export function bindAnalyticNoise(resolution: UniformNode, seed?: number): () => void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts deleted file mode 100644 index 82ad5f77c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/Raymarching.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function RaymarchingBox(steps: number | Node, callback: Function | FunctionNode): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts deleted file mode 100644 index 8df6f566e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SoftParticles.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Computes an opacity node for soft particles, based on the "Soft Particles" white - * paper (NVIDIA, Tristan Lorach). - * - * @tsl - * @function - * @param {Object} [parameters={}] - The configuration parameters. - * @param {Node} [parameters.opacity=float(1)] - The sprite's base opacity, which the soft fade is multiplied with. - * @param {Node|number} [parameters.distance=1] - The world-space distance over which the sprite fades out against the scene. - * @param {Node|number} [parameters.contrast=2] - The contrast power of the fade curve. `1` is linear, higher values sharpen the transition. - * @param {Node} [parameters.viewportDepth=viewportDepthTexture()] - The opaque scene depth the particles fade against. - * @return {Node} The opacity node to assign to `material.opacityNode`. - */ -export function softParticles({ opacity, distance, contrast, viewportDepth }?: { - opacity?: Node; - distance?: Node | number; - contrast?: Node | number; - viewportDepth?: Node; -}): Node; diff --git a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts b/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts deleted file mode 100644 index 8dfe8a871..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/tsl/utils/SpecularHelpers.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Specular / microfacet BRDF helpers: VNDF sampling, GTR distribution, Smith geometry, - * Fresnel, reflection importance sampling, parallax-corrected ray-length terms, and - * equirectangular environment sampling / MIS helpers. - * Pure TSL functions of their inputs (no scene/camera state). - */ -/** - * Sentinel ray length the SSR pass writes for environment misses (no screen-space hit), set far above - * any real hit distance so a single magnitude test separates misses from hits and survives `.max( 0 )`. - * - * @type {number} - */ -export const ENV_RAY_LENGTH: number; -/** - * Classification threshold for {@link ENV_RAY_LENGTH}: above this is an env miss, below a real hit. - * An order of magnitude under the sentinel, robust to fp16 storage and bilinear blending at borders. - * - * @type {number} - */ -export const ENV_RAY_LENGTH_THRESHOLD: number; -export const D_GTR: () => void; -export const SmithG: () => void; -export const GeometryTerm: () => void; -/** - * Fresnel reflectance for the Schlick approximation. - */ -export const F_Schlick: () => void; -/** - * Specular dominant factor for parallax-corrected ray length. - * From REBLUR: A Hierarchical Recurrent Denoiser (NRD). - */ -export const getSpecularDominantFactor: any; -/** - * Importance-samples the GGX/VNDF specular lobe for one pixel and returns the reflected - * ray direction plus the Monte-Carlo weight to apply to the gathered radiance, along with - * the GGX terms the SSR env-miss MIS fallback needs. - * - * @param {Node} N - View-space shading normal (normalized). - * @param {Node} V - View-space surface→camera direction (normalized). - * @param {Node} roughness - Perceptual roughness in `[0,1]`. - * @param {Node} metalness - Metalness in `[0,1]`. - * @param {Node} albedo - Surface base color; tints the metal Fresnel reflectance (`f0`). - * @param {Node} Xi - Per-pixel random numbers; only `.xy` are used. - * @return {ggxReflectionStruct} - */ -export const ggxReflectionSample: () => void; -/** - * Equirectangular direction / UV / PDF helpers and MIS weighting shared by environment sampling code. - * Env-miss MIS integration lives in {@link ImportanceSampledEnvironment}. - * - * Equirectangular parameterization helpers used with CDF importance sampling are adapted from - * [three-gpu-pathtracer](https://github.com/gkjohnson/three-gpu-pathtracer). - * - * @see {@link https://github.com/gkjohnson/three-gpu-pathtracer} - */ -export const equirectUvToDir: any; -export const equirectDirPdf: any; -/** - * MIS power heuristic with β = 2: `pdfA² / (pdfA² + pdfB²)`. - * Weights the contribution of the strategy that produced `pdfA` against the other strategy. - * - * @see Eric Veach, *Optimally Combining Sampling Techniques for Monte Carlo Rendering* - * @tsl - */ -export const misPowerHeuristic: any; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts deleted file mode 100644 index 2585bcb59..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/BufferGeometryUtils.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/** - * @module BufferGeometryUtils - * @three_import import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - */ -/** - * Computes vertex tangents using the MikkTSpace algorithm. MikkTSpace generates the same tangents consistently, - * and is used in most modelling tools and normal map bakers. Use MikkTSpace for materials with normal maps, - * because inconsistent tangents may lead to subtle visual issues in the normal map, particularly around mirrored - * UV seams. - * - * In comparison to this method, {@link BufferGeometry#computeTangents} (a custom algorithm) generates tangents that - * probably will not match the tangents in other software. The custom algorithm is sufficient for general use with a - * custom material, and may be faster than MikkTSpace. - * - * Returns the original BufferGeometry. Indexed geometries will be de-indexed. Requires position, normal, and uv attributes. - * - * @param {BufferGeometry} geometry - The geometry to compute tangents for. - * @param {Object} MikkTSpace - Instance of `examples/jsm/libs/mikktspace.module.js`, or `mikktspace` npm package. - * Await `MikkTSpace.ready` before use. - * @param {boolean} [negateSign=true] - Whether to negate the sign component (.w) of each tangent. - * Required for normal map conventions in some formats, including glTF. - * @return {BufferGeometry} The updated geometry. - */ -export function computeMikkTSpaceTangents(geometry: BufferGeometry, MikkTSpace: Object, negateSign?: boolean): BufferGeometry; -/** - * Merges a set of geometries into a single instance. All geometries must have compatible attributes. - * - * @param {Array} geometries - The geometries to merge. - * @param {boolean} [useGroups=false] - Whether to use groups or not. - * @return {?BufferGeometry} The merged geometry. Returns `null` if the merge does not succeed. - */ -export function mergeGeometries(geometries: Array, useGroups?: boolean): BufferGeometry | null; -/** - * Merges a set of attributes into a single instance. All attributes must have compatible properties and types. - * Instances of {@link InterleavedBufferAttribute} are not supported. - * - * @param {Array} attributes - The attributes to merge. - * @return {?BufferAttribute} The merged attribute. Returns `null` if the merge does not succeed. - */ -export function mergeAttributes(attributes: Array): BufferAttribute | null; -/** - * Performs a deep clone of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The attribute to clone. - * @return {BufferAttribute} The cloned attribute. - */ -export function deepCloneAttribute(attribute: BufferAttribute): BufferAttribute; -/** - * Returns a new, non-interleaved version of the given attribute. - * - * @param {InterleavedBufferAttribute} attribute - The interleaved attribute. - * @return {BufferAttribute} The non-interleaved attribute. - */ -export function deinterleaveAttribute(attribute: InterleavedBufferAttribute): BufferAttribute; -/** - * Deinterleaves all attributes on the given geometry. - * - * @param {BufferGeometry} geometry - The geometry to deinterleave. - */ -export function deinterleaveGeometry(geometry: BufferGeometry): void; -/** - * Interleaves a set of attributes and returns a new array of corresponding attributes that share a - * single {@link InterleavedBuffer} instance. All attributes must have compatible types. - * - * @param {Array} attributes - The attributes to interleave. - * @return {?Array} An array of interleaved attributes. If interleave does not succeed, the method returns `null`. - */ -export function interleaveAttributes(attributes: Array): Array | null; -/** - * Returns the amount of bytes used by all attributes to represent the geometry. - * - * @param {BufferGeometry} geometry - The geometry. - * @return {number} The estimate bytes used. - */ -export function estimateBytesUsed(geometry: BufferGeometry): number; -/** - * Returns a new geometry with vertices for which all similar vertex attributes (within tolerance) are merged. - * - * @param {BufferGeometry} geometry - The geometry to merge vertices for. - * @param {number} [tolerance=1e-4] - The tolerance value. - * @return {BufferGeometry} - The new geometry with merged vertices. - */ -export function mergeVertices(geometry: BufferGeometry, tolerance?: number): BufferGeometry; -/** - * Converts the given geometry to the `TrianglesDrawMode` draw mode, which - * corresponds to the `gl.TRIANGLES` primitive in WebGL. The conversion only - * rewrites the index, so the geometry is modified in place and returned. - * - * @param {BufferGeometry} geometry - The geometry to convert. - * @param {number} drawMode - The current draw mode. - * @return {BufferGeometry} The converted geometry using `TrianglesDrawMode`. - */ -export function toTrianglesDrawMode(geometry: BufferGeometry, drawMode: number): BufferGeometry; -/** - * Calculates the morphed attributes of a morphed/skinned BufferGeometry. - * - * Helpful for Raytracing or Decals (i.e. a `DecalGeometry` applied to a morphed Object with a `BufferGeometry` - * will use the original `BufferGeometry`, not the morphed/skinned one, generating an incorrect result. - * Using this function to create a shadow `Object3`D the `DecalGeometry` can be correctly generated). - * - * @param {Mesh|Line|Points} object - The 3D object to compute morph attributes for. - * @return {Object} An object with original position/normal attributes and morphed ones. - */ -export function computeMorphedAttributes(object: Mesh | Line | Points): Object; -/** - * Merges the {@link BufferGeometry#groups} for the given geometry. - * - * @param {BufferGeometry} geometry - The geometry to modify. - * @return {BufferGeometry} - The updated geometry - */ -export function mergeGroups(geometry: BufferGeometry): BufferGeometry; -/** - * Modifies the supplied geometry if it is non-indexed, otherwise creates a new, - * non-indexed geometry. Returns the geometry with smooth normals everywhere except - * faces that meet at an angle greater than the crease angle. - * - * @param {BufferGeometry} geometry - The geometry to modify. - * @param {number} [creaseAngle=Math.PI/3] - The crease angle in radians. - * @return {BufferGeometry} - The updated geometry - */ -export function toCreasedNormals(geometry: BufferGeometry, creaseAngle?: number): BufferGeometry; -import { BufferGeometry } from 'three'; -import { BufferAttribute } from 'three'; -import { InterleavedBufferAttribute } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts deleted file mode 100644 index 42813c0bf..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/CameraUtils.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Set projection matrix and the orientation of a perspective camera - * to exactly frame the corners of an arbitrary rectangle. - * NOTE: This function ignores the standard parameters; - * do not call `updateProjectionMatrix()` after this. - * - * @param {PerspectiveCamera} camera - The camera. - * @param {Vector3} bottomLeftCorner - The bottom-left corner point. - * @param {Vector3} bottomRightCorner - The bottom-right corner point. - * @param {Vector3} topLeftCorner - The top-left corner point. - * @param {boolean} [estimateViewFrustum=false] - If set to `true`, the function tries to estimate the camera's FOV. - */ -export function frameCorners(camera: PerspectiveCamera, bottomLeftCorner: Vector3, bottomRightCorner: Vector3, topLeftCorner: Vector3, estimateViewFrustum?: boolean): void; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts deleted file mode 100644 index fd8d570bc..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/ColorUtils.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @module ColorUtils - * @three_import import * as ColorUtils from 'three/addons/utils/ColorUtils.js'; - */ -/** - * Sets the given color from a color temperature in Kelvin. - * - * Converts a correlated color temperature (CTT) to an approximate sRGB color - * using Tanner Helland's algorithm. Useful for physically-based lighting - * setups — e.g. candle flame (~1900K), tungsten bulb (~3200K), daylight - * (~6500K), or clear blue sky (~10000K). Values outside [1000, 40000] are - * clamped. - * - * Reference: https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html - * - * @param {Color} color - The color to set. - * @param {number} kelvin - Color temperature in Kelvin. Clamped to [1000, 40000]. - * @return {Color} The updated color. - */ -export function setKelvin(color: Color, kelvin: number): Color; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts deleted file mode 100644 index ab8bda46a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/GaussianSplatUtils.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export const SH_BAND_COMPONENTS: number[]; -export const SH_BAND_WORDS: number[]; -export const SH_C0: 0.2820947917738781; -/** - * Creates Gaussian splat geometry from packed attribute arrays. Higher-order - * spherical harmonics must be supplied as packed `Uint32Array` words - * (`SH_BAND_WORDS[ degree ]` words per splat, four clamped-byte coefficients - * per word using `( value - 128 ) / 128`). - * - * @param {Float32Array} centers - Splat centers. - * @param {Float32Array} covariances - Splat covariance matrices. - * @param {Uint8Array|Uint8ClampedArray} colors - RGBA colors. - * @param {Object} [sphericalHarmonics={}] - Optional packed SH band arrays. - * @return {BufferGeometry} The Gaussian splat geometry. - */ -export function createGaussianSplatGeometry(centers: Float32Array, covariances: Float32Array, colors: Uint8Array | Uint8ClampedArray, sphericalHarmonics?: Object): BufferGeometry; -export function createPackedSphericalHarmonicsBand(count: any, degree: any): { - packed: Uint32Array; - bytes: Uint8ClampedArray; -}; -export function getSphericalHarmonicsDegree(geometry: any): number; -export function linearToSH0(color: any): number; -export function sh0ToLinear(coefficient: any): number; -export function sigmoid(value: any): number; -export function writeColorBytes(target: any, offset: any, r: any, g: any, b: any, a: any): void; -export function writeColorBytesFromSH0(target: any, offset: any, r: any, g: any, b: any, a: any): void; -export function writeCovariance(target: any, offset: any, sx: any, sy: any, sz: any, qx: any, qy: any, qz: any, qw: any): void; -import { BufferGeometry } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts deleted file mode 100644 index 30aa1ef4b..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryCompressionUtils.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @module GeometryCompressionUtils - * @three_import import * as GeometryCompressionUtils from 'three/addons/utils/GeometryCompressionUtils.js'; - */ -/** - * Compressed the given geometry's `normal` attribute by the selected encode method. - * - * @param {BufferGeometry} geometry - The geometry whose normals should be compressed. - * @param {('DEFAULT'|'OCT1Byte'|'OCT2Byte'|'ANGLES')} encodeMethod - The compression method. - */ -export function compressNormals(geometry: BufferGeometry, encodeMethod: ("DEFAULT" | "OCT1Byte" | "OCT2Byte" | "ANGLES")): void; -/** - * Compressed the given geometry's `position` attribute. - * - * @param {BufferGeometry} geometry - The geometry whose position values should be compressed. - */ -export function compressPositions(geometry: BufferGeometry): void; -/** - * Compressed the given geometry's `uv` attribute. - * - * @param {BufferGeometry} geometry - The geometry whose texture coordinates should be compressed. - */ -export function compressUvs(geometry: BufferGeometry): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts deleted file mode 100644 index a5d2f6c5e..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/GeometryUtils.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @module GeometryUtils - * @three_import import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; - */ -/** - * Generates 2D-Coordinates along a Hilbert curve. - * - * Based on work by: {@link http://www.openprocessing.org/sketch/15493} - * - * @param {Vector3} [center] - Center of Hilbert curve. - * @param {number} [size=10] - Total width of Hilbert curve. - * @param {number} [iterations=10] - Number of subdivisions. - * @param {number} [v0=0] - Corner index -X, -Z. - * @param {number} [v1=1] - Corner index -X, +Z. - * @param {number} [v2=2] - Corner index +X, +Z. - * @param {number} [v3=3] - Corner index +X, -Z. - * @returns {Array} The Hilbert curve points. - */ -export function hilbert2D(center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number): Array; -/** - * Generates 3D-Coordinates along a Hilbert curve. - * - * Based on work by: {@link https://openprocessing.org/user/5654} - * - * @param {Vector3} [center] - Center of Hilbert curve. - * @param {number} [size=10] - Total width of Hilbert curve. - * @param {number} [iterations=1] - Number of subdivisions. - * @param {number} [v0=0] - Corner index -X, +Y, -Z. - * @param {number} [v1=1] - Corner index -X, +Y, +Z. - * @param {number} [v2=2] - Corner index -X, -Y, +Z. - * @param {number} [v3=3] - Corner index -X, -Y, -Z. - * @param {number} [v4=4] - Corner index +X, -Y, -Z. - * @param {number} [v5=5] - Corner index +X, -Y, +Z. - * @param {number} [v6=6] - Corner index +X, +Y, +Z. - * @param {number} [v7=7] - Corner index +X, +Y, -Z. - * @returns {Array} - The Hilbert curve points. - */ -export function hilbert3D(center?: Vector3, size?: number, iterations?: number, v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number): Array; -/** - * Generates a Gosper curve (lying in the XY plane). - * - * Reference: {@link https://gist.github.com/nitaku/6521802} - * - * @param {number} [size=1] - The size of a single gosper island. - * @return {Array} The gosper island points. - */ -export function gosper(size?: number): Array; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts deleted file mode 100644 index 6345ec25f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/LDrawUtils.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Utility class for LDraw models. - * - * @three_import import { LDrawUtils } from 'three/addons/utils/LDrawUtils.js'; - */ -export class LDrawUtils { - /** - * Merges geometries in the given object by materials and returns a new group object. - * Use on not indexed geometries. The object buffers reference the old object ones. - * Special treatment is done to the conditional lines generated by LDrawLoader. - * - * @param {Object3D} object - The object to merge. - * @returns {Group} The merged object. - */ - static mergeObject(object: Object3D): Group; -} -import { Group } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts deleted file mode 100644 index e8def1ced..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/SceneOptimizer.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * ~Options - */ -export type SceneOptimizer = { - /** - * - Whether to enable debug mode or not. - */ - debug?: boolean | undefined; -}; -/** - * This class can be used to optimized scenes by converting - * individual meshes into {@link BatchedMesh}. This component - * is an experimental attempt to implement auto-batching in three.js. - * - * @three_import import { SceneOptimizer } from 'three/addons/utils/SceneOptimizer.js'; - */ -export class SceneOptimizer { - /** - * Constructs a new scene optimizer. - * - * @param {Scene} scene - The scene to optimize. - * @param {SceneOptimizer~Options} options - The configuration options. - */ - constructor(scene: Scene, options?: {}); - scene: Scene; - debug: any; - _bufferToHash(buffer: any): number; - _getMaterialPropertiesHash(material: any): string; - _getAttributesSignature(geometry: any): string; - _getGeometryHash(geometry: any): string; - _getBatchKey(materialProps: any, attributesSignature: any): string; - _analyzeModel(): { - batchGroups: Map; - singleGroups: Map; - uniqueGeometries: number; - }; - _createBatchedMeshes(batchGroups: any): Set; - /** - * Removes empty nodes from all descendants of the given 3D object. - * - * @param {Object3D} object - The 3D object to process. - */ - removeEmptyNodes(object: Object3D): void; - /** - * Removes the given array of meshes from the scene. - * - * @param {Set} meshesToRemove - The meshes to remove. - */ - disposeMeshes(meshesToRemove: Set): void; - _logDebugInfo(stats: any): void; - /** - * Performs the auto-baching by identifying groups of meshes in the scene - * that can be represented as a single {@link BatchedMesh}. The method modifies - * the scene by adding instances of `BatchedMesh` and removing the now redundant - * individual meshes. - * - * @return {Scene} The optimized scene. - */ - toBatchedMesh(): Scene; - /** - * Performs the auto-instancing by identifying groups of meshes in the scene - * that can be represented as a single {@link InstancedMesh}. The method modifies - * the scene by adding instances of `InstancedMesh` and removing the now redundant - * individual meshes. - * - * This method is not yet implemented. - * - * @abstract - * @return {Scene} The optimized scene. - */ - toInstancingMesh(): Scene; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts deleted file mode 100644 index c25850d82..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/SceneUtils.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This function creates a mesh for each instance of the given instanced mesh and - * adds it to a group. Each mesh will honor the current 3D transformation of its - * corresponding instance. - * - * @param {InstancedMesh} instancedMesh - The instanced mesh. - * @return {Group} A group of meshes. - */ -export function createMeshesFromInstancedMesh(instancedMesh: InstancedMesh): Group; -/** - * This function creates a mesh for each geometry-group of the given multi-material mesh and - * adds it to a group. - * - * @param {Mesh} mesh - The multi-material mesh. - * @return {Group} A group of meshes. - */ -export function createMeshesFromMultiMaterialMesh(mesh: Mesh): Group; -/** - * This function represents an alternative way to create 3D objects with multiple materials. - * Normally, {@link BufferGeometry#groups} are used which might introduce issues e.g. when - * exporting the object to a 3D format. This function accepts a geometry and an array of - * materials and creates for each material a mesh that is added to a group. - * - * @param {BufferGeometry} geometry - The geometry. - * @param {Array} materials - An array of materials. - * @return {Group} A group representing a multi-material object. - */ -export function createMultiMaterialObject(geometry: BufferGeometry, materials: Array): Group; -/** - * Executes a reducer function for each vertex of the given 3D object. - * `reduceVertices()` returns a single value: the function's accumulated result. - * - * @param {Object3D} object - The 3D object that should be processed. It must have a - * geometry with a `position` attribute. - * @param {function(number,Vector3):number} func - The reducer function. First argument - * is the current value, second argument the current vertex. - * @param {any} initialValue - The initial value. - * @return {any} The result. - */ -export function reduceVertices(object: Object3D, func: (arg0: number, arg1: Vector3) => number, initialValue: any): any; -/** - * Sorts the instances of the given instanced mesh. - * - * @param {InstancedMesh} mesh - The instanced mesh to sort. - * @param {function(number, number):number} compareFn - A custom compare function for the sort. - */ -export function sortInstancedMesh(mesh: InstancedMesh, compareFn: (arg0: number, arg1: number) => number): void; -/** - * Generator based alternative to {@link Object3D#traverse}. - * - * @param {Object3D} object - Object to traverse. - * @yields {Object3D} Objects that passed the filter condition. - */ -export function traverseGenerator(object: Object3D): any; -/** - * Generator based alternative to {@link Object3D#traverseVisible}. - * - * @param {Object3D} object Object to traverse. - * @yields {Object3D} Objects that passed the filter condition. - */ -export function traverseVisibleGenerator(object: Object3D): any; -/** - * Generator based alternative to {@link Object3D#traverseAncestors}. - * - * @param {Object3D} object Object to traverse. - * @yields {Object3D} Objects that passed the filter condition. - */ -export function traverseAncestorsGenerator(object: Object3D): any; -import { Group } from 'three'; -import { Mesh } from 'three'; -import { BufferGeometry } from 'three'; -import { Vector3 } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts deleted file mode 100644 index 868c5d524..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewer.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This is a helper for visualising a given light's shadow map. - * It works for shadow casting lights: DirectionalLight and SpotLight. - * It renders out the shadow map and displays it on a HUD. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * import the class from `ShadowMapViewerGPU.js`. - * - * ```js - * const lightShadowMapViewer = new ShadowMapViewer( light ); - * lightShadowMapViewer.position.x = 10; - * lightShadowMapViewer.position.y = SCREEN_HEIGHT - ( SHADOW_MAP_HEIGHT / 4 ) - 10; - * lightShadowMapViewer.size.width = SHADOW_MAP_WIDTH / 4; - * lightShadowMapViewer.size.height = SHADOW_MAP_HEIGHT / 4; - * lightShadowMapViewer.update(); - * ``` - * - * @three_import import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; - */ -export class ShadowMapViewer { - /** - * Constructs a new shadow map viewer. - * - * @param {Light} light - The shadow casting light. - */ - constructor(light: Light); - /** - * Whether to display the shadow map viewer or not. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * The size of the viewer. When changing this property, make sure - * to call {@link ShadowMapViewer#update}. - * - * @type {{width:number,height:number}} - * @default true - */ - size: { - width: number; - height: number; - }; - /** - * The position of the viewer. When changing this property, make sure - * to call {@link ShadowMapViewer#update}. - * - * @type {{x:number,y:number, set:function(number,number)}} - * @default true - */ - position: { - x: number; - y: number; - set: (arg0: number, arg1: number) => any; - }; - /** - * Renders the viewer. This method must be called in the app's animation loop. - * - * @param {WebGLRenderer} renderer - The renderer. - */ - render: (renderer: WebGLRenderer) => void; - /** - * Resizes the viewer. This method should be called whenever the app's - * window is resized. - */ - updateForWindowResize: () => void; - /** - * Updates the viewer. - */ - update: () => void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts deleted file mode 100644 index b32070902..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/ShadowMapViewerGPU.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/** - * This is a helper for visualising a given light's shadow map. - * It works for shadow casting lights: DirectionalLight and SpotLight. - * It renders out the shadow map and displays it on a HUD. - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * import the class from `ShadowMapViewer.js`. - * - * ```js - * const lightShadowMapViewer = new ShadowMapViewer( light ); - * lightShadowMapViewer.position.x = 10; - * lightShadowMapViewer.position.y = SCREEN_HEIGHT - ( SHADOW_MAP_HEIGHT / 4 ) - 10; - * lightShadowMapViewer.size.width = SHADOW_MAP_WIDTH / 4; - * lightShadowMapViewer.size.height = SHADOW_MAP_HEIGHT / 4; - * lightShadowMapViewer.update(); - * ``` - * - * @three_import import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewerGPU.js'; - */ -export class ShadowMapViewer { - /** - * Constructs a new shadow map viewer. - * - * @param {Light} light - The shadow casting light. - */ - constructor(light: Light); - /** - * Whether to display the shadow map viewer or not. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * The size of the viewer. When changing this property, make sure - * to call {@link ShadowMapViewer#update}. - * - * @type {{width:number,height:number}} - * @default true - */ - size: { - width: number; - height: number; - }; - /** - * The position of the viewer. When changing this property, make sure - * to call {@link ShadowMapViewer#update}. - * - * @type {{width:number,height:number}} - * @default true - */ - position: { - width: number; - height: number; - }; - /** - * Renders the viewer. This method must be called in the app's animation loop. - * - * @param {WebGPURenderer} renderer - The renderer. - */ - render: (renderer: WebGPURenderer) => void; - /** - * Resizes the viewer. This method should be called whenever the app's - * window is resized. - */ - updateForWindowResize: () => void; - /** - * Updates the viewer. - */ - update: () => void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts deleted file mode 100644 index d4841dd3a..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/SkeletonUtils.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * :SkeletonUtils~RetargetOptions - */ -export type module = { - /** - * - Whether to use the position of the first frame or not. - */ - useFirstFramePosition?: boolean | undefined; - /** - * - The FPS of the clip. - */ - fps?: number | undefined; - /** - * - A dictionary for mapping target to source bone names. - */ - names?: { - [x: string]: string; - } | undefined; - /** - * - A function for mapping bone names. Alternative to `names`. - */ - getBoneName?: ((arg0: string) => string) | undefined; - /** - * - Whether to trim the clip or not. If set the array should hold two values for the start and end. - */ - trim?: number[] | undefined; - /** - * - Whether to preserve bone matrices or not. - */ - preserveBoneMatrix?: boolean | undefined; - /** - * - Whether to preserve bone positions or not. - */ - preserveBonePositions?: boolean | undefined; - /** - * - Whether to use the target matrix or not. - */ - useTargetMatrix?: boolean | undefined; - /** - * - The name of the source's hip bone. - */ - hip?: string | undefined; - /** - * - The hip influence. - */ - hipInfluence?: Vector3 | undefined; - /** - * - The scale. - */ - scale?: number | undefined; - /** - * - Per-bone local offset matrices, keyed by bone name. - */ - localOffsets?: { - [x: string]: Matrix4; - } | undefined; - /** - * - An additional position offset applied to the hip bone. - */ - hipPosition?: Vector3 | undefined; -}; -/** - * Retargets the skeleton from the given source to the target. - * - * Both `target` and `source` can be a 3D object with a skeleton property (e.g. a skinned mesh) - * or a {@link Skeleton} directly. - * - * @param {Object3D|Skeleton} target - The target object. - * @param {Object3D|Skeleton} source - The source object. - * @param {module:SkeletonUtils~RetargetOptions} options - The options. - */ -export function retarget(target: Object3D | Skeleton, source: Object3D | Skeleton, options?: any): void; -/** - * Retargets the animation clip of the source to the target 3D object. - * - * The `source` can be a 3D object with a skeleton property (e.g. a skinned mesh) - * or a {@link Skeleton} directly. - * - * @param {Object3D} target - The target 3D object. Must have a `skeleton` property. - * @param {Object3D|Skeleton} source - The source object. - * @param {AnimationClip} clip - The animation clip. - * @param {module:SkeletonUtils~RetargetOptions} options - The options. - * @return {AnimationClip} The retargeted animation clip. - */ -export function retargetClip(target: Object3D, source: Object3D | Skeleton, clip: AnimationClip, options?: any): AnimationClip; -/** - * Clones the given 3D object and its descendants, ensuring that any `SkinnedMesh` instances are - * correctly associated with their bones. Bones are also cloned, and must be descendants of the - * object passed to this method. Other data, like geometries and materials, are reused by reference. - * - * @param {Object3D} source - The 3D object to clone. - * @return {Object3D} The cloned 3D object. - */ -export function clone(source: Object3D): Object3D; -import { Vector3 } from 'three'; -import { Matrix4 } from 'three'; -import { AnimationClip } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts deleted file mode 100644 index c3b427e51..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/SortUtils.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function radixSort(arr: Array, opt: Object): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts deleted file mode 100644 index 241f84f5f..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/UVsDebug.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @module UVsDebug - * @three_import import { UVsDebug } from 'three/addons/utils/UVsDebug.js'; - */ -/** - * Function for "unwrapping" and debugging three.js geometries UV mapping. - * - * ```js - * document.body.appendChild( UVsDebug( new THREE.SphereGeometry() ) ); - * ``` - * - * @param {BufferGeometry} geometry - The geometry whose uv coordinates should be inspected. - * @param {number} [size=1024] - The size of the debug canvas. - * @return {HTMLCanvasElement} A canvas element with visualized uv coordinates. - */ -export function UVsDebug(geometry: BufferGeometry, size?: number): HTMLCanvasElement; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts deleted file mode 100644 index 80f87055c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/WebGLTextureUtils.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Returns an uncompressed version of the given compressed texture. - * - * This module can only be used with {@link WebGLRenderer}. When using {@link WebGPURenderer}, - * import the function from {@link module:WebGPUTextureUtils}. - * - * @param {CompressedTexture} texture - The compressed texture. - * @param {number} [maxTextureSize=Infinity] - The maximum size of the uncompressed texture. - * @param {?WebGLRenderer} [renderer=null] - A reference to a renderer. - * @return {CanvasTexture} The uncompressed texture. - */ -export function decompress(texture: CompressedTexture, maxTextureSize?: number, renderer?: WebGLRenderer | null): CanvasTexture; -import { WebGLRenderer } from 'three'; -import { CanvasTexture } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts deleted file mode 100644 index 6a415b8bf..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/WebGPUTextureUtils.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Returns an uncompressed version of the given compressed texture. - * - * This module can only be used with {@link WebGPURenderer}. When using {@link WebGLRenderer}, - * import the function from {@link module:WebGLTextureUtils}. - * - * @async - * @param {CompressedTexture} blitTexture - The compressed texture. - * @param {number} [maxTextureSize=Infinity] - The maximum size of the uncompressed texture. - * @param {?WebGPURenderer} [renderer=null] - A reference to a renderer. - * @return {Promise} A Promise that resolved with the uncompressed texture. - */ -export function decompress(blitTexture: CompressedTexture, maxTextureSize?: number, renderer?: WebGPURenderer | null): Promise; -import { WebGPURenderer } from 'three/webgpu'; -import { CanvasTexture } from 'three/webgpu'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts b/jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts deleted file mode 100644 index 054151041..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/utils/WorkerPool.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * A simple pool for managing Web Workers. - * - * @three_import import { WorkerPool } from 'three/addons/utils/WorkerPool.js'; - */ -export class WorkerPool { - /** - * Constructs a new Worker pool. - * - * @param {number} [pool=4] - The size of the pool. - */ - constructor(pool?: number); - /** - * The size of the pool. - * - * @type {number} - * @default 4 - */ - pool: number; - /** - * A message queue. - * - * @type {Array} - */ - queue: Array; - /** - * An array of Workers. - * - * @type {Array} - */ - workers: Array; - /** - * An array with resolve functions for messages. - * - * @type {Array} - */ - workersResolve: Array; - /** - * The current worker status. - * - * @type {number} - */ - workerStatus: number; - /** - * A factory function for creating workers. - * - * @type {?Function} - */ - workerCreator: Function | null; - _initWorker(workerId: any): void; - _getIdleWorker(): number; - _onMessage(workerId: any, msg: any): void; - /** - * Sets a function that is responsible for creating Workers. - * - * @param {Function} workerCreator - The worker creator function. - */ - setWorkerCreator(workerCreator: Function): void; - /** - * Sets the Worker limit - * - * @param {number} pool - The size of the pool. - */ - setWorkerLimit(pool: number): void; - /** - * Post a message to an idle Worker. If no Worker is available, - * the message is pushed into a message queue for later processing. - * - * @param {Object} msg - The message. - * @param {Array} transfer - An array with array buffers for data transfer. - * @return {Promise} A Promise that resolves when the message has been processed. - */ - postMessage(msg: Object, transfer: Array): Promise; - /** - * Terminates all Workers of this pool. Call this method whenever this - * Worker pool is no longer used in your app. - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts deleted file mode 100644 index 64886c1b3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/ARButton.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A utility class for creating a button that allows to initiate - * immersive AR sessions based on WebXR. The button can be created - * with a factory method and then appended to the website's DOM. - * - * ```js - * document.body.appendChild( ARButton.createButton( renderer ) ); - * ``` - * - * @hideconstructor - * @three_import import { ARButton } from 'three/addons/webxr/ARButton.js'; - */ -export class ARButton { - /** - * Constructs a new AR button. - * - * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. - * @param {XRSessionInit} [sessionInit] - The a configuration object for the AR session. - * @return {HTMLElement} The button or an error message if `immersive-ar` isn't supported. - */ - static createButton(renderer: WebGLRenderer | WebGPURenderer, sessionInit?: XRSessionInit): HTMLElement; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts deleted file mode 100644 index 7d8e29631..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandModel.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Represents an Oculus hand model. - * - * @augments Object3D - * @three_import import { OculusHandModel } from 'three/addons/webxr/OculusHandModel.js'; - */ -export class OculusHandModel extends Object3D { - /** - * Constructs a new Oculus hand model. - * - * @param {Group} controller - The hand controller. - * @param {?Loader} [loader=null] - A loader that is used to load hand models. - * @param {?Function} [onLoad=null] - A callback that is executed when a hand model has been loaded. - */ - constructor(controller: Group, loader?: Loader | null, onLoad?: Function | null); - /** - * The hand controller. - * - * @type {Group} - */ - controller: Group; - /** - * The motion controller. - * - * @type {?MotionController} - * @default null - */ - motionController: MotionController | null; - /** - * The model's environment map. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - /** - * A loader that is used to load hand models. - * - * @type {?Loader} - * @default null - */ - loader: Loader | null; - /** - * A callback that is executed when a hand model has been loaded. - * - * @type {?Function} - * @default null - */ - onLoad: Function | null; - /** - * The path to the model repository. - * - * @type {?string} - * @default null - */ - path: string | null; - /** - * The model mesh. - * - * @type {Mesh} - * @default null - */ - mesh: Mesh; - xrInputSource: any; - /** - * Returns the pointer position which is the position of the index finger tip. - * - * @return {?Vector3} The pointer position. Returns `null` if not index finger tip joint was found. - */ - getPointerPosition(): Vector3 | null; - /** - * Returns `true` if the current pointer position (the index finger tip) intersections - * with the given box object. - * - * @param {Mesh} boxObject - The box object. - * @return {boolean} Whether an intersection was found or not. - */ - intersectBoxObject(boxObject: Mesh): boolean; - /** - * Executed actions depending on the interaction state with - * the given button. - * - * @param {Object} button - The button. - */ - checkButton(button: Object): void; -} -import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts deleted file mode 100644 index 6b95236eb..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/OculusHandPointerModel.d.ts +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Represents an Oculus hand pointer model. - * - * @augments Object3D - * @three_import import { OculusHandPointerModel } from 'three/addons/webxr/OculusHandPointerModel.js'; - */ -export class OculusHandPointerModel extends Object3D { - /** - * Constructs a new Oculus hand model. - * - * @param {Group} hand - The hand controller. - * @param {Group} controller - The WebXR controller in target ray space. - */ - constructor(hand: Group, controller: Group); - /** - * The hand controller. - * - * @type {Group} - */ - hand: Group; - /** - * The WebXR controller in target ray space. - * - * @type {Group} - */ - controller: Group; - motionController: any; - envMap: any; - mesh: any; - /** - * The pointer geometry. - * - * @type {?BufferGeometry} - * @default null - */ - pointerGeometry: BufferGeometry | null; - /** - * The pointer mesh. - * - * @type {?Mesh} - * @default null - */ - pointerMesh: Mesh | null; - /** - * The pointer object that holds the pointer mesh. - * - * @type {?Object3D} - * @default null - */ - pointerObject: Object3D | null; - /** - * Whether the model is pinched or not. - * - * @type {?boolean} - * @default false - */ - pinched: boolean | null; - /** - * Whether the model is attached or not. - * - * @type {boolean} - * @default false - */ - attached: boolean; - /** - * The cursor object. - * - * @type {?Mesh} - * @default null - */ - cursorObject: Mesh | null; - /** - * The internal raycaster used for detecting - * intersections. - * - * @type {?Raycaster} - * @default null - */ - raycaster: Raycaster | null; - _onConnected(event: any): void; - _onDisconnected(): void; - xrInputSource: any; - _drawVerticesRing(vertices: any, baseVector: any, ringIndex: any): void; - _updatePointerVertices(rearRadius: any): void; - /** - * Creates a pointer mesh and adds it to this model. - */ - createPointer(): void; - _updateRaycaster(): void; - _updatePointer(): void; - /** - * Returns `true` is the model is pinched. - * - * @return {boolean} Whether the model is pinched or not. - */ - isPinched(): boolean; - /** - * Sets the attached state. - * - * @param {boolean} attached - Whether the model is attached or not. - */ - setAttached(attached: boolean): void; - /** - * Returns `true` is the model is attached. - * - * @return {boolean} Whether the model is attached or not. - */ - isAttached(): boolean; - /** - * Performs an intersection test with the model's raycaster and the given object. - * - * @param {Object3D} object - The 3D object to check for intersection with the ray. - * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. - * Otherwise it only checks intersection with the object. - * @return {Array} An array holding the intersection points. - */ - intersectObject(object: Object3D, recursive?: boolean): Array; - /** - * Performs an intersection test with the model's raycaster and the given objects. - * - * @param {Array} objects - The 3D objects to check for intersection with the ray. - * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. - * Otherwise it only checks intersection with the object. - * @return {Array} An array holding the intersection points. - */ - intersectObjects(objects: Array, recursive?: boolean): Array; - /** - * Checks for intersections between the model's raycaster and the given objects. The method - * updates the cursor object to the intersection point. - * - * @param {Array} objects - The 3D objects to check for intersection with the ray. - * @param {boolean} [recursive=false] - If set to `true`, it also checks all descendants. - * Otherwise it only checks intersection with the object. - */ - checkIntersections(objects: Array, recursive?: boolean): void; - /** - * Sets the cursor to the given distance. - * - * @param {number} distance - The distance to set the cursor to. - */ - setCursor(distance: number): void; -} -import { Object3D } from 'three'; -import { BufferGeometry } from 'three'; -import { Mesh } from 'three'; -import { Raycaster } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts deleted file mode 100644 index 4101f890c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/Text2D.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @module Text2D - * @three_import import * as Text2D from 'three/addons/webxr/Text2D.js'; - */ -/** - * A helper function for creating a simple plane mesh - * that can be used as a text label. The mesh's material - * holds a canvas texture that displays the given message. - * - * @param {string} message - The message to display. - * @param {number} height - The labels height. - * @return {Mesh} The plane mesh representing a text label. - */ -export function createText(message: string, height: number): Mesh; -import { Mesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts deleted file mode 100644 index 5901f3ec3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/VRButton.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * A utility class for creating a button that allows to initiate - * immersive VR sessions based on WebXR. The button can be created - * with a factory method and then appended ot the website's DOM. - * - * ```js - * document.body.appendChild( VRButton.createButton( renderer ) ); - * ``` - * - * @hideconstructor - * @three_import import { VRButton } from 'three/addons/webxr/VRButton.js'; - */ -export class VRButton { - /** - * Constructs a new VR button. - * - * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. - * @param {XRSessionInit} [sessionInit] - The a configuration object for the AR session. - * @return {HTMLElement} The button or an error message if `immersive-ar` isn't supported. - */ - static createButton(renderer: WebGLRenderer | WebGPURenderer, sessionInit?: XRSessionInit): HTMLElement; - /** - * Registers a `sessiongranted` event listener. When a session is granted, the {@link VRButton#xrSessionIsGranted} - * flag will evaluate to `true`. This method is automatically called by the module itself so there - * should be no need to use it on app level. - */ - static registerSessionGrantedListener(): void; -} -export namespace VRButton { - let xrSessionIsGranted: boolean; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts deleted file mode 100644 index 113ff7df3..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/WebGLXRFallback.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Sets up a construction-time WebGL fallback for WebGPU XR examples. - * - * @param {WebGPURenderer} renderer - The initial renderer. - * @param {Function} createFallbackRenderer - A function that returns a new renderer with a WebGL backend. - * @param {Function} onFallback - A function that installs the new renderer in the app. - */ -export function setupWebGLXRFallback(renderer: WebGPURenderer, createFallbackRenderer: Function, onFallback?: Function): void; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts deleted file mode 100644 index ad3f844b1..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRButton.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * A utility class for creating a button that allows to initiate - * immersive XR sessions based on WebXR. The button can be created - * with a factory method and then appended ot the website's DOM. - * - * ```js - * document.body.appendChild( XRButton.createButton( renderer ) ); - * ``` - * - * Compared to {@link ARButton} and {@link VRButton}, this class will - * try to offer an immersive AR session first. If the device does not - * support this type of session, it uses an immersive VR session. - * - * @hideconstructor - * @three_import import { XRButton } from 'three/addons/webxr/XRButton.js'; - */ -export class XRButton { - /** - * Constructs a new XR button. - * - * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. - * @param {XRSessionInit} [sessionInit] - The a configuration object for the AR session. - * @return {HTMLElement} The button or an error message if WebXR isn't supported. - */ - static createButton(renderer: WebGLRenderer | WebGPURenderer, sessionInit?: XRSessionInit): HTMLElement; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts deleted file mode 100644 index b4a44651c..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRControllerModelFactory.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Allows to create controller models for WebXR controllers that can be added as a visual - * representation to your scene. `XRControllerModelFactory` will automatically fetch controller - * models that match what the user is holding as closely as possible. The models should be - * attached to the object returned from getControllerGrip in order to match the orientation of - * the held device. - * - * This module depends on the [motion-controllers](https://github.com/immersive-web/webxr-input-profiles/blob/main/packages/motion-controllers/README.md) - * third-part library. - * - * ```js - * const controllerModelFactory = new XRControllerModelFactory(); - * - * const controllerGrip = renderer.xr.getControllerGrip( 0 ); - * controllerGrip.add( controllerModelFactory.createControllerModel( controllerGrip ) ); - * scene.add( controllerGrip ); - * ``` - * - * @three_import import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; - */ -export class XRControllerModelFactory { - /** - * Constructs a new XR controller model factory. - * - * @param {?GLTFLoader} [gltfLoader=null] - A glTF loader that is used to load controller models. - * @param {?Function} [onLoad=null] - A callback that is executed when a controller model has been loaded. - */ - constructor(gltfLoader?: GLTFLoader | null, onLoad?: Function | null); - /** - * A glTF loader that is used to load controller models. - * - * @type {?GLTFLoader} - * @default null - */ - gltfLoader: GLTFLoader | null; - /** - * The path to the model repository. - * - * @type {string} - */ - path: string; - _assetCache: {}; - /** - * A callback that is executed when a controller model has been loaded. - * - * @type {?Function} - * @default null - */ - onLoad: Function | null; - /** - * Sets the path to the model repository. - * - * @param {string} path - The path to set. - * @return {XRControllerModelFactory} A reference to this instance. - */ - setPath(path: string): XRControllerModelFactory; - /** - * Creates a controller model for the given WebXR controller. - * - * @param {Group} controller - The controller. - * @return {XRControllerModel} The XR controller model. - */ - createControllerModel(controller: Group): XRControllerModel; -} -import { GLTFLoader } from '../loaders/GLTFLoader.js'; -/** - * Represents a XR controller model. - * - * @augments Object3D - */ -declare class XRControllerModel extends Object3D { - /** - * The motion controller. - * - * @type {?MotionController} - * @default null - */ - motionController: MotionController | null; - /** - * The controller's environment map. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - /** - * Sets an environment map that is applied to the controller model. - * - * @param {?Texture} envMap - The environment map to apply. - * @return {XRControllerModel} A reference to this instance. - */ - setEnvironmentMap(envMap: Texture | null): XRControllerModel; -} -import { Object3D } from 'three'; -import { MotionController } from '../libs/motion-controllers.module.js'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts deleted file mode 100644 index 49e4e1b99..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/XREstimatedLight.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This class can be used to represent the environmental light of - * a XR session. It relies on the WebXR Lighting Estimation API. - * - * @augments Group - * @three_import import { XREstimatedLight } from 'three/addons/webxr/XREstimatedLight.js'; - */ -export class XREstimatedLight extends Group { - /** - * Constructs a new light. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {boolean} [environmentEstimation=true] - Whether to use environment estimation or not. - */ - constructor(renderer: WebGLRenderer, environmentEstimation?: boolean); - /** - * The light probe that represents the estimated light. - * - * @type {LightProbe} - */ - lightProbe: LightProbe; - /** - * Represents the primary light from the XR environment. - * - * @type {DirectionalLight} - */ - directionalLight: DirectionalLight; - /** - * Will be set to a cube map in the SessionLightProbe if environment estimation is - * available and requested. - * - * @type {?Texture} - * @default null - */ - environment: Texture | null; -} -import { Group } from 'three'; -import { LightProbe } from 'three'; -import { DirectionalLight } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts deleted file mode 100644 index 7cb18fa25..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandMeshModel.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Represents one of the hand model types {@link XRHandModelFactory} might produce - * depending on the selected profile. `XRHandMeshModel` represents a hand with a - * custom asset. - * - * @three_import import { XRHandMeshModel } from 'three/addons/webxr/XRHandMeshModel.js'; - */ -export class XRHandMeshModel { - /** - * Constructs a new XR hand mesh model. - * - * @param {XRHandModel} handModel - The hand model. - * @param {Group} controller - The WebXR controller. - * @param {?string} path - The model path. - * @param {XRHandedness} handedness - The handedness of the XR input source. - * @param {?Loader} [loader=null] - The loader. If not provided, an instance of `GLTFLoader` will be used to load models. - * @param {?Function} [onLoad=null] - A callback that is executed when a controller model has been loaded. - * @param {?Object} [customCache=null] - An optional shared cache object for storing and reusing loaded assets across instances. - */ - constructor(handModel: XRHandModel, controller: Group, path: string | null, handedness: XRHandedness, loader?: Loader | null, onLoad?: Function | null, customCache?: Object | null); - /** - * The WebXR controller. - * - * @type {Group} - */ - controller: Group; - /** - * The hand model. - * - * @type {XRHandModel} - */ - handModel: XRHandModel; - /** - * An array of bones representing the bones - * of the hand skeleton. - * - * @type {Array} - */ - bones: Array; - /** - * Updates the mesh based on the tracked XR joints data. - */ - updateMesh(): void; -} diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts deleted file mode 100644 index 720ee0cd7..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandModelFactory.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Similar to {@link XRControllerModelFactory}, this class allows to create hand models - * for WebXR controllers that can be added as a visual representation to your scene. - * - * ```js - * const handModelFactory = new XRHandModelFactory(); - * - * const hand = renderer.xr.getHand( 0 ); - * hand.add( handModelFactory.createHandModel( hand ) ); - * scene.add( hand ); - * ``` - * - * @three_import import { XRHandModelFactory } from 'three/addons/webxr/XRHandModelFactory.js'; - */ -export class XRHandModelFactory { - /** - * Constructs a new XR hand model factory. - * - * @param {?GLTFLoader} [gltfLoader=null] - A glTF loader that is used to load hand models. - * @param {?Function} [onLoad=null] - A callback that is executed when a hand model has been loaded. - */ - constructor(gltfLoader?: GLTFLoader | null, onLoad?: Function | null); - /** - * A glTF loader that is used to load hand models. - * - * @type {?GLTFLoader} - * @default null - */ - gltfLoader: GLTFLoader | null; - /** - * The path to the model repository. - * - * @type {?string} - * @default null - */ - path: string | null; - _assetCache: {}; - /** - * A callback that is executed when a hand model has been loaded. - * - * @type {?Function} - * @default null - */ - onLoad: Function | null; - /** - * Sets the path to the hand model repository. - * - * @param {string} path - The path to set. - * @return {XRHandModelFactory} A reference to this instance. - */ - setPath(path: string): XRHandModelFactory; - /** - * Creates a controller model for the given WebXR hand controller. - * - * @param {Group} controller - The hand controller. - * @param {('spheres'|'boxes'|'mesh')} [profile] - The model profile that defines the model type. - * @return {XRHandModel} The XR hand model. - */ - createHandModel(controller: Group, profile?: ("spheres" | "boxes" | "mesh")): XRHandModel; -} -/** - * Represents a XR hand model. - * - * @augments Object3D - */ -declare class XRHandModel extends Object3D { - /** - * Constructs a new XR hand model. - * - * @param {Group} controller - The hand controller. - */ - constructor(controller: Group); - /** - * The hand controller. - * - * @type {Group} - */ - controller: Group; - /** - * The motion controller. - * - * @type {?MotionController} - * @default null - */ - motionController: MotionController | null; - /** - * The controller's environment map. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - /** - * The model mesh. - * - * @type {Mesh} - * @default null - */ - mesh: Mesh; -} -import { Object3D } from 'three'; -export {}; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts deleted file mode 100644 index fbe6ed543..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRHandPrimitiveModel.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * ~Options - */ -export type XRHandPrimitiveModel = { - /** - * - The primitive type. - */ - primitive?: "sphere" | "box" | undefined; -}; -/** - * Represents one of the hand model types {@link XRHandModelFactory} might produce - * depending on the selected profile. `XRHandPrimitiveModel` represents a hand - * with sphere or box primitives according to the selected `primitive` option. - * - * @three_import import { XRHandPrimitiveModel } from 'three/addons/webxr/XRHandPrimitiveModel.js'; - */ -export class XRHandPrimitiveModel { - /** - * Constructs a new XR hand primitive model. - * - * @param {XRHandModel} handModel - The hand model. - * @param {Group} controller - The WebXR controller. - * @param {string} path - The model path. - * @param {XRHandedness} handedness - The handedness of the XR input source. - * @param {XRHandPrimitiveModel~Options} options - The model options. - */ - constructor(handModel: XRHandModel, controller: Group, path: string, handedness: XRHandedness, options: any); - /** - * The WebXR controller. - * - * @type {Group} - */ - controller: Group; - /** - * The hand model. - * - * @type {XRHandModel} - */ - handModel: XRHandModel; - /** - * The model's environment map. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - handMesh: InstancedMesh; - joints: string[]; - /** - * Updates the mesh based on the tracked XR joints data. - */ - updateMesh(): void; -} -import { InstancedMesh } from 'three'; diff --git a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts b/jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts deleted file mode 100644 index de818107d..000000000 --- a/jsdoc-testing/jsdoc/examples/jsm/webxr/XRPlanes.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A utility class for the WebXR Plane Detection Module. If planes - * are detected by WebXR, this class will automatically add them - * as thin box meshes to the scene when below code snippet is used. - * - * ```js - * const planes = new XRPlanes( renderer ); - * scene.add( planes ); - * ``` - * - * @augments Object3D - * @three_import import { XRPlanes } from 'three/addons/webxr/XRPlanes.js'; - */ -export class XRPlanes extends Object3D { - /** - * Constructs a new XR plane container. - * - * @param {WebGLRenderer|WebGPURenderer} renderer - The renderer. - */ - constructor(renderer: WebGLRenderer | WebGPURenderer); -} -import { Object3D } from 'three'; diff --git a/jsdoc-testing/jsdoc/src/Three.Core.d.ts b/jsdoc-testing/jsdoc/src/Three.Core.d.ts deleted file mode 100644 index b7a036bb7..000000000 --- a/jsdoc-testing/jsdoc/src/Three.Core.d.ts +++ /dev/null @@ -1,163 +0,0 @@ -export { WebGLArrayRenderTarget } from "./renderers/WebGLArrayRenderTarget.js"; -export { WebGL3DRenderTarget } from "./renderers/WebGL3DRenderTarget.js"; -export { WebGLRenderTarget } from "./renderers/WebGLRenderTarget.js"; -export { WebXRController } from "./renderers/webxr/WebXRController.js"; -export { FogExp2 } from "./scenes/FogExp2.js"; -export { Fog } from "./scenes/Fog.js"; -export { Scene } from "./scenes/Scene.js"; -export { Sprite } from "./objects/Sprite.js"; -export { LOD } from "./objects/LOD.js"; -export { SkinnedMesh } from "./objects/SkinnedMesh.js"; -export { Skeleton } from "./objects/Skeleton.js"; -export { Bone } from "./objects/Bone.js"; -export { Mesh } from "./objects/Mesh.js"; -export { InstancedMesh } from "./objects/InstancedMesh.js"; -export { BatchedMesh } from "./objects/BatchedMesh.js"; -export { LineSegments } from "./objects/LineSegments.js"; -export { LineLoop } from "./objects/LineLoop.js"; -export { Line } from "./objects/Line.js"; -export { Points } from "./objects/Points.js"; -export { Group } from "./objects/Group.js"; -export { VideoTexture } from "./textures/VideoTexture.js"; -export { VideoFrameTexture } from "./textures/VideoFrameTexture.js"; -export { FramebufferTexture } from "./textures/FramebufferTexture.js"; -export { DataTexture } from "./textures/DataTexture.js"; -export { DataArrayTexture } from "./textures/DataArrayTexture.js"; -export { Data3DTexture } from "./textures/Data3DTexture.js"; -export { CompressedTexture } from "./textures/CompressedTexture.js"; -export { CompressedArrayTexture } from "./textures/CompressedArrayTexture.js"; -export { CompressedCubeTexture } from "./textures/CompressedCubeTexture.js"; -export { CubeTexture } from "./textures/CubeTexture.js"; -export { CanvasTexture } from "./textures/CanvasTexture.js"; -export { HTMLTexture } from "./textures/HTMLTexture.js"; -export { DepthTexture } from "./textures/DepthTexture.js"; -export { CubeDepthTexture } from "./textures/CubeDepthTexture.js"; -export { ExternalTexture } from "./textures/ExternalTexture.js"; -export { Texture } from "./textures/Texture.js"; -export * from "./geometries/Geometries.js"; -export * from "./materials/Materials.js"; -export * from "./core/BufferAttribute.js"; -export * from "./extras/curves/Curves.js"; -export * from "./constants.js"; -export * from "./Three.Legacy.js"; -export { AnimationLoader } from "./loaders/AnimationLoader.js"; -export { CompressedTextureLoader } from "./loaders/CompressedTextureLoader.js"; -export { CubeTextureLoader } from "./loaders/CubeTextureLoader.js"; -export { DataTextureLoader } from "./loaders/DataTextureLoader.js"; -export { TextureLoader } from "./loaders/TextureLoader.js"; -export { ObjectLoader } from "./loaders/ObjectLoader.js"; -export { MaterialLoader } from "./loaders/MaterialLoader.js"; -export { BufferGeometryLoader } from "./loaders/BufferGeometryLoader.js"; -export { ImageLoader } from "./loaders/ImageLoader.js"; -export { ImageBitmapLoader } from "./loaders/ImageBitmapLoader.js"; -export { FileLoader } from "./loaders/FileLoader.js"; -export { Loader } from "./loaders/Loader.js"; -export { LoaderUtils } from "./loaders/LoaderUtils.js"; -export { Cache } from "./loaders/Cache.js"; -export { AudioLoader } from "./loaders/AudioLoader.js"; -export { SpotLight } from "./lights/SpotLight.js"; -export { PointLight } from "./lights/PointLight.js"; -export { RectAreaLight } from "./lights/RectAreaLight.js"; -export { HemisphereLight } from "./lights/HemisphereLight.js"; -export { SunLight } from "./lights/SunLight.js"; -export { DirectionalLight } from "./lights/DirectionalLight.js"; -export { AmbientLight } from "./lights/AmbientLight.js"; -export { Light } from "./lights/Light.js"; -export { LightProbe } from "./lights/LightProbe.js"; -export { StereoCamera } from "./cameras/StereoCamera.js"; -export { PerspectiveCamera } from "./cameras/PerspectiveCamera.js"; -export { OrthographicCamera } from "./cameras/OrthographicCamera.js"; -export { CubeCamera } from "./cameras/CubeCamera.js"; -export { ArrayCamera } from "./cameras/ArrayCamera.js"; -export { Camera } from "./cameras/Camera.js"; -export { AudioListener } from "./audio/AudioListener.js"; -export { PositionalAudio } from "./audio/PositionalAudio.js"; -export { AudioContext } from "./audio/AudioContext.js"; -export { AudioAnalyser } from "./audio/AudioAnalyser.js"; -export { Audio } from "./audio/Audio.js"; -export { VectorKeyframeTrack } from "./animation/tracks/VectorKeyframeTrack.js"; -export { StringKeyframeTrack } from "./animation/tracks/StringKeyframeTrack.js"; -export { QuaternionKeyframeTrack } from "./animation/tracks/QuaternionKeyframeTrack.js"; -export { NumberKeyframeTrack } from "./animation/tracks/NumberKeyframeTrack.js"; -export { ColorKeyframeTrack } from "./animation/tracks/ColorKeyframeTrack.js"; -export { BooleanKeyframeTrack } from "./animation/tracks/BooleanKeyframeTrack.js"; -export { PropertyMixer } from "./animation/PropertyMixer.js"; -export { PropertyBinding } from "./animation/PropertyBinding.js"; -export { KeyframeTrack } from "./animation/KeyframeTrack.js"; -export { AnimationUtils } from "./animation/AnimationUtils.js"; -export { AnimationObjectGroup } from "./animation/AnimationObjectGroup.js"; -export { AnimationMixer } from "./animation/AnimationMixer.js"; -export { AnimationClip } from "./animation/AnimationClip.js"; -export { AnimationAction } from "./animation/AnimationAction.js"; -export { RenderTarget } from "./core/RenderTarget.js"; -export { RenderTarget3D } from "./core/RenderTarget3D.js"; -export { Uniform } from "./core/Uniform.js"; -export { UniformsGroup } from "./core/UniformsGroup.js"; -export { InstancedBufferGeometry } from "./core/InstancedBufferGeometry.js"; -export { BufferGeometry } from "./core/BufferGeometry.js"; -export { InterleavedBufferAttribute } from "./core/InterleavedBufferAttribute.js"; -export { InstancedInterleavedBuffer } from "./core/InstancedInterleavedBuffer.js"; -export { InterleavedBuffer } from "./core/InterleavedBuffer.js"; -export { InstancedBufferAttribute } from "./core/InstancedBufferAttribute.js"; -export { GLBufferAttribute } from "./core/GLBufferAttribute.js"; -export { Object3D } from "./core/Object3D.js"; -export { Raycaster } from "./core/Raycaster.js"; -export { Layers } from "./core/Layers.js"; -export { EventDispatcher } from "./core/EventDispatcher.js"; -export { Clock } from "./core/Clock.js"; -export { Timer } from "./core/Timer.js"; -export { QuaternionLinearInterpolant } from "./math/interpolants/QuaternionLinearInterpolant.js"; -export { LinearInterpolant } from "./math/interpolants/LinearInterpolant.js"; -export { DiscreteInterpolant } from "./math/interpolants/DiscreteInterpolant.js"; -export { CubicInterpolant } from "./math/interpolants/CubicInterpolant.js"; -export { BezierInterpolant } from "./math/interpolants/BezierInterpolant.js"; -export { Interpolant } from "./math/Interpolant.js"; -export { Triangle } from "./math/Triangle.js"; -export { MathUtils } from "./math/MathUtils.js"; -export { Spherical } from "./math/Spherical.js"; -export { Cylindrical } from "./math/Cylindrical.js"; -export { Plane } from "./math/Plane.js"; -export { Frustum } from "./math/Frustum.js"; -export { FrustumArray } from "./math/FrustumArray.js"; -export { Sphere } from "./math/Sphere.js"; -export { Ray } from "./math/Ray.js"; -export { Matrix4 } from "./math/Matrix4.js"; -export { Matrix3 } from "./math/Matrix3.js"; -export { Matrix2 } from "./math/Matrix2.js"; -export { Box3 } from "./math/Box3.js"; -export { Box2 } from "./math/Box2.js"; -export { Line3 } from "./math/Line3.js"; -export { Euler } from "./math/Euler.js"; -export { Vector4 } from "./math/Vector4.js"; -export { Vector3 } from "./math/Vector3.js"; -export { Vector2 } from "./math/Vector2.js"; -export { Quaternion } from "./math/Quaternion.js"; -export { Color } from "./math/Color.js"; -export { ColorManagement } from "./math/ColorManagement.js"; -export { SphericalHarmonics3 } from "./math/SphericalHarmonics3.js"; -export { SpotLightHelper } from "./helpers/SpotLightHelper.js"; -export { SkeletonHelper } from "./helpers/SkeletonHelper.js"; -export { PointLightHelper } from "./helpers/PointLightHelper.js"; -export { HemisphereLightHelper } from "./helpers/HemisphereLightHelper.js"; -export { GridHelper } from "./helpers/GridHelper.js"; -export { PolarGridHelper } from "./helpers/PolarGridHelper.js"; -export { DirectionalLightHelper } from "./helpers/DirectionalLightHelper.js"; -export { CameraHelper } from "./helpers/CameraHelper.js"; -export { BoxHelper } from "./helpers/BoxHelper.js"; -export { Box3Helper } from "./helpers/Box3Helper.js"; -export { PlaneHelper } from "./helpers/PlaneHelper.js"; -export { ArrowHelper } from "./helpers/ArrowHelper.js"; -export { AxesHelper } from "./helpers/AxesHelper.js"; -export { Shape } from "./extras/core/Shape.js"; -export { Path } from "./extras/core/Path.js"; -export { ShapePath } from "./extras/core/ShapePath.js"; -export { CurvePath } from "./extras/core/CurvePath.js"; -export { Curve } from "./extras/core/Curve.js"; -export { Controls } from "./extras/Controls.js"; -export { DataUtils } from "./extras/DataUtils.js"; -export { ImageUtils } from "./extras/ImageUtils.js"; -export { ShapeUtils } from "./extras/ShapeUtils.js"; -export { TextureUtils } from "./extras/TextureUtils.js"; -export { TextureSource, Source } from "./textures/TextureSource.js"; -export { DefaultLoadingManager, LoadingManager } from "./loaders/LoadingManager.js"; -export { createCanvasElement, setConsoleFunction, getConsoleFunction, log, warn, error, warnOnce } from "./utils.js"; diff --git a/jsdoc-testing/jsdoc/src/Three.Legacy.d.ts b/jsdoc-testing/jsdoc/src/Three.Legacy.d.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/jsdoc-testing/jsdoc/src/Three.Legacy.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts b/jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts deleted file mode 100644 index a1e4e42c9..000000000 --- a/jsdoc-testing/jsdoc/src/Three.WebGPU.Nodes.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export * from "./Three.Core.js"; -export * from "./materials/nodes/NodeMaterials.js"; -export * from "./nodes/Nodes.js"; -export { default as WebGPURenderer } from "./renderers/webgpu/WebGPURenderer.Nodes.js"; -export { default as WebGPUBackend } from "./renderers/webgpu/WebGPUBackend.js"; -export { default as WebGLBackend } from "./renderers/webgl-fallback/WebGLBackend.js"; -export { default as Lighting } from "./renderers/common/Lighting.js"; -export { default as BundleGroup } from "./renderers/common/BundleGroup.js"; -export { default as QuadMesh } from "./renderers/common/QuadMesh.js"; -export { default as PMREMGenerator } from "./renderers/common/extras/PMREMGenerator.js"; -export { default as RenderPipeline } from "./renderers/common/RenderPipeline.js"; -export { default as DirectRenderPipeline } from "./renderers/common/DirectRenderPipeline.js"; -export { default as PostProcessing } from "./renderers/common/PostProcessing.js"; -export { default as ReadbackBuffer } from "./renderers/common/ReadbackBuffer.js"; -export { default as StorageTexture } from "./renderers/common/StorageTexture.js"; -export { default as StorageBufferAttribute } from "./renderers/common/StorageBufferAttribute.js"; -export { default as StorageInstancedBufferAttribute } from "./renderers/common/StorageInstancedBufferAttribute.js"; -export { default as IndirectStorageBufferAttribute } from "./renderers/common/IndirectStorageBufferAttribute.js"; -export { default as IESSpotLight } from "./lights/webgpu/IESSpotLight.js"; -export { default as ProjectorLight } from "./lights/webgpu/ProjectorLight.js"; -export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js"; -export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js"; -export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js"; -export { default as InspectorBase } from "./renderers/common/InspectorBase.js"; -export { default as CanvasTarget } from "./renderers/common/CanvasTarget.js"; -export { default as BlendMode } from "./renderers/common/BlendMode.js"; -export { ClippingGroup } from "./objects/ClippingGroup.js"; -import * as RendererUtils from './renderers/common/RendererUtils.js'; -import * as TSL from './nodes/TSL.js'; -export { RendererUtils, TSL }; diff --git a/jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts b/jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts deleted file mode 100644 index fb3edc290..000000000 --- a/jsdoc-testing/jsdoc/src/Three.WebGPU.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export * from "./Three.Core.js"; -export * from "./materials/nodes/NodeMaterials.js"; -export * from "./nodes/Nodes.js"; -export { default as WebGPURenderer } from "./renderers/webgpu/WebGPURenderer.js"; -export { default as WebGPUBackend } from "./renderers/webgpu/WebGPUBackend.js"; -export { default as WebGLBackend } from "./renderers/webgl-fallback/WebGLBackend.js"; -export { default as Renderer } from "./renderers/common/Renderer.js"; -export { default as Backend } from "./renderers/common/Backend.js"; -export { default as WebGLCapabilities } from "./renderers/webgl-fallback/utils/WebGLCapabilities.js"; -export { default as Lighting } from "./renderers/common/Lighting.js"; -export { default as BundleGroup } from "./renderers/common/BundleGroup.js"; -export { default as QuadMesh } from "./renderers/common/QuadMesh.js"; -export { default as PMREMGenerator } from "./renderers/common/extras/PMREMGenerator.js"; -export { default as RenderPipeline } from "./renderers/common/RenderPipeline.js"; -export { default as DirectRenderPipeline } from "./renderers/common/DirectRenderPipeline.js"; -export { default as PostProcessing } from "./renderers/common/PostProcessing.js"; -export { default as ReadbackBuffer } from "./renderers/common/ReadbackBuffer.js"; -export { default as CubeRenderTarget } from "./renderers/common/CubeRenderTarget.js"; -export { default as StorageTexture } from "./renderers/common/StorageTexture.js"; -export { default as Storage3DTexture } from "./renderers/common/Storage3DTexture.js"; -export { default as StorageArrayTexture } from "./renderers/common/StorageArrayTexture.js"; -export { default as StorageBufferAttribute } from "./renderers/common/StorageBufferAttribute.js"; -export { default as StorageInstancedBufferAttribute } from "./renderers/common/StorageInstancedBufferAttribute.js"; -export { default as IndirectStorageBufferAttribute } from "./renderers/common/IndirectStorageBufferAttribute.js"; -export { default as IESSpotLight } from "./lights/webgpu/IESSpotLight.js"; -export { default as ProjectorLight } from "./lights/webgpu/ProjectorLight.js"; -export { default as NodeLoader } from "./loaders/nodes/NodeLoader.js"; -export { default as NodeObjectLoader } from "./loaders/nodes/NodeObjectLoader.js"; -export { default as NodeMaterialLoader } from "./loaders/nodes/NodeMaterialLoader.js"; -export { default as InspectorBase } from "./renderers/common/InspectorBase.js"; -export { default as CanvasTarget } from "./renderers/common/CanvasTarget.js"; -export { default as BlendMode } from "./renderers/common/BlendMode.js"; -export { default as GLSLNodeBuilder } from "./renderers/webgl-fallback/nodes/GLSLNodeBuilder.js"; -export { default as BasicNodeLibrary } from "./renderers/webgpu/nodes/BasicNodeLibrary.js"; -export { default as StandardNodeLibrary } from "./renderers/webgpu/nodes/StandardNodeLibrary.js"; -export { default as WGSLNodeBuilder } from "./renderers/webgpu/nodes/WGSLNodeBuilder.js"; -export { ClippingGroup } from "./objects/ClippingGroup.js"; -import * as RendererUtils from './renderers/common/RendererUtils.js'; -import * as TSL from './nodes/TSL.js'; -export { RendererUtils, TSL }; diff --git a/jsdoc-testing/jsdoc/src/Three.d.ts b/jsdoc-testing/jsdoc/src/Three.d.ts deleted file mode 100644 index 3c8c6cd87..000000000 --- a/jsdoc-testing/jsdoc/src/Three.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from "./Three.Core.js"; -export { WebGLRenderer } from "./renderers/WebGLRenderer.js"; -export { WebGLCubeRenderTarget } from "./renderers/WebGLCubeRenderTarget.js"; -export { ShaderLib } from "./renderers/shaders/ShaderLib.js"; -export { UniformsLib } from "./renderers/shaders/UniformsLib.js"; -export { UniformsUtils } from "./renderers/shaders/UniformsUtils.js"; -export { ShaderChunk } from "./renderers/shaders/ShaderChunk.js"; -export { PMREMGenerator } from "./extras/PMREMGenerator.js"; -export { WebGLUtils } from "./renderers/webgl/WebGLUtils.js"; diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts deleted file mode 100644 index 543005806..000000000 --- a/jsdoc-testing/jsdoc/src/animation/AnimationAction.d.ts +++ /dev/null @@ -1,311 +0,0 @@ -/** - * An instance of `AnimationAction` schedules the playback of an animation which is - * stored in {@link AnimationClip}. - */ -export class AnimationAction { - /** - * Constructs a new animation action. - * - * @param {AnimationMixer} mixer - The mixer that is controlled by this action. - * @param {AnimationClip} clip - The animation clip that holds the actual keyframes. - * @param {?Object3D} [localRoot=null] - The root object on which this action is performed. - * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode. - */ - constructor(mixer: AnimationMixer, clip: AnimationClip, localRoot?: Object3D | null, blendMode?: (number | number)); - _mixer: AnimationMixer; - _clip: AnimationClip; - _localRoot: any; - /** - * Defines how the animation is blended/combined when two or more animations - * are simultaneously played. - * - * @type {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} - */ - blendMode: (number | number); - _interpolantSettings: { - endingStart: number; - endingEnd: number; - }; - _interpolants: any[]; - _propertyBindings: any[]; - _cacheIndex: any; - _byClipCacheIndex: any; - _timeScaleInterpolant: any; - _restoreTimeScale: number | null; - _weightInterpolant: any; - /** - * The loop mode, set via {@link AnimationAction#setLoop}. - * - * @type {(LoopRepeat|LoopOnce|LoopPingPong)} - * @default LoopRepeat - */ - loop: (number | number | number); - _loopCount: number; - _startTime: number | null; - /** - * The local time of this action (in seconds, starting with `0`). - * - * The value gets clamped or wrapped to `[0,clip.duration]` (according to the - * loop state). - * - * @type {number} - * @default Infinity - */ - time: number; - /** - * Scaling factor for the {@link AnimationAction#time}. A value of `0` causes the - * animation to pause. Negative values cause the animation to play backwards. - * - * @type {number} - * @default 1 - */ - timeScale: number; - _effectiveTimeScale: number; - /** - * The degree of influence of this action (in the interval `[0, 1]`). Values - * between `0` (no impact) and `1` (full impact) can be used to blend between - * several actions. - * - * @type {number} - * @default 1 - */ - weight: number; - _effectiveWeight: number; - /** - * The number of repetitions of the performed clip over the course of this action. - * Can be set via {@link AnimationAction#setLoop}. - * - * Setting this number has no effect if {@link AnimationAction#loop} is set to - * `THREE:LoopOnce`. - * - * @type {number} - * @default Infinity - */ - repetitions: number; - /** - * If set to `true`, the playback of the action is paused. - * - * @type {boolean} - * @default false - */ - paused: boolean; - /** - * If set to `false`, the action is disabled so it has no impact. - * - * When the action is re-enabled, the animation continues from its current - * time (setting `enabled` to `false` doesn't reset the action). - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * If set to true the animation will automatically be paused on its last frame. - * - * If set to false, {@link AnimationAction#enabled} will automatically be switched - * to `false` when the last loop of the action has finished, so that this action has - * no further impact. - * - * Note: This member has no impact if the action is interrupted (it - * has only an effect if its last loop has really finished). - * - * @type {boolean} - * @default false - */ - clampWhenFinished: boolean; - /** - * Enables smooth interpolation without separate clips for start, loop and end. - * - * @type {boolean} - * @default true - */ - zeroSlopeAtStart: boolean; - /** - * Enables smooth interpolation without separate clips for start, loop and end. - * - * @type {boolean} - * @default true - */ - zeroSlopeAtEnd: boolean; - /** - * Starts the playback of the animation. - * - * @return {AnimationAction} A reference to this animation action. - */ - play(): AnimationAction; - /** - * Stops the playback of the animation. - * - * @return {AnimationAction} A reference to this animation action. - */ - stop(): AnimationAction; - /** - * Resets the playback of the animation. - * - * @return {AnimationAction} A reference to this animation action. - */ - reset(): AnimationAction; - /** - * Returns `true` if the animation is running. - * - * @return {boolean} Whether the animation is running or not. - */ - isRunning(): boolean; - /** - * Returns `true` when {@link AnimationAction#play} has been called. - * - * @return {boolean} Whether the animation is scheduled or not. - */ - isScheduled(): boolean; - /** - * Defines the time when the animation should start. - * - * @param {number} time - The start time in seconds. - * @return {AnimationAction} A reference to this animation action. - */ - startAt(time: number): AnimationAction; - /** - * Configures the loop settings for this action. - * - * @param {(LoopRepeat|LoopOnce|LoopPingPong)} mode - The loop mode. - * @param {number} repetitions - The number of repetitions. - * @return {AnimationAction} A reference to this animation action. - */ - setLoop(mode: (number | number | number), repetitions: number): AnimationAction; - /** - * Sets the effective weight of this action. - * - * An action has no effect and thus an effective weight of zero when the - * action is disabled. - * - * @param {number} weight - The weight to set. - * @return {AnimationAction} A reference to this animation action. - */ - setEffectiveWeight(weight: number): AnimationAction; - /** - * Returns the effective weight of this action. - * - * @return {number} The effective weight. - */ - getEffectiveWeight(): number; - /** - * Fades the animation in by increasing its weight gradually from `0` to `1`, - * within the passed time interval. - * - * @param {number} duration - The duration of the fade. - * @return {AnimationAction} A reference to this animation action. - */ - fadeIn(duration: number): AnimationAction; - /** - * Fades the animation out by decreasing its weight gradually from `1` to `0`, - * within the passed time interval. - * - * @param {number} duration - The duration of the fade. - * @return {AnimationAction} A reference to this animation action. - */ - fadeOut(duration: number): AnimationAction; - /** - * Causes this action to fade in and the given action to fade out, - * within the passed time interval. - * - * @param {AnimationAction} fadeOutAction - The animation action to fade out. - * @param {number} duration - The duration of the fade. - * @param {boolean} [warp=false] - Whether warping should be used or not. - * @return {AnimationAction} A reference to this animation action. - */ - crossFadeFrom(fadeOutAction: AnimationAction, duration: number, warp?: boolean): AnimationAction; - /** - * Causes this action to fade out and the given action to fade in, - * within the passed time interval. - * - * @param {AnimationAction} fadeInAction - The animation action to fade in. - * @param {number} duration - The duration of the fade. - * @param {boolean} [warp=false] - Whether warping should be used or not. - * @return {AnimationAction} A reference to this animation action. - */ - crossFadeTo(fadeInAction: AnimationAction, duration: number, warp?: boolean): AnimationAction; - /** - * Stops any fading which is applied to this action. - * - * @return {AnimationAction} A reference to this animation action. - */ - stopFading(): AnimationAction; - /** - * Sets the effective time scale of this action. - * - * An action has no effect and thus an effective time scale of zero when the - * action is paused. - * - * @param {number} timeScale - The time scale to set. - * @return {AnimationAction} A reference to this animation action. - */ - setEffectiveTimeScale(timeScale: number): AnimationAction; - /** - * Returns the effective time scale of this action. - * - * @return {number} The effective time scale. - */ - getEffectiveTimeScale(): number; - /** - * Sets the duration for a single loop of this action. - * - * @param {number} duration - The duration to set. - * @return {AnimationAction} A reference to this animation action. - */ - setDuration(duration: number): AnimationAction; - /** - * Synchronizes this action with the passed other action. - * - * @param {AnimationAction} action - The action to sync with. - * @return {AnimationAction} A reference to this animation action. - */ - syncWith(action: AnimationAction): AnimationAction; - /** - * Decelerates this animation's speed to `0` within the passed time interval. - * - * @param {number} duration - The duration. - * @return {AnimationAction} A reference to this animation action. - */ - halt(duration: number): AnimationAction; - /** - * Changes the playback speed, within the passed time interval, by modifying - * {@link AnimationAction#timeScale} gradually from `startTimeScale` to - * `endTimeScale`. - * - * @param {number} startTimeScale - The start time scale. - * @param {number} endTimeScale - The end time scale. - * @param {number} duration - The duration. - * @return {AnimationAction} A reference to this animation action. - */ - warp(startTimeScale: number, endTimeScale: number, duration: number): AnimationAction; - /** - * Stops any scheduled warping which is applied to this action. - * - * @return {AnimationAction} A reference to this animation action. - */ - stopWarping(): AnimationAction; - /** - * Returns the animation mixer of this animation action. - * - * @return {AnimationMixer} The animation mixer. - */ - getMixer(): AnimationMixer; - /** - * Returns the animation clip of this animation action. - * - * @return {AnimationClip} The animation clip. - */ - getClip(): AnimationClip; - /** - * Returns the root object of this animation action. - * - * @return {Object3D} The root object. - */ - getRoot(): Object3D; - _update(time: any, deltaTime: any, timeDirection: any, accuIndex: any): void; - _updateWeight(time: any): number; - _updateTimeScale(time: any): number; - _updateTime(deltaTime: any): any; - _setEndings(atStart: any, atEnd: any, pingPong: any): void; - _scheduleFading(duration: any, weightNow: any, weightThen: any): this; -} diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts deleted file mode 100644 index 23194681c..000000000 --- a/jsdoc-testing/jsdoc/src/animation/AnimationClip.d.ts +++ /dev/null @@ -1,154 +0,0 @@ -/** - * A reusable set of keyframe tracks which represent an animation. - */ -export class AnimationClip { - /** - * Factory method for creating an animation clip from the given JSON. - * - * @static - * @param {Object} json - The serialized animation clip. - * @return {AnimationClip} The new animation clip. - */ - static parse(json: Object): AnimationClip; - /** - * Serializes the given animation clip into JSON. - * - * @static - * @param {AnimationClip} clip - The animation clip to serialize. - * @return {Object} The JSON object. - */ - static toJSON(clip: AnimationClip): Object; - /** - * Returns a new animation clip from the passed morph targets array of a - * geometry, taking a name and the number of frames per second. - * - * Note: The fps parameter is required, but the animation speed can be - * overridden via {@link AnimationAction#setDuration}. - * - * @static - * @param {string} name - The name of the animation clip. - * @param {Array} morphTargetSequence - A sequence of morph targets. - * @param {number} fps - The Frames-Per-Second value. - * @param {boolean} noLoop - Whether the clip should be no loop or not. - * @return {AnimationClip} The new animation clip. - */ - static CreateFromMorphTargetSequence(name: string, morphTargetSequence: Array, fps: number, noLoop: boolean): AnimationClip; - /** - * Searches for an animation clip by name, taking as its first parameter - * either an array of clips, or a mesh or geometry that contains an - * array named "animations" property. - * - * @static - * @param {(Array|Object3D)} objectOrClipArray - The array or object to search through. - * @param {string} name - The name to search for. - * @return {?AnimationClip} The found animation clip. Returns `null` if no clip has been found. - */ - static findByName(objectOrClipArray: (Array | Object3D), name: string): AnimationClip | null; - /** - * Returns an array of new AnimationClips created from the morph target - * sequences of a geometry, trying to sort morph target names into - * animation-group-based patterns like "Walk_001, Walk_002, Run_001, Run_002...". - * - * See {@link MD2Loader#parse} as an example for how the method should be used. - * - * @static - * @param {Array} morphTargets - A sequence of morph targets. - * @param {number} fps - The Frames-Per-Second value. - * @param {boolean} noLoop - Whether the clip should be no loop or not. - * @return {Array} An array of new animation clips. - */ - static CreateClipsFromMorphTargetSequences(morphTargets: Array, fps: number, noLoop: boolean): Array; - /** - * Constructs a new animation clip. - * - * Note: Instead of instantiating an AnimationClip directly with the constructor, you can - * use the static interface of this class for creating clips. In most cases though, animation clips - * will automatically be created by loaders when importing animated 3D assets. - * - * @param {string} [name=''] - The clip's name. - * @param {number} [duration=-1] - The clip's duration in seconds. If a negative value is passed, - * the duration will be calculated from the passed keyframes. - * @param {Array} tracks - An array of keyframe tracks. - * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode=NormalAnimationBlendMode] - Defines how the animation - * is blended/combined when two or more animations are simultaneously played. - */ - constructor(name?: string, duration?: number, tracks?: Array, blendMode?: (number | AdditiveAnimationBlendMode)); - /** - * The clip's name. - * - * @type {string} - */ - name: string; - /** - * An array of keyframe tracks. - * - * @type {Array} - */ - tracks: Array; - /** - * The clip's duration in seconds. - * - * @type {number} - */ - duration: number; - /** - * Defines how the animation is blended/combined when two or more animations - * are simultaneously played. - * - * @type {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} - */ - blendMode: (number | AdditiveAnimationBlendMode); - /** - * The UUID of the animation clip. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * An object that can be used to store custom data about the animation clip. - * It should not hold references to functions as these will not be cloned. - * - * @type {Object} - */ - userData: Object; - /** - * Sets the duration of this clip to the duration of its longest keyframe track. - * - * @return {AnimationClip} A reference to this animation clip. - */ - resetDuration(): AnimationClip; - /** - * Trims all tracks to the clip's duration. - * - * @return {AnimationClip} A reference to this animation clip. - */ - trim(): AnimationClip; - /** - * Performs minimal validation on each track in the clip. Returns `true` if all - * tracks are valid. - * - * @return {boolean} Whether the clip's keyframes are valid or not. - */ - validate(): boolean; - /** - * Optimizes each track by removing equivalent sequential keys (which are - * common in morph target sequences). - * - * @return {AnimationClip} A reference to this animation clip. - */ - optimize(): AnimationClip; - /** - * Returns a new animation clip with copied values from this instance. - * - * @return {AnimationClip} A clone of this instance. - */ - clone(): AnimationClip; - /** - * Serializes this animation clip into JSON. - * - * @return {Object} The JSON object. - */ - toJSON(): Object; -} -import { KeyframeTrack } from './KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts deleted file mode 100644 index b474470e7..000000000 --- a/jsdoc-testing/jsdoc/src/animation/AnimationMixer.d.ts +++ /dev/null @@ -1,152 +0,0 @@ -/** - * `AnimationMixer` is a player for animations on a particular object in - * the scene. When multiple objects in the scene are animated independently, - * one `AnimationMixer` may be used for each object. - */ -export class AnimationMixer extends EventDispatcher { - /** - * Constructs a new animation mixer. - * - * @param {Object3D} root - The object whose animations shall be played by this mixer. - */ - constructor(root: Object3D); - _root: Object3D; - _accuIndex: number; - /** - * The global mixer time (in seconds; starting with `0` on the mixer's creation). - * - * @type {number} - * @default 0 - */ - time: number; - /** - * A scaling factor for the global time. - * - * Note: Setting this member to `0` and later back to `1` is a - * possibility to pause/unpause all actions that are controlled by this - * mixer. - * - * @type {number} - * @default 1 - */ - timeScale: number; - _bindAction(action: any, prototypeAction: any): void; - _activateAction(action: any): void; - _deactivateAction(action: any): void; - _initMemoryManager(): void; - _actions: any[] | undefined; - _nActiveActions: number | undefined; - _actionsByClip: {} | undefined; - _bindings: any[] | undefined; - _nActiveBindings: number | undefined; - _bindingsByRootAndName: {} | undefined; - _controlInterpolants: any[] | undefined; - _nActiveControlInterpolants: number | undefined; - stats: { - actions: { - readonly total: number; - readonly inUse: number | undefined; - }; - bindings: { - readonly total: number; - readonly inUse: number | undefined; - }; - controlInterpolants: { - readonly total: number; - readonly inUse: number | undefined; - }; - } | undefined; - _isActiveAction(action: any): boolean; - _addInactiveAction(action: any, clipUuid: any, rootUuid: any): void; - _removeInactiveAction(action: any): void; - _removeInactiveBindingsForAction(action: any): void; - _lendAction(action: any): void; - _takeBackAction(action: any): void; - _addInactiveBinding(binding: any, rootUuid: any, trackName: any): void; - _removeInactiveBinding(binding: any): void; - _lendBinding(binding: any): void; - _takeBackBinding(binding: any): void; - _lendControlInterpolant(): any; - _takeBackControlInterpolant(interpolant: any): void; - /** - * Returns an instance of {@link AnimationAction} for the passed clip. - * - * If an action fitting the clip and root parameters doesn't yet exist, it - * will be created by this method. Calling this method several times with the - * same clip and root parameters always returns the same action. - * - * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip. - * @param {Object3D} [optionalRoot] - An alternative root object. - * @param {(NormalAnimationBlendMode|AdditiveAnimationBlendMode)} [blendMode] - The blend mode. - * @return {?AnimationAction} The animation action. - */ - clipAction(clip: AnimationClip | string, optionalRoot?: Object3D, blendMode?: (number | AdditiveAnimationBlendMode)): AnimationAction | null; - /** - * Returns an existing animation action for the passed clip. - * - * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip. - * @param {Object3D} [optionalRoot] - An alternative root object. - * @return {?AnimationAction} The animation action. Returns `null` if no action was found. - */ - existingAction(clip: AnimationClip | string, optionalRoot?: Object3D): AnimationAction | null; - /** - * Deactivates all previously scheduled actions on this mixer. - * - * @return {AnimationMixer} A reference to this animation mixer. - */ - stopAllAction(): AnimationMixer; - /** - * Advances the global mixer time and updates the animation. - * - * This is usually done in the render loop by passing the delta - * time from {@link Clock} or {@link Timer}. - * - * @param {number} deltaTime - The delta time in seconds. - * @return {AnimationMixer} A reference to this animation mixer. - */ - update(deltaTime: number): AnimationMixer; - /** - * Sets the global mixer to a specific time and updates the animation accordingly. - * - * This is useful when you need to jump to an exact time in an animation. The - * input parameter will be scaled by {@link AnimationMixer#timeScale} - * - * @param {number} time - The time to set in seconds. - * @return {AnimationMixer} A reference to this animation mixer. - */ - setTime(time: number): AnimationMixer; - /** - * Returns this mixer's root object. - * - * @return {Object3D} The mixer's root object. - */ - getRoot(): Object3D; - /** - * Deallocates all memory resources for a clip. Before using this method make - * sure to call {@link AnimationAction#stop} for all related actions. - * - * @param {AnimationClip} clip - The clip to uncache. - */ - uncacheClip(clip: AnimationClip): void; - /** - * Deallocates all memory resources for a root object. Before using this - * method make sure to call {@link AnimationAction#stop} for all related - * actions or alternatively {@link AnimationMixer#stopAllAction} when the - * mixer operates on a single root. - * - * @param {Object3D} root - The root object to uncache. - */ - uncacheRoot(root: Object3D): void; - /** - * Deallocates all memory resources for an action. The action is identified by the - * given clip and an optional root object. Before using this method make - * sure to call {@link AnimationAction#stop} to deactivate the action. - * - * @param {AnimationClip|string} clip - An animation clip or alternatively the name of the animation clip. - * @param {Object3D} [optionalRoot] - An alternative root object. - */ - uncacheAction(clip: AnimationClip | string, optionalRoot?: Object3D): void; -} -import { EventDispatcher } from '../core/EventDispatcher.js'; -import { AnimationClip } from './AnimationClip.js'; -import { AnimationAction } from './AnimationAction.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts deleted file mode 100644 index 040c4af5c..000000000 --- a/jsdoc-testing/jsdoc/src/animation/AnimationObjectGroup.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -/** - * A group of objects that receives a shared animation state. - * - * Usage: - * - * - Add objects you would otherwise pass as 'root' to the - * constructor or the .clipAction method of AnimationMixer. - * - Instead pass this object as 'root'. - * - You can also add and remove objects later when the mixer is running. - * - * Note: - * - * - Objects of this class appear as one object to the mixer, - * so cache control of the individual objects must be done on the group. - * - * Limitation: - * - * - The animated properties must be compatible among the all objects in the group. - * - A single property can either be controlled through a target group or directly, but not both. - */ -export class AnimationObjectGroup { - /** - * Constructs a new animation group. - * - * @param {...Object3D} arguments - An arbitrary number of 3D objects that share the same animation state. - */ - constructor(...args: Object3D[]); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAnimationObjectGroup: boolean; - /** - * The UUID of the 3D object. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - _objects: any[]; - nCachedObjects_: number; - _indicesByUUID: {}; - _paths: any[]; - _parsedPaths: any[]; - _bindings: any[]; - _bindingsIndicesByPath: {}; - stats: { - objects: { - readonly total: number; - readonly inUse: number; - }; - readonly bindingsPerObject: number; - }; - /** - * Adds an arbitrary number of objects to this animation group. - * - * @param {...Object3D} arguments - The 3D objects to add. - */ - add(...args: Object3D[]): void; - /** - * Removes an arbitrary number of objects to this animation group - * - * @param {...Object3D} arguments - The 3D objects to remove. - */ - remove(...args: Object3D[]): void; - /** - * Deallocates all memory resources for the passed 3D objects of this animation group. - * - * @param {...Object3D} arguments - The 3D objects to uncache. - */ - uncache(...args: Object3D[]): void; - subscribe_(path: any, parsedPath: any): any; - unsubscribe_(path: any): void; -} diff --git a/jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts b/jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts deleted file mode 100644 index 7355fe037..000000000 --- a/jsdoc-testing/jsdoc/src/animation/AnimationUtils.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Converts an array to a specific type. - * - * @param {TypedArray|Array} array - The array to convert. - * @param {TypedArray.constructor} type - The constructor of a typed array that defines the new type. - * @return {TypedArray} The converted array. - */ -export function convertArray(array: TypedArray | any[], type: TypedArray.constructor): TypedArray; -import { isTypedArray } from '../utils.js'; -/** - * Returns an array by which times and values can be sorted. - * - * @param {Array} times - The keyframe time values. - * @return {Array} The array. - */ -export function getKeyframeOrder(times: Array): Array; -/** - * Sorts the given array by the previously computed order via `getKeyframeOrder()`. - * - * @param {Array} values - The values to sort. - * @param {number} stride - The stride. - * @param {Array} order - The sort order. - * @return {Array} The sorted values. - */ -export function sortedArray(values: Array, stride: number, order: Array): Array; -/** - * Used for parsing AOS keyframe formats. - * - * @param {Array} jsonKeys - A list of JSON keyframes. - * @param {Array} times - This array will be filled with keyframe times by this function. - * @param {Array} values - This array will be filled with keyframe values by this function. - * @param {string} valuePropertyName - The name of the property to use. - */ -export function flattenJSON(jsonKeys: Array, times: Array, values: Array, valuePropertyName: string): void; -/** - * Creates a new clip, containing only the segment of the original clip between the given frames. - * - * @param {AnimationClip} sourceClip - The values to sort. - * @param {string} name - The name of the clip. - * @param {number} startFrame - The start frame. - * @param {number} endFrame - The end frame. - * @param {number} [fps=30] - The FPS. - * @return {AnimationClip} The new sub clip. - */ -export function subclip(sourceClip: AnimationClip, name: string, startFrame: number, endFrame: number, fps?: number): AnimationClip; -/** - * Converts the keyframes of the given animation clip to an additive format. - * - * @param {AnimationClip} targetClip - The clip to make additive. - * @param {number} [referenceFrame=0] - The reference frame. - * @param {AnimationClip} [referenceClip=targetClip] - The reference clip. - * @param {number} [fps=30] - The FPS. - * @return {AnimationClip} The updated clip which is now additive. - */ -export function makeClipAdditive(targetClip: AnimationClip, referenceFrame?: number, referenceClip?: AnimationClip, fps?: number): AnimationClip; -/** - * A class with various methods to assist with animations. - * - * @hideconstructor - */ -export class AnimationUtils { - /** - * Converts an array to a specific type - * - * @static - * @param {TypedArray|Array} array - The array to convert. - * @param {TypedArray.constructor} type - The constructor of a type array. - * @return {TypedArray} The converted array - */ - static convertArray(array: TypedArray | any[], type: TypedArray.constructor): TypedArray; - /** - * Returns `true` if the given object is a typed array. - * - * @static - * @param {any} object - The object to check. - * @return {boolean} Whether the given object is a typed array. - */ - static isTypedArray(object: any): boolean; - /** - * Returns an array by which times and values can be sorted. - * - * @static - * @param {Array} times - The keyframe time values. - * @return {Array} The array. - */ - static getKeyframeOrder(times: Array): Array; - /** - * Sorts the given array by the previously computed order via `getKeyframeOrder()`. - * - * @static - * @param {Array} values - The values to sort. - * @param {number} stride - The stride. - * @param {Array} order - The sort order. - * @return {Array} The sorted values. - */ - static sortedArray(values: Array, stride: number, order: Array): Array; - /** - * Used for parsing AOS keyframe formats. - * - * @static - * @param {Array} jsonKeys - A list of JSON keyframes. - * @param {Array} times - This array will be filled with keyframe times by this method. - * @param {Array} values - This array will be filled with keyframe values by this method. - * @param {string} valuePropertyName - The name of the property to use. - */ - static flattenJSON(jsonKeys: Array, times: Array, values: Array, valuePropertyName: string): void; - /** - * Creates a new clip, containing only the segment of the original clip between the given frames. - * - * @static - * @param {AnimationClip} sourceClip - The values to sort. - * @param {string} name - The name of the clip. - * @param {number} startFrame - The start frame. - * @param {number} endFrame - The end frame. - * @param {number} [fps=30] - The FPS. - * @return {AnimationClip} The new sub clip. - */ - static subclip(sourceClip: AnimationClip, name: string, startFrame: number, endFrame: number, fps?: number): AnimationClip; - /** - * Converts the keyframes of the given animation clip to an additive format. - * - * @static - * @param {AnimationClip} targetClip - The clip to make additive. - * @param {number} [referenceFrame=0] - The reference frame. - * @param {AnimationClip} [referenceClip=targetClip] - The reference clip. - * @param {number} [fps=30] - The FPS. - * @return {AnimationClip} The updated clip which is now additive. - */ - static makeClipAdditive(targetClip: AnimationClip, referenceFrame?: number, referenceClip?: AnimationClip, fps?: number): AnimationClip; -} -export { isTypedArray }; diff --git a/jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts deleted file mode 100644 index 72239e7a2..000000000 --- a/jsdoc-testing/jsdoc/src/animation/KeyframeTrack.d.ts +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Represents a timed sequence of keyframes, which are composed of lists of - * times and related values, and which are used to animate a specific property - * of an object. - */ -export class KeyframeTrack { - /** - * Converts the keyframe track to JSON. - * - * @static - * @param {KeyframeTrack} track - The keyframe track to serialize. - * @return {Object} The serialized keyframe track as JSON. - */ - static toJSON(track: KeyframeTrack): Object; - /** - * Constructs a new keyframe track. - * - * @param {string} name - The keyframe track's name. - * @param {Array} times - A list of keyframe times. - * @param {Array} values - A list of keyframe values. - * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} [interpolation] - The interpolation type. - */ - constructor(name: string, times: Array, values: Array, interpolation?: (number | number | number | number)); - /** - * The track's name can refer to morph targets or bones or - * possibly other values within an animated object. See {@link PropertyBinding#parseTrackName} - * for the forms of strings that can be parsed for property binding. - * - * @type {string} - */ - name: string; - /** - * The keyframe times. - * - * @type {Float32Array} - */ - times: Float32Array; - /** - * The keyframe values. - * - * @type {Float32Array} - */ - values: Float32Array; - /** - * Factory method for creating a new discrete interpolant. - * - * @static - * @param {TypedArray} [result] - The result buffer. - * @return {DiscreteInterpolant} The new interpolant. - */ - InterpolantFactoryMethodDiscrete(result?: TypedArray): DiscreteInterpolant; - /** - * Factory method for creating a new linear interpolant. - * - * @static - * @param {TypedArray} [result] - The result buffer. - * @return {LinearInterpolant} The new interpolant. - */ - InterpolantFactoryMethodLinear(result?: TypedArray): LinearInterpolant; - /** - * Factory method for creating a new smooth interpolant. - * - * @static - * @param {TypedArray} [result] - The result buffer. - * @return {CubicInterpolant} The new interpolant. - */ - InterpolantFactoryMethodSmooth(result?: TypedArray): CubicInterpolant; - /** - * Factory method for creating a new Bezier interpolant. - * - * The Bezier interpolant requires tangent data to be set via the `settings` property - * on the track before creating the interpolant. The settings should contain: - * - `inTangents`: Float32Array with [time, value] pairs per keyframe per component - * - `outTangents`: Float32Array with [time, value] pairs per keyframe per component - * - * @static - * @param {TypedArray} [result] - The result buffer. - * @return {BezierInterpolant} The new interpolant. - */ - InterpolantFactoryMethodBezier(result?: TypedArray): BezierInterpolant; - /** - * Defines the interpolation factor method for this keyframe track. - * - * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} interpolation - The interpolation type. - * @return {KeyframeTrack} A reference to this keyframe track. - */ - setInterpolation(interpolation: (number | number | number | number)): KeyframeTrack; - createInterpolant: ((result?: TypedArray) => LinearInterpolant) | ((result?: TypedArray) => CubicInterpolant) | undefined; - /** - * Returns the current interpolation type. - * - * @return {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} The interpolation type. - */ - getInterpolation(): (number | number | number | number); - /** - * Returns the value size. - * - * @return {number} The value size. - */ - getValueSize(): number; - /** - * Moves all keyframes either forward or backward in time. - * - * @param {number} timeOffset - The offset to move the time values. - * @return {KeyframeTrack} A reference to this keyframe track. - */ - shift(timeOffset: number): KeyframeTrack; - /** - * Scale all keyframe times by a factor (useful for frame - seconds conversions). - * - * @param {number} timeScale - The time scale. - * @return {KeyframeTrack} A reference to this keyframe track. - */ - scale(timeScale: number): KeyframeTrack; - /** - * Removes keyframes before and after animation without changing any values within the defined time range. - * - * Note: The method does not shift around keys to the start of the track time, because for interpolated - * keys this will change their values - * - * @param {number} startTime - The start time. - * @param {number} endTime - The end time. - * @return {KeyframeTrack} A reference to this keyframe track. - */ - trim(startTime: number, endTime: number): KeyframeTrack; - /** - * Performs minimal validation on the keyframe track. Returns `true` if the values - * are valid. - * - * @return {boolean} Whether the keyframes are valid or not. - */ - validate(): boolean; - /** - * Optimizes this keyframe track by removing equivalent sequential keys (which are - * common in morph target sequences). - * - * @return {KeyframeTrack} A reference to this keyframe track. - */ - optimize(): KeyframeTrack; - /** - * Returns a new keyframe track with copied values from this instance. - * - * @return {KeyframeTrack} A clone of this instance. - */ - clone(): KeyframeTrack; - /** - * The value type name. - * - * @type {string} - * @default '' - */ - ValueTypeName: string; - /** - * The time buffer type of this keyframe track. - * - * @type {TypedArray|Array} - * @default Float32Array.constructor - */ - TimeBufferType: TypedArray | any[]; - /** - * The value buffer type of this keyframe track. - * - * @type {TypedArray|Array} - * @default Float32Array.constructor - */ - ValueBufferType: TypedArray | any[]; - /** - * The default interpolation type of this keyframe track. - * - * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth|InterpolateBezier)} - * @default InterpolateLinear - */ - DefaultInterpolation: (number | number | number | number); -} -import { DiscreteInterpolant } from '../math/interpolants/DiscreteInterpolant.js'; -import { LinearInterpolant } from '../math/interpolants/LinearInterpolant.js'; -import { CubicInterpolant } from '../math/interpolants/CubicInterpolant.js'; -import { BezierInterpolant } from '../math/interpolants/BezierInterpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts b/jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts deleted file mode 100644 index af4e99d9d..000000000 --- a/jsdoc-testing/jsdoc/src/animation/PropertyBinding.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -/** - * This holds a reference to a real property in the scene graph; used internally. - */ -export class PropertyBinding { - /** - * Factory method for creating a property binding from the given parameters. - * - * @static - * @param {Object} root - The root node. - * @param {string} path - The path. - * @param {?Object} [parsedPath] - The parsed path. - * @return {PropertyBinding|Composite} The created property binding or composite. - */ - static create(root: Object, path: string, parsedPath?: Object | null): PropertyBinding | Composite; - /** - * Replaces spaces with underscores and removes unsupported characters from - * node names, to ensure compatibility with parseTrackName(). - * - * @param {string} name - Node name to be sanitized. - * @return {string} The sanitized node name. - */ - static sanitizeNodeName(name: string): string; - /** - * Parses the given track name (an object path to an animated property) and - * returns an object with information about the path. Matches strings in the following forms: - * - * - nodeName.property - * - nodeName.property[accessor] - * - nodeName.material.property[accessor] - * - uuid.property[accessor] - * - uuid.objectName[objectIndex].propertyName[propertyIndex] - * - parentName/nodeName.property - * - parentName/parentName/nodeName.property[index] - * - .bone[Armature.DEF_cog].position - * - scene:helium_balloon_model:helium_balloon_model.position - * - * @static - * @param {string} trackName - The track name to parse. - * @return {Object} The parsed track name as an object. - */ - static parseTrackName(trackName: string): Object; - /** - * Searches for a node in the hierarchy of the given root object by the given - * node name. - * - * @static - * @param {Object} root - The root object. - * @param {string|number} nodeName - The name of the node. - * @return {?Object} The found node. Returns `null` if no object was found. - */ - static findNode(root: Object, nodeName: string | number): Object | null; - /** - * Constructs a new property binding. - * - * @param {Object} rootNode - The root node. - * @param {string} path - The path. - * @param {?Object} [parsedPath] - The parsed path. - */ - constructor(rootNode: Object, path: string, parsedPath?: Object | null); - /** - * The object path to the animated property. - * - * @type {string} - */ - path: string; - /** - * An object holding information about the path. - * - * @type {Object} - */ - parsedPath: Object; - /** - * The object owns the animated property. - * - * @type {?Object} - */ - node: Object | null; - /** - * The root node. - * - * @type {Object3D|Skeleton} - */ - rootNode: Object3D | Skeleton; - getValue: (targetArray: any, offset: any) => void; - setValue: (sourceArray: any, offset: any) => void; - _getValue_unavailable(): void; - _setValue_unavailable(): void; - _getValue_direct(buffer: any, offset: any): void; - _getValue_array(buffer: any, offset: any): void; - _getValue_arrayElement(buffer: any, offset: any): void; - _getValue_toArray(buffer: any, offset: any): void; - _setValue_direct(buffer: any, offset: any): void; - _setValue_direct_setNeedsUpdate(buffer: any, offset: any): void; - _setValue_direct_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; - _setValue_array(buffer: any, offset: any): void; - _setValue_array_setNeedsUpdate(buffer: any, offset: any): void; - _setValue_array_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; - _setValue_arrayElement(buffer: any, offset: any): void; - _setValue_arrayElement_setNeedsUpdate(buffer: any, offset: any): void; - _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; - _setValue_fromArray(buffer: any, offset: any): void; - _setValue_fromArray_setNeedsUpdate(buffer: any, offset: any): void; - _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer: any, offset: any): void; - _getValue_unbound(targetArray: any, offset: any): void; - _setValue_unbound(sourceArray: any, offset: any): void; - /** - * Creates a getter / setter pair for the property tracked by this binding. - */ - bind(): void; - targetObject: Object | null | undefined; - resolvedProperty: any; - propertyIndex: any; - propertyName: any; - /** - * Unbinds the property. - */ - unbind(): void; - BindingType: { - Direct: number; - EntireArray: number; - ArrayElement: number; - HasFromToArray: number; - }; - Versioning: { - None: number; - NeedsUpdate: number; - MatrixWorldNeedsUpdate: number; - }; - GetterByBindingType: ((buffer: any, offset: any) => void)[]; - SetterByBindingTypeAndVersioning: ((buffer: any, offset: any) => void)[][]; -} -export namespace PropertyBinding { - export { Composite }; -} -declare class Composite { - constructor(targetGroup: any, path: any, optionalParsedPath: any); - _targetGroup: any; - _bindings: any; - getValue(array: any, offset: any): void; - setValue(array: any, offset: any): void; - bind(): void; - unbind(): void; -} -export {}; diff --git a/jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts b/jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts deleted file mode 100644 index 0f715aa7b..000000000 --- a/jsdoc-testing/jsdoc/src/animation/PropertyMixer.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Buffered scene graph property that allows weighted accumulation; used internally. - */ -export class PropertyMixer { - /** - * Constructs a new property mixer. - * - * @param {PropertyBinding} binding - The property binding. - * @param {string} typeName - The keyframe track type name. - * @param {number} valueSize - The keyframe track value size. - */ - constructor(binding: PropertyBinding, typeName: string, valueSize: number); - /** - * The property binding. - * - * @type {PropertyBinding} - */ - binding: PropertyBinding; - /** - * The keyframe track value size. - * - * @type {number} - */ - valueSize: number; - buffer: any[] | Float64Array; - _workIndex: number | undefined; - _mixBufferRegion: (buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any) => void; - _mixBufferRegionAdditive: (buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any) => void; - _setIdentity: () => void; - _origIndex: number; - _addIndex: number; - /** - * Accumulated weight of the property binding. - * - * @type {number} - * @default 0 - */ - cumulativeWeight: number; - /** - * Accumulated additive weight of the property binding. - * - * @type {number} - * @default 0 - */ - cumulativeWeightAdditive: number; - /** - * Number of active keyframe tracks currently using this property binding. - * - * @type {number} - * @default 0 - */ - useCount: number; - /** - * Number of keyframe tracks referencing this property binding. - * - * @type {number} - * @default 0 - */ - referenceCount: number; - /** - * Accumulates data in the `incoming` region into `accu`. - * - * @param {number} accuIndex - The accumulation index. - * @param {number} weight - The weight. - */ - accumulate(accuIndex: number, weight: number): void; - /** - * Accumulates data in the `incoming` region into `add`. - * - * @param {number} weight - The weight. - */ - accumulateAdditive(weight: number): void; - /** - * Applies the state of `accu` to the binding when accus differ. - * - * @param {number} accuIndex - The accumulation index. - */ - apply(accuIndex: number): void; - /** - * Remembers the state of the bound property and copy it to both accus. - */ - saveOriginalState(): void; - /** - * Applies the state previously taken via {@link PropertyMixer#saveOriginalState} to the binding. - */ - restoreOriginalState(): void; - _setAdditiveIdentityNumeric(): void; - _setAdditiveIdentityQuaternion(): void; - _setAdditiveIdentityOther(): void; - _select(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; - _slerp(buffer: any, dstOffset: any, srcOffset: any, t: any): void; - _slerpAdditive(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; - _lerp(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; - _lerpAdditive(buffer: any, dstOffset: any, srcOffset: any, t: any, stride: any): void; -} diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts deleted file mode 100644 index d8e3cfd7f..000000000 --- a/jsdoc-testing/jsdoc/src/animation/tracks/BooleanKeyframeTrack.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * A track for boolean keyframe values. - * - * @augments KeyframeTrack - */ -export class BooleanKeyframeTrack extends KeyframeTrack { - /** - * Constructs a new boolean keyframe track. - * - * This keyframe track type has no `interpolation` parameter because the - * interpolation is always discrete. - * - * @param {string} name - The keyframe track's name. - * @param {Array} times - A list of keyframe times. - * @param {Array} values - A list of keyframe values. - */ - constructor(name: string, times: Array, values: Array); - /** - * The default interpolation type of this keyframe track. - * - * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} - * @default InterpolateDiscrete - */ - DefaultInterpolation: (InterpolateLinear | number | InterpolateSmooth); - InterpolantFactoryMethodLinear: any; - InterpolantFactoryMethodSmooth: any; -} -import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts deleted file mode 100644 index aa0f64d74..000000000 --- a/jsdoc-testing/jsdoc/src/animation/tracks/ColorKeyframeTrack.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * A track for color keyframe values. - * - * @augments KeyframeTrack - */ -export class ColorKeyframeTrack extends KeyframeTrack { - /** - * Constructs a new color keyframe track. - * - * @param {string} name - The keyframe track's name. - * @param {Array} times - A list of keyframe times. - * @param {Array} values - A list of keyframe values. - * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. - */ - constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); -} -import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts deleted file mode 100644 index f83c955ca..000000000 --- a/jsdoc-testing/jsdoc/src/animation/tracks/NumberKeyframeTrack.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * A track for numeric keyframe values. - * - * @augments KeyframeTrack - */ -export class NumberKeyframeTrack extends KeyframeTrack { - /** - * Constructs a new number keyframe track. - * - * @param {string} name - The keyframe track's name. - * @param {Array} times - A list of keyframe times. - * @param {Array} values - A list of keyframe values. - * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. - */ - constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); -} -import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts deleted file mode 100644 index 98e4a75e2..000000000 --- a/jsdoc-testing/jsdoc/src/animation/tracks/QuaternionKeyframeTrack.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * A track for Quaternion keyframe values. - * - * @augments KeyframeTrack - */ -export class QuaternionKeyframeTrack extends KeyframeTrack { - /** - * Constructs a new Quaternion keyframe track. - * - * @param {string} name - The keyframe track's name. - * @param {Array} times - A list of keyframe times. - * @param {Array} values - A list of keyframe values. - * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. - */ - constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); - InterpolantFactoryMethodSmooth: any; -} -import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts deleted file mode 100644 index 95c5bd155..000000000 --- a/jsdoc-testing/jsdoc/src/animation/tracks/StringKeyframeTrack.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * A track for string keyframe values. - * - * @augments KeyframeTrack - */ -export class StringKeyframeTrack extends KeyframeTrack { - /** - * Constructs a new string keyframe track. - * - * This keyframe track type has no `interpolation` parameter because the - * interpolation is always discrete. - * - * @param {string} name - The keyframe track's name. - * @param {Array} times - A list of keyframe times. - * @param {Array} values - A list of keyframe values. - */ - constructor(name: string, times: Array, values: Array); - /** - * The default interpolation type of this keyframe track. - * - * @type {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} - * @default InterpolateDiscrete - */ - DefaultInterpolation: (InterpolateLinear | number | InterpolateSmooth); - InterpolantFactoryMethodLinear: any; - InterpolantFactoryMethodSmooth: any; -} -import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts b/jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts deleted file mode 100644 index 856db2d58..000000000 --- a/jsdoc-testing/jsdoc/src/animation/tracks/VectorKeyframeTrack.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * A track for vector keyframe values. - * - * @augments KeyframeTrack - */ -export class VectorKeyframeTrack extends KeyframeTrack { - /** - * Constructs a new vector keyframe track. - * - * @param {string} name - The keyframe track's name. - * @param {Array} times - A list of keyframe times. - * @param {Array} values - A list of keyframe values. - * @param {(InterpolateLinear|InterpolateDiscrete|InterpolateSmooth)} [interpolation] - The interpolation type. - */ - constructor(name: string, times: Array, values: Array, interpolation?: (InterpolateLinear | InterpolateDiscrete | InterpolateSmooth)); -} -import { KeyframeTrack } from '../KeyframeTrack.js'; diff --git a/jsdoc-testing/jsdoc/src/audio/Audio.d.ts b/jsdoc-testing/jsdoc/src/audio/Audio.d.ts deleted file mode 100644 index 755622769..000000000 --- a/jsdoc-testing/jsdoc/src/audio/Audio.d.ts +++ /dev/null @@ -1,379 +0,0 @@ -/** - * Represents a non-positional ( global ) audio object. - * - * This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/). - * - * ```js - * // create an AudioListener and add it to the camera - * const listener = new THREE.AudioListener(); - * camera.add( listener ); - * - * // create a global audio source - * const sound = new THREE.Audio( listener ); - * - * // load a sound and set it as the Audio object's buffer - * const audioLoader = new THREE.AudioLoader(); - * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { - * sound.setBuffer( buffer ); - * sound.setLoop( true ); - * sound.setVolume( 0.5 ); - * sound.play(); - * }); - * ``` - * - * @augments Object3D - */ -export class Audio extends Object3D { - /** - * Constructs a new audio. - * - * @param {AudioListener} listener - The global audio listener. - */ - constructor(listener: AudioListener); - type: string; - /** - * The global audio listener. - * - * @type {AudioListener} - * @readonly - */ - readonly listener: AudioListener; - /** - * The audio context. - * - * @type {AudioContext} - * @readonly - */ - readonly context: AudioContext; - /** - * The gain node used for volume control. - * - * @type {GainNode} - * @readonly - */ - readonly gain: GainNode; - /** - * Whether to start playback automatically or not. - * - * @type {boolean} - * @default false - */ - autoplay: boolean; - /** - * A reference to an audio buffer. - * - * Defined via {@link Audio#setBuffer}. - * - * @type {?AudioBuffer} - * @default null - * @readonly - */ - readonly buffer: AudioBuffer | null; - /** - * Modify pitch, measured in cents. +/- 100 is a semitone. - * +/- 1200 is an octave. - * - * Defined via {@link Audio#setDetune}. - * - * @type {number} - * @default 0 - * @readonly - */ - readonly detune: number; - /** - * Whether the audio should loop or not. - * - * Defined via {@link Audio#setLoop}. - * - * @type {boolean} - * @default false - * @readonly - */ - readonly loop: boolean; - /** - * Defines where in the audio buffer the replay should - * start, in seconds. - * - * @type {number} - * @default 0 - */ - loopStart: number; - /** - * Defines where in the audio buffer the replay should - * stop, in seconds. - * - * @type {number} - * @default 0 - */ - loopEnd: number; - /** - * An offset to the time within the audio buffer the playback - * should begin, in seconds. - * - * @type {number} - * @default 0 - */ - offset: number; - /** - * Overrides the default duration of the audio. - * - * @type {undefined|number} - * @default undefined - */ - duration: undefined | number; - /** - * The playback speed. - * - * Defined via {@link Audio#setPlaybackRate}. - * - * @type {number} - * @readonly - * @default 1 - */ - readonly playbackRate: number; - /** - * Indicates whether the audio is playing or not. - * - * This flag will be automatically set when using {@link Audio#play}, - * {@link Audio#pause}, {@link Audio#stop}. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly isPlaying: boolean; - /** - * Indicates whether the audio playback can be controlled - * with method like {@link Audio#play} or {@link Audio#pause}. - * - * This flag will be automatically set when audio sources are - * defined. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly hasPlaybackControl: boolean; - /** - * Holds a reference to the current audio source. - * - * The property is automatically by one of the `set*()` methods. - * - * @type {?AudioNode} - * @readonly - * @default null - */ - readonly source: AudioNode | null; - /** - * Defines the source type. - * - * The property is automatically set by one of the `set*()` methods. - * - * @type {('empty'|'audioNode'|'mediaNode'|'mediaStreamNode'|'buffer')} - * @readonly - * @default 'empty' - */ - readonly sourceType: ("empty" | "audioNode" | "mediaNode" | "mediaStreamNode" | "buffer"); - _startedAt: number; - _progress: number; - _connected: boolean; - /** - * Can be used to apply a variety of low-order filters to create - * more complex sound effects e.g. via `BiquadFilterNode`. - * - * The property is automatically set by {@link Audio#setFilters}. - * - * @type {Array} - * @readonly - */ - readonly filters: Array; - /** - * Returns the output audio node. - * - * @return {GainNode} The output node. - */ - getOutput(): GainNode; - /** - * Sets the given audio node as the source of this instance. - * - * {@link Audio#sourceType} is set to `audioNode` and {@link Audio#hasPlaybackControl} to `false`. - * - * @param {AudioNode} audioNode - The audio node like an instance of `OscillatorNode`. - * @return {Audio} A reference to this instance. - */ - setNodeSource(audioNode: AudioNode): Audio; - /** - * Sets the given media element as the source of this instance. - * - * {@link Audio#sourceType} is set to `mediaNode` and {@link Audio#hasPlaybackControl} to `false`. - * - * @param {HTMLMediaElement} mediaElement - The media element. - * @return {Audio} A reference to this instance. - */ - setMediaElementSource(mediaElement: HTMLMediaElement): Audio; - /** - * Sets the given media stream as the source of this instance. - * - * {@link Audio#sourceType} is set to `mediaStreamNode` and {@link Audio#hasPlaybackControl} to `false`. - * - * @param {MediaStream} mediaStream - The media stream. - * @return {Audio} A reference to this instance. - */ - setMediaStreamSource(mediaStream: MediaStream): Audio; - /** - * Sets the given audio buffer as the source of this instance. - * - * {@link Audio#sourceType} is set to `buffer` and {@link Audio#hasPlaybackControl} to `true`. - * - * @param {AudioBuffer} audioBuffer - The audio buffer. - * @return {Audio} A reference to this instance. - */ - setBuffer(audioBuffer: AudioBuffer): Audio; - /** - * Starts the playback of the audio. - * - * Can only be used with compatible audio sources that allow playback control. - * - * @param {number} [delay=0] - The delay, in seconds, at which the audio should start playing. - * @return {Audio|undefined} A reference to this instance. - */ - play(delay?: number): Audio | undefined; - /** - * Pauses the playback of the audio. - * - * Can only be used with compatible audio sources that allow playback control. - * - * @return {Audio|undefined} A reference to this instance. - */ - pause(): Audio | undefined; - /** - * Stops the playback of the audio. - * - * Can only be used with compatible audio sources that allow playback control. - * - * @param {number} [delay=0] - The delay, in seconds, at which the audio should stop playing. - * @return {Audio|undefined} A reference to this instance. - */ - stop(delay?: number): Audio | undefined; - /** - * Connects to the audio source. This is used internally on - * initialisation and when setting / removing filters. - * - * @return {Audio} A reference to this instance. - */ - connect(): Audio; - /** - * Disconnects to the audio source. This is used internally on - * initialisation and when setting / removing filters. - * - * @return {Audio|undefined} A reference to this instance. - */ - disconnect(): Audio | undefined; - /** - * Returns the current set filters. - * - * @return {Array} The list of filters. - */ - getFilters(): Array; - /** - * Sets an array of filters and connects them with the audio source. - * - * @param {Array} [value] - A list of filters. - * @return {Audio} A reference to this instance. - */ - setFilters(value?: Array): Audio; - /** - * Defines the detuning of oscillation in cents. - * - * @param {number} value - The detuning of oscillation in cents. - * @return {Audio} A reference to this instance. - */ - setDetune(value: number): Audio; - /** - * Returns the detuning of oscillation in cents. - * - * @return {number} The detuning of oscillation in cents. - */ - getDetune(): number; - /** - * Returns the first filter in the list of filters. - * - * @return {AudioNode|undefined} The first filter in the list of filters. - */ - getFilter(): AudioNode | undefined; - /** - * Applies a single filter node to the audio. - * - * @param {AudioNode} [filter] - The filter to set. - * @return {Audio} A reference to this instance. - */ - setFilter(filter?: AudioNode): Audio; - /** - * Sets the playback rate. - * - * Can only be used with compatible audio sources that allow playback control. - * - * @param {number} [value] - The playback rate to set. - * @return {Audio|undefined} A reference to this instance. - */ - setPlaybackRate(value?: number): Audio | undefined; - /** - * Returns the current playback rate. - - * @return {number} The playback rate. - */ - getPlaybackRate(): number; - /** - * Automatically called when playback finished. - */ - onEnded(): void; - /** - * Returns the loop flag. - * - * Can only be used with compatible audio sources that allow playback control. - * - * @return {boolean} Whether the audio should loop or not. - */ - getLoop(): boolean; - /** - * Sets the loop flag. - * - * Can only be used with compatible audio sources that allow playback control. - * - * @param {boolean} value - Whether the audio should loop or not. - * @return {Audio|undefined} A reference to this instance. - */ - setLoop(value: boolean): Audio | undefined; - /** - * Sets the loop start value which defines where in the audio buffer the replay should - * start, in seconds. - * - * @param {number} value - The loop start value. - * @return {Audio} A reference to this instance. - */ - setLoopStart(value: number): Audio; - /** - * Sets the loop end value which defines where in the audio buffer the replay should - * stop, in seconds. - * - * @param {number} value - The loop end value. - * @return {Audio} A reference to this instance. - */ - setLoopEnd(value: number): Audio; - /** - * Returns the volume. - * - * @return {number} The volume. - */ - getVolume(): number; - /** - * Sets the volume. - * - * @param {number} value - The volume to set. - * @return {Audio} A reference to this instance. - */ - setVolume(value: number): Audio; - copy(source: any, recursive: any): this; - clone(recursive: any): any; -} -import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts b/jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts deleted file mode 100644 index 241498397..000000000 --- a/jsdoc-testing/jsdoc/src/audio/AudioAnalyser.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * This class can be used to analyse audio data. - * - * ```js - * // create an AudioListener and add it to the camera - * const listener = new THREE.AudioListener(); - * camera.add( listener ); - * - * // create an Audio source - * const sound = new THREE.Audio( listener ); - * - * // load a sound and set it as the Audio object's buffer - * const audioLoader = new THREE.AudioLoader(); - * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { - * sound.setBuffer( buffer ); - * sound.setLoop(true); - * sound.setVolume(0.5); - * sound.play(); - * }); - * - * // create an AudioAnalyser, passing in the sound and desired fftSize - * const analyser = new THREE.AudioAnalyser( sound, 32 ); - * - * // get the average frequency of the sound - * const data = analyser.getAverageFrequency(); - * ``` - */ -export class AudioAnalyser { - /** - * Constructs a new audio analyzer. - * - * @param {Audio} audio - The audio to analyze. - * @param {number} [fftSize=2048] - The window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data. - */ - constructor(audio: new (src?: string) => HTMLAudioElement, fftSize?: number); - /** - * The global audio listener. - * - * @type {AnalyserNode} - */ - analyser: AnalyserNode; - /** - * Holds the analyzed data. - * - * @type {Uint8Array} - */ - data: Uint8Array; - /** - * Returns an array with frequency data of the audio. - * - * Each item in the array represents the decibel value for a specific frequency. - * The frequencies are spread linearly from 0 to 1/2 of the sample rate. - * For example, for 48000 sample rate, the last item of the array will represent - * the decibel value for 24000 Hz. - * - * @return {Uint8Array} The frequency data. - */ - getFrequencyData(): Uint8Array; - /** - * Returns the average of the frequencies returned by {@link AudioAnalyser#getFrequencyData}. - * - * @return {number} The average frequency. - */ - getAverageFrequency(): number; -} diff --git a/jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts b/jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts deleted file mode 100644 index 3a4632519..000000000 --- a/jsdoc-testing/jsdoc/src/audio/AudioContext.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Manages the global audio context in the engine. - * - * @hideconstructor - */ -export class AudioContext { - /** - * Returns the global native audio context. - * - * @return {Window.AudioContext} The native audio context. - */ - static getContext(): Window.AudioContext; - /** - * Allows to set the global native audio context from outside. - * - * @param {Window.AudioContext} value - The native context to set. - */ - static setContext(value: Window.AudioContext): void; -} diff --git a/jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts b/jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts deleted file mode 100644 index c668dd516..000000000 --- a/jsdoc-testing/jsdoc/src/audio/AudioListener.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * The class represents a virtual listener of the all positional and non-positional audio effects - * in the scene. A three.js application usually creates a single listener. It is a mandatory - * constructor parameter for audios entities like {@link Audio} and {@link PositionalAudio}. - * - * In most cases, the listener object is a child of the camera. So the 3D transformation of the - * camera represents the 3D transformation of the listener. - * - * @augments Object3D - */ -export class AudioListener extends Object3D { - type: string; - /** - * The native audio context. - * - * @type {AudioContext} - * @readonly - */ - readonly context: AudioContext; - /** - * The gain node used for volume control. - * - * @type {GainNode} - * @readonly - */ - readonly gain: GainNode; - /** - * An optional filter. - * - * Defined via {@link AudioListener#setFilter}. - * - * @type {?AudioNode} - * @default null - * @readonly - */ - readonly filter: AudioNode | null; - /** - * Time delta values required for `linearRampToValueAtTime()` usage. - * - * @type {number} - * @default 0 - * @readonly - */ - readonly timeDelta: number; - _timer: Timer; - /** - * Returns the listener's input node. - * - * This method is used by other audio nodes to connect to this listener. - * - * @return {GainNode} The input node. - */ - getInput(): GainNode; - /** - * Removes the current filter from this listener. - * - * @return {AudioListener} A reference to this listener. - */ - removeFilter(): AudioListener; - /** - * Returns the current set filter. - * - * @return {?AudioNode} The filter. - */ - getFilter(): AudioNode | null; - /** - * Sets the given filter to this listener. - * - * @param {AudioNode} value - The filter to set. - * @return {AudioListener} A reference to this listener. - */ - setFilter(value: AudioNode): AudioListener; - /** - * Returns the applications master volume. - * - * @return {number} The master volume. - */ - getMasterVolume(): number; - /** - * Sets the applications master volume. This volume setting affects - * all audio nodes in the scene. - * - * @param {number} value - The master volume to set. - * @return {AudioListener} A reference to this listener. - */ - setMasterVolume(value: number): AudioListener; - updateMatrixWorld(force: any): void; -} -import { Object3D } from '../core/Object3D.js'; -import { AudioContext } from './AudioContext.js'; -import { Timer } from '../core/Timer.js'; diff --git a/jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts b/jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts deleted file mode 100644 index 03307384c..000000000 --- a/jsdoc-testing/jsdoc/src/audio/PositionalAudio.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Represents a positional audio object. - * - * ```js - * // create an AudioListener and add it to the camera - * const listener = new THREE.AudioListener(); - * camera.add( listener ); - * - * // create the PositionalAudio object (passing in the listener) - * const sound = new THREE.PositionalAudio( listener ); - * - * // load a sound and set it as the PositionalAudio object's buffer - * const audioLoader = new THREE.AudioLoader(); - * audioLoader.load( 'sounds/song.ogg', function( buffer ) { - * sound.setBuffer( buffer ); - * sound.setRefDistance( 20 ); - * sound.play(); - * }); - * - * // create an object for the sound to play from - * const sphere = new THREE.SphereGeometry( 20, 32, 16 ); - * const material = new THREE.MeshPhongMaterial( { color: 0xff2200 } ); - * const mesh = new THREE.Mesh( sphere, material ); - * scene.add( mesh ); - * - * // finally add the sound to the mesh - * mesh.add( sound ); - * - * @augments Audio - */ -export class PositionalAudio extends Audio { - /** - * The panner node represents the location, direction, and behavior of an audio - * source in 3D space. - * - * @type {PannerNode} - * @readonly - */ - readonly panner: PannerNode; - connect(): this; - disconnect(): this; - getOutput(): PannerNode; - /** - * Returns the current reference distance. - * - * @return {number} The reference distance. - */ - getRefDistance(): number; - /** - * Defines the reference distance for reducing volume as the audio source moves - * further from the listener – i.e. the distance at which the volume reduction - * starts taking effect. - * - * @param {number} value - The reference distance to set. - * @return {PositionalAudio} A reference to this instance. - */ - setRefDistance(value: number): PositionalAudio; - /** - * Returns the current rolloff factor. - * - * @return {number} The rolloff factor. - */ - getRolloffFactor(): number; - /** - * Defines how quickly the volume is reduced as the source moves away from the listener. - * - * @param {number} value - The rolloff factor. - * @return {PositionalAudio} A reference to this instance. - */ - setRolloffFactor(value: number): PositionalAudio; - /** - * Returns the current distance model. - * - * @return {('linear'|'inverse'|'exponential')} The distance model. - */ - getDistanceModel(): ("linear" | "inverse" | "exponential"); - /** - * Defines which algorithm to use to reduce the volume of the audio source - * as it moves away from the listener. - * - * Read [the spec](https://www.w3.org/TR/webaudio-1.1/#enumdef-distancemodeltype) - * for more details. - * - * @param {('linear'|'inverse'|'exponential')} value - The distance model to set. - * @return {PositionalAudio} A reference to this instance. - */ - setDistanceModel(value: ("linear" | "inverse" | "exponential")): PositionalAudio; - /** - * Returns the current max distance. - * - * @return {number} The max distance. - */ - getMaxDistance(): number; - /** - * Defines the maximum distance between the audio source and the listener, - * after which the volume is not reduced any further. - * - * This value is used only by the `linear` distance model. - * - * @param {number} value - The max distance. - * @return {PositionalAudio} A reference to this instance. - */ - setMaxDistance(value: number): PositionalAudio; - /** - * Sets the directional cone in which the audio can be listened. - * - * @param {number} coneInnerAngle - An angle, in degrees, of a cone inside of which there will be no volume reduction. - * @param {number} coneOuterAngle - An angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the `coneOuterGain` parameter. - * @param {number} coneOuterGain - The amount of volume reduction outside the cone defined by the `coneOuterAngle`. When set to `0`, no sound can be heard. - * @return {PositionalAudio} A reference to this instance. - */ - setDirectionalCone(coneInnerAngle: number, coneOuterAngle: number, coneOuterGain: number): PositionalAudio; - updateMatrixWorld(force: any): void; -} -import { Audio } from './Audio.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts deleted file mode 100644 index d1dd98d30..000000000 --- a/jsdoc-testing/jsdoc/src/cameras/ArrayCamera.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This type of camera can be used in order to efficiently render a scene with a - * predefined set of cameras. This is an important performance aspect for - * rendering VR scenes. - * - * An instance of `ArrayCamera` always has an array of sub cameras. It's mandatory - * to define for each sub camera the `viewport` property which determines the - * part of the viewport that is rendered with this camera. - * - * @augments PerspectiveCamera - */ -export class ArrayCamera extends PerspectiveCamera { - /** - * Constructs a new array camera. - * - * @param {Array} [array=[]] - An array of perspective sub cameras. - */ - constructor(array?: Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayCamera: boolean; - /** - * Whether this camera is used with multiview rendering or not. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly isMultiViewCamera: boolean; - /** - * An array of perspective sub cameras. - * - * @type {Array} - */ - cameras: Array; -} -import { PerspectiveCamera } from './PerspectiveCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/Camera.d.ts b/jsdoc-testing/jsdoc/src/cameras/Camera.d.ts deleted file mode 100644 index 67a368630..000000000 --- a/jsdoc-testing/jsdoc/src/cameras/Camera.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Abstract base class for cameras. This class should always be inherited - * when you build a new camera. - * - * @abstract - * @augments Object3D - */ -export class Camera extends Object3D { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCamera: boolean; - type: string; - /** - * The inverse of the camera's world matrix. - * - * @type {Matrix4} - */ - matrixWorldInverse: Matrix4; - /** - * The camera's projection matrix. - * - * @type {Matrix4} - */ - projectionMatrix: Matrix4; - /** - * The inverse of the camera's projection matrix. - * - * @type {Matrix4} - */ - projectionMatrixInverse: Matrix4; - /** - * The coordinate system in which the camera is used. - * - * @type {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} - */ - coordinateSystem: (number | WebGPUCoordinateSystem); - _reversedDepth: boolean; - /** - * The flag that indicates whether the camera uses a reversed depth buffer. - * - * @type {boolean} - * @default false - */ - get reversedDepth(): boolean; - copy(source: any, recursive: any): this; - updateMatrixWorld(force: any): void; - updateWorldMatrix(updateParents: any, updateChildren: any, force?: boolean): void; - clone(): any; -} -import { Object3D } from '../core/Object3D.js'; -import { Matrix4 } from '../math/Matrix4.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts deleted file mode 100644 index 28a2ba9c1..000000000 --- a/jsdoc-testing/jsdoc/src/cameras/CubeCamera.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * A special type of camera that is positioned in 3D space to render its surroundings into a - * cube render target. The render target can then be used as an environment map for rendering - * realtime reflections in your scene. - * - * ```js - * // Create cube render target - * const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 256, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } ); - * - * // Create cube camera - * const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget ); - * scene.add( cubeCamera ); - * - * // Create car - * const chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeRenderTarget.texture } ); - * const car = new THREE.Mesh( carGeometry, chromeMaterial ); - * scene.add( car ); - * - * // Update the render target cube - * car.visible = false; - * cubeCamera.position.copy( car.position ); - * cubeCamera.update( renderer, scene ); - * - * // Render the scene - * car.visible = true; - * renderer.render( scene, camera ); - * ``` - * - * @augments Object3D - */ -export class CubeCamera extends Object3D { - /** - * Constructs a new cube camera. - * - * @param {number} near - The camera's near plane. - * @param {number} far - The camera's far plane. - * @param {WebGLCubeRenderTarget} renderTarget - The cube render target. - */ - constructor(near: number, far: number, renderTarget: WebGLCubeRenderTarget); - type: string; - /** - * A reference to the cube render target. - * - * @type {WebGLCubeRenderTarget} - */ - renderTarget: WebGLCubeRenderTarget; - /** - * The current active coordinate system. - * - * @type {?(WebGLCoordinateSystem|WebGPUCoordinateSystem)} - * @default null - */ - coordinateSystem: (number | number) | null; - /** - * The current active mipmap level - * - * @type {number} - * @default 0 - */ - activeMipmapLevel: number; - /** - * Must be called when the coordinate system of the cube camera is changed. - */ - updateCoordinateSystem(): void; - /** - * Calling this method will render the given scene with the given renderer - * into the cube render target of the camera. - * - * @param {(Renderer|WebGLRenderer)} renderer - The renderer. - * @param {Scene} scene - The scene to render. - */ - update(renderer: (Renderer | WebGLRenderer), scene: Scene): void; -} -import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts deleted file mode 100644 index b6269a9b1..000000000 --- a/jsdoc-testing/jsdoc/src/cameras/OrthographicCamera.d.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Camera that uses [orthographic projection](https://en.wikipedia.org/wiki/Orthographic_projection). - * - * In this projection mode, an object's size in the rendered image stays - * constant regardless of its distance from the camera. This can be useful - * for rendering 2D scenes and UI elements, amongst other things. - * - * ```js - * const camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 ); - * scene.add( camera ); - * ``` - * - * @augments Camera - */ -export class OrthographicCamera extends Camera { - /** - * Constructs a new orthographic camera. - * - * @param {number} [left=-1] - The left plane of the camera's frustum. - * @param {number} [right=1] - The right plane of the camera's frustum. - * @param {number} [top=1] - The top plane of the camera's frustum. - * @param {number} [bottom=-1] - The bottom plane of the camera's frustum. - * @param {number} [near=0.1] - The camera's near plane. - * @param {number} [far=2000] - The camera's far plane. - */ - constructor(left?: number, right?: number, top?: number, bottom?: number, near?: number, far?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOrthographicCamera: boolean; - /** - * The zoom factor of the camera. - * - * @type {number} - * @default 1 - */ - zoom: number; - /** - * Represents the frustum window specification. This property should not be edited - * directly but via {@link PerspectiveCamera#setViewOffset} and {@link PerspectiveCamera#clearViewOffset}. - * - * @type {?Object} - * @default null - */ - view: Object | null; - /** - * The left plane of the camera's frustum. - * - * @type {number} - * @default -1 - */ - left: number; - /** - * The right plane of the camera's frustum. - * - * @type {number} - * @default 1 - */ - right: number; - /** - * The top plane of the camera's frustum. - * - * @type {number} - * @default 1 - */ - top: number; - /** - * The bottom plane of the camera's frustum. - * - * @type {number} - * @default -1 - */ - bottom: number; - /** - * The camera's near plane. The valid range is greater than `0` - * and less than the current value of {@link OrthographicCamera#far}. - * - * Note that, unlike for the {@link PerspectiveCamera}, `0` is a - * valid value for an orthographic camera's near plane. - * - * @type {number} - * @default 0.1 - */ - near: number; - /** - * The camera's far plane. Must be greater than the - * current value of {@link OrthographicCamera#near}. - * - * @type {number} - * @default 2000 - */ - far: number; - copy(source: any, recursive: any): this; - /** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * @param {number} fullWidth - The full width of multiview setup. - * @param {number} fullHeight - The full height of multiview setup. - * @param {number} x - The horizontal offset of the subcamera. - * @param {number} y - The vertical offset of the subcamera. - * @param {number} width - The width of subcamera. - * @param {number} height - The height of subcamera. - * @see {@link PerspectiveCamera#setViewOffset} - */ - setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void; - /** - * Removes the view offset from the projection matrix. - */ - clearViewOffset(): void; - /** - * Updates the camera's projection matrix. Must be called after any change of - * camera properties. - */ - updateProjectionMatrix(): void; - toJSON(meta: any): Object; -} -import { Camera } from './Camera.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts deleted file mode 100644 index 0bf274692..000000000 --- a/jsdoc-testing/jsdoc/src/cameras/PerspectiveCamera.d.ts +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Camera that uses [perspective projection](https://en.wikipedia.org/wiki/Perspective_(graphical)). - * - * This projection mode is designed to mimic the way the human eye sees. It - * is the most common projection mode used for rendering a 3D scene. - * - * ```js - * const camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 ); - * scene.add( camera ); - * ``` - * - * @augments Camera - */ -export class PerspectiveCamera extends Camera { - /** - * Constructs a new perspective camera. - * - * @param {number} [fov=50] - The vertical field of view. - * @param {number} [aspect=1] - The aspect ratio. - * @param {number} [near=0.1] - The camera's near plane. - * @param {number} [far=2000] - The camera's far plane. - */ - constructor(fov?: number, aspect?: number, near?: number, far?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPerspectiveCamera: boolean; - /** - * The vertical field of view, from bottom to top of view, - * in degrees. - * - * @type {number} - * @default 50 - */ - fov: number; - /** - * The zoom factor of the camera. - * - * @type {number} - * @default 1 - */ - zoom: number; - /** - * The camera's near plane. The valid range is greater than `0` - * and less than the current value of {@link PerspectiveCamera#far}. - * - * Note that, unlike for the {@link OrthographicCamera}, `0` is not a - * valid value for a perspective camera's near plane. - * - * @type {number} - * @default 0.1 - */ - near: number; - /** - * The camera's far plane. Must be greater than the - * current value of {@link PerspectiveCamera#near}. - * - * @type {number} - * @default 2000 - */ - far: number; - /** - * Object distance used for stereoscopy and depth-of-field effects. This - * parameter does not influence the projection matrix unless a - * {@link StereoCamera} is being used. - * - * @type {number} - * @default 10 - */ - focus: number; - /** - * The aspect ratio, usually the canvas width / canvas height. - * - * @type {number} - * @default 1 - */ - aspect: number; - /** - * Represents the frustum window specification. This property should not be edited - * directly but via {@link PerspectiveCamera#setViewOffset} and {@link PerspectiveCamera#clearViewOffset}. - * - * @type {?Object} - * @default null - */ - view: Object | null; - /** - * Film size used for the larger axis. Default is `35` (millimeters). This - * parameter does not influence the projection matrix unless {@link PerspectiveCamera#filmOffset} - * is set to a nonzero value. - * - * @type {number} - * @default 35 - */ - filmGauge: number; - /** - * Horizontal off-center offset in the same unit as {@link PerspectiveCamera#filmGauge}. - * - * @type {number} - * @default 0 - */ - filmOffset: number; - copy(source: any, recursive: any): this; - /** - * Sets the FOV by focal length in respect to the current {@link PerspectiveCamera#filmGauge}. - * - * The default film gauge is 35, so that the focal length can be specified for - * a 35mm (full frame) camera. - * - * @param {number} focalLength - Values for focal length and film gauge must have the same unit. - */ - setFocalLength(focalLength: number): void; - /** - * Returns the focal length from the current {@link PerspectiveCamera#fov} and - * {@link PerspectiveCamera#filmGauge}. - * - * @return {number} The computed focal length. - */ - getFocalLength(): number; - /** - * Returns the current vertical field of view angle in degrees considering {@link PerspectiveCamera#zoom}. - * - * @return {number} The effective FOV. - */ - getEffectiveFOV(): number; - /** - * Returns the width of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or - * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}. - * - * @return {number} The film width. - */ - getFilmWidth(): number; - /** - * Returns the height of the image on the film. If {@link PerspectiveCamera#aspect} is greater than or - * equal to one (landscape format), the result equals {@link PerspectiveCamera#filmGauge}. - * - * @return {number} The film width. - */ - getFilmHeight(): number; - /** - * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction. - * Sets `minTarget` and `maxTarget` to the coordinates of the lower-left and upper-right corners of the view rectangle. - * - * @param {number} distance - The viewing distance. - * @param {Vector2} minTarget - The lower-left corner of the view rectangle is written into this vector. - * @param {Vector2} maxTarget - The upper-right corner of the view rectangle is written into this vector. - */ - getViewBounds(distance: number, minTarget: Vector2, maxTarget: Vector2): void; - /** - * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction. - * - * @param {number} distance - The viewing distance. - * @param {Vector2} target - The target vector that is used to store result where x is width and y is height. - * @returns {Vector2} The view size. - */ - getViewSize(distance: number, target: Vector2): Vector2; - /** - * Sets an offset in a larger frustum. This is useful for multi-window or - * multi-monitor/multi-machine setups. - * - * For example, if you have 3x2 monitors and each monitor is 1920x1080 and - * the monitors are in grid like this - *``` - * +---+---+---+ - * | A | B | C | - * +---+---+---+ - * | D | E | F | - * +---+---+---+ - *``` - * then for each monitor you would call it like this: - *```js - * const w = 1920; - * const h = 1080; - * const fullWidth = w * 3; - * const fullHeight = h * 2; - * - * // --A-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); - * // --B-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); - * // --C-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); - * // --D-- - * camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); - * // --E-- - * camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); - * // --F-- - * camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); - * ``` - * - * Note there is no reason monitors have to be the same size or in a grid. - * - * @param {number} fullWidth - The full width of multiview setup. - * @param {number} fullHeight - The full height of multiview setup. - * @param {number} x - The horizontal offset of the subcamera. - * @param {number} y - The vertical offset of the subcamera. - * @param {number} width - The width of subcamera. - * @param {number} height - The height of subcamera. - */ - setViewOffset(fullWidth: number, fullHeight: number, x: number, y: number, width: number, height: number): void; - /** - * Removes the view offset from the projection matrix. - */ - clearViewOffset(): void; - /** - * Updates the camera's projection matrix. Must be called after any change of - * camera properties. - */ - updateProjectionMatrix(): void; - toJSON(meta: any): Object; -} -import { Camera } from './Camera.js'; -import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts b/jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts deleted file mode 100644 index 929bf5258..000000000 --- a/jsdoc-testing/jsdoc/src/cameras/StereoCamera.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * A special type of camera that uses two perspective cameras with - * stereoscopic projection. Can be used for rendering stereo effects - * like [3D Anaglyph](https://en.wikipedia.org/wiki/Anaglyph_3D) or - * [Parallax Barrier](https://en.wikipedia.org/wiki/parallax_barrier). - */ -export class StereoCamera { - /** - * The type property is used for detecting the object type - * in context of serialization/deserialization. - * - * @type {string} - * @readonly - */ - readonly type: string; - /** - * The aspect. - * - * @type {number} - * @default 1 - */ - aspect: number; - /** - * The eye separation which represents the distance - * between the left and right camera. - * - * @type {number} - * @default 0.064 - */ - eyeSep: number; - /** - * The camera representing the left eye. This is added to layer `1` so objects to be - * rendered by the left camera must also be added to this layer. - * - * @type {PerspectiveCamera} - */ - cameraL: PerspectiveCamera; - /** - * The camera representing the right eye. This is added to layer `2` so objects to be - * rendered by the right camera must also be added to this layer. - * - * @type {PerspectiveCamera} - */ - cameraR: PerspectiveCamera; - _cache: { - focus: null; - fov: null; - aspect: null; - near: null; - far: null; - zoom: null; - eyeSep: null; - }; - /** - * Updates the stereo camera based on the given perspective camera. - * - * @param {PerspectiveCamera} camera - The perspective camera. - */ - update(camera: PerspectiveCamera): void; -} -import { PerspectiveCamera } from './PerspectiveCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/constants.d.ts b/jsdoc-testing/jsdoc/src/constants.d.ts deleted file mode 100644 index d5c3f9397..000000000 --- a/jsdoc-testing/jsdoc/src/constants.d.ts +++ /dev/null @@ -1,1617 +0,0 @@ -export const REVISION: "186dev"; -/** - * Represents mouse buttons and interaction types in context of controls. - * - * @type {ConstantsMouse} - * @constant - */ -export const MOUSE: ConstantsMouse; -/** - * Represents touch interaction types in context of controls. - * - * @type {ConstantsTouch} - * @constant - */ -export const TOUCH: ConstantsTouch; -/** - * Disables face culling. - * - * @type {number} - * @constant - */ -export const CullFaceNone: number; -/** - * Culls back faces. - * - * @type {number} - * @constant - */ -export const CullFaceBack: number; -/** - * Culls front faces. - * - * @type {number} - * @constant - */ -export const CullFaceFront: number; -/** - * Culls both front and back faces. - * - * @type {number} - * @constant - */ -export const CullFaceFrontBack: number; -/** - * Gives unfiltered shadow maps - fastest, but lowest quality. - * - * @type {number} - * @constant - */ -export const BasicShadowMap: number; -/** - * Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm. - * - * @type {number} - * @constant - */ -export const PCFShadowMap: number; -/** - * Filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm with - * better soft shadows especially when using low-resolution shadow maps. - * - * @type {number} - * @constant - * @deprecated since r186. Use `PCFShadowMap` instead. - */ -export const PCFSoftShadowMap: number; -/** - * Filters shadow maps using the Variance Shadow Map (VSM) algorithm. - * When using VSMShadowMap all shadow receivers will also cast shadows. - * - * @type {number} - * @constant - */ -export const VSMShadowMap: number; -/** - * Only front faces are rendered. - * - * @type {number} - * @constant - */ -export const FrontSide: number; -/** - * Only back faces are rendered. - * - * @type {number} - * @constant - */ -export const BackSide: number; -/** - * Both front and back faces are rendered. - * - * @type {number} - * @constant - */ -export const DoubleSide: number; -/** - * No blending is performed which effectively disables - * alpha transparency. - * - * @type {number} - * @constant - */ -export const NoBlending: number; -/** - * The default blending. - * - * @type {number} - * @constant - */ -export const NormalBlending: number; -/** - * Represents additive blending. - * - * @type {number} - * @constant - */ -export const AdditiveBlending: number; -/** - * Represents subtractive blending. - * - * @type {number} - * @constant - */ -export const SubtractiveBlending: number; -/** - * Represents multiply blending. - * - * @type {number} - * @constant - */ -export const MultiplyBlending: number; -/** - * Represents custom blending. - * - * @type {number} - * @constant - */ -export const CustomBlending: number; -/** - * Represents material blending. - * - * @type {number} - * @constant - */ -export const MaterialBlending: number; -/** - * A `source + destination` blending equation. - * - * @type {number} - * @constant - */ -export const AddEquation: number; -/** - * A `source - destination` blending equation. - * - * @type {number} - * @constant - */ -export const SubtractEquation: number; -/** - * A `destination - source` blending equation. - * - * @type {number} - * @constant - */ -export const ReverseSubtractEquation: number; -/** - * A blend equation that uses the minimum of source and destination. - * - * @type {number} - * @constant - */ -export const MinEquation: number; -/** - * A blend equation that uses the maximum of source and destination. - * - * @type {number} - * @constant - */ -export const MaxEquation: number; -/** - * Multiplies all colors by `0`. - * - * @type {number} - * @constant - */ -export const ZeroFactor: number; -/** - * Multiplies all colors by `1`. - * - * @type {number} - * @constant - */ -export const OneFactor: number; -/** - * Multiplies all colors by the source colors. - * - * @type {number} - * @constant - */ -export const SrcColorFactor: number; -/** - * Multiplies all colors by `1` minus each source color. - * - * @type {number} - * @constant - */ -export const OneMinusSrcColorFactor: number; -/** - * Multiplies all colors by the source alpha value. - * - * @type {number} - * @constant - */ -export const SrcAlphaFactor: number; -/** - * Multiplies all colors by 1 minus the source alpha value. - * - * @type {number} - * @constant - */ -export const OneMinusSrcAlphaFactor: number; -/** - * Multiplies all colors by the destination alpha value. - * - * @type {number} - * @constant - */ -export const DstAlphaFactor: number; -/** - * Multiplies all colors by `1` minus the destination alpha value. - * - * @type {number} - * @constant - */ -export const OneMinusDstAlphaFactor: number; -/** - * Multiplies all colors by the destination color. - * - * @type {number} - * @constant - */ -export const DstColorFactor: number; -/** - * Multiplies all colors by `1` minus each destination color. - * - * @type {number} - * @constant - */ -export const OneMinusDstColorFactor: number; -/** - * Multiplies the RGB colors by the smaller of either the source alpha - * value or the value of `1` minus the destination alpha value. The alpha - * value is multiplied by `1`. - * - * @type {number} - * @constant - */ -export const SrcAlphaSaturateFactor: number; -/** - * Multiplies all colors by a constant color. - * - * @type {number} - * @constant - */ -export const ConstantColorFactor: number; -/** - * Multiplies all colors by `1` minus a constant color. - * - * @type {number} - * @constant - */ -export const OneMinusConstantColorFactor: number; -/** - * Multiplies all colors by a constant alpha value. - * - * @type {number} - * @constant - */ -export const ConstantAlphaFactor: number; -/** - * Multiplies all colors by 1 minus a constant alpha value. - * - * @type {number} - * @constant - */ -export const OneMinusConstantAlphaFactor: number; -/** - * Never pass. - * - * @type {number} - * @constant - */ -export const NeverDepth: number; -/** - * Always pass. - * - * @type {number} - * @constant - */ -export const AlwaysDepth: number; -/** - * Pass if the incoming value is less than the depth buffer value. - * - * @type {number} - * @constant - */ -export const LessDepth: number; -/** - * Pass if the incoming value is less than or equal to the depth buffer value. - * - * @type {number} - * @constant - */ -export const LessEqualDepth: number; -/** - * Pass if the incoming value equals the depth buffer value. - * - * @type {number} - * @constant - */ -export const EqualDepth: number; -/** - * Pass if the incoming value is greater than or equal to the depth buffer value. - * - * @type {number} - * @constant - */ -export const GreaterEqualDepth: number; -/** - * Pass if the incoming value is greater than the depth buffer value. - * - * @type {number} - * @constant - */ -export const GreaterDepth: number; -/** - * Pass if the incoming value is not equal to the depth buffer value. - * - * @type {number} - * @constant - */ -export const NotEqualDepth: number; -/** - * Multiplies the environment map color with the surface color. - * - * @type {number} - * @constant - */ -export const MultiplyOperation: number; -/** - * Uses reflectivity to blend between the two colors. - * - * @type {number} - * @constant - */ -export const MixOperation: number; -/** - * Adds the two colors. - * - * @type {number} - * @constant - */ -export const AddOperation: number; -/** - * No tone mapping is applied. - * - * @type {number} - * @constant - */ -export const NoToneMapping: number; -/** - * Linear tone mapping. - * - * @type {number} - * @constant - */ -export const LinearToneMapping: number; -/** - * Reinhard tone mapping. - * - * @type {number} - * @constant - */ -export const ReinhardToneMapping: number; -/** - * Cineon tone mapping. - * - * @type {number} - * @constant - */ -export const CineonToneMapping: number; -/** - * ACES Filmic tone mapping. - * - * @type {number} - * @constant - */ -export const ACESFilmicToneMapping: number; -/** - * Custom tone mapping. - * - * Expects a custom implementation by modifying shader code of the material's fragment shader. - * - * @type {number} - * @constant - */ -export const CustomToneMapping: number; -/** - * AgX tone mapping. - * - * @type {number} - * @constant - */ -export const AgXToneMapping: number; -/** - * Neutral tone mapping. - * - * Implementation based on the Khronos 3D Commerce Group standard tone mapping. - * - * @type {number} - * @constant - */ -export const NeutralToneMapping: number; -/** - * The skinned mesh shares the same world space as the skeleton. - * - * @type {string} - * @constant - */ -export const AttachedBindMode: string; -/** - * The skinned mesh does not share the same world space as the skeleton. - * This is useful when a skeleton is shared across multiple skinned meshes. - * - * @type {string} - * @constant - */ -export const DetachedBindMode: string; -/** - * Maps textures using the geometry's UV coordinates. - * - * @type {number} - * @constant - */ -export const UVMapping: number; -/** - * Reflection mapping for cube textures. - * - * @type {number} - * @constant - */ -export const CubeReflectionMapping: number; -/** - * Refraction mapping for cube textures. - * - * @type {number} - * @constant - */ -export const CubeRefractionMapping: number; -/** - * Reflection mapping for equirectangular textures. - * - * @type {number} - * @constant - */ -export const EquirectangularReflectionMapping: number; -/** - * Refraction mapping for equirectangular textures. - * - * @type {number} - * @constant - */ -export const EquirectangularRefractionMapping: number; -/** - * Reflection mapping for PMREM textures. - * - * @type {number} - * @constant - */ -export const CubeUVReflectionMapping: number; -/** - * The texture will simply repeat to infinity. - * - * @type {number} - * @constant - */ -export const RepeatWrapping: number; -/** - * The last pixel of the texture stretches to the edge of the mesh. - * - * @type {number} - * @constant - */ -export const ClampToEdgeWrapping: number; -/** - * The texture will repeats to infinity, mirroring on each repeat. - * - * @type {number} - * @constant - */ -export const MirroredRepeatWrapping: number; -/** - * Returns the value of the texture element that is nearest (in Manhattan distance) - * to the specified texture coordinates. - * - * @type {number} - * @constant - */ -export const NearestFilter: number; -/** - * Chooses the mipmap that most closely matches the size of the pixel being textured - * and uses the `NearestFilter` criterion (the texel nearest to the center of the pixel) - * to produce a texture value. - * - * @type {number} - * @constant - */ -export const NearestMipmapNearestFilter: number; -export const NearestMipMapNearestFilter: 1004; -/** - * Chooses the two mipmaps that most closely match the size of the pixel being textured and - * uses the `NearestFilter` criterion to produce a texture value from each mipmap. - * The final texture value is a weighted average of those two values. - * - * @type {number} - * @constant - */ -export const NearestMipmapLinearFilter: number; -export const NearestMipMapLinearFilter: 1005; -/** - * Returns the weighted average of the four texture elements that are closest to the specified - * texture coordinates, and can include items wrapped or repeated from other parts of a texture, - * depending on the values of `wrapS` and `wrapT`, and on the exact mapping. - * - * @type {number} - * @constant - */ -export const LinearFilter: number; -/** - * Chooses the mipmap that most closely matches the size of the pixel being textured and uses - * the `LinearFilter` criterion (a weighted average of the four texels that are closest to the - * center of the pixel) to produce a texture value. - * - * @type {number} - * @constant - */ -export const LinearMipmapNearestFilter: number; -export const LinearMipMapNearestFilter: 1007; -/** - * Chooses the two mipmaps that most closely match the size of the pixel being textured and uses - * the `LinearFilter` criterion to produce a texture value from each mipmap. The final texture value - * is a weighted average of those two values. - * - * @type {number} - * @constant - */ -export const LinearMipmapLinearFilter: number; -export const LinearMipMapLinearFilter: 1008; -/** - * An unsigned byte data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedByteType: number; -/** - * A byte data type for textures. - * - * @type {number} - * @constant - */ -export const ByteType: number; -/** - * A short data type for textures. - * - * @type {number} - * @constant - */ -export const ShortType: number; -/** - * An unsigned short data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedShortType: number; -/** - * An int data type for textures. - * - * @type {number} - * @constant - */ -export const IntType: number; -/** - * An unsigned int data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedIntType: number; -/** - * A float data type for textures. - * - * @type {number} - * @constant - */ -export const FloatType: number; -/** - * A half float data type for textures. - * - * @type {number} - * @constant - */ -export const HalfFloatType: number; -/** - * An unsigned short 4_4_4_4 (packed) data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedShort4444Type: number; -/** - * An unsigned short 5_5_5_1 (packed) data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedShort5551Type: number; -/** - * An unsigned int 24_8 data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedInt248Type: number; -/** - * An unsigned int 5_9_9_9 (packed) data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedInt5999Type: number; -/** - * An unsigned int 10_11_11 (packed) data type for textures. - * - * @type {number} - * @constant - */ -export const UnsignedInt101111Type: number; -/** - * Discards the red, green and blue components and reads just the alpha component. - * - * @type {number} - * @constant - */ -export const AlphaFormat: number; -/** - * Discards the alpha component and reads the red, green and blue component. - * - * @type {number} - * @constant - */ -export const RGBFormat: number; -/** - * Reads the red, green, blue and alpha components. - * - * @type {number} - * @constant - */ -export const RGBAFormat: number; -/** - * Reads each element as a single depth value, converts it to floating point, and clamps to the range `[0,1]`. - * - * @type {number} - * @constant - */ -export const DepthFormat: number; -/** - * Reads each element is a pair of depth and stencil values. The depth component of the pair is interpreted as - * in `DepthFormat`. The stencil component is interpreted based on the depth + stencil internal format. - * - * @type {number} - * @constant - */ -export const DepthStencilFormat: number; -/** - * Discards the green, blue and alpha components and reads just the red component. - * - * @type {number} - * @constant - */ -export const RedFormat: number; -/** - * Discards the green, blue and alpha components and reads just the red component. The texels are read as integers instead of floating point. - * - * @type {number} - * @constant - */ -export const RedIntegerFormat: number; -/** - * Discards the alpha, and blue components and reads the red, and green components. - * - * @type {number} - * @constant - */ -export const RGFormat: number; -/** - * Discards the alpha, and blue components and reads the red, and green components. The texels are read as integers instead of floating point. - * - * @type {number} - * @constant - */ -export const RGIntegerFormat: number; -/** - * Discards the alpha component and reads the red, green and blue component. The texels are read as integers instead of floating point. - * - * @type {number} - * @constant - */ -export const RGBIntegerFormat: number; -/** - * Reads the red, green, blue and alpha components. The texels are read as integers instead of floating point. - * - * @type {number} - * @constant - */ -export const RGBAIntegerFormat: number; -/** - * A DXT1-compressed image in an RGB image format. - * - * @type {number} - * @constant - */ -export const RGB_S3TC_DXT1_Format: number; -/** - * A DXT1-compressed image in an RGB image format with a simple on/off alpha value. - * - * @type {number} - * @constant - */ -export const RGBA_S3TC_DXT1_Format: number; -/** - * A DXT3-compressed image in an RGBA image format. Compared to a 32-bit RGBA texture, it offers 4:1 compression. - * - * @type {number} - * @constant - */ -export const RGBA_S3TC_DXT3_Format: number; -/** - * A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3 - * compression in how the alpha compression is done. - * - * @type {number} - * @constant - */ -export const RGBA_S3TC_DXT5_Format: number; -/** - * PVRTC RGB compression in 4-bit mode. One block for each 4×4 pixels. - * - * @type {number} - * @constant - */ -export const RGB_PVRTC_4BPPV1_Format: number; -/** - * PVRTC RGB compression in 2-bit mode. One block for each 8×4 pixels. - * - * @type {number} - * @constant - */ -export const RGB_PVRTC_2BPPV1_Format: number; -/** - * PVRTC RGBA compression in 4-bit mode. One block for each 4×4 pixels. - * - * @type {number} - * @constant - */ -export const RGBA_PVRTC_4BPPV1_Format: number; -/** - * PVRTC RGBA compression in 2-bit mode. One block for each 8×4 pixels. - * - * @type {number} - * @constant - */ -export const RGBA_PVRTC_2BPPV1_Format: number; -/** - * ETC1 RGB format. - * - * @type {number} - * @constant - */ -export const RGB_ETC1_Format: number; -/** - * ETC2 RGB format. - * - * @type {number} - * @constant - */ -export const RGB_ETC2_Format: number; -/** - * ETC2 RGBA format. - * - * @type {number} - * @constant - */ -export const RGBA_ETC2_EAC_Format: number; -/** - * EAC R11 UNORM format. - * - * @type {number} - * @constant - */ -export const R11_EAC_Format: number; -/** - * EAC R11 SNORM format. - * - * @type {number} - * @constant - */ -export const SIGNED_R11_EAC_Format: number; -/** - * EAC RG11 UNORM format. - * - * @type {number} - * @constant - */ -export const RG11_EAC_Format: number; -/** - * EAC RG11 SNORM format. - * - * @type {number} - * @constant - */ -export const SIGNED_RG11_EAC_Format: number; -/** - * ASTC RGBA 4x4 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_4x4_Format: number; -/** - * ASTC RGBA 5x4 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_5x4_Format: number; -/** - * ASTC RGBA 5x5 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_5x5_Format: number; -/** - * ASTC RGBA 6x5 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_6x5_Format: number; -/** - * ASTC RGBA 6x6 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_6x6_Format: number; -/** - * ASTC RGBA 8x5 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_8x5_Format: number; -/** - * ASTC RGBA 8x6 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_8x6_Format: number; -/** - * ASTC RGBA 8x8 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_8x8_Format: number; -/** - * ASTC RGBA 10x5 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_10x5_Format: number; -/** - * ASTC RGBA 10x6 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_10x6_Format: number; -/** - * ASTC RGBA 10x8 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_10x8_Format: number; -/** - * ASTC RGBA 10x10 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_10x10_Format: number; -/** - * ASTC RGBA 12x10 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_12x10_Format: number; -/** - * ASTC RGBA 12x12 format. - * - * @type {number} - * @constant - */ -export const RGBA_ASTC_12x12_Format: number; -/** - * BPTC RGBA format. - * - * @type {number} - * @constant - */ -export const RGBA_BPTC_Format: number; -/** - * BPTC Signed RGB format. - * - * @type {number} - * @constant - */ -export const RGB_BPTC_SIGNED_Format: number; -/** - * BPTC Unsigned RGB format. - * - * @type {number} - * @constant - */ -export const RGB_BPTC_UNSIGNED_Format: number; -/** - * RGTC1 Red format. - * - * @type {number} - * @constant - */ -export const RED_RGTC1_Format: number; -/** - * RGTC1 Signed Red format. - * - * @type {number} - * @constant - */ -export const SIGNED_RED_RGTC1_Format: number; -/** - * RGTC2 Red Green format. - * - * @type {number} - * @constant - */ -export const RED_GREEN_RGTC2_Format: number; -/** - * RGTC2 Signed Red Green format. - * - * @type {number} - * @constant - */ -export const SIGNED_RED_GREEN_RGTC2_Format: number; -/** - * Animations are played once. - * - * @type {number} - * @constant - */ -export const LoopOnce: number; -/** - * Animations are played with a chosen number of repetitions, each time jumping from - * the end of the clip directly to its beginning. - * - * @type {number} - * @constant - */ -export const LoopRepeat: number; -/** - * Animations are played with a chosen number of repetitions, alternately playing forward - * and backward. - * - * @type {number} - * @constant - */ -export const LoopPingPong: number; -/** - * Discrete interpolation mode for keyframe tracks. - * - * @type {number} - * @constant - */ -export const InterpolateDiscrete: number; -/** - * Linear interpolation mode for keyframe tracks. - * - * @type {number} - * @constant - */ -export const InterpolateLinear: number; -/** - * Smooth interpolation mode for keyframe tracks. - * - * @type {number} - * @constant - */ -export const InterpolateSmooth: number; -/** - * Bezier interpolation mode for keyframe tracks. - * - * Uses cubic Bezier curves with explicit 2D control points. - * Requires tangent data to be set on the track. - * - * @type {number} - * @constant - */ -export const InterpolateBezier: number; -/** - * Zero curvature ending for animations. - * - * @type {number} - * @constant - */ -export const ZeroCurvatureEnding: number; -/** - * Zero slope ending for animations. - * - * @type {number} - * @constant - */ -export const ZeroSlopeEnding: number; -/** - * Wrap around ending for animations. - * - * @type {number} - * @constant - */ -export const WrapAroundEnding: number; -/** - * Default animation blend mode. - * - * @type {number} - * @constant - */ -export const NormalAnimationBlendMode: number; -/** - * Additive animation blend mode. Can be used to layer motions on top of - * each other to build complex performances from smaller re-usable assets. - * - * @type {number} - * @constant - */ -export const AdditiveAnimationBlendMode: number; -/** - * For every three vertices draw a single triangle. - * - * @type {number} - * @constant - */ -export const TrianglesDrawMode: number; -/** - * For each vertex draw a triangle from the last three vertices. - * - * @type {number} - * @constant - */ -export const TriangleStripDrawMode: number; -/** - * For each vertex draw a triangle from the first vertex and the last two vertices. - * - * @type {number} - * @constant - */ -export const TriangleFanDrawMode: number; -/** - * The depth value is inverted (1.0 - z) for visualization purposes. - * - * @type {number} - * @constant - */ -export const BasicDepthPacking: number; -/** - * The depth value is packed into 32 bit RGBA. - * - * @type {number} - * @constant - */ -export const RGBADepthPacking: number; -/** - * The depth value is packed into 24 bit RGB. - * - * @type {number} - * @constant - */ -export const RGBDepthPacking: number; -/** - * The depth value is packed into 16 bit RG. - * - * @type {number} - * @constant - */ -export const RGDepthPacking: number; -/** - * Normal information is relative to the underlying surface. - * - * @type {number} - * @constant - */ -export const TangentSpaceNormalMap: number; -/** - * Normal information is relative to the object orientation. - * - * @type {number} - * @constant - */ -export const ObjectSpaceNormalMap: number; -/** - * No color space. - * - * @type {string} - * @constant - */ -export const NoColorSpace: string; -/** - * sRGB color space. - * - * @type {string} - * @constant - */ -export const SRGBColorSpace: string; -/** - * sRGB-linear color space. - * - * @type {string} - * @constant - */ -export const LinearSRGBColorSpace: string; -/** - * Linear transfer function. - * - * @type {string} - * @constant - */ -export const LinearTransfer: string; -/** - * sRGB transfer function. - * - * @type {string} - * @constant - */ -export const SRGBTransfer: string; -/** - * No normal map packing. - * - * @type {string} - * @constant - */ -export const NoNormalPacking: string; -/** - * Normal RG packing. - * - * @type {string} - * @constant - */ -export const NormalRGPacking: string; -/** - * Normal GA packing. - * - * @type {string} - * @constant - */ -export const NormalGAPacking: string; -/** - * Sets the stencil buffer value to `0`. - * - * @type {number} - * @constant - */ -export const ZeroStencilOp: number; -/** - * Keeps the current value. - * - * @type {number} - * @constant - */ -export const KeepStencilOp: number; -/** - * Sets the stencil buffer value to the specified reference value. - * - * @type {number} - * @constant - */ -export const ReplaceStencilOp: number; -/** - * Increments the current stencil buffer value. Clamps to the maximum representable unsigned value. - * - * @type {number} - * @constant - */ -export const IncrementStencilOp: number; -/** - * Decrements the current stencil buffer value. Clamps to `0`. - * - * @type {number} - * @constant - */ -export const DecrementStencilOp: number; -/** - * Increments the current stencil buffer value. Wraps stencil buffer value to zero when incrementing - * the maximum representable unsigned value. - * - * @type {number} - * @constant - */ -export const IncrementWrapStencilOp: number; -/** - * Decrements the current stencil buffer value. Wraps stencil buffer value to the maximum representable - * unsigned value when decrementing a stencil buffer value of `0`. - * - * @type {number} - * @constant - */ -export const DecrementWrapStencilOp: number; -/** - * Inverts the current stencil buffer value bitwise. - * - * @type {number} - * @constant - */ -export const InvertStencilOp: number; -/** - * Will never return true. - * - * @type {number} - * @constant - */ -export const NeverStencilFunc: number; -/** - * Will return true if the stencil reference value is less than the current stencil value. - * - * @type {number} - * @constant - */ -export const LessStencilFunc: number; -/** - * Will return true if the stencil reference value is equal to the current stencil value. - * - * @type {number} - * @constant - */ -export const EqualStencilFunc: number; -/** - * Will return true if the stencil reference value is less than or equal to the current stencil value. - * - * @type {number} - * @constant - */ -export const LessEqualStencilFunc: number; -/** - * Will return true if the stencil reference value is greater than the current stencil value. - * - * @type {number} - * @constant - */ -export const GreaterStencilFunc: number; -/** - * Will return true if the stencil reference value is not equal to the current stencil value. - * - * @type {number} - * @constant - */ -export const NotEqualStencilFunc: number; -/** - * Will return true if the stencil reference value is greater than or equal to the current stencil value. - * - * @type {number} - * @constant - */ -export const GreaterEqualStencilFunc: number; -/** - * Will always return true. - * - * @type {number} - * @constant - */ -export const AlwaysStencilFunc: number; -/** - * Never pass. - * - * @type {number} - * @constant - */ -export const NeverCompare: number; -/** - * Pass if the incoming value is less than the texture value. - * - * @type {number} - * @constant - */ -export const LessCompare: number; -/** - * Pass if the incoming value equals the texture value. - * - * @type {number} - * @constant - */ -export const EqualCompare: number; -/** - * Pass if the incoming value is less than or equal to the texture value. - * - * @type {number} - * @constant - */ -export const LessEqualCompare: number; -/** - * Pass if the incoming value is greater than the texture value. - * - * @type {number} - * @constant - */ -export const GreaterCompare: number; -/** - * Pass if the incoming value is not equal to the texture value. - * - * @type {number} - * @constant - */ -export const NotEqualCompare: number; -/** - * Pass if the incoming value is greater than or equal to the texture value. - * - * @type {number} - * @constant - */ -export const GreaterEqualCompare: number; -/** - * Always pass. - * - * @type {number} - * @constant - */ -export const AlwaysCompare: number; -/** - * The contents are intended to be specified once by the application, and used many - * times as the source for drawing and image specification commands. - * - * @type {number} - * @constant - */ -export const StaticDrawUsage: number; -/** - * The contents are intended to be respecified repeatedly by the application, and - * used many times as the source for drawing and image specification commands. - * - * @type {number} - * @constant - */ -export const DynamicDrawUsage: number; -/** - * The contents are intended to be specified once by the application, and used at most - * a few times as the source for drawing and image specification commands. - * - * @type {number} - * @constant - */ -export const StreamDrawUsage: number; -/** - * The contents are intended to be specified once by reading data from the 3D API, and queried - * many times by the application. - * - * @type {number} - * @constant - */ -export const StaticReadUsage: number; -/** - * The contents are intended to be respecified repeatedly by reading data from the 3D API, and queried - * many times by the application. - * - * @type {number} - * @constant - */ -export const DynamicReadUsage: number; -/** - * The contents are intended to be specified once by reading data from the 3D API, and queried at most - * a few times by the application - * - * @type {number} - * @constant - */ -export const StreamReadUsage: number; -/** - * The contents are intended to be specified once by reading data from the 3D API, and used many times as - * the source for WebGL drawing and image specification commands. - * - * @type {number} - * @constant - */ -export const StaticCopyUsage: number; -/** - * The contents are intended to be respecified repeatedly by reading data from the 3D API, and used many times - * as the source for WebGL drawing and image specification commands. - * - * @type {number} - * @constant - */ -export const DynamicCopyUsage: number; -/** - * The contents are intended to be specified once by reading data from the 3D API, and used at most a few times - * as the source for WebGL drawing and image specification commands. - * - * @type {number} - * @constant - */ -export const StreamCopyUsage: number; -/** - * GLSL 1 shader code. - * - * @type {string} - * @constant - */ -export const GLSL1: string; -/** - * GLSL 3 shader code. - * - * @type {string} - * @constant - */ -export const GLSL3: string; -/** - * WebGL coordinate system. - * - * @type {number} - * @constant - */ -export const WebGLCoordinateSystem: number; -/** - * WebGPU coordinate system. - * - * @type {number} - * @constant - */ -export const WebGPUCoordinateSystem: number; -/** - * Represents the different timestamp query types. - * - * @type {ConstantsTimestampQuery} - * @constant - */ -export const TimestampQuery: ConstantsTimestampQuery; -/** - * Represents mouse buttons and interaction types in context of controls. - * - * @type {ConstantsInterpolationSamplingType} - * @constant - */ -export const InterpolationSamplingType: ConstantsInterpolationSamplingType; -/** - * Represents the different interpolation sampling modes. - * - * @type {ConstantsInterpolationSamplingMode} - * @constant - */ -export const InterpolationSamplingMode: ConstantsInterpolationSamplingMode; -/** - * Compatibility flags for features that may not be supported across all platforms. - * - * @type {Object} - * @constant - */ -export const Compatibility: Object; -/** - * Represents the refresh types of render objects. - * - * @type {ConstantsRenderObjectRefreshType} - * @constant - */ -export const RenderObjectRefreshType: ConstantsRenderObjectRefreshType; -/** - * This type represents mouse buttons and interaction types in context of controls. - */ -export type ConstantsMouse = { - /** - * - The left mouse button. - */ - MIDDLE: number; - /** - * - The middle mouse button. - */ - LEFT: number; - /** - * - The right mouse button. - */ - RIGHT: number; - /** - * - A rotate interaction. - */ - ROTATE: number; - /** - * - A dolly interaction. - */ - DOLLY: number; - /** - * - A pan interaction. - */ - PAN: number; -}; -/** - * This type represents touch interaction types in context of controls. - */ -export type ConstantsTouch = { - /** - * - A rotate interaction. - */ - ROTATE: number; - /** - * - A pan interaction. - */ - PAN: number; - /** - * - The dolly-pan interaction. - */ - DOLLY_PAN: number; - /** - * - A dolly-rotate interaction. - */ - DOLLY_ROTATE: number; -}; -/** - * This type represents the different timestamp query types. - */ -export type ConstantsTimestampQuery = { - /** - * - A `compute` timestamp query. - */ - COMPUTE: string; - /** - * - A `render` timestamp query. - */ - RENDER: string; -}; -/** - * Represents the different interpolation sampling types. - */ -export type ConstantsInterpolationSamplingType = { - /** - * - Perspective-correct interpolation. - */ - PERSPECTIVE: string; - /** - * - Linear interpolation. - */ - LINEAR: string; - /** - * - Flat interpolation. - */ - FLAT: string; -}; -/** - * Represents the different interpolation sampling modes. - */ -export type ConstantsInterpolationSamplingMode = { - /** - * - Normal sampling mode. - */ - NORMAL: string; - /** - * - Centroid sampling mode. - */ - CENTROID: string; - /** - * - Sample-specific sampling mode. - */ - SAMPLE: string; - /** - * - Flat interpolation using the first vertex. - */ - FIRST: string; - /** - * - Flat interpolation using either vertex. - */ - EITHER: string; -}; -/** - * Represents the refresh types of render objects. - */ -export type ConstantsRenderObjectRefreshType = { - /** - * - No refresh required. - */ - NONE: number; - /** - * - Only shared uniform buffers require an update. - */ - SHARED: number; - /** - * - The render object requires a full refresh. - */ - FULL: number; -}; diff --git a/jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts deleted file mode 100644 index 577098a58..000000000 --- a/jsdoc-testing/jsdoc/src/core/BufferAttribute.d.ts +++ /dev/null @@ -1,487 +0,0 @@ -/** - * Convenient class that can be used when creating a `Float32` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Float32BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Float32Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Float32Array), itemSize: number, normalized?: boolean); -} -/** - * Convenient class that can be used when creating a `Float16` buffer attribute with - * a plain `Array` instance. - * - * This class automatically converts to and from FP16 via `Uint16Array` since `Float16Array` - * browser support is still problematic. - * - * @augments BufferAttribute - */ -export class Float16BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Uint16Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Uint16Array), itemSize: number, normalized?: boolean); - isFloat16BufferAttribute: boolean; - getX(index: any): number; - setX(index: any, x: any): this; - getY(index: any): number; - setY(index: any, y: any): this; - getZ(index: any): number; - setZ(index: any, z: any): this; - getW(index: any): number; - setW(index: any, w: any): this; - setXY(index: any, x: any, y: any): this; - setXYZ(index: any, x: any, y: any, z: any): this; - setXYZW(index: any, x: any, y: any, z: any, w: any): this; -} -/** - * Convenient class that can be used when creating a `UInt32` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Uint32BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Uint32Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Uint32Array), itemSize: number, normalized?: boolean); -} -/** - * Convenient class that can be used when creating a `Int32` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Int32BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Int32Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Int32Array), itemSize: number, normalized?: boolean); -} -/** - * Convenient class that can be used when creating a `UInt16` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Uint16BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Uint16Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Uint16Array), itemSize: number, normalized?: boolean); -} -/** - * Convenient class that can be used when creating a `Int16` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Int16BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Int16Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Int16Array), itemSize: number, normalized?: boolean); -} -/** - * Convenient class that can be used when creating a `UInt8Clamped` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Uint8ClampedBufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Uint8ClampedArray)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Uint8ClampedArray), itemSize: number, normalized?: boolean); -} -/** - * Convenient class that can be used when creating a `UInt8` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Uint8BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Uint8Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Uint8Array), itemSize: number, normalized?: boolean); -} -/** - * Convenient class that can be used when creating a `Int8` buffer attribute with - * a plain `Array` instance. - * - * @augments BufferAttribute - */ -export class Int8BufferAttribute extends BufferAttribute { - /** - * Constructs a new buffer attribute. - * - * @param {(Array|Int8Array)} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: (Array | Int8Array), itemSize: number, normalized?: boolean); -} -/** - * This class stores data for an attribute (such as vertex positions, face - * indices, normals, colors, UVs, and any custom attributes ) associated with - * a geometry, which allows for more efficient passing of data to the GPU. - * - * When working with vector-like data, the `fromBufferAttribute( attribute, index )` - * helper methods on vector and color class might be helpful. E.g. {@link Vector3#fromBufferAttribute}. - */ -export class BufferAttribute extends EventDispatcher { - /** - * Constructs a new buffer attribute. - * - * @param {TypedArray} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(array: TypedArray, itemSize: number, normalized?: boolean); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBufferAttribute: boolean; - /** - * The name of the buffer attribute. - * - * @type {string} - */ - name: string; - /** - * The array holding the attribute data. It should have `itemSize * numVertices` - * elements, where `numVertices` is the number of vertices in the associated geometry. - * - * @type {TypedArray} - */ - array: TypedArray; - /** - * The number of values of the array that should be associated with a particular vertex. - * For instance, if this attribute is storing a 3-component vector (such as a position, - * normal, or color), then the value should be `3`. - * - * @type {number} - */ - itemSize: number; - /** - * Represents the number of items this buffer attribute stores. It is internally computed - * by dividing the `array` length by the `itemSize`. - * - * @type {number} - * @readonly - */ - readonly count: number; - /** - * Applies to integer data only. Indicates how the underlying data in the buffer maps to - * the values in the GLSL code. For instance, if `array` is an instance of `UInt16Array`, - * and `normalized` is `true`, the values `0 - +65535` in the array data will be mapped to - * `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted - * to floats unmodified, i.e. `65535` becomes `65535.0f`. - * - * @type {boolean} - */ - normalized: boolean; - /** - * Defines the intended usage pattern of the data store for optimization purposes. - * - * Note: After the initial use of a buffer, its usage cannot be changed. Instead, - * instantiate a new one and set the desired usage before the next render. - * - * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} - * @default StaticDrawUsage - */ - usage: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage); - /** - * This can be used to only update some components of stored vectors (for example, just the - * component related to color). Use the `addUpdateRange()` function to add ranges to this array. - * - * @type {Array} - */ - updateRanges: Array; - /** - * Configures the bound GPU type for use in shaders. - * - * Note: this only has an effect for integer arrays and is not configurable for float arrays. - * For lower precision float types, use `Float16BufferAttribute`. - * - * @type {(FloatType|IntType)} - * @default FloatType - */ - gpuType: (number | IntType); - /** - * A version number, incremented every time the `needsUpdate` is set to `true`. - * - * @type {number} - */ - version: number; - /** - * A callback function that is executed after the renderer has transferred the attribute - * array data to the GPU. - */ - onUploadCallback(): void; - /** - * Flag to indicate that this attribute has changed and should be re-sent to - * the GPU. Set this to `true` when you modify the value of the array. - * - * @type {number} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * Sets the usage of this buffer attribute. - * - * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set. - * @return {BufferAttribute} A reference to this buffer attribute. - */ - setUsage(value: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage)): BufferAttribute; - /** - * Adds a range of data in the data array to be updated on the GPU. - * - * @param {number} start - Position at which to start update. - * @param {number} count - The number of components to update. - */ - addUpdateRange(start: number, count: number): void; - /** - * Clears the update ranges. - */ - clearUpdateRanges(): void; - /** - * Copies the values of the given buffer attribute to this instance. - * - * @param {BufferAttribute} source - The buffer attribute to copy. - * @return {BufferAttribute} A reference to this instance. - */ - copy(source: BufferAttribute): BufferAttribute; - /** - * Copies a vector from the given buffer attribute to this one. The start - * and destination position in the attribute buffers are represented by the - * given indices. - * - * @param {number} index1 - The destination index into this buffer attribute. - * @param {BufferAttribute} attribute - The buffer attribute to copy from. - * @param {number} index2 - The source index into the given buffer attribute. - * @return {BufferAttribute} A reference to this instance. - */ - copyAt(index1: number, attribute: BufferAttribute, index2: number): BufferAttribute; - /** - * Copies the given array data into this buffer attribute. - * - * @param {(TypedArray|Array)} array - The array to copy. - * @return {BufferAttribute} A reference to this instance. - */ - copyArray(array: (TypedArray | any[])): BufferAttribute; - /** - * Applies the given 3x3 matrix to the given attribute. Works with - * item size `2` and `3`. - * - * @param {Matrix3} m - The matrix to apply. - * @return {BufferAttribute} A reference to this instance. - */ - applyMatrix3(m: Matrix3): BufferAttribute; - /** - * Applies the given 4x4 matrix to the given attribute. Only works with - * item size `3`. - * - * @param {Matrix4} m - The matrix to apply. - * @return {BufferAttribute} A reference to this instance. - */ - applyMatrix4(m: Matrix4): BufferAttribute; - /** - * Applies the given 3x3 normal matrix to the given attribute. Only works with - * item size `3`. - * - * @param {Matrix3} m - The normal matrix to apply. - * @return {BufferAttribute} A reference to this instance. - */ - applyNormalMatrix(m: Matrix3): BufferAttribute; - /** - * Applies the given 4x4 matrix to the given attribute. Only works with - * item size `3` and with direction vectors. - * - * @param {Matrix4} m - The matrix to apply. - * @return {BufferAttribute} A reference to this instance. - */ - transformDirection(m: Matrix4): BufferAttribute; - /** - * Sets the given array data in the buffer attribute. - * - * @param {(TypedArray|Array)} value - The array data to set. - * @param {number} [offset=0] - The offset in this buffer attribute's array. - * @return {BufferAttribute} A reference to this instance. - */ - set(value: (TypedArray | any[]), offset?: number): BufferAttribute; - /** - * Returns the given component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} component - The component index. - * @return {number} The returned value. - */ - getComponent(index: number, component: number): number; - /** - * Sets the given value to the given component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} component - The component index. - * @param {number} value - The value to set. - * @return {BufferAttribute} A reference to this instance. - */ - setComponent(index: number, component: number, value: number): BufferAttribute; - /** - * Returns the x component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The x component. - */ - getX(index: number): number; - /** - * Sets the x component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value to set. - * @return {BufferAttribute} A reference to this instance. - */ - setX(index: number, x: number): BufferAttribute; - /** - * Returns the y component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The y component. - */ - getY(index: number): number; - /** - * Sets the y component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} y - The value to set. - * @return {BufferAttribute} A reference to this instance. - */ - setY(index: number, y: number): BufferAttribute; - /** - * Returns the z component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The z component. - */ - getZ(index: number): number; - /** - * Sets the z component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} z - The value to set. - * @return {BufferAttribute} A reference to this instance. - */ - setZ(index: number, z: number): BufferAttribute; - /** - * Returns the w component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The w component. - */ - getW(index: number): number; - /** - * Sets the w component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} w - The value to set. - * @return {BufferAttribute} A reference to this instance. - */ - setW(index: number, w: number): BufferAttribute; - /** - * Sets the x and y component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value for the x component to set. - * @param {number} y - The value for the y component to set. - * @return {BufferAttribute} A reference to this instance. - */ - setXY(index: number, x: number, y: number): BufferAttribute; - /** - * Sets the x, y and z component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value for the x component to set. - * @param {number} y - The value for the y component to set. - * @param {number} z - The value for the z component to set. - * @return {BufferAttribute} A reference to this instance. - */ - setXYZ(index: number, x: number, y: number, z: number): BufferAttribute; - /** - * Sets the x, y, z and w component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value for the x component to set. - * @param {number} y - The value for the y component to set. - * @param {number} z - The value for the z component to set. - * @param {number} w - The value for the w component to set. - * @return {BufferAttribute} A reference to this instance. - */ - setXYZW(index: number, x: number, y: number, z: number, w: number): BufferAttribute; - /** - * Sets the given callback function that is executed after the Renderer has transferred - * the attribute array data to the GPU. Can be used to perform clean-up operations after - * the upload when attribute data are not needed anymore on the CPU side. - * - * @param {Function} callback - The `onUpload()` callback. - * @return {BufferAttribute} A reference to this instance. - */ - onUpload(callback: Function): BufferAttribute; - /** - * Returns a new buffer attribute with copied values from this instance. - * - * @return {BufferAttribute} A clone of this instance. - */ - clone(): BufferAttribute; - /** - * Serializes the buffer attribute into JSON. - * - * @return {Object} A JSON object representing the serialized buffer attribute. - */ - toJSON(): Object; - /** - * Disposes of the buffer attribute. Available only in {@link WebGPURenderer}. - */ - dispose(): void; -} -import { EventDispatcher } from './EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts b/jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts deleted file mode 100644 index 9906f15d4..000000000 --- a/jsdoc-testing/jsdoc/src/core/BufferGeometry.d.ts +++ /dev/null @@ -1,403 +0,0 @@ -/** - * A representation of mesh, line, or point geometry. Includes vertex - * positions, face indices, normals, colors, UVs, and custom attributes - * within buffers, reducing the cost of passing all this data to the GPU. - * - * ```js - * const geometry = new THREE.BufferGeometry(); - * // create a simple square shape. We duplicate the top left and bottom right - * // vertices because each vertex needs to appear once per triangle. - * const vertices = new Float32Array( [ - * -1.0, -1.0, 1.0, // v0 - * 1.0, -1.0, 1.0, // v1 - * 1.0, 1.0, 1.0, // v2 - * - * 1.0, 1.0, 1.0, // v3 - * -1.0, 1.0, 1.0, // v4 - * -1.0, -1.0, 1.0 // v5 - * ] ); - * // itemSize = 3 because there are 3 values (components) per vertex - * geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) ); - * const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } ); - * const mesh = new THREE.Mesh( geometry, material ); - * ``` - * - * @augments EventDispatcher - */ -export class BufferGeometry extends EventDispatcher { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBufferGeometry: boolean; - /** - * The UUID of the geometry. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * The name of the geometry. - * - * @type {string} - */ - name: string; - type: string; - /** - * Allows for vertices to be re-used across multiple triangles; this is - * called using "indexed triangles". Each triangle is associated with the - * indices of three vertices. This attribute therefore stores the index of - * each vertex for each triangular face. If this attribute is not set, the - * renderer assumes that each three contiguous positions represent a single triangle. - * - * @type {?BufferAttribute} - * @default null - */ - index: BufferAttribute | null; - /** - * A (storage) buffer attribute which was generated with a compute shader and - * now defines indirect draw calls. - * - * Can only be used with {@link WebGPURenderer} and a WebGPU backend. - * - * @type {?BufferAttribute} - * @default null - */ - indirect: BufferAttribute | null; - /** - * The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset. - * - * Can only be used with {@link WebGPURenderer} and a WebGPU backend. - * - * @type {number|Array} - * @default 0 - */ - indirectOffset: number | Array; - /** - * This dictionary has as id the name of the attribute to be set and as value - * the buffer attribute to set it to. Rather than accessing this property directly, - * use `setAttribute()` and `getAttribute()` to access attributes of this geometry. - * - * @type {Object} - */ - attributes: { - [x: string]: any; - }; - /** - * This dictionary holds the morph targets of the geometry. - * - * Note: Once the geometry has been rendered, the morph attribute data cannot - * be changed. You will have to call `dispose()`, and create a new geometry instance. - * - * @type {Object} - */ - morphAttributes: Object; - /** - * Used to control the morph target behavior; when set to `true`, the morph - * target data is treated as relative offsets, rather than as absolute - * positions/normals. - * - * @type {boolean} - * @default false - */ - morphTargetsRelative: boolean; - /** - * Split the geometry into groups, each of which will be rendered in a - * separate draw call. This allows an array of materials to be used with the geometry. - * - * Use `addGroup()` and `clearGroups()` to edit groups, rather than modifying this array directly. - * - * Every vertex and index must belong to exactly one group — groups must not share vertices or - * indices, and must not leave vertices or indices unused. - * - * @type {Array} - */ - groups: Array; - /** - * Bounding box for the geometry which can be calculated with `computeBoundingBox()`. - * - * @type {?Box3} - * @default null - */ - boundingBox: Box3 | null; - /** - * Bounding sphere for the geometry which can be calculated with `computeBoundingSphere()`. - * - * @type {?Sphere} - * @default null - */ - boundingSphere: Sphere | null; - /** - * Determines the part of the geometry to render. This should not be set directly, - * instead use `setDrawRange()`. - * - * @type {{start:number,count:number}} - */ - drawRange: { - start: number; - count: number; - }; - /** - * An object that can be used to store custom data about the geometry. - * It should not hold references to functions as these will not be cloned. - * - * @type {Object} - */ - userData: Object; - /** - * `true` when the geometry has been transformed since construction - * (e.g. via {@link BufferGeometry#applyMatrix4}). Only relevant for - * geometry generators (subclasses that populate `parameters`): when set, - * {@link BufferGeometry#toJSON} omits `parameters` since they no longer - * describe the geometry. - * - * @private - * @type {boolean} - * @default false - */ - private _transformed; - /** - * Returns the index of this geometry. - * - * @return {?BufferAttribute} The index. Returns `null` if no index is defined. - */ - getIndex(): BufferAttribute | null; - /** - * Sets the given index to this geometry. - * - * @param {Array|BufferAttribute} index - The index to set. - * @return {BufferGeometry} A reference to this instance. - */ - setIndex(index: Array | BufferAttribute): BufferGeometry; - /** - * Sets the given indirect attribute to this geometry. - * - * @param {BufferAttribute} indirect - The attribute holding indirect draw calls. - * @param {number|Array} [indirectOffset=0] - The offset, in bytes, into the indirect drawing buffer where the value data begins. If an array is provided, multiple indirect draw calls will be made for each offset. - * @return {BufferGeometry} A reference to this instance. - */ - setIndirect(indirect: BufferAttribute, indirectOffset?: number | Array): BufferGeometry; - /** - * Returns the indirect attribute of this geometry. - * - * @return {?BufferAttribute} The indirect attribute. Returns `null` if no indirect attribute is defined. - */ - getIndirect(): BufferAttribute | null; - /** - * Returns the buffer attribute for the given name. - * - * @param {string} name - The attribute name. - * @return {BufferAttribute|InterleavedBufferAttribute|undefined} The buffer attribute. - * Returns `undefined` if not attribute has been found. - */ - getAttribute(name: string): BufferAttribute | InterleavedBufferAttribute | undefined; - /** - * Sets the given attribute for the given name. - * - * @param {string} name - The attribute name. - * @param {BufferAttribute|InterleavedBufferAttribute} attribute - The attribute to set. - * @return {BufferGeometry} A reference to this instance. - */ - setAttribute(name: string, attribute: BufferAttribute | InterleavedBufferAttribute): BufferGeometry; - /** - * Deletes the attribute for the given name. - * - * @param {string} name - The attribute name to delete. - * @return {BufferGeometry} A reference to this instance. - */ - deleteAttribute(name: string): BufferGeometry; - /** - * Returns `true` if this geometry has an attribute for the given name. - * - * @param {string} name - The attribute name. - * @return {boolean} Whether this geometry has an attribute for the given name or not. - */ - hasAttribute(name: string): boolean; - /** - * Adds a group to this geometry. - * - * @param {number} start - The first element in this draw call. That is the first - * vertex for non-indexed geometry, otherwise the first triangle index. - * @param {number} count - Specifies how many vertices (or indices) are part of this group. - * @param {number} [materialIndex=0] - The material array index to use. - */ - addGroup(start: number, count: number, materialIndex?: number): void; - /** - * Clears all groups. - */ - clearGroups(): void; - /** - * Sets the draw range for this geometry. - * - * @param {number} start - The first vertex for non-indexed geometry, otherwise the first triangle index. - * @param {number} count - For non-indexed BufferGeometry, `count` is the number of vertices to render. - * For indexed BufferGeometry, `count` is the number of indices to render. - */ - setDrawRange(start: number, count: number): void; - /** - * Applies the given 4x4 transformation matrix to the geometry. - * - * @param {Matrix4} matrix - The matrix to apply. - * @return {BufferGeometry} A reference to this instance. - */ - applyMatrix4(matrix: Matrix4): BufferGeometry; - /** - * Applies the rotation represented by the Quaternion to the geometry. - * - * @param {Quaternion} q - The Quaternion to apply. - * @return {BufferGeometry} A reference to this instance. - */ - applyQuaternion(q: Quaternion): BufferGeometry; - /** - * Rotates the geometry about the X axis. This is typically done as a one time - * operation, and not during a loop. Use {@link Object3D#rotation} for typical - * real-time mesh rotation. - * - * @param {number} angle - The angle in radians. - * @return {BufferGeometry} A reference to this instance. - */ - rotateX(angle: number): BufferGeometry; - /** - * Rotates the geometry about the Y axis. This is typically done as a one time - * operation, and not during a loop. Use {@link Object3D#rotation} for typical - * real-time mesh rotation. - * - * @param {number} angle - The angle in radians. - * @return {BufferGeometry} A reference to this instance. - */ - rotateY(angle: number): BufferGeometry; - /** - * Rotates the geometry about the Z axis. This is typically done as a one time - * operation, and not during a loop. Use {@link Object3D#rotation} for typical - * real-time mesh rotation. - * - * @param {number} angle - The angle in radians. - * @return {BufferGeometry} A reference to this instance. - */ - rotateZ(angle: number): BufferGeometry; - /** - * Translates the geometry. This is typically done as a one time - * operation, and not during a loop. Use {@link Object3D#position} for typical - * real-time mesh rotation. - * - * @param {number} x - The x offset. - * @param {number} y - The y offset. - * @param {number} z - The z offset. - * @return {BufferGeometry} A reference to this instance. - */ - translate(x: number, y: number, z: number): BufferGeometry; - /** - * Scales the geometry. This is typically done as a one time - * operation, and not during a loop. Use {@link Object3D#scale} for typical - * real-time mesh rotation. - * - * @param {number} x - The x scale. - * @param {number} y - The y scale. - * @param {number} z - The z scale. - * @return {BufferGeometry} A reference to this instance. - */ - scale(x: number, y: number, z: number): BufferGeometry; - /** - * Rotates the geometry to face a point in 3D space. This is typically done as a one time - * operation, and not during a loop. Use {@link Object3D#lookAt} for typical - * real-time mesh rotation. - * - * @param {Vector3} vector - The target point. - * @return {BufferGeometry} A reference to this instance. - */ - lookAt(vector: Vector3): BufferGeometry; - /** - * Center the geometry based on its bounding box. - * - * @return {BufferGeometry} A reference to this instance. - */ - center(): BufferGeometry; - /** - * Defines a geometry by creating a `position` attribute based on the given array of points. The array - * can hold 2D or 3D vectors. When using two-dimensional data, the `z` coordinate for all vertices is - * set to `0`. - * - * If the method is used with an existing `position` attribute, the vertex data are overwritten with the - * data from the array. The length of the array must match the vertex count. - * - * @param {Array|Array} points - The points. - * @return {BufferGeometry} A reference to this instance. - */ - setFromPoints(points: Array | Array): BufferGeometry; - /** - * Computes the bounding box of the geometry, and updates the `boundingBox` member. - * The bounding box is not computed by the engine; it must be computed by your app. - * You may need to recompute the bounding box if the geometry vertices are modified. - */ - computeBoundingBox(): void; - /** - * Computes the bounding sphere of the geometry, and updates the `boundingSphere` member. - * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. - * You may need to recompute the bounding sphere if the geometry vertices are modified. - */ - computeBoundingSphere(): void; - /** - * Calculates and adds a tangent attribute to this geometry. - * - * The computation is only supported for indexed geometries and if position, normal, and uv attributes - * are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by - * {@link BufferGeometryUtils#computeMikkTSpaceTangents} instead. - */ - computeTangents(): void; - /** - * Computes vertex normals for the given vertex data. For indexed geometries, the method sets - * each vertex normal to be the average of the face normals of the faces that share that vertex. - * For non-indexed geometries, vertices are not shared, and the method sets each vertex normal - * to be the same as the face normal. - */ - computeVertexNormals(): void; - /** - * Ensures every normal vector in a geometry will have a magnitude of `1`. This will - * correct lighting on the geometry surfaces. - */ - normalizeNormals(): void; - /** - * Return a new non-index version of this indexed geometry. If the geometry - * is already non-indexed, the method is a NOOP. - * - * @return {BufferGeometry} The non-indexed version of this indexed geometry. - */ - toNonIndexed(): BufferGeometry; - /** - * Serializes the geometry into JSON. - * - * @return {Object} A JSON object representing the serialized geometry. - */ - toJSON(): Object; - /** - * Returns a new geometry with copied values from this instance. - * - * @return {BufferGeometry} A clone of this instance. - */ - clone(): BufferGeometry; - /** - * Copies the values of the given geometry to this instance. - * - * @param {BufferGeometry} source - The geometry to copy. - * @return {BufferGeometry} A reference to this instance. - */ - copy(source: BufferGeometry): BufferGeometry; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * @fires BufferGeometry#dispose - */ - dispose(): void; -} -import { EventDispatcher } from './EventDispatcher.js'; -import { BufferAttribute } from './BufferAttribute.js'; -import { Box3 } from '../math/Box3.js'; -import { Sphere } from '../math/Sphere.js'; -import { Matrix4 } from '../math/Matrix4.js'; -import { Vector3 } from '../math/Vector3.js'; -import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Clock.d.ts b/jsdoc-testing/jsdoc/src/core/Clock.d.ts deleted file mode 100644 index d8945c215..000000000 --- a/jsdoc-testing/jsdoc/src/core/Clock.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Class for keeping track of time. - * - * @deprecated since r183. - */ -export class Clock { - /** - * Constructs a new clock. - * - * @deprecated since 183. - * @param {boolean} [autoStart=true] - Whether to automatically start the clock when - * `getDelta()` is called for the first time. - */ - constructor(autoStart?: boolean); - /** - * If set to `true`, the clock starts automatically when `getDelta()` is called - * for the first time. - * - * @type {boolean} - * @default true - */ - autoStart: boolean; - /** - * Holds the time at which the clock's `start()` method was last called. - * - * @type {number} - * @default 0 - */ - startTime: number; - /** - * Holds the time at which the clock's `start()`, `getElapsedTime()` or - * `getDelta()` methods were last called. - * - * @type {number} - * @default 0 - */ - oldTime: number; - /** - * Keeps track of the total time that the clock has been running. - * - * @type {number} - * @default 0 - */ - elapsedTime: number; - /** - * Whether the clock is running or not. - * - * @type {boolean} - * @default true - */ - running: boolean; - /** - * Starts the clock. When `autoStart` is set to `true`, the method is automatically - * called by the class. - */ - start(): void; - /** - * Stops the clock. - */ - stop(): void; - /** - * Returns the elapsed time in seconds. - * - * @return {number} The elapsed time. - */ - getElapsedTime(): number; - /** - * Returns the delta time in seconds. - * - * @return {number} The delta time. - */ - getDelta(): number; -} diff --git a/jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts b/jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts deleted file mode 100644 index b53482ecc..000000000 --- a/jsdoc-testing/jsdoc/src/core/EventDispatcher.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * This modules allows to dispatch event objects on custom JavaScript objects. - * - * Main repository: [eventdispatcher.js](https://github.com/mrdoob/eventdispatcher.js/) - * - * Code Example: - * ```js - * class Car extends EventDispatcher { - * start() { - * this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } ); - * } - *}; - * - * // Using events with the custom object - * const car = new Car(); - * car.addEventListener( 'start', function ( event ) { - * alert( event.message ); - * } ); - * - * car.start(); - * ``` - */ -export class EventDispatcher { - /** - * Adds the given event listener to the given event type. - * - * @param {string} type - The type of event to listen to. - * @param {Function} listener - The function that gets called when the event is fired. - */ - addEventListener(type: string, listener: Function): void; - _listeners: {} | undefined; - /** - * Returns `true` if the given event listener has been added to the given event type. - * - * @param {string} type - The type of event. - * @param {Function} listener - The listener to check. - * @return {boolean} Whether the given event listener has been added to the given event type. - */ - hasEventListener(type: string, listener: Function): boolean; - /** - * Removes the given event listener from the given event type. - * - * @param {string} type - The type of event. - * @param {Function} listener - The listener to remove. - */ - removeEventListener(type: string, listener: Function): void; - /** - * Dispatches an event object. - * - * @param {Object} event - The event that gets fired. - */ - dispatchEvent(event: Object): void; -} diff --git a/jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts deleted file mode 100644 index 636d7b1e6..000000000 --- a/jsdoc-testing/jsdoc/src/core/GLBufferAttribute.d.ts +++ /dev/null @@ -1,122 +0,0 @@ -/** - * An alternative version of a buffer attribute with more control over the VBO. - * - * The renderer does not construct a VBO for this kind of attribute. Instead, it uses - * whatever VBO is passed in constructor and can later be altered via the `buffer` property. - * - * The most common use case for this class is when some kind of GPGPU calculation interferes - * or even produces the VBOs in question. - * - * Notice that this class can only be used with {@link WebGLRenderer}. - */ -export class GLBufferAttribute { - /** - * Constructs a new GL buffer attribute. - * - * @param {WebGLBuffer} buffer - The native WebGL buffer. - * @param {number} type - The native data type (e.g. `gl.FLOAT`). - * @param {number} itemSize - The item size. - * @param {number} elementSize - The corresponding size (in bytes) for the given `type` parameter. - * @param {number} count - The expected number of vertices in VBO. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(buffer: WebGLBuffer, type: number, itemSize: number, elementSize: number, count: number, normalized?: boolean); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isGLBufferAttribute: boolean; - /** - * The name of the buffer attribute. - * - * @type {string} - */ - name: string; - /** - * The native WebGL buffer. - * - * @type {WebGLBuffer} - */ - buffer: WebGLBuffer; - /** - * The native data type. - * - * @type {number} - */ - type: number; - /** - * The item size, see {@link BufferAttribute#itemSize}. - * - * @type {number} - */ - itemSize: number; - /** - * The corresponding size (in bytes) for the given `type` parameter. - * - * @type {number} - */ - elementSize: number; - /** - * The expected number of vertices in VBO. - * - * @type {number} - */ - count: number; - /** - * Applies to integer data only. Indicates how the underlying data in the buffer maps to - * the values in the GLSL code. For instance, if `buffer` contains data of `gl.UNSIGNED_SHORT`, - * and `normalized` is `true`, the values `0 - +65535` in the buffer data will be mapped to - * `0.0f - +1.0f` in the GLSL attribute. If `normalized` is `false`, the values will be converted - * to floats unmodified, i.e. `65535` becomes `65535.0f`. - * - * @type {boolean} - */ - normalized: boolean; - /** - * A version number, incremented every time the `needsUpdate` is set to `true`. - * - * @type {number} - */ - version: number; - /** - * Flag to indicate that this attribute has changed and should be re-sent to - * the GPU. Set this to `true` when you modify the value of the array. - * - * @type {number} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * Sets the given native WebGL buffer. - * - * @param {WebGLBuffer} buffer - The buffer to set. - * @return {BufferAttribute} A reference to this instance. - */ - setBuffer(buffer: WebGLBuffer): BufferAttribute; - /** - * Sets the given native data type and element size. - * - * @param {number} type - The native data type (e.g. `gl.FLOAT`). - * @param {number} elementSize - The corresponding size (in bytes) for the given `type` parameter. - * @return {BufferAttribute} A reference to this instance. - */ - setType(type: number, elementSize: number): BufferAttribute; - /** - * Sets the item size. - * - * @param {number} itemSize - The item size. - * @return {BufferAttribute} A reference to this instance. - */ - setItemSize(itemSize: number): BufferAttribute; - /** - * Sets the count (the expected number of vertices in VBO). - * - * @param {number} count - The count. - * @return {BufferAttribute} A reference to this instance. - */ - setCount(count: number): BufferAttribute; -} diff --git a/jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts deleted file mode 100644 index aed6b3ff4..000000000 --- a/jsdoc-testing/jsdoc/src/core/InstancedBufferAttribute.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * An instanced version of a buffer attribute. - * - * @augments BufferAttribute - */ -export class InstancedBufferAttribute extends BufferAttribute { - /** - * Constructs a new instanced buffer attribute. - * - * @param {TypedArray} array - The array holding the attribute data. - * @param {number} itemSize - The item size. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - * @param {number} [meshPerAttribute=1] - How often a value of this buffer attribute should be repeated. - */ - constructor(array: TypedArray, itemSize: number, normalized?: boolean, meshPerAttribute?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInstancedBufferAttribute: boolean; - /** - * Defines how often a value of this buffer attribute should be repeated. A - * value of one means that each value of the instanced attribute is used for - * a single instance. A value of two means that each value is used for two - * consecutive instances (and so on). - * - * @type {number} - * @default 1 - */ - meshPerAttribute: number; - copy(source: any): this; -} -import { BufferAttribute } from './BufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts b/jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts deleted file mode 100644 index 4ea16abdd..000000000 --- a/jsdoc-testing/jsdoc/src/core/InstancedBufferGeometry.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * An instanced version of a geometry. - */ -export class InstancedBufferGeometry extends BufferGeometry { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInstancedBufferGeometry: boolean; - /** - * The instance count. - * - * @type {number} - * @default Infinity - */ - instanceCount: number; - copy(source: any): this; -} -import { BufferGeometry } from './BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts b/jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts deleted file mode 100644 index 3f95ae1bb..000000000 --- a/jsdoc-testing/jsdoc/src/core/InstancedInterleavedBuffer.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * An instanced version of an interleaved buffer. - * - * @augments InterleavedBuffer - */ -export class InstancedInterleavedBuffer extends InterleavedBuffer { - /** - * Constructs a new instanced interleaved buffer. - * - * @param {TypedArray} array - A typed array with a shared buffer storing attribute data. - * @param {number} stride - The number of typed-array elements per vertex. - * @param {number} [meshPerAttribute=1] - Defines how often a value of this interleaved buffer should be repeated. - */ - constructor(array: TypedArray, stride: number, meshPerAttribute?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInstancedInterleavedBuffer: boolean; - /** - * Defines how often a value of this buffer attribute should be repeated, - * see {@link InstancedBufferAttribute#meshPerAttribute}. - * - * @type {number} - * @default 1 - */ - meshPerAttribute: number; - copy(source: any): this; - clone(data: any): InterleavedBuffer; - toJSON(data: any): Object; -} -import { InterleavedBuffer } from './InterleavedBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts b/jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts deleted file mode 100644 index c6054ce83..000000000 --- a/jsdoc-testing/jsdoc/src/core/InterleavedBuffer.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -/** - * "Interleaved" means that multiple attributes, possibly of different types, - * (e.g., position, normal, uv, color) are packed into a single array buffer. - * - * An introduction into interleaved arrays can be found here: [Interleaved array basics](https://blog.tojicode.com/2011/05/interleaved-array-basics.html) - */ -export class InterleavedBuffer { - /** - * Constructs a new interleaved buffer. - * - * @param {TypedArray} array - A typed array with a shared buffer storing attribute data. - * @param {number} stride - The number of typed-array elements per vertex. - */ - constructor(array: TypedArray, stride: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInterleavedBuffer: boolean; - /** - * A typed array with a shared buffer storing attribute data. - * - * @type {TypedArray} - */ - array: TypedArray; - /** - * The number of typed-array elements per vertex. - * - * @type {number} - */ - stride: number; - /** - * The total number of elements in the array - * - * @type {number} - * @readonly - */ - readonly count: number; - /** - * Defines the intended usage pattern of the data store for optimization purposes. - * - * Note: After the initial use of a buffer, its usage cannot be changed. Instead, - * instantiate a new one and set the desired usage before the next render. - * - * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} - * @default StaticDrawUsage - */ - usage: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage); - /** - * This can be used to only update some components of stored vectors (for example, just the - * component related to color). Use the `addUpdateRange()` function to add ranges to this array. - * - * @type {Array} - */ - updateRanges: Array; - /** - * A version number, incremented every time the `needsUpdate` is set to `true`. - * - * @type {number} - */ - version: number; - /** - * The UUID of the interleaved buffer. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * A callback function that is executed after the renderer has transferred the attribute array - * data to the GPU. - */ - onUploadCallback(): void; - /** - * Flag to indicate that this attribute has changed and should be re-sent to - * the GPU. Set this to `true` when you modify the value of the array. - * - * @type {number} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * Sets the usage of this interleaved buffer. - * - * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set. - * @return {InterleavedBuffer} A reference to this interleaved buffer. - */ - setUsage(value: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage)): InterleavedBuffer; - /** - * Adds a range of data in the data array to be updated on the GPU. - * - * @param {number} start - Position at which to start update. - * @param {number} count - The number of components to update. - */ - addUpdateRange(start: number, count: number): void; - /** - * Clears the update ranges. - */ - clearUpdateRanges(): void; - /** - * Copies the values of the given interleaved buffer to this instance. - * - * @param {InterleavedBuffer} source - The interleaved buffer to copy. - * @return {InterleavedBuffer} A reference to this instance. - */ - copy(source: InterleavedBuffer): InterleavedBuffer; - /** - * Copies a vector from the given interleaved buffer to this one. The start - * and destination position in the attribute buffers are represented by the - * given indices. - * - * @param {number} index1 - The destination index into this interleaved buffer. - * @param {InterleavedBuffer} interleavedBuffer - The interleaved buffer to copy from. - * @param {number} index2 - The source index into the given interleaved buffer. - * @return {InterleavedBuffer} A reference to this instance. - */ - copyAt(index1: number, interleavedBuffer: InterleavedBuffer, index2: number): InterleavedBuffer; - /** - * Sets the given array data in the interleaved buffer. - * - * @param {(TypedArray|Array)} value - The array data to set. - * @param {number} [offset=0] - The offset in this interleaved buffer's array. - * @return {InterleavedBuffer} A reference to this instance. - */ - set(value: (TypedArray | any[]), offset?: number): InterleavedBuffer; - /** - * Returns a new interleaved buffer with copied values from this instance. - * - * @param {Object} [data] - An object with shared array buffers that allows to retain shared structures. - * @return {InterleavedBuffer} A clone of this instance. - */ - clone(data?: Object): InterleavedBuffer; - /** - * Sets the given callback function that is executed after the Renderer has transferred - * the array data to the GPU. Can be used to perform clean-up operations after - * the upload when data are not needed anymore on the CPU side. - * - * @param {Function} callback - The `onUpload()` callback. - * @return {InterleavedBuffer} A reference to this instance. - */ - onUpload(callback: Function): InterleavedBuffer; - /** - * Serializes the interleaved buffer into JSON. - * - * @param {Object} [data] - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized interleaved buffer. - */ - toJSON(data?: Object): Object; -} diff --git a/jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts deleted file mode 100644 index 8fd60911e..000000000 --- a/jsdoc-testing/jsdoc/src/core/InterleavedBufferAttribute.d.ts +++ /dev/null @@ -1,226 +0,0 @@ -/** - * An alternative version of a buffer attribute with interleaved data. Interleaved - * attributes share a common interleaved data storage ({@link InterleavedBuffer}) and refer with - * different offsets into the buffer. - */ -export class InterleavedBufferAttribute { - /** - * Constructs a new interleaved buffer attribute. - * - * @param {InterleavedBuffer} interleavedBuffer - The buffer holding the interleaved data. - * @param {number} itemSize - The item size. - * @param {number} offset - The attribute offset into the buffer. - * @param {boolean} [normalized=false] - Whether the data are normalized or not. - */ - constructor(interleavedBuffer: InterleavedBuffer, itemSize: number, offset: number, normalized?: boolean); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInterleavedBufferAttribute: boolean; - /** - * The name of the buffer attribute. - * - * @type {string} - */ - name: string; - /** - * The buffer holding the interleaved data. - * - * @type {InterleavedBuffer} - */ - data: InterleavedBuffer; - /** - * The item size, see {@link BufferAttribute#itemSize}. - * - * @type {number} - */ - itemSize: number; - /** - * The attribute offset into the buffer. - * - * @type {number} - */ - offset: number; - /** - * Whether the data are normalized or not, see {@link BufferAttribute#normalized} - * - * @type {InterleavedBuffer} - */ - normalized: InterleavedBuffer; - /** - * The item count of this buffer attribute. - * - * @type {number} - * @readonly - */ - readonly get count(): number; - /** - * The array holding the interleaved buffer attribute data. - * - * @type {TypedArray} - */ - get array(): TypedArray; - /** - * Flag to indicate that this attribute has changed and should be re-sent to - * the GPU. Set this to `true` when you modify the value of the array. - * - * @type {number} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * Applies the given 4x4 matrix to the given attribute. Only works with - * item size `3`. - * - * @param {Matrix4} m - The matrix to apply. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - applyMatrix4(m: Matrix4): InterleavedBufferAttribute; - /** - * Applies the given 3x3 normal matrix to the given attribute. Only works with - * item size `3`. - * - * @param {Matrix3} m - The normal matrix to apply. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - applyNormalMatrix(m: Matrix3): InterleavedBufferAttribute; - /** - * Applies the given 4x4 matrix to the given attribute. Only works with - * item size `3` and with direction vectors. - * - * @param {Matrix4} m - The matrix to apply. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - transformDirection(m: Matrix4): InterleavedBufferAttribute; - /** - * Returns the given component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} component - The component index. - * @return {number} The returned value. - */ - getComponent(index: number, component: number): number; - /** - * Sets the given value to the given component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} component - The component index. - * @param {number} value - The value to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setComponent(index: number, component: number, value: number): InterleavedBufferAttribute; - /** - * Sets the x component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setX(index: number, x: number): InterleavedBufferAttribute; - /** - * Sets the y component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} y - The value to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setY(index: number, y: number): InterleavedBufferAttribute; - /** - * Sets the z component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} z - The value to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setZ(index: number, z: number): InterleavedBufferAttribute; - /** - * Sets the w component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} w - The value to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setW(index: number, w: number): InterleavedBufferAttribute; - /** - * Returns the x component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The x component. - */ - getX(index: number): number; - /** - * Returns the y component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The y component. - */ - getY(index: number): number; - /** - * Returns the z component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The z component. - */ - getZ(index: number): number; - /** - * Returns the w component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @return {number} The w component. - */ - getW(index: number): number; - /** - * Sets the x and y component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value for the x component to set. - * @param {number} y - The value for the y component to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setXY(index: number, x: number, y: number): InterleavedBufferAttribute; - /** - * Sets the x, y and z component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value for the x component to set. - * @param {number} y - The value for the y component to set. - * @param {number} z - The value for the z component to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setXYZ(index: number, x: number, y: number, z: number): InterleavedBufferAttribute; - /** - * Sets the x, y, z and w component of the vector at the given index. - * - * @param {number} index - The index into the buffer attribute. - * @param {number} x - The value for the x component to set. - * @param {number} y - The value for the y component to set. - * @param {number} z - The value for the z component to set. - * @param {number} w - The value for the w component to set. - * @return {InterleavedBufferAttribute} A reference to this instance. - */ - setXYZW(index: number, x: number, y: number, z: number, w: number): InterleavedBufferAttribute; - /** - * Returns a new buffer attribute with copied values from this instance. - * - * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data. - * - * @param {Object} [data] - An object with interleaved buffers that allows to retain the interleaved property. - * @return {BufferAttribute|InterleavedBufferAttribute} A clone of this instance. - */ - clone(data?: Object): BufferAttribute | InterleavedBufferAttribute; - /** - * Serializes the buffer attribute into JSON. - * - * If no parameter is provided, cloning an interleaved buffer attribute will de-interleave buffer data. - * - * @param {Object} [data] - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized buffer attribute. - */ - toJSON(data?: Object): Object; -} -import { BufferAttribute } from './BufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Layers.d.ts b/jsdoc-testing/jsdoc/src/core/Layers.d.ts deleted file mode 100644 index 34b3c6175..000000000 --- a/jsdoc-testing/jsdoc/src/core/Layers.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * A layers object assigns an 3D object to 1 or more of 32 - * layers numbered `0` to `31` - internally the layers are stored as a - * bit mask], and by default all 3D objects are a member of layer `0`. - * - * This can be used to control visibility - an object must share a layer with - * a camera to be visible when that camera's view is - * rendered. - * - * All classes that inherit from {@link Object3D} have an `layers` property which - * is an instance of this class. - */ -export class Layers { - /** - * A bit mask storing which of the 32 layers this layers object is currently - * a member of. - * - * @type {number} - */ - mask: number; - /** - * Sets membership to the given layer, and remove membership all other layers. - * - * @param {number} layer - The layer to set. - */ - set(layer: number): void; - /** - * Adds membership of the given layer. - * - * @param {number} layer - The layer to enable. - */ - enable(layer: number): void; - /** - * Adds membership to all layers. - */ - enableAll(): void; - /** - * Toggles the membership of the given layer. - * - * @param {number} layer - The layer to toggle. - */ - toggle(layer: number): void; - /** - * Removes membership of the given layer. - * - * @param {number} layer - The layer to enable. - */ - disable(layer: number): void; - /** - * Removes the membership from all layers. - */ - disableAll(): void; - /** - * Returns `true` if this and the given layers object have at least one - * layer in common. - * - * @param {Layers} layers - The layers to test. - * @return {boolean } Whether this and the given layers object have at least one layer in common or not. - */ - test(layers: Layers): boolean; - /** - * Returns `true` if the given layer is enabled. - * - * @param {number} layer - The layer to test. - * @return {boolean } Whether the given layer is enabled or not. - */ - isEnabled(layer: number): boolean; -} diff --git a/jsdoc-testing/jsdoc/src/core/Object3D.d.ts b/jsdoc-testing/jsdoc/src/core/Object3D.d.ts deleted file mode 100644 index 7e07bf8c4..000000000 --- a/jsdoc-testing/jsdoc/src/core/Object3D.d.ts +++ /dev/null @@ -1,606 +0,0 @@ -/** - * This is the base class for most objects in three.js and provides a set of - * properties and methods for manipulating objects in 3D space. - * - * @augments EventDispatcher - */ -export class Object3D extends EventDispatcher { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isObject3D: boolean; - /** - * The UUID of the 3D object. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * The name of the 3D object. - * - * @type {string} - */ - name: string; - /** - * The type property is used for detecting the object type - * in context of serialization/deserialization. - * - * @type {string} - * @readonly - */ - readonly type: string; - /** - * A reference to the parent object. - * - * @type {?Object3D} - * @default null - */ - parent: Object3D | null; - /** - * An array holding the child 3D objects of this instance. - * - * @type {Array} - */ - children: Array; - /** - * Defines the `up` direction of the 3D object which influences - * the orientation via methods like {@link Object3D#lookAt}. - * - * The default values for all 3D objects is defined by `Object3D.DEFAULT_UP`. - * - * @type {Vector3} - */ - up: Vector3; - /** - * Represents the object's transformation matrix in local space. - * - * @type {Matrix4} - */ - matrix: Matrix4; - /** - * Represents the object's transformation matrix in world space. - * If the 3D object has no parent, then it's identical to the local transformation matrix - * - * @type {Matrix4} - */ - matrixWorld: Matrix4; - /** - * When set to `true`, the engine automatically computes the local matrix from position, - * rotation and scale every frame. If set to `false`, the app is responsible for recomputing - * the local matrix by calling `updateMatrix()`. - * - * The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_AUTO_UPDATE`. - * - * @type {boolean} - * @default true - */ - matrixAutoUpdate: boolean; - /** - * When set to `true`, the engine automatically computes the world matrix from the current local - * matrix and the object's transformation hierarchy. If set to `false`, the app is responsible for - * recomputing the world matrix by directly updating the `matrixWorld` property. - * - * The default values for all 3D objects is defined by `Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE`. - * - * @type {boolean} - * @default true - */ - matrixWorldAutoUpdate: boolean; - /** - * When set to `true`, it calculates the world matrix in that frame and resets this property - * to `false`. - * - * @type {boolean} - * @default false - */ - matrixWorldNeedsUpdate: boolean; - /** - * The layer membership of the 3D object. The 3D object is only visible if it has - * at least one layer in common with the camera in use. This property can also be - * used to filter out unwanted objects in ray-intersection tests when using {@link Raycaster}. - * - * @type {Layers} - */ - layers: Layers; - /** - * When set to `true`, the 3D object gets rendered. - * - * @type {boolean} - * @default true - */ - visible: boolean; - /** - * When set to `true`, the 3D object gets rendered into shadow maps. - * - * @type {boolean} - * @default false - */ - castShadow: boolean; - /** - * When set to `true`, the 3D object is affected by shadows in the scene. - * - * @type {boolean} - * @default false - */ - receiveShadow: boolean; - /** - * When set to `true`, the 3D object is honored by view frustum culling. - * - * @type {boolean} - * @default true - */ - frustumCulled: boolean; - /** - * This value allows the default rendering order of scene graph objects to be - * overridden although opaque and transparent objects remain sorted independently. - * When this property is set for an instance of {@link Group},all descendants - * objects will be sorted and rendered together. Sorting is from lowest to highest - * render order. - * - * @type {number} - * @default 0 - */ - renderOrder: number; - /** - * An array holding the animation clips of the 3D object. - * - * @type {Array} - */ - animations: Array; - /** - * Custom depth material to be used when rendering to the depth map. Can only be used - * in context of meshes. When shadow-casting with a {@link DirectionalLight} or {@link SpotLight}, - * if you are modifying vertex positions in the vertex shader you must specify a custom depth - * material for proper shadows. - * - * Only relevant in context of {@link WebGLRenderer}. - * - * @type {(Material|undefined)} - * @default undefined - */ - customDepthMaterial: (Material | undefined); - /** - * Same as {@link Object3D#customDepthMaterial}, but used with {@link PointLight}. - * - * Only relevant in context of {@link WebGLRenderer}. - * - * @type {(Material|undefined)} - * @default undefined - */ - customDistanceMaterial: (Material | undefined); - /** - * Whether the 3D object is supposed to be static or not. If set to `true`, it means - * the 3D object is not going to be changed after the initial renderer. This includes - * geometry and material settings. A static 3D object can be processed by the renderer - * slightly faster since certain state checks can be bypassed. - * - * Only relevant in context of {@link WebGPURenderer}. - * - * @type {boolean} - * @default false - */ - static: boolean; - /** - * An object that can be used to store custom data about the 3D object. It - * should not hold references to functions as these will not be cloned. - * - * @type {Object} - */ - userData: Object; - /** - * The pivot point for rotation and scale transformations. - * When set, rotation and scale are applied around this point - * instead of the object's origin. - * - * @type {?Vector3} - * @default null - */ - pivot: Vector3 | null; - /** - * A callback that is executed immediately before a 3D object is rendered to a shadow map. - * - * @param {Renderer|WebGLRenderer} renderer - The renderer. - * @param {Object3D} object - The 3D object. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {Camera} shadowCamera - The shadow camera. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Material} depthMaterial - The depth material. - * @param {Object} group - The geometry group data. - */ - onBeforeShadow(): void; - /** - * A callback that is executed immediately after a 3D object is rendered to a shadow map. - * - * @param {Renderer|WebGLRenderer} renderer - The renderer. - * @param {Object3D} object - The 3D object. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {Camera} shadowCamera - The shadow camera. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Material} depthMaterial - The depth material. - * @param {Object} group - The geometry group data. - */ - onAfterShadow(): void; - /** - * A callback that is executed immediately before a 3D object is rendered. - * - * @param {Renderer|WebGLRenderer} renderer - The renderer. - * @param {Object3D} object - The 3D object. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Material} material - The 3D object's material. - * @param {Object} group - The geometry group data. - */ - onBeforeRender(): void; - /** - * A callback that is executed immediately after a 3D object is rendered. - * - * @param {Renderer|WebGLRenderer} renderer - The renderer. - * @param {Object3D} object - The 3D object. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Material} material - The 3D object's material. - * @param {Object} group - The geometry group data. - */ - onAfterRender(): void; - /** - * Applies the given transformation matrix to the object and updates the object's position, - * rotation and scale. - * - * @param {Matrix4} matrix - The transformation matrix. - */ - applyMatrix4(matrix: Matrix4): void; - /** - * Applies a rotation represented by given the quaternion to the 3D object. - * - * @param {Quaternion} q - The quaternion. - * @return {Object3D} A reference to this instance. - */ - applyQuaternion(q: Quaternion): Object3D; - /** - * Sets the given rotation represented as an axis/angle couple to the 3D object. - * - * @param {Vector3} axis - The (normalized) axis vector. - * @param {number} angle - The angle in radians. - */ - setRotationFromAxisAngle(axis: Vector3, angle: number): void; - /** - * Sets the given rotation represented as Euler angles to the 3D object. - * - * @param {Euler} euler - The Euler angles. - */ - setRotationFromEuler(euler: Euler): void; - /** - * Sets the given rotation represented as rotation matrix to the 3D object. - * - * @param {Matrix4} m - Although a 4x4 matrix is expected, the upper 3x3 portion must be - * a pure rotation matrix (i.e, unscaled). - */ - setRotationFromMatrix(m: Matrix4): void; - /** - * Sets the given rotation represented as a Quaternion to the 3D object. - * - * @param {Quaternion} q - The Quaternion - */ - setRotationFromQuaternion(q: Quaternion): void; - /** - * Rotates the 3D object along an axis in local space. - * - * @param {Vector3} axis - The (normalized) axis vector. - * @param {number} angle - The angle in radians. - * @return {Object3D} A reference to this instance. - */ - rotateOnAxis(axis: Vector3, angle: number): Object3D; - /** - * Rotates the 3D object along an axis in world space. - * - * @param {Vector3} axis - The (normalized) axis vector. - * @param {number} angle - The angle in radians. - * @return {Object3D} A reference to this instance. - */ - rotateOnWorldAxis(axis: Vector3, angle: number): Object3D; - /** - * Rotates the 3D object around its X axis in local space. - * - * @param {number} angle - The angle in radians. - * @return {Object3D} A reference to this instance. - */ - rotateX(angle: number): Object3D; - /** - * Rotates the 3D object around its Y axis in local space. - * - * @param {number} angle - The angle in radians. - * @return {Object3D} A reference to this instance. - */ - rotateY(angle: number): Object3D; - /** - * Rotates the 3D object around its Z axis in local space. - * - * @param {number} angle - The angle in radians. - * @return {Object3D} A reference to this instance. - */ - rotateZ(angle: number): Object3D; - /** - * Translate the 3D object by a distance along the given axis in local space. - * - * @param {Vector3} axis - The (normalized) axis vector. - * @param {number} distance - The distance in world units. - * @return {Object3D} A reference to this instance. - */ - translateOnAxis(axis: Vector3, distance: number): Object3D; - /** - * Translate the 3D object by a distance along its X-axis in local space. - * - * @param {number} distance - The distance in world units. - * @return {Object3D} A reference to this instance. - */ - translateX(distance: number): Object3D; - /** - * Translate the 3D object by a distance along its Y-axis in local space. - * - * @param {number} distance - The distance in world units. - * @return {Object3D} A reference to this instance. - */ - translateY(distance: number): Object3D; - /** - * Translate the 3D object by a distance along its Z-axis in local space. - * - * @param {number} distance - The distance in world units. - * @return {Object3D} A reference to this instance. - */ - translateZ(distance: number): Object3D; - /** - * Converts the given vector from this 3D object's local space to world space. - * - * @param {Vector3} vector - The vector to convert. - * @return {Vector3} The converted vector. - */ - localToWorld(vector: Vector3): Vector3; - /** - * Converts the given vector from this 3D object's world space to local space. - * - * @param {Vector3} vector - The vector to convert. - * @return {Vector3} The converted vector. - */ - worldToLocal(vector: Vector3): Vector3; - /** - * Rotates the object to face a point in world space. - * - * This method does not support objects having non-uniformly-scaled parent(s). - * - * @param {number|Vector3} x - The x coordinate in world space. Alternatively, a vector representing a position in world space - * @param {number} [y] - The y coordinate in world space. - * @param {number} [z] - The z coordinate in world space. - */ - lookAt(x: number | Vector3, y?: number, z?: number): void; - /** - * Adds the given 3D object as a child to this 3D object. An arbitrary number of - * objects may be added. Any current parent on an object passed in here will be - * removed, since an object can have at most one parent. - * - * @fires Object3D#added - * @fires Object3D#childadded - * @param {Object3D} object - The 3D object to add. - * @return {Object3D} A reference to this instance. - */ - add(object: Object3D, ...args: any[]): Object3D; - /** - * Removes the given 3D object as child from this 3D object. - * An arbitrary number of objects may be removed. - * - * @fires Object3D#removed - * @fires Object3D#childremoved - * @param {Object3D} object - The 3D object to remove. - * @return {Object3D} A reference to this instance. - */ - remove(object: Object3D, ...args: any[]): Object3D; - /** - * Removes this 3D object from its current parent. - * - * @fires Object3D#removed - * @fires Object3D#childremoved - * @return {Object3D} A reference to this instance. - */ - removeFromParent(): Object3D; - /** - * Removes all child objects. - * - * @fires Object3D#removed - * @fires Object3D#childremoved - * @return {Object3D} A reference to this instance. - */ - clear(): Object3D; - /** - * Adds the given 3D object as a child of this 3D object, while maintaining the object's world - * transform. This method does not support scene graphs having non-uniformly-scaled nodes(s). - * - * @fires Object3D#added - * @fires Object3D#childadded - * @param {Object3D} object - The 3D object to attach. - * @return {Object3D} A reference to this instance. - */ - attach(object: Object3D): Object3D; - /** - * Searches through the 3D object and its children, starting with the 3D object - * itself, and returns the first with a matching ID. - * - * @param {number} id - The id. - * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found. - */ - getObjectById(id: number): Object3D | undefined; - /** - * Searches through the 3D object and its children, starting with the 3D object - * itself, and returns the first with a matching name. - * - * @param {string} name - The name. - * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found. - */ - getObjectByName(name: string): Object3D | undefined; - /** - * Searches through the 3D object and its children, starting with the 3D object - * itself, and returns the first with a matching property value. - * - * @param {string} name - The name of the property. - * @param {any} value - The value. - * @return {Object3D|undefined} The found 3D object. Returns `undefined` if no 3D object has been found. - */ - getObjectByProperty(name: string, value: any): Object3D | undefined; - /** - * Searches through the 3D object and its children, starting with the 3D object - * itself, and returns all 3D objects with a matching property value. - * - * @param {string} name - The name of the property. - * @param {any} value - The value. - * @param {Array} result - The method stores the result in this array. - * @return {Array} The found 3D objects. - */ - getObjectsByProperty(name: string, value: any, result?: Array): Array; - /** - * Returns a vector representing the position of the 3D object in world space. - * - * @param {Vector3} target - The target vector the result is stored to. - * @return {Vector3} The 3D object's position in world space. - */ - getWorldPosition(target: Vector3): Vector3; - /** - * Returns a Quaternion representing the position of the 3D object in world space. - * - * @param {Quaternion} target - The target Quaternion the result is stored to. - * @return {Quaternion} The 3D object's rotation in world space. - */ - getWorldQuaternion(target: Quaternion): Quaternion; - /** - * Returns a vector representing the scale of the 3D object in world space. - * - * @param {Vector3} target - The target vector the result is stored to. - * @return {Vector3} The 3D object's scale in world space. - */ - getWorldScale(target: Vector3): Vector3; - /** - * Returns a vector representing the ("look") direction of the 3D object in world space. - * - * @param {Vector3} target - The target vector the result is stored to. - * @return {Vector3} The 3D object's direction in world space. - */ - getWorldDirection(target: Vector3): Vector3; - /** - * Abstract method to get intersections between a casted ray and this - * 3D object. Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points} - * implement this method in order to use raycasting. - * - * @abstract - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - An array holding the result of the method. - */ - raycast(): void; - /** - * Abstract method to test whether this 3D object intersects the given frustum. - * Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points} - * implement this method in order to use frustum culling. - * - * @abstract - * @param {Frustum|FrustumArray} frustum - The frustum to test. - * @return {boolean|undefined} Whether this 3D object intersects the given frustum or not. - */ - intersectsFrustum(): boolean | undefined; - /** - * Executes the callback on this 3D object and all descendants. - * - * Note: Modifying the scene graph inside the callback is discouraged. - * - * @param {Function} callback - A callback function that allows to process the current 3D object. - */ - traverse(callback: Function): void; - /** - * Like {@link Object3D#traverse}, but the callback will only be executed for visible 3D objects. - * Descendants of invisible 3D objects are not traversed. - * - * Note: Modifying the scene graph inside the callback is discouraged. - * - * @param {Function} callback - A callback function that allows to process the current 3D object. - */ - traverseVisible(callback: Function): void; - /** - * Like {@link Object3D#traverse}, but the callback will only be executed for all ancestors. - * - * Note: Modifying the scene graph inside the callback is discouraged. - * - * @param {Function} callback - A callback function that allows to process the current 3D object. - */ - traverseAncestors(callback: Function): void; - /** - * Updates the transformation matrix in local space by computing it from the current - * position, rotation and scale values. - */ - updateMatrix(): void; - /** - * Updates the transformation matrix in world space of this 3D objects and its descendants. - * - * To ensure correct results, this method also recomputes the 3D object's transformation matrix in - * local space. The computation of the local and world matrix can be controlled with the - * {@link Object3D#matrixAutoUpdate} and {@link Object3D#matrixWorldAutoUpdate} flags which are both - * `true` by default. Set these flags to `false` if you need more control over the update matrix process. - * - * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even - * when {@link Object3D#matrixWorldNeedsUpdate} is `false`. - */ - updateMatrixWorld(force?: boolean): void; - /** - * An alternative version of {@link Object3D#updateMatrixWorld} with more control over the - * update of ancestor and descendant nodes. - * - * @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not. - * @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not. - * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even - * when {@link Object3D#matrixWorldNeedsUpdate} is `false`. - */ - updateWorldMatrix(updateParents?: boolean, updateChildren?: boolean, force?: boolean): void; - /** - * Serializes the 3D object into JSON. - * - * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized 3D object. - * @see {@link ObjectLoader#parse} - */ - toJSON(meta: (Object | string) | null): Object; - /** - * Returns a new 3D object with copied values from this instance. - * - * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are also cloned. - * @return {Object3D} A clone of this instance. - */ - clone(recursive?: boolean): Object3D; - /** - * Copies the values of the given 3D object to this instance. - * - * @param {Object3D} source - The 3D object to copy. - * @param {boolean} [recursive=true] - When set to `true`, descendants of the 3D object are cloned. - * @return {Object3D} A reference to this instance. - */ - copy(source: Object3D, recursive?: boolean): Object3D; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * Geometries, materials and textures are potentially shared with other - * 3D objects and must be disposed of separately. - * - * @fires Object3D#dispose - */ - dispose(): void; -} -export namespace Object3D { - let DEFAULT_UP: Vector3; - let DEFAULT_MATRIX_AUTO_UPDATE: boolean; - let DEFAULT_MATRIX_WORLD_AUTO_UPDATE: boolean; -} -import { EventDispatcher } from './EventDispatcher.js'; -import { Vector3 } from '../math/Vector3.js'; -import { Matrix4 } from '../math/Matrix4.js'; -import { Layers } from './Layers.js'; -import { Quaternion } from '../math/Quaternion.js'; -import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Raycaster.d.ts b/jsdoc-testing/jsdoc/src/core/Raycaster.d.ts deleted file mode 100644 index 09c8b0845..000000000 --- a/jsdoc-testing/jsdoc/src/core/Raycaster.d.ts +++ /dev/null @@ -1,149 +0,0 @@ -/** - * This class is designed to assist with raycasting. Raycasting is used for - * mouse picking (working out what objects in the 3d space the mouse is over) - * amongst other things. - */ -export class Raycaster { - /** - * Constructs a new raycaster. - * - * @param {Vector3} origin - The origin vector where the ray casts from. - * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray. - * @param {number} [near=0] - All results returned are further away than near. Near can't be negative. - * @param {number} [far=Infinity] - All results returned are closer than far. Far can't be lower than near. - */ - constructor(origin: Vector3, direction: Vector3, near?: number, far?: number); - /** - * The ray used for raycasting. - * - * @type {Ray} - */ - ray: Ray; - /** - * All results returned are further away than near. Near can't be negative. - * - * @type {number} - * @default 0 - */ - near: number; - /** - * All results returned are closer than far. Far can't be lower than near. - * - * @type {number} - * @default Infinity - */ - far: number; - /** - * The camera to use when raycasting against view-dependent objects such as - * billboarded objects like sprites. This field can be set manually or - * is set when calling `setFromCamera()`. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * Allows to selectively ignore 3D objects when performing intersection tests. - * The following code example ensures that only 3D objects on layer `1` will be - * honored by raycaster. - * ```js - * raycaster.layers.set( 1 ); - * object.layers.enable( 1 ); - * ``` - * - * @type {Layers} - */ - layers: Layers; - /** - * A parameter object that configures the raycasting. It has the structure: - * - * ``` - * { - * Mesh: {}, - * Line: { threshold: 1 }, - * LOD: {}, - * Points: { threshold: 1 }, - * Sprite: {} - * } - * ``` - * Where `threshold` is the precision of the raycaster when intersecting objects, in world units. - * - * @type {Object} - */ - params: Object; - /** - * Updates the ray with a new origin and direction by copying the values from the arguments. - * - * @param {Vector3} origin - The origin vector where the ray casts from. - * @param {Vector3} direction - The (normalized) direction vector that gives direction to the ray. - */ - set(origin: Vector3, direction: Vector3): void; - /** - * Uses the given coordinates and camera to compute a new origin and direction for the internal ray. - * - * @param {Vector2} coords - 2D coordinates of the mouse, in normalized device coordinates (NDC). - * X and Y components should be between `-1` and `1`. - * @param {Camera} camera - The camera from which the ray should originate. - */ - setFromCamera(coords: Vector2, camera: Camera): void; - /** - * Uses the given WebXR controller to compute a new origin and direction for the internal ray. - * - * @param {WebXRController} controller - The controller to copy the position and direction from. - * @return {Raycaster} A reference to this raycaster. - */ - setFromXRController(controller: WebXRController): Raycaster; - /** - * The intersection point of a raycaster intersection test. - * @typedef {Object} Raycaster~Intersection - * @property {number} distance - The distance from the ray's origin to the intersection point. - * @property {number} distanceToRay - Some 3D objects e.g. {@link Points} provide the distance of the - * intersection to the nearest point on the ray. For other objects it will be `undefined`. - * @property {Vector3} point - The intersection point, in world coordinates. - * @property {Object} face - The face that has been intersected. - * @property {number} faceIndex - The face index. - * @property {Object3D} object - The 3D object that has been intersected. - * @property {Vector2} uv - U,V coordinates at point of intersection. - * @property {Vector2} uv1 - Second set of U,V coordinates at point of intersection. - * @property {Vector3} normal - Interpolated normal vector at point of intersection. - * @property {number} instanceId - The index number of the instance where the ray - * intersects the {@link InstancedMesh}. - */ - /** - * Checks all intersection between the ray and the object with or without the - * descendants. Intersections are returned sorted by distance, closest first. - * - * `Raycaster` delegates to the `raycast()` method of the passed 3D object, when - * evaluating whether the ray intersects the object or not. This allows meshes to respond - * differently to ray casting than lines or points. - * - * Note that for meshes, faces must be pointed towards the origin of the ray in order - * to be detected; intersections of the ray passing through the back of a face will not - * be detected. To raycast against both faces of an object, you'll want to set {@link Material#side} - * to `THREE.DoubleSide`. - * - * Note that a ray hitting a triangle mesh exactly along an edge shared by two faces may be - * reported by both faces, resulting in two coincident intersections (identical point and - * distance) in the returned array. - * - * @param {Object3D} object - The 3D object to check for intersection with the ray. - * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. - * Otherwise it only checks intersection with the object. - * @param {Array} [intersects=[]] The target array that holds the result of the method. - * @return {Array} An array holding the intersection points. - */ - intersectObject(object: Object3D, recursive?: boolean, intersects?: any[]): Array; - /** - * Checks all intersection between the ray and the objects with or without - * the descendants. Intersections are returned sorted by distance, closest first. - * - * @param {Array} objects - The 3D objects to check for intersection with the ray. - * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants. - * Otherwise it only checks intersection with the object. - * @param {Array} [intersects=[]] The target array that holds the result of the method. - * @return {Array} An array holding the intersection points. - */ - intersectObjects(objects: Array, recursive?: boolean, intersects?: any[]): Array; -} -import { Ray } from '../math/Ray.js'; -import { Layers } from './Layers.js'; diff --git a/jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts b/jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts deleted file mode 100644 index 772ac985d..000000000 --- a/jsdoc-testing/jsdoc/src/core/RenderTarget.d.ts +++ /dev/null @@ -1,269 +0,0 @@ -/** - * A render target is a buffer where the video card draws pixels for a scene - * that is being rendered in the background. It is used in different effects, - * such as applying postprocessing to a rendered image before displaying it - * on the screen. - * - * @augments EventDispatcher - */ -export class RenderTarget extends EventDispatcher { - /** - * Render target options. - * - * @typedef {Object} RenderTarget~Options - * @property {boolean} [generateMipmaps=false] - Whether to generate mipmaps or not. - * @property {number} [magFilter=LinearFilter] - The mag filter. - * @property {number} [minFilter=LinearFilter] - The min filter. - * @property {number} [format=RGBAFormat] - The texture format. - * @property {number} [type=UnsignedByteType] - The texture type. - * @property {?string} [internalFormat=null] - The texture's internal format. - * @property {number} [wrapS=ClampToEdgeWrapping] - The texture's uv wrapping mode. - * @property {number} [wrapT=ClampToEdgeWrapping] - The texture's uv wrapping mode. - * @property {number} [anisotropy=1] - The texture's anisotropy value. - * @property {string} [colorSpace=NoColorSpace] - The texture's color space. - * @property {boolean} [depthBuffer=true] - Whether to allocate a depth buffer or not. - * @property {boolean} [stencilBuffer=false] - Whether to allocate a stencil buffer or not. - * @property {boolean} [resolveColorBuffer=true] - Whether to resolve the color buffer or not. Only relevant for multisampled render targets. - * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not. Only relevant for multisampled render targets. - * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not. Only relevant for multisampled render targets. - * @property {boolean} [storeMultisampledColorBuffer=true] - Whether to store the multisampled color buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass. - * @property {boolean} [storeMultisampledDepthBuffer=true] - Whether to store the multisampled depth buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass. - * @property {boolean} [storeMultisampledStencilBuffer=true] - Whether to store the multisampled stencil buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass. - * @property {?Texture} [depthTexture=null] - Reference to a depth texture. - * @property {number} [samples=0] - The MSAA samples count. - * @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`. - * @property {number} [depth=1] - The texture depth. - * @property {boolean} [multiview=false] - Whether this target is used for multiview rendering (WebGL OVR_multiview2 extension). - * @property {boolean} [useArrayDepthTexture=false] - Whether to create the depth texture as an array texture for per-layer depth testing. This is separate from multiview so layered render targets can use array depth without the multiview extension. - */ - /** - * Constructs a new render target. - * - * @param {number} [width=1] - The width of the render target. - * @param {number} [height=1] - The height of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(width?: number, height?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderTarget: boolean; - /** - * The width of the render target. - * - * @type {number} - * @default 1 - */ - width: number; - /** - * The height of the render target. - * - * @type {number} - * @default 1 - */ - height: number; - /** - * The depth of the render target. - * - * @type {number} - * @default 1 - */ - depth: number; - /** - * A rectangular area inside the render target's viewport. Fragments that are - * outside the area will be discarded. - * - * @type {Vector4} - * @default (0,0,width,height) - */ - scissor: Vector4; - /** - * Indicates whether the scissor test should be enabled when rendering into - * this render target or not. - * - * @type {boolean} - * @default false - */ - scissorTest: boolean; - /** - * A rectangular area representing the render target's viewport. - * - * @type {Vector4} - * @default (0,0,width,height) - */ - viewport: Vector4; - /** - * An array of textures. Each color attachment is represented as a separate texture. - * Has at least a single entry for the default color attachment. - * - * @type {Array} - */ - textures: Array; - /** - * Whether to allocate a depth buffer or not. - * - * @type {boolean} - * @default true - */ - depthBuffer: boolean; - /** - * Whether to allocate a stencil buffer or not. - * - * @type {boolean} - * @default false - */ - stencilBuffer: boolean; - /** - * Whether to resolve the color buffer or not. When set to `false`, the color - * attachments do not receive the resolved (single-sampled) output of a render - * pass and the render target's textures are left untouched. The rendered - * content is then only accessible within the render pass itself. - * - * Only relevant for multisampled render targets. - * - * @type {boolean} - * @default true - */ - resolveColorBuffer: boolean; - /** - * Whether to resolve the depth buffer or not. When set to `false`, the depth - * texture does not receive the resolved depth output of a render pass which - * saves memory bandwidth. Use this setting when the depth data of a render - * pass are not required afterwards. - * - * Only relevant for multisampled render targets in WebGL. WebGPU does not - * support depth resolves; sampling the depth texture of a multisampled render - * target accesses the multisampled data directly, see - * {@link RenderTarget#storeMultisampledDepthBuffer}. - * - * @type {boolean} - * @default true - */ - resolveDepthBuffer: boolean; - /** - * Whether to resolve the stencil buffer or not. Analogous to - * {@link RenderTarget#resolveDepthBuffer} but for the stencil aspect. - * - * @type {boolean} - * @default true - */ - resolveStencilBuffer: boolean; - /** - * Whether to store the multisampled color buffer or not. When set to `false`, - * the multisampled data are discarded at the end of a render pass, right after - * they have been resolved. This saves memory bandwidth, especially on tile-based - * GPUs, and is the recommended setting for render targets that are fully redrawn - * each frame and whose output is only accessed via the resolved textures (e.g. - * scene passes in post-processing chains). - * - * Must be kept `true` when the multisampled data are needed after the render - * pass ends, e.g. when rendering into the target without clearing or when the - * scene contains transmissive objects which require a mid-pass framebuffer copy. - * - * @type {boolean} - * @default true - */ - storeMultisampledColorBuffer: boolean; - /** - * Whether to store the multisampled depth buffer or not. When set to `false`, - * the multisampled depth data are discarded at the end of a render pass which - * saves memory bandwidth. - * - * Must be kept `true` in WebGPU when the depth texture of a multisampled render - * target is sampled (e.g. by depth-based post-processing effects) since depth - * is read directly from the multisampled data. - * - * @type {boolean} - * @default true - */ - storeMultisampledDepthBuffer: boolean; - /** - * Whether to store the multisampled stencil buffer or not. Analogous to - * {@link RenderTarget#storeMultisampledDepthBuffer} but for the stencil aspect. - * - * @type {boolean} - * @default true - */ - storeMultisampledStencilBuffer: boolean; - _depthTexture: any; - set depthTexture(current: DepthTexture | null); - /** - * Instead of saving the depth in a renderbuffer, a texture - * can be used instead which is useful for further processing - * e.g. in context of post-processing. - * - * @type {?DepthTexture} - * @default null - */ - get depthTexture(): DepthTexture | null; - /** - * The number of MSAA samples. - * - * A value of `0` disables MSAA. - * - * @type {number} - * @default 0 - */ - samples: number; - /** - * Whether to this target is used in multiview rendering. - * - * @type {boolean} - * @default false - */ - multiview: boolean; - /** - * Whether to create the depth texture as an array texture for per-layer depth testing. - * This is separate from multiview so layered render targets can use array depth without - * the multiview extension. - * - * @type {boolean} - * @default false - */ - useArrayDepthTexture: boolean; - _setTextureOptions(options?: {}): void; - set texture(value: Texture); - /** - * The texture representing the default color attachment. - * - * @type {Texture} - */ - get texture(): Texture; - /** - * Sets the size of this render target. - * - * @param {number} width - The width. - * @param {number} height - The height. - * @param {number} [depth=1] - The depth. - */ - setSize(width: number, height: number, depth?: number): void; - /** - * Returns a new render target with copied values from this instance. - * - * @return {RenderTarget} A clone of this instance. - */ - clone(): RenderTarget; - /** - * Copies the settings of the given render target. This is a structural copy so - * no resources are shared between render targets after the copy. That includes - * all MRT textures and the depth texture. - * - * @param {RenderTarget} source - The render target to copy. - * @return {RenderTarget} A reference to this instance. - */ - copy(source: RenderTarget): RenderTarget; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * @fires RenderTarget#dispose - */ - dispose(): void; -} -import { EventDispatcher } from './EventDispatcher.js'; -import { Vector4 } from '../math/Vector4.js'; -import { Texture } from '../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts b/jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts deleted file mode 100644 index 11621efd2..000000000 --- a/jsdoc-testing/jsdoc/src/core/RenderTarget3D.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Represents a 3D render target. - * - * @augments RenderTarget - */ -export class RenderTarget3D extends RenderTarget { - /** - * Constructs a new 3D render target. - * - * @param {number} [width=1] - The width of the render target. - * @param {number} [height=1] - The height of the render target. - * @param {number} [depth=1] - The height of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(width?: number, height?: number, depth?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderTarget3D: boolean; -} -import { RenderTarget } from './RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/core/Timer.d.ts b/jsdoc-testing/jsdoc/src/core/Timer.d.ts deleted file mode 100644 index d47c2d4bd..000000000 --- a/jsdoc-testing/jsdoc/src/core/Timer.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This class is an alternative to {@link Clock} with a different API design and behavior. - * The goal is to avoid the conceptual flaws that became apparent in `Clock` over time. - * - * - `Timer` has an `update()` method that updates its internal state. That makes it possible to - * call `getDelta()` and `getElapsed()` multiple times per simulation step without getting different values. - * - The class can make use of the Page Visibility API to avoid large time delta values when the app - * is inactive (e.g. tab switched or browser hidden). - * - * ```js - * const timer = new Timer(); - * timer.connect( document ); // use Page Visibility API - * ``` - */ -export class Timer { - _previousTime: number; - _currentTime: number; - _startTime: number; - _delta: number; - _elapsed: number; - _timescale: number; - _document: Document | null; - _pageVisibilityHandler: typeof handleVisibilityChange | null; - /** - * Connect the timer to the given document.Calling this method is not mandatory to - * use the timer but enables the usage of the Page Visibility API to avoid large time - * delta values. - * - * @param {Document} document - The document. - */ - connect(document: Document): void; - /** - * Disconnects the timer from the DOM and also disables the usage of the Page Visibility API. - */ - disconnect(): void; - /** - * Returns the time delta in seconds. - * - * @return {number} The time delta in second. - */ - getDelta(): number; - /** - * Returns the elapsed time in seconds. - * - * @return {number} The elapsed time in second. - */ - getElapsed(): number; - /** - * Returns the timescale. - * - * @return {number} The timescale. - */ - getTimescale(): number; - /** - * Sets the given timescale which scale the time delta computation - * in `update()`. - * - * @param {number} timescale - The timescale to set. - * @return {Timer} A reference to this timer. - */ - setTimescale(timescale: number): Timer; - /** - * Resets the time computation for the current simulation step. - * - * @return {Timer} A reference to this timer. - */ - reset(): Timer; - /** - * Can be used to free all internal resources. Usually called when - * the timer instance isn't required anymore. - */ - dispose(): void; - /** - * Updates the internal state of the timer. This method should be called - * once per simulation step and before you perform queries against the timer - * (e.g. via `getDelta()`). - * - * @param {number} timestamp - The current time in milliseconds. Can be obtained - * from the `requestAnimationFrame` callback argument. If not provided, the current - * time will be determined with `performance.now`. - * @return {Timer} A reference to this timer. - */ - update(timestamp: number): Timer; -} -declare function handleVisibilityChange(): void; -export {}; diff --git a/jsdoc-testing/jsdoc/src/core/Uniform.d.ts b/jsdoc-testing/jsdoc/src/core/Uniform.d.ts deleted file mode 100644 index 4febfde95..000000000 --- a/jsdoc-testing/jsdoc/src/core/Uniform.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Represents a uniform which is a global shader variable. They are passed to shader programs. - * - * When declaring a uniform of a {@link ShaderMaterial}, it is declared by value or by object. - * ```js - * uniforms: { - * time: { value: 1.0 }, - * resolution: new Uniform( new Vector2() ) - * }; - * ``` - * Since this class can only be used in context of {@link ShaderMaterial}, it is only supported - * in {@link WebGLRenderer}. - */ -export class Uniform { - /** - * Constructs a new uniform. - * - * @param {any} value - The uniform value. - */ - constructor(value: any); - /** - * The uniform value. - * - * @type {any} - */ - value: any; - /** - * Returns a new uniform with copied values from this instance. - * If the value has a `clone()` method, the value is cloned as well. - * - * @return {Uniform} A clone of this instance. - */ - clone(): Uniform; -} diff --git a/jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts b/jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts deleted file mode 100644 index fd08bb44b..000000000 --- a/jsdoc-testing/jsdoc/src/core/UniformsGroup.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * A class for managing multiple uniforms in a single group. The renderer will process - * such a definition as a single UBO. - * - * Since this class can only be used in context of {@link ShaderMaterial}, it is only supported - * in {@link WebGLRenderer}. - * - * @augments EventDispatcher - */ -export class UniformsGroup extends EventDispatcher { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformsGroup: boolean; - /** - * The name of the uniforms group. - * - * @type {string} - */ - name: string; - /** - * The buffer usage. - * - * @type {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} - * @default StaticDrawUsage - */ - usage: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage); - /** - * An array holding the uniforms. - * - * @type {Array} - */ - uniforms: Array; - /** - * Adds the given uniform to this uniforms group. - * - * @param {Uniform} uniform - The uniform to add. - * @return {UniformsGroup} A reference to this uniforms group. - */ - add(uniform: Uniform): UniformsGroup; - /** - * Removes the given uniform from this uniforms group. - * - * @param {Uniform} uniform - The uniform to remove. - * @return {UniformsGroup} A reference to this uniforms group. - */ - remove(uniform: Uniform): UniformsGroup; - /** - * Sets the name of this uniforms group. - * - * @param {string} name - The name to set. - * @return {UniformsGroup} A reference to this uniforms group. - */ - setName(name: string): UniformsGroup; - /** - * Sets the usage of this uniforms group. - * - * @param {(StaticDrawUsage|DynamicDrawUsage|StreamDrawUsage|StaticReadUsage|DynamicReadUsage|StreamReadUsage|StaticCopyUsage|DynamicCopyUsage|StreamCopyUsage)} value - The usage to set. - * @return {UniformsGroup} A reference to this uniforms group. - */ - setUsage(value: (number | DynamicDrawUsage | StreamDrawUsage | StaticReadUsage | DynamicReadUsage | StreamReadUsage | StaticCopyUsage | DynamicCopyUsage | StreamCopyUsage)): UniformsGroup; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * @fires Texture#dispose - */ - dispose(): void; - /** - * Copies the values of the given uniforms group to this instance. - * - * @param {UniformsGroup} source - The uniforms group to copy. - * @return {UniformsGroup} A reference to this uniforms group. - */ - copy(source: UniformsGroup): UniformsGroup; - /** - * Returns a new uniforms group with copied values from this instance. - * - * @return {UniformsGroup} A clone of this instance. - */ - clone(): UniformsGroup; -} -import { EventDispatcher } from './EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/Controls.d.ts b/jsdoc-testing/jsdoc/src/extras/Controls.d.ts deleted file mode 100644 index f9b5a381f..000000000 --- a/jsdoc-testing/jsdoc/src/extras/Controls.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Abstract base class for controls. - * - * @abstract - * @augments EventDispatcher - */ -export class Controls extends EventDispatcher { - /** - * Constructs a new controls instance. - * - * @param {Object3D} object - The object that is managed by the controls. - * @param {?HTMLElement} domElement - The HTML element used for event listeners. - */ - constructor(object: Object3D, domElement?: HTMLElement | null); - /** - * The object that is managed by the controls. - * - * @type {Object3D} - */ - object: Object3D; - /** - * The HTML element used for event listeners. - * - * @type {?HTMLElement} - * @default null - */ - domElement: HTMLElement | null; - /** - * Whether the controls responds to user input or not. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * The internal state of the controls. - * - * @type {number} - * @default -1 - */ - state: number; - /** - * This object defines the keyboard input of the controls. - * - * @type {Object} - */ - keys: Object; - /** - * This object defines what type of actions are assigned to the available mouse buttons. - * It depends on the control implementation what kind of mouse buttons and actions are supported. - * - * @type {{LEFT: ?number, MIDDLE: ?number, RIGHT: ?number}} - */ - mouseButtons: { - LEFT: number | null; - MIDDLE: number | null; - RIGHT: number | null; - }; - /** - * This object defines what type of actions are assigned to what kind of touch interaction. - * It depends on the control implementation what kind of touch interaction and actions are supported. - * - * @type {{ONE: ?number, TWO: ?number}} - */ - touches: { - ONE: number | null; - TWO: number | null; - }; - /** - * Connects the controls to the DOM. This method has so called "side effects" since - * it adds the module's event listeners to the DOM. - * - * @param {HTMLElement} element - The DOM element to connect to. - */ - connect(element: HTMLElement): void; - /** - * Disconnects the controls from the DOM. - */ - disconnect(): void; - /** - * Call this method if you no longer want use to the controls. It frees all internal - * resources and removes all event listeners. - */ - dispose(): void; - /** - * Controls should implement this method if they have to update their internal state - * per simulation step. - * - * @param {number} [delta] - The time delta in seconds. - */ - update(): void; -} -import { EventDispatcher } from '../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts deleted file mode 100644 index 66cfe1590..000000000 --- a/jsdoc-testing/jsdoc/src/extras/DataUtils.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Returns a half precision floating point value (FP16) from the given single - * precision floating point value (FP32). - * - * @param {number} val - A single precision floating point value. - * @return {number} The FP16 value. - */ -export function toHalfFloat(val: number): number; -/** - * Returns a single precision floating point value (FP32) from the given half - * precision floating point value (FP16). - * - * @param {number} val - A half precision floating point value. - * @return {number} The FP32 value. - */ -export function fromHalfFloat(val: number): number; -/** - * A class containing utility functions for data. - * - * @hideconstructor - */ -export class DataUtils { - /** - * Returns a half precision floating point value (FP16) from the given single - * precision floating point value (FP32). - * - * @param {number} val - A single precision floating point value. - * @return {number} The FP16 value. - */ - static toHalfFloat(val: number): number; - /** - * Returns a single precision floating point value (FP32) from the given half - * precision floating point value (FP16). - * - * @param {number} val - A half precision floating point value. - * @return {number} The FP32 value. - */ - static fromHalfFloat(val: number): number; -} diff --git a/jsdoc-testing/jsdoc/src/extras/Earcut.d.ts b/jsdoc-testing/jsdoc/src/extras/Earcut.d.ts deleted file mode 100644 index 77d051e6a..000000000 --- a/jsdoc-testing/jsdoc/src/extras/Earcut.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * An implementation of the earcut polygon triangulation algorithm. - * The code is a port of [mapbox/earcut](https://github.com/mapbox/earcut). - * - * @see https://github.com/mapbox/earcut - */ -export class Earcut { - /** - * Triangulates the given shape definition by returning an array of triangles. - * - * @param {Array} data - An array with 2D points. - * @param {Array} holeIndices - An array with indices defining holes. - * @param {number} [dim=2] - The number of coordinates per vertex in the input array. - * @return {Array} An array representing the triangulated faces. Each face is defined by three consecutive numbers - * representing vertex indices. - */ - static triangulate(data: Array, holeIndices: Array, dim?: number): Array; -} diff --git a/jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts deleted file mode 100644 index 26077e10c..000000000 --- a/jsdoc-testing/jsdoc/src/extras/ImageUtils.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A class containing utility functions for images. - * - * @hideconstructor - */ -export class ImageUtils { - /** - * Returns a data URI containing a representation of the given image. - * - * @param {(HTMLImageElement|HTMLCanvasElement)} image - The image object. - * @param {string} [type='image/png'] - Indicates the image format. - * @return {string} The data URI. - */ - static getDataURL(image: (HTMLImageElement | HTMLCanvasElement), type?: string): string; - /** - * Converts the given sRGB image data to linear color space. - * - * @param {(HTMLImageElement|HTMLCanvasElement|ImageBitmap|Object)} image - The image object. - * @return {HTMLCanvasElement|Object} The converted image. - */ - static sRGBToLinear(image: (HTMLImageElement | HTMLCanvasElement | ImageBitmap | Object)): HTMLCanvasElement | Object; -} diff --git a/jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts b/jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts deleted file mode 100644 index f306c169b..000000000 --- a/jsdoc-testing/jsdoc/src/extras/PMREMGenerator.d.ts +++ /dev/null @@ -1,520 +0,0 @@ -/** - * This class generates a Prefiltered, Mipmapped Radiance Environment Map - * (PMREM) from a cubeMap environment texture. This allows different levels of - * blur to be quickly accessed based on material roughness. It is packed into a - * special CubeUV format that allows us to perform custom interpolation so that - * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap - * chain, it only goes down to the LOD_MIN level (above), and then creates extra - * even more filtered 'mips' at the same LOD_MIN resolution, associated with - * higher roughness levels. In this way we maintain resolution to smoothly - * interpolate diffuse lighting while limiting sampling computation. - * - * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) - * importance sampling based on "Sampling the GGX Distribution of Visible Normals" - * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF - * used in material rendering for physically-based image-based lighting. - */ -export class PMREMGenerator { - /** - * Constructs a new PMREM generator. - * - * @param {WebGLRenderer} renderer - The renderer. - */ - constructor(renderer: WebGLRenderer); - _renderer: WebGLRenderer; - _pingPongRenderTarget: any; - _lodMax: number; - _cubeSize: number; - _sizeLods: any[]; - _lodMeshes: any[]; - _backgroundBox: Mesh | null; - _cubemapMaterial: { - readonly isShaderMaterial: boolean; - type: string; - defines: Object; - uniforms: Object; - uniformsGroups: Array; - vertexShader: string; - fragmentShader: string; - linewidth: number; - wireframe: boolean; - wireframeLinewidth: number; - fog: boolean; - lights: boolean; - clipping: boolean; - forceSinglePass: boolean; - extensions: { - clipCullDistance: false; - multiDraw: false; - }; - defaultAttributeValues: Object; - index0AttributeName: string | undefined; - uniformsNeedUpdate: boolean; - glslVersion: (GLSL1 | GLSL3) | null; - copy(source: any): /*elided*/ any; - toJSON(meta: any): Object; - fromJSON(json: Object, textures: { - [x: string]: Texture; - }): /*elided*/ any; - readonly isMaterial: boolean; - readonly uuid: string; - name: string; - blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); - side: (number | BackSide | DoubleSide); - vertexColors: boolean; - opacity: number; - transparent: boolean; - alphaHash: boolean; - blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); - blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; - blendColor: Color; - blendAlpha: number; - depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); - depthTest: boolean; - depthWrite: boolean; - stencilWriteMask: number; - stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; - stencilRef: number; - stencilFuncMask: number; - stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilWrite: boolean; - clippingPlanes: Array | null; - clipIntersection: boolean; - clipShadows: boolean; - shadowSide: (number | BackSide | DoubleSide) | null; - colorWrite: boolean; - precision: ("highp" | "mediump" | "lowp") | null; - polygonOffset: boolean; - polygonOffsetFactor: number; - polygonOffsetUnits: number; - dithering: boolean; - alphaToCoverage: boolean; - premultipliedAlpha: boolean; - allowOverride: boolean; - visible: boolean; - toneMapped: boolean; - userData: Object; - readonly version: number; - _alphaTest: number; - get alphaTest(): number; - set alphaTest(value: number); - onBeforeRender(): void; - onBeforeCompile(): void; - customProgramCacheKey(): string; - setValues(values?: Object): void; - clone(): Material; - dispose(): void; - set needsUpdate(value: boolean); - addEventListener(type: string, listener: Function): void; - _listeners: {} | undefined; - hasEventListener(type: string, listener: Function): boolean; - removeEventListener(type: string, listener: Function): void; - dispatchEvent(event: Object): void; - } | null; - _equirectMaterial: { - readonly isShaderMaterial: boolean; - type: string; - defines: Object; - uniforms: Object; - uniformsGroups: Array; - vertexShader: string; - fragmentShader: string; - linewidth: number; - wireframe: boolean; - wireframeLinewidth: number; - fog: boolean; - lights: boolean; - clipping: boolean; - forceSinglePass: boolean; - extensions: { - clipCullDistance: false; - multiDraw: false; - }; - defaultAttributeValues: Object; - index0AttributeName: string | undefined; - uniformsNeedUpdate: boolean; - glslVersion: (GLSL1 | GLSL3) | null; - copy(source: any): /*elided*/ any; - toJSON(meta: any): Object; - fromJSON(json: Object, textures: { - [x: string]: Texture; - }): /*elided*/ any; - readonly isMaterial: boolean; - readonly uuid: string; - name: string; - blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); - side: (number | BackSide | DoubleSide); - vertexColors: boolean; - opacity: number; - transparent: boolean; - alphaHash: boolean; - blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); - blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; - blendColor: Color; - blendAlpha: number; - depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); - depthTest: boolean; - depthWrite: boolean; - stencilWriteMask: number; - stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; - stencilRef: number; - stencilFuncMask: number; - stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilWrite: boolean; - clippingPlanes: Array | null; - clipIntersection: boolean; - clipShadows: boolean; - shadowSide: (number | BackSide | DoubleSide) | null; - colorWrite: boolean; - precision: ("highp" | "mediump" | "lowp") | null; - polygonOffset: boolean; - polygonOffsetFactor: number; - polygonOffsetUnits: number; - dithering: boolean; - alphaToCoverage: boolean; - premultipliedAlpha: boolean; - allowOverride: boolean; - visible: boolean; - toneMapped: boolean; - userData: Object; - readonly version: number; - _alphaTest: number; - get alphaTest(): number; - set alphaTest(value: number); - onBeforeRender(): void; - onBeforeCompile(): void; - customProgramCacheKey(): string; - setValues(values?: Object): void; - clone(): Material; - dispose(): void; - set needsUpdate(value: boolean); - addEventListener(type: string, listener: Function): void; - _listeners: {} | undefined; - hasEventListener(type: string, listener: Function): boolean; - removeEventListener(type: string, listener: Function): void; - dispatchEvent(event: Object): void; - } | null; - _blurMaterial: { - readonly isShaderMaterial: boolean; - type: string; - defines: Object; - uniforms: Object; - uniformsGroups: Array; - vertexShader: string; - fragmentShader: string; - linewidth: number; - wireframe: boolean; - wireframeLinewidth: number; - fog: boolean; - lights: boolean; - clipping: boolean; - forceSinglePass: boolean; - extensions: { - clipCullDistance: false; - multiDraw: false; - }; - defaultAttributeValues: Object; - index0AttributeName: string | undefined; - uniformsNeedUpdate: boolean; - glslVersion: (GLSL1 | GLSL3) | null; - copy(source: any): /*elided*/ any; - toJSON(meta: any): Object; - fromJSON(json: Object, textures: { - [x: string]: Texture; - }): /*elided*/ any; - readonly isMaterial: boolean; - readonly uuid: string; - name: string; - blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); - side: (number | BackSide | DoubleSide); - vertexColors: boolean; - opacity: number; - transparent: boolean; - alphaHash: boolean; - blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); - blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; - blendColor: Color; - blendAlpha: number; - depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); - depthTest: boolean; - depthWrite: boolean; - stencilWriteMask: number; - stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; - stencilRef: number; - stencilFuncMask: number; - stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilWrite: boolean; - clippingPlanes: Array | null; - clipIntersection: boolean; - clipShadows: boolean; - shadowSide: (number | BackSide | DoubleSide) | null; - colorWrite: boolean; - precision: ("highp" | "mediump" | "lowp") | null; - polygonOffset: boolean; - polygonOffsetFactor: number; - polygonOffsetUnits: number; - dithering: boolean; - alphaToCoverage: boolean; - premultipliedAlpha: boolean; - allowOverride: boolean; - visible: boolean; - toneMapped: boolean; - userData: Object; - readonly version: number; - _alphaTest: number; - get alphaTest(): number; - set alphaTest(value: number); - onBeforeRender(): void; - onBeforeCompile(): void; - customProgramCacheKey(): string; - setValues(values?: Object): void; - clone(): Material; - dispose(): void; - set needsUpdate(value: boolean); - addEventListener(type: string, listener: Function): void; - _listeners: {} | undefined; - hasEventListener(type: string, listener: Function): boolean; - removeEventListener(type: string, listener: Function): void; - dispatchEvent(event: Object): void; - } | null; - _ggxMaterial: { - readonly isShaderMaterial: boolean; - type: string; - defines: Object; - uniforms: Object; - uniformsGroups: Array; - vertexShader: string; - fragmentShader: string; - linewidth: number; - wireframe: boolean; - wireframeLinewidth: number; - fog: boolean; - lights: boolean; - clipping: boolean; - forceSinglePass: boolean; - extensions: { - clipCullDistance: false; - multiDraw: false; - }; - defaultAttributeValues: Object; - index0AttributeName: string | undefined; - uniformsNeedUpdate: boolean; - glslVersion: (GLSL1 | GLSL3) | null; - copy(source: any): /*elided*/ any; - toJSON(meta: any): Object; - fromJSON(json: Object, textures: { - [x: string]: Texture; - }): /*elided*/ any; - readonly isMaterial: boolean; - readonly uuid: string; - name: string; - blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); - side: (number | BackSide | DoubleSide); - vertexColors: boolean; - opacity: number; - transparent: boolean; - alphaHash: boolean; - blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); - blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; - blendColor: Color; - blendAlpha: number; - depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); - depthTest: boolean; - depthWrite: boolean; - stencilWriteMask: number; - stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; - stencilRef: number; - stencilFuncMask: number; - stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilWrite: boolean; - clippingPlanes: Array | null; - clipIntersection: boolean; - clipShadows: boolean; - shadowSide: (number | BackSide | DoubleSide) | null; - colorWrite: boolean; - precision: ("highp" | "mediump" | "lowp") | null; - polygonOffset: boolean; - polygonOffsetFactor: number; - polygonOffsetUnits: number; - dithering: boolean; - alphaToCoverage: boolean; - premultipliedAlpha: boolean; - allowOverride: boolean; - visible: boolean; - toneMapped: boolean; - userData: Object; - readonly version: number; - _alphaTest: number; - get alphaTest(): number; - set alphaTest(value: number); - onBeforeRender(): void; - onBeforeCompile(): void; - customProgramCacheKey(): string; - setValues(values?: Object): void; - clone(): Material; - dispose(): void; - set needsUpdate(value: boolean); - addEventListener(type: string, listener: Function): void; - _listeners: {} | undefined; - hasEventListener(type: string, listener: Function): boolean; - removeEventListener(type: string, listener: Function): void; - dispatchEvent(event: Object): void; - } | null; - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety. - * - * @param {Scene} scene - The scene to be captured. - * @param {number} [sigma=0] - The blur radius in radians. - * @param {number} [near=0.1] - The near plane distance. - * @param {number} [far=100] - The far plane distance. - * @param {Object} [options={}] - The configuration options. - * @param {number} [options.size=256] - The texture size of the PMREM. - * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. - * @return {WebGLRenderTarget} The resulting PMREM. - */ - fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { - size?: number | undefined; - position?: Vector3 | undefined; - }): WebGLRenderTarget; - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best - * with the 256 x 256 cubemap output. The minimum supported input image size - * is 64 x 32. - * - * @param {Texture} equirectangular - The equirectangular texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ - fromEquirectangular(equirectangular: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?WebGLRenderTarget} [renderTarget=null] - The render target to use. - * @return {WebGLRenderTarget} The resulting PMREM. - */ - fromCubemap(cubemap: Texture, renderTarget?: WebGLRenderTarget | null): WebGLRenderTarget; - /** - * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileCubemapShader(): void; - /** - * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - */ - compileEquirectangularShader(): void; - /** - * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, - * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on - * one of them will cause any others to also become unusable. - */ - dispose(): void; - _setSize(cubeSize: any): void; - _dispose(): void; - _cleanup(outputTarget: any): void; - _fromTexture(texture: any, renderTarget: any): any; - _allocateTargets(): WebGLRenderTarget; - _compileMaterial(material: any): void; - _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; - _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; - _applyPMREM(cubeUVRenderTarget: any): void; - /** - * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. - * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the - * GGX BRDF for physically-based rendering. Reads from the previous LOD level and - * applies incremental roughness filtering to avoid over-blurring. - * - * @private - * @param {WebGLRenderTarget} cubeUVRenderTarget - * @param {number} lodIn - Source LOD level to read from - * @param {number} lodOut - Target LOD level to write to - */ - private _applyGGXFilter; - /** - * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples - * the Gaussian along a spiral kernel (Golden Angle), which distributes samples - * isotropically on the sphere (no pole artifacts). - * - * Used for initial scene blur in fromScene() method when sigma > 0. - * - * @private - * @param {WebGLRenderTarget} cubeUVRenderTarget - * @param {number} lodIn - * @param {number} lodOut - * @param {number} sigma - */ - private _blur; - _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; -} -import { Mesh } from '../objects/Mesh.js'; -import { Color } from '../math/Color.js'; -import { Vector3 } from '../math/Vector3.js'; -import { WebGLRenderTarget } from '../renderers/WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts deleted file mode 100644 index 333966c85..000000000 --- a/jsdoc-testing/jsdoc/src/extras/ShapeUtils.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * A class containing utility functions for shapes. - * - * @hideconstructor - */ -export class ShapeUtils { - /** - * Calculate area of a ( 2D ) contour polygon. - * - * @param {Array} contour - An array of 2D points. - * @return {number} The area. - */ - static area(contour: Array): number; - /** - * Returns `true` if the given contour uses a clockwise winding order. - * - * @param {Array} pts - An array of 2D points defining a polygon. - * @return {boolean} Whether the given contour uses a clockwise winding order or not. - */ - static isClockWise(pts: Array): boolean; - /** - * Triangulates the given shape definition. - * - * @param {Array} contour - An array of 2D points defining the contour. - * @param {Array>} holes - An array that holds arrays of 2D points defining the holes. - * @return {Array>} An array that holds for each face definition an array with three indices. - */ - static triangulateShape(contour: Array, holes: Array>): Array>; -} diff --git a/jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts b/jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts deleted file mode 100644 index 5de7a1677..000000000 --- a/jsdoc-testing/jsdoc/src/extras/TextureUtils.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Scales the texture as large as possible within its surface without cropping - * or stretching the texture. The method preserves the original aspect ratio of - * the texture. Akin to CSS `object-fit: contain` - * - * @param {Texture} texture - The texture. - * @param {number} aspect - The texture's aspect ratio. - * @return {Texture} The updated texture. - */ -export function contain(texture: Texture, aspect: number): Texture; -/** - * Scales the texture to the smallest possible size to fill the surface, leaving - * no empty space. The method preserves the original aspect ratio of the texture. - * Akin to CSS `object-fit: cover`. - * - * @param {Texture} texture - The texture. - * @param {number} aspect - The texture's aspect ratio. - * @return {Texture} The updated texture. - */ -export function cover(texture: Texture, aspect: number): Texture; -/** - * Configures the texture to the default transformation. Akin to CSS `object-fit: fill`. - * - * @param {Texture} texture - The texture. - * @return {Texture} The updated texture. - */ -export function fill(texture: Texture): Texture; -/** - * Determines how many bytes must be used to represent the texture. - * - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {number} format - The texture's format. - * @param {number} type - The texture's type. - * @return {number} The byte length. - */ -export function getByteLength(width: number, height: number, format: number, type: number): number; -/** - * A class containing utility functions for textures. - * - * @hideconstructor - */ -export class TextureUtils { - /** - * Scales the texture as large as possible within its surface without cropping - * or stretching the texture. The method preserves the original aspect ratio of - * the texture. Akin to CSS `object-fit: contain` - * - * @param {Texture} texture - The texture. - * @param {number} aspect - The texture's aspect ratio. - * @return {Texture} The updated texture. - */ - static contain(texture: Texture, aspect: number): Texture; - /** - * Scales the texture to the smallest possible size to fill the surface, leaving - * no empty space. The method preserves the original aspect ratio of the texture. - * Akin to CSS `object-fit: cover`. - * - * @param {Texture} texture - The texture. - * @param {number} aspect - The texture's aspect ratio. - * @return {Texture} The updated texture. - */ - static cover(texture: Texture, aspect: number): Texture; - /** - * Configures the texture to the default transformation. Akin to CSS `object-fit: fill`. - * - * @param {Texture} texture - The texture. - * @return {Texture} The updated texture. - */ - static fill(texture: Texture): Texture; - /** - * Determines how many bytes must be used to represent the texture. - * - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {number} format - The texture's format. - * @param {number} type - The texture's type. - * @return {number} The byte length. - */ - static getByteLength(width: number, height: number, format: number, type: number): number; -} diff --git a/jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts deleted file mode 100644 index ff7e9b470..000000000 --- a/jsdoc-testing/jsdoc/src/extras/core/Curve.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -/** - * An abstract base class for creating an analytic curve object that contains methods - * for interpolation. - * - * @abstract - */ -export class Curve { - /** - * The type property is used for detecting the object type - * in context of serialization/deserialization. - * - * @type {string} - * @readonly - */ - readonly type: string; - /** - * This value determines the amount of divisions when calculating the - * cumulative segment lengths of a curve via {@link Curve#getLengths}. To ensure - * precision when using methods like {@link Curve#getSpacedPoints}, it is - * recommended to increase the value of this property if the curve is very large. - * - * @type {number} - * @default 200 - */ - arcLengthDivisions: number; - /** - * Must be set to `true` if the curve parameters have changed. - * - * @type {boolean} - * @default false - */ - needsUpdate: boolean; - /** - * An internal cache that holds precomputed curve length values. - * - * @private - * @type {?Array} - * @default null - */ - private cacheArcLengths; - /** - * This method returns a vector in 2D or 3D space (depending on the curve definition) - * for the given interpolation factor. - * - * @abstract - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. - * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition. - */ - getPoint(): (Vector2 | Vector3); - /** - * This method returns a vector in 2D or 3D space (depending on the curve definition) - * for the given interpolation factor. Unlike {@link Curve#getPoint}, this method honors the length - * of the curve which equidistant samples. - * - * @param {number} u - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. - * @return {(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition. - */ - getPointAt(u: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3); - /** - * This method samples the curve via {@link Curve#getPoint} and returns an array of points representing - * the curve shape. - * - * @param {number} [divisions=5] - The number of divisions. - * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`. - */ - getPoints(divisions?: number): Array<(Vector2 | Vector3)>; - /** - * This method samples the curve via {@link Curve#getPointAt} and returns an array of points representing - * the curve shape. Unlike {@link Curve#getPoints}, this method returns equi-spaced points across the entire - * curve. - * - * @param {number} [divisions=5] - The number of divisions. - * @return {Array<(Vector2|Vector3)>} An array holding the sampled curve values. The number of points is `divisions + 1`. - */ - getSpacedPoints(divisions?: number): Array<(Vector2 | Vector3)>; - /** - * Returns the total arc length of the curve. - * - * @return {number} The length of the curve. - */ - getLength(): number; - /** - * Returns an array of cumulative segment lengths of the curve. - * - * @param {number} [divisions=this.arcLengthDivisions] - The number of divisions. - * @return {Array} An array holding the cumulative segment lengths. - */ - getLengths(divisions?: number): Array; - /** - * Update the cumulative segment distance cache. The method must be called - * every time curve parameters are changed. If an updated curve is part of a - * composed curve like {@link CurvePath}, this method must be called on the - * composed curve, too. - */ - updateArcLengths(): void; - /** - * Given an interpolation factor in the range `[0,1]`, this method returns an updated - * interpolation factor in the same range that can be ued to sample equidistant points - * from a curve. - * - * @param {number} u - The interpolation factor. - * @param {?number} distance - An optional distance on the curve. - * @return {number} The updated interpolation factor. - */ - getUtoTmapping(u: number, distance?: number | null): number; - /** - * Returns a unit vector tangent for the given interpolation factor. - * If the derived curve does not implement its tangent derivation, - * two points a small delta apart will be used to find its gradient - * which seems to give a reasonable approximation. - * - * @param {number} t - The interpolation factor. - * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. - * @return {(Vector2|Vector3)} The tangent vector. - */ - getTangent(t: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3); - /** - * Same as {@link Curve#getTangent} but with equidistant samples. - * - * @param {number} u - The interpolation factor. - * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. - * @return {(Vector2|Vector3)} The tangent vector. - * @see {@link Curve#getPointAt} - */ - getTangentAt(u: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3); - /** - * Generates the Frenet Frames. Requires a curve definition in 3D space. Used - * in geometries like {@link TubeGeometry} or {@link ExtrudeGeometry}. - * - * @param {number} segments - The number of segments. - * @param {boolean} [closed=false] - Whether the curve is closed or not. - * @return {{tangents: Array, normals: Array, binormals: Array}} The Frenet Frames. - */ - computeFrenetFrames(segments: number, closed?: boolean): { - tangents: Array; - normals: Array; - binormals: Array; - }; - /** - * Returns a new curve with copied values from this instance. - * - * @return {Curve} A clone of this instance. - */ - clone(): Curve; - /** - * Copies the values of the given curve to this instance. - * - * @param {Curve} source - The curve to copy. - * @return {Curve} A reference to this curve. - */ - copy(source: Curve): Curve; - /** - * Serializes the curve into JSON. - * - * @return {Object} A JSON object representing the serialized curve. - * @see {@link ObjectLoader#parse} - */ - toJSON(): Object; - /** - * Deserializes the curve from the given JSON. - * - * @param {Object} json - The JSON holding the serialized curve. - * @return {Curve} A reference to this curve. - */ - fromJSON(json: Object): Curve; -} -import { Vector2 } from '../../math/Vector2.js'; -import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts b/jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts deleted file mode 100644 index a92079be5..000000000 --- a/jsdoc-testing/jsdoc/src/extras/core/CurvePath.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * A base class extending {@link Curve}. `CurvePath` is simply an - * array of connected curves, but retains the API of a curve. - * - * @augments Curve - */ -export class CurvePath extends Curve { - type: string; - /** - * An array of curves defining the - * path. - * - * @type {Array} - */ - curves: Array; - /** - * Whether the path should automatically be closed - * by a line curve. - * - * @type {boolean} - * @default false - */ - autoClose: boolean; - /** - * Adds a curve to this curve path. - * - * @param {Curve} curve - The curve to add. - */ - add(curve: Curve): void; - /** - * Adds a line curve to close the path. - * - * @return {CurvePath} A reference to this curve path. - */ - closePath(): CurvePath; - /** - * This method returns a vector in 2D or 3D space (depending on the curve definitions) - * for the given interpolation factor. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {(Vector2|Vector3)} [optionalTarget] - The optional target vector the result is written to. - * @return {?(Vector2|Vector3)} The position on the curve. It can be a 2D or 3D vector depending on the curve definition. - */ - getPoint(t: number, optionalTarget?: (Vector2 | Vector3)): (Vector2 | Vector3) | null; - cacheLengths: number[] | null | undefined; - /** - * Returns list of cumulative curve lengths of the defined curves. - * - * @return {Array} The curve lengths. - */ - getCurveLengths(): Array; - getSpacedPoints(divisions?: number): any[]; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from './Curve.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts deleted file mode 100644 index aa80afbc8..000000000 --- a/jsdoc-testing/jsdoc/src/extras/core/Interpolations.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Interpolations contains spline and Bézier functions internally used by concrete curve classes. - * - * Bezier Curves formulas obtained from: https://en.wikipedia.org/wiki/B%C3%A9zier_curve - * - * @module Interpolations - */ -/** - * Computes a point on a Catmull-Rom spline. - * - * @param {number} t - The interpolation factor. - * @param {number} p0 - The first control point. - * @param {number} p1 - The second control point. - * @param {number} p2 - The third control point. - * @param {number} p3 - The fourth control point. - * @return {number} The calculated point on a Catmull-Rom spline. - */ -export function CatmullRom(t: number, p0: number, p1: number, p2: number, p3: number): number; -/** - * Computes a point on a Quadratic Bezier curve. - * - * @param {number} t - The interpolation factor. - * @param {number} p0 - The first control point. - * @param {number} p1 - The second control point. - * @param {number} p2 - The third control point. - * @return {number} The calculated point on a Quadratic Bezier curve. - */ -export function QuadraticBezier(t: number, p0: number, p1: number, p2: number): number; -/** - * Computes a point on a Cubic Bezier curve. - * - * @param {number} t - The interpolation factor. - * @param {number} p0 - The first control point. - * @param {number} p1 - The second control point. - * @param {number} p2 - The third control point. - * @param {number} p3 - The fourth control point. - * @return {number} The calculated point on a Cubic Bezier curve. - */ -export function CubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number; diff --git a/jsdoc-testing/jsdoc/src/extras/core/Path.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Path.d.ts deleted file mode 100644 index 521287532..000000000 --- a/jsdoc-testing/jsdoc/src/extras/core/Path.d.ts +++ /dev/null @@ -1,151 +0,0 @@ -/** - * A 2D path representation. The class provides methods for creating paths - * and contours of 2D shapes similar to the 2D Canvas API. - * - * ```js - * const path = new THREE.Path(); - * - * path.lineTo( 0, 0.8 ); - * path.quadraticCurveTo( 0, 1, 0.2, 1 ); - * path.lineTo( 1, 1 ); - * - * const points = path.getPoints(); - * - * const geometry = new THREE.BufferGeometry().setFromPoints( points ); - * const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); - * - * const line = new THREE.Line( geometry, material ); - * scene.add( line ); - * ``` - * - * @augments CurvePath - */ -export class Path extends CurvePath { - /** - * Constructs a new path. - * - * @param {Array} [points] - An array of 2D points defining the path. - */ - constructor(points?: Array); - /** - * The current offset of the path. Any new curve added will start here. - * - * @type {Vector2} - */ - currentPoint: Vector2; - /** - * Creates a path from the given list of points. The points are added - * to the path as instances of {@link LineCurve}. - * - * @param {Array} points - An array of 2D points. - * @return {Path} A reference to this path. - */ - setFromPoints(points: Array): Path; - /** - * Moves {@link Path#currentPoint} to the given point. - * - * @param {number} x - The x coordinate. - * @param {number} y - The y coordinate. - * @return {Path} A reference to this path. - */ - moveTo(x: number, y: number): Path; - /** - * Adds an instance of {@link LineCurve} to the path by connecting - * the current point with the given one. - * - * @param {number} x - The x coordinate of the end point. - * @param {number} y - The y coordinate of the end point. - * @return {Path} A reference to this path. - */ - lineTo(x: number, y: number): Path; - /** - * Adds an instance of {@link QuadraticBezierCurve} to the path by connecting - * the current point with the given one. - * - * @param {number} aCPx - The x coordinate of the control point. - * @param {number} aCPy - The y coordinate of the control point. - * @param {number} aX - The x coordinate of the end point. - * @param {number} aY - The y coordinate of the end point. - * @return {Path} A reference to this path. - */ - quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): Path; - /** - * Adds an instance of {@link CubicBezierCurve} to the path by connecting - * the current point with the given one. - * - * @param {number} aCP1x - The x coordinate of the first control point. - * @param {number} aCP1y - The y coordinate of the first control point. - * @param {number} aCP2x - The x coordinate of the second control point. - * @param {number} aCP2y - The y coordinate of the second control point. - * @param {number} aX - The x coordinate of the end point. - * @param {number} aY - The y coordinate of the end point. - * @return {Path} A reference to this path. - */ - bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): Path; - /** - * Adds an instance of {@link SplineCurve} to the path by connecting - * the current point with the given list of points. - * - * @param {Array} pts - An array of points in 2D space. - * @return {Path} A reference to this path. - */ - splineThru(pts: Array): Path; - /** - * Adds an arc as an instance of {@link EllipseCurve} to the path, positioned relative - * to the current point. - * - * @param {number} [aX=0] - The x coordinate of the center of the arc offsetted from the previous curve. - * @param {number} [aY=0] - The y coordinate of the center of the arc offsetted from the previous curve. - * @param {number} [aRadius=1] - The radius of the arc. - * @param {number} [aStartAngle=0] - The start angle in radians. - * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. - * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not. - * @return {Path} A reference to this path. - */ - arc(aX?: number, aY?: number, aRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean): Path; - /** - * Adds an absolutely positioned arc as an instance of {@link EllipseCurve} to the path. - * - * @param {number} [aX=0] - The x coordinate of the center of the arc. - * @param {number} [aY=0] - The y coordinate of the center of the arc. - * @param {number} [aRadius=1] - The radius of the arc. - * @param {number} [aStartAngle=0] - The start angle in radians. - * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. - * @param {boolean} [aClockwise=false] - Whether to sweep the arc clockwise or not. - * @return {Path} A reference to this path. - */ - absarc(aX?: number, aY?: number, aRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean): Path; - /** - * Adds an ellipse as an instance of {@link EllipseCurve} to the path, positioned relative - * to the current point - * - * @param {number} [aX=0] - The x coordinate of the center of the ellipse offsetted from the previous curve. - * @param {number} [aY=0] - The y coordinate of the center of the ellipse offsetted from the previous curve. - * @param {number} [xRadius=1] - The radius of the ellipse in the x axis. - * @param {number} [yRadius=1] - The radius of the ellipse in the y axis. - * @param {number} [aStartAngle=0] - The start angle in radians. - * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. - * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not. - * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. - * @return {Path} A reference to this path. - */ - ellipse(aX?: number, aY?: number, xRadius?: number, yRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean, aRotation?: number): Path; - /** - * Adds an absolutely positioned ellipse as an instance of {@link EllipseCurve} to the path. - * - * @param {number} [aX=0] - The x coordinate of the absolute center of the ellipse. - * @param {number} [aY=0] - The y coordinate of the absolute center of the ellipse. - * @param {number} [xRadius=1] - The radius of the ellipse in the x axis. - * @param {number} [yRadius=1] - The radius of the ellipse in the y axis. - * @param {number} [aStartAngle=0] - The start angle in radians. - * @param {number} [aEndAngle=Math.PI*2] - The end angle in radians. - * @param {boolean} [aClockwise=false] - Whether to sweep the ellipse clockwise or not. - * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. - * @return {Path} A reference to this path. - */ - absellipse(aX?: number, aY?: number, xRadius?: number, yRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean, aRotation?: number): Path; - copy(source: any): this; - fromJSON(json: any): this; -} -import { CurvePath } from './CurvePath.js'; -import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts b/jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts deleted file mode 100644 index 056fdb610..000000000 --- a/jsdoc-testing/jsdoc/src/extras/core/Shape.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Defines an arbitrary 2d shape plane using paths with optional holes. It - * can be used with {@link ExtrudeGeometry}, {@link ShapeGeometry}, to get - * points, or to get triangulated faces. - * - * ```js - * const heartShape = new THREE.Shape(); - * - * heartShape.moveTo( 25, 25 ); - * heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 ); - * heartShape.bezierCurveTo( - 30, 0, - 30, 35, - 30, 35 ); - * heartShape.bezierCurveTo( - 30, 55, - 10, 77, 25, 95 ); - * heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 ); - * heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 ); - * heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 ); - * - * const extrudeSettings = { - * depth: 8, - * bevelEnabled: true, - * bevelSegments: 2, - * steps: 2, - * bevelSize: 1, - * bevelThickness: 1 - * }; - * - * const geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings ); - * const mesh = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial() ); - * ``` - * - * @augments Path - */ -export class Shape extends Path { - /** - * Constructs a new shape. - * - * @param {Array} [points] - An array of 2D points defining the shape. - */ - constructor(points?: Array); - /** - * The UUID of the shape. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * Defines the holes in the shape. Hole definitions must use the - * opposite winding order (CW/CCW) than the outer shape. - * - * @type {Array} - * @readonly - */ - readonly holes: Array; - /** - * Returns an array representing each contour of the holes - * as a list of 2D points. - * - * @param {number} divisions - The fineness of the result. - * @return {Array>} The holes as a series of 2D points. - */ - getPointsHoles(divisions: number): Array>; - /** - * Returns an object that holds contour data for the shape and its holes as - * arrays of 2D points. - * - * @param {number} divisions - The fineness of the result. - * @return {{shape:Array,holes:Array>}} An object with contour data. - */ - extractPoints(divisions: number): { - shape: Array; - holes: Array>; - }; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Path } from './Path.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts b/jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts deleted file mode 100644 index 04032cbd6..000000000 --- a/jsdoc-testing/jsdoc/src/extras/core/ShapePath.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This class is used to convert a series of paths to an array of - * shapes. It is specifically used in context of fonts and SVG. - */ -export class ShapePath { - type: string; - /** - * The color of the shape. - * - * @type {Color} - */ - color: Color; - /** - * The paths that have been generated for this shape. - * - * @type {Array} - * @default null - */ - subPaths: Array; - /** - * The current path that is being generated. - * - * @type {?Path} - * @default null - */ - currentPath: Path | null; - /** - * An object that can be used to store custom data about the shape path. - * Mainly used by SVGLoader to store style information. - * - * @type {Object} - */ - userData: Object; - /** - * Creates a new path and moves it current point to the given one. - * - * @param {number} x - The x coordinate. - * @param {number} y - The y coordinate. - * @return {ShapePath} A reference to this shape path. - */ - moveTo(x: number, y: number): ShapePath; - /** - * Adds an instance of {@link LineCurve} to the path by connecting - * the current point with the given one. - * - * @param {number} x - The x coordinate of the end point. - * @param {number} y - The y coordinate of the end point. - * @return {ShapePath} A reference to this shape path. - */ - lineTo(x: number, y: number): ShapePath; - /** - * Adds an instance of {@link QuadraticBezierCurve} to the path by connecting - * the current point with the given one. - * - * @param {number} aCPx - The x coordinate of the control point. - * @param {number} aCPy - The y coordinate of the control point. - * @param {number} aX - The x coordinate of the end point. - * @param {number} aY - The y coordinate of the end point. - * @return {ShapePath} A reference to this shape path. - */ - quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): ShapePath; - /** - * Adds an instance of {@link CubicBezierCurve} to the path by connecting - * the current point with the given one. - * - * @param {number} aCP1x - The x coordinate of the first control point. - * @param {number} aCP1y - The y coordinate of the first control point. - * @param {number} aCP2x - The x coordinate of the second control point. - * @param {number} aCP2y - The y coordinate of the second control point. - * @param {number} aX - The x coordinate of the end point. - * @param {number} aY - The y coordinate of the end point. - * @return {ShapePath} A reference to this shape path. - */ - bezierCurveTo(aCP1x: number, aCP1y: number, aCP2x: number, aCP2y: number, aX: number, aY: number): ShapePath; - /** - * Adds an instance of {@link SplineCurve} to the path by connecting - * the current point with the given list of points. - * - * @param {Array} pts - An array of points in 2D space. - * @return {ShapePath} A reference to this shape path. - */ - splineThru(pts: Array): ShapePath; - /** - * Converts the paths into an array of shapes. - * - * @return {Array} An array of shapes. - */ - toShapes(): Array; -} -import { Color } from '../../math/Color.js'; -import { Path } from './Path.js'; -import { Vector2 } from '../../math/Vector2.js'; -import { Shape } from './Shape.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts deleted file mode 100644 index 3ae4feae2..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/ArcCurve.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * A curve representing an arc. - * - * @augments EllipseCurve - */ -export class ArcCurve extends EllipseCurve { - /** - * Constructs a new arc curve. - * - * @param {number} [aX=0] - The X center of the ellipse. - * @param {number} [aY=0] - The Y center of the ellipse. - * @param {number} [aRadius=1] - The radius of the ellipse in the x direction. - * @param {number} [aStartAngle=0] - The start angle of the curve in radians starting from the positive X axis. - * @param {number} [aEndAngle=Math.PI*2] - The end angle of the curve in radians starting from the positive X axis. - * @param {boolean} [aClockwise=false] - Whether the ellipse is drawn clockwise or not. - */ - constructor(aX?: number, aY?: number, aRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArcCurve: boolean; -} -import { EllipseCurve } from './EllipseCurve.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts deleted file mode 100644 index 8798e6d39..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/CatmullRomCurve3.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * A curve representing a Catmull-Rom spline. - * - * ```js - * //Create a closed wavey loop - * const curve = new THREE.CatmullRomCurve3( [ - * new THREE.Vector3( -10, 0, 10 ), - * new THREE.Vector3( -5, 5, 5 ), - * new THREE.Vector3( 0, 0, 0 ), - * new THREE.Vector3( 5, -5, 5 ), - * new THREE.Vector3( 10, 0, 10 ) - * ] ); - * - * const points = curve.getPoints( 50 ); - * const geometry = new THREE.BufferGeometry().setFromPoints( points ); - * - * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); - * - * // Create the final object to add to the scene - * const curveObject = new THREE.Line( geometry, material ); - * ``` - * - * @augments Curve - */ -export class CatmullRomCurve3 extends Curve { - /** - * Constructs a new Catmull-Rom curve. - * - * @param {Array} [points] - An array of 3D points defining the curve. - * @param {boolean} [closed=false] - Whether the curve is closed or not. - * @param {('centripetal'|'chordal'|'catmullrom')} [curveType='centripetal'] - The curve type. - * @param {number} [tension=0.5] - Tension of the curve. - */ - constructor(points?: Array, closed?: boolean, curveType?: ("centripetal" | "chordal" | "catmullrom"), tension?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCatmullRomCurve3: boolean; - type: string; - /** - * An array of 3D points defining the curve. - * - * @type {Array} - */ - points: Array; - /** - * Whether the curve is closed or not. - * - * @type {boolean} - * @default false - */ - closed: boolean; - /** - * The curve type. - * - * @type {('centripetal'|'chordal'|'catmullrom')} - * @default 'centripetal' - */ - curveType: ("centripetal" | "chordal" | "catmullrom"); - /** - * Tension of the curve. - * - * @type {number} - * @default 0.5 - */ - tension: number; - /** - * Returns a point on the curve. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts deleted file mode 100644 index 434713a9f..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * A curve representing a 2D Cubic Bezier curve. - * - * ```js - * const curve = new THREE.CubicBezierCurve( - * new THREE.Vector2( - 0, 0 ), - * new THREE.Vector2( - 5, 15 ), - * new THREE.Vector2( 20, 15 ), - * new THREE.Vector2( 10, 0 ) - * ); - * - * const points = curve.getPoints( 50 ); - * const geometry = new THREE.BufferGeometry().setFromPoints( points ); - * - * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); - * - * // Create the final object to add to the scene - * const curveObject = new THREE.Line( geometry, material ); - * ``` - * - * @augments Curve - */ -export class CubicBezierCurve extends Curve { - /** - * Constructs a new Cubic Bezier curve. - * - * @param {Vector2} [v0] - The start point. - * @param {Vector2} [v1] - The first control point. - * @param {Vector2} [v2] - The second control point. - * @param {Vector2} [v3] - The end point. - */ - constructor(v0?: Vector2, v1?: Vector2, v2?: Vector2, v3?: Vector2); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubicBezierCurve: boolean; - type: string; - /** - * The start point. - * - * @type {Vector2} - */ - v0: Vector2; - /** - * The first control point. - * - * @type {Vector2} - */ - v1: Vector2; - /** - * The second control point. - * - * @type {Vector2} - */ - v2: Vector2; - /** - * The end point. - * - * @type {Vector2} - */ - v3: Vector2; - /** - * Returns a point on the curve. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector2} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector2): Vector2; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts deleted file mode 100644 index ccc99379e..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/CubicBezierCurve3.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * A curve representing a 3D Cubic Bezier curve. - * - * @augments Curve - */ -export class CubicBezierCurve3 extends Curve { - /** - * Constructs a new Cubic Bezier curve. - * - * @param {Vector3} [v0] - The start point. - * @param {Vector3} [v1] - The first control point. - * @param {Vector3} [v2] - The second control point. - * @param {Vector3} [v3] - The end point. - */ - constructor(v0?: Vector3, v1?: Vector3, v2?: Vector3, v3?: Vector3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubicBezierCurve3: boolean; - type: string; - /** - * The start point. - * - * @type {Vector3} - */ - v0: Vector3; - /** - * The first control point. - * - * @type {Vector3} - */ - v1: Vector3; - /** - * The second control point. - * - * @type {Vector3} - */ - v2: Vector3; - /** - * The end point. - * - * @type {Vector3} - */ - v3: Vector3; - /** - * Returns a point on the curve. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts deleted file mode 100644 index ce726ca5a..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/Curves.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export { ArcCurve } from "./ArcCurve.js"; -export { CatmullRomCurve3 } from "./CatmullRomCurve3.js"; -export { CubicBezierCurve } from "./CubicBezierCurve.js"; -export { CubicBezierCurve3 } from "./CubicBezierCurve3.js"; -export { EllipseCurve } from "./EllipseCurve.js"; -export { LineCurve } from "./LineCurve.js"; -export { LineCurve3 } from "./LineCurve3.js"; -export { QuadraticBezierCurve } from "./QuadraticBezierCurve.js"; -export { QuadraticBezierCurve3 } from "./QuadraticBezierCurve3.js"; -export { SplineCurve } from "./SplineCurve.js"; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts deleted file mode 100644 index 4080dab88..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/EllipseCurve.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * A curve representing an ellipse. - * - * ```js - * const curve = new THREE.EllipseCurve( - * 0, 0, - * 10, 10, - * 0, 2 * Math.PI, - * false, - * 0 - * ); - * - * const points = curve.getPoints( 50 ); - * const geometry = new THREE.BufferGeometry().setFromPoints( points ); - * - * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); - * - * // Create the final object to add to the scene - * const ellipse = new THREE.Line( geometry, material ); - * ``` - * - * @augments Curve - */ -export class EllipseCurve extends Curve { - /** - * Constructs a new ellipse curve. - * - * @param {number} [aX=0] - The X center of the ellipse. - * @param {number} [aY=0] - The Y center of the ellipse. - * @param {number} [xRadius=1] - The radius of the ellipse in the x direction. - * @param {number} [yRadius=1] - The radius of the ellipse in the y direction. - * @param {number} [aStartAngle=0] - The start angle of the curve in radians starting from the positive X axis. - * @param {number} [aEndAngle=Math.PI*2] - The end angle of the curve in radians starting from the positive X axis. - * @param {boolean} [aClockwise=false] - Whether the ellipse is drawn clockwise or not. - * @param {number} [aRotation=0] - The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. - */ - constructor(aX?: number, aY?: number, xRadius?: number, yRadius?: number, aStartAngle?: number, aEndAngle?: number, aClockwise?: boolean, aRotation?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isEllipseCurve: boolean; - type: string; - /** - * The X center of the ellipse. - * - * @type {number} - * @default 0 - */ - aX: number; - /** - * The Y center of the ellipse. - * - * @type {number} - * @default 0 - */ - aY: number; - /** - * The radius of the ellipse in the x direction. - * Setting the this value equal to the {@link EllipseCurve#yRadius} will result in a circle. - * - * @type {number} - * @default 1 - */ - xRadius: number; - /** - * The radius of the ellipse in the y direction. - * Setting the this value equal to the {@link EllipseCurve#xRadius} will result in a circle. - * - * @type {number} - * @default 1 - */ - yRadius: number; - /** - * The start angle of the curve in radians starting from the positive X axis. - * - * @type {number} - * @default 0 - */ - aStartAngle: number; - /** - * The end angle of the curve in radians starting from the positive X axis. - * - * @type {number} - * @default Math.PI*2 - */ - aEndAngle: number; - /** - * Whether the ellipse is drawn clockwise or not. - * - * @type {boolean} - * @default false - */ - aClockwise: boolean; - /** - * The rotation angle of the ellipse in radians, counterclockwise from the positive X axis. - * - * @type {number} - * @default 0 - */ - aRotation: number; - /** - * Returns a point on the curve. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector2} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector2): Vector2; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts deleted file mode 100644 index 3a0f08206..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/LineCurve.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * A curve representing a 2D line segment. - * - * @augments Curve - */ -export class LineCurve extends Curve { - /** - * Constructs a new line curve. - * - * @param {Vector2} [v1] - The start point. - * @param {Vector2} [v2] - The end point. - */ - constructor(v1?: Vector2, v2?: Vector2); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineCurve: boolean; - type: string; - /** - * The start point. - * - * @type {Vector2} - */ - v1: Vector2; - /** - * The end point. - * - * @type {Vector2} - */ - v2: Vector2; - /** - * Returns a point on the line. - * - * @param {number} t - A interpolation factor representing a position on the line. Must be in the range `[0,1]`. - * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector2} The position on the line. - */ - getPoint(t: number, optionalTarget?: Vector2): Vector2; - getPointAt(u: any, optionalTarget: any): Vector2; - getTangent(t: any, optionalTarget?: Vector2): Vector2; - getTangentAt(u: any, optionalTarget: any): Vector2; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts deleted file mode 100644 index 5f03eb30d..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/LineCurve3.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * A curve representing a 3D line segment. - * - * @augments Curve - */ -export class LineCurve3 extends Curve { - /** - * Constructs a new line curve. - * - * @param {Vector3} [v1] - The start point. - * @param {Vector3} [v2] - The end point. - */ - constructor(v1?: Vector3, v2?: Vector3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineCurve3: boolean; - type: string; - /** - * The start point. - * - * @type {Vector3} - */ - v1: Vector3; - /** - * The end point. - * - * @type {Vector2} - */ - v2: Vector2; - /** - * Returns a point on the line. - * - * @param {number} t - A interpolation factor representing a position on the line. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the line. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; - getPointAt(u: any, optionalTarget: any): Vector3; - getTangent(t: any, optionalTarget?: Vector3): Vector3; - getTangentAt(u: any, optionalTarget: any): Vector3; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts deleted file mode 100644 index d123a23b5..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * A curve representing a 2D Quadratic Bezier curve. - * - * ```js - * const curve = new THREE.QuadraticBezierCurve( - * new THREE.Vector2( - 10, 0 ), - * new THREE.Vector2( 20, 15 ), - * new THREE.Vector2( 10, 0 ) - * ) - * - * const points = curve.getPoints( 50 ); - * const geometry = new THREE.BufferGeometry().setFromPoints( points ); - * - * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); - * - * // Create the final object to add to the scene - * const curveObject = new THREE.Line( geometry, material ); - * ``` - * - * @augments Curve - */ -export class QuadraticBezierCurve extends Curve { - /** - * Constructs a new Quadratic Bezier curve. - * - * @param {Vector2} [v0] - The start point. - * @param {Vector2} [v1] - The control point. - * @param {Vector2} [v2] - The end point. - */ - constructor(v0?: Vector2, v1?: Vector2, v2?: Vector2); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isQuadraticBezierCurve: boolean; - type: string; - /** - * The start point. - * - * @type {Vector2} - */ - v0: Vector2; - /** - * The control point. - * - * @type {Vector2} - */ - v1: Vector2; - /** - * The end point. - * - * @type {Vector2} - */ - v2: Vector2; - /** - * Returns a point on the curve. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector2} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector2): Vector2; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts deleted file mode 100644 index 5166fe270..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/QuadraticBezierCurve3.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/** - * A curve representing a 3D Quadratic Bezier curve. - * - * @augments Curve - */ -export class QuadraticBezierCurve3 extends Curve { - /** - * Constructs a new Quadratic Bezier curve. - * - * @param {Vector3} [v0] - The start point. - * @param {Vector3} [v1] - The control point. - * @param {Vector3} [v2] - The end point. - */ - constructor(v0?: Vector3, v1?: Vector3, v2?: Vector3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isQuadraticBezierCurve3: boolean; - type: string; - /** - * The start point. - * - * @type {Vector3} - */ - v0: Vector3; - /** - * The control point. - * - * @type {Vector3} - */ - v1: Vector3; - /** - * The end point. - * - * @type {Vector3} - */ - v2: Vector3; - /** - * Returns a point on the curve. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector3} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector3} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector3): Vector3; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts b/jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts deleted file mode 100644 index 10e62e17d..000000000 --- a/jsdoc-testing/jsdoc/src/extras/curves/SplineCurve.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * A curve representing a 2D spline curve. - * - * ```js - * // Create a sine-like wave - * const curve = new THREE.SplineCurve( [ - * new THREE.Vector2( -10, 0 ), - * new THREE.Vector2( -5, 5 ), - * new THREE.Vector2( 0, 0 ), - * new THREE.Vector2( 5, -5 ), - * new THREE.Vector2( 10, 0 ) - * ] ); - * - * const points = curve.getPoints( 50 ); - * const geometry = new THREE.BufferGeometry().setFromPoints( points ); - * - * const material = new THREE.LineBasicMaterial( { color: 0xff0000 } ); - * - * // Create the final object to add to the scene - * const splineObject = new THREE.Line( geometry, material ); - * ``` - * - * @augments Curve - */ -export class SplineCurve extends Curve { - /** - * Constructs a new 2D spline curve. - * - * @param {Array} [points] - An array of 2D points defining the curve. - */ - constructor(points?: Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSplineCurve: boolean; - type: string; - /** - * An array of 2D points defining the curve. - * - * @type {Array} - */ - points: Array; - /** - * Returns a point on the curve. - * - * @param {number} t - A interpolation factor representing a position on the curve. Must be in the range `[0,1]`. - * @param {Vector2} [optionalTarget] - The optional target vector the result is written to. - * @return {Vector2} The position on the curve. - */ - getPoint(t: number, optionalTarget?: Vector2): Vector2; - copy(source: any): this; - fromJSON(json: any): this; -} -import { Curve } from '../core/Curve.js'; -import { Vector2 } from '../../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts b/jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts deleted file mode 100644 index 8cf03b1bf..000000000 --- a/jsdoc-testing/jsdoc/src/extras/lib/earcut.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export default function earcut(data: any, holeIndices: any, dim?: number): any[]; -export function deviation(data: any, holeIndices: any, dim: any, triangles: any): number; -export function flatten(data: any): { - vertices: any[]; - holes: number[]; - dimensions: any; -}; diff --git a/jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts deleted file mode 100644 index 36fb50dad..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/BoxGeometry.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * A geometry class for a rectangular cuboid with a given width, height, and depth. - * On creation, the cuboid is centred on the origin, with each edge parallel to one - * of the axes. - * - * ```js - * const geometry = new THREE.BoxGeometry( 1, 1, 1 ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const cube = new THREE.Mesh( geometry, material ); - * scene.add( cube ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#BoxGeometry - */ -export class BoxGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {BoxGeometry} A new instance. - */ - static fromJSON(data: Object): BoxGeometry; - /** - * Constructs a new box geometry. - * - * @param {number} [width=1] - The width. That is, the length of the edges parallel to the X axis. - * @param {number} [height=1] - The height. That is, the length of the edges parallel to the Y axis. - * @param {number} [depth=1] - The depth. That is, the length of the edges parallel to the Z axis. - * @param {number} [widthSegments=1] - Number of segmented rectangular faces along the width of the sides. - * @param {number} [heightSegments=1] - Number of segmented rectangular faces along the height of the sides. - * @param {number} [depthSegments=1] - Number of segmented rectangular faces along the depth of the sides. - */ - constructor(width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts deleted file mode 100644 index 207ba310c..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/CapsuleGeometry.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * A geometry class for representing a capsule. - * - * ```js - * const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8, 1 ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const capsule = new THREE.Mesh( geometry, material ); - * scene.add( capsule ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#CapsuleGeometry - */ -export class CapsuleGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {CapsuleGeometry} A new instance. - */ - static fromJSON(data: Object): CapsuleGeometry; - /** - * Constructs a new capsule geometry. - * - * @param {number} [radius=1] - Radius of the capsule. - * @param {number} [height=1] - Height of the middle section. - * @param {number} [capSegments=4] - Number of curve segments used to build each cap. - * @param {number} [radialSegments=8] - Number of segmented faces around the circumference of the capsule. Must be an integer >= 3. - * @param {number} [heightSegments=1] - Number of rows of faces along the height of the middle section. Must be an integer >= 1. - */ - constructor(radius?: number, height?: number, capSegments?: number, radialSegments?: number, heightSegments?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts deleted file mode 100644 index 964d89897..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/CircleGeometry.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A simple shape of Euclidean geometry. It is constructed from a - * number of triangular segments that are oriented around a central point and - * extend as far out as a given radius. It is built counter-clockwise from a - * start angle and a given central angle. It can also be used to create - * regular polygons, where the number of segments determines the number of - * sides. - * - * ```js - * const geometry = new THREE.CircleGeometry( 5, 32 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const circle = new THREE.Mesh( geometry, material ); - * scene.add( circle ) - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#CircleGeometry - */ -export class CircleGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {CircleGeometry} A new instance. - */ - static fromJSON(data: Object): CircleGeometry; - /** - * Constructs a new circle geometry. - * - * @param {number} [radius=1] - Radius of the circle. - * @param {number} [segments=32] - Number of segments (triangles), minimum = `3`. - * @param {number} [thetaStart=0] - Start angle for first segment in radians. - * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, - * of the circular sector in radians. The default value results in a complete circle. - */ - constructor(radius?: number, segments?: number, thetaStart?: number, thetaLength?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts deleted file mode 100644 index 0df48d532..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/ConeGeometry.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * A geometry class for representing a cone. - * - * ```js - * const geometry = new THREE.ConeGeometry( 5, 20, 32 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const cone = new THREE.Mesh(geometry, material ); - * scene.add( cone ); - * ``` - * - * @augments CylinderGeometry - * @demo scenes/geometry-browser.html#ConeGeometry - */ -export class ConeGeometry extends CylinderGeometry { - /** - * Constructs a new cone geometry. - * - * @param {number} [radius=1] - Radius of the cone base. - * @param {number} [height=1] - Height of the cone. - * @param {number} [radialSegments=32] - Number of segmented faces around the circumference of the cone. - * @param {number} [heightSegments=1] - Number of rows of faces along the height of the cone. - * @param {boolean} [openEnded=false] - Whether the base of the cone is open or capped. - * @param {number} [thetaStart=0] - Start angle for first segment, in radians. - * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, of the circular sector, in radians. - * The default value results in a complete cone. - */ - constructor(radius?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); -} -import { CylinderGeometry } from './CylinderGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts deleted file mode 100644 index 6b28774bd..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/CylinderGeometry.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * A geometry class for representing a cylinder. - * - * ```js - * const geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const cylinder = new THREE.Mesh( geometry, material ); - * scene.add( cylinder ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#CylinderGeometry - */ -export class CylinderGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {CylinderGeometry} A new instance. - */ - static fromJSON(data: Object): CylinderGeometry; - /** - * Constructs a new cylinder geometry. - * - * @param {number} [radiusTop=1] - Radius of the cylinder at the top. - * @param {number} [radiusBottom=1] - Radius of the cylinder at the bottom. - * @param {number} [height=1] - Height of the cylinder. - * @param {number} [radialSegments=32] - Number of segmented faces around the circumference of the cylinder. - * @param {number} [heightSegments=1] - Number of rows of faces along the height of the cylinder. - * @param {boolean} [openEnded=false] - Whether the base of the cylinder is open or capped. - * @param {number} [thetaStart=0] - Start angle for first segment, in radians. - * @param {number} [thetaLength=Math.PI*2] - The central angle, often called theta, of the circular sector, in radians. - * The default value results in a complete cylinder. - */ - constructor(radiusTop?: number, radiusBottom?: number, height?: number, radialSegments?: number, heightSegments?: number, openEnded?: boolean, thetaStart?: number, thetaLength?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts deleted file mode 100644 index dd5a084d9..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/DodecahedronGeometry.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A geometry class for representing a dodecahedron. - * - * ```js - * const geometry = new THREE.DodecahedronGeometry(); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const dodecahedron = new THREE.Mesh( geometry, material ); - * scene.add( dodecahedron ); - * ``` - * - * @augments PolyhedronGeometry - * @demo scenes/geometry-browser.html#DodecahedronGeometry - */ -export class DodecahedronGeometry extends PolyhedronGeometry { - /** - * Constructs a new dodecahedron geometry. - * - * @param {number} [radius=1] - Radius of the dodecahedron. - * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a dodecahedron. - */ - constructor(radius?: number, detail?: number); -} -import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts deleted file mode 100644 index e8a57e60b..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/EdgesGeometry.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Can be used as a helper object to view the edges of a geometry. - * - * ```js - * const geometry = new THREE.BoxGeometry(); - * const edges = new THREE.EdgesGeometry( geometry ); - * const line = new THREE.LineSegments( edges ); - * scene.add( line ); - * ``` - * - * Note: It is not yet possible to serialize/deserialize instances of this class. - * - * @augments BufferGeometry - */ -export class EdgesGeometry extends BufferGeometry { - /** - * Constructs a new edges geometry. - * - * @param {?BufferGeometry} [geometry=null] - The geometry. - * @param {number} [thresholdAngle=1] - An edge is only rendered if the angle (in degrees) - * between the face normals of the adjoining faces exceeds this value. - */ - constructor(geometry?: BufferGeometry | null, thresholdAngle?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts deleted file mode 100644 index 92ba6a8a5..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/ExtrudeGeometry.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * ~Options - */ -export type ExtrudeGeometry = { - /** - * - Number of points on the curves. - */ - curveSegments?: number | undefined; - /** - * - Number of points used for subdividing segments along the depth of the extruded spline. - */ - steps?: number | undefined; - /** - * - Depth to extrude the shape. - */ - depth?: number | undefined; - /** - * - Whether to beveling to the shape or not. - */ - bevelEnabled?: boolean | undefined; - /** - * - How deep into the original shape the bevel goes. - */ - bevelThickness?: number | undefined; - /** - * - Distance from the shape outline that the bevel extends. - */ - bevelSize?: number | undefined; - /** - * - Distance from the shape outline that the bevel starts. - */ - bevelOffset?: number | undefined; - /** - * - Number of bevel layers. - */ - bevelSegments?: number | undefined; - /** - * - A 3D spline path along which the shape should be extruded. Bevels not supported for path extrusion. - */ - extrudePath?: Curve | null; - /** - * - An object that provides UV generator functions for custom UV generation. - */ - UVGenerator?: Object | undefined; -}; -/** - * Creates extruded geometry from a path shape. - * - * ```js - * const length = 12, width = 8; - * - * const shape = new THREE.Shape(); - * shape.moveTo( 0,0 ); - * shape.lineTo( 0, width ); - * shape.lineTo( length, width ); - * shape.lineTo( length, 0 ); - * shape.lineTo( 0, 0 ); - * - * const geometry = new THREE.ExtrudeGeometry( shape ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const mesh = new THREE.Mesh( geometry, material ) ; - * scene.add( mesh ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#ExtrudeGeometry - */ -export class ExtrudeGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @param {Array} shapes - An array of shapes. - * @return {ExtrudeGeometry} A new instance. - */ - static fromJSON(data: Object, shapes: Array): ExtrudeGeometry; - /** - * Constructs a new extrude geometry. - * - * @param {Shape|Array} [shapes] - A shape or an array of shapes. - * @param {ExtrudeGeometry~Options} [options] - The extrude settings. - */ - constructor(shapes?: Shape | Array, options?: {}); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; - toJSON(): any; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; -import { Shape } from '../extras/core/Shape.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts b/jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts deleted file mode 100644 index b1be46c46..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/Geometries.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export * from "./BoxGeometry.js"; -export * from "./CapsuleGeometry.js"; -export * from "./CircleGeometry.js"; -export * from "./ConeGeometry.js"; -export * from "./CylinderGeometry.js"; -export * from "./DodecahedronGeometry.js"; -export * from "./EdgesGeometry.js"; -export * from "./ExtrudeGeometry.js"; -export * from "./IcosahedronGeometry.js"; -export * from "./LatheGeometry.js"; -export * from "./OctahedronGeometry.js"; -export * from "./PlaneGeometry.js"; -export * from "./PolyhedronGeometry.js"; -export * from "./RingGeometry.js"; -export * from "./ShapeGeometry.js"; -export * from "./SphereGeometry.js"; -export * from "./TetrahedronGeometry.js"; -export * from "./TorusGeometry.js"; -export * from "./TorusKnotGeometry.js"; -export * from "./TubeGeometry.js"; -export * from "./WireframeGeometry.js"; diff --git a/jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts deleted file mode 100644 index fb50e77df..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/IcosahedronGeometry.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A geometry class for representing an icosahedron. - * - * ```js - * const geometry = new THREE.IcosahedronGeometry(); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const icosahedron = new THREE.Mesh( geometry, material ); - * scene.add( icosahedron ); - * ``` - * - * @augments PolyhedronGeometry - * @demo scenes/geometry-browser.html#IcosahedronGeometry - */ -export class IcosahedronGeometry extends PolyhedronGeometry { - /** - * Constructs a new icosahedron geometry. - * - * @param {number} [radius=1] - Radius of the icosahedron. - * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a icosahedron. - */ - constructor(radius?: number, detail?: number); -} -import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts deleted file mode 100644 index cce939fca..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/LatheGeometry.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Creates meshes with axial symmetry like vases. The lathe rotates around the Y axis. - * - * ```js - * const points = []; - * for ( let i = 0; i < 10; i ++ ) { - * points.push( new THREE.Vector2( Math.sin( i * 0.2 ) * 10 + 5, ( i - 5 ) * 2 ) ); - * } - * const geometry = new THREE.LatheGeometry( points ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const lathe = new THREE.Mesh( geometry, material ); - * scene.add( lathe ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#LatheGeometry - */ -export class LatheGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {LatheGeometry} A new instance. - */ - static fromJSON(data: Object): LatheGeometry; - /** - * Constructs a new lathe geometry. - * - * @param {Array} [points] - An array of points in 2D space. The x-coordinate of each point - * must be greater than zero. - * @param {number} [segments=12] - The number of circumference segments to generate. - * @param {number} [phiStart=0] - The starting angle in radians. - * @param {number} [phiLength=Math.PI*2] - The radian (0 to 2PI) range of the lathed section 2PI is a - * closed lathe, less than 2PI is a portion. - */ - constructor(points?: Array, segments?: number, phiStart?: number, phiLength?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; -import { Vector2 } from '../math/Vector2.js'; -import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts deleted file mode 100644 index d61fe28a2..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/OctahedronGeometry.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A geometry class for representing an octahedron. - * - * ```js - * const geometry = new THREE.OctahedronGeometry(); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const octahedron = new THREE.Mesh( geometry, material ); - * scene.add( octahedron ); - * ``` - * - * @augments PolyhedronGeometry - * @demo scenes/geometry-browser.html#OctahedronGeometry - */ -export class OctahedronGeometry extends PolyhedronGeometry { - /** - * Constructs a new octahedron geometry. - * - * @param {number} [radius=1] - Radius of the octahedron. - * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a octahedron. - */ - constructor(radius?: number, detail?: number); -} -import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts deleted file mode 100644 index d75a367ea..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/PlaneGeometry.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * A geometry class for representing a plane. - * - * ```js - * const geometry = new THREE.PlaneGeometry( 1, 1 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); - * const plane = new THREE.Mesh( geometry, material ); - * scene.add( plane ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#PlaneGeometry - */ -export class PlaneGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {PlaneGeometry} A new instance. - */ - static fromJSON(data: Object): PlaneGeometry; - /** - * Constructs a new plane geometry. - * - * @param {number} [width=1] - The width along the X axis. - * @param {number} [height=1] - The height along the Y axis - * @param {number} [widthSegments=1] - The number of segments along the X axis. - * @param {number} [heightSegments=1] - The number of segments along the Y axis. - */ - constructor(width?: number, height?: number, widthSegments?: number, heightSegments?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts deleted file mode 100644 index c0ef0437c..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/PolyhedronGeometry.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A polyhedron is a solid in three dimensions with flat faces. This class - * will take an array of vertices, project them onto a sphere, and then - * divide them up to the desired level of detail. - * - * @augments BufferGeometry - */ -export class PolyhedronGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {PolyhedronGeometry} A new instance. - */ - static fromJSON(data: Object): PolyhedronGeometry; - /** - * Constructs a new polyhedron geometry. - * - * @param {Array} [vertices] - A flat array of vertices describing the base shape. - * @param {Array} [indices] - A flat array of indices describing the base shape. - * @param {number} [radius=1] - The radius of the shape. - * @param {number} [detail=0] - How many levels to subdivide the geometry. The more detail, the smoother the shape. - */ - constructor(vertices?: Array, indices?: Array, radius?: number, detail?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts deleted file mode 100644 index 3d54a0d1a..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/RingGeometry.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * A class for generating a two-dimensional ring geometry. - * - * ```js - * const geometry = new THREE.RingGeometry( 1, 5, 32 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00, side: THREE.DoubleSide } ); - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#RingGeometry - */ -export class RingGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {RingGeometry} A new instance. - */ - static fromJSON(data: Object): RingGeometry; - /** - * Constructs a new ring geometry. - * - * @param {number} [innerRadius=0.5] - The inner radius of the ring. - * @param {number} [outerRadius=1] - The outer radius of the ring. - * @param {number} [thetaSegments=32] - Number of segments. A higher number means the ring will be more round. Minimum is `3`. - * @param {number} [phiSegments=1] - Number of segments per ring segment. Minimum is `1`. - * @param {number} [thetaStart=0] - Starting angle in radians. - * @param {number} [thetaLength=Math.PI*2] - Central angle in radians. - */ - constructor(innerRadius?: number, outerRadius?: number, thetaSegments?: number, phiSegments?: number, thetaStart?: number, thetaLength?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts deleted file mode 100644 index 335290e14..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/ShapeGeometry.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Creates an one-sided polygonal geometry from one or more path shapes. - * - * ```js - * const arcShape = new THREE.Shape() - * .moveTo( 5, 1 ) - * .absarc( 1, 1, 4, 0, Math.PI * 2, false ); - * - * const geometry = new THREE.ShapeGeometry( arcShape ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00, side: THREE.DoubleSide } ); - * const mesh = new THREE.Mesh( geometry, material ) ; - * scene.add( mesh ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#ShapeGeometry - */ -export class ShapeGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @param {Array} shapes - An array of shapes. - * @return {ShapeGeometry} A new instance. - */ - static fromJSON(data: Object, shapes: Array): ShapeGeometry; - /** - * Constructs a new shape geometry. - * - * @param {Shape|Array} [shapes] - A shape or an array of shapes. - * @param {number} [curveSegments=12] - Number of segments per shape. - */ - constructor(shapes?: Shape | Array, curveSegments?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; - toJSON(): any; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; -import { Shape } from '../extras/core/Shape.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts deleted file mode 100644 index b150fa7df..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/SphereGeometry.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A class for generating a sphere geometry. - * - * ```js - * const geometry = new THREE.SphereGeometry( 15, 32, 16 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const sphere = new THREE.Mesh( geometry, material ); - * scene.add( sphere ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#SphereGeometry - */ -export class SphereGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {SphereGeometry} A new instance. - */ - static fromJSON(data: Object): SphereGeometry; - /** - * Constructs a new sphere geometry. - * - * @param {number} [radius=1] - The sphere radius. - * @param {number} [widthSegments=32] - The number of horizontal segments. Minimum value is `3`. - * @param {number} [heightSegments=16] - The number of vertical segments. Minimum value is `2`. - * @param {number} [phiStart=0] - The horizontal starting angle in radians. - * @param {number} [phiLength=Math.PI*2] - The horizontal sweep angle size. - * @param {number} [thetaStart=0] - The vertical starting angle in radians. - * @param {number} [thetaLength=Math.PI] - The vertical sweep angle size. - */ - constructor(radius?: number, widthSegments?: number, heightSegments?: number, phiStart?: number, phiLength?: number, thetaStart?: number, thetaLength?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts deleted file mode 100644 index 20b8cc1f3..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/TetrahedronGeometry.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * A geometry class for representing an tetrahedron. - * - * ```js - * const geometry = new THREE.TetrahedronGeometry(); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const tetrahedron = new THREE.Mesh( geometry, material ); - * scene.add( tetrahedron ); - * ``` - * - * @augments PolyhedronGeometry - * @demo scenes/geometry-browser.html#TetrahedronGeometry - */ -export class TetrahedronGeometry extends PolyhedronGeometry { - /** - * Constructs a new tetrahedron geometry. - * - * @param {number} [radius=1] - Radius of the tetrahedron. - * @param {number} [detail=0] - Setting this to a value greater than `0` adds vertices making it no longer a tetrahedron. - */ - constructor(radius?: number, detail?: number); -} -import { PolyhedronGeometry } from './PolyhedronGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts deleted file mode 100644 index cb545919c..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/TorusGeometry.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A geometry class for representing an torus. - * - * ```js - * const geometry = new THREE.TorusGeometry( 10, 3, 16, 100 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const torus = new THREE.Mesh( geometry, material ); - * scene.add( torus ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#TorusGeometry - */ -export class TorusGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {TorusGeometry} A new instance. - */ - static fromJSON(data: Object): TorusGeometry; - /** - * Constructs a new torus geometry. - * - * @param {number} [radius=1] - Radius of the torus, from the center of the torus to the center of the tube. - * @param {number} [tube=0.4] - Radius of the tube. Must be smaller than `radius`. - * @param {number} [radialSegments=12] - The number of radial segments. - * @param {number} [tubularSegments=48] - The number of tubular segments. - * @param {number} [arc=Math.PI*2] - Central angle in radians. - * @param {number} [thetaStart=0] - Start of the tubular sweep in radians. - * @param {number} [thetaLength=Math.PI*2] - Length of the tubular sweep in radians. - */ - constructor(radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, arc?: number, thetaStart?: number, thetaLength?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts deleted file mode 100644 index 5f7272dfe..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/TorusKnotGeometry.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Creates a torus knot, the particular shape of which is defined by a pair - * of coprime integers, p and q. If p and q are not coprime, the result will - * be a torus link. - * - * ```js - * const geometry = new THREE.TorusKnotGeometry( 10, 3, 100, 16 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const torusKnot = new THREE.Mesh( geometry, material ); - * scene.add( torusKnot ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#TorusKnotGeometry - */ -export class TorusKnotGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {TorusKnotGeometry} A new instance. - */ - static fromJSON(data: Object): TorusKnotGeometry; - /** - * Constructs a new torus knot geometry. - * - * @param {number} [radius=1] - Radius of the torus knot. - * @param {number} [tube=0.4] - Radius of the tube. - * @param {number} [tubularSegments=64] - The number of tubular segments. - * @param {number} [radialSegments=8] - The number of radial segments. - * @param {number} [p=2] - This value determines, how many times the geometry winds around its axis of rotational symmetry. - * @param {number} [q=3] - This value determines, how many times the geometry winds around a circle in the interior of the torus. - */ - constructor(radius?: number, tube?: number, tubularSegments?: number, radialSegments?: number, p?: number, q?: number); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts deleted file mode 100644 index f34277010..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/TubeGeometry.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Creates a tube that extrudes along a 3D curve. - * - * ```js - * class CustomSinCurve extends THREE.Curve { - * - * getPoint( t, optionalTarget = new THREE.Vector3() ) { - * - * const tx = t * 3 - 1.5; - * const ty = Math.sin( 2 * Math.PI * t ); - * const tz = 0; - * - * return optionalTarget.set( tx, ty, tz ); - * } - * - * } - * - * const path = new CustomSinCurve( 10 ); - * const geometry = new THREE.TubeGeometry( path, 20, 2, 8, false ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * ``` - * - * @augments BufferGeometry - * @demo scenes/geometry-browser.html#TubeGeometry - */ -export class TubeGeometry extends BufferGeometry { - /** - * Factory method for creating an instance of this class from the given - * JSON object. - * - * @param {Object} data - A JSON object representing the serialized geometry. - * @return {TubeGeometry} A new instance. - */ - static fromJSON(data: Object): TubeGeometry; - /** - * Constructs a new tube geometry. - * - * @param {Curve} [path=QuadraticBezierCurve3] - A 3D curve defining the path of the tube. - * @param {number} [tubularSegments=64] - The number of segments that make up the tube. - * @param {number} [radius=1] -The radius of the tube. - * @param {number} [radialSegments=8] - The number of segments that make up the cross-section. - * @param {boolean} [closed=false] - Whether the tube is closed or not. - */ - constructor(path?: Curve, tubularSegments?: number, radius?: number, radialSegments?: number, closed?: boolean); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - tangents: any; - normals: any; - binormals: any; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts b/jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts deleted file mode 100644 index 39f9908ab..000000000 --- a/jsdoc-testing/jsdoc/src/geometries/WireframeGeometry.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Can be used as a helper object to visualize a geometry as a wireframe. - * - * ```js - * const geometry = new THREE.SphereGeometry(); - * - * const wireframe = new THREE.WireframeGeometry( geometry ); - * - * const line = new THREE.LineSegments( wireframe ); - * line.material.depthWrite = false; - * line.material.opacity = 0.25; - * line.material.transparent = true; - * - * scene.add( line ); - * ``` - * - * Note: It is not yet possible to serialize/deserialize instances of this class. - * - * @augments BufferGeometry - */ -export class WireframeGeometry extends BufferGeometry { - /** - * Constructs a new wireframe geometry. - * - * @param {?BufferGeometry} [geometry=null] - The geometry. - */ - constructor(geometry?: BufferGeometry | null); - /** - * Holds the constructor parameters that have been - * used to generate the geometry. Any modification - * after instantiation does not change the geometry. - * - * @type {Object} - */ - parameters: Object; - copy(source: any): this; -} -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts deleted file mode 100644 index c4ee0cb4f..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/ArrowHelper.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * An 3D arrow object for visualizing directions. - * - * ```js - * const dir = new THREE.Vector3( 1, 2, 0 ); - * - * //normalize the direction vector (convert to vector of length 1) - * dir.normalize(); - * - * const origin = new THREE.Vector3( 0, 0, 0 ); - * const length = 1; - * const hex = 0xffff00; - * - * const arrowHelper = new THREE.ArrowHelper( dir, origin, length, hex ); - * scene.add( arrowHelper ); - * ``` - * - * @augments Object3D - */ -export class ArrowHelper extends Object3D { - /** - * Constructs a new arrow helper. - * - * @param {Vector3} [dir=(0, 0, 1)] - The (normalized) direction vector. - * @param {Vector3} [origin=(0, 0, 0)] - Point at which the arrow starts. - * @param {number} [length=1] - Length of the arrow in world units. - * @param {(number|Color|string)} [color=0xffff00] - Color of the arrow. - * @param {number} [headLength=length*0.2] - The length of the head of the arrow. - * @param {number} [headWidth=headLength*0.2] - The width of the head of the arrow. - */ - constructor(dir?: Vector3, origin?: Vector3, length?: number, color?: (number | Color | string), headLength?: number, headWidth?: number); - type: string; - /** - * The line part of the arrow helper. - * - * @type {Line} - */ - line: Line; - /** - * The cone part of the arrow helper. - * - * @type {Mesh} - */ - cone: Mesh; - /** - * Sets the direction of the helper. - * - * @param {Vector3} dir - The normalized direction vector. - */ - setDirection(dir: Vector3): void; - /** - * Sets the length of the helper. - * - * @param {number} length - Length of the arrow in world units. - * @param {number} [headLength=length*0.2] - The length of the head of the arrow. - * @param {number} [headWidth=headLength*0.2] - The width of the head of the arrow. - */ - setLength(length: number, headLength?: number, headWidth?: number): void; - /** - * Sets the color of the helper. - * - * @param {number|Color|string} color - The color to set. - */ - setColor(color: number | Color | string): void; - copy(source: any): this; -} -import { Object3D } from '../core/Object3D.js'; -import { Line } from '../objects/Line.js'; -import { Mesh } from '../objects/Mesh.js'; -import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts deleted file mode 100644 index 3669564fc..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/AxesHelper.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * An axis object to visualize the 3 axes in a simple way. - * The X axis is red. The Y axis is green. The Z axis is blue. - * - * ```js - * const axesHelper = new THREE.AxesHelper( 5 ); - * scene.add( axesHelper ); - * ``` - * - * @augments LineSegments - */ -export class AxesHelper extends LineSegments { - /** - * Constructs a new axes helper. - * - * @param {number} [size=1] - Size of the lines representing the axes. - */ - constructor(size?: number); - /** - * Defines the colors of the axes helper. - * - * @param {number|Color|string} xAxisColor - The color for the x axis. - * @param {number|Color|string} yAxisColor - The color for the y axis. - * @param {number|Color|string} zAxisColor - The color for the z axis. - * @return {AxesHelper} A reference to this axes helper. - */ - setColors(xAxisColor: number | Color | string, yAxisColor: number | Color | string, zAxisColor: number | Color | string): AxesHelper; -} -import { LineSegments } from '../objects/LineSegments.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts b/jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts deleted file mode 100644 index 77ea2a19f..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/Box3Helper.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A helper object to visualize an instance of {@link Box3}. - * - * ```js - * const box = new THREE.Box3(); - * box.setFromCenterAndSize( new THREE.Vector3( 1, 1, 1 ), new THREE.Vector3( 2, 1, 3 ) ); - * - * const helper = new THREE.Box3Helper( box, 0xffff00 ); - * scene.add( helper ) - * ``` - * - * @augments LineSegments - */ -export class Box3Helper extends LineSegments { - /** - * Constructs a new box3 helper. - * - * @param {Box3} box - The box to visualize. - * @param {number|Color|string} [color=0xffff00] - The box's color. - */ - constructor(box: Box3, color?: number | Color | string); - /** - * The box being visualized. - * - * @type {Box3} - */ - box: Box3; - updateMatrixWorld(force: any): void; -} -import { LineSegments } from '../objects/LineSegments.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts deleted file mode 100644 index 02a4fa37c..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/BoxHelper.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Helper object to graphically show the world-axis-aligned bounding box - * around an object. The actual bounding box is handled with {@link Box3}, - * this is just a visual helper for debugging. It can be automatically - * resized with {@link BoxHelper#update} when the object it's created from - * is transformed. Note that the object must have a geometry for this to work, - * so it won't work with sprites. - * - * ```js - * const sphere = new THREE.SphereGeometry(); - * const object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) ); - * const box = new THREE.BoxHelper( object, 0xffff00 ); - * scene.add( box ); - * ``` - * - * @augments LineSegments - */ -export class BoxHelper extends LineSegments { - /** - * The 3D object being visualized. - * - * @type {Object3D} - */ - object: Object3D; - /** - * Updates the helper's geometry to match the dimensions of the object, - * including any children. - */ - update(): void; - /** - * Updates the wireframe box for the passed object. - * - * @param {Object3D} object - The 3D object to create the helper for. - * @return {BoxHelper} A reference to this instance. - */ - setFromObject(object: Object3D): BoxHelper; - copy(source: any, recursive: any): this; -} -import { LineSegments } from '../objects/LineSegments.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts deleted file mode 100644 index 7aa2e0e29..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/CameraHelper.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This helps with visualizing what a camera contains in its frustum. It - * visualizes the frustum of a camera using a line segments. - * - * Based on frustum visualization in [lightgl.js shadowmap example](https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html). - * - * `CameraHelper` must be a child of the scene. - * - * When the camera is transformed or its projection matrix is changed, it's necessary - * to call the `update()` method of the respective helper. - * - * ```js - * const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); - * const helper = new THREE.CameraHelper( camera ); - * scene.add( helper ); - * ``` - * - * @augments LineSegments - */ -export class CameraHelper extends LineSegments { - /** - * Constructs a new arrow helper. - * - * @param {Camera} camera - The camera to visualize. - */ - constructor(camera: Camera); - /** - * The camera being visualized. - * - * @type {Camera} - */ - camera: Camera; - /** - * This contains the points used to visualize the camera. - * - * @type {Object>} - */ - pointMap: { - [x: string]: number[]; - }; - /** - * Defines the colors of the helper. - * - * @param {Color} frustum - The frustum line color. - * @param {Color} cone - The cone line color. - * @param {Color} up - The up line color. - * @param {Color} target - The target line color. - * @param {Color} cross - The cross line color. - * @return {CameraHelper} A reference to this helper. - */ - setColors(frustum: Color, cone: Color, up: Color, target: Color, cross: Color): CameraHelper; - /** - * Updates the helper based on the projection matrix of the camera. - */ - update(): void; -} -import { LineSegments } from '../objects/LineSegments.js'; -import { Camera } from '../cameras/Camera.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts deleted file mode 100644 index 6931d5275..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/DirectionalLightHelper.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Helper object to assist with visualizing a {@link DirectionalLight}'s - * effect on the scene. This consists of a plane and a line representing the - * light's position and direction. - * - * When the directional light or its target are transformed or light properties - * are changed, it's necessary to call the `update()` method of the respective helper. - * - * ```js - * const light = new THREE.DirectionalLight( 0xFFFFFF ); - * scene.add( light ); - * - * const helper = new THREE.DirectionalLightHelper( light, 5 ); - * scene.add( helper ); - * ``` - * - * @augments Object3D - */ -export class DirectionalLightHelper extends Object3D { - /** - * Constructs a new directional light helper. - * - * @param {DirectionalLight} light - The light to be visualized. - * @param {number} [size=1] - The dimensions of the plane. - * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take - * the color of the light. - */ - constructor(light: DirectionalLight, size?: number, color?: number | Color | string); - /** - * The light being visualized. - * - * @type {DirectionalLight} - */ - light: DirectionalLight; - matrix: any; - /** - * The color parameter passed in the constructor. - * If not set, the helper will take the color of the light. - * - * @type {number|Color|string} - */ - color: number | Color | string; - type: string; - /** - * Contains the line showing the location of the directional light. - * - * @type {Line} - */ - lightPlane: Line; - /** - * Represents the target line of the directional light. - * - * @type {Line} - */ - targetLine: Line; - /** - * Updates the helper to match the position and direction of the - * light being visualized. - */ - update(): void; -} -import { Object3D } from '../core/Object3D.js'; -import { Line } from '../objects/Line.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts deleted file mode 100644 index 7efd650b5..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/GridHelper.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * The helper is an object to define grids. Grids are two-dimensional - * arrays of lines. - * - * ```js - * const size = 10; - * const divisions = 10; - * - * const gridHelper = new THREE.GridHelper( size, divisions ); - * scene.add( gridHelper ); - * ``` - * - * @augments LineSegments - */ -export class GridHelper extends LineSegments { - /** - * Constructs a new grid helper. - * - * @param {number} [size=10] - The size of the grid. - * @param {number} [divisions=10] - The number of divisions across the grid. - * @param {number|Color|string} [color1=0x444444] - The color of the center line. - * @param {number|Color|string} [color2=0x888888] - The color of the lines of the grid. - */ - constructor(size?: number, divisions?: number, color1?: number | Color | string, color2?: number | Color | string); -} -import { LineSegments } from '../objects/LineSegments.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts deleted file mode 100644 index d3dc6b8da..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/HemisphereLightHelper.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Creates a visual aid consisting of a spherical mesh for a - * given {@link HemisphereLight}. - * - * When the hemisphere light is transformed or its light properties are changed, - * it's necessary to call the `update()` method of the respective helper. - * - * ```js - * const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); - * const helper = new THREE.HemisphereLightHelper( light, 5 ); - * scene.add( helper ); - * ``` - * - * @augments Object3D - */ -export class HemisphereLightHelper extends Object3D { - /** - * Constructs a new hemisphere light helper. - * - * @param {HemisphereLight} light - The light to be visualized. - * @param {number} [size=1] - The size of the mesh used to visualize the light. - * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take - * the color of the light. - */ - constructor(light: HemisphereLight, size?: number, color?: number | Color | string); - /** - * The light being visualized. - * - * @type {HemisphereLight} - */ - light: HemisphereLight; - matrix: any; - /** - * The color parameter passed in the constructor. - * If not set, the helper will take the color of the light. - * - * @type {number|Color|string} - */ - color: number | Color | string; - type: string; - material: MeshBasicMaterial; - /** - * Updates the helper to match the position and direction of the - * light being visualized. - */ - update(): void; -} -import { Object3D } from '../core/Object3D.js'; -import { Color } from '../math/Color.js'; -import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts deleted file mode 100644 index b2015d607..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/PlaneHelper.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A helper object to visualize an instance of {@link Plane}. - * - * ```js - * const plane = new THREE.Plane( new THREE.Vector3( 1, 1, 0.2 ), 3 ); - * const helper = new THREE.PlaneHelper( plane, 1, 0xffff00 ); - * scene.add( helper ); - * ``` - * - * @augments Line - */ -export class PlaneHelper extends Line { - /** - * Constructs a new plane helper. - * - * @param {Plane} plane - The plane to be visualized. - * @param {number} [size=1] - The side length of plane helper. - * @param {number|Color|string} [hex=0xffff00] - The helper's color. - */ - constructor(plane: Plane, size?: number, hex?: number | Color | string); - /** - * The plane being visualized. - * - * @type {Plane} - */ - plane: Plane; - /** - * The side length of plane helper. - * - * @type {number} - * @default 1 - */ - size: number; - updateMatrixWorld(force: any): void; -} -import { Line } from '../objects/Line.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts deleted file mode 100644 index ef2ecb228..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/PointLightHelper.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This displays a helper object consisting of a spherical mesh for - * visualizing an instance of {@link PointLight}. - * - * ```js - * const pointLight = new THREE.PointLight( 0xff0000, 1, 100 ); - * pointLight.position.set( 10, 10, 10 ); - * scene.add( pointLight ); - * - * const sphereSize = 1; - * const pointLightHelper = new THREE.PointLightHelper( pointLight, sphereSize ); - * scene.add( pointLightHelper ); - * ``` - * - * @augments Mesh - */ -export class PointLightHelper extends Mesh { - /** - * Constructs a new point light helper. - * - * @param {PointLight} light - The light to be visualized. - * @param {number} [sphereSize=1] - The size of the sphere helper. - * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take - * the color of the light. - */ - constructor(light: PointLight, sphereSize?: number, color?: number | Color | string); - /** - * The light being visualized. - * - * @type {PointLight} - */ - light: PointLight; - /** - * The color parameter passed in the constructor. - * If not set, the helper will take the color of the light. - * - * @type {number|Color|string} - */ - color: number | Color | string; - matrix: any; - /** - * Updates the helper to match the position of the - * light being visualized. - */ - update(): void; -} -import { Mesh } from '../objects/Mesh.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts deleted file mode 100644 index edaecda65..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/PolarGridHelper.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This helper is an object to define polar grids. Grids are - * two-dimensional arrays of lines. - * - * ```js - * const radius = 10; - * const sectors = 16; - * const rings = 8; - * const divisions = 64; - * - * const helper = new THREE.PolarGridHelper( radius, sectors, rings, divisions ); - * scene.add( helper ); - * ``` - * - * @augments LineSegments - */ -export class PolarGridHelper extends LineSegments { - /** - * Constructs a new polar grid helper. - * - * @param {number} [radius=10] - The radius of the polar grid. This can be any positive number. - * @param {number} [sectors=16] - The number of sectors the grid will be divided into. This can be any positive integer. - * @param {number} [rings=16] - The number of rings. This can be any positive integer. - * @param {number} [divisions=64] - The number of line segments used for each circle. This can be any positive integer. - * @param {number|Color|string} [color1=0x444444] - The first color used for grid elements. - * @param {number|Color|string} [color2=0x888888] - The second color used for grid elements. - */ - constructor(radius?: number, sectors?: number, rings?: number, divisions?: number, color1?: number | Color | string, color2?: number | Color | string); -} -import { LineSegments } from '../objects/LineSegments.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts deleted file mode 100644 index 4b864c4eb..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/SkeletonHelper.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * A helper object to assist with visualizing a {@link Skeleton}. - * - * ```js - * const helper = new THREE.SkeletonHelper( skinnedMesh ); - * scene.add( helper ); - * ``` - * - * @augments LineSegments - */ -export class SkeletonHelper extends LineSegments { - /** - * Constructs a new skeleton helper. - * - * @param {Object3D} object - Usually an instance of {@link SkinnedMesh}. However, any 3D object - * can be used if it represents a hierarchy of bones (see {@link Bone}). - */ - constructor(object: Object3D); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSkeletonHelper: boolean; - /** - * The object being visualized. - * - * @type {Object3D} - */ - root: Object3D; - /** - * The list of bones that the helper visualizes. - * - * @type {Array} - */ - bones: Array; - matrix: any; - updateMatrixWorld(force: any): void; - /** - * Defines the colors of the helper. - * - * @param {Color} color1 - The first line color for each bone. - * @param {Color} color2 - The second line color for each bone. - * @return {SkeletonHelper} A reference to this helper. - */ - setColors(color1: Color, color2: Color): SkeletonHelper; -} -import { LineSegments } from '../objects/LineSegments.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts b/jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts deleted file mode 100644 index 84337bbb2..000000000 --- a/jsdoc-testing/jsdoc/src/helpers/SpotLightHelper.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * This displays a cone shaped helper object for a {@link SpotLight}. - * - * When the spot light or its target are transformed or light properties are - * changed, it's necessary to call the `update()` method of the respective helper. - * - * ```js - * const spotLight = new THREE.SpotLight( 0xffffff ); - * spotLight.position.set( 10, 10, 10 ); - * scene.add( spotLight ); - * - * const spotLightHelper = new THREE.SpotLightHelper( spotLight ); - * scene.add( spotLightHelper ); - * ``` - * - * @augments Object3D - */ -export class SpotLightHelper extends Object3D { - /** - * Constructs a new spot light helper. - * - * @param {HemisphereLight} light - The light to be visualized. - * @param {number|Color|string} [color] - The helper's color. If not set, the helper will take - * the color of the light. - */ - constructor(light: HemisphereLight, color?: number | Color | string); - /** - * The light being visualized. - * - * @type {SpotLight} - */ - light: SpotLight; - /** - * The color parameter passed in the constructor. - * If not set, the helper will take the color of the light. - * - * @type {number|Color|string} - */ - color: number | Color | string; - type: string; - cone: LineSegments; - /** - * Updates the helper to match the position and direction of the - * light being visualized. - */ - update(): void; -} -import { Object3D } from '../core/Object3D.js'; -import { LineSegments } from '../objects/LineSegments.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts b/jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts deleted file mode 100644 index 78c3196fd..000000000 --- a/jsdoc-testing/jsdoc/src/lights/AmbientLight.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This light globally illuminates all objects in the scene equally. - * - * It cannot be used to cast shadows as it does not have a direction. - * - * ```js - * const light = new THREE.AmbientLight( 0x404040 ); // soft white light - * scene.add( light ); - * ``` - * - * @augments Light - */ -export class AmbientLight extends Light { - /** - * Constructs a new ambient light. - * - * @param {(number|Color|string)} [color=0xffffff] - The light's color. - * @param {number} [intensity=1] - The light's strength/intensity. - */ - constructor(color?: (number | Color | string), intensity?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAmbientLight: boolean; -} -import { Light } from './Light.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts b/jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts deleted file mode 100644 index 753317423..000000000 --- a/jsdoc-testing/jsdoc/src/lights/DirectionalLight.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * A light that gets emitted in a specific direction. This light will behave - * as though it is infinitely far away and the rays produced from it are all - * parallel. The common use case for this is to simulate daylight; the sun is - * far enough away that its position can be considered to be infinite, and - * all light rays coming from it are parallel. - * - * A common point of confusion for directional lights is that setting the - * rotation has no effect. This is because three.js's DirectionalLight is the - * equivalent to what is often called a 'Target Direct Light' in other - * applications. - * - * This means that its direction is calculated as pointing from the light's - * {@link Object3D#position} to the {@link DirectionalLight#target} position - * (as opposed to a 'Free Direct Light' that just has a rotation - * component). - * - * This light can cast shadows - see the {@link DirectionalLightShadow} for details. - * - * ```js - * // White directional light at half intensity shining from the top. - * const directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 ); - * scene.add( directionalLight ); - * ``` - * - * @augments Light - */ -export class DirectionalLight extends Light { - /** - * Constructs a new directional light. - * - * @param {(number|Color|string)} [color=0xffffff] - The light's color. - * @param {number} [intensity=1] - The light's strength/intensity. - */ - constructor(color?: (number | Color | string), intensity?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isDirectionalLight: boolean; - /** - * The directional light points from its position to the - * target's position. - * - * For the target's position to be changed to anything other - * than the default, it must be added to the scene. - * - * It is also possible to set the target to be another 3D object - * in the scene. The light will now track the target object. - * - * @type {Object3D} - */ - target: Object3D; - /** - * This property holds the light's shadow configuration. - * - * @type {DirectionalLightShadow} - */ - shadow: DirectionalLightShadow; - copy(source: any): this; -} -import { Light } from './Light.js'; -import { Object3D } from '../core/Object3D.js'; -import { DirectionalLightShadow } from './DirectionalLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts deleted file mode 100644 index 69d809ea1..000000000 --- a/jsdoc-testing/jsdoc/src/lights/DirectionalLightShadow.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Represents the shadow configuration of directional lights. - * - * @augments LightShadow - */ -export class DirectionalLightShadow extends LightShadow { - /** - * Constructs a new directional light shadow. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isDirectionalLightShadow: boolean; -} -import { LightShadow } from './LightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts b/jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts deleted file mode 100644 index 9bffa0d03..000000000 --- a/jsdoc-testing/jsdoc/src/lights/HemisphereLight.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * A light source positioned directly above the scene, with color fading from - * the sky color to the ground color. - * - * This light cannot be used to cast shadows. - * - * ```js - * const light = new THREE.HemisphereLight( 0xffffbb, 0x080820, 1 ); - * scene.add( light ); - * ``` - * - * @augments Light - */ -export class HemisphereLight extends Light { - /** - * Constructs a new hemisphere light. - * - * @param {(number|Color|string)} [skyColor=0xffffff] - The light's sky color. - * @param {(number|Color|string)} [groundColor=0xffffff] - The light's ground color. - * @param {number} [intensity=1] - The light's strength/intensity. - */ - constructor(skyColor?: (number | Color | string), groundColor?: (number | Color | string), intensity?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isHemisphereLight: boolean; - /** - * The light's ground color. - * - * @type {Color} - */ - groundColor: Color; - copy(source: any, recursive: any): this; -} -import { Light } from './Light.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/Light.d.ts b/jsdoc-testing/jsdoc/src/lights/Light.d.ts deleted file mode 100644 index 53b1d77ab..000000000 --- a/jsdoc-testing/jsdoc/src/lights/Light.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Abstract base class for lights - all other light types inherit the - * properties and methods described here. - * - * @abstract - * @augments Object3D - */ -export class Light extends Object3D { - /** - * Constructs a new light. - * - * @param {(number|Color|string)} [color=0xffffff] - The light's color. - * @param {number} [intensity=1] - The light's strength/intensity. - */ - constructor(color?: (number | Color | string), intensity?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLight: boolean; - type: string; - /** - * The light's color. - * - * @type {Color} - */ - color: Color; - /** - * The light's intensity. - * - * @type {number} - * @default 1 - */ - intensity: number; - copy(source: any, recursive: any): this; - toJSON(meta: any): Object; -} -import { Object3D } from '../core/Object3D.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts b/jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts deleted file mode 100644 index 8a03aa8cf..000000000 --- a/jsdoc-testing/jsdoc/src/lights/LightProbe.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Light probes are an alternative way of adding light to a 3D scene. Unlike - * classical light sources (e.g. directional, point or spot lights), light - * probes do not emit light. Instead they store information about light - * passing through 3D space. During rendering, the light that hits a 3D - * object is approximated by using the data from the light probe. - * - * Light probes are usually created from (radiance) environment maps. The - * class {@link LightProbeGenerator} can be used to create light probes from - * cube textures or render targets. However, light estimation data could also - * be provided in other forms e.g. by WebXR. This enables the rendering of - * augmented reality content that reacts to real world lighting. - * - * The current probe implementation in three.js supports so-called diffuse - * light probes. This type of light probe is functionally equivalent to an - * irradiance environment map. - * - * @augments Light - */ -export class LightProbe extends Light { - /** - * Constructs a new light probe. - * - * @param {SphericalHarmonics3} sh - The spherical harmonics which represents encoded lighting information. - * @param {number} [intensity=1] - The light's strength/intensity. - */ - constructor(sh?: SphericalHarmonics3, intensity?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLightProbe: boolean; - /** - * A light probe uses spherical harmonics to encode lighting information. - * - * @type {SphericalHarmonics3} - */ - sh: SphericalHarmonics3; - copy(source: any): this; -} -import { Light } from './Light.js'; -import { SphericalHarmonics3 } from '../math/SphericalHarmonics3.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts deleted file mode 100644 index 71e500048..000000000 --- a/jsdoc-testing/jsdoc/src/lights/LightShadow.d.ts +++ /dev/null @@ -1,215 +0,0 @@ -/** - * Abstract base class for light shadow classes. These classes - * represent the shadow configuration for different light types. - * - * @abstract - */ -export class LightShadow { - /** - * Constructs a new light shadow. - * - * @param {Camera} camera - The light's view of the world. - */ - constructor(camera: Camera); - /** - * The light's view of the world. - * - * @type {Camera} - */ - camera: Camera; - /** - * The intensity of the shadow. The default is `1`. - * Valid values are in the range `[0, 1]`. - * - * @type {number} - * @default 1 - */ - intensity: number; - /** - * Shadow map bias, how much to add or subtract from the normalized depth - * when deciding whether a surface is in shadow. - * - * The default is `0`. Very tiny adjustments here (in the order of `0.0001`) - * may help reduce artifacts in shadows. - * - * @type {number} - * @default 0 - */ - bias: number; - /** - * A node version of `bias`. Only supported with `WebGPURenderer`. - * - * If a bias node is defined, `bias` has no effect. - * - * @type {?Node} - * @default null - */ - biasNode: Node | null; - /** - * Defines how much the position used to query the shadow map is offset along - * the object normal. The default is `0`. Increasing this value can be used to - * reduce shadow acne especially in large scenes where light shines onto - * geometry at a shallow angle. The cost is that shadows may appear distorted. - * - * @type {number} - * @default 0 - */ - normalBias: number; - /** - * Setting this to values greater than 1 will blur the edges of the shadow. - * High values will cause unwanted banding effects in the shadows - a greater - * map size will allow for a higher value to be used here before these effects - * become visible. - * - * The property has no effect when the shadow map type is `BasicShadowMap`. - * - * @type {number} - * @default 1 - */ - radius: number; - /** - * The amount of samples to use when blurring a VSM shadow map. - * - * @type {number} - * @default 8 - */ - blurSamples: number; - /** - * Defines the width and height of the shadow map. Higher values give better quality - * shadows at the cost of computation time. Values must be powers of two. - * - * @type {Vector2} - * @default (512,512) - */ - mapSize: Vector2; - /** - * The type of shadow texture. The default is `UnsignedByteType`. - * - * @type {number} - * @default UnsignedByteType - */ - mapType: number; - /** - * The depth map generated using the internal camera; a location beyond a - * pixel's depth is in shadow. Computed internally during rendering. - * - * @type {?RenderTarget} - * @default null - */ - map: RenderTarget | null; - /** - * The distribution map generated using the internal camera; an occlusion is - * calculated based on the distribution of depths. Computed internally during - * rendering. - * - * @type {?RenderTarget} - * @default null - */ - mapPass: RenderTarget | null; - /** - * Model to shadow camera space, to compute location and depth in shadow map. - * This is computed internally during rendering. - * - * @type {Matrix4} - */ - matrix: Matrix4; - /** - * Enables automatic updates of the light's shadow. If you do not require dynamic - * lighting / shadows, you may set this to `false`. - * - * @type {boolean} - * @default true - */ - autoUpdate: boolean; - /** - * When set to `true`, shadow maps will be updated in the next `render` call. - * If you have set {@link LightShadow#autoUpdate} to `false`, you will need to - * set this property to `true` and then make a render call to update the light's shadow. - * - * @type {boolean} - * @default false - */ - needsUpdate: boolean; - _frustum: Frustum; - _frameExtents: Vector2; - _viewportCount: number; - _viewports: Vector4[]; - /** - * Used internally by the renderer to get the number of viewports that need - * to be rendered for this shadow. - * - * @return {number} The viewport count. - */ - getViewportCount(): number; - /** - * Used internally by the renderer to get the camera that renders the given viewport. - * - * @param {number} [viewportIndex=0] - The viewport index. - * @return {Camera} The shadow camera. - */ - getCamera(): Camera; - /** - * Gets the shadow cameras frustum. Used internally by the renderer to cull objects. - * - * @return {Frustum} The shadow camera frustum. - */ - getFrustum(): Frustum; - /** - * Update the matrices for the camera and shadow, used internally by the renderer. - * - * @param {Light} light - The light for which the shadow is being rendered. - */ - updateMatrices(light: Light): void; - /** - * Updates a shadow projection matrix and its corresponding frustum. - * - * @private - * @param {Camera} shadowCamera - The shadow camera. - * @param {Matrix4} shadowMatrix - The target shadow matrix. - * @param {Frustum} frustum - The target frustum. - * @param {Vector4} [viewport] - The viewport within the shadow atlas. - */ - private _updateMatrix; - /** - * Returns a viewport definition for the given viewport index. - * - * @param {number} viewportIndex - The viewport index. - * @return {Vector4} The viewport. - */ - getViewport(viewportIndex: number): Vector4; - /** - * Returns the frame extends. - * - * @return {Vector2} The frame extends. - */ - getFrameExtents(): Vector2; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - */ - dispose(): void; - /** - * Copies the values of the given light shadow instance to this instance. - * - * @param {LightShadow} source - The light shadow to copy. - * @return {LightShadow} A reference to this light shadow instance. - */ - copy(source: LightShadow): LightShadow; - /** - * Returns a new light shadow instance with copied values from this instance. - * - * @return {LightShadow} A clone of this instance. - */ - clone(): LightShadow; - /** - * Serializes the light shadow into JSON. - * - * @return {Object} A JSON object representing the serialized light shadow. - * @see {@link ObjectLoader#parse} - */ - toJSON(): Object; -} -import { Vector2 } from '../math/Vector2.js'; -import { Matrix4 } from '../math/Matrix4.js'; -import { Frustum } from '../math/Frustum.js'; -import { Vector4 } from '../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/PointLight.d.ts b/jsdoc-testing/jsdoc/src/lights/PointLight.d.ts deleted file mode 100644 index f42ec0f7c..000000000 --- a/jsdoc-testing/jsdoc/src/lights/PointLight.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * A light that gets emitted from a single point in all directions. A common - * use case for this is to replicate the light emitted from a bare - * lightbulb. - * - * This light can cast shadows - see the {@link PointLightShadow} for details. - * - * ```js - * const light = new THREE.PointLight( 0xff0000, 1, 100 ); - * light.position.set( 50, 50, 50 ); - * scene.add( light ); - * ``` - * - * @augments Light - */ -export class PointLight extends Light { - /** - * Constructs a new point light. - * - * @param {(number|Color|string)} [color=0xffffff] - The light's color. - * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd). - * @param {number} [distance=0] - Maximum range of the light. `0` means no limit. - * @param {number} [decay=2] - The amount the light dims along the distance of the light. - */ - constructor(color?: (number | Color | string), intensity?: number, distance?: number, decay?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPointLight: boolean; - /** - * When distance is zero, light will attenuate according to inverse-square - * law to infinite distance. When distance is non-zero, light will attenuate - * according to inverse-square law until near the distance cutoff, where it - * will then attenuate quickly and smoothly to 0. Inherently, cutoffs are not - * physically correct. - * - * @type {number} - * @default 0 - */ - distance: number; - /** - * The amount the light dims along the distance of the light. In context of - * physically-correct rendering the default value should not be changed. - * - * @type {number} - * @default 2 - */ - decay: number; - /** - * This property holds the light's shadow configuration. - * - * @type {PointLightShadow} - */ - shadow: PointLightShadow; - set power(power: number); - /** - * The light's power. Power is the luminous power of the light measured in lumens (lm). - * Changing the power will also change the light's intensity. - * - * @type {number} - */ - get power(): number; - copy(source: any, recursive: any): this; -} -import { Light } from './Light.js'; -import { PointLightShadow } from './PointLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts deleted file mode 100644 index 9157a63b8..000000000 --- a/jsdoc-testing/jsdoc/src/lights/PointLightShadow.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Represents the shadow configuration of point lights. - * - * @augments LightShadow - */ -export class PointLightShadow extends LightShadow { - /** - * Constructs a new point light shadow. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPointLightShadow: boolean; -} -import { LightShadow } from './LightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts b/jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts deleted file mode 100644 index 6d4b7b657..000000000 --- a/jsdoc-testing/jsdoc/src/lights/RectAreaLight.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * This class emits light uniformly across the face a rectangular plane. - * This light type can be used to simulate light sources such as bright - * windows or strip lighting. - * - * Important Notes: - * - * - There is no shadow support. - * - Only PBR materials are supported. - * - You have to include `RectAreaLightUniformsLib` (`WebGLRenderer`) or `RectAreaLightTexturesLib` (`WebGPURenderer`) - * into your app and init the uniforms/textures. - * - * ```js - * RectAreaLightUniformsLib.init(); // only relevant for WebGLRenderer - * THREE.RectAreaLightNode.setLTC( RectAreaLightTexturesLib.init() ); // only relevant for WebGPURenderer - * - * const intensity = 1; const width = 10; const height = 10; - * const rectLight = new THREE.RectAreaLight( 0xffffff, intensity, width, height ); - * rectLight.position.set( 5, 5, 0 ); - * rectLight.lookAt( 0, 0, 0 ); - * scene.add( rectLight ) - * ``` - * - * @augments Light - */ -export class RectAreaLight extends Light { - /** - * Constructs a new area light. - * - * @param {(number|Color|string)} [color=0xffffff] - The light's color. - * @param {number} [intensity=1] - The light's strength/intensity. - * @param {number} [width=10] - The width of the light. - * @param {number} [height=10] - The height of the light. - */ - constructor(color?: (number | Color | string), intensity?: number, width?: number, height?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRectAreaLight: boolean; - /** - * The width of the light. - * - * @type {number} - * @default 10 - */ - width: number; - /** - * The height of the light. - * - * @type {number} - * @default 10 - */ - height: number; - set power(power: number); - /** - * The light's power. Power is the luminous power of the light measured in lumens (lm). - * Changing the power will also change the light's intensity. - * - * @type {number} - */ - get power(): number; - copy(source: any): this; -} -import { Light } from './Light.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts b/jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts deleted file mode 100644 index 1197fdf27..000000000 --- a/jsdoc-testing/jsdoc/src/lights/SpotLight.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -/** - * This light gets emitted from a single point in one direction, along a cone - * that increases in size the further from the light it gets. - * - * This light can cast shadows - see the {@link SpotLightShadow} for details. - * - * ```js - * // white spotlight shining from the side, modulated by a texture - * const spotLight = new THREE.SpotLight( 0xffffff ); - * spotLight.position.set( 100, 1000, 100 ); - * spotLight.map = new THREE.TextureLoader().load( url ); - * - * spotLight.castShadow = true; - * spotLight.shadow.mapSize.width = 1024; - * spotLight.shadow.mapSize.height = 1024; - * spotLight.shadow.camera.near = 500; - * spotLight.shadow.camera.far = 4000; - * spotLight.shadow.camera.fov = 30;s - * ``` - * - * @augments Light - */ -export class SpotLight extends Light { - /** - * Constructs a new spot light. - * - * @param {(number|Color|string)} [color=0xffffff] - The light's color. - * @param {number} [intensity=1] - The light's strength/intensity measured in candela (cd). - * @param {number} [distance=0] - Maximum range of the light. `0` means no limit. - * @param {number} [angle=Math.PI/3] - Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. - * @param {number} [penumbra=0] - Percent of the spotlight cone that is attenuated due to penumbra. Value range is `[0,1]`. - * @param {number} [decay=2] - The amount the light dims along the distance of the light. - */ - constructor(color?: (number | Color | string), intensity?: number, distance?: number, angle?: number, penumbra?: number, decay?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSpotLight: boolean; - /** - * The spot light points from its position to the - * target's position. - * - * For the target's position to be changed to anything other - * than the default, it must be added to the scene. - * - * It is also possible to set the target to be another 3D object - * in the scene. The light will now track the target object. - * - * @type {Object3D} - */ - target: Object3D; - /** - * Maximum range of the light. `0` means no limit. - * - * @type {number} - * @default 0 - */ - distance: number; - /** - * Maximum angle of light dispersion from its direction whose upper bound is `Math.PI/2`. - * - * @type {number} - * @default Math.PI/3 - */ - angle: number; - /** - * Percent of the spotlight cone that is attenuated due to penumbra. - * Value range is `[0,1]`. - * - * @type {number} - * @default 0 - */ - penumbra: number; - /** - * The amount the light dims along the distance of the light. In context of - * physically-correct rendering the default value should not be changed. - * - * @type {number} - * @default 2 - */ - decay: number; - /** - * A texture used to modulate the color of the light. The spot light - * color is mixed with the RGB value of this texture, with a ratio - * corresponding to its alpha value. The cookie-like masking effect is - * reproduced using pixel values (0, 0, 0, 1-cookie_value). - * - * *Warning*: This property is disabled if {@link Object3D#castShadow} is set to `false`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * This property holds the light's shadow configuration. - * - * @type {SpotLightShadow} - */ - shadow: SpotLightShadow; - set power(power: number); - /** - * The light's power. Power is the luminous power of the light measured in lumens (lm). - * Changing the power will also change the light's intensity. - * - * @type {number} - */ - get power(): number; - copy(source: any, recursive: any): this; -} -import { Light } from './Light.js'; -import { Object3D } from '../core/Object3D.js'; -import { SpotLightShadow } from './SpotLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts deleted file mode 100644 index 0de4c95b0..000000000 --- a/jsdoc-testing/jsdoc/src/lights/SpotLightShadow.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Represents the shadow configuration of directional lights. - * - * @augments LightShadow - */ -export class SpotLightShadow extends LightShadow { - /** - * Constructs a new spot light shadow. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSpotLightShadow: boolean; - /** - * Used to focus the shadow camera. The camera's field of view is set as a - * percentage of the spotlight's field-of-view. Range is `[0, 1]`. - * - * @type {number} - * @default 1 - */ - focus: number; - /** - * Texture aspect ratio. - * - * @type {number} - * @default 1 - */ - aspect: number; - updateMatrices(light: any): void; - copy(source: any): this; -} -import { LightShadow } from './LightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SunLight.d.ts b/jsdoc-testing/jsdoc/src/lights/SunLight.d.ts deleted file mode 100644 index a89ca7861..000000000 --- a/jsdoc-testing/jsdoc/src/lights/SunLight.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * A sun-like light that gets emitted in a specific direction, with rays that - * are all parallel, and casts cascaded shadow maps via {@link SunLightShadow}, - * suited for lighting large scenes. - * - * Unlike {@link DirectionalLight}, the light has no target: like - * {@link HemisphereLight}, its direction is defined by its position. The - * light shines from its position towards the origin and points straight - * down by default. - * - * ```js - * const sun = new SunLight( 0xfff2e3, 3 ); - * sun.position.set( 1, 1, 1 ); - * sun.castShadow = true; - * scene.add( sun ); - * ``` - * - * This light is only supported by `WebGLRenderer`. When using `WebGPURenderer`, - * use {@link DirectionalLight} with `CSMShadowNode` instead. - * - * @augments Light - */ -export class SunLight extends Light { - /** - * Constructs a new sun light. - * - * @param {(number|Color|string)} [color=0xffffff] - The light's color. - * @param {number} [intensity=1] - The light's strength/intensity. - */ - constructor(color?: (number | Color | string), intensity?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSunLight: boolean; - /** - * This property holds the light's shadow configuration. - * - * @type {SunLightShadow} - */ - shadow: SunLightShadow; - copy(source: any): this; -} -import { Light } from './Light.js'; -import { SunLightShadow } from './SunLightShadow.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts b/jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts deleted file mode 100644 index b61d245ab..000000000 --- a/jsdoc-testing/jsdoc/src/lights/SunLightShadow.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Represents the shadow configuration of {@link SunLight}, using four - * cascaded shadow maps (CSM). - * - * The shadow camera projection is fitted automatically to slices of the view - * frustum, up to a distance of `camera.far` (or the view camera's far plane, - * whichever is smaller), and adjacent cascades blend into each other over a - * small depth range. `camera.left/right/top/bottom` are ignored. - * - * The default `mapSize` is `1024x1024` per cascade. - * - * @augments LightShadow - */ -export class SunLightShadow extends LightShadow { - /** - * Constructs a new sun light shadow. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSunLightShadow: boolean; - _cameras: OrthographicCamera[]; - _matrices: Matrix4[]; - _frustums: Frustum[]; - _cascadeSplits: any[]; - _cascadeData: Vector4[]; - /** - * Returns the shadow camera of the given cascade. - * - * @param {number} [cascadeIndex=0] - The cascade index. - * @return {OrthographicCamera} The shadow camera. - */ - getCamera(cascadeIndex?: number): OrthographicCamera; - /** - * Returns the shadow matrix of the given cascade. - * - * @param {number} [cascadeIndex=0] - The cascade index. - * @return {Matrix4} The shadow matrix. - */ - getMatrix(cascadeIndex?: number): Matrix4; - /** - * Returns the shadow camera frustum of the given cascade. Used internally by - * the renderer to cull objects. - * - * @param {number} [cascadeIndex=0] - The cascade index. - * @return {Frustum} The shadow camera frustum. - */ - getFrustum(cascadeIndex?: number): Frustum; - /** - * Update the matrices for the cascade cameras and shadows, used internally - * by the renderer. - * - * @param {Light} light - The light for which the shadow is being rendered. - * @param {Camera} viewCamera - The camera the scene is rendered with. - */ - updateMatrices(light: Light, viewCamera: Camera): void; -} -import { LightShadow } from './LightShadow.js'; -import { OrthographicCamera } from '../cameras/OrthographicCamera.js'; -import { Matrix4 } from '../math/Matrix4.js'; -import { Frustum } from '../math/Frustum.js'; -import { Vector4 } from '../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts b/jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts deleted file mode 100644 index 0e372ff20..000000000 --- a/jsdoc-testing/jsdoc/src/lights/webgpu/IESSpotLight.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export default IESSpotLight; -/** - * A IES version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. - * - * @augments SpotLight - */ -declare class IESSpotLight extends SpotLight { - /** - * The IES map. It's a lookup table that stores normalized attenuation factors - * (0.0 to 1.0) that represent the light's intensity at a specific angle. - * - * @type {?Texture} - * @default null - */ - iesMap: Texture | null; - copy(source: any, recursive: any): this; -} -import { SpotLight } from '../SpotLight.js'; diff --git a/jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts b/jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts deleted file mode 100644 index f561855ff..000000000 --- a/jsdoc-testing/jsdoc/src/lights/webgpu/ProjectorLight.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export default ProjectorLight; -/** - * A projector light version of {@link SpotLight}. Can only be used with {@link WebGPURenderer}. - * - * @augments SpotLight - */ -declare class ProjectorLight extends SpotLight { - /** - * Aspect ratio of the light. Set to `null` to use the texture aspect ratio. - * - * @type {?number} - * @default null - */ - aspect: number | null; - copy(source: any, recursive: any): this; -} -import { SpotLight } from '../SpotLight.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts deleted file mode 100644 index 4bed37855..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/AnimationLoader.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Class for loading animation clips in the JSON format. The files are internally - * loaded via {@link FileLoader}. - * - * ```js - * const loader = new THREE.AnimationLoader(); - * const animations = await loader.loadAsync( 'animations/animation.js' ); - * ``` - * - * @augments Loader - */ -export class AnimationLoader extends Loader { - /** - * Starts loading from the given URL and pass the loaded animations as an array - * holding instances of {@link AnimationClip} to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Array)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Array) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given JSON object and returns an array of animation clips. - * - * @param {Object} json - The serialized animation clips. - * @return {Array} The parsed animation clips. - */ - parse(json: Object): Array; -} -import { Loader } from './Loader.js'; -import { AnimationClip } from '../animation/AnimationClip.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts deleted file mode 100644 index c9c2c4c2c..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/AudioLoader.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Class for loading audio buffers. Audios are internally - * loaded via {@link FileLoader}. - * - * ```js - * const audioListener = new THREE.AudioListener(); - * const ambientSound = new THREE.Audio( audioListener ); - * - * const loader = new THREE.AudioLoader(); - * const audioBuffer = await loader.loadAsync( 'audio/ambient_ocean.ogg' ); - * - * ambientSound.setBuffer( audioBuffer ); - * ambientSound.play(); - * ``` - * - * @augments Loader - */ -export class AudioLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded audio buffer - * to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(AudioBuffer)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: AudioBuffer) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; -} -import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts deleted file mode 100644 index b85f471e0..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/BufferGeometryLoader.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Class for loading geometries. The files are internally - * loaded via {@link FileLoader}. - * - * ```js - * const loader = new THREE.BufferGeometryLoader(); - * const geometry = await loader.loadAsync( 'models/json/pressure.json' ); - * - * const material = new THREE.MeshBasicMaterial( { color: 0xF5F5F5 } ); - * const object = new THREE.Mesh( geometry, material ); - * scene.add( object ); - * ``` - * - * @augments Loader - */ -export class BufferGeometryLoader extends Loader { - /** - * Starts loading from the given URL and pass the loaded geometry to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(BufferGeometry)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: BufferGeometry) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given JSON object and returns a geometry. - * - * @param {Object} json - The serialized geometry. - * @return {BufferGeometry} The parsed geometry. - */ - parse(json: Object): BufferGeometry; -} -import { Loader } from './Loader.js'; -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts deleted file mode 100644 index 652d27243..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/CompressedTextureLoader.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * ~TexData - */ -export type CompressedTextureLoader = { - /** - * - The width of the base mip. - */ - width: number; - /** - * - The width of the base mip. - */ - height: number; - /** - * - Whether the data represent a cubemap or not. - */ - isCubemap: boolean; - /** - * - The mipmap count. - */ - mipmapCount: number; - /** - * - An array holding the mipmaps. - * Each entry holds the data and the dimensions for each level. - */ - mipmaps: Array<{ - data: TypedArray; - width: number; - height: number; - }>; - /** - * - The texture format. - */ - format: number; -}; -/** - * Abstract base class for loading compressed texture formats S3TC, ASTC or ETC. - * Textures are internally loaded via {@link FileLoader}. - * - * Derived classes have to implement the `parse()` method which holds the parsing - * for the respective format. - * - * @abstract - * @augments Loader - */ -export class CompressedTextureLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded compressed texture - * to the `onLoad()` callback. The method also returns a new texture object which can - * directly be used for material creation. If you do it this way, the texture - * may pop up in your scene once the respective loading process is finished. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(CompressedTexture)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - * @return {CompressedTexture} The compressed texture. - */ - load(url: string, onLoad: (arg0: CompressedTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): CompressedTexture; -} -import { Loader } from './Loader.js'; -import { CompressedTexture } from '../textures/CompressedTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts deleted file mode 100644 index 8ac41df2c..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/CubeTextureLoader.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Class for loading cube textures. Images are internally loaded via {@link ImageLoader}. - * - * The loader returns an instance of {@link CubeTexture} and expects the cube map to - * be defined as six separate images representing the sides of a cube. Other cube map definitions - * like vertical and horizontal cross, column and row layouts are not supported. - * - * Note that, by convention, cube maps are specified in a coordinate system - * in which positive-x is to the right when looking up the positive-z axis -- - * in other words, using a left-handed coordinate system. Since three.js uses - * a right-handed coordinate system, environment maps used in three.js will - * have pos-x and neg-x swapped. - * - * The loaded cube texture is in sRGB color space. Meaning {@link Texture#colorSpace} - * is set to `SRGBColorSpace` by default. - * - * ```js - * const loader = new THREE.CubeTextureLoader().setPath( 'textures/cubeMaps/' ); - * const cubeTexture = await loader.loadAsync( [ - * 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' - * ] ); - * scene.background = cubeTexture; - * ``` - * - * @augments Loader - */ -export class CubeTextureLoader extends Loader { - /** - * Starts loading from the given URL and pass the fully loaded cube texture - * to the `onLoad()` callback. The method also returns a new cube texture object which can - * directly be used for material creation. If you do it this way, the cube texture - * may pop up in your scene once the respective loading process is finished. - * - * @param {Array} urls - Array of 6 URLs to images, one for each side of the - * cube texture. The urls should be specified in the following order: pos-x, - * neg-x, pos-y, neg-y, pos-z, neg-z. An array of data URIs are allowed as well. - * @param {function(CubeTexture)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Unsupported in this loader. - * @param {onErrorCallback} onError - Executed when errors occur. - * @return {CubeTexture} The cube texture. - */ - load(urls: Array, onLoad: (arg0: CubeTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): CubeTexture; -} -import { Loader } from './Loader.js'; -import { CubeTexture } from '../textures/CubeTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts deleted file mode 100644 index 62f05e621..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/DataTextureLoader.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * ~TexData - */ -export type DataTextureLoader = { - /** - * - An object holding width, height and the texture data. - */ - image?: Object | undefined; - /** - * - The width of the base mip. - */ - width?: number | undefined; - /** - * - The width of the base mip. - */ - height?: number | undefined; - /** - * - The texture data. - */ - data?: TypedArray; - /** - * - The texture format. - */ - format?: number | undefined; - /** - * - The texture type. - */ - type?: number | undefined; - /** - * - If set to `true`, the texture is flipped along the vertical axis when uploaded to the GPU. - */ - flipY?: boolean | undefined; - /** - * - The wrapS value. - */ - wrapS?: number | undefined; - /** - * - The wrapT value. - */ - wrapT?: number | undefined; - /** - * - The anisotropy value. - */ - anisotropy?: number | undefined; - /** - * - Whether to generate mipmaps or not. - */ - generateMipmaps?: boolean | undefined; - /** - * - The color space. - */ - colorSpace?: string | undefined; - /** - * - The mag filter. - */ - magFilter?: number | undefined; - /** - * - The min filter. - */ - minFilter?: number | undefined; - /** - * - The mipmaps. - */ - mipmaps?: Object[] | undefined; -}; -/** - * Abstract base class for loading binary texture formats RGBE, EXR or TGA. - * Textures are internally loaded via {@link FileLoader}. - * - * Derived classes have to implement the `parse()` method which holds the parsing - * for the respective format. - * - * @abstract - * @augments Loader - */ -export class DataTextureLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded data texture - * to the `onLoad()` callback. The method also returns a new texture object which can - * directly be used for material creation. If you do it this way, the texture - * may pop up in your scene once the respective loading process is finished. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(DataTexture)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - * @return {DataTexture} The data texture. - */ - load(url: string, onLoad: (arg0: DataTexture) => any, onProgress: onProgressCallback, onError: onErrorCallback): DataTexture; - /** - * Parses the given buffer and returns a configured data texture. Use this method - * for parsing texture data that is already in memory (e.g. drag and drop or data - * loaded from a server) without going through {@link DataTextureLoader#load}. - * - * @param {ArrayBuffer} buffer - The raw texture data. - * @return {DataTexture} The data texture. - */ - createDataTexture(buffer: ArrayBuffer): DataTexture; - /** - * Applies the given parsed texture data to the given data texture. - * - * @private - * @param {DataTexture} texture - The data texture. - * @param {DataTextureLoader~TexData} texData - The parsed texture data. - */ - private _applyTexData; -} -import { Loader } from './Loader.js'; -import { DataTexture } from '../textures/DataTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts deleted file mode 100644 index bdad7b69a..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/FileLoader.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * A low level class for loading resources with the Fetch API, used internally by - * most loaders. It can also be used directly to load any file type that does - * not have a loader. - * - * This loader supports caching. If you want to use it, add `THREE.Cache.enabled = true;` - * once to your application. - * - * ```js - * const loader = new THREE.FileLoader(); - * const data = await loader.loadAsync( 'example.txt' ); - * ``` - * - * @augments Loader - */ -export class FileLoader extends Loader { - /** - * The expected mime type. Valid values can be found - * [here](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#mimetype) - * - * @type {string} - */ - mimeType: string; - /** - * The expected response type. - * - * @type {('arraybuffer'|'blob'|'document'|'json'|'')} - * @default '' - */ - responseType: ("arraybuffer" | "blob" | "document" | "json" | ""); - /** - * Used for aborting requests. - * - * @private - * @type {AbortController} - */ - private _abortController; - /** - * Starts loading from the given URL and pass the loaded response to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(any)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. - * @param {onErrorCallback} [onError] - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: any) => any, onProgress?: onProgressCallback, onError?: onErrorCallback): void; - /** - * Sets the expected response type. - * - * @param {('arraybuffer'|'blob'|'document'|'json'|'')} value - The response type. - * @return {FileLoader} A reference to this file loader. - */ - setResponseType(value: ("arraybuffer" | "blob" | "document" | "json" | "")): FileLoader; - /** - * Sets the expected mime type of the loaded file. - * - * @param {string} value - The mime type. - * @return {FileLoader} A reference to this file loader. - */ - setMimeType(value: string): FileLoader; - /** - * Aborts ongoing fetch requests. - * - * @return {FileLoader} A reference to this instance. - */ - abort(): FileLoader; -} -import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts deleted file mode 100644 index c060ff5b6..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/ImageBitmapLoader.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -/** - * A loader for loading images as an [ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap). - * An `ImageBitmap` provides an asynchronous and resource efficient pathway to prepare - * textures for rendering. - * - * Note that {@link Texture#flipY} and {@link Texture#premultiplyAlpha} are ignored with image bitmaps. - * These options need to be configured via {@link ImageBitmapLoader#setOptions} prior to loading, - * unlike regular images which can be configured on the Texture to set these options on GPU upload instead. - * - * To match the default behaviour of {@link Texture}, the following options are needed: - * - * ```js - * { imageOrientation: 'flipY', premultiplyAlpha: 'none' } - * ``` - * - * Also note that unlike {@link FileLoader}, this loader will only avoid multiple concurrent requests to the same URL if {@link Cache} is enabled. - * - * ```js - * const loader = new THREE.ImageBitmapLoader(); - * loader.setOptions( { imageOrientation: 'flipY' } ); // set options if needed - * const imageBitmap = await loader.loadAsync( 'image.png' ); - * - * const texture = new THREE.Texture( imageBitmap ); - * texture.needsUpdate = true; - * ``` - * - * @augments Loader - */ -export class ImageBitmapLoader extends Loader { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isImageBitmapLoader: boolean; - /** - * Represents the loader options. - * - * @type {Object} - * @default {premultiplyAlpha:'none'} - */ - options: Object; - /** - * Used for aborting requests. - * - * @private - * @type {AbortController} - */ - private _abortController; - /** - * Sets the given loader options. The structure of the object must match the `options` parameter of - * [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap). - * - * Note: When caching is enabled, the cache key is based on the URL only. Loading the same URL with - * different options will return the cached result of the first request. - * - * @param {Object} options - The loader options to set. - * @return {ImageBitmapLoader} A reference to this image bitmap loader. - */ - setOptions(options: Object): ImageBitmapLoader; - /** - * Starts loading from the given URL and pass the loaded image bitmap to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(ImageBitmap)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Unsupported in this loader. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: ImageBitmap) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Aborts ongoing fetch requests. - * - * @return {ImageBitmapLoader} A reference to this instance. - */ - abort(): ImageBitmapLoader; -} -import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts deleted file mode 100644 index 0b4296abc..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/ImageLoader.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * A loader for loading images. The class loads images with the HTML `Image` API. - * - * ```js - * const loader = new THREE.ImageLoader(); - * const image = await loader.loadAsync( 'image.png' ); - * ``` - * Please note that `ImageLoader` has dropped support for progress - * events in `r84`. For an `ImageLoader` that supports progress events, see - * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-275785639). - * - * @augments Loader - */ -export class ImageLoader extends Loader { - /** - * Starts loading from the given URL and passes the loaded image - * to the `onLoad()` callback. The method also returns a new `Image` object which can - * directly be used for texture creation. If you do it this way, the texture - * may pop up in your scene once the respective loading process is finished. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Image)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Unsupported in this loader. - * @param {onErrorCallback} onError - Executed when errors occur. - * @return {Image} The image. - */ - load(url: string, onLoad: (arg0: new (width?: number, height?: number) => HTMLImageElement) => any, onProgress: onProgressCallback, onError: onErrorCallback): new (width?: number, height?: number) => HTMLImageElement; -} -import { Loader } from './Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/Loader.d.ts b/jsdoc-testing/jsdoc/src/loaders/Loader.d.ts deleted file mode 100644 index a1e704eb9..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/Loader.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Callback for onProgress in loaders. - */ -export type onProgressCallback = (event: ProgressEvent) => any; -/** - * Callback for onError in loaders. - */ -export type onErrorCallback = (error: Error) => any; -/** - * Abstract base class for loaders. - * - * @abstract - */ -export class Loader { - /** - * Constructs a new loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * The loading manager. - * - * @type {LoadingManager} - * @default DefaultLoadingManager - */ - manager: LoadingManager; - /** - * The crossOrigin string to implement CORS for loading the url from a - * different domain that allows CORS. - * - * @type {string} - * @default 'anonymous' - */ - crossOrigin: string; - /** - * Whether the XMLHttpRequest uses credentials. - * - * @type {boolean} - * @default false - */ - withCredentials: boolean; - /** - * The base path from which the asset will be loaded. - * - * @type {string} - */ - path: string; - /** - * The base path from which additional resources like textures will be loaded. - * - * @type {string} - */ - resourcePath: string; - /** - * The [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header) - * used in HTTP request. - * - * @type {Object} - */ - requestHeader: { - [x: string]: any; - }; - /** - * This method needs to be implemented by all concrete loaders. It holds the - * logic for loading assets from the backend. - * - * @abstract - * @param {string} url - The path/URL of the file to be loaded. - * @param {Function} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. - * @param {onErrorCallback} [onError] - Executed when errors occur. - */ - load(): void; - /** - * A async version of {@link Loader#load}. - * - * @param {string} url - The path/URL of the file to be loaded. - * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress. - * @return {Promise} A Promise that resolves when the asset has been loaded. - */ - loadAsync(url: string, onProgress?: onProgressCallback): Promise; - /** - * This method needs to be implemented by all concrete loaders. It holds the - * logic for parsing the asset into three.js entities. - * - * @abstract - * @param {any} data - The data to parse. - */ - parse(): void; - /** - * Sets the `crossOrigin` String to implement CORS for loading the URL - * from a different domain that allows CORS. - * - * @param {string} crossOrigin - The `crossOrigin` value. - * @return {Loader} A reference to this instance. - */ - setCrossOrigin(crossOrigin: string): Loader; - /** - * Whether the XMLHttpRequest uses credentials such as cookies, authorization - * headers or TLS client certificates, see [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials). - * - * Note: This setting has no effect if you are loading files locally or from the same domain. - * - * @param {boolean} value - The `withCredentials` value. - * @return {Loader} A reference to this instance. - */ - setWithCredentials(value: boolean): Loader; - /** - * Sets the base path for the asset. - * - * @param {string} path - The base path. - * @return {Loader} A reference to this instance. - */ - setPath(path: string): Loader; - /** - * Sets the base path for dependent resources like textures. - * - * @param {string} resourcePath - The resource path. - * @return {Loader} A reference to this instance. - */ - setResourcePath(resourcePath: string): Loader; - /** - * Sets the given request header. - * - * @param {Object} requestHeader - A [request header](https://developer.mozilla.org/en-US/docs/Glossary/Request_header) - * for configuring the HTTP request. - * @return {Loader} A reference to this instance. - */ - setRequestHeader(requestHeader: Object): Loader; - /** - * This method can be implemented in loaders for aborting ongoing requests. - * - * @abstract - * @return {Loader} A reference to this instance. - */ - abort(): Loader; -} -export namespace Loader { - let DEFAULT_MATERIAL_NAME: string; -} diff --git a/jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts b/jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts deleted file mode 100644 index ce241791d..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/LoaderUtils.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * A class with loader utility functions. - */ -export class LoaderUtils { - /** - * Extracts the base URL from the given URL. - * - * @param {string} url -The URL to extract the base URL from. - * @return {string} The extracted base URL. - */ - static extractUrlBase(url: string): string; - /** - * Resolves relative URLs against the given path. Absolute paths, data urls, - * and blob URLs will be returned as is. Invalid URLs will return an empty - * string. - * - * @param {string} url -The URL to resolve. - * @param {string} path - The base path for relative URLs to be resolved against. - * @return {string} The resolved URL. - */ - static resolveURL(url: string, path: string): string; -} diff --git a/jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts deleted file mode 100644 index 9dda62756..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/MaterialLoader.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Class for loading materials. The files are internally - * loaded via {@link FileLoader}. - * - * ```js - * const loader = new THREE.MaterialLoader(); - * const material = await loader.loadAsync( 'material.json' ); - * ``` - * This loader does not support node materials. Use {@link NodeMaterialLoader} instead. - * - * @augments Loader - */ -export class MaterialLoader extends Loader { - /** - * Creates a material for the given type. - * - * @static - * @param {string} type - The material type. - * @return {Material} The new material. - */ - static createMaterialFromType(type: string): Material; - /** - * Registers the given material at the internal - * material library. - * - * @static - * @param {string} type - The material type. - * @param {Material.constructor} materialClass - The material class. - */ - static registerMaterial(type: string, materialClass: Material.constructor): void; - /** - * A dictionary holding textures used by the material. - * - * @type {Object} - */ - textures: { - [x: string]: Texture; - }; - /** - * Starts loading from the given URL and pass the loaded material to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Material)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Material) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Parses the given JSON object and returns a material. - * - * @param {Object} json - The serialized material. - * @return {Material} The parsed material. - */ - parse(json: Object): Material; - /** - * Textures are not embedded in the material JSON so they have - * to be injected before the loading process starts. - * - * @param {Object} value - A dictionary holding textures for material properties. - * @return {MaterialLoader} A reference to this material loader. - */ - setTextures(value: Object): MaterialLoader; - /** - * Creates a material for the given type. - * - * @param {string} type - The material type. - * @return {Material} The new material. - */ - createMaterialFromType(type: string): Material; -} -import { Loader } from './Loader.js'; -import { Material } from '../materials/Materials.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts deleted file mode 100644 index 79e15d582..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/ObjectLoader.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * A loader for loading a JSON resource in the [JSON Object/Scene format](https://github.com/mrdoob/three.js/wiki/JSON-Object-Scene-format-4). - * The files are internally loaded via {@link FileLoader}. - * - * ```js - * const loader = new THREE.ObjectLoader(); - * const obj = await loader.loadAsync( 'models/json/example.json' ); - * scene.add( obj ); - * - * // Alternatively, to parse a previously loaded JSON structure - * const object = await loader.parseAsync( a_json_object ); - * scene.add( object ); - * ``` - * - * @augments Loader - */ -export class ObjectLoader extends Loader { - /** - * Registers the given geometry at the internal - * geometry library. - * - * @static - * @param {string} type - The geometry type. - * @param {BufferGeometry.constructor} geometryClass - The geometry class. - */ - static registerGeometry(type: string, geometryClass: BufferGeometry.constructor): void; - /** - * Constructs a new object loader. - * - * @param {LoadingManager} [manager] - The loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Starts loading from the given URL and pass the loaded 3D object to the `onLoad()` callback. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Object3D)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @param {onErrorCallback} onError - Executed when errors occur. - */ - load(url: string, onLoad: (arg0: Object3D) => any, onProgress: onProgressCallback, onError: onErrorCallback): void; - /** - * Async version of {@link ObjectLoader#load}. - * - * @async - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {onProgressCallback} onProgress - Executed while the loading is in progress. - * @return {Promise} A Promise that resolves with the loaded 3D object. - */ - loadAsync(url: string, onProgress: onProgressCallback): Promise; - /** - * Parses the given JSON. This is used internally by {@link ObjectLoader#load} - * but can also be used directly to parse a previously loaded JSON structure. - * - * @param {Object} json - The serialized 3D object. - * @param {onLoad} onLoad - Executed when all resources (e.g. textures) have been fully loaded. - * @return {Object3D} The parsed 3D object. - */ - parse(json: Object, onLoad: any): Object3D; - /** - * Async version of {@link ObjectLoader#parse}. - * - * @param {Object} json - The serialized 3D object. - * @return {Promise} A Promise that resolves with the parsed 3D object. - */ - parseAsync(json: Object): Promise; - parseShapes(json: any): {}; - parseSkeletons(json: any, object: any): {}; - parseGeometries(json: any, shapes: any): {}; - parseMaterials(json: any, textures: any): {}; - parseAnimations(json: any): {}; - parseImages(json: any, onLoad: any): {}; - parseImagesAsync(json: any): Promise<{}>; - parseTextures(json: any, images: any): {}; - parseObject(data: any, geometries: any, materials: any, textures: any, animations: any): Object3D | Sprite | LOD | Mesh | SkinnedMesh | InstancedMesh | BatchedMesh | Line | Points | OrthographicCamera | PerspectiveCamera; - bindSkeletons(object: any, skeletons: any): void; - bindLightTargets(object: any): void; -} -import { Loader } from './Loader.js'; -import { Object3D } from '../core/Object3D.js'; -import { Sprite } from '../objects/Sprite.js'; -import { LOD } from '../objects/LOD.js'; -import { Mesh } from '../objects/Mesh.js'; -import { SkinnedMesh } from '../objects/SkinnedMesh.js'; -import { InstancedMesh } from '../objects/InstancedMesh.js'; -import { BatchedMesh } from '../objects/BatchedMesh.js'; -import { Line } from '../objects/Line.js'; -import { Points } from '../objects/Points.js'; -import { OrthographicCamera } from '../cameras/OrthographicCamera.js'; -import { PerspectiveCamera } from '../cameras/PerspectiveCamera.js'; -import { LoadingManager } from './LoadingManager.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts deleted file mode 100644 index 8069b4948..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/TextureLoader.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Class for loading textures. Images are internally - * loaded via {@link ImageLoader}. - * - * ```js - * const loader = new THREE.TextureLoader(); - * const texture = await loader.loadAsync( 'textures/land_ocean_ice_cloud_2048.jpg' ); - * - * const material = new THREE.MeshBasicMaterial( { map:texture } ); - * ``` - * Please note that `TextureLoader` has dropped support for progress - * events in `r84`. For a `TextureLoader` that supports progress events, see - * [this thread](https://github.com/mrdoob/three.js/issues/10439#issuecomment-293260145). - * - * @augments Loader - */ -export class TextureLoader extends Loader { - /** - * Starts loading from the given URL and pass the fully loaded texture - * to the `onLoad()` callback. The method also returns a new texture object which can - * directly be used for material creation. If you do it this way, the texture - * may pop up in your scene once the respective loading process is finished. - * - * @param {string} url - The path/URL of the file to be loaded. This can also be a data URI. - * @param {function(Texture)} onLoad - Executed when the loading process has been finished. - * @param {onProgressCallback} onProgress - Unsupported in this loader. - * @param {onErrorCallback} onError - Executed when errors occur. - * @return {Texture} The texture. - */ - load(url: string, onLoad: (arg0: Texture) => any, onProgress: onProgressCallback, onError: onErrorCallback): Texture; -} -import { Loader } from './Loader.js'; -import { Texture } from '../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts deleted file mode 100644 index 58b362d35..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeLoader.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -export default NodeLoader; -/** - * A loader for loading node objects in the three.js JSON Object/Scene format. - * - * @augments Loader - */ -declare class NodeLoader extends Loader { - /** - * Represents a dictionary of textures. - * - * @type {Object} - */ - textures: { - [x: string]: Texture; - }; - /** - * Represents a dictionary of node types. - * - * @type {Object} - */ - nodes: { - [x: string]: Node.constructor; - }; - /** - * Loads the node definitions from the given URL. - * - * @param {string} url - The path/URL of the file to be loaded. - * @param {Function} onLoad - Will be called when load completes. - * @param {Function} onProgress - Will be called while load progresses. - * @param {Function} onError - Will be called when errors are thrown during the loading process. - */ - load(url: string, onLoad: Function, onProgress: Function, onError: Function): void; - /** - * Parse the node dependencies for the loaded node. - * - * @param {Array} [json] - The JSON definition - * @return {Object} A dictionary with node dependencies. - */ - parseNodes(json?: Array): { - [x: string]: Node; - }; - /** - * Parses the node from the given JSON. - * - * @param {Object} json - The JSON definition - * @param {string} json.type - The node type. - * @param {string} json.uuid - The node UUID. - * @param {Array} [json.nodes] - The node dependencies. - * @param {Object} [json.meta] - The meta data. - * @return {Node} The parsed node. - */ - parse(json: { - type: string; - uuid: string; - nodes?: Object[] | undefined; - meta?: Object | undefined; - }): Node; - /** - * Defines the dictionary of textures. - * - * @param {Object} value - The texture library defines as ``. - * @return {NodeLoader} A reference to this loader. - */ - setTextures(value: { - [x: string]: Texture; - }): NodeLoader; - /** - * Defines the dictionary of node types. - * - * @param {Object} value - The node library defined as ``. - * @return {NodeLoader} A reference to this loader. - */ - setNodes(value: { - [x: string]: Node.constructor; - }): NodeLoader; - /** - * Creates a node object from the given type. - * - * @param {string} type - The node type. - * @return {Node} The created node instance. - */ - createNodeFromType(type: string): Node; -} -import { Loader } from '../Loader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts deleted file mode 100644 index cf350a240..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeMaterialLoader.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -export default NodeMaterialLoader; -/** - * A special type of material loader for loading node materials. - * - * @augments MaterialLoader - */ -declare class NodeMaterialLoader extends MaterialLoader { - /** - * Represents a dictionary of node types. - * - * @type {Object} - */ - nodes: { - [x: string]: Node.constructor; - }; - /** - * Represents a dictionary of node material types. - * - * @type {Object} - */ - nodeMaterials: { - [x: string]: NodeMaterial.constructor; - }; - /** - * Parses the node material from the given JSON. - * - * @param {Object} json - The JSON definition - * @return {NodeMaterial}. The parsed material. - */ - parse(json: Object): NodeMaterial; - /** - * Defines the dictionary of node types. - * - * @param {Object} value - The node library defined as ``. - * @return {NodeLoader} A reference to this loader. - */ - setNodes(value: { - [x: string]: Node.constructor; - }): NodeLoader; - /** - * Defines the dictionary of node material types. - * - * @param {Object} value - The node material library defined as ``. - * @return {NodeLoader} A reference to this loader. - */ - setNodeMaterials(value: { - [x: string]: NodeMaterial.constructor; - }): NodeLoader; - /** - * Creates a node material from the given type. - * - * @param {string} type - The node material type. - * @return {Node} The created node material instance. - */ - createMaterialFromType(type: string): Node; -} -import { MaterialLoader } from '../../loaders/MaterialLoader.js'; diff --git a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts b/jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts deleted file mode 100644 index b5954eab2..000000000 --- a/jsdoc-testing/jsdoc/src/loaders/nodes/NodeObjectLoader.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -export default NodeObjectLoader; -/** - * A special type of object loader for loading 3D objects using - * node materials. - * - * @augments ObjectLoader - */ -declare class NodeObjectLoader extends ObjectLoader { - /** - * Constructs a new node object loader. - * - * @param {LoadingManager} [manager] - A reference to a loading manager. - */ - constructor(manager?: LoadingManager); - /** - * Represents a dictionary of node types. - * - * @type {Object} - */ - nodes: { - [x: string]: Node.constructor; - }; - /** - * Represents a dictionary of node material types. - * - * @type {Object} - */ - nodeMaterials: { - [x: string]: NodeMaterial.constructor; - }; - /** - * A reference to hold the `nodes` JSON property. - * - * @private - * @type {?Object[]} - */ - private _nodesJSON; - /** - * Defines the dictionary of node types. - * - * @param {Object} value - The node library defined as ``. - * @return {NodeObjectLoader} A reference to this loader. - */ - setNodes(value: { - [x: string]: Node.constructor; - }): NodeObjectLoader; - /** - * Defines the dictionary of node material types. - * - * @param {Object} value - The node material library defined as ``. - * @return {NodeObjectLoader} A reference to this loader. - */ - setNodeMaterials(value: { - [x: string]: NodeMaterial.constructor; - }): NodeObjectLoader; - /** - * Parses the node objects from the given JSON. - * - * @param {Object} json - The JSON definition - * @param {Function} onLoad - The onLoad callback function. - * @return {Object3D}. The parsed 3D object. - */ - parse(json: Object, onLoad: Function): Object3D; - /** - * Async version of {@link NodeObjectLoader#parse}. - * - * @param {Object} json - The JSON definition - * @return {Promise} A Promise that resolves with the parsed 3D object. - */ - parseAsync(json: Object): Promise; - /** - * Parses the node objects from the given JSON and textures. - * - * @param {Object[]} json - The JSON definition - * @param {Object} textures - The texture library. - * @return {Object}. The parsed nodes. - */ - parseNodes(json: Object[], textures: { - [x: string]: Texture; - }): { - [x: string]: Node; - }; - /** - * Parses the node objects from the given JSON and textures. - * - * @param {Object} json - The JSON definition - * @param {Object} textures - The texture library. - * @return {Object}. The parsed materials. - */ - parseMaterials(json: Object, textures: { - [x: string]: Texture; - }): { - [x: string]: NodeMaterial; - }; -} -import { ObjectLoader } from '../../loaders/ObjectLoader.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts deleted file mode 100644 index b7fb9b69a..000000000 --- a/jsdoc-testing/jsdoc/src/materials/LineBasicMaterial.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -/** - * A material for rendering line primitives. - * - * Materials define the appearance of renderable 3D objects. - * - * ```js - * const material = new THREE.LineBasicMaterial( { color: 0xffffff } ); - * ``` - * - * @augments Material - */ -export class LineBasicMaterial extends Material { - /** - * Constructs a new line basic material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineBasicMaterial: boolean; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * Sets the color of the lines using data from a texture. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * Controls line thickness or lines. - * - * Can only be used with {@link SVGRenderer}. WebGL and WebGPU - * ignore this setting and always render line primitives with a - * width of one pixel. - * - * @type {number} - * @default 1 - */ - linewidth: number; - /** - * Defines appearance of line ends. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('butt'|'round'|'square')} - * @default 'round' - */ - linecap: ("butt" | "round" | "square"); - /** - * Defines appearance of line joints. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - linejoin: ("round" | "bevel" | "miter"); - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts deleted file mode 100644 index 3cb1a34d8..000000000 --- a/jsdoc-testing/jsdoc/src/materials/LineDashedMaterial.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * A material for rendering line primitives. - * - * Materials define the appearance of renderable 3D objects. - * - * ```js - * const material = new THREE.LineDashedMaterial( { - * color: 0xffffff, - * scale: 1, - * dashSize: 3, - * gapSize: 1, - * } ); - * ``` - * - * @augments LineBasicMaterial - */ -export class LineDashedMaterial extends LineBasicMaterial { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineDashedMaterial: boolean; - /** - * The scale of the dashed part of a line. - * - * @type {number} - * @default 1 - */ - scale: number; - /** - * The size of the dash. This is both the gap with the stroke. - * - * @type {number} - * @default 3 - */ - dashSize: number; - /** - * The size of the gap. - * - * @type {number} - * @default 1 - */ - gapSize: number; - copy(source: any): this; -} -import { LineBasicMaterial } from './LineBasicMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/Material.d.ts b/jsdoc-testing/jsdoc/src/materials/Material.d.ts deleted file mode 100644 index a559b6e84..000000000 --- a/jsdoc-testing/jsdoc/src/materials/Material.d.ts +++ /dev/null @@ -1,508 +0,0 @@ -/** - * Abstract base class for materials. - * - * Materials define the appearance of renderable 3D objects. - * - * @abstract - * @augments EventDispatcher - */ -export class Material extends EventDispatcher { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMaterial: boolean; - /** - * The UUID of the material. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * The name of the material. - * - * @type {string} - */ - name: string; - /** - * The type property is used for detecting the object type - * in context of serialization/deserialization. - * - * @type {string} - * @readonly - */ - readonly type: string; - /** - * Defines the blending type of the material. - * - * It must be set to `CustomBlending` if custom blending properties like - * {@link Material#blendSrc}, {@link Material#blendDst} or {@link Material#blendEquation} - * should have any effect. - * - * @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending)} - * @default NormalBlending - */ - blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); - /** - * Defines which side of faces will be rendered - front, back or both. - * - * @type {(FrontSide|BackSide|DoubleSide)} - * @default FrontSide - */ - side: (number | BackSide | DoubleSide); - /** - * If set to `true`, vertex colors should be used. - * - * The engine supports RGB and RGBA vertex colors depending on whether a three (RGB) or - * four (RGBA) component color buffer attribute is used. - * - * @type {boolean} - * @default false - */ - vertexColors: boolean; - /** - * Defines how transparent the material is. - * A value of `0.0` indicates fully transparent, `1.0` is fully opaque. - * - * If the {@link Material#transparent} is not set to `true`, - * the material will remain fully opaque and this value will only affect its color. - * - * @type {number} - * @default 1 - */ - opacity: number; - /** - * Defines whether this material is transparent. This has an effect on - * rendering as transparent objects need special treatment and are rendered - * after non-transparent objects. - * - * When set to true, the extent to which the material is transparent is - * controlled by {@link Material#opacity}. - * - * @type {boolean} - * @default false - */ - transparent: boolean; - /** - * Enables alpha hashed transparency, an alternative to {@link Material#transparent} or - * {@link Material#alphaTest}. The material will not be rendered if opacity is lower than - * a random threshold. Randomization introduces some grain or noise, but approximates alpha - * blending without the associated problems of sorting. Using TAA can reduce the resulting noise. - * - * @type {boolean} - * @default false - */ - alphaHash: boolean; - /** - * Defines the blending source factor. - * - * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default SrcAlphaFactor - */ - blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - /** - * Defines the blending destination factor. - * - * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default OneMinusSrcAlphaFactor - */ - blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - /** - * Defines the blending equation. - * - * @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} - * @default AddEquation - */ - blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); - /** - * Defines the blending source alpha factor. - * - * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default null - */ - blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - /** - * Defines the blending destination alpha factor. - * - * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default null - */ - blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - /** - * Defines the blending equation of the alpha channel. - * - * @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} - * @default null - */ - blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; - /** - * Represents the RGB values of the constant blend color. - * - * This property has only an effect when using custom blending with `ConstantColor` or `OneMinusConstantColor`. - * - * @type {Color} - * @default (0,0,0) - */ - blendColor: Color; - /** - * Represents the alpha value of the constant blend color. - * - * This property has only an effect when using custom blending with `ConstantAlpha` or `OneMinusConstantAlpha`. - * - * @type {number} - * @default 0 - */ - blendAlpha: number; - /** - * Defines the depth function. - * - * @type {(NeverDepth|AlwaysDepth|LessDepth|LessEqualDepth|EqualDepth|GreaterEqualDepth|GreaterDepth|NotEqualDepth)} - * @default LessEqualDepth - */ - depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); - /** - * Whether to have depth test enabled when rendering this material. - * When the depth test is disabled, the depth write will also be implicitly disabled. - * - * @type {boolean} - * @default true - */ - depthTest: boolean; - /** - * Whether rendering this material has any effect on the depth buffer. - * - * When drawing 2D overlays it can be useful to disable the depth writing in - * order to layer several things together without creating z-index artifacts. - * - * @type {boolean} - * @default true - */ - depthWrite: boolean; - /** - * The bit mask to use when writing to the stencil buffer. - * - * @type {number} - * @default 0xff - */ - stencilWriteMask: number; - /** - * The stencil comparison function to use. - * - * @type {NeverStencilFunc|LessStencilFunc|EqualStencilFunc|LessEqualStencilFunc|GreaterStencilFunc|NotEqualStencilFunc|GreaterEqualStencilFunc|AlwaysStencilFunc} - * @default AlwaysStencilFunc - */ - stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; - /** - * The value to use when performing stencil comparisons or stencil operations. - * - * @type {number} - * @default 0 - */ - stencilRef: number; - /** - * The bit mask to use when comparing against the stencil buffer. - * - * @type {number} - * @default 0xff - */ - stencilFuncMask: number; - /** - * Which stencil operation to perform when the comparison function returns `false`. - * - * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp} - * @default KeepStencilOp - */ - stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - /** - * Which stencil operation to perform when the comparison function returns - * `true` but the depth test fails. - * - * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp} - * @default KeepStencilOp - */ - stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - /** - * Which stencil operation to perform when the comparison function returns - * `true` and the depth test passes. - * - * @type {ZeroStencilOp|KeepStencilOp|ReplaceStencilOp|IncrementStencilOp|DecrementStencilOp|IncrementWrapStencilOp|DecrementWrapStencilOp|InvertStencilOp} - * @default KeepStencilOp - */ - stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - /** - * Whether stencil operations are performed against the stencil buffer. In - * order to perform writes or comparisons against the stencil buffer this - * value must be `true`. - * - * @type {boolean} - * @default false - */ - stencilWrite: boolean; - /** - * User-defined clipping planes specified as THREE.Plane objects in world - * space. These planes apply to the objects this material is attached to. - * Points in space whose signed distance to the plane is negative are clipped - * (not rendered). This requires {@link WebGLRenderer#localClippingEnabled} to - * be `true`. - * - * @type {?Array} - * @default null - */ - clippingPlanes: Array | null; - /** - * Changes the behavior of clipping planes so that only their intersection is - * clipped, rather than their union. - * - * @type {boolean} - * @default false - */ - clipIntersection: boolean; - /** - * Defines whether to clip shadows according to the clipping planes specified - * on this material. - * - * @type {boolean} - * @default false - */ - clipShadows: boolean; - /** - * Defines which side of faces cast shadows. If `null`, the side casting shadows - * is determined as follows: - * - * - When {@link Material#side} is set to `FrontSide`, the back side cast shadows. - * - When {@link Material#side} is set to `BackSide`, the front side cast shadows. - * - When {@link Material#side} is set to `DoubleSide`, both sides cast shadows. - * - * @type {?(FrontSide|BackSide|DoubleSide)} - * @default null - */ - shadowSide: (number | BackSide | DoubleSide) | null; - /** - * Whether to render the material's color. - * - * This can be used in conjunction with {@link Object3D#renderOder} to create invisible - * objects that occlude other objects. - * - * @type {boolean} - * @default true - */ - colorWrite: boolean; - /** - * Override the renderer's default precision for this material. - * - * @type {?('highp'|'mediump'|'lowp')} - * @default null - */ - precision: ("highp" | "mediump" | "lowp") | null; - /** - * Whether to use polygon offset or not. When enabled, each fragment's depth value will - * be offset after it is interpolated from the depth values of the appropriate vertices. - * The offset is added before the depth test is performed and before the value is written - * into the depth buffer. - * - * Can be useful for rendering hidden-line images, for applying decals to surfaces, and for - * rendering solids with highlighted edges. - * - * @type {boolean} - * @default false - */ - polygonOffset: boolean; - /** - * Specifies a scale factor that is used to create a variable depth offset for each polygon. - * - * @type {number} - * @default 0 - */ - polygonOffsetFactor: number; - /** - * Is multiplied by an implementation-specific value to create a constant depth offset. - * - * @type {number} - * @default 0 - */ - polygonOffsetUnits: number; - /** - * Whether to apply dithering to the color to remove the appearance of banding. - * - * @type {boolean} - * @default false - */ - dithering: boolean; - /** - * Whether alpha to coverage should be enabled or not. Can only be used with MSAA-enabled contexts - * (meaning when the renderer was created with *antialias* parameter set to `true`). Enabling this - * will smooth aliasing on clip plane edges and alphaTest-clipped edges. - * - * @type {boolean} - * @default false - */ - alphaToCoverage: boolean; - /** - * Whether to premultiply the alpha (transparency) value. - * - * @type {boolean} - * @default false - */ - premultipliedAlpha: boolean; - /** - * Whether double-sided, transparent objects should be rendered with a single pass or not. - * - * The engine renders double-sided, transparent objects with two draw calls (back faces first, - * then front faces) to mitigate transparency artifacts. There are scenarios however where this - * approach produces no quality gains but still doubles draw calls e.g. when rendering flat - * vegetation like grass sprites. In these cases, set the `forceSinglePass` flag to `true` to - * disable the two pass rendering to avoid performance issues. - * - * @type {boolean} - * @default false - */ - forceSinglePass: boolean; - /** - * Whether it's possible to override the material with {@link Scene#overrideMaterial} or not. - * - * @type {boolean} - * @default true - */ - allowOverride: boolean; - /** - * Defines whether 3D objects using this material are visible. - * - * @type {boolean} - * @default true - */ - visible: boolean; - /** - * Defines whether this material is tone mapped according to the renderer's tone mapping setting. - * - * It is ignored when rendering to a render target or using post processing or when using - * `WebGPURenderer`. In all these cases, all materials are honored by tone mapping. - * - * @type {boolean} - * @default true - */ - toneMapped: boolean; - /** - * An object that can be used to store custom data about the Material. It - * should not hold references to functions as these will not be cloned. - * - * @type {Object} - */ - userData: Object; - /** - * This starts at `0` and counts how many times {@link Material#needsUpdate} is set to `true`. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly version: number; - _alphaTest: number; - readonly set alphaTest(value: number); - /** - * Sets the alpha value to be used when running an alpha test. The material - * will not be rendered if the opacity is lower than this value. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly get alphaTest(): number; - /** - * An optional callback that is executed immediately before the material is used to render a 3D object. - * - * This method can only be used when rendering with {@link WebGLRenderer}. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {Scene} scene - The scene. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Object3D} object - The 3D object. - * @param {Object} group - The geometry group data. - */ - onBeforeRender(): void; - /** - * An optional callback that is executed immediately before the shader - * program is compiled. This function is called with the shader source code - * as a parameter. Useful for the modification of built-in materials. - * - * This method can only be used when rendering with {@link WebGLRenderer}. The - * recommended approach when customizing materials is to use `WebGPURenderer` with the new - * Node Material system and [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language). - * - * @param {{vertexShader:string,fragmentShader:string,uniforms:Object}} shaderobject - The object holds the uniforms and the vertex and fragment shader source. - * @param {WebGLRenderer} renderer - A reference to the renderer. - */ - onBeforeCompile(): void; - /** - * In case {@link Material#onBeforeCompile} is used, this callback can be used to identify - * values of settings used in `onBeforeCompile()`, so three.js can reuse a cached - * shader or recompile the shader for this material as needed. - * - * This method can only be used when rendering with {@link WebGLRenderer}. - * - * @return {string} The custom program cache key. - */ - customProgramCacheKey(): string; - /** - * This method can be used to set default values from parameter objects. - * It is a generic implementation so it can be used with different types - * of materials. - * - * @param {Object} [values] - The material values to set. - */ - setValues(values?: Object): void; - /** - * Serializes the material into JSON. - * - * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized material. - * @see {@link ObjectLoader#parse} - */ - toJSON(meta: (Object | string) | null): Object; - /** - * Deserializes the material from the given JSON. - * - * @param {Object} json - The JSON holding the serialized material. - * @param {Object} textures - A dictionary holding textures referenced by the material. - * @return {Material} A reference to this material. - */ - fromJSON(json: Object, textures: { - [x: string]: Texture; - }): Material; - /** - * Returns a new material with copied values from this instance. - * - * @return {Material} A clone of this instance. - */ - clone(): Material; - /** - * Copies the values of the given material to this instance. - * - * @param {Material} source - The material to copy. - * @return {Material} A reference to this instance. - */ - copy(source: Material): Material; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * @fires Material#dispose - */ - dispose(): void; - /** - * Setting this property to `true` indicates the engine the material - * needs to be recompiled. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); -} -import { EventDispatcher } from '../core/EventDispatcher.js'; -import { Color } from '../math/Color.js'; -import { Plane } from '../math/Plane.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/Materials.d.ts b/jsdoc-testing/jsdoc/src/materials/Materials.d.ts deleted file mode 100644 index 3f555b856..000000000 --- a/jsdoc-testing/jsdoc/src/materials/Materials.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ShadowMaterial } from './ShadowMaterial.js'; -import { SpriteMaterial } from './SpriteMaterial.js'; -import { RawShaderMaterial } from './RawShaderMaterial.js'; -import { ShaderMaterial } from './ShaderMaterial.js'; -import { PointsMaterial } from './PointsMaterial.js'; -import { MeshPhysicalMaterial } from './MeshPhysicalMaterial.js'; -import { MeshStandardMaterial } from './MeshStandardMaterial.js'; -import { MeshPhongMaterial } from './MeshPhongMaterial.js'; -import { MeshToonMaterial } from './MeshToonMaterial.js'; -import { MeshNormalMaterial } from './MeshNormalMaterial.js'; -import { MeshLambertMaterial } from './MeshLambertMaterial.js'; -import { MeshDepthMaterial } from './MeshDepthMaterial.js'; -import { MeshDistanceMaterial } from './MeshDistanceMaterial.js'; -import { MeshBasicMaterial } from './MeshBasicMaterial.js'; -import { MeshMatcapMaterial } from './MeshMatcapMaterial.js'; -import { LineDashedMaterial } from './LineDashedMaterial.js'; -import { LineBasicMaterial } from './LineBasicMaterial.js'; -import { Material } from './Material.js'; -export { ShadowMaterial, SpriteMaterial, RawShaderMaterial, ShaderMaterial, PointsMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshPhongMaterial, MeshToonMaterial, MeshNormalMaterial, MeshLambertMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshBasicMaterial, MeshMatcapMaterial, LineDashedMaterial, LineBasicMaterial, Material }; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts deleted file mode 100644 index e124b7403..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshBasicMaterial.d.ts +++ /dev/null @@ -1,208 +0,0 @@ -/** - * A material for drawing geometries in a simple shaded (flat or wireframe) way. - * - * This material is not affected by lights. - * - * @augments Material - * @demo scenes/material-browser.html#MeshBasicMaterial - */ -export class MeshBasicMaterial extends Material { - /** - * Constructs a new mesh basic material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshBasicMaterial: boolean; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The light map. Requires a second set of UVs. - * - * `lightMap` represents pre-baked illuminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `lightMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - lightMap: Texture | null; - /** - * Intensity of the baked light. - * - * @type {number} - * @default 1 - */ - lightMapIntensity: number; - /** - * The red channel of this texture is used as the ambient occlusion map. - * Requires a second set of UVs. - * - * `aoMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - aoMap: Texture | null; - /** - * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` - * disables ambient occlusion. Where intensity is `1` and the AO map's - * red channel is also `1`, ambient light is fully occluded on a surface. - * - * @type {number} - * @default 1 - */ - aoMapIntensity: number; - /** - * Specular map used by the material. - * - * `specularMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `specularMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - specularMap: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * The environment map. - * - * `envMap` represents luminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `envMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - /** - * The rotation of the environment map in radians. - * - * @type {Euler} - * @default (0,0,0) - */ - envMapRotation: Euler; - /** - * How to combine the result of the surface's color with the environment map, if any. - * - * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to - * blend between the two colors. - * - * @type {(MultiplyOperation|MixOperation|AddOperation)} - * @default MultiplyOperation - */ - combine: (number | MixOperation | AddOperation); - /** - * How much the environment map affects the surface. - * The valid range is between `0` (no reflections) and `1` (full reflections). - * - * @type {number} - * @default 1 - */ - reflectivity: number; - /** - * The index of refraction (IOR) of air (approximately 1) divided by the - * index of refraction of the material. It is used with environment mapping - * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}. - * The refraction ratio should not exceed `1`. - * - * @type {number} - * @default 0.98 - */ - refractionRatio: number; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Defines appearance of wireframe ends. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinecap: ("round" | "bevel" | "miter"); - /** - * Defines appearance of wireframe joints. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinejoin: ("round" | "bevel" | "miter"); - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; -import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts deleted file mode 100644 index 0b95d4608..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshDepthMaterial.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -/** - * A material for drawing geometry by depth. Depth is based off of the camera - * near and far plane. White is nearest, black is farthest. - * - * @augments Material - * @demo scenes/material-browser.html#MeshDepthMaterial - */ -export class MeshDepthMaterial extends Material { - /** - * Constructs a new mesh depth material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshDepthMaterial: boolean; - type: string; - /** - * Type for depth packing. - * - * @type {(BasicDepthPacking|RGBADepthPacking|RGBDepthPacking|RGDepthPacking)} - * @default BasicDepthPacking - */ - depthPacking: (number | RGBADepthPacking | RGBDepthPacking | RGDepthPacking); - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. - * - * `displacementMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * WebGL and WebGPU ignore this property and always render - * 1 pixel wide lines. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - copy(source: any): this; -} -import { Material } from './Material.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts deleted file mode 100644 index 459c2a606..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshDistanceMaterial.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * A material used internally for implementing shadow mapping with - * point lights. - * - * Can also be used to customize the shadow casting of an object by assigning - * an instance of `MeshDistanceMaterial` to {@link Object3D#customDistanceMaterial}. - * The following examples demonstrates this approach in order to ensure - * transparent parts of objects do not cast shadows. - * - * @augments Material - */ -export class MeshDistanceMaterial extends Material { - /** - * Constructs a new mesh distance material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshDistanceMaterial: boolean; - type: string; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. - * - * `displacementMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - copy(source: any): this; -} -import { Material } from './Material.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts deleted file mode 100644 index 375147a59..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshLambertMaterial.d.ts +++ /dev/null @@ -1,344 +0,0 @@ -/** - * A material for non-shiny surfaces, without specular highlights. - * - * The material uses a non-physically based [Lambertian](https://en.wikipedia.org/wiki/Lambertian_reflectance) - * model for calculating reflectance. This can simulate some surfaces (such - * as untreated wood or stone) well, but cannot simulate shiny surfaces with - * specular highlights (such as varnished wood). `MeshLambertMaterial` uses per-fragment - * shading. - * - * Due to the simplicity of the reflectance and illumination models, - * performance will be greater when using this material over the - * {@link MeshPhongMaterial}, {@link MeshStandardMaterial} or - * {@link MeshPhysicalMaterial}, at the cost of some graphical accuracy. - * - * @augments Material - * @demo scenes/material-browser.html#MeshLambertMaterial - */ -export class MeshLambertMaterial extends Material { - /** - * Constructs a new mesh lambert material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshLambertMaterial: boolean; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The light map. Requires a second set of UVs. - * - * `lightMap` represents pre-baked illuminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `lightMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - lightMap: Texture | null; - /** - * Intensity of the baked light. - * - * @type {number} - * @default 1 - */ - lightMapIntensity: number; - /** - * The red channel of this texture is used as the ambient occlusion map. - * Requires a second set of UVs. - * - * `aoMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - aoMap: Texture | null; - /** - * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` - * disables ambient occlusion. Where intensity is `1` and the AO map's - * red channel is also `1`, ambient light is fully occluded on a surface. - * - * @type {number} - * @default 1 - */ - aoMapIntensity: number; - /** - * Emissive (light) color of the material, essentially a solid color - * unaffected by other lighting. - * - * @type {Color} - * @default (0,0,0) - */ - emissive: Color; - /** - * Intensity of the emissive light. Modulates the emissive color. - * - * @type {number} - * @default 1 - */ - emissiveIntensity: number; - /** - * Set emissive (glow) map. The emissive map color is modulated by the - * emissive color and the emissive intensity. If you have an emissive map, - * be sure to set the emissive color to something other than black. - * - * `emissiveMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `emissiveMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - emissiveMap: Texture | null; - /** - * The texture to create a bump map. The black and white values map to the - * perceived depth in relation to the lights. Bump doesn't actually affect - * the geometry of the object, only the lighting. If a normal map is defined - * this will be ignored. - * - * `bumpMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - bumpMap: Texture | null; - /** - * How much the bump map affects the material. Typical range is `[0,1]`. - * - * @type {number} - * @default 1 - */ - bumpScale: number; - /** - * The texture to create a normal map. The RGB values affect the surface - * normal for each pixel fragment and change the way the color is lit. Normal - * maps do not change the actual shape of the surface, only the lighting. In - * case the material has a normal map authored using the left handed - * convention, the `y` component of `normalScale` should be negated to compensate - * for the different handedness. - * - * `normalMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - normalMap: Texture | null; - /** - * The type of normal map. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | ObjectSpaceNormalMap); - /** - * How much the normal map affects the material. Typical value range is `[0,1]`. - * - * @type {Vector2} - * @default (1,1) - */ - normalScale: Vector2; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. For best results, pair a - * displacement map with a matching normal map, since the renderer can - * not recompute surface normals from the displaced vertices. - * - * `displacementMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - /** - * Specular map used by the material. - * - * `specularMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `specularMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - specularMap: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * The environment map. - * - * `envMap` represents luminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `envMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - /** - * The rotation of the environment map in radians. - * - * @type {Euler} - * @default (0,0,0) - */ - envMapRotation: Euler; - /** - * How to combine the result of the surface's color with the environment map, if any. - * - * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to - * blend between the two colors. - * - * @type {(MultiplyOperation|MixOperation|AddOperation)} - * @default MultiplyOperation - */ - combine: (number | MixOperation | AddOperation); - /** - * How much the environment map affects the surface. - * The valid range is between `0` (no reflections) and `1` (full reflections). - * - * @type {number} - * @default 1 - */ - reflectivity: number; - /** - * Scales the effect of the environment map by multiplying its color. - * - * @type {number} - * @default 1 - */ - envMapIntensity: number; - /** - * The index of refraction (IOR) of air (approximately 1) divided by the - * index of refraction of the material. It is used with environment mapping - * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}. - * The refraction ratio should not exceed `1`. - * - * @type {number} - * @default 0.98 - */ - refractionRatio: number; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Defines appearance of wireframe ends. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinecap: ("round" | "bevel" | "miter"); - /** - * Defines appearance of wireframe joints. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinejoin: ("round" | "bevel" | "miter"); - /** - * Whether the material is rendered with flat shading or not. - * - * @type {boolean} - * @default false - */ - flatShading: boolean; - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; -import { Vector2 } from '../math/Vector2.js'; -import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts deleted file mode 100644 index f345fb9f5..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshMatcapMaterial.d.ts +++ /dev/null @@ -1,204 +0,0 @@ -/** - * This material is defined by a MatCap (or Lit Sphere) texture, which encodes the - * material color and shading. - * - * `MeshMatcapMaterial` does not respond to lights since the matcap image file encodes - * baked lighting. It will cast a shadow onto an object that receives shadows - * (and shadow clipping works), but it will not self-shadow or receive - * shadows. - * - * @augments Material - * @demo scenes/material-browser.html#MeshMatcapMaterial - */ -export class MeshMatcapMaterial extends Material { - /** - * Constructs a new mesh matcap material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshMatcapMaterial: boolean; - defines: { - MATCAP: string; - }; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * The matcap map. - * - * `matcap` represents luminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. HDR `matcap` textures (e.g. `.exr`) - * typically set `texture.colorSpace = LinearSRGBColorSpace`, while LDR - * `matcap` textures (e.g. `.png`, `.jpg`, `.webp`) typically set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - matcap: Texture | null; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The texture to create a bump map. The black and white values map to the - * perceived depth in relation to the lights. Bump doesn't actually affect - * the geometry of the object, only the lighting. If a normal map is defined - * this will be ignored. - * - * `bumpMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - bumpMap: Texture | null; - /** - * How much the bump map affects the material. Typical range is `[0,1]`. - * - * @type {number} - * @default 1 - */ - bumpScale: number; - /** - * The texture to create a normal map. The RGB values affect the surface - * normal for each pixel fragment and change the way the color is lit. Normal - * maps do not change the actual shape of the surface, only the lighting. In - * case the material has a normal map authored using the left handed - * convention, the `y` component of `normalScale` should be negated to compensate - * for the different handedness. - * - * `normalMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - normalMap: Texture | null; - /** - * The type of normal map. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | ObjectSpaceNormalMap); - /** - * How much the normal map affects the material. Typical value range is `[0,1]`. - * - * @type {Vector2} - * @default (1,1) - */ - normalScale: Vector2; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. For best results, pair a - * displacement map with a matching normal map, since the renderer can - * not recompute surface normals from the displaced vertices. - * - * `displacementMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Whether the material is rendered with flat shading or not. - * - * @type {boolean} - * @default false - */ - flatShading: boolean; - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; -import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts deleted file mode 100644 index 794b28e73..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshNormalMaterial.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -/** - * A material that maps the normal vectors to RGB colors. - * - * @augments Material - * @demo scenes/material-browser.html#MeshNormalMaterial - */ -export class MeshNormalMaterial extends Material { - /** - * Constructs a new mesh normal material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshNormalMaterial: boolean; - type: string; - /** - * The texture to create a bump map. The black and white values map to the - * perceived depth in relation to the lights. Bump doesn't actually affect - * the geometry of the object, only the lighting. If a normal map is defined - * this will be ignored. - * - * `bumpMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - bumpMap: Texture | null; - /** - * How much the bump map affects the material. Typical range is `[0,1]`. - * - * @type {number} - * @default 1 - */ - bumpScale: number; - /** - * The texture to create a normal map. The RGB values affect the surface - * normal for each pixel fragment and change the way the color is lit. Normal - * maps do not change the actual shape of the surface, only the lighting. In - * case the material has a normal map authored using the left handed - * convention, the `y` component of `normalScale` should be negated to compensate - * for the different handedness. - * - * `normalMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - normalMap: Texture | null; - /** - * The type of normal map. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | ObjectSpaceNormalMap); - /** - * How much the normal map affects the material. Typical value range is `[0,1]`. - * - * @type {Vector2} - * @default (1,1) - */ - normalScale: Vector2; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. For best results, pair a - * displacement map with a matching normal map, since the renderer can - * not recompute surface normals from the displaced vertices. - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * WebGL and WebGPU ignore this property and always render - * 1 pixel wide lines. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Whether the material is rendered with flat shading or not. - * - * @type {boolean} - * @default false - */ - flatShading: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts deleted file mode 100644 index 6fb55c994..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshPhongMaterial.d.ts +++ /dev/null @@ -1,359 +0,0 @@ -/** - * A material for shiny surfaces with specular highlights. - * - * The material uses a non-physically based [Blinn-Phong](https://en.wikipedia.org/wiki/Blinn-Phong_shading_model) - * model for calculating reflectance. Unlike the Lambertian model used in the - * {@link MeshLambertMaterial} this can simulate shiny surfaces with specular - * highlights (such as varnished wood). `MeshPhongMaterial` uses per-fragment shading. - * - * Performance will generally be greater when using this material over the - * {@link MeshStandardMaterial} or {@link MeshPhysicalMaterial}, at the cost of - * some graphical accuracy. - * - * @augments Material - * @demo scenes/material-browser.html#MeshPhongMaterial - */ -export class MeshPhongMaterial extends Material { - /** - * Constructs a new mesh phong material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshPhongMaterial: boolean; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * Specular color of the material. The default color is set to `0x111111` (very dark grey) - * - * This defines how shiny the material is and the color of its shine. - * - * @type {Color} - */ - specular: Color; - /** - * How shiny the specular highlight is; a higher value gives a sharper highlight. - * - * @type {number} - * @default 30 - */ - shininess: number; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The light map. Requires a second set of UVs. - * - * `lightMap` represents pre-baked illuminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `lightMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - lightMap: Texture | null; - /** - * Intensity of the baked light. - * - * @type {number} - * @default 1 - */ - lightMapIntensity: number; - /** - * The red channel of this texture is used as the ambient occlusion map. - * Requires a second set of UVs. - * - * `aoMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - aoMap: Texture | null; - /** - * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` - * disables ambient occlusion. Where intensity is `1` and the AO map's - * red channel is also `1`, ambient light is fully occluded on a surface. - * - * @type {number} - * @default 1 - */ - aoMapIntensity: number; - /** - * Emissive (light) color of the material, essentially a solid color - * unaffected by other lighting. - * - * @type {Color} - * @default (0,0,0) - */ - emissive: Color; - /** - * Intensity of the emissive light. Modulates the emissive color. - * - * @type {number} - * @default 1 - */ - emissiveIntensity: number; - /** - * Set emissive (glow) map. The emissive map color is modulated by the - * emissive color and the emissive intensity. If you have an emissive map, - * be sure to set the emissive color to something other than black. - * - * `emissiveMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `emissiveMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - emissiveMap: Texture | null; - /** - * The texture to create a bump map. The black and white values map to the - * perceived depth in relation to the lights. Bump doesn't actually affect - * the geometry of the object, only the lighting. If a normal map is defined - * this will be ignored. - * - * `bumpMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - bumpMap: Texture | null; - /** - * How much the bump map affects the material. Typical range is `[0,1]`. - * - * @type {number} - * @default 1 - */ - bumpScale: number; - /** - * The texture to create a normal map. The RGB values affect the surface - * normal for each pixel fragment and change the way the color is lit. Normal - * maps do not change the actual shape of the surface, only the lighting. In - * case the material has a normal map authored using the left handed - * convention, the `y` component of `normalScale` should be negated to compensate - * for the different handedness. - * - * `normalMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - normalMap: Texture | null; - /** - * The type of normal map. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | ObjectSpaceNormalMap); - /** - * How much the normal map affects the material. Typical value range is `[0,1]`. - * - * @type {Vector2} - * @default (1,1) - */ - normalScale: Vector2; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. For best results, pair a - * displacement map with a matching normal map, since the renderer can - * not recompute surface normals from the displaced vertices. - * - * `displacementMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - /** - * The specular map value affects both how much the specular surface - * highlight contributes and how much of the environment map affects the - * surface. - * - * `specularMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `specularMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - specularMap: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * The environment map. - * - * `envMap` represents luminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `envMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - /** - * The rotation of the environment map in radians. - * - * @type {Euler} - * @default (0,0,0) - */ - envMapRotation: Euler; - /** - * How to combine the result of the surface's color with the environment map, if any. - * - * When set to `MixOperation`, the {@link MeshBasicMaterial#reflectivity} is used to - * blend between the two colors. - * - * @type {(MultiplyOperation|MixOperation|AddOperation)} - * @default MultiplyOperation - */ - combine: (number | MixOperation | AddOperation); - /** - * How much the environment map affects the surface. - * The valid range is between `0` (no reflections) and `1` (full reflections). - * - * @type {number} - * @default 1 - */ - reflectivity: number; - /** - * Scales the effect of the environment map by multiplying its color. - * - * @type {number} - * @default 1 - */ - envMapIntensity: number; - /** - * The index of refraction (IOR) of air (approximately 1) divided by the - * index of refraction of the material. It is used with environment mapping - * modes {@link CubeRefractionMapping} and {@link EquirectangularRefractionMapping}. - * The refraction ratio should not exceed `1`. - * - * @type {number} - * @default 0.98 - */ - refractionRatio: number; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Defines appearance of wireframe ends. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinecap: ("round" | "bevel" | "miter"); - /** - * Defines appearance of wireframe joints. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinejoin: ("round" | "bevel" | "miter"); - /** - * Whether the material is rendered with flat shading or not. - * - * @type {boolean} - * @default false - */ - flatShading: boolean; - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; -import { Vector2 } from '../math/Vector2.js'; -import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts deleted file mode 100644 index 285e8a2bb..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshPhysicalMaterial.d.ts +++ /dev/null @@ -1,362 +0,0 @@ -/** - * An extension of the {@link MeshStandardMaterial}, providing more advanced - * physically-based rendering properties: - * - * - Anisotropy: Ability to represent the anisotropic property of materials - * as observable with brushed metals. - * - Clearcoat: Some materials — like car paints, carbon fiber, and wet surfaces — require - * a clear, reflective layer on top of another layer that may be irregular or rough. - * Clearcoat approximates this effect, without the need for a separate transparent surface. - * - Iridescence: Allows to render the effect where hue varies depending on the viewing - * angle and illumination angle. This can be seen on soap bubbles, oil films, or on the - * wings of many insects. - * - Physically-based transparency: One limitation of {@link Material#opacity} is that highly - * transparent materials are less reflective. Physically-based transmission provides a more - * realistic option for thin, transparent surfaces like glass. - * - Advanced reflectivity: More flexible reflectivity for non-metallic materials. - * - Retroreflection: Redirects specular light back toward the light source for - * safety materials like road markings and reflective tape. - * - Sheen: Can be used for representing cloth and fabric materials. - * - * As a result of these complex shading features, `MeshPhysicalMaterial` has a - * higher performance cost, per pixel, than other three.js materials. Most - * effects are disabled by default, and add cost as they are enabled. For - * best results, always specify an environment map when using this material. - * - * @augments MeshStandardMaterial - * @demo scenes/material-browser.html#MeshPhysicalMaterial - */ -export class MeshPhysicalMaterial extends MeshStandardMaterial { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshPhysicalMaterial: boolean; - defines: { - STANDARD: string; - PHYSICAL: string; - }; - /** - * The rotation of the anisotropy in tangent, bitangent space, measured in radians - * counter-clockwise from the tangent. When `anisotropyMap` is present, this - * property provides additional rotation to the vectors in the texture. - * - * @type {number} - * @default 1 - */ - anisotropyRotation: number; - /** - * Red and green channels represent the anisotropy direction in `[-1, 1]` tangent, - * bitangent space, to be rotated by `anisotropyRotation`. The blue channel - * contains strength as `[0, 1]` to be multiplied by `anisotropy`. - * - * `anisotropyMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - anisotropyMap: Texture | null; - /** - * The red channel of this texture is multiplied against `clearcoat`, - * for per-pixel control over a coating's intensity. - * - * `clearcoatMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - clearcoatMap: Texture | null; - /** - * Roughness of the clear coat layer, from `0.0` to `1.0`. - * - * @type {number} - * @default 0 - */ - clearcoatRoughness: number; - /** - * The green channel of this texture is multiplied against - * `clearcoatRoughness`, for per-pixel control over a coating's roughness. - * - * `clearcoatRoughnessMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - clearcoatRoughnessMap: Texture | null; - /** - * How much `clearcoatNormalMap` affects the clear coat layer, from - * `(0,0)` to `(1,1)`. - * - * @type {Vector2} - * @default (1,1) - */ - clearcoatNormalScale: Vector2; - /** - * Can be used to enable independent normals for the clear coat layer. - * - * `clearcoatNormalMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - clearcoatNormalMap: Texture | null; - /** - * Index-of-refraction for non-metallic materials, from `1.0` to `2.333`. - * - * @type {number} - * @default 1.5 - */ - ior: number; - /** - * The red channel of this texture is multiplied against `iridescence`, for per-pixel - * control over iridescence. - * - * `iridescenceMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - iridescenceMap: Texture | null; - /** - * Strength of the iridescence RGB color shift effect, represented by an index-of-refraction. - * Between `1.0` to `2.333`. - * - * @type {number} - * @default 1.3 - */ - iridescenceIOR: number; - /** - *Array of exactly 2 elements, specifying minimum and maximum thickness of the iridescence layer. - Thickness of iridescence layer has an equivalent effect of the one `thickness` has on `ior`. - * - * @type {Array} - * @default [100,400] - */ - iridescenceThicknessRange: Array; - /** - * A texture that defines the thickness of the iridescence layer, stored in the green channel. - * Minimum and maximum values of thickness are defined by `iridescenceThicknessRange` array: - * - `0.0` in the green channel will result in thickness equal to first element of the array. - * - `1.0` in the green channel will result in thickness equal to second element of the array. - * - Values in-between will linearly interpolate between the elements of the array. - * - * `iridescenceThicknessMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - iridescenceThicknessMap: Texture | null; - /** - * The sheen tint. - * - * @type {Color} - * @default (0,0,0) - */ - sheenColor: Color; - /** - * The RGB channels of this texture are multiplied against `sheenColor`, for per-pixel control - * over sheen tint. - * - * `sheenColorMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `sheenColorMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - sheenColorMap: Texture | null; - /** - * Roughness of the sheen layer, from `0.0` to `1.0`. - * - * @type {number} - * @default 1 - */ - sheenRoughness: number; - /** - * The alpha channel of this texture is multiplied against `sheenRoughness`, for per-pixel control - * over sheen roughness. - * - * `sheenRoughnessMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - sheenRoughnessMap: Texture | null; - /** - * The red channel of this texture is multiplied against `transmission`, for per-pixel control over - * optical transparency. - * - * `transmissionMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - transmissionMap: Texture | null; - /** - * The thickness of the volume beneath the surface. The value is given in the - * coordinate space of the mesh. If the value is `0` the material is - * thin-walled. Otherwise the material is a volume boundary. - * - * @type {number} - * @default 0 - */ - thickness: number; - /** - * A texture that defines the thickness, stored in the green channel. This will - * be multiplied by `thickness`. - * - * `thicknessMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - thicknessMap: Texture | null; - /** - * Density of the medium given as the average distance that light travels in - * the medium before interacting with a particle. The value is given in world - * space units, and must be greater than zero. - * - * @type {number} - * @default Infinity - */ - attenuationDistance: number; - /** - * The color that white light turns into due to absorption when reaching the - * attenuation distance. - * - * @type {Color} - * @default (1,1,1) - */ - attenuationColor: Color; - /** - * A float that scales the amount of specular reflection for non-metals only. - * When set to zero, the model is effectively Lambertian. From `0.0` to `1.0`. - * - * @type {number} - * @default 1 - */ - specularIntensity: number; - /** - * The alpha channel of this texture is multiplied against `specularIntensity`, - * for per-pixel control over specular intensity. - * - * `specularIntensityMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - specularIntensityMap: Texture | null; - /** - * Tints the specular reflection at normal incidence for non-metals only. - * - * @type {Color} - * @default (1,1,1) - */ - specularColor: Color; - /** - * The RGB channels of this texture are multiplied against `specularColor`, - * for per-pixel control over specular color. - * - * `specularColorMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `specularColorMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - specularColorMap: Texture | null; - _anisotropy: number; - _clearcoat: number; - _dispersion: number; - _iridescence: number; - _retroreflectivity: number; - _sheen: number; - _transmission: number; - set anisotropy(value: number); - /** - * The anisotropy strength, from `0.0` to `1.0`. - * - * @type {number} - * @default 0 - */ - get anisotropy(): number; - set clearcoat(value: number); - /** - * Represents the intensity of the clear coat layer, from `0.0` to `1.0`. Use - * clear coat related properties to enable multilayer materials that have a - * thin translucent layer over the base layer. - * - * @type {number} - * @default 0 - */ - get clearcoat(): number; - set iridescence(value: number); - /** - * The intensity of the iridescence layer, simulating RGB color shift based on the angle between - * the surface and the viewer, from `0.0` to `1.0`. - * - * @type {number} - * @default 0 - */ - get iridescence(): number; - set dispersion(value: number); - /** - * Defines the strength of the angular separation of colors (chromatic aberration) transmitting - * through a relatively clear volume. Any value zero or larger is valid, the typical range of - * realistic values is `[0, 1]`. This property can be only be used with transmissive objects. - * - * @type {number} - * @default 0 - */ - get dispersion(): number; - set retroreflectivity(value: number); - /** - * The strength of retroreflection, from `0.0` to `1.0`. A value of `1.0` - * evaluates the material's microfacet reflection with the view direction - * reflected about the surface normal, redirecting the specular lobe back - * toward the light source. - * - * @type {number} - * @default 0 - */ - get retroreflectivity(): number; - set sheen(value: number); - /** - * The intensity of the sheen layer, from `0.0` to `1.0`. - * - * @type {number} - * @default 0 - */ - get sheen(): number; - set transmission(value: number); - /** - * Degree of transmission (or optical transparency), from `0.0` to `1.0`. - * - * Thin, transparent or semitransparent, plastic or glass materials remain - * largely reflective even if they are fully transmissive. The transmission - * property can be used to model these materials. - * - * When transmission is non-zero, `opacity` should be set to `1`. - * - * @type {number} - * @default 0 - */ - get transmission(): number; - copy(source: any): this; -} -import { MeshStandardMaterial } from './MeshStandardMaterial.js'; -import { Vector2 } from '../math/Vector2.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts deleted file mode 100644 index d95b258b5..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshStandardMaterial.d.ts +++ /dev/null @@ -1,367 +0,0 @@ -/** - * A standard physically based material, using Metallic-Roughness workflow. - * - * Physically based rendering (PBR) has recently become the standard in many - * 3D applications, such as [Unity](https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/), - * [Unreal](https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/) and - * [3D Studio Max](http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017). - * - * This approach differs from older approaches in that instead of using - * approximations for the way in which light interacts with a surface, a - * physically correct model is used. The idea is that, instead of tweaking - * materials to look good under specific lighting, a material can be created - * that will react 'correctly' under all lighting scenarios. - * - * In practice this gives a more accurate and realistic looking result than - * the {@link MeshLambertMaterial} or {@link MeshPhongMaterial}, at the cost of - * being somewhat more computationally expensive. `MeshStandardMaterial` uses per-fragment - * shading. - * - * Note that for best results you should always specify an environment map when using this material. - * - * For a non-technical introduction to the concept of PBR and how to set up a - * PBR material, check out these articles by the people at [marmoset](https://www.marmoset.co): - * - * - [Basic Theory of Physically Based Rendering](https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/) - * - [Physically Based Rendering and You Can Too](https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/) - * - * Technical details of the approach used in three.js (and most other PBR systems) can be found is this - * [paper from Disney](https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf) - * (pdf), by Brent Burley. - * - * @augments Material - * @demo scenes/material-browser.html#MeshStandardMaterial - */ -export class MeshStandardMaterial extends Material { - /** - * Constructs a new mesh standard material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshStandardMaterial: boolean; - type: string; - defines: { - STANDARD: string; - }; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * How rough the material appears. `0.0` means a smooth mirror reflection, `1.0` - * means fully diffuse. If `roughnessMap` is also provided, - * both values are multiplied. - * - * @type {number} - * @default 1 - */ - roughness: number; - /** - * How much the material is like a metal. Non-metallic materials such as wood - * or stone use `0.0`, metallic use `1.0`, with nothing (usually) in between. - * A value between `0.0` and `1.0` could be used for a rusty metal look. - * If `metalnessMap` is also provided, both values are multiplied. - * - * @type {number} - * @default 0 - */ - metalness: number; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The light map. Requires a second set of UVs. - * - * `lightMap` represents pre-baked illuminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `lightMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - lightMap: Texture | null; - /** - * Intensity of the baked light. - * - * @type {number} - * @default 1 - */ - lightMapIntensity: number; - /** - * The red channel of this texture is used as the ambient occlusion map. - * Requires a second set of UVs. - * - * `aoMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - aoMap: Texture | null; - /** - * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` - * disables ambient occlusion. Where intensity is `1` and the AO map's - * red channel is also `1`, ambient light is fully occluded on a surface. - * - * @type {number} - * @default 1 - */ - aoMapIntensity: number; - /** - * Emissive (light) color of the material, essentially a solid color - * unaffected by other lighting. - * - * @type {Color} - * @default (0,0,0) - */ - emissive: Color; - /** - * Intensity of the emissive light. Modulates the emissive color. - * - * @type {number} - * @default 1 - */ - emissiveIntensity: number; - /** - * Set emissive (glow) map. The emissive map color is modulated by the - * emissive color and the emissive intensity. If you have an emissive map, - * be sure to set the emissive color to something other than black. - * - * `emissiveMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `emissiveMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - emissiveMap: Texture | null; - /** - * The texture to create a bump map. The black and white values map to the - * perceived depth in relation to the lights. Bump doesn't actually affect - * the geometry of the object, only the lighting. If a normal map is defined - * this will be ignored. - * - * `bumpMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - bumpMap: Texture | null; - /** - * How much the bump map affects the material. Typical range is `[0,1]`. - * - * @type {number} - * @default 1 - */ - bumpScale: number; - /** - * The texture to create a normal map. The RGB values affect the surface - * normal for each pixel fragment and change the way the color is lit. Normal - * maps do not change the actual shape of the surface, only the lighting. In - * case the material has a normal map authored using the left handed - * convention, the `y` component of `normalScale` should be negated to compensate - * for the different handedness. - * - * `normalMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - normalMap: Texture | null; - /** - * The type of normal map. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | ObjectSpaceNormalMap); - /** - * How much the normal map affects the material. Typical value range is `[0,1]`. - * - * @type {Vector2} - * @default (1,1) - */ - normalScale: Vector2; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. For best results, pair a - * displacement map with a matching normal map, since the renderer can - * not recompute surface normals from the displaced vertices. - * - * `displacementMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - /** - * The green channel of this texture is used to alter the roughness of the - * material. - * - * `roughnessMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - roughnessMap: Texture | null; - /** - * The blue channel of this texture is used to alter the metalness of the - * material. - * - * `metalnessMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - metalnessMap: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * The environment map. To ensure a physically correct rendering, environment maps - * are internally pre-processed with {@link PMREMGenerator}. - * - * `envMap` represents luminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `envMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - envMap: Texture | null; - /** - * The rotation of the environment map in radians. - * - * @type {Euler} - * @default (0,0,0) - */ - envMapRotation: Euler; - /** - * Scales the effect of the environment map by multiplying its color. - * - * @type {number} - * @default 1 - */ - envMapIntensity: number; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Defines appearance of wireframe ends. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinecap: ("round" | "bevel" | "miter"); - /** - * Defines appearance of wireframe joints. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinejoin: ("round" | "bevel" | "miter"); - /** - * Whether the material is rendered with flat shading or not. - * - * @type {boolean} - * @default false - */ - flatShading: boolean; - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; -import { Vector2 } from '../math/Vector2.js'; -import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts deleted file mode 100644 index 8777c4e00..000000000 --- a/jsdoc-testing/jsdoc/src/materials/MeshToonMaterial.d.ts +++ /dev/null @@ -1,275 +0,0 @@ -/** - * A material implementing toon shading. - * - * @augments Material - * @demo scenes/material-browser.html#MeshToonMaterial - */ -export class MeshToonMaterial extends Material { - /** - * Constructs a new mesh toon material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshToonMaterial: boolean; - defines: { - TOON: string; - }; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * Gradient map for toon shading. It's required to set - * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter} - * when using this type of texture. - * - * `gradientMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - gradientMap: Texture | null; - /** - * The light map. Requires a second set of UVs. - * - * `lightMap` represents pre-baked illuminance data, and the texture must be assigned - * a {@link Texture#colorSpace}. Most `lightMap` textures set - * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats - * such as `.exr` or `.hdr`. - * - * @type {?Texture} - * @default null - */ - lightMap: Texture | null; - /** - * Intensity of the baked light. - * - * @type {number} - * @default 1 - */ - lightMapIntensity: number; - /** - * The red channel of this texture is used as the ambient occlusion map. - * Requires a second set of UVs. - * - * `aoMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - aoMap: Texture | null; - /** - * Intensity of the ambient occlusion effect. Range is `[0,1]`, where `0` - * disables ambient occlusion. Where intensity is `1` and the AO map's - * red channel is also `1`, ambient light is fully occluded on a surface. - * - * @type {number} - * @default 1 - */ - aoMapIntensity: number; - /** - * Emissive (light) color of the material, essentially a solid color - * unaffected by other lighting. - * - * @type {Color} - * @default (0,0,0) - */ - emissive: Color; - /** - * Intensity of the emissive light. Modulates the emissive color. - * - * @type {number} - * @default 1 - */ - emissiveIntensity: number; - /** - * Set emissive (glow) map. The emissive map color is modulated by the - * emissive color and the emissive intensity. If you have an emissive map, - * be sure to set the emissive color to something other than black. - * - * `emissiveMap` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `emissiveMap` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - emissiveMap: Texture | null; - /** - * The texture to create a bump map. The black and white values map to the - * perceived depth in relation to the lights. Bump doesn't actually affect - * the geometry of the object, only the lighting. If a normal map is defined - * this will be ignored. - * - * `bumpMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - bumpMap: Texture | null; - /** - * How much the bump map affects the material. Typical range is `[0,1]`. - * - * @type {number} - * @default 1 - */ - bumpScale: number; - /** - * The texture to create a normal map. The RGB values affect the surface - * normal for each pixel fragment and change the way the color is lit. Normal - * maps do not change the actual shape of the surface, only the lighting. In - * case the material has a normal map authored using the left handed - * convention, the `y` component of `normalScale` should be negated to compensate - * for the different handedness. - * - * `normalMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - normalMap: Texture | null; - /** - * The type of normal map. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | ObjectSpaceNormalMap); - /** - * How much the normal map affects the material. Typical value range is `[0,1]`. - * - * @type {Vector2} - * @default (1,1) - */ - normalScale: Vector2; - /** - * The displacement map affects the position of the mesh's vertices. Unlike - * other maps which only affect the light and shade of the material the - * displaced vertices can cast shadows, block other objects, and otherwise - * act as real geometry. The displacement texture is an image where the value - * of each pixel (white being the highest) is mapped against, and - * repositions, the vertices of the mesh. For best results, pair a - * displacement map with a matching normal map, since the renderer can - * not recompute surface normals from the displaced vertices. - * - * `displacementMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - displacementMap: Texture | null; - /** - * How much the displacement map affects the mesh (where black is no - * displacement, and white is maximum displacement). Without a displacement - * map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementScale: number; - /** - * The offset of the displacement map's values on the mesh's vertices. - * The bias is added to the scaled sample of the displacement map. - * Without a displacement map set, this value is not applied. - * - * @type {number} - * @default 0 - */ - displacementBias: number; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Defines appearance of wireframe ends. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinecap: ("round" | "bevel" | "miter"); - /** - * Defines appearance of wireframe joints. - * - * Can only be used with {@link SVGRenderer}. - * - * @type {('round'|'bevel'|'miter')} - * @default 'round' - */ - wireframeLinejoin: ("round" | "bevel" | "miter"); - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; -import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts deleted file mode 100644 index 69665f811..000000000 --- a/jsdoc-testing/jsdoc/src/materials/PointsMaterial.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * A material for rendering point primitives. - * - * Materials define the appearance of renderable 3D objects. - * - * ```js - * const vertices = []; - * - * for ( let i = 0; i < 10000; i ++ ) { - * const x = THREE.MathUtils.randFloatSpread( 2000 ); - * const y = THREE.MathUtils.randFloatSpread( 2000 ); - * const z = THREE.MathUtils.randFloatSpread( 2000 ); - * - * vertices.push( x, y, z ); - * } - * - * const geometry = new THREE.BufferGeometry(); - * geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) ); - * const material = new THREE.PointsMaterial( { color: 0x888888 } ); - * const points = new THREE.Points( geometry, material ); - * scene.add( points ); - * ``` - * - * @augments Material - */ -export class PointsMaterial extends Material { - /** - * Constructs a new points material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPointsMaterial: boolean; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * Defines the size of the points in pixels. - * - * Might be capped if the value exceeds hardware dependent parameters like [gl.ALIASED_POINT_SIZE_RANGE](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getParamete). - * - * @type {number} - * @default 1 - */ - size: number; - /** - * Specifies whether size of individual points is attenuated by the camera depth (perspective camera only). - * - * @type {boolean} - * @default true - */ - sizeAttenuation: boolean; - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts deleted file mode 100644 index c9e548d48..000000000 --- a/jsdoc-testing/jsdoc/src/materials/RawShaderMaterial.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -declare const RawShaderMaterial_base: { - new (parameters?: Object): { - readonly isShaderMaterial: boolean; - type: string; - defines: Object; - uniforms: Object; - uniformsGroups: Array; - vertexShader: string; - fragmentShader: string; - linewidth: number; - wireframe: boolean; - wireframeLinewidth: number; - fog: boolean; - lights: boolean; - clipping: boolean; - forceSinglePass: boolean; - extensions: { - clipCullDistance: false; - multiDraw: false; - }; - defaultAttributeValues: Object; - index0AttributeName: string | undefined; - uniformsNeedUpdate: boolean; - glslVersion: (GLSL1 | GLSL3) | null; - copy(source: any): /*elided*/ any; - toJSON(meta: any): Object; - fromJSON(json: Object, textures: { - [x: string]: Texture; - }): /*elided*/ any; - readonly isMaterial: boolean; - readonly uuid: string; - name: string; - blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending); - side: (number | BackSide | DoubleSide); - vertexColors: boolean; - opacity: number; - transparent: boolean; - alphaHash: boolean; - blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); - blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; - blendColor: import("../Three.Core.js").Color; - blendAlpha: number; - depthFunc: (NeverDepth | AlwaysDepth | LessDepth | number | EqualDepth | GreaterEqualDepth | GreaterDepth | NotEqualDepth); - depthTest: boolean; - depthWrite: boolean; - stencilWriteMask: number; - stencilFunc: NeverStencilFunc | LessStencilFunc | EqualStencilFunc | LessEqualStencilFunc | GreaterStencilFunc | NotEqualStencilFunc | GreaterEqualStencilFunc | number; - stencilRef: number; - stencilFuncMask: number; - stencilFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZFail: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilZPass: ZeroStencilOp | number | ReplaceStencilOp | IncrementStencilOp | DecrementStencilOp | IncrementWrapStencilOp | DecrementWrapStencilOp | InvertStencilOp; - stencilWrite: boolean; - clippingPlanes: Array | null; - clipIntersection: boolean; - clipShadows: boolean; - shadowSide: (number | BackSide | DoubleSide) | null; - colorWrite: boolean; - precision: ("highp" | "mediump" | "lowp") | null; - polygonOffset: boolean; - polygonOffsetFactor: number; - polygonOffsetUnits: number; - dithering: boolean; - alphaToCoverage: boolean; - premultipliedAlpha: boolean; - allowOverride: boolean; - visible: boolean; - toneMapped: boolean; - userData: Object; - readonly version: number; - _alphaTest: number; - get alphaTest(): number; - set alphaTest(value: number); - onBeforeRender(): void; - onBeforeCompile(): void; - customProgramCacheKey(): string; - setValues(values?: Object): void; - clone(): Material; - dispose(): void; - set needsUpdate(value: boolean); - addEventListener(type: string, listener: Function): void; - _listeners: {} | undefined; - hasEventListener(type: string, listener: Function): boolean; - removeEventListener(type: string, listener: Function): void; - dispatchEvent(event: Object): void; - }; -}; -/** - * This class works just like {@link ShaderMaterial}, except that definitions - * of built-in uniforms and attributes are not automatically prepended to the - * GLSL shader code. - * - * `RawShaderMaterial` can only be used with {@link WebGLRenderer}. - * - * @augments ShaderMaterial - */ -export class RawShaderMaterial extends RawShaderMaterial_base { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRawShaderMaterial: boolean; -} -export {}; diff --git a/jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts deleted file mode 100644 index 24157d560..000000000 --- a/jsdoc-testing/jsdoc/src/materials/ShaderMaterial.d.ts +++ /dev/null @@ -1,266 +0,0 @@ -/** - * ~Shader - */ -export type ShaderMaterial = { - /** - * - The name of the shader. - */ - name: string; - /** - * - The uniforms of the shader. - */ - uniforms: { - [x: string]: Uniform; - }; - /** - * - The defines of the shader. - */ - defines: { - [x: string]: any; - }; - /** - * - The vertex shader code. - */ - vertexShader: string; - /** - * - The fragment shader code. - */ - fragmentShader: string; -}; -/** - * A material rendered with custom shaders. A shader is a small program written in GLSL. - * that runs on the GPU. You may want to use a custom shader if you need to implement an - * effect not included with any of the built-in materials. - * - * There are the following notes to bear in mind when using a `ShaderMaterial`: - * - * - `ShaderMaterial` can only be used with {@link WebGLRenderer}. - * - Built in attributes and uniforms are passed to the shaders along with your code. If - * you don't want that, use {@link RawShaderMaterial} instead. - * - You can use the directive `#pragma unroll_loop_start` and `#pragma unroll_loop_end` - * in order to unroll a `for` loop in GLSL by the shader preprocessor. The directive has - * to be placed right above the loop. The loop formatting has to correspond to a defined standard. - * - The loop has to be [normalized](https://en.wikipedia.org/wiki/Normalized_loop). - * - The loop variable has to be *i*. - * - The value `UNROLLED_LOOP_INDEX` will be replaced with the explicitly - * value of *i* for the given iteration and can be used in preprocessor - * statements. - * - * ```js - * const material = new THREE.ShaderMaterial( { - * uniforms: { - * time: { value: 1.0 }, - * resolution: { value: new THREE.Vector2() } - * }, - * vertexShader: document.getElementById( 'vertexShader' ).textContent, - * fragmentShader: document.getElementById( 'fragmentShader' ).textContent - * } ); - * ``` - * - * @augments Material - */ -export class ShaderMaterial extends Material { - /** - * Constructs a new shader material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShaderMaterial: boolean; - type: string; - /** - * Defines custom constants using `#define` directives within the GLSL code - * for both the vertex shader and the fragment shader; each key/value pair - * yields another directive. - * ```js - * defines: { - * FOO: 15, - * BAR: true - * } - * ``` - * Yields the lines: - * ``` - * #define FOO 15 - * #define BAR true - * ``` - * - * @type {Object} - */ - defines: Object; - /** - * An object of the form: - * ```js - * { - * "uniform1": { value: 1.0 }, - * "uniform2": { value: 2 } - * } - * ``` - * specifying the uniforms to be passed to the shader code; keys are uniform - * names, values are definitions of the form - * ``` - * { - * value: 1.0 - * } - * ``` - * where `value` is the value of the uniform. Names must match the name of - * the uniform, as defined in the GLSL code. Note that uniforms are refreshed - * on every frame, so updating the value of the uniform will immediately - * update the value available to the GLSL code. - * - * @type {Object} - */ - uniforms: Object; - /** - * An array holding uniforms groups for configuring UBOs. - * - * @type {Array} - */ - uniformsGroups: Array; - /** - * Vertex shader GLSL code. This is the actual code for the shader. - * - * @type {string} - */ - vertexShader: string; - /** - * Fragment shader GLSL code. This is the actual code for the shader. - * - * @type {string} - */ - fragmentShader: string; - /** - * Controls line thickness or lines. - * - * WebGL and WebGPU ignore this setting and always render line primitives with a - * width of one pixel. - * - * @type {number} - * @default 1 - */ - linewidth: number; - /** - * Renders the geometry as a wireframe. - * - * @type {boolean} - * @default false - */ - wireframe: boolean; - /** - * Controls the thickness of the wireframe. - * - * WebGL and WebGPU ignore this property and always render - * 1 pixel wide lines. - * - * @type {number} - * @default 1 - */ - wireframeLinewidth: number; - /** - * Defines whether the material color is affected by global fog settings; `true` - * to pass fog uniforms to the shader. - * - * Setting this property to `true` requires the definition of fog uniforms. It is - * recommended to use `UniformsUtils.merge()` to combine the custom shader uniforms - * with predefined fog uniforms. - * - * ```js - * const material = new ShaderMaterial( { - * uniforms: UniformsUtils.merge( [ UniformsLib[ 'fog' ], shaderUniforms ] ); - * vertexShader: vertexShader, - * fragmentShader: fragmentShader, - * fog: true - * } ); - * ``` - * - * @type {boolean} - * @default false - */ - fog: boolean; - /** - * Defines whether this material uses lighting; `true` to pass uniform data - * related to lighting to this shader. - * - * @type {boolean} - * @default false - */ - lights: boolean; - /** - * Defines whether this material supports clipping; `true` to let the renderer - * pass the clippingPlanes uniform. - * - * @type {boolean} - * @default false - */ - clipping: boolean; - /** - * This object allows to enable certain WebGL 2 extensions. - * - * - clipCullDistance: set to `true` to use vertex shader clipping - * - multiDraw: set to `true` to use vertex shader multi_draw / enable gl_DrawID - * - * @type {{clipCullDistance:false,multiDraw:false}} - */ - extensions: { - clipCullDistance: false; - multiDraw: false; - }; - /** - * When the rendered geometry doesn't include these attributes but the - * material does, these default values will be passed to the shaders. This - * avoids errors when buffer data is missing. - * - * - color: [ 1, 1, 1 ] - * - uv: [ 0, 0 ] - * - uv1: [ 0, 0 ] - * - * @type {Object} - */ - defaultAttributeValues: Object; - /** - * If set, this calls [gl.bindAttribLocation](https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation) - * to bind a generic vertex index to an attribute variable. - * - * @type {string|undefined} - * @default undefined - */ - index0AttributeName: string | undefined; - /** - * Can be used to force a uniform update while changing uniforms in - * {@link Object3D#onBeforeRender}. - * - * @type {boolean} - * @default false - */ - uniformsNeedUpdate: boolean; - /** - * Defines the GLSL version of custom shader code. - * - * @type {?(GLSL1|GLSL3)} - * @default null - */ - glslVersion: (GLSL1 | GLSL3) | null; - copy(source: any): this; - toJSON(meta: any): Object; - /** - * Deserializes the material from the given JSON. - * - * @param {Object} json - The JSON holding the serialized material. - * @param {Object} textures - A dictionary holding textures referenced by the material. - * @return {ShaderMaterial} A reference to this material. - */ - fromJSON(json: Object, textures: { - [x: string]: Texture; - }): ShaderMaterial; -} -import { Material } from './Material.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts deleted file mode 100644 index 2e66a5668..000000000 --- a/jsdoc-testing/jsdoc/src/materials/ShadowMaterial.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * This material can receive shadows, but otherwise is completely transparent. - * - * ```js - * const geometry = new THREE.PlaneGeometry( 2000, 2000 ); - * geometry.rotateX( - Math.PI / 2 ); - * - * const material = new THREE.ShadowMaterial(); - * material.opacity = 0.2; - * - * const plane = new THREE.Mesh( geometry, material ); - * plane.position.y = -200; - * plane.receiveShadow = true; - * scene.add( plane ); - * ``` - * - * @augments Material - */ -export class ShadowMaterial extends Material { - /** - * Constructs a new shadow material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowMaterial: boolean; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (0,0,0) - */ - color: Color; - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts deleted file mode 100644 index dfe9816f7..000000000 --- a/jsdoc-testing/jsdoc/src/materials/SpriteMaterial.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * A material for rendering instances of {@link Sprite}. - * - * ```js - * const map = new THREE.TextureLoader().load( 'textures/sprite.png' ); - * const material = new THREE.SpriteMaterial( { map: map, color: 0xffffff } ); - * - * const sprite = new THREE.Sprite( material ); - * sprite.scale.set(200, 200, 1) - * scene.add( sprite ); - * ``` - * - * @augments Material - */ -export class SpriteMaterial extends Material { - /** - * Constructs a new sprite material. - * - * @param {Object} [parameters] - An object with one or more properties - * defining the material's appearance. Any property of the material - * (including any property from inherited materials) can be passed - * in here. Color values can be passed any type of value accepted - * by {@link Color#set}. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSpriteMaterial: boolean; - type: string; - /** - * Color of the material. - * - * @type {Color} - * @default (1,1,1) - */ - color: Color; - /** - * The color map. May optionally include an alpha channel, typically combined - * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map - * color is modulated by the diffuse `color`. - * - * `map` represents color data, and the texture must be assigned a - * {@link Texture#colorSpace}. Most `map` textures set - * `texture.colorSpace = SRGBColorSpace`. - * - * @type {?Texture} - * @default null - */ - map: Texture | null; - /** - * The alpha map is a grayscale texture that controls the opacity across the - * surface (black: fully transparent; white: fully opaque). - * - * Only the color of the texture is used, ignoring the alpha channel if one - * exists. For RGB and RGBA textures, the renderer will use the green channel - * when sampling this texture due to the extra bit of precision provided for - * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and - * luminance/alpha textures will also still work as expected. - * - * `alphaMap` represents non-color data. Any texture assigned must have - * `texture.colorSpace = NoColorSpace` (default). - * - * @type {?Texture} - * @default null - */ - alphaMap: Texture | null; - /** - * The rotation of the sprite in radians. - * - * @type {number} - * @default 0 - */ - rotation: number; - /** - * Specifies whether size of the sprite is attenuated by the camera depth (perspective camera only). - * - * @type {boolean} - * @default true - */ - sizeAttenuation: boolean; - /** - * Whether the material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - copy(source: any): this; -} -import { Material } from './Material.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts deleted file mode 100644 index 861ba6447..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/Line2NodeMaterial.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -export default Line2NodeMaterial; -/** - * This node material can be used to render lines with a size larger than one - * by representing them as instanced meshes. - * - * @augments NodeMaterial - */ -declare class Line2NodeMaterial extends NodeMaterial { - /** - * Constructs a new node material for wide line rendering. - * - * @param {Object} [parameters={}] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLine2NodeMaterial: boolean; - /** - * The dash offset. - * - * @type {number} - * @default 0 - */ - dashOffset: number; - /** - * Defines the offset. - * - * @type {?Node} - * @default null - */ - offsetNode: Node | null; - /** - * Defines the dash scale. - * - * @type {?Node} - * @default null - */ - dashScaleNode: Node | null; - /** - * Defines the dash size. - * - * @type {?Node} - * @default null - */ - dashSizeNode: Node | null; - /** - * Defines the gap size. - * - * @type {?Node} - * @default null - */ - gapSizeNode: Node | null; - _useDash: any; - _useAlphaToCoverage: boolean; - _useWorldUnits: boolean; - set lineColorNode(value: Node | null); - /** - * Defines the lines color. - * - * @deprecated since r185. Use {@link NodeMaterial#colorNode} instead. - * @type {?Node} - */ - get lineColorNode(): Node | null; - set worldUnits(value: boolean); - /** - * Whether the lines should sized in world units or not. - * When set to `false` the unit is pixel. - * - * @type {boolean} - * @default false - */ - get worldUnits(): boolean; - set dashed(value: boolean); - /** - * Whether the lines should be dashed or not. - * - * @type {boolean} - * @default false - */ - get dashed(): boolean; -} -import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts deleted file mode 100644 index da65dc888..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/LineBasicNodeMaterial.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export default LineBasicNodeMaterial; -/** - * Node material version of {@link LineBasicMaterial}. - * - * @augments NodeMaterial - */ -declare class LineBasicNodeMaterial extends NodeMaterial { - /** - * Constructs a new line basic node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineBasicNodeMaterial: boolean; -} -import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts deleted file mode 100644 index 89820e463..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/LineDashedNodeMaterial.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -export default LineDashedNodeMaterial; -/** - * Node material version of {@link LineDashedMaterial}. - * - * @augments NodeMaterial - */ -declare class LineDashedNodeMaterial extends NodeMaterial { - /** - * Constructs a new line dashed node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineDashedNodeMaterial: boolean; - /** - * The dash offset. - * - * @type {number} - * @default 0 - */ - dashOffset: number; - /** - * The offset of dash materials is by default inferred from the `dashOffset` - * property. This node property allows to overwrite the default - * and define the offset with a node instead. - * - * If you don't want to overwrite the offset but modify the existing - * value instead, use {@link materialLineDashOffset}. - * - * @type {?Node} - * @default null - */ - offsetNode: Node | null; - /** - * The scale of dash materials is by default inferred from the `scale` - * property. This node property allows to overwrite the default - * and define the scale with a node instead. - * - * If you don't want to overwrite the scale but modify the existing - * value instead, use {@link materialLineScale}. - * - * @type {?Node} - * @default null - */ - dashScaleNode: Node | null; - /** - * The dash size of dash materials is by default inferred from the `dashSize` - * property. This node property allows to overwrite the default - * and define the dash size with a node instead. - * - * If you don't want to overwrite the dash size but modify the existing - * value instead, use {@link materialLineDashSize}. - * - * @type {?Node} - * @default null - */ - dashSizeNode: Node | null; - /** - * The gap size of dash materials is by default inferred from the `gapSize` - * property. This node property allows to overwrite the default - * and define the gap size with a node instead. - * - * If you don't want to overwrite the gap size but modify the existing - * value instead, use {@link materialLineGapSize}. - * - * @type {?Node} - * @default null - */ - gapSizeNode: Node | null; -} -import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts deleted file mode 100644 index 97d6b1cb4..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshBasicNodeMaterial.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export default MeshBasicNodeMaterial; -/** - * Node material version of {@link MeshBasicMaterial}. - * - * @augments NodeMaterial - */ -declare class MeshBasicNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh basic node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshBasicNodeMaterial: boolean; - /** - * Overwritten since this type of material uses {@link BasicEnvironmentNode} - * to implement the default environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?BasicEnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {BasicLightingModel} The lighting model. - */ - setupLightingModel(): BasicLightingModel; -} -import NodeMaterial from './NodeMaterial.js'; -import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; -import BasicLightingModel from '../../nodes/functions/BasicLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts deleted file mode 100644 index a5e110905..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshLambertNodeMaterial.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export default MeshLambertNodeMaterial; -/** - * Node material version of {@link MeshLambertMaterial}. - * - * @augments NodeMaterial - */ -declare class MeshLambertNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh lambert node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshLambertNodeMaterial: boolean; - /** - * Overwritten since this type of material uses {@link BasicEnvironmentNode} - * to implement the default environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?BasicEnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {PhongLightingModel} The lighting model. - */ - setupLightingModel(): PhongLightingModel; -} -import NodeMaterial from './NodeMaterial.js'; -import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; -import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts deleted file mode 100644 index 1a2d32c8c..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshMatcapNodeMaterial.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export default MeshMatcapNodeMaterial; -/** - * Node material version of {@link MeshMatcapMaterial}. - * - * @augments NodeMaterial - */ -declare class MeshMatcapNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh normal node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshMatcapNodeMaterial: boolean; - /** - * Setups the matcap specific node variables. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupVariants(builder: NodeBuilder): void; -} -import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts deleted file mode 100644 index effc5951b..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshNormalNodeMaterial.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default MeshNormalNodeMaterial; -/** - * Node material version of {@link MeshNormalMaterial}. - * - * @augments NodeMaterial - */ -declare class MeshNormalNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh normal node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshNormalNodeMaterial: boolean; - /** - * Overwrites the default implementation by computing the diffuse color - * based on the normal data. - */ - setupDiffuseColor(): void; -} -import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts deleted file mode 100644 index 374eb470a..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhongNodeMaterial.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -export default MeshPhongNodeMaterial; -/** - * Node material version of {@link MeshPhongMaterial}. - * - * @augments NodeMaterial - */ -declare class MeshPhongNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh lambert node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshPhongNodeMaterial: boolean; - /** - * The shininess of phong materials is by default inferred from the `shininess` - * property. This node property allows to overwrite the default - * and define the shininess with a node instead. - * - * If you don't want to overwrite the shininess but modify the existing - * value instead, use {@link materialShininess}. - * - * @type {?Node} - * @default null - */ - shininessNode: Node | null; - /** - * The specular color of phong materials is by default inferred from the - * `specular` property. This node property allows to overwrite the default - * and define the specular color with a node instead. - * - * If you don't want to overwrite the specular color but modify the existing - * value instead, use {@link materialSpecular}. - * - * @type {?Node} - * @default null - */ - specularNode: Node | null; - /** - * Overwritten since this type of material uses {@link BasicEnvironmentNode} - * to implement the default environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?BasicEnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): BasicEnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {PhongLightingModel} The lighting model. - */ - setupLightingModel(): PhongLightingModel; -} -import NodeMaterial from './NodeMaterial.js'; -import BasicEnvironmentNode from '../../nodes/lighting/BasicEnvironmentNode.js'; -import PhongLightingModel from '../../nodes/functions/PhongLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts deleted file mode 100644 index f5cd2ac32..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshPhysicalNodeMaterial.d.ts +++ /dev/null @@ -1,295 +0,0 @@ -export default MeshPhysicalNodeMaterial; -/** - * Node material version of {@link MeshPhysicalMaterial}. - * - * @augments MeshStandardNodeMaterial - */ -declare class MeshPhysicalNodeMaterial extends MeshStandardNodeMaterial { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshPhysicalNodeMaterial: boolean; - /** - * The clearcoat of physical materials is by default inferred from the `clearcoat` - * and `clearcoatMap` properties. This node property allows to overwrite the default - * and define the clearcoat with a node instead. - * - * If you don't want to overwrite the clearcoat but modify the existing - * value instead, use {@link materialClearcoat}. - * - * @type {?Node} - * @default null - */ - clearcoatNode: Node | null; - /** - * The clearcoat roughness of physical materials is by default inferred from the `clearcoatRoughness` - * and `clearcoatRoughnessMap` properties. This node property allows to overwrite the default - * and define the clearcoat roughness with a node instead. - * - * If you don't want to overwrite the clearcoat roughness but modify the existing - * value instead, use {@link materialClearcoatRoughness}. - * - * @type {?Node} - * @default null - */ - clearcoatRoughnessNode: Node | null; - /** - * The clearcoat normal of physical materials is by default inferred from the `clearcoatNormalMap` - * property. This node property allows to overwrite the default - * and define the clearcoat normal with a node instead. - * - * If you don't want to overwrite the clearcoat normal but modify the existing - * value instead, use {@link materialClearcoatNormal}. - * - * @type {?Node} - * @default null - */ - clearcoatNormalNode: Node | null; - /** - * The sheen of physical materials is by default inferred from the `sheen`, `sheenColor` - * and `sheenColorMap` properties. This node property allows to overwrite the default - * and define the sheen with a node instead. - * - * If you don't want to overwrite the sheen but modify the existing - * value instead, use {@link materialSheen}. - * - * @type {?Node} - * @default null - */ - sheenNode: Node | null; - /** - * The sheen roughness of physical materials is by default inferred from the `sheenRoughness` and - * `sheenRoughnessMap` properties. This node property allows to overwrite the default - * and define the sheen roughness with a node instead. - * - * If you don't want to overwrite the sheen roughness but modify the existing - * value instead, use {@link materialSheenRoughness}. - * - * @type {?Node} - * @default null - */ - sheenRoughnessNode: Node | null; - /** - * The iridescence of physical materials is by default inferred from the `iridescence` - * property. This node property allows to overwrite the default - * and define the iridescence with a node instead. - * - * If you don't want to overwrite the iridescence but modify the existing - * value instead, use {@link materialIridescence}. - * - * @type {?Node} - * @default null - */ - iridescenceNode: Node | null; - /** - * The iridescence IOR of physical materials is by default inferred from the `iridescenceIOR` - * property. This node property allows to overwrite the default - * and define the iridescence IOR with a node instead. - * - * If you don't want to overwrite the iridescence IOR but modify the existing - * value instead, use {@link materialIridescenceIOR}. - * - * @type {?Node} - * @default null - */ - iridescenceIORNode: Node | null; - /** - * The iridescence thickness of physical materials is by default inferred from the `iridescenceThicknessRange` - * and `iridescenceThicknessMap` properties. This node property allows to overwrite the default - * and define the iridescence thickness with a node instead. - * - * If you don't want to overwrite the iridescence thickness but modify the existing - * value instead, use {@link materialIridescenceThickness}. - * - * @type {?Node} - * @default null - */ - iridescenceThicknessNode: Node | null; - /** - * The specular intensity of physical materials is by default inferred from the `specularIntensity` - * and `specularIntensityMap` properties. This node property allows to overwrite the default - * and define the specular intensity with a node instead. - * - * If you don't want to overwrite the specular intensity but modify the existing - * value instead, use {@link materialSpecularIntensity}. - * - * @type {?Node} - * @default null - */ - specularIntensityNode: Node | null; - /** - * The specular color of physical materials is by default inferred from the `specularColor` - * and `specularColorMap` properties. This node property allows to overwrite the default - * and define the specular color with a node instead. - * - * If you don't want to overwrite the specular color but modify the existing - * value instead, use {@link materialSpecularColor}. - * - * @type {?Node} - * @default null - */ - specularColorNode: Node | null; - /** - * The ior of physical materials is by default inferred from the `ior` - * property. This node property allows to overwrite the default - * and define the ior with a node instead. - * - * If you don't want to overwrite the ior but modify the existing - * value instead, use {@link materialIOR}. - * - * @type {?Node} - * @default null - */ - iorNode: Node | null; - /** - * The transmission of physical materials is by default inferred from the `transmission` and - * `transmissionMap` properties. This node property allows to overwrite the default - * and define the transmission with a node instead. - * - * If you don't want to overwrite the transmission but modify the existing - * value instead, use {@link materialTransmission}. - * - * @type {?Node} - * @default null - */ - transmissionNode: Node | null; - /** - * The thickness of physical materials is by default inferred from the `thickness` and - * `thicknessMap` properties. This node property allows to overwrite the default - * and define the thickness with a node instead. - * - * If you don't want to overwrite the thickness but modify the existing - * value instead, use {@link materialThickness}. - * - * @type {?Node} - * @default null - */ - thicknessNode: Node | null; - /** - * The attenuation distance of physical materials is by default inferred from the - * `attenuationDistance` property. This node property allows to overwrite the default - * and define the attenuation distance with a node instead. - * - * If you don't want to overwrite the attenuation distance but modify the existing - * value instead, use {@link materialAttenuationDistance}. - * - * @type {?Node} - * @default null - */ - attenuationDistanceNode: Node | null; - /** - * The attenuation color of physical materials is by default inferred from the - * `attenuationColor` property. This node property allows to overwrite the default - * and define the attenuation color with a node instead. - * - * If you don't want to overwrite the attenuation color but modify the existing - * value instead, use {@link materialAttenuationColor}. - * - * @type {?Node} - * @default null - */ - attenuationColorNode: Node | null; - /** - * The dispersion of physical materials is by default inferred from the - * `dispersion` property. This node property allows to overwrite the default - * and define the dispersion with a node instead. - * - * If you don't want to overwrite the dispersion but modify the existing - * value instead, use {@link materialDispersion}. - * - * @type {?Node} - * @default null - */ - dispersionNode: Node | null; - /** - * The retroreflective strength of physical materials is by default inferred from the - * `retroreflectivity` property. This node property allows to overwrite the default - * and define the retroreflective strength with a node instead. - * - * If you don't want to overwrite the retroreflective strength but modify the existing - * value instead, use {@link materialRetroreflectivity}. - * - * @type {?Node} - * @default null - */ - retroreflectivityNode: Node | null; - /** - * The anisotropy of physical materials is by default inferred from the - * `anisotropy` property. This node property allows to overwrite the default - * and define the anisotropy with a node instead. - * - * If you don't want to overwrite the anisotropy but modify the existing - * value instead, use {@link materialAnisotropy}. - * - * @type {?Node} - * @default null - */ - anisotropyNode: Node | null; - /** - * Whether the lighting model should use clearcoat or not. - * - * @type {boolean} - * @default true - */ - get useClearcoat(): boolean; - /** - * Whether the lighting model should use iridescence or not. - * - * @type {boolean} - * @default true - */ - get useIridescence(): boolean; - /** - * Whether the lighting model should use sheen or not. - * - * @type {boolean} - * @default true - */ - get useSheen(): boolean; - /** - * Whether the lighting model should use anisotropy or not. - * - * @type {boolean} - * @default true - */ - get useAnisotropy(): boolean; - /** - * Whether the lighting model should use transmission or not. - * - * @type {boolean} - * @default true - */ - get useTransmission(): boolean; - /** - * Whether the lighting model should use dispersion or not. - * - * @type {boolean} - * @default true - */ - get useDispersion(): boolean; - /** - * Whether the lighting model should use retroreflection or not. - * - * @type {boolean} - * @default true - */ - get useRetroreflection(): boolean; - /** - * Setups the physical specific node variables. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupVariants(builder: NodeBuilder): void; - /** - * Setups the clearcoat normal node. - * - * @return {Node} The clearcoat normal. - */ - setupClearcoatNormal(): Node; - setup(builder: any): void; -} -import MeshStandardNodeMaterial from './MeshStandardNodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts deleted file mode 100644 index 29ec54604..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshSSSNodeMaterial.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -export default MeshSSSNodeMaterial; -/** - * This node material is an experimental extension of {@link MeshPhysicalNodeMaterial} - * that implements a Subsurface scattering (SSS) term. - * - * @augments MeshPhysicalNodeMaterial - */ -declare class MeshSSSNodeMaterial extends MeshPhysicalNodeMaterial { - /** - * Represents the thickness color. - * - * @type {?Node} - * @default null - */ - thicknessColorNode: Node | null; - /** - * Represents the distortion factor. - * - * @type {?Node} - */ - thicknessDistortionNode: Node | null; - /** - * Represents the thickness ambient factor. - * - * @type {?Node} - */ - thicknessAmbientNode: Node | null; - /** - * Represents the thickness attenuation. - * - * @type {?Node} - */ - thicknessAttenuationNode: Node | null; - /** - * Represents the thickness power. - * - * @type {?Node} - */ - thicknessPowerNode: Node | null; - /** - * Represents the thickness scale. - * - * @type {?Node} - */ - thicknessScaleNode: Node | null; - /** - * Whether the lighting model should use SSS or not. - * - * @type {boolean} - * @default true - */ - get useSSS(): boolean; - /** - * Setups the lighting model. - * - * @return {SSSLightingModel} The lighting model. - */ - setupLightingModel(): SSSLightingModel; -} -import MeshPhysicalNodeMaterial from './MeshPhysicalNodeMaterial.js'; -/** - * Represents the lighting model for {@link MeshSSSNodeMaterial}. - * - * @augments PhysicalLightingModel - */ -declare class SSSLightingModel extends PhysicalLightingModel { - /** - * Whether the lighting model should use SSS or not. - * - * @type {boolean} - * @default false - */ - useSSS: boolean; - /** - * Extends the default implementation with a SSS term. - * - * Reference: [Approximating Translucency for a Fast, Cheap and Convincing Subsurface Scattering Look](https://colinbarrebrisebois.com/2011/03/07/gdc-2011-approximating-translucency-for-a-fast-cheap-and-convincing-subsurface-scattering-look/) - * - * @param {Object} input - The input data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; -} -import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts deleted file mode 100644 index f81035d5a..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshStandardNodeMaterial.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -export default MeshStandardNodeMaterial; -/** - * Node material version of {@link MeshStandardMaterial}. - * - * @augments NodeMaterial - */ -declare class MeshStandardNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh standard node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshStandardNodeMaterial: boolean; - /** - * The emissive color of standard materials is by default inferred from the `emissive`, - * `emissiveIntensity` and `emissiveMap` properties. This node property allows to - * overwrite the default and define the emissive color with a node instead. - * - * If you don't want to overwrite the emissive color but modify the existing - * value instead, use {@link materialEmissive}. - * - * @type {?Node} - * @default null - */ - emissiveNode: Node | null; - /** - * The metalness of standard materials is by default inferred from the `metalness`, - * and `metalnessMap` properties. This node property allows to - * overwrite the default and define the metalness with a node instead. - * - * If you don't want to overwrite the metalness but modify the existing - * value instead, use {@link materialMetalness}. - * - * @type {?Node} - * @default null - */ - metalnessNode: Node | null; - /** - * The roughness of standard materials is by default inferred from the `roughness`, - * and `roughnessMap` properties. This node property allows to - * overwrite the default and define the roughness with a node instead. - * - * If you don't want to overwrite the roughness but modify the existing - * value instead, use {@link materialRoughness}. - * - * @type {?Node} - * @default null - */ - roughnessNode: Node | null; - /** - * Overwritten since this type of material uses {@link EnvironmentNode} - * to implement the PBR (PMREM based) environment mapping. Besides, the - * method honors `Scene.environment`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?EnvironmentNode} The environment node. - */ - setupEnvironment(builder: NodeBuilder): EnvironmentNode | null; - /** - * Setups the lighting model. - * - * @return {PhysicalLightingModel} The lighting model. - */ - setupLightingModel(): PhysicalLightingModel; - /** - * Setups the specular related node variables. - */ - setupSpecular(): void; -} -import NodeMaterial from './NodeMaterial.js'; -import EnvironmentNode from '../../nodes/lighting/EnvironmentNode.js'; -import PhysicalLightingModel from '../../nodes/functions/PhysicalLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts deleted file mode 100644 index 1ffe1bd1b..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/MeshToonNodeMaterial.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export default MeshToonNodeMaterial; -/** - * Node material version of {@link MeshToonMaterial}. - * - * @augments NodeMaterial - */ -declare class MeshToonNodeMaterial extends NodeMaterial { - /** - * Constructs a new mesh toon node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMeshToonNodeMaterial: boolean; - /** - * Setups the lighting model. - * - * @return {ToonLightingModel} The lighting model. - */ - setupLightingModel(): ToonLightingModel; -} -import NodeMaterial from './NodeMaterial.js'; -import ToonLightingModel from '../../nodes/functions/ToonLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts deleted file mode 100644 index 6389a9643..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterial.d.ts +++ /dev/null @@ -1,524 +0,0 @@ -export default NodeMaterial; -/** - * Base class for all node materials. - * - * @augments Material - */ -declare class NodeMaterial extends Material { - static get type(): string; - set type(_value: string); - /** - * Represents the type of the node material. - * - * @type {string} - */ - get type(): string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeMaterial: boolean; - /** - * Whether this material is affected by fog or not. - * - * @type {boolean} - * @default true - */ - fog: boolean; - /** - * Whether this material is affected by lights or not. - * - * @type {boolean} - * @default false - */ - lights: boolean; - /** - * Node materials which set their `lights` property to `true` - * are affected by all lights of the scene. Sometimes selective - * lighting is wanted which means only _some_ lights in the scene - * affect a material. This can be achieved by creating an instance - * of {@link LightsNode} with a list of selective - * lights and assign the node to this property. - * - * ```js - * const customLightsNode = lights( [ light1, light2 ] ); - * material.lightsNode = customLightsNode; - * ``` - * - * @type {?LightsNode} - * @default null - */ - lightsNode: LightsNode | null; - /** - * The environment of node materials can be defined by an environment - * map assigned to the `envMap` property or by `Scene.environment` - * if the node material is a PBR material. This node property allows to overwrite - * the default behavior and define the environment with a custom node. - * - * ```js - * material.envNode = pmremTexture( renderTarget.texture ); - * ``` - * - * @type {?Node} - * @default null - */ - envNode: Node | null; - /** - * The lighting of node materials might be influenced by ambient occlusion. - * The default AO is inferred from an ambient occlusion map assigned to `aoMap` - * and the respective `aoMapIntensity`. This node property allows to overwrite - * the default and define the ambient occlusion with a custom node instead. - * - * If you don't want to overwrite the diffuse color but modify the existing - * values instead, use {@link materialAO}. - * - * @type {?Node} - * @default null - */ - aoNode: Node | null; - /** - * The diffuse color of node materials is by default inferred from the - * `color` and `map` properties. This node property allows to overwrite the default - * and define the diffuse color with a node instead. - * - * ```js - * material.colorNode = color( 0xff0000 ); // define red color - * ``` - * - * If you don't want to overwrite the diffuse color but modify the existing - * values instead, use {@link materialColor}. - * - * ```js - * material.colorNode = materialColor.mul( color( 0xff0000 ) ); // give diffuse colors a red tint - * ``` - * - * @type {?Node} - * @default null - */ - colorNode: Node | null; - /** - * The normals of node materials are by default inferred from the `normalMap`/`normalScale` - * or `bumpMap`/`bumpScale` properties. This node property allows to overwrite the default - * and define the normals with a node instead. - * - * If you don't want to overwrite the normals but modify the existing values instead, - * use {@link materialNormal}. - * - * @type {?Node} - * @default null - */ - normalNode: Node | null; - /** - * The opacity of node materials is by default inferred from the `opacity` - * and `alphaMap` properties. This node property allows to overwrite the default - * and define the opacity with a node instead. - * - * If you don't want to overwrite the opacity but modify the existing - * value instead, use {@link materialOpacity}. - * - * @type {?Node} - * @default null - */ - opacityNode: Node | null; - /** - * This node can be used to implement a variety of filter-like effects. The idea is - * to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it - * to create an arbitrary effect and then assign the node composition to this property. - * Everything behind the object using this material will now be affected by a filter. - * - * ```js - * const material = new NodeMaterial() - * material.transparent = true; - * - * // everything behind the object will be monochromatic - * material.backdropNode = saturation( viewportSharedTexture().rgb, 0 ); - * ``` - * - * Backdrop computations are part of the lighting so only lit materials can use this property. - * - * @type {?Node} - * @default null - */ - backdropNode: Node | null; - /** - * This node allows to modulate the influence of `backdropNode` to the outgoing light. - * - * @type {?Node} - * @default null - */ - backdropAlphaNode: Node | null; - /** - * The alpha test of node materials is by default inferred from the `alphaTest` - * property. This node property allows to overwrite the default and define the - * alpha test with a node instead. - * - * If you don't want to overwrite the alpha test but modify the existing - * value instead, use {@link materialAlphaTest}. - * - * @type {?Node} - * @default null - */ - alphaTestNode: Node | null; - /** - * Discards the fragment if the mask value is `false`. - * - * @type {?Node} - * @default null - */ - maskNode: Node | null; - /** - * This node can be used to implement a shadow mask for the material. - * - * @type {?Node} - * @default null - */ - maskShadowNode: Node | null; - /** - * The local vertex positions are computed based on multiple factors like the - * attribute data, morphing or skinning. This node property allows to overwrite - * the default and define local vertex positions with nodes instead. - * - * If you don't want to overwrite the vertex positions but modify the existing - * values instead, use {@link positionLocal}. - * - *```js - * material.positionNode = positionLocal.add( displace ); - * ``` - * - * @type {?Node} - * @default null - */ - positionNode: Node | null; - /** - * This node property is intended for logic which modifies geometry data once or per animation step. - * Apps usually place such logic randomly in initialization routines or in the animation loop. - * `geometryNode` is intended as a dedicated API so there is an intended spot where geometry modifications - * can be implemented. - * - * The idea is to assign a `Fn` definition that holds the geometry modification logic. A typical example - * would be a GPU based particle system that provides a node material for usage on app level. The particle - * simulation would be implemented as compute shaders and managed inside a `Fn` function. This function is - * eventually assigned to `geometryNode`. - * - * @type {?Function} - * @default null - */ - geometryNode: Function | null; - /** - * Allows to overwrite depth values in the fragment shader. - * - * @type {?Node} - * @default null - */ - depthNode: Node | null; - /** - * Allows to overwrite the position used for shadow map rendering which - * is by default {@link positionWorld}, the vertex position - * in world space. - * - * @type {?Node} - * @default null - */ - receivedShadowPositionNode: Node | null; - /** - * Allows to overwrite the geometry position used for shadow map projection which - * is by default {@link positionLocal}, the vertex position in local space. - * - * @type {?Node} - * @default null - */ - castShadowPositionNode: Node | null; - /** - * This node can be used to influence how an object using this node material - * receive shadows. - * - * ```js - * const totalShadows = float( 1 ).toVar(); - * material.receivedShadowNode = Fn( ( [ shadow ] ) => { - * totalShadows.mulAssign( shadow ); - * //return float( 1 ); // bypass received shadows - * return shadow.mix( color( 0xff0000 ), 1 ); // modify shadow color - * } ); - * - * @type {?(Function|FunctionNode)} - * @default null - */ - receivedShadowNode: (Function | FunctionNode) | null; - /** - * This node can be used to influence how an object using this node material - * casts shadows. To apply a color to shadows, you can simply do: - * - * ```js - * material.castShadowNode = vec4( 1, 0, 0, 1 ); - * ``` - * - * Which can be nice to fake colored shadows of semi-transparent objects. It - * is also common to use the property with `Fn` function so checks are performed - * per fragment. - * - * ```js - * materialCustomShadow.castShadowNode = Fn( () => { - * hash( vertexIndex ).greaterThan( 0.5 ).discard(); - * return materialColor; - * } )(); - * ``` - * - * @type {?Node} - * @default null - */ - castShadowNode: Node | null; - /** - * This node can be used to overwrite the final output of the material. - * - * Unlike {@link NodeMaterial#fragmentNode}, the built-in material logic - * (diffuse color, lighting, etc.) is still evaluated; assigning a node - * only replaces the resulting output color. - * - * @type {?Node} - * @default null - */ - outputNode: Node | null; - /** - * MRT configuration is done on renderer or pass level. This node allows to - * overwrite what values are written into MRT targets on material level. This - * can be useful for implementing selective FX features that should only affect - * specific objects. - * - * @type {?MRTNode} - * @default null - */ - mrtNode: MRTNode | null; - /** - * This node property can be used if you need complete freedom in implementing - * the fragment shader. Assigning a node will replace the built-in material - * logic used in the fragment stage. - * - * @type {?Node} - * @default null - */ - fragmentNode: Node | null; - /** - * This node property can be used if you need complete freedom in implementing - * the vertex shader. Assigning a node will replace the built-in material logic - * used in the vertex stage. - * - * @type {?Node} - * @default null - */ - vertexNode: Node | null; - /** - * This node can be used as a global context management component for this material. - * - * @type {?ContextNode} - * @default null - */ - contextNode: ContextNode | null; - /** - * Returns an array of child nodes for this material. - * - * @private - * @returns {Array<{property: string, childNode: Node}>} - */ - private _getNodeChildren; - /** - * Builds this material with the given node builder. - * - * @param {NodeBuilder} builder - The current node builder. - */ - build(builder: NodeBuilder): void; - /** - * Setups a node material observer with the given builder. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {NodeMaterialObserver} The node material observer. - */ - setupObserver(builder: NodeBuilder): NodeMaterialObserver; - /** - * Setups the vertex and fragment stage of this node material. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * Setups the clipping node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {ClippingNode} The clipping node. - */ - setupClipping(builder: NodeBuilder): ClippingNode; - /** - * Setups the hardware clipping if available on the current device. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupHardwareClipping(builder: NodeBuilder): void; - /** - * Setups the depth of this material. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupDepth(builder: NodeBuilder): void; - /** - * Setups the position node in view space. This method exists - * so derived node materials can modify the implementation e.g. sprite materials. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in view space. - */ - setupPositionView(): Node; - /** - * Setups the position in clip space. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in view space. - */ - setupModelViewProjection(): Node; - /** - * Setups the logic for the vertex stage. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in clip space. - */ - setupVertex(builder: NodeBuilder): Node; - /** - * Setups the computation of the position in local space. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in local space. - */ - setupPosition(builder: NodeBuilder): Node; - /** - * Setups the computation of the material's diffuse color. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupDiffuseColor(builder: NodeBuilder): void; - /** - * Abstract interface method that can be implemented by derived materials - * to setup material-specific node variables. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - setupVariants(): void; - /** - * Setups the outgoing light node variable - * - * @return {Node} The outgoing light node. - */ - setupOutgoingLight(): Node; - /** - * Setups the normal node from the material. - * - * @return {Node} The normal node. - */ - setupNormal(): Node; - /** - * Setups the environment node from the material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The environment node. - */ - setupEnvironment(): Node; - /** - * Setups the light map node from the material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The light map node. - */ - setupLightMap(builder: NodeBuilder): Node; - /** - * Setups the lights node based on the scene, environment and material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {LightingNode} The lights node. - */ - setupMaterialLightings(builder: NodeBuilder): LightingNode; - /** - * Setups the ambient occlusion node from the material. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The ambient occlusion node. - */ - setupAmbientOcclusion(builder: NodeBuilder): Node; - /** - * This method should be implemented by most derived materials - * since it defines the material's lighting model. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - * @return {LightingModel} The lighting model. - */ - setupLightingModel(): LightingModel; - /** - * Setups the outgoing light node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The outgoing light node. - */ - setupLighting(builder: NodeBuilder): Node; - /** - * Setup the fog. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} outputNode - The existing output node. - * @return {Node} The output node. - */ - setupFog(builder: NodeBuilder, outputNode: Node): Node; - /** - * Setups premultiplied alpha. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} outputNode - The existing output node. - * @return {Node} The output node. - */ - setupPremultipliedAlpha(builder: NodeBuilder, outputNode: Node): Node; - /** - * Setups the output node. - * - * This method can be implemented by derived materials to extend the functionality - * of the material's output or replace it altogether. - * - * ```js - * class ColoredShadowMaterial extends MeshPhongNodeMaterial { - * constructor( parameters ) { - * super( parameters ); - * this._shadeColor = uniform( new Color( parameters.shadeColor ?? 0xff0000 ) ); - * } - * - * setupOutput( builder, outputNode ) { - * // Modify the native output of the MeshPhongNodeMaterial fragment shader - * const brightness = min( outputNode.r, 1.0 ); - * const mixedColor = mix( this._shadeColor, diffuseColor.rgb, brightness ); - * // Return new output back into NodeMaterial flow - * return super.setupOutput( builder, vec4( mixedColor, outputNode.a ) ); - * } - * } - * ``` - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} outputNode - The existing output node. - * @return {Node} The output node. - */ - setupOutput(builder: NodeBuilder, outputNode: Node): Node; - /** - * Most classic material types have a node pendant e.g. for `MeshBasicMaterial` - * there is `MeshBasicNodeMaterial`. This utility method is intended for - * defining all material properties of the classic type in the node type. - * - * @param {Material} material - The material to copy properties with their values to this node material. - */ - setDefaultValues(material: Material): void; - /** - * Copies the common properties of the given material to this instance. - * - * @param {Material} source - The material to copy. - * @return {NodeMaterial} A reference to this node material. - */ - copy(source: Material): NodeMaterial; -} -import { Material } from '../Material.js'; -import NodeMaterialObserver from './manager/NodeMaterialObserver.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts deleted file mode 100644 index 3ab3141d1..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/NodeMaterials.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export { default as NodeMaterialObserver } from "./manager/NodeMaterialObserver.js"; -export { default as NodeMaterial } from "./NodeMaterial.js"; -export { default as LineBasicNodeMaterial } from "./LineBasicNodeMaterial.js"; -export { default as LineDashedNodeMaterial } from "./LineDashedNodeMaterial.js"; -export { default as Line2NodeMaterial } from "./Line2NodeMaterial.js"; -export { default as MeshNormalNodeMaterial } from "./MeshNormalNodeMaterial.js"; -export { default as MeshBasicNodeMaterial } from "./MeshBasicNodeMaterial.js"; -export { default as MeshLambertNodeMaterial } from "./MeshLambertNodeMaterial.js"; -export { default as MeshPhongNodeMaterial } from "./MeshPhongNodeMaterial.js"; -export { default as MeshStandardNodeMaterial } from "./MeshStandardNodeMaterial.js"; -export { default as MeshPhysicalNodeMaterial } from "./MeshPhysicalNodeMaterial.js"; -export { default as MeshSSSNodeMaterial } from "./MeshSSSNodeMaterial.js"; -export { default as MeshToonNodeMaterial } from "./MeshToonNodeMaterial.js"; -export { default as MeshMatcapNodeMaterial } from "./MeshMatcapNodeMaterial.js"; -export { default as PointsNodeMaterial } from "./PointsNodeMaterial.js"; -export { default as SpriteNodeMaterial } from "./SpriteNodeMaterial.js"; -export { default as ShadowNodeMaterial } from "./ShadowNodeMaterial.js"; -export { default as VolumeNodeMaterial } from "./VolumeNodeMaterial.js"; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts deleted file mode 100644 index 1a6e48eef..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/PointsNodeMaterial.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export default PointsNodeMaterial; -/** - * Node material version of {@link PointsMaterial}. - * - * This material can be used in two ways: - * - * - By rendering point primitives with {@link Points}. Since WebGPU only supports point primitives - * with a pixel size of `1`, it's not possible to define a size. - * - * ```js - * const pointCloud = new THREE.Points( geometry, new THREE.PointsNodeMaterial() ); - * ``` - * - * - By rendering point primitives with {@link Sprites}. In this case, size is honored, - * see {@link PointsNodeMaterial#sizeNode}. - * - * ```js - * const instancedPoints = new THREE.Sprite( new THREE.PointsNodeMaterial( { positionNode: instancedBufferAttribute( positionAttribute ) } ) ); - * ``` - * - * @augments SpriteNodeMaterial - */ -declare class PointsNodeMaterial extends SpriteNodeMaterial { - /** - * This node property provides an additional way to set the point size. - * - * Note that WebGPU only supports point primitives with 1 pixel size. Consequently, - * this node has no effect when the material is used with {@link Points} and a WebGPU - * backend. If an application wants to render points with a size larger than 1 pixel, - * the material should be used with {@link Sprite} and instancing. - * - * @type {?Node} - * @default null - */ - sizeNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPointsNodeMaterial: boolean; - setupPositionView(): any; - setupVertexSprite(builder: any): any; - setupVertex(builder: any): any; - _useAlphaToCoverage: any; -} -import SpriteNodeMaterial from './SpriteNodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts deleted file mode 100644 index edf904684..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/ShadowNodeMaterial.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export default ShadowNodeMaterial; -/** - * Node material version of {@link ShadowMaterial}. - * - * @augments NodeMaterial - */ -declare class ShadowNodeMaterial extends NodeMaterial { - /** - * Constructs a new shadow node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowNodeMaterial: boolean; - /** - * Setups the lighting model. - * - * @return {ShadowMaskModel} The lighting model. - */ - setupLightingModel(): ShadowMaskModel; -} -import NodeMaterial from './NodeMaterial.js'; -import ShadowMaskModel from '../../nodes/functions/ShadowMaskModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts deleted file mode 100644 index 491e32e08..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/SpriteNodeMaterial.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -export default SpriteNodeMaterial; -/** - * Node material version of {@link SpriteMaterial}. - * - * @augments NodeMaterial - */ -declare class SpriteNodeMaterial extends NodeMaterial { - /** - * Constructs a new sprite node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSpriteNodeMaterial: boolean; - _useSizeAttenuation: boolean; - /** - * The rotation of sprite materials is by default inferred from the `rotation`, - * property. This node property allows to overwrite the default and define - * the rotation with a node instead. - * - * If you don't want to overwrite the rotation but modify the existing - * value instead, use {@link materialRotation}. - * - * @type {?Node} - * @default null - */ - rotationNode: Node | null; - /** - * This node property provides an additional way to scale sprites next to - * `Object3D.scale`. The scale transformation based in `Object3D.scale` - * is multiplied with the scale value of this node in the vertex shader. - * - * @type {?Node} - * @default null - */ - scaleNode: Node | null; - /** - * Setups the position node in view space. This method implements - * the sprite specific vertex shader. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The position in view space. - */ - setupPositionView(builder: NodeBuilder): Node; - set sizeAttenuation(value: boolean); - /** - * Whether to use size attenuation or not. - * - * @type {boolean} - * @default true - */ - get sizeAttenuation(): boolean; -} -import NodeMaterial from './NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts deleted file mode 100644 index 8b5885c3c..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/VolumeNodeMaterial.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -export default VolumeNodeMaterial; -/** - * Volume node material. - * - * @augments NodeMaterial - */ -declare class VolumeNodeMaterial extends NodeMaterial { - /** - * Constructs a new volume node material. - * - * @param {Object} [parameters] - The configuration parameter. - */ - constructor(parameters?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVolumeNodeMaterial: boolean; - /** - * Number of steps used for raymarching. - * - * @type {number} - * @default 25 - */ - steps: number; - /** - * Offsets the distance a ray has been traveled through a volume. - * Can be used to implement dithering to reduce banding. - * - * @type {Node} - * @default null - */ - offsetNode: Node; - /** - * Node used for scattering calculations. - * - * @type {Function|FunctionNode} - * @default null - */ - scatteringNode: Function | FunctionNode; - side: number; - setupLightingModel(): VolumetricLightingModel; -} -import NodeMaterial from './NodeMaterial.js'; -import VolumetricLightingModel from '../../nodes/functions/VolumetricLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts b/jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts deleted file mode 100644 index 3f21040e0..000000000 --- a/jsdoc-testing/jsdoc/src/materials/nodes/manager/NodeMaterialObserver.d.ts +++ /dev/null @@ -1,147 +0,0 @@ -export default NodeMaterialObserver; -/** - * This class is used by {@link WebGPURenderer} as management component. - * It's primary purpose is to determine whether render objects require a - * refresh right before they are going to be rendered or not. - */ -declare class NodeMaterialObserver { - /** - * Constructs a new node material observer. - * - * @param {NodeBuilder} builder - The node builder. - */ - constructor(builder: NodeBuilder); - /** - * A node material can be used by more than one render object so the - * monitor must maintain a list of render objects. - * - * @type {WeakMap} - */ - renderObjects: WeakMap; - /** - * Whether the material uses node objects or not. - * - * @type {boolean} - */ - hasNode: boolean; - /** - * Whether the node builder's 3D object is animated or not. - * - * @type {boolean} - */ - hasAnimation: boolean; - /** - * A list of all possible material uniforms - * - * @type {Array} - */ - refreshUniforms: Array; - /** - * Holds the current render ID from the node frame. - * - * @type {number} - * @default 0 - */ - renderId: number; - /** - * Returns `true` if the given render object is verified for the first time of this observer. - * - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the given render object is verified for the first time of this observer. - */ - firstInitialization(renderObject: RenderObject): boolean; - /** - * Returns `true` if the given 3D object uses instance buffers with dynamic draw usage. - * Such buffers must be uploaded once per render so the render object requires a full refresh. - * - * @param {Object3D} object - The 3D object. - * @return {boolean} Whether the given 3D object uses instance buffers with dynamic draw usage or not. - */ - hasDynamicInstancing(object: Object3D): boolean; - /** - * Returns `true` if the current rendering produces motion vectors. - * - * @param {Renderer} renderer - The renderer. - * @return {boolean} Whether the current rendering produces motion vectors or not. - */ - needsVelocity(renderer: Renderer): boolean; - /** - * Returns monitoring data for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {Object} The monitoring data. - */ - getRenderObjectData(renderObject: RenderObject): Object; - /** - * Returns an attribute data structure holding the attributes versions for - * monitoring. - * - * @param {Object} attributes - The geometry attributes. - * @return {Object} An object for monitoring the versions of attributes. - */ - getAttributesData(attributes: Object): Object; - /** - * Returns `true` if the node builder's material uses - * node properties. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether the node builder's material uses node properties or not. - */ - containsNode(builder: NodeBuilder): boolean; - /** - * Returns a geometry data structure holding the geometry property values for - * monitoring. - * - * @param {BufferGeometry} geometry - The geometry. - * @return {Object} An object for monitoring geometry properties. - */ - getGeometryData(geometry: BufferGeometry): Object; - /** - * Returns a texture data structure holding the texture state for - * monitoring. - * - * @param {Texture} texture - The texture. - * @return {Object} An object for monitoring the texture. - */ - getTextureData(texture: Texture): Object; - /** - * Returns a material data structure holding the material property values for - * monitoring. - * - * @param {Material} material - The material. - * @return {Object} An object for monitoring material properties. - */ - getMaterialData(material: Material): Object; - /** - * Returns `true` if the given render object has not changed its state. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} lightsData - The current material lights. - * @param {number} renderId - The current render ID. - * @return {boolean} Whether the given render object is equal to its cached state or not. - */ - equals(renderObject: RenderObject, lightsData: Array, renderId: number): boolean; - /** - * Returns the lights data for the given material lights. - * - * @param {Array} materialLights - The material lights. - * @return {Array} The lights data for the given material lights. - */ - getLightsData(materialLights: Array, lights: any): Array; - /** - * Returns the lights for the given lights node and render ID. - * - * @param {LightsNode} lightsNode - The lights node. - * @param {number} renderId - The render ID. - * @return {Array} The lights for the given lights node and render ID. - */ - getLights(lightsNode: LightsNode, renderId: number): Array; - /** - * Checks if the given render object requires a refresh. - * - * @param {RenderObject} renderObject - The render object. - * @param {NodeFrame} nodeFrame - The current node frame. - * @return {number} The refresh type, see {@link RenderObjectRefreshType}. - */ - needsRefresh(renderObject: RenderObject, nodeFrame: NodeFrame): number; -} diff --git a/jsdoc-testing/jsdoc/src/math/Box2.d.ts b/jsdoc-testing/jsdoc/src/math/Box2.d.ts deleted file mode 100644 index cc99e0f2f..000000000 --- a/jsdoc-testing/jsdoc/src/math/Box2.d.ts +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Represents an axis-aligned bounding box (AABB) in 2D space. - */ -export class Box2 { - /** - * Constructs a new bounding box. - * - * @param {Vector2} [min=(Infinity,Infinity)] - A vector representing the lower boundary of the box. - * @param {Vector2} [max=(-Infinity,-Infinity)] - A vector representing the upper boundary of the box. - */ - constructor(min?: Vector2, max?: Vector2); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBox2: boolean; - /** - * The lower boundary of the box. - * - * @type {Vector2} - */ - min: Vector2; - /** - * The upper boundary of the box. - * - * @type {Vector2} - */ - max: Vector2; - /** - * Sets the lower and upper boundaries of this box. - * Please note that this method only copies the values from the given objects. - * - * @param {Vector2} min - The lower boundary of the box. - * @param {Vector2} max - The upper boundary of the box. - * @return {Box2} A reference to this bounding box. - */ - set(min: Vector2, max: Vector2): Box2; - /** - * Sets the upper and lower bounds of this box so it encloses the position data - * in the given array. - * - * @param {Array} points - An array holding 2D position data as instances of {@link Vector2}. - * @return {Box2} A reference to this bounding box. - */ - setFromPoints(points: Array): Box2; - /** - * Centers this box on the given center vector and sets this box's width, height and - * depth to the given size values. - * - * @param {Vector2} center - The center of the box. - * @param {Vector2} size - The x and y dimensions of the box. - * @return {Box2} A reference to this bounding box. - */ - setFromCenterAndSize(center: Vector2, size: Vector2): Box2; - /** - * Returns a new box with copied values from this instance. - * - * @return {Box2} A clone of this instance. - */ - clone(): Box2; - /** - * Copies the values of the given box to this instance. - * - * @param {Box2} box - The box to copy. - * @return {Box2} A reference to this bounding box. - */ - copy(box: Box2): Box2; - /** - * Makes this box empty which means in encloses a zero space in 2D. - * - * @return {Box2} A reference to this bounding box. - */ - makeEmpty(): Box2; - /** - * Returns true if this box includes zero points within its bounds. - * Note that a box with equal lower and upper bounds still includes one - * point, the one both bounds share. - * - * @return {boolean} Whether this box is empty or not. - */ - isEmpty(): boolean; - /** - * Returns the center point of this box. - * - * @param {Vector2} target - The target vector that is used to store the method's result. - * @return {Vector2} The center point. - */ - getCenter(target: Vector2): Vector2; - /** - * Returns the dimensions of this box. - * - * @param {Vector2} target - The target vector that is used to store the method's result. - * @return {Vector2} The size. - */ - getSize(target: Vector2): Vector2; - /** - * Expands the boundaries of this box to include the given point. - * - * @param {Vector2} point - The point that should be included by the bounding box. - * @return {Box2} A reference to this bounding box. - */ - expandByPoint(point: Vector2): Box2; - /** - * Expands this box equilaterally by the given vector. The width of this - * box will be expanded by the x component of the vector in both - * directions. The height of this box will be expanded by the y component of - * the vector in both directions. - * - * @param {Vector2} vector - The vector that should expand the bounding box. - * @return {Box2} A reference to this bounding box. - */ - expandByVector(vector: Vector2): Box2; - /** - * Expands each dimension of the box by the given scalar. If negative, the - * dimensions of the box will be contracted. - * - * @param {number} scalar - The scalar value that should expand the bounding box. - * @return {Box2} A reference to this bounding box. - */ - expandByScalar(scalar: number): Box2; - /** - * Returns `true` if the given point lies within or on the boundaries of this box. - * - * @param {Vector2} point - The point to test. - * @return {boolean} Whether the bounding box contains the given point or not. - */ - containsPoint(point: Vector2): boolean; - /** - * Returns `true` if this bounding box includes the entirety of the given bounding box. - * If this box and the given one are identical, this function also returns `true`. - * - * @param {Box2} box - The bounding box to test. - * @return {boolean} Whether the bounding box contains the given bounding box or not. - */ - containsBox(box: Box2): boolean; - /** - * Returns a point as a proportion of this box's width and height. - * - * @param {Vector2} point - A point in 2D space. - * @param {Vector2} target - The target vector that is used to store the method's result. - * @return {Vector2} A point as a proportion of this box's width and height. - */ - getParameter(point: Vector2, target: Vector2): Vector2; - /** - * Returns `true` if the given bounding box intersects with this bounding box. - * - * @param {Box2} box - The bounding box to test. - * @return {boolean} Whether the given bounding box intersects with this bounding box. - */ - intersectsBox(box: Box2): boolean; - /** - * Clamps the given point within the bounds of this box. - * - * @param {Vector2} point - The point to clamp. - * @param {Vector2} target - The target vector that is used to store the method's result. - * @return {Vector2} The clamped point. - */ - clampPoint(point: Vector2, target: Vector2): Vector2; - /** - * Returns the euclidean distance from any edge of this box to the specified point. If - * the given point lies inside of this box, the distance will be `0`. - * - * @param {Vector2} point - The point to compute the distance to. - * @return {number} The euclidean distance. - */ - distanceToPoint(point: Vector2): number; - /** - * Computes the intersection of this bounding box and the given one, setting the upper - * bound of this box to the lesser of the two boxes' upper bounds and the - * lower bound of this box to the greater of the two boxes' lower bounds. If - * there's no overlap, makes this box empty. - * - * @param {Box2} box - The bounding box to intersect with. - * @return {Box2} A reference to this bounding box. - */ - intersect(box: Box2): Box2; - /** - * Computes the union of this box and another and the given one, setting the upper - * bound of this box to the greater of the two boxes' upper bounds and the - * lower bound of this box to the lesser of the two boxes' lower bounds. - * - * @param {Box2} box - The bounding box that will be unioned with this instance. - * @return {Box2} A reference to this bounding box. - */ - union(box: Box2): Box2; - /** - * Adds the given offset to both the upper and lower bounds of this bounding box, - * effectively moving it in 2D space. - * - * @param {Vector2} offset - The offset that should be used to translate the bounding box. - * @return {Box2} A reference to this bounding box. - */ - translate(offset: Vector2): Box2; - /** - * Returns `true` if this bounding box is equal with the given one. - * - * @param {Box2} box - The box to test for equality. - * @return {boolean} Whether this bounding box is equal with the given one. - */ - equals(box: Box2): boolean; -} -import { Vector2 } from './Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Box3.d.ts b/jsdoc-testing/jsdoc/src/math/Box3.d.ts deleted file mode 100644 index b1c152106..000000000 --- a/jsdoc-testing/jsdoc/src/math/Box3.d.ts +++ /dev/null @@ -1,298 +0,0 @@ -/** - * Represents an axis-aligned bounding box (AABB) in 3D space. - */ -export class Box3 { - /** - * Constructs a new bounding box. - * - * @param {Vector3} [min=(Infinity,Infinity,Infinity)] - A vector representing the lower boundary of the box. - * @param {Vector3} [max=(-Infinity,-Infinity,-Infinity)] - A vector representing the upper boundary of the box. - */ - constructor(min?: Vector3, max?: Vector3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBox3: boolean; - /** - * The lower boundary of the box. - * - * @type {Vector3} - */ - min: Vector3; - /** - * The upper boundary of the box. - * - * @type {Vector3} - */ - max: Vector3; - /** - * Sets the lower and upper boundaries of this box. - * Please note that this method only copies the values from the given objects. - * - * @param {Vector3} min - The lower boundary of the box. - * @param {Vector3} max - The upper boundary of the box. - * @return {Box3} A reference to this bounding box. - */ - set(min: Vector3, max: Vector3): Box3; - /** - * Sets the upper and lower bounds of this box so it encloses the position data - * in the given array. - * - * @param {Array} array - An array holding 3D position data. - * @return {Box3} A reference to this bounding box. - */ - setFromArray(array: Array): Box3; - /** - * Sets the upper and lower bounds of this box so it encloses the position data - * in the given buffer attribute. - * - * @param {BufferAttribute} attribute - A buffer attribute holding 3D position data. - * @return {Box3} A reference to this bounding box. - */ - setFromBufferAttribute(attribute: BufferAttribute): Box3; - /** - * Sets the upper and lower bounds of this box so it encloses the position data - * in the given array. - * - * @param {Array} points - An array holding 3D position data as instances of {@link Vector3}. - * @return {Box3} A reference to this bounding box. - */ - setFromPoints(points: Array): Box3; - /** - * Centers this box on the given center vector and sets this box's width, height and - * depth to the given size values. - * - * @param {Vector3} center - The center of the box. - * @param {Vector3} size - The x, y and z dimensions of the box. - * @return {Box3} A reference to this bounding box. - */ - setFromCenterAndSize(center: Vector3, size: Vector3): Box3; - /** - * Computes the world-axis-aligned bounding box for the given 3D object - * (including its children), accounting for the object's, and children's, - * world transforms. The function may result in a larger box than strictly necessary. - * - * Note: To compute the correct bounding box, make sure the given 3D object - * has an up-to-date world matrix that reflects the current transformation of its - * ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if - * you're unsure. - * - * @param {Object3D} object - The 3D object to compute the bounding box for. - * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest - * world-axis-aligned bounding box at the expense of more computation. - * @return {Box3} A reference to this bounding box. - */ - setFromObject(object: Object3D, precise?: boolean): Box3; - /** - * Returns a new box with copied values from this instance. - * - * @return {Box3} A clone of this instance. - */ - clone(): Box3; - /** - * Copies the values of the given box to this instance. - * - * @param {Box3} box - The box to copy. - * @return {Box3} A reference to this bounding box. - */ - copy(box: Box3): Box3; - /** - * Makes this box empty which means in encloses a zero space in 3D. - * - * @return {Box3} A reference to this bounding box. - */ - makeEmpty(): Box3; - /** - * Returns true if this box includes zero points within its bounds. - * Note that a box with equal lower and upper bounds still includes one - * point, the one both bounds share. - * - * @return {boolean} Whether this box is empty or not. - */ - isEmpty(): boolean; - /** - * Returns the center point of this box. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The center point. - */ - getCenter(target: Vector3): Vector3; - /** - * Returns the dimensions of this box. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The size. - */ - getSize(target: Vector3): Vector3; - /** - * Expands the boundaries of this box to include the given point. - * - * @param {Vector3} point - The point that should be included by the bounding box. - * @return {Box3} A reference to this bounding box. - */ - expandByPoint(point: Vector3): Box3; - /** - * Expands this box equilaterally by the given vector. The width of this - * box will be expanded by the x component of the vector in both - * directions. The height of this box will be expanded by the y component of - * the vector in both directions. The depth of this box will be - * expanded by the z component of the vector in both directions. - * - * @param {Vector3} vector - The vector that should expand the bounding box. - * @return {Box3} A reference to this bounding box. - */ - expandByVector(vector: Vector3): Box3; - /** - * Expands each dimension of the box by the given scalar. If negative, the - * dimensions of the box will be contracted. - * - * @param {number} scalar - The scalar value that should expand the bounding box. - * @return {Box3} A reference to this bounding box. - */ - expandByScalar(scalar: number): Box3; - /** - * Expands the boundaries of this box to include the given 3D object and - * its children, accounting for the object's, and children's, world - * transforms. The function may result in a larger box than strictly - * necessary (unless the precise parameter is set to true). - * - * @param {Object3D} object - The 3D object that should expand the bounding box. - * @param {boolean} precise - If set to `true`, the method expands the bounding box - * as little as necessary at the expense of more computation. - * @return {Box3} A reference to this bounding box. - */ - expandByObject(object: Object3D, precise?: boolean): Box3; - /** - * Returns `true` if the given point lies within or on the boundaries of this box. - * - * @param {Vector3} point - The point to test. - * @return {boolean} Whether the bounding box contains the given point or not. - */ - containsPoint(point: Vector3): boolean; - /** - * Returns `true` if this bounding box includes the entirety of the given bounding box. - * If this box and the given one are identical, this function also returns `true`. - * - * @param {Box3} box - The bounding box to test. - * @return {boolean} Whether the bounding box contains the given bounding box or not. - */ - containsBox(box: Box3): boolean; - /** - * Returns a point as a proportion of this box's width, height and depth. - * - * @param {Vector3} point - A point in 3D space. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} A point as a proportion of this box's width, height and depth. - */ - getParameter(point: Vector3, target: Vector3): Vector3; - /** - * Returns `true` if the given bounding box intersects with this bounding box. - * - * @param {Box3} box - The bounding box to test. - * @return {boolean} Whether the given bounding box intersects with this bounding box. - */ - intersectsBox(box: Box3): boolean; - /** - * Returns `true` if the given bounding sphere intersects with this bounding box. - * - * @param {Sphere} sphere - The bounding sphere to test. - * @return {boolean} Whether the given bounding sphere intersects with this bounding box. - */ - intersectsSphere(sphere: Sphere): boolean; - /** - * Returns `true` if the given plane intersects with this bounding box. - * - * @param {Plane} plane - The plane to test. - * @return {boolean} Whether the given plane intersects with this bounding box. - */ - intersectsPlane(plane: Plane): boolean; - /** - * Returns `true` if the given triangle intersects with this bounding box. - * - * @param {Triangle} triangle - The triangle to test. - * @return {boolean} Whether the given triangle intersects with this bounding box. - */ - intersectsTriangle(triangle: Triangle): boolean; - /** - * Clamps the given point within the bounds of this box. - * - * @param {Vector3} point - The point to clamp. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The clamped point. - */ - clampPoint(point: Vector3, target: Vector3): Vector3; - /** - * Returns the euclidean distance from any edge of this box to the specified point. If - * the given point lies inside of this box, the distance will be `0`. - * - * @param {Vector3} point - The point to compute the distance to. - * @return {number} The euclidean distance. - */ - distanceToPoint(point: Vector3): number; - /** - * Returns a bounding sphere that encloses this bounding box. - * - * @param {Sphere} target - The target sphere that is used to store the method's result. - * @return {Sphere} The bounding sphere that encloses this bounding box. - */ - getBoundingSphere(target: Sphere): Sphere; - /** - * Computes the intersection of this bounding box and the given one, setting the upper - * bound of this box to the lesser of the two boxes' upper bounds and the - * lower bound of this box to the greater of the two boxes' lower bounds. If - * there's no overlap, makes this box empty. - * - * @param {Box3} box - The bounding box to intersect with. - * @return {Box3} A reference to this bounding box. - */ - intersect(box: Box3): Box3; - /** - * Computes the union of this box and another and the given one, setting the upper - * bound of this box to the greater of the two boxes' upper bounds and the - * lower bound of this box to the lesser of the two boxes' lower bounds. - * - * @param {Box3} box - The bounding box that will be unioned with this instance. - * @return {Box3} A reference to this bounding box. - */ - union(box: Box3): Box3; - /** - * Transforms this bounding box by the given 4x4 transformation matrix. - * - * @param {Matrix4} matrix - The transformation matrix. - * @return {Box3} A reference to this bounding box. - */ - applyMatrix4(matrix: Matrix4): Box3; - /** - * Adds the given offset to both the upper and lower bounds of this bounding box, - * effectively moving it in 3D space. - * - * @param {Vector3} offset - The offset that should be used to translate the bounding box. - * @return {Box3} A reference to this bounding box. - */ - translate(offset: Vector3): Box3; - /** - * Returns `true` if this bounding box is equal with the given one. - * - * @param {Box3} box - The box to test for equality. - * @return {boolean} Whether this bounding box is equal with the given one. - */ - equals(box: Box3): boolean; - /** - * Returns a serialized structure of the bounding box. - * - * @return {Object} Serialized structure with fields representing the object state. - */ - toJSON(): Object; - /** - * Returns a serialized structure of the bounding box. - * - * @param {Object} json - The serialized json to set the box from. - * @return {Box3} A reference to this bounding box. - */ - fromJSON(json: Object): Box3; -} -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Color.d.ts b/jsdoc-testing/jsdoc/src/math/Color.d.ts deleted file mode 100644 index 88445d822..000000000 --- a/jsdoc-testing/jsdoc/src/math/Color.d.ts +++ /dev/null @@ -1,538 +0,0 @@ -/** - * A Color instance is represented by RGB components in the linear working - * color space, which defaults to `LinearSRGBColorSpace`. Inputs - * conventionally using `SRGBColorSpace` (such as hexadecimals and CSS - * strings) are converted to the working color space automatically. - * - * ```js - * // converted automatically from SRGBColorSpace to LinearSRGBColorSpace - * const color = new THREE.Color().setHex( 0x112233 ); - * ``` - * Source color spaces may be specified explicitly, to ensure correct conversions. - * ```js - * // assumed already LinearSRGBColorSpace; no conversion - * const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5 ); - * - * // converted explicitly from SRGBColorSpace to LinearSRGBColorSpace - * const color = new THREE.Color().setRGB( 0.5, 0.5, 0.5, SRGBColorSpace ); - * ``` - * If THREE.ColorManagement is disabled, no conversions occur. For details, - * see Color management. Iterating through a Color instance will yield - * its components (r, g, b) in the corresponding order. A Color can be initialised - * in any of the following ways: - * ```js - * //empty constructor - will default white - * const color1 = new THREE.Color(); - * - * //Hexadecimal color (recommended) - * const color2 = new THREE.Color( 0xff0000 ); - * - * //RGB string - * const color3 = new THREE.Color("rgb(255, 0, 0)"); - * const color4 = new THREE.Color("rgb(100%, 0%, 0%)"); - * - * //X11 color name - all 140 color names are supported. - * //Note the lack of CamelCase in the name - * const color5 = new THREE.Color( 'skyblue' ); - * //HSL string - * const color6 = new THREE.Color("hsl(0, 100%, 50%)"); - * - * //Separate RGB values between 0 and 1 - * const color7 = new THREE.Color( 1, 0, 0 ); - * ``` - */ -export class Color { - /** - * Constructs a new color. - * - * Note that standard method of specifying color in three.js is with a hexadecimal triplet, - * and that method is used throughout the rest of the documentation. - * - * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are - * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance. - * @param {number} [g] - The green component. - * @param {number} [b] - The blue component. - */ - constructor(r?: (number | string | Color), g?: number, b?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isColor: boolean; - /** - * The red component. - * - * @type {number} - * @default 1 - */ - r: number; - /** - * The green component. - * - * @type {number} - * @default 1 - */ - g: number; - /** - * The blue component. - * - * @type {number} - * @default 1 - */ - b: number; - /** - * Sets the colors's components from the given values. - * - * @param {(number|string|Color)} [r] - The red component of the color. If `g` and `b` are - * not provided, it can be hexadecimal triplet, a CSS-style string or another `Color` instance. - * @param {number} [g] - The green component. - * @param {number} [b] - The blue component. - * @return {Color} A reference to this color. - */ - set(r?: (number | string | Color), g?: number, b?: number): Color; - /** - * Sets the colors's components to the given scalar value. - * - * @param {number} scalar - The scalar value. - * @return {Color} A reference to this color. - */ - setScalar(scalar: number): Color; - /** - * Sets this color from a hexadecimal value. - * - * @param {number} hex - The hexadecimal value. - * @param {string} [colorSpace=SRGBColorSpace] - The color space. - * @return {Color} A reference to this color. - */ - setHex(hex: number, colorSpace?: string): Color; - /** - * Sets this color from RGB values. - * - * @param {number} r - Red channel value between `0.0` and `1.0`. - * @param {number} g - Green channel value between `0.0` and `1.0`. - * @param {number} b - Blue channel value between `0.0` and `1.0`. - * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. - * @return {Color} A reference to this color. - */ - setRGB(r: number, g: number, b: number, colorSpace?: string): Color; - /** - * Sets this color from RGB values. - * - * @param {number} h - Hue value between `0.0` and `1.0`. - * @param {number} s - Saturation value between `0.0` and `1.0`. - * @param {number} l - Lightness value between `0.0` and `1.0`. - * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. - * @return {Color} A reference to this color. - */ - setHSL(h: number, s: number, l: number, colorSpace?: string): Color; - /** - * Sets this color from a CSS-style string. For example, `rgb(250, 0,0)`, - * `rgb(100%, 0%, 0%)`, `hsl(0, 100%, 50%)`, `#ff0000`, `#f00`, or `red` ( or - * any [X11 color name](https://en.wikipedia.org/wiki/X11_color_names#Color_name_chart) - - * all 140 color names are supported). - * - * @param {string} style - Color as a CSS-style string. - * @param {string} [colorSpace=SRGBColorSpace] - The color space. - * @return {Color} A reference to this color. - */ - setStyle(style: string, colorSpace?: string): Color; - /** - * Sets this color from a color name. Faster than {@link Color#setStyle} if - * you don't need the other CSS-style formats. - * - * For convenience, the list of names is exposed in `Color.NAMES` as a hash. - * ```js - * Color.NAMES.aliceblue // returns 0xF0F8FF - * ``` - * - * @param {string} style - The color name. - * @param {string} [colorSpace=SRGBColorSpace] - The color space. - * @return {Color} A reference to this color. - */ - setColorName(style: string, colorSpace?: string): Color; - /** - * Returns a new color with copied values from this instance. - * - * @return {Color} A clone of this instance. - */ - clone(): Color; - /** - * Copies the values of the given color to this instance. - * - * @param {Color} color - The color to copy. - * @return {Color} A reference to this color. - */ - copy(color: Color): Color; - /** - * Copies the given color into this color, and then converts this color from - * `SRGBColorSpace` to `LinearSRGBColorSpace`. - * - * @param {Color} color - The color to copy/convert. - * @return {Color} A reference to this color. - */ - copySRGBToLinear(color: Color): Color; - /** - * Copies the given color into this color, and then converts this color from - * `LinearSRGBColorSpace` to `SRGBColorSpace`. - * - * @param {Color} color - The color to copy/convert. - * @return {Color} A reference to this color. - */ - copyLinearToSRGB(color: Color): Color; - /** - * Converts this color from `SRGBColorSpace` to `LinearSRGBColorSpace`. - * - * @return {Color} A reference to this color. - */ - convertSRGBToLinear(): Color; - /** - * Converts this color from `LinearSRGBColorSpace` to `SRGBColorSpace`. - * - * @return {Color} A reference to this color. - */ - convertLinearToSRGB(): Color; - /** - * Returns the hexadecimal value of this color. - * - * @param {string} [colorSpace=SRGBColorSpace] - The color space. - * @return {number} The hexadecimal value. - */ - getHex(colorSpace?: string): number; - /** - * Returns the hexadecimal value of this color as a string (for example, 'FFFFFF'). - * - * @param {string} [colorSpace=SRGBColorSpace] - The color space. - * @return {string} The hexadecimal value as a string. - */ - getHexString(colorSpace?: string): string; - /** - * Converts the colors RGB values into the HSL format and stores them into the - * given target object. - * - * @param {{h:number,s:number,l:number}} target - The target object that is used to store the method's result. - * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. - * @return {{h:number,s:number,l:number}} The HSL representation of this color. - */ - getHSL(target: { - h: number; - s: number; - l: number; - }, colorSpace?: string): { - h: number; - s: number; - l: number; - }; - /** - * Returns the RGB values of this color and stores them into the given target object. - * - * @param {Color} target - The target color that is used to store the method's result. - * @param {string} [colorSpace=ColorManagement.workingColorSpace] - The color space. - * @return {Color} The RGB representation of this color. - */ - getRGB(target: Color, colorSpace?: string): Color; - /** - * Returns the value of this color as a CSS style string. Example: `rgb(255,0,0)`. - * - * @param {string} [colorSpace=SRGBColorSpace] - The color space. - * @return {string} The CSS representation of this color. - */ - getStyle(colorSpace?: string): string; - /** - * Adds the given HSL values to this color's values. - * Internally, this converts the color's RGB values to HSL, adds HSL - * and then converts the color back to RGB. - * - * @param {number} h - Hue value between `0.0` and `1.0`. - * @param {number} s - Saturation value between `0.0` and `1.0`. - * @param {number} l - Lightness value between `0.0` and `1.0`. - * @return {Color} A reference to this color. - */ - offsetHSL(h: number, s: number, l: number): Color; - /** - * Adds the RGB values of the given color to the RGB values of this color. - * - * @param {Color} color - The color to add. - * @return {Color} A reference to this color. - */ - add(color: Color): Color; - /** - * Adds the RGB values of the given colors and stores the result in this instance. - * - * @param {Color} color1 - The first color. - * @param {Color} color2 - The second color. - * @return {Color} A reference to this color. - */ - addColors(color1: Color, color2: Color): Color; - /** - * Adds the given scalar value to the RGB values of this color. - * - * @param {number} s - The scalar to add. - * @return {Color} A reference to this color. - */ - addScalar(s: number): Color; - /** - * Subtracts the RGB values of the given color from the RGB values of this color. - * - * @param {Color} color - The color to subtract. - * @return {Color} A reference to this color. - */ - sub(color: Color): Color; - /** - * Multiplies the RGB values of the given color with the RGB values of this color. - * - * @param {Color} color - The color to multiply. - * @return {Color} A reference to this color. - */ - multiply(color: Color): Color; - /** - * Multiplies the given scalar value with the RGB values of this color. - * - * @param {number} s - The scalar to multiply. - * @return {Color} A reference to this color. - */ - multiplyScalar(s: number): Color; - /** - * Linearly interpolates this color's RGB values toward the RGB values of the - * given color. The alpha argument can be thought of as the ratio between - * the two colors, where `0.0` is this color and `1.0` is the first argument. - * - * @param {Color} color - The color to converge on. - * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`. - * @return {Color} A reference to this color. - */ - lerp(color: Color, alpha: number): Color; - /** - * Linearly interpolates between the given colors and stores the result in this instance. - * The alpha argument can be thought of as the ratio between the two colors, where `0.0` - * is the first and `1.0` is the second color. - * - * @param {Color} color1 - The first color. - * @param {Color} color2 - The second color. - * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`. - * @return {Color} A reference to this color. - */ - lerpColors(color1: Color, color2: Color, alpha: number): Color; - /** - * Linearly interpolates this color's HSL values toward the HSL values of the - * given color. It differs from {@link Color#lerp} by not interpolating straight - * from one color to the other, but instead going through all the hues in between - * those two colors. The alpha argument can be thought of as the ratio between - * the two colors, where 0.0 is this color and 1.0 is the first argument. - * - * @param {Color} color - The color to converge on. - * @param {number} alpha - The interpolation factor in the closed interval `[0,1]`. - * @return {Color} A reference to this color. - */ - lerpHSL(color: Color, alpha: number): Color; - /** - * Sets the color's RGB components from the given 3D vector. - * - * @param {Vector3} v - The vector to set. - * @return {Color} A reference to this color. - */ - setFromVector3(v: Vector3): Color; - /** - * Transforms this color with the given 3x3 matrix. - * - * @param {Matrix3} m - The matrix. - * @return {Color} A reference to this color. - */ - applyMatrix3(m: Matrix3): Color; - /** - * Returns `true` if this color is equal with the given one. - * - * @param {Color} c - The color to test for equality. - * @return {boolean} Whether this bounding color is equal with the given one. - */ - equals(c: Color): boolean; - /** - * Sets this color's RGB components from the given array. - * - * @param {Array} array - An array holding the RGB values. - * @param {number} [offset=0] - The offset into the array. - * @return {Color} A reference to this color. - */ - fromArray(array: Array, offset?: number): Color; - /** - * Writes the RGB components of this color to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the color components. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The color components. - */ - toArray(array?: Array, offset?: number): Array; - /** - * Sets the components of this color from the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute holding color data. - * @param {number} index - The index into the attribute. - * @return {Color} A reference to this color. - */ - fromBufferAttribute(attribute: BufferAttribute, index: number): Color; - /** - * This methods defines the serialization result of this class. Returns the color - * as a hexadecimal value. - * - * @return {number} The hexadecimal value. - */ - toJSON(): number; - [Symbol.iterator](): Generator; -} -export namespace Color { - export { _colorKeywords as NAMES }; -} -declare namespace _colorKeywords { - let aliceblue: number; - let antiquewhite: number; - let aqua: number; - let aquamarine: number; - let azure: number; - let beige: number; - let bisque: number; - let black: number; - let blanchedalmond: number; - let blue: number; - let blueviolet: number; - let brown: number; - let burlywood: number; - let cadetblue: number; - let chartreuse: number; - let chocolate: number; - let coral: number; - let cornflowerblue: number; - let cornsilk: number; - let crimson: number; - let cyan: number; - let darkblue: number; - let darkcyan: number; - let darkgoldenrod: number; - let darkgray: number; - let darkgreen: number; - let darkgrey: number; - let darkkhaki: number; - let darkmagenta: number; - let darkolivegreen: number; - let darkorange: number; - let darkorchid: number; - let darkred: number; - let darksalmon: number; - let darkseagreen: number; - let darkslateblue: number; - let darkslategray: number; - let darkslategrey: number; - let darkturquoise: number; - let darkviolet: number; - let deeppink: number; - let deepskyblue: number; - let dimgray: number; - let dimgrey: number; - let dodgerblue: number; - let firebrick: number; - let floralwhite: number; - let forestgreen: number; - let fuchsia: number; - let gainsboro: number; - let ghostwhite: number; - let gold: number; - let goldenrod: number; - let gray: number; - let green: number; - let greenyellow: number; - let grey: number; - let honeydew: number; - let hotpink: number; - let indianred: number; - let indigo: number; - let ivory: number; - let khaki: number; - let lavender: number; - let lavenderblush: number; - let lawngreen: number; - let lemonchiffon: number; - let lightblue: number; - let lightcoral: number; - let lightcyan: number; - let lightgoldenrodyellow: number; - let lightgray: number; - let lightgreen: number; - let lightgrey: number; - let lightpink: number; - let lightsalmon: number; - let lightseagreen: number; - let lightskyblue: number; - let lightslategray: number; - let lightslategrey: number; - let lightsteelblue: number; - let lightyellow: number; - let lime: number; - let limegreen: number; - let linen: number; - let magenta: number; - let maroon: number; - let mediumaquamarine: number; - let mediumblue: number; - let mediumorchid: number; - let mediumpurple: number; - let mediumseagreen: number; - let mediumslateblue: number; - let mediumspringgreen: number; - let mediumturquoise: number; - let mediumvioletred: number; - let midnightblue: number; - let mintcream: number; - let mistyrose: number; - let moccasin: number; - let navajowhite: number; - let navy: number; - let oldlace: number; - let olive: number; - let olivedrab: number; - let orange: number; - let orangered: number; - let orchid: number; - let palegoldenrod: number; - let palegreen: number; - let paleturquoise: number; - let palevioletred: number; - let papayawhip: number; - let peachpuff: number; - let peru: number; - let pink: number; - let plum: number; - let powderblue: number; - let purple: number; - let rebeccapurple: number; - let red: number; - let rosybrown: number; - let royalblue: number; - let saddlebrown: number; - let salmon: number; - let sandybrown: number; - let seagreen: number; - let seashell: number; - let sienna: number; - let silver: number; - let skyblue: number; - let slateblue: number; - let slategray: number; - let slategrey: number; - let snow: number; - let springgreen: number; - let steelblue: number; - let tan: number; - let teal: number; - let thistle: number; - let tomato: number; - let turquoise: number; - let violet: number; - let wheat: number; - let white: number; - let whitesmoke: number; - let yellow: number; - let yellowgreen: number; -} -export {}; diff --git a/jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts b/jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts deleted file mode 100644 index 63d1502b9..000000000 --- a/jsdoc-testing/jsdoc/src/math/ColorManagement.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export function SRGBToLinear(c: any): number; -export function LinearToSRGB(c: any): number; -export namespace ColorManagement { - export let enabled: boolean; - export { LinearSRGBColorSpace as workingColorSpace }; - export let spaces: {}; - export function convert(color: any, sourceColorSpace: any, targetColorSpace: any): any; - export function workingToColorSpace(color: any, targetColorSpace: any): any; - export function colorSpaceToWorking(color: any, sourceColorSpace: any): any; - export function getPrimaries(colorSpace: any): any; - export function getTransfer(colorSpace: any): any; - export function getToneMappingMode(colorSpace: any): any; - export function getLuminanceCoefficients(target: any, colorSpace?: any): any; - export function define(colorSpaces: any): void; - export function _getMatrix(targetMatrix: any, sourceColorSpace: any, targetColorSpace: any): any; - export function _getDrawingBufferColorSpace(colorSpace: any): any; - export function _getUnpackColorSpace(colorSpace?: any): any; - export function fromWorkingColorSpace(color: any, targetColorSpace: any): any; - export function toWorkingColorSpace(color: any, sourceColorSpace: any): any; -} -import { LinearSRGBColorSpace } from '../constants.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts b/jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts deleted file mode 100644 index 8c5d91627..000000000 --- a/jsdoc-testing/jsdoc/src/math/Cylindrical.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This class can be used to represent points in 3D space as - * [Cylindrical coordinates](https://en.wikipedia.org/wiki/Cylindrical_coordinate_system). - */ -export class Cylindrical { - /** - * Constructs a new cylindrical. - * - * @param {number} [radius=1] - The distance from the origin to a point in the x-z plane. - * @param {number} [theta=0] - A counterclockwise angle in the x-z plane measured in radians from the positive z-axis. - * @param {number} [y=0] - The height above the x-z plane. - */ - constructor(radius?: number, theta?: number, y?: number); - /** - * The distance from the origin to a point in the x-z plane. - * - * @type {number} - * @default 1 - */ - radius: number; - /** - * A counterclockwise angle in the x-z plane measured in radians from the positive z-axis. - * - * @type {number} - * @default 0 - */ - theta: number; - /** - * The height above the x-z plane. - * - * @type {number} - * @default 0 - */ - y: number; - /** - * Sets the cylindrical components by copying the given values. - * - * @param {number} radius - The radius. - * @param {number} theta - The theta angle. - * @param {number} y - The height value. - * @return {Cylindrical} A reference to this cylindrical. - */ - set(radius: number, theta: number, y: number): Cylindrical; - /** - * Copies the values of the given cylindrical to this instance. - * - * @param {Cylindrical} other - The cylindrical to copy. - * @return {Cylindrical} A reference to this cylindrical. - */ - copy(other: Cylindrical): Cylindrical; - /** - * Sets the cylindrical components from the given vector which is assumed to hold - * Cartesian coordinates. - * - * @param {Vector3} v - The vector to set. - * @return {Cylindrical} A reference to this cylindrical. - */ - setFromVector3(v: Vector3): Cylindrical; - /** - * Sets the cylindrical components from the given Cartesian coordinates. - * - * @param {number} x - The x value. - * @param {number} y - The x value. - * @param {number} z - The x value. - * @return {Cylindrical} A reference to this cylindrical. - */ - setFromCartesianCoords(x: number, y: number, z: number): Cylindrical; - /** - * Returns a new cylindrical with copied values from this instance. - * - * @return {Cylindrical} A clone of this instance. - */ - clone(): Cylindrical; -} diff --git a/jsdoc-testing/jsdoc/src/math/Euler.d.ts b/jsdoc-testing/jsdoc/src/math/Euler.d.ts deleted file mode 100644 index 8ba21b0f2..000000000 --- a/jsdoc-testing/jsdoc/src/math/Euler.d.ts +++ /dev/null @@ -1,164 +0,0 @@ -/** - * A class representing Euler angles. - * - * Euler angles describe a rotational transformation by rotating an object on - * its various axes in specified amounts per axis, and a specified axis - * order. - * - * Iterating through an instance will yield its components (x, y, z, - * order) in the corresponding order. - * - * ```js - * const a = new THREE.Euler( 0, 1, 1.57, 'XYZ' ); - * const b = new THREE.Vector3( 1, 0, 1 ); - * b.applyEuler(a); - * ``` - */ -export class Euler { - /** - * Constructs a new euler instance. - * - * @param {number} [x=0] - The angle of the x axis in radians. - * @param {number} [y=0] - The angle of the y axis in radians. - * @param {number} [z=0] - The angle of the z axis in radians. - * @param {string} [order=Euler.DEFAULT_ORDER] - A string representing the order that the rotations are applied. - */ - constructor(x?: number, y?: number, z?: number, order?: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isEuler: boolean; - _x: number; - _y: number; - _z: number; - _order: string; - set x(value: number); - /** - * The angle of the x axis in radians. - * - * @type {number} - * @default 0 - */ - get x(): number; - set y(value: number); - /** - * The angle of the y axis in radians. - * - * @type {number} - * @default 0 - */ - get y(): number; - set z(value: number); - /** - * The angle of the z axis in radians. - * - * @type {number} - * @default 0 - */ - get z(): number; - set order(value: string); - /** - * A string representing the order that the rotations are applied. - * - * @type {string} - * @default 'XYZ' - */ - get order(): string; - /** - * Sets the Euler components. - * - * @param {number} x - The angle of the x axis in radians. - * @param {number} y - The angle of the y axis in radians. - * @param {number} z - The angle of the z axis in radians. - * @param {string} [order] - A string representing the order that the rotations are applied. - * @return {Euler} A reference to this Euler instance. - */ - set(x: number, y: number, z: number, order?: string): Euler; - /** - * Returns a new Euler instance with copied values from this instance. - * - * @return {Euler} A clone of this instance. - */ - clone(): Euler; - /** - * Copies the values of the given Euler instance to this instance. - * - * @param {Euler} euler - The Euler instance to copy. - * @return {Euler} A reference to this Euler instance. - */ - copy(euler: Euler): Euler; - /** - * Sets the angles of this Euler instance from a pure rotation matrix. - * - * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled). - * @param {string} [order] - A string representing the order that the rotations are applied. - * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not. - * @return {Euler} A reference to this Euler instance. - */ - setFromRotationMatrix(m: Matrix4, order?: string, update?: boolean): Euler; - /** - * Sets the angles of this Euler instance from a normalized quaternion. - * - * @param {Quaternion} q - A normalized Quaternion. - * @param {string} [order] - A string representing the order that the rotations are applied. - * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not. - * @return {Euler} A reference to this Euler instance. - */ - setFromQuaternion(q: Quaternion, order?: string, update?: boolean): Euler; - /** - * Sets the angles of this Euler instance from the given vector. - * - * @param {Vector3} v - The vector. - * @param {string} [order] - A string representing the order that the rotations are applied. - * @return {Euler} A reference to this Euler instance. - */ - setFromVector3(v: Vector3, order?: string): Euler; - /** - * Resets the euler angle with a new order by creating a quaternion from this - * euler angle and then setting this euler angle with the quaternion and the - * new order. - * - * Warning: This discards revolution information. - * - * @param {string} [newOrder] - A string representing the new order that the rotations are applied. - * @return {Euler} A reference to this Euler instance. - */ - reorder(newOrder?: string): Euler; - /** - * Returns `true` if this Euler instance is equal with the given one. - * - * @param {Euler} euler - The Euler instance to test for equality. - * @return {boolean} Whether this Euler instance is equal with the given one. - */ - equals(euler: Euler): boolean; - /** - * Sets this Euler instance's components to values from the given array. The first three - * entries of the array are assign to the x,y and z components. An optional fourth entry - * defines the Euler order. - * - * @param {Array} array - An array holding the Euler component values. - * @return {Euler} A reference to this Euler instance. - */ - fromArray(array: Array): Euler; - /** - * Writes the components of this Euler instance to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the Euler components. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The Euler components. - */ - toArray(array?: Array, offset?: number): Array; - _onChange(callback: any): this; - _onChangeCallback(): void; - [Symbol.iterator](): Generator; -} -export namespace Euler { - let DEFAULT_ORDER: string; -} -import { Matrix4 } from './Matrix4.js'; -import { Quaternion } from './Quaternion.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Frustum.d.ts b/jsdoc-testing/jsdoc/src/math/Frustum.d.ts deleted file mode 100644 index b75731203..000000000 --- a/jsdoc-testing/jsdoc/src/math/Frustum.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Frustums are used to determine what is inside the camera's field of view. - * They help speed up the rendering process - objects which lie outside a camera's - * frustum can safely be excluded from rendering. - * - * This class is mainly intended for use internally by a renderer. - */ -export class Frustum { - /** - * Constructs a new frustum. - * - * @param {Plane} [p0] - The first plane that encloses the frustum. - * @param {Plane} [p1] - The second plane that encloses the frustum. - * @param {Plane} [p2] - The third plane that encloses the frustum. - * @param {Plane} [p3] - The fourth plane that encloses the frustum. - * @param {Plane} [p4] - The fifth plane that encloses the frustum. - * @param {Plane} [p5] - The sixth plane that encloses the frustum. - */ - constructor(p0?: Plane, p1?: Plane, p2?: Plane, p3?: Plane, p4?: Plane, p5?: Plane); - /** - * This array holds the planes that enclose the frustum. - * - * @type {Array} - */ - planes: Array; - /** - * Sets the frustum planes by copying the given planes. - * - * @param {Plane} [p0] - The first plane that encloses the frustum. - * @param {Plane} [p1] - The second plane that encloses the frustum. - * @param {Plane} [p2] - The third plane that encloses the frustum. - * @param {Plane} [p3] - The fourth plane that encloses the frustum. - * @param {Plane} [p4] - The fifth plane that encloses the frustum. - * @param {Plane} [p5] - The sixth plane that encloses the frustum. - * @return {Frustum} A reference to this frustum. - */ - set(p0?: Plane, p1?: Plane, p2?: Plane, p3?: Plane, p4?: Plane, p5?: Plane): Frustum; - /** - * Copies the values of the given frustum to this instance. - * - * @param {Frustum} frustum - The frustum to copy. - * @return {Frustum} A reference to this frustum. - */ - copy(frustum: Frustum): Frustum; - /** - * Sets the frustum planes from the given projection matrix. - * - * @param {Matrix4} m - The projection matrix. - * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} coordinateSystem - The coordinate system. - * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth. - * @return {Frustum} A reference to this frustum. - */ - setFromProjectionMatrix(m: Matrix4, coordinateSystem?: (number | number), reversedDepth?: boolean): Frustum; - /** - * Returns `true` if the 3D object's bounding sphere is intersecting this frustum. - * - * Note that the 3D object must have a geometry so that the bounding sphere can be calculated. - * - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object's bounding sphere is intersecting this frustum or not. - */ - intersectsObject(object: Object3D): boolean; - /** - * Returns `true` if the given sprite is intersecting this frustum. - * - * @param {Sprite} sprite - The sprite to test. - * @return {boolean} Whether the sprite is intersecting this frustum or not. - */ - intersectsSprite(sprite: Sprite): boolean; - /** - * Returns `true` if the given bounding sphere is intersecting this frustum. - * - * This is a fast, conservative test that favors performance over precision. It can - * report false positives for spheres that lie outside the frustum but are not separated - * by a single frustum plane. It never reports false negatives, so it is safe for culling. - * - * @param {Sphere} sphere - The bounding sphere to test. - * @return {boolean} Whether the bounding sphere is intersecting this frustum or not. - */ - intersectsSphere(sphere: Sphere): boolean; - /** - * Returns `true` if the given bounding box is intersecting this frustum. - * - * This is a fast, conservative test that favors performance over precision. It can - * report false positives for large boxes that lie outside the frustum but are not - * separated by a single frustum plane. It never reports false negatives, so it is - * safe for culling. - * - * @param {Box3} box - The bounding box to test. - * @return {boolean} Whether the bounding box is intersecting this frustum or not. - */ - intersectsBox(box: Box3): boolean; - /** - * Returns `true` if the given point lies within the frustum. - * - * @param {Vector3} point - The point to test. - * @return {boolean} Whether the point lies within this frustum or not. - */ - containsPoint(point: Vector3): boolean; - /** - * Returns a new frustum with copied values from this instance. - * - * @return {Frustum} A clone of this instance. - */ - clone(): Frustum; -} -import { Plane } from './Plane.js'; -import { Sphere } from './Sphere.js'; -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts b/jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts deleted file mode 100644 index 09dd15ad3..000000000 --- a/jsdoc-testing/jsdoc/src/math/FrustumArray.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * FrustumArray is used to determine if an object is visible in at least one camera - * from an array of cameras. This is particularly useful for multi-view renderers. -*/ -export class FrustumArray { - /** - * The coordinate system to use. - * - * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem} - * @default WebGLCoordinateSystem - */ - coordinateSystem: number | WebGPUCoordinateSystem; - /** - * A pool of frustum instances. It may hold more entries than are - * currently in use; surplus instances are kept for reuse to avoid - * reallocating when array cameras of different lengths are rendered. - * - * @private - * @type {Array} - */ - private _frustums; - /** - * The number of frustums in {@link FrustumArray#_frustums} that are currently - * in use. - * - * @private - * @type {number} - * @default 0 - */ - private _count; - /** - * Computes and caches a frustum for each camera of the given array camera. - * - * @param {ArrayCamera} cameraArray - The array camera whose sub-cameras define the frustums. - * @return {FrustumArray} A reference to this frustum array. - */ - setFromArrayCamera(cameraArray: ArrayCamera): FrustumArray; - /** - * Returns `true` if the 3D object's bounding sphere is intersecting any cached frustum. - * - * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. - * - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is visible in any camera. - */ - intersectsObject(object: Object3D): boolean; - /** - * Returns `true` if the given sprite is intersecting any cached frustum. - * - * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. - * - * @param {Sprite} sprite - The sprite to test. - * @return {boolean} Whether the sprite is visible in any camera. - */ - intersectsSprite(sprite: Sprite): boolean; - /** - * Returns `true` if the given bounding sphere is intersecting any cached frustum. - * - * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. - * - * @param {Sphere} sphere - The bounding sphere to test. - * @return {boolean} Whether the sphere is visible in any camera. - */ - intersectsSphere(sphere: Sphere): boolean; - /** - * Returns `true` if the given bounding box is intersecting any cached frustum. - * - * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. - * - * @param {Box3} box - The bounding box to test. - * @return {boolean} Whether the box is visible in any camera. - */ - intersectsBox(box: Box3): boolean; - /** - * Returns `true` if the given point lies within any cached frustum. - * - * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method. - * - * @param {Vector3} point - The point to test. - * @return {boolean} Whether the point is visible in any camera. - */ - containsPoint(point: Vector3): boolean; - /** - * Copies the values of the given frustum array to this instance. - * - * @param {FrustumArray} source - The frustum array to copy. - * @return {FrustumArray} A reference to this frustum array. - */ - copy(source: FrustumArray): FrustumArray; - /** - * Returns a new frustum array with copied values from this instance. - * - * @return {FrustumArray} A clone of this instance. - */ - clone(): FrustumArray; -} diff --git a/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts b/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts deleted file mode 100644 index 561415c0e..000000000 --- a/jsdoc-testing/jsdoc/src/math/Interpolant.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Abstract base class of interpolants over parametric samples. - * - * The parameter domain is one dimensional, typically the time or a path - * along a curve defined by the data. - * - * The sample values can have any dimensionality and derived classes may - * apply special interpretations to the data. - * - * This class provides the interval seek in a Template Method, deferring - * the actual interpolation to derived classes. - * - * Time complexity is O(1) for linear access crossing at most two points - * and O(log N) for random access, where N is the number of positions. - * - * References: {@link http://www.oodesign.com/template-method-pattern.html} - * - * @abstract - */ -export class Interpolant { - /** - * Constructs a new interpolant. - * - * @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors. - * @param {TypedArray} sampleValues - The sample values. - * @param {number} sampleSize - The sample size - * @param {TypedArray} [resultBuffer] - The result buffer. - */ - constructor(parameterPositions: TypedArray, sampleValues: TypedArray, sampleSize: number, resultBuffer?: TypedArray); - /** - * The parameter positions. - * - * @type {TypedArray} - */ - parameterPositions: TypedArray; - /** - * A cache index. - * - * @private - * @type {number} - * @default 0 - */ - private _cachedIndex; - /** - * The result buffer. - * - * @type {TypedArray} - */ - resultBuffer: TypedArray; - /** - * The sample values. - * - * @type {TypedArray} - */ - sampleValues: TypedArray; - /** - * The value size. - * - * @type {TypedArray} - */ - valueSize: TypedArray; - /** - * The interpolation settings. - * - * @type {?Object} - * @default null - */ - settings: Object | null; - /** - * The default settings object. - * - * @type {Object} - */ - DefaultSettings_: Object; - /** - * Evaluate the interpolant at position `t`. - * - * @param {number} t - The interpolation factor. - * @return {TypedArray} The result buffer. - */ - evaluate(t: number): TypedArray; - /** - * Returns the interpolation settings. - * - * @return {Object} The interpolation settings. - */ - getSettings_(): Object; - /** - * Copies a sample value to the result buffer. - * - * @param {number} index - An index into the sample value buffer. - * @return {TypedArray} The result buffer. - */ - copySampleValue_(index: number): TypedArray; - /** - * Copies a sample value to the result buffer. - * - * @abstract - * @param {number} i1 - An index into the sample value buffer. - * @param {number} t0 - The previous interpolation factor. - * @param {number} t - The current interpolation factor. - * @param {number} t1 - The next interpolation factor. - * @return {TypedArray} The result buffer. - */ - interpolate_(): TypedArray; - /** - * Optional method that is executed when the interval has changed. - * - * @param {number} i1 - An index into the sample value buffer. - * @param {number} t0 - The previous interpolation factor. - * @param {number} t - The current interpolation factor. - */ - intervalChanged_(): void; -} diff --git a/jsdoc-testing/jsdoc/src/math/Line3.d.ts b/jsdoc-testing/jsdoc/src/math/Line3.d.ts deleted file mode 100644 index 339e53546..000000000 --- a/jsdoc-testing/jsdoc/src/math/Line3.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -/** - * An analytical line segment in 3D space represented by a start and end point. - */ -export class Line3 { - /** - * Constructs a new line segment. - * - * @param {Vector3} [start=(0,0,0)] - Start of the line segment. - * @param {Vector3} [end=(0,0,0)] - End of the line segment. - */ - constructor(start?: Vector3, end?: Vector3); - /** - * Start of the line segment. - * - * @type {Vector3} - */ - start: Vector3; - /** - * End of the line segment. - * - * @type {Vector3} - */ - end: Vector3; - /** - * Sets the start and end values by copying the given vectors. - * - * @param {Vector3} start - The start point. - * @param {Vector3} end - The end point. - * @return {Line3} A reference to this line segment. - */ - set(start: Vector3, end: Vector3): Line3; - /** - * Copies the values of the given line segment to this instance. - * - * @param {Line3} line - The line segment to copy. - * @return {Line3} A reference to this line segment. - */ - copy(line: Line3): Line3; - /** - * Returns the center of the line segment. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The center point. - */ - getCenter(target: Vector3): Vector3; - /** - * Returns the delta vector of the line segment's start and end point. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The delta vector. - */ - delta(target: Vector3): Vector3; - /** - * Returns the squared Euclidean distance between the line' start and end point. - * - * @return {number} The squared Euclidean distance. - */ - distanceSq(): number; - /** - * Returns the Euclidean distance between the line' start and end point. - * - * @return {number} The Euclidean distance. - */ - distance(): number; - /** - * Returns a vector at a certain position along the line segment. - * - * @param {number} t - A value between `[0,1]` to represent a position along the line segment. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The delta vector. - */ - at(t: number, target: Vector3): Vector3; - /** - * Returns a point parameter based on the closest point as projected on the line segment. - * - * @param {Vector3} point - The point for which to return a point parameter. - * @param {boolean} clampToLine - Whether to clamp the result to the range `[0,1]` or not. - * @return {number} The point parameter. - */ - closestPointToPointParameter(point: Vector3, clampToLine: boolean): number; - /** - * Returns the closest point on the line for a given point. - * - * @param {Vector3} point - The point to compute the closest point on the line for. - * @param {boolean} clampToLine - Whether to clamp the result to the range `[0,1]` or not. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The closest point on the line. - */ - closestPointToPoint(point: Vector3, clampToLine: boolean, target: Vector3): Vector3; - /** - * Returns the closest squared distance between this line segment and the given one. - * - * @param {Line3} line - The line segment to compute the closest squared distance to. - * @param {Vector3} [c1] - The closest point on this line segment. - * @param {Vector3} [c2] - The closest point on the given line segment. - * @return {number} The squared distance between this line segment and the given one. - */ - distanceSqToLine3(line: Line3, c1?: Vector3, c2?: Vector3): number; - /** - * Applies a 4x4 transformation matrix to this line segment. - * - * @param {Matrix4} matrix - The transformation matrix. - * @return {Line3} A reference to this line segment. - */ - applyMatrix4(matrix: Matrix4): Line3; - /** - * Returns `true` if this line segment is equal with the given one. - * - * @param {Line3} line - The line segment to test for equality. - * @return {boolean} Whether this line segment is equal with the given one. - */ - equals(line: Line3): boolean; - /** - * Returns a new line segment with copied values from this instance. - * - * @return {Line3} A clone of this instance. - */ - clone(): Line3; -} -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/MathUtils.d.ts b/jsdoc-testing/jsdoc/src/math/MathUtils.d.ts deleted file mode 100644 index bc4d11f77..000000000 --- a/jsdoc-testing/jsdoc/src/math/MathUtils.d.ts +++ /dev/null @@ -1,224 +0,0 @@ -export const DEG2RAD: number; -export const RAD2DEG: number; -/** - * Generate a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) - * (universally unique identifier). - * - * @return {string} The UUID. - */ -export function generateUUID(): string; -/** - * Clamps the given value between min and max. - * - * @param {number} value - The value to clamp. - * @param {number} min - The min value. - * @param {number} max - The max value. - * @return {number} The clamped value. - */ -export function clamp(value: number, min: number, max: number): number; -/** - * Computes the Euclidean modulo of the given parameters that - * is `( ( n % m ) + m ) % m`. - * - * @param {number} n - The first parameter. - * @param {number} m - The second parameter. - * @return {number} The Euclidean modulo. - */ -export function euclideanModulo(n: number, m: number): number; -/** - * Performs a linear mapping from range `` to range `` - * for the given value. `a2` must be greater than `a1`. - * - * @param {number} x - The value to be mapped. - * @param {number} a1 - Minimum value for range A. - * @param {number} a2 - Maximum value for range A. - * @param {number} b1 - Minimum value for range B. - * @param {number} b2 - Maximum value for range B. - * @return {number} The mapped value. - */ -export function mapLinear(x: number, a1: number, a2: number, b1: number, b2: number): number; -/** - * Returns the percentage in the closed interval `[0, 1]` of the given value - * between the start and end point. - * - * @param {number} x - The start point - * @param {number} y - The end point. - * @param {number} value - A value between start and end. - * @return {number} The interpolation factor. - */ -export function inverseLerp(x: number, y: number, value: number): number; -/** - * Returns a value linearly interpolated from two known points based on the given interval - - * `t = 0` will return `x` and `t = 1` will return `y`. - * - * @param {number} x - The start point - * @param {number} y - The end point. - * @param {number} t - The interpolation factor in the closed interval `[0, 1]`. - * @return {number} The interpolated value. - */ -export function lerp(x: number, y: number, t: number): number; -/** - * Smoothly interpolate a number from `x` to `y` in a spring-like manner using a delta - * time to maintain frame rate independent movement. For details, see - * [Frame rate independent damping using lerp](http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/). - * - * @param {number} x - The current point. - * @param {number} y - The target point. - * @param {number} lambda - A higher lambda value will make the movement more sudden, - * and a lower value will make the movement more gradual. - * @param {number} dt - Delta time in seconds. - * @return {number} The interpolated value. - */ -export function damp(x: number, y: number, lambda: number, dt: number): number; -/** - * Returns a value that alternates between `0` and the given `length` parameter. - * - * @param {number} x - The value to pingpong. - * @param {number} [length=1] - The positive value the function will pingpong to. - * @return {number} The alternated value. - */ -export function pingpong(x: number, length?: number): number; -/** - * Returns a value in the range `[0,1]` that represents the percentage that `x` has - * moved between `min` and `max`, but smoothed or slowed down the closer `x` is to - * the `min` and `max`. - * - * See [Smoothstep](http://en.wikipedia.org/wiki/Smoothstep) for more details. - * - * @param {number} x - The value to evaluate based on its position between `min` and `max`. - * @param {number} min - The min value. Any `x` value below `min` will be `0`. `min` must be lower than `max`. - * @param {number} max - The max value. Any `x` value above `max` will be `1`. `max` must be greater than `min`. - * @return {number} The alternated value. - */ -export function smoothstep(x: number, min: number, max: number): number; -/** - * A [variation on smoothstep](https://en.wikipedia.org/wiki/Smoothstep#Variations) - * that has zero 1st and 2nd order derivatives at `x=0` and `x=1`. - * - * @param {number} x - The value to evaluate based on its position between `min` and `max`. - * @param {number} min - The min value. Any `x` value below `min` will be `0`. `min` must be lower than `max`. - * @param {number} max - The max value. Any `x` value above `max` will be `1`. `max` must be greater than `min`. - * @return {number} The alternated value. - */ -export function smootherstep(x: number, min: number, max: number): number; -/** - * Returns a random integer from `` interval. - * - * @param {number} low - The lower value boundary. - * @param {number} high - The upper value boundary - * @return {number} A random integer. - */ -export function randInt(low: number, high: number): number; -/** - * Returns a random float from `` interval. - * - * @param {number} low - The lower value boundary. - * @param {number} high - The upper value boundary - * @return {number} A random float. - */ -export function randFloat(low: number, high: number): number; -/** - * Returns a random integer from `<-range/2, range/2>` interval. - * - * @param {number} range - Defines the value range. - * @return {number} A random float. - */ -export function randFloatSpread(range: number): number; -/** - * Returns a deterministic pseudo-random float in the interval `[0, 1]`. - * - * @param {number} [s] - The integer seed. - * @return {number} A random float. - */ -export function seededRandom(s?: number): number; -/** - * Converts degrees to radians. - * - * @param {number} degrees - A value in degrees. - * @return {number} The converted value in radians. - */ -export function degToRad(degrees: number): number; -/** - * Converts radians to degrees. - * - * @param {number} radians - A value in radians. - * @return {number} The converted value in degrees. - */ -export function radToDeg(radians: number): number; -/** - * Returns `true` if the given number is a power of two. - * - * @param {number} value - The value to check. - * @return {boolean} Whether the given number is a power of two or not. - */ -export function isPowerOfTwo(value: number): boolean; -/** - * Returns the smallest power of two that is greater than or equal to the given number. - * - * @param {number} value - The value to find a POT for. Must be greater than `0`. - * @return {number} The smallest power of two that is greater than or equal to the given number. - */ -export function ceilPowerOfTwo(value: number): number; -/** - * Returns the largest power of two that is less than or equal to the given number. - * - * @param {number} value - The value to find a POT for. Must be greater than `0`. - * @return {number} The largest power of two that is less than or equal to the given number. - */ -export function floorPowerOfTwo(value: number): number; -/** - * Sets the given quaternion from the [Intrinsic Proper Euler Angles](https://en.wikipedia.org/wiki/Euler_angles) - * defined by the given angles and order. - * - * Rotations are applied to the axes in the order specified by order: - * rotation by angle `a` is applied first, then by angle `b`, then by angle `c`. - * - * @param {Quaternion} q - The quaternion to set. - * @param {number} a - The rotation applied to the first axis, in radians. - * @param {number} b - The rotation applied to the second axis, in radians. - * @param {number} c - The rotation applied to the third axis, in radians. - * @param {('XYX'|'XZX'|'YXY'|'YZY'|'ZXZ'|'ZYZ')} order - A string specifying the axes order. - */ -export function setQuaternionFromProperEuler(q: Quaternion, a: number, b: number, c: number, order: ("XYX" | "XZX" | "YXY" | "YZY" | "ZXZ" | "ZYZ")): void; -/** - * Normalizes the given value according to the given typed array. - * - * @param {number} value - The float value in the range `[0,1]` to normalize. - * @param {TypedArray} array - The typed array that defines the data type of the value. - * @return {number} The normalize value. - */ -export function normalize(value: number, array: TypedArray): number; -/** - * Denormalizes the given value according to the given typed array. - * - * @param {number} value - The value to denormalize. - * @param {TypedArray} array - The typed array that defines the data type of the value. - * @return {number} The denormalize (float) value in the range `[0,1]`. - */ -export function denormalize(value: number, array: TypedArray): number; -export namespace MathUtils { - export { DEG2RAD }; - export { RAD2DEG }; - export { generateUUID }; - export { clamp }; - export { euclideanModulo }; - export { mapLinear }; - export { inverseLerp }; - export { lerp }; - export { damp }; - export { pingpong }; - export { smoothstep }; - export { smootherstep }; - export { randInt }; - export { randFloat }; - export { randFloatSpread }; - export { seededRandom }; - export { degToRad }; - export { radToDeg }; - export { isPowerOfTwo }; - export { ceilPowerOfTwo }; - export { floorPowerOfTwo }; - export { setQuaternionFromProperEuler }; - export { normalize }; - export { denormalize }; -} diff --git a/jsdoc-testing/jsdoc/src/math/Matrix2.d.ts b/jsdoc-testing/jsdoc/src/math/Matrix2.d.ts deleted file mode 100644 index 7eac72d0b..000000000 --- a/jsdoc-testing/jsdoc/src/math/Matrix2.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Represents a 2x2 matrix. - * - * A Note on Row-Major and Column-Major Ordering: - * - * The constructor and {@link Matrix2#set} method take arguments in - * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) - * order, while internally they are stored in the {@link Matrix2#elements} array in column-major order. - * This means that calling: - * ```js - * const m = new THREE.Matrix2(); - * m.set( 11, 12, - * 21, 22 ); - * ``` - * will result in the elements array containing: - * ```js - * m.elements = [ 11, 21, - * 12, 22 ]; - * ``` - * and internally all calculations are performed using column-major ordering. - * However, as the actual ordering makes no difference mathematically and - * most people are used to thinking about matrices in row-major order, the - * three.js documentation shows matrices in row-major order. Just bear in - * mind that if you are reading the source code, you'll have to take the - * transpose of any matrices outlined here to make sense of the calculations. - */ -export class Matrix2 { - /** - * Constructs a new 2x2 matrix. The arguments are supposed to be - * in row-major order. If no arguments are provided, the constructor - * initializes the matrix as an identity matrix. - * - * @param {number} [n11] - 1-1 matrix element. - * @param {number} [n12] - 1-2 matrix element. - * @param {number} [n21] - 2-1 matrix element. - * @param {number} [n22] - 2-2 matrix element. - */ - constructor(n11?: number, n12?: number, n21?: number, n22?: number); - /** - * A column-major list of matrix values. - * - * @type {Array} - */ - elements: Array; - /** - * Sets this matrix to the 2x2 identity matrix. - * - * @return {Matrix2} A reference to this matrix. - */ - identity(): Matrix2; - /** - * Sets the elements of the matrix from the given array. - * - * @param {Array} array - The matrix elements in column-major order. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Matrix2} A reference to this matrix. - */ - fromArray(array: Array, offset?: number): Matrix2; - /** - * Sets the elements of the matrix.The arguments are supposed to be - * in row-major order. - * - * @param {number} n11 - 1-1 matrix element. - * @param {number} n12 - 1-2 matrix element. - * @param {number} n21 - 2-1 matrix element. - * @param {number} n22 - 2-2 matrix element. - * @return {Matrix2} A reference to this matrix. - */ - set(n11: number, n12: number, n21: number, n22: number): Matrix2; -} diff --git a/jsdoc-testing/jsdoc/src/math/Matrix3.d.ts b/jsdoc-testing/jsdoc/src/math/Matrix3.d.ts deleted file mode 100644 index 659ea41a3..000000000 --- a/jsdoc-testing/jsdoc/src/math/Matrix3.d.ts +++ /dev/null @@ -1,254 +0,0 @@ -/** - * Represents a 3x3 matrix. - * - * A Note on Row-Major and Column-Major Ordering: - * - * The constructor and {@link Matrix3#set} method take arguments in - * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) - * order, while internally they are stored in the {@link Matrix3#elements} array in column-major order. - * This means that calling: - * ```js - * const m = new THREE.Matrix(); - * m.set( 11, 12, 13, - * 21, 22, 23, - * 31, 32, 33 ); - * ``` - * will result in the elements array containing: - * ```js - * m.elements = [ 11, 21, 31, - * 12, 22, 32, - * 13, 23, 33 ]; - * ``` - * and internally all calculations are performed using column-major ordering. - * However, as the actual ordering makes no difference mathematically and - * most people are used to thinking about matrices in row-major order, the - * three.js documentation shows matrices in row-major order. Just bear in - * mind that if you are reading the source code, you'll have to take the - * transpose of any matrices outlined here to make sense of the calculations. - */ -export class Matrix3 { - /** - * Constructs a new 3x3 matrix. The arguments are supposed to be - * in row-major order. If no arguments are provided, the constructor - * initializes the matrix as an identity matrix. - * - * @param {number} [n11] - 1-1 matrix element. - * @param {number} [n12] - 1-2 matrix element. - * @param {number} [n13] - 1-3 matrix element. - * @param {number} [n21] - 2-1 matrix element. - * @param {number} [n22] - 2-2 matrix element. - * @param {number} [n23] - 2-3 matrix element. - * @param {number} [n31] - 3-1 matrix element. - * @param {number} [n32] - 3-2 matrix element. - * @param {number} [n33] - 3-3 matrix element. - */ - constructor(n11?: number, n12?: number, n13?: number, n21?: number, n22?: number, n23?: number, n31?: number, n32?: number, n33?: number); - /** - * A column-major list of matrix values. - * - * @type {Array} - */ - elements: Array; - /** - * Sets the elements of the matrix.The arguments are supposed to be - * in row-major order. - * - * @param {number} [n11] - 1-1 matrix element. - * @param {number} [n12] - 1-2 matrix element. - * @param {number} [n13] - 1-3 matrix element. - * @param {number} [n21] - 2-1 matrix element. - * @param {number} [n22] - 2-2 matrix element. - * @param {number} [n23] - 2-3 matrix element. - * @param {number} [n31] - 3-1 matrix element. - * @param {number} [n32] - 3-2 matrix element. - * @param {number} [n33] - 3-3 matrix element. - * @return {Matrix3} A reference to this matrix. - */ - set(n11?: number, n12?: number, n13?: number, n21?: number, n22?: number, n23?: number, n31?: number, n32?: number, n33?: number): Matrix3; - /** - * Sets this matrix to the 3x3 identity matrix. - * - * @return {Matrix3} A reference to this matrix. - */ - identity(): Matrix3; - /** - * Copies the values of the given matrix to this instance. - * - * @param {Matrix3} m - The matrix to copy. - * @return {Matrix3} A reference to this matrix. - */ - copy(m: Matrix3): Matrix3; - /** - * Extracts the basis of this matrix into the three axis vectors provided. - * - * @param {Vector3} xAxis - The basis's x axis. - * @param {Vector3} yAxis - The basis's y axis. - * @param {Vector3} zAxis - The basis's z axis. - * @return {Matrix3} A reference to this matrix. - */ - extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix3; - /** - * Set this matrix to the upper 3x3 matrix of the given 4x4 matrix. - * - * @param {Matrix4} m - The 4x4 matrix. - * @return {Matrix3} A reference to this matrix. - */ - setFromMatrix4(m: Matrix4): Matrix3; - /** - * Post-multiplies this matrix by the given 3x3 matrix. - * - * @param {Matrix3} m - The matrix to multiply with. - * @return {Matrix3} A reference to this matrix. - */ - multiply(m: Matrix3): Matrix3; - /** - * Pre-multiplies this matrix by the given 3x3 matrix. - * - * @param {Matrix3} m - The matrix to multiply with. - * @return {Matrix3} A reference to this matrix. - */ - premultiply(m: Matrix3): Matrix3; - /** - * Multiples the given 3x3 matrices and stores the result - * in this matrix. - * - * @param {Matrix3} a - The first matrix. - * @param {Matrix3} b - The second matrix. - * @return {Matrix3} A reference to this matrix. - */ - multiplyMatrices(a: Matrix3, b: Matrix3): Matrix3; - /** - * Multiplies every component of the matrix by the given scalar. - * - * @param {number} s - The scalar. - * @return {Matrix3} A reference to this matrix. - */ - multiplyScalar(s: number): Matrix3; - /** - * Computes and returns the determinant of this matrix. - * - * @return {number} The determinant. - */ - determinant(): number; - /** - * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution). - * You can not invert with a determinant of zero. If you attempt this, the method produces - * a zero matrix instead. - * - * @return {Matrix3} A reference to this matrix. - */ - invert(): Matrix3; - /** - * Transposes this matrix in place. - * - * @return {Matrix3} A reference to this matrix. - */ - transpose(): Matrix3; - /** - * Computes the normal matrix which is the inverse transpose of the upper - * left 3x3 portion of the given 4x4 matrix. - * - * @param {Matrix4} matrix4 - The 4x4 matrix. - * @return {Matrix3} A reference to this matrix. - */ - getNormalMatrix(matrix4: Matrix4): Matrix3; - /** - * Transposes this matrix into the supplied array, and returns itself unchanged. - * - * @param {Array} r - An array to store the transposed matrix elements. - * @return {Matrix3} A reference to this matrix. - */ - transposeIntoArray(r: Array): Matrix3; - /** - * Sets the UV transform matrix from offset, repeat, rotation, and center. - * - * @param {number} tx - Offset x. - * @param {number} ty - Offset y. - * @param {number} sx - Repeat x. - * @param {number} sy - Repeat y. - * @param {number} rotation - Rotation, in radians. Positive values rotate counterclockwise. - * @param {number} cx - Center x of rotation. - * @param {number} cy - Center y of rotation - * @return {Matrix3} A reference to this matrix. - */ - setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number): Matrix3; - /** - * Scales this matrix with the given scalar values. - * - * @deprecated - * @param {number} sx - The amount to scale in the X axis. - * @param {number} sy - The amount to scale in the Y axis. - * @return {Matrix3} A reference to this matrix. - */ - scale(sx: number, sy: number): Matrix3; - /** - * Rotates this matrix by the given angle. - * - * @deprecated - * @param {number} theta - The rotation in radians. - * @return {Matrix3} A reference to this matrix. - */ - rotate(theta: number): Matrix3; - /** - * Translates this matrix by the given scalar values. - * - * @deprecated - * @param {number} tx - The amount to translate in the X axis. - * @param {number} ty - The amount to translate in the Y axis. - * @return {Matrix3} A reference to this matrix. - */ - translate(tx: number, ty: number): Matrix3; - /** - * Sets this matrix as a 2D translation transform. - * - * @param {number|Vector2} x - The amount to translate in the X axis or alternatively a translation vector. - * @param {number} y - The amount to translate in the Y axis. - * @return {Matrix3} A reference to this matrix. - */ - makeTranslation(x: number | Vector2, y: number): Matrix3; - /** - * Sets this matrix as a 2D rotational transformation. - * - * @param {number} theta - The rotation in radians. - * @return {Matrix3} A reference to this matrix. - */ - makeRotation(theta: number): Matrix3; - /** - * Sets this matrix as a 2D scale transform. - * - * @param {number} x - The amount to scale in the X axis. - * @param {number} y - The amount to scale in the Y axis. - * @return {Matrix3} A reference to this matrix. - */ - makeScale(x: number, y: number): Matrix3; - /** - * Returns `true` if this matrix is equal with the given one. - * - * @param {Matrix3} matrix - The matrix to test for equality. - * @return {boolean} Whether this matrix is equal with the given one. - */ - equals(matrix: Matrix3): boolean; - /** - * Sets the elements of the matrix from the given array. - * - * @param {Array} array - The matrix elements in column-major order. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Matrix3} A reference to this matrix. - */ - fromArray(array: Array, offset?: number): Matrix3; - /** - * Writes the elements of this matrix to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the matrix elements in column-major order. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The matrix elements in column-major order. - */ - toArray(array?: Array, offset?: number): Array; - /** - * Returns a matrix with copied values from this instance. - * - * @return {Matrix3} A clone of this instance. - */ - clone(): Matrix3; -} diff --git a/jsdoc-testing/jsdoc/src/math/Matrix4.d.ts b/jsdoc-testing/jsdoc/src/math/Matrix4.d.ts deleted file mode 100644 index e6e246bc2..000000000 --- a/jsdoc-testing/jsdoc/src/math/Matrix4.d.ts +++ /dev/null @@ -1,411 +0,0 @@ -/** - * Represents a 4x4 matrix. - * - * The most common use of a 4x4 matrix in 3D computer graphics is as a transformation matrix. - * For an introduction to transformation matrices as used in WebGL, check out [this tutorial](https://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices) - * - * This allows a 3D vector representing a point in 3D space to undergo - * transformations such as translation, rotation, shear, scale, reflection, - * orthogonal or perspective projection and so on, by being multiplied by the - * matrix. This is known as `applying` the matrix to the vector. - * - * A Note on Row-Major and Column-Major Ordering: - * - * The constructor and {@link Matrix3#set} method take arguments in - * [row-major](https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order) - * order, while internally they are stored in the {@link Matrix3#elements} array in column-major order. - * This means that calling: - * ```js - * const m = new THREE.Matrix4(); - * m.set( 11, 12, 13, 14, - * 21, 22, 23, 24, - * 31, 32, 33, 34, - * 41, 42, 43, 44 ); - * ``` - * will result in the elements array containing: - * ```js - * m.elements = [ 11, 21, 31, 41, - * 12, 22, 32, 42, - * 13, 23, 33, 43, - * 14, 24, 34, 44 ]; - * ``` - * and internally all calculations are performed using column-major ordering. - * However, as the actual ordering makes no difference mathematically and - * most people are used to thinking about matrices in row-major order, the - * three.js documentation shows matrices in row-major order. Just bear in - * mind that if you are reading the source code, you'll have to take the - * transpose of any matrices outlined here to make sense of the calculations. - */ -export class Matrix4 { - /** - * Constructs a new 4x4 matrix. The arguments are supposed to be - * in row-major order. If no arguments are provided, the constructor - * initializes the matrix as an identity matrix. - * - * @param {number} [n11] - 1-1 matrix element. - * @param {number} [n12] - 1-2 matrix element. - * @param {number} [n13] - 1-3 matrix element. - * @param {number} [n14] - 1-4 matrix element. - * @param {number} [n21] - 2-1 matrix element. - * @param {number} [n22] - 2-2 matrix element. - * @param {number} [n23] - 2-3 matrix element. - * @param {number} [n24] - 2-4 matrix element. - * @param {number} [n31] - 3-1 matrix element. - * @param {number} [n32] - 3-2 matrix element. - * @param {number} [n33] - 3-3 matrix element. - * @param {number} [n34] - 3-4 matrix element. - * @param {number} [n41] - 4-1 matrix element. - * @param {number} [n42] - 4-2 matrix element. - * @param {number} [n43] - 4-3 matrix element. - * @param {number} [n44] - 4-4 matrix element. - */ - constructor(n11?: number, n12?: number, n13?: number, n14?: number, n21?: number, n22?: number, n23?: number, n24?: number, n31?: number, n32?: number, n33?: number, n34?: number, n41?: number, n42?: number, n43?: number, n44?: number); - /** - * A column-major list of matrix values. - * - * @type {Array} - */ - elements: Array; - /** - * Sets the elements of the matrix.The arguments are supposed to be - * in row-major order. - * - * @param {number} [n11] - 1-1 matrix element. - * @param {number} [n12] - 1-2 matrix element. - * @param {number} [n13] - 1-3 matrix element. - * @param {number} [n14] - 1-4 matrix element. - * @param {number} [n21] - 2-1 matrix element. - * @param {number} [n22] - 2-2 matrix element. - * @param {number} [n23] - 2-3 matrix element. - * @param {number} [n24] - 2-4 matrix element. - * @param {number} [n31] - 3-1 matrix element. - * @param {number} [n32] - 3-2 matrix element. - * @param {number} [n33] - 3-3 matrix element. - * @param {number} [n34] - 3-4 matrix element. - * @param {number} [n41] - 4-1 matrix element. - * @param {number} [n42] - 4-2 matrix element. - * @param {number} [n43] - 4-3 matrix element. - * @param {number} [n44] - 4-4 matrix element. - * @return {Matrix4} A reference to this matrix. - */ - set(n11?: number, n12?: number, n13?: number, n14?: number, n21?: number, n22?: number, n23?: number, n24?: number, n31?: number, n32?: number, n33?: number, n34?: number, n41?: number, n42?: number, n43?: number, n44?: number): Matrix4; - /** - * Sets this matrix to the 4x4 identity matrix. - * - * @return {Matrix4} A reference to this matrix. - */ - identity(): Matrix4; - /** - * Returns a matrix with copied values from this instance. - * - * @return {Matrix4} A clone of this instance. - */ - clone(): Matrix4; - /** - * Copies the values of the given matrix to this instance. - * - * @param {Matrix4} m - The matrix to copy. - * @return {Matrix4} A reference to this matrix. - */ - copy(m: Matrix4): Matrix4; - /** - * Copies the translation component of the given matrix - * into this matrix's translation component. - * - * @param {Matrix4} m - The matrix to copy the translation component. - * @return {Matrix4} A reference to this matrix. - */ - copyPosition(m: Matrix4): Matrix4; - /** - * Set the upper 3x3 elements of this matrix to the values of given 3x3 matrix. - * - * @param {Matrix3} m - The 3x3 matrix. - * @return {Matrix4} A reference to this matrix. - */ - setFromMatrix3(m: Matrix3): Matrix4; - /** - * Extracts the basis vectors of this matrix into the three vectors provided. - * - * @param {Vector3} xAxis - The basis's x axis. - * @param {Vector3} yAxis - The basis's y axis. - * @param {Vector3} zAxis - The basis's z axis. - * @return {Matrix4} A reference to this matrix. - */ - extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; - /** - * Sets the given basis vectors to this matrix. - * - * @param {Vector3} xAxis - The basis's x axis. - * @param {Vector3} yAxis - The basis's y axis. - * @param {Vector3} zAxis - The basis's z axis. - * @return {Matrix4} A reference to this matrix. - */ - makeBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix4; - /** - * Extracts the rotation component of the given matrix - * into this matrix's rotation component. - * - * Note: This method does not support reflection matrices. - * - * @param {Matrix4} m - The matrix. - * @return {Matrix4} A reference to this matrix. - */ - extractRotation(m: Matrix4): Matrix4; - /** - * Sets the rotation component (the upper left 3x3 matrix) of this matrix to - * the rotation specified by the given Euler angles. The rest of - * the matrix is set to the identity. Depending on the {@link Euler#order}, - * there are six possible outcomes. See [this page](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix) - * for a complete list. - * - * @param {Euler} euler - The Euler angles. - * @return {Matrix4} A reference to this matrix. - */ - makeRotationFromEuler(euler: Euler): Matrix4; - /** - * Sets the rotation component of this matrix to the rotation specified by - * the given Quaternion as outlined [here](https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion) - * The rest of the matrix is set to the identity. - * - * @param {Quaternion} q - The Quaternion. - * @return {Matrix4} A reference to this matrix. - */ - makeRotationFromQuaternion(q: Quaternion): Matrix4; - /** - * Sets the rotation component of the transformation matrix, looking from `eye` towards - * `target`, and oriented by the up-direction. - * - * @param {Vector3} eye - The eye vector. - * @param {Vector3} target - The target vector. - * @param {Vector3} up - The up vector. - * @return {Matrix4} A reference to this matrix. - */ - lookAt(eye: Vector3, target: Vector3, up: Vector3): Matrix4; - /** - * Post-multiplies this matrix by the given 4x4 matrix. - * - * @param {Matrix4} m - The matrix to multiply with. - * @return {Matrix4} A reference to this matrix. - */ - multiply(m: Matrix4): Matrix4; - /** - * Pre-multiplies this matrix by the given 4x4 matrix. - * - * @param {Matrix4} m - The matrix to multiply with. - * @return {Matrix4} A reference to this matrix. - */ - premultiply(m: Matrix4): Matrix4; - /** - * Multiples the given 4x4 matrices and stores the result - * in this matrix. - * - * @param {Matrix4} a - The first matrix. - * @param {Matrix4} b - The second matrix. - * @return {Matrix4} A reference to this matrix. - */ - multiplyMatrices(a: Matrix4, b: Matrix4): Matrix4; - /** - * Multiplies every component of the matrix by the given scalar. - * - * @param {number} s - The scalar. - * @return {Matrix4} A reference to this matrix. - */ - multiplyScalar(s: number): Matrix4; - /** - * Computes and returns the determinant of this matrix. - * - * @return {number} The determinant. - */ - determinant(): number; - /** - * Computes and returns the determinant of the 4x4 matrix, but assumes the - * matrix is affine, saving some computations. - * - * For affine matrices (like an object's world matrix), this value equals the - * full 4x4 {@link Matrix4#determinant} but is cheaper to compute. - * - * Assumes the bottom row is [0, 0, 0, 1]. - * - * @return {number} The determinant of the matrix. - */ - determinantAffine(): number; - /** - * Transposes this matrix in place. - * - * @return {Matrix4} A reference to this matrix. - */ - transpose(): Matrix4; - /** - * Sets the position component for this matrix from the given vector, - * without affecting the rest of the matrix. - * - * @param {number|Vector3} x - The x component of the vector or alternatively the vector object. - * @param {number} y - The y component of the vector. - * @param {number} z - The z component of the vector. - * @return {Matrix4} A reference to this matrix. - */ - setPosition(x: number | Vector3, y: number, z: number): Matrix4; - /** - * Inverts this matrix, using the [analytic method](https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution). - * You can not invert with a determinant of zero. If you attempt this, the method produces - * a zero matrix instead. - * - * @return {Matrix4} A reference to this matrix. - */ - invert(): Matrix4; - /** - * Scales each of the first three columns of this matrix by the corresponding component of the given vector. - * - * @param {Vector3} v - The scale vector. - * @return {Matrix4} A reference to this matrix. - */ - scale(v: Vector3): Matrix4; - /** - * Gets the maximum scale value of the three axes. - * - * @return {number} The maximum scale. - */ - getMaxScaleOnAxis(): number; - /** - * Sets this matrix as a translation transform from the given vector. - * - * @param {number|Vector3} x - The amount to translate in the X axis or alternatively a translation vector. - * @param {number} y - The amount to translate in the Y axis. - * @param {number} z - The amount to translate in the z axis. - * @return {Matrix4} A reference to this matrix. - */ - makeTranslation(x: number | Vector3, y: number, z: number): Matrix4; - /** - * Sets this matrix as a rotational transformation around the X axis by - * the given angle. - * - * @param {number} theta - The rotation in radians. - * @return {Matrix4} A reference to this matrix. - */ - makeRotationX(theta: number): Matrix4; - /** - * Sets this matrix as a rotational transformation around the Y axis by - * the given angle. - * - * @param {number} theta - The rotation in radians. - * @return {Matrix4} A reference to this matrix. - */ - makeRotationY(theta: number): Matrix4; - /** - * Sets this matrix as a rotational transformation around the Z axis by - * the given angle. - * - * @param {number} theta - The rotation in radians. - * @return {Matrix4} A reference to this matrix. - */ - makeRotationZ(theta: number): Matrix4; - /** - * Sets this matrix as a rotational transformation around the given axis by - * the given angle. - * - * @param {Vector3} axis - The normalized rotation axis. - * @param {number} angle - The rotation in radians. - * @return {Matrix4} A reference to this matrix. - */ - makeRotationAxis(axis: Vector3, angle: number): Matrix4; - /** - * Sets this matrix as a scale transformation. - * - * @param {number} x - The amount to scale in the X axis. - * @param {number} y - The amount to scale in the Y axis. - * @param {number} z - The amount to scale in the Z axis. - * @return {Matrix4} A reference to this matrix. - */ - makeScale(x: number, y: number, z: number): Matrix4; - /** - * Sets this matrix as a shear transformation. - * - * @param {number} xy - The amount to shear X by Y. - * @param {number} xz - The amount to shear X by Z. - * @param {number} yx - The amount to shear Y by X. - * @param {number} yz - The amount to shear Y by Z. - * @param {number} zx - The amount to shear Z by X. - * @param {number} zy - The amount to shear Z by Y. - * @return {Matrix4} A reference to this matrix. - */ - makeShear(xy: number, xz: number, yx: number, yz: number, zx: number, zy: number): Matrix4; - /** - * Sets this matrix to the transformation composed of the given position, - * rotation (Quaternion) and scale. - * - * @param {Vector3} position - The position vector. - * @param {Quaternion} quaternion - The rotation as a Quaternion. - * @param {Vector3} scale - The scale vector. - * @return {Matrix4} A reference to this matrix. - */ - compose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4; - /** - * Decomposes this matrix into its position, rotation and scale components - * and provides the result in the given objects. - * - * Note: Not all matrices are decomposable in this way. For example, if an - * object has a non-uniformly scaled parent, then the object's world matrix - * may not be decomposable, and this method may not be appropriate. - * - * @param {Vector3} position - The position vector. - * @param {Quaternion} quaternion - The rotation as a Quaternion. - * @param {Vector3} scale - The scale vector. - * @return {Matrix4} A reference to this matrix. - */ - decompose(position: Vector3, quaternion: Quaternion, scale: Vector3): Matrix4; - /** - * Creates a perspective projection matrix. This is used internally by - * {@link PerspectiveCamera#updateProjectionMatrix}. - - * @param {number} left - Left boundary of the viewing frustum at the near plane. - * @param {number} right - Right boundary of the viewing frustum at the near plane. - * @param {number} top - Top boundary of the viewing frustum at the near plane. - * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane. - * @param {number} near - The distance from the camera to the near plane. - * @param {number} far - The distance from the camera to the far plane. - * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system. - * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth. - * @return {Matrix4} A reference to this matrix. - */ - makePerspective(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: (number | number), reversedDepth?: boolean): Matrix4; - /** - * Creates a orthographic projection matrix. This is used internally by - * {@link OrthographicCamera#updateProjectionMatrix}. - - * @param {number} left - Left boundary of the viewing frustum at the near plane. - * @param {number} right - Right boundary of the viewing frustum at the near plane. - * @param {number} top - Top boundary of the viewing frustum at the near plane. - * @param {number} bottom - Bottom boundary of the viewing frustum at the near plane. - * @param {number} near - The distance from the camera to the near plane. - * @param {number} far - The distance from the camera to the far plane. - * @param {(WebGLCoordinateSystem|WebGPUCoordinateSystem)} [coordinateSystem=WebGLCoordinateSystem] - The coordinate system. - * @param {boolean} [reversedDepth=false] - Whether to use a reversed depth. - * @return {Matrix4} A reference to this matrix. - */ - makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number, coordinateSystem?: (number | number), reversedDepth?: boolean): Matrix4; - /** - * Returns `true` if this matrix is equal with the given one. - * - * @param {Matrix4} matrix - The matrix to test for equality. - * @return {boolean} Whether this matrix is equal with the given one. - */ - equals(matrix: Matrix4): boolean; - /** - * Sets the elements of the matrix from the given array. - * - * @param {Array} array - The matrix elements in column-major order. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Matrix4} A reference to this matrix. - */ - fromArray(array: Array, offset?: number): Matrix4; - /** - * Writes the elements of this matrix to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the matrix elements in column-major order. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The matrix elements in column-major order. - */ - toArray(array?: Array, offset?: number): Array; -} -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Plane.d.ts b/jsdoc-testing/jsdoc/src/math/Plane.d.ts deleted file mode 100644 index b98878577..000000000 --- a/jsdoc-testing/jsdoc/src/math/Plane.d.ts +++ /dev/null @@ -1,203 +0,0 @@ -/** - * A two dimensional surface that extends infinitely in 3D space, represented - * in [Hessian normal form](https://mathworld.wolfram.com/HessianNormalForm.html) - * by a unit length normal vector and a constant. - */ -export class Plane { - /** - * Constructs a new plane. - * - * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane. - * @param {number} [constant=0] - The signed distance from the origin to the plane. - */ - constructor(normal?: Vector3, constant?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPlane: boolean; - /** - * A unit length vector defining the normal of the plane. - * - * @type {Vector3} - */ - normal: Vector3; - /** - * The signed distance from the origin to the plane. - * - * @type {number} - * @default 0 - */ - constant: number; - /** - * Sets the plane components by copying the given values. - * - * @param {Vector3} normal - The normal. - * @param {number} constant - The constant. - * @return {Plane} A reference to this plane. - */ - set(normal: Vector3, constant: number): Plane; - /** - * Sets the plane components by defining `x`, `y`, `z` as the - * plane normal and `w` as the constant. - * - * @param {number} x - The value for the normal's x component. - * @param {number} y - The value for the normal's y component. - * @param {number} z - The value for the normal's z component. - * @param {number} w - The constant value. - * @return {Plane} A reference to this plane. - */ - setComponents(x: number, y: number, z: number, w: number): Plane; - /** - * Sets the plane from the given normal and coplanar point (that is a point - * that lies onto the plane). - * - * @param {Vector3} normal - The normal. - * @param {Vector3} point - A coplanar point. - * @return {Plane} A reference to this plane. - */ - setFromNormalAndCoplanarPoint(normal: Vector3, point: Vector3): Plane; - /** - * Sets the plane from three coplanar points. The winding order is - * assumed to be counter-clockwise, and determines the direction of - * the plane normal. - * - * @param {Vector3} a - The first coplanar point. - * @param {Vector3} b - The second coplanar point. - * @param {Vector3} c - The third coplanar point. - * @return {Plane} A reference to this plane. - */ - setFromCoplanarPoints(a: Vector3, b: Vector3, c: Vector3): Plane; - /** - * Copies the values of the given plane to this instance. - * - * @param {Plane} plane - The plane to copy. - * @return {Plane} A reference to this plane. - */ - copy(plane: Plane): Plane; - /** - * Normalizes the plane normal and adjusts the constant accordingly. - * - * @return {Plane} A reference to this plane. - */ - normalize(): Plane; - /** - * Negates both the plane normal and the constant. - * - * @return {Plane} A reference to this plane. - */ - negate(): Plane; - /** - * Returns the signed distance from the given point to this plane. - * - * @param {Vector3} point - The point to compute the distance for. - * @return {number} The signed distance. - */ - distanceToPoint(point: Vector3): number; - /** - * Returns the signed distance from the given sphere to this plane. - * - * @param {Sphere} sphere - The sphere to compute the distance for. - * @return {number} The signed distance. - */ - distanceToSphere(sphere: Sphere): number; - /** - * Projects a the given point onto the plane. - * - * @param {Vector3} point - The point to project. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The projected point on the plane. - */ - projectPoint(point: Vector3, target: Vector3): Vector3; - /** - * Returns the intersection point of the passed line and the plane. Returns - * `null` if the line does not intersect. Returns the line's starting point if - * the line is coplanar with the plane. - * - * @param {Line3} line - The line to compute the intersection for. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment. - * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected. - */ - intersectLine(line: Line3, target: Vector3, clampToLine?: boolean): Vector3 | null; - /** - * Returns `true` if the given line segment intersects with (passes through) the plane. - * - * @param {Line3} line - The line to test. - * @return {boolean} Whether the given line segment intersects with the plane or not. - */ - intersectsLine(line: Line3): boolean; - /** - * Returns `true` if the given bounding box intersects with the plane. - * - * @param {Box3} box - The bounding box to test. - * @return {boolean} Whether the given bounding box intersects with the plane or not. - */ - intersectsBox(box: Box3): boolean; - /** - * Returns `true` if the given bounding sphere intersects with the plane. - * - * @param {Sphere} sphere - The bounding sphere to test. - * @return {boolean} Whether the given bounding sphere intersects with the plane or not. - */ - intersectsSphere(sphere: Sphere): boolean; - /** - * Returns a coplanar vector to the plane, by calculating the - * projection of the normal at the origin onto the plane. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The coplanar point. - */ - coplanarPoint(target: Vector3): Vector3; - /** - * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform. - * - * The optional normal matrix can be pre-computed like so: - * ```js - * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix ); - * ``` - * - * @param {Matrix4} matrix - The transformation matrix. - * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix. - * @return {Plane} A reference to this plane. - */ - applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix4): Plane; - /** - * Translates the plane by the distance defined by the given offset vector. - * Note that this only affects the plane constant and will not affect the normal vector. - * - * @param {Vector3} offset - The offset vector. - * @return {Plane} A reference to this plane. - */ - translate(offset: Vector3): Plane; - /** - * Returns `true` if this plane is equal with the given one. - * - * @param {Plane} plane - The plane to test for equality. - * @return {boolean} Whether this plane is equal with the given one. - */ - equals(plane: Plane): boolean; - /** - * Returns a new plane with copied values from this instance. - * - * @return {Plane} A clone of this instance. - */ - clone(): Plane; - /** - * Returns a serialized structure of the plane. - * - * @return {Object} Serialized structure with fields representing the object state. - */ - toJSON(): Object; - /** - * Sets the plane properties from the given JSON. - * - * @param {Object} json - The serialized json to set the plane from. - * @return {Plane} A reference to this plane. - */ - fromJSON(json: Object): Plane; -} -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Quaternion.d.ts b/jsdoc-testing/jsdoc/src/math/Quaternion.d.ts deleted file mode 100644 index 214548cde..000000000 --- a/jsdoc-testing/jsdoc/src/math/Quaternion.d.ts +++ /dev/null @@ -1,310 +0,0 @@ -/** - * Class for representing a Quaternion. Quaternions are used in three.js to represent rotations. - * - * Iterating through a vector instance will yield its components `(x, y, z, w)` in - * the corresponding order. - * - * Note that three.js expects Quaternions to be normalized. - * ```js - * const quaternion = new THREE.Quaternion(); - * quaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), Math.PI / 2 ); - * - * const vector = new THREE.Vector3( 1, 0, 0 ); - * vector.applyQuaternion( quaternion ); - * ``` - */ -export class Quaternion { - /** - * Interpolates between two quaternions via SLERP. This implementation assumes the - * quaternion data are managed in flat arrays. - * - * @param {Array} dst - The destination array. - * @param {number} dstOffset - An offset into the destination array. - * @param {Array} src0 - The source array of the first quaternion. - * @param {number} srcOffset0 - An offset into the first source array. - * @param {Array} src1 - The source array of the second quaternion. - * @param {number} srcOffset1 - An offset into the second source array. - * @param {number} t - The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate. - * @see {@link Quaternion#slerp} - */ - static slerpFlat(dst: Array, dstOffset: number, src0: Array, srcOffset0: number, src1: Array, srcOffset1: number, t: number): void; - /** - * Multiplies two quaternions. This implementation assumes the quaternion data are managed - * in flat arrays. - * - * @param {Array} dst - The destination array. - * @param {number} dstOffset - An offset into the destination array. - * @param {Array} src0 - The source array of the first quaternion. - * @param {number} srcOffset0 - An offset into the first source array. - * @param {Array} src1 - The source array of the second quaternion. - * @param {number} srcOffset1 - An offset into the second source array. - * @return {Array} The destination array. - * @see {@link Quaternion#multiplyQuaternions}. - */ - static multiplyQuaternionsFlat(dst: Array, dstOffset: number, src0: Array, srcOffset0: number, src1: Array, srcOffset1: number): Array; - /** - * Constructs a new quaternion. - * - * @param {number} [x=0] - The x value of this quaternion. - * @param {number} [y=0] - The y value of this quaternion. - * @param {number} [z=0] - The z value of this quaternion. - * @param {number} [w=1] - The w value of this quaternion. - */ - constructor(x?: number, y?: number, z?: number, w?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isQuaternion: boolean; - _x: number; - _y: number; - _z: number; - _w: number; - set x(value: number); - /** - * The x value of this quaternion. - * - * @type {number} - * @default 0 - */ - get x(): number; - set y(value: number); - /** - * The y value of this quaternion. - * - * @type {number} - * @default 0 - */ - get y(): number; - set z(value: number); - /** - * The z value of this quaternion. - * - * @type {number} - * @default 0 - */ - get z(): number; - set w(value: number); - /** - * The w value of this quaternion. - * - * @type {number} - * @default 1 - */ - get w(): number; - /** - * Sets the quaternion components. - * - * @param {number} x - The x value of this quaternion. - * @param {number} y - The y value of this quaternion. - * @param {number} z - The z value of this quaternion. - * @param {number} w - The w value of this quaternion. - * @return {Quaternion} A reference to this quaternion. - */ - set(x: number, y: number, z: number, w: number): Quaternion; - /** - * Returns a new quaternion with copied values from this instance. - * - * @return {Quaternion} A clone of this instance. - */ - clone(): Quaternion; - /** - * Copies the values of the given quaternion to this instance. - * - * @param {Quaternion} quaternion - The quaternion to copy. - * @return {Quaternion} A reference to this quaternion. - */ - copy(quaternion: Quaternion): Quaternion; - /** - * Sets this quaternion from the rotation specified by the given - * Euler angles. - * - * @param {Euler} euler - The Euler angles. - * @param {boolean} [update=true] - Whether the internal `onChange` callback should be executed or not. - * @return {Quaternion} A reference to this quaternion. - */ - setFromEuler(euler: Euler, update?: boolean): Quaternion; - /** - * Sets this quaternion from the given axis and angle. - * - * @param {Vector3} axis - The normalized axis. - * @param {number} angle - The angle in radians. - * @return {Quaternion} A reference to this quaternion. - */ - setFromAxisAngle(axis: Vector3, angle: number): Quaternion; - /** - * Sets this quaternion from the given rotation matrix. - * - * @param {Matrix4} m - A 4x4 matrix of which the upper 3x3 of matrix is a pure rotation matrix (i.e. unscaled). - * @return {Quaternion} A reference to this quaternion. - */ - setFromRotationMatrix(m: Matrix4): Quaternion; - /** - * Sets this quaternion to the rotation required to rotate the direction vector - * `vFrom` to the direction vector `vTo`. - * - * @param {Vector3} vFrom - The first (normalized) direction vector. - * @param {Vector3} vTo - The second (normalized) direction vector. - * @return {Quaternion} A reference to this quaternion. - */ - setFromUnitVectors(vFrom: Vector3, vTo: Vector3): Quaternion; - /** - * Returns the angle between this quaternion and the given one in radians. - * - * @param {Quaternion} q - The quaternion to compute the angle with. - * @return {number} The angle in radians. - */ - angleTo(q: Quaternion): number; - /** - * Rotates this quaternion by a given angular step to the given quaternion. - * The method ensures that the final quaternion will not overshoot `q`. - * - * @param {Quaternion} q - The target quaternion. - * @param {number} step - The angular step in radians. - * @return {Quaternion} A reference to this quaternion. - */ - rotateTowards(q: Quaternion, step: number): Quaternion; - /** - * Sets this quaternion to the identity quaternion; that is, to the - * quaternion that represents "no rotation". - * - * @return {Quaternion} A reference to this quaternion. - */ - identity(): Quaternion; - /** - * Inverts this quaternion via {@link Quaternion#conjugate}. The - * quaternion is assumed to have unit length. - * - * @return {Quaternion} A reference to this quaternion. - */ - invert(): Quaternion; - /** - * Returns the rotational conjugate of this quaternion. The conjugate of a - * quaternion represents the same rotation in the opposite direction about - * the rotational axis. - * - * @return {Quaternion} A reference to this quaternion. - */ - conjugate(): Quaternion; - /** - * Calculates the dot product of this quaternion and the given one. - * - * @param {Quaternion} v - The quaternion to compute the dot product with. - * @return {number} The result of the dot product. - */ - dot(v: Quaternion): number; - /** - * Computes the squared Euclidean length (straight-line length) of this quaternion, - * considered as a 4 dimensional vector. This can be useful if you are comparing the - * lengths of two quaternions, as this is a slightly more efficient calculation than - * {@link Quaternion#length}. - * - * @return {number} The squared Euclidean length. - */ - lengthSq(): number; - /** - * Computes the Euclidean length (straight-line length) of this quaternion, - * considered as a 4 dimensional vector. - * - * @return {number} The Euclidean length. - */ - length(): number; - /** - * Normalizes this quaternion - that is, calculated the quaternion that performs - * the same rotation as this one, but has a length equal to `1`. - * - * @return {Quaternion} A reference to this quaternion. - */ - normalize(): Quaternion; - /** - * Multiplies this quaternion by the given one. - * - * @param {Quaternion} q - The quaternion. - * @return {Quaternion} A reference to this quaternion. - */ - multiply(q: Quaternion): Quaternion; - /** - * Pre-multiplies this quaternion by the given one. - * - * @param {Quaternion} q - The quaternion. - * @return {Quaternion} A reference to this quaternion. - */ - premultiply(q: Quaternion): Quaternion; - /** - * Multiplies the given quaternions and stores the result in this instance. - * - * @param {Quaternion} a - The first quaternion. - * @param {Quaternion} b - The second quaternion. - * @return {Quaternion} A reference to this quaternion. - */ - multiplyQuaternions(a: Quaternion, b: Quaternion): Quaternion; - /** - * Performs a spherical linear interpolation between this quaternion and the target quaternion. - * - * @param {Quaternion} qb - The target quaternion. - * @param {number} t - The interpolation factor. A value in the range `[0,1]` will interpolate. A value outside the range `[0,1]` will extrapolate. - * @return {Quaternion} A reference to this quaternion. - */ - slerp(qb: Quaternion, t: number): Quaternion; - /** - * Performs a spherical linear interpolation between the given quaternions - * and stores the result in this quaternion. - * - * @param {Quaternion} qa - The source quaternion. - * @param {Quaternion} qb - The target quaternion. - * @param {number} t - The interpolation factor in the closed interval `[0, 1]`. - * @return {Quaternion} A reference to this quaternion. - */ - slerpQuaternions(qa: Quaternion, qb: Quaternion, t: number): Quaternion; - /** - * Sets this quaternion to a uniformly random, normalized quaternion. - * - * @return {Quaternion} A reference to this quaternion. - */ - random(): Quaternion; - /** - * Returns `true` if this quaternion is equal with the given one. - * - * @param {Quaternion} quaternion - The quaternion to test for equality. - * @return {boolean} Whether this quaternion is equal with the given one. - */ - equals(quaternion: Quaternion): boolean; - /** - * Sets this quaternion's components from the given array. - * - * @param {Array} array - An array holding the quaternion component values. - * @param {number} [offset=0] - The offset into the array. - * @return {Quaternion} A reference to this quaternion. - */ - fromArray(array: Array, offset?: number): Quaternion; - /** - * Writes the components of this quaternion to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the quaternion components. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The quaternion components. - */ - toArray(array?: Array, offset?: number): Array; - /** - * Sets the components of this quaternion from the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute holding quaternion data. - * @param {number} index - The index into the attribute. - * @return {Quaternion} A reference to this quaternion. - */ - fromBufferAttribute(attribute: BufferAttribute, index: number): Quaternion; - /** - * This methods defines the serialization result of this class. Returns the - * numerical elements of this quaternion in an array of format `[x, y, z, w]`. - * - * @return {Array} The serialized quaternion. - */ - toJSON(): Array; - _onChange(callback: any): this; - _onChangeCallback(): void; - [Symbol.iterator](): Generator; -} diff --git a/jsdoc-testing/jsdoc/src/math/Ray.d.ts b/jsdoc-testing/jsdoc/src/math/Ray.d.ts deleted file mode 100644 index 02531c54e..000000000 --- a/jsdoc-testing/jsdoc/src/math/Ray.d.ts +++ /dev/null @@ -1,185 +0,0 @@ -/** - * A ray that emits from an origin in a certain direction. The class is used by - * {@link Raycaster} to assist with raycasting. Raycasting is used for - * mouse picking (working out what objects in the 3D space the mouse is over) - * amongst other things. - */ -export class Ray { - /** - * Constructs a new ray. - * - * @param {Vector3} [origin=(0,0,0)] - The origin of the ray. - * @param {Vector3} [direction=(0,0,-1)] - The (normalized) direction of the ray. - */ - constructor(origin?: Vector3, direction?: Vector3); - /** - * The origin of the ray. - * - * @type {Vector3} - */ - origin: Vector3; - /** - * The (normalized) direction of the ray. - * - * @type {Vector3} - */ - direction: Vector3; - /** - * Sets the ray's components by copying the given values. - * - * @param {Vector3} origin - The origin. - * @param {Vector3} direction - The direction. - * @return {Ray} A reference to this ray. - */ - set(origin: Vector3, direction: Vector3): Ray; - /** - * Copies the values of the given ray to this instance. - * - * @param {Ray} ray - The ray to copy. - * @return {Ray} A reference to this ray. - */ - copy(ray: Ray): Ray; - /** - * Returns a vector that is located at a given distance along this ray. - * - * @param {number} t - The distance along the ray to retrieve a position for. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} A position on the ray. - */ - at(t: number, target: Vector3): Vector3; - /** - * Adjusts the direction of the ray to point at the given vector in world space. - * - * @param {Vector3} v - The target position. - * @return {Ray} A reference to this ray. - */ - lookAt(v: Vector3): Ray; - /** - * Shift the origin of this ray along its direction by the given distance. - * - * @param {number} t - The distance along the ray to interpolate. - * @return {Ray} A reference to this ray. - */ - recast(t: number): Ray; - /** - * Returns the point along this ray that is closest to the given point. - * - * @param {Vector3} point - A point in 3D space to get the closet location on the ray for. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The closest point on this ray. - */ - closestPointToPoint(point: Vector3, target: Vector3): Vector3; - /** - * Returns the distance of the closest approach between this ray and the given point. - * - * @param {Vector3} point - A point in 3D space to compute the distance to. - * @return {number} The distance. - */ - distanceToPoint(point: Vector3): number; - /** - * Returns the squared distance of the closest approach between this ray and the given point. - * - * @param {Vector3} point - A point in 3D space to compute the distance to. - * @return {number} The squared distance. - */ - distanceSqToPoint(point: Vector3): number; - /** - * Returns the squared distance between this ray and the given line segment. - * - * @param {Vector3} v0 - The start point of the line segment. - * @param {Vector3} v1 - The end point of the line segment. - * @param {Vector3} [optionalPointOnRay] - When provided, it receives the point on this ray that is closest to the segment. - * @param {Vector3} [optionalPointOnSegment] - When provided, it receives the point on the line segment that is closest to this ray. - * @return {number} The squared distance. - */ - distanceSqToSegment(v0: Vector3, v1: Vector3, optionalPointOnRay?: Vector3, optionalPointOnSegment?: Vector3): number; - /** - * Intersects this ray with the given sphere, returning the intersection - * point or `null` if there is no intersection. - * - * @param {Sphere} sphere - The sphere to intersect. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The intersection point. - */ - intersectSphere(sphere: Sphere, target: Vector3): Vector3 | null; - /** - * Returns `true` if this ray intersects with the given sphere. - * - * @param {Sphere} sphere - The sphere to intersect. - * @return {boolean} Whether this ray intersects with the given sphere or not. - */ - intersectsSphere(sphere: Sphere): boolean; - /** - * Computes the distance from the ray's origin to the given plane. Returns `null` if the ray - * does not intersect with the plane. - * - * @param {Plane} plane - The plane to compute the distance to. - * @return {?number} Whether this ray intersects with the given sphere or not. - */ - distanceToPlane(plane: Plane): number | null; - /** - * Intersects this ray with the given plane, returning the intersection - * point or `null` if there is no intersection. - * - * @param {Plane} plane - The plane to intersect. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The intersection point. - */ - intersectPlane(plane: Plane, target: Vector3): Vector3 | null; - /** - * Returns `true` if this ray intersects with the given plane. - * - * @param {Plane} plane - The plane to intersect. - * @return {boolean} Whether this ray intersects with the given plane or not. - */ - intersectsPlane(plane: Plane): boolean; - /** - * Intersects this ray with the given bounding box, returning the intersection - * point or `null` if there is no intersection. - * - * @param {Box3} box - The box to intersect. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The intersection point. - */ - intersectBox(box: Box3, target: Vector3): Vector3 | null; - /** - * Returns `true` if this ray intersects with the given box. - * - * @param {Box3} box - The box to intersect. - * @return {boolean} Whether this ray intersects with the given box or not. - */ - intersectsBox(box: Box3): boolean; - /** - * Intersects this ray with the given triangle, returning the intersection - * point or `null` if there is no intersection. - * - * @param {Vector3} a - The first vertex of the triangle. - * @param {Vector3} b - The second vertex of the triangle. - * @param {Vector3} c - The third vertex of the triangle. - * @param {boolean} backfaceCulling - Whether to use backface culling or not. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The intersection point. - */ - intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, target: Vector3): Vector3 | null; - /** - * Transforms this ray with the given 4x4 transformation matrix. - * - * @param {Matrix4} matrix4 - The transformation matrix. - * @return {Ray} A reference to this ray. - */ - applyMatrix4(matrix4: Matrix4): Ray; - /** - * Returns `true` if this ray is equal with the given one. - * - * @param {Ray} ray - The ray to test for equality. - * @return {boolean} Whether this ray is equal with the given one. - */ - equals(ray: Ray): boolean; - /** - * Returns a new ray with copied values from this instance. - * - * @return {Ray} A clone of this instance. - */ - clone(): Ray; -} -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Sphere.d.ts b/jsdoc-testing/jsdoc/src/math/Sphere.d.ts deleted file mode 100644 index 5d7e4ac67..000000000 --- a/jsdoc-testing/jsdoc/src/math/Sphere.d.ts +++ /dev/null @@ -1,185 +0,0 @@ -/** - * An analytical 3D sphere defined by a center and radius. This class is mainly - * used as a Bounding Sphere for 3D objects. - */ -export class Sphere { - /** - * Constructs a new sphere. - * - * @param {Vector3} [center=(0,0,0)] - The center of the sphere - * @param {number} [radius=-1] - The radius of the sphere. - */ - constructor(center?: Vector3, radius?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSphere: boolean; - /** - * The center of the sphere - * - * @type {Vector3} - */ - center: Vector3; - /** - * The radius of the sphere. - * - * @type {number} - */ - radius: number; - /** - * Sets the sphere's components by copying the given values. - * - * @param {Vector3} center - The center. - * @param {number} radius - The radius. - * @return {Sphere} A reference to this sphere. - */ - set(center: Vector3, radius: number): Sphere; - /** - * Computes the minimum bounding sphere for list of points. - * If the optional center point is given, it is used as the sphere's - * center. Otherwise, the center of the axis-aligned bounding box - * encompassing the points is calculated. - * - * @param {Array} points - A list of points in 3D space. - * @param {Vector3} [optionalCenter] - The center of the sphere. - * @return {Sphere} A reference to this sphere. - */ - setFromPoints(points: Array, optionalCenter?: Vector3): Sphere; - /** - * Copies the values of the given sphere to this instance. - * - * @param {Sphere} sphere - The sphere to copy. - * @return {Sphere} A reference to this sphere. - */ - copy(sphere: Sphere): Sphere; - /** - * Returns `true` if the sphere is empty (the radius set to a negative number). - * - * Spheres with a radius of `0` contain only their center point and are not - * considered to be empty. - * - * @return {boolean} Whether this sphere is empty or not. - */ - isEmpty(): boolean; - /** - * Makes this sphere empty which means in encloses a zero space in 3D. - * - * @return {Sphere} A reference to this sphere. - */ - makeEmpty(): Sphere; - /** - * Returns `true` if this sphere contains the given point inclusive of - * the surface of the sphere. - * - * @param {Vector3} point - The point to check. - * @return {boolean} Whether this sphere contains the given point or not. - */ - containsPoint(point: Vector3): boolean; - /** - * Returns the closest distance from the boundary of the sphere to the - * given point. If the sphere contains the point, the distance will - * be negative. - * - * @param {Vector3} point - The point to compute the distance to. - * @return {number} The distance to the point. - */ - distanceToPoint(point: Vector3): number; - /** - * Returns `true` if this sphere intersects with the given one. - * - * @param {Sphere} sphere - The sphere to test. - * @return {boolean} Whether this sphere intersects with the given one or not. - */ - intersectsSphere(sphere: Sphere): boolean; - /** - * Returns `true` if this sphere intersects with the given box. - * - * @param {Box3} box - The box to test. - * @return {boolean} Whether this sphere intersects with the given box or not. - */ - intersectsBox(box: Box3): boolean; - /** - * Returns `true` if this sphere intersects with the given plane. - * - * @param {Plane} plane - The plane to test. - * @return {boolean} Whether this sphere intersects with the given plane or not. - */ - intersectsPlane(plane: Plane): boolean; - /** - * Clamps a point within the sphere. If the point is outside the sphere, it - * will clamp it to the closest point on the edge of the sphere. Points - * already inside the sphere will not be affected. - * - * @param {Vector3} point - The plane to clamp. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The clamped point. - */ - clampPoint(point: Vector3, target: Vector3): Vector3; - /** - * Returns a bounding box that encloses this sphere. - * - * @param {Box3} target - The target box that is used to store the method's result. - * @return {Box3} The bounding box that encloses this sphere. - */ - getBoundingBox(target: Box3): Box3; - /** - * Transforms this sphere with the given 4x4 transformation matrix. - * - * @param {Matrix4} matrix - The transformation matrix. - * @return {Sphere} A reference to this sphere. - */ - applyMatrix4(matrix: Matrix4): Sphere; - /** - * Translates the sphere's center by the given offset. - * - * @param {Vector3} offset - The offset. - * @return {Sphere} A reference to this sphere. - */ - translate(offset: Vector3): Sphere; - /** - * Expands the boundaries of this sphere to include the given point. - * - * @param {Vector3} point - The point to include. - * @return {Sphere} A reference to this sphere. - */ - expandByPoint(point: Vector3): Sphere; - /** - * Expands this sphere to enclose both the original sphere and the given sphere. - * - * @param {Sphere} sphere - The sphere to include. - * @return {Sphere} A reference to this sphere. - */ - union(sphere: Sphere): Sphere; - /** - * Returns `true` if this sphere is equal with the given one. - * - * @param {Sphere} sphere - The sphere to test for equality. - * @return {boolean} Whether this bounding sphere is equal with the given one. - */ - equals(sphere: Sphere): boolean; - /** - * Returns a new sphere with copied values from this instance. - * - * @return {Sphere} A clone of this instance. - */ - clone(): Sphere; - /** - * Returns a serialized structure of the bounding sphere. - * - * @return {Object} Serialized structure with fields representing the object state. - */ - toJSON(): Object; - /** - * Returns a serialized structure of the bounding sphere. - * - * @param {Object} json - The serialized json to set the sphere from. - * @return {Sphere} A reference to this bounding sphere. - */ - fromJSON(json: Object): Sphere; -} -import { Vector3 } from './Vector3.js'; -import { Box3 } from './Box3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Spherical.d.ts b/jsdoc-testing/jsdoc/src/math/Spherical.d.ts deleted file mode 100644 index 300c0481a..000000000 --- a/jsdoc-testing/jsdoc/src/math/Spherical.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * This class can be used to represent points in 3D space as - * [Spherical coordinates](https://en.wikipedia.org/wiki/Spherical_coordinate_system). - */ -export class Spherical { - /** - * Constructs a new spherical. - * - * @param {number} [radius=1] - The radius, or the Euclidean distance (straight-line distance) from the point to the origin. - * @param {number} [phi=0] - The polar angle in radians from the y (up) axis. - * @param {number} [theta=0] - The equator/azimuthal angle in radians around the y (up) axis. - */ - constructor(radius?: number, phi?: number, theta?: number); - /** - * The radius, or the Euclidean distance (straight-line distance) from the point to the origin. - * - * @type {number} - * @default 1 - */ - radius: number; - /** - * The polar angle in radians from the y (up) axis. - * - * @type {number} - * @default 0 - */ - phi: number; - /** - * The equator/azimuthal angle in radians around the y (up) axis. - * - * @type {number} - * @default 0 - */ - theta: number; - /** - * Sets the spherical components by copying the given values. - * - * @param {number} radius - The radius. - * @param {number} phi - The polar angle. - * @param {number} theta - The azimuthal angle. - * @return {Spherical} A reference to this spherical. - */ - set(radius: number, phi: number, theta: number): Spherical; - /** - * Copies the values of the given spherical to this instance. - * - * @param {Spherical} other - The spherical to copy. - * @return {Spherical} A reference to this spherical. - */ - copy(other: Spherical): Spherical; - /** - * Restricts the polar angle [page:.phi phi] to be between `0.000001` and pi - - * `0.000001`. - * - * @return {Spherical} A reference to this spherical. - */ - makeSafe(): Spherical; - /** - * Sets the spherical components from the given vector which is assumed to hold - * Cartesian coordinates. - * - * @param {Vector3} v - The vector to set. - * @return {Spherical} A reference to this spherical. - */ - setFromVector3(v: Vector3): Spherical; - /** - * Sets the spherical components from the given Cartesian coordinates. - * - * @param {number} x - The x value. - * @param {number} y - The y value. - * @param {number} z - The z value. - * @return {Spherical} A reference to this spherical. - */ - setFromCartesianCoords(x: number, y: number, z: number): Spherical; - /** - * Returns a new spherical with copied values from this instance. - * - * @return {Spherical} A clone of this instance. - */ - clone(): Spherical; -} diff --git a/jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts b/jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts deleted file mode 100644 index 307ff49fa..000000000 --- a/jsdoc-testing/jsdoc/src/math/SphericalHarmonics3.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Represents a third-order spherical harmonics (SH). Light probes use this class - * to encode lighting information. - * - * - Primary reference: {@link https://graphics.stanford.edu/papers/envmap/envmap.pdf} - * - Secondary reference: {@link https://www.ppsloan.org/publications/StupidSH36.pdf} - */ -export class SphericalHarmonics3 { - /** - * Computes the SH basis for the given normal vector. - * - * @param {Vector3} normal - The normal. - * @param {Array} shBasis - The target array holding the SH basis. - */ - static getBasisAt(normal: Vector3, shBasis: Array): void; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSphericalHarmonics3: boolean; - /** - * An array holding the (9) SH coefficients. - * - * @type {Array} - */ - coefficients: Array; - /** - * Sets the given SH coefficients to this instance by copying - * the values. - * - * @param {Array} coefficients - The SH coefficients. - * @return {SphericalHarmonics3} A reference to this spherical harmonics. - */ - set(coefficients: Array): SphericalHarmonics3; - /** - * Sets all SH coefficients to `0`. - * - * @return {SphericalHarmonics3} A reference to this spherical harmonics. - */ - zero(): SphericalHarmonics3; - /** - * Returns the radiance in the direction of the given normal. - * - * @param {Vector3} normal - The normal vector (assumed to be unit length) - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The radiance. - */ - getAt(normal: Vector3, target: Vector3): Vector3; - /** - * Returns the irradiance (radiance convolved with cosine lobe) in the - * direction of the given normal. - * - * @param {Vector3} normal - The normal vector (assumed to be unit length) - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The irradiance. - */ - getIrradianceAt(normal: Vector3, target: Vector3): Vector3; - /** - * Adds the given SH to this instance. - * - * @param {SphericalHarmonics3} sh - The SH to add. - * @return {SphericalHarmonics3} A reference to this spherical harmonics. - */ - add(sh: SphericalHarmonics3): SphericalHarmonics3; - /** - * A convenience method for performing {@link SphericalHarmonics3#add} and - * {@link SphericalHarmonics3#scale} at once. - * - * @param {SphericalHarmonics3} sh - The SH to add. - * @param {number} s - The scale factor. - * @return {SphericalHarmonics3} A reference to this spherical harmonics. - */ - addScaledSH(sh: SphericalHarmonics3, s: number): SphericalHarmonics3; - /** - * Scales this SH by the given scale factor. - * - * @param {number} s - The scale factor. - * @return {SphericalHarmonics3} A reference to this spherical harmonics. - */ - scale(s: number): SphericalHarmonics3; - /** - * Linear interpolates between the given SH and this instance by the given - * alpha factor. - * - * @param {SphericalHarmonics3} sh - The SH to interpolate with. - * @param {number} alpha - The alpha factor. - * @return {SphericalHarmonics3} A reference to this spherical harmonics. - */ - lerp(sh: SphericalHarmonics3, alpha: number): SphericalHarmonics3; - /** - * Returns `true` if this spherical harmonics is equal with the given one. - * - * @param {SphericalHarmonics3} sh - The spherical harmonics to test for equality. - * @return {boolean} Whether this spherical harmonics is equal with the given one. - */ - equals(sh: SphericalHarmonics3): boolean; - /** - * Copies the values of the given spherical harmonics to this instance. - * - * @param {SphericalHarmonics3} sh - The spherical harmonics to copy. - * @return {SphericalHarmonics3} A reference to this spherical harmonics. - */ - copy(sh: SphericalHarmonics3): SphericalHarmonics3; - /** - * Returns a new spherical harmonics with copied values from this instance. - * - * @return {SphericalHarmonics3} A clone of this instance. - */ - clone(): SphericalHarmonics3; - /** - * Sets the SH coefficients of this instance from the given array. - * - * @param {Array} array - An array holding the SH coefficients. - * @param {number} [offset=0] - The array offset where to start copying. - * @return {SphericalHarmonics3} A clone of this instance. - */ - fromArray(array: Array, offset?: number): SphericalHarmonics3; - /** - * Returns an array with the SH coefficients, or copies them into the provided - * array. The coefficients are represented as numbers. - * - * @param {Array} [array=[]] - The target array. - * @param {number} [offset=0] - The array offset where to start copying. - * @return {Array} An array with flat SH coefficients. - */ - toArray(array?: Array, offset?: number): Array; -} -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Triangle.d.ts b/jsdoc-testing/jsdoc/src/math/Triangle.d.ts deleted file mode 100644 index 3841d3852..000000000 --- a/jsdoc-testing/jsdoc/src/math/Triangle.d.ts +++ /dev/null @@ -1,231 +0,0 @@ -/** - * A geometric triangle as defined by three vectors representing its three corners. - */ -export class Triangle { - /** - * Computes the normal vector of a triangle. - * - * @param {Vector3} a - The first corner of the triangle. - * @param {Vector3} b - The second corner of the triangle. - * @param {Vector3} c - The third corner of the triangle. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The triangle's normal. - */ - static getNormal(a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3; - /** - * Computes a barycentric coordinates from the given vector. - * Returns `null` if the triangle is degenerate. - * - * @param {Vector3} point - A point in 3D space. - * @param {Vector3} a - The first corner of the triangle. - * @param {Vector3} b - The second corner of the triangle. - * @param {Vector3} c - The third corner of the triangle. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The barycentric coordinates for the given point - */ - static getBarycoord(point: Vector3, a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3 | null; - /** - * Returns `true` if the given point, when projected onto the plane of the - * triangle, lies within the triangle. - * - * @param {Vector3} point - The point in 3D space to test. - * @param {Vector3} a - The first corner of the triangle. - * @param {Vector3} b - The second corner of the triangle. - * @param {Vector3} c - The third corner of the triangle. - * @return {boolean} Whether the given point, when projected onto the plane of the - * triangle, lies within the triangle or not. - */ - static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean; - /** - * Computes the value barycentrically interpolated for the given point on the - * triangle. Returns `null` if the triangle is degenerate. - * - * @param {Vector3} point - Position of interpolated point. - * @param {Vector3} p1 - The first corner of the triangle. - * @param {Vector3} p2 - The second corner of the triangle. - * @param {Vector3} p3 - The third corner of the triangle. - * @param {Vector3} v1 - Value to interpolate of first vertex. - * @param {Vector3} v2 - Value to interpolate of second vertex. - * @param {Vector3} v3 - Value to interpolate of third vertex. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The interpolated value. - */ - static getInterpolation(point: Vector3, p1: Vector3, p2: Vector3, p3: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, target: Vector3): Vector3 | null; - /** - * Computes the value barycentrically interpolated for the given attribute and indices. - * - * @param {BufferAttribute} attr - The attribute to interpolate. - * @param {number} i1 - Index of first vertex. - * @param {number} i2 - Index of second vertex. - * @param {number} i3 - Index of third vertex. - * @param {Vector3} barycoord - The barycoordinate value to use to interpolate. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The interpolated attribute value. - */ - static getInterpolatedAttribute(attr: BufferAttribute, i1: number, i2: number, i3: number, barycoord: Vector3, target: Vector3): Vector3; - /** - * Returns `true` if the triangle is oriented towards the given direction. - * - * @param {Vector3} a - The first corner of the triangle. - * @param {Vector3} b - The second corner of the triangle. - * @param {Vector3} c - The third corner of the triangle. - * @param {Vector3} direction - The (normalized) direction vector. - * @return {boolean} Whether the triangle is oriented towards the given direction or not. - */ - static isFrontFacing(a: Vector3, b: Vector3, c: Vector3, direction: Vector3): boolean; - /** - * Constructs a new triangle. - * - * @param {Vector3} [a=(0,0,0)] - The first corner of the triangle. - * @param {Vector3} [b=(0,0,0)] - The second corner of the triangle. - * @param {Vector3} [c=(0,0,0)] - The third corner of the triangle. - */ - constructor(a?: Vector3, b?: Vector3, c?: Vector3); - /** - * The first corner of the triangle. - * - * @type {Vector3} - */ - a: Vector3; - /** - * The second corner of the triangle. - * - * @type {Vector3} - */ - b: Vector3; - /** - * The third corner of the triangle. - * - * @type {Vector3} - */ - c: Vector3; - /** - * Sets the triangle's vertices by copying the given values. - * - * @param {Vector3} a - The first corner of the triangle. - * @param {Vector3} b - The second corner of the triangle. - * @param {Vector3} c - The third corner of the triangle. - * @return {Triangle} A reference to this triangle. - */ - set(a: Vector3, b: Vector3, c: Vector3): Triangle; - /** - * Sets the triangle's vertices by copying the given array values. - * - * @param {Array} points - An array with 3D points. - * @param {number} i0 - The array index representing the first corner of the triangle. - * @param {number} i1 - The array index representing the second corner of the triangle. - * @param {number} i2 - The array index representing the third corner of the triangle. - * @return {Triangle} A reference to this triangle. - */ - setFromPointsAndIndices(points: Array, i0: number, i1: number, i2: number): Triangle; - /** - * Sets the triangle's vertices by copying the given attribute values. - * - * @param {BufferAttribute} attribute - A buffer attribute with 3D points data. - * @param {number} i0 - The attribute index representing the first corner of the triangle. - * @param {number} i1 - The attribute index representing the second corner of the triangle. - * @param {number} i2 - The attribute index representing the third corner of the triangle. - * @return {Triangle} A reference to this triangle. - */ - setFromAttributeAndIndices(attribute: BufferAttribute, i0: number, i1: number, i2: number): Triangle; - /** - * Returns a new triangle with copied values from this instance. - * - * @return {Triangle} A clone of this instance. - */ - clone(): Triangle; - /** - * Copies the values of the given triangle to this instance. - * - * @param {Triangle} triangle - The triangle to copy. - * @return {Triangle} A reference to this triangle. - */ - copy(triangle: Triangle): Triangle; - /** - * Computes the area of the triangle. - * - * @return {number} The triangle's area. - */ - getArea(): number; - /** - * Computes the midpoint of the triangle. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The triangle's midpoint. - */ - getMidpoint(target: Vector3): Vector3; - /** - * Computes the normal of the triangle. - * - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The triangle's normal. - */ - getNormal(target: Vector3): Vector3; - /** - * Computes a plane the triangle lies within. - * - * @param {Plane} target - The target vector that is used to store the method's result. - * @return {Plane} The plane the triangle lies within. - */ - getPlane(target: Plane): Plane; - /** - * Computes a barycentric coordinates from the given vector. - * Returns `null` if the triangle is degenerate. - * - * @param {Vector3} point - A point in 3D space. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The barycentric coordinates for the given point - */ - getBarycoord(point: Vector3, target: Vector3): Vector3 | null; - /** - * Computes the value barycentrically interpolated for the given point on the - * triangle. Returns `null` if the triangle is degenerate. - * - * @param {Vector3} point - Position of interpolated point. - * @param {Vector3} v1 - Value to interpolate of first vertex. - * @param {Vector3} v2 - Value to interpolate of second vertex. - * @param {Vector3} v3 - Value to interpolate of third vertex. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {?Vector3} The interpolated value. - */ - getInterpolation(point: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, target: Vector3): Vector3 | null; - /** - * Returns `true` if the given point, when projected onto the plane of the - * triangle, lies within the triangle. - * - * @param {Vector3} point - The point in 3D space to test. - * @return {boolean} Whether the given point, when projected onto the plane of the - * triangle, lies within the triangle or not. - */ - containsPoint(point: Vector3): boolean; - /** - * Returns `true` if the triangle is oriented towards the given direction. - * - * @param {Vector3} direction - The (normalized) direction vector. - * @return {boolean} Whether the triangle is oriented towards the given direction or not. - */ - isFrontFacing(direction: Vector3): boolean; - /** - * Returns `true` if this triangle intersects with the given box. - * - * @param {Box3} box - The box to intersect. - * @return {boolean} Whether this triangle intersects with the given box or not. - */ - intersectsBox(box: Box3): boolean; - /** - * Returns the closest point on the triangle to the given point. - * - * @param {Vector3} p - The point to compute the closest point for. - * @param {Vector3} target - The target vector that is used to store the method's result. - * @return {Vector3} The closest point on the triangle. - */ - closestPointToPoint(p: Vector3, target: Vector3): Vector3; - /** - * Returns `true` if this triangle is equal with the given one. - * - * @param {Triangle} triangle - The triangle to test for equality. - * @return {boolean} Whether this triangle is equal with the given one. - */ - equals(triangle: Triangle): boolean; -} -import { Vector3 } from './Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Vector2.d.ts b/jsdoc-testing/jsdoc/src/math/Vector2.d.ts deleted file mode 100644 index aeaeb509d..000000000 --- a/jsdoc-testing/jsdoc/src/math/Vector2.d.ts +++ /dev/null @@ -1,440 +0,0 @@ -/** - * Class representing a 2D vector. A 2D vector is an ordered pair of numbers - * (labeled x and y), which can be used to represent a number of things, such as: - * - * - A point in 2D space (i.e. a position on a plane). - * - A direction and length across a plane. In three.js the length will - * always be the Euclidean distance(straight-line distance) from `(0, 0)` to `(x, y)` - * and the direction is also measured from `(0, 0)` towards `(x, y)`. - * - Any arbitrary ordered pair of numbers. - * - * There are other things a 2D vector can be used to represent, such as - * momentum vectors, complex numbers and so on, however these are the most - * common uses in three.js. - * - * Iterating through a vector instance will yield its components `(x, y)` in - * the corresponding order. - * ```js - * const a = new THREE.Vector2( 0, 1 ); - * - * //no arguments; will be initialised to (0, 0) - * const b = new THREE.Vector2( ); - * - * const d = a.distanceTo( b ); - * ``` - */ -export class Vector2 { - /** - * Constructs a new 2D vector. - * - * @param {number} [x=0] - The x value of this vector. - * @param {number} [y=0] - The y value of this vector. - */ - constructor(x?: number, y?: number); - /** - * The x value of this vector. - * - * @type {number} - */ - x: number; - /** - * The y value of this vector. - * - * @type {number} - */ - y: number; - set width(value: number); - /** - * Alias for {@link Vector2#x}. - * - * @type {number} - */ - get width(): number; - set height(value: number); - /** - * Alias for {@link Vector2#y}. - * - * @type {number} - */ - get height(): number; - /** - * Sets the vector components. - * - * @param {number} x - The value of the x component. - * @param {number} y - The value of the y component. - * @return {Vector2} A reference to this vector. - */ - set(x: number, y: number): Vector2; - /** - * Sets the vector components to the same value. - * - * @param {number} scalar - The value to set for all vector components. - * @return {Vector2} A reference to this vector. - */ - setScalar(scalar: number): Vector2; - /** - * Sets the vector's x component to the given value - * - * @param {number} x - The value to set. - * @return {Vector2} A reference to this vector. - */ - setX(x: number): Vector2; - /** - * Sets the vector's y component to the given value - * - * @param {number} y - The value to set. - * @return {Vector2} A reference to this vector. - */ - setY(y: number): Vector2; - /** - * Allows to set a vector component with an index. - * - * @param {number} index - The component index. `0` equals to x, `1` equals to y. - * @param {number} value - The value to set. - * @return {Vector2} A reference to this vector. - */ - setComponent(index: number, value: number): Vector2; - /** - * Returns the value of the vector component which matches the given index. - * - * @param {number} index - The component index. `0` equals to x, `1` equals to y. - * @return {number} A vector component value. - */ - getComponent(index: number): number; - /** - * Returns a new vector with copied values from this instance. - * - * @return {Vector2} A clone of this instance. - */ - clone(): Vector2; - /** - * Copies the values of the given vector to this instance. - * - * @param {Vector2} v - The vector to copy. - * @return {Vector2} A reference to this vector. - */ - copy(v: Vector2): Vector2; - /** - * Adds the given vector to this instance. - * - * @param {Vector2} v - The vector to add. - * @return {Vector2} A reference to this vector. - */ - add(v: Vector2): Vector2; - /** - * Adds the given scalar value to all components of this instance. - * - * @param {number} s - The scalar to add. - * @return {Vector2} A reference to this vector. - */ - addScalar(s: number): Vector2; - /** - * Adds the given vectors and stores the result in this instance. - * - * @param {Vector2} a - The first vector. - * @param {Vector2} b - The second vector. - * @return {Vector2} A reference to this vector. - */ - addVectors(a: Vector2, b: Vector2): Vector2; - /** - * Adds the given vector scaled by the given factor to this instance. - * - * @param {Vector2} v - The vector. - * @param {number} s - The factor that scales `v`. - * @return {Vector2} A reference to this vector. - */ - addScaledVector(v: Vector2, s: number): Vector2; - /** - * Subtracts the given vector from this instance. - * - * @param {Vector2} v - The vector to subtract. - * @return {Vector2} A reference to this vector. - */ - sub(v: Vector2): Vector2; - /** - * Subtracts the given scalar value from all components of this instance. - * - * @param {number} s - The scalar to subtract. - * @return {Vector2} A reference to this vector. - */ - subScalar(s: number): Vector2; - /** - * Subtracts the given vectors and stores the result in this instance. - * - * @param {Vector2} a - The first vector. - * @param {Vector2} b - The second vector. - * @return {Vector2} A reference to this vector. - */ - subVectors(a: Vector2, b: Vector2): Vector2; - /** - * Multiplies the given vector with this instance. - * - * @param {Vector2} v - The vector to multiply. - * @return {Vector2} A reference to this vector. - */ - multiply(v: Vector2): Vector2; - /** - * Multiplies the given scalar value with all components of this instance. - * - * @param {number} scalar - The scalar to multiply. - * @return {Vector2} A reference to this vector. - */ - multiplyScalar(scalar: number): Vector2; - /** - * Divides this instance by the given vector. - * - * @param {Vector2} v - The vector to divide. - * @return {Vector2} A reference to this vector. - */ - divide(v: Vector2): Vector2; - /** - * Divides this vector by the given scalar. - * - * @param {number} scalar - The scalar to divide. - * @return {Vector2} A reference to this vector. - */ - divideScalar(scalar: number): Vector2; - /** - * Multiplies this vector (with an implicit 1 as the 3rd component) by - * the given 3x3 matrix. - * - * @param {Matrix3} m - The matrix to apply. - * @return {Vector2} A reference to this vector. - */ - applyMatrix3(m: Matrix3): Vector2; - /** - * If this vector's x or y value is greater than the given vector's x or y - * value, replace that value with the corresponding min value. - * - * @param {Vector2} v - The vector. - * @return {Vector2} A reference to this vector. - */ - min(v: Vector2): Vector2; - /** - * If this vector's x or y value is less than the given vector's x or y - * value, replace that value with the corresponding max value. - * - * @param {Vector2} v - The vector. - * @return {Vector2} A reference to this vector. - */ - max(v: Vector2): Vector2; - /** - * If this vector's x or y value is greater than the max vector's x or y - * value, it is replaced by the corresponding value. - * If this vector's x or y value is less than the min vector's x or y value, - * it is replaced by the corresponding value. - * - * @param {Vector2} min - The minimum x and y values. - * @param {Vector2} max - The maximum x and y values in the desired range. - * @return {Vector2} A reference to this vector. - */ - clamp(min: Vector2, max: Vector2): Vector2; - /** - * If this vector's x or y values are greater than the max value, they are - * replaced by the max value. - * If this vector's x or y values are less than the min value, they are - * replaced by the min value. - * - * @param {number} minVal - The minimum value the components will be clamped to. - * @param {number} maxVal - The maximum value the components will be clamped to. - * @return {Vector2} A reference to this vector. - */ - clampScalar(minVal: number, maxVal: number): Vector2; - /** - * If this vector's length is greater than the max value, it is replaced by - * the max value. - * If this vector's length is less than the min value, it is replaced by the - * min value. - * - * @param {number} min - The minimum value the vector length will be clamped to. - * @param {number} max - The maximum value the vector length will be clamped to. - * @return {Vector2} A reference to this vector. - */ - clampLength(min: number, max: number): Vector2; - /** - * The components of this vector are rounded down to the nearest integer value. - * - * @return {Vector2} A reference to this vector. - */ - floor(): Vector2; - /** - * The components of this vector are rounded up to the nearest integer value. - * - * @return {Vector2} A reference to this vector. - */ - ceil(): Vector2; - /** - * The components of this vector are rounded to the nearest integer value - * - * @return {Vector2} A reference to this vector. - */ - round(): Vector2; - /** - * The components of this vector are rounded towards zero (up if negative, - * down if positive) to an integer value. - * - * @return {Vector2} A reference to this vector. - */ - roundToZero(): Vector2; - /** - * Inverts this vector - i.e. sets x = -x and y = -y. - * - * @return {Vector2} A reference to this vector. - */ - negate(): Vector2; - /** - * Calculates the dot product of the given vector with this instance. - * - * @param {Vector2} v - The vector to compute the dot product with. - * @return {number} The result of the dot product. - */ - dot(v: Vector2): number; - /** - * Calculates the cross product of the given vector with this instance. - * - * @param {Vector2} v - The vector to compute the cross product with. - * @return {number} The result of the cross product. - */ - cross(v: Vector2): number; - /** - * Computes the square of the Euclidean length (straight-line length) from - * (0, 0) to (x, y). If you are comparing the lengths of vectors, you should - * compare the length squared instead as it is slightly more efficient to calculate. - * - * @return {number} The square length of this vector. - */ - lengthSq(): number; - /** - * Computes the Euclidean length (straight-line length) from (0, 0) to (x, y). - * - * @return {number} The length of this vector. - */ - length(): number; - /** - * Computes the Manhattan length of this vector. - * - * @return {number} The length of this vector. - */ - manhattanLength(): number; - /** - * Converts this vector to a unit vector - that is, sets it equal to a vector - * with the same direction as this one, but with a vector length of `1`. - * - * @return {Vector2} A reference to this vector. - */ - normalize(): Vector2; - /** - * Computes the angle in radians of this vector with respect to the positive x-axis. - * - * @return {number} The angle in radians. - */ - angle(): number; - /** - * Returns the angle between the given vector and this instance in radians. - * - * @param {Vector2} v - The vector to compute the angle with. - * @return {number} The angle in radians. - */ - angleTo(v: Vector2): number; - /** - * Computes the distance from the given vector to this instance. - * - * @param {Vector2} v - The vector to compute the distance to. - * @return {number} The distance. - */ - distanceTo(v: Vector2): number; - /** - * Computes the squared distance from the given vector to this instance. - * If you are just comparing the distance with another distance, you should compare - * the distance squared instead as it is slightly more efficient to calculate. - * - * @param {Vector2} v - The vector to compute the squared distance to. - * @return {number} The squared distance. - */ - distanceToSquared(v: Vector2): number; - /** - * Computes the Manhattan distance from the given vector to this instance. - * - * @param {Vector2} v - The vector to compute the Manhattan distance to. - * @return {number} The Manhattan distance. - */ - manhattanDistanceTo(v: Vector2): number; - /** - * Sets this vector to a vector with the same direction as this one, but - * with the specified length. - * - * @param {number} length - The new length of this vector. - * @return {Vector2} A reference to this vector. - */ - setLength(length: number): Vector2; - /** - * Linearly interpolates between the given vector and this instance, where - * alpha is the percent distance along the line - alpha = 0 will be this - * vector, and alpha = 1 will be the given one. - * - * @param {Vector2} v - The vector to interpolate towards. - * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. - * @return {Vector2} A reference to this vector. - */ - lerp(v: Vector2, alpha: number): Vector2; - /** - * Linearly interpolates between the given vectors, where alpha is the percent - * distance along the line - alpha = 0 will be first vector, and alpha = 1 will - * be the second one. The result is stored in this instance. - * - * @param {Vector2} v1 - The first vector. - * @param {Vector2} v2 - The second vector. - * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. - * @return {Vector2} A reference to this vector. - */ - lerpVectors(v1: Vector2, v2: Vector2, alpha: number): Vector2; - /** - * Returns `true` if this vector is equal with the given one. - * - * @param {Vector2} v - The vector to test for equality. - * @return {boolean} Whether this vector is equal with the given one. - */ - equals(v: Vector2): boolean; - /** - * Sets this vector's x value to be `array[ offset ]` and y - * value to be `array[ offset + 1 ]`. - * - * @param {Array} array - An array holding the vector component values. - * @param {number} [offset=0] - The offset into the array. - * @return {Vector2} A reference to this vector. - */ - fromArray(array: Array, offset?: number): Vector2; - /** - * Writes the components of this vector to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the vector components. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The vector components. - */ - toArray(array?: Array, offset?: number): Array; - /** - * Sets the components of this vector from the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute holding vector data. - * @param {number} index - The index into the attribute. - * @return {Vector2} A reference to this vector. - */ - fromBufferAttribute(attribute: BufferAttribute, index: number): Vector2; - /** - * Rotates this vector around the given center by the given angle. - * - * @param {Vector2} center - The point around which to rotate. - * @param {number} angle - The angle to rotate, in radians. - * @return {Vector2} A reference to this vector. - */ - rotateAround(center: Vector2, angle: number): Vector2; - /** - * Sets each component of this vector to a pseudo-random value between `0` and - * `1`, excluding `1`. - * - * @return {Vector2} A reference to this vector. - */ - random(): Vector2; - [Symbol.iterator](): Generator; -} diff --git a/jsdoc-testing/jsdoc/src/math/Vector3.d.ts b/jsdoc-testing/jsdoc/src/math/Vector3.d.ts deleted file mode 100644 index c102e1d72..000000000 --- a/jsdoc-testing/jsdoc/src/math/Vector3.d.ts +++ /dev/null @@ -1,613 +0,0 @@ -/** - * Class representing a 3D vector. A 3D vector is an ordered triplet of numbers - * (labeled x, y and z), which can be used to represent a number of things, such as: - * - * - A point in 3D space. - * - A direction and length in 3D space. In three.js the length will - * always be the Euclidean distance(straight-line distance) from `(0, 0, 0)` to `(x, y, z)` - * and the direction is also measured from `(0, 0, 0)` towards `(x, y, z)`. - * - Any arbitrary ordered triplet of numbers. - * - * There are other things a 3D vector can be used to represent, such as - * momentum vectors and so on, however these are the most - * common uses in three.js. - * - * Iterating through a vector instance will yield its components `(x, y, z)` in - * the corresponding order. - * ```js - * const a = new THREE.Vector3( 0, 1, 0 ); - * - * //no arguments; will be initialised to (0, 0, 0) - * const b = new THREE.Vector3( ); - * - * const d = a.distanceTo( b ); - * ``` - */ -export class Vector3 { - /** - * Constructs a new 3D vector. - * - * @param {number} [x=0] - The x value of this vector. - * @param {number} [y=0] - The y value of this vector. - * @param {number} [z=0] - The z value of this vector. - */ - constructor(x?: number, y?: number, z?: number); - /** - * The x value of this vector. - * - * @type {number} - */ - x: number; - /** - * The y value of this vector. - * - * @type {number} - */ - y: number; - /** - * The z value of this vector. - * - * @type {number} - */ - z: number; - /** - * Sets the vector components. - * - * @param {number} x - The value of the x component. - * @param {number} y - The value of the y component. - * @param {number} z - The value of the z component. - * @return {Vector3} A reference to this vector. - */ - set(x: number, y: number, z: number): Vector3; - /** - * Sets the vector components to the same value. - * - * @param {number} scalar - The value to set for all vector components. - * @return {Vector3} A reference to this vector. - */ - setScalar(scalar: number): Vector3; - /** - * Sets the vector's x component to the given value. - * - * @param {number} x - The value to set. - * @return {Vector3} A reference to this vector. - */ - setX(x: number): Vector3; - /** - * Sets the vector's y component to the given value. - * - * @param {number} y - The value to set. - * @return {Vector3} A reference to this vector. - */ - setY(y: number): Vector3; - /** - * Sets the vector's z component to the given value. - * - * @param {number} z - The value to set. - * @return {Vector3} A reference to this vector. - */ - setZ(z: number): Vector3; - /** - * Allows to set a vector component with an index. - * - * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z. - * @param {number} value - The value to set. - * @return {Vector3} A reference to this vector. - */ - setComponent(index: number, value: number): Vector3; - /** - * Returns the value of the vector component which matches the given index. - * - * @param {number} index - The component index. `0` equals to x, `1` equals to y, `2` equals to z. - * @return {number} A vector component value. - */ - getComponent(index: number): number; - /** - * Returns a new vector with copied values from this instance. - * - * @return {Vector3} A clone of this instance. - */ - clone(): Vector3; - /** - * Copies the values of the given vector to this instance. - * - * @param {Vector3} v - The vector to copy. - * @return {Vector3} A reference to this vector. - */ - copy(v: Vector3): Vector3; - /** - * Adds the given vector to this instance. - * - * @param {Vector3} v - The vector to add. - * @return {Vector3} A reference to this vector. - */ - add(v: Vector3): Vector3; - /** - * Adds the given scalar value to all components of this instance. - * - * @param {number} s - The scalar to add. - * @return {Vector3} A reference to this vector. - */ - addScalar(s: number): Vector3; - /** - * Adds the given vectors and stores the result in this instance. - * - * @param {Vector3} a - The first vector. - * @param {Vector3} b - The second vector. - * @return {Vector3} A reference to this vector. - */ - addVectors(a: Vector3, b: Vector3): Vector3; - /** - * Adds the given vector scaled by the given factor to this instance. - * - * @param {Vector3|Vector4} v - The vector. - * @param {number} s - The factor that scales `v`. - * @return {Vector3} A reference to this vector. - */ - addScaledVector(v: Vector3 | Vector4, s: number): Vector3; - /** - * Subtracts the given vector from this instance. - * - * @param {Vector3} v - The vector to subtract. - * @return {Vector3} A reference to this vector. - */ - sub(v: Vector3): Vector3; - /** - * Subtracts the given scalar value from all components of this instance. - * - * @param {number} s - The scalar to subtract. - * @return {Vector3} A reference to this vector. - */ - subScalar(s: number): Vector3; - /** - * Subtracts the given vectors and stores the result in this instance. - * - * @param {Vector3} a - The first vector. - * @param {Vector3} b - The second vector. - * @return {Vector3} A reference to this vector. - */ - subVectors(a: Vector3, b: Vector3): Vector3; - /** - * Multiplies the given vector with this instance. - * - * @param {Vector3} v - The vector to multiply. - * @return {Vector3} A reference to this vector. - */ - multiply(v: Vector3): Vector3; - /** - * Multiplies the given scalar value with all components of this instance. - * - * @param {number} scalar - The scalar to multiply. - * @return {Vector3} A reference to this vector. - */ - multiplyScalar(scalar: number): Vector3; - /** - * Multiplies the given vectors and stores the result in this instance. - * - * @param {Vector3} a - The first vector. - * @param {Vector3} b - The second vector. - * @return {Vector3} A reference to this vector. - */ - multiplyVectors(a: Vector3, b: Vector3): Vector3; - /** - * Applies the given Euler rotation to this vector. - * - * @param {Euler} euler - The Euler angles. - * @return {Vector3} A reference to this vector. - */ - applyEuler(euler: Euler): Vector3; - /** - * Applies a rotation specified by an axis and an angle to this vector. - * - * @param {Vector3} axis - A normalized vector representing the rotation axis. - * @param {number} angle - The angle in radians. - * @return {Vector3} A reference to this vector. - */ - applyAxisAngle(axis: Vector3, angle: number): Vector3; - /** - * Multiplies this vector with the given 3x3 matrix. - * - * @param {Matrix3} m - The 3x3 matrix. - * @return {Vector3} A reference to this vector. - */ - applyMatrix3(m: Matrix3): Vector3; - /** - * Multiplies this vector by the given normal matrix and normalizes - * the result. - * - * @param {Matrix3} m - The normal matrix. - * @return {Vector3} A reference to this vector. - */ - applyNormalMatrix(m: Matrix3): Vector3; - /** - * Multiplies this vector (with an implicit 1 in the 4th dimension) by m, and - * divides by perspective. - * - * @param {Matrix4} m - The matrix to apply. - * @return {Vector3} A reference to this vector. - */ - applyMatrix4(m: Matrix4): Vector3; - /** - * Applies the given Quaternion to this vector. - * - * @param {Quaternion} q - The Quaternion. - * @return {Vector3} A reference to this vector. - */ - applyQuaternion(q: Quaternion): Vector3; - /** - * Projects this vector from world space into the camera's normalized - * device coordinate (NDC) space. - * - * @param {Camera} camera - The camera. - * @return {Vector3} A reference to this vector. - */ - project(camera: Camera): Vector3; - /** - * Unprojects this vector from the camera's normalized device coordinate (NDC) - * space into world space. - * - * @param {Camera} camera - The camera. - * @return {Vector3} A reference to this vector. - */ - unproject(camera: Camera): Vector3; - /** - * Transforms this vector by the upper left 3x3 sub-matrix of the given 4x4 matrix, - * and normalizes the result. - * - * @param {Matrix4} m - The matrix. - * @return {Vector3} A reference to this vector. - */ - transformDirection(m: Matrix4): Vector3; - /** - * Divides this instance by the given vector. - * - * @param {Vector3} v - The vector to divide. - * @return {Vector3} A reference to this vector. - */ - divide(v: Vector3): Vector3; - /** - * Divides this vector by the given scalar. - * - * @param {number} scalar - The scalar to divide. - * @return {Vector3} A reference to this vector. - */ - divideScalar(scalar: number): Vector3; - /** - * If this vector's x, y or z value is greater than the given vector's x, y or z - * value, replace that value with the corresponding min value. - * - * @param {Vector3} v - The vector. - * @return {Vector3} A reference to this vector. - */ - min(v: Vector3): Vector3; - /** - * If this vector's x, y or z value is less than the given vector's x, y or z - * value, replace that value with the corresponding max value. - * - * @param {Vector3} v - The vector. - * @return {Vector3} A reference to this vector. - */ - max(v: Vector3): Vector3; - /** - * If this vector's x, y or z value is greater than the max vector's x, y or z - * value, it is replaced by the corresponding value. - * If this vector's x, y or z value is less than the min vector's x, y or z value, - * it is replaced by the corresponding value. - * - * @param {Vector3} min - The minimum x, y and z values. - * @param {Vector3} max - The maximum x, y and z values in the desired range. - * @return {Vector3} A reference to this vector. - */ - clamp(min: Vector3, max: Vector3): Vector3; - /** - * If this vector's x, y or z values are greater than the max value, they are - * replaced by the max value. - * If this vector's x, y or z values are less than the min value, they are - * replaced by the min value. - * - * @param {number} minVal - The minimum value the components will be clamped to. - * @param {number} maxVal - The maximum value the components will be clamped to. - * @return {Vector3} A reference to this vector. - */ - clampScalar(minVal: number, maxVal: number): Vector3; - /** - * If this vector's length is greater than the max value, it is replaced by - * the max value. - * If this vector's length is less than the min value, it is replaced by the - * min value. - * - * @param {number} min - The minimum value the vector length will be clamped to. - * @param {number} max - The maximum value the vector length will be clamped to. - * @return {Vector3} A reference to this vector. - */ - clampLength(min: number, max: number): Vector3; - /** - * The components of this vector are rounded down to the nearest integer value. - * - * @return {Vector3} A reference to this vector. - */ - floor(): Vector3; - /** - * The components of this vector are rounded up to the nearest integer value. - * - * @return {Vector3} A reference to this vector. - */ - ceil(): Vector3; - /** - * The components of this vector are rounded to the nearest integer value - * - * @return {Vector3} A reference to this vector. - */ - round(): Vector3; - /** - * The components of this vector are rounded towards zero (up if negative, - * down if positive) to an integer value. - * - * @return {Vector3} A reference to this vector. - */ - roundToZero(): Vector3; - /** - * Inverts this vector - i.e. sets x = -x, y = -y and z = -z. - * - * @return {Vector3} A reference to this vector. - */ - negate(): Vector3; - /** - * Calculates the dot product of the given vector with this instance. - * - * @param {Vector3} v - The vector to compute the dot product with. - * @return {number} The result of the dot product. - */ - dot(v: Vector3): number; - /** - * Computes the square of the Euclidean length (straight-line length) from - * (0, 0, 0) to (x, y, z). If you are comparing the lengths of vectors, you should - * compare the length squared instead as it is slightly more efficient to calculate. - * - * @return {number} The square length of this vector. - */ - lengthSq(): number; - /** - * Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z). - * - * @return {number} The length of this vector. - */ - length(): number; - /** - * Computes the Manhattan length of this vector. - * - * @return {number} The length of this vector. - */ - manhattanLength(): number; - /** - * Converts this vector to a unit vector - that is, sets it equal to a vector - * with the same direction as this one, but with a vector length of `1`. - * - * @return {Vector3} A reference to this vector. - */ - normalize(): Vector3; - /** - * Sets this vector to a vector with the same direction as this one, but - * with the specified length. - * - * @param {number} length - The new length of this vector. - * @return {Vector3} A reference to this vector. - */ - setLength(length: number): Vector3; - /** - * Linearly interpolates between the given vector and this instance, where - * alpha is the percent distance along the line - alpha = 0 will be this - * vector, and alpha = 1 will be the given one. - * - * @param {Vector3} v - The vector to interpolate towards. - * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. - * @return {Vector3} A reference to this vector. - */ - lerp(v: Vector3, alpha: number): Vector3; - /** - * Linearly interpolates between the given vectors, where alpha is the percent - * distance along the line - alpha = 0 will be first vector, and alpha = 1 will - * be the second one. The result is stored in this instance. - * - * @param {Vector3} v1 - The first vector. - * @param {Vector3} v2 - The second vector. - * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. - * @return {Vector3} A reference to this vector. - */ - lerpVectors(v1: Vector3, v2: Vector3, alpha: number): Vector3; - /** - * Calculates the cross product of the given vector with this instance. - * - * @param {Vector3} v - The vector to compute the cross product with. - * @return {Vector3} The result of the cross product. - */ - cross(v: Vector3): Vector3; - /** - * Calculates the cross product of the given vectors and stores the result - * in this instance. - * - * @param {Vector3} a - The first vector. - * @param {Vector3} b - The second vector. - * @return {Vector3} A reference to this vector. - */ - crossVectors(a: Vector3, b: Vector3): Vector3; - /** - * Projects this vector onto the given one. - * - * @param {Vector3} v - The vector to project to. - * @return {Vector3} A reference to this vector. - */ - projectOnVector(v: Vector3): Vector3; - /** - * Projects this vector onto a plane by subtracting this - * vector projected onto the plane's normal from this vector. - * - * @param {Vector3} planeNormal - The plane normal. - * @return {Vector3} A reference to this vector. - */ - projectOnPlane(planeNormal: Vector3): Vector3; - /** - * Reflects this vector off a plane orthogonal to the given normal vector. - * - * @param {Vector3} normal - The (normalized) normal vector. - * @return {Vector3} A reference to this vector. - */ - reflect(normal: Vector3): Vector3; - /** - * Returns the angle between the given vector and this instance in radians. - * - * @param {Vector3} v - The vector to compute the angle with. - * @return {number} The angle in radians. - */ - angleTo(v: Vector3): number; - /** - * Computes the distance from the given vector to this instance. - * - * @param {Vector3} v - The vector to compute the distance to. - * @return {number} The distance. - */ - distanceTo(v: Vector3): number; - /** - * Computes the squared distance from the given vector to this instance. - * If you are just comparing the distance with another distance, you should compare - * the distance squared instead as it is slightly more efficient to calculate. - * - * @param {Vector3} v - The vector to compute the squared distance to. - * @return {number} The squared distance. - */ - distanceToSquared(v: Vector3): number; - /** - * Computes the Manhattan distance from the given vector to this instance. - * - * @param {Vector3} v - The vector to compute the Manhattan distance to. - * @return {number} The Manhattan distance. - */ - manhattanDistanceTo(v: Vector3): number; - /** - * Sets the vector components from the given spherical coordinates. - * - * @param {Spherical} s - The spherical coordinates. - * @return {Vector3} A reference to this vector. - */ - setFromSpherical(s: Spherical): Vector3; - /** - * Sets the vector components from the given spherical coordinates. - * - * @param {number} radius - The radius. - * @param {number} phi - The phi angle in radians. - * @param {number} theta - The theta angle in radians. - * @return {Vector3} A reference to this vector. - */ - setFromSphericalCoords(radius: number, phi: number, theta: number): Vector3; - /** - * Sets the vector components from the given cylindrical coordinates. - * - * @param {Cylindrical} c - The cylindrical coordinates. - * @return {Vector3} A reference to this vector. - */ - setFromCylindrical(c: Cylindrical): Vector3; - /** - * Sets the vector components from the given cylindrical coordinates. - * - * @param {number} radius - The radius. - * @param {number} theta - The theta angle in radians. - * @param {number} y - The y value. - * @return {Vector3} A reference to this vector. - */ - setFromCylindricalCoords(radius: number, theta: number, y: number): Vector3; - /** - * Sets the vector components to the position elements of the - * given transformation matrix. - * - * @param {Matrix4} m - The 4x4 matrix. - * @return {Vector3} A reference to this vector. - */ - setFromMatrixPosition(m: Matrix4): Vector3; - /** - * Sets the vector components to the scale elements of the - * given transformation matrix. - * - * @param {Matrix4} m - The 4x4 matrix. - * @return {Vector3} A reference to this vector. - */ - setFromMatrixScale(m: Matrix4): Vector3; - /** - * Sets the vector components from the specified matrix column. - * - * @param {Matrix4} m - The 4x4 matrix. - * @param {number} index - The column index. - * @return {Vector3} A reference to this vector. - */ - setFromMatrixColumn(m: Matrix4, index: number): Vector3; - /** - * Sets the vector components from the specified matrix column. - * - * @param {Matrix3} m - The 3x3 matrix. - * @param {number} index - The column index. - * @return {Vector3} A reference to this vector. - */ - setFromMatrix3Column(m: Matrix3, index: number): Vector3; - /** - * Sets the vector components from the given Euler angles. - * - * @param {Euler} e - The Euler angles to set. - * @return {Vector3} A reference to this vector. - */ - setFromEuler(e: Euler): Vector3; - /** - * Sets the vector components from the RGB components of the - * given color. - * - * @param {Color} c - The color to set. - * @return {Vector3} A reference to this vector. - */ - setFromColor(c: Color): Vector3; - /** - * Returns `true` if this vector is equal with the given one. - * - * @param {Vector3} v - The vector to test for equality. - * @return {boolean} Whether this vector is equal with the given one. - */ - equals(v: Vector3): boolean; - /** - * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]` - * and z value to be `array[ offset + 2 ]`. - * - * @param {Array} array - An array holding the vector component values. - * @param {number} [offset=0] - The offset into the array. - * @return {Vector3} A reference to this vector. - */ - fromArray(array: Array, offset?: number): Vector3; - /** - * Writes the components of this vector to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the vector components. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The vector components. - */ - toArray(array?: Array, offset?: number): Array; - /** - * Sets the components of this vector from the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute holding vector data. - * @param {number} index - The index into the attribute. - * @return {Vector3} A reference to this vector. - */ - fromBufferAttribute(attribute: BufferAttribute, index: number): Vector3; - /** - * Sets each component of this vector to a pseudo-random value between `0` and - * `1`, excluding `1`. - * - * @return {Vector3} A reference to this vector. - */ - random(): Vector3; - /** - * Sets this vector to a uniformly random point on a unit sphere. - * - * @return {Vector3} A reference to this vector. - */ - randomDirection(): Vector3; - [Symbol.iterator](): Generator; -} -import { Quaternion } from './Quaternion.js'; diff --git a/jsdoc-testing/jsdoc/src/math/Vector4.d.ts b/jsdoc-testing/jsdoc/src/math/Vector4.d.ts deleted file mode 100644 index 2360be77d..000000000 --- a/jsdoc-testing/jsdoc/src/math/Vector4.d.ts +++ /dev/null @@ -1,443 +0,0 @@ -/** - * Class representing a 4D vector. A 4D vector is an ordered quadruplet of numbers - * (labeled x, y, z and w), which can be used to represent a number of things, such as: - * - * - A point in 4D space. - * - A direction and length in 4D space. In three.js the length will - * always be the Euclidean distance(straight-line distance) from `(0, 0, 0, 0)` to `(x, y, z, w)` - * and the direction is also measured from `(0, 0, 0, 0)` towards `(x, y, z, w)`. - * - Any arbitrary ordered quadruplet of numbers. - * - * There are other things a 4D vector can be used to represent, however these - * are the most common uses in *three.js*. - * - * Iterating through a vector instance will yield its components `(x, y, z, w)` in - * the corresponding order. - * ```js - * const a = new THREE.Vector4( 0, 1, 0, 0 ); - * - * //no arguments; will be initialised to (0, 0, 0, 1) - * const b = new THREE.Vector4( ); - * - * const d = a.dot( b ); - * ``` - */ -export class Vector4 { - /** - * Constructs a new 4D vector. - * - * @param {number} [x=0] - The x value of this vector. - * @param {number} [y=0] - The y value of this vector. - * @param {number} [z=0] - The z value of this vector. - * @param {number} [w=1] - The w value of this vector. - */ - constructor(x?: number, y?: number, z?: number, w?: number); - /** - * The x value of this vector. - * - * @type {number} - */ - x: number; - /** - * The y value of this vector. - * - * @type {number} - */ - y: number; - /** - * The z value of this vector. - * - * @type {number} - */ - z: number; - /** - * The w value of this vector. - * - * @type {number} - */ - w: number; - set width(value: number); - /** - * Alias for {@link Vector4#z}. - * - * @type {number} - */ - get width(): number; - set height(value: number); - /** - * Alias for {@link Vector4#w}. - * - * @type {number} - */ - get height(): number; - /** - * Sets the vector components. - * - * @param {number} x - The value of the x component. - * @param {number} y - The value of the y component. - * @param {number} z - The value of the z component. - * @param {number} w - The value of the w component. - * @return {Vector4} A reference to this vector. - */ - set(x: number, y: number, z: number, w: number): Vector4; - /** - * Sets the vector components to the same value. - * - * @param {number} scalar - The value to set for all vector components. - * @return {Vector4} A reference to this vector. - */ - setScalar(scalar: number): Vector4; - /** - * Sets the vector's x component to the given value - * - * @param {number} x - The value to set. - * @return {Vector4} A reference to this vector. - */ - setX(x: number): Vector4; - /** - * Sets the vector's y component to the given value - * - * @param {number} y - The value to set. - * @return {Vector4} A reference to this vector. - */ - setY(y: number): Vector4; - /** - * Sets the vector's z component to the given value - * - * @param {number} z - The value to set. - * @return {Vector4} A reference to this vector. - */ - setZ(z: number): Vector4; - /** - * Sets the vector's w component to the given value - * - * @param {number} w - The value to set. - * @return {Vector4} A reference to this vector. - */ - setW(w: number): Vector4; - /** - * Allows to set a vector component with an index. - * - * @param {number} index - The component index. `0` equals to x, `1` equals to y, - * `2` equals to z, `3` equals to w. - * @param {number} value - The value to set. - * @return {Vector4} A reference to this vector. - */ - setComponent(index: number, value: number): Vector4; - /** - * Returns the value of the vector component which matches the given index. - * - * @param {number} index - The component index. `0` equals to x, `1` equals to y, - * `2` equals to z, `3` equals to w. - * @return {number} A vector component value. - */ - getComponent(index: number): number; - /** - * Returns a new vector with copied values from this instance. - * - * @return {Vector4} A clone of this instance. - */ - clone(): Vector4; - /** - * Copies the values of the given vector to this instance. - * - * @param {Vector3|Vector4} v - The vector to copy. - * @return {Vector4} A reference to this vector. - */ - copy(v: Vector3 | Vector4): Vector4; - /** - * Adds the given vector to this instance. - * - * @param {Vector4} v - The vector to add. - * @return {Vector4} A reference to this vector. - */ - add(v: Vector4): Vector4; - /** - * Adds the given scalar value to all components of this instance. - * - * @param {number} s - The scalar to add. - * @return {Vector4} A reference to this vector. - */ - addScalar(s: number): Vector4; - /** - * Adds the given vectors and stores the result in this instance. - * - * @param {Vector4} a - The first vector. - * @param {Vector4} b - The second vector. - * @return {Vector4} A reference to this vector. - */ - addVectors(a: Vector4, b: Vector4): Vector4; - /** - * Adds the given vector scaled by the given factor to this instance. - * - * @param {Vector4} v - The vector. - * @param {number} s - The factor that scales `v`. - * @return {Vector4} A reference to this vector. - */ - addScaledVector(v: Vector4, s: number): Vector4; - /** - * Subtracts the given vector from this instance. - * - * @param {Vector4} v - The vector to subtract. - * @return {Vector4} A reference to this vector. - */ - sub(v: Vector4): Vector4; - /** - * Subtracts the given scalar value from all components of this instance. - * - * @param {number} s - The scalar to subtract. - * @return {Vector4} A reference to this vector. - */ - subScalar(s: number): Vector4; - /** - * Subtracts the given vectors and stores the result in this instance. - * - * @param {Vector4} a - The first vector. - * @param {Vector4} b - The second vector. - * @return {Vector4} A reference to this vector. - */ - subVectors(a: Vector4, b: Vector4): Vector4; - /** - * Multiplies the given vector with this instance. - * - * @param {Vector4} v - The vector to multiply. - * @return {Vector4} A reference to this vector. - */ - multiply(v: Vector4): Vector4; - /** - * Multiplies the given scalar value with all components of this instance. - * - * @param {number} scalar - The scalar to multiply. - * @return {Vector4} A reference to this vector. - */ - multiplyScalar(scalar: number): Vector4; - /** - * Multiplies this vector with the given 4x4 matrix. - * - * @param {Matrix4} m - The 4x4 matrix. - * @return {Vector4} A reference to this vector. - */ - applyMatrix4(m: Matrix4): Vector4; - /** - * Divides this instance by the given vector. - * - * @param {Vector4} v - The vector to divide. - * @return {Vector4} A reference to this vector. - */ - divide(v: Vector4): Vector4; - /** - * Divides this vector by the given scalar. - * - * @param {number} scalar - The scalar to divide. - * @return {Vector4} A reference to this vector. - */ - divideScalar(scalar: number): Vector4; - /** - * Sets the x, y and z components of this - * vector to the quaternion's axis and w to the angle. - * - * @param {Quaternion} q - The Quaternion to set. - * @return {Vector4} A reference to this vector. - */ - setAxisAngleFromQuaternion(q: Quaternion): Vector4; - /** - * Sets the x, y and z components of this - * vector to the axis of rotation and w to the angle. - * - * @param {Matrix4} m - A 4x4 matrix of which the upper left 3x3 matrix is a pure rotation matrix. - * @return {Vector4} A reference to this vector. - */ - setAxisAngleFromRotationMatrix(m: Matrix4): Vector4; - /** - * Sets the vector components to the position elements of the - * given transformation matrix. - * - * @param {Matrix4} m - The 4x4 matrix. - * @return {Vector4} A reference to this vector. - */ - setFromMatrixPosition(m: Matrix4): Vector4; - /** - * If this vector's x, y, z or w value is greater than the given vector's x, y, z or w - * value, replace that value with the corresponding min value. - * - * @param {Vector4} v - The vector. - * @return {Vector4} A reference to this vector. - */ - min(v: Vector4): Vector4; - /** - * If this vector's x, y, z or w value is less than the given vector's x, y, z or w - * value, replace that value with the corresponding max value. - * - * @param {Vector4} v - The vector. - * @return {Vector4} A reference to this vector. - */ - max(v: Vector4): Vector4; - /** - * If this vector's x, y, z or w value is greater than the max vector's x, y, z or w - * value, it is replaced by the corresponding value. - * If this vector's x, y, z or w value is less than the min vector's x, y, z or w value, - * it is replaced by the corresponding value. - * - * @param {Vector4} min - The minimum x, y and z values. - * @param {Vector4} max - The maximum x, y and z values in the desired range. - * @return {Vector4} A reference to this vector. - */ - clamp(min: Vector4, max: Vector4): Vector4; - /** - * If this vector's x, y, z or w values are greater than the max value, they are - * replaced by the max value. - * If this vector's x, y, z or w values are less than the min value, they are - * replaced by the min value. - * - * @param {number} minVal - The minimum value the components will be clamped to. - * @param {number} maxVal - The maximum value the components will be clamped to. - * @return {Vector4} A reference to this vector. - */ - clampScalar(minVal: number, maxVal: number): Vector4; - /** - * If this vector's length is greater than the max value, it is replaced by - * the max value. - * If this vector's length is less than the min value, it is replaced by the - * min value. - * - * @param {number} min - The minimum value the vector length will be clamped to. - * @param {number} max - The maximum value the vector length will be clamped to. - * @return {Vector4} A reference to this vector. - */ - clampLength(min: number, max: number): Vector4; - /** - * The components of this vector are rounded down to the nearest integer value. - * - * @return {Vector4} A reference to this vector. - */ - floor(): Vector4; - /** - * The components of this vector are rounded up to the nearest integer value. - * - * @return {Vector4} A reference to this vector. - */ - ceil(): Vector4; - /** - * The components of this vector are rounded to the nearest integer value - * - * @return {Vector4} A reference to this vector. - */ - round(): Vector4; - /** - * The components of this vector are rounded towards zero (up if negative, - * down if positive) to an integer value. - * - * @return {Vector4} A reference to this vector. - */ - roundToZero(): Vector4; - /** - * Inverts this vector - i.e. sets x = -x, y = -y, z = -z, w = -w. - * - * @return {Vector4} A reference to this vector. - */ - negate(): Vector4; - /** - * Calculates the dot product of the given vector with this instance. - * - * @param {Vector4} v - The vector to compute the dot product with. - * @return {number} The result of the dot product. - */ - dot(v: Vector4): number; - /** - * Computes the square of the Euclidean length (straight-line length) from - * (0, 0, 0, 0) to (x, y, z, w). If you are comparing the lengths of vectors, you should - * compare the length squared instead as it is slightly more efficient to calculate. - * - * @return {number} The square length of this vector. - */ - lengthSq(): number; - /** - * Computes the Euclidean length (straight-line length) from (0, 0, 0, 0) to (x, y, z, w). - * - * @return {number} The length of this vector. - */ - length(): number; - /** - * Computes the Manhattan length of this vector. - * - * @return {number} The length of this vector. - */ - manhattanLength(): number; - /** - * Converts this vector to a unit vector - that is, sets it equal to a vector - * with the same direction as this one, but with a vector length of `1`. - * - * @return {Vector4} A reference to this vector. - */ - normalize(): Vector4; - /** - * Sets this vector to a vector with the same direction as this one, but - * with the specified length. - * - * @param {number} length - The new length of this vector. - * @return {Vector4} A reference to this vector. - */ - setLength(length: number): Vector4; - /** - * Linearly interpolates between the given vector and this instance, where - * alpha is the percent distance along the line - alpha = 0 will be this - * vector, and alpha = 1 will be the given one. - * - * @param {Vector4} v - The vector to interpolate towards. - * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. - * @return {Vector4} A reference to this vector. - */ - lerp(v: Vector4, alpha: number): Vector4; - /** - * Linearly interpolates between the given vectors, where alpha is the percent - * distance along the line - alpha = 0 will be first vector, and alpha = 1 will - * be the second one. The result is stored in this instance. - * - * @param {Vector4} v1 - The first vector. - * @param {Vector4} v2 - The second vector. - * @param {number} alpha - The interpolation factor, typically in the closed interval `[0, 1]`. - * @return {Vector4} A reference to this vector. - */ - lerpVectors(v1: Vector4, v2: Vector4, alpha: number): Vector4; - /** - * Returns `true` if this vector is equal with the given one. - * - * @param {Vector4} v - The vector to test for equality. - * @return {boolean} Whether this vector is equal with the given one. - */ - equals(v: Vector4): boolean; - /** - * Sets this vector's x value to be `array[ offset ]`, y value to be `array[ offset + 1 ]`, - * z value to be `array[ offset + 2 ]`, w value to be `array[ offset + 3 ]`. - * - * @param {Array} array - An array holding the vector component values. - * @param {number} [offset=0] - The offset into the array. - * @return {Vector4} A reference to this vector. - */ - fromArray(array: Array, offset?: number): Vector4; - /** - * Writes the components of this vector to the given array. If no array is provided, - * the method returns a new instance. - * - * @param {Array} [array=[]] - The target array holding the vector components. - * @param {number} [offset=0] - Index of the first element in the array. - * @return {Array} The vector components. - */ - toArray(array?: Array, offset?: number): Array; - /** - * Sets the components of this vector from the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute holding vector data. - * @param {number} index - The index into the attribute. - * @return {Vector4} A reference to this vector. - */ - fromBufferAttribute(attribute: BufferAttribute, index: number): Vector4; - /** - * Sets each component of this vector to a pseudo-random value between `0` and - * `1`, excluding `1`. - * - * @return {Vector4} A reference to this vector. - */ - random(): Vector4; - [Symbol.iterator](): Generator; -} diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts deleted file mode 100644 index a3d1715dc..000000000 --- a/jsdoc-testing/jsdoc/src/math/interpolants/BezierInterpolant.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A Bezier interpolant using cubic Bezier curves with 2D control points. - * - * This interpolant supports the COLLADA/Maya style of Bezier animation where - * each keyframe has explicit in/out tangent control points specified as - * 2D coordinates (time, value). - * - * Tangent data is read from `inTangents` and `outTangents` on the interpolant - * (populated by `KeyframeTrack.InterpolantFactoryMethodBezier`). - * - * For a track with N keyframes and stride S: - * - Each tangent array has N * S * 2 values - * - Layout: [k0_c0_time, k0_c0_value, k0_c1_time, k0_c1_value, ..., k0_cS_time, k0_cS_value, - * k1_c0_time, k1_c0_value, ...] - * - * @augments Interpolant - */ -export class BezierInterpolant extends Interpolant { - interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; -} -import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts deleted file mode 100644 index ca53c5e9a..000000000 --- a/jsdoc-testing/jsdoc/src/math/interpolants/CubicInterpolant.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Fast and simple cubic spline interpolant. - * - * It was derived from a Hermitian construction setting the first derivative - * at each sample position to the linear slope between neighboring positions - * over their parameter interval. - * - * @augments Interpolant - */ -export class CubicInterpolant extends Interpolant { - _weightPrev: number; - _offsetPrev: number; - _weightNext: number; - _offsetNext: number; - DefaultSettings_: { - endingStart: number; - endingEnd: number; - }; - intervalChanged_(i1: any, t0: any, t1: any): void; - interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; -} -import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts deleted file mode 100644 index 04ce01eb6..000000000 --- a/jsdoc-testing/jsdoc/src/math/interpolants/DiscreteInterpolant.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Interpolant that evaluates to the sample value at the position preceding - * the parameter. - * - * @augments Interpolant - */ -export class DiscreteInterpolant extends Interpolant { - interpolate_(i1: any): TypedArray; -} -import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts deleted file mode 100644 index d36003868..000000000 --- a/jsdoc-testing/jsdoc/src/math/interpolants/LinearInterpolant.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * A basic linear interpolant. - * - * @augments Interpolant - */ -export class LinearInterpolant extends Interpolant { - interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; -} -import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts b/jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts deleted file mode 100644 index e8ddddc6e..000000000 --- a/jsdoc-testing/jsdoc/src/math/interpolants/QuaternionLinearInterpolant.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Spherical linear unit quaternion interpolant. - * - * @augments Interpolant - */ -export class QuaternionLinearInterpolant extends Interpolant { - interpolate_(i1: any, t0: any, t: any, t1: any): TypedArray; -} -import { Interpolant } from '../Interpolant.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts b/jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts deleted file mode 100644 index 8712dab21..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/Nodes.d.ts +++ /dev/null @@ -1,138 +0,0 @@ -export * from "./core/constants.js"; -export { default as ArrayNode } from "./core/ArrayNode.js"; -export { default as AssignNode } from "./core/AssignNode.js"; -export { default as AttributeNode } from "./core/AttributeNode.js"; -export { default as BypassNode } from "./core/BypassNode.js"; -export { default as ConstNode } from "./core/ConstNode.js"; -export { default as ContextNode } from "./core/ContextNode.js"; -export { default as IndexNode } from "./core/IndexNode.js"; -export { default as InputNode } from "./core/InputNode.js"; -export { default as InspectorNode } from "./core/InspectorNode.js"; -export { default as IsolateNode } from "./core/IsolateNode.js"; -export { default as LightingModel } from "./core/LightingModel.js"; -export { default as MRTNode } from "./core/MRTNode.js"; -export { default as Node } from "./core/Node.js"; -export { default as NodeAttribute } from "./core/NodeAttribute.js"; -export { default as NodeBuilder } from "./core/NodeBuilder.js"; -export { default as NodeCache } from "./core/NodeCache.js"; -export { default as NodeCode } from "./core/NodeCode.js"; -export { default as NodeError } from "./core/NodeError.js"; -export { default as NodeFrame } from "./core/NodeFrame.js"; -export { default as NodeFunctionInput } from "./core/NodeFunctionInput.js"; -export { default as NodeUniform } from "./core/NodeUniform.js"; -export { default as NodeVar } from "./core/NodeVar.js"; -export { default as NodeVarying } from "./core/NodeVarying.js"; -export { default as OutputStructNode } from "./core/OutputStructNode.js"; -export { default as OverrideContextNode } from "./core/OverrideContextNode.js"; -export { default as ParameterNode } from "./core/ParameterNode.js"; -export { default as PropertyNode } from "./core/PropertyNode.js"; -export { default as StackNode } from "./core/StackNode.js"; -export { default as StackTrace } from "./core/StackTrace.js"; -export { default as StructNode } from "./core/StructNode.js"; -export { default as StructTypeNode } from "./core/StructTypeNode.js"; -export { default as SubBuildNode } from "./core/SubBuildNode.js"; -export { default as TempNode } from "./core/TempNode.js"; -export { default as UniformGroupNode } from "./core/UniformGroupNode.js"; -export { default as UniformNode } from "./core/UniformNode.js"; -export { default as VarNode } from "./core/VarNode.js"; -export { default as VaryingNode } from "./core/VaryingNode.js"; -export { NodeUtils }; -export { default as BufferAttributeNode } from "./accessors/BufferAttributeNode.js"; -export { default as BufferNode } from "./accessors/BufferNode.js"; -export { default as BuiltinNode } from "./accessors/BuiltinNode.js"; -export { default as ClippingNode } from "./accessors/ClippingNode.js"; -export { default as CubeTextureNode } from "./accessors/CubeTextureNode.js"; -export { default as MaterialNode } from "./accessors/MaterialNode.js"; -export { default as MaterialReferenceNode } from "./accessors/MaterialReferenceNode.js"; -export { default as ModelNode } from "./accessors/ModelNode.js"; -export { default as Object3DNode } from "./accessors/Object3DNode.js"; -export { default as PointUVNode } from "./accessors/PointUVNode.js"; -export { default as ReferenceBaseNode } from "./accessors/ReferenceBaseNode.js"; -export { default as ReferenceElementNode } from "./accessors/ReferenceElementNode.js"; -export { default as ReferenceNode } from "./accessors/ReferenceNode.js"; -export { default as RendererReferenceNode } from "./accessors/RendererReferenceNode.js"; -export { default as StorageBufferNode } from "./accessors/StorageBufferNode.js"; -export { default as StorageTexture3DNode } from "./accessors/StorageTexture3DNode.js"; -export { default as StorageTextureNode } from "./accessors/StorageTextureNode.js"; -export { default as Texture3DNode } from "./accessors/Texture3DNode.js"; -export { default as TextureNode } from "./accessors/TextureNode.js"; -export { default as TextureSizeNode } from "./accessors/TextureSizeNode.js"; -export { default as UniformArrayNode } from "./accessors/UniformArrayNode.js"; -export { default as UserDataNode } from "./accessors/UserDataNode.js"; -export { default as VelocityNode } from "./accessors/VelocityNode.js"; -export { default as VertexColorNode } from "./accessors/VertexColorNode.js"; -export { default as CodeNode } from "./code/CodeNode.js"; -export { default as ExpressionNode } from "./code/ExpressionNode.js"; -export { default as FunctionCallNode } from "./code/FunctionCallNode.js"; -export { default as FunctionNode } from "./code/FunctionNode.js"; -export { default as BumpMapNode } from "./display/BumpMapNode.js"; -export { default as ColorSpaceNode } from "./display/ColorSpaceNode.js"; -export { default as FrontFacingNode } from "./display/FrontFacingNode.js"; -export { default as NormalMapNode } from "./display/NormalMapNode.js"; -export { default as PassNode } from "./display/PassNode.js"; -export { default as RenderOutputNode } from "./display/RenderOutputNode.js"; -export { default as ScreenNode } from "./display/ScreenNode.js"; -export { default as ToneMappingNode } from "./display/ToneMappingNode.js"; -export { default as ToonOutlinePassNode } from "./display/ToonOutlinePassNode.js"; -export { default as ViewportDepthNode } from "./display/ViewportDepthNode.js"; -export { default as ViewportDepthTextureNode } from "./display/ViewportDepthTextureNode.js"; -export { default as ViewportSharedTextureNode } from "./display/ViewportSharedTextureNode.js"; -export { default as ViewportTextureNode } from "./display/ViewportTextureNode.js"; -export { default as RangeNode } from "./geometry/RangeNode.js"; -export { default as AtomicFunctionNode } from "./gpgpu/AtomicFunctionNode.js"; -export { default as BarrierNode } from "./gpgpu/BarrierNode.js"; -export { default as ComputeBuiltinNode } from "./gpgpu/ComputeBuiltinNode.js"; -export { default as ComputeNode } from "./gpgpu/ComputeNode.js"; -export { default as SubgroupFunctionNode } from "./gpgpu/SubgroupFunctionNode.js"; -export { default as WorkgroupInfoNode } from "./gpgpu/WorkgroupInfoNode.js"; -export { default as AmbientLightNode } from "./lighting/AmbientLightNode.js"; -export { default as AnalyticLightNode } from "./lighting/AnalyticLightNode.js"; -export { default as AONode } from "./lighting/AONode.js"; -export { default as BasicEnvironmentNode } from "./lighting/BasicEnvironmentNode.js"; -export { default as BasicLightMapNode } from "./lighting/BasicLightMapNode.js"; -export { default as DirectionalLightNode } from "./lighting/DirectionalLightNode.js"; -export { default as EnvironmentNode } from "./lighting/EnvironmentNode.js"; -export { default as HemisphereLightNode } from "./lighting/HemisphereLightNode.js"; -export { default as IESSpotLightNode } from "./lighting/IESSpotLightNode.js"; -export { default as IrradianceNode } from "./lighting/IrradianceNode.js"; -export { default as LightingContextNode } from "./lighting/LightingContextNode.js"; -export { default as LightingNode } from "./lighting/LightingNode.js"; -export { default as LightProbeNode } from "./lighting/LightProbeNode.js"; -export { default as LightsNode } from "./lighting/LightsNode.js"; -export { default as PointLightNode } from "./lighting/PointLightNode.js"; -export { default as PointShadowNode } from "./lighting/PointShadowNode.js"; -export { default as ProjectorLightNode } from "./lighting/ProjectorLightNode.js"; -export { default as RectAreaLightNode } from "./lighting/RectAreaLightNode.js"; -export { default as ShadowBaseNode } from "./lighting/ShadowBaseNode.js"; -export { default as ShadowNode } from "./lighting/ShadowNode.js"; -export { default as SpotLightNode } from "./lighting/SpotLightNode.js"; -export { default as BitcastNode } from "./math/BitcastNode.js"; -export { default as BitcountNode } from "./math/BitcountNode.js"; -export { default as ConditionalNode } from "./math/ConditionalNode.js"; -export { default as MathNode } from "./math/MathNode.js"; -export { default as OperatorNode } from "./math/OperatorNode.js"; -export { default as PackFloatNode } from "./math/PackFloatNode.js"; -export { default as UnpackFloatNode } from "./math/UnpackFloatNode.js"; -export { default as GLSLNodeParser } from "./parsers/GLSLNodeParser.js"; -export { default as PMREMNode } from "./pmrem/PMREMNode.js"; -export { default as ArrayElementNode } from "./utils/ArrayElementNode.js"; -export { default as ConvertNode } from "./utils/ConvertNode.js"; -export { default as CubeMapNode } from "./utils/CubeMapNode.js"; -export { default as DebugNode } from "./utils/DebugNode.js"; -export { default as EventNode } from "./utils/EventNode.js"; -export { default as FlipNode } from "./utils/FlipNode.js"; -export { default as FunctionOverloadingNode } from "./utils/FunctionOverloadingNode.js"; -export { default as JoinNode } from "./utils/JoinNode.js"; -export { default as LoopNode } from "./utils/LoopNode.js"; -export { default as MaxMipLevelNode } from "./utils/MaxMipLevelNode.js"; -export { default as MemberNode } from "./utils/MemberNode.js"; -export { default as ReflectorNode } from "./utils/ReflectorNode.js"; -export { default as RotateNode } from "./utils/RotateNode.js"; -export { default as RTTNode } from "./utils/RTTNode.js"; -export { default as SampleNode } from "./utils/SampleNode.js"; -export { default as SetNode } from "./utils/SetNode.js"; -export { default as SplitNode } from "./utils/SplitNode.js"; -export { default as StorageArrayElementNode } from "./utils/StorageArrayElementNode.js"; -export { default as PhongLightingModel } from "./functions/PhongLightingModel.js"; -export { default as PhysicalLightingModel } from "./functions/PhysicalLightingModel.js"; -import * as NodeUtils from './core/NodeUtils.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/TSL.d.ts b/jsdoc-testing/jsdoc/src/nodes/TSL.d.ts deleted file mode 100644 index 9e37c77eb..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/TSL.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -export * from "./core/constants.js"; -export * from "./core/AssignNode.js"; -export * from "./core/AttributeNode.js"; -export * from "./core/BypassNode.js"; -export * from "./core/IsolateNode.js"; -export * from "./core/ContextNode.js"; -export * from "./core/OverrideContextNode.js"; -export * from "./core/IndexNode.js"; -export * from "./core/ParameterNode.js"; -export * from "./core/PropertyNode.js"; -export * from "./core/StackNode.js"; -export * from "./core/StructNode.js"; -export * from "./core/UniformGroupNode.js"; -export * from "./core/UniformNode.js"; -export * from "./core/VaryingNode.js"; -export * from "./core/OutputStructNode.js"; -export * from "./core/MRTNode.js"; -export * from "./math/BitcastNode.js"; -export * from "./math/BitcountNode.js"; -export * from "./math/Hash.js"; -export * from "./math/MathUtils.js"; -export * from "./math/PackFloatNode.js"; -export * from "./math/UnpackFloatNode.js"; -export * from "./math/TriNoise3D.js"; -export * from "./utils/EquirectUV.js"; -export * from "./utils/FunctionOverloadingNode.js"; -export * from "./utils/LoopNode.js"; -export * from "./utils/MatcapUV.js"; -export * from "./utils/MaxMipLevelNode.js"; -export * from "./utils/Oscillators.js"; -export * from "./utils/Packing.js"; -export * from "./utils/Remap.js"; -export * from "./utils/UVUtils.js"; -export * from "./utils/SpriteUtils.js"; -export * from "./utils/ViewportUtils.js"; -export * from "./utils/RotateNode.js"; -export * from "./utils/SpriteSheetUV.js"; -export * from "./utils/Timer.js"; -export * from "./utils/TriplanarTextures.js"; -export * from "./utils/ReflectorNode.js"; -export * from "./utils/RTTNode.js"; -export * from "./utils/PostProcessingUtils.js"; -export * from "./utils/SampleNode.js"; -export * from "./utils/EventNode.js"; -export * from "./utils/StorageArrayElementNode.js"; -export * from "./tsl/TSLBase.js"; -export * from "./accessors/AccessorsUtils.js"; -export * from "./accessors/Arrays.js"; -export * from "./accessors/UniformArrayNode.js"; -export * from "./accessors/Bitangent.js"; -export * from "./accessors/ClippingNode.js"; -export * from "./accessors/TangentUtils.js"; -export * from "./accessors/BufferAttributeNode.js"; -export * from "./accessors/BufferNode.js"; -export * from "./accessors/BuiltinNode.js"; -export * from "./accessors/Camera.js"; -export * from "./accessors/VertexColorNode.js"; -export * from "./accessors/CubeTextureNode.js"; -export * from "./accessors/Instance.js"; -export * from "./accessors/Batch.js"; -export * from "./accessors/MaterialNode.js"; -export * from "./accessors/MaterialProperties.js"; -export * from "./accessors/MaterialReferenceNode.js"; -export * from "./accessors/RendererReferenceNode.js"; -export * from "./accessors/Morph.js"; -export * from "./accessors/TextureBicubic.js"; -export * from "./accessors/ModelNode.js"; -export * from "./accessors/ModelViewProjectionNode.js"; -export * from "./accessors/Normal.js"; -export * from "./accessors/Object3DNode.js"; -export * from "./accessors/PointUVNode.js"; -export * from "./accessors/Position.js"; -export * from "./accessors/ReferenceNode.js"; -export * from "./accessors/ReflectVector.js"; -export * from "./accessors/Skinning.js"; -export * from "./accessors/SceneProperties.js"; -export * from "./accessors/StorageBufferNode.js"; -export * from "./accessors/StorageTexture3DNode.js"; -export * from "./accessors/StorageTextureNode.js"; -export * from "./accessors/Tangent.js"; -export * from "./accessors/TextureNode.js"; -export * from "./accessors/TextureSizeNode.js"; -export * from "./accessors/Texture3DNode.js"; -export * from "./accessors/UV.js"; -export * from "./accessors/UserDataNode.js"; -export * from "./accessors/VelocityNode.js"; -export * from "./display/BlendModes.js"; -export * from "./display/BumpMapNode.js"; -export * from "./display/ColorAdjustment.js"; -export * from "./display/ColorSpaceNode.js"; -export * from "./display/FrontFacingNode.js"; -export * from "./display/NormalMapNode.js"; -export * from "./display/PremultiplyAlphaFunctions.js"; -export * from "./display/ToneMappingNode.js"; -export * from "./display/ScreenNode.js"; -export * from "./display/ViewportTextureNode.js"; -export * from "./display/ViewportSharedTextureNode.js"; -export * from "./display/ViewportDepthTextureNode.js"; -export * from "./display/ViewportDepthNode.js"; -export * from "./display/RenderOutputNode.js"; -export * from "./display/ToonOutlinePassNode.js"; -export * from "./display/PassNode.js"; -export * from "./display/ColorSpaceFunctions.js"; -export * from "./display/ToneMappingFunctions.js"; -export * from "./code/ExpressionNode.js"; -export * from "./code/CodeNode.js"; -export * from "./code/FunctionCallNode.js"; -export * from "./code/FunctionNode.js"; -export * from "./fog/Fog.js"; -export * from "./geometry/RangeNode.js"; -export * from "./gpgpu/ComputeNode.js"; -export * from "./gpgpu/ComputeBuiltinNode.js"; -export * from "./gpgpu/BarrierNode.js"; -export * from "./gpgpu/WorkgroupInfoNode.js"; -export * from "./gpgpu/AtomicFunctionNode.js"; -export * from "./gpgpu/SubgroupFunctionNode.js"; -export * from "./accessors/Lights.js"; -export * from "./lighting/LightsNode.js"; -export * from "./lighting/LightingContextNode.js"; -export * from "./lighting/ShadowBaseNode.js"; -export * from "./lighting/PointShadowNode.js"; -export * from "./lighting/PointLightNode.js"; -export * from "./pmrem/PMREMNode.js"; -export * from "./procedural/Checker.js"; -export * from "./shapes/Shapes.js"; -export * from "./materialx/MaterialXNodes.js"; -export * from "./lighting/LightUtils.js"; -export { shadow } from "./lighting/ShadowNode.js"; -export { default as BRDF_GGX } from "./functions/BSDF/BRDF_GGX.js"; -export { default as BRDF_Lambert } from "./functions/BSDF/BRDF_Lambert.js"; -export { default as BRDF_Sheen } from "./functions/BSDF/BRDF_Sheen.js"; -export { default as D_GGX } from "./functions/BSDF/D_GGX.js"; -export { default as D_GGX_Anisotropic } from "./functions/BSDF/D_GGX_Anisotropic.js"; -export { default as DFGLUT } from "./functions/BSDF/DFGLUT.js"; -export { default as EnvironmentBRDF } from "./functions/BSDF/EnvironmentBRDF.js"; -export { default as F_Schlick } from "./functions/BSDF/F_Schlick.js"; -export { default as Schlick_to_F0 } from "./functions/BSDF/Schlick_to_F0.js"; -export { default as V_GGX_SmithCorrelated } from "./functions/BSDF/V_GGX_SmithCorrelated.js"; -export { default as V_GGX_SmithCorrelated_Anisotropic } from "./functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.js"; -export { default as getGeometryRoughness } from "./functions/material/getGeometryRoughness.js"; -export { default as getParallaxCorrectNormal } from "./functions/material/getParallaxCorrectNormal.js"; -export { default as getRoughness } from "./functions/material/getRoughness.js"; -export { default as getShIrradianceAt } from "./functions/material/getShIrradianceAt.js"; -export { BasicShadowFilter, PCFShadowFilter, VSMShadowFilter } from "./lighting/ShadowFilterNode.js"; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts deleted file mode 100644 index 07177caec..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/AccessorsUtils.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * TSL object that represents the TBN matrix in view space. - * - * @tsl - * @type {Node} - */ -export const TBNViewMatrix: Node; -/** - * TSL object that represents the parallax direction. - * - * @tsl - * @type {Node} - */ -export const parallaxDirection: Node; -export function parallaxUV(uv: Node, scale: Node): Node; -/** - * TSL function for computing bent normals. - * - * @tsl - * @function - * @returns {Node} Bent normals. - */ -export const bentNormalView: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts deleted file mode 100644 index 6c9184803..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Arrays.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function attributeArray(count: number | TypedArray, type?: string | Struct): StorageBufferNode; -export function instancedArray(count: number | TypedArray, type?: string | Struct): StorageBufferNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts deleted file mode 100644 index f483ad0da..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Batch.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * TSL object representing a varying property for the batching color vector. - * - * @type {VaryingNode} - */ -export const batchColor: VaryingNode; -/** - * TSL object representing a varying property for the batch indirect index (instance ID). - * - * @type {VaryingNode} - */ -export const batchIndirectIndex: VaryingNode; -/** - * TSL function representing the vertex shader batching setup. - * Applies the batch transformation matrix to positionLocal, normalLocal, and tangentLocal. - * Also assigns the batch color if a color texture is present. - * - * @tsl - * @function - * @param {BatchedMesh} batchMesh - The batched mesh. - */ -export const batch: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts deleted file mode 100644 index 7694a53fc..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Bitangent.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * TSL object that represents the bitangent attribute of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const bitangentGeometry: Node; -/** - * TSL object that represents the vertex bitangent in local space of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const bitangentLocal: Node; -/** - * TSL object that represents the vertex bitangent in view space of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const bitangentView: Node; -/** - * TSL object that represents the vertex bitangent in world space of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const bitangentWorld: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts deleted file mode 100644 index 60775a2a1..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/BufferAttributeNode.d.ts +++ /dev/null @@ -1,143 +0,0 @@ -export default BufferAttributeNode; -export function bufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; -export function dynamicBufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; -export function instancedBufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; -export function instancedDynamicBufferAttribute(array: BufferAttribute | InterleavedBuffer | TypedArray, type?: string | null, stride?: number, offset?: number): BufferAttributeNode | Node; -/** - * In earlier `three.js` versions it was only possible to define attribute data - * on geometry level. With `BufferAttributeNode`, it is also possible to do this - * on the node level. - * ```js - * const geometry = new THREE.PlaneGeometry(); - * const positionAttribute = geometry.getAttribute( 'position' ); - * - * const colors = []; - * for ( let i = 0; i < position.count; i ++ ) { - * colors.push( 1, 0, 0 ); - * } - * - * material.colorNode = bufferAttribute( new THREE.Float32BufferAttribute( colors, 3 ) ); - * ``` - * This new approach is especially interesting when geometry data are generated via - * compute shaders. The below line converts a storage buffer into an attribute node. - * ```js - * material.positionNode = positionBuffer.toAttribute(); - * ``` - * @augments InputNode - */ -declare class BufferAttributeNode extends InputNode { - /** - * Constructs a new buffer attribute node. - * - * @param {BufferAttribute|InterleavedBuffer|TypedArray} value - The attribute data. - * @param {?string} [bufferType=null] - The buffer type (e.g. `'vec3'`). - * @param {number} [bufferStride=0] - The buffer stride. - * @param {number} [bufferOffset=0] - The buffer offset. - */ - constructor(value: BufferAttribute | InterleavedBuffer | TypedArray, bufferType?: string | null, bufferStride?: number, bufferOffset?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBufferNode: boolean; - /** - * The buffer type (e.g. `'vec3'`). - * - * @type {?string} - * @default null - */ - bufferType: string | null; - /** - * The buffer stride. - * - * @type {number} - * @default 0 - */ - bufferStride: number; - /** - * The buffer offset. - * - * @type {number} - * @default 0 - */ - bufferOffset: number; - /** - * The usage property. Set this to `THREE.DynamicDrawUsage` via `.setUsage()`, - * if you are planning to update the attribute data per frame. - * - * @type {number} - * @default StaticDrawUsage - */ - usage: number; - /** - * Whether the attribute is instanced or not. - * - * @type {boolean} - * @default false - */ - instanced: boolean; - /** - * A reference to the buffer attribute. - * - * @type {?BufferAttribute} - * @default null - */ - attribute: BufferAttribute | null; - /** - * This method is overwritten since the attribute data might be shared - * and thus the hash should be shared as well. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(builder: NodeBuilder): string; - /** - * This method is overwritten since the node type is inferred from - * the buffer attribute. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Depending on which value was passed to the node, `setup()` behaves - * differently. If no instance of `BufferAttribute` was passed, the method - * creates an internal attribute and configures it respectively. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * Generates the code snippet of the buffer attribute node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder): string; - /** - * Overwrites the default implementation to return a fixed value `'bufferAttribute'`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; - /** - * Sets the `usage` property to the given value. - * - * @param {number} value - The usage to set. - * @return {BufferAttributeNode} A reference to this node. - */ - setUsage(value: number): BufferAttributeNode; - /** - * Sets the `instanced` property to the given value. - * - * @param {boolean} value - The value to set. - * @return {BufferAttributeNode} A reference to this node. - */ - setInstanced(value: boolean): BufferAttributeNode; -} -import { InterleavedBuffer } from '../../core/InterleavedBuffer.js'; -import InputNode from '../core/InputNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts deleted file mode 100644 index a0765ba1c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/BufferNode.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -export default BufferNode; -export function buffer(value: Array, type: string, count: number): BufferNode; -/** - * A special type of uniform node which represents array-like data - * as uniform buffers. The access usually happens via `element()` - * which returns an instance of {@link ArrayElementNode}. For example: - * - * ```js - * const bufferNode = buffer( array, 'mat4', count ); - * const matrixNode = bufferNode.element( index ); // access a matrix from the buffer - * ``` - * In general, it is recommended to use the more managed {@link UniformArrayNode} - * since it handles more input types and automatically cares about buffer paddings. - * - * @augments UniformNode - */ -declare class BufferNode extends UniformNode { - /** - * Constructs a new buffer node. - * - * @param {Array} value - Array-like buffer data. - * @param {string} bufferType - The data type of the buffer. - * @param {number} [bufferCount=0] - The count of buffer elements. - */ - constructor(value: Array, bufferType: string, bufferCount?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBufferNode: boolean; - /** - * The data type of the buffer. - * - * @type {string} - */ - bufferType: string; - /** - * The uniform node that holds the value of the reference node. - * - * @type {number} - * @default 0 - */ - bufferCount: number; - /** - * An array of update ranges. - * - * @type {Array<{start: number, count: number}>} - */ - updateRanges: Array<{ - start: number; - count: number; - }>; - /** - * Adds a range of data in the data array to be updated on the GPU. - * - * @param {number} start - Position at which to start update. - * @param {number} count - The number of components to update. - */ - addUpdateRange(start: number, count: number): void; - /** - * Clears the update ranges. - */ - clearUpdateRanges(): void; - /** - * Overwrites the default implementation to return a fixed value `'buffer'`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; -} -import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts deleted file mode 100644 index 1081d0ec4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/BuiltinNode.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export default BuiltinNode; -/** - * TSL function for creating a builtin node. - * - * @tsl - * @function - * @param {string} name - The name of the built-in shader variable. - * @returns {BuiltinNode} - */ -export const builtin: any; -/** - * The node allows to set values for built-in shader variables. That is - * required for features like hardware-accelerated vertex clipping. - * - * @augments Node - */ -declare class BuiltinNode extends Node { - /** - * Constructs a new builtin node. - * - * @param {string} name - The name of the built-in shader variable. - */ - constructor(name: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBuiltinNode: boolean; - /** - * Generates the code snippet of the builtin node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(): string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts deleted file mode 100644 index 1af86bd26..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Camera.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * TSL object that represents the current `index` value of the camera if used ArrayCamera. - * - * @tsl - * @type {UniformNode} - */ -export const cameraIndex: UniformNode; -/** - * TSL object that represents the `near` value of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraNear: UniformNode; -/** - * TSL object that represents the `far` value of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraFar: UniformNode; -/** - * TSL object that represents the projection matrix of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraProjectionMatrix: UniformNode; -/** - * TSL object that represents the inverse projection matrix of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraProjectionMatrixInverse: UniformNode; -/** - * TSL object that represents the view matrix of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraViewMatrix: UniformNode; -/** - * TSL object that represents the world matrix of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraWorldMatrix: UniformNode; -/** - * TSL object that represents the normal matrix of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraNormalMatrix: UniformNode; -/** - * TSL object that represents the position in world space of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraPosition: UniformNode; -/** - * TSL object that represents the viewport of the camera used for the current render. - * - * @tsl - * @type {UniformNode} - */ -export const cameraViewport: UniformNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts deleted file mode 100644 index 5ee80d125..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/ClippingNode.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -export default ClippingNode; -export function clipping(): ClippingNode; -export function clippingAlpha(): ClippingNode; -export function hardwareClipping(): ClippingNode; -/** - * This node is used in {@link NodeMaterial} to setup the clipping - * which can happen hardware-accelerated (if supported) and optionally - * use alpha-to-coverage for anti-aliasing clipped edges. - * - * @augments Node - */ -declare class ClippingNode extends Node { - /** - * Constructs a new clipping node. - * - * @param {('default'|'hardware'|'alphaToCoverage')} [scope='default'] - The node's scope. Similar to other nodes, - * the selected scope influences the behavior of the node and what type of code is generated. - */ - constructor(scope?: ("default" | "hardware" | "alphaToCoverage")); - /** - * The node's scope. Similar to other nodes, the selected scope influences - * the behavior of the node and what type of code is generated. - * - * @type {('default'|'hardware'|'alphaToCoverage')} - */ - scope: ("default" | "hardware" | "alphaToCoverage"); - /** - * Setups the node depending on the selected scope. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The result node. - */ - setup(builder: NodeBuilder): Node; - hardwareClipping: any; - /** - * Setups alpha to coverage. - * - * @param {Array} intersectionPlanes - The intersection planes. - * @param {Array} unionPlanes - The union planes. - * @return {Node} The result node. - */ - setupAlphaToCoverage(intersectionPlanes: Array, unionPlanes: Array): Node; - /** - * Setups the default clipping. - * - * @param {Array} intersectionPlanes - The intersection planes. - * @param {Array} unionPlanes - The union planes. - * @return {Node} The result node. - */ - setupDefault(intersectionPlanes: Array, unionPlanes: Array): Node; - /** - * Setups hardware clipping. - * - * @param {Array} unionPlanes - The union planes. - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The result node. - */ - setupHardwareClipping(unionPlanes: Array, builder: NodeBuilder): Node; -} -declare namespace ClippingNode { - let ALPHA_TO_COVERAGE: string; - let DEFAULT: string; - let HARDWARE: string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts deleted file mode 100644 index 23a01c90a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/CubeTextureNode.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -export default CubeTextureNode; -/** - * TSL function for creating a cube texture node. - * - * @tsl - * @function - * @param {CubeTexture} value - The cube texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Node} [biasNode=null] - The bias node. - * @returns {CubeTextureNode} - */ -export const cubeTextureBase: any; -export function cubeTexture(value?: (CubeTexture | CubeTextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null): CubeTextureNode; -export function uniformCubeTexture(value?: CubeTexture | null): CubeTextureNode; -/** - * This type of uniform node represents a cube texture. - * - * @augments TextureNode - */ -declare class CubeTextureNode extends TextureNode { - /** - * Constructs a new cube texture node. - * - * @param {CubeTexture} value - The cube texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Node} [biasNode=null] - The bias node. - */ - constructor(value: CubeTexture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeTextureNode: boolean; - /** - * Overwritten with an empty implementation since the `updateMatrix` flag is ignored - * for cube textures. The uv transformation matrix is not applied to cube textures. - * - * @param {boolean} value - The update toggle. - */ - setUpdateMatrix(): void; -} -import { CubeTexture } from '../../textures/CubeTexture.js'; -import TextureNode from './TextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts deleted file mode 100644 index 7976840f6..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Instance.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * TSL object representing a varying property for the instanced color vector. - * - * @type {VaryingNode} - */ -export const instanceColor: VaryingNode; -/** - * TSL function representing the standard instancing vertex shader setup. - * Transforms positionLocal and normalLocal, and assigns varying color in-place. - * - * @tsl - * @function - * @param {InstancedBufferAttribute|StorageInstancedBufferAttribute} matrices - The instanced transformation matrices. - * @param {?InstancedBufferAttribute|StorageInstancedBufferAttribute} [colors=null] - The optional instanced colors. - */ -export const instance: () => void; -/** - * TSL wrapper for applying instanced mesh rendering setup. - * - * @tsl - * @function - * @param {InstancedMesh} instancedMesh - The instanced mesh. - */ -export const instancedMesh: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts deleted file mode 100644 index 1639939c2..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Lights.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * TSL function for getting a shadow matrix uniform node for the given light. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @returns {UniformNode} The shadow matrix uniform node. - */ -export function lightShadowMatrix(light: Light): UniformNode; -/** - * TSL function for getting projected uv coordinates for the given light. - * Relevant when using maps with spot lights. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @param {Node} [position=positionWorld] -The position to project. - * @returns {Node} The projected uvs. - */ -export function lightProjectionUV(light: Light, position?: Node): Node; -/** - * TSL function for getting the position in world space for the given light. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @returns {UniformNode} The light's position in world space. - */ -export function lightPosition(light: Light): UniformNode; -/** - * TSL function for getting the light target position in world space for the given light. - * - * @tsl - * @function - * @param {Light} light -The light source. - * @returns {UniformNode} The light target position in world space. - */ -export function lightTargetPosition(light: Light): UniformNode; -/** - * TSL function for getting the position in view space for the given light. - * - * @tsl - * @function - * @param {Light} light - The light source. - * @returns {UniformNode} The light's position in view space. - */ -export function lightViewPosition(light: Light): UniformNode; -export function lightTargetDirection(light: Light): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts deleted file mode 100644 index 35c61d585..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialNode.d.ts +++ /dev/null @@ -1,392 +0,0 @@ -export default MaterialNode; -/** - * TSL object that represents alpha test of the current material. - * - * @tsl - * @type {Node} - */ -export const materialAlphaTest: Node; -/** - * TSL object that represents the diffuse color of the current material. - * The value is composed via `color` * `map`. - * - * @tsl - * @type {Node} - */ -export const materialColor: Node; -/** - * TSL object that represents the shininess of the current material. - * - * @tsl - * @type {Node} - */ -export const materialShininess: Node; -/** - * TSL object that represents the emissive color of the current material. - * The value is composed via `emissive` * `emissiveIntensity` * `emissiveMap`. - * - * @tsl - * @type {Node} - */ -export const materialEmissive: Node; -/** - * TSL object that represents the opacity of the current material. - * The value is composed via `opacity` * `alphaMap`. - * - * @tsl - * @type {Node} - */ -export const materialOpacity: Node; -/** - * TSL object that represents the specular of the current material. - * - * @tsl - * @type {Node} - */ -export const materialSpecular: Node; -/** - * TSL object that represents the specular intensity of the current material. - * The value is composed via `specularIntensity` * `specularMap.a`. - * - * @tsl - * @type {Node} - */ -export const materialSpecularIntensity: Node; -/** - * TSL object that represents the specular color of the current material. - * The value is composed via `specularColor` * `specularMap.rgb`. - * - * @tsl - * @type {Node} - */ -export const materialSpecularColor: Node; -/** - * TSL object that represents the specular strength of the current material. - * The value is composed via `specularMap.r`. - * - * @tsl - * @type {Node} - */ -export const materialSpecularStrength: Node; -/** - * TSL object that represents the reflectivity of the current material. - * - * @tsl - * @type {Node} - */ -export const materialReflectivity: Node; -/** - * TSL object that represents the roughness of the current material. - * The value is composed via `roughness` * `roughnessMap.g`. - * - * @tsl - * @type {Node} - */ -export const materialRoughness: Node; -/** - * TSL object that represents the metalness of the current material. - * The value is composed via `metalness` * `metalnessMap.b`. - * - * @tsl - * @type {Node} - */ -export const materialMetalness: Node; -/** - * TSL object that represents the normal of the current material. - * The value will be either `normalMap` * `normalScale`, `bumpMap` * `bumpScale` or `normalView`. - * - * @tsl - * @type {Node} - */ -export const materialNormal: Node; -/** - * TSL object that represents the clearcoat of the current material. - * The value is composed via `clearcoat` * `clearcoatMap.r` - * - * @tsl - * @type {Node} - */ -export const materialClearcoat: Node; -/** - * TSL object that represents the clearcoat roughness of the current material. - * The value is composed via `clearcoatRoughness` * `clearcoatRoughnessMap.r`. - * - * @tsl - * @type {Node} - */ -export const materialClearcoatRoughness: Node; -/** - * TSL object that represents the clearcoat normal of the current material. - * The value will be either `clearcoatNormalMap` or `normalView`. - * - * @tsl - * @type {Node} - */ -export const materialClearcoatNormal: Node; -/** - * TSL object that represents the rotation of the current sprite material. - * - * @tsl - * @type {Node} - */ -export const materialRotation: Node; -/** - * TSL object that represents the sheen color of the current material. - * The value is composed via `sheen` * `sheenColor` * `sheenColorMap`. - * - * @tsl - * @type {Node} - */ -export const materialSheen: Node; -/** - * TSL object that represents the sheen roughness of the current material. - * The value is composed via `sheenRoughness` * `sheenRoughnessMap.a`. - * - * @tsl - * @type {Node} - */ -export const materialSheenRoughness: Node; -/** - * TSL object that represents the anisotropy of the current material. - * - * @tsl - * @type {Node} - */ -export const materialAnisotropy: Node; -/** - * TSL object that represents the iridescence of the current material. - * - * @tsl - * @type {Node} - */ -export const materialIridescence: Node; -/** - * TSL object that represents the iridescence IOR of the current material. - * - * @tsl - * @type {Node} - */ -export const materialIridescenceIOR: Node; -/** - * TSL object that represents the iridescence thickness of the current material. - * - * @tsl - * @type {Node} - */ -export const materialIridescenceThickness: Node; -/** - * TSL object that represents the transmission of the current material. - * The value is composed via `transmission` * `transmissionMap.r`. - * - * @tsl - * @type {Node} - */ -export const materialTransmission: Node; -/** - * TSL object that represents the thickness of the current material. - * The value is composed via `thickness` * `thicknessMap.g`. - * - * @tsl - * @type {Node} - */ -export const materialThickness: Node; -/** - * TSL object that represents the IOR of the current material. - * - * @tsl - * @type {Node} - */ -export const materialIOR: Node; -/** - * TSL object that represents the attenuation distance of the current material. - * - * @tsl - * @type {Node} - */ -export const materialAttenuationDistance: Node; -/** - * TSL object that represents the attenuation color of the current material. - * - * @tsl - * @type {Node} - */ -export const materialAttenuationColor: Node; -/** - * TSL object that represents the scale of the current dashed line material. - * - * @tsl - * @type {Node} - */ -export const materialLineScale: Node; -/** - * TSL object that represents the dash size of the current dashed line material. - * - * @tsl - * @type {Node} - */ -export const materialLineDashSize: Node; -/** - * TSL object that represents the gap size of the current dashed line material. - * - * @tsl - * @type {Node} - */ -export const materialLineGapSize: Node; -/** - * TSL object that represents the line width of the current line material. - * - * @tsl - * @type {Node} - */ -export const materialLineWidth: Node; -/** - * TSL object that represents the dash offset of the current line material. - * - * @tsl - * @type {Node} - */ -export const materialLineDashOffset: Node; -/** - * TSL object that represents the point size of the current points material. - * - * @tsl - * @type {Node} - */ -export const materialPointSize: Node; -/** - * TSL object that represents the dispersion of the current material. - * - * @tsl - * @type {Node} - */ -export const materialDispersion: Node; -/** - * TSL object that represents the retroreflective strength of the current material. - * - * @tsl - * @type {Node} - */ -export const materialRetroreflectivity: Node; -/** - * TSL object that represents the light map of the current material. - * The value is composed via `lightMapIntensity` * `lightMap.rgb`. - * - * @tsl - * @type {Node} - */ -export const materialLightMap: Node; -/** - * TSL object that represents the ambient occlusion map of the current material. - * The value is composed via `aoMap.r` - 1 * `aoMapIntensity` + 1. - * - * @tsl - * @type {Node} - */ -export const materialAO: Node; -/** - * TSL object that represents the anisotropy vector of the current material. - * - * @tsl - * @type {Node} - */ -export const materialAnisotropyVector: Node; -/** - * This class should simplify the node access to material properties. - * It internal uses reference nodes to make sure changes to material - * properties are automatically reflected to predefined TSL objects - * like e.g. `materialColor`. - * - * @augments Node - */ -declare class MaterialNode extends Node { - /** - * Constructs a new material node. - * - * @param {string} scope - The scope defines what kind of material property is referred by the node. - */ - constructor(scope: string); - /** - * The scope defines what material property is referred by the node. - * - * @type {string} - */ - scope: string; - /** - * Returns a cached reference node for the given property and type. - * - * @param {string} property - The name of the material property. - * @param {string} type - The uniform type of the property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getCache(property: string, type: string): MaterialReferenceNode; - /** - * Returns a float-typed material reference node for the given property name. - * - * @param {string} property - The name of the material property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getFloat(property: string): MaterialReferenceNode; - /** - * Returns a color-typed material reference node for the given property name. - * - * @param {string} property - The name of the material property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getColor(property: string): MaterialReferenceNode; - /** - * Returns a texture-typed material reference node for the given property name. - * - * @param {string} property - The name of the material property. - * @return {MaterialReferenceNode} A material reference node representing the property access. - */ - getTexture(property: string): MaterialReferenceNode; - /** - * The node setup is done depending on the selected scope. Multiple material properties - * might be grouped into a single node composition if they logically belong together. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The node representing the selected scope. - */ - setup(builder: NodeBuilder): Node; -} -declare namespace MaterialNode { - let ALPHA_TEST: string; - let COLOR: string; - let OPACITY: string; - let SHININESS: string; - let SPECULAR: string; - let SPECULAR_STRENGTH: string; - let SPECULAR_INTENSITY: string; - let SPECULAR_COLOR: string; - let REFLECTIVITY: string; - let ROUGHNESS: string; - let METALNESS: string; - let NORMAL: string; - let CLEARCOAT: string; - let CLEARCOAT_ROUGHNESS: string; - let CLEARCOAT_NORMAL: string; - let EMISSIVE: string; - let ROTATION: string; - let SHEEN: string; - let SHEEN_ROUGHNESS: string; - let ANISOTROPY: string; - let IRIDESCENCE: string; - let IRIDESCENCE_IOR: string; - let IRIDESCENCE_THICKNESS: string; - let IOR: string; - let TRANSMISSION: string; - let THICKNESS: string; - let ATTENUATION_DISTANCE: string; - let ATTENUATION_COLOR: string; - let LINE_SCALE: string; - let LINE_DASH_SIZE: string; - let LINE_GAP_SIZE: string; - let LINE_WIDTH: string; - let LINE_DASH_OFFSET: string; - let POINT_SIZE: string; - let DISPERSION: string; - let RETROREFLECTIVITY: string; - let LIGHT_MAP: string; - let AO: string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts deleted file mode 100644 index 6ef441cc9..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialProperties.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * TSL object that represents the refraction ratio of the material used for rendering the current object. - * - * @tsl - * @type {UniformNode} - */ -export const materialRefractionRatio: UniformNode; -/** - * TSL object that represents the intensity of environment maps of PBR materials. - * When `material.envMap` is set, the value is `material.envMapIntensity` otherwise `scene.environmentIntensity`. - * - * @tsl - * @type {Node} - */ -export const materialEnvIntensity: Node; -/** - * TSL object that represents the rotation of environment maps. - * When `material.envMap` is set, the value is `material.envMapRotation`. - * `scene.environmentRotation` controls the rotation of `scene.environment` or `scene.environmentNode` instead. - * - * @tsl - * @type {Node} - */ -export const materialEnvRotation: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts deleted file mode 100644 index 7a6029df8..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/MaterialReferenceNode.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default MaterialReferenceNode; -export function materialReference(name: string, type: string, material?: Material | null): MaterialReferenceNode; -/** - * This node is a special type of reference node which is intended - * for linking material properties with node values. - * ```js - * const opacityNode = materialReference( 'opacity', 'float', material ); - * ``` - * When changing `material.opacity`, the node value of `opacityNode` will - * automatically be updated. - * - * @augments ReferenceNode - */ -declare class MaterialReferenceNode extends ReferenceNode { - /** - * Constructs a new material reference node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} inputType - The uniform type that should be used to represent the property value. - * @param {?Material} [material=null] - The material the property belongs to. When no material is set, - * the node refers to the material of the current rendered object. - */ - constructor(property: string, inputType: string, material?: Material | null); - /** - * The material the property belongs to. When no material is set, - * the node refers to the material of the current rendered object. - * - * @type {?Material} - * @default null - */ - material: Material | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMaterialReferenceNode: boolean; -} -import ReferenceNode from './ReferenceNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts deleted file mode 100644 index b5523dfa3..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/ModelNode.d.ts +++ /dev/null @@ -1,104 +0,0 @@ -export default ModelNode; -/** - * TSL object that represents the object's direction in world space. - * - * @tsl - * @type {ModelNode} - */ -export const modelDirection: ModelNode; -/** - * TSL object that represents the object's world matrix. - * - * @tsl - * @type {ModelNode} - */ -export const modelWorldMatrix: ModelNode; -/** - * TSL object that represents the object's position in world space. - * - * @tsl - * @type {ModelNode} - */ -export const modelPosition: ModelNode; -/** - * TSL object that represents the object's scale in world space. - * - * @tsl - * @type {ModelNode} - */ -export const modelScale: ModelNode; -/** - * TSL object that represents the object's position in view/camera space. - * - * @tsl - * @type {ModelNode} - */ -export const modelViewPosition: ModelNode; -/** - * TSL object that represents the object's radius. - * - * @tsl - * @type {ModelNode} - */ -export const modelRadius: ModelNode; -/** - * TSL object that represents the object's normal matrix. - * - * @tsl - * @type {UniformNode} - */ -export const modelNormalMatrix: UniformNode; -/** - * TSL object that represents the object's inverse world matrix. - * - * @tsl - * @type {UniformNode} - */ -export const modelWorldMatrixInverse: UniformNode; -/** - * TSL object that represents the object's model view matrix. - * - * @tsl - * @type {Node} - */ -export const modelViewMatrix: Node; -/** - * TSL object that represents the object's model view in `mediump` precision. - * - * @tsl - * @type {Node} - */ -export const mediumpModelViewMatrix: Node; -/** - * TSL object that represents the object's model view in `highp` precision - * which is achieved by computing the matrix in JS and not in the shader. - * - * @tsl - * @type {Node} - */ -export const highpModelViewMatrix: Node; -/** - * TSL object that represents the object's model normal view in `highp` precision - * which is achieved by computing the matrix in JS and not in the shader. - * - * @tsl - * @type {Node} - */ -export const highpModelNormalViewMatrix: Node; -/** - * This type of node is a specialized version of `Object3DNode` - * with larger set of model related metrics. Unlike `Object3DNode`, - * `ModelNode` extracts the reference to the 3D object from the - * current node frame state. - * - * @augments Object3DNode - */ -declare class ModelNode extends Object3DNode { - /** - * Constructs a new object model node. - * - * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. - */ - constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix")); -} -import Object3DNode from './Object3DNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts deleted file mode 100644 index 40d0ac691..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/ModelViewProjectionNode.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -/** - * TSL object that represents the position in clip space after the model-view-projection transform of the current rendered object. - * - * @tsl - * @type {VaryingNode} - */ -export const modelViewProjection: VaryingNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts deleted file mode 100644 index 1713b3af4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Morph.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * TSL function representing the vertex shader morph targets blend setup. - * Dynamically computes morph targets weights and updates positionLocal and normalLocal in-place. - * - * @tsl - * @function - * @param {Mesh} mesh - The mesh. - */ -export const morphReference: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts deleted file mode 100644 index b7f3793b1..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Normal.d.ts +++ /dev/null @@ -1,100 +0,0 @@ -/** - * TSL object that represents the normal attribute of the current rendered object in local space. - * - * @tsl - * @type {Node} - */ -export const normalGeometry: Node; -/** - * TSL object that represents the vertex normal of the current rendered object in local space. - * - * @tsl - * @type {Node} - */ -export const normalLocal: Node; -/** - * TSL object that represents the flat vertex normal of the current rendered object in view space. - * - * @tsl - * @type {Node} - */ -export const normalFlat: Node; -/** - * TSL object that represents the vertex normal of the current rendered object in view space. - * - * @tsl - * @type {Node} - */ -export const normalViewGeometry: Node; -/** - * TSL object that represents the vertex normal of the current rendered object in world space. - * - * @tsl - * @type {Node} - */ -export const normalWorldGeometry: Node; -/** - * TSL object that represents the vertex normal of the current rendered object in view space. - * - * @tsl - * @type {Node} - */ -export const normalView: Node; -/** - * TSL object that represents the vertex normal of the current rendered object in world space. - * - * @tsl - * @type {Node} - */ -export const normalWorld: Node; -/** - * TSL object that represents the clearcoat vertex normal of the current rendered object in view space. - * - * @tsl - * @type {Node} - */ -export const clearcoatNormalView: Node; -/** - * Transforms the normal by the normal matrix of the given matrix and then normalizes the result. - * - * @tsl - * @function - * @param {Node} normal - The normal. - * @param {Node} [matrix=modelWorldMatrix] - The matrix. - * @return {Node} The transformed normal. - */ -export const transformNormal: () => void; -/** - * Transforms the given normal from local to view space. - * - * @tsl - * @function - * @param {Node} normal - The normal. - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The transformed normal. - */ -export const transformNormalToView: () => void; -/** - * TSL object that represents the transformed vertex normal of the current rendered object in view space. - * - * @tsl - * @type {Node} - * @deprecated since r178. Use `normalView` instead. - */ -export const transformedNormalView: Node; -/** - * TSL object that represents the transformed vertex normal of the current rendered object in world space. - * - * @tsl - * @type {Node} - * @deprecated since r178. Use `normalWorld` instead. - */ -export const transformedNormalWorld: Node; -/** - * TSL object that represents the transformed clearcoat vertex normal of the current rendered object in view space. - * - * @tsl - * @type {Node} - * @deprecated since r178. Use `clearcoatNormalView` instead. - */ -export const transformedClearcoatNormalView: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts deleted file mode 100644 index 99b15b948..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Object3DNode.d.ts +++ /dev/null @@ -1,128 +0,0 @@ -export default Object3DNode; -/** - * TSL function for creating an object 3D node that represents the object's direction in world space. - * - * @tsl - * @function - * @param {?Object3D} [object3d] - The 3D object. - * @returns {Object3DNode} - */ -export const objectDirection: any; -/** - * TSL function for creating an object 3D node that represents the object's world matrix. - * - * @tsl - * @function - * @param {?Object3D} [object3d] - The 3D object. - * @returns {Object3DNode} - */ -export const objectWorldMatrix: any; -/** - * TSL function for creating an object 3D node that represents the object's position in world space. - * - * @tsl - * @function - * @param {?Object3D} [object3d] - The 3D object. - * @returns {Object3DNode} - */ -export const objectPosition: any; -/** - * TSL function for creating an object 3D node that represents the object's scale in world space. - * - * @tsl - * @function - * @param {?Object3D} [object3d] - The 3D object. - * @returns {Object3DNode} - */ -export const objectScale: any; -/** - * TSL function for creating an object 3D node that represents the object's position in view/camera space. - * - * @tsl - * @function - * @param {?Object3D} [object3d] - The 3D object. - * @returns {Object3DNode} - */ -export const objectViewPosition: any; -/** - * TSL function for creating an object 3D node that represents the object's radius. - * - * @tsl - * @function - * @param {?Object3D} [object3d] - The 3D object. - * @returns {Object3DNode} - */ -export const objectRadius: any; -/** - * This node can be used to access transformation related metrics of 3D objects. - * Depending on the selected scope, a different metric is represented as a uniform - * in the shader. The following scopes are supported: - * - * - `POSITION`: The object's position in world space. - * - `VIEW_POSITION`: The object's position in view/camera space. - * - `DIRECTION`: The object's direction in world space. - * - `SCALE`: The object's scale in world space. - * - `WORLD_MATRIX`: The object's matrix in world space. - * - * @augments Node - */ -declare class Object3DNode extends Node { - /** - * Constructs a new object 3D node. - * - * @param {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} scope - The node represents a different type of transformation depending on the scope. - * @param {?Object3D} [object3d=null] - The 3D object. - */ - constructor(scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"), object3d?: Object3D | null); - /** - * The node reports a different type of transformation depending on the scope. - * - * @type {('position'|'viewPosition'|'direction'|'scale'|'worldMatrix')} - */ - scope: ("position" | "viewPosition" | "direction" | "scale" | "worldMatrix"); - /** - * The 3D object. - * - * @type {?Object3D} - * @default null - */ - object3d: Object3D | null; - /** - * Holds the value of the node as a uniform. - * - * @type {UniformNode} - */ - uniformNode: UniformNode; - /** - * Overwritten since the node type is inferred from the scope. - * - * @return {('mat4'|'vec3'|'float')} The node type. - */ - generateNodeType(): ("mat4" | "vec3" | "float"); - /** - * Updates the uniform value depending on the scope. - * - * @param {NodeFrame} frame - The current node frame. - */ - update(frame: NodeFrame): void; - /** - * Generates the code snippet of the uniform node. The node type of the uniform - * node also depends on the selected scope. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder): string; - serialize(data: any): void; - deserialize(data: any): void; -} -declare namespace Object3DNode { - let WORLD_MATRIX: string; - let POSITION: string; - let SCALE: string; - let VIEW_POSITION: string; - let DIRECTION: string; - let RADIUS: string; -} -import Node from '../core/Node.js'; -import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts deleted file mode 100644 index 67872c0e7..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/PointUVNode.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -export default PointUVNode; -/** - * TSL object that represents the uv coordinates of points. - * - * @tsl - * @type {PointUVNode} - */ -export const pointUV: PointUVNode; -/** - * A node for representing the uv coordinates of points. - * - * Can only be used with a WebGL backend. In WebGPU, point - * primitives always have the size of one pixel and can thus - * can't be used as sprite-like objects that display textures. - * - * @augments Node - */ -declare class PointUVNode extends Node { - /** - * Constructs a new point uv node. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPointUVNode: boolean; - generate(): string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts deleted file mode 100644 index 6b2893c1d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Position.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * TSL object that represents the clip space position of the current rendered object. - * - * @tsl - * @type {VaryingNode} - */ -export const clipSpace: VaryingNode; -/** - * TSL object that represents the position attribute of the current rendered object. - * - * @tsl - * @type {AttributeNode} - */ -export const positionGeometry: AttributeNode; -/** - * TSL object that represents the transformed vertex position in local space of the current rendered object. - * - * The term "transformed" indicates that an object or material's properties, such as skinning, batch, - * instancing, or displacement mapping, will change the vertex position of the node when present. - * To use the pre-transformed local space position of the object, use {@link positionGeometry}. - * - * @tsl - * @type {AttributeNode} - */ -export const positionLocal: AttributeNode; -/** - * TSL object that represents the previous vertex position in local space of the current rendered object. - * Used in context of {@link VelocityNode} for rendering motion vectors. - * - * @tsl - * @type {AttributeNode} - */ -export const positionPrevious: AttributeNode; -/** - * TSL object that represents the vertex position in world space of the current rendered object. - * - * @tsl - * @type {VaryingNode} - */ -export const positionWorld: VaryingNode; -/** - * TSL object that represents the position world direction of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const positionWorldDirection: Node; -/** - * TSL object that represents the vertex position in view space of the current rendered object. - * - * @tsl - * @type {VaryingNode} - */ -export const positionView: VaryingNode; -/** - * TSL object that represents the position view direction of the current rendered object. - * - * @tsl - * @type {VaryingNode} - */ -export const positionViewDirection: VaryingNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts deleted file mode 100644 index 856e0f400..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceBaseNode.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -export default ReferenceBaseNode; -export function reference(name: string, type: string, object: Object): ReferenceBaseNode; -export function referenceBuffer(name: string, type: string, count: number, object?: Object): ReferenceBaseNode; -/** - * Base class for nodes which establishes a reference to a property of another object. - * In this way, the value of the node is automatically linked to the value of - * referenced object. Reference nodes internally represent the linked value - * as a uniform. - * - * @augments Node - */ -declare class ReferenceBaseNode extends Node { - /** - * Constructs a new reference base node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} uniformType - The uniform type that should be used to represent the property value. - * @param {?Object} [object=null] - The object the property belongs to. - * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. - */ - constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); - /** - * The name of the property the node refers to. - * - * @type {string} - */ - property: string; - /** - * The uniform type that should be used to represent the property value. - * - * @type {string} - */ - uniformType: string; - /** - * The object the property belongs to. - * - * @type {?Object} - * @default null - */ - object: Object | null; - /** - * When the linked property is an array, this parameter defines its length. - * - * @type {?number} - * @default null - */ - count: number | null; - /** - * The property name might have dots so nested properties can be referred. - * The hierarchy of the names is stored inside this array. - * - * @type {Array} - */ - properties: Array; - /** - * Points to the current referred object. This property exists next to {@link ReferenceNode#object} - * since the final reference might be updated from calling code. - * - * @type {?Object} - * @default null - */ - reference: Object | null; - /** - * The uniform node that holds the value of the reference node. - * - * @type {UniformNode} - * @default null - */ - node: UniformNode; - /** - * The uniform group of the internal uniform. - * - * @type {UniformGroupNode} - * @default null - */ - group: UniformGroupNode; - /** - * Sets the uniform group for this reference node. - * - * @param {UniformGroupNode} group - The uniform group to set. - * @return {ReferenceBaseNode} A reference to this node. - */ - setGroup(group: UniformGroupNode): ReferenceBaseNode; - /** - * When the referred property is array-like, this method can be used - * to access elements via an index node. - * - * @param {IndexNode} indexNode - indexNode. - * @return {ReferenceElementNode} A reference to an element. - */ - element(indexNode: IndexNode): ReferenceElementNode; - /** - * Sets the node type which automatically defines the internal - * uniform type. - * - * @param {string} uniformType - The type to set. - */ - setNodeType(uniformType: string): void; - /** - * This method is overwritten since the node type is inferred from - * the type of the reference node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the property value from the given referred object. - * - * @param {Object} [object=this.reference] - The object to retrieve the property value from. - * @return {any} The value. - */ - getValueFromReference(object?: Object): any; - /** - * Allows to update the reference based on the given state. The state is only - * evaluated {@link ReferenceBaseNode#object} is not set. - * - * @param {(NodeFrame|NodeBuilder)} state - The current state. - * @return {Object} The updated reference. - */ - updateReference(state: (NodeFrame | NodeBuilder)): Object; - /** - * The output of the reference node is the internal uniform node. - * - * @return {UniformNode} The output node. - */ - setup(): UniformNode; - /** - * Overwritten to update the internal uniform value. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(): void; - /** - * Retrieves the value from the referred object property and uses it - * to updated the internal uniform. - */ - updateValue(): void; -} -import Node from '../core/Node.js'; -import ReferenceElementNode from './ReferenceElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts deleted file mode 100644 index f46eabeb4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceElementNode.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export default ReferenceElementNode; -/** - * This class is only relevant if the referenced property is array-like. - * In this case, `ReferenceElementNode` allows to refer to a specific - * element inside the data structure via an index. - * - * @augments ArrayElementNode - */ -declare class ReferenceElementNode extends ArrayElementNode { - /** - * Constructs a new reference element node. - * - * @param {(ReferenceBaseNode|ReferenceNode)} referenceNode - The reference node. - * @param {Node} indexNode - The index node that defines the element access. - */ - constructor(referenceNode: (ReferenceBaseNode | ReferenceNode), indexNode: Node); - /** - * Similar to {@link ReferenceNode#reference}, an additional - * property references to the current node. - * - * @type {?(ReferenceBaseNode|ReferenceNode)} - * @default null - */ - referenceNode: (ReferenceBaseNode | ReferenceNode) | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isReferenceElementNode: boolean; - /** - * This method is overwritten since the node type is inferred from - * the uniform type of the reference node. - * - * @return {string} The node type. - */ - generateNodeType(): string; - generate(builder: any): any; -} -import ArrayElementNode from '../utils/ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts deleted file mode 100644 index c5aa93edd..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/ReferenceNode.d.ts +++ /dev/null @@ -1,157 +0,0 @@ -export default ReferenceNode; -export function reference(name: string, type: string, object?: Object | null): ReferenceNode; -export function referenceBuffer(name: string, type: string, count: number, object: Object): ReferenceNode; -/** - * This type of node establishes a reference to a property of another object. - * In this way, the value of the node is automatically linked to the value of - * referenced object. Reference nodes internally represent the linked value - * as a uniform. - * - * @augments Node - */ -declare class ReferenceNode extends Node { - /** - * Constructs a new reference node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} uniformType - The uniform type that should be used to represent the property value. - * @param {?Object} [object=null] - The object the property belongs to. - * @param {?number} [count=null] - When the linked property is an array-like, this parameter defines its length. - */ - constructor(property: string, uniformType: string, object?: Object | null, count?: number | null); - /** - * The name of the property the node refers to. - * - * @type {string} - */ - property: string; - /** - * The uniform type that should be used to represent the property value. - * - * @type {string} - */ - uniformType: string; - /** - * The object the property belongs to. - * - * @type {?Object} - * @default null - */ - object: Object | null; - /** - * When the linked property is an array, this parameter defines its length. - * - * @type {?number} - * @default null - */ - count: number | null; - /** - * The property name might have dots so nested properties can be referred. - * The hierarchy of the names is stored inside this array. - * - * @type {Array} - */ - properties: Array; - /** - * Points to the current referred object. This property exists next to {@link ReferenceNode#object} - * since the final reference might be updated from calling code. - * - * @type {?Object} - * @default null - */ - reference: Object | null; - /** - * The uniform node that holds the value of the reference node. - * - * @type {UniformNode} - * @default null - */ - node: UniformNode; - /** - * The uniform group of the internal uniform. - * - * @type {UniformGroupNode} - * @default null - */ - group: UniformGroupNode; - /** - * When the referred property is array-like, this method can be used - * to access elements via an index node. - * - * @param {IndexNode} indexNode - indexNode. - * @return {ReferenceElementNode} A reference to an element. - */ - element(indexNode: IndexNode): ReferenceElementNode; - /** - * Sets the uniform group for this reference node. - * - * @param {UniformGroupNode} group - The uniform group to set. - * @return {ReferenceNode} A reference to this node. - */ - setGroup(group: UniformGroupNode): ReferenceNode; - /** - * Sets the name for the internal uniform. - * - * @param {string} name - The label to set. - * @return {ReferenceNode} A reference to this node. - */ - setName(name: string): ReferenceNode; - /** - * Sets the label for the internal uniform. - * - * @deprecated - * @param {string} name - The label to set. - * @return {ReferenceNode} A reference to this node. - */ - label(name: string): ReferenceNode; - /** - * Sets the node type which automatically defines the internal - * uniform type. - * - * @param {string} uniformType - The type to set. - */ - setNodeType(uniformType: string): void; - /** - * This method is overwritten since the node type is inferred from - * the type of the reference node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the property value from the given referred object. - * - * @param {Object} [object=this.reference] - The object to retrieve the property value from. - * @return {any} The value. - */ - getValueFromReference(object?: Object): any; - /** - * Allows to update the reference based on the given state. The state is only - * evaluated {@link ReferenceNode#object} is not set. - * - * @param {(NodeFrame|NodeBuilder)} state - The current state. - * @return {Object} The updated reference. - */ - updateReference(state: (NodeFrame | NodeBuilder)): Object; - /** - * The output of the reference node is the internal uniform node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {UniformNode} The output node. - */ - setup(): UniformNode; - /** - * Overwritten to update the internal uniform value. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(): void; - /** - * Retrieves the value from the referred object property and uses it - * to updated the internal uniform. - */ - updateValue(): void; -} -import Node from '../core/Node.js'; -import ReferenceElementNode from './ReferenceElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts deleted file mode 100644 index 6cf15717c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/ReflectVector.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * The reflect vector in view space. - * - * @tsl - * @type {Node} - */ -export const reflectView: Node; -/** - * The refract vector in view space. - * - * @tsl - * @type {Node} - */ -export const refractView: Node; -/** - * Used for sampling cube maps when using cube reflection mapping. - * - * @tsl - * @type {Node} - */ -export const reflectVector: Node; -/** - * Used for sampling cube maps when using cube refraction mapping. - * - * @tsl - * @type {Node} - */ -export const refractVector: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts deleted file mode 100644 index 43bd3b071..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/RendererReferenceNode.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -export default RendererReferenceNode; -export function rendererReference(name: string, type: string, renderer?: Renderer | null): RendererReferenceNode; -/** - * This node is a special type of reference node which is intended - * for linking renderer properties with node values. - * ```js - * const exposureNode = rendererReference( 'toneMappingExposure', 'float', renderer ); - * ``` - * When changing `renderer.toneMappingExposure`, the node value of `exposureNode` will - * automatically be updated. - * - * @augments ReferenceBaseNode - */ -declare class RendererReferenceNode extends ReferenceBaseNode { - /** - * Constructs a new renderer reference node. - * - * @param {string} property - The name of the property the node refers to. - * @param {string} inputType - The uniform type that should be used to represent the property value. - * @param {?Renderer} [renderer=null] - The renderer the property belongs to. When no renderer is set, - * the node refers to the renderer of the current state. - */ - constructor(property: string, inputType: string, renderer?: Renderer | null); - /** - * The renderer the property belongs to. When no renderer is set, - * the node refers to the renderer of the current state. - * - * @type {?Renderer} - * @default null - */ - renderer: Renderer | null; -} -import ReferenceBaseNode from './ReferenceBaseNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts deleted file mode 100644 index 12f6b0aef..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/SceneProperties.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * TSL object that represents the scene's background blurriness. - * - * @tsl - * @type {Node} - */ -export const backgroundBlurriness: Node; -/** - * TSL object that represents the scene's background intensity. - * - * @tsl - * @type {Node} - */ -export const backgroundIntensity: Node; -/** - * TSL object that represents the scene's background rotation. - * - * @tsl - * @type {Node} - */ -export const backgroundRotation: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts deleted file mode 100644 index ca4dd3dff..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Skinning.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * TSL function representing the standard skeletal animation vertex shader setup. - * Transforms positionLocal, normalLocal, and tangentLocal in-place. - * - * @tsl - * @function - * @param {SkinnedMesh} skinnedMesh - The skinned mesh. - */ -export const skinning: () => void; -/** - * TSL function that computes skeletal animation for custom compute passes. - * - * @tsl - * @function - * @param {SkinnedMesh} skinnedMesh - The skinned mesh. - * @param {Node} [toPosition=null] - The target position node to assign. - * @returns {Node} The computed skinned position node. - */ -export const computeSkinning: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts deleted file mode 100644 index fea4f9cd4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageBufferNode.d.ts +++ /dev/null @@ -1,183 +0,0 @@ -export default StorageBufferNode; -export function storage(value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, type?: (string | Struct) | null, count?: number): StorageBufferNode; -/** - * This node is used in context of compute shaders and allows to define a - * storage buffer for data. A typical workflow is to create instances of - * this node with the convenience functions `attributeArray()` or `instancedArray()`, - * setup up a compute shader that writes into the buffers and then convert - * the storage buffers to attribute nodes for rendering. - * - * ```js - * const positionBuffer = instancedArray( particleCount, 'vec3' ); // the storage buffer node - * - * const computeInit = Fn( () => { // the compute shader - * - * const position = positionBuffer.element( instanceIndex ); - * - * // compute position data - * - * position.x = 1; - * position.y = 1; - * position.z = 1; - * - * } )().compute( particleCount ); - * - * const particleMaterial = new THREE.SpriteNodeMaterial(); - * particleMaterial.positionNode = positionBuffer.toAttribute(); - * - * renderer.computeAsync( computeInit ); - * - * ``` - * - * @augments BufferNode - */ -declare class StorageBufferNode extends BufferNode { - /** - * Constructs a new storage buffer node. - * - * @param {StorageBufferAttribute|StorageInstancedBufferAttribute|BufferAttribute} value - The buffer data. - * @param {?(string|Struct)} [bufferType=null] - The buffer type (e.g. `'vec3'`). - * @param {number} [bufferCount=0] - The buffer count. - */ - constructor(value: StorageBufferAttribute | StorageInstancedBufferAttribute | BufferAttribute, bufferType?: (string | Struct) | null, bufferCount?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageBufferNode: boolean; - /** - * The buffer struct type. - * - * @type {?StructTypeNode} - * @default null - */ - structTypeNode: StructTypeNode | null; - /** - * The access type of the texture node. - * - * @type {string} - * @default 'readWrite' - */ - access: string; - /** - * Whether the node is atomic or not. - * - * @type {boolean} - * @default false - */ - isAtomic: boolean; - /** - * Whether the node represents a PBO or not. - * Only relevant for WebGL. - * - * @type {boolean} - * @default false - */ - isPBO: boolean; - /** - * A reference to the internal buffer attribute node. - * - * @private - * @type {?BufferAttributeNode} - * @default null - */ - private _attribute; - /** - * A reference to the internal varying node. - * - * @private - * @type {?VaryingNode} - * @default null - */ - private _varying; - /** - * This method is overwritten since the buffer data might be shared - * and thus the hash should be shared as well. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(builder: NodeBuilder): string; - /** - * Enables element access with the given index node. - * - * @param {IndexNode} indexNode - The index node. - * @return {StorageArrayElementNode} A node representing the element access. - */ - element(indexNode: IndexNode): StorageArrayElementNode; - /** - * Defines whether this node is a PBO or not. Only relevant for WebGL. - * - * @param {boolean} value - The value so set. - * @return {StorageBufferNode} A reference to this node. - */ - setPBO(value: boolean): StorageBufferNode; - /** - * Returns the `isPBO` value. - * - * @return {boolean} Whether the node represents a PBO or not. - */ - getPBO(): boolean; - /** - * Defines the node access. - * - * @param {string} value - The node access. - * @return {StorageBufferNode} A reference to this node. - */ - setAccess(value: string): StorageBufferNode; - /** - * Convenience method for configuring a read-only node access. - * - * @return {StorageBufferNode} A reference to this node. - */ - toReadOnly(): StorageBufferNode; - /** - * Defines whether the node is atomic or not. - * - * @param {boolean} value - The atomic flag. - * @return {StorageBufferNode} A reference to this node. - */ - setAtomic(value: boolean): StorageBufferNode; - /** - * Convenience method for making this node atomic. - * - * @return {StorageBufferNode} A reference to this node. - */ - toAtomic(): StorageBufferNode; - /** - * Returns attribute data for this storage buffer node. - * - * @return {{attribute: BufferAttributeNode, varying: VaryingNode}} The attribute data. - */ - getAttributeData(): { - attribute: BufferAttributeNode; - varying: VaryingNode; - }; - /** - * This method is overwritten since the node type from the availability of storage buffers - * and the attribute data. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the type of a member of the struct. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member. - * @return {string} The type of the member. - */ - getMemberType(builder: NodeBuilder, name: string): string; - /** - * Generates the code snippet of the storage buffer node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder): string; -} -import BufferNode from './BufferNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts deleted file mode 100644 index 72f129b88..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTexture3DNode.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -export default StorageTexture3DNode; -/** - * TSL function for creating a 3D storage texture node. - * - * @tsl - * @function - * @param {Storage3DTexture} value - The 3D storage texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. - * @returns {StorageTexture3DNode} - */ -export const storageTexture3D: any; -/** - * This special version of a texture node can be used to - * write data into a 3D storage texture with a compute shader. - * - * @augments StorageTextureNode - */ -declare class StorageTexture3DNode extends StorageTextureNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture3DNode: boolean; - /** - * Overwritten with an empty implementation since the `updateMatrix` flag is ignored - * for 3D textures. The uv transformation matrix is not applied to 3D textures. - * - * @param {boolean} value - The update toggle. - */ - setUpdateMatrix(): void; -} -import StorageTextureNode from './StorageTextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts deleted file mode 100644 index f1ac56640..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/StorageTextureNode.d.ts +++ /dev/null @@ -1,146 +0,0 @@ -export default StorageTextureNode; -/** - * TSL function for creating a storage texture node. - * - * @tsl - * @function - * @param {StorageTexture} value - The storage texture. - * @param {?Node} uvNode - The uv node. - * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. - * @returns {StorageTextureNode} - */ -export const storageTexture: any; -export function textureStore(value: StorageTexture | StorageTextureNode, uvNode: Node, storeNode?: Node | null): StorageTextureNode; -/** - * This special version of a texture node can be used to - * write data into a storage texture with a compute shader. - * - * ```js - * const storageTexture = new THREE.StorageTexture( width, height ); - * - * const computeTexture = Fn( ( { storageTexture } ) => { - * - * const posX = instanceIndex.mod( width ); - * const posY = instanceIndex.div( width ); - * const indexUV = uvec2( posX, posY ); - * - * // generate RGB values - * - * const r = 1; - * const g = 1; - * const b = 1; - * - * textureStore( storageTexture, indexUV, vec4( r, g, b, 1 ) ).toWriteOnly(); - * - * } ); - * - * const computeNode = computeTexture( { storageTexture } ).compute( width * height ); - * renderer.computeAsync( computeNode ); - * ``` - * - * This node can only be used with a WebGPU backend. - * - * @augments TextureNode - */ -declare class StorageTextureNode extends TextureNode { - /** - * Constructs a new storage texture node. - * - * @param {StorageTexture} value - The storage texture. - * @param {Node} uvNode - The uv node. - * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. - */ - constructor(value: StorageTexture, uvNode: Node, storeNode?: Node | null); - /** - * The value node that should be stored in the texture. - * - * @type {?Node} - * @default null - */ - storeNode: Node | null; - /** - * The mip level to write to for storage textures. - * - * @type {number} - * @default 0 - */ - mipLevel: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTextureNode: boolean; - /** - * The access type of the texture node. - * - * @type {string} - * @default 'writeOnly' - */ - access: string; - setup(builder: any): any; - /** - * Defines the node access. - * - * @param {string} value - The node access. - * @return {StorageTextureNode} A reference to this node. - */ - setAccess(value: string): StorageTextureNode; - /** - * Sets the mip level to write to. - * - * @param {number} level - The mip level. - * @return {StorageTextureNode} A reference to this node. - */ - setMipLevel(level: number): StorageTextureNode; - /** - * Generates the snippet for the storage texture. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} textureProperty - The texture property. - * @param {string} uvSnippet - The uv snippet. - * @param {?string} levelSnippet - The level snippet. - * @param {?string} biasSnippet - The bias snippet. - * @param {?string} depthSnippet - The depth snippet. - * @param {?string} compareSnippet - The compare snippet. - * @param {?Array} gradSnippet - The grad snippet. - * @param {?string} offsetSnippet - The offset snippet. - * @return {string} The generated code snippet. - */ - generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, offsetSnippet: string | null): string; - /** - * Convenience method for configuring a read/write node access. - * - * @return {StorageTextureNode} A reference to this node. - */ - toReadWrite(): StorageTextureNode; - /** - * Convenience method for configuring a read-only node access. - * - * @return {StorageTextureNode} A reference to this node. - */ - toReadOnly(): StorageTextureNode; - /** - * Convenience method for configuring a write-only node access. - * - * @return {StorageTextureNode} A reference to this node. - */ - toWriteOnly(): StorageTextureNode; - /** - * Stores a value in this storage texture at the given coordinates. - * - * @param {Node} uvNode - The storage texture coordinates. - * @param {?Node} [storeNode=null] - The value node that should be stored in the texture. - * @return {StorageTextureNode} A storage texture node representing the store operation. - */ - store(uvNode: Node, storeNode?: Node | null): StorageTextureNode; - /** - * Generates the code snippet of the storage texture node. - * - * @param {NodeBuilder} builder - The current node builder. - */ - generateStore(builder: NodeBuilder): void; -} -import TextureNode from './TextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts deleted file mode 100644 index fa48ada28..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Tangent.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * TSL object that represents the tangent attribute of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const tangentGeometry: Node; -/** - * TSL object that represents the vertex tangent in local space of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const tangentLocal: Node; -/** - * TSL object that represents the vertex tangent in view space of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const tangentView: Node; -/** - * TSL object that represents the vertex tangent in world space of the current rendered object. - * - * @tsl - * @type {Node} - */ -export const tangentWorld: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts deleted file mode 100644 index 5ae231172..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/TangentUtils.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Tangent vector in view space, computed dynamically from geometry and UV derivatives. - * Useful for normal mapping without precomputed tangents. - * - * Reference: http://www.thetenthplanet.de/archives/1180 - * - * @tsl - * @type {Node} - */ -export const tangentViewFrame: Node; -/** - * Bitangent vector in view space, computed dynamically from geometry and UV derivatives. - * Complements the tangentViewFrame for constructing the tangent space basis. - * - * Reference: http://www.thetenthplanet.de/archives/1180 - * - * @tsl - * @type {Node} - */ -export const bitangentViewFrame: Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts deleted file mode 100644 index 1b1066b8b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/Texture3DNode.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -export default Texture3DNode; -/** - * TSL function for creating a 3D texture node. - * - * @tsl - * @function - * @param {Data3DTexture} value - The 3D texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @returns {Texture3DNode} - */ -export const texture3D: any; -export function texture3DLoad(...params: any[]): TextureNode; -export function texture3DLevel(value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null): TextureNode; -/** - * This type of uniform node represents a 3D texture. - * - * @augments TextureNode - */ -declare class Texture3DNode extends TextureNode { - /** - * Constructs a new 3D texture node. - * - * @param {Data3DTexture} value - The 3D texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - */ - constructor(value: Data3DTexture, uvNode?: Node | null, levelNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTexture3DNode: boolean; - /** - * Overwritten with an empty implementation since the `updateMatrix` flag is ignored - * for 3D textures. The uv transformation matrix is not applied to 3D textures. - * - * @param {boolean} value - The update toggle. - */ - setUpdateMatrix(): void; - /** - * Computes the normal for the given uv. These texture coordiantes represent a - * position inside the 3D texture. Unlike geometric normals, this normal - * represents a slope or gradient of scalar data inside the 3D texture. - * - * @param {Node} uvNode - The uv node that defines a position in the 3D texture. - * @return {Node} The normal representing the slope/gradient in the data. - */ - normal(uvNode: Node): Node; -} -import TextureNode from './TextureNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts deleted file mode 100644 index ff3a05aad..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureBicubic.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Applies mipped bicubic texture filtering to the given texture node. - * - * @tsl - * @function - * @param {TextureNode} textureNode - The texture node that should be filtered. - * @param {Node} lodNode - Defines the LOD to sample from. - * @return {Node} The filtered texture sample. - */ -export const textureBicubicLevel: () => void; -/** - * Applies mipped bicubic texture filtering to the given texture node. - * - * @tsl - * @function - * @param {TextureNode} textureNode - The texture node that should be filtered. - * @param {Node} [strength] - Defines the strength of the bicubic filtering. - * @return {Node} The filtered texture sample. - */ -export const textureBicubic: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts deleted file mode 100644 index 76de67ef9..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureNode.d.ts +++ /dev/null @@ -1,369 +0,0 @@ -export default TextureNode; -export function texture(value?: (Texture | TextureNode) | null, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null): TextureNode; -export function uniformTexture(value?: Texture | null): TextureNode; -export function textureLoad(...params: any[]): TextureNode; -export function textureLevel(value: any, uv: any, level: any): TextureNode; -export function sampler(value: TextureNode | Texture): Node; -export function samplerComparison(value: TextureNode | Texture): Node; -/** - * This type of uniform node represents a 2D texture. - * - * @augments UniformNode - */ -declare class TextureNode extends UniformNode { - /** - * Constructs a new texture node. - * - * @param {Texture} [value=EmptyTexture] - The texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Node} [biasNode=null] - The bias node. - */ - constructor(value?: Texture, uvNode?: Node | null, levelNode?: Node | null, biasNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTextureNode: boolean; - /** - * Represents the texture coordinates. - * - * @type {?Node} - * @default null - */ - uvNode: Node | null; - /** - * Represents the mip level that should be selected. - * - * @type {?Node} - * @default null - */ - levelNode: Node | null; - /** - * Represents the bias to be applied during level-of-detail computation. - * - * @type {?Node} - * @default null - */ - biasNode: Node | null; - /** - * Represents a reference value a texture sample is compared to. - * - * @type {?Node} - * @default null - */ - compareNode: Node | null; - /** - * When using texture arrays, the depth node defines the layer to select. - * - * @type {?Node} - * @default null - */ - depthNode: Node | null; - /** - * When defined, a texture is sampled using explicit gradients. - * - * @type {?Array>} - * @default null - */ - gradNode: Array> | null; - /** - * Represents the optional index constant of the channel to gather. - * This must be in range [0, 3] and a compile-time constant. - * - * @type {?Node} - * @default null - */ - gatherNode: Node | null; - /** - * Represents the optional texel offset applied to the unnormalized texture - * coordinate before sampling the texture. - * - * @type {?Node} - * @default null - */ - offsetNode: Node | null; - /** - * Whether texture values should be sampled or fetched. - * - * @type {boolean} - * @default true - */ - sampler: boolean; - /** - * Whether the uv transformation matrix should be - * automatically updated or not. Use `setUpdateMatrix()` - * if you want to change the value of the property. - * - * @type {boolean} - * @default false - */ - updateMatrix: boolean; - /** - * The reference node. - * - * @type {?Node} - * @default null - */ - referenceNode: Node | null; - /** - * The texture value is stored in a private property. - * - * @private - * @type {Texture} - */ - private _value; - /** - * The uniform node that represents the uv transformation matrix. - * - * @private - * @type {?UniformNode} - * @default null - */ - private _matrixUniform; - /** - * The uniform node that represents the y-flip. Only required for WebGL. - * - * @private - * @type {?UniformNode} - * @default null - */ - private _flipYUniform; - /** - * Whether the node is used as a comparison sampler, e.g. via `samplerComparison()`. - * - * @private - * @type {boolean} - * @default false - */ - private _samplerComparison; - set value(value: Texture); - /** - * The texture value. - * - * @type {Texture} - */ - get value(): Texture; - /** - * Overwritten since the uniform hash is defined by the texture's UUID. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The uniform hash. - */ - getUniformHash(): string; - /** - * Overwritten since the node type is inferred from the texture type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(): string; - /** - * Overwrites the default implementation to return a fixed value `'texture'`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; - /** - * Returns a default uvs based on the current texture's channel. - * - * @return {AttributeNode} The default uvs. - */ - getDefaultUV(): AttributeNode; - /** - * Overwritten to always return the texture reference of the node. - * - * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. - * @return {Texture} The texture reference. - */ - updateReference(): Texture; - /** - * Transforms the given uv node with the texture transformation matrix. - * - * @param {Node} uvNode - The uv node to transform. - * @return {Node} The transformed uv node. - */ - getTransformedUV(uvNode: Node): Node; - /** - * Defines whether the uv transformation matrix should automatically be updated or not. - * - * @param {boolean} value - The update toggle. - * @return {TextureNode} A reference to this node. - */ - setUpdateMatrix(value: boolean): TextureNode; - /** - * Setups the uv node. Depending on the backend as well as texture's image and type, it might be necessary - * to modify the uv node for correct sampling. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} uvNode - The uv node to setup. - * @return {Node} The updated uv node. - */ - setupUV(builder: NodeBuilder, uvNode: Node): Node; - /** - * Setups texture node by preparing the internal nodes for code generation. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * Generates the uv code snippet. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} uvNode - The uv node to generate code for. - * @return {string} The generated code snippet. - */ - generateUV(builder: NodeBuilder, uvNode: Node): string; - /** - * Generates the offset code snippet. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {Node} offsetNode - The offset node to generate code for. - * @return {string} The generated code snippet. - */ - generateOffset(builder: NodeBuilder, offsetNode: Node): string; - /** - * Generates the snippet for the texture sampling. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} textureProperty - The texture property. - * @param {string} uvSnippet - The uv snippet. - * @param {?string} levelSnippet - The level snippet. - * @param {?string} biasSnippet - The bias snippet. - * @param {?string} depthSnippet - The depth snippet. - * @param {?string} compareSnippet - The compare snippet. - * @param {?Array} gradSnippet - The grad snippet. - * @param {?string} gatherSnippet - The gather snippet. - * @param {?string} offsetSnippet - The offset snippet. - * @param {?string} flipYSnippet - The y-flip snippet. Only used for WebGL. - * @return {string} The generated code snippet. - */ - generateSnippet(builder: NodeBuilder, textureProperty: string, uvSnippet: string, levelSnippet: string | null, biasSnippet: string | null, depthSnippet: string | null, compareSnippet: string | null, gradSnippet: Array | null, gatherSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; - /** - * Generates the code snippet of the texture node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} output - The current output. - * @return {string} The generated code snippet. - */ - generate(builder: NodeBuilder, output: string): string; - /** - * Sets the sampler value. - * - * @param {boolean} value - The sampler value to set. - * @return {TextureNode} A reference to this texture node. - */ - setSampler(value: boolean): TextureNode; - /** - * Returns the sampler value. - * - * @return {boolean} The sampler value. - */ - getSampler(): boolean; - /** - * Samples the texture with the given uv node. - * - * @param {Node} uvNode - The uv node. - * @return {TextureNode} A texture node representing the texture sample. - */ - sample(uvNode: Node): TextureNode; - /** - * TSL function for creating a texture node that fetches/loads texels without interpolation. - * - * @param {Node} uvNode - The uv node. - * @returns {TextureNode} A texture node representing the texture load. - */ - load(uvNode: Node): TextureNode; - /** - * Samples a blurred version of the texture by defining an internal bias. - * - * @param {Node} amountNode - How blurred the texture should be. - * @return {TextureNode} A texture node representing the texture sample. - */ - blur(amountNode: Node): TextureNode; - /** - * Samples a specific mip of the texture. - * - * @param {Node} levelNode - The mip level to sample. - * @return {TextureNode} A texture node representing the texture sample. - */ - level(levelNode: Node): TextureNode; - /** - * Returns the texture size of the requested level. - * - * @param {Node} levelNode - The level to compute the size for. - * @return {TextureSizeNode} The texture size. - */ - size(levelNode: Node): TextureSizeNode; - /** - * Samples the texture with the given bias. - * - * @param {Node} biasNode - The bias node. - * @return {TextureNode} A texture node representing the texture sample. - */ - bias(biasNode: Node): TextureNode; - /** - * Returns the base texture of this node. - * @return {TextureNode} The base texture node. - */ - getBase(): TextureNode; - /** - * Samples the texture by executing a compare operation. - * - * @param {Node} compareNode - The node that defines the compare value. - * @return {TextureNode} A texture node representing the texture sample. - */ - compare(compareNode: Node): TextureNode; - /** - * Samples the texture using an explicit gradient. - * - * @param {Node} gradNodeX - The gradX node. - * @param {Node} gradNodeY - The gradY node. - * @return {TextureNode} A texture node representing the texture sample. - */ - grad(gradNodeX: Node, gradNodeY: Node): TextureNode; - /** - * Gathers four texels from the texture. - * - * @param {Node} gatherNode - The index of the channel to read. This must be in range [0, 3] and a compile-time constant. - * @return {TextureNode} A texture node representing the texture sample. - */ - gather(gatherNode?: Node): TextureNode; - /** - * Returns `true` if the texture is sampled with a depth comparison, - * meaning the node must be bound with a comparison sampler. - * - * @return {boolean} Whether comparison sampling is used or not. - */ - isSampleCompare(): boolean; - /** - * Samples the texture by defining a depth node. - * - * @param {Node} depthNode - The depth node. - * @return {TextureNode} A texture node representing the texture sample. - */ - depth(depthNode: Node): TextureNode; - /** - * Samples the texture by defining an offset node. - * - * @param {Node} offsetNode - The offset node. - * @return {TextureNode} A texture node representing the texture sample. - */ - offset(offsetNode: Node): TextureNode; - /** - * The update is used to implement the update of the uv transformation matrix. - */ - update(): void; - /** - * Clones the texture node. - * - * @return {TextureNode} The cloned texture node. - */ - clone(): TextureNode; -} -import { Texture } from '../../textures/Texture.js'; -import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts deleted file mode 100644 index e8ddf1c81..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/TextureSizeNode.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export default TextureSizeNode; -/** - * TSL function for creating a texture size node. - * - * @tsl - * @function - * @param {TextureNode} textureNode - A texture node which size should be retrieved. - * @param {?Node} [levelNode=null] - A level node which defines the requested mip. - * @returns {TextureSizeNode} - */ -export const textureSize: any; -/** - * A node that represents the dimensions of a texture. The texture size is - * retrieved in the shader via built-in shader functions like `textureDimensions()` - * or `textureSize()`. - * - * @augments Node - */ -declare class TextureSizeNode extends Node { - /** - * Constructs a new texture size node. - * - * @param {TextureNode} textureNode - A texture node which size should be retrieved. - * @param {?Node} [levelNode=null] - A level node which defines the requested mip. - */ - constructor(textureNode: TextureNode, levelNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTextureSizeNode: boolean; - /** - * A texture node which size should be retrieved. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * A level node which defines the requested mip. - * - * @type {Node} - * @default null - */ - levelNode: Node; - generate(builder: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts deleted file mode 100644 index 959b2be65..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/UV.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function uv(index?: number): AttributeNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts deleted file mode 100644 index ade6a8e94..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/UniformArrayNode.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -export default UniformArrayNode; -export function uniformArray(values: Array, nodeType?: string | null): UniformArrayNode; -/** - * Similar to {@link BufferNode} this module represents array-like data as - * uniform buffers. Unlike {@link BufferNode}, it can handle more common - * data types in the array (e.g `three.js` primitives) and automatically - * manage buffer padding. It should be the first choice when working with - * uniforms buffers. - * ```js - * const tintColors = uniformArray( [ - * new Color( 1, 0, 0 ), - * new Color( 0, 1, 0 ), - * new Color( 0, 0, 1 ) - * ], 'color' ); - * - * const redColor = tintColors.element( 0 ); - * - * @augments BufferNode - */ -declare class UniformArrayNode extends BufferNode { - /** - * Constructs a new uniform array node. - * - * @param {Array} value - Array holding the buffer data. - * @param {?string} [elementType=null] - The data type of a buffer element. - */ - constructor(value: Array, elementType?: string | null); - /** - * Array holding the buffer data. Unlike {@link BufferNode}, the array can - * hold number primitives as well as three.js objects like vectors, matrices - * or colors. - * - * @type {Array} - */ - array: Array; - /** - * The data type of an array element. - * - * @type {string} - */ - elementType: string; - /** - * The padded type. Uniform buffers must conform to a certain buffer layout - * so a separate type is computed to ensure correct buffer size. - * - * @type {string} - */ - paddedType: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayBufferNode: boolean; - /** - * This method is overwritten since the node type is inferred from the - * {@link UniformArrayNode#paddedType}. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(): string; - /** - * The data type of the array elements. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The element type. - */ - getElementType(): string; - /** - * Returns the padded type based on the element type. - * - * @return {string} The padded type. - */ - getPaddedType(): string; - update(): void; - /** - * Composes a user-defined update with the buffer transfer. - * - * @param {Function} callback - The update function. - * @param {string} updateType - The update type. - * @return {UniformArrayNode} A reference to this node. - */ - onUpdate(callback: Function, updateType: string): UniformArrayNode; - /** - * The method makes sure to correctly transfer the data from the (complex) objects - * in the array to the internal, correctly padded value buffer. - */ - updateBuffer(): void; - /** - * Implement the value buffer creation based on the array data. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {null} - */ - setup(builder: NodeBuilder): null; - /** - * Overwrites the default `element()` method to provide element access - * based on {@link UniformArrayNode}. - * - * @param {IndexNode} indexNode - The index node. - * @return {UniformArrayElementNode} - */ - element(indexNode: IndexNode): UniformArrayElementNode; -} -import BufferNode from './BufferNode.js'; -/** - * Represents the element access on uniform array nodes. - * - * @augments ArrayElementNode - */ -declare class UniformArrayElementNode extends ArrayElementNode { - /** - * Constructs a new buffer node. - * - * @param {UniformArrayNode} uniformArrayNode - The uniform array node to access. - * @param {IndexNode} indexNode - The index data that define the position of the accessed element in the array. - */ - constructor(uniformArrayNode: UniformArrayNode, indexNode: IndexNode); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayBufferElementNode: boolean; - generate(builder: any): any; -} -import ArrayElementNode from '../utils/ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts deleted file mode 100644 index e526f57c7..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/UserDataNode.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default UserDataNode; -export function userData(name: string, inputType: string, userData: Object | null): UserDataNode; -/** - * A special type of reference node that allows to link values in - * `userData` fields to node objects. - * ```js - * sprite.userData.rotation = 1; // stores individual rotation per sprite - * - * const material = new THREE.SpriteNodeMaterial(); - * material.rotationNode = userData( 'rotation', 'float' ); - * ``` - * Since `UserDataNode` is extended from {@link ReferenceNode}, the node value - * will automatically be updated when the `rotation` user data field changes. - * - * @augments ReferenceNode - */ -declare class UserDataNode extends ReferenceNode { - /** - * Constructs a new user data node. - * - * @param {string} property - The property name that should be referenced by the node. - * @param {string} inputType - The node data type of the reference. - * @param {?Object} [userData=null] - A reference to the `userData` object. If not provided, the `userData` property of the 3D object that uses the node material is evaluated. - */ - constructor(property: string, inputType: string, userData?: Object | null); - /** - * A reference to the `userData` object. If not provided, the `userData` - * property of the 3D object that uses the node material is evaluated. - * - * @type {?Object} - * @default null - */ - userData: Object | null; -} -import ReferenceNode from './ReferenceNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts deleted file mode 100644 index 476ee206d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/VelocityNode.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -export default VelocityNode; -/** - * TSL object that represents the velocity of a render pass. - * - * @tsl - * @type {VelocityNode} - */ -export const velocity: VelocityNode; -/** - * A node for representing motion or velocity vectors. Foundation - * for advanced post processing effects like motion blur or TRAA. - * - * The node keeps track of the model, view and projection matrices - * of the previous frame and uses them to compute offsets in NDC space. - * These offsets represent the final velocity. - * - * @augments TempNode - */ -declare class VelocityNode extends TempNode { - /** - * Constructs a new vertex color node. - */ - constructor(); - /** - * The current projection matrix. - * - * @type {?Matrix4} - * @default null - */ - projectionMatrix: Matrix4 | null; - /** - * Uniform node representing the previous model matrix in world space. - * - * @type {UniformNode} - * @default null - */ - previousModelWorldMatrix: UniformNode; - /** - * Uniform node representing the previous projection matrix. - * - * @type {UniformNode} - * @default null - */ - previousProjectionMatrix: UniformNode; - /** - * Uniform node representing the previous view matrix. - * - * @type {UniformNode} - * @default null - */ - previousCameraViewMatrix: UniformNode; - /** - * Sets the given projection matrix. - * - * @param {Matrix4} projectionMatrix - The projection matrix to set. - */ - setProjectionMatrix(projectionMatrix: Matrix4): void; - /** - * Updates velocity specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update({ frameId, camera, object }: NodeFrame): void; - /** - * Overwritten to updated velocity specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateAfter({ object }: NodeFrame): void; - /** - * Implements the velocity computation based on the previous and current vertex data. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Node} The motion vector. - */ - setup(): Node; -} -import TempNode from '../core/TempNode.js'; -import { Matrix4 } from '../../math/Matrix4.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts deleted file mode 100644 index c55c763bd..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/accessors/VertexColorNode.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default VertexColorNode; -export function vertexColor(index?: number): VertexColorNode; -/** - * An attribute node for representing vertex colors. - * - * @augments AttributeNode - */ -declare class VertexColorNode extends AttributeNode { - /** - * Constructs a new vertex color node. - * - * @param {number} index - The attribute index. - */ - constructor(index: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVertexColorNode: boolean; - /** - * The attribute index to enable more than one sets of vertex colors. - * - * @type {number} - * @default 0 - */ - index: number; -} -import AttributeNode from '../core/AttributeNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts deleted file mode 100644 index 13ca56a3d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/code/CodeNode.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -export default CodeNode; -/** - * TSL function for creating a code node. - * - * @tsl - * @function - * @param {string} [code] - The native code. - * @param {?Array} [includes=[]] - An array of includes. - * @param {?('js'|'wgsl'|'glsl')} [language=''] - The used language. - * @returns {CodeNode} - */ -export const code: any; -export function js(src: string, includes: Array): CodeNode; -export function wgsl(src: string, includes: Array): CodeNode; -export function glsl(src: string, includes: Array): CodeNode; -/** - * This class represents native code sections. It is the base - * class for modules like {@link FunctionNode} which allows to implement - * functions with native shader languages. - * - * @augments Node - */ -declare class CodeNode extends Node { - /** - * Constructs a new code node. - * - * @param {string} [code=''] - The native code. - * @param {Array} [includes=[]] - An array of includes. - * @param {('js'|'wgsl'|'glsl')} [language=''] - The used language. - */ - constructor(code?: string, includes?: Array, language?: ("js" | "wgsl" | "glsl")); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCodeNode: boolean; - /** - * The native code. - * - * @type {string} - * @default '' - */ - code: string; - /** - * An array of includes - * - * @type {Array} - * @default [] - */ - includes: Array; - /** - * The used language. - * - * @type {('js'|'wgsl'|'glsl')} - * @default '' - */ - language: ("js" | "wgsl" | "glsl"); - /** - * Sets the includes of this code node. - * - * @param {Array} includes - The includes to set. - * @return {CodeNode} A reference to this node. - */ - setIncludes(includes: Array): CodeNode; - /** - * Returns the includes of this code node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Array} The includes. - */ - getIncludes(): Array; - generate(builder: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts deleted file mode 100644 index 47f1180ff..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/code/ExpressionNode.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default ExpressionNode; -/** - * TSL function for creating an expression node. - * - * @tsl - * @function - * @param {string} [snippet] - The native code snippet. - * @param {?string} [nodeType='void'] - The node type. - * @returns {ExpressionNode} - */ -export const expression: any; -/** - * This class can be used to implement basic expressions in shader code. - * Basic examples for that are `return`, `continue` or `discard` statements. - * - * @augments Node - */ -declare class ExpressionNode extends Node { - /** - * Constructs a new expression node. - * - * @param {string} [snippet=''] - The native code snippet. - * @param {string} [nodeType='void'] - The node type. - */ - constructor(snippet?: string, nodeType?: string); - /** - * The native code snippet. - * - * @type {string} - * @default '' - */ - snippet: string; - generate(builder: any, output: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts deleted file mode 100644 index 38783b5a5..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/code/FunctionCallNode.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -export default FunctionCallNode; -export function call(func: any, ...params: any[]): FunctionCallNode; -/** - * This module represents the call of a {@link FunctionNode}. Developers are usually not confronted - * with this module since they use the predefined TSL syntax `wgslFn` and `glslFn` which encapsulate - * this logic. - * - * @augments TempNode - */ -declare class FunctionCallNode extends TempNode { - /** - * Constructs a new function call node. - * - * @param {?FunctionNode} functionNode - The function node. - * @param {Object} [parameters={}] - The parameters for the function call. - */ - constructor(functionNode?: FunctionNode | null, parameters?: { - [x: string]: Node; - }); - /** - * The function node. - * - * @type {?FunctionNode} - * @default null - */ - functionNode: FunctionNode | null; - /** - * The parameters of the function call. - * - * @type {Object} - * @default {} - */ - parameters: { - [x: string]: Node; - }; - /** - * Sets the parameters of the function call node. - * - * @param {Object} parameters - The parameters to set. - * @return {FunctionCallNode} A reference to this node. - */ - setParameters(parameters: { - [x: string]: Node; - }): FunctionCallNode; - /** - * Returns the parameters of the function call node. - * - * @return {Object} The parameters of this node. - */ - getParameters(): { - [x: string]: Node; - }; - /** - * Returns the type of this function call node. - * - * @param {NodeBuilder} builder - The current node builder. - * @returns {string} The type of this node. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the function node of this function call node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} [name] - The name of the member. - * @returns {string} The type of the member. - */ - getMemberType(builder: NodeBuilder, name?: string): string; - generate(builder: any): string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts deleted file mode 100644 index d17722e1f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/code/FunctionNode.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -export default FunctionNode; -export function glslFn(code: any, includes: any): any; -export function wgslFn(code: any, includes: any): any; -/** - * This class represents a native shader function. It can be used to implement - * certain aspects of a node material with native shader code. There are two predefined - * TSL functions for easier usage. - * - * - `wgslFn`: Creates a WGSL function node. - * - `glslFn`: Creates a GLSL function node. - * - * A basic example with one include looks like so: - * - * ```js - * const desaturateWGSLFn = wgslFn( ` - * fn desaturate( color:vec3 ) -> vec3 { - * let lum = vec3( 0.299, 0.587, 0.114 ); - * return vec3( dot( lum, color ) ); - * }` - *); - * const someWGSLFn = wgslFn( ` - * fn someFn( color:vec3 ) -> vec3 { - * return desaturate( color ); - * } - * `, [ desaturateWGSLFn ] ); - * material.colorNode = someWGSLFn( { color: texture( map ) } ); - *``` - * @augments CodeNode - */ -declare class FunctionNode extends CodeNode { - /** - * Constructs a new function node. - * - * @param {string} [code=''] - The native code. - * @param {Array} [includes=[]] - An array of includes. - * @param {('js'|'wgsl'|'glsl')} [language=''] - The used language. - */ - constructor(code?: string, includes?: Array, language?: ("js" | "wgsl" | "glsl")); - /** - * Returns the type of this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the type of a member of this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member. - * @return {string} The type of the member. - */ - getMemberType(builder: NodeBuilder, name: string): string; - /** - * Returns the inputs of this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Array} The inputs. - */ - getInputs(builder: NodeBuilder): Array; - /** - * Returns the node function for this function node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {NodeFunction} The node function. - */ - getNodeFunction(builder: NodeBuilder): NodeFunction; - generate(builder: any, output: any): any; -} -import CodeNode from './CodeNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts deleted file mode 100644 index 41339a0bd..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/ArrayNode.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -export default ArrayNode; -export function array(...params: any[]): ArrayNode; -/** - * ArrayNode represents a collection of nodes, typically created using the {@link array} function. - * ```js - * const colors = array( [ - * vec3( 1, 0, 0 ), - * vec3( 0, 1, 0 ), - * vec3( 0, 0, 1 ) - * ] ); - * - * const redColor = tintColors.element( 0 ); - * ``` - * - * @augments TempNode - */ -declare class ArrayNode extends TempNode { - /** - * Constructs a new array node. - * - * @param {?string} nodeType - The data type of the elements. - * @param {number} count - Size of the array. - * @param {?Array} [values=null] - Array default values. - */ - constructor(nodeType: string | null, count: number, values?: Array | null); - /** - * Array size. - * - * @type {number} - */ - count: number; - /** - * Array default values. - * - * @type {?Array} - */ - values: Array | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayNode: boolean; - /** - * Returns the number of elements in the node array. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {number} The number of elements in the node array. - */ - getArrayCount(): number; - /** - * Returns the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The type of the node. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the type of a member variable. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member variable. - * @return {string} The type of the member variable. - */ - getMemberType(builder: NodeBuilder, name: string): string; - /** - * This method builds the output node and returns the resulting array as a shader string. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated shader string. - */ - generate(builder: NodeBuilder): string; -} -import TempNode from './TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts deleted file mode 100644 index 3f1ab4808..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/AssignNode.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -export default AssignNode; -/** - * TSL function for creating an assign node. - * - * @tsl - * @function - * @param {Node} targetNode - The target node. - * @param {Node} sourceNode - The source type. - * @returns {AssignNode} - */ -export const assign: any; -/** - * These node represents an assign operation. Meaning a node is assigned - * to another node. - * - * @augments TempNode - */ -declare class AssignNode extends TempNode { - /** - * Constructs a new assign node. - * - * @param {Node} targetNode - The target node. - * @param {Node} sourceNode - The source type. - */ - constructor(targetNode: Node, sourceNode: Node); - /** - * The target node. - * - * @type {Node} - */ - targetNode: Node; - /** - * The source node. - * - * @type {Node} - */ - sourceNode: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAssignNode: boolean; - /** - * Whether this node is used more than once in context of other nodes. This method - * is overwritten since it always returns `false` (assigns are unique). - * - * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. Always `false`. - */ - hasDependencies(): boolean; - generateNodeType(builder: any, output: any): any; - /** - * Whether a split is required when assigning source to target. This can happen when the component length of - * target and source data type does not match. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether a split is required when assigning source to target. - */ - needsSplitAssign(builder: NodeBuilder): boolean; - setup(builder: any): void; - generate(builder: any, output: any): any; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts deleted file mode 100644 index 0f8b0bf15..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/AttributeNode.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default AttributeNode; -export function attribute(name: string, nodeType?: string | null): AttributeNode; -/** - * Base class for representing shader attributes as nodes. - * - * @augments Node - */ -declare class AttributeNode extends Node { - /** - * Constructs a new attribute node. - * - * @param {string} attributeName - The name of the attribute. - * @param {?string} nodeType - The node type. - */ - constructor(attributeName: string, nodeType?: string | null); - _attributeName: string; - getHash(builder: any): string; - generateNodeType(builder: any): string | null; - /** - * Sets the attribute name to the given value. The method can be - * overwritten in derived classes if the final name must be computed - * analytically. - * - * @param {string} attributeName - The name of the attribute. - * @return {AttributeNode} A reference to this node. - */ - setAttributeName(attributeName: string): AttributeNode; - /** - * Returns the attribute name of this node. The method can be - * overwritten in derived classes if the final name must be computed - * analytically. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The attribute name. - */ - getAttributeName(): string; - generate(builder: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts deleted file mode 100644 index db68f52f5..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/BypassNode.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -export default BypassNode; -/** - * TSL function for creating a bypass node. - * - * @tsl - * @function - * @param {Node} outputNode - The output node. - * @param {Node} callNode - The call node. - * @returns {BypassNode} - */ -export const bypass: any; -/** - * The class generates the code of a given node but returns another node in the output. - * This can be used to call a method or node that does not return a value, i.e. - * type `void` on an input where returning a value is required. Example: - * - * ```js - * material.colorNode = myColor.bypass( runVoidFn() ) - *``` - * - * @augments Node - */ -declare class BypassNode extends Node { - /** - * Constructs a new bypass node. - * - * @param {Node} outputNode - The output node. - * @param {Node} callNode - The call node. - */ - constructor(outputNode: Node, callNode: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBypassNode: boolean; - /** - * The output node. - * - * @type {Node} - */ - outputNode: Node; - /** - * The call node. - * - * @type {Node} - */ - callNode: Node; - generateNodeType(builder: any): string; - generate(builder: any): string | Node | null; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts deleted file mode 100644 index f26ae9eb3..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/ConstNode.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default ConstNode; -/** - * Class for representing a constant value in the shader. - * - * @augments InputNode - */ -declare class ConstNode extends InputNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isConstNode: boolean; - /** - * Generates the shader string of the value with the current node builder. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The generated value as a shader string. - */ - generateConst(builder: NodeBuilder): string; - generate(builder: any, output: any): any; -} -import InputNode from './InputNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts deleted file mode 100644 index 08ff51454..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/ContextNode.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -/** - * TSL function for defining a built-in shadow context for a given node. - * - * @tsl - * @function - * @param {ShadowNode} shadowNode - The shadow node representing the light's shadow. - * @param {Light} light - The light associated with the shadow. - * @param {Node} [node=null] - The node whose context should be modified. - * @returns {ContextNode} - */ -export function builtinShadowContext(shadowNode: ShadowNode, light: Light, node?: Node): ContextNode; -/** - * TSL function for defining a built-in ambient occlusion context for a given node. - * - * @tsl - * @function - * @param {Node} aoNode - The ambient occlusion value node to apply. - * @param {Node} [node=null] - The node whose context should be modified. - * @returns {ContextNode} - */ -export function builtinAOContext(aoNode: Node, node?: Node): ContextNode; -/** - * TSL function for defining a label context value for a given node. - * - * @tsl - * @function - * @deprecated - * @param {Node} node - The node whose context should be modified. - * @param {string} name - The name/label to set. - * @returns {ContextNode} - */ -export function label(node: Node, name: string): ContextNode; -export default ContextNode; -export function context(nodeOrValue?: Node | Object, value?: Object): ContextNode; -export function uniformFlow(node: Node): ContextNode; -export function setName(node: Node, name: string): ContextNode; -import Node from './Node.js'; -/** - * This node can be used as a context management component for another node. - * {@link NodeBuilder} performs its node building process in a specific context and - * this node allows the modify the context. A typical use case is to overwrite `getUV()` e.g.: - * - * ```js - *node.context( { getUV: () => customCoord } ); - *\// or - *material.contextNode = context( { getUV: () => customCoord } ); - *\// or - *renderer.contextNode = context( { getUV: () => customCoord } ); - *\// or - *scenePass.contextNode = context( { getUV: () => customCoord } ); - *``` - * @augments Node - */ -declare class ContextNode extends Node { - /** - * Constructs a new context node. - * - * @param {Node} node - The node whose context should be modified. - * @param {Object} [value={}] - The modified context data. - */ - constructor(node?: Node, value?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isContextNode: boolean; - /** - * The node whose context should be modified. - * - * @type {Node} - */ - node: Node; - /** - * The modified context data. - * - * @type {Object} - * @default {} - */ - value: Object; - /** - * This method is overwritten to ensure it returns the type of {@link ContextNode#node}. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Gathers the context data from all parent context nodes. - * - * @return {Object} The gathered context data. - */ - getFlowContextData(): Object; - /** - * This method is overwritten to ensure it returns the member type of {@link ContextNode#node}. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The member name. - * @returns {string} The member type. - */ - getMemberType(builder: NodeBuilder, name: string): string; - analyze(builder: any): void; - setup(builder: any): string | Node | null; - generate(builder: any, output: any): string | Node | null; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts deleted file mode 100644 index 6117487c5..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/IndexNode.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -export default IndexNode; -/** - * TSL object that represents the index of a vertex within a mesh. - * - * @tsl - * @type {IndexNode} - */ -export const vertexIndex: IndexNode; -/** - * TSL object that represents the index of either a mesh instance or an invocation of a compute shader. - * - * @tsl - * @type {IndexNode} - */ -export const instanceIndex: IndexNode; -/** - * TSL object that represents the index of the subgroup the current compute invocation belongs to. - * - * @tsl - * @type {IndexNode} - */ -export const subgroupIndex: IndexNode; -/** - * TSL object that represents the index of a compute invocation within the scope of a subgroup. - * - * @tsl - * @type {IndexNode} - */ -export const invocationSubgroupIndex: IndexNode; -/** - * TSL object that represents the index of a compute invocation within the scope of a workgroup load. - * - * @tsl - * @type {IndexNode} - */ -export const invocationLocalIndex: IndexNode; -/** - * TSL object that represents the index of a draw call. - * - * @tsl - * @type {IndexNode} - */ -export const drawIndex: IndexNode; -/** - * This class represents shader indices of different types. The following predefined node - * objects cover frequent use cases: - * - * - `vertexIndex`: The index of a vertex within a mesh. - * - `instanceIndex`: The index of either a mesh instance or an invocation of a compute shader. - * - `drawIndex`: The index of a draw call. - * - `invocationLocalIndex`: The index of a compute invocation within the scope of a workgroup load. - * - `invocationSubgroupIndex`: The index of a compute invocation within the scope of a subgroup. - * - `subgroupIndex`: The index of a compute invocation's subgroup within its workgroup. - * - * @augments Node - */ -declare class IndexNode extends Node { - /** - * Constructs a new index node. - * - * @param {('vertex'|'instance'|'subgroup'|'invocationLocal'|'invocationGlobal'|'invocationSubgroup'|'draw')} scope - The scope of the index node. - */ - constructor(scope: ("vertex" | "instance" | "subgroup" | "invocationLocal" | "invocationGlobal" | "invocationSubgroup" | "draw")); - /** - * The scope of the index node. - * - * @type {string} - */ - scope: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isIndexNode: boolean; - generate(builder: any): any; -} -declare namespace IndexNode { - let VERTEX: string; - let INSTANCE: string; - let SUBGROUP: string; - let INVOCATION_LOCAL: string; - let INVOCATION_SUBGROUP: string; - let DRAW: string; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts deleted file mode 100644 index fc285a964..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/InputNode.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -export default InputNode; -/** - * Base class for representing data input nodes. - * - * @augments Node - */ -declare class InputNode extends Node { - /** - * Constructs a new input node. - * - * @param {any} value - The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). - * @param {?string} nodeType - The node type. If no explicit type is defined, the node tries to derive the type from its value. - */ - constructor(value: any, nodeType?: string | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInputNode: boolean; - /** - * The value of this node. This can be any JS primitive, functions, array buffers or even three.js objects (vector, matrices, colors). - * - * @type {any} - */ - value: any; - /** - * The precision of the value in the shader. - * - * @type {?('low'|'medium'|'high')} - * @default null - */ - precision: ("low" | "medium" | "high") | null; - generateNodeType(): string | null; - /** - * Returns the input type of the node which is by default the node type. Derived modules - * might overwrite this method and use a fixed type or compute one analytically. - * - * A typical example for different input and node types are textures. The input type of a - * normal RGBA texture is `texture` whereas its node type is `vec4`. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(builder: NodeBuilder): string; - /** - * Sets the precision to the given value. The method can be - * overwritten in derived classes if the final precision must be computed - * analytically. - * - * @param {('low'|'medium'|'high')} precision - The precision of the input value in the shader. - * @return {InputNode} A reference to this node. - */ - setPrecision(precision: ("low" | "medium" | "high")): InputNode; - serialize(data: any): void; - deserialize(data: any): void; - generate(): void; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts deleted file mode 100644 index 4671327d0..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/InspectorNode.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Creates an inspector node to wrap around a given node for inspection purposes. - * - * @tsl - * @param {Node} node - The node to inspect. - * @param {string} [name=''] - Optional name for the inspector node. - * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. - * @returns {Node} The inspector node. - */ -export function inspect(node: Node, name?: string, callback?: Function | null): Node; -export default InspectorNode; -import Node from './Node.js'; -/** - * InspectorNode is a wrapper node that allows inspection of node values during rendering. - * It can be used to debug or analyze node outputs in the rendering pipeline. - * - * @augments Node - */ -declare class InspectorNode extends Node { - /** - * Creates an InspectorNode. - * - * @param {Node} node - The node to inspect. - * @param {string} [name=''] - Optional name for the inspector node. - * @param {Function|null} [callback=null] - Optional callback to modify the node during setup. - */ - constructor(node: Node, name?: string, callback?: Function | null); - node: Node; - callback: Function | null; - isInspectorNode: boolean; - /** - * Returns the name of the inspector node. - * - * @returns {string} - */ - getName(): string; - /** - * Updates the inspector node, allowing inspection of the wrapped node. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - /** - * Returns the type of the wrapped node. - * - * @param {NodeBuilder} builder - The node builder. - * @returns {string} - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Sets up the inspector node. - * - * @param {NodeBuilder} builder - The node builder. - * @returns {Node} The setup node. - */ - setup(builder: NodeBuilder): Node; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts deleted file mode 100644 index 23e65acba..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/IsolateNode.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * TSL function for creating a cache node. - * - * @tsl - * @function - * @deprecated - * @param {Node} node - The node that should be cached. - * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. - * @returns {IsolateNode} - */ -export function cache(node: Node, parent?: boolean): IsolateNode; -export default IsolateNode; -export function isolate(node: Node): IsolateNode; -import Node from './Node.js'; -/** - * This node can be used as a cache management component for another node. - * Caching is in general used by default in {@link NodeBuilder} but this node - * allows the usage of a shared parent cache during the build process. - * - * @augments Node - */ -declare class IsolateNode extends Node { - /** - * Constructs a new cache node. - * - * @param {Node} node - The node that should be cached. - * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. - */ - constructor(node: Node, parent?: boolean); - /** - * The node that should be cached. - * - * @type {Node} - */ - node: Node; - /** - * Whether this node refers to a shared parent cache or not. - * - * @type {boolean} - * @default true - */ - parent: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isIsolateNode: boolean; - generateNodeType(builder: any): string; - build(builder: any, ...params: any[]): string | Node | null; - setParent(parent: any): this; - getParent(): boolean; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts deleted file mode 100644 index e281d8a3c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/LightingModel.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -export default LightingModel; -/** - * Abstract class for implementing lighting models. The module defines - * multiple methods that concrete lighting models can implement. These - * methods are executed at different points during the light evaluation - * process. - */ -declare class LightingModel { - /** - * This method is intended for setting up lighting model and context data - * which are later used in the evaluation process. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - start(builder: NodeBuilder): void; - /** - * This method is intended for executing final tasks like final updates - * to the outgoing light. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - finish(): void; - /** - * This method is intended for implementing the direct light term and - * executed during the build process of directional, point and spot light nodes. - * - * @abstract - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct(): void; - /** - * This method is intended for implementing the direct light term for - * rect area light nodes. - * - * @abstract - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - directRectArea(): void; - /** - * This method is intended for implementing the indirect light term. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - indirect(): void; - /** - * This method is intended for implementing the ambient occlusion term. - * Unlike other methods, this method must be called manually by the lighting - * model in its indirect term. - * - * @abstract - * @param {NodeBuilder} builder - The current node builder. - */ - ambientOcclusion(): void; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts deleted file mode 100644 index 3ad6b3c3e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/MRTNode.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Returns the MRT texture index for the given name. - * - * @param {Array} textures - The textures of a MRT-configured render target. - * @param {string} name - The name of the MRT texture which index is requested. - * @return {number} The texture index. - */ -export function getTextureIndex(textures: Array, name: string): number; -export default MRTNode; -/** - * TSL function for creating a MRT node. - * - * @tsl - * @function - * @param {Object} outputNodes - The MRT outputs. - * @returns {MRTNode} - */ -export const mrt: any; -/** - * This node can be used setup a MRT context for rendering. A typical MRT setup for - * post-processing is shown below: - * ```js - * const mrtNode = mrt( { - * output: output, - * normal: normalView - * } ) ; - * ``` - * The MRT output is defined as a dictionary. - * - * @augments OutputStructNode - */ -declare class MRTNode extends OutputStructNode { - /** - * Constructs a new output struct node. - * - * @param {Object} outputNodes - The MRT outputs. - */ - constructor(outputNodes: { - [x: string]: Node; - }); - /** - * A dictionary representing the MRT outputs. The key - * is the name of the output, the value the node which produces - * the output result. - * - * @type {Object} - */ - outputNodes: { - [x: string]: Node; - }; - /** - * A dictionary storing the blend modes for each output. - * - * @type {Object} - */ - blendModes: { - [x: string]: BlendMode; - }; - /** - * A dictionary storing the clear colors for each output. - * - * @type {Object} - */ - clearColors: { - [x: string]: Color4; - }; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMRTNode: boolean; - /** - * Sets the blend mode for the given output name. - * - * @param {string} name - The name of the output. - * @param {BlendMode} blend - The blending mode. - * @return {MRTNode} The current MRT node. - */ - setBlendMode(name: string, blend: BlendMode): MRTNode; - /** - * Returns the blend mode for the given output name. - * - * @param {string} name - The name of the output. - * @return {BlendMode} The blend mode. - */ - getBlendMode(name: string): BlendMode; - /** - * Sets the clear color for the given output name. - * - * @param {string} name - The name of the output. - * @param {number|string|Color} color - The clear color. - * @param {number} [alpha=1] - The clear alpha. - * @return {MRTNode} The current MRT node. - */ - setClearColor(name: string, color: number | string | Color, alpha?: number): MRTNode; - /** - * Returns the clear color for the given output name. - * - * @param {string} name - The name of the output. - * @return {?Color4} The clear color. Returns `null` if no clear color is defined - * which means the renderer's default clear policy is applied. - */ - getClearColor(name: string): Color4 | null; - /** - * Returns `true` if the MRT node has an output with the given name. - * - * @param {string} name - The name of the output. - * @return {NodeBuilder} Whether the MRT node has an output for the given name or not. - */ - has(name: string): NodeBuilder; - /** - * Returns the output node for the given name. - * - * @param {string} name - The name of the output. - * @return {Node} The output node. - */ - get(name: string): Node; - /** - * Merges the outputs of the given MRT node with the outputs of this node. - * - * @param {MRTNode} mrtNode - The MRT to merge. - * @return {MRTNode} A new MRT node with merged outputs.. - */ - merge(mrtNode: MRTNode): MRTNode; - setup(builder: any): import("./Node.js").default | null; -} -import OutputStructNode from './OutputStructNode.js'; -import BlendMode from '../../renderers/common/BlendMode.js'; -import Color4 from '../../renderers/common/Color4.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts deleted file mode 100644 index ffffd5676..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/Node.d.ts +++ /dev/null @@ -1,438 +0,0 @@ -export default Node; -/** - * Base class for all nodes. - * - * @augments EventDispatcher - */ -declare class Node extends EventDispatcher { - static get type(): string; - /** - * Constructs a new node. - * - * @param {?string} nodeType - The node type. - */ - constructor(nodeType?: string | null); - /** - * The node type. This represents the result type of the node (e.g. `float` or `vec3`). - * - * @type {?string} - * @default null - */ - nodeType: string | null; - /** - * The update type of the node's {@link Node#update} method. Possible values are listed in {@link NodeUpdateType}. - * - * @type {string} - * @default 'none' - */ - updateType: string; - /** - * The update type of the node's {@link Node#updateBefore} method. Possible values are listed in {@link NodeUpdateType}. - * - * @type {string} - * @default 'none' - */ - updateBeforeType: string; - /** - * The update type of the node's {@link Node#updateAfter} method. Possible values are listed in {@link NodeUpdateType}. - * - * @type {string} - * @default 'none' - */ - updateAfterType: string; - /** - * The version of the node. The version automatically is increased when {@link Node#needsUpdate} is set to `true`. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly version: number; - /** - * The name of the node. - * - * @type {string} - * @default '' - */ - name: string; - /** - * Whether this node is global or not. This property is relevant for the internal - * node caching system. All nodes which should be declared just once should - * set this flag to `true` (a typical example is {@link AttributeNode}). - * - * @type {boolean} - * @default false - */ - global: boolean; - /** - * Create a list of parents for this node during the build process. - * - * @type {boolean} - * @default false - */ - parents: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNode: boolean; - _beforeNodes: any; - /** - * The cache key of this node. - * - * @private - * @type {?number} - * @default null - */ - private _cacheKey; - /** - * The UUID of the node. - * - * @type {string} - * @default null - * @private - */ - private _uuid; - /** - * The cache key's version. - * - * @private - * @type {number} - * @default 0 - */ - private _cacheKeyVersion; - /** - * The unique ID of the node. - * - * @type {number} - * @readonly - */ - readonly id: number; - /** - * The stack trace of the node for debugging purposes. - * - * @type {?string} - * @default null - */ - stackTrace: string | null; - /** - * Set this property to `true` when the node should be regenerated. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * The UUID of the node. - * - * @type {string} - * @readonly - */ - readonly get uuid(): string; - /** - * The type of the class. The value is usually the constructor name. - * - * @type {string} - * @readonly - */ - readonly get type(): string; - /** - * Convenient method for defining {@link Node#update}. - * - * @param {Function} callback - The update method. - * @param {string} updateType - The update type. - * @return {Node} A reference to this node. - */ - onUpdate(callback: Function, updateType: string): Node; - /** - * The method can be implemented to update the node's internal state when it is used to render an object. - * The {@link Node#updateType} property defines how often the update is executed. - * - * @abstract - * @param {NodeFrame} frame - A reference to the current node frame. - * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). - */ - update(): boolean | null; - /** - * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but - * this method automatically sets the update type to `FRAME`. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onFrameUpdate(callback: Function): Node; - /** - * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but - * this method automatically sets the update type to `RENDER`. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onRenderUpdate(callback: Function): Node; - /** - * Convenient method for defining {@link Node#update}. Similar to {@link Node#onUpdate}, but - * this method automatically sets the update type to `OBJECT`. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onObjectUpdate(callback: Function): Node; - /** - * Convenient method for defining {@link Node#updateReference}. - * - * @param {Function} callback - The update method. - * @return {Node} A reference to this node. - */ - onReference(callback: Function): Node; - /** - * Nodes might refer to other objects like materials. This method allows to dynamically update the reference - * to such objects based on a given state (e.g. the current node frame or builder). - * - * @param {any} state - This method can be invocated in different contexts so `state` can refer to any object type. - * @return {any} The updated reference. - */ - updateReference(): any; - /** - * By default this method returns the value of the {@link Node#global} flag. This method - * can be overwritten in derived classes if an analytical way is required to determine the - * global cache referring to the current shader-stage. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether this node is global or not. - */ - isGlobal(): boolean; - /** - * Generator function that can be used to iterate over the child nodes. - * - * @generator - * @yields {Node} A child node. - */ - getChildren(): Generator; - /** - * Calling this method dispatches the `dispose` event. This event can be used - * to register event listeners for clean up tasks. - */ - dispose(): void; - /** - * Callback for {@link Node#traverse}. - * - * @callback traverseCallback - * @param {Node} node - The current node. - */ - /** - * Can be used to traverse through the node's hierarchy. - * - * @param {traverseCallback} callback - A callback that is executed per node. - */ - traverse(callback: (node: Node) => any): void; - /** - * Returns the child nodes of this node. - * - * @private - * @param {Set} [ignores=new Set()] - A set of nodes to ignore during the search to avoid circular references. - * @returns {Array} An array of objects describing the child nodes. - */ - private _getChildren; - /** - * Returns the cache key for this node. - * - * @param {boolean} [force=false] - When set to `true`, a recomputation of the cache key is forced. - * @param {Set} [ignores=null] - A set of nodes to ignore during the computation of the cache key. - * @return {number} The cache key of the node. - */ - getCacheKey(force?: boolean, ignores?: Set): number; - /** - * Generate a custom cache key for this node. - * - * @return {number} The cache key of the node. - */ - customCacheKey(): number; - /** - * Returns the references to this node which is by default `this`. - * - * @return {Node} A reference to this node. - */ - getScope(): Node; - /** - * Returns the hash of the node which is used to identify the node. By default it's - * the {@link Node#uuid} however derived node classes might have to overwrite this method - * depending on their implementation. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(): string; - /** - * Returns the update type of {@link Node#update}. - * - * @return {NodeUpdateType} The update type. - */ - getUpdateType(): { - NONE: string; - FRAME: string; - RENDER: string; - OBJECT: string; - }; - /** - * Returns the update type of {@link Node#updateBefore}. - * - * @return {NodeUpdateType} The update type. - */ - getUpdateBeforeType(): { - NONE: string; - FRAME: string; - RENDER: string; - OBJECT: string; - }; - /** - * Returns the update type of {@link Node#updateAfter}. - * - * @return {NodeUpdateType} The update type. - */ - getUpdateAfterType(): { - NONE: string; - FRAME: string; - RENDER: string; - OBJECT: string; - }; - /** - * Certain types are composed of multiple elements. For example a `vec3` - * is composed of three `float` values. This method returns the type of - * these elements. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The type of the node. - */ - getElementType(builder: NodeBuilder): string; - /** - * Returns the node member type for the given name. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The name of the member. - * @return {string} The type of the node. - */ - getMemberType(): string; - /** - * Returns the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} [output=null] - The output of the node. - * @return {string} The type of the node. - */ - getNodeType(builder: NodeBuilder, output?: string): string; - /** - * Returns the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} [output=null] - The output of the node. - * @return {string} The type of the node. - */ - generateNodeType(builder: NodeBuilder, output?: string): string; - /** - * This method is used during the build process of a node and ensures - * equal nodes are not built multiple times but just once. For example if - * `attribute( 'uv' )` is used multiple times by the user, the build - * process makes sure to process just the first node. It also handles - * node overrides if an override context is set. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The shared node if possible. Otherwise `this` is returned. - */ - getShared(builder: NodeBuilder): Node; - /** - * Returns the number of elements in the node array. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?number} The number of elements in the node array. - */ - getArrayCount(): number | null; - /** - * Represents the setup stage which is the first step of the build process, see {@link Node#build} method. - * This method is often overwritten in derived modules to prepare the node which is used as a node's output/result. - * If an output node is prepared, then it must be returned in the `return` statement of the derived module's setup function. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {?Node} The output node. - */ - setup(builder: NodeBuilder): Node | null; - /** - * Represents the analyze stage which is the second step of the build process, see {@link Node#build} method. - * This stage analyzes the node hierarchy and ensures descendent nodes are built. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?Node} output - The target output node. - */ - analyze(builder: NodeBuilder, output?: Node | null): void; - /** - * Represents the generate stage which is the third step of the build process, see {@link Node#build} method. - * This state builds the output node and returns the resulting shader string. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?string} [output] - Can be used to define the output type. - * @return {?string} The generated shader string. - */ - generate(builder: NodeBuilder, output?: string | null): string | null; - /** - * The method can be implemented to update the node's internal state before it is used to render an object. - * The {@link Node#updateBeforeType} property defines how often the update is executed. - * - * @abstract - * @param {NodeFrame} frame - A reference to the current node frame. - * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). - */ - updateBefore(): boolean | null; - /** - * The method can be implemented to update the node's internal state after it was used to render an object. - * The {@link Node#updateAfterType} property defines how often the update is executed. - * - * @abstract - * @param {NodeFrame} frame - A reference to the current node frame. - * @return {?boolean} An optional bool that indicates whether the implementation actually performed an update or not (e.g. due to caching). - */ - updateAfter(): boolean | null; - before(node: any): this; - /** - * This method performs the build of a node. The behavior and return value depend on the current build stage: - * - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant. - * - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`. - * - **generate**: Generates the shader code for the node. Returns the generated shader string. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?(string|Node)} [output=null] - Can be used to define the output type. - * @return {?(Node|string)} The result of the build process, depending on the build stage. - */ - build(builder: NodeBuilder, output?: (string | Node) | null): (Node | string) | null; - /** - * Returns the child nodes as a JSON object. - * - * @return {Generator} An iterable list of serialized child objects as JSON. - */ - getSerializeChildren(): Generator; - /** - * Serializes the node to JSON. - * - * @param {Object} json - The output JSON object. - */ - serialize(json: Object): void; - /** - * Deserializes the node from the given JSON. - * - * @param {Object} json - The JSON object. - */ - deserialize(json: Object): void; - /** - * Serializes the node into the three.js JSON Object/Scene format. - * - * @param {?Object} meta - An optional JSON object that already holds serialized data from other scene objects. - * @return {Object} The serialized node. - */ - toJSON(meta: Object | null): Object; -} -declare namespace Node { - let captureStackTrace: boolean; -} -import { EventDispatcher } from '../../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts deleted file mode 100644 index d6414185f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeAttribute.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export default NodeAttribute; -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader attributes that are going to be generated - * by the builder. Arrays of node attributes is maintained in {@link NodeBuilder#attributes} - * and {@link NodeBuilder#bufferAttributes} for this purpose. - */ -declare class NodeAttribute { - /** - * Constructs a new node attribute. - * - * @param {string} name - The name of the attribute. - * @param {string} type - The type of the attribute. - * @param {?Node} node - An optional reference to the node. - */ - constructor(name: string, type: string, node?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeAttribute: boolean; - /** - * The name of the attribute. - * - * @type {string} - */ - name: string; - /** - * The type of the attribute. - * - * @type {string} - */ - type: string; - /** - * An optional reference to the node. - * - * @type {?Node} - * @default null - */ - node: Node | null; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts deleted file mode 100644 index 150cba495..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeBuilder.d.ts +++ /dev/null @@ -1,1380 +0,0 @@ -export default NodeBuilder; -/** - * Base class for builders which generate a shader program based - * on a 3D object and its node material definition. - */ -declare class NodeBuilder { - /** - * Constructs a new node builder. - * - * @param {Object3D} object - The 3D object. - * @param {Renderer} renderer - The current renderer. - * @param {NodeParser} parser - A reference to a node parser. - */ - constructor(object: Object3D, renderer: Renderer, parser: NodeParser); - /** - * The 3D object. - * - * @type {Object3D} - */ - object: Object3D; - /** - * The material of the 3D object. - * - * @type {?Material} - */ - material: Material | null; - /** - * The geometry of the 3D object. - * - * @type {?BufferGeometry} - */ - geometry: BufferGeometry | null; - /** - * The current renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * A reference to a node parser. - * - * @type {NodeParser} - */ - parser: NodeParser; - /** - * The scene the 3D object belongs to. - * - * @type {?Scene} - * @default null - */ - scene: Scene | null; - /** - * The camera the 3D object is rendered with. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * A list of all nodes the builder is processing - * for this 3D object. - * - * @type {Set} - */ - nodes: Set; - /** - * A list of all nodes the builder is processing in sequential order. - * - * This is used to determine the update order of nodes, which is important for - * {@link NodeUpdateType#UPDATE_BEFORE} and {@link NodeUpdateType#UPDATE_AFTER}. - * - * @type {Set} - */ - sequentialNodes: Set; - /** - * A list of all nodes which {@link Node#update} method should be executed. - * - * @type {Array} - */ - updateNodes: Array; - /** - * A list of all nodes which {@link Node#updateBefore} method should be executed. - * - * @type {Array} - */ - updateBeforeNodes: Array; - /** - * A list of all nodes which {@link Node#updateAfter} method should be executed. - * - * @type {Array} - */ - updateAfterNodes: Array; - /** - * A dictionary that assigns each node to a unique hash. - * - * @type {Object} - */ - hashNodes: { - [x: number]: Node; - }; - /** - * A reference to a node material observer. - * - * @type {?NodeMaterialObserver} - * @default null - */ - observer: NodeMaterialObserver | null; - /** - * A reference to the current lights node. - * - * @type {?LightsNode} - * @default null - */ - lightsNode: LightsNode | null; - /** - * A reference to the current environment node. - * - * @type {?Node} - * @default null - */ - environmentNode: Node | null; - /** - * A reference to the current fog node. - * - * @type {?Node} - * @default null - */ - fogNode: Node | null; - /** - * The current clipping context. - * - * @type {?ClippingContext} - */ - clippingContext: ClippingContext | null; - /** - * Whether the built material uses hardware clipping or not. - * - * @type {boolean} - * @default false - */ - hardwareClipping: boolean; - /** - * The generated vertex shader. - * - * @type {?string} - */ - vertexShader: string | null; - /** - * The generated fragment shader. - * - * @type {?string} - */ - fragmentShader: string | null; - /** - * The generated compute shader. - * - * @type {?string} - */ - computeShader: string | null; - /** - * Nodes used in the primary flow of code generation. - * - * @type {Object>} - */ - flowNodes: { - [x: string]: Node[]; - }; - /** - * Nodes code from `.flowNodes`. - * - * @type {Object} - */ - flowCode: { - [x: string]: string; - }; - /** - * This dictionary holds the node uniforms of the builder. - * The uniforms are maintained in an array for each shader stage. - * - * @type {Object} - */ - uniforms: Object; - /** - * This dictionary holds the output structs of the builder. - * The structs are maintained in an array for each shader stage. - * - * @type {Object} - */ - structs: Object; - /** - * This dictionary holds the types of the builder. - * - * @type {Object} - */ - types: Object; - /** - * This dictionary holds the bindings for each shader stage. - * - * @type {Object} - */ - bindings: Object; - /** - * This dictionary maintains the binding indices per bind group. - * - * @type {Object} - */ - bindingsIndexes: Object; - /** - * Reference to the array of bind groups. - * - * @type {?Array} - */ - bindGroups: Array | null; - /** - * This array holds the node attributes of this builder - * created via {@link AttributeNode}. - * - * @type {Array} - */ - attributes: Array; - /** - * This array holds the node attributes of this builder - * created via {@link BufferAttributeNode}. - * - * @type {Array} - */ - bufferAttributes: Array; - /** - * This array holds the node varyings of this builder. - * - * @type {Array} - */ - varyings: Array; - /** - * This dictionary holds the (native) node codes of this builder. - * The codes are maintained in an array for each shader stage. - * - * @type {Object>} - */ - codes: { - [x: string]: NodeCode[]; - }; - /** - * This dictionary holds the node variables of this builder. - * The variables are maintained in an array for each shader stage. - * This dictionary is also used to count the number of variables - * according to their type (const, vars). - * - * @type {Object|number>} - */ - vars: { - [x: string]: number | NodeVar[]; - }; - /** - * This dictionary holds the declarations for each shader stage. - * - * @type {Object} - */ - declarations: Object; - /** - * Current code flow. - * All code generated in this stack will be stored in `.flow`. - * - * @type {{code: string}} - */ - flow: { - code: string; - }; - /** - * A chain of nodes. - * Used to check recursive calls in node-graph. - * - * @type {Array} - */ - chaining: Array; - /** - * The current stack. - * This reflects the current process in the code block hierarchy, - * it is useful to know if the current process is inside a conditional for example. - * - * @type {StackNode} - */ - stack: StackNode; - /** - * List of stack nodes. - * The current stack hierarchy is stored in an array. - * - * @type {Array} - */ - stacks: Array; - /** - * A tab value. Used for shader string generation. - * - * @type {string} - * @default '\t' - */ - tab: string; - /** - * Reference to the current function node. - * - * @type {?FunctionNode} - * @default null - */ - currentFunctionNode: FunctionNode | null; - /** - * The builder's context. - * - * @type {Object} - */ - context: Object; - /** - * The builder's cache. - * - * @type {NodeCache} - */ - cache: NodeCache; - /** - * Since the {@link NodeBuilder#cache} might be temporarily - * overwritten by other caches, this member retains the reference - * to the builder's own cache. - * - * @type {NodeCache} - * @default this.cache - */ - globalCache: NodeCache; - flowsData: WeakMap; - /** - * The current shader stage. - * - * @type {?('vertex'|'fragment'|'compute'|'any')} - */ - shaderStage: ("vertex" | "fragment" | "compute" | "any") | null; - /** - * The current build stage. - * - * @type {?('setup'|'analyze'|'generate')} - */ - buildStage: ("setup" | "analyze" | "generate") | null; - /** - * The sub-build layers. - * - * @type {Array} - * @default [] - */ - subBuildLayers: Array; - /** - * The active stack nodes. - * - * @type {Array} - */ - activeStacks: Array; - /** - * The current sub-build TSL function(Fn). - * - * @type {?string} - * @default null - */ - subBuildFn: string | null; - /** - * The current TSL function(Fn) call node. - * - * @type {?Node} - * @default null - */ - fnCall: Node | null; - /** - * Whether the material is using flat shading or not. - * - * @returns {boolean} Whether the material is using flat shading or not. - */ - isFlatShading(): boolean; - /** - * Whether the material is opaque or not. - * - * @return {boolean} Whether the material is opaque or not. - */ - isOpaque(): boolean; - /** - * Factory method for creating an instance of {@link RenderTarget} with the given - * dimensions and options. - * - * @param {number} width - The width of the render target. - * @param {number} height - The height of the render target. - * @param {Object} options - The options of the render target. - * @return {RenderTarget} The render target. - */ - createRenderTarget(width: number, height: number, options: Object): RenderTarget; - /** - * Factory method for creating an instance of {@link CubeRenderTarget} with the given - * dimensions and options. - * - * @param {number} size - The size of the cube render target. - * @param {Object} options - The options of the cube render target. - * @return {CubeRenderTarget} The cube render target. - */ - createCubeRenderTarget(size: number, options: Object): CubeRenderTarget; - /** - * Whether the given node is included in the internal array of nodes or not. - * - * @param {Node} node - The node to test. - * @return {boolean} Whether the given node is included in the internal array of nodes or not. - */ - includes(node: Node): boolean; - /** - * Returns the type of the color output based on the renderer's render target. - * - * @param {number} [index=0] - The index of the render target texture. - * @return {string} The type. - */ - getOutputType(index?: number): string; - /** - * Returns the output struct name which is required by - * {@link OutputStructNode}. - * - * @abstract - * @return {string} The name of the output struct. - */ - getOutputStructName(): string; - /** - * Returns a bind group for the given group name and binding. - * - * @private - * @param {string} groupName - The group name. - * @param {Array} bindings - List of bindings. - * @return {BindGroup} The bind group - */ - private _getBindGroup; - /** - * Returns an array of node uniform groups for the given group name and shader stage. - * - * @param {string} groupName - The group name. - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {Array} The array of node uniform groups. - */ - getBindGroupArray(groupName: string, shaderStage: ("vertex" | "fragment" | "compute" | "any")): Array; - /** - * Returns a list bindings of all shader stages separated by groups. - * - * @return {Array} The list of bindings. - */ - getBindings(): Array; - /** - * Sorts the bind groups and updates {@link NodeBuilder#bindingsIndexes}. - */ - sortBindingGroups(): void; - /** - * The builder maintains each node in a hash-based dictionary. - * This method sets the given node (value) with the given hash (key) into this dictionary. - * - * @param {Node} node - The node to add. - * @param {number} hash - The hash of the node. - */ - setHashNode(node: Node, hash: number): void; - /** - * Adds a node to this builder. - * - * @param {Node} node - The node to add. - */ - addNode(node: Node): void; - /** - * It is used to add Nodes that will be used as FRAME and RENDER events, - * and need to follow a certain sequence in the calls to work correctly. - * This function should be called after 'setup()' in the 'build()' process to ensure that the child nodes are processed first. - * - * @param {Node} node - The node to add. - */ - addSequentialNode(node: Node): void; - /** - * Checks the update types of nodes - */ - buildUpdateNodes(): void; - /** - * A reference the current node which is the - * last node in the chain of nodes. - * - * @type {Node} - */ - get currentNode(): Node; - /** - * A reference to the render pipeline. - * - * @type {RenderPipeline} - */ - get renderPipeline(): RenderPipeline; - /** - * Whether the given texture is filtered or not. - * - * @param {Texture} texture - The texture to check. - * @return {boolean} Whether the given texture is filtered or not. - */ - isFilteredTexture(texture: Texture): boolean; - /** - * Returns the maximum number of bytes available for uniform buffers. - * - * @return {number} The maximum number of bytes available for uniform buffers. - */ - getUniformBufferLimit(): number; - /** - * Adds the given node to the internal node chain. - * This is used to check recursive calls in node-graph. - * - * @param {Node} node - The node to add. - */ - addChain(node: Node): void; - /** - * Removes the given node from the internal node chain. - * - * @param {Node} node - The node to remove. - */ - removeChain(node: Node): void; - /** - * Returns the native shader method name for a given generic name. E.g. - * the method name `textureDimensions` matches the WGSL name but must be - * resolved to `textureSize` in GLSL. - * - * @abstract - * @param {string} method - The method name to resolve. - * @return {string} The resolved method name. - */ - getMethod(method: string): string; - /** - * Returns the native snippet for a ternary operation. E.g. GLSL would output - * a ternary op as `cond ? x : y` whereas WGSL would output it as `select(y, x, cond)` - * - * @abstract - * @param {string} condSnippet - The condition determining which expression gets resolved. - * @param {string} ifSnippet - The expression to resolve to if the condition is true. - * @param {string} elseSnippet - The expression to resolve to if the condition is false. - * @return {string} The resolved method name. - */ - getTernary(): string; - /** - * Returns a node for the given hash, see {@link NodeBuilder#setHashNode}. - * - * @param {number} hash - The hash of the node. - * @return {Node} The found node. - */ - getNodeFromHash(hash: number): Node; - /** - * Adds the Node to a target flow so that it can generate code in the 'generate' process. - * - * @param {('vertex'|'fragment'|'compute')} shaderStage - The shader stage. - * @param {Node} node - The node to add. - * @return {Node} The node. - */ - addFlow(shaderStage: ("vertex" | "fragment" | "compute"), node: Node): Node; - /** - * Sets builder's context. - * - * @param {Object} context - The context to set. - */ - setContext(context: Object): void; - /** - * Returns the builder's current context. - * - * @return {Object} The builder's current context. - */ - getContext(): Object; - /** - * Adds context data to the builder's current context. - * - * @param {Object} context - The context to add. - * @return {Object} The previous context. - */ - addContext(context: Object): Object; - /** - * Gets a context used in shader construction that can be shared across different materials. - * This is necessary since the renderer cache can reuse shaders generated in one material and use them in another. - * - * @return {Object} The builder's current context without material. - */ - getSharedContext(): Object; - /** - * Sets builder's cache. - * - * @param {NodeCache} cache - The cache to set. - */ - setCache(cache: NodeCache): void; - /** - * Returns the builder's current cache. - * - * @return {NodeCache} The builder's current cache. - */ - getCache(): NodeCache; - /** - * Returns a cache for the given node. - * - * @param {Node} node - The node. - * @param {boolean} [parent=true] - Whether this node refers to a shared parent cache or not. - * @return {NodeCache} The cache. - */ - getCacheFromNode(node: Node, parent?: boolean): NodeCache; - /** - * Whether the requested feature is available or not. - * - * @abstract - * @param {string} name - The requested feature. - * @return {boolean} Whether the requested feature is supported or not. - */ - isAvailable(): boolean; - /** - * Returns the vertexIndex input variable as a native shader string. - * - * @abstract - * @return {string} The instanceIndex shader string. - */ - getVertexIndex(): string; - /** - * Contextually returns either the vertex stage instance index builtin - * or the linearized index of an compute invocation within a grid of workgroups. - * - * @abstract - * @return {string} The instanceIndex shader string. - */ - getInstanceIndex(): string; - /** - * Returns the drawIndex input variable as a native shader string. - * Only relevant for WebGL and its `WEBGL_multi_draw` extension. - * - * @abstract - * @return {?string} The drawIndex shader string. - */ - getDrawIndex(): string | null; - /** - * Returns the frontFacing input variable as a native shader string. - * - * @abstract - * @return {string} The frontFacing shader string. - */ - getFrontFacing(): string; - /** - * Returns the fragCoord input variable as a native shader string. - * - * @abstract - * @return {string} The fragCoord shader string. - */ - getFragCoord(): string; - /** - * Whether to flip texture data along its vertical axis or not. WebGL needs - * this method evaluate to `true`, WebGPU to `false`. - * - * @abstract - * @return {boolean} Whether to flip texture data along its vertical axis or not. - */ - isFlipY(): boolean; - /** - * Returns whether the builder is currently in an assignment context. - * - * @return {boolean} Whether the builder is in an assignment context. - */ - isContextAssign(): boolean; - /** - * Calling this method increases the usage count for the given node by one. - * - * @param {Node} node - The node to increase the usage count for. - * @return {number} The updated usage count. - */ - increaseUsage(node: Node): number; - /** - * Returns whether the given node has been written to in any shader stage. - * - * @param {Node} node - The node to check. - * @return {boolean} Whether the node has been written to. - */ - hasWriteUsage(node: Node): boolean; - /** - * Generates a texture sample shader string for the given texture data. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The texture property name. - * @param {string} uvSnippet - Snippet defining the texture coordinates. - * @return {string} The generated shader string. - */ - generateTexture(): string; - /** - * Generates a texture LOD shader string for the given texture data. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The texture property name. - * @param {string} uvSnippet - Snippet defining the texture coordinates. - * @param {?string} depthSnippet - Snippet defining the 0-based texture array index to sample. - * @param {string} levelSnippet - Snippet defining the mip level. - * @return {string} The generated shader string. - */ - generateTextureLod(): string; - /** - * Generates a texture size shader string for the given texture data. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The texture property name. - * @param {string} levelSnippet - Snippet defining the mip level. - * @return {string} The generated shader string. - */ - generateTextureSize(): string; - /** - * Generates the array declaration string. - * - * @param {string} type - The type. - * @param {?number} [count] - The count. - * @return {string} The generated value as a shader string. - */ - generateArrayDeclaration(type: string, count?: number | null): string; - /** - * Generates the array shader string for the given type and value. - * - * @param {string} type - The type. - * @param {?number} [count] - The count. - * @param {?Array} [values=null] - The default values. - * @return {string} The generated value as a shader string. - */ - generateArray(type: string, count?: number | null, values?: Array | null): string; - /** - * Generates the struct shader string. - * - * @param {string} type - The type. - * @param {Array} [membersLayout] - The count. - * @param {?Array} [values=null] - The default values. - * @return {string} The generated value as a shader string. - */ - generateStruct(type: string, membersLayout?: Array, values?: Array | null): string; - /** - * Generates the shader string for the given type and value. - * - * @param {string} type - The type. - * @param {?any} [value=null] - The value. - * @return {string} The generated value as a shader string. - */ - generateConst(type: string, value?: any | null): string; - /** - * It might be necessary to convert certain data types to different ones - * so this method can be used to hide the conversion. - * - * @param {string} type - The type. - * @return {string} The updated type. - */ - getType(type: string): string; - /** - * Whether the given attribute name is defined in the geometry or not. - * - * @param {string} name - The attribute name. - * @return {boolean} Whether the given attribute name is defined in the geometry. - */ - hasGeometryAttribute(name: string): boolean; - /** - * Returns a node attribute for the given name and type. - * - * @param {string} name - The attribute's name. - * @param {string} type - The attribute's type. - * @return {NodeAttribute} The node attribute. - */ - getAttribute(name: string, type: string): NodeAttribute; - /** - * Returns for the given node and shader stage the property name for the shader. - * - * @param {Node} node - The node. - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The property name. - */ - getPropertyName(node: Node): string; - /** - * Returns whether the given name is a reserved keyword of the backend's - * shading language. Backends override this method to provide their - * language-specific keywords. - * - * @param {string} name - The name to test. - * @return {boolean} Whether the name is a reserved keyword or not. - */ - isReservedKeyword(): boolean; - /** - * Whether the given type is a vector type or not. - * - * @param {string} type - The type to check. - * @return {boolean} Whether the given type is a vector type or not. - */ - isVector(type: string): boolean; - /** - * Whether the given type is a matrix type or not. - * - * @param {string} type - The type to check. - * @return {boolean} Whether the given type is a matrix type or not. - */ - isMatrix(type: string): boolean; - /** - * Whether the given type is a reference type or not. - * - * @param {string} type - The type to check. - * @return {boolean} Whether the given type is a reference type or not. - */ - isReference(type: string): boolean; - /** - * Checks if the given texture requires a manual conversion to the working color space. - * - * @abstract - * @param {Texture} texture - The texture to check. - * @return {boolean} Whether the given texture requires a conversion to working color space or not. - */ - needsToWorkingColorSpace(): boolean; - /** - * Returns the component type of a given texture. - * - * @param {Texture} texture - The texture. - * @return {string} The component type. - */ - getComponentTypeFromTexture(texture: Texture): string; - /** - * Returns the element type for a given type. - * - * @param {string} type - The type. - * @return {string} The element type. - */ - getElementType(type: string): string; - /** - * Returns the component type for a given type. - * - * @param {string} type - The type. - * @return {string} The component type. - */ - getComponentType(type: string): string; - /** - * Returns the vector type for a given type. - * - * @param {string} type - The type. - * @return {string} The vector type. - */ - getVectorType(type: string): string; - /** - * Returns the data type for the given the length and component type. - * - * @param {number} length - The length. - * @param {string} [componentType='float'] - The component type. - * @return {string} The type. - */ - getTypeFromLength(length: number, componentType?: string): string; - /** - * Returns the type for a given typed array. - * - * @param {TypedArray} array - The typed array. - * @return {string} The type. - */ - getTypeFromArray(array: TypedArray): string; - /** - * Returns the type is an integer type. - * - * @param {string} type - The type. - * @return {boolean} Whether the type is an integer type or not. - */ - isInteger(type: string): boolean; - /** - * Returns the type for a given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - * @return {string} The type. - */ - getTypeFromAttribute(attribute: BufferAttribute): string; - /** - * Returns the length for the given data type. - * - * @param {string} type - The data type. - * @return {number} The length. - */ - getTypeLength(type: string): number; - /** - * Returns the vector type for a given matrix type. - * - * @param {string} type - The matrix type. - * @return {string} The vector type. - */ - getVectorFromMatrix(type: string): string; - /** - * For a given type this method changes the component type to the - * given value. E.g. `vec4` should be changed to the new component type - * `uint` which results in `uvec4`. - * - * @param {string} type - The type. - * @param {string} newComponentType - The new component type. - * @return {string} The new type. - */ - changeComponentType(type: string, newComponentType: string): string; - /** - * Returns the integer type pendant for the given type. - * - * @param {string} type - The type. - * @return {string} The integer type. - */ - getIntegerType(type: string): string; - /** - * Adds an active stack to the internal stack. - * - * @param {StackNode} stack - The stack node to add. - */ - setActiveStack(stack: StackNode): void; - /** - * Removes the active stack from the internal stack. - * - * @param {StackNode} stack - The stack node to remove. - */ - removeActiveStack(stack: StackNode): void; - /** - * Returns the active stack. - * - * @return {StackNode} The active stack. - */ - getActiveStack(): StackNode; - /** - * Returns the base stack. - * - * @return {StackNode} The base stack. - */ - getBaseStack(): StackNode; - /** - * Adds a stack node to the internal stack. - * - * @return {StackNode} The added stack node. - */ - addStack(): StackNode; - /** - * Removes the last stack node from the internal stack. - * - * @return {StackNode} The removed stack node. - */ - removeStack(): StackNode; - /** - * The builder maintains (cached) data for each node during the building process. This method - * can be used to get these data for a specific shader stage and cache. - * - * @param {Node} node - The node to get the data for. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @param {?NodeCache} cache - An optional cache. - * @return {Object} The node data. - */ - getDataFromNode(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), cache?: NodeCache | null): Object; - /** - * Returns the properties for the given node and shader stage. - * - * Properties are typically used within a build stage to reference a node's - * child node or nodes manually assigned to the properties in a separate build stage. - * A typical usage pattern for defining nodes manually would be assigning dependency nodes - * to the current node's properties in the setup stage and building those properties in the generate stage. - * - * @param {Node} node - The node to get the properties for. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage='any'] - The shader stage. - * @return {Object} The node properties. - */ - getNodeProperties(node: Node, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): Object; - /** - * Returns an instance of {@link NodeAttribute} for the given buffer attribute node. - * - * @param {BufferAttributeNode} node - The buffer attribute node. - * @param {string} type - The node type. - * @param {?string} [name=null] - The name of the buffer attribute. - * @return {NodeAttribute} The node attribute. - */ - getBufferAttributeFromNode(node: BufferAttributeNode, type: string, name?: string | null): NodeAttribute; - /** - * Returns an instance of {@link StructType} for the given struct name and shader stage - * or null if not found. - * - * @param {string} name - The name of the struct. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @return {?StructType} The struct type or null if not found. - */ - getStructTypeNode(name: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType | null; - /** - * Returns an instance of {@link StructType} for the given output struct node. - * - * @param {OutputStructNode} node - The output struct node. - * @param {Array} membersLayout - The output struct types. - * @param {?string} [name=null] - The name of the struct. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @return {StructType} The struct type attribute. - */ - getStructTypeFromNode(node: OutputStructNode, membersLayout: Array, name?: string | null, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): StructType; - /** - * Returns an instance of {@link StructType} for the given output struct node. - * - * @param {OutputStructNode} node - The output struct node. - * @param {Array} membersLayout - The output struct types. - * @return {StructType} The struct type attribute. - */ - getOutputStructTypeFromNode(node: OutputStructNode, membersLayout: Array): StructType; - /** - * Returns an instance of {@link NodeUniform} for the given uniform node. - * - * @param {UniformNode} node - The uniform node. - * @param {string} type - The uniform type. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @param {?string} name - The name of the uniform. - * @return {NodeUniform} The node uniform. - */ - getUniformFromNode(node: UniformNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), name?: string | null): NodeUniform; - /** - * Returns an instance of {@link NodeVar} for the given variable node. - * - * @param {VarNode} node - The variable node. - * @param {?string} name - The variable's name. - * @param {string} [type=node.getNodeType( this )] - The variable's type. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @param {boolean} [readOnly=false] - Whether the variable is read-only or not. - * - * @return {NodeVar} The node variable. - */ - getVarFromNode(node: VarNode, name?: string | null, type?: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any"), readOnly?: boolean): NodeVar; - /** - * Returns whether a Node or its flow is deterministic, useful for use in `const`. - * - * @param {Node} node - The varying node. - * @return {boolean} Returns true if deterministic. - */ - isDeterministic(node: Node): boolean; - /** - * Returns an instance of {@link NodeVarying} for the given varying node. - * - * @param {(VaryingNode|PropertyNode)} node - The varying node. - * @param {?string} name - The varying's name. - * @param {string} [type=node.getNodeType( this )] - The varying's type. - * @param {?string} interpolationType - The interpolation type of the varying. - * @param {?string} interpolationSampling - The interpolation sampling type of the varying. - * @return {NodeVar} The node varying. - */ - getVaryingFromNode(node: (VaryingNode | PropertyNode), name?: string | null, type?: string, interpolationType?: string | null, interpolationSampling?: string | null): NodeVar; - /** - * Registers a node declaration in the current shader stage. - * - * @param {Object} node - The node to be registered. - */ - registerDeclaration(node: Object): void; - /** - * Returns an instance of {@link NodeCode} for the given code node. - * - * @param {CodeNode} node - The code node. - * @param {string} type - The node type. - * @param {('vertex'|'fragment'|'compute'|'any')} [shaderStage=this.shaderStage] - The shader stage. - * @return {NodeCode} The node code. - */ - getCodeFromNode(node: CodeNode, type: string, shaderStage?: ("vertex" | "fragment" | "compute" | "any")): NodeCode; - /** - * Adds a code flow based on the code-block hierarchy. - - * This is used so that code-blocks like If,Else create their variables locally if the Node - * is only used inside one of these conditionals in the current shader stage. - * - * @param {Node} node - The node to add. - * @param {Node} nodeBlock - Node-based code-block. Usually 'ConditionalNode'. - */ - addFlowCodeHierarchy(node: Node, nodeBlock: Node): void; - /** - * Add a inline-code to the current flow code-block. - * - * @param {Node} node - The node to add. - * @param {string} code - The code to add. - * @param {Node} nodeBlock - Current ConditionalNode - */ - addLineFlowCodeBlock(node: Node, code: string, nodeBlock: Node): void; - /** - * Add a inline-code to the current flow. - * - * @param {string} code - The code to add. - * @param {?Node} [node= null] - Optional Node, can help the system understand if the Node is part of a code-block. - * @return {NodeBuilder} A reference to this node builder. - */ - addLineFlowCode(code: string, node?: Node | null): NodeBuilder; - /** - * Adds a code to the current code flow. - * - * @param {string} code - Shader code. - * @return {NodeBuilder} A reference to this node builder. - */ - addFlowCode(code: string): NodeBuilder; - /** - * Add tab in the code that will be generated so that other snippets respect the current tabulation. - * Typically used in codes with If,Else. - * - * @return {NodeBuilder} A reference to this node builder. - */ - addFlowTab(): NodeBuilder; - /** - * Removes a tab. - * - * @return {NodeBuilder} A reference to this node builder. - */ - removeFlowTab(): NodeBuilder; - /** - * Gets the current flow data based on a Node. - * - * @param {Node} node - Node that the flow was started. - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {Object} The flow data. - */ - getFlowData(node: Node): Object; - /** - * Executes the node flow based on a root node to generate the final shader code. - * - * @param {Node} node - The node to execute. - * @return {Object} The code flow. - */ - flowNode(node: Node): Object; - /** - * Includes a node in the current function node. - * - * @param {Node} node - The node to include. - * @returns {void} - */ - addInclude(node: Node): void; - /** - * Returns the native shader operator name for a given generic name. - * It is a similar type of method like {@link NodeBuilder#getMethod}. - * - * @param {ShaderNodeInternal} shaderNode - The shader node to build the function node with. - * @return {FunctionNode} The build function node. - */ - buildFunctionNode(shaderNode: ShaderNodeInternal): FunctionNode; - /** - * Generates a code flow based on a TSL function: Fn(). - * - * @param {ShaderNodeInternal} shaderNode - A function code will be generated based on the input. - * @return {Object} - */ - flowShaderNode(shaderNode: ShaderNodeInternal): Object; - /** - * Executes the node in a specific build stage. - * - * This function can be used to arbitrarily execute the specified build stage - * outside of the standard build process. For instance, if a node's type depends - * on properties created by the 'setup' stage, then flowBuildStage(node, 'setup') - * can be used to execute the setup build stage and access its generated nodes - * before the standard build process begins. - * - * @param {Node} node - The node to execute. - * @param {string} buildStage - The build stage to execute the node in. - * @param {?(Node|string)} [output=null] - Expected output type. For example 'vec3'. - * @return {?(Node|string)} The result of the node build. - */ - flowBuildStage(node: Node, buildStage: string, output?: (Node | string) | null): (Node | string) | null; - /** - * Runs the node flow through all the steps of creation, 'setup', 'analyze', 'generate'. - * - * @param {Node} node - The node to execute. - * @param {?string} output - Expected output type. For example 'vec3'. - * @return {Object} - */ - flowStagesNode(node: Node, output?: string | null): Object; - /** - * Returns the native shader operator name for a given generic name. - * It is a similar type of method like {@link NodeBuilder#getMethod}. - * - * @abstract - * @param {string} op - The operator name to resolve. - * @return {?string} The resolved operator name. - */ - getFunctionOperator(): string | null; - /** - * Builds the given shader node. - * - * @abstract - * @param {ShaderNodeInternal} shaderNode - The shader node. - * @return {string} The function code. - */ - buildFunctionCode(): string; - /** - * Generates a code flow based on a child Node. - * - * @param {Node} node - The node to execute. - * @param {?string} output - Expected output type. For example 'vec3'. - * @return {Object} The code flow. - */ - flowChildNode(node: Node, output?: string | null): Object; - /** - * Executes a flow of code in a different stage. - * - * Some nodes like `varying()` have the ability to compute code in vertex-stage and - * return the value in fragment-stage even if it is being executed in an input fragment. - * - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @param {Node} node - The node to execute. - * @param {?string} output - Expected output type. For example 'vec3'. - * @param {?string} propertyName - The property name to assign the result. - * @return {?(Object|Node)} The code flow or node.build() result. - */ - flowNodeFromShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any"), node: Node, output?: string | null, propertyName?: string | null): (Object | Node) | null; - /** - * Returns an array holding all node attributes of this node builder. - * - * @return {Array} The node attributes of this builder. - */ - getAttributesArray(): Array; - /** - * Returns the attribute definitions as a shader string for the given shader stage. - * - * @abstract - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The attribute code section. - */ - getAttributes(): string; - /** - * Returns the varying definitions as a shader string for the given shader stage. - * - * @abstract - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The varying code section. - */ - getVaryings(): string; - /** - * Returns a single variable definition as a shader string for the given variable type and name. - * - * @param {string} type - The variable's type. - * @param {string} name - The variable's name. - * @param {?number} [count=null] - The array length. - * @return {string} The shader string. - */ - getVar(type: string, name: string, count?: number | null): string; - /** - * Returns the variable definitions as a shader string for the given shader stage. - * - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @param {boolean} [global=false] - Whether the variables are global. - * @return {string} The variable code section. - */ - getVars(shaderStage: ("vertex" | "fragment" | "compute" | "any"), global?: boolean): string; - /** - * Returns the uniform definitions as a shader string for the given shader stage. - * - * @abstract - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The uniform code section. - */ - getUniforms(): string; - /** - * Returns the native code definitions as a shader string for the given shader stage. - * - * @param {('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage. - * @return {string} The native code section. - */ - getCodes(shaderStage: ("vertex" | "fragment" | "compute" | "any")): string; - /** - * Returns the hash of this node builder. - * - * @return {string} The hash. - */ - getHash(): string; - /** - * Sets the current shader stage. - * - * @param {?('vertex'|'fragment'|'compute'|'any')} shaderStage - The shader stage to set. - */ - setShaderStage(shaderStage: ("vertex" | "fragment" | "compute" | "any") | null): void; - /** - * Returns the current shader stage. - * - * @return {?('vertex'|'fragment'|'compute'|'any')} The current shader stage. - */ - getShaderStage(): ("vertex" | "fragment" | "compute" | "any") | null; - /** - * Sets the current build stage. - * - * @param {?('setup'|'analyze'|'generate')} buildStage - The build stage to set. - */ - setBuildStage(buildStage: ("setup" | "analyze" | "generate") | null): void; - /** - * Returns the current build stage. - * - * @return {?('setup'|'analyze'|'generate')} The current build stage. - */ - getBuildStage(): ("setup" | "analyze" | "generate") | null; - /** - * Controls the code build of the shader stages. - * - * @abstract - */ - buildCode(): void; - /** - * Returns the current sub-build layer. - * - * @return {SubBuildNode} The current sub-build layers. - */ - get subBuild(): SubBuildNode; - /** - * Adds a sub-build layer to the node builder. - * - * @param {SubBuildNode} subBuild - The sub-build layer to add. - */ - addSubBuild(subBuild: SubBuildNode): void; - /** - * Removes the last sub-build layer from the node builder. - * - * @return {SubBuildNode} The removed sub-build layer. - */ - removeSubBuild(): SubBuildNode; - /** - * Returns the closest sub-build layer for the given data. - * - * @param {Node|Set|Array} data - The data to get the closest sub-build layer from. - * @return {?string} The closest sub-build name or null if none found. - */ - getClosestSubBuild(data: Node | Set | Array): string | null; - /** - * Returns the output node of a sub-build layer. - * - * @param {Node} node - The node to get the output from. - * @return {string} The output node name. - */ - getSubBuildOutput(node: Node): string; - /** - * Returns the sub-build property name for the given property and node. - * - * @param {string} [property=''] - The property name. - * @param {?Node} [node=null] - The node to get the sub-build from. - * @return {string} The sub-build property name. - */ - getSubBuildProperty(property?: string, node?: Node | null): string; - /** - * Prebuild the node builder. - */ - prebuild(): void; - /** - * Central build method which controls the build for the given object. - * - * @return {NodeBuilder} A reference to this node builder. - */ - build(): NodeBuilder; - /** - * Async version of build() that yields to main thread between shader stages. - * Use this in compileAsync() to prevent blocking the main thread. - * - * @return {Promise} A promise that resolves to this node builder. - */ - buildAsync(): Promise; - /** - * Returns shared data object for the given node. - * - * @param {Node} node - The node to get shared data from. - * @return {Object} The shared data. - */ - getSharedDataFromNode(node: Node): Object; - /** - * Returns a uniform representation which is later used for UBO generation and rendering. - * - * @param {NodeUniform} uniformNode - The uniform node. - * @param {string} type - The requested type. - * @return {Uniform} The uniform. - */ - getNodeUniform(uniformNode: NodeUniform, type: string): Uniform; - /** - * Formats the given shader snippet from a given type into another one. E.g. - * this method might be used to convert a simple float string `"1.0"` into a - * `vec3` representation: `"vec3( 1.0 )"`. - * - * @param {string} snippet - The shader snippet. - * @param {string} fromType - The source type. - * @param {string} toType - The target type. - * @return {string} The updated shader string. - */ - format(snippet: string, fromType: string, toType: string): string; - /** - * Returns a signature with the engine's current revision. - * - * @return {string} The signature. - */ - getSignature(): string; - /** - * Returns `true` if data from the previous frame are required. Relevant - * when computing motion vectors with {@link VelocityNode}. - * - * @return {boolean} Whether data from the previous frame are required or not. - */ - needsPreviousData(): boolean; -} -import BindGroup from '../../renderers/common/BindGroup.js'; -import NodeAttribute from './NodeAttribute.js'; -import NodeVarying from './NodeVarying.js'; -import NodeCode from './NodeCode.js'; -import NodeVar from './NodeVar.js'; -import FunctionNode from '../code/FunctionNode.js'; -import NodeCache from './NodeCache.js'; -import { RenderTarget } from '../../core/RenderTarget.js'; -import CubeRenderTarget from '../../renderers/common/CubeRenderTarget.js'; -import StructType from './StructType.js'; -import NodeUniform from './NodeUniform.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts deleted file mode 100644 index 0c192004d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeCache.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -export default NodeCache; -/** - * This utility class is used in {@link NodeBuilder} as an internal - * cache data structure for node data. - */ -declare class NodeCache { - /** - * Constructs a new node cache. - * - * @param {?NodeCache} parent - A reference to a parent cache. - */ - constructor(parent?: NodeCache | null); - /** - * The id of the cache. - * - * @type {number} - * @readonly - */ - readonly id: number; - /** - * A weak map for managing node data. - * - * @type {WeakMap} - */ - nodesData: WeakMap; - /** - * Reference to a parent node cache. - * - * @type {?NodeCache} - * @default null - */ - parent: NodeCache | null; - /** - * Returns the data for the given node. - * - * @param {Node} node - The node. - * @return {?Object} The data for the node. - */ - getData(node: Node): Object | null; - /** - * Sets the data for a given node. - * - * @param {Node} node - The node. - * @param {Object} data - The data that should be cached. - */ - setData(node: Node, data: Object): void; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts deleted file mode 100644 index f96665f26..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeCode.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -export default NodeCode; -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent user-defined, native shader code portions that are going to be - * injected by the builder. A dictionary of node codes is maintained in {@link NodeBuilder#codes} - * for this purpose. - */ -declare class NodeCode { - /** - * Constructs a new code node. - * - * @param {string} name - The name of the code. - * @param {string} type - The node type. - * @param {string} [code=''] - The native shader code. - */ - constructor(name: string, type: string, code?: string); - /** - * The name of the code. - * - * @type {string} - */ - name: string; - /** - * The node type. - * - * @type {string} - */ - type: string; - /** - * The native shader code. - * - * @type {string} - * @default '' - */ - code: string; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts deleted file mode 100644 index 71d14d55f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeError.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export default NodeError; -/** - * Custom error class for node-related errors, including stack trace information. - */ -declare class NodeError extends Error { - constructor(message: any, stackTrace?: null); - /** - * The stack trace associated with the error. - * - * @type {?StackTrace} - */ - stackTrace: StackTrace | null; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts deleted file mode 100644 index afaee4fe4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeFrame.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -export default NodeFrame; -/** - * Management class for updating nodes. The module tracks metrics like - * the elapsed time, delta time, the render and frame ID to correctly - * call the node update methods {@link Node#updateBefore}, {@link Node#update} - * and {@link Node#updateAfter} depending on the node's configuration. - */ -declare class NodeFrame { - /** - * The elapsed time in seconds. - * - * @type {number} - * @default 0 - */ - time: number; - /** - * The delta time in seconds. - * - * @type {number} - * @default 0 - */ - deltaTime: number; - /** - * The frame ID. - * - * @type {number} - * @default 0 - */ - frameId: number; - /** - * The render ID. - * - * @type {number} - * @default 0 - */ - renderId: number; - /** - * Used to control the {@link Node#update} call. - * - * @type {WeakMap} - */ - updateMap: WeakMap; - /** - * Used to control the {@link Node#updateBefore} call. - * - * @type {WeakMap} - */ - updateBeforeMap: WeakMap; - /** - * Used to control the {@link Node#updateAfter} call. - * - * @type {WeakMap} - */ - updateAfterMap: WeakMap; - /** - * A reference to the current renderer. - * - * @type {?Renderer} - * @default null - */ - renderer: Renderer | null; - /** - * A reference to the current material. - * - * @type {?Material} - * @default null - */ - material: Material | null; - /** - * A reference to the current camera. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * A reference to the current 3D object. - * - * @type {?Object3D} - * @default null - */ - object: Object3D | null; - /** - * A reference to the current scene. - * - * @type {?Scene} - * @default null - */ - scene: Scene | null; - /** - * Returns a dictionary for a given node and update map which - * is used to correctly call node update methods per frame or render. - * - * @private - * @param {WeakMap} referenceMap - The reference weak map. - * @param {Node} nodeRef - The reference to the current node. - * @return {Object>} The dictionary. - */ - private _getMaps; - /** - * This method executes the {@link Node#updateBefore} for the given node. - * It makes sure {@link Node#updateBeforeType} is honored meaning the update - * is only executed once per frame, render or object depending on the update - * type. - * - * @param {Node} node - The node that should be updated. - */ - updateBeforeNode(node: Node): void; - /** - * This method executes the {@link Node#updateAfter} for the given node. - * It makes sure {@link Node#updateAfterType} is honored meaning the update - * is only executed once per frame, render or object depending on the update - * type. - * - * @param {Node} node - The node that should be updated. - */ - updateAfterNode(node: Node): void; - /** - * This method executes the {@link Node#update} for the given node. - * It makes sure {@link Node#updateType} is honored meaning the update - * is only executed once per frame, render or object depending on the update - * type. - * - * @param {Node} node - The node that should be updated. - */ - updateNode(node: Node): void; - /** - * Updates the internal state of the node frame. This method is - * called by the renderer in its internal animation loop. - */ - update(): void; - lastTime: number | undefined; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts deleted file mode 100644 index ef2cdbc0a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeFunction.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -export default NodeFunction; -/** - * Base class for node functions. A derived module must be implemented - * for each supported native shader language. Similar to other `Node*` modules, - * this class is only relevant during the building process and not used - * in user-level code. - */ -declare class NodeFunction { - /** - * Constructs a new node function. - * - * @param {string} type - The node type. This type is the return type of the node function. - * @param {Array} inputs - The function's inputs. - * @param {string} [name=''] - The function's name. - * @param {string} [precision=''] - The precision qualifier. - */ - constructor(type: string, inputs: Array, name?: string, precision?: string); - /** - * The node type. This type is the return type of the node function. - * - * @type {string} - */ - type: string; - /** - * The function's inputs. - * - * @type {Array} - */ - inputs: Array; - /** - * The name of the uniform. - * - * @type {string} - * @default '' - */ - name: string; - /** - * The precision qualifier. - * - * @type {string} - * @default '' - */ - precision: string; - /** - * This method returns the native code of the node function. - * - * @abstract - * @param {string} name - The function's name. - * @return {string} A shader code. - */ - getCode(): string; -} -declare namespace NodeFunction { - let isNodeFunction: boolean; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts deleted file mode 100644 index 3df5a1b75..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeFunctionInput.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export default NodeFunctionInput; -/** - * Describes the input of a {@link NodeFunction}. - */ -declare class NodeFunctionInput { - /** - * Constructs a new node function input. - * - * @param {string} type - The input type. - * @param {string} name - The input name. - * @param {?number} [count=null] - If the input is an Array, count will be the length. - * @param {('in'|'out'|'inout')} [qualifier=''] - The parameter qualifier (only relevant for GLSL). - * @param {boolean} [isConst=false] - Whether the input uses a const qualifier or not (only relevant for GLSL). - */ - constructor(type: string, name: string, count?: number | null, qualifier?: ("in" | "out" | "inout"), isConst?: boolean); - /** - * The input type. - * - * @type {string} - */ - type: string; - /** - * The input name. - * - * @type {string} - */ - name: string; - /** - * If the input is an Array, count will be the length. - * - * @type {?number} - * @default null - */ - count: number | null; - /** - *The parameter qualifier (only relevant for GLSL). - * - * @type {('in'|'out'|'inout')} - * @default '' - */ - qualifier: ("in" | "out" | "inout"); - /** - * Whether the input uses a const qualifier or not (only relevant for GLSL). - * - * @type {boolean} - * @default false - */ - isConst: boolean; -} -declare namespace NodeFunctionInput { - let isNodeFunctionInput: boolean; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts deleted file mode 100644 index f15875899..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeParser.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -export default NodeParser; -/** - * Base class for node parsers. A derived parser must be implemented - * for each supported native shader language. - */ -declare class NodeParser { - /** - * The method parses the given native code an returns a node function. - * - * @abstract - * @param {string} source - The native shader code. - * @return {NodeFunction} A node function. - */ - parseFunction(): NodeFunction; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts deleted file mode 100644 index 3f872f033..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeUniform.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -export default NodeUniform; -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader uniforms that are going to be generated - * by the builder. A dictionary of node uniforms is maintained in {@link NodeBuilder#uniforms} - * for this purpose. - */ -declare class NodeUniform { - /** - * Constructs a new node uniform. - * - * @param {string} name - The name of the uniform. - * @param {string} type - The type of the uniform. - * @param {UniformNode} node - An reference to the node. - */ - constructor(name: string, type: string, node: UniformNode); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeUniform: boolean; - /** - * The name of the uniform. - * - * @type {string} - */ - name: string; - /** - * The type of the uniform. - * - * @type {string} - */ - type: string; - /** - * An reference to the node. - * - * @type {UniformNode} - */ - node: UniformNode; - set value(val: any); - /** - * The value of the uniform node. - * - * @type {any} - */ - get value(): any; - /** - * The id of the uniform node. - * - * @type {number} - */ - get id(): number; - /** - * The uniform node's group. - * - * @type {UniformGroupNode} - */ - get groupNode(): UniformGroupNode; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts deleted file mode 100644 index 527147b2a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeUtils.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Returns the data type for the given the length. - * - * @private - * @method - * @param {number} length - The length. - * @return {string} The data type. - */ -export function getTypeFromLength(length: number): string; -/** - * Returns the typed array for the given data type. - * - * @private - * @method - * @param {string} type - The data type. - * @return {TypedArray} The typed array. - */ -export function getTypedArrayFromType(type: string): TypedArray; -/** - * Returns the length for the given data type. - * - * @private - * @method - * @param {string} type - The data type. - * @return {number} The length. - */ -export function getLengthFromType(type: string): number; -/** - * Returns the gpu memory length for the given data type in 4-byte elements. - * - * @private - * @method - * @param {string} type - The data type. - * @return {number} The memory length in 4-byte elements. - */ -export function getMemoryLengthFromType(type: string): number; -/** - * Returns the alignment requirement for the given data type in 4-byte elements. - * - * @private - * @method - * @param {string} type - The data type. - * @return {number} The alignment requirement in 4-byte elements. - */ -export function getAlignmentFromType(type: string): number; -/** - * Returns the data type for the given value. - * - * @private - * @method - * @param {any} value - The value. - * @return {?string} The data type. - */ -export function getValueType(value: any): string | null; -/** - * Returns the node data type for the given texture. - * - * @private - * @method - * @param {Texture} texture - The texture. - * @return {string} The data type. - */ -export function getTextureType(texture: Texture): string; -/** - * Returns the value/object for the given data type and parameters. - * - * @private - * @method - * @param {string} type - The given type. - * @param {...any} params - A parameter list. - * @return {any} The value/object. - */ -export function getValueFromType(type: string, ...params: any[]): any; -/** - * Gets the object data that can be shared between different rendering steps. - * - * @private - * @param {Object} object - The object to get the data for. - * @return {Object} The object data. - */ -export function getDataFromObject(object: Object): Object; -/** - * Converts the given array buffer to a Base64 string. - * - * @private - * @method - * @param {ArrayBuffer} arrayBuffer - The array buffer. - * @return {string} The Base64 string. - */ -export function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string; -/** - * Converts the given Base64 string to an array buffer. - * - * @private - * @method - * @param {string} base64 - The Base64 string. - * @return {ArrayBuffer} The array buffer. - */ -export function base64ToArrayBuffer(base64: string): ArrayBuffer; -export function isArrayAsParameter(params: any): any; -export function hashString(str: string): number; -export function hashArray(array: Array): number; -export function hash(...params: number[]): number; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts deleted file mode 100644 index 43e82262f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeVar.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export default NodeVar; -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader variables that are going to be generated - * by the builder. A dictionary of node variables is maintained in {@link NodeBuilder#vars} for - * this purpose. - */ -declare class NodeVar { - /** - * Constructs a new node variable. - * - * @param {string} name - The name of the variable. - * @param {string} type - The type of the variable. - * @param {boolean} [readOnly=false] - The read-only flag. - * @param {?number} [count=null] - The size. - */ - constructor(name: string, type: string, readOnly?: boolean, count?: number | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeVar: boolean; - /** - * The name of the variable. - * - * @type {string} - */ - name: string; - /** - * The type of the variable. - * - * @type {string} - */ - type: string; - /** - * The read-only flag. - * - * @type {boolean} - */ - readOnly: boolean; - /** - * The size. - * - * @type {?number} - */ - count: number | null; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts deleted file mode 100644 index 587fb0896..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/NodeVarying.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export default NodeVarying; -/** - * {@link NodeBuilder} is going to create instances of this class during the build process - * of nodes. They represent the final shader varyings that are going to be generated - * by the builder. An array of node varyings is maintained in {@link NodeBuilder#varyings} for - * this purpose. - * - * @augments NodeVar - */ -declare class NodeVarying extends NodeVar { - /** - * Constructs a new node varying. - * - * @param {string} name - The name of the varying. - * @param {string} type - The type of the varying. - * @param {?string} interpolationType - The interpolation type of the varying. - * @param {?string} interpolationSampling - The interpolation sampling type of the varying. - */ - constructor(name: string, type: string, interpolationType?: string | null, interpolationSampling?: string | null); - /** - * Whether this varying requires interpolation or not. This property can be used - * to check if the varying can be optimized for a variable. - * - * @type {boolean} - * @default false - */ - needsInterpolation: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeVarying: boolean; - /** - * The interpolation type of the varying data. - * - * @type {?string} - * @default null - */ - interpolationType: string | null; - /** - * The interpolation sampling type of varying data. - * - * @type {?string} - * @default null - */ - interpolationSampling: string | null; -} -import NodeVar from './NodeVar.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts deleted file mode 100644 index ea5448089..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/OutputStructNode.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default OutputStructNode; -/** - * TSL function for creating an output struct node. - * - * @tsl - * @function - * @param {...Node} members - A parameter list of nodes. - * @returns {OutputStructNode} - */ -export const outputStruct: any; -/** - * This node can be used to define multiple outputs in a shader programs. - * - * @augments Node - */ -declare class OutputStructNode extends Node { - /** - * Constructs a new output struct node. The constructor can be invoked with an - * arbitrary number of nodes representing the members. - * - * @param {...Node} members - A parameter list of nodes. - */ - constructor(...members: Node[]); - /** - * An array of nodes which defines the output. - * - * @type {Array} - */ - members: Array; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOutputStructNode: boolean; - generateNodeType(): string; - generate(builder: any): any; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts deleted file mode 100644 index dadc1807e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/OverrideContextNode.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * TSL function for creating an `OverrideContextNode` to override a single target node. - * - * ```js - * material.contextNode = overrideNode( positionLocal, ( builder ) => positionLocal.add( vec3( 1, 0, 0 ) ) ); - * ``` - * - * @tsl - * @function - * @param {Node} targetNode - The target node that should be overridden. - * @param {Function|Node|null} [callback=null] - A callback function returning the overriding node (which receives the builder as its argument), or the overriding node itself. - * @param {Node|null} [flowNode=null] - The node whose context should be modified. - * @return {OverrideContextNode} The created override context node. - */ -export function overrideNode(targetNode: Node, callback?: Function | Node | null, flowNode?: Node | null): OverrideContextNode; -/** - * TSL function for creating an `OverrideContextNode` to override multiple target nodes. - * - * ```js - * material.contextNode = overrideNodes( [ - * [ positionView, customPositionView ], - * [ positionViewDirection, ( builder ) => customPositionViewDirection ] - * ] ); - * ``` - * - * @tsl - * @function - * @param {Map|Array>} overrides - The overrides mapping target nodes to callback functions or overriding nodes. - * @param {Node|null} [flowNode=null] - The node whose context should be modified. - * @return {OverrideContextNode} The created override context node. - */ -export function overrideNodes(overrides: Map | Array>, flowNode?: Node | null): OverrideContextNode; -export default OverrideContextNode; -/** - * A specialized context node designed to override specific target nodes within a - * node sub-graph or flow. This allows replacing specific inputs (e.g., normal - * and position vectors) dynamically during compilation for a specific flow node, - * without having to reconstruct or duplicate the source nodes. - * - * ```js - * // Method chaining example: - * node.overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); - * - * // Context assignment example: - * material.contextNode = overrideNode( positionLocal, () => positionLocal.add( vec3( 1, 0, 0 ) ) ); - * ``` - * - * @augments ContextNode - */ -declare class OverrideContextNode extends ContextNode { - /** - * Constructs a new override context node. - * - * @param {Map} overrideNodes - A map mapping target nodes to their respective override callback functions. - * @param {Node|null} [flowNode=null] - The node whose context should be modified. - */ - constructor(overrideNodes: Map, flowNode?: Node | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOverrideContextNode: boolean; -} -import ContextNode from './ContextNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts deleted file mode 100644 index 6ab531096..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/ParameterNode.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default ParameterNode; -export function parameter(type: string, name: string | null): ParameterNode; -/** - * Special version of {@link PropertyNode} which is used for parameters. - * - * @augments PropertyNode - */ -declare class ParameterNode extends PropertyNode { - /** - * Constructs a new parameter node. - * - * @param {string} nodeType - The type of the node. - * @param {?string} [name=null] - The name of the parameter in the shader. - */ - constructor(nodeType: string, name?: string | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isParameterNode: boolean; - /** - * Gets the type of a member variable in the parameter node. - * - * @param {NodeBuilder} builder - The node builder. - * @param {string} name - The name of the member variable. - * @returns {string} - */ - getMemberType(builder: NodeBuilder, name: string): string; - getHash(): string; - generate(): string; -} -import PropertyNode from './PropertyNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts deleted file mode 100644 index 7c15780f7..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/PropertyNode.d.ts +++ /dev/null @@ -1,277 +0,0 @@ -export default PropertyNode; -export function property(type: string, name?: string | null, placeholderNode?: Node | null): PropertyNode; -export function varyingProperty(type: string, name?: string | null, placeholderNode?: Node | null): PropertyNode; -/** - * TSL object that represents the shader variable `DiffuseColor`. - * - * @tsl - * @type {PropertyNode} - */ -export const diffuseColor: PropertyNode; -/** - * TSL object that represents the shader variable `DiffuseContribution`. - * - * @tsl - * @type {PropertyNode} - */ -export const diffuseContribution: PropertyNode; -/** - * TSL object that represents the shader variable `EmissiveColor`. - * - * @tsl - * @type {PropertyNode} - */ -export const emissive: PropertyNode; -/** - * TSL object that represents the shader variable `Roughness`. - * - * @tsl - * @type {PropertyNode} - */ -export const roughness: PropertyNode; -/** - * TSL object that represents the shader variable `Metalness`. - * - * @tsl - * @type {PropertyNode} - */ -export const metalness: PropertyNode; -/** - * TSL object that represents the shader variable `Clearcoat`. - * - * @tsl - * @type {PropertyNode} - */ -export const clearcoat: PropertyNode; -/** - * TSL object that represents the shader variable `ClearcoatRoughness`. - * - * @tsl - * @type {PropertyNode} - */ -export const clearcoatRoughness: PropertyNode; -/** - * TSL object that represents the shader variable `Sheen`. - * - * @tsl - * @type {PropertyNode} - */ -export const sheen: PropertyNode; -/** - * TSL object that represents the shader variable `SheenRoughness`. - * - * @tsl - * @type {PropertyNode} - */ -export const sheenRoughness: PropertyNode; -/** - * TSL object that represents the shader variable `Iridescence`. - * - * @tsl - * @type {PropertyNode} - */ -export const iridescence: PropertyNode; -/** - * TSL object that represents the shader variable `IridescenceIOR`. - * - * @tsl - * @type {PropertyNode} - */ -export const iridescenceIOR: PropertyNode; -/** - * TSL object that represents the shader variable `IridescenceThickness`. - * - * @tsl - * @type {PropertyNode} - */ -export const iridescenceThickness: PropertyNode; -/** - * TSL object that represents the shader variable `AlphaT`. - * - * @tsl - * @type {PropertyNode} - */ -export const alphaT: PropertyNode; -/** - * TSL object that represents the shader variable `Anisotropy`. - * - * @tsl - * @type {PropertyNode} - */ -export const anisotropy: PropertyNode; -/** - * TSL object that represents the shader variable `AnisotropyT`. - * - * @tsl - * @type {PropertyNode} - */ -export const anisotropyT: PropertyNode; -/** - * TSL object that represents the shader variable `AnisotropyB`. - * - * @tsl - * @type {PropertyNode} - */ -export const anisotropyB: PropertyNode; -/** - * TSL object that represents the shader variable `SpecularColor`. - * - * @tsl - * @type {PropertyNode} - */ -export const specularColor: PropertyNode; -/** - * TSL object that represents the shader variable `SpecularColorBlended`. - * - * @tsl - * @type {PropertyNode} - */ -export const specularColorBlended: PropertyNode; -/** - * TSL object that represents the shader variable `SpecularF90`. - * - * @tsl - * @type {PropertyNode} - */ -export const specularF90: PropertyNode; -/** - * TSL object that represents the shader variable `Shininess`. - * - * @tsl - * @type {PropertyNode} - */ -export const shininess: PropertyNode; -/** - * TSL object that represents the shader variable `Output`. - * - * @tsl - * @type {PropertyNode} - */ -export const output: PropertyNode; -/** - * TSL object that represents the shader variable `dashSize`. - * - * @tsl - * @type {PropertyNode} - */ -export const dashSize: PropertyNode; -/** - * TSL object that represents the shader variable `gapSize`. - * - * @tsl - * @type {PropertyNode} - */ -export const gapSize: PropertyNode; -/** - * TSL object that represents the shader variable `pointWidth`. - * - * @tsl - * @type {PropertyNode} - */ -export const pointWidth: PropertyNode; -/** - * TSL object that represents the shader variable `IOR`. - * - * @tsl - * @type {PropertyNode} - */ -export const ior: PropertyNode; -/** - * TSL object that represents the shader variable `Transmission`. - * - * @tsl - * @type {PropertyNode} - */ -export const transmission: PropertyNode; -/** - * TSL object that represents the shader variable `Thickness`. - * - * @tsl - * @type {PropertyNode} - */ -export const thickness: PropertyNode; -/** - * TSL object that represents the shader variable `AttenuationDistance`. - * - * @tsl - * @type {PropertyNode} - */ -export const attenuationDistance: PropertyNode; -/** - * TSL object that represents the shader variable `AttenuationColor`. - * - * @tsl - * @type {PropertyNode} - */ -export const attenuationColor: PropertyNode; -/** - * TSL object that represents the shader variable `Dispersion`. - * - * @tsl - * @type {PropertyNode} - */ -export const dispersion: PropertyNode; -/** - * TSL object that represents the shader variable `Retroreflectivity`. - * - * @tsl - * @type {PropertyNode} - */ -export const retroreflectivity: PropertyNode; -/** - * TSL object that represents the shader variable `AmbientOcclusion`. - * If no value is assigned to this property, it defaults to a placeholder value of `1.0`. - * - * @tsl - * @type {PropertyNode} - */ -export const ambientOcclusion: PropertyNode; -/** - * This class represents a shader property. It can be used - * to explicitly define a property and assign a value to it. - * - * ```js - * const threshold = property( 'float', 'threshold' ).assign( THRESHOLD ); - *``` - * `PropertyNode` is used by the engine to predefined common material properties - * for TSL code. - * - * @augments Node - */ -declare class PropertyNode extends Node { - /** - * Constructs a new property node. - * - * @param {string} nodeType - The type of the node. - * @param {?string} [name=null] - The name of the property in the shader. - * @param {boolean} [varying=false] - Whether this property is a varying or not. - * @param {?Node} [placeholderNode=null] - The placeholder node if not assigned. - */ - constructor(nodeType: string, name?: string | null, varying?: boolean, placeholderNode?: Node | null); - /** - * Whether this property is a varying or not. - * - * @type {boolean} - * @default false - */ - varying: boolean; - /** - * The placeholder node of the property if it is not assigned. - * - * @type {?Node} - * @default null - */ - placeholderNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPropertyNode: boolean; - getNodeType(builder: any): any; - getHash(builder: any): string; - generate(builder: any): any; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts deleted file mode 100644 index 279abd734..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/StackNode.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -export default StackNode; -/** - * TSL function for creating a stack node. - * - * @tsl - * @function - * @param {?StackNode} [parent=null] - The parent stack node. - * @returns {StackNode} - */ -export const stack: any; -/** - * Stack is a helper for Nodes that need to produce stack-based code instead of continuous flow. - * They are usually needed in cases like `If`, `Else`. - * - * @augments Node - */ -declare class StackNode extends Node { - /** - * Constructs a new stack node. - * - * @param {?StackNode} [parent=null] - The parent stack node. - */ - constructor(parent?: StackNode | null); - /** - * List of nodes. - * - * @type {Array} - */ - nodes: Array; - /** - * The output node. - * - * @type {?Node} - * @default null - */ - outputNode: Node | null; - /** - * The parent stack node. - * - * @type {?StackNode} - * @default null - */ - parent: StackNode | null; - /** - * The current conditional node. - * - * @private - * @type {ConditionalNode} - * @default null - */ - private _currentCond; - /** - * The expression node. Only - * relevant for Switch/Case. - * - * @private - * @type {Node} - * @default null - */ - private _expressionNode; - /** - * The current node being processed. - * - * @private - * @type {Node} - * @default null - */ - private _currentNode; - /** - * Stores additional data for nodes that are added to the stack. - * - * @private - * @type {Map} - */ - private _nodeDataLibrary; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStackNode: boolean; - getElementType(builder: any): string; - generateNodeType(builder: any): string; - getMemberType(builder: any, name: any): string; - /** - * Adds a node to this stack. - * - * @param {Node} node - The node to add. - * @param {number} [index=-1] - The index of the node. If not specified, the node will be added to the end of the stack. - * @return {StackNode} A reference to this stack node. - */ - addToStack(node: Node, index?: number): StackNode; - /** - * Adds a node to the stack before the current node. - * - * @param {Node} node - The node to add. - * @return {StackNode} A reference to this stack node. - */ - addToStackBefore(node: Node): StackNode; - /** - * Represent an `if` statement in TSL. - * - * @param {Node} boolNode - Represents the condition. - * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. - * @return {StackNode} A reference to this stack node. - */ - If(boolNode: Node, method: Function): StackNode; - /** - * Represent an `elseif` statement in TSL. - * - * @param {Node} boolNode - Represents the condition. - * @param {Function} method - TSL code which is executed if the condition evaluates to `true`. - * @return {StackNode} A reference to this stack node. - */ - ElseIf(boolNode: Node, method: Function): StackNode; - /** - * Represent an `else` statement in TSL. - * - * @param {Function} method - TSL code which is executed in the `else` case. - * @return {StackNode} A reference to this stack node. - */ - Else(method: Function): StackNode; - /** - * Represents a `switch` statement in TSL. - * - * @param {any} expression - Represents the expression. - * @return {StackNode} A reference to this stack node. - */ - Switch(expression: any): StackNode; - /** - * Represents a `case` statement in TSL. The TSL version accepts an arbitrary numbers of values. - * The last parameter must be the callback method that should be executed in the `true` case. - * - * @param {...any} params - The values of the `Case()` statement as well as the callback method. - * @return {StackNode} A reference to this stack node. - */ - Case(...params: any[]): StackNode; - /** - * Represents the default code block of a Switch/Case statement. - * - * @param {Function} method - TSL code which is executed in the `else` case. - * @return {StackNode} A reference to this stack node. - */ - Default(method: Function): StackNode; - setup(builder: any): any; - build(builder: any, ...params: any[]): string | Node | null | undefined; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts deleted file mode 100644 index d870b1d2f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/StackTrace.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export default StackTrace; -/** - * Class representing a stack trace for debugging purposes. - */ -declare class StackTrace { - /** - * Creates a StackTrace instance by capturing and filtering the current stack trace. - * - * @param {Error|string|null} stackMessage - An optional stack trace to use instead of capturing a new one. - */ - constructor(stackMessage?: Error | string | null); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStackTrace: boolean; - /** - * The stack trace. - * - * @type {Array<{fn: string, file: string, line: number, column: number}>} - */ - stack: Array<{ - fn: string; - file: string; - line: number; - column: number; - }>; - /** - * Returns a formatted location string of the top stack frame. - * - * @returns {string} The formatted stack trace message. - */ - getLocation(): string; - /** - * Returns the full error message including the stack trace. - * - * @param {string} message - The error message. - * @returns {string} The full error message with stack trace. - */ - getError(message: string): string; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts deleted file mode 100644 index 0b9c6e2d8..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/StructNode.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -export default StructNode; -export function struct(membersLayout: Object, name?: string | null): Function; -/** - * StructNode allows to create custom structures with multiple members. - * This can also be used to define structures in attribute and uniform data. - * - * ```js - * // Define a custom struct - * const BoundingBox = struct( { min: 'vec3', max: 'vec3' } ); - * - * // Create a new instance of the struct - * const bb = BoundingBox( vec3( 0 ), vec3( 1 ) ); // style 1 - * const bb = BoundingBox( { min: vec3( 0 ), max: vec3( 1 ) } ); // style 2 - * - * // Access the struct members - * const min = bb.get( 'min' ); - * - * // Assign a new value to a member - * min.assign( vec3() ); - * ``` - * @augments Node - */ -declare class StructNode extends Node { - constructor(structTypeNode: any, values: any); - structTypeNode: any; - values: any; - isStructNode: boolean; - generateNodeType(builder: any): any; - getMemberType(builder: any, name: any): any; - _getChildren(): Object[]; - generate(builder: any): any; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts deleted file mode 100644 index af08042f6..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/StructType.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export default StructType; -declare class StructType { - constructor(name: any, members: any); - name: any; - members: any; - output: boolean; -} diff --git a/jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts deleted file mode 100644 index 7fb5881df..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/StructTypeNode.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export default StructTypeNode; -/** - * Represents a struct type node in the node-based system. - * This class is used to define and manage the layout and types of struct members. - * It extends the base Node class and provides methods to get the length of the struct, - * retrieve member types, and generate the struct type for a builder. - * - * @augments Node - */ -declare class StructTypeNode extends Node { - /** - * Creates an instance of StructTypeNode. - * - * @param {Object} membersLayout - The layout of the members for the struct. - * @param {?string} [name=null] - The optional name of the struct. - */ - constructor(membersLayout: Object, name?: string | null); - /** - * The layout of the members for the struct - * - * @type {Array.<{name: string, type: string, atomic: boolean}>} - */ - membersLayout: Array<{ - name: string; - type: string; - atomic: boolean; - }>; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStructTypeNode: boolean; - /** - * Returns the length of the struct in 4-byte elements (e.g. float or int components). - * The length is calculated by summing the lengths of the struct's members, accounting for memory alignment. - * To get the size in bytes, multiply the returned value by 4. - * - * @returns {number} The length of the struct in 4-byte elements. - */ - getLength(): number; - getMemberType(builder: any, name: any): string; - generateNodeType(builder: any): any; - setup(builder: any): void; - generate(builder: any): string; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts deleted file mode 100644 index a5227f1b6..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/SubBuildNode.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export default SubBuildNode; -export function subBuild(node: Node, name: string, type?: string | null): Node; -/** - * This node is used to build a sub-build in the node system. - * - * @augments Node - * @param {Node} node - The node to be built in the sub-build. - * @param {string} name - The name of the sub-build. - * @param {?string} [nodeType=null] - The type of the node, if known. - */ -declare class SubBuildNode extends Node { - constructor(node: any, name: any, nodeType?: null); - /** - * The node to be built in the sub-build. - * - * @type {Node} - */ - node: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSubBuildNode: boolean; - generateNodeType(builder: any): string; - build(builder: any, ...params: any[]): string | Node | null; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts deleted file mode 100644 index ed3119f09..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/TempNode.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default TempNode; -/** - * This module uses cache management to create temporary variables - * if the node is used more than once to prevent duplicate calculations. - * - * The class acts as a base class for many other nodes types. - * - * @augments Node - */ -declare class TempNode extends Node { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTempNode: boolean; - /** - * Whether this node is used more than once in context of other nodes. - * - * @param {NodeBuilder} builder - The node builder. - * @return {boolean} A flag that indicates if there is more than one dependency to other nodes. - */ - hasDependencies(builder: NodeBuilder): boolean; - build(builder: any, output: any): any; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts deleted file mode 100644 index 04956ab9c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/UniformGroupNode.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -export default UniformGroupNode; -export function uniformGroup(name: string, order?: number, updateType?: null): UniformGroupNode; -export function sharedUniformGroup(name: string, order?: number, updateType?: null): UniformGroupNode; -/** - * TSL object that represents a shared uniform group node which is updated once per frame. - * - * @tsl - * @type {UniformGroupNode} - */ -export const frameGroup: UniformGroupNode; -/** - * TSL object that represents a shared uniform group node which is updated once per render. - * - * @tsl - * @type {UniformGroupNode} - */ -export const renderGroup: UniformGroupNode; -/** - * TSL object that represents a uniform group node which is updated once per object. - * - * @tsl - * @type {UniformGroupNode} - */ -export const objectGroup: UniformGroupNode; -/** - * This node can be used to group single instances of {@link UniformNode} - * and manage them as a uniform buffer. - * - * In most cases, the predefined nodes `objectGroup`, `renderGroup` and `frameGroup` - * will be used when defining the {@link UniformNode#groupNode} property. - * - * - `objectGroup`: Uniform buffer per object. - * - `renderGroup`: Shared uniform buffer, updated once per render call. - * - `frameGroup`: Shared uniform buffer, updated once per frame. - * - * @augments Node - */ -declare class UniformGroupNode extends Node { - /** - * Constructs a new uniform group node. - * - * @param {string} name - The name of the uniform group node. - * @param {boolean} [shared=false] - Whether this uniform group node is shared or not. - * @param {number} [order=1] - Influences the internal sorting. - * @param {string|null} [updateType=null] - The update type of the uniform group node. - */ - constructor(name: string, shared?: boolean, order?: number, updateType?: string | null); - /** - * Whether this uniform group node is shared or not. - * - * @type {boolean} - * @default false - */ - shared: boolean; - /** - * The sort key that determines the order of this group relative to other - * uniform groups. Groups with a lower order are placed first. Shared groups - * typically use a lower order so they precede regular per-object groups. - * - * @type {number} - * @default 1 - */ - order: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformGroup: boolean; - /** - * Marks the uniform group node as needing an update. - * This will trigger the necessary updates in the rendering process. - */ - update(): void; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts deleted file mode 100644 index 780398f37..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/UniformNode.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -export default UniformNode; -export function uniform(value: any | string, type?: string): UniformNode; -/** - * Class for representing a uniform. - * - * @augments InputNode - */ -declare class UniformNode extends InputNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformNode: boolean; - /** - * The uniform group of this uniform. By default, uniforms are - * managed per object but they might belong to a shared group - * which is updated per frame or render call. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; - /** - * Sets the {@link UniformNode#name} property. - * - * @param {string} name - The name of the uniform. - * @return {UniformNode} A reference to this node. - */ - setName(name: string): UniformNode; - /** - * Sets the {@link UniformNode#name} property. - * - * @deprecated - * @param {string} name - The name of the uniform. - * @return {UniformNode} A reference to this node. - */ - label(name: string): UniformNode; - /** - * Sets the {@link UniformNode#groupNode} property. - * - * @param {UniformGroupNode} group - The uniform group. - * @return {UniformNode} A reference to this node. - */ - setGroup(group: UniformGroupNode): UniformNode; - /** - * Returns the {@link UniformNode#groupNode}. - * - * @return {UniformGroupNode} The uniform group. - */ - getGroup(): UniformGroupNode; - /** - * By default, this method returns the result of {@link Node#getHash} but derived - * classes might overwrite this method with a different implementation. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The uniform hash. - */ - getUniformHash(builder: NodeBuilder): string; - /** - * Uniform nodes with the same hash share a single uniform. This method returns the node - * the shared uniform refers to which is the first node registered for the hash. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {UniformNode} The node the shared uniform refers to. - */ - getSharedNode(builder: NodeBuilder): UniformNode; - onUpdate(callback: any, updateType: any): import("./Node.js").default; - getInputType(builder: any): string; - generate(builder: any, output: any): any; -} -import InputNode from './InputNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts deleted file mode 100644 index 5e200133c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/VarNode.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -export default VarNode; -export function Var(node: Node, name?: string | null): VarNode; -export function Const(node: Node, name?: string | null): VarNode; -export function VarIntent(node: Node): VarNode; -/** - * Class for representing shader variables as nodes. Variables are created from - * existing nodes like the following: - * - * ```js - * const depth = sampleDepth( uvNode ).toVar( 'depth' ); - * ``` - * - * @augments Node - */ -declare class VarNode extends Node { - /** - * Constructs a new variable node. - * - * @param {Node} node - The node for which a variable should be created. - * @param {?string} [name=null] - The name of the variable in the shader. - * @param {boolean} [readOnly=false] - The read-only flag. - */ - constructor(node: Node, name?: string | null, readOnly?: boolean); - /** - * The node for which a variable should be created. - * - * @type {Node} - */ - node: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVarNode: boolean; - /** - * - * The read-only flag. - * - * @type {boolean} - * @default false - */ - readOnly: boolean; - /** - * This flag is used to indicate that this node is used for intent. - * - * @type {boolean} - * @default false - */ - intent: boolean; - /** - * Sets the intent flag for this node. - * - * This flag is used to indicate that this node is used for intent - * and should not be built directly. Instead, it is used to indicate that - * the node should be treated as a variable intent. - * - * It's useful for assigning variables without needing creating a new variable node. - * - * @param {boolean} value - The value to set for the intent flag. - * @returns {VarNode} This node. - */ - setIntent(value: boolean): VarNode; - /** - * Checks if this node is used for intent. - * - * @param {NodeBuilder} builder - The node builder. - * @returns {boolean} Whether this node is used for intent. - */ - isIntent(builder: NodeBuilder): boolean; - /** - * Returns the intent flag of this node. - * - * @return {boolean} The intent flag. - */ - getIntent(): boolean; - getMemberType(builder: any, name: any): string; - getElementType(builder: any): string; - generateNodeType(builder: any): string; - getArrayCount(builder: any): number | null; - isAssign(builder: any): any; - build(...params: any[]): string | Node | null; - generate(builder: any): any; - _hasStack(builder: any): boolean; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts deleted file mode 100644 index 4833ad311..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/VaryingNode.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -export default VaryingNode; -/** - * TSL function for creating a varying node. - * - * @tsl - * @function - * @param {Node} node - The node for which a varying should be created. - * @param {?string} name - The name of the varying in the shader. - * @returns {VaryingNode} - */ -export const varying: any; -export function vertexStage(node: Node): VaryingNode; -/** - * Class for representing shader varyings as nodes. Varyings are create from - * existing nodes like the following: - * - * ```js - * const positionLocal = positionGeometry.toVarying( 'vPositionLocal' ); - * ``` - * - * @augments Node - */ -declare class VaryingNode extends Node { - /** - * Constructs a new varying node. - * - * @param {Node} node - The node for which a varying should be created. - * @param {?string} name - The name of the varying in the shader. - */ - constructor(node: Node, name?: string | null); - /** - * The node for which a varying should be created. - * - * @type {Node} - */ - node: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVaryingNode: boolean; - /** - * The interpolation type of the varying data. - * - * @type {?string} - * @default null - */ - interpolationType: string | null; - /** - * The interpolation sampling type of varying data. - * - * @type {?string} - * @default null - */ - interpolationSampling: string | null; - /** - * Defines the interpolation type of the varying. - * - * @param {string} type - The interpolation type. - * @param {?string} sampling - The interpolation sampling type - * @return {VaryingNode} A reference to this node. - */ - setInterpolation(type: string, sampling?: string | null): VaryingNode; - getHash(builder: any): string; - generateNodeType(builder: any): string; - /** - * This method performs the setup of a varying node with the current node builder. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {NodeVarying} The node varying from the node builder. - */ - setupVarying(builder: NodeBuilder): NodeVarying; - setup(builder: any): void; - analyze(builder: any): void; - generate(builder: any): any; -} -import Node from './Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts b/jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts deleted file mode 100644 index 5d342ff3a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/core/constants.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export namespace NodeShaderStage { - let VERTEX: string; - let FRAGMENT: string; -} -export namespace NodeUpdateType { - let NONE: string; - let FRAME: string; - let RENDER: string; - let OBJECT: string; -} -export namespace NodeType { - let BOOLEAN: string; - let INTEGER: string; - let FLOAT: string; - let VECTOR2: string; - let VECTOR3: string; - let VECTOR4: string; - let MATRIX2: string; - let MATRIX3: string; - let MATRIX4: string; -} -export namespace NodeAccess { - let READ_ONLY: string; - let WRITE_ONLY: string; - let READ_WRITE: string; -} -export const defaultShaderStages: string[]; -export const defaultBuildStages: string[]; -export const shaderStages: string[]; -export const vectorComponents: string[]; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts deleted file mode 100644 index 243a98ae5..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/BlendModes.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Represents a "Color Burn" blend mode. - * - * It's designed to darken the base layer's colors based on the color of the blend layer. - * It significantly increases the contrast of the base layer, making the colors more vibrant and saturated. - * The darker the color in the blend layer, the stronger the darkening and contrast effect on the base layer. - * - * @tsl - * @function - * @param {Node} base - The base color. - * @param {Node} blend - The blend color. A white (#ffffff) blend color does not alter the base color. - * @return {Node} The result. - */ -export const blendBurn: any; -/** - * Represents a "Color Dodge" blend mode. - * - * It's designed to lighten the base layer's colors based on the color of the blend layer. - * It significantly increases the brightness of the base layer, making the colors lighter and more vibrant. - * The brighter the color in the blend layer, the stronger the lightening and contrast effect on the base layer. - * - * @tsl - * @function - * @param {Node} base - The base color. - * @param {Node} blend - The blend color. A black (#000000) blend color does not alter the base color. - * @return {Node} The result. - */ -export const blendDodge: any; -/** - * Represents a "Screen" blend mode. - * - * Similar to `blendDodge()`, this mode also lightens the base layer's colors based on the color of the blend layer. - * The "Screen" blend mode is better for general brightening whereas the "Dodge" results in more subtle and nuanced - * effects. - * - * @tsl - * @function - * @param {Node} base - The base color. - * @param {Node} blend - The blend color. A black (#000000) blend color does not alter the base color. - * @return {Node} The result. - */ -export const blendScreen: any; -/** - * Represents a "Overlay" blend mode. - * - * It's designed to increase the contrast of the base layer based on the color of the blend layer. - * It amplifies the existing colors and contrast in the base layer, making lighter areas lighter and darker areas darker. - * The color of the blend layer significantly influences the resulting contrast and color shift in the base layer. - * - * @tsl - * @function - * @param {Node} base - The base color. - * @param {Node} blend - The blend color - * @return {Node} The result. - */ -export const blendOverlay: any; -/** - * This function blends two color based on their alpha values by replicating the behavior of `THREE.NormalBlending`. - * It assumes both input colors have non-premultiplied alpha. - * - * @tsl - * @function - * @param {Node} base - The base color. - * @param {Node} blend - The blend color - * @return {Node} The result. - */ -export const blendColor: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts deleted file mode 100644 index be1b07013..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/BumpMapNode.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export default BumpMapNode; -/** - * TSL function for creating a bump map node. - * - * @tsl - * @function - * @param {Node} textureNode - Represents the bump map data. - * @param {?Node} [scaleNode=null] - Controls the intensity of the bump effect. - * @returns {BumpMapNode} - */ -export const bumpMap: any; -/** - * This class can be used for applying bump maps to materials. - * - * ```js - * material.normalNode = bumpMap( texture( bumpTex ) ); - * ``` - * - * @augments TempNode - */ -declare class BumpMapNode extends TempNode { - /** - * Constructs a new bump map node. - * - * @param {Node} textureNode - Represents the bump map data. - * @param {?Node} [scaleNode=null] - Controls the intensity of the bump effect. - */ - constructor(textureNode: Node, scaleNode?: Node | null); - /** - * Represents the bump map data. - * - * @type {Node} - */ - textureNode: Node; - /** - * Controls the intensity of the bump effect. - * - * @type {?Node} - * @default null - */ - scaleNode: Node | null; - setup(builder: any): any; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts deleted file mode 100644 index 37d9b6b99..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ColorAdjustment.d.ts +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Computes a grayscale value for the given RGB color value. - * - * @tsl - * @function - * @param {Node} color - The color value to compute the grayscale for. - * @return {Node} The grayscale color. - */ -export const grayscale: () => void; -/** - * Super-saturates or desaturates the given RGB color. - * - * @tsl - * @function - * @param {Node} color - The input color. - * @param {Node} [adjustment=1] - Specifies the amount of the conversion. A value under `1` desaturates the color, a value over `1` super-saturates it. - * @return {Node} The saturated color. - */ -export const saturation: () => void; -/** - * Selectively enhance the intensity of less saturated RGB colors. Can result - * in a more natural and visually appealing image with enhanced color depth - * compared to {@link ColorAdjustment#saturation}. - * - * @tsl - * @function - * @param {Node} color - The input color. - * @param {Node} [adjustment=0] - Controls the intensity of the vibrance effect. - * @return {Node} The updated color. - */ -export const vibrance: () => void; -/** - * Updates the hue component of the given RGB color while preserving its luminance and saturation. - * - * @tsl - * @function - * @param {Node} color - The input color. - * @param {Node} [adjustment=1] - Defines the degree of hue rotation in radians. A positive value rotates the hue clockwise, while a negative value rotates it counterclockwise. - * @return {Node} The updated color. - */ -export const hue: () => void; -export function luminance(color: Node, luminanceCoefficients?: Node | null): Node; -/** - * Color Decision List (CDL) v1.2 - * - * Compact representation of color grading information, defined by slope, offset, power, and - * saturation. The CDL should be typically be given input in a log space (such as LogC, ACEScc, - * or AgX Log), and will return output in the same space. Output may require clamping >=0. - * - * @tsl - * @function - * @param {Node} color Input (-Infinity < input < +Infinity) - * @param {Node} slope Slope (0 ≤ slope < +Infinity) - * @param {Node} offset Offset (-Infinity < offset < +Infinity; typically -1 < offset < 1) - * @param {Node} power Power (0 < power < +Infinity) - * @param {Node} saturation Saturation (0 ≤ saturation < +Infinity; typically 0 ≤ saturation < 4) - * @param {Node} luminanceCoefficients Luminance coefficients for saturation term, typically Rec. 709 - * @return {Node} Output, -Infinity < output < +Infinity - * - * References: - * - ASC CDL v1.2 - * - {@link https://blender.stackexchange.com/a/55239/43930} - * - {@link https://docs.acescentral.com/specifications/acescc/} - */ -export const cdl: () => void; -/** - * TSL function for creating a posterize effect which reduces the number of colors - * in an image, resulting in a more blocky and stylized appearance. - * - * @tsl - * @function - * @param {Node} sourceNode - The input color. - * @param {Node} stepsNode - Controls the intensity of the posterization effect. A lower number results in a more blocky appearance. - * @returns {Node} The posterized color. - */ -export const posterize: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts deleted file mode 100644 index 2677fb978..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceFunctions.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Converts the given color value from sRGB to linear-sRGB color space. - * - * @tsl - * @function - * @param {Node} color - The sRGB color. - * @return {Node} The linear-sRGB color. - */ -export const sRGBTransferEOTF: any; -/** - * Converts the given color value from linear-sRGB to sRGB color space. - * - * @tsl - * @function - * @param {Node} color - The linear-sRGB color. - * @return {Node} The sRGB color. - */ -export const sRGBTransferOETF: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts deleted file mode 100644 index 37eaac303..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ColorSpaceNode.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export default ColorSpaceNode; -export function workingToColorSpace(node: Node, targetColorSpace: string): ColorSpaceNode; -export function colorSpaceToWorking(node: Node, sourceColorSpace: string): ColorSpaceNode; -export function convertColorSpace(node: Node, sourceColorSpace: string, targetColorSpace: string): ColorSpaceNode; -/** - * This node represents a color space conversion. Meaning it converts - * a color value from a source to a target color space. - * - * @augments TempNode - */ -declare class ColorSpaceNode extends TempNode { - /** - * Constructs a new color space node. - * - * @param {Node} colorNode - Represents the color to convert. - * @param {string} source - The source color space. - * @param {string} target - The target color space. - */ - constructor(colorNode: Node, source: string, target: string); - /** - * Represents the color to convert. - * - * @type {Node} - */ - colorNode: Node; - /** - * The source color space. - * - * @type {string} - */ - source: string; - /** - * The target color space. - * - * @type {string} - */ - target: string; - /** - * This method resolves the constants `WORKING_COLOR_SPACE` and - * `OUTPUT_COLOR_SPACE` based on the current configuration of the - * color management and renderer. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} colorSpace - The color space to resolve. - * @return {string} The resolved color space. - */ - resolveColorSpace(builder: NodeBuilder, colorSpace: string): string; - setup(builder: any): Node; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts deleted file mode 100644 index b1d3e7e1c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/FrontFacingNode.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -export default FrontFacingNode; -/** - * TSL object that represents whether a primitive is front or back facing - * - * @tsl - * @type {FrontFacingNode} - */ -export const frontFacing: FrontFacingNode; -/** - * TSL object that represents the front facing status as a number instead of a bool. - * `1` means front facing, `-1` means back facing. - * - * @tsl - * @type {Node} - */ -export const faceDirection: Node; -/** - * Negates a vector if the rendering occurs on the back side of a face, - * based on the material's side configuration. - * - * - If the material's side is `BackSide`, the vector is inverted (negated). - * - If the material's side is `DoubleSide`, the vector is multiplied by `faceDirection` - * (negated only for back-facing fragments). - * - If the material's side is `FrontSide` (default), the vector remains unchanged. - * - * @tsl - * @function - * @param {Node} vector - The vector to process. - * @returns {Node} The processed vector. - */ -export const negateOnBackSide: () => void; -export function directionToFaceDirection(vector: Node): Node; -/** - * This node can be used to evaluate whether a primitive is front or back facing. - * - * @augments Node - */ -declare class FrontFacingNode extends Node { - /** - * Constructs a new front facing node. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isFrontFacingNode: boolean; - generate(builder: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts deleted file mode 100644 index a87be475f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/NormalMapNode.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -export default NormalMapNode; -/** - * TSL function for creating a normal map node. - * - * @tsl - * @function - * @param {Node} node - Represents the normal map data. - * @param {?Node} [scaleNode=null] - Controls the intensity of the effect. - * @returns {NormalMapNode} - */ -export const normalMap: any; -/** - * This class can be used for applying normals maps to materials. - * - * ```js - * material.normalNode = normalMap( texture( normalTex ) ); - * ``` - * - * @augments TempNode - */ -declare class NormalMapNode extends TempNode { - /** - * Constructs a new normal map node. - * - * @param {Node} node - Represents the normal map data. - * @param {?Node} [scaleNode=null] - Controls the intensity of the effect. - */ - constructor(node: Node, scaleNode?: Node | null); - /** - * Represents the normal map data. - * - * @type {Node} - */ - node: Node; - /** - * Controls the intensity of the effect. - * - * @type {?Node} - * @default null - */ - scaleNode: Node | null; - /** - * The normal map type. - * - * @type {(TangentSpaceNormalMap|ObjectSpaceNormalMap)} - * @default TangentSpaceNormalMap - */ - normalMapType: (number | number); - /** - * Controls how to unpack the sampled normal map values. - * - * @type {string} - * @default NoNormalPacking - */ - unpackNormalMode: string; - setup(builder: any): any; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts deleted file mode 100644 index 7c6731f50..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/PassNode.d.ts +++ /dev/null @@ -1,432 +0,0 @@ -export default PassNode; -export function pass(scene: Scene, camera: Camera, options: Object): PassNode; -export function passTexture(pass: PassNode, texture: Texture): PassTextureNode; -export function depthPass(scene: Scene, camera: Camera, options: Object): PassNode; -/** - * Represents a render pass (sometimes called beauty pass) in context of post processing. - * This pass produces a render for the given scene and camera and can provide multiple outputs - * via MRT for further processing. - * - * ```js - * const postProcessing = new RenderPipeline( renderer ); - * - * const scenePass = pass( scene, camera ); - * - * postProcessing.outputNode = scenePass; - * ``` - * - * @augments TempNode - */ -declare class PassNode extends TempNode { - /** - * Constructs a new pass node. - * - * @param {('color'|'depth')} scope - The scope of the pass. The scope determines whether the node outputs color or depth. - * @param {Scene} scene - A reference to the scene. - * @param {Camera} camera - A reference to the camera. - * @param {Object} options - Options for the internal render target. - */ - constructor(scope: ("color" | "depth"), scene: Scene, camera: Camera, options?: Object); - /** - * The scope of the pass. The scope determines whether the node outputs color or depth. - * - * @type {('color'|'depth')} - */ - scope: ("color" | "depth"); - /** - * A reference to the scene. - * - * @type {Scene} - */ - scene: Scene; - /** - * A reference to the camera. - * - * @type {Camera} - */ - camera: Camera; - /** - * Options for the internal render target. - * - * @type {Object} - */ - options: Object; - /** - * The pass's pixel width. Will be kept automatically kept in sync with the renderer's width. - * @private - * @type {number} - * @default 1 - */ - private _width; - /** - * The pass's pixel height. Will be kept automatically kept in sync with the renderer's height. - * @private - * @type {number} - * @default 1 - */ - private _height; - /** - * The pass's render target. - * - * @type {RenderTarget} - */ - renderTarget: RenderTarget; - /** - * An optional override material for the pass. - * - * @type {Material|null} - */ - overrideMaterial: Material | null; - /** - * Whether the pass is transparent. - * - * @type {boolean} - * @default false - */ - transparent: boolean; - /** - * Whether the pass is opaque. - * - * @type {boolean} - * @default true - */ - opaque: boolean; - lighting: any; - /** - * Whether the renderer should automatically clear before rendering the pass. - * - * @type {boolean} - * @default true - */ - autoClear: boolean; - /** - * Whether the color buffer should be cleared. - * - * @type {boolean} - * @default true - */ - autoClearColor: boolean; - /** - * Whether the depth buffer should be cleared. - * - * @type {boolean} - * @default true - */ - autoClearDepth: boolean; - /** - * Whether the stencil buffer should be cleared. - * - * @type {boolean} - * @default true - */ - autoClearStencil: boolean; - /** - * An optional global context for the pass. - * - * @type {ContextNode|null} - */ - contextNode: ContextNode | null; - /** - * A cache for the context node. - * - * @private - * @type {?Object} - * @default null - */ - private _contextNodeCache; - /** - * A dictionary holding the internal result textures. - * - * @private - * @type {{ output: Texture, depth: ?DepthTexture }} - */ - private _textures; - /** - * A dictionary holding the internal texture nodes. - * - * @private - * @type {Object} - */ - private _textureNodes; - /** - * A dictionary holding the internal depth nodes. - * - * @private - * @type {Object} - */ - private _linearDepthNodes; - /** - * A dictionary holding the internal viewZ nodes. - * - * @private - * @type {Object} - */ - private _viewZNodes; - /** - * A dictionary holding the texture data of the previous frame. - * Used for computing velocity/motion vectors. - * - * @private - * @type {Object} - */ - private _previousTextures; - /** - * A dictionary holding the texture nodes of the previous frame. - * Used for computing velocity/motion vectors. - * - * @private - * @type {Object} - */ - private _previousTextureNodes; - /** - * The `near` property of the camera as a uniform. - * - * @private - * @type {UniformNode} - */ - private _cameraNear; - /** - * The `far` property of the camera as a uniform. - * - * @private - * @type {UniformNode} - */ - private _cameraFar; - /** - * A MRT node configuring the MRT settings. - * - * @private - * @type {?MRTNode} - * @default null - */ - private _mrt; - /** - * Layer object for configuring the camera that is used - * to produce the pass. - * - * @private - * @type {?Layers} - * @default null - */ - private _layers; - /** - * Scales the resolution of the internal render target. - * - * @private - * @type {number} - * @default 1 - */ - private _resolutionScale; - /** - * Custom viewport definition. - * - * @private - * @type {?Vector4} - * @default null - */ - private _viewport; - /** - * Custom scissor definition. - * - * @private - * @type {?Vector4} - * @default null - */ - private _scissor; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPassNode: boolean; - /** - * Sets the resolution scale for the pass. - * The resolution scale is a factor that is multiplied with the renderer's width and height. - * - * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. - * @return {PassNode} A reference to this pass. - */ - setResolutionScale(resolutionScale: number): PassNode; - /** - * Gets the current resolution scale of the pass. - * - * @return {number} The current resolution scale. A value of `1` means full resolution. - */ - getResolutionScale(): number; - /** - * Sets the resolution for the pass. - * The resolution is a factor that is multiplied with the renderer's width and height. - * - * @param {number} resolution - The resolution to set. A value of `1` means full resolution. - * @return {PassNode} A reference to this pass. - * @deprecated since r181. Use {@link PassNode#setResolutionScale `setResolutionScale()`} instead. - */ - setResolution(resolution: number): PassNode; - /** - * Gets the current resolution of the pass. - * - * @return {number} The current resolution. A value of `1` means full resolution. - * @deprecated since r181. Use {@link PassNode#getResolutionScale `getResolutionScale()`} instead. - */ - getResolution(): number; - /** - * Sets the layer configuration that should be used when rendering the pass. - * - * @param {Layers} layers - The layers object to set. - * @return {PassNode} A reference to this pass. - */ - setLayers(layers: Layers): PassNode; - /** - * Gets the current layer configuration of the pass. - * - * @return {?Layers} . - */ - getLayers(): Layers | null; - /** - * Sets the given MRT node to setup MRT for this pass. - * - * @param {MRTNode} mrt - The MRT object. - * @return {PassNode} A reference to this pass. - */ - setMRT(mrt: MRTNode): PassNode; - /** - * Returns the current MRT node. - * - * @return {MRTNode} The current MRT node. - */ - getMRT(): MRTNode; - /** - * Returns the texture for the given output name. - * - * @param {string} name - The output name to get the texture for. - * @return {Texture} The texture. - */ - getTexture(name: string): Texture; - /** - * Returns the texture holding the data of the previous frame for the given output name. - * - * @param {string} name - The output name to get the texture for. - * @return {Texture} The texture holding the data of the previous frame. - */ - getPreviousTexture(name: string): Texture; - /** - * Switches current and previous textures for the given output name. - * - * @param {string} name - The output name. - */ - toggleTexture(name: string): void; - /** - * Returns the texture node for the given output name. - * - * @param {string} [name='output'] - The output name to get the texture node for. - * @return {TextureNode} The texture node. - */ - getTextureNode(name?: string): TextureNode; - /** - * Returns the previous texture node for the given output name. - * - * @param {string} [name='output'] - The output name to get the previous texture node for. - * @return {TextureNode} The previous texture node. - */ - getPreviousTextureNode(name?: string): TextureNode; - /** - * Returns a viewZ node of this pass. - * - * @param {string} [name='depth'] - The output name to get the viewZ node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. - * @return {Node} The viewZ node. - */ - getViewZNode(name?: string): Node; - /** - * Returns a linear depth node of this pass. - * - * @param {string} [name='depth'] - The output name to get the linear depth node for. In most cases the default `'depth'` can be used however the parameter exists for custom depth outputs. - * @return {Node} The linear depth node. - */ - getLinearDepthNode(name?: string): Node; - /** - * Precompiles the pass. - * - * Note that this method must be called after the pass configuration is complete. - * So calls like `setMRT()` and `getTextureNode()` must proceed the precompilation. - * - * @async - * @param {Renderer} renderer - The renderer. - * @return {Promise} A Promise that resolves when the compile has been finished. - * @see {@link Renderer#compileAsync} - */ - compileAsync(renderer: Renderer): Promise; - setup({ renderer }: { - renderer: any; - }): Node | TextureNode; - updateBefore(frame: any): void; - /** - * Sets the size of the pass's render target. Honors the pixel ratio. - * - * @param {number} width - The width to set. - * @param {number} height - The height to set. - */ - setSize(width: number, height: number): void; - /** - * This method allows to define the pass's scissor rectangle. By default, the scissor rectangle is kept - * in sync with the pass's dimensions. To reverse the process and use auto-sizing again, call the method - * with `null` as the single argument. - * - * @param {?(number | Vector4)} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. - * Instead of passing four arguments, the method also works with a single four-dimensional vector. - * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. - * @param {number} width - The width of the scissor box in logical pixel unit. - * @param {number} height - The height of the scissor box in logical pixel unit. - */ - setScissor(x: (number | Vector4) | null, y: number, width: number, height: number): void; - /** - * This method allows to define the pass's viewport. By default, the viewport is kept in sync - * with the pass's dimensions. To reverse the process and use auto-sizing again, call the method - * with `null` as the single argument. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - */ - setViewport(x: number | Vector4, y: number, width: number, height: number): void; -} -declare namespace PassNode { - let COLOR: "color"; - let DEPTH: "depth"; -} -/** - * Represents the texture of a pass node. - * - * @augments TextureNode - */ -declare class PassTextureNode extends TextureNode { - /** - * Constructs a new pass texture node. - * - * @param {PassNode} passNode - The pass node. - * @param {Texture} texture - The output texture. - */ - constructor(passNode: PassNode, texture: Texture); - /** - * A reference to the pass node. - * - * @type {PassNode} - */ - passNode: PassNode; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @default true - * @readonly - */ - readonly isPassTextureNode: boolean; - setup(builder: any): void; - clone(): any; -} -import TempNode from '../core/TempNode.js'; -import { RenderTarget } from '../../core/RenderTarget.js'; -import { default as TextureNode } from '../accessors/TextureNode.js'; -import { Vector4 } from '../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts deleted file mode 100644 index bcf1b8bef..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/PremultiplyAlphaFunctions.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Premultiplies the RGB channels of a color by its alpha channel. - * - * This function is useful for converting a non-premultiplied alpha color - * into a premultiplied alpha format, where the RGB values are scaled - * by the alpha value. Premultiplied alpha is often used in graphics - * rendering for certain operations, such as compositing and image processing. - * - * @tsl - * @function - * @param {Node} color - The input color with non-premultiplied alpha. - * @return {Node} The color with premultiplied alpha. - */ -export const premultiplyAlpha: () => void; -/** - * Unpremultiplies the RGB channels of a color by its alpha channel. - * - * This function is useful for converting a premultiplied alpha color - * back into a non-premultiplied alpha format, where the RGB values are - * divided by the alpha value. Unpremultiplied alpha is often used in graphics - * rendering for certain operations, such as compositing and image processing. - * - * @tsl - * @function - * @param {Node} color - The input color with premultiplied alpha. - * @return {Node} The color with non-premultiplied alpha. - */ -export const unpremultiplyAlpha: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts deleted file mode 100644 index d469787e9..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/RenderOutputNode.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -export default RenderOutputNode; -export function renderOutput(color: Node, toneMapping?: number | null, outputColorSpace?: string | null): RenderOutputNode; -/** - * Normally, tone mapping and color conversion happens automatically just - * before outputting a pixel to the default (screen) framebuffer. In certain - * post processing setups this is too late because some effects such as FXAA - * require e.g. sRGB input. For such scenarios, `RenderOutputNode` can be used - * to apply tone mapping and color space conversion at an arbitrary point - * in the effect chain. - * - * When applying tone mapping and color space conversion manually with this node, - * you have to set {@link RenderPipeline#outputColorTransform} to `false`. - * - * ```js - * const postProcessing = new RenderPipeline( renderer ); - * postProcessing.outputColorTransform = false; - * - * const scenePass = pass( scene, camera ); - * const outputPass = renderOutput( scenePass ); - * - * postProcessing.outputNode = outputPass; - * ``` - * - * @augments TempNode - */ -declare class RenderOutputNode extends TempNode { - /** - * Constructs a new render output node. - * - * @param {Node} colorNode - The color node to process. - * @param {?number} toneMapping - The tone mapping type. - * @param {?string} outputColorSpace - The output color space. - */ - constructor(colorNode: Node, toneMapping: number | null, outputColorSpace: string | null); - /** - * The color node to process. - * - * @type {Node} - */ - colorNode: Node; - /** - * The tone mapping type. - * - * @private - * @type {?number} - */ - private _toneMapping; - /** - * The output color space. - * - * @type {?string} - */ - outputColorSpace: string | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderOutputNode: boolean; - /** - * Sets the tone mapping type. - * - * @param {number} value - The tone mapping type. - * @return {ToneMappingNode} A reference to this node. - */ - setToneMapping(value: number): ToneMappingNode; - /** - * Gets the tone mapping type. - * - * @returns {number} The tone mapping type. - */ - getToneMapping(): number; - setup({ context }: { - context: any; - }): Node; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts deleted file mode 100644 index a9226363d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ScreenNode.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -export default ScreenNode; -/** - * TSL object that represents the current DPR. - * - * @tsl - * @type {UniformNode} - */ -export const screenDPR: UniformNode; -/** - * TSL object that represents normalized screen coordinates, unitless in `[0, 1]`. - * - * @tsl - * @type {ScreenNode} - */ -export const screenUV: ScreenNode; -/** - * TSL object that represents the screen resolution in physical pixel units. - * - * @tsl - * @type {ScreenNode} - */ -export const screenSize: ScreenNode; -/** - * TSL object that represents the current `x`/`y` pixel position on the screen in physical pixel units. - * - * @tsl - * @type {ScreenNode} - */ -export const screenCoordinate: ScreenNode; -/** - * TSL object that represents the viewport rectangle as `x`, `y`, `width` and `height` in physical pixel units. - * - * @tsl - * @type {ScreenNode} - */ -export const viewport: ScreenNode; -/** - * TSL object that represents the viewport resolution in physical pixel units. - * - * @tsl - * @type {ScreenNode} - */ -export const viewportSize: ScreenNode; -/** - * TSL object that represents the current `x`/`y` pixel position on the viewport in physical pixel units. - * - * @tsl - * @type {ScreenNode} - */ -export const viewportCoordinate: ScreenNode; -/** - * TSL object that represents normalized viewport coordinates, unitless in `[0, 1]`. - * - * @tsl - * @type {ScreenNode} - */ -export const viewportUV: ScreenNode; -/** - * This node provides a collection of screen related metrics. - * Depending on {@link ScreenNode#scope}, the nodes can represent - * resolution or viewport data as well as fragment or uv coordinates. - * - * @augments Node - */ -declare class ScreenNode extends Node { - /** - * Constructs a new screen node. - * - * @param {('coordinate'|'viewport'|'size'|'uv')} scope - The node's scope. - */ - constructor(scope: ("coordinate" | "viewport" | "size" | "uv")); - /** - * The node represents different metric depending on which scope is selected. - * - * - `ScreenNode.COORDINATE`: Window-relative coordinates of the current fragment according to WebGPU standards. - * - `ScreenNode.VIEWPORT`: The current viewport defined as a four-dimensional vector. - * - `ScreenNode.SIZE`: The dimensions of the current bound framebuffer. - * - `ScreenNode.UV`: Normalized coordinates. - * - * @type {('coordinate'|'viewport'|'size'|'uv')} - */ - scope: ("coordinate" | "viewport" | "size" | "uv"); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isViewportNode: boolean; - /** - * This method is overwritten since the node type depends on the selected scope. - * - * @return {('vec2'|'vec4')} The node type. - */ - generateNodeType(): ("vec2" | "vec4"); - /** - * `ScreenNode` implements {@link Node#update} to retrieve viewport and size information - * from the current renderer. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update({ renderer }: NodeFrame): void; - setup(): any; - generate(builder: any): any; -} -declare namespace ScreenNode { - let COORDINATE: string; - let VIEWPORT: string; - let SIZE: string; - let UV: string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts deleted file mode 100644 index 2d04148f4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingFunctions.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Linear tone mapping, exposure only. - * - * @tsl - * @function - * @param {Node} color - The color that should be tone mapped. - * @param {Node} exposure - The exposure. - * @return {Node} The tone mapped color. - */ -export const linearToneMapping: any; -/** - * Reinhard tone mapping. - * - * Reference: {@link https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf} - * - * @tsl - * @function - * @param {Node} color - The color that should be tone mapped. - * @param {Node} exposure - The exposure. - * @return {Node} The tone mapped color. - */ -export const reinhardToneMapping: any; -/** - * Cineon tone mapping. - * - * Reference: {@link http://filmicworlds.com/blog/filmic-tonemapping-operators/} - * - * @tsl - * @function - * @param {Node} color - The color that should be tone mapped. - * @param {Node} exposure - The exposure. - * @return {Node} The tone mapped color. - */ -export const cineonToneMapping: any; -/** - * ACESFilmic tone mapping. - * - * Reference: {@link https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs} - * - * @tsl - * @function - * @param {Node} color - The color that should be tone mapped. - * @param {Node} exposure - The exposure. - * @return {Node} The tone mapped color. - */ -export const acesFilmicToneMapping: any; -/** - * AgX tone mapping. - * - * @tsl - * @function - * @param {Node} color - The color that should be tone mapped. - * @param {Node} exposure - The exposure. - * @return {Node} The tone mapped color. - */ -export const agxToneMapping: any; -/** - * Neutral tone mapping. - * - * Reference: {@link https://modelviewer.dev/examples/tone-mapping} - * - * @tsl - * @function - * @param {Node} color - The color that should be tone mapped. - * @param {Node} exposure - The exposure. - * @return {Node} The tone mapped color. - */ -export const neutralToneMapping: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts deleted file mode 100644 index 7e8ca1871..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ToneMappingNode.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -export default ToneMappingNode; -export function toneMapping(mapping: number, exposure: Node | number, color: Node | Color): ToneMappingNode; -/** - * TSL object that represents the global tone mapping exposure of the renderer. - * - * @tsl - * @type {RendererReferenceNode} - */ -export const toneMappingExposure: RendererReferenceNode; -/** - * This node represents a tone mapping operation. - * - * @augments TempNode - */ -declare class ToneMappingNode extends TempNode { - /** - * Constructs a new tone mapping node. - * - * @param {number} toneMapping - The tone mapping type. - * @param {Node} exposureNode - The tone mapping exposure. - * @param {Node} [colorNode=null] - The color node to process. - */ - constructor(toneMapping: number, exposureNode?: Node, colorNode?: Node); - /** - * The tone mapping type. - * - * @private - * @type {number} - */ - private _toneMapping; - /** - * The tone mapping exposure. - * - * @type {Node} - * @default null - */ - exposureNode: Node; - /** - * Represents the color to process. - * - * @type {?Node} - * @default null - */ - colorNode: Node | null; - /** - * Sets the tone mapping type. - * - * @param {number} value - The tone mapping type. - * @return {ToneMappingNode} A reference to this node. - */ - setToneMapping(value: number): ToneMappingNode; - /** - * Gets the tone mapping type. - * - * @returns {number} The tone mapping type. - */ - getToneMapping(): number; - setup(builder: any): any; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts deleted file mode 100644 index cb934f4cb..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ToonOutlinePassNode.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -export default ToonOutlinePassNode; -export function toonOutlinePass(scene: Scene, camera: Camera, color?: Color, thickness?: number, alpha?: number): ToonOutlinePassNode; -/** - * Represents a render pass for producing a toon outline effect on compatible objects. - * Only 3D objects with materials of type `MeshToonMaterial` and `MeshToonNodeMaterial` - * will receive the outline. - * - * ```js - * const postProcessing = new RenderPipeline( renderer ); - * - * const scenePass = toonOutlinePass( scene, camera ); - * - * postProcessing.outputNode = scenePass; - * ``` - * @augments PassNode - */ -declare class ToonOutlinePassNode extends PassNode { - /** - * Constructs a new outline pass node. - * - * @param {Scene} scene - A reference to the scene. - * @param {Camera} camera - A reference to the camera. - * @param {Node} colorNode - Defines the outline's color. - * @param {Node} thicknessNode - Defines the outline's thickness. - * @param {Node} alphaNode - Defines the outline's alpha. - */ - constructor(scene: Scene, camera: Camera, colorNode: Node, thicknessNode: Node, alphaNode: Node); - /** - * Defines the outline's color. - * - * @type {Node} - */ - colorNode: Node; - /** - * Defines the outline's thickness. - * - * @type {Node} - */ - thicknessNode: Node; - /** - * Defines the outline's alpha. - * - * @type {Node} - */ - alphaNode: Node; - /** - * An internal material cache. - * - * @private - * @type {WeakMap} - */ - private _materialCache; - /** - * Creates the material used for outline rendering. - * - * @private - * @return {NodeMaterial} The outline material. - */ - private _createMaterial; - /** - * For the given toon material, this method returns a corresponding - * outline material. - * - * @private - * @param {(MeshToonMaterial|MeshToonNodeMaterial)} originalMaterial - The toon material. - * @return {NodeMaterial} The outline material. - */ - private _getOutlineMaterial; -} -import { Color } from '../../math/Color.js'; -import PassNode from './PassNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts deleted file mode 100644 index 6b0693f40..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthNode.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -export default ViewportDepthNode; -export function viewZToOrthographicDepth(viewZ: Node, near: Node, far: Node): Node; -export function viewZToReversedOrthographicDepth(viewZ: Node, near: Node, far: Node): Node; -/** - * TSL function for converting an orthographic depth value to a viewZ value. - * - * @tsl - * @function - * @param {Node} depth - The orthographic depth. - * @param {Node} near - The camera's near value. - * @param {Node} far - The camera's far value. - * @returns {Node} - */ -export const orthographicDepthToViewZ: () => void; -export function viewZToPerspectiveDepth(viewZ: Node, near: Node, far: Node): Node; -export function viewZToReversedPerspectiveDepth(viewZ: Node, near: Node, far: Node): Node; -/** - * TSL function for converting a perspective depth value to a viewZ value. - * - * @tsl - * @function - * @param {Node} depth - The perspective depth. - * @param {Node} near - The camera's near value. - * @param {Node} far - The camera's far value. - * @returns {Node} - */ -export const perspectiveDepthToViewZ: () => void; -export function viewZToLogarithmicDepth(viewZ: Node, near: Node, far: Node): Node; -export function logarithmicDepthToViewZ(depth: Node, near: Node, far: Node): Node; -/** - * TSL object that represents the depth value for the current fragment. - * - * @tsl - * @type {ViewportDepthNode} - */ -export const depth: ViewportDepthNode; -/** - * TSL function for converting a perspective depth value to linear depth. - * - * @tsl - * @function - * @param {?Node} [value=null] - The perspective depth. If `null` is provided, the current fragment's depth is used. - * @returns {ViewportDepthNode} - */ -export const linearDepth: any; -/** - * TSL object that represents the linear (orthographic) depth value of the current fragment - * - * @tsl - * @type {ViewportDepthNode} - */ -export const viewportLinearDepth: ViewportDepthNode; -/** - * This node offers a collection of features in context of the depth logic in the fragment shader. - * Depending on {@link ViewportDepthNode#scope}, it can be used to define a depth value for the current - * fragment or for depth evaluation purposes. - * - * @augments Node - */ -declare class ViewportDepthNode extends Node { - /** - * Constructs a new viewport depth node. - * - * @param {('depth'|'depthBase'|'linearDepth')} scope - The node's scope. - * @param {?Node} [valueNode=null] - The value node. - */ - constructor(scope: ("depth" | "depthBase" | "linearDepth"), valueNode?: Node | null); - /** - * The node behaves differently depending on which scope is selected. - * - * - `ViewportDepthNode.DEPTH_BASE`: Allows to define a value for the current fragment's depth. - * - `ViewportDepthNode.DEPTH`: Represents the depth value for the current fragment (`valueNode` is ignored). - * - `ViewportDepthNode.LINEAR_DEPTH`: Represents the linear (orthographic) depth value of the current fragment. - * If a `valueNode` is set, the scope can be used to convert perspective depth data to linear data. - * - * @type {('depth'|'depthBase'|'linearDepth')} - */ - scope: ("depth" | "depthBase" | "linearDepth"); - /** - * Can be used to define a custom depth value. - * The property is ignored in the `ViewportDepthNode.DEPTH` scope. - * - * @type {?Node} - * @default null - */ - valueNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isViewportDepthNode: boolean; - generate(builder: any): any; - setup({ camera }: { - camera: any; - }): any; -} -declare namespace ViewportDepthNode { - let DEPTH_BASE: string; - let DEPTH: string; - let LINEAR_DEPTH: string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts deleted file mode 100644 index c70252a7e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ViewportDepthTextureNode.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default ViewportDepthTextureNode; -/** - * TSL function for a viewport depth texture node. - * - * @tsl - * @function - * @param {?Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, a depth texture is created automatically. - * @returns {ViewportDepthTextureNode} - */ -export const viewportDepthTexture: any; -/** - * Represents the depth of the current viewport as a texture. This module - * can be used in combination with viewport texture to achieve effects - * that require depth evaluation. - * - * @augments ViewportTextureNode - */ -declare class ViewportDepthTextureNode extends ViewportTextureNode { - /** - * Constructs a new viewport depth texture node. - * - * @param {Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?DepthTexture} [depthTexture=null] - A depth texture. If not provided, uses a shared depth texture. - */ - constructor(uvNode?: Node, levelNode?: Node | null, depthTexture?: DepthTexture | null); -} -import ViewportTextureNode from './ViewportTextureNode.js'; -import { DepthTexture } from '../../textures/DepthTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts deleted file mode 100644 index 46859c337..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ViewportSharedTextureNode.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -export default ViewportSharedTextureNode; -/** - * TSL function for creating a shared viewport texture node. - * - * @tsl - * @function - * @param {?Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @returns {ViewportSharedTextureNode} - */ -export const viewportSharedTexture: any; -/** - * `ViewportTextureNode` creates an internal texture for each node instance. This module - * shares a texture across all instances of `ViewportSharedTextureNode`. It should - * be the first choice when using data of the default/screen framebuffer for performance reasons. - * - * @augments ViewportTextureNode - */ -declare class ViewportSharedTextureNode extends ViewportTextureNode { - /** - * Constructs a new viewport shared texture node. - * - * @param {Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - */ - constructor(uvNode?: Node, levelNode?: Node | null); - /** - * Overwritten so the method always returns the unique shared - * framebuffer texture. - * - * @return {FramebufferTexture} The shared framebuffer texture. - */ - getTextureForReference(): FramebufferTexture; - updateReference(): this; -} -import ViewportTextureNode from './ViewportTextureNode.js'; -import { FramebufferTexture } from '../../textures/FramebufferTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts deleted file mode 100644 index e679f9d6a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/display/ViewportTextureNode.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -export default ViewportTextureNode; -/** - * TSL function for creating a viewport texture node. - * - * @tsl - * @function - * @param {?Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. - * @returns {ViewportTextureNode} - */ -export const viewportTexture: any; -/** - * TSL function for creating a viewport texture node with enabled mipmap generation. - * - * @tsl - * @function - * @param {?Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. - * @returns {ViewportTextureNode} - */ -export const viewportMipTexture: any; -export function viewportOpaqueMipTexture(uv?: Node | null, level?: Node | null): ViewportTextureNode; -/** - * A special type of texture node which represents the data of the current viewport - * as a texture. The module extracts data from the current bound framebuffer with - * a copy operation so no extra render pass is required to produce the texture data - * (which is good for performance). `ViewportTextureNode` can be used as an input for a - * variety of effects like refractive or transmissive materials. - * - * @augments TextureNode - */ -declare class ViewportTextureNode extends TextureNode { - /** - * Constructs a new viewport texture node. - * - * @param {Node} [uvNode=screenUV] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @param {?Texture} [framebufferTexture=null] - A framebuffer texture holding the viewport data. If not provided, a framebuffer texture is created automatically. - */ - constructor(uvNode?: Node, levelNode?: Node | null, framebufferTexture?: Texture | null); - /** - * Whether to generate mipmaps or not. - * - * @type {boolean} - * @default false - */ - generateMipmaps: boolean; - /** - * The reference framebuffer texture. This is used to store the framebuffer texture - * for the current render target. If the render target changes, a new framebuffer texture - * is created automatically. - * - * @type {FramebufferTexture} - * @default null - */ - defaultFramebuffer: FramebufferTexture; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOutputTextureNode: boolean; - /** - * The framebuffer texture for the current renderer context. - * - * @type {WeakMap} - * @private - */ - private _cacheTextures; - /** - * This methods returns a texture for the given render target or canvas target reference. - * - * To avoid rendering errors, `ViewportTextureNode` must use unique framebuffer textures - * for different render contexts. - * - * @param {?(RenderTarget|CanvasTarget)} [reference=null] - The render target or canvas target reference. - * @return {Texture} The framebuffer texture. - */ - getTextureForReference(reference?: (RenderTarget | CanvasTarget) | null): Texture; - updateReference(frame: any): import("../../Three.Core.js").Texture; - updateBefore(frame: any): void; - clone(): any; -} -import TextureNode from '../accessors/TextureNode.js'; -import { FramebufferTexture } from '../../textures/FramebufferTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts b/jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts deleted file mode 100644 index 34f7636b6..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/fog/Fog.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Constructs a new range factor node. - * - * @tsl - * @function - * @param {Node} near - Defines the near value. - * @param {Node} far - Defines the far value. - */ -export const rangeFogFactor: () => void; -/** - * Represents an exponential squared fog. This type of fog gives - * a clear view near the camera and a faster than exponentially - * densening fog farther from the camera. - * - * @tsl - * @function - * @param {Node} density - Defines the fog density. - */ -export const densityFogFactor: () => void; -/** - * Constructs a new height fog factor node. This fog factor requires a Y-up coordinate system. - * - * @tsl - * @function - * @param {Node} density - Defines the fog density. - * @param {Node} height - The height threshold in world space. Everything below this y-coordinate is affected by fog. - */ -export const exponentialHeightFogFactor: () => void; -/** - * This class can be used to configure a fog for the scene. - * Nodes of this type are assigned to `Scene.fogNode`. - * - * @tsl - * @function - * @param {Node} color - Defines the color of the fog. - * @param {Node} factor - Defines how the fog is factored in the scene. - */ -export const fog: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts deleted file mode 100644 index c47f5559a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_GGX.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default BRDF_GGX; -declare const BRDF_GGX: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts deleted file mode 100644 index 71b76485d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Lambert.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default BRDF_Lambert; -declare const BRDF_Lambert: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts deleted file mode 100644 index eb31b60ad..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/BRDF_Sheen.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default BRDF_Sheen; -declare const BRDF_Sheen: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts deleted file mode 100644 index 5a20667ef..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/DFGLUT.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default DFGLUT; -declare const DFGLUT: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts deleted file mode 100644 index ee1081261..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default D_GGX; -declare const D_GGX: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts deleted file mode 100644 index 788dd6c3b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/D_GGX_Anisotropic.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default D_GGX_Anisotropic; -declare const D_GGX_Anisotropic: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts deleted file mode 100644 index ebc316a79..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/EnvironmentBRDF.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default EnvironmentBRDF; -declare const EnvironmentBRDF: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts deleted file mode 100644 index a1d2caea7..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/F_Schlick.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default F_Schlick; -declare const F_Schlick: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts deleted file mode 100644 index 3f41af9a6..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/LTC.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const LTC_Evaluate: any; -export const LTC_Evaluate_Volume: any; -export const LTC_Uv: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts deleted file mode 100644 index 316542c93..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/Schlick_to_F0.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default Schlick_to_F0; -declare const Schlick_to_F0: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts deleted file mode 100644 index aeaeb6109..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default V_GGX_SmithCorrelated; -declare const V_GGX_SmithCorrelated: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts deleted file mode 100644 index 7c2c87243..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BSDF/V_GGX_SmithCorrelated_Anisotropic.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default V_GGX_SmithCorrelated_Anisotropic; -declare const V_GGX_SmithCorrelated_Anisotropic: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts deleted file mode 100644 index 3db9024d7..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/BasicLightingModel.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export default BasicLightingModel; -/** - * Represents the lighting model for unlit materials. The only light contribution - * is baked indirect lighting modulated with ambient occlusion and the material's - * diffuse color. Environment mapping is supported. Used in {@link MeshBasicNodeMaterial}. - * - * @augments LightingModel - */ -declare class BasicLightingModel extends LightingModel { - /** - * Implements the baked indirect lighting with its modulation. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirect({ context }: NodeBuilder): void; - /** - * Implements the environment mapping. - * - * @param {NodeBuilder} builder - The current node builder. - */ - finish(builder: NodeBuilder): void; -} -import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts deleted file mode 100644 index 8e2c536a1..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/PhongLightingModel.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default PhongLightingModel; -/** - * Represents the lighting model for a phong material. Used in {@link MeshPhongNodeMaterial}. - * - * @augments BasicLightingModel - */ -declare class PhongLightingModel extends BasicLightingModel { - /** - * Constructs a new phong lighting model. - * - * @param {boolean} [specular=true] - Whether specular is supported or not. - */ - constructor(specular?: boolean); - /** - * Whether specular is supported or not. Set this to `false` if you are - * looking for a Lambert-like material meaning a material for non-shiny - * surfaces, without specular highlights. - * - * @type {boolean} - * @default true - */ - specular: boolean; - /** - * Implements the direct lighting. The specular portion is optional and can be controlled - * with the {@link PhongLightingModel#specular} flag. - * - * @param {Object} lightData - The light data. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object): void; -} -import BasicLightingModel from './BasicLightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts deleted file mode 100644 index 2b22eba0d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/PhysicalLightingModel.d.ts +++ /dev/null @@ -1,186 +0,0 @@ -export default PhysicalLightingModel; -/** - * Represents the lighting model for a PBR material. - * - * @augments LightingModel - */ -declare class PhysicalLightingModel extends LightingModel { - /** - * Constructs a new physical lighting model. - * - * @param {boolean} [clearcoat=false] - Whether clearcoat is supported or not. - * @param {boolean} [sheen=false] - Whether sheen is supported or not. - * @param {boolean} [iridescence=false] - Whether iridescence is supported or not. - * @param {boolean} [anisotropy=false] - Whether anisotropy is supported or not. - * @param {boolean} [transmission=false] - Whether transmission is supported or not. - * @param {boolean} [dispersion=false] - Whether dispersion is supported or not. - * @param {boolean} [retroreflection=false] - Whether retroreflection is supported or not. - */ - constructor(clearcoat?: boolean, sheen?: boolean, iridescence?: boolean, anisotropy?: boolean, transmission?: boolean, dispersion?: boolean, retroreflection?: boolean); - /** - * Whether clearcoat is supported or not. - * - * @type {boolean} - * @default false - */ - clearcoat: boolean; - /** - * Whether sheen is supported or not. - * - * @type {boolean} - * @default false - */ - sheen: boolean; - /** - * Whether iridescence is supported or not. - * - * @type {boolean} - * @default false - */ - iridescence: boolean; - /** - * Whether anisotropy is supported or not. - * - * @type {boolean} - * @default false - */ - anisotropy: boolean; - /** - * Whether transmission is supported or not. - * - * @type {boolean} - * @default false - */ - transmission: boolean; - /** - * Whether dispersion is supported or not. - * - * @type {boolean} - * @default false - */ - dispersion: boolean; - /** - * Whether retroreflection is supported or not. - * - * @type {boolean} - * @default false - */ - retroreflection: boolean; - /** - * The clear coat radiance. - * - * @type {?Node} - * @default null - */ - clearcoatRadiance: Node | null; - /** - * The clear coat specular direct. - * - * @type {?Node} - * @default null - */ - clearcoatSpecularDirect: Node | null; - /** - * The clear coat specular indirect. - * - * @type {?Node} - * @default null - */ - clearcoatSpecularIndirect: Node | null; - /** - * The sheen specular direct. - * - * @type {?Node} - * @default null - */ - sheenSpecularDirect: Node | null; - /** - * The sheen specular indirect. - * - * @type {?Node} - * @default null - */ - sheenSpecularIndirect: Node | null; - /** - * The iridescence Fresnel. - * - * @type {?Node} - * @default null - */ - iridescenceFresnel: Node | null; - /** - * The iridescence F0 dielectric. - * - * @type {?Node} - * @default null - */ - iridescenceF0Dielectric: Node | null; - /** - * The iridescence F0 metallic. - * - * @type {?Node} - * @default null - */ - iridescenceF0Metallic: Node | null; - /** - * The sampled DFG LUT value, shared by the direct and indirect lighting paths. - * - * @type {?Node} - * @default null - */ - dfg: Node | null; - /** - * The multi-scattering energy compensation for direct lighting. - * - * @type {?Node} - * @default null - */ - multiScatteringCompensation: Node | null; - computeMultiscattering(singleScatter: any, multiScatter: any, specularF90: any, f0: any, iridescenceF0?: null): void; - /** - * Implements the direct light. - * - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object): void; - /** - * This method is intended for implementing the direct light term for - * rect area light nodes. - * - * @param {Object} input - The input data. - * @param {NodeBuilder} builder - The current node builder. - */ - directRectArea({ lightColor, lightPosition, halfWidth, halfHeight, reflectedLight, ltc_1, ltc_2 }: Object): void; - /** - * Implements the indirect lighting. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirect(builder: NodeBuilder): void; - /** - * Implements the indirect diffuse term. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirectDiffuse(builder: NodeBuilder): void; - /** - * Implements the indirect specular term. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirectSpecular(builder: NodeBuilder): void; - /** - * Implements the ambient occlusion term. - * - * @param {NodeBuilder} builder - The current node builder. - */ - ambientOcclusion(builder: NodeBuilder): void; - /** - * Used for final lighting accumulations depending on the requested features. - * - * @param {NodeBuilder} builder - The current node builder. - */ - finish({ context }: NodeBuilder): void; -} -import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts deleted file mode 100644 index 84e3d6ecf..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/ShadowMaskModel.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -export default ShadowMaskModel; -/** - * Represents lighting model for a shadow material. Used in {@link ShadowNodeMaterial}. - * - * @augments LightingModel - */ -declare class ShadowMaskModel extends LightingModel { - /** - * The shadow mask node. - * - * @type {Node} - */ - shadowNode: Node; - /** - * Only used to save the shadow mask. - * - * @param {Object} input - The input data. - */ - direct({ lightNode }: Object): void; - /** - * Uses the shadow mask to produce the final color. - * - * @param {NodeBuilder} builder - The current node builder. - */ - finish({ context }: NodeBuilder): void; -} -import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts deleted file mode 100644 index 420e9ee87..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/ToonLightingModel.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -export default ToonLightingModel; -/** - * Represents the lighting model for a toon material. Used in {@link MeshToonNodeMaterial}. - * - * @augments LightingModel - */ -declare class ToonLightingModel extends LightingModel { - /** - * Implements the direct lighting. Instead of using a conventional smooth irradiance, the irradiance is - * reduced to a small number of discrete shades to create a comic-like, flat look. - * - * @param {Object} lightData - The light data. - * @param {NodeBuilder} builder - The current node builder. - */ - direct({ lightDirection, lightColor, reflectedLight }: Object, builder: NodeBuilder): void; - /** - * Implements the indirect lighting. - * - * @param {NodeBuilder} builder - The current node builder. - */ - indirect(builder: NodeBuilder): void; -} -import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts deleted file mode 100644 index 1cf33cba5..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/VolumetricLightingModel.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default VolumetricLightingModel; -/** - * VolumetricLightingModel class extends the LightingModel to implement volumetric lighting effects. - * This model calculates the scattering and transmittance of light through a volumetric medium. - * It dynamically adjusts the direction of the ray based on the camera and object positions. - * The model supports custom scattering and depth nodes to enhance the lighting effects. - * - * @augments LightingModel - */ -declare class VolumetricLightingModel extends LightingModel { - start(builder: any): void; - scatteringLight(lightColor: any, builder: any): void; - direct({ lightNode, lightColor }: { - lightNode: any; - lightColor: any; - }, builder: any): void; - directRectArea({ lightColor, lightPosition, halfWidth, halfHeight }: { - lightColor: any; - lightPosition: any; - halfWidth: any; - halfHeight: any; - }, builder: any): void; - finish(builder: any): void; -} -import LightingModel from '../core/LightingModel.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts deleted file mode 100644 index 30b15c98e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/material/getAlphaHashThreshold.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default getAlphaHashThreshold; -declare const getAlphaHashThreshold: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts deleted file mode 100644 index 30ea57be5..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/material/getGeometryRoughness.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default getGeometryRoughness; -declare const getGeometryRoughness: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts deleted file mode 100644 index 4c4a103a4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/material/getParallaxCorrectNormal.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export default getParallaxCorrectNormal; -/** - * This computes a parallax corrected normal which is used for box-projected cube mapping (BPCEM). - * - * Reference: {@link https://devlog-martinsh.blogspot.com/2011/09/box-projected-cube-environment-mapping.html} - * - * ```js - * const uvNode = getParallaxCorrectNormal( reflectVector, vec3( 200, 100, 100 ), vec3( 0, - 50, 0 ) ); - * material.envNode = pmremTexture( renderTarget.texture, uvNode ); - * ``` - * - * @tsl - * @function - * @param {Node} normal - The normal to correct. - * @param {Node} cubeSize - The cube size should reflect the size of the environment (BPCEM is usually applied in closed environments like rooms). - * @param {Node} cubePos - The cube position. - * @return {Node} The parallax corrected normal. - */ -declare const getParallaxCorrectNormal: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts deleted file mode 100644 index 18eff5982..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/material/getRoughness.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default getRoughness; -declare const getRoughness: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts b/jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts deleted file mode 100644 index 627b15982..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/functions/material/getShIrradianceAt.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export default getShIrradianceAt; -declare const getShIrradianceAt: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts deleted file mode 100644 index 3630a9978..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/geometry/RangeNode.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -export default RangeNode; -/** - * TSL function for creating a range node. - * - * @tsl - * @function - * @param {Node} [minNode=float()] - A node defining the lower bound of the range. - * @param {Node} [maxNode=float()] - A node defining the upper bound of the range. - * @returns {RangeNode} - */ -export const range: any; -/** - * `RangeNode` generates random instanced attribute data in a defined range. - * An exemplary use case for this utility node is to generate random per-instance - * colors: - * ```js - * const material = new MeshBasicNodeMaterial(); - * material.colorNode = range( new Color( 0x000000 ), new Color( 0xFFFFFF ) ); - * const mesh = new InstancedMesh( geometry, material, count ); - * ``` - * @augments Node - */ -declare class RangeNode extends Node { - /** - * Constructs a new range node. - * - * @param {Node} [minNode=float()] - A node defining the lower bound of the range. - * @param {Node} [maxNode=float()] - A node defining the upper bound of the range. - */ - constructor(minNode?: Node, maxNode?: Node); - /** - * A node defining the lower bound of the range. - * - * @type {Node} - * @default float() - */ - minNode: Node; - /** - * A node defining the upper bound of the range. - * - * @type {Node} - * @default float() - */ - maxNode: Node; - /** - * Returns the vector length which is computed based on the range definition. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {number} The vector length. - */ - getVectorLength(builder: NodeBuilder): number; - /** - * This method is overwritten since the node type is inferred from range definition. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns a constant node from the given node by traversing it. - * - * @param {Node} node - The node to traverse. - * @returns {Node} The constant node, if found. - */ - getConstNode(node: Node): Node; - setup(builder: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts deleted file mode 100644 index 956f26c33..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/gpgpu/AtomicFunctionNode.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -export default AtomicFunctionNode; -export function atomicFunc(method: string, pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicLoad(pointerNode: Node): AtomicFunctionNode; -export function atomicStore(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicAdd(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicSub(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicMax(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicMin(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicAnd(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicOr(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -export function atomicXor(pointerNode: Node, valueNode: Node): AtomicFunctionNode; -/** - * `AtomicFunctionNode` represents any function that can operate on atomic variable types - * within a shader. In an atomic function, any modification to an atomic variable will - * occur as an indivisible step with a defined order relative to other modifications. - * Accordingly, even if multiple atomic functions are modifying an atomic variable at once - * atomic operations will not interfere with each other. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -declare class AtomicFunctionNode extends Node { - /** - * Constructs a new atomic function node. - * - * @param {string} method - The signature of the atomic function to construct. - * @param {Node} pointerNode - An atomic variable or element of an atomic buffer. - * @param {Node} valueNode - The value that mutates the atomic variable. - */ - constructor(method: string, pointerNode: Node, valueNode: Node); - /** - * The signature of the atomic function to construct. - * - * @type {string} - */ - method: string; - /** - * An atomic variable or element of an atomic buffer. - * - * @type {Node} - */ - pointerNode: Node; - /** - * A value that modifies the atomic variable. - * - * @type {Node} - */ - valueNode: Node; - /** - * Overwrites the default implementation to return the type of - * the pointer node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(builder: NodeBuilder): string; - /** - * Overwritten since the node type is inferred from the input type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any): any; -} -declare namespace AtomicFunctionNode { - let ATOMIC_LOAD: string; - let ATOMIC_STORE: string; - let ATOMIC_ADD: string; - let ATOMIC_SUB: string; - let ATOMIC_MAX: string; - let ATOMIC_MIN: string; - let ATOMIC_AND: string; - let ATOMIC_OR: string; - let ATOMIC_XOR: string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts deleted file mode 100644 index 6879cc29f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/gpgpu/BarrierNode.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default BarrierNode; -export function workgroupBarrier(): BarrierNode; -export function storageBarrier(): BarrierNode; -export function textureBarrier(): BarrierNode; -/** - * Represents a GPU control barrier that synchronizes compute operations within a given scope. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -declare class BarrierNode extends Node { - /** - * Constructs a new barrier node. - * - * @param {string} scope - The scope defines the behavior of the node. - */ - constructor(scope: string); - scope: string; - isBarrierNode: boolean; - setup(builder: any): void; - generate(builder: any): void; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts deleted file mode 100644 index d5dbfe59e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeBuiltinNode.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -export default ComputeBuiltinNode; -/** - * Represents the number of workgroups dispatched by the compute shader. - * ```js - * // Run 512 invocations/threads with a workgroup size of 128. - * const computeFn = Fn(() => { - * - * // numWorkgroups.x = 4 - * storageBuffer.element(0).assign(numWorkgroups.x) - * - * })().compute(512, [128]); - * - * // Run 512 invocations/threads with the default workgroup size of 64. - * const computeFn = Fn(() => { - * - * // numWorkgroups.x = 8 - * storageBuffer.element(0).assign(numWorkgroups.x) - * - * })().compute(512); - * ``` - * - * @tsl - * @type {ComputeBuiltinNode} - */ -export const numWorkgroups: ComputeBuiltinNode; -/** - * Represents the 3-dimensional index of the workgroup the current compute invocation belongs to. - * ```js - * // Execute 12 compute threads with a workgroup size of 3. - * const computeFn = Fn( () => { - * - * If( workgroupId.x.mod( 2 ).equal( 0 ), () => { - * - * storageBuffer.element( instanceIndex ).assign( instanceIndex ); - * - * } ).Else( () => { - * - * storageBuffer.element( instanceIndex ).assign( 0 ); - * - * } ); - * - * } )().compute( 12, [ 3 ] ); - * - * // workgroupId.x = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3]; - * // Buffer Output = [0, 1, 2, 0, 0, 0, 6, 7, 8, 0, 0, 0]; - * ``` - * - * @tsl - * @type {ComputeBuiltinNode} - */ -export const workgroupId: ComputeBuiltinNode; -/** - * A non-linearized 3-dimensional representation of the current invocation's position within a 3D global grid. - * - * @tsl - * @type {ComputeBuiltinNode} - */ -export const globalId: ComputeBuiltinNode; -/** - * A non-linearized 3-dimensional representation of the current invocation's position within a 3D workgroup grid. - * - * @tsl - * @type {ComputeBuiltinNode} - */ -export const localId: ComputeBuiltinNode; -/** - * A device dependent variable that exposes the size of the current invocation's subgroup. - * - * @tsl - * @type {ComputeBuiltinNode} - */ -export const subgroupSize: ComputeBuiltinNode; -/** - * `ComputeBuiltinNode` represents a compute-scope builtin value that expose information - * about the currently running dispatch and/or the device it is running on. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -declare class ComputeBuiltinNode extends Node { - /** - * Constructs a new compute builtin node. - * - * @param {string} builtinName - The built-in name. - * @param {string} nodeType - The node type. - */ - constructor(builtinName: string, nodeType: string); - /** - * The built-in name. - * - * @private - * @type {string} - */ - private _builtinName; - /** - * This method is overwritten since hash is derived from the built-in name. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The hash. - */ - getHash(builder: NodeBuilder): string; - /** - * This method is overwritten since the node type is simply derived from `nodeType`.. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(): string; - /** - * Sets the builtin name. - * - * @param {string} builtinName - The built-in name. - * @return {ComputeBuiltinNode} A reference to this node. - */ - setBuiltinName(builtinName: string): ComputeBuiltinNode; - /** - * Returns the builtin name. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The builtin name. - */ - getBuiltinName(): string; - /** - * Whether the current node builder has the builtin or not. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {boolean} Whether the builder has the builtin or not. - */ - hasBuiltin(builder: NodeBuilder): boolean; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts deleted file mode 100644 index 66213c478..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/gpgpu/ComputeNode.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -export default ComputeNode; -export function computeKernel(node: Node, workgroupSize?: Array): ComputeNode; -export function compute(node: Node, count: number | Array, workgroupSize?: Array): ComputeNode; -/** - * Represents a compute shader node. - * - * @augments Node - */ -declare class ComputeNode extends Node { - /** - * Constructs a new compute node. - * - * @param {Node} computeNode - The node that defines the compute shader logic. - * @param {Array} workgroupSize - An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. - */ - constructor(computeNode: Node, workgroupSize: Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isComputeNode: boolean; - /** - * The node that defines the compute shader logic. - * - * @type {Node} - */ - computeNode: Node; - /** - * An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution. - * - * @type {Array} - * @default [ 64 ] - */ - workgroupSize: Array; - /** - * The total number of threads (invocations) to execute. If it is a number, it will be used - * to automatically generate bounds checking against `instanceIndex`. - * - * @type {number|Array} - */ - count: number | Array; - /** - * The dispatch size for workgroups on X, Y, and Z axes. - * Used directly if `count` is not provided. - * - * @type {number|Array} - */ - dispatchSize: number | Array; - /** - * A callback executed when the compute node finishes initialization. - * - * @type {?Function} - */ - onInitFunction: Function | null; - /** - * A uniform node holding the dispatch count for bounds checking. - * Created automatically when `count` is a number. - * - * @type {?UniformNode} - */ - countNode: UniformNode | null; - /** - * Sets the {@link ComputeNode#name} property. - * - * @param {string} name - The name of the uniform. - * @return {ComputeNode} A reference to this node. - */ - setName(name: string): ComputeNode; - /** - * Sets the {@link ComputeNode#name} property. - * - * @deprecated - * @param {string} name - The name of the uniform. - * @return {ComputeNode} A reference to this node. - */ - label(name: string): ComputeNode; - /** - * Sets the callback to run during initialization. - * - * @param {Function} callback - The callback function. - * @return {ComputeNode} A reference to this node. - */ - onInit(callback: Function): ComputeNode; - /** - * The method execute the compute for this node. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateBefore({ renderer }: NodeFrame): void; - setup(builder: any): string | Node | null; - generate(builder: any, output: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts deleted file mode 100644 index 19c603f9b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/gpgpu/SubgroupFunctionNode.d.ts +++ /dev/null @@ -1,303 +0,0 @@ -export default SubgroupFunctionNode; -/** - * Returns true if this invocation has the lowest subgroup_invocation_id - * among active invocations in the subgroup. - * - * @tsl - * @method - * @return {bool} The result of the computation. - */ -export const subgroupElect: any; -/** - * Returns a set of bitfields where the bit corresponding to subgroup_invocation_id - * is 1 if pred is true for that active invocation and 0 otherwise. - * - * @tsl - * @method - * @param {bool} pred - A boolean that sets the bit corresponding to the invocations subgroup invocation id. - * @return {vec4}- A bitfield corresponding to the pred value of each subgroup invocation. - */ -export const subgroupBallot: any; -/** - * A reduction that adds e among all active invocations and returns that result. - * - * @tsl - * @method - * @param {number} e - The value provided to the reduction by the current invocation. - * @return {number} The accumulated result of the reduction operation. - */ -export const subgroupAdd: any; -/** - * An inclusive scan returning the sum of e for all active invocations with subgroup_invocation_id less than or equal to this invocation. - * - * @tsl - * @method - * @param {number} e - The value provided to the inclusive scan by the current invocation. - * @return {number} The accumulated result of the inclusive scan operation. - */ -export const subgroupInclusiveAdd: any; -/** - * An exclusive scan that returns the sum of e for all active invocations with subgroup_invocation_id less than this invocation. - * - * @tsl - * @method - * @param {number} e - The value provided to the exclusive scan by the current invocation. - * @return {number} The accumulated result of the exclusive scan operation. - */ -export const subgroupExclusiveAdd: any; -/** - * A reduction that multiplies e among all active invocations and returns that result. - * - * @tsl - * @method - * @param {number} e - The value provided to the reduction by the current invocation. - * @return {number} The accumulated result of the reduction operation. - */ -export const subgroupMul: any; -/** - * An inclusive scan returning the product of e for all active invocations with subgroup_invocation_id less than or equal to this invocation. - * - * @tsl - * @method - * @param {number} e - The value provided to the inclusive scan by the current invocation. - * @return {number} The accumulated result of the inclusive scan operation. - */ -export const subgroupInclusiveMul: any; -/** - * An exclusive scan that returns the product of e for all active invocations with subgroup_invocation_id less than this invocation. - * - * @tsl - * @method - * @param {number} e - The value provided to the exclusive scan by the current invocation. - * @return {number} The accumulated result of the exclusive scan operation. - */ -export const subgroupExclusiveMul: any; -/** - * A reduction that performs a bitwise and of e among all active invocations and returns that result. - * - * @tsl - * @method - * @param {number} e - The value provided to the reduction by the current invocation. - * @return {number} The result of the reduction operation. - */ -export const subgroupAnd: any; -/** - * A reduction that performs a bitwise or of e among all active invocations and returns that result. - * - * @tsl - * @method - * @param {number} e - The value provided to the reduction by the current invocation. - * @return {number} The result of the reduction operation. - */ -export const subgroupOr: any; -/** - * A reduction that performs a bitwise xor of e among all active invocations and returns that result. - * - * @tsl - * @method - * @param {number} e - The value provided to the reduction by the current invocation. - * @return {number} The result of the reduction operation. - */ -export const subgroupXor: any; -/** - * A reduction that performs a min of e among all active invocations and returns that result. - * - * @tsl - * @method - * @param {number} e - The value provided to the reduction by the current invocation. - * @return {number} The result of the reduction operation. - */ -export const subgroupMin: any; -/** - * A reduction that performs a max of e among all active invocations and returns that result. - * - * @tsl - * @method - * @param {number} e - The value provided to the reduction by the current invocation. - * @return {number} The result of the reduction operation. - */ -export const subgroupMax: any; -/** - * Returns true if e is true for all active invocations in the subgroup. - * - * @tsl - * @method - * @return {bool} The result of the computation. - */ -export const subgroupAll: any; -/** - * Returns true if e is true for any active invocation in the subgroup - * - * @tsl - * @method - * @return {bool} The result of the computation. - */ -export const subgroupAny: any; -/** - * Broadcasts e from the active invocation with the lowest subgroup_invocation_id in the subgroup to all other active invocations. - * - * @tsl - * @method - * @param {number} e - The value to broadcast from the lowest subgroup invocation. - * @param {number} id - The subgroup invocation to broadcast from. - * @return {number} The broadcast value. - */ -export const subgroupBroadcastFirst: any; -/** - * Swaps e between invocations in the quad in the X direction. - * - * @tsl - * @method - * @param {number} e - The value to swap from the current invocation. - * @return {number} The value received from the swap operation. - */ -export const quadSwapX: any; -/** - * Swaps e between invocations in the quad in the Y direction. - * - * @tsl - * @method - * @param {number} e - The value to swap from the current invocation. - * @return {number} The value received from the swap operation. - */ -export const quadSwapY: any; -/** - * Swaps e between invocations in the quad diagonally. - * - * @tsl - * @method - * @param {number} e - The value to swap from the current invocation. - * @return {number} The value received from the swap operation. - */ -export const quadSwapDiagonal: any; -/** - * Broadcasts e from the invocation whose subgroup_invocation_id matches id, to all active invocations. - * - * @tsl - * @method - * @param {number} e - The value to broadcast from subgroup invocation 'id'. - * @param {number} id - The subgroup invocation to broadcast from. - * @return {number} The broadcast value. - */ -export const subgroupBroadcast: any; -/** - * Returns v from the active invocation whose subgroup_invocation_id matches id - * - * @tsl - * @method - * @param {number} v - The value to return from subgroup invocation id^mask. - * @param {number} id - The subgroup invocation which returns the value v. - * @return {number} The broadcast value. - */ -export const subgroupShuffle: any; -/** - * Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id ^ mask. - * - * @tsl - * @method - * @param {number} v - The value to return from subgroup invocation id^mask. - * @param {number} mask - A bitmask that determines the target invocation via a XOR operation. - * @return {number} The broadcast value. - */ -export const subgroupShuffleXor: any; -/** - * Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id - delta - * - * @tsl - * @method - * @param {number} v - The value to return from subgroup invocation id^mask. - * @param {number} delta - A value that offsets the current in. - * @return {number} The broadcast value. - */ -export const subgroupShuffleUp: any; -/** - * Returns v from the active invocation whose subgroup_invocation_id matches subgroup_invocation_id + delta - * - * @tsl - * @method - * @param {number} v - The value to return from subgroup invocation id^mask. - * @param {number} delta - A value that offsets the current subgroup invocation. - * @return {number} The broadcast value. - */ -export const subgroupShuffleDown: any; -/** - * Broadcasts e from the quad invocation with id equal to id. - * - * @tsl - * @method - * @param {number} e - The value to broadcast. - * @return {number} The broadcast value. - */ -export const quadBroadcast: any; -/** - * This class represents a set of built in WGSL shader functions that sync - * synchronously execute an operation across a subgroup, or 'warp', of compute - * or fragment shader invocations within a workgroup. Typically, these functions - * will synchronously execute an operation using data from all active invocations - * within the subgroup, then broadcast that result to all active invocations. In - * other graphics APIs, subgroup functions are also referred to as wave intrinsics - * (DirectX/HLSL) or warp intrinsics (CUDA). - * - * @augments TempNode - */ -declare class SubgroupFunctionNode extends TempNode { - /** - * Constructs a new function node. - * - * @param {string} method - The subgroup/wave intrinsic method to construct. - * @param {Node} [aNode=null] - The method's first argument. - * @param {Node} [bNode=null] - The method's second argument. - */ - constructor(method: string, aNode?: Node, bNode?: Node); - /** - * The subgroup/wave intrinsic method to construct. - * - * @type {string} - */ - method: string; - /** - * The method's first argument. - * - * @type {Node} - */ - aNode: Node; - /** - * The method's second argument. - * - * @type {Node} - */ - bNode: Node; - getInputType(builder: any): any; - generateNodeType(builder: any): any; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -declare namespace SubgroupFunctionNode { - let SUBGROUP_ELECT: string; - let SUBGROUP_BALLOT: string; - let SUBGROUP_ADD: string; - let SUBGROUP_INCLUSIVE_ADD: string; - let SUBGROUP_EXCLUSIVE_AND: string; - let SUBGROUP_MUL: string; - let SUBGROUP_INCLUSIVE_MUL: string; - let SUBGROUP_EXCLUSIVE_MUL: string; - let SUBGROUP_AND: string; - let SUBGROUP_OR: string; - let SUBGROUP_XOR: string; - let SUBGROUP_MIN: string; - let SUBGROUP_MAX: string; - let SUBGROUP_ALL: string; - let SUBGROUP_ANY: string; - let SUBGROUP_BROADCAST_FIRST: string; - let QUAD_SWAP_X: string; - let QUAD_SWAP_Y: string; - let QUAD_SWAP_DIAGONAL: string; - let SUBGROUP_BROADCAST: string; - let SUBGROUP_SHUFFLE: string; - let SUBGROUP_SHUFFLE_XOR: string; - let SUBGROUP_SHUFFLE_UP: string; - let SUBGROUP_SHUFFLE_DOWN: string; - let QUAD_BROADCAST: string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts deleted file mode 100644 index 617e35cea..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/gpgpu/WorkgroupInfoNode.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -export default WorkgroupInfoNode; -export function workgroupArray(type: string, count?: number): WorkgroupInfoNode; -/** - * A node allowing the user to create a 'workgroup' scoped buffer within the - * context of a compute shader. Typically, workgroup scoped buffers are - * created to hold data that is transferred from a global storage scope into - * a local workgroup scope. For invocations within a workgroup, data - * access speeds on 'workgroup' scoped buffers can be significantly faster - * than similar access operations on globally accessible storage buffers. - * - * This node can only be used with a WebGPU backend. - * - * @augments Node - */ -declare class WorkgroupInfoNode extends Node { - /** - * Constructs a new workgroup info node. - * - * @param {string} scope - The address space the buffer is scoped to. Currently only `'Workgroup'` is used. - * @param {string} bufferType - The data type of a 'workgroup' scoped buffer element. - * @param {number} [bufferCount=0] - The number of elements in the buffer. - */ - constructor(scope: string, bufferType: string, bufferCount?: number); - /** - * The buffer type. - * - * @type {string} - */ - bufferType: string; - /** - * The buffer count. - * - * @type {number} - * @default 0 - */ - bufferCount: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWorkgroupInfoNode: boolean; - /** - * The data type of the array buffer. - * - * @type {string} - */ - elementType: string; - /** - * The address space the buffer is scoped to. Currently only `'Workgroup'` is used. - * - * @type {string} - */ - scope: string; - /** - * Sets the name of this node. - * - * @param {string} name - The name to set. - * @return {WorkgroupInfoNode} A reference to this node. - */ - setName(name: string): WorkgroupInfoNode; - /** - * Sets the name/label of this node. - * - * @deprecated - * @param {string} name - The name to set. - * @return {WorkgroupInfoNode} A reference to this node. - */ - label(name: string): WorkgroupInfoNode; - /** - * Sets the scope of this node. - * - * @param {string} scope - The scope to set. - * @return {WorkgroupInfoNode} A reference to this node. - */ - setScope(scope: string): WorkgroupInfoNode; - /** - * The data type of the array buffer. - * - * @return {string} The element type. - */ - getElementType(): string; - /** - * Overwrites the default implementation since the input type - * is inferred from the scope. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(): string; - /** - * This method can be used to access elements via an index node. - * - * @param {IndexNode} indexNode - indexNode. - * @return {WorkgroupInfoElementNode} A reference to an element. - */ - element(indexNode: IndexNode): WorkgroupInfoElementNode; - generate(builder: any): any; -} -import Node from '../core/Node.js'; -/** - * Represents an element of a 'workgroup' scoped buffer. - * - * @augments ArrayElementNode - */ -declare class WorkgroupInfoElementNode extends ArrayElementNode { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWorkgroupInfoElementNode: boolean; - generate(builder: any, output: any): any; -} -import ArrayElementNode from '../utils/ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts deleted file mode 100644 index 5c4e49ae2..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/AONode.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default AONode; -/** - * A generic class that can be used by nodes which contribute - * ambient occlusion to the scene. E.g. an ambient occlusion map - * node can be used as input for this module. Used in {@link NodeMaterial}. - * - * @augments LightingNode - */ -declare class AONode extends LightingNode { - /** - * Constructs a new AO node. - * - * @param {?Node} [aoNode=null] - The ambient occlusion node. - */ - constructor(aoNode?: Node | null); - /** - * The ambient occlusion node. - * - * @type {?Node} - * @default null - */ - aoNode: Node | null; - setup(builder: any): void; -} -import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts deleted file mode 100644 index 5705b1d91..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/AmbientLightNode.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export default AmbientLightNode; -/** - * Module for representing ambient lights as nodes. - * - * @augments AnalyticLightNode - */ -declare class AmbientLightNode extends AnalyticLightNode { - setup({ context }: { - context: any; - }): void; -} -import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts deleted file mode 100644 index e1c0209aa..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/AnalyticLightNode.d.ts +++ /dev/null @@ -1,127 +0,0 @@ -export default AnalyticLightNode; -/** - * Base class for analytic light nodes. - * - * @augments LightingNode - */ -declare class AnalyticLightNode extends LightingNode { - /** - * Constructs a new analytic light node. - * - * @param {?Light} [light=null] - The light source. - */ - constructor(light?: Light | null); - /** - * The light source. - * - * @type {?Light} - * @default null - */ - light: Light | null; - /** - * The light's color value. - * - * @type {Color} - */ - color: Color; - /** - * The light's color node. Points to `colorNode` of the light source, if set. Otherwise - * it creates a uniform node based on {@link AnalyticLightNode#color}. - * - * @type {Node} - */ - colorNode: Node; - /** - * This property is used to retain a reference to the original value of {@link AnalyticLightNode#colorNode}. - * The final color node is represented by a different node when using shadows. - * - * @type {?Node} - * @default null - */ - baseColorNode: Node | null; - /** - * Represents the light's shadow. - * - * @type {?ShadowNode} - * @default null - */ - shadowNode: ShadowNode | null; - /** - * Represents the light's shadow color. - * - * @type {?Node} - * @default null - */ - shadowColorNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isAnalyticLightNode: boolean; - _shadowDisposeListener: (() => void) | undefined; - /** - * Frees internal resources related to shadows. - */ - disposeShadow(): void; - getHash(): any; - /** - * Returns a node representing a direction vector which points from the current - * position in view space to the light's position in view space. - * - * @param {NodeBuilder} builder - The builder object used for setting up the light. - * @return {Node} The light vector node. - */ - getLightVector(builder: NodeBuilder): Node; - /** - * Sets up the direct lighting for the analytic light node. - * - * @abstract - * @param {NodeBuilder} builder - The builder object used for setting up the light. - * @return {Object|undefined} The direct light data (color and direction). - */ - setupDirect(): Object | undefined; - /** - * Sets up the direct rect area lighting for the analytic light node. - * - * @abstract - * @param {NodeBuilder} builder - The builder object used for setting up the light. - * @return {Object|undefined} The direct rect area light data. - */ - setupDirectRectArea(): Object | undefined; - /** - * Setups the shadow node for this light. The method exists so concrete light classes - * can setup different types of shadow nodes. - * - * @return {ShadowNode} The created shadow node. - */ - setupShadowNode(): ShadowNode; - /** - * Setups the shadow for this light. This method is only executed if the light - * cast shadows and the current build object receives shadows. It incorporates - * shadows into the lighting computation. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setupShadow(builder: NodeBuilder): void; - /** - * Unlike most other nodes, lighting nodes do not return a output node in {@link Node#setup}. - * The main purpose of lighting nodes is to configure the current {@link LightingModel} and/or - * invocate the respective interface methods. - * - * @param {NodeBuilder} builder - The current node builder. - */ - setup(builder: NodeBuilder): void; - /** - * The update method is used to update light uniforms per frame. - * Potentially overwritten in concrete light nodes to update light - * specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(): void; -} -import LightingNode from './LightingNode.js'; -import { Color } from '../../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts deleted file mode 100644 index 701118341..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/BasicEnvironmentNode.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export default BasicEnvironmentNode; -/** - * Represents a basic model for Image-based lighting (IBL). The environment - * is defined via environment maps in the equirectangular or cube map format. - * `BasicEnvironmentNode` is intended for non-PBR materials like {@link MeshBasicNodeMaterial} - * or {@link MeshPhongNodeMaterial}. - * - * @augments LightingNode - */ -declare class BasicEnvironmentNode extends LightingNode { - /** - * Constructs a new basic environment node. - * - * @param {Node} [envNode=null] - A node representing the environment. - */ - constructor(envNode?: Node); - /** - * A node representing the environment. - * - * @type {Node} - * @default null - */ - envNode: Node; - setup(builder: any): void; -} -import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts deleted file mode 100644 index b5173c497..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/BasicLightMapNode.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default BasicLightMapNode; -/** - * A specific version of {@link IrradianceNode} that is only relevant - * for {@link MeshBasicNodeMaterial}. Since the material is unlit, it - * requires a special scaling factor for the light map. - * - * @augments LightingNode - */ -declare class BasicLightMapNode extends LightingNode { - /** - * Constructs a new basic light map node. - * - * @param {?Node} [lightMapNode=null] - The light map node. - */ - constructor(lightMapNode?: Node | null); - /** - * The light map node. - * - * @type {?Node} - */ - lightMapNode: Node | null; - setup(builder: any): void; -} -import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts deleted file mode 100644 index 723a2afc6..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/DirectionalLightNode.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export default DirectionalLightNode; -/** - * Module for representing directional lights as nodes. - * - * @augments AnalyticLightNode - */ -declare class DirectionalLightNode extends AnalyticLightNode { - setupDirect(): { - lightDirection: any; - lightColor: Node; - }; -} -import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts deleted file mode 100644 index 6b87431fc..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/EnvironmentNode.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -export default EnvironmentNode; -/** - * Represents a physical model for Image-based lighting (IBL). The environment - * is defined via environment maps in the equirectangular, cube map or cubeUV (PMREM) format. - * `EnvironmentNode` is intended for PBR materials like {@link MeshStandardNodeMaterial}. - * - * @augments LightingNode - */ -declare class EnvironmentNode extends LightingNode { - /** - * Constructs a new environment node. - * - * @param {Node} [envNode=null] - A node representing the environment. - */ - constructor(envNode?: Node); - /** - * A node representing the environment. - * - * @type {?Node} - * @default null - */ - envNode: Node | null; - setup(builder: any): void; - /** - * Returns the PMREM node cache of the current renderer. - * - * @private - * @param {Renderer} renderer - The current renderer. - * @return {WeakMap} The node cache. - */ - private _getPMREMNodeCache; -} -import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts deleted file mode 100644 index 6612f6067..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/HemisphereLightNode.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export default HemisphereLightNode; -/** - * Module for representing hemisphere lights as nodes. - * - * @augments AnalyticLightNode - */ -declare class HemisphereLightNode extends AnalyticLightNode { - /** - * Uniform node representing the light's position. - * - * @type {UniformNode} - */ - lightPositionNode: UniformNode; - /** - * A node representing the light's direction. - * - * @type {Node} - */ - lightDirectionNode: Node; - /** - * Uniform node representing the light's ground color. - * - * @type {UniformNode} - */ - groundColorNode: UniformNode; - /** - * Overwritten to updated hemisphere light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - setup(builder: any): void; -} -import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts deleted file mode 100644 index 28a59eced..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/IESSpotLightNode.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export default IESSpotLightNode; -/** - * An IES version of the default spot light node. - * - * @augments SpotLightNode - */ -declare class IESSpotLightNode extends SpotLightNode { - /** - * The texture node representing the IES texture. - * - * @type {?TextureNode} - * @default null - */ - _iesTextureNode: TextureNode | null; -} -import SpotLightNode from './SpotLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts deleted file mode 100644 index 0498aea05..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/IrradianceNode.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default IrradianceNode; -/** - * A generic class that can be used by nodes which contribute - * irradiance to the scene. E.g. a light map node can be used - * as input for this module. Used in {@link NodeMaterial}. - * - * @augments LightingNode - */ -declare class IrradianceNode extends LightingNode { - /** - * Constructs a new irradiance node. - * - * @param {Node} node - A node contributing irradiance. - */ - constructor(node: Node); - /** - * A node contributing irradiance. - * - * @type {Node} - */ - node: Node; - setup(builder: any): void; -} -import LightingNode from './LightingNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts deleted file mode 100644 index 02fd000fd..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/LightProbeNode.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default LightProbeNode; -/** - * Module for representing light probes as nodes. - * - * @augments AnalyticLightNode - */ -declare class LightProbeNode extends AnalyticLightNode { - /** - * Light probe represented as a uniform of spherical harmonics. - * - * @type {UniformArrayNode} - */ - lightProbe: UniformArrayNode; - /** - * Overwritten to updated light probe specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - setup(builder: any): void; -} -import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts deleted file mode 100644 index 9a60548b3..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/LightUtils.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Represents a `discard` shader operation in TSL. - * - * @method - * @param {Object} inputs - The input parameter object. - * @param {Node} inputs.lightDistance - The distance of the light's position to the current fragment position. - * @param {Node} inputs.cutoffDistance - The light's cutoff distance. - * @param {Node} inputs.decayExponent - The light's decay exponent. - * @return {Node} The distance falloff. - */ -export const getDistanceAttenuation: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts deleted file mode 100644 index deef06daa..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/LightingContextNode.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -export default LightingContextNode; -export const lightingContext: any; -/** - * `LightingContextNode` represents an extension of the {@link ContextNode} module - * by adding lighting specific context data. It represents the runtime context of - * {@link LightsNode}. - * - * @augments ContextNode - */ -declare class LightingContextNode extends ContextNode { - /** - * Constructs a new lighting context node. - * - * @param {LightsNode} lightsNode - The lights node. - * @param {?LightingModel} [lightingModel=null] - The current lighting model. - * @param {?Array} materialLightings - The material lightings nodes. - * @param {?Node} [backdropNode=null] - A backdrop node. - * @param {?Node} [backdropAlphaNode=null] - A backdrop alpha node. - */ - constructor(lightsNode: LightsNode, lightingModel?: LightingModel | null, materialLightings?: Array | null, backdropNode?: Node | null, backdropAlphaNode?: Node | null); - /** - * The current lighting model. - * - * @type {?LightingModel} - * @default null - */ - lightingModel: LightingModel | null; - /** - * @type {?Array} - * @default [] - */ - materialLightings: Array | null; - /** - * A backdrop node. - * - * @type {?Node} - * @default null - */ - backdropNode: Node | null; - /** - * A backdrop alpha node. - * - * @type {?Node} - * @default null - */ - backdropAlphaNode: Node | null; - _value: { - radiance: Node; - irradiance: Node; - iblIrradiance: Node; - ambientOcclusion: Node; - reflectedLight: { - directDiffuse: Node; - directSpecular: Node; - indirectDiffuse: Node; - indirectSpecular: Node; - }; - backdrop: Node; - backdropAlpha: Node; - } | null; - /** - * Returns a lighting context object. - * - * @return {{ - * radiance: Node, - * irradiance: Node, - * iblIrradiance: Node, - * ambientOcclusion: Node, - * reflectedLight: {directDiffuse: Node, directSpecular: Node, indirectDiffuse: Node, indirectSpecular: Node}, - * backdrop: Node, - * backdropAlpha: Node - * }} The lighting context object. - */ - getContext(): { - radiance: Node; - irradiance: Node; - iblIrradiance: Node; - ambientOcclusion: Node; - reflectedLight: { - directDiffuse: Node; - directSpecular: Node; - indirectDiffuse: Node; - indirectSpecular: Node; - }; - backdrop: Node; - backdropAlpha: Node; - }; -} -import ContextNode from '../core/ContextNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts deleted file mode 100644 index adc145155..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/LightingNode.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export default LightingNode; -/** - * Base class for lighting nodes. - * - * @augments Node - */ -declare class LightingNode extends Node { - /** - * Constructs a new lighting node. - */ - constructor(); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLightingNode: boolean; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts deleted file mode 100644 index a78eb1292..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/LightsNode.d.ts +++ /dev/null @@ -1,125 +0,0 @@ -export default LightsNode; -export function lights(lights?: Array): LightsNode; -/** - * This node represents the scene's lighting and manages the lighting model's life cycle - * for the current build 3D object. It is responsible for computing the total outgoing - * light in a given lighting context. - * - * @augments Node - */ -declare class LightsNode extends Node { - /** - * Constructs a new lights node. - */ - constructor(); - /** - * A node representing the total diffuse light. - * - * @type {Node} - */ - totalDiffuseNode: Node; - /** - * A node representing the total specular light. - * - * @type {Node} - */ - totalSpecularNode: Node; - /** - * A node representing the outgoing light. - * - * @type {Node} - */ - outgoingLightNode: Node; - /** - * An array representing the lights in the scene. - * - * @private - * @type {Array} - */ - private _lights; - /** - * Computes a hash value for identifying the current light nodes setup. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {string} The computed hash. - */ - getHash(builder: NodeBuilder): string; - /** - * Analyzes the node's dependencies by building all nested light nodes - * and the output node. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - */ - analyze(builder: NodeBuilder): void; - /** - * Creates lighting nodes for each scene light. This makes it possible to further - * process lights in the node system. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Array} The array of lighting nodes. - */ - setupLightsNode(builder: NodeBuilder): Array; - /** - * Sets up a direct light in the lighting model. - * - * @param {Object} builder - The builder object containing the context and stack. - * @param {Object} lightNode - The light node. - * @param {Object} lightData - The light object containing color and direction properties. - */ - setupDirectLight(builder: Object, lightNode: Object, lightData: Object): void; - /** - * Sets up a direct rect area light in the lighting model. - * - * @param {Object} builder - The builder object containing the context and stack. - * @param {Object} lightNode - The light node. - * @param {Object} lightData - The light object containing color and area light properties. - */ - setupDirectRectAreaLight(builder: Object, lightNode: Object, lightData: Object): void; - /** - * Setups the internal lights by building all respective - * light nodes. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @param {Array} lightNodes - An array of lighting nodes. - */ - setupLights(builder: NodeBuilder, lightNodes: Array): void; - getLightNodes(builder: any): any; - /** - * The implementation makes sure that for each light in the scene - * there is a corresponding light node. By building the light nodes - * and evaluating the lighting model the outgoing light is computed. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Node} A node representing the outgoing light. - */ - setup(builder: NodeBuilder): Node; - /** - * Configures this node with an array of lights. - * - * @param {Array} lights - An array of lights. - * @return {LightsNode} A reference to this node. - */ - setLights(lights: Array): LightsNode; - /** - * Returns an array of the scene's lights. - * - * @return {Array} The scene's lights. - */ - getLights(): Array; - /** - * Returns an array of the scene's lights. - * - * The light variations are shader-dependent; - * if this array changes, the shader needs to be recreated. - * - * @return {Array} The scene's lights. - */ - getBuiltinLights(): Array; - /** - * Whether the scene has lights or not. - * - * @type {boolean} - */ - get hasLights(): boolean; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts deleted file mode 100644 index 4dee5e49c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/PointLightNode.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export function directPointLight({ color, lightVector, cutoffDistance, decayExponent }: { - color: any; - lightVector: any; - cutoffDistance: any; - decayExponent: any; -}): { - lightDirection: any; - lightColor: any; -}; -export default PointLightNode; -/** - * Module for representing point lights as nodes. - * - * @augments AnalyticLightNode - */ -declare class PointLightNode extends AnalyticLightNode { - /** - * Uniform node representing the cutoff distance. - * - * @type {UniformNode} - */ - cutoffDistanceNode: UniformNode; - /** - * Uniform node representing the decay exponent. - * - * @type {UniformNode} - */ - decayExponentNode: UniformNode; - /** - * Overwritten to updated point light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - setupDirect(builder: any): { - lightDirection: any; - lightColor: any; - }; -} -import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts deleted file mode 100644 index 6215b48a3..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/PointShadowNode.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export const BasicPointShadowFilter: () => void; -/** - * A shadow filtering function for point lights using Vogel disk sampling and IGN. - * - * Uses 5 samples distributed via Vogel disk pattern in tangent space around the - * sample direction, rotated per-pixel using Interleaved Gradient Noise (IGN). - * - * @method - * @param {Object} inputs - The input parameter object. - * @param {CubeDepthTexture} inputs.depthTexture - A reference to the shadow cube map. - * @param {Node} inputs.bd3D - The normalized direction from light to fragment. - * @param {Node} inputs.dp - The depth value to compare against. - * @param {LightShadow} inputs.shadow - The light shadow. - * @return {Node} The filtering result. - */ -export const PointShadowFilter: () => void; -export default PointShadowNode; -export function pointShadow(light: PointLight, shadow?: PointLightShadow | null): PointShadowNode; -/** - * Represents the shadow implementation for point light nodes. - * - * @augments ShadowNode - */ -declare class PointShadowNode extends ShadowNode { - /** - * Overwrites the default implementation to only use point light specific - * shadow filter functions. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @param {Object} inputs - A configuration object that defines the shadow filtering. - * @param {Function} inputs.filterFn - This function defines the filtering type of the shadow map e.g. PCF. - * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's depth texture. - * @param {Node} inputs.shadowCoord - Shadow coordinates which are used to sample from the shadow map. - * @param {LightShadow} inputs.shadow - The light shadow. - * @return {Node} The result node of the shadow filtering. - */ - setupShadowFilter(builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow }: { - filterFn: Function; - depthTexture: DepthTexture; - shadowCoord: Node; - shadow: LightShadow; - }): Node; - /** - * Overwrites the default implementation to create a CubeRenderTarget with CubeDepthTexture. - * - * @param {LightShadow} shadow - The light shadow object. - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Object} An object containing the shadow map and depth texture. - */ - setupRenderTarget(shadow: LightShadow, builder: NodeBuilder): Object; -} -import ShadowNode from './ShadowNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts deleted file mode 100644 index 22f3ffe8b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/ProjectorLightNode.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export default ProjectorLightNode; -/** - * An implementation of a projector light node. - * - * @augments SpotLightNode - */ -declare class ProjectorLightNode extends SpotLightNode { - update(frame: any): void; - /** - * Overwrites the default implementation to compute projection attenuation. - * - * @param {NodeBuilder} builder - The node builder. - * @return {Node} The spot attenuation. - */ - getSpotAttenuation(builder: NodeBuilder): Node; -} -import SpotLightNode from './SpotLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts deleted file mode 100644 index 0b4d56420..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/RectAreaLightNode.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default RectAreaLightNode; -/** - * Module for representing rect area lights as nodes. - * - * @augments AnalyticLightNode - */ -declare class RectAreaLightNode extends AnalyticLightNode { - /** - * Used to configure the internal BRDF approximation texture data. - * - * @param {RectAreaLightTexturesLib} ltc - The BRDF approximation texture data. - */ - static setLTC(ltc: RectAreaLightTexturesLib): void; - /** - * Uniform node representing the half height of the are light. - * - * @type {UniformNode} - */ - halfHeight: UniformNode; - /** - * Uniform node representing the half width of the are light. - * - * @type {UniformNode} - */ - halfWidth: UniformNode; - /** - * Overwritten to updated rect area light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - setupDirectRectArea(builder: any): { - lightColor: Node; - lightPosition: UniformNode; - halfWidth: UniformNode; - halfHeight: UniformNode; - ltc_1: import("../accessors/TextureNode.js").default; - ltc_2: import("../accessors/TextureNode.js").default; - }; -} -import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts deleted file mode 100644 index 423eed39e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowBaseNode.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/** - * TSL object that represents the vertex position in world space during the shadow pass. - * - * @tsl - * @type {Node} - */ -export const shadowPositionWorld: Node; -export default ShadowBaseNode; -import Node from '../core/Node.js'; -/** - * Base class for all shadow nodes. - * - * Shadow nodes encapsulate shadow related logic and are always coupled to lighting nodes. - * Lighting nodes might share the same shadow node type or use specific ones depending on - * their requirements. - * - * @augments Node - */ -declare class ShadowBaseNode extends Node { - /** - * Constructs a new shadow base node. - * - * @param {Light} light - The shadow casting light. - */ - constructor(light: Light); - /** - * The shadow casting light. - * - * @type {Light} - */ - light: Light; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowBaseNode: boolean; - /** - * Retrieves or creates a shadow material for the shadow casting light source. - * - * This method checks if a shadow material already exists for the provided light in the internal library. - * If not, it creates a new `NodeMaterial` configured for shadow rendering and stores it for future use. - * - * @return {NodeMaterial} The shadow material associated with the given light. - */ - getShadowMaterial(): NodeMaterial; - /** - * Disposes the shadow material for the shadow casting light source. - */ - disposeShadowMaterial(): void; - /** - * Returns a function to render shadow objects in a scene for the given light shadow and renderer. - * - * @param {Renderer} renderer - The renderer. - * @param {LightShadow} [shadow=this.light.shadow] - The light shadow object containing shadow properties. - * @return {Function} A function that renders shadow objects. - */ - getShadowRenderObjectFunction(renderer: Renderer, shadow?: LightShadow): Function; - /** - * Setups the shadow position node which is by default the predefined TSL node object `shadowPositionWorld`. - * - * @param {NodeBuilder} object - A configuration object that must at least hold a material reference. - */ - setupShadowPosition({ context, material }: NodeBuilder): void; -} -import NodeMaterial from '../../materials/nodes/NodeMaterial.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts deleted file mode 100644 index 3946fc3fb..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowFilterNode.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * A shadow filtering function performing basic filtering. This is in fact an unfiltered version of the shadow map - * with a binary `[0,1]` result. - * - * @method - * @param {Object} inputs - The input parameter object. - * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. - * @param {Node} inputs.shadowCoord - The shadow coordinates. - * @return {Node} The filtering result. - */ -export const BasicShadowFilter: () => void; -/** - * A shadow filtering function performing PCF filtering with Vogel disk sampling and IGN. - * - * Uses 5 samples distributed via Vogel disk pattern, rotated per-pixel using Interleaved - * Gradient Noise (IGN) to break up banding artifacts. Combined with hardware PCF (4-tap - * filtering per sample), this effectively provides 20 filtered taps with better distribution. - * - * @method - * @param {Object} inputs - The input parameter object. - * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. - * @param {Node} inputs.shadowCoord - The shadow coordinates. - * @param {LightShadow} inputs.shadow - The light shadow. - * @return {Node} The filtering result. - */ -export const PCFShadowFilter: () => void; -/** - * A shadow filtering function performing VSM filtering. - * - * @method - * @param {Object} inputs - The input parameter object. - * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. - * @param {Node} inputs.shadowCoord - The shadow coordinates. - * @return {Node} The filtering result. - */ -export const VSMShadowFilter: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts deleted file mode 100644 index a24be2495..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/ShadowNode.d.ts +++ /dev/null @@ -1,192 +0,0 @@ -export default ShadowNode; -export function shadow(light: Light, shadow?: LightShadow | null): ShadowNode; -/** - * Represents the default shadow implementation for lighting nodes. - * - * @augments ShadowBaseNode - */ -declare class ShadowNode extends ShadowBaseNode { - /** - * Constructs a new shadow node. - * - * @param {Light} light - The shadow casting light. - * @param {?LightShadow} [shadow=null] - An optional light shadow. - */ - constructor(light: Light, shadow?: LightShadow | null); - /** - * The light shadow which defines the properties light's - * shadow. - * - * @type {?LightShadow} - * @default null - */ - shadow: LightShadow | null; - /** - * A reference to the shadow map which is a render target. - * - * @type {?RenderTarget} - * @default null - */ - shadowMap: RenderTarget | null; - /** - * Only relevant for VSM shadows. Render target for the - * first VSM render pass. - * - * @type {?RenderTarget} - * @default null - */ - vsmShadowMapVertical: RenderTarget | null; - /** - * Only relevant for VSM shadows. Render target for the - * second VSM render pass. - * - * @type {?RenderTarget} - * @default null - */ - vsmShadowMapHorizontal: RenderTarget | null; - /** - * Only relevant for VSM shadows. Node material which - * is used to render the first VSM pass. - * - * @type {?NodeMaterial} - * @default null - */ - vsmMaterialVertical: NodeMaterial | null; - /** - * Only relevant for VSM shadows. Node material which - * is used to render the second VSM pass. - * - * @type {?NodeMaterial} - * @default null - */ - vsmMaterialHorizontal: NodeMaterial | null; - /** - * A reference to the output node which defines the - * final result of this shadow node. - * - * @type {?Node} - * @private - * @default null - */ - private _node; - /** - * The current shadow map type of this shadow node. - * - * @type {?number} - * @private - * @default null - */ - private _currentShadowType; - /** - * A Weak Map holding the current frame ID per camera. Used - * to control the update of shadow maps. - * - * @type {WeakMap} - * @private - */ - private _cameraFrameId; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isShadowNode: boolean; - /** - * This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer. - * - * @type {number} - * @readonly - * @default true - */ - readonly depthLayer: number; - /** - * Setups the shadow filtering. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @param {Object} inputs - A configuration object that defines the shadow filtering. - * @param {Function} inputs.filterFn - This function defines the filtering type of the shadow map e.g. PCF. - * @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. - * @param {Node} inputs.shadowCoord - Shadow coordinates which are used to sample from the shadow map. - * @param {LightShadow} inputs.shadow - The light shadow. - * @return {Node} The result node of the shadow filtering. - */ - setupShadowFilter(builder: NodeBuilder, { filterFn, depthTexture, shadowCoord, shadow, depthLayer }: { - filterFn: Function; - depthTexture: DepthTexture; - shadowCoord: Node; - shadow: LightShadow; - }): Node; - /** - * Setups the shadow coordinates. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @param {Node} shadowPosition - A node representing the shadow position. - * @return {Node} The shadow coordinates. - */ - setupShadowCoord(builder: NodeBuilder, shadowPosition: Node): Node; - /** - * Returns the shadow filtering function for the given shadow type. - * - * @param {number} type - The shadow type. - * @return {Function} The filtering function. - */ - getShadowFilterFn(type: number): Function; - setupRenderTarget(shadow: any, builder: any): { - shadowMap: any; - depthTexture: DepthTexture; - }; - /** - * Setups the shadow output node. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {Node} The shadow output node. - */ - setupShadow(builder: NodeBuilder): Node; - /** - * The implementation performs the setup of the output node. An output is only - * produces if shadow mapping is globally enabled in the renderer. - * - * @param {NodeBuilder} builder - A reference to the current node builder. - * @return {ShaderCallNodeInternal} The output node. - */ - setup(builder: NodeBuilder): ShaderCallNodeInternal; - /** - * Renders the shadow. The logic of this function could be included - * into {@link ShadowNode#updateShadow} however more specialized shadow - * nodes might require a custom shadow map rendering. By having a - * dedicated method, it's easier to overwrite the default behavior. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - renderShadow(frame: NodeFrame): void; - /** - * Updates the shadow. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateShadow(frame: NodeFrame): void; - _depthVersionCached: any; - /** - * For VSM additional render passes are required. - * - * @param {Renderer} renderer - A reference to the current renderer. - */ - vsmPass(renderer: Renderer): void; - /** - * Resets the resouce state of this shadow node. - * - * @private - */ - private _reset; - /** - * The implementation performs the update of the shadow map if necessary. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - updateBefore(frame: NodeFrame): void; -} -import ShadowBaseNode from './ShadowBaseNode.js'; -import NodeMaterial from '../../materials/nodes/NodeMaterial.js'; -import { DepthTexture } from '../../textures/DepthTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts deleted file mode 100644 index 84f17e937..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/lighting/SpotLightNode.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export default SpotLightNode; -/** - * Module for representing spot lights as nodes. - * - * @augments AnalyticLightNode - */ -declare class SpotLightNode extends AnalyticLightNode { - /** - * Uniform node representing the cone cosine. - * - * @type {UniformNode} - */ - coneCosNode: UniformNode; - /** - * Uniform node representing the penumbra cosine. - * - * @type {UniformNode} - */ - penumbraCosNode: UniformNode; - /** - * Uniform node representing the cutoff distance. - * - * @type {UniformNode} - */ - cutoffDistanceNode: UniformNode; - /** - * Uniform node representing the decay exponent. - * - * @type {UniformNode} - */ - decayExponentNode: UniformNode; - /** - * Overwritten to updated spot light specific uniforms. - * - * @param {NodeFrame} frame - A reference to the current node frame. - */ - update(frame: NodeFrame): void; - /** - * Computes the spot attenuation for the given angle. - * - * @param {NodeBuilder} builder - The node builder. - * @param {Node} angleCosine - The angle to compute the spot attenuation for. - * @return {Node} The spot attenuation. - */ - getSpotAttenuation(builder: NodeBuilder, angleCosine: Node): Node; - getLightCoord(builder: any): any; - setupDirect(builder: any): { - lightColor: any; - lightDirection: any; - }; -} -import AnalyticLightNode from './AnalyticLightNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts deleted file mode 100644 index 27d194964..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColor.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const mx_hsvtorgb: any; -export const mx_rgbtohsv: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts deleted file mode 100644 index 521d93346..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXColorTransform.d.ts +++ /dev/null @@ -1 +0,0 @@ -export const mx_srgb_texture_to_lin_rec709: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts deleted file mode 100644 index 4edb75dc5..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXCore.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function mx_rotate2d(input: any, amount?: number): any; -export function mx_rotate3d(input: any, amount?: number, axis?: any): any; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts deleted file mode 100644 index a9df4cdc0..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNodes.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export function mx_aastep(threshold: any, value: any): any; -export function mx_ramplr(valuel: any, valuer: any, texcoord?: AttributeNode): any; -export function mx_ramptb(valueb: any, valuet: any, texcoord?: AttributeNode): any; -export function mx_ramp4(valuetl: any, valuetr: any, valuebl: any, valuebr: any, texcoord?: AttributeNode): any; -export function mx_splitlr(valuel: any, valuer: any, center: any, texcoord?: AttributeNode): any; -export function mx_splittb(valueb: any, valuet: any, center: any, texcoord?: AttributeNode): any; -export function mx_transform_uv(uv_scale?: number, uv_offset?: number, uv_geo?: AttributeNode): any; -export function mx_safepower(in1: any, in2?: number): any; -export function mx_contrast(input: any, amount?: number, pivot?: number): any; -export function mx_noise_float(texcoord?: AttributeNode, amplitude?: number, pivot?: number): any; -export function mx_noise_vec3(texcoord?: AttributeNode, amplitude?: number, pivot?: number): any; -export function mx_noise_vec4(texcoord?: AttributeNode, amplitude?: number, pivot?: number): any; -export function mx_smoothstep(inNode: any, low?: number, high?: number): any; -export function mx_cell_noise_vec3(texcoord?: AttributeNode): any; -export function mx_worley_noise_float_2d(texcoord?: AttributeNode, jitter?: number, style?: number): void; -export function mx_worley_noise_float_3d(texcoord?: AttributeNode, jitter?: number, style?: number): void; -export function mx_unifiednoise2d(noiseType: any, texcoord?: AttributeNode, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number): void; -export function mx_unifiednoise3d(noiseType: any, texcoord?: AttributeNode, freq?: any, offset?: any, jitter?: number, outmin?: number, outmax?: number, clampoutput?: boolean, octaves?: number, lacunarity?: number, diminish?: number, style?: number): void; -export function mx_worley_noise_float(texcoord?: AttributeNode, jitter?: number, style?: number): void; -export function mx_worley_noise_vec2(texcoord?: AttributeNode, jitter?: number): any; -export function mx_worley_noise_vec3(texcoord?: AttributeNode, jitter?: number, metric?: number): any; -export function mx_worley_noise_vec3_style(texcoord?: AttributeNode, jitter?: number, style?: number, metric?: number): any; -export function mx_cell_noise_float(texcoord?: AttributeNode): any; -export function mx_fractal_noise_float_2d(texcoord?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; -export function mx_fractal_noise_float(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; -export function mx_fractal_noise_vec2(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; -export function mx_fractal_noise_vec3(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; -export function mx_fractal_noise_vec4(position?: AttributeNode, octaves?: number, lacunarity?: number, diminish?: number, amplitude?: number): any; -export function mx_add(in1: any, in2?: any): any; -export function mx_subtract(in1: any, in2?: any): any; -export function mx_multiply(in1: any, in2?: any): any; -export function mx_divide(in1: any, in2?: any): any; -export function mx_modulo(in1: any, in2?: any): any; -export function mx_power(in1: any, in2?: any): any; -export function mx_atan2(in1?: any, in2?: any): any; -export function mx_timer(): UniformNode; -export function mx_frame(): UniformNode; -export function mx_invert(in1: any, amount?: any): any; -export function mx_ifgreater(value1: any, value2: any, in1: any, in2: any): any; -export function mx_ifgreatereq(value1: any, value2: any, in1: any, in2: any): any; -export function mx_ifequal(value1: any, value2: any, in1: any, in2: any): any; -export function mx_separate(in1: any, channelOrOut?: null): any; -export function mx_place2d(texcoord: any, pivot?: any, scale?: any, rotate?: any, offset?: any, operationorder?: any): any; -export function mx_heighttonormal(input: any, scale?: number, texcoord?: AttributeNode): any; -import { mx_rotate2d } from './MaterialXCore.js'; -import { mx_rotate3d } from './MaterialXCore.js'; -import { mx_hsvtorgb } from './MaterialXColor.js'; -import { mx_rgbtohsv } from './MaterialXColor.js'; -import { mx_srgb_texture_to_lin_rec709 } from './MaterialXColorTransform.js'; -export { mx_rotate2d, mx_rotate3d, mx_hsvtorgb, mx_rgbtohsv, mx_srgb_texture_to_lin_rec709 }; diff --git a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts b/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts deleted file mode 100644 index e6cad55ae..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/materialx/MaterialXNoise.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -export const mx_select: any; -export const mx_negate_if: any; -export const mx_floor: any; -export const mx_floorfrac: () => void; -export const mx_bilerp_0: any; -export const mx_bilerp_1: any; -export const mx_bilerp: import("../utils/FunctionOverloadingNode.js").default; -export const mx_trilerp_0: any; -export const mx_trilerp_1: any; -export const mx_trilerp: import("../utils/FunctionOverloadingNode.js").default; -export const mx_gradient_float_0: any; -export const mx_gradient_float_1: any; -export const mx_gradient_float: import("../utils/FunctionOverloadingNode.js").default; -export const mx_gradient_vec3_0: any; -export const mx_gradient_vec3_1: any; -export const mx_gradient_vec3: import("../utils/FunctionOverloadingNode.js").default; -export const mx_gradient_scale2d_0: any; -export const mx_gradient_scale3d_0: any; -export const mx_gradient_scale2d_1: any; -export const mx_gradient_scale2d: import("../utils/FunctionOverloadingNode.js").default; -export const mx_gradient_scale3d_1: any; -export const mx_gradient_scale3d: import("../utils/FunctionOverloadingNode.js").default; -export const mx_rotl32: any; -export const mx_bjmix: any; -export const mx_bjfinal: any; -export const mx_bits_to_01: any; -export const mx_fade: any; -export const mx_hash_int_0: any; -export const mx_hash_int_1: any; -export const mx_hash_int_2: any; -export const mx_hash_int_3: any; -export const mx_hash_int_4: any; -export const mx_hash_int: import("../utils/FunctionOverloadingNode.js").default; -export const mx_hash_vec3_0: any; -export const mx_hash_vec3_1: any; -export const mx_hash_vec3: import("../utils/FunctionOverloadingNode.js").default; -export const mx_perlin_noise_float_0: any; -export const mx_perlin_noise_float_1: any; -export const mx_perlin_noise_float: import("../utils/FunctionOverloadingNode.js").default; -export const mx_perlin_noise_vec3_0: any; -export const mx_perlin_noise_vec3_1: any; -export const mx_perlin_noise_vec3: import("../utils/FunctionOverloadingNode.js").default; -export const mx_cell_noise_float_0: any; -export const mx_cell_noise_float_1: any; -export const mx_cell_noise_float_2: any; -export const mx_cell_noise_float_3: any; -export const mx_cell_noise_float: import("../utils/FunctionOverloadingNode.js").default; -export const mx_cell_noise_vec3_0: any; -export const mx_cell_noise_vec3_1: any; -export const mx_cell_noise_vec3_2: any; -export const mx_cell_noise_vec3_3: any; -export const mx_cell_noise_vec3: import("../utils/FunctionOverloadingNode.js").default; -export const mx_fractal_noise_float_2d: any; -export const mx_fractal_noise_float: any; -export const mx_fractal_noise_vec3: any; -export const mx_fractal_noise_vec2: any; -export const mx_fractal_noise_vec4: any; -export const mx_worley_distance_0: any; -export const mx_worley_distance_1: any; -export const mx_worley_distance: import("../utils/FunctionOverloadingNode.js").default; -export const mx_worley_noise_float_3d: () => void; -export const mx_worley_noise_float_2d: () => void; -export const mx_worley_noise_float: import("../utils/FunctionOverloadingNode.js").default; -export const mx_worley_noise_vec2_0: any; -export const mx_worley_noise_vec3_0: any; -export const mx_worley_noise_vec2_1: any; -export const mx_worley_noise_vec2: import("../utils/FunctionOverloadingNode.js").default; -export const mx_worley_noise_vec3_1: any; -export const mx_worley_noise_vec3: import("../utils/FunctionOverloadingNode.js").default; -export const mx_worley_noise_vec3_style_0: any; -export const mx_worley_noise_vec3_style_1: any; -export const mx_worley_noise_vec3_style: import("../utils/FunctionOverloadingNode.js").default; -export const mx_unifiednoise2d: () => void; -export const mx_unifiednoise3d: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts deleted file mode 100644 index f15d7989b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/BitcastNode.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -export default BitcastNode; -/** - * Reinterpret the bit representation of a value in one type as a value in another type. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @param {string} y - The new type. - * @returns {Node} - */ -export const bitcast: any; -export function floatBitsToInt(value: Node): BitcastNode; -export function floatBitsToUint(value: Node): BitcastNode; -export function intBitsToFloat(value: Node): BitcastNode; -export function uintBitsToFloat(value: Node): BitcastNode; -/** - * This node represents an operation that reinterprets the bit representation of a value - * in one type as a value in another type. - * - * @augments TempNode - */ -declare class BitcastNode extends TempNode { - /** - * Constructs a new bitcast node. - * - * @param {Node} valueNode - The value to convert. - * @param {string} conversionType - The type to convert to. - * @param {?string} [inputType = null] - The expected input data type of the bitcast operation. - */ - constructor(valueNode: Node, conversionType: string, inputType?: string | null); - /** - * The data to bitcast to a new type. - * - * @type {Node} - */ - valueNode: Node; - /** - * The type the value will be converted to. - * - * @type {string} - */ - conversionType: string; - /** - * The expected input data type of the bitcast operation. - * - * - * @type {string} - * @default null - */ - inputType: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBitcastNode: boolean; - generateNodeType(builder: any): any; - generate(builder: any): string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts deleted file mode 100644 index 5a85b0585..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/BitcountNode.d.ts +++ /dev/null @@ -1,111 +0,0 @@ -export default BitcountNode; -/** - * Finds the number of consecutive 0 bits from the least significant bit of the input value, - * which is also the index of the least significant bit of the input value. - * - * Can only be used with {@link WebGPURenderer} and a WebGPU backend. - * - * @tsl - * @function - * @param {Node | number} x - The input value. - * @returns {Node} - */ -export const countTrailingZeros: any; -/** - * Finds the number of consecutive 0 bits starting from the most significant bit of the input value. - * - * Can only be used with {@link WebGPURenderer} and a WebGPU backend. - * - * @tsl - * @function - * @param {Node | number} x - The input value. - * @returns {Node} - */ -export const countLeadingZeros: any; -/** - * Finds the number of '1' bits set in the input value - * - * Can only be used with {@link WebGPURenderer} and a WebGPU backend. - * - * @tsl - * @function - * @returns {Node} - */ -export const countOneBits: any; -/** - * This node represents an operation that counts the bits of a piece of shader data. - * - * @augments MathNode - */ -declare class BitcountNode extends MathNode { - /** - * Constructs a new math node. - * - * @param {'countTrailingZeros'|'countLeadingZeros'|'countOneBits'} method - The method name. - * @param {Node} aNode - The first input. - */ - constructor(method: "countTrailingZeros" | "countLeadingZeros" | "countOneBits", aNode: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBitcountNode: boolean; - /** - * Casts the input value of the function to an integer if necessary. - * - * @private - * @param {Node|Node} inputNode - The input value. - * @param {Node} outputNode - The output value. - * @param {string} elementType - The type of the input value. - */ - private _resolveElementType; - _returnDataNode(inputType: any): any; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of countTrailingZeros. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} elementType - The type of the input value. - * @returns {Function} - The generated function - */ - private _createTrailingZerosBaseLayout; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of countLeadingZeros. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} elementType - The type of the input value. - * @returns {Function} - The generated function - */ - private _createLeadingZerosBaseLayout; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of countOneBits. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} elementType - The type of the input value. - * @returns {Function} - The generated function - */ - private _createOneBitsBaseLayout; - /** - * Creates and registers a reusable GLSL function that emulates the behavior of the specified bitcount function. - * including considerations for component-wise bitcounts on vector type inputs. - * - * @private - * @param {string} method - The name of the function to create. - * @param {string} inputType - The type of the input value. - * @param {number} typeLength - The vec length of the input value. - * @param {Function} baseFn - The base function that operates on an individual component of the vector. - * @returns {Function} - The alias function for the specified bitcount method. - */ - private _createMainLayout; -} -declare namespace BitcountNode { - let COUNT_TRAILING_ZEROS: string; - let COUNT_LEADING_ZEROS: string; - let COUNT_ONE_BITS: string; -} -import MathNode from './MathNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts deleted file mode 100644 index 25e21f3e9..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/ConditionalNode.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -export default ConditionalNode; -/** - * TSL function for creating a conditional node. - * - * @tsl - * @function - * @param {Node} condNode - The node that defines the condition. - * @param {Node} ifNode - The node that is evaluate when the condition ends up `true`. - * @param {?Node} [elseNode=null] - The node that is evaluate when the condition ends up `false`. - * @returns {ConditionalNode} - */ -export const select: any; -/** - * Represents a logical `if/else` statement. Can be used as an alternative - * to the `If()`/`Else()` syntax. - * - * The `select()` method is called in a chaining fashion on a condition. The parameter nodes of `select()` - * determine the outcome of the entire statement. - * - * ```js - * velocity = position.greaterThanEqual( limit ).select( velocity.negate(), velocity ); - * ``` - * - * @augments Node - */ -declare class ConditionalNode extends Node { - /** - * Constructs a new conditional node. - * - * @param {Node} condNode - The node that defines the condition. - * @param {Node} ifNode - The node that is evaluate when the condition ends up `true`. - * @param {?Node} [elseNode=null] - The node that is evaluate when the condition ends up `false`. - */ - constructor(condNode: Node, ifNode: Node, elseNode?: Node | null); - /** - * The node that defines the condition. - * - * @type {Node} - */ - condNode: Node; - /** - * The node that is evaluate when the condition ends up `true`. - * - * @type {Node} - */ - ifNode: Node; - /** - * The node that is evaluate when the condition ends up `false`. - * - * @type {?Node} - * @default null - */ - elseNode: Node | null; - /** - * This method is overwritten since the node type is inferred from the if/else - * nodes. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - setup(builder: any): void; - generate(builder: any, output: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts deleted file mode 100644 index e42866ba8..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/Hash.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Generates a hash value in the range `[0, 1]` from the given seed. - * - * @tsl - * @function - * @param {Node} seed - The seed. - * @return {Node} The hash value. - */ -export const hash: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts deleted file mode 100644 index 7311ec733..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/MathNode.d.ts +++ /dev/null @@ -1,703 +0,0 @@ -export default MathNode; -/** - * A small value used to handle floating-point precision errors. - * - * @tsl - * @type {Node} - */ -export const EPSILON: Node; -/** - * Represents infinity. - * - * @tsl - * @type {Node} - */ -export const INFINITY: Node; -/** - * Represents PI. - * - * @tsl - * @type {Node} - */ -export const PI: Node; -/** - * Represents PI * 2. Please use the non-deprecated version `TWO_PI`. - * - * @tsl - * @deprecated - * @type {Node} - */ -export const PI2: Node; -/** - * Represents PI * 2. - * - * @tsl - * @type {Node} - */ -export const TWO_PI: Node; -/** - * Represents PI / 2. - * - * @tsl - * @type {Node} - */ -export const HALF_PI: Node; -/** - * Returns `true` if all components of `x` are `true`. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const all: any; -/** - * Returns `true` if any components of `x` are `true`. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const any: any; -/** - * Converts a quantity in degrees to radians. - * - * @tsl - * @function - * @param {Node | number} x - The input in degrees. - * @returns {Node} - */ -export const radians: any; -/** - * Convert a quantity in radians to degrees. - * - * @tsl - * @function - * @param {Node | number} x - The input in radians. - * @returns {Node} - */ -export const degrees: any; -/** - * Returns the natural exponentiation of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const exp: any; -/** - * Returns 2 raised to the power of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const exp2: any; -/** - * Returns the natural logarithm of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const log: any; -/** - * Returns the base 2 logarithm of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const log2: any; -/** - * Returns the square root of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const sqrt: any; -/** - * Returns the inverse of the square root of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const inverseSqrt: any; -/** - * Finds the nearest integer less than or equal to the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const floor: any; -/** - * Finds the nearest integer that is greater than or equal to the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const ceil: any; -/** - * Calculates the unit vector in the same direction as the original vector. - * - * @tsl - * @function - * @param {Node} x - The input vector. - * @returns {Node} - */ -export const normalize: any; -/** - * Computes the fractional part of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const fract: any; -/** - * Returns the sine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const sin: any; -/** - * Returns the hyperbolic sine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const sinh: any; -/** - * Returns the cosine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const cos: any; -/** - * Returns the hyperbolic cosine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const cosh: any; -/** - * Returns the tangent of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const tan: any; -/** - * Returns the hyperbolic tangent of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const tanh: any; -/** - * Returns the arcsine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const asin: any; -/** - * Returns the inverse hyperbolic sine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const asinh: any; -/** - * Returns the arccosine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const acos: any; -/** - * Returns the inverse hyperbolic cosine of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const acosh: any; -/** - * Returns the arc-tangent of the parameter. - * If two parameters are provided, the result is `atan2(y/x)`. - * - * @tsl - * @function - * @param {Node | number} y - The y parameter. - * @param {?(Node | number)} x - The x parameter. - * @returns {Node} - */ -export const atan: any; -/** - * Returns the inverse hyperbolic tangent of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const atanh: any; -/** - * Returns the absolute value of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const abs: any; -/** - * Extracts the sign of the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const sign: any; -/** - * Calculates the length of a vector. - * - * @tsl - * @function - * @param {Node} x - The parameter. - * @returns {Node} - */ -export const length: any; -/** - * Negates the value of the parameter (-x). - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const negate: any; -/** - * Return `1` minus the parameter. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const oneMinus: any; -/** - * Returns the partial derivative of the parameter with respect to x. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const dFdx: any; -/** - * Returns the partial derivative of the parameter with respect to y. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const dFdy: any; -/** - * Rounds the parameter to the nearest integer. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const round: any; -/** - * Returns the reciprocal of the parameter `(1/x)`. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const reciprocal: any; -/** - * Truncates the parameter, removing the fractional part. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const trunc: any; -/** - * Returns the sum of the absolute derivatives in x and y. - * - * @tsl - * @function - * @param {Node | number} x - The parameter. - * @returns {Node} - */ -export const fwidth: any; -/** - * Returns the transpose of a matrix. - * - * @tsl - * @function - * @param {Node} x - The parameter. - * @returns {Node} - */ -export const transpose: any; -/** - * Returns the determinant of a matrix. - * - * @tsl - * @function - * @param {Node} x - The parameter. - * @returns {Node} - */ -export const determinant: any; -/** - * Returns the inverse of a matrix. - * - * @tsl - * @function - * @param {Node} x - The parameter. - * @returns {Node} - */ -export const inverse: any; -/** - * Returns the least of the given values. - * - * @tsl - * @function - * @param {...(Node | number)} values - The values to compare. - * @returns {Node} - */ -export const min: any; -/** - * Returns the greatest of the given values. - * - * @tsl - * @function - * @param {...(Node | number)} values - The values to compare. - * @returns {Node} - */ -export const max: any; -/** - * Generate a step function by comparing two values. - * - * @tsl - * @function - * @param {Node | number} x - The y parameter. - * @param {Node | number} y - The x parameter. - * @returns {Node} - */ -export const step: any; -/** - * Calculates the reflection direction for an incident vector. - * - * @tsl - * @function - * @param {Node} I - The incident vector. - * @param {Node} N - The normal vector. - * @returns {Node} - */ -export const reflect: any; -/** - * Calculates the distance between two points. - * - * @tsl - * @function - * @param {Node} x - The first point. - * @param {Node} y - The second point. - * @returns {Node} - */ -export const distance: any; -/** - * Calculates the absolute difference between two values. - * - * @tsl - * @function - * @param {Node | number} x - The first parameter. - * @param {Node | number} y - The second parameter. - * @returns {Node} - */ -export const difference: any; -/** - * Calculates the dot product of two vectors. - * - * @tsl - * @function - * @param {Node} x - The first vector. - * @param {Node} y - The second vector. - * @returns {Node} - */ -export const dot: any; -/** - * Calculates the cross product of two vectors. - * - * @tsl - * @function - * @param {Node} x - The first vector. - * @param {Node} y - The second vector. - * @returns {Node} - */ -export const cross: any; -/** - * Return the value of the first parameter raised to the power of the second one. - * - * @tsl - * @function - * @param {Node | number} x - The first parameter. - * @param {Node | number} y - The second parameter. - * @returns {Node} - */ -export const pow: any; -export function pow2(x: Node | number): Node; -export function pow3(x: Node | number): Node; -export function pow4(x: Node | number): Node; -/** - * Transforms the direction of a vector by a matrix and then normalizes the result. - * - * @tsl - * @function - * @param {Node} direction - The direction vector. - * @param {Node} matrix - The transformation matrix. - * @returns {Node} - */ -export const transformDirection: any; -export function transformNormalByViewMatrix(normal: Node, viewMatrix: Node): Node; -export function transformNormalByInverseViewMatrix(normal: Node, viewMatrix: Node): Node; -export function cbrt(a: Node | number): Node; -export function lengthSq(a: Node): Node; -/** - * Linearly interpolates between two values. - * - * @tsl - * @function - * @param {Node | number} a - The first parameter. - * @param {Node | number} b - The second parameter. - * @param {Node | number} t - The interpolation value. - * @returns {Node} - */ -export const mix: any; -export function clamp(value: Node | number, low?: Node | number, high?: Node | number): Node; -export function saturate(value: Node | number): Node; -/** - * Calculates the refraction direction for an incident vector. - * - * @tsl - * @function - * @param {Node} I - The incident vector. - * @param {Node} N - The normal vector. - * @param {Node} eta - The ratio of indices of refraction. - * @returns {Node} - */ -export const refract: any; -/** - * Performs a Hermite interpolation between two values. - * - * @tsl - * @function - * @param {Node | number} low - The value of the lower edge of the Hermite function. - * @param {Node | number} high - The value of the upper edge of the Hermite function. - * @param {Node | number} x - The source value for interpolation. - * @returns {Node} - */ -export const smoothstep: any; -/** - * Returns a vector pointing in the same direction as another. - * - * @tsl - * @function - * @param {Node} N - The vector to orient. - * @param {Node} I - The incident vector. - * @param {Node} Nref - The reference vector. - * @returns {Node} - */ -export const faceForward: any; -/** - * Returns a random value for the given uv. - * - * @tsl - * @function - * @param {Node} uv - The uv node. - * @returns {Node} - */ -export const rand: () => void; -export function mixElement(t: Node | number, e1: Node | number, e2: Node | number): Node; -export function smoothstepElement(x: Node | number, low: Node | number, high: Node | number): Node; -export function stepElement(x: Node | number, edge: Node | number): Node; -export const faceforward: any; -export const inversesqrt: any; -/** - * This node represents a variety of mathematical methods available in shaders. - * They are divided into three categories: - * - * - Methods with one input like `sin`, `cos` or `normalize`. - * - Methods with two inputs like `dot`, `cross` or `pow`. - * - Methods with three inputs like `mix`, `clamp` or `smoothstep`. - * - * @augments TempNode - */ -declare class MathNode extends TempNode { - /** - * Constructs a new math node. - * - * @param {string} method - The method name. - * @param {Node} aNode - The first input. - * @param {?Node} [bNode=null] - The second input. - * @param {?Node} [cNode=null] - The third input. - */ - constructor(method: string, aNode: Node, bNode?: Node | null, cNode?: Node | null, ...args: any[]); - /** - * The method name. - * - * @type {string} - */ - method: string; - /** - * The first input. - * - * @type {Node} - */ - aNode: Node; - /** - * The second input. - * - * @type {?Node} - * @default null - */ - bNode: Node | null; - /** - * The third input. - * - * @type {?Node} - * @default null - */ - cNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMathNode: boolean; - /** - * The input type is inferred from the node types of the input nodes. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The input type. - */ - getInputType(builder: NodeBuilder): string; - /** - * The selected method as well as the input type determine the node type of this node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - setup(builder: any): any; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -declare namespace MathNode { - let ALL: string; - let ANY: string; - let RADIANS: string; - let DEGREES: string; - let EXP: string; - let EXP2: string; - let LOG: string; - let LOG2: string; - let SQRT: string; - let INVERSE_SQRT: string; - let FLOOR: string; - let CEIL: string; - let NORMALIZE: string; - let FRACT: string; - let SIN: string; - let SINH: string; - let COS: string; - let COSH: string; - let TAN: string; - let TANH: string; - let ASIN: string; - let ASINH: string; - let ACOS: string; - let ACOSH: string; - let ATAN: string; - let ATANH: string; - let ABS: string; - let SIGN: string; - let LENGTH: string; - let NEGATE: string; - let ONE_MINUS: string; - let DFDX: string; - let DFDY: string; - let ROUND: string; - let RECIPROCAL: string; - let TRUNC: string; - let FWIDTH: string; - let TRANSPOSE: string; - let DETERMINANT: string; - let INVERSE: string; - let EQUALS: string; - let MIN: string; - let MAX: string; - let STEP: string; - let REFLECT: string; - let DISTANCE: string; - let DIFFERENCE: string; - let DOT: string; - let CROSS: string; - let POW: string; - let TRANSFORM_DIRECTION: string; - let MIX: string; - let CLAMP: string; - let REFRACT: string; - let SMOOTHSTEP: string; - let FACEFORWARD: string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts deleted file mode 100644 index 69ed7ec52..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/MathUtils.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function parabola(x: Node, k: Node): Node; -export function gain(x: Node, k: Node): Node; -export function pcurve(x: Node, a: Node, b: Node): Node; -export function sinc(x: Node, k: Node): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts deleted file mode 100644 index 34ed2e4b4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/OperatorNode.d.ts +++ /dev/null @@ -1,312 +0,0 @@ -export default OperatorNode; -/** - * Returns the addition of two or more value. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @param {...Node} params - Additional input parameters. - * @returns {OperatorNode} - */ -export const add: any; -/** - * Returns the subtraction of two or more value. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @param {...Node} params - Additional input parameters. - * @returns {OperatorNode} - */ -export const sub: any; -/** - * Returns the multiplication of two or more value. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @param {...Node} params - Additional input parameters. - * @returns {OperatorNode} - */ -export const mul: any; -/** - * Returns the division of two or more value. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @param {...Node} params - Additional input parameters. - * @returns {OperatorNode} - */ -export const div: any; -/** - * Computes the remainder of dividing the first node by the second one. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const mod: any; -/** - * Checks if two nodes are equal. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const equal: any; -/** - * Checks if two nodes are not equal. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const notEqual: any; -/** - * Checks if the first node is less than the second. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const lessThan: any; -/** - * Checks if the first node is greater than the second. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const greaterThan: any; -/** - * Checks if the first node is less than or equal to the second. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const lessThanEqual: any; -/** - * Checks if the first node is greater than or equal to the second. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const greaterThanEqual: any; -/** - * Performs a logical AND operation on multiple nodes. - * - * @tsl - * @function - * @param {...Node} nodes - The input nodes to be combined using AND. - * @returns {OperatorNode} - */ -export const and: any; -/** - * Performs a logical OR operation on multiple nodes. - * - * @tsl - * @function - * @param {...Node} nodes - The input nodes to be combined using OR. - * @returns {OperatorNode} - */ -export const or: any; -/** - * Performs logical NOT on a node. - * - * @tsl - * @function - * @param {Node} value - The value. - * @returns {OperatorNode} - */ -export const not: any; -/** - * Performs logical XOR on two nodes. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const xor: any; -/** - * Performs bitwise AND on two nodes. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const bitAnd: any; -/** - * Performs bitwise NOT on a node. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const bitNot: any; -/** - * Performs bitwise OR on two nodes. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const bitOr: any; -/** - * Performs bitwise XOR on two nodes. - * - * @tsl - * @function - * @param {Node} a - The first input. - * @param {Node} b - The second input. - * @returns {OperatorNode} - */ -export const bitXor: any; -/** - * Shifts a node to the left. - * - * @tsl - * @function - * @param {Node} a - The node to shift. - * @param {Node} b - The value to shift. - * @returns {OperatorNode} - */ -export const shiftLeft: any; -/** - * Shifts a node to the right. - * - * @tsl - * @function - * @param {Node} a - The node to shift. - * @param {Node} b - The value to shift. - * @returns {OperatorNode} - */ -export const shiftRight: any; -/** - * Increments a node by 1. - * - * @tsl - * @function - * @param {Node} a - The node to increment. - * @returns {OperatorNode} - */ -export const incrementBefore: () => void; -/** - * Decrements a node by 1. - * - * @tsl - * @function - * @param {Node} a - The node to decrement. - * @returns {OperatorNode} - */ -export const decrementBefore: () => void; -/** - * Increments a node by 1 and returns the previous value. - * - * @tsl - * @function - * @param {Node} a - The node to increment. - * @returns {OperatorNode} - */ -export const increment: () => void; -/** - * Decrements a node by 1 and returns the previous value. - * - * @tsl - * @function - * @param {Node} a - The node to decrement. - * @returns {OperatorNode} - */ -export const decrement: () => void; -/** - * This node represents basic mathematical and logical operations like addition, - * subtraction or comparisons (e.g. `equal()`). - * - * @augments TempNode - */ -declare class OperatorNode extends TempNode { - /** - * Constructs a new operator node. - * - * @param {string} op - The operator. - * @param {Node} aNode - The first input. - * @param {Node} bNode - The second input. - * @param {...Node} params - Additional input parameters. - */ - constructor(op: string, aNode: Node, bNode: Node, ...params: Node[]); - /** - * The operator. - * - * @type {string} - */ - op: string; - /** - * The first input. - * - * @type {Node} - */ - aNode: Node; - /** - * The second input. - * - * @type {Node} - */ - bNode: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isOperatorNode: boolean; - /** - * Returns the operator method name. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} output - The output type. - * @returns {string} The operator method name. - */ - getOperatorMethod(builder: NodeBuilder, output: string): string; - /** - * This method is overwritten since the node type is inferred from the operator - * and the input node types. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {?string} [output=null] - The output type. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder, output?: string | null): string; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts deleted file mode 100644 index d9b190a16..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/PackFloatNode.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -export default PackFloatNode; -/** - * Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. - * round(clamp(c, -1, +1) * 32767.0) - * - * @tsl - * @function - * @param {Node} value - The 2-component vector to be packed - * @returns {Node} - */ -export const packSnorm2x16: any; -/** - * Converts each component of the normalized float to 16-bit integer values. The results are packed into a single unsigned integer. - * round(clamp(c, 0, +1) * 65535.0) - * - * @tsl - * @function - * @param {Node} value - The 2-component vector to be packed - * @returns {Node} - */ -export const packUnorm2x16: any; -/** - * Converts each component of the vec2 to 16-bit floating-point values. The results are packed into a single unsigned integer. - * - * @tsl - * @function - * @param {Node} value - The 2-component vector to be packed - * @returns {Node} - */ -export const packHalf2x16: any; -/** - * Converts each component of the normalized float to 8-bit integer values. The results are packed into a single unsigned integer. - * - * @tsl - * @function - * @param {Node} value - The 4-component vector to be packed - * @returns {Node} - */ -export const packSnorm4x8: any; -/** - * Converts each component of the normalized float to 8-bit integer values. The results are packed into a single unsigned integer. - * - * @tsl - * @function - * @param {Node} value - The 4-component vector to be packed - * @returns {Node} - */ -export const packUnorm4x8: any; -/** - * This node represents an operation that packs floating-point values of a vector into an unsigned 32-bit integer - * - * @augments TempNode - */ -declare class PackFloatNode extends TempNode { - /** - * - * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the float values are mapped to the integer range. - * @param {Node} vectorNode - The vector node to be packed - */ - constructor(encoding: "snorm" | "unorm" | "float16", vectorNode: Node); - /** - * The vector to be packed. - * - * @type {Node} - */ - vectorNode: Node; - /** - * The numeric encoding. - * - * @type {string} - */ - encoding: string; - /** - * The component layout of the packed integer. - * - * @type {'2x16' | '4x8'} - * @default '2x16' - */ - layout: "2x16" | "4x8"; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPackFloatNode: boolean; - generateNodeType(): string; - generate(builder: any): string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts deleted file mode 100644 index 15dad5e5f..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/TriNoise3D.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Generates a noise value from the given position, speed and time parameters. - * - * @tsl - * @function - * @param {Node} position - The position. - * @param {Node} speed - The speed. - * @param {Node} time - The time. - * @return {Node} The generated noise. - */ -export const triNoise3D: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts deleted file mode 100644 index 198e08bc4..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/math/UnpackFloatNode.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -export default UnpackFloatNode; -/** - * Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized signed integers. Returns a vec2 with both values. - * - * @tsl - * @function - * @param {Node} value - The unsigned integer to be unpacked - * @returns {Node} - */ -export const unpackSnorm2x16: any; -/** - * Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as normalized unsigned integers. Returns a vec2 with both values. - * - * @tsl - * @function - * @param {Node} value - The unsigned integer to be unpacked - * @returns {Node} - */ -export const unpackUnorm2x16: any; -/** - * Unpacks a 32-bit unsigned integer into two 16-bit values, interpreted as 16-bit floating-point numbers. Returns a vec2 with both values. - * - * @tsl - * @function - * @param {Node} value - The unsigned integer to be unpacked - * @returns {Node} - */ -export const unpackHalf2x16: any; -/** - * Unpacks a 32-bit unsigned integer into four 8-bit values, interpreted as normalized signed integers. Returns a vec4 with all values. - * - * @tsl - * @function - * @param {Node} value - The unsigned integer to be unpacked - * @returns {Node} - */ -export const unpackSnorm4x8: any; -/** - * Unpacks a 32-bit unsigned integer into four 8-bit values, interpreted as normalized unsigned integers. Returns a vec4 with all values. - * - * @tsl - * @function - * @param {Node} value - The unsigned integer to be unpacked - * @returns {Node} - */ -export const unpackUnorm4x8: any; -/** - * This node represents an operation that unpacks values from a 32-bit unsigned integer, reinterpreting the results as a floating-point vector - * - * @augments TempNode - */ -declare class UnpackFloatNode extends TempNode { - /** - * - * @param {'snorm' | 'unorm' | 'float16'} encoding - The numeric encoding that describes how the integer values are mapped to the float range - * @param {Node} uintNode - The uint node to be unpacked - */ - constructor(encoding: "snorm" | "unorm" | "float16", uintNode: Node); - /** - * The unsigned integer to be unpacked. - * - * @type {Node} - */ - uintNode: Node; - /** - * The numeric encoding. - * - * @type {string} - */ - encoding: string; - /** - * The component layout of the packed integer. - * - * @type {'2x16' | '4x8'} - * @default '2x16' - */ - layout: "2x16" | "4x8"; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUnpackFloatNode: boolean; - generateNodeType(): "vec2" | "vec4"; - generate(builder: any): string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts b/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts deleted file mode 100644 index 3b3ed5efe..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeFunction.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default GLSLNodeFunction; -/** - * This class represents a GLSL node function. - * - * @augments NodeFunction - */ -declare class GLSLNodeFunction extends NodeFunction { - /** - * Constructs a new GLSL node function. - * - * @param {string} source - The GLSL source. - */ - constructor(source: string); - inputsCode: any; - blockCode: any; - headerCode: any; - /** - * This method returns the GLSL code of the node function. - * - * @param {string} [name=this.name] - The function's name. - * @return {string} The shader code. - */ - getCode(name?: string): string; -} -import NodeFunction from '../core/NodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts b/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts deleted file mode 100644 index 4219e9d0e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/parsers/GLSLNodeParser.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export default GLSLNodeParser; -/** - * A GLSL node parser. - * - * @augments NodeParser - */ -declare class GLSLNodeParser extends NodeParser { - /** - * The method parses the given GLSL code an returns a node function. - * - * @param {string} source - The GLSL code. - * @return {GLSLNodeFunction} A node function. - */ - parseFunction(source: string): GLSLNodeFunction; -} -import NodeParser from '../core/NodeParser.js'; -import GLSLNodeFunction from './GLSLNodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts deleted file mode 100644 index 0ddba7546..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMNode.d.ts +++ /dev/null @@ -1,113 +0,0 @@ -export default PMREMNode; -/** - * TSL function for creating a PMREM node. - * - * @tsl - * @function - * @param {Texture} value - The input texture. - * @param {?Node} [uvNode=null] - The uv node. - * @param {?Node} [levelNode=null] - The level node. - * @returns {PMREMNode} - */ -export const pmremTexture: any; -/** - * This node represents a PMREM which is a special type of preprocessed - * environment map intended for PBR materials. - * - * ```js - * const material = new MeshStandardNodeMaterial(); - * material.envNode = pmremTexture( envMap ); - * ``` - * - * @augments TempNode - */ -declare class PMREMNode extends TempNode { - /** - * Constructs a new function overloading node. - * - * @param {Texture} value - The input texture. - * @param {Node} [uvNode=null] - The uv node. - * @param {Node} [levelNode=null] - The level node. - */ - constructor(value: Texture, uvNode?: Node, levelNode?: Node); - /** - * Reference to the input texture. - * - * @private - * @type {Texture} - */ - private _value; - /** - * Reference to the generated PMREM. - * - * @private - * @type {Texture | null} - * @default null - */ - private _pmrem; - /** - * The uv node. - * - * @type {Node} - */ - uvNode: Node; - /** - * The level node. - * - * @type {Node} - */ - levelNode: Node; - /** - * Reference to a PMREM generator. - * - * @private - * @type {?PMREMGenerator} - * @default null - */ - private _generator; - /** - * The texture node holding the generated PMREM. - * - * @private - * @type {TextureNode} - */ - private _texture; - /** - * A uniform representing the PMREM's width. - * - * @private - * @type {UniformNode} - */ - private _width; - /** - * A uniform representing the PMREM's height. - * - * @private - * @type {UniformNode} - */ - private _height; - /** - * A uniform representing the PMREM's max Mip. - * - * @private - * @type {UniformNode} - */ - private _maxMip; - set value(value: Texture); - /** - * The node's texture value. - * - * @type {Texture} - */ - get value(): Texture; - /** - * Uses the given PMREM texture to update internal values. - * - * @param {Texture} texture - The PMREM texture. - */ - updateFromTexture(texture: Texture): void; - updateBefore(frame: any): void; - setup(builder: any): void; -} -import TempNode from '../core/TempNode.js'; -import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts deleted file mode 100644 index 28e9913e8..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/pmrem/PMREMUtils.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const textureCubeUV: () => void; -export const sphericalGaussianBlur: () => void; -export const ggxConvolution: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts b/jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts deleted file mode 100644 index 622cf3968..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/procedural/Checker.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Creates a 2x2 checkerboard pattern that can be used as procedural texture data. - * - * @tsl - * @function - * @param {Node} coord - The uv coordinates. - * @return {Node} The result data. - */ -export const checker: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts b/jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts deleted file mode 100644 index 0777cf76d..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/shapes/Shapes.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Generates a circle based on the uv coordinates. - * - * @tsl - * @function - * @param {Node} coord - The uv to generate the circle. - * @return {Node} The circle shape. - */ -export const shapeCircle: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts b/jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts deleted file mode 100644 index cbad0a788..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/tsl/TSLBase.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export function addNodeElement(name: any): void; -export * from "./TSLCore.js"; -export * from "../core/ArrayNode.js"; -export * from "../core/UniformNode.js"; -export * from "../core/PropertyNode.js"; -export * from "../core/AssignNode.js"; -export * from "../code/FunctionCallNode.js"; -export * from "../math/OperatorNode.js"; -export * from "../math/MathNode.js"; -export * from "../math/ConditionalNode.js"; -export * from "../core/ContextNode.js"; -export * from "../core/VarNode.js"; -export * from "../core/VaryingNode.js"; -export * from "../display/ColorSpaceNode.js"; -export * from "../display/ToneMappingNode.js"; -export * from "../accessors/BufferAttributeNode.js"; -export * from "../gpgpu/ComputeNode.js"; -export * from "../core/IsolateNode.js"; -export * from "../core/BypassNode.js"; -export * from "../utils/Remap.js"; -export * from "../code/ExpressionNode.js"; -export * from "../utils/Discard.js"; -export * from "../display/RenderOutputNode.js"; -export * from "../utils/DebugNode.js"; -export * from "../core/SubBuildNode.js"; -export * from "../core/InspectorNode.js"; diff --git a/jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts b/jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts deleted file mode 100644 index 9fb1bc989..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/tsl/TSLCore.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -export function addMethodChaining(name: any, nodeElement: any): void; -export function defined(value: any): boolean; -export function ShaderNode(jsFunc: any, nodeType: any): ShaderNodeInternal; -export function Fn(jsFunc: any, layout?: null): () => void; -/** - * Add the given node to the current stack. - * - * @param {Node} node - The node to add. - * @returns {Node} The node that was added to the stack. - */ -export function Stack(node: Node): Node; -export function getConstNodeType(value: any): any; -export function nodeObject(val: any, altType?: null): any; -export function nodeObjectIntent(val: any, altType?: null): any; -export function nodeObjects(val: any, altType?: null): any; -export function nodeArray(val: any, altType?: null): any; -export function nodeProxy(NodeClass: any, scope?: null, factor?: null, settings?: null): any; -export function nodeImmutable(NodeClass: any, ...params: any[]): any; -export function nodeProxyIntent(NodeClass: any, scope?: null, factor?: null, settings?: {}): any; -export function nodeProxyConstructor(constructorFunction: any, nodeInstance: any): any; -export function setCurrentStack(stack: any): void; -export function getCurrentStack(): any; -export function If(...params: any[]): StackNode; -export function Switch(...params: any[]): StackNode; -export const color: any; -export const float: any; -export const int: any; -export const uint: any; -export const bool: any; -export const vec2: any; -export const ivec2: any; -export const uvec2: any; -export const bvec2: any; -export const vec3: any; -export const ivec3: any; -export const uvec3: any; -export const bvec3: any; -export const vec4: any; -export const ivec4: any; -export const uvec4: any; -export const bvec4: any; -export const mat2: any; -export const mat3: any; -export const mat4: any; -export const element: any; -export function convert(node: any, types: any): ConvertNode; -export function split(node: any, channels: any): SplitNode; -declare class ShaderNodeInternal extends Node { - constructor(jsFunc: any, nodeType: any); - jsFunc: any; - layout: any; - once: boolean; - setLayout(layout: any): this; - getLayout(): any; - call(rawInputs?: null): ShaderCallNodeInternal; - setup(): ShaderCallNodeInternal; -} -import Node from '../core/Node.js'; -import ConvertNode from '../utils/ConvertNode.js'; -import SplitNode from '../utils/SplitNode.js'; -declare class ShaderCallNodeInternal extends Node { - constructor(shaderNode: any, rawInputs: any); - shaderNode: any; - rawInputs: any; - isShaderCallNodeInternal: boolean; - generateNodeType(builder: any): any; - getElementType(builder: any): any; - getMemberType(builder: any, name: any): any; - call(builder: any): any; - setupOutput(builder: any): any; - getOutputNode(builder: any): any; - build(builder: any, output?: null): any; -} -export {}; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts deleted file mode 100644 index e5669d2f2..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/ArrayElementNode.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -export default ArrayElementNode; -/** - * Base class for representing element access on an array-like - * node data structures. - * - * @augments Node - */ -declare class ArrayElementNode extends Node { - /** - * Constructs an array element node. - * - * @param {Node} node - The array-like node. - * @param {Node} indexNode - The index node that defines the element access. - */ - constructor(node: Node, indexNode: Node); - /** - * The array-like node. - * - * @type {Node} - */ - node: Node; - /** - * The index node that defines the element access. - * - * @type {Node} - */ - indexNode: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isArrayElementNode: boolean; - /** - * This method is overwritten since the node type is inferred from the array-like node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * This method is overwritten since the member type is inferred from the array-like node. - * - * @param {NodeBuilder} builder - The current node builder. - * @param {string} name - The member name. - * @return {string} The member type. - */ - getMemberType(builder: NodeBuilder, name: string): string; - generate(builder: any): string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts deleted file mode 100644 index 77f0ea2f7..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/ConvertNode.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default ConvertNode; -/** - * This module is part of the TSL core and usually not used in app level code. - * It represents a convert operation during the shader generation process - * meaning it converts the data type of a node to a target data type. - * - * @augments Node - */ -declare class ConvertNode extends Node { - /** - * Constructs a new convert node. - * - * @param {Node} node - The node which type should be converted. - * @param {string} convertTo - The target node type. Multiple types can be defined by separating them with a `|` sign. - */ - constructor(node: Node, convertTo: string); - /** - * The node which type should be converted. - * - * @type {Node} - */ - node: Node; - /** - * The target node type. Multiple types can be defined by separating them with a `|` sign. - * - * @type {string} - */ - convertTo: string; - /** - * This method is overwritten since the implementation tries to infer the best - * matching type from the {@link ConvertNode#convertTo} property. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - serialize(data: any): void; - deserialize(data: any): void; - generate(builder: any, output: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts deleted file mode 100644 index a24a72427..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/CubeMapNode.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -export default CubeMapNode; -/** - * TSL function for creating a cube map node. - * - * @tsl - * @function - * @param {Node} envNode - The node representing the environment map. - * @returns {CubeMapNode} - */ -export const cubeMapNode: any; -/** - * This node can be used to automatically convert environment maps in the - * equirectangular format into the cube map format. - * - * @augments TempNode - */ -declare class CubeMapNode extends TempNode { - /** - * Constructs a new cube map node. - * - * @param {Node} envNode - The node representing the environment map. - */ - constructor(envNode: Node); - /** - * The node representing the environment map. - * - * @type {Node} - */ - envNode: Node; - /** - * A reference to the internal cube texture. - * - * @private - * @type {?CubeTexture} - * @default null - */ - private _cubeTexture; - /** - * A reference to the internal cube texture node. - * - * @private - * @type {CubeTextureNode} - */ - private _cubeTextureNode; - /** - * A default cube texture that acts as a placeholder. - * It is used when the conversion from equirectangular to cube - * map has not finished yet for a given texture. - * - * @private - * @type {CubeTexture} - */ - private _defaultTexture; - updateBefore(frame: any): void; - setup(builder: any): CubeTextureNode; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts deleted file mode 100644 index 526033e08..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/DebugNode.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export default DebugNode; -export function debug(node: Node, callback?: Function | null): DebugNode; -declare class DebugNode extends TempNode { - constructor(node: any, callback?: null); - node: any; - callback: any; - generateNodeType(builder: any): any; - setup(builder: any): any; - analyze(builder: any): any; - generate(builder: any): any; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts deleted file mode 100644 index 2d21a4048..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/Discard.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export function Discard(conditional: ConditionalNode | null): Node; -export function Return(): ExpressionNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts deleted file mode 100644 index 32dc240ff..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/EquirectUV.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * TSL function for creating an equirect uv node. - * - * Can be used to compute texture coordinates for projecting an - * equirectangular texture onto a mesh for using it as the scene's - * background. - * - * ```js - * scene.backgroundNode = texture( equirectTexture, equirectUV() ); - * ``` - * - * @tsl - * @function - * @param {?Node} [direction=positionWorldDirection] - A direction vector for sampling which is by default `positionWorldDirection`. - * @returns {Node} - */ -export const equirectUV: () => void; -/** - * TSL function for creating an equirect direction node. - * - * Can be used to compute a direction vector from the given equirectangular - * UV coordinates. - * - * @tsl - * @function - * @param {?Node} [uv=UV()] - The equirectangular UV coordinates. - * @returns {Node} The computed direction vector. - */ -export const equirectDirection: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts deleted file mode 100644 index 9c9a75232..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/EventNode.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export default EventNode; -export function OnObjectUpdate(callback: Function): EventNode; -export function OnMaterialUpdate(callback: Function): EventNode; -export function OnFrameUpdate(callback: Function): EventNode; -export function OnAfterObjectUpdate(callback: Function): EventNode; -export function OnBeforeObjectUpdate(callback: Function): EventNode; -export function OnBeforeMaterialUpdate(callback: Function): EventNode; -export function OnBeforeFrameUpdate(callback: Function): EventNode; -export function OnBeforeRenderPipeline(callback: Function): EventNode; -export function OnAfterRenderPipeline(callback: Function): EventNode; -/** - * EventNode is a node that executes a callback during specific update phases. - * - * @augments Node - */ -declare class EventNode extends Node { - /** - * Creates an EventNode. - * - * @param {string} eventType - The type of event - * @param {Function} callback - The callback to execute on update. - */ - constructor(eventType: string, callback: Function); - eventType: string; - callback: Function; - setup(builder: any): Node | null; - update(frame: any): void; - updateBefore(frame: any): void; - updateAfter(frame: any): void; -} -declare namespace EventNode { - let OBJECT: string; - let MATERIAL: string; - let FRAME: string; - let AFTER_OBJECT: string; - let BEFORE_OBJECT: string; - let BEFORE_MATERIAL: string; - let BEFORE_FRAME: string; - let BEFORE_RENDER_PIPELINE: string; - let AFTER_RENDER_PIPELINE: string; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts deleted file mode 100644 index 15e36f325..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/FlipNode.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -export default FlipNode; -/** - * This module is part of the TSL core and usually not used in app level code. - * It represents a flip operation during the shader generation process - * meaning it flips normalized values with the following formula: - * ``` - * x = 1 - x; - * ``` - * `FlipNode` is internally used to implement any `flipXYZW()`, `flipRGBA()` and - * `flipSTPQ()` method invocations on node objects. For example: - * ```js - * uvNode = uvNode.flipY(); - * ``` - * - * @augments TempNode - */ -declare class FlipNode extends TempNode { - /** - * Constructs a new flip node. - * - * @param {Node} sourceNode - The node which component(s) should be flipped. - * @param {string} components - The components that should be flipped e.g. `'x'` or `'xy'`. - */ - constructor(sourceNode: Node, components: string); - /** - * The node which component(s) should be flipped. - * - * @type {Node} - */ - sourceNode: Node; - /** - * The components that should be flipped e.g. `'x'` or `'xy'`. - * - * @type {string} - */ - components: string; - /** - * This method is overwritten since the node type is inferred from the source node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any): string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts deleted file mode 100644 index 765ca535c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/FunctionOverloadingNode.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -export default FunctionOverloadingNode; -export function overloadingFn(functionNodes: Array): FunctionOverloadingNode; -/** - * This class allows to define multiple overloaded versions - * of the same function. Depending on the parameters of the function - * call, the node picks the best-fit overloaded version. - * - * @augments Node - */ -declare class FunctionOverloadingNode extends Node { - /** - * Constructs a new function overloading node. - * - * @param {Array} functionNodes - Array of `Fn` function definitions. - * @param {...Node} parametersNodes - A list of parameter nodes. - */ - constructor(functionNodes?: Array, ...parametersNodes: Node[]); - /** - * Array of `Fn` function definitions. - * - * @type {Array} - */ - functionNodes: Array; - /** - * A list of parameter nodes. - * - * @type {Array} - */ - parametersNodes: Array; - /** - * The selected overloaded function call. - * - * @private - * @type {ShaderCallNodeInternal} - */ - private _candidateFn; - /** - * This method is overwritten since the node type is inferred from - * the function's return type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - /** - * Returns the candidate function for the current parameters. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {FunctionNode} The candidate function. - */ - getCandidateFn(builder: NodeBuilder): FunctionNode; - /** - * Sets up the node for the current parameters. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Node} The setup node. - */ - setup(builder: NodeBuilder): Node; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts deleted file mode 100644 index 70dfe5537..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/JoinNode.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -export default JoinNode; -/** - * This module is part of the TSL core and usually not used in app level code. - * It represents a join operation during the shader generation process. - * For example in can compose/join two single floats into a `vec2` type. - * - * @augments TempNode - */ -declare class JoinNode extends TempNode { - /** - * Constructs a new join node. - * - * @param {Array} nodes - An array of nodes that should be joined. - * @param {?string} [nodeType=null] - The node type. - */ - constructor(nodes?: Array, nodeType?: string | null); - /** - * An array of nodes that should be joined. - * - * @type {Array} - */ - nodes: Array; - /** - * This method is overwritten since the node type must be inferred from the - * joined data length if not explicitly defined. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any, output: any): any; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts deleted file mode 100644 index cf5080cae..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/LoopNode.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -export default LoopNode; -export function Loop(...params: any[]): LoopNode; -export function Continue(): ExpressionNode; -export function Break(): ExpressionNode; -/** - * This module offers a variety of ways to implement loops in TSL. In it's basic form it's: - * ```js - * Loop( count, ( { i } ) => { - * - * } ); - * ``` - * However, it is also possible to define a start and end ranges, data types and loop conditions: - * ```js - * Loop( { start: int( 0 ), end: int( 10 ), type: 'int', condition: '<' }, ( { i } ) => { - * - * } ); - *``` - * Nested loops can be defined in a compacted form: - * ```js - * Loop( 10, 5, ( { i, j } ) => { - * - * } ); - * ``` - * Loops that should run backwards can be defined like so: - * ```js - * Loop( { start: 10 }, () => {} ); - * ``` - * It is possible to execute with boolean values, similar to the `while` syntax. - * ```js - * const value = float( 0 ).toVar(); - * - * Loop( value.lessThan( 10 ), () => { - * - * value.addAssign( 1 ); - * - * } ); - * ``` - * The module also provides `Break()` and `Continue()` TSL expression for loop control. - * @augments Node - */ -declare class LoopNode extends Node { - /** - * Constructs a new loop node. - * - * @param {Array} params - Depending on the loop type, array holds different parameterization values for the loop. - */ - constructor(params?: Array); - params: any[]; - /** - * Returns a loop variable name based on an index. The pattern is - * `0` = `i`, `1`= `j`, `2`= `k` and so on. - * - * @param {number} index - The index. - * @return {string} The loop variable name. - */ - getVarName(index: number): string; - /** - * Returns properties about this node. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {Object} The node properties. - */ - getProperties(builder: NodeBuilder): Object; - _getInternalParams(): any[]; - setup(builder: any): void; - generate(builder: any): void; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts deleted file mode 100644 index 11ccf7d5a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/MatcapUV.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * TSL function for creating a matcap uv node. - * - * Can be used to compute texture coordinates for projecting a - * matcap onto a mesh. Used by {@link MeshMatcapNodeMaterial}. - * - * @tsl - * @function - * @returns {Node} The matcap UV coordinates. - */ -export const matcapUV: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts deleted file mode 100644 index a54346cc2..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/MaxMipLevelNode.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export default MaxMipLevelNode; -/** - * TSL function for creating a max mip level node. - * - * @tsl - * @function - * @param {TextureNode} textureNode - The texture node to compute the max mip level for. - * @returns {MaxMipLevelNode} - */ -export const maxMipLevel: any; -/** - * A special type of uniform node that computes the - * maximum mipmap level for a given texture node. - * - * ```js - * const level = maxMipLevel( textureNode ); - * ``` - * - * @augments UniformNode - */ -declare class MaxMipLevelNode extends UniformNode { - /** - * Constructs a new max mip level node. - * - * @param {TextureNode} textureNode - The texture node to compute the max mip level for. - */ - constructor(textureNode: TextureNode); - /** - * The texture node to compute the max mip level for. - * - * @private - * @type {TextureNode} - */ - private _textureNode; - /** - * The texture node to compute the max mip level for. - * - * @readonly - * @type {TextureNode} - */ - readonly get textureNode(): TextureNode; - /** - * The texture. - * - * @readonly - * @type {Texture} - */ - readonly get texture(): Texture; - update(): void; -} -import UniformNode from '../core/UniformNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts deleted file mode 100644 index 45fabbe06..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/MemberNode.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default MemberNode; -/** - * Base class for representing member access on an object-like - * node data structures. - * - * @augments Node - */ -declare class MemberNode extends Node { - /** - * Constructs a member node. - * - * @param {Node} structNode - The struct node. - * @param {string} property - The property name. - */ - constructor(structNode: Node, property: string); - /** - * The struct node. - * - * @type {Node} - */ - structNode: Node; - /** - * The property name. - * - * @type {Node} - */ - property: Node; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMemberNode: boolean; - hasMember(builder: any): boolean; - generateNodeType(builder: any): string; - getMemberType(builder: any, name: any): any; - generate(builder: any): any; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts deleted file mode 100644 index 08bd81824..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/Oscillators.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function oscSine(t?: Node): Node; -export function oscSquare(t?: Node): Node; -export function oscTriangle(t?: Node): Node; -export function oscSawtooth(t?: Node): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts deleted file mode 100644 index 35dbe54c6..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/Packing.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function packNormalToRGB(node: Node): Node; -export function unpackRGBToNormal(node: Node): Node; -export function unpackNormal(xy: Node): Node; -export function directionToColor(node: Node): Node; -export function colorToDirection(node: Node): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts deleted file mode 100644 index 2a6b7133e..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/PostProcessingUtils.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Computes a position in view space based on a fragment's screen position expressed as uv coordinates, the fragments - * depth value and the camera's inverse projection matrix. - * - * @tsl - * @function - * @param {Node} screenPosition - The fragment's screen position expressed as uv coordinates. - * @param {Node} depth - The fragment's depth value. - * @param {Node} projectionMatrixInverse - The camera's inverse projection matrix. - * @return {Node} The fragments position in view space. - */ -export const getViewPosition: () => void; -/** - * Computes a screen position expressed as uv coordinates based on a fragment's position in view space - * and the camera's projection matrix - * - * @tsl - * @function - * @param {Node} viewPosition - The fragments position in view space. - * @param {Node} projectionMatrix - The camera's projection matrix. - * @return {Node} The fragment's screen position expressed as uv coordinates. - */ -export const getScreenPosition: () => void; -/** - * Converts a clip-space position into a screen position expressed as uv coordinates. - * - * @tsl - * @function - * @param {Node} clipPosition - The position in clip space. - * @return {Node} The screen position expressed as uv coordinates. - */ -export const getScreenPositionFromClip: any; -/** - * Computes a normal vector based on depth data. Can be used as a fallback when no normal render - * target is available or if flat surface normals are required. - * - * @tsl - * @function - * @param {Node} uv - The texture coordinate. - * @param {DepthTexture} depthTexture - The depth texture. - * @param {Node} projectionMatrixInverse - The camera's inverse projection matrix. - * @return {Node} The computed normal vector. - */ -export const getNormalFromDepth: () => void; -/** - * Interleaved Gradient Noise (IGN) from Jimenez 2014. - * - * IGN has "low discrepancy" resulting in evenly distributed samples. It's superior compared to - * default white noise, blue noise or Bayer. - * - * References: - * - {@link https://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare/} - * - {@link https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/} - * - * @tsl - * @function - * @param {Node} position - The input position, usually screen coordinates. - * @return {Node} The noise value. - */ -export const interleavedGradientNoise: any; -/** - * Vogel disk sampling for uniform circular distribution. - * - * This function generates sample points distributed uniformly on a disk using the golden angle, - * resulting in an efficient low-discrepancy sequence for sampling. The rotation parameter (phi) - * allows randomizing the pattern per-pixel when combined with IGN. - * - * @tsl - * @function - * @param {Node} sampleIndex - The index of the current sample (0-based). - * @param {Node} samplesCount - The total number of samples. - * @param {Node} phi - Rotation angle in radians (typically from IGN * 2π). - * @return {Node} A 2D point on the unit disk. - */ -export const vogelDiskSample: any; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts deleted file mode 100644 index 455e11adb..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/RTTNode.d.ts +++ /dev/null @@ -1,128 +0,0 @@ -export default RTTNode; -export function rtt(node: Node, ...params: any[]): RTTNode; -export function convertToTexture(node: Node, ...params: any[]): RTTNode; -/** - * `RTTNode` takes another node and uses it with a `QuadMesh` to render into a texture (RTT). - * This module is especially relevant in context of post processing where certain nodes require - * texture input for their effects. With the helper function `convertToTexture()` which is based - * on this module, the node system can automatically ensure texture input if required. - * - * @augments TextureNode - */ -declare class RTTNode extends TextureNode { - /** - * Constructs a new RTT node. - * - * @param {Node} node - The node to render a texture with. - * @param {?number} [width=null] - The width of the internal render target. If not width is applied, the render target is automatically resized. - * @param {?number} [height=null] - The height of the internal render target. - * @param {Object} [options={}] - The options for the internal render target. - * @param {number} [options.type=HalfFloatType] - The texture type. - * @param {boolean} [options.autoUpdate=true] - Whether the texture should automatically be updated or not. - * @param {number} [options.resolutionScale=1] - The resolution scale. - */ - constructor(node: Node, width?: number | null, height?: number | null, options?: { - type?: number | undefined; - autoUpdate?: boolean | undefined; - resolutionScale?: number | undefined; - }); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRTTNode: boolean; - /** - * The node to render a texture with. - * - * @type {Node} - */ - node: Node; - /** - * The width of the internal render target. - * If not width is applied, the render target is automatically resized. - * - * @type {?number} - * @default null - */ - width: number | null; - /** - * The height of the internal render target. - * - * @type {?number} - * @default null - */ - height: number | null; - /** - * The render target - * - * @type {RenderTarget} - */ - renderTarget: RenderTarget; - /** - * Whether the texture requires an update or not. - * - * @type {boolean} - * @default true - */ - textureNeedsUpdate: boolean; - /** - * Whether the texture should automatically be updated or not. - * - * @type {boolean} - * @default true - */ - autoUpdate: boolean; - /** - * The resolution scale - * - * @private - * @type {number} - * @default 1 - */ - private _resolutionScale; - /** - * The internal quad mesh for RTT. - * - * @private - * @type {QuadMesh} - */ - private _quadMesh; - /** - * Whether the internal render target should automatically be resized or not. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly get autoResize(): boolean; - setup(builder: any): void; - /** - * Sets the size of the internal render target - * - * @param {number} width - The width to set. - * @param {number} height - The width to set. - */ - setSize(width: number, height: number): void; - /** - * Sets the resolution scale. - * The resolution scale is a factor that is multiplied with the renderer's width and height. - * - * @param {number} resolutionScale - The resolution scale to set. A value of `1` means full resolution. - * @returns {RTTNode} A reference to this node. - */ - setResolutionScale(resolutionScale: number): RTTNode; - /** - * Gets the resolution scale. - * - * @returns {number} The resolution scale. - */ - getResolutionScale(): number; - updateBefore({ renderer }: { - renderer: any; - }): void; -} -import TextureNode from '../accessors/TextureNode.js'; -import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts deleted file mode 100644 index cbe1f5605..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/ReflectorNode.d.ts +++ /dev/null @@ -1,237 +0,0 @@ -export function reflector(parameters?: { - target?: Object3D | undefined; - resolution?: number | undefined; - generateMipmaps?: boolean | undefined; - bounces?: boolean | undefined; - depth?: boolean | undefined; - samples?: number | undefined; - defaultTexture?: TextureNode | undefined; - reflector?: ReflectorBaseNode | undefined; -}): ReflectorNode; -export default ReflectorNode; -import { Object3D } from '../../core/Object3D.js'; -import TextureNode from '../accessors/TextureNode.js'; -/** - * Holds the actual implementation of the reflector (virtual cameras, render - * targets and the reflection rendering). - * - * This logic is kept separate from {@link ReflectorNode} because the latter is - * a {@link TextureNode} representing a single texture view. A reflector can be - * sampled by multiple texture nodes at once - e.g. one for color and one for - * depth (see {@link ReflectorNode#getDepthNode}) - which all reference the same - * base node so the reflection is rendered only once. - * - * @private - * @augments Node - */ -declare class ReflectorBaseNode extends Node { - /** - * Constructs a new reflector base node. - * - * @param {TextureNode} textureNode - Represents the rendered reflections as a texture node. - * @param {Object} [parameters={}] - An object holding configuration parameters. - * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. - * @param {number} [parameters.resolutionScale=1] - The resolution scale. - * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. - * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. - * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. - * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. - */ - constructor(textureNode: TextureNode, parameters?: { - target?: Object3D | undefined; - resolutionScale?: number | undefined; - generateMipmaps?: boolean | undefined; - bounces?: boolean | undefined; - depth?: boolean | undefined; - samples?: number | undefined; - }); - /** - * Represents the rendered reflections as a texture node. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * The 3D object the reflector is linked to. - * - * @type {Object3D} - * @default {new Object3D()} - */ - target: Object3D; - /** - * The resolution scale. - * - * @type {number} - * @default {1} - */ - resolutionScale: number; - /** - * Whether mipmaps should be generated or not. - * - * @type {boolean} - * @default {false} - */ - generateMipmaps: boolean; - /** - * Whether reflectors can render other reflector nodes or not. - * - * @type {boolean} - * @default {true} - */ - bounces: boolean; - /** - * Whether depth data should be generated or not. - * - * @type {boolean} - * @default {false} - */ - depth: boolean; - /** - * The number of anti-aliasing samples for the render-target - * - * @type {number} - * @default {0} - */ - samples: number; - /** - * Weak map for managing virtual cameras. - * - * @type {WeakMap} - */ - virtualCameras: WeakMap; - /** - * Weak map for managing render targets. - * - * @type {Map} - */ - renderTargets: Map; - /** - * Force render even if reflector is facing away from camera. - * - * @type {boolean} - * @default {false} - */ - forceUpdate: boolean; - /** - * Whether the reflector has been rendered or not. - * - * When the reflector is facing away from the camera, - * this flag is set to `false` and the texture will be empty(black). - * - * @type {boolean} - * @default {false} - */ - hasOutput: boolean; - /** - * Updates the resolution of the internal render target. - * - * @private - * @param {RenderTarget} renderTarget - The render target to resize. - * @param {Renderer} renderer - The renderer that is used to determine the new size. - */ - private _updateResolution; - setup(builder: any): Node | null; - /** - * Returns a virtual camera for the given camera. The virtual camera is used to - * render the scene from the reflector's view so correct reflections can be produced. - * - * @param {Camera} camera - The scene's camera. - * @return {Camera} The corresponding virtual camera. - */ - getVirtualCamera(camera: Camera): Camera; - /** - * Returns a render target for the given camera. The reflections are rendered - * into this render target. - * - * @param {Camera} camera - The scene's camera. - * @return {RenderTarget} The render target. - */ - getRenderTarget(camera: Camera): RenderTarget; - updateBefore(frame: any): false | undefined; - set resolution(value: number); - /** - * The resolution scale. - * - * @deprecated - * @type {number} - * @default {1} - */ - get resolution(): number; -} -/** - * This node can be used to implement mirror-like flat reflective surfaces. - * - * ```js - * const groundReflector = reflector(); - * material.colorNode = groundReflector; - * - * const plane = new Mesh( geometry, material ); - * plane.add( groundReflector.target ); - * ``` - * - * @augments TextureNode - */ -declare class ReflectorNode extends TextureNode { - /** - * Constructs a new reflector node. - * - * @param {Object} [parameters={}] - An object holding configuration parameters. - * @param {Object3D} [parameters.target=new Object3D()] - The 3D object the reflector is linked to. - * @param {number} [parameters.resolutionScale=1] - The resolution scale. - * @param {boolean} [parameters.generateMipmaps=false] - Whether mipmaps should be generated or not. - * @param {boolean} [parameters.bounces=true] - Whether reflectors can render other reflector nodes or not. - * @param {boolean} [parameters.depth=false] - Whether depth data should be generated or not. - * @param {number} [parameters.samples] - Anti-Aliasing samples of the internal render-target. - * @param {TextureNode} [parameters.defaultTexture] - The default texture node. - * @param {ReflectorBaseNode} [parameters.reflector] - The reflector base node. - */ - constructor(parameters?: { - target?: Object3D | undefined; - resolutionScale?: number | undefined; - generateMipmaps?: boolean | undefined; - bounces?: boolean | undefined; - depth?: boolean | undefined; - samples?: number | undefined; - defaultTexture?: TextureNode | undefined; - reflector?: ReflectorBaseNode | undefined; - }); - /** - * A reference to the internal reflector base node which holds the actual implementation. - * - * @private - * @type {ReflectorBaseNode} - * @default ReflectorBaseNode - */ - private _reflectorBaseNode; - /** - * A reference to the internal depth node. - * - * @private - * @type {?Node} - * @default null - */ - private _depthNode; - /** - * A reference to the internal reflector node. - * - * @type {ReflectorBaseNode} - */ - get reflector(): ReflectorBaseNode; - /** - * A reference to 3D object the reflector is linked to. - * - * @type {Object3D} - */ - get target(): Object3D; - /** - * Returns a node representing the mirror's depth. That can be used - * to implement more advanced reflection effects like distance attenuation. - * - * @return {Node} The depth node. - */ - getDepthNode(): Node; - setup(builder: any): void; - clone(): any; -} -import Node from '../core/Node.js'; -import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts deleted file mode 100644 index b6aacd043..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/Remap.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * This node allows to remap a node value from one range into another but with enabled clamping. E.g a value of - * `0.4` in the range `[ 0.3, 0.5 ]` should be remapped into the normalized range `[ 0, 1 ]`. - * `remapClamp` takes care of that and converts the original value of `0.4` to `0.5`. - * - * @tsl - * @function - * @param {Node} node - The node that should be remapped. - * @param {Node} inLowNode - The source or current lower bound of the range. - * @param {Node} inHighNode - The source or current upper bound of the range. - * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. - * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. - * @returns {Node} - */ -export function remapClamp(node: Node, inLowNode: Node, inHighNode: Node, outLowNode?: Node | null, outHighNode?: Node | null): Node; -/** - * This node allows to remap a node value from one range into another. E.g a value of - * `0.4` in the range `[ 0.3, 0.5 ]` should be remapped into the normalized range `[ 0, 1 ]`. - * `remap` takes care of that and converts the original value of `0.4` to `0.5`. - * - * @tsl - * @function - * @param {Node} node - The node that should be remapped. - * @param {Node} inLowNode - The source or current lower bound of the range. - * @param {Node} inHighNode - The source or current upper bound of the range. - * @param {?Node} [outLowNode=float(0)] - The target lower bound of the range. - * @param {?Node} [outHighNode=float(1)] - The target upper bound of the range. - * @returns {Node} - */ -export const remap: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts deleted file mode 100644 index ed6dfe36b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/RotateNode.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export default RotateNode; -/** - * TSL function for creating a rotate node. - * - * @tsl - * @function - * @param {Node} positionNode - The position node. - * @param {Node} rotationNode - Represents the rotation that is applied to the position node. Depending - * on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. - * @returns {RotateNode} - */ -export const rotate: any; -/** - * Applies a rotation to the given position node. - * - * @augments TempNode - */ -declare class RotateNode extends TempNode { - /** - * Constructs a new rotate node. - * - * @param {Node} positionNode - The position node. - * @param {Node} rotationNode - Represents the rotation that is applied to the position node. Depending - * on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. - */ - constructor(positionNode: Node, rotationNode: Node); - /** - * The position node. - * - * @type {Node} - */ - positionNode: Node; - /** - * Represents the rotation that is applied to the position node. - * Depending on whether the position data are 2D or 3D, the rotation is expressed a single float value or an Euler value. - * - * @type {Node} - */ - rotationNode: Node; - /** - * The type of the {@link RotateNode#positionNode} defines the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node's type. - */ - generateNodeType(builder: NodeBuilder): string; - setup(builder: any): any; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts deleted file mode 100644 index 6fb9d738c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/SampleNode.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -export default SampleNode; -export function sample(callback: Function, uv?: Node | null): SampleNode; -/** - * Class representing a node that samples a value using a provided callback function. - * - * @extends Node - */ -declare class SampleNode extends Node { - /** - * Creates an instance of SampleNode. - * - * @param {Function} callback - The function to be called when sampling. Should accept a UV node and return a value. - * @param {?Node} [uvNode=null] - The UV node to be used in the texture sampling. - */ - constructor(callback: Function, uvNode?: Node | null); - callback: Function; - /** - * Represents the texture coordinates. - * - * @type {?Node} - * @default null - */ - uvNode: Node | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampleNode: boolean; - /** - * Sets up the node by sampling with the default UV accessor. - * - * @returns {Node} The result of the callback function when called with the UV node. - */ - setup(): Node; - /** - * Calls the callback function with the provided UV node. - * - * @param {Node} uv - The UV node or value to be passed to the callback. - * @returns {Node} The result of the callback function. - */ - sample(uv: Node): Node; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts deleted file mode 100644 index 4dcfbd1b9..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/SetNode.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export default SetNode; -/** - * This module is part of the TSL core and usually not used in app level code. - * `SetNode` represents a set operation which means it is used to implement any - * `setXYZW()`, `setRGBA()` and `setSTPQ()` method invocations on node objects. - * For example: - * ```js - * materialLine.colorNode = color( 0, 0, 0 ).setR( float( 1 ) ); - * ``` - * - * @augments TempNode - */ -declare class SetNode extends TempNode { - /** - * Constructs a new set node. - * - * @param {Node} sourceNode - The node that should be updated. - * @param {string} components - The components that should be updated. - * @param {Node} targetNode - The value node. - */ - constructor(sourceNode: Node, components: string, targetNode: Node); - /** - * The node that should be updated. - * - * @type {Node} - */ - sourceNode: Node; - /** - * The components that should be updated. - * - * @type {string} - */ - components: string; - /** - * The value node. - * - * @type {Node} - */ - targetNode: Node; - /** - * This method is overwritten since the node type is inferred from {@link SetNode#sourceNode}. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any): string; -} -import TempNode from '../core/TempNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts deleted file mode 100644 index 9941f1852..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/SplitNode.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -export default SplitNode; -/** - * This module is part of the TSL core and usually not used in app level code. - * `SplitNode` represents a property access operation which means it is - * used to implement any `.xyzw`, `.rgba` and `stpq` usage on node objects. - * For example: - * ```js - * const redValue = color.r; - * ``` - * - * @augments Node - */ -declare class SplitNode extends Node { - /** - * Constructs a new split node. - * - * @param {Node} node - The node that should be accessed. - * @param {string} [components='x'] - The components that should be accessed. - */ - constructor(node: Node, components?: string); - /** - * The node that should be accessed. - * - * @type {Node} - */ - node: Node; - /** - * The components that should be accessed. - * - * @type {string} - */ - components: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSplitNode: boolean; - /** - * Returns the vector length which is computed based on the requested components. - * - * @return {number} The vector length. - */ - getVectorLength(): number; - /** - * Returns the component type of the node's type. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The component type. - */ - getComponentType(builder: NodeBuilder): string; - /** - * This method is overwritten since the node type is inferred from requested components. - * - * @param {NodeBuilder} builder - The current node builder. - * @return {string} The node type. - */ - generateNodeType(builder: NodeBuilder): string; - generate(builder: any, output: any): any; - serialize(data: any): void; - deserialize(data: any): void; -} -import Node from '../core/Node.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts deleted file mode 100644 index 572dccc2c..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/SpriteSheetUV.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * TSL function for computing texture coordinates for animated sprite sheets. - * - * ```js - * const uvNode = spritesheetUV( vec2( 6, 6 ), uv(), time.mul( animationSpeed ) ); - * - * material.colorNode = texture( spriteSheet, uvNode ); - * ``` - * - * @tsl - * @function - * @param {Node} countNode - The node that defines the number of sprites in the x and y direction (e.g 6x6). - * @param {?Node} [uvNode=uv()] - The uv node. - * @param {?Node} [frameNode=float(0)] - The node that defines the current frame/sprite. - * @returns {Node} - */ -export const spritesheetUV: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts deleted file mode 100644 index 9c3d7017a..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/SpriteUtils.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This can be used to achieve a billboarding behavior for flat meshes. That means they are - * oriented always towards the camera. - * - * ```js - * material.vertexNode = billboarding(); - * ``` - * - * @tsl - * @function - * @param {Object} config - The configuration object. - * @param {?Node} [config.position=null] - Can be used to define the billboard center position directly. - * When null, the center is derived automatically from `positionWorld`. - * @param {boolean} [config.horizontal=true] - Whether to follow the camera rotation horizontally or not. - * @param {boolean} [config.vertical=false] - Whether to follow the camera rotation vertically or not. - * @param {boolean} [config.horizontalRotation=false] - Whether to rotate around the Y axis to face the camera. - * @return {Node} The updated vertex position in clip space. - */ -export const billboarding: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts deleted file mode 100644 index 5257eebfd..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/StorageArrayElementNode.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export default StorageArrayElementNode; -/** - * TSL function for creating a storage element node. - * - * @tsl - * @function - * @param {StorageBufferNode} storageBufferNode - The storage buffer node. - * @param {Node} indexNode - The index node that defines the element access. - * @returns {StorageArrayElementNode} - */ -export const storageElement: any; -/** - * This class enables element access on instances of {@link StorageBufferNode}. - * In most cases, it is indirectly used when accessing elements with the - * {@link StorageBufferNode#element} method. - * - * ```js - * const position = positionStorage.element( instanceIndex ); - * ``` - * - * @augments ArrayElementNode - */ -declare class StorageArrayElementNode extends ArrayElementNode { - /** - * Constructs storage buffer element node. - * - * @param {StorageBufferNode} storageBufferNode - The storage buffer node. - * @param {Node} indexNode - The index node that defines the element access. - */ - constructor(storageBufferNode: StorageBufferNode, indexNode: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageArrayElementNode: boolean; - /** - * The storage buffer node. - * - * @param {Node} value - * @type {StorageBufferNode} - */ - set storageBufferNode(value: Node); - get storageBufferNode(): Node; - getMemberType(builder: any, name: any): any; - setup(builder: any): import("../Nodes.js").Node | null; - generate(builder: any, output: any): any; -} -import ArrayElementNode from './ArrayElementNode.js'; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts deleted file mode 100644 index 9131612ca..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/Timer.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Represents the elapsed time in seconds. - * - * @tsl - * @type {UniformNode} - */ -export const time: UniformNode; -/** - * Represents the delta time in seconds. - * - * @tsl - * @type {UniformNode} - */ -export const deltaTime: UniformNode; -/** - * Represents the current frame ID. - * - * @tsl - * @type {UniformNode} - */ -export const frameId: UniformNode; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts deleted file mode 100644 index df819d30b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/TriplanarTextures.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * TSL function for creating a triplanar textures node. - * - * Can be used for triplanar texture mapping. - * - * ```js - * material.colorNode = triplanarTexture( texture( diffuseMap ) ); - * ``` - * - * @tsl - * @function - * @param {Node} textureXNode - First texture node. - * @param {?Node} [textureYNode=null] - Second texture node. When not set, the shader will sample from `textureXNode` instead. - * @param {?Node} [textureZNode=null] - Third texture node. When not set, the shader will sample from `textureXNode` instead. - * @param {?Node} [scaleNode=float(1)] - The scale node. - * @param {?Node} [positionNode=positionLocal] - Vertex positions in local space. - * @param {?Node} [normalNode=normalLocal] - Normals in local space. - * @returns {Node} - */ -export const triplanarTextures: () => void; -export function triplanarTexture(...params: any[]): Node; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts deleted file mode 100644 index fb078e354..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/UVUtils.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Replaces the default UV coordinates used in texture lookups. - * - * ```js - *material.contextNode = replaceDefaultUV( ( textureNode ) => { - * - * // ... - * return customUVCoordinates; - * - *} ); - *``` - * - * @tsl - * @function - * @param {function(Node):Node|Node} callback - A callback that receives the texture node - * and must return the new uv coordinates. - * @param {Node} [node=null] - An optional node to which the context will be applied. - * @return {ContextNode} A context node that replaces the default UV coordinates. - */ -export function replaceDefaultUV(callback: (arg0: Node) => Node | Node, node?: Node): ContextNode; -/** - * Rotates the given uv coordinates around a center point - * - * @tsl - * @function - * @param {Node} uv - The uv coordinates. - * @param {Node} rotation - The rotation defined in radians. - * @param {Node} center - The center of rotation - * @return {Node} The rotated uv coordinates. - */ -export const rotateUV: () => void; -/** - * Applies a spherical warping effect to the given uv coordinates. - * - * @tsl - * @function - * @param {Node} uv - The uv coordinates. - * @param {Node} strength - The strength of the effect. - * @param {Node} center - The center point - * @return {Node} The updated uv coordinates. - */ -export const spherizeUV: () => void; diff --git a/jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts b/jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts deleted file mode 100644 index 8622c377b..000000000 --- a/jsdoc-testing/jsdoc/src/nodes/utils/ViewportUtils.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * A special version of a screen uv function that involves a depth comparison - * when computing the final uvs. The function mitigates visual errors when - * using viewport texture nodes for refraction purposes. Without this function - * objects in front of a refractive surface might appear on the refractive surface - * which is incorrect. - * - * @tsl - * @function - * @param {?Node} uv - Optional uv coordinates. By default `screenUV` is used. - * @return {Node} The update uv coordinates. - */ -export const viewportSafeUV: () => void; diff --git a/jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts b/jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts deleted file mode 100644 index 54ed9a5d8..000000000 --- a/jsdoc-testing/jsdoc/src/objects/BatchedMesh.d.ts +++ /dev/null @@ -1,362 +0,0 @@ -/** - * A special version of a mesh with multi draw batch rendering support. Use - * this class if you have to render a large number of objects with the same - * material but with different geometries or world transformations. The usage of - * `BatchedMesh` will help you to reduce the number of draw calls and thus improve the overall - * rendering performance in your application. - * - * ```js - * const box = new THREE.BoxGeometry( 1, 1, 1 ); - * const sphere = new THREE.SphereGeometry( 1, 12, 12 ); - * const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); - * - * // initialize and add geometries into the batched mesh - * const batchedMesh = new BatchedMesh( 10, 5000, 10000, material ); - * const boxGeometryId = batchedMesh.addGeometry( box ); - * const sphereGeometryId = batchedMesh.addGeometry( sphere ); - * - * // create instances of those geometries - * const boxInstancedId1 = batchedMesh.addInstance( boxGeometryId ); - * const boxInstancedId2 = batchedMesh.addInstance( boxGeometryId ); - * - * const sphereInstancedId1 = batchedMesh.addInstance( sphereGeometryId ); - * const sphereInstancedId2 = batchedMesh.addInstance( sphereGeometryId ); - * - * // position the geometries - * batchedMesh.setMatrixAt( boxInstancedId1, boxMatrix1 ); - * batchedMesh.setMatrixAt( boxInstancedId2, boxMatrix2 ); - * - * batchedMesh.setMatrixAt( sphereInstancedId1, sphereMatrix1 ); - * batchedMesh.setMatrixAt( sphereInstancedId2, sphereMatrix2 ); - * - * scene.add( batchedMesh ); - * ``` - * - * @augments Mesh - */ -export class BatchedMesh extends Mesh { - /** - * Constructs a new batched mesh. - * - * @param {number} maxInstanceCount - The maximum number of individual instances planned to be added and rendered. - * @param {number} maxVertexCount - The maximum number of vertices to be used by all unique geometries. - * @param {number} [maxIndexCount=maxVertexCount*2] - The maximum number of indices to be used by all unique geometries - * @param {Material|Array} [material] - The mesh material. - */ - constructor(maxInstanceCount: number, maxVertexCount: number, maxIndexCount?: number, material?: Material | Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBatchedMesh: boolean; - /** - * When set ot `true`, the individual objects of a batch are frustum culled. - * - * @type {boolean} - * @default true - */ - perObjectFrustumCulled: boolean; - /** - * When set to `true`, the individual objects of a batch are sorted to improve overdraw-related artifacts. - * If the material is marked as "transparent" objects are rendered back to front and if not then they are - * rendered front to back. - * - * @type {boolean} - * @default true - */ - sortObjects: boolean; - /** - * The bounding box of the batched mesh. Can be computed via {@link BatchedMesh#computeBoundingBox}. - * - * @type {?Box3} - * @default null - */ - boundingBox: Box3 | null; - /** - * The bounding sphere of the batched mesh. Can be computed via {@link BatchedMesh#computeBoundingSphere}. - * - * @type {?Sphere} - * @default null - */ - boundingSphere: Sphere | null; - /** - * Takes a sort a function that is run before render. The function takes a list of instances to - * sort and a camera. The objects in the list include a "z" field to perform a depth-ordered - * sort with. - * - * @type {?Function} - * @default null - */ - customSort: Function | null; - _instanceInfo: any[]; - _geometryInfo: any[]; - _availableInstanceIds: any[]; - _availableGeometryIds: any[]; - _nextIndexStart: number; - _nextVertexStart: number; - _geometryCount: number; - _visibilityChanged: boolean; - _geometryInitialized: boolean; - _maxInstanceCount: number; - _maxVertexCount: number; - _maxIndexCount: number; - _multiDrawCounts: Int32Array; - _multiDrawStarts: Int32Array; - _multiDrawCount: number; - _multiDrawBytesPerElement: number; - _matricesTexture: any; - _indirectTexture: any; - _colorsTexture: any; - /** - * The maximum number of individual instances that can be stored in the batch. - * - * @type {number} - * @readonly - */ - readonly get maxInstanceCount(): number; - /** - * The instance count. - * - * @type {number} - * @readonly - */ - readonly get instanceCount(): number; - /** - * The number of unused vertices. - * - * @type {number} - * @readonly - */ - readonly get unusedVertexCount(): number; - /** - * The number of unused indices. - * - * @type {number} - * @readonly - */ - readonly get unusedIndexCount(): number; - _initMatricesTexture(): void; - _initIndirectTexture(): void; - _initColorsTexture(): void; - _initializeGeometry(reference: any): void; - _validateGeometry(geometry: any): void; - /** - * Validates the instance defined by the given ID. - * - * @param {number} instanceId - The instance to validate. - */ - validateInstanceId(instanceId: number): void; - /** - * Validates the geometry defined by the given ID. - * - * @param {number} geometryId - The geometry to validate. - */ - validateGeometryId(geometryId: number): void; - /** - * Takes a sort a function that is run before render. The function takes a list of instances to - * sort and a camera. The objects in the list include a "z" field to perform a depth-ordered sort with. - * - * @param {Function} func - The custom sort function. - * @return {BatchedMesh} A reference to this batched mesh. - */ - setCustomSort(func: Function): BatchedMesh; - /** - * Computes the bounding box, updating {@link BatchedMesh#boundingBox}. - * Bounding boxes aren't computed by default. They need to be explicitly computed, - * otherwise they are `null`. - */ - computeBoundingBox(): void; - /** - * Computes the bounding sphere, updating {@link BatchedMesh#boundingSphere}. - * Bounding spheres aren't computed by default. They need to be explicitly computed, - * otherwise they are `null`. - */ - computeBoundingSphere(): void; - /** - * Adds a new instance to the batch using the geometry of the given ID and returns - * a new id referring to the new instance to be used by other functions. - * - * @param {number} geometryId - The ID of a previously added geometry via {@link BatchedMesh#addGeometry}. - * @return {number} The instance ID. - */ - addInstance(geometryId: number): number; - /** - * Adds the given geometry to the batch and returns the associated - * geometry id referring to it to be used in other functions. - * - * @param {BufferGeometry} geometry - The geometry to add. - * @param {number} [reservedVertexCount=-1] - Optional parameter specifying the amount of - * vertex buffer space to reserve for the added geometry. This is necessary if it is planned - * to set a new geometry at this index at a later time that is larger than the original geometry. - * Defaults to the length of the given geometry vertex buffer. - * @param {number} [reservedIndexCount=-1] - Optional parameter specifying the amount of index - * buffer space to reserve for the added geometry. This is necessary if it is planned to set a - * new geometry at this index at a later time that is larger than the original geometry. Defaults to - * the length of the given geometry index buffer. - * @return {number} The geometry ID. - */ - addGeometry(geometry: BufferGeometry, reservedVertexCount?: number, reservedIndexCount?: number): number; - /** - * Replaces the geometry at the given ID with the provided geometry. Throws an error if there - * is not enough space reserved for geometry. Calling this will change all instances that are - * rendering that geometry. - * - * @param {number} geometryId - The ID of the geometry that should be replaced with the given geometry. - * @param {BufferGeometry} geometry - The new geometry. - * @return {number} The geometry ID. - */ - setGeometryAt(geometryId: number, geometry: BufferGeometry): number; - /** - * Deletes the geometry defined by the given ID from this batch. Any instances referencing - * this geometry will also be removed as a side effect. - * - * @param {number} geometryId - The ID of the geometry to remove from the batch. - * @return {BatchedMesh} A reference to this batched mesh. - */ - deleteGeometry(geometryId: number): BatchedMesh; - /** - * Deletes an existing instance from the batch using the given ID. - * - * @param {number} instanceId - The ID of the instance to remove from the batch. - * @return {BatchedMesh} A reference to this batched mesh. - */ - deleteInstance(instanceId: number): BatchedMesh; - /** - * Repacks the sub geometries in BatchedMesh to remove any unused space remaining from - * previously deleted geometry, freeing up space to add new geometry. - * - * @return {BatchedMesh} A reference to this batched mesh. - */ - optimize(): BatchedMesh; - /** - * Returns the bounding box for the given geometry. - * - * @param {number} geometryId - The ID of the geometry to return the bounding box for. - * @param {Box3} target - The target object that is used to store the method's result. - * @return {?Box3} The geometry's bounding box. Returns `null` if no geometry has been found for the given ID. - */ - getBoundingBoxAt(geometryId: number, target: Box3): Box3 | null; - /** - * Returns the bounding sphere for the given geometry. - * - * @param {number} geometryId - The ID of the geometry to return the bounding sphere for. - * @param {Sphere} target - The target object that is used to store the method's result. - * @return {?Sphere} The geometry's bounding sphere. Returns `null` if no geometry has been found for the given ID. - */ - getBoundingSphereAt(geometryId: number, target: Sphere): Sphere | null; - /** - * Sets the given local transformation matrix to the defined instance. - * Negatively scaled matrices are not supported. - * - * @param {number} instanceId - The ID of an instance to set the matrix of. - * @param {Matrix4} matrix - A 4x4 matrix representing the local transformation of a single instance. - * @return {BatchedMesh} A reference to this batched mesh. - */ - setMatrixAt(instanceId: number, matrix: Matrix4): BatchedMesh; - /** - * Returns the local transformation matrix of the defined instance. - * - * @param {number} instanceId - The ID of an instance to get the matrix of. - * @param {Matrix4} matrix - The target object that is used to store the method's result. - * @return {Matrix4} The instance's local transformation matrix. - */ - getMatrixAt(instanceId: number, matrix: Matrix4): Matrix4; - /** - * Sets the given color to the defined instance. - * - * @param {number} instanceId - The ID of an instance to set the color of. - * @param {Color|Vector4} color - The color to set the instance to. Use a `Vector4` to also define alpha. - * @return {BatchedMesh} A reference to this batched mesh. - */ - setColorAt(instanceId: number, color: Color | Vector4): BatchedMesh; - /** - * Returns the color of the defined instance. - * - * @param {number} instanceId - The ID of an instance to get the color of. - * @param {Color|Vector4} color - The target object that is used to store the method's result. - * @return {Color|Vector4} The instance's color. Use a `Vector4` to also retrieve alpha. - */ - getColorAt(instanceId: number, color: Color | Vector4): Color | Vector4; - /** - * Sets the visibility of the instance. - * - * @param {number} instanceId - The id of the instance to set the visibility of. - * @param {boolean} visible - Whether the instance is visible or not. - * @return {BatchedMesh} A reference to this batched mesh. - */ - setVisibleAt(instanceId: number, visible: boolean): BatchedMesh; - /** - * Returns the visibility state of the defined instance. - * - * @param {number} instanceId - The ID of an instance to get the visibility state of. - * @return {boolean} Whether the instance is visible or not. - */ - getVisibleAt(instanceId: number): boolean; - /** - * Sets the geometry ID of the instance at the given index. - * - * @param {number} instanceId - The ID of the instance to set the geometry ID of. - * @param {number} geometryId - The geometry ID to be use by the instance. - * @return {BatchedMesh} A reference to this batched mesh. - */ - setGeometryIdAt(instanceId: number, geometryId: number): BatchedMesh; - /** - * Returns the geometry ID of the defined instance. - * - * @param {number} instanceId - The ID of an instance to get the geometry ID of. - * @return {number} The instance's geometry ID. - */ - getGeometryIdAt(instanceId: number): number; - /** - * Get the range representing the subset of triangles related to the attached geometry, - * indicating the starting offset and count, or `null` if invalid. - * - * @param {number} geometryId - The id of the geometry to get the range of. - * @param {Object} [target] - The target object that is used to store the method's result. - * @return {{ - * vertexStart:number,vertexCount:number,reservedVertexCount:number, - * indexStart:number,indexCount:number,reservedIndexCount:number, - * start:number,count:number - * }} The result object with range data. - */ - getGeometryRangeAt(geometryId: number, target?: Object): { - vertexStart: number; - vertexCount: number; - reservedVertexCount: number; - indexStart: number; - indexCount: number; - reservedIndexCount: number; - start: number; - count: number; - }; - /** - * Resizes the necessary buffers to support the provided number of instances. - * If the provided arguments shrink the number of instances but there are not enough - * unused Ids at the end of the list then an error is thrown. - * - * @param {number} maxInstanceCount - The max number of individual instances that can be added and rendered by the batch. - */ - setInstanceCount(maxInstanceCount: number): void; - /** - * Resizes the available space in the batch's vertex and index buffer attributes to the provided sizes. - * If the provided arguments shrink the geometry buffers but there is not enough unused space at the - * end of the geometry attributes then an error is thrown. - * - * @param {number} maxVertexCount - The maximum number of vertices to be used by all unique geometries to resize to. - * @param {number} maxIndexCount - The maximum number of indices to be used by all unique geometries to resize to. - */ - setGeometrySize(maxVertexCount: number, maxIndexCount: number): void; - raycast(raycaster: any, intersects: any): void; - copy(source: any): this; - onBeforeRender(renderer: any, scene: any, camera: any, geometry: any, material: any): void; - onBeforeShadow(renderer: any, object: any, camera: any, shadowCamera: any, geometry: any, depthMaterial: any): void; -} -import { Mesh } from './Mesh.js'; -import { Box3 } from '../math/Box3.js'; -import { Sphere } from '../math/Sphere.js'; -import { BufferGeometry } from '../core/BufferGeometry.js'; -import { Matrix4 } from '../math/Matrix4.js'; -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Bone.d.ts b/jsdoc-testing/jsdoc/src/objects/Bone.d.ts deleted file mode 100644 index 5d0be09bc..000000000 --- a/jsdoc-testing/jsdoc/src/objects/Bone.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * A bone which is part of a {@link Skeleton}. The skeleton in turn is used by - * the {@link SkinnedMesh}. - * - * ```js - * const root = new THREE.Bone(); - * const child = new THREE.Bone(); - * - * root.add( child ); - * child.position.y = 5; - * ``` - * - * @augments Object3D - */ -export class Bone extends Object3D { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBone: boolean; - type: string; -} -import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts b/jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts deleted file mode 100644 index 6183e90a1..000000000 --- a/jsdoc-testing/jsdoc/src/objects/ClippingGroup.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * In earlier three.js versions, clipping was defined globally - * on the renderer or on material level. This special version of - * `THREE.Group` allows to encode the clipping state into the scene - * graph. Meaning if you create an instance of this group, all - * descendant 3D objects will be affected by the respective clipping - * planes. - * - * Note: `ClippingGroup` can only be used with `WebGPURenderer`. - * - * @augments Group - */ -export class ClippingGroup extends Group { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isClippingGroup: boolean; - /** - * An array with clipping planes. - * - * @type {Array} - */ - clippingPlanes: Array; - /** - * Whether clipping should be enabled or not. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * Whether the intersection of the clipping planes is used to clip objects, rather than their union. - * - * @type {boolean} - * @default false - */ - clipIntersection: boolean; - /** - * Whether shadows should be clipped or not. - * - * @type {boolean} - * @default false - */ - clipShadows: boolean; -} -import { Group } from './Group.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Group.d.ts b/jsdoc-testing/jsdoc/src/objects/Group.d.ts deleted file mode 100644 index 4def40910..000000000 --- a/jsdoc-testing/jsdoc/src/objects/Group.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * This is almost identical to an {@link Object3D}. Its purpose is to - * make working with groups of objects syntactically clearer. - * - * ```js - * // Create a group and add the two cubes. - * // These cubes can now be rotated / scaled etc as a group. - * const group = new THREE.Group(); - * - * group.add( meshA ); - * group.add( meshB ); - * - * scene.add( group ); - * ``` - * - * @augments Object3D - */ -export class Group extends Object3D { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isGroup: boolean; - type: string; -} -import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts b/jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts deleted file mode 100644 index 17bb69f8e..000000000 --- a/jsdoc-testing/jsdoc/src/objects/InstancedMesh.d.ts +++ /dev/null @@ -1,138 +0,0 @@ -/** - * A special version of a mesh with instanced rendering support. Use - * this class if you have to render a large number of objects with the same - * geometry and material(s) but with different world transformations. The usage - * of 'InstancedMesh' will help you to reduce the number of draw calls and thus - * improve the overall rendering performance in your application. - * - * @augments Mesh - */ -export class InstancedMesh extends Mesh { - /** - * Constructs a new instanced mesh. - * - * @param {BufferGeometry} [geometry] - The mesh geometry. - * @param {Material|Array} [material] - The mesh material. - * @param {number} count - The number of instances. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array, count: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isInstancedMesh: boolean; - /** - * Represents the local transformation of all instances. You have to set its - * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data - * via {@link InstancedMesh#setMatrixAt}. - * - * @type {InstancedBufferAttribute} - */ - instanceMatrix: InstancedBufferAttribute; - /** - * Represents the color of all instances. You have to set its - * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data - * via {@link InstancedMesh#setColorAt}. - * - * @type {?InstancedBufferAttribute} - * @default null - */ - instanceColor: InstancedBufferAttribute | null; - /** - * Represents the morph target weights of all instances. You have to set its - * {@link Texture#needsUpdate} flag to true if you modify instanced data - * via {@link InstancedMesh#setMorphAt}. - * - * @type {?DataTexture} - * @default null - */ - morphTexture: DataTexture | null; - /** - * The bounding box of the instanced mesh. Can be computed via {@link InstancedMesh#computeBoundingBox}. - * - * @type {?Box3} - * @default null - */ - boundingBox: Box3 | null; - /** - * The bounding sphere of the instanced mesh. Can be computed via {@link InstancedMesh#computeBoundingSphere}. - * - * @type {?Sphere} - * @default null - */ - boundingSphere: Sphere | null; - /** - * Computes the bounding box of the instanced mesh, and updates {@link InstancedMesh#boundingBox}. - * The bounding box is not automatically computed by the engine; this method must be called by your app. - * You may need to recompute the bounding box if an instance is transformed via {@link InstancedMesh#setMatrixAt}. - */ - computeBoundingBox(): void; - /** - * Computes the bounding sphere of the instanced mesh, and updates {@link InstancedMesh#boundingSphere} - * The engine automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. - * You may need to recompute the bounding sphere if an instance is transformed via {@link InstancedMesh#setMatrixAt}. - */ - computeBoundingSphere(): void; - copy(source: any, recursive: any): this; - /** - * Gets the color of the defined instance. - * - * @param {number} index - The instance index. - * @param {Color} color - The target object that is used to store the method's result. - * @return {Color} A reference to the target color. - */ - getColorAt(index: number, color: Color): Color; - /** - * Gets the local transformation matrix of the defined instance. - * - * @param {number} index - The instance index. - * @param {Matrix4} matrix - The target object that is used to store the method's result. - * @return {Matrix4} A reference to the target matrix. - */ - getMatrixAt(index: number, matrix: Matrix4): Matrix4; - /** - * Gets the morph target weights of the defined instance. - * - * @param {number} index - The instance index. - * @param {Mesh} object - The target object that is used to store the method's result. - */ - getMorphAt(index: number, object: Mesh): void; - raycast(raycaster: any, intersects: any): void; - /** - * Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of - * {@link InstancedMesh#instanceColor} to `true` after updating all the colors. - * - * @param {number} index - The instance index. - * @param {Color} color - The instance color. - * @return {InstancedMesh} A reference to this instanced mesh. - */ - setColorAt(index: number, color: Color): InstancedMesh; - /** - * Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of - * {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices. - * - * @param {number} index - The instance index. - * @param {Matrix4} matrix - The local transformation. - * @return {InstancedMesh} A reference to this instanced mesh. - */ - setMatrixAt(index: number, matrix: Matrix4): InstancedMesh; - /** - * Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of - * {@link InstancedMesh#morphTexture} to `true` after updating all the influences. - * - * @param {number} index - The instance index. - * @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights - * of a single instance. - * @return {InstancedMesh} A reference to this instanced mesh. - */ - setMorphAt(index: number, object: Mesh): InstancedMesh; -} -import { Mesh } from './Mesh.js'; -import { InstancedBufferAttribute } from '../core/InstancedBufferAttribute.js'; -import { DataTexture } from '../textures/DataTexture.js'; -import { Box3 } from '../math/Box3.js'; -import { Sphere } from '../math/Sphere.js'; -import { Matrix4 } from '../math/Matrix4.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/LOD.d.ts b/jsdoc-testing/jsdoc/src/objects/LOD.d.ts deleted file mode 100644 index d2f7d1004..000000000 --- a/jsdoc-testing/jsdoc/src/objects/LOD.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * A component for providing a basic Level of Detail (LOD) mechanism. - * - * Every LOD level is associated with an object, and rendering can be switched - * between them at the distances specified. Typically you would create, say, - * three meshes, one for far away (low detail), one for mid range (medium - * detail) and one for close up (high detail). - * - * ```js - * const lod = new THREE.LOD(); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * - * //Create spheres with 3 levels of detail and create new LOD levels for them - * for( let i = 0; i < 3; i++ ) { - * - * const geometry = new THREE.IcosahedronGeometry( 10, 3 - i ); - * const mesh = new THREE.Mesh( geometry, material ); - * lod.addLevel( mesh, i * 75 ); - * - * } - * - * scene.add( lod ); - * ``` - * - * @augments Object3D - */ -export class LOD extends Object3D { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLOD: boolean; - /** - * The current LOD index. - * - * @private - * @type {number} - * @default 0 - */ - private _currentLevel; - type: string; - /** - * Whether the LOD object is updated automatically by the renderer per frame - * or not. If set to `false`, you have to call {@link LOD#update} in the - * render loop by yourself. - * - * @type {boolean} - * @default true - */ - autoUpdate: boolean; - copy(source: any): this; - /** - * Adds a mesh that will display at a certain distance and greater. Typically - * the further away the distance, the lower the detail on the mesh. - * - * @param {Object3D} object - The 3D object to display at this level. - * @param {number} [distance=0] - The distance at which to display this level of detail. - * @param {number} [hysteresis=0] - Threshold used to avoid flickering at LOD boundaries, as a fraction of distance. - * @return {LOD} A reference to this instance. - */ - addLevel(object: Object3D, distance?: number, hysteresis?: number): LOD; - /** - * Removes an existing level, based on the distance from the camera. - * Returns `true` when the level has been removed. Otherwise `false`. - * - * @param {number} distance - Distance of the level to remove. - * @return {boolean} Whether the level has been removed or not. - */ - removeLevel(distance: number): boolean; - /** - * Returns the currently active LOD level index. - * - * @return {number} The current active LOD level index. - */ - getCurrentLevel(): number; - /** - * Returns a reference to the first 3D object that is greater than - * the given distance. - * - * @param {number} distance - The LOD distance. - * @return {?Object3D} The found 3D object. `null` if no 3D object has been found. - */ - getObjectForDistance(distance: number): Object3D | null; - /** - * Computes intersection points between a casted ray and this LOD. - * - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - The target array that holds the intersection points. - */ - raycast(raycaster: Raycaster, intersects: Array): void; - /** - * Updates the LOD by computing which LOD level should be visible according - * to the current distance of the given camera. - * - * @param {Camera} camera - The camera the scene is rendered with. - */ - update(camera: Camera): void; - toJSON(meta: any): Object; -} -import { Object3D } from '../core/Object3D.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Line.d.ts b/jsdoc-testing/jsdoc/src/objects/Line.d.ts deleted file mode 100644 index 4cc9f90cd..000000000 --- a/jsdoc-testing/jsdoc/src/objects/Line.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * A continuous line. The line are rendered by connecting consecutive - * vertices with straight lines. - * - * ```js - * const material = new THREE.LineBasicMaterial( { color: 0x0000ff } ); - * - * const points = []; - * points.push( new THREE.Vector3( - 10, 0, 0 ) ); - * points.push( new THREE.Vector3( 0, 10, 0 ) ); - * points.push( new THREE.Vector3( 10, 0, 0 ) ); - * - * const geometry = new THREE.BufferGeometry().setFromPoints( points ); - * - * const line = new THREE.Line( geometry, material ); - * scene.add( line ); - * ``` - * - * @augments Object3D - */ -export class Line extends Object3D { - /** - * Constructs a new line. - * - * @param {BufferGeometry} [geometry] - The line geometry. - * @param {Material|Array} [material] - The line material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLine: boolean; - type: string; - /** - * The line geometry. - * - * @type {BufferGeometry} - */ - geometry: BufferGeometry; - /** - * The line material. - * - * @type {Material|Array} - * @default LineBasicMaterial - */ - material: Material | Array; - /** - * A dictionary representing the morph targets in the geometry. The key is the - * morph targets name, the value its attribute index. This member is `undefined` - * by default and only set when morph targets are detected in the geometry. - * - * @type {Object|undefined} - * @default undefined - */ - morphTargetDictionary: { - [x: string]: number; - } | undefined; - /** - * An array of weights typically in the range `[0,1]` that specify how much of the morph - * is applied. This member is `undefined` by default and only set when morph targets are - * detected in the geometry. - * - * @type {Array|undefined} - * @default undefined - */ - morphTargetInfluences: Array | undefined; - copy(source: any, recursive: any): this; - /** - * Computes an array of distance values which are necessary for rendering dashed lines. - * For each vertex in the geometry, the method calculates the cumulative length from the - * current point to the very beginning of the line. - * - * @return {Line} A reference to this line. - */ - computeLineDistances(): Line; - /** - * Returns `true` if this line intersects the given frustum. - * - * @param {Frustum|FrustumArray} frustum - The frustum to test. - * @return {boolean} Whether this line intersects the given frustum or not. - */ - intersectsFrustum(frustum: Frustum | FrustumArray): boolean; - /** - * Computes intersection points between a casted ray and this line. - * - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - The target array that holds the intersection points. - */ - raycast(raycaster: Raycaster, intersects: Array): void; - /** - * Sets the values of {@link Line#morphTargetDictionary} and {@link Line#morphTargetInfluences} - * to make sure existing morph targets can influence this 3D object. - */ - updateMorphTargets(): void; -} -import { Object3D } from '../core/Object3D.js'; -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts b/jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts deleted file mode 100644 index 2f08cb084..000000000 --- a/jsdoc-testing/jsdoc/src/objects/LineLoop.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A continuous line. This is nearly the same as {@link Line} the only difference - * is that the last vertex is connected with the first vertex in order to close - * the line to form a loop. - * - * @augments Line - */ -export class LineLoop extends Line { - /** - * Constructs a new line loop. - * - * @param {BufferGeometry} [geometry] - The line geometry. - * @param {Material|Array} [material] - The line material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineLoop: boolean; -} -import { Line } from './Line.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts b/jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts deleted file mode 100644 index 88df8f57f..000000000 --- a/jsdoc-testing/jsdoc/src/objects/LineSegments.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * A series of lines drawn between pairs of vertices. - * - * @augments Line - */ -export class LineSegments extends Line { - /** - * Constructs a new line segments. - * - * @param {BufferGeometry} [geometry] - The line geometry. - * @param {Material|Array} [material] - The line material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isLineSegments: boolean; - computeLineDistances(): this; -} -import { Line } from './Line.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Mesh.d.ts b/jsdoc-testing/jsdoc/src/objects/Mesh.d.ts deleted file mode 100644 index 95ec4a1e1..000000000 --- a/jsdoc-testing/jsdoc/src/objects/Mesh.d.ts +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Class representing triangular polygon mesh based objects. - * - * ```js - * const geometry = new THREE.BoxGeometry( 1, 1, 1 ); - * const material = new THREE.MeshBasicMaterial( { color: 0xffff00 } ); - * const mesh = new THREE.Mesh( geometry, material ); - * scene.add( mesh ); - * ``` - * - * @augments Object3D - */ -export class Mesh extends Object3D { - /** - * Constructs a new mesh. - * - * @param {BufferGeometry} [geometry] - The mesh geometry. - * @param {Material|Array} [material] - The mesh material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMesh: boolean; - type: string; - /** - * The mesh geometry. - * - * @type {BufferGeometry} - */ - geometry: BufferGeometry; - /** - * The mesh material. - * - * @type {Material|Array} - * @default MeshBasicMaterial - */ - material: Material | Array; - /** - * A dictionary representing the morph targets in the geometry. The key is the - * morph targets name, the value its attribute index. This member is `undefined` - * by default and only set when morph targets are detected in the geometry. - * - * @type {Object|undefined} - * @default undefined - */ - morphTargetDictionary: { - [x: string]: number; - } | undefined; - /** - * An array of weights typically in the range `[0,1]` that specify how much of the morph - * is applied. This member is `undefined` by default and only set when morph targets are - * detected in the geometry. - * - * @type {Array|undefined} - * @default undefined - */ - morphTargetInfluences: Array | undefined; - /** - * The number of instances of this mesh. - * Can only be used with {@link WebGPURenderer}. - * - * @type {number} - * @default 1 - */ - count: number; - copy(source: any, recursive: any): this; - /** - * Sets the values of {@link Mesh#morphTargetDictionary} and {@link Mesh#morphTargetInfluences} - * to make sure existing morph targets can influence this 3D object. - */ - updateMorphTargets(): void; - /** - * Returns the local-space position of the vertex at the given index, taking into - * account the current animation state of both morph targets and skinning. - * - * @param {number} index - The vertex index. - * @param {Vector3} target - The target object that is used to store the method's result. - * @return {Vector3} The vertex position in local space. - */ - getVertexPosition(index: number, target: Vector3): Vector3; - /** - * Returns `true` if this mesh intersects the given frustum. - * - * @param {Frustum|FrustumArray} frustum - The frustum to test. - * @return {boolean} Whether this mesh intersects the given frustum or not. - */ - intersectsFrustum(frustum: Frustum | FrustumArray): boolean; - /** - * Computes intersection points between a casted ray and this line. - * - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - The target array that holds the intersection points. - */ - raycast(raycaster: Raycaster, intersects: Array): void; - _computeIntersections(raycaster: any, intersects: any, rayLocalSpace: any): void; -} -import { Object3D } from '../core/Object3D.js'; -import { BufferGeometry } from '../core/BufferGeometry.js'; -import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Points.d.ts b/jsdoc-testing/jsdoc/src/objects/Points.d.ts deleted file mode 100644 index 1336406a3..000000000 --- a/jsdoc-testing/jsdoc/src/objects/Points.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * A class for displaying points or point clouds. - * - * @augments Object3D - */ -export class Points extends Object3D { - /** - * Constructs a new point cloud. - * - * @param {BufferGeometry} [geometry] - The points geometry. - * @param {Material|Array} [material] - The points material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isPoints: boolean; - type: string; - /** - * The points geometry. - * - * @type {BufferGeometry} - */ - geometry: BufferGeometry; - /** - * The line material. - * - * @type {Material|Array} - * @default PointsMaterial - */ - material: Material | Array; - /** - * A dictionary representing the morph targets in the geometry. The key is the - * morph targets name, the value its attribute index. This member is `undefined` - * by default and only set when morph targets are detected in the geometry. - * - * @type {Object|undefined} - * @default undefined - */ - morphTargetDictionary: { - [x: string]: number; - } | undefined; - /** - * An array of weights typically in the range `[0,1]` that specify how much of the morph - * is applied. This member is `undefined` by default and only set when morph targets are - * detected in the geometry. - * - * @type {Array|undefined} - * @default undefined - */ - morphTargetInfluences: Array | undefined; - copy(source: any, recursive: any): this; - /** - * Returns `true` if this point cloud intersects the given frustum. - * - * @param {Frustum|FrustumArray} frustum - The frustum to test. - * @return {boolean} Whether this point cloud intersects the given frustum or not. - */ - intersectsFrustum(frustum: Frustum | FrustumArray): boolean; - /** - * Computes intersection points between a casted ray and this point cloud. - * - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - The target array that holds the intersection points. - */ - raycast(raycaster: Raycaster, intersects: Array): void; - /** - * Sets the values of {@link Points#morphTargetDictionary} and {@link Points#morphTargetInfluences} - * to make sure existing morph targets can influence this 3D object. - */ - updateMorphTargets(): void; -} -import { Object3D } from '../core/Object3D.js'; -import { BufferGeometry } from '../core/BufferGeometry.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts b/jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts deleted file mode 100644 index 02c01c61d..000000000 --- a/jsdoc-testing/jsdoc/src/objects/Skeleton.d.ts +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Class for representing the armatures in `three.js`. The skeleton - * is defined by a hierarchy of bones. - * - * ```js - * const bones = []; - * - * const shoulder = new THREE.Bone(); - * const elbow = new THREE.Bone(); - * const hand = new THREE.Bone(); - * - * shoulder.add( elbow ); - * elbow.add( hand ); - * - * bones.push( shoulder , elbow, hand); - * - * shoulder.position.y = -5; - * elbow.position.y = 0; - * hand.position.y = 5; - * - * const armSkeleton = new THREE.Skeleton( bones ); - * ``` - */ -export class Skeleton { - /** - * Constructs a new skeleton. - * - * @param {Array} [bones] - An array of bones. - * @param {Array} [boneInverses] - An array of bone inverse matrices. - * If not provided, these matrices will be computed automatically via {@link Skeleton#calculateInverses}. - */ - constructor(bones?: Array, boneInverses?: Array); - uuid: string; - /** - * An array of bones defining the skeleton. - * - * @type {Array} - */ - bones: Array; - /** - * An array of bone inverse matrices. - * - * @type {Array} - */ - boneInverses: Array; - /** - * An array buffer holding the bone data. - * Input data for {@link Skeleton#boneTexture}. - * - * @type {?Float32Array} - * @default null - */ - boneMatrices: Float32Array | null; - /** - * A texture holding the bone data for use - * in the vertex shader. - * - * @type {?DataTexture} - * @default null - */ - boneTexture: DataTexture | null; - /** - * Initializes the skeleton. This method gets automatically called by the constructor - * but depending on how the skeleton is created it might be necessary to call this method - * manually. - */ - init(): void; - /** - * Computes the bone inverse matrices. This method resets {@link Skeleton#boneInverses} - * and fills it with new matrices. - */ - calculateInverses(): void; - /** - * Resets the skeleton to the base pose. - */ - pose(): void; - /** - * Resets the skeleton to the base pose. - */ - update(): void; - /** - * Returns a new skeleton with copied values from this instance. - * - * @return {Skeleton} A clone of this instance. - */ - clone(): Skeleton; - /** - * Computes a data texture for passing bone data to the vertex shader. - * - * @return {Skeleton} A reference of this instance. - */ - computeBoneTexture(): Skeleton; - /** - * Searches through the skeleton's bone array and returns the first with a - * matching name. - * - * @param {string} name - The name of the bone. - * @return {Bone|undefined} The found bone. `undefined` if no bone has been found. - */ - getBoneByName(name: string): Bone | undefined; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - */ - dispose(): void; - /** - * Setups the skeleton by the given JSON and bones. - * - * @param {Object} json - The skeleton as serialized JSON. - * @param {Object} bones - An array of bones. - * @return {Skeleton} A reference of this instance. - */ - fromJSON(json: Object, bones: { - [x: string]: Bone; - }): Skeleton; - /** - * Serializes the skeleton into JSON. - * - * @return {Object} A JSON object representing the serialized skeleton. - * @see {@link ObjectLoader#parse} - */ - toJSON(): Object; -} -import { Bone } from './Bone.js'; -import { Matrix4 } from '../math/Matrix4.js'; -import { DataTexture } from '../textures/DataTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts b/jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts deleted file mode 100644 index 77cf71c4e..000000000 --- a/jsdoc-testing/jsdoc/src/objects/SkinnedMesh.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -/** - * A mesh that has a {@link Skeleton} that can then be used to animate the - * vertices of the geometry with skinning/skeleton animation. - * - * Next to a valid skeleton, the skinned mesh requires skin indices and weights - * as buffer attributes in its geometry. These attribute define which bones affect a single - * vertex to a certain extend. - * - * Typically skinned meshes are not created manually but loaders like {@link GLTFLoader} - * or {@link FBXLoader } import respective models. - * - * @augments Mesh - * @demo scenes/bones-browser.html - */ -export class SkinnedMesh extends Mesh { - /** - * Constructs a new skinned mesh. - * - * @param {BufferGeometry} [geometry] - The mesh geometry. - * @param {Material|Array} [material] - The mesh material. - */ - constructor(geometry?: BufferGeometry, material?: Material | Array); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSkinnedMesh: boolean; - /** - * `AttachedBindMode` means the skinned mesh shares the same world space as the skeleton. - * This is not true when using `DetachedBindMode` which is useful when sharing a skeleton - * across multiple skinned meshes. - * - * @type {(AttachedBindMode|DetachedBindMode)} - * @default AttachedBindMode - */ - bindMode: (string | string); - /** - * The base matrix that is used for the bound bone transforms. - * - * @type {Matrix4} - */ - bindMatrix: Matrix4; - /** - * The base matrix that is used for resetting the bound bone transforms. - * - * @type {Matrix4} - */ - bindMatrixInverse: Matrix4; - /** - * The bounding box of the skinned mesh. Can be computed via {@link SkinnedMesh#computeBoundingBox}. - * - * @type {?Box3} - * @default null - */ - boundingBox: Box3 | null; - /** - * The bounding sphere of the skinned mesh. Can be computed via {@link SkinnedMesh#computeBoundingSphere}. - * - * @type {?Sphere} - * @default null - */ - boundingSphere: Sphere | null; - /** - * Computes the bounding box of the skinned mesh, and updates {@link SkinnedMesh#boundingBox}. - * The bounding box is not automatically computed by the engine; this method must be called by your app. - * If the skinned mesh is animated, the bounding box should be recomputed per frame in order to reflect - * the current animation state. - */ - computeBoundingBox(): void; - /** - * Computes the bounding sphere of the skinned mesh, and updates {@link SkinnedMesh#boundingSphere}. - * The bounding sphere is automatically computed by the engine once when it is needed, e.g., for ray casting - * and view frustum culling. If the skinned mesh is animated, the bounding sphere should be recomputed - * per frame in order to reflect the current animation state. - */ - computeBoundingSphere(): void; - copy(source: any, recursive: any): this; - skeleton: any; - raycast(raycaster: any, intersects: any): void; - getVertexPosition(index: any, target: any): any; - /** - * Binds the given skeleton to the skinned mesh. - * - * @param {Skeleton} skeleton - The skeleton to bind. - * @param {Matrix4} [bindMatrix] - The bind matrix. If no bind matrix is provided, - * the skinned mesh's world matrix will be used instead. - */ - bind(skeleton: Skeleton, bindMatrix?: Matrix4): void; - /** - * This method sets the skinned mesh in the rest pose). - */ - pose(): void; - /** - * Normalizes the skin weights which are defined as a buffer attribute - * in the skinned mesh's geometry. - */ - normalizeSkinWeights(): void; - updateMatrixWorld(force: any): void; - /** - * Applies the bone transform associated with the given index to the given - * vector. Can be used to transform positions or direction vectors by providing - * a Vector4 with 1 or 0 in the w component respectively. Returns the updated vector. - * - * @param {number} index - The vertex index. - * @param {Vector3|Vector4} target - The target object that is used to store the method's result. - * @return {Vector3|Vector4} The updated vertex attribute data. - */ - applyBoneTransform(index: number, target: Vector3 | Vector4): Vector3 | Vector4; -} -import { Mesh } from './Mesh.js'; -import { Matrix4 } from '../math/Matrix4.js'; -import { Box3 } from '../math/Box3.js'; -import { Sphere } from '../math/Sphere.js'; -import { Vector3 } from '../math/Vector3.js'; -import { Vector4 } from '../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/objects/Sprite.d.ts b/jsdoc-testing/jsdoc/src/objects/Sprite.d.ts deleted file mode 100644 index e250827d7..000000000 --- a/jsdoc-testing/jsdoc/src/objects/Sprite.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -/** - * A sprite is a plane that always faces towards the camera, generally with a - * partially transparent texture applied. - * - * Sprites do not cast shadows, setting {@link Object3D#castShadow} to `true` will - * have no effect. - * - * ```js - * const map = new THREE.TextureLoader().load( 'sprite.png' ); - * const material = new THREE.SpriteMaterial( { map: map } ); - * - * const sprite = new THREE.Sprite( material ); - * scene.add( sprite ); - * ``` - * - * @augments Object3D - */ -export class Sprite extends Object3D { - /** - * Constructs a new sprite. - * - * @param {(SpriteMaterial|SpriteNodeMaterial)} [material] - The sprite material. - */ - constructor(material?: (SpriteMaterial | SpriteNodeMaterial)); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSprite: boolean; - type: string; - /** - * The sprite geometry. - * - * @type {BufferGeometry} - */ - geometry: BufferGeometry; - /** - * The sprite material. - * - * @type {(SpriteMaterial|SpriteNodeMaterial)} - */ - material: (SpriteMaterial | SpriteNodeMaterial); - /** - * The sprite's anchor point, and the point around which the sprite rotates. - * A value of `(0.5, 0.5)` corresponds to the midpoint of the sprite. A value - * of `(0, 0)` corresponds to the lower left corner of the sprite. - * - * @type {Vector2} - * @default (0.5,0.5) - */ - center: Vector2; - /** - * The number of instances of this sprite. - * Can only be used with {@link WebGPURenderer}. - * - * @type {number} - * @default 1 - */ - count: number; - /** - * Returns `true` if this sprite intersects the given frustum. - * - * @param {Frustum|FrustumArray} frustum - The frustum to test. - * @return {boolean} Whether this sprite intersects the given frustum or not. - */ - intersectsFrustum(frustum: Frustum | FrustumArray): boolean; - /** - * Computes intersection points between a casted ray and this sprite. - * - * @param {Raycaster} raycaster - The raycaster. - * @param {Array} intersects - The target array that holds the intersection points. - */ - raycast(raycaster: Raycaster, intersects: Array): void; - copy(source: any, recursive: any): this; -} -import { Object3D } from '../core/Object3D.js'; -import { BufferGeometry } from '../core/BufferGeometry.js'; -import { SpriteMaterial } from '../materials/SpriteMaterial.js'; -import { Vector2 } from '../math/Vector2.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts deleted file mode 100644 index e27e8a964..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/WebGL3DRenderTarget.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * A 3D render target used in context of {@link WebGLRenderer}. - * - * @augments WebGLRenderTarget - */ -export class WebGL3DRenderTarget extends WebGLRenderTarget { - /** - * Constructs a new 3D render target. - * - * @param {number} [width=1] - The width of the render target. - * @param {number} [height=1] - The height of the render target. - * @param {number} [depth=1] - The height of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(width?: number, height?: number, depth?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGL3DRenderTarget: boolean; -} -import { WebGLRenderTarget } from './WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts deleted file mode 100644 index 22f9b0da1..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/WebGLArrayRenderTarget.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * An array render target used in context of {@link WebGLRenderer}. - * - * @augments WebGLRenderTarget - */ -export class WebGLArrayRenderTarget extends WebGLRenderTarget { - /** - * Constructs a new array render target. - * - * @param {number} [width=1] - The width of the render target. - * @param {number} [height=1] - The height of the render target. - * @param {number} [depth=1] - The height of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(width?: number, height?: number, depth?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLArrayRenderTarget: boolean; -} -import { WebGLRenderTarget } from './WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts deleted file mode 100644 index c112d383d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/WebGLCubeRenderTarget.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * A cube render target used in context of {@link WebGLRenderer}. - * - * @augments WebGLRenderTarget - */ -export class WebGLCubeRenderTarget extends WebGLRenderTarget { - /** - * Constructs a new cube render target. - * - * @param {number} [size=1] - The size of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(size?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLCubeRenderTarget: boolean; - /** - * Converts the given equirectangular texture to a cube map. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {Texture} texture - The equirectangular texture. - * @return {WebGLCubeRenderTarget} A reference to this cube render target. - */ - fromEquirectangularTexture(renderer: WebGLRenderer, texture: Texture): WebGLCubeRenderTarget; - /** - * Clears this cube render target. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear(renderer: WebGLRenderer, color?: boolean, depth?: boolean, stencil?: boolean): void; -} -import { WebGLRenderTarget } from './WebGLRenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts deleted file mode 100644 index f20262ff0..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/WebGLRenderTarget.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * A render target used in context of {@link WebGLRenderer}. - * - * @augments RenderTarget - */ -export class WebGLRenderTarget extends RenderTarget { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLRenderTarget: boolean; -} -import { RenderTarget } from '../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts deleted file mode 100644 index 7ed2e8df3..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/WebGLRenderer.d.ts +++ /dev/null @@ -1,580 +0,0 @@ -/** - * ~Options - */ -export type WebGLRenderer = { - /** - * - A canvas element where the renderer draws its output. If not passed in here, a new canvas element will be created by the renderer. - */ - canvas?: HTMLCanvasElement | OffscreenCanvas | undefined; - /** - * - Can be used to attach an existing rendering context to this renderer. - */ - context?: WebGL2RenderingContext | undefined; - /** - * - The default shader precision. Uses `highp` if supported by the device. - */ - precision?: "highp" | "mediump" | "lowp" | undefined; - /** - * - Controls the default clear alpha value. When set to`true`, the value is `0`. Otherwise it's `1`. - */ - alpha?: boolean | undefined; - /** - * Whether the renderer will assume colors have premultiplied alpha or not. - */ - premultipliedAlpha?: boolean | undefined; - /** - * Whether to use the default MSAA or not. - */ - antialias?: boolean | undefined; - /** - * Whether the drawing buffer has a stencil buffer of at least 8 bits or not. - */ - stencil?: boolean | undefined; - /** - * Whether to preserve the buffer until manually cleared or overwritten. - */ - preserveDrawingBuffer?: boolean | undefined; - /** - * Provides a hint to the user agent indicating what configuration of GPU is suitable for this WebGL context. - */ - powerPreference?: "default" | "high-performance" | "low-power" | undefined; - /** - * Whether the renderer creation will fail upon low performance is detected. - */ - failIfMajorPerformanceCaveat?: boolean | undefined; - /** - * Whether the drawing buffer has a depth buffer of at least 16 bits. - */ - depth?: boolean | undefined; - /** - * Whether to use a logarithmic depth buffer. It may be necessary to use this if dealing with huge differences in scale in a single scene. - * Note that this setting uses `gl_FragDepth` if available which disables the Early Fragment Test optimization and can cause a decrease in performance. - */ - logarithmicDepthBuffer?: boolean | undefined; - /** - * Whether to use a reverse depth buffer. Requires the `EXT_clip_control` extension. - * This is a more faster and accurate version than logarithmic depth buffer. - */ - reversedDepthBuffer?: boolean | undefined; - /** - * Defines the type of the output buffer. Use `HalfFloatType` for HDR rendering with tone mapping and post-processing support. - */ - outputBufferType?: number | undefined; -}; -/** - * This renderer uses WebGL 2 to display scenes. - * - * WebGL 1 is not supported since `r163`. - */ -export class WebGLRenderer { - /** - * Constructs a new WebGL renderer. - * - * @param {WebGLRenderer~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLRenderer: boolean; - /** - * A canvas where the renderer draws its output. This is automatically created by the renderer - * in the constructor (if not provided already); you just need to add it to your page like so: - * ```js - * document.body.appendChild( renderer.domElement ); - * ``` - * - * @type {HTMLCanvasElement|OffscreenCanvas} - */ - domElement: HTMLCanvasElement | OffscreenCanvas; - /** - * A object with debug configuration settings. - * - * - `checkShaderErrors`: If it is `true`, defines whether material shader programs are - * checked for errors during compilation and linkage process. It may be useful to disable - * this check in production for performance gain. It is strongly recommended to keep these - * checks enabled during development. If the shader does not compile and link, it will not - * work and associated material will not render. - * - `onShaderError(gl, program, glVertexShader,glFragmentShader)`: A callback function that - * can be used for custom error reporting. The callback receives the WebGL context, an instance - * of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader. - * Assigning a custom function disables the default error reporting. - * - * @type {Object} - */ - debug: Object; - /** - * Whether the renderer should automatically clear its output before rendering a frame or not. - * - * @type {boolean} - * @default true - */ - autoClear: boolean; - /** - * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear - * the color buffer or not. - * - * @type {boolean} - * @default true - */ - autoClearColor: boolean; - /** - * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear - * the depth buffer or not. - * - * @type {boolean} - * @default true - */ - autoClearDepth: boolean; - /** - * If {@link WebGLRenderer#autoClear} set to `true`, whether the renderer should clear - * the stencil buffer or not. - * - * @type {boolean} - * @default true - */ - autoClearStencil: boolean; - /** - * Whether the renderer should sort objects or not. - * - * Note: Sorting is used to attempt to properly render objects that have some - * degree of transparency. By definition, sorting objects may not work in all - * cases. Depending on the needs of application, it may be necessary to turn - * off sorting and use other methods to deal with transparency rendering e.g. - * manually determining each object's rendering order. - * - * @type {boolean} - * @default true - */ - sortObjects: boolean; - /** - * User-defined clipping planes specified in world space. These planes apply globally. - * Points in space whose dot product with the plane is negative are cut away. - * - * @type {Array} - */ - clippingPlanes: Array; - /** - * Whether the renderer respects object-level clipping planes or not. - * - * @type {boolean} - * @default false - */ - localClippingEnabled: boolean; - /** - * The tone mapping technique of the renderer. - * - * @type {(NoToneMapping|LinearToneMapping|ReinhardToneMapping|CineonToneMapping|ACESFilmicToneMapping|CustomToneMapping|AgXToneMapping|NeutralToneMapping)} - * @default NoToneMapping - */ - toneMapping: (number | LinearToneMapping | ReinhardToneMapping | CineonToneMapping | ACESFilmicToneMapping | CustomToneMapping | AgXToneMapping | NeutralToneMapping); - /** - * Exposure level of tone mapping. - * - * @type {number} - * @default 1 - */ - toneMappingExposure: number; - /** - * The normalized resolution scale for the transmission render target, measured in percentage - * of viewport dimensions. Lowering this value can result in significant performance improvements - * when using {@link MeshPhysicalMaterial#transmission}. - * - * @type {number} - * @default 1 - */ - transmissionResolutionScale: number; - _outputColorSpace: string; - /** - * A reference to the XR manager. - * - * @type {WebXRManager} - */ - xr: WebXRManager; - /** - * Returns the rendering context. - * - * @return {WebGL2RenderingContext} The rendering context. - */ - getContext: () => WebGL2RenderingContext; - /** - * Returns the rendering context attributes. - * - * @return {WebGLContextAttributes} The rendering context attributes. - */ - getContextAttributes: () => WebGLContextAttributes; - /** - * Simulates a loss of the WebGL context. This requires support for the `WEBGL_lose_context` extension. - */ - forceContextLoss: () => void; - /** - * Simulates a restore of the WebGL context. This requires support for the `WEBGL_lose_context` extension. - */ - forceContextRestore: () => void; - /** - * Returns the pixel ratio. - * - * @return {number} The pixel ratio. - */ - getPixelRatio: () => number; - /** - * Sets the given pixel ratio and resizes the canvas if necessary. - * - * @param {number} value - The pixel ratio. - */ - setPixelRatio: (value: number) => void; - /** - * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The renderer's size in logical pixels. - */ - getSize: (target: Vector2) => Vector2; - /** - * Resizes the output canvas to (width, height) with device pixel ratio taken - * into account, and also sets the viewport to fit that size, starting in (0, - * 0). Setting `updateStyle` to false prevents any style changes to the output canvas. - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. - */ - setSize: (width: number, height: number, updateStyle?: boolean) => void; - /** - * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize: (target: Vector2) => Vector2; - /** - * This method allows to define the drawing buffer size by specifying - * width, height and pixel ratio all at once. The size of the drawing - * buffer is computed with this formula: - * ```js - * size.x = width * pixelRatio; - * size.y = height * pixelRatio; - * ``` - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {number} pixelRatio - The pixel ratio. - */ - setDrawingBufferSize: (width: number, height: number, pixelRatio: number) => void; - /** - * Sets the post-processing effects to be applied after rendering. - * - * @param {Array} effects - An array of post-processing effects. - */ - setEffects: (effects: any[]) => void; - /** - * Returns the current viewport definition. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The current viewport definition. - */ - getCurrentViewport: (target: Vector2) => Vector2; - /** - * Returns the viewport definition. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The viewport definition. - */ - getViewport: (target: Vector4) => Vector4; - /** - * Sets the viewport to render from `(x, y)` to `(x + width, y + height)`. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. - * Or alternatively a four-component vector specifying all the parameters of the viewport. - * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - */ - setViewport: (x: number | Vector4, y: number, width: number, height: number) => void; - /** - * Returns the scissor region. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The scissor region. - */ - getScissor: (target: Vector4) => Vector4; - /** - * Sets the scissor region to render from `(x, y)` to `(x + width, y + height)`. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit. - * Or alternatively a four-component vector specifying all the parameters of the scissor region. - * @param {number} y - The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit. - * @param {number} width - The width of the scissor region in logical pixel unit. - * @param {number} height - The height of the scissor region in logical pixel unit. - */ - setScissor: (x: number | Vector4, y: number, width: number, height: number) => void; - /** - * Returns `true` if the scissor test is enabled. - * - * @return {boolean} Whether the scissor test is enabled or not. - */ - getScissorTest: () => boolean; - /** - * Enable or disable the scissor test. When this is enabled, only the pixels - * within the defined scissor area will be affected by further renderer - * actions. - * - * @param {boolean} boolean - Whether the scissor test is enabled or not. - */ - setScissorTest: (boolean: boolean) => void; - /** - * Sets a custom opaque sort function for the render lists. Pass `null` - * to use the default `painterSortStable` function. - * - * @param {?Function} method - The opaque sort function. - */ - setOpaqueSort: (method: Function | null) => void; - /** - * Sets a custom transparent sort function for the render lists. Pass `null` - * to use the default `reversePainterSortStable` function. - * - * @param {?Function} method - The opaque sort function. - */ - setTransparentSort: (method: Function | null) => void; - /** - * Returns the clear color. - * - * @param {Color} target - The method writes the result in this target object. - * @return {Color} The clear color. - */ - getClearColor: (target: Color) => Color; - /** - * Sets the clear color and alpha. - * - * @param {Color} color - The clear color. - * @param {number} [alpha=1] - The clear alpha. - */ - setClearColor: (...args: any[]) => void; - /** - * Returns the clear alpha. Ranges within `[0,1]`. - * - * @return {number} The clear alpha. - */ - getClearAlpha: () => number; - /** - * Sets the clear alpha. - * - * @param {number} alpha - The clear alpha. - */ - setClearAlpha: (...args: any[]) => void; - /** - * Tells the renderer to clear its color, depth or stencil drawing buffer(s). - * This method initializes the buffers to the current clear color values. - * - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear: (color?: boolean, depth?: boolean, stencil?: boolean) => void; - /** - * Clears the color buffer. Equivalent to calling `renderer.clear( true, false, false )`. - */ - clearColor: () => void; - /** - * Clears the depth buffer. Equivalent to calling `renderer.clear( false, true, false )`. - */ - clearDepth: () => void; - /** - * Clears the stencil buffer. Equivalent to calling `renderer.clear( false, false, true )`. - */ - clearStencil: () => void; - /** - * Sets a compatibility node builder for rendering node materials with WebGLRenderer. - * This enables using TSL (Three.js Shading Language) node materials to prepare - * for migration to WebGPURenderer. - * - * @param {WebGLNodesHandler} nodesHandler - The node builder instance. - */ - setNodesHandler: (nodesHandler: WebGLNodesHandler) => void; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - */ - dispose: () => void; - renderBufferDirect: (camera: any, scene: any, geometry: any, material: any, object: any, group: any) => void; - /** - * Compiles all materials in the scene with the camera. This is useful to precompile shaders - * before the first rendering. If you want to add a 3D object to an existing scene, use the third - * optional parameter for applying the target scene. - * - * Note that the (target) scene's lighting and environment must be configured before calling this method. - * - * @param {Object3D} scene - The scene or another type of 3D object to precompile. - * @param {Camera} camera - The camera. - * @param {?Scene} [targetScene=null] - The target scene. - * @return {Set} The precompiled materials. - */ - compile: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Set; - /** - * Asynchronous version of {@link WebGLRenderer#compile}. - * - * This method makes use of the `KHR_parallel_shader_compile` WebGL extension. Hence, - * it is recommended to use this version of `compile()` whenever possible. - * - * @async - * @param {Object3D} scene - The scene or another type of 3D object to precompile. - * @param {Camera} camera - The camera. - * @param {?Scene} [targetScene=null] - The target scene. - * @return {Promise} A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation. - */ - compileAsync: (scene: Object3D, camera: Camera, targetScene?: Scene | null) => Promise; - /** - * Applications are advised to always define the animation loop - * with this method and not manually with `requestAnimationFrame()` - * for best compatibility. - * - * @param {?onAnimationCallback} callback - The application's animation loop. - */ - setAnimationLoop: (callback: onAnimationCallback | null) => void; - /** - * Renders the given scene (or other type of 3D object) using the given camera. - * - * The render is done to a previously specified render target set by calling {@link WebGLRenderer#setRenderTarget} - * or to the canvas as usual. - * - * By default render buffers are cleared before rendering but you can prevent - * this by setting the property `autoClear` to `false`. If you want to prevent - * only certain buffers being cleared you can `autoClearColor`, `autoClearDepth` - * or `autoClearStencil` to `false`. To force a clear, use {@link WebGLRenderer#clear}. - * - * @param {Object3D} scene - The scene to render. - * @param {Camera} camera - The camera. - */ - render: (scene: Object3D, camera: Camera) => void; - /** - * Returns the active cube face. - * - * @return {number} The active cube face. - */ - getActiveCubeFace: () => number; - /** - * Returns the active mipmap level. - * - * @return {number} The active mipmap level. - */ - getActiveMipmapLevel: () => number; - /** - * Returns the active render target. - * - * @return {?WebGLRenderTarget} The active render target. Returns `null` if no render target - * is currently set. - */ - getRenderTarget: () => WebGLRenderTarget | null; - setRenderTargetTextures: (renderTarget: any, colorTexture: any, depthTexture: any) => void; - setRenderTargetFramebuffer: (renderTarget: any, defaultFramebuffer: any) => void; - /** - * Sets the active rendertarget. - * - * @param {?WebGLRenderTarget} renderTarget - The render target to set. When `null` is given, - * the canvas is set as the active render target instead. - * @param {number} [activeCubeFace=0] - The active cube face when using a cube render target. - * Indicates the z layer to render in to when using 3D or array render targets. - * @param {number} [activeMipmapLevel=0] - The active mipmap level. - */ - setRenderTarget: (renderTarget: WebGLRenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number) => void; - /** - * Reads the pixel data from the given render target into the given buffer. - * - * @param {WebGLRenderTarget} renderTarget - The render target to read from. - * @param {number} x - The `x` coordinate of the copy region's origin. - * @param {number} y - The `y` coordinate of the copy region's origin. - * @param {number} width - The width of the copy region. - * @param {number} height - The height of the copy region. - * @param {TypedArray} buffer - The result buffer. - * @param {number} [activeCubeFaceIndex] - The active cube face index. - * @param {number} [textureIndex=0] - The texture index of an MRT render target. - */ - readRenderTargetPixels: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => void; - /** - * Asynchronous, non-blocking version of {@link WebGLRenderer#readRenderTargetPixels}. - * - * It is recommended to use this version of `readRenderTargetPixels()` whenever possible. - * - * @async - * @param {WebGLRenderTarget} renderTarget - The render target to read from. - * @param {number} x - The `x` coordinate of the copy region's origin. - * @param {number} y - The `y` coordinate of the copy region's origin. - * @param {number} width - The width of the copy region. - * @param {number} height - The height of the copy region. - * @param {TypedArray} buffer - The result buffer. - * @param {number} [activeCubeFaceIndex] - The active cube face index. - * @param {number} [textureIndex=0] - The texture index of an MRT render target. - * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. - */ - readRenderTargetPixelsAsync: (renderTarget: WebGLRenderTarget, x: number, y: number, width: number, height: number, buffer: TypedArray, activeCubeFaceIndex?: number, textureIndex?: number) => Promise; - /** - * Copies pixels from the current bound framebuffer into the given texture. - * - * @param {FramebufferTexture} texture - The texture. - * @param {?Vector2} [position=null] - The start position of the copy operation. - * @param {number} [level=0] - The mip level. The default represents the base mip. - */ - copyFramebufferToTexture: (texture: FramebufferTexture, position?: Vector2 | null, level?: number) => void; - /** - * Copies data of the given source texture into a destination texture. - * - * When using render target textures as `srcTexture` and `dstTexture`, you must make sure both render targets are initialized - * {@link WebGLRenderer#initRenderTarget}. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box2|Box3)} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. - * @param {?(Vector2|Vector3)} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. - * @param {number} [srcLevel=0] - The source mipmap level to copy. - * @param {?number} [dstLevel=0] - The destination mipmap level. - */ - copyTextureToTexture: (srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box2 | Box3) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number | null) => void; - /** - * Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data - * can be copied into it using {@link WebGLRenderer#copyTextureToTexture} before it has been - * rendered to. - * - * @param {WebGLRenderTarget} target - The render target. - */ - initRenderTarget: (target: WebGLRenderTarget) => void; - /** - * Initializes the given texture. Useful for preloading a texture rather than waiting until first - * render (which can cause noticeable lags due to decode and GPU upload overhead). - * - * @param {Texture} texture - The texture. - */ - initTexture: (texture: Texture) => void; - /** - * Can be used to reset the internal WebGL state. This method is mostly - * relevant for applications which share a single WebGL context across - * multiple WebGL libraries. - */ - resetState: () => void; - /** - * Defines the coordinate system of the renderer. - * - * In `WebGLRenderer`, the value is always `WebGLCoordinateSystem`. - * - * @type {WebGLCoordinateSystem|WebGPUCoordinateSystem} - * @default WebGLCoordinateSystem - * @readonly - */ - readonly get coordinateSystem(): number | WebGPUCoordinateSystem; - set outputColorSpace(colorSpace: string | LinearSRGBColorSpace); - /** - * Defines the output color space of the renderer. - * - * @type {SRGBColorSpace|LinearSRGBColorSpace} - * @default SRGBColorSpace - */ - get outputColorSpace(): string | LinearSRGBColorSpace; -} -import { WebXRManager } from './webxr/WebXRManager.js'; -import { Vector4 } from '../math/Vector4.js'; -import { Color } from '../math/Color.js'; -import { WebGLRenderTarget } from './WebGLRenderTarget.js'; -import { Vector3 } from '../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts deleted file mode 100644 index 276e5a64c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Animation.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -export default Animation; -/** - * This module manages the internal animation loop of the renderer. - * - * @private - */ -declare class Animation { - /** - * Constructs a new animation loop management component. - * - * @param {Renderer} renderer - A reference to the main renderer. - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(renderer: Renderer, nodes: NodeManager, info: Info); - /** - * A reference to the main renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * Renderer component for managing nodes related logic. - * - * @type {NodeManager} - */ - nodes: NodeManager; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * A reference to the context from `requestAnimationFrame()` can - * be called (usually `window`). - * - * @type {?(Window|XRSession)} - */ - _context: (Window | XRSession) | null; - /** - * The user-defined animation loop. - * - * @type {?Function} - * @default null - */ - _animationLoop: Function | null; - /** - * The requestId which is returned from the `requestAnimationFrame()` call. - * Can be used to cancel the stop the animation loop. - * - * @type {?number} - * @default null - */ - _requestId: number | null; - /** - * Starts the internal animation loop. - */ - start(): void; - /** - * Stops the internal animation loop. - */ - stop(): void; - /** - * Returns the user-level animation loop. - * - * @return {?Function} The animation loop. - */ - getAnimationLoop(): Function | null; - /** - * Defines the user-level animation loop. - * - * @param {?Function} callback - The animation loop. - */ - setAnimationLoop(callback: Function | null): void; - /** - * Returns the animation context. - * - * @return {Window|XRSession} The animation context. - */ - getContext(): Window | XRSession; - /** - * Defines the context in which `requestAnimationFrame()` is executed. - * - * @param {Window|XRSession} context - The context to set. - */ - setContext(context: Window | XRSession): void; - /** - * Frees all internal resources and stops the animation loop. - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts deleted file mode 100644 index 40b80e84c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Attributes.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export default Attributes; -/** - * This renderer module manages geometry attributes. - * - * @private - * @augments DataMap - */ -declare class Attributes extends DataMap { - /** - * Constructs a new attribute management component. - * - * @param {Backend} backend - The renderer's backend. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(backend: Backend, info: Info); - /** - * The renderer's backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * Deletes the data for the given attribute. - * - * @param {BufferAttribute} attribute - The attribute. - * @return {?Object} The deleted attribute data. - */ - delete(attribute: BufferAttribute): Object | null; - /** - * Updates the given attribute. This method creates attribute buffers - * for new attributes and updates data for existing ones. - * - * @param {BufferAttribute} attribute - The attribute to update. - * @param {number} type - The attribute type. - */ - update(attribute: BufferAttribute, type: number): void; - /** - * Utility method for handling interleaved buffer attributes correctly. - * To process them, their `InterleavedBuffer` is returned. - * - * @param {BufferAttribute} attribute - The attribute. - * @return {BufferAttribute|InterleavedBuffer} - */ - _getBufferAttribute(attribute: BufferAttribute): BufferAttribute | InterleavedBuffer; -} -import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts deleted file mode 100644 index d75563c24..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Backend.d.ts +++ /dev/null @@ -1,573 +0,0 @@ -export default Backend; -/** - * Most of the rendering related logic is implemented in the - * {@link Renderer} module and related management components. - * Sometimes it is required though to execute commands which are - * specific to the current 3D backend (which is WebGPU or WebGL 2). - * This abstract base class defines an interface that encapsulates - * all backend-related logic. Derived classes for each backend must - * implement the interface. - * - * @abstract - */ -declare class Backend { - /** - * Constructs a new backend. - * - * @param {Object} parameters - An object holding parameters for the backend. - */ - constructor(parameters?: Object); - /** - * The parameters of the backend. - * - * @type {Object} - */ - parameters: Object; - /** - * This weak map holds backend-specific data of objects - * like textures, attributes or render targets. - * - * @type {WeakMap} - */ - data: WeakMap; - /** - * A reference to the renderer. - * - * @type {?Renderer} - * @default null - */ - renderer: Renderer | null; - /** - * A reference to the canvas element the renderer is drawing to. - * - * @type {?(HTMLCanvasElement|OffscreenCanvas)} - * @default null - */ - domElement: (HTMLCanvasElement | OffscreenCanvas) | null; - /** - * A reference to the timestamp query pool. - * - * @type {{render: ?TimestampQueryPool, compute: ?TimestampQueryPool}} - */ - timestampQueryPool: { - render: TimestampQueryPool | null; - compute: TimestampQueryPool | null; - }; - /** - * Whether to track timestamps with a Timestamp Query API or not. - * - * @type {boolean} - * @default false - */ - trackTimestamp: boolean; - /** - * Initializes the backend so it is ready for usage. Concrete backends - * are supposed to implement their rendering context creation and related - * operations in this method. - * - * @async - * @param {Renderer} renderer - The renderer. - * @return {Promise} A Promise that resolves when the backend has been initialized. - */ - init(renderer: Renderer): Promise; - /** - * The coordinate system of the backend. - * - * @abstract - * @type {number} - * @readonly - */ - readonly get coordinateSystem(): number; - /** - * This method is executed at the beginning of a render call and - * can be used by the backend to prepare the state for upcoming - * draw calls. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - beginRender(): void; - /** - * This method is executed at the end of a render call and - * can be used by the backend to finalize work after draw - * calls. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - finishRender(): void; - /** - * Sets the XR rendering destination. - * - * Backends that render directly into XR framebuffers can override this hook. - * - * @param {?Object} xrTarget - The XR rendering destination. - */ - setXRTarget(): void; - /** - * This method is executed at the beginning of a compute call and - * can be used by the backend to prepare the state for upcoming - * compute tasks. - * - * @abstract - * @param {Node|Array} computeGroup - The compute node(s). - */ - beginCompute(): void; - /** - * This method is executed at the end of a compute call and - * can be used by the backend to finalize work after compute - * tasks. - * - * @abstract - * @param {Node|Array} computeGroup - The compute node(s). - */ - finishCompute(): void; - /** - * Executes a draw command for the given render object. - * - * @abstract - * @param {RenderObject} renderObject - The render object to draw. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - */ - draw(): void; - /** - * Executes a compute command for the given compute node. - * - * @abstract - * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. - * @param {Node} computeNode - The compute node. - * @param {Array} bindings - The bindings. - * @param {ComputePipeline} computePipeline - The compute pipeline. - */ - compute(): void; - /** - * Creates a shader program from the given programmable stage. - * - * @abstract - * @param {ProgrammableStage} program - The programmable stage. - */ - createProgram(): void; - /** - * Destroys the shader program of the given programmable stage. - * - * @abstract - * @param {ProgrammableStage} program - The programmable stage. - */ - destroyProgram(): void; - /** - * Creates bindings from the given bind group definition. - * - * @abstract - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(): void; - /** - * Updates the given bind group definition. - * - * @abstract - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - updateBindings(): void; - /** - * Updates a buffer binding. - * - * @abstract - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(): void; - /** - * Creates a render pipeline for the given render object. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(): void; - /** - * Creates a compute pipeline for the given compute node. - * - * @abstract - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(): void; - /** - * Returns `true` if the render pipeline requires an update. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the render pipeline requires an update or not. - */ - needsRenderUpdate(): boolean; - /** - * Returns a cache key that is used to identify render pipelines. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @return {string} The cache key. - */ - getRenderCacheKey(): string; - /** - * Returns a node builder for the given render object. - * - * @abstract - * @param {RenderObject} renderObject - The render object. - * @param {Renderer} renderer - The renderer. - * @return {NodeBuilder} The node builder. - */ - createNodeBuilder(): NodeBuilder; - /** - * Updates a GPU sampler for the given texture. - * - * @abstract - * @param {Sampler} binding - The sampler binding to update. - * @return {string} The current sampler key. - */ - updateSampler(): string; - /** - * Frees the GPU sampler for the given sampler binding. - * - * @abstract - * @param {Sampler} binding - The sampler binding to free. - */ - destroySampler(): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @abstract - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(): void; - /** - * Uploads the updated texture data to the GPU. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(): void; - /** - * Generates mipmaps for the given texture. - * - * @abstract - * @param {Texture} texture - The texture. - */ - generateMipmaps(): void; - /** - * Destroys the GPU data for the given texture object. - * - * @abstract - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(): void; - /** - * Returns texture data as a typed array. - * - * @abstract - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(): Promise; - /** - * Copies data of the given source texture to the given destination texture. - * - * @abstract - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @abstract - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(): void; - /** - * Creates the GPU buffer of a shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createAttribute(): void; - /** - * Creates the GPU buffer of an indexed shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The indexed buffer attribute. - */ - createIndexAttribute(): void; - /** - * Creates the GPU buffer of a storage attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createStorageAttribute(): void; - /** - * Creates a uniform buffer. - * - * @abstract - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - createUniformBuffer(): void; - /** - * Destroys a uniform buffer. - * - * @abstract - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - destroyUniformBuffer(): void; - /** - * Updates the GPU buffer of a shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute to update. - */ - updateAttribute(): void; - /** - * Destroys the GPU buffer of a shader attribute. - * - * @abstract - * @param {BufferAttribute} attribute - The buffer attribute to destroy. - */ - destroyAttribute(): void; - /** - * Returns the backend's rendering context. - * - * @abstract - * @return {Object} The rendering context. - */ - getContext(): Object; - /** - * Backends can use this method if they have to run - * logic when the renderer gets resized. - * - * @abstract - */ - updateSize(): void; - /** - * Updates the viewport with the values from the given render context. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - updateViewport(): void; - /** - * Updates a unique identifier for the given render context that can be used - * to allocate resources like occlusion queries or timestamp queries. - * - * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. - */ - updateTimeStampUID(abstractRenderContext: RenderContext | ComputeNode): void; - /** - * Returns a unique identifier for the given render context that can be used - * to allocate resources like occlusion queries or timestamp queries. - * - * @param {RenderContext|ComputeNode} abstractRenderContext - The render context. - * @return {string} The unique identifier. - */ - getTimestampUID(abstractRenderContext: RenderContext | ComputeNode): string; - /** - * Returns all timestamp frames for the given type. - * - * @param {string} type - The type of the time stamp. - * @return {Array} The timestamp frames. - */ - getTimestampFrames(type: string): Array; - /** - * Returns the query pool for the given uid. - * - * @param {string} uid - The unique identifier. - * @return {TimestampQueryPool} The query pool. - */ - _getQueryPool(uid: string): TimestampQueryPool; - /** - * Returns the timestamp for the given uid. - * - * @param {string} uid - The unique identifier. - * @return {number} The timestamp. - */ - getTimestamp(uid: string): number; - /** - * Whether the backend supports query timestamps or not. - * - * @type {boolean} - * @readonly - */ - readonly get hasTimestamp(): boolean; - /** - * Returns `true` if a timestamp for the given uid is available. - * - * @param {string} uid - The unique identifier. - * @return {boolean} Whether the timestamp is available or not. - */ - hasTimestampQuery(uid: string): boolean; - /** - * Returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. Backends must implement this method by using - * a Occlusion Query API. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(): boolean; - /** - * Resolves the time stamp for the given render context and type. - * - * @async - * @abstract - * @param {string} [type='render'] - The type of the time stamp. - * @return {Promise} A Promise that resolves with the time stamp. - */ - resolveTimestampsAsync(type?: string): Promise; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. - * - * @async - * @param {StorageBufferAttribute} attribute - The storage buffer attribute. - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(): Promise; - /** - * Checks if the given feature is supported by the backend. - * - * @async - * @abstract - * @param {string} name - The feature's name. - * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. - */ - hasFeatureAsync(): Promise; - /** - * Checks if the given feature is supported by the backend. - * - * @abstract - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(): boolean; - /** - * Returns the drawing buffer size. - * - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize(): Vector2; - /** - * Defines the scissor test. - * - * @abstract - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(): void; - /** - * Resets the backend's internal state. A no-op for backends without a state cache (e.g. WebGPU). - * - * @abstract - */ - resetState(): void; - /** - * Returns the clear color and alpha into a single - * color object. - * - * @return {Color4} The clear color. - */ - getClearColor(): Color4; - /** - * Returns the DOM element. If no DOM element exists, the backend - * creates a new one. - * - * @return {HTMLCanvasElement} The DOM element. - */ - getDomElement(): HTMLCanvasElement; - /** - * Checks if the backend has the given compatibility. - * - * @abstract - * @param {string} name - The compatibility. - * @return {boolean} Whether the backend has the given compatibility or not. - */ - hasCompatibility(): boolean; - /** - * Initializes the render target defined in the given render context. - * - * @abstract - * @param {RenderContext} renderContext - The render context. - */ - initRenderTarget(): void; - /** - * Sets a dictionary for the given object into the - * internal data structure. - * - * @param {Object} object - The object. - * @param {Object} value - The dictionary to set. - */ - set(object: Object, value: Object): void; - /** - * Returns the dictionary for the given object. - * - * @param {Object} object - The object. - * @return {Object} The object's dictionary. - */ - get(object: Object): Object; - /** - * Checks if the given object has a dictionary - * with data defined. - * - * @param {Object} object - The object. - * @return {boolean} Whether a dictionary for the given object as been defined or not. - */ - has(object: Object): boolean; - /** - * Deletes an object from the internal data structure. - * - * @param {Object} object - The object to delete. - */ - delete(object: Object): void; - /** - * Delete GPU data associated with a bind group. - * - * @abstract - * @param {BindGroup} bindGroup - The bind group. - */ - deleteBindGroupData(): void; - /** - * Frees internal resources. - * - * @abstract - */ - dispose(): void; -} -import { Vector2 } from '../../math/Vector2.js'; -import Color4 from './Color4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts deleted file mode 100644 index f8262c348..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Background.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -export default Background; -/** - * This renderer module manages the background. - * - * @private - * @augments DataMap - */ -declare class Background extends DataMap { - /** - * Constructs a new background management component. - * - * @param {Renderer} renderer - The renderer. - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - */ - constructor(renderer: Renderer, nodes: NodeManager); - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * Renderer component for managing nodes related logic. - * - * @type {NodeManager} - */ - nodes: NodeManager; - /** - * Updates the background for the given scene. Depending on how `Scene.background` - * or `Scene.backgroundNode` are configured, this method might configure a simple clear - * or add a mesh to the render list for rendering the background as a textured plane - * or skybox. - * - * @param {Scene} scene - The scene. - * @param {RenderList} renderList - The current render list. - * @param {RenderContext} renderContext - The current render context. - */ - update(scene: Scene, renderList: RenderList, renderContext: RenderContext): void; -} -import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts deleted file mode 100644 index 3fe0a0480..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/BindGroup.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default BindGroup; -/** - * A bind group represents a collection of bindings and thus a collection - * or resources. Bind groups are assigned to pipelines to provide them - * with the required resources (like uniform buffers or textures). - * - * @private - */ -declare class BindGroup { - /** - * Constructs a new bind group. - * - * @param {string} name - The bind group's name. - * @param {Array} bindings - An array of bindings. - */ - constructor(name?: string, bindings?: Array); - /** - * The bind group's name. - * - * @type {string} - */ - name: string; - /** - * An array of bindings. - * - * @type {Array} - */ - bindings: Array; - /** - * The group's ID. - * - * @type {number} - */ - id: number; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts deleted file mode 100644 index 46356fdc4..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Binding.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export default Binding; -/** - * A binding represents the connection between a resource (like a texture, sampler - * or uniform buffer) and the resource definition in a shader stage. - * - * This module is an abstract base class for all concrete bindings types. - * - * @abstract - * @private - */ -declare class Binding { - /** - * Constructs a new binding. - * - * @param {string} [name=''] - The binding's name. - */ - constructor(name?: string); - /** - * The binding's name. - * - * @type {string} - */ - name: string; - /** - * A bitmask that defines in what shader stages the - * binding's resource is accessible. - * - * @type {number} - */ - visibility: number; - /** - * Makes sure binding's resource is visible for the given shader stage. - * - * @param {number} visibility - The shader stage. - */ - setVisibility(visibility: number): void; - /** - * The shader stages in which the binding's resource is visible. - * - * @return {number} The visibility bitmask. - */ - getVisibility(): number; - /** - * Clones the binding. - * - * @return {Binding} The cloned binding. - */ - clone(): Binding; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts deleted file mode 100644 index 70fe07f98..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Bindings.d.ts +++ /dev/null @@ -1,126 +0,0 @@ -export default Bindings; -/** - * This renderer module manages the bindings of the renderer. - * - * @private - * @augments DataMap - */ -declare class Bindings extends DataMap { - /** - * Constructs a new bindings management component. - * - * @param {Backend} backend - The renderer's backend. - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - * @param {Textures} textures - Renderer component for managing textures. - * @param {Attributes} attributes - Renderer component for managing attributes. - * @param {Pipelines} pipelines - Renderer component for managing pipelines. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(backend: Backend, nodes: NodeManager, textures: Textures, attributes: Attributes, pipelines: Pipelines, info: Info); - /** - * The renderer's backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * Renderer component for managing textures. - * - * @type {Textures} - */ - textures: Textures; - /** - * Renderer component for managing pipelines. - * - * @type {Pipelines} - */ - pipelines: Pipelines; - /** - * Renderer component for managing attributes. - * - * @type {Attributes} - */ - attributes: Attributes; - /** - * Renderer component for managing nodes related logic. - * - * @type {NodeManager} - */ - nodes: NodeManager; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * Returns the bind groups for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {Array} The bind groups. - */ - getForRender(renderObject: RenderObject): Array; - /** - * Returns the bind groups for the given compute node. - * - * @param {Node} computeNode - The compute node. - * @return {Array} The bind groups. - */ - getForCompute(computeNode: Node): Array; - /** - * Updates the bindings for the given compute node. - * - * @param {Node} computeNode - The compute node. - */ - updateForCompute(computeNode: Node): void; - /** - * Updates the bindings for the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateForRender(renderObject: RenderObject): void; - /** - * Updates only the shared uniform buffers of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateSharedForRender(renderObject: RenderObject): void; - /** - * Deletes the bindings for the given compute node. - * - * @param {Node} computeNode - The compute node. - */ - deleteForCompute(computeNode: Node): void; - /** - * Deletes the bindings for the given renderObject node. - * - * @param {RenderObject} renderObject - The renderObject. - */ - deleteForRender(renderObject: RenderObject): void; - /** - * Creates the bindings for the given array of bindings. - * - * @param {Array} bindings - The bind groups. - */ - _createBindings(bindings: Array): void; - /** - * Deletes the given array of bindings. - * - * @param {Array} bindings - The bind groups. - */ - _destroyBindings(bindings: Array): void; - /** - * Updates the given array of bindings. - * - * @param {Array} bindings - The bind groups. - */ - _updateBindings(bindings: Array): void; - /** - * Updates the given bind group. - * - * @param {BindGroup} bindGroup - The bind group to update. - * @param {Array} bindings - The bind groups. - */ - _update(bindGroup: BindGroup, bindings: Array): void; -} -import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts deleted file mode 100644 index 29223086e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/BlendMode.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -export default BlendMode; -/** - * Represents blending configuration. - * - * This class encapsulates all blending-related properties that control how - * a material's colors are combined with the colors already in the frame buffer. - */ -declare class BlendMode { - /** - * Constructs a new blending configuration. - * - * @param {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} [blending=NormalBlending] - The blending mode. - */ - constructor(blending?: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending | MaterialBlending)); - /** - * Defines the blending type. - * - * It must be set to `CustomBlending` if custom blending properties like - * {@link BlendMode#blendSrc}, {@link BlendMode#blendDst} or {@link BlendMode#blendEquation} - * should have any effect. - * - * @type {(NoBlending|NormalBlending|AdditiveBlending|SubtractiveBlending|MultiplyBlending|CustomBlending|MaterialBlending)} - * @default NormalBlending - */ - blending: (NoBlending | number | AdditiveBlending | SubtractiveBlending | MultiplyBlending | CustomBlending | MaterialBlending); - /** - * Defines the blending source factor. - * - * This determines how the source (incoming) fragment color is factored before being added - * to the destination (existing) fragment color in the frame buffer. - * - * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default SrcAlphaFactor - */ - blendSrc: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - /** - * Defines the blending destination factor. - * - * This determines how the destination (existing) fragment color in the frame buffer - * is factored before being combined with the source (incoming) fragment color. - * - * @type {(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default OneMinusSrcAlphaFactor - */ - blendDst: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor); - /** - * Defines the blending equation. - * - * This determines how the source and destination colors are combined. - * - * @type {(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} - * @default AddEquation - */ - blendEquation: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation); - /** - * Defines the blending source alpha factor. - * - * When set, this allows separate control of the alpha channel's source blending factor. - * If `null`, {@link BlendMode#blendSrc} is used for the alpha channel as well. - * - * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default null - */ - blendSrcAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - /** - * Defines the blending destination alpha factor. - * - * When set, this allows separate control of the alpha channel's destination blending factor. - * If `null`, {@link BlendMode#blendDst} is used for the alpha channel as well. - * - * @type {?(ZeroFactor|OneFactor|SrcColorFactor|OneMinusSrcColorFactor|SrcAlphaFactor|OneMinusSrcAlphaFactor|DstAlphaFactor|OneMinusDstAlphaFactor|DstColorFactor|OneMinusDstColorFactor|SrcAlphaSaturateFactor|ConstantColorFactor|OneMinusConstantColorFactor|ConstantAlphaFactor|OneMinusConstantAlphaFactor)} - * @default null - */ - blendDstAlpha: (ZeroFactor | OneFactor | SrcColorFactor | OneMinusSrcColorFactor | number | number | DstAlphaFactor | OneMinusDstAlphaFactor | DstColorFactor | OneMinusDstColorFactor | SrcAlphaSaturateFactor | ConstantColorFactor | OneMinusConstantColorFactor | ConstantAlphaFactor | OneMinusConstantAlphaFactor) | null; - /** - * Defines the blending equation of the alpha channel. - * - * When set, this allows separate control of the alpha channel's blending equation. - * If `null`, {@link BlendMode#blendEquation} is used for the alpha channel as well. - * - * @type {?(AddEquation|SubtractEquation|ReverseSubtractEquation|MinEquation|MaxEquation)} - * @default null - */ - blendEquationAlpha: (number | SubtractEquation | ReverseSubtractEquation | MinEquation | MaxEquation) | null; - /** - * Defines whether to premultiply the alpha (transparency) value. - * - * If `true`, the RGB color of the texture or material is multiplied by its alpha value. - * This is useful for transparent textures/materials where the color data - * should already include the transparency information. - * - * @type {boolean} - * @default false - */ - premultiplyAlpha: boolean; - /** - * Copies the blending properties from the given source to this instance. - * - * @param {BlendMode} source - The blending configuration to copy from. - * @return {BlendMode} A reference to this instance. - */ - copy(source: BlendMode): BlendMode; - /** - * Returns a clone of this blending configuration. - * - * @return {BlendMode} A new Blending instance with the same properties. - */ - clone(): BlendMode; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts deleted file mode 100644 index 907f0ad0b..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Buffer.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -export default Buffer; -/** - * Represents a buffer binding type. - * - * @private - * @abstract - * @augments Binding - */ -declare class Buffer extends Binding { - /** - * Constructs a new buffer. - * - * @param {string} name - The buffer's name. - * @param {TypedArray} [buffer=null] - The buffer. - */ - constructor(name: string, buffer?: TypedArray); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBuffer: boolean; - /** - * The bytes per element. - * - * @type {number} - */ - bytesPerElement: number; - /** - * A reference to the internal buffer. - * - * @private - * @type {TypedArray} - */ - private _buffer; - /** - * An array of update ranges. - * - * @private - * @type {Array<{start: number, count: number}>} - */ - private _updateRanges; - /** - * The array of update ranges. - * - * @type {Array<{start: number, count: number}>} - */ - get updateRanges(): Array<{ - start: number; - count: number; - }>; - /** - * Adds an update range. - * - * @param {number} start - The start index. - * @param {number} count - The number of elements. - */ - addUpdateRange(start: number, count: number): void; - /** - * Clears all update ranges. - */ - clearUpdateRanges(): void; - /** - * The buffer's byte length. - * - * @type {number} - * @readonly - */ - readonly get byteLength(): number; - /** - * A reference to the internal buffer. - * - * @type {Float32Array} - * @readonly - */ - readonly get buffer(): Float32Array; - /** - * Updates the binding. - * - * @return {boolean} Whether the buffer has been updated and must be - * uploaded to the GPU. - */ - update(): boolean; - /** - * Releases the buffer. - */ - release(): void; -} -import Binding from './Binding.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts deleted file mode 100644 index 4d149b3a7..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/BufferUtils.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This function is usually called with the length in bytes of an array buffer. - * It returns an padded value which ensure chunk size alignment according to STD140 layout. - * - * @function - * @param {number} floatLength - The buffer length. - * @return {number} The padded length. - */ -export function getFloatLength(floatLength: number): number; -/** - * Given the count of vectors and their vector length, this function computes - * a total length in bytes with buffer alignment according to STD140 layout. - * - * @function - * @param {number} count - The number of vectors. - * @param {number} [vectorLength=4] - The vector length. - * @return {number} The padded length. - */ -export function getVectorLength(count: number, vectorLength?: number): number; -/** - * This function is called with a vector length and ensure the computed length - * matches a predefined stride (in this case `4`). - * - * @function - * @param {number} vectorLength - The vector length. - * @return {number} The padded length. - */ -export function getStrideLength(vectorLength: number): number; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts deleted file mode 100644 index b4f4b22f1..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/BundleGroup.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export default BundleGroup; -/** - * A specialized group which enables applications access to the - * Render Bundle API of WebGPU. The group with all its descendant nodes - * are considered as one render bundle and processed as such by - * the renderer. - * - * Only renderable 3D objects are allowed in a bundle group. Other - * types like lights are not supported and must be added to the scene - * outside of the group. - * - * This module is only fully supported by `WebGPURenderer` with a WebGPU backend. - * With a WebGL backend, the group can technically be rendered but without - * any performance improvements. - * - * @augments Group - */ -declare class BundleGroup extends Group { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isBundleGroup: boolean; - /** - * The bundle group's version. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly version: number; - /** - * Set this property to `true` when the bundle group has changed. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); -} -import { Group } from '../../objects/Group.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts deleted file mode 100644 index 9932067a0..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/CanvasTarget.d.ts +++ /dev/null @@ -1,189 +0,0 @@ -export default CanvasTarget; -/** - * CanvasTarget is a class that represents the final output destination of the renderer. - * - * @augments EventDispatcher - */ -declare class CanvasTarget extends EventDispatcher { - /** - * Constructs a new CanvasTarget. - * - * @param {HTMLCanvasElement|OffscreenCanvas} domElement - The canvas element to render to. - */ - constructor(domElement: HTMLCanvasElement | OffscreenCanvas); - /** - * A reference to the canvas element the renderer is drawing to. - * This value of this property will automatically be created by - * the renderer. - * - * @type {HTMLCanvasElement|OffscreenCanvas} - */ - domElement: HTMLCanvasElement | OffscreenCanvas; - /** - * The renderer's pixel ratio. - * - * @private - * @type {number} - * @default 1 - */ - private _pixelRatio; - /** - * The width of the renderer's default framebuffer in logical pixel unit. - * - * @private - * @type {number} - */ - private _width; - /** - * The height of the renderer's default framebuffer in logical pixel unit. - * - * @private - * @type {number} - */ - private _height; - /** - * The viewport of the renderer in logical pixel unit. - * - * @private - * @type {Vector4} - */ - private _viewport; - /** - * The scissor rectangle of the renderer in logical pixel unit. - * - * @private - * @type {Vector4} - */ - private _scissor; - /** - * Whether the scissor test should be enabled or not. - * - * @private - * @type {boolean} - */ - private _scissorTest; - /** - * The color texture of the default framebuffer. - * - * @type {FramebufferTexture} - */ - colorTexture: FramebufferTexture; - /** - * The depth texture of the default framebuffer. - * - * @type {DepthTexture} - */ - depthTexture: DepthTexture; - /** - * Returns the pixel ratio. - * - * @return {number} The pixel ratio. - */ - getPixelRatio(): number; - /** - * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize(target: Vector2): Vector2; - /** - * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The renderer's size in logical pixels. - */ - getSize(target: Vector2): Vector2; - /** - * Sets the given pixel ratio and resizes the canvas if necessary. - * - * @param {number} [value=1] - The pixel ratio. - */ - setPixelRatio(value?: number): void; - /** - * This method allows to define the drawing buffer size by specifying - * width, height and pixel ratio all at once. The size of the drawing - * buffer is computed with this formula: - * ```js - * size.x = width * pixelRatio; - * size.y = height * pixelRatio; - * ``` - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {number} pixelRatio - The pixel ratio. - */ - setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; - /** - * Sets the size of the renderer. - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. - */ - setSize(width: number, height: number, updateStyle?: boolean): void; - /** - * Returns the scissor rectangle. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The scissor rectangle. - */ - getScissor(target: Vector4): Vector4; - /** - * Defines the scissor rectangle. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the box in logical pixel unit. - * Instead of passing four arguments, the method also works with a single four-dimensional vector. - * @param {number} y - The vertical coordinate for the lower left corner of the box in logical pixel unit. - * @param {number} width - The width of the scissor box in logical pixel unit. - * @param {number} height - The height of the scissor box in logical pixel unit. - */ - setScissor(x: number | Vector4, y: number, width: number, height: number): void; - /** - * Returns the scissor test value. - * - * @return {boolean} Whether the scissor test should be enabled or not. - */ - getScissorTest(): boolean; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Returns the viewport definition. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The viewport definition. - */ - getViewport(target: Vector4): Vector4; - /** - * Defines the viewport. - * - * @param {number | Vector4} x - The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} y - The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. - * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. - */ - setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; - /** - * Dispatches the resize event. - * - * @private - */ - private _dispatchResize; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * @fires RenderTarget#dispose - */ - dispose(): void; -} -import { EventDispatcher } from '../../core/EventDispatcher.js'; -import { FramebufferTexture } from '../../textures/FramebufferTexture.js'; -import { DepthTexture } from '../../textures/DepthTexture.js'; -import { Vector4 } from '../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts deleted file mode 100644 index 97e504734..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/ChainMap.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -export default ChainMap; -/** - * Data structure for the renderer. It allows defining values - * with chained, hierarchical keys. Keys are meant to be - * objects since the module internally works with Weak Maps - * for performance reasons. - * - * @private - */ -declare class ChainMap { - /** - * A map of Weak Maps by their key length. - * - * @type {Object} - */ - weakMaps: { - [x: number]: WeakMap; - }; - /** - * Returns the Weak Map for the given keys. - * - * @param {Array} keys - List of keys. - * @return {WeakMap} The weak map. - */ - _getWeakMap(keys: Array): WeakMap; - /** - * Returns the value for the given array of keys. - * - * @param {Array} keys - List of keys. - * @return {any} The value. Returns `undefined` if no value was found. - */ - get(keys: Array): any; - /** - * Sets the value for the given keys. - * - * @param {Array} keys - List of keys. - * @param {any} value - The value to set. - * @return {ChainMap} A reference to this Chain Map. - */ - set(keys: Array, value: any): ChainMap; - /** - * Deletes a value for the given keys. - * - * @param {Array} keys - The keys. - * @return {boolean} Returns `true` if the value has been removed successfully and `false` if the value has not be found. - */ - delete(keys: Array): boolean; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts deleted file mode 100644 index 0bc37ff1c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/ClippingContext.d.ts +++ /dev/null @@ -1,129 +0,0 @@ -export default ClippingContext; -/** - * Represents the state that is used to perform clipping via clipping planes. - * There is a default clipping context for each render context. When the - * scene holds instances of `ClippingGroup`, there will be a context for each - * group. - * - * @private - */ -declare class ClippingContext { - /** - * Constructs a new clipping context. - * - * @param {?ClippingContext} [parentContext=null] - A reference to the parent clipping context. - */ - constructor(parentContext?: ClippingContext | null); - /** - * The id of the clipping context. - * - * @type {number} - * @readonly - */ - readonly id: number; - /** - * The clipping context's version. - * - * @type {number} - * @readonly - */ - readonly version: number; - /** - * Whether the intersection of the clipping planes is used to clip objects, rather than their union. - * - * @type {?boolean} - * @default null - */ - clipIntersection: boolean | null; - /** - * The clipping context's cache key. - * - * @type {string} - */ - cacheKey: string; - /** - * Whether the shadow pass is active or not. - * - * @type {boolean} - * @default false - */ - shadowPass: boolean; - /** - * The view matrix. - * - * @type {Matrix4} - */ - viewMatrix: Matrix4; - /** - * The view normal matrix. - * - * @type {Matrix3} - */ - viewNormalMatrix: Matrix3; - /** - * Internal cache for maintaining clipping contexts. - * - * @type {WeakMap} - */ - clippingGroupContexts: WeakMap; - /** - * The intersection planes. - * - * @type {Array} - */ - intersectionPlanes: Array; - /** - * The intersection planes. - * - * @type {Array} - */ - unionPlanes: Array; - /** - * The version of the clipping context's parent context. - * - * @type {?number} - * @readonly - */ - readonly parentVersion: number | null; - /** - * Projects the given source clipping planes and writes the result into the - * destination array. - * - * @param {Array} source - The source clipping planes. - * @param {Array} destination - The destination. - * @param {number} offset - The offset. - */ - projectPlanes(source: Array, destination: Array, offset: number): void; - /** - * Updates the root clipping context of a scene. - * - * @param {Scene} scene - The scene. - * @param {Camera} camera - The camera that is used to render the scene. - */ - updateGlobal(scene: Scene, camera: Camera): void; - /** - * Updates the clipping context. - * - * @param {ClippingContext} parentContext - The parent context. - * @param {ClippingGroup} clippingGroup - The clipping group this context belongs to. - */ - update(parentContext: ClippingContext, clippingGroup: ClippingGroup): void; - /** - * Returns a clipping context for the given clipping group. - * - * @param {ClippingGroup} clippingGroup - The clipping group. - * @return {ClippingContext} The clipping context. - */ - getGroupContext(clippingGroup: ClippingGroup): ClippingContext; - /** - * The count of union clipping planes. - * - * @type {number} - * @readonly - */ - readonly get unionClippingCount(): number; -} -import { Matrix4 } from '../../math/Matrix4.js'; -import { Matrix3 } from '../../math/Matrix3.js'; -import { Vector4 } from '../../math/Vector4.js'; -import { Plane } from '../../math/Plane.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts deleted file mode 100644 index 6f01003df..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Color4.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -export default Color4; -/** - * A four-component version of {@link Color} which is internally - * used by the renderer to represents clear color with alpha as - * one object. - * - * @private - * @augments Color - */ -declare class Color4 extends Color { - /** - * Constructs a new four-component color. - * You can also pass a single THREE.Color, hex or - * string argument to this constructor. - * - * @param {number|string} [r=1] - The red value. - * @param {number} [g=1] - The green value. - * @param {number} [b=1] - The blue value. - * @param {number} [a=1] - The alpha value. - */ - constructor(r?: number | string, g?: number, b?: number, a?: number); - a: number; - /** - * Overwrites the default to honor alpha. - * You can also pass a single THREE.Color, hex or - * string argument to this method. - * - * @param {number|string|Color} r - The red value. - * @param {number} [g] - The green value. - * @param {number} [b] - The blue value. - * @param {number} [a=1] - The alpha value. - * @return {Color4} A reference to this object. - */ - set(r: number | string | Color, g?: number, b?: number, a?: number): Color4; - /** - * Overwrites the default to honor alpha. - * - * @param {Color4} color - The color to copy. - * @return {Color4} A reference to this object. - */ - copy(color: Color4): Color4; - /** - * Overwrites the default to honor alpha. - * - * @return {Color4} The cloned color. - */ - clone(): Color4; -} -import { Color } from '../../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts deleted file mode 100644 index c8740c38d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/ComputePipeline.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default ComputePipeline; -/** - * Class for representing compute pipelines. - * - * @private - * @augments Pipeline - */ -declare class ComputePipeline extends Pipeline { - /** - * Constructs a new compute pipeline. - * - * @param {string} cacheKey - The pipeline's cache key. - * @param {ProgrammableStage} computeProgram - The pipeline's compute shader. - */ - constructor(cacheKey: string, computeProgram: ProgrammableStage); - /** - * The pipeline's compute shader. - * - * @type {ProgrammableStage} - */ - computeProgram: ProgrammableStage; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isComputePipeline: boolean; -} -import Pipeline from './Pipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts deleted file mode 100644 index 0561bfadb..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Constants.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export namespace AttributeType { - let VERTEX: number; - let INDEX: number; - let STORAGE: number; - let INDIRECT: number; -} -export const GPU_CHUNK_BYTES: 16; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts deleted file mode 100644 index e6cad71cf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/CubeRenderTarget.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export default CubeRenderTarget; -/** - * This class represents a cube render target. It is a special version - * of `WebGLCubeRenderTarget` which is compatible with `WebGPURenderer`. - * - * @augments RenderTarget - */ -declare class CubeRenderTarget extends RenderTarget { - /** - * Constructs a new cube render target. - * - * @param {number} [size=1] - The size of the render target. - * @param {RenderTarget~Options} [options] - The configuration object. - */ - constructor(size?: number, options?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeRenderTarget: boolean; - /** - * Converts the given equirectangular texture to a cube map. - * - * @param {Renderer} renderer - The renderer. - * @param {Texture} texture - The equirectangular texture. - * @return {CubeRenderTarget} A reference to this cube render target. - */ - fromEquirectangularTexture(renderer: Renderer, texture: Texture): CubeRenderTarget; - /** - * Clears this cube render target. - * - * @param {Renderer} renderer - The renderer. - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear(renderer: Renderer, color?: boolean, depth?: boolean, stencil?: boolean): void; -} -import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts deleted file mode 100644 index 5b407575a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/DataMap.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export default DataMap; -/** - * Data structure for the renderer. It is intended to manage - * data of objects in dictionaries. - * - * @private - */ -declare class DataMap { - /** - * `DataMap` internally uses a weak map - * to manage its data. - * - * @type {WeakMap} - */ - data: WeakMap; - /** - * Returns the dictionary for the given object. - * - * @param {Object} object - The object. - * @return {Object} The dictionary. - */ - get(object: Object): Object; - /** - * Deletes the dictionary for the given object. - * - * @param {Object} object - The object. - * @return {?Object} The deleted dictionary. - */ - delete(object: Object): Object | null; - /** - * Returns `true` if the given object has a dictionary defined. - * - * @param {Object} object - The object to test. - * @return {boolean} Whether a dictionary is defined or not. - */ - has(object: Object): boolean; - /** - * Frees internal resources. - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts deleted file mode 100644 index edb6ba183..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/DirectRenderPipeline.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -export default DirectRenderPipeline; -/** - * An alternative render pipeline that applies output processing directly in - * material shaders. This avoids the intermediate framebuffer and output pass - * used by {@link Renderer}, but changes blending and is not compatible with - * materials that sample the framebuffer, such as transmissive materials. - * - * ```js - * const renderPipeline = new DirectRenderPipeline( renderer ); - * renderPipeline.render( scene, camera ); - * ``` - * - * Note: This module can only be used with `WebGPURenderer`. - * - * @augments RenderPipeline - */ -declare class DirectRenderPipeline extends RenderPipeline { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isDirectRenderPipeline: boolean; - /** - * The context node used to apply output processing in material shaders. - * - * @private - * @type {?ContextNode} - * @default null - */ - private _contextNode; - /** - * The renderer context node wrapped by this pipeline. - * - * @private - * @type {?ContextNode} - * @default null - */ - private _rendererContextNode; - /** - * Cached node representations of solid scene backgrounds. - * - * @private - * @type {WeakMap} - */ - private _backgroundNodes; - /** - * Renders the scene with output processing applied directly in material shaders. - * - * @param {Object3D} scene - The scene or object to render. - * @param {Camera} camera - The camera. - */ - render(scene: Object3D, camera: Camera): void; - /** - * Returns a node representation of a solid scene background so it receives - * the same inline output processing as material fragments. - * - * @private - * @param {Object3D} scene - The scene or object to render. - * @return {?UniformNode} The background node. - */ - private _getBackgroundNode; -} -import RenderPipeline from './RenderPipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts deleted file mode 100644 index a1cd970c9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Geometries.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -export default Geometries; -/** - * This renderer module manages geometries. - * - * @private - * @augments DataMap - */ -declare class Geometries extends DataMap { - /** - * Constructs a new geometry management component. - * - * @param {Attributes} attributes - Renderer component for managing attributes. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(attributes: Attributes, info: Info); - /** - * Renderer component for managing attributes. - * - * @type {Attributes} - */ - attributes: Attributes; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * Weak Map for managing attributes for wireframe rendering. - * - * @type {WeakMap} - */ - wireframes: WeakMap; - /** - * This Weak Map is used to make sure buffer attributes are - * updated only once per render call. - * - * @type {WeakMap} - */ - attributeCall: WeakMap; - /** - * Stores the event listeners attached to geometries. - * - * @private - * @type {Map} - */ - private _geometryDisposeListeners; - /** - * Returns `true` if the given render object has an initialized geometry. - * - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether if the given render object has an initialized geometry or not. - */ - has(renderObject: RenderObject): boolean; - /** - * Prepares the geometry of the given render object for rendering. - * - * @param {RenderObject} renderObject - The render object. - */ - updateForRender(renderObject: RenderObject): void; - /** - * Initializes the geometry of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - initGeometry(renderObject: RenderObject): void; - /** - * Updates the geometry attributes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateAttributes(renderObject: RenderObject): void; - /** - * Updates the given attribute. - * - * @param {BufferAttribute} attribute - The attribute to update. - * @param {number} type - The attribute type. - */ - updateAttribute(attribute: BufferAttribute, type: number): void; - /** - * Returns the indirect buffer attribute of the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. - */ - getIndirect(renderObject: RenderObject): BufferAttribute | null; - /** - * Returns the byte offset into the indirect attribute buffer of the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {number} The byte offset into the indirect attribute buffer. - */ - getIndirectOffset(renderObject: RenderObject): number; - /** - * Returns the index of the given render object's geometry. This is implemented - * in a method to return a wireframe index if necessary. - * - * @param {RenderObject} renderObject - The render object. - * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. - */ - getIndex(renderObject: RenderObject): BufferAttribute | null; -} -import DataMap from './DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts deleted file mode 100644 index 9084444e7..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/IndirectStorageBufferAttribute.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export default IndirectStorageBufferAttribute; -/** - * This special type of buffer attribute is intended for compute shaders. - * It can be used to encode draw parameters for indirect draw calls. - * - * Note: This type of buffer attribute can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments StorageBufferAttribute - */ -declare class IndirectStorageBufferAttribute extends StorageBufferAttribute { - /** - * Constructs a new storage buffer attribute. - * - * @param {number|Uint32Array} count - The item count. It is also valid to pass a `Uint32Array` as an argument. - * The subsequent parameter is then obsolete. - * @param {number} itemSize - The item size. - */ - constructor(count: number | Uint32Array, itemSize: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isIndirectStorageBufferAttribute: boolean; -} -import StorageBufferAttribute from './StorageBufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts deleted file mode 100644 index 8155740ab..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Info.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -export default Info; -/** - * This renderer module provides a series of statistical information - * about the GPU memory and the rendering process. Useful for debugging - * and monitoring. - */ -declare class Info { - /** - * Whether frame related metrics should automatically - * be resetted or not. This property should be set to `false` - * by apps which manage their own animation loop. They must - * then call `renderer.info.reset()` once per frame manually. - * - * @type {boolean} - * @default true - */ - autoReset: boolean; - /** - * The current frame ID. This ID is managed - * by `NodeFrame`. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly frame: number; - /** - * The number of render calls since the - * app has been started. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly calls: number; - /** - * Render related metrics. - * - * @type {Object} - * @readonly - * @property {number} calls - The number of render calls since the app has been started. - * @property {number} frameCalls - The number of render calls of the current frame. - * @property {number} drawCalls - The number of draw calls of the current frame. - * @property {number} triangles - The number of rendered triangle primitives of the current frame. - * @property {number} points - The number of rendered point primitives of the current frame. - * @property {number} lines - The number of rendered line primitives of the current frame. - * @property {number} timestamp - The timestamp of the frame. - */ - readonly render: Object; - /** - * Compute related metrics. - * - * @type {Object} - * @readonly - * @property {number} calls - The number of compute calls since the app has been started. - * @property {number} frameCalls - The number of compute calls of the current frame. - * @property {number} timestamp - The timestamp of the frame when using `renderer.computeAsync()`. - */ - readonly compute: Object; - /** - * Memory related metrics. - * - * @type {Object} - * @readonly - * @property {number} attributes - The number of active attributes. - * @property {number} attributesSize - The memory size of active attributes in bytes. - * @property {number} geometries - The number of active geometries. - * @property {number} indexAttributes - The number of active index attributes. - * @property {number} indexAttributesSize - The memory size of active index attributes in bytes. - * @property {number} indirectStorageAttributes - The number of active indirect storage attributes. - * @property {number} indirectStorageAttributesSize - The memory size of active indirect storage attributes in bytes. - * @property {number} programs - The number of active programs. - * @property {number} programsSize - The memory size of active programs in bytes. - * @property {number} readbackBuffers - The number of active readback buffers. - * @property {number} readbackBuffersSize - The memory size of active readback buffers in bytes. - * @property {number} renderTargets - The number of active renderTargets. - * @property {number} storageAttributes - The number of active storage attributes. - * @property {number} storageAttributesSize - The memory size of active storage attributes in bytes. - * @property {number} textures - The number of active textures. - * @property {number} texturesSize - The memory size of active textures in bytes. - * @property {number} uniformBuffers - The number of active uniform buffers. - * @property {number} uniformBuffersSize - The memory size of active uniform buffers in bytes. - * @property {number} total - The total memory size in bytes. - */ - readonly memory: Object; - /** - * Map for storing calculated byte sizes of tracked objects. - * - * @type {WeakMap} - * @private - */ - private memoryMap; - /** - * This method should be executed per draw call and updates the corresponding metrics. - * - * @param {Object3D} object - The 3D object that is going to be rendered. - * @param {number} count - The vertex or index count. - * @param {number} instanceCount - The instance count. - */ - update(object: Object3D, count: number, instanceCount: number): void; - /** - * Resets frame related metrics. - */ - reset(): void; - /** - * Performs a complete reset of the object. - */ - dispose(): void; - /** - * Tracks texture memory explicitly, updating counts and byte tracking. - * - * @param {Texture} texture - */ - createTexture(texture: Texture): void; - /** - * Tracks texture memory explicitly, updating counts and byte tracking. - * - * @param {Texture} texture - */ - destroyTexture(texture: Texture): void; - /** - * Tracks attribute memory explicitly, updating counts and byte tracking. - * - * @param {BufferAttribute} attribute - * @param {string} type - type of attribute - * @private - */ - private _createAttribute; - /** - * Tracks a regular attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The attribute to track. - */ - createAttribute(attribute: BufferAttribute): void; - /** - * Tracks an index attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The index attribute to track. - */ - createIndexAttribute(attribute: BufferAttribute): void; - /** - * Tracks a storage attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The storage attribute to track. - */ - createStorageAttribute(attribute: BufferAttribute): void; - /** - * Tracks an indirect storage attribute memory explicitly. - * - * @param {BufferAttribute} attribute - The indirect storage attribute to track. - */ - createIndirectStorageAttribute(attribute: BufferAttribute): void; - /** - * Tracks attribute memory explicitly, updating counts and byte tracking. - * - * @param {BufferAttribute} attribute - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * Tracks a readback buffer memory explicitly. - * - * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. - */ - createReadbackBuffer(readbackBuffer: ReadbackBuffer): void; - /** - * Tracks a readback buffer memory explicitly. - * - * @param {ReadbackBuffer} readbackBuffer - The readback buffer to track. - */ - destroyReadbackBuffer(readbackBuffer: ReadbackBuffer): void; - /** - * Tracks a uniform buffer memory explicitly. - * - * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. - */ - createUniformBuffer(uniformBuffer: UniformBuffer): void; - /** - * Tracks a uniform buffer memory explicitly. - * - * @param {UniformBuffer} uniformBuffer - The uniform buffer to track. - */ - destroyUniformBuffer(uniformBuffer: UniformBuffer): void; - /** - * Tracks program memory explicitly, updating counts and byte tracking. - * - * @param {ProgrammableStage} program - The program to track. - */ - createProgram(program: ProgrammableStage): void; - /** - * Tracks program memory explicitly, updating counts and byte tracking. - * - * @param {Object} program - The program to track. - */ - destroyProgram(program: Object): void; - /** - * Calculates the memory size of a texture in bytes. - * - * @param {Texture} texture - The texture to calculate the size for. - * @return {number} The calculated size in bytes. - * @private - */ - private _getTextureMemorySize; - /** - * Calculates the memory size of an attribute in bytes. - * - * @param {BufferAttribute} attribute - The attribute to calculate the size for. - * @return {number} The calculated size in bytes. - * @private - */ - private _getAttributeMemorySize; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts deleted file mode 100644 index c35ecfabf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/InspectorBase.d.ts +++ /dev/null @@ -1,122 +0,0 @@ -export default InspectorBase; -/** - * InspectorBase is the base class for all inspectors. - * - * @augments EventDispatcher - */ -declare class InspectorBase extends EventDispatcher { - /** - * The renderer associated with this inspector. - * - * @type {WebGLRenderer} - * @private - */ - private _renderer; - /** - * The current frame being processed. - * - * @type {Object} - */ - currentFrame: Object; - /** - * Indicates whether the inspector is running. - * - * @type {boolean} - * @default false - */ - isRunning: boolean; - /** - * Indicates whether the inspector is enabled. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * Returns the node frame for the current renderer. - * - * @return {Object} The node frame. - */ - get nodeFrame(): Object; - /** - * Sets the renderer for this inspector. - * - * @param {WebGLRenderer} renderer - The renderer to associate with this inspector. - * @return {InspectorBase} This inspector instance. - */ - setRenderer(renderer: WebGLRenderer): InspectorBase; - /** - * Returns the renderer associated with this inspector. - * - * @return {WebGLRenderer} The associated renderer. - */ - getRenderer(): WebGLRenderer; - /** - * Initializes the inspector. - */ - init(): void; - /** - * Called when a frame begins. - */ - begin(): void; - /** - * Called when a frame ends. - */ - finish(): void; - /** - * Inspects a node. - * - * @param {Node} node - The node to inspect. - */ - inspect(): void; - /** - * When a compute operation is performed. - * - * @param {ComputeNode} computeNode - The compute node being executed. - * @param {number|Array} dispatchSizeOrCount - The dispatch size or count. - */ - computeAsync(): void; - /** - * Called when a compute operation begins. - * - * @param {string} uid - A unique identifier for the render context. - * @param {ComputeNode} computeNode - The compute node being executed. - */ - beginCompute(): void; - /** - * Called when a compute operation ends. - * - * @param {string} uid - A unique identifier for the render context. - * @param {ComputeNode} computeNode - The compute node being executed. - */ - finishCompute(): void; - /** - * Called when a render operation begins. - * - * @param {string} uid - A unique identifier for the render context. - * @param {Scene} scene - The scene being rendered. - * @param {Camera} camera - The camera being used for rendering. - * @param {?WebGLRenderTarget} renderTarget - The render target, if any. - */ - beginRender(): void; - /** - * Called when an animation loop ends. - * - * @param {string} uid - A unique identifier for the render context. - */ - finishRender(): void; - /** - * Called when a texture copy operation is performed. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - */ - copyTextureToTexture(): void; - /** - * Called when a framebuffer copy operation is performed. - * - * @param {Texture} framebufferTexture - The texture associated with the framebuffer. - */ - copyFramebufferToTexture(): void; -} -import { EventDispatcher } from '../../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts deleted file mode 100644 index ae4011fdf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Lighting.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -export default Lighting; -/** - * This renderer module manages the lights nodes which are unique - * per scene + camera + lighting combination. - * - * The lights node itself is later configured in the render list - * with the actual lights from the scene. - * - * @private - */ -declare class Lighting { - /** - * Whether this lighting manager is enabled or not. - * - * @type {boolean} - * @default true - */ - enabled: boolean; - /** - * A stack of light arrays saved per render via {@link Lighting#beginRender}. - * - * @private - * @type {Array>} - */ - private _cache; - /** - * A map of lights nodes per scene. - * - * @private - * @type {WeakMap} - */ - private _lightsNodeMap; - /** - * Creates a new lights node for the given array of lights. - * - * @param {Array} lights - The render object. - * @return {LightsNode} The lights node. - */ - createNode(lights?: Array): LightsNode; - /** - * Returns a lights node for the given scene. - * - * @param {Scene} scene - The scene. - * @return {LightsNode} The lights node. - */ - getNode(scene: Scene): LightsNode; - /** - * Saves the current lights of the scene's lights node so they can be restored - * in {@link Lighting#finishRender}. Must be paired with a `finishRender()` call - * to avoid memory leaks. - * - * Nested render calls might mutate the lights array so a save/restore is required - * for each render call. - * - * @param {Scene} scene - The scene. - */ - beginRender(scene: Scene): void; - /** - * Restores the lights saved by the matching {@link Lighting#beginRender} call. - * - * @param {Scene} scene - The scene. - */ - finishRender(scene: Scene): void; -} -import { LightsNode } from '../../nodes/Nodes.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts deleted file mode 100644 index db30b30a6..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Pipeline.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -export default Pipeline; -/** - * Abstract class for representing pipelines. - * - * @private - * @abstract - */ -declare class Pipeline { - /** - * Constructs a new pipeline. - * - * @param {string} cacheKey - The pipeline's cache key. - */ - constructor(cacheKey: string); - /** - * The pipeline's cache key. - * - * @type {string} - */ - cacheKey: string; - /** - * How often the pipeline is currently in use. - * - * @type {number} - * @default 0 - */ - usedTimes: number; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts deleted file mode 100644 index f314e54f4..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Pipelines.d.ts +++ /dev/null @@ -1,176 +0,0 @@ -export default Pipelines; -/** - * This renderer module manages the pipelines of the renderer. - * - * @private - * @augments DataMap - */ -declare class Pipelines extends DataMap { - /** - * Constructs a new pipeline management component. - * - * @param {Backend} backend - The renderer's backend. - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(backend: Backend, nodes: NodeManager, info: Info); - /** - * The renderer's backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * Renderer component for managing nodes related logic. - * - * @type {NodeManager} - */ - nodes: NodeManager; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * A references to the bindings management component. - * This reference will be set inside the `Bindings` - * constructor. - * - * @type {?Bindings} - * @default null - */ - bindings: Bindings | null; - /** - * Internal cache for maintaining pipelines. - * The key of the map is a cache key, the value the pipeline. - * - * @type {Map} - */ - caches: Map; - /** - * This dictionary maintains for each shader stage type (vertex, - * fragment and compute) the programmable stage objects which - * represent the actual shader code. - * - * @type {Object>} - */ - programs: { - [x: string]: Map; - }; - /** - * Returns a compute pipeline for the given compute node. - * - * @param {Node} computeNode - The compute node. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - An array of compilation promises which is only relevant in context of `Renderer.compileComputeAsync()`. - * @return {ComputePipeline} The compute pipeline. - */ - getForCompute(computeNode: Node, bindings: Array, promises?: Array> | null): ComputePipeline; - /** - * Returns a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {?Array} [promises=null] - An array of compilation promises which is only relevant in context of `Renderer.compileAsync()`. - * @return {RenderObjectPipeline} The render pipeline. - */ - getForRender(renderObject: RenderObject, promises?: Array> | null): RenderObjectPipeline; - /** - * Checks if the render pipeline for the given render object is ready for drawing. - * Returns false if the GPU pipeline is still being compiled asynchronously. - * - * @param {RenderObject} renderObject - The render object. - * @return {boolean} True if the pipeline is ready for drawing. - */ - isReady(renderObject: RenderObject): boolean; - /** - * Deletes the pipeline for the given render object. - * - * @param {RenderObject} object - The render object. - * @return {?Object} The deleted dictionary. - */ - delete(object: RenderObject): Object | null; - /** - * Updates the pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateForRender(renderObject: RenderObject): void; - /** - * Returns a compute pipeline for the given parameters. - * - * @private - * @param {Node} computeNode - The compute node. - * @param {ProgrammableStage} stageCompute - The programmable stage representing the compute shader. - * @param {string} cacheKey - The cache key. - * @param {Array} bindings - The bindings. - * @param {?Array} promises - An array of compilation promises which is only relevant in context of `Renderer.compileComputeAsync()`. - * @return {ComputePipeline} The compute pipeline. - */ - private _getComputePipeline; - /** - * Returns a render pipeline for the given parameters. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {ProgrammableStage} stageVertex - The programmable stage representing the vertex shader. - * @param {ProgrammableStage} stageFragment - The programmable stage representing the fragment shader. - * @param {string} cacheKey - The cache key. - * @param {?Array} promises - An array of compilation promises which is only relevant in context of `Renderer.compileAsync()`. - * @return {RenderObjectPipeline} The render pipeline. - */ - private _getRenderPipeline; - /** - * Computes a cache key representing a compute pipeline. - * - * @private - * @param {Node} computeNode - The compute node. - * @param {ProgrammableStage} stageCompute - The programmable stage representing the compute shader. - * @return {string} The cache key. - */ - private _getComputeCacheKey; - /** - * Computes a cache key representing a render pipeline. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {ProgrammableStage} stageVertex - The programmable stage representing the vertex shader. - * @param {ProgrammableStage} stageFragment - The programmable stage representing the fragment shader. - * @return {string} The cache key. - */ - private _getRenderCacheKey; - /** - * Releases the given pipeline. - * - * @private - * @param {Pipeline} pipeline - The pipeline to release. - */ - private _releasePipeline; - /** - * Releases the shader program. - * - * @private - * @param {Object} program - The shader program to release. - */ - private _releaseProgram; - /** - * Returns `true` if the compute pipeline for the given compute node requires an update. - * - * @private - * @param {Node} computeNode - The compute node. - * @return {boolean} Whether the compute pipeline for the given compute node requires an update or not. - */ - private _needsComputeUpdate; - /** - * Returns `true` if the render pipeline for the given render object requires an update. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the render object for the given render object requires an update or not. - */ - private _needsRenderUpdate; -} -import DataMap from './DataMap.js'; -import ProgrammableStage from './ProgrammableStage.js'; -import ComputePipeline from './ComputePipeline.js'; -import RenderObjectPipeline from './RenderObjectPipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts deleted file mode 100644 index 7bf242f58..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/PostProcessing.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export default PostProcessing; -/** - * @deprecated since r183. Use {@link RenderPipeline} instead. PostProcessing has been renamed to RenderPipeline. - * - * This class is a wrapper for backward compatibility and will be removed in a future version. - */ -declare class PostProcessing extends RenderPipeline { - /** - * Constructs a new post processing management module. - * - * @param {Renderer} renderer - A reference to the renderer. - * @param {Node} outputNode - An optional output node. - * @deprecated since r183. Use {@link RenderPipeline} instead. - */ - constructor(renderer: Renderer, outputNode: Node); -} -import RenderPipeline from './RenderPipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts deleted file mode 100644 index 5fdbd4d68..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/ProgrammableStage.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export default ProgrammableStage; -/** - * Class for representing programmable stages which are vertex, - * fragment or compute shaders. Unlike fixed-function states (like blending), - * they represent the programmable part of a pipeline. - * - * @private - */ -declare class ProgrammableStage { - /** - * Constructs a new programmable stage. - * - * @param {string} code - The shader code. - * @param {('vertex'|'fragment'|'compute')} stage - The type of stage. - * @param {string} name - The name of the shader. - * @param {?Array} [transforms=null] - The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - * @param {?Array} [attributes=null] - The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - */ - constructor(code: string, stage: ("vertex" | "fragment" | "compute"), name: string, transforms?: Array | null, attributes?: Array | null); - /** - * The id of the programmable stage. - * - * @type {number} - */ - id: number; - /** - * The shader code. - * - * @type {string} - */ - code: string; - /** - * The type of stage. - * - * @type {string} - */ - stage: string; - /** - * The name of the stage. - * This is used for debugging purposes. - * - * @type {string} - */ - name: string; - /** - * The transforms (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - * - * @type {?Array} - */ - transforms: Array | null; - /** - * The attributes (only relevant for compute stages with WebGL 2 which uses Transform Feedback). - * - * @type {?Array} - */ - attributes: Array | null; - /** - * How often the programmable stage is currently in use. - * - * @type {number} - * @default 0 - */ - usedTimes: number; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts deleted file mode 100644 index 8bf6f8261..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/QuadMesh.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export default QuadMesh; -/** - * This module is a helper for passes which need to render a full - * screen effect which is quite common in context of post processing. - * - * The intended usage is to reuse a single quad mesh for rendering - * subsequent passes by just reassigning the `material` reference. - * - * Note: This module can only be used with `WebGPURenderer`. - * - * @augments Mesh - */ -declare class QuadMesh extends Mesh { - /** - * Constructs a new quad mesh. - * - * @param {NodeMaterial} material - The material to render the quad mesh with. - */ - constructor(material: NodeMaterial); - /** - * The camera to render the quad mesh with. - * - * @type {OrthographicCamera} - * @readonly - */ - readonly camera: OrthographicCamera; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isQuadMesh: boolean; - /** - * Async version of `render()`. - * - * @async - * @deprecated - * @param {Renderer} renderer - The renderer. - * @return {Promise} A Promise that resolves when the render has been finished. - */ - renderAsync(renderer: Renderer): Promise; - /** - * Renders the quad mesh - * - * @param {Renderer} renderer - The renderer. - */ - render(renderer: Renderer): void; -} -import { Mesh } from '../../objects/Mesh.js'; -import { OrthographicCamera } from '../../cameras/OrthographicCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts deleted file mode 100644 index 70218d55a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/ReadbackBuffer.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -export default ReadbackBuffer; -/** - * A readback buffer is used to transfer data from the GPU to the CPU. - * It is primarily used to read back compute shader results. - * - * @augments EventDispatcher - */ -declare class ReadbackBuffer extends EventDispatcher { - /** - * Constructs a new readback buffer. - * - * @param {number} maxByteLength - The maximum size of the buffer to be read back. - */ - constructor(maxByteLength: number); - /** - * Name used for debugging purposes. - * - * @type {string} - */ - name: string; - /** - * The mapped, read back array buffer. - * - * @type {ArrayBuffer|null} - */ - buffer: ArrayBuffer | null; - /** - * The maximum size of the buffer to be read back. - * - * @type {number} - */ - maxByteLength: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isReadbackBuffer: boolean; - _mapped: boolean; - /** - * Releases the mapped buffer data so the GPU buffer can be - * used by the GPU again. - * - * Note: Any `ArrayBuffer` data associated with this readback buffer - * are removed and no longer accessible after calling this method. - */ - release(): void; - /** - * Frees internal resources. - */ - dispose(): void; -} -import { EventDispatcher } from '../../core/EventDispatcher.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts deleted file mode 100644 index aca8cbee1..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderBundle.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export default RenderBundle; -/** - * This module is used to represent render bundles inside the renderer - * for further processing. - * - * @private - */ -declare class RenderBundle { - /** - * Constructs a new bundle group. - * - * @param {BundleGroup} bundleGroup - The bundle group. - * @param {Camera} camera - The camera the bundle group is rendered with. - * @param {RenderContext} renderContext - The render context the bundle is rendered with. - */ - constructor(bundleGroup: BundleGroup, camera: Camera, renderContext: RenderContext); - bundleGroup: BundleGroup; - camera: Camera; - renderContext: RenderContext; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts deleted file mode 100644 index ec46ba6ca..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderBundles.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export default RenderBundles; -/** - * This renderer module manages render bundles. - * - * @private - */ -declare class RenderBundles { - /** - * A chain map for maintaining the render bundles. - * - * @type {ChainMap} - */ - bundles: ChainMap; - /** - * Returns a render bundle for the given bundle group and camera. - * - * @param {BundleGroup} bundleGroup - The bundle group. - * @param {Camera} camera - The camera the bundle group is rendered with. - * @param {RenderContext} renderContext - The render context the bundle is rendered with. - * @return {RenderBundle} The render bundle. - */ - get(bundleGroup: BundleGroup, camera: Camera, renderContext: RenderContext): RenderBundle; - /** - * Frees all internal resources. - */ - dispose(): void; -} -import ChainMap from './ChainMap.js'; -import RenderBundle from './RenderBundle.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts deleted file mode 100644 index 514d3ddc3..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderContext.d.ts +++ /dev/null @@ -1,228 +0,0 @@ -/** - * Computes a cache key for the given render context. This key - * should identify the render target state so it is possible to - * configure the correct attachments in the respective backend. - * - * @param {RenderContext} renderContext - The render context. - * @return {number} The cache key. - */ -export function getCacheKey(renderContext: RenderContext): number; -export default RenderContext; -/** - * Any render or compute command is executed in a specific context that defines - * the state of the renderer and its backend. Typical examples for such context - * data are the current clear values or data from the active framebuffer. This - * module is used to represent these contexts as objects. - * - * @private - */ -declare class RenderContext { - /** - * The context's ID. - * - * @type {number} - */ - id: number; - /** - * The MRT configuration. - * - * @type {?MRTNode} - * @default null - */ - mrt: MRTNode | null; - /** - * Whether the current active framebuffer has a color attachment. - * - * @type {boolean} - * @default true - */ - color: boolean; - /** - * Whether the color attachment should be cleared or not. - * - * @type {boolean} - * @default true - */ - clearColor: boolean; - /** - * The clear color value. - * - * @type {Object} - * @default true - */ - clearColorValue: Object; - /** - * Whether the current active framebuffer has a depth attachment. - * - * @type {boolean} - * @default true - */ - depth: boolean; - /** - * Whether the depth attachment should be cleared or not. - * - * @type {boolean} - * @default true - */ - clearDepth: boolean; - /** - * The clear depth value. - * - * @type {number} - * @default 1 - */ - clearDepthValue: number; - /** - * Whether the current active framebuffer has a stencil attachment. - * - * @type {boolean} - * @default false - */ - stencil: boolean; - /** - * Whether the stencil attachment should be cleared or not. - * - * @type {boolean} - * @default true - */ - clearStencil: boolean; - /** - * The clear stencil value. - * - * @type {number} - * @default 1 - */ - clearStencilValue: number; - /** - * By default the viewport encloses the entire framebuffer If a smaller - * viewport is manually defined, this property is to `true` by the renderer. - * - * @type {boolean} - * @default false - */ - viewport: boolean; - /** - * The viewport value. This value is in physical pixels meaning it incorporates - * the renderer's pixel ratio. The viewport property of render targets or - * the renderer is in logical pixels. - * - * @type {Vector4} - */ - viewportValue: Vector4; - /** - * When the scissor test is active and scissor rectangle smaller than the - * framebuffers dimensions, this property is to `true` by the renderer. - * - * @type {boolean} - * @default false - */ - scissor: boolean; - /** - * The scissor rectangle. - * - * @type {Vector4} - */ - scissorValue: Vector4; - /** - * The active render target. - * - * @type {?RenderTarget} - * @default null - */ - renderTarget: RenderTarget | null; - /** - * The textures of the active render target. - * `null` when no render target is set. - * - * @type {?Array} - * @default null - */ - textures: Array | null; - /** - * The depth texture of the active render target. - * `null` when no render target is set. - * - * @type {?DepthTexture} - * @default null - */ - depthTexture: DepthTexture | null; - /** - * The active cube face. - * - * @type {number} - * @default 0 - */ - activeCubeFace: number; - /** - * The active mipmap level. - * - * @type {number} - * @default 0 - */ - activeMipmapLevel: number; - /** - * The number of MSAA samples. This value is always `1` when - * MSAA isn't used. - * - * @type {number} - * @default 1 - */ - sampleCount: number; - /** - * The active render target's width in physical pixels. - * - * @type {number} - * @default 0 - */ - width: number; - /** - * The active render target's height in physical pixels. - * - * @type {number} - * @default 0 - */ - height: number; - /** - * The occlusion query count. - * - * @type {number} - * @default 0 - */ - occlusionQueryCount: number; - /** - * The current clipping context. - * - * @type {?ClippingContext} - * @default null - */ - clippingContext: ClippingContext | null; - /** - * The current camera. - * - * @type {?Camera} - * @default null - */ - camera: Camera | null; - /** - * Whether a fullscreen pass is rendered or not. - * - * @type {boolean} - * @default false - */ - fullscreenPass: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderContext: boolean; - /** - * Returns the cache key of this render context. - * - * @return {number} The cache key. - */ - getCacheKey(): number; -} -import { Vector4 } from '../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts deleted file mode 100644 index ff6dfc870..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderContexts.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export default RenderContexts; -/** - * This module manages the render contexts of the renderer. - * - * @private - */ -declare class RenderContexts { - /** - * Constructs a new render context management component. - * - * @param {Renderer} renderer - The renderer. - */ - constructor(renderer: Renderer); - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * A dictionary that manages render contexts. - * - * @type {Object} - */ - _renderContexts: { - [x: string]: RenderContext; - }; - /** - * Returns a render context for the given scene, camera and render target. - * - * @param {?RenderTarget} [renderTarget=null] - The active render target. - * @param {?MRTNode} [mrt=null] - The MRT configuration - * @param {?number} [callDepth=0] - The call depth of the renderer. - * @return {RenderContext} The render context. - */ - get(renderTarget?: RenderTarget | null, mrt?: MRTNode | null, callDepth?: number | null): RenderContext; - /** - * Frees internal resources. - */ - dispose(): void; -} -import RenderContext from './RenderContext.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts deleted file mode 100644 index f341a76ea..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderList.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -export default RenderList; -/** - * When the renderer analyzes the scene at the beginning of a render call, - * it stores 3D object for further processing in render lists. Depending on the - * properties of a 3D objects (like their transformation or material state), the - * objects are maintained in ordered lists for the actual rendering. - * - * Render lists are unique per scene and camera combination. - * - * @private - * @augments Pipeline - */ -declare class RenderList { - /** - * Constructs a render list. - * - * @param {Lighting} lighting - The lighting management component. - * @param {Scene} scene - The scene. - * @param {Camera} camera - The camera the scene is rendered with. - */ - constructor(lighting: Lighting, scene: Scene, camera: Camera); - /** - * 3D objects are transformed into render items and stored in this array. - * - * @type {Array} - */ - renderItems: Array; - /** - * The current render items index. - * - * @type {number} - * @default 0 - */ - renderItemsIndex: number; - /** - * A list with opaque render items. - * - * @type {Array} - */ - opaque: Array; - /** - * A list with transparent render items which require - * double pass rendering (e.g. transmissive objects). - * - * @type {Array} - */ - transparentDoublePass: Array; - /** - * A list with transparent render items. - * - * @type {Array} - */ - transparent: Array; - /** - * A list with transparent render bundle data. - * - * @type {Array} - */ - bundles: Array; - /** - * The lighting management component. - * - * @type {Lighting} - */ - lighting: Lighting; - /** - * The render list's lights node. This node is later - * relevant for the actual analytical light nodes which - * compute the scene's lighting in the shader. - * - * @type {LightsNode} - */ - lightsNode: LightsNode; - /** - * The scene's lights stored in an array. This array - * is used to setup the lights node. - * - * @type {Array} - */ - lightsArray: Array; - /** - * The scene. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera the scene is rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * How many objects perform occlusion query tests. - * - * @type {number} - * @default 0 - */ - occlusionQueryCount: number; - /** - * The ID of the frame the render list was last used in. - * - * @type {number} - * @default -1 - */ - frameId: number; - /** - * The last object that was counted for occlusion query testing. Used to - * avoid counting an object more than once when it produces multiple render - * items (e.g. a mesh with multiple material groups), since such an object - * is covered by a single occlusion query. - * - * @private - * @type {?Object3D} - * @default null - */ - private _lastOcclusionObject; - /** - * This method is called right at the beginning of a render call - * before the scene is analyzed. It prepares the internal data - * structures for the upcoming render lists generation. - * - * @return {RenderList} A reference to this render list. - */ - begin(): RenderList; - /** - * Returns a render item for the giving render item state. The state is defined - * by a series of object-related parameters. - * - * The method avoids object creation by holding render items and reusing them in - * subsequent render calls (just with different property values). - * - * @param {Object3D} object - The 3D object. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Material} material - The 3D object's material. - * @param {number} groupOrder - The current group order. - * @param {number} z - Th 3D object's depth value (z value in clip space). - * @param {?number} group - {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {ClippingContext} clippingContext - The current clipping context. - * @return {Object} The render item. - */ - getNextRenderItem(object: Object3D, geometry: BufferGeometry, material: Material, groupOrder: number, z: number, group: number | null, clippingContext: ClippingContext): Object; - /** - * Pushes the given object as a render item to the internal render lists. - * The selected lists depend on the object properties. - * - * @param {Object3D} object - The 3D object. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Material} material - The 3D object's material. - * @param {number} groupOrder - The current group order. - * @param {number} z - Th 3D object's depth value (z value in clip space). - * @param {?number} group - {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {ClippingContext} clippingContext - The current clipping context. - */ - push(object: Object3D, geometry: BufferGeometry, material: Material, groupOrder: number, z: number, group: number | null, clippingContext: ClippingContext): void; - /** - * Inserts the given object as a render item at the start of the internal render lists. - * The selected lists depend on the object properties. - * - * @param {Object3D} object - The 3D object. - * @param {BufferGeometry} geometry - The 3D object's geometry. - * @param {Material} material - The 3D object's material. - * @param {number} groupOrder - The current group order. - * @param {number} z - Th 3D object's depth value (z value in clip space). - * @param {?number} group - {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {ClippingContext} clippingContext - The current clipping context. - */ - unshift(object: Object3D, geometry: BufferGeometry, material: Material, groupOrder: number, z: number, group: number | null, clippingContext: ClippingContext): void; - /** - * Pushes render bundle group data into the render list. - * - * @param {Object} group - Bundle group data. - */ - pushBundle(group: Object): void; - /** - * Pushes a light into the render list. - * - * @param {Light} light - The light. - */ - pushLight(light: Light): void; - /** - * Sorts the internal render lists. - * - * @param {?function(any, any): number} customOpaqueSort - A custom sort function for opaque objects. - * @param {?function(any, any): number} customTransparentSort - A custom sort function for transparent objects. - */ - sort(customOpaqueSort: ((arg0: any, arg1: any) => number) | null, customTransparentSort: ((arg0: any, arg1: any) => number) | null): void; - /** - * This method performs finalizing tasks right after the render lists - * have been generated. - */ - finish(): void; - /** - * This method is called when the render list has become inactive. - */ - clear(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts deleted file mode 100644 index 983aeccef..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderLists.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export default RenderLists; -/** - * This renderer module manages the render lists which are unique - * per scene and camera combination. - * - * @private - */ -declare class RenderLists { - /** - * The internal chain map which holds the render lists. - * - * @type {ChainMap} - */ - lists: ChainMap; - /** - * The render lists which are currently in use. Lists are removed - * as soon as they become stale. - * - * @private - * @type {Set} - */ - private _activeLists; - /** - * The current frame ID. - * - * @private - * @type {number} - */ - private _frameId; - /** - * Returns a render list for the given scene and camera. - * - * @param {Scene} scene - The scene. - * @param {Camera} camera - The camera. - * @param {Lighting} lighting - The lighting manager. - * @return {RenderList} The render list. - */ - get(scene: Scene, camera: Camera, lighting: Lighting): RenderList; - /** - * Must be called when a new frame begins. - * - * @param {number} frameId - The current frame ID. - */ - update(frameId: number): void; - /** - * Frees all internal resources. - */ - dispose(): void; -} -import ChainMap from './ChainMap.js'; -import RenderList from './RenderList.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts deleted file mode 100644 index 90f05d5b8..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderObject.d.ts +++ /dev/null @@ -1,425 +0,0 @@ -export default RenderObject; -/** - * A render object is the renderer's representation of single entity that gets drawn - * with a draw command. There is no unique mapping of render objects to 3D objects in the - * scene since render objects also depend from the used material, the current render context - * and the current scene's lighting. - * - * In general, the basic process of the renderer is: - * - * - Analyze the 3D objects in the scene and generate render lists containing render items. - * - Process the render lists by calling one or more render commands for each render item. - * - For each render command, request a render object and perform the draw. - * - * The module provides an interface to get data required for the draw command like the actual - * draw parameters or vertex buffers. It also holds a series of caching related methods since - * creating render objects should only be done when necessary. - * - * @private - */ -declare class RenderObject { - /** - * Constructs a new render object. - * - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - * @param {Geometries} geometries - Renderer component for managing geometries. - * @param {Renderer} renderer - The renderer. - * @param {Object3D} object - The 3D object. - * @param {Material} material - The 3D object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {LightsNode} lightsNode - The lights node. - * @param {RenderContext} renderContext - The render context. - * @param {ClippingContext} clippingContext - The clipping context. - */ - constructor(nodes: NodeManager, geometries: Geometries, renderer: Renderer, object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext); - id: number; - /** - * Renderer component for managing nodes related logic. - * - * @type {NodeManager} - * @private - */ - private _nodes; - /** - * Renderer component for managing geometries. - * - * @type {Geometries} - * @private - */ - private _geometries; - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * The 3D object. - * - * @type {Object3D} - */ - object: Object3D; - /** - * The 3D object's material. - * - * @type {Material} - */ - material: Material; - /** - * The scene the 3D object belongs to. - * - * @type {Scene} - */ - scene: Scene; - /** - * The camera the 3D object should be rendered with. - * - * @type {Camera} - */ - camera: Camera; - /** - * The lights node. - * - * @type {LightsNode} - */ - lightsNode: LightsNode; - /** - * The render context. - * - * @type {RenderContext} - */ - context: RenderContext; - /** - * The 3D object's geometry. - * - * @type {BufferGeometry} - */ - geometry: BufferGeometry; - /** - * The render object's version. - * - * @type {number} - */ - version: number; - /** - * The draw range of the geometry. - * - * @type {?Object} - * @default null - */ - drawRange: Object | null; - /** - * An array holding the buffer attributes - * of the render object. This entails attribute - * definitions on geometry and node level. - * - * @type {?Array} - * @default null - */ - attributes: Array | null; - /** - * An object holding the version of the - * attributes. The keys are the attribute names - * and the values are the attribute versions. - * - * @type {?Object} - * @default null - */ - attributesId: { - [x: string]: number; - } | null; - /** - * A reference to a render pipeline the render - * object is processed with. - * - * @type {RenderPipeline} - * @default null - */ - pipeline: RenderPipeline; - /** - * Only relevant for objects using - * multiple materials. This represents a group entry - * from the respective `BufferGeometry`. - * - * @type {?{start: number, count: number}} - * @default null - */ - group: { - start: number; - count: number; - } | null; - /** - * An array holding the vertex buffers which can - * be buffer attributes but also interleaved buffers. - * - * @type {?Array} - * @default null - */ - vertexBuffers: Array | null; - /** - * The parameters for the draw command. - * - * @type {?Object} - * @default null - */ - drawParams: Object | null; - /** - * If this render object is used inside a render bundle, - * this property points to the respective bundle group. - * - * @type {?BundleGroup} - * @default null - */ - bundle: BundleGroup | null; - /** - * The clipping context. - * - * @type {ClippingContext} - */ - clippingContext: ClippingContext; - /** - * The clipping context's cache key. - * - * @type {string} - */ - clippingContextCacheKey: string; - /** - * The initial node cache key. - * - * @type {number} - */ - initialNodesCacheKey: number; - /** - * The initial cache key. - * - * @type {number} - */ - initialCacheKey: number; - /** - * The node builder state. - * - * @type {?NodeBuilderState} - * @private - * @default null - */ - private _nodeBuilderState; - /** - * An array of bindings. - * - * @type {?Array} - * @private - * @default null - */ - private _bindings; - /** - * Reference to the node material observer. - * - * @type {?NodeMaterialObserver} - * @private - * @default null - */ - private _monitor; - /** - * The object's original material when this render object is drawn with an - * override material. - * - * @type {?Material} - * @private - * @default null - */ - private _sourceMaterial; - /** - * An event listener which is defined by `RenderObjects`. It performs - * clean up tasks when `dispose()` on this render object. - * - * @method - */ - onDispose: any; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderObject: boolean; - /** - * An event listener which is executed when `dispose()` is called on - * the material of this render object. - * - * @method - */ - onMaterialDispose: () => void; - /** - * An event listener which is executed when `dispose()` is called on - * the geometry of this render object. - * - * @method - */ - onGeometryDispose: () => void; - /** - * An event listener which is executed when `dispose()` is called on - * the 3D object of this render object. - * - * @method - */ - onObjectDispose: () => void; - /** - * Updates the clipping context. - * - * @param {ClippingContext} context - The clipping context to set. - */ - updateClipping(context: ClippingContext): void; - /** - * Whether the clipping requires an update or not. - * - * @type {boolean} - * @readonly - */ - readonly get clippingNeedsUpdate(): boolean; - /** - * The number of clipping planes defined in context of hardware clipping. - * - * @type {number} - * @readonly - */ - readonly get hardwareClippingPlanes(): number; - /** - * Returns the node builder state of this render object. - * - * @return {NodeBuilderState} The node builder state. - */ - getNodeBuilderState(): NodeBuilderState; - /** - * Returns the node material observer of this render object. - * - * @return {NodeMaterialObserver} The node material observer. - */ - getMonitor(): NodeMaterialObserver; - /** - * Returns an array of bind groups of this render object. - * - * @return {Array} The bindings. - */ - getBindings(): Array; - /** - * Returns a binding group by group name of this render object. - * - * @param {string} name - The name of the binding group. - * @return {?BindGroup} The bindings. - */ - getBindingGroup(name: string): BindGroup | null; - /** - * Returns the index of the render object's geometry. - * - * @return {?BufferAttribute} The index. Returns `null` for non-indexed geometries. - */ - getIndex(): BufferAttribute | null; - /** - * Returns the indirect buffer attribute. - * - * @return {?BufferAttribute} The indirect attribute. `null` if no indirect drawing is used. - */ - getIndirect(): BufferAttribute | null; - /** - * Returns the byte offset into the indirect attribute buffer. - * - * @return {number|Array} The byte offset into the indirect attribute buffer. - */ - getIndirectOffset(): number | Array; - /** - * Returns an array that acts as a key for identifying the render object in a chain map. - * - * @return {Array} An array with object references. - */ - getChainArray(): Array; - /** - * This method is used when the geometry of a 3D object has been exchanged and the - * respective render object now requires an update. - * - * @param {BufferGeometry} geometry - The geometry to set. - */ - setGeometry(geometry: BufferGeometry): void; - /** - * Returns the buffer attributes of the render object. The returned array holds - * attribute definitions on geometry and node level. - * - * @return {Array} An array with buffer attributes. - */ - getAttributes(): Array; - /** - * Returns the vertex buffers of the render object. - * - * @return {Array} An array with buffer attribute or interleaved buffers. - */ - getVertexBuffers(): Array; - /** - * Returns the draw parameters for the render object. - * - * @return {?{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} The draw parameters. - */ - getDrawParameters(): { - vertexCount: number; - firstVertex: number; - instanceCount: number; - firstInstance: number; - } | null; - /** - * Returns the render object's geometry cache key. - * - * The geometry cache key is part of the material cache key. - * - * @return {string} The geometry cache key. - */ - getGeometryCacheKey(): string; - /** - * Returns the render object's material cache key. - * - * The material cache key is part of the render object cache key. - * - * @return {number} The material cache key. - */ - getMaterialCacheKey(): number; - /** - * Whether the geometry requires an update or not. - * - * @type {boolean} - * @readonly - */ - readonly get needsGeometryUpdate(): boolean; - /** - * Whether the render object requires an update or not. - * - * Note: There are two distinct places where render objects are checked for an update. - * - * 1. In `RenderObjects.get()` which is executed when the render object is request. This - * method checks the `needsUpdate` flag and recreates the render object if necessary. - * 2. In `Renderer._renderObjectDirect()` right after getting the render object via - * `RenderObjects.get()`. The render object's NodeMaterialObserver is then used to detect - * a need for a refresh due to material, geometry or object related value changes. - * - * TODO: Investigate if it's possible to merge both steps so there is only a single place - * that performs the 'needsUpdate' check. - * - * @type {boolean} - * @readonly - */ - readonly get needsUpdate(): boolean; - /** - * Returns the dynamic cache key which represents a key that is computed per draw command. - * - * @return {number} The cache key. - */ - getDynamicCacheKey(): number; - /** - * Returns the render object's cache key. - * - * @return {number} The cache key. - */ - getCacheKey(): number; - /** - * Frees internal resources. - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts deleted file mode 100644 index d9631c32e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderObjectPipeline.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export default RenderObjectPipeline; -/** - * Class for representing render pipelines. - * - * @private - * @augments Pipeline - */ -declare class RenderObjectPipeline extends Pipeline { - /** - * Constructs a new render object pipeline. - * - * @param {string} cacheKey - The pipeline's cache key. - * @param {ProgrammableStage} vertexProgram - The pipeline's vertex shader. - * @param {ProgrammableStage} fragmentProgram - The pipeline's fragment shader. - */ - constructor(cacheKey: string, vertexProgram: ProgrammableStage, fragmentProgram: ProgrammableStage); - /** - * The pipeline's vertex shader. - * - * @type {ProgrammableStage} - */ - vertexProgram: ProgrammableStage; - /** - * The pipeline's fragment shader. - * - * @type {ProgrammableStage} - */ - fragmentProgram: ProgrammableStage; -} -import Pipeline from './Pipeline.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts deleted file mode 100644 index fcb34a2e6..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderObjects.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -export default RenderObjects; -/** - * This module manages the render objects of the renderer. - * - * @private - */ -declare class RenderObjects { - /** - * Constructs a new render object management component. - * - * @param {Renderer} renderer - The renderer. - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - * @param {Geometries} geometries - Renderer component for managing geometries. - * @param {Pipelines} pipelines - Renderer component for managing pipelines. - * @param {Bindings} bindings - Renderer component for managing bindings. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(renderer: Renderer, nodes: NodeManager, geometries: Geometries, pipelines: Pipelines, bindings: Bindings, info: Info); - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * Renderer component for managing nodes related logic. - * - * @type {NodeManager} - */ - nodes: NodeManager; - /** - * Renderer component for managing geometries. - * - * @type {Geometries} - */ - geometries: Geometries; - /** - * Renderer component for managing pipelines. - * - * @type {Pipelines} - */ - pipelines: Pipelines; - /** - * Renderer component for managing bindings. - * - * @type {Bindings} - */ - bindings: Bindings; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * A dictionary that manages render contexts in chain maps - * for each pass ID. - * - * @type {Object} - */ - chainMaps: { - [x: string]: ChainMap; - }; - /** - * Returns a render object for the given object and state data. - * - * @param {Object3D} object - The 3D object. - * @param {Material} material - The 3D object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the 3D object should be rendered with. - * @param {LightsNode} lightsNode - The lights node. - * @param {RenderContext} renderContext - The render context. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {string} [passId] - An optional ID for identifying the pass. - * @return {RenderObject} The render object. - */ - get(object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext, passId?: string): RenderObject; - /** - * Returns a chain map for the given pass ID. - * - * @param {string} [passId='default'] - The pass ID. - * @return {ChainMap} The chain map. - */ - getChainMap(passId?: string): ChainMap; - /** - * Frees internal resources. - */ - dispose(): void; - /** - * Factory method for creating render objects with the given list of parameters. - * - * @param {NodeManager} nodes - Renderer component for managing nodes related logic. - * @param {Geometries} geometries - Renderer component for managing geometries. - * @param {Renderer} renderer - The renderer. - * @param {Object3D} object - The 3D object. - * @param {Material} material - The object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {LightsNode} lightsNode - The lights node. - * @param {RenderContext} renderContext - The render context. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {string} [passId] - An optional ID for identifying the pass. - * @return {RenderObject} The render object. - */ - createRenderObject(nodes: NodeManager, geometries: Geometries, renderer: Renderer, object: Object3D, material: Material, scene: Scene, camera: Camera, lightsNode: LightsNode, renderContext: RenderContext, clippingContext: ClippingContext, passId?: string): RenderObject; -} -import ChainMap from './ChainMap.js'; -import RenderObject from './RenderObject.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts deleted file mode 100644 index b0528c37e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RenderPipeline.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -export default RenderPipeline; -/** - * This module is responsible to manage the rendering pipeline setups in apps. - * You usually create a single instance of this class and use it to define - * the output of your render pipeline and post processing effect chain. - * ```js - * const renderPipeline = new RenderPipeline( renderer ); - * - * const scenePass = pass( scene, camera ); - * - * renderPipeline.outputNode = scenePass; - * ``` - * - * Note: This module can only be used with `WebGPURenderer`. - */ -declare class RenderPipeline { - /** - * Constructs a new render pipeline management module. - * - * @param {Renderer} renderer - A reference to the renderer. - * @param {Node} outputNode - An optional output node. - */ - constructor(renderer: Renderer, outputNode?: Node); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderPipeline: boolean; - /** - * A reference to the renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * A node which defines the final output of the rendering - * pipeline. This is usually the last node in a chain - * of effect nodes. - * - * @type {Node} - */ - outputNode: Node; - /** - * Whether the default output tone mapping and color - * space transformation should be enabled or not. - * - * This is enabled by default but it must be disabled for - * effects that expect to be executed after tone mapping and color - * space conversion. A typical example is FXAA which - * requires sRGB input. - * - * When set to `false`, the app must control the output - * transformation with `RenderOutputNode`. - * - * ```js - * const outputPass = renderOutput( scenePass ); - * ``` - * - * @type {boolean} - */ - outputColorTransform: boolean; - /** - * Must be set to `true` when the output node changes. - * - * @type {Node} - */ - needsUpdate: Node; - /** - * The full screen quad that is used to render - * the effects. - * - * @private - * @type {QuadMesh} - */ - private _quadMesh; - /** - * The context data for the render pipeline. - * - * @private - * @type {?Object} - * @default null - */ - private _contextData; - /** - * The current tone mapping. - * - * @private - * @type {ToneMapping} - */ - private _toneMapping; - /** - * The current output color space. - * - * @private - * @type {ColorSpace} - */ - private _outputColorSpace; - /** - * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, - * the application must use this version of `render()` inside - * its animation loop (not the one from the renderer). - */ - render(): void; - /** - * Frees internal resources. - */ - dispose(): void; - /** - * Updates the context data. - * - * @private - */ - private _updateContext; - /** - * Updates the state of the module. - * - * @private - */ - private _update; - /** - * When `RenderPipeline` is used to apply rendering pipeline and post processing effects, - * the application must use this version of `renderAsync()` inside - * its animation loop (not the one from the renderer). - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the render has been finished. - */ - renderAsync(): Promise; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts deleted file mode 100644 index ef23054d1..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Renderer.d.ts +++ /dev/null @@ -1,1491 +0,0 @@ -export default Renderer; -/** - * Animation loop parameter of `renderer.setAnimationLoop()`. - */ -export type onAnimationCallback = (time: DOMHighResTimeStamp, frame?: XRFrame) => any; -/** - * Base class for renderers. - */ -declare class Renderer { - /** - * Renderer options. - * - * @typedef {Object} Renderer~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. This parameter can set to any other integer value than 0 - * to overwrite the default. - * @property {?Function} [getFallback=null] - This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. - * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best - * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. - * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. - */ - /** - * Constructs a new renderer. - * - * @param {Backend} backend - The backend the renderer is targeting (e.g. WebGPU or WebGL 2). - * @param {Renderer~Options} [parameters] - The configuration parameter. - - */ - constructor(backend: Backend, parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isRenderer: boolean; - /** - * A reference to the current backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * Whether the renderer should automatically clear the current rendering target - * before execute a `render()` call. The target can be the canvas (default framebuffer) - * or the current bound render target (custom framebuffer). - * - * @type {boolean} - * @default true - */ - autoClear: boolean; - /** - * When `autoClear` is set to `true`, this property defines whether the renderer - * should clear the color buffer. - * - * @type {boolean} - * @default true - */ - autoClearColor: boolean; - /** - * When `autoClear` is set to `true`, this property defines whether the renderer - * should clear the depth buffer. - * - * @type {boolean} - * @default true - */ - autoClearDepth: boolean; - /** - * When `autoClear` is set to `true`, this property defines whether the renderer - * should clear the stencil buffer. - * - * @type {boolean} - * @default true - */ - autoClearStencil: boolean; - /** - * Whether the default framebuffer should be transparent or opaque. - * - * @type {boolean} - * @default true - */ - alpha: boolean; - /** - * Whether logarithmic depth buffer is enabled or not. - * - * @type {boolean} - * @default false - * @readonly - */ - readonly logarithmicDepthBuffer: boolean; - /** - * Whether reversed depth buffer is enabled or not. - * - * @type {boolean} - * @default false - * @readonly - */ - readonly reversedDepthBuffer: boolean; - /** - * Defines the output color space of the renderer. - * - * @type {string} - * @default SRGBColorSpace - */ - outputColorSpace: string; - /** - * Defines the tone mapping of the renderer. - * - * @type {number} - * @default NoToneMapping - */ - toneMapping: number; - /** - * Defines the tone mapping exposure. - * - * @type {number} - * @default 1 - */ - toneMappingExposure: number; - /** - * Whether the renderer should sort its render lists or not. - * - * Note: Sorting is used to attempt to properly render objects that have some degree of transparency. - * By definition, sorting objects may not work in all cases. Depending on the needs of application, - * it may be necessary to turn off sorting and use other methods to deal with transparency rendering - * e.g. manually determining each object's rendering order. - * - * @type {boolean} - * @default true - */ - sortObjects: boolean; - /** - * Whether the default framebuffer should have a depth buffer or not. - * - * @type {boolean} - * @default true - */ - depth: boolean; - /** - * Whether the default framebuffer should have a stencil buffer or not. - * - * @type {boolean} - * @default false - */ - stencil: boolean; - /** - * Holds a series of statistical information about the GPU memory - * and the rendering process. Useful for debugging and monitoring. - * - * @type {Info} - */ - info: Info; - /** - * A global context node that stores override nodes for specific transformations or calculations. - * These nodes can be used to replace default behavior in the rendering pipeline. - * - * @type {ContextNode} - * @property {Object} value - The context value object. - */ - contextNode: ContextNode; - /** - * The node library defines how certain library objects like materials, lights - * or tone mapping functions are mapped to node types. This is required since - * although instances of classes like `MeshBasicMaterial` or `PointLight` can - * be part of the scene graph, they are internally represented as nodes for - * further processing. - * - * @type {NodeLibrary} - */ - library: NodeLibrary; - /** - * A map-like data structure for managing lights. - * - * @type {Lighting} - */ - lighting: Lighting; - /** - * The number of MSAA samples. - * - * @private - * @type {number} - * @default 0 - */ - private _samples; - /** - * Callback when the canvas has been resized. - * - * @private - */ - private _onCanvasTargetResize; - /** - * The canvas target for rendering. - * - * @private - * @type {CanvasTarget} - */ - private _canvasTarget; - /** - * The inspector provides information about the internal renderer state. - * - * @private - * @type {InspectorBase} - */ - private _inspector; - /** - * This callback function can be used to provide a fallback backend, if the primary backend can't be targeted. - * - * @private - * @type {?Function} - */ - private _getFallback; - /** - * A reference to a renderer module for managing shader attributes. - * - * @private - * @type {?Attributes} - * @default null - */ - private _attributes; - /** - * A reference to a renderer module for managing geometries. - * - * @private - * @type {?Geometries} - * @default null - */ - private _geometries; - /** - * A reference to a renderer module for managing node related logic. - * - * @private - * @type {?NodeManager} - * @default null - */ - private _nodes; - /** - * A reference to a renderer module for managing the internal animation loop. - * - * @private - * @type {?Animation} - * @default null - */ - private _animation; - /** - * A reference to a renderer module for managing shader program bindings. - * - * @private - * @type {?Bindings} - * @default null - */ - private _bindings; - /** - * A reference to a renderer module for managing render objects. - * - * @private - * @type {?RenderObjects} - * @default null - */ - private _objects; - /** - * A reference to a renderer module for managing render and compute pipelines. - * - * @private - * @type {?Pipelines} - * @default null - */ - private _pipelines; - /** - * A reference to a renderer module for managing render bundles. - * - * @private - * @type {?RenderBundles} - * @default null - */ - private _bundles; - /** - * A reference to a renderer module for managing render lists. - * - * @private - * @type {?RenderLists} - * @default null - */ - private _renderLists; - /** - * A reference to a renderer module for managing render contexts. - * - * @private - * @type {?RenderContexts} - * @default null - */ - private _renderContexts; - /** - * A reference to a renderer module for managing textures. - * - * @private - * @type {?Textures} - * @default null - */ - private _textures; - /** - * A reference to a renderer module for backgrounds. - * - * @private - * @type {?Background} - * @default null - */ - private _background; - /** - * Cache for the fullscreen quad. - * This fullscreen quad is used for internal render passes - * like the tone mapping and color space output pass. - * - * @private - * @type {Map} - */ - private _quadCache; - /** - * A reference to the current render context. - * - * @private - * @type {?RenderContext} - * @default null - */ - private _currentRenderContext; - /** - * A custom sort function for the opaque render list. - * - * @private - * @type {?Function} - * @default null - */ - private _opaqueSort; - /** - * A custom sort function for the transparent render list. - * - * @private - * @type {?Function} - * @default null - */ - private _transparentSort; - /** - * Cache of framebuffer targets per canvas target. - * - * @private - * @type {Map} - */ - private _frameBufferTargets; - /** - * The clear color value. - * - * @private - * @type {Color4} - */ - private _clearColor; - /** - * The clear depth value. - * - * @private - * @type {number} - * @default 1 - */ - private _clearDepth; - /** - * The clear stencil value. - * - * @private - * @type {number} - * @default 0 - */ - private _clearStencil; - /** - * The current render target. - * - * @private - * @type {?RenderTarget} - * @default null - */ - private _renderTarget; - /** - * The active cube face. - * - * @private - * @type {number} - * @default 0 - */ - private _activeCubeFace; - /** - * The active mipmap level. - * - * @private - * @type {number} - * @default 0 - */ - private _activeMipmapLevel; - /** - * The current output render target. - * - * @private - * @type {?RenderTarget} - * @default null - */ - private _outputRenderTarget; - /** - * The MRT setting. - * - * @private - * @type {?MRTNode} - * @default null - */ - private _mrt; - /** - * This function defines how a render object is going - * to be rendered. - * - * @private - * @type {?Function} - * @default null - */ - private _renderObjectFunction; - /** - * Used to keep track of the current render object function. - * - * @private - * @type {?Function} - * @default null - */ - private _currentRenderObjectFunction; - /** - * Used to keep track of the current render bundle. - * - * @private - * @type {?RenderBundle} - * @default null - */ - private _currentRenderBundle; - /** - * Next to `_renderObjectFunction()`, this function provides another hook - * for influencing the render process of a render object. It is meant for internal - * use and only relevant for `compileAsync()` right now. Instead of using - * the default logic of `_renderObjectDirect()` which actually draws the render object, - * a different function might be used which performs no draw but just the node - * and pipeline updates. - * - * @private - * @type {Function} - */ - private _handleObjectFunction; - /** - * Indicates whether the device has been lost or not. In WebGL terms, the device - * lost is considered as a context lost. When this is set to `true`, rendering - * isn't possible anymore. - * - * @private - * @type {boolean} - * @default false - */ - private _isDeviceLost; - /** - * A callback function that defines what should happen when a device/context lost occurs. - * - * @type {Function} - */ - onDeviceLost: Function; - /** - * A callback function that defines what should happen when an uncaptured - * backend error is reported (e.g. a WebGPU validation/out-of-memory/internal - * error raised outside an error scope). Applications can override this to - * surface errors in their own UI without letting them escalate to a device - * loss. The default implementation logs to the console. - * - * @type {Function} - */ - onError: Function; - /** - * Defines the type of output buffers. The default `HalfFloatType` is recommend for - * best quality. To save memory and bandwidth, `UnsignedByteType` might be used. - * This will reduce rendering quality though. - * - * @private - * @type {number} - * @default HalfFloatType - */ - private _outputBufferType; - /** - * A cache for shadow nodes per material - * - * @private - * @type {WeakMap} - */ - private _cacheShadowNodes; - /** - * Whether the renderer has been initialized or not. - * - * @private - * @type {boolean} - * @default false - */ - private _initialized; - /** - * The call depth of the renderer. Counts the number of - * nested render calls. - * - * @private - * @type {number} - * @default - 1 - */ - private _callDepth; - /** - * A reference to the promise which initializes the renderer. - * - * @private - * @type {?Promise} - * @default null - */ - private _initPromise; - /** - * An array of compilation promises which are used in `compileAsync()`. - * - * @private - * @type {?Array} - * @default null - */ - private _compilationPromises; - /** - * Whether the renderer is currently precompiling a render object in - * `compileAsync()`. - * - * @private - * @type {boolean} - * @default false - */ - private _isPreCompiling; - /** - * When an override material is in use, this property points to the current - * source material during the rendering of a render object. - * - * @private - * @type {?Material} - * @default null - */ - private _currentSourceMaterial; - /** - * Whether the renderer should render transparent render objects or not. - * - * @type {boolean} - * @default true - */ - transparent: boolean; - /** - * Whether the renderer should render opaque render objects or not. - * - * @type {boolean} - * @default true - */ - opaque: boolean; - /** - * Shadow map configuration - * @typedef {Object} ShadowMapConfig - * @property {boolean} enabled - Whether to globally enable shadows or not. - * @property {boolean} transmitted - Whether to enable light transmission through non-opaque materials. - * @property {number} type - The shadow map type. - */ - /** - * The renderer's shadow configuration. - * - * @type {ShadowMapConfig} - */ - shadowMap: { - /** - * - Whether to globally enable shadows or not. - */ - enabled: boolean; - /** - * - Whether to enable light transmission through non-opaque materials. - */ - transmitted: boolean; - /** - * - The shadow map type. - */ - type: number; - }; - /** - * XR configuration. - * @typedef {Object} XRConfig - * @property {boolean} enabled - Whether to globally enable XR or not. - */ - /** - * The renderer's XR manager. - * - * @type {XRManager} - */ - xr: XRManager; - /** - * Debug configuration. - * @typedef {Object} DebugConfig - * @property {boolean} checkShaderErrors - Whether shader errors should be checked or not. - * @property {Object} diagnostics - Diagnostics configuration for the shader generation. - * @property {boolean} diagnostics.keywords - Whether declaration names that collide with reserved keywords should be renamed or not. - * @property {?Function} onNodeBuilderCreated - A callback function that is executed after a node builder has been created and before it is built. - * @property {?Function} onShaderError - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. - * @property {Function} getShaderAsync - Allows the get the raw shader code for the given scene, camera and 3D object. - */ - /** - * The renderer's debug configuration. - * - * @type {DebugConfig} - */ - debug: { - /** - * - Whether shader errors should be checked or not. - */ - checkShaderErrors: boolean; - /** - * - Diagnostics configuration for the shader generation. - */ - diagnostics: { - keywords: boolean; - }; - /** - * - A callback function that is executed after a node builder has been created and before it is built. - */ - onNodeBuilderCreated: Function | null; - /** - * - A callback function that is executed when a shader error happens. Only supported with WebGL 2 right now. - */ - onShaderError: Function | null; - /** - * - Allows the get the raw shader code for the given scene, camera and 3D object. - */ - getShaderAsync: Function; - }; - /** - * Initializes the renderer so it is ready for usage. - * - * @async - * @return {Promise} A Promise that resolves when the renderer has been initialized. - */ - init(): Promise; - /** - * A reference to the canvas element the renderer is drawing to. - * This value of this property will automatically be created by - * the renderer. - * - * @type {HTMLCanvasElement|OffscreenCanvas} - */ - get domElement(): HTMLCanvasElement | OffscreenCanvas; - /** - * The coordinate system of the renderer. The value of this property - * depends on the selected backend. Either `THREE.WebGLCoordinateSystem` or - * `THREE.WebGPUCoordinateSystem`. - * - * @readonly - * @type {number} - */ - readonly get coordinateSystem(): number; - /** - * Compiles all materials in the given scene. This can be useful to avoid a - * phenomenon which is called "shader compilation stutter", which occurs when - * rendering an object with a new shader for the first time. - * - * If you want to add a 3D object to an existing scene, use the third optional - * parameter for applying the target scene. Note that the (target) scene's lighting - * and environment must be configured before calling this method. - * - * @async - * @param {Object3D} scene - The scene or 3D object to precompile. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {?Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. - * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. - * @return {Promise} A Promise that resolves when the compile has been finished. - */ - compileAsync(scene: Object3D, camera: Camera, targetScene?: Scene | null, onProgress?: onProgressCallback): Promise; - /** - * Compile compute programs. This can be useful to avoid a - * phenomenon which is called "shader compilation stutter", which occurs when - * rendering an object with a new shader for the first time. - * - * @async - * @param {Node|Array} computeNodes - The compute node(s). - * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. - * @return {Promise} A Promise that resolves when the compile has been finished. - */ - compileComputeAsync(computeNodes: Node | Array, onProgress?: onProgressCallback): Promise; - /** - * Renders the scene in an async fashion. - * - * @async - * @deprecated - * @param {Object3D} scene - The scene or 3D object to render. - * @param {Camera} camera - The camera. - * @return {Promise} A Promise that resolves when the render has been finished. - */ - renderAsync(scene: Object3D, camera: Camera): Promise; - /** - * Can be used to synchronize CPU operations with GPU tasks. So when this method is called, - * the CPU waits for the GPU to complete its operation (e.g. a compute task). - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when synchronization has been finished. - */ - waitForGPU(): Promise; - set inspector(value: InspectorBase); - /** - * The inspector instance. The inspector can be any class that extends from `InspectorBase`. - * - * @type {InspectorBase} - */ - get inspector(): InspectorBase; - /** - * Enables or disables high precision for model-view and normal-view matrices. - * When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance. - * - * NOTE: 64-bit precision is not compatible with `InstancedMesh` and `SkinnedMesh`. - * - * @param {boolean} value - Whether to enable or disable high precision. - * @type {boolean} - */ - set highPrecision(value: boolean); - /** - * Returns whether high precision is enabled or not. - * - * @return {boolean} Whether high precision is enabled or not. - * @type {boolean} - */ - get highPrecision(): boolean; - /** - * Sets the given MRT configuration. - * - * @param {MRTNode} mrt - The MRT node to set. - * @return {Renderer} A reference to this renderer. - */ - setMRT(mrt: MRTNode): Renderer; - /** - * Returns the MRT configuration. - * - * @return {MRTNode} The MRT configuration. - */ - getMRT(): MRTNode; - /** - * Returns the output buffer type. - * - * @return {number} The output buffer type. - */ - getOutputBufferType(): number; - /** - * Returns the output buffer type. - * - * @deprecated since r182. Use `.getOutputBufferType()` instead. - * @return {number} The output buffer type. - */ - getColorBufferType(): number; - /** - * Default implementation of the device lost callback. - * - * @private - * @param {Object} info - Information about the context lost. - */ - private _onDeviceLost; - /** - * Default implementation of the uncaptured backend error callback. - * - * @private - * @param {Object} info - Information about the uncaptured error. - */ - private _onError; - /** - * Returns `true` if the cached GPU render bundle for the given bundle group is - * out-of-date and must be recorded again. - * - * @private - * @param {BundleGroup} bundleGroup - The bundle group. - * @param {Object} renderBundleData - The backend data of the render bundle. - * @return {boolean} Whether the cached render bundle needs an update. - */ - private _bundleNeedsUpdate; - /** - * Renders the given render bundle. - * - * @private - * @param {Object} bundle - Render bundle data. - * @param {Scene} sceneRef - The scene the render bundle belongs to. - * @param {LightsNode} lightsNode - The lights node. - */ - private _renderBundle; - /** - * Renders the scene or 3D object with the given camera. This method can only be called - * if the renderer has been initialized. When using `render()` inside an animation loop, - * it's guaranteed the renderer will be initialized. The animation loop must be defined - * with {@link Renderer#setAnimationLoop} though. - * - * For all other use cases (like when using on-demand rendering), you must call - * {@link Renderer#init} before rendering. - * - * The target of the method is the default framebuffer (meaning the canvas) - * or alternatively a render target when specified via `setRenderTarget()`. - * - * @param {Object3D} scene - The scene or 3D object to render. - * @param {Camera} camera - The camera to render the scene with. - */ - render(scene: Object3D, camera: Camera): void; - /** - * Returns whether the renderer has been initialized or not. - * - * @readonly - * @return {boolean} Whether the renderer has been initialized or not. - */ - readonly get initialized(): boolean; - _renderOutputLayers(quad: any, renderTarget: any): void; - /** - * Returns an internal render target which is used when computing the output tone mapping - * and color space conversion. Unlike in `WebGLRenderer`, this is done in a separate render - * pass and not inline to achieve more correct results. - * - * @private - * @return {?RenderTarget} The render target. The method returns `null` if no output conversion should be applied. - */ - private _getFrameBufferTarget; - /** - * Renders the scene or 3D object with the given camera. - * - * @private - * @param {Object3D} scene - The scene or 3D object to render. - * @param {Camera} camera - The camera to render the scene with. - * @param {boolean} [useFrameBufferTarget=true] - Whether to use a framebuffer target or not. - * @return {RenderContext} The current render context. - */ - private _renderScene; - _setXRLayerSize(width: any, height: any): void; - /** - * The output pass performs tone mapping and color space conversion. - * - * @private - * @param {RenderTarget} renderTarget - The current render target. - */ - private _renderOutput; - /** - * Returns the maximum available anisotropy for texture filtering. - * - * @return {number} The maximum available anisotropy. - */ - getMaxAnisotropy(): number; - /** - * Returns the active cube face. - * - * @return {number} The active cube face. - */ - getActiveCubeFace(): number; - /** - * Returns the active mipmap level. - * - * @return {number} The active mipmap level. - */ - getActiveMipmapLevel(): number; - /** - * Applications are advised to always define the animation loop - * with this method and not manually with `requestAnimationFrame()` - * for best compatibility. - * - * @async - * @param {?onAnimationCallback} callback - The application's animation loop. - * @return {Promise} A Promise that resolves when the set has been executed. - */ - setAnimationLoop(callback: onAnimationCallback | null): Promise; - /** - * Returns the current animation loop callback. - * - * @return {?Function} The current animation loop callback. - */ - getAnimationLoop(): Function | null; - /** - * Can be used to transfer buffer data from a storage buffer attribute - * from the GPU to the CPU in context of compute shaders. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @param {number} offset - The storage buffer attribute. - * @param {number} count - The offset from which to start reading the - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Returns the rendering context. - * - * @return {GPUCanvasContext|WebGL2RenderingContext} The rendering context. - */ - getContext(): GPUCanvasContext | WebGL2RenderingContext; - /** - * Returns the pixel ratio. - * - * @return {number} The pixel ratio. - */ - getPixelRatio(): number; - /** - * Returns the drawing buffer size in physical pixels. This method honors the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The drawing buffer size. - */ - getDrawingBufferSize(target: Vector2): Vector2; - /** - * Returns the renderer's size in logical pixels. This method does not honor the pixel ratio. - * - * @param {Vector2} target - The method writes the result in this target object. - * @return {Vector2} The renderer's size in logical pixels. - */ - getSize(target: Vector2): Vector2; - /** - * Sets the given pixel ratio and resizes the canvas if necessary. - * - * @param {number} [value=1] - The pixel ratio. - */ - setPixelRatio(value?: number): void; - /** - * This method allows to define the drawing buffer size by specifying - * width, height and pixel ratio all at once. The size of the drawing - * buffer is computed with this formula: - * ```js - * size.x = width * pixelRatio; - * size.y = height * pixelRatio; - * ``` - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {number} pixelRatio - The pixel ratio. - */ - setDrawingBufferSize(width: number, height: number, pixelRatio: number): void; - /** - * Sets the size of the renderer. - * - * @param {number} width - The width in logical pixels. - * @param {number} height - The height in logical pixels. - * @param {boolean} [updateStyle=true] - Whether to update the `style` attribute of the canvas or not. - */ - setSize(width: number, height: number, updateStyle?: boolean): void; - /** - * Defines a manual sort function for the opaque render list. - * Pass `null` to use the default sort. - * - * @param {Function} method - The sort function. - */ - setOpaqueSort(method: Function): void; - /** - * Defines a manual sort function for the transparent render list. - * Pass `null` to use the default sort. - * - * @param {Function} method - The sort function. - */ - setTransparentSort(method: Function): void; - /** - * Returns the scissor rectangle. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The scissor rectangle. - */ - getScissor(target: Vector4): Vector4; - /** - * Defines the scissor rectangle. - * - * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the box in logical pixel unit. - * Instead of passing four arguments, the method also works with a single four-dimensional vector. - * @param {number} y - The vertical coordinate for the upper left corner of the box in logical pixel unit. - * @param {number} width - The width of the scissor box in logical pixel unit. - * @param {number} height - The height of the scissor box in logical pixel unit. - */ - setScissor(x: number | Vector4, y: number, width: number, height: number): void; - /** - * Returns the scissor test value. - * - * @return {boolean} Whether the scissor test should be enabled or not. - */ - getScissorTest(): boolean; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Resets the backend's internal state cache. Useful when the rendering context is shared with - * other libraries that change the state. A no-op for the WebGPU backend. - */ - resetState(): void; - /** - * Returns the viewport definition. - * - * @param {Vector4} target - The method writes the result in this target object. - * @return {Vector4} The viewport definition. - */ - getViewport(target: Vector4): Vector4; - /** - * Defines the viewport. - * - * @param {number | Vector4} x - The horizontal coordinate for the upper left corner of the viewport origin in logical pixel unit. - * @param {number} y - The vertical coordinate for the upper left corner of the viewport origin in logical pixel unit. - * @param {number} width - The width of the viewport in logical pixel unit. - * @param {number} height - The height of the viewport in logical pixel unit. - * @param {number} minDepth - The minimum depth value of the viewport. WebGPU only. - * @param {number} maxDepth - The maximum depth value of the viewport. WebGPU only. - */ - setViewport(x: number | Vector4, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void; - /** - * Returns the clear color. - * - * @param {Color} target - The method writes the result in this target object. - * @return {Color} The clear color. - */ - getClearColor(target: Color): Color; - /** - * Defines the clear color and optionally the clear alpha. - * - * @param {Color} color - The clear color. - * @param {number} [alpha=1] - The clear alpha. - */ - setClearColor(color: Color, alpha?: number): void; - /** - * Returns the clear alpha. - * - * @return {number} The clear alpha. - */ - getClearAlpha(): number; - /** - * Defines the clear alpha. - * - * @param {number} alpha - The clear alpha. - */ - setClearAlpha(alpha: number): void; - /** - * Returns the clear depth. - * - * @return {number} The clear depth. - */ - getClearDepth(): number; - /** - * Defines the clear depth. - * - * @param {number} depth - The clear depth. - */ - setClearDepth(depth: number): void; - /** - * Returns the clear stencil. - * - * @return {number} The clear stencil. - */ - getClearStencil(): number; - /** - * Defines the clear stencil. - * - * @param {number} stencil - The clear stencil. - */ - setClearStencil(stencil: number): void; - /** - * This method performs an occlusion query for the given 3D object. - * It returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. - * - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(object: Object3D): boolean; - /** - * Performs a manual clear operation. This method ignores `autoClear` properties. - * - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - */ - clear(color?: boolean, depth?: boolean, stencil?: boolean): void; - /** - * Performs a manual clear operation of the color buffer. This method ignores `autoClear` properties. - */ - clearColor(): void; - /** - * Performs a manual clear operation of the depth buffer. This method ignores `autoClear` properties. - */ - clearDepth(): void; - /** - * Performs a manual clear operation of the stencil buffer. This method ignores `autoClear` properties. - */ - clearStencil(): void; - /** - * Async version of {@link Renderer#clear}. - * - * @async - * @deprecated - * @param {boolean} [color=true] - Whether the color buffer should be cleared or not. - * @param {boolean} [depth=true] - Whether the depth buffer should be cleared or not. - * @param {boolean} [stencil=true] - Whether the stencil buffer should be cleared or not. - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearAsync(color?: boolean, depth?: boolean, stencil?: boolean): Promise; - /** - * Async version of {@link Renderer#clearColor}. - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearColorAsync(): Promise; - /** - * Async version of {@link Renderer#clearDepth}. - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearDepthAsync(): Promise; - /** - * Async version of {@link Renderer#clearStencil}. - * - * @async - * @deprecated - * @return {Promise} A Promise that resolves when the clear operation has been executed. - */ - clearStencilAsync(): Promise; - /** - * Returns `true` if a framebuffer target is needed to perform tone mapping or color space conversion. - * If this is the case, the renderer allocates an internal render target for that purpose. - * - * @type {boolean} - */ - get needsFrameBufferTarget(): boolean; - /** - * The number of samples used for multi-sample anti-aliasing (MSAA). - * - * @type {number} - * @default 0 - */ - get samples(): number; - /** - * The current number of samples used for multi-sample anti-aliasing (MSAA). - * - * When rendering to a custom render target, the number of samples of that render target is used. - * The number of samples is set to 0 when the renderer needs an internal framebuffer target for - * tone mapping or color space conversion, or when rendering a fullscreen quad to screen. - * - * @type {number} - */ - get currentSamples(): number; - /** - * The current tone mapping of the renderer. When not producing screen output, - * the tone mapping is always `NoToneMapping`. - * - * @type {number} - */ - get currentToneMapping(): number; - /** - * The current color space of the renderer. When not producing screen output, - * the color space is always the working color space. - * - * @type {string} - */ - get currentColorSpace(): string; - /** - * Returns `true` if the rendering settings are set to screen output. - * - * @returns {boolean} True if the current render target is the same of output render target or `null`, otherwise false. - */ - get isOutputTarget(): boolean; - /** - * Frees all internal resources of the renderer. Call this method if the renderer - * is no longer in use by your app. - */ - dispose(): void; - /** - * Sets the given render target. Calling this method means the renderer does not - * target the default framebuffer (meaning the canvas) anymore but a custom framebuffer. - * Use `null` as the first argument to reset the state. - * - * @param {?RenderTarget} renderTarget - The render target to set. - * @param {number} [activeCubeFace=0] - The active cube face. - * @param {number} [activeMipmapLevel=0] - The active mipmap level. - */ - setRenderTarget(renderTarget: RenderTarget | null, activeCubeFace?: number, activeMipmapLevel?: number): void; - /** - * Returns the current render target. - * - * @return {?RenderTarget} The render target. Returns `null` if no render target is set. - */ - getRenderTarget(): RenderTarget | null; - /** - * Sets the output render target for the renderer. - * - * @param {?RenderTarget} renderTarget - The render target to set as the output target. - */ - setOutputRenderTarget(renderTarget: RenderTarget | null): void; - /** - * Returns the current output target. - * - * @return {?RenderTarget} The current output render target. Returns `null` if no output target is set. - */ - getOutputRenderTarget(): RenderTarget | null; - /** - * Sets the canvas target. The canvas target manages the HTML canvas - * or the offscreen canvas the renderer draws into. - * - * @param {CanvasTarget} canvasTarget - The canvas target. - */ - setCanvasTarget(canvasTarget: CanvasTarget): void; - /** - * Returns the current canvas target. - * - * @return {CanvasTarget} The current canvas target. - */ - getCanvasTarget(): CanvasTarget; - /** - * Resets the renderer to the initial state before WebXR started. - * - * @private - */ - private _resetXRState; - /** - * Callback for {@link Renderer#setRenderObjectFunction}. - * - * @callback renderObjectFunction - * @param {Object3D} object - The 3D object. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {BufferGeometry} geometry - The object's geometry. - * @param {Material} material - The object's material. - * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {LightsNode} lightsNode - The current lights node. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {?string} [passId=null] - An optional ID for identifying the pass. - */ - /** - * Sets the given render object function. Calling this method overwrites the default implementation - * which is {@link Renderer#renderObject}. Defining a custom function can be useful - * if you want to modify the way objects are rendered. For example you can define things like "every - * object that has material of a certain type should perform a pre-pass with a special overwrite material". - * The custom function must always call `renderObject()` in its implementation. - * - * Use `null` as the first argument to reset the state. - * - * @param {?renderObjectFunction} renderObjectFunction - The render object function. - */ - setRenderObjectFunction(renderObjectFunction: ((object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext: ClippingContext, passId?: string | null | undefined) => any) | null): void; - /** - * Returns the current render object function. - * - * @return {?Function} The current render object function. Returns `null` if no function is set. - */ - getRenderObjectFunction(): Function | null; - /** - * Execute a single or an array of compute nodes. This method can only be called - * if the renderer has been initialized. - * - * @param {Node|Array} computeNodes - The compute node(s). - * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] - * - A single number representing count, or - * - An array [x, y, z] representing dispatch size, or - * - A IndirectStorageBufferAttribute for indirect dispatch size. - * @return {Promise|undefined} A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized. - */ - compute(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise | undefined; - /** - * Execute a single or an array of compute nodes. - * - * @async - * @param {Node|Array} computeNodes - The compute node(s). - * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] - * - A single number representing count, or - * - An array [x, y, z] representing dispatch size, or - * - A IndirectStorageBufferAttribute for indirect dispatch size. - * @return {Promise} A Promise that resolve when the compute has finished. - */ - computeAsync(computeNodes: Node | Array, dispatchSize?: number | Array | IndirectStorageBufferAttribute): Promise; - /** - * Checks if the given feature is supported by the selected backend. - * - * @async - * @deprecated - * @param {string} name - The feature's name. - * @return {Promise} A Promise that resolves with a bool that indicates whether the feature is supported or not. - */ - hasFeatureAsync(name: string): Promise; - resolveTimestampsAsync(type?: string): Promise; - /** - * Checks if the given feature is supported by the selected backend. If the - * renderer has not been initialized, this method always returns `false`. - * - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(name: string): boolean; - /** - * Returns `true` when the renderer has been initialized. - * - * @return {boolean} Whether the renderer has been initialized or not. - */ - hasInitialized(): boolean; - /** - * Initializes the given textures. Useful for preloading a texture rather than waiting until first render - * (which can cause noticeable lags due to decode and GPU upload overhead). - * - * @async - * @deprecated - * @param {Texture} texture - The texture. - * @return {Promise} A Promise that resolves when the texture has been initialized. - */ - initTextureAsync(texture: Texture): Promise; - /** - * Initializes the given texture. Useful for preloading a texture rather than waiting until first render - * (which can cause noticeable lags due to decode and GPU upload overhead). - * - * This method can only be used if the renderer has been initialized. - * - * @param {Texture} texture - The texture. - */ - initTexture(texture: Texture): void; - /** - * Initializes the given render target. - * - * @param {RenderTarget} renderTarget - The render target to intialize. - */ - initRenderTarget(renderTarget: RenderTarget): void; - /** - * Copies the current bound framebuffer into the given texture. - * - * @param {FramebufferTexture} framebufferTexture - The texture. - * @param {?(Vector2|Vector4)} [rectangle=null] - A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied. - */ - copyFramebufferToTexture(framebufferTexture: FramebufferTexture, rectangle?: (Vector2 | Vector4) | null): void; - /** - * Copies data of the given source texture into a destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {Box2|Box3} [srcRegion=null] - A bounding box which describes the source region. Can be two or three-dimensional. - * @param {Vector2|Vector3} [dstPosition=null] - A vector that represents the origin of the destination region. Can be two or three-dimensional. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: Box2 | Box3, dstPosition?: Vector2 | Vector3, srcLevel?: number, dstLevel?: number): void; - /** - * Reads pixel data from the given render target. - * - * @async - * @param {RenderTarget} renderTarget - The render target to read from. - * @param {number} x - The `x` coordinate of the copy region's origin. - * @param {number} y - The `y` coordinate of the copy region's origin. - * @param {number} width - The width of the copy region. - * @param {number} height - The height of the copy region. - * @param {number} [textureIndex=0] - The texture index of a MRT render target. - * @param {number} [faceIndex=0] - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array. - */ - readRenderTargetPixelsAsync(renderTarget: RenderTarget, x: number, y: number, width: number, height: number, textureIndex?: number, faceIndex?: number): Promise; - /** - * Analyzes the given 3D object's hierarchy and builds render lists from the - * processed hierarchy. - * - * @private - * @param {Object3D} object - The 3D object to process (usually a scene). - * @param {Camera} camera - The camera the object is rendered with. - * @param {number} groupOrder - The group order is derived from the `renderOrder` of groups and is used to group 3D objects within groups. - * @param {RenderList} renderList - The current render list. - * @param {ClippingContext} clippingContext - The current clipping context. - */ - private _projectObject; - /** - * Renders the given render bundles. - * - * @private - * @param {Array} bundles - Array with render bundle data. - * @param {Scene} sceneRef - The scene the render bundles belong to. - * @param {LightsNode} lightsNode - The current lights node. - */ - private _renderBundles; - /** - * Renders the transparent objects from the given render lists. - * - * @private - * @param {Array} renderList - The transparent render list. - * @param {Array} doublePassList - The list of transparent objects which require a double pass (e.g. because of transmission). - * @param {Camera} camera - The camera the render list should be rendered with. - * @param {Scene} scene - The scene the render list belongs to. - * @param {LightsNode} lightsNode - The current lights node. - */ - private _renderTransparents; - /** - * Renders the objects from the given render list. - * - * @private - * @param {Array} renderList - The render list. - * @param {Camera} camera - The camera the render list should be rendered with. - * @param {Scene} scene - The scene the render list belongs to. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?string} [passId=null] - An optional ID for identifying the pass. - */ - private _renderObjects; - /** - * Retrieves shadow nodes for the given material. This is used to setup shadow passes. - * The result is cached per material and updated when the material's version changes. - * - * @private - * @param {Material} material - * @returns {Object} - The shadow nodes for the material. - */ - private _getShadowNodes; - /** - * Updates the camera so it's prepared for rendering operations. - * - * @private - * @param {Camera} camera - The camera to update. - * @param {boolean} useXRCamera - Whether the XR camera should be used when presenting. - * @return {Camera} The returned camera might be different depending on whether XR is used or not. - */ - private _updateCamera; - /** - * This method represents the default render object function that manages the render lifecycle - * of the object. - * - * @param {Object3D} object - The 3D object. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {BufferGeometry} geometry - The object's geometry. - * @param {Material} material - The object's material. - * @param {?Object} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?ClippingContext} clippingContext - The clipping context. - * @param {?string} [passId=null] - An optional ID for identifying the pass. - */ - renderObject(object: Object3D, scene: Scene, camera: Camera, geometry: BufferGeometry, material: Material, group: Object | null, lightsNode: LightsNode, clippingContext?: ClippingContext | null, passId?: string | null): void; - /** - * Checks if the given compatibility is supported by the selected backend. - * - * @param {string} name - The compatibility's name. - * @return {boolean} Whether the compatibility is supported or not. - */ - hasCompatibility(name: string): boolean; - /** - * This method represents the default `_handleObjectFunction` implementation which creates - * a render object from the given data and performs the draw command with the selected backend. - * - * @private - * @param {Object3D} object - The 3D object. - * @param {Material} material - The object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {string} [passId] - An optional ID for identifying the pass. - */ - private _renderObjectDirect; - /** - * A different implementation for `_handleObjectFunction` which only makes sure the object is ready for rendering. - * Used in `compileAsync()`. - * - * @private - * @param {Object3D} object - The 3D object. - * @param {Material} material - The object's material. - * @param {Scene} scene - The scene the 3D object belongs to. - * @param {Camera} camera - The camera the object should be rendered with. - * @param {LightsNode} lightsNode - The current lights node. - * @param {?{start: number, count: number}} group - Only relevant for objects using multiple materials. This represents a group entry from the respective `BufferGeometry`. - * @param {ClippingContext} clippingContext - The clipping context. - * @param {string} [passId] - An optional ID for identifying the pass. - */ - private _createObjectPipeline; - /** - * Alias for `compileAsync()`. - * - * @method - * @param {Object3D} scene - The scene or 3D object to precompile. - * @param {Camera} camera - The camera that is used to render the scene. - * @param {Scene} targetScene - If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added. - * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress. - * @return {function(Object3D, Camera, ?Scene, ?onProgressCallback): Promise|undefined} A Promise that resolves when the compile has been finished. - */ - get compile(): (arg0: Object3D, arg1: Camera, arg2: Scene | null, arg3: onProgressCallback | null) => Promise | undefined; -} -import Info from './Info.js'; -import NodeLibrary from './nodes/NodeLibrary.js'; -import Lighting from './Lighting.js'; -import XRManager from './XRManager.js'; -import { Scene } from '../../scenes/Scene.js'; -import InspectorBase from './InspectorBase.js'; -import { Vector2 } from '../../math/Vector2.js'; -import { Vector4 } from '../../math/Vector4.js'; -import { RenderTarget } from '../../core/RenderTarget.js'; -import CanvasTarget from './CanvasTarget.js'; -import ClippingContext from './ClippingContext.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts deleted file mode 100644 index 8809693b3..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/RendererUtils.d.ts +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Saves the state of the given renderer and stores it into the given state object. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -export function saveRendererState(renderer: Renderer, state?: Object): Object; -/** - * Saves the state of the given renderer and stores it into the given state object. - * Besides, the function also resets the state of the renderer to its default values. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -export function resetRendererState(renderer: Renderer, state?: Object): Object; -/** - * Restores the state of the given renderer from the given state object. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Object} state - The state to restore. - */ -export function restoreRendererState(renderer: Renderer, state: Object): void; -/** - * Saves the state of the given scene and stores it into the given state object. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -export function saveSceneState(scene: Scene, state?: Object): Object; -/** - * Saves the state of the given scene and stores it into the given state object. - * Besides, the function also resets the state of the scene to its default values. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -export function resetSceneState(scene: Scene, state?: Object): Object; -/** - * Restores the state of the given scene from the given state object. - * - * @private - * @function - * @param {Scene} scene - The scene. - * @param {Object} state - The state to restore. - */ -export function restoreSceneState(scene: Scene, state: Object): void; -/** - * Saves the state of the given renderer and scene and stores it into the given state object. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -export function saveRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; -/** - * Saves the state of the given renderer and scene and stores it into the given state object. - * Besides, the function also resets the state of the renderer and scene to its default values. - * - * If not state object is provided, the function creates one. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Scene} scene - The scene. - * @param {Object} [state={}] - The state. - * @return {Object} The state. - */ -export function resetRendererAndSceneState(renderer: Renderer, scene: Scene, state?: Object): Object; -/** - * Restores the state of the given renderer and scene from the given state object. - * - * @private - * @function - * @param {Renderer} renderer - The renderer. - * @param {Scene} scene - The scene. - * @param {Object} state - The state to restore. - */ -export function restoreRendererAndSceneState(renderer: Renderer, scene: Scene, state: Object): void; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts deleted file mode 100644 index 990534644..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/SampledTexture.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Represents a sampled texture binding type. - * - * @private - * @augments Sampler - */ -export class SampledTexture extends Sampler { - /** - * This identifier. - * - * @type {number} - */ - id: number; - /** - * Whether the texture is a storage texture or not. - * - * @type {boolean} - * @default false - */ - store: boolean; - /** - * The mip level to bind for storage textures. - * - * @type {number} - * @default 0 - */ - mipLevel: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampledTexture: boolean; -} -/** - * Represents a sampled array texture binding type. - * - * @private - * @augments SampledTexture - */ -export class SampledArrayTexture extends SampledTexture { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampledArrayTexture: boolean; -} -/** - * Represents a sampled 3D texture binding type. - * - * @private - * @augments SampledTexture - */ -export class Sampled3DTexture extends SampledTexture { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampled3DTexture: boolean; -} -/** - * Represents a sampled cube texture binding type. - * - * @private - * @augments SampledTexture - */ -export class SampledCubeTexture extends SampledTexture { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampledCubeTexture: boolean; -} -import Sampler from './Sampler.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts deleted file mode 100644 index f79e15db7..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Sampler.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -export default Sampler; -/** - * Represents a sampler binding type. - * - * @private - * @augments Binding - */ -declare class Sampler extends Binding { - /** - * Constructs a new sampler. - * - * @param {string} name - The samplers's name. - * @param {?Texture} texture - The texture this binding is referring to. - */ - constructor(name: string, texture: Texture | null); - /** - * The texture the sampler is referring to. - * - * @private - * @type {?Texture} - */ - private _texture; - /** - * The binding's version. - * - * @type {number} - */ - version: number; - /** - * The binding's generation which is an additional version - * qualifier. - * - * @type {?number} - * @default null - */ - generation: number | null; - /** - * The binding's sampler key. - * - * @type {string} - * @default '' - */ - samplerKey: string; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampler: boolean; - /** - * Sets the texture of this sampler. - * - * @param {Texture} value - The texture to set. - */ - set texture(value: Texture); - /** - * Gets the texture of this sampler. - * @return {?Texture} The texture. - */ - get texture(): Texture | null; - /** - * Updates the binding. - * - * @return {boolean} Whether the texture has been updated and must be - * uploaded to the GPU. - */ - update(): boolean; - /** - * Resets the version and generation. This is used when the texture - * the binding is pointing to is disposed or exchanged. - */ - reset(): void; - /** - * Releases the texture reference. - */ - release(): void; -} -import Binding from './Binding.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts deleted file mode 100644 index bb60fe38a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Storage3DTexture.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -export default Storage3DTexture; -/** - * This special type of texture is intended for compute shaders. - * It can be used to compute the data of a texture with a compute shader. - * - * Note: This type of texture can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments Texture - */ -declare class Storage3DTexture extends Texture { - /** - * Constructs a new storage texture. - * - * @param {number} [width=1] - The storage texture's width. - * @param {number} [height=1] - The storage texture's height. - * @param {number} [depth=1] - The storage texture's depth. - */ - constructor(width?: number, height?: number, depth?: number); - isArrayTexture: boolean; - /** - * This defines how the texture is wrapped in the depth direction and corresponds to - * *W* in UVW mapping. - * - * @type {number} - */ - wrapR: number; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture: boolean; - /** - * Indicates whether this texture is a 3D texture. - * - * @type {boolean} - * - */ - is3DTexture: boolean; - /** - * Copies the values of the given texture to this instance. - * - * @param {Storage3DTexture} source - The texture to copy. - * @return {Storage3DTexture} A reference to this instance. - */ - copy(source: Storage3DTexture): Storage3DTexture; - /** - * Sets the size of the storage 3d texture. - * - * @param {number} width - The new width of the storage texture. - * @param {number} height - The new height of the storage texture. - * @param {number} depth - The new depth of the storage texture. - */ - setSize(width: number, height: number, depth: number): void; -} -import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts deleted file mode 100644 index 27581e2fc..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/StorageArrayTexture.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export default StorageArrayTexture; -/** - * This special type of texture is intended for compute shaders. - * It can be used to compute the data of a texture with a compute shader. - * - * Note: This type of texture can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments Texture - */ -declare class StorageArrayTexture extends Texture { - /** - * Constructs a new storage texture. - * - * @param {number} [width=1] - The storage texture's width. - * @param {number} [height=1] - The storage texture's height. - * @param {number} [depth=1] - The storage texture's depth. - */ - constructor(width?: number, height?: number, depth?: number); - isArrayTexture: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture: boolean; - /** - * Sets the size of the storage array texture. - * - * @param {number} width - The new width of the storage texture. - * @param {number} height - The new height of the storage texture. - * @param {number} depth - The new depth of the storage texture. - */ - setSize(width: number, height: number, depth: number): void; -} -import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts deleted file mode 100644 index d4de63398..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/StorageBuffer.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export default StorageBuffer; -/** - * Represents a storage buffer binding type. - * - * @private - * @augments Buffer - */ -declare class StorageBuffer extends Buffer { - /** - * Constructs a new uniform buffer. - * - * @param {string} name - The buffer's name. - * @param {BufferAttribute} attribute - The buffer attribute. - */ - constructor(name: string, attribute: BufferAttribute); - /** - * This flag can be used for type testing. - * - * @private - * @type {BufferAttribute} - */ - private _attribute; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageBuffer: boolean; - /** - * The storage buffer attribute. - * - * @type {BufferAttribute} - */ - get attribute(): BufferAttribute; -} -import Buffer from './Buffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts deleted file mode 100644 index d53cac3dc..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/StorageBufferAttribute.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default StorageBufferAttribute; -/** - * This special type of buffer attribute is intended for compute shaders. - * In earlier three.js versions it was only possible to update attribute data - * on the CPU via JavaScript and then upload the data to the GPU. With the - * new material system and renderer it is now possible to use compute shaders - * to compute the data for an attribute more efficiently on the GPU. - * - * The idea is to create an instance of this class and provide it as an input - * to {@link StorageBufferNode}. - * - * Note: This type of buffer attribute can only be used with `WebGPURenderer`. - * - * @augments BufferAttribute - */ -declare class StorageBufferAttribute extends BufferAttribute { - /** - * Constructs a new storage buffer attribute. - * - * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. - * The subsequent parameters are then obsolete. - * @param {number} itemSize - The item size. - * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. - */ - constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageBufferAttribute: boolean; -} -import { BufferAttribute } from '../../core/BufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts deleted file mode 100644 index 6f8614323..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/StorageInstancedBufferAttribute.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default StorageInstancedBufferAttribute; -/** - * This special type of instanced buffer attribute is intended for compute shaders. - * In earlier three.js versions it was only possible to update attribute data - * on the CPU via JavaScript and then upload the data to the GPU. With the - * new material system and renderer it is now possible to use compute shaders - * to compute the data for an attribute more efficiently on the GPU. - * - * The idea is to create an instance of this class and provide it as an input - * to {@link StorageBufferNode}. - * - * Note: This type of buffer attribute can only be used with `WebGPURenderer`. - * - * @augments InstancedBufferAttribute - */ -declare class StorageInstancedBufferAttribute extends InstancedBufferAttribute { - /** - * Constructs a new storage instanced buffer attribute. - * - * @param {number|TypedArray} count - The item count. It is also valid to pass a typed array as an argument. - * The subsequent parameters are then obsolete. - * @param {number} itemSize - The item size. - * @param {TypedArray.constructor} [typeClass=Float32Array] - A typed array constructor. - */ - constructor(count: number | TypedArray, itemSize: number, typeClass?: TypedArray.constructor); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageInstancedBufferAttribute: boolean; -} -import { InstancedBufferAttribute } from '../../core/InstancedBufferAttribute.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts deleted file mode 100644 index a369bd6e8..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/StorageTexture.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -export default StorageTexture; -/** - * This special type of texture is intended for compute shaders. - * It can be used to compute the data of a texture with a compute shader. - * - * Note: This type of texture can only be used with `WebGPURenderer` - * and a WebGPU backend. - * - * @augments Texture - */ -declare class StorageTexture extends Texture { - /** - * Constructs a new storage texture. - * - * @param {number} [width=1] - The storage texture's width. - * @param {number} [height=1] - The storage texture's height. - */ - constructor(width?: number, height?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isStorageTexture: boolean; - /** - * When `true`, mipmaps will be auto-generated after compute writes. - * When `false`, mipmaps must be written manually via compute shaders. - * - * @type {boolean} - * @default true - */ - mipmapsAutoUpdate: boolean; - /** - * Sets the size of the storage texture. - * - * @param {number} width - The new width of the storage texture. - * @param {number} height - The new height of the storage texture. - */ - setSize(width: number, height: number): void; -} -import { Texture } from '../../textures/Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts deleted file mode 100644 index 859bd9b24..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Textures.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -export default Textures; -/** - * This module manages the textures of the renderer. - * - * @private - * @augments DataMap - */ -declare class Textures extends DataMap { - /** - * Constructs a new texture management component. - * - * @param {Renderer} renderer - The renderer. - * @param {Backend} backend - The renderer's backend. - * @param {Info} info - Renderer component for managing metrics and monitoring data. - */ - constructor(renderer: Renderer, backend: Backend, info: Info); - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * The backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * Renderer component for managing metrics and monitoring data. - * - * @type {Info} - */ - info: Info; - /** - * A set of HTMLTextures that need paint updates. - * - * @type {Set} - */ - _htmlTextures: Set; - /** - * Updates the given render target. Based on the given render target configuration, - * it updates the texture states representing the attachments of the framebuffer. - * - * @param {RenderTarget} renderTarget - The render target to update. - * @param {number} [activeMipmapLevel=0] - The active mipmap level. - */ - updateRenderTarget(renderTarget: RenderTarget, activeMipmapLevel?: number): void; - /** - * Updates the given texture. Depending on the texture state, this method - * triggers the upload of texture data to the GPU memory. If the texture data are - * not yet ready for the upload, it uses default texture data for as a placeholder. - * - * @param {Texture} texture - The texture to update. - * @param {Object} [options={}] - The options. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Updates the sampler for the given texture. This method has no effect - * for the WebGL backend since it has no concept of samplers. Texture - * parameters are configured with the `texParameter()` command for each - * texture. - * - * In WebGPU, samplers are objects like textures and it's possible to share - * them when the texture parameters match. - * - * @param {Sampler} binding - The sampler binding to update. - * @return {string} The current sampler key. - */ - updateSampler(binding: Sampler): string; - /** - * Computes the size of the given texture and writes the result - * into the target vector. This vector is also returned by the - * method. - * - * If no texture data are available for the compute yet, the method - * returns default size values. - * - * @param {Texture} texture - The texture to compute the size for. - * @param {Vector3} target - The target vector. - * @return {Vector3} The target vector. - */ - getSize(texture: Texture, target?: Vector3): Vector3; - /** - * Computes the number of mipmap levels for the given texture. - * - * @param {Texture} texture - The texture. - * @param {number} width - The texture's width. - * @param {number} height - The texture's height. - * @return {number} The number of mipmap levels. - */ - getMipLevels(texture: Texture, width: number, height: number): number; - /** - * Returns `true` if the given texture makes use of mipmapping. - * - * @param {Texture} texture - The texture. - * @return {boolean} Whether mipmaps are required or not. - */ - needsMipmaps(texture: Texture): boolean; - /** - * Frees internal resources when the given render target isn't - * required anymore. - * - * @param {RenderTarget} renderTarget - The render target to destroy. - */ - _destroyRenderTarget(renderTarget: RenderTarget): void; - /** - * Frees internal resource when the given texture isn't - * required anymore. - * - * @param {Texture} texture - The texture to destroy. - */ - _destroyTexture(texture: Texture): void; -} -import DataMap from './DataMap.js'; -import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts deleted file mode 100644 index f18cad9f8..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/TimestampQueryPool.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -export default TimestampQueryPool; -/** - * Abstract base class of a timestamp query pool. - * - * @abstract - */ -declare class TimestampQueryPool { - /** - * Creates a new timestamp query pool. - * - * @param {number} [maxQueries=256] - Maximum number of queries this pool can hold. - */ - constructor(maxQueries?: number); - /** - * Whether to track timestamps or not. - * - * @type {boolean} - * @default true - */ - trackTimestamp: boolean; - /** - * Maximum number of queries this pool can hold. - * - * @type {number} - * @default 256 - */ - maxQueries: number; - /** - * How many queries allocated so far. - * - * @type {number} - * @default 0 - */ - currentQueryIndex: number; - /** - * Tracks offsets for different contexts. - * - * @type {Map} - */ - queryOffsets: Map; - /** - * Whether the pool has been disposed or not. - * - * @type {boolean} - * @default false - */ - isDisposed: boolean; - /** - * The total frame duration until the next update. - * - * @type {number} - * @default 0 - */ - lastValue: number; - /** - * Stores all timestamp frames. - * - * @type {Array} - */ - frames: Array; - /** - * This property is used to avoid multiple concurrent resolve operations. - * The WebGL backend uses it as a boolean flag. In context of WebGPU, it holds - * the promise of the current resolve operation. - * - * @type {boolean|Promise} - * @default false - */ - pendingResolve: boolean | Promise; - /** - * Stores the latest timestamp for each render context. - * - * @type {Map} - */ - timestamps: Map; - /** - * Returns all timestamp frames. - * - * @return {Array} The timestamp frames. - */ - getTimestampFrames(): Array; - /** - * Returns the timestamp for a given render context. - * - * @param {string} uid - A unique identifier for the render context. - * @return {?number} The timestamp, or undefined if not available. - */ - getTimestamp(uid: string): number | null; - /** - * Returns whether a timestamp is available for a given render context. - * - * @param {string} uid - A unique identifier for the render context. - * @return {boolean} True if a timestamp is available, false otherwise. - */ - hasTimestampQuery(uid: string): boolean; - /** - * Allocate queries for a specific uid. - * - * @abstract - * @param {string} uid - A unique identifier for the render context. - * @param {number} frameId - The current frame identifier. - * @returns {?number} - */ - allocateQueriesForContext(): number | null; - /** - * Resolve all timestamps and return data (or process them). - * - * @abstract - * @async - * @returns {Promise|number} The resolved timestamp value. - */ - resolveQueriesAsync(): Promise | number; - /** - * Dispose of the query pool. - * - * @abstract - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts deleted file mode 100644 index d8d107299..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/Uniform.d.ts +++ /dev/null @@ -1,260 +0,0 @@ -/** - * Represents a Number uniform. - * - * @private - * @augments Uniform - */ -export class NumberUniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {number} value - The uniform's value. - */ - constructor(name: string, value?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNumberUniform: boolean; -} -/** - * Represents a Vector2 uniform. - * - * @private - * @augments Uniform - */ -export class Vector2Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Vector2} value - The uniform's value. - */ - constructor(name: string, value?: Vector2); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVector2Uniform: boolean; -} -/** - * Represents a Vector3 uniform. - * - * @private - * @augments Uniform - */ -export class Vector3Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Vector3} value - The uniform's value. - */ - constructor(name: string, value?: Vector3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVector3Uniform: boolean; -} -/** - * Represents a Vector4 uniform. - * - * @private - * @augments Uniform - */ -export class Vector4Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Vector4} value - The uniform's value. - */ - constructor(name: string, value?: Vector4); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVector4Uniform: boolean; -} -/** - * Represents a Color uniform. - * - * @private - * @augments Uniform - */ -export class ColorUniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Color} value - The uniform's value. - */ - constructor(name: string, value?: Color); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isColorUniform: boolean; -} -/** - * Represents a Matrix2 uniform. - * - * @private - * @augments Uniform - */ -export class Matrix2Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Matrix2} value - The uniform's value. - */ - constructor(name: string, value?: Matrix2); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMatrix2Uniform: boolean; -} -/** - * Represents a Matrix3 uniform. - * - * @private - * @augments Uniform - */ -export class Matrix3Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Matrix3} value - The uniform's value. - */ - constructor(name: string, value?: Matrix3); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMatrix3Uniform: boolean; -} -/** - * Represents a Matrix4 uniform. - * - * @private - * @augments Uniform - */ -export class Matrix4Uniform extends Uniform { - /** - * Constructs a new Number uniform. - * - * @param {string} name - The uniform's name. - * @param {Matrix4} value - The uniform's value. - */ - constructor(name: string, value?: Matrix4); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isMatrix4Uniform: boolean; -} -/** - * Abstract base class for uniforms. - * - * @abstract - * @private - */ -declare class Uniform { - /** - * Constructs a new uniform. - * - * @param {string} name - The uniform's name. - * @param {any} value - The uniform's value. - */ - constructor(name: string, value: any); - /** - * The uniform's name. - * - * @type {string} - */ - name: string; - /** - * The uniform's value. - * - * @type {any} - */ - value: any; - /** - * Used to build the uniform buffer according to the STD140 layout. - * Derived uniforms will set this property to a data type specific - * value. - * - * @type {number} - */ - boundary: number; - /** - * The item size. Derived uniforms will set this property to a data - * type specific value. - * - * @type {number} - */ - itemSize: number; - /** - * This property is set by {@link UniformsGroup} and marks - * the start position in the uniform buffer. - * - * @type {number} - */ - offset: number; - /** - * This property is set by {@link UniformsGroup} and marks - * the index position in the uniform array. - * - * @type {number} - */ - index: number; - /** - * Sets the uniform's value. - * - * @param {any} value - The value to set. - */ - setValue(value: any): void; - /** - * Returns the uniform's value. - * - * @return {any} The value. - */ - getValue(): any; -} -import { Vector2 } from '../../math/Vector2.js'; -import { Vector3 } from '../../math/Vector3.js'; -import { Vector4 } from '../../math/Vector4.js'; -import { Color } from '../../math/Color.js'; -import { Matrix2 } from '../../math/Matrix2.js'; -import { Matrix3 } from '../../math/Matrix3.js'; -import { Matrix4 } from '../../math/Matrix4.js'; -export {}; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts deleted file mode 100644 index 15af25d88..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/UniformBuffer.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export default UniformBuffer; -/** - * Represents a uniform buffer binding type. - * - * @private - * @augments Buffer - */ -declare class UniformBuffer extends Buffer { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformBuffer: boolean; -} -import Buffer from './Buffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts deleted file mode 100644 index 8990101e7..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/UniformsGroup.d.ts +++ /dev/null @@ -1,147 +0,0 @@ -export default UniformsGroup; -/** - * This class represents a uniform buffer binding but with - * an API that allows to maintain individual uniform objects. - * - * @private - * @augments UniformBuffer - */ -declare class UniformsGroup extends UniformBuffer { - /** - * Constructs a new uniforms group. - * - * @param {string} name - The group's name. - */ - constructor(name: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isUniformsGroup: boolean; - /** - * An array with the raw uniform values. - * - * @private - * @type {?Array} - * @default null - */ - private _values; - /** - * An array of uniform objects. - * - * The order of uniforms in this array must match the order of uniforms in the shader. - * - * @type {Array} - */ - uniforms: Array; - /** - * A cache for the uniform update ranges. - * - * @private - * @type {Map} - */ - private _updateRangeCache; - /** - * Uniform indices whose range has already been pushed into `updateRanges` - * during the current update cycle. Reset on `clearUpdateRanges()`. - * - * @private - * @type {Set} - */ - private _addedIndices; - /** - * Adds a uniform's update range to this buffer. - * - * @param {Uniform} uniform - The uniform. - */ - addUniformUpdateRange(uniform: Uniform): void; - /** - * Adds a uniform to this group. - * - * @param {Uniform} uniform - The uniform to add. - * @return {UniformsGroup} A reference to this group. - */ - addUniform(uniform: Uniform): UniformsGroup; - /** - * Removes a uniform from this group. - * - * @param {Uniform} uniform - The uniform to remove. - * @return {UniformsGroup} A reference to this group. - */ - removeUniform(uniform: Uniform): UniformsGroup; - /** - * An array with the raw uniform values. - * - * @type {Array} - */ - get values(): Array; - /** - * Updates a given uniform by calling an update method matching - * the uniforms type. - * - * @param {Uniform} uniform - The uniform to update. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateByType(uniform: Uniform): boolean; - /** - * Updates a given Number uniform. - * - * @param {NumberUniform} uniform - The Number uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateNumber(uniform: NumberUniform): boolean; - /** - * Updates a given Vector2 uniform. - * - * @param {Vector2Uniform} uniform - The Vector2 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateVector2(uniform: Vector2Uniform): boolean; - /** - * Updates a given Vector3 uniform. - * - * @param {Vector3Uniform} uniform - The Vector3 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateVector3(uniform: Vector3Uniform): boolean; - /** - * Updates a given Vector4 uniform. - * - * @param {Vector4Uniform} uniform - The Vector4 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateVector4(uniform: Vector4Uniform): boolean; - /** - * Updates a given Color uniform. - * - * @param {ColorUniform} uniform - The Color uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateColor(uniform: ColorUniform): boolean; - /** - * Updates a given Matrix3 uniform. - * - * @param {Matrix3Uniform} uniform - The Matrix3 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateMatrix3(uniform: Matrix3Uniform): boolean; - /** - * Updates a given Matrix4 uniform. - * - * @param {Matrix4Uniform} uniform - The Matrix4 uniform. - * @return {boolean} Whether the uniform has been updated or not. - */ - updateMatrix4(uniform: Matrix4Uniform): boolean; - /** - * Returns a typed array that matches the given data type. - * - * @private - * @param {string} type - The data type. - * @return {TypedArray} The typed array. - */ - private _getBufferForType; -} -import UniformBuffer from './UniformBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts deleted file mode 100644 index 8babeb489..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/XRManager.d.ts +++ /dev/null @@ -1,602 +0,0 @@ -export default XRManager; -/** - * The XR manager is built on top of the WebXR Device API to - * manage XR sessions with renderer backends. - * - * @augments EventDispatcher - */ -declare class XRManager extends EventDispatcher { - /** - * Constructs a new XR manager. - * - * @param {Renderer} renderer - The renderer. - * @param {boolean} [multiview=false] - Enables multiview if the device supports it. - */ - constructor(renderer: Renderer, multiview?: boolean); - /** - * This flag globally enables XR rendering. - * - * @type {boolean} - * @default false - */ - enabled: boolean; - /** - * Whether the XR device is currently presenting or not. - * - * @type {boolean} - * @default false - * @readonly - */ - readonly isPresenting: boolean; - /** - * Whether the XR camera should automatically be updated or not. - * - * @type {boolean} - * @default true - */ - cameraAutoUpdate: boolean; - /** - * The renderer. - * - * @private - * @type {Renderer} - */ - private _renderer; - /** - * Represents the camera for the left eye. - * - * @private - * @type {PerspectiveCamera} - */ - private _cameraL; - /** - * Represents the camera for the right eye. - * - * @private - * @type {PerspectiveCamera} - */ - private _cameraR; - /** - * A list of cameras used for rendering the XR views. - * - * @private - * @type {Array} - */ - private _cameras; - /** - * The main XR camera. - * - * @private - * @type {ArrayCamera} - */ - private _cameraXR; - /** - * The current near value of the XR camera. - * - * @private - * @type {?number} - * @default null - */ - private _currentDepthNear; - /** - * The current far value of the XR camera. - * - * @private - * @type {?number} - * @default null - */ - private _currentDepthFar; - /** - * A list of WebXR controllers requested by the application. - * - * @private - * @type {Array} - */ - private _controllers; - /** - * A list of XR input source. Each input source belongs to - * an instance of WebXRController. - * - * @private - * @type {Array} - */ - private _controllerInputSources; - /** - * The XR render target that represents the rendering destination - * during an active XR session. - * - * @private - * @type {?RenderTarget} - * @default null - */ - private _xrRenderTarget; - /** - * An array holding all the non-projection layers - * - * @private - * @type {Array} - * @default [] - */ - private _layers; - /** - * Whether the XR session uses layers. - * - * @private - * @type {boolean} - * @default false - */ - private _sessionUsesLayers; - /** - * Whether the device supports binding gl objects. - * - * @private - * @type {boolean} - * @readonly - */ - private readonly _supportsGlBinding; - _supportsWebGPUBinding: boolean; - /** - * Helper function to create native WebXR Layer. - * - * @private - * @type {Function} - */ - private _createXRLayer; - /** - * The current WebGL context. - * - * @private - * @type {?WebGL2RenderingContext} - * @default null - */ - private _gl; - /** - * The current animation context. - * - * @private - * @type {?Window} - * @default null - */ - private _currentAnimationContext; - /** - * The current animation loop. - * - * @private - * @type {?Function} - * @default null - */ - private _currentAnimationLoop; - /** - * The current pixel ratio. - * - * @private - * @type {?number} - * @default null - */ - private _currentPixelRatio; - /** - * The current size of the renderer's canvas - * in logical pixel unit. - * - * @private - * @type {Vector2} - */ - private _currentSize; - /** - * Holds a reference to the user camera and its current settings. - * - * @private - * @type {?Object} - * @default null - */ - private _currentCameraSettings; - /** - * The default event listener for handling events inside a XR session. - * - * @private - * @type {Function} - */ - private _onSessionEvent; - /** - * The event listener for handling the end of a XR session. - * - * @private - * @type {Function} - */ - private _onSessionEnd; - /** - * The event listener for handling the `inputsourceschange` event. - * - * @private - * @type {Function} - */ - private _onInputSourcesChange; - /** - * The animation loop which is used as a replacement for the default - * animation loop of the application. It is only used when a XR session - * is active. - * - * @private - * @type {Function} - */ - private _onAnimationFrame; - /** - * The current XR reference space. - * - * @private - * @type {?XRReferenceSpace} - * @default null - */ - private _referenceSpace; - /** - * The current XR reference space type. - * - * @private - * @type {XRReferenceSpaceType} - * @default 'local-floor' - */ - private _referenceSpaceType; - /** - * A custom reference space defined by the application. - * - * @private - * @type {?XRReferenceSpace} - * @default null - */ - private _customReferenceSpace; - /** - * The framebuffer scale factor. - * - * @private - * @type {number} - * @default 1 - */ - private _framebufferScaleFactor; - /** - * The foveation factor. - * - * @private - * @type {number} - * @default 1 - */ - private _foveation; - /** - * A reference to the current XR session. - * - * @private - * @type {?XRSession} - * @default null - */ - private _session; - /** - * A reference to the current XR base layer. - * - * @private - * @type {?XRWebGLLayer} - * @default null - */ - private _glBaseLayer; - /** - * A reference to the current XR binding. - * - * @private - * @type {?XRWebGLBinding} - * @default null - */ - private _glBinding; - /** - * A reference to the current XR WebGPU binding. - * - * @private - * @type {?XRGPUBinding} - * @default null - */ - private _webgpuBinding; - /** - * A reference to the current XR projection layer. - * - * @private - * @type {?XRProjectionLayer} - * @default null - */ - private _glProjLayer; - /** - * A reference to the current XR frame. - * - * @private - * @type {?XRFrame} - * @default null - */ - private _xrFrame; - /** - * Whether the browser supports the APIs necessary to use XRProjectionLayers. - * - * Note: this does not represent XRSession explicitly requesting - * `'layers'` as a feature - see `_sessionUsesLayers` and #30112 - * - * @private - * @type {boolean} - * @readonly - */ - private readonly _supportsLayers; - /** - * Whether the usage of multiview has been requested by the application or not. - * - * @private - * @type {boolean} - * @default false - * @readonly - */ - private readonly _useMultiviewIfPossible; - /** - * Whether the usage of multiview is actually enabled. This flag only evaluates to `true` - * if multiview has been requested by the application and the `OVR_multiview2` is available. - * - * @private - * @type {boolean} - * @readonly - */ - private readonly _useMultiview; - /** - * Returns an instance of `THREE.Group` that represents the transformation - * of a XR controller in target ray space. The requested controller is defined - * by the given index. - * - * @param {number} index - The index of the XR controller. - * @return {Group} A group that represents the controller's transformation. - */ - getController(index: number): Group; - /** - * Returns an instance of `THREE.Group` that represents the transformation - * of a XR controller in grip space. The requested controller is defined - * by the given index. - * - * @param {number} index - The index of the XR controller. - * @return {Group} A group that represents the controller's transformation. - */ - getControllerGrip(index: number): Group; - /** - * Returns an instance of `THREE.Group` that represents the transformation - * of a XR controller in hand space. The requested controller is defined - * by the given index. - * - * @param {number} index - The index of the XR controller. - * @return {Group} A group that represents the controller's transformation. - */ - getHand(index: number): Group; - /** - * Returns the foveation value. - * - * @return {number|undefined} The foveation value. - */ - getFoveation(): number | undefined; - /** - * Sets the foveation value. - * - * @param {number} foveation - A number in the range `[0,1]` where `0` means no foveation (full resolution) - * and `1` means maximum foveation (the edges render at lower resolution). - */ - setFoveation(foveation: number): void; - /** - * Returns the framebuffer scale factor. - * - * @return {number} The framebuffer scale factor. - */ - getFramebufferScaleFactor(): number; - /** - * Sets the framebuffer scale factor. - * - * This method can not be used during a XR session. - * - * @param {number} factor - The framebuffer scale factor. - */ - setFramebufferScaleFactor(factor: number): void; - /** - * Returns the reference space type. - * - * @return {XRReferenceSpaceType} The reference space type. - */ - getReferenceSpaceType(): XRReferenceSpaceType; - /** - * Sets the reference space type. - * - * This method can not be used during a XR session. - * - * @param {XRReferenceSpaceType} type - The reference space type. - */ - setReferenceSpaceType(type: XRReferenceSpaceType): void; - /** - * Returns the XR reference space. - * - * @return {XRReferenceSpace} The XR reference space. - */ - getReferenceSpace(): XRReferenceSpace; - /** - * Sets a custom XR reference space. - * - * @param {XRReferenceSpace} space - The XR reference space. - */ - setReferenceSpace(space: XRReferenceSpace): void; - /** - * Returns the XR camera. - * - * @return {ArrayCamera} The XR camera. - */ - getCamera(): ArrayCamera; - /** - * Returns the environment blend mode from the current XR session. - * - * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. - */ - getEnvironmentBlendMode(): "opaque" | "additive" | "alpha-blend" | undefined; - /** - * Returns the current base layer. - * - * This is an `XRProjectionLayer` when the targeted XR device supports the - * WebXR Layers API, or an `XRWebGLLayer` otherwise. - * - * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. - */ - getBaseLayer(): (XRWebGLLayer | XRProjectionLayer) | null; - /** - * Returns the current XR binding. - * - * Creates a new binding if needed and the browser is - * capable of doing so. - * - * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. - */ - getBinding(): XRWebGLBinding | null; - /** - * Applies WebXR fixed foveation to the internal post-processing render target - * used by the first XR render pass before compositing into a projection layer. - * - * Browser-side `XRWebGLBinding.foveateBoundTexture()` failures are treated as - * non-fatal so they do not interrupt rendering. - * - * @param {?RenderTarget} renderTarget - The internal render target. - */ - foveateBoundTexture(renderTarget: RenderTarget | null): void; - /** - * Returns the current XR WebGPU binding. - * - * Creates a new binding if needed and the browser is - * capable of doing so. - * - * @return {?XRGPUBinding} The XR WebGPU binding. Returns `null` if one cannot be created. - */ - getWebGPUBinding(): XRGPUBinding | null; - /** - * Returns whether the current XR session is using WebGPU. - * - * @private - * @return {boolean} Whether the current session uses the WebGPU backend and the `webgpu` session feature. - */ - private _isWebGPUSession; - /** - * Validates the current WebGPU XR session requirements. - * - * @private - */ - private _validateWebGPUSession; - /** - * Initializes the WebGPU XR projection layer and render target. - * - * @private - * @async - * @param {XRSession} session - The XR session. - * @return {Promise} - */ - private _initWebGPUSession; - /** - * Releases WebGPU XR resources associated with the current session. - * - * @private - */ - private _disposeWebGPUSession; - /** - * Collects WebGPU XR sub-image data for the current frame. - * - * @private - * @param {Array} views - The XR views for the current pose. - * @return {{colorTexture:?GPUTexture, viewDescriptors:Array, viewports:Array}} The WebGPU XR view data. - */ - private _getWebGPUViewData; - /** - * Returns the current XR frame. - * - * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. - */ - getFrame(): XRFrame | null; - /** - * Returns `true` if the engine renders to a multiview target. - * - * @return {boolean} Whether the engine renders to a multiview render target or not. - */ - useMultiview(): boolean; - /** - * This method can be used in XR applications to create a quadratic layer that presents a separate - * rendered scene. - * - * @param {number} width - The width of the layer plane in world units. - * @param {number} height - The height of the layer plane in world units. - * @param {Vector3} translation - The position/translation of the layer plane in world units. - * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. - * @param {number} pixelwidth - The width of the layer's render target in pixels. - * @param {number} pixelheight - The height of the layer's render target in pixels. - * @param {Function} rendercall - A callback function that renders the layer. Similar to code in - * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. - * @param {Object} [attributes={}] - Allows to configure the layer's render target. - * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. - * @return {Mesh} A mesh representing the quadratic XR layer. This mesh should be added to the XR scene. - */ - createQuadLayer(width: number, height: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { - samples?: number | undefined; - }): Mesh; - /** - * This method can be used in XR applications to create a cylindrical layer that presents a separate - * rendered scene. - * - * @param {number} radius - The radius of the cylinder in world units. - * @param {number} centralAngle - The central angle of the cylinder in radians. - * @param {number} aspectratio - The aspect ratio. - * @param {Vector3} translation - The position/translation of the layer plane in world units. - * @param {Quaternion} quaternion - The orientation of the layer plane expressed as a quaternion. - * @param {number} pixelwidth - The width of the layer's render target in pixels. - * @param {number} pixelheight - The height of the layer's render target in pixels. - * @param {Function} rendercall - A callback function that renders the layer. Similar to code in - * the default animation loop, this method can be used to update/transform 3D object in the layer's scene. - * @param {Object} [attributes={}] - Allows to configure the layer's render target. - * @param {number} [attributes.samples] - The scene MSAA sample count. Defaults to the renderer's sample count. - * @return {Mesh} A mesh representing the cylindrical XR layer. This mesh should be added to the XR scene. - */ - createCylinderLayer(radius: number, centralAngle: number, aspectratio: number, translation: Vector3, quaternion: Quaternion, pixelwidth: number, pixelheight: number, rendercall: Function, attributes?: { - samples?: number | undefined; - }): Mesh; - /** - * Renders the XR layers that have been previously added to the scene. - * - * This method is usually called in your animation loop before rendering - * the actual scene via `renderer.render( scene, camera );`. - */ - renderLayers(): void; - /** - * Returns the current XR session. - * - * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. - */ - getSession(): XRSession | null; - /** - * After a XR session has been requested usually with one of the `*Button` modules, it - * is injected into the renderer with this method. This method triggers the start of - * the actual XR rendering. - * - * @async - * @param {XRSession} session - The XR session to set. - * @return {Promise} A Promise that resolves when the session has been set. - */ - setSession(session: XRSession): Promise; - /** - * This method is called by the renderer per frame and updates the XR camera - * and it sub cameras based on the given camera. The given camera is the "user" - * camera created on application level and used for non-XR rendering. - * - * @param {PerspectiveCamera} camera - The camera. - */ - updateCamera(camera: PerspectiveCamera): void; - /** - * Returns a WebXR controller for the given controller index. - * - * @private - * @param {number} index - The controller index. - * @return {WebXRController} The XR controller. - */ - private _getController; -} -import { EventDispatcher } from '../../core/EventDispatcher.js'; -import { ArrayCamera } from '../../cameras/ArrayCamera.js'; -import { RenderTarget } from '../../core/RenderTarget.js'; -import { Vector3 } from '../../math/Vector3.js'; -import { Quaternion } from '../../math/Quaternion.js'; -import { Mesh } from '../../objects/Mesh.js'; -import { PerspectiveCamera } from '../../cameras/PerspectiveCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts deleted file mode 100644 index e397d7c26..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/XRRenderTarget.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * A special type of render target that is used when rendering - * with the WebXR Device API. - * - * @private - * @augments RenderTarget - */ -export class XRRenderTarget extends RenderTarget { - /** - * Constructs a new XR render target. - * - * @param {number} [width=1] - The width of the render target. - * @param {number} [height=1] - The height of the render target. - * @param {Object} [options={}] - The configuration options. - */ - constructor(width?: number, height?: number, options?: Object); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isXRRenderTarget: boolean; - /** - * Whether the attachments of the render target - * are defined by external textures. This flag is - * set to `true` when using the WebXR Layers API. - * - * @private - * @type {boolean} - * @default false - */ - private _hasExternalTextures; - /** - * Whether a depth buffer should automatically be allocated - * for this XR render target or not. - * - * Allocating a depth buffer is the default behavior of XR render - * targets. However, when using the WebXR Layers API, this flag - * must be set to `false` when the `ignoreDepthValues` property of - * the projection layers evaluates to `false`. - * - * Reference: {@link https://www.w3.org/TR/webxrlayers-1/#dom-xrprojectionlayer-ignoredepthvalues}. - * - * @private - * @type {boolean} - * @default true - */ - private _autoAllocateDepthBuffer; - /** - * Whether this render target is associated with a XRWebGLLayer. - * - * A XRWebGLLayer points to an opaque framebuffer. Basically, - * this means that you don't have access to its bound color, - * stencil and depth buffers. We need to handle this framebuffer - * differently since its textures are always bound. - * - * @private - * @type {boolean} - * @default false - * */ - private _isOpaqueFramebuffer; - copy(source: any): this; -} -import { RenderTarget } from '../../core/RenderTarget.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts deleted file mode 100644 index 4a90f691c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/extras/PMREMGenerator.d.ts +++ /dev/null @@ -1,194 +0,0 @@ -export default PMREMGenerator; -/** - * This class generates a Prefiltered, Mipmapped Radiance Environment Map - * (PMREM) from a cubeMap environment texture. This allows different levels of - * blur to be quickly accessed based on material roughness. It is packed into a - * special CubeUV format that allows us to perform custom interpolation so that - * we can support nonlinear formats such as RGBE. Unlike a traditional mipmap - * chain, it only goes down to the LOD_MIN level (above), and then creates extra - * even more filtered 'mips' at the same LOD_MIN resolution, associated with - * higher roughness levels. In this way we maintain resolution to smoothly - * interpolate diffuse lighting while limiting sampling computation. - * - * The prefiltering uses GGX VNDF (Visible Normal Distribution Function) - * importance sampling based on "Sampling the GGX Distribution of Visible Normals" - * (Heitz, 2018) to generate environment maps that accurately match the GGX BRDF - * used in material rendering for physically-based image-based lighting. - */ -declare class PMREMGenerator { - /** - * Constructs a new PMREM generator. - * - * @param {Renderer} renderer - The renderer. - */ - constructor(renderer: Renderer); - _renderer: Renderer; - _pingPongRenderTarget: RenderTarget | null; - _lodMax: number; - _cubeSize: number; - _sizeLods: any[]; - _lodMeshes: any[]; - _blurMaterial: NodeMaterial | null; - _ggxMaterial: NodeMaterial | null; - _cubemapMaterial: NodeMaterial | null; - _equirectMaterial: NodeMaterial | null; - _backgroundBox: Mesh | null; - get _hasInitialized(): any; - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety. - * - * @param {Scene} scene - The scene to be captured. - * @param {number} [sigma=0] - The blur radius in radians. - * @param {number} [near=0.1] - The near plane distance. - * @param {number} [far=100] - The far plane distance. - * @param {Object} [options={}] - The configuration options. - * @param {number} [options.size=256] - The texture size of the PMREM. - * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. - * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. - * @return {RenderTarget} The resulting PMREM. - * @see {@link PMREMGenerator#fromScene} - */ - fromScene(scene: Scene, sigma?: number, near?: number, far?: number, options?: { - size?: number | undefined; - position?: Vector3 | undefined; - renderTarget?: RenderTarget | null | undefined; - }): RenderTarget; - /** - * Generates a PMREM from a supplied Scene, which can be faster than using an - * image if networking bandwidth is low. Optional sigma specifies a blur radius - * in radians to be applied to the scene before PMREM generation. Optional near - * and far planes ensure the scene is rendered in its entirety (the cubeCamera - * is placed at the origin). - * - * @deprecated - * @param {Scene} scene - The scene to be captured. - * @param {number} [sigma=0] - The blur radius in radians. - * @param {number} [near=0.1] - The near plane distance. - * @param {number} [far=100] - The far plane distance. - * @param {Object} [options={}] - The configuration options. - * @param {number} [options.size=256] - The texture size of the PMREM. - * @param {Vector3} [options.position=origin] - The position of the internal cube camera that renders the scene. - * @param {?RenderTarget} [options.renderTarget=null] - The render target to use. - * @return {Promise} A Promise that resolve with the PMREM when the generation has been finished. - * @see {@link PMREMGenerator#fromScene} - */ - fromSceneAsync(scene: Scene, sigma?: number, near?: number, far?: number, options?: { - size?: number | undefined; - position?: Vector3 | undefined; - renderTarget?: RenderTarget | null | undefined; - }): Promise; - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), as this matches best - * with the 256 x 256 cubemap output. The minimum supported input image size - * is 64 x 32. - * - * @param {Texture} equirectangular - The equirectangular texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {RenderTarget} The resulting PMREM. - * @see {@link PMREMGenerator#fromEquirectangularAsync} - */ - fromEquirectangular(equirectangular: Texture, renderTarget?: RenderTarget | null): RenderTarget; - /** - * Generates a PMREM from an equirectangular texture, which can be either LDR - * or HDR. The ideal input image size is 1k (1024 x 512), - * as this matches best with the 256 x 256 cubemap output. - * - * @deprecated - * @param {Texture} equirectangular - The equirectangular texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {Promise} The resulting PMREM. - * @see {@link PMREMGenerator#fromEquirectangular} - */ - fromEquirectangularAsync(equirectangular: Texture, renderTarget?: RenderTarget | null): Promise; - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, as this matches best - * with the 256 x 256 cubemap output. The minimum supported input cube - * size is 16 x 16 per face. - * - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {RenderTarget} The resulting PMREM. - * @see {@link PMREMGenerator#fromCubemapAsync} - */ - fromCubemap(cubemap: Texture, renderTarget?: RenderTarget | null): RenderTarget; - /** - * Generates a PMREM from an cubemap texture, which can be either LDR - * or HDR. The ideal input cube size is 256 x 256, - * with the 256 x 256 cubemap output. - * - * @deprecated - * @param {Texture} cubemap - The cubemap texture to be converted. - * @param {?RenderTarget} [renderTarget=null] - The render target to use. - * @return {Promise} The resulting PMREM. - * @see {@link PMREMGenerator#fromCubemap} - */ - fromCubemapAsync(cubemap: Texture, renderTarget?: RenderTarget | null): Promise; - /** - * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - * - * @returns {Promise} - */ - compileCubemapShader(): Promise; - /** - * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during - * your texture's network fetch for increased concurrency. - * - * @returns {Promise} - */ - compileEquirectangularShader(): Promise; - /** - * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, - * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on - * one of them will cause any others to also become unusable. - */ - dispose(): void; - _setSizeFromTexture(texture: any): void; - _setSize(cubeSize: any): void; - _dispose(): void; - _cleanup(outputTarget: any): void; - _fromTexture(texture: any, renderTarget: any): any; - _allocateTarget(depthBuffer: any): RenderTarget; - _init(renderTarget: any): void; - _compileMaterial(material: any): Promise; - _sceneToCubeUV(scene: any, near: any, far: any, cubeUVRenderTarget: any, position: any): void; - _textureToCubeUV(texture: any, cubeUVRenderTarget: any): void; - _applyPMREM(cubeUVRenderTarget: any): void; - /** - * Applies GGX VNDF importance sampling filter to generate a prefiltered environment map. - * Uses Monte Carlo integration with VNDF importance sampling to accurately represent the - * GGX BRDF for physically-based rendering. Reads from the previous LOD level and - * applies incremental roughness filtering to avoid over-blurring. - * - * @private - * @param {RenderTarget} cubeUVRenderTarget - * @param {number} lodIn - Source LOD level to read from - * @param {number} lodOut - Target LOD level to write to - */ - private _applyGGXFilter; - /** - * This is a two-pass Gaussian blur for a cubemap. Each pass importance-samples - * the Gaussian along a spiral kernel (Golden Angle), which distributes samples - * isotropically on the sphere (no pole artifacts). - * - * Used for initial scene blur in fromScene() method when sigma > 0. - * - * @private - * @param {RenderTarget} cubeUVRenderTarget - The cubemap render target. - * @param {number} lodIn - The input level-of-detail. - * @param {number} lodOut - The output level-of-detail. - * @param {number} sigma - The blur radius in radians. - */ - private _blur; - _blurPass(targetIn: any, targetOut: any, lodIn: any, lodOut: any, sigmaRadians: any): void; - _setViewport(target: any, x: any, y: any, width: any, height: any): void; -} -import { RenderTarget } from '../../../core/RenderTarget.js'; -import NodeMaterial from '../../../materials/nodes/NodeMaterial.js'; -import { Mesh } from '../../../objects/Mesh.js'; -import { Vector3 } from '../../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts deleted file mode 100644 index af3e23934..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeBuilderState.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -export default NodeBuilderState; -/** - * This module represents the state of a node builder after it was - * used to build the nodes for a render object. The state holds the - * results of the build for further processing in the renderer. - * - * Render objects with identical cache keys share the same node builder state. - * - * @private - */ -declare class NodeBuilderState { - /** - * Constructs a new node builder state. - * - * @param {string} vertexShader - The native vertex shader code. - * @param {string} fragmentShader - The native fragment shader code. - * @param {string} computeShader - The native compute shader code. - * @param {Array} nodeAttributes - An array of node attributes. - * @param {Array} bindings - An array of bind groups. - * @param {Array} updateNodes - An array of nodes that implement their `update()` method. - * @param {Array} updateBeforeNodes - An array of nodes that implement their `updateBefore()` method. - * @param {Array} updateAfterNodes - An array of nodes that implement their `updateAfter()` method. - * @param {NodeMaterialObserver} observer - A node material observer. - * @param {boolean} hardwareClipping - Whether the built material uses hardware clipping or not. - * @param {Array} transforms - An array with transform attribute objects. Only relevant when using compute shaders with WebGL 2. - */ - constructor(vertexShader: string, fragmentShader: string, computeShader: string, nodeAttributes: Array, bindings: Array, updateNodes: Array, updateBeforeNodes: Array, updateAfterNodes: Array, observer: NodeMaterialObserver, hardwareClipping: boolean, transforms?: Array); - /** - * The native vertex shader code. - * - * @type {string} - */ - vertexShader: string; - /** - * The native fragment shader code. - * - * @type {string} - */ - fragmentShader: string; - /** - * The native compute shader code. - * - * @type {string} - */ - computeShader: string; - /** - * An array with transform attribute objects. - * Only relevant when using compute shaders with WebGL 2. - * - * @type {Array} - */ - transforms: Array; - /** - * An array of node attributes representing - * the attributes of the shaders. - * - * @type {Array} - */ - nodeAttributes: Array; - /** - * An array of bind groups representing the uniform or storage - * buffers, texture or samplers of the shader. - * - * @type {Array} - */ - bindings: Array; - /** - * An array of nodes that implement their `update()` method. - * - * @type {Array} - */ - updateNodes: Array; - /** - * An array of nodes that implement their `updateBefore()` method. - * - * @type {Array} - */ - updateBeforeNodes: Array; - /** - * An array of nodes that implement their `updateAfter()` method. - * - * @type {Array} - */ - updateAfterNodes: Array; - /** - * A node material observer. - * - * @type {NodeMaterialObserver} - */ - observer: NodeMaterialObserver; - /** - * Whether the built material uses hardware clipping or not. - * - * @type {boolean} - */ - hardwareClipping: boolean; - /** - * How often this state is used by render objects. - * - * @type {number} - */ - usedTimes: number; - /** - * This method is used to create a array of bind groups based - * on the existing bind groups of this state. Shared groups are - * not cloned. - * - * @return {Array} A array of bind groups. - */ - createBindings(): Array; -} -import BindGroup from '../BindGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts deleted file mode 100644 index 0121dd34b..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeLibrary.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -export default NodeLibrary; -/** - * The purpose of a node library is to assign node implementations - * to existing library features. In `WebGPURenderer` lights, materials - * which are not based on `NodeMaterial` as well as tone mapping techniques - * are implemented with node-based modules. - * - * @private - */ -declare class NodeLibrary { - /** - * A weak map that maps lights to light nodes. - * - * @type {WeakMap} - */ - lightNodes: WeakMap; - /** - * A map that maps materials to node materials. - * - * @type {Map} - */ - materialNodes: Map; - /** - * A map that maps tone mapping techniques (constants) - * to tone mapping node functions. - * - * @type {Map} - */ - toneMappingNodes: Map; - /** - * Returns a matching node material instance for the given material object. - * - * This method also assigns/copies the properties of the given material object - * to the node material. This is done to make sure the current material - * configuration carries over to the node version. - * - * @param {Material} material - A material. - * @return {NodeMaterial} The corresponding node material. - */ - fromMaterial(material: Material): NodeMaterial; - /** - * Adds a tone mapping node function for a tone mapping technique (constant). - * - * @param {Function} toneMappingNode - The tone mapping node function. - * @param {number} toneMapping - The tone mapping. - */ - addToneMapping(toneMappingNode: Function, toneMapping: number): void; - /** - * Returns a tone mapping node function for a tone mapping technique (constant). - * - * @param {number} toneMapping - The tone mapping. - * @return {?Function} The tone mapping node function. Returns `null` if no node function is found. - */ - getToneMappingFunction(toneMapping: number): Function | null; - /** - * Returns a node material class definition for a material type. - * - * @param {string} materialType - The material type. - * @return {?NodeMaterial.constructor} The node material class definition. Returns `null` if no node material is found. - */ - getMaterialNodeClass(materialType: string): NodeMaterial.constructor | null; - /** - * Adds a node material class definition for a given material type. - * - * @param {NodeMaterial.constructor} materialNodeClass - The node material class definition. - * @param {string} materialClassType - The material type. - */ - addMaterial(materialNodeClass: NodeMaterial.constructor, materialClassType: string): void; - /** - * Returns a light node class definition for a light class definition. - * - * @param {Light.constructor} light - The light class definition. - * @return {?AnalyticLightNode.constructor} The light node class definition. Returns `null` if no light node is found. - */ - getLightNodeClass(light: Light.constructor): AnalyticLightNode.constructor | null; - /** - * Adds a light node class definition for a given light class definition. - * - * @param {AnalyticLightNode.constructor} lightNodeClass - The light node class definition. - * @param {Light.constructor} lightClass - The light class definition. - */ - addLight(lightNodeClass: AnalyticLightNode.constructor, lightClass: Light.constructor): void; - /** - * Adds a node class definition for the given type to the provided type library. - * - * @param {Node.constructor} nodeClass - The node class definition. - * @param {number|string} type - The object type. - * @param {Map} library - The type library. - */ - addType(nodeClass: Node.constructor, type: number | string, library: Map): void; - /** - * Adds a node class definition for the given class definition to the provided type library. - * - * @param {Node.constructor} nodeClass - The node class definition. - * @param {Node.constructor} baseClass - The class definition. - * @param {WeakMap} library - The type library. - */ - addClass(nodeClass: Node.constructor, baseClass: Node.constructor, library: WeakMap): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts deleted file mode 100644 index 64db1c627..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeManager.d.ts +++ /dev/null @@ -1,296 +0,0 @@ -export default NodeManager; -/** - * This renderer module manages node-related objects and is the - * primary interface between the renderer and the node system. - * - * @private - * @augments DataMap - */ -declare class NodeManager extends DataMap { - /** - * Constructs a new nodes management component. - * - * @param {Renderer} renderer - The renderer. - * @param {Backend} backend - The renderer's backend. - */ - constructor(renderer: Renderer, backend: Backend); - /** - * The renderer. - * - * @type {Renderer} - */ - renderer: Renderer; - /** - * The renderer's backend. - * - * @type {Backend} - */ - backend: Backend; - /** - * The node frame. - * - * @type {Renderer} - */ - nodeFrame: Renderer; - /** - * A cache for managing node builder states. - * - * @type {Map} - */ - nodeBuilderCache: Map; - /** - * A cache for managing data cache key data. - * - * @type {ChainMap} - */ - callHashCache: ChainMap; - /** - * A cache for managing node uniforms group data. - * - * @type {ChainMap} - */ - groupsData: ChainMap; - /** - * Queue for pending async builds to limit concurrent compilation. - * - * @private - * @type {Array} - */ - private _buildQueue; - /** - * Whether an async build is currently in progress. - * - * @private - * @type {boolean} - */ - private _buildInProgress; - /** - * A cache for managing node objects of - * scene properties like fog or environments. - * - * @type {Object} - */ - cacheLib: { - [x: string]: WeakMap; - }; - /** - * Returns `true` if the given node uniforms group must be updated or not. - * - * @param {NodeUniformsGroup} nodeUniformsGroup - The node uniforms group. - * @return {boolean} Whether the node uniforms group requires an update or not. - */ - updateGroup(nodeUniformsGroup: NodeUniformsGroup): boolean; - /** - * Returns the cache key for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {number} The cache key. - */ - getForRenderCacheKey(renderObject: RenderObject): number; - /** - * Creates a node builder configured for the given render object and material. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {Material} material - The material to use. - * @return {NodeBuilder} The configured node builder. - */ - private _createNodeBuilder; - /** - * Returns a node builder state for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {boolean} [useAsync=false] - Whether to use async build with yielding. - * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). - */ - getForRender(renderObject: RenderObject, useAsync?: boolean): NodeBuilderState | Promise; - /** - * Async version of getForRender() that yields to main thread during build. - * Use this in compileAsync() to prevent blocking the main thread. - * - * @param {RenderObject} renderObject - The render object. - * @return {Promise} A promise that resolves to the node builder state. - */ - getForRenderAsync(renderObject: RenderObject): Promise; - /** - * Returns nodeBuilderState if ready, null if pending async build. - * Queues async build on first call for cache miss. - * Use this in render() path to enable non-blocking compilation. - * - * @param {RenderObject} renderObject - The render object. - * @return {?NodeBuilderState} The node builder state, or null if still building. - */ - getForRenderDeferred(renderObject: RenderObject): NodeBuilderState | null; - /** - * Processes the build queue one item at a time. - * This ensures builds don't all run simultaneously and freeze the main thread. - * - * @private - */ - private _processBuildQueue; - /** - * Deletes the given object from the internal data map - * - * @param {any} object - The object to delete. - * @return {?Object} The deleted dictionary. - */ - delete(object: any): Object | null; - /** - * Returns a node builder state for the given compute node. - * - * @param {Node} computeNode - The compute node. - * @param {boolean} [useAsync=false] - Whether to use async build with yielding. - * @return {NodeBuilderState|Promise} The node builder state (or Promise if async). - */ - getForCompute(computeNode: Node, useAsync?: boolean): NodeBuilderState | Promise; - /** - * Async version of getForCompute() that yields to main thread during build. - * Use this in compileComputeAsync() to prevent blocking the main thread. - * - * @param {Node} computeNode - The compute node. - * @return {Promise} A promise that resolves to the node builder state. - */ - getForComputeAsync(computeNode: Node): Promise; - /** - * Creates a node builder state for the given node builder. - * - * @private - * @param {NodeBuilder} nodeBuilder - The node builder. - * @return {NodeBuilderState} The node builder state. - */ - private _createNodeBuilderState; - /** - * Returns an environment node for the current configured - * scene environment. - * - * @param {Scene} scene - The scene. - * @return {Node} A node representing the current scene environment. - */ - getEnvironmentNode(scene: Scene): Node; - /** - * Returns a background node for the current configured - * scene background. - * - * @param {Scene} scene - The scene. - * @return {Node} A node representing the current scene background. - */ - getBackgroundNode(scene: Scene): Node; - /** - * Returns a fog node for the current configured scene fog. - * - * @param {Scene} scene - The scene. - * @return {Node} A node representing the current scene fog. - */ - getFogNode(scene: Scene): Node; - /** - * Returns a cache key for the given scene and lights node. - * This key is used by `RenderObject` as a part of the dynamic - * cache key (a key that must be checked every time the render - * objects is drawn). - * - * @param {Scene} scene - The scene. - * @param {LightsNode} lightsNode - The lights node. - * @return {number} The cache key. - */ - getCacheKey(scene: Scene, lightsNode: LightsNode): number; - /** - * A boolean that indicates whether tone mapping should be enabled - * or not. - * - * @type {boolean} - */ - get isToneMappingState(): boolean; - /** - * If a scene background is configured, this method makes sure to - * represent the background with a corresponding node-based implementation. - * - * @param {Scene} scene - The scene. - */ - updateBackground(scene: Scene): void; - /** - * This method is part of the caching of nodes which are used to represents the - * scene's background, fog or environment. - * - * @param {string} type - The type of object to cache. - * @param {Object} object - The object. - * @param {Function} callback - A callback that produces a node representation for the given object. - * @param {boolean} [forceUpdate=false] - Whether an update should be enforced or not. - * @return {Node} The node representation. - */ - getCacheNode(type: string, object: Object, callback: Function, forceUpdate?: boolean): Node; - /** - * If a scene fog is configured, this method makes sure to - * represent the fog with a corresponding node-based implementation. - * - * @param {Scene} scene - The scene. - */ - updateFog(scene: Scene): void; - /** - * If a scene environment is configured, this method makes sure to - * represent the environment with a corresponding node-based implementation. - * - * @param {Scene} scene - The scene. - */ - updateEnvironment(scene: Scene): void; - getNodeFrame(renderer?: Renderer, scene?: null, object?: null, camera?: null, material?: null): Renderer; - getNodeFrameForRender(renderObject: any): Renderer; - /** - * Returns the current output cache key. - * - * @return {string} The output cache key. - */ - getOutputCacheKey(): string; - /** - * Returns a node that represents the output configuration (tone mapping and - * color space) for the current target. - * - * @param {Texture} outputTarget - The output target. - * @return {Node} The output node. - */ - getOutputNode(outputTarget: Texture): Node; - /** - * Sets the output layer index for array texture output pass. - * This should be called before each layer render during the output pass. - * - * @param {number} index - The layer index. - */ - setOutputLayerIndex(index: number): void; - /** - * Triggers the call of `updateBefore()` methods - * for all nodes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateBefore(renderObject: RenderObject): void; - /** - * Triggers the call of `updateAfter()` methods - * for all nodes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateAfter(renderObject: RenderObject): void; - /** - * Triggers the call of `update()` methods - * for all nodes of the given compute node. - * - * @param {Node} computeNode - The compute node. - */ - updateForCompute(computeNode: Node): void; - /** - * Triggers the call of `update()` methods - * for all nodes of the given render object. - * - * @param {RenderObject} renderObject - The render object. - */ - updateForRender(renderObject: RenderObject): void; - /** - * Returns the refresh type of the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {number} The refresh type, see `RenderObjectRefreshType`. - */ - needsRefresh(renderObject: RenderObject): number; -} -import DataMap from '../DataMap.js'; -import NodeBuilderState from './NodeBuilderState.js'; -import ChainMap from '../ChainMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts deleted file mode 100644 index 3c380c248..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampledTexture.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -/** - * A special form of sampled texture binding type. - * It's texture value is managed by a node object. - * - * @private - * @augments SampledTexture - */ -export class NodeSampledTexture extends SampledTexture { - /** - * Constructs a new node-based sampled texture. - * - * @param {string} name - The textures's name. - * @param {TextureNode} textureNode - The texture node. - * @param {UniformGroupNode} groupNode - The uniform group node. - * @param {?string} [access=null] - The access type. - */ - constructor(name: string, textureNode: TextureNode, groupNode: UniformGroupNode, access?: string | null); - /** - * The texture node. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * The uniform group node. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; - /** - * The access type. - * - * @type {?string} - * @default null - */ - access: string | null; -} -/** - * A special form of sampled cube texture binding type. - * It's texture value is managed by a node object. - * - * @private - * @augments NodeSampledTexture - */ -export class NodeSampledCubeTexture extends NodeSampledTexture { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampledCubeTexture: boolean; -} -/** - * A special form of sampled 3D texture binding type. - * It's texture value is managed by a node object. - * - * @private - * @augments NodeSampledTexture - */ -export class NodeSampledTexture3D extends NodeSampledTexture { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isSampledTexture3D: boolean; -} -import { SampledTexture } from '../SampledTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts deleted file mode 100644 index b5ad4701d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeSampler.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default NodeSampler; -/** - * A special form of sampler binding type. - * It's texture value is managed by a node object. - * - * @private - * @augments Sampler - */ -declare class NodeSampler extends Sampler { - /** - * Constructs a new node-based sampler. - * - * @param {string} name - The samplers's name. - * @param {TextureNode} textureNode - The texture node. - * @param {UniformGroupNode} groupNode - The uniform group node. - */ - constructor(name: string, textureNode: TextureNode, groupNode: UniformGroupNode); - /** - * The texture node. - * - * @type {TextureNode} - */ - textureNode: TextureNode; - /** - * The uniform group node. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; -} -import Sampler from '../Sampler.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts deleted file mode 100644 index ca5196126..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeStorageBuffer.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -export default NodeStorageBuffer; -/** - * A special form of storage buffer binding type. - * It's buffer value is managed by a node object. - * - * @private - * @augments StorageBuffer - */ -declare class NodeStorageBuffer extends StorageBuffer { - /** - * Constructs a new node-based storage buffer. - * - * @param {StorageBufferNode} nodeUniform - The storage buffer node. - * @param {UniformGroupNode} groupNode - The uniform group node. - */ - constructor(nodeUniform: StorageBufferNode, groupNode: UniformGroupNode); - /** - * The node uniform. - * - * @type {StorageBufferNode} - */ - nodeUniform: StorageBufferNode; - /** - * The access type. - * - * @type {string} - */ - access: string; - /** - * The uniform group node. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; -} -import StorageBuffer from '../StorageBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts deleted file mode 100644 index 47673f68d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniform.d.ts +++ /dev/null @@ -1,230 +0,0 @@ -/** - * A special form of Number uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments NumberUniform - */ -export class NumberNodeUniform extends NumberUniform { - /** - * Constructs a new node-based Number uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Overwritten to return the value of the node uniform. - * - * @return {number} The value. - */ - getValue(): number; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -/** - * A special form of Vector2 uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments Vector2Uniform - */ -export class Vector2NodeUniform extends Vector2Uniform { - /** - * Constructs a new node-based Vector2 uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -/** - * A special form of Vector3 uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments Vector3Uniform - */ -export class Vector3NodeUniform extends Vector3Uniform { - /** - * Constructs a new node-based Vector3 uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -/** - * A special form of Vector4 uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments Vector4Uniform - */ -export class Vector4NodeUniform extends Vector4Uniform { - /** - * Constructs a new node-based Vector4 uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -/** - * A special form of Color uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments ColorUniform - */ -export class ColorNodeUniform extends ColorUniform { - /** - * Constructs a new node-based Color uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -/** - * A special form of Matrix2 uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments Matrix2Uniform - */ -export class Matrix2NodeUniform extends Matrix2Uniform { - /** - * Constructs a new node-based Matrix2 uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -/** - * A special form of Matrix3 uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments Matrix3Uniform - */ -export class Matrix3NodeUniform extends Matrix3Uniform { - /** - * Constructs a new node-based Matrix3 uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -/** - * A special form of Matrix4 uniform binding type. - * It's value is managed by a node object. - * - * @private - * @augments Matrix4Uniform - */ -export class Matrix4NodeUniform extends Matrix4Uniform { - /** - * Constructs a new node-based Matrix4 uniform. - * - * @param {NodeUniform} nodeUniform - The node uniform. - */ - constructor(nodeUniform: NodeUniform); - /** - * The node uniform. - * - * @type {NodeUniform} - */ - nodeUniform: NodeUniform; - /** - * Returns the node uniform data type. - * - * @return {string} The data type. - */ - getType(): string; -} -import { NumberUniform } from '../Uniform.js'; -import { Vector2Uniform } from '../Uniform.js'; -import { Vector3Uniform } from '../Uniform.js'; -import { Vector4Uniform } from '../Uniform.js'; -import { ColorUniform } from '../Uniform.js'; -import { Matrix2Uniform } from '../Uniform.js'; -import { Matrix3Uniform } from '../Uniform.js'; -import { Matrix4Uniform } from '../Uniform.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts deleted file mode 100644 index 495dc5d8c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformBuffer.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -export default NodeUniformBuffer; -/** - * A special form of uniform buffer binding type. - * It's buffer value is managed by a node object. - * - * @private - * @augments UniformBuffer - */ -declare class NodeUniformBuffer extends UniformBuffer { - /** - * Constructs a new node-based uniform buffer. - * - * @param {BufferNode} nodeUniform - The uniform buffer node. - * @param {UniformGroupNode} groupNode - The uniform group node. - */ - constructor(nodeUniform: BufferNode, groupNode: UniformGroupNode); - /** - * The uniform buffer node. - * - * @type {BufferNode} - */ - nodeUniform: BufferNode; - /** - * The uniform group node. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeUniformBuffer: boolean; - /** - * The array of update ranges. - * - * @param {Array<{start: number, count: number}>} value - The update ranges. - */ - set updateRanges(value: Array<{ - start: number; - count: number; - }>); - /** - * The array of update ranges. - * - * @type {Array<{start: number, count: number}>} - */ - get updateRanges(): Array<{ - start: number; - count: number; - }>; -} -import UniformBuffer from '../UniformBuffer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts b/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts deleted file mode 100644 index c196bbe56..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/common/nodes/NodeUniformsGroup.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -export default NodeUniformsGroup; -/** - * A special form of uniforms group that represents - * the individual uniforms as node-based uniforms. - * - * @private - * @augments UniformsGroup - */ -declare class NodeUniformsGroup extends UniformsGroup { - /** - * Constructs a new node-based uniforms group. - * - * @param {string} name - The group's name. - * @param {UniformGroupNode} groupNode - The uniform group node. - */ - constructor(name: string, groupNode: UniformGroupNode); - /** - * The group's ID. - * - * @type {number} - */ - id: number; - /** - * The uniform group node. - * - * @type {UniformGroupNode} - */ - groupNode: UniformGroupNode; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isNodeUniformsGroup: boolean; -} -import UniformsGroup from '../UniformsGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts deleted file mode 100644 index 408609494..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/DFGLUTData.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function getDFGLUT(): any; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts deleted file mode 100644 index 8fb607cb0..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk.d.ts +++ /dev/null @@ -1,252 +0,0 @@ -export namespace ShaderChunk { - export { alphahash_fragment }; - export { alphahash_pars_fragment }; - export { alphamap_fragment }; - export { alphamap_pars_fragment }; - export { alphatest_fragment }; - export { alphatest_pars_fragment }; - export { aomap_fragment }; - export { aomap_pars_fragment }; - export { batching_pars_vertex }; - export { batching_vertex }; - export { begin_vertex }; - export { beginnormal_vertex }; - export { bsdfs }; - export { iridescence_fragment }; - export { bumpmap_pars_fragment }; - export { clipping_planes_fragment }; - export { clipping_planes_pars_fragment }; - export { clipping_planes_pars_vertex }; - export { clipping_planes_vertex }; - export { color_fragment }; - export { color_pars_fragment }; - export { color_pars_vertex }; - export { color_vertex }; - export { common }; - export { cube_uv_reflection_fragment }; - export { defaultnormal_vertex }; - export { displacementmap_pars_vertex }; - export { displacementmap_vertex }; - export { emissivemap_fragment }; - export { emissivemap_pars_fragment }; - export { colorspace_fragment }; - export { colorspace_pars_fragment }; - export { envmap_fragment }; - export { envmap_common_pars_fragment }; - export { envmap_pars_fragment }; - export { envmap_pars_vertex }; - export { envmap_physical_pars_fragment }; - export { envmap_vertex }; - export { fog_vertex }; - export { fog_pars_vertex }; - export { fog_fragment }; - export { fog_pars_fragment }; - export { gradientmap_pars_fragment }; - export { lightmap_pars_fragment }; - export { lights_lambert_fragment }; - export { lights_lambert_pars_fragment }; - export { lights_pars_begin }; - export { lights_toon_fragment }; - export { lights_toon_pars_fragment }; - export { lights_phong_fragment }; - export { lights_phong_pars_fragment }; - export { lights_physical_fragment }; - export { lights_physical_pars_fragment }; - export { lights_fragment_begin }; - export { lights_fragment_maps }; - export { lights_fragment_end }; - export { lightprobes_pars_fragment }; - export { logdepthbuf_fragment }; - export { logdepthbuf_pars_fragment }; - export { logdepthbuf_pars_vertex }; - export { logdepthbuf_vertex }; - export { map_fragment }; - export { map_pars_fragment }; - export { map_particle_fragment }; - export { map_particle_pars_fragment }; - export { metalnessmap_fragment }; - export { metalnessmap_pars_fragment }; - export { morphinstance_vertex }; - export { morphcolor_vertex }; - export { morphnormal_vertex }; - export { morphtarget_pars_vertex }; - export { morphtarget_vertex }; - export { normal_fragment_begin }; - export { normal_fragment_maps }; - export { normal_pars_fragment }; - export { normal_pars_vertex }; - export { normal_vertex }; - export { normalmap_pars_fragment }; - export { clearcoat_normal_fragment_begin }; - export { clearcoat_normal_fragment_maps }; - export { clearcoat_pars_fragment }; - export { iridescence_pars_fragment }; - export { opaque_fragment }; - export { packing }; - export { premultiplied_alpha_fragment }; - export { project_vertex }; - export { dithering_fragment }; - export { dithering_pars_fragment }; - export { roughnessmap_fragment }; - export { roughnessmap_pars_fragment }; - export { shadowmap_pars_fragment }; - export { shadowmap_pars_vertex }; - export { shadowmap_vertex }; - export { shadowmask_pars_fragment }; - export { skinbase_vertex }; - export { skinning_pars_vertex }; - export { skinning_vertex }; - export { skinnormal_vertex }; - export { specularmap_fragment }; - export { specularmap_pars_fragment }; - export { tonemapping_fragment }; - export { tonemapping_pars_fragment }; - export { transmission_fragment }; - export { transmission_pars_fragment }; - export { uv_pars_fragment }; - export { uv_pars_vertex }; - export { uv_vertex }; - export { worldpos_vertex }; - export let background_vert: string; - export let background_frag: string; - export let backgroundCube_vert: string; - export let backgroundCube_frag: string; - export let cube_vert: string; - export let cube_frag: string; - export let depth_vert: string; - export let depth_frag: string; - export let distance_vert: string; - export let distance_frag: string; - export let equirect_vert: string; - export let equirect_frag: string; - export let linedashed_vert: string; - export let linedashed_frag: string; - export let meshbasic_vert: string; - export let meshbasic_frag: string; - export let meshlambert_vert: string; - export let meshlambert_frag: string; - export let meshmatcap_vert: string; - export let meshmatcap_frag: string; - export let meshnormal_vert: string; - export let meshnormal_frag: string; - export let meshphong_vert: string; - export let meshphong_frag: string; - export let meshphysical_vert: string; - export let meshphysical_frag: string; - export let meshtoon_vert: string; - export let meshtoon_frag: string; - export let points_vert: string; - export let points_frag: string; - export let shadow_vert: string; - export let shadow_frag: string; - export let sprite_vert: string; - export let sprite_frag: string; -} -import alphahash_fragment from './ShaderChunk/alphahash_fragment.glsl.js'; -import alphahash_pars_fragment from './ShaderChunk/alphahash_pars_fragment.glsl.js'; -import alphamap_fragment from './ShaderChunk/alphamap_fragment.glsl.js'; -import alphamap_pars_fragment from './ShaderChunk/alphamap_pars_fragment.glsl.js'; -import alphatest_fragment from './ShaderChunk/alphatest_fragment.glsl.js'; -import alphatest_pars_fragment from './ShaderChunk/alphatest_pars_fragment.glsl.js'; -import aomap_fragment from './ShaderChunk/aomap_fragment.glsl.js'; -import aomap_pars_fragment from './ShaderChunk/aomap_pars_fragment.glsl.js'; -import batching_pars_vertex from './ShaderChunk/batching_pars_vertex.glsl.js'; -import batching_vertex from './ShaderChunk/batching_vertex.glsl.js'; -import begin_vertex from './ShaderChunk/begin_vertex.glsl.js'; -import beginnormal_vertex from './ShaderChunk/beginnormal_vertex.glsl.js'; -import bsdfs from './ShaderChunk/bsdfs.glsl.js'; -import iridescence_fragment from './ShaderChunk/iridescence_fragment.glsl.js'; -import bumpmap_pars_fragment from './ShaderChunk/bumpmap_pars_fragment.glsl.js'; -import clipping_planes_fragment from './ShaderChunk/clipping_planes_fragment.glsl.js'; -import clipping_planes_pars_fragment from './ShaderChunk/clipping_planes_pars_fragment.glsl.js'; -import clipping_planes_pars_vertex from './ShaderChunk/clipping_planes_pars_vertex.glsl.js'; -import clipping_planes_vertex from './ShaderChunk/clipping_planes_vertex.glsl.js'; -import color_fragment from './ShaderChunk/color_fragment.glsl.js'; -import color_pars_fragment from './ShaderChunk/color_pars_fragment.glsl.js'; -import color_pars_vertex from './ShaderChunk/color_pars_vertex.glsl.js'; -import color_vertex from './ShaderChunk/color_vertex.glsl.js'; -import common from './ShaderChunk/common.glsl.js'; -import cube_uv_reflection_fragment from './ShaderChunk/cube_uv_reflection_fragment.glsl.js'; -import defaultnormal_vertex from './ShaderChunk/defaultnormal_vertex.glsl.js'; -import displacementmap_pars_vertex from './ShaderChunk/displacementmap_pars_vertex.glsl.js'; -import displacementmap_vertex from './ShaderChunk/displacementmap_vertex.glsl.js'; -import emissivemap_fragment from './ShaderChunk/emissivemap_fragment.glsl.js'; -import emissivemap_pars_fragment from './ShaderChunk/emissivemap_pars_fragment.glsl.js'; -import colorspace_fragment from './ShaderChunk/colorspace_fragment.glsl.js'; -import colorspace_pars_fragment from './ShaderChunk/colorspace_pars_fragment.glsl.js'; -import envmap_fragment from './ShaderChunk/envmap_fragment.glsl.js'; -import envmap_common_pars_fragment from './ShaderChunk/envmap_common_pars_fragment.glsl.js'; -import envmap_pars_fragment from './ShaderChunk/envmap_pars_fragment.glsl.js'; -import envmap_pars_vertex from './ShaderChunk/envmap_pars_vertex.glsl.js'; -import envmap_physical_pars_fragment from './ShaderChunk/envmap_physical_pars_fragment.glsl.js'; -import envmap_vertex from './ShaderChunk/envmap_vertex.glsl.js'; -import fog_vertex from './ShaderChunk/fog_vertex.glsl.js'; -import fog_pars_vertex from './ShaderChunk/fog_pars_vertex.glsl.js'; -import fog_fragment from './ShaderChunk/fog_fragment.glsl.js'; -import fog_pars_fragment from './ShaderChunk/fog_pars_fragment.glsl.js'; -import gradientmap_pars_fragment from './ShaderChunk/gradientmap_pars_fragment.glsl.js'; -import lightmap_pars_fragment from './ShaderChunk/lightmap_pars_fragment.glsl.js'; -import lights_lambert_fragment from './ShaderChunk/lights_lambert_fragment.glsl.js'; -import lights_lambert_pars_fragment from './ShaderChunk/lights_lambert_pars_fragment.glsl.js'; -import lights_pars_begin from './ShaderChunk/lights_pars_begin.glsl.js'; -import lights_toon_fragment from './ShaderChunk/lights_toon_fragment.glsl.js'; -import lights_toon_pars_fragment from './ShaderChunk/lights_toon_pars_fragment.glsl.js'; -import lights_phong_fragment from './ShaderChunk/lights_phong_fragment.glsl.js'; -import lights_phong_pars_fragment from './ShaderChunk/lights_phong_pars_fragment.glsl.js'; -import lights_physical_fragment from './ShaderChunk/lights_physical_fragment.glsl.js'; -import lights_physical_pars_fragment from './ShaderChunk/lights_physical_pars_fragment.glsl.js'; -import lights_fragment_begin from './ShaderChunk/lights_fragment_begin.glsl.js'; -import lights_fragment_maps from './ShaderChunk/lights_fragment_maps.glsl.js'; -import lights_fragment_end from './ShaderChunk/lights_fragment_end.glsl.js'; -import lightprobes_pars_fragment from './ShaderChunk/lightprobes_pars_fragment.glsl.js'; -import logdepthbuf_fragment from './ShaderChunk/logdepthbuf_fragment.glsl.js'; -import logdepthbuf_pars_fragment from './ShaderChunk/logdepthbuf_pars_fragment.glsl.js'; -import logdepthbuf_pars_vertex from './ShaderChunk/logdepthbuf_pars_vertex.glsl.js'; -import logdepthbuf_vertex from './ShaderChunk/logdepthbuf_vertex.glsl.js'; -import map_fragment from './ShaderChunk/map_fragment.glsl.js'; -import map_pars_fragment from './ShaderChunk/map_pars_fragment.glsl.js'; -import map_particle_fragment from './ShaderChunk/map_particle_fragment.glsl.js'; -import map_particle_pars_fragment from './ShaderChunk/map_particle_pars_fragment.glsl.js'; -import metalnessmap_fragment from './ShaderChunk/metalnessmap_fragment.glsl.js'; -import metalnessmap_pars_fragment from './ShaderChunk/metalnessmap_pars_fragment.glsl.js'; -import morphinstance_vertex from './ShaderChunk/morphinstance_vertex.glsl.js'; -import morphcolor_vertex from './ShaderChunk/morphcolor_vertex.glsl.js'; -import morphnormal_vertex from './ShaderChunk/morphnormal_vertex.glsl.js'; -import morphtarget_pars_vertex from './ShaderChunk/morphtarget_pars_vertex.glsl.js'; -import morphtarget_vertex from './ShaderChunk/morphtarget_vertex.glsl.js'; -import normal_fragment_begin from './ShaderChunk/normal_fragment_begin.glsl.js'; -import normal_fragment_maps from './ShaderChunk/normal_fragment_maps.glsl.js'; -import normal_pars_fragment from './ShaderChunk/normal_pars_fragment.glsl.js'; -import normal_pars_vertex from './ShaderChunk/normal_pars_vertex.glsl.js'; -import normal_vertex from './ShaderChunk/normal_vertex.glsl.js'; -import normalmap_pars_fragment from './ShaderChunk/normalmap_pars_fragment.glsl.js'; -import clearcoat_normal_fragment_begin from './ShaderChunk/clearcoat_normal_fragment_begin.glsl.js'; -import clearcoat_normal_fragment_maps from './ShaderChunk/clearcoat_normal_fragment_maps.glsl.js'; -import clearcoat_pars_fragment from './ShaderChunk/clearcoat_pars_fragment.glsl.js'; -import iridescence_pars_fragment from './ShaderChunk/iridescence_pars_fragment.glsl.js'; -import opaque_fragment from './ShaderChunk/opaque_fragment.glsl.js'; -import packing from './ShaderChunk/packing.glsl.js'; -import premultiplied_alpha_fragment from './ShaderChunk/premultiplied_alpha_fragment.glsl.js'; -import project_vertex from './ShaderChunk/project_vertex.glsl.js'; -import dithering_fragment from './ShaderChunk/dithering_fragment.glsl.js'; -import dithering_pars_fragment from './ShaderChunk/dithering_pars_fragment.glsl.js'; -import roughnessmap_fragment from './ShaderChunk/roughnessmap_fragment.glsl.js'; -import roughnessmap_pars_fragment from './ShaderChunk/roughnessmap_pars_fragment.glsl.js'; -import shadowmap_pars_fragment from './ShaderChunk/shadowmap_pars_fragment.glsl.js'; -import shadowmap_pars_vertex from './ShaderChunk/shadowmap_pars_vertex.glsl.js'; -import shadowmap_vertex from './ShaderChunk/shadowmap_vertex.glsl.js'; -import shadowmask_pars_fragment from './ShaderChunk/shadowmask_pars_fragment.glsl.js'; -import skinbase_vertex from './ShaderChunk/skinbase_vertex.glsl.js'; -import skinning_pars_vertex from './ShaderChunk/skinning_pars_vertex.glsl.js'; -import skinning_vertex from './ShaderChunk/skinning_vertex.glsl.js'; -import skinnormal_vertex from './ShaderChunk/skinnormal_vertex.glsl.js'; -import specularmap_fragment from './ShaderChunk/specularmap_fragment.glsl.js'; -import specularmap_pars_fragment from './ShaderChunk/specularmap_pars_fragment.glsl.js'; -import tonemapping_fragment from './ShaderChunk/tonemapping_fragment.glsl.js'; -import tonemapping_pars_fragment from './ShaderChunk/tonemapping_pars_fragment.glsl.js'; -import transmission_fragment from './ShaderChunk/transmission_fragment.glsl.js'; -import transmission_pars_fragment from './ShaderChunk/transmission_pars_fragment.glsl.js'; -import uv_pars_fragment from './ShaderChunk/uv_pars_fragment.glsl.js'; -import uv_pars_vertex from './ShaderChunk/uv_pars_vertex.glsl.js'; -import uv_vertex from './ShaderChunk/uv_vertex.glsl.js'; -import worldpos_vertex from './ShaderChunk/worldpos_vertex.glsl.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts deleted file mode 100644 index 2fbc8585e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ALPHAHASH\n\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts deleted file mode 100644 index 22f68c64c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphahash_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ALPHAHASH\n\n\t/**\n\t * See: https://casual-effects.com/research/Wyman2017Hashed/index.html\n\t */\n\n\tconst float ALPHA_HASH_SCALE = 0.05; // Derived from trials only, and may be changed.\n\n\tfloat hash2D( vec2 value ) {\n\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\n\t}\n\n\tfloat hash3D( vec3 value ) {\n\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\n\t}\n\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\n\t\t// Find the discretized derivatives of our coordinates\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\n\t\t// Find two nearest log-discretized noise scales\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\n\t\t// Compute alpha thresholds at our two noise scales\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\n\t\t// Factor to interpolate lerp with\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\n\t\t// Interpolate alpha threshold from noise at two scales\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\n\t\t// Pass into CDF to compute uniformly distrib threshold\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\n\t\t// Find our final, uniformly distributed alpha threshold (\u03B1\u03C4)\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\n\t\t// Avoids \u03B1\u03C4 == 0. Could also do \u03B1\u03C4 =1-\u03B1\u03C4\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts deleted file mode 100644 index 307a3304f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts deleted file mode 100644 index adb0fb573..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphamap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts deleted file mode 100644 index 92b21922a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ALPHATEST\n\n\t#ifdef ALPHA_TO_COVERAGE\n\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\n\t#else\n\n\tif ( diffuseColor.a < alphaTest ) discard;\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts deleted file mode 100644 index af0e29861..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/alphatest_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts deleted file mode 100644 index 13933984f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_AOMAP\n\n\t// reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts deleted file mode 100644 index 3d9728bad..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/aomap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_AOMAP\n\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts deleted file mode 100644 index 745b7477f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\n\t}\n\n\tfloat getIndirectIndex( const in int i ) {\n\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\n\t}\n\n#endif\n\n#ifdef USE_BATCHING_COLOR\n\n\tuniform sampler2D batchingColorTexture;\n\tvec4 getBatchingColor( const in float i ) {\n\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts deleted file mode 100644 index b472ee778..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts deleted file mode 100644 index 06db803d3..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/begin_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvec3 transformed = vec3( position );\n\n#ifdef USE_ALPHAHASH\n\n\tvPosition = vec3( position );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts deleted file mode 100644 index 3da7db7fa..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/beginnormal_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvec3 objectNormal = vec3( normal );\n\n#ifdef USE_TANGENT\n\n\tvec3 objectTangent = vec3( tangent.xyz );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts deleted file mode 100644 index 2ad3ea62c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bsdfs.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n\n\t// geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n\treturn 0.25;\n\n}\n\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n\n}\n\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n\tfloat G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\n\treturn F * ( G * D );\n\n} // validated\n\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts deleted file mode 100644 index f19431cdb..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_BUMPMAP\n\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\n\t// Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n\t// https://mmikk.github.io/papers3d/mm_sfgrad_bump.pdf\n\n\t// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n\tvec2 dHdxy_fwd() {\n\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\n\t\treturn vec2( dBx, dBy );\n\n\t}\n\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n\t\t// normalize is done to ensure that the bump map looks the same regardless of the texture's scale\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm; // normalized\n\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts deleted file mode 100644 index 956542f38..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_CLEARCOAT\n\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts deleted file mode 100644 index f16ddc371..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_maps.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts deleted file mode 100644 index 2ca80fed2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clearcoat_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\n#ifdef USE_CLEARCOATMAP\n\n\tuniform sampler2D clearcoatMap;\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n\n#endif\n\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform sampler2D clearcoatRoughnessMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts deleted file mode 100644 index aaa2b23f9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvec4 plane;\n\n\t#ifdef ALPHA_TO_COVERAGE\n\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\t\tfloat unionClipOpacity = 1.0;\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\n\t\t#endif\n\n\t\tdiffuseColor.a *= clipOpacity;\n\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\n\t#else\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\n\t\t\tbool clipped = true;\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\tif ( clipped ) discard;\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts deleted file mode 100644 index ae5f26dfe..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts deleted file mode 100644 index d5b3da410..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvarying vec3 vClipPosition;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts deleted file mode 100644 index 20c123ce6..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/clipping_planes_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if NUM_CLIPPING_PLANES > 0\n\n\tvClipPosition = - mvPosition.xyz;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts deleted file mode 100644 index 8feede5ff..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\n\tdiffuseColor *= vColor;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts deleted file mode 100644 index 34020cf10..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\n\tvarying vec4 vColor;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts deleted file mode 100644 index 90280cde7..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\n\tvarying vec4 vColor;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts deleted file mode 100644 index 18cabec6a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/color_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\n\tvColor = vec4( 1.0 );\n\n#endif\n\n#ifdef USE_COLOR_ALPHA\n\n\tvColor *= color;\n\n#elif defined( USE_COLOR )\n\n\tvColor.rgb *= color;\n\n#endif\n\n#ifdef USE_INSTANCING_COLOR\n\n\tvColor.rgb *= instanceColor.rgb;\n\n#endif\n\n#ifdef USE_BATCHING_COLOR\n\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts deleted file mode 100644 index 9046950c1..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\ngl_FragColor = linearToOutputTexel( gl_FragColor );\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts deleted file mode 100644 index 0421d40c8..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\n\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\n\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\n\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts deleted file mode 100644 index 43db5ac04..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/common.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n\treturn fract( sin( sn ) * c );\n\n}\n\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\n\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\n\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n\n#ifdef USE_ALPHAHASH\n\n\tvarying vec3 vPosition;\n\n#endif\n\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n}\n\n#define inverseTransformDirection transformDirectionByInverseViewMatrix // @deprecated r185\n\nvec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {\n\n\t// upper-left 3x3 of view matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );\n\n}\n\nvec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {\n\n\t// upper-left 3x3 of view matrix is assumed to be orthogonal\n\n\treturn normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );\n\n}\n\nbool isPerspectiveMatrix( mat4 m ) {\n\n\treturn m[ 2 ][ 3 ] == - 1.0;\n\n}\n\nvec2 equirectUv( in vec3 dir ) {\n\n\t// dir is assumed to be unit length\n\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\n\treturn vec2( u, v );\n\n}\n\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\n\treturn RECIPROCAL_PI * diffuseColor;\n\n} // validated\n\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\n\t// Original approximation by Christophe Schlick '94\n\t// float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n\t// Optimized variant (presented by Epic at SIGGRAPH '13)\n\t// https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n\n} // validated\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts deleted file mode 100644 index 679dc7c37..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\n\t// These shader functions convert between the UV coordinates of a single face of\n\t// a cubemap, the 0-5 integer index of a cube face, and the direction vector for\n\t// sampling a textureCube (not generally normalized ).\n\n\tfloat getFace( vec3 direction ) {\n\n\t\tvec3 absDirection = abs( direction );\n\n\t\tfloat face = - 1.0;\n\n\t\tif ( absDirection.x > absDirection.z ) {\n\n\t\t\tif ( absDirection.x > absDirection.y )\n\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t} else {\n\n\t\t\tif ( absDirection.z > absDirection.y )\n\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\n\t\t\telse\n\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\n\t\t}\n\n\t\treturn face;\n\n\t}\n\n\t// RH coordinate system; PMREM face-indexing convention\n\tvec2 getUV( vec3 direction, float face ) {\n\n\t\tvec2 uv;\n\n\t\tif ( face == 0.0 ) {\n\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); // pos x\n\n\t\t} else if ( face == 1.0 ) {\n\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); // pos y\n\n\t\t} else if ( face == 2.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); // pos z\n\n\t\t} else if ( face == 3.0 ) {\n\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); // neg x\n\n\t\t} else if ( face == 4.0 ) {\n\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); // neg y\n\n\t\t} else {\n\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); // neg z\n\n\t\t}\n\n\t\treturn 0.5 * ( uv + 1.0 );\n\n\t}\n\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\n\t\tfloat face = getFace( direction );\n\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\n\t\tfloat faceSize = exp2( mipInt );\n\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; // #25071\n\n\t\tif ( face > 2.0 ) {\n\n\t\t\tuv.y += faceSize;\n\n\t\t\tface -= 3.0;\n\n\t\t}\n\n\t\tuv.x += face * faceSize;\n\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\n\t\t#ifdef texture2DGradEXT\n\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; // disable anisotropic filtering\n\n\t\t#else\n\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\n\t\t#endif\n\n\t}\n\n\t// These defines must match with PMREMGenerator\n\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\n\tfloat roughnessToMip( float roughness ) {\n\n\t\tfloat mip = 0.0;\n\n\t\tif ( roughness >= cubeUV_r1 ) {\n\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\n\t\t} else {\n\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness ); // 1.16 = 1.79^0.25\n\t\t}\n\n\t\treturn mip;\n\n\t}\n\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\n\t\tfloat mipF = fract( mip );\n\n\t\tfloat mipInt = floor( mip );\n\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\n\t\tif ( mipF == 0.0 ) {\n\n\t\t\treturn vec4( color0, 1.0 );\n\n\t\t} else {\n\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\n\t\t}\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts deleted file mode 100644 index 0ec477406..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvoid main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts deleted file mode 100644 index c8a2405ff..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/default_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvoid main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts deleted file mode 100644 index ef2e87dc2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\nvec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\n\tvec3 transformedTangent = objectTangent;\n\n#endif\n\n#ifdef USE_BATCHING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// non-uniform scaling in the instance matrix is supported\n\t// shear transforms are not supported\n\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\ttransformedTangent = bm * transformedTangent;\n\n\t#endif\n\n#endif\n\n#ifdef USE_INSTANCING\n\n\t// this is in lieu of a per-instance normal-matrix\n\t// non-uniform scaling in the instance matrix is supported\n\t// shear transforms are not supported\n\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\ttransformedTangent = im * transformedTangent;\n\n\t#endif\n\n#endif\n\ntransformedNormal = normalMatrix * transformedNormal;\n\n#ifdef FLIP_SIDED\n\n\ttransformedNormal = - transformedNormal;\n\n#endif\n\n#ifdef USE_TANGENT\n\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts deleted file mode 100644 index 11548436c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts deleted file mode 100644 index 00cd8f00c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_DISPLACEMENTMAP\n\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts deleted file mode 100644 index 79105cddc..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef DITHERING\n\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts deleted file mode 100644 index a209611c6..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef DITHERING\n\n\t// based on https://www.shadertoy.com/view/MslGR8\n\tvec3 dithering( vec3 color ) {\n\t\t//Calculate grid position\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\n\t\t//Shift the individual colors differently, thus making it even harder to see the dithering pattern\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\n\t\t//modify shift according to grid position.\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\n\t\t//shift the color by dither_shift\n\t\treturn color + dither_shift_RGB;\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts deleted file mode 100644 index c78635cd5..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_EMISSIVEMAP\n\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)\n\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\n\t#endif\n\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts deleted file mode 100644 index a3cb247c1..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/emissivemap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_EMISSIVEMAP\n\n\tuniform sampler2D emissiveMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts deleted file mode 100644 index b5a4b088e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ENVMAP\n\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts deleted file mode 100644 index f91032c79..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvec3 cameraToFrag;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\n\t\t}\n\n\t\t// Transforming Normal Vectors with the Inverse Transformation\n\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\n\t\t#else\n\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#else\n\n\t\tvec3 reflectVec = vReflect;\n\n\t#endif\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts deleted file mode 100644 index 402c73014..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ENVMAP\n\n\tuniform float reflectivity;\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts deleted file mode 100644 index 9ff38842e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ENVMAP\n\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\n\t\t#define ENV_WORLDPOS\n\n\t#endif\n\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\n\t#else\n\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts deleted file mode 100644 index 6b2783dda..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ENVMAP\n\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\n\t\t\t// Mixing the reflection with the normal is more accurate and keeps rough objects from gathering light from behind their tangent plane.\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\n\t\t\treflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\n\t\t#else\n\n\t\t\treturn vec3( 0.0 );\n\n\t\t#endif\n\n\t}\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\n\t\t\t // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\n\t\t\t#else\n\n\t\t\t\treturn vec3( 0.0 );\n\n\t\t\t#endif\n\n\t\t}\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts deleted file mode 100644 index af6e18f7e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ENVMAP\n\n\t#ifdef ENV_WORLDPOS\n\n\t\tvWorldPosition = worldPosition.xyz;\n\n\t#else\n\n\t\tvec3 cameraToVertex;\n\n\t\tif ( isOrthographic ) {\n\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\n\t\t} else {\n\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\n\t\t}\n\n\t\tvec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\n\t\t#else\n\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts deleted file mode 100644 index a402de6ab..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_FOG\n\n\t#ifdef FOG_EXP2\n\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\n\t#else\n\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\n\t#endif\n\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts deleted file mode 100644 index 2d1b3c615..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_FOG\n\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\n\t#ifdef FOG_EXP2\n\n\t\tuniform float fogDensity;\n\n\t#else\n\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts deleted file mode 100644 index 683bfb933..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_FOG\n\n\tvarying float vFogDepth;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts deleted file mode 100644 index 5193d77e2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/fog_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_FOG\n\n\tvFogDepth = - mvPosition.z;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts deleted file mode 100644 index 64ffea6e5..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\n#ifdef USE_GRADIENTMAP\n\n\tuniform sampler2D gradientMap;\n\n#endif\n\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\n\t// dotNL will be from -1.0 to 1.0\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\n\t#ifdef USE_GRADIENTMAP\n\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\n\t#else\n\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\n\t#endif\n\n}\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts deleted file mode 100644 index ee7f019ab..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\n#ifdef USE_IRIDESCENCE\n\n\t// XYZ to linear-sRGB color space\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\n\t// Assume air interface for top\n\t// Note: We don't handle the case fresnel0 == 1\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\n\t}\n\n\t// Conversion FO/IOR\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\n\t}\n\n\t// ior is a value between 1.0 and 3.0. 1.0 is air interface\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\n\t}\n\n\t// Fresnel equations for dielectric/dielectric interfaces.\n\t// Ref: https://belcour.github.io/blog/research/2017/05/01/brdf-thin-film.html\n\t// Evaluation XYZ sensitivity curves in Fourier space\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\n\t}\n\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\n\t\tvec3 I;\n\n\t\t// Force iridescenceIOR -> outsideIOR when thinFilmThickness -> 0.0\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\t// Evaluate the cosTheta on the base layer (Snell law)\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\n\t\t// Handle TIR:\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\n\t\t\treturn vec3( 1.0 );\n\n\t\t}\n\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\n\t\t// First interface\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\n\t\t// Second interface\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); // guard against 1.0\n\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\n\t\t// Phase shift\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\n\t\t// Compound terms\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\n\t\t// Reflectance term for m = 0 (DC term amplitude)\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\n\t\t// Reflectance term for m > 0 (pairs of diracs)\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\n\t\t}\n\n\t\t// Since out of gamut colors might be produced, negative color values are clamped to 0.\n\t\treturn max( I, vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts deleted file mode 100644 index 53cec2b86..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/iridescence_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform sampler2D iridescenceMap;\n\n#endif\n\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform sampler2D iridescenceThicknessMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts deleted file mode 100644 index 16bdb81bf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_LIGHTMAP\n\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts deleted file mode 100644 index feb145c93..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lightprobes_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_LIGHT_PROBES_GRID\n\n// Single atlas 3D texture that stores all 7 SH sub-volumes stacked along Z.\n// Atlas depth = 7 * ( nz + 2 ) where nz = probesResolution.z.\n// Each sub-volume occupies ( nz + 2 ) slices: 1 padding + nz data + 1 padding.\n// Padding is a copy of the first / last data slice and prevents color bleeding\n// when the hardware linear filter reads across a sub-volume boundary.\nuniform highp sampler3D probesSH;\n\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\n\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n\n\tvec3 res = probesResolution;\n\tvec3 gridRange = probesMax - probesMin;\n\tvec3 resMinusOne = res - 1.0;\n\tvec3 probeSpacing = gridRange / resMinusOne;\n\n\t// Offset sample position along normal by half a probe spacing\n\tvec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n\tvec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n\n\t// Remap to texel centers of the probe grid (XY and Z)\n\tuvw = uvw * resMinusOne / res + 0.5 / res;\n\n\t// Atlas UV mapping along Z:\n\t// paddedSlices = nz + 2 (1 padding texel at each end of every sub-volume)\n\t// atlasDepth = 7 * paddedSlices\n\t// For sub-volume t the first DATA texel sits at atlas slice t*paddedSlices + 1.\n\t// Given probe-grid texel-centre UVZ = ( iz + 0.5 ) / nz the atlas UV is:\n\t// atlasUvZ = ( uvw.z * nz + t * paddedSlices + 1 ) / atlasDepth\n\t//\n\t// uvZBase encodes the nz-scaled Z plus the intra-volume offset (+ 1 for padding),\n\t// so adding t*paddedSlices steps to each successive sub-volume.\n\tfloat nz = res.z;\n\tfloat paddedSlices = nz + 2.0;\n\tfloat atlasDepth = 7.0 * paddedSlices;\n\tfloat uvZBase = uvw.z * nz + 1.0;\n\n\tvec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n\tvec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n\tvec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n\n\t// Unpack 9 vec3 SH L2 coefficients\n\tvec3 c0 = s0.xyz;\n\tvec3 c1 = vec3( s0.w, s1.xy );\n\tvec3 c2 = vec3( s1.zw, s2.x );\n\tvec3 c3 = s2.yzw;\n\tvec3 c4 = s3.xyz;\n\tvec3 c5 = vec3( s3.w, s4.xy );\n\tvec3 c6 = vec3( s4.zw, s5.x );\n\tvec3 c7 = s5.yzw;\n\tvec3 c8 = s6.xyz;\n\n\t// Evaluate L2 irradiance\n\tfloat x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n\n\tvec3 result = c0 * 0.886227;\n\tresult += c1 * 2.0 * 0.511664 * y;\n\tresult += c2 * 2.0 * 0.511664 * z;\n\tresult += c3 * 2.0 * 0.511664 * x;\n\tresult += c4 * 2.0 * 0.429043 * x * y;\n\tresult += c5 * 2.0 * 0.429043 * y * z;\n\tresult += c6 * ( 0.743125 * z * z - 0.247708 );\n\tresult += c7 * 2.0 * 0.429043 * x * z;\n\tresult += c8 * 0.429043 * ( x * x - y * y );\n\n\treturn max( result, vec3( 0.0 ) );\n\n}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts deleted file mode 100644 index 2e93774d9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n/**\n * This is a template that can be used to light a material, it uses pluggable\n * RenderEquations (RE)for specific lighting scenarios.\n *\n * Instructions for use:\n * - Ensure that both RE_Direct, RE_IndirectDiffuse and RE_IndirectSpecular are defined\n * - Create a material parameter that is to be passed as the third parameter to your lighting functions.\n *\n * TODO:\n * - Add area light support.\n * - Add sphere light support.\n * - Add diffuse light probe (irradiance cubemap) support.\n */\n\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n\n#ifdef USE_CLEARCOAT\n\n\tgeometryClearcoatNormal = clearcoatNormal;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\n\tif ( material.iridescenceThickness == 0.0 ) {\n\n\t\tmaterial.iridescence = 0.0;\n\n\t} else {\n\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\n\t}\n\n\tif ( material.iridescence > 0.0 ) {\n\n\t\tvec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tvec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\n\t\tmaterial.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );\n\n\t\t// Iridescence F0 approximation\n\t\tmaterial.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );\n\t\tmaterial.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );\n\n\t}\n\n#endif\n\n#ifdef STANDARD\n\n\tfloat dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );\n\n\tmaterial.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;\n\n\t#if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )\n\n\t\t// Multi-scattering energy compensation for direct lighting\n\t\t// Based on \"Practical Multiple Scattering Compensation for Microfacet Models\"\n\t\t// https://blog.selfshadow.com/publications/turquin/ms_comp_final.pdf\n\n\t\t// Energy of the single-scattering lobe in a white furnace ( F0 = F90 = 1 )\n\t\tfloat EssMs = material.dfg.x + material.dfg.y;\n\n\t\t// Compensate for the energy lost to multiple scattering, tinting the added term by F0 ( equation 16 )\n\t\tmaterial.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );\n\n\t#endif\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\n\t\t// spot lights are ordered [shadows with maps, shadows without maps, maps without shadows, none]\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSunLight sunLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0\n\tSunLightShadow sunLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {\n\n\t\tsunLight = sunLights[ i ];\n\n\t\tgetSunLightInfo( sunLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )\n\t\tsunLightShadow = sunLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\t#if defined( USE_LIGHT_PROBES )\n\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\n\t#endif\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#ifdef USE_LIGHT_PROBES_GRID\n\n\t\tvec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n\t\tvec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n\t\tirradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts deleted file mode 100644 index 247915d2a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( RE_IndirectDiffuse )\n\n\t#if defined( LAMBERT ) || defined( PHONG )\n\n\t\tirradiance += iblIrradiance;\n\n\t#endif\n\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts deleted file mode 100644 index be37cbe29..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( RE_IndirectDiffuse )\n\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\n\t\tirradiance += lightMapIrradiance;\n\n\t#endif\n\n\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\n\t\t#endif\n\n\t#endif\n\n#endif\n\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\n\t#else\n\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts deleted file mode 100644 index 7d7c7ceeb..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nLambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts deleted file mode 100644 index 5ea7d176c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvarying vec3 vViewPosition;\n\nstruct LambertMaterial {\n\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts deleted file mode 100644 index 975cf1d75..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nuniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n\n#if defined( USE_LIGHT_PROBES )\n\n\tuniform vec3 lightProbe[ 9 ];\n\n#endif\n\n// get the irradiance (radiance convolved with cosine lobe) at the point 'normal' on the unit sphere\n// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\n\t// normal is assumed to have unit length\n\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\n\t// band 0\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\n\t// band 1\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\n\t// band 2\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\n\treturn result;\n\n}\n\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\n\tvec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\n\treturn irradiance;\n\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\n\tvec3 irradiance = ambientLightColor;\n\n\treturn irradiance;\n\n}\n\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\n\t// based upon Frostbite 3 Moving to Physically-based Rendering\n\t// page 32, equation 26: E[window1]\n\t// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\n\tif ( cutoffDistance > 0.0 ) {\n\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\n\t}\n\n\treturn distanceFalloff;\n\n}\n\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n\n}\n\n#if NUM_SUN_LIGHTS > 0\n\n\tstruct SunLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform SunLight sunLights[ NUM_SUN_LIGHTS ];\n\n\tvoid getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {\n\n\t\tlight.color = sunLight.color;\n\t\tlight.direction = sunLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_DIR_LIGHTS > 0\n\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\n\t}\n\n#endif\n\n\n#if NUM_POINT_LIGHTS > 0\n\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat lightDistance = length( lVector );\n\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t}\n\n#endif\n\n\n#if NUM_SPOT_LIGHTS > 0\n\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\n\t// light is an out parameter as having it as a return value caused compiler errors on some devices\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\n\t\tlight.direction = normalize( lVector );\n\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\n\t\tif ( spotAttenuation > 0.0 ) {\n\n\t\t\tfloat lightDistance = length( lVector );\n\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\n\t\t} else {\n\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\n\t\t}\n\n\t}\n\n#endif\n\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\n\t// Pre-computed values of LinearTransformedCosine approximation of BRDF\n\t// BRDF approximation Texture is 64x64\n\tuniform sampler2D ltc_1; // RGBA Float\n\tuniform sampler2D ltc_2; // RGBA Float\n\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n\n#endif\n\n\n#if NUM_HEMI_LIGHTS > 0\n\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\n\t\treturn irradiance;\n\n\t}\n\n#endif\n\n#include \n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts deleted file mode 100644 index da03357bf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nBlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts deleted file mode 100644 index be47604ec..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvarying vec3 vViewPosition;\n\nstruct BlinnPhongMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n\n};\n\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts deleted file mode 100644 index 2ccf14523..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\n\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\n\nmaterial.roughness = max( roughnessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.\nmaterial.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n\n#ifdef IOR\n\n\tmaterial.ior = ior;\n\n\t#ifdef USE_SPECULAR\n\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\n\t\t#endif\n\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\n\t\t#endif\n\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\n\t#else\n\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\n\t#endif\n\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\n\t#ifdef USE_CLEARCOATMAP\n\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\n\t#endif\n\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\n\t#endif\n\n\tmaterial.clearcoat = saturate( material.clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n\n#endif\n\n#ifdef USE_DISPERSION\n\n\tmaterial.dispersion = dispersion;\n\n#endif\n\n#ifdef USE_RETROREFLECTION\n\n\tmaterial.retroreflectivity = retroreflectivity;\n\n#endif\n\n#ifdef USE_IRIDESCENCE\n\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\n\t#ifdef USE_IRIDESCENCEMAP\n\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\n\t#else\n\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\n\t#endif\n\n#endif\n\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheenColor;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\n\t#endif\n\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\n\t#endif\n\n#endif\n\n#ifdef USE_ANISOTROPY\n\n\t#ifdef USE_ANISOTROPYMAP\n\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\n\t#else\n\n\t\tvec2 anisotropyV = anisotropyVector;\n\n\t#endif\n\n\tmaterial.anisotropy = length( anisotropyV );\n\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\n\t// Roughness along the anisotropy bitangent is the material roughness, while the tangent roughness increases with anisotropy.\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts deleted file mode 100644 index 899c50ca2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\nuniform sampler2D dfgLUT;\n\nstruct PhysicalMaterial {\n\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\tvec2 dfg;\n\tvec3 multiScatteringCompensation;\n\n\t#ifdef USE_RETROREFLECTION\n\t\tfloat retroreflectivity;\n\t#endif\n\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0Dielectric;\n\t\tvec3 iridescenceF0Metallic;\n\t#endif\n\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n\n};\n\n// temporary\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\n\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\n\treturn 0.5 / max( gv + gl, EPSILON );\n\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\n\tfloat a2 = pow2( alpha );\n\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; // avoid alpha = 0 with dotNH = 1\n\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n\n}\n\n// https://google.github.io/filament/Filament.md.html#materialsystem/anisotropicmodel/anisotropicspecularbrdf\n#ifdef USE_ANISOTROPY\n\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\treturn 0.5 / max( gv + gl, EPSILON );\n\n\t}\n\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\n\t}\n\n#endif\n\n#ifdef USE_CLEARCOAT\n\n\t// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\n\t\tfloat alpha = pow2( roughness ); // UE4's roughness\n\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t\treturn F * ( V * D );\n\n\t}\n\n#endif\n\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\n\tfloat alpha = pow2( roughness ); // UE4's roughness\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\n\t#endif\n\n\t#ifdef USE_ANISOTROPY\n\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\n\t#else\n\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\n\t\tfloat D = D_GGX( alpha, dotNH );\n\n\t#endif\n\n\treturn F * ( V * D );\n\n}\n\n// Rect Area Light\n\n// Real-Time Polygonal-Light Shading with Linearly Transformed Cosines\n// by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt\n// code: https://github.com/selfshadow/ltc_code/\n\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\tfloat dotNV = saturate( dot( N, V ) );\n\n\t// texture parameterized by sqrt( GGX alpha ) and sqrt( 1 - cos( theta ) )\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\treturn uv;\n\n}\n\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\n\t// Real-Time Area Lighting: a Journey from Research to Production (p.102)\n\t// An approximation of the form factor of a horizon-clipped rectangle.\n\n\tfloat l = length( f );\n\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n\n}\n\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\n\tfloat x = dot( v1, v2 );\n\n\tfloat y = abs( x );\n\n\t// rational polynomial approximation to theta / sin( theta ) / 2PI\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\n\treturn cross( v1, v2 ) * theta_sintheta;\n\n}\n\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\n\t// bail if point is on back side of plane of light\n\t// assumes ccw winding order of light vertices\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\n\t// construct orthonormal basis around N\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 ); // negated from paper; possibly due to a different handedness of world coordinate system\n\n\t// compute transform\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\n\t// transform rect\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\n\t// project rect onto sphere\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\n\t// calculate vector form factor\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\n\t// adjust for horizon clipping\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\n/*\n\t// alternate method of adjusting for horizon clipping (see reference)\n\t// refactoring required\n\tfloat len = length( vectorFormFactor );\n\tfloat z = vectorFormFactor.z / len;\n\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\n\t// tabulated horizon-clipped sphere, apparently...\n\tvec2 uv = vec2( z * 0.5 + 0.5, len );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\n\tfloat scale = texture2D( ltc_2, uv ).w;\n\n\tfloat result = len * scale;\n*/\n\n\treturn vec3( result );\n\n}\n\n// End Rect Area Light\n\n#if defined( USE_SHEEN )\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat D_Charlie( float roughness, float dotNH ) {\n\n\tfloat alpha = pow2( roughness );\n\n\t// Estevez and Kulla 2017, \"Production Friendly Microfacet Sheen BRDF\"\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); // 2^(-14/2), so sin2h^2 > 0 in fp16\n\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n\n}\n\n// https://github.com/google/filament/blob/master/shaders/src/brdf.fs\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\n\t// Neubelt and Pettineo 2013, \"Crafting a Next-gen Material Pipeline for The Order: 1886\"\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n\n}\n\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\n\treturn sheenColor * ( D * V );\n\n}\n\n#endif\n\n// This is a curve-fit approximation to the \"Charlie sheen\" BRDF integrated over the hemisphere from\n// Estevez and Kulla 2017, \"Production Friendly Microfacet Sheen BRDF\".\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\n\tfloat DG = exp( a * dotNV + b );\n\n\treturn saturate( DG );\n\n}\n\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\n\treturn specularColor * fab.x + specularF90 * fab.y;\n\n}\n\n// Fdez-Ag\u00FCera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\n\t#else\n\n\t\tvec3 Fr = specularColor;\n\n\t#endif\n\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; // 1/21\n\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n\n}\n\n#if NUM_RECT_AREA_LIGHTS > 0\n\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight; // counterclockwise; light shines in local neg z direction\n\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\n\t\t// LTC Fresnel Approximation by Stephen Hill\n\t\t// http://blog.selfshadow.com/publications/s2016-advances/s2016_ltc_fresnel.pdf\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\n\t\t#ifdef USE_CLEARCOAT\n\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\n\t\t\t// LTC Fresnel Approximation for clearcoat\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\n\t\t#endif\n\n\t}\n\n#endif\n\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\n\tvec3 irradiance = dotNL * directLight.color;\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\n\tvec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\n\t#ifdef USE_RETROREFLECTION\n\n\t\t// Minimal Retroreflective Microfacet Model:\n\t\t// https://jcgt.org/published/0015/01/04/\n\t\tvec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );\n\t\tvec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );\n\n\t\tspecularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );\n\n\t#endif\n\n\treflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;\n\n\t// Light reflected by the specular interface is not available to the diffuse layer ( glTF fresnel_mix )\n\tvec3 halfDir = normalize( directLight.direction + geometryViewDir );\n\tfloat dotVH = saturate( dot( geometryViewDir, halfDir ) );\n\tvec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );\n\n\t#ifdef USE_RETROREFLECTION\n\n\t\tvec3 retroHalfDir = normalize( directLight.direction + retroViewDir );\n\t\tfloat dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );\n\t\tvec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );\n\n\t\tF = mix( F, retroF, saturate( material.retroreflectivity ) );\n\n\t#endif\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );\n}\n\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\n\t// Energy reflected by the specular lobe is not available to the diffuse layer\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );\n\n\t#else\n\n\t\tcomputeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );\n\n\t#endif\n\n\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );\n\n\t#ifdef USE_SHEEN\n\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;\n\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\n\t\tdiffuse *= sheenEnergyComp;\n\n\t#endif\n\n\treflectedLight.indirectDiffuse += diffuse;\n\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\n\t#endif\n\n\t#ifdef USE_SHEEN\n\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n\n \t#endif\n\n\t// Both indirect specular and indirect diffuse light accumulate here\n\t// Compute multiscattering separately for dielectric and metallic, then mix\n\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\n\t#ifdef USE_IRIDESCENCE\n\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );\n\n\t#else\n\n\t\tcomputeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );\n\n\t#endif\n\n\t// Mix based on metalness\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\n\t// Diffuse energy conservation uses dielectric path\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\n\t#ifdef USE_SHEEN\n\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\n\t#endif\n\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n\n// ref: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n\n}\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts deleted file mode 100644 index a113ed7ee..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts deleted file mode 100644 index 20ff9bef9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvarying vec3 vViewPosition;\n\nstruct ToonMaterial {\n\n\tvec3 diffuseColor;\n\n};\n\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n}\n\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts deleted file mode 100644 index 20e28af12..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\n\t// Doing a strict comparison with == 1.0 can cause noise artifacts\n\t// on some platforms. See issue #17623.\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts deleted file mode 100644 index 69a279337..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts deleted file mode 100644 index ee342c244..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts deleted file mode 100644 index 582385491..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts deleted file mode 100644 index c433444b0..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_MAP\n\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)\n\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\n\t#endif\n\n\tdiffuseColor *= sampledDiffuseColor;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts deleted file mode 100644 index 1bcb0e9fd..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts deleted file mode 100644 index 274c1350e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t#if defined( USE_POINTS_UV )\n\n\t\tvec2 uv = vUv;\n\n\t#else\n\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tdiffuseColor *= texture2D( map, uv );\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts deleted file mode 100644 index 2cf3023a2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/map_particle_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_POINTS_UV )\n\n\tvarying vec2 vUv;\n\n#else\n\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\n\t\tuniform mat3 uvTransform;\n\n\t#endif\n\n#endif\n\n#ifdef USE_MAP\n\n\tuniform sampler2D map;\n\n#endif\n\n#ifdef USE_ALPHAMAP\n\n\tuniform sampler2D alphaMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts deleted file mode 100644 index a1169d5f9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nfloat metalnessFactor = metalness;\n\n#ifdef USE_METALNESSMAP\n\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\n\t// reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\tmetalnessFactor *= texelMetalness.b;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts deleted file mode 100644 index 1f17ea17d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/metalnessmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_METALNESSMAP\n\n\tuniform sampler2D metalnessMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts deleted file mode 100644 index 2bbdcb4bb..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphcolor_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_MORPHCOLORS )\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tvColor *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\t#if defined( USE_COLOR_ALPHA )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\n\t\t#elif defined( USE_COLOR )\n\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\n\t\t#endif\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts deleted file mode 100644 index e90281801..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_INSTANCING_MORPH\n\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\n\t}\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts deleted file mode 100644 index 9e1a7c480..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_MORPHNORMALS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in normal = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\tobjectNormal *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts deleted file mode 100644 index 66bb19332..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_MORPHTARGETS\n\n\t#ifndef USE_INSTANCING_MORPH\n\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\n\t#endif\n\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts deleted file mode 100644 index e65f0a031..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/morphtarget_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_MORPHTARGETS\n\n\t// morphTargetBaseInfluence is set based on BufferGeometry.morphTargetsRelative value:\n\t// When morphTargetsRelative is false, this is set to 1 - sum(influences); this results in position = sum((target - base) * influence)\n\t// When morphTargetsRelative is true, this is set to 1; as a result, all morph targets are simply added to the base after weighting\n\ttransformed *= morphTargetBaseInfluence;\n\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts deleted file mode 100644 index 190f1a744..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nfloat faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n\n#ifdef FLAT_SHADED\n\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n\n#else\n\n\tvec3 normal = normalize( vNormal );\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal *= faceDirection;\n\n\t#endif\n\n#endif\n\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\t#ifdef USE_TANGENT\n\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\n\t#else\n\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\n\t#endif\n\n#endif\n\n// non perturbed normal for clearcoat among others\n\nvec3 nonPerturbedNormal = normal;\n\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts deleted file mode 100644 index 69ee51c6d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_fragment_maps.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n\t#ifdef FLIP_SIDED\n\n\t\tnormal = - normal;\n\n\t#endif\n\n\t#ifdef DOUBLE_SIDED\n\n\t\tnormal = normal * faceDirection;\n\n\t#endif\n\n\tnormal = normalize( normalMatrix * normal );\n\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\n\t#if defined( USE_PACKED_NORMALMAP )\n\n\t\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n\n\t#endif\n\n\tmapN.xy *= normalScale;\n\n\tnormal = normalize( tbn * mapN );\n\n#elif defined( USE_BUMPMAP )\n\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts deleted file mode 100644 index 069c529cd..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts deleted file mode 100644 index 069c529cd..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n\t#ifdef USE_TANGENT\n\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts deleted file mode 100644 index 7a77e535d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifndef FLAT_SHADED // normal is computed with derivatives when FLAT_SHADED\n\n\tvNormal = normalize( transformedNormal );\n\n\t#ifdef USE_TANGENT\n\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\n\t\t#ifdef FLIP_SIDED\n\n\t\t\tvBitangent = - vBitangent;\n\n\t\t#endif\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts deleted file mode 100644 index 34eba1c99..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_NORMALMAP\n\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\n#endif\n\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\n\tuniform mat3 normalMatrix;\n\n#endif\n\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\n\t// Normal Mapping Without Precomputed Tangents\n\t// http://www.thetenthplanet.de/archives/1180\n\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\n\t\tvec3 N = surf_norm; // normalized\n\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\n\t\treturn mat3( T * scale, B * scale, N );\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts deleted file mode 100644 index 30b98b9ed..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/opaque_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\n\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts deleted file mode 100644 index 3d9dc4d37..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/packing.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\n\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\n\nconst float PackUpscale = 256. / 255.; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255. / 256.; // 0..1 -> fraction (excluding 1)\nconst float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\n\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\n\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\n\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\n\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\t// the 0.9999 tweak is unimportant, very tiny empirical improvement\n\t// return vec3( vuf * Inv255, gf * PackUpscale, bf * 0.9999 );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\n\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\n\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\n\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\n\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\n\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\n\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\n\n// NOTE: viewZ, the z-coordinate in camera space, is negative for points in front of the camera\n\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( viewZ + near ) / ( near - far );\n}\n\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\n\t#else\n\n\t\treturn depth * ( near - far ) - near;\n\n\t#endif\n}\n\n// NOTE: https://twitter.com/gonnavis/status/1377183786949959682\n\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\t// -near maps to 0; -far maps to 1\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\n\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\n\t#else\n\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\n\t#endif\n}\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts deleted file mode 100644 index 72a909a98..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/premultiplied_alpha_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef PREMULTIPLIED_ALPHA\n\n\tgl_FragColor.rgb *= gl_FragColor.a;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts deleted file mode 100644 index 69daad77e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/project_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nvec4 mvPosition = vec4( transformed, 1.0 );\n\n#ifdef USE_BATCHING\n\n\tmvPosition = batchingMatrix * mvPosition;\n\n#endif\n\n#ifdef USE_INSTANCING\n\n\tmvPosition = instanceMatrix * mvPosition;\n\n#endif\n\nmvPosition = modelViewMatrix * mvPosition;\n\ngl_Position = projectionMatrix * mvPosition;\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts deleted file mode 100644 index 51df63905..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nfloat roughnessFactor = roughness;\n\n#ifdef USE_ROUGHNESSMAP\n\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\n\t// reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n\troughnessFactor *= texelRoughness.g;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts deleted file mode 100644 index 41e9d78a5..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/roughnessmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform sampler2D roughnessMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts deleted file mode 100644 index c2f2b1881..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#if NUM_SPOT_LIGHT_MAPS > 0\n\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n\n\t\t#else\n\n\t\t\tuniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tuniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * 4 ];\n\t\tuniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * 4 ];\n\t\tvarying vec4 vSunShadowWorldPosition;\n\t\tvarying vec3 vSunShadowWorldNormal;\n\n\t\tstruct SunLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\t#else\n\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\t#else\n\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\t#endif\n\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\t// Interleaved Gradient Noise for randomizing sampling patterns\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t}\n\n\t\t// Vogel disk sampling for uniform circular distribution\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\n\t\t}\n\n\t#endif\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\t\tif ( frustumTest ) {\n\n\t\t\t\t// Hardware PCF with LinearFilter gives us 4-tap filtering per sample\n\t\t\t\t// 5 samples using Vogel disk + IGN = effectively 20 filtered taps with better distribution\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\n\t\t\t\t// Use IGN to rotate sampling pattern per pixel\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\n\t\t\t}\n\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t\t}\n\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tshadowCoord.z -= shadowBias;\n\n\t\t\t#else\n\n\t\t\t\tshadowCoord.z += shadowBias;\n\n\t\t\t#endif\n\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\t\tif ( frustumTest ) {\n\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\n\t\t\t\t#else\n\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\t// Early return if fully lit\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\n\t\t\t\t\tshadow = 1.0;\n\n\t\t\t\t} else {\n\n\t\t\t\t\t// Variance must be non-zero to avoid division by zero\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\n\t\t\t\t\t// Distance from mean\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\n\t\t\t\t\t// Chebyshev's inequality for upper bound on probability\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\n\t\t\t\t\t// Reduce light bleeding by remapping [amount, 1] to [0, 1]\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t\t}\n\n\t#else // SHADOWMAP_TYPE_BASIC\n\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tshadowCoord.z -= shadowBias;\n\n\t\t\t#else\n\n\t\t\t\tshadowCoord.z += shadowBias;\n\n\t\t\t#endif\n\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\n\t\t\tif ( frustumTest ) {\n\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\n\t\t\t\t#else\n\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\n\t\t\t\t#endif\n\n\t\t\t}\n\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t\t}\n\n\t#endif\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\tfloat getSunShadow(\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\t\tsampler2DShadow shadowMap,\n\t\t\t#else\n\t\t\t\tsampler2D shadowMap,\n\t\t\t#endif\n\t\t\tSunLightShadow sunLightShadow,\n\t\t\tint shadowIndex\n\t\t) {\n\n\t\t\tvec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );\n\t\t\tfloat viewDepth = vSunShadowWorldPosition.w;\n\t\t\tint cascadeOffset = shadowIndex * 4;\n\n\t\t\tfloat shadow = 1.0;\n\n\t\t\t// walk the cascades back to front so each fade band can blend with the shadow behind it\n\n\t\t\tfor ( int i = 3; i >= 0; i -- ) {\n\n\t\t\t\t// ( begin, end, fade start ) view depths of the cascade\n\n\t\t\t\tvec4 cascade = sunShadowCascade[ cascadeOffset + i ];\n\n\t\t\t\tif ( viewDepth >= cascade.x && viewDepth < cascade.y ) {\n\n\t\t\t\t\tfloat cascadeShadow = getShadow( shadowMap, sunLightShadow.shadowMapSize, sunLightShadow.shadowIntensity, sunLightShadow.shadowBias, sunLightShadow.shadowRadius, sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition );\n\n\t\t\t\t\tshadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn shadow;\n\n\t\t}\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// Direction from light to fragment\n\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t// For cube shadow maps, depth is stored as distance along each face's view axis, not radial distance\n\t\t// The view-space depth is the maximum component of the direction vector (which face is sampled)\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\n\t\t\t// viewZ to perspective depth\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp -= shadowBias;\n\n\t\t\t#else\n\n\t\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp += shadowBias;\n\n\t\t\t#endif\n\n\t\t\t// Hardware PCF with LinearFilter gives us 4-tap filtering per sample\n\t\t\t// Use Vogel disk + IGN sampling for better quality\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\n\t\t\t// Build a tangent-space coordinate system for applying offsets\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\n\t\t\t// Use IGN to rotate sampling pattern per pixel\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\n\t\t\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\n\t\t\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\n\t\t\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\n\t\t\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\n\t\t\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\n\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\n\t\t}\n\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t}\n\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\n\t\tfloat shadow = 1.0;\n\n\t\t// for point lights, the uniform @vShadowCoord is re-purposed to hold\n\t\t// the vector from the light to the world-space position of the fragment.\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\n\t\t// For cube shadow maps, depth is stored as distance along each face's view axis, not radial distance\n\t\t// The view-space depth is the maximum component of the direction vector (which face is sampled)\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\n\t\t\t// viewZ to perspective depth\n\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\n\t\t\t// Direction from light to fragment\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\t\t\tdepth = 1.0 - depth;\n\n\t\t\t#endif\n\n\t\t\tshadow = step( dp, depth );\n\n\t\t}\n\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\n\t}\n\n\t#endif\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts deleted file mode 100644 index e2403745a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n\n#endif\n\n#ifdef USE_SHADOWMAP\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\t// cascade selection and shadow coordinates are computed per fragment\n\n\t\tvarying vec4 vSunShadowWorldPosition;\n\t\tvarying vec3 vSunShadowWorldNormal;\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): uniforms for area light shadows\n\n\t#endif\n\t*/\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts deleted file mode 100644 index 9a6c7cbb0..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n\n#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\n\t#ifdef HAS_NORMAL\n\n\t\t// Offsetting the position used for querying occlusion along the world normal can be used to reduce shadow acne.\n\n\t\tvec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n\n\t#else\n\n\t\tvec3 shadowWorldNormal = vec3( 0.0 ); // fallback, see #21483\n\n\t#endif\n\n\tvec4 shadowWorldPosition;\n\n#endif\n\n#if defined( USE_SHADOWMAP )\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\t\tvSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );\n\t\tvSunShadowWorldNormal = shadowWorldNormal;\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\n\t\t}\n\t\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update vAreaShadowCoord with area light info\n\n\t#endif\n\t*/\n\n#endif\n\n// spot lights can be evaluated without active shadow mapping (when SpotLight.map is used)\n\n#if NUM_SPOT_LIGHT_COORDS > 0\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\n\t}\n\t#pragma unroll_loop_end\n\n#endif\n\n\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts deleted file mode 100644 index 2e96d8c70..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nfloat getShadowMask() {\n\n\tfloat shadow = 1.0;\n\n\t#ifdef USE_SHADOWMAP\n\n\t#if NUM_SUN_LIGHT_SHADOWS > 0\n\n\tSunLightShadow sunLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {\n\n\t\tsunLight = sunLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\n\tDirectionalLightShadow directionalLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\n\tSpotLightShadow spotLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\n\tPointLightShadow pointLight;\n\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\n\t}\n\t#pragma unroll_loop_end\n\n\t#endif\n\n\t/*\n\t#if NUM_RECT_AREA_LIGHTS > 0\n\n\t\t// TODO (abelnation): update shadow for Area light\n\n\t#endif\n\t*/\n\n\t#endif\n\n\treturn shadow;\n\n}\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts deleted file mode 100644 index 17f2cd5a8..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinbase_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_SKINNING\n\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts deleted file mode 100644 index 95a28ff80..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_SKINNING\n\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\n\tuniform highp sampler2D boneTexture;\n\n\tmat4 getBoneMatrix( const in float i ) {\n\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\n\t\treturn mat4( v1, v2, v3, v4 );\n\n\t}\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts deleted file mode 100644 index 34b9a3566..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinning_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_SKINNING\n\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts deleted file mode 100644 index 853e7bfd7..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/skinnormal_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_SKINNING\n\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\n\t#ifdef USE_TANGENT\n\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\n\t#endif\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts deleted file mode 100644 index cf125b322..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\nfloat specularStrength;\n\n#ifdef USE_SPECULARMAP\n\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n\n#else\n\n\tspecularStrength = 1.0;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts deleted file mode 100644 index c2212b978..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/specularmap_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_SPECULARMAP\n\n\tuniform sampler2D specularMap;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts deleted file mode 100644 index a48659853..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( TONE_MAPPING )\n\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts deleted file mode 100644 index 6f9412747..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifndef saturate\n// may have defined saturate() already\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n\nuniform float toneMappingExposure;\n\n// exposure only\nvec3 LinearToneMapping( vec3 color ) {\n\n\treturn saturate( toneMappingExposure * color );\n\n}\n\n// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf\nvec3 ReinhardToneMapping( vec3 color ) {\n\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n\n}\n\n// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/\nvec3 CineonToneMapping( vec3 color ) {\n\n\t// filmic operator by Jim Hejl and Richard Burgess-Dawson\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n\n}\n\n// source: https://github.com/selfshadow/ltc_code/blob/master/webgl/shaders/ltc/ltc_blit.fs\nvec3 RRTAndODTFit( vec3 v ) {\n\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n\n}\n\n// this implementation of ACES is modified to accommodate a brighter viewing environment.\n// the scale factor of 1/0.6 is subjective. see discussion in #19621.\n\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\n\t// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ), // transposed from source\n\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\n\t// ODT_SAT => XYZ => D60_2_D65 => sRGB\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ), // transposed from source\n\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\n\tcolor *= toneMappingExposure / 0.6;\n\n\tcolor = ACESInputMat * color;\n\n\t// Apply RRT and ODT\n\tcolor = RRTAndODTFit( color );\n\n\tcolor = ACESOutputMat * color;\n\n\t// Clamp to [0, 1]\n\treturn saturate( color );\n\n}\n\n// Matrices for rec 2020 <> rec 709 color space conversion\n// matrix provided in row-major order so it has been transposed\n// https://www.itu.int/pub/R-REP-BT.2407-2017\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\n\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\n\n// https://iolite-engine.com/blog_posts/minimal_agx_implementation\n// Mean error^2: 3.6705141e-06\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n\n}\n\n// AgX Tone Mapping implementation based on Filament, which in turn is based\n// on Blender's implementation using rec 2020 primaries\n// https://github.com/google/filament/pull/7236\n// Inputs and outputs are encoded as Linear-sRGB.\n\nvec3 AgXToneMapping( vec3 color ) {\n\n\t// AgX constants\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\n\t// explicit AgXOutsetMatrix generated from Filaments AgXOutsetMatrixInv\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\n\t// LOG2_MIN = -10.0\n\t// LOG2_MAX = +6.5\n\t// MIDDLE_GRAY = 0.18\n\tconst float AgxMinEv = - 12.47393; // log2( pow( 2, LOG2_MIN ) * MIDDLE_GRAY )\n\tconst float AgxMaxEv = 4.026069; // log2( pow( 2, LOG2_MAX ) * MIDDLE_GRAY )\n\n\tcolor *= toneMappingExposure;\n\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\n\tcolor = AgXInsetMatrix * color;\n\n\t// Log2 encoding\n\tcolor = max( color, 1e-10 ); // avoid 0 or negative numbers for log2\n\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\n\tcolor = clamp( color, 0.0, 1.0 );\n\n\t// Apply sigmoid\n\tcolor = agxDefaultContrastApprox( color );\n\n\t// Apply AgX look\n\t// v = agxLook(v, look);\n\n\tcolor = AgXOutsetMatrix * color;\n\n\t// Linearize\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\n\t// Gamut mapping. Simple clamp for now.\n\tcolor = clamp( color, 0.0, 1.0 );\n\n\treturn color;\n\n}\n\n// https://modelviewer.dev/examples/tone-mapping\n\nvec3 NeutralToneMapping( vec3 color ) {\n\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\n\tcolor *= toneMappingExposure;\n\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\n\tcolor -= offset;\n\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\n\tif ( peak < StartCompression ) return color;\n\n\tfloat d = 1. - StartCompression;\n\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\n\tcolor *= newPeak / peak;\n\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\n\treturn mix( color, vec3( newPeak ), g );\n\n}\n\nvec3 CustomToneMapping( vec3 color ) { return color; }\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts deleted file mode 100644 index 5fa885d5f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_TRANSMISSION\n\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\n\t#endif\n\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );\n\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts deleted file mode 100644 index a96404940..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#ifdef USE_TRANSMISSION\n\n\t// Transmission code is based on glTF-Sampler-Viewer\n\t// https://github.com/KhronosGroup/glTF-Sample-Viewer\n\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\n\t#ifdef USE_TRANSMISSIONMAP\n\n\t\tuniform sampler2D transmissionMap;\n\n\t#endif\n\n\t#ifdef USE_THICKNESSMAP\n\n\t\tuniform sampler2D thicknessMap;\n\n\t#endif\n\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\n\tvarying vec3 vWorldPosition;\n\n\t// Mipped Bicubic Texture Filtering by N8\n\t// https://www.shadertoy.com/view/Dl2SDW\n\n\tfloat w0( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w1( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\n\t}\n\n\tfloat w2( float a ){\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\n\t}\n\n\tfloat w3( float a ) {\n\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\n\t}\n\n\t// g0 and g1 are the two amplitude functions\n\tfloat g0( float a ) {\n\n\t\treturn w0( a ) + w1( a );\n\n\t}\n\n\tfloat g1( float a ) {\n\n\t\treturn w2( a ) + w3( a );\n\n\t}\n\n\t// h0 and h1 are the two offset functions\n\tfloat h0( float a ) {\n\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\n\t}\n\n\tfloat h1( float a ) {\n\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\n\t}\n\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\n\t\tuv = uv * texelSize.zw + 0.5;\n\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\n\t}\n\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\n\t}\n\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\n\t\t// Direction of refracted light.\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\n\t\t// Compute rotation-independent scaling of the model matrix.\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\n\t\t// The thickness is specified in local space.\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\n\t}\n\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\n\t\t// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and\n\t\t// an IOR of 1.5 results in the default amount of microfacet refraction.\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\n\t}\n\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\n\t}\n\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tif ( isinf( attenuationDistance ) ) {\n\n\t\t\t// Attenuation distance is +\u221E, i.e. the transmitted color is not attenuated at all.\n\t\t\treturn vec3( 1.0 );\n\n\t\t} else {\n\n\t\t\t// Compute light attenuation using Beer's law.\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); // Beer's law\n\t\t\treturn transmittance;\n\n\t\t}\n\n\t}\n\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\n\t\t#ifdef USE_DISPERSION\n\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\n\t\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\n\t\t\t}\n\n\t\t\ttransmittedLight.a /= 3.0;\n\n\t\t#else\n\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\n\t\t\t// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\n\t\t\t// Sample framebuffer to get pixel the refracted ray hits.\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\n\t\t#endif\n\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\n\t\t// Get the specular component.\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\n\t\t// As less light is transmitted, the opacity should be increased. This simple approximation does a decent job\n\t\t// of modulating a CSS background, and has no effect when the buffer is opaque, due to a solid object or clear color.\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\n\t}\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts deleted file mode 100644 index aa5001c0e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_fragment.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts deleted file mode 100644 index 5439faba3..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_pars_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvarying vec2 vUv;\n\n#endif\n#ifdef USE_MAP\n\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n\n#endif\n#ifdef USE_AOMAP\n\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts deleted file mode 100644 index 62229e16f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/uv_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\n\tvUv = vec3( uv, 1 ).xy;\n\n#endif\n#ifdef USE_MAP\n\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ALPHAMAP\n\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_LIGHTMAP\n\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_AOMAP\n\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_BUMPMAP\n\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_NORMALMAP\n\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_EMISSIVEMAP\n\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_METALNESSMAP\n\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ROUGHNESSMAP\n\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_ANISOTROPYMAP\n\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOATMAP\n\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULARMAP\n\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n\n#endif\n#ifdef USE_THICKNESSMAP\n\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts deleted file mode 100644 index 83ecd5b37..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: "\n#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t#ifdef USE_BATCHING\n\n\t\tworldPosition = batchingMatrix * worldPosition;\n\n\t#endif\n\n\t#ifdef USE_INSTANCING\n\n\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t#endif\n\n\tworldPosition = modelMatrix * worldPosition;\n\n#endif\n"; -export default _default; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts deleted file mode 100644 index 7aeb3f49e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export namespace ShaderLib { - namespace physical { - let uniforms: Object; - let vertexShader: string; - let fragmentShader: string; - } -} diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts deleted file mode 100644 index 28f6e3d08..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/background.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nvarying vec2 vUv;\nuniform mat3 uvTransform;\n\nvoid main() {\n\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n\n}\n"; -export const fragment: "\nuniform sampler2D t2D;\nuniform float backgroundIntensity;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tvec4 texColor = texture2D( t2D, vUv );\n\n\t#ifdef DECODE_VIDEO_TEXTURE\n\n\t\t// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures\n\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts deleted file mode 100644 index 1e2625bfe..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/backgroundCube.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n"; -export const fragment: "\n\n#ifdef ENVMAP_TYPE_CUBE\n\n\tuniform samplerCube envMap;\n\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\tuniform sampler2D envMap;\n\n#endif\n\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\t#ifdef ENVMAP_TYPE_CUBE\n\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\n\t#else\n\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t#endif\n\n\ttexColor.rgb *= backgroundIntensity;\n\n\tgl_FragColor = texColor;\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts deleted file mode 100644 index 1db8a9081..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/cube.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n}\n"; -export const fragment: "\nuniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\n\nvarying vec3 vWorldDirection;\n\nvoid main() {\n\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts deleted file mode 100644 index b3c2e87e5..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/depth.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// This is used for computing an equivalent of gl_FragCoord.z that is as high precision as possible.\n// Some platforms compute gl_FragCoord at a lower precision which makes the manually computed value better for\n// depth-based postprocessing effects. Reproduced on iPad with A10 processor / iPadOS 13.3.1.\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvHighPrecisionZW = gl_Position.zw;\n\n}\n"; -export const fragment: "\n#if DEPTH_PACKING == 3200\n\n\tuniform float opacity;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvarying vec2 vHighPrecisionZW;\n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\n\t#if DEPTH_PACKING == 3200\n\n\t\tdiffuseColor.a = opacity;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\n\t// Higher precision equivalent of gl_FragCoord.z\n\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\n\t#else\n\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\n\t#endif\n\n\t#if DEPTH_PACKING == 3200\n\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\n\t#elif DEPTH_PACKING == 3201\n\n\t\t// TODO Deprecate\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\n\t#elif DEPTH_PACKING == 3202\n\n\t\t// TODO Deprecate\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\n\t#elif DEPTH_PACKING == 3203\n\n\t\t// TODO Deprecate\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\n\t#endif\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts deleted file mode 100644 index 0c5024b11..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/distance.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#define DISTANCE\n\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\n\t#include \n\n\t#ifdef USE_DISPLACEMENTMAP\n\n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvWorldPosition = worldPosition.xyz;\n\n}\n"; -export const fragment: "\n#define DISTANCE\n\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist ); // clamp to [ 0, 1 ]\n\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts deleted file mode 100644 index 4e98c6662..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/equirect.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t#include \n\t#include \n\n}\n"; -export const fragment: "\nuniform sampler2D tEquirect;\n\nvarying vec3 vWorldDirection;\n\n#include \n\nvoid main() {\n\n\tvec3 direction = normalize( vWorldDirection );\n\n\tvec2 sampleUV = equirectUv( direction );\n\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts deleted file mode 100644 index 765f1bb14..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/linedashed.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvLineDistance = scale * lineDistance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n\t\tdiscard;\n\n\t}\n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb; // simple shader\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts deleted file mode 100644 index 23471acee..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshbasic.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\n\n\tvarying vec3 vNormal;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\n\t// accumulation (baked indirect lighting only)\n\t#ifdef USE_LIGHTMAP\n\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\n\t#else\n\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\n\t#endif\n\n\t// modulation\n\t#include \n\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts deleted file mode 100644 index 698ee0dd6..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshlambert.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#define LAMBERT\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\n#define LAMBERT\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts deleted file mode 100644 index a2e4cbe2e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshmatcap.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#define MATCAP\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n}\n"; -export const fragment: "\n#define MATCAP\n\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; // 0.495 to remove artifacts caused by undersized matcap disks\n\n\t#ifdef USE_MATCAP\n\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\n\t#else\n\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); // default if matcap is missing\n\n\t#endif\n\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts deleted file mode 100644 index 1961afdbe..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshnormal.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#define NORMAL\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvViewPosition = - mvPosition.xyz;\n\n#endif\n\n}\n"; -export const fragment: "\n#define NORMAL\n\nuniform float opacity;\n\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\n\tvarying vec3 vViewPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\n\t#ifdef OPAQUE\n\n\t\tgl_FragColor.a = 1.0;\n\n\t#endif\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts deleted file mode 100644 index 22dc16023..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphong.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#define PHONG\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\n#define PHONG\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts deleted file mode 100644 index 9cbf95666..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshphysical.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#define STANDARD\n\nvarying vec3 vViewPosition;\n\n#ifdef USE_TRANSMISSION\n\n\tvarying vec3 vWorldPosition;\n\n#endif\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n#ifdef USE_TRANSMISSION\n\n\tvWorldPosition = worldPosition.xyz;\n\n#endif\n}\n"; -export const fragment: "\n#define STANDARD\n\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n\n#ifdef IOR\n\tuniform float ior;\n#endif\n\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n\n#ifdef USE_RETROREFLECTION\n\tuniform float retroreflectivity;\n#endif\n\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\n\t#include \n\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\n\t#ifdef USE_CLEARCOAT\n\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts deleted file mode 100644 index bccb5d045..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/meshtoon.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#define TOON\n\nvarying vec3 vViewPosition;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tvViewPosition = - mvPosition.xyz;\n\n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\n#define TOON\n\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// accumulation\n\t#include \n\t#include \n\t#include \n\t#include \n\n\t// modulation\n\t#include \n\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts deleted file mode 100644 index 384b2516f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/points.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nuniform float size;\nuniform float scale;\n\n#include \n#include \n#include \n#include \n#include \n#include \n\n#ifdef USE_POINTS_UV\n\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n\n#endif\n\nvoid main() {\n\n\t#ifdef USE_POINTS_UV\n\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\tgl_PointSize = size;\n\n\t#ifdef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\n\t#endif\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts deleted file mode 100644 index 49c051900..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/shadow.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\nuniform vec3 color;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts deleted file mode 100644 index 921ca31df..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/sprite.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nuniform float rotation;\nuniform vec2 center;\n\n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\t#include \n\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\n\t#ifndef USE_SIZEATTENUATION\n\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\n\t#endif\n\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\n\tmvPosition.xy += rotatedPosition;\n\n\tgl_Position = projectionMatrix * mvPosition;\n\n\t#include \n\t#include \n\t#include \n\n}\n"; -export const fragment: "\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid main() {\n\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\n\tvec3 outgoingLight = vec3( 0.0 );\n\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\n\toutgoingLight = diffuseColor.rgb;\n\n\t#include \n\t#include \n\t#include \n\t#include \n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts deleted file mode 100644 index b19167e8f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/ShaderLib/vsm.glsl.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const vertex: "\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}\n"; -export const fragment: "\nuniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n\nvoid main() {\n\n\tconst float samples = float( VSM_SAMPLES );\n\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\n\t\t#ifdef HORIZONTAL_PASS\n\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\n\t\t#else\n\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\n\t\t#endif\n\n\t}\n\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n\n}\n"; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts deleted file mode 100644 index 8918d7709..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsLib.d.ts +++ /dev/null @@ -1,485 +0,0 @@ -export namespace UniformsLib { - namespace common { - namespace diffuse { - let value: Color; - } - namespace opacity { - let value_1: number; - export { value_1 as value }; - } - namespace map { - let value_2: null; - export { value_2 as value }; - } - namespace mapTransform { - let value_3: Matrix3; - export { value_3 as value }; - } - namespace alphaMap { - let value_4: null; - export { value_4 as value }; - } - namespace alphaMapTransform { - let value_5: Matrix3; - export { value_5 as value }; - } - namespace alphaTest { - let value_6: number; - export { value_6 as value }; - } - } - namespace specularmap { - namespace specularMap { - let value_7: null; - export { value_7 as value }; - } - namespace specularMapTransform { - let value_8: Matrix3; - export { value_8 as value }; - } - } - namespace envmap { - namespace envMap { - let value_9: null; - export { value_9 as value }; - } - namespace envMapRotation { - let value_10: Matrix3; - export { value_10 as value }; - } - namespace reflectivity { - let value_11: number; - export { value_11 as value }; - } - namespace ior { - let value_12: number; - export { value_12 as value }; - } - namespace refractionRatio { - let value_13: number; - export { value_13 as value }; - } - namespace dfgLUT { - let value_14: null; - export { value_14 as value }; - } - } - namespace aomap { - namespace aoMap { - let value_15: null; - export { value_15 as value }; - } - namespace aoMapIntensity { - let value_16: number; - export { value_16 as value }; - } - namespace aoMapTransform { - let value_17: Matrix3; - export { value_17 as value }; - } - } - namespace lightmap { - namespace lightMap { - let value_18: null; - export { value_18 as value }; - } - namespace lightMapIntensity { - let value_19: number; - export { value_19 as value }; - } - namespace lightMapTransform { - let value_20: Matrix3; - export { value_20 as value }; - } - } - namespace bumpmap { - namespace bumpMap { - let value_21: null; - export { value_21 as value }; - } - namespace bumpMapTransform { - let value_22: Matrix3; - export { value_22 as value }; - } - namespace bumpScale { - let value_23: number; - export { value_23 as value }; - } - } - namespace normalmap { - namespace normalMap { - let value_24: null; - export { value_24 as value }; - } - namespace normalMapTransform { - let value_25: Matrix3; - export { value_25 as value }; - } - namespace normalScale { - let value_26: Vector2; - export { value_26 as value }; - } - } - namespace displacementmap { - namespace displacementMap { - let value_27: null; - export { value_27 as value }; - } - namespace displacementMapTransform { - let value_28: Matrix3; - export { value_28 as value }; - } - namespace displacementScale { - let value_29: number; - export { value_29 as value }; - } - namespace displacementBias { - let value_30: number; - export { value_30 as value }; - } - } - namespace emissivemap { - namespace emissiveMap { - let value_31: null; - export { value_31 as value }; - } - namespace emissiveMapTransform { - let value_32: Matrix3; - export { value_32 as value }; - } - } - namespace metalnessmap { - namespace metalnessMap { - let value_33: null; - export { value_33 as value }; - } - namespace metalnessMapTransform { - let value_34: Matrix3; - export { value_34 as value }; - } - } - namespace roughnessmap { - namespace roughnessMap { - let value_35: null; - export { value_35 as value }; - } - namespace roughnessMapTransform { - let value_36: Matrix3; - export { value_36 as value }; - } - } - namespace gradientmap { - namespace gradientMap { - let value_37: null; - export { value_37 as value }; - } - } - namespace fog { - namespace fogDensity { - let value_38: number; - export { value_38 as value }; - } - namespace fogNear { - let value_39: number; - export { value_39 as value }; - } - namespace fogFar { - let value_40: number; - export { value_40 as value }; - } - namespace fogColor { - let value_41: Color; - export { value_41 as value }; - } - } - namespace lights { - namespace ambientLightColor { - let value_42: never[]; - export { value_42 as value }; - } - namespace lightProbe { - let value_43: never[]; - export { value_43 as value }; - } - namespace sunLights { - let value_44: never[]; - export { value_44 as value }; - export namespace properties { - let direction: {}; - let color: {}; - } - } - namespace sunLightShadows { - let value_45: never[]; - export { value_45 as value }; - export namespace properties_1 { - let shadowIntensity: number; - let shadowBias: {}; - let shadowNormalBias: {}; - let shadowRadius: {}; - let shadowMapSize: {}; - } - export { properties_1 as properties }; - } - namespace sunShadowMatrix { - let value_46: never[]; - export { value_46 as value }; - } - namespace sunShadowCascade { - let value_47: never[]; - export { value_47 as value }; - } - namespace directionalLights { - let value_48: never[]; - export { value_48 as value }; - export namespace properties_2 { - let direction_1: {}; - export { direction_1 as direction }; - let color_1: {}; - export { color_1 as color }; - } - export { properties_2 as properties }; - } - namespace directionalLightShadows { - let value_49: never[]; - export { value_49 as value }; - export namespace properties_3 { - let shadowIntensity_1: number; - export { shadowIntensity_1 as shadowIntensity }; - let shadowBias_1: {}; - export { shadowBias_1 as shadowBias }; - let shadowNormalBias_1: {}; - export { shadowNormalBias_1 as shadowNormalBias }; - let shadowRadius_1: {}; - export { shadowRadius_1 as shadowRadius }; - let shadowMapSize_1: {}; - export { shadowMapSize_1 as shadowMapSize }; - } - export { properties_3 as properties }; - } - namespace directionalShadowMatrix { - let value_50: never[]; - export { value_50 as value }; - } - namespace spotLights { - let value_51: never[]; - export { value_51 as value }; - export namespace properties_4 { - let color_2: {}; - export { color_2 as color }; - export let position: {}; - let direction_2: {}; - export { direction_2 as direction }; - export let distance: {}; - export let coneCos: {}; - export let penumbraCos: {}; - export let decay: {}; - } - export { properties_4 as properties }; - } - namespace spotLightShadows { - let value_52: never[]; - export { value_52 as value }; - export namespace properties_5 { - let shadowIntensity_2: number; - export { shadowIntensity_2 as shadowIntensity }; - let shadowBias_2: {}; - export { shadowBias_2 as shadowBias }; - let shadowNormalBias_2: {}; - export { shadowNormalBias_2 as shadowNormalBias }; - let shadowRadius_2: {}; - export { shadowRadius_2 as shadowRadius }; - let shadowMapSize_2: {}; - export { shadowMapSize_2 as shadowMapSize }; - } - export { properties_5 as properties }; - } - namespace spotLightMap { - let value_53: never[]; - export { value_53 as value }; - } - namespace spotLightMatrix { - let value_54: never[]; - export { value_54 as value }; - } - namespace pointLights { - let value_55: never[]; - export { value_55 as value }; - export namespace properties_6 { - let color_3: {}; - export { color_3 as color }; - let position_1: {}; - export { position_1 as position }; - let decay_1: {}; - export { decay_1 as decay }; - let distance_1: {}; - export { distance_1 as distance }; - } - export { properties_6 as properties }; - } - namespace pointLightShadows { - let value_56: never[]; - export { value_56 as value }; - export namespace properties_7 { - let shadowIntensity_3: number; - export { shadowIntensity_3 as shadowIntensity }; - let shadowBias_3: {}; - export { shadowBias_3 as shadowBias }; - let shadowNormalBias_3: {}; - export { shadowNormalBias_3 as shadowNormalBias }; - let shadowRadius_3: {}; - export { shadowRadius_3 as shadowRadius }; - let shadowMapSize_3: {}; - export { shadowMapSize_3 as shadowMapSize }; - export let shadowCameraNear: {}; - export let shadowCameraFar: {}; - } - export { properties_7 as properties }; - } - namespace pointShadowMatrix { - let value_57: never[]; - export { value_57 as value }; - } - namespace hemisphereLights { - let value_58: never[]; - export { value_58 as value }; - export namespace properties_8 { - let direction_3: {}; - export { direction_3 as direction }; - export let skyColor: {}; - export let groundColor: {}; - } - export { properties_8 as properties }; - } - namespace rectAreaLights { - let value_59: never[]; - export { value_59 as value }; - export namespace properties_9 { - let color_4: {}; - export { color_4 as color }; - let position_2: {}; - export { position_2 as position }; - export let width: {}; - export let height: {}; - } - export { properties_9 as properties }; - } - namespace ltc_1 { - let value_60: null; - export { value_60 as value }; - } - namespace ltc_2 { - let value_61: null; - export { value_61 as value }; - } - namespace probesSH { - let value_62: null; - export { value_62 as value }; - } - namespace probesMin { - let value_63: Vector3; - export { value_63 as value }; - } - namespace probesMax { - let value_64: Vector3; - export { value_64 as value }; - } - namespace probesResolution { - let value_65: Vector3; - export { value_65 as value }; - } - } - namespace points { - export namespace diffuse_1 { - let value_66: Color; - export { value_66 as value }; - } - export { diffuse_1 as diffuse }; - export namespace opacity_1 { - let value_67: number; - export { value_67 as value }; - } - export { opacity_1 as opacity }; - export namespace size { - let value_68: number; - export { value_68 as value }; - } - export namespace scale { - let value_69: number; - export { value_69 as value }; - } - export namespace map_1 { - let value_70: null; - export { value_70 as value }; - } - export { map_1 as map }; - export namespace alphaMap_1 { - let value_71: null; - export { value_71 as value }; - } - export { alphaMap_1 as alphaMap }; - export namespace alphaMapTransform_1 { - let value_72: Matrix3; - export { value_72 as value }; - } - export { alphaMapTransform_1 as alphaMapTransform }; - export namespace alphaTest_1 { - let value_73: number; - export { value_73 as value }; - } - export { alphaTest_1 as alphaTest }; - export namespace uvTransform { - let value_74: Matrix3; - export { value_74 as value }; - } - } - namespace sprite { - export namespace diffuse_2 { - let value_75: Color; - export { value_75 as value }; - } - export { diffuse_2 as diffuse }; - export namespace opacity_2 { - let value_76: number; - export { value_76 as value }; - } - export { opacity_2 as opacity }; - export namespace center { - let value_77: Vector2; - export { value_77 as value }; - } - export namespace rotation { - let value_78: number; - export { value_78 as value }; - } - export namespace map_2 { - let value_79: null; - export { value_79 as value }; - } - export { map_2 as map }; - export namespace mapTransform_1 { - let value_80: Matrix3; - export { value_80 as value }; - } - export { mapTransform_1 as mapTransform }; - export namespace alphaMap_2 { - let value_81: null; - export { value_81 as value }; - } - export { alphaMap_2 as alphaMap }; - export namespace alphaMapTransform_2 { - let value_82: Matrix3; - export { value_82 as value }; - } - export { alphaMapTransform_2 as alphaMapTransform }; - export namespace alphaTest_2 { - let value_83: number; - export { value_83 as value }; - } - export { alphaTest_2 as alphaTest }; - } -} -import { Color } from '../../math/Color.js'; -import { Matrix3 } from '../../math/Matrix3.js'; -import { Vector2 } from '../../math/Vector2.js'; -import { Vector3 } from '../../math/Vector3.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts deleted file mode 100644 index 2789a045c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/shaders/UniformsUtils.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Provides utility functions for managing uniforms. - * - * @module UniformsUtils - */ -/** - * Clones the given uniform definitions by performing a deep-copy. That means - * if the value of a uniform refers to an object like a Vector3 or Texture, - * the cloned uniform will refer to a new object reference. - * - * @param {Object} src - An object representing uniform definitions. - * @return {Object} The cloned uniforms. - */ -export function cloneUniforms(src: Object): Object; -/** - * Merges the given uniform definitions into a single object. Since the - * method internally uses cloneUniforms(), it performs a deep-copy when - * producing the merged uniform definitions. - * - * @param {Array} uniforms - An array of objects containing uniform definitions. - * @return {Object} The merged uniforms. - */ -export function mergeUniforms(uniforms: any[]): Object; -export function cloneUniformsGroups(src: any): any[]; -export function getUnlitUniformColorSpace(renderer: any): any; -export namespace UniformsUtils { - export { cloneUniforms as clone }; - export { mergeUniforms as merge }; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts deleted file mode 100644 index 1e7af83d2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBackend.d.ts +++ /dev/null @@ -1,657 +0,0 @@ -export default WebGLBackend; -/** - * A backend implementation targeting WebGL 2. - * - * @private - * @augments Backend - */ -declare class WebGLBackend extends Backend { - /** - * WebGLBackend options. - * - * @typedef {Object} WebGLBackend~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. - * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. - * @property {WebGL2RenderingContext} [context=undefined] - A WebGL 2 rendering context. - */ - /** - * Constructs a new WebGPU backend. - * - * @param {WebGLBackend~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGLBackend: boolean; - /** - * A reference to a backend module holding shader attribute-related - * utility functions. - * - * @type {?WebGLAttributeUtils} - * @default null - */ - attributeUtils: WebGLAttributeUtils | null; - /** - * A reference to a backend module holding extension-related - * utility functions. - * - * @type {?WebGLExtensions} - * @default null - */ - extensions: WebGLExtensions | null; - /** - * A reference to a backend module holding capability-related - * utility functions. - * - * @type {?WebGLCapabilities} - * @default null - */ - capabilities: WebGLCapabilities | null; - /** - * A reference to a backend module holding texture-related - * utility functions. - * - * @type {?WebGLTextureUtils} - * @default null - */ - textureUtils: WebGLTextureUtils | null; - /** - * A reference to a backend module holding renderer-related - * utility functions. - * - * @type {?WebGLBufferRenderer} - * @default null - */ - bufferRenderer: WebGLBufferRenderer | null; - /** - * A reference to the rendering context. - * - * @type {?WebGL2RenderingContext} - * @default null - */ - gl: WebGL2RenderingContext | null; - /** - * A reference to a backend module holding state-related - * utility functions. - * - * @type {?WebGLState} - * @default null - */ - state: WebGLState | null; - /** - * A reference to a backend module holding common - * utility functions. - * - * @type {?WebGLUtils} - * @default null - */ - utils: WebGLUtils | null; - /** - * Dictionary for caching VAOs. - * - * @type {Object} - */ - vaoCache: { - [x: string]: WebGLVertexArrayObject; - }; - /** - * Dictionary for caching transform feedback objects. - * - * @type {Object} - */ - transformFeedbackCache: { - [x: string]: WebGLTransformFeedback; - }; - /** - * Controls if `gl.RASTERIZER_DISCARD` should be enabled or not. - * Only relevant when using compute shaders. - * - * @type {boolean} - * @default false - */ - discard: boolean; - /** - * A reference to the `EXT_disjoint_timer_query_webgl2` extension. `null` if the - * device does not support the extension. - * - * @type {?EXTDisjointTimerQueryWebGL2} - * @default null - */ - disjoint: EXTDisjointTimerQueryWebGL2 | null; - /** - * A reference to the `KHR_parallel_shader_compile` extension. `null` if the - * device does not support the extension. - * - * @type {?KHRParallelShaderCompile} - * @default null - */ - parallel: KHRParallelShaderCompile | null; - /** - * A reference to the current render context. - * - * @private - * @type {RenderContext} - * @default null - */ - private _currentContext; - /** - * A unique collection of bindings. - * - * @private - * @type {WeakSet>} - */ - private _knownBindings; - /** - * Whether the device supports framebuffers invalidation or not. - * - * @private - * @type {boolean} - */ - private _supportsInvalidateFramebuffer; - /** - * The target framebuffer when rendering with - * the WebXR device API. - * - * @private - * @type {?WebGLFramebuffer} - * @default null - */ - private _xrFramebuffer; - /** - * Initializes the backend so it is ready for usage. - * - * @param {Renderer} renderer - The renderer. - */ - init(renderer: Renderer): void; - _onContextLost: ((event: any) => void) | undefined; - drawBuffersIndexedExt: Object | undefined; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @param {number} offset - The storage buffer attribute. - * @param {number} count - The offset from which to start reading the - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Ensures the backend is XR compatible. - * - * @async - * @return {Promise} A Promise that resolve when the renderer is XR compatible. - */ - makeXRCompatible(): Promise; - /** - * Sets the XR rendering destination. - * - * @param {WebGLFramebuffer} xrFramebuffer - The XR framebuffer. - */ - setXRTarget(xrFramebuffer: WebGLFramebuffer): void; - /** - * Configures the given XR render target with external textures. - * - * This method is only relevant when using the WebXR Layers API. - * - * @param {XRRenderTarget} renderTarget - The XR render target. - * @param {WebGLTexture} colorTexture - A native color texture. - * @param {?WebGLTexture} [depthTexture=null] - A native depth texture. - */ - setXRRenderTargetTextures(renderTarget: XRRenderTarget, colorTexture: WebGLTexture, depthTexture?: WebGLTexture | null): void; - /** - * Inits a time stamp query for the given render context. - * - * @param {string} type - The type of the timestamp query. - * @param {string} uid - A unique identifier for the timestamp query. - */ - initTimestampQuery(type: string, uid: string): void; - /** - * Prepares the timestamp buffer. - * - * @param {string} type - The type of the timestamp query. - * @param {string} uid - A unique identifier for the timestamp query. - */ - prepareTimestampBuffer(type: string, uid: string): void; - /** - * Returns the backend's rendering context. - * - * @return {WebGL2RenderingContext} The rendering context. - */ - getContext(): WebGL2RenderingContext; - /** - * This method is executed at the beginning of a render call and prepares - * the WebGL state for upcoming render calls - * - * @param {RenderContext} renderContext - The render context. - */ - beginRender(renderContext: RenderContext): void; - /** - * This method is executed at the end of a render call and finalizes work - * after draw calls. - * - * @param {RenderContext} renderContext - The render context. - */ - finishRender(renderContext: RenderContext): void; - /** - * This method processes the result of occlusion queries and writes it - * into render context data. - * - * @async - * @param {RenderContext} renderContext - The render context. - */ - resolveOccludedAsync(renderContext: RenderContext): void; - /** - * Returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(renderContext: RenderContext, object: Object3D): boolean; - /** - * Updates the viewport with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateViewport(renderContext: RenderContext): void; - /** - * Updates the scissor with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateScissor(renderContext: RenderContext): void; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Returns the clear color and alpha into a single - * color object. - * - * @return {Color4} The clear color. - */ - getClearColor(): Color4; - /** - * Performs a clear operation. - * - * @param {boolean} color - Whether the color buffer should be cleared or not. - * @param {boolean} depth - Whether the depth buffer should be cleared or not. - * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. - * @param {?Object} [descriptor=null] - The render context of the current set render target. - * @param {boolean} [setFrameBuffer=true] - Controls whether the intermediate framebuffer should be set or not. - * @param {boolean} [resolveRenderTarget=true] - Controls whether an active render target should be resolved - * or not. Only relevant for explicit clears. - */ - clear(color: boolean, depth: boolean, stencil: boolean, descriptor?: Object | null, setFrameBuffer?: boolean, resolveRenderTarget?: boolean): void; - /** - * This method is executed at the beginning of a compute call and - * prepares the state for upcoming compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - beginCompute(computeGroup: Node | Array): void; - /** - * Executes a compute command for the given compute node. - * - * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. - * @param {Node} computeNode - The compute node. - * @param {Array} bindings - The bindings. - * @param {ComputePipeline} pipeline - The compute pipeline. - * @param {?number} [count=null] - The count of compute invocations. If `null`, the count is determined by the compute node. - */ - compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, count?: number | null): void; - /** - * This method is executed at the end of a compute call and - * finalizes work after compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - finishCompute(computeGroup: Node | Array): void; - /** - * Internal to determine if the current render target is a render target array with depth 2D array texture. - * - * @param {RenderContext} renderContext - The render context. - * @return {boolean} Whether the render target is a render target array with depth 2D array texture. - * - * @private - */ - private _isRenderCameraDepthArray; - /** - * Internal draw function. - * - * @private - * @param {Object3D} object - The object to render. - * @param {WebGLBufferRenderer} renderer - The internal renderer. - * @param {number} firstVertex - The first vertex to render. - * @param {number} vertexCount - The vertex count. - * @param {number} instanceCount - The intance count. - * @param {WebGLProgram} programGPU - The raw WebGL shader program. - */ - private _draw; - /** - * Executes a draw command for the given render object. - * - * @param {RenderObject} renderObject - The render object to draw. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - */ - draw(renderObject: RenderObject): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(texture: Texture): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(texture: Texture, options?: Object): void; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - */ - generateMipmaps(texture: Texture): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Returns a node builder for the given render object. - * - * @param {RenderObject} object - The render object. - * @param {Renderer} renderer - The renderer. - * @return {GLSLNodeBuilder} The node builder. - */ - createNodeBuilder(object: RenderObject, renderer: Renderer): GLSLNodeBuilder; - /** - * Creates a shader program from the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - createProgram(program: ProgrammableStage): void; - /** - * Destroys the shader program of the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - destroyProgram(program: ProgrammableStage): void; - /** - * Creates a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(renderObject: RenderObject, promises: Array>): void; - /** - * Formats the source code of error messages. - * - * @private - * @param {string} string - The code. - * @param {number} errorLine - The error line. - * @return {string} The formatted code. - */ - private _handleSource; - /** - * Gets the shader compilation errors from the info log. - * - * @private - * @param {WebGL2RenderingContext} gl - The rendering context. - * @param {WebGLShader} shader - The WebGL shader object. - * @param {string} type - The shader type. - * @return {string} The shader errors. - */ - private _getShaderErrors; - /** - * Logs shader compilation errors. - * - * @private - * @param {WebGLProgram} programGPU - The WebGL program. - * @param {WebGLShader} glFragmentShader - The fragment shader as a native WebGL shader object. - * @param {WebGLShader} glVertexShader - The vertex shader as a native WebGL shader object. - */ - private _logProgramError; - /** - * Completes the shader program setup for the given render object. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {RenderPipeline} pipeline - The render pipeline. - */ - private _completeCompile; - /** - * Creates a compute pipeline for the given compute node. - * - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; - /** - * Completes the compute pipeline setup for the given compute pipeline. - * - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - Array of bind groups. - */ - _completeComputeCompile(computePipeline: ComputePipeline, bindings: Array): void; - /** - * Creates bindings from the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(bindGroup: BindGroup, bindings: Array): void; - /** - * Updates the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - updateBindings(bindGroup: BindGroup): void; - /** - * Updates a buffer binding. - * - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(binding: Buffer): void; - /** - * Creates a uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - createUniformBuffer(uniformBuffer: Buffer): void; - /** - * Destroys the GPU data for the given uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - destroyUniformBuffer(uniformBuffer: Buffer): void; - /** - * Creates the GPU buffer of an indexed shader attribute. - * - * @param {BufferAttribute} attribute - The indexed buffer attribute. - */ - createIndexAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a storage attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createStorageAttribute(attribute: BufferAttribute): void; - /** - * Updates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to update. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * Destroys the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to destroy. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * Checks if the given feature is supported by the backend. - * - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(name: string): boolean; - /** - * Copies data of the given source texture to the given destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; - /** - * Checks if the given compatibility is supported by the backend. - * - * @param {string} name - The compatibility name. - * @return {boolean} Whether the compatibility is supported or not. - */ - hasCompatibility(name: string): boolean; - /** - * Initializes the render target defined in the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - initRenderTarget(renderContext: RenderContext): void; - /** - * Configures the active framebuffer from the given render context. - * - * @private - * @param {RenderContext} descriptor - The render context. - */ - private _setFramebuffer; - /** - * Computes the VAO key for the given index and attributes. - * - * @private - * @param {Array} attributes - An array of buffer attributes. - * @return {string} The VAO key. - */ - private _getVaoKey; - /** - * Creates a VAO from the index and attributes. - * - * @private - * @param {Array} attributes - An array of buffer attributes. - * @return {Object} The VAO data. - */ - private _createVao; - /** - * Creates a transform feedback from the given transform buffers. - * - * @private - * @param {Array} transformBuffers - The transform buffers. - * @return {WebGLTransformFeedback} The transform feedback. - */ - private _getTransformFeedback; - /** - * Setups the given bindings. - * - * @private - * @param {Array} bindings - The bindings. - * @param {WebGLProgram} programGPU - The WebGL program. - */ - private _setupBindings; - /** - * Binds the given uniforms. - * - * @private - * @param {Array} bindings - The bindings. - */ - private _bindUniforms; - /** - * The method ensures multisampled render targets are resolved. - * - * @private - * @param {RenderContext} renderContext - The render context. - */ - private _resolveRenderTarget; - /** - * Returns `true` if the `WEBGL_multisampled_render_to_texture` extension - * should be used when MSAA is enabled. - * - * @private - * @param {RenderTarget} renderTarget - The render target that should be multisampled. - * @return {boolean} Whether to use the `WEBGL_multisampled_render_to_texture` extension for MSAA or not. - */ - private _useMultisampledExtension; -} -import Backend from '../common/Backend.js'; -import WebGLAttributeUtils from './utils/WebGLAttributeUtils.js'; -import WebGLExtensions from './utils/WebGLExtensions.js'; -import WebGLCapabilities from './utils/WebGLCapabilities.js'; -import WebGLTextureUtils from './utils/WebGLTextureUtils.js'; -import { WebGLBufferRenderer } from './WebGLBufferRenderer.js'; -import WebGLState from './utils/WebGLState.js'; -import WebGLUtils from './utils/WebGLUtils.js'; -import GLSLNodeBuilder from './nodes/GLSLNodeBuilder.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts deleted file mode 100644 index c297252cb..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/WebGLBufferRenderer.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -export class WebGLBufferRenderer { - constructor(backend: any); - gl: any; - extensions: any; - info: any; - mode: any; - index: number; - type: any; - object: any; - render(start: any, count: any): void; - renderInstances(start: any, count: any, primcount: any): void; - renderMultiDraw(starts: any, counts: any, drawCount: any): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts deleted file mode 100644 index ac6f8fd77..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.d.ts +++ /dev/null @@ -1,402 +0,0 @@ -export default GLSLNodeBuilder; -/** - * A node builder targeting GLSL. - * - * This module generates GLSL shader code from node materials and also - * generates the respective bindings and vertex buffer definitions. These - * data are later used by the renderer to create render and compute pipelines - * for render objects. - * - * @augments NodeBuilder - */ -declare class GLSLNodeBuilder extends NodeBuilder { - /** - * Constructs a new GLSL node builder renderer. - * - * @param {Object3D} object - The 3D object. - * @param {Renderer} renderer - The renderer. - */ - constructor(object: Object3D, renderer: Renderer); - /** - * A dictionary holds for each shader stage ('vertex', 'fragment', 'compute') - * another dictionary which manages UBOs per group ('render','frame','object'). - * - * @type {Object>} - */ - uniformGroups: { - [x: string]: { - [x: string]: NodeUniformsGroup; - }; - }; - /** - * An array that holds objects defining the varying and attribute data in - * context of Transform Feedback. - * - * @type {Array>} - */ - transforms: Array<{ - [x: string]: AttributeNode | string; - }>; - /** - * A dictionary that holds for each shader stage a Map of used extensions. - * - * @type {Object>} - */ - extensions: { - [x: string]: Map; - }; - /** - * A dictionary that holds for each shader stage an Array of used builtins. - * - * @type {Object>} - */ - builtins: { - [x: string]: string[]; - }; - /** - * Checks if the given texture requires a manual conversion to the working color space. - * - * @param {Texture} texture - The texture to check. - * @return {boolean} Whether the given texture requires a conversion to working color space or not. - */ - needsToWorkingColorSpace(texture: Texture): boolean; - /** - * Includes the given method name into the current - * function node. - * - * @private - * @param {string} name - The method name to include. - * @return {CodeNode} The respective code node. - */ - private _include; - /** - * Returns the bitcast method name for a given input and outputType. - * - * @param {string} type - The output type to bitcast to. - * @param {string} inputType - The input type of the. - * @return {string} The resolved GLSL bitcast invocation. - */ - getBitcastMethod(type: string, inputType: string): string; - /** - * Returns the float packing method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolved GLSL float packing method name. - */ - getFloatPackingMethod(encoding: string, layout?: string): string; - /** - * Returns the float unpacking method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolved GLSL float unpacking method name. - */ - getFloatUnpackingMethod(encoding: string, layout?: string): string; - /** - * Returns the native snippet for a ternary operation. - * - * @param {string} condSnippet - The condition determining which expression gets resolved. - * @param {string} ifSnippet - The expression to resolve to if the condition is true. - * @param {string} elseSnippet - The expression to resolve to if the condition is false. - * @return {string} The resolved method name. - */ - getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; - /** - * Builds the given shader node. - * - * @param {ShaderNodeInternal} shaderNode - The shader node. - * @return {string} The GLSL function code. - */ - buildFunctionCode(shaderNode: ShaderNodeInternal): string; - /** - * Setups the Pixel Buffer Object (PBO) for the given storage - * buffer node. - * - * @param {StorageBufferNode} storageBufferNode - The storage buffer node. - */ - setupPBO(storageBufferNode: StorageBufferNode): void; - /** - * Returns a GLSL snippet that represents the property name of the given node. - * - * @param {Node} node - The node. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The property name. - */ - getPropertyName(node: Node, shaderStage?: string): string; - /** - * Returns whether the given name is a reserved keyword of GLSL. - * - * @param {string} name - The name to test. - * @return {boolean} Whether the name is a reserved keyword or not. - */ - isReservedKeyword(name: string): boolean; - /** - * Setups the Pixel Buffer Object (PBO) for the given storage - * buffer node. - * - * @param {StorageArrayElementNode} storageArrayElementNode - The storage array element node. - * @return {string} The property name. - */ - generatePBO(storageArrayElementNode: StorageArrayElementNode): string; - /** - * Generates the GLSL snippet that reads a single texel from a texture without sampling or filtering. - * - * @param {?Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {?string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureLoad(texture: Texture | null, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet for sampling/loading the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A GLSL snippet that represents the 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet that resolves the dimensions of the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} levelSnippet - A GLSL snippet that represents the mip level. - * @return {string} The GLSL snippet. - */ - generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; - /** - * Generates the GLSL snippet when sampling textures with explicit mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} levelSnippet - A GLSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet when sampling textures with a bias to the mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} biasSnippet - A GLSL snippet that represents the bias to apply to the mip level before sampling. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet for sampling/loading the given texture using explicit gradients. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {Array} gradSnippet - An array holding both gradient GLSL snippets. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The GLSL snippet. - */ - generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the GLSL snippet for sampling a depth texture and comparing the sampled depth values - * against a reference value. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A GLSL snippet that represents the reference value. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The GLSL snippet. - */ - generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the GLSL snippet for gathering four texels from the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} gatherSnippet - A GLSL snippet that represents the index of the channel to read. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. - * @return {string} The GLSL snippet. - */ - generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; - /** - * Generates the GLSL snippet for performing a depth comparison on four texels in the given depth texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A GLSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A GLSL snippet that represents the reference value. - * @param {?string} depthSnippet - A GLSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A GLSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {?string} flipYSnippet - A GLSL snippet that represents the y-flip. Only used for WebGL. - * @return {string} The GLSL snippet. - */ - generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, flipYSnippet: string | null): string; - /** - * Returns the uniforms of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the uniforms. - */ - getUniforms(shaderStage: string): string; - /** - * Returns the shader attributes of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the shader attributes. - */ - getAttributes(shaderStage: string): string; - /** - * Returns the members of the given struct type node as a GLSL string. - * - * @param {StructTypeNode} struct - The struct type node. - * @return {string} The GLSL snippet that defines the struct members. - */ - getStructMembers(struct: StructTypeNode): string; - /** - * Returns the structs of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the structs. - */ - getStructs(shaderStage: string): string; - /** - * Returns the varyings of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the varyings. - */ - getVaryings(shaderStage: string): string; - /** - * Returns a builtin representing the index of an invocation within its workgroup. - * - * @return {string} The invocation local index. - */ - getInvocationLocalIndex(): string; - /** - * Returns a builtin representing the size of a subgroup within the current shader. - */ - getSubgroupSize(): void; - /** - * Returns a builtin representing the index of an invocation within its subgroup. - */ - getInvocationSubgroupIndex(): void; - /** - * Returns a builtin representing the index of the current invocation's subgroup within its workgroup. - */ - getSubgroupIndex(): void; - /** - * Returns the frag depth builtin. - * - * @return {string} The frag depth builtin. - */ - getFragDepth(): string; - /** - * Enables the given extension. - * - * @param {string} name - The extension name. - * @param {string} behavior - The extension behavior. - * @param {string} [shaderStage=this.shaderStage] - The shader stage. - */ - enableExtension(name: string, behavior: string, shaderStage?: string): void; - /** - * Returns the enabled extensions of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the enabled extensions. - */ - getExtensions(shaderStage: string): string; - /** - * Returns the clip distances builtin. - * - * @return {string} The clip distances builtin. - */ - getClipDistance(): string; - /** - * Whether the requested feature is available or not. - * - * @param {string} name - The requested feature. - * @return {boolean} Whether the requested feature is supported or not. - */ - isAvailable(name: string): boolean; - /** - * Enables hardware clipping. - * - * @param {string} planeCount - The clipping plane count. - */ - enableHardwareClipping(planeCount: string): void; - /** - * Enables multiview. - */ - enableMultiview(): void; - /** - * Registers a transform in context of Transform Feedback. - * - * @param {string} varyingName - The varying name. - * @param {AttributeNode} attributeNode - The attribute node. - */ - registerTransform(varyingName: string, attributeNode: AttributeNode): void; - /** - * Returns the transforms of the given shader stage as a GLSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The GLSL snippet that defines the transforms. - */ - getTransforms(): string; - /** - * Returns a GLSL struct based on the given name and variables. - * - * @private - * @param {string} name - The struct name. - * @param {string} vars - The struct variables. - * @return {string} The GLSL snippet representing a struct. - */ - private _getGLSLUniformStruct; - /** - * Returns a GLSL vertex shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getGLSLVertexCode; - /** - * Returns a GLSL fragment shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getGLSLFragmentCode; - /** - * This method is one of the more important ones since it's responsible - * for generating a matching binding instance for the given uniform node. - * - * These bindings are later used in the renderer to create bind groups - * and layouts. - * - * @param {UniformNode} node - The uniform node. - * @param {string} type - The node data type. - * @param {string} shaderStage - The shader stage. - * @param {?string} [name=null] - An optional uniform name. - * @return {NodeUniform} The node uniform object. - */ - getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; -} -import { NodeBuilder } from '../../../nodes/Nodes.js'; -import NodeUniformsGroup from '../../common/nodes/NodeUniformsGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts deleted file mode 100644 index 80d81e2f3..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -export default WebGLAttributeUtils; -/** - * A WebGL 2 backend utility module for managing shader attributes. - * - * @private - */ -declare class WebGLAttributeUtils { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * Creates the GPU buffer for the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. - */ - createAttribute(attribute: BufferAttribute, bufferType: GLenum): void; - /** - * Updates the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * Destroys the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @param {number} offset - The storage buffer attribute. - * @param {number} count - The offset from which to start reading the - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Creates a WebGL buffer with the given data. - * - * @private - * @param {WebGL2RenderingContext} gl - The rendering context. - * @param {GLenum } bufferType - A flag that indicates the buffer type and thus binding point target. - * @param {TypedArray} array - The array of the buffer attribute. - * @param {GLenum} usage - The usage. - * @return {WebGLBuffer} The WebGL buffer. - */ - private _createBuffer; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts deleted file mode 100644 index 095e4ee8c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLCapabilities.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -export default WebGLCapabilities; -/** - * A WebGL 2 backend utility module for managing the device's capabilities. - * - * @private - */ -declare class WebGLCapabilities { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * This value holds the cached max anisotropy value. - * - * @type {?number} - * @default null - */ - maxAnisotropy: number | null; - /** - * This value holds the cached max uniform block size value. - * - * @type {?number} - * @default null - */ - maxUniformBlockSize: number | null; - /** - * Returns the maximum anisotropy texture filtering value. This value - * depends on the device and is reported by the `EXT_texture_filter_anisotropic` - * WebGL extension. - * - * @return {number} The maximum anisotropy texture filtering value. - */ - getMaxAnisotropy(): number; - /** - * Returns the maximum number of bytes available for uniform buffers. - * - * @return {number} The maximum number of bytes available for uniform buffers. - */ - getUniformBufferLimit(): number; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts deleted file mode 100644 index d8093bad2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLConstants.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export namespace GLFeatureName { - let WEBGL_multi_draw: string; - let WEBGL_compressed_texture_astc: string; - let WEBGL_compressed_texture_etc: string; - let WEBGL_compressed_texture_etc1: string; - let WEBGL_compressed_texture_pvrtc: string; - let WEBGL_compressed_texture_s3tc: string; - let EXT_texture_compression_bptc: string; - let EXT_disjoint_timer_query_webgl2: string; - let OVR_multiview2: string; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts deleted file mode 100644 index be5b14a6e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLExtensions.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -export default WebGLExtensions; -/** - * A WebGL 2 backend utility module for managing extensions. - * - * @private - */ -declare class WebGLExtensions { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - /** - * A list with all the supported WebGL extensions. - * - * @type {Array} - */ - availableExtensions: Array; - /** - * A dictionary with requested WebGL extensions. - * The key is the name of the extension, the value - * the requested extension object. - * - * @type {Object} - */ - extensions: { - [x: string]: Object; - }; - /** - * Returns the extension object for the given extension name. - * - * @param {string} name - The extension name. - * @return {Object} The extension object. - */ - get(name: string): Object; - /** - * Returns `true` if the requested extension is available. - * - * @param {string} name - The extension name. - * @return {boolean} Whether the given extension is available or not. - */ - has(name: string): boolean; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts deleted file mode 100644 index e10da62e2..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLState.d.ts +++ /dev/null @@ -1,382 +0,0 @@ -export default WebGLState; -/** - * A WebGL 2 backend utility module for managing the WebGL state. - * - * The major goal of this module is to reduce the number of state changes - * by caching the WEbGL state with a series of variables. In this way, the - * renderer only executes state change commands when necessary which - * improves the overall performance. - * - * @private - */ -declare class WebGLState { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - enabled: {}; - parameters: {}; - currentFlipSided: any; - currentCullFace: any; - currentProgram: any; - currentBlendingEnabled: boolean; - currentBlending: any; - currentBlendEquation: any; - currentBlendEquationAlpha: number | null; - currentBlendSrc: any; - currentBlendDst: number | null; - currentBlendSrcAlpha: number | null; - currentBlendDstAlpha: number | null; - currentBlendColor: Color; - currentBlendAlpha: number; - currentPremultipledAlpha: boolean | null; - currentPolygonOffsetFactor: any; - currentPolygonOffsetUnits: number | null; - currentColorMask: any; - currentDepthReversed: boolean; - currentDepthFunc: any; - currentDepthMask: any; - currentStencilFunc: any; - currentStencilRef: number | null; - currentStencilFuncMask: number | null; - currentStencilFail: any; - currentStencilZFail: number | null; - currentStencilZPass: number | null; - currentStencilMask: any; - currentLineWidth: any; - currentClippingPlanes: number; - currentVAO: any; - currentIndex: WebGLBuffer | null; - currentBoundFramebuffers: {}; - currentDrawbuffers: WeakMap; - maxTextures: any; - currentTextureSlot: any; - currentBoundTextures: {}; - currentBoundBufferBases: {}; - /** - * Inits the state of the utility. - * - * @private - */ - private _init; - currentScissor: Vector4 | undefined; - currentViewport: Vector4 | undefined; - _tempVec4: Vector4 | undefined; - /** - * Enables the given WebGL capability. - * - * This method caches the capability state so - * `gl.enable()` is only called when necessary. - * - * @param {GLenum} id - The capability to enable. - */ - enable(id: GLenum): void; - /** - * Disables the given WebGL capability. - * - * This method caches the capability state so - * `gl.disable()` is only called when necessary. - * - * @param {GLenum} id - The capability to enable. - */ - disable(id: GLenum): void; - /** - * Specifies whether polygons are front- or back-facing - * by setting the winding orientation. - * - * This method caches the state so `gl.frontFace()` is only - * called when necessary. - * - * @param {boolean} flipSided - Whether triangles flipped their sides or not. - */ - setFlipSided(flipSided: boolean): void; - /** - * Specifies whether or not front- and/or back-facing - * polygons can be culled. - * - * This method caches the state so `gl.cullFace()` is only - * called when necessary. - * - * @param {number} cullFace - Defines which polygons are candidates for culling. - */ - setCullFace(cullFace: number): void; - /** - * Specifies the width of line primitives. - * - * This method caches the state so `gl.lineWidth()` is only - * called when necessary. - * - * @param {number} width - The line width. - */ - setLineWidth(width: number): void; - setMRTBlending(textures: any, mrt: any, material: any): void; - /** - * Applies blending configuration for a specific draw buffer index. - * - * @private - * @param {number} index - The draw buffer index. - * @param {Object} blending - The blending configuration (material or BlendMode). - */ - private _setMRTBlendingIndex; - /** - * Defines the blending. - * - * This method caches the state so `gl.blendEquation()`, `gl.blendEquationSeparate()`, - * `gl.blendFunc()`, `gl.blendFuncSeparate()` and `gl.blendColor()` are only called when necessary. - * - * @param {number} blending - The blending type. - * @param {number} blendEquation - The blending equation. - * @param {number} blendSrc - Only relevant for custom blending. The RGB source blending factor. - * @param {number} blendDst - Only relevant for custom blending. The RGB destination blending factor. - * @param {number} blendEquationAlpha - Only relevant for custom blending. The blending equation for alpha. - * @param {number} blendSrcAlpha - Only relevant for custom blending. The alpha source blending factor. - * @param {number} blendDstAlpha - Only relevant for custom blending. The alpha destination blending factor. - * @param {Color} blendColor - Only relevant for custom blending. The RGB values of the constant blend color. - * @param {number} blendAlpha - Only relevant for custom blending. The alpha value of the constant blend color. - * @param {boolean} premultipliedAlpha - Whether premultiplied alpha is enabled or not. - */ - setBlending(blending: number, blendEquation: number, blendSrc: number, blendDst: number, blendEquationAlpha: number, blendSrcAlpha: number, blendDstAlpha: number, blendColor: Color, blendAlpha: number, premultipliedAlpha: boolean): void; - /** - * Specifies whether colors can be written when rendering - * into a framebuffer or not. - * - * This method caches the state so `gl.colorMask()` is only - * called when necessary. - * - * @param {boolean} colorMask - The color mask. - */ - setColorMask(colorMask: boolean): void; - /** - * Specifies whether the depth test is enabled or not. - * - * @param {boolean} depthTest - Whether the depth test is enabled or not. - */ - setDepthTest(depthTest: boolean): void; - /** - * Configures the WebGL state to use a reversed depth buffer. - * - * @param {boolean} reversed - Whether the depth buffer is reversed or not. - */ - setReversedDepth(reversed: boolean): void; - /** - * Specifies whether depth values can be written when rendering - * into a framebuffer or not. - * - * This method caches the state so `gl.depthMask()` is only - * called when necessary. - * - * @param {boolean} depthMask - The depth mask. - */ - setDepthMask(depthMask: boolean): void; - /** - * Specifies the depth compare function. - * - * This method caches the state so `gl.depthFunc()` is only - * called when necessary. - * - * @param {number} depthFunc - The depth compare function. - */ - setDepthFunc(depthFunc: number): void; - /** - * Specifies the scissor box. - * - * @param {number} x - The x-coordinate of the lower left corner of the viewport. - * @param {number} y - The y-coordinate of the lower left corner of the viewport. - * @param {number} width - The width of the viewport. - * @param {number} height - The height of the viewport. - * - */ - scissor(x: number, y: number, width: number, height: number): void; - /** - * Specifies the viewport. - * - * @param {number} x - The x-coordinate of the lower left corner of the viewport. - * @param {number} y - The y-coordinate of the lower left corner of the viewport. - * @param {number} width - The width of the viewport. - * @param {number} height - The height of the viewport. - * - */ - viewport(x: number, y: number, width: number, height: number): void; - /** - * Defines the scissor test. - * - * @param {boolean} boolean - Whether the scissor test should be enabled or not. - */ - setScissorTest(boolean: boolean): void; - /** - * Specifies whether the stencil test is enabled or not. - * - * @param {boolean} stencilTest - Whether the stencil test is enabled or not. - */ - setStencilTest(stencilTest: boolean): void; - /** - * Specifies whether stencil values can be written when rendering - * into a framebuffer or not. - * - * This method caches the state so `gl.stencilMask()` is only - * called when necessary. - * - * @param {boolean} stencilMask - The stencil mask. - */ - setStencilMask(stencilMask: boolean): void; - /** - * Specifies whether the stencil test functions. - * - * This method caches the state so `gl.stencilFunc()` is only - * called when necessary. - * - * @param {number} stencilFunc - The stencil compare function. - * @param {number} stencilRef - The reference value for the stencil test. - * @param {number} stencilMask - A bit-wise mask that is used to AND the reference value and the stored stencil value when the test is done. - */ - setStencilFunc(stencilFunc: number, stencilRef: number, stencilMask: number): void; - /** - * Specifies whether the stencil test operation. - * - * This method caches the state so `gl.stencilOp()` is only - * called when necessary. - * - * @param {number} stencilFail - The function to use when the stencil test fails. - * @param {number} stencilZFail - The function to use when the stencil test passes, but the depth test fail. - * @param {number} stencilZPass - The function to use when both the stencil test and the depth test pass, - * or when the stencil test passes and there is no depth buffer or depth testing is disabled. - */ - setStencilOp(stencilFail: number, stencilZFail: number, stencilZPass: number): void; - /** - * Configures the WebGL state for the given material. - * - * @param {Material} material - The material to configure the state for. - * @param {number} frontFaceCW - Whether the front faces are counter-clockwise or not. - * @param {number} hardwareClippingPlanes - The number of hardware clipping planes. - */ - setMaterial(material: Material, frontFaceCW: number, hardwareClippingPlanes: number): void; - /** - * Specifies the polygon offset. - * - * This method caches the state so `gl.polygonOffset()` is only - * called when necessary. - * - * @param {boolean} polygonOffset - Whether polygon offset is enabled or not. - * @param {number} factor - The scale factor for the variable depth offset for each polygon. - * @param {number} units - The multiplier by which an implementation-specific value is multiplied with to create a constant depth offset. - */ - setPolygonOffset(polygonOffset: boolean, factor: number, units: number): void; - /** - * Defines the usage of the given WebGL program. - * - * This method caches the state so `gl.useProgram()` is only - * called when necessary. - * - * @param {WebGLProgram} program - The WebGL program to use. - * @return {boolean} Whether a program change has been executed or not. - */ - useProgram(program: WebGLProgram): boolean; - /** - * Sets the vertex state by binding the given VAO and element buffer. - * - * @param {WebGLVertexArrayObject} vao - The VAO. - * @param {?WebGLBuffer} indexBuffer - The index buffer. - * @return {boolean} Whether a vertex state has been changed or not. - */ - setVertexState(vao: WebGLVertexArrayObject, indexBuffer?: WebGLBuffer | null): boolean; - /** - * Resets the vertex array state by resetting the VAO and element buffer. - */ - resetVertexState(): void; - /** - * Binds the given framebuffer. - * - * This method caches the state so `gl.bindFramebuffer()` is only - * called when necessary. - * - * @param {number} target - The binding point (target). - * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer to bind. - * @return {boolean} Whether a bind has been executed or not. - */ - bindFramebuffer(target: number, framebuffer: WebGLFramebuffer): boolean; - /** - * Defines draw buffers to which fragment colors are written into. - * Configures the MRT setup of custom framebuffers. - * - * This method caches the state so `gl.drawBuffers()` is only - * called when necessary. - * - * @param {RenderContext} renderContext - The render context. - * @param {WebGLFramebuffer} framebuffer - The WebGL framebuffer. - */ - drawBuffers(renderContext: RenderContext, framebuffer: WebGLFramebuffer): void; - /** - * Makes the given texture unit active. - * - * This method caches the state so `gl.activeTexture()` is only - * called when necessary. - * - * @param {number} webglSlot - The texture unit to make active. - */ - activeTexture(webglSlot: number): void; - /** - * Binds the given WebGL texture to a target. - * - * This method caches the state so `gl.bindTexture()` is only - * called when necessary. - * - * @param {number} webglType - The binding point (target). - * @param {WebGLTexture} webglTexture - The WebGL texture to bind. - * @param {number} webglSlot - The texture. - */ - bindTexture(webglType: number, webglTexture: WebGLTexture, webglSlot: number): void; - /** - * Binds a given WebGL buffer to a given binding point (target) at a given index. - * - * This method caches the state so `gl.bindBufferBase()` is only - * called when necessary. - * - * @param {number} target - The target for the bind operation. - * @param {number} index - The index of the target. - * @param {WebGLBuffer} buffer - The WebGL buffer. - * @return {boolean} Whether a bind has been executed or not. - */ - bindBufferBase(target: number, index: number, buffer: WebGLBuffer): boolean; - /** - * Unbinds the current bound texture. - * - * This method caches the state so `gl.bindTexture()` is only - * called when necessary. - */ - unbindTexture(): void; - /** - * Returns the value for the given parameter. - * - * @param {number} name - The parameter to get the value for. - * @return {any} The value for the given parameter. - */ - getParameter(name: number): any; - /** - * Specifies a pixel storage mode. - * - * @param {number} name - The parameter to set. - * @param {any} value - A value to set the parameter to. - */ - pixelStorei(name: number, value: any): void; - /** - * Restores the WebGL state to its default and clears the cache so subsequent renderings - * re-apply the required state. Useful when the WebGL context is shared with other libraries. - */ - reset(): void; -} -import { Color } from '../../../math/Color.js'; -import { Vector4 } from '../../../math/Vector4.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts deleted file mode 100644 index 09a26d0f9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTextureUtils.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -export default WebGLTextureUtils; -/** - * A WebGL 2 backend utility module for managing textures. - * - * @private - */ -declare class WebGLTextureUtils { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - /** - * A reference to a backend module holding extension-related - * utility functions. - * - * @type {WebGLExtensions} - */ - extensions: WebGLExtensions; - /** - * A dictionary for managing default textures. The key - * is the binding point (target), the value the WEbGL texture object. - * - * @type {Object} - */ - defaultTextures: any; - /** - * A scratch framebuffer used for attaching the source texture in - * {@link copyTextureToTexture}. - * - * @private - * @type {?WebGLFramebuffer} - */ - private _srcFramebuffer; - /** - * A scratch framebuffer used for attaching the destination texture in - * {@link copyTextureToTexture}. - * - * @private - * @type {?WebGLFramebuffer} - */ - private _dstFramebuffer; - /** - * Inits the state of the utility. - * - * @private - */ - private _init; - /** - * Returns the native texture type for the given texture. - * - * @param {Texture} texture - The texture. - * @return {GLenum} The native texture type. - */ - getGLTextureType(texture: Texture): GLenum; - /** - * Returns the native texture type for the given texture. - * - * @param {?string} internalFormatName - The internal format name. When `null`, the internal format is derived from the subsequent parameters. - * @param {GLenum} glFormat - The WebGL format. - * @param {GLenum} glType - The WebGL type. - * @param {string} colorSpace - The texture's color space. - * @param {boolean} [forceLinearTransfer=false] - Whether to force a linear transfer or not. - * @return {GLenum} The internal format. - */ - getInternalFormat(internalFormatName: string | null, glFormat: GLenum, glType: GLenum, normalized: any, colorSpace: string, forceLinearTransfer?: boolean): GLenum; - /** - * Sets the texture parameters for the given texture. - * - * @param {GLenum} textureType - The texture type. - * @param {Texture} texture - The texture. - */ - setTextureParameters(textureType: GLenum, texture: Texture): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(texture: Texture): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - * @return {undefined} - */ - createTexture(texture: Texture, options?: Object): undefined; - /** - * Uploads texture buffer data to the GPU memory. - * - * @param {WebGLBuffer} buffer - The buffer data. - * @param {Texture} texture - The texture, - */ - copyBufferToTexture(buffer: WebGLBuffer, texture: Texture): void; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - */ - generateMipmaps(texture: Texture): void; - /** - * Deallocates the render buffers of the given render target. - * - * @param {RenderTarget} renderTarget - The render target. - */ - deallocateRenderBuffers(renderTarget: RenderTarget): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Copies data of the given source texture to the given destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The source mip level to copy from. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; - /** - * SetupS storage for internal depth/stencil buffers and bind to correct framebuffer. - * - * @param {WebGLRenderbuffer} renderbuffer - The render buffer. - * @param {RenderContext} renderContext - The render context. - * @param {number} samples - The MSAA sample count. - * @param {boolean} [useMultisampledRTT=false] - Whether to use WEBGL_multisampled_render_to_texture or not. - */ - setupRenderBufferStorage(renderbuffer: WebGLRenderbuffer, renderContext: RenderContext, samples: number, useMultisampledRTT?: boolean): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Returns the corresponding typed array type for the given WebGL data type. - * - * @private - * @param {GLenum} glType - The WebGL data type. - * @return {TypedArray.constructor} The typed array type. - */ - private _getTypedArrayType; - /** - * Returns the bytes-per-texel value for the given WebGL data type and texture format. - * - * @private - * @param {GLenum} glType - The WebGL data type. - * @param {GLenum} glFormat - The WebGL texture format. - * @return {number} The bytes-per-texel. - */ - private _getBytesPerTexel; - /** - * Frees the internal resources. - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts deleted file mode 100644 index c6a325c47..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -export default WebGLTimestampQueryPool; -/** - * Manages a pool of WebGL timestamp queries for performance measurement. - * Handles creation, execution, and resolution of timer queries using WebGL extensions. - * - * @augments TimestampQueryPool - */ -declare class WebGLTimestampQueryPool extends TimestampQueryPool { - /** - * Creates a new WebGL timestamp query pool. - * - * @param {WebGLRenderingContext|WebGL2RenderingContext} gl - The WebGL context. - * @param {string} type - The type identifier for this query pool. - * @param {number} [maxQueries=2048] - Maximum number of queries this pool can hold. - */ - constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, type: string, maxQueries?: number); - gl: WebGLRenderingContext | WebGL2RenderingContext; - type: string; - ext: any; - queries: any[] | undefined; - activeQuery: number | null; - queryStates: Map | undefined; - /** - * Allocates a pair of queries for a given render context. - * - * @param {string} uid - A unique identifier for the render context. - * @returns {?number} The base offset for the allocated queries, or null if allocation failed. - */ - allocateQueriesForContext(uid: string): number | null; - /** - * Begins a timestamp query for the specified render context. - * - * @param {string} uid - A unique identifier for the render context. - */ - beginQuery(uid: string): void; - /** - * Ends the active timestamp query for the specified render context. - * - * @param {string} uid - A unique identifier for the render context. - */ - endQuery(uid: string): void; - /** - * Asynchronously resolves all completed queries and returns the total duration. - * - * @async - * @returns {Promise} The total duration in milliseconds, or the last valid value if resolution fails. - */ - resolveQueriesAsync(): Promise; - /** - * Resolves a single query, checking for completion and disjoint operation. - * - * @async - * @param {WebGLQuery} query - The query object to resolve. - * @returns {Promise} The elapsed time in milliseconds. - */ - resolveQuery(query: WebGLQuery): Promise; -} -import TimestampQueryPool from '../../common/TimestampQueryPool.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts deleted file mode 100644 index 1f75ec7e8..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl-fallback/utils/WebGLUtils.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export default WebGLUtils; -/** - * A WebGL 2 backend utility module with common helpers. - * - * @private - */ -declare class WebGLUtils { - /** - * Constructs a new utility object. - * - * @param {WebGLBackend} backend - The WebGL 2 backend. - */ - constructor(backend: WebGLBackend); - /** - * A reference to the WebGL 2 backend. - * - * @type {WebGLBackend} - */ - backend: WebGLBackend; - /** - * A reference to the rendering context. - * - * @type {WebGL2RenderingContext} - */ - gl: WebGL2RenderingContext; - /** - * A reference to a backend module holding extension-related - * utility functions. - * - * @type {WebGLExtensions} - */ - extensions: WebGLExtensions; - /** - * Converts the given three.js constant into a WebGL constant. - * The method currently supports the conversion of texture formats - * and types. - * - * @param {number} p - The three.js constant. - * @param {string} [colorSpace=NoColorSpace] - The color space. - * @return {?number} The corresponding WebGL constant. - */ - convert(p: number, colorSpace?: string): number | null; - /** - * This method can be used to synchronize the CPU with the GPU by waiting until - * ongoing GPU commands have been completed. - * - * @private - * @return {Promise} A promise that resolves when all ongoing GPU commands have been completed. - */ - private _clientWaitAsync; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts deleted file mode 100644 index 8c234dea3..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAnimation.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function WebGLAnimation(): { - start: () => void; - stop: () => void; - setAnimationLoop: (callback: any) => void; - setContext: (value: any) => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts deleted file mode 100644 index 74dfcf7fd..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLAttributes.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function WebGLAttributes(gl: any): { - get: (attribute: any) => any; - remove: (attribute: any) => void; - update: (attribute: any, bufferType: any) => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts deleted file mode 100644 index a05a75907..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBackground.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function WebGLBackground(renderer: any, environments: any, state: any, objects: any, alpha: any, premultipliedAlpha: any): { - getClearColor: () => Color; - setClearColor: (color: any, alpha?: number) => void; - getClearAlpha: () => number; - setClearAlpha: (alpha: any) => void; - render: (scene: any) => void; - addToRenderList: (renderList: any, scene: any) => void; - dispose: () => void; -}; -import { Color } from '../../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts deleted file mode 100644 index 73ea033cc..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBindingStates.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export function WebGLBindingStates(gl: any, attributes: any): { - setup: (object: any, material: any, program: any, geometry: any, index: any) => void; - reset: () => void; - resetDefaultState: () => void; - dispose: () => void; - releaseStatesOfGeometry: (geometry: any) => void; - releaseStatesOfObject: (object: any) => void; - releaseStatesOfProgram: (program: any) => void; - initAttributes: () => void; - enableAttribute: (attribute: any) => void; - disableUnusedAttributes: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts deleted file mode 100644 index 8182d4ea9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLBufferRenderer.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export function WebGLBufferRenderer(gl: any, extensions: any, info: any): void; -export class WebGLBufferRenderer { - constructor(gl: any, extensions: any, info: any); - setMode: (value: any) => void; - render: (start: any, count: any) => void; - renderInstances: (start: any, count: any, primcount: any) => void; - renderMultiDraw: (starts: any, counts: any, drawCount: any) => void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts deleted file mode 100644 index 1367f224b..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLCapabilities.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export function WebGLCapabilities(gl: any, extensions: any, parameters: any, utils: any): { - isWebGL2: boolean; - getMaxAnisotropy: () => any; - getMaxPrecision: (precision: any) => "highp" | "mediump" | "lowp"; - textureFormatReadable: (textureFormat: any) => boolean; - textureTypeReadable: (textureType: any) => boolean; - precision: any; - logarithmicDepthBuffer: boolean; - reversedDepthBuffer: any; - maxTextures: any; - maxVertexTextures: any; - maxTextureSize: any; - maxCubemapSize: any; - maxAttributes: any; - maxVertexUniforms: any; - maxVaryings: any; - maxFragmentUniforms: any; - maxSamples: any; - samples: any; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts deleted file mode 100644 index 5cda7553c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLEnvironments.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function WebGLEnvironments(renderer: any): { - get: (texture: any, usePMREM?: boolean) => any; - dispose: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts deleted file mode 100644 index 485025fbb..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLExtensions.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function WebGLExtensions(gl: any): { - has: (name: any) => boolean; - init: () => void; - get: (name: any) => any; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts deleted file mode 100644 index 6dc941500..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLGeometries.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function WebGLGeometries(gl: any, attributes: any, info: any, bindingStates: any): { - get: (object: any, geometry: any) => any; - update: (geometry: any) => void; - getWireframeAttribute: (geometry: any) => any; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts deleted file mode 100644 index 344fcb256..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export function WebGLIndexedBufferRenderer(gl: any, extensions: any, info: any): void; -export class WebGLIndexedBufferRenderer { - constructor(gl: any, extensions: any, info: any); - setMode: (value: any) => void; - setIndex: (value: any) => void; - render: (start: any, count: any) => void; - renderInstances: (start: any, count: any, primcount: any) => void; - renderMultiDraw: (starts: any, counts: any, drawCount: any) => void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts deleted file mode 100644 index dd5ad7dac..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLInfo.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function WebGLInfo(gl: any): { - memory: { - geometries: number; - textures: number; - }; - render: { - frame: number; - calls: number; - triangles: number; - points: number; - lines: number; - }; - programs: null; - autoReset: boolean; - reset: () => void; - update: (count: any, mode: any, instanceCount: any) => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts deleted file mode 100644 index 1a605e848..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLLights.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -export function WebGLLights(extensions: any): { - setup: (lights: any) => void; - setupView: (lights: any, camera: any) => void; - state: { - version: number; - hash: { - sunLength: number; - directionalLength: number; - pointLength: number; - spotLength: number; - rectAreaLength: number; - hemiLength: number; - numSunShadows: number; - numDirectionalShadows: number; - numPointShadows: number; - numSpotShadows: number; - numSpotMaps: number; - numLightProbes: number; - }; - ambient: number[]; - probe: never[]; - sun: never[]; - sunShadow: never[]; - sunShadowMap: never[]; - sunShadowMatrix: never[]; - sunShadowCascade: never[]; - directional: never[]; - directionalShadow: never[]; - directionalShadowMap: never[]; - directionalShadowMatrix: never[]; - spot: never[]; - spotLightMap: never[]; - spotShadow: never[]; - spotShadowMap: never[]; - spotLightMatrix: never[]; - rectArea: never[]; - rectAreaLTC1: null; - rectAreaLTC2: null; - point: never[]; - pointShadow: never[]; - pointShadowMap: never[]; - pointShadowMatrix: never[]; - hemi: never[]; - numSpotLightShadowsWithMaps: number; - numLightProbes: number; - }; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts deleted file mode 100644 index 2db593304..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMaterials.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function WebGLMaterials(renderer: any, properties: any): { - refreshFogUniforms: (uniforms: any, fog: any) => void; - refreshMaterialUniforms: (uniforms: any, material: any, pixelRatio: any, height: any, transmissionRenderTarget: any) => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts deleted file mode 100644 index 1882f060b..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLMorphtargets.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function WebGLMorphtargets(gl: any, capabilities: any, textures: any): { - update: (object: any, geometry: any, program: any) => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts deleted file mode 100644 index 50c005398..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLObjects.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function WebGLObjects(gl: any, geometries: any, attributes: any, bindingStates: any, info: any): { - update: (object: any) => any; - dispose: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts deleted file mode 100644 index 2977b038f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLOutput.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export function WebGLOutput(type: any, width: any, height: any, antialias: any, depth: any, stencil: any): void; -export class WebGLOutput { - constructor(type: any, width: any, height: any, antialias: any, depth: any, stencil: any); - setSize: (width: any, height: any) => void; - setEffects: (effects: any) => void; - begin: (renderer: any, renderTarget: any) => boolean; - hasRenderPass: () => boolean; - end: (renderer: any, deltaTime: any) => void; - isCompositing: () => boolean; - dispose: () => void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts deleted file mode 100644 index f89049df9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLPrograms.d.ts +++ /dev/null @@ -1,145 +0,0 @@ -export function WebGLPrograms(renderer: any, environments: any, extensions: any, capabilities: any, bindingStates: any, clipping: any): { - getParameters: (material: any, lights: any, shadows: any, scene: any, object: any, lightProbeGrids: any) => { - shaderID: any; - shaderType: any; - shaderName: any; - vertexShader: any; - fragmentShader: any; - defines: any; - customVertexShaderID: any; - customFragmentShaderID: any; - isRawShaderMaterial: boolean; - glslVersion: any; - precision: any; - batching: boolean; - batchingColor: boolean; - instancing: boolean; - instancingColor: boolean; - instancingMorph: boolean; - outputColorSpace: any; - alphaToCoverage: boolean; - map: boolean; - matcap: boolean; - envMap: boolean; - envMapMode: any; - envMapCubeUVHeight: any; - aoMap: boolean; - lightMap: boolean; - bumpMap: boolean; - normalMap: boolean; - displacementMap: boolean; - emissiveMap: boolean; - normalMapObjectSpace: boolean; - normalMapTangentSpace: boolean; - packedNormalMap: boolean; - metalnessMap: boolean; - roughnessMap: boolean; - anisotropy: boolean; - anisotropyMap: boolean; - clearcoat: boolean; - clearcoatMap: boolean; - clearcoatNormalMap: boolean; - clearcoatRoughnessMap: boolean; - dispersion: boolean; - retroreflection: boolean; - iridescence: boolean; - iridescenceMap: boolean; - iridescenceThicknessMap: boolean; - sheen: boolean; - sheenColorMap: boolean; - sheenRoughnessMap: boolean; - specularMap: boolean; - specularColorMap: boolean; - specularIntensityMap: boolean; - transmission: boolean; - transmissionMap: boolean; - thicknessMap: boolean; - gradientMap: boolean; - opaque: boolean; - alphaMap: boolean; - alphaTest: boolean; - alphaHash: boolean; - combine: any; - mapUv: string | false; - aoMapUv: string | false; - lightMapUv: string | false; - bumpMapUv: string | false; - normalMapUv: string | false; - displacementMapUv: string | false; - emissiveMapUv: string | false; - metalnessMapUv: string | false; - roughnessMapUv: string | false; - anisotropyMapUv: string | false; - clearcoatMapUv: string | false; - clearcoatNormalMapUv: string | false; - clearcoatRoughnessMapUv: string | false; - iridescenceMapUv: string | false; - iridescenceThicknessMapUv: string | false; - sheenColorMapUv: string | false; - sheenRoughnessMapUv: string | false; - specularMapUv: string | false; - specularColorMapUv: string | false; - specularIntensityMapUv: string | false; - transmissionMapUv: string | false; - thicknessMapUv: string | false; - alphaMapUv: string | false; - vertexTangents: boolean; - vertexNormals: boolean; - vertexColors: any; - vertexAlphas: boolean; - pointsUvs: boolean; - fog: boolean; - useFog: boolean; - fogExp2: any; - flatShading: any; - sizeAttenuation: boolean; - logarithmicDepthBuffer: any; - reversedDepthBuffer: any; - skinning: boolean; - hasPositionAttribute: boolean; - morphTargets: boolean; - morphNormals: boolean; - morphColors: boolean; - morphTargetsCount: any; - morphTextureStride: number; - numSunLights: any; - numDirLights: any; - numPointLights: any; - numSpotLights: any; - numSpotLightMaps: any; - numRectAreaLights: any; - numHemiLights: any; - numSunLightShadows: any; - numDirLightShadows: any; - numPointLightShadows: any; - numSpotLightShadows: any; - numSpotLightShadowsWithMaps: any; - numLightProbes: any; - numLightProbeGrids: any; - numClippingPlanes: any; - numClipIntersection: any; - dithering: any; - shadowMapEnabled: any; - shadowMapType: any; - toneMapping: number; - decodeVideoTexture: boolean; - decodeVideoTextureEmissive: boolean; - premultipliedAlpha: any; - doubleSided: boolean; - flipSided: boolean; - useDepthPacking: boolean; - depthPacking: any; - index0AttributeName: any; - extensionClipCullDistance: any; - extensionMultiDraw: any; - rendererExtensionParallelShaderCompile: any; - customProgramCacheKey: any; - }; - getProgramCacheKey: (parameters: any) => string; - getUniforms: (material: any) => any; - acquireProgram: (parameters: any, cacheKey: any) => any; - releaseProgram: (program: any) => void; - releaseShaderCache: (material: any) => void; - programs: any[]; - dispose: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts deleted file mode 100644 index 85512905d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLProperties.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function WebGLProperties(): { - has: (object: any) => boolean; - get: (object: any) => any; - remove: (object: any) => void; - update: (object: any, key: any, value: any) => void; - dispose: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts deleted file mode 100644 index 9ec930a02..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderLists.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function WebGLRenderLists(): { - get: (scene: any, renderCallDepth: any) => any; - dispose: () => void; -}; -export function WebGLRenderList(): { - opaque: any[]; - transmissive: any[]; - transparent: any[]; - init: () => void; - push: (object: any, geometry: any, material: any, groupOrder: any, z: any, group: any, camera: any) => void; - unshift: (object: any, geometry: any, material: any, groupOrder: any, z: any, group: any) => void; - finish: () => void; - sort: (customOpaqueSort: any, customTransparentSort: any) => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts deleted file mode 100644 index f6d5a471a..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLRenderStates.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function WebGLRenderStates(extensions: any): { - get: (scene: any, renderCallDepth?: number) => any; - dispose: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts deleted file mode 100644 index c4b1be0cc..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShader.d.ts +++ /dev/null @@ -1 +0,0 @@ -export function WebGLShader(gl: any, type: any, string: any): any; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts deleted file mode 100644 index 7b4f6f540..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLShaderCache.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export class WebGLShaderCache { - shaderCache: Map; - materialCache: Map; - update(material: any, vertexShaderStage: any, fragmentShaderStage: any): this; - remove(material: any): this; - getVertexShaderStage(material: any): any; - getFragmentShaderStage(material: any): any; - dispose(): void; - _getShaderCacheForMaterial(material: any): any; - _getShaderStage(code: any): any; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts deleted file mode 100644 index 2915facbf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLState.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export function WebGLState(gl: any, extensions: any): { - buffers: { - color: any; - depth: any; - stencil: any; - }; - enable: (id: any) => void; - disable: (id: any) => void; - bindFramebuffer: (target: any, framebuffer: any) => boolean; - drawBuffers: (renderTarget: any, framebuffer: any) => void; - useProgram: (program: any) => boolean; - setBlending: (blending: any, blendEquation: any, blendSrc: any, blendDst: any, blendEquationAlpha: any, blendSrcAlpha: any, blendDstAlpha: any, blendColor: any, blendAlpha: any, premultipliedAlpha: any) => void; - setMaterial: (material: any, frontFaceCW: any) => void; - setFlipSided: (flipSided: any) => void; - setCullFace: (cullFace: any) => void; - setLineWidth: (width: any) => void; - setPolygonOffset: (polygonOffset: any, factor: any, units: any) => void; - setScissorTest: (scissorTest: any) => void; - activeTexture: (webglSlot: any) => void; - bindTexture: (webglType: any, webglTexture: any, webglSlot: any) => void; - unbindTexture: () => void; - compressedTexImage2D: (...args: any[]) => void; - compressedTexImage3D: (...args: any[]) => void; - texImage2D: (...args: any[]) => void; - texImage3D: (...args: any[]) => void; - pixelStorei: (name: any, value: any) => void; - getParameter: (name: any) => any; - updateUBOMapping: (uniformsGroup: any, program: any) => void; - uniformBlockBinding: (uniformsGroup: any, program: any) => void; - texStorage2D: (...args: any[]) => void; - texStorage3D: (...args: any[]) => void; - texSubImage2D: (...args: any[]) => void; - texSubImage3D: (...args: any[]) => void; - compressedTexSubImage2D: (...args: any[]) => void; - compressedTexSubImage3D: (...args: any[]) => void; - scissor: (scissor: any) => void; - viewport: (viewport: any) => void; - reset: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts deleted file mode 100644 index 8d958b7ae..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLTextures.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -export function WebGLTextures(_gl: any, extensions: any, state: any, properties: any, capabilities: any, utils: any, info: any): void; -export class WebGLTextures { - constructor(_gl: any, extensions: any, state: any, properties: any, capabilities: any, utils: any, info: any); - allocateTextureUnit: () => number; - resetTextureUnits: () => void; - getTextureUnits: () => number; - setTextureUnits: (value: any) => void; - setTexture2D: (texture: any, slot: any) => void; - setTexture2DArray: (texture: any, slot: any) => void; - setTexture3D: (texture: any, slot: any) => void; - setTextureCube: (texture: any, slot: any) => void; - rebindTextures: (renderTarget: any, colorTexture: any, depthTexture: any) => void; - setupRenderTarget: (renderTarget: any) => void; - updateRenderTargetMipmap: (renderTarget: any) => void; - updateMultisampleRenderTarget: (renderTarget: any) => void; - setupDepthRenderbuffer: (renderTarget: any) => void; - setupFrameBufferTexture: (framebuffer: any, renderTarget: any, texture: any, attachment: any, textureTarget: any, level: any) => void; - useMultisampledRTT: (renderTarget: any) => boolean; - isReversedDepthBuffer: () => any; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts deleted file mode 100644 index 8535725df..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniforms.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class WebGLUniforms { - static upload(gl: any, seq: any, values: any, textures: any): void; - static seqWithValue(seq: any, values: any): any[]; - constructor(gl: any, program: any); - seq: any[]; - map: {}; - setValue(gl: any, name: any, value: any, textures: any): void; - setOptional(gl: any, object: any, name: any): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts deleted file mode 100644 index 3eb1deb18..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUniformsGroups.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function WebGLUniformsGroups(gl: any, info: any, capabilities: any, state: any): { - bind: (uniformsGroup: any, program: any) => void; - update: (uniformsGroup: any, program: any) => void; - dispose: () => void; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts deleted file mode 100644 index 4c3bac4b4..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgl/WebGLUtils.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function WebGLUtils(gl: any, extensions: any): { - convert: (p: any, colorSpace?: string) => any; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts deleted file mode 100644 index 93dd58f9f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPUBackend.d.ts +++ /dev/null @@ -1,637 +0,0 @@ -export default WebGPUBackend; -/** - * A backend implementation targeting WebGPU. - * - * @private - * @augments Backend - */ -declare class WebGPUBackend extends Backend { - /** - * WebGPUBackend options. - * - * @typedef {Object} WebGPUBackend~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. - * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. - * @property {boolean} [trackTimestamp=false] - Whether to track timestamps with a Timestamp Query API or not. - * @property {string} [powerPreference=undefined] - The power preference. - * @property {Object} [requiredLimits=undefined] - Specifies the limits that are required by the device request. The request will fail if the adapter cannot provide these limits. - * @property {GPUDevice} [device=undefined] - If there is an existing GPU device on app level, it can be passed to the renderer as a parameter. - * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. - */ - /** - * Constructs a new WebGPU backend. - * - * @param {WebGPUBackend~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGPUBackend: boolean; - /** - * Indicates whether the backend is in WebGPU compatibility mode or not. - * The backend must be initialized before the property can be evaluated. - * - * @type {?boolean} - * @readonly - * @default null - */ - readonly compatibilityMode: boolean | null; - /** - * A reference to the device. - * - * @type {?GPUDevice} - * @default null - */ - device: GPUDevice | null; - /** - * A reference to the default render pass descriptor. - * - * @type {?Object} - * @default null - */ - defaultRenderPassdescriptor: Object | null; - /** - * A reference to a backend module holding common utility functions. - * - * @type {WebGPUUtils} - */ - utils: WebGPUUtils; - /** - * A reference to a backend module holding shader attribute-related - * utility functions. - * - * @type {WebGPUAttributeUtils} - */ - attributeUtils: WebGPUAttributeUtils; - /** - * A reference to a backend module holding shader binding-related - * utility functions. - * - * @type {WebGPUBindingUtils} - */ - bindingUtils: WebGPUBindingUtils; - /** - * A reference to a backend module holding device capability related - * utility functions. - * - * @type {WebGPUCapabilities} - */ - capabilities: WebGPUCapabilities; - /** - * A reference to a backend module holding shader pipeline-related - * utility functions. - * - * @type {WebGPUPipelineUtils} - */ - pipelineUtils: WebGPUPipelineUtils; - /** - * A reference to a backend module holding shader texture-related - * utility functions. - * - * @type {WebGPUTextureUtils} - */ - textureUtils: WebGPUTextureUtils; - /** - * A map that manages the resolve buffers for occlusion queries. - * - * @type {Map} - */ - occludedResolveCache: Map; - /** - * A map of compatibility checks. - * - * @type {Object} - */ - _compatibility: Object; - /** - * Registers external GPU textures from `XRGPUBinding` for use in rendering. - * - * @param {RenderTarget} renderTarget - The render target to register the textures for. - * @param {GPUTexture} colorTexture - The shared XR color GPUTexture. - * @param {?Array} [viewDescriptors=null] - Optional view descriptors, one per XR view. - */ - setXRRenderTargetTextures(renderTarget: RenderTarget, colorTexture: GPUTexture, viewDescriptors?: Array | null): void; - /** - * A reference to the context. - * - * @type {?GPUCanvasContext} - * @default null - */ - get context(): GPUCanvasContext | null; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {number} count - The offset from which to start reading the - * @param {number} offset - The storage buffer attribute. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Returns the backend's rendering context. - * - * @return {GPUCanvasContext} The rendering context. - */ - getContext(): GPUCanvasContext; - /** - * Returns the default render pass descriptor. - * - * In WebGPU, the default framebuffer must be configured - * like custom framebuffers so the backend needs a render - * pass descriptor even when rendering directly to screen. - * - * @private - * @return {GPURenderPassDescriptor} The render pass descriptor. - */ - private _getDefaultRenderPassDescriptor; - /** - * Returns whether the render target is a render target array with depth 2D array texture. - * - * @param {RenderContext} renderContext - The render context. - * @return {boolean} Whether the render target is a render target array with depth 2D array texture. - * - * @private - */ - private _isRenderCameraDepthArray; - /** - * Returns whether the current render context references external textures. - * - * External textures can change every frame, so their descriptors must not be cached. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @return {boolean} Whether the render context uses external textures. - */ - private _hasExternalTexture; - /** - * Returns multisampled color textures for an external render target. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @param {Object} textureData - The backend data for the external texture. - * @param {number} count - The number of textures to create. - * @return {?Array} The multisampled textures. - */ - private _getExternalMSAATextures; - /** - * Creates attachment views for an external texture render target. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @param {Object} textureData - The backend data for the texture. - * @return {Array} The attachment view descriptors. - */ - private _createExternalTextureViews; - /** - * Returns the render pass descriptor for the given render context. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @param {Object} colorAttachmentsConfig - Configuration object for the color attachments. - * @return {Object} The render pass descriptor. - */ - private _getRenderPassDescriptor; - /** - * This method is executed at the beginning of a render call and prepares - * the WebGPU state for upcoming render calls - * - * @param {RenderContext} renderContext - The render context. - */ - beginRender(renderContext: RenderContext): void; - /** - * Resets the state cache of the given render context data. - * - * A new render pass encoder starts with a blend constant and a stencil reference - * of zero so the cached values must be reset as well. - * - * @private - * @param {Object} renderContextData - The render context data. - */ - private _resetRenderContextData; - /** - * Creates a render bundle encoder and state cache for each camera layer. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object} renderContextData - The render context data. - * @private - */ - private _createArrayCameraBundleEncoders; - /** - * Finishes the render bundle encoders for all camera layers. - * - * @param {Object} renderContextData - The render context data. - * @return {Array} The completed render bundles. - * @private - */ - private _finishArrayCameraBundleEncoders; - /** - * Creates render pass descriptors for each camera in an array camera. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object} renderContextData - The render context data. - * @param {Object} descriptor - The render pass descriptor. - * @param {ArrayCamera} cameras - The array camera. - * - * @private - */ - private _createArrayCameraLayerDescriptors; - /** - * Updates render pass descriptors for each camera in an array camera. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object} renderContextData - The render context data. - * @param {Object} descriptor - The render pass descriptor. - * @param {ArrayCamera} cameras - The array camera. - * - */ - _updateArrayCameraLayerDescriptors(renderContext: RenderContext, renderContextData: Object, descriptor: Object, cameras: ArrayCamera): void; - /** - * This method is executed at the end of a render call and finalizes work - * after draw calls. - * - * @param {RenderContext} renderContext - The render context. - */ - finishRender(renderContext: RenderContext): void; - /** - * Returns `true` if the given 3D object is fully occluded by other - * 3D objects in the scene. - * - * @param {RenderContext} renderContext - The render context. - * @param {Object3D} object - The 3D object to test. - * @return {boolean} Whether the 3D object is fully occluded or not. - */ - isOccluded(renderContext: RenderContext, object: Object3D): boolean; - /** - * This method processes the result of occlusion queries and writes it - * into render context data. - * - * @async - * @param {RenderContext} renderContext - The render context. - * @return {Promise} A Promise that resolves when the occlusion query results have been processed. - */ - resolveOccludedAsync(renderContext: RenderContext): Promise; - /** - * Updates the viewport with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateViewport(renderContext: RenderContext): void; - /** - * Updates the scissor with the values from the given render context. - * - * @param {RenderContext} renderContext - The render context. - */ - updateScissor(renderContext: RenderContext): void; - /** - * Returns the clear color and alpha into a single - * color object. - * - * @return {Color4} The clear color. - */ - getClearColor(): Color4; - /** - * Performs a clear operation. - * - * @param {boolean} color - Whether the color buffer should be cleared or not. - * @param {boolean} depth - Whether the depth buffer should be cleared or not. - * @param {boolean} stencil - Whether the stencil buffer should be cleared or not. - * @param {?RenderContext} [renderTargetContext=null] - The render context of the current set render target. - */ - clear(color: boolean, depth: boolean, stencil: boolean, renderTargetContext?: RenderContext | null): void; - /** - * This method is executed at the beginning of a compute call and - * prepares the state for upcoming compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - beginCompute(computeGroup: Node | Array): void; - /** - * Executes a compute command for the given compute node. - * - * @param {Node|Array} computeGroup - The group of compute nodes of a compute call. Can be a single compute node. - * @param {Node} computeNode - The compute node. - * @param {Array} bindings - The bindings. - * @param {ComputePipeline} pipeline - The compute pipeline. - * @param {number|Array|IndirectStorageBufferAttribute} [dispatchSize=null] - * - A single number representing count, or - * - An array [x, y, z] representing dispatch size, or - * - A IndirectStorageBufferAttribute for indirect dispatch size. - */ - compute(computeGroup: Node | Array, computeNode: Node, bindings: Array, pipeline: ComputePipeline, dispatchSize?: number | Array | IndirectStorageBufferAttribute): void; - /** - * This method is executed at the end of a compute call and - * finalizes work after compute tasks. - * - * @param {Node|Array} computeGroup - The compute node(s). - */ - finishCompute(computeGroup: Node | Array): void; - /** - * Internal draw function that performs the draw with the given pass encoder. - * - * @private - * @param {RenderObject} renderObject - The render object. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - * @param {Object} renderContextData - The render context data object, holding current pass state and occlusion query tracking. - * @param {GPURenderPipeline} pipelineGPU - The GPU render pipeline. - * @param {Array} bindings - The bind groups. - * @param {Array} vertexBuffers - The vertex buffers. - * @param {{vertexCount: number, firstVertex: number, instanceCount: number, firstInstance: number}} drawParams - The draw parameters. - * @param {GPURenderPassEncoder|GPURenderBundleEncoder} passEncoderGPU - The GPU pass encoder used for recording draw commands. - * @param {Object} currentSets - Tracking object for currently set pipeline, attributes, bind groups, and index state. - * @param {number} [cameraIndexSlot=-1] - Index of the binding slot holding the camera index bind group. - */ - private _draw; - /** - * Executes a draw command for the given render object. - * - * @param {RenderObject} renderObject - The render object to draw. - * @param {Info} info - Holds a series of statistical information about the GPU memory and the rendering process. - */ - draw(renderObject: RenderObject, info: Info): void; - /** - * Returns `true` if the render pipeline requires an update. - * - * @param {RenderObject} renderObject - The render object. - * @return {boolean} Whether the render pipeline requires an update or not. - */ - needsRenderUpdate(renderObject: RenderObject): boolean; - /** - * Returns a cache key that is used to identify render pipelines. - * - * @param {RenderObject} renderObject - The render object. - * @return {string} The cache key. - */ - getRenderCacheKey(renderObject: RenderObject): string; - /** - * Updates a GPU sampler for the given texture. - * - * @param {Sampler} binding - The sampler binding to update. - * @return {string} The current sampler key. - */ - updateSampler(binding: Sampler): string; - /** - * Frees the GPU sampler for the given sampler binding. - * - * @param {Sampler} binding - The sampler binding to free. - */ - destroySampler(binding: Sampler): void; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - * @return {boolean} Whether the sampler has been updated or not. - */ - createDefaultTexture(texture: Texture): boolean; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(texture: Texture, options?: Object): void; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - */ - generateMipmaps(texture: Texture): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Inits a time stamp query for the given render context. - * - * @param {string} type - The type of the timestamp query (e.g. 'render', 'compute'). - * @param {number} uid - Unique id for the context (e.g. render context id). - * @param {Object} descriptor - The query descriptor. - */ - initTimestampQuery(type: string, uid: number, descriptor: Object): void; - /** - * Returns a node builder for the given render object. - * - * @param {RenderObject} object - The render object. - * @param {Renderer} renderer - The renderer. - * @return {WGSLNodeBuilder} The node builder. - */ - createNodeBuilder(object: RenderObject, renderer: Renderer): WGSLNodeBuilder; - /** - * Creates a shader program from the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - createProgram(program: ProgrammableStage): void; - /** - * Destroys the shader program of the given programmable stage. - * - * @param {ProgrammableStage} program - The programmable stage. - */ - destroyProgram(program: ProgrammableStage): void; - /** - * Creates a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(renderObject: RenderObject, promises: Array>): void; - /** - * Creates a compute pipeline for the given compute node. - * - * @param {ComputePipeline} computePipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(computePipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; - /** - * Prepares the state for encoding render bundles. - * - * @param {RenderContext} renderContext - The render context. - */ - beginBundle(renderContext: RenderContext): void; - /** - * After processing render bundles this method finalizes related work. - * - * @param {RenderContext} renderContext - The render context. - * @param {RenderBundle} bundle - The render bundle. - */ - finishBundle(renderContext: RenderContext, bundle: RenderBundle): void; - /** - * Adds a render bundle to the render context data. - * - * @param {RenderContext} renderContext - The render context. - * @param {RenderBundle} bundle - The render bundle to add. - */ - addBundle(renderContext: RenderContext, bundle: RenderBundle): void; - /** - * Creates a uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - createUniformBuffer(uniformBuffer: Buffer): void; - /** - * Destroys the GPU data for the given uniform buffer. - * - * @param {Buffer} uniformBuffer - The uniform buffer. - */ - destroyUniformBuffer(uniformBuffer: Buffer): void; - /** - * Creates bindings from the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; - /** - * Updates the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - updateBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version: number): void; - /** - * Updates a buffer binding. - * - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(binding: Buffer): void; - /** - * Delete data associated with the current bind group. - * - * @param {BindGroup} bindGroup - The bind group. - */ - deleteBindGroupData(bindGroup: BindGroup): void; - /** - * Creates the buffer of an indexed shader attribute. - * - * @param {BufferAttribute} attribute - The indexed buffer attribute. - */ - createIndexAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of a storage attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createStorageAttribute(attribute: BufferAttribute): void; - /** - * Creates the GPU buffer of an indirect storage attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - createIndirectStorageAttribute(attribute: BufferAttribute): void; - /** - * Updates the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to update. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * Destroys the GPU buffer of a shader attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute to destroy. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * Checks if the given feature is supported by the backend. - * - * @param {string} name - The feature's name. - * @return {boolean} Whether the feature is supported or not. - */ - hasFeature(name: string): boolean; - /** - * Copies data of the given source texture to the given destination texture. - * - * @param {Texture} srcTexture - The source texture. - * @param {Texture} dstTexture - The destination texture. - * @param {?(Box3|Box2)} [srcRegion=null] - The region of the source texture to copy. - * @param {?(Vector2|Vector3)} [dstPosition=null] - The destination position of the copy. - * @param {number} [srcLevel=0] - The mipmap level to copy. - * @param {number} [dstLevel=0] - The destination mip level to copy to. - */ - copyTextureToTexture(srcTexture: Texture, dstTexture: Texture, srcRegion?: (Box3 | Box2) | null, dstPosition?: (Vector2 | Vector3) | null, srcLevel?: number, dstLevel?: number): void; - /** - * Copies the current bound framebuffer to the given texture. - * - * @param {Texture} texture - The destination texture. - * @param {RenderContext} renderContext - The render context. - * @param {Vector4} rectangle - A four dimensional vector defining the origin and dimension of the copy. - */ - copyFramebufferToTexture(texture: Texture, renderContext: RenderContext, rectangle: Vector4): void; - /** - * Encodes a framebuffer copy from a specific texture-array layer. - * - * @param {GPUCommandEncoder} encoder - The command encoder. - * @param {Texture} texture - The destination texture. - * @param {GPUTexture} sourceGPU - The source GPU texture. - * @param {GPUTexture} destinationGPU - The destination GPU texture. - * @param {Object} rectangle - The source rectangle. - * @param {number} [sourceLayer=0] - The source array layer. - * @param {boolean} [generateMipmaps=texture.generateMipmaps] - Whether mipmaps should be generated. - * @private - */ - private _copyFramebufferToTexture; - /** - * Checks if the given compatibility is supported by the backend. - * - * @param {string} name - The compatibility name. - * @return {boolean} Whether the compatibility is supported or not. - */ - hasCompatibility(name: string): boolean; -} -import Backend from '../common/Backend.js'; -import WebGPUUtils from './utils/WebGPUUtils.js'; -import WebGPUAttributeUtils from './utils/WebGPUAttributeUtils.js'; -import WebGPUBindingUtils from './utils/WebGPUBindingUtils.js'; -import WebGPUCapabilities from './utils/WebGPUCapabilities.js'; -import WebGPUPipelineUtils from './utils/WebGPUPipelineUtils.js'; -import WebGPUTextureUtils from './utils/WebGPUTextureUtils.js'; -import WGSLNodeBuilder from './nodes/WGSLNodeBuilder.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts deleted file mode 100644 index dfbe8d022..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.Nodes.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default WebGPURenderer; -/** - * This alternative version of {@link WebGPURenderer} only supports node materials. - * So classes like `MeshBasicMaterial` are not compatible. - * - * @private - * @augments Renderer - */ -declare class WebGPURenderer extends Renderer { - /** - * Constructs a new WebGPU renderer. - * - * @param {WebGPURenderer~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGPURenderer: boolean; -} -import Renderer from '../common/Renderer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts deleted file mode 100644 index 546c6744b..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/WebGPURenderer.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -export default WebGPURenderer; -/** - * This renderer is the new alternative of `WebGLRenderer`. `WebGPURenderer` has the ability - * to target different backends. By default, the renderer tries to use a WebGPU backend if the - * browser supports WebGPU. If not, `WebGPURenderer` falls backs to a WebGL 2 backend. - * - * @augments Renderer - */ -declare class WebGPURenderer extends Renderer { - /** - * WebGPURenderer options. - * - * @typedef {Object} WebGPURenderer~Options - * @property {boolean} [logarithmicDepthBuffer=false] - Whether logarithmic depth buffer is enabled or not. - * @property {boolean} [reversedDepthBuffer=false] - Whether reversed depth buffer is enabled or not. - * @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. - * @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. - * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. - * @property {boolean} [antialias=false] - Whether MSAA as the default anti-aliasing should be enabled or not. - * @property {number} [samples=0] - When `antialias` is `true`, `4` samples are used by default. Set this parameter to any other integer value than 0 to overwrite the default. - * @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. - * @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. - * @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. - * @property {number} [outputBufferType=HalfFloatType] - Defines the type of output buffers. The default `HalfFloatType` is recommend for best - * quality. To save memory and bandwidth, `UnsignedByteType` might be used. This will reduce rendering quality though. - */ - /** - * Constructs a new WebGPU renderer. - * - * @param {WebGPURenderer~Options} [parameters] - The configuration parameter. - */ - constructor(parameters?: {}); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isWebGPURenderer: boolean; -} -import Renderer from '../common/Renderer.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts deleted file mode 100644 index 1bd559d39..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export default GPUBindGroupDescriptor; -/** - * Reusable descriptor for `GPUDevice.createBindGroup()`. - * - * @private - */ -declare class GPUBindGroupDescriptor { - /** - * The label of the bind group. - * - * @type {string} - */ - label: string; - /** - * The bind group layout the bind group conforms to. - * - * @type {?GPUBindGroupLayout} - * @default null - */ - layout: GPUBindGroupLayout | null; - /** - * The bind group entries. - * - * @type {Array} - */ - entries: Array; - /** - * Resets the descriptor to its default state. The internal `entries` array - * is emptied without releasing its backing storage. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts deleted file mode 100644 index b53c868a8..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUBufferDescriptor.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export default GPUBufferDescriptor; -/** - * Reusable descriptor for `GPUDevice.createBuffer()`. - * - * @private - */ -declare class GPUBufferDescriptor { - /** - * The label of the buffer. - * - * @type {string} - */ - label: string; - /** - * The size of the buffer in bytes. - * - * @type {number} - * @default 0 - */ - size: number; - /** - * The allowed usages for the buffer. - * - * @type {number} - * @default 0 - */ - usage: number; - /** - * Whether the buffer is in the mapped state at creation. - * - * @type {boolean} - * @default false - */ - mappedAtCreation: boolean; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts deleted file mode 100644 index 3e3be9d44..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export default GPUCommandEncoderDescriptor; -/** - * Reusable descriptor for `GPUDevice.createCommandEncoder()`. - * - * @private - */ -declare class GPUCommandEncoderDescriptor { - /** - * The label of the command encoder. - * - * @type {string} - */ - label: string; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts deleted file mode 100644 index ab1ccf90e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default GPUComputePassDescriptor; -/** - * Reusable descriptor for `GPUCommandEncoder.beginComputePass()`. - * - * @private - */ -declare class GPUComputePassDescriptor { - /** - * The label of the compute pass. - * - * @type {string} - */ - label: string; - /** - * Defines which timestamp values are written and where. - * - * @type {Object|undefined} - */ - timestampWrites: Object | undefined; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts deleted file mode 100644 index 738679592..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export default GPUComputePipelineDescriptor; -/** - * Reusable descriptor for `GPUDevice.createComputePipeline()`. - * - * @private - */ -declare class GPUComputePipelineDescriptor { - /** - * The label of the compute pipeline. - * - * @type {string} - */ - label: string; - /** - * The pipeline layout the pipeline conforms to, or `'auto'`. - * - * @type {?GPUPipelineLayout|string} - * @default null - */ - layout: (GPUPipelineLayout | string) | null; - /** - * The programmable compute stage. - * - * @type {?Object} - * @default null - */ - compute: Object | null; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts deleted file mode 100644 index 49adfbc13..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default GPUCopyExternalImageDestInfo; -/** - * Reusable descriptor for `GPUCopyExternalImageDestInfo`, the destination - * argument to `GPUQueue.copyExternalImageToTexture()`. - * - * @private - * @augments GPUTexelCopyTextureInfo - */ -declare class GPUCopyExternalImageDestInfo extends GPUTexelCopyTextureInfo { - /** - * The predefined color space the destination texture is interpreted in. - * - * @type {string} - * @default 'srgb' - */ - colorSpace: string; - /** - * Whether the destination texture has premultiplied alpha. - * - * @type {boolean} - * @default false - */ - premultipliedAlpha: boolean; -} -import GPUTexelCopyTextureInfo from './GPUTexelCopyTextureInfo.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts deleted file mode 100644 index ade0e6661..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -export default GPUCopyExternalImageSourceInfo; -/** - * Reusable descriptor for `GPUCopyExternalImageSourceInfo`, the source argument - * to `GPUQueue.copyExternalImageToTexture()`. - * - * @private - */ -declare class GPUCopyExternalImageSourceInfo { - /** - * The image-like source. - * - * @type {?(ImageBitmap|ImageData|HTMLImageElement|HTMLVideoElement|VideoFrame|HTMLCanvasElement|OffscreenCanvas)} - * @default null - */ - source: (ImageBitmap | ImageData | HTMLImageElement | HTMLVideoElement | VideoFrame | HTMLCanvasElement | OffscreenCanvas) | null; - /** - * The origin offset within the source. - * - * @type {{x: number, y: number}} - */ - origin: { - x: number; - y: number; - }; - /** - * Whether the source is flipped vertically before copying. - * - * @type {boolean} - * @default false - */ - flipY: boolean; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts deleted file mode 100644 index ad73dea82..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUExtent3D.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -export default GPUExtent3D; -/** - * Reusable descriptor for `GPUExtent3D` in its dictionary form, used by - * `GPUQueue.writeTexture()`, `GPUQueue.copyExternalImageToTexture()` and - * the various `GPUCommandEncoder` copy methods. - * - * @private - */ -declare class GPUExtent3D { - /** - * The width of the extent. - * - * @type {number} - * @default 0 - */ - width: number; - /** - * The height of the extent. - * - * @type {number} - * @default 1 - */ - height: number; - /** - * The depth (for 3D textures) or number of array layers. - * - * @type {number} - * @default 1 - */ - depthOrArrayLayers: number; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts deleted file mode 100644 index a2263550f..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default GPUPipelineLayoutDescriptor; -/** - * Reusable descriptor for `GPUDevice.createPipelineLayout()`. - * - * @private - */ -declare class GPUPipelineLayoutDescriptor { - /** - * The label of the pipeline layout. - * - * @type {string} - */ - label: string; - /** - * The set of bind group layouts the pipeline layout describes. - * - * @type {?Array} - * @default null - */ - bindGroupLayouts: Array | null; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts deleted file mode 100644 index 6e44a65da..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -export default GPUQuerySetDescriptor; -/** - * Reusable descriptor for `GPUDevice.createQuerySet()`. - * - * @private - */ -declare class GPUQuerySetDescriptor { - /** - * The label of the query set. - * - * @type {string} - */ - label: string; - /** - * The type of queries managed by the set. - * - * @type {string|undefined} - */ - type: string | undefined; - /** - * The number of queries managed by the set. - * - * @type {number} - * @default 0 - */ - count: number; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts deleted file mode 100644 index b027f82ca..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -export default GPURenderBundleEncoderDescriptor; -/** - * Reusable descriptor for `GPUDevice.createRenderBundleEncoder()`. - * - * @private - */ -declare class GPURenderBundleEncoderDescriptor { - /** - * The label of the render bundle encoder. - * - * @type {string} - */ - label: string; - /** - * The formats of the color attachments the bundle is compatible with. - * - * @type {?Array} - * @default null - */ - colorFormats: Array | null; - /** - * The format of the depth/stencil attachment the bundle is compatible with. - * - * @type {string|undefined} - */ - depthStencilFormat: string | undefined; - /** - * The number of samples per pixel the bundle is compatible with. - * - * @type {number} - * @default 1 - */ - sampleCount: number; - /** - * Whether the depth attachment is read-only. - * - * @type {boolean} - * @default false - */ - depthReadOnly: boolean; - /** - * Whether the stencil attachment is read-only. - * - * @type {boolean} - * @default false - */ - stencilReadOnly: boolean; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts deleted file mode 100644 index a6aa47714..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export default GPURenderPassColorAttachment; -/** - * Reusable descriptor for `GPURenderPassColorAttachment`, the type of each - * entry in `GPURenderPassDescriptor.colorAttachments`. - * - * @private - */ -declare class GPURenderPassColorAttachment { - /** - * The texture view the pass renders into. - * - * @type {?GPUTextureView} - * @default null - */ - view: GPUTextureView | null; - /** - * The depth slice the pass renders into. - * - * @type {number|undefined} - */ - depthSlice: number | undefined; - /** - * The texture view that receives the resolved output of multisampled rendering. - * - * @type {?GPUTextureView|undefined} - */ - resolveTarget: (GPUTextureView | undefined) | null; - /** - * The clear value used when `loadOp` is `'clear'`. - * - * @type {Object|undefined} - */ - clearValue: Object | undefined; - /** - * The load operation performed at the start of the pass. - * - * @type {string|undefined} - */ - loadOp: string | undefined; - /** - * The store operation performed at the end of the pass. - * - * @type {string|undefined} - */ - storeOp: string | undefined; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts deleted file mode 100644 index 3bc5d785d..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -export default GPURenderPassDepthStencilAttachment; -/** - * Reusable descriptor for `GPURenderPassDepthStencilAttachment`, the - * `depthStencilAttachment` field of `GPURenderPassDescriptor`. - * - * @private - */ -declare class GPURenderPassDepthStencilAttachment { - /** - * The depth/stencil texture view the pass renders into. - * - * @type {?GPUTextureView} - * @default null - */ - view: GPUTextureView | null; - /** - * The load operation applied to the depth aspect at the start of the pass. - * - * @type {string|undefined} - */ - depthLoadOp: string | undefined; - /** - * The store operation applied to the depth aspect at the end of the pass. - * - * @type {string|undefined} - */ - depthStoreOp: string | undefined; - /** - * The clear value used when `depthLoadOp` is `'clear'`. - * - * @type {number|undefined} - */ - depthClearValue: number | undefined; - /** - * Whether the depth aspect is read-only. - * - * @type {boolean} - * @default false - */ - depthReadOnly: boolean; - /** - * The load operation applied to the stencil aspect at the start of the pass. - * - * @type {string|undefined} - */ - stencilLoadOp: string | undefined; - /** - * The store operation applied to the stencil aspect at the end of the pass. - * - * @type {string|undefined} - */ - stencilStoreOp: string | undefined; - /** - * The clear value used when `stencilLoadOp` is `'clear'`. - * - * @type {number} - * @default 0 - */ - stencilClearValue: number; - /** - * Whether the stencil aspect is read-only. - * - * @type {boolean} - * @default false - */ - stencilReadOnly: boolean; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts deleted file mode 100644 index 34e775c38..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -export default GPURenderPassDescriptor; -/** - * Reusable descriptor for `GPUCommandEncoder.beginRenderPass()`. - * - * @private - */ -declare class GPURenderPassDescriptor { - /** - * The label of the render pass. - * - * @type {string} - */ - label: string; - /** - * The color attachments of the render pass. - * - * @type {Array} - */ - colorAttachments: Array; - /** - * The depth-stencil attachment of the render pass. - * - * @type {Object|undefined} - */ - depthStencilAttachment: Object | undefined; - /** - * The query set used for occlusion queries during the pass. - * - * @type {?GPUQuerySet|undefined} - */ - occlusionQuerySet: (GPUQuerySet | undefined) | null; - /** - * Defines which timestamp values are written and where. - * - * @type {Object|undefined} - */ - timestampWrites: Object | undefined; - /** - * The maximum number of draw calls that can be issued during the pass. - * - * @type {number} - * @default 50000000 - */ - maxDrawCount: number; - /** - * Resets the descriptor to its default state. The internal `colorAttachments` - * array is emptied without releasing its backing storage. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts deleted file mode 100644 index f7199f492..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -export default GPURenderPassTimestampWrites; -/** - * Reusable descriptor for `GPURenderPassTimestampWrites`, the - * `timestampWrites` field of `GPURenderPassDescriptor`. The same shape is - * also accepted as `GPUComputePassTimestampWrites`. - * - * @private - */ -declare class GPURenderPassTimestampWrites { - /** - * The query set the timestamps are written to. - * - * @type {?GPUQuerySet} - * @default null - */ - querySet: GPUQuerySet | null; - /** - * The index in the query set the beginning timestamp is written to. - * - * @type {number|undefined} - */ - beginningOfPassWriteIndex: number | undefined; - /** - * The index in the query set the ending timestamp is written to. - * - * @type {number|undefined} - */ - endOfPassWriteIndex: number | undefined; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts deleted file mode 100644 index e7139e818..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -export default GPURenderPipelineDescriptor; -/** - * Reusable descriptor for `GPUDevice.createRenderPipeline()` and - * `createRenderPipelineAsync()`. - * - * @private - */ -declare class GPURenderPipelineDescriptor { - /** - * The label of the render pipeline. - * - * @type {string} - */ - label: string; - /** - * The pipeline layout the pipeline conforms to, or `'auto'`. - * - * @type {?GPUPipelineLayout|string} - * @default null - */ - layout: (GPUPipelineLayout | string) | null; - /** - * The programmable vertex stage. - * - * @type {?Object} - * @default null - */ - vertex: Object | null; - /** - * The primitive-assembly state. - * - * @type {Object} - */ - primitive: Object; - /** - * The depth/stencil state, omitted when the pipeline has no depth or stencil aspect. - * - * @type {Object|undefined} - */ - depthStencil: Object | undefined; - /** - * The multisample state. - * - * @type {GPUMultisampleState} - */ - multisample: GPUMultisampleState; - /** - * The programmable fragment stage. Omitted for vertex-only pipelines. - * - * @type {?Object} - * @default null - */ - fragment: Object | null; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} -/** - * Reusable nested state for `GPURenderPipelineDescriptor.multisample`. - * - * @private - */ -declare class GPUMultisampleState { - /** - * The number of samples per pixel. - * - * @type {number} - * @default 1 - */ - count: number; - /** - * A bitmask determining which samples are written to. - * - * @type {number} - * @default 0xFFFFFFFF - */ - mask: number; - /** - * Whether a fragment's alpha channel is used to generate a sample coverage mask. - * - * @type {boolean} - * @default false - */ - alphaToCoverageEnabled: boolean; - /** - * Resets the state to its default values. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts deleted file mode 100644 index a3b28563b..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.d.ts +++ /dev/null @@ -1,87 +0,0 @@ -export default GPUSamplerDescriptor; -/** - * Reusable descriptor for `GPUDevice.createSampler()`. - * - * @private - */ -declare class GPUSamplerDescriptor { - /** - * The label of the sampler. - * - * @type {string} - */ - label: string; - /** - * The address mode for the sampler's U coordinate. - * - * @type {string} - * @default 'clamp-to-edge' - */ - addressModeU: string; - /** - * The address mode for the sampler's V coordinate. - * - * @type {string} - * @default 'clamp-to-edge' - */ - addressModeV: string; - /** - * The address mode for the sampler's W coordinate. - * - * @type {string} - * @default 'clamp-to-edge' - */ - addressModeW: string; - /** - * The magnification filter mode. - * - * @type {string} - * @default 'nearest' - */ - magFilter: string; - /** - * The minification filter mode. - * - * @type {string} - * @default 'nearest' - */ - minFilter: string; - /** - * The mipmap filter mode. - * - * @type {string} - * @default 'nearest' - */ - mipmapFilter: string; - /** - * The minimum level of detail used to sample. - * - * @type {number} - * @default 0 - */ - lodMinClamp: number; - /** - * The maximum level of detail used to sample. - * - * @type {number} - * @default 32 - */ - lodMaxClamp: number; - /** - * The compare function used by the sampler. - * - * @type {string|undefined} - */ - compare: string | undefined; - /** - * The maximum allowed anisotropic filtering. - * - * @type {number} - * @default 1 - */ - maxAnisotropy: number; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts deleted file mode 100644 index 25b481010..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export default GPUShaderModuleDescriptor; -/** - * Reusable descriptor for `GPUDevice.createShaderModule()`. - * - * @private - */ -declare class GPUShaderModuleDescriptor { - /** - * The label of the shader module. - * - * @type {string} - */ - label: string; - /** - * The WGSL source code of the shader module. - * - * @type {string} - */ - code: string; - /** - * Compilation hints that may help the implementation produce optimized code. - * - * @type {Array} - */ - compilationHints: Array; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts deleted file mode 100644 index 8e7a5e2aa..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export default GPUTexelCopyBufferInfo; -/** - * Reusable descriptor for `GPUTexelCopyBufferInfo`, the buffer side of - * `GPUCommandEncoder.copyTextureToBuffer()` and `copyBufferToTexture()`. - * - * @private - */ -declare class GPUTexelCopyBufferInfo { - /** - * The target buffer. - * - * @type {?GPUBuffer} - * @default null - */ - buffer: GPUBuffer | null; - /** - * The byte offset within the buffer where the texel data begins. - * - * @type {number} - * @default 0 - */ - offset: number; - /** - * The stride, in bytes, between rows of texel blocks. - * - * @type {number|undefined} - */ - bytesPerRow: number | undefined; - /** - * The number of texel block rows per single image of the texture. - * - * @type {number|undefined} - */ - rowsPerImage: number | undefined; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts deleted file mode 100644 index a78ad019e..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export default GPUTexelCopyBufferLayout; -/** - * Reusable descriptor for `GPUTexelCopyBufferLayout`, the data-layout argument - * to `GPUQueue.writeTexture()`. - * - * @private - */ -declare class GPUTexelCopyBufferLayout { - /** - * The byte offset within the source data where the texel data begins. - * - * @type {number} - * @default 0 - */ - offset: number; - /** - * The stride, in bytes, between rows of texel blocks. - * - * @type {number|undefined} - */ - bytesPerRow: number | undefined; - /** - * The number of texel block rows per single image of the texture. - * - * @type {number|undefined} - */ - rowsPerImage: number | undefined; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts deleted file mode 100644 index b57669f02..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -export default GPUTexelCopyTextureInfo; -/** - * Reusable descriptor for `GPUTexelCopyTextureInfo`, the texture side of - * `GPUCommandEncoder.copyTextureToTexture()`, `copyTextureToBuffer()` and - * `GPUQueue.writeTexture()`. - * - * @private - */ -declare class GPUTexelCopyTextureInfo { - /** - * The target texture. - * - * @type {?GPUTexture} - * @default null - */ - texture: GPUTexture | null; - /** - * The mipmap level of the texture. - * - * @type {number} - * @default 0 - */ - mipLevel: number; - /** - * The origin offset within the texture. - * - * @type {{x: number, y: number, z: number}} - */ - origin: { - x: number; - y: number; - z: number; - }; - /** - * Which aspect of the texture is referenced. - * - * @type {string} - * @default 'all' - */ - aspect: string; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts deleted file mode 100644 index a9507b721..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureDescriptor.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -export default GPUTextureDescriptor; -/** - * Reusable descriptor for `GPUDevice.createTexture()`. - * - * @private - */ -declare class GPUTextureDescriptor { - /** - * The label of the texture. - * - * @type {string} - */ - label: string; - /** - * The size of the texture. - * - * @type {{width: number, height: number, depthOrArrayLayers: number}} - */ - size: { - width: number; - height: number; - depthOrArrayLayers: number; - }; - /** - * The number of mip levels the texture will contain. - * - * @type {number} - * @default 1 - */ - mipLevelCount: number; - /** - * The sample count of the texture. - * - * @type {number} - * @default 1 - */ - sampleCount: number; - /** - * The dimension of the set of texel coordinates. - * - * @type {string} - * @default '2d' - */ - dimension: string; - /** - * The format of the texture. - * - * @type {string|undefined} - */ - format: string | undefined; - /** - * The allowed usages for the texture. - * - * @type {number|undefined} - */ - usage: number | undefined; - /** - * The formats that views of this texture may use. - * - * @type {Array} - */ - viewFormats: Array; - /** - * The view dimension to use when binding the texture (compatibility mode). - * - * @type {string|undefined} - */ - textureBindingViewDimension: string | undefined; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts deleted file mode 100644 index a70410284..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -export default GPUTextureViewDescriptor; -/** - * Reusable descriptor for `GPUTexture.createView()`. - * - * @private - */ -declare class GPUTextureViewDescriptor { - /** - * The label of the texture view. - * - * @type {string} - */ - label: string; - /** - * The format of the texture view. - * - * @type {string|undefined} - */ - format: string | undefined; - /** - * The dimension of the texture view. - * - * @type {string|undefined} - */ - dimension: string | undefined; - /** - * The allowed usages for the texture view. - * - * @type {number} - * @default 0 - */ - usage: number; - /** - * Which aspect of the texture is referenced. - * - * @type {string} - * @default 'all' - */ - aspect: string; - /** - * The first mip level accessible to the texture view. - * - * @type {number} - * @default 0 - */ - baseMipLevel: number; - /** - * The number of mip levels accessible to the texture view. - * - * @type {number|undefined} - */ - mipLevelCount: number | undefined; - /** - * The first array layer accessible to the texture view. - * - * @type {number} - * @default 0 - */ - baseArrayLayer: number; - /** - * The number of array layers accessible to the texture view. - * - * @type {number|undefined} - */ - arrayLayerCount: number | undefined; - /** - * The component swizzle to apply when sampling the texture view. - * Requires the `'texture-component-swizzle'` feature; ignored otherwise. - * - * @type {string} - * @default 'rgba' - */ - swizzle: string; - /** - * Resets the descriptor to its default state. - */ - reset(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts deleted file mode 100644 index f6f699f14..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export default BasicNodeLibrary; -/** - * This version of a node library represents a basic version - * just focusing on lights and tone mapping techniques. - * - * @private - * @augments NodeLibrary - */ -declare class BasicNodeLibrary extends NodeLibrary { -} -import NodeLibrary from '../../common/nodes/NodeLibrary.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts deleted file mode 100644 index ee01cd7e7..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export default StandardNodeLibrary; -/** - * This version of a node library represents the standard version - * used in {@link WebGPURenderer}. It maps lights, tone mapping - * techniques and materials to node-based implementations. - * - * @augments NodeLibrary - */ -declare class StandardNodeLibrary extends NodeLibrary { -} -import NodeLibrary from '../../common/nodes/NodeLibrary.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts deleted file mode 100644 index 26127eaa9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +++ /dev/null @@ -1,648 +0,0 @@ -export default WGSLNodeBuilder; -/** - * A node builder targeting WGSL. - * - * This module generates WGSL shader code from node materials and also - * generates the respective bindings and vertex buffer definitions. These - * data are later used by the renderer to create render and compute pipelines - * for render objects. - * - * @augments NodeBuilder - */ -declare class WGSLNodeBuilder extends NodeBuilder { - /** - * Constructs a new WGSL node builder renderer. - * - * @param {Object3D} object - The 3D object. - * @param {Renderer} renderer - The renderer. - */ - constructor(object: Object3D, renderer: Renderer); - /** - * A dictionary that holds for each shader stage ('vertex', 'fragment', 'compute') - * another dictionary which manages UBOs per group ('render','frame','object'). - * - * @type {Object>} - */ - uniformGroups: { - [x: string]: { - [x: string]: NodeUniformsGroup; - }; - }; - /** - * A dictionary that holds the assigned binding indices for each uniform group. - * This ensures the same binding index is used across all shader stages. - * - * @type {Object} - */ - uniformGroupsBindings: { - [x: string]: { - index: number; - id: number; - }; - }; - /** - * A dictionary that holds for each shader stage a Map of builtins. - * - * @type {Object>} - */ - builtins: { - [x: string]: Map; - }; - /** - * A dictionary that holds for each shader stage a Set of directives. - * - * @type {Object>} - */ - directives: { - [x: string]: Set; - }; - /** - * A map for managing scope arrays. Only relevant for when using - * {@link WorkgroupInfoNode} in context of compute shaders. - * - * @type {Map} - */ - scopedArrays: Map; - /** - * A flag that indicates that early returns are allowed. - * - * @type {boolean} - * @default true - */ - allowEarlyReturns: boolean; - /** - * A flag that indicates that global variables are allowed. - * - * @type {boolean} - * @default true - */ - allowGlobalVariables: boolean; - /** - * Generates the WGSL snippet for sampled textures. - * - * @private - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - private _generateTextureSample; - /** - * Generates the WGSL snippet when sampling textures with explicit mip level. - * - * @private - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - private generateTextureSampleLevel; - /** - * Generates a wrap function used in context of textures. - * - * @param {Texture} texture - The texture to generate the function for. - * @return {string} The name of the generated function. - */ - generateWrapFunction(texture: Texture): string; - /** - * Generates a WGSL variable that holds the texture dimension of the given texture. - * It also returns information about the number of layers (elements) of an arrayed - * texture as well as the cube face count of cube textures. - * - * @param {Texture} texture - The texture to generate the function for. - * @param {string} textureProperty - The name of the video texture uniform in the shader. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @return {string} The name of the dimension variable. - */ - generateTextureDimension(texture: Texture, textureProperty: string, levelSnippet: string): string; - /** - * Generates the WGSL snippet that resolves the dimensions of the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level. - * @return {string} The WGSL snippet. - */ - generateTextureSize(texture: Texture, textureProperty: string, levelSnippet: string): string; - /** - * Generates the WGSL snippet for a manual filtered texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @return {string} The WGSL snippet. - */ - generateFilteredTexture(texture: Texture, textureProperty: string, uvSnippet: string, offsetSnippet: string | null, levelSnippet?: string, depthSnippet: string | null): string; - /** - * Generates the WGSL snippet for a texture lookup with explicit level-of-detail. - * Since it's a lookup, no sampling or filtering is applied. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [levelSnippet='0u'] - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @return {string} The WGSL snippet. - */ - generateTextureLod(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, levelSnippet?: string): string; - /** - * Generates the WGSL snippet that reads a single texel from a storage texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateStorageTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet that reads a single texel from a texture without sampling or filtering. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureLoad(texture: Texture, textureProperty: string, uvIndexSnippet: string, levelSnippet: string | null, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet that writes a single texel to a texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvIndexSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {string} valueSnippet - A WGSL snippet that represent the new texel value. - * @return {string} The WGSL snippet. - */ - generateTextureStore(texture: Texture, textureProperty: string, uvIndexSnippet: string, depthSnippet: string | null, valueSnippet: string): string; - /** - * Returns `true` if the sampled values of the given texture should be compared against a reference value. - * - * @param {Texture} texture - The texture. - * @return {boolean} Whether the sampled values of the given texture should be compared against a reference value or not. - */ - isSampleCompare(texture: Texture): boolean; - /** - * Returns `true` if the given texture is unfilterable. - * - * @param {Texture} texture - The texture. - * @return {boolean} Whether the given texture is unfilterable or not. - */ - isUnfilterable(texture: Texture): boolean; - /** - * Generates the WGSL snippet for sampling/loading the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTexture(texture: Texture, textureProperty: string, uvSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the WGSL snippet for sampling/loading the given texture using explicit gradients. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {Array} gradSnippet - An array holding both gradient WGSL snippets. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTextureGrad(texture: Texture, textureProperty: string, uvSnippet: string, gradSnippet: Array, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the WGSL snippet for sampling a depth texture and comparing the sampled depth values - * against a reference value. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A WGSL snippet that represents the reference value. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTextureCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Generates the WGSL snippet for gathering four texels from the given texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} gatherSnippet - A WGSL snippet that represents the index of the channel to read. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureGather(texture: Texture, textureProperty: string, uvSnippet: string, gatherSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet for performing a depth comparison on four texels in the given depth texture. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} compareSnippet - A WGSL snippet that represents the reference value. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureGatherCompare(texture: Texture, textureProperty: string, uvSnippet: string, compareSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet when sampling textures with explicit mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} levelSnippet - A WGSL snippet that represents the mip level, with level 0 containing a full size version of the texture. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @return {string} The WGSL snippet. - */ - generateTextureLevel(texture: Texture, textureProperty: string, uvSnippet: string, levelSnippet: string, depthSnippet: string | null, offsetSnippet: string | null): string; - /** - * Generates the WGSL snippet when sampling textures with a bias to the mip level. - * - * @param {Texture} texture - The texture. - * @param {string} textureProperty - The name of the texture uniform in the shader. - * @param {string} uvSnippet - A WGSL snippet that represents texture coordinates used for sampling. - * @param {string} biasSnippet - A WGSL snippet that represents the bias to apply to the mip level before sampling. - * @param {?string} depthSnippet - A WGSL snippet that represents 0-based texture array index to sample. - * @param {?string} offsetSnippet - A WGSL snippet that represents the offset that will be applied to the unnormalized texture coordinate before sampling the texture. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The WGSL snippet. - */ - generateTextureBias(texture: Texture, textureProperty: string, uvSnippet: string, biasSnippet: string, depthSnippet: string | null, offsetSnippet: string | null, shaderStage?: string): string; - /** - * Returns a WGSL snippet that represents the property name of the given node. - * - * @param {Node} node - The node. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The property name. - */ - getPropertyName(node: Node, shaderStage?: string): string; - /** - * Returns whether the given name is a reserved keyword of WGSL. - * - * @param {string} name - The name to test. - * @return {boolean} Whether the name is a reserved keyword or not. - */ - isReservedKeyword(name: string): boolean; - /** - * Returns the native shader operator name for a given generic name. - * - * @param {string} op - The operator name to resolve. - * @return {?string} The resolved operator name. - */ - getFunctionOperator(op: string): string | null; - /** - * Returns the node access for the given node and shader stage. - * - * @param {StorageTextureNode|StorageBufferNode} node - The storage node. - * @param {string} shaderStage - The shader stage. - * @return {string} The node access. - */ - getNodeAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; - /** - * Returns A WGSL snippet representing the storage access. - * - * @param {StorageTextureNode|StorageBufferNode} node - The storage node. - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet representing the storage access. - */ - getStorageAccess(node: StorageTextureNode | StorageBufferNode, shaderStage: string): string; - /** - * This method is one of the more important ones since it's responsible - * for generating a matching binding instance for the given uniform node. - * - * These bindings are later used in the renderer to create bind groups - * and layouts. - * - * @param {UniformNode} node - The uniform node. - * @param {string} type - The node data type. - * @param {string} shaderStage - The shader stage. - * @param {?string} [name=null] - An optional uniform name. - * @return {NodeUniform} The node uniform object. - */ - getUniformFromNode(node: UniformNode, type: string, shaderStage: string, name?: string | null): NodeUniform; - /** - * This method should be used whenever builtins are required in nodes. - * The internal builtins data structure will make sure builtins are - * defined in the WGSL source. - * - * @param {string} name - The builtin name. - * @param {string} property - The property name. - * @param {string} type - The node data type. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {string} The property name. - */ - getBuiltin(name: string, property: string, type: string, shaderStage?: string): string; - /** - * Returns `true` if the given builtin is defined in the given shader stage. - * - * @param {string} name - The builtin name. - * @param {string} [shaderStage=this.shaderStage] - The shader stage this code snippet is generated for. - * @return {boolean} Whether the given builtin is defined in the given shader stage or not. - */ - hasBuiltin(name: string, shaderStage?: string): boolean; - /** - * Builds the given shader node. - * - * @param {ShaderNodeInternal} shaderNode - The shader node. - * @return {string} The WGSL function code. - */ - buildFunctionCode(shaderNode: ShaderNodeInternal): string; - /** - * Returns a builtin representing the index of a compute invocation within the scope of a workgroup load. - * - * @return {string} The invocation local index. - */ - getInvocationLocalIndex(): string; - /** - * Returns a builtin representing the size of a subgroup within the current shader. - * - * @return {string} The subgroup size. - */ - getSubgroupSize(): string; - /** - * Returns a builtin representing the index of a compute invocation within the scope of a subgroup. - * - * @return {string} The invocation subgroup index. - */ - getInvocationSubgroupIndex(): string; - /** - * Returns a builtin representing the index of a compute invocation's subgroup within its workgroup. - * - * @return {string} The subgroup index. - */ - getSubgroupIndex(): string; - /** - * Overwritten as a NOP since this method is intended for the WebGL 2 backend. - * - * @return {null} Null. - */ - getDrawIndex(): null; - /** - * Returns the frag depth builtin. - * - * @return {string} The frag depth builtin. - */ - getFragDepth(): string; - /** - * Returns the clip distances builtin. - * - * @return {string} The clip distances builtin. - */ - getClipDistance(): string; - /** - * Enables the given directive for the given shader stage. - * - * @param {string} name - The directive name. - * @param {string} [shaderStage=this.shaderStage] - The shader stage to enable the directive for. - */ - enableDirective(name: string, shaderStage?: string): void; - /** - * Returns the directives of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} A WGSL snippet that enables the directives of the given stage. - */ - getDirectives(shaderStage: string): string; - /** - * Enables the 'subgroups' directive. - */ - enableSubGroups(): void; - /** - * Enables the 'subgroups-f16' directive. - */ - enableSubgroupsF16(): void; - /** - * Enables the 'clip_distances' directive. - */ - enableClipDistances(): void; - /** - * Enables the 'f16' directive. - */ - enableShaderF16(): void; - /** - * Enables the 'dual_source_blending' directive. - */ - enableDualSourceBlending(): void; - /** - * Enables hardware clipping. - * - * @param {string} planeCount - The clipping plane count. - */ - enableHardwareClipping(planeCount: string): void; - /** - * Returns the builtins of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} A WGSL snippet that represents the builtins of the given stage. - */ - getBuiltins(shaderStage: string): string; - /** - * This method should be used when a new scoped buffer is used in context of - * compute shaders. It adds the array to the internal data structure which is - * later used to generate the respective WGSL. - * - * @param {string} name - The array name. - * @param {string} scope - The scope. - * @param {string} bufferType - The buffer type. - * @param {string} bufferCount - The buffer count. - * @return {string} The array name. - */ - getScopedArray(name: string, scope: string, bufferType: string, bufferCount: string): string; - /** - * Returns the scoped arrays of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string|undefined} The WGSL snippet that defines the scoped arrays. - * Returns `undefined` when used in the vertex or fragment stage. - */ - getScopedArrays(shaderStage: string): string | undefined; - /** - * Returns the shader attributes of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the shader attributes. - */ - getAttributes(shaderStage: string): string; - /** - * Returns the members of the given struct type node as a WGSL string. - * - * @param {StructTypeNode} struct - The struct type node. - * @return {string} The WGSL snippet that defines the struct members. - */ - getStructMembers(struct: StructTypeNode): string; - /** - * Returns the structs of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the structs. - */ - getStructs(shaderStage: string): string; - /** - * Returns a WGSL string representing a variable. - * - * @param {string} type - The variable's type. - * @param {string} name - The variable's name. - * @param {?number} [count=null] - The array length. - * @param {string} [qualifier=''] - The variable's qualifier. - * @return {string} The WGSL snippet that defines a variable. - */ - getVar(type: string, name: string, count?: number | null, qualifier?: string): string; - /** - * Returns the variables of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the variables. - */ - getVars(shaderStage: string, global?: boolean): string; - /** - * Returns the varyings of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the varyings. - */ - getVaryings(shaderStage: string): string; - isCustomStruct(nodeUniform: any): any; - /** - * Returns the uniforms of the given shader stage as a WGSL string. - * - * @param {string} shaderStage - The shader stage. - * @return {string} The WGSL snippet that defines the uniforms. - */ - getUniforms(shaderStage: string): string; - /** - * Returns the native shader method name for a given generic name. - * - * @param {string} method - The method name to resolve. - * @param {?string} [output=null] - An optional output. - * @return {string} The resolved WGSL method name. - */ - getMethod(method: string, output?: string | null): string; - /** - * Returns the bitcast method name for a given input and outputType. - * - * @param {string} type - The output type to bitcast to. - * @return {string} The resolved WGSL bitcast invocation. - */ - getBitcastMethod(type: string): string; - /** - * Returns the float packing method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the float values are mapped to the integer range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolve WGSL float packing method name. - */ - getFloatPackingMethod(encoding: string, layout?: string): string; - /** - * Returns the float unpacking method name for a given numeric encoding. - * - * @param {string} encoding - The numeric encoding that describes how the integer values are mapped to the float range. - * @param {string} [layout='2x16'] - The component layout of the packed integer. - * @returns {string} The resolve WGSL float unpacking method name. - */ - getFloatUnpackingMethod(encoding: string, layout?: string): string; - /** - * Returns the native snippet for a ternary operation. - * - * @param {string} condSnippet - The condition determining which expression gets resolved. - * @param {string} ifSnippet - The expression to resolve to if the condition is true. - * @param {string} elseSnippet - The expression to resolve to if the condition is false. - * @return {string} The resolved method name. - */ - getTernary(condSnippet: string, ifSnippet: string, elseSnippet: string): string; - /** - * Whether the requested feature is available or not. - * - * @param {string} name - The requested feature. - * @return {boolean} Whether the requested feature is supported or not. - */ - isAvailable(name: string): boolean; - /** - * Returns the native shader method name for a given generic name. - * - * @private - * @param {string} method - The method name to resolve. - * @return {string} The resolved WGSL method name. - */ - private _getWGSLMethod; - /** - * Includes the given method name into the current - * function node. - * - * @private - * @param {string} name - The method name to include. - * @return {CodeNode} The respective code node. - */ - private _include; - /** - * Returns a WGSL vertex shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getWGSLVertexCode; - /** - * Returns a WGSL fragment shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @return {string} The vertex shader. - */ - private _getWGSLFragmentCode; - /** - * Returns a WGSL compute shader based on the given shader data. - * - * @private - * @param {Object} shaderData - The shader data. - * @param {string} workgroupSize - The workgroup size. - * @return {string} The vertex shader. - */ - private _getWGSLComputeCode; - /** - * Returns a WGSL struct based on the given name and variables. - * - * @private - * @param {string} name - The struct name. - * @param {string} vars - The struct variables. - * @return {string} The WGSL snippet representing a struct. - */ - private _getWGSLStruct; - /** - * Returns a WGSL struct binding. - * - * @private - * @param {string} name - The struct name. - * @param {string} vars - The struct variables. - * @param {string} access - The access. - * @param {number} [binding=0] - The binding index. - * @param {number} [group=0] - The group index. - * @return {string} The WGSL snippet representing a struct binding. - */ - private _getWGSLStructBinding; -} -import { NodeBuilder } from '../../../nodes/Nodes.js'; -import NodeUniformsGroup from '../../common/nodes/NodeUniformsGroup.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts deleted file mode 100644 index 3cbe9f2f5..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeFunction.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export default WGSLNodeFunction; -/** - * This class represents a WSL node function. - * - * @augments NodeFunction - */ -declare class WGSLNodeFunction extends NodeFunction { - /** - * Constructs a new WGSL node function. - * - * @param {string} source - The WGSL source. - */ - constructor(source: string); - inputsCode: any; - blockCode: any; - outputType: any; - /** - * This method returns the WGSL code of the node function. - * - * @param {string} [name=this.name] - The function's name. - * @return {string} The shader code. - */ - getCode(name?: string): string; -} -import NodeFunction from '../../../nodes/core/NodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts deleted file mode 100644 index 58ab25284..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/nodes/WGSLNodeParser.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export default WGSLNodeParser; -/** - * A WGSL node parser. - * - * @augments NodeParser - */ -declare class WGSLNodeParser extends NodeParser { - /** - * The method parses the given WGSL code an returns a node function. - * - * @param {string} source - The WGSL code. - * @return {WGSLNodeFunction} A node function. - */ - parseFunction(source: string): WGSLNodeFunction; -} -import NodeParser from '../../../nodes/core/NodeParser.js'; -import WGSLNodeFunction from './WGSLNodeFunction.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts deleted file mode 100644 index 6f286dacf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUAttributeUtils.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -export default WebGPUAttributeUtils; -/** - * A WebGPU backend utility module for managing shader attributes. - * - * @private - */ -declare class WebGPUAttributeUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Creates the GPU buffer for the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - * @param {GPUBufferUsage} usage - A flag that indicates how the buffer may be used after its creation. - */ - createAttribute(attribute: BufferAttribute, usage: GPUBufferUsage): void; - /** - * Updates the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - updateAttribute(attribute: BufferAttribute): void; - /** - * This method creates the vertex buffer layout data which are - * require when creating a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @return {Array} An array holding objects which describe the vertex buffer layout. - */ - createShaderVertexBuffers(renderObject: RenderObject): Array; - /** - * Destroys the GPU buffer of the given buffer attribute. - * - * @param {BufferAttribute} attribute - The buffer attribute. - */ - destroyAttribute(attribute: BufferAttribute): void; - /** - * This method performs a readback operation by moving buffer data from - * a storage buffer attribute from the GPU to the CPU. ReadbackBuffer can - * be used to retain and reuse handles to the intermediate buffers and prevent - * new allocation. - * - * @async - * @param {BufferAttribute} attribute - The storage buffer attribute to read frm. - * @param {number} count - The offset from which to start reading the - * @param {number} offset - The storage buffer attribute. - * @param {ReadbackBuffer|ArrayBuffer} target - The storage buffer attribute. - * @return {Promise} A promise that resolves with the buffer data when the data are ready. - */ - getArrayBufferAsync(attribute: BufferAttribute, target?: ReadbackBuffer | ArrayBuffer, offset?: number, count?: number): Promise; - /** - * Returns the vertex format of the given buffer attribute. - * - * @private - * @param {BufferAttribute} geometryAttribute - The buffer attribute. - * @return {string|undefined} The vertex format (e.g. 'float32x3'). - */ - private _getVertexFormat; - /** - * Utility method for handling interleaved buffer attributes correctly. - * To process them, their `InterleavedBuffer` is returned. - * - * @private - * @param {BufferAttribute} attribute - The attribute. - * @return {BufferAttribute|InterleavedBuffer} - */ - private _getBufferAttribute; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts deleted file mode 100644 index ebe8cf500..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUBindingUtils.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -export default WebGPUBindingUtils; -/** - * A WebGPU backend utility module for managing bindings. - * - * When reading the documentation it's helpful to keep in mind that - * all class definitions starting with 'GPU*' are modules from the - * WebGPU API. So for example `BindGroup` is a class from the engine - * whereas `GPUBindGroup` is a class from WebGPU. - * - * @private - */ -declare class WebGPUBindingUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * A cache that maps combinations of layout entries to existing bind group layouts. - * - * @private - * @type {Map} - */ - private _bindGroupLayoutCache; - /** - * Creates a GPU bind group layout for the given bind group. - * - * @param {BindGroup} bindGroup - The bind group. - * @return {GPUBindGroupLayout} The GPU bind group layout. - */ - createBindingsLayout(bindGroup: BindGroup): GPUBindGroupLayout; - /** - * Creates bindings from the given bind group definition. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {Array} bindings - Array of bind groups. - * @param {string} cacheKey - The cache key. - * @param {number} version - The version. - */ - createBindings(bindGroup: BindGroup, bindings: Array, cacheKey: string, version?: number): void; - /** - * Updates a buffer binding. - * - * @param {Buffer} binding - The buffer binding to update. - */ - updateBinding(binding: Buffer): void; - /** - * Creates a GPU bind group for the camera index. - * - * @param {Uint32Array} data - The index data. - * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. - * @return {GPUBindGroup} The GPU bind group. - */ - createBindGroupIndex(data: Uint32Array, layoutGPU: GPUBindGroupLayout): GPUBindGroup; - /** - * Creates a GPU bind group for the given bind group and GPU layout. - * - * @param {BindGroup} bindGroup - The bind group. - * @param {GPUBindGroupLayout} layoutGPU - The GPU bind group layout. - * @return {GPUBindGroup} The GPU bind group. - */ - createBindGroup(bindGroup: BindGroup, layoutGPU: GPUBindGroupLayout): GPUBindGroup; - /** - * Creates a GPU bind group layout entries for the given bind group. - * - * @private - * @param {BindGroup} bindGroup - The bind group. - * @return {Array} The GPU bind group layout entries. - */ - private _createLayoutEntries; - /** - * Delete the data associated with a bind group. - * - * @param {BindGroup} bindGroup - The bind group. - */ - deleteBindGroupData(bindGroup: BindGroup): void; - /** - * Frees internal resources. - */ - dispose(): void; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts deleted file mode 100644 index c56d99d65..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUCapabilities.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export default WebGPUCapabilities; -/** - * A WebGPU backend utility module for managing the device's capabilities. - * - * @private - */ -declare class WebGPUCapabilities { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Returns the maximum anisotropy texture filtering value. - * - * @return {number} The maximum anisotropy texture filtering value. - */ - getMaxAnisotropy(): number; - /** - * Returns the maximum number of bytes available for uniform buffers. - * - * @return {number} The maximum number of bytes available for uniform buffers. - */ - getUniformBufferLimit(): number; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts deleted file mode 100644 index b8fc49536..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUConstants.d.ts +++ /dev/null @@ -1,301 +0,0 @@ -export namespace GPUPrimitiveTopology { - let PointList: string; - let LineList: string; - let LineStrip: string; - let TriangleList: string; - let TriangleStrip: string; -} -export const GPUShaderStage: any; -export namespace GPUCompareFunction { - let Never: string; - let Less: string; - let Equal: string; - let LessEqual: string; - let Greater: string; - let NotEqual: string; - let GreaterEqual: string; - let Always: string; -} -export namespace GPUStoreOp { - let Store: string; - let Discard: string; -} -export namespace GPULoadOp { - let Load: string; - let Clear: string; -} -export namespace GPUFrontFace { - let CCW: string; - let CW: string; -} -export namespace GPUCullMode { - let None: string; - let Front: string; - let Back: string; -} -export namespace GPUIndexFormat { - let Uint16: string; - let Uint32: string; -} -export namespace GPUVertexFormat { - export let Uint8x2: string; - export let Uint8x4: string; - export let Sint8x2: string; - export let Sint8x4: string; - export let Unorm8x2: string; - export let Unorm8x4: string; - export let Snorm8x2: string; - export let Snorm8x4: string; - export let Uint16x2: string; - export let Uint16x4: string; - export let Sint16x2: string; - export let Sint16x4: string; - export let Unorm16x2: string; - export let Unorm16x4: string; - export let Snorm16x2: string; - export let Snorm16x4: string; - export let Float16x2: string; - export let Float16x4: string; - export let Float32: string; - export let Float32x2: string; - export let Float32x3: string; - export let Float32x4: string; - let Uint32_1: string; - export { Uint32_1 as Uint32 }; - export let Uint32x2: string; - export let Uint32x3: string; - export let Uint32x4: string; - export let Sint32: string; - export let Sint32x2: string; - export let Sint32x3: string; - export let Sint32x4: string; -} -export namespace GPUTextureFormat { - let R8Unorm: string; - let R8Snorm: string; - let R8Uint: string; - let R8Sint: string; - let R16Uint: string; - let R16Sint: string; - let R16Float: string; - let RG8Unorm: string; - let RG8Snorm: string; - let RG8Uint: string; - let RG8Sint: string; - let R16Unorm: string; - let R16Snorm: string; - let R32Uint: string; - let R32Sint: string; - let R32Float: string; - let RG16Uint: string; - let RG16Sint: string; - let RG16Float: string; - let RGBA8Unorm: string; - let RGBA8UnormSRGB: string; - let RGBA8Snorm: string; - let RGBA8Uint: string; - let RGBA8Sint: string; - let BGRA8Unorm: string; - let BGRA8UnormSRGB: string; - let RG16Unorm: string; - let RG16Snorm: string; - let RGB9E5UFloat: string; - let RGB10A2Unorm: string; - let RG11B10UFloat: string; - let RG32Uint: string; - let RG32Sint: string; - let RG32Float: string; - let RGBA16Uint: string; - let RGBA16Sint: string; - let RGBA16Float: string; - let RGBA16Unorm: string; - let RGBA16Snorm: string; - let RGBA32Uint: string; - let RGBA32Sint: string; - let RGBA32Float: string; - let Stencil8: string; - let Depth16Unorm: string; - let Depth24Plus: string; - let Depth24PlusStencil8: string; - let Depth32Float: string; - let Depth32FloatStencil8: string; - let BC1RGBAUnorm: string; - let BC1RGBAUnormSRGB: string; - let BC2RGBAUnorm: string; - let BC2RGBAUnormSRGB: string; - let BC3RGBAUnorm: string; - let BC3RGBAUnormSRGB: string; - let BC4RUnorm: string; - let BC4RSnorm: string; - let BC5RGUnorm: string; - let BC5RGSnorm: string; - let BC6HRGBUFloat: string; - let BC6HRGBFloat: string; - let BC7RGBAUnorm: string; - let BC7RGBAUnormSRGB: string; - let ETC2RGB8Unorm: string; - let ETC2RGB8UnormSRGB: string; - let ETC2RGB8A1Unorm: string; - let ETC2RGB8A1UnormSRGB: string; - let ETC2RGBA8Unorm: string; - let ETC2RGBA8UnormSRGB: string; - let EACR11Unorm: string; - let EACR11Snorm: string; - let EACRG11Unorm: string; - let EACRG11Snorm: string; - let ASTC4x4Unorm: string; - let ASTC4x4UnormSRGB: string; - let ASTC5x4Unorm: string; - let ASTC5x4UnormSRGB: string; - let ASTC5x5Unorm: string; - let ASTC5x5UnormSRGB: string; - let ASTC6x5Unorm: string; - let ASTC6x5UnormSRGB: string; - let ASTC6x6Unorm: string; - let ASTC6x6UnormSRGB: string; - let ASTC8x5Unorm: string; - let ASTC8x5UnormSRGB: string; - let ASTC8x6Unorm: string; - let ASTC8x6UnormSRGB: string; - let ASTC8x8Unorm: string; - let ASTC8x8UnormSRGB: string; - let ASTC10x5Unorm: string; - let ASTC10x5UnormSRGB: string; - let ASTC10x6Unorm: string; - let ASTC10x6UnormSRGB: string; - let ASTC10x8Unorm: string; - let ASTC10x8UnormSRGB: string; - let ASTC10x10Unorm: string; - let ASTC10x10UnormSRGB: string; - let ASTC12x10Unorm: string; - let ASTC12x10UnormSRGB: string; - let ASTC12x12Unorm: string; - let ASTC12x12UnormSRGB: string; -} -export namespace GPUAddressMode { - let ClampToEdge: string; - let Repeat: string; - let MirrorRepeat: string; -} -export namespace GPUFilterMode { - let Linear: string; - let Nearest: string; -} -export namespace GPUBlendFactor { - let Zero: string; - let One: string; - let Src: string; - let OneMinusSrc: string; - let SrcAlpha: string; - let OneMinusSrcAlpha: string; - let Dst: string; - let OneMinusDst: string; - let DstAlpha: string; - let OneMinusDstAlpha: string; - let SrcAlphaSaturated: string; - let Constant: string; - let OneMinusConstant: string; -} -export namespace GPUBlendOperation { - let Add: string; - let Subtract: string; - let ReverseSubtract: string; - let Min: string; - let Max: string; -} -export namespace GPUColorWriteFlags { - let None_1: number; - export { None_1 as None }; - export let Red: number; - export let Green: number; - export let Blue: number; - export let Alpha: number; - export let All: number; -} -export namespace GPUStencilOperation { - export let Keep: string; - let Zero_1: string; - export { Zero_1 as Zero }; - export let Replace: string; - export let Invert: string; - export let IncrementClamp: string; - export let DecrementClamp: string; - export let IncrementWrap: string; - export let DecrementWrap: string; -} -export namespace GPUBufferBindingType { - let Uniform: string; - let Storage: string; - let ReadOnlyStorage: string; -} -export namespace GPUStorageTextureAccess { - let WriteOnly: string; - let ReadOnly: string; - let ReadWrite: string; -} -export namespace GPUSamplerBindingType { - let Filtering: string; - let NonFiltering: string; - let Comparison: string; -} -export namespace GPUTextureSampleType { - let Float: string; - let UnfilterableFloat: string; - let Depth: string; - let SInt: string; - let UInt: string; -} -export namespace GPUTextureDimension { - let OneD: string; - let TwoD: string; - let ThreeD: string; -} -export namespace GPUTextureViewDimension { - let OneD_1: string; - export { OneD_1 as OneD }; - let TwoD_1: string; - export { TwoD_1 as TwoD }; - export let TwoDArray: string; - export let Cube: string; - export let CubeArray: string; - let ThreeD_1: string; - export { ThreeD_1 as ThreeD }; -} -export namespace GPUTextureAspect { - let All_1: string; - export { All_1 as All }; - export let StencilOnly: string; - export let DepthOnly: string; -} -export namespace GPUInputStepMode { - let Vertex: string; - let Instance: string; -} -export namespace GPUFeatureName { - export let CoreFeaturesAndLimits: string; - export let DepthClipControl: string; - let Depth32FloatStencil8_1: string; - export { Depth32FloatStencil8_1 as Depth32FloatStencil8 }; - export let TextureCompressionBC: string; - export let TextureCompressionBCSliced3D: string; - export let TextureCompressionETC2: string; - export let TextureCompressionASTC: string; - export let TextureCompressionASTCSliced3D: string; - export let TimestampQuery: string; - export let IndirectFirstInstance: string; - export let ShaderF16: string; - let RG11B10UFloat_1: string; - export { RG11B10UFloat_1 as RG11B10UFloat }; - export let BGRA8UNormStorage: string; - export let Float32Filterable: string; - export let Float32Blendable: string; - export let ClipDistances: string; - export let DualSourceBlending: string; - export let Subgroups: string; - export let TextureFormatsTier1: string; - export let TextureFormatsTier2: string; -} -export const GPUFeatureMap: { - 'texture-compression-s3tc': string; - 'texture-compression-etc1': string; -}; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts deleted file mode 100644 index 6e12e01ba..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUPipelineUtils.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -export default WebGPUPipelineUtils; -/** - * A WebGPU backend utility module for managing pipelines. - * - * @private - */ -declare class WebGPUPipelineUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Returns the sample count derived from the given render context. - * - * @private - * @param {RenderContext} renderContext - The render context. - * @return {number} The sample count. - */ - private _getSampleCount; - /** - * Creates a render pipeline for the given render object. - * - * @param {RenderObject} renderObject - The render object. - * @param {Array} promises - An array of compilation promises which are used in `compileAsync()`. - */ - createRenderPipeline(renderObject: RenderObject, promises: Array>): void; - /** - * Creates GPU render bundle encoder for the given render context. - * - * @param {RenderContext} renderContext - The render context. - * @param {?string} [label='renderBundleEncoder'] - The label. - * @return {GPURenderBundleEncoder} The GPU render bundle encoder. - */ - createBundleEncoder(renderContext: RenderContext, label?: string | null): GPURenderBundleEncoder; - /** - * Creates a compute pipeline for the given compute node. - * - * @param {ComputePipeline} pipeline - The compute pipeline. - * @param {Array} bindings - The bindings. - * @param {?Array} [promises=null] - Optional compilation promises. - */ - createComputePipeline(pipeline: ComputePipeline, bindings: Array, promises?: Array> | null): void; - /** - * Reads line-accurate diagnostics from shader modules and logs them. - * Called from pipeline creation error paths to turn opaque validation - * failures into actionable WGSL feedback. - * - * @private - * @param {Array<{program: ProgrammableStage, module: GPUShaderModule}>} stages - Pairs of program + compiled shader module. - * @param {string} pipelineLabel - Label of the owning pipeline, used as log prefix. - * @return {Promise} - */ - private _reportShaderDiagnostics; - /** - * Returns the blending state as a descriptor object required - * for the pipeline creation. - * - * @private - * @param {Material|BlendMode} object - The object containing blending information. - * @return {Object} The blending state. - */ - private _getBlending; - /** - * Returns the GPU blend factor which is required for the pipeline creation. - * - * @private - * @param {number} blend - The blend factor as a three.js constant. - * @return {string} The GPU blend factor. - */ - private _getBlendFactor; - /** - * Returns the GPU stencil compare function which is required for the pipeline creation. - * - * @private - * @param {Material} material - The material. - * @return {string} The GPU stencil compare function. - */ - private _getStencilCompare; - /** - * Returns the GPU stencil operation which is required for the pipeline creation. - * - * @private - * @param {number} op - A three.js constant defining the stencil operation. - * @return {string} The GPU stencil operation. - */ - private _getStencilOperation; - /** - * Returns the GPU blend operation which is required for the pipeline creation. - * - * @private - * @param {number} blendEquation - A three.js constant defining the blend equation. - * @return {string} The GPU blend operation. - */ - private _getBlendOperation; - /** - * Returns the primitive state as a descriptor object required - * for the pipeline creation. - * - * @private - * @param {Object3D} object - The 3D object. - * @param {BufferGeometry} geometry - The geometry. - * @param {Material} material - The material. - * @return {Object} The primitive state. - */ - private _getPrimitiveState; - /** - * Returns the GPU color write mask which is required for the pipeline creation. - * - * @private - * @param {Material} material - The material. - * @return {number} The GPU color write mask. - */ - private _getColorWriteMask; - /** - * Returns the GPU depth compare function which is required for the pipeline creation. - * - * @private - * @param {Material} material - The material. - * @return {string} The GPU depth compare function. - */ - private _getDepthCompare; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts deleted file mode 100644 index e2d05d692..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTexturePassUtils.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -export default WebGPUTexturePassUtils; -/** - * A WebGPU backend utility module used by {@link WebGPUTextureUtils}. - * - * @private - */ -declare class WebGPUTexturePassUtils extends DataMap { - /** - * Constructs a new utility object. - * - * @param {GPUDevice} device - The WebGPU device. - */ - constructor(device: GPUDevice); - /** - * The WebGPU device. - * - * @type {GPUDevice} - */ - device: GPUDevice; - /** - * The mipmap GPU sampler. - * - * @type {GPUSampler} - */ - mipmapSampler: GPUSampler; - /** - * The flipY GPU sampler. - * - * @type {GPUSampler} - */ - flipYSampler: GPUSampler; - flipUniformBuffer: GPUBuffer; - noFlipUniformBuffer: GPUBuffer; - /** - * A cache for GPU render pipelines used for copy/transfer passes. - * Every texture format and textureBindingViewDimension combo requires a unique pipeline. - * - * @type {Object} - */ - transferPipelines: { - [x: string]: GPURenderPipeline; - }; - mipmapShaderModule: GPUShaderModule; - /** - * Returns a render pipeline for the internal copy render pass. The pass - * requires a unique render pipeline for each texture format. - * - * @param {string} format - The GPU texture format - * @param {string?} textureBindingViewDimension - The GPU texture binding view dimension - * @return {GPURenderPipeline} The GPU render pipeline. - */ - getTransferPipeline(format: string, textureBindingViewDimension: string | null): GPURenderPipeline; - /** - * Flip the contents of the given GPU texture along its vertical axis. - * - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {Object} textureGPUDescriptor - The texture descriptor. - * @param {number} [baseArrayLayer=0] - The index of the first array layer accessible to the texture view. - */ - flipY(textureGPU: GPUTexture, textureGPUDescriptor: Object, baseArrayLayer?: number): void; - /** - * Generates mipmaps for the given GPU texture. - * - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. - */ - generateMipmaps(textureGPU: GPUTexture, encoder?: GPUCommandEncoder | null): void; - /** - * Since multiple copy render passes are required to generate mipmaps, the passes - * are managed as render bundles to improve performance. - * - * @param {GPUTexture} textureGPU - The GPU texture object. - * @return {Array} An array of render bundles. - */ - _mipmapCreateBundles(textureGPU: GPUTexture): Array; - /** - * Executes the render bundles. - * - * @param {GPUCommandEncoder} commandEncoder - The GPU command encoder. - * @param {Array} passes - An array of render bundles. - */ - _mipmapRunBundles(commandEncoder: GPUCommandEncoder, passes: Array): void; -} -import DataMap from '../../common/DataMap.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts deleted file mode 100644 index 8ffa3ade9..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTextureUtils.d.ts +++ /dev/null @@ -1,302 +0,0 @@ -/** - * Returns the GPU format for the given texture. - * - * @param {Texture} texture - The texture. - * @param {GPUDevice} [device] - The GPU device which is used for feature detection. - * @return {string} The GPU format. - */ -export function getFormat(texture: Texture, device?: GPUDevice): string; -export default WebGPUTextureUtils; -import { Texture } from '../../../textures/Texture.js'; -/** - * A WebGPU backend utility module for managing textures. - * - * @private - */ -declare class WebGPUTextureUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * A reference to the pass utils. - * - * @type {?WebGPUTexturePassUtils} - * @default null - */ - _passUtils: WebGPUTexturePassUtils | null; - /** - * A dictionary for managing default textures. The key - * is the texture format, the value the texture object. - * - * @type {Object} - */ - defaultTexture: { - [x: string]: Texture; - }; - /** - * A dictionary for managing default cube textures. The key - * is the texture format, the value the texture object. - * - * @type {Object} - */ - defaultCubeTexture: { - [x: string]: CubeTexture; - }; - /** - * A default video frame. - * - * @type {?VideoFrame} - * @default null - */ - defaultVideoFrame: VideoFrame | null; - /** - * A cache of shared texture samplers. - * - * @type {Map} - */ - _samplerCache: Map; - /** - * Creates a GPU sampler for the given texture. - * - * @param {Sampler} binding - The sampler binding to update. - * @return {string} The current sampler key. - */ - updateSampler(binding: Sampler): string; - /** - * Frees the GPU sampler referenced by the given sampler binding. - * - * @param {Sampler} binding - The sampler binding to free. - */ - destroySampler(binding: Sampler): void; - /** - * Releases the pooled sampler referenced by the given binding data and - * removes it from the cache when no binding references it anymore. - * - * @private - * @param {Object} bindingData - The binding data holding the sampler reference. - */ - private _releaseSampler; - /** - * Creates a default texture for the given texture that can be used - * as a placeholder until the actual texture is ready for usage. - * - * @param {Texture} texture - The texture to create a default texture for. - */ - createDefaultTexture(texture: Texture): void; - /** - * Defines a texture on the GPU for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - createTexture(texture: Texture, options?: Object): void; - /** - * Destroys the GPU data for the given texture object. - * - * @param {Texture} texture - The texture. - * @param {boolean} [isDefaultTexture=false] - Whether the texture uses a default GPU texture or not. - */ - destroyTexture(texture: Texture, isDefaultTexture?: boolean): void; - /** - * Generates mipmaps for the given texture. - * - * @param {Texture} texture - The texture. - * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. - */ - generateMipmaps(texture: Texture, encoder?: GPUCommandEncoder | null): void; - /** - * Returns the color buffer representing the color - * attachment of the default framebuffer. - * - * @return {GPUTexture} The color buffer. - */ - getColorBuffer(): GPUTexture; - /** - * Returns the depth buffer representing the depth - * attachment of the default framebuffer. - * - * @param {boolean} [depth=true] - Whether depth is enabled or not. - * @param {boolean} [stencil=false] - Whether stencil is enabled or not. - * @return {GPUTexture} The depth buffer. - */ - getDepthBuffer(depth?: boolean, stencil?: boolean): GPUTexture; - /** - * Uploads the updated texture data to the GPU. - * - * @param {Texture} texture - The texture. - * @param {Object} [options={}] - Optional configuration parameter. - */ - updateTexture(texture: Texture, options?: Object): void; - /** - * Returns texture data as a typed array. - * - * @async - * @param {Texture} texture - The texture to copy. - * @param {number} x - The x coordinate of the copy origin. - * @param {number} y - The y coordinate of the copy origin. - * @param {number} width - The width of the copy. - * @param {number} height - The height of the copy. - * @param {number} faceIndex - The cube face, depth slice or array layer index. - * @return {Promise} A Promise that resolves with a typed array when the copy operation has finished. - */ - copyTextureToBuffer(texture: Texture, x: number, y: number, width: number, height: number, faceIndex: number): Promise; - /** - * Frees all internal resources. - */ - dispose(): void; - /** - * Returns the default GPU texture for the given format. - * - * @private - * @param {string} format - The GPU format. - * @return {GPUTexture} The GPU texture. - */ - private _getDefaultTextureGPU; - /** - * Returns the default GPU cube texture for the given format. - * - * @private - * @param {string} format - The GPU format. - * @return {GPUTexture} The GPU texture. - */ - private _getDefaultCubeTextureGPU; - /** - * Uploads cube texture image data to the GPU memory. - * - * @private - * @param {CubeTexture} texture - The cube texture. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - */ - private _copyCubeMapToTexture; - /** - * Uploads texture image data to the GPU memory. - * - * @private - * @param {HTMLImageElement|ImageBitmap|HTMLCanvasElement} image - The image data. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - * @param {number} originDepth - The origin depth. - * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. - * @param {boolean} premultiplyAlpha - Whether the texture should have its RGB channels premultiplied by the alpha channel or not. - * @param {number} [mipLevel=0] - The mip level where the data should be copied to. - */ - private _copyImageToTexture; - /** - * Returns the pass utils singleton. - * - * @private - * @return {WebGPUTexturePassUtils} The utils instance. - */ - private _getPassUtils; - /** - * Generates mipmaps for the given GPU texture. - * - * @private - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {?GPUCommandEncoder} [encoder=null] - An optional command encoder used to generate mipmaps. - */ - private _generateMipmaps; - /** - * Flip the contents of the given GPU texture along its vertical axis. - * - * @private - * @param {GPUTexture} textureGPU - The GPU texture object. - * @param {Object} textureDescriptorGPU - The texture descriptor. - * @param {number} [originDepth=0] - The origin depth. - */ - private _flipY; - /** - * Uploads texture buffer data to the GPU memory. - * - * @private - * @param {Object} image - An object defining the image buffer data. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - * @param {number} originDepth - The origin depth. - * @param {boolean} flipY - Whether to flip texture data along their vertical axis or not. - * @param {number} [depth=0] - The depth offset when copying array or 3D texture data. - * @param {number} [mipLevel=0] - The mip level where the data should be copied to. - */ - private _copyBufferToTexture; - /** - * Uploads compressed texture data to the GPU memory. - * - * @private - * @param {Array} mipmaps - An array with mipmap data. - * @param {GPUTexture} textureGPU - The GPU texture. - * @param {Object} textureDescriptorGPU - The GPU texture descriptor. - * @param {?Set} [layerUpdates=null] - The layer indices to update. - */ - private _copyCompressedBufferToTexture; - /** - * This method is only relevant for compressed texture formats. It returns a block - * data descriptor for the given GPU compressed texture format. - * - * @private - * @param {string} format - The GPU compressed texture format. - * @return {Object} The block data descriptor. - */ - private _getBlockData; - /** - * Converts the three.js uv wrapping constants to GPU address mode constants. - * - * @private - * @param {number} value - The three.js constant defining a uv wrapping mode. - * @return {string} The GPU address mode. - */ - private _convertAddressMode; - /** - * Converts the three.js filter constants to GPU filter constants. - * - * @private - * @param {number} value - The three.js constant defining a filter mode. - * @return {string} The GPU filter mode. - */ - private _convertFilterMode; - /** - * Converts the three.js filter constants to a GPU mipmap filter constant. - * Unlike `_convertFilterMode`, this extracts the between-mip-level filtering - * axis from the combined three.js constant rather than the within-level axis. - * - * @private - * @param {number} value - The three.js constant defining a filter mode. - * @return {string} The GPU mipmap filter mode. - */ - private _convertMipmapFilterMode; - /** - * Returns the bytes-per-texel value for the given GPU texture format. - * - * @private - * @param {string} format - The GPU texture format. - * @return {number} The bytes-per-texel. - */ - private _getBytesPerTexel; - /** - * Returns the corresponding typed array type for the given GPU texture format. - * - * @private - * @param {string} format - The GPU texture format. - * @return {TypedArray.constructor} The typed array type. - */ - private _getTypedArrayType; - /** - * Returns the GPU dimensions for the given texture. - * - * @private - * @param {Texture} texture - The texture. - * @return {string} The GPU dimension. - */ - private _getDimension; -} -import WebGPUTexturePassUtils from './WebGPUTexturePassUtils.js'; -import { CubeTexture } from '../../../textures/CubeTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts deleted file mode 100644 index dcc48eded..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -export default WebGPUTimestampQueryPool; -/** - * Manages a pool of WebGPU timestamp queries for performance measurement. - * Extends the base TimestampQueryPool to provide WebGPU-specific implementation. - * - * @augments TimestampQueryPool - */ -declare class WebGPUTimestampQueryPool extends TimestampQueryPool { - /** - * Creates a new WebGPU timestamp query pool. - * - * @param {GPUDevice} device - The WebGPU device to create queries on. - * @param {string} type - The type identifier for this query pool. - * @param {number} [maxQueries=2048] - Maximum number of queries this pool can hold. - */ - constructor(device: GPUDevice, type: string, maxQueries?: number); - device: GPUDevice; - type: string; - querySet: GPUQuerySet; - resolveBuffer: GPUBuffer; - resultBuffer: GPUBuffer; - /** - * Allocates a pair of queries for a given render context. - * - * @param {string} uid - A unique identifier for the render context. - * @returns {?number} The base offset for the allocated queries, or null if allocation failed. - */ - allocateQueriesForContext(uid: string): number | null; - /** - * Asynchronously resolves all pending queries and returns the total duration. - * If there's already a pending resolve operation, returns that promise instead. - * - * @async - * @returns {Promise} The total duration in milliseconds, or the last valid value if resolution fails. - */ - resolveQueriesAsync(): Promise; - /** - * Internal method to resolve queries and calculate total duration. - * - * @async - * @private - * @returns {Promise} The total duration in milliseconds. - */ - private _resolveQueries; - /** - * Dispose of the query pool. - * - * @async - * @returns {Promise} A Promise that resolves when the dispose has been executed. - */ - dispose(): Promise; -} -import TimestampQueryPool from '../../common/TimestampQueryPool.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts b/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts deleted file mode 100644 index 1e208f66c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webgpu/utils/WebGPUUtils.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Submits a single GPU command to the device queue using a shared, module-scoped - * array to avoid per-call array allocations. - * - * @private - * @param {GPUDevice} device - The GPU device. - * @param {GPUCommandBuffer} command - The command buffer to submit. - */ -export function submit(device: GPUDevice, command: GPUCommandBuffer): void; -export default WebGPUUtils; -/** - * A WebGPU backend utility module with common helpers. - * - * @private - */ -declare class WebGPUUtils { - /** - * Constructs a new utility object. - * - * @param {WebGPUBackend} backend - The WebGPU backend. - */ - constructor(backend: WebGPUBackend); - /** - * A reference to the WebGPU backend. - * - * @type {WebGPUBackend} - */ - backend: WebGPUBackend; - /** - * Caches the preferred canvas format. - * - * @private - * @type {?string} - * @default null - */ - private _preferredCanvasFormat; - /** - * Returns the depth/stencil GPU format for the given render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {string} The depth/stencil GPU texture format. - */ - getCurrentDepthStencilFormat(renderContext: RenderContext): string; - /** - * Returns the GPU format for the given texture. - * - * @param {Texture} texture - The texture. - * @return {string} The GPU texture format. - */ - getTextureFormatGPU(texture: Texture): string; - /** - * Returns an object that defines the multi-sampling state of the given texture. - * - * @param {Texture} texture - The texture. - * @return {Object} The multi-sampling state. - */ - getTextureSampleData(texture: Texture): Object; - /** - * Returns the default color attachment's GPU format of the current render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {string} The GPU texture format of the default color attachment. - */ - getCurrentColorFormat(renderContext: RenderContext): string; - /** - * Returns the GPU formats of all color attachments of the current render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {Array} The GPU texture formats of all color attachments. - */ - getCurrentColorFormats(renderContext: RenderContext): Array; - /** - * Returns the output color space of the current render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {string} The output color space. - */ - getCurrentColorSpace(renderContext: RenderContext): string; - /** - * Returns GPU primitive topology for the given object and material. - * - * @param {Object3D} object - The 3D object. - * @param {Material} material - The material. - * @return {string} The GPU primitive topology. - */ - getPrimitiveTopology(object: Object3D, material: Material): string; - /** - * Returns a modified sample count from the given sample count value. - * - * That is required since WebGPU only supports either 1 or 4. - * - * @param {number} sampleCount - The input sample count. - * @return {number} The (potentially updated) output sample count. - */ - getSampleCount(sampleCount: number): number; - /** - * Returns the sample count of the given render context. - * - * @param {RenderContext} renderContext - The render context. - * @return {number} The sample count. - */ - getSampleCountRenderContext(renderContext: RenderContext): number; - /** - * Returns the preferred canvas format. - * - * There is a separate method for this so it's possible to - * honor edge cases for specific devices. - * - * @return {string} The GPU texture format of the canvas. - */ - getPreferredCanvasFormat(): string; -} diff --git a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts deleted file mode 100644 index 91dbb3340..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRController.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Class for representing a XR controller with its - * different coordinate systems. - * - * @private - */ -export class WebXRController { - /** - * A group representing the target ray space - * of the XR controller. - * - * @private - * @type {?Group} - * @default null - */ - private _targetRay; - /** - * A group representing the grip space - * of the XR controller. - * - * @private - * @type {?Group} - * @default null - */ - private _grip; - /** - * A group representing the hand space - * of the XR controller. - * - * @private - * @type {?Group} - * @default null - */ - private _hand; - /** - * Returns a group representing the hand space of the XR controller. - * - * @return {Group} A group representing the hand space of the XR controller. - */ - getHandSpace(): Group; - /** - * Returns a group representing the target ray space of the XR controller. - * - * @return {Group} A group representing the target ray space of the XR controller. - */ - getTargetRaySpace(): Group; - /** - * Returns a group representing the grip space of the XR controller. - * - * @return {Group} A group representing the grip space of the XR controller. - */ - getGripSpace(): Group; - /** - * Dispatches the given event to the groups representing - * the different coordinate spaces of the XR controller. - * - * @param {Object} event - The event to dispatch. - * @return {WebXRController} A reference to this instance. - */ - dispatchEvent(event: Object): WebXRController; - /** - * Connects the controller with the given XR input source. - * - * @param {XRInputSource} inputSource - The input source. - * @return {WebXRController} A reference to this instance. - */ - connect(inputSource: XRInputSource): WebXRController; - /** - * Disconnects the controller from the given XR input source. - * - * @param {XRInputSource} inputSource - The input source. - * @return {WebXRController} A reference to this instance. - */ - disconnect(inputSource: XRInputSource): WebXRController; - /** - * Updates the controller with the given input source, XR frame and reference space. - * This updates the transformations of the groups that represent the different - * coordinate systems of the controller. - * - * @param {XRInputSource} inputSource - The input source. - * @param {XRFrame} frame - The XR frame. - * @param {XRReferenceSpace} referenceSpace - The reference space. - * @return {WebXRController} A reference to this instance. - */ - update(inputSource: XRInputSource, frame: XRFrame, referenceSpace: XRReferenceSpace): WebXRController; - /** - * Returns a group representing the hand joint for the given input joint. - * - * @private - * @param {Group} hand - The group representing the hand space. - * @param {XRJointSpace} inputjoint - The hand joint data. - * @return {Group} A group representing the hand joint for the given input joint. - */ - private _getHandJoint; -} -import { Group } from '../../objects/Group.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts deleted file mode 100644 index aaa8ad7cf..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRDepthSensing.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/** - * A XR module that manages the access to the Depth Sensing API. - */ -export class WebXRDepthSensing { - /** - * An opaque texture representing the depth of the user's environment. - * - * @type {?ExternalTexture} - */ - texture: ExternalTexture | null; - /** - * A plane mesh for visualizing the depth texture. - * - * @type {?Mesh} - */ - mesh: Mesh | null; - /** - * The depth near value. - * - * @type {number} - */ - depthNear: number; - /** - * The depth near far. - * - * @type {number} - */ - depthFar: number; - /** - * Inits the depth sensing module - * - * @param {XRWebGLDepthInformation} depthData - The XR depth data. - * @param {XRRenderState} renderState - The XR render state. - */ - init(depthData: XRWebGLDepthInformation, renderState: XRRenderState): void; - /** - * Returns a plane mesh that visualizes the depth texture. - * - * @param {ArrayCamera} cameraXR - The XR camera. - * @return {?Mesh} The plane mesh. - */ - getMesh(cameraXR: ArrayCamera): Mesh | null; - /** - * Resets the module - */ - reset(): void; - /** - * Returns a texture representing the depth of the user's environment. - * - * @return {?ExternalTexture} The depth texture. - */ - getDepthTexture(): ExternalTexture | null; -} -import { ExternalTexture } from '../../textures/ExternalTexture.js'; -import { Mesh } from '../../objects/Mesh.js'; diff --git a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts b/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts deleted file mode 100644 index edab6f90c..000000000 --- a/jsdoc-testing/jsdoc/src/renderers/webxr/WebXRManager.d.ts +++ /dev/null @@ -1,220 +0,0 @@ -/** - * This class represents an abstraction of the WebXR Device API and is - * internally used by {@link WebGLRenderer}. `WebXRManager` also provides a public - * interface that allows users to enable/disable XR and perform XR related - * tasks like for instance retrieving controllers. - * - * @augments EventDispatcher - * @hideconstructor - */ -export class WebXRManager extends EventDispatcher { - /** - * Constructs a new WebGL renderer. - * - * @param {WebGLRenderer} renderer - The renderer. - * @param {WebGL2RenderingContext} gl - The rendering context. - */ - constructor(renderer: WebGLRenderer, gl: WebGL2RenderingContext); - /** - * Whether the manager's XR camera should be automatically updated or not. - * - * @type {boolean} - * @default true - */ - cameraAutoUpdate: boolean; - /** - * This flag notifies the renderer to be ready for XR rendering. Set it to `true` - * if you are going to use XR in your app. - * - * @type {boolean} - * @default false - */ - enabled: boolean; - /** - * Whether XR presentation is active or not. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly isPresenting: boolean; - /** - * Returns a group representing the `target ray` space of the XR controller. - * Use this space for visualizing 3D objects that support the user in pointing - * tasks like UI interaction. - * - * @param {number} index - The index of the controller. - * @return {Group} A group representing the `target ray` space. - */ - getController: (index: number) => Group; - /** - * Returns a group representing the `grip` space of the XR controller. - * Use this space for visualizing 3D objects that support the user in pointing - * tasks like UI interaction. - * - * Note: If you want to show something in the user's hand AND offer a - * pointing ray at the same time, you'll want to attached the handheld object - * to the group returned by `getControllerGrip()` and the ray to the - * group returned by `getController()`. The idea is to have two - * different groups in two different coordinate spaces for the same WebXR - * controller. - * - * @param {number} index - The index of the controller. - * @return {Group} A group representing the `grip` space. - */ - getControllerGrip: (index: number) => Group; - /** - * Returns a group representing the `hand` space of the XR controller. - * Use this space for visualizing 3D objects that support the user in pointing - * tasks like UI interaction. - * - * @param {number} index - The index of the controller. - * @return {Group} A group representing the `hand` space. - */ - getHand: (index: number) => Group; - /** - * Sets the framebuffer scale factor. - * - * This method can not be used during a XR session. - * - * @param {number} value - The framebuffer scale factor. - */ - setFramebufferScaleFactor: (value: number) => void; - /** - * Sets the reference space type. Can be used to configure a spatial relationship with the user's physical - * environment. Depending on how the user moves in 3D space, setting an appropriate reference space can - * improve tracking. Default is `local-floor`. Valid values can be found here - * https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types. - * - * This method can not be used during a XR session. - * - * @param {string} value - The reference space type. - */ - setReferenceSpaceType: (value: string) => void; - /** - * Returns the XR reference space. - * - * @return {XRReferenceSpace} The XR reference space. - */ - getReferenceSpace: () => XRReferenceSpace; - /** - * Sets a custom XR reference space. - * - * @param {XRReferenceSpace} space - The XR reference space. - */ - setReferenceSpace: (space: XRReferenceSpace) => void; - /** - * Returns the current base layer. - * - * This is an `XRProjectionLayer` when the targeted XR device supports the - * WebXR Layers API, or an `XRWebGLLayer` otherwise. - * - * @return {?(XRWebGLLayer|XRProjectionLayer)} The XR base layer. - */ - getBaseLayer: () => (XRWebGLLayer | XRProjectionLayer) | null; - /** - * Returns the current XR binding. - * - * Creates a new binding if needed and the browser is - * capable of doing so. - * - * @return {?XRWebGLBinding} The XR binding. Returns `null` if one cannot be created. - */ - getBinding: () => XRWebGLBinding | null; - /** - * Returns the current XR frame. - * - * @return {?XRFrame} The XR frame. Returns `null` when used outside a XR session. - */ - getFrame: () => XRFrame | null; - /** - * Returns the current XR session. - * - * @return {?XRSession} The XR session. Returns `null` when used outside a XR session. - */ - getSession: () => XRSession | null; - /** - * After a XR session has been requested usually with one of the `*Button` modules, it - * is injected into the renderer with this method. This method triggers the start of - * the actual XR rendering. - * - * @async - * @param {XRSession} value - The XR session to set. - * @return {Promise} A Promise that resolves when the session has been set. - */ - setSession: (value: XRSession) => Promise; - /** - * Returns the environment blend mode from the current XR session. - * - * @return {'opaque'|'additive'|'alpha-blend'|undefined} The environment blend mode. Returns `undefined` when used outside of a XR session. - */ - getEnvironmentBlendMode: () => "opaque" | "additive" | "alpha-blend" | undefined; - /** - * Returns the current depth texture computed via depth sensing. - * - * See {@link WebXRDepthSensing#getDepthTexture}. - * - * @return {?Texture} The depth texture. - */ - getDepthTexture: () => Texture | null; - /** - * Updates the state of the XR camera. Use this method on app level if you - * set `cameraAutoUpdate` to `false`. The method requires the non-XR - * camera of the scene as a parameter. The passed in camera's transformation - * is automatically adjusted to the position of the XR camera when calling - * this method. - * - * @param {Camera} camera - The camera. - */ - updateCamera: (camera: Camera) => void; - /** - * Returns an instance of {@link ArrayCamera} which represents the XR camera - * of the active XR session. For each view it holds a separate camera object. - * - * The camera's `fov` is currently not used and does not reflect the fov of - * the XR camera. If you need the fov on app level, you have to compute in - * manually from the XR camera's projection matrices. - * - * @return {ArrayCamera} The XR camera. - */ - getCamera: () => ArrayCamera; - /** - * Returns the amount of foveation used by the XR compositor for the projection layer. - * - * @return {number|undefined} The amount of foveation. - */ - getFoveation: () => number | undefined; - /** - * Sets the foveation value. - * - * @param {number} value - A number in the range `[0,1]` where `0` means no foveation (full resolution) - * and `1` means maximum foveation (the edges render at lower resolution). - */ - setFoveation: (value: number) => void; - /** - * Returns `true` if depth sensing is supported. - * - * @return {boolean} Whether depth sensing is supported or not. - */ - hasDepthSensing: () => boolean; - /** - * Returns the depth sensing mesh. - * - * See {@link WebXRDepthSensing#getMesh}. - * - * @return {Mesh} The depth sensing mesh. - */ - getDepthSensingMesh: () => Mesh; - /** - * Retrieves an opaque texture from the view-aligned {@link XRCamera}. - * Only available during the current animation loop. - * - * @param {XRCamera} xrCamera - The camera to query. - * @return {?Texture} An opaque texture representing the current raw camera frame. - */ - getCameraTexture: (xrCamera: XRCamera) => Texture | null; - setAnimationLoop: (callback: any) => void; - dispose: () => void; -} -import { EventDispatcher } from '../../core/EventDispatcher.js'; -import { ArrayCamera } from '../../cameras/ArrayCamera.js'; diff --git a/jsdoc-testing/jsdoc/src/scenes/Fog.d.ts b/jsdoc-testing/jsdoc/src/scenes/Fog.d.ts deleted file mode 100644 index 3c17089bd..000000000 --- a/jsdoc-testing/jsdoc/src/scenes/Fog.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -/** - * This class can be used to define a linear fog that grows linearly denser - * with the distance. - * - * ```js - * const scene = new THREE.Scene(); - * scene.fog = new THREE.Fog( 0xcccccc, 10, 15 ); - * ``` - */ -export class Fog { - /** - * Constructs a new fog. - * - * @param {number|Color} color - The fog's color. - * @param {number} [near=1] - The minimum distance to start applying fog. - * @param {number} [far=1000] - The maximum distance at which fog stops being calculated and applied. - */ - constructor(color: number | Color, near?: number, far?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isFog: boolean; - /** - * The name of the fog. - * - * @type {string} - */ - name: string; - /** - * The fog's color. - * - * @type {Color} - */ - color: Color; - /** - * The minimum distance to start applying fog. Objects that are less than - * `near` units from the active camera won't be affected by fog. - * - * @type {number} - * @default 1 - */ - near: number; - /** - * The maximum distance at which fog stops being calculated and applied. - * Objects that are more than `far` units away from the active camera won't - * be affected by fog. - * - * @type {number} - * @default 1000 - */ - far: number; - /** - * Returns a new fog with copied values from this instance. - * - * @return {Fog} A clone of this instance. - */ - clone(): Fog; - /** - * Serializes the fog into JSON. - * - * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized fog - */ - toJSON(): Object; -} -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts b/jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts deleted file mode 100644 index e11462391..000000000 --- a/jsdoc-testing/jsdoc/src/scenes/FogExp2.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * This class can be used to define an exponential squared fog, - * which gives a clear view near the camera and a faster than exponentially - * densening fog farther from the camera. - * - * ```js - * const scene = new THREE.Scene(); - * scene.fog = new THREE.FogExp2( 0xcccccc, 0.002 ); - * ``` - */ -export class FogExp2 { - /** - * Constructs a new fog. - * - * @param {number|Color} color - The fog's color. - * @param {number} [density=0.00025] - Defines how fast the fog will grow dense. - */ - constructor(color: number | Color, density?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isFogExp2: boolean; - /** - * The name of the fog. - * - * @type {string} - */ - name: string; - /** - * The fog's color. - * - * @type {Color} - */ - color: Color; - /** - * Defines how fast the fog will grow dense. - * - * @type {number} - * @default 0.00025 - */ - density: number; - /** - * Returns a new fog with copied values from this instance. - * - * @return {FogExp2} A clone of this instance. - */ - clone(): FogExp2; - /** - * Serializes the fog into JSON. - * - * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized fog - */ - toJSON(): Object; -} -import { Color } from '../math/Color.js'; diff --git a/jsdoc-testing/jsdoc/src/scenes/Scene.d.ts b/jsdoc-testing/jsdoc/src/scenes/Scene.d.ts deleted file mode 100644 index 91ed09ab6..000000000 --- a/jsdoc-testing/jsdoc/src/scenes/Scene.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Scenes allow you to set up what is to be rendered and where by three.js. - * This is where you place 3D objects like meshes, lines or lights. - * - * @augments Object3D - */ -export class Scene extends Object3D { - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isScene: boolean; - type: string; - /** - * Defines the background of the scene. Valid inputs are: - * - * - A color for defining a uniform colored background. - * - A texture for defining a (flat) textured background. - * - Cube textures or equirectangular textures for defining a skybox. - * - * @type {?(Color|Texture)} - * @default null - */ - background: (Color | Texture) | null; - /** - * Sets the environment map for all physical materials in the scene. However, - * it's not possible to overwrite an existing texture assigned to the `envMap` - * material property. - * - * @type {?Texture} - * @default null - */ - environment: Texture | null; - /** - * A fog instance defining the type of fog that affects everything - * rendered in the scene. - * - * @type {?(Fog|FogExp2)} - * @default null - */ - fog: (Fog | FogExp2) | null; - /** - * Sets the blurriness of the background. Only influences environment maps - * assigned to {@link Scene#background}. Valid input is a float between `0` - * and `1`. - * - * @type {number} - * @default 0 - */ - backgroundBlurriness: number; - /** - * Attenuates the color of the background. Only applies to background textures. - * - * @type {number} - * @default 1 - */ - backgroundIntensity: number; - /** - * The rotation of the background in radians. Only influences environment maps - * assigned to {@link Scene#background}. - * - * @type {Euler} - * @default (0,0,0) - */ - backgroundRotation: Euler; - /** - * Attenuates the color of the environment. Only influences environment maps - * assigned to {@link Scene#environment}. - * - * @type {number} - * @default 1 - */ - environmentIntensity: number; - /** - * The rotation of the environment map in radians. Only influences physical materials - * in the scene when {@link Scene#environment} is used. - * - * @type {Euler} - * @default (0,0,0) - */ - environmentRotation: Euler; - /** - * Forces everything in the scene to be rendered with the defined material. It is possible - * to exclude materials from override by setting {@link Material#allowOverride} to `false`. - * - * @type {?Material} - * @default null - */ - overrideMaterial: Material | null; - copy(source: any, recursive: any): this; - toJSON(meta: any): Object; -} -import { Object3D } from '../core/Object3D.js'; -import { Euler } from '../math/Euler.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts deleted file mode 100644 index ee88d4d2b..000000000 --- a/jsdoc-testing/jsdoc/src/textures/CanvasTexture.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Creates a texture from a canvas element. - * - * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate} - * to `true` immediately since a canvas can directly be used for rendering. - * - * @augments Texture - */ -export class CanvasTexture extends Texture { - /** - * Constructs a new texture. - * - * @param {HTMLCanvasElement} [canvas] - The HTML canvas element. - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - */ - constructor(canvas?: HTMLCanvasElement, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCanvasTexture: boolean; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts deleted file mode 100644 index 96dee3662..000000000 --- a/jsdoc-testing/jsdoc/src/textures/CompressedArrayTexture.d.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Creates a texture 2D array based on data in compressed form. - * - * These texture are usually loaded with {@link CompressedTextureLoader}. - * - * @augments CompressedTexture - */ -export class CompressedArrayTexture extends CompressedTexture { - /** - * Constructs a new compressed array texture. - * - * @param {Array} mipmaps - This array holds for all mipmaps (including the bases mip) - * the data and dimensions. - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {number} depth - The depth of the texture. - * @param {number} [format=RGBAFormat] - The min filter value. - * @param {number} [type=UnsignedByteType] - The min filter value. - */ - constructor(mipmaps: Array, width: number, height: number, depth: number, format?: number, type?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCompressedArrayTexture: boolean; - /** - * This defines how the texture is wrapped in the depth and corresponds to - * *W* in UVW mapping. - * - * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} - * @default ClampToEdgeWrapping - */ - wrapR: (RepeatWrapping | number | MirroredRepeatWrapping); - /** - * A set of all layers which need to be updated in the texture. - * - * @type {Set} - */ - layerUpdates: Set; - /** - * Copies the values of the given texture to this instance. - * - * @param {CompressedArrayTexture} source - The texture to copy. - * @return {CompressedArrayTexture} A reference to this instance. - */ - copy(source: CompressedArrayTexture): CompressedArrayTexture; - /** - * Describes that a specific layer of the texture needs to be updated. - * Normally when {@link Texture#needsUpdate} is set to `true`, the - * entire compressed texture array is sent to the GPU. Marking specific - * layers will only transmit subsets of all mipmaps associated with a - * specific depth in the array which is often much more performant. - * - * @param {number} layerIndex - The layer index that should be updated. - */ - addLayerUpdate(layerIndex: number): void; - /** - * Resets the layer updates registry. - */ - clearLayerUpdates(): void; -} -import { CompressedTexture } from './CompressedTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts deleted file mode 100644 index 05f09fbfb..000000000 --- a/jsdoc-testing/jsdoc/src/textures/CompressedCubeTexture.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Creates a cube texture based on data in compressed form. - * - * These texture are usually loaded with {@link CompressedTextureLoader}. - * - * @augments CompressedTexture - */ -export class CompressedCubeTexture extends CompressedTexture { - /** - * Constructs a new compressed texture. - * - * @param {Array} images - An array of compressed textures. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - */ - constructor(images: Array, format?: number, type?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCompressedCubeTexture: boolean; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeTexture: boolean; - image: CompressedTexture[]; -} -import { CompressedTexture } from './CompressedTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts deleted file mode 100644 index 3d1d77673..000000000 --- a/jsdoc-testing/jsdoc/src/textures/CompressedTexture.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Creates a texture based on data in compressed form. - * - * These texture are usually loaded with {@link CompressedTextureLoader}. - * - * @augments Texture - */ -export class CompressedTexture extends Texture { - /** - * Constructs a new compressed texture. - * - * @param {Array} mipmaps - This array holds for all mipmaps (including the bases mip) - * the data and dimensions. - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - * @param {string} [colorSpace=NoColorSpace] - The color space. - */ - constructor(mipmaps: Array, width: number, height: number, format?: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, colorSpace?: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCompressedTexture: boolean; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts deleted file mode 100644 index c436fb9e7..000000000 --- a/jsdoc-testing/jsdoc/src/textures/CubeDepthTexture.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * This class can be used to automatically save the depth information of a - * cube rendering into a cube texture with depth format. Used for PointLight shadows. - * - * @augments DepthTexture - */ -export class CubeDepthTexture extends DepthTexture { - /** - * Constructs a new cube depth texture. - * - * @param {number} size - The size (width and height) of each cube face. - * @param {number} [type=UnsignedIntType] - The texture type. - * @param {number} [mapping=CubeReflectionMapping] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=NearestFilter] - The mag filter value. - * @param {number} [minFilter=NearestFilter] - The min filter value. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - * @param {number} [format=DepthFormat] - The texture format. - */ - constructor(size: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, format?: number); - image: { - width: number; - height: number; - depth: number; - }[]; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeDepthTexture: boolean; - /** - * Set to true for cube texture handling in WebGLTextures. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeTexture: boolean; - set images(value: Array HTMLImageElement>); - /** - * Alias for {@link CubeDepthTexture#image}. - * - * @type {Array} - */ - get images(): Array HTMLImageElement>; -} -import { DepthTexture } from './DepthTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts deleted file mode 100644 index 76c1ce43d..000000000 --- a/jsdoc-testing/jsdoc/src/textures/CubeTexture.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Creates a cube texture made up of six images. - * - * ```js - * const loader = new THREE.CubeTextureLoader(); - * loader.setPath( 'textures/cube/pisa/' ); - * - * const textureCube = loader.load( [ - * 'px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png' - * ] ); - * - * const material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube } ); - * ``` - * - * @augments Texture - */ -export class CubeTexture extends Texture { - /** - * Constructs a new cube texture. - * - * @param {Array} [images=[]] - An array holding a image for each side of a cube. - * @param {number} [mapping=CubeReflectionMapping] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - * @param {string} [colorSpace=NoColorSpace] - The color space value. - */ - constructor(images?: Array HTMLImageElement>, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number, colorSpace?: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isCubeTexture: boolean; - set images(value: Array HTMLImageElement>); - /** - * Alias for {@link CubeTexture#image}. - * - * @type {Array} - */ - get images(): Array HTMLImageElement>; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts deleted file mode 100644 index abdcba564..000000000 --- a/jsdoc-testing/jsdoc/src/textures/Data3DTexture.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Creates a three-dimensional texture from raw data, with parameters to - * divide it into width, height, and depth. - * - * @augments Texture - */ -export class Data3DTexture extends Texture { - /** - * Constructs a new data array texture. - * - * @param {?TypedArray} [data=null] - The buffer data. - * @param {number} [width=1] - The width of the texture. - * @param {number} [height=1] - The height of the texture. - * @param {number} [depth=1] - The depth of the texture. - */ - constructor(data?: TypedArray | null, width?: number, height?: number, depth?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isData3DTexture: boolean; - /** - * This defines how the texture is wrapped in the depth and corresponds to - * *W* in UVW mapping. - * - * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} - * @default ClampToEdgeWrapping - */ - wrapR: (RepeatWrapping | number | MirroredRepeatWrapping); - /** - * Copies the values of the given texture to this instance. - * - * @param {Data3DTexture} source - The texture to copy. - * @return {Data3DTexture} A reference to this instance. - */ - copy(source: Data3DTexture): Data3DTexture; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts deleted file mode 100644 index c93a79f69..000000000 --- a/jsdoc-testing/jsdoc/src/textures/DataArrayTexture.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Creates an array of textures directly from raw buffer data. - * - * @augments Texture - */ -export class DataArrayTexture extends Texture { - /** - * Constructs a new data array texture. - * - * @param {?TypedArray} [data=null] - The buffer data. - * @param {number} [width=1] - The width of the texture. - * @param {number} [height=1] - The height of the texture. - * @param {number} [depth=1] - The depth of the texture. - */ - constructor(data?: TypedArray | null, width?: number, height?: number, depth?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isDataArrayTexture: boolean; - /** - * This defines how the texture is wrapped in the depth and corresponds to - * *W* in UVW mapping. - * - * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} - * @default ClampToEdgeWrapping - */ - wrapR: (RepeatWrapping | number | MirroredRepeatWrapping); - /** - * A set of all layers which need to be updated in the texture. - * - * @type {Set} - */ - layerUpdates: Set; - /** - * Copies the values of the given texture to this instance. - * - * @param {DataArrayTexture} source - The texture to copy. - * @return {DataArrayTexture} A reference to this instance. - */ - copy(source: DataArrayTexture): DataArrayTexture; - /** - * Describes that a specific layer of the texture needs to be updated. - * Normally when {@link Texture#needsUpdate} is set to `true`, the - * entire data texture array is sent to the GPU. Marking specific - * layers will only transmit subsets of all mipmaps associated with a - * specific depth in the array which is often much more performant. - * - * @param {number} layerIndex - The layer index that should be updated. - */ - addLayerUpdate(layerIndex: number): void; - /** - * Resets the layer updates registry. - */ - clearLayerUpdates(): void; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts deleted file mode 100644 index 8bec07e5d..000000000 --- a/jsdoc-testing/jsdoc/src/textures/DataTexture.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Creates a texture directly from raw buffer data. - * - * The interpretation of the data depends on type and format: If the type is - * `UnsignedByteType`, a `Uint8Array` will be useful for addressing the - * texel data. If the format is `RGBAFormat`, data needs four values for - * one texel; Red, Green, Blue and Alpha (typically the opacity). - * - * @augments Texture - */ -export class DataTexture extends Texture { - /** - * Constructs a new data texture. - * - * @param {?TypedArray} [data=null] - The buffer data. - * @param {number} [width=1] - The width of the texture. - * @param {number} [height=1] - The height of the texture. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=NearestFilter] - The mag filter value. - * @param {number} [minFilter=NearestFilter] - The min filter value. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - * @param {string} [colorSpace=NoColorSpace] - The color space. - */ - constructor(data?: TypedArray | null, width?: number, height?: number, format?: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, colorSpace?: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isDataTexture: boolean; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts deleted file mode 100644 index 7d3a969ed..000000000 --- a/jsdoc-testing/jsdoc/src/textures/DepthTexture.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This class can be used to automatically save the depth information of a - * rendering into a texture. - * - * @augments Texture - */ -export class DepthTexture extends Texture { - /** - * Constructs a new depth texture. - * - * @param {number} width - The width of the texture. - * @param {number} height - The height of the texture. - * @param {number} [type=UnsignedIntType] - The texture type. - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearFilter] - The min filter value. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - * @param {number} [format=DepthFormat] - The texture format. - * @param {number} [depth=1] - The depth of the texture. - */ - constructor(width: number, height: number, type?: number, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, anisotropy?: number, format?: number, depth?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isDepthTexture: boolean; - /** - * Code corresponding to the depth compare function. - * - * @type {?(NeverCompare|LessCompare|EqualCompare|LessEqualCompare|GreaterCompare|NotEqualCompare|GreaterEqualCompare|AlwaysCompare)} - * @default null - */ - compareFunction: (NeverCompare | LessCompare | EqualCompare | LessEqualCompare | GreaterCompare | NotEqualCompare | GreaterEqualCompare | AlwaysCompare) | null; - copy(source: any): this; - toJSON(meta: any): Object; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts deleted file mode 100644 index f898755c0..000000000 --- a/jsdoc-testing/jsdoc/src/textures/ExternalTexture.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Represents a texture created externally with the same renderer context. - * - * This may be a texture from a protected media stream, device camera feed, - * or other data feeds like a depth sensor. - * - * @augments Texture - */ -export class ExternalTexture extends Texture { - /** - * Creates a new raw texture. - * - * @param {?(WebGLTexture|GPUTexture)} [sourceTexture=null] - The external texture. - */ - constructor(sourceTexture?: (WebGLTexture | GPUTexture) | null); - /** - * The external source texture. - * - * @type {?(WebGLTexture|GPUTexture)} - * @default null - */ - sourceTexture: (WebGLTexture | GPUTexture) | null; - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isExternalTexture: boolean; - copy(source: any): this; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts deleted file mode 100644 index 0de9064c8..000000000 --- a/jsdoc-testing/jsdoc/src/textures/FramebufferTexture.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This class can only be used in combination with `copyFramebufferToTexture()` methods - * of renderers. It extracts the contents of the current bound framebuffer and provides it - * as a texture for further usage. - * - * ```js - * const pixelRatio = window.devicePixelRatio; - * const textureSize = 128 * pixelRatio; - * - * const frameTexture = new FramebufferTexture( textureSize, textureSize ); - * - * // calculate start position for copying part of the frame data - * const vector = new Vector2(); - * vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 ); - * vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 ); - * - * renderer.render( scene, camera ); - * - * // copy part of the rendered frame into the framebuffer texture - * renderer.copyFramebufferToTexture( frameTexture, vector ); - * ``` - * - * @augments Texture - */ -export class FramebufferTexture extends Texture { - /** - * Constructs a new framebuffer texture. - * - * @param {number} [width] - The width of the texture. - * @param {number} [height] - The height of the texture. - */ - constructor(width?: number, height?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isFramebufferTexture: boolean; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts deleted file mode 100644 index bdf594cf7..000000000 --- a/jsdoc-testing/jsdoc/src/textures/HTMLTexture.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Creates a texture from an HTML element. - * - * This is almost the same as the base texture class, except that it sets {@link Texture#needsUpdate} - * to `true` immediately and listens for the parent canvas's paint events to trigger updates. - * - * @augments Texture - */ -export class HTMLTexture extends Texture { - /** - * Constructs a new texture. - * - * @param {HTMLElement} [element] - The HTML element. - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - */ - constructor(element?: HTMLElement, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isHTMLTexture: boolean; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/Texture.d.ts b/jsdoc-testing/jsdoc/src/textures/Texture.d.ts deleted file mode 100644 index bad56374d..000000000 --- a/jsdoc-testing/jsdoc/src/textures/Texture.d.ts +++ /dev/null @@ -1,413 +0,0 @@ -/** - * Base class for all textures. - * - * Note: After the initial use of a texture, its dimensions, format, and type - * cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one. - * - * @augments EventDispatcher - */ -export class Texture extends EventDispatcher { - /** - * Constructs a new texture. - * - * @param {?Object} [image=Texture.DEFAULT_IMAGE] - The image holding the texture data. - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearMipmapLinearFilter] - The min filter value. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - * @param {string} [colorSpace=NoColorSpace] - The color space. - */ - constructor(image?: Object | null, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number, colorSpace?: string); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTexture: boolean; - /** - * The UUID of the texture. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * The name of the texture. - * - * @type {string} - */ - name: string; - /** - * The data definition of a texture. A reference to the data source can be - * shared across textures. This is often useful in context of spritesheets - * where multiple textures render the same data but with different texture - * transformations. - * - * @type {TextureSource} - */ - source: TextureSource; - /** - * An array holding user-defined mipmaps. - * - * @type {Array} - */ - mipmaps: Array; - /** - * How the texture is applied to the object. The value `UVMapping` - * is the default, where texture or uv coordinates are used to apply the map. - * - * @type {(UVMapping|CubeReflectionMapping|CubeRefractionMapping|EquirectangularReflectionMapping|EquirectangularRefractionMapping|CubeUVReflectionMapping)} - * @default UVMapping - */ - mapping: (number | CubeReflectionMapping | CubeRefractionMapping | EquirectangularReflectionMapping | EquirectangularRefractionMapping | CubeUVReflectionMapping); - /** - * Lets you select the uv attribute to map the texture to. `0` for `uv`, - * `1` for `uv1`, `2` for `uv2` and `3` for `uv3`. - * - * @type {number} - * @default 0 - */ - channel: number; - /** - * This defines how the texture is wrapped horizontally and corresponds to - * *U* in UV mapping. - * - * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} - * @default ClampToEdgeWrapping - */ - wrapS: (number | number | number); - /** - * This defines how the texture is wrapped horizontally and corresponds to - * *V* in UV mapping. - * - * @type {(RepeatWrapping|ClampToEdgeWrapping|MirroredRepeatWrapping)} - * @default ClampToEdgeWrapping - */ - wrapT: (number | number | number); - /** - * How the texture is sampled when a texel covers more than one pixel. - * - * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)} - * @default LinearFilter - */ - magFilter: (NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | number | LinearMipmapNearestFilter | number); - /** - * How the texture is sampled when a texel covers less than one pixel. - * - * @type {(NearestFilter|NearestMipmapNearestFilter|NearestMipmapLinearFilter|LinearFilter|LinearMipmapNearestFilter|LinearMipmapLinearFilter)} - * @default LinearMipmapLinearFilter - */ - minFilter: (NearestFilter | NearestMipmapNearestFilter | NearestMipmapLinearFilter | number | LinearMipmapNearestFilter | number); - /** - * The number of samples taken along the axis through the pixel that has the - * highest density of texels. By default, this value is `1`. A higher value - * gives a less blurry result than a basic mipmap, at the cost of more - * texture samples being used. - * - * @type {number} - * @default Texture.DEFAULT_ANISOTROPY - */ - anisotropy: number; - /** - * The format of the texture. - * - * @type {number} - * @default RGBAFormat - */ - format: number; - /** - * The default internal format is derived from {@link Texture#format} and {@link Texture#type} and - * defines how the texture data is going to be stored on the GPU. - * - * This property allows to overwrite the default format. - * - * @type {?string} - * @default null - */ - internalFormat: string | null; - /** - * The data type of the texture. - * - * @type {number} - * @default UnsignedByteType - */ - type: number; - /** - * How much a single repetition of the texture is offset from the beginning, - * in each direction U and V. Typical range is `0.0` to `1.0`. - * - * @type {Vector2} - * @default (0,0) - */ - offset: Vector2; - /** - * How many times the texture is repeated across the surface, in each - * direction U and V. If repeat is set greater than `1` in either direction, - * the corresponding wrap parameter should also be set to `RepeatWrapping` - * or `MirroredRepeatWrapping` to achieve the desired tiling effect. - * - * @type {Vector2} - * @default (1,1) - */ - repeat: Vector2; - /** - * The point around which rotation occurs. A value of `(0.5, 0.5)` corresponds - * to the center of the texture. Default is `(0, 0)`, the lower left. - * - * @type {Vector2} - * @default (0,0) - */ - center: Vector2; - /** - * How much the texture is rotated around the center point, in radians. - * Positive values are counter-clockwise. - * - * @type {number} - * @default 0 - */ - rotation: number; - /** - * Whether to update the texture's uv-transformation {@link Texture#matrix} - * from the properties {@link Texture#offset}, {@link Texture#repeat}, - * {@link Texture#rotation}, and {@link Texture#center}. - * - * Set this to `false` if you are specifying the uv-transform matrix directly. - * - * @type {boolean} - * @default true - */ - matrixAutoUpdate: boolean; - /** - * The uv-transformation matrix of the texture. - * - * @type {Matrix3} - */ - matrix: Matrix3; - /** - * Whether to generate mipmaps (if possible) for a texture. - * - * Set this to `false` if you are creating mipmaps manually. - * - * @type {boolean} - * @default true - */ - generateMipmaps: boolean; - /** - * If set to `true`, the alpha channel, if present, is multiplied into the - * color channels when the texture is uploaded to the GPU. - * - * Note that this property has no effect when using `ImageBitmap`. You need to - * configure premultiply alpha on bitmap creation instead. - * - * @type {boolean} - * @default false - */ - premultiplyAlpha: boolean; - /** - * If set to `true`, the texture is flipped along the vertical axis when - * uploaded to the GPU. - * - * Note that this property has no effect when using `ImageBitmap`. You need to - * configure the flip on bitmap creation instead. - * - * @type {boolean} - * @default true - */ - flipY: boolean; - /** - * Specifies the alignment requirements for the start of each pixel row in memory. - * The allowable values are `1` (byte-alignment), `2` (rows aligned to even-numbered bytes), - * `4` (word-alignment), and `8` (rows start on double-word boundaries). - * - * @type {number} - * @default 4 - */ - unpackAlignment: number; - /** - * Textures containing color data should be annotated with `SRGBColorSpace` or `LinearSRGBColorSpace`. - * - * @type {string} - * @default NoColorSpace - */ - colorSpace: string; - /** - * An object that can be used to store custom data about the texture. It - * should not hold references to functions as these will not be cloned. - * - * @type {Object} - */ - userData: Object; - /** - * This can be used to only update a subregion or specific rows of the texture (for example, just the - * first 3 rows). Use the `addUpdateRange()` function to add ranges to this array. - * - * @type {Array} - */ - updateRanges: Array; - /** - * This starts at `0` and counts how many times {@link Texture#needsUpdate} is set to `true`. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly version: number; - /** - * A callback function, called when the texture is updated (e.g., when - * {@link Texture#needsUpdate} has been set to true and then the texture is used). - * - * @type {?Function} - * @default null - */ - onUpdate: Function | null; - /** - * An optional back reference to the textures render target. - * - * @type {?(RenderTarget|WebGLRenderTarget)} - * @default null - */ - renderTarget: (RenderTarget | WebGLRenderTarget) | null; - /** - * Indicates whether a texture belongs to a render target or not. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly isRenderTargetTexture: boolean; - /** - * Indicates if a texture should be handled like a texture array. - * - * @type {boolean} - * @readonly - * @default false - */ - readonly isArrayTexture: boolean; - /** - * Indicates whether this texture should be processed by `PMREMGenerator` or not - * (only relevant for render target textures). - * - * @type {number} - * @readonly - * @default 0 - */ - readonly pmremVersion: number; - /** - * Whether the texture should use one of the 16 bit integer formats which are normalized - * to [0, 1] or [-1, 1] (depending on signed/unsigned) when sampled. - * - * @type {boolean} - * @default false - */ - normalized: boolean; - /** - * The width of the texture in pixels. - */ - get width(): any; - /** - * The height of the texture in pixels. - */ - get height(): any; - /** - * The depth of the texture in pixels. - */ - get depth(): any; - set image(value: Object | null); - /** - * The image object holding the texture data. - * - * @type {?Object} - */ - get image(): Object | null; - /** - * Updates the texture transformation matrix from the properties {@link Texture#offset}, - * {@link Texture#repeat}, {@link Texture#rotation}, and {@link Texture#center}. - */ - updateMatrix(): void; - /** - * Adds a range of data in the data texture to be updated on the GPU. - * - * @param {number} start - Position at which to start update. - * @param {number} count - The number of components to update. - */ - addUpdateRange(start: number, count: number): void; - /** - * Clears the update ranges. - */ - clearUpdateRanges(): void; - /** - * Returns a new texture with copied values from this instance. - * - * @return {Texture} A clone of this instance. - */ - clone(): Texture; - /** - * Copies the values of the given texture to this instance. - * - * @param {Texture} source - The texture to copy. - * @return {Texture} A reference to this instance. - */ - copy(source: Texture): Texture; - /** - * Setting this property to `true` indicates the engine the texture - * must be updated in the next render. This triggers a texture upload - * to the GPU and ensures correct texture parameter configuration. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * Sets this texture's properties based on `values`. - * @param {Object} values - A container with texture parameters. - */ - setValues(values: Object): void; - /** - * Serializes the texture into JSON. - * - * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized texture. - * @see {@link ObjectLoader#parse} - */ - toJSON(meta: (Object | string) | null): Object; - /** - * Frees the GPU-related resources allocated by this instance. Call this - * method whenever this instance is no longer used in your app. - * - * @fires Texture#dispose - */ - dispose(): void; - /** - * Transforms the given uv vector with the textures uv transformation matrix. - * - * @param {Vector2} uv - The uv vector. - * @return {Vector2} The transformed uv vector. - */ - transformUv(uv: Vector2): Vector2; - /** - * Setting this property to `true` indicates the engine the PMREM - * must be regenerated. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsPMREMUpdate(value: boolean); -} -export namespace Texture { - export let DEFAULT_IMAGE: (new (width?: number, height?: number) => HTMLImageElement) | null; - export { UVMapping as DEFAULT_MAPPING }; - export let DEFAULT_ANISOTROPY: number; -} -import { EventDispatcher } from '../core/EventDispatcher.js'; -import { TextureSource } from './TextureSource.js'; -import { Vector2 } from '../math/Vector2.js'; -import { Matrix3 } from '../math/Matrix3.js'; -import { UVMapping } from '../constants.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts b/jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts deleted file mode 100644 index a01902cee..000000000 --- a/jsdoc-testing/jsdoc/src/textures/TextureSource.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @deprecated since r186. Use {@link TextureSource} instead. `Source` has been renamed to `TextureSource`. - */ -export class Source extends TextureSource { - /** - * This flag can be used for type testing. - * - * @deprecated since r186. Use {@link TextureSource#isTextureSource} instead. - * @type {boolean} - * @readonly - * @default true - */ - readonly isSource: boolean; -} -/** - * Represents the data source of a texture. - * - * The main purpose of this class is to decouple the data definition from the texture - * definition so the same data can be used with multiple texture instances. - */ -export class TextureSource { - /** - * Constructs a new texture source. - * - * @param {any} [data=null] - The data definition of a texture. - */ - constructor(data?: any); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isTextureSource: boolean; - /** - * The UUID of the source. - * - * @type {string} - * @readonly - */ - readonly uuid: string; - /** - * The data definition of a texture. - * - * @type {any} - */ - data: any; - /** - * This property is only relevant when {@link TextureSource#needsUpdate} is set to `true` and - * provides more control on how texture data should be processed. When `dataReady` is set - * to `false`, the engine performs the memory allocation (if necessary) but does not transfer - * the data into the GPU memory. - * - * @type {boolean} - * @default true - */ - dataReady: boolean; - /** - * This starts at `0` and counts how many times {@link TextureSource#needsUpdate} is set to `true`. - * - * @type {number} - * @readonly - * @default 0 - */ - readonly version: number; - /** - * Returns the dimensions of the source into the given target vector. - * - * @param {(Vector2|Vector3)} target - The target object the result is written into. - * @return {(Vector2|Vector3)} The dimensions of the source. - */ - getSize(target: (Vector2 | Vector3)): (Vector2 | Vector3); - /** - * When the property is set to `true`, the engine allocates the memory - * for the texture (if necessary) and triggers the actual texture upload - * to the GPU next time the source is used. - * - * @type {boolean} - * @default false - * @param {boolean} value - */ - set needsUpdate(value: boolean); - /** - * Serializes the source into JSON. - * - * @param {?(Object|string)} meta - An optional value holding meta information about the serialization. - * @return {Object} A JSON object representing the serialized source. - * @see {@link ObjectLoader#parse} - */ - toJSON(meta: (Object | string) | null): Object; -} diff --git a/jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts deleted file mode 100644 index bd25d7d01..000000000 --- a/jsdoc-testing/jsdoc/src/textures/VideoFrameTexture.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This class can be used as an alternative way to define video data. Instead of using - * an instance of `HTMLVideoElement` like with `VideoTexture`, `VideoFrameTexture` expects each frame is - * defined manually via {@link VideoFrameTexture#setFrame}. A typical use case for this module is when - * video frames are decoded with the WebCodecs API. - * - * ```js - * const texture = new THREE.VideoFrameTexture(); - * texture.setFrame( frame ); - * ``` - * - * @augments VideoTexture - */ -export class VideoFrameTexture extends VideoTexture { - /** - * Constructs a new video frame texture. - * - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearFilter] - The min filter value. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - */ - constructor(mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVideoFrameTexture: boolean; - /** - * Sets the current frame of the video. This will automatically update the texture - * so the data can be used for rendering. - * - * @param {VideoFrame} frame - The video frame. - */ - setFrame(frame: VideoFrame): void; -} -import { VideoTexture } from './VideoTexture.js'; diff --git a/jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts b/jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts deleted file mode 100644 index d4ba7a0fd..000000000 --- a/jsdoc-testing/jsdoc/src/textures/VideoTexture.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * A texture for use with a video. - * - * ```js - * // assuming you have created a HTML video element with id="video" - * const video = document.getElementById( 'video' ); - * const texture = new THREE.VideoTexture( video ); - * ``` - * - * Note: When using video textures with {@link WebGPURenderer}, {@link Texture#colorSpace} must be - * set to THREE.SRGBColorSpace. - * - * Note: After the initial use of a texture, its dimensions, format, and type - * cannot be changed. Instead, call {@link Texture#dispose} on the texture and instantiate a new one. - * - * @augments Texture - */ -export class VideoTexture extends Texture { - /** - * Constructs a new video texture. - * - * @param {HTMLVideoElement} video - The video element to use as a data source for the texture. - * @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. - * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. - * @param {number} [wrapT=ClampToEdgeWrapping] - The wrapT value. - * @param {number} [magFilter=LinearFilter] - The mag filter value. - * @param {number} [minFilter=LinearFilter] - The min filter value. - * @param {number} [format=RGBAFormat] - The texture format. - * @param {number} [type=UnsignedByteType] - The texture type. - * @param {number} [anisotropy=Texture.DEFAULT_ANISOTROPY] - The anisotropy value. - */ - constructor(video: HTMLVideoElement, mapping?: number, wrapS?: number, wrapT?: number, magFilter?: number, minFilter?: number, format?: number, type?: number, anisotropy?: number); - /** - * This flag can be used for type testing. - * - * @type {boolean} - * @readonly - * @default true - */ - readonly isVideoTexture: boolean; - /** - * The video frame request callback identifier, which is a positive integer. - * - * Value of 0 represents no scheduled rVFC. - * - * @private - * @type {number} - */ - private _requestVideoFrameCallbackId; - clone(): any; - /** - * This method is called automatically by the renderer and sets {@link Texture#needsUpdate} - * to `true` every time a new frame is available. - * - * Only relevant if `requestVideoFrameCallback` is not supported in the browser. - */ - update(): void; -} -import { Texture } from './Texture.js'; diff --git a/jsdoc-testing/jsdoc/src/utils.d.ts b/jsdoc-testing/jsdoc/src/utils.d.ts deleted file mode 100644 index 21c16ba39..000000000 --- a/jsdoc-testing/jsdoc/src/utils.d.ts +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Finds the minimum value in an array. - * - * @private - * @param {Array} array - The array to search for the minimum value. - * @return {number} The minimum value in the array, or Infinity if the array is empty. - */ -export function arrayMin(array: Array): number; -/** - * Finds the maximum value in an array. - * - * @private - * @param {Array} array - The array to search for the maximum value. - * @return {number} The maximum value in the array, or -Infinity if the array is empty. - */ -export function arrayMax(array: Array): number; -/** - * Checks if an array contains values that require Uint32 representation. - * - * This function determines whether the array contains any values >= 65535, - * which would require a Uint32Array rather than a Uint16Array for proper storage. - * The function iterates from the end of the array, assuming larger values are - * typically located at the end. - * - * @private - * @param {Array} array - The array to check. - * @return {boolean} True if the array contains values >= 65535, false otherwise. - */ -export function arrayNeedsUint32(array: Array): boolean; -/** - * Creates a typed array of the specified type from the given buffer. - * - * @private - * @param {string} type - The name of the typed array type (e.g., 'Float32Array', 'Uint16Array'). - * @param {ArrayBuffer} buffer - The buffer to create the typed array from. - * @return {TypedArray} A new typed array of the specified type. - */ -export function getTypedArray(type: string, buffer: ArrayBuffer): TypedArray; -/** - * Creates an XHTML element with the specified tag name. - * - * This function uses the XHTML namespace to create DOM elements, - * ensuring proper element creation in XML-based contexts. - * - * @private - * @param {string} name - The tag name of the element to create (e.g., 'canvas', 'div'). - * @return {HTMLElement} The created XHTML element. - */ -export function createElementNS(name: string): HTMLElement; -/** - * Creates a canvas element configured for block display. - * - * This is a convenience function that creates a canvas element with - * display style set to 'block', which is commonly used in three.js - * rendering contexts to avoid inline element spacing issues. - * - * @return {HTMLCanvasElement} A canvas element with display set to 'block'. - */ -export function createCanvasElement(): HTMLCanvasElement; -/** - * Sets a custom function to handle console output. - * - * This allows external code to intercept and handle console.log, console.warn, - * and console.error calls made by three.js, which is useful for custom logging, - * testing, or debugging workflows. - * - * @param {Function} fn - The function to handle console output. Should accept - * (type, message, ...params) where type is 'log', 'warn', or 'error'. - */ -export function setConsoleFunction(fn: Function): void; -/** - * Gets the currently set custom console function. - * - * @return {Function|null} The custom console function, or null if not set. - */ -export function getConsoleFunction(): Function | null; -/** - * Logs an informational message with the 'THREE.' prefix. - * - * If a custom console function is set via setConsoleFunction(), it will be used - * instead of the native console.log. The first parameter is treated as the - * method name and is automatically prefixed with 'THREE.'. - * - * @param {...any} params - The message components. The first param is used as - * the method name and prefixed with 'THREE.'. - */ -export function log(...params: any[]): void; -/** - * Logs a warning message with the 'THREE.' prefix. - * - * If a custom console function is set via setConsoleFunction(), it will be used - * instead of the native console.warn. The first parameter is treated as the - * method name and is automatically prefixed with 'THREE.'. - * - * @param {...any} params - The message components. The first param is used as - * the method name and prefixed with 'THREE.'. - */ -export function warn(...params: any[]): void; -/** - * Logs an error message with the 'THREE.' prefix. - * - * If a custom console function is set via setConsoleFunction(), it will be used - * instead of the native console.error. The first parameter is treated as the - * method name and is automatically prefixed with 'THREE.'. - * - * @param {...any} params - The message components. The first param is used as - * the method name and prefixed with 'THREE.'. - */ -export function error(...params: any[]): void; -/** - * Logs a warning message only once, preventing duplicate warnings. - * - * This function maintains an internal cache of warning messages and will only - * output each unique warning message once. Useful for warnings that may be - * triggered repeatedly but should only be shown to the user once. - * - * @param {...any} params - The warning message components. - */ -export function warnOnce(...params: any[]): void; -/** - * Asynchronously probes for WebGL sync object completion. - * - * This function creates a promise that resolves when the WebGL sync object - * signals completion or rejects if the sync operation fails. It uses polling - * at the specified interval to check the sync status without blocking the - * main thread. This is useful for GPU-CPU synchronization in WebGL contexts. - * - * @private - * @param {WebGL2RenderingContext} gl - The WebGL rendering context. - * @param {WebGLSync} sync - The WebGL sync object to wait for. - * @param {number} interval - The polling interval in milliseconds. - * @return {Promise} A promise that resolves when the sync completes or rejects if it fails. - */ -export function probeAsync(gl: WebGL2RenderingContext, sync: WebGLSync, interval: number): Promise; -/** - * Yields execution to the main thread to allow rendering and other tasks. - * Uses scheduler.yield() when available (Chrome 115+), falls back to requestAnimationFrame. - * - * @return {Promise} - */ -export function yieldToMain(): Promise; -/** - * Converts a projection matrix from normalized device coordinates (NDC) - * range [-1, 1] to [0, 1]. - * - * This conversion is commonly needed when working with depth textures or - * render targets that expect depth values in the [0, 1] range rather than - * the standard OpenGL NDC range of [-1, 1]. The function modifies the - * projection matrix in place. - * - * @private - * @param {Matrix4} projectionMatrix - The projection matrix to convert (modified in place). - */ -export function toNormalizedProjectionMatrix(projectionMatrix: Matrix4): void; -/** - * Reverses the depth range of a projection matrix. - * - * This function inverts the depth mapping of a projection matrix, which is - * useful for reversed-Z depth buffer techniques that can improve depth - * precision. The function handles both perspective and orthographic projection - * matrices differently and modifies the matrix in place. - * - * For perspective matrices (where m[11] === -1), the depth mapping is - * reversed with an offset. For orthographic matrices, a simpler reversal - * is applied. - * - * @private - * @param {Matrix4} projectionMatrix - The projection matrix to reverse (modified in place). - */ -export function toReversedProjectionMatrix(projectionMatrix: Matrix4): void; -/** - * Returns `true` if the given object is a typed array. - * - * @param {any} array - The object to check. - * @return {boolean} Whether the given object is a typed array. - */ -export function isTypedArray(array: any): boolean; -/** - * Used to select the correct depth functions - * when reversed depth buffer is used. - * - * @private - * @type {Object} - */ -export const ReversedDepthFuncs: Object; From 23bbc8ff638788ce9d3f9f8710bcd416dd5f7bb9 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 22 Aug 2026 10:08:44 -0400 Subject: [PATCH 4/6] Update declarations --- types/three/src/renderers/common/ClippingContext.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/three/src/renderers/common/ClippingContext.d.ts b/types/three/src/renderers/common/ClippingContext.d.ts index b6f1a53c4..bf3bb43ee 100644 --- a/types/three/src/renderers/common/ClippingContext.d.ts +++ b/types/three/src/renderers/common/ClippingContext.d.ts @@ -21,6 +21,13 @@ declare class ClippingContext { * @param {?ClippingContext} [parentContext=null] - A reference to the parent clipping context. */ constructor(parentContext?: ClippingContext | null); + /** + * The id of the clipping context. + * + * @type {number} + * @readonly + */ + readonly id: number; /** * The clipping context's version. * From 479c358813b9300f89af97708ae00dd515e4dc08 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 22 Aug 2026 10:09:00 -0400 Subject: [PATCH 5/6] Add examples --- examples-testing/examples/css2d_label.ts | 189 ++++ examples-testing/examples/css3d_mixed.ts | 138 +++ examples-testing/examples/css3d_molecules.ts | 353 +++++++ .../examples/css3d_orthographic.ts | 208 ++++ .../examples/css3d_periodictable.ts | 793 +++++++++++++++ examples-testing/examples/css3d_sandbox.ts | 180 ++++ examples-testing/examples/css3d_sprites.ts | 157 +++ examples-testing/examples/css3d_youtube.ts | 79 ++ examples-testing/examples/games_fps.ts | 377 +++++++ .../examples/misc_animation_groups.ts | 128 +++ .../examples/misc_animation_keys.ts | 132 +++ .../examples/misc_boxselection.ts | 137 +++ .../examples/misc_controls_arcball.ts | 211 ++++ .../examples/misc_controls_drag.ts | 153 +++ .../examples/misc_controls_fly.ts | 219 ++++ .../examples/misc_controls_map.ts | 102 ++ .../examples/misc_controls_orbit.ts | 95 ++ .../examples/misc_controls_pointerlock.ts | 245 +++++ .../examples/misc_controls_trackball.ts | 147 +++ .../examples/misc_controls_transform.ts | 182 ++++ .../examples/misc_exporter_draco.ts | 117 +++ .../examples/misc_exporter_exr.ts | 158 +++ .../examples/misc_exporter_gltf.ts | 534 ++++++++++ .../examples/misc_exporter_gltf_normals.ts | 163 +++ .../examples/misc_exporter_ktx2.ts | 145 +++ .../examples/misc_exporter_obj.ts | 192 ++++ .../examples/misc_exporter_ply.ts | 162 +++ .../examples/misc_exporter_stl.ts | 129 +++ .../examples/misc_exporter_usdz.ts | 111 ++ examples-testing/examples/misc_uv_tests.ts | 44 + .../examples/physics_ammo_instancing.ts | 132 +++ .../examples/physics_jolt_instancing.ts | 133 +++ .../examples/physics_rapier_basic.ts | 144 +++ .../physics_rapier_character_controller.ts | 187 ++++ .../examples/physics_rapier_instancing.ts | 158 +++ .../examples/physics_rapier_joints.ts | 130 +++ .../examples/physics_rapier_terrain.ts | 295 ++++++ .../physics_rapier_vehicle_controller.ts | 297 ++++++ examples-testing/examples/svg_lines.ts | 87 ++ examples-testing/examples/svg_sandbox.ts | 212 ++++ .../examples/webaudio_orientation.ts | 141 +++ examples-testing/examples/webaudio_sandbox.ts | 223 ++++ examples-testing/examples/webaudio_timing.ts | 155 +++ .../examples/webaudio_visualizer.ts | 86 ++ .../examples/webgl_animation_keyframes.ts | 96 ++ .../examples/webgl_animation_multiple.ts | 193 ++++ .../webgl_animation_skinning_morph.ts | 190 ++++ .../examples/webgl_animation_walk.ts | 367 +++++++ .../examples/webgl_buffergeometry.ts | 178 ++++ ...webgl_buffergeometry_attributes_integer.ts | 142 +++ .../webgl_buffergeometry_attributes_none.ts | 56 + ...fergeometry_custom_attributes_particles.ts | 103 ++ .../webgl_buffergeometry_drawrange.ts | 239 +++++ .../webgl_buffergeometry_glbufferattribute.ts | 140 +++ .../examples/webgl_buffergeometry_indexed.ts | 137 +++ .../webgl_buffergeometry_instancing.ts | 138 +++ ...gl_buffergeometry_instancing_billboards.ts | 86 ++ ...l_buffergeometry_instancing_interleaved.ts | 152 +++ .../examples/webgl_buffergeometry_lines.ts | 121 +++ .../webgl_buffergeometry_lines_indexed.ts | 179 ++++ .../examples/webgl_buffergeometry_points.ts | 109 ++ ...webgl_buffergeometry_points_interleaved.ts | 122 +++ .../webgl_buffergeometry_rawshader.ts | 97 ++ .../webgl_buffergeometry_selective_draw.ts | 150 +++ .../examples/webgl_buffergeometry_uint.ts | 177 ++++ examples-testing/examples/webgl_camera.ts | 218 ++++ .../examples/webgl_camera_array.ts | 104 ++ .../webgl_camera_logarithmicdepthbuffer.ts | 248 +++++ .../examples/webgl_clipculldistance.ts | 113 +++ examples-testing/examples/webgl_clipping.ts | 195 ++++ .../examples/webgl_clipping_advanced.ts | 357 +++++++ .../examples/webgl_clipping_intersection.ts | 137 +++ .../examples/webgl_clipping_stencil.ts | 263 +++++ .../examples/webgl_custom_attributes.ts | 100 ++ .../examples/webgl_custom_attributes_lines.ts | 121 +++ .../webgl_custom_attributes_points.ts | 117 +++ .../webgl_custom_attributes_points2.ts | 193 ++++ .../webgl_custom_attributes_points3.ts | 200 ++++ examples-testing/examples/webgl_decals.ts | 240 +++++ .../examples/webgl_effects_anaglyph.ts | 120 +++ .../examples/webgl_effects_ascii.ts | 81 ++ .../examples/webgl_effects_parallaxbarrier.ts | 110 ++ .../examples/webgl_effects_stereo.ts | 98 ++ .../examples/webgl_framebuffer_texture.ts | 151 +++ .../examples/webgl_furnace_test.ts | 108 ++ examples-testing/examples/webgl_geometries.ts | 165 +++ .../examples/webgl_geometry_colors.ts | 177 ++++ .../webgl_geometry_colors_lookuptable.ts | 148 +++ .../examples/webgl_geometry_convex.ts | 117 +++ .../examples/webgl_geometry_cube.ts | 46 + .../examples/webgl_geometry_extrude_shapes.ts | 149 +++ .../webgl_geometry_extrude_splines.ts | 310 ++++++ .../examples/webgl_geometry_minecraft.ts | 184 ++++ .../examples/webgl_geometry_nurbs.ts | 298 ++++++ .../examples/webgl_geometry_shapes.ts | 363 +++++++ .../examples/webgl_geometry_teapot.ts | 185 ++++ .../examples/webgl_geometry_terrain.ts | 174 ++++ .../webgl_geometry_terrain_raycast.ts | 206 ++++ .../examples/webgl_geometry_text.ts | 312 ++++++ .../examples/webgl_geometry_text_shapes.ts | 112 ++ .../examples/webgl_geometry_text_stroke.ts | 146 +++ .../examples/webgl_gpgpu_birds.ts | 313 ++++++ .../examples/webgl_gpgpu_birds_gltf.ts | 413 ++++++++ .../examples/webgl_gpgpu_protoplanet.ts | 280 +++++ .../examples/webgl_gpgpu_water.ts | 574 +++++++++++ examples-testing/examples/webgl_helpers.ts | 117 +++ .../examples/webgl_instancing_dynamic.ts | 175 ++++ .../examples/webgl_instancing_morph.ts | 143 +++ .../examples/webgl_instancing_performance.ts | 262 +++++ .../examples/webgl_instancing_raycast.ts | 116 +++ .../examples/webgl_instancing_scatter.ts | 257 +++++ .../webgl_interactive_buffergeometry.ts | 244 +++++ .../examples/webgl_interactive_cubes.ts | 114 +++ .../examples/webgl_interactive_cubes_gpu.ts | 231 +++++ .../examples/webgl_interactive_cubes_ortho.ts | 129 +++ .../examples/webgl_interactive_lines.ts | 151 +++ .../examples/webgl_interactive_points.ts | 143 +++ .../webgl_interactive_raycasting_points.ts | 223 ++++ .../webgl_interactive_voxelpainter.ts | 158 +++ examples-testing/examples/webgl_lensflares.ts | 140 +++ examples-testing/examples/webgl_lightprobe.ts | 142 +++ .../examples/webgl_lightprobe_cubecamera.ts | 85 ++ .../examples/webgl_lightprobes.ts | 190 ++++ .../examples/webgl_lightprobes_complex.ts | 304 ++++++ .../examples/webgl_lightprobes_sponza.ts | 312 ++++++ .../examples/webgl_lights_hemisphere.ts | 191 ++++ .../examples/webgl_lights_physical.ts | 237 +++++ .../examples/webgl_lights_rectarealight.ts | 110 ++ .../examples/webgl_lights_spotlight.ts | 202 ++++ .../examples/webgl_lights_spotlights.ts | 133 +++ .../examples/webgl_lights_sunlight.ts | 226 +++++ .../examples/webgl_lines_colors.ts | 181 ++++ .../examples/webgl_lines_dashed.ts | 186 ++++ examples-testing/examples/webgl_lines_fat.ts | 245 +++++ .../examples/webgl_lines_fat_raycasting.ts | 280 +++++ .../examples/webgl_lines_fat_wireframe.ts | 210 ++++ examples-testing/examples/webgl_loader_3dm.ts | 94 ++ examples-testing/examples/webgl_loader_3ds.ts | 62 ++ examples-testing/examples/webgl_loader_3mf.ts | 113 +++ .../examples/webgl_loader_3mf_materials.ts | 98 ++ examples-testing/examples/webgl_loader_amf.ts | 62 ++ examples-testing/examples/webgl_loader_bvh.ts | 64 ++ .../examples/webgl_loader_collada.ts | 86 ++ .../examples/webgl_loader_collada_skinning.ts | 100 ++ .../examples/webgl_loader_draco.ts | 81 ++ examples-testing/examples/webgl_loader_fbx.ts | 216 ++++ .../examples/webgl_loader_fbx_nurbs.ts | 61 ++ .../examples/webgl_loader_gcode.ts | 81 ++ .../examples/webgl_loader_gltf.ts | 167 +++ .../webgl_loader_gltf_animation_pointer.ts | 91 ++ .../examples/webgl_loader_gltf_anisotropy.ts | 68 ++ .../examples/webgl_loader_gltf_avif.ts | 61 ++ .../examples/webgl_loader_gltf_compressed.ts | 83 ++ .../examples/webgl_loader_gltf_dispersion.ts | 66 ++ .../examples/webgl_loader_gltf_instancing.ts | 69 ++ .../examples/webgl_loader_gltf_iridescence.ts | 66 ++ .../webgl_loader_gltf_progressive_lod.ts | 143 +++ .../examples/webgl_loader_gltf_sheen.ts | 72 ++ .../webgl_loader_gltf_transmission.ts | 83 ++ .../examples/webgl_loader_imagebitmap.ts | 113 +++ examples-testing/examples/webgl_loader_kmz.ts | 59 ++ .../examples/webgl_loader_md2_control.ts | 278 +++++ examples-testing/examples/webgl_loader_mdd.ts | 65 ++ examples-testing/examples/webgl_loader_obj.ts | 72 ++ examples-testing/examples/webgl_loader_pcd.ts | 78 ++ examples-testing/examples/webgl_loader_pdb.ts | 208 ++++ examples-testing/examples/webgl_loader_ply.ts | 146 +++ examples-testing/examples/webgl_loader_svg.ts | 202 ++++ .../examples/webgl_loader_texture_dds.ts | 218 ++++ .../examples/webgl_loader_texture_ktx.ts | 165 +++ .../examples/webgl_loader_texture_tga.ts | 90 ++ .../examples/webgl_loader_texture_tiff.ts | 87 ++ .../examples/webgl_loader_texture_ultrahdr.ts | 101 ++ examples-testing/examples/webgl_loader_ttf.ts | 231 +++++ .../examples/webgl_loader_usdz.ts | 68 ++ examples-testing/examples/webgl_loader_vox.ts | 99 ++ .../examples/webgl_loader_vrml.ts | 120 +++ examples-testing/examples/webgl_loader_xyz.ts | 65 ++ examples-testing/examples/webgl_lod.ts | 91 ++ .../examples/webgl_marchingcubes.ts | 312 ++++++ .../examples/webgl_materials_alphahash.ts | 178 ++++ .../examples/webgl_materials_blending.ts | 149 +++ .../webgl_materials_blending_custom.ts | 214 ++++ .../examples/webgl_materials_bumpmap.ts | 134 +++ .../examples/webgl_materials_car.ts | 168 +++ .../examples/webgl_materials_cubemap.ts | 115 +++ .../webgl_materials_cubemap_dynamic.ts | 115 +++ .../webgl_materials_cubemap_mipmaps.ts | 119 +++ .../webgl_materials_cubemap_refraction.ts | 126 +++ ...bgl_materials_cubemap_render_to_mipmaps.ts | 183 ++++ .../webgl_materials_displacementmap.ts | 224 ++++ .../examples/webgl_materials_envmaps.ts | 131 +++ .../examples/webgl_materials_envmaps_exr.ts | 153 +++ .../webgl_materials_envmaps_fasthdr.ts | 169 ++++ ...webgl_materials_envmaps_groundprojected.ts | 151 +++ .../examples/webgl_materials_envmaps_hdr.ts | 163 +++ .../examples/webgl_materials_modified.ts | 115 +++ .../webgl_materials_normalmap_object_space.ts | 82 ++ .../webgl_materials_physical_clearcoat.ts | 208 ++++ .../webgl_materials_physical_transmission.ts | 192 ++++ ...l_materials_physical_transmission_alpha.ts | 194 ++++ .../webgl_materials_texture_anisotropy.ts | 143 +++ .../webgl_materials_texture_canvas.ts | 92 ++ .../webgl_materials_texture_filters.ts | 165 +++ .../examples/webgl_materials_texture_html.ts | 94 ++ .../webgl_materials_texture_manualmipmap.ts | 175 ++++ .../webgl_materials_texture_partialupdate.ts | 104 ++ .../webgl_materials_texture_rotation.ts | 112 ++ .../examples/webgl_materials_toon.ts | 152 +++ .../examples/webgl_materials_video.ts | 202 ++++ .../examples/webgl_materials_video_webcam.ts | 79 ++ .../examples/webgl_materials_wireframe.ts | 107 ++ examples-testing/examples/webgl_math_obb.ts | 192 ++++ .../webgl_math_orientation_transform.ts | 120 +++ examples-testing/examples/webgl_mesh_batch.ts | 347 +++++++ examples-testing/examples/webgl_mirror.ts | 193 ++++ .../examples/webgl_modifier_edgesplit.ts | 128 +++ .../examples/webgl_modifier_simplifier.ts | 84 ++ .../examples/webgl_modifier_tessellation.ts | 142 +++ .../examples/webgl_morphtargets.ts | 116 +++ .../examples/webgl_morphtargets_face.ts | 108 ++ .../examples/webgl_morphtargets_horse.ts | 100 ++ .../examples/webgl_morphtargets_sphere.ts | 105 ++ .../examples/webgl_multiple_elements.ts | 139 +++ .../examples/webgl_multiple_rendertargets.ts | 133 +++ .../webgl_multiple_scenes_comparison.ts | 98 ++ .../examples/webgl_multiple_views.ts | 235 +++++ .../webgl_multisampled_renderbuffers.ts | 133 +++ .../examples/webgl_panorama_cube.ts | 83 ++ .../webgl_panorama_equirectangular.ts | 112 ++ .../examples/webgl_performance.ts | 77 ++ .../examples/webgl_pmrem_cubemap.ts | 76 ++ .../examples/webgl_pmrem_equirectangular.ts | 76 ++ examples-testing/examples/webgl_pmrem_test.ts | 141 +++ .../examples/webgl_points_billboards.ts | 120 +++ .../examples/webgl_points_sprites.ts | 167 +++ .../examples/webgl_points_waves.ts | 145 +++ examples-testing/examples/webgl_portal.ts | 218 ++++ .../examples/webgl_postprocessing.ts | 86 ++ .../examples/webgl_postprocessing_advanced.ts | 304 ++++++ .../webgl_postprocessing_afterimage.ts | 72 ++ .../webgl_postprocessing_backgrounds.ts | 214 ++++ .../examples/webgl_postprocessing_fxaa.ts | 122 +++ .../examples/webgl_postprocessing_glitch.ts | 108 ++ .../examples/webgl_postprocessing_godrays.ts | 176 ++++ .../examples/webgl_postprocessing_gtao.ts | 216 ++++ .../examples/webgl_postprocessing_masking.ts | 101 ++ .../examples/webgl_postprocessing_outline.ts | 273 +++++ .../examples/webgl_postprocessing_pixel.ts | 363 +++++++ .../webgl_postprocessing_procedural.ts | 77 ++ .../webgl_postprocessing_rgb_halftone.ts | 170 ++++ .../examples/webgl_postprocessing_sao.ts | 146 +++ .../examples/webgl_postprocessing_smaa.ts | 106 ++ .../examples/webgl_postprocessing_sobel.ts | 111 ++ .../examples/webgl_postprocessing_ssaa.ts | 214 ++++ .../examples/webgl_postprocessing_ssao.ts | 125 +++ .../examples/webgl_postprocessing_ssr.ts | 260 +++++ .../examples/webgl_postprocessing_taa.ts | 139 +++ .../webgl_postprocessing_transition.ts | 214 ++++ .../webgl_postprocessing_unreal_bloom.ts | 139 +++ ...l_postprocessing_unreal_bloom_selective.ts | 208 ++++ examples-testing/examples/webgl_random_uv.ts | 338 +++++++ .../examples/webgl_raycaster_sprite.ts | 103 ++ .../examples/webgl_raycaster_texture.ts | 286 ++++++ .../examples/webgl_read_float_buffer.ts | 153 +++ examples-testing/examples/webgl_refraction.ts | 138 +++ examples-testing/examples/webgl_rtt.ts | 171 ++++ examples-testing/examples/webgl_shader.ts | 50 + .../examples/webgl_shader_lava.ts | 104 ++ .../examples/webgl_shaders_ocean.ts | 200 ++++ .../examples/webgl_shaders_sky.ts | 127 +++ .../examples/webgl_shadow_contact.ts | 272 +++++ examples-testing/examples/webgl_shadowmap.ts | 310 ++++++ .../examples/webgl_shadowmap_csm.ts | 253 +++++ .../examples/webgl_shadowmap_pcss.ts | 165 +++ .../examples/webgl_shadowmap_performance.ts | 270 +++++ .../examples/webgl_shadowmap_pointlight.ts | 141 +++ .../examples/webgl_shadowmap_progressive.ts | 204 ++++ .../examples/webgl_shadowmap_viewer.ts | 181 ++++ .../examples/webgl_shadowmap_vsm.ts | 203 ++++ examples-testing/examples/webgl_shadowmesh.ts | 253 +++++ examples-testing/examples/webgl_simple_gi.ts | 172 ++++ examples-testing/examples/webgl_sprites.ts | 187 ++++ .../examples/webgl_test_memory.ts | 65 ++ .../examples/webgl_test_memory2.ts | 81 ++ .../examples/webgl_test_wide_gamut.ts | 130 +++ .../webgl_texture2darray_compressed.ts | 90 ++ .../webgl_texture2darray_layerupdate.ts | 130 +++ examples-testing/examples/webgl_texture3d.ts | 128 +++ .../examples/webgl_texture3d_partialupdate.ts | 326 ++++++ .../examples/webgl_tonemapping.ts | 170 ++++ .../examples/webgl_tsl_clearcoat.ts | 210 ++++ .../examples/webgl_tsl_instancing.ts | 286 ++++++ .../examples/webgl_tsl_shadowmap.ts | 160 +++ .../examples/webgl_tsl_skinning.ts | 74 ++ examples-testing/examples/webgl_ubo.ts | 140 +++ examples-testing/examples/webgl_ubo_arrays.ts | 174 ++++ .../examples/webgl_video_kinect.ts | 109 ++ .../webgl_video_panorama_equirectangular.ts | 95 ++ .../examples/webgl_volume_cloud.ts | 279 +++++ .../examples/webgl_volume_instancing.ts | 222 ++++ .../examples/webgl_volume_perlin.ts | 235 +++++ examples-testing/examples/webgl_watch.ts | 243 +++++ .../examples/webgpu_animation_retargeting.ts | 295 ++++++ ...ebgpu_animation_retargeting_readyplayer.ts | 165 +++ examples-testing/examples/webgpu_backdrop.ts | 134 +++ .../examples/webgpu_backdrop_area.ts | 157 +++ .../examples/webgpu_backdrop_water.ts | 261 +++++ examples-testing/examples/webgpu_camera.ts | 211 ++++ .../examples/webgpu_camera_array.ts | 101 ++ .../webgpu_camera_logarithmicdepthbuffer.ts | 240 +++++ examples-testing/examples/webgpu_caustics.ts | 200 ++++ .../examples/webgpu_centroid_sampling.ts | 199 ++++ examples-testing/examples/webgpu_clearcoat.ts | 194 ++++ examples-testing/examples/webgpu_clipping.ts | 201 ++++ .../examples/webgpu_clipping_stencil.ts | 240 +++++ .../examples/webgpu_compile_async.ts | 265 +++++ .../examples/webgpu_compute_audio.ts | 178 ++++ .../examples/webgpu_compute_birds.ts | 424 ++++++++ .../examples/webgpu_compute_cloth.ts | 487 +++++++++ .../examples/webgpu_compute_geometry.ts | 190 ++++ .../examples/webgpu_compute_particles.ts | 226 +++++ .../examples/webgpu_compute_particles_rain.ts | 334 ++++++ .../examples/webgpu_compute_particles_snow.ts | 331 ++++++ .../examples/webgpu_compute_points.ts | 124 +++ .../examples/webgpu_compute_sort_bitonic.ts | 457 +++++++++ .../examples/webgpu_compute_texture.ts | 96 ++ .../examples/webgpu_compute_texture_3d.ts | 193 ++++ .../webgpu_compute_texture_pingpong.ts | 170 ++++ .../examples/webgpu_cubemap_adjustments.ts | 165 +++ .../examples/webgpu_cubemap_dynamic.ts | 130 +++ .../examples/webgpu_cubemap_mix.ts | 78 ++ .../examples/webgpu_custom_fog.ts | 225 +++++ .../examples/webgpu_custom_fog_background.ts | 86 ++ .../examples/webgpu_custom_fog_scattering.ts | 193 ++++ examples-testing/examples/webgpu_deferred.ts | 254 +++++ .../examples/webgpu_depth_texture.ts | 83 ++ .../examples/webgpu_display_stereo.ts | 191 ++++ .../examples/webgpu_equirectangular.ts | 57 ++ .../examples/webgpu_fog_height.ts | 99 ++ .../examples/webgpu_furnace_test.ts | 111 ++ .../examples/webgpu_gaussian_splat.ts | 193 ++++ .../examples/webgpu_generator_building.ts | 225 +++++ .../examples/webgpu_generator_city.ts | 169 ++++ .../examples/webgpu_geometry_loft.ts | 955 ++++++++++++++++++ examples-testing/examples/webgpu_hdr.ts | 124 +++ .../examples/webgpu_instance_mesh.ts | 98 ++ .../examples/webgpu_instance_path.ts | 147 +++ .../examples/webgpu_instance_points.ts | 204 ++++ .../examples/webgpu_instancing_morph.ts | 145 +++ examples-testing/examples/webgpu_layers.ts | 144 +++ .../examples/webgpu_lensflares.ts | 137 +++ .../examples/webgpu_lightprobe.ts | 136 +++ .../examples/webgpu_lightprobe_cubecamera.ts | 90 ++ .../examples/webgpu_lightprobes.ts | 195 ++++ .../examples/webgpu_lightprobes_complex.ts | 313 ++++++ .../examples/webgpu_lightprobes_sponza.ts | 339 +++++++ .../examples/webgpu_lights_clustered.ts | 228 +++++ .../examples/webgpu_lights_dynamic.ts | 242 +++++ .../examples/webgpu_lights_ies_spotlight.ts | 168 +++ .../examples/webgpu_lights_phong.ts | 136 +++ .../examples/webgpu_lights_physical.ts | 236 +++++ .../examples/webgpu_lights_pointlights.ts | 190 ++++ .../examples/webgpu_lights_rectarealight.ts | 87 ++ .../examples/webgpu_lights_selective.ts | 150 +++ .../examples/webgpu_lights_spotlight.ts | 200 ++++ examples-testing/examples/webgpu_lines_fat.ts | 266 +++++ .../examples/webgpu_lines_fat_raycasting.ts | 286 ++++++ .../examples/webgpu_lines_fat_wireframe.ts | 208 ++++ .../examples/webgpu_loader_gltf.ts | 183 ++++ .../examples/webgpu_loader_gltf_anisotropy.ts | 64 ++ .../examples/webgpu_loader_gltf_compressed.ts | 69 ++ .../examples/webgpu_loader_gltf_dispersion.ts | 63 ++ .../webgpu_loader_gltf_iridescence.ts | 70 ++ .../examples/webgpu_loader_gltf_sheen.ts | 81 ++ .../webgpu_loader_gltf_transmission.ts | 83 ++ .../examples/webgpu_loader_materialx.ts | 300 ++++++ .../examples/webgpu_loader_texture_ktx2.ts | 186 ++++ .../examples/webgpu_materials_alphahash.ts | 130 +++ .../examples/webgpu_materials_arrays.ts | 185 ++++ .../examples/webgpu_materials_basic.ts | 129 +++ .../webgpu_materials_cubemap_mipmaps.ts | 119 +++ .../webgpu_materials_displacementmap.ts | 195 ++++ .../examples/webgpu_materials_envmaps.ts | 132 +++ .../webgpu_materials_envmaps_bpcem.ts | 202 ++++ ...ebgpu_materials_envmaps_groundprojected.ts | 160 +++ .../examples/webgpu_materials_lightmap.ts | 105 ++ .../examples/webgpu_materials_matcap.ts | 175 ++++ .../webgpu_materials_retroreflection.ts | 132 +++ .../examples/webgpu_materials_sss.ts | 153 +++ .../examples/webgpu_materials_texture_html.ts | 95 ++ .../webgpu_materials_texture_manualmipmap.ts | 170 ++++ .../examples/webgpu_materials_toon.ts | 149 +++ .../examples/webgpu_materials_transmission.ts | 173 ++++ .../examples/webgpu_materials_video.ts | 179 ++++ .../examples/webgpu_materialx_noise.ts | 355 +++++++ .../examples/webgpu_mesh_batch.ts | 265 +++++ examples-testing/examples/webgpu_mirror.ts | 195 ++++ .../examples/webgpu_modifier_curve.ts | 154 +++ .../examples/webgpu_morphtargets.ts | 119 +++ .../examples/webgpu_morphtargets_face.ts | 98 ++ examples-testing/examples/webgpu_mrt.ts | 123 +++ examples-testing/examples/webgpu_mrt_mask.ts | 132 +++ .../examples/webgpu_multiple_canvas.ts | 111 ++ .../examples/webgpu_multiple_elements.ts | 142 +++ .../examples/webgpu_multiple_rendertargets.ts | 97 ++ .../webgpu_multiple_rendertargets_readback.ts | 161 +++ .../webgpu_multisampled_renderbuffers.ts | 129 +++ examples-testing/examples/webgpu_occlusion.ts | 97 ++ examples-testing/examples/webgpu_ocean.ts | 181 ++++ examples-testing/examples/webgpu_oit.ts | 148 +++ .../examples/webgpu_parallax_uv.ts | 135 +++ examples-testing/examples/webgpu_particles.ts | 151 +++ .../examples/webgpu_particles_soft.ts | 153 +++ .../examples/webgpu_performance.ts | 101 ++ .../webgpu_performance_renderbundle.ts | 229 +++++ .../examples/webgpu_pmrem_cubemap.ts | 75 ++ .../examples/webgpu_pmrem_equirectangular.ts | 75 ++ .../examples/webgpu_pmrem_scene.ts | 106 ++ .../examples/webgpu_pmrem_test.ts | 138 +++ examples-testing/examples/webgpu_portal.ts | 156 +++ .../examples/webgpu_postprocessing.ts | 82 ++ .../examples/webgpu_postprocessing_3dlut.ts | 229 +++++ .../webgpu_postprocessing_afterimage.ts | 152 +++ .../webgpu_postprocessing_anamorphic.ts | 166 +++ .../examples/webgpu_postprocessing_ao.ts | 582 +++++++++++ .../examples/webgpu_postprocessing_bloom.ts | 132 +++ .../webgpu_postprocessing_bloom_emissive.ts | 115 +++ .../webgpu_postprocessing_bloom_selective.ts | 124 +++ .../examples/webgpu_postprocessing_ca.ts | 266 +++++ .../webgpu_postprocessing_difference.ts | 93 ++ .../examples/webgpu_postprocessing_direct.ts | 78 ++ .../examples/webgpu_postprocessing_dof.ts | 132 +++ .../webgpu_postprocessing_dof_basic.ts | 154 +++ .../examples/webgpu_postprocessing_fxaa.ts | 129 +++ .../examples/webgpu_postprocessing_godrays.ts | 209 ++++ .../webgpu_postprocessing_lensflare.ts | 135 +++ .../examples/webgpu_postprocessing_masking.ts | 88 ++ .../webgpu_postprocessing_motion_blur.ts | 199 ++++ .../examples/webgpu_postprocessing_outline.ts | 232 +++++ .../examples/webgpu_postprocessing_pixel.ts | 237 +++++ .../webgpu_postprocessing_radial_blur.ts | 149 +++ .../examples/webgpu_postprocessing_retro.ts | 370 +++++++ .../examples/webgpu_postprocessing_smaa.ts | 98 ++ .../examples/webgpu_postprocessing_sobel.ts | 95 ++ .../examples/webgpu_postprocessing_ssaa.ts | 169 ++++ .../examples/webgpu_postprocessing_ssgi.ts | 244 +++++ .../webgpu_postprocessing_ssgi_ballpool.ts | 416 ++++++++ .../examples/webgpu_postprocessing_ssr.ts | 212 ++++ .../webgpu_postprocessing_ssr_denoise.ts | 504 +++++++++ .../examples/webgpu_postprocessing_sss.ts | 185 ++++ .../examples/webgpu_postprocessing_traa.ts | 93 ++ .../webgpu_postprocessing_transition.ts | 207 ++++ .../examples/webgpu_procedural_texture.ts | 75 ++ .../examples/webgpu_reflection.ts | 344 +++++++ .../examples/webgpu_reflection_roughness.ts | 121 +++ .../examples/webgpu_refraction.ts | 144 +++ .../webgpu_rendertarget_2d-array_3d.ts | 237 +++++ .../examples/webgpu_reversed_depth_buffer.ts | 169 ++++ examples-testing/examples/webgpu_rtt.ts | 90 ++ .../examples/webgpu_shadow_contact.ts | 205 ++++ examples-testing/examples/webgpu_shadowmap.ts | 166 +++ .../examples/webgpu_shadowmap_array.ts | 329 ++++++ .../examples/webgpu_shadowmap_csm.ts | 267 +++++ .../examples/webgpu_shadowmap_opacity.ts | 117 +++ .../examples/webgpu_shadowmap_pointlight.ts | 139 +++ .../examples/webgpu_shadowmap_progressive.ts | 203 ++++ .../examples/webgpu_shadowmap_vsm.ts | 197 ++++ examples-testing/examples/webgpu_skinning.ts | 72 ++ .../examples/webgpu_skinning_instancing.ts | 128 +++ .../webgpu_skinning_instancing_individual.ts | 431 ++++++++ examples-testing/examples/webgpu_sprites.ts | 103 ++ .../examples/webgpu_storage_buffer.ts | 169 ++++ .../examples/webgpu_struct_drawindirect.ts | 212 ++++ .../examples/webgpu_test_memory.ts | 223 ++++ .../examples/webgpu_texturegather.ts | 120 +++ .../examples/webgpu_texturegrad.ts | 116 +++ .../examples/webgpu_textures_2d-array.ts | 69 ++ .../webgpu_textures_2d-array_compressed.ts | 85 ++ .../examples/webgpu_textures_anisotropy.ts | 145 +++ .../examples/webgpu_textures_partialupdate.ts | 105 ++ .../examples/webgpu_tonemapping.ts | 141 +++ .../examples/webgpu_tsl_angular_slicing.ts | 174 ++++ examples-testing/examples/webgpu_tsl_earth.ts | 175 ++++ .../examples/webgpu_tsl_galaxy.ts | 99 ++ examples-testing/examples/webgpu_tsl_graph.ts | 228 +++++ .../examples/webgpu_tsl_halftone.ts | 214 ++++ .../examples/webgpu_tsl_interoperability.ts | 263 +++++ .../examples/webgpu_tsl_procedural_terrain.ts | 318 ++++++ .../examples/webgpu_tsl_raging_sea.ts | 178 ++++ .../examples/webgpu_tsl_vfx_flames.ts | 203 ++++ .../webgpu_tsl_vfx_linkedparticles.ts | 445 ++++++++ .../examples/webgpu_tsl_vfx_tornado.ts | 289 ++++++ examples-testing/examples/webgpu_tsl_wood.ts | 249 +++++ .../examples/webgpu_upscaling_fsr1.ts | 122 +++ .../examples/webgpu_upscaling_taau.ts | 142 +++ .../examples/webgpu_video_panorama.ts | 99 ++ .../examples/webgpu_volume_caustics.ts | 302 ++++++ .../examples/webgpu_volume_cloud.ts | 165 +++ .../examples/webgpu_volume_lighting.ts | 248 +++++ .../webgpu_volume_lighting_rectarea.ts | 256 +++++ .../examples/webgpu_volume_lighting_traa.ts | 298 ++++++ .../examples/webgpu_volume_perlin.ts | 148 +++ examples-testing/examples/webgpu_water.ts | 199 ++++ examples-testing/examples/webgpu_xr_cubes.ts | 242 +++++ .../examples/webgpu_xr_native_layers.ts | 637 ++++++++++++ .../examples/webgpu_xr_rollercoaster.ts | 259 +++++ .../examples/webgpu_xr_shadows.ts | 195 ++++ examples-testing/examples/webxr_ar_cones.ts | 66 ++ examples-testing/examples/webxr_ar_hittest.ts | 119 +++ .../examples/webxr_ar_lighting.ts | 124 +++ .../examples/webxr_ar_plane_detection.ts | 46 + .../examples/webxr_vr_handinput.ts | 126 +++ .../examples/webxr_vr_panorama.ts | 92 ++ .../examples/webxr_vr_panorama_depth.ts | 93 ++ .../examples/webxr_vr_rollercoaster.ts | 232 +++++ examples-testing/examples/webxr_vr_sandbox.ts | 192 ++++ examples-testing/examples/webxr_vr_video.ts | 92 ++ .../examples/webxr_xr_controls_transform.ts | 218 ++++ .../webxr_xr_dragging_custom_depth.ts | 395 ++++++++ 520 files changed, 90542 insertions(+) create mode 100644 examples-testing/examples/css2d_label.ts create mode 100644 examples-testing/examples/css3d_mixed.ts create mode 100644 examples-testing/examples/css3d_molecules.ts create mode 100644 examples-testing/examples/css3d_orthographic.ts create mode 100644 examples-testing/examples/css3d_periodictable.ts create mode 100644 examples-testing/examples/css3d_sandbox.ts create mode 100644 examples-testing/examples/css3d_sprites.ts create mode 100644 examples-testing/examples/css3d_youtube.ts create mode 100644 examples-testing/examples/games_fps.ts create mode 100644 examples-testing/examples/misc_animation_groups.ts create mode 100644 examples-testing/examples/misc_animation_keys.ts create mode 100644 examples-testing/examples/misc_boxselection.ts create mode 100644 examples-testing/examples/misc_controls_arcball.ts create mode 100644 examples-testing/examples/misc_controls_drag.ts create mode 100644 examples-testing/examples/misc_controls_fly.ts create mode 100644 examples-testing/examples/misc_controls_map.ts create mode 100644 examples-testing/examples/misc_controls_orbit.ts create mode 100644 examples-testing/examples/misc_controls_pointerlock.ts create mode 100644 examples-testing/examples/misc_controls_trackball.ts create mode 100644 examples-testing/examples/misc_controls_transform.ts create mode 100644 examples-testing/examples/misc_exporter_draco.ts create mode 100644 examples-testing/examples/misc_exporter_exr.ts create mode 100644 examples-testing/examples/misc_exporter_gltf.ts create mode 100644 examples-testing/examples/misc_exporter_gltf_normals.ts create mode 100644 examples-testing/examples/misc_exporter_ktx2.ts create mode 100644 examples-testing/examples/misc_exporter_obj.ts create mode 100644 examples-testing/examples/misc_exporter_ply.ts create mode 100644 examples-testing/examples/misc_exporter_stl.ts create mode 100644 examples-testing/examples/misc_exporter_usdz.ts create mode 100644 examples-testing/examples/misc_uv_tests.ts create mode 100644 examples-testing/examples/physics_ammo_instancing.ts create mode 100644 examples-testing/examples/physics_jolt_instancing.ts create mode 100644 examples-testing/examples/physics_rapier_basic.ts create mode 100644 examples-testing/examples/physics_rapier_character_controller.ts create mode 100644 examples-testing/examples/physics_rapier_instancing.ts create mode 100644 examples-testing/examples/physics_rapier_joints.ts create mode 100644 examples-testing/examples/physics_rapier_terrain.ts create mode 100644 examples-testing/examples/physics_rapier_vehicle_controller.ts create mode 100644 examples-testing/examples/svg_lines.ts create mode 100644 examples-testing/examples/svg_sandbox.ts create mode 100644 examples-testing/examples/webaudio_orientation.ts create mode 100644 examples-testing/examples/webaudio_sandbox.ts create mode 100644 examples-testing/examples/webaudio_timing.ts create mode 100644 examples-testing/examples/webaudio_visualizer.ts create mode 100644 examples-testing/examples/webgl_animation_keyframes.ts create mode 100644 examples-testing/examples/webgl_animation_multiple.ts create mode 100644 examples-testing/examples/webgl_animation_skinning_morph.ts create mode 100644 examples-testing/examples/webgl_animation_walk.ts create mode 100644 examples-testing/examples/webgl_buffergeometry.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_attributes_integer.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_attributes_none.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_drawrange.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_indexed.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_instancing.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_lines.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_lines_indexed.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_points.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_points_interleaved.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_rawshader.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_selective_draw.ts create mode 100644 examples-testing/examples/webgl_buffergeometry_uint.ts create mode 100644 examples-testing/examples/webgl_camera.ts create mode 100644 examples-testing/examples/webgl_camera_array.ts create mode 100644 examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts create mode 100644 examples-testing/examples/webgl_clipculldistance.ts create mode 100644 examples-testing/examples/webgl_clipping.ts create mode 100644 examples-testing/examples/webgl_clipping_advanced.ts create mode 100644 examples-testing/examples/webgl_clipping_intersection.ts create mode 100644 examples-testing/examples/webgl_clipping_stencil.ts create mode 100644 examples-testing/examples/webgl_custom_attributes.ts create mode 100644 examples-testing/examples/webgl_custom_attributes_lines.ts create mode 100644 examples-testing/examples/webgl_custom_attributes_points.ts create mode 100644 examples-testing/examples/webgl_custom_attributes_points2.ts create mode 100644 examples-testing/examples/webgl_custom_attributes_points3.ts create mode 100644 examples-testing/examples/webgl_decals.ts create mode 100644 examples-testing/examples/webgl_effects_anaglyph.ts create mode 100644 examples-testing/examples/webgl_effects_ascii.ts create mode 100644 examples-testing/examples/webgl_effects_parallaxbarrier.ts create mode 100644 examples-testing/examples/webgl_effects_stereo.ts create mode 100644 examples-testing/examples/webgl_framebuffer_texture.ts create mode 100644 examples-testing/examples/webgl_furnace_test.ts create mode 100644 examples-testing/examples/webgl_geometries.ts create mode 100644 examples-testing/examples/webgl_geometry_colors.ts create mode 100644 examples-testing/examples/webgl_geometry_colors_lookuptable.ts create mode 100644 examples-testing/examples/webgl_geometry_convex.ts create mode 100644 examples-testing/examples/webgl_geometry_cube.ts create mode 100644 examples-testing/examples/webgl_geometry_extrude_shapes.ts create mode 100644 examples-testing/examples/webgl_geometry_extrude_splines.ts create mode 100644 examples-testing/examples/webgl_geometry_minecraft.ts create mode 100644 examples-testing/examples/webgl_geometry_nurbs.ts create mode 100644 examples-testing/examples/webgl_geometry_shapes.ts create mode 100644 examples-testing/examples/webgl_geometry_teapot.ts create mode 100644 examples-testing/examples/webgl_geometry_terrain.ts create mode 100644 examples-testing/examples/webgl_geometry_terrain_raycast.ts create mode 100644 examples-testing/examples/webgl_geometry_text.ts create mode 100644 examples-testing/examples/webgl_geometry_text_shapes.ts create mode 100644 examples-testing/examples/webgl_geometry_text_stroke.ts create mode 100644 examples-testing/examples/webgl_gpgpu_birds.ts create mode 100644 examples-testing/examples/webgl_gpgpu_birds_gltf.ts create mode 100644 examples-testing/examples/webgl_gpgpu_protoplanet.ts create mode 100644 examples-testing/examples/webgl_gpgpu_water.ts create mode 100644 examples-testing/examples/webgl_helpers.ts create mode 100644 examples-testing/examples/webgl_instancing_dynamic.ts create mode 100644 examples-testing/examples/webgl_instancing_morph.ts create mode 100644 examples-testing/examples/webgl_instancing_performance.ts create mode 100644 examples-testing/examples/webgl_instancing_raycast.ts create mode 100644 examples-testing/examples/webgl_instancing_scatter.ts create mode 100644 examples-testing/examples/webgl_interactive_buffergeometry.ts create mode 100644 examples-testing/examples/webgl_interactive_cubes.ts create mode 100644 examples-testing/examples/webgl_interactive_cubes_gpu.ts create mode 100644 examples-testing/examples/webgl_interactive_cubes_ortho.ts create mode 100644 examples-testing/examples/webgl_interactive_lines.ts create mode 100644 examples-testing/examples/webgl_interactive_points.ts create mode 100644 examples-testing/examples/webgl_interactive_raycasting_points.ts create mode 100644 examples-testing/examples/webgl_interactive_voxelpainter.ts create mode 100644 examples-testing/examples/webgl_lensflares.ts create mode 100644 examples-testing/examples/webgl_lightprobe.ts create mode 100644 examples-testing/examples/webgl_lightprobe_cubecamera.ts create mode 100644 examples-testing/examples/webgl_lightprobes.ts create mode 100644 examples-testing/examples/webgl_lightprobes_complex.ts create mode 100644 examples-testing/examples/webgl_lightprobes_sponza.ts create mode 100644 examples-testing/examples/webgl_lights_hemisphere.ts create mode 100644 examples-testing/examples/webgl_lights_physical.ts create mode 100644 examples-testing/examples/webgl_lights_rectarealight.ts create mode 100644 examples-testing/examples/webgl_lights_spotlight.ts create mode 100644 examples-testing/examples/webgl_lights_spotlights.ts create mode 100644 examples-testing/examples/webgl_lights_sunlight.ts create mode 100644 examples-testing/examples/webgl_lines_colors.ts create mode 100644 examples-testing/examples/webgl_lines_dashed.ts create mode 100644 examples-testing/examples/webgl_lines_fat.ts create mode 100644 examples-testing/examples/webgl_lines_fat_raycasting.ts create mode 100644 examples-testing/examples/webgl_lines_fat_wireframe.ts create mode 100644 examples-testing/examples/webgl_loader_3dm.ts create mode 100644 examples-testing/examples/webgl_loader_3ds.ts create mode 100644 examples-testing/examples/webgl_loader_3mf.ts create mode 100644 examples-testing/examples/webgl_loader_3mf_materials.ts create mode 100644 examples-testing/examples/webgl_loader_amf.ts create mode 100644 examples-testing/examples/webgl_loader_bvh.ts create mode 100644 examples-testing/examples/webgl_loader_collada.ts create mode 100644 examples-testing/examples/webgl_loader_collada_skinning.ts create mode 100644 examples-testing/examples/webgl_loader_draco.ts create mode 100644 examples-testing/examples/webgl_loader_fbx.ts create mode 100644 examples-testing/examples/webgl_loader_fbx_nurbs.ts create mode 100644 examples-testing/examples/webgl_loader_gcode.ts create mode 100644 examples-testing/examples/webgl_loader_gltf.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_animation_pointer.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_anisotropy.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_avif.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_compressed.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_dispersion.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_instancing.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_iridescence.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_progressive_lod.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_sheen.ts create mode 100644 examples-testing/examples/webgl_loader_gltf_transmission.ts create mode 100644 examples-testing/examples/webgl_loader_imagebitmap.ts create mode 100644 examples-testing/examples/webgl_loader_kmz.ts create mode 100644 examples-testing/examples/webgl_loader_md2_control.ts create mode 100644 examples-testing/examples/webgl_loader_mdd.ts create mode 100644 examples-testing/examples/webgl_loader_obj.ts create mode 100644 examples-testing/examples/webgl_loader_pcd.ts create mode 100644 examples-testing/examples/webgl_loader_pdb.ts create mode 100644 examples-testing/examples/webgl_loader_ply.ts create mode 100644 examples-testing/examples/webgl_loader_svg.ts create mode 100644 examples-testing/examples/webgl_loader_texture_dds.ts create mode 100644 examples-testing/examples/webgl_loader_texture_ktx.ts create mode 100644 examples-testing/examples/webgl_loader_texture_tga.ts create mode 100644 examples-testing/examples/webgl_loader_texture_tiff.ts create mode 100644 examples-testing/examples/webgl_loader_texture_ultrahdr.ts create mode 100644 examples-testing/examples/webgl_loader_ttf.ts create mode 100644 examples-testing/examples/webgl_loader_usdz.ts create mode 100644 examples-testing/examples/webgl_loader_vox.ts create mode 100644 examples-testing/examples/webgl_loader_vrml.ts create mode 100644 examples-testing/examples/webgl_loader_xyz.ts create mode 100644 examples-testing/examples/webgl_lod.ts create mode 100644 examples-testing/examples/webgl_marchingcubes.ts create mode 100644 examples-testing/examples/webgl_materials_alphahash.ts create mode 100644 examples-testing/examples/webgl_materials_blending.ts create mode 100644 examples-testing/examples/webgl_materials_blending_custom.ts create mode 100644 examples-testing/examples/webgl_materials_bumpmap.ts create mode 100644 examples-testing/examples/webgl_materials_car.ts create mode 100644 examples-testing/examples/webgl_materials_cubemap.ts create mode 100644 examples-testing/examples/webgl_materials_cubemap_dynamic.ts create mode 100644 examples-testing/examples/webgl_materials_cubemap_mipmaps.ts create mode 100644 examples-testing/examples/webgl_materials_cubemap_refraction.ts create mode 100644 examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts create mode 100644 examples-testing/examples/webgl_materials_displacementmap.ts create mode 100644 examples-testing/examples/webgl_materials_envmaps.ts create mode 100644 examples-testing/examples/webgl_materials_envmaps_exr.ts create mode 100644 examples-testing/examples/webgl_materials_envmaps_fasthdr.ts create mode 100644 examples-testing/examples/webgl_materials_envmaps_groundprojected.ts create mode 100644 examples-testing/examples/webgl_materials_envmaps_hdr.ts create mode 100644 examples-testing/examples/webgl_materials_modified.ts create mode 100644 examples-testing/examples/webgl_materials_normalmap_object_space.ts create mode 100644 examples-testing/examples/webgl_materials_physical_clearcoat.ts create mode 100644 examples-testing/examples/webgl_materials_physical_transmission.ts create mode 100644 examples-testing/examples/webgl_materials_physical_transmission_alpha.ts create mode 100644 examples-testing/examples/webgl_materials_texture_anisotropy.ts create mode 100644 examples-testing/examples/webgl_materials_texture_canvas.ts create mode 100644 examples-testing/examples/webgl_materials_texture_filters.ts create mode 100644 examples-testing/examples/webgl_materials_texture_html.ts create mode 100644 examples-testing/examples/webgl_materials_texture_manualmipmap.ts create mode 100644 examples-testing/examples/webgl_materials_texture_partialupdate.ts create mode 100644 examples-testing/examples/webgl_materials_texture_rotation.ts create mode 100644 examples-testing/examples/webgl_materials_toon.ts create mode 100644 examples-testing/examples/webgl_materials_video.ts create mode 100644 examples-testing/examples/webgl_materials_video_webcam.ts create mode 100644 examples-testing/examples/webgl_materials_wireframe.ts create mode 100644 examples-testing/examples/webgl_math_obb.ts create mode 100644 examples-testing/examples/webgl_math_orientation_transform.ts create mode 100644 examples-testing/examples/webgl_mesh_batch.ts create mode 100644 examples-testing/examples/webgl_mirror.ts create mode 100644 examples-testing/examples/webgl_modifier_edgesplit.ts create mode 100644 examples-testing/examples/webgl_modifier_simplifier.ts create mode 100644 examples-testing/examples/webgl_modifier_tessellation.ts create mode 100644 examples-testing/examples/webgl_morphtargets.ts create mode 100644 examples-testing/examples/webgl_morphtargets_face.ts create mode 100644 examples-testing/examples/webgl_morphtargets_horse.ts create mode 100644 examples-testing/examples/webgl_morphtargets_sphere.ts create mode 100644 examples-testing/examples/webgl_multiple_elements.ts create mode 100644 examples-testing/examples/webgl_multiple_rendertargets.ts create mode 100644 examples-testing/examples/webgl_multiple_scenes_comparison.ts create mode 100644 examples-testing/examples/webgl_multiple_views.ts create mode 100644 examples-testing/examples/webgl_multisampled_renderbuffers.ts create mode 100644 examples-testing/examples/webgl_panorama_cube.ts create mode 100644 examples-testing/examples/webgl_panorama_equirectangular.ts create mode 100644 examples-testing/examples/webgl_performance.ts create mode 100644 examples-testing/examples/webgl_pmrem_cubemap.ts create mode 100644 examples-testing/examples/webgl_pmrem_equirectangular.ts create mode 100644 examples-testing/examples/webgl_pmrem_test.ts create mode 100644 examples-testing/examples/webgl_points_billboards.ts create mode 100644 examples-testing/examples/webgl_points_sprites.ts create mode 100644 examples-testing/examples/webgl_points_waves.ts create mode 100644 examples-testing/examples/webgl_portal.ts create mode 100644 examples-testing/examples/webgl_postprocessing.ts create mode 100644 examples-testing/examples/webgl_postprocessing_advanced.ts create mode 100644 examples-testing/examples/webgl_postprocessing_afterimage.ts create mode 100644 examples-testing/examples/webgl_postprocessing_backgrounds.ts create mode 100644 examples-testing/examples/webgl_postprocessing_fxaa.ts create mode 100644 examples-testing/examples/webgl_postprocessing_glitch.ts create mode 100644 examples-testing/examples/webgl_postprocessing_godrays.ts create mode 100644 examples-testing/examples/webgl_postprocessing_gtao.ts create mode 100644 examples-testing/examples/webgl_postprocessing_masking.ts create mode 100644 examples-testing/examples/webgl_postprocessing_outline.ts create mode 100644 examples-testing/examples/webgl_postprocessing_pixel.ts create mode 100644 examples-testing/examples/webgl_postprocessing_procedural.ts create mode 100644 examples-testing/examples/webgl_postprocessing_rgb_halftone.ts create mode 100644 examples-testing/examples/webgl_postprocessing_sao.ts create mode 100644 examples-testing/examples/webgl_postprocessing_smaa.ts create mode 100644 examples-testing/examples/webgl_postprocessing_sobel.ts create mode 100644 examples-testing/examples/webgl_postprocessing_ssaa.ts create mode 100644 examples-testing/examples/webgl_postprocessing_ssao.ts create mode 100644 examples-testing/examples/webgl_postprocessing_ssr.ts create mode 100644 examples-testing/examples/webgl_postprocessing_taa.ts create mode 100644 examples-testing/examples/webgl_postprocessing_transition.ts create mode 100644 examples-testing/examples/webgl_postprocessing_unreal_bloom.ts create mode 100644 examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts create mode 100644 examples-testing/examples/webgl_random_uv.ts create mode 100644 examples-testing/examples/webgl_raycaster_sprite.ts create mode 100644 examples-testing/examples/webgl_raycaster_texture.ts create mode 100644 examples-testing/examples/webgl_read_float_buffer.ts create mode 100644 examples-testing/examples/webgl_refraction.ts create mode 100644 examples-testing/examples/webgl_rtt.ts create mode 100644 examples-testing/examples/webgl_shader.ts create mode 100644 examples-testing/examples/webgl_shader_lava.ts create mode 100644 examples-testing/examples/webgl_shaders_ocean.ts create mode 100644 examples-testing/examples/webgl_shaders_sky.ts create mode 100644 examples-testing/examples/webgl_shadow_contact.ts create mode 100644 examples-testing/examples/webgl_shadowmap.ts create mode 100644 examples-testing/examples/webgl_shadowmap_csm.ts create mode 100644 examples-testing/examples/webgl_shadowmap_pcss.ts create mode 100644 examples-testing/examples/webgl_shadowmap_performance.ts create mode 100644 examples-testing/examples/webgl_shadowmap_pointlight.ts create mode 100644 examples-testing/examples/webgl_shadowmap_progressive.ts create mode 100644 examples-testing/examples/webgl_shadowmap_viewer.ts create mode 100644 examples-testing/examples/webgl_shadowmap_vsm.ts create mode 100644 examples-testing/examples/webgl_shadowmesh.ts create mode 100644 examples-testing/examples/webgl_simple_gi.ts create mode 100644 examples-testing/examples/webgl_sprites.ts create mode 100644 examples-testing/examples/webgl_test_memory.ts create mode 100644 examples-testing/examples/webgl_test_memory2.ts create mode 100644 examples-testing/examples/webgl_test_wide_gamut.ts create mode 100644 examples-testing/examples/webgl_texture2darray_compressed.ts create mode 100644 examples-testing/examples/webgl_texture2darray_layerupdate.ts create mode 100644 examples-testing/examples/webgl_texture3d.ts create mode 100644 examples-testing/examples/webgl_texture3d_partialupdate.ts create mode 100644 examples-testing/examples/webgl_tonemapping.ts create mode 100644 examples-testing/examples/webgl_tsl_clearcoat.ts create mode 100644 examples-testing/examples/webgl_tsl_instancing.ts create mode 100644 examples-testing/examples/webgl_tsl_shadowmap.ts create mode 100644 examples-testing/examples/webgl_tsl_skinning.ts create mode 100644 examples-testing/examples/webgl_ubo.ts create mode 100644 examples-testing/examples/webgl_ubo_arrays.ts create mode 100644 examples-testing/examples/webgl_video_kinect.ts create mode 100644 examples-testing/examples/webgl_video_panorama_equirectangular.ts create mode 100644 examples-testing/examples/webgl_volume_cloud.ts create mode 100644 examples-testing/examples/webgl_volume_instancing.ts create mode 100644 examples-testing/examples/webgl_volume_perlin.ts create mode 100644 examples-testing/examples/webgl_watch.ts create mode 100644 examples-testing/examples/webgpu_animation_retargeting.ts create mode 100644 examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts create mode 100644 examples-testing/examples/webgpu_backdrop.ts create mode 100644 examples-testing/examples/webgpu_backdrop_area.ts create mode 100644 examples-testing/examples/webgpu_backdrop_water.ts create mode 100644 examples-testing/examples/webgpu_camera.ts create mode 100644 examples-testing/examples/webgpu_camera_array.ts create mode 100644 examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts create mode 100644 examples-testing/examples/webgpu_caustics.ts create mode 100644 examples-testing/examples/webgpu_centroid_sampling.ts create mode 100644 examples-testing/examples/webgpu_clearcoat.ts create mode 100644 examples-testing/examples/webgpu_clipping.ts create mode 100644 examples-testing/examples/webgpu_clipping_stencil.ts create mode 100644 examples-testing/examples/webgpu_compile_async.ts create mode 100644 examples-testing/examples/webgpu_compute_audio.ts create mode 100644 examples-testing/examples/webgpu_compute_birds.ts create mode 100644 examples-testing/examples/webgpu_compute_cloth.ts create mode 100644 examples-testing/examples/webgpu_compute_geometry.ts create mode 100644 examples-testing/examples/webgpu_compute_particles.ts create mode 100644 examples-testing/examples/webgpu_compute_particles_rain.ts create mode 100644 examples-testing/examples/webgpu_compute_particles_snow.ts create mode 100644 examples-testing/examples/webgpu_compute_points.ts create mode 100644 examples-testing/examples/webgpu_compute_sort_bitonic.ts create mode 100644 examples-testing/examples/webgpu_compute_texture.ts create mode 100644 examples-testing/examples/webgpu_compute_texture_3d.ts create mode 100644 examples-testing/examples/webgpu_compute_texture_pingpong.ts create mode 100644 examples-testing/examples/webgpu_cubemap_adjustments.ts create mode 100644 examples-testing/examples/webgpu_cubemap_dynamic.ts create mode 100644 examples-testing/examples/webgpu_cubemap_mix.ts create mode 100644 examples-testing/examples/webgpu_custom_fog.ts create mode 100644 examples-testing/examples/webgpu_custom_fog_background.ts create mode 100644 examples-testing/examples/webgpu_custom_fog_scattering.ts create mode 100644 examples-testing/examples/webgpu_deferred.ts create mode 100644 examples-testing/examples/webgpu_depth_texture.ts create mode 100644 examples-testing/examples/webgpu_display_stereo.ts create mode 100644 examples-testing/examples/webgpu_equirectangular.ts create mode 100644 examples-testing/examples/webgpu_fog_height.ts create mode 100644 examples-testing/examples/webgpu_furnace_test.ts create mode 100644 examples-testing/examples/webgpu_gaussian_splat.ts create mode 100644 examples-testing/examples/webgpu_generator_building.ts create mode 100644 examples-testing/examples/webgpu_generator_city.ts create mode 100644 examples-testing/examples/webgpu_geometry_loft.ts create mode 100644 examples-testing/examples/webgpu_hdr.ts create mode 100644 examples-testing/examples/webgpu_instance_mesh.ts create mode 100644 examples-testing/examples/webgpu_instance_path.ts create mode 100644 examples-testing/examples/webgpu_instance_points.ts create mode 100644 examples-testing/examples/webgpu_instancing_morph.ts create mode 100644 examples-testing/examples/webgpu_layers.ts create mode 100644 examples-testing/examples/webgpu_lensflares.ts create mode 100644 examples-testing/examples/webgpu_lightprobe.ts create mode 100644 examples-testing/examples/webgpu_lightprobe_cubecamera.ts create mode 100644 examples-testing/examples/webgpu_lightprobes.ts create mode 100644 examples-testing/examples/webgpu_lightprobes_complex.ts create mode 100644 examples-testing/examples/webgpu_lightprobes_sponza.ts create mode 100644 examples-testing/examples/webgpu_lights_clustered.ts create mode 100644 examples-testing/examples/webgpu_lights_dynamic.ts create mode 100644 examples-testing/examples/webgpu_lights_ies_spotlight.ts create mode 100644 examples-testing/examples/webgpu_lights_phong.ts create mode 100644 examples-testing/examples/webgpu_lights_physical.ts create mode 100644 examples-testing/examples/webgpu_lights_pointlights.ts create mode 100644 examples-testing/examples/webgpu_lights_rectarealight.ts create mode 100644 examples-testing/examples/webgpu_lights_selective.ts create mode 100644 examples-testing/examples/webgpu_lights_spotlight.ts create mode 100644 examples-testing/examples/webgpu_lines_fat.ts create mode 100644 examples-testing/examples/webgpu_lines_fat_raycasting.ts create mode 100644 examples-testing/examples/webgpu_lines_fat_wireframe.ts create mode 100644 examples-testing/examples/webgpu_loader_gltf.ts create mode 100644 examples-testing/examples/webgpu_loader_gltf_anisotropy.ts create mode 100644 examples-testing/examples/webgpu_loader_gltf_compressed.ts create mode 100644 examples-testing/examples/webgpu_loader_gltf_dispersion.ts create mode 100644 examples-testing/examples/webgpu_loader_gltf_iridescence.ts create mode 100644 examples-testing/examples/webgpu_loader_gltf_sheen.ts create mode 100644 examples-testing/examples/webgpu_loader_gltf_transmission.ts create mode 100644 examples-testing/examples/webgpu_loader_materialx.ts create mode 100644 examples-testing/examples/webgpu_loader_texture_ktx2.ts create mode 100644 examples-testing/examples/webgpu_materials_alphahash.ts create mode 100644 examples-testing/examples/webgpu_materials_arrays.ts create mode 100644 examples-testing/examples/webgpu_materials_basic.ts create mode 100644 examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts create mode 100644 examples-testing/examples/webgpu_materials_displacementmap.ts create mode 100644 examples-testing/examples/webgpu_materials_envmaps.ts create mode 100644 examples-testing/examples/webgpu_materials_envmaps_bpcem.ts create mode 100644 examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts create mode 100644 examples-testing/examples/webgpu_materials_lightmap.ts create mode 100644 examples-testing/examples/webgpu_materials_matcap.ts create mode 100644 examples-testing/examples/webgpu_materials_retroreflection.ts create mode 100644 examples-testing/examples/webgpu_materials_sss.ts create mode 100644 examples-testing/examples/webgpu_materials_texture_html.ts create mode 100644 examples-testing/examples/webgpu_materials_texture_manualmipmap.ts create mode 100644 examples-testing/examples/webgpu_materials_toon.ts create mode 100644 examples-testing/examples/webgpu_materials_transmission.ts create mode 100644 examples-testing/examples/webgpu_materials_video.ts create mode 100644 examples-testing/examples/webgpu_materialx_noise.ts create mode 100644 examples-testing/examples/webgpu_mesh_batch.ts create mode 100644 examples-testing/examples/webgpu_mirror.ts create mode 100644 examples-testing/examples/webgpu_modifier_curve.ts create mode 100644 examples-testing/examples/webgpu_morphtargets.ts create mode 100644 examples-testing/examples/webgpu_morphtargets_face.ts create mode 100644 examples-testing/examples/webgpu_mrt.ts create mode 100644 examples-testing/examples/webgpu_mrt_mask.ts create mode 100644 examples-testing/examples/webgpu_multiple_canvas.ts create mode 100644 examples-testing/examples/webgpu_multiple_elements.ts create mode 100644 examples-testing/examples/webgpu_multiple_rendertargets.ts create mode 100644 examples-testing/examples/webgpu_multiple_rendertargets_readback.ts create mode 100644 examples-testing/examples/webgpu_multisampled_renderbuffers.ts create mode 100644 examples-testing/examples/webgpu_occlusion.ts create mode 100644 examples-testing/examples/webgpu_ocean.ts create mode 100644 examples-testing/examples/webgpu_oit.ts create mode 100644 examples-testing/examples/webgpu_parallax_uv.ts create mode 100644 examples-testing/examples/webgpu_particles.ts create mode 100644 examples-testing/examples/webgpu_particles_soft.ts create mode 100644 examples-testing/examples/webgpu_performance.ts create mode 100644 examples-testing/examples/webgpu_performance_renderbundle.ts create mode 100644 examples-testing/examples/webgpu_pmrem_cubemap.ts create mode 100644 examples-testing/examples/webgpu_pmrem_equirectangular.ts create mode 100644 examples-testing/examples/webgpu_pmrem_scene.ts create mode 100644 examples-testing/examples/webgpu_pmrem_test.ts create mode 100644 examples-testing/examples/webgpu_portal.ts create mode 100644 examples-testing/examples/webgpu_postprocessing.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_3dlut.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_afterimage.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_anamorphic.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_ao.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_bloom.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_bloom_selective.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_ca.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_difference.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_direct.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_dof.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_dof_basic.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_fxaa.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_godrays.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_lensflare.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_masking.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_motion_blur.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_outline.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_pixel.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_radial_blur.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_retro.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_smaa.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_sobel.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_ssaa.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_ssgi.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_ssr.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_sss.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_traa.ts create mode 100644 examples-testing/examples/webgpu_postprocessing_transition.ts create mode 100644 examples-testing/examples/webgpu_procedural_texture.ts create mode 100644 examples-testing/examples/webgpu_reflection.ts create mode 100644 examples-testing/examples/webgpu_reflection_roughness.ts create mode 100644 examples-testing/examples/webgpu_refraction.ts create mode 100644 examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts create mode 100644 examples-testing/examples/webgpu_reversed_depth_buffer.ts create mode 100644 examples-testing/examples/webgpu_rtt.ts create mode 100644 examples-testing/examples/webgpu_shadow_contact.ts create mode 100644 examples-testing/examples/webgpu_shadowmap.ts create mode 100644 examples-testing/examples/webgpu_shadowmap_array.ts create mode 100644 examples-testing/examples/webgpu_shadowmap_csm.ts create mode 100644 examples-testing/examples/webgpu_shadowmap_opacity.ts create mode 100644 examples-testing/examples/webgpu_shadowmap_pointlight.ts create mode 100644 examples-testing/examples/webgpu_shadowmap_progressive.ts create mode 100644 examples-testing/examples/webgpu_shadowmap_vsm.ts create mode 100644 examples-testing/examples/webgpu_skinning.ts create mode 100644 examples-testing/examples/webgpu_skinning_instancing.ts create mode 100644 examples-testing/examples/webgpu_skinning_instancing_individual.ts create mode 100644 examples-testing/examples/webgpu_sprites.ts create mode 100644 examples-testing/examples/webgpu_storage_buffer.ts create mode 100644 examples-testing/examples/webgpu_struct_drawindirect.ts create mode 100644 examples-testing/examples/webgpu_test_memory.ts create mode 100644 examples-testing/examples/webgpu_texturegather.ts create mode 100644 examples-testing/examples/webgpu_texturegrad.ts create mode 100644 examples-testing/examples/webgpu_textures_2d-array.ts create mode 100644 examples-testing/examples/webgpu_textures_2d-array_compressed.ts create mode 100644 examples-testing/examples/webgpu_textures_anisotropy.ts create mode 100644 examples-testing/examples/webgpu_textures_partialupdate.ts create mode 100644 examples-testing/examples/webgpu_tonemapping.ts create mode 100644 examples-testing/examples/webgpu_tsl_angular_slicing.ts create mode 100644 examples-testing/examples/webgpu_tsl_earth.ts create mode 100644 examples-testing/examples/webgpu_tsl_galaxy.ts create mode 100644 examples-testing/examples/webgpu_tsl_graph.ts create mode 100644 examples-testing/examples/webgpu_tsl_halftone.ts create mode 100644 examples-testing/examples/webgpu_tsl_interoperability.ts create mode 100644 examples-testing/examples/webgpu_tsl_procedural_terrain.ts create mode 100644 examples-testing/examples/webgpu_tsl_raging_sea.ts create mode 100644 examples-testing/examples/webgpu_tsl_vfx_flames.ts create mode 100644 examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts create mode 100644 examples-testing/examples/webgpu_tsl_vfx_tornado.ts create mode 100644 examples-testing/examples/webgpu_tsl_wood.ts create mode 100644 examples-testing/examples/webgpu_upscaling_fsr1.ts create mode 100644 examples-testing/examples/webgpu_upscaling_taau.ts create mode 100644 examples-testing/examples/webgpu_video_panorama.ts create mode 100644 examples-testing/examples/webgpu_volume_caustics.ts create mode 100644 examples-testing/examples/webgpu_volume_cloud.ts create mode 100644 examples-testing/examples/webgpu_volume_lighting.ts create mode 100644 examples-testing/examples/webgpu_volume_lighting_rectarea.ts create mode 100644 examples-testing/examples/webgpu_volume_lighting_traa.ts create mode 100644 examples-testing/examples/webgpu_volume_perlin.ts create mode 100644 examples-testing/examples/webgpu_water.ts create mode 100644 examples-testing/examples/webgpu_xr_cubes.ts create mode 100644 examples-testing/examples/webgpu_xr_native_layers.ts create mode 100644 examples-testing/examples/webgpu_xr_rollercoaster.ts create mode 100644 examples-testing/examples/webgpu_xr_shadows.ts create mode 100644 examples-testing/examples/webxr_ar_cones.ts create mode 100644 examples-testing/examples/webxr_ar_hittest.ts create mode 100644 examples-testing/examples/webxr_ar_lighting.ts create mode 100644 examples-testing/examples/webxr_ar_plane_detection.ts create mode 100644 examples-testing/examples/webxr_vr_handinput.ts create mode 100644 examples-testing/examples/webxr_vr_panorama.ts create mode 100644 examples-testing/examples/webxr_vr_panorama_depth.ts create mode 100644 examples-testing/examples/webxr_vr_rollercoaster.ts create mode 100644 examples-testing/examples/webxr_vr_sandbox.ts create mode 100644 examples-testing/examples/webxr_vr_video.ts create mode 100644 examples-testing/examples/webxr_xr_controls_transform.ts create mode 100644 examples-testing/examples/webxr_xr_dragging_custom_depth.ts diff --git a/examples-testing/examples/css2d_label.ts b/examples-testing/examples/css2d_label.ts new file mode 100644 index 000000000..1b2889980 --- /dev/null +++ b/examples-testing/examples/css2d_label.ts @@ -0,0 +1,189 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let gui; + +let camera, scene, renderer, labelRenderer; + +const layers = { + 'Toggle Name': function () { + camera.layers.toggle(0); + }, + 'Toggle Mass': function () { + camera.layers.toggle(1); + }, + 'Enable All': function () { + camera.layers.enableAll(); + }, + + 'Disable All': function () { + camera.layers.disableAll(); + }, +}; + +const timer = new THREE.Timer(); +timer.connect(document); +const textureLoader = new THREE.TextureLoader(); + +let moon; + +init(); +animate(); + +function init() { + const EARTH_RADIUS = 1; + const MOON_RADIUS = 0.27; + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); + camera.position.set(10, 5, 20); + camera.layers.enableAll(); + + scene = new THREE.Scene(); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(0, 0, 1); + dirLight.layers.enableAll(); + scene.add(dirLight); + + const axesHelper = new THREE.AxesHelper(5); + axesHelper.layers.enableAll(); + scene.add(axesHelper); + + // + + const earthGeometry = new THREE.SphereGeometry(EARTH_RADIUS, 16, 16); + const earthMaterial = new THREE.MeshPhongMaterial({ + specular: 0x333333, + shininess: 5, + map: textureLoader.load('textures/planets/earth_atmos_2048.jpg'), + specularMap: textureLoader.load('textures/planets/earth_specular_2048.jpg'), + normalMap: textureLoader.load('textures/planets/earth_normal_2048.jpg'), + normalScale: new THREE.Vector2(0.85, 0.85), + }); + earthMaterial.map.colorSpace = THREE.SRGBColorSpace; + const earth = new THREE.Mesh(earthGeometry, earthMaterial); + scene.add(earth); + + const moonGeometry = new THREE.SphereGeometry(MOON_RADIUS, 16, 16); + const moonMaterial = new THREE.MeshPhongMaterial({ + shininess: 5, + map: textureLoader.load('textures/planets/moon_1024.jpg'), + }); + moonMaterial.map.colorSpace = THREE.SRGBColorSpace; + moon = new THREE.Mesh(moonGeometry, moonMaterial); + scene.add(moon); + + // + + earth.layers.enableAll(); + moon.layers.enableAll(); + + const earthDiv = document.createElement('div'); + earthDiv.className = 'label'; + earthDiv.textContent = 'Earth'; + earthDiv.style.backgroundColor = 'transparent'; + + const earthLabel = new CSS2DObject(earthDiv); + earthLabel.position.set(1.5 * EARTH_RADIUS, 0, 0); + earthLabel.center.set(0, 1); + earth.add(earthLabel); + earthLabel.layers.set(0); + + const earthMassDiv = document.createElement('div'); + earthMassDiv.className = 'label'; + earthMassDiv.textContent = '5.97237e24 kg'; + earthMassDiv.style.backgroundColor = 'transparent'; + + const earthMassLabel = new CSS2DObject(earthMassDiv); + earthMassLabel.position.set(1.5 * EARTH_RADIUS, 0, 0); + earthMassLabel.center.set(0, 0); + earth.add(earthMassLabel); + earthMassLabel.layers.set(1); + + const moonDiv = document.createElement('div'); + moonDiv.className = 'label'; + moonDiv.textContent = 'Moon'; + moonDiv.style.backgroundColor = 'transparent'; + + const moonLabel = new CSS2DObject(moonDiv); + moonLabel.position.set(1.5 * MOON_RADIUS, 0, 0); + moonLabel.center.set(0, 1); + moon.add(moonLabel); + moonLabel.layers.set(0); + + const moonMassDiv = document.createElement('div'); + moonMassDiv.className = 'label'; + moonMassDiv.textContent = '7.342e22 kg'; + moonMassDiv.style.backgroundColor = 'transparent'; + + const moonMassLabel = new CSS2DObject(moonMassDiv); + moonMassLabel.position.set(1.5 * MOON_RADIUS, 0, 0); + moonMassLabel.center.set(0, 0); + moon.add(moonMassLabel); + moonMassLabel.layers.set(1); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + labelRenderer = new CSS2DRenderer(); + labelRenderer.setSize(window.innerWidth, window.innerHeight); + labelRenderer.domElement.style.position = 'absolute'; + labelRenderer.domElement.style.top = '0px'; + document.body.appendChild(labelRenderer.domElement); + + const controls = new OrbitControls(camera, labelRenderer.domElement); + controls.minDistance = 5; + controls.maxDistance = 100; + + // + + window.addEventListener('resize', onWindowResize); + + initGui(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + labelRenderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + requestAnimationFrame(animate); + + const elapsed = timer.getElapsed(); + + moon.position.set(Math.sin(elapsed) * 5, 0, Math.cos(elapsed) * 5); + + renderer.render(scene, camera); + labelRenderer.render(scene, camera); +} + +// + +function initGui() { + gui = new GUI(); + + gui.title('Camera Layers'); + + gui.add(layers, 'Toggle Name'); + gui.add(layers, 'Toggle Mass'); + gui.add(layers, 'Enable All'); + gui.add(layers, 'Disable All'); + + gui.open(); +} diff --git a/examples-testing/examples/css3d_mixed.ts b/examples-testing/examples/css3d_mixed.ts new file mode 100644 index 000000000..b526e73e5 --- /dev/null +++ b/examples-testing/examples/css3d_mixed.ts @@ -0,0 +1,138 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; + +let camera, scene, rendererCSS3D, rendererWebGL; +let controls; + +init(); + +function init() { + const controlsDomElement = document.createElement('div'); + controlsDomElement.style.position = 'absolute'; + controlsDomElement.style.top = '0'; + controlsDomElement.style.width = '100%'; + controlsDomElement.style.height = '100%'; + document.body.appendChild(controlsDomElement); + + rendererCSS3D = new CSS3DRenderer(); + rendererCSS3D.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(rendererCSS3D.domElement); + + rendererWebGL = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + rendererWebGL.domElement.style.position = 'absolute'; + rendererWebGL.domElement.style.top = '0'; + rendererWebGL.domElement.style.pointerEvents = 'none'; + rendererWebGL.setPixelRatio(window.devicePixelRatio); + rendererWebGL.setSize(window.innerWidth, window.innerHeight); + rendererWebGL.toneMapping = THREE.NeutralToneMapping; + rendererWebGL.setAnimationLoop(animate); + document.body.appendChild(rendererWebGL.domElement); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(-1000, 500, 1500); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + // Add room + const roomGeometry = new THREE.EdgesGeometry(new THREE.BoxGeometry(4000, 2000, 4000, 10, 5, 10)); + const roomMaterial = new THREE.LineBasicMaterial({ color: 0x000000, opacity: 0.2, transparent: true }); + const room = new THREE.LineSegments(roomGeometry, roomMaterial); + scene.add(room); + + // Add light + const hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 4); + hemisphereLight.position.set(-25, 100, 50); + scene.add(hemisphereLight); + + // Add cutout mesh + const geometry = new THREE.PlaneGeometry(1024, 768); + const material = new THREE.MeshBasicMaterial({ + color: 0xff0000, + blending: THREE.NoBlending, + opacity: 0, + premultipliedAlpha: true, + }); + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // Add frame + const frame = buildFrame(1024, 768, 50); + scene.add(frame); + + // Add CSS3D element + const iframe = document.createElement('iframe'); + iframe.style.width = '1028px'; + iframe.style.height = '768px'; + iframe.style.border = '0px'; + iframe.style.backfaceVisibility = 'hidden'; + iframe.src = './#webgl_animation_keyframes'; + scene.add(new CSS3DObject(iframe)); + + // Add controls + controls = new OrbitControls(camera); + controls.connect(controlsDomElement); + controls.addEventListener('start', () => (iframe.style.pointerEvents = 'none')); + controls.addEventListener('end', () => (iframe.style.pointerEvents = 'auto')); + controls.enableDamping = true; + + window.addEventListener('resize', onWindowResize); +} + +function buildFrame(width, height, thickness) { + const group = new THREE.Group(); + const material = new THREE.MeshStandardMaterial({ color: 0x2200ff }); + + // Create the frame border + const outerShape = new THREE.Shape(); + outerShape.moveTo(-(width / 2 + thickness), -(height / 2 + thickness)); + outerShape.lineTo(width / 2 + thickness, -(height / 2 + thickness)); + outerShape.lineTo(width / 2 + thickness, height / 2 + thickness); + outerShape.lineTo(-(width / 2 + thickness), height / 2 + thickness); + outerShape.lineTo(-(width / 2 + thickness), -(height / 2 + thickness)); + + // Create inner rectangle (hole) + const innerHole = new THREE.Path(); + innerHole.moveTo(-width / 2, -height / 2); + innerHole.lineTo(width / 2, -height / 2); + innerHole.lineTo(width / 2, height / 2); + innerHole.lineTo(-width / 2, height / 2); + innerHole.lineTo(-width / 2, -height / 2); + + outerShape.holes.push(innerHole); + + const frameGeometry = new THREE.ExtrudeGeometry(outerShape, { + depth: thickness, + bevelEnabled: false, + }); + + const frameMesh = new THREE.Mesh(frameGeometry, material); + frameMesh.position.z = -thickness / 2; + group.add(frameMesh); + + // Add back plane + const backGeometry = new THREE.PlaneGeometry(width + thickness * 2, height + thickness * 2); + const backMesh = new THREE.Mesh(backGeometry, material); + backMesh.position.set(0, 0, -thickness / 2); + backMesh.rotation.y = Math.PI; + group.add(backMesh); + + return group; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + rendererWebGL.setSize(window.innerWidth, window.innerHeight); + rendererCSS3D.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + rendererWebGL.render(scene, camera); + rendererCSS3D.render(scene, camera); +} diff --git a/examples-testing/examples/css3d_molecules.ts b/examples-testing/examples/css3d_molecules.ts new file mode 100644 index 000000000..538472607 --- /dev/null +++ b/examples-testing/examples/css3d_molecules.ts @@ -0,0 +1,353 @@ +import * as THREE from 'three'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; +import { CSS3DRenderer, CSS3DObject, CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer; +let controls; +let root; + +const objects = []; +const tmpVec1 = new THREE.Vector3(); +const tmpVec2 = new THREE.Vector3(); +const tmpVec3 = new THREE.Vector3(); +const tmpVec4 = new THREE.Vector3(); +const offset = new THREE.Vector3(); + +const VIZ_TYPE = { + Atoms: 0, + Bonds: 1, + 'Atoms + Bonds': 2, +}; + +const MOLECULES = { + Ethanol: 'ethanol.pdb', + Aspirin: 'aspirin.pdb', + Caffeine: 'caffeine.pdb', + Nicotine: 'nicotine.pdb', + LSD: 'lsd.pdb', + Cocaine: 'cocaine.pdb', + Cholesterol: 'cholesterol.pdb', + Lycopene: 'lycopene.pdb', + Glucose: 'glucose.pdb', + 'Aluminium oxide': 'Al2O3.pdb', + Cubane: 'cubane.pdb', + Copper: 'cu.pdb', + Fluorite: 'caf2.pdb', + Salt: 'nacl.pdb', + 'YBCO superconductor': 'ybco.pdb', + Buckyball: 'buckyball.pdb', + // 'Diamond': 'diamond.pdb', + Graphite: 'graphite.pdb', +}; + +const params = { + vizType: 2, + molecule: 'caffeine.pdb', +}; + +const loader = new PDBLoader(); +const colorSpriteMap = {}; +const baseSprite = document.createElement('img'); + +init(); +animate(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + + root = new THREE.Object3D(); + scene.add(root); + + // + + renderer = new CSS3DRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + document.getElementById('container').appendChild(renderer.domElement); + + // + + controls = new TrackballControls(camera, renderer.domElement); + controls.rotateSpeed = 0.5; + + // + + baseSprite.onload = function () { + loadMolecule(params.molecule); + }; + + baseSprite.src = 'textures/sprites/ball.png'; + + // + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + + gui.add(params, 'vizType', VIZ_TYPE).onChange(changeVizType); + gui.add(params, 'molecule', MOLECULES).onChange(loadMolecule); + gui.open(); +} + +function changeVizType(value) { + if (value === 0) showAtoms(); + else if (value === 1) showBonds(); + else showAtomsBonds(); +} + +// + +function showAtoms() { + for (let i = 0; i < objects.length; i++) { + const object = objects[i]; + + if (object instanceof CSS3DSprite) { + object.element.style.display = ''; + object.visible = true; + } else { + object.element.style.display = 'none'; + object.visible = false; + } + } +} + +function showBonds() { + for (let i = 0; i < objects.length; i++) { + const object = objects[i]; + + if (object instanceof CSS3DSprite) { + object.element.style.display = 'none'; + object.visible = false; + } else { + object.element.style.display = ''; + object.element.style.height = object.userData.bondLengthFull; + object.visible = true; + } + } +} + +function showAtomsBonds() { + for (let i = 0; i < objects.length; i++) { + const object = objects[i]; + + object.element.style.display = ''; + object.visible = true; + + if (!(object instanceof CSS3DSprite)) { + object.element.style.height = object.userData.bondLengthShort; + } + } +} + +// + +function colorify(ctx, width, height, color) { + const r = color.r, + g = color.g, + b = color.b; + + const imageData = ctx.getImageData(0, 0, width, height); + const data = imageData.data; + + for (let i = 0, l = data.length; i < l; i += 4) { + data[i + 0] *= r; + data[i + 1] *= g; + data[i + 2] *= b; + } + + ctx.putImageData(imageData, 0, 0); +} + +function imageToCanvas(image) { + const width = image.width; + const height = image.height; + + const canvas = document.createElement('canvas'); + + canvas.width = width; + canvas.height = height; + + const context = canvas.getContext('2d'); + context.drawImage(image, 0, 0, width, height); + + return canvas; +} + +// + +function loadMolecule(model) { + const url = 'models/pdb/' + model; + + for (let i = 0; i < objects.length; i++) { + const object = objects[i]; + object.parent.remove(object); + } + + objects.length = 0; + + loader.load(url, function (pdb) { + const geometryAtoms = pdb.geometryAtoms; + const geometryBonds = pdb.geometryBonds; + const json = pdb.json; + + geometryAtoms.computeBoundingBox(); + geometryAtoms.boundingBox.getCenter(offset).negate(); + + geometryAtoms.translate(offset.x, offset.y, offset.z); + geometryBonds.translate(offset.x, offset.y, offset.z); + + const positionAtoms = geometryAtoms.getAttribute('position'); + const colorAtoms = geometryAtoms.getAttribute('color'); + + const position = new THREE.Vector3(); + const color = new THREE.Color(); + + for (let i = 0; i < positionAtoms.count; i++) { + position.fromBufferAttribute(positionAtoms, i); + color.fromBufferAttribute(colorAtoms, i); + + const atomJSON = json.atoms[i]; + const element = atomJSON[4]; + + if (!colorSpriteMap[element]) { + const canvas = imageToCanvas(baseSprite); + const context = canvas.getContext('2d'); + + colorify(context, canvas.width, canvas.height, color); + + const dataUrl = canvas.toDataURL(); + + colorSpriteMap[element] = dataUrl; + } + + const colorSprite = colorSpriteMap[element]; + + const atom = document.createElement('img'); + atom.src = colorSprite; + + const object = new CSS3DSprite(atom); + object.position.copy(position); + object.position.multiplyScalar(75); + + object.matrixAutoUpdate = false; + object.updateMatrix(); + + root.add(object); + + objects.push(object); + } + + const positionBonds = geometryBonds.getAttribute('position'); + + const start = new THREE.Vector3(); + const end = new THREE.Vector3(); + + for (let i = 0; i < positionBonds.count; i += 2) { + start.fromBufferAttribute(positionBonds, i); + end.fromBufferAttribute(positionBonds, i + 1); + + start.multiplyScalar(75); + end.multiplyScalar(75); + + tmpVec1.subVectors(end, start); + const bondLength = tmpVec1.length() - 50; + + // + + let bond = document.createElement('div'); + bond.className = 'bond'; + bond.style.height = bondLength + 'px'; + + let object = new CSS3DObject(bond); + object.position.copy(start); + object.position.lerp(end, 0.5); + + object.userData.bondLengthShort = bondLength + 'px'; + object.userData.bondLengthFull = bondLength + 55 + 'px'; + + // + + const axis = tmpVec2.set(0, 1, 0).cross(tmpVec1); + const radians = Math.acos(tmpVec3.set(0, 1, 0).dot(tmpVec4.copy(tmpVec1).normalize())); + + const objMatrix = new THREE.Matrix4().makeRotationAxis(axis.normalize(), radians); + object.matrix.copy(objMatrix); + object.quaternion.setFromRotationMatrix(object.matrix); + + object.matrixAutoUpdate = false; + object.updateMatrix(); + + root.add(object); + + objects.push(object); + + // + + const joint = new THREE.Object3D(); + joint.position.copy(start); + joint.position.lerp(end, 0.5); + + joint.matrix.copy(objMatrix); + joint.quaternion.setFromRotationMatrix(joint.matrix); + + joint.matrixAutoUpdate = false; + joint.updateMatrix(); + + bond = document.createElement('div'); + bond.className = 'bond'; + bond.style.height = bondLength + 'px'; + + object = new CSS3DObject(bond); + object.rotation.y = Math.PI / 2; + + object.matrixAutoUpdate = false; + object.updateMatrix(); + + object.userData.bondLengthShort = bondLength + 'px'; + object.userData.bondLengthFull = bondLength + 55 + 'px'; + + object.userData.joint = joint; + + joint.add(object); + root.add(joint); + + objects.push(object); + } + + //console.log( "CSS3DObjects:", objects.length ); + + changeVizType(params.vizType); + }); +} + +// + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + requestAnimationFrame(animate); + controls.update(); + + const time = Date.now() * 0.0004; + + root.rotation.x = time; + root.rotation.y = time * 0.7; + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/css3d_orthographic.ts b/examples-testing/examples/css3d_orthographic.ts new file mode 100644 index 000000000..4aabbed08 --- /dev/null +++ b/examples-testing/examples/css3d_orthographic.ts @@ -0,0 +1,208 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer; + +let scene2, renderer2; + +const frustumSize = 500; + +init(); +animate(); + +function init() { + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera( + (frustumSize * aspect) / -2, + (frustumSize * aspect) / 2, + frustumSize / 2, + frustumSize / -2, + 1, + 1000, + ); + + camera.position.set(-200, 200, 200); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + scene2 = new THREE.Scene(); + + const material = new THREE.MeshBasicMaterial({ + color: 0x000000, + wireframe: true, + wireframeLinewidth: 1, + side: THREE.DoubleSide, + }); + + // left + createPlane( + 100, + 100, + 'chocolate', + new THREE.Vector3(-50, 0, 0), + new THREE.Euler(0, -90 * THREE.MathUtils.DEG2RAD, 0), + ); + // right + createPlane(100, 100, 'saddlebrown', new THREE.Vector3(0, 0, 50), new THREE.Euler(0, 0, 0)); + // top + createPlane( + 100, + 100, + 'yellowgreen', + new THREE.Vector3(0, 50, 0), + new THREE.Euler(-90 * THREE.MathUtils.DEG2RAD, 0, 0), + ); + // bottom + createPlane( + 300, + 300, + 'seagreen', + new THREE.Vector3(0, -50, 0), + new THREE.Euler(-90 * THREE.MathUtils.DEG2RAD, 0, 0), + ); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + renderer2 = new CSS3DRenderer(); + renderer2.setSize(window.innerWidth, window.innerHeight); + renderer2.domElement.style.position = 'absolute'; + renderer2.domElement.style.top = 0; + document.body.appendChild(renderer2.domElement); + + const controls = new OrbitControls(camera, renderer2.domElement); + controls.minZoom = 0.5; + controls.maxZoom = 2; + + function createPlane(width, height, cssColor, pos, rot) { + const element = document.createElement('div'); + element.style.width = width + 'px'; + element.style.height = height + 'px'; + element.style.opacity = 0.75; + element.style.background = cssColor; + + const object = new CSS3DObject(element); + object.position.copy(pos); + object.rotation.copy(rot); + scene2.add(object); + + const geometry = new THREE.PlaneGeometry(width, height); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.copy(object.position); + mesh.rotation.copy(object.rotation); + scene.add(mesh); + } + + window.addEventListener('resize', onWindowResize); + createPanel(); +} + +function onWindowResize() { + const aspect = window.innerWidth / window.innerHeight; + + camera.left = (-frustumSize * aspect) / 2; + camera.right = (frustumSize * aspect) / 2; + camera.top = frustumSize / 2; + camera.bottom = -frustumSize / 2; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + renderer2.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + requestAnimationFrame(animate); + + renderer.render(scene, camera); + renderer2.render(scene2, camera); +} + +function createPanel() { + const panel = new GUI(); + const folder1 = panel.addFolder('camera setViewOffset').close(); + + const settings = { + setViewOffset() { + folder1.children[1].enable().setValue(window.innerWidth); + folder1.children[2].enable().setValue(window.innerHeight); + folder1.children[3].enable().setValue(0); + folder1.children[4].enable().setValue(0); + folder1.children[5].enable().setValue(window.innerWidth); + folder1.children[6].enable().setValue(window.innerHeight); + }, + fullWidth: 0, + fullHeight: 0, + offsetX: 0, + offsetY: 0, + width: 0, + height: 0, + clearViewOffset() { + folder1.children[1].setValue(0).disable(); + folder1.children[2].setValue(0).disable(); + folder1.children[3].setValue(0).disable(); + folder1.children[4].setValue(0).disable(); + folder1.children[5].setValue(0).disable(); + folder1.children[6].setValue(0).disable(); + camera.clearViewOffset(); + }, + }; + + folder1.add(settings, 'setViewOffset'); + folder1 + .add(settings, 'fullWidth', window.screen.width / 4, window.screen.width * 2, 1) + .onChange(val => updateCameraViewOffset({ fullWidth: val })) + .disable(); + folder1 + .add(settings, 'fullHeight', window.screen.height / 4, window.screen.height * 2, 1) + .onChange(val => updateCameraViewOffset({ fullHeight: val })) + .disable(); + folder1 + .add(settings, 'offsetX', 0, 256, 1) + .onChange(val => updateCameraViewOffset({ x: val })) + .disable(); + folder1 + .add(settings, 'offsetY', 0, 256, 1) + .onChange(val => updateCameraViewOffset({ y: val })) + .disable(); + folder1 + .add(settings, 'width', window.screen.width / 4, window.screen.width * 2, 1) + .onChange(val => updateCameraViewOffset({ width: val })) + .disable(); + folder1 + .add(settings, 'height', window.screen.height / 4, window.screen.height * 2, 1) + .onChange(val => updateCameraViewOffset({ height: val })) + .disable(); + folder1.add(settings, 'clearViewOffset'); +} + +function updateCameraViewOffset({ fullWidth, fullHeight, x, y, width, height }) { + if (!camera.view) { + camera.setViewOffset( + fullWidth || window.innerWidth, + fullHeight || window.innerHeight, + x || 0, + y || 0, + width || window.innerWidth, + height || window.innerHeight, + ); + } else { + camera.setViewOffset( + fullWidth || camera.view.fullWidth, + fullHeight || camera.view.fullHeight, + x || camera.view.offsetX, + y || camera.view.offsetY, + width || camera.view.width, + height || camera.view.height, + ); + } +} diff --git a/examples-testing/examples/css3d_periodictable.ts b/examples-testing/examples/css3d_periodictable.ts new file mode 100644 index 000000000..e3a33f796 --- /dev/null +++ b/examples-testing/examples/css3d_periodictable.ts @@ -0,0 +1,793 @@ +import * as THREE from 'three'; + +import TWEEN from 'three/addons/libs/tween.module.js'; +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; + +const table = [ + 'H', + 'Hydrogen', + '1.00794', + 1, + 1, + 'He', + 'Helium', + '4.002602', + 18, + 1, + 'Li', + 'Lithium', + '6.941', + 1, + 2, + 'Be', + 'Beryllium', + '9.012182', + 2, + 2, + 'B', + 'Boron', + '10.811', + 13, + 2, + 'C', + 'Carbon', + '12.0107', + 14, + 2, + 'N', + 'Nitrogen', + '14.0067', + 15, + 2, + 'O', + 'Oxygen', + '15.9994', + 16, + 2, + 'F', + 'Fluorine', + '18.9984032', + 17, + 2, + 'Ne', + 'Neon', + '20.1797', + 18, + 2, + 'Na', + 'Sodium', + '22.98976...', + 1, + 3, + 'Mg', + 'Magnesium', + '24.305', + 2, + 3, + 'Al', + 'Aluminium', + '26.9815386', + 13, + 3, + 'Si', + 'Silicon', + '28.0855', + 14, + 3, + 'P', + 'Phosphorus', + '30.973762', + 15, + 3, + 'S', + 'Sulfur', + '32.065', + 16, + 3, + 'Cl', + 'Chlorine', + '35.453', + 17, + 3, + 'Ar', + 'Argon', + '39.948', + 18, + 3, + 'K', + 'Potassium', + '39.948', + 1, + 4, + 'Ca', + 'Calcium', + '40.078', + 2, + 4, + 'Sc', + 'Scandium', + '44.955912', + 3, + 4, + 'Ti', + 'Titanium', + '47.867', + 4, + 4, + 'V', + 'Vanadium', + '50.9415', + 5, + 4, + 'Cr', + 'Chromium', + '51.9961', + 6, + 4, + 'Mn', + 'Manganese', + '54.938045', + 7, + 4, + 'Fe', + 'Iron', + '55.845', + 8, + 4, + 'Co', + 'Cobalt', + '58.933195', + 9, + 4, + 'Ni', + 'Nickel', + '58.6934', + 10, + 4, + 'Cu', + 'Copper', + '63.546', + 11, + 4, + 'Zn', + 'Zinc', + '65.38', + 12, + 4, + 'Ga', + 'Gallium', + '69.723', + 13, + 4, + 'Ge', + 'Germanium', + '72.63', + 14, + 4, + 'As', + 'Arsenic', + '74.9216', + 15, + 4, + 'Se', + 'Selenium', + '78.96', + 16, + 4, + 'Br', + 'Bromine', + '79.904', + 17, + 4, + 'Kr', + 'Krypton', + '83.798', + 18, + 4, + 'Rb', + 'Rubidium', + '85.4678', + 1, + 5, + 'Sr', + 'Strontium', + '87.62', + 2, + 5, + 'Y', + 'Yttrium', + '88.90585', + 3, + 5, + 'Zr', + 'Zirconium', + '91.224', + 4, + 5, + 'Nb', + 'Niobium', + '92.90628', + 5, + 5, + 'Mo', + 'Molybdenum', + '95.96', + 6, + 5, + 'Tc', + 'Technetium', + '(98)', + 7, + 5, + 'Ru', + 'Ruthenium', + '101.07', + 8, + 5, + 'Rh', + 'Rhodium', + '102.9055', + 9, + 5, + 'Pd', + 'Palladium', + '106.42', + 10, + 5, + 'Ag', + 'Silver', + '107.8682', + 11, + 5, + 'Cd', + 'Cadmium', + '112.411', + 12, + 5, + 'In', + 'Indium', + '114.818', + 13, + 5, + 'Sn', + 'Tin', + '118.71', + 14, + 5, + 'Sb', + 'Antimony', + '121.76', + 15, + 5, + 'Te', + 'Tellurium', + '127.6', + 16, + 5, + 'I', + 'Iodine', + '126.90447', + 17, + 5, + 'Xe', + 'Xenon', + '131.293', + 18, + 5, + 'Cs', + 'Caesium', + '132.9054', + 1, + 6, + 'Ba', + 'Barium', + '132.9054', + 2, + 6, + 'La', + 'Lanthanum', + '138.90547', + 4, + 9, + 'Ce', + 'Cerium', + '140.116', + 5, + 9, + 'Pr', + 'Praseodymium', + '140.90765', + 6, + 9, + 'Nd', + 'Neodymium', + '144.242', + 7, + 9, + 'Pm', + 'Promethium', + '(145)', + 8, + 9, + 'Sm', + 'Samarium', + '150.36', + 9, + 9, + 'Eu', + 'Europium', + '151.964', + 10, + 9, + 'Gd', + 'Gadolinium', + '157.25', + 11, + 9, + 'Tb', + 'Terbium', + '158.92535', + 12, + 9, + 'Dy', + 'Dysprosium', + '162.5', + 13, + 9, + 'Ho', + 'Holmium', + '164.93032', + 14, + 9, + 'Er', + 'Erbium', + '167.259', + 15, + 9, + 'Tm', + 'Thulium', + '168.93421', + 16, + 9, + 'Yb', + 'Ytterbium', + '173.054', + 17, + 9, + 'Lu', + 'Lutetium', + '174.9668', + 18, + 9, + 'Hf', + 'Hafnium', + '178.49', + 4, + 6, + 'Ta', + 'Tantalum', + '180.94788', + 5, + 6, + 'W', + 'Tungsten', + '183.84', + 6, + 6, + 'Re', + 'Rhenium', + '186.207', + 7, + 6, + 'Os', + 'Osmium', + '190.23', + 8, + 6, + 'Ir', + 'Iridium', + '192.217', + 9, + 6, + 'Pt', + 'Platinum', + '195.084', + 10, + 6, + 'Au', + 'Gold', + '196.966569', + 11, + 6, + 'Hg', + 'Mercury', + '200.59', + 12, + 6, + 'Tl', + 'Thallium', + '204.3833', + 13, + 6, + 'Pb', + 'Lead', + '207.2', + 14, + 6, + 'Bi', + 'Bismuth', + '208.9804', + 15, + 6, + 'Po', + 'Polonium', + '(209)', + 16, + 6, + 'At', + 'Astatine', + '(210)', + 17, + 6, + 'Rn', + 'Radon', + '(222)', + 18, + 6, + 'Fr', + 'Francium', + '(223)', + 1, + 7, + 'Ra', + 'Radium', + '(226)', + 2, + 7, + 'Ac', + 'Actinium', + '(227)', + 4, + 10, + 'Th', + 'Thorium', + '232.03806', + 5, + 10, + 'Pa', + 'Protactinium', + '231.0588', + 6, + 10, + 'U', + 'Uranium', + '238.02891', + 7, + 10, + 'Np', + 'Neptunium', + '(237)', + 8, + 10, + 'Pu', + 'Plutonium', + '(244)', + 9, + 10, + 'Am', + 'Americium', + '(243)', + 10, + 10, + 'Cm', + 'Curium', + '(247)', + 11, + 10, + 'Bk', + 'Berkelium', + '(247)', + 12, + 10, + 'Cf', + 'Californium', + '(251)', + 13, + 10, + 'Es', + 'Einstenium', + '(252)', + 14, + 10, + 'Fm', + 'Fermium', + '(257)', + 15, + 10, + 'Md', + 'Mendelevium', + '(258)', + 16, + 10, + 'No', + 'Nobelium', + '(259)', + 17, + 10, + 'Lr', + 'Lawrencium', + '(262)', + 18, + 10, + 'Rf', + 'Rutherfordium', + '(267)', + 4, + 7, + 'Db', + 'Dubnium', + '(268)', + 5, + 7, + 'Sg', + 'Seaborgium', + '(271)', + 6, + 7, + 'Bh', + 'Bohrium', + '(272)', + 7, + 7, + 'Hs', + 'Hassium', + '(270)', + 8, + 7, + 'Mt', + 'Meitnerium', + '(276)', + 9, + 7, + 'Ds', + 'Darmstadium', + '(281)', + 10, + 7, + 'Rg', + 'Roentgenium', + '(280)', + 11, + 7, + 'Cn', + 'Copernicium', + '(285)', + 12, + 7, + 'Nh', + 'Nihonium', + '(286)', + 13, + 7, + 'Fl', + 'Flerovium', + '(289)', + 14, + 7, + 'Mc', + 'Moscovium', + '(290)', + 15, + 7, + 'Lv', + 'Livermorium', + '(293)', + 16, + 7, + 'Ts', + 'Tennessine', + '(294)', + 17, + 7, + 'Og', + 'Oganesson', + '(294)', + 18, + 7, +]; + +let camera, scene, renderer; +let controls; + +const objects = []; +const targets = { table: [], sphere: [], helix: [], grid: [] }; + +init(); +animate(); + +function init() { + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 3000; + + scene = new THREE.Scene(); + + // table + + for (let i = 0; i < table.length; i += 5) { + const element = document.createElement('div'); + element.className = 'element'; + element.style.backgroundColor = 'rgba(0,127,127,' + (Math.random() * 0.5 + 0.25) + ')'; + + const number = document.createElement('div'); + number.className = 'number'; + number.textContent = i / 5 + 1; + element.appendChild(number); + + const symbol = document.createElement('div'); + symbol.className = 'symbol'; + symbol.textContent = table[i]; + element.appendChild(symbol); + + const details = document.createElement('div'); + details.className = 'details'; + details.innerHTML = table[i + 1] + '
' + table[i + 2]; + element.appendChild(details); + + const objectCSS = new CSS3DObject(element); + objectCSS.position.x = Math.random() * 4000 - 2000; + objectCSS.position.y = Math.random() * 4000 - 2000; + objectCSS.position.z = Math.random() * 4000 - 2000; + scene.add(objectCSS); + + objects.push(objectCSS); + + // + + const object = new THREE.Object3D(); + object.position.x = table[i + 3] * 140 - 1330; + object.position.y = -(table[i + 4] * 180) + 990; + + targets.table.push(object); + } + + // sphere + + const vector = new THREE.Vector3(); + + for (let i = 0, l = objects.length; i < l; i++) { + const phi = Math.acos(-1 + (2 * i) / l); + const theta = Math.sqrt(l * Math.PI) * phi; + + const object = new THREE.Object3D(); + + object.position.setFromSphericalCoords(800, phi, theta); + + vector.copy(object.position).multiplyScalar(2); + + object.lookAt(vector); + + targets.sphere.push(object); + } + + // helix + + for (let i = 0, l = objects.length; i < l; i++) { + const theta = i * 0.175 + Math.PI; + const y = -(i * 8) + 450; + + const object = new THREE.Object3D(); + + object.position.setFromCylindricalCoords(900, theta, y); + + vector.x = object.position.x * 2; + vector.y = object.position.y; + vector.z = object.position.z * 2; + + object.lookAt(vector); + + targets.helix.push(object); + } + + // grid + + for (let i = 0; i < objects.length; i++) { + const object = new THREE.Object3D(); + + object.position.x = (i % 5) * 400 - 800; + object.position.y = -(Math.floor(i / 5) % 5) * 400 + 800; + object.position.z = Math.floor(i / 25) * 1000 - 2000; + + targets.grid.push(object); + } + + // + + renderer = new CSS3DRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + document.getElementById('container').appendChild(renderer.domElement); + + // + + controls = new TrackballControls(camera, renderer.domElement); + controls.minDistance = 500; + controls.maxDistance = 6000; + controls.addEventListener('change', render); + + const buttonTable = document.getElementById('table'); + buttonTable.addEventListener('click', function () { + transform(targets.table, 2000); + }); + + const buttonSphere = document.getElementById('sphere'); + buttonSphere.addEventListener('click', function () { + transform(targets.sphere, 2000); + }); + + const buttonHelix = document.getElementById('helix'); + buttonHelix.addEventListener('click', function () { + transform(targets.helix, 2000); + }); + + const buttonGrid = document.getElementById('grid'); + buttonGrid.addEventListener('click', function () { + transform(targets.grid, 2000); + }); + + transform(targets.table, 2000); + + // + + window.addEventListener('resize', onWindowResize); +} + +function transform(targets, duration) { + TWEEN.removeAll(); + + for (let i = 0; i < objects.length; i++) { + const object = objects[i]; + const target = targets[i]; + + new TWEEN.Tween(object.position) + .to( + { x: target.position.x, y: target.position.y, z: target.position.z }, + Math.random() * duration + duration, + ) + .easing(TWEEN.Easing.Exponential.InOut) + .start(); + + new TWEEN.Tween(object.rotation) + .to( + { x: target.rotation.x, y: target.rotation.y, z: target.rotation.z }, + Math.random() * duration + duration, + ) + .easing(TWEEN.Easing.Exponential.InOut) + .start(); + } + + new TWEEN.Tween(this) + .to({}, duration * 2) + .onUpdate(render) + .start(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function animate() { + requestAnimationFrame(animate); + + TWEEN.update(); + + controls.update(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/css3d_sandbox.ts b/examples-testing/examples/css3d_sandbox.ts new file mode 100644 index 000000000..1088b84b1 --- /dev/null +++ b/examples-testing/examples/css3d_sandbox.ts @@ -0,0 +1,180 @@ +import * as THREE from 'three'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer; + +let scene2, renderer2; + +let controls; + +init(); +animate(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(200, 200, 200); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + scene2 = new THREE.Scene(); + + const material = new THREE.MeshBasicMaterial({ + color: 0x000000, + wireframe: true, + wireframeLinewidth: 1, + side: THREE.DoubleSide, + }); + + // + + for (let i = 0; i < 10; i++) { + const element = document.createElement('div'); + element.style.width = '100px'; + element.style.height = '100px'; + element.style.opacity = i < 5 ? 0.5 : 1; + element.style.background = new THREE.Color(Math.random() * 0xffffff).getStyle(); + + const object = new CSS3DObject(element); + object.position.x = Math.random() * 200 - 100; + object.position.y = Math.random() * 200 - 100; + object.position.z = Math.random() * 200 - 100; + object.rotation.x = Math.random(); + object.rotation.y = Math.random(); + object.rotation.z = Math.random(); + object.scale.x = Math.random() + 0.5; + object.scale.y = Math.random() + 0.5; + scene2.add(object); + + const geometry = new THREE.PlaneGeometry(100, 100); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.copy(object.position); + mesh.rotation.copy(object.rotation); + mesh.scale.copy(object.scale); + scene.add(mesh); + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + renderer2 = new CSS3DRenderer(); + renderer2.setSize(window.innerWidth, window.innerHeight); + renderer2.domElement.style.position = 'absolute'; + renderer2.domElement.style.top = 0; + document.body.appendChild(renderer2.domElement); + + controls = new TrackballControls(camera, renderer2.domElement); + + window.addEventListener('resize', onWindowResize); + createPanel(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + renderer2.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + requestAnimationFrame(animate); + + controls.update(); + + renderer.render(scene, camera); + renderer2.render(scene2, camera); +} + +function createPanel() { + const panel = new GUI(); + const folder1 = panel.addFolder('camera setViewOffset').close(); + + const settings = { + setViewOffset() { + folder1.children[1].enable().setValue(window.innerWidth); + folder1.children[2].enable().setValue(window.innerHeight); + folder1.children[3].enable().setValue(0); + folder1.children[4].enable().setValue(0); + folder1.children[5].enable().setValue(window.innerWidth); + folder1.children[6].enable().setValue(window.innerHeight); + }, + fullWidth: 0, + fullHeight: 0, + offsetX: 0, + offsetY: 0, + width: 0, + height: 0, + clearViewOffset() { + folder1.children[1].setValue(0).disable(); + folder1.children[2].setValue(0).disable(); + folder1.children[3].setValue(0).disable(); + folder1.children[4].setValue(0).disable(); + folder1.children[5].setValue(0).disable(); + folder1.children[6].setValue(0).disable(); + camera.clearViewOffset(); + }, + }; + + folder1.add(settings, 'setViewOffset'); + folder1 + .add(settings, 'fullWidth', window.screen.width / 4, window.screen.width * 2, 1) + .onChange(val => updateCameraViewOffset({ fullWidth: val })) + .disable(); + folder1 + .add(settings, 'fullHeight', window.screen.height / 4, window.screen.height * 2, 1) + .onChange(val => updateCameraViewOffset({ fullHeight: val })) + .disable(); + folder1 + .add(settings, 'offsetX', 0, 256, 1) + .onChange(val => updateCameraViewOffset({ x: val })) + .disable(); + folder1 + .add(settings, 'offsetY', 0, 256, 1) + .onChange(val => updateCameraViewOffset({ y: val })) + .disable(); + folder1 + .add(settings, 'width', window.screen.width / 4, window.screen.width * 2, 1) + .onChange(val => updateCameraViewOffset({ width: val })) + .disable(); + folder1 + .add(settings, 'height', window.screen.height / 4, window.screen.height * 2, 1) + .onChange(val => updateCameraViewOffset({ height: val })) + .disable(); + folder1.add(settings, 'clearViewOffset'); +} + +function updateCameraViewOffset({ fullWidth, fullHeight, x, y, width, height }) { + if (!camera.view) { + camera.setViewOffset( + fullWidth || window.innerWidth, + fullHeight || window.innerHeight, + x || 0, + y || 0, + width || window.innerWidth, + height || window.innerHeight, + ); + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + } else { + camera.setViewOffset( + fullWidth || camera.view.fullWidth, + fullHeight || camera.view.fullHeight, + x || camera.view.offsetX, + y || camera.view.offsetY, + width || camera.view.width, + height || camera.view.height, + ); + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + } +} diff --git a/examples-testing/examples/css3d_sprites.ts b/examples-testing/examples/css3d_sprites.ts new file mode 100644 index 000000000..39c3455a5 --- /dev/null +++ b/examples-testing/examples/css3d_sprites.ts @@ -0,0 +1,157 @@ +import * as THREE from 'three'; + +import TWEEN from 'three/addons/libs/tween.module.js'; +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { CSS3DRenderer, CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; + +let camera, scene, renderer; +let controls; + +const particlesTotal = 512; +const positions = []; +const objects = []; +let current = 0; + +init(); +animate(); + +function init() { + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.set(600, 400, 1500); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + + const image = document.createElement('img'); + image.addEventListener('load', function () { + for (let i = 0; i < particlesTotal; i++) { + const object = new CSS3DSprite(image.cloneNode()); + ((object.position.x = Math.random() * 4000 - 2000), + (object.position.y = Math.random() * 4000 - 2000), + (object.position.z = Math.random() * 4000 - 2000)); + scene.add(object); + + objects.push(object); + } + + transition(); + }); + image.src = 'textures/sprite.png'; + + // Plane + + const amountX = 16; + const amountZ = 32; + const separationPlane = 150; + const offsetX = ((amountX - 1) * separationPlane) / 2; + const offsetZ = ((amountZ - 1) * separationPlane) / 2; + + for (let i = 0; i < particlesTotal; i++) { + const x = (i % amountX) * separationPlane; + const z = Math.floor(i / amountX) * separationPlane; + const y = (Math.sin(x * 0.5) + Math.sin(z * 0.5)) * 200; + + positions.push(x - offsetX, y, z - offsetZ); + } + + // Cube + + const amount = 8; + const separationCube = 150; + const offset = ((amount - 1) * separationCube) / 2; + + for (let i = 0; i < particlesTotal; i++) { + const x = (i % amount) * separationCube; + const y = Math.floor((i / amount) % amount) * separationCube; + const z = Math.floor(i / (amount * amount)) * separationCube; + + positions.push(x - offset, y - offset, z - offset); + } + + // Random + + for (let i = 0; i < particlesTotal; i++) { + positions.push(Math.random() * 4000 - 2000, Math.random() * 4000 - 2000, Math.random() * 4000 - 2000); + } + + // Sphere + + const radius = 750; + + for (let i = 0; i < particlesTotal; i++) { + const phi = Math.acos(-1 + (2 * i) / particlesTotal); + const theta = Math.sqrt(particlesTotal * Math.PI) * phi; + + positions.push( + radius * Math.cos(theta) * Math.sin(phi), + radius * Math.sin(theta) * Math.sin(phi), + radius * Math.cos(phi), + ); + } + + // + + renderer = new CSS3DRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + document.getElementById('container').appendChild(renderer.domElement); + + // + + controls = new TrackballControls(camera, renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function transition() { + const offset = current * particlesTotal * 3; + const duration = 2000; + + for (let i = 0, j = offset; i < particlesTotal; i++, j += 3) { + const object = objects[i]; + + new TWEEN.Tween(object.position) + .to( + { + x: positions[j], + y: positions[j + 1], + z: positions[j + 2], + }, + Math.random() * duration + duration, + ) + .easing(TWEEN.Easing.Exponential.InOut) + .start(); + } + + new TWEEN.Tween(this) + .to({}, duration * 3) + .onComplete(transition) + .start(); + + current = (current + 1) % 4; +} + +function animate() { + requestAnimationFrame(animate); + + TWEEN.update(); + controls.update(); + + const time = performance.now(); + + for (let i = 0, l = objects.length; i < l; i++) { + const object = objects[i]; + const scale = Math.sin((Math.floor(object.position.x) + time) * 0.002) * 0.3 + 1; + object.scale.set(scale, scale, scale); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/css3d_youtube.ts b/examples-testing/examples/css3d_youtube.ts new file mode 100644 index 000000000..62652f87f --- /dev/null +++ b/examples-testing/examples/css3d_youtube.ts @@ -0,0 +1,79 @@ +import * as THREE from 'three'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; + +let camera, scene, renderer; +let controls; + +function Element(id, x, y, z, ry) { + const div = document.createElement('div'); + div.style.width = '480px'; + div.style.height = '360px'; + div.style.backgroundColor = '#000'; + + const iframe = document.createElement('iframe'); + iframe.style.width = '480px'; + iframe.style.height = '360px'; + iframe.style.border = '0px'; + iframe.src = ['https://www.youtube.com/embed/', id, '?rel=0'].join(''); + div.appendChild(iframe); + + const object = new CSS3DObject(div); + object.position.set(x, y, z); + object.rotation.y = ry; + + return object; +} + +init(); +animate(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.set(500, 350, 750); + + scene = new THREE.Scene(); + + renderer = new CSS3DRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + container.appendChild(renderer.domElement); + + const group = new THREE.Group(); + group.add(new Element('SJOz3qjfQXU', 0, 0, 240, 0)); + group.add(new Element('Y2-xZ-1HE-Q', 240, 0, 0, Math.PI / 2)); + group.add(new Element('IrydklNpcFI', 0, 0, -240, Math.PI)); + group.add(new Element('9ubytEsCaS0', -240, 0, 0, -Math.PI / 2)); + scene.add(group); + + controls = new TrackballControls(camera, renderer.domElement); + controls.rotateSpeed = 4; + + window.addEventListener('resize', onWindowResize); + + // Block iframe events when dragging camera + + const blocker = document.getElementById('blocker'); + blocker.style.display = 'none'; + + controls.addEventListener('start', function () { + blocker.style.display = ''; + }); + controls.addEventListener('end', function () { + blocker.style.display = 'none'; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + requestAnimationFrame(animate); + controls.update(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/games_fps.ts b/examples-testing/examples/games_fps.ts new file mode 100644 index 000000000..ed08fb5fa --- /dev/null +++ b/examples-testing/examples/games_fps.ts @@ -0,0 +1,377 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Octree } from 'three/addons/math/Octree.js'; +import { OctreeHelper } from 'three/addons/helpers/OctreeHelper.js'; + +import { Capsule } from 'three/addons/math/Capsule.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +const timer = new THREE.Timer(); +timer.connect(document); + +const scene = new THREE.Scene(); +scene.background = new THREE.Color(0x88ccee); +scene.fog = new THREE.Fog(0x88ccee, 0, 50); + +const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 1000); +camera.rotation.order = 'YXZ'; + +const fillLight1 = new THREE.HemisphereLight(0x8dc1de, 0x00668d, 1.5); +fillLight1.position.set(2, 1, 1); +scene.add(fillLight1); + +const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); +directionalLight.position.set(-5, 25, -1); +directionalLight.castShadow = true; +directionalLight.shadow.camera.near = 0.01; +directionalLight.shadow.camera.far = 500; +directionalLight.shadow.camera.right = 30; +directionalLight.shadow.camera.left = -30; +directionalLight.shadow.camera.top = 30; +directionalLight.shadow.camera.bottom = -30; +directionalLight.shadow.mapSize.width = 1024; +directionalLight.shadow.mapSize.height = 1024; +directionalLight.shadow.radius = 4; +directionalLight.shadow.bias = -0.00006; +scene.add(directionalLight); + +const container = document.getElementById('container'); + +const renderer = new THREE.WebGLRenderer({ antialias: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setAnimationLoop(animate); +renderer.shadowMap.enabled = true; +renderer.shadowMap.type = THREE.VSMShadowMap; +renderer.toneMapping = THREE.ACESFilmicToneMapping; +container.appendChild(renderer.domElement); + +const stats = new Stats(); +stats.domElement.style.position = 'absolute'; +stats.domElement.style.top = '0px'; +container.appendChild(stats.domElement); + +const GRAVITY = 30; + +const NUM_SPHERES = 100; +const SPHERE_RADIUS = 0.2; + +const STEPS_PER_FRAME = 5; + +const sphereGeometry = new THREE.IcosahedronGeometry(SPHERE_RADIUS, 5); +const sphereMaterial = new THREE.MeshLambertMaterial({ color: 0xdede8d }); + +const spheres = []; +let sphereIdx = 0; + +for (let i = 0; i < NUM_SPHERES; i++) { + const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); + sphere.castShadow = true; + sphere.receiveShadow = true; + + scene.add(sphere); + + spheres.push({ + mesh: sphere, + collider: new THREE.Sphere(new THREE.Vector3(0, -100, 0), SPHERE_RADIUS), + velocity: new THREE.Vector3(), + }); +} + +const worldOctree = new Octree(); + +const playerCollider = new Capsule(new THREE.Vector3(0, 0.35, 0), new THREE.Vector3(0, 1, 0), 0.35); + +const playerVelocity = new THREE.Vector3(); +const playerDirection = new THREE.Vector3(); + +let playerOnFloor = false; +let mouseTime = 0; + +const keyStates = {}; + +const vector1 = new THREE.Vector3(); +const vector2 = new THREE.Vector3(); +const vector3 = new THREE.Vector3(); + +document.addEventListener('keydown', event => { + keyStates[event.code] = true; +}); + +document.addEventListener('keyup', event => { + keyStates[event.code] = false; +}); + +container.addEventListener('mousedown', () => { + document.body.requestPointerLock(); + + mouseTime = performance.now(); +}); + +document.addEventListener('mouseup', () => { + if (document.pointerLockElement !== null) throwBall(); +}); + +document.body.addEventListener('mousemove', event => { + if (document.pointerLockElement === document.body) { + camera.rotation.y -= event.movementX / 500; + camera.rotation.x -= event.movementY / 500; + } +}); + +window.addEventListener('resize', onWindowResize); + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function throwBall() { + const sphere = spheres[sphereIdx]; + + camera.getWorldDirection(playerDirection); + + sphere.collider.center.copy(playerCollider.end).addScaledVector(playerDirection, playerCollider.radius * 1.5); + + // throw the ball with more force if we hold the button longer, and if we move forward + + const impulse = 15 + 30 * (1 - Math.exp((mouseTime - performance.now()) * 0.001)); + + sphere.velocity.copy(playerDirection).multiplyScalar(impulse); + sphere.velocity.addScaledVector(playerVelocity, 2); + + sphereIdx = (sphereIdx + 1) % spheres.length; +} + +function playerCollisions() { + const result = worldOctree.capsuleIntersect(playerCollider); + + playerOnFloor = false; + + if (result) { + // determine if the surface we bumped into is something we can stand on + + playerOnFloor = result.normal.y >= 0.15; // allow slopes up to ~81° but ignore sheer vertical walls + + if (!playerOnFloor) { + playerVelocity.addScaledVector(result.normal, -result.normal.dot(playerVelocity)); + } + + if (result.depth >= 1e-10) { + playerCollider.translate(result.normal.multiplyScalar(result.depth)); + } + } +} + +function updatePlayer(deltaTime) { + let damping = Math.exp(-4 * deltaTime) - 1; + + if (!playerOnFloor) { + playerVelocity.y -= GRAVITY * deltaTime; + + // small air resistance + damping *= 0.1; + } + + playerVelocity.addScaledVector(playerVelocity, damping); + + const deltaPosition = playerVelocity.clone().multiplyScalar(deltaTime); + playerCollider.translate(deltaPosition); + + playerCollisions(); + + camera.position.copy(playerCollider.end); +} + +function playerSphereCollision(sphere) { + const center = vector1.addVectors(playerCollider.start, playerCollider.end).multiplyScalar(0.5); + + const sphere_center = sphere.collider.center; + + const r = playerCollider.radius + sphere.collider.radius; + const r2 = r * r; + + // approximation: player = 3 spheres + + for (const point of [playerCollider.start, playerCollider.end, center]) { + const d2 = point.distanceToSquared(sphere_center); + + if (d2 < r2) { + const normal = vector1.subVectors(point, sphere_center).normalize(); + const v1 = vector2.copy(normal).multiplyScalar(normal.dot(playerVelocity)); + const v2 = vector3.copy(normal).multiplyScalar(normal.dot(sphere.velocity)); + + playerVelocity.add(v2).sub(v1); + sphere.velocity.add(v1).sub(v2); + + const d = (r - Math.sqrt(d2)) / 2; + sphere_center.addScaledVector(normal, -d); + } + } +} + +function spheresCollisions() { + for (let i = 0, length = spheres.length; i < length; i++) { + const s1 = spheres[i]; + + for (let j = i + 1; j < length; j++) { + const s2 = spheres[j]; + + const d2 = s1.collider.center.distanceToSquared(s2.collider.center); + const r = s1.collider.radius + s2.collider.radius; + const r2 = r * r; + + if (d2 < r2) { + const normal = vector1.subVectors(s1.collider.center, s2.collider.center).normalize(); + const v1 = vector2.copy(normal).multiplyScalar(normal.dot(s1.velocity)); + const v2 = vector3.copy(normal).multiplyScalar(normal.dot(s2.velocity)); + + s1.velocity.add(v2).sub(v1); + s2.velocity.add(v1).sub(v2); + + const d = (r - Math.sqrt(d2)) / 2; + + s1.collider.center.addScaledVector(normal, d); + s2.collider.center.addScaledVector(normal, -d); + } + } + } +} + +function updateSpheres(deltaTime) { + spheres.forEach(sphere => { + sphere.collider.center.addScaledVector(sphere.velocity, deltaTime); + + const result = worldOctree.sphereIntersect(sphere.collider); + + if (result) { + sphere.velocity.addScaledVector(result.normal, -result.normal.dot(sphere.velocity) * 1.5); + sphere.collider.center.add(result.normal.multiplyScalar(result.depth)); + } else { + sphere.velocity.y -= GRAVITY * deltaTime; + } + + const damping = Math.exp(-1.5 * deltaTime) - 1; + sphere.velocity.addScaledVector(sphere.velocity, damping); + + playerSphereCollision(sphere); + }); + + spheresCollisions(); + + for (const sphere of spheres) { + sphere.mesh.position.copy(sphere.collider.center); + } +} + +function getForwardVector() { + camera.getWorldDirection(playerDirection); + playerDirection.y = 0; + playerDirection.normalize(); + + return playerDirection; +} + +function getSideVector() { + camera.getWorldDirection(playerDirection); + playerDirection.y = 0; + playerDirection.normalize(); + playerDirection.cross(camera.up); + + return playerDirection; +} + +function controls(deltaTime) { + // gives a bit of air control + const speedDelta = deltaTime * (playerOnFloor ? 25 : 8); + + if (keyStates['KeyW']) { + playerVelocity.add(getForwardVector().multiplyScalar(speedDelta)); + } + + if (keyStates['KeyS']) { + playerVelocity.add(getForwardVector().multiplyScalar(-speedDelta)); + } + + if (keyStates['KeyA']) { + playerVelocity.add(getSideVector().multiplyScalar(-speedDelta)); + } + + if (keyStates['KeyD']) { + playerVelocity.add(getSideVector().multiplyScalar(speedDelta)); + } + + if (playerOnFloor) { + if (keyStates['Space']) { + playerVelocity.y = 15; + } + } +} + +const loader = new GLTFLoader().setPath('./models/gltf/'); + +loader.load('collision-world.glb', gltf => { + scene.add(gltf.scene); + + worldOctree.fromGraphNode(gltf.scene); + + gltf.scene.traverse(child => { + if (child.isMesh) { + child.castShadow = true; + child.receiveShadow = true; + + if (child.material.map) { + child.material.map.anisotropy = 4; + } + } + }); + + const helper = new OctreeHelper(worldOctree); + helper.visible = false; + scene.add(helper); + + const gui = new GUI({ width: 200 }); + gui.add({ debug: false }, 'debug').onChange(function (value) { + helper.visible = value; + }); +}); + +function teleportPlayerIfOob() { + if (camera.position.y <= -25) { + playerCollider.start.set(0, 0.35, 0); + playerCollider.end.set(0, 1, 0); + playerCollider.radius = 0.35; + camera.position.copy(playerCollider.end); + camera.rotation.set(0, 0, 0); + } +} + +function animate() { + timer.update(); + + const deltaTime = Math.min(0.05, timer.getDelta()) / STEPS_PER_FRAME; + + // we look for collisions in substeps to mitigate the risk of + // an object traversing another too quickly for detection. + + for (let i = 0; i < STEPS_PER_FRAME; i++) { + controls(deltaTime); + + updatePlayer(deltaTime); + + updateSpheres(deltaTime); + + teleportPlayerIfOob(); + } + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/misc_animation_groups.ts b/examples-testing/examples/misc_animation_groups.ts new file mode 100644 index 000000000..9fed234fc --- /dev/null +++ b/examples-testing/examples/misc_animation_groups.ts @@ -0,0 +1,128 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let stats, timer; +let scene, camera, renderer, mixer; + +init(); + +function init() { + scene = new THREE.Scene(); + + // + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(50, 50, 100); + camera.lookAt(scene.position); + + // all objects of this animation group share a common animation state + + const animationGroup = new THREE.AnimationObjectGroup(); + + // + + const geometry = new THREE.BoxGeometry(5, 5, 5); + const material = new THREE.MeshBasicMaterial({ transparent: true }); + + // + + for (let i = 0; i < 5; i++) { + for (let j = 0; j < 5; j++) { + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = 32 - 16 * i; + mesh.position.y = 0; + mesh.position.z = 32 - 16 * j; + + scene.add(mesh); + animationGroup.add(mesh); + } + } + + // create some keyframe tracks + + const xAxis = new THREE.Vector3(1, 0, 0); + const qInitial = new THREE.Quaternion().setFromAxisAngle(xAxis, 0); + const qFinal = new THREE.Quaternion().setFromAxisAngle(xAxis, Math.PI); + const quaternionKF = new THREE.QuaternionKeyframeTrack( + '.quaternion', + [0, 1, 2], + [ + qInitial.x, + qInitial.y, + qInitial.z, + qInitial.w, + qFinal.x, + qFinal.y, + qFinal.z, + qFinal.w, + qInitial.x, + qInitial.y, + qInitial.z, + qInitial.w, + ], + ); + + const colorKF = new THREE.ColorKeyframeTrack( + '.material.color', + [0, 1, 2], + [1, 0, 0, 0, 1, 0, 0, 0, 1], + THREE.InterpolateDiscrete, + ); + const opacityKF = new THREE.NumberKeyframeTrack('.material.opacity', [0, 1, 2], [1, 0, 1]); + + // create clip + + const clip = new THREE.AnimationClip('default', 3, [quaternionKF, colorKF, opacityKF]); + + // apply the animation group to the mixer as the root object + + mixer = new THREE.AnimationMixer(animationGroup); + + const clipAction = mixer.clipAction(clip); + clipAction.play(); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + timer = new THREE.Timer(); + timer.connect(document); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) { + mixer.update(delta); + } + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/misc_animation_keys.ts b/examples-testing/examples/misc_animation_keys.ts new file mode 100644 index 000000000..32d497e5a --- /dev/null +++ b/examples-testing/examples/misc_animation_keys.ts @@ -0,0 +1,132 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let stats, timer; +let scene, camera, renderer, mixer; + +init(); + +function init() { + scene = new THREE.Scene(); + + // + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(25, 25, 50); + camera.lookAt(scene.position); + + // + + const axesHelper = new THREE.AxesHelper(10); + scene.add(axesHelper); + + // + + const geometry = new THREE.BoxGeometry(5, 5, 5); + const material = new THREE.MeshBasicMaterial({ color: 0xffffff, transparent: true }); + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // create a keyframe track (i.e. a timed sequence of keyframes) for each animated property + // Note: the keyframe track type should correspond to the type of the property being animated + + // POSITION + const positionKF = new THREE.VectorKeyframeTrack('.position', [0, 1, 2], [0, 0, 0, 30, 0, 0, 0, 0, 0]); + + // SCALE + const scaleKF = new THREE.VectorKeyframeTrack('.scale', [0, 1, 2], [1, 1, 1, 2, 2, 2, 1, 1, 1]); + + // ROTATION + // Rotation should be performed using quaternions, using a THREE.QuaternionKeyframeTrack + // Interpolating Euler angles (.rotation property) can be problematic and is currently not supported + + // set up rotation about x axis + const xAxis = new THREE.Vector3(1, 0, 0); + + const qInitial = new THREE.Quaternion().setFromAxisAngle(xAxis, 0); + const qFinal = new THREE.Quaternion().setFromAxisAngle(xAxis, Math.PI); + const quaternionKF = new THREE.QuaternionKeyframeTrack( + '.quaternion', + [0, 1, 2], + [ + qInitial.x, + qInitial.y, + qInitial.z, + qInitial.w, + qFinal.x, + qFinal.y, + qFinal.z, + qFinal.w, + qInitial.x, + qInitial.y, + qInitial.z, + qInitial.w, + ], + ); + + // COLOR + const colorKF = new THREE.ColorKeyframeTrack( + '.material.color', + [0, 1, 2], + [1, 0, 0, 0, 1, 0, 0, 0, 1], + THREE.InterpolateDiscrete, + ); + + // OPACITY + const opacityKF = new THREE.NumberKeyframeTrack('.material.opacity', [0, 1, 2], [1, 0, 1]); + + // create an animation sequence with the tracks + // If a negative time value is passed, the duration will be calculated from the times of the passed tracks array + const clip = new THREE.AnimationClip('Action', 3, [scaleKF, positionKF, quaternionKF, colorKF, opacityKF]); + + // setup the THREE.AnimationMixer + mixer = new THREE.AnimationMixer(mesh); + + // create a ClipAction and set it to play + const clipAction = mixer.clipAction(clip); + clipAction.play(); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + timer = new THREE.Timer(); + timer.connect(document); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) { + mixer.update(delta); + } + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/misc_boxselection.ts b/examples-testing/examples/misc_boxselection.ts new file mode 100644 index 000000000..e7079c405 --- /dev/null +++ b/examples-testing/examples/misc_boxselection.ts @@ -0,0 +1,137 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { SelectionBox } from 'three/addons/interactive/SelectionBox.js'; +import { SelectionHelper } from 'three/addons/interactive/SelectionHelper.js'; + +let container, stats; +let camera, scene, renderer; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 500); + camera.position.z = 50; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + scene.add(new THREE.AmbientLight(0xaaaaaa)); + + const light = new THREE.SpotLight(0xffffff, 10000); + light.position.set(0, 25, 50); + light.angle = Math.PI / 5; + + light.castShadow = true; + light.shadow.camera.near = 10; + light.shadow.camera.far = 100; + light.shadow.mapSize.width = 1024; + light.shadow.mapSize.height = 1024; + + scene.add(light); + + const geometry = new THREE.BoxGeometry(); + + for (let i = 0; i < 200; i++) { + const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); + + object.position.x = Math.random() * 80 - 40; + object.position.y = Math.random() * 45 - 25; + object.position.z = Math.random() * 45 - 25; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.x = Math.random() * 2 + 1; + object.scale.y = Math.random() * 2 + 1; + object.scale.z = Math.random() * 2 + 1; + + object.castShadow = true; + object.receiveShadow = true; + + scene.add(object); + } + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.render(scene, camera); + + stats.update(); +} + +const selectionBox = new SelectionBox(camera, scene); +const helper = new SelectionHelper(renderer, 'selectBox'); + +document.addEventListener('pointerdown', function (event) { + for (const item of selectionBox.collection) { + item.material.emissive.set(0x000000); + } + + selectionBox.startPoint.set( + (event.clientX / window.innerWidth) * 2 - 1, + -(event.clientY / window.innerHeight) * 2 + 1, + 0.5, + ); +}); + +document.addEventListener('pointermove', function (event) { + if (helper.isDown) { + for (let i = 0; i < selectionBox.collection.length; i++) { + selectionBox.collection[i].material.emissive.set(0x000000); + } + + selectionBox.endPoint.set( + (event.clientX / window.innerWidth) * 2 - 1, + -(event.clientY / window.innerHeight) * 2 + 1, + 0.5, + ); + + const allSelected = selectionBox.select(); + + for (let i = 0; i < allSelected.length; i++) { + allSelected[i].material.emissive.set(0xffffff); + } + } +}); + +document.addEventListener('pointerup', function (event) { + selectionBox.endPoint.set( + (event.clientX / window.innerWidth) * 2 - 1, + -(event.clientY / window.innerHeight) * 2 + 1, + 0.5, + ); + + const allSelected = selectionBox.select(); + + for (let i = 0; i < allSelected.length; i++) { + allSelected[i].material.emissive.set(0xffffff); + } +}); diff --git a/examples-testing/examples/misc_controls_arcball.ts b/examples-testing/examples/misc_controls_arcball.ts new file mode 100644 index 000000000..f2611be64 --- /dev/null +++ b/examples-testing/examples/misc_controls_arcball.ts @@ -0,0 +1,211 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { ArcballControls } from 'three/addons/controls/ArcballControls.js'; + +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +const cameras = ['Orthographic', 'Perspective']; +const cameraType = { type: 'Perspective' }; + +const perspectiveDistance = 2.5; +const orthographicDistance = 120; +let camera, controls, scene, renderer, gui; +let folderOptions, folderAnimations; + +const arcballGui = { + gizmoVisible: true, + + setArcballControls: function () { + controls = new ArcballControls(camera, renderer.domElement, scene); + controls.addEventListener('change', render); + + this.gizmoVisible = true; + + this.populateGui(); + }, + + populateGui: function () { + folderOptions.add(controls, 'enabled').name('Enable controls'); + folderOptions.add(controls, 'enableFocus').name('Enable focus'); + folderOptions.add(controls, 'enableGrid').name('Enable Grid'); + folderOptions.add(controls, 'enableRotate').name('Enable rotate'); + folderOptions.add(controls, 'enablePan').name('Enable pan'); + folderOptions.add(controls, 'enableZoom').name('Enable zoom'); + folderOptions.add(controls, 'cursorZoom').name('Cursor zoom'); + folderOptions.add(controls, 'adjustNearFar').name('adjust near/far'); + folderOptions.add(controls, 'scaleFactor', 1.1, 10, 0.1).name('Scale factor'); + folderOptions.add(controls, 'minDistance', 0, 50, 0.5).name('Min distance'); + folderOptions.add(controls, 'maxDistance', 0, 50, 0.5).name('Max distance'); + folderOptions.add(controls, 'minZoom', 0, 50, 0.5).name('Min zoom'); + folderOptions.add(controls, 'maxZoom', 0, 50, 0.5).name('Max zoom'); + folderOptions + .add(arcballGui, 'gizmoVisible') + .name('Show gizmos') + .onChange(function () { + controls.setGizmosVisible(arcballGui.gizmoVisible); + }); + folderOptions.add(controls, 'copyState').name('Copy state(ctrl+c)'); + folderOptions.add(controls, 'pasteState').name('Paste state(ctrl+v)'); + folderOptions.add(controls, 'reset').name('Reset'); + folderAnimations.add(controls, 'enableAnimations').name('Enable anim.'); + folderAnimations.add(controls, 'dampingFactor', 0, 100, 1).name('Damping'); + folderAnimations.add(controls, 'wMax', 0, 100, 1).name('Angular spd'); + }, +}; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ReinhardToneMapping; + renderer.toneMappingExposure = 3; + renderer.domElement.style.background = 'linear-gradient( 180deg, rgba( 0,0,0,1 ) 0%, rgba( 128,128,255,1 ) 100% )'; + container.appendChild(renderer.domElement); + + // + + scene = new THREE.Scene(); + + camera = makePerspectiveCamera(); + camera.position.set(0, 0, perspectiveDistance); + + const material = new THREE.MeshStandardMaterial(); + + new OBJLoader().setPath('models/obj/cerberus/').load('Cerberus.obj', function (group) { + const textureLoader = new THREE.TextureLoader().setPath('models/obj/cerberus/'); + + material.roughness = 1; + material.metalness = 1; + + const diffuseMap = textureLoader.load('Cerberus_A.jpg', render); + diffuseMap.colorSpace = THREE.SRGBColorSpace; + material.map = diffuseMap; + + material.metalnessMap = material.roughnessMap = textureLoader.load('Cerberus_RM.jpg', render); + material.normalMap = textureLoader.load('Cerberus_N.jpg', render); + + material.map.wrapS = THREE.RepeatWrapping; + material.roughnessMap.wrapS = THREE.RepeatWrapping; + material.metalnessMap.wrapS = THREE.RepeatWrapping; + material.normalMap.wrapS = THREE.RepeatWrapping; + + group.traverse(function (child) { + if (child.isMesh) { + child.material = material; + } + }); + + group.rotation.y = Math.PI / 2; + group.position.x += 0.25; + scene.add(group); + render(); + + new HDRLoader().setPath('textures/equirectangular/').load('venice_sunset_1k.hdr', function (hdrEquirect) { + hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; + + scene.environment = hdrEquirect; + + render(); + }); + + window.addEventListener('keydown', onKeyDown); + window.addEventListener('resize', onWindowResize); + + // + + gui = new GUI(); + gui.add(cameraType, 'type', cameras) + .name('Choose Camera') + .onChange(function () { + setCamera(cameraType.type); + }); + + folderOptions = gui.addFolder('Arcball parameters'); + folderAnimations = folderOptions.addFolder('Animations'); + + arcballGui.setArcballControls(); + + render(); + }); +} + +function makeOrthographicCamera() { + const halfFovV = THREE.MathUtils.DEG2RAD * 45 * 0.5; + const halfFovH = Math.atan((window.innerWidth / window.innerHeight) * Math.tan(halfFovV)); + + const halfW = perspectiveDistance * Math.tan(halfFovH); + const halfH = perspectiveDistance * Math.tan(halfFovV); + const near = 0.01; + const far = 2000; + const newCamera = new THREE.OrthographicCamera(-halfW, halfW, halfH, -halfH, near, far); + return newCamera; +} + +function makePerspectiveCamera() { + const fov = 45; + const aspect = window.innerWidth / window.innerHeight; + const near = 0.01; + const far = 2000; + const newCamera = new THREE.PerspectiveCamera(fov, aspect, near, far); + return newCamera; +} + +function onWindowResize() { + if (camera.type == 'OrthographicCamera') { + const halfFovV = THREE.MathUtils.DEG2RAD * 45 * 0.5; + const halfFovH = Math.atan((window.innerWidth / window.innerHeight) * Math.tan(halfFovV)); + + const halfW = perspectiveDistance * Math.tan(halfFovH); + const halfH = perspectiveDistance * Math.tan(halfFovV); + camera.left = -halfW; + camera.right = halfW; + camera.top = halfH; + camera.bottom = -halfH; + } else if (camera.type == 'PerspectiveCamera') { + camera.aspect = window.innerWidth / window.innerHeight; + } + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} + +function onKeyDown(event) { + if (event.key === 'c') { + if (event.ctrlKey || event.metaKey) { + controls.copyState(); + } + } else if (event.key === 'v') { + if (event.ctrlKey || event.metaKey) { + controls.pasteState(); + } + } +} + +function setCamera(type) { + if (type == 'Orthographic') { + camera = makeOrthographicCamera(); + camera.position.set(0, 0, orthographicDistance); + } else if (type == 'Perspective') { + camera = makePerspectiveCamera(); + camera.position.set(0, 0, perspectiveDistance); + } + + controls.setCamera(camera); + + render(); +} diff --git a/examples-testing/examples/misc_controls_drag.ts b/examples-testing/examples/misc_controls_drag.ts new file mode 100644 index 000000000..b12b0421e --- /dev/null +++ b/examples-testing/examples/misc_controls_drag.ts @@ -0,0 +1,153 @@ +import * as THREE from 'three'; + +import { DragControls } from 'three/addons/controls/DragControls.js'; + +let container; +let camera, scene, renderer; +let controls, group; +let enableSelection = false; + +const objects = []; + +const mouse = new THREE.Vector2(), + raycaster = new THREE.Raycaster(); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 500); + camera.position.z = 25; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + scene.add(new THREE.AmbientLight(0xaaaaaa)); + + const light = new THREE.SpotLight(0xffffff, 10000); + light.position.set(0, 25, 50); + light.angle = Math.PI / 9; + + light.castShadow = true; + light.shadow.camera.near = 10; + light.shadow.camera.far = 100; + light.shadow.mapSize.width = 1024; + light.shadow.mapSize.height = 1024; + + scene.add(light); + + group = new THREE.Group(); + scene.add(group); + + const geometry = new THREE.BoxGeometry(); + + for (let i = 0; i < 200; i++) { + const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); + + object.position.x = Math.random() * 30 - 15; + object.position.y = Math.random() * 15 - 7.5; + object.position.z = Math.random() * 20 - 10; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.x = Math.random() * 2 + 1; + object.scale.y = Math.random() * 2 + 1; + object.scale.z = Math.random() * 2 + 1; + + object.castShadow = true; + object.receiveShadow = true; + + scene.add(object); + + objects.push(object); + } + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + + container.appendChild(renderer.domElement); + + controls = new DragControls([...objects], camera, renderer.domElement); + controls.rotateSpeed = 2; + controls.addEventListener('drag', render); + + // + + window.addEventListener('resize', onWindowResize); + + document.addEventListener('click', onClick); + window.addEventListener('keydown', onKeyDown); + window.addEventListener('keyup', onKeyUp); + + render(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function onKeyDown(event) { + enableSelection = event.keyCode === 16 ? true : false; + + if (event.keyCode === 77) { + controls.touches.ONE = controls.touches.ONE === THREE.TOUCH.PAN ? THREE.TOUCH.ROTATE : THREE.TOUCH.PAN; + } +} + +function onKeyUp() { + enableSelection = false; +} + +function onClick(event) { + event.preventDefault(); + + if (enableSelection === true) { + const draggableObjects = controls.objects; + draggableObjects.length = 0; + + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; + + raycaster.setFromCamera(mouse, camera); + + const intersections = raycaster.intersectObjects(objects, true); + + if (intersections.length > 0) { + const object = intersections[0].object; + + if (group.children.includes(object) === true) { + object.material.emissive.set(0x000000); + scene.attach(object); + } else { + object.material.emissive.set(0xaaaaaa); + group.attach(object); + } + + controls.transformGroup = true; + draggableObjects.push(group); + } + + if (group.children.length === 0) { + controls.transformGroup = false; + draggableObjects.push(...objects); + } + } + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/misc_controls_fly.ts b/examples-testing/examples/misc_controls_fly.ts new file mode 100644 index 000000000..b47be6f1d --- /dev/null +++ b/examples-testing/examples/misc_controls_fly.ts @@ -0,0 +1,219 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; +import { film } from 'three/addons/tsl/display/FilmNode.js'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { FlyControls } from 'three/addons/controls/FlyControls.js'; + +const radius = 6371; +const tilt = 0.41; +const rotationSpeed = 0.02; + +const cloudsScale = 1.005; +const moonScale = 0.23; + +const MARGIN = 0; +let SCREEN_HEIGHT = window.innerHeight - MARGIN * 2; +let SCREEN_WIDTH = window.innerWidth; + +let camera, controls, scene, renderer, stats; +let geometry, meshPlanet, meshClouds, meshMoon; +let dirLight; + +let renderPipeline; + +const textureLoader = new THREE.TextureLoader(); + +let d, dPlanet, dMoon; +const dMoonVec = new THREE.Vector3(); + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(25, SCREEN_WIDTH / SCREEN_HEIGHT, 50, 1e7); + camera.position.z = radius * 5; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + scene.fog = new THREE.FogExp2(0x000000, 0.00000025); + + dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(-1, 0, 1).normalize(); + scene.add(dirLight); + + const materialNormalMap = new THREE.MeshPhongMaterial({ + specular: 0x7c7c7c, + shininess: 15, + map: textureLoader.load('textures/planets/earth_atmos_2048.jpg'), + specularMap: textureLoader.load('textures/planets/earth_specular_2048.jpg'), + normalMap: textureLoader.load('textures/planets/earth_normal_2048.jpg'), + + // y scale is negated to compensate for normal map handedness. + normalScale: new THREE.Vector2(0.85, -0.85), + }); + materialNormalMap.map.colorSpace = THREE.SRGBColorSpace; + + // planet + + geometry = new THREE.SphereGeometry(radius, 100, 50); + + meshPlanet = new THREE.Mesh(geometry, materialNormalMap); + meshPlanet.rotation.y = 0; + meshPlanet.rotation.z = tilt; + scene.add(meshPlanet); + + // clouds + + const materialClouds = new THREE.MeshLambertMaterial({ + map: textureLoader.load('textures/planets/earth_clouds_1024.png'), + transparent: true, + }); + materialClouds.map.colorSpace = THREE.SRGBColorSpace; + + meshClouds = new THREE.Mesh(geometry, materialClouds); + meshClouds.scale.set(cloudsScale, cloudsScale, cloudsScale); + meshClouds.rotation.z = tilt; + scene.add(meshClouds); + + // moon + + const materialMoon = new THREE.MeshPhongMaterial({ + map: textureLoader.load('textures/planets/moon_1024.jpg'), + }); + materialMoon.map.colorSpace = THREE.SRGBColorSpace; + + meshMoon = new THREE.Mesh(geometry, materialMoon); + meshMoon.position.set(radius * 5, 0, 0); + meshMoon.scale.set(moonScale, moonScale, moonScale); + scene.add(meshMoon); + + // stars + + const r = radius, + starsGeometry = [new THREE.BufferGeometry(), new THREE.BufferGeometry()]; + + const vertices1 = []; + const vertices2 = []; + + const vertex = new THREE.Vector3(); + + for (let i = 0; i < 250; i++) { + vertex.x = Math.random() * 2 - 1; + vertex.y = Math.random() * 2 - 1; + vertex.z = Math.random() * 2 - 1; + vertex.multiplyScalar(r); + + vertices1.push(vertex.x, vertex.y, vertex.z); + } + + for (let i = 0; i < 1500; i++) { + vertex.x = Math.random() * 2 - 1; + vertex.y = Math.random() * 2 - 1; + vertex.z = Math.random() * 2 - 1; + vertex.multiplyScalar(r); + + vertices2.push(vertex.x, vertex.y, vertex.z); + } + + starsGeometry[0].setAttribute('position', new THREE.Float32BufferAttribute(vertices1, 3)); + starsGeometry[1].setAttribute('position', new THREE.Float32BufferAttribute(vertices2, 3)); + + const starsMaterials = [ + new THREE.PointsMaterial({ color: 0x9c9c9c }), + new THREE.PointsMaterial({ color: 0x838383 }), + new THREE.PointsMaterial({ color: 0x5a5a5a }), + ]; + + for (let i = 10; i < 30; i++) { + const stars = new THREE.Points(starsGeometry[i % 2], starsMaterials[i % 3]); + + stars.rotation.x = Math.random() * 6; + stars.rotation.y = Math.random() * 6; + stars.rotation.z = Math.random() * 6; + stars.scale.setScalar(i * 10); + + stars.matrixAutoUpdate = false; + stars.updateMatrix(); + + scene.add(stars); + } + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + controls = new FlyControls(camera, renderer.domElement); + + controls.movementSpeed = 1000; + controls.domElement = renderer.domElement; + controls.rollSpeed = Math.PI / 24; + controls.autoForward = false; + controls.dragToLook = false; + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode(); + + renderPipeline.outputNode = film(scenePassColor); +} + +function onWindowResize() { + SCREEN_HEIGHT = window.innerHeight; + SCREEN_WIDTH = window.innerWidth; + + camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + camera.updateProjectionMatrix(); + + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); +} + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + // rotate the planet and clouds + + const delta = timer.getDelta(); + + meshPlanet.rotation.y += rotationSpeed * delta; + meshClouds.rotation.y += 1.25 * rotationSpeed * delta; + + // slow down as we approach the surface + + dPlanet = camera.position.length(); + + dMoonVec.subVectors(camera.position, meshMoon.position); + dMoon = dMoonVec.length(); + + if (dMoon < dPlanet) { + d = dMoon - radius * moonScale * 1.01; + } else { + d = dPlanet - radius * 1.01; + } + + controls.movementSpeed = 0.33 * d; + controls.update(delta); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/misc_controls_map.ts b/examples-testing/examples/misc_controls_map.ts new file mode 100644 index 000000000..9c7af0cda --- /dev/null +++ b/examples-testing/examples/misc_controls_map.ts @@ -0,0 +1,102 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { MapControls } from 'three/addons/controls/MapControls.js'; + +let camera, controls, scene, renderer; + +init(); +//render(); // remove when using animation loop + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xcccccc); + scene.fog = new THREE.FogExp2(0xcccccc, 0.002); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 200, -200); + + // controls + + controls = new MapControls(camera, renderer.domElement); + + //controls.addEventListener( 'change', render ); // call this only in static scenes (i.e., if there is no animation loop) + + controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled + controls.dampingFactor = 0.05; + + controls.screenSpacePanning = false; + + controls.minDistance = 100; + controls.maxDistance = 500; + + controls.maxPolarAngle = Math.PI / 2; + + // world + + const geometry = new THREE.BoxGeometry(); + geometry.translate(0, 0.5, 0); + const material = new THREE.MeshPhongMaterial({ color: 0xeeeeee, flatShading: true }); + + const mesh = new THREE.InstancedMesh(geometry, material, 500); + const dummy = new THREE.Object3D(); + + for (let i = 0; i < 500; i++) { + dummy.position.x = Math.random() * 1600 - 800; + dummy.position.y = 0; + dummy.position.z = Math.random() * 1600 - 800; + dummy.scale.x = 20; + dummy.scale.y = Math.random() * 80 + 10; + dummy.scale.z = 20; + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + } + + scene.add(mesh); + + // lights + + const dirLight1 = new THREE.DirectionalLight(0xffffff, 3); + dirLight1.position.set(1, 1, 1); + scene.add(dirLight1); + + const dirLight2 = new THREE.DirectionalLight(0x002288, 3); + dirLight2.position.set(-1, -1, -1); + scene.add(dirLight2); + + const ambientLight = new THREE.AmbientLight(0x555555); + scene.add(ambientLight); + + // + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + gui.add(controls, 'zoomToCursor'); + gui.add(controls, 'screenSpacePanning'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); // only required if controls.enableDamping = true, or if controls.autoRotate = true + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/misc_controls_orbit.ts b/examples-testing/examples/misc_controls_orbit.ts new file mode 100644 index 000000000..7d2ec2626 --- /dev/null +++ b/examples-testing/examples/misc_controls_orbit.ts @@ -0,0 +1,95 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, controls, scene, renderer; + +init(); +//render(); // remove when using animation loop + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xcccccc); + scene.fog = new THREE.FogExp2(0xcccccc, 0.002); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(400, 200, 0); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.listenToKeyEvents(window); // optional + + //controls.addEventListener( 'change', render ); // call this only in static scenes (i.e., if there is no animation loop) + + controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled + controls.dampingFactor = 0.05; + + controls.screenSpacePanning = false; + + controls.minDistance = 100; + controls.maxDistance = 500; + + controls.cursorStyle = 'grab'; + + controls.maxPolarAngle = Math.PI / 2; + + // world + + const geometry = new THREE.ConeGeometry(10, 30, 4, 1); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); + + const mesh = new THREE.InstancedMesh(geometry, material, 500); + const dummy = new THREE.Object3D(); + + for (let i = 0; i < 500; i++) { + dummy.position.x = Math.random() * 1600 - 800; + dummy.position.y = 0; + dummy.position.z = Math.random() * 1600 - 800; + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + } + + scene.add(mesh); + + // lights + + const dirLight1 = new THREE.DirectionalLight(0xffffff, 3); + dirLight1.position.set(1, 1, 1); + scene.add(dirLight1); + + const dirLight2 = new THREE.DirectionalLight(0x002288, 3); + dirLight2.position.set(-1, -1, -1); + scene.add(dirLight2); + + const ambientLight = new THREE.AmbientLight(0x555555); + scene.add(ambientLight); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); // only required if controls.enableDamping = true, or if controls.autoRotate = true + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/misc_controls_pointerlock.ts b/examples-testing/examples/misc_controls_pointerlock.ts new file mode 100644 index 000000000..0b6fcc516 --- /dev/null +++ b/examples-testing/examples/misc_controls_pointerlock.ts @@ -0,0 +1,245 @@ +import * as THREE from 'three'; + +import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js'; + +let camera, scene, renderer, controls; + +const objects = []; + +let raycaster; + +let moveForward = false; +let moveBackward = false; +let moveLeft = false; +let moveRight = false; +let canJump = false; + +let prevTime = performance.now(); +const velocity = new THREE.Vector3(); +const direction = new THREE.Vector3(); +const vertex = new THREE.Vector3(); +const color = new THREE.Color(); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.y = 10; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + scene.fog = new THREE.Fog(0xffffff, 0, 750); + + const light = new THREE.HemisphereLight(0xeeeeff, 0x777788, 2.5); + light.position.set(0.5, 1, 0.75); + scene.add(light); + + controls = new PointerLockControls(camera, document.body); + + const blocker = document.getElementById('blocker'); + const instructions = document.getElementById('instructions'); + + instructions.addEventListener('click', function () { + controls.lock(); + }); + + controls.addEventListener('lock', function () { + instructions.style.display = 'none'; + blocker.style.display = 'none'; + }); + + controls.addEventListener('unlock', function () { + blocker.style.display = 'block'; + instructions.style.display = ''; + }); + + scene.add(controls.object); + + const onKeyDown = function (event) { + switch (event.code) { + case 'ArrowUp': + case 'KeyW': + moveForward = true; + break; + + case 'ArrowLeft': + case 'KeyA': + moveLeft = true; + break; + + case 'ArrowDown': + case 'KeyS': + moveBackward = true; + break; + + case 'ArrowRight': + case 'KeyD': + moveRight = true; + break; + + case 'Space': + if (canJump === true) velocity.y += 350; + canJump = false; + break; + } + }; + + const onKeyUp = function (event) { + switch (event.code) { + case 'ArrowUp': + case 'KeyW': + moveForward = false; + break; + + case 'ArrowLeft': + case 'KeyA': + moveLeft = false; + break; + + case 'ArrowDown': + case 'KeyS': + moveBackward = false; + break; + + case 'ArrowRight': + case 'KeyD': + moveRight = false; + break; + } + }; + + document.addEventListener('keydown', onKeyDown); + document.addEventListener('keyup', onKeyUp); + + raycaster = new THREE.Raycaster(new THREE.Vector3(), new THREE.Vector3(0, -1, 0), 0, 10); + + // floor + + let floorGeometry = new THREE.PlaneGeometry(2000, 2000, 100, 100); + floorGeometry.rotateX(-Math.PI / 2); + + // vertex displacement + + let position = floorGeometry.attributes.position; + + for (let i = 0, l = position.count; i < l; i++) { + vertex.fromBufferAttribute(position, i); + + vertex.x += Math.random() * 20 - 10; + vertex.y += Math.random() * 2; + vertex.z += Math.random() * 20 - 10; + + position.setXYZ(i, vertex.x, vertex.y, vertex.z); + } + + floorGeometry = floorGeometry.toNonIndexed(); // ensure each face has unique vertices + + position = floorGeometry.attributes.position; + const colorsFloor = []; + + for (let i = 0, l = position.count; i < l; i++) { + color.setHSL(Math.random() * 0.3 + 0.5, 0.75, Math.random() * 0.25 + 0.75, THREE.SRGBColorSpace); + colorsFloor.push(color.r, color.g, color.b); + } + + floorGeometry.setAttribute('color', new THREE.Float32BufferAttribute(colorsFloor, 3)); + + const floorMaterial = new THREE.MeshBasicMaterial({ vertexColors: true }); + + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + scene.add(floor); + + // objects + + const boxGeometry = new THREE.BoxGeometry(20, 20, 20).toNonIndexed(); + + position = boxGeometry.attributes.position; + const colorsBox = []; + + for (let i = 0, l = position.count; i < l; i++) { + color.setHSL(Math.random() * 0.3 + 0.5, 0.75, Math.random() * 0.25 + 0.75, THREE.SRGBColorSpace); + colorsBox.push(color.r, color.g, color.b); + } + + boxGeometry.setAttribute('color', new THREE.Float32BufferAttribute(colorsBox, 3)); + + for (let i = 0; i < 500; i++) { + const boxMaterial = new THREE.MeshPhongMaterial({ specular: 0xffffff, flatShading: true, vertexColors: true }); + boxMaterial.color.setHSL(Math.random() * 0.2 + 0.5, 0.75, Math.random() * 0.25 + 0.75, THREE.SRGBColorSpace); + + const box = new THREE.Mesh(boxGeometry, boxMaterial); + box.position.x = Math.floor(Math.random() * 20 - 10) * 20; + box.position.y = Math.floor(Math.random() * 20) * 20 + 10; + box.position.z = Math.floor(Math.random() * 20 - 10) * 20; + + scene.add(box); + objects.push(box); + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now(); + + if (controls.isLocked === true) { + raycaster.ray.origin.copy(controls.object.position); + raycaster.ray.origin.y -= 10; + + const intersections = raycaster.intersectObjects(objects, false); + + const onObject = intersections.length > 0; + + const delta = (time - prevTime) / 1000; + + velocity.x -= velocity.x * 10.0 * delta; + velocity.z -= velocity.z * 10.0 * delta; + + velocity.y -= 9.8 * 100.0 * delta; // 100.0 = mass + + direction.z = Number(moveForward) - Number(moveBackward); + direction.x = Number(moveRight) - Number(moveLeft); + direction.normalize(); // this ensures consistent movements in all directions + + if (moveForward || moveBackward) velocity.z -= direction.z * 400.0 * delta; + if (moveLeft || moveRight) velocity.x -= direction.x * 400.0 * delta; + + if (onObject === true) { + velocity.y = Math.max(0, velocity.y); + canJump = true; + } + + controls.moveRight(-velocity.x * delta); + controls.moveForward(-velocity.z * delta); + + controls.object.position.y += velocity.y * delta; // new behavior + + if (controls.object.position.y < 10) { + velocity.y = 0; + controls.object.position.y = 10; + + canJump = true; + } + } + + prevTime = time; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/misc_controls_trackball.ts b/examples-testing/examples/misc_controls_trackball.ts new file mode 100644 index 000000000..da24a8e8d --- /dev/null +++ b/examples-testing/examples/misc_controls_trackball.ts @@ -0,0 +1,147 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; + +let perspectiveCamera, orthographicCamera, controls, scene, renderer, stats; + +const params = { + orthographicCamera: false, + multiTouchRoll: false, +}; + +const frustumSize = 400; + +init(); + +function init() { + const aspect = window.innerWidth / window.innerHeight; + + perspectiveCamera = new THREE.PerspectiveCamera(60, aspect, 1, 1000); + perspectiveCamera.position.z = 500; + + orthographicCamera = new THREE.OrthographicCamera( + (frustumSize * aspect) / -2, + (frustumSize * aspect) / 2, + frustumSize / 2, + frustumSize / -2, + 1, + 1000, + ); + orthographicCamera.position.z = 500; + + // world + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xcccccc); + scene.fog = new THREE.FogExp2(0xcccccc, 0.002); + + const geometry = new THREE.ConeGeometry(10, 30, 4, 1); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); + + const mesh = new THREE.InstancedMesh(geometry, material, 500); + const dummy = new THREE.Object3D(); + + for (let i = 0; i < 500; i++) { + dummy.position.x = (Math.random() - 0.5) * 1000; + dummy.position.y = (Math.random() - 0.5) * 1000; + dummy.position.z = (Math.random() - 0.5) * 1000; + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + } + + scene.add(mesh); + + // lights + + const dirLight1 = new THREE.DirectionalLight(0xffffff, 3); + dirLight1.position.set(1, 1, 1); + scene.add(dirLight1); + + const dirLight2 = new THREE.DirectionalLight(0x002288, 3); + dirLight2.position.set(-1, -1, -1); + scene.add(dirLight2); + + const ambientLight = new THREE.AmbientLight(0x555555); + scene.add(ambientLight); + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + const gui = new GUI(); + gui.add(params, 'orthographicCamera') + .name('use orthographic') + .onChange(function (value) { + controls.dispose(); + + createControls(value ? orthographicCamera : perspectiveCamera); + }); + + gui.add(params, 'multiTouchRoll') + .name('multi touch roll') + .onChange(function (value) { + controls.multiTouchRoll = value; + }); + + // + + window.addEventListener('resize', onWindowResize); + + createControls(perspectiveCamera); +} + +function createControls(camera) { + controls = new TrackballControls(camera, renderer.domElement); + + controls.rotateSpeed = 1.0; + controls.zoomSpeed = 1.2; + controls.panSpeed = 0.8; + + controls.multiTouchRoll = params.multiTouchRoll; + + controls.keys = ['KeyA', 'KeyS', 'KeyD']; +} + +function onWindowResize() { + const aspect = window.innerWidth / window.innerHeight; + + perspectiveCamera.aspect = aspect; + perspectiveCamera.updateProjectionMatrix(); + + orthographicCamera.left = (-frustumSize * aspect) / 2; + orthographicCamera.right = (frustumSize * aspect) / 2; + orthographicCamera.top = frustumSize / 2; + orthographicCamera.bottom = -frustumSize / 2; + orthographicCamera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + controls.handleResize(); +} + +function animate() { + controls.update(); + + render(); + + stats.update(); +} + +function render() { + const camera = params.orthographicCamera ? orthographicCamera : perspectiveCamera; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/misc_controls_transform.ts b/examples-testing/examples/misc_controls_transform.ts new file mode 100644 index 000000000..6f7793d33 --- /dev/null +++ b/examples-testing/examples/misc_controls_transform.ts @@ -0,0 +1,182 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TransformControls } from 'three/addons/controls/TransformControls.js'; + +let cameraPersp, cameraOrtho, currentCamera; +let scene, renderer, control, orbit; + +init(); +render(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + const aspect = window.innerWidth / window.innerHeight; + + const frustumSize = 5; + + cameraPersp = new THREE.PerspectiveCamera(50, aspect, 0.1, 100); + cameraOrtho = new THREE.OrthographicCamera( + -frustumSize * aspect, + frustumSize * aspect, + frustumSize, + -frustumSize, + 0.1, + 100, + ); + currentCamera = cameraPersp; + + currentCamera.position.set(5, 2.5, 5); + + scene = new THREE.Scene(); + scene.add(new THREE.GridHelper(5, 10, 0x888888, 0x444444)); + + const ambientLight = new THREE.AmbientLight(0xffffff); + scene.add(ambientLight); + + const light = new THREE.DirectionalLight(0xffffff, 4); + light.position.set(1, 1, 1); + scene.add(light); + + const texture = new THREE.TextureLoader().load('textures/crate.gif', render); + texture.colorSpace = THREE.SRGBColorSpace; + texture.anisotropy = renderer.capabilities.getMaxAnisotropy(); + + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshLambertMaterial({ map: texture }); + + orbit = new OrbitControls(currentCamera, renderer.domElement); + orbit.update(); + orbit.addEventListener('change', render); + + control = new TransformControls(currentCamera, renderer.domElement); + control.addEventListener('change', render); + control.addEventListener('dragging-changed', function (event) { + orbit.enabled = !event.value; + }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + control.attach(mesh); + + const gizmo = control.getHelper(); + scene.add(gizmo); + + window.addEventListener('resize', onWindowResize); + + window.addEventListener('keydown', function (event) { + switch (event.key) { + case 'q': + control.setSpace(control.space === 'local' ? 'world' : 'local'); + break; + + case 'Shift': + control.setTranslationSnap(1); + control.setRotationSnap(THREE.MathUtils.degToRad(15)); + control.setScaleSnap(0.25); + break; + + case 'w': + control.setMode('translate'); + break; + + case 'e': + control.setMode('rotate'); + break; + + case 'r': + control.setMode('scale'); + break; + + case 'c': + const position = currentCamera.position.clone(); + + currentCamera = currentCamera.isPerspectiveCamera ? cameraOrtho : cameraPersp; + currentCamera.position.copy(position); + + orbit.object = currentCamera; + control.camera = currentCamera; + + currentCamera.lookAt(orbit.target.x, orbit.target.y, orbit.target.z); + onWindowResize(); + break; + + case 'v': + const randomFoV = Math.random() + 0.1; + const randomZoom = Math.random() + 0.1; + + cameraPersp.fov = randomFoV * 160; + cameraOrtho.bottom = -randomFoV * 500; + cameraOrtho.top = randomFoV * 500; + + cameraPersp.zoom = randomZoom * 5; + cameraOrtho.zoom = randomZoom * 5; + onWindowResize(); + break; + + case '+': + case '=': + control.setSize(control.size + 0.1); + break; + + case '-': + case '_': + control.setSize(Math.max(control.size - 0.1, 0.1)); + break; + + case 'x': + control.showX = !control.showX; + break; + + case 'y': + control.showY = !control.showY; + break; + + case 'z': + control.showZ = !control.showZ; + break; + + case ' ': + control.enabled = !control.enabled; + break; + + case 'Escape': + control.reset(); + break; + } + }); + + window.addEventListener('keyup', function (event) { + switch (event.key) { + case 'Shift': + control.setTranslationSnap(null); + control.setRotationSnap(null); + control.setScaleSnap(null); + break; + } + }); +} + +function onWindowResize() { + const aspect = window.innerWidth / window.innerHeight; + + cameraPersp.aspect = aspect; + cameraPersp.updateProjectionMatrix(); + + cameraOrtho.left = cameraOrtho.bottom * aspect; + cameraOrtho.right = cameraOrtho.top * aspect; + cameraOrtho.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, currentCamera); +} diff --git a/examples-testing/examples/misc_exporter_draco.ts b/examples-testing/examples/misc_exporter_draco.ts new file mode 100644 index 000000000..4d1398eaa --- /dev/null +++ b/examples-testing/examples/misc_exporter_draco.ts @@ -0,0 +1,117 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer, exporter, mesh; + +const params = { + export: exportFile, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(4, 2, 4); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 4, 20); + + exporter = new DRACOExporter(); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 3); + hemiLight.position.set(0, 20, 0); + scene.add(hemiLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 3); + directionalLight.position.set(0, 20, 10); + directionalLight.castShadow = true; + directionalLight.shadow.camera.top = 2; + directionalLight.shadow.camera.bottom = -2; + directionalLight.shadow.camera.left = -2; + directionalLight.shadow.camera.right = 2; + scene.add(directionalLight); + + // ground + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(40, 40), + new THREE.MeshPhongMaterial({ color: 0xbbbbbb, depthWrite: false }), + ); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + const grid = new THREE.GridHelper(40, 20, 0x000000, 0x000000); + grid.material.opacity = 0.2; + grid.material.transparent = true; + scene.add(grid); + + // export mesh + + const geometry = new THREE.TorusKnotGeometry(0.75, 0.2, 200, 30); + const material = new THREE.MeshPhongMaterial({ color: 0x00ff00 }); + mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + mesh.position.y = 1.5; + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1.5, 0); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'export').name('Export DRC'); + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} + +async function exportFile() { + const result = await exporter.parseAsync(mesh); + saveArrayBuffer(result, 'file.drc'); +} + +const link = document.createElement('a'); +link.style.display = 'none'; +document.body.appendChild(link); + +function save(blob, filename) { + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); +} + +function saveArrayBuffer(buffer, filename) { + save(new Blob([buffer], { type: 'application/octet-stream' }), filename); +} diff --git a/examples-testing/examples/misc_exporter_exr.ts b/examples-testing/examples/misc_exporter_exr.ts new file mode 100644 index 000000000..014ea58a0 --- /dev/null +++ b/examples-testing/examples/misc_exporter_exr.ts @@ -0,0 +1,158 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { EXRExporter, ZIP_COMPRESSION, ZIPS_COMPRESSION, NO_COMPRESSION } from 'three/addons/exporters/EXRExporter.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer, exporter, mesh, controls, renderTarget, dataTexture; + +const params = { + target: 'pmrem', + type: 'HalfFloatType', + compression: 'ZIP', + export: exportFile, +}; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(10, 0, 0); + + scene = new THREE.Scene(); + + exporter = new EXRExporter(); + const hdrLoader = new HDRLoader(); + + // + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + pmremGenerator.compileEquirectangularShader(); + + hdrLoader.load('textures/equirectangular/san_giuseppe_bridge_2k.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + renderTarget = pmremGenerator.fromEquirectangular(texture); + scene.background = renderTarget.texture; + }); + + createDataTexture(); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.rotateSpeed = -0.25; // negative, to track mouse pointer + + // + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + const input = gui.addFolder('Input'); + input.add(params, 'target').options(['pmrem', 'data-texture']).onChange(swapScene); + + const options = gui.addFolder('Output Options'); + options.add(params, 'type').options(['FloatType', 'HalfFloatType']); + options.add(params, 'compression').options(['ZIP', 'ZIPS', 'NONE']); + + gui.add(params, 'export').name('Export EXR'); + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + renderer.render(scene, camera); +} + +function createDataTexture() { + const normal = new THREE.Vector3(); + const coord = new THREE.Vector2(); + const size = 800, + radius = 320, + factor = (Math.PI * 0.5) / radius; + const data = new Float32Array(4 * size * size); + + for (let i = 0; i < size; i++) { + for (let j = 0; j < size; j++) { + const idx = i * size * 4 + j * 4; + coord.set(j, i).subScalar(size / 2); + + if (coord.length() < radius) + normal.set(Math.sin(coord.x * factor), Math.sin(coord.y * factor), Math.cos(coord.x * factor)); + else normal.set(0, 0, 1); + + data[idx + 0] = 0.5 + 0.5 * normal.x; + data[idx + 1] = 0.5 + 0.5 * normal.y; + data[idx + 2] = 0.5 + 0.5 * normal.z; + data[idx + 3] = 1; + } + } + + dataTexture = new THREE.DataTexture(data, size, size, THREE.RGBAFormat, THREE.FloatType); + dataTexture.needsUpdate = true; + + const material = new THREE.MeshBasicMaterial({ map: dataTexture }); + const quad = new THREE.PlaneGeometry(50, 50); + mesh = new THREE.Mesh(quad, material); + mesh.visible = false; + + scene.add(mesh); +} + +function swapScene() { + if (params.target == 'pmrem') { + camera.position.set(10, 0, 0); + controls.enabled = true; + scene.background = renderTarget.texture; + mesh.visible = false; + } else { + camera.position.set(0, 0, 70); + controls.enabled = false; + scene.background = new THREE.Color(0, 0, 0); + mesh.visible = true; + } +} + +async function exportFile() { + let result, exportType, exportCompression; + + if (params.type == 'HalfFloatType') exportType = THREE.HalfFloatType; + else exportType = THREE.FloatType; + + if (params.compression == 'ZIP') exportCompression = ZIP_COMPRESSION; + else if (params.compression == 'ZIPS') exportCompression = ZIPS_COMPRESSION; + else exportCompression = NO_COMPRESSION; + + if (params.target == 'pmrem') + result = await exporter.parse(renderer, renderTarget, { type: exportType, compression: exportCompression }); + else result = await exporter.parse(dataTexture, { type: exportType, compression: exportCompression }); + + saveArrayBuffer(result, params.target + '.exr'); +} + +function saveArrayBuffer(buffer, filename) { + const blob = new Blob([buffer], { type: 'image/x-exr' }); + const link = document.createElement('a'); + + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); +} diff --git a/examples-testing/examples/misc_exporter_gltf.ts b/examples-testing/examples/misc_exporter_gltf.ts new file mode 100644 index 000000000..c19eb94a6 --- /dev/null +++ b/examples-testing/examples/misc_exporter_gltf.ts @@ -0,0 +1,534 @@ +import * as THREE from 'three'; + +import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import * as TextureUtils from 'three/addons/utils/WebGLTextureUtils.js'; + +function exportGLTF(input) { + const gltfExporter = new GLTFExporter().setTextureUtils(TextureUtils); + + const options = { + trs: params.trs, + onlyVisible: params.onlyVisible, + binary: params.binary, + maxTextureSize: params.maxTextureSize, + }; + gltfExporter.parse( + input, + function (result) { + if (result instanceof ArrayBuffer) { + saveArrayBuffer(result, 'scene.glb'); + } else { + const output = JSON.stringify(result, null, 2); + console.log(output); + saveString(output, 'scene.gltf'); + } + }, + function (error) { + console.log('An error happened during parsing', error); + }, + options, + ); +} + +const link = document.createElement('a'); +link.style.display = 'none'; +document.body.appendChild(link); // Firefox workaround, see #6594 + +function save(blob, filename) { + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); + + // URL.revokeObjectURL( url ); breaks Firefox... +} + +function saveString(text, filename) { + save(new Blob([text], { type: 'text/plain' }), filename); +} + +function saveArrayBuffer(buffer, filename) { + save(new Blob([buffer], { type: 'application/octet-stream' }), filename); +} + +let container; + +let camera, object, object2, material, geometry, scene1, scene2, renderer; +let gridHelper, sphere, model, coffeemat, webpBox; + +const params = { + trs: false, + onlyVisible: true, + binary: false, + maxTextureSize: 4096, + exportScene1: exportScene1, + exportScenes: exportScenes, + exportSphere: exportSphere, + exportModel: exportModel, + exportObjects: exportObjects, + exportSceneObject: exportSceneObject, + exportCompressedObject: exportCompressedObject, + exportWebPModel: exportWebPModel, +}; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // Make linear gradient texture + + const data = new Uint8ClampedArray(100 * 100 * 4); + + for (let y = 0; y < 100; y++) { + for (let x = 0; x < 100; x++) { + const stride = 4 * (100 * y + x); + + data[stride] = Math.round((255 * y) / 99); + data[stride + 1] = Math.round(255 - (255 * y) / 99); + data[stride + 2] = 0; + data[stride + 3] = 255; + } + } + + const gradientTexture = new THREE.DataTexture(data, 100, 100, THREE.RGBAFormat); + gradientTexture.minFilter = THREE.LinearFilter; + gradientTexture.magFilter = THREE.LinearFilter; + gradientTexture.needsUpdate = true; + + scene1 = new THREE.Scene(); + scene1.name = 'Scene1'; + + // --------------------------------------------------------------------- + // Perspective Camera + // --------------------------------------------------------------------- + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(600, 400, 0); + + camera.name = 'PerspectiveCamera'; + scene1.add(camera); + + // --------------------------------------------------------------------- + // Ambient light + // --------------------------------------------------------------------- + const ambientLight = new THREE.AmbientLight(0xcccccc); + ambientLight.name = 'AmbientLight'; + scene1.add(ambientLight); + + // --------------------------------------------------------------------- + // DirectLight + // --------------------------------------------------------------------- + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.target.position.set(0, 0, -1); + dirLight.add(dirLight.target); + dirLight.lookAt(-1, -1, 0); + dirLight.name = 'DirectionalLight'; + scene1.add(dirLight); + + // --------------------------------------------------------------------- + // Grid + // --------------------------------------------------------------------- + gridHelper = new THREE.GridHelper(2000, 20, 0xc1c1c1, 0x8d8d8d); + gridHelper.position.y = -50; + gridHelper.name = 'Grid'; + scene1.add(gridHelper); + + // --------------------------------------------------------------------- + // Axes + // --------------------------------------------------------------------- + const axes = new THREE.AxesHelper(500); + axes.name = 'AxesHelper'; + scene1.add(axes); + + // --------------------------------------------------------------------- + // Simple geometry with basic material + // --------------------------------------------------------------------- + // Icosahedron + const mapGrid = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); + mapGrid.wrapS = mapGrid.wrapT = THREE.RepeatWrapping; + mapGrid.colorSpace = THREE.SRGBColorSpace; + material = new THREE.MeshBasicMaterial({ + color: 0xffffff, + map: mapGrid, + }); + + object = new THREE.Mesh(new THREE.IcosahedronGeometry(75, 0), material); + object.position.set(-200, 0, 200); + object.name = 'Icosahedron'; + scene1.add(object); + + // Octahedron + material = new THREE.MeshBasicMaterial({ + color: 0x0000ff, + wireframe: true, + }); + object = new THREE.Mesh(new THREE.OctahedronGeometry(75, 1), material); + object.position.set(0, 0, 200); + object.name = 'Octahedron'; + scene1.add(object); + + // Tetrahedron + material = new THREE.MeshBasicMaterial({ + color: 0xff0000, + transparent: true, + opacity: 0.5, + }); + + object = new THREE.Mesh(new THREE.TetrahedronGeometry(75, 0), material); + object.position.set(200, 0, 200); + object.name = 'Tetrahedron'; + scene1.add(object); + + // --------------------------------------------------------------------- + // Buffered geometry primitives + // --------------------------------------------------------------------- + // Sphere + material = new THREE.MeshStandardMaterial({ + color: 0xffff00, + metalness: 0.5, + roughness: 1.0, + flatShading: true, + }); + material.map = gradientTexture; + material.bumpMap = mapGrid; + sphere = new THREE.Mesh(new THREE.SphereGeometry(70, 10, 10), material); + sphere.position.set(0, 0, 0); + sphere.name = 'Sphere'; + scene1.add(sphere); + + // Cylinder + material = new THREE.MeshStandardMaterial({ + color: 0xff00ff, + flatShading: true, + }); + object = new THREE.Mesh(new THREE.CylinderGeometry(10, 80, 100), material); + object.position.set(200, 0, 0); + object.name = 'Cylinder'; + scene1.add(object); + + // TorusKnot + material = new THREE.MeshStandardMaterial({ + color: 0xff0000, + roughness: 1, + }); + object = new THREE.Mesh(new THREE.TorusKnotGeometry(50, 15, 40, 10), material); + object.position.set(-200, 0, 0); + object.name = 'Cylinder'; + scene1.add(object); + + // --------------------------------------------------------------------- + // Hierarchy + // --------------------------------------------------------------------- + const mapWood = new THREE.TextureLoader().load('textures/hardwood2_diffuse.jpg'); + material = new THREE.MeshStandardMaterial({ map: mapWood, side: THREE.DoubleSide }); + + object = new THREE.Mesh(new THREE.BoxGeometry(40, 100, 100), material); + object.position.set(-200, 0, 400); + object.name = 'Cube'; + scene1.add(object); + + object2 = new THREE.Mesh(new THREE.BoxGeometry(40, 40, 40, 2, 2, 2), material); + object2.position.set(0, 0, 50); + object2.rotation.set(0, 45, 0); + object2.name = 'SubCube'; + object.add(object2); + + // --------------------------------------------------------------------- + // Groups + // --------------------------------------------------------------------- + const group1 = new THREE.Group(); + group1.name = 'Group'; + scene1.add(group1); + + const group2 = new THREE.Group(); + group2.name = 'subGroup'; + group2.position.set(0, 50, 0); + group1.add(group2); + + object2 = new THREE.Mesh(new THREE.BoxGeometry(30, 30, 30), material); + object2.name = 'Cube in group'; + object2.position.set(0, 0, 400); + group2.add(object2); + + // --------------------------------------------------------------------- + // THREE.Line Strip + // --------------------------------------------------------------------- + geometry = new THREE.BufferGeometry(); + let numPoints = 100; + let positions = new Float32Array(numPoints * 3); + + for (let i = 0; i < numPoints; i++) { + positions[i * 3] = i; + positions[i * 3 + 1] = Math.sin(i / 2) * 20; + positions[i * 3 + 2] = 0; + } + + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + object = new THREE.Line(geometry, new THREE.LineBasicMaterial({ color: 0xffff00 })); + object.position.set(-50, 0, -200); + scene1.add(object); + + // --------------------------------------------------------------------- + // THREE.Line Loop + // --------------------------------------------------------------------- + geometry = new THREE.BufferGeometry(); + numPoints = 5; + const radius = 70; + positions = new Float32Array(numPoints * 3); + + for (let i = 0; i < numPoints; i++) { + const s = (i * Math.PI * 2) / numPoints; + positions[i * 3] = radius * Math.sin(s); + positions[i * 3 + 1] = radius * Math.cos(s); + positions[i * 3 + 2] = 0; + } + + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + object = new THREE.LineLoop(geometry, new THREE.LineBasicMaterial({ color: 0xffff00 })); + object.position.set(0, 0, -200); + + scene1.add(object); + + // --------------------------------------------------------------------- + // THREE.Points + // --------------------------------------------------------------------- + numPoints = 100; + const pointsArray = new Float32Array(numPoints * 3); + for (let i = 0; i < numPoints; i++) { + pointsArray[3 * i] = -50 + Math.random() * 100; + pointsArray[3 * i + 1] = Math.random() * 100; + pointsArray[3 * i + 2] = -50 + Math.random() * 100; + } + + const pointsGeo = new THREE.BufferGeometry(); + pointsGeo.setAttribute('position', new THREE.BufferAttribute(pointsArray, 3)); + + const pointsMaterial = new THREE.PointsMaterial({ color: 0xffff00, size: 5 }); + const pointCloud = new THREE.Points(pointsGeo, pointsMaterial); + pointCloud.name = 'Points'; + pointCloud.position.set(-200, 0, -200); + scene1.add(pointCloud); + + // --------------------------------------------------------------------- + // Ortho camera + // --------------------------------------------------------------------- + + const height = 1000; // frustum height + const aspect = window.innerWidth / window.innerHeight; + + const cameraOrtho = new THREE.OrthographicCamera(-height * aspect, height * aspect, height, -height, 0, 2000); + cameraOrtho.position.set(600, 400, 0); + cameraOrtho.lookAt(0, 0, 0); + scene1.add(cameraOrtho); + cameraOrtho.name = 'OrthographicCamera'; + + material = new THREE.MeshLambertMaterial({ + color: 0xffff00, + side: THREE.DoubleSide, + }); + + object = new THREE.Mesh(new THREE.CircleGeometry(50, 20, 0, Math.PI * 2), material); + object.position.set(200, 0, -400); + scene1.add(object); + + object = new THREE.Mesh(new THREE.RingGeometry(10, 50, 20, 5, 0, Math.PI * 2), material); + object.position.set(0, 0, -400); + scene1.add(object); + + object = new THREE.Mesh(new THREE.CylinderGeometry(25, 75, 100, 40, 5), material); + object.position.set(-200, 0, -400); + scene1.add(object); + + // + const points = []; + + for (let i = 0; i < 50; i++) { + points.push(new THREE.Vector2(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, (i - 5) * 2)); + } + + object = new THREE.Mesh(new THREE.LatheGeometry(points, 20), material); + object.position.set(200, 0, 400); + scene1.add(object); + + // --------------------------------------------------------------------- + // Big red box hidden just for testing `onlyVisible` option + // --------------------------------------------------------------------- + material = new THREE.MeshBasicMaterial({ + color: 0xff0000, + }); + object = new THREE.Mesh(new THREE.BoxGeometry(200, 200, 200), material); + object.position.set(0, 0, 0); + object.name = 'CubeHidden'; + object.visible = false; + scene1.add(object); + + // --------------------------------------------------------------------- + // Model requiring KHR_mesh_quantization + // --------------------------------------------------------------------- + const loader = new GLTFLoader(); + loader.load('models/gltf/ShaderBall.glb', function (gltf) { + model = gltf.scene; + model.scale.setScalar(50); + model.position.set(200, -40, -200); + scene1.add(model); + }); + + // --------------------------------------------------------------------- + // Model requiring KHR_mesh_quantization + // --------------------------------------------------------------------- + + material = new THREE.MeshBasicMaterial({ + color: 0xffffff, + }); + object = new THREE.InstancedMesh(new THREE.BoxGeometry(10, 10, 10, 2, 2, 2), material, 50); + const matrix = new THREE.Matrix4(); + const color = new THREE.Color(); + for (let i = 0; i < 50; i++) { + matrix.setPosition(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); + object.setMatrixAt(i, matrix); + object.setColorAt(i, color.setHSL(i / 50, 1, 0.5)); + } + + object.position.set(400, 0, 200); + scene1.add(object); + + // --------------------------------------------------------------------- + // 2nd THREE.Scene + // --------------------------------------------------------------------- + scene2 = new THREE.Scene(); + object = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100), material); + object.position.set(0, 0, 0); + object.name = 'Cube2ndScene'; + scene2.name = 'Scene2'; + scene2.add(object); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + + container.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); + + // --------------------------------------------------------------------- + // Exporting compressed textures and meshes (KTX2 / Draco / Meshopt) + // --------------------------------------------------------------------- + const ktx2Loader = new KTX2Loader().detectSupport(renderer); + + const gltfLoader = new GLTFLoader().setPath('models/gltf/'); + gltfLoader.setKTX2Loader(ktx2Loader); + gltfLoader.setMeshoptDecoder(MeshoptDecoder); + gltfLoader.load('coffeemat.glb', function (gltf) { + gltf.scene.position.x = 400; + gltf.scene.position.z = -200; + + scene1.add(gltf.scene); + + coffeemat = gltf.scene; + }); + + // --------------------------------------------------------------------- + // Box with WebP texture (EXT_texture_webp) + // --------------------------------------------------------------------- + const canvas = document.createElement('canvas'); + canvas.width = 64; + canvas.height = 64; + const ctx = canvas.getContext('2d'); + ctx.fillStyle = '#005BBB'; + ctx.fillRect(0, 0, 64, 64); + ctx.fillStyle = '#FFD500'; + ctx.fillRect(16, 16, 32, 32); + + const webpTexture = new THREE.CanvasTexture(canvas); + webpTexture.userData.mimeType = 'image/webp'; + webpTexture.colorSpace = THREE.SRGBColorSpace; + + webpBox = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100), new THREE.MeshBasicMaterial({ map: webpTexture })); + webpBox.position.set(400, 0, 0); + webpBox.name = 'WebPBox'; + scene1.add(webpBox); + + // + + const gui = new GUI(); + + let h = gui.addFolder('Settings'); + h.add(params, 'trs').name('Use TRS'); + h.add(params, 'onlyVisible').name('Only Visible Objects'); + h.add(params, 'binary').name('Binary (GLB)'); + h.add(params, 'maxTextureSize', 2, 8192).name('Max Texture Size').step(1); + + h = gui.addFolder('Export'); + h.add(params, 'exportScene1').name('Export Scene 1'); + h.add(params, 'exportScenes').name('Export Scene 1 and 2'); + h.add(params, 'exportSphere').name('Export Sphere'); + h.add(params, 'exportModel').name('Export Model'); + h.add(params, 'exportObjects').name('Export Sphere With Grid'); + h.add(params, 'exportSceneObject').name('Export Scene 1 and Object'); + h.add(params, 'exportCompressedObject').name('Export Coffeemat (from compressed data)'); + h.add(params, 'exportWebPModel').name('Export WebP Model (EXT_texture_webp)'); + + gui.open(); +} + +function exportScene1() { + exportGLTF(scene1); +} + +function exportScenes() { + exportGLTF([scene1, scene2]); +} + +function exportSphere() { + exportGLTF(sphere); +} + +function exportModel() { + exportGLTF(model); +} + +function exportObjects() { + exportGLTF([sphere, gridHelper]); +} + +function exportSceneObject() { + exportGLTF([scene1, gridHelper]); +} + +function exportCompressedObject() { + exportGLTF([coffeemat]); +} + +function exportWebPModel() { + exportGLTF(webpBox); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const timer = Date.now() * 0.0001; + + camera.position.x = Math.cos(timer) * 800; + camera.position.z = Math.sin(timer) * 800; + + camera.lookAt(scene1.position); + renderer.render(scene1, camera); +} diff --git a/examples-testing/examples/misc_exporter_gltf_normals.ts b/examples-testing/examples/misc_exporter_gltf_normals.ts new file mode 100644 index 000000000..c2981aa33 --- /dev/null +++ b/examples-testing/examples/misc_exporter_gltf_normals.ts @@ -0,0 +1,163 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js'; + +// + +let container; + +let camera, scene, renderer; +let mesh1, mesh2; + +init(); +render(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + + container.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + scene.name = 'Scene'; + + // camera + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 150); + camera.name = 'PerspectiveCamera'; + scene.add(camera); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 100; + controls.maxDistance = 200; + + // lights + const light = new THREE.DirectionalLight(0xffffff, 4); + light.position.set(0, 1, 1); + light.name = 'DirectionalLight'; + scene.add(light); + + const light2 = new THREE.DirectionalLight(0xffffff, 4); // for back-sided objects + light2.position.set(0, 1, -1); + light2.name = 'DirectionalLight2'; + scene.add(light2); + + // geometry1 - three.js convention: uv (0,0) bottom left + const geometry1 = new THREE.PlaneGeometry(50, 50); + + // geometry2 - glTF convention: uv (0,0) top left + const geometry2 = new THREE.PlaneGeometry(50, 50); + geometry2.setAttribute('uv', new THREE.BufferAttribute(new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), 2)); + + // textures + const normalMapOpenGL = new THREE.TextureLoader().load('textures/NormalMapOpenGL.png', render); + const normalMapDirectX = new THREE.TextureLoader().load('textures/NormalMapDirectX.png', render); + + // material + const material = new THREE.MeshStandardMaterial({ + color: 0x636389, + roughness: 0.3, + normalMap: null, + normalScale: new THREE.Vector2(0.5, 0.5), + side: THREE.DoubleSide, + }); + + // pick one + // --------------------------------------------------- + const GEOMETRY = geometry1; // geometry1 or geometry2 + // --------------------------------------------------- + + // mesh1 + mesh1 = new THREE.Mesh(GEOMETRY, material.clone()); + mesh1.position.set(-30, 0, 0); + + mesh1.material.normalMap = normalMapOpenGL; + //mesh1.material.normalMap.flipY = false; // default true + //mesh1.material.normalScale.y *= - 1; // exporter ignores negative normalScale.y + + mesh1.name = 'Mesh1'; + scene.add(mesh1); + + // mesh2 + mesh2 = new THREE.Mesh(GEOMETRY, material.clone()); + mesh2.position.set(30, 0, 0); + + mesh2.material.normalMap = normalMapDirectX; + //mesh2.material.normalMap.flipY = false; // default true + mesh2.material.normalScale.y *= -1; // exporter ignores negative normalScale.y + + mesh2.name = 'Mesh2'; + scene.add(mesh2); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + renderer.render(scene, camera); +} + +// + +function exportGLTF(input) { + const gltfExporter = new GLTFExporter(); + + const options = { + binary: true, + }; + + gltfExporter.parse( + input, + function (result) { + if (result instanceof ArrayBuffer) { + saveArrayBuffer(result, 'scene.glb'); + } else { + const output = JSON.stringify(result, null, 2); + console.log(output); + saveString(output, 'scene.gltf'); + } + }, + null, + options, + ); +} + +document.getElementById('export_objects').addEventListener('click', function () { + exportGLTF([mesh1, mesh2]); +}); + +const link = document.createElement('a'); +link.style.display = 'none'; +document.body.appendChild(link); // Firefox workaround, see #6594 + +function save(blob, filename) { + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); + + // URL.revokeObjectURL( url ); breaks Firefox... +} + +function saveString(text, filename) { + save(new Blob([text], { type: 'text/plain' }), filename); +} + +function saveArrayBuffer(buffer, filename) { + save(new Blob([buffer], { type: 'application/octet-stream' }), filename); +} diff --git a/examples-testing/examples/misc_exporter_ktx2.ts b/examples-testing/examples/misc_exporter_ktx2.ts new file mode 100644 index 000000000..c96889a24 --- /dev/null +++ b/examples-testing/examples/misc_exporter_ktx2.ts @@ -0,0 +1,145 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { KTX2Exporter } from 'three/addons/exporters/KTX2Exporter.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer, exporter, mesh, controls, renderTarget, dataTexture; + +const params = { + target: 'pmrem', + export: exportFile, +}; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.toneMapping = THREE.AgXToneMapping; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(10, 0, 0); + + scene = new THREE.Scene(); + + exporter = new KTX2Exporter(); + const hdrLoader = new HDRLoader(); + + // + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + pmremGenerator.compileEquirectangularShader(); + + hdrLoader.load('textures/equirectangular/venice_sunset_1k.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + renderTarget = pmremGenerator.fromEquirectangular(texture); + scene.background = renderTarget.texture; + }); + + createDataTexture(); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.rotateSpeed = -0.25; // negative, to track mouse pointer + + // + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'target').options(['pmrem', 'data-texture']).onChange(swapScene); + gui.add(params, 'export').name('Export KTX2'); + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + renderer.render(scene, camera); +} + +function createDataTexture() { + const normal = new THREE.Vector3(); + const coord = new THREE.Vector2(); + const size = 800, + radius = 320, + factor = (Math.PI * 0.5) / radius; + const data = new Float32Array(4 * size * size); + + for (let i = 0; i < size; i++) { + for (let j = 0; j < size; j++) { + const idx = i * size * 4 + j * 4; + coord.set(j, i).subScalar(size / 2); + + if (coord.length() < radius) + normal.set(Math.sin(coord.x * factor), Math.sin(coord.y * factor), Math.cos(coord.x * factor)); + else normal.set(0, 0, 1); + + data[idx + 0] = 0.5 + 0.5 * normal.x; + data[idx + 1] = 0.5 + 0.5 * normal.y; + data[idx + 2] = 0.5 + 0.5 * normal.z; + data[idx + 3] = 1; + } + } + + dataTexture = new THREE.DataTexture(data, size, size, THREE.RGBAFormat, THREE.FloatType); + dataTexture.needsUpdate = true; + + const material = new THREE.MeshBasicMaterial({ map: dataTexture }); + const quad = new THREE.PlaneGeometry(50, 50); + mesh = new THREE.Mesh(quad, material); + mesh.visible = false; + + scene.add(mesh); +} + +function swapScene() { + if (params.target == 'pmrem') { + camera.position.set(10, 0, 0); + controls.enabled = true; + scene.background = renderTarget.texture; + mesh.visible = false; + renderer.toneMapping = THREE.AgXToneMapping; + } else { + camera.position.set(0, 0, 70); + controls.enabled = false; + scene.background = new THREE.Color(0, 0, 0); + mesh.visible = true; + renderer.toneMapping = THREE.NoToneMapping; + } +} + +async function exportFile() { + let result; + + if (params.target == 'pmrem') result = await exporter.parse(renderer, renderTarget); + else result = await exporter.parse(dataTexture); + + saveArrayBuffer(result, params.target + '.ktx2'); +} + +function saveArrayBuffer(buffer, filename) { + const blob = new Blob([buffer], { type: 'image/ktx2' }); + const link = document.createElement('a'); + + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); +} diff --git a/examples-testing/examples/misc_exporter_obj.ts b/examples-testing/examples/misc_exporter_obj.ts new file mode 100644 index 000000000..025034daf --- /dev/null +++ b/examples-testing/examples/misc_exporter_obj.ts @@ -0,0 +1,192 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OBJExporter } from 'three/addons/exporters/OBJExporter.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer; + +const params = { + addTriangle: addTriangle, + addCube: addCube, + addCylinder: addCylinder, + addMultiple: addMultiple, + addTransformed: addTransformed, + addPoints: addPoints, + exportToObj: exportToObj, +}; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 400); + + scene = new THREE.Scene(); + + const ambientLight = new THREE.AmbientLight(0xffffff); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); + directionalLight.position.set(0, 1, 1); + scene.add(directionalLight); + + const gui = new GUI(); + + let h = gui.addFolder('Geometry Selection'); + h.add(params, 'addTriangle').name('Triangle'); + h.add(params, 'addCube').name('Cube'); + h.add(params, 'addCylinder').name('Cylinder'); + h.add(params, 'addMultiple').name('Multiple objects'); + h.add(params, 'addTransformed').name('Transformed objects'); + h.add(params, 'addPoints').name('Point Cloud'); + + h = gui.addFolder('Export'); + h.add(params, 'exportToObj').name('Export OBJ'); + + gui.open(); + + addGeometry(1); + + window.addEventListener('resize', onWindowResize); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enablePan = false; +} + +function exportToObj() { + const exporter = new OBJExporter(); + const result = exporter.parse(scene); + saveString(result, 'object.obj'); +} + +function addGeometry(type) { + for (let i = 0; i < scene.children.length; i++) { + const child = scene.children[i]; + + if (child.isMesh || child.isPoints) { + child.geometry.dispose(); + scene.remove(child); + i--; + } + } + + if (type === 1) { + const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); + const geometry = generateTriangleGeometry(); + + scene.add(new THREE.Mesh(geometry, material)); + } else if (type === 2) { + const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); + const geometry = new THREE.BoxGeometry(100, 100, 100); + scene.add(new THREE.Mesh(geometry, material)); + } else if (type === 3) { + const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); + const geometry = new THREE.CylinderGeometry(50, 50, 100, 30, 1); + scene.add(new THREE.Mesh(geometry, material)); + } else if (type === 4 || type === 5) { + const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); + const geometry = generateTriangleGeometry(); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = -200; + scene.add(mesh); + + const geometry2 = new THREE.BoxGeometry(100, 100, 100); + const mesh2 = new THREE.Mesh(geometry2, material); + scene.add(mesh2); + + const geometry3 = new THREE.CylinderGeometry(50, 50, 100, 30, 1); + const mesh3 = new THREE.Mesh(geometry3, material); + mesh3.position.x = 200; + scene.add(mesh3); + + if (type === 5) { + mesh.rotation.y = Math.PI / 4.0; + mesh2.rotation.y = Math.PI / 4.0; + mesh3.rotation.y = Math.PI / 4.0; + } + } else if (type === 6) { + const points = [0, 0, 0, 100, 0, 0, 100, 100, 0, 0, 100, 0]; + const colors = [0.5, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0.5, 0]; + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.Float32BufferAttribute(points, 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + const material = new THREE.PointsMaterial({ size: 10, vertexColors: true }); + + const pointCloud = new THREE.Points(geometry, material); + pointCloud.name = 'point cloud'; + scene.add(pointCloud); + } +} + +function addTriangle() { + addGeometry(1); +} + +function addCube() { + addGeometry(2); +} + +function addCylinder() { + addGeometry(3); +} + +function addMultiple() { + addGeometry(4); +} + +function addTransformed() { + addGeometry(5); +} + +function addPoints() { + addGeometry(6); +} + +const link = document.createElement('a'); +link.style.display = 'none'; +document.body.appendChild(link); + +function save(blob, filename) { + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); +} + +function saveString(text, filename) { + save(new Blob([text], { type: 'text/plain' }), filename); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} + +function generateTriangleGeometry() { + const geometry = new THREE.BufferGeometry(); + const vertices = []; + + vertices.push(-50, -50, 0); + vertices.push(50, -50, 0); + vertices.push(50, 50, 0); + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + geometry.computeVertexNormals(); + + return geometry; +} diff --git a/examples-testing/examples/misc_exporter_ply.ts b/examples-testing/examples/misc_exporter_ply.ts new file mode 100644 index 000000000..8a5c52626 --- /dev/null +++ b/examples-testing/examples/misc_exporter_ply.ts @@ -0,0 +1,162 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { PLYExporter } from 'three/addons/exporters/PLYExporter.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer, exporter, mesh; + +const params = { + exportASCII: exportASCII, + exportBinaryBigEndian: exportBinaryBigEndian, + exportBinaryLittleEndian: exportBinaryLittleEndian, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(4, 2, 4); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 4, 20); + + exporter = new PLYExporter(); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 3); + hemiLight.position.set(0, 20, 0); + scene.add(hemiLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 3); + directionalLight.position.set(0, 20, 10); + directionalLight.castShadow = true; + directionalLight.shadow.camera.top = 2; + directionalLight.shadow.camera.bottom = -2; + directionalLight.shadow.camera.left = -2; + directionalLight.shadow.camera.right = 2; + scene.add(directionalLight); + + // ground + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(40, 40), + new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), + ); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + const grid = new THREE.GridHelper(40, 20, 0x000000, 0x000000); + grid.material.opacity = 0.2; + grid.material.transparent = true; + scene.add(grid); + + // export mesh + + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshPhongMaterial({ vertexColors: true }); + + // color vertices based on vertex positions + const positions = geometry.getAttribute('position'); + const colors = new THREE.Uint8BufferAttribute(positions.array, 3, true); + const vertex = new THREE.Vector3(); + + for (let i = 0, l = positions.count; i < l; i++) { + vertex.fromBufferAttribute(positions, i); + + colors.setX(i, vertex.x > 0 ? 0.5 : 0); + colors.setY(i, vertex.y > 0 ? 0.5 : 0); + colors.setZ(i, vertex.z > 0 ? 0.5 : 0); + } + + geometry.setAttribute('color', colors); + + mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + mesh.position.y = 0.5; + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.5, 0); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'exportASCII').name('Export PLY (ASCII)'); + gui.add(params, 'exportBinaryBigEndian').name('Export PLY (Binary BE)'); + gui.add(params, 'exportBinaryLittleEndian').name('Export PLY (Binary LE)'); + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} + +function exportASCII() { + exporter.parse(mesh, function (result) { + saveString(result, 'box.ply'); + }); +} + +function exportBinaryBigEndian() { + exporter.parse( + mesh, + function (result) { + saveArrayBuffer(result, 'box.ply'); + }, + { binary: true }, + ); +} + +function exportBinaryLittleEndian() { + exporter.parse( + mesh, + function (result) { + saveArrayBuffer(result, 'box.ply'); + }, + { binary: true, littleEndian: true }, + ); +} + +const link = document.createElement('a'); +link.style.display = 'none'; +document.body.appendChild(link); + +function save(blob, filename) { + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); +} + +function saveString(text, filename) { + save(new Blob([text], { type: 'text/plain' }), filename); +} + +function saveArrayBuffer(buffer, filename) { + save(new Blob([buffer], { type: 'application/octet-stream' }), filename); +} diff --git a/examples-testing/examples/misc_exporter_stl.ts b/examples-testing/examples/misc_exporter_stl.ts new file mode 100644 index 000000000..ff6d6e2b5 --- /dev/null +++ b/examples-testing/examples/misc_exporter_stl.ts @@ -0,0 +1,129 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { STLExporter } from 'three/addons/exporters/STLExporter.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer, exporter, mesh; + +const params = { + exportASCII: exportASCII, + exportBinary: exportBinary, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(4, 2, 4); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 4, 20); + + exporter = new STLExporter(); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 3); + hemiLight.position.set(0, 20, 0); + scene.add(hemiLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 3); + directionalLight.position.set(0, 20, 10); + directionalLight.castShadow = true; + directionalLight.shadow.camera.top = 2; + directionalLight.shadow.camera.bottom = -2; + directionalLight.shadow.camera.left = -2; + directionalLight.shadow.camera.right = 2; + scene.add(directionalLight); + + // ground + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(40, 40), + new THREE.MeshPhongMaterial({ color: 0xbbbbbb, depthWrite: false }), + ); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + const grid = new THREE.GridHelper(40, 20, 0x000000, 0x000000); + grid.material.opacity = 0.2; + grid.material.transparent = true; + scene.add(grid); + + // export mesh + + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshPhongMaterial({ color: 0x00ff00 }); + + mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + mesh.position.y = 0.5; + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.5, 0); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'exportASCII').name('Export STL (ASCII)'); + gui.add(params, 'exportBinary').name('Export STL (Binary)'); + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} + +function exportASCII() { + const result = exporter.parse(mesh); + saveString(result, 'box.stl'); +} + +function exportBinary() { + const result = exporter.parse(mesh, { binary: true }); + saveArrayBuffer(result, 'box.stl'); +} + +const link = document.createElement('a'); +link.style.display = 'none'; +document.body.appendChild(link); + +function save(blob, filename) { + link.href = URL.createObjectURL(blob); + link.download = filename; + link.click(); +} + +function saveString(text, filename) { + save(new Blob([text], { type: 'text/plain' }), filename); +} + +function saveArrayBuffer(buffer, filename) { + save(new Blob([buffer], { type: 'application/octet-stream' }), filename); +} diff --git a/examples-testing/examples/misc_exporter_usdz.ts b/examples-testing/examples/misc_exporter_usdz.ts new file mode 100644 index 000000000..4c84a8ffb --- /dev/null +++ b/examples-testing/examples/misc_exporter_usdz.ts @@ -0,0 +1,111 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +import { USDZExporter } from 'three/addons/exporters/USDZExporter.js'; +import * as WebGLTextureUtils from 'three/addons/utils/WebGLTextureUtils.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, mixer, timer, controls; + +const params = { + exportUSDZ: exportUSDZ, +}; + +init(); + +function init() { + timer = new THREE.Timer(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-2.5, 1.6, 3.0); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + + const ktx2loader = new KTX2Loader().detectSupport(renderer); + const dracoLoader = new DRACOLoader(); + const gltfLoader = new GLTFLoader(); + + gltfLoader.setDRACOLoader(dracoLoader); + gltfLoader.setKTX2Loader(ktx2loader); + gltfLoader.setPath('models/gltf/'); + gltfLoader.load('CarbonFrameBike.glb', async function (gltf) { + scene.add(gltf.scene); + + if (gltf.animations.length > 0) { + mixer = new THREE.AnimationMixer(gltf.scene); + const action = mixer.clipAction(gltf.animations[0]); + action.setLoop(THREE.LoopRepeat, Infinity); + action.play(); + } + + // USDZ + + const exporter = new USDZExporter(); + exporter.setTextureUtils(WebGLTextureUtils); // for texture decompresssing + const arraybuffer = await exporter.parseAsync(gltf.scene, { animations: gltf.animations }); + const blob = new Blob([arraybuffer], { type: 'application/octet-stream' }); + + const link = document.getElementById('link'); + link.href = URL.createObjectURL(blob); + }); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.enableDamping = true; + controls.target.set(0, 0.7, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); + + const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent); + + if (isIOS === false) { + const gui = new GUI(); + + gui.add(params, 'exportUSDZ').name('Export USDZ'); + gui.open(); + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function exportUSDZ() { + const link = document.getElementById('link'); + link.click(); +} + +// + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/misc_uv_tests.ts b/examples-testing/examples/misc_uv_tests.ts new file mode 100644 index 000000000..4f782d45f --- /dev/null +++ b/examples-testing/examples/misc_uv_tests.ts @@ -0,0 +1,44 @@ +import * as THREE from 'three'; + +import { UVsDebug } from 'three/addons/utils/UVsDebug.js'; + +/* + * This is to help debug UVs problems in geometry, + * as well as allow a new user to visualize what UVs are about. + */ + +function test(name, geometry) { + const d = document.createElement('div'); + + d.innerHTML = '

' + name + '

'; + + d.appendChild(UVsDebug(geometry)); + + document.body.appendChild(d); +} + +const points = []; + +for (let i = 0; i < 10; i++) { + points.push(new THREE.Vector2(Math.sin(i * 0.2) * 15 + 50, (i - 5) * 2)); +} + +// + +test('new THREE.PlaneGeometry( 100, 100, 4, 4 )', new THREE.PlaneGeometry(100, 100, 4, 4)); + +test('new THREE.SphereGeometry( 75, 12, 6 )', new THREE.SphereGeometry(75, 12, 6)); + +test('new THREE.IcosahedronGeometry( 30, 1 )', new THREE.IcosahedronGeometry(30, 1)); + +test('new THREE.OctahedronGeometry( 30, 2 )', new THREE.OctahedronGeometry(30, 2)); + +test('new THREE.CylinderGeometry( 25, 75, 100, 10, 5 )', new THREE.CylinderGeometry(25, 75, 100, 10, 5)); + +test('new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 )', new THREE.BoxGeometry(100, 100, 100, 4, 4, 4)); + +test('new THREE.LatheGeometry( points, 8 )', new THREE.LatheGeometry(points, 8)); + +test('new THREE.TorusGeometry( 50, 20, 8, 8 )', new THREE.TorusGeometry(50, 20, 8, 8)); + +test('new THREE.TorusKnotGeometry( 50, 10, 12, 6 )', new THREE.TorusKnotGeometry(50, 10, 12, 6)); diff --git a/examples-testing/examples/physics_ammo_instancing.ts b/examples-testing/examples/physics_ammo_instancing.ts new file mode 100644 index 000000000..5cbee3260 --- /dev/null +++ b/examples-testing/examples/physics_ammo_instancing.ts @@ -0,0 +1,132 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { AmmoPhysics } from 'three/addons/physics/AmmoPhysics.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let physics, position; + +let boxes, spheres; + +init(); + +async function init() { + physics = await AmmoPhysics(); + position = new THREE.Vector3(); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-1, 1.5, 2); + camera.lookAt(0, 0.5, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x666666); + + const hemiLight = new THREE.HemisphereLight(); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(5, 5, 5); + dirLight.castShadow = true; + dirLight.shadow.camera.zoom = 2; + scene.add(dirLight); + + const shadowPlane = new THREE.Mesh( + new THREE.PlaneGeometry(10, 10), + new THREE.ShadowMaterial({ + color: 0x444444, + }), + ); + shadowPlane.rotation.x = -Math.PI / 2; + shadowPlane.receiveShadow = true; + scene.add(shadowPlane); + + const floorCollider = new THREE.Mesh( + new THREE.BoxGeometry(10, 5, 10), + new THREE.MeshBasicMaterial({ color: 0x666666 }), + ); + floorCollider.position.y = -2.5; + floorCollider.userData.physics = { mass: 0 }; + floorCollider.visible = false; + scene.add(floorCollider); + + // + + const material = new THREE.MeshLambertMaterial(); + + const matrix = new THREE.Matrix4(); + const color = new THREE.Color(); + + // Boxes + + const geometryBox = new THREE.BoxGeometry(0.075, 0.075, 0.075); + boxes = new THREE.InstancedMesh(geometryBox, material, 400); + boxes.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame + boxes.castShadow = true; + boxes.receiveShadow = true; + boxes.userData.physics = { mass: 1 }; + scene.add(boxes); + + for (let i = 0; i < boxes.count; i++) { + matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); + boxes.setMatrixAt(i, matrix); + boxes.setColorAt(i, color.setHex(0xffffff * Math.random())); + } + + // Spheres + + const geometrySphere = new THREE.IcosahedronGeometry(0.05, 4); + spheres = new THREE.InstancedMesh(geometrySphere, material, 400); + spheres.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame + spheres.castShadow = true; + spheres.receiveShadow = true; + spheres.userData.physics = { mass: 1 }; + scene.add(spheres); + + for (let i = 0; i < spheres.count; i++) { + matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); + spheres.setMatrixAt(i, matrix); + spheres.setColorAt(i, color.setHex(0xffffff * Math.random())); + } + + physics.addScene(scene); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.y = 0.5; + controls.update(); + + setInterval(() => { + let index = Math.floor(Math.random() * boxes.count); + + position.set(0, Math.random() + 1, 0); + physics.setMeshPosition(boxes, position, index); + + // + + index = Math.floor(Math.random() * spheres.count); + + position.set(0, Math.random() + 1, 0); + physics.setMeshPosition(spheres, position, index); + }, 1000 / 60); +} + +function animate() { + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/physics_jolt_instancing.ts b/examples-testing/examples/physics_jolt_instancing.ts new file mode 100644 index 000000000..70980b8d5 --- /dev/null +++ b/examples-testing/examples/physics_jolt_instancing.ts @@ -0,0 +1,133 @@ +import * as THREE from 'three/webgpu'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { JoltPhysics } from 'three/addons/physics/JoltPhysics.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let physics, position; + +let boxes, spheres; + +init(); + +async function init() { + physics = await JoltPhysics(); + position = new THREE.Vector3(); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-1, 1.5, 2); + camera.lookAt(0, 0.5, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x666666); + + const hemiLight = new THREE.HemisphereLight(); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(5, 5, 5); + dirLight.castShadow = true; + dirLight.shadow.camera.zoom = 2; + dirLight.shadow.bias = -0.001; + scene.add(dirLight); + + const shadowPlane = new THREE.Mesh( + new THREE.PlaneGeometry(10, 10), + new THREE.ShadowMaterial({ + color: 0x444444, + }), + ); + shadowPlane.rotation.x = -Math.PI / 2; + shadowPlane.receiveShadow = true; + scene.add(shadowPlane); + + const floorCollider = new THREE.Mesh( + new THREE.BoxGeometry(10, 5, 10), + new THREE.MeshBasicMaterial({ color: 0x666666 }), + ); + floorCollider.position.y = -2.5; + floorCollider.userData.physics = { mass: 0 }; + floorCollider.visible = false; + scene.add(floorCollider); + + // + + const material = new THREE.MeshLambertMaterial(); + + const matrix = new THREE.Matrix4(); + const color = new THREE.Color(); + + // Boxes + + const geometryBox = new THREE.BoxGeometry(0.075, 0.075, 0.075); + boxes = new THREE.InstancedMesh(geometryBox, material, 400); + boxes.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame + boxes.castShadow = true; + boxes.receiveShadow = true; + boxes.userData.physics = { mass: 1 }; + scene.add(boxes); + + for (let i = 0; i < boxes.count; i++) { + matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); + boxes.setMatrixAt(i, matrix); + boxes.setColorAt(i, color.setHex(0xffffff * Math.random())); + } + + // Spheres + + const geometrySphere = new THREE.IcosahedronGeometry(0.05, 4); + spheres = new THREE.InstancedMesh(geometrySphere, material, 400); + spheres.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame + spheres.castShadow = true; + spheres.receiveShadow = true; + spheres.userData.physics = { mass: 1 }; + scene.add(spheres); + + for (let i = 0; i < spheres.count; i++) { + matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); + spheres.setMatrixAt(i, matrix); + spheres.setColorAt(i, color.setHex(0xffffff * Math.random())); + } + + physics.addScene(scene); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.y = 0.5; + controls.update(); + + setInterval(() => { + let index = Math.floor(Math.random() * boxes.count); + + position.set(0, Math.random() + 1, 0); + physics.setMeshPosition(boxes, position, index); + + // + + index = Math.floor(Math.random() * spheres.count); + + position.set(0, Math.random() + 1, 0); + physics.setMeshPosition(spheres, position, index); + }, 1000 / 60); +} + +function animate() { + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/physics_rapier_basic.ts b/examples-testing/examples/physics_rapier_basic.ts new file mode 100644 index 000000000..0bacda80c --- /dev/null +++ b/examples-testing/examples/physics_rapier_basic.ts @@ -0,0 +1,144 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; +import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; +import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats, controls; +let physics, physicsHelper; + +init(); + +async function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfd1e5); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 3, 10); + + const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); + + scene.add(ambient); + + const light = new THREE.DirectionalLight(0xffffff, 4); + + light.position.set(0, 12.5, 12.5); + light.castShadow = true; + light.shadow.radius = 3; + light.shadow.blurSamples = 8; + light.shadow.mapSize.width = 1024; + light.shadow.mapSize.height = 1024; + + const size = 10; + light.shadow.camera.left = -size; + light.shadow.camera.bottom = -size; + light.shadow.camera.right = size; + light.shadow.camera.top = size; + light.shadow.camera.near = 1; + light.shadow.camera.far = 50; + + scene.add(light); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + renderer.setAnimationLoop(animate); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target = new THREE.Vector3(0, 2, 0); + controls.update(); + + const geometry = new THREE.BoxGeometry(10, 0.5, 10); + const material = new THREE.MeshStandardMaterial({ color: 0xffffff }); + + const floor = new THREE.Mesh(geometry, material); + floor.receiveShadow = true; + + floor.position.y = -0.25; + floor.userData.physics = { mass: 0 }; + + scene.add(floor); + + new THREE.TextureLoader().load('textures/grid.png', function (texture) { + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.repeat.set(20, 20); + floor.material.map = texture; + floor.material.needsUpdate = true; + }); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + initPhysics(); + + onWindowResize(); + + window.addEventListener('resize', onWindowResize, false); +} + +async function initPhysics() { + //Initialize physics engine using the script in the jsm/physics folder + physics = await RapierPhysics(); + + physics.addScene(scene); + + addBody(); + + //Optionally display collider outlines + physicsHelper = new RapierHelper(physics.world); + scene.add(physicsHelper); + + setInterval(addBody, 1000); +} + +const geometries = [ + new THREE.BoxGeometry(1, 1, 1), + new THREE.SphereGeometry(0.5), + new RoundedBoxGeometry(1, 1, 1, 2, 0.25), +]; + +function addBody() { + const geometry = geometries[Math.floor(Math.random() * geometries.length)]; + const material = new THREE.MeshStandardMaterial({ color: Math.floor(Math.random() * 0xffffff) }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + + mesh.position.set(Math.random() * 2 - 1, Math.random() * 3 + 6, Math.random() * 2 - 1); + + scene.add(mesh); + + //parameter 2 - mass, parameter 3 - restitution ( how bouncy ) + physics.addMesh(mesh, 1, 0.5); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + for (const object of scene.children) { + if (object.isMesh) { + if (object.position.y < -10) { + scene.remove(object); + physics.removeMesh(object); + } + } + } + + if (physicsHelper) physicsHelper.update(); + + controls.update(); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/physics_rapier_character_controller.ts b/examples-testing/examples/physics_rapier_character_controller.ts new file mode 100644 index 000000000..8e797a98c --- /dev/null +++ b/examples-testing/examples/physics_rapier_character_controller.ts @@ -0,0 +1,187 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; +import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let physics, characterController, physicsHelper; +let player, movement; + +init(); + +async function init() { + scene = new THREE.Scene(); + + scene.background = new THREE.Color(0xbfd1e5); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(2, 5, 15); + + const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); + + scene.add(ambient); + + const light = new THREE.DirectionalLight(0xffffff, 3); + + light.position.set(0, 12.5, 12.5); + light.castShadow = true; + light.shadow.radius = 3; + light.shadow.blurSamples = 8; + light.shadow.mapSize.width = 1024; + light.shadow.mapSize.height = 1024; + + const size = 10; + light.shadow.camera.left = -size; + light.shadow.camera.bottom = -size; + light.shadow.camera.right = size; + light.shadow.camera.top = size; + light.shadow.camera.near = 1; + light.shadow.camera.far = 50; + + scene.add(light); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + renderer.setAnimationLoop(animate); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target = new THREE.Vector3(0, 2, 0); + controls.update(); + + const geometry = new THREE.BoxGeometry(20, 0.5, 20); + const material = new THREE.MeshStandardMaterial({ color: 0xffffff }); + + const ground = new THREE.Mesh(geometry, material); + ground.receiveShadow = true; + + ground.position.y = -0.25; + ground.userData.physics = { mass: 0 }; + + scene.add(ground); + + new THREE.TextureLoader().load('textures/grid.png', function (texture) { + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.repeat.set(20, 20); + ground.material.map = texture; + ground.material.needsUpdate = true; + }); + + for (let i = 0; i < 10; i++) addBody(Math.random() > 0.7); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + initPhysics(); + + onWindowResize(); + + // Movement input + movement = { forward: 0, right: 0 }; + + window.addEventListener('keydown', event => { + if (event.key === 'w' || event.key === 'ArrowUp') movement.forward = 1; + if (event.key === 's' || event.key === 'ArrowDown') movement.forward = -1; + if (event.key === 'a' || event.key === 'ArrowLeft') movement.right = -1; + if (event.key === 'd' || event.key === 'ArrowRight') movement.right = 1; + }); + + window.addEventListener('keyup', event => { + if (event.key === 'w' || event.key === 's' || event.key === 'ArrowUp' || event.key === 'ArrowDown') + movement.forward = 0; + if (event.key === 'a' || event.key === 'd' || event.key === 'ArrowLeft' || event.key === 'ArrowRight') + movement.right = 0; + }); + + window.addEventListener('resize', onWindowResize, false); +} + +function random(min, max) { + return Math.random() * (max - min) + min; +} + +async function initPhysics() { + //Initialize physics engine using the script in the jsm/physics folder + physics = await RapierPhysics(); + + //Optionally display collider outlines + physicsHelper = new RapierHelper(physics.world); + scene.add(physicsHelper); + + physics.addScene(scene); + + addCharacterController(); +} + +function addCharacterController() { + // Character Capsule + const geometry = new THREE.CapsuleGeometry(0.3, 1, 8, 8); + const material = new THREE.MeshStandardMaterial({ color: 0x0000ff }); + player = new THREE.Mesh(geometry, material); + player.castShadow = true; + player.position.set(0, 0.8, 0); + scene.add(player); + + // Rapier Character Controller + characterController = physics.world.createCharacterController(0.01); + characterController.setApplyImpulsesToDynamicBodies(true); + characterController.setCharacterMass(3); + const colliderDesc = physics.RAPIER.ColliderDesc.capsule(0.5, 0.3).setTranslation(0, 0.8, 0); + player.userData.collider = physics.world.createCollider(colliderDesc); +} + +function addBody(fixed = true) { + const geometry = fixed ? new THREE.BoxGeometry(1, 1, 1) : new THREE.SphereGeometry(0.25); + const material = new THREE.MeshStandardMaterial({ color: fixed ? 0xff0000 : 0x00ff00 }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + + mesh.position.set(random(-10, 10), 0.5, random(-10, 10)); + + mesh.userData.physics = { mass: fixed ? 0 : 0.5, restitution: fixed ? 0 : 0.3 }; + + scene.add(mesh); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + if (physicsHelper) physicsHelper.update(); + + renderer.render(scene, camera); + + if (physics && characterController) { + const deltaTime = 1 / 60; + + // Character movement + const speed = 2.5 * deltaTime; + const moveVector = new physics.RAPIER.Vector3(movement.right * speed, 0, -movement.forward * speed); + + characterController.computeColliderMovement(player.userData.collider, moveVector); + + // Read the result. + const translation = characterController.computedMovement(); + const position = player.userData.collider.translation(); + + position.x += translation.x; + position.y += translation.y; + position.z += translation.z; + + player.userData.collider.setTranslation(position); + + // Sync Three.js mesh with Rapier collider + player.position.set(position.x, position.y, position.z); + } + + stats.update(); +} diff --git a/examples-testing/examples/physics_rapier_instancing.ts b/examples-testing/examples/physics_rapier_instancing.ts new file mode 100644 index 000000000..d65c631c5 --- /dev/null +++ b/examples-testing/examples/physics_rapier_instancing.ts @@ -0,0 +1,158 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let physics, position; + +let boxes, spheres; + +init(); + +async function init() { + physics = await RapierPhysics(); + position = new THREE.Vector3(); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-1, 1.5, 2); + camera.lookAt(0, 0.5, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x666666); + + const hemiLight = new THREE.HemisphereLight(); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(5, 5, 5); + dirLight.castShadow = true; + dirLight.shadow.camera.zoom = 2; + scene.add(dirLight); + + const shadowPlane = new THREE.Mesh( + new THREE.PlaneGeometry(10, 10), + new THREE.ShadowMaterial({ + color: 0x444444, + }), + ); + shadowPlane.rotation.x = -Math.PI / 2; + shadowPlane.receiveShadow = true; + scene.add(shadowPlane); + + const floorCollider = new THREE.Mesh( + new THREE.BoxGeometry(10, 5, 10), + new THREE.MeshBasicMaterial({ color: 0x666666 }), + ); + floorCollider.position.y = -2.5; + floorCollider.userData.physics = { mass: 0 }; + floorCollider.visible = false; + scene.add(floorCollider); + + // + + const material = new THREE.MeshLambertMaterial(); + + const matrix = new THREE.Matrix4(); + const color = new THREE.Color(); + + // Boxes + + const geometryBox = new THREE.BoxGeometry(0.075, 0.075, 0.075); + boxes = new THREE.InstancedMesh(geometryBox, material, 400); + boxes.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame + boxes.castShadow = true; + boxes.receiveShadow = true; + boxes.userData.physics = { mass: 1 }; + scene.add(boxes); + + for (let i = 0; i < boxes.count; i++) { + matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); + boxes.setMatrixAt(i, matrix); + boxes.setColorAt(i, color.setHex(0xffffff * Math.random())); + } + + // Spheres + + const geometrySphere = new THREE.IcosahedronGeometry(0.05, 4); + spheres = new THREE.InstancedMesh(geometrySphere, material, 400); + spheres.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame + spheres.castShadow = true; + spheres.receiveShadow = true; + spheres.userData.physics = { mass: 1 }; + scene.add(spheres); + + for (let i = 0; i < spheres.count; i++) { + matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); + spheres.setMatrixAt(i, matrix); + spheres.setColorAt(i, color.setHex(0xffffff * Math.random())); + } + + physics.addScene(scene); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.y = 0.5; + controls.update(); + + document.querySelector('button#shake').addEventListener('click', () => { + const impulse = new THREE.Vector3(); + + for (let i = 0; i < spheres.count; i++) { + impulse.set((Math.random() - 0.5) * 5, Math.random() * 5, (Math.random() - 0.5) * 5); + + physics.applyImpulse(spheres, impulse, i); + } + + for (let i = 0; i < boxes.count; i++) { + impulse.set((Math.random() - 0.5) * 5, Math.random() * 5, (Math.random() - 0.5) * 5); + + physics.applyImpulse(boxes, impulse, i); + } + }); + + setInterval(() => { + let index = Math.floor(Math.random() * boxes.count); + + position.set(0, Math.random() + 1, 0); + physics.setMeshPosition(boxes, position, index); + + // + + index = Math.floor(Math.random() * spheres.count); + + position.set(0, Math.random() + 1, 0); + physics.setMeshPosition(spheres, position, index); + }, 1000 / 60); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/physics_rapier_joints.ts b/examples-testing/examples/physics_rapier_joints.ts new file mode 100644 index 000000000..5f8805fe1 --- /dev/null +++ b/examples-testing/examples/physics_rapier_joints.ts @@ -0,0 +1,130 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; +import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let physics, pivot, physicsHelper; + +init(); + +async function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfd1e5); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 3, 10); + + const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); + + scene.add(ambient); + + const light = new THREE.DirectionalLight(0xffffff, 4); + + light.position.set(0, 12.5, 12.5); + light.castShadow = true; + light.shadow.radius = 3; + light.shadow.blurSamples = 8; + light.shadow.mapSize.width = 1024; + light.shadow.mapSize.height = 1024; + + const size = 10; + light.shadow.camera.left = -size; + light.shadow.camera.bottom = -size; + light.shadow.camera.right = size; + light.shadow.camera.top = size; + light.shadow.camera.near = 1; + light.shadow.camera.far = 50; + + scene.add(light); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + renderer.setAnimationLoop(animate); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target = new THREE.Vector3(0, 2, 0); + controls.update(); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + //Create pivot point + const geometry = new THREE.SphereGeometry(0.5); + const material = new THREE.MeshStandardMaterial({ color: 0xff0000 }); + + pivot = new THREE.Mesh(geometry, material); + + pivot.position.y = 6; + pivot.userData.physics = { mass: 0 }; + + scene.add(pivot); + + initPhysics(); + + onWindowResize(); + + window.addEventListener('resize', onWindowResize, false); +} + +async function initPhysics() { + //Initialize physics engine using the script in the jsm/physics folder + physics = await RapierPhysics(); + + physics.addScene(scene); + + //Optionally display collider outlines + physicsHelper = new RapierHelper(physics.world); + scene.add(physicsHelper); + + const link1 = addLink(pivot, 0); + const link2 = addLink(link1, 2); + addLink(link2, 4); +} + +//link - the mesh that the new link will be attached to +//x - used to position the new link +function addLink(link, x) { + const geometry = new THREE.CapsuleGeometry(0.25, 1.8); + const material = new THREE.MeshStandardMaterial({ color: 0xcccc00 }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.rotateZ(Math.PI * 0.5); + + mesh.position.set(x + 0.9, 5.8, 0); + + scene.add(mesh); + + physics.addMesh(mesh, 1, 0.5); + + const jointParams = physics.RAPIER.JointData.spherical( + link == pivot ? new physics.RAPIER.Vector3(0, -0.5, 0) : new physics.RAPIER.Vector3(0, -1.15, 0), // Joint position in world space + new physics.RAPIER.Vector3(0, 1.15, 0), // Corresponding attachment on sphere + ); + const body1 = link.userData.physics.body; + const body2 = mesh.userData.physics.body; + body2.setAngularDamping(10.0); + + physics.world.createImpulseJoint(jointParams, body1, body2, true); + + return mesh; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + if (physicsHelper) physicsHelper.update(); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/physics_rapier_terrain.ts b/examples-testing/examples/physics_rapier_terrain.ts new file mode 100644 index 000000000..7708ceab8 --- /dev/null +++ b/examples-testing/examples/physics_rapier_terrain.ts @@ -0,0 +1,295 @@ +import * as THREE from 'three'; +import Stats from 'three/addons/libs/stats.module.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; + +// Heightfield parameters +const terrainWidthExtents = 100; +const terrainDepthExtents = 100; +const terrainWidth = 128; +const terrainDepth = 128; +const terrainHalfWidth = terrainWidth / 2; +const terrainHalfDepth = terrainDepth / 2; +const terrainMaxHeight = 8; +const terrainMinHeight = -2; + +// Graphics variables +let container, stats; +let camera, scene, renderer; +let terrainMesh; +const timer = new THREE.Timer(); +timer.connect(document); + +// Physics variables +let physics; +const dynamicObjects = []; +let heightData = null; + +let time = 0; +const objectTimePeriod = 3; +let timeNextSpawn = time + objectTimePeriod; +const maxNumObjects = 30; + +init(); + +async function init() { + heightData = generateHeight(terrainWidth, terrainDepth, terrainMinHeight, terrainMaxHeight); + initGraphics(); + await initPhysics(); + // Start animation loop only after physics is initialized + renderer.setAnimationLoop(animate); +} + +function initGraphics() { + container = document.getElementById('container'); + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + // Remove setAnimationLoop from here since we'll start it after physics init + renderer.shadowMap.enabled = true; + container.appendChild(renderer.domElement); + + stats = new Stats(); + stats.domElement.style.position = 'absolute'; + stats.domElement.style.top = '0px'; + container.appendChild(stats.domElement); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.2, 2000); + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfd1e5); + + camera.position.y = + heightData[terrainHalfWidth + terrainHalfDepth * terrainWidth] * (terrainMaxHeight - terrainMinHeight) + 5; + camera.position.z = terrainDepthExtents / 2; + camera.lookAt(0, 0, 0); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + + const geometry = new THREE.PlaneGeometry( + terrainWidthExtents, + terrainDepthExtents, + terrainWidth - 1, + terrainDepth - 1, + ); + geometry.rotateX(-Math.PI / 2); + + const vertices = geometry.attributes.position.array; + + for (let i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) { + vertices[j + 1] = heightData[i]; + } + + geometry.computeVertexNormals(); + + const groundMaterial = new THREE.MeshPhongMaterial({ color: 0xc7c7c7 }); + terrainMesh = new THREE.Mesh(geometry, groundMaterial); + terrainMesh.receiveShadow = true; + terrainMesh.castShadow = true; + scene.add(terrainMesh); + + const textureLoader = new THREE.TextureLoader(); + textureLoader.load('textures/grid.png', function (texture) { + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.repeat.set(terrainWidth - 1, terrainDepth - 1); + groundMaterial.map = texture; + groundMaterial.needsUpdate = true; + }); + + const ambientLight = new THREE.AmbientLight(0xbbbbbb); + scene.add(ambientLight); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(100, 100, 50); + light.castShadow = true; + const dLight = 200; + const sLight = dLight * 0.25; + light.shadow.camera.left = -sLight; + light.shadow.camera.right = sLight; + light.shadow.camera.top = sLight; + light.shadow.camera.bottom = -sLight; + light.shadow.camera.near = dLight / 30; + light.shadow.camera.far = dLight; + light.shadow.mapSize.x = 1024 * 2; + light.shadow.mapSize.y = 1024 * 2; + scene.add(light); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function initPhysics() { + physics = await RapierPhysics(); + + // Create the terrain body using RapierPhysics module + physics.addHeightfield(terrainMesh, terrainWidth - 1, terrainDepth - 1, heightData, { + x: terrainWidthExtents, + y: 1.0, + z: terrainDepthExtents, + }); + + // Continue with adding other dynamic objects as needed +} + +function generateHeight(width, depth, minHeight, maxHeight) { + const size = width * depth; + const data = new Float32Array(size); + const hRange = maxHeight - minHeight; + const w2 = width / 2; + const d2 = depth / 2; + const phaseMult = 12; + let p = 0; + + for (let j = 0; j < depth; j++) { + for (let i = 0; i < width; i++) { + const radius = Math.sqrt(Math.pow((i - w2) / w2, 2.0) + Math.pow((j - d2) / d2, 2.0)); + const height = (Math.sin(radius * phaseMult) + 1) * 0.5 * hRange + minHeight; + data[p] = height; + p++; + } + } + + return data; +} + +function generateObject() { + const numTypes = 3; // cones not working + const objectType = Math.ceil(Math.random() * numTypes); + let threeObject = null; + const objectSize = 3; + let radius, height; + + switch (objectType) { + case 1: // Sphere + radius = 1 + Math.random() * objectSize; + threeObject = new THREE.Mesh(new THREE.SphereGeometry(radius, 20, 20), createObjectMaterial()); + break; + case 2: // Box + const sx = 1 + Math.random() * objectSize; + const sy = 1 + Math.random() * objectSize; + const sz = 1 + Math.random() * objectSize; + threeObject = new THREE.Mesh(new THREE.BoxGeometry(sx, sy, sz, 1, 1, 1), createObjectMaterial()); + break; + case 3: // Cylinder + radius = 1 + Math.random() * objectSize; + height = 1 + Math.random() * objectSize; + threeObject = new THREE.Mesh( + new THREE.CylinderGeometry(radius, radius, height, 20, 1), + createObjectMaterial(), + ); + break; + default: // Cone + radius = 1 + Math.random() * objectSize; + height = 2 + Math.random() * objectSize; + threeObject = new THREE.Mesh(new THREE.ConeGeometry(radius, height, 20, 2), createObjectMaterial()); + break; + } + + // Position objects higher and with more randomization to prevent clustering + threeObject.position.set( + (Math.random() - 0.5) * terrainWidth * 0.6, + terrainMaxHeight + objectSize + 15 + Math.random() * 5, // Even higher with randomization + (Math.random() - 0.5) * terrainDepth * 0.6, + ); + + const mass = objectSize * 5; + const restitution = 0.3; // Add some bounciness + + // Add to scene first + scene.add(threeObject); + + // Add physics to the object + physics.addMesh(threeObject, mass, restitution); + + // Store the object for later reference + dynamicObjects.push(threeObject); + + // Force a small delay before adding the next object + timeNextSpawn = time + 0.5; + + threeObject.receiveShadow = true; + threeObject.castShadow = true; +} + +function createObjectMaterial() { + const c = Math.floor(Math.random() * (1 << 24)); + return new THREE.MeshPhongMaterial({ color: c }); +} + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + const deltaTime = timer.getDelta(); + + // Generate new objects with a delay between them + if (dynamicObjects.length < maxNumObjects && time > timeNextSpawn) { + // Generate object directly in this frame + generateObject(); + // timeNextSpawn is now set in generateObject() + } + + // Clean up objects that have fallen off the terrain + for (let i = dynamicObjects.length - 1; i >= 0; i--) { + const obj = dynamicObjects[i]; + if (obj.position.y < terrainMinHeight - 10) { + // Remove from scene and physics world + scene.remove(obj); + dynamicObjects.splice(i, 1); + } + } + + updatePhysics(); + renderer.render(scene, camera); + time += deltaTime; +} + +function updatePhysics() { + // Check for objects that might need help with physics + for (let i = 0, il = dynamicObjects.length; i < il; i++) { + const objThree = dynamicObjects[i]; + + // If object is not moving but should be (based on height), try to fix it + if (objThree.position.y > 1.0) { + // Check if physics body exists + if (objThree.userData && objThree.userData.physics && objThree.userData.physics.body) { + const body = objThree.userData.physics.body; + + // Make sure body is awake + if (typeof body.wakeUp === 'function') { + body.wakeUp(); + } + + // Check velocity and apply impulse if needed + if (typeof body.linvel === 'function') { + const velocity = body.linvel(); + const speed = Math.sqrt( + velocity.x * velocity.x + velocity.y * velocity.y + velocity.z * velocity.z, + ); + + // If object is very slow, give it a stronger impulse + if (speed < 0.5) { + body.applyImpulse({ x: 0, y: -2.0, z: 0 }, true); + } + } + } else { + // If the object doesn't have a physics body but should, recreate it + const mass = 5; // Default mass + const restitution = 0.3; // Default restitution + + // Recreate physics for the object + physics.addMesh(objThree, mass, restitution); + } + } + } +} diff --git a/examples-testing/examples/physics_rapier_vehicle_controller.ts b/examples-testing/examples/physics_rapier_vehicle_controller.ts new file mode 100644 index 000000000..fac5ef082 --- /dev/null +++ b/examples-testing/examples/physics_rapier_vehicle_controller.ts @@ -0,0 +1,297 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; +import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let physics, physicsHelper, controls; +let car, chassis, wheels, movement, vehicleController; + +init(); + +async function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfd1e5); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 4, 10); + + const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); + + scene.add(ambient); + + const light = new THREE.DirectionalLight(0xffffff, 4); + + light.position.set(0, 12.5, 12.5); + light.castShadow = true; + light.shadow.radius = 3; + light.shadow.blurSamples = 8; + light.shadow.mapSize.width = 2048; + light.shadow.mapSize.height = 2048; + + const size = 40; + light.shadow.camera.left = -size; + light.shadow.camera.bottom = -size; + light.shadow.camera.right = size; + light.shadow.camera.top = size; + light.shadow.camera.near = 1; + light.shadow.camera.far = 50; + + scene.add(light); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + renderer.setAnimationLoop(animate); + + controls = new OrbitControls(camera, renderer.domElement); + controls.target = new THREE.Vector3(0, 2, 0); + controls.update(); + + const geometry = new THREE.BoxGeometry(100, 0.5, 100); + const material = new THREE.MeshStandardMaterial({ color: 0xffffff }); + + const ground = new THREE.Mesh(geometry, material); + ground.receiveShadow = true; + + ground.position.set(0, -0.25, -20); + ground.userData.physics = { mass: 0 }; + + scene.add(ground); + + new THREE.TextureLoader().load('textures/grid.png', function (texture) { + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.repeat.set(80, 80); + ground.material.map = texture; + ground.material.needsUpdate = true; + }); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + initPhysics(); + + onWindowResize(); + + // Movement input + movement = { + forward: 0, + right: 0, + brake: 0, + reset: false, + accelerateForce: { value: 0, min: -30, max: 30, step: 1 }, + brakeForce: { value: 0, min: 0, max: 1, step: 0.05 }, + }; + + window.addEventListener('keydown', event => { + //console.log( event.key ); + if (event.key === 'w' || event.key === 'ArrowUp') movement.forward = -1; + if (event.key === 's' || event.key === 'ArrowDown') movement.forward = 1; + if (event.key === 'a' || event.key === 'ArrowLeft') movement.right = 1; + if (event.key === 'd' || event.key === 'ArrowRight') movement.right = -1; + if (event.key === 'r') movement.reset = true; + if (event.key === ' ') movement.brake = 1; + }); + + window.addEventListener('keyup', event => { + if (event.key === 'w' || event.key === 's' || event.key === 'ArrowUp' || event.key === 'ArrowDown') + movement.forward = 0; + if (event.key === 'a' || event.key === 'd' || event.key === 'ArrowLeft' || event.key === 'ArrowRight') + movement.right = 0; + if (event.key === 'r') movement.reset = false; + if (event.key === ' ') movement.brake = 0; + }); + + window.addEventListener('resize', onWindowResize, false); +} + +async function initPhysics() { + //Initialize physics engine using the script in the jsm/physics folder + physics = await RapierPhysics(); + + //Optionally display collider outlines + physicsHelper = new RapierHelper(physics.world); + scene.add(physicsHelper); + + physics.addScene(scene); + + createCar(); +} + +function createCar() { + const geometry = new THREE.BoxGeometry(2, 1, 4); + const material = new THREE.MeshStandardMaterial({ color: 0xff0000 }); + const mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + scene.add(mesh); + car = mesh; + + mesh.position.y = 1; + + physics.addMesh(mesh, 10, 0.8); // addMesh places the RigidBody in the mesh.userData.physics object + chassis = mesh.userData.physics.body; + + vehicleController = physics.world.createVehicleController(chassis); + + wheels = []; + + addWheel(0, { x: -1, y: 0, z: -1.5 }, mesh); + addWheel(1, { x: 1, y: 0, z: -1.5 }, mesh); + addWheel(2, { x: -1, y: 0, z: 1.5 }, mesh); + addWheel(3, { x: 1, y: 0, z: 1.5 }, mesh); + + vehicleController.setWheelSteering(0, Math.PI / 4); + vehicleController.setWheelSteering(1, Math.PI / 4); +} + +function addWheel(index, pos, carMesh) { + // Define wheel properties + const wheelRadius = 0.3; + const wheelWidth = 0.4; + const suspensionRestLength = 0.8; + const wheelPosition = pos; // Position relative to chassis + const wheelDirection = { x: 0.0, y: -1.0, z: 0.0 }; // Downward direction + const wheelAxle = { x: -1.0, y: 0.0, z: 0.0 }; // Axle direction + + // Add the wheel to the vehicle controller + vehicleController.addWheel(wheelPosition, wheelDirection, wheelAxle, suspensionRestLength, wheelRadius); + + // Set suspension stiffness for wheel + vehicleController.setWheelSuspensionStiffness(index, 24.0); + + // Set wheel friction + vehicleController.setWheelFrictionSlip(index, 1000.0); + + // Enable steering for the wheel + vehicleController.setWheelSteering(index, pos.z < 0); + + // Create a wheel mesh + const geometry = new THREE.CylinderGeometry(wheelRadius, wheelRadius, wheelWidth, 16); + geometry.rotateZ(Math.PI * 0.5); + const material = new THREE.MeshStandardMaterial({ color: 0x000000 }); + const wheel = new THREE.Mesh(geometry, material); + + wheel.castShadow = true; + + wheel.position.copy(pos); + + wheels.push(wheel); + carMesh.add(wheel); +} + +function updateWheels() { + if (vehicleController === undefined) return; + + const wheelSteeringQuat = new THREE.Quaternion(); + const wheelRotationQuat = new THREE.Quaternion(); + const up = new THREE.Vector3(0, 1, 0); + + //const chassisPosition = chassis.translation(); + + wheels.forEach((wheel, index) => { + const wheelAxleCs = vehicleController.wheelAxleCs(index); + const connection = vehicleController.wheelChassisConnectionPointCs(index).y || 0; + const suspension = vehicleController.wheelSuspensionLength(index) || 0; + const steering = vehicleController.wheelSteering(index) || 0; + const rotationRad = vehicleController.wheelRotation(index) || 0; + + wheel.position.y = connection - suspension; + + wheelSteeringQuat.setFromAxisAngle(up, steering); + wheelRotationQuat.setFromAxisAngle(wheelAxleCs, rotationRad); + + wheel.quaternion.multiplyQuaternions(wheelSteeringQuat, wheelRotationQuat); + }); +} + +function updateCarControl() { + if (movement.reset) { + chassis.setTranslation(new physics.RAPIER.Vector3(0, 1, 0), true); + chassis.setRotation(new physics.RAPIER.Quaternion(0, 0, 0, 1), true); + chassis.setLinvel(new physics.RAPIER.Vector3(0, 0, 0), true); + chassis.setAngvel(new physics.RAPIER.Vector3(0, 0, 0), true); + + movement.accelerateForce.value = 0; + movement.brakeForce.value = 0; + + return; + } + + let accelerateForce = 0; + + if (movement.forward < 0) { + //if (movement.accelerateForce.value === 0) chassis.wakeUp(); + accelerateForce = movement.accelerateForce.value - movement.accelerateForce.step; + if (accelerateForce < movement.accelerateForce.min) accelerateForce = movement.accelerateForce.min; + } else if (movement.forward > 0) { + //if (movement.accelerateForce.value === 0) chassis.wakeUp(); + accelerateForce = movement.accelerateForce.value + movement.accelerateForce.step; + + if (accelerateForce > movement.accelerateForce.max) accelerateForce = movement.accelerateForce.max; + } else { + if (chassis.isSleeping()) chassis.wakeUp(); + } + + movement.accelerateForce.value = accelerateForce; + + //console.log(accelerateForce); + + let brakeForce = 0; + + if (movement.brake > 0) { + brakeForce = movement.brakeForce.value + movement.brakeForce.step; + if (brakeForce > movement.brakeForce.max) brakeForce = movement.brakeForce.max; + } + + movement.brakeForce.value = brakeForce; + + const engineForce = accelerateForce; + + vehicleController.setWheelEngineForce(0, engineForce); + vehicleController.setWheelEngineForce(1, engineForce); + + const currentSteering = vehicleController.wheelSteering(0); + const steerDirection = movement.right; + const steerAngle = Math.PI / 4; + + const steering = THREE.MathUtils.lerp(currentSteering, steerAngle * steerDirection, 0.25); + + vehicleController.setWheelSteering(0, steering); + vehicleController.setWheelSteering(1, steering); + + const wheelBrake = movement.brake * brakeForce; + vehicleController.setWheelBrake(0, wheelBrake); + vehicleController.setWheelBrake(1, wheelBrake); + vehicleController.setWheelBrake(2, wheelBrake); + vehicleController.setWheelBrake(3, wheelBrake); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + if (vehicleController) { + updateCarControl(); + vehicleController.updateVehicle(1 / 60); + updateWheels(); + } + + if (controls && car) { + controls.target.copy(car.position); + controls.update(); + } + + if (physicsHelper) physicsHelper.update(); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/svg_lines.ts b/examples-testing/examples/svg_lines.ts new file mode 100644 index 000000000..99b74c405 --- /dev/null +++ b/examples-testing/examples/svg_lines.ts @@ -0,0 +1,87 @@ +import * as THREE from 'three'; + +import { SVGRenderer } from 'three/addons/renderers/SVGRenderer.js'; + +THREE.ColorManagement.enabled = false; + +let camera, scene, renderer; + +init(); +animate(); + +function init() { + camera = new THREE.PerspectiveCamera(33, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 10; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0, 0, 0); + + renderer = new SVGRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + // + + const vertices = []; + const divisions = 50; + + for (let i = 0; i <= divisions; i++) { + const v = (i / divisions) * (Math.PI * 2); + + const x = Math.sin(v); + const z = Math.cos(v); + + vertices.push(x, 0, z); + } + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + // + + for (let i = 1; i <= 3; i++) { + const material = new THREE.LineBasicMaterial({ + color: Math.random() * 0xffffff, + linewidth: 10, + }); + const line = new THREE.Line(geometry, material); + line.scale.setScalar(i / 3); + scene.add(line); + } + + const material = new THREE.LineDashedMaterial({ + color: 'blue', + linewidth: 1, + dashSize: 10, + gapSize: 10, + }); + const line = new THREE.Line(geometry, material); + line.scale.setScalar(2); + scene.add(line); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + let count = 0; + const time = performance.now() / 1000; + + scene.traverse(function (child) { + child.rotation.x = count + time / 3; + child.rotation.z = count + time / 4; + + count++; + }); + + renderer.render(scene, camera); + requestAnimationFrame(animate); +} diff --git a/examples-testing/examples/svg_sandbox.ts b/examples-testing/examples/svg_sandbox.ts new file mode 100644 index 000000000..fa66f10e1 --- /dev/null +++ b/examples-testing/examples/svg_sandbox.ts @@ -0,0 +1,212 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { SVGRenderer, SVGObject } from 'three/addons/renderers/SVGRenderer.js'; + +THREE.ColorManagement.enabled = false; + +let camera, scene, renderer, stats, controls; + +let group; + +init(); +animate(); + +function init() { + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + // QRCODE + + const loader = new THREE.BufferGeometryLoader(); + loader.load('models/json/QRCode_buffergeometry.json', function (geometry) { + mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ vertexColors: true })); + mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; + scene.add(mesh); + }); + + // CUBES + + const boxGeometry = new THREE.BoxGeometry(100, 100, 100); + + let mesh = new THREE.Mesh( + boxGeometry, + new THREE.MeshBasicMaterial({ color: 0x0000ff, opacity: 0.5, transparent: true }), + ); + mesh.position.x = 500; + mesh.rotation.x = Math.random(); + mesh.rotation.y = Math.random(); + mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; + scene.add(mesh); + + mesh = new THREE.Mesh(boxGeometry, new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff })); + mesh.position.x = 500; + mesh.position.y = 500; + mesh.rotation.x = Math.random(); + mesh.rotation.y = Math.random(); + mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; + scene.add(mesh); + + // PLANE + + mesh = new THREE.Mesh( + new THREE.PlaneGeometry(100, 100), + new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff, side: THREE.DoubleSide }), + ); + mesh.position.y = -500; + mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; + scene.add(mesh); + + // CYLINDER + + mesh = new THREE.Mesh( + new THREE.CylinderGeometry(20, 100, 200, 10), + new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff }), + ); + mesh.position.x = -500; + mesh.rotation.x = -Math.PI / 2; + mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; + scene.add(mesh); + + // POLYFIELD + + const geometry = new THREE.BufferGeometry(); + const material = new THREE.MeshBasicMaterial({ vertexColors: true, side: THREE.DoubleSide }); + + const v = new THREE.Vector3(); + const v0 = new THREE.Vector3(); + const v1 = new THREE.Vector3(); + const v2 = new THREE.Vector3(); + const color = new THREE.Color(); + + const vertices = []; + const colors = []; + + for (let i = 0; i < 100; i++) { + v.set(Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500); + + v0.set(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); + + v1.set(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); + + v2.set(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); + + v0.add(v); + v1.add(v); + v2.add(v); + + color.setHex(Math.random() * 0xffffff); + + // create a single triangle + + vertices.push(v0.x, v0.y, v0.z); + vertices.push(v1.x, v1.y, v1.z); + vertices.push(v2.x, v2.y, v2.z); + + colors.push(color.r, color.g, color.b); + colors.push(color.r, color.g, color.b); + colors.push(color.r, color.g, color.b); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + group = new THREE.Mesh(geometry, material); + group.scale.set(2, 2, 2); + scene.add(group); + + // SPRITES + + for (let i = 0; i < 50; i++) { + const material = new THREE.SpriteMaterial({ color: Math.random() * 0xffffff }); + const sprite = new THREE.Sprite(material); + sprite.position.x = Math.random() * 1000 - 500; + sprite.position.y = Math.random() * 1000 - 500; + sprite.position.z = Math.random() * 1000 - 500; + sprite.scale.set(64, 64, 1); + scene.add(sprite); + } + + // CUSTOM + + const node = document.createElementNS('http://www.w3.org/2000/svg', 'circle'); + node.setAttribute('stroke', 'black'); + node.setAttribute('fill', 'red'); + node.setAttribute('r', '40'); + + for (let i = 0; i < 50; i++) { + const object = new SVGObject(node.cloneNode()); + object.position.x = Math.random() * 1000 - 500; + object.position.y = Math.random() * 1000 - 500; + object.position.z = Math.random() * 1000 - 500; + scene.add(object); + } + + // CUSTOM FROM FILE + + const fileLoader = new THREE.FileLoader(); + fileLoader.load('models/svg/hexagon.svg', function (svg) { + const node = document.createElementNS('http://www.w3.org/2000/svg', 'g'); + const parser = new DOMParser(); + const doc = parser.parseFromString(svg, 'image/svg+xml'); + + node.appendChild(doc.documentElement); + + const object = new SVGObject(node); + object.position.x = 500; + scene.add(object); + }); + + // LIGHTS + + const ambient = new THREE.AmbientLight(0x80ffff); + scene.add(ambient); + + const directional = new THREE.DirectionalLight(0xffff00); + directional.position.set(-1, 0.5, 0); + scene.add(directional); + + renderer = new SVGRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setQuality('low'); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + requestAnimationFrame(animate); + + render(); + stats.update(); +} + +function render() { + group.rotation.x += 0.01; + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webaudio_orientation.ts b/examples-testing/examples/webaudio_orientation.ts new file mode 100644 index 000000000..7baaa88a0 --- /dev/null +++ b/examples-testing/examples/webaudio_orientation.ts @@ -0,0 +1,141 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { PositionalAudioHelper } from 'three/addons/helpers/PositionalAudioHelper.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let scene, camera, renderer; + +const startButton = document.getElementById('startButton'); +startButton.addEventListener('click', init); + +function init() { + const overlay = document.getElementById('overlay'); + overlay.remove(); + + const container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(3, 2, 3); + + const reflectionCube = new THREE.CubeTextureLoader() + .setPath('textures/cube/SwedishRoyalCastle/') + .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 2, 20); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); + hemiLight.position.set(0, 20, 0); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(5, 5, 0); + dirLight.castShadow = true; + dirLight.shadow.camera.top = 1; + dirLight.shadow.camera.bottom = -1; + dirLight.shadow.camera.left = -1; + dirLight.shadow.camera.right = 1; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = 20; + scene.add(dirLight); + + // scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) ); + + // + + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(50, 50), + new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), + ); + mesh.rotation.x = -Math.PI / 2; + mesh.receiveShadow = true; + scene.add(mesh); + + const grid = new THREE.GridHelper(50, 50, 0xc1c1c1, 0xc1c1c1); + scene.add(grid); + + // + + const listener = new THREE.AudioListener(); + camera.add(listener); + + const audioElement = document.getElementById('music'); + audioElement.play(); + + const positionalAudio = new THREE.PositionalAudio(listener); + positionalAudio.setMediaElementSource(audioElement); + positionalAudio.setRefDistance(1); + positionalAudio.setDirectionalCone(180, 230, 0.1); + + const helper = new PositionalAudioHelper(positionalAudio, 0.1); + positionalAudio.add(helper); + + // + + const gltfLoader = new GLTFLoader(); + gltfLoader.load('models/gltf/BoomBox.glb', function (gltf) { + const boomBox = gltf.scene; + boomBox.position.set(0, 0.2, 0); + boomBox.scale.set(20, 20, 20); + + boomBox.traverse(function (object) { + if (object.isMesh) { + object.material.envMap = reflectionCube; + object.geometry.rotateY(-Math.PI); + object.castShadow = true; + } + }); + + boomBox.add(positionalAudio); + scene.add(boomBox); + + renderer.setAnimationLoop(animate); + }); + + // sound is damped behind this wall + + const wallGeometry = new THREE.BoxGeometry(2, 1, 0.1); + const wallMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, transparent: true, opacity: 0.5 }); + + const wall = new THREE.Mesh(wallGeometry, wallMaterial); + wall.position.set(0, 0.5, -0.5); + scene.add(wall); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + container.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.1, 0); + controls.update(); + controls.minDistance = 0.5; + controls.maxDistance = 10; + controls.maxPolarAngle = 0.5 * Math.PI; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webaudio_sandbox.ts b/examples-testing/examples/webaudio_sandbox.ts new file mode 100644 index 000000000..34afca985 --- /dev/null +++ b/examples-testing/examples/webaudio_sandbox.ts @@ -0,0 +1,223 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; + +let camera, controls, scene, renderer, light; + +let material1, material2, material3; + +let analyser1, analyser2, analyser3; + +const timer = new THREE.Timer(); +timer.connect(document); + +const startButton = document.getElementById('startButton'); +startButton.addEventListener('click', init); + +function init() { + const overlay = document.getElementById('overlay'); + overlay.remove(); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(0, 25, 0); + + const listener = new THREE.AudioListener(); + camera.add(listener); + + scene = new THREE.Scene(); + scene.fog = new THREE.FogExp2(0x000000, 0.0025); + + light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 0.5, 1).normalize(); + scene.add(light); + + const sphere = new THREE.SphereGeometry(20, 32, 16); + + material1 = new THREE.MeshPhongMaterial({ color: 0xffaa00, flatShading: true, shininess: 0 }); + material2 = new THREE.MeshPhongMaterial({ color: 0xff2200, flatShading: true, shininess: 0 }); + material3 = new THREE.MeshPhongMaterial({ color: 0x6622aa, flatShading: true, shininess: 0 }); + + // sound spheres + + const mesh1 = new THREE.Mesh(sphere, material1); + mesh1.position.set(-250, 30, 0); + scene.add(mesh1); + + const sound1 = new THREE.PositionalAudio(listener); + const songElement = document.getElementById('song'); + sound1.setMediaElementSource(songElement); + sound1.setRefDistance(20); + songElement.play(); + mesh1.add(sound1); + + // + + const mesh2 = new THREE.Mesh(sphere, material2); + mesh2.position.set(250, 30, 0); + scene.add(mesh2); + + const sound2 = new THREE.PositionalAudio(listener); + const skullbeatzElement = document.getElementById('skullbeatz'); + sound2.setMediaElementSource(skullbeatzElement); + sound2.setRefDistance(20); + skullbeatzElement.play(); + mesh2.add(sound2); + + // + + const mesh3 = new THREE.Mesh(sphere, material3); + mesh3.position.set(0, 30, -250); + scene.add(mesh3); + + const sound3 = new THREE.PositionalAudio(listener); + const oscillator = listener.context.createOscillator(); + oscillator.type = 'sine'; + oscillator.frequency.setValueAtTime(144, sound3.context.currentTime); + oscillator.start(0); + sound3.setNodeSource(oscillator); + sound3.setRefDistance(20); + sound3.setVolume(0.5); + mesh3.add(sound3); + + // analysers + + analyser1 = new THREE.AudioAnalyser(sound1, 32); + analyser2 = new THREE.AudioAnalyser(sound2, 32); + analyser3 = new THREE.AudioAnalyser(sound3, 32); + + // global ambient audio + + const sound4 = new THREE.Audio(listener); + const utopiaElement = document.getElementById('utopia'); + sound4.setMediaElementSource(utopiaElement); + sound4.setVolume(0.5); + utopiaElement.play(); + + // ground + + const helper = new THREE.GridHelper(1000, 10, 0x444444, 0x444444); + helper.position.y = 0.1; + scene.add(helper); + + // + + const SoundControls = function () { + this.master = listener.getMasterVolume(); + this.firstSphere = sound1.getVolume(); + this.secondSphere = sound2.getVolume(); + this.thirdSphere = sound3.getVolume(); + this.Ambient = sound4.getVolume(); + }; + + const GeneratorControls = function () { + this.frequency = oscillator.frequency.value; + this.wavetype = oscillator.type; + }; + + const gui = new GUI(); + const soundControls = new SoundControls(); + const generatorControls = new GeneratorControls(); + const volumeFolder = gui.addFolder('sound volume'); + const generatorFolder = gui.addFolder('sound generator'); + + volumeFolder + .add(soundControls, 'master') + .min(0.0) + .max(1.0) + .step(0.01) + .onChange(function () { + listener.setMasterVolume(soundControls.master); + }); + volumeFolder + .add(soundControls, 'firstSphere') + .min(0.0) + .max(1.0) + .step(0.01) + .onChange(function () { + sound1.setVolume(soundControls.firstSphere); + }); + volumeFolder + .add(soundControls, 'secondSphere') + .min(0.0) + .max(1.0) + .step(0.01) + .onChange(function () { + sound2.setVolume(soundControls.secondSphere); + }); + + volumeFolder + .add(soundControls, 'thirdSphere') + .min(0.0) + .max(1.0) + .step(0.01) + .onChange(function () { + sound3.setVolume(soundControls.thirdSphere); + }); + volumeFolder + .add(soundControls, 'Ambient') + .min(0.0) + .max(1.0) + .step(0.01) + .onChange(function () { + sound4.setVolume(soundControls.Ambient); + }); + volumeFolder.open(); + generatorFolder + .add(generatorControls, 'frequency') + .min(50.0) + .max(5000.0) + .step(1.0) + .onChange(function () { + oscillator.frequency.setValueAtTime(generatorControls.frequency, listener.context.currentTime); + }); + generatorFolder + .add(generatorControls, 'wavetype', ['sine', 'square', 'sawtooth', 'triangle']) + .onChange(function () { + oscillator.type = generatorControls.wavetype; + }); + + generatorFolder.open(); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + controls = new FirstPersonControls(camera, renderer.domElement); + + controls.movementSpeed = 70; + controls.lookSpeed = 0.05; + controls.lookVertical = false; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + controls.update(delta); + + material1.emissive.b = analyser1.getAverageFrequency() / 256; + material2.emissive.b = analyser2.getAverageFrequency() / 256; + material3.emissive.b = analyser3.getAverageFrequency() / 256; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webaudio_timing.ts b/examples-testing/examples/webaudio_timing.ts new file mode 100644 index 000000000..f37b5c5cf --- /dev/null +++ b/examples-testing/examples/webaudio_timing.ts @@ -0,0 +1,155 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let scene, camera, renderer, timer; + +const objects = []; + +const speed = 2.5; +const height = 3; +const offset = 0.5; + +const startButton = document.getElementById('startButton'); +startButton.addEventListener('click', init); + +function init() { + const overlay = document.getElementById('overlay'); + overlay.remove(); + + const container = document.getElementById('container'); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(7, 3, 7); + + // lights + + const ambientLight = new THREE.AmbientLight(0xcccccc); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); + directionalLight.position.set(0, 5, 5); + scene.add(directionalLight); + + const d = 5; + directionalLight.castShadow = true; + directionalLight.shadow.camera.left = -d; + directionalLight.shadow.camera.right = d; + directionalLight.shadow.camera.top = d; + directionalLight.shadow.camera.bottom = -d; + + directionalLight.shadow.camera.near = 1; + directionalLight.shadow.camera.far = 20; + + directionalLight.shadow.mapSize.x = 1024; + directionalLight.shadow.mapSize.y = 1024; + + // audio + + const audioLoader = new THREE.AudioLoader(); + + const listener = new THREE.AudioListener(); + camera.add(listener); + + // floor + + const floorGeometry = new THREE.PlaneGeometry(10, 10); + const floorMaterial = new THREE.MeshLambertMaterial({ color: 0x4676b6 }); + + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.rotation.x = Math.PI * -0.5; + floor.receiveShadow = true; + scene.add(floor); + + // objects + + const count = 5; + const radius = 3; + + const ballGeometry = new THREE.SphereGeometry(0.3, 32, 16); + ballGeometry.translate(0, 0.3, 0); + const ballMaterial = new THREE.MeshLambertMaterial({ color: 0xcccccc }); + + // create objects when audio buffer is loaded + + audioLoader.load('sounds/ping_pong.mp3', function (buffer) { + for (let i = 0; i < count; i++) { + const s = (i / count) * Math.PI * 2; + + const ball = new THREE.Mesh(ballGeometry, ballMaterial); + ball.castShadow = true; + ball.userData.down = false; + + ball.position.x = radius * Math.cos(s); + ball.position.z = radius * Math.sin(s); + + const audio = new THREE.PositionalAudio(listener); + audio.setBuffer(buffer); + ball.add(audio); + + scene.add(ball); + objects.push(ball); + } + + renderer.setAnimationLoop(animate); + }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + container.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 25; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const time = timer.getElapsed(); + + for (let i = 0; i < objects.length; i++) { + const ball = objects[i]; + + const previousHeight = ball.position.y; + ball.position.y = Math.abs(Math.sin(i * offset + time * speed) * height); + + if (ball.position.y < previousHeight) { + ball.userData.down = true; + } else { + if (ball.userData.down === true) { + // ball changed direction from down to up + + const audio = ball.children[0]; + audio.play(); // play audio with perfect timing when ball hits the surface + ball.userData.down = false; + } + } + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webaudio_visualizer.ts b/examples-testing/examples/webaudio_visualizer.ts new file mode 100644 index 000000000..a3f58cb36 --- /dev/null +++ b/examples-testing/examples/webaudio_visualizer.ts @@ -0,0 +1,86 @@ +import * as THREE from 'three'; + +let scene, camera, renderer, analyser, uniforms; + +const startButton = document.getElementById('startButton'); +startButton.addEventListener('click', init); + +function init() { + const fftSize = 128; + + // + + const overlay = document.getElementById('overlay'); + overlay.remove(); + + // + + const container = document.getElementById('container'); + + scene = new THREE.Scene(); + + camera = new THREE.Camera(); + + // + + const listener = new THREE.AudioListener(); + + const audio = new THREE.Audio(listener); + const file = './sounds/376737_Skullbeatz___Bad_Cat_Maste.mp3'; + + if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) { + const loader = new THREE.AudioLoader(); + loader.load(file, function (buffer) { + audio.setBuffer(buffer); + audio.play(); + }); + } else { + const mediaElement = new Audio(file); + mediaElement.play(); + + audio.setMediaElementSource(mediaElement); + } + + analyser = new THREE.AudioAnalyser(audio, fftSize); + + // + + uniforms = { + tAudioData: { value: new THREE.DataTexture(analyser.data, fftSize / 2, 1, THREE.RedFormat) }, + }; + + const material = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + }); + + const geometry = new THREE.PlaneGeometry(1, 1); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + analyser.getFrequencyData(); + + uniforms.tAudioData.value.needsUpdate = true; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_animation_keyframes.ts b/examples-testing/examples/webgl_animation_keyframes.ts new file mode 100644 index 000000000..117e7032e --- /dev/null +++ b/examples-testing/examples/webgl_animation_keyframes.ts @@ -0,0 +1,96 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Sky } from 'three/addons/objects/Sky.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +let mixer; + +const timer = new THREE.Timer(); +timer.connect(document); +const container = document.getElementById('container'); + +const stats = new Stats(); +container.appendChild(stats.dom); + +const renderer = new THREE.WebGLRenderer({ antialias: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.toneMapping = THREE.ACESFilmicToneMapping; +container.appendChild(renderer.domElement); + +const scene = new THREE.Scene(); + +// Sky + +const sky = new Sky(); +sky.scale.setScalar(10000); +scene.add(sky); + +const uniforms = sky.material.uniforms; +uniforms['turbidity'].value = 0; +uniforms['rayleigh'].value = 3; +uniforms['mieDirectionalG'].value = 0.7; +uniforms['cloudElevation'].value = 1; +uniforms['sunPosition'].value.set(-0.8, 0.19, 0.56); // elevation: 11, azimuth: -55 + +const pmremGenerator = new THREE.PMREMGenerator(renderer); +const environment = pmremGenerator.fromScene(sky).texture; +scene.environment = environment; + +const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); +camera.position.set(5, 2, 8); + +const controls = new OrbitControls(camera, renderer.domElement); +controls.enableDamping = true; +controls.target.set(0, 0.7, 0); +controls.update(); + +const dracoLoader = new DRACOLoader(); +dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + +const loader = new GLTFLoader(); +loader.setDRACOLoader(dracoLoader); +loader.load( + 'models/gltf/LittlestTokyo.glb', + function (gltf) { + const model = gltf.scene; + model.position.set(1, 1, 0); + model.scale.set(0.01, 0.01, 0.01); + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + mixer.clipAction(gltf.animations[0]).play(); + + renderer.setAnimationLoop(animate); + }, + undefined, + function (e) { + console.error(e); + }, +); + +window.onresize = function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +}; + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + mixer.update(delta); + + controls.update(); + + stats.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_animation_multiple.ts b/examples-testing/examples/webgl_animation_multiple.ts new file mode 100644 index 000000000..2456cb4cf --- /dev/null +++ b/examples-testing/examples/webgl_animation_multiple.ts @@ -0,0 +1,193 @@ +import * as THREE from 'three'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, timer; +let model, animations; + +const mixers = [], + objects = []; + +const params = { + sharedSkeleton: false, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(2, 3, -6); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 10, 50); + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); + hemiLight.position.set(0, 20, 0); + scene.add(hemiLight); + + const sunLight = new THREE.SunLight(0xffffff, 3); + sunLight.position.set(-3, 10, -10); + sunLight.castShadow = true; + sunLight.shadow.camera.far = 20; + scene.add(sunLight); + + // ground + + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(200, 200), + new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), + ); + mesh.rotation.x = -Math.PI / 2; + mesh.receiveShadow = true; + scene.add(mesh); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Soldier.glb', function (gltf) { + model = gltf.scene; + animations = gltf.animations; + + model.traverse(function (object) { + if (object.isMesh) object.castShadow = true; + }); + + setupDefaultScene(); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'sharedSkeleton').onChange(function () { + clearScene(); + + if (params.sharedSkeleton === true) { + setupSharedSkeletonScene(); + } else { + setupDefaultScene(); + } + }); + gui.open(); +} + +function clearScene() { + for (const mixer of mixers) { + mixer.stopAllAction(); + } + + mixers.length = 0; + + // + + for (const object of objects) { + scene.remove(object); + + scene.traverse(function (child) { + if (child.isSkinnedMesh) child.skeleton.dispose(); + }); + } +} + +function setupDefaultScene() { + // three cloned models with independent skeletons. + // each model can have its own animation state + + const model1 = SkeletonUtils.clone(model); + const model2 = SkeletonUtils.clone(model); + const model3 = SkeletonUtils.clone(model); + + model1.position.x = -2; + model2.position.x = 0; + model3.position.x = 2; + + const mixer1 = new THREE.AnimationMixer(model1); + const mixer2 = new THREE.AnimationMixer(model2); + const mixer3 = new THREE.AnimationMixer(model3); + + mixer1.clipAction(animations[0]).play(); // idle + mixer2.clipAction(animations[1]).play(); // run + mixer3.clipAction(animations[3]).play(); // walk + + scene.add(model1, model2, model3); + + objects.push(model1, model2, model3); + mixers.push(mixer1, mixer2, mixer3); +} + +function setupSharedSkeletonScene() { + // three cloned models with a single shared skeleton. + // all models share the same animation state + + const sharedModel = SkeletonUtils.clone(model); + const shareSkinnedMesh = sharedModel.getObjectByName('vanguard_Mesh'); + const sharedSkeleton = shareSkinnedMesh.skeleton; + const sharedParentBone = sharedModel.getObjectByName('mixamorigHips'); + scene.add(sharedParentBone); // the bones need to be in the scene for the animation to work + + const model1 = shareSkinnedMesh.clone(); + const model2 = shareSkinnedMesh.clone(); + const model3 = shareSkinnedMesh.clone(); + + model1.bindMode = THREE.DetachedBindMode; + model2.bindMode = THREE.DetachedBindMode; + model3.bindMode = THREE.DetachedBindMode; + + const identity = new THREE.Matrix4(); + + model1.bind(sharedSkeleton, identity); + model2.bind(sharedSkeleton, identity); + model3.bind(sharedSkeleton, identity); + + model1.position.x = -2; + model2.position.x = 0; + model3.position.x = 2; + + // apply transformation from the glTF asset + + model1.scale.setScalar(0.01); + model1.rotation.x = -Math.PI * 0.5; + model2.scale.setScalar(0.01); + model2.rotation.x = -Math.PI * 0.5; + model3.scale.setScalar(0.01); + model3.rotation.x = -Math.PI * 0.5; + + // + + const mixer = new THREE.AnimationMixer(sharedParentBone); + mixer.clipAction(animations[1]).play(); + + scene.add(sharedParentBone, model1, model2, model3); + + objects.push(sharedParentBone, model1, model2, model3); + mixers.push(mixer); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + for (const mixer of mixers) mixer.update(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_animation_skinning_morph.ts b/examples-testing/examples/webgl_animation_skinning_morph.ts new file mode 100644 index 000000000..0ae68e7d7 --- /dev/null +++ b/examples-testing/examples/webgl_animation_skinning_morph.ts @@ -0,0 +1,190 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let container, stats, timer, gui, mixer, actions, activeAction, previousAction; +let camera, scene, renderer, model, face; + +const api = { state: 'Walking' }; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 100); + camera.position.set(-5, 3, 10); + camera.lookAt(0, 2, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xe0e0e0); + scene.fog = new THREE.Fog(0xe0e0e0, 20, 100); + + timer = new THREE.Timer(); + timer.connect(document); + + // lights + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); + hemiLight.position.set(0, 20, 0); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(0, 20, 10); + scene.add(dirLight); + + // ground + + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(2000, 2000), + new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), + ); + mesh.rotation.x = -Math.PI / 2; + scene.add(mesh); + + const grid = new THREE.GridHelper(200, 40, 0x000000, 0x000000); + grid.material.opacity = 0.2; + grid.material.transparent = true; + scene.add(grid); + + // model + + const loader = new GLTFLoader(); + loader.load( + 'models/gltf/RobotExpressive/RobotExpressive.glb', + function (gltf) { + model = gltf.scene; + scene.add(model); + + createGUI(model, gltf.animations); + }, + undefined, + function (e) { + console.error(e); + }, + ); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + // stats + stats = new Stats(); + container.appendChild(stats.dom); +} + +function createGUI(model, animations) { + const states = ['Idle', 'Walking', 'Running', 'Dance', 'Death', 'Sitting', 'Standing']; + const emotes = ['Jump', 'Yes', 'No', 'Wave', 'Punch', 'ThumbsUp']; + + gui = new GUI(); + + mixer = new THREE.AnimationMixer(model); + + actions = {}; + + for (let i = 0; i < animations.length; i++) { + const clip = animations[i]; + const action = mixer.clipAction(clip); + actions[clip.name] = action; + + if (emotes.indexOf(clip.name) >= 0 || states.indexOf(clip.name) >= 4) { + action.clampWhenFinished = true; + action.loop = THREE.LoopOnce; + } + } + + // states + + const statesFolder = gui.addFolder('States'); + + const clipCtrl = statesFolder.add(api, 'state').options(states); + + clipCtrl.onChange(function () { + fadeToAction(api.state, 0.5); + }); + + statesFolder.open(); + + // emotes + + const emoteFolder = gui.addFolder('Emotes'); + + function createEmoteCallback(name) { + api[name] = function () { + fadeToAction(name, 0.2); + + mixer.addEventListener('finished', restoreState); + }; + + emoteFolder.add(api, name); + } + + function restoreState() { + mixer.removeEventListener('finished', restoreState); + + fadeToAction(api.state, 0.2); + } + + for (let i = 0; i < emotes.length; i++) { + createEmoteCallback(emotes[i]); + } + + emoteFolder.open(); + + // expressions + + face = model.getObjectByName('Head_4'); + + const expressions = Object.keys(face.morphTargetDictionary); + const expressionFolder = gui.addFolder('Expressions'); + + for (let i = 0; i < expressions.length; i++) { + expressionFolder.add(face.morphTargetInfluences, i, 0, 1, 0.01).name(expressions[i]); + } + + activeAction = actions['Walking']; + activeAction.play(); + + expressionFolder.open(); +} + +function fadeToAction(name, duration) { + previousAction = activeAction; + activeAction = actions[name]; + + if (previousAction !== activeAction) { + previousAction.fadeOut(duration); + } + + activeAction.reset().setEffectiveTimeScale(1).setEffectiveWeight(1).fadeIn(duration).play(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const dt = timer.getDelta(); + + if (mixer) mixer.update(dt); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_animation_walk.ts b/examples-testing/examples/webgl_animation_walk.ts new file mode 100644 index 000000000..88f4da5e8 --- /dev/null +++ b/examples-testing/examples/webgl_animation_walk.ts @@ -0,0 +1,367 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let scene, renderer, camera, floor, orbitControls; +let group, model, skeleton, mixer, timer; + +let actions; + +const settings = { + show_skeleton: false, + fixe_transition: true, +}; + +const PI = Math.PI; +const PI90 = Math.PI / 2; + +const controls = { + key: [0, 0], + ease: new THREE.Vector3(), + position: new THREE.Vector3(), + up: new THREE.Vector3(0, 1, 0), + rotate: new THREE.Quaternion(), + current: 'Idle', + fadeDuration: 0.5, + runVelocity: 5, + walkVelocity: 1.8, + rotateSpeed: 0.05, + floorDecale: 0, +}; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 2, -5); + + timer = new THREE.Timer(); + timer.connect(document); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x5e5d5d); + scene.fog = new THREE.Fog(0x5e5d5d, 2, 20); + + group = new THREE.Group(); + scene.add(group); + + const sunLight = new THREE.SunLight(0xffffff, 5); + sunLight.position.set(-2, 5, -3); + sunLight.castShadow = true; + sunLight.shadow.camera.far = 20; + scene.add(sunLight); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.5; + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + container.appendChild(renderer.domElement); + + orbitControls = new OrbitControls(camera, renderer.domElement); + orbitControls.target.set(0, 1, 0); + orbitControls.enableDamping = true; + orbitControls.enablePan = false; + orbitControls.maxPolarAngle = PI90 - 0.05; + orbitControls.update(); + + // EVENTS + + window.addEventListener('resize', onWindowResize); + document.addEventListener('keydown', onKeyDown); + document.addEventListener('keyup', onKeyUp); + + // DEMO + + new HDRLoader().setPath('textures/equirectangular/').load('lobe.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + scene.environment = texture; + scene.environmentIntensity = 1.5; + + loadModel(); + addFloor(); + }); +} + +function addFloor() { + const size = 50; + const repeat = 16; + + const maxAnisotropy = renderer.capabilities.getMaxAnisotropy(); + + const floorT = new THREE.TextureLoader().load('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); + floorT.colorSpace = THREE.SRGBColorSpace; + floorT.repeat.set(repeat, repeat); + floorT.wrapS = floorT.wrapT = THREE.RepeatWrapping; + floorT.anisotropy = maxAnisotropy; + + const floorN = new THREE.TextureLoader().load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); + floorN.repeat.set(repeat, repeat); + floorN.wrapS = floorN.wrapT = THREE.RepeatWrapping; + floorN.anisotropy = maxAnisotropy; + + const mat = new THREE.MeshStandardMaterial({ + map: floorT, + normalMap: floorN, + normalScale: new THREE.Vector2(0.5, 0.5), + color: 0x404040, + depthWrite: false, + roughness: 0.85, + }); + + const g = new THREE.PlaneGeometry(size, size, 50, 50); + g.rotateX(-PI90); + + floor = new THREE.Mesh(g, mat); + floor.receiveShadow = true; + scene.add(floor); + + controls.floorDecale = (size / repeat) * 4; + + const bulbGeometry = new THREE.SphereGeometry(0.05, 16, 8); + const bulbLight = new THREE.PointLight(0xffee88, 2, 500, 2); + + const bulbMat = new THREE.MeshStandardMaterial({ emissive: 0xffffee, emissiveIntensity: 1, color: 0x000000 }); + bulbLight.add(new THREE.Mesh(bulbGeometry, bulbMat)); + bulbLight.position.set(1, 0.1, -3); + bulbLight.castShadow = true; + floor.add(bulbLight); +} + +function loadModel() { + const loader = new GLTFLoader(); + loader.load('models/gltf/Soldier.glb', function (gltf) { + model = gltf.scene; + group.add(model); + model.rotation.y = PI; + group.rotation.y = PI; + + model.traverse(function (object) { + if (object.isMesh) { + if (object.name == 'vanguard_Mesh') { + object.castShadow = true; + object.receiveShadow = true; + //object.material.envMapIntensity = 0.5; + object.material.metalness = 1.0; + object.material.roughness = 0.2; + object.material.color.set(1, 1, 1); + object.material.metalnessMap = object.material.map; + } else { + object.material.metalness = 1; + object.material.roughness = 0; + object.material.transparent = true; + object.material.opacity = 0.8; + object.material.color.set(1, 1, 1); + } + } + }); + + // + + skeleton = new THREE.SkeletonHelper(model); + skeleton.setColors(new THREE.Color(0xe000ff), new THREE.Color(0x00e0ff)); + skeleton.visible = false; + scene.add(skeleton); + + // + + createPanel(); + + // + + const animations = gltf.animations; + + mixer = new THREE.AnimationMixer(model); + + actions = { + Idle: mixer.clipAction(animations[0]), + Walk: mixer.clipAction(animations[3]), + Run: mixer.clipAction(animations[1]), + }; + + for (const m in actions) { + actions[m].enabled = true; + actions[m].setEffectiveTimeScale(1); + if (m !== 'Idle') actions[m].setEffectiveWeight(0); + } + + actions.Idle.play(); + + animate(); + }); +} + +function updateCharacter(delta) { + const fade = controls.fadeDuration; + const key = controls.key; + const up = controls.up; + const ease = controls.ease; + const rotate = controls.rotate; + const position = controls.position; + const azimuth = orbitControls.getAzimuthalAngle(); + + const active = key[0] === 0 && key[1] === 0 ? false : true; + const play = active ? (key[2] ? 'Run' : 'Walk') : 'Idle'; + + // change animation + + if (controls.current != play) { + const current = actions[play]; + const old = actions[controls.current]; + controls.current = play; + + if (settings.fixe_transition) { + current.reset(); + current.weight = 1.0; + current.stopFading(); + old.stopFading(); + // synchro if not idle + if (play !== 'Idle') current.time = old.time * (current.getClip().duration / old.getClip().duration); + old._scheduleFading(fade, old.getEffectiveWeight(), 0); + current._scheduleFading(fade, current.getEffectiveWeight(), 1); + current.play(); + } else { + setWeight(current, 1.0); + old.fadeOut(fade); + current.reset().fadeIn(fade).play(); + } + } + + // move object + + if (controls.current !== 'Idle') { + // run/walk velocity + const velocity = controls.current == 'Run' ? controls.runVelocity : controls.walkVelocity; + + // direction with key + ease.set(key[1], 0, key[0]).multiplyScalar(velocity * delta); + + // calculate camera direction + const angle = unwrapRad(Math.atan2(ease.x, ease.z) + azimuth); + rotate.setFromAxisAngle(up, angle); + + // apply camera angle on ease + controls.ease.applyAxisAngle(up, azimuth); + + position.add(ease); + camera.position.add(ease); + + group.position.copy(position); + group.quaternion.rotateTowards(rotate, controls.rotateSpeed); + + orbitControls.target.copy(position).add({ x: 0, y: 1, z: 0 }); + + // Move the floor without any limit + const dx = position.x - floor.position.x; + const dz = position.z - floor.position.z; + if (Math.abs(dx) > controls.floorDecale) floor.position.x += dx; + if (Math.abs(dz) > controls.floorDecale) floor.position.z += dz; + } + + if (mixer) mixer.update(delta); + + orbitControls.update(); +} + +function unwrapRad(r) { + return Math.atan2(Math.sin(r), Math.cos(r)); +} + +function createPanel() { + const panel = new GUI({ width: 310 }); + + panel.add(settings, 'show_skeleton').onChange(b => { + skeleton.visible = b; + }); + + panel.add(settings, 'fixe_transition'); +} + +function setWeight(action, weight) { + action.enabled = true; + action.setEffectiveTimeScale(1); + action.setEffectiveWeight(weight); +} + +function onKeyDown(event) { + const key = controls.key; + switch (event.code) { + case 'ArrowUp': + case 'KeyW': + case 'KeyZ': + key[0] = -1; + break; + case 'ArrowDown': + case 'KeyS': + key[0] = 1; + break; + case 'ArrowLeft': + case 'KeyA': + case 'KeyQ': + key[1] = -1; + break; + case 'ArrowRight': + case 'KeyD': + key[1] = 1; + break; + case 'ShiftLeft': + case 'ShiftRight': + key[2] = 1; + break; + } +} + +function onKeyUp(event) { + const key = controls.key; + switch (event.code) { + case 'ArrowUp': + case 'KeyW': + case 'KeyZ': + key[0] = key[0] < 0 ? 0 : key[0]; + break; + case 'ArrowDown': + case 'KeyS': + key[0] = key[0] > 0 ? 0 : key[0]; + break; + case 'ArrowLeft': + case 'KeyA': + case 'KeyQ': + key[1] = key[1] < 0 ? 0 : key[1]; + break; + case 'ArrowRight': + case 'KeyD': + key[1] = key[1] > 0 ? 0 : key[1]; + break; + case 'ShiftLeft': + case 'ShiftRight': + key[2] = 0; + break; + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + // Render loop + + const delta = timer.getDelta(); + + updateCharacter(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_buffergeometry.ts b/examples-testing/examples/webgl_buffergeometry.ts new file mode 100644 index 000000000..28b2c96a4 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry.ts @@ -0,0 +1,178 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let mesh; + +init(); +animate(); + +function init() { + container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); + camera.position.z = 2750; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const light1 = new THREE.DirectionalLight(0xffffff, 1.5); + light1.position.set(1, 1, 1); + scene.add(light1); + + const light2 = new THREE.DirectionalLight(0xffffff, 4.5); + light2.position.set(0, -1, 0); + scene.add(light2); + + // + + const triangles = 160000; + + const geometry = new THREE.BufferGeometry(); + + const positions = []; + const normals = []; + const colors = []; + + const color = new THREE.Color(); + + const n = 800, + n2 = n / 2; // triangles spread in the cube + const d = 12, + d2 = d / 2; // individual triangle size + + const pA = new THREE.Vector3(); + const pB = new THREE.Vector3(); + const pC = new THREE.Vector3(); + + const cb = new THREE.Vector3(); + const ab = new THREE.Vector3(); + + for (let i = 0; i < triangles; i++) { + // positions + + const x = Math.random() * n - n2; + const y = Math.random() * n - n2; + const z = Math.random() * n - n2; + + const ax = x + Math.random() * d - d2; + const ay = y + Math.random() * d - d2; + const az = z + Math.random() * d - d2; + + const bx = x + Math.random() * d - d2; + const by = y + Math.random() * d - d2; + const bz = z + Math.random() * d - d2; + + const cx = x + Math.random() * d - d2; + const cy = y + Math.random() * d - d2; + const cz = z + Math.random() * d - d2; + + positions.push(ax, ay, az); + positions.push(bx, by, bz); + positions.push(cx, cy, cz); + + // flat face normals + + pA.set(ax, ay, az); + pB.set(bx, by, bz); + pC.set(cx, cy, cz); + + cb.subVectors(pC, pB); + ab.subVectors(pA, pB); + cb.cross(ab); + + cb.normalize(); + + const nx = cb.x; + const ny = cb.y; + const nz = cb.z; + + normals.push(nx, ny, nz); + normals.push(nx, ny, nz); + normals.push(nx, ny, nz); + + // colors + + const vx = x / n + 0.5; + const vy = y / n + 0.5; + const vz = z / n + 0.5; + + color.setRGB(vx, vy, vz); + + const alpha = Math.random(); + + colors.push(color.r, color.g, color.b, alpha); + colors.push(color.r, color.g, color.b, alpha); + colors.push(color.r, color.g, color.b, alpha); + } + + function disposeArray() { + this.array = null; + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3).onUpload(disposeArray)); + geometry.setAttribute('normal', new THREE.Float32BufferAttribute(normals, 3).onUpload(disposeArray)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 4).onUpload(disposeArray)); + + geometry.computeBoundingSphere(); + + const material = new THREE.MeshPhongMaterial({ + color: 0xd5d5d5, + specular: 0xffffff, + shininess: 250, + side: THREE.DoubleSide, + vertexColors: true, + transparent: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = Date.now() * 0.001; + + mesh.rotation.x = time * 0.25; + mesh.rotation.y = time * 0.5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_attributes_integer.ts b/examples-testing/examples/webgl_buffergeometry_attributes_integer.ts new file mode 100644 index 000000000..00490b716 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_attributes_integer.ts @@ -0,0 +1,142 @@ +import * as THREE from 'three'; + +let camera, scene, renderer, mesh; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); + camera.position.z = 2500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // geometry + + const triangles = 10000; + + const geometry = new THREE.BufferGeometry(); + + const positions = []; + const uvs = []; + const textureIndices = []; + + const n = 800, + n2 = n / 2; // triangles spread in the cube + const d = 50, + d2 = d / 2; // individual triangle size + + for (let i = 0; i < triangles; i++) { + // positions + + const x = Math.random() * n - n2; + const y = Math.random() * n - n2; + const z = Math.random() * n - n2; + + const ax = x + Math.random() * d - d2; + const ay = y + Math.random() * d - d2; + const az = z + Math.random() * d - d2; + + const bx = x + Math.random() * d - d2; + const by = y + Math.random() * d - d2; + const bz = z + Math.random() * d - d2; + + const cx = x + Math.random() * d - d2; + const cy = y + Math.random() * d - d2; + const cz = z + Math.random() * d - d2; + + positions.push(ax, ay, az); + positions.push(bx, by, bz); + positions.push(cx, cy, cz); + + // uvs + + uvs.push(0, 0); + uvs.push(0.5, 1); + uvs.push(1, 0); + + // texture indices + + const t = i % 3; + textureIndices.push(t, t, t); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geometry.setAttribute('uv', new THREE.Float32BufferAttribute(uvs, 2)); + geometry.setAttribute('textureIndex', new THREE.Int16BufferAttribute(textureIndices, 1)); + geometry.attributes.textureIndex.gpuType = THREE.IntType; + + geometry.computeBoundingSphere(); + + // material + + const loader = new THREE.TextureLoader(); + + const map1 = loader.load('textures/crate.gif'); + const map2 = loader.load('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); + const map3 = loader.load('textures/terrain/grasslight-big.jpg'); + + const material = new THREE.ShaderMaterial({ + uniforms: { + uTextures: { + value: [map1, map2, map3], + }, + }, + vertexShader: /* glsl */ ` + in int textureIndex; + + flat out int vIndex; // "flat" indicates that the value will not be interpolated (required for integer attributes) + out vec2 vUv; + + void main() { + + vIndex = textureIndex; + vUv = uv; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + } + `, + fragmentShader: /* glsl */ ` + flat in int vIndex; + in vec2 vUv; + + uniform sampler2D uTextures[ 3 ]; + + out vec4 outColor; + + void main() { + + if ( vIndex == 0 ) outColor = texture( uTextures[ 0 ], vUv ); + else if ( vIndex == 1 ) outColor = texture( uTextures[ 1 ], vUv ); + else if ( vIndex == 2 ) outColor = texture( uTextures[ 2 ], vUv ); + + } + `, + side: THREE.DoubleSide, + glslVersion: THREE.GLSL3, + }); + + // mesh + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); +} + +function animate() { + const time = Date.now() * 0.001; + + mesh.rotation.x = time * 0.25; + mesh.rotation.y = time * 0.5; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_buffergeometry_attributes_none.ts b/examples-testing/examples/webgl_buffergeometry_attributes_none.ts new file mode 100644 index 000000000..a1424e871 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_attributes_none.ts @@ -0,0 +1,56 @@ +import * as THREE from 'three'; + +let camera, scene, renderer, mesh; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); + camera.position.z = 4; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // geometry + + const triangleCount = 10000; + const vertexCountPerTriangle = 3; + const vertexCount = triangleCount * vertexCountPerTriangle; + + const geometry = new THREE.BufferGeometry(); + geometry.setDrawRange(0, vertexCount); + + // material + + const material = new THREE.RawShaderMaterial({ + uniforms: { + seed: { value: 42 }, + }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + side: THREE.DoubleSide, + glslVersion: THREE.GLSL3, + }); + + // mesh + + mesh = new THREE.Mesh(geometry, material); + mesh.frustumCulled = false; + scene.add(mesh); + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); +} + +function animate(time) { + mesh.rotation.x = (time / 1000.0) * 0.25; + mesh.rotation.y = (time / 1000.0) * 0.5; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts b/examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts new file mode 100644 index 000000000..0dffa65cc --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts @@ -0,0 +1,103 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let renderer, scene, camera, stats; + +let particleSystem, uniforms, geometry; + +const particles = 100000; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 300; + + scene = new THREE.Scene(); + + uniforms = { + pointTexture: { value: new THREE.TextureLoader().load('textures/sprites/spark1.png') }, + }; + + const shaderMaterial = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + + blending: THREE.AdditiveBlending, + depthTest: false, + transparent: true, + vertexColors: true, + }); + + const radius = 200; + + geometry = new THREE.BufferGeometry(); + + const positions = []; + const colors = []; + const sizes = []; + + const color = new THREE.Color(); + + for (let i = 0; i < particles; i++) { + positions.push((Math.random() * 2 - 1) * radius); + positions.push((Math.random() * 2 - 1) * radius); + positions.push((Math.random() * 2 - 1) * radius); + + color.setHSL(i / particles, 1.0, 0.5); + + colors.push(color.r, color.g, color.b); + + sizes.push(20); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1).setUsage(THREE.DynamicDrawUsage)); + + particleSystem = new THREE.Points(geometry, shaderMaterial); + + scene.add(particleSystem); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + const container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = Date.now() * 0.005; + + particleSystem.rotation.z = 0.01 * time; + + const sizes = geometry.attributes.size.array; + + for (let i = 0; i < particles; i++) { + sizes[i] = 10 * (1 + Math.sin(0.1 * i + time)); + } + + geometry.attributes.size.needsUpdate = true; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_drawrange.ts b/examples-testing/examples/webgl_buffergeometry_drawrange.ts new file mode 100644 index 000000000..142ff43bf --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_drawrange.ts @@ -0,0 +1,239 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let group; +let container, stats; +const particlesData = []; +let camera, scene, renderer; +let positions, colors; +let particles; +let pointCloud; +let particlePositions; +let linesMesh; + +const maxParticleCount = 1000; +let particleCount = 500; +const r = 800; +const rHalf = r / 2; + +const effectController = { + showDots: true, + showLines: true, + minDistance: 150, + limitConnections: false, + maxConnections: 20, + particleCount: 500, +}; + +init(); + +function initGUI() { + const gui = new GUI(); + + gui.add(effectController, 'showDots').onChange(function (value) { + pointCloud.visible = value; + }); + gui.add(effectController, 'showLines').onChange(function (value) { + linesMesh.visible = value; + }); + gui.add(effectController, 'minDistance', 10, 300); + gui.add(effectController, 'limitConnections'); + gui.add(effectController, 'maxConnections', 0, 30, 1); + gui.add(effectController, 'particleCount', 0, maxParticleCount, 1).onChange(function (value) { + particleCount = value; + particles.setDrawRange(0, particleCount); + }); +} + +function init() { + initGUI(); + + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 4000); + camera.position.z = 1750; + + const controls = new OrbitControls(camera, container); + controls.minDistance = 1000; + controls.maxDistance = 3000; + + scene = new THREE.Scene(); + + group = new THREE.Group(); + scene.add(group); + + const helper = new THREE.BoxHelper(new THREE.Mesh(new THREE.BoxGeometry(r, r, r))); + helper.material.color.setHex(0x474747); + helper.material.blending = THREE.AdditiveBlending; + helper.material.transparent = true; + group.add(helper); + + const segments = maxParticleCount * maxParticleCount; + + positions = new Float32Array(segments * 3); + colors = new Float32Array(segments * 3); + + const pMaterial = new THREE.PointsMaterial({ + color: 0xffffff, + size: 3, + blending: THREE.AdditiveBlending, + transparent: true, + sizeAttenuation: false, + }); + + particles = new THREE.BufferGeometry(); + particlePositions = new Float32Array(maxParticleCount * 3); + + for (let i = 0; i < maxParticleCount; i++) { + const x = Math.random() * r - r / 2; + const y = Math.random() * r - r / 2; + const z = Math.random() * r - r / 2; + + particlePositions[i * 3] = x; + particlePositions[i * 3 + 1] = y; + particlePositions[i * 3 + 2] = z; + + // add it to the geometry + particlesData.push({ + velocity: new THREE.Vector3(-1 + Math.random() * 2, -1 + Math.random() * 2, -1 + Math.random() * 2), + numConnections: 0, + }); + } + + particles.setDrawRange(0, particleCount); + particles.setAttribute( + 'position', + new THREE.BufferAttribute(particlePositions, 3).setUsage(THREE.DynamicDrawUsage), + ); + + // create the particle system + pointCloud = new THREE.Points(particles, pMaterial); + group.add(pointCloud); + + const geometry = new THREE.BufferGeometry(); + + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3).setUsage(THREE.DynamicDrawUsage)); + geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3).setUsage(THREE.DynamicDrawUsage)); + + geometry.computeBoundingSphere(); + + geometry.setDrawRange(0, 0); + + const material = new THREE.LineBasicMaterial({ + vertexColors: true, + blending: THREE.AdditiveBlending, + transparent: true, + }); + + linesMesh = new THREE.LineSegments(geometry, material); + group.add(linesMesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + let vertexpos = 0; + let colorpos = 0; + let numConnected = 0; + + for (let i = 0; i < particleCount; i++) particlesData[i].numConnections = 0; + + for (let i = 0; i < particleCount; i++) { + // get the particle + const particleData = particlesData[i]; + + particlePositions[i * 3] += particleData.velocity.x; + particlePositions[i * 3 + 1] += particleData.velocity.y; + particlePositions[i * 3 + 2] += particleData.velocity.z; + + if (particlePositions[i * 3 + 1] < -rHalf || particlePositions[i * 3 + 1] > rHalf) + particleData.velocity.y = -particleData.velocity.y; + + if (particlePositions[i * 3] < -rHalf || particlePositions[i * 3] > rHalf) + particleData.velocity.x = -particleData.velocity.x; + + if (particlePositions[i * 3 + 2] < -rHalf || particlePositions[i * 3 + 2] > rHalf) + particleData.velocity.z = -particleData.velocity.z; + + if (effectController.limitConnections && particleData.numConnections >= effectController.maxConnections) + continue; + + // Check collision + for (let j = i + 1; j < particleCount; j++) { + const particleDataB = particlesData[j]; + if (effectController.limitConnections && particleDataB.numConnections >= effectController.maxConnections) + continue; + + const dx = particlePositions[i * 3] - particlePositions[j * 3]; + const dy = particlePositions[i * 3 + 1] - particlePositions[j * 3 + 1]; + const dz = particlePositions[i * 3 + 2] - particlePositions[j * 3 + 2]; + const dist = Math.sqrt(dx * dx + dy * dy + dz * dz); + + if (dist < effectController.minDistance) { + particleData.numConnections++; + particleDataB.numConnections++; + + const alpha = 1.0 - dist / effectController.minDistance; + + positions[vertexpos++] = particlePositions[i * 3]; + positions[vertexpos++] = particlePositions[i * 3 + 1]; + positions[vertexpos++] = particlePositions[i * 3 + 2]; + + positions[vertexpos++] = particlePositions[j * 3]; + positions[vertexpos++] = particlePositions[j * 3 + 1]; + positions[vertexpos++] = particlePositions[j * 3 + 2]; + + colors[colorpos++] = alpha; + colors[colorpos++] = alpha; + colors[colorpos++] = alpha; + + colors[colorpos++] = alpha; + colors[colorpos++] = alpha; + colors[colorpos++] = alpha; + + numConnected++; + } + } + } + + linesMesh.geometry.setDrawRange(0, numConnected * 2); + linesMesh.geometry.attributes.position.needsUpdate = true; + linesMesh.geometry.attributes.color.needsUpdate = true; + + pointCloud.geometry.attributes.position.needsUpdate = true; + + render(); + + stats.update(); +} + +function render() { + const time = Date.now() * 0.001; + + group.rotation.y = time * 0.1; + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts b/examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts new file mode 100644 index 000000000..80fa828bb --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts @@ -0,0 +1,140 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let points; + +const particles = 300000; +let drawCount = 10000; + +init(); +animate(); + +function init() { + container = document.getElementById('container'); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 5, 3500); + camera.position.z = 2750; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // + + const geometry = new THREE.BufferGeometry(); + + const positions = []; + const positions2 = []; + const colors = []; + + const color = new THREE.Color(); + + const n = 1000, + n2 = n / 2; // particles spread in the cube + + for (let i = 0; i < particles; i++) { + // positions + + const x = Math.random() * n - n2; + const y = Math.random() * n - n2; + const z = Math.random() * n - n2; + + positions.push(x, y, z); + positions2.push(z * 0.3, x * 0.3, y * 0.3); + + // colors + + const vx = x / n + 0.5; + const vy = y / n + 0.5; + const vz = z / n + 0.5; + + color.setRGB(vx, vy, vz, THREE.SRGBColorSpace); + + const hex = color.getHex(THREE.LinearSRGBColorSpace); + colors.push((hex >> 16) & 255, (hex >> 8) & 255, hex & 255); + } + + const gl = renderer.getContext(); + + const pos = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, pos); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); + + const pos2 = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, pos2); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions2), gl.STATIC_DRAW); + + const rgb = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, rgb); + gl.bufferData(gl.ARRAY_BUFFER, new Uint8Array(colors), gl.STATIC_DRAW); + + const posAttr1 = new THREE.GLBufferAttribute(pos, gl.FLOAT, 3, 4, particles); + const posAttr2 = new THREE.GLBufferAttribute(pos2, gl.FLOAT, 3, 4, particles); + geometry.setAttribute('position', posAttr1); + + setInterval(function () { + const attr = geometry.getAttribute('position'); + + geometry.setAttribute('position', attr === posAttr1 ? posAttr2 : posAttr1); + }, 2000); + + geometry.setAttribute('color', new THREE.GLBufferAttribute(rgb, gl.UNSIGNED_BYTE, 3, 1, particles, true)); + + // + + const material = new THREE.PointsMaterial({ size: 15, vertexColors: true }); + + points = new THREE.Points(geometry, material); + + geometry.boundingSphere = new THREE.Sphere().set(new THREE.Vector3(), 500); + + scene.add(points); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + drawCount = (Math.max(5000, drawCount) + Math.floor(500 * Math.random())) % particles; + points.geometry.setDrawRange(0, drawCount); + + const time = Date.now() * 0.001; + + points.rotation.x = time * 0.1; + points.rotation.y = time * 0.2; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_indexed.ts b/examples-testing/examples/webgl_buffergeometry_indexed.ts new file mode 100644 index 000000000..a2f9f3795 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_indexed.ts @@ -0,0 +1,137 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, stats; + +let mesh; + +init(); + +function init() { + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); + camera.position.z = 64; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + + // + + const light = new THREE.HemisphereLight(); + light.intensity = 3; + scene.add(light); + + // + + const geometry = new THREE.BufferGeometry(); + + const indices = []; + + const vertices = []; + const normals = []; + const colors = []; + + const size = 20; + const segments = 10; + + const halfSize = size / 2; + const segmentSize = size / segments; + + const _color = new THREE.Color(); + + // generate vertices, normals and color data for a simple grid geometry + + for (let i = 0; i <= segments; i++) { + const y = i * segmentSize - halfSize; + + for (let j = 0; j <= segments; j++) { + const x = j * segmentSize - halfSize; + + vertices.push(x, -y, 0); + normals.push(0, 0, 1); + + const r = x / size + 0.5; + const g = y / size + 0.5; + + _color.setRGB(r, g, 1, THREE.SRGBColorSpace); + + colors.push(_color.r, _color.g, _color.b); + } + } + + // generate indices (data for element array buffer) + + for (let i = 0; i < segments; i++) { + for (let j = 0; j < segments; j++) { + const a = i * (segments + 1) + (j + 1); + const b = i * (segments + 1) + j; + const c = (i + 1) * (segments + 1) + j; + const d = (i + 1) * (segments + 1) + (j + 1); + + // generate two faces (triangles) per iteration + + indices.push(a, b, d); // face one + indices.push(b, c, d); // face two + } + } + + // + + geometry.setIndex(indices); + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + geometry.setAttribute('normal', new THREE.Float32BufferAttribute(normals, 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + const material = new THREE.MeshPhongMaterial({ + side: THREE.DoubleSide, + vertexColors: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + const gui = new GUI(); + gui.add(material, 'wireframe'); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = Date.now() * 0.001; + + mesh.rotation.x = time * 0.25; + mesh.rotation.y = time * 0.5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_instancing.ts b/examples-testing/examples/webgl_buffergeometry_instancing.ts new file mode 100644 index 000000000..b27f500f0 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_instancing.ts @@ -0,0 +1,138 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let container, stats; + +let camera, scene, renderer; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10); + camera.position.z = 2; + + scene = new THREE.Scene(); + + // geometry + + const vector = new THREE.Vector4(); + + const instances = 50000; + + const positions = []; + const offsets = []; + const colors = []; + const orientationsStart = []; + const orientationsEnd = []; + + positions.push(0.025, -0.025, 0); + positions.push(-0.025, 0.025, 0); + positions.push(0, 0, 0.025); + + // instanced attributes + + for (let i = 0; i < instances; i++) { + // offsets + + offsets.push(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + + // colors + + colors.push(Math.random(), Math.random(), Math.random(), Math.random()); + + // orientation start + + vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); + vector.normalize(); + + orientationsStart.push(vector.x, vector.y, vector.z, vector.w); + + // orientation end + + vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); + vector.normalize(); + + orientationsEnd.push(vector.x, vector.y, vector.z, vector.w); + } + + const geometry = new THREE.InstancedBufferGeometry(); + geometry.instanceCount = instances; // set so its initialized for dat.GUI, will be set in first draw otherwise + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + + geometry.setAttribute('offset', new THREE.InstancedBufferAttribute(new Float32Array(offsets), 3)); + geometry.setAttribute('color', new THREE.InstancedBufferAttribute(new Float32Array(colors), 4)); + geometry.setAttribute( + 'orientationStart', + new THREE.InstancedBufferAttribute(new Float32Array(orientationsStart), 4), + ); + geometry.setAttribute('orientationEnd', new THREE.InstancedBufferAttribute(new Float32Array(orientationsEnd), 4)); + + // material + + const material = new THREE.RawShaderMaterial({ + uniforms: { + time: { value: 1.0 }, + sineTime: { value: 1.0 }, + }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + side: THREE.DoubleSide, + forceSinglePass: true, + transparent: true, + }); + + // + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + const gui = new GUI({ width: 350 }); + gui.add(geometry, 'instanceCount', 0, instances); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = performance.now(); + + const object = scene.children[0]; + + object.rotation.y = time * 0.0005; + object.material.uniforms['time'].value = time * 0.005; + object.material.uniforms['sineTime'].value = Math.sin(object.material.uniforms['time'].value * 0.05); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts b/examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts new file mode 100644 index 000000000..2158dff39 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts @@ -0,0 +1,86 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; +let geometry, material, mesh; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.z = 1400; + + scene = new THREE.Scene(); + + const circleGeometry = new THREE.CircleGeometry(1, 6); + + geometry = new THREE.InstancedBufferGeometry(); + geometry.index = circleGeometry.index; + geometry.attributes = circleGeometry.attributes; + + const particleCount = 75000; + + const translateArray = new Float32Array(particleCount * 3); + + for (let i = 0, i3 = 0, l = particleCount; i < l; i++, i3 += 3) { + translateArray[i3 + 0] = Math.random() * 2 - 1; + translateArray[i3 + 1] = Math.random() * 2 - 1; + translateArray[i3 + 2] = Math.random() * 2 - 1; + } + + geometry.setAttribute('translate', new THREE.InstancedBufferAttribute(translateArray, 3)); + + material = new THREE.RawShaderMaterial({ + uniforms: { + map: { value: new THREE.TextureLoader().load('textures/sprites/circle.png') }, + time: { value: 0.0 }, + }, + vertexShader: document.getElementById('vshader').textContent, + fragmentShader: document.getElementById('fshader').textContent, + depthTest: true, + depthWrite: true, + }); + + mesh = new THREE.Mesh(geometry, material); + mesh.scale.set(500, 500, 500); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); + + return true; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now() * 0.0005; + + material.uniforms['time'].value = time; + + mesh.rotation.x = time * 0.2; + mesh.rotation.y = time * 0.4; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts b/examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts new file mode 100644 index 000000000..bef2c264d --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts @@ -0,0 +1,152 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; +let camera, scene, renderer, mesh; + +const instances = 5000; +let lastTime = 0; + +const moveQ = new THREE.Quaternion(0.5, 0.5, 0.5, 0.0).normalize(); +const tmpQ = new THREE.Quaternion(); +const tmpM = new THREE.Matrix4(); +const currentM = new THREE.Matrix4(); + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x101010); + + // geometry + + const geometry = new THREE.InstancedBufferGeometry(); + + // per mesh data x,y,z,w,u,v,s,t for 4-element alignment + // only use x,y,z and u,v; but x, y, z, nx, ny, nz, u, v would be a good layout + const vertexBuffer = new THREE.InterleavedBuffer( + new Float32Array([ + // Front + -1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, -1, -1, 1, 0, 0, 1, 0, 0, 1, -1, 1, 0, 1, 1, 0, 0, + // Back + 1, 1, -1, 0, 1, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 1, 0, 0, -1, -1, -1, 0, 0, 1, 0, 0, + // Left + -1, 1, -1, 0, 1, 1, 0, 0, -1, 1, 1, 0, 1, 0, 0, 0, -1, -1, -1, 0, 0, 1, 0, 0, -1, -1, 1, 0, 0, 0, 0, 0, + // Right + 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, -1, 0, 1, 1, 0, 0, 1, -1, 1, 0, 0, 0, 0, 0, 1, -1, -1, 0, 0, 1, 0, 0, + // Top + -1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, -1, 1, -1, 0, 0, 1, 0, 0, 1, 1, -1, 0, 1, 1, 0, 0, + // Bottom + 1, -1, 1, 0, 1, 0, 0, 0, -1, -1, 1, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 1, 0, 0, -1, -1, -1, 0, 0, 1, 0, 0, + ]), + 8, + ); + + // Use vertexBuffer, starting at offset 0, 3 items in position attribute + const positions = new THREE.InterleavedBufferAttribute(vertexBuffer, 3, 0); + geometry.setAttribute('position', positions); + // Use vertexBuffer, starting at offset 4, 2 items in uv attribute + const uvs = new THREE.InterleavedBufferAttribute(vertexBuffer, 2, 4); + geometry.setAttribute('uv', uvs); + + const indices = new Uint16Array([ + 0, 2, 1, 2, 3, 1, 4, 6, 5, 6, 7, 5, 8, 10, 9, 10, 11, 9, 12, 14, 13, 14, 15, 13, 16, 17, 18, 18, 17, 19, 20, 21, + 22, 22, 21, 23, + ]); + + geometry.setIndex(new THREE.BufferAttribute(indices, 1)); + + // material + + const material = new THREE.MeshBasicMaterial(); + material.map = new THREE.TextureLoader().load('textures/crate.gif'); + material.map.colorSpace = THREE.SRGBColorSpace; + material.map.flipY = false; + + // per instance data + + const matrix = new THREE.Matrix4(); + const offset = new THREE.Vector3(); + const orientation = new THREE.Quaternion(); + const scale = new THREE.Vector3(1, 1, 1); + let x, y, z, w; + + mesh = new THREE.InstancedMesh(geometry, material, instances); + + for (let i = 0; i < instances; i++) { + // offsets + + x = Math.random() * 100 - 50; + y = Math.random() * 100 - 50; + z = Math.random() * 100 - 50; + + offset.set(x, y, z).normalize(); + offset.multiplyScalar(5); // move out at least 5 units from center in current direction + offset.set(x + offset.x, y + offset.y, z + offset.z); + + // orientations + + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + z = Math.random() * 2 - 1; + w = Math.random() * 2 - 1; + + orientation.set(x, y, z, w).normalize(); + + matrix.compose(offset, orientation, scale); + + mesh.setMatrixAt(i, matrix); + } + + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = performance.now(); + + mesh.rotation.y = time * 0.00005; + + const delta = (time - lastTime) / 5000; + tmpQ.set(moveQ.x * delta, moveQ.y * delta, moveQ.z * delta, 1).normalize(); + tmpM.makeRotationFromQuaternion(tmpQ); + + for (let i = 0, il = instances; i < il; i++) { + mesh.getMatrixAt(i, currentM); + currentM.multiply(tmpM); + mesh.setMatrixAt(i, currentM); + } + + mesh.instanceMatrix.needsUpdate = true; + mesh.computeBoundingSphere(); + + lastTime = time; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_lines.ts b/examples-testing/examples/webgl_buffergeometry_lines.ts new file mode 100644 index 000000000..d039e0112 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_lines.ts @@ -0,0 +1,121 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats, timer; + +let camera, scene, renderer; + +let line; + +const segments = 10000; +const r = 800; +let t = 0; + +init(); + +function init() { + container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 4000); + camera.position.z = 2750; + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + const geometry = new THREE.BufferGeometry(); + const material = new THREE.LineBasicMaterial({ vertexColors: true }); + + const positions = []; + const colors = []; + + for (let i = 0; i < segments; i++) { + const x = Math.random() * r - r / 2; + const y = Math.random() * r - r / 2; + const z = Math.random() * r - r / 2; + + // positions + + positions.push(x, y, z); + + // colors + + colors.push(x / r + 0.5); + colors.push(y / r + 0.5); + colors.push(z / r + 0.5); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + generateMorphTargets(geometry); + + geometry.computeBoundingSphere(); + + line = new THREE.Line(geometry, material); + scene.add(line); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + const time = timer.getElapsed(); + + line.rotation.x = time * 0.25; + line.rotation.y = time * 0.5; + + t += delta * 0.5; + line.morphTargetInfluences[0] = Math.abs(Math.sin(t)); + + renderer.render(scene, camera); + + stats.update(); +} + +function generateMorphTargets(geometry) { + const data = []; + + for (let i = 0; i < segments; i++) { + const x = Math.random() * r - r / 2; + const y = Math.random() * r - r / 2; + const z = Math.random() * r - r / 2; + + data.push(x, y, z); + } + + const morphTarget = new THREE.Float32BufferAttribute(data, 3); + morphTarget.name = 'target1'; + + geometry.morphAttributes.position = [morphTarget]; +} diff --git a/examples-testing/examples/webgl_buffergeometry_lines_indexed.ts b/examples-testing/examples/webgl_buffergeometry_lines_indexed.ts new file mode 100644 index 000000000..58296087e --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_lines_indexed.ts @@ -0,0 +1,179 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let parent_node; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 9000; + + scene = new THREE.Scene(); + + const geometry = new THREE.BufferGeometry(); + const material = new THREE.LineBasicMaterial({ vertexColors: true }); + + const indices = []; + const positions = []; + const colors = []; + + let next_positions_index = 0; + + // + + const iteration_count = 4; + const rangle = (60 * Math.PI) / 180.0; + + function add_vertex(v) { + positions.push(v.x, v.y, v.z); + colors.push(Math.random() * 0.5 + 0.5, Math.random() * 0.5 + 0.5, 1); + + return next_positions_index++; + } + + // simple Koch curve + + function snowflake_iteration(p0, p4, depth) { + if (--depth < 0) { + const i = next_positions_index - 1; // p0 already there + add_vertex(p4); + indices.push(i, i + 1); + + return; + } + + const v = p4.clone().sub(p0); + const v_tier = v.clone().multiplyScalar(1 / 3); + const p1 = p0.clone().add(v_tier); + + const angle = Math.atan2(v.y, v.x) + rangle; + const length = v_tier.length(); + const p2 = p1.clone(); + p2.x += Math.cos(angle) * length; + p2.y += Math.sin(angle) * length; + + const p3 = p0.clone().add(v_tier).add(v_tier); + + snowflake_iteration(p0, p1, depth); + snowflake_iteration(p1, p2, depth); + snowflake_iteration(p2, p3, depth); + snowflake_iteration(p3, p4, depth); + } + + function snowflake(points, loop, x_offset) { + for (let iteration = 0; iteration != iteration_count; iteration++) { + add_vertex(points[0]); + + for (let p_index = 0, p_count = points.length - 1; p_index != p_count; p_index++) { + snowflake_iteration(points[p_index], points[p_index + 1], iteration); + } + + if (loop) snowflake_iteration(points[points.length - 1], points[0], iteration); + + // translate input curve for next iteration + + for (let p_index = 0, p_count = points.length; p_index != p_count; p_index++) { + points[p_index].x += x_offset; + } + } + } + + let y = 0; + + snowflake([new THREE.Vector3(0, y, 0), new THREE.Vector3(500, y, 0)], false, 600); + + y += 600; + snowflake( + [new THREE.Vector3(0, y, 0), new THREE.Vector3(250, y + 400, 0), new THREE.Vector3(500, y, 0)], + true, + 600, + ); + + y += 600; + snowflake( + [ + new THREE.Vector3(0, y, 0), + new THREE.Vector3(500, y, 0), + new THREE.Vector3(500, y + 500, 0), + new THREE.Vector3(0, y + 500, 0), + ], + true, + 600, + ); + + y += 1000; + snowflake( + [ + new THREE.Vector3(250, y, 0), + new THREE.Vector3(500, y, 0), + new THREE.Vector3(250, y, 0), + new THREE.Vector3(250, y + 250, 0), + new THREE.Vector3(250, y, 0), + new THREE.Vector3(0, y, 0), + new THREE.Vector3(250, y, 0), + new THREE.Vector3(250, y - 250, 0), + new THREE.Vector3(250, y, 0), + ], + false, + 600, + ); + + // + + geometry.setIndex(indices); + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + geometry.computeBoundingSphere(); + + const lineSegments = new THREE.LineSegments(geometry, material); + lineSegments.position.x -= 1200; + lineSegments.position.y -= 1200; + + parent_node = new THREE.Object3D(); + parent_node.add(lineSegments); + + scene.add(parent_node); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = Date.now() * 0.001; + + parent_node.rotation.z = time * 0.5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_points.ts b/examples-testing/examples/webgl_buffergeometry_points.ts new file mode 100644 index 000000000..4547d9d08 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_points.ts @@ -0,0 +1,109 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let points; + +init(); +animate(); + +function init() { + container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 5, 3500); + camera.position.z = 2750; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // + + const particles = 500000; + + const geometry = new THREE.BufferGeometry(); + + const positions = []; + const colors = []; + + const color = new THREE.Color(); + + const n = 1000, + n2 = n / 2; // particles spread in the cube + + for (let i = 0; i < particles; i++) { + // positions + + const x = Math.random() * n - n2; + const y = Math.random() * n - n2; + const z = Math.random() * n - n2; + + positions.push(x, y, z); + + // colors + + const vx = x / n + 0.5; + const vy = y / n + 0.5; + const vz = z / n + 0.5; + + color.setRGB(vx, vy, vz, THREE.SRGBColorSpace); + + colors.push(color.r, color.g, color.b); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + geometry.computeBoundingSphere(); + + // + + const material = new THREE.PointsMaterial({ size: 15, vertexColors: true }); + + points = new THREE.Points(geometry, material); + scene.add(points); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = Date.now() * 0.001; + + points.rotation.x = time * 0.25; + points.rotation.y = time * 0.5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_points_interleaved.ts b/examples-testing/examples/webgl_buffergeometry_points_interleaved.ts new file mode 100644 index 000000000..93eed992e --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_points_interleaved.ts @@ -0,0 +1,122 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let points; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 5, 3500); + camera.position.z = 2750; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // + + const particles = 500000; + + const geometry = new THREE.BufferGeometry(); + + // create a generic buffer of binary data (a single particle has 16 bytes of data) + + const arrayBuffer = new ArrayBuffer(particles * 16); + + // the following typed arrays share the same buffer + + const interleavedFloat32Buffer = new Float32Array(arrayBuffer); + const interleavedUint8Buffer = new Uint8Array(arrayBuffer); + + // + + const color = new THREE.Color(); + + const n = 1000, + n2 = n / 2; // particles spread in the cube + + for (let i = 0; i < interleavedFloat32Buffer.length; i += 4) { + // position (first 12 bytes) + + const x = Math.random() * n - n2; + const y = Math.random() * n - n2; + const z = Math.random() * n - n2; + + interleavedFloat32Buffer[i + 0] = x; + interleavedFloat32Buffer[i + 1] = y; + interleavedFloat32Buffer[i + 2] = z; + + // color (last 4 bytes) + + const vx = x / n + 0.5; + const vy = y / n + 0.5; + const vz = z / n + 0.5; + + color.setRGB(vx, vy, vz, THREE.SRGBColorSpace); + + const j = (i + 3) * 4; + + interleavedUint8Buffer[j + 0] = color.r * 255; + interleavedUint8Buffer[j + 1] = color.g * 255; + interleavedUint8Buffer[j + 2] = color.b * 255; + interleavedUint8Buffer[j + 3] = 0; // not needed + } + + const interleavedBuffer32 = new THREE.InterleavedBuffer(interleavedFloat32Buffer, 4); + const interleavedBuffer8 = new THREE.InterleavedBuffer(interleavedUint8Buffer, 16); + + geometry.setAttribute('position', new THREE.InterleavedBufferAttribute(interleavedBuffer32, 3, 0, false)); + geometry.setAttribute('color', new THREE.InterleavedBufferAttribute(interleavedBuffer8, 3, 12, true)); + + // + + const material = new THREE.PointsMaterial({ size: 15, vertexColors: true }); + + points = new THREE.Points(geometry, material); + scene.add(points); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = Date.now() * 0.001; + + points.rotation.x = time * 0.25; + points.rotation.y = time * 0.5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_rawshader.ts b/examples-testing/examples/webgl_buffergeometry_rawshader.ts new file mode 100644 index 000000000..5bc113dc3 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_rawshader.ts @@ -0,0 +1,97 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10); + camera.position.z = 2; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x101010); + + // geometry + // nr of triangles with 3 vertices per triangle + const vertexCount = 200 * 3; + + const geometry = new THREE.BufferGeometry(); + + const positions = []; + const colors = []; + + for (let i = 0; i < vertexCount; i++) { + // adding x,y,z + positions.push(Math.random() - 0.5); + positions.push(Math.random() - 0.5); + positions.push(Math.random() - 0.5); + + // adding r,g,b,a + colors.push(Math.random() * 255); + colors.push(Math.random() * 255); + colors.push(Math.random() * 255); + colors.push(Math.random() * 255); + } + + const positionAttribute = new THREE.Float32BufferAttribute(positions, 3); + const colorAttribute = new THREE.Uint8BufferAttribute(colors, 4); + + colorAttribute.normalized = true; // this will map the buffer values to 0.0f - +1.0f in the shader + + geometry.setAttribute('position', positionAttribute); + geometry.setAttribute('color', colorAttribute); + + // material + + const material = new THREE.RawShaderMaterial({ + uniforms: { + time: { value: 1.0 }, + }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + side: THREE.DoubleSide, + transparent: true, + }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = performance.now(); + + const object = scene.children[0]; + + object.rotation.y = time * 0.0005; + object.material.uniforms.time.value = time * 0.005; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_selective_draw.ts b/examples-testing/examples/webgl_buffergeometry_selective_draw.ts new file mode 100644 index 000000000..1264c7cad --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_selective_draw.ts @@ -0,0 +1,150 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let geometry, mesh; +const numLat = 100; +const numLng = 200; +let numLinesCulled = 0; + +init(); + +function init() { + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.z = 3.5; + + stats = new Stats(); + document.body.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); + + addLines(1.0); + + const hideLinesButton = document.getElementById('hideLines'); + hideLinesButton.addEventListener('click', hideLines); + + const showAllLinesButton = document.getElementById('showAllLines'); + showAllLinesButton.addEventListener('click', showAllLines); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); +} + +function addLines(radius) { + geometry = new THREE.BufferGeometry(); + const linePositions = new Float32Array(numLat * numLng * 3 * 2); + const lineColors = new Float32Array(numLat * numLng * 3 * 2); + const visible = new Float32Array(numLat * numLng * 2); + + for (let i = 0; i < numLat; ++i) { + for (let j = 0; j < numLng; ++j) { + const lat = (Math.random() * Math.PI) / 50.0 + (i / numLat) * Math.PI; + const lng = (Math.random() * Math.PI) / 50.0 + (j / numLng) * 2 * Math.PI; + + const index = i * numLng + j; + + linePositions[index * 6 + 0] = 0; + linePositions[index * 6 + 1] = 0; + linePositions[index * 6 + 2] = 0; + linePositions[index * 6 + 3] = radius * Math.sin(lat) * Math.cos(lng); + linePositions[index * 6 + 4] = radius * Math.cos(lat); + linePositions[index * 6 + 5] = radius * Math.sin(lat) * Math.sin(lng); + + const color = new THREE.Color(0xffffff); + + color.setHSL(lat / Math.PI, 1.0, 0.2); + lineColors[index * 6 + 0] = color.r; + lineColors[index * 6 + 1] = color.g; + lineColors[index * 6 + 2] = color.b; + + color.setHSL(lat / Math.PI, 1.0, 0.7); + lineColors[index * 6 + 3] = color.r; + lineColors[index * 6 + 4] = color.g; + lineColors[index * 6 + 5] = color.b; + + // non-0 is visible + visible[index * 2 + 0] = 1.0; + visible[index * 2 + 1] = 1.0; + } + } + + geometry.setAttribute('position', new THREE.BufferAttribute(linePositions, 3)); + geometry.setAttribute('vertColor', new THREE.BufferAttribute(lineColors, 3)); + geometry.setAttribute('visible', new THREE.BufferAttribute(visible, 1)); + + geometry.computeBoundingSphere(); + + const shaderMaterial = new THREE.ShaderMaterial({ + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + }); + + mesh = new THREE.LineSegments(geometry, shaderMaterial); + scene.add(mesh); + + updateCount(); +} + +function updateCount() { + const str = + '1 draw call, ' + + numLat * numLng + + ' lines, ' + + numLinesCulled + + ' culled (author)'; + document.getElementById('title').innerHTML = str.replace(/\B(?=(\d{3})+(?!\d))/g, ','); +} + +function hideLines() { + for (let i = 0; i < geometry.attributes.visible.array.length; i += 2) { + if (Math.random() > 0.75) { + if (geometry.attributes.visible.array[i + 0]) { + ++numLinesCulled; + } + + geometry.attributes.visible.array[i + 0] = 0; + geometry.attributes.visible.array[i + 1] = 0; + } + } + + geometry.attributes.visible.needsUpdate = true; + + updateCount(); +} + +function showAllLines() { + numLinesCulled = 0; + + for (let i = 0; i < geometry.attributes.visible.array.length; i += 2) { + geometry.attributes.visible.array[i + 0] = 1; + geometry.attributes.visible.array[i + 1] = 1; + } + + geometry.attributes.visible.needsUpdate = true; + + updateCount(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = Date.now() * 0.001; + + mesh.rotation.x = time * 0.25; + mesh.rotation.y = time * 0.5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_buffergeometry_uint.ts b/examples-testing/examples/webgl_buffergeometry_uint.ts new file mode 100644 index 000000000..0b8df6ec7 --- /dev/null +++ b/examples-testing/examples/webgl_buffergeometry_uint.ts @@ -0,0 +1,177 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let mesh; + +init(); + +function init() { + container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); + camera.position.z = 2750; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const light1 = new THREE.DirectionalLight(0xffffff, 1.5); + light1.position.set(1, 1, 1); + scene.add(light1); + + const light2 = new THREE.DirectionalLight(0xffffff, 4.5); + light2.position.set(0, -1, 0); + scene.add(light2); + + // + + const triangles = 500000; + + const geometry = new THREE.BufferGeometry(); + + const positions = []; + const normals = []; + const colors = []; + + const color = new THREE.Color(); + + const n = 800, + n2 = n / 2; // triangles spread in the cube + const d = 12, + d2 = d / 2; // individual triangle size + + const pA = new THREE.Vector3(); + const pB = new THREE.Vector3(); + const pC = new THREE.Vector3(); + + const cb = new THREE.Vector3(); + const ab = new THREE.Vector3(); + + for (let i = 0; i < triangles; i++) { + // positions + + const x = Math.random() * n - n2; + const y = Math.random() * n - n2; + const z = Math.random() * n - n2; + + const ax = x + Math.random() * d - d2; + const ay = y + Math.random() * d - d2; + const az = z + Math.random() * d - d2; + + const bx = x + Math.random() * d - d2; + const by = y + Math.random() * d - d2; + const bz = z + Math.random() * d - d2; + + const cx = x + Math.random() * d - d2; + const cy = y + Math.random() * d - d2; + const cz = z + Math.random() * d - d2; + + positions.push(ax, ay, az); + positions.push(bx, by, bz); + positions.push(cx, cy, cz); + + // flat face normals + + pA.set(ax, ay, az); + pB.set(bx, by, bz); + pC.set(cx, cy, cz); + + cb.subVectors(pC, pB); + ab.subVectors(pA, pB); + cb.cross(ab); + + cb.normalize(); + + const nx = cb.x; + const ny = cb.y; + const nz = cb.z; + + normals.push(nx * 32767, ny * 32767, nz * 32767); + normals.push(nx * 32767, ny * 32767, nz * 32767); + normals.push(nx * 32767, ny * 32767, nz * 32767); + + // colors + + const vx = x / n + 0.5; + const vy = y / n + 0.5; + const vz = z / n + 0.5; + + color.setRGB(vx, vy, vz); + + colors.push(color.r * 255, color.g * 255, color.b * 255); + colors.push(color.r * 255, color.g * 255, color.b * 255); + colors.push(color.r * 255, color.g * 255, color.b * 255); + } + + const positionAttribute = new THREE.Float32BufferAttribute(positions, 3); + const normalAttribute = new THREE.Int16BufferAttribute(normals, 3); + const colorAttribute = new THREE.Uint8BufferAttribute(colors, 3); + + normalAttribute.normalized = true; // this will map the buffer values to 0.0f - +1.0f in the shader + colorAttribute.normalized = true; + + geometry.setAttribute('position', positionAttribute); + geometry.setAttribute('normal', normalAttribute); + geometry.setAttribute('color', colorAttribute); + + geometry.computeBoundingSphere(); + + const material = new THREE.MeshPhongMaterial({ + color: 0xd5d5d5, + specular: 0xffffff, + shininess: 250, + side: THREE.DoubleSide, + vertexColors: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = Date.now() * 0.001; + + mesh.rotation.x = time * 0.25; + mesh.rotation.y = time * 0.5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_camera.ts b/examples-testing/examples/webgl_camera.ts new file mode 100644 index 000000000..f3d663603 --- /dev/null +++ b/examples-testing/examples/webgl_camera.ts @@ -0,0 +1,218 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let SCREEN_WIDTH = window.innerWidth; +let SCREEN_HEIGHT = window.innerHeight; +let aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + +let container, stats; +let camera, scene, renderer, mesh; +let cameraRig, activeCamera, activeHelper; +let cameraPerspective, cameraOrtho; +let cameraPerspectiveHelper, cameraOrthoHelper; +const frustumSize = 600; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + + // + + camera = new THREE.PerspectiveCamera(50, 0.5 * aspect, 1, 10000); + camera.position.z = 2500; + + cameraPerspective = new THREE.PerspectiveCamera(50, 0.5 * aspect, 150, 1000); + + cameraPerspectiveHelper = new THREE.CameraHelper(cameraPerspective); + scene.add(cameraPerspectiveHelper); + + // + cameraOrtho = new THREE.OrthographicCamera( + (0.5 * frustumSize * aspect) / -2, + (0.5 * frustumSize * aspect) / 2, + frustumSize / 2, + frustumSize / -2, + 150, + 1000, + ); + + cameraOrthoHelper = new THREE.CameraHelper(cameraOrtho); + scene.add(cameraOrthoHelper); + + // + + activeCamera = cameraPerspective; + activeHelper = cameraPerspectiveHelper; + + // counteract different front orientation of cameras vs rig + + cameraOrtho.rotation.y = Math.PI; + cameraPerspective.rotation.y = Math.PI; + + cameraRig = new THREE.Group(); + + cameraRig.add(cameraPerspective); + cameraRig.add(cameraOrtho); + + scene.add(cameraRig); + + // + + mesh = new THREE.Mesh( + new THREE.SphereGeometry(100, 16, 8), + new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }), + ); + scene.add(mesh); + + const mesh2 = new THREE.Mesh( + new THREE.SphereGeometry(50, 16, 8), + new THREE.MeshBasicMaterial({ color: 0x00ff00, wireframe: true }), + ); + mesh2.position.y = 150; + mesh.add(mesh2); + + const mesh3 = new THREE.Mesh( + new THREE.SphereGeometry(5, 16, 8), + new THREE.MeshBasicMaterial({ color: 0x0000ff, wireframe: true }), + ); + mesh3.position.z = 150; + cameraRig.add(mesh3); + + // + + const geometry = new THREE.BufferGeometry(); + const vertices = []; + + for (let i = 0; i < 10000; i++) { + vertices.push(THREE.MathUtils.randFloatSpread(2000)); // x + vertices.push(THREE.MathUtils.randFloatSpread(2000)); // y + vertices.push(THREE.MathUtils.randFloatSpread(2000)); // z + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + const particles = new THREE.Points(geometry, new THREE.PointsMaterial({ color: 0x888888 })); + scene.add(particles); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + renderer.setScissorTest(true); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); + document.addEventListener('keydown', onKeyDown); +} + +// + +function onKeyDown(event) { + switch (event.keyCode) { + case 79 /*O*/: + activeCamera = cameraOrtho; + activeHelper = cameraOrthoHelper; + + break; + + case 80 /*P*/: + activeCamera = cameraPerspective; + activeHelper = cameraPerspectiveHelper; + + break; + } +} + +// + +function onWindowResize() { + SCREEN_WIDTH = window.innerWidth; + SCREEN_HEIGHT = window.innerHeight; + aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + + camera.aspect = 0.5 * aspect; + camera.updateProjectionMatrix(); + + cameraPerspective.aspect = 0.5 * aspect; + cameraPerspective.updateProjectionMatrix(); + + cameraOrtho.left = (-0.5 * frustumSize * aspect) / 2; + cameraOrtho.right = (0.5 * frustumSize * aspect) / 2; + cameraOrtho.top = frustumSize / 2; + cameraOrtho.bottom = -frustumSize / 2; + cameraOrtho.updateProjectionMatrix(); +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const r = Date.now() * 0.0005; + + mesh.position.x = 700 * Math.cos(r); + mesh.position.z = 700 * Math.sin(r); + mesh.position.y = 700 * Math.sin(r); + + mesh.children[0].position.x = 70 * Math.cos(2 * r); + mesh.children[0].position.z = 70 * Math.sin(r); + + if (activeCamera === cameraPerspective) { + cameraPerspective.fov = 35 + 30 * Math.sin(0.5 * r); + cameraPerspective.far = mesh.position.length(); + cameraPerspective.updateProjectionMatrix(); + + cameraPerspectiveHelper.update(); + cameraPerspectiveHelper.visible = true; + + cameraOrthoHelper.visible = false; + } else { + cameraOrtho.far = mesh.position.length(); + cameraOrtho.updateProjectionMatrix(); + + cameraOrthoHelper.update(); + cameraOrthoHelper.visible = true; + + cameraPerspectiveHelper.visible = false; + } + + cameraRig.lookAt(mesh.position); + + // + + activeHelper.visible = false; + + renderer.setClearColor(0x000000, 1); + renderer.setScissor(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.setViewport(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.render(scene, activeCamera); + + // + + activeHelper.visible = true; + + renderer.setClearColor(0x111111, 1); + renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.setViewport(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_camera_array.ts b/examples-testing/examples/webgl_camera_array.ts new file mode 100644 index 000000000..8b10e27cb --- /dev/null +++ b/examples-testing/examples/webgl_camera_array.ts @@ -0,0 +1,104 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; +let mesh; +const AMOUNT = 6; + +init(); + +function init() { + const ASPECT_RATIO = window.innerWidth / window.innerHeight; + + const WIDTH = (window.innerWidth / AMOUNT) * window.devicePixelRatio; + const HEIGHT = (window.innerHeight / AMOUNT) * window.devicePixelRatio; + + const cameras = []; + + for (let y = 0; y < AMOUNT; y++) { + for (let x = 0; x < AMOUNT; x++) { + const subcamera = new THREE.PerspectiveCamera(40, ASPECT_RATIO, 0.1, 10); + subcamera.viewport = new THREE.Vector4( + Math.floor(x * WIDTH), + Math.floor(y * HEIGHT), + Math.ceil(WIDTH), + Math.ceil(HEIGHT), + ); + subcamera.position.x = x / AMOUNT - 0.5; + subcamera.position.y = 0.5 - y / AMOUNT; + subcamera.position.z = 1.5; + subcamera.position.multiplyScalar(2); + subcamera.lookAt(0, 0, 0); + subcamera.updateMatrixWorld(); + cameras.push(subcamera); + } + } + + camera = new THREE.ArrayCamera(cameras); + camera.position.z = 3; + + scene = new THREE.Scene(); + + scene.add(new THREE.AmbientLight(0x999999)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0.5, 0.5, 1); + light.castShadow = true; + light.shadow.camera.zoom = 4; // tighter shadow map + scene.add(light); + + const geometryBackground = new THREE.PlaneGeometry(100, 100); + const materialBackground = new THREE.MeshPhongMaterial({ color: 0x000066 }); + + const background = new THREE.Mesh(geometryBackground, materialBackground); + background.receiveShadow = true; + background.position.set(0, 0, -1); + scene.add(background); + + const geometryCylinder = new THREE.CylinderGeometry(0.5, 0.5, 1, 32); + const materialCylinder = new THREE.MeshPhongMaterial({ color: 0xff0000 }); + + mesh = new THREE.Mesh(geometryCylinder, materialCylinder); + mesh.castShadow = true; + mesh.receiveShadow = true; + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const ASPECT_RATIO = window.innerWidth / window.innerHeight; + const WIDTH = (window.innerWidth / AMOUNT) * window.devicePixelRatio; + const HEIGHT = (window.innerHeight / AMOUNT) * window.devicePixelRatio; + + camera.aspect = ASPECT_RATIO; + camera.updateProjectionMatrix(); + + for (let y = 0; y < AMOUNT; y++) { + for (let x = 0; x < AMOUNT; x++) { + const subcamera = camera.cameras[AMOUNT * y + x]; + + subcamera.viewport.set(Math.floor(x * WIDTH), Math.floor(y * HEIGHT), Math.ceil(WIDTH), Math.ceil(HEIGHT)); + + subcamera.aspect = ASPECT_RATIO; + subcamera.updateProjectionMatrix(); + } + } + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.rotation.x += 0.005; + mesh.rotation.z += 0.01; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts b/examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts new file mode 100644 index 000000000..f1d440004 --- /dev/null +++ b/examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts @@ -0,0 +1,248 @@ +import * as THREE from 'three'; + +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +import Stats from 'three/addons/libs/stats.module.js'; + +// 1 micrometer to 100 billion light years in one scene, with 1 unit = 1 meter? preposterous! and yet... +const NEAR = 1e-6, + FAR = 1e27; +let SCREEN_WIDTH = window.innerWidth; +let SCREEN_HEIGHT = window.innerHeight; +let screensplit = 0.25, + screensplit_right = 0; +const mouse = [0.5, 0.5]; +let zoompos = -100, + minzoomspeed = 0.015; +let zoomspeed = minzoomspeed; + +let container, border, stats; +const objects = {}; + +// Generate a number of text labels, from 1µm in size up to 100,000,000 light years +// Try to use some descriptive real-world examples of objects at each scale + +const labeldata = [ + { size: 0.01, scale: 0.0001, label: 'microscopic (1µm)' }, // FIXME - triangulating text fails at this size, so we scale instead + { size: 0.01, scale: 0.1, label: 'minuscule (1mm)' }, + { size: 0.01, scale: 1.0, label: 'tiny (1cm)' }, + { size: 1, scale: 1.0, label: 'child-sized (1m)' }, + { size: 10, scale: 1.0, label: 'tree-sized (10m)' }, + { size: 100, scale: 1.0, label: 'building-sized (100m)' }, + { size: 1000, scale: 1.0, label: 'medium (1km)' }, + { size: 10000, scale: 1.0, label: 'city-sized (10km)' }, + { size: 3400000, scale: 1.0, label: 'moon-sized (3,400 Km)' }, + { size: 12000000, scale: 1.0, label: 'planet-sized (12,000 km)' }, + { size: 1400000000, scale: 1.0, label: 'sun-sized (1,400,000 km)' }, + { size: 7.47e12, scale: 1.0, label: 'solar system-sized (50Au)' }, + { size: 9.4605284e15, scale: 1.0, label: 'gargantuan (1 light year)' }, + { size: 3.08567758e16, scale: 1.0, label: 'ludicrous (1 parsec)' }, + { size: 1e19, scale: 1.0, label: 'mind boggling (1000 light years)' }, +]; + +init(); + +function init() { + container = document.getElementById('container'); + + const loader = new FontLoader(); + loader.load('fonts/helvetiker_regular.typeface.json', function (font) { + const scene = initScene(font); + + // Initialize two copies of the same scene, one with normal z-buffer and one with logarithmic z-buffer + objects.normal = initView(scene, 'normal', false); + objects.logzbuf = initView(scene, 'logzbuf', true); + + animate(); + }); + + stats = new Stats(); + container.appendChild(stats.dom); + + // Resize border allows the user to easily compare effects of logarithmic depth buffer over the whole scene + border = document.getElementById('renderer_border'); + border.addEventListener('pointerdown', onBorderPointerDown); + + window.addEventListener('mousemove', onMouseMove); + window.addEventListener('resize', onWindowResize); + window.addEventListener('wheel', onMouseWheel); +} + +function initView(scene, name, logDepthBuf) { + const framecontainer = document.getElementById('container_' + name); + + const camera = new THREE.PerspectiveCamera(50, (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT, NEAR, FAR); + scene.add(camera); + + const renderer = new THREE.WebGLRenderer({ antialias: true, logarithmicDepthBuffer: logDepthBuf }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.domElement.style.position = 'relative'; + renderer.domElement.id = 'renderer_' + name; + framecontainer.appendChild(renderer.domElement); + + return { container: framecontainer, renderer: renderer, scene: scene, camera: camera }; +} + +function initScene(font) { + const scene = new THREE.Scene(); + + scene.add(new THREE.AmbientLight(0x777777)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(100, 100, 100); + scene.add(light); + + const materialargs = { + color: 0xffffff, + specular: 0x050505, + shininess: 50, + emissive: 0x000000, + }; + + const geometry = new THREE.SphereGeometry(0.5, 24, 12); + + for (let i = 0; i < labeldata.length; i++) { + const scale = labeldata[i].scale || 1; + + const labelgeo = new TextGeometry(labeldata[i].label, { + font: font, + size: labeldata[i].size, + depth: labeldata[i].size / 2, + }); + + labelgeo.computeBoundingSphere(); + + // center text + labelgeo.translate(-labelgeo.boundingSphere.radius, 0, 0); + + materialargs.color = new THREE.Color().setHSL(Math.random(), 0.5, 0.5); + + const material = new THREE.MeshPhongMaterial(materialargs); + + const group = new THREE.Group(); + group.position.z = -labeldata[i].size * scale; + scene.add(group); + + const textmesh = new THREE.Mesh(labelgeo, material); + textmesh.scale.set(scale, scale, scale); + textmesh.position.z = -labeldata[i].size * scale; + textmesh.position.y = (labeldata[i].size / 4) * scale; + group.add(textmesh); + + const dotmesh = new THREE.Mesh(geometry, material); + dotmesh.position.y = (-labeldata[i].size / 4) * scale; + dotmesh.scale.multiplyScalar(labeldata[i].size * scale); + group.add(dotmesh); + } + + return scene; +} + +function updateRendererSizes() { + // Recalculate size for both renderers when screen size or split location changes + + SCREEN_WIDTH = window.innerWidth; + SCREEN_HEIGHT = window.innerHeight; + + screensplit_right = 1 - screensplit; + + objects.normal.renderer.setSize(screensplit * SCREEN_WIDTH, SCREEN_HEIGHT); + objects.normal.camera.aspect = (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT; + objects.normal.camera.updateProjectionMatrix(); + objects.normal.camera.setViewOffset(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH * screensplit, SCREEN_HEIGHT); + objects.normal.container.style.width = screensplit * 100 + '%'; + + objects.logzbuf.renderer.setSize(screensplit_right * SCREEN_WIDTH, SCREEN_HEIGHT); + objects.logzbuf.camera.aspect = (screensplit_right * SCREEN_WIDTH) / SCREEN_HEIGHT; + objects.logzbuf.camera.updateProjectionMatrix(); + objects.logzbuf.camera.setViewOffset( + SCREEN_WIDTH, + SCREEN_HEIGHT, + SCREEN_WIDTH * screensplit, + 0, + SCREEN_WIDTH * screensplit_right, + SCREEN_HEIGHT, + ); + objects.logzbuf.container.style.width = screensplit_right * 100 + '%'; + + border.style.left = screensplit * 100 + '%'; +} + +function animate() { + requestAnimationFrame(animate); + render(); +} + +function render() { + // Put some limits on zooming + const minzoom = labeldata[0].size * labeldata[0].scale * 1; + const maxzoom = labeldata[labeldata.length - 1].size * labeldata[labeldata.length - 1].scale * 100; + let damping = Math.abs(zoomspeed) > minzoomspeed ? 0.95 : 1.0; + + // Zoom out faster the further out you go + const zoom = THREE.MathUtils.clamp(Math.pow(Math.E, zoompos), minzoom, maxzoom); + zoompos = Math.log(zoom); + + // Slow down quickly at the zoom limits + if ((zoom == minzoom && zoomspeed < 0) || (zoom == maxzoom && zoomspeed > 0)) { + damping = 0.85; + } + + zoompos += zoomspeed; + zoomspeed *= damping; + + objects.normal.camera.position.x = Math.sin(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; + objects.normal.camera.position.y = Math.sin(0.25 * Math.PI * (mouse[1] - 0.5)) * zoom; + objects.normal.camera.position.z = Math.cos(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; + objects.normal.camera.lookAt(objects.normal.scene.position); + + // Clone camera settings across both scenes + objects.logzbuf.camera.position.copy(objects.normal.camera.position); + objects.logzbuf.camera.quaternion.copy(objects.normal.camera.quaternion); + + // Update renderer sizes if the split has changed + if (screensplit_right != 1 - screensplit) { + updateRendererSizes(); + } + + objects.normal.renderer.render(objects.normal.scene, objects.normal.camera); + objects.logzbuf.renderer.render(objects.logzbuf.scene, objects.logzbuf.camera); + + stats.update(); +} + +function onWindowResize() { + updateRendererSizes(); +} + +function onBorderPointerDown() { + // activate draggable window resizing bar + window.addEventListener('pointermove', onBorderPointerMove); + window.addEventListener('pointerup', onBorderPointerUp); +} + +function onBorderPointerMove(ev) { + screensplit = Math.max(0, Math.min(1, ev.clientX / window.innerWidth)); +} + +function onBorderPointerUp() { + window.removeEventListener('pointermove', onBorderPointerMove); + window.removeEventListener('pointerup', onBorderPointerUp); +} + +function onMouseMove(ev) { + mouse[0] = ev.clientX / window.innerWidth; + mouse[1] = ev.clientY / window.innerHeight; +} + +function onMouseWheel(ev) { + const amount = ev.deltaY; + if (amount === 0) return; + const dir = amount / Math.abs(amount); + zoomspeed = dir / 10; + + // Slow down default zoom speed after user starts zooming, to give them more control + minzoomspeed = 0.001; +} diff --git a/examples-testing/examples/webgl_clipculldistance.ts b/examples-testing/examples/webgl_clipculldistance.ts new file mode 100644 index 000000000..42c1ff17f --- /dev/null +++ b/examples-testing/examples/webgl_clipculldistance.ts @@ -0,0 +1,113 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, controls, timer, scene, renderer, stats; + +let material; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10); + camera.position.z = 2; + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + if (renderer.extensions.has('WEBGL_clip_cull_distance') === false) { + document.getElementById('notSupported').style.display = ''; + return; + } + + const ext = renderer.getContext().getExtension('WEBGL_clip_cull_distance'); + const gl = renderer.getContext(); + + gl.enable(ext.CLIP_DISTANCE0_WEBGL); + + // geometry + + const vertexCount = 200 * 3; + + const geometry = new THREE.BufferGeometry(); + + const positions = []; + const colors = []; + + for (let i = 0; i < vertexCount; i++) { + // adding x,y,z + positions.push(Math.random() - 0.5); + positions.push(Math.random() - 0.5); + positions.push(Math.random() - 0.5); + + // adding r,g,b,a + colors.push(Math.random() * 255); + colors.push(Math.random() * 255); + colors.push(Math.random() * 255); + colors.push(Math.random() * 255); + } + + const positionAttribute = new THREE.Float32BufferAttribute(positions, 3); + const colorAttribute = new THREE.Uint8BufferAttribute(colors, 4); + colorAttribute.normalized = true; + + geometry.setAttribute('position', positionAttribute); + geometry.setAttribute('color', colorAttribute); + + // material + + material = new THREE.ShaderMaterial({ + uniforms: { + time: { value: 1.0 }, + }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + side: THREE.DoubleSide, + transparent: true, + vertexColors: true, + }); + + material.extensions.clipCullDistance = true; + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + controls = new OrbitControls(camera, renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + controls.update(); + stats.update(); + + material.uniforms.time.value = timer.getElapsed(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_clipping.ts b/examples-testing/examples/webgl_clipping.ts new file mode 100644 index 000000000..cde10c7d1 --- /dev/null +++ b/examples-testing/examples/webgl_clipping.ts @@ -0,0 +1,195 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, startTime, object, stats; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 0.25, 16); + + camera.position.set(0, 1.3, 3); + + scene = new THREE.Scene(); + + // Lights + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const spotLight = new THREE.SpotLight(0xffffff, 60); + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.2; + spotLight.position.set(2, 3, 3); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 3; + spotLight.shadow.camera.far = 10; + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + scene.add(spotLight); + + const dirLight = new THREE.DirectionalLight(0x55505a, 3); + dirLight.position.set(0, 3, 0); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 1; + dirLight.shadow.camera.far = 10; + + dirLight.shadow.camera.right = 1; + dirLight.shadow.camera.left = -1; + dirLight.shadow.camera.top = 1; + dirLight.shadow.camera.bottom = -1; + + dirLight.shadow.mapSize.width = 1024; + dirLight.shadow.mapSize.height = 1024; + scene.add(dirLight); + + // ***** Clipping planes: ***** + + const localPlane = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0.8); + const globalPlane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0.1); + + // Geometry + + const material = new THREE.MeshPhongMaterial({ + color: 0x80ee10, + shininess: 100, + side: THREE.DoubleSide, + + // ***** Clipping setup (material): ***** + clippingPlanes: [localPlane], + clipShadows: true, + + alphaToCoverage: true, + }); + + const geometry = new THREE.TorusKnotGeometry(0.4, 0.08, 95, 20); + + object = new THREE.Mesh(geometry, material); + object.castShadow = true; + scene.add(object); + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(9, 9, 1, 1), + new THREE.MeshPhongMaterial({ color: 0xa0adaf, shininess: 150 }), + ); + + ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z + ground.receiveShadow = true; + scene.add(ground); + + // Renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + // ***** Clipping setup (renderer): ***** + const globalPlanes = [globalPlane], + Empty = Object.freeze([]); + renderer.clippingPlanes = Empty; // GUI sets it to globalPlanes + renderer.localClippingEnabled = true; + + // Stats + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // Controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1, 0); + controls.update(); + + // GUI + + const gui = new GUI(), + props = { + alphaToCoverage: true, + }, + folderLocal = gui.addFolder('Local Clipping'), + propsLocal = { + get Enabled() { + return renderer.localClippingEnabled; + }, + set Enabled(v) { + renderer.localClippingEnabled = v; + }, + + get Shadows() { + return material.clipShadows; + }, + set Shadows(v) { + material.clipShadows = v; + }, + + get Plane() { + return localPlane.constant; + }, + set Plane(v) { + localPlane.constant = v; + }, + }, + folderGlobal = gui.addFolder('Global Clipping'), + propsGlobal = { + get Enabled() { + return renderer.clippingPlanes !== Empty; + }, + set Enabled(v) { + renderer.clippingPlanes = v ? globalPlanes : Empty; + }, + + get Plane() { + return globalPlane.constant; + }, + set Plane(v) { + globalPlane.constant = v; + }, + }; + + gui.add(props, 'alphaToCoverage').onChange(function (value) { + ground.material.alphaToCoverage = value; + ground.material.needsUpdate = true; + + material.alphaToCoverage = value; + material.needsUpdate = true; + }); + folderLocal.add(propsLocal, 'Enabled'); + folderLocal.add(propsLocal, 'Shadows'); + folderLocal.add(propsLocal, 'Plane', 0.3, 1.25); + + folderGlobal.add(propsGlobal, 'Enabled'); + folderGlobal.add(propsGlobal, 'Plane', -0.4, 3); + + // Start + + startTime = Date.now(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const currentTime = Date.now(); + const time = (currentTime - startTime) / 1000; + + object.position.y = 0.8; + object.rotation.x = time * 0.5; + object.rotation.y = time * 0.2; + object.scale.setScalar(Math.cos(time) * 0.125 + 0.875); + + stats.begin(); + renderer.render(scene, camera); + stats.end(); +} diff --git a/examples-testing/examples/webgl_clipping_advanced.ts b/examples-testing/examples/webgl_clipping_advanced.ts new file mode 100644 index 000000000..f65f00043 --- /dev/null +++ b/examples-testing/examples/webgl_clipping_advanced.ts @@ -0,0 +1,357 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +function planesFromMesh(vertices, indices) { + // creates a clipping volume from a convex triangular mesh + // specified by the arrays 'vertices' and 'indices' + + const n = indices.length / 3, + result = new Array(n); + + for (let i = 0, j = 0; i < n; ++i, j += 3) { + const a = vertices[indices[j]], + b = vertices[indices[j + 1]], + c = vertices[indices[j + 2]]; + + result[i] = new THREE.Plane().setFromCoplanarPoints(a, b, c); + } + + return result; +} + +function createPlanes(n) { + // creates an array of n uninitialized plane objects + + const result = new Array(n); + + for (let i = 0; i !== n; ++i) result[i] = new THREE.Plane(); + + return result; +} + +function assignTransformedPlanes(planesOut, planesIn, matrix) { + // sets an array of existing planes to transformed 'planesIn' + + for (let i = 0, n = planesIn.length; i !== n; ++i) planesOut[i].copy(planesIn[i]).applyMatrix4(matrix); +} + +function cylindricalPlanes(n, innerRadius) { + const result = createPlanes(n); + + for (let i = 0; i !== n; ++i) { + const plane = result[i], + angle = (i * Math.PI * 2) / n; + + plane.normal.set(Math.cos(angle), 0, Math.sin(angle)); + + plane.constant = innerRadius; + } + + return result; +} + +const planeToMatrix = (function () { + // creates a matrix that aligns X/Y to a given plane + + // temporaries: + const xAxis = new THREE.Vector3(), + yAxis = new THREE.Vector3(), + trans = new THREE.Vector3(); + + return function planeToMatrix(plane) { + const zAxis = plane.normal, + matrix = new THREE.Matrix4(); + + // Hughes & Moeller '99 + // "Building an Orthonormal Basis from a Unit Vector." + + if (Math.abs(zAxis.x) > Math.abs(zAxis.z)) { + yAxis.set(-zAxis.y, zAxis.x, 0); + } else { + yAxis.set(0, -zAxis.z, zAxis.y); + } + + xAxis.crossVectors(yAxis.normalize(), zAxis); + + plane.coplanarPoint(trans); + return matrix.set( + xAxis.x, + yAxis.x, + zAxis.x, + trans.x, + xAxis.y, + yAxis.y, + zAxis.y, + trans.y, + xAxis.z, + yAxis.z, + zAxis.z, + trans.z, + 0, + 0, + 0, + 1, + ); + }; +})(); + +// A regular tetrahedron for the clipping volume: + +const Vertices = [ + new THREE.Vector3(+1, 0, +Math.SQRT1_2), + new THREE.Vector3(-1, 0, +Math.SQRT1_2), + new THREE.Vector3(0, +1, -Math.SQRT1_2), + new THREE.Vector3(0, -1, -Math.SQRT1_2), + ], + Indices = [0, 1, 2, 0, 2, 3, 0, 3, 1, 1, 3, 2], + Planes = planesFromMesh(Vertices, Indices), + PlaneMatrices = Planes.map(planeToMatrix), + GlobalClippingPlanes = cylindricalPlanes(5, 2.5), + Empty = Object.freeze([]); + +let camera, scene, renderer, startTime, stats, object, clipMaterial, volumeVisualization, globalClippingPlanes; + +function init() { + camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 0.25, 16); + + camera.position.set(0, 1.5, 3); + + scene = new THREE.Scene(); + + // Lights + + scene.add(new THREE.AmbientLight(0xffffff)); + + const spotLight = new THREE.SpotLight(0xffffff, 60); + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.2; + spotLight.position.set(2, 3, 3); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 3; + spotLight.shadow.camera.far = 10; + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + scene.add(spotLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 1.5); + dirLight.position.set(0, 2, 0); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 1; + dirLight.shadow.camera.far = 10; + + dirLight.shadow.camera.right = 1; + dirLight.shadow.camera.left = -1; + dirLight.shadow.camera.top = 1; + dirLight.shadow.camera.bottom = -1; + + dirLight.shadow.mapSize.width = 1024; + dirLight.shadow.mapSize.height = 1024; + scene.add(dirLight); + + // Geometry + + clipMaterial = new THREE.MeshPhongMaterial({ + color: 0xee0a10, + shininess: 100, + side: THREE.DoubleSide, + // Clipping setup: + clippingPlanes: createPlanes(Planes.length), + clipShadows: true, + }); + + const count = 5 * 5 * 5; + const geometry = new THREE.BoxGeometry(0.18, 0.18, 0.18); + object = new THREE.InstancedMesh(geometry, clipMaterial, count); + object.castShadow = true; + + let i = 0; + const matrix = new THREE.Matrix4(); + + for (let z = -2; z <= 2; ++z) + for (let y = -2; y <= 2; ++y) + for (let x = -2; x <= 2; ++x) { + matrix.setPosition(x / 5, y / 5, z / 5); + object.setMatrixAt(i++, matrix); + } + + scene.add(object); + + const planeGeometry = new THREE.PlaneGeometry(3, 3, 1, 1), + color = new THREE.Color(); + + volumeVisualization = new THREE.Group(); + volumeVisualization.visible = false; + + for (let i = 0, n = Planes.length; i !== n; ++i) { + const material = new THREE.MeshBasicMaterial({ + color: color.setHSL(i / n, 0.5, 0.5).getHex(), + side: THREE.DoubleSide, + + opacity: 0.2, + transparent: true, + + // clip to the others to show the volume (wildly + // intersecting transparent planes look bad) + clippingPlanes: clipMaterial.clippingPlanes.filter(function (_, j) { + return j !== i; + }), + + // no need to enable shadow clipping - the plane + // visualization does not cast shadows + }); + + const mesh = new THREE.Mesh(planeGeometry, material); + mesh.matrixAutoUpdate = false; + + volumeVisualization.add(mesh); + } + + scene.add(volumeVisualization); + + const ground = new THREE.Mesh( + planeGeometry, + new THREE.MeshPhongMaterial({ + color: 0xa0adaf, + shininess: 10, + }), + ); + ground.rotation.x = -Math.PI / 2; + ground.scale.multiplyScalar(3); + ground.receiveShadow = true; + scene.add(ground); + + // Renderer + + const container = document.body; + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + container.appendChild(renderer.domElement); + // Clipping setup: + globalClippingPlanes = createPlanes(GlobalClippingPlanes.length); + renderer.clippingPlanes = Empty; + renderer.localClippingEnabled = true; + + window.addEventListener('resize', onWindowResize); + + // Stats + + stats = new Stats(); + container.appendChild(stats.dom); + + // Controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 8; + controls.target.set(0, 1, 0); + controls.update(); + + // GUI + + const gui = new GUI(), + folder = gui.addFolder('Local Clipping'), + props = { + get Enabled() { + return renderer.localClippingEnabled; + }, + set Enabled(v) { + renderer.localClippingEnabled = v; + if (!v) volumeVisualization.visible = false; + }, + + get Shadows() { + return clipMaterial.clipShadows; + }, + set Shadows(v) { + clipMaterial.clipShadows = v; + }, + + get Visualize() { + return volumeVisualization.visible; + }, + set Visualize(v) { + if (renderer.localClippingEnabled) volumeVisualization.visible = v; + }, + }; + + folder.add(props, 'Enabled'); + folder.add(props, 'Shadows'); + folder.add(props, 'Visualize').listen(); + + gui.addFolder('Global Clipping').add( + { + get Enabled() { + return renderer.clippingPlanes !== Empty; + }, + set Enabled(v) { + renderer.clippingPlanes = v ? globalClippingPlanes : Empty; + }, + }, + 'Enabled', + ); + + // Start + + startTime = Date.now(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function setObjectWorldMatrix(object, matrix) { + // set the orientation of an object based on a world matrix + + const parent = object.parent; + scene.updateMatrixWorld(); + object.matrix.copy(parent.matrixWorld).invert(); + object.applyMatrix4(matrix); +} + +const transform = new THREE.Matrix4(), + tmpMatrix = new THREE.Matrix4(); + +function animate() { + const currentTime = Date.now(), + time = (currentTime - startTime) / 1000; + + object.position.y = 1; + object.rotation.x = time * 0.5; + object.rotation.y = time * 0.2; + + object.updateMatrix(); + transform.copy(object.matrix); + + const bouncy = Math.cos(time * 0.5) * 0.5 + 0.7; + transform.multiply(tmpMatrix.makeScale(bouncy, bouncy, bouncy)); + + assignTransformedPlanes(clipMaterial.clippingPlanes, Planes, transform); + + const planeMeshes = volumeVisualization.children; + + for (let i = 0, n = planeMeshes.length; i !== n; ++i) { + tmpMatrix.multiplyMatrices(transform, PlaneMatrices[i]); + setObjectWorldMatrix(planeMeshes[i], tmpMatrix); + } + + transform.makeRotationY(time * 0.1); + + assignTransformedPlanes(globalClippingPlanes, GlobalClippingPlanes, transform); + + stats.begin(); + renderer.render(scene, camera); + stats.end(); +} + +init(); diff --git a/examples-testing/examples/webgl_clipping_intersection.ts b/examples-testing/examples/webgl_clipping_intersection.ts new file mode 100644 index 000000000..5f45e45df --- /dev/null +++ b/examples-testing/examples/webgl_clipping_intersection.ts @@ -0,0 +1,137 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; + +const params = { + clipIntersection: true, + planeConstant: 0, + showHelpers: false, + alphaToCoverage: true, +}; + +const clipPlanes = [ + new THREE.Plane(new THREE.Vector3(1, 0, 0), 0), + new THREE.Plane(new THREE.Vector3(0, -1, 0), 0), + new THREE.Plane(new THREE.Vector3(0, 0, -1), 0), +]; + +init(); +render(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.localClippingEnabled = true; + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 200); + + camera.position.set(-1.5, 2.5, 3.0); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use only if there is no animation loop + controls.minDistance = 1; + controls.maxDistance = 10; + controls.enablePan = false; + + const light = new THREE.HemisphereLight(0xffffff, 0x080808, 4.5); + light.position.set(-1.25, 1, 1.25); + scene.add(light); + + // + + const group = new THREE.Group(); + + for (let i = 1; i <= 30; i += 2) { + const geometry = new THREE.SphereGeometry(i / 30, 48, 24); + + const material = new THREE.MeshPhongMaterial({ + color: new THREE.Color().setHSL(Math.random(), 0.5, 0.5, THREE.SRGBColorSpace), + side: THREE.DoubleSide, + clippingPlanes: clipPlanes, + clipIntersection: params.clipIntersection, + alphaToCoverage: true, + }); + + group.add(new THREE.Mesh(geometry, material)); + } + + scene.add(group); + + // helpers + + const helpers = new THREE.Group(); + helpers.add(new THREE.PlaneHelper(clipPlanes[0], 2, 0xff0000)); + helpers.add(new THREE.PlaneHelper(clipPlanes[1], 2, 0x00ff00)); + helpers.add(new THREE.PlaneHelper(clipPlanes[2], 2, 0x0000ff)); + helpers.visible = false; + scene.add(helpers); + + // gui + + const gui = new GUI(); + + gui.add(params, 'alphaToCoverage').onChange(function (value) { + group.children.forEach(c => { + c.material.alphaToCoverage = Boolean(value); + c.material.needsUpdate = true; + }); + + render(); + }); + + gui.add(params, 'clipIntersection') + .name('clip intersection') + .onChange(function (value) { + const children = group.children; + + for (let i = 0; i < children.length; i++) { + children[i].material.clipIntersection = value; + } + + render(); + }); + + gui.add(params, 'planeConstant', -1, 1) + .step(0.01) + .name('plane constant') + .onChange(function (value) { + for (let j = 0; j < clipPlanes.length; j++) { + clipPlanes[j].constant = value; + } + + render(); + }); + + gui.add(params, 'showHelpers') + .name('show helpers') + .onChange(function (value) { + helpers.visible = value; + + render(); + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_clipping_stencil.ts b/examples-testing/examples/webgl_clipping_stencil.ts new file mode 100644 index 000000000..7cb1f5c52 --- /dev/null +++ b/examples-testing/examples/webgl_clipping_stencil.ts @@ -0,0 +1,263 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, object, stats; +let planes, planeObjects, planeHelpers; +let timer; + +const params = { + animate: true, + planeX: { + constant: 0, + negated: false, + displayHelper: false, + }, + planeY: { + constant: 0, + negated: false, + displayHelper: false, + }, + planeZ: { + constant: 0, + negated: false, + displayHelper: false, + }, +}; + +init(); + +function createPlaneStencilGroup(geometry, plane, renderOrder) { + const group = new THREE.Group(); + const baseMat = new THREE.MeshBasicMaterial(); + baseMat.depthWrite = false; + baseMat.depthTest = false; + baseMat.colorWrite = false; + baseMat.stencilWrite = true; + baseMat.stencilFunc = THREE.AlwaysStencilFunc; + + // back faces + const mat0 = baseMat.clone(); + mat0.side = THREE.BackSide; + mat0.clippingPlanes = [plane]; + mat0.stencilFail = THREE.IncrementWrapStencilOp; + mat0.stencilZFail = THREE.IncrementWrapStencilOp; + mat0.stencilZPass = THREE.IncrementWrapStencilOp; + + const mesh0 = new THREE.Mesh(geometry, mat0); + mesh0.renderOrder = renderOrder; + group.add(mesh0); + + // front faces + const mat1 = baseMat.clone(); + mat1.side = THREE.FrontSide; + mat1.clippingPlanes = [plane]; + mat1.stencilFail = THREE.DecrementWrapStencilOp; + mat1.stencilZFail = THREE.DecrementWrapStencilOp; + mat1.stencilZPass = THREE.DecrementWrapStencilOp; + + const mesh1 = new THREE.Mesh(geometry, mat1); + mesh1.renderOrder = renderOrder; + + group.add(mesh1); + + return group; +} + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 1, 100); + camera.position.set(2, 2, 2); + + scene.add(new THREE.AmbientLight(0xffffff, 1.5)); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(5, 10, 7.5); + dirLight.castShadow = true; + dirLight.shadow.camera.right = 2; + dirLight.shadow.camera.left = -2; + dirLight.shadow.camera.top = 2; + dirLight.shadow.camera.bottom = -2; + + dirLight.shadow.mapSize.width = 1024; + dirLight.shadow.mapSize.height = 1024; + scene.add(dirLight); + + planes = [ + new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0), + new THREE.Plane(new THREE.Vector3(0, -1, 0), 0), + new THREE.Plane(new THREE.Vector3(0, 0, -1), 0), + ]; + + planeHelpers = planes.map(p => new THREE.PlaneHelper(p, 2, 0xffffff)); + planeHelpers.forEach(ph => { + ph.visible = false; + scene.add(ph); + }); + + const geometry = new THREE.TorusKnotGeometry(0.4, 0.15, 220, 60); + object = new THREE.Group(); + scene.add(object); + + // Set up clip plane rendering + planeObjects = []; + const planeGeom = new THREE.PlaneGeometry(4, 4); + + for (let i = 0; i < 3; i++) { + const poGroup = new THREE.Group(); + const plane = planes[i]; + const stencilGroup = createPlaneStencilGroup(geometry, plane, i + 1); + + // plane is clipped by the other clipping planes + const planeMat = new THREE.MeshStandardMaterial({ + color: 0xe91e63, + metalness: 0.1, + roughness: 0.75, + clippingPlanes: planes.filter(p => p !== plane), + + stencilWrite: true, + stencilRef: 0, + stencilFunc: THREE.NotEqualStencilFunc, + stencilFail: THREE.ReplaceStencilOp, + stencilZFail: THREE.ReplaceStencilOp, + stencilZPass: THREE.ReplaceStencilOp, + }); + const po = new THREE.Mesh(planeGeom, planeMat); + po.onAfterRender = function (renderer) { + renderer.clearStencil(); + }; + + po.renderOrder = i + 1.1; + + object.add(stencilGroup); + poGroup.add(po); + planeObjects.push(po); + scene.add(poGroup); + } + + const material = new THREE.MeshStandardMaterial({ + color: 0xffc107, + metalness: 0.1, + roughness: 0.75, + clippingPlanes: planes, + clipShadows: true, + shadowSide: THREE.DoubleSide, + }); + + // add the color + const clippedColorFront = new THREE.Mesh(geometry, material); + clippedColorFront.castShadow = true; + clippedColorFront.renderOrder = 6; + object.add(clippedColorFront); + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(9, 9, 1, 1), + new THREE.ShadowMaterial({ color: 0x000000, opacity: 0.25, side: THREE.DoubleSide }), + ); + + ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z + ground.position.y = -1; + ground.receiveShadow = true; + scene.add(ground); + + // Renderer + renderer = new THREE.WebGLRenderer({ antialias: true, stencil: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setClearColor(0x263238); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.localClippingEnabled = true; + document.body.appendChild(renderer.domElement); + + // Stats + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); + + // Controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 20; + controls.update(); + + // GUI + const gui = new GUI(); + gui.add(params, 'animate'); + + const planeX = gui.addFolder('planeX'); + planeX.add(params.planeX, 'displayHelper').onChange(v => (planeHelpers[0].visible = v)); + planeX + .add(params.planeX, 'constant') + .min(-1) + .max(1) + .onChange(d => (planes[0].constant = d)); + planeX.add(params.planeX, 'negated').onChange(() => { + planes[0].negate(); + params.planeX.constant = planes[0].constant; + }); + planeX.open(); + + const planeY = gui.addFolder('planeY'); + planeY.add(params.planeY, 'displayHelper').onChange(v => (planeHelpers[1].visible = v)); + planeY + .add(params.planeY, 'constant') + .min(-1) + .max(1) + .onChange(d => (planes[1].constant = d)); + planeY.add(params.planeY, 'negated').onChange(() => { + planes[1].negate(); + params.planeY.constant = planes[1].constant; + }); + planeY.open(); + + const planeZ = gui.addFolder('planeZ'); + planeZ.add(params.planeZ, 'displayHelper').onChange(v => (planeHelpers[2].visible = v)); + planeZ + .add(params.planeZ, 'constant') + .min(-1) + .max(1) + .onChange(d => (planes[2].constant = d)); + planeZ.add(params.planeZ, 'negated').onChange(() => { + planes[2].negate(); + params.planeZ.constant = planes[2].constant; + }); + planeZ.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (params.animate) { + object.rotation.x += delta * 0.5; + object.rotation.y += delta * 0.2; + } + + for (let i = 0; i < planeObjects.length; i++) { + const plane = planes[i]; + const po = planeObjects[i]; + plane.coplanarPoint(po.position); + po.lookAt(po.position.x - plane.normal.x, po.position.y - plane.normal.y, po.position.z - plane.normal.z); + } + + stats.begin(); + renderer.render(scene, camera); + stats.end(); +} diff --git a/examples-testing/examples/webgl_custom_attributes.ts b/examples-testing/examples/webgl_custom_attributes.ts new file mode 100644 index 000000000..0dc897748 --- /dev/null +++ b/examples-testing/examples/webgl_custom_attributes.ts @@ -0,0 +1,100 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let renderer, scene, camera, stats; + +let sphere, uniforms; + +let displacement, noise; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 300; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + + uniforms = { + amplitude: { value: 1.0 }, + color: { value: new THREE.Color(0xff2200) }, + colorTexture: { value: new THREE.TextureLoader().load('textures/water.jpg') }, + }; + + uniforms['colorTexture'].value.wrapS = uniforms['colorTexture'].value.wrapT = THREE.RepeatWrapping; + + const shaderMaterial = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + }); + + const radius = 50, + segments = 128, + rings = 64; + + const geometry = new THREE.SphereGeometry(radius, segments, rings); + + displacement = new Float32Array(geometry.attributes.position.count); + noise = new Float32Array(geometry.attributes.position.count); + + for (let i = 0; i < displacement.length; i++) { + noise[i] = Math.random() * 5; + } + + geometry.setAttribute('displacement', new THREE.BufferAttribute(displacement, 1)); + + sphere = new THREE.Mesh(geometry, shaderMaterial); + scene.add(sphere); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + const container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.01; + + sphere.rotation.y = sphere.rotation.z = 0.01 * time; + + uniforms['amplitude'].value = 2.5 * Math.sin(sphere.rotation.y * 0.125); + uniforms['color'].value.offsetHSL(0.0005, 0, 0); + + for (let i = 0; i < displacement.length; i++) { + displacement[i] = Math.sin(0.1 * i + time); + + noise[i] += 0.5 * (0.5 - Math.random()); + noise[i] = THREE.MathUtils.clamp(noise[i], -5, 5); + + displacement[i] += noise[i]; + } + + sphere.geometry.attributes.displacement.needsUpdate = true; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_custom_attributes_lines.ts b/examples-testing/examples/webgl_custom_attributes_lines.ts new file mode 100644 index 000000000..3e2454e92 --- /dev/null +++ b/examples-testing/examples/webgl_custom_attributes_lines.ts @@ -0,0 +1,121 @@ +import * as THREE from 'three'; + +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let renderer, scene, camera, stats; + +let line, uniforms; + +const loader = new FontLoader(); +loader.load('fonts/helvetiker_bold.typeface.json', function (font) { + init(font); +}); + +function init(font) { + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 400; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + + uniforms = { + amplitude: { value: 5.0 }, + opacity: { value: 0.3 }, + color: { value: new THREE.Color(0xffffff) }, + }; + + const shaderMaterial = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + blending: THREE.AdditiveBlending, + depthTest: false, + transparent: true, + }); + + const geometry = new TextGeometry('three.js', { + font: font, + + size: 50, + depth: 15, + curveSegments: 10, + + bevelThickness: 5, + bevelSize: 1.5, + bevelEnabled: true, + bevelSegments: 10, + }); + + geometry.center(); + + const count = geometry.attributes.position.count; + + const displacement = new THREE.Float32BufferAttribute(count * 3, 3); + geometry.setAttribute('displacement', displacement); + + const customColor = new THREE.Float32BufferAttribute(count * 3, 3); + geometry.setAttribute('customColor', customColor); + + const color = new THREE.Color(0xffffff); + + for (let i = 0, l = customColor.count; i < l; i++) { + color.setHSL(i / l, 0.5, 0.5); + color.toArray(customColor.array, i * customColor.itemSize); + } + + line = new THREE.Line(geometry, shaderMaterial); + line.rotation.x = 0.2; + scene.add(line); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + const container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.001; + + line.rotation.y = 0.25 * time; + + uniforms.amplitude.value = Math.sin(0.5 * time); + uniforms.color.value.offsetHSL(0.0005, 0, 0); + + const attributes = line.geometry.attributes; + const array = attributes.displacement.array; + + for (let i = 0, l = array.length; i < l; i += 3) { + array[i] += 0.3 * (0.5 - Math.random()); + array[i + 1] += 0.3 * (0.5 - Math.random()); + array[i + 2] += 0.3 * (0.5 - Math.random()); + } + + attributes.displacement.needsUpdate = true; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_custom_attributes_points.ts b/examples-testing/examples/webgl_custom_attributes_points.ts new file mode 100644 index 000000000..ae112980a --- /dev/null +++ b/examples-testing/examples/webgl_custom_attributes_points.ts @@ -0,0 +1,117 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let renderer, scene, camera, stats; + +let sphere; + +const WIDTH = window.innerWidth; +const HEIGHT = window.innerHeight; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(40, WIDTH / HEIGHT, 1, 10000); + camera.position.z = 300; + + scene = new THREE.Scene(); + + const amount = 100000; + const radius = 200; + + const positions = new Float32Array(amount * 3); + const colors = new Float32Array(amount * 3); + const sizes = new Float32Array(amount); + + const vertex = new THREE.Vector3(); + const color = new THREE.Color(0xffffff); + + for (let i = 0; i < amount; i++) { + vertex.x = (Math.random() * 2 - 1) * radius; + vertex.y = (Math.random() * 2 - 1) * radius; + vertex.z = (Math.random() * 2 - 1) * radius; + vertex.toArray(positions, i * 3); + + if (vertex.x < 0) { + color.setHSL(0.5 + 0.1 * (i / amount), 0.7, 0.5); + } else { + color.setHSL(0.0 + 0.1 * (i / amount), 0.9, 0.5); + } + + color.toArray(colors, i * 3); + + sizes[i] = 10; + } + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + geometry.setAttribute('customColor', new THREE.BufferAttribute(colors, 3)); + geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1)); + + // + + const material = new THREE.ShaderMaterial({ + uniforms: { + color: { value: new THREE.Color(0xffffff) }, + pointTexture: { value: new THREE.TextureLoader().load('textures/sprites/spark1.png') }, + }, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + + blending: THREE.AdditiveBlending, + depthTest: false, + transparent: true, + }); + + // + + sphere = new THREE.Points(geometry, material); + scene.add(sphere); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(WIDTH, HEIGHT); + renderer.setAnimationLoop(animate); + + const container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.005; + + sphere.rotation.z = 0.01 * time; + + const geometry = sphere.geometry; + const attributes = geometry.attributes; + + for (let i = 0; i < attributes.size.array.length; i++) { + attributes.size.array[i] = 14 + 13 * Math.sin(0.1 * i + time); + } + + attributes.size.needsUpdate = true; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_custom_attributes_points2.ts b/examples-testing/examples/webgl_custom_attributes_points2.ts new file mode 100644 index 000000000..edd158fa1 --- /dev/null +++ b/examples-testing/examples/webgl_custom_attributes_points2.ts @@ -0,0 +1,193 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +let renderer, scene, camera, stats; +let sphere, length1; + +const WIDTH = window.innerWidth; +const HEIGHT = window.innerHeight; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, WIDTH / HEIGHT, 1, 10000); + camera.position.z = 300; + + scene = new THREE.Scene(); + + const radius = 100, + segments = 68, + rings = 38; + + let sphereGeometry = new THREE.SphereGeometry(radius, segments, rings); + let boxGeometry = new THREE.BoxGeometry(0.8 * radius, 0.8 * radius, 0.8 * radius, 10, 10, 10); + + // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data + + sphereGeometry.deleteAttribute('normal'); + sphereGeometry.deleteAttribute('uv'); + + boxGeometry.deleteAttribute('normal'); + boxGeometry.deleteAttribute('uv'); + + sphereGeometry = BufferGeometryUtils.mergeVertices(sphereGeometry); + boxGeometry = BufferGeometryUtils.mergeVertices(boxGeometry); + + const combinedGeometry = BufferGeometryUtils.mergeGeometries([sphereGeometry, boxGeometry]); + const positionAttribute = combinedGeometry.getAttribute('position'); + + const colors = []; + const sizes = []; + + const color = new THREE.Color(); + const vertex = new THREE.Vector3(); + + length1 = sphereGeometry.getAttribute('position').count; + + for (let i = 0, l = positionAttribute.count; i < l; i++) { + vertex.fromBufferAttribute(positionAttribute, i); + + if (i < length1) { + color.setHSL(0.01 + 0.1 * (i / length1), 0.99, (vertex.y + radius) / (4 * radius)); + } else { + color.setHSL(0.6, 0.75, 0.25 + vertex.y / (2 * radius)); + } + + color.toArray(colors, i * 3); + + sizes[i] = i < length1 ? 10 : 40; + } + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', positionAttribute); + geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1)); + geometry.setAttribute('ca', new THREE.Float32BufferAttribute(colors, 3)); + + // + + const texture = new THREE.TextureLoader().load('textures/sprites/disc.png'); + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + + const material = new THREE.ShaderMaterial({ + uniforms: { + color: { value: new THREE.Color(0xffffff) }, + pointTexture: { value: texture }, + }, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + transparent: true, + }); + + // + + sphere = new THREE.Points(geometry, material); + scene.add(sphere); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(WIDTH, HEIGHT); + renderer.setAnimationLoop(animate); + + const container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function sortPoints() { + const vector = new THREE.Vector3(); + + // Model View Projection matrix + + const matrix = new THREE.Matrix4(); + matrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); + matrix.multiply(sphere.matrixWorld); + + // + + const geometry = sphere.geometry; + + let index = geometry.getIndex(); + const positions = geometry.getAttribute('position').array; + const length = positions.length / 3; + + if (index === null) { + const array = new Uint16Array(length); + + for (let i = 0; i < length; i++) { + array[i] = i; + } + + index = new THREE.BufferAttribute(array, 1); + + geometry.setIndex(index); + } + + const sortArray = []; + + for (let i = 0; i < length; i++) { + vector.fromArray(positions, i * 3); + vector.applyMatrix4(matrix); + + sortArray.push([vector.z, i]); + } + + function numericalSort(a, b) { + return b[0] - a[0]; + } + + sortArray.sort(numericalSort); + + const indices = index.array; + + for (let i = 0; i < length; i++) { + indices[i] = sortArray[i][1]; + } + + geometry.index.needsUpdate = true; +} + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.005; + + sphere.rotation.y = 0.02 * time; + sphere.rotation.z = 0.02 * time; + + const geometry = sphere.geometry; + const attributes = geometry.attributes; + + for (let i = 0; i < attributes.size.array.length; i++) { + if (i < length1) { + attributes.size.array[i] = 16 + 12 * Math.sin(0.1 * i + time); + } + } + + attributes.size.needsUpdate = true; + + sortPoints(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_custom_attributes_points3.ts b/examples-testing/examples/webgl_custom_attributes_points3.ts new file mode 100644 index 000000000..1bca8ccd4 --- /dev/null +++ b/examples-testing/examples/webgl_custom_attributes_points3.ts @@ -0,0 +1,200 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +let renderer, scene, camera, stats; + +let object; + +let vertices1; + +const WIDTH = window.innerWidth; +const HEIGHT = window.innerHeight; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(40, WIDTH / HEIGHT, 1, 1000); + camera.position.z = 500; + + scene = new THREE.Scene(); + + let radius = 100; + const inner = 0.6 * radius; + const vertex = new THREE.Vector3(); + const vertices = []; + + for (let i = 0; i < 100000; i++) { + vertex.x = Math.random() * 2 - 1; + vertex.y = Math.random() * 2 - 1; + vertex.z = Math.random() * 2 - 1; + vertex.multiplyScalar(radius); + + if ( + vertex.x > inner || + vertex.x < -inner || + vertex.y > inner || + vertex.y < -inner || + vertex.z > inner || + vertex.z < -inner + ) + vertices.push(vertex.x, vertex.y, vertex.z); + } + + vertices1 = vertices.length / 3; + + radius = 200; + + let boxGeometry1 = new THREE.BoxGeometry(radius, 0.1 * radius, 0.1 * radius, 50, 5, 5); + + // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data + + boxGeometry1.deleteAttribute('normal'); + boxGeometry1.deleteAttribute('uv'); + + boxGeometry1 = BufferGeometryUtils.mergeVertices(boxGeometry1); + + const matrix = new THREE.Matrix4(); + const position = new THREE.Vector3(); + const rotation = new THREE.Euler(); + const quaternion = new THREE.Quaternion(); + const scale = new THREE.Vector3(1, 1, 1); + + function addGeo(geo, x, y, z, ry) { + position.set(x, y, z); + rotation.set(0, ry, 0); + + matrix.compose(position, quaternion.setFromEuler(rotation), scale); + + const positionAttribute = geo.getAttribute('position'); + + for (let i = 0, l = positionAttribute.count; i < l; i++) { + vertex.fromBufferAttribute(positionAttribute, i); + vertex.applyMatrix4(matrix); + vertices.push(vertex.x, vertex.y, vertex.z); + } + } + + // side 1 + + addGeo(boxGeometry1, 0, 110, 110, 0); + addGeo(boxGeometry1, 0, 110, -110, 0); + addGeo(boxGeometry1, 0, -110, 110, 0); + addGeo(boxGeometry1, 0, -110, -110, 0); + + // side 2 + + addGeo(boxGeometry1, 110, 110, 0, Math.PI / 2); + addGeo(boxGeometry1, 110, -110, 0, Math.PI / 2); + addGeo(boxGeometry1, -110, 110, 0, Math.PI / 2); + addGeo(boxGeometry1, -110, -110, 0, Math.PI / 2); + + // corner edges + + let boxGeometry2 = new THREE.BoxGeometry(0.1 * radius, radius * 1.2, 0.1 * radius, 5, 60, 5); + + boxGeometry2.deleteAttribute('normal'); + boxGeometry2.deleteAttribute('uv'); + + boxGeometry2 = BufferGeometryUtils.mergeVertices(boxGeometry2); + + addGeo(boxGeometry2, 110, 0, 110, 0); + addGeo(boxGeometry2, 110, 0, -110, 0); + addGeo(boxGeometry2, -110, 0, 110, 0); + addGeo(boxGeometry2, -110, 0, -110, 0); + + const positionAttribute = new THREE.Float32BufferAttribute(vertices, 3); + + const colors = []; + const sizes = []; + + const color = new THREE.Color(); + + for (let i = 0; i < positionAttribute.count; i++) { + if (i < vertices1) { + color.setHSL(0.5 + 0.2 * (i / vertices1), 1, 0.5); + } else { + color.setHSL(0.1, 1, 0.5); + } + + color.toArray(colors, i * 3); + + sizes[i] = i < vertices1 ? 10 : 40; + } + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', positionAttribute); + geometry.setAttribute('ca', new THREE.Float32BufferAttribute(colors, 3)); + geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1)); + + // + + const texture = new THREE.TextureLoader().load('textures/sprites/ball.png'); + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + + const material = new THREE.ShaderMaterial({ + uniforms: { + amplitude: { value: 1.0 }, + color: { value: new THREE.Color(0xffffff) }, + pointTexture: { value: texture }, + }, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + }); + + // + + object = new THREE.Points(geometry, material); + scene.add(object); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(WIDTH, HEIGHT); + renderer.setAnimationLoop(animate); + + const container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.01; + + object.rotation.y = object.rotation.z = 0.02 * time; + + const geometry = object.geometry; + const attributes = geometry.attributes; + + for (let i = 0; i < attributes.size.array.length; i++) { + if (i < vertices1) { + attributes.size.array[i] = Math.max(0, 26 + 32 * Math.sin(0.1 * i + 0.6 * time)); + } + } + + attributes.size.needsUpdate = true; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_decals.ts b/examples-testing/examples/webgl_decals.ts new file mode 100644 index 000000000..8f77c30fc --- /dev/null +++ b/examples-testing/examples/webgl_decals.ts @@ -0,0 +1,240 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js'; + +const container = document.getElementById('container'); + +let renderer, scene, camera, stats; +let mesh; +let raycaster; +let line; + +const intersection = { + intersects: false, + point: new THREE.Vector3(), + normal: new THREE.Vector3(), +}; +const mouse = new THREE.Vector2(); +const intersects = []; + +const textureLoader = new THREE.TextureLoader(); +const decalDiffuse = textureLoader.load('textures/decal/decal-diffuse.png'); +decalDiffuse.colorSpace = THREE.SRGBColorSpace; +const decalNormal = textureLoader.load('textures/decal/decal-normal.jpg'); + +const decalMaterial = new THREE.MeshPhongMaterial({ + specular: 0x444444, + map: decalDiffuse, + normalMap: decalNormal, + normalScale: new THREE.Vector2(1, 1), + shininess: 30, + transparent: true, + depthTest: true, + depthWrite: false, + polygonOffset: true, + polygonOffsetFactor: -4, + wireframe: false, +}); + +const decals = []; +let mouseHelper; +const position = new THREE.Vector3(); +const orientation = new THREE.Euler(); +const size = new THREE.Vector3(10, 10, 10); + +const params = { + minScale: 10, + maxScale: 20, + rotate: true, + clear: function () { + removeDecals(); + }, +}; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 120; + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 50; + controls.maxDistance = 200; + + scene.add(new THREE.AmbientLight(0x666666)); + + const dirLight1 = new THREE.DirectionalLight(0xffddcc, 3); + dirLight1.position.set(1, 0.75, 0.5); + scene.add(dirLight1); + + const dirLight2 = new THREE.DirectionalLight(0xccccff, 3); + dirLight2.position.set(-1, 0.75, -0.5); + scene.add(dirLight2); + + const geometry = new THREE.BufferGeometry(); + geometry.setFromPoints([new THREE.Vector3(), new THREE.Vector3()]); + + line = new THREE.Line(geometry, new THREE.LineBasicMaterial()); + scene.add(line); + + loadLeePerrySmith(); + + raycaster = new THREE.Raycaster(); + + mouseHelper = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 10), new THREE.MeshNormalMaterial()); + mouseHelper.visible = false; + scene.add(mouseHelper); + + window.addEventListener('resize', onWindowResize); + + let moved = false; + + controls.addEventListener('change', function () { + moved = true; + }); + + window.addEventListener('pointerdown', function () { + moved = false; + }); + + window.addEventListener('pointerup', function (event) { + if (moved === false) { + checkIntersection(event.clientX, event.clientY); + + if (intersection.intersects) shoot(); + } + }); + + window.addEventListener('pointermove', onPointerMove); + + function onPointerMove(event) { + if (event.isPrimary) { + checkIntersection(event.clientX, event.clientY); + } + } + + function checkIntersection(x, y) { + if (mesh === undefined) return; + + mouse.x = (x / window.innerWidth) * 2 - 1; + mouse.y = -(y / window.innerHeight) * 2 + 1; + + raycaster.setFromCamera(mouse, camera); + raycaster.intersectObject(mesh, false, intersects); + + if (intersects.length > 0) { + const p = intersects[0].point; + mouseHelper.position.copy(p); + intersection.point.copy(p); + + const normalMatrix = new THREE.Matrix3().getNormalMatrix(mesh.matrixWorld); + + const n = intersects[0].face.normal.clone(); + n.applyNormalMatrix(normalMatrix); + n.multiplyScalar(10); + n.add(intersects[0].point); + + intersection.normal.copy(intersects[0].face.normal); + mouseHelper.lookAt(n); + + const positions = line.geometry.attributes.position; + positions.setXYZ(0, p.x, p.y, p.z); + positions.setXYZ(1, n.x, n.y, n.z); + positions.needsUpdate = true; + + intersection.intersects = true; + + intersects.length = 0; + } else { + intersection.intersects = false; + } + } + + const gui = new GUI(); + + gui.add(params, 'minScale', 1, 30); + gui.add(params, 'maxScale', 1, 30); + gui.add(params, 'rotate'); + gui.add(params, 'clear'); + gui.open(); +} + +function loadLeePerrySmith() { + const map = textureLoader.load('models/gltf/LeePerrySmith/Map-COL.jpg'); + map.colorSpace = THREE.SRGBColorSpace; + const specularMap = textureLoader.load('models/gltf/LeePerrySmith/Map-SPEC.jpg'); + const normalMap = textureLoader.load('models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg'); + + const loader = new GLTFLoader(); + + loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + mesh = gltf.scene.children[0]; + mesh.material = new THREE.MeshPhongMaterial({ + specular: 0x111111, + map: map, + specularMap: specularMap, + normalMap: normalMap, + shininess: 25, + }); + + scene.add(mesh); + mesh.scale.multiplyScalar(10); + }); +} + +function shoot() { + position.copy(intersection.point); + orientation.copy(mouseHelper.rotation); + + if (params.rotate) orientation.z = Math.random() * 2 * Math.PI; + + const scale = params.minScale + Math.random() * (params.maxScale - params.minScale); + size.set(scale, scale, scale); + + const material = decalMaterial.clone(); + material.color.setHex(Math.random() * 0xffffff); + + const m = new THREE.Mesh(new DecalGeometry(mesh, position, orientation, size), material); + m.renderOrder = decals.length; // give decals a fixed render order + + decals.push(m); + + mesh.attach(m); +} + +function removeDecals() { + decals.forEach(function (d) { + mesh.remove(d); + }); + + decals.length = 0; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_effects_anaglyph.ts b/examples-testing/examples/webgl_effects_anaglyph.ts new file mode 100644 index 000000000..7e67c9173 --- /dev/null +++ b/examples-testing/examples/webgl_effects_anaglyph.ts @@ -0,0 +1,120 @@ +import * as THREE from 'three'; + +import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js'; + +let container, camera, scene, renderer, effect; + +const spheres = []; + +let mouseX = 0; +let mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +document.addEventListener('mousemove', onDocumentMouseMove); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.z = 3; + + const path = 'textures/cube/pisa/'; + const format = '.png'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const textureCube = new THREE.CubeTextureLoader().load(urls); + + scene = new THREE.Scene(); + scene.background = textureCube; + + const geometry = new THREE.SphereGeometry(0.1, 32, 16); + const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); + + for (let i = 0; i < 500; i++) { + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = Math.random() * 10 - 5; + mesh.position.y = Math.random() * 10 - 5; + mesh.position.z = Math.random() * 10 - 5; + + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; + + scene.add(mesh); + + spheres.push(mesh); + } + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + const width = window.innerWidth || 2; + const height = window.innerHeight || 2; + + effect = new AnaglyphEffect(renderer); + effect.setSize(width, height); + + // Configure stereo parameters for physically-correct rendering + // eyeSep: interpupillary distance (default 0.064m / 64mm for humans) + // planeDistance: distance to the zero-parallax plane (objects here appear at screen depth) + effect.eyeSep = 0.064; + effect.planeDistance = 3; // Match camera distance to origin for zero parallax at scene center + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + effect.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentMouseMove(event) { + mouseX = (event.clientX - windowHalfX) / 100; + mouseY = (event.clientY - windowHalfY) / 100; +} + +// + +function animate() { + render(); +} + +function render() { + const timer = 0.0001 * Date.now(); + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + for (let i = 0, il = spheres.length; i < il; i++) { + const sphere = spheres[i]; + + sphere.position.x = 5 * Math.cos(timer + i); + sphere.position.y = 5 * Math.sin(timer + i * 1.1); + } + + effect.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_effects_ascii.ts b/examples-testing/examples/webgl_effects_ascii.ts new file mode 100644 index 000000000..a412bb79e --- /dev/null +++ b/examples-testing/examples/webgl_effects_ascii.ts @@ -0,0 +1,81 @@ +import * as THREE from 'three'; + +import { AsciiEffect } from 'three/addons/effects/AsciiEffect.js'; +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; + +let camera, controls, scene, renderer, effect; + +let sphere, plane; + +const start = Date.now(); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.y = 150; + camera.position.z = 500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0, 0, 0); + + const pointLight1 = new THREE.PointLight(0xffffff, 3, 0, 0); + pointLight1.position.set(500, 500, 500); + scene.add(pointLight1); + + const pointLight2 = new THREE.PointLight(0xffffff, 1, 0, 0); + pointLight2.position.set(-500, -500, -500); + scene.add(pointLight2); + + sphere = new THREE.Mesh(new THREE.SphereGeometry(200, 20, 10), new THREE.MeshPhongMaterial({ flatShading: true })); + scene.add(sphere); + + // Plane + + plane = new THREE.Mesh(new THREE.PlaneGeometry(400, 400), new THREE.MeshBasicMaterial({ color: 0xe0e0e0 })); + plane.position.y = -200; + plane.rotation.x = -Math.PI / 2; + scene.add(plane); + + renderer = new THREE.WebGLRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + effect = new AsciiEffect(renderer, ' .:-+*=%@#', { invert: true }); + effect.setSize(window.innerWidth, window.innerHeight); + effect.domElement.style.color = 'white'; + effect.domElement.style.backgroundColor = 'black'; + + // Special case: append effect.domElement, instead of renderer.domElement. + // AsciiEffect creates a custom domElement (a div container) where the ASCII elements are placed. + + document.body.appendChild(effect.domElement); + + controls = new TrackballControls(camera, effect.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + effect.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const timer = Date.now() - start; + + sphere.position.y = Math.abs(Math.sin(timer * 0.002)) * 150; + sphere.rotation.x = timer * 0.0003; + sphere.rotation.z = timer * 0.0002; + + controls.update(); + + effect.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_effects_parallaxbarrier.ts b/examples-testing/examples/webgl_effects_parallaxbarrier.ts new file mode 100644 index 000000000..90c867973 --- /dev/null +++ b/examples-testing/examples/webgl_effects_parallaxbarrier.ts @@ -0,0 +1,110 @@ +import * as THREE from 'three'; + +import { ParallaxBarrierEffect } from 'three/addons/effects/ParallaxBarrierEffect.js'; + +let container, camera, scene, renderer, effect; + +const spheres = []; + +let mouseX = 0; +let mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +document.addEventListener('mousemove', onDocumentMouseMove); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.z = 3; + + const path = 'textures/cube/pisa/'; + const format = '.png'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const textureCube = new THREE.CubeTextureLoader().load(urls); + + scene = new THREE.Scene(); + scene.background = textureCube; + + const geometry = new THREE.SphereGeometry(0.1, 32, 16); + const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); + + for (let i = 0; i < 500; i++) { + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = Math.random() * 10 - 5; + mesh.position.y = Math.random() * 10 - 5; + mesh.position.z = Math.random() * 10 - 5; + + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; + + scene.add(mesh); + + spheres.push(mesh); + } + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + const width = window.innerWidth || 2; + const height = window.innerHeight || 2; + + effect = new ParallaxBarrierEffect(renderer); + effect.setSize(width, height); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + effect.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentMouseMove(event) { + mouseX = (event.clientX - windowHalfX) / 100; + mouseY = (event.clientY - windowHalfY) / 100; +} + +// + +function animate() { + const timer = 0.0001 * Date.now(); + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + for (let i = 0, il = spheres.length; i < il; i++) { + const sphere = spheres[i]; + + sphere.position.x = 5 * Math.cos(timer + i); + sphere.position.y = 5 * Math.sin(timer + i * 1.1); + } + + effect.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_effects_stereo.ts b/examples-testing/examples/webgl_effects_stereo.ts new file mode 100644 index 000000000..673850541 --- /dev/null +++ b/examples-testing/examples/webgl_effects_stereo.ts @@ -0,0 +1,98 @@ +import * as THREE from 'three'; + +import { StereoEffect } from 'three/addons/effects/StereoEffect.js'; + +let container, camera, scene, renderer, effect; + +const spheres = []; + +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +document.addEventListener('mousemove', onDocumentMouseMove); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 3; + + scene = new THREE.Scene(); + scene.background = new THREE.CubeTextureLoader() + .setPath('textures/cube/Park3Med/') + .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); + + const geometry = new THREE.SphereGeometry(0.1, 32, 16); + + const textureCube = new THREE.CubeTextureLoader() + .setPath('textures/cube/Park3Med/') + .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); + textureCube.mapping = THREE.CubeRefractionMapping; + + const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 }); + + for (let i = 0; i < 500; i++) { + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = Math.random() * 10 - 5; + mesh.position.y = Math.random() * 10 - 5; + mesh.position.z = Math.random() * 10 - 5; + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; + scene.add(mesh); + + spheres.push(mesh); + } + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + effect = new StereoEffect(renderer); + effect.setSize(window.innerWidth, window.innerHeight); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + effect.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentMouseMove(event) { + mouseX = (event.clientX - windowHalfX) * 0.01; + mouseY = (event.clientY - windowHalfY) * 0.01; +} + +// + +function animate() { + const timer = 0.0001 * Date.now(); + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + camera.lookAt(scene.position); + + for (let i = 0, il = spheres.length; i < il; i++) { + const sphere = spheres[i]; + + sphere.position.x = 5 * Math.cos(timer + i); + sphere.position.y = 5 * Math.sin(timer + i * 1.1); + } + + effect.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_framebuffer_texture.ts b/examples-testing/examples/webgl_framebuffer_texture.ts new file mode 100644 index 000000000..df4acc9d6 --- /dev/null +++ b/examples-testing/examples/webgl_framebuffer_texture.ts @@ -0,0 +1,151 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; + +let camera, scene, renderer; +let line, sprite, texture; + +let cameraOrtho, sceneOrtho; + +let offset = 0; + +const dpr = window.devicePixelRatio; + +const textureSize = 128 * dpr; +const vector = new THREE.Vector2(); +const color = new THREE.Color(); + +init(); + +function init() { + // + + const width = window.innerWidth; + const height = window.innerHeight; + + camera = new THREE.PerspectiveCamera(70, width / height, 1, 1000); + camera.position.z = 20; + + cameraOrtho = new THREE.OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, 1, 10); + cameraOrtho.position.z = 10; + + scene = new THREE.Scene(); + sceneOrtho = new THREE.Scene(); + + // + + const points = GeometryUtils.gosper(8); + + const geometry = new THREE.BufferGeometry(); + const positionAttribute = new THREE.Float32BufferAttribute(points, 3); + geometry.setAttribute('position', positionAttribute); + geometry.center(); + + const colorAttribute = new THREE.BufferAttribute(new Float32Array(positionAttribute.array.length), 3); + colorAttribute.setUsage(THREE.DynamicDrawUsage); + geometry.setAttribute('color', colorAttribute); + + const material = new THREE.LineBasicMaterial({ vertexColors: true }); + + line = new THREE.Line(geometry, material); + line.scale.setScalar(0.05); + scene.add(line); + + // + + texture = new THREE.FramebufferTexture(textureSize, textureSize); + + // + + const spriteMaterial = new THREE.SpriteMaterial({ map: texture }); + sprite = new THREE.Sprite(spriteMaterial); + sprite.scale.set(textureSize, textureSize, 1); + sceneOrtho.add(sprite); + + updateSpritePosition(); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + document.body.appendChild(renderer.domElement); + + // + + const selection = document.getElementById('selection'); + const controls = new OrbitControls(camera, selection); + controls.enablePan = false; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + cameraOrtho.left = -width / 2; + cameraOrtho.right = width / 2; + cameraOrtho.top = height / 2; + cameraOrtho.bottom = -height / 2; + cameraOrtho.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + updateSpritePosition(); +} + +function updateSpritePosition() { + const halfWidth = window.innerWidth / 2; + const halfHeight = window.innerHeight / 2; + + const halfImageWidth = textureSize / 2; + const halfImageHeight = textureSize / 2; + + sprite.position.set(-halfWidth + halfImageWidth, halfHeight - halfImageHeight, 1); +} + +function animate() { + const colorAttribute = line.geometry.getAttribute('color'); + updateColors(colorAttribute); + + // scene rendering + + renderer.clear(); + renderer.render(scene, camera); + + // calculate start position for copying data + + vector.x = (window.innerWidth * dpr) / 2 - textureSize / 2; + vector.y = (window.innerHeight * dpr) / 2 - textureSize / 2; + + renderer.copyFramebufferToTexture(texture, vector); + + renderer.clearDepth(); + renderer.render(sceneOrtho, cameraOrtho); +} + +function updateColors(colorAttribute) { + const l = colorAttribute.count; + + for (let i = 0; i < l; i++) { + const h = ((offset + i) % l) / l; + + color.setHSL(h, 1, 0.5); + colorAttribute.setX(i, color.r); + colorAttribute.setY(i, color.g); + colorAttribute.setZ(i, color.b); + } + + colorAttribute.needsUpdate = true; + + offset -= 25; +} diff --git a/examples-testing/examples/webgl_furnace_test.ts b/examples-testing/examples/webgl_furnace_test.ts new file mode 100644 index 000000000..f89857366 --- /dev/null +++ b/examples-testing/examples/webgl_furnace_test.ts @@ -0,0 +1,108 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer, radianceMap; + +let gui; + +const COLOR = 0xcccccc; + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + const aspect = width / height; + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize(width, height); + renderer.setPixelRatio(window.devicePixelRatio); + document.body.appendChild(renderer.domElement); + + // scene + + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); + camera.position.set(0, 0, 18); + + // + + initGui(); + + window.addEventListener('resize', onWindowResize); +} + +function createObjects() { + const geometry = new THREE.SphereGeometry(0.4, 32, 16); + + for (let x = 0; x <= 10; x++) { + for (let y = 0; y <= 10; y++) { + const material = new THREE.MeshPhysicalMaterial({ + roughness: x / 10, + metalness: y / 10, + color: 0xffffff, + envMap: radianceMap, + envMapIntensity: 1, + transmission: 0, + ior: 1.5, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = x - 5; + mesh.position.y = 5 - y; + scene.add(mesh); + } + } +} + +function createEnvironment() { + const envScene = new THREE.Scene(); + envScene.background = new THREE.Color(COLOR); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + radianceMap = pmremGenerator.fromScene(envScene).texture; + pmremGenerator.dispose(); + + scene.background = envScene.background; +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + + render(); +} + +function render() { + renderer.render(scene, camera); +} + +function initGui() { + gui = new GUI(); + + const param = { + tint: false, + }; + + gui.add(param, 'tint') + .name('Tint for Visibility') + .onChange(function (val) { + scene.traverse(function (child) { + const tint = val ? 0xccccff : 0xffffff; + + if (child.isMesh) child.material.color.setHex(tint); + }); + + render(); + }); +} + +Promise.resolve().then(init).then(createEnvironment).then(createObjects).then(render); diff --git a/examples-testing/examples/webgl_geometries.ts b/examples-testing/examples/webgl_geometries.ts new file mode 100644 index 000000000..0eb50120c --- /dev/null +++ b/examples-testing/examples/webgl_geometries.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; +import { plane, klein, mobius } from 'three/addons/geometries/ParametricFunctions.js'; + +let camera, scene, renderer, stats; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.y = 500; + + scene = new THREE.Scene(); + + let object, geometry; + + const ambientLight = new THREE.AmbientLight(0xcccccc, 1.5); + scene.add(ambientLight); + + const pointLight = new THREE.PointLight(0xffffff, 2.5, 0, 0); + camera.add(pointLight); + scene.add(camera); + + const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); + map.wrapS = map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 16; + map.colorSpace = THREE.SRGBColorSpace; + + const material = new THREE.MeshPhongMaterial({ map: map, side: THREE.DoubleSide }); + + // + + object = new THREE.Mesh(new THREE.SphereGeometry(75, 20, 10), material); + object.position.set(-300, 0, 300); + scene.add(object); + + object = new THREE.Mesh(new THREE.IcosahedronGeometry(75), material); + object.position.set(-100, 0, 300); + scene.add(object); + + object = new THREE.Mesh(new THREE.OctahedronGeometry(75), material); + object.position.set(100, 0, 300); + scene.add(object); + + object = new THREE.Mesh(new THREE.TetrahedronGeometry(75), material); + object.position.set(300, 0, 300); + scene.add(object); + + // + + object = new THREE.Mesh(new THREE.PlaneGeometry(100, 100, 4, 4), material); + object.position.set(-300, 0, 100); + scene.add(object); + + object = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100, 4, 4, 4), material); + object.position.set(-100, 0, 100); + scene.add(object); + + object = new THREE.Mesh(new THREE.CircleGeometry(50, 20, 0, Math.PI * 2), material); + object.position.set(100, 0, 100); + scene.add(object); + + object = new THREE.Mesh(new THREE.RingGeometry(10, 50, 20, 5, 0, Math.PI * 2), material); + object.position.set(300, 0, 100); + scene.add(object); + + // + + object = new THREE.Mesh(new THREE.CylinderGeometry(25, 75, 100, 40, 5), material); + object.position.set(-300, 0, -100); + scene.add(object); + + const points = []; + + for (let i = 0; i < 50; i++) { + points.push(new THREE.Vector2(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, (i - 5) * 2)); + } + + object = new THREE.Mesh(new THREE.LatheGeometry(points, 20), material); + object.position.set(-100, 0, -100); + scene.add(object); + + object = new THREE.Mesh(new THREE.TorusGeometry(50, 20, 20, 20), material); + object.position.set(100, 0, -100); + scene.add(object); + + object = new THREE.Mesh(new THREE.TorusKnotGeometry(50, 10, 50, 20), material); + object.position.set(300, 0, -100); + scene.add(object); + + // + + object = new THREE.Mesh(new THREE.CapsuleGeometry(20, 50), material); + object.position.set(-300, 0, -300); + scene.add(object); + + geometry = new ParametricGeometry(plane, 10, 10); + geometry.scale(100, 100, 100); + geometry.center(); + object = new THREE.Mesh(geometry, material); + object.position.set(-100, 0, -300); + scene.add(object); + + geometry = new ParametricGeometry(klein, 20, 20); + object = new THREE.Mesh(geometry, material); + object.position.set(100, 0, -300); + object.scale.multiplyScalar(5); + scene.add(object); + + geometry = new ParametricGeometry(mobius, 20, 20); + object = new THREE.Mesh(geometry, material); + object.position.set(300, 0, -300); + object.scale.multiplyScalar(30); + scene.add(object); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const timer = Date.now() * 0.0001; + + camera.position.x = Math.cos(timer) * 800; + camera.position.z = Math.sin(timer) * 800; + + camera.lookAt(scene.position); + + scene.traverse(function (object) { + if (object.isMesh === true) { + object.rotation.x = timer * 5; + object.rotation.y = timer * 2.5; + } + }); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_colors.ts b/examples-testing/examples/webgl_geometry_colors.ts new file mode 100644 index 000000000..3166c03bc --- /dev/null +++ b/examples-testing/examples/webgl_geometry_colors.ts @@ -0,0 +1,177 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(20, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 1800; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 0, 1); + scene.add(light); + + // shadow + + const canvas = document.createElement('canvas'); + canvas.width = 128; + canvas.height = 128; + + const context = canvas.getContext('2d'); + const gradient = context.createRadialGradient( + canvas.width / 2, + canvas.height / 2, + 0, + canvas.width / 2, + canvas.height / 2, + canvas.width / 2, + ); + gradient.addColorStop(0.1, 'rgba(210,210,210,1)'); + gradient.addColorStop(1, 'rgba(255,255,255,1)'); + + context.fillStyle = gradient; + context.fillRect(0, 0, canvas.width, canvas.height); + + const shadowTexture = new THREE.CanvasTexture(canvas); + + const shadowMaterial = new THREE.MeshBasicMaterial({ map: shadowTexture }); + const shadowGeo = new THREE.PlaneGeometry(300, 300, 1, 1); + + let shadowMesh; + + shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); + shadowMesh.position.y = -250; + shadowMesh.rotation.x = -Math.PI / 2; + scene.add(shadowMesh); + + shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); + shadowMesh.position.y = -250; + shadowMesh.position.x = -400; + shadowMesh.rotation.x = -Math.PI / 2; + scene.add(shadowMesh); + + shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); + shadowMesh.position.y = -250; + shadowMesh.position.x = 400; + shadowMesh.rotation.x = -Math.PI / 2; + scene.add(shadowMesh); + + const radius = 200; + + const geometry1 = new THREE.IcosahedronGeometry(radius, 1); + + const count = geometry1.attributes.position.count; + const arrayType = typeof Float16Array !== 'undefined' ? Float16Array : Float32Array; + geometry1.setAttribute('color', new THREE.BufferAttribute(new arrayType(count * 3), 3)); + + const geometry2 = geometry1.clone(); + const geometry3 = geometry1.clone(); + + const color = new THREE.Color(); + const positions1 = geometry1.attributes.position; + const positions2 = geometry2.attributes.position; + const positions3 = geometry3.attributes.position; + const colors1 = geometry1.attributes.color; + const colors2 = geometry2.attributes.color; + const colors3 = geometry3.attributes.color; + + for (let i = 0; i < count; i++) { + color.setHSL((positions1.getY(i) / radius + 1) / 2, 1.0, 0.5, THREE.SRGBColorSpace); + colors1.setXYZ(i, color.r, color.g, color.b); + + color.setHSL(0, (positions2.getY(i) / radius + 1) / 2, 0.5, THREE.SRGBColorSpace); + colors2.setXYZ(i, color.r, color.g, color.b); + + color.setRGB(1, 0.8 - (positions3.getY(i) / radius + 1) / 2, 0, THREE.SRGBColorSpace); + colors3.setXYZ(i, color.r, color.g, color.b); + } + + const material = new THREE.MeshPhongMaterial({ + color: 0xffffff, + flatShading: true, + vertexColors: true, + shininess: 0, + }); + + const wireframeMaterial = new THREE.MeshBasicMaterial({ color: 0x000000, wireframe: true, transparent: true }); + + let mesh = new THREE.Mesh(geometry1, material); + let wireframe = new THREE.Mesh(geometry1, wireframeMaterial); + mesh.add(wireframe); + mesh.position.x = -400; + mesh.rotation.x = -1.87; + scene.add(mesh); + + mesh = new THREE.Mesh(geometry2, material); + wireframe = new THREE.Mesh(geometry2, wireframeMaterial); + mesh.add(wireframe); + mesh.position.x = 400; + scene.add(mesh); + + mesh = new THREE.Mesh(geometry3, material); + wireframe = new THREE.Mesh(geometry3, wireframeMaterial); + mesh.add(wireframe); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + document.addEventListener('mousemove', onDocumentMouseMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_colors_lookuptable.ts b/examples-testing/examples/webgl_geometry_colors_lookuptable.ts new file mode 100644 index 000000000..6b0138529 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_colors_lookuptable.ts @@ -0,0 +1,148 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Lut } from 'three/addons/math/Lut.js'; + +let container; + +let perpCamera, orthoCamera, renderer, lut; + +let mesh, sprite; +let scene, uiScene; + +let params; + +init(); + +function init() { + container = document.getElementById('container'); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + uiScene = new THREE.Scene(); + + lut = new Lut(); + + const width = window.innerWidth; + const height = window.innerHeight; + + perpCamera = new THREE.PerspectiveCamera(60, width / height, 1, 100); + perpCamera.position.set(0, 0, 10); + scene.add(perpCamera); + + orthoCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 1, 2); + orthoCamera.position.set(0.5, 0, 1); + + sprite = new THREE.Sprite( + new THREE.SpriteMaterial({ + map: new THREE.CanvasTexture(lut.createCanvas()), + }), + ); + sprite.material.map.colorSpace = THREE.SRGBColorSpace; + sprite.scale.x = 0.125; + uiScene.add(sprite); + + mesh = new THREE.Mesh( + undefined, + new THREE.MeshLambertMaterial({ + side: THREE.DoubleSide, + color: 0xf5f5f5, + vertexColors: true, + }), + ); + scene.add(mesh); + + params = { + colorMap: 'rainbow', + }; + loadModel(); + + const pointLight = new THREE.PointLight(0xffffff, 3, 0, 0); + perpCamera.add(pointLight); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.autoClear = false; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + const controls = new OrbitControls(perpCamera, renderer.domElement); + controls.addEventListener('change', render); + + const gui = new GUI(); + + gui.add(params, 'colorMap', ['rainbow', 'cooltowarm', 'blackbody', 'grayscale']).onChange(function () { + updateColors(); + render(); + }); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + perpCamera.aspect = width / height; + perpCamera.updateProjectionMatrix(); + + renderer.setSize(width, height); + render(); +} + +function render() { + renderer.clear(); + renderer.render(scene, perpCamera); + renderer.render(uiScene, orthoCamera); +} + +function loadModel() { + const loader = new THREE.BufferGeometryLoader(); + loader.load('models/json/pressure.json', function (geometry) { + geometry.center(); + geometry.computeVertexNormals(); + + // default color attribute + const colors = []; + + for (let i = 0, n = geometry.attributes.position.count; i < n; ++i) { + colors.push(1, 1, 1); + } + + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + mesh.geometry = geometry; + updateColors(); + + render(); + }); +} + +function updateColors() { + lut.setColorMap(params.colorMap); + + lut.setMax(2000); + lut.setMin(0); + + const geometry = mesh.geometry; + const pressures = geometry.attributes.pressure; + const colors = geometry.attributes.color; + const color = new THREE.Color(); + + for (let i = 0; i < pressures.array.length; i++) { + const colorValue = pressures.array[i]; + + color.copy(lut.getColor(colorValue)).convertSRGBToLinear(); + + colors.setXYZ(i, color.r, color.g, color.b); + } + + colors.needsUpdate = true; + + const map = sprite.material.map; + lut.updateCanvas(map.image); + map.needsUpdate = true; +} diff --git a/examples-testing/examples/webgl_geometry_convex.ts b/examples-testing/examples/webgl_geometry_convex.ts new file mode 100644 index 000000000..09516c070 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_convex.ts @@ -0,0 +1,117 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js'; +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +let group, camera, scene, renderer; + +init(); + +function init() { + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // camera + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(15, 20, 30); + scene.add(camera); + + // controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 20; + controls.maxDistance = 50; + controls.maxPolarAngle = Math.PI / 2; + + // ambient light + + scene.add(new THREE.AmbientLight(0x666666)); + + // point light + + const light = new THREE.PointLight(0xffffff, 3, 0, 0); + camera.add(light); + + // helper + + scene.add(new THREE.AxesHelper(20)); + + // textures + + const loader = new THREE.TextureLoader(); + const texture = loader.load('textures/sprites/disc.png'); + texture.colorSpace = THREE.SRGBColorSpace; + + group = new THREE.Group(); + scene.add(group); + + // points + + let dodecahedronGeometry = new THREE.DodecahedronGeometry(10); + + // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data + + dodecahedronGeometry.deleteAttribute('normal'); + dodecahedronGeometry.deleteAttribute('uv'); + + dodecahedronGeometry = BufferGeometryUtils.mergeVertices(dodecahedronGeometry); + + const vertices = []; + const positionAttribute = dodecahedronGeometry.getAttribute('position'); + + for (let i = 0; i < positionAttribute.count; i++) { + const vertex = new THREE.Vector3(); + vertex.fromBufferAttribute(positionAttribute, i); + vertices.push(vertex); + } + + const pointsMaterial = new THREE.PointsMaterial({ + color: 0x0080ff, + map: texture, + size: 1, + alphaTest: 0.5, + }); + + const pointsGeometry = new THREE.BufferGeometry().setFromPoints(vertices); + + const points = new THREE.Points(pointsGeometry, pointsMaterial); + group.add(points); + + // convex hull + + const meshMaterial = new THREE.MeshLambertMaterial({ + color: 0xffffff, + opacity: 0.5, + side: THREE.DoubleSide, + transparent: true, + }); + + const meshGeometry = new ConvexGeometry(vertices); + + const mesh = new THREE.Mesh(meshGeometry, meshMaterial); + group.add(mesh); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + group.rotation.y += 0.005; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_cube.ts b/examples-testing/examples/webgl_geometry_cube.ts new file mode 100644 index 000000000..572601acb --- /dev/null +++ b/examples-testing/examples/webgl_geometry_cube.ts @@ -0,0 +1,46 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; +let mesh; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 2; + + scene = new THREE.Scene(); + + const texture = new THREE.TextureLoader().load('textures/crate.gif'); + texture.colorSpace = THREE.SRGBColorSpace; + + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshBasicMaterial({ map: texture }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.rotation.x += 0.005; + mesh.rotation.y += 0.01; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_extrude_shapes.ts b/examples-testing/examples/webgl_geometry_extrude_shapes.ts new file mode 100644 index 000000000..dea62d0e6 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_extrude_shapes.ts @@ -0,0 +1,149 @@ +import * as THREE from 'three'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; + +let camera, scene, renderer, controls; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222222); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 500); + + controls = new TrackballControls(camera, renderer.domElement); + controls.minDistance = 200; + controls.maxDistance = 500; + + scene.add(new THREE.AmbientLight(0x666666)); + + const light = new THREE.PointLight(0xffffff, 3, 0, 0); + light.position.copy(camera.position); + scene.add(light); + + // + + const closedSpline = new THREE.CatmullRomCurve3([ + new THREE.Vector3(-60, -100, 60), + new THREE.Vector3(-60, 20, 60), + new THREE.Vector3(-60, 120, 60), + new THREE.Vector3(60, 20, -60), + new THREE.Vector3(60, -100, -60), + ]); + + closedSpline.curveType = 'catmullrom'; + closedSpline.closed = true; + + const extrudeSettings1 = { + steps: 100, + bevelEnabled: false, + extrudePath: closedSpline, + }; + + const pts1 = [], + count = 3; + + for (let i = 0; i < count; i++) { + const l = 20; + + const a = ((2 * i) / count) * Math.PI; + + pts1.push(new THREE.Vector2(Math.cos(a) * l, Math.sin(a) * l)); + } + + const shape1 = new THREE.Shape(pts1); + + const geometry1 = new THREE.ExtrudeGeometry(shape1, extrudeSettings1); + + const material1 = new THREE.MeshLambertMaterial({ color: 0xb00000, wireframe: false }); + + const mesh1 = new THREE.Mesh(geometry1, material1); + + scene.add(mesh1); + + // + + const randomPoints = []; + + for (let i = 0; i < 10; i++) { + randomPoints.push( + new THREE.Vector3((i - 4.5) * 50, THREE.MathUtils.randFloat(-50, 50), THREE.MathUtils.randFloat(-50, 50)), + ); + } + + const randomSpline = new THREE.CatmullRomCurve3(randomPoints); + + // + + const extrudeSettings2 = { + steps: 200, + bevelEnabled: false, + extrudePath: randomSpline, + }; + + const pts2 = [], + numPts = 5; + + for (let i = 0; i < numPts * 2; i++) { + const l = i % 2 == 1 ? 10 : 20; + + const a = (i / numPts) * Math.PI; + + pts2.push(new THREE.Vector2(Math.cos(a) * l, Math.sin(a) * l)); + } + + const shape2 = new THREE.Shape(pts2); + + const geometry2 = new THREE.ExtrudeGeometry(shape2, extrudeSettings2); + + const material2 = new THREE.MeshLambertMaterial({ color: 0xff8000, wireframe: false }); + + const mesh2 = new THREE.Mesh(geometry2, material2); + + scene.add(mesh2); + + // + + const materials = [material1, material2]; + + const extrudeSettings3 = { + depth: 20, + steps: 1, + bevelEnabled: true, + bevelThickness: 2, + bevelSize: 4, + bevelSegments: 1, + }; + + const geometry3 = new THREE.ExtrudeGeometry(shape2, extrudeSettings3); + + const mesh3 = new THREE.Mesh(geometry3, materials); + + mesh3.position.set(50, 100, 50); + + scene.add(mesh3); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_extrude_splines.ts b/examples-testing/examples/webgl_geometry_extrude_splines.ts new file mode 100644 index 000000000..8636812f7 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_extrude_splines.ts @@ -0,0 +1,310 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import * as Curves from 'three/addons/curves/CurveExtras.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container, stats; + +let camera, scene, renderer, splineCamera, cameraHelper, cameraEye; + +const direction = new THREE.Vector3(); +const binormal = new THREE.Vector3(); +const normal = new THREE.Vector3(); +const position = new THREE.Vector3(); +const lookAt = new THREE.Vector3(); + +const pipeSpline = new THREE.CatmullRomCurve3([ + new THREE.Vector3(0, 10, -10), + new THREE.Vector3(10, 0, -10), + new THREE.Vector3(20, 0, 0), + new THREE.Vector3(30, 0, 10), + new THREE.Vector3(30, 0, 20), + new THREE.Vector3(20, 0, 30), + new THREE.Vector3(10, 0, 30), + new THREE.Vector3(0, 0, 30), + new THREE.Vector3(-10, 10, 30), + new THREE.Vector3(-10, 20, 30), + new THREE.Vector3(0, 30, 30), + new THREE.Vector3(10, 30, 30), + new THREE.Vector3(20, 30, 15), + new THREE.Vector3(10, 30, 10), + new THREE.Vector3(0, 30, 10), + new THREE.Vector3(-10, 20, 10), + new THREE.Vector3(-10, 10, 10), + new THREE.Vector3(0, 0, 10), + new THREE.Vector3(10, -10, 10), + new THREE.Vector3(20, -15, 10), + new THREE.Vector3(30, -15, 10), + new THREE.Vector3(40, -15, 10), + new THREE.Vector3(50, -15, 10), + new THREE.Vector3(60, 0, 10), + new THREE.Vector3(70, 0, 0), + new THREE.Vector3(80, 0, 0), + new THREE.Vector3(90, 0, 0), + new THREE.Vector3(100, 0, 0), +]); + +const sampleClosedSpline = new THREE.CatmullRomCurve3([ + new THREE.Vector3(0, -40, -40), + new THREE.Vector3(0, 40, -40), + new THREE.Vector3(0, 140, -40), + new THREE.Vector3(0, 40, 40), + new THREE.Vector3(0, -40, 40), +]); + +sampleClosedSpline.curveType = 'catmullrom'; +sampleClosedSpline.closed = true; + +// Keep a dictionary of Curve instances +const splines = { + GrannyKnot: new Curves.GrannyKnot(), + HeartCurve: new Curves.HeartCurve(3.5), + VivianiCurve: new Curves.VivianiCurve(70), + KnotCurve: new Curves.KnotCurve(), + HelixCurve: new Curves.HelixCurve(), + TrefoilKnot: new Curves.TrefoilKnot(), + TorusKnot: new Curves.TorusKnot(20), + CinquefoilKnot: new Curves.CinquefoilKnot(20), + TrefoilPolynomialKnot: new Curves.TrefoilPolynomialKnot(14), + FigureEightPolynomialKnot: new Curves.FigureEightPolynomialKnot(), + DecoratedTorusKnot4a: new Curves.DecoratedTorusKnot4a(), + DecoratedTorusKnot4b: new Curves.DecoratedTorusKnot4b(), + DecoratedTorusKnot5a: new Curves.DecoratedTorusKnot5a(), + DecoratedTorusKnot5c: new Curves.DecoratedTorusKnot5c(), + PipeSpline: pipeSpline, + SampleClosedSpline: sampleClosedSpline, +}; + +let parent, tubeGeometry, mesh; + +const params = { + spline: 'GrannyKnot', + scale: 4, + extrusionSegments: 100, + radiusSegments: 3, + closed: true, + animationView: false, + lookAhead: false, + cameraHelper: false, +}; + +const material = new THREE.MeshLambertMaterial({ color: 0xff00ff }); + +const wireframeMaterial = new THREE.MeshBasicMaterial({ + color: 0x000000, + opacity: 0.3, + wireframe: true, + transparent: true, +}); + +function addTube() { + if (mesh !== undefined) { + parent.remove(mesh); + mesh.geometry.dispose(); + } + + const extrudePath = splines[params.spline]; + + tubeGeometry = new THREE.TubeGeometry( + extrudePath, + params.extrusionSegments, + 2, + params.radiusSegments, + params.closed, + ); + + addGeometry(tubeGeometry); + + setScale(); +} + +function setScale() { + mesh.scale.set(params.scale, params.scale, params.scale); +} + +function addGeometry(geometry) { + // 3D shape + + mesh = new THREE.Mesh(geometry, material); + const wireframe = new THREE.Mesh(geometry, wireframeMaterial); + mesh.add(wireframe); + + parent.add(mesh); +} + +function animateCamera() { + cameraHelper.visible = params.cameraHelper; + cameraEye.visible = params.cameraHelper; +} + +init(); + +function init() { + container = document.getElementById('container'); + + // camera + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 10000); + camera.position.set(0, 50, 500); + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + // light + + scene.add(new THREE.AmbientLight(0xffffff)); + + const light = new THREE.DirectionalLight(0xffffff, 1.5); + light.position.set(0, 0, 1); + scene.add(light); + + // tube + + parent = new THREE.Object3D(); + scene.add(parent); + + splineCamera = new THREE.PerspectiveCamera(84, window.innerWidth / window.innerHeight, 0.01, 1000); + parent.add(splineCamera); + + cameraHelper = new THREE.CameraHelper(splineCamera); + scene.add(cameraHelper); + + addTube(); + + // debug camera + + cameraEye = new THREE.Mesh(new THREE.SphereGeometry(5), new THREE.MeshBasicMaterial({ color: 0xdddddd })); + parent.add(cameraEye); + + cameraHelper.visible = params.cameraHelper; + cameraEye.visible = params.cameraHelper; + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // stats + + stats = new Stats(); + container.appendChild(stats.dom); + + // dat.GUI + + const gui = new GUI({ width: 285 }); + + const folderGeometry = gui.addFolder('Geometry'); + folderGeometry.add(params, 'spline', Object.keys(splines)).onChange(function () { + addTube(); + }); + folderGeometry + .add(params, 'scale', 2, 10) + .step(2) + .onChange(function () { + setScale(); + }); + folderGeometry + .add(params, 'extrusionSegments', 50, 500) + .step(50) + .onChange(function () { + addTube(); + }); + folderGeometry + .add(params, 'radiusSegments', 2, 12) + .step(1) + .onChange(function () { + addTube(); + }); + folderGeometry.add(params, 'closed').onChange(function () { + addTube(); + }); + folderGeometry.open(); + + const folderCamera = gui.addFolder('Camera'); + folderCamera.add(params, 'animationView').onChange(function () { + animateCamera(); + }); + folderCamera.add(params, 'lookAhead').onChange(function () { + animateCamera(); + }); + folderCamera.add(params, 'cameraHelper').onChange(function () { + animateCamera(); + }); + folderCamera.open(); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 100; + controls.maxDistance = 2000; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + // animate camera along spline + + const time = Date.now(); + const looptime = 20 * 1000; + const t = (time % looptime) / looptime; + + tubeGeometry.parameters.path.getPointAt(t, position); + position.multiplyScalar(params.scale); + + // interpolation + + const segments = tubeGeometry.tangents.length; + const pickt = t * segments; + const pick = Math.floor(pickt); + const pickNext = (pick + 1) % segments; + + binormal.subVectors(tubeGeometry.binormals[pickNext], tubeGeometry.binormals[pick]); + binormal.multiplyScalar(pickt - pick).add(tubeGeometry.binormals[pick]); + + tubeGeometry.parameters.path.getTangentAt(t, direction); + const offset = 15; + + normal.copy(binormal).cross(direction); + + // we move on a offset on its binormal + + position.add(normal.clone().multiplyScalar(offset)); + + splineCamera.position.copy(position); + cameraEye.position.copy(position); + + // using arclength for stabilization in look ahead + + tubeGeometry.parameters.path.getPointAt((t + 30 / tubeGeometry.parameters.path.getLength()) % 1, lookAt); + lookAt.multiplyScalar(params.scale); + + // camera orientation 2 - up orientation via normal + + if (!params.lookAhead) lookAt.copy(position).add(direction); + splineCamera.matrix.lookAt(splineCamera.position, lookAt, normal); + splineCamera.quaternion.setFromRotationMatrix(splineCamera.matrix); + + cameraHelper.update(); + + renderer.render(scene, params.animationView === true ? splineCamera : camera); +} diff --git a/examples-testing/examples/webgl_geometry_minecraft.ts b/examples-testing/examples/webgl_geometry_minecraft.ts new file mode 100644 index 000000000..220156552 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_minecraft.ts @@ -0,0 +1,184 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +let container, stats; + +let camera, controls, scene, renderer; + +const worldWidth = 128, + worldDepth = 128; +const worldHalfWidth = worldWidth / 2; +const worldHalfDepth = worldDepth / 2; +const data = generateHeight(worldWidth, worldDepth); + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 20000); + camera.position.y = getY(worldHalfWidth, worldHalfDepth) * 100 + 100; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfd1e5); + + // sides + + const matrix = new THREE.Matrix4(); + + const pxGeometry = new THREE.PlaneGeometry(100, 100); + pxGeometry.attributes.uv.array[1] = 0.5; + pxGeometry.attributes.uv.array[3] = 0.5; + pxGeometry.rotateY(Math.PI / 2); + pxGeometry.translate(50, 0, 0); + + const nxGeometry = new THREE.PlaneGeometry(100, 100); + nxGeometry.attributes.uv.array[1] = 0.5; + nxGeometry.attributes.uv.array[3] = 0.5; + nxGeometry.rotateY(-Math.PI / 2); + nxGeometry.translate(-50, 0, 0); + + const pyGeometry = new THREE.PlaneGeometry(100, 100); + pyGeometry.attributes.uv.array[5] = 0.5; + pyGeometry.attributes.uv.array[7] = 0.5; + pyGeometry.rotateX(-Math.PI / 2); + pyGeometry.translate(0, 50, 0); + + const pzGeometry = new THREE.PlaneGeometry(100, 100); + pzGeometry.attributes.uv.array[1] = 0.5; + pzGeometry.attributes.uv.array[3] = 0.5; + pzGeometry.translate(0, 0, 50); + + const nzGeometry = new THREE.PlaneGeometry(100, 100); + nzGeometry.attributes.uv.array[1] = 0.5; + nzGeometry.attributes.uv.array[3] = 0.5; + nzGeometry.rotateY(Math.PI); + nzGeometry.translate(0, 0, -50); + + // + + const geometries = []; + + for (let z = 0; z < worldDepth; z++) { + for (let x = 0; x < worldWidth; x++) { + const h = getY(x, z); + + matrix.makeTranslation(x * 100 - worldHalfWidth * 100, h * 100, z * 100 - worldHalfDepth * 100); + + const px = getY(x + 1, z); + const nx = getY(x - 1, z); + const pz = getY(x, z + 1); + const nz = getY(x, z - 1); + + geometries.push(pyGeometry.clone().applyMatrix4(matrix)); + + if ((px !== h && px !== h + 1) || x === 0) { + geometries.push(pxGeometry.clone().applyMatrix4(matrix)); + } + + if ((nx !== h && nx !== h + 1) || x === worldWidth - 1) { + geometries.push(nxGeometry.clone().applyMatrix4(matrix)); + } + + if ((pz !== h && pz !== h + 1) || z === worldDepth - 1) { + geometries.push(pzGeometry.clone().applyMatrix4(matrix)); + } + + if ((nz !== h && nz !== h + 1) || z === 0) { + geometries.push(nzGeometry.clone().applyMatrix4(matrix)); + } + } + } + + const geometry = BufferGeometryUtils.mergeGeometries(geometries); + geometry.computeBoundingSphere(); + + const texture = new THREE.TextureLoader().load('textures/minecraft/atlas.png'); + texture.colorSpace = THREE.SRGBColorSpace; + texture.magFilter = THREE.NearestFilter; + + const mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ map: texture, side: THREE.DoubleSide })); + scene.add(mesh); + + const ambientLight = new THREE.AmbientLight(0xeeeeee, 3); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 12); + directionalLight.position.set(1, 1, 0.5).normalize(); + scene.add(directionalLight); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + controls = new FirstPersonControls(camera, renderer.domElement); + + controls.movementSpeed = 1000; + controls.lookSpeed = 0.125; + controls.lookVertical = true; + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function generateHeight(width, height) { + const data = [], + perlin = new ImprovedNoise(), + size = width * height, + z = Math.random() * 100; + + let quality = 2; + + for (let j = 0; j < 4; j++) { + if (j === 0) for (let i = 0; i < size; i++) data[i] = 0; + + for (let i = 0; i < size; i++) { + const x = i % width, + y = (i / width) | 0; + data[i] += perlin.noise(x / quality, y / quality, z) * quality; + } + + quality *= 4; + } + + return data; +} + +function getY(x, z) { + return (data[x + z * worldWidth] * 0.15) | 0; +} + +// + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + controls.update(timer.getDelta()); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_nurbs.ts b/examples-testing/examples/webgl_geometry_nurbs.ts new file mode 100644 index 000000000..ecd79c67e --- /dev/null +++ b/examples-testing/examples/webgl_geometry_nurbs.ts @@ -0,0 +1,298 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js'; +import { NURBSSurface } from 'three/addons/curves/NURBSSurface.js'; +import { NURBSVolume } from 'three/addons/curves/NURBSVolume.js'; +import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; + +let container, stats; + +let camera, scene, renderer; +let group; + +let targetRotation = 0; +let targetRotationOnPointerDown = 0; + +let pointerX = 0; +let pointerXOnPointerDown = 0; + +let windowHalfX = window.innerWidth / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(0, 150, 750); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + scene.add(new THREE.AmbientLight(0xffffff)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1); + scene.add(light); + + group = new THREE.Group(); + group.position.y = 50; + scene.add(group); + + // NURBS curve + + const nurbsControlPoints = []; + const nurbsKnots = []; + const nurbsDegree = 3; + + for (let i = 0; i <= nurbsDegree; i++) { + nurbsKnots.push(0); + } + + for (let i = 0, j = 20; i < j; i++) { + nurbsControlPoints.push( + new THREE.Vector4( + Math.random() * 400 - 200, + Math.random() * 400, + Math.random() * 400 - 200, + 1, // weight of control point: higher means stronger attraction + ), + ); + + const knot = (i + 1) / (j - nurbsDegree); + nurbsKnots.push(THREE.MathUtils.clamp(knot, 0, 1)); + } + + const nurbsCurve = new NURBSCurve(nurbsDegree, nurbsKnots, nurbsControlPoints); + + const nurbsGeometry = new THREE.BufferGeometry(); + nurbsGeometry.setFromPoints(nurbsCurve.getPoints(200)); + + const nurbsMaterial = new THREE.LineBasicMaterial({ color: 0x333333 }); + + const nurbsLine = new THREE.Line(nurbsGeometry, nurbsMaterial); + nurbsLine.position.set(0, -100, 0); + group.add(nurbsLine); + + const nurbsControlPointsGeometry = new THREE.BufferGeometry(); + nurbsControlPointsGeometry.setFromPoints(nurbsCurve.controlPoints); + + const nurbsControlPointsMaterial = new THREE.LineBasicMaterial({ + color: 0x333333, + opacity: 0.25, + transparent: true, + }); + + const nurbsControlPointsLine = new THREE.Line(nurbsControlPointsGeometry, nurbsControlPointsMaterial); + nurbsControlPointsLine.position.copy(nurbsLine.position); + group.add(nurbsControlPointsLine); + + // NURBS surface + { + const nsControlPoints = [ + [ + new THREE.Vector4(-200, -200, 100, 1), + new THREE.Vector4(-200, -100, -200, 1), + new THREE.Vector4(-200, 100, 250, 1), + new THREE.Vector4(-200, 200, -100, 1), + ], + [ + new THREE.Vector4(0, -200, 0, 1), + new THREE.Vector4(0, -100, -100, 5), + new THREE.Vector4(0, 100, 150, 5), + new THREE.Vector4(0, 200, 0, 1), + ], + [ + new THREE.Vector4(200, -200, -100, 1), + new THREE.Vector4(200, -100, 200, 1), + new THREE.Vector4(200, 100, -250, 1), + new THREE.Vector4(200, 200, 100, 1), + ], + ]; + const degree1 = 2; + const degree2 = 3; + const knots1 = [0, 0, 0, 1, 1, 1]; + const knots2 = [0, 0, 0, 0, 1, 1, 1, 1]; + const nurbsSurface = new NURBSSurface(degree1, degree2, knots1, knots2, nsControlPoints); + + const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); + map.wrapS = map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 16; + map.colorSpace = THREE.SRGBColorSpace; + + function getSurfacePoint(u, v, target) { + return nurbsSurface.getPoint(u, v, target); + } + + const geometry = new ParametricGeometry(getSurfacePoint, 20, 20); + const material = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); + const object = new THREE.Mesh(geometry, material); + object.position.set(-400, 100, 0); + object.scale.multiplyScalar(1); + group.add(object); + } + + // NURBS volume + { + const nsControlPoints = [ + [ + [new THREE.Vector4(-200, -200, -200, 1), new THREE.Vector4(-200, -200, 200, 1)], + [new THREE.Vector4(-200, -100, -200, 1), new THREE.Vector4(-200, -100, 200, 1)], + [new THREE.Vector4(-200, 100, -200, 1), new THREE.Vector4(-200, 100, 200, 1)], + [new THREE.Vector4(-200, 200, -200, 1), new THREE.Vector4(-200, 200, 200, 1)], + ], + [ + [new THREE.Vector4(0, -200, -200, 1), new THREE.Vector4(0, -200, 200, 1)], + [new THREE.Vector4(0, -100, -200, 1), new THREE.Vector4(0, -100, 200, 1)], + [new THREE.Vector4(0, 100, -200, 1), new THREE.Vector4(0, 100, 200, 1)], + [new THREE.Vector4(0, 200, -200, 1), new THREE.Vector4(0, 200, 200, 1)], + ], + [ + [new THREE.Vector4(200, -200, -200, 1), new THREE.Vector4(200, -200, 200, 1)], + [new THREE.Vector4(200, -100, 0, 1), new THREE.Vector4(200, -100, 100, 1)], + [new THREE.Vector4(200, 100, 0, 1), new THREE.Vector4(200, 100, 100, 1)], + [new THREE.Vector4(200, 200, 0, 1), new THREE.Vector4(200, 200, 100, 1)], + ], + ]; + const degree1 = 2; + const degree2 = 3; + const degree3 = 1; + const knots1 = [0, 0, 0, 1, 1, 1]; + const knots2 = [0, 0, 0, 0, 1, 1, 1, 1]; + const knots3 = [0, 0, 1, 1]; + const nurbsVolume = new NURBSVolume(degree1, degree2, degree3, knots1, knots2, knots3, nsControlPoints); + + const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); + map.wrapS = map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 16; + map.colorSpace = THREE.SRGBColorSpace; + + // Since ParametricGeometry() only support bi-variate parametric geometries + // we create evaluation functions for different surfaces with one of the three + // parameter values (u, v, w) kept constant and create multiple THREE.Mesh + // objects one for each surface + function getSurfacePointFront(u, v, target) { + return nurbsVolume.getPoint(u, v, 0, target); + } + + function getSurfacePointMiddle(u, v, target) { + return nurbsVolume.getPoint(u, v, 0.5, target); + } + + function getSurfacePointBack(u, v, target) { + return nurbsVolume.getPoint(u, v, 1, target); + } + + function getSurfacePointTop(u, w, target) { + return nurbsVolume.getPoint(u, 1, w, target); + } + + function getSurfacePointSide(v, w, target) { + return nurbsVolume.getPoint(0, v, w, target); + } + + const geometryFront = new ParametricGeometry(getSurfacePointFront, 20, 20); + const materialFront = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); + const objectFront = new THREE.Mesh(geometryFront, materialFront); + objectFront.position.set(400, 100, 0); + objectFront.scale.multiplyScalar(0.5); + group.add(objectFront); + + const geometryMiddle = new ParametricGeometry(getSurfacePointMiddle, 20, 20); + const materialMiddle = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); + const objectMiddle = new THREE.Mesh(geometryMiddle, materialMiddle); + objectMiddle.position.set(400, 100, 0); + objectMiddle.scale.multiplyScalar(0.5); + group.add(objectMiddle); + + const geometryBack = new ParametricGeometry(getSurfacePointBack, 20, 20); + const materialBack = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); + const objectBack = new THREE.Mesh(geometryBack, materialBack); + objectBack.position.set(400, 100, 0); + objectBack.scale.multiplyScalar(0.5); + group.add(objectBack); + + const geometryTop = new ParametricGeometry(getSurfacePointTop, 20, 20); + const materialTop = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); + const objectTop = new THREE.Mesh(geometryTop, materialTop); + objectTop.position.set(400, 100, 0); + objectTop.scale.multiplyScalar(0.5); + group.add(objectTop); + + const geometrySide = new ParametricGeometry(getSurfacePointSide, 20, 20); + const materialSide = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); + const objectSide = new THREE.Mesh(geometrySide, materialSide); + objectSide.position.set(400, 100, 0); + objectSide.scale.multiplyScalar(0.5); + group.add(objectSide); + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + container.style.touchAction = 'none'; + container.addEventListener('pointerdown', onPointerDown); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function onPointerDown(event) { + if (event.isPrimary === false) return; + + pointerXOnPointerDown = event.clientX - windowHalfX; + targetRotationOnPointerDown = targetRotation; + + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerup', onPointerUp); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + pointerX = event.clientX - windowHalfX; + + targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; +} + +function onPointerUp(event) { + if (event.isPrimary === false) return; + + document.removeEventListener('pointermove', onPointerMove); + document.removeEventListener('pointerup', onPointerUp); +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + group.rotation.y += (targetRotation - group.rotation.y) * 0.05; + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_shapes.ts b/examples-testing/examples/webgl_geometry_shapes.ts new file mode 100644 index 000000000..0c25d8855 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_shapes.ts @@ -0,0 +1,363 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let group; + +let targetRotation = 0; +let targetRotationOnPointerDown = 0; + +let pointerX = 0; +let pointerXOnPointerDown = 0; + +let windowHalfX = window.innerWidth / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 150, 500); + scene.add(camera); + + const light = new THREE.PointLight(0xffffff, 2.5, 0, 0); + camera.add(light); + + group = new THREE.Group(); + group.position.y = 50; + scene.add(group); + + const loader = new THREE.TextureLoader(); + const texture = loader.load('textures/uv_grid_opengl.jpg'); + texture.colorSpace = THREE.SRGBColorSpace; + + // it's necessary to apply these settings in order to correctly display the texture on a shape geometry + + texture.wrapS = texture.wrapT = THREE.RepeatWrapping; + texture.repeat.set(0.008, 0.008); + + function addShape(shape, extrudeSettings, color, x, y, z, rx, ry, rz, s) { + // flat shape with texture + // note: default UVs generated by THREE.ShapeGeometry are simply the x- and y-coordinates of the vertices + + let geometry = new THREE.ShapeGeometry(shape); + + let mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({ side: THREE.DoubleSide, map: texture })); + mesh.position.set(x, y, z - 175); + mesh.rotation.set(rx, ry, rz); + mesh.scale.set(s, s, s); + group.add(mesh); + + // flat shape + + geometry = new THREE.ShapeGeometry(shape); + + mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({ color: color, side: THREE.DoubleSide })); + mesh.position.set(x, y, z - 125); + mesh.rotation.set(rx, ry, rz); + mesh.scale.set(s, s, s); + group.add(mesh); + + // extruded shape + + geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings); + + mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({ color: color })); + mesh.position.set(x, y, z - 75); + mesh.rotation.set(rx, ry, rz); + mesh.scale.set(s, s, s); + group.add(mesh); + + addLineShape(shape, color, x, y, z, rx, ry, rz, s); + } + + function addLineShape(shape, color, x, y, z, rx, ry, rz, s) { + // lines + + shape.autoClose = true; + + const points = shape.getPoints(); + const spacedPoints = shape.getSpacedPoints(50); + + const geometryPoints = new THREE.BufferGeometry().setFromPoints(points); + const geometrySpacedPoints = new THREE.BufferGeometry().setFromPoints(spacedPoints); + + // solid line + + let line = new THREE.Line(geometryPoints, new THREE.LineBasicMaterial({ color: color })); + line.position.set(x, y, z - 25); + line.rotation.set(rx, ry, rz); + line.scale.set(s, s, s); + group.add(line); + + // line from equidistance sampled points + + line = new THREE.Line(geometrySpacedPoints, new THREE.LineBasicMaterial({ color: color })); + line.position.set(x, y, z + 25); + line.rotation.set(rx, ry, rz); + line.scale.set(s, s, s); + group.add(line); + + // vertices from real points + + let particles = new THREE.Points(geometryPoints, new THREE.PointsMaterial({ color: color, size: 4 })); + particles.position.set(x, y, z + 75); + particles.rotation.set(rx, ry, rz); + particles.scale.set(s, s, s); + group.add(particles); + + // equidistance sampled points + + particles = new THREE.Points(geometrySpacedPoints, new THREE.PointsMaterial({ color: color, size: 4 })); + particles.position.set(x, y, z + 125); + particles.rotation.set(rx, ry, rz); + particles.scale.set(s, s, s); + group.add(particles); + } + + // California + + const californiaPts = []; + + californiaPts.push(new THREE.Vector2(610, 320)); + californiaPts.push(new THREE.Vector2(450, 300)); + californiaPts.push(new THREE.Vector2(392, 392)); + californiaPts.push(new THREE.Vector2(266, 438)); + californiaPts.push(new THREE.Vector2(190, 570)); + californiaPts.push(new THREE.Vector2(190, 600)); + californiaPts.push(new THREE.Vector2(160, 620)); + californiaPts.push(new THREE.Vector2(160, 650)); + californiaPts.push(new THREE.Vector2(180, 640)); + californiaPts.push(new THREE.Vector2(165, 680)); + californiaPts.push(new THREE.Vector2(150, 670)); + californiaPts.push(new THREE.Vector2(90, 737)); + californiaPts.push(new THREE.Vector2(80, 795)); + californiaPts.push(new THREE.Vector2(50, 835)); + californiaPts.push(new THREE.Vector2(64, 870)); + californiaPts.push(new THREE.Vector2(60, 945)); + californiaPts.push(new THREE.Vector2(300, 945)); + californiaPts.push(new THREE.Vector2(300, 743)); + californiaPts.push(new THREE.Vector2(600, 473)); + californiaPts.push(new THREE.Vector2(626, 425)); + californiaPts.push(new THREE.Vector2(600, 370)); + californiaPts.push(new THREE.Vector2(610, 320)); + + for (let i = 0; i < californiaPts.length; i++) californiaPts[i].multiplyScalar(0.25); + + const californiaShape = new THREE.Shape(californiaPts); + + // Triangle + + const triangleShape = new THREE.Shape().moveTo(80, 20).lineTo(40, 80).lineTo(120, 80).lineTo(80, 20); // close path + + // Heart + + const x = 0, + y = 0; + + const heartShape = new THREE.Shape() + .moveTo(x + 25, y + 25) + .bezierCurveTo(x + 25, y + 25, x + 20, y, x, y) + .bezierCurveTo(x - 30, y, x - 30, y + 35, x - 30, y + 35) + .bezierCurveTo(x - 30, y + 55, x - 10, y + 77, x + 25, y + 95) + .bezierCurveTo(x + 60, y + 77, x + 80, y + 55, x + 80, y + 35) + .bezierCurveTo(x + 80, y + 35, x + 80, y, x + 50, y) + .bezierCurveTo(x + 35, y, x + 25, y + 25, x + 25, y + 25); + + // Square + + const sqLength = 80; + + const squareShape = new THREE.Shape() + .moveTo(0, 0) + .lineTo(0, sqLength) + .lineTo(sqLength, sqLength) + .lineTo(sqLength, 0) + .lineTo(0, 0); + + // Rounded rectangle + + const roundedRectShape = new THREE.Shape(); + + (function roundedRect(ctx, x, y, width, height, radius) { + ctx.moveTo(x, y + radius); + ctx.lineTo(x, y + height - radius); + ctx.quadraticCurveTo(x, y + height, x + radius, y + height); + ctx.lineTo(x + width - radius, y + height); + ctx.quadraticCurveTo(x + width, y + height, x + width, y + height - radius); + ctx.lineTo(x + width, y + radius); + ctx.quadraticCurveTo(x + width, y, x + width - radius, y); + ctx.lineTo(x + radius, y); + ctx.quadraticCurveTo(x, y, x, y + radius); + })(roundedRectShape, 0, 0, 50, 50, 20); + + // Track + + const trackShape = new THREE.Shape() + .moveTo(40, 40) + .lineTo(40, 160) + .absarc(60, 160, 20, Math.PI, 0, true) + .lineTo(80, 40) + .absarc(60, 40, 20, 2 * Math.PI, Math.PI, true); + + // Circle + + const circleRadius = 40; + const circleShape = new THREE.Shape() + .moveTo(0, circleRadius) + .quadraticCurveTo(circleRadius, circleRadius, circleRadius, 0) + .quadraticCurveTo(circleRadius, -circleRadius, 0, -circleRadius) + .quadraticCurveTo(-circleRadius, -circleRadius, -circleRadius, 0) + .quadraticCurveTo(-circleRadius, circleRadius, 0, circleRadius); + + // Fish + + const fishShape = new THREE.Shape() + .moveTo(x, y) + .quadraticCurveTo(x + 50, y - 80, x + 90, y - 10) + .quadraticCurveTo(x + 100, y - 10, x + 115, y - 40) + .quadraticCurveTo(x + 115, y, x + 115, y + 40) + .quadraticCurveTo(x + 100, y + 10, x + 90, y + 10) + .quadraticCurveTo(x + 50, y + 80, x, y); + + // Arc circle + + const arcShape = new THREE.Shape().moveTo(50, 10).absarc(10, 10, 40, 0, Math.PI * 2, false); + + const holePath = new THREE.Path().moveTo(20, 10).absarc(10, 10, 10, 0, Math.PI * 2, true); + + arcShape.holes.push(holePath); + + // Smiley + + const smileyShape = new THREE.Shape().moveTo(80, 40).absarc(40, 40, 40, 0, Math.PI * 2, false); + + const smileyEye1Path = new THREE.Path().moveTo(35, 20).absellipse(25, 20, 10, 10, 0, Math.PI * 2, true); + + const smileyEye2Path = new THREE.Path().moveTo(65, 20).absarc(55, 20, 10, 0, Math.PI * 2, true); + + const smileyMouthPath = new THREE.Path() + .moveTo(20, 40) + .quadraticCurveTo(40, 60, 60, 40) + .bezierCurveTo(70, 45, 70, 50, 60, 60) + .quadraticCurveTo(40, 80, 20, 60) + .quadraticCurveTo(5, 50, 20, 40); + + smileyShape.holes.push(smileyEye1Path); + smileyShape.holes.push(smileyEye2Path); + smileyShape.holes.push(smileyMouthPath); + + // Spline shape + + const splinepts = []; + splinepts.push(new THREE.Vector2(70, 20)); + splinepts.push(new THREE.Vector2(80, 90)); + splinepts.push(new THREE.Vector2(-30, 70)); + splinepts.push(new THREE.Vector2(0, 0)); + + const splineShape = new THREE.Shape().moveTo(0, 0).splineThru(splinepts); + + const extrudeSettings = { + depth: 8, + bevelEnabled: true, + bevelSegments: 2, + steps: 2, + bevelSize: 1, + bevelThickness: 1, + }; + + // addShape( shape, color, x, y, z, rx, ry,rz, s ); + + addShape(californiaShape, extrudeSettings, 0xf08000, -300, -100, 0, 0, 0, 0, 1); + addShape(triangleShape, extrudeSettings, 0x8080f0, -180, 0, 0, 0, 0, 0, 1); + addShape(roundedRectShape, extrudeSettings, 0x008000, -150, 150, 0, 0, 0, 0, 1); + addShape(trackShape, extrudeSettings, 0x008080, 200, -100, 0, 0, 0, 0, 1); + addShape(squareShape, extrudeSettings, 0x0040f0, 150, 100, 0, 0, 0, 0, 1); + addShape(heartShape, extrudeSettings, 0xf00000, 60, 100, 0, 0, 0, Math.PI, 1); + addShape(circleShape, extrudeSettings, 0x00f000, 120, 250, 0, 0, 0, 0, 1); + addShape(fishShape, extrudeSettings, 0x404040, -60, 200, 0, 0, 0, 0, 1); + addShape(smileyShape, extrudeSettings, 0xf000f0, -200, 250, 0, 0, 0, Math.PI, 1); + addShape(arcShape, extrudeSettings, 0x804000, 150, 0, 0, 0, 0, 0, 1); + addShape(splineShape, extrudeSettings, 0x808080, -50, -100, 0, 0, 0, 0, 1); + + addLineShape(arcShape.holes[0], 0x804000, 150, 0, 0, 0, 0, 0, 1); + + for (let i = 0; i < smileyShape.holes.length; i += 1) { + addLineShape(smileyShape.holes[i], 0xf000f0, -200, 250, 0, 0, 0, Math.PI, 1); + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + container.style.touchAction = 'none'; + container.addEventListener('pointerdown', onPointerDown); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function onPointerDown(event) { + if (event.isPrimary === false) return; + + pointerXOnPointerDown = event.clientX - windowHalfX; + targetRotationOnPointerDown = targetRotation; + + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerup', onPointerUp); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + pointerX = event.clientX - windowHalfX; + + targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; +} + +function onPointerUp(event) { + if (event.isPrimary === false) return; + + document.removeEventListener('pointermove', onPointerMove); + document.removeEventListener('pointerup', onPointerUp); +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + group.rotation.y += (targetRotation - group.rotation.y) * 0.05; + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_teapot.ts b/examples-testing/examples/webgl_geometry_teapot.ts new file mode 100644 index 000000000..2516d660c --- /dev/null +++ b/examples-testing/examples/webgl_geometry_teapot.ts @@ -0,0 +1,185 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + +let camera, scene, renderer; +let cameraControls; +let effectController; +const teapotSize = 300; +let ambientLight, light; + +let tess = -1; // force initialization +let bBottom; +let bLid; +let bBody; +let bFitLid; +let bNonBlinn; +let shading; + +let teapot, textureCube; +const materials = {}; + +init(); +render(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + const canvasWidth = window.innerWidth; + const canvasHeight = window.innerHeight; + + // CAMERA + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 80000); + camera.position.set(-600, 550, 1300); + + // LIGHTS + ambientLight = new THREE.AmbientLight(0x7c7c7c, 2.0); + + light = new THREE.DirectionalLight(0xffffff, 2.0); + light.position.set(0.32, 0.39, 0.7); + + // RENDERER + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(canvasWidth, canvasHeight); + container.appendChild(renderer.domElement); + + // EVENTS + window.addEventListener('resize', onWindowResize); + + // CONTROLS + cameraControls = new OrbitControls(camera, renderer.domElement); + cameraControls.addEventListener('change', render); + + // TEXTURE MAP + const textureMap = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); + textureMap.wrapS = textureMap.wrapT = THREE.RepeatWrapping; + textureMap.anisotropy = 16; + textureMap.colorSpace = THREE.SRGBColorSpace; + + // REFLECTION MAP + const path = 'textures/cube/pisa/'; + const urls = ['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']; + + textureCube = new THREE.CubeTextureLoader().setPath(path).load(urls); + + materials['wireframe'] = new THREE.MeshBasicMaterial({ wireframe: true }); + materials['flat'] = new THREE.MeshPhongMaterial({ specular: 0x000000, flatShading: true, side: THREE.DoubleSide }); + materials['smooth'] = new THREE.MeshLambertMaterial({ side: THREE.DoubleSide }); + materials['glossy'] = new THREE.MeshPhongMaterial({ + color: 0xc0c0c0, + specular: 0x404040, + shininess: 300, + side: THREE.DoubleSide, + }); + materials['textured'] = new THREE.MeshPhongMaterial({ map: textureMap, side: THREE.DoubleSide }); + materials['reflective'] = new THREE.MeshPhongMaterial({ envMap: textureCube, side: THREE.DoubleSide }); + + // scene itself + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xaaaaaa); + + scene.add(ambientLight); + scene.add(light); + + // GUI + setupGui(); +} + +// EVENT HANDLERS + +function onWindowResize() { + const canvasWidth = window.innerWidth; + const canvasHeight = window.innerHeight; + + renderer.setSize(canvasWidth, canvasHeight); + + camera.aspect = canvasWidth / canvasHeight; + camera.updateProjectionMatrix(); + + render(); +} + +function setupGui() { + effectController = { + newTess: 15, + bottom: true, + lid: true, + body: true, + fitLid: false, + nonblinn: false, + newShading: 'glossy', + }; + + const gui = new GUI(); + gui.add(effectController, 'newTess', [2, 3, 4, 5, 6, 8, 10, 15, 20, 30, 40, 50]) + .name('Tessellation Level') + .onChange(render); + gui.add(effectController, 'lid').name('display lid').onChange(render); + gui.add(effectController, 'body').name('display body').onChange(render); + gui.add(effectController, 'bottom').name('display bottom').onChange(render); + gui.add(effectController, 'fitLid').name('snug lid').onChange(render); + gui.add(effectController, 'nonblinn').name('original scale').onChange(render); + gui.add(effectController, 'newShading', ['wireframe', 'flat', 'smooth', 'glossy', 'textured', 'reflective']) + .name('Shading') + .onChange(render); +} + +// + +function render() { + if ( + effectController.newTess !== tess || + effectController.bottom !== bBottom || + effectController.lid !== bLid || + effectController.body !== bBody || + effectController.fitLid !== bFitLid || + effectController.nonblinn !== bNonBlinn || + effectController.newShading !== shading + ) { + tess = effectController.newTess; + bBottom = effectController.bottom; + bLid = effectController.lid; + bBody = effectController.body; + bFitLid = effectController.fitLid; + bNonBlinn = effectController.nonblinn; + shading = effectController.newShading; + + createNewTeapot(); + } + + // skybox is rendered separately, so that it is always behind the teapot. + if (shading === 'reflective') { + scene.background = textureCube; + } else { + scene.background = null; + } + + renderer.render(scene, camera); +} + +// Whenever the teapot changes, the scene is rebuilt from scratch (not much to it). +function createNewTeapot() { + if (teapot !== undefined) { + teapot.geometry.dispose(); + scene.remove(teapot); + } + + const geometry = new TeapotGeometry( + teapotSize, + tess, + effectController.bottom, + effectController.lid, + effectController.body, + effectController.fitLid, + !effectController.nonblinn, + ); + + teapot = new THREE.Mesh(geometry, materials[shading]); + + scene.add(teapot); +} diff --git a/examples-testing/examples/webgl_geometry_terrain.ts b/examples-testing/examples/webgl_geometry_terrain.ts new file mode 100644 index 000000000..55b4aa474 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_terrain.ts @@ -0,0 +1,174 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +let container, stats; +let camera, controls, scene, renderer; +let mesh, texture; + +const worldWidth = 256, + worldDepth = 256; +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xefd1b5); + scene.fog = new THREE.FogExp2(0xefd1b5, 0.0025); + + const data = generateHeight(worldWidth, worldDepth); + + camera.position.set(100, 800, -800); + camera.lookAt(-100, 810, -800); + + const geometry = new THREE.PlaneGeometry(7500, 7500, worldWidth - 1, worldDepth - 1); + geometry.rotateX(-Math.PI / 2); + + const vertices = geometry.attributes.position.array; + + for (let i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) { + vertices[j + 1] = data[i] * 10; + } + + texture = new THREE.CanvasTexture(generateTexture(data, worldWidth, worldDepth)); + texture.wrapS = THREE.ClampToEdgeWrapping; + texture.wrapT = THREE.ClampToEdgeWrapping; + texture.colorSpace = THREE.SRGBColorSpace; + + mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ map: texture })); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + controls = new FirstPersonControls(camera, renderer.domElement); + controls.movementSpeed = 150; + controls.lookSpeed = 0.1; + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function generateHeight(width, height) { + let seed = Math.PI / 4; + window.Math.random = function () { + const x = Math.sin(seed++) * 10000; + return x - Math.floor(x); + }; + + const size = width * height, + data = new Uint8Array(size); + const perlin = new ImprovedNoise(), + z = Math.random() * 100; + + let quality = 1; + + for (let j = 0; j < 4; j++) { + for (let i = 0; i < size; i++) { + const x = i % width, + y = ~~(i / width); + data[i] += Math.abs(perlin.noise(x / quality, y / quality, z) * quality * 1.75); + } + + quality *= 5; + } + + return data; +} + +function generateTexture(data, width, height) { + let context, image, imageData, shade; + + const vector3 = new THREE.Vector3(0, 0, 0); + + const sun = new THREE.Vector3(1, 1, 1); + sun.normalize(); + + const canvas = document.createElement('canvas'); + canvas.width = width; + canvas.height = height; + + context = canvas.getContext('2d'); + context.fillStyle = '#000'; + context.fillRect(0, 0, width, height); + + image = context.getImageData(0, 0, canvas.width, canvas.height); + imageData = image.data; + + for (let i = 0, j = 0, l = imageData.length; i < l; i += 4, j++) { + vector3.x = data[j - 2] - data[j + 2]; + vector3.y = 2; + vector3.z = data[j - width * 2] - data[j + width * 2]; + vector3.normalize(); + + shade = vector3.dot(sun); + + imageData[i] = (96 + shade * 128) * (0.5 + data[j] * 0.007); + imageData[i + 1] = (32 + shade * 96) * (0.5 + data[j] * 0.007); + imageData[i + 2] = shade * 96 * (0.5 + data[j] * 0.007); + } + + context.putImageData(image, 0, 0); + + // Scaled 4x + + const canvasScaled = document.createElement('canvas'); + canvasScaled.width = width * 4; + canvasScaled.height = height * 4; + + context = canvasScaled.getContext('2d'); + context.scale(4, 4); + context.drawImage(canvas, 0, 0); + + image = context.getImageData(0, 0, canvasScaled.width, canvasScaled.height); + imageData = image.data; + + for (let i = 0, l = imageData.length; i < l; i += 4) { + const v = ~~(Math.random() * 5); + + imageData[i] += v; + imageData[i + 1] += v; + imageData[i + 2] += v; + } + + context.putImageData(image, 0, 0); + + return canvasScaled; +} + +// + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + controls.update(timer.getDelta()); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_terrain_raycast.ts b/examples-testing/examples/webgl_geometry_terrain_raycast.ts new file mode 100644 index 000000000..f1383c138 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_terrain_raycast.ts @@ -0,0 +1,206 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +let container, stats; + +let camera, controls, scene, renderer; + +let mesh, texture; + +const worldWidth = 256, + worldDepth = 256, + worldHalfWidth = worldWidth / 2, + worldHalfDepth = worldDepth / 2; + +let helper; + +const raycaster = new THREE.Raycaster(); +const pointer = new THREE.Vector2(); + +init(); + +function init() { + container = document.getElementById('container'); + container.innerHTML = ''; + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfd1e5); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 10, 20000); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1000; + controls.maxDistance = 10000; + controls.maxPolarAngle = Math.PI / 2; + + // + + const data = generateHeight(worldWidth, worldDepth); + + controls.target.y = data[worldHalfWidth + worldHalfDepth * worldWidth] + 500; + camera.position.y = controls.target.y + 2000; + camera.position.x = 2000; + controls.update(); + + const geometry = new THREE.PlaneGeometry(7500, 7500, worldWidth - 1, worldDepth - 1); + geometry.rotateX(-Math.PI / 2); + + const vertices = geometry.attributes.position.array; + + for (let i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) { + vertices[j + 1] = data[i] * 10; + } + + // + + texture = new THREE.CanvasTexture(generateTexture(data, worldWidth, worldDepth)); + texture.wrapS = THREE.ClampToEdgeWrapping; + texture.wrapT = THREE.ClampToEdgeWrapping; + texture.colorSpace = THREE.SRGBColorSpace; + + mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ map: texture })); + scene.add(mesh); + + const geometryHelper = new THREE.ConeGeometry(20, 100, 3); + geometryHelper.translate(0, 50, 0); + geometryHelper.rotateX(Math.PI / 2); + helper = new THREE.Mesh(geometryHelper, new THREE.MeshNormalMaterial()); + scene.add(helper); + + container.addEventListener('pointermove', onPointerMove); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function generateHeight(width, height) { + const size = width * height, + data = new Uint8Array(size), + perlin = new ImprovedNoise(), + z = Math.random() * 100; + + let quality = 1; + + for (let j = 0; j < 4; j++) { + for (let i = 0; i < size; i++) { + const x = i % width, + y = ~~(i / width); + data[i] += Math.abs(perlin.noise(x / quality, y / quality, z) * quality * 1.75); + } + + quality *= 5; + } + + return data; +} + +function generateTexture(data, width, height) { + // bake lighting into texture + + let context, image, imageData, shade; + + const vector3 = new THREE.Vector3(0, 0, 0); + + const sun = new THREE.Vector3(1, 1, 1); + sun.normalize(); + + const canvas = document.createElement('canvas'); + canvas.width = width; + canvas.height = height; + + context = canvas.getContext('2d'); + context.fillStyle = '#000'; + context.fillRect(0, 0, width, height); + + image = context.getImageData(0, 0, canvas.width, canvas.height); + imageData = image.data; + + for (let i = 0, j = 0, l = imageData.length; i < l; i += 4, j++) { + vector3.x = data[j - 2] - data[j + 2]; + vector3.y = 2; + vector3.z = data[j - width * 2] - data[j + width * 2]; + vector3.normalize(); + + shade = vector3.dot(sun); + + imageData[i] = (96 + shade * 128) * (0.5 + data[j] * 0.007); + imageData[i + 1] = (32 + shade * 96) * (0.5 + data[j] * 0.007); + imageData[i + 2] = shade * 96 * (0.5 + data[j] * 0.007); + } + + context.putImageData(image, 0, 0); + + // Scaled 4x + + const canvasScaled = document.createElement('canvas'); + canvasScaled.width = width * 4; + canvasScaled.height = height * 4; + + context = canvasScaled.getContext('2d'); + context.scale(4, 4); + context.drawImage(canvas, 0, 0); + + image = context.getImageData(0, 0, canvasScaled.width, canvasScaled.height); + imageData = image.data; + + for (let i = 0, l = imageData.length; i < l; i += 4) { + const v = ~~(Math.random() * 5); + + imageData[i] += v; + imageData[i + 1] += v; + imageData[i + 2] += v; + } + + context.putImageData(image, 0, 0); + + return canvasScaled; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + renderer.render(scene, camera); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / renderer.domElement.clientWidth) * 2 - 1; + pointer.y = -(event.clientY / renderer.domElement.clientHeight) * 2 + 1; + raycaster.setFromCamera(pointer, camera); + + // See if the ray from the camera into the world hits one of our meshes + const intersects = raycaster.intersectObject(mesh); + + // Toggle rotation bool for meshes that we clicked + if (intersects.length > 0) { + helper.position.set(0, 0, 0); + helper.lookAt(intersects[0].face.normal); + + helper.position.copy(intersects[0].point); + } +} diff --git a/examples-testing/examples/webgl_geometry_text.ts b/examples-testing/examples/webgl_geometry_text.ts new file mode 100644 index 000000000..1a9d00d06 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_text.ts @@ -0,0 +1,312 @@ +import * as THREE from 'three'; + +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +THREE.Cache.enabled = true; + +let container; + +let camera, cameraTarget, scene, renderer; + +let group, textMesh1, textMesh2, textGeo, materials; + +let firstLetter = true; + +let text = 'three.js', + bevelEnabled = true, + font = undefined, + fontName = 'optimer', // helvetiker, optimer, gentilis, droid sans, droid serif + fontWeight = 'bold'; // normal bold + +const depth = 20, + size = 70, + hover = 30, + curveSegments = 4, + bevelThickness = 2, + bevelSize = 1.5; + +const mirror = true; + +const fontMap = { + helvetiker: 0, + optimer: 1, + gentilis: 2, + 'droid/droid_sans': 3, + 'droid/droid_serif': 4, +}; + +const weightMap = { + regular: 0, + bold: 1, +}; + +const reverseFontMap = []; +const reverseWeightMap = []; + +for (const i in fontMap) reverseFontMap[fontMap[i]] = i; +for (const i in weightMap) reverseWeightMap[weightMap[i]] = i; + +let targetRotation = 0; +let targetRotationOnPointerDown = 0; + +let pointerX = 0; +let pointerXOnPointerDown = 0; + +let windowHalfX = window.innerWidth / 2; + +let fontIndex = 1; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // CAMERA + + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1500); + camera.position.set(0, 400, 700); + + cameraTarget = new THREE.Vector3(0, 150, 0); + + // SCENE + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + scene.fog = new THREE.Fog(0x000000, 250, 1400); + + // LIGHTS + + const dirLight = new THREE.DirectionalLight(0xffffff, 0.4); + dirLight.position.set(0, 0, 1).normalize(); + scene.add(dirLight); + + const pointLight = new THREE.PointLight(0xffffff, 4.5, 0, 0); + pointLight.color.setHSL(Math.random(), 1, 0.5); + pointLight.position.set(0, 100, 90); + scene.add(pointLight); + + materials = [ + new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }), // front + new THREE.MeshPhongMaterial({ color: 0xffffff }), // side + ]; + + group = new THREE.Group(); + group.position.y = 100; + + scene.add(group); + + loadFont(); + + const plane = new THREE.Mesh( + new THREE.PlaneGeometry(10000, 10000), + new THREE.MeshBasicMaterial({ color: 0xffffff, opacity: 0.5, transparent: true }), + ); + plane.position.y = 100; + plane.rotation.x = -Math.PI / 2; + scene.add(plane); + + // RENDERER + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // EVENTS + + container.style.touchAction = 'none'; + container.addEventListener('pointerdown', onPointerDown); + + document.addEventListener('keypress', onDocumentKeyPress); + document.addEventListener('keydown', onDocumentKeyDown); + + // + + const params = { + changeColor: function () { + pointLight.color.setHSL(Math.random(), 1, 0.5); + }, + changeFont: function () { + fontIndex++; + + fontName = reverseFontMap[fontIndex % reverseFontMap.length]; + + loadFont(); + }, + changeWeight: function () { + if (fontWeight === 'bold') { + fontWeight = 'regular'; + } else { + fontWeight = 'bold'; + } + + loadFont(); + }, + changeBevel: function () { + bevelEnabled = !bevelEnabled; + + refreshText(); + }, + }; + + // + + const gui = new GUI(); + + gui.add(params, 'changeColor').name('change color'); + gui.add(params, 'changeFont').name('change font'); + gui.add(params, 'changeWeight').name('change weight'); + gui.add(params, 'changeBevel').name('change bevel'); + gui.open(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function onDocumentKeyDown(event) { + if (firstLetter) { + firstLetter = false; + text = ''; + } + + const keyCode = event.keyCode; + + // backspace + + if (keyCode == 8) { + event.preventDefault(); + + text = text.substring(0, text.length - 1); + refreshText(); + + return false; + } +} + +function onDocumentKeyPress(event) { + const keyCode = event.which; + + // backspace + + if (keyCode == 8) { + event.preventDefault(); + } else { + const ch = String.fromCharCode(keyCode); + text += ch; + + refreshText(); + } +} + +function loadFont() { + const loader = new FontLoader(); + loader.load('fonts/' + fontName + '_' + fontWeight + '.typeface.json', function (response) { + font = response; + + refreshText(); + }); +} + +function createText() { + textGeo = new TextGeometry(text, { + font: font, + + size: size, + depth: depth, + curveSegments: curveSegments, + + bevelThickness: bevelThickness, + bevelSize: bevelSize, + bevelEnabled: bevelEnabled, + }); + + textGeo.computeBoundingBox(); + + const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); + + textMesh1 = new THREE.Mesh(textGeo, materials); + + textMesh1.position.x = centerOffset; + textMesh1.position.y = hover; + textMesh1.position.z = 0; + + textMesh1.rotation.x = 0; + textMesh1.rotation.y = Math.PI * 2; + + group.add(textMesh1); + + if (mirror) { + textMesh2 = new THREE.Mesh(textGeo, materials); + + textMesh2.position.x = centerOffset; + textMesh2.position.y = -hover; + textMesh2.position.z = depth; + + textMesh2.rotation.x = Math.PI; + textMesh2.rotation.y = Math.PI * 2; + + group.add(textMesh2); + } +} + +function refreshText() { + group.remove(textMesh1); + if (mirror) group.remove(textMesh2); + + if (!text) return; + + createText(); +} + +function onPointerDown(event) { + if (event.isPrimary === false) return; + + pointerXOnPointerDown = event.clientX - windowHalfX; + targetRotationOnPointerDown = targetRotation; + + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerup', onPointerUp); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + pointerX = event.clientX - windowHalfX; + + targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; +} + +function onPointerUp(event) { + if (event.isPrimary === false) return; + + document.removeEventListener('pointermove', onPointerMove); + document.removeEventListener('pointerup', onPointerUp); +} + +// + +function animate() { + group.rotation.y += (targetRotation - group.rotation.y) * 0.05; + + camera.lookAt(cameraTarget); + + renderer.clear(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_text_shapes.ts b/examples-testing/examples/webgl_geometry_text_shapes.ts new file mode 100644 index 000000000..d9633cd15 --- /dev/null +++ b/examples-testing/examples/webgl_geometry_text_shapes.ts @@ -0,0 +1,112 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; + +let camera, scene, renderer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(0, -400, 600); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + const loader = new FontLoader(); + loader.load('fonts/helvetiker_regular.typeface.json', function (font) { + const color = 0x006699; + + const matDark = new THREE.LineBasicMaterial({ + color: color, + side: THREE.DoubleSide, + }); + + const matLite = new THREE.MeshBasicMaterial({ + color: color, + transparent: true, + opacity: 0.4, + side: THREE.DoubleSide, + }); + + const message = ' Three.js\nSimple text.'; + + const shapes = font.generateShapes(message, 100); + + const geometry = new THREE.ShapeGeometry(shapes); + + geometry.computeBoundingBox(); + + const xMid = -0.5 * (geometry.boundingBox.max.x - geometry.boundingBox.min.x); + + geometry.translate(xMid, 0, 0); + + // make shape ( N.B. edge view not visible ) + + const text = new THREE.Mesh(geometry, matLite); + text.position.z = -150; + scene.add(text); + + // make line shape ( N.B. edge view remains visible ) + + const holeShapes = []; + + for (let i = 0; i < shapes.length; i++) { + const shape = shapes[i]; + + if (shape.holes && shape.holes.length > 0) { + for (let j = 0; j < shape.holes.length; j++) { + const hole = shape.holes[j]; + holeShapes.push(hole); + } + } + } + + shapes.push(...holeShapes); + + const lineText = new THREE.Object3D(); + + for (let i = 0; i < shapes.length; i++) { + const shape = shapes[i]; + + const points = shape.getPoints(); + const geometry = new THREE.BufferGeometry().setFromPoints(points); + + geometry.translate(xMid, 0, 0); + + const lineMesh = new THREE.Line(geometry, matDark); + lineText.add(lineMesh); + } + + scene.add(lineText); + + render(); + }); //end load function + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0, 0); + controls.update(); + + controls.addEventListener('change', render); + + window.addEventListener('resize', onWindowResize); +} // end init + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_geometry_text_stroke.ts b/examples-testing/examples/webgl_geometry_text_stroke.ts new file mode 100644 index 000000000..49ca9aa8c --- /dev/null +++ b/examples-testing/examples/webgl_geometry_text_stroke.ts @@ -0,0 +1,146 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { SVGLoader } from 'three/addons/loaders/SVGLoader.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; + +let camera, scene, renderer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(0, -400, 1000); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + const loader = new FontLoader(); + loader.load('fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json', function (font) { + const color = new THREE.Color(0x006699); + + const matDark = new THREE.MeshBasicMaterial({ + color: color, + side: THREE.DoubleSide, + }); + + const matLite = new THREE.MeshBasicMaterial({ + color: color, + transparent: true, + opacity: 0.4, + side: THREE.DoubleSide, + }); + + const material = { + dark: matDark, + lite: matLite, + color: color, + }; + + const english = ' Three.js\nStroke text.'; // Left to right + + const hebrew = 'טקסט קו'; // Right to left + + const chinese = '文字描邊'; // Top to bottom + + const message1 = generateStrokeText(font, material, english, 80, 'ltr'); + + const message2 = generateStrokeText(font, material, hebrew, 80, 'rtl'); + + const message3 = generateStrokeText(font, material, chinese, 80, 'tb'); + + message1.position.x = -100; + + message2.position.x = -100; + message2.position.y = -300; + + message3.position.x = 300; + message3.position.y = -300; + + scene.add(message1, message2, message3); + + render(); + }); //end load function + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0, 0); + controls.update(); + + controls.addEventListener('change', render); + + window.addEventListener('resize', onWindowResize); +} // end init + +function generateStrokeText(font, material, message, size, direction = 'ltr') { + const shapes = font.generateShapes(message, size, direction); + + const geometry = new THREE.ShapeGeometry(shapes); + + const strokeText = new THREE.Group(); + + geometry.computeBoundingBox(); + + const xMid = -0.5 * (geometry.boundingBox.max.x - geometry.boundingBox.min.x); + + geometry.translate(xMid, 0, 0); + + // make shape ( N.B. edge view not visible ) + + const text = new THREE.Mesh(geometry, material.lite); + + text.position.z = -150; + + strokeText.add(text); + + // make line shape ( N.B. edge view remains visible ) + + const holeShapes = []; + + for (let i = 0; i < shapes.length; i++) { + const shape = shapes[i]; + + if (shape.holes && shape.holes.length > 0) { + for (let j = 0; j < shape.holes.length; j++) { + const hole = shape.holes[j]; + holeShapes.push(hole); + } + } + } + + shapes.push(...holeShapes); + + const style = SVGLoader.getStrokeStyle(5, material.color.getStyle()); + + for (let i = 0; i < shapes.length; i++) { + const shape = shapes[i]; + + const points = shape.getPoints(); + + const geometry = SVGLoader.pointsToStroke(points, style); + + geometry.translate(xMid, 0, 0); + + const strokeMesh = new THREE.Mesh(geometry, material.dark); + strokeText.add(strokeMesh); + } + + return strokeText; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_gpgpu_birds.ts b/examples-testing/examples/webgl_gpgpu_birds.ts new file mode 100644 index 000000000..20a5e0d97 --- /dev/null +++ b/examples-testing/examples/webgl_gpgpu_birds.ts @@ -0,0 +1,313 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; + +/* TEXTURE WIDTH FOR SIMULATION */ +const WIDTH = 32; + +const BIRDS = WIDTH * WIDTH; + +// Custom Geometry - using 3 triangles each. No UVs, no normals currently. +class BirdGeometry extends THREE.BufferGeometry { + constructor() { + super(); + + const trianglesPerBird = 3; + const triangles = BIRDS * trianglesPerBird; + const points = triangles * 3; + + const vertices = new THREE.BufferAttribute(new Float32Array(points * 3), 3); + const birdColors = new THREE.BufferAttribute(new Float32Array(points * 3), 3); + const references = new THREE.BufferAttribute(new Float32Array(points * 2), 2); + const birdVertex = new THREE.BufferAttribute(new Float32Array(points), 1); + + this.setAttribute('position', vertices); + this.setAttribute('birdColor', birdColors); + this.setAttribute('reference', references); + this.setAttribute('birdVertex', birdVertex); + + // this.setAttribute( 'normal', new Float32Array( points * 3 ), 3 ); + + let v = 0; + + function verts_push() { + for (let i = 0; i < arguments.length; i++) { + vertices.array[v++] = arguments[i]; + } + } + + const wingsSpan = 20; + + for (let f = 0; f < BIRDS; f++) { + // Body + + verts_push(0, -0, -20, 0, 4, -20, 0, 0, 30); + + // Wings + + verts_push(0, 0, -15, -wingsSpan, 0, 0, 0, 0, 15); + + verts_push(0, 0, 15, wingsSpan, 0, 0, 0, 0, -15); + } + + for (let v = 0; v < triangles * 3; v++) { + const triangleIndex = ~~(v / 3); + const birdIndex = ~~(triangleIndex / trianglesPerBird); + const x = (birdIndex % WIDTH) / WIDTH; + const y = ~~(birdIndex / WIDTH) / WIDTH; + + const c = new THREE.Color(0x666666 + (~~(v / 9) / BIRDS) * 0x666666); + + birdColors.array[v * 3 + 0] = c.r; + birdColors.array[v * 3 + 1] = c.g; + birdColors.array[v * 3 + 2] = c.b; + + references.array[v * 2] = x; + references.array[v * 2 + 1] = y; + + birdVertex.array[v] = v % 9; + } + + this.scale(0.2, 0.2, 0.2); + } +} + +// + +let container, stats; +let camera, scene, renderer; +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +const BOUNDS = 800, + BOUNDS_HALF = BOUNDS / 2; + +let last = performance.now(); + +let gpuCompute; +let velocityVariable; +let positionVariable; +let positionUniforms; +let velocityUniforms; +let birdUniforms; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 3000); + camera.position.z = 350; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + scene.fog = new THREE.Fog(0xffffff, 100, 1000); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + initComputeRenderer(); + + stats = new Stats(); + container.appendChild(stats.dom); + + container.style.touchAction = 'none'; + container.addEventListener('pointermove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + const effectController = { + separation: 20.0, + alignment: 20.0, + cohesion: 20.0, + freedom: 0.75, + }; + + const valuesChanger = function () { + velocityUniforms['separationDistance'].value = effectController.separation; + velocityUniforms['alignmentDistance'].value = effectController.alignment; + velocityUniforms['cohesionDistance'].value = effectController.cohesion; + velocityUniforms['freedomFactor'].value = effectController.freedom; + }; + + valuesChanger(); + + gui.add(effectController, 'separation', 0.0, 100.0, 1.0).onChange(valuesChanger); + gui.add(effectController, 'alignment', 0.0, 100, 0.001).onChange(valuesChanger); + gui.add(effectController, 'cohesion', 0.0, 100, 0.025).onChange(valuesChanger); + gui.close(); + + initBirds(); +} + +function initComputeRenderer() { + gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); + + const dtPosition = gpuCompute.createTexture(); + const dtVelocity = gpuCompute.createTexture(); + fillPositionTexture(dtPosition); + fillVelocityTexture(dtVelocity); + + velocityVariable = gpuCompute.addVariable( + 'textureVelocity', + document.getElementById('fragmentShaderVelocity').textContent, + dtVelocity, + ); + positionVariable = gpuCompute.addVariable( + 'texturePosition', + document.getElementById('fragmentShaderPosition').textContent, + dtPosition, + ); + + gpuCompute.setVariableDependencies(velocityVariable, [positionVariable, velocityVariable]); + gpuCompute.setVariableDependencies(positionVariable, [positionVariable, velocityVariable]); + + positionUniforms = positionVariable.material.uniforms; + velocityUniforms = velocityVariable.material.uniforms; + + positionUniforms['time'] = { value: 0.0 }; + positionUniforms['delta'] = { value: 0.0 }; + velocityUniforms['time'] = { value: 1.0 }; + velocityUniforms['delta'] = { value: 0.0 }; + velocityUniforms['testing'] = { value: 1.0 }; + velocityUniforms['separationDistance'] = { value: 1.0 }; + velocityUniforms['alignmentDistance'] = { value: 1.0 }; + velocityUniforms['cohesionDistance'] = { value: 1.0 }; + velocityUniforms['freedomFactor'] = { value: 1.0 }; + velocityUniforms['predator'] = { value: new THREE.Vector3() }; + velocityVariable.material.defines.BOUNDS = BOUNDS.toFixed(2); + + velocityVariable.wrapS = THREE.RepeatWrapping; + velocityVariable.wrapT = THREE.RepeatWrapping; + positionVariable.wrapS = THREE.RepeatWrapping; + positionVariable.wrapT = THREE.RepeatWrapping; + + const error = gpuCompute.init(); + + if (error !== null) { + console.error(error); + } +} + +function initBirds() { + const geometry = new BirdGeometry(); + + // For Vertex and Fragment + birdUniforms = { + color: { value: new THREE.Color(0xff2200) }, + texturePosition: { value: null }, + textureVelocity: { value: null }, + time: { value: 1.0 }, + delta: { value: 0.0 }, + }; + + // THREE.ShaderMaterial + const material = new THREE.ShaderMaterial({ + uniforms: birdUniforms, + vertexShader: document.getElementById('birdVS').textContent, + fragmentShader: document.getElementById('birdFS').textContent, + side: THREE.DoubleSide, + }); + + const birdMesh = new THREE.Mesh(geometry, material); + birdMesh.rotation.y = Math.PI / 2; + birdMesh.matrixAutoUpdate = false; + birdMesh.updateMatrix(); + + scene.add(birdMesh); +} + +function fillPositionTexture(texture) { + const theArray = texture.image.data; + + for (let k = 0, kl = theArray.length; k < kl; k += 4) { + const x = Math.random() * BOUNDS - BOUNDS_HALF; + const y = Math.random() * BOUNDS - BOUNDS_HALF; + const z = Math.random() * BOUNDS - BOUNDS_HALF; + + theArray[k + 0] = x; + theArray[k + 1] = y; + theArray[k + 2] = z; + theArray[k + 3] = 1; + } +} + +function fillVelocityTexture(texture) { + const theArray = texture.image.data; + + for (let k = 0, kl = theArray.length; k < kl; k += 4) { + const x = Math.random() - 0.5; + const y = Math.random() - 0.5; + const z = Math.random() - 0.5; + + theArray[k + 0] = x * 10; + theArray[k + 1] = y * 10; + theArray[k + 2] = z * 10; + theArray[k + 3] = 1; + } +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const now = performance.now(); + let delta = (now - last) / 1000; + + if (delta > 1) delta = 1; // safety cap on large deltas + last = now; + + positionUniforms['time'].value = now; + positionUniforms['delta'].value = delta; + velocityUniforms['time'].value = now; + velocityUniforms['delta'].value = delta; + birdUniforms['time'].value = now; + birdUniforms['delta'].value = delta; + + velocityUniforms['predator'].value.set((0.5 * mouseX) / windowHalfX, (-0.5 * mouseY) / windowHalfY, 0); + + mouseX = 10000; + mouseY = 10000; + + gpuCompute.compute(); + + birdUniforms['texturePosition'].value = gpuCompute.getCurrentRenderTarget(positionVariable).texture; + birdUniforms['textureVelocity'].value = gpuCompute.getCurrentRenderTarget(velocityVariable).texture; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_gpgpu_birds_gltf.ts b/examples-testing/examples/webgl_gpgpu_birds_gltf.ts new file mode 100644 index 000000000..05f81a869 --- /dev/null +++ b/examples-testing/examples/webgl_gpgpu_birds_gltf.ts @@ -0,0 +1,413 @@ +import * as THREE from 'three'; +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; + +/* TEXTURE WIDTH FOR SIMULATION */ +const WIDTH = 64; +const BIRDS = WIDTH * WIDTH; + +/* BAKE ANIMATION INTO TEXTURE and CREATE GEOMETRY FROM BASE MODEL */ +const BirdGeometry = new THREE.BufferGeometry(); +let textureAnimation, durationAnimation, birdMesh, materialShader, indicesPerBird; + +function nextPowerOf2(n) { + return Math.pow(2, Math.ceil(Math.log(n) / Math.log(2))); +} + +const gltfs = ['models/gltf/Parrot.glb', 'models/gltf/Flamingo.glb']; +const colors = [0xccffff, 0xffdeff]; +const sizes = [0.2, 0.1]; +const selectModel = Math.floor(Math.random() * gltfs.length); +new GLTFLoader().load(gltfs[selectModel], function (gltf) { + const animations = gltf.animations; + durationAnimation = Math.round(animations[0].duration * 60); + const birdGeo = gltf.scene.children[0].geometry; + const morphAttributes = birdGeo.morphAttributes.position; + const tHeight = nextPowerOf2(durationAnimation); + const tWidth = nextPowerOf2(birdGeo.getAttribute('position').count); + indicesPerBird = birdGeo.index.count; + const tData = new Float32Array(4 * tWidth * tHeight); + + for (let i = 0; i < tWidth; i++) { + for (let j = 0; j < tHeight; j++) { + const offset = j * tWidth * 4; + + const curMorph = Math.floor((j / durationAnimation) * morphAttributes.length); + const nextMorph = + (Math.floor((j / durationAnimation) * morphAttributes.length) + 1) % morphAttributes.length; + const lerpAmount = ((j / durationAnimation) * morphAttributes.length) % 1; + + if (j < durationAnimation) { + let d0, d1; + + d0 = morphAttributes[curMorph].array[i * 3]; + d1 = morphAttributes[nextMorph].array[i * 3]; + + if (d0 !== undefined && d1 !== undefined) + tData[offset + i * 4] = THREE.MathUtils.lerp(d0, d1, lerpAmount); + + d0 = morphAttributes[curMorph].array[i * 3 + 1]; + d1 = morphAttributes[nextMorph].array[i * 3 + 1]; + + if (d0 !== undefined && d1 !== undefined) + tData[offset + i * 4 + 1] = THREE.MathUtils.lerp(d0, d1, lerpAmount); + + d0 = morphAttributes[curMorph].array[i * 3 + 2]; + d1 = morphAttributes[nextMorph].array[i * 3 + 2]; + + if (d0 !== undefined && d1 !== undefined) + tData[offset + i * 4 + 2] = THREE.MathUtils.lerp(d0, d1, lerpAmount); + + tData[offset + i * 4 + 3] = 1; + } + } + } + + textureAnimation = new THREE.DataTexture(tData, tWidth, tHeight, THREE.RGBAFormat, THREE.FloatType); + textureAnimation.needsUpdate = true; + + const vertices = [], + color = [], + reference = [], + seeds = [], + indices = []; + const totalVertices = birdGeo.getAttribute('position').count * 3 * BIRDS; + for (let i = 0; i < totalVertices; i++) { + const bIndex = i % (birdGeo.getAttribute('position').count * 3); + vertices.push(birdGeo.getAttribute('position').array[bIndex]); + color.push(birdGeo.getAttribute('color').array[bIndex]); + } + + let r = Math.random(); + for (let i = 0; i < birdGeo.getAttribute('position').count * BIRDS; i++) { + const bIndex = i % birdGeo.getAttribute('position').count; + const bird = Math.floor(i / birdGeo.getAttribute('position').count); + if (bIndex == 0) r = Math.random(); + const j = ~~bird; + const x = (j % WIDTH) / WIDTH; + const y = ~~(j / WIDTH) / WIDTH; + reference.push(x, y, bIndex / tWidth, durationAnimation / tHeight); + seeds.push(bird, r, Math.random(), Math.random()); + } + + for (let i = 0; i < birdGeo.index.array.length * BIRDS; i++) { + const offset = Math.floor(i / birdGeo.index.array.length) * birdGeo.getAttribute('position').count; + indices.push(birdGeo.index.array[i % birdGeo.index.array.length] + offset); + } + + BirdGeometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(vertices), 3)); + BirdGeometry.setAttribute('birdColor', new THREE.BufferAttribute(new Float32Array(color), 3)); + BirdGeometry.setAttribute('color', new THREE.BufferAttribute(new Float32Array(color), 3)); + BirdGeometry.setAttribute('reference', new THREE.BufferAttribute(new Float32Array(reference), 4)); + BirdGeometry.setAttribute('seeds', new THREE.BufferAttribute(new Float32Array(seeds), 4)); + + BirdGeometry.setIndex(indices); + + init(); +}); + +let container, stats; +let camera, scene, renderer; +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +const BOUNDS = 800, + BOUNDS_HALF = BOUNDS / 2; + +let last = performance.now(); + +let gpuCompute; +let velocityVariable; +let positionVariable; +let positionUniforms; +let velocityUniforms; + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 3000); + camera.position.z = 350; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(colors[selectModel]); + scene.fog = new THREE.Fog(colors[selectModel], 100, 1000); + + // LIGHTS + + const hemiLight = new THREE.HemisphereLight(colors[selectModel], 0xffffff, 4.5); + hemiLight.color.setHSL(0.6, 1, 0.6, THREE.SRGBColorSpace); + hemiLight.groundColor.setHSL(0.095, 1, 0.75, THREE.SRGBColorSpace); + hemiLight.position.set(0, 50, 0); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0x00ced1, 2.0); + dirLight.color.setHSL(0.1, 1, 0.95, THREE.SRGBColorSpace); + dirLight.position.set(-1, 1.75, 1); + dirLight.position.multiplyScalar(30); + scene.add(dirLight); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + initComputeRenderer(); + + stats = new Stats(); + container.appendChild(stats.dom); + + container.style.touchAction = 'none'; + container.addEventListener('pointermove', onPointerMove); + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + const effectController = { + separation: 20.0, + alignment: 20.0, + cohesion: 20.0, + freedom: 0.75, + size: sizes[selectModel], + count: Math.floor(BIRDS / 4), + }; + + const valuesChanger = function () { + velocityUniforms['separationDistance'].value = effectController.separation; + velocityUniforms['alignmentDistance'].value = effectController.alignment; + velocityUniforms['cohesionDistance'].value = effectController.cohesion; + velocityUniforms['freedomFactor'].value = effectController.freedom; + if (materialShader) materialShader.uniforms['size'].value = effectController.size; + BirdGeometry.setDrawRange(0, indicesPerBird * effectController.count); + }; + + valuesChanger(); + + gui.add(effectController, 'separation', 0.0, 100.0, 1.0).onChange(valuesChanger); + gui.add(effectController, 'alignment', 0.0, 100, 0.001).onChange(valuesChanger); + gui.add(effectController, 'cohesion', 0.0, 100, 0.025).onChange(valuesChanger); + gui.add(effectController, 'size', 0, 1, 0.01).onChange(valuesChanger); + gui.add(effectController, 'count', 0, BIRDS, 1).onChange(valuesChanger); + gui.close(); + + initBirds(effectController); +} + +function initComputeRenderer() { + gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); + + const dtPosition = gpuCompute.createTexture(); + const dtVelocity = gpuCompute.createTexture(); + fillPositionTexture(dtPosition); + fillVelocityTexture(dtVelocity); + + velocityVariable = gpuCompute.addVariable( + 'textureVelocity', + document.getElementById('fragmentShaderVelocity').textContent, + dtVelocity, + ); + positionVariable = gpuCompute.addVariable( + 'texturePosition', + document.getElementById('fragmentShaderPosition').textContent, + dtPosition, + ); + + gpuCompute.setVariableDependencies(velocityVariable, [positionVariable, velocityVariable]); + gpuCompute.setVariableDependencies(positionVariable, [positionVariable, velocityVariable]); + + positionUniforms = positionVariable.material.uniforms; + velocityUniforms = velocityVariable.material.uniforms; + + positionUniforms['time'] = { value: 0.0 }; + positionUniforms['delta'] = { value: 0.0 }; + velocityUniforms['time'] = { value: 1.0 }; + velocityUniforms['delta'] = { value: 0.0 }; + velocityUniforms['testing'] = { value: 1.0 }; + velocityUniforms['separationDistance'] = { value: 1.0 }; + velocityUniforms['alignmentDistance'] = { value: 1.0 }; + velocityUniforms['cohesionDistance'] = { value: 1.0 }; + velocityUniforms['freedomFactor'] = { value: 1.0 }; + velocityUniforms['predator'] = { value: new THREE.Vector3() }; + velocityVariable.material.defines.BOUNDS = BOUNDS.toFixed(2); + + velocityVariable.wrapS = THREE.RepeatWrapping; + velocityVariable.wrapT = THREE.RepeatWrapping; + positionVariable.wrapS = THREE.RepeatWrapping; + positionVariable.wrapT = THREE.RepeatWrapping; + + const error = gpuCompute.init(); + + if (error !== null) { + console.error(error); + } +} + +function initBirds(effectController) { + const geometry = BirdGeometry; + + const m = new THREE.MeshStandardMaterial({ + vertexColors: true, + flatShading: true, + roughness: 1, + metalness: 0, + }); + + m.onBeforeCompile = shader => { + shader.uniforms.texturePosition = { value: null }; + shader.uniforms.textureVelocity = { value: null }; + shader.uniforms.textureAnimation = { value: textureAnimation }; + shader.uniforms.time = { value: 1.0 }; + shader.uniforms.size = { value: effectController.size }; + shader.uniforms.delta = { value: 0.0 }; + + let token = '#define STANDARD'; + + let insert = /* glsl */ ` + attribute vec4 reference; + attribute vec4 seeds; + attribute vec3 birdColor; + uniform sampler2D texturePosition; + uniform sampler2D textureVelocity; + uniform sampler2D textureAnimation; + uniform float size; + uniform float time; + `; + + shader.vertexShader = shader.vertexShader.replace(token, token + insert); + + token = '#include '; + + insert = /* glsl */ ` + vec4 tmpPos = texture2D( texturePosition, reference.xy ); + + vec3 pos = tmpPos.xyz; + vec3 velocity = normalize(texture2D( textureVelocity, reference.xy ).xyz); + vec3 aniPos = texture2D( textureAnimation, vec2( reference.z, mod( time + ( seeds.x ) * ( ( 0.0004 + seeds.y / 10000.0) + normalize( velocity ) / 20000.0 ), reference.w ) ) ).xyz; + vec3 newPosition = position; + + newPosition = mat3( modelMatrix ) * ( newPosition + aniPos ); + newPosition *= size + seeds.y * size * 0.2; + + velocity.z *= -1.; + float xz = length( velocity.xz ); + float xyz = 1.; + float x = sqrt( 1. - velocity.y * velocity.y ); + + float cosry = velocity.x / xz; + float sinry = velocity.z / xz; + + float cosrz = x / xyz; + float sinrz = velocity.y / xyz; + + mat3 maty = mat3( cosry, 0, -sinry, 0 , 1, 0 , sinry, 0, cosry ); + mat3 matz = mat3( cosrz , sinrz, 0, -sinrz, cosrz, 0, 0 , 0 , 1 ); + + newPosition = maty * matz * newPosition; + newPosition += pos; + + vec3 transformed = vec3( newPosition ); + `; + + shader.vertexShader = shader.vertexShader.replace(token, insert); + + materialShader = shader; + }; + + birdMesh = new THREE.Mesh(geometry, m); + birdMesh.rotation.y = Math.PI / 2; + + birdMesh.castShadow = true; + birdMesh.receiveShadow = true; + + scene.add(birdMesh); +} + +function fillPositionTexture(texture) { + const theArray = texture.image.data; + + for (let k = 0, kl = theArray.length; k < kl; k += 4) { + const x = Math.random() * BOUNDS - BOUNDS_HALF; + const y = Math.random() * BOUNDS - BOUNDS_HALF; + const z = Math.random() * BOUNDS - BOUNDS_HALF; + + theArray[k + 0] = x; + theArray[k + 1] = y; + theArray[k + 2] = z; + theArray[k + 3] = 1; + } +} + +function fillVelocityTexture(texture) { + const theArray = texture.image.data; + + for (let k = 0, kl = theArray.length; k < kl; k += 4) { + const x = Math.random() - 0.5; + const y = Math.random() - 0.5; + const z = Math.random() - 0.5; + + theArray[k + 0] = x * 10; + theArray[k + 1] = y * 10; + theArray[k + 2] = z * 10; + theArray[k + 3] = 1; + } +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const now = performance.now(); + let delta = (now - last) / 1000; + + if (delta > 1) delta = 1; // safety cap on large deltas + last = now; + + positionUniforms['time'].value = now; + positionUniforms['delta'].value = delta; + velocityUniforms['time'].value = now; + velocityUniforms['delta'].value = delta; + if (materialShader) materialShader.uniforms['time'].value = now / 1000; + if (materialShader) materialShader.uniforms['delta'].value = delta; + + velocityUniforms['predator'].value.set((0.5 * mouseX) / windowHalfX, (-0.5 * mouseY) / windowHalfY, 0); + + mouseX = 10000; + mouseY = 10000; + + gpuCompute.compute(); + + if (materialShader) + materialShader.uniforms['texturePosition'].value = gpuCompute.getCurrentRenderTarget(positionVariable).texture; + if (materialShader) + materialShader.uniforms['textureVelocity'].value = gpuCompute.getCurrentRenderTarget(velocityVariable).texture; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_gpgpu_protoplanet.ts b/examples-testing/examples/webgl_gpgpu_protoplanet.ts new file mode 100644 index 000000000..30444ddba --- /dev/null +++ b/examples-testing/examples/webgl_gpgpu_protoplanet.ts @@ -0,0 +1,280 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; + +// Texture width for simulation (each texel is a debris particle) +const WIDTH = 64; + +let container, stats; +let camera, scene, renderer, geometry; + +const PARTICLES = WIDTH * WIDTH; + +let gpuCompute; +let velocityVariable; +let positionVariable; +let velocityUniforms; +let particleUniforms; +let effectController; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 5, 15000); + camera.position.y = 120; + camera.position.z = 400; + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 100; + controls.maxDistance = 1000; + + effectController = { + // Can be changed dynamically + gravityConstant: 100.0, + density: 0.45, + + // Must restart simulation + radius: 300, + height: 8, + exponent: 0.4, + maxMass: 15.0, + velocity: 70, + velocityExponent: 0.2, + randVelocity: 0.001, + }; + + initComputeRenderer(); + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); + + initGUI(); + + initProtoplanets(); + + dynamicValuesChanger(); +} + +function initComputeRenderer() { + gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); + + const dtPosition = gpuCompute.createTexture(); + const dtVelocity = gpuCompute.createTexture(); + + fillTextures(dtPosition, dtVelocity); + + velocityVariable = gpuCompute.addVariable( + 'textureVelocity', + document.getElementById('computeShaderVelocity').textContent, + dtVelocity, + ); + positionVariable = gpuCompute.addVariable( + 'texturePosition', + document.getElementById('computeShaderPosition').textContent, + dtPosition, + ); + + gpuCompute.setVariableDependencies(velocityVariable, [positionVariable, velocityVariable]); + gpuCompute.setVariableDependencies(positionVariable, [positionVariable, velocityVariable]); + + velocityUniforms = velocityVariable.material.uniforms; + + velocityUniforms['gravityConstant'] = { value: 0.0 }; + velocityUniforms['density'] = { value: 0.0 }; + + const error = gpuCompute.init(); + + if (error !== null) { + console.error(error); + } +} + +function restartSimulation() { + const dtPosition = gpuCompute.createTexture(); + const dtVelocity = gpuCompute.createTexture(); + + fillTextures(dtPosition, dtVelocity); + + gpuCompute.renderTexture(dtPosition, positionVariable.renderTargets[0]); + gpuCompute.renderTexture(dtPosition, positionVariable.renderTargets[1]); + gpuCompute.renderTexture(dtVelocity, velocityVariable.renderTargets[0]); + gpuCompute.renderTexture(dtVelocity, velocityVariable.renderTargets[1]); +} + +function initProtoplanets() { + geometry = new THREE.BufferGeometry(); + + const positions = new Float32Array(PARTICLES * 3); + let p = 0; + + for (let i = 0; i < PARTICLES; i++) { + positions[p++] = (Math.random() * 2 - 1) * effectController.radius; + positions[p++] = 0; //( Math.random() * 2 - 1 ) * effectController.radius; + positions[p++] = (Math.random() * 2 - 1) * effectController.radius; + } + + const uvs = new Float32Array(PARTICLES * 2); + p = 0; + + for (let j = 0; j < WIDTH; j++) { + for (let i = 0; i < WIDTH; i++) { + uvs[p++] = i / (WIDTH - 1); + uvs[p++] = j / (WIDTH - 1); + } + } + + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2)); + + particleUniforms = { + texturePosition: { value: null }, + textureVelocity: { value: null }, + cameraConstant: { value: getCameraConstant(camera) }, + density: { value: 0.0 }, + }; + + // THREE.ShaderMaterial + const material = new THREE.ShaderMaterial({ + uniforms: particleUniforms, + vertexShader: document.getElementById('particleVertexShader').textContent, + fragmentShader: document.getElementById('particleFragmentShader').textContent, + }); + + const particles = new THREE.Points(geometry, material); + particles.matrixAutoUpdate = false; + particles.updateMatrix(); + + scene.add(particles); +} + +function fillTextures(texturePosition, textureVelocity) { + const posArray = texturePosition.image.data; + const velArray = textureVelocity.image.data; + + const radius = effectController.radius; + const height = effectController.height; + const exponent = effectController.exponent; + const maxMass = (effectController.maxMass * 1024) / PARTICLES; + const maxVel = effectController.velocity; + const velExponent = effectController.velocityExponent; + const randVel = effectController.randVelocity; + + for (let k = 0, kl = posArray.length; k < kl; k += 4) { + // Position + let x, z, rr; + + do { + x = Math.random() * 2 - 1; + z = Math.random() * 2 - 1; + rr = x * x + z * z; + } while (rr > 1); + + rr = Math.sqrt(rr); + + const rExp = radius * Math.pow(rr, exponent); + + // Velocity + const vel = maxVel * Math.pow(rr, velExponent); + + const vx = vel * z + (Math.random() * 2 - 1) * randVel; + const vy = (Math.random() * 2 - 1) * randVel * 0.05; + const vz = -vel * x + (Math.random() * 2 - 1) * randVel; + + x *= rExp; + z *= rExp; + const y = (Math.random() * 2 - 1) * height; + + const mass = Math.random() * maxMass + 1; + + // Fill in texture values + posArray[k + 0] = x; + posArray[k + 1] = y; + posArray[k + 2] = z; + posArray[k + 3] = 1; + + velArray[k + 0] = vx; + velArray[k + 1] = vy; + velArray[k + 2] = vz; + velArray[k + 3] = mass; + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + particleUniforms['cameraConstant'].value = getCameraConstant(camera); +} + +function dynamicValuesChanger() { + velocityUniforms['gravityConstant'].value = effectController.gravityConstant; + velocityUniforms['density'].value = effectController.density; + particleUniforms['density'].value = effectController.density; +} + +function initGUI() { + const gui = new GUI({ width: 280 }); + + const folder1 = gui.addFolder('Dynamic parameters'); + + folder1.add(effectController, 'gravityConstant', 0.0, 1000.0, 0.05).onChange(dynamicValuesChanger); + folder1.add(effectController, 'density', 0.0, 10.0, 0.001).onChange(dynamicValuesChanger); + + const folder2 = gui.addFolder('Static parameters'); + + folder2.add(effectController, 'radius', 10.0, 1000.0, 1.0); + folder2.add(effectController, 'height', 0.0, 50.0, 0.01); + folder2.add(effectController, 'exponent', 0.0, 2.0, 0.001); + folder2.add(effectController, 'maxMass', 1.0, 50.0, 0.1); + folder2.add(effectController, 'velocity', 0.0, 150.0, 0.1); + folder2.add(effectController, 'velocityExponent', 0.0, 1.0, 0.01); + folder2.add(effectController, 'randVelocity', 0.0, 50.0, 0.1); + + const buttonRestart = { + restartSimulation: function () { + restartSimulation(); + }, + }; + + folder2.add(buttonRestart, 'restartSimulation'); + + folder1.open(); + folder2.open(); +} + +function getCameraConstant(camera) { + return window.innerHeight / (Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * camera.fov) / camera.zoom); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + gpuCompute.compute(); + + particleUniforms['texturePosition'].value = gpuCompute.getCurrentRenderTarget(positionVariable).texture; + particleUniforms['textureVelocity'].value = gpuCompute.getCurrentRenderTarget(velocityVariable).texture; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_gpgpu_water.ts b/examples-testing/examples/webgl_gpgpu_water.ts new file mode 100644 index 000000000..6474339cf --- /dev/null +++ b/examples-testing/examples/webgl_gpgpu_water.ts @@ -0,0 +1,574 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; +import { SimplexNoise } from 'three/addons/math/SimplexNoise.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +// Texture width for simulation +const WIDTH = 128; + +// Water size in system units +const BOUNDS = 6; +const BOUNDS_HALF = BOUNDS * 0.5; + +let tmpHeightmap = null; +const tmpQuat = new THREE.Quaternion(); +const tmpQuatX = new THREE.Quaternion(); +const tmpQuatZ = new THREE.Quaternion(); +let duckModel = null; + +let container, stats; +let camera, scene, renderer, controls; +let mousedown = false; +const mouseCoords = new THREE.Vector2(); +const raycaster = new THREE.Raycaster(); + +let sun; +let waterMesh; +let poolBorder; +let meshRay; +let gpuCompute; +let heightmapVariable; +// let smoothShader; +let readWaterLevelShader; +let readWaterLevelRenderTarget; +let readWaterLevelImage; +const waterNormal = new THREE.Vector3(); + +const NUM_DUCK = 12; +const ducks = []; +let ducksEnabled = true; + +const simplex = new SimplexNoise(); + +let frame = 0; + +const effectController = { + mouseSize: 0.2, + mouseDeep: 0.01, + viscosity: 0.93, + speed: 5, + ducksEnabled: ducksEnabled, + wireframe: false, + shadow: false, +}; + +init(); + +async function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(0, 2.0, 4); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + + sun = new THREE.SunLight(0xffffff, 4.0); + sun.position.set(-1, 2.6, 1.4); + scene.add(sun); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.5; + container.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, container); + + stats = new Stats(); + container.appendChild(stats.dom); + + container.style.touchAction = 'none'; + container.addEventListener('pointermove', onPointerMove); + container.addEventListener('pointerdown', onPointerDown); + container.addEventListener('pointerup', onPointerUp); + + window.addEventListener('resize', onWindowResize); + + const hdrLoader = new HDRLoader().setPath('./textures/equirectangular/'); + const glbloader = new GLTFLoader().setPath('models/gltf/'); + glbloader.setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)); + + const [env, model] = await Promise.all([ + hdrLoader.loadAsync('blouberg_sunrise_2_1k.hdr'), + glbloader.loadAsync('duck.glb'), + ]); + env.mapping = THREE.EquirectangularReflectionMapping; + scene.environment = env; + scene.background = env; + scene.backgroundBlurriness = 0.3; + scene.environmentIntensity = 1.25; + + duckModel = model.scene.children[0]; + duckModel.receiveShadow = true; + duckModel.castShadow = true; + + const gui = new GUI(); + gui.domElement.style.right = '0px'; + + const valuesChanger = function () { + heightmapVariable.material.uniforms['mouseSize'].value = effectController.mouseSize; + heightmapVariable.material.uniforms['deep'].value = effectController.mouseDeep; + heightmapVariable.material.uniforms['viscosity'].value = effectController.viscosity; + ducksEnabled = effectController.ducksEnabled; + + let i = NUM_DUCK; + while (i--) { + if (ducks[i]) ducks[i].visible = ducksEnabled; + } + }; + + gui.add(effectController, 'mouseSize', 0.1, 1.0, 0.1).onChange(valuesChanger); + gui.add(effectController, 'mouseDeep', 0.01, 1.0, 0.01).onChange(valuesChanger); + gui.add(effectController, 'viscosity', 0.9, 0.999, 0.001).onChange(valuesChanger); + gui.add(effectController, 'speed', 1, 6, 1); + gui.add(effectController, 'ducksEnabled').onChange(valuesChanger); + gui.add(effectController, 'wireframe').onChange(v => { + waterMesh.material.wireframe = v; + poolBorder.material.wireframe = v; + }); + gui.add(effectController, 'shadow').onChange(addShadow); + + //const buttonSmooth = { smoothWater: function () {smoothWater();} }; + //gui.add( buttonSmooth, 'smoothWater' ); + + initWater(); + + createducks(); + + valuesChanger(); + + renderer.setAnimationLoop(animate); +} + +function initWater() { + const geometry = new THREE.PlaneGeometry(BOUNDS, BOUNDS, WIDTH - 1, WIDTH - 1); + + const material = new WaterMaterial({ + color: 0x9bd2ec, + metalness: 0.9, + roughness: 0, + transparent: true, + opacity: 0.8, + side: THREE.DoubleSide, + }); + + waterMesh = new THREE.Mesh(geometry, material); + waterMesh.rotation.x = -Math.PI * 0.5; + waterMesh.matrixAutoUpdate = false; + waterMesh.updateMatrix(); + + waterMesh.receiveShadow = true; + waterMesh.castShadow = true; + + scene.add(waterMesh); + + // pool border + const borderGeom = new THREE.TorusGeometry(4.2, 0.1, 12, 4); + borderGeom.rotateX(Math.PI * 0.5); + borderGeom.rotateY(Math.PI * 0.25); + poolBorder = new THREE.Mesh(borderGeom, new THREE.MeshStandardMaterial({ color: 0x908877, roughness: 0.2 })); + scene.add(poolBorder); + poolBorder.receiveShadow = true; + poolBorder.castShadow = true; + + // THREE.Mesh just for mouse raycasting + const geometryRay = new THREE.PlaneGeometry(BOUNDS, BOUNDS, 1, 1); + meshRay = new THREE.Mesh(geometryRay, new THREE.MeshBasicMaterial({ color: 0xffffff, visible: false })); + meshRay.rotation.x = -Math.PI / 2; + meshRay.matrixAutoUpdate = false; + meshRay.updateMatrix(); + scene.add(meshRay); + + // Creates the gpu computation class and sets it up + + gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); + + const heightmap0 = gpuCompute.createTexture(); + + fillTexture(heightmap0); + + heightmapVariable = gpuCompute.addVariable('heightmap', shaderChange.heightmap_frag, heightmap0); + + gpuCompute.setVariableDependencies(heightmapVariable, [heightmapVariable]); + + heightmapVariable.material.uniforms['mousePos'] = { value: new THREE.Vector2(10000, 10000) }; + heightmapVariable.material.uniforms['mouseSize'] = { value: 0.2 }; + heightmapVariable.material.uniforms['viscosity'] = { value: 0.93 }; + heightmapVariable.material.uniforms['deep'] = { value: 0.01 }; + heightmapVariable.material.defines.BOUNDS = BOUNDS.toFixed(1); + + const error = gpuCompute.init(); + if (error !== null) console.error(error); + + // Create compute shader to smooth the water surface and velocity + //smoothShader = gpuCompute.createShaderMaterial( document.getElementById( 'smoothFragmentShader' ).textContent, { smoothTexture: { value: null } } ); + + // Create compute shader to read water level + readWaterLevelShader = gpuCompute.createShaderMaterial( + document.getElementById('readWaterLevelFragmentShader').textContent, + { + point1: { value: new THREE.Vector2() }, + levelTexture: { value: null }, + }, + ); + readWaterLevelShader.defines.WIDTH = WIDTH.toFixed(1); + readWaterLevelShader.defines.BOUNDS = BOUNDS.toFixed(1); + + // Create a 4x1 pixel image and a render target (Uint8, 4 channels, 1 byte per channel) to read water height and orientation + readWaterLevelImage = new Uint8Array(4 * 1 * 4); + + readWaterLevelRenderTarget = new THREE.WebGLRenderTarget(4, 1, { + wrapS: THREE.ClampToEdgeWrapping, + wrapT: THREE.ClampToEdgeWrapping, + minFilter: THREE.NearestFilter, + magFilter: THREE.NearestFilter, + format: THREE.RGBAFormat, + type: THREE.UnsignedByteType, + depthBuffer: false, + }); +} + +function fillTexture(texture) { + const waterMaxHeight = 0.1; + + function noise(x, y) { + let multR = waterMaxHeight; + let mult = 0.025; + let r = 0; + for (let i = 0; i < 15; i++) { + r += multR * simplex.noise(x * mult, y * mult); + multR *= 0.53 + 0.025 * i; + mult *= 1.25; + } + + return r; + } + + const pixels = texture.image.data; + + let p = 0; + for (let j = 0; j < WIDTH; j++) { + for (let i = 0; i < WIDTH; i++) { + const x = (i * 128) / WIDTH; + const y = (j * 128) / WIDTH; + + pixels[p + 0] = noise(x, y); + pixels[p + 1] = pixels[p + 0]; + pixels[p + 2] = 0; + pixels[p + 3] = 1; + + p += 4; + } + } +} + +function addShadow(v) { + renderer.shadowMap.enabled = v; + sun.castShadow = v; + + if (v) { + renderer.shadowMap.type = THREE.VSMShadowMap; + const shadow = sun.shadow; + shadow.radius = 2; + shadow.bias = -0.0005; + shadow.camera.far = 6; + } else { + if (sun.shadow) sun.shadow.dispose(); + } +} + +// function smoothWater() { + +// const currentRenderTarget = gpuCompute.getCurrentRenderTarget( heightmapVariable ); +// const alternateRenderTarget = gpuCompute.getAlternateRenderTarget( heightmapVariable ); + +// for ( let i = 0; i < 10; i ++ ) { + +// smoothShader.uniforms[ 'smoothTexture' ].value = currentRenderTarget.texture; +// gpuCompute.doRenderTarget( smoothShader, alternateRenderTarget ); + +// smoothShader.uniforms[ 'smoothTexture' ].value = alternateRenderTarget.texture; +// gpuCompute.doRenderTarget( smoothShader, currentRenderTarget ); + +// } + +// } + +function createducks() { + for (let i = 0; i < NUM_DUCK; i++) { + let sphere = duckModel; + if (i < NUM_DUCK - 1) { + sphere = duckModel.clone(); + } + + sphere.position.x = (Math.random() - 0.5) * BOUNDS * 0.7; + sphere.position.z = (Math.random() - 0.5) * BOUNDS * 0.7; + + sphere.userData.velocity = new THREE.Vector3(); + + scene.add(sphere); + + ducks[i] = sphere; + } +} + +function duckDynamics() { + readWaterLevelShader.uniforms['levelTexture'].value = tmpHeightmap; + + for (let i = 0; i < NUM_DUCK; i++) { + const sphere = ducks[i]; + + if (sphere) { + // Read water level and orientation + const u = (0.5 * sphere.position.x) / BOUNDS_HALF + 0.5; + const v = 1 - ((0.5 * sphere.position.z) / BOUNDS_HALF + 0.5); + readWaterLevelShader.uniforms['point1'].value.set(u, v); + gpuCompute.doRenderTarget(readWaterLevelShader, readWaterLevelRenderTarget); + + renderer.readRenderTargetPixels(readWaterLevelRenderTarget, 0, 0, 4, 1, readWaterLevelImage); + const pixels = new Float32Array(readWaterLevelImage.buffer); + + // Get orientation + waterNormal.set(pixels[1], 0, -pixels[2]); + + const pos = sphere.position; + + const startPos = pos.clone(); + + // Set height + pos.y = pixels[0]; + + // Move sphere + waterNormal.multiplyScalar(0.01); + sphere.userData.velocity.add(waterNormal); + sphere.userData.velocity.multiplyScalar(0.998); + pos.add(sphere.userData.velocity); + + const decal = 0.001; + const limit = BOUNDS_HALF - 0.2; + + if (pos.x < -limit) { + pos.x = -limit + decal; + sphere.userData.velocity.x *= -0.3; + } else if (pos.x > limit) { + pos.x = limit - decal; + sphere.userData.velocity.x *= -0.3; + } + + if (pos.z < -limit) { + pos.z = -limit + decal; + sphere.userData.velocity.z *= -0.3; + } else if (pos.z > limit) { + pos.z = limit - decal; + sphere.userData.velocity.z *= -0.3; + } + + // duck orientation test + + const startNormal = new THREE.Vector3(pixels[1], 1, -pixels[2]).normalize(); + + const dir = startPos.sub(pos); + dir.y = 0; + dir.normalize(); + + const yAxis = new THREE.Vector3(0, 1, 0); + const zAxis = new THREE.Vector3(0, 0, -1); + tmpQuatX.setFromUnitVectors(zAxis, dir); + tmpQuatZ.setFromUnitVectors(yAxis, startNormal); + tmpQuat.multiplyQuaternions(tmpQuatZ, tmpQuatX); + sphere.quaternion.slerp(tmpQuat, 0.017); + } + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerDown() { + mousedown = true; +} + +function onPointerUp() { + mousedown = false; + controls.enabled = true; +} + +function onPointerMove(event) { + const dom = renderer.domElement; + mouseCoords.set((event.clientX / dom.clientWidth) * 2 - 1, -(event.clientY / dom.clientHeight) * 2 + 1); +} + +function raycast() { + // Set uniforms: mouse interaction + const uniforms = heightmapVariable.material.uniforms; + if (mousedown) { + raycaster.setFromCamera(mouseCoords, camera); + + const intersects = raycaster.intersectObject(meshRay); + + if (intersects.length > 0) { + const point = intersects[0].point; + uniforms['mousePos'].value.set(point.x, point.z); + if (controls.enabled) controls.enabled = false; + } else { + uniforms['mousePos'].value.set(10000, 10000); + } + } else { + uniforms['mousePos'].value.set(10000, 10000); + } +} + +function animate() { + render(); + stats.update(); +} + +function render() { + raycast(); + + frame++; + + if (frame >= 7 - effectController.speed) { + // Do the gpu computation + gpuCompute.compute(); + tmpHeightmap = gpuCompute.getCurrentRenderTarget(heightmapVariable).texture; + + if (ducksEnabled) duckDynamics(); + + // Get compute output in custom uniform + if (waterMesh) waterMesh.material.heightmap = tmpHeightmap; + + frame = 0; + } + + // Render + renderer.render(scene, camera); +} + +//---------------------- + +class WaterMaterial extends THREE.MeshStandardMaterial { + constructor(parameters) { + super(); + + this.defines = { + STANDARD: '', + USE_UV: '', + WIDTH: WIDTH.toFixed(1), + BOUNDS: BOUNDS.toFixed(1), + }; + + this.extra = {}; + + this.addParameter('heightmap', null); + + this.setValues(parameters); + } + + addParameter(name, value) { + this.extra[name] = value; + Object.defineProperty(this, name, { + get: () => this.extra[name], + set: v => { + this.extra[name] = v; + if (this.userData.shader) this.userData.shader.uniforms[name].value = this.extra[name]; + }, + }); + } + + onBeforeCompile(shader) { + for (const name in this.extra) { + shader.uniforms[name] = { value: this.extra[name] }; + } + + shader.vertexShader = shader.vertexShader.replace('#include ', shaderChange.common); + //shader.vertexShader = 'uniform sampler2D heightmap;\n' + shader.vertexShader; + shader.vertexShader = shader.vertexShader.replace( + '#include ', + shaderChange.beginnormal_vertex, + ); + shader.vertexShader = shader.vertexShader.replace('#include ', shaderChange.begin_vertex); + + this.userData.shader = shader; + } +} + +const shaderChange = { + heightmap_frag: /* glsl */ ` + #include + + uniform vec2 mousePos; + uniform float mouseSize; + uniform float viscosity; + uniform float deep; + + void main() { + + vec2 cellSize = 1.0 / resolution.xy; + + vec2 uv = gl_FragCoord.xy * cellSize; + + // heightmapValue.x == height from previous frame + // heightmapValue.y == height from penultimate frame + // heightmapValue.z, heightmapValue.w not used + vec4 heightmapValue = texture2D( heightmap, uv ); + + // Get neighbours + vec4 north = texture2D( heightmap, uv + vec2( 0.0, cellSize.y ) ); + vec4 south = texture2D( heightmap, uv + vec2( 0.0, - cellSize.y ) ); + vec4 east = texture2D( heightmap, uv + vec2( cellSize.x, 0.0 ) ); + vec4 west = texture2D( heightmap, uv + vec2( - cellSize.x, 0.0 ) ); + + //float newHeight = ( ( north.x + south.x + east.x + west.x ) * 0.5 - heightmapValue.y ) * viscosity; + float newHeight = ( ( north.x + south.x + east.x + west.x ) * 0.5 - (heightmapValue.y) ) * viscosity; + + + // Mouse influence + float mousePhase = clamp( length( ( uv - vec2( 0.5 ) ) * BOUNDS - vec2( mousePos.x, - mousePos.y ) ) * PI / mouseSize, 0.0, PI ); + //newHeight += ( cos( mousePhase ) + 1.0 ) * 0.28 * 10.0; + newHeight -= ( cos( mousePhase ) + 1.0 ) * deep; + + heightmapValue.y = heightmapValue.x; + heightmapValue.x = newHeight; + + gl_FragColor = heightmapValue; + + } + `, + // FOR MATERIAL + common: /* glsl */ ` + #include + uniform sampler2D heightmap; + `, + beginnormal_vertex: /* glsl */ ` + vec2 cellSize = vec2( 1.0 / WIDTH, 1.0 / WIDTH ); + vec3 objectNormal = vec3( + ( texture2D( heightmap, uv + vec2( - cellSize.x, 0 ) ).x - texture2D( heightmap, uv + vec2( cellSize.x, 0 ) ).x ) * WIDTH / BOUNDS, + ( texture2D( heightmap, uv + vec2( 0, - cellSize.y ) ).x - texture2D( heightmap, uv + vec2( 0, cellSize.y ) ).x ) * WIDTH / BOUNDS, + 1.0 ); + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `, + begin_vertex: /* glsl */ ` + float heightValue = texture2D( heightmap, uv ).x; + vec3 transformed = vec3( position.x, position.y, heightValue ); + #ifdef USE_ALPHAHASH + vPosition = vec3( position ); + #endif + `, +}; diff --git a/examples-testing/examples/webgl_helpers.ts b/examples-testing/examples/webgl_helpers.ts new file mode 100644 index 000000000..a8c3b9773 --- /dev/null +++ b/examples-testing/examples/webgl_helpers.ts @@ -0,0 +1,117 @@ +import * as THREE from 'three'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { VertexNormalsHelper } from 'three/addons/helpers/VertexNormalsHelper.js'; +import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js'; + +let scene, renderer; +let camera, light; +let vnh; +let vth; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 400; + + scene = new THREE.Scene(); + + light = new THREE.PointLight(); + light.position.set(200, 100, 150); + scene.add(light); + + scene.add(new THREE.PointLightHelper(light, 15)); + + const gridHelper = new THREE.GridHelper(400, 40, 0x0000ff, 0x808080); + gridHelper.position.y = -150; + gridHelper.position.x = -150; + scene.add(gridHelper); + + const polarGridHelper = new THREE.PolarGridHelper(200, 16, 8, 64, 0x0000ff, 0x808080); + polarGridHelper.position.y = -150; + polarGridHelper.position.x = 200; + scene.add(polarGridHelper); + + const loader = new GLTFLoader(); + loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + + mesh.geometry.computeTangents(); // generates bad data due to degenerate UVs + + const group = new THREE.Group(); + group.scale.multiplyScalar(50); + scene.add(group); + + // To make sure that the matrixWorld is up to date for the boxhelpers + group.updateMatrixWorld(true); + + group.add(mesh); + + vnh = new VertexNormalsHelper(mesh, 5); + scene.add(vnh); + + vth = new VertexTangentsHelper(mesh, 5); + scene.add(vth); + + scene.add(new THREE.BoxHelper(mesh)); + + const wireframe = new THREE.WireframeGeometry(mesh.geometry); + let line = new THREE.LineSegments(wireframe); + line.material.depthTest = false; + line.material.opacity = 0.25; + line.material.transparent = true; + line.position.x = 4; + group.add(line); + scene.add(new THREE.BoxHelper(line)); + + const edges = new THREE.EdgesGeometry(mesh.geometry); + line = new THREE.LineSegments(edges); + line.material.depthTest = false; + line.material.opacity = 0.25; + line.material.transparent = true; + line.position.x = -4; + group.add(line); + scene.add(new THREE.BoxHelper(line)); + + scene.add(new THREE.BoxHelper(group)); + scene.add(new THREE.BoxHelper(scene)); + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = -performance.now() * 0.0003; + + camera.position.x = 400 * Math.cos(time); + camera.position.z = 400 * Math.sin(time); + camera.lookAt(scene.position); + + light.position.x = Math.sin(time * 1.7) * 300; + light.position.y = Math.cos(time * 1.5) * 400; + light.position.z = Math.cos(time * 1.3) * 300; + + if (vnh) vnh.update(); + if (vth) vth.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_instancing_dynamic.ts b/examples-testing/examples/webgl_instancing_dynamic.ts new file mode 100644 index 000000000..bc4a88662 --- /dev/null +++ b/examples-testing/examples/webgl_instancing_dynamic.ts @@ -0,0 +1,175 @@ +import * as THREE from 'three'; + +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import TWEEN from 'three/addons/libs/tween.module.js'; + +let camera, scene, renderer, timer, mesh; + +const amount = 100; + +const count = Math.pow(amount, 2); +const dummy = new THREE.Object3D(); + +const seeds = []; +const baseColors = []; + +const color = new THREE.Color(); +const colors = [new THREE.Color(0x00ffff), new THREE.Color(0xffff00), new THREE.Color(0xff00ff)]; +const animation = { t: 0 }; +let currentColorIndex = 0; +let nextColorIndex = 1; + +const maxDistance = 75; +const cameraTarget = new THREE.Vector3(); + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(10, 10, 10); + camera.lookAt(0, 0, 0); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xadd8e6); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + + timer = new THREE.Timer(); + timer.connect(document); + + const loader = new THREE.TextureLoader(); + const texture = loader.load('textures/edge3.jpg'); + texture.colorSpace = THREE.SRGBColorSpace; + + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshStandardMaterial({ map: texture }); + + mesh = new THREE.InstancedMesh(geometry, material, count); + mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame + scene.add(mesh); + + let i = 0; + const offset = (amount - 1) / 2; + + for (let x = 0; x < amount; x++) { + for (let z = 0; z < amount; z++) { + dummy.position.set(offset - x, 0, offset - z); + dummy.scale.set(1, 2, 1); + + dummy.updateMatrix(); + + color.setHSL(1, 0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5); + baseColors.push(color.getHex()); + + mesh.setMatrixAt(i, dummy.matrix); + mesh.setColorAt(i, color.multiply(colors[0])); + + i++; + + seeds.push(Math.random()); + } + } + + // + + window.addEventListener('resize', onWindowResize); + + setInterval(startTween, 3000); +} + +function startTween() { + // tween for animating color transition + + new TWEEN.Tween(animation) + .to( + { + t: 1, + }, + 2000, + ) + .easing(TWEEN.Easing.Sinusoidal.In) + .onComplete(() => { + animation.t = 0; + + currentColorIndex = nextColorIndex; + nextColorIndex++; + + if (nextColorIndex >= colors.length) nextColorIndex = 0; + }) + .start(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const time = timer.getElapsed(); + + TWEEN.update(); + + // animate camera + + camera.position.x = Math.sin(time / 4) * 10; + camera.position.z = Math.cos(time / 4) * 10; + camera.position.y = 8 + Math.cos(time / 2) * 2; + + cameraTarget.x = Math.sin(time / 4) * -8; + cameraTarget.z = Math.cos(time / 2) * -8; + + camera.lookAt(cameraTarget); + + camera.up.x = Math.sin(time / 400); + + // animate instance positions and colors + + for (let i = 0; i < mesh.count; i++) { + mesh.getMatrixAt(i, dummy.matrix); + dummy.matrix.decompose(dummy.position, dummy.quaternion, dummy.scale); + + dummy.position.y = Math.abs(Math.sin((time + seeds[i]) * 2 + seeds[i])); + + dummy.updateMatrix(); + + mesh.setMatrixAt(i, dummy.matrix); + + // colors + + if (animation.t > 0) { + const currentColor = colors[currentColorIndex]; + const nextColor = colors[nextColorIndex]; + + const f = dummy.position.length() / maxDistance; + + if (f <= animation.t) { + color.set(baseColors[i]).multiply(nextColor); + } else { + color.set(baseColors[i]).multiply(currentColor); + } + + mesh.setColorAt(i, color); + } + } + + mesh.instanceMatrix.needsUpdate = true; + if (animation.t > 0) mesh.instanceColor.needsUpdate = true; + + mesh.computeBoundingSphere(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_instancing_morph.ts b/examples-testing/examples/webgl_instancing_morph.ts new file mode 100644 index 000000000..fd3e66786 --- /dev/null +++ b/examples-testing/examples/webgl_instancing_morph.ts @@ -0,0 +1,143 @@ +import * as THREE from 'three'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats, mesh, mixer, dummy; + +const offset = 5000; + +const timeOffsets = new Float32Array(1024); + +for (let i = 0; i < 1024; i++) { + timeOffsets[i] = Math.random() * 3; +} + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 100, 10000); + + scene = new THREE.Scene(); + + scene.background = new THREE.Color(0x99ddff); + + scene.fog = new THREE.Fog(0x99ddff, 5000, 10000); + + const light = new THREE.SunLight(0xffffff, 2); + + light.position.set(200, 1000, 50); + + light.castShadow = true; + + light.shadow.camera.far = 10000; + + light.shadow.mapSize.setScalar(2048); + + scene.add(light); + + const hemi = new THREE.HemisphereLight(0x99ddff, 0x669933, 0.5); + + scene.add(hemi); + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(1000000, 1000000), + new THREE.MeshStandardMaterial({ color: 0x669933, depthWrite: true }), + ); + + ground.rotation.x = -Math.PI / 2; + + ground.receiveShadow = true; + + scene.add(ground); + + const loader = new GLTFLoader(); + + loader.load('models/gltf/Horse.glb', function (glb) { + dummy = glb.scene.children[0]; + + mesh = new THREE.InstancedMesh(dummy.geometry, dummy.material, 1024); + + mesh.castShadow = true; + + for (let x = 0, i = 0; x < 32; x++) { + for (let y = 0; y < 32; y++) { + dummy.position.set(offset - 300 * x + 200 * Math.random(), 0, offset - 300 * y); + + dummy.updateMatrix(); + + mesh.setMatrixAt(i, dummy.matrix); + + mesh.setColorAt(i, new THREE.Color(`hsl(${Math.random() * 360}, 50%, 66%)`)); + + i++; + } + } + + scene.add(mesh); + + mixer = new THREE.AnimationMixer(glb.scene); + + const action = mixer.clipAction(glb.animations[0]); + + action.play(); + }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + renderer.shadowMap.enabled = true; + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + render(); + + stats.update(); +} + +function render() { + const time = timer.getElapsed(); + + const r = 3000; + camera.position.set(Math.sin(time / 10) * r, 1500 + 1000 * Math.cos(time / 5), Math.cos(time / 10) * r); + camera.lookAt(0, 0, 0); + + if (mesh) { + for (let i = 0; i < 1024; i++) { + mixer.setTime(time + timeOffsets[i]); + + mesh.setMorphAt(i, dummy); + } + + mesh.morphTexture.needsUpdate = true; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_instancing_performance.ts b/examples-testing/examples/webgl_instancing_performance.ts new file mode 100644 index 000000000..bf1deabad --- /dev/null +++ b/examples-testing/examples/webgl_instancing_performance.ts @@ -0,0 +1,262 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +let container, stats, gui, guiStatsEl; +let camera, controls, scene, renderer, material; + +// gui + +const Method = { + INSTANCED: 'INSTANCED', + MERGED: 'MERGED', + NAIVE: 'NAIVE', +}; + +const api = { + method: Method.INSTANCED, + count: 1000, +}; + +// + +init(); +initMesh(); + +// + +function clean() { + const meshes = []; + + scene.traverse(function (object) { + if (object.isMesh) meshes.push(object); + }); + + for (let i = 0; i < meshes.length; i++) { + const mesh = meshes[i]; + mesh.material.dispose(); + mesh.geometry.dispose(); + + scene.remove(mesh); + } +} + +const randomizeMatrix = (function () { + const position = new THREE.Vector3(); + const quaternion = new THREE.Quaternion(); + const scale = new THREE.Vector3(); + + return function (matrix) { + position.x = Math.random() * 40 - 20; + position.y = Math.random() * 40 - 20; + position.z = Math.random() * 40 - 20; + + quaternion.random(); + + scale.x = scale.y = scale.z = Math.random() * 1; + + matrix.compose(position, quaternion, scale); + }; +})(); + +function initMesh() { + clean(); + + // make instances + new THREE.BufferGeometryLoader().setPath('models/json/').load('suzanne_buffergeometry.json', function (geometry) { + material = new THREE.MeshNormalMaterial(); + + geometry.computeVertexNormals(); + + console.time(api.method + ' (build)'); + + switch (api.method) { + case Method.INSTANCED: + makeInstanced(geometry); + break; + + case Method.MERGED: + makeMerged(geometry); + break; + + case Method.NAIVE: + makeNaive(geometry); + break; + } + + console.timeEnd(api.method + ' (build)'); + }); +} + +function makeInstanced(geometry) { + const matrix = new THREE.Matrix4(); + const mesh = new THREE.InstancedMesh(geometry, material, api.count); + + for (let i = 0; i < api.count; i++) { + randomizeMatrix(matrix); + mesh.setMatrixAt(i, matrix); + } + + scene.add(mesh); + + // + + const geometryByteLength = getGeometryByteLength(geometry); + + guiStatsEl.innerHTML = [ + 'GPU draw calls: 1', + 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), + ].join('
'); +} + +function makeMerged(geometry) { + const geometries = []; + const matrix = new THREE.Matrix4(); + + for (let i = 0; i < api.count; i++) { + randomizeMatrix(matrix); + + const instanceGeometry = geometry.clone(); + instanceGeometry.applyMatrix4(matrix); + + geometries.push(instanceGeometry); + } + + const mergedGeometry = BufferGeometryUtils.mergeGeometries(geometries); + + scene.add(new THREE.Mesh(mergedGeometry, material)); + + // + + guiStatsEl.innerHTML = [ + 'GPU draw calls: 1', + 'GPU memory: ' + formatBytes(getGeometryByteLength(mergedGeometry), 2), + ].join('
'); +} + +function makeNaive(geometry) { + const matrix = new THREE.Matrix4(); + + for (let i = 0; i < api.count; i++) { + randomizeMatrix(matrix); + + const mesh = new THREE.Mesh(geometry, material); + mesh.applyMatrix4(matrix); + + scene.add(mesh); + } + + // + + const geometryByteLength = getGeometryByteLength(geometry); + + guiStatsEl.innerHTML = [ + 'GPU draw calls: ' + api.count, + 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), + ].join('
'); +} + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + + // camera + + camera = new THREE.PerspectiveCamera(70, width / height, 1, 100); + camera.position.z = 30; + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + + // stats + + stats = new Stats(); + container.appendChild(stats.dom); + + // gui + + gui = new GUI(); + gui.add(api, 'method', Method).onChange(initMesh); + gui.add(api, 'count', 1, 10000).step(1).onChange(initMesh); + + const perfFolder = gui.addFolder('Performance'); + + guiStatsEl = document.createElement('div'); + guiStatsEl.classList.add('gui-stats'); + + perfFolder.$children.appendChild(guiStatsEl); + perfFolder.open(); + + // listeners + + window.addEventListener('resize', onWindowResize); + + Object.assign(window, { scene }); +} + +// + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); + + stats.update(); +} + +// + +function getGeometryByteLength(geometry) { + let total = 0; + + if (geometry.index) total += geometry.index.array.byteLength; + + for (const name in geometry.attributes) { + total += geometry.attributes[name].array.byteLength; + } + + return total; +} + +// Source: https://stackoverflow.com/a/18650828/1314762 +function formatBytes(bytes, decimals) { + if (bytes === 0) return '0 bytes'; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['bytes', 'KB', 'MB']; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} diff --git a/examples-testing/examples/webgl_instancing_raycast.ts b/examples-testing/examples/webgl_instancing_raycast.ts new file mode 100644 index 000000000..371ea070b --- /dev/null +++ b/examples-testing/examples/webgl_instancing_raycast.ts @@ -0,0 +1,116 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, controls, stats; + +let mesh; +const amount = parseInt(window.location.search.slice(1)) || 10; +const count = Math.pow(amount, 3); + +const raycaster = new THREE.Raycaster(); +const mouse = new THREE.Vector2(1, 1); + +const color = new THREE.Color(); +const white = new THREE.Color().setHex(0xffffff); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(amount, amount, amount); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + + const light = new THREE.HemisphereLight(0xffffff, 0x888888, 3); + light.position.set(0, 1, 0); + scene.add(light); + + const geometry = new THREE.IcosahedronGeometry(0.5, 3); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff }); + + mesh = new THREE.InstancedMesh(geometry, material, count); + + let i = 0; + const offset = (amount - 1) / 2; + + const matrix = new THREE.Matrix4(); + + for (let x = 0; x < amount; x++) { + for (let y = 0; y < amount; y++) { + for (let z = 0; z < amount; z++) { + matrix.setPosition(offset - x, offset - y, offset - z); + + mesh.setMatrixAt(i, matrix); + mesh.setColorAt(i, color); + + i++; + } + } + } + + scene.add(mesh); + + // + + const gui = new GUI(); + gui.add(mesh, 'count', 0, count); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.enableZoom = false; + controls.enablePan = false; + + stats = new Stats(); + document.body.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); + document.addEventListener('mousemove', onMouseMove); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onMouseMove(event) { + event.preventDefault(); + + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +function animate() { + controls.update(); + + raycaster.setFromCamera(mouse, camera); + + const intersection = raycaster.intersectObject(mesh); + + if (intersection.length > 0) { + const instanceId = intersection[0].instanceId; + + mesh.getColorAt(instanceId, color); + + if (color.equals(white)) { + mesh.setColorAt(instanceId, color.setHex(Math.random() * 0xffffff)); + + mesh.instanceColor.needsUpdate = true; + } + } + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_instancing_scatter.ts b/examples-testing/examples/webgl_instancing_scatter.ts new file mode 100644 index 000000000..fc3b9cc9f --- /dev/null +++ b/examples-testing/examples/webgl_instancing_scatter.ts @@ -0,0 +1,257 @@ +import * as THREE from 'three'; + +import { MeshSurfaceSampler } from 'three/addons/math/MeshSurfaceSampler.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, stats; + +const api = { + count: 2000, + distribution: 'random', + resample: resample, + surfaceColor: 0xfff784, + backgroundColor: 0xe39469, +}; + +let stemMesh, blossomMesh; +let stemGeometry, blossomGeometry; +let stemMaterial, blossomMaterial; + +let sampler; +const count = api.count; +const ages = new Float32Array(count); +const scales = new Float32Array(count); +const dummy = new THREE.Object3D(); + +const _position = new THREE.Vector3(); +const _normal = new THREE.Vector3(); +const _scale = new THREE.Vector3(); + +// let surfaceGeometry = new THREE.BoxGeometry( 10, 10, 10 ).toNonIndexed(); +const surfaceGeometry = new THREE.TorusKnotGeometry(10, 3, 100, 16).toNonIndexed(); +const surfaceMaterial = new THREE.MeshLambertMaterial({ color: api.surfaceColor, wireframe: false }); +const surface = new THREE.Mesh(surfaceGeometry, surfaceMaterial); + +// Source: https://gist.github.com/gre/1650294 +const easeOutCubic = function (t) { + return --t * t * t + 1; +}; + +// Scaling curve causes particles to grow quickly, ease gradually into full scale, then +// disappear quickly. More of the particle's lifetime is spent around full scale. +const scaleCurve = function (t) { + return Math.abs(easeOutCubic((t > 0.5 ? 1 - t : t) * 2)); +}; + +const loader = new GLTFLoader(); + +loader.load('./models/gltf/Flower/Flower.glb', function (gltf) { + const _stemMesh = gltf.scene.getObjectByName('Stem'); + const _blossomMesh = gltf.scene.getObjectByName('Blossom'); + + stemGeometry = _stemMesh.geometry.clone(); + blossomGeometry = _blossomMesh.geometry.clone(); + + const defaultTransform = new THREE.Matrix4() + .makeRotationX(Math.PI) + .multiply(new THREE.Matrix4().makeScale(7, 7, 7)); + + stemGeometry.applyMatrix4(defaultTransform); + blossomGeometry.applyMatrix4(defaultTransform); + + stemMaterial = _stemMesh.material; + blossomMaterial = _blossomMesh.material; + + stemMesh = new THREE.InstancedMesh(stemGeometry, stemMaterial, count); + blossomMesh = new THREE.InstancedMesh(blossomGeometry, blossomMaterial, count); + + // Assign random colors to the blossoms. + const color = new THREE.Color(); + const blossomPalette = [0xf20587, 0xf2d479, 0xf2c879, 0xf2b077, 0xf24405]; + + for (let i = 0; i < count; i++) { + color.setHex(blossomPalette[Math.floor(Math.random() * blossomPalette.length)]); + blossomMesh.setColorAt(i, color); + } + + // Instance matrices will be updated every frame. + stemMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); + blossomMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); + + resample(); + + init(); +}); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(25, 25, 25); + camera.lookAt(0, 0, 0); + + // + + scene = new THREE.Scene(); + scene.background = new THREE.Color(api.backgroundColor); + + const pointLight = new THREE.PointLight(0xaa8899, 2.5, 0, 0); + pointLight.position.set(50, -25, 75); + scene.add(pointLight); + + scene.add(new THREE.AmbientLight(0xffffff, 3)); + + // + + scene.add(stemMesh); + scene.add(blossomMesh); + + scene.add(surface); + + // + + const gui = new GUI(); + gui.add(api, 'count', 0, count).onChange(function () { + stemMesh.count = api.count; + blossomMesh.count = api.count; + }); + + // gui.addColor( api, 'backgroundColor' ).onChange( function () { + + // scene.background.setHex( api.backgroundColor ); + + // } ); + + // gui.addColor( api, 'surfaceColor' ).onChange( function () { + + // surfaceMaterial.color.setHex( api.surfaceColor ); + + // } ); + + gui.add(api, 'distribution').options(['random', 'weighted']).onChange(resample); + gui.add(api, 'resample'); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function resample() { + const vertexCount = surface.geometry.getAttribute('position').count; + + console.info('Sampling ' + count + ' points from a surface with ' + vertexCount + ' vertices...'); + + // + + console.time('.build()'); + + sampler = new MeshSurfaceSampler(surface).setWeightAttribute(api.distribution === 'weighted' ? 'uv' : null).build(); + + console.timeEnd('.build()'); + + // + + console.time('.sample()'); + + for (let i = 0; i < count; i++) { + ages[i] = Math.random(); + scales[i] = scaleCurve(ages[i]); + + resampleParticle(i); + } + + console.timeEnd('.sample()'); + + stemMesh.instanceMatrix.needsUpdate = true; + blossomMesh.instanceMatrix.needsUpdate = true; +} + +function resampleParticle(i) { + sampler.sample(_position, _normal); + _normal.add(_position); + + dummy.position.copy(_position); + dummy.scale.set(scales[i], scales[i], scales[i]); + dummy.lookAt(_normal); + dummy.updateMatrix(); + + stemMesh.setMatrixAt(i, dummy.matrix); + blossomMesh.setMatrixAt(i, dummy.matrix); +} + +function updateParticle(i) { + // Update lifecycle. + + ages[i] += 0.005; + + if (ages[i] >= 1) { + ages[i] = 0.001; + scales[i] = scaleCurve(ages[i]); + + resampleParticle(i); + + return; + } + + // Update scale. + + const prevScale = scales[i]; + scales[i] = scaleCurve(ages[i]); + _scale.set(scales[i] / prevScale, scales[i] / prevScale, scales[i] / prevScale); + + // Update transform. + + stemMesh.getMatrixAt(i, dummy.matrix); + dummy.matrix.scale(_scale); + stemMesh.setMatrixAt(i, dummy.matrix); + blossomMesh.setMatrixAt(i, dummy.matrix); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + render(); + + stats.update(); +} + +function render() { + if (stemMesh && blossomMesh) { + const time = Date.now() * 0.001; + + scene.rotation.x = Math.sin(time / 4); + scene.rotation.y = Math.sin(time / 2); + + for (let i = 0; i < api.count; i++) { + updateParticle(i); + } + + stemMesh.instanceMatrix.needsUpdate = true; + blossomMesh.instanceMatrix.needsUpdate = true; + + stemMesh.computeBoundingSphere(); + blossomMesh.computeBoundingSphere(); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_buffergeometry.ts b/examples-testing/examples/webgl_interactive_buffergeometry.ts new file mode 100644 index 000000000..1d6608b13 --- /dev/null +++ b/examples-testing/examples/webgl_interactive_buffergeometry.ts @@ -0,0 +1,244 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let camera, scene, renderer; + +let raycaster, pointer; + +let mesh, line; + +init(); + +function init() { + container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); + camera.position.z = 2750; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + scene.fog = new THREE.Fog(0x050505, 2000, 3500); + + // + + scene.add(new THREE.AmbientLight(0x444444, 3)); + + const light1 = new THREE.DirectionalLight(0xffffff, 1.5); + light1.position.set(1, 1, 1); + scene.add(light1); + + const light2 = new THREE.DirectionalLight(0xffffff, 4.5); + light2.position.set(0, -1, 0); + scene.add(light2); + + // + + const triangles = 5000; + + let geometry = new THREE.BufferGeometry(); + + const positions = new Float32Array(triangles * 3 * 3); + const normals = new Float32Array(triangles * 3 * 3); + const colors = new Float32Array(triangles * 3 * 3); + + const color = new THREE.Color(); + + const n = 800, + n2 = n / 2; // triangles spread in the cube + const d = 120, + d2 = d / 2; // individual triangle size + + const pA = new THREE.Vector3(); + const pB = new THREE.Vector3(); + const pC = new THREE.Vector3(); + + const cb = new THREE.Vector3(); + const ab = new THREE.Vector3(); + + for (let i = 0; i < positions.length; i += 9) { + // positions + + const x = Math.random() * n - n2; + const y = Math.random() * n - n2; + const z = Math.random() * n - n2; + + const ax = x + Math.random() * d - d2; + const ay = y + Math.random() * d - d2; + const az = z + Math.random() * d - d2; + + const bx = x + Math.random() * d - d2; + const by = y + Math.random() * d - d2; + const bz = z + Math.random() * d - d2; + + const cx = x + Math.random() * d - d2; + const cy = y + Math.random() * d - d2; + const cz = z + Math.random() * d - d2; + + positions[i] = ax; + positions[i + 1] = ay; + positions[i + 2] = az; + + positions[i + 3] = bx; + positions[i + 4] = by; + positions[i + 5] = bz; + + positions[i + 6] = cx; + positions[i + 7] = cy; + positions[i + 8] = cz; + + // flat face normals + + pA.set(ax, ay, az); + pB.set(bx, by, bz); + pC.set(cx, cy, cz); + + cb.subVectors(pC, pB); + ab.subVectors(pA, pB); + cb.cross(ab); + + cb.normalize(); + + const nx = cb.x; + const ny = cb.y; + const nz = cb.z; + + normals[i] = nx; + normals[i + 1] = ny; + normals[i + 2] = nz; + + normals[i + 3] = nx; + normals[i + 4] = ny; + normals[i + 5] = nz; + + normals[i + 6] = nx; + normals[i + 7] = ny; + normals[i + 8] = nz; + + // colors + + const vx = x / n + 0.5; + const vy = y / n + 0.5; + const vz = z / n + 0.5; + + color.setRGB(vx, vy, vz); + + colors[i] = color.r; + colors[i + 1] = color.g; + colors[i + 2] = color.b; + + colors[i + 3] = color.r; + colors[i + 4] = color.g; + colors[i + 5] = color.b; + + colors[i + 6] = color.r; + colors[i + 7] = color.g; + colors[i + 8] = color.b; + } + + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + geometry.setAttribute('normal', new THREE.BufferAttribute(normals, 3)); + geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3)); + + geometry.computeBoundingSphere(); + + let material = new THREE.MeshPhongMaterial({ + color: 0xaaaaaa, + specular: 0xffffff, + shininess: 250, + side: THREE.DoubleSide, + vertexColors: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + raycaster = new THREE.Raycaster(); + + pointer = new THREE.Vector2(); + + geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(4 * 3), 3)); + + material = new THREE.LineBasicMaterial({ color: 0xffffff, transparent: true }); + + line = new THREE.Line(geometry, material); + scene.add(line); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); + document.addEventListener('pointermove', onPointerMove); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.001; + + mesh.rotation.x = time * 0.15; + mesh.rotation.y = time * 0.25; + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObject(mesh); + + if (intersects.length > 0) { + const intersect = intersects[0]; + const face = intersect.face; + + const linePosition = line.geometry.attributes.position; + const meshPosition = mesh.geometry.attributes.position; + + linePosition.copyAt(0, meshPosition, face.a); + linePosition.copyAt(1, meshPosition, face.b); + linePosition.copyAt(2, meshPosition, face.c); + linePosition.copyAt(3, meshPosition, face.a); + + mesh.updateMatrix(); + + line.geometry.applyMatrix4(mesh.matrix); + + line.visible = true; + } else { + line.visible = false; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_cubes.ts b/examples-testing/examples/webgl_interactive_cubes.ts new file mode 100644 index 000000000..adfcfddf8 --- /dev/null +++ b/examples-testing/examples/webgl_interactive_cubes.ts @@ -0,0 +1,114 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let stats; +let camera, scene, raycaster, renderer; + +let INTERSECTED; +let theta = 0; + +const pointer = new THREE.Vector2(); +const radius = 5; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1).normalize(); + scene.add(light); + + const geometry = new THREE.BoxGeometry(); + + for (let i = 0; i < 2000; i++) { + const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); + + object.position.x = Math.random() * 40 - 20; + object.position.y = Math.random() * 40 - 20; + object.position.z = Math.random() * 40 - 20; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.x = Math.random() + 0.5; + object.scale.y = Math.random() + 0.5; + object.scale.z = Math.random() + 0.5; + + scene.add(object); + } + + raycaster = new THREE.Raycaster(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + document.addEventListener('mousemove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + theta += 0.1; + + camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); + camera.position.y = radius * Math.sin(THREE.MathUtils.degToRad(theta)); + camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); + camera.lookAt(scene.position); + + camera.updateMatrixWorld(); + + // find intersections + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObjects(scene.children, false); + + if (intersects.length > 0) { + if (INTERSECTED != intersects[0].object) { + if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + + INTERSECTED = intersects[0].object; + INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex(); + INTERSECTED.material.emissive.setHex(0xff0000); + } + } else { + if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + + INTERSECTED = null; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_cubes_gpu.ts b/examples-testing/examples/webgl_interactive_cubes_gpu.ts new file mode 100644 index 000000000..5b19d2085 --- /dev/null +++ b/examples-testing/examples/webgl_interactive_cubes_gpu.ts @@ -0,0 +1,231 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +let container, stats; +let camera, controls, scene, renderer; +let pickingTexture, pickingScene; +let highlightBox; + +const pickingData = []; + +const pointer = new THREE.Vector2(); +const offset = new THREE.Vector3(10, 10, 10); +const clearColor = new THREE.Color(); + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 500, 2000); + scene.add(light); + + const defaultMaterial = new THREE.MeshPhongMaterial({ + color: 0xffffff, + flatShading: true, + vertexColors: true, + shininess: 0, + }); + + // set up the picking texture to use a 32 bit integer so we can write and read integer ids from it + pickingScene = new THREE.Scene(); + pickingTexture = new THREE.WebGLRenderTarget(1, 1, { + type: THREE.IntType, + format: THREE.RGBAIntegerFormat, + internalFormat: 'RGBA32I', + }); + const pickingMaterial = new THREE.ShaderMaterial({ + glslVersion: THREE.GLSL3, + + vertexShader: /* glsl */ ` + attribute int id; + flat varying int vid; + void main() { + + vid = id; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + } + `, + + fragmentShader: /* glsl */ ` + layout(location = 0) out int out_id; + flat varying int vid; + + void main() { + + out_id = vid; + + } + `, + }); + + function applyId(geometry, id) { + const position = geometry.attributes.position; + const array = new Int16Array(position.count); + array.fill(id); + + const bufferAttribute = new THREE.Int16BufferAttribute(array, 1, false); + bufferAttribute.gpuType = THREE.IntType; + geometry.setAttribute('id', bufferAttribute); + } + + function applyVertexColors(geometry, color) { + const position = geometry.attributes.position; + const colors = []; + + for (let i = 0; i < position.count; i++) { + colors.push(color.r, color.g, color.b); + } + + geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + } + + const geometries = []; + const matrix = new THREE.Matrix4(); + const quaternion = new THREE.Quaternion(); + const color = new THREE.Color(); + + for (let i = 0; i < 5000; i++) { + const geometry = new THREE.BoxGeometry(); + + const position = new THREE.Vector3(); + position.x = Math.random() * 10000 - 5000; + position.y = Math.random() * 6000 - 3000; + position.z = Math.random() * 8000 - 4000; + + const rotation = new THREE.Euler(); + rotation.x = Math.random() * 2 * Math.PI; + rotation.y = Math.random() * 2 * Math.PI; + rotation.z = Math.random() * 2 * Math.PI; + + const scale = new THREE.Vector3(); + scale.x = Math.random() * 200 + 100; + scale.y = Math.random() * 200 + 100; + scale.z = Math.random() * 200 + 100; + + quaternion.setFromEuler(rotation); + matrix.compose(position, quaternion, scale); + + geometry.applyMatrix4(matrix); + + // give the geometry's vertices a random color to be displayed and an integer + // identifier as a vertex attribute so boxes can be identified after being merged. + applyVertexColors(geometry, color.setHex(Math.random() * 0xffffff)); + applyId(geometry, i); + + geometries.push(geometry); + + pickingData[i] = { + position: position, + rotation: rotation, + scale: scale, + }; + } + + const mergedGeometry = BufferGeometryUtils.mergeGeometries(geometries); + scene.add(new THREE.Mesh(mergedGeometry, defaultMaterial)); + pickingScene.add(new THREE.Mesh(mergedGeometry, pickingMaterial)); + + highlightBox = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshLambertMaterial({ color: 0xffff00 })); + scene.add(highlightBox); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + controls = new TrackballControls(camera, renderer.domElement); + controls.rotateSpeed = 1.0; + controls.zoomSpeed = 1.2; + controls.panSpeed = 0.8; + controls.noZoom = false; + controls.noPan = false; + controls.staticMoving = true; + controls.dynamicDampingFactor = 0.3; + + stats = new Stats(); + container.appendChild(stats.dom); + + renderer.domElement.addEventListener('pointermove', onPointerMove); +} + +// + +function onPointerMove(e) { + pointer.x = e.clientX; + pointer.y = e.clientY; +} + +function animate() { + render(); + stats.update(); +} + +function pick() { + // render the picking scene off-screen + // set the view offset to represent just a single pixel under the mouse + const dpr = window.devicePixelRatio; + camera.setViewOffset( + renderer.domElement.width, + renderer.domElement.height, + Math.floor(pointer.x * dpr), + Math.floor(pointer.y * dpr), + 1, + 1, + ); + + // render the scene + renderer.setRenderTarget(pickingTexture); + + // clear the background to - 1 meaning no item was hit + clearColor.setRGB(-1, -1, -1); + renderer.setClearColor(clearColor); + renderer.render(pickingScene, camera); + + // Restore active render target to canvas + renderer.setRenderTarget(null); + + // clear the view offset so rendering returns to normal + camera.clearViewOffset(); + + // create buffer for reading single pixel + const pixelBuffer = new Int32Array(4); + + // read the pixel + renderer.readRenderTargetPixelsAsync(pickingTexture, 0, 0, 1, 1, pixelBuffer).then(() => { + const id = pixelBuffer[0]; + if (id !== -1) { + // move our highlightBox so that it surrounds the picked object + const data = pickingData[id]; + highlightBox.position.copy(data.position); + highlightBox.rotation.copy(data.rotation); + highlightBox.scale.copy(data.scale).add(offset); + highlightBox.visible = true; + } else { + highlightBox.visible = false; + } + }); +} + +function render() { + controls.update(); + + pick(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_cubes_ortho.ts b/examples-testing/examples/webgl_interactive_cubes_ortho.ts new file mode 100644 index 000000000..520674b5f --- /dev/null +++ b/examples-testing/examples/webgl_interactive_cubes_ortho.ts @@ -0,0 +1,129 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let stats; +let camera, scene, raycaster, renderer; + +let theta = 0; +let INTERSECTED; + +const pointer = new THREE.Vector2(); +const radius = 25; +const frustumSize = 50; + +init(); + +function init() { + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera( + (frustumSize * aspect) / -2, + (frustumSize * aspect) / 2, + frustumSize / 2, + frustumSize / -2, + 0.1, + 100, + ); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1).normalize(); + scene.add(light); + + const geometry = new THREE.BoxGeometry(); + + for (let i = 0; i < 2000; i++) { + const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); + + object.position.x = Math.random() * 40 - 20; + object.position.y = Math.random() * 40 - 20; + object.position.z = Math.random() * 40 - 20; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.x = Math.random() + 0.5; + object.scale.y = Math.random() + 0.5; + object.scale.z = Math.random() + 0.5; + + scene.add(object); + } + + raycaster = new THREE.Raycaster(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + document.addEventListener('pointermove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const aspect = window.innerWidth / window.innerHeight; + + camera.left = (-frustumSize * aspect) / 2; + camera.right = (frustumSize * aspect) / 2; + camera.top = frustumSize / 2; + camera.bottom = -frustumSize / 2; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + theta += 0.1; + + camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); + camera.position.y = radius * Math.sin(THREE.MathUtils.degToRad(theta)); + camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); + camera.lookAt(scene.position); + + camera.updateMatrixWorld(); + + // find intersections + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObjects(scene.children, false); + + if (intersects.length > 0) { + if (INTERSECTED != intersects[0].object) { + if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + + INTERSECTED = intersects[0].object; + INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex(); + INTERSECTED.material.emissive.setHex(0xff0000); + } + } else { + if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + + INTERSECTED = null; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_lines.ts b/examples-testing/examples/webgl_interactive_lines.ts new file mode 100644 index 000000000..f81ad5b5f --- /dev/null +++ b/examples-testing/examples/webgl_interactive_lines.ts @@ -0,0 +1,151 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; +let camera, scene, raycaster, renderer, parentTransform, sphereInter; + +const pointer = new THREE.Vector2(); +const radius = 100; +let theta = 0; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 10000); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + const geometry = new THREE.SphereGeometry(5); + const material = new THREE.MeshBasicMaterial({ color: 0xff0000 }); + + sphereInter = new THREE.Mesh(geometry, material); + sphereInter.visible = false; + scene.add(sphereInter); + + const lineGeometry = new THREE.BufferGeometry(); + const points = []; + + const point = new THREE.Vector3(); + const direction = new THREE.Vector3(); + + for (let i = 0; i < 50; i++) { + direction.x += Math.random() - 0.5; + direction.y += Math.random() - 0.5; + direction.z += Math.random() - 0.5; + direction.normalize().multiplyScalar(10); + + point.add(direction); + points.push(point.x, point.y, point.z); + } + + lineGeometry.setAttribute('position', new THREE.Float32BufferAttribute(points, 3)); + + parentTransform = new THREE.Object3D(); + parentTransform.position.x = Math.random() * 40 - 20; + parentTransform.position.y = Math.random() * 40 - 20; + parentTransform.position.z = Math.random() * 40 - 20; + + parentTransform.rotation.x = Math.random() * 2 * Math.PI; + parentTransform.rotation.y = Math.random() * 2 * Math.PI; + parentTransform.rotation.z = Math.random() * 2 * Math.PI; + + parentTransform.scale.x = Math.random() + 0.5; + parentTransform.scale.y = Math.random() + 0.5; + parentTransform.scale.z = Math.random() + 0.5; + + for (let i = 0; i < 50; i++) { + let object; + + const lineMaterial = new THREE.LineBasicMaterial({ color: Math.random() * 0xffffff }); + + if (Math.random() > 0.5) { + object = new THREE.Line(lineGeometry, lineMaterial); + } else { + object = new THREE.LineSegments(lineGeometry, lineMaterial); + } + + object.position.x = Math.random() * 400 - 200; + object.position.y = Math.random() * 400 - 200; + object.position.z = Math.random() * 400 - 200; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.x = Math.random() + 0.5; + object.scale.y = Math.random() + 0.5; + object.scale.z = Math.random() + 0.5; + + parentTransform.add(object); + } + + scene.add(parentTransform); + + raycaster = new THREE.Raycaster(); + raycaster.params.Line.threshold = 3; + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + document.addEventListener('pointermove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + theta += 0.1; + + camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); + camera.position.y = radius * Math.sin(THREE.MathUtils.degToRad(theta)); + camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); + camera.lookAt(scene.position); + + camera.updateMatrixWorld(); + + // find intersections + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObjects(parentTransform.children, true); + + if (intersects.length > 0) { + sphereInter.visible = true; + sphereInter.position.copy(intersects[0].point); + } else { + sphereInter.visible = false; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_points.ts b/examples-testing/examples/webgl_interactive_points.ts new file mode 100644 index 000000000..b6be0df05 --- /dev/null +++ b/examples-testing/examples/webgl_interactive_points.ts @@ -0,0 +1,143 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +let renderer, scene, camera, stats; + +let particles; + +const PARTICLE_SIZE = 20; + +let raycaster, intersects; +let pointer, INTERSECTED; + +init(); + +function init() { + const container = document.getElementById('container'); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 250; + + // + + let boxGeometry = new THREE.BoxGeometry(200, 200, 200, 16, 16, 16); + + // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data + + boxGeometry.deleteAttribute('normal'); + boxGeometry.deleteAttribute('uv'); + + boxGeometry = BufferGeometryUtils.mergeVertices(boxGeometry); + + // + + const positionAttribute = boxGeometry.getAttribute('position'); + + const colors = []; + const sizes = []; + + const color = new THREE.Color(); + + for (let i = 0, l = positionAttribute.count; i < l; i++) { + color.setHSL(0.01 + 0.1 * (i / l), 1.0, 0.5); + color.toArray(colors, i * 3); + + sizes[i] = PARTICLE_SIZE * 0.5; + } + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', positionAttribute); + geometry.setAttribute('customColor', new THREE.Float32BufferAttribute(colors, 3)); + geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1)); + + // + + const material = new THREE.ShaderMaterial({ + uniforms: { + color: { value: new THREE.Color(0xffffff) }, + pointTexture: { value: new THREE.TextureLoader().load('textures/sprites/disc.png') }, + alphaTest: { value: 0.9 }, + }, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + }); + + // + + particles = new THREE.Points(geometry, material); + scene.add(particles); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + raycaster = new THREE.Raycaster(); + pointer = new THREE.Vector2(); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); + document.addEventListener('pointermove', onPointerMove); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + particles.rotation.x += 0.0005; + particles.rotation.y += 0.001; + + const geometry = particles.geometry; + const attributes = geometry.attributes; + + raycaster.setFromCamera(pointer, camera); + + intersects = raycaster.intersectObject(particles); + + if (intersects.length > 0) { + if (INTERSECTED != intersects[0].index) { + attributes.size.array[INTERSECTED] = PARTICLE_SIZE; + + INTERSECTED = intersects[0].index; + + attributes.size.array[INTERSECTED] = PARTICLE_SIZE * 1.25; + attributes.size.needsUpdate = true; + } + } else if (INTERSECTED !== null) { + attributes.size.array[INTERSECTED] = PARTICLE_SIZE; + attributes.size.needsUpdate = true; + INTERSECTED = null; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_raycasting_points.ts b/examples-testing/examples/webgl_interactive_raycasting_points.ts new file mode 100644 index 000000000..50b8d1e1d --- /dev/null +++ b/examples-testing/examples/webgl_interactive_raycasting_points.ts @@ -0,0 +1,223 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let renderer, scene, camera, stats; +let pointclouds; +let raycaster; +let intersection = null; +let spheresIndex = 0; +let timer; +let toggle = 0; + +const pointer = new THREE.Vector2(); +const spheres = []; + +const threshold = 0.1; +const pointSize = 0.05; +const width = 80; +const length = 160; +const rotateY = new THREE.Matrix4().makeRotationY(0.005); + +init(); + +function generatePointCloudGeometry(color, width, length) { + const geometry = new THREE.BufferGeometry(); + const numPoints = width * length; + + const positions = new Float32Array(numPoints * 3); + const colors = new Float32Array(numPoints * 3); + + let k = 0; + + for (let i = 0; i < width; i++) { + for (let j = 0; j < length; j++) { + const u = i / width; + const v = j / length; + const x = u - 0.5; + const y = (Math.cos(u * Math.PI * 4) + Math.sin(v * Math.PI * 8)) / 20; + const z = v - 0.5; + + positions[3 * k] = x; + positions[3 * k + 1] = y; + positions[3 * k + 2] = z; + + const intensity = (y + 0.1) * 5; + colors[3 * k] = color.r * intensity; + colors[3 * k + 1] = color.g * intensity; + colors[3 * k + 2] = color.b * intensity; + + k++; + } + } + + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3)); + geometry.computeBoundingBox(); + + return geometry; +} + +function generatePointcloud(color, width, length) { + const geometry = generatePointCloudGeometry(color, width, length); + const material = new THREE.PointsMaterial({ size: pointSize, vertexColors: true }); + + return new THREE.Points(geometry, material); +} + +function generateIndexedPointcloud(color, width, length) { + const geometry = generatePointCloudGeometry(color, width, length); + const numPoints = width * length; + const indices = new Uint16Array(numPoints); + + let k = 0; + + for (let i = 0; i < width; i++) { + for (let j = 0; j < length; j++) { + indices[k] = k; + k++; + } + } + + geometry.setIndex(new THREE.BufferAttribute(indices, 1)); + + const material = new THREE.PointsMaterial({ size: pointSize, vertexColors: true }); + + return new THREE.Points(geometry, material); +} + +function generateIndexedWithOffsetPointcloud(color, width, length) { + const geometry = generatePointCloudGeometry(color, width, length); + const numPoints = width * length; + const indices = new Uint16Array(numPoints); + + let k = 0; + + for (let i = 0; i < width; i++) { + for (let j = 0; j < length; j++) { + indices[k] = k; + k++; + } + } + + geometry.setIndex(new THREE.BufferAttribute(indices, 1)); + geometry.addGroup(0, indices.length); + + const material = new THREE.PointsMaterial({ size: pointSize, vertexColors: true }); + + return new THREE.Points(geometry, material); +} + +function init() { + const container = document.getElementById('container'); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(10, 10, 10); + camera.lookAt(scene.position); + camera.updateMatrix(); + + // + + const pcBuffer = generatePointcloud(new THREE.Color(1, 0, 0), width, length); + pcBuffer.scale.set(5, 10, 10); + pcBuffer.position.set(-5, 0, 0); + scene.add(pcBuffer); + + const pcIndexed = generateIndexedPointcloud(new THREE.Color(0, 1, 0), width, length); + pcIndexed.scale.set(5, 10, 10); + pcIndexed.position.set(0, 0, 0); + scene.add(pcIndexed); + + const pcIndexedOffset = generateIndexedWithOffsetPointcloud(new THREE.Color(0, 1, 1), width, length); + pcIndexedOffset.scale.set(5, 10, 10); + pcIndexedOffset.position.set(5, 0, 0); + scene.add(pcIndexedOffset); + + pointclouds = [pcBuffer, pcIndexed, pcIndexedOffset]; + + // + + const sphereGeometry = new THREE.SphereGeometry(0.1, 32, 32); + const sphereMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 }); + + for (let i = 0; i < 40; i++) { + const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); + scene.add(sphere); + spheres.push(sphere); + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + raycaster = new THREE.Raycaster(); + raycaster.params.Points.threshold = threshold; + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); + document.addEventListener('pointermove', onPointerMove); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + camera.applyMatrix4(rotateY); + camera.updateMatrixWorld(); + + raycaster.setFromCamera(pointer, camera); + + const intersections = raycaster.intersectObjects(pointclouds, false); + intersection = intersections.length > 0 ? intersections[0] : null; + + if (toggle > 0.02 && intersection !== null) { + spheres[spheresIndex].position.copy(intersection.point); + spheres[spheresIndex].scale.set(1, 1, 1); + spheresIndex = (spheresIndex + 1) % spheres.length; + + toggle = 0; + } + + for (let i = 0; i < spheres.length; i++) { + const sphere = spheres[i]; + sphere.scale.multiplyScalar(0.98); + sphere.scale.clampScalar(0.01, 1); + } + + toggle += timer.getDelta(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_interactive_voxelpainter.ts b/examples-testing/examples/webgl_interactive_voxelpainter.ts new file mode 100644 index 000000000..48b16f3b7 --- /dev/null +++ b/examples-testing/examples/webgl_interactive_voxelpainter.ts @@ -0,0 +1,158 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; +let plane; +let pointer, + raycaster, + isShiftDown = false; + +let rollOverMesh, rollOverMaterial; +let cubeGeo, cubeMaterial; + +const objects = []; + +init(); +render(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(500, 800, 1300); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + // roll-over helpers + + const rollOverGeo = new THREE.BoxGeometry(50, 50, 50); + rollOverMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, opacity: 0.5, transparent: true }); + rollOverMesh = new THREE.Mesh(rollOverGeo, rollOverMaterial); + scene.add(rollOverMesh); + + // cubes + + const map = new THREE.TextureLoader().load('textures/square-outline-textured.png'); + map.colorSpace = THREE.SRGBColorSpace; + cubeGeo = new THREE.BoxGeometry(50, 50, 50); + cubeMaterial = new THREE.MeshLambertMaterial({ color: 0xfeb74c, map: map }); + + // grid + + const gridHelper = new THREE.GridHelper(1000, 20); + scene.add(gridHelper); + + // + + raycaster = new THREE.Raycaster(); + pointer = new THREE.Vector2(); + + const geometry = new THREE.PlaneGeometry(1000, 1000); + geometry.rotateX(-Math.PI / 2); + + plane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ visible: false })); + scene.add(plane); + + objects.push(plane); + + // lights + + const ambientLight = new THREE.AmbientLight(0x606060, 3); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 3); + directionalLight.position.set(1, 0.75, 0.5).normalize(); + scene.add(directionalLight); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerdown', onPointerDown); + document.addEventListener('keydown', onDocumentKeyDown); + document.addEventListener('keyup', onDocumentKeyUp); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function onPointerMove(event) { + pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObjects(objects, false); + + if (intersects.length > 0) { + const intersect = intersects[0]; + + rollOverMesh.position.copy(intersect.point).add(intersect.face.normal); + rollOverMesh.position.divideScalar(50).floor().multiplyScalar(50).addScalar(25); + + render(); + } +} + +function onPointerDown(event) { + pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObjects(objects, false); + + if (intersects.length > 0) { + const intersect = intersects[0]; + + // delete cube + + if (isShiftDown) { + if (intersect.object !== plane) { + scene.remove(intersect.object); + + objects.splice(objects.indexOf(intersect.object), 1); + } + + // create cube + } else { + const voxel = new THREE.Mesh(cubeGeo, cubeMaterial); + voxel.position.copy(intersect.point).add(intersect.face.normal); + voxel.position.divideScalar(50).floor().multiplyScalar(50).addScalar(25); + scene.add(voxel); + + objects.push(voxel); + } + + render(); + } +} + +function onDocumentKeyDown(event) { + switch (event.keyCode) { + case 16: + isShiftDown = true; + break; + } +} + +function onDocumentKeyUp(event) { + switch (event.keyCode) { + case 16: + isShiftDown = false; + break; + } +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lensflares.ts b/examples-testing/examples/webgl_lensflares.ts new file mode 100644 index 000000000..0a55bec42 --- /dev/null +++ b/examples-testing/examples/webgl_lensflares.ts @@ -0,0 +1,140 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { FlyControls } from 'three/addons/controls/FlyControls.js'; +import { Lensflare, LensflareElement } from 'three/addons/objects/Lensflare.js'; + +let container, stats; + +let camera, scene, renderer; +let controls; + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // camera + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 15000); + camera.position.z = 250; + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color().setHSL(0.51, 0.4, 0.01, THREE.SRGBColorSpace); + scene.fog = new THREE.Fog(scene.background, 3500, 15000); + + // world + + const s = 250; + + const geometry = new THREE.BoxGeometry(s, s, s); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff, specular: 0xffffff, shininess: 50 }); + + for (let i = 0; i < 3000; i++) { + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = 8000 * (2.0 * Math.random() - 1.0); + mesh.position.y = 8000 * (2.0 * Math.random() - 1.0); + mesh.position.z = 8000 * (2.0 * Math.random() - 1.0); + + mesh.rotation.x = Math.random() * Math.PI; + mesh.rotation.y = Math.random() * Math.PI; + mesh.rotation.z = Math.random() * Math.PI; + + mesh.matrixAutoUpdate = false; + mesh.updateMatrix(); + + scene.add(mesh); + } + + // lights + + const dirLight = new THREE.DirectionalLight(0xffffff, 0.15); + dirLight.position.set(0, -1, 0).normalize(); + dirLight.color.setHSL(0.1, 0.7, 0.5); + scene.add(dirLight); + + // lensflares + const textureLoader = new THREE.TextureLoader(); + + const textureFlare0 = textureLoader.load('textures/lensflare/lensflare0.png'); + const textureFlare3 = textureLoader.load('textures/lensflare/lensflare3.png'); + + addLight(0.55, 0.9, 0.5, 5000, 0, -1000); + addLight(0.08, 0.8, 0.5, 0, 0, -1000); + addLight(0.995, 0.5, 0.9, 5000, 5000, -1000); + + function addLight(h, s, l, x, y, z) { + const light = new THREE.PointLight(0xffffff, 1.5, 2000, 0); + light.color.setHSL(h, s, l); + light.position.set(x, y, z); + scene.add(light); + + const lensflare = new Lensflare(); + lensflare.addElement(new LensflareElement(textureFlare0, 700, 0, light.color)); + lensflare.addElement(new LensflareElement(textureFlare3, 60, 0.6)); + lensflare.addElement(new LensflareElement(textureFlare3, 70, 0.7)); + lensflare.addElement(new LensflareElement(textureFlare3, 120, 0.9)); + lensflare.addElement(new LensflareElement(textureFlare3, 70, 1)); + light.add(lensflare); + } + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + controls = new FlyControls(camera, renderer.domElement); + + controls.movementSpeed = 2500; + controls.domElement = container; + controls.rollSpeed = Math.PI / 6; + controls.autoForward = false; + controls.dragToLook = false; + + // stats + + stats = new Stats(); + container.appendChild(stats.dom); + + // events + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +// + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + const delta = timer.getDelta(); + + controls.update(delta); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lightprobe.ts b/examples-testing/examples/webgl_lightprobe.ts new file mode 100644 index 000000000..58f021e6d --- /dev/null +++ b/examples-testing/examples/webgl_lightprobe.ts @@ -0,0 +1,142 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; + +import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; + +let mesh, renderer, scene, camera; + +let gui; + +let lightProbe; +let directionalLight; + +// linear color space +const API = { + lightProbeIntensity: 1.0, + directionalLightIntensity: 0.6, + envMapIntensity: 1, +}; + +init(); + +function init() { + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + // tone mapping + renderer.toneMapping = THREE.NoToneMapping; + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 30); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.minDistance = 10; + controls.maxDistance = 50; + controls.enablePan = false; + + // probe + lightProbe = new THREE.LightProbe(); + scene.add(lightProbe); + + // light + directionalLight = new THREE.DirectionalLight(0xffffff, API.directionalLightIntensity); + directionalLight.position.set(10, 10, 10); + scene.add(directionalLight); + + // envmap + const genCubeUrls = function (prefix, postfix) { + return [ + prefix + 'px' + postfix, + prefix + 'nx' + postfix, + prefix + 'py' + postfix, + prefix + 'ny' + postfix, + prefix + 'pz' + postfix, + prefix + 'nz' + postfix, + ]; + }; + + const urls = genCubeUrls('textures/cube/pisa/', '.png'); + + new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { + scene.background = cubeTexture; + + lightProbe.copy(LightProbeGenerator.fromCubeTexture(cubeTexture)); + lightProbe.intensity = API.lightProbeIntensity; + lightProbe.position.set(-10, 0, 0); // position not used in scene lighting calculations (helper honors the position, however) + + const geometry = new THREE.SphereGeometry(5, 64, 32); + //const geometry = new THREE.TorusKnotGeometry( 4, 1.5, 256, 32, 2, 3 ); + + const material = new THREE.MeshStandardMaterial({ + color: 0xffffff, + metalness: 0, + roughness: 0, + envMap: cubeTexture, + envMapIntensity: API.envMapIntensity, + }); + + // mesh + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // helper + const helper = new LightProbeHelper(lightProbe, 1); + scene.add(helper); + + render(); + }); + + // gui + gui = new GUI({ title: 'Intensity' }); + + gui.add(API, 'lightProbeIntensity', 0, 1, 0.02) + .name('light probe') + .onChange(function () { + lightProbe.intensity = API.lightProbeIntensity; + render(); + }); + + gui.add(API, 'directionalLightIntensity', 0, 1, 0.02) + .name('directional light') + .onChange(function () { + directionalLight.intensity = API.directionalLightIntensity; + render(); + }); + + gui.add(API, 'envMapIntensity', 0, 1, 0.02) + .name('envMap') + .onChange(function () { + mesh.material.envMapIntensity = API.envMapIntensity; + render(); + }); + + // listener + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lightprobe_cubecamera.ts b/examples-testing/examples/webgl_lightprobe_cubecamera.ts new file mode 100644 index 000000000..65425d4e7 --- /dev/null +++ b/examples-testing/examples/webgl_lightprobe_cubecamera.ts @@ -0,0 +1,85 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; +import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; + +let renderer, scene, camera, cubeCamera; + +let lightProbe; + +init(); + +function init() { + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 30); + + const cubeRenderTarget = new THREE.WebGLCubeRenderTarget(256); + + cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.minDistance = 10; + controls.maxDistance = 50; + controls.enablePan = false; + + // probe + lightProbe = new THREE.LightProbe(); + scene.add(lightProbe); + + // envmap + const genCubeUrls = function (prefix, postfix) { + return [ + prefix + 'px' + postfix, + prefix + 'nx' + postfix, + prefix + 'py' + postfix, + prefix + 'ny' + postfix, + prefix + 'pz' + postfix, + prefix + 'nz' + postfix, + ]; + }; + + const urls = genCubeUrls('textures/cube/pisa/', '.png'); + + new THREE.CubeTextureLoader().load(urls, async function (cubeTexture) { + scene.background = cubeTexture; + + cubeCamera.update(renderer, scene); + + const probe = await LightProbeGenerator.fromCubeRenderTarget(renderer, cubeRenderTarget); + + lightProbe.copy(probe); + + scene.add(new LightProbeHelper(lightProbe, 5)); + + render(); + }); + + // listener + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lightprobes.ts b/examples-testing/examples/webgl_lightprobes.ts new file mode 100644 index 000000000..1018f47a7 --- /dev/null +++ b/examples-testing/examples/webgl_lightprobes.ts @@ -0,0 +1,190 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; +import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; + +let camera, scene, renderer, controls; +let probes, probesHelper; + +init(); + +async function init() { + // Camera + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 2.5, 8); + + // Scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x111111); + + // Cornell box + + const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc }); + const redMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 }); + const greenMaterial = new THREE.MeshStandardMaterial({ color: 0x00ff00 }); + + // Floor + const floor = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); + floor.rotation.x = -Math.PI / 2; + floor.receiveShadow = true; + scene.add(floor); + + // Ceiling + const ceiling = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); + ceiling.rotation.x = Math.PI / 2; + ceiling.position.y = 5; + ceiling.receiveShadow = true; + scene.add(ceiling); + + // Back wall + const backWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); + backWall.position.set(0, 2.5, -3); + backWall.receiveShadow = true; + scene.add(backWall); + + // Front wall + const frontWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); + frontWall.rotation.y = Math.PI; + frontWall.position.set(0, 2.5, 3); + frontWall.receiveShadow = true; + scene.add(frontWall); + + // Left wall (red) + const leftWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), redMaterial); + leftWall.rotation.y = Math.PI / 2; + leftWall.position.set(-3, 2.5, 0); + leftWall.receiveShadow = true; + scene.add(leftWall); + + // Right wall (green) + const rightWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), greenMaterial); + rightWall.rotation.y = -Math.PI / 2; + rightWall.position.set(3, 2.5, 0); + rightWall.receiveShadow = true; + scene.add(rightWall); + + // Objects inside the box + + const objectMaterial = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); + + // Tall box + const tallBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 2.5, 1.2), objectMaterial); + tallBox.position.set(-0.8, 1.25, -0.8); + tallBox.rotation.y = Math.PI / 8; + tallBox.castShadow = true; + tallBox.receiveShadow = true; + scene.add(tallBox); + + // Short box + const shortBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 1.2, 1.2), objectMaterial); + shortBox.position.set(1, 0.6, 0.5); + shortBox.rotation.y = -Math.PI / 6; + shortBox.castShadow = true; + shortBox.receiveShadow = true; + scene.add(shortBox); + + // Sphere (to show smooth GI variation) + const sphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 32, 32), objectMaterial.clone()); + sphere.position.set(1, 1.9, 0.5); + sphere.castShadow = true; + sphere.receiveShadow = true; + scene.add(sphere); + + // Light + const light = new THREE.PointLight(0xffffff, 40); + light.position.set(0, 4.5, 0); + light.castShadow = true; + light.shadow.mapSize.setScalar(256); + light.shadow.radius = 10; + light.shadow.normalBias = -0.02; + scene.add(light); + + // Renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.0; + document.body.appendChild(renderer.domElement); + + // Controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2.5, 0); + controls.update(); + + // Bake light probe volume + + async function bake(resolution) { + if (probes) { + scene.remove(probes); + probes.dispose(); + } + + probes = new LightProbeGridWebGL(5.6, 4.7, 5.6, resolution, resolution, resolution); + probes.position.set(0, 2.45, 0); + probes.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); + probes.visible = params.enabled; + scene.add(probes); + + // Update debug visualization + + if (!probesHelper) { + probesHelper = new LightProbeGridHelperWebGL(probes); + probesHelper.visible = params.showProbes; + scene.add(probesHelper); + } else { + probesHelper.probes = probes; + probesHelper.update(); + } + } + + const params = { + enabled: true, + showProbes: false, + resolution: 6, + }; + + await bake(params.resolution); + + // GUI + + const gui = new GUI(); + gui.add(params, 'enabled') + .name('GI') + .onChange(value => { + probes.visible = value; + }); + gui.add(params, 'resolution', 2, 12, 1) + .name('Resolution') + .onFinishChange(value => { + bake(value); + }); + gui.add(params, 'showProbes') + .name('Show Probes') + .onChange(value => { + probesHelper.visible = value; + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lightprobes_complex.ts b/examples-testing/examples/webgl_lightprobes_complex.ts new file mode 100644 index 000000000..e15a909c3 --- /dev/null +++ b/examples-testing/examples/webgl_lightprobes_complex.ts @@ -0,0 +1,304 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; +import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; + +let camera, scene, renderer, controls; +let probesLeft, probesRight; +let probesHelperLeft, probesHelperRight; + +init(); + +async function init() { + // Camera + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 2.5, 16); + + // Scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x111111); + + // Materials + + const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc, side: THREE.BackSide }); + const whiteMat = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); + + // Room shell: x=-8 to 8, z=-4 to 4, y=0 to 5 + + const room = new THREE.Mesh(new THREE.BoxGeometry(16, 5, 8), wallMaterial); + room.position.set(0, 2.5, 0); + room.receiveShadow = true; + scene.add(room); + + const redWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0xdd2200 })); + redWall.rotation.y = Math.PI / 2; + redWall.position.set(-7.99, 2.5, 0); + scene.add(redWall); + + const blueWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0x0044ff })); + blueWall.rotation.y = -Math.PI / 2; + blueWall.position.set(7.99, 2.5, 0); + scene.add(blueWall); + + // Dividing wall at x=0 with doorway + + const dividerMat = new THREE.MeshStandardMaterial({ color: 0xcccccc }); + const doorwayHalfGap = 1.25; + + // Left section of divider (z = -4 to -1.25) + const dividerLeft = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); + dividerLeft.position.set(0, 2.5, -(doorwayHalfGap + (4 - doorwayHalfGap) / 2)); + dividerLeft.castShadow = true; + dividerLeft.receiveShadow = true; + scene.add(dividerLeft); + + // Right section of divider (z = 1.25 to 4) + const dividerRight = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); + dividerRight.position.set(0, 2.5, doorwayHalfGap + (4 - doorwayHalfGap) / 2); + dividerRight.castShadow = true; + dividerRight.receiveShadow = true; + scene.add(dividerRight); + + // Lintel above doorway + const lintel = new THREE.Mesh(new THREE.BoxGeometry(0.3, 1.2, doorwayHalfGap * 2), dividerMat); + lintel.position.set(0, 4.4, 0); + lintel.castShadow = true; + lintel.receiveShadow = true; + scene.add(lintel); + + // Left room objects + + // Columns + const columnGeom = new THREE.CylinderGeometry(0.3, 0.3, 4, 16); + + for (const x of [-6, -2]) { + for (const z of [-2.5, 2.5]) { + const col = new THREE.Mesh(columnGeom, whiteMat); + col.position.set(x, 2, z); + col.castShadow = true; + col.receiveShadow = true; + scene.add(col); + } + } + + // Table with golden sphere + const tableTop = new THREE.Mesh( + new THREE.BoxGeometry(2.4, 0.12, 1.4), + new THREE.MeshStandardMaterial({ color: 0x886644 }), + ); + tableTop.position.set(-4, 1.0, 0); + tableTop.castShadow = true; + tableTop.receiveShadow = true; + scene.add(tableTop); + + const legGeom = new THREE.BoxGeometry(0.1, 1, 0.1); + + for (const x of [-5.05, -2.95]) { + for (const z of [-0.55, 0.55]) { + const leg = new THREE.Mesh(legGeom, tableTop.material); + leg.position.set(x, 0.5, z); + leg.castShadow = true; + scene.add(leg); + } + } + + const sphere = new THREE.Mesh( + new THREE.SphereGeometry(0.35, 32, 32), + new THREE.MeshStandardMaterial({ color: 0xffd700, metalness: 0.3, roughness: 0.4 }), + ); + sphere.position.set(-4, 1.41, 0); + sphere.castShadow = true; + sphere.receiveShadow = true; + scene.add(sphere); + + // Stepped blocks near red wall + const step1 = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.5, 1), whiteMat); + step1.position.set(-7, 0.25, 0); + step1.castShadow = true; + step1.receiveShadow = true; + scene.add(step1); + + const step2 = new THREE.Mesh(new THREE.BoxGeometry(1.0, 1.0, 1), whiteMat); + step2.position.set(-7, 0.5, 0); + step2.castShadow = true; + step2.receiveShadow = true; + scene.add(step2); + + const step3 = new THREE.Mesh(new THREE.BoxGeometry(0.5, 1.5, 1), whiteMat); + step3.position.set(-7, 0.75, 0); + step3.castShadow = true; + step3.receiveShadow = true; + scene.add(step3); + + // Right room objects + + // Columns + for (const x of [2, 6]) { + for (const z of [-2.5, 2.5]) { + const col = new THREE.Mesh(columnGeom, whiteMat); + col.position.set(x, 2, z); + col.castShadow = true; + col.receiveShadow = true; + scene.add(col); + } + } + + // Pedestal with torus knot + const pedestal = new THREE.Mesh(new THREE.BoxGeometry(0.8, 1.2, 0.8), whiteMat); + pedestal.position.set(4, 0.6, 0); + pedestal.castShadow = true; + pedestal.receiveShadow = true; + scene.add(pedestal); + + const torusKnot = new THREE.Mesh( + new THREE.TorusKnotGeometry(0.3, 0.1, 64, 16), + new THREE.MeshStandardMaterial({ color: 0xff44aa, metalness: 0.2, roughness: 0.5 }), + ); + torusKnot.position.set(4, 1.65, 0); + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + // Tall cone sculpture + const sculpture = new THREE.Mesh(new THREE.ConeGeometry(0.4, 2.5, 5), whiteMat); + sculpture.position.set(6.5, 1.25, -1.5); + sculpture.castShadow = true; + sculpture.receiveShadow = true; + scene.add(sculpture); + + // Lights + + // Warm point light in left room + const warmLight = new THREE.PointLight(0xffaa44, 30); + warmLight.position.set(-4, 4.5, 0); + warmLight.castShadow = true; + warmLight.shadow.mapSize.setScalar(256); + warmLight.shadow.radius = 12; + warmLight.shadow.bias = -0.002; + scene.add(warmLight); + + // Cool point light in right room + const coolLight = new THREE.PointLight(0x88bbff, 30); + coolLight.position.set(4, 4.5, 0); + coolLight.castShadow = true; + coolLight.shadow.mapSize.setScalar(256); + coolLight.shadow.radius = 12; + coolLight.shadow.bias = -0.002; + scene.add(coolLight); + + // Renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.0; + document.body.appendChild(renderer.domElement); + + // Controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2.5, 0); + controls.update(); + + // Probe volumes + + const params = { + enabled: true, + showProbes: false, + resolution: 6, + }; + + async function bake(resolution) { + // Remove both volumes before baking to prevent feedback + + if (probesLeft) { + scene.remove(probesLeft); + probesLeft.dispose(); + } + + if (probesRight) { + scene.remove(probesRight); + probesRight.dispose(); + } + + // Bake both volumes + + probesLeft = new LightProbeGridWebGL(7.8, 4.7, 7.6, resolution, resolution, resolution); + probesLeft.position.set(-3.9, 2.45, 0); + probesLeft.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); + probesLeft.visible = params.enabled; + + probesRight = new LightProbeGridWebGL(7.8, 4.7, 7.6, resolution, resolution, resolution); + probesRight.position.set(3.9, 2.45, 0); + probesRight.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); + probesRight.visible = params.enabled; + + // Add both after baking + + scene.add(probesLeft); + scene.add(probesRight); + + // Update debug visualization + + if (!probesHelperLeft) { + probesHelperLeft = new LightProbeGridHelperWebGL(probesLeft); + probesHelperLeft.visible = params.showProbes; + scene.add(probesHelperLeft); + + probesHelperRight = new LightProbeGridHelperWebGL(probesRight); + probesHelperRight.visible = params.showProbes; + scene.add(probesHelperRight); + } else { + probesHelperLeft.probes = probesLeft; + probesHelperLeft.update(); + + probesHelperRight.probes = probesRight; + probesHelperRight.update(); + } + } + + await bake(params.resolution); + + // GUI + + const gui = new GUI(); + gui.add(params, 'enabled') + .name('GI') + .onChange(value => { + probesLeft.visible = value; + probesRight.visible = value; + }); + gui.add(params, 'resolution', 2, 12, 1) + .name('Resolution') + .onFinishChange(value => { + bake(value); + }); + gui.add(params, 'showProbes') + .name('Show Probes') + .onChange(value => { + probesHelperLeft.visible = value; + probesHelperRight.visible = value; + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lightprobes_sponza.ts b/examples-testing/examples/webgl_lightprobes_sponza.ts new file mode 100644 index 000000000..6130445da --- /dev/null +++ b/examples-testing/examples/webgl_lightprobes_sponza.ts @@ -0,0 +1,312 @@ +import * as THREE from 'three'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { Sky } from 'three/addons/objects/Sky.js'; +import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; +import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; + +const MODEL_INDEX_URL = + 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json'; +const SAMPLE_ASSETS_BASE_URL = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/'; + +let camera, scene, renderer, controls, timer; +let probes = null, + probesHelper = null; +let modelSize = null; +let sunLight = null, + sky = null; + +const _box = new THREE.Box3(); +const _size = new THREE.Vector3(); + +init(); + +async function init() { + timer = new THREE.Timer(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(-10.25, 4.99, 0.4); + camera.rotation.set(1.6505, -1.5008, 1.6507); + + scene = new THREE.Scene(); + + sky = new Sky(); + sky.scale.setScalar(450000); + scene.add(sky); + + const skyUniforms = sky.material.uniforms; + skyUniforms['turbidity'].value = 10; + skyUniforms['rayleigh'].value = 2; + skyUniforms['mieCoefficient'].value = 0.005; + skyUniforms['mieDirectionalG'].value = 0.8; + skyUniforms['showSunDisc'].value = false; // the sun is represented by the light + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.0; + document.body.appendChild(renderer.domElement); + + controls = new FirstPersonControls(camera, renderer.domElement); + controls.movementSpeed = 2.0; + controls.lookSpeed = 0.16; + + const progressBar = document.getElementById('progressBar'); + + const manager = new THREE.LoadingManager(); + manager.onProgress = function (url, loaded, total) { + progressBar.value = (loaded / total) * 100; + }; + + manager.onLoad = function () { + progressBar.remove(); + }; + + const loader = new GLTFLoader(manager); + const modelURL = await getSponzaModelURL(); + const gltf = await loader.loadAsync(modelURL); + const model = gltf.scene; + const embeddedLights = []; + + model.traverse(child => { + if (child.isMesh) { + child.castShadow = true; + child.receiveShadow = true; + } else if (child.isLight) { + embeddedLights.push(child); + } + }); + + for (const light of embeddedLights) { + if (light.parent) light.parent.remove(light); + } + + scene.add(model); + + _box.setFromObject(model); + modelSize = _box.getSize(_size).clone(); + const probeFar = Math.max(modelSize.x, modelSize.y, modelSize.z) * 2.0; + let rebakeTimer = null; + let isBaking = false; + let bakeQueued = false; + + sunLight = new THREE.SunLight(0xfff2dc, 100.0); + sunLight.castShadow = true; + sunLight.shadow.camera.far = 50; + sunLight.shadow.mapSize.setScalar(2048); + scene.add(sunLight); + + const params = { + enabled: true, + showProbes: false, + probeSize: 0.2, + boundsX: -0.5, + boundsY: 6, + boundsZ: -0.3, + sizeX: 21, + sizeY: 11, + sizeZ: 9, + countX: 10, + countY: 7, + countZ: 7, + bounces: 1, + lightAzimuth: -75, + lightElevation: 60, + lightIntensity: 100.0, + shadows: true, + }; + + function updateLightPosition() { + const elevation = THREE.MathUtils.degToRad(params.lightElevation); + const azimuth = THREE.MathUtils.degToRad(params.lightAzimuth); + + sunLight.position.setFromSphericalCoords(1, Math.PI / 2 - elevation, azimuth); + sky.material.uniforms['sunPosition'].value.copy(sunLight.position); + } + + function scheduleRebake() { + if (rebakeTimer !== null) clearTimeout(rebakeTimer); + rebakeTimer = setTimeout(() => { + rebakeTimer = null; + bakeWithSettings(); + }, 250); + } + + async function bakeWithSettings() { + if (isBaking) { + bakeQueued = true; + return; + } + + isBaking = true; + + do { + bakeQueued = false; + + if (probes) { + scene.remove(probes); + probes.dispose(); + } + + probes = new LightProbeGridWebGL( + params.sizeX, + params.sizeY, + params.sizeZ, + params.countX, + params.countY, + params.countZ, + ); + probes.position.set(params.boundsX, params.boundsY, params.boundsZ); + // Add to the scene before baking so bounce passes can sample the prior pass's atlas. + scene.add(probes); + // Hide the helper spheres so they don't appear in the cubemap captures. + if (probesHelper) probesHelper.visible = false; + probes.bake(renderer, scene, { + cubemapSize: 32, + near: 0.05, + far: probeFar, + bounces: params.bounces, + }); + probes.visible = params.enabled; + + if (!probesHelper) { + probesHelper = new LightProbeGridHelperWebGL(probes, params.probeSize); + probesHelper.visible = params.showProbes; + scene.add(probesHelper); + } else { + probesHelper.probes = probes; + probesHelper.update(); + probesHelper.visible = params.showProbes; + } + } while (bakeQueued); + + isBaking = false; + } + + updateLightPosition(); + + const gui = new GUI(); + gui.add(params, 'enabled') + .name('GI') + .onChange(value => { + if (probes) probes.visible = value; + }); + + gui.add(params, 'lightAzimuth', -180, 180, 1) + .name('Light Azimuth') + .onChange(() => { + updateLightPosition(); + scheduleRebake(); + }); + gui.add(params, 'lightElevation', 5, 85, 1) + .name('Light Elevation') + .onChange(() => { + updateLightPosition(); + scheduleRebake(); + }); + gui.add(params, 'lightIntensity', 0, 100, 0.1) + .name('Light Intensity') + .onChange(value => { + sunLight.intensity = value; + scheduleRebake(); + }); + gui.add(params, 'shadows') + .name('Shadows') + .onChange(value => { + setShadowsEnabled(value); + scheduleRebake(); + }); + + gui.add(params, 'countX', 2, 32, 1).name('Probes X').onChange(scheduleRebake); + gui.add(params, 'countY', 2, 16, 1).name('Probes Y').onChange(scheduleRebake); + gui.add(params, 'countZ', 2, 16, 1).name('Probes Z').onChange(scheduleRebake); + gui.add(params, 'bounces', 0, 2, 1).name('Bounces').onChange(scheduleRebake); + + gui.add(params, 'showProbes') + .name('Show Probes') + .onChange(value => { + if (probesHelper) probesHelper.visible = value; + }); + gui.add(params, 'probeSize', 0.05, 2.0, 0.05) + .name('Probe Size') + .onChange(value => { + if (probesHelper) { + scene.remove(probesHelper); + probesHelper.dispose(); + probesHelper = new LightProbeGridHelperWebGL(probes, value); + probesHelper.visible = params.showProbes; + scene.add(probesHelper); + } + }); + + gui.add( + { + log: () => { + console.log( + 'position:', + camera.position.x.toFixed(2), + camera.position.y.toFixed(2), + camera.position.z.toFixed(2), + ); + console.log( + 'rotation:', + camera.rotation.x.toFixed(4), + camera.rotation.y.toFixed(4), + camera.rotation.z.toFixed(4), + ); + }, + }, + 'log', + ).name('Log Camera'); + + setShadowsEnabled(params.shadows); + await bakeWithSettings(); + + window.addEventListener('resize', onWindowResize); +} + +async function getSponzaModelURL() { + const response = await fetch(MODEL_INDEX_URL); + const models = await response.json(); + const sponzaInfo = models.find(model => model.name === 'Sponza'); + + if (!sponzaInfo) { + throw new Error('Sponza entry was not found in the glTF sample model index.'); + } + + const variants = sponzaInfo.variants || {}; + const variantName = + variants['glTF-Binary'] || variants['glTF'] || variants['glTF-Embedded'] || Object.values(variants)[0]; + + if (!variantName) { + throw new Error('Sponza has no supported glTF variant in the model index.'); + } + + const variantFolder = variantName.endsWith('.glb') ? 'glTF-Binary' : 'glTF'; + return `${SAMPLE_ASSETS_BASE_URL}${sponzaInfo.name}/${variantFolder}/${variantName}`; +} + +function setShadowsEnabled(enabled) { + if (!renderer || !sunLight) return; + + renderer.shadowMap.enabled = enabled; + sunLight.castShadow = enabled; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(timestamp) { + timer.update(timestamp); + controls.update(timer.getDelta()); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lights_hemisphere.ts b/examples-testing/examples/webgl_lights_hemisphere.ts new file mode 100644 index 000000000..2910b15de --- /dev/null +++ b/examples-testing/examples/webgl_lights_hemisphere.ts @@ -0,0 +1,191 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer; +const mixers = []; +let stats; + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.set(0, 0, 250); + + scene = new THREE.Scene(); + scene.background = new THREE.Color().setHSL(0.6, 0, 1); + scene.fog = new THREE.Fog(scene.background, 1, 5000); + + // LIGHTS + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0xffffff, 2); + hemiLight.color.setHSL(0.6, 1, 0.6); + hemiLight.groundColor.setHSL(0.095, 1, 0.75); + hemiLight.position.set(0, 50, 0); + scene.add(hemiLight); + + const hemiLightHelper = new THREE.HemisphereLightHelper(hemiLight, 10); + scene.add(hemiLightHelper); + + // + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.color.setHSL(0.1, 1, 0.95); + dirLight.position.set(-1, 1.75, 1); + dirLight.position.multiplyScalar(30); + scene.add(dirLight); + + dirLight.castShadow = true; + + dirLight.shadow.mapSize.width = 2048; + dirLight.shadow.mapSize.height = 2048; + + const d = 50; + + dirLight.shadow.camera.left = -d; + dirLight.shadow.camera.right = d; + dirLight.shadow.camera.top = d; + dirLight.shadow.camera.bottom = -d; + + dirLight.shadow.camera.far = 3500; + dirLight.shadow.bias = -0.0001; + + const dirLightHelper = new THREE.DirectionalLightHelper(dirLight, 10); + scene.add(dirLightHelper); + + // GROUND + + const groundGeo = new THREE.PlaneGeometry(10000, 10000); + const groundMat = new THREE.MeshLambertMaterial({ color: 0xffffff }); + groundMat.color.setHSL(0.095, 1, 0.75); + + const ground = new THREE.Mesh(groundGeo, groundMat); + ground.position.y = -33; + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + // SKYDOME + + const vertexShader = document.getElementById('vertexShader').textContent; + const fragmentShader = document.getElementById('fragmentShader').textContent; + const uniforms = { + topColor: { value: new THREE.Color(0x0077ff) }, + bottomColor: { value: new THREE.Color(0xffffff) }, + offset: { value: 33 }, + exponent: { value: 0.6 }, + }; + uniforms['topColor'].value.copy(hemiLight.color); + + scene.fog.color.copy(uniforms['bottomColor'].value); + + const skyGeo = new THREE.SphereGeometry(4000, 32, 15); + const skyMat = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: vertexShader, + fragmentShader: fragmentShader, + side: THREE.BackSide, + }); + + const sky = new THREE.Mesh(skyGeo, skyMat); + scene.add(sky); + + // MODEL + + const loader = new GLTFLoader(); + + loader.load('models/gltf/Flamingo.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + + const s = 0.35; + mesh.scale.set(s, s, s); + mesh.position.y = 15; + mesh.rotation.y = -1; + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); + + const mixer = new THREE.AnimationMixer(mesh); + mixer.clipAction(gltf.animations[0]).setDuration(1).play(); + mixers.push(mixer); + }); + + // RENDERER + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + renderer.shadowMap.enabled = true; + + // STATS + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + const params = { + toggleHemisphereLight: function () { + hemiLight.visible = !hemiLight.visible; + hemiLightHelper.visible = !hemiLightHelper.visible; + }, + toggleDirectionalLight: function () { + dirLight.visible = !dirLight.visible; + dirLightHelper.visible = !dirLightHelper.visible; + }, + shadowIntensity: 1, + }; + + const gui = new GUI(); + + gui.add(params, 'toggleHemisphereLight').name('toggle hemisphere light'); + gui.add(params, 'toggleDirectionalLight').name('toggle directional light'); + gui.add(params, 'shadowIntensity', 0, 1) + .name('shadow intensity') + .onChange(value => { + dirLight.shadow.intensity = value; + }); + gui.open(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + const delta = timer.getDelta(); + + for (let i = 0; i < mixers.length; i++) { + mixers[i].update(delta); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lights_physical.ts b/examples-testing/examples/webgl_lights_physical.ts new file mode 100644 index 000000000..707ef200e --- /dev/null +++ b/examples-testing/examples/webgl_lights_physical.ts @@ -0,0 +1,237 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, bulbLight, bulbMat, hemiLight, stats; +let ballMat, cubeMat, floorMat; + +let previousShadowMap = false; + +// ref for lumens: http://www.power-sure.com/lumens.htm +const bulbLuminousPowers = { + '110000 lm (1000W)': 110000, + '3500 lm (300W)': 3500, + '1700 lm (100W)': 1700, + '800 lm (60W)': 800, + '400 lm (40W)': 400, + '180 lm (25W)': 180, + '20 lm (4W)': 20, + Off: 0, +}; + +// ref for solar irradiances: https://en.wikipedia.org/wiki/Lux +const hemiLuminousIrradiances = { + '0.0001 lx (Moonless Night)': 0.0001, + '0.002 lx (Night Airglow)': 0.002, + '0.5 lx (Full Moon)': 0.5, + '3.4 lx (City Twilight)': 3.4, + '50 lx (Living Room)': 50, + '100 lx (Very Overcast)': 100, + '350 lx (Office Room)': 350, + '400 lx (Sunrise/Sunset)': 400, + '1000 lx (Overcast)': 1000, + '18000 lx (Daylight)': 18000, + '50000 lx (Direct Sun)': 50000, +}; + +const params = { + shadows: true, + exposure: 0.68, + bulbPower: Object.keys(bulbLuminousPowers)[4], + hemiIrradiance: Object.keys(hemiLuminousIrradiances)[0], +}; + +init(); + +function init() { + const container = document.getElementById('container'); + + stats = new Stats(); + container.appendChild(stats.dom); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.x = -4; + camera.position.z = 4; + camera.position.y = 2; + + scene = new THREE.Scene(); + + const bulbGeometry = new THREE.SphereGeometry(0.02, 16, 8); + bulbLight = new THREE.PointLight(0xffee88, 1, 100, 2); + + bulbMat = new THREE.MeshStandardMaterial({ + emissive: 0xffffee, + emissiveIntensity: 1, + color: 0x000000, + }); + bulbLight.add(new THREE.Mesh(bulbGeometry, bulbMat)); + bulbLight.position.set(0, 2, 0); + bulbLight.castShadow = true; + scene.add(bulbLight); + + hemiLight = new THREE.HemisphereLight(0xddeeff, 0x0f0e0d, 0.02); + scene.add(hemiLight); + + floorMat = new THREE.MeshStandardMaterial({ + roughness: 0.8, + color: 0xffffff, + metalness: 0.2, + bumpScale: 1, + }); + const textureLoader = new THREE.TextureLoader(); + textureLoader.load('textures/hardwood2_diffuse.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(10, 24); + map.colorSpace = THREE.SRGBColorSpace; + floorMat.map = map; + floorMat.needsUpdate = true; + }); + textureLoader.load('textures/hardwood2_bump.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(10, 24); + floorMat.bumpMap = map; + floorMat.needsUpdate = true; + }); + textureLoader.load('textures/hardwood2_roughness.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(10, 24); + floorMat.roughnessMap = map; + floorMat.needsUpdate = true; + }); + + cubeMat = new THREE.MeshStandardMaterial({ + roughness: 0.7, + color: 0xffffff, + bumpScale: 1, + metalness: 0.2, + }); + textureLoader.load('textures/brick_diffuse.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(1, 1); + map.colorSpace = THREE.SRGBColorSpace; + cubeMat.map = map; + cubeMat.needsUpdate = true; + }); + textureLoader.load('textures/brick_bump.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(1, 1); + cubeMat.bumpMap = map; + cubeMat.needsUpdate = true; + }); + + ballMat = new THREE.MeshStandardMaterial({ + color: 0xffffff, + roughness: 0.5, + metalness: 1.0, + }); + textureLoader.load('textures/planets/earth_atmos_2048.jpg', function (map) { + map.anisotropy = 4; + map.colorSpace = THREE.SRGBColorSpace; + ballMat.map = map; + ballMat.needsUpdate = true; + }); + textureLoader.load('textures/planets/earth_specular_2048.jpg', function (map) { + map.anisotropy = 4; + map.colorSpace = THREE.SRGBColorSpace; + ballMat.metalnessMap = map; + ballMat.needsUpdate = true; + }); + + const floorGeometry = new THREE.PlaneGeometry(20, 20); + const floorMesh = new THREE.Mesh(floorGeometry, floorMat); + floorMesh.receiveShadow = true; + floorMesh.rotation.x = -Math.PI / 2.0; + scene.add(floorMesh); + + const ballGeometry = new THREE.SphereGeometry(0.25, 32, 32); + const ballMesh = new THREE.Mesh(ballGeometry, ballMat); + ballMesh.position.set(1, 0.25, 1); + ballMesh.rotation.y = Math.PI; + ballMesh.castShadow = true; + scene.add(ballMesh); + + const boxGeometry = new THREE.BoxGeometry(0.5, 0.5, 0.5); + const boxMesh = new THREE.Mesh(boxGeometry, cubeMat); + boxMesh.position.set(-0.5, 0.25, -1); + boxMesh.castShadow = true; + scene.add(boxMesh); + + const boxMesh2 = new THREE.Mesh(boxGeometry, cubeMat); + boxMesh2.position.set(0, 0.25, -5); + boxMesh2.castShadow = true; + scene.add(boxMesh2); + + const boxMesh3 = new THREE.Mesh(boxGeometry, cubeMat); + boxMesh3.position.set(7, 0.25, 0); + boxMesh3.castShadow = true; + scene.add(boxMesh3); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ReinhardToneMapping; + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 20; + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'hemiIrradiance', Object.keys(hemiLuminousIrradiances)); + gui.add(params, 'bulbPower', Object.keys(bulbLuminousPowers)); + gui.add(params, 'exposure', 0, 1); + gui.add(params, 'shadows'); + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.toneMappingExposure = Math.pow(params.exposure, 5.0); // to allow for very bright scenes. + renderer.shadowMap.enabled = params.shadows; + bulbLight.castShadow = params.shadows; + + if (params.shadows !== previousShadowMap) { + ballMat.needsUpdate = true; + cubeMat.needsUpdate = true; + floorMat.needsUpdate = true; + previousShadowMap = params.shadows; + } + + bulbLight.power = bulbLuminousPowers[params.bulbPower]; + bulbMat.emissiveIntensity = bulbLight.intensity / Math.pow(0.02, 2.0); // convert from intensity to irradiance at bulb surface + + hemiLight.intensity = hemiLuminousIrradiances[params.hemiIrradiance]; + const time = Date.now() * 0.0005; + + bulbLight.position.y = Math.cos(time) * 0.75 + 1.25; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_lights_rectarealight.ts b/examples-testing/examples/webgl_lights_rectarealight.ts new file mode 100644 index 000000000..621d183d8 --- /dev/null +++ b/examples-testing/examples/webgl_lights_rectarealight.ts @@ -0,0 +1,110 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; +import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js'; + +let renderer, scene, camera; +let rectLight1, rectLight2, rectLight3; +let timer, stats; + +init(); + +function init() { + timer = new THREE.Timer(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animation); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 5, -15); + + scene = new THREE.Scene(); + + RectAreaLightUniformsLib.init(); + + rectLight1 = new THREE.RectAreaLight(0xff0000, 5, 4, 10); + rectLight1.position.set(-5, 6, 5); + scene.add(rectLight1); + + rectLight2 = new THREE.RectAreaLight(0x00ff00, 5, 4, 10); + rectLight2.position.set(0, 6, 5); + scene.add(rectLight2); + + rectLight3 = new THREE.RectAreaLight(0x0000ff, 5, 4, 10); + rectLight3.position.set(5, 6, 5); + scene.add(rectLight3); + + scene.add(new RectAreaLightHelper(rectLight1)); + scene.add(new RectAreaLightHelper(rectLight2)); + scene.add(new RectAreaLightHelper(rectLight3)); + + const geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000); + const matStdFloor = new THREE.MeshStandardMaterial({ color: 0x444444 }); + matStdFloor.roughnessMap = createCheckerTexture(400); + const mshStdFloor = new THREE.Mesh(geoFloor, matStdFloor); + scene.add(mshStdFloor); + + const geoKnot = new THREE.TorusKnotGeometry(1.5, 0.5, 200, 16); + const matKnot = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0, metalness: 0 }); + const meshKnot = new THREE.Mesh(geoKnot, matKnot); + meshKnot.position.set(0, 5.5, 0); + scene.add(meshKnot); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.copy(meshKnot.position); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); + + stats = new Stats(); + document.body.appendChild(stats.dom); +} + +function createCheckerTexture(repeat = 1) { + const canvas = document.createElement('canvas'); + canvas.width = 2; + canvas.height = 2; + + const ctx = canvas.getContext('2d'); + ctx.fillStyle = '#000'; + ctx.fillRect(0, 0, 2, 2); + ctx.fillStyle = '#fff'; + ctx.fillRect(0, 0, 1, 1); + ctx.fillRect(1, 1, 1, 1); + + const texture = new THREE.CanvasTexture(canvas); + texture.repeat.set(repeat, repeat); + texture.magFilter = THREE.NearestFilter; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + + return texture; +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +function animation() { + timer.update(); + + const delta = timer.getDelta(); + + rectLight1.rotation.y += -delta; + rectLight2.rotation.y += delta * 0.5; + rectLight3.rotation.y += delta; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_lights_spotlight.ts b/examples-testing/examples/webgl_lights_spotlight.ts new file mode 100644 index 000000000..78fec9d4e --- /dev/null +++ b/examples-testing/examples/webgl_lights_spotlight.ts @@ -0,0 +1,202 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let renderer, scene, camera; + +let spotLight; + +init(); + +function init() { + // Renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1; + + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(7, 4, 1); + + // Controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.maxPolarAngle = Math.PI / 2; + controls.target.set(0, 1, 0); + controls.update(); + + // Textures + + const loader = new THREE.TextureLoader().setPath('textures/'); + const filenames = ['disturb.jpg', 'colors.png', 'uv_grid_opengl.jpg']; + + const textures = { none: null }; + + for (let i = 0; i < filenames.length; i++) { + const filename = filenames[i]; + + const texture = loader.load(filename); + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + texture.colorSpace = THREE.SRGBColorSpace; + + textures[filename] = texture; + } + + // Lights + + const ambient = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 0.25); + scene.add(ambient); + + spotLight = new THREE.SpotLight(0xffffff, 100); + spotLight.name = 'spotLight'; + spotLight.map = textures['disturb.jpg']; + spotLight.position.set(2.5, 5, 2.5); + spotLight.angle = Math.PI / 6; + spotLight.penumbra = 1; + spotLight.decay = 2; + spotLight.distance = 0; + + spotLight.castShadow = true; + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + spotLight.shadow.camera.near = 2; + spotLight.shadow.camera.far = 10; + spotLight.shadow.focus = 1; + spotLight.shadow.bias = -0.003; + spotLight.shadow.intensity = 1; + scene.add(spotLight); + + spotLight.lightHelper = new THREE.SpotLightHelper(spotLight); + spotLight.lightHelper.visible = false; + scene.add(spotLight.lightHelper); + + spotLight.shadowCameraHelper = new THREE.CameraHelper(spotLight.shadow.camera); // colored lines + spotLight.shadowCameraHelper.visible = false; + scene.add(spotLight.shadowCameraHelper); + + // + + const geometry = new THREE.PlaneGeometry(10, 10); + const material = new THREE.MeshLambertMaterial({ color: 0xbcbcbc }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(0, -1, 0); + mesh.rotation.x = -Math.PI / 2; + mesh.receiveShadow = true; + scene.add(mesh); + + // Model + + new PLYLoader().load('models/ply/binary/Lucy100k.ply', function (geometry) { + geometry.scale(0.0024, 0.0024, 0.0024); + geometry.computeVertexNormals(); + + const material = new THREE.MeshLambertMaterial(); + + const mesh = new THREE.Mesh(geometry, material); + mesh.rotation.y = -Math.PI / 2; + mesh.position.y = 0.8; + mesh.castShadow = true; + mesh.receiveShadow = true; + scene.add(mesh); + }); + + // + + window.addEventListener('resize', onWindowResize); + + // GUI + + const gui = new GUI(); + + const params = { + map: textures['disturb.jpg'], + color: spotLight.color.getHex(), + intensity: spotLight.intensity, + distance: spotLight.distance, + angle: spotLight.angle, + penumbra: spotLight.penumbra, + decay: spotLight.decay, + focus: spotLight.shadow.focus, + shadowIntensity: spotLight.shadow.intensity, + helpers: false, + }; + + gui.add(params, 'map', textures).onChange(function (val) { + spotLight.map = val; + }); + + gui.addColor(params, 'color').onChange(function (val) { + spotLight.color.setHex(val); + }); + + gui.add(params, 'intensity', 0, 500).onChange(function (val) { + spotLight.intensity = val; + }); + + gui.add(params, 'distance', 0, 20).onChange(function (val) { + spotLight.distance = val; + }); + + gui.add(params, 'angle', 0, Math.PI / 3).onChange(function (val) { + spotLight.angle = val; + }); + + gui.add(params, 'penumbra', 0, 1).onChange(function (val) { + spotLight.penumbra = val; + }); + + gui.add(params, 'decay', 1, 2).onChange(function (val) { + spotLight.decay = val; + }); + + gui.add(params, 'focus', 0, 1).onChange(function (val) { + spotLight.shadow.focus = val; + }); + + gui.add(params, 'shadowIntensity', 0, 1).onChange(function (val) { + spotLight.shadow.intensity = val; + }); + + gui.add(params, 'helpers').onChange(function (val) { + spotLight.lightHelper.visible = val; + spotLight.shadowCameraHelper.visible = val; + }); + + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now() / 3000; + + spotLight.position.x = Math.cos(time) * 2.5; + spotLight.position.z = Math.sin(time) * 2.5; + + spotLight.lightHelper.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lights_spotlights.ts b/examples-testing/examples/webgl_lights_spotlights.ts new file mode 100644 index 000000000..be8dfd69d --- /dev/null +++ b/examples-testing/examples/webgl_lights_spotlights.ts @@ -0,0 +1,133 @@ +import * as THREE from 'three'; +import TWEEN from 'three/addons/libs/tween.module.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +const renderer = new THREE.WebGLRenderer({ antialias: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setAnimationLoop(animate); + +const camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); + +const controls = new OrbitControls(camera, renderer.domElement); + +const scene = new THREE.Scene(); + +const matFloor = new THREE.MeshPhongMaterial({ color: 0x808080 }); +const matBox = new THREE.MeshPhongMaterial({ color: 0xaaaaaa }); + +const geoFloor = new THREE.PlaneGeometry(100, 100); +const geoBox = new THREE.BoxGeometry(0.3, 0.1, 0.2); + +const mshFloor = new THREE.Mesh(geoFloor, matFloor); +mshFloor.rotation.x = -Math.PI * 0.5; +const mshBox = new THREE.Mesh(geoBox, matBox); + +const ambient = new THREE.AmbientLight(0x444444); + +const spotLight1 = createSpotlight(0xff7f00); +const spotLight2 = createSpotlight(0x00ff7f); +const spotLight3 = createSpotlight(0x7f00ff); + +let lightHelper1, lightHelper2, lightHelper3; + +function init() { + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + + camera.position.set(4.6, 2.2, -2.1); + + spotLight1.position.set(1.5, 4, 4.5); + spotLight2.position.set(0, 4, 3.5); + spotLight3.position.set(-1.5, 4, 4.5); + + lightHelper1 = new THREE.SpotLightHelper(spotLight1); + lightHelper2 = new THREE.SpotLightHelper(spotLight2); + lightHelper3 = new THREE.SpotLightHelper(spotLight3); + + mshFloor.receiveShadow = true; + mshFloor.position.set(0, -0.05, 0); + + mshBox.castShadow = true; + mshBox.receiveShadow = true; + mshBox.position.set(0, 0.5, 0); + + scene.add(mshFloor); + scene.add(mshBox); + scene.add(ambient); + scene.add(spotLight1, spotLight2, spotLight3); + scene.add(lightHelper1, lightHelper2, lightHelper3); + + document.body.appendChild(renderer.domElement); + window.addEventListener('resize', onWindowResize); + + controls.target.set(0, 0.5, 0); + controls.maxPolarAngle = Math.PI / 2; + controls.minDistance = 1; + controls.maxDistance = 10; + controls.update(); +} + +function createSpotlight(color) { + const newObj = new THREE.SpotLight(color, 10); + + newObj.castShadow = true; + newObj.angle = 0.3; + newObj.penumbra = 0.2; + newObj.decay = 2; + newObj.distance = 50; + + return newObj; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function tween(light) { + new TWEEN.Tween(light) + .to( + { + angle: Math.random() * 0.7 + 0.1, + penumbra: Math.random() + 1, + }, + Math.random() * 3000 + 2000, + ) + .easing(TWEEN.Easing.Quadratic.Out) + .start(); + + new TWEEN.Tween(light.position) + .to( + { + x: Math.random() * 3 - 1.5, + y: Math.random() * 1 + 1.5, + z: Math.random() * 3 - 1.5, + }, + Math.random() * 3000 + 2000, + ) + .easing(TWEEN.Easing.Quadratic.Out) + .start(); +} + +function updateTweens() { + tween(spotLight1); + tween(spotLight2); + tween(spotLight3); + + setTimeout(updateTweens, 5000); +} + +function animate() { + TWEEN.update(); + + if (lightHelper1) lightHelper1.update(); + if (lightHelper2) lightHelper2.update(); + if (lightHelper3) lightHelper3.update(); + + renderer.render(scene, camera); +} + +init(); +updateTweens(); diff --git a/examples-testing/examples/webgl_lights_sunlight.ts b/examples-testing/examples/webgl_lights_sunlight.ts new file mode 100644 index 000000000..9cfe10948 --- /dev/null +++ b/examples-testing/examples/webgl_lights_sunlight.ts @@ -0,0 +1,226 @@ +import * as THREE from 'three'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { Sky } from 'three/addons/objects/Sky.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let renderer, scene, camera, controls, timer, sunLight, sky, sceneEnv, pmremGenerator, renderTarget; + +const params = { + showCascades: false, + far: 1000, + resolution: 2048, + azimuth: 135, + elevation: 10, +}; + +const _sunDay = new THREE.Color(0xfff2e3), + _sunDusk = new THREE.Color(0xff8a3d); +const _fogDay = new THREE.Color(0xd8e2ea), + _fogDusk = new THREE.Color(0xd9a273); + +// tints each fragment by its cascade, using the data of the built-in sun shadow shader + +function tintCascades(shader) { + shader.fragmentShader = shader.fragmentShader.replace( + '#include ', + /* glsl */ ` + #include + + #if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0 + + float cascade = 0.0; + for ( int i = 0; i < 4; i ++ ) cascade += step( sunShadowCascade[ i ].y, vSunShadowWorldPosition.w ); + gl_FragColor.rgb *= 0.7 + 0.3 * cos( cascade * 1.2 + vec3( 0.0, 4.2, 2.1 ) ); + + #endif + `, + ); +} + +init(); + +function updateSun() { + sunLight.position.setFromSphericalCoords( + 1, + THREE.MathUtils.degToRad(90 - params.elevation), + THREE.MathUtils.degToRad(params.azimuth), + ); + + // the sun light warms up and fades towards the horizon + + const daylight = Math.min(1, params.elevation / 30); + + sunLight.color.lerpColors(_sunDusk, _sunDay, daylight); + sunLight.intensity = 3 + daylight * 2; + + scene.fog.color.lerpColors(_fogDusk, _fogDay, daylight); + + sky.material.uniforms.sunPosition.value.copy(sunLight.position); + + // light the scene with the sky itself + + if (renderTarget !== undefined) renderTarget.dispose(); + + sceneEnv.add(sky); + renderTarget = pmremGenerator.fromScene(sceneEnv); + scene.add(sky); + + scene.environment = renderTarget.texture; +} + +function init() { + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x000000, 500, 4000); + scene.environmentIntensity = 0.5; + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.5, 5000); + camera.position.set(60, 8, 0); + camera.lookAt(-60, 8, 0); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.6; + document.body.appendChild(renderer.domElement); + + controls = new FirstPersonControls(camera, renderer.domElement); + controls.movementSpeed = 40; + controls.lookSpeed = 0.05; + + timer = new THREE.Timer(); + pmremGenerator = new THREE.PMREMGenerator(renderer); + sceneEnv = new THREE.Scene(); + + // sky and sun + + sky = new Sky(); + sky.scale.setScalar(9000); + scene.add(sky); + + sky.material.uniforms.turbidity.value = 3; + sky.material.uniforms.rayleigh.value = 2; + sky.material.uniforms.showSunDisc.value = false; // the sun is represented by the light + + sunLight = new THREE.SunLight(); + sunLight.castShadow = true; + sunLight.shadow.camera.far = params.far; // maximum shadow distance + sunLight.shadow.mapSize.setScalar(params.resolution); + sunLight.shadow.normalBias = 0.05; + scene.add(sunLight); + + updateSun(); + + // ground + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(10000, 10000), + new THREE.MeshStandardMaterial({ color: 0xa39f8e }), + ); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + const dummy = new THREE.Object3D(); + + // an avenue of thin posts shows the shadow resolution from up close + // all the way down to the shadow distance + + const posts = new THREE.InstancedMesh( + new THREE.BoxGeometry(1, 10, 1), + new THREE.MeshStandardMaterial({ color: 0x475161 }), + 120, + ); + posts.castShadow = true; + posts.receiveShadow = true; + scene.add(posts); + + for (let i = 0; i < 60; i++) { + for (const side of [-1, 1]) { + dummy.position.set(30 - i * 17, 5, side * 13); + dummy.updateMatrix(); + posts.setMatrixAt(i * 2 + (side + 1) / 2, dummy.matrix); + } + } + + // towers for large shadows in the distance + + const towers = new THREE.InstancedMesh(new THREE.BoxGeometry(10, 1, 10), new THREE.MeshStandardMaterial(), 60); + towers.castShadow = true; + towers.receiveShadow = true; + scene.add(towers); + + const towerColors = [new THREE.Color(0x08d9d6), new THREE.Color(0xff2e63)]; + + THREE.MathUtils.seededRandom(6); + + for (let i = 0; i < 30; i++) { + for (const side of [-1, 1]) { + const height = 20 + THREE.MathUtils.seededRandom() * 40; + + dummy.position.set( + -40 - i * 32 - THREE.MathUtils.seededRandom() * 10, + height / 2, + side * (38 + THREE.MathUtils.seededRandom() * 55), + ); + dummy.scale.y = height; + dummy.updateMatrix(); + + const index = i * 2 + (side + 1) / 2; + towers.setMatrixAt(index, dummy.matrix); + towers.setColorAt(index, towerColors[(i + (side + 1) / 2) % 2]); + } + } + + // gui + + const materials = [ground.material, posts.material, towers.material]; + + const gui = new GUI(); + + gui.add(params, 'showCascades') + .name('show cascades') + .onChange(function (value) { + for (const material of materials) { + if (value) material.onBeforeCompile = tintCascades; + else delete material.onBeforeCompile; + + material.needsUpdate = true; + } + }); + + gui.add(params, 'far', 100, 3000) + .step(1) + .name('shadow far') + .onChange(function (value) { + sunLight.shadow.camera.far = value; + }); + + gui.add(params, 'resolution', [256, 512, 1024, 2048, 4096]) + .name('shadow resolution') + .onChange(function (value) { + sunLight.shadow.mapSize.setScalar(value); + }); + + gui.add(params, 'azimuth', 0, 360).onChange(updateSun); + gui.add(params, 'elevation', 5, 80).onChange(updateSun); + + window.addEventListener('resize', function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + controls.handleResize(); + }); +} + +function animate() { + timer.update(); + + controls.update(timer.getDelta()); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lines_colors.ts b/examples-testing/examples/webgl_lines_colors.ts new file mode 100644 index 000000000..9da19ee2e --- /dev/null +++ b/examples-testing/examples/webgl_lines_colors.ts @@ -0,0 +1,181 @@ +import * as THREE from 'three'; + +import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; + +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +let camera, scene, renderer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(33, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + const hilbertPoints = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 200.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); + + const geometry1 = new THREE.BufferGeometry(); + const geometry2 = new THREE.BufferGeometry(); + const geometry3 = new THREE.BufferGeometry(); + + const subdivisions = 6; + + let vertices = []; + let colors1 = []; + let colors2 = []; + let colors3 = []; + + const point = new THREE.Vector3(); + const color = new THREE.Color(); + + const spline = new THREE.CatmullRomCurve3(hilbertPoints); + + for (let i = 0; i < hilbertPoints.length * subdivisions; i++) { + const t = i / (hilbertPoints.length * subdivisions); + spline.getPoint(t, point); + + vertices.push(point.x, point.y, point.z); + + color.setHSL(0.6, 1.0, Math.max(0, -point.x / 200) + 0.5, THREE.SRGBColorSpace); + colors1.push(color.r, color.g, color.b); + + color.setHSL(0.9, 1.0, Math.max(0, -point.y / 200) + 0.5, THREE.SRGBColorSpace); + colors2.push(color.r, color.g, color.b); + + color.setHSL(i / (hilbertPoints.length * subdivisions), 1.0, 0.5, THREE.SRGBColorSpace); + colors3.push(color.r, color.g, color.b); + } + + geometry1.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + geometry2.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + geometry3.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + geometry1.setAttribute('color', new THREE.Float32BufferAttribute(colors1, 3)); + geometry2.setAttribute('color', new THREE.Float32BufferAttribute(colors2, 3)); + geometry3.setAttribute('color', new THREE.Float32BufferAttribute(colors3, 3)); + + // + + const geometry4 = new THREE.BufferGeometry(); + const geometry5 = new THREE.BufferGeometry(); + const geometry6 = new THREE.BufferGeometry(); + + vertices = []; + colors1 = []; + colors2 = []; + colors3 = []; + + for (let i = 0; i < hilbertPoints.length; i++) { + const point = hilbertPoints[i]; + + vertices.push(point.x, point.y, point.z); + + color.setHSL(0.6, 1.0, Math.max(0, (200 - hilbertPoints[i].x) / 400) * 0.5 + 0.5, THREE.SRGBColorSpace); + colors1.push(color.r, color.g, color.b); + + color.setHSL(0.3, 1.0, Math.max(0, (200 + hilbertPoints[i].x) / 400) * 0.5, THREE.SRGBColorSpace); + colors2.push(color.r, color.g, color.b); + + color.setHSL(i / hilbertPoints.length, 1.0, 0.5, THREE.SRGBColorSpace); + colors3.push(color.r, color.g, color.b); + } + + geometry4.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + geometry5.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + geometry6.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + geometry4.setAttribute('color', new THREE.Float32BufferAttribute(colors1, 3)); + geometry5.setAttribute('color', new THREE.Float32BufferAttribute(colors2, 3)); + geometry6.setAttribute('color', new THREE.Float32BufferAttribute(colors3, 3)); + + // Create lines and add to scene + + const material = new THREE.LineBasicMaterial({ color: 0xffffff, vertexColors: true }); + + let line, p; + const scale = 0.3, + d = 225; + + const parameters = [ + [material, scale * 1.5, [-d, -d / 2, 0], geometry1], + [material, scale * 1.5, [0, -d / 2, 0], geometry2], + [material, scale * 1.5, [d, -d / 2, 0], geometry3], + + [material, scale * 1.5, [-d, d / 2, 0], geometry4], + [material, scale * 1.5, [0, d / 2, 0], geometry5], + [material, scale * 1.5, [d, d / 2, 0], geometry6], + ]; + + for (let i = 0; i < parameters.length; i++) { + p = parameters[i]; + line = new THREE.Line(p[3], p[0]); + line.scale.x = line.scale.y = line.scale.z = p[1]; + line.position.x = p[2][0]; + line.position.y = p[2][1]; + line.position.z = p[2][2]; + scene.add(line); + } + + // + + document.body.style.touchAction = 'none'; + document.body.addEventListener('pointermove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY + 200 - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + const time = Date.now() * 0.0005; + + for (let i = 0; i < scene.children.length; i++) { + const object = scene.children[i]; + + if (object.isLine) { + object.rotation.y = time * (i % 2 ? 1 : -1); + } + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lines_dashed.ts b/examples-testing/examples/webgl_lines_dashed.ts new file mode 100644 index 000000000..3e3ee3041 --- /dev/null +++ b/examples-testing/examples/webgl_lines_dashed.ts @@ -0,0 +1,186 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; + +let renderer, scene, camera, stats; +const objects = []; + +const WIDTH = window.innerWidth, + HEIGHT = window.innerHeight; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, WIDTH / HEIGHT, 1, 200); + camera.position.z = 150; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x111111); + scene.fog = new THREE.Fog(0x111111, 150, 200); + + const subdivisions = 6; + const recursion = 1; + + const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 25.0, recursion, 0, 1, 2, 3, 4, 5, 6, 7); + const spline = new THREE.CatmullRomCurve3(points); + + const samples = spline.getPoints(points.length * subdivisions); + const geometrySpline = new THREE.BufferGeometry().setFromPoints(samples); + + const line = new THREE.Line( + geometrySpline, + new THREE.LineDashedMaterial({ color: 0xffffff, dashSize: 1, gapSize: 0.5 }), + ); + line.computeLineDistances(); + + objects.push(line); + scene.add(line); + + const geometryBox = box(50, 50, 50); + + const lineSegments = new THREE.LineSegments( + geometryBox, + new THREE.LineDashedMaterial({ color: 0xffaa00, dashSize: 3, gapSize: 1 }), + ); + lineSegments.computeLineDistances(); + + objects.push(lineSegments); + scene.add(lineSegments); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(WIDTH, HEIGHT); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function box(width, height, depth) { + ((width = width * 0.5), (height = height * 0.5), (depth = depth * 0.5)); + + const geometry = new THREE.BufferGeometry(); + const position = []; + + position.push( + -width, + -height, + -depth, + -width, + height, + -depth, + + -width, + height, + -depth, + width, + height, + -depth, + + width, + height, + -depth, + width, + -height, + -depth, + + width, + -height, + -depth, + -width, + -height, + -depth, + + -width, + -height, + depth, + -width, + height, + depth, + + -width, + height, + depth, + width, + height, + depth, + + width, + height, + depth, + width, + -height, + depth, + + width, + -height, + depth, + -width, + -height, + depth, + + -width, + -height, + -depth, + -width, + -height, + depth, + + -width, + height, + -depth, + -width, + height, + depth, + + width, + height, + -depth, + width, + height, + depth, + + width, + -height, + -depth, + width, + -height, + depth, + ); + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(position, 3)); + + return geometry; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.001; + + scene.traverse(function (object) { + if (object.isLine) { + object.rotation.x = 0.25 * time; + object.rotation.y = 0.25 * time; + } + }); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lines_fat.ts b/examples-testing/examples/webgl_lines_fat.ts new file mode 100644 index 000000000..73b29ad70 --- /dev/null +++ b/examples-testing/examples/webgl_lines_fat.ts @@ -0,0 +1,245 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Line2 } from 'three/addons/lines/Line2.js'; +import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; +import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; +import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; + +let line, renderer, scene, camera, camera2, controls; +let line1; +let matLine, matLineBasic, matLineDashed; +let gui; + +// viewport +let insetWidth; +let insetHeight; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setClearColor(0x000000, 0.0); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-40, 0, 60); + + camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); + camera2.position.copy(camera.position); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 10; + controls.maxDistance = 500; + + // Position and THREE.Color Data + + const positions = []; + const colors = []; + + const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 20.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); + + const spline = new THREE.CatmullRomCurve3(points); + const divisions = Math.round(12 * points.length); + const point = new THREE.Vector3(); + const color = new THREE.Color(); + + for (let i = 0, l = divisions; i < l; i++) { + const t = i / l; + + spline.getPoint(t, point); + positions.push(point.x, point.y, point.z); + + color.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); + colors.push(color.r, color.g, color.b); + } + + // Line2 ( LineGeometry, LineMaterial ) + + const geometry = new LineGeometry(); + geometry.setPositions(positions); + geometry.setColors(colors); + + matLine = new LineMaterial({ + color: 0xffffff, + linewidth: 5, // in world units with size attenuation, pixels otherwise + vertexColors: true, + + dashed: false, + alphaToCoverage: true, + }); + + line = new Line2(geometry, matLine); + line.computeLineDistances(); + line.scale.set(1, 1, 1); + scene.add(line); + + // THREE.Line ( THREE.BufferGeometry, THREE.LineBasicMaterial ) - rendered with gl.LINE_STRIP + + const geo = new THREE.BufferGeometry(); + geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + matLineBasic = new THREE.LineBasicMaterial({ vertexColors: true }); + matLineDashed = new THREE.LineDashedMaterial({ vertexColors: true, scale: 2, dashSize: 1, gapSize: 1 }); + + line1 = new THREE.Line(geo, matLineBasic); + line1.computeLineDistances(); + line1.visible = false; + scene.add(line1); + + // + + window.addEventListener('resize', onWindowResize); + onWindowResize(); + + initGui(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + insetWidth = window.innerHeight / 4; // square + insetHeight = window.innerHeight / 4; + + camera2.aspect = insetWidth / insetHeight; + camera2.updateProjectionMatrix(); +} + +function animate() { + // main scene + + renderer.setClearColor(0x000000, 0); + + renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); + + controls.update(); + + renderer.render(scene, camera); + + // inset scene + + renderer.setClearColor(0x222222, 1); + + renderer.clearDepth(); // important! + + renderer.setScissorTest(true); + + renderer.setScissor(20, 20, insetWidth, insetHeight); + + renderer.setViewport(20, 20, insetWidth, insetHeight); + + camera2.position.copy(camera.position); + camera2.quaternion.copy(camera.quaternion); + + renderer.render(scene, camera2); + + renderer.setScissorTest(false); +} + +// + +function initGui() { + gui = new GUI(); + + const param = { + 'line type': 0, + 'world units': false, + width: 10, + alphaToCoverage: false, + dashed: false, + 'dash scale': 1, + 'dash / gap': 1, + }; + + gui.add(param, 'line type', { LineGeometry: 0, 'gl.LINE': 1 }).onChange(function (val) { + switch (val) { + case 0: + line.visible = true; + + line1.visible = false; + + break; + + case 1: + line.visible = false; + + line1.visible = true; + + break; + } + }); + + gui.add(param, 'world units').onChange(function (val) { + matLine.worldUnits = val; + matLine.needsUpdate = true; + + if (val) { + widthController.name('width (world units)').min(0.1).max(0.5).setValue(0.5); + } else { + widthController.name('width (pixels)').min(1).max(10).setValue(10); + } + }); + + const widthController = gui + .add(param, 'width', 1, 10) + .name('width (pixels)') + .onChange(function (val) { + matLine.linewidth = val; + }); + + gui.add(param, 'alphaToCoverage').onChange(function (val) { + matLine.alphaToCoverage = val; + }); + + gui.add(param, 'dashed').onChange(function (val) { + matLine.dashed = val; + line1.material = val ? matLineDashed : matLineBasic; + }); + + gui.add(param, 'dash scale', 0.5, 2, 0.1).onChange(function (val) { + matLine.dashScale = val; + matLineDashed.scale = val; + }); + + gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { + switch (val) { + case 0: + matLine.dashSize = 2; + matLine.gapSize = 1; + + matLineDashed.dashSize = 2; + matLineDashed.gapSize = 1; + + break; + + case 1: + matLine.dashSize = 1; + matLine.gapSize = 1; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 1; + + break; + + case 2: + matLine.dashSize = 1; + matLine.gapSize = 2; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 2; + + break; + } + }); +} diff --git a/examples-testing/examples/webgl_lines_fat_raycasting.ts b/examples-testing/examples/webgl_lines_fat_raycasting.ts new file mode 100644 index 000000000..ac9400da3 --- /dev/null +++ b/examples-testing/examples/webgl_lines_fat_raycasting.ts @@ -0,0 +1,280 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; +import { LineSegments2 } from 'three/addons/lines/LineSegments2.js'; +import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; +import { Line2 } from 'three/addons/lines/Line2.js'; +import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; + +let line, thresholdLine, segments, thresholdSegments; +let renderer, scene, camera, controls; +let sphereInter, sphereOnLine; +let gui; +let timer; + +const color = new THREE.Color(); + +const pointer = new THREE.Vector2(Infinity, Infinity); + +const raycaster = new THREE.Raycaster(); + +raycaster.params.Line2 = {}; +raycaster.params.Line2.threshold = 0; + +const matLine = new LineMaterial({ + color: 0xffffff, + linewidth: 1, // in world units with size attenuation, pixels otherwise + worldUnits: true, + vertexColors: true, + + alphaToCoverage: true, +}); + +const matThresholdLine = new LineMaterial({ + color: 0xffffff, + linewidth: matLine.linewidth, // in world units with size attenuation, pixels otherwise + worldUnits: true, + // vertexColors: true, + transparent: true, + opacity: 0.2, + depthTest: false, + visible: false, +}); + +const params = { + 'line type': 0, + 'world units': matLine.worldUnits, + 'visualize threshold': matThresholdLine.visible, + width: matLine.linewidth, + alphaToCoverage: matLine.alphaToCoverage, + threshold: raycaster.params.Line2.threshold, + translation: 0, + animate: true, +}; + +init(); + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setClearColor(0x000000, 0.0); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-40, 0, 60); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 10; + controls.maxDistance = 500; + + const sphereGeometry = new THREE.SphereGeometry(0.25, 8, 4); + const sphereInterMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, depthTest: false }); + const sphereOnLineMaterial = new THREE.MeshBasicMaterial({ color: 0x00ff00, depthTest: false }); + + sphereInter = new THREE.Mesh(sphereGeometry, sphereInterMaterial); + sphereOnLine = new THREE.Mesh(sphereGeometry, sphereOnLineMaterial); + sphereInter.visible = false; + sphereOnLine.visible = false; + sphereInter.renderOrder = 10; + sphereOnLine.renderOrder = 10; + scene.add(sphereInter); + scene.add(sphereOnLine); + + // Position and THREE.Color Data + + const positions = []; + const colors = []; + const points = []; + for (let i = -50; i < 50; i++) { + const t = i / 3; + points.push(new THREE.Vector3(t * Math.sin(2 * t), t, t * Math.cos(2 * t))); + } + + const spline = new THREE.CatmullRomCurve3(points); + const divisions = Math.round(3 * points.length); + const point = new THREE.Vector3(); + const color = new THREE.Color(); + + for (let i = 0, l = divisions; i < l; i++) { + const t = i / l; + + spline.getPoint(t, point); + positions.push(point.x, point.y, point.z); + + color.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); + colors.push(color.r, color.g, color.b); + } + + const lineGeometry = new LineGeometry(); + lineGeometry.setPositions(positions); + lineGeometry.setColors(colors); + + const segmentsGeometry = new LineSegmentsGeometry(); + segmentsGeometry.setPositions(positions); + segmentsGeometry.setColors(colors); + + segments = new LineSegments2(segmentsGeometry, matLine); + segments.computeLineDistances(); + segments.scale.set(1, 1, 1); + scene.add(segments); + segments.visible = false; + + thresholdSegments = new LineSegments2(segmentsGeometry, matThresholdLine); + thresholdSegments.computeLineDistances(); + thresholdSegments.scale.set(1, 1, 1); + scene.add(thresholdSegments); + thresholdSegments.visible = false; + + line = new Line2(lineGeometry, matLine); + line.computeLineDistances(); + line.scale.set(1, 1, 1); + scene.add(line); + + thresholdLine = new Line2(lineGeometry, matThresholdLine); + thresholdLine.computeLineDistances(); + thresholdLine.scale.set(1, 1, 1); + scene.add(thresholdLine); + + const geo = new THREE.BufferGeometry(); + geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + // + + document.addEventListener('pointermove', onPointerMove); + window.addEventListener('resize', onWindowResize); + onWindowResize(); + + initGui(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + const obj = line.visible ? line : segments; + thresholdLine.position.copy(line.position); + thresholdLine.quaternion.copy(line.quaternion); + thresholdSegments.position.copy(segments.position); + thresholdSegments.quaternion.copy(segments.quaternion); + + if (params.animate) { + line.rotation.y += delta * 0.1; + + segments.rotation.y = line.rotation.y; + } + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObject(obj); + + if (intersects.length > 0) { + sphereInter.visible = true; + sphereOnLine.visible = true; + + sphereInter.position.copy(intersects[0].point); + sphereOnLine.position.copy(intersects[0].pointOnLine); + + const index = intersects[0].faceIndex; + const colors = obj.geometry.getAttribute('instanceColorStart'); + + color.fromBufferAttribute(colors, index); + + sphereInter.material.color.copy(color).offsetHSL(0.3, 0, 0); + sphereOnLine.material.color.copy(color).offsetHSL(0.7, 0, 0); + + renderer.domElement.style.cursor = 'crosshair'; + } else { + sphereInter.visible = false; + sphereOnLine.visible = false; + renderer.domElement.style.cursor = ''; + } + + renderer.render(scene, camera); +} + +// + +function switchLine(val) { + switch (val) { + case 0: + line.visible = true; + thresholdLine.visible = true; + + segments.visible = false; + thresholdSegments.visible = false; + + break; + + case 1: + line.visible = false; + thresholdLine.visible = false; + + segments.visible = true; + thresholdSegments.visible = true; + + break; + } +} + +function initGui() { + gui = new GUI(); + + gui.add(params, 'line type', { LineGeometry: 0, LineSegmentsGeometry: 1 }) + .onChange(function (val) { + switchLine(val); + }) + .setValue(1); + + gui.add(params, 'world units').onChange(function (val) { + matLine.worldUnits = val; + matThresholdLine.worldUnits = val; + }); + + gui.add(params, 'visualize threshold').onChange(function (val) { + matThresholdLine.visible = val; + }); + + gui.add(params, 'width', 1, 10).onChange(function (val) { + matLine.linewidth = val; + matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; + }); + + gui.add(params, 'alphaToCoverage').onChange(function (val) { + matLine.alphaToCoverage = val; + }); + + gui.add(params, 'threshold', 0, 10).onChange(function (val) { + raycaster.params.Line2.threshold = val; + matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; + }); + + gui.add(params, 'translation', 0, 10).onChange(function (val) { + line.position.x = val; + segments.position.x = val; + }); + + gui.add(params, 'animate'); +} diff --git a/examples-testing/examples/webgl_lines_fat_wireframe.ts b/examples-testing/examples/webgl_lines_fat_wireframe.ts new file mode 100644 index 000000000..59660ad7e --- /dev/null +++ b/examples-testing/examples/webgl_lines_fat_wireframe.ts @@ -0,0 +1,210 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; +import { Wireframe } from 'three/addons/lines/Wireframe.js'; +import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; + +let wireframe, renderer, scene, camera, camera2, controls; +let wireframe1; +let matLine, matLineBasic, matLineDashed; +let stats; +let gui; + +// viewport +let insetWidth; +let insetHeight; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setClearColor(0x000000, 0.0); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-50, 0, 50); + + camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); + camera2.position.copy(camera.position); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 10; + controls.maxDistance = 500; + + // Wireframe ( WireframeGeometry2, LineMaterial ) + + let geo = new THREE.IcosahedronGeometry(20, 1); + + const geometry = new WireframeGeometry2(geo); + + matLine = new LineMaterial({ + color: 0x4080ff, + linewidth: 5, // in pixels + dashed: false, + }); + + wireframe = new Wireframe(geometry, matLine); + wireframe.computeLineDistances(); + wireframe.scale.set(1, 1, 1); + scene.add(wireframe); + + // Line ( THREE.WireframeGeometry, THREE.LineBasicMaterial ) - rendered with gl.LINE + + geo = new THREE.WireframeGeometry(geo); + + matLineBasic = new THREE.LineBasicMaterial({ color: 0x4080ff }); + matLineDashed = new THREE.LineDashedMaterial({ scale: 2, dashSize: 1, gapSize: 1 }); + + wireframe1 = new THREE.LineSegments(geo, matLineBasic); + wireframe1.computeLineDistances(); + wireframe1.visible = false; + scene.add(wireframe1); + + // + + window.addEventListener('resize', onWindowResize); + onWindowResize(); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + initGui(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + insetWidth = window.innerHeight / 4; // square + insetHeight = window.innerHeight / 4; + + camera2.aspect = insetWidth / insetHeight; + camera2.updateProjectionMatrix(); +} + +function animate() { + // main scene + + renderer.setClearColor(0x000000, 0); + + renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); + + renderer.render(scene, camera); + + // inset scene + + renderer.setClearColor(0x222222, 1); + + renderer.clearDepth(); // important! + + renderer.setScissorTest(true); + + renderer.setScissor(20, 20, insetWidth, insetHeight); + + renderer.setViewport(20, 20, insetWidth, insetHeight); + + camera2.position.copy(camera.position); + camera2.quaternion.copy(camera.quaternion); + + renderer.render(scene, camera2); + + renderer.setScissorTest(false); + + stats.update(); +} + +// + +function initGui() { + gui = new GUI(); + + const param = { + 'line type': 0, + 'width (px)': 5, + dashed: false, + 'dash scale': 1, + 'dash / gap': 1, + }; + + gui.add(param, 'line type', { LineGeometry: 0, 'gl.LINE': 1 }).onChange(function (val) { + switch (val) { + case 0: + wireframe.visible = true; + + wireframe1.visible = false; + + break; + + case 1: + wireframe.visible = false; + + wireframe1.visible = true; + + break; + } + }); + + gui.add(param, 'width (px)', 1, 10).onChange(function (val) { + matLine.linewidth = val; + }); + + gui.add(param, 'dashed').onChange(function (val) { + matLine.dashed = val; + + // dashed is implemented as a defines -- not as a uniform. this could be changed. + // ... or THREE.LineDashedMaterial could be implemented as a separate material + // temporary hack - renderer should do this eventually + if (val) matLine.defines.USE_DASH = ''; + else delete matLine.defines.USE_DASH; + matLine.needsUpdate = true; + + wireframe1.material = val ? matLineDashed : matLineBasic; + }); + + gui.add(param, 'dash scale', 0.5, 1, 0.1).onChange(function (val) { + matLine.dashScale = val; + matLineDashed.scale = val; + }); + + gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { + switch (val) { + case 0: + matLine.dashSize = 2; + matLine.gapSize = 1; + + matLineDashed.dashSize = 2; + matLineDashed.gapSize = 1; + + break; + + case 1: + matLine.dashSize = 1; + matLine.gapSize = 1; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 1; + + break; + + case 2: + matLine.dashSize = 1; + matLine.gapSize = 2; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 2; + + break; + } + }); +} diff --git a/examples-testing/examples/webgl_loader_3dm.ts b/examples-testing/examples/webgl_loader_3dm.ts new file mode 100644 index 000000000..292295699 --- /dev/null +++ b/examples-testing/examples/webgl_loader_3dm.ts @@ -0,0 +1,94 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer; +let controls, gui; + +init(); + +function init() { + THREE.Object3D.DEFAULT_UP.set(0, 0, 1); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(26, -40, 5); + + scene = new THREE.Scene(); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 6); + directionalLight.position.set(0, 0, 2); + scene.add(directionalLight); + + const loader = new Rhino3dmLoader(); + loader.setLibraryPath('https://cdn.jsdelivr.net/npm/rhino3dm@8.32.1/'); + loader.load( + 'models/3dm/Rhino_Logo.3dm', + function (object) { + scene.add(object); + initGUI(object.userData.layers); + + // hide spinner + document.getElementById('loader').style.display = 'none'; + }, + function (progress) { + console.log((progress.loaded / progress.total) * 100 + '%'); + }, + function (error) { + console.log(error); + }, + ); + + controls = new OrbitControls(camera, renderer.domElement); + + window.addEventListener('resize', resize); +} + +function resize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + renderer.render(scene, camera); +} + +function initGUI(layers) { + gui = new GUI({ title: 'layers' }); + + for (let i = 0; i < layers.length; i++) { + const layer = layers[i]; + gui.add(layer, 'visible') + .name(layer.name) + .onChange(function (val) { + const name = this.object.name; + + scene.traverse(function (child) { + if (child.userData.hasOwnProperty('attributes')) { + if ('layerIndex' in child.userData.attributes) { + const layerName = layers[child.userData.attributes.layerIndex].name; + + if (layerName === name) { + child.visible = val; + layer.visible = val; + } + } + } + }); + }); + } +} diff --git a/examples-testing/examples/webgl_loader_3ds.ts b/examples-testing/examples/webgl_loader_3ds.ts new file mode 100644 index 000000000..10ce34076 --- /dev/null +++ b/examples-testing/examples/webgl_loader_3ds.ts @@ -0,0 +1,62 @@ +import * as THREE from 'three'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { TDSLoader } from 'three/addons/loaders/TDSLoader.js'; + +let container, controls; +let camera, scene, renderer; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.z = 2; + + scene = new THREE.Scene(); + scene.add(new THREE.AmbientLight(0xffffff, 3)); + + const directionalLight = new THREE.DirectionalLight(0xffeedd, 3); + directionalLight.position.set(0, 0, 2); + scene.add(directionalLight); + + //3ds files dont store normal maps + const normal = new THREE.TextureLoader().load('models/3ds/portalgun/textures/normal.jpg'); + + const loader = new TDSLoader(); + loader.setResourcePath('models/3ds/portalgun/textures/'); + loader.load('models/3ds/portalgun/portalgun.3ds', function (object) { + object.traverse(function (child) { + if (child.isMesh) { + child.material.specular.setScalar(0.1); + child.material.normalMap = normal; + } + }); + + scene.add(object); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + controls = new TrackballControls(camera, renderer.domElement); + + window.addEventListener('resize', resize); +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_3mf.ts b/examples-testing/examples/webgl_loader_3mf.ts new file mode 100644 index 000000000..83fac845e --- /dev/null +++ b/examples-testing/examples/webgl_loader_3mf.ts @@ -0,0 +1,113 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, object, loader, controls; + +const params = { + asset: 'cube_gears', +}; + +const assets = [ + 'cube_gears', + 'facecolors', + 'multipletextures', + 'pyramid', + 'spinal implant', + 'variable voronoi', + 'vertexcolors', +]; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x333333); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); + + // Z is up for objects intended to be 3D printed. + + camera.up.set(0, 0, 1); + camera.position.set(-100, -250, 100); + scene.add(camera); + + controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.minDistance = 50; + controls.maxDistance = 400; + controls.enablePan = false; + controls.update(); + + scene.add(new THREE.AmbientLight(0xffffff, 0.6)); + + const light = new THREE.DirectionalLight(0xffffff, 2); + light.position.set(-1, -2.5, 1); + scene.add(light); + + const manager = new THREE.LoadingManager(); + + manager.onLoad = function () { + const aabb = new THREE.Box3().setFromObject(object); + const center = aabb.getCenter(new THREE.Vector3()); + + object.position.x += object.position.x - center.x; + object.position.y += object.position.y - center.y; + object.position.z += object.position.z - center.z; + + controls.reset(); + + scene.add(object); + render(); + }; + + loader = new ThreeMFLoader(manager); + loadAsset(params.asset); + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + gui.add(params, 'asset', assets).onChange(function (value) { + loadAsset(value); + }); +} + +function loadAsset(asset) { + loader.load('models/3mf/' + asset + '.3mf', function (group) { + if (object) { + object.traverse(function (child) { + if (child.material) child.material.dispose(); + if (child.material && child.material.map) child.material.map.dispose(); + if (child.geometry) child.geometry.dispose(); + }); + + scene.remove(object); + } + + // + + object = group; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_3mf_materials.ts b/examples-testing/examples/webgl_loader_3mf_materials.ts new file mode 100644 index 000000000..b33ffc3e0 --- /dev/null +++ b/examples-testing/examples/webgl_loader_3mf_materials.ts @@ -0,0 +1,98 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; + +let camera, scene, renderer; + +init(); + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 10, 500); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); + camera.position.set(-50, 40, 50); + scene.add(camera); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); + hemiLight.position.set(0, 100, 0); + scene.add(hemiLight); + + const sunLight = new THREE.SunLight(0xffffff, 3); + sunLight.position.set(0, 40, 50); + sunLight.castShadow = true; + sunLight.shadow.camera.far = 100; + scene.add(sunLight); + + // + + const manager = new THREE.LoadingManager(); + + const loader = new ThreeMFLoader(manager); + loader.load('./models/3mf/truck.3mf', function (object) { + object.rotation.set(-Math.PI / 2, 0, 0); // z-up conversion + + object.traverse(function (child) { + child.castShadow = true; + }); + + scene.add(object); + }); + + // + + manager.onLoad = function () { + render(); + }; + + // + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(1000, 1000), + new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), + ); + ground.rotation.x = -Math.PI / 2; + ground.position.y = 11; + ground.receiveShadow = true; + scene.add(ground); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + document.body.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.minDistance = 50; + controls.maxDistance = 200; + controls.enablePan = false; + controls.target.set(0, 20, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); + + render(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_amf.ts b/examples-testing/examples/webgl_loader_amf.ts new file mode 100644 index 000000000..ee576e04f --- /dev/null +++ b/examples-testing/examples/webgl_loader_amf.ts @@ -0,0 +1,62 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { AMFLoader } from 'three/addons/loaders/AMFLoader.js'; + +let camera, scene, renderer; + +init(); + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x999999); + + scene.add(new THREE.AmbientLight(0x999999)); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); + + // Z is up for objects intended to be 3D printed. + + camera.up.set(0, 0, 1); + camera.position.set(0, -9, 6); + + camera.add(new THREE.PointLight(0xffffff, 250)); + + scene.add(camera); + + const grid = new THREE.GridHelper(50, 50, 0xffffff, 0x555555); + grid.rotateOnAxis(new THREE.Vector3(1, 0, 0), 90 * (Math.PI / 180)); + scene.add(grid); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + const loader = new AMFLoader(); + loader.load('./models/amf/rook.amf', function (amfobject) { + scene.add(amfobject); + render(); + }); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.target.set(0, 0, 2); + controls.enableZoom = false; + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_bvh.ts b/examples-testing/examples/webgl_loader_bvh.ts new file mode 100644 index 000000000..70cec7e6a --- /dev/null +++ b/examples-testing/examples/webgl_loader_bvh.ts @@ -0,0 +1,64 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { BVHLoader } from 'three/addons/loaders/BVHLoader.js'; + +const timer = new THREE.Timer(); +timer.connect(document); + +let camera, controls, scene, renderer; +let mixer; + +init(); + +const loader = new BVHLoader(); +loader.load('models/bvh/pirouette.bvh', function (result) { + const skeletonHelper = new THREE.SkeletonHelper(result.skeleton.bones[0]); + + scene.add(result.skeleton.bones[0]); + scene.add(skeletonHelper); + + // play animation + mixer = new THREE.AnimationMixer(result.skeleton.bones[0]); + mixer.clipAction(result.clip).play(); +}); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 200, 300); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xeeeeee); + + scene.add(new THREE.GridHelper(400, 10)); + + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 300; + controls.maxDistance = 700; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_collada.ts b/examples-testing/examples/webgl_loader_collada.ts new file mode 100644 index 000000000..3106369c8 --- /dev/null +++ b/examples-testing/examples/webgl_loader_collada.ts @@ -0,0 +1,86 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js'; + +let container, stats, timer; +let camera, scene, renderer, elf; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); + camera.position.set(8, 10, 8); + camera.lookAt(0, 3, 0); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // loading manager + + const loadingManager = new THREE.LoadingManager(function () { + scene.add(elf); + }); + + // collada + + const loader = new ColladaLoader(loadingManager); + loader.load('./models/collada/elf/elf.dae', function (collada) { + elf = collada.scene; + }); + + // + + const ambientLight = new THREE.AmbientLight(0xffffff); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); + directionalLight.position.set(1, 1, 0).normalize(); + scene.add(directionalLight); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + const delta = timer.getDelta(); + + if (elf !== undefined) { + elf.rotation.z += delta * 0.5; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_collada_skinning.ts b/examples-testing/examples/webgl_loader_collada_skinning.ts new file mode 100644 index 000000000..bbbd0ac3e --- /dev/null +++ b/examples-testing/examples/webgl_loader_collada_skinning.ts @@ -0,0 +1,100 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container, stats, timer, controls; +let camera, scene, renderer, mixer; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(15, 10, -15); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // collada + + const loader = new ColladaLoader(); + loader.load('./models/collada/stormtrooper/stormtrooper.dae', function (collada) { + const avatar = collada.scene; + const animations = avatar.animations; + + mixer = new THREE.AnimationMixer(avatar); + mixer.clipAction(animations[0]).play(); + + scene.add(avatar); + }); + + // + + const gridHelper = new THREE.GridHelper(10, 20, 0xc1c1c1, 0x8d8d8d); + scene.add(gridHelper); + + // + + const ambientLight = new THREE.AmbientLight(0xffffff, 0.6); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 3); + directionalLight.position.set(1.5, 1, -1.5); + scene.add(directionalLight); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.screenSpacePanning = true; + controls.minDistance = 5; + controls.maxDistance = 40; + controls.target.set(0, 2, 0); + controls.update(); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + const delta = timer.getDelta(); + + if (mixer !== undefined) { + mixer.update(delta); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_draco.ts b/examples-testing/examples/webgl_loader_draco.ts new file mode 100644 index 000000000..4d41740e6 --- /dev/null +++ b/examples-testing/examples/webgl_loader_draco.ts @@ -0,0 +1,81 @@ +import * as THREE from 'three'; + +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; + +let camera, scene, renderer; + +const container = document.querySelector('#container'); + +// Configure and create Draco decoder. +const dracoLoader = new DRACOLoader(); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 15); + camera.position.set(3, 0.25, 3); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x443333); + scene.fog = new THREE.Fog(0x443333, 1, 4); + + // Ground + const plane = new THREE.Mesh(new THREE.PlaneGeometry(8, 8), new THREE.MeshLambertMaterial({ color: 0xcbcbcb })); + plane.rotation.x = -Math.PI / 2; + plane.position.y = 0.03; + plane.receiveShadow = true; + scene.add(plane); + + // Lights + const hemiLight = new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3); + scene.add(hemiLight); + + const spotLight = new THREE.SpotLight(); + spotLight.intensity = 7; + spotLight.angle = Math.PI / 16; + spotLight.penumbra = 0.5; + spotLight.castShadow = true; + spotLight.shadow.radius = 8; + spotLight.position.set(-1, 1, 1); + scene.add(spotLight); + + dracoLoader.load('models/draco/bunny.drc', function (geometry) { + geometry.computeVertexNormals(); + + const material = new THREE.MeshStandardMaterial({ color: 0xa5a5a5 }); + const mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + mesh.receiveShadow = true; + scene.add(mesh); + + // Release decoder resources. + dracoLoader.dispose(); + }); + + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const timer = Date.now() * 0.0003; + + camera.position.x = Math.sin(timer) * 0.5; + camera.position.z = Math.cos(timer) * 0.5; + camera.lookAt(0, 0.1, 0); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_fbx.ts b/examples-testing/examples/webgl_loader_fbx.ts new file mode 100644 index 000000000..01e72722a --- /dev/null +++ b/examples-testing/examples/webgl_loader_fbx.ts @@ -0,0 +1,216 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +const manager = new THREE.LoadingManager(); + +let camera, scene, renderer, controls, stats, object, loader, guiMorphsFolder, guiAnimationsFolder; +let mixer; + +const timer = new THREE.Timer(); +timer.connect(document); + +const params = { + asset: 'Samba Dancing', +}; + +const assets = [ + 'Samba Dancing', + 'morph_test', + 'monkey', + 'monkey_embedded_texture', + 'vCube', + 'archer/ArcherRi01', + 'warrior/Warrior', + 'stanford-bunny', + 'mixamo', + 'RotationTest', + 'exampleWindow', + 'Head_69', + 'morph-translation', + 'ball_anims_asc_2018', +]; + +const scales = new Map(); +scales.set('warrior/Warrior', 100); +scales.set('archer/ArcherRi01', 100); +scales.set('stanford-bunny', 0.001); +scales.set('Head_69', 100); +scales.set('ball_anims_asc_2018', 50); + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(100, 200, 300); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 200, 1000); + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 5); + hemiLight.position.set(0, 200, 0); + scene.add(hemiLight); + + const sunLight = new THREE.SunLight(0xffffff, 5); + sunLight.position.set(0, 200, 100); + sunLight.castShadow = true; + scene.add(sunLight); + + // ground + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(2000, 2000), + new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false }), + ); + mesh.rotation.x = -Math.PI / 2; + mesh.receiveShadow = true; + scene.add(mesh); + + const grid = new THREE.GridHelper(2000, 20, 0x000000, 0x000000); + grid.material.opacity = 0.2; + grid.material.transparent = true; + scene.add(grid); + + loader = new FBXLoader(manager); + loadAsset(params.asset); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + container.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enablePan = false; + controls.enableDamping = true; + controls.target.set(0, 100, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); + + // stats + stats = new Stats(); + container.appendChild(stats.dom); + + const gui = new GUI(); + gui.add(params, 'asset', assets).onChange(function (value) { + loadAsset(value); + }); + + guiMorphsFolder = gui.addFolder('Morphs').hide(); + guiAnimationsFolder = gui.addFolder('Animations').hide(); +} + +function loadAsset(asset) { + loader.trimAnimationClips = asset === 'ball_anims_asc_2018'; + + loader.load('models/fbx/' + asset + '.fbx', function (group) { + if (object) { + object.traverse(function (child) { + if (child.isSkinnedMesh) { + child.skeleton.dispose(); + } + + if (child.material) { + const materials = Array.isArray(child.material) ? child.material : [child.material]; + materials.forEach(material => { + if (material.map) material.map.dispose(); + material.dispose(); + }); + } + + if (child.geometry) child.geometry.dispose(); + }); + + scene.remove(object); + } + + // + + object = group; + + const scale = scales.get(asset); + object.scale.setScalar(scale || 1); + + guiAnimationsFolder.children.forEach(child => child.destroy()); + guiAnimationsFolder.hide(); + + if (object.animations && object.animations.length) { + mixer = new THREE.AnimationMixer(object); + + const action = mixer.clipAction(object.animations[0]); + action.play(); + + const clips = object.animations; + const animationParams = { clip: clips[0].name }; + + guiAnimationsFolder.show(); + guiAnimationsFolder + .add( + animationParams, + 'clip', + clips.map(clip => clip.name), + ) + .onChange(function (name) { + mixer.stopAllAction(); + + const clip = THREE.AnimationClip.findByName(clips, name); + mixer.clipAction(clip).play(); + }); + } else { + mixer = null; + } + + guiMorphsFolder.children.forEach(child => child.destroy()); + guiMorphsFolder.hide(); + + object.traverse(function (child) { + if (child.isMesh) { + child.castShadow = true; + child.receiveShadow = true; + + if (child.morphTargetDictionary) { + guiMorphsFolder.show(); + const meshFolder = guiMorphsFolder.addFolder(child.name || child.uuid); + Object.keys(child.morphTargetDictionary).forEach(key => { + meshFolder.add(child.morphTargetInfluences, child.morphTargetDictionary[key], 0, 1, 0.01); + }); + } + } + }); + + scene.add(object); + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + controls.update(); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_loader_fbx_nurbs.ts b/examples-testing/examples/webgl_loader_fbx_nurbs.ts new file mode 100644 index 000000000..f2e45bcb5 --- /dev/null +++ b/examples-testing/examples/webgl_loader_fbx_nurbs.ts @@ -0,0 +1,61 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; + +let camera, scene, renderer, stats; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(2, 18, 28); + + scene = new THREE.Scene(); + + // grid + const gridHelper = new THREE.GridHelper(28, 28, 0x303030, 0x303030); + scene.add(gridHelper); + + // stats + stats = new Stats(); + container.appendChild(stats.dom); + + // model + const loader = new FBXLoader(); + loader.load('models/fbx/nurbs.fbx', function (object) { + scene.add(object); + }); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 12, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_loader_gcode.ts b/examples-testing/examples/webgl_loader_gcode.ts new file mode 100644 index 000000000..16dfb92e2 --- /dev/null +++ b/examples-testing/examples/webgl_loader_gcode.ts @@ -0,0 +1,81 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, controls, loader; + +let model; + +const params = { + asset: 'benchy', +}; + +const assets = ['benchy', 'test_m82', 'test_m83']; + +const positions = [new THREE.Vector3(-100, -20, 100), new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, 0)]; + +init(); +render(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 70); + + scene = new THREE.Scene(); + + loader = new GCodeLoader(); + loadAsset(params.asset); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 10; + controls.maxDistance = 100; + + window.addEventListener('resize', resize); + + const gui = new GUI(); + + gui.add(params, 'asset', assets).onChange(function (value) { + if (model) { + model.traverse(function (object) { + if (object.material) object.material.dispose(); + if (object.geometry) object.geometry.dispose(); + }); + + scene.remove(model); + } + + loadAsset(value); + }); + + gui.open(); +} + +function loadAsset(asset) { + loader.load('models/gcode/' + asset + '.gcode', function (object) { + model = object; + model.position.copy(positions[assets.indexOf(asset)]); + scene.add(model); + controls.reset(); + }); +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf.ts b/examples-testing/examples/webgl_loader_gltf.ts new file mode 100644 index 000000000..e0cb68546 --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf.ts @@ -0,0 +1,167 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, controls; +let currentModel, mixer; +let currentLoadId = 0; + +const timer = new THREE.Timer(); + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + render(); + + // model + + fetch('https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json') + .then(response => response.json()) + .then(models => { + const gui = new GUI(); + const modelNames = models.map(m => m.name); + const params = { model: 'DamagedHelmet' }; + + if (!modelNames.includes(params.model) && modelNames.length > 0) { + params.model = modelNames[0]; + } + + gui.add(params, 'model', modelNames).onChange(name => { + const modelInfo = models.find(m => m.name === name); + loadModel(modelInfo); + }); + + gui.add(scene, 'backgroundBlurriness', 0, 1); + + const initialModel = models.find(m => m.name === params.model); + if (initialModel) loadModel(initialModel); + }); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + container.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2; + controls.maxDistance = 10; + controls.target.set(0, 0, -0.2); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function loadModel(modelInfo) { + const variants = modelInfo.variants; + const variant = variants['glTF-Binary'] || variants['glTF']; + const url = `https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/${modelInfo.name}/${variant.endsWith('.glb') ? 'glTF-Binary' : 'glTF'}/${variant}`; + + if (currentModel) { + scene.remove(currentModel); + currentModel = null; + } + + if (mixer) { + mixer.stopAllAction(); + mixer = null; + } + + const loadId = ++currentLoadId; + + const loader = new GLTFLoader(); + loader.load(url, async function (gltf) { + if (loadId !== currentLoadId) return; + + currentModel = gltf.scene; + + // wait until the model can be added to the scene without blocking due to shader compilation + + await renderer.compileAsync(currentModel, camera, scene); + + if (loadId !== currentLoadId) return; + + scene.add(currentModel); + + fitCameraToSelection(camera, controls, currentModel); + + // animations + + if (gltf.animations.length > 0) { + mixer = new THREE.AnimationMixer(currentModel); + + for (const animation of gltf.animations) { + mixer.clipAction(animation).play(); + } + } + }); +} + +function fitCameraToSelection(camera, controls, selection, fitOffset = 1.3) { + const box = new THREE.Box3(); + box.setFromObject(selection); + + const size = box.getSize(new THREE.Vector3()); + const center = box.getCenter(new THREE.Vector3()); + + const maxSize = Math.max(size.x, size.y, size.z); + const fitHeightDistance = maxSize / (2 * Math.atan((Math.PI * camera.fov) / 360)); + // const fitWidthDistance = fitHeightDistance / camera.aspect; + // const distance = fitOffset * Math.max( fitHeightDistance, fitWidthDistance ); + const distance = fitOffset * fitHeightDistance; + + const direction = controls.target.clone().sub(camera.position).normalize().multiplyScalar(distance); + + controls.maxDistance = distance * 10; + controls.minDistance = distance / 10; + controls.target.copy(center); + + camera.near = distance / 100; + camera.far = distance * 100; + camera.updateProjectionMatrix(); + + camera.position.copy(controls.target).sub(direction); + + controls.update(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +// + +function render() { + timer.update(); + + controls.update(); + + if (mixer) mixer.update(timer.getDelta()); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_animation_pointer.ts b/examples-testing/examples/webgl_loader_gltf_animation_pointer.ts new file mode 100644 index 000000000..7f94fafdd --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_animation_pointer.ts @@ -0,0 +1,91 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +import { GLTFAnimationPointerExtension } from '@needle-tools/three-animation-pointer'; + +let mixer; + +const timer = new THREE.Timer(); +timer.connect(document); +const container = document.getElementById('container'); + +const stats = new Stats(); +container.appendChild(stats.dom); + +const renderer = new THREE.WebGLRenderer({ antialias: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +container.appendChild(renderer.domElement); + +const pmremGenerator = new THREE.PMREMGenerator(renderer); + +const scene = new THREE.Scene(); +scene.background = new THREE.Color(0xbfe3dd); +scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + +const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.2, 100); +camera.position.set(-3, 2, 6); + +const controls = new OrbitControls(camera, renderer.domElement); +controls.target.set(0, 0.5, 0); +controls.update(); +controls.enablePan = false; +controls.enableDamping = true; + +const dracoLoader = new DRACOLoader(); +dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + +const ktx2Loader = new KTX2Loader().detectSupport(renderer); + +const loader = new GLTFLoader(); +loader.setDRACOLoader(dracoLoader); +loader.setKTX2Loader(ktx2Loader); + +loader.register(p => { + return new GLTFAnimationPointerExtension(p); +}); + +loader.load( + 'https://cloud.needle.tools/-/assets/Z23hmXB27L6Db-optimized/file', + function (gltf) { + const model = gltf.scene; + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + mixer.clipAction(gltf.animations[0]).play(); + + renderer.setAnimationLoop(animate); + }, + undefined, + function (e) { + console.error(e); + }, +); + +window.onresize = function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +}; + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + mixer.update(delta); + + controls.update(); + + stats.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_anisotropy.ts b/examples-testing/examples/webgl_loader_gltf_anisotropy.ts new file mode 100644 index 000000000..f0dd05cfe --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_anisotropy.ts @@ -0,0 +1,68 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +let renderer, scene, camera, controls; + +init(); + +async function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.35; + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.set(-0.35, -0.2, 0.35); + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, -0.08, 0.11); + controls.minDistance = 0.1; + controls.maxDistance = 2; + controls.addEventListener('change', render); + controls.update(); + + const hdrLoader = new UltraHDRLoader().setPath('textures/equirectangular/'); + const gltfLoader = new GLTFLoader().setPath('models/gltf/'); + + const [texture, gltf] = await Promise.all([ + hdrLoader.loadAsync('royal_esplanade_2k.hdr.jpg'), + gltfLoader.loadAsync('AnisotropyBarnLamp.glb'), + ]); + + // environment + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.backgroundBlurriness = 0.5; + scene.environment = texture; + + // model + + scene.add(gltf.scene); + + render(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_avif.ts b/examples-testing/examples/webgl_loader_gltf_avif.ts new file mode 100644 index 000000000..516987a9c --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_avif.ts @@ -0,0 +1,61 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +let camera, scene, renderer; + +init(); +render(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(1.5, 4, 9); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf6eedc); + + // + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + loader.setPath('models/gltf/AVIFTest/'); + loader.load('forest_house.glb', function (gltf) { + scene.add(gltf.scene); + + render(); + }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.target.set(0, 2, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_compressed.ts b/examples-testing/examples/webgl_loader_gltf_compressed.ts new file mode 100644 index 000000000..24dec183d --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_compressed.ts @@ -0,0 +1,83 @@ +import * as THREE from 'three'; + +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; + +let camera, scene, renderer; + +init(); +render(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + container.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(0, 100, 0); + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbbbbbb); + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + environment.dispose(); + + const grid = new THREE.GridHelper(500, 10, 0xffffff, 0xffffff); + grid.material.opacity = 0.5; + grid.material.depthWrite = false; + grid.material.transparent = true; + scene.add(grid); + + const ktx2Loader = new KTX2Loader().detectSupport(renderer); + + const loader = new GLTFLoader().setPath('models/gltf/'); + loader.setKTX2Loader(ktx2Loader); + loader.setMeshoptDecoder(MeshoptDecoder); + loader.load('coffeemat.glb', function (gltf) { + // coffeemat.glb was produced from the source scene using gltfpack: + // gltfpack -i coffeemat/scene.gltf -o coffeemat.glb -cc -tc + // The resulting model uses EXT_meshopt_compression (for geometry) and KHR_texture_basisu (for texture compression using ETC1S/BasisLZ) + + gltf.scene.position.y = 8; + + scene.add(gltf.scene); + + render(); + }); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 400; + controls.maxDistance = 1000; + controls.target.set(10, 90, -16); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_dispersion.ts b/examples-testing/examples/webgl_loader_gltf_dispersion.ts new file mode 100644 index 000000000..0f1d7e57a --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_dispersion.ts @@ -0,0 +1,66 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +let camera, scene, renderer; + +init().then(render); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 5); + camera.position.set(0.1, 0.05, 0.15); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1; + container.appendChild(renderer.domElement); + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.backgroundBlurriness = 0.5; + + const env = pmremGenerator.fromScene(environment, 0.04).texture; + scene.background = env; + scene.environment = env; + environment.dispose(); + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/DispersionTest.glb'); + + scene.add(gltf.scene); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 0.1; + controls.maxDistance = 10; + controls.target.set(0, 0, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_instancing.ts b/examples-testing/examples/webgl_loader_gltf_instancing.ts new file mode 100644 index 000000000..6acb140ec --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_instancing.ts @@ -0,0 +1,69 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +let camera, scene, renderer; + +init(); +render(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-0.9, 0.41, -0.89); + + scene = new THREE.Scene(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + render(); + + // model + + const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF-instancing/'); + loader.load('DamagedHelmetGpuInstancing.gltf', function (gltf) { + scene.add(gltf.scene); + + render(); + }); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 0.2; + controls.maxDistance = 10; + controls.target.set(0, 0.25, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_iridescence.ts b/examples-testing/examples/webgl_loader_gltf_iridescence.ts new file mode 100644 index 000000000..5519835fe --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_iridescence.ts @@ -0,0 +1,66 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let renderer, scene, camera, controls; + +init().catch(function (err) { + console.error(err); +}); + +async function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setAnimationLoop(animate); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.05, 20); + camera.position.set(0.35, 0.05, 0.35); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = -0.5; + controls.target.set(0, 0.2, 0); + controls.update(); + + const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); + + const gltfLoader = new GLTFLoader().setPath('models/gltf/'); + + const [texture, gltf] = await Promise.all([ + hdrLoader.loadAsync('venice_sunset_1k.hdr'), + gltfLoader.loadAsync('IridescenceLamp.glb'), + ]); + + // environment + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + // model + + scene.add(gltf.scene); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_progressive_lod.ts b/examples-testing/examples/webgl_loader_gltf_progressive_lod.ts new file mode 100644 index 000000000..8d1c60480 --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_progressive_lod.ts @@ -0,0 +1,143 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { useNeedleProgressive } from '@needle-tools/gltf-progressive'; + +let camera, scene, renderer, mixer; +let airshipModel; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 40); + camera.position.set(-9, 2, -13); + + const fog = new THREE.Fog('#131055', 15, 50); + scene.fog = fog; + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 0.1; + controls.maxDistance = 20; + controls.target.set(-1, 2.1, 0); + controls.update(); + + new HDRLoader().setPath('textures/equirectangular/').load('quarry_01_1k.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = new THREE.Color('#192022'); + scene.backgroundBlurriness = 0.5; + scene.environment = texture; + scene.environmentRotation = new THREE.Euler(0, Math.PI / -2, 0, 'XYZ'); + }); + + mixer = new THREE.AnimationMixer(scene); + + const loader = new GLTFLoader(); + + useNeedleProgressive(loader, renderer); + + loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ2sPRdk-world/file', function (gltf) { + const model = gltf.scene; + + model.scale.multiplyScalar(0.1); + + scene.add(model); + + const animations = gltf.animations; + if (animations && animations.length) { + for (const animation of animations) { + mixer.clipAction(animation).play(); + } + } + }); + + loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZnlceI-ZnlceI-world/file', function (gltf) { + const model = gltf.scene; + + model.scale.multiplyScalar(0.0005); + + model.position.set(1.6, 6, 7); + + model.rotation.set(0, Math.PI * 1.4, 0); + + scene.add(model); + + airshipModel = model; + + const animations = gltf.animations; + + if (animations && animations.length) { + for (const animation of animations) { + mixer.clipAction(animation).play(); + } + } + }); + + loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ21QnG-Z21QnG-product/file', function (gltf) { + const model = gltf.scene; + + model.scale.multiplyScalar(0.5); + + model.position.set(2, 5.15, 2.3); + + model.rotation.set(0, Math.PI * 1, 0); + + scene.add(model); + + const animations = gltf.animations; + if (animations && animations.length) { + for (const animation of animations) { + mixer.clipAction(animation).play(); + } + } + }); + + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +const timer = new THREE.Timer(); +timer.connect(document); +let time = 0; + +function animate() { + timer.update(); + + const dt = timer.getDelta(); + time += dt; + + mixer.update(dt); + + if (airshipModel) { + airshipModel.position.y += Math.sin(time) * 0.002; + } + + renderer.render(scene, camera); + + window.requestAnimationFrame(animate); +} + +animate(); diff --git a/examples-testing/examples/webgl_loader_gltf_sheen.ts b/examples-testing/examples/webgl_loader_gltf_sheen.ts new file mode 100644 index 000000000..b058f1e27 --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_sheen.ts @@ -0,0 +1,72 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, controls; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); + camera.position.set(-0.75, 0.7, 1.25); + + scene = new THREE.Scene(); + + // model + + new GLTFLoader().setPath('models/gltf/').load('SheenChair.glb', function (gltf) { + scene.add(gltf.scene); + + const object = gltf.scene.getObjectByName('SheenChair_fabric'); + + const gui = new GUI(); + + gui.add(object.material, 'sheen', 0, 1); + gui.open(); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + container.appendChild(renderer.domElement); + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.background = new THREE.Color(0xbbbbbb); + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 1; + controls.maxDistance = 10; + controls.target.set(0, 0.35, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + controls.update(); // required if damping enabled + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_gltf_transmission.ts b/examples-testing/examples/webgl_loader_gltf_transmission.ts new file mode 100644 index 000000000..418bb373d --- /dev/null +++ b/examples-testing/examples/webgl_loader_gltf_transmission.ts @@ -0,0 +1,83 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +let camera, scene, renderer, controls, timer, mixer; + +init(); + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(0, 0.4, 0.7); + + scene = new THREE.Scene(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.backgroundBlurriness = 0.35; + + scene.environment = texture; + + // model + + new GLTFLoader() + .setPath('models/gltf/') + .setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)) + .load('IridescentDishWithOlives.glb', function (gltf) { + mixer = new THREE.AnimationMixer(gltf.scene); + mixer.clipAction(gltf.animations[0]).play(); + + scene.add(gltf.scene); + }); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + container.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = -0.75; + controls.enableDamping = true; + controls.minDistance = 0.5; + controls.maxDistance = 1; + controls.target.set(0, 0.1, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + if (mixer) mixer.update(timer.getDelta()); + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_imagebitmap.ts b/examples-testing/examples/webgl_loader_imagebitmap.ts new file mode 100644 index 000000000..c02a03e17 --- /dev/null +++ b/examples-testing/examples/webgl_loader_imagebitmap.ts @@ -0,0 +1,113 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; +let group, cubes; + +init(); + +function addImageBitmap() { + new THREE.ImageBitmapLoader().setOptions({ imageOrientation: 'flipY' }).load( + 'textures/planets/earth_atmos_2048.jpg?' + performance.now(), + function (imageBitmap) { + const texture = new THREE.CanvasTexture(imageBitmap); + texture.colorSpace = THREE.SRGBColorSpace; + const material = new THREE.MeshBasicMaterial({ map: texture }); + + // ImageBitmap should be disposed when done with it. + + texture.onUpdate = disposeImageBitmap; + + addCube(material); + }, + function (p) { + console.log(p); + }, + function (e) { + console.log(e); + }, + ); +} + +function addImage() { + new THREE.ImageLoader() + .setCrossOrigin('*') + .load('textures/planets/earth_atmos_2048.jpg?' + performance.now(), function (image) { + const texture = new THREE.CanvasTexture(image); + texture.colorSpace = THREE.SRGBColorSpace; + const material = new THREE.MeshBasicMaterial({ color: 0xff8888, map: texture }); + addCube(material); + }); +} + +const geometry = new THREE.BoxGeometry(); + +function addCube(material) { + const cube = new THREE.Mesh(geometry, material); + cube.position.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); + cube.rotation.set(Math.random() * 2 * Math.PI, Math.random() * 2 * Math.PI, Math.random() * 2 * Math.PI); + cubes.add(cube); +} + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + // CAMERA + + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1500); + camera.position.set(0, 4, 7); + camera.lookAt(0, 0, 0); + + // SCENE + + scene = new THREE.Scene(); + + // + + group = new THREE.Group(); + scene.add(group); + + group.add(new THREE.GridHelper(4, 12, 0x888888, 0x444444)); + + cubes = new THREE.Group(); + group.add(cubes); + + // RENDERER + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // TESTS + + setTimeout(addImage, 300); + setTimeout(addImage, 600); + setTimeout(addImage, 900); + setTimeout(addImageBitmap, 1300); + setTimeout(addImageBitmap, 1600); + setTimeout(addImageBitmap, 1900); + + // EVENTS + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + group.rotation.y = performance.now() / 3000; + + renderer.render(scene, camera); +} + +function disposeImageBitmap(texture) { + texture.source.data.close(); + texture.onUpdate = null; // make sure this callback is executed only once per texture +} diff --git a/examples-testing/examples/webgl_loader_kmz.ts b/examples-testing/examples/webgl_loader_kmz.ts new file mode 100644 index 000000000..f93555e41 --- /dev/null +++ b/examples-testing/examples/webgl_loader_kmz.ts @@ -0,0 +1,59 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { KMZLoader } from 'three/addons/loaders/KMZLoader.js'; + +let camera, scene, renderer; + +init(); + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x999999); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0.5, 1.0, 0.5).normalize(); + + scene.add(light); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); + + camera.position.y = 5; + camera.position.z = 10; + + scene.add(camera); + + const grid = new THREE.GridHelper(50, 50, 0xffffff, 0x7b7b7b); + scene.add(grid); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + const loader = new KMZLoader(); + loader.load('./models/kmz/Box.kmz', function (kmz) { + kmz.scene.position.y = 0.5; + scene.add(kmz.scene); + render(); + }); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_md2_control.ts b/examples-testing/examples/webgl_loader_md2_control.ts new file mode 100644 index 000000000..df1eb6b3c --- /dev/null +++ b/examples-testing/examples/webgl_loader_md2_control.ts @@ -0,0 +1,278 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js'; +import { Gyroscope } from 'three/addons/misc/Gyroscope.js'; + +let SCREEN_WIDTH = window.innerWidth; +let SCREEN_HEIGHT = window.innerHeight; + +let container, stats; +let camera, scene, renderer; + +const characters = []; +let nCharacters = 0; + +let cameraControls; + +const controls = { + moveForward: false, + moveBackward: false, + moveLeft: false, + moveRight: false, +}; + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // CAMERA + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 4000); + camera.position.set(0, 150, 1300); + + // SCENE + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + scene.fog = new THREE.Fog(0xffffff, 1000, 4000); + + scene.add(camera); + + // LIGHTS + + scene.add(new THREE.AmbientLight(0x666666, 3)); + + const sunLight = new THREE.SunLight(0xffffff, 7); + sunLight.position.set(200, 450, 500); + sunLight.castShadow = true; + sunLight.shadow.camera.far = 2000; + scene.add(sunLight); + + // GROUND + + const gt = new THREE.TextureLoader().load('textures/terrain/grasslight-big.jpg'); + const gg = new THREE.PlaneGeometry(16000, 16000); + const gm = new THREE.MeshPhongMaterial({ color: 0xffffff, map: gt }); + + const ground = new THREE.Mesh(gg, gm); + ground.rotation.x = -Math.PI / 2; + ground.material.map.repeat.set(64, 64); + ground.material.map.wrapS = THREE.RepeatWrapping; + ground.material.map.wrapT = THREE.RepeatWrapping; + ground.material.map.colorSpace = THREE.SRGBColorSpace; + // note that because the ground does not cast a shadow, .castShadow is left false + ground.receiveShadow = true; + + scene.add(ground); + + // RENDERER + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + + // STATS + + stats = new Stats(); + container.appendChild(stats.dom); + + // EVENTS + + window.addEventListener('resize', onWindowResize); + document.addEventListener('keydown', onKeyDown); + document.addEventListener('keyup', onKeyUp); + + // CONTROLS + + cameraControls = new OrbitControls(camera, renderer.domElement); + cameraControls.target.set(0, 50, 0); + cameraControls.update(); + + // CHARACTER + + const configOgro = { + baseUrl: 'models/md2/ogro/', + + body: 'ogro.md2', + skins: [ + 'grok.jpg', + 'ogrobase.png', + 'arboshak.png', + 'ctf_r.png', + 'ctf_b.png', + 'darkam.png', + 'freedom.png', + 'gib.png', + 'gordogh.png', + 'igdosh.png', + 'khorne.png', + 'nabogro.png', + 'sharokh.png', + ], + weapons: [['weapon.md2', 'weapon.jpg']], + animations: { + move: 'run', + idle: 'stand', + jump: 'jump', + attack: 'attack', + crouchMove: 'cwalk', + crouchIdle: 'cstand', + crouchAttach: 'crattack', + }, + + walkSpeed: 350, + crouchSpeed: 175, + }; + + const nRows = 1; + const nSkins = configOgro.skins.length; + + nCharacters = nSkins * nRows; + + for (let i = 0; i < nCharacters; i++) { + const character = new MD2CharacterComplex(); + character.scale = 3; + character.controls = controls; + characters.push(character); + } + + const baseCharacter = new MD2CharacterComplex(); + baseCharacter.scale = 3; + + baseCharacter.onLoadComplete = function () { + let k = 0; + + for (let j = 0; j < nRows; j++) { + for (let i = 0; i < nSkins; i++) { + const cloneCharacter = characters[k]; + + cloneCharacter.shareParts(baseCharacter); + + // cast and receive shadows + cloneCharacter.enableShadows(true); + + cloneCharacter.setWeapon(0); + cloneCharacter.setSkin(i); + + cloneCharacter.root.position.x = (i - nSkins / 2) * 150; + cloneCharacter.root.position.z = j * 250; + + scene.add(cloneCharacter.root); + + k++; + } + } + + const gyro = new Gyroscope(); + gyro.add(camera); + + characters[Math.floor(nSkins / 2)].root.add(gyro); + }; + + baseCharacter.loadParts(configOgro); +} + +// EVENT HANDLERS + +function onWindowResize() { + SCREEN_WIDTH = window.innerWidth; + SCREEN_HEIGHT = window.innerHeight; + + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + + camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + camera.updateProjectionMatrix(); +} + +function onKeyDown(event) { + switch (event.code) { + case 'ArrowUp': + case 'KeyW': + controls.moveForward = true; + break; + + case 'ArrowDown': + case 'KeyS': + controls.moveBackward = true; + break; + + case 'ArrowLeft': + case 'KeyA': + controls.moveLeft = true; + break; + + case 'ArrowRight': + case 'KeyD': + controls.moveRight = true; + break; + + // case 'KeyC': controls.crouch = true; break; + // case 'Space': controls.jump = true; break; + // case 'ControlLeft': + // case 'ControlRight': controls.attack = true; break; + } +} + +function onKeyUp(event) { + switch (event.code) { + case 'ArrowUp': + case 'KeyW': + controls.moveForward = false; + break; + + case 'ArrowDown': + case 'KeyS': + controls.moveBackward = false; + break; + + case 'ArrowLeft': + case 'KeyA': + controls.moveLeft = false; + break; + + case 'ArrowRight': + case 'KeyD': + controls.moveRight = false; + break; + + // case 'KeyC': controls.crouch = false; break; + // case 'Space': controls.jump = false; break; + // case 'ControlLeft': + // case 'ControlRight': controls.attack = false; break; + } +} + +// + +function animate() { + timer.update(); + + render(); + + stats.update(); +} + +function render() { + const delta = timer.getDelta(); + + for (let i = 0; i < nCharacters; i++) { + characters[i].update(delta); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_mdd.ts b/examples-testing/examples/webgl_loader_mdd.ts new file mode 100644 index 000000000..16e49221c --- /dev/null +++ b/examples-testing/examples/webgl_loader_mdd.ts @@ -0,0 +1,65 @@ +import * as THREE from 'three'; + +import { MDDLoader } from 'three/addons/loaders/MDDLoader.js'; + +let camera, scene, renderer, mixer, timer; + +init(); + +function init() { + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(8, 8, 8); + camera.lookAt(scene.position); + + timer = new THREE.Timer(); + timer.connect(document); + + // + + const loader = new MDDLoader(); + loader.load('models/mdd/cube.mdd', function (result) { + const morphTargets = result.morphTargets; + const clip = result.clip; + // clip.optimize(); // optional + + const geometry = new THREE.BoxGeometry(); + geometry.morphAttributes.position = morphTargets; // apply morph targets + + const material = new THREE.MeshNormalMaterial(); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + mixer = new THREE.AnimationMixer(mesh); + mixer.clipAction(clip).play(); // use clip + }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_obj.ts b/examples-testing/examples/webgl_loader_obj.ts new file mode 100644 index 000000000..42f1f3257 --- /dev/null +++ b/examples-testing/examples/webgl_loader_obj.ts @@ -0,0 +1,72 @@ +import * as THREE from 'three'; + +import { MTLLoader } from 'three/addons/loaders/MTLLoader.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, controls; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); + camera.position.z = 2.5; + + // scene + + scene = new THREE.Scene(); + + const ambientLight = new THREE.AmbientLight(0xffffff); + scene.add(ambientLight); + + const pointLight = new THREE.PointLight(0xffffff, 15); + camera.add(pointLight); + scene.add(camera); + + // model + + const mtlLoader = new MTLLoader().setPath('models/obj/male02/'); + const materials = await mtlLoader.loadAsync('male02.mtl'); + materials.preload(); + + const objLoader = new OBJLoader().setPath('models/obj/male02/'); + objLoader.setMaterials(materials); // optional since OBJ assets can be loaded without an accompanying MTL file + + const object = await objLoader.loadAsync('male02.obj'); + + object.position.y = -0.95; + object.scale.setScalar(0.01); + scene.add(object); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2; + controls.maxDistance = 5; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_pcd.ts b/examples-testing/examples/webgl_loader_pcd.ts new file mode 100644 index 000000000..dd0f0b0f5 --- /dev/null +++ b/examples-testing/examples/webgl_loader_pcd.ts @@ -0,0 +1,78 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { PCDLoader } from 'three/addons/loaders/PCDLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer; + +init(); +render(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 0.01, 40); + camera.position.set(0, 0, 1); + scene.add(camera); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 0.5; + controls.maxDistance = 10; + + //scene.add( new THREE.AxesHelper( 1 ) ); + + const loader = new PCDLoader(); + + const loadPointCloud = function (file) { + loader.load('./models/pcd/' + file, function (points) { + points.geometry.center(); + points.geometry.rotateX(Math.PI); + points.name = file; + scene.add(points); + + const gui = new GUI(); + + gui.add(points.material, 'size', 0.001, 0.01).onChange(render); + gui.addColor(points.material, 'color').onChange(render); + gui.add(points, 'name', [ + 'ascii/simple.pcd', + 'binary/Zaghetto.pcd', + 'binary/Zaghetto_8bit.pcd', + 'binary_compressed/pcl_logo.pcd', + ]) + .name('type') + .onChange(e => { + gui.destroy(); + scene.remove(points); + loadPointCloud(e); + }); + gui.open(); + + render(); + }); + }; + + loadPointCloud('binary/Zaghetto.pcd'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_pdb.ts b/examples-testing/examples/webgl_loader_pdb.ts new file mode 100644 index 000000000..b560efa73 --- /dev/null +++ b/examples-testing/examples/webgl_loader_pdb.ts @@ -0,0 +1,208 @@ +import * as THREE from 'three'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; +import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, labelRenderer; +let controls; + +let root; + +const MOLECULES = { + Ethanol: 'ethanol.pdb', + Aspirin: 'aspirin.pdb', + Caffeine: 'caffeine.pdb', + Nicotine: 'nicotine.pdb', + LSD: 'lsd.pdb', + Cocaine: 'cocaine.pdb', + Cholesterol: 'cholesterol.pdb', + Lycopene: 'lycopene.pdb', + Glucose: 'glucose.pdb', + 'Aluminium oxide': 'Al2O3.pdb', + Cubane: 'cubane.pdb', + Copper: 'cu.pdb', + Fluorite: 'caf2.pdb', + Salt: 'nacl.pdb', + 'YBCO superconductor': 'ybco.pdb', + Buckyball: 'buckyball.pdb', + Graphite: 'graphite.pdb', +}; + +const params = { + molecule: 'caffeine.pdb', +}; + +const loader = new PDBLoader(); +const offset = new THREE.Vector3(); + +init(); + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.z = 1000; + scene.add(camera); + + const light1 = new THREE.DirectionalLight(0xffffff, 2.5); + light1.position.set(1, 1, 1); + scene.add(light1); + + const light2 = new THREE.DirectionalLight(0xffffff, 1.5); + light2.position.set(-1, -1, 1); + scene.add(light2); + + root = new THREE.Group(); + scene.add(root); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.getElementById('container').appendChild(renderer.domElement); + + labelRenderer = new CSS2DRenderer(); + labelRenderer.setSize(window.innerWidth, window.innerHeight); + labelRenderer.domElement.style.position = 'absolute'; + labelRenderer.domElement.style.top = '0px'; + labelRenderer.domElement.style.pointerEvents = 'none'; + document.getElementById('container').appendChild(labelRenderer.domElement); + + // + + controls = new TrackballControls(camera, renderer.domElement); + controls.minDistance = 500; + controls.maxDistance = 2000; + + // + + loadMolecule(params.molecule); + + // + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + + gui.add(params, 'molecule', MOLECULES).onChange(loadMolecule); + gui.open(); +} + +// + +function loadMolecule(model) { + const url = 'models/pdb/' + model; + + while (root.children.length > 0) { + const object = root.children[0]; + object.parent.remove(object); + } + + loader.load(url, function (pdb) { + const geometryAtoms = pdb.geometryAtoms; + const geometryBonds = pdb.geometryBonds; + const json = pdb.json; + + const boxGeometry = new THREE.BoxGeometry(1, 1, 1); + const sphereGeometry = new THREE.IcosahedronGeometry(1, 3); + + geometryAtoms.computeBoundingBox(); + geometryAtoms.boundingBox.getCenter(offset).negate(); + + geometryAtoms.translate(offset.x, offset.y, offset.z); + geometryBonds.translate(offset.x, offset.y, offset.z); + + let positions = geometryAtoms.getAttribute('position'); + const colors = geometryAtoms.getAttribute('color'); + + const position = new THREE.Vector3(); + const color = new THREE.Color(); + + for (let i = 0; i < positions.count; i++) { + position.x = positions.getX(i); + position.y = positions.getY(i); + position.z = positions.getZ(i); + + color.r = colors.getX(i); + color.g = colors.getY(i); + color.b = colors.getZ(i); + + const material = new THREE.MeshPhongMaterial({ color: color }); + + const object = new THREE.Mesh(sphereGeometry, material); + object.position.copy(position); + object.position.multiplyScalar(75); + object.scale.multiplyScalar(25); + root.add(object); + + const atom = json.atoms[i]; + + const text = document.createElement('div'); + text.className = 'label'; + text.style.color = 'rgb(' + atom[3][0] + ',' + atom[3][1] + ',' + atom[3][2] + ')'; + text.textContent = atom[4]; + + const label = new CSS2DObject(text); + label.position.copy(object.position); + root.add(label); + } + + positions = geometryBonds.getAttribute('position'); + + const start = new THREE.Vector3(); + const end = new THREE.Vector3(); + + for (let i = 0; i < positions.count; i += 2) { + start.x = positions.getX(i); + start.y = positions.getY(i); + start.z = positions.getZ(i); + + end.x = positions.getX(i + 1); + end.y = positions.getY(i + 1); + end.z = positions.getZ(i + 1); + + start.multiplyScalar(75); + end.multiplyScalar(75); + + const object = new THREE.Mesh(boxGeometry, new THREE.MeshPhongMaterial({ color: 0xffffff })); + object.position.copy(start); + object.position.lerp(end, 0.5); + object.scale.set(5, 5, start.distanceTo(end)); + object.lookAt(end); + root.add(object); + } + }); +} + +// + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + labelRenderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + const time = Date.now() * 0.0004; + + root.rotation.x = time; + root.rotation.y = time * 0.7; + + render(); +} + +function render() { + renderer.render(scene, camera); + labelRenderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_ply.ts b/examples-testing/examples/webgl_loader_ply.ts new file mode 100644 index 000000000..0f4042b7d --- /dev/null +++ b/examples-testing/examples/webgl_loader_ply.ts @@ -0,0 +1,146 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; + +let container, stats; + +let camera, cameraTarget, scene, renderer; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 15); + camera.position.set(3, 0.15, 3); + + cameraTarget = new THREE.Vector3(0, -0.1, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x72645b); + scene.fog = new THREE.Fog(0x72645b, 2, 15); + + // Ground + + const plane = new THREE.Mesh( + new THREE.PlaneGeometry(40, 40), + new THREE.MeshPhongMaterial({ color: 0xcbcbcb, specular: 0x474747 }), + ); + plane.rotation.x = -Math.PI / 2; + plane.position.y = -0.5; + scene.add(plane); + + plane.receiveShadow = true; + + // PLY file + + const loader = new PLYLoader(); + loader.load('./models/ply/ascii/dolphins.ply', function (geometry) { + geometry.computeVertexNormals(); + + const material = new THREE.MeshStandardMaterial({ color: 0x009cff, flatShading: true }); + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.y = -0.2; + mesh.position.z = 0.3; + mesh.rotation.x = -Math.PI / 2; + mesh.scale.multiplyScalar(0.001); + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); + }); + + loader.load('./models/ply/binary/Lucy100k.ply', function (geometry) { + geometry.computeVertexNormals(); + + const material = new THREE.MeshStandardMaterial({ color: 0x009cff, flatShading: true }); + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = -0.2; + mesh.position.y = -0.02; + mesh.position.z = -0.2; + mesh.scale.multiplyScalar(0.0006); + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); + }); + + // Lights + + scene.add(new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3)); + + addShadowedLight(1, 1, 1, 0xffffff, 3.5); + addShadowedLight(0.5, 1, -1, 0xffd500, 3); + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + renderer.shadowMap.enabled = true; + + container.appendChild(renderer.domElement); + + // stats + + stats = new Stats(); + container.appendChild(stats.dom); + + // resize + + window.addEventListener('resize', onWindowResize); +} + +function addShadowedLight(x, y, z, color, intensity) { + const directionalLight = new THREE.DirectionalLight(color, intensity); + directionalLight.position.set(x, y, z); + scene.add(directionalLight); + + directionalLight.castShadow = true; + + const d = 1; + directionalLight.shadow.camera.left = -d; + directionalLight.shadow.camera.right = d; + directionalLight.shadow.camera.top = d; + directionalLight.shadow.camera.bottom = -d; + + directionalLight.shadow.camera.near = 1; + directionalLight.shadow.camera.far = 4; + + directionalLight.shadow.mapSize.width = 1024; + directionalLight.shadow.mapSize.height = 1024; + + directionalLight.shadow.bias = -0.001; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + stats.update(); +} + +function render() { + const timer = Date.now() * 0.0005; + + camera.position.x = Math.sin(timer) * 2.5; + camera.position.z = Math.cos(timer) * 2.5; + + camera.lookAt(cameraTarget); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_svg.ts b/examples-testing/examples/webgl_loader_svg.ts new file mode 100644 index 000000000..2226a96b1 --- /dev/null +++ b/examples-testing/examples/webgl_loader_svg.ts @@ -0,0 +1,202 @@ +import * as THREE from 'three'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { SVGLoader } from 'three/addons/loaders/SVGLoader.js'; + +let renderer, scene, camera, gui, guiData; + +init(); + +// + +function init() { + const container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 200); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + container.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.screenSpacePanning = true; + + // + + window.addEventListener('resize', onWindowResize); + + guiData = { + currentURL: 'models/svg/tiger.svg', + drawFillShapes: true, + drawStrokes: true, + fillShapesWireframe: false, + strokesWireframe: false, + }; + + loadSVG(guiData.currentURL); + + createGUI(); +} + +function createGUI() { + if (gui) gui.destroy(); + + gui = new GUI(); + + gui.add(guiData, 'currentURL', { + Tiger: 'models/svg/tiger.svg', + 'Joins and caps': 'models/svg/lineJoinsAndCaps.svg', + Hexagon: 'models/svg/hexagon.svg', + Energy: 'models/svg/energy.svg', + 'Test 1': 'models/svg/tests/1.svg', + 'Test 2': 'models/svg/tests/2.svg', + 'Test 3': 'models/svg/tests/3.svg', + 'Test 4': 'models/svg/tests/4.svg', + 'Test 5': 'models/svg/tests/5.svg', + 'Test 6': 'models/svg/tests/6.svg', + 'Test 7': 'models/svg/tests/7.svg', + 'Test 8': 'models/svg/tests/8.svg', + 'Test 9': 'models/svg/tests/9.svg', + Units: 'models/svg/tests/units.svg', + Ordering: 'models/svg/tests/ordering.svg', + Defs: 'models/svg/tests/testDefs/Svg-defs.svg', + Defs2: 'models/svg/tests/testDefs/Svg-defs2.svg', + Defs3: 'models/svg/tests/testDefs/Wave-defs.svg', + Defs4: 'models/svg/tests/testDefs/defs4.svg', + Defs5: 'models/svg/tests/testDefs/defs5.svg', + 'Style CSS inside defs': 'models/svg/style-css-inside-defs.svg', + 'Styled Paths': 'models/svg/styled-paths.svg', + 'Multiple CSS classes': 'models/svg/multiple-css-classes.svg', + 'Zero Radius': 'models/svg/zero-radius.svg', + 'Styles in svg tag': 'models/svg/tests/styles.svg', + 'Round join': 'models/svg/tests/roundJoinPrecisionIssue.svg', + 'Ellipse Transformations': 'models/svg/tests/ellipseTransform.svg', + singlePointTest: 'models/svg/singlePointTest.svg', + singlePointTest2: 'models/svg/singlePointTest2.svg', + singlePointTest3: 'models/svg/singlePointTest3.svg', + emptyPath: 'models/svg/emptyPath.svg', + emoji: 'models/svg/emoji.svg', + blueprint: 'models/svg/blueprint.svg', + wideStroke: 'models/svg/tests/wideStroke.svg', + letter: 'models/svg/tests/letter.svg', + }) + .name('SVG File') + .onChange(update); + + gui.add(guiData, 'drawStrokes').name('Draw strokes').onChange(update); + + gui.add(guiData, 'drawFillShapes').name('Draw fill shapes').onChange(update); + + gui.add(guiData, 'strokesWireframe').name('Wireframe strokes').onChange(update); + + gui.add(guiData, 'fillShapesWireframe').name('Wireframe fill shapes').onChange(update); + + function update() { + loadSVG(guiData.currentURL); + } +} + +function loadSVG(url) { + // + + if (scene) disposeScene(scene); + + // + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xb0b0b0); + + // + + const helper = new THREE.GridHelper(160, 10, 0x8d8d8d, 0xc1c1c1); + helper.rotation.x = Math.PI / 2; + scene.add(helper); + + // + + const loader = new SVGLoader(); + + loader.load(url, function (data) { + const group = new THREE.Group(); + group.scale.multiplyScalar(0.25); + group.position.x = -70; + group.position.y = 70; + group.scale.y *= -1; + + let renderOrder = 0; + + for (const path of data.paths) { + if (guiData.drawFillShapes) { + const material = SVGLoader.createFillMaterial(path); + + if (material) { + material.wireframe = guiData.fillShapesWireframe; + + const shapes = path.toShapes(); + + for (const shape of shapes) { + const geometry = new THREE.ShapeGeometry(shape); + const mesh = new THREE.Mesh(geometry, material); + mesh.renderOrder = renderOrder++; + + group.add(mesh); + } + } + } + + if (guiData.drawStrokes) { + const material = SVGLoader.createStrokeMaterial(path); + + if (material) { + material.wireframe = guiData.strokesWireframe; + + for (const subPath of path.subPaths) { + const geometry = SVGLoader.pointsToStroke(subPath.getPoints(), path.userData.style); + + if (geometry) { + const mesh = new THREE.Mesh(geometry, material); + mesh.renderOrder = renderOrder++; + + group.add(mesh); + } + } + } + } + } + + scene.add(group); + + render(); + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + render(); +} + +function render() { + renderer.render(scene, camera); +} + +function disposeScene(scene) { + scene.traverse(function (object) { + if (object.isMesh || object.isLine) { + object.geometry.dispose(); + if (object.material.map) object.material.map.dispose(); + object.material.dispose(); + } + }); +} diff --git a/examples-testing/examples/webgl_loader_texture_dds.ts b/examples-testing/examples/webgl_loader_texture_dds.ts new file mode 100644 index 000000000..ba9b18e9d --- /dev/null +++ b/examples-testing/examples/webgl_loader_texture_dds.ts @@ -0,0 +1,218 @@ +import * as THREE from 'three'; + +import { DDSLoader } from 'three/addons/loaders/DDSLoader.js'; + +let camera, scene, renderer; +const meshes = []; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 100); + camera.position.y = -2; + camera.position.z = 16; + + scene = new THREE.Scene(); + + const geometry = new THREE.BoxGeometry(2, 2, 2); + + /* + This is how compressed textures are supposed to be used: + + DXT1 - RGB - opaque textures + DXT3 - RGBA - transparent textures with sharp alpha transitions + DXT5 - RGBA - transparent textures with full alpha range + */ + + const loader = new DDSLoader(); + + const map1 = loader.load('textures/compressed/disturb_dxt1_nomip.dds'); + map1.minFilter = map1.magFilter = THREE.LinearFilter; + map1.anisotropy = 4; + map1.colorSpace = THREE.SRGBColorSpace; + + const map2 = loader.load('textures/compressed/disturb_dxt1_mip.dds'); + map2.anisotropy = 4; + map2.colorSpace = THREE.SRGBColorSpace; + + const map3 = loader.load('textures/compressed/hepatica_dxt3_mip.dds'); + map3.anisotropy = 4; + map3.colorSpace = THREE.SRGBColorSpace; + + const map4 = loader.load('textures/compressed/explosion_dxt5_mip.dds'); + map4.anisotropy = 4; + map4.colorSpace = THREE.SRGBColorSpace; + + const map5 = loader.load('textures/compressed/disturb_argb_nomip.dds'); + map5.minFilter = map5.magFilter = THREE.LinearFilter; + map5.anisotropy = 4; + map5.colorSpace = THREE.SRGBColorSpace; + + const map6 = loader.load('textures/compressed/disturb_argb_mip.dds'); + map6.anisotropy = 4; + map6.colorSpace = THREE.SRGBColorSpace; + + const map7 = loader.load('textures/compressed/disturb_dx10_bc6h_signed_nomip.dds'); + map7.anisotropy = 4; + + const map8 = loader.load('textures/compressed/disturb_dx10_bc6h_signed_mip.dds'); + map8.anisotropy = 4; + + const map9 = loader.load('textures/compressed/disturb_dx10_bc6h_unsigned_nomip.dds'); + map9.anisotropy = 4; + + const map10 = loader.load('textures/compressed/disturb_dx10_bc6h_unsigned_mip.dds'); + map10.anisotropy = 4; + + const map11 = loader.load('textures/wave_normals_24bit_uncompressed.dds'); + map11.anisotropy = 4; + + const cubemap1 = loader.load('textures/compressed/Mountains.dds', function (texture) { + texture.magFilter = THREE.LinearFilter; + texture.minFilter = THREE.LinearFilter; + texture.mapping = THREE.CubeReflectionMapping; + texture.colorSpace = THREE.SRGBColorSpace; + material1.needsUpdate = true; + }); + + const cubemap2 = loader.load('textures/compressed/Mountains_argb_mip.dds', function (texture) { + texture.magFilter = THREE.LinearFilter; + texture.minFilter = THREE.LinearFilter; + texture.mapping = THREE.CubeReflectionMapping; + texture.colorSpace = THREE.SRGBColorSpace; + material5.needsUpdate = true; + }); + + const cubemap3 = loader.load('textures/compressed/Mountains_argb_nomip.dds', function (texture) { + texture.magFilter = THREE.LinearFilter; + texture.minFilter = THREE.LinearFilter; + texture.mapping = THREE.CubeReflectionMapping; + texture.colorSpace = THREE.SRGBColorSpace; + material6.needsUpdate = true; + }); + + const material1 = new THREE.MeshBasicMaterial({ map: map1, envMap: cubemap1 }); + const material2 = new THREE.MeshBasicMaterial({ map: map2 }); + const material3 = new THREE.MeshBasicMaterial({ map: map3, alphaTest: 0.5, side: THREE.DoubleSide }); + const material4 = new THREE.MeshBasicMaterial({ + map: map4, + side: THREE.DoubleSide, + blending: THREE.AdditiveBlending, + depthTest: false, + transparent: true, + }); + const material5 = new THREE.MeshBasicMaterial({ envMap: cubemap2 }); + const material6 = new THREE.MeshBasicMaterial({ envMap: cubemap3 }); + const material7 = new THREE.MeshBasicMaterial({ map: map5 }); + const material8 = new THREE.MeshBasicMaterial({ map: map6 }); + const material9 = new THREE.MeshBasicMaterial({ map: map7 }); + const material10 = new THREE.MeshBasicMaterial({ map: map8 }); + const material11 = new THREE.MeshBasicMaterial({ map: map9 }); + const material12 = new THREE.MeshBasicMaterial({ map: map10 }); + const material13 = new THREE.MeshBasicMaterial({ map: map11, transparent: true }); + + let mesh = new THREE.Mesh(new THREE.TorusGeometry(), material1); + mesh.position.x = -10; + mesh.position.y = -2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material2); + mesh.position.x = -6; + mesh.position.y = -2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material3); + mesh.position.x = -6; + mesh.position.y = 2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material4); + mesh.position.x = -10; + mesh.position.y = 2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material5); + mesh.position.x = -2; + mesh.position.y = 2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material6); + mesh.position.x = -2; + mesh.position.y = -2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material7); + mesh.position.x = 2; + mesh.position.y = -2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material8); + mesh.position.x = 2; + mesh.position.y = 2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material9); + mesh.position.x = 6; + mesh.position.y = -2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material10); + mesh.position.x = 6; + mesh.position.y = 2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material11); + mesh.position.x = 10; + mesh.position.y = -2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material12); + mesh.position.x = 10; + mesh.position.y = 2; + scene.add(mesh); + meshes.push(mesh); + + mesh = new THREE.Mesh(geometry, material13); + mesh.position.x = -10; + mesh.position.y = -6; + scene.add(mesh); + meshes.push(mesh); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = Date.now() * 0.001; + + for (let i = 0; i < meshes.length; i++) { + const mesh = meshes[i]; + mesh.rotation.x = time; + mesh.rotation.y = time; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_texture_ktx.ts b/examples-testing/examples/webgl_loader_texture_ktx.ts new file mode 100644 index 000000000..a4e749301 --- /dev/null +++ b/examples-testing/examples/webgl_loader_texture_ktx.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three'; + +import { KTXLoader } from 'three/addons/loaders/KTXLoader.js'; + +/* + This is how compressed textures are supposed to be used: + + best for desktop: + BC1(DXT1) - opaque textures + BC3(DXT5) - transparent textures with full alpha range + + best for iOS: + PVR2, PVR4 - opaque textures or alpha + + best for Android: + ETC1 - opaque textures + ASTC_4x4, ASTC8x8 - transparent textures with full alpha range + */ + +let camera, scene, renderer; +const meshes = []; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + const formats = { + astc: renderer.extensions.has('WEBGL_compressed_texture_astc'), + etc1: renderer.extensions.has('WEBGL_compressed_texture_etc1'), + etc2: renderer.extensions.has('WEBGL_compressed_texture_etc'), + s3tc: renderer.extensions.has('WEBGL_compressed_texture_s3tc'), + pvrtc: renderer.extensions.has('WEBGL_compressed_texture_pvrtc'), + }; + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + + const ambientLight = new THREE.AmbientLight(0xffffff, 0.02); + scene.add(ambientLight); + + const pointLight = new THREE.PointLight(0xffffff, 2, 0, 0); + pointLight.position.z = 300; + scene.add(pointLight); + + const geometry = new THREE.BoxGeometry(200, 200, 200); + let material1, material2, material3; + + // TODO: add cubemap support + const loader = new KTXLoader(); + + if (formats.pvrtc) { + material1 = new THREE.MeshBasicMaterial({ + map: loader.load('textures/compressed/disturb_PVR2bpp.ktx'), + }); + material1.map.colorSpace = THREE.SRGBColorSpace; + material2 = new THREE.MeshBasicMaterial({ + map: loader.load('textures/compressed/lensflare_PVR4bpp.ktx'), + depthTest: false, + transparent: true, + side: THREE.DoubleSide, + }); + material2.map.colorSpace = THREE.SRGBColorSpace; + + meshes.push(new THREE.Mesh(geometry, material1)); + meshes.push(new THREE.Mesh(geometry, material2)); + } + + if (formats.s3tc) { + material1 = new THREE.MeshBasicMaterial({ + map: loader.load('textures/compressed/disturb_BC1.ktx'), + }); + material1.map.colorSpace = THREE.SRGBColorSpace; + material2 = new THREE.MeshBasicMaterial({ + map: loader.load('textures/compressed/lensflare_BC3.ktx'), + depthTest: false, + transparent: true, + side: THREE.DoubleSide, + }); + material2.map.colorSpace = THREE.SRGBColorSpace; + material3 = new THREE.MeshStandardMaterial({ + normalMap: loader.load('textures/compressed/normal.bc5.ktx'), + }); + + meshes.push(new THREE.Mesh(geometry, material1)); + meshes.push(new THREE.Mesh(geometry, material2)); + meshes.push(new THREE.Mesh(geometry, material3)); + } + + if (formats.etc1) { + material1 = new THREE.MeshBasicMaterial({ + map: loader.load('textures/compressed/disturb_ETC1.ktx'), + }); + + meshes.push(new THREE.Mesh(geometry, material1)); + } + + if (formats.etc2) { + material1 = new THREE.MeshStandardMaterial({ + normalMap: loader.load('textures/compressed/normal.eac_rg.ktx'), + }); + + meshes.push(new THREE.Mesh(geometry, material1)); + } + + if (formats.astc) { + material1 = new THREE.MeshBasicMaterial({ + map: loader.load('textures/compressed/disturb_ASTC4x4.ktx'), + }); + material1.map.colorSpace = THREE.SRGBColorSpace; + material2 = new THREE.MeshBasicMaterial({ + map: loader.load('textures/compressed/lensflare_ASTC8x8.ktx'), + depthTest: false, + transparent: true, + side: THREE.DoubleSide, + }); + material2.map.colorSpace = THREE.SRGBColorSpace; + + meshes.push(new THREE.Mesh(geometry, material1)); + meshes.push(new THREE.Mesh(geometry, material2)); + } + + let x0 = (-Math.min(4, meshes.length) * 300) / 2 + 150; + for (let i = 0; i < Math.min(4, meshes.length); ++i, x0 += 300) { + const mesh = meshes[i]; + mesh.position.x = x0; + mesh.position.y = 150; + scene.add(mesh); + } + + let x1 = (-(meshes.length - 4) * 300) / 2 + 150; + for (let i = 4; i < meshes.length; ++i, x1 += 300) { + const mesh = meshes[i]; + mesh.position.x = x1; + mesh.position.y = -150; + scene.add(mesh); + } + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = Date.now() * 0.001; + + for (let i = 0; i < meshes.length; i++) { + const mesh = meshes[i]; + mesh.rotation.x = time; + mesh.rotation.y = time; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_texture_tga.ts b/examples-testing/examples/webgl_loader_texture_tga.ts new file mode 100644 index 000000000..c4f65b79a --- /dev/null +++ b/examples-testing/examples/webgl_loader_texture_tga.ts @@ -0,0 +1,90 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TGALoader } from 'three/addons/loaders/TGALoader.js'; + +let camera, scene, renderer, stats; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 1, 5); + + scene = new THREE.Scene(); + + // + + const loader = new TGALoader(); + const geometry = new THREE.BoxGeometry(); + + // add box 1 - grey8 texture + + const texture1 = loader.load('textures/crate_grey8.tga'); + texture1.colorSpace = THREE.SRGBColorSpace; + const material1 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture1 }); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.position.x = -1; + + scene.add(mesh1); + + // add box 2 - tga texture + + const texture2 = loader.load('textures/crate_color8.tga'); + texture2.colorSpace = THREE.SRGBColorSpace; + const material2 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture2 }); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.position.x = 1; + + scene.add(mesh2); + + // + + const ambientLight = new THREE.AmbientLight(0xffffff, 1.5); + scene.add(ambientLight); + + const light = new THREE.DirectionalLight(0xffffff, 2.5); + light.position.set(1, 1, 1); + scene.add(light); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); + stats.update(); +} diff --git a/examples-testing/examples/webgl_loader_texture_tiff.ts b/examples-testing/examples/webgl_loader_texture_tiff.ts new file mode 100644 index 000000000..f097774aa --- /dev/null +++ b/examples-testing/examples/webgl_loader_texture_tiff.ts @@ -0,0 +1,87 @@ +import * as THREE from 'three'; + +import { TIFFLoader } from 'three/addons/loaders/TIFFLoader.js'; + +let renderer, scene, camera; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.set(0, 0, 4); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + const loader = new TIFFLoader(); + + const geometry = new THREE.PlaneGeometry(); + + // uncompressed + + loader.load('textures/tiff/crate_uncompressed.tif', function (texture) { + texture.colorSpace = THREE.SRGBColorSpace; + + const material = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(-1.5, 0, 0); + + scene.add(mesh); + + render(); + }); + + // LZW + + loader.load('textures/tiff/crate_lzw.tif', function (texture) { + texture.colorSpace = THREE.SRGBColorSpace; + + const material = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(0, 0, 0); + + scene.add(mesh); + + render(); + }); + + // JPEG + + loader.load('textures/tiff/crate_jpeg.tif', function (texture) { + texture.colorSpace = THREE.SRGBColorSpace; + + const material = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(1.5, 0, 0); + + scene.add(mesh); + + render(); + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_texture_ultrahdr.ts b/examples-testing/examples/webgl_loader_texture_ultrahdr.ts new file mode 100644 index 000000000..c8bce4bf9 --- /dev/null +++ b/examples-testing/examples/webgl_loader_texture_ultrahdr.ts @@ -0,0 +1,101 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +const params = { + autoRotate: true, + metalness: 1.0, + roughness: 0.0, + exposure: 1.0, + resolution: '2k', + type: 'HalfFloatType', +}; + +let renderer, scene, camera, controls, torusMesh, loader; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = params.exposure; + + renderer.setAnimationLoop(render); + + scene = new THREE.Scene(); + + torusMesh = new THREE.Mesh( + new THREE.TorusKnotGeometry(1, 0.4, 128, 128, 1, 3), + new THREE.MeshStandardMaterial({ roughness: params.roughness, metalness: params.metalness }), + ); + scene.add(torusMesh); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 500); + camera.position.set(0.0, 0.0, -6.0); + + controls = new OrbitControls(camera, renderer.domElement); + + loader = new UltraHDRLoader(); + loader.setDataType(THREE.FloatType); + + const loadEnvironment = function (resolution = '2k', type = 'HalfFloatType') { + loader.setDataType(THREE[type]); + + loader.load(`textures/equirectangular/spruit_sunrise_${resolution}.hdr.jpg`, function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + texture.needsUpdate = true; + + scene.background = texture; + scene.environment = texture; + }); + }; + + loadEnvironment(params.resolution, params.type); + + const gui = new GUI(); + + gui.add(params, 'autoRotate'); + gui.add(params, 'metalness', 0, 1, 0.01); + gui.add(params, 'roughness', 0, 1, 0.01); + gui.add(params, 'exposure', 0, 4, 0.01); + gui.add(params, 'resolution', ['2k', '4k']).onChange(value => { + loadEnvironment(value, params.type); + }); + gui.add(params, 'type', ['HalfFloatType', 'FloatType']).onChange(value => { + loadEnvironment(params.resolution, value); + }); + + gui.open(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + torusMesh.material.roughness = params.roughness; + torusMesh.material.metalness = params.metalness; + + if (params.autoRotate) { + torusMesh.rotation.y += 0.005; + } + + renderer.toneMappingExposure = params.exposure; + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_ttf.ts b/examples-testing/examples/webgl_loader_ttf.ts new file mode 100644 index 000000000..b54b8c290 --- /dev/null +++ b/examples-testing/examples/webgl_loader_ttf.ts @@ -0,0 +1,231 @@ +import * as THREE from 'three'; + +import { TTFLoader } from 'three/addons/loaders/TTFLoader.js'; +import { Font } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +let container; +let camera, cameraTarget, scene, renderer; +let group, textMesh1, textMesh2, textGeo, material; +let firstLetter = true; + +let text = 'three.js'; +const depth = 20, + size = 70, + hover = 30, + curveSegments = 4, + bevelThickness = 2, + bevelSize = 1.5; + +let font = null; +const mirror = true; + +let targetRotation = 0; +let targetRotationOnPointerDown = 0; + +let pointerX = 0; +let pointerXOnPointerDown = 0; + +let windowHalfX = window.innerWidth / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // CAMERA + + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1500); + camera.position.set(0, 400, 700); + + cameraTarget = new THREE.Vector3(0, 150, 0); + + // SCENE + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + scene.fog = new THREE.Fog(0x000000, 250, 1400); + + // LIGHTS + + const dirLight1 = new THREE.DirectionalLight(0xffffff, 0.4); + dirLight1.position.set(0, 0, 1).normalize(); + scene.add(dirLight1); + + const dirLight2 = new THREE.DirectionalLight(0xffffff, 2); + dirLight2.position.set(0, hover, 10).normalize(); + dirLight2.color.setHSL(Math.random(), 1, 0.5, THREE.SRGBColorSpace); + scene.add(dirLight2); + + material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); + + group = new THREE.Group(); + group.position.y = 100; + + scene.add(group); + + const loader = new TTFLoader(); + + loader.load('fonts/ttf/kenpixel.ttf', function (json) { + font = new Font(json); + createText(); + }); + + const plane = new THREE.Mesh( + new THREE.PlaneGeometry(10000, 10000), + new THREE.MeshBasicMaterial({ color: 0xffffff, opacity: 0.5, transparent: true }), + ); + plane.position.y = 100; + plane.rotation.x = -Math.PI / 2; + scene.add(plane); + + // RENDERER + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // EVENTS + + container.style.touchAction = 'none'; + container.addEventListener('pointerdown', onPointerDown); + + document.addEventListener('keypress', onDocumentKeyPress); + document.addEventListener('keydown', onDocumentKeyDown); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentKeyDown(event) { + if (firstLetter) { + firstLetter = false; + text = ''; + } + + const keyCode = event.keyCode; + + // backspace + + if (keyCode === 8) { + event.preventDefault(); + + text = text.substring(0, text.length - 1); + refreshText(); + + return false; + } +} + +function onDocumentKeyPress(event) { + const keyCode = event.which; + + // backspace + + if (keyCode === 8) { + event.preventDefault(); + } else { + const ch = String.fromCharCode(keyCode); + text += ch; + + refreshText(); + } +} + +function createText() { + textGeo = new TextGeometry(text, { + font: font, + + size: size, + depth: depth, + curveSegments: curveSegments, + + bevelThickness: bevelThickness, + bevelSize: bevelSize, + bevelEnabled: true, + }); + + textGeo.computeBoundingBox(); + textGeo.computeVertexNormals(); + + const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); + + textMesh1 = new THREE.Mesh(textGeo, material); + + textMesh1.position.x = centerOffset; + textMesh1.position.y = hover; + textMesh1.position.z = 0; + + textMesh1.rotation.x = 0; + textMesh1.rotation.y = Math.PI * 2; + + group.add(textMesh1); + + if (mirror) { + textMesh2 = new THREE.Mesh(textGeo, material); + + textMesh2.position.x = centerOffset; + textMesh2.position.y = -hover; + textMesh2.position.z = depth; + + textMesh2.rotation.x = Math.PI; + textMesh2.rotation.y = Math.PI * 2; + + group.add(textMesh2); + } +} + +function refreshText() { + group.remove(textMesh1); + if (mirror) group.remove(textMesh2); + + if (!text) return; + + createText(); +} + +function onPointerDown(event) { + if (event.isPrimary === false) return; + + pointerXOnPointerDown = event.clientX - windowHalfX; + targetRotationOnPointerDown = targetRotation; + + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerup', onPointerUp); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + pointerX = event.clientX - windowHalfX; + + targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; +} + +function onPointerUp(event) { + if (event.isPrimary === false) return; + + document.removeEventListener('pointermove', onPointerMove); + document.removeEventListener('pointerup', onPointerUp); +} + +// + +function animate() { + group.rotation.y += (targetRotation - group.rotation.y) * 0.05; + + camera.lookAt(cameraTarget); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_usdz.ts b/examples-testing/examples/webgl_loader_usdz.ts new file mode 100644 index 000000000..409c6b597 --- /dev/null +++ b/examples-testing/examples/webgl_loader_usdz.ts @@ -0,0 +1,68 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { USDLoader } from 'three/addons/loaders/USDLoader.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0.75, -1.5); + + scene = new THREE.Scene(); + + const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); + + const usdzLoader = new USDLoader().setPath('models/usdz/'); + + const [texture, model] = await Promise.all([ + hdrLoader.loadAsync('venice_sunset_1k.hdr'), + usdzLoader.loadAsync('saeukkang.usdz'), + ]); + + // environment + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.backgroundBlurriness = 0.5; + scene.environment = texture; + + // model + + model.position.y = 0.25; + model.position.z = -0.25; + scene.add(model); + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 2.0; + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 8; + // controls.target.y = 15; + // controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_vox.ts b/examples-testing/examples/webgl_loader_vox.ts new file mode 100644 index 000000000..87e0b2f81 --- /dev/null +++ b/examples-testing/examples/webgl_loader_vox.ts @@ -0,0 +1,99 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { VOXLoader } from 'three/addons/loaders/VOXLoader.js'; + +let camera, controls, scene, renderer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.set(0.175, 0.075, 0.175); + + scene = new THREE.Scene(); + scene.add(camera); + + // light + + const hemiLight = new THREE.HemisphereLight(0xcccccc, 0x444444, 3); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 2.5); + dirLight.position.set(1.5, 3, 2.5); + scene.add(dirLight); + + const dirLight2 = new THREE.DirectionalLight(0xffffff, 1.5); + dirLight2.position.set(-1.5, -3, -2.5); + scene.add(dirLight2); + + const loader = new VOXLoader(); + loader.load('models/vox/monu10.vox', function (result) { + const mesh = result.scene.children[0]; + mesh.position.y = 0; + mesh.scale.setScalar(0.0015); + scene.add(mesh); + }); + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 0.1; + controls.maxDistance = 0.5; + + // + + window.addEventListener('resize', onWindowResize); +} + +/* + function displayPalette( palette ) { + + const canvas = document.createElement( 'canvas' ); + canvas.width = 8; + canvas.height = 32; + canvas.style.position = 'absolute'; + canvas.style.top = '0'; + canvas.style.width = '100px'; + canvas.style.imageRendering = 'pixelated'; + document.body.appendChild( canvas ); + + const context = canvas.getContext( '2d' ); + + for ( let c = 0; c < 256; c ++ ) { + + const x = c % 8; + const y = Math.floor( c / 8 ); + + const hex = palette[ c + 1 ]; + const r = hex >> 0 & 0xff; + const g = hex >> 8 & 0xff; + const b = hex >> 16 & 0xff; + context.fillStyle = `rgba(${r},${g},${b},1)`; + context.fillRect( x, 31 - y, 1, 1 ); + + } + + } + */ + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_loader_vrml.ts b/examples-testing/examples/webgl_loader_vrml.ts new file mode 100644 index 000000000..ce8b30513 --- /dev/null +++ b/examples-testing/examples/webgl_loader_vrml.ts @@ -0,0 +1,120 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { VRMLLoader } from 'three/addons/loaders/VRMLLoader.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, stats, controls, loader; + +const params = { + asset: 'house', +}; + +const assets = [ + 'creaseAngle', + 'crystal', + 'house', + 'elevationGrid1', + 'elevationGrid2', + 'extrusion1', + 'extrusion2', + 'extrusion3', + 'lines', + 'linesTransparent', + 'meshWithLines', + 'meshWithTexture', + 'pixelTexture', + 'points', + 'camera', + 'multilineString', +]; + +let vrmlScene; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1e10); + camera.position.set(-10, 5, 10); + + scene = new THREE.Scene(); + scene.add(camera); + + // light + + const ambientLight = new THREE.AmbientLight(0xffffff, 1.2); + scene.add(ambientLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 2.0); + dirLight.position.set(200, 200, 200); + scene.add(dirLight); + + loader = new VRMLLoader(); + loadAsset(params.asset); + + // renderer + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 200; + controls.enableDamping = true; + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + gui.add(params, 'asset', assets).onChange(function (value) { + if (vrmlScene) { + vrmlScene.traverse(function (object) { + if (object.material) object.material.dispose(); + if (object.material && object.material.map) object.material.map.dispose(); + if (object.geometry) object.geometry.dispose(); + }); + + scene.remove(vrmlScene); + } + + loadAsset(value); + }); +} + +function loadAsset(asset) { + loader.load('models/vrml/' + asset + '.wrl', function (object) { + vrmlScene = object; + scene.add(object); + controls.reset(); + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); // to support damping + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_loader_xyz.ts b/examples-testing/examples/webgl_loader_xyz.ts new file mode 100644 index 000000000..315c6de39 --- /dev/null +++ b/examples-testing/examples/webgl_loader_xyz.ts @@ -0,0 +1,65 @@ +import * as THREE from 'three'; + +import { XYZLoader } from 'three/addons/loaders/XYZLoader.js'; + +let camera, scene, renderer, timer; + +let points; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(10, 7, 10); + + scene = new THREE.Scene(); + scene.add(camera); + camera.lookAt(scene.position); + + timer = new THREE.Timer(); + timer.connect(document); + + const loader = new XYZLoader(); + loader.load('models/xyz/helix_201.xyz', function (geometry) { + geometry.center(); + + const vertexColors = geometry.hasAttribute('color') === true; + + const material = new THREE.PointsMaterial({ size: 0.1, vertexColors: vertexColors }); + + points = new THREE.Points(geometry, material); + scene.add(points); + }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (points) { + points.rotation.x += delta * 0.2; + points.rotation.y += delta * 0.5; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_lod.ts b/examples-testing/examples/webgl_lod.ts new file mode 100644 index 000000000..d957efbbd --- /dev/null +++ b/examples-testing/examples/webgl_lod.ts @@ -0,0 +1,91 @@ +import * as THREE from 'three'; + +import { FlyControls } from 'three/addons/controls/FlyControls.js'; + +let container; + +let camera, scene, renderer, controls; + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 15000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x000000, 1, 15000); + + const pointLight = new THREE.PointLight(0xff2200, 3, 0, 0); + pointLight.position.set(0, 0, 0); + scene.add(pointLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(0, 0, 1).normalize(); + scene.add(dirLight); + + const geometry = [ + [new THREE.IcosahedronGeometry(100, 16), 50], + [new THREE.IcosahedronGeometry(100, 8), 300], + [new THREE.IcosahedronGeometry(100, 4), 1000], + [new THREE.IcosahedronGeometry(100, 2), 2000], + [new THREE.IcosahedronGeometry(100, 1), 8000], + ]; + + const material = new THREE.MeshLambertMaterial({ color: 0xffffff, wireframe: true }); + + for (let j = 0; j < 1000; j++) { + const lod = new THREE.LOD(); + + for (let i = 0; i < geometry.length; i++) { + const mesh = new THREE.Mesh(geometry[i][0], material); + mesh.scale.set(1.5, 1.5, 1.5); + mesh.updateMatrix(); + mesh.matrixAutoUpdate = false; + lod.addLevel(mesh, geometry[i][1]); + } + + lod.position.x = 10000 * (0.5 - Math.random()); + lod.position.y = 7500 * (0.5 - Math.random()); + lod.position.z = 10000 * (0.5 - Math.random()); + lod.updateMatrix(); + lod.matrixAutoUpdate = false; + scene.add(lod); + } + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + controls = new FlyControls(camera, renderer.domElement); + controls.movementSpeed = 1000; + controls.rollSpeed = Math.PI / 10; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + controls.update(timer.getDelta()); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_marchingcubes.ts b/examples-testing/examples/webgl_marchingcubes.ts new file mode 100644 index 000000000..4a4c6da0b --- /dev/null +++ b/examples-testing/examples/webgl_marchingcubes.ts @@ -0,0 +1,312 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { MarchingCubes } from 'three/addons/objects/MarchingCubes.js'; +import { ToonShader1, ToonShader2, ToonShaderHatching, ToonShaderDotted } from 'three/addons/shaders/ToonShader.js'; + +let container, stats; + +let camera, scene, renderer; + +let materials, current_material; + +let light, pointLight, ambientLight; + +let effect, resolution; + +let effectController; + +let time = 0; + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + container = document.getElementById('container'); + + // CAMERA + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(-500, 500, 1500); + + // SCENE + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + + // LIGHTS + + light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0.5, 0.5, 1); + scene.add(light); + + pointLight = new THREE.PointLight(0xff7c00, 3, 0, 0); + pointLight.position.set(0, 0, 100); + scene.add(pointLight); + + ambientLight = new THREE.AmbientLight(0x323232, 3); + scene.add(ambientLight); + + // MATERIALS + + materials = generateMaterials(); + current_material = 'shiny'; + + // MARCHING CUBES + + resolution = 28; + + effect = new MarchingCubes(resolution, materials[current_material], true, true, 100000); + effect.position.set(0, 0, 0); + effect.scale.set(700, 700, 700); + + effect.enableUvs = false; + effect.enableColors = false; + + scene.add(effect); + + // RENDERER + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // CONTROLS + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 500; + controls.maxDistance = 5000; + + // STATS + + stats = new Stats(); + container.appendChild(stats.dom); + + // GUI + + setupGui(); + + // EVENTS + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function generateMaterials() { + // environment map + + const path = 'textures/cube/SwedishRoyalCastle/'; + const format = '.jpg'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const cubeTextureLoader = new THREE.CubeTextureLoader(); + + const reflectionCube = cubeTextureLoader.load(urls); + const refractionCube = cubeTextureLoader.load(urls); + refractionCube.mapping = THREE.CubeRefractionMapping; + + // toons + + const toonMaterial1 = createShaderMaterial(ToonShader1, light, ambientLight); + const toonMaterial2 = createShaderMaterial(ToonShader2, light, ambientLight); + const hatchingMaterial = createShaderMaterial(ToonShaderHatching, light, ambientLight); + const dottedMaterial = createShaderMaterial(ToonShaderDotted, light, ambientLight); + + const texture = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.colorSpace = THREE.SRGBColorSpace; + + const materials = { + shiny: new THREE.MeshStandardMaterial({ + color: 0x9c0000, + envMap: reflectionCube, + roughness: 0.1, + metalness: 1.0, + }), + chrome: new THREE.MeshLambertMaterial({ color: 0xffffff, envMap: reflectionCube }), + liquid: new THREE.MeshLambertMaterial({ color: 0xffffff, envMap: refractionCube, refractionRatio: 0.85 }), + matte: new THREE.MeshPhongMaterial({ specular: 0x494949, shininess: 1 }), + flat: new THREE.MeshLambertMaterial({/*TODO flatShading: true */}), + textured: new THREE.MeshPhongMaterial({ color: 0xffffff, specular: 0x111111, shininess: 1, map: texture }), + colors: new THREE.MeshPhongMaterial({ color: 0xffffff, specular: 0xffffff, shininess: 2, vertexColors: true }), + multiColors: new THREE.MeshPhongMaterial({ shininess: 2, vertexColors: true }), + plastic: new THREE.MeshPhongMaterial({ specular: 0xc1c1c1, shininess: 250 }), + toon1: toonMaterial1, + toon2: toonMaterial2, + hatching: hatchingMaterial, + dotted: dottedMaterial, + }; + + return materials; +} + +function createShaderMaterial(shader, light, ambientLight) { + const u = THREE.UniformsUtils.clone(shader.uniforms); + + const vs = shader.vertexShader; + const fs = shader.fragmentShader; + + const material = new THREE.ShaderMaterial({ uniforms: u, vertexShader: vs, fragmentShader: fs }); + + material.uniforms['uDirLightPos'].value = light.position; + material.uniforms['uDirLightColor'].value = light.color; + + material.uniforms['uAmbientLightColor'].value = ambientLight.color; + + return material; +} + +// + +function setupGui() { + const createHandler = function (id) { + return function () { + current_material = id; + + effect.material = materials[id]; + effect.enableUvs = current_material === 'textured' ? true : false; + effect.enableColors = current_material === 'colors' || current_material === 'multiColors' ? true : false; + }; + }; + + effectController = { + material: 'shiny', + + speed: 1.0, + numBlobs: 10, + resolution: 28, + isolation: 80, + + floor: true, + wallx: false, + wallz: false, + + dummy: function () {}, + }; + + let h; + + const gui = new GUI(); + + // material (type) + + h = gui.addFolder('Materials'); + + for (const m in materials) { + effectController[m] = createHandler(m); + h.add(effectController, m).name(m); + } + + // simulation + + h = gui.addFolder('Simulation'); + + h.add(effectController, 'speed', 0.1, 8.0, 0.05); + h.add(effectController, 'numBlobs', 1, 50, 1); + h.add(effectController, 'resolution', 14, 100, 1); + h.add(effectController, 'isolation', 10, 300, 1); + + h.add(effectController, 'floor'); + h.add(effectController, 'wallx'); + h.add(effectController, 'wallz'); +} + +// this controls content of marching cubes voxel field + +function updateCubes(object, time, numblobs, floor, wallx, wallz) { + object.reset(); + + // fill the field with some metaballs + + const rainbow = [ + new THREE.Color(0xff0000), + new THREE.Color(0xffbb00), + new THREE.Color(0xffff00), + new THREE.Color(0x00ff00), + new THREE.Color(0x0000ff), + new THREE.Color(0x9400bd), + new THREE.Color(0xc800eb), + ]; + const subtract = 12; + const strength = 1.2 / ((Math.sqrt(numblobs) - 1) / 4 + 1); + + for (let i = 0; i < numblobs; i++) { + const ballx = Math.sin(i + 1.26 * time * (1.03 + 0.5 * Math.cos(0.21 * i))) * 0.27 + 0.5; + const bally = Math.abs(Math.cos(i + 1.12 * time * Math.cos(1.22 + 0.1424 * i))) * 0.77; // dip into the floor + const ballz = Math.cos(i + 1.32 * time * 0.1 * Math.sin(0.92 + 0.53 * i)) * 0.27 + 0.5; + + if (current_material === 'multiColors') { + object.addBall(ballx, bally, ballz, strength, subtract, rainbow[i % 7]); + } else { + object.addBall(ballx, bally, ballz, strength, subtract); + } + } + + if (floor) object.addPlaneY(2, 12); + if (wallz) object.addPlaneZ(2, 12); + if (wallx) object.addPlaneX(2, 12); + + object.update(); +} + +// + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + const delta = timer.getDelta(); + + time += delta * effectController.speed * 0.5; + + // marching cubes + + if (effectController.resolution !== resolution) { + resolution = effectController.resolution; + effect.init(Math.floor(resolution)); + } + + if (effectController.isolation !== effect.isolation) { + effect.isolation = effectController.isolation; + } + + updateCubes( + effect, + time, + effectController.numBlobs, + effectController.floor, + effectController.wallx, + effectController.wallz, + ); + + // render + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_alphahash.ts b/examples-testing/examples/webgl_materials_alphahash.ts new file mode 100644 index 000000000..790e31be4 --- /dev/null +++ b/examples-testing/examples/webgl_materials_alphahash.ts @@ -0,0 +1,178 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, scene, renderer, controls, stats, mesh, material; + +let composer, renderPass, taaRenderPass, outputPass; + +let needsUpdate = false; + +const amount = parseInt(window.location.search.slice(1)) || 3; +const count = Math.pow(amount, 3); + +const color = new THREE.Color(); + +const params = { + alpha: 0.5, + alphaHash: true, + taa: true, + sampleLevel: 2, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(amount, amount, amount); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + + const geometry = new THREE.IcosahedronGeometry(0.5, 3); + + material = new THREE.MeshStandardMaterial({ + color: 0xffffff, + alphaHash: params.alphaHash, + opacity: params.alpha, + }); + + mesh = new THREE.InstancedMesh(geometry, material, count); + + let i = 0; + const offset = (amount - 1) / 2; + + const matrix = new THREE.Matrix4(); + + for (let x = 0; x < amount; x++) { + for (let y = 0; y < amount; y++) { + for (let z = 0; z < amount; z++) { + matrix.setPosition(offset - x, offset - y, offset - z); + + mesh.setMatrixAt(i, matrix); + mesh.setColorAt(i, color.setHex(Math.random() * 0xffffff)); + + i++; + } + } + } + + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + environment.dispose(); + + // + + composer = new EffectComposer(renderer); + + renderPass = new RenderPass(scene, camera); + renderPass.enabled = false; + + taaRenderPass = new TAARenderPass(scene, camera); + + outputPass = new OutputPass(); + + composer.addPass(renderPass); + composer.addPass(taaRenderPass); + composer.addPass(outputPass); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enablePan = false; + + controls.addEventListener('change', () => (needsUpdate = true)); + + // + + const gui = new GUI(); + + gui.add(params, 'alpha', 0, 1).onChange(onMaterialUpdate); + gui.add(params, 'alphaHash').onChange(onMaterialUpdate); + + const taaFolder = gui.addFolder('Temporal Anti-Aliasing'); + + taaFolder + .add(params, 'taa') + .name('enabled') + .onChange(() => { + renderPass.enabled = !params.taa; + taaRenderPass.enabled = params.taa; + + sampleLevelCtrl.enable(params.taa); + + needsUpdate = true; + }); + + const sampleLevelCtrl = taaFolder.add(params, 'sampleLevel', 0, 6, 1).onChange(() => (needsUpdate = true)); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); + + needsUpdate = true; +} + +function onMaterialUpdate() { + material.opacity = params.alpha; + material.alphaHash = params.alphaHash; + material.transparent = !params.alphaHash; + material.depthWrite = params.alphaHash; + + material.needsUpdate = true; + needsUpdate = true; +} + +function animate() { + render(); + + stats.update(); +} + +function render() { + if (needsUpdate) { + taaRenderPass.accumulate = false; + taaRenderPass.sampleLevel = 0; + + needsUpdate = false; + } else { + taaRenderPass.accumulate = true; + taaRenderPass.sampleLevel = params.sampleLevel; + } + + composer.render(); +} diff --git a/examples-testing/examples/webgl_materials_blending.ts b/examples-testing/examples/webgl_materials_blending.ts new file mode 100644 index 000000000..fb2e6a91e --- /dev/null +++ b/examples-testing/examples/webgl_materials_blending.ts @@ -0,0 +1,149 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; +let mapBg; + +const textureLoader = new THREE.TextureLoader(); + +init(); + +function init() { + // CAMERA + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 600; + + // SCENE + + scene = new THREE.Scene(); + + // BACKGROUND + + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + canvas.width = canvas.height = 128; + ctx.fillStyle = '#ddd'; + ctx.fillRect(0, 0, 128, 128); + ctx.fillStyle = '#555'; + ctx.fillRect(0, 0, 64, 64); + ctx.fillStyle = '#999'; + ctx.fillRect(32, 32, 32, 32); + ctx.fillStyle = '#555'; + ctx.fillRect(64, 64, 64, 64); + ctx.fillStyle = '#777'; + ctx.fillRect(96, 96, 32, 32); + + mapBg = new THREE.CanvasTexture(canvas); + mapBg.colorSpace = THREE.SRGBColorSpace; + mapBg.wrapS = mapBg.wrapT = THREE.RepeatWrapping; + mapBg.repeat.set(64, 32); + + scene.background = mapBg; + + // OBJECTS + + const blendings = [ + { name: 'No', constant: THREE.NoBlending }, + { name: 'Normal', constant: THREE.NormalBlending }, + { name: 'Additive', constant: THREE.AdditiveBlending }, + { name: 'Subtractive', constant: THREE.SubtractiveBlending }, + { name: 'Multiply', constant: THREE.MultiplyBlending }, + ]; + + const assignSRGB = texture => { + texture.colorSpace = THREE.SRGBColorSpace; + }; + + const map0 = textureLoader.load('textures/uv_grid_opengl.jpg', assignSRGB); + const map1 = textureLoader.load('textures/sprite0.jpg', assignSRGB); + const map2 = textureLoader.load('textures/sprite0.png', assignSRGB); + const map3 = textureLoader.load('textures/lensflare/lensflare0.png', assignSRGB); + const map4 = textureLoader.load('textures/lensflare/lensflare0_alpha.png', assignSRGB); + + const geo1 = new THREE.PlaneGeometry(100, 100); + const geo2 = new THREE.PlaneGeometry(100, 25); + + addImageRow(map0, 300); + addImageRow(map1, 150); + addImageRow(map2, 0); + addImageRow(map3, -150); + addImageRow(map4, -300); + + function addImageRow(map, y) { + for (let i = 0; i < blendings.length; i++) { + const blending = blendings[i]; + + const material = new THREE.MeshBasicMaterial({ map: map }); + material.transparent = true; + material.blending = blending.constant; + + material.premultipliedAlpha = true; + + const x = (i - blendings.length / 2) * 110; + const z = 0; + + let mesh = new THREE.Mesh(geo1, material); + mesh.position.set(x, y, z); + scene.add(mesh); + + mesh = new THREE.Mesh(geo2, generateLabelMaterial(blending.name)); + mesh.position.set(x, y - 75, z); + scene.add(mesh); + } + } + + // RENDERER + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // EVENTS + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + const SCREEN_WIDTH = window.innerWidth; + const SCREEN_HEIGHT = window.innerHeight; + + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + + camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + camera.updateProjectionMatrix(); +} + +function generateLabelMaterial(text) { + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + canvas.width = 128; + canvas.height = 32; + + ctx.fillStyle = 'rgba( 0, 0, 0, 0.95 )'; + ctx.fillRect(0, 0, 128, 32); + + ctx.fillStyle = 'white'; + ctx.font = 'bold 12pt arial'; + ctx.fillText(text, 10, 22); + + const map = new THREE.CanvasTexture(canvas); + map.colorSpace = THREE.SRGBColorSpace; + + const material = new THREE.MeshBasicMaterial({ map: map, transparent: true }); + + return material; +} + +function animate() { + const time = Date.now() * 0.00025; + const ox = (time * -0.01 * mapBg.repeat.x) % 1; + const oy = (time * -0.01 * mapBg.repeat.y) % 1; + + mapBg.offset.set(ox, oy); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_blending_custom.ts b/examples-testing/examples/webgl_materials_blending_custom.ts new file mode 100644 index 000000000..072447426 --- /dev/null +++ b/examples-testing/examples/webgl_materials_blending_custom.ts @@ -0,0 +1,214 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer; + +let mapBg; +const materials = []; + +const params = { + blendEquation: THREE.AddEquation, +}; + +const equations = { + Add: THREE.AddEquation, + Subtract: THREE.SubtractEquation, + ReverseSubtract: THREE.ReverseSubtractEquation, + Min: THREE.MinEquation, + Max: THREE.MaxEquation, +}; + +init(); + +function init() { + // CAMERA + + camera = new THREE.PerspectiveCamera(80, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 700; + + // SCENE + + scene = new THREE.Scene(); + + // BACKGROUND + + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + canvas.width = canvas.height = 128; + ctx.fillStyle = '#ddd'; + ctx.fillRect(0, 0, 128, 128); + ctx.fillStyle = '#555'; + ctx.fillRect(0, 0, 64, 64); + ctx.fillStyle = '#999'; + ctx.fillRect(32, 32, 32, 32); + ctx.fillStyle = '#555'; + ctx.fillRect(64, 64, 64, 64); + ctx.fillStyle = '#777'; + ctx.fillRect(96, 96, 32, 32); + + mapBg = new THREE.CanvasTexture(canvas); + mapBg.colorSpace = THREE.SRGBColorSpace; + mapBg.wrapS = mapBg.wrapT = THREE.RepeatWrapping; + mapBg.repeat.set(64, 32); + + scene.background = mapBg; + + // FOREGROUND OBJECTS + + const src = [ + { name: 'Zero', constant: THREE.ZeroFactor }, + { name: 'One', constant: THREE.OneFactor }, + { name: 'SrcColor', constant: THREE.SrcColorFactor }, + { name: 'OneMinusSrcColor', constant: THREE.OneMinusSrcColorFactor }, + { name: 'SrcAlpha', constant: THREE.SrcAlphaFactor }, + { name: 'OneMinusSrcAlpha', constant: THREE.OneMinusSrcAlphaFactor }, + { name: 'DstAlpha', constant: THREE.DstAlphaFactor }, + { name: 'OneMinusDstAlpha', constant: THREE.OneMinusDstAlphaFactor }, + { name: 'DstColor', constant: THREE.DstColorFactor }, + { name: 'OneMinusDstColor', constant: THREE.OneMinusDstColorFactor }, + { name: 'SrcAlphaSaturate', constant: THREE.SrcAlphaSaturateFactor }, + ]; + + const dst = [ + { name: 'Zero', constant: THREE.ZeroFactor }, + { name: 'One', constant: THREE.OneFactor }, + { name: 'SrcColor', constant: THREE.SrcColorFactor }, + { name: 'OneMinusSrcColor', constant: THREE.OneMinusSrcColorFactor }, + { name: 'SrcAlpha', constant: THREE.SrcAlphaFactor }, + { name: 'OneMinusSrcAlpha', constant: THREE.OneMinusSrcAlphaFactor }, + { name: 'DstAlpha', constant: THREE.DstAlphaFactor }, + { name: 'OneMinusDstAlpha', constant: THREE.OneMinusDstAlphaFactor }, + { name: 'DstColor', constant: THREE.DstColorFactor }, + { name: 'OneMinusDstColor', constant: THREE.OneMinusDstColorFactor }, + ]; + + const geo1 = new THREE.PlaneGeometry(100, 100); + const geo2 = new THREE.PlaneGeometry(100, 25); + + const texture = new THREE.TextureLoader().load('textures/lensflare/lensflare0_alpha.png'); + texture.colorSpace = THREE.SRGBColorSpace; + + for (let i = 0; i < dst.length; i++) { + const blendDst = dst[i]; + + for (let j = 0; j < src.length; j++) { + const blendSrc = src[j]; + + const material = new THREE.MeshBasicMaterial({ map: texture }); + material.transparent = true; + + material.blending = THREE.CustomBlending; + material.blendSrc = blendSrc.constant; + material.blendDst = blendDst.constant; + material.blendEquation = THREE.AddEquation; + + const x = (j - src.length / 2) * 110; + const z = 0; + const y = (i - dst.length / 2) * 110 + 50; + + const mesh = new THREE.Mesh(geo1, material); + mesh.position.set(x, -y, z); + mesh.matrixAutoUpdate = false; + mesh.updateMatrix(); + scene.add(mesh); + + materials.push(material); + } + } + + for (let j = 0; j < src.length; j++) { + const blendSrc = src[j]; + + const x = (j - src.length / 2) * 110; + const z = 0; + const y = (0 - dst.length / 2) * 110 + 50; + + const mesh = new THREE.Mesh(geo2, generateLabelMaterial(blendSrc.name, 'rgba( 0, 150, 0, 1 )')); + mesh.position.set(x, -(y - 70), z); + mesh.matrixAutoUpdate = false; + mesh.updateMatrix(); + scene.add(mesh); + } + + for (let i = 0; i < dst.length; i++) { + const blendDst = dst[i]; + + const x = (0 - src.length / 2) * 110 - 125; + const z = 0; + const y = (i - dst.length / 2) * 110 + 165; + + const mesh = new THREE.Mesh(geo2, generateLabelMaterial(blendDst.name, 'rgba( 150, 0, 0, 1 )')); + mesh.position.set(x, -(y - 120), z); + mesh.matrixAutoUpdate = false; + mesh.updateMatrix(); + scene.add(mesh); + } + + // RENDERER + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // EVENTS + + window.addEventListener('resize', onWindowResize); + + // GUI + + // + const gui = new GUI({ width: 300 }); + + gui.add(params, 'blendEquation', equations).onChange(updateBlendEquation); + gui.open(); +} + +// + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +// + +function generateLabelMaterial(text, bg) { + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + canvas.width = 128; + canvas.height = 32; + + ctx.fillStyle = bg; + ctx.fillRect(0, 0, 128, 32); + + ctx.fillStyle = 'white'; + ctx.font = 'bold 11pt arial'; + ctx.fillText(text, 8, 22); + + const map = new THREE.CanvasTexture(canvas); + map.colorSpace = THREE.SRGBColorSpace; + + const material = new THREE.MeshBasicMaterial({ map: map, transparent: true }); + return material; +} + +function updateBlendEquation(value) { + for (const material of materials) { + material.blendEquation = value; + } +} + +function animate() { + const time = Date.now() * 0.00025; + const ox = (time * -0.01 * mapBg.repeat.x) % 1; + const oy = (time * -0.01 * mapBg.repeat.y) % 1; + + mapBg.offset.set(ox, oy); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_bumpmap.ts b/examples-testing/examples/webgl_materials_bumpmap.ts new file mode 100644 index 000000000..a09c21573 --- /dev/null +++ b/examples-testing/examples/webgl_materials_bumpmap.ts @@ -0,0 +1,134 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container, loader; + +let camera, scene, renderer, controls; + +let mesh; + +let spotLight; + +const params = { + enableBumpMap: true, +}; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 12; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x060708); + + // LIGHTS + + scene.add(new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3)); + + spotLight = new THREE.SpotLight(0xffffde, 200); + spotLight.position.set(3.5, 0, 7); + scene.add(spotLight); + + spotLight.castShadow = true; + + spotLight.shadow.mapSize.width = 2048; + spotLight.shadow.mapSize.height = 2048; + + spotLight.shadow.camera.near = 2; + spotLight.shadow.camera.far = 15; + + spotLight.shadow.camera.fov = 40; + + spotLight.shadow.bias = -0.005; + + // + + const mapHeight = new THREE.TextureLoader().load( + 'models/gltf/LeePerrySmith/Infinite-Level_02_Disp_NoSmoothUV-4096.jpg', + ); + + const material = new THREE.MeshPhongMaterial({ + color: 0x9c6e49, + specular: 0x666666, + shininess: 25, + bumpMap: mapHeight, + bumpScale: 10, + }); + + loader = new GLTFLoader(); + loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + createScene(gltf.scene.children[0].geometry, 1, material); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + renderer.shadowMap.enabled = true; + + // EVENTS + + window.addEventListener('resize', onWindowResize); + + // GUI + + const gui = new GUI(); + + gui.add(params, 'enableBumpMap') + .name('enable bump map') + .onChange(value => { + mesh.material.bumpMap = value === true ? mapHeight : null; + mesh.material.needsUpdate = true; + }); + gui.add(material, 'bumpScale', 0, 40).name('bump scale'); + gui.open(); + + // CONTROLS + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 8; + controls.maxDistance = 50; + controls.enablePan = false; + controls.enableDamping = true; +} + +function createScene(geometry, scale, material) { + mesh = new THREE.Mesh(geometry, material); + + mesh.position.y = -0.5; + mesh.scale.set(scale, scale, scale); + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); +} + +// + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +// + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_car.ts b/examples-testing/examples/webgl_materials_car.ts new file mode 100644 index 000000000..a839e8dce --- /dev/null +++ b/examples-testing/examples/webgl_materials_car.ts @@ -0,0 +1,168 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let camera, scene, renderer; +let stats; + +let grid; +let controls; + +const wheels = []; + +function init() { + const container = document.getElementById('container'); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.85; + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(4.25, 1.4, -4.5); + + controls = new OrbitControls(camera, container); + controls.maxDistance = 9; + controls.maxPolarAngle = THREE.MathUtils.degToRad(90); + controls.target.set(0, 0.5, 0); + controls.update(); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x333333); + scene.environment = new HDRLoader().load('textures/equirectangular/venice_sunset_1k.hdr'); + scene.environment.mapping = THREE.EquirectangularReflectionMapping; + scene.fog = new THREE.Fog(0x333333, 10, 15); + + grid = new THREE.GridHelper(20, 40, 0xffffff, 0xffffff); + grid.material.opacity = 0.2; + grid.material.depthWrite = false; + grid.material.transparent = true; + scene.add(grid); + + // materials + + const bodyMaterial = new THREE.MeshPhysicalMaterial({ + color: 0xff0000, + metalness: 1.0, + roughness: 0.5, + clearcoat: 1.0, + clearcoatRoughness: 0.03, + }); + + const detailsMaterial = new THREE.MeshStandardMaterial({ + color: 0xffffff, + metalness: 1.0, + roughness: 0.5, + }); + + const glassMaterial = new THREE.MeshPhysicalMaterial({ + color: 0xffffff, + metalness: 0.25, + roughness: 0, + transmission: 1.0, + }); + + const bodyColorInput = document.getElementById('body-color'); + bodyColorInput.addEventListener('input', function () { + bodyMaterial.color.set(this.value); + }); + + const detailsColorInput = document.getElementById('details-color'); + detailsColorInput.addEventListener('input', function () { + detailsMaterial.color.set(this.value); + }); + + const glassColorInput = document.getElementById('glass-color'); + glassColorInput.addEventListener('input', function () { + glassMaterial.color.set(this.value); + }); + + // Car + + const shadow = new THREE.TextureLoader().load('models/gltf/ferrari_ao.png'); + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + + loader.load('models/gltf/ferrari.glb', function (gltf) { + const carModel = gltf.scene.children[0]; + + carModel.getObjectByName('body').material = bodyMaterial; + + carModel.getObjectByName('rim_fl').material = detailsMaterial; + carModel.getObjectByName('rim_fr').material = detailsMaterial; + carModel.getObjectByName('rim_rr').material = detailsMaterial; + carModel.getObjectByName('rim_rl').material = detailsMaterial; + carModel.getObjectByName('trim').material = detailsMaterial; + + carModel.getObjectByName('glass').material = glassMaterial; + + wheels.push( + carModel.getObjectByName('wheel_fl'), + carModel.getObjectByName('wheel_fr'), + carModel.getObjectByName('wheel_rl'), + carModel.getObjectByName('wheel_rr'), + ); + + // shadow + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(0.655 * 4, 1.3 * 4), + new THREE.MeshBasicMaterial({ + map: shadow, + blending: THREE.MultiplyBlending, + toneMapped: false, + transparent: true, + premultipliedAlpha: true, + }), + ); + mesh.rotation.x = -Math.PI / 2; + mesh.renderOrder = 2; + carModel.add(mesh); + + scene.add(carModel); + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + const time = -performance.now() / 1000; + + for (let i = 0; i < wheels.length; i++) { + wheels[i].rotation.x = time * Math.PI * 2; + } + + grid.position.z = -time % 1; + + renderer.render(scene, camera); + + stats.update(); +} + +init(); diff --git a/examples-testing/examples/webgl_materials_cubemap.ts b/examples-testing/examples/webgl_materials_cubemap.ts new file mode 100644 index 000000000..5f2692751 --- /dev/null +++ b/examples-testing/examples/webgl_materials_cubemap.ts @@ -0,0 +1,115 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; + +let container, stats; + +let camera, scene, renderer; + +let pointLight; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 13; + + //cubemap + const path = 'textures/cube/SwedishRoyalCastle/'; + const format = '.jpg'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const reflectionCube = new THREE.CubeTextureLoader().load(urls); + const refractionCube = new THREE.CubeTextureLoader().load(urls); + refractionCube.mapping = THREE.CubeRefractionMapping; + + scene = new THREE.Scene(); + scene.background = reflectionCube; + + //lights + const ambient = new THREE.AmbientLight(0xffffff, 3); + scene.add(ambient); + + pointLight = new THREE.PointLight(0xffffff, 200); + scene.add(pointLight); + + //materials + const cubeMaterial3 = new THREE.MeshLambertMaterial({ + color: 0xffaa00, + envMap: reflectionCube, + combine: THREE.MixOperation, + reflectivity: 0.3, + }); + const cubeMaterial2 = new THREE.MeshLambertMaterial({ + color: 0xfff700, + envMap: refractionCube, + refractionRatio: 0.95, + }); + const cubeMaterial1 = new THREE.MeshLambertMaterial({ color: 0xffffff, envMap: reflectionCube }); + + //models + const objLoader = new OBJLoader(); + + objLoader.setPath('models/obj/walt/'); + objLoader.load('WaltHead.obj', function (object) { + const head = object.children[0]; + head.scale.setScalar(0.1); + head.position.y = -3; + head.material = cubeMaterial1; + + const head2 = head.clone(); + head2.position.x = -6; + head2.material = cubeMaterial2; + + const head3 = head.clone(); + head3.position.x = 6; + head3.material = cubeMaterial3; + + scene.add(head, head2, head3); + }); + + //renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + //controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enablePan = false; + controls.minPolarAngle = Math.PI / 4; + controls.maxPolarAngle = Math.PI / 1.5; + + //stats + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); + stats.update(); +} diff --git a/examples-testing/examples/webgl_materials_cubemap_dynamic.ts b/examples-testing/examples/webgl_materials_cubemap_dynamic.ts new file mode 100644 index 000000000..301835dda --- /dev/null +++ b/examples-testing/examples/webgl_materials_cubemap_dynamic.ts @@ -0,0 +1,115 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, stats; +let cube, sphere, torus, material; + +let cubeCamera, cubeRenderTarget; + +let controls; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResized); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 75; + + scene = new THREE.Scene(); + scene.rotation.y = 0.5; // avoid flying objects occluding the sun + + new HDRLoader().setPath('textures/equirectangular/').load('quarry_01_1k.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + }); + + // + + cubeRenderTarget = new THREE.WebGLCubeRenderTarget(256); + cubeRenderTarget.texture.type = THREE.HalfFloatType; + + cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); + + // + + material = new THREE.MeshStandardMaterial({ + envMap: cubeRenderTarget.texture, + roughness: 0.05, + metalness: 1, + }); + + const gui = new GUI(); + gui.add(material, 'roughness', 0, 1); + gui.add(material, 'metalness', 0, 1); + gui.add(renderer, 'toneMappingExposure', 0, 2).name('exposure'); + + sphere = new THREE.Mesh(new THREE.IcosahedronGeometry(15, 8), material); + scene.add(sphere); + + const material2 = new THREE.MeshStandardMaterial({ + roughness: 0.1, + metalness: 0, + }); + + cube = new THREE.Mesh(new THREE.BoxGeometry(15, 15, 15), material2); + scene.add(cube); + + torus = new THREE.Mesh(new THREE.TorusKnotGeometry(8, 3, 128, 16), material2); + scene.add(torus); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; +} + +function onWindowResized() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +function animate(msTime) { + const time = msTime / 1000; + + cube.position.x = Math.cos(time) * 30; + cube.position.y = Math.sin(time) * 30; + cube.position.z = Math.sin(time) * 30; + + cube.rotation.x += 0.02; + cube.rotation.y += 0.03; + + torus.position.x = Math.cos(time + 10) * 30; + torus.position.y = Math.sin(time + 10) * 30; + torus.position.z = Math.sin(time + 10) * 30; + + torus.rotation.x += 0.02; + torus.rotation.y += 0.03; + + cubeCamera.update(renderer, scene); + + controls.update(); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_materials_cubemap_mipmaps.ts b/examples-testing/examples/webgl_materials_cubemap_mipmaps.ts new file mode 100644 index 000000000..944f4c18e --- /dev/null +++ b/examples-testing/examples/webgl_materials_cubemap_mipmaps.ts @@ -0,0 +1,119 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container; + +let camera, scene, renderer; + +init(); + +//load customized cube texture +async function loadCubeTextureWithMipmaps() { + const path = 'textures/cube/angus/'; + const format = '.jpg'; + const mipmaps = []; + const maxLevel = 8; + + async function loadCubeTexture(urls) { + return new Promise(function (resolve) { + new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { + resolve(cubeTexture); + }); + }); + } + + // load mipmaps + const pendings = []; + + for (let level = 0; level <= maxLevel; ++level) { + const urls = []; + + for (let face = 0; face < 6; ++face) { + urls.push(path + 'cube_m0' + level + '_c0' + face + format); + } + + const mipmapLevel = level; + + pendings.push( + loadCubeTexture(urls).then(function (cubeTexture) { + mipmaps[mipmapLevel] = cubeTexture; + }), + ); + } + + await Promise.all(pendings); + + const customizedCubeTexture = mipmaps.shift(); + customizedCubeTexture.mipmaps = mipmaps; + customizedCubeTexture.colorSpace = THREE.SRGBColorSpace; + customizedCubeTexture.minFilter = THREE.LinearMipMapLinearFilter; + customizedCubeTexture.magFilter = THREE.LinearFilter; + customizedCubeTexture.generateMipmaps = false; + customizedCubeTexture.needsUpdate = true; + + return customizedCubeTexture; +} + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 500; + + scene = new THREE.Scene(); + + loadCubeTextureWithMipmaps().then(function (cubeTexture) { + //model + const sphere = new THREE.SphereGeometry(100, 128, 128); + + //manual mipmaps + let material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: cubeTexture }); + material.name = 'manual mipmaps'; + + let mesh = new THREE.Mesh(sphere, material); + mesh.position.set(100, 0, 0); + scene.add(mesh); + + //webgl mipmaps + material = material.clone(); + material.name = 'auto mipmaps'; + + const autoCubeTexture = cubeTexture.clone(); + autoCubeTexture.mipmaps = []; + autoCubeTexture.generateMipmaps = true; + autoCubeTexture.needsUpdate = true; + + material.envMap = autoCubeTexture; + + mesh = new THREE.Mesh(sphere, material); + mesh.position.set(-100, 0, 0); + scene.add(mesh); + }); + + //renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + //controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.minPolarAngle = Math.PI / 4; + controls.maxPolarAngle = Math.PI / 1.5; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_cubemap_refraction.ts b/examples-testing/examples/webgl_materials_cubemap_refraction.ts new file mode 100644 index 000000000..8c025071f --- /dev/null +++ b/examples-testing/examples/webgl_materials_cubemap_refraction.ts @@ -0,0 +1,126 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; + +let container, stats; + +let camera, scene, renderer; + +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 100000); + camera.position.z = -4000; + + // + + const r = 'textures/cube/Park3Med/'; + + const urls = [r + 'px.jpg', r + 'nx.jpg', r + 'py.jpg', r + 'ny.jpg', r + 'pz.jpg', r + 'nz.jpg']; + + const textureCube = new THREE.CubeTextureLoader().load(urls); + textureCube.mapping = THREE.CubeRefractionMapping; + + scene = new THREE.Scene(); + scene.background = textureCube; + + // LIGHTS + + const ambient = new THREE.AmbientLight(0xffffff, 3.5); + scene.add(ambient); + + // material samples + + const cubeMaterial3 = new THREE.MeshPhongMaterial({ + color: 0xccddff, + envMap: textureCube, + refractionRatio: 0.98, + reflectivity: 0.9, + }); + const cubeMaterial2 = new THREE.MeshPhongMaterial({ color: 0xccfffd, envMap: textureCube, refractionRatio: 0.985 }); + const cubeMaterial1 = new THREE.MeshPhongMaterial({ color: 0xffffff, envMap: textureCube, refractionRatio: 0.98 }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + const loader = new PLYLoader(); + loader.load('models/ply/binary/Lucy100k.ply', function (geometry) { + createScene(geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3); + }); + + document.addEventListener('mousemove', onDocumentMouseMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function createScene(geometry, m1, m2, m3) { + geometry.computeVertexNormals(); + + const s = 1.5; + + let mesh = new THREE.Mesh(geometry, m1); + mesh.scale.x = mesh.scale.y = mesh.scale.z = s; + scene.add(mesh); + + mesh = new THREE.Mesh(geometry, m2); + mesh.position.x = -1500; + mesh.scale.x = mesh.scale.y = mesh.scale.z = s; + scene.add(mesh); + + mesh = new THREE.Mesh(geometry, m3); + mesh.position.x = 1500; + mesh.scale.x = mesh.scale.y = mesh.scale.z = s; + scene.add(mesh); +} + +function onDocumentMouseMove(event) { + mouseX = (event.clientX - windowHalfX) * 4; + mouseY = (event.clientY - windowHalfY) * 4; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts b/examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts new file mode 100644 index 000000000..599a1369b --- /dev/null +++ b/examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts @@ -0,0 +1,183 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container; +let camera, scene, renderer; + +const CubemapFilterShader = { + name: 'CubemapFilterShader', + + uniforms: { + cubeTexture: { value: null }, + mipIndex: { value: 0 }, + }, + + vertexShader: /* glsl */ ` + + varying vec3 vWorldDirection; + + #include + + void main() { + vWorldDirection = transformDirection(position, modelMatrix); + #include + #include + gl_Position.z = gl_Position.w; // set z to camera.far + } + + `, + + fragmentShader: /* glsl */ ` + + uniform samplerCube cubeTexture; + varying vec3 vWorldDirection; + + uniform float mipIndex; + + #include + + void main() { + vec3 cubeCoordinates = normalize(vWorldDirection); + + // Colorize mip levels + vec4 color = vec4(1.0, 0.0, 0.0, 1.0); + if (mipIndex == 0.0) color.rgb = vec3(1.0, 1.0, 1.0); + else if (mipIndex == 1.0) color.rgb = vec3(0.0, 0.0, 1.0); + else if (mipIndex == 2.0) color.rgb = vec3(0.0, 1.0, 1.0); + else if (mipIndex == 3.0) color.rgb = vec3(0.0, 1.0, 0.0); + else if (mipIndex == 4.0) color.rgb = vec3(1.0, 1.0, 0.0); + + gl_FragColor = textureCube(cubeTexture, cubeCoordinates, 0.0) * color; + } + + `, +}; + +init(); + +async function loadCubeTexture(urls) { + return new Promise(function (resolve) { + new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { + resolve(cubeTexture); + }); + }); +} + +function allocateCubemapRenderTarget(cubeMapSize) { + const params = { + magFilter: THREE.LinearFilter, + minFilter: THREE.LinearMipMapLinearFilter, + generateMipmaps: false, + type: THREE.HalfFloatType, + format: THREE.RGBAFormat, + colorSpace: THREE.LinearSRGBColorSpace, + depthBuffer: false, + }; + + const rt = new THREE.WebGLCubeRenderTarget(cubeMapSize, params); + + const mipLevels = Math.log(cubeMapSize) * Math.LOG2E + 1.0; + for (let i = 0; i < mipLevels; i++) rt.texture.mipmaps.push({}); + + rt.texture.mapping = THREE.CubeReflectionMapping; + return rt; +} + +function renderToCubeTexture(cubeMapRenderTarget, sourceCubeTexture) { + const geometry = new THREE.BoxGeometry(5, 5, 5); + + const material = new THREE.ShaderMaterial({ + name: CubemapFilterShader.name, + uniforms: THREE.UniformsUtils.clone(CubemapFilterShader.uniforms), + vertexShader: CubemapFilterShader.vertexShader, + fragmentShader: CubemapFilterShader.fragmentShader, + side: THREE.BackSide, + blending: THREE.NoBlending, + }); + + material.uniforms.cubeTexture.value = sourceCubeTexture; + + const mesh = new THREE.Mesh(geometry, material); + const cubeCamera = new THREE.CubeCamera(1, 10, cubeMapRenderTarget); + const mipmapCount = Math.floor(Math.log2(Math.max(cubeMapRenderTarget.width, cubeMapRenderTarget.height))); + + for (let mipmap = 0; mipmap < mipmapCount; mipmap++) { + material.uniforms.mipIndex.value = mipmap; + material.needsUpdate = true; + + cubeMapRenderTarget.viewport.set( + 0, + 0, + cubeMapRenderTarget.width >> mipmap, + cubeMapRenderTarget.height >> mipmap, + ); + + cubeCamera.activeMipmapLevel = mipmap; + cubeCamera.update(renderer, mesh); + } + + mesh.geometry.dispose(); + mesh.material.dispose(); +} + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // Create renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 500; + + // Create controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.minPolarAngle = Math.PI / 4; + controls.maxPolarAngle = Math.PI / 1.5; + + window.addEventListener('resize', onWindowResize); + + // Load a cube texture + const r = 'textures/cube/Park3Med/'; + const urls = [r + 'px.jpg', r + 'nx.jpg', r + 'py.jpg', r + 'ny.jpg', r + 'pz.jpg', r + 'nz.jpg']; + + loadCubeTexture(urls).then(cubeTexture => { + // Allocate a cube map render target + const cubeMapRenderTarget = allocateCubemapRenderTarget(512); + + // Render to all the mip levels of cubeMapRenderTarget + renderToCubeTexture(cubeMapRenderTarget, cubeTexture); + + // Create geometry + const sphere = new THREE.SphereGeometry(100, 128, 128); + let material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: cubeTexture }); + + let mesh = new THREE.Mesh(sphere, material); + mesh.position.set(-100, 0, 0); + scene.add(mesh); + + material = material.clone(); + material.envMap = cubeMapRenderTarget.texture; + + mesh = new THREE.Mesh(sphere, material); + mesh.position.set(100, 0, 0); + scene.add(mesh); + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_displacementmap.ts b/examples-testing/examples/webgl_materials_displacementmap.ts new file mode 100644 index 000000000..fd0be9a5e --- /dev/null +++ b/examples-testing/examples/webgl_materials_displacementmap.ts @@ -0,0 +1,224 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; + +let stats; +let camera, scene, renderer, controls; + +const settings = { + metalness: 1.0, + roughness: 0.4, + ambientIntensity: 0.2, + aoMapIntensity: 1.0, + envMapIntensity: 1.0, + displacementScale: 2.436143, // from original model + normalScale: 1.0, +}; + +let mesh, material; + +let pointLight, ambientLight; + +const height = 500; // of camera frustum + +let r = 0.0; + +init(); +initGui(); + +// Init gui +function initGui() { + const gui = new GUI(); + //let gui = gui.addFolder( "Material" ); + gui.add(settings, 'metalness') + .min(0) + .max(1) + .onChange(function (value) { + material.metalness = value; + }); + + gui.add(settings, 'roughness') + .min(0) + .max(1) + .onChange(function (value) { + material.roughness = value; + }); + + gui.add(settings, 'aoMapIntensity') + .min(0) + .max(1) + .onChange(function (value) { + material.aoMapIntensity = value; + }); + + gui.add(settings, 'ambientIntensity') + .min(0) + .max(1) + .onChange(function (value) { + ambientLight.intensity = value; + }); + + gui.add(settings, 'envMapIntensity') + .min(0) + .max(3) + .onChange(function (value) { + material.envMapIntensity = value; + }); + + gui.add(settings, 'displacementScale') + .min(0) + .max(3.0) + .onChange(function (value) { + material.displacementScale = value; + }); + + gui.add(settings, 'normalScale') + .min(-1) + .max(1) + .onChange(function (value) { + material.normalScale.set(1, -1).multiplyScalar(value); + }); +} + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + scene = new THREE.Scene(); + + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera(-height * aspect, height * aspect, height, -height, 1, 10000); + camera.position.z = 1500; + scene.add(camera); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enableDamping = true; + + // lights + + ambientLight = new THREE.AmbientLight(0xffffff, settings.ambientIntensity); + scene.add(ambientLight); + + pointLight = new THREE.PointLight(0xff0000, 1.5, 0, 0); + pointLight.position.z = 2500; + scene.add(pointLight); + + const pointLight2 = new THREE.PointLight(0xff6666, 3, 0, 0); + camera.add(pointLight2); + + const pointLight3 = new THREE.PointLight(0x0000ff, 1.5, 0, 0); + pointLight3.position.x = -1000; + pointLight3.position.z = 1000; + scene.add(pointLight3); + + // env map + + const path = 'textures/cube/SwedishRoyalCastle/'; + const format = '.jpg'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const reflectionCube = new THREE.CubeTextureLoader().load(urls); + + // textures + + const textureLoader = new THREE.TextureLoader(); + const normalMap = textureLoader.load('models/obj/ninja/normal.png'); + const aoMap = textureLoader.load('models/obj/ninja/ao.jpg'); + const displacementMap = textureLoader.load('models/obj/ninja/displacement.jpg'); + + // material + + material = new THREE.MeshStandardMaterial({ + color: 0xc1c1c1, + roughness: settings.roughness, + metalness: settings.metalness, + + normalMap: normalMap, + normalScale: new THREE.Vector2(1, -1), // why does the normal map require negation in this case? + + aoMap: aoMap, + aoMapIntensity: 1, + + displacementMap: displacementMap, + displacementScale: settings.displacementScale, + displacementBias: -0.428408, // from original model + + envMap: reflectionCube, + envMapIntensity: settings.envMapIntensity, + + side: THREE.DoubleSide, + }); + + // + + const loader = new OBJLoader(); + loader.load('models/obj/ninja/ninjaHead_Low.obj', function (group) { + const geometry = group.children[0].geometry; + geometry.center(); + + mesh = new THREE.Mesh(geometry, material); + mesh.scale.multiplyScalar(25); + scene.add(mesh); + }); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const aspect = window.innerWidth / window.innerHeight; + + camera.left = -height * aspect; + camera.right = height * aspect; + camera.top = height; + camera.bottom = -height; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + controls.update(); + + stats.begin(); + render(); + stats.end(); +} + +function render() { + pointLight.position.x = 2500 * Math.cos(r); + pointLight.position.z = 2500 * Math.sin(r); + + r += 0.01; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_envmaps.ts b/examples-testing/examples/webgl_materials_envmaps.ts new file mode 100644 index 000000000..18a5542ed --- /dev/null +++ b/examples-testing/examples/webgl_materials_envmaps.ts @@ -0,0 +1,131 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let controls, camera, scene, renderer; +let textureEquirec, textureCube; +let sphereMesh, sphereMaterial, params; + +init(); + +function init() { + // CAMERAS + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 2.5); + + // SCENE + + scene = new THREE.Scene(); + + // Textures + + const loader = new THREE.CubeTextureLoader(); + loader.setPath('textures/cube/Bridge2/'); + + textureCube = loader.load(['posx.jpg', 'negx.jpg', 'posy.jpg', 'negy.jpg', 'posz.jpg', 'negz.jpg']); + + const textureLoader = new THREE.TextureLoader(); + + textureEquirec = textureLoader.load('textures/2294472375_24a3b8ef46_o.jpg'); + textureEquirec.mapping = THREE.EquirectangularReflectionMapping; + textureEquirec.colorSpace = THREE.SRGBColorSpace; + + scene.background = textureCube; + + // + + const geometry = new THREE.IcosahedronGeometry(1, 15); + sphereMaterial = new THREE.MeshBasicMaterial({ envMap: textureCube }); + sphereMesh = new THREE.Mesh(geometry, sphereMaterial); + scene.add(sphereMesh); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1.5; + controls.maxDistance = 6; + + // + + params = { + Cube: function () { + scene.background = textureCube; + + sphereMaterial.envMap = textureCube; + sphereMaterial.needsUpdate = true; + }, + Equirectangular: function () { + scene.background = textureEquirec; + + sphereMaterial.envMap = textureEquirec; + sphereMaterial.needsUpdate = true; + }, + Refraction: false, + backgroundRotationX: false, + backgroundRotationY: false, + backgroundRotationZ: false, + syncMaterial: false, + }; + + const gui = new GUI({ width: 300 }); + gui.add(params, 'Cube'); + gui.add(params, 'Equirectangular'); + gui.add(params, 'Refraction').onChange(function (value) { + if (value) { + textureEquirec.mapping = THREE.EquirectangularRefractionMapping; + textureCube.mapping = THREE.CubeRefractionMapping; + } else { + textureEquirec.mapping = THREE.EquirectangularReflectionMapping; + textureCube.mapping = THREE.CubeReflectionMapping; + } + + sphereMaterial.needsUpdate = true; + }); + gui.add(params, 'backgroundRotationX'); + gui.add(params, 'backgroundRotationY'); + gui.add(params, 'backgroundRotationZ'); + gui.add(params, 'syncMaterial'); + gui.open(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + if (params.backgroundRotationX) { + scene.backgroundRotation.x += 0.001; + } + + if (params.backgroundRotationY) { + scene.backgroundRotation.y += 0.001; + } + + if (params.backgroundRotationZ) { + scene.backgroundRotation.z += 0.001; + } + + if (params.syncMaterial) { + sphereMesh.material.envMapRotation.copy(scene.backgroundRotation); + } + + camera.lookAt(scene.position); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_envmaps_exr.ts b/examples-testing/examples/webgl_materials_envmaps_exr.ts new file mode 100644 index 000000000..c3f3f4f7d --- /dev/null +++ b/examples-testing/examples/webgl_materials_envmaps_exr.ts @@ -0,0 +1,153 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; + +const params = { + envMap: 'EXR', + roughness: 0.0, + metalness: 0.0, + exposure: 1.0, + debug: false, +}; + +let container, stats; +let camera, scene, renderer, controls; +let torusMesh, planeMesh; +let pngCubeRenderTarget, exrCubeRenderTarget; +let pngBackground, exrBackground; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 120); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + // + + let geometry = new THREE.TorusKnotGeometry(18, 8, 150, 20); + let material = new THREE.MeshStandardMaterial({ + metalness: params.metalness, + roughness: params.roughness, + envMapIntensity: 1.0, + }); + + torusMesh = new THREE.Mesh(geometry, material); + scene.add(torusMesh); + + geometry = new THREE.PlaneGeometry(200, 200); + material = new THREE.MeshBasicMaterial(); + + planeMesh = new THREE.Mesh(geometry, material); + planeMesh.position.y = -50; + planeMesh.rotation.x = -Math.PI * 0.5; + scene.add(planeMesh); + + THREE.DefaultLoadingManager.onLoad = function () { + pmremGenerator.dispose(); + }; + + new EXRLoader().load('textures/piz_compressed.exr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + exrCubeRenderTarget = pmremGenerator.fromEquirectangular(texture); + exrBackground = texture; + }); + + new THREE.TextureLoader().load('textures/equirectangular.png', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + texture.colorSpace = THREE.SRGBColorSpace; + + pngCubeRenderTarget = pmremGenerator.fromEquirectangular(texture); + pngBackground = texture; + }); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + pmremGenerator.compileEquirectangularShader(); + + stats = new Stats(); + container.appendChild(stats.dom); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 50; + controls.maxDistance = 300; + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'envMap', ['EXR', 'PNG']); + gui.add(params, 'roughness', 0, 1, 0.01); + gui.add(params, 'metalness', 0, 1, 0.01); + gui.add(params, 'exposure', 0, 2, 0.01); + gui.add(params, 'debug'); + gui.open(); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + torusMesh.material.roughness = params.roughness; + torusMesh.material.metalness = params.metalness; + + let newEnvMap = torusMesh.material.envMap; + let background = scene.background; + + switch (params.envMap) { + case 'EXR': + newEnvMap = exrCubeRenderTarget ? exrCubeRenderTarget.texture : null; + background = exrBackground; + break; + case 'PNG': + newEnvMap = pngCubeRenderTarget ? pngCubeRenderTarget.texture : null; + background = pngBackground; + break; + } + + if (newEnvMap !== torusMesh.material.envMap) { + torusMesh.material.envMap = newEnvMap; + torusMesh.material.needsUpdate = true; + + planeMesh.material.map = newEnvMap; + planeMesh.material.needsUpdate = true; + } + + torusMesh.rotation.y += 0.005; + planeMesh.visible = params.debug; + + scene.background = background; + renderer.toneMappingExposure = params.exposure; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_envmaps_fasthdr.ts b/examples-testing/examples/webgl_materials_envmaps_fasthdr.ts new file mode 100644 index 000000000..f03862acf --- /dev/null +++ b/examples-testing/examples/webgl_materials_envmaps_fasthdr.ts @@ -0,0 +1,169 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; + +const params = { + image: 'ballroom', + fov: 40, + exposure: 1.0, + backgroundBlurriness: 0.0, +}; + +let container, stats; +let camera, scene, renderer, controls; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(params.fov, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.set(7, 0, 0); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + // + + const sphereGeometry = new THREE.SphereGeometry(0.45, 64, 32); + + const sphere01 = new THREE.Mesh( + sphereGeometry, + new THREE.MeshPhysicalMaterial({ + transmission: 1.0, + thickness: 2.0, + metalness: 0.0, + roughness: 0.0, + }), + ); + sphere01.position.z += 2; + scene.add(sphere01); + + const sphere02 = new THREE.Mesh( + sphereGeometry, + new THREE.MeshStandardMaterial({ + metalness: 0.0, + roughness: 1.0, + }), + ); + sphere02.position.z += 1; + scene.add(sphere02); + + const sphere03 = new THREE.Mesh( + sphereGeometry, + new THREE.MeshStandardMaterial({ + metalness: 1.0, + roughness: 0.0, + }), + ); + sphere03.position.z += 0; + scene.add(sphere03); + + const sphere04 = new THREE.Mesh( + sphereGeometry, + new THREE.MeshStandardMaterial({ + metalness: 1.0, + roughness: 0.5, + color: 0x888888, + }), + ); + sphere04.position.z -= 1; + scene.add(sphere04); + + const sphere05 = new THREE.Mesh( + sphereGeometry, + new THREE.MeshStandardMaterial({ + metalness: 0.0, + roughness: 0.0, + color: 0x6ab440, + }), + ); + sphere05.position.z -= 2; + scene.add(sphere05); + + const loader = new KTX2Loader().detectSupport(renderer); + + function loadTexture(url) { + loader.load(url, texture => { + texture.mapping = THREE.CubeUVReflectionMapping; + scene.environment = texture; + scene.background = texture; + }); + } + + loadTexture('https://cdn.needle.tools/static/hdris/ballroom_2k.pmrem.ktx2'); + + stats = new Stats(); + container.appendChild(stats.dom); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 0.1; + controls.maxDistance = 20; + controls.enableDamping = true; + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'image', { + ballroom: 'https://cdn.needle.tools/static/hdris/ballroom_2k.pmrem.ktx2', + 'brown photostudio': 'https://cdn.needle.tools/static/hdris/brown_photostudio_02_2k.pmrem.ktx2', + 'cape hill': 'https://cdn.needle.tools/static/hdris/cape_hill_2k.pmrem.ktx2', + cannon: 'https://cdn.needle.tools/static/hdris/cannon_2k.pmrem.ktx2', + 'metro noord': 'https://cdn.needle.tools/static/hdris/metro_noord_2k.pmrem.ktx2', + 'the sky is on fire': 'https://cdn.needle.tools/static/hdris/the_sky_is_on_fire_2k.pmrem.ktx2', + 'studio small 09': 'https://cdn.needle.tools/static/hdris/studio_small_09_2k.pmrem.ktx2', + 'wide street 01': 'https://cdn.needle.tools/static/hdris/wide_street_01_2k.pmrem.ktx2', + }).onChange(() => { + loadTexture(params.image); + }); + + gui.add(params, 'exposure', 0, 2, 0.01); + + gui.add(params, 'fov', 10, 100).onChange(() => { + camera.fov = params.fov; + camera.updateProjectionMatrix(); + }); + + gui.add(params, 'backgroundBlurriness', 0, 1, 0.01).name('background blurriness'); + + gui.open(); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + renderer.toneMappingExposure = params.exposure; + scene.backgroundBlurriness = params.backgroundBlurriness; + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_envmaps_groundprojected.ts b/examples-testing/examples/webgl_materials_envmaps_groundprojected.ts new file mode 100644 index 000000000..033b1dab3 --- /dev/null +++ b/examples-testing/examples/webgl_materials_envmaps_groundprojected.ts @@ -0,0 +1,151 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GroundedSkybox } from 'three/addons/objects/GroundedSkybox.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +const params = { + height: 15, + radius: 100, + enabled: true, +}; + +let camera, scene, renderer, skybox; + +init().then(render); + +async function init() { + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-20, 7, 20); + camera.lookAt(0, 4, 0); + + scene = new THREE.Scene(); + + const hdrLoader = new HDRLoader(); + const envMap = await hdrLoader.loadAsync('textures/equirectangular/blouberg_sunrise_2_1k.hdr'); + envMap.mapping = THREE.EquirectangularReflectionMapping; + + skybox = new GroundedSkybox(envMap, params.height, params.radius); + skybox.position.y = params.height - 0.01; + scene.add(skybox); + + scene.environment = envMap; + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + + const shadow = new THREE.TextureLoader().load('models/gltf/ferrari_ao.png'); + + loader.load('models/gltf/ferrari.glb', function (gltf) { + const bodyMaterial = new THREE.MeshPhysicalMaterial({ + color: 0x000000, + metalness: 1.0, + roughness: 0.8, + clearcoat: 1.0, + clearcoatRoughness: 0.2, + }); + + const detailsMaterial = new THREE.MeshStandardMaterial({ + color: 0xffffff, + metalness: 1.0, + roughness: 0.5, + }); + + const glassMaterial = new THREE.MeshPhysicalMaterial({ + color: 0xffffff, + metalness: 0.25, + roughness: 0, + transmission: 1.0, + }); + + const carModel = gltf.scene.children[0]; + carModel.scale.multiplyScalar(4); + carModel.rotation.y = Math.PI; + + carModel.getObjectByName('body').material = bodyMaterial; + + carModel.getObjectByName('rim_fl').material = detailsMaterial; + carModel.getObjectByName('rim_fr').material = detailsMaterial; + carModel.getObjectByName('rim_rr').material = detailsMaterial; + carModel.getObjectByName('rim_rl').material = detailsMaterial; + carModel.getObjectByName('trim').material = detailsMaterial; + + carModel.getObjectByName('glass').material = glassMaterial; + + // shadow + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(0.655 * 4, 1.3 * 4), + new THREE.MeshBasicMaterial({ + map: shadow, + blending: THREE.MultiplyBlending, + toneMapped: false, + transparent: true, + premultipliedAlpha: true, + }), + ); + mesh.rotation.x = -Math.PI / 2; + carModel.add(mesh); + + scene.add(carModel); + + render(); + }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.target.set(0, 2, 0); + controls.maxPolarAngle = THREE.MathUtils.degToRad(90); + controls.maxDistance = 80; + controls.minDistance = 20; + controls.enablePan = false; + controls.update(); + + document.body.appendChild(renderer.domElement); + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'enabled') + .name('Grounded') + .onChange(function (value) { + if (value) { + scene.add(skybox); + scene.background = null; + } else { + scene.remove(skybox); + scene.background = scene.environment; + } + + render(); + }); + + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_envmaps_hdr.ts b/examples-testing/examples/webgl_materials_envmaps_hdr.ts new file mode 100644 index 000000000..2dc2b808a --- /dev/null +++ b/examples-testing/examples/webgl_materials_envmaps_hdr.ts @@ -0,0 +1,163 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; +import { DebugEnvironment } from 'three/addons/environments/DebugEnvironment.js'; + +const params = { + envMap: 'HDR', + roughness: 0.0, + metalness: 0.0, + exposure: 1.0, + debug: false, +}; + +let container, stats; +let camera, scene, renderer, controls; +let torusMesh, planeMesh; +let generatedCubeRenderTarget, ldrCubeRenderTarget, hdrCubeRenderTarget; +let ldrCubeMap, hdrCubeMap; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 120); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + renderer = new THREE.WebGLRenderer(); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + // + + let geometry = new THREE.TorusKnotGeometry(18, 8, 150, 20); + // let geometry = new THREE.SphereGeometry( 26, 64, 32 ); + let material = new THREE.MeshStandardMaterial({ + color: 0xffffff, + metalness: params.metalness, + roughness: params.roughness, + }); + + torusMesh = new THREE.Mesh(geometry, material); + scene.add(torusMesh); + + geometry = new THREE.PlaneGeometry(200, 200); + material = new THREE.MeshBasicMaterial(); + + planeMesh = new THREE.Mesh(geometry, material); + planeMesh.position.y = -50; + planeMesh.rotation.x = -Math.PI * 0.5; + scene.add(planeMesh); + + THREE.DefaultLoadingManager.onLoad = function () { + pmremGenerator.dispose(); + }; + + const hdrUrls = ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']; + hdrCubeMap = new HDRCubeTextureLoader().setPath('./textures/cube/pisaHDR/').load(hdrUrls, function () { + hdrCubeRenderTarget = pmremGenerator.fromCubemap(hdrCubeMap); + + hdrCubeMap.magFilter = THREE.LinearFilter; + hdrCubeMap.needsUpdate = true; + }); + + const ldrUrls = ['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']; + ldrCubeMap = new THREE.CubeTextureLoader().setPath('./textures/cube/pisa/').load(ldrUrls, function () { + ldrCubeRenderTarget = pmremGenerator.fromCubemap(ldrCubeMap); + }); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + pmremGenerator.compileCubemapShader(); + + const envScene = new DebugEnvironment(); + generatedCubeRenderTarget = pmremGenerator.fromScene(envScene); + + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + //renderer.toneMapping = ReinhardToneMapping; + + stats = new Stats(); + container.appendChild(stats.dom); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 50; + controls.maxDistance = 300; + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + gui.add(params, 'envMap', ['Generated', 'LDR', 'HDR']); + gui.add(params, 'roughness', 0, 1, 0.01); + gui.add(params, 'metalness', 0, 1, 0.01); + gui.add(params, 'exposure', 0, 2, 0.01); + gui.add(params, 'debug'); + gui.open(); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + torusMesh.material.roughness = params.roughness; + torusMesh.material.metalness = params.metalness; + + let renderTarget, cubeMap; + + switch (params.envMap) { + case 'Generated': + renderTarget = generatedCubeRenderTarget; + cubeMap = generatedCubeRenderTarget.texture; + break; + case 'LDR': + renderTarget = ldrCubeRenderTarget; + cubeMap = ldrCubeMap; + break; + case 'HDR': + renderTarget = hdrCubeRenderTarget; + cubeMap = hdrCubeMap; + break; + } + + const newEnvMap = renderTarget ? renderTarget.texture : null; + + if (newEnvMap && newEnvMap !== torusMesh.material.envMap) { + torusMesh.material.envMap = newEnvMap; + torusMesh.material.needsUpdate = true; + + planeMesh.material.map = newEnvMap; + planeMesh.material.needsUpdate = true; + } + + torusMesh.rotation.y += 0.005; + planeMesh.visible = params.debug; + + scene.background = cubeMap; + renderer.toneMappingExposure = params.exposure; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_modified.ts b/examples-testing/examples/webgl_materials_modified.ts new file mode 100644 index 000000000..de36aeb7d --- /dev/null +++ b/examples-testing/examples/webgl_materials_modified.ts @@ -0,0 +1,115 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer, stats; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 20; + + scene = new THREE.Scene(); + + const loader = new GLTFLoader(); + loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + const geometry = gltf.scene.children[0].geometry; + + let mesh = new THREE.Mesh(geometry, buildTwistMaterial(2.0)); + mesh.position.x = -3.5; + mesh.position.y = -0.5; + scene.add(mesh); + + mesh = new THREE.Mesh(geometry, buildTwistMaterial(-2.0)); + mesh.position.x = 3.5; + mesh.position.y = -0.5; + scene.add(mesh); + }); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 10; + controls.maxDistance = 50; + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // EVENTS + + window.addEventListener('resize', onWindowResize); +} + +function buildTwistMaterial(amount) { + const material = new THREE.MeshNormalMaterial(); + material.onBeforeCompile = function (shader) { + shader.uniforms.time = { value: 0 }; + + shader.vertexShader = 'uniform float time;\n' + shader.vertexShader; + shader.vertexShader = shader.vertexShader.replace( + '#include ', + [ + `float theta = sin( time + position.y ) / ${amount.toFixed(1)};`, + 'float c = cos( theta );', + 'float s = sin( theta );', + 'mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );', + 'vec3 transformed = vec3( position ) * m;', + 'vNormal = vNormal * m;', + ].join('\n'), + ); + + material.userData.shader = shader; + }; + + // Make sure WebGLRenderer doesn't reuse a single program + + material.customProgramCacheKey = function () { + return amount.toFixed(1); + }; + + return material; +} + +// + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +// + +function animate() { + render(); + + stats.update(); +} + +function render() { + scene.traverse(function (child) { + if (child.isMesh) { + const shader = child.material.userData.shader; + + if (shader) { + shader.uniforms.time.value = performance.now() / 1000; + } + } + }); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_normalmap_object_space.ts b/examples-testing/examples/webgl_materials_normalmap_object_space.ts new file mode 100644 index 000000000..1fc6f8066 --- /dev/null +++ b/examples-testing/examples/webgl_materials_normalmap_object_space.ts @@ -0,0 +1,82 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let renderer, scene, camera; + +init(); + +function init() { + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-10, 0, 23); + scene.add(camera); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.minDistance = 10; + controls.maxDistance = 50; + controls.enablePan = false; + + // ambient + scene.add(new THREE.AmbientLight(0xffffff, 0.6)); + + // light + const light = new THREE.PointLight(0xffffff, 4.5, 0, 0); + camera.add(light); + + // model + new GLTFLoader().load('models/gltf/Nefertiti/Nefertiti.glb', function (gltf) { + gltf.scene.traverse(function (child) { + if (child.isMesh) { + // glTF currently supports only tangent-space normal maps. + // this model has been modified to demonstrate the use of an object-space normal map. + + child.material.normalMapType = THREE.ObjectSpaceNormalMap; + + // attribute normals are not required with an object-space normal map. remove them. + + child.geometry.deleteAttribute('normal'); + + // + + child.material.side = THREE.DoubleSide; + + child.scale.multiplyScalar(0.5); + + // recenter + + new THREE.Box3().setFromObject(child).getCenter(child.position).multiplyScalar(-1); + + scene.add(child); + } + }); + + render(); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_physical_clearcoat.ts b/examples-testing/examples/webgl_materials_physical_clearcoat.ts new file mode 100644 index 000000000..408fd9921 --- /dev/null +++ b/examples-testing/examples/webgl_materials_physical_clearcoat.ts @@ -0,0 +1,208 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; + +import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; + +let container, stats; + +let camera, scene, renderer; + +let particleLight; +let group; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.25, 50); + camera.position.z = 10; + + scene = new THREE.Scene(); + + group = new THREE.Group(); + scene.add(group); + + new HDRCubeTextureLoader() + .setPath('textures/cube/pisaHDR/') + .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (texture) { + const geometry = new THREE.SphereGeometry(0.8, 64, 32); + + const textureLoader = new THREE.TextureLoader(); + + const diffuse = textureLoader.load('textures/carbon/Carbon.png'); + diffuse.colorSpace = THREE.SRGBColorSpace; + diffuse.wrapS = THREE.RepeatWrapping; + diffuse.wrapT = THREE.RepeatWrapping; + diffuse.repeat.x = 10; + diffuse.repeat.y = 10; + + const normalMap = textureLoader.load('textures/carbon/Carbon_Normal.png'); + normalMap.wrapS = THREE.RepeatWrapping; + normalMap.wrapT = THREE.RepeatWrapping; + normalMap.repeat.x = 10; + normalMap.repeat.y = 10; + + const normalMap2 = textureLoader.load('textures/water/Water_1_M_Normal.jpg'); + + const normalMap3 = new THREE.CanvasTexture(new FlakesTexture()); + normalMap3.wrapS = THREE.RepeatWrapping; + normalMap3.wrapT = THREE.RepeatWrapping; + normalMap3.repeat.x = 10; + normalMap3.repeat.y = 6; + normalMap3.anisotropy = 16; + + const normalMap4 = textureLoader.load('textures/golfball.jpg'); + + const clearcoatNormalMap = textureLoader.load( + 'textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png', + ); + + // car paint + + let material = new THREE.MeshPhysicalMaterial({ + clearcoat: 1.0, + clearcoatRoughness: 0.1, + metalness: 0.9, + roughness: 0.5, + color: 0x0000ff, + normalMap: normalMap3, + normalScale: new THREE.Vector2(0.15, 0.15), + }); + + let mesh = new THREE.Mesh(geometry, material); + mesh.position.x = -1; + mesh.position.y = 1; + group.add(mesh); + + // fibers + + material = new THREE.MeshPhysicalMaterial({ + roughness: 0.5, + clearcoat: 1.0, + clearcoatRoughness: 0.1, + map: diffuse, + normalMap: normalMap, + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = 1; + mesh.position.y = 1; + group.add(mesh); + + // golf + + material = new THREE.MeshPhysicalMaterial({ + metalness: 0.0, + roughness: 0.1, + clearcoat: 1.0, + normalMap: normalMap4, + clearcoatNormalMap: clearcoatNormalMap, + + // y scale is negated to compensate for normal map handedness. + clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = -1; + mesh.position.y = -1; + group.add(mesh); + + // clearcoat + normalmap + + material = new THREE.MeshPhysicalMaterial({ + clearcoat: 1.0, + metalness: 1.0, + color: 0xff0000, + normalMap: normalMap2, + normalScale: new THREE.Vector2(0.15, 0.15), + clearcoatNormalMap: clearcoatNormalMap, + + // y scale is negated to compensate for normal map handedness. + clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = 1; + mesh.position.y = -1; + group.add(mesh); + + // + + scene.background = texture; + scene.environment = texture; + }); + + // LIGHTS + + particleLight = new THREE.Mesh( + new THREE.SphereGeometry(0.05, 8, 8), + new THREE.MeshBasicMaterial({ color: 0xffffff }), + ); + scene.add(particleLight); + + particleLight.add(new THREE.PointLight(0xffffff, 30)); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.25; + + // + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // EVENTS + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 3; + controls.maxDistance = 30; + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +// + +function animate() { + render(); + + stats.update(); +} + +function render() { + const timer = Date.now() * 0.00025; + + particleLight.position.x = Math.sin(timer * 7) * 3; + particleLight.position.y = Math.cos(timer * 5) * 4; + particleLight.position.z = Math.cos(timer * 3) * 3; + + for (let i = 0; i < group.children.length; i++) { + const child = group.children[i]; + child.rotation.y += 0.005; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_physical_transmission.ts b/examples-testing/examples/webgl_materials_physical_transmission.ts new file mode 100644 index 000000000..08ee08cac --- /dev/null +++ b/examples-testing/examples/webgl_materials_physical_transmission.ts @@ -0,0 +1,192 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +const params = { + color: 0xffffff, + transmission: 1, + opacity: 1, + metalness: 0, + roughness: 0, + ior: 1.5, + thickness: 0.01, + specularIntensity: 1, + specularColor: 0xffffff, + envMapIntensity: 1, + lightIntensity: 1, + exposure: 1, + transmissionResolutionScale: 1, +}; + +let camera, scene, renderer; + +let mesh; + +const hdrEquirect = new UltraHDRLoader() + .setPath('textures/equirectangular/') + .load('royal_esplanade_2k.hdr.jpg', function () { + hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; + + init(); + render(); + }); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = params.exposure; + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(0, 0, 120); + + // + + scene.background = hdrEquirect; + + // + + const geometry = new THREE.SphereGeometry(20, 64, 32); + + const texture = new THREE.CanvasTexture(generateTexture()); + texture.magFilter = THREE.NearestFilter; + texture.wrapT = THREE.RepeatWrapping; + texture.wrapS = THREE.RepeatWrapping; + texture.repeat.set(1, 3.5); + + const material = new THREE.MeshPhysicalMaterial({ + color: params.color, + metalness: params.metalness, + roughness: params.roughness, + ior: params.ior, + alphaMap: texture, + envMap: hdrEquirect, + envMapIntensity: params.envMapIntensity, + transmission: params.transmission, // use material.transmission for glass materials + specularIntensity: params.specularIntensity, + specularColor: params.specularColor, + opacity: params.opacity, + side: THREE.DoubleSide, + transparent: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 10; + controls.maxDistance = 150; + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + + gui.addColor(params, 'color').onChange(function () { + material.color.set(params.color); + render(); + }); + + gui.add(params, 'transmission', 0, 1, 0.01).onChange(function () { + material.transmission = params.transmission; + render(); + }); + + gui.add(params, 'opacity', 0, 1, 0.01).onChange(function () { + material.opacity = params.opacity; + render(); + }); + + gui.add(params, 'metalness', 0, 1, 0.01).onChange(function () { + material.metalness = params.metalness; + render(); + }); + + gui.add(params, 'roughness', 0, 1, 0.01).onChange(function () { + material.roughness = params.roughness; + render(); + }); + + gui.add(params, 'ior', 1, 2, 0.01).onChange(function () { + material.ior = params.ior; + render(); + }); + + gui.add(params, 'thickness', 0, 5, 0.01).onChange(function () { + material.thickness = params.thickness; + render(); + }); + + gui.add(params, 'specularIntensity', 0, 1, 0.01).onChange(function () { + material.specularIntensity = params.specularIntensity; + render(); + }); + + gui.addColor(params, 'specularColor').onChange(function () { + material.specularColor.set(params.specularColor); + render(); + }); + + gui.add(params, 'envMapIntensity', 0, 1, 0.01) + .name('envMap intensity') + .onChange(function () { + material.envMapIntensity = params.envMapIntensity; + render(); + }); + + gui.add(params, 'exposure', 0, 1, 0.01).onChange(function () { + renderer.toneMappingExposure = params.exposure; + render(); + }); + + gui.add(params, 'transmissionResolutionScale', 0.01, 1, 0.01) + .name('transmission resolution') + .onChange(function () { + renderer.transmissionResolutionScale = params.transmissionResolutionScale; + render(); + }); + + gui.open(); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + + render(); +} + +// + +function generateTexture() { + const canvas = document.createElement('canvas'); + canvas.width = 2; + canvas.height = 2; + + const context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 1, 2, 1); + + return canvas; +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_physical_transmission_alpha.ts b/examples-testing/examples/webgl_materials_physical_transmission_alpha.ts new file mode 100644 index 000000000..6318d7844 --- /dev/null +++ b/examples-testing/examples/webgl_materials_physical_transmission_alpha.ts @@ -0,0 +1,194 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +const params = { + color: 0xffffff, + transmission: 1, + opacity: 1, + metalness: 0, + roughness: 0, + ior: 1.5, + thickness: 0.01, + attenuationColor: 0xffffff, + attenuationDistance: 1, + specularIntensity: 1, + specularColor: 0xffffff, + envMapIntensity: 1, + lightIntensity: 1, + exposure: 1, +}; + +let camera, scene, renderer; + +let mesh, material; + +const hdrEquirect = new UltraHDRLoader() + .setPath('textures/equirectangular/') + .load('royal_esplanade_2k.hdr.jpg', function () { + hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; + + new GLTFLoader().setPath('models/gltf/').load('DragonAttenuation.glb', function (gltf) { + gltf.scene.traverse(function (child) { + if (child.isMesh && child.material.isMeshPhysicalMaterial) { + mesh = child; + material = mesh.material; + + const color = new THREE.Color(); + + params.color = color.copy(mesh.material.color).getHex(); + params.roughness = mesh.material.roughness; + params.metalness = mesh.material.metalness; + + params.ior = mesh.material.ior; + params.specularIntensity = mesh.material.specularIntensity; + + params.transmission = mesh.material.transmission; + params.thickness = mesh.material.thickness; + params.attenuationColor = color.copy(mesh.material.attenuationColor).getHex(); + params.attenuationDistance = mesh.material.attenuationDistance; + } + }); + + init(); + + scene.add(gltf.scene); + + scene.environment = hdrEquirect; + //scene.background = hdrEquirect; + + render(); + }); + }); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = params.exposure; + + // accommodate CSS table + renderer.domElement.style.position = 'absolute'; + renderer.domElement.style.top = 0; + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(-5, 0.5, 0); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 5; + controls.maxDistance = 20; + controls.target.y = 0.5; + controls.update(); + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + + gui.addColor(params, 'color').onChange(function () { + material.color.set(params.color); + render(); + }); + + gui.add(params, 'transmission', 0, 1, 0.01).onChange(function () { + material.transmission = params.transmission; + render(); + }); + + gui.add(params, 'opacity', 0, 1, 0.01).onChange(function () { + material.opacity = params.opacity; + const transparent = params.opacity < 1; + + if (transparent !== material.transparent) { + material.transparent = transparent; + material.needsUpdate = true; + } + + render(); + }); + + gui.add(params, 'metalness', 0, 1, 0.01).onChange(function () { + material.metalness = params.metalness; + render(); + }); + + gui.add(params, 'roughness', 0, 1, 0.01).onChange(function () { + material.roughness = params.roughness; + render(); + }); + + gui.add(params, 'ior', 1, 2, 0.01).onChange(function () { + material.ior = params.ior; + render(); + }); + + gui.add(params, 'thickness', 0, 5, 0.01).onChange(function () { + material.thickness = params.thickness; + render(); + }); + + gui.addColor(params, 'attenuationColor') + .name('attenuation color') + .onChange(function () { + material.attenuationColor.set(params.attenuationColor); + render(); + }); + + gui.add(params, 'attenuationDistance', 0, 1, 0.01).onChange(function () { + material.attenuationDistance = params.attenuationDistance; + render(); + }); + + gui.add(params, 'specularIntensity', 0, 1, 0.01).onChange(function () { + material.specularIntensity = params.specularIntensity; + render(); + }); + + gui.addColor(params, 'specularColor').onChange(function () { + material.specularColor.set(params.specularColor); + render(); + }); + + gui.add(params, 'envMapIntensity', 0, 1, 0.01) + .name('envMap intensity') + .onChange(function () { + material.envMapIntensity = params.envMapIntensity; + render(); + }); + + gui.add(params, 'exposure', 0, 1, 0.01).onChange(function () { + renderer.toneMappingExposure = params.exposure; + render(); + }); + + gui.open(); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + + render(); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_texture_anisotropy.ts b/examples-testing/examples/webgl_materials_texture_anisotropy.ts new file mode 100644 index 000000000..1e030d64d --- /dev/null +++ b/examples-testing/examples/webgl_materials_texture_anisotropy.ts @@ -0,0 +1,143 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +const SCREEN_WIDTH = window.innerWidth; +const SCREEN_HEIGHT = window.innerHeight; + +let container, stats; + +let camera, scene1, scene2, renderer; + +let mouseX = 0, + mouseY = 0; + +const windowHalfX = window.innerWidth / 2; +const windowHalfY = window.innerHeight / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + + // + + camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 25000); + camera.position.z = 1500; + + scene1 = new THREE.Scene(); + scene1.background = new THREE.Color(0xf2f7ff); + scene1.fog = new THREE.Fog(0xf2f7ff, 1, 25000); + + scene2 = new THREE.Scene(); + scene2.background = new THREE.Color(0xf2f7ff); + scene2.fog = new THREE.Fog(0xf2f7ff, 1, 25000); + + scene1.add(new THREE.AmbientLight(0xeef0ff, 3)); + scene2.add(new THREE.AmbientLight(0xeef0ff, 3)); + + const light1 = new THREE.DirectionalLight(0xffffff, 6); + light1.position.set(1, 1, 1); + scene1.add(light1); + + const light2 = new THREE.DirectionalLight(0xffffff, 6); + light2.position.set(1, 1, 1); + scene2.add(light2); + + // GROUND + + const textureLoader = new THREE.TextureLoader(); + + const maxAnisotropy = renderer.capabilities.getMaxAnisotropy(); + + const texture1 = textureLoader.load('textures/crate.gif'); + const material1 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture1 }); + + texture1.colorSpace = THREE.SRGBColorSpace; + texture1.anisotropy = maxAnisotropy; + texture1.wrapS = texture1.wrapT = THREE.RepeatWrapping; + texture1.repeat.set(512, 512); + + const texture2 = textureLoader.load('textures/crate.gif'); + const material2 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture2 }); + + texture2.colorSpace = THREE.SRGBColorSpace; + texture2.anisotropy = 1; + texture2.wrapS = texture2.wrapT = THREE.RepeatWrapping; + texture2.repeat.set(512, 512); + + if (maxAnisotropy > 0) { + document.getElementById('val_left').innerHTML = texture1.anisotropy; + document.getElementById('val_right').innerHTML = texture2.anisotropy; + } else { + document.getElementById('val_left').innerHTML = 'not supported'; + document.getElementById('val_right').innerHTML = 'not supported'; + } + + // + + const geometry = new THREE.PlaneGeometry(100, 100); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.rotation.x = -Math.PI / 2; + mesh1.scale.set(1000, 1000, 1000); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.rotation.x = -Math.PI / 2; + mesh2.scale.set(1000, 1000, 1000); + + scene1.add(mesh1); + scene2.add(mesh2); + + // RENDERER + + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + + renderer.domElement.style.position = 'relative'; + container.appendChild(renderer.domElement); + + // STATS1 + + stats = new Stats(); + container.appendChild(stats.dom); + + document.addEventListener('mousemove', onDocumentMouseMove); +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +function animate() { + render(); + stats.update(); +} + +function render() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y = THREE.MathUtils.clamp( + camera.position.y + (-(mouseY - 200) - camera.position.y) * 0.05, + 50, + 1000, + ); + + camera.lookAt(scene1.position); + + renderer.clear(); + renderer.setScissorTest(true); + + renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene1, camera); + + renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene2, camera); + + renderer.setScissorTest(false); +} diff --git a/examples-testing/examples/webgl_materials_texture_canvas.ts b/examples-testing/examples/webgl_materials_texture_canvas.ts new file mode 100644 index 000000000..d23c68436 --- /dev/null +++ b/examples-testing/examples/webgl_materials_texture_canvas.ts @@ -0,0 +1,92 @@ +import * as THREE from 'three'; + +let camera, scene, renderer, mesh, material; +const drawStartPos = new THREE.Vector2(); + +init(); +setupCanvasDrawing(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.z = 500; + + scene = new THREE.Scene(); + + material = new THREE.MeshBasicMaterial(); + + mesh = new THREE.Mesh(new THREE.BoxGeometry(200, 200, 200), material); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +// Sets up the drawing canvas and adds it as the material map + +function setupCanvasDrawing() { + // get canvas and context + + const drawingCanvas = document.getElementById('drawing-canvas'); + const drawingContext = drawingCanvas.getContext('2d'); + + // draw white background + + drawingContext.fillStyle = '#FFFFFF'; + drawingContext.fillRect(0, 0, 128, 128); + + // set canvas as material.map (this could be done to any map, bump, displacement etc.) + + material.map = new THREE.CanvasTexture(drawingCanvas); + + // set the variable to keep track of when to draw + + let paint = false; + + // add canvas event listeners + drawingCanvas.addEventListener('pointerdown', function (e) { + paint = true; + drawStartPos.set(e.offsetX, e.offsetY); + }); + + drawingCanvas.addEventListener('pointermove', function (e) { + if (paint) draw(drawingContext, e.offsetX, e.offsetY); + }); + + drawingCanvas.addEventListener('pointerup', function () { + paint = false; + }); + + drawingCanvas.addEventListener('pointerleave', function () { + paint = false; + }); +} + +function draw(drawContext, x, y) { + drawContext.moveTo(drawStartPos.x, drawStartPos.y); + drawContext.strokeStyle = '#000000'; + drawContext.lineTo(x, y); + drawContext.stroke(); + // reset drawing start position to current position. + drawStartPos.set(x, y); + // need to flag the map as needing updating. + material.map.needsUpdate = true; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.rotation.x += 0.01; + mesh.rotation.y += 0.01; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_texture_filters.ts b/examples-testing/examples/webgl_materials_texture_filters.ts new file mode 100644 index 000000000..77b254684 --- /dev/null +++ b/examples-testing/examples/webgl_materials_texture_filters.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three'; + +const SCREEN_WIDTH = window.innerWidth; +const SCREEN_HEIGHT = window.innerHeight; + +let container; + +let camera, scene, scene2, renderer; + +let mouseX = 0, + mouseY = 0; + +const windowHalfX = window.innerWidth / 2; +const windowHalfY = window.innerHeight / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000); + camera.position.z = 1500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + scene.fog = new THREE.Fog(0x000000, 1500, 4000); + + scene2 = new THREE.Scene(); + scene2.background = new THREE.Color(0x000000); + scene2.fog = new THREE.Fog(0x000000, 1500, 4000); + + // GROUND + + const imageCanvas = document.createElement('canvas'); + const context = imageCanvas.getContext('2d'); + + imageCanvas.width = imageCanvas.height = 128; + + context.fillStyle = '#444'; + context.fillRect(0, 0, 128, 128); + + context.fillStyle = '#fff'; + context.fillRect(0, 0, 64, 64); + context.fillRect(64, 64, 64, 64); + + const textureCanvas = new THREE.CanvasTexture(imageCanvas); + textureCanvas.colorSpace = THREE.SRGBColorSpace; + textureCanvas.repeat.set(1000, 1000); + textureCanvas.wrapS = THREE.RepeatWrapping; + textureCanvas.wrapT = THREE.RepeatWrapping; + + const textureCanvas2 = textureCanvas.clone(); + textureCanvas2.magFilter = THREE.NearestFilter; + textureCanvas2.minFilter = THREE.NearestFilter; + textureCanvas2.generateMipmaps = false; + + const materialCanvas = new THREE.MeshBasicMaterial({ map: textureCanvas }); + const materialCanvas2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: textureCanvas2 }); + + const geometry = new THREE.PlaneGeometry(100, 100); + + const meshCanvas = new THREE.Mesh(geometry, materialCanvas); + meshCanvas.rotation.x = -Math.PI / 2; + meshCanvas.scale.set(1000, 1000, 1000); + + const meshCanvas2 = new THREE.Mesh(geometry, materialCanvas2); + meshCanvas2.rotation.x = -Math.PI / 2; + meshCanvas2.scale.set(1000, 1000, 1000); + + // PAINTING + + const callbackPainting = function () { + const image = texturePainting.image; + + texturePainting2.image = image; + texturePainting2.needsUpdate = true; + + scene.add(meshCanvas); + scene2.add(meshCanvas2); + + const geometry = new THREE.PlaneGeometry(100, 100); + const mesh = new THREE.Mesh(geometry, materialPainting); + const mesh2 = new THREE.Mesh(geometry, materialPainting2); + + addPainting(scene, mesh); + addPainting(scene2, mesh2); + + function addPainting(zscene, zmesh) { + zmesh.scale.x = image.width / 100; + zmesh.scale.y = image.height / 100; + + zscene.add(zmesh); + + const meshFrame = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000 })); + meshFrame.position.z = -10.0; + meshFrame.scale.x = (1.1 * image.width) / 100; + meshFrame.scale.y = (1.1 * image.height) / 100; + zscene.add(meshFrame); + + const meshShadow = new THREE.Mesh( + geometry, + new THREE.MeshBasicMaterial({ color: 0x000000, opacity: 0.75, transparent: true }), + ); + meshShadow.position.y = (-1.1 * image.height) / 2; + meshShadow.position.z = (-1.1 * image.height) / 2; + meshShadow.rotation.x = -Math.PI / 2; + meshShadow.scale.x = (1.1 * image.width) / 100; + meshShadow.scale.y = (1.1 * image.height) / 100; + zscene.add(meshShadow); + + const floorHeight = (-1.117 * image.height) / 2; + meshCanvas.position.y = meshCanvas2.position.y = floorHeight; + } + }; + + const texturePainting = new THREE.TextureLoader().load( + 'textures/758px-Canestra_di_frutta_(Caravaggio).jpg', + callbackPainting, + ); + const texturePainting2 = new THREE.Texture(); + + const materialPainting = new THREE.MeshBasicMaterial({ color: 0xffffff, map: texturePainting }); + const materialPainting2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: texturePainting2 }); + + texturePainting.colorSpace = THREE.SRGBColorSpace; + texturePainting2.colorSpace = THREE.SRGBColorSpace; + texturePainting2.minFilter = texturePainting2.magFilter = THREE.NearestFilter; + texturePainting.minFilter = texturePainting.magFilter = THREE.LinearFilter; + texturePainting.mapping = THREE.UVMapping; + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + + renderer.domElement.style.position = 'relative'; + container.appendChild(renderer.domElement); + + document.addEventListener('mousemove', onDocumentMouseMove); +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +function animate() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-(mouseY - 200) - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + renderer.clear(); + renderer.setScissorTest(true); + + renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene, camera); + + renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene2, camera); + + renderer.setScissorTest(false); +} diff --git a/examples-testing/examples/webgl_materials_texture_html.ts b/examples-testing/examples/webgl_materials_texture_html.ts new file mode 100644 index 000000000..c6c264e0f --- /dev/null +++ b/examples-testing/examples/webgl_materials_texture_html.ts @@ -0,0 +1,94 @@ +import * as THREE from 'three'; +import { installHtmlInCanvasPolyfill } from 'three-html-render/polyfill'; +import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { InteractionManager } from 'three/addons/interaction/InteractionManager.js'; + +if (!('requestPaint' in HTMLCanvasElement.prototype)) { + installHtmlInCanvasPolyfill(); + info.innerHTML += + '
HTML-in-Canvas API not available. Using polyfill.'; +} + +let camera, scene, renderer, mesh, interactions; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.z = 500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xaaaaaa); + scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.02).texture; + + // HTML element + + const element = document.createElement('div'); + element.id = 'draw_element'; + element.innerHTML = ` + Hello world!
I'm multi-line, formatted, + rotated text with emoji (😀), RTL text + من فارسی صحبت میکنم, + vertical text, +

+ 这是垂直文本 +

+ an inline image (), and + + + + SVG + + ! +
+ + + `; + + const geometry = new RoundedBoxGeometry(200, 200, 200, 10, 10); + + const material = new THREE.MeshStandardMaterial({ roughness: 0, metalness: 0.5 }); + material.map = new THREE.HTMLTexture(element); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // Interaction + + interactions = new InteractionManager(); + interactions.connect(renderer, camera); + interactions.add(mesh); + + // Button click handler + + element.querySelector('button').addEventListener('click', function () { + this.textContent = 'Clicked!'; + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(time) { + mesh.rotation.x = Math.sin(time * 0.0005) * 0.5; + mesh.rotation.y = Math.cos(time * 0.0008) * 0.5; + + interactions.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_texture_manualmipmap.ts b/examples-testing/examples/webgl_materials_texture_manualmipmap.ts new file mode 100644 index 000000000..24bd4eb9f --- /dev/null +++ b/examples-testing/examples/webgl_materials_texture_manualmipmap.ts @@ -0,0 +1,175 @@ +import * as THREE from 'three'; + +const SCREEN_WIDTH = window.innerWidth; +const SCREEN_HEIGHT = window.innerHeight; + +let container; + +let camera, scene1, scene2, renderer; + +let mouseX = 0, + mouseY = 0; + +const windowHalfX = window.innerWidth / 2; +const windowHalfY = window.innerHeight / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000); + camera.position.z = 1500; + + scene1 = new THREE.Scene(); + scene1.background = new THREE.Color(0x000000); + scene1.fog = new THREE.Fog(0x000000, 1500, 4000); + + scene2 = new THREE.Scene(); + scene2.background = new THREE.Color(0x000000); + scene2.fog = new THREE.Fog(0x000000, 1500, 4000); + + // GROUND + + function mipmap(size, color) { + const imageCanvas = document.createElement('canvas'); + const context = imageCanvas.getContext('2d'); + + imageCanvas.width = imageCanvas.height = size; + + context.fillStyle = '#444'; + context.fillRect(0, 0, size, size); + + context.fillStyle = color; + context.fillRect(0, 0, size / 2, size / 2); + context.fillRect(size / 2, size / 2, size / 2, size / 2); + return imageCanvas; + } + + const canvas = mipmap(128, '#f00'); + const textureCanvas1 = new THREE.CanvasTexture(canvas); + textureCanvas1.mipmaps[0] = canvas; + textureCanvas1.mipmaps[1] = mipmap(64, '#0f0'); + textureCanvas1.mipmaps[2] = mipmap(32, '#00f'); + textureCanvas1.mipmaps[3] = mipmap(16, '#400'); + textureCanvas1.mipmaps[4] = mipmap(8, '#040'); + textureCanvas1.mipmaps[5] = mipmap(4, '#004'); + textureCanvas1.mipmaps[6] = mipmap(2, '#044'); + textureCanvas1.mipmaps[7] = mipmap(1, '#404'); + textureCanvas1.colorSpace = THREE.SRGBColorSpace; + textureCanvas1.repeat.set(1000, 1000); + textureCanvas1.wrapS = THREE.RepeatWrapping; + textureCanvas1.wrapT = THREE.RepeatWrapping; + + const textureCanvas2 = textureCanvas1.clone(); + textureCanvas2.magFilter = THREE.NearestFilter; + textureCanvas2.minFilter = THREE.NearestMipmapNearestFilter; + + const materialCanvas1 = new THREE.MeshBasicMaterial({ map: textureCanvas1 }); + const materialCanvas2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: textureCanvas2 }); + + const geometry = new THREE.PlaneGeometry(100, 100); + + const meshCanvas1 = new THREE.Mesh(geometry, materialCanvas1); + meshCanvas1.rotation.x = -Math.PI / 2; + meshCanvas1.scale.set(1000, 1000, 1000); + + const meshCanvas2 = new THREE.Mesh(geometry, materialCanvas2); + meshCanvas2.rotation.x = -Math.PI / 2; + meshCanvas2.scale.set(1000, 1000, 1000); + + // PAINTING + + const callbackPainting = function () { + const image = texturePainting1.image; + + texturePainting2.image = image; + texturePainting2.needsUpdate = true; + + scene1.add(meshCanvas1); + scene2.add(meshCanvas2); + + const geometry = new THREE.PlaneGeometry(100, 100); + const mesh1 = new THREE.Mesh(geometry, materialPainting1); + const mesh2 = new THREE.Mesh(geometry, materialPainting2); + + addPainting(scene1, mesh1); + addPainting(scene2, mesh2); + + function addPainting(zscene, zmesh) { + zmesh.scale.x = image.width / 100; + zmesh.scale.y = image.height / 100; + + zscene.add(zmesh); + + const meshFrame = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000 })); + meshFrame.position.z = -10.0; + meshFrame.scale.x = (1.1 * image.width) / 100; + meshFrame.scale.y = (1.1 * image.height) / 100; + zscene.add(meshFrame); + + const meshShadow = new THREE.Mesh( + geometry, + new THREE.MeshBasicMaterial({ color: 0x000000, opacity: 0.75, transparent: true }), + ); + meshShadow.position.y = (-1.1 * image.height) / 2; + meshShadow.position.z = (-1.1 * image.height) / 2; + meshShadow.rotation.x = -Math.PI / 2; + meshShadow.scale.x = (1.1 * image.width) / 100; + meshShadow.scale.y = (1.1 * image.height) / 100; + zscene.add(meshShadow); + + const floorHeight = (-1.117 * image.height) / 2; + meshCanvas1.position.y = meshCanvas2.position.y = floorHeight; + } + }; + + const texturePainting1 = new THREE.TextureLoader().load( + 'textures/758px-Canestra_di_frutta_(Caravaggio).jpg', + callbackPainting, + ); + const texturePainting2 = new THREE.Texture(); + const materialPainting1 = new THREE.MeshBasicMaterial({ color: 0xffffff, map: texturePainting1 }); + const materialPainting2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: texturePainting2 }); + + texturePainting1.colorSpace = THREE.SRGBColorSpace; + texturePainting2.colorSpace = THREE.SRGBColorSpace; + texturePainting2.minFilter = texturePainting2.magFilter = THREE.NearestFilter; + texturePainting1.minFilter = texturePainting1.magFilter = THREE.LinearFilter; + texturePainting1.mapping = THREE.UVMapping; + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + + renderer.domElement.style.position = 'relative'; + container.appendChild(renderer.domElement); + + document.addEventListener('mousemove', onDocumentMouseMove); +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +function animate() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-(mouseY - 200) - camera.position.y) * 0.05; + + camera.lookAt(scene1.position); + + renderer.clear(); + renderer.setScissorTest(true); + + renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene1, camera); + + renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene2, camera); + + renderer.setScissorTest(false); +} diff --git a/examples-testing/examples/webgl_materials_texture_partialupdate.ts b/examples-testing/examples/webgl_materials_texture_partialupdate.ts new file mode 100644 index 000000000..cae161939 --- /dev/null +++ b/examples-testing/examples/webgl_materials_texture_partialupdate.ts @@ -0,0 +1,104 @@ +import * as THREE from 'three'; + +let camera, scene, renderer, timer, dataTexture, diffuseMap; + +let last = 0; +const position = new THREE.Vector2(); +const color = new THREE.Color(); + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.z = 2; + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + const loader = new THREE.TextureLoader(); + diffuseMap = await loader.loadAsync('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); + diffuseMap.colorSpace = THREE.SRGBColorSpace; + diffuseMap.minFilter = THREE.LinearFilter; + diffuseMap.generateMipmaps = false; + + const geometry = new THREE.PlaneGeometry(2, 2); + const material = new THREE.MeshBasicMaterial({ map: diffuseMap }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const width = 32; + const height = 32; + + const data = new Uint8Array(width * height * 4); + dataTexture = new THREE.DataTexture(data, width, height); + dataTexture.colorSpace = THREE.SRGBColorSpace; + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const elapsedTime = timer.getElapsed(); + + if (elapsedTime - last > 0.1) { + last = elapsedTime; + + position.x = 32 * THREE.MathUtils.randInt(1, 16) - 32; + position.y = 32 * THREE.MathUtils.randInt(1, 16) - 32; + + // generate new color data + + updateDataTexture(dataTexture); + + // perform copy from src to dest texture to a random position + + renderer.copyTextureToTexture(dataTexture, diffuseMap, null, position); + } + + renderer.render(scene, camera); +} + +function updateDataTexture(texture) { + const size = texture.image.width * texture.image.height; + const data = texture.image.data; + + // generate a random color and update texture data + + color.setHex(Math.random() * 0xffffff); + + const r = Math.floor(color.r * 255); + const g = Math.floor(color.g * 255); + const b = Math.floor(color.b * 255); + + for (let i = 0; i < size; i++) { + const stride = i * 4; + + data[stride] = r; + data[stride + 1] = g; + data[stride + 2] = b; + data[stride + 3] = 1; + } +} diff --git a/examples-testing/examples/webgl_materials_texture_rotation.ts b/examples-testing/examples/webgl_materials_texture_rotation.ts new file mode 100644 index 000000000..eedc80c6f --- /dev/null +++ b/examples-testing/examples/webgl_materials_texture_rotation.ts @@ -0,0 +1,112 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let mesh, renderer, scene, camera; + +let gui; + +const API = { + offsetX: 0, + offsetY: 0, + repeatX: 0.25, + repeatY: 0.25, + rotation: Math.PI / 4, // positive is counterclockwise + centerX: 0.5, + centerY: 0.5, +}; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(10, 15, 25); + scene.add(camera); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.minDistance = 20; + controls.maxDistance = 50; + controls.maxPolarAngle = Math.PI / 2; + + const geometry = new THREE.BoxGeometry(10, 10, 10); + + new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg', function (texture) { + texture.wrapS = texture.wrapT = THREE.RepeatWrapping; + texture.anisotropy = renderer.capabilities.getMaxAnisotropy(); + texture.colorSpace = THREE.SRGBColorSpace; + + //texture.matrixAutoUpdate = false; // default is true; set to false to update texture.matrix manually + + const material = new THREE.MeshBasicMaterial({ map: texture }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + updateUvTransform(); + + initGui(); + + render(); + }); + + window.addEventListener('resize', onWindowResize); +} + +function render() { + renderer.render(scene, camera); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function updateUvTransform() { + const texture = mesh.material.map; + + if (texture.matrixAutoUpdate === true) { + texture.offset.set(API.offsetX, API.offsetY); + texture.repeat.set(API.repeatX, API.repeatY); + texture.center.set(API.centerX, API.centerY); + texture.rotation = API.rotation; // rotation is around center + } else { + // setting the matrix uv transform directly + texture.matrix.setUvTransform( + API.offsetX, + API.offsetY, + API.repeatX, + API.repeatY, + API.rotation, + API.centerX, + API.centerY, + ); + } + + render(); +} + +function initGui() { + gui = new GUI(); + + gui.add(API, 'offsetX', 0.0, 1.0).name('offset.x').onChange(updateUvTransform); + gui.add(API, 'offsetY', 0.0, 1.0).name('offset.y').onChange(updateUvTransform); + gui.add(API, 'repeatX', 0.25, 2.0).name('repeat.x').onChange(updateUvTransform); + gui.add(API, 'repeatY', 0.25, 2.0).name('repeat.y').onChange(updateUvTransform); + gui.add(API, 'rotation', -2.0, 2.0).name('rotation').onChange(updateUvTransform); + gui.add(API, 'centerX', 0.0, 1.0).name('center.x').onChange(updateUvTransform); + gui.add(API, 'centerY', 0.0, 1.0).name('center.y').onChange(updateUvTransform); +} diff --git a/examples-testing/examples/webgl_materials_toon.ts b/examples-testing/examples/webgl_materials_toon.ts new file mode 100644 index 000000000..46c6a7e93 --- /dev/null +++ b/examples-testing/examples/webgl_materials_toon.ts @@ -0,0 +1,152 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OutlineEffect } from 'three/addons/effects/OutlineEffect.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +let container, stats; + +let camera, scene, renderer, effect; +let particleLight; + +const loader = new FontLoader(); +loader.load('fonts/gentilis_regular.typeface.json', function (font) { + init(font); +}); + +function init(font) { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2500); + camera.position.set(0.0, 400, 400 * 3.5); + + // + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x444488); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // Materials + + const cubeWidth = 400; + const numberOfSpheresPerSide = 5; + const sphereRadius = (cubeWidth / numberOfSpheresPerSide) * 0.8 * 0.5; + const stepSize = 1.0 / numberOfSpheresPerSide; + + const geometry = new THREE.SphereGeometry(sphereRadius, 32, 16); + + for (let alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex++) { + const colors = new Uint8Array(alphaIndex + 2); + + for (let c = 0; c <= colors.length; c++) { + colors[c] = (c / colors.length) * 256; + } + + const gradientMap = new THREE.DataTexture(colors, colors.length, 1, THREE.RedFormat); + gradientMap.needsUpdate = true; + + for (let beta = 0; beta <= 1.0; beta += stepSize) { + for (let gamma = 0; gamma <= 1.0; gamma += stepSize) { + // basic monochromatic energy preservation + const diffuseColor = new THREE.Color() + .setHSL(alpha, 0.5, gamma * 0.5 + 0.1) + .multiplyScalar(1 - beta * 0.2); + + const material = new THREE.MeshToonMaterial({ + color: diffuseColor, + gradientMap: gradientMap, + }); + + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = alpha * 400 - 200; + mesh.position.y = beta * 400 - 200; + mesh.position.z = gamma * 400 - 200; + + scene.add(mesh); + } + } + } + + function addLabel(name, location) { + const textGeo = new TextGeometry(name, { + font: font, + + size: 20, + depth: 1, + curveSegments: 1, + }); + + const textMaterial = new THREE.MeshBasicMaterial(); + const textMesh = new THREE.Mesh(textGeo, textMaterial); + textMesh.position.copy(location); + scene.add(textMesh); + } + + addLabel('-gradientMap', new THREE.Vector3(-350, 0, 0)); + addLabel('+gradientMap', new THREE.Vector3(350, 0, 0)); + + addLabel('-diffuse', new THREE.Vector3(0, 0, -300)); + addLabel('+diffuse', new THREE.Vector3(0, 0, 300)); + + particleLight = new THREE.Mesh(new THREE.SphereGeometry(4, 8, 8), new THREE.MeshBasicMaterial({ color: 0xffffff })); + scene.add(particleLight); + + // Lights + + scene.add(new THREE.AmbientLight(0xc1c1c1, 3)); + + const pointLight = new THREE.PointLight(0xffffff, 2, 800, 0); + particleLight.add(pointLight); + + // + + effect = new OutlineEffect(renderer); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 200; + controls.maxDistance = 2000; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + const timer = Date.now() * 0.00025; + + particleLight.position.x = Math.sin(timer * 7) * 300; + particleLight.position.y = Math.cos(timer * 5) * 400; + particleLight.position.z = Math.cos(timer * 3) * 300; + + effect.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_video.ts b/examples-testing/examples/webgl_materials_video.ts new file mode 100644 index 000000000..ddf079183 --- /dev/null +++ b/examples-testing/examples/webgl_materials_video.ts @@ -0,0 +1,202 @@ +import * as THREE from 'three'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let container; + +let camera, scene, renderer; + +let video, texture, material, mesh; + +let composer; + +let mouseX = 0; +let mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +let cube_count; + +const meshes = [], + materials = [], + xgrid = 20, + ygrid = 10; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 500; + + scene = new THREE.Scene(); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0.5, 1, 1).normalize(); + scene.add(light); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + video = document.getElementById('video'); + video.play(); + video.addEventListener('play', function () { + this.currentTime = 3; + }); + + texture = new THREE.VideoTexture(video); + texture.colorSpace = THREE.SRGBColorSpace; + + // + + let i, j, ox, oy, geometry; + + const ux = 1 / xgrid; + const uy = 1 / ygrid; + + const xsize = 480 / xgrid; + const ysize = 204 / ygrid; + + const parameters = { color: 0xffffff, map: texture }; + + cube_count = 0; + + for (i = 0; i < xgrid; i++) { + for (j = 0; j < ygrid; j++) { + ox = i; + oy = j; + + geometry = new THREE.BoxGeometry(xsize, ysize, xsize); + + change_uvs(geometry, ux, uy, ox, oy); + + materials[cube_count] = new THREE.MeshLambertMaterial(parameters); + + material = materials[cube_count]; + + material.hue = i / xgrid; + material.saturation = 1 - j / ygrid; + + material.color.setHSL(material.hue, material.saturation, 0.5); + + mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = (i - xgrid / 2) * xsize; + mesh.position.y = (j - ygrid / 2) * ysize; + mesh.position.z = 0; + + mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; + + scene.add(mesh); + + mesh.dx = 0.001 * (0.5 - Math.random()); + mesh.dy = 0.001 * (0.5 - Math.random()); + + meshes[cube_count] = mesh; + + cube_count += 1; + } + } + + renderer.autoClear = false; + + document.addEventListener('mousemove', onDocumentMouseMove); + + // postprocessing + + const renderPass = new RenderPass(scene, camera); + const bloomPass = new BloomPass(1.3); + const outputPass = new OutputPass(); + + composer = new EffectComposer(renderer); + + composer.addPass(renderPass); + composer.addPass(bloomPass); + composer.addPass(outputPass); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); +} + +function change_uvs(geometry, unitx, unity, offsetx, offsety) { + const uvs = geometry.attributes.uv.array; + + for (let i = 0; i < uvs.length; i += 2) { + uvs[i] = (uvs[i] + offsetx) * unitx; + uvs[i + 1] = (uvs[i + 1] + offsety) * unity; + } +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = (event.clientY - windowHalfY) * 0.3; +} + +// + +let h, + counter = 1; + +function animate() { + const time = Date.now() * 0.00005; + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + for (let i = 0; i < cube_count; i++) { + material = materials[i]; + + h = ((360 * (material.hue + time)) % 360) / 360; + material.color.setHSL(h, material.saturation, 0.5); + } + + if (counter % 1000 > 200) { + for (let i = 0; i < cube_count; i++) { + mesh = meshes[i]; + + mesh.rotation.x += 10 * mesh.dx; + mesh.rotation.y += 10 * mesh.dy; + + mesh.position.x -= 150 * mesh.dx; + mesh.position.y += 150 * mesh.dy; + mesh.position.z += 300 * mesh.dx; + } + } + + if (counter % 1000 === 0) { + for (let i = 0; i < cube_count; i++) { + mesh = meshes[i]; + + mesh.dx *= -1; + mesh.dy *= -1; + } + } + + counter++; + + renderer.clear(); + composer.render(); +} diff --git a/examples-testing/examples/webgl_materials_video_webcam.ts b/examples-testing/examples/webgl_materials_video_webcam.ts new file mode 100644 index 000000000..cf6f8d50c --- /dev/null +++ b/examples-testing/examples/webgl_materials_video_webcam.ts @@ -0,0 +1,79 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, video; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 0.01; + + scene = new THREE.Scene(); + + video = document.getElementById('video'); + + const texture = new THREE.VideoTexture(video); + texture.colorSpace = THREE.SRGBColorSpace; + + const geometry = new THREE.PlaneGeometry(16, 9); + geometry.scale(0.5, 0.5, 0.5); + const material = new THREE.MeshBasicMaterial({ map: texture }); + + const count = 128; + const radius = 32; + + for (let i = 1, l = count; i <= l; i++) { + const phi = Math.acos(-1 + (2 * i) / l); + const theta = Math.sqrt(l * Math.PI) * phi; + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.setFromSphericalCoords(radius, phi, theta); + mesh.lookAt(camera.position); + scene.add(mesh); + } + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enablePan = false; + + window.addEventListener('resize', onWindowResize); + + // + + if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + const constraints = { video: { width: 1280, height: 720, facingMode: 'user' } }; + + navigator.mediaDevices + .getUserMedia(constraints) + .then(function (stream) { + // apply the stream to the video element used in the texture + + video.srcObject = stream; + video.play(); + }) + .catch(function (error) { + console.error('Unable to access the camera/webcam.', error); + }); + } else { + console.error('MediaDevices interface not available.'); + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_materials_wireframe.ts b/examples-testing/examples/webgl_materials_wireframe.ts new file mode 100644 index 000000000..8adbd71d6 --- /dev/null +++ b/examples-testing/examples/webgl_materials_wireframe.ts @@ -0,0 +1,107 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +const API = { + thickness: 1, +}; + +let renderer, scene, camera, mesh2; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 500); + camera.position.z = 200; + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.enablePan = false; + controls.enableZoom = false; + + new THREE.BufferGeometryLoader().load('models/json/WaltHeadLo_buffergeometry.json', function (geometry) { + geometry.deleteAttribute('normal'); + geometry.deleteAttribute('uv'); + + setupAttributes(geometry); + + // left + + const material1 = new THREE.MeshBasicMaterial({ + color: 0xe0e0ff, + wireframe: true, + }); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.position.set(-40, 0, 0); + + scene.add(mesh1); + + // right + + const material2 = new THREE.ShaderMaterial({ + uniforms: { thickness: { value: API.thickness } }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + side: THREE.DoubleSide, + alphaToCoverage: true, // only works when WebGLRenderer's "antialias" is set to "true" + }); + + mesh2 = new THREE.Mesh(geometry, material2); + mesh2.position.set(40, 0, 0); + + scene.add(mesh2); + + // + + render(); + }); + + // + + const gui = new GUI(); + + gui.add(API, 'thickness', 0, 4).onChange(function () { + mesh2.material.uniforms.thickness.value = API.thickness; + render(); + }); + + gui.open(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function setupAttributes(geometry) { + const vectors = [new THREE.Vector3(1, 0, 0), new THREE.Vector3(0, 1, 0), new THREE.Vector3(0, 0, 1)]; + + const position = geometry.attributes.position; + const centers = new Float32Array(position.count * 3); + + for (let i = 0, l = position.count; i < l; i++) { + vectors[i % 3].toArray(centers, i * 3); + } + + geometry.setAttribute('center', new THREE.BufferAttribute(centers, 3)); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_math_obb.ts b/examples-testing/examples/webgl_math_obb.ts new file mode 100644 index 000000000..71cb5a916 --- /dev/null +++ b/examples-testing/examples/webgl_math_obb.ts @@ -0,0 +1,192 @@ +import * as THREE from 'three'; + +import { OBB } from 'three/addons/math/OBB.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, timer, controls, stats, raycaster, hitbox; + +const objects = [], + mouse = new THREE.Vector2(); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 75); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + timer = new THREE.Timer(); + timer.connect(document); + + raycaster = new THREE.Raycaster(); + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x222222, 4); + hemiLight.position.set(1, 1, 1); + scene.add(hemiLight); + + const size = new THREE.Vector3(10, 5, 6); + const geometry = new THREE.BoxGeometry(size.x, size.y, size.z); + + // setup OBB on geometry level (doing this manually for now) + + geometry.userData.obb = new OBB(); + geometry.userData.obb.halfSize.copy(size).multiplyScalar(0.5); + + for (let i = 0; i < 100; i++) { + const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: 0x00ff00 })); + object.matrixAutoUpdate = false; + + object.position.x = Math.random() * 80 - 40; + object.position.y = Math.random() * 80 - 40; + object.position.z = Math.random() * 80 - 40; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.x = Math.random() + 0.5; + object.scale.y = Math.random() + 0.5; + object.scale.z = Math.random() + 0.5; + + scene.add(object); + + // bounding volume on object level (this will reflect the current world transform) + + object.userData.obb = new OBB(); + + objects.push(object); + } + + // + + hitbox = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000, wireframe: true })); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); + + document.addEventListener('click', onClick); +} + +function onClick(event) { + event.preventDefault(); + + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; + + raycaster.setFromCamera(mouse, camera); + + const intersectionPoint = new THREE.Vector3(); + const intersections = []; + + for (let i = 0, il = objects.length; i < il; i++) { + const object = objects[i]; + const obb = object.userData.obb; + + const ray = raycaster.ray; + + if (obb.intersectRay(ray, intersectionPoint) !== null) { + const distance = ray.origin.distanceTo(intersectionPoint); + intersections.push({ distance: distance, object: object }); + } + } + + if (intersections.length > 0) { + // determine closest intersection and highlight the respective 3D object + + intersections.sort(sortIntersections); + + intersections[0].object.add(hitbox); + } else { + const parent = hitbox.parent; + + if (parent) parent.remove(hitbox); + } +} + +function sortIntersections(a, b) { + return a.distance - b.distance; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + controls.update(); + + // transform cubes + + const delta = timer.getDelta(); + + for (let i = 0, il = objects.length; i < il; i++) { + const object = objects[i]; + + object.rotation.x += delta * Math.PI * 0.2; + object.rotation.y += delta * Math.PI * 0.1; + + object.updateMatrix(); + object.updateMatrixWorld(); + + // update OBB + + object.userData.obb.copy(object.geometry.userData.obb); + object.userData.obb.applyMatrix4(object.matrixWorld); + + // reset + + object.material.color.setHex(0x00ff00); + } + + // collision detection + + for (let i = 0, il = objects.length; i < il; i++) { + const object = objects[i]; + const obb = object.userData.obb; + + for (let j = i + 1, jl = objects.length; j < jl; j++) { + const objectToTest = objects[j]; + const obbToTest = objectToTest.userData.obb; + + // now perform intersection test + + if (obb.intersectsOBB(obbToTest) === true) { + object.material.color.setHex(0xff0000); + objectToTest.material.color.setHex(0xff0000); + } + } + } + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_math_orientation_transform.ts b/examples-testing/examples/webgl_math_orientation_transform.ts new file mode 100644 index 000000000..1d66997c4 --- /dev/null +++ b/examples-testing/examples/webgl_math_orientation_transform.ts @@ -0,0 +1,120 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, mesh, target; + +const spherical = new THREE.Spherical(); +const rotationMatrix = new THREE.Matrix4(); +const targetQuaternion = new THREE.Quaternion(); +const timer = new THREE.Timer(); +timer.connect(document); +const speed = Math.PI / 2; + +const params = { + useLookAt: false, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.z = 5; + + scene = new THREE.Scene(); + + const geometry = new THREE.ConeGeometry(0.1, 0.5, 8); + geometry.rotateX(Math.PI * 0.5); + const material = new THREE.MeshNormalMaterial(); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const targetGeometry = new THREE.SphereGeometry(0.05); + const targetMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 }); + target = new THREE.Mesh(targetGeometry, targetMaterial); + scene.add(target); + + // + + const sphereGeometry = new THREE.SphereGeometry(2, 32, 32); + const sphereMaterial = new THREE.MeshBasicMaterial({ + color: 0xcccccc, + wireframe: true, + transparent: true, + opacity: 0.3, + }); + const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); + scene.add(sphere); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + + gui.add(params, 'useLookAt'); + gui.open(); + + // + + generateTarget(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mesh.quaternion.equals(targetQuaternion) === false) { + if (params.useLookAt === true) { + // using lookAt() will make the mesh instantly look at the target + + mesh.lookAt(target.position); + } else { + // using rotateTowards() will gradually rotate the mesh towards the target + // the "speed" variable represents the rotation speed in radians per seconds + + const step = speed * delta; + mesh.quaternion.rotateTowards(targetQuaternion, step); + } + } + + renderer.render(scene, camera); +} + +function generateTarget() { + // generate a random point on a sphere + + spherical.theta = Math.random() * Math.PI * 2; + spherical.phi = Math.acos(2 * Math.random() - 1); + spherical.radius = 2; + + target.position.setFromSpherical(spherical); + + // compute target rotation + + rotationMatrix.lookAt(target.position, mesh.position, mesh.up); + targetQuaternion.setFromRotationMatrix(rotationMatrix); + + setTimeout(generateTarget, 2000); +} diff --git a/examples-testing/examples/webgl_mesh_batch.ts b/examples-testing/examples/webgl_mesh_batch.ts new file mode 100644 index 000000000..e238e50a3 --- /dev/null +++ b/examples-testing/examples/webgl_mesh_batch.ts @@ -0,0 +1,347 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { radixSort } from 'three/addons/utils/SortUtils.js'; + +let stats, gui, guiStatsEl; +let camera, controls, scene, renderer; +let geometries, mesh; +const ids = []; +const matrix = new THREE.Matrix4(); + +// + +const position = new THREE.Vector3(); +const rotation = new THREE.Euler(); +const quaternion = new THREE.Quaternion(); +const scale = new THREE.Vector3(); + +// + +const MAX_GEOMETRY_COUNT = 20000; + +const Method = { + BATCHED: 'BATCHED', + NAIVE: 'NAIVE', +}; + +const api = { + method: Method.BATCHED, + count: 256, + dynamic: 16, + + transparent: true, + sortObjects: true, + perObjectFrustumCulled: true, + useCustomSort: true, +}; + +init(); +initGeometries(); +initMesh(); + +// + +function randomizeMatrix(matrix) { + position.x = Math.random() * 40 - 20; + position.y = Math.random() * 40 - 20; + position.z = Math.random() * 40 - 20; + + rotation.x = Math.random() * 2 * Math.PI; + rotation.y = Math.random() * 2 * Math.PI; + rotation.z = Math.random() * 2 * Math.PI; + + quaternion.setFromEuler(rotation); + + scale.x = scale.y = scale.z = 0.5 + Math.random() * 0.5; + + return matrix.compose(position, quaternion, scale); +} + +function randomizeRotationSpeed(rotation) { + rotation.x = Math.random() * 0.01; + rotation.y = Math.random() * 0.01; + rotation.z = Math.random() * 0.01; + return rotation; +} + +function randomizeColor(color) { + return color.setHSL(Math.random() * 0.5, 0.6, 0.5); +} + +function randomizeAlpha() { + // make ~20% of all objects transparent + return Math.random() > 0.8 ? 0.5 : 1.0; +} + +function initGeometries() { + const cone = new THREE.ConeGeometry(1.0, 2.0); + const box = new THREE.BoxGeometry(2.0, 2.0, 2.0); + const sphere = new THREE.SphereGeometry(1.0, 16, 8); + + geometries = [cone, box, sphere]; + + for (const geometry of geometries) { + // add vertex colors for testing + const count = geometry.getAttribute('position').count; + const attribute = new THREE.BufferAttribute(new Float32Array(count * 3), 3); + geometry.setAttribute('color', attribute); + + for (let i = 0, l = attribute.array.length; i < l; ++i) { + attribute.array[i] = 1.0; + } + } +} + +function createMaterial() { + return new THREE.MeshPhongMaterial({ + vertexColors: true, + transparent: api.transparent, + depthWrite: !api.transparent, + }); +} + +function cleanup() { + if (mesh) { + mesh.traverse(node => { + if (node instanceof THREE.Mesh) { + node.material.dispose(); + } + }); + + mesh.parent.remove(mesh); + + if (mesh.dispose) { + mesh.dispose(); + } + } +} + +function initMesh() { + cleanup(); + + if (api.method === Method.BATCHED) { + initBatchedMesh(); + } else { + initRegularMesh(); + } +} + +function initRegularMesh() { + mesh = new THREE.Group(); + + for (let i = 0; i < api.count; i++) { + const material = createMaterial(); + randomizeColor(material.color); + material.opacity = randomizeAlpha(); + + const child = new THREE.Mesh(geometries[i % geometries.length], material); + randomizeMatrix(child.matrix); + child.matrix.decompose(child.position, child.quaternion, child.scale); + child.userData.rotationSpeed = randomizeRotationSpeed(new THREE.Euler()); + mesh.add(child); + } + + scene.add(mesh); +} + +function initBatchedMesh() { + const geometryCount = api.count; + const vertexCount = geometries.length * 512; + const indexCount = geometries.length * 1024; + + const euler = new THREE.Euler(); + const matrix = new THREE.Matrix4(); + const color = new THREE.Color(); + const colorWithAlpha = new THREE.Vector4(); + mesh = new THREE.BatchedMesh(geometryCount, vertexCount, indexCount, createMaterial()); + mesh.userData.rotationSpeeds = []; + + // disable full-object frustum culling since all of the objects can be dynamic. + mesh.frustumCulled = false; + + ids.length = 0; + + const geometryIds = [ + mesh.addGeometry(geometries[0]), + mesh.addGeometry(geometries[1]), + mesh.addGeometry(geometries[2]), + ]; + + for (let i = 0; i < api.count; i++) { + randomizeColor(color); + colorWithAlpha.set(color.r, color.g, color.b, randomizeAlpha()); + + const id = mesh.addInstance(geometryIds[i % geometryIds.length]); + mesh.setMatrixAt(id, randomizeMatrix(matrix)); + mesh.setColorAt(id, colorWithAlpha); + + const rotationMatrix = new THREE.Matrix4(); + rotationMatrix.makeRotationFromEuler(randomizeRotationSpeed(euler)); + mesh.userData.rotationSpeeds.push(rotationMatrix); + + ids.push(id); + } + + scene.add(mesh); +} + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + + // camera + + camera = new THREE.PerspectiveCamera(70, width / height, 1, 100); + camera.position.z = 30; + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = 1.0; + + // light + + const ambientLight = new THREE.AmbientLight(0xffffff, 2); + const directionalLight = new THREE.DirectionalLight(0xffffff, 2); + directionalLight.position.set(1, 1, 1); + scene.add(directionalLight, ambientLight); + + // stats + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // gui + + gui = new GUI(); + gui.add(api, 'count', 1, MAX_GEOMETRY_COUNT).step(1).onChange(initMesh); + gui.add(api, 'dynamic', 0, MAX_GEOMETRY_COUNT).step(1); + gui.add(api, 'method', Method).onChange(initMesh); + + gui.add(api, 'transparent').onChange(v => + mesh.traverse(node => { + if (node instanceof THREE.Mesh) { + const material = node.material; + material.transparent = v; + material.depthWrite = !v; + material.needsUpdate = true; + } + }), + ); + + gui.add(api, 'sortObjects'); + gui.add(api, 'perObjectFrustumCulled'); + gui.add(api, 'useCustomSort'); + + guiStatsEl = document.createElement('li'); + guiStatsEl.classList.add('gui-stats'); + + // listeners + + window.addEventListener('resize', onWindowResize); +} + +// + +function sortFunction(list) { + // initialize options + this._options = this._options || { + get: el => el.z, + aux: new Array(this.maxInstanceCount), + }; + + const options = this._options; + options.reversed = this.material.transparent; + + let minZ = Infinity; + let maxZ = -Infinity; + for (let i = 0, l = list.length; i < l; i++) { + const z = list[i].z; + if (z > maxZ) maxZ = z; + if (z < minZ) minZ = z; + } + + // convert depth to unsigned 32 bit range + const depthDelta = maxZ - minZ; + const factor = (2 ** 32 - 1) / depthDelta; // UINT32_MAX / z range + for (let i = 0, l = list.length; i < l; i++) { + list[i].z -= minZ; + list[i].z *= factor; + } + + // perform a fast-sort using the hybrid radix sort function + radixSort(list, options); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + animateMeshes(); + + controls.update(); + stats.update(); + + render(); +} + +function animateMeshes() { + const loopNum = Math.min(api.count, api.dynamic); + + if (api.method === Method.BATCHED) { + for (let i = 0; i < loopNum; i++) { + const rotationMatrix = mesh.userData.rotationSpeeds[i]; + const id = ids[i]; + + mesh.getMatrixAt(id, matrix); + matrix.multiply(rotationMatrix); + mesh.setMatrixAt(id, matrix); + } + } else { + for (let i = 0; i < loopNum; i++) { + const child = mesh.children[i]; + const rotationSpeed = child.userData.rotationSpeed; + + child.rotation.set( + child.rotation.x + rotationSpeed.x, + child.rotation.y + rotationSpeed.y, + child.rotation.z + rotationSpeed.z, + ); + } + } +} + +function render() { + if (mesh.isBatchedMesh) { + mesh.sortObjects = api.sortObjects; + mesh.perObjectFrustumCulled = api.perObjectFrustumCulled; + mesh.setCustomSort(api.useCustomSort ? sortFunction : null); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_mirror.ts b/examples-testing/examples/webgl_mirror.ts new file mode 100644 index 000000000..4f1f17f7d --- /dev/null +++ b/examples-testing/examples/webgl_mirror.ts @@ -0,0 +1,193 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Reflector } from 'three/addons/objects/Reflector.js'; + +let camera, scene, renderer; + +let cameraControls; + +let sphereGroup, smallSphere; + +let groundMirror, verticalMirror; + +let resolutionScale = 1; // render target scale factor in [ 0, 1 ] + +const size = new THREE.Vector2(); + +init(); + +function init() { + const container = document.getElementById('container'); + + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); + camera.position.set(0, 75, 160); + + cameraControls = new OrbitControls(camera, renderer.domElement); + cameraControls.target.set(0, 40, 0); + cameraControls.maxDistance = 400; + cameraControls.minDistance = 10; + cameraControls.update(); + + // + + const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); + + // reflectors/mirrors + + let geometry, material; + + renderer.getDrawingBufferSize(size); + size.multiplyScalar(resolutionScale).round(); + + geometry = new THREE.CircleGeometry(40, 64); + groundMirror = new Reflector(geometry, { + clipBias: 0.003, + textureWidth: size.width, + textureHeight: size.height, + color: 0xb5b5b5, + }); + groundMirror.position.y = 0.5; + groundMirror.rotateX(-Math.PI / 2); + scene.add(groundMirror); + + geometry = new THREE.PlaneGeometry(100, 100); + verticalMirror = new Reflector(geometry, { + clipBias: 0.003, + textureWidth: size.width, + textureHeight: size.height, + color: 0xc1cbcb, + }); + verticalMirror.position.y = 50; + verticalMirror.position.z = -50; + scene.add(verticalMirror); + + sphereGroup = new THREE.Object3D(); + scene.add(sphereGroup); + + geometry = new THREE.CylinderGeometry(0.1, 15 * Math.cos((Math.PI / 180) * 30), 0.1, 24, 1); + material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x8d8d8d }); + const sphereCap = new THREE.Mesh(geometry, material); + sphereCap.position.y = -15 * Math.sin((Math.PI / 180) * 30) - 0.05; + sphereCap.rotateX(-Math.PI); + + geometry = new THREE.SphereGeometry(15, 24, 24, Math.PI / 2, Math.PI * 2, 0, (Math.PI / 180) * 120); + const halfSphere = new THREE.Mesh(geometry, material); + halfSphere.add(sphereCap); + halfSphere.rotateX((-Math.PI / 180) * 135); + halfSphere.rotateZ((-Math.PI / 180) * 20); + halfSphere.position.y = 7.5 + 15 * Math.sin((Math.PI / 180) * 30); + + sphereGroup.add(halfSphere); + + geometry = new THREE.IcosahedronGeometry(5, 0); + material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x7b7b7b, flatShading: true }); + smallSphere = new THREE.Mesh(geometry, material); + scene.add(smallSphere); + + // walls + const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeTop.position.y = 100; + planeTop.rotateX(Math.PI / 2); + scene.add(planeTop); + + const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeBottom.rotateX(-Math.PI / 2); + scene.add(planeBottom); + + const planeFront = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); + planeFront.position.z = 50; + planeFront.position.y = 50; + planeFront.rotateY(Math.PI); + scene.add(planeFront); + + const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); + planeRight.position.x = 50; + planeRight.position.y = 50; + planeRight.rotateY(-Math.PI / 2); + scene.add(planeRight); + + const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); + planeLeft.position.x = -50; + planeLeft.position.y = 50; + planeLeft.rotateY(Math.PI / 2); + scene.add(planeLeft); + + // lights + const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); + mainLight.position.y = 60; + scene.add(mainLight); + + const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); + greenLight.position.set(550, 50, 0); + scene.add(greenLight); + + const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); + redLight.position.set(-550, 50, 0); + scene.add(redLight); + + const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); + blueLight.position.set(0, 50, 550); + scene.add(blueLight); + + // GUI + + const params = { + resolution: resolutionScale, + }; + + const gui = new GUI(); + + const folder = gui.addFolder('Mirrors'); + + folder.add(params, 'resolution', 0.2, 1, 0.1).onChange(function (val) { + resolutionScale = val; + onWindowResize(); + }); + + folder.open(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + renderer.getDrawingBufferSize(size); + size.multiplyScalar(resolutionScale).round(); + + groundMirror.getRenderTarget().setSize(size.width, size.height); + verticalMirror.getRenderTarget().setSize(size.width, size.height); +} + +function animate() { + const timer = Date.now() * 0.01; + + sphereGroup.rotation.y -= 0.002; + + smallSphere.position.set( + Math.cos(timer * 0.1) * 30, + Math.abs(Math.cos(timer * 0.2)) * 20 + 5, + Math.sin(timer * 0.1) * 30, + ); + smallSphere.rotation.y = Math.PI / 2 - timer * 0.1; + smallSphere.rotation.z = timer * 0.8; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_modifier_edgesplit.ts b/examples-testing/examples/webgl_modifier_edgesplit.ts new file mode 100644 index 000000000..f02478ed9 --- /dev/null +++ b/examples-testing/examples/webgl_modifier_edgesplit.ts @@ -0,0 +1,128 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +import { EdgeSplitModifier } from 'three/addons/modifiers/EdgeSplitModifier.js'; +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let renderer, scene, camera; +let modifier, mesh, baseGeometry; +let map; + +const params = { + smoothShading: true, + edgeSplit: true, + cutOffAngle: 20, + showMap: false, + tryKeepNormals: true, +}; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.enableDamping = true; + controls.dampingFactor = 0.25; + controls.rotateSpeed = 0.35; + controls.minZoom = 1; + camera.position.set(0, 0, 4); + + scene.add(new THREE.HemisphereLight(0xffffff, 0x444444, 3)); + + new OBJLoader().load('./models/obj/cerberus/Cerberus.obj', function (group) { + const cerberus = group.children[0]; + const modelGeometry = cerberus.geometry; + + modifier = new EdgeSplitModifier(); + baseGeometry = BufferGeometryUtils.mergeVertices(modelGeometry); + + mesh = new THREE.Mesh(getGeometry(), new THREE.MeshStandardMaterial()); + mesh.material.flatShading = !params.smoothShading; + mesh.rotateY(-Math.PI / 2); + mesh.scale.set(3.5, 3.5, 3.5); + mesh.translateZ(1.5); + scene.add(mesh); + + if (map !== undefined && params.showMap) { + mesh.material.map = map; + mesh.material.needsUpdate = true; + } + + render(); + }); + + window.addEventListener('resize', onWindowResize); + + new THREE.TextureLoader().load('./models/obj/cerberus/Cerberus_A.jpg', function (texture) { + map = texture; + map.colorSpace = THREE.SRGBColorSpace; + + if (mesh !== undefined && params.showMap) { + mesh.material.map = map; + mesh.material.needsUpdate = true; + } + }); + + const gui = new GUI({ title: 'Edge split modifier parameters' }); + + gui.add(params, 'showMap').onFinishChange(updateMesh); + gui.add(params, 'smoothShading').onFinishChange(updateMesh); + gui.add(params, 'edgeSplit').onFinishChange(updateMesh); + gui.add(params, 'cutOffAngle').min(0).max(180).onFinishChange(updateMesh); + gui.add(params, 'tryKeepNormals').onFinishChange(updateMesh); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + render(); +} + +function getGeometry() { + let geometry; + + if (params.edgeSplit) { + geometry = modifier.modify(baseGeometry, (params.cutOffAngle * Math.PI) / 180, params.tryKeepNormals); + } else { + geometry = baseGeometry; + } + + return geometry; +} + +function updateMesh() { + if (mesh !== undefined) { + mesh.geometry = getGeometry(); + + let needsUpdate = mesh.material.flatShading === params.smoothShading; + mesh.material.flatShading = params.smoothShading === false; + + if (map !== undefined) { + needsUpdate = needsUpdate || mesh.material.map !== (params.showMap ? map : null); + mesh.material.map = params.showMap ? map : null; + } + + mesh.material.needsUpdate = needsUpdate; + + render(); + } +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_modifier_simplifier.ts b/examples-testing/examples/webgl_modifier_simplifier.ts new file mode 100644 index 000000000..e1ddb45e7 --- /dev/null +++ b/examples-testing/examples/webgl_modifier_simplifier.ts @@ -0,0 +1,84 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { SimplifyModifier } from 'three/addons/modifiers/SimplifyModifier.js'; + +let renderer, scene, camera; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 15; + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.enablePan = false; + controls.enableZoom = false; + + scene.add(new THREE.AmbientLight(0xffffff, 0.6)); + + const light = new THREE.PointLight(0xffffff, 400); + camera.add(light); + scene.add(camera); + + new GLTFLoader().load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + mesh.position.x = -3; + mesh.rotation.y = Math.PI / 2; + scene.add(mesh); + + const modifier = new SimplifyModifier(); + + const simplified = mesh.clone(); + simplified.material = simplified.material.clone(); + simplified.material.flatShading = true; + + simplified.position.x = 3; + simplified.rotation.y = -Math.PI / 2; + scene.add(simplified); + + const params = { ratio: 0.125 }; + + async function simplify() { + const count = Math.floor(mesh.geometry.attributes.position.count * (1 - params.ratio)); // number of vertices to remove + + const geometry = await modifier.modify(mesh.geometry, count); + + if (simplified.geometry !== mesh.geometry) simplified.geometry.dispose(); + + simplified.geometry = geometry; + + render(); + } + + simplify(); + + const gui = new GUI(); + gui.add(params, 'ratio', 0.01, 1, 0.01).onChange(simplify); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_modifier_tessellation.ts b/examples-testing/examples/webgl_modifier_tessellation.ts new file mode 100644 index 000000000..4600fc6cb --- /dev/null +++ b/examples-testing/examples/webgl_modifier_tessellation.ts @@ -0,0 +1,142 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; +import { TessellateModifier } from 'three/addons/modifiers/TessellateModifier.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +let renderer, scene, camera, stats; + +let controls; + +let mesh, uniforms; + +const WIDTH = window.innerWidth; +const HEIGHT = window.innerHeight; + +const loader = new FontLoader(); +loader.load('fonts/helvetiker_bold.typeface.json', function (font) { + init(font); +}); + +function init(font) { + camera = new THREE.PerspectiveCamera(40, WIDTH / HEIGHT, 1, 10000); + camera.position.set(-100, 100, 200); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x050505); + + // + + let geometry = new TextGeometry('THREE.JS', { + font: font, + + size: 40, + depth: 5, + curveSegments: 3, + + bevelThickness: 2, + bevelSize: 1, + bevelEnabled: true, + }); + + geometry.center(); + + const tessellateModifier = new TessellateModifier(8, 6); + + geometry = tessellateModifier.modify(geometry); + + // + + const numFaces = geometry.attributes.position.count / 3; + + const colors = new Float32Array(numFaces * 3 * 3); + const displacement = new Float32Array(numFaces * 3 * 3); + + const color = new THREE.Color(); + + for (let f = 0; f < numFaces; f++) { + const index = 9 * f; + + const h = 0.2 * Math.random(); + const s = 0.5 + 0.5 * Math.random(); + const l = 0.5 + 0.5 * Math.random(); + + color.setHSL(h, s, l); + + const d = 10 * (0.5 - Math.random()); + + for (let i = 0; i < 3; i++) { + colors[index + 3 * i] = color.r; + colors[index + 3 * i + 1] = color.g; + colors[index + 3 * i + 2] = color.b; + + displacement[index + 3 * i] = d; + displacement[index + 3 * i + 1] = d; + displacement[index + 3 * i + 2] = d; + } + } + + geometry.setAttribute('customColor', new THREE.BufferAttribute(colors, 3)); + geometry.setAttribute('displacement', new THREE.BufferAttribute(displacement, 3)); + + // + + uniforms = { + amplitude: { value: 0.0 }, + }; + + const shaderMaterial = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + }); + + // + + mesh = new THREE.Mesh(geometry, shaderMaterial); + + scene.add(mesh); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(WIDTH, HEIGHT); + renderer.setAnimationLoop(animate); + + const container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + controls = new TrackballControls(camera, renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + render(); + + stats.update(); +} + +function render() { + const time = Date.now() * 0.001; + + uniforms.amplitude.value = 1.0 + Math.sin(time * 0.5); + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_morphtargets.ts b/examples-testing/examples/webgl_morphtargets.ts new file mode 100644 index 000000000..d8a4bbe8d --- /dev/null +++ b/examples-testing/examples/webgl_morphtargets.ts @@ -0,0 +1,116 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container, camera, scene, renderer, mesh; + +init(); + +function init() { + container = document.getElementById('container'); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x8fbcd4); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); + camera.position.z = 10; + scene.add(camera); + + scene.add(new THREE.AmbientLight(0x8fbcd4, 1.5)); + + const pointLight = new THREE.PointLight(0xffffff, 200); + camera.add(pointLight); + + const geometry = createGeometry(); + + const material = new THREE.MeshPhongMaterial({ + color: 0xff0000, + flatShading: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + initGUI(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(function () { + renderer.render(scene, camera); + }); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + + window.addEventListener('resize', onWindowResize); +} + +function createGeometry() { + const geometry = new THREE.BoxGeometry(2, 2, 2, 32, 32, 32); + + // create an empty array to hold targets for the attribute we want to morph + // morphing positions and normals is supported + geometry.morphAttributes.position = []; + + // the original positions of the cube's vertices + const positionAttribute = geometry.attributes.position; + + // for the first morph target we'll move the cube's vertices onto the surface of a sphere + const spherePositions = []; + + // for the second morph target, we'll twist the cubes vertices + const twistPositions = []; + const direction = new THREE.Vector3(1, 0, 0); + const vertex = new THREE.Vector3(); + + for (let i = 0; i < positionAttribute.count; i++) { + const x = positionAttribute.getX(i); + const y = positionAttribute.getY(i); + const z = positionAttribute.getZ(i); + + spherePositions.push( + x * Math.sqrt(1 - (y * y) / 2 - (z * z) / 2 + (y * y * z * z) / 3), + y * Math.sqrt(1 - (z * z) / 2 - (x * x) / 2 + (z * z * x * x) / 3), + z * Math.sqrt(1 - (x * x) / 2 - (y * y) / 2 + (x * x * y * y) / 3), + ); + + // stretch along the x-axis so we can see the twist better + vertex.set(x * 2, y, z); + + vertex.applyAxisAngle(direction, (Math.PI * x) / 2).toArray(twistPositions, twistPositions.length); + } + + // add the spherical positions as the first morph target + geometry.morphAttributes.position[0] = new THREE.Float32BufferAttribute(spherePositions, 3); + + // add the twisted positions as the second morph target + geometry.morphAttributes.position[1] = new THREE.Float32BufferAttribute(twistPositions, 3); + + return geometry; +} + +function initGUI() { + // Set up dat.GUI to control targets + const params = { + Spherify: 0, + Twist: 0, + }; + const gui = new GUI({ title: 'Morph Targets' }); + + gui.add(params, 'Spherify', 0, 1, 0.01).onChange(function (value) { + mesh.morphTargetInfluences[0] = value; + }); + gui.add(params, 'Twist', 0, 1, 0.01).onChange(function (value) { + mesh.morphTargetInfluences[1] = value; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} diff --git a/examples-testing/examples/webgl_morphtargets_face.ts b/examples-testing/examples/webgl_morphtargets_face.ts new file mode 100644 index 000000000..4e02c83ce --- /dev/null +++ b/examples-testing/examples/webgl_morphtargets_face.ts @@ -0,0 +1,108 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; + +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, stats, mixer, timer, controls; + +init(); + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); + camera.position.set(-1.8, 0.8, 3); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + container.appendChild(renderer.domElement); + + const ktx2Loader = new KTX2Loader().detectSupport(renderer); + + new GLTFLoader() + .setKTX2Loader(ktx2Loader) + .setMeshoptDecoder(MeshoptDecoder) + .load('models/gltf/facecap.glb', gltf => { + const mesh = gltf.scene.children[0]; + + scene.add(mesh); + + mixer = new THREE.AnimationMixer(mesh); + + mixer.clipAction(gltf.animations[0]).play(); + + // GUI + + const head = mesh.getObjectByName('mesh_2'); + const influences = head.morphTargetInfluences; + + const gui = new GUI(); + gui.close(); + + for (const [key, value] of Object.entries(head.morphTargetDictionary)) { + gui.add(influences, value, 0, 1, 0.01).name(key.replace('blendShape1.', '')).listen(); + } + }); + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.background = new THREE.Color(0x666666); + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2.5; + controls.maxDistance = 5; + controls.minAzimuthAngle = -Math.PI / 2; + controls.maxAzimuthAngle = Math.PI / 2; + controls.maxPolarAngle = Math.PI / 1.8; + controls.target.set(0, 0.15, -0.2); + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) { + mixer.update(delta); + } + + renderer.render(scene, camera); + + controls.update(); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_morphtargets_horse.ts b/examples-testing/examples/webgl_morphtargets_horse.ts new file mode 100644 index 000000000..2c29e9c0e --- /dev/null +++ b/examples-testing/examples/webgl_morphtargets_horse.ts @@ -0,0 +1,100 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let container, stats; +let camera, scene, renderer; +let mesh, mixer; + +const radius = 600; +let theta = 0; +let prevTime = Date.now(); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.y = 300; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xf0f0f0); + + // + + const light1 = new THREE.DirectionalLight(0xefefff, 5); + light1.position.set(1, 1, 1).normalize(); + scene.add(light1); + + const light2 = new THREE.DirectionalLight(0xffefef, 5); + light2.position.set(-1, -1, -1).normalize(); + scene.add(light2); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Horse.glb', function (gltf) { + mesh = gltf.scene.children[0]; + mesh.scale.set(1.5, 1.5, 1.5); + scene.add(mesh); + + mixer = new THREE.AnimationMixer(mesh); + + mixer.clipAction(gltf.animations[0]).setDuration(1).play(); + }); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + theta += 0.1; + + camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); + camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); + + camera.lookAt(0, 150, 0); + + if (mixer) { + const time = Date.now(); + + mixer.update((time - prevTime) * 0.001); + + prevTime = time; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_morphtargets_sphere.ts b/examples-testing/examples/webgl_morphtargets_sphere.ts new file mode 100644 index 000000000..3e36f002c --- /dev/null +++ b/examples-testing/examples/webgl_morphtargets_sphere.ts @@ -0,0 +1,105 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer, timer; + +let mesh; + +let sign = 1; +const speed = 0.5; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.2, 100); + camera.position.set(0, 5, 5); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + const light1 = new THREE.PointLight(0xff2200, 50000); + light1.position.set(100, 100, 100); + scene.add(light1); + + const light2 = new THREE.PointLight(0x22ff00, 10000); + light2.position.set(-100, -100, -100); + scene.add(light2); + + scene.add(new THREE.AmbientLight(0x111111)); + + const loader = new GLTFLoader(); + loader.load('models/gltf/AnimatedMorphSphere/glTF/AnimatedMorphSphere.gltf', function (gltf) { + mesh = gltf.scene.getObjectByName('AnimatedMorphSphere'); + mesh.rotation.z = Math.PI / 2; + scene.add(mesh); + + // + + const pointsMaterial = new THREE.PointsMaterial({ + size: 10, + sizeAttenuation: false, + map: new THREE.TextureLoader().load('textures/sprites/disc.png'), + alphaTest: 0.5, + }); + + const points = new THREE.Points(mesh.geometry, pointsMaterial); + points.morphTargetInfluences = mesh.morphTargetInfluences; + points.morphTargetDictionary = mesh.morphTargetDictionary; + mesh.add(points); + }); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + container.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 20; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + render(); +} + +function render() { + const delta = timer.getDelta(); + + if (mesh !== undefined) { + const step = delta * speed; + + mesh.rotation.y += step; + + mesh.morphTargetInfluences[1] = mesh.morphTargetInfluences[1] + step * sign; + + if (mesh.morphTargetInfluences[1] <= 0 || mesh.morphTargetInfluences[1] >= 1) { + sign *= -1; + } + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_multiple_elements.ts b/examples-testing/examples/webgl_multiple_elements.ts new file mode 100644 index 000000000..64f8a9c5f --- /dev/null +++ b/examples-testing/examples/webgl_multiple_elements.ts @@ -0,0 +1,139 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let canvas, renderer; + +const scenes = []; + +init(); + +function init() { + canvas = document.getElementById('c'); + + const geometries = [ + new THREE.BoxGeometry(1, 1, 1), + new THREE.SphereGeometry(0.5, 12, 8), + new THREE.DodecahedronGeometry(0.5), + new THREE.CylinderGeometry(0.5, 0.5, 1, 12), + ]; + + const content = document.getElementById('content'); + + for (let i = 0; i < 40; i++) { + const scene = new THREE.Scene(); + + // make a list item + const element = document.createElement('div'); + element.className = 'list-item'; + + const sceneElement = document.createElement('div'); + element.appendChild(sceneElement); + + const descriptionElement = document.createElement('div'); + descriptionElement.innerText = 'Scene ' + (i + 1); + element.appendChild(descriptionElement); + + // the element that represents the area we want to render the scene + scene.userData.element = sceneElement; + content.appendChild(element); + + const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); + camera.position.z = 2; + scene.userData.camera = camera; + + const controls = new OrbitControls(scene.userData.camera, scene.userData.element); + controls.minDistance = 2; + controls.maxDistance = 5; + controls.enablePan = false; + controls.enableZoom = false; + scene.userData.controls = controls; + + // add one random mesh to each scene + const geometry = geometries[(geometries.length * Math.random()) | 0]; + + const material = new THREE.MeshStandardMaterial({ + color: new THREE.Color().setHSL(Math.random(), 1, 0.75, THREE.SRGBColorSpace), + roughness: 0.5, + metalness: 0, + flatShading: true, + }); + + scene.add(new THREE.Mesh(geometry, material)); + + scene.add(new THREE.HemisphereLight(0xaaaaaa, 0x444444, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 1.5); + light.position.set(1, 1, 1); + scene.add(light); + + scenes.push(scene); + } + + renderer = new THREE.WebGLRenderer({ canvas: canvas, antialias: true }); + renderer.setClearColor(0xffffff, 1); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setAnimationLoop(animate); +} + +function updateSize() { + const width = canvas.clientWidth; + const height = canvas.clientHeight; + + if (canvas.width !== width || canvas.height !== height) { + renderer.setSize(width, height, false); + } +} + +function animate() { + updateSize(); + + canvas.style.transform = `translateY(${window.scrollY}px)`; + + renderer.setClearColor(0xffffff); + renderer.setScissorTest(false); + renderer.clear(); + + renderer.setClearColor(0xe0e0e0); + renderer.setScissorTest(true); + + scenes.forEach(function (scene) { + // so something moves + scene.children[0].rotation.y = Date.now() * 0.001; + + // get the element that is a place holder for where we want to + // draw the scene + const element = scene.userData.element; + + // get its position relative to the page's viewport + const rect = element.getBoundingClientRect(); + + // check if it's offscreen. If so skip it + if ( + rect.bottom < 0 || + rect.top > renderer.domElement.clientHeight || + rect.right < 0 || + rect.left > renderer.domElement.clientWidth + ) { + return; // it's off screen + } + + // set the viewport + const width = rect.right - rect.left; + const height = rect.bottom - rect.top; + const left = rect.left; + const bottom = renderer.domElement.clientHeight - rect.bottom; + + renderer.setViewport(left, bottom, width, height); + renderer.setScissor(left, bottom, width, height); + + const camera = scene.userData.camera; + + //camera.aspect = width / height; // not changing in this example + //camera.updateProjectionMatrix(); + + //scene.userData.controls.update(); + + renderer.render(scene, camera); + }); +} diff --git a/examples-testing/examples/webgl_multiple_rendertargets.ts b/examples-testing/examples/webgl_multiple_rendertargets.ts new file mode 100644 index 000000000..86708082b --- /dev/null +++ b/examples-testing/examples/webgl_multiple_rendertargets.ts @@ -0,0 +1,133 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, controls; +let renderTarget; +let postScene, postCamera; + +const parameters = { + samples: 4, + wireframe: false, +}; + +const gui = new GUI(); +gui.add(parameters, 'samples', 0, 4).step(1); +gui.add(parameters, 'wireframe'); +gui.onChange(render); + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + // Create a multi render target with Float buffers + + renderTarget = new THREE.WebGLRenderTarget( + window.innerWidth * window.devicePixelRatio, + window.innerHeight * window.devicePixelRatio, + { + count: 2, + minFilter: THREE.NearestFilter, + magFilter: THREE.NearestFilter, + }, + ); + + // Name our G-Buffer attachments for debugging + + renderTarget.textures[0].name = 'diffuse'; + renderTarget.textures[1].name = 'normal'; + + // Scene setup + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222222); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.z = 4; + + const loader = new THREE.TextureLoader(); + + const diffuse = loader.load('textures/hardwood2_diffuse.jpg', render); + diffuse.wrapS = THREE.RepeatWrapping; + diffuse.wrapT = THREE.RepeatWrapping; + diffuse.colorSpace = THREE.SRGBColorSpace; + + scene.add( + new THREE.Mesh( + new THREE.TorusKnotGeometry(1, 0.3, 128, 32), + new THREE.RawShaderMaterial({ + name: 'G-Buffer Shader', + vertexShader: document.querySelector('#gbuffer-vert').textContent.trim(), + fragmentShader: document.querySelector('#gbuffer-frag').textContent.trim(), + uniforms: { + tDiffuse: { value: diffuse }, + repeat: { value: new THREE.Vector2(5, 0.5) }, + }, + glslVersion: THREE.GLSL3, + }), + ), + ); + + // PostProcessing setup + + postScene = new THREE.Scene(); + postCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); + + postScene.add( + new THREE.Mesh( + new THREE.PlaneGeometry(2, 2), + new THREE.RawShaderMaterial({ + name: 'Post-FX Shader', + vertexShader: document.querySelector('#render-vert').textContent.trim(), + fragmentShader: document.querySelector('#render-frag').textContent.trim(), + uniforms: { + tDiffuse: { value: renderTarget.textures[0] }, + tNormal: { value: renderTarget.textures[1] }, + }, + glslVersion: THREE.GLSL3, + }), + ), + ); + + // Controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + const dpr = renderer.getPixelRatio(); + renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); + + render(); +} + +function render() { + renderTarget.samples = parameters.samples; + + scene.traverse(function (child) { + if (child.material !== undefined) { + child.material.wireframe = parameters.wireframe; + } + }); + + // render scene into target + renderer.setRenderTarget(renderTarget); + renderer.render(scene, camera); + + // render post FX + renderer.setRenderTarget(null); + renderer.render(postScene, postCamera); +} diff --git a/examples-testing/examples/webgl_multiple_scenes_comparison.ts b/examples-testing/examples/webgl_multiple_scenes_comparison.ts new file mode 100644 index 000000000..41a5130d4 --- /dev/null +++ b/examples-testing/examples/webgl_multiple_scenes_comparison.ts @@ -0,0 +1,98 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container, camera, renderer, controls; +let sceneL, sceneR; + +let sliderPos = window.innerWidth / 2; + +init(); + +function init() { + container = document.querySelector('.container'); + + sceneL = new THREE.Scene(); + sceneL.background = new THREE.Color(0xbcd48f); + + sceneR = new THREE.Scene(); + sceneR.background = new THREE.Color(0x8fbcd4); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 6; + + controls = new OrbitControls(camera, container); + + const light = new THREE.HemisphereLight(0xffffff, 0x444444, 3); + light.position.set(-2, 2, 2); + sceneL.add(light.clone()); + sceneR.add(light.clone()); + + initMeshes(); + initSlider(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setScissorTest(true); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function initMeshes() { + const geometry = new THREE.IcosahedronGeometry(1, 3); + + const meshL = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial()); + sceneL.add(meshL); + + const meshR = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial({ wireframe: true })); + sceneR.add(meshR); +} + +function initSlider() { + const slider = document.querySelector('.slider'); + + function onPointerDown() { + if (event.isPrimary === false) return; + + controls.enabled = false; + + window.addEventListener('pointermove', onPointerMove); + window.addEventListener('pointerup', onPointerUp); + } + + function onPointerUp() { + controls.enabled = true; + + window.removeEventListener('pointermove', onPointerMove); + window.removeEventListener('pointerup', onPointerUp); + } + + function onPointerMove(e) { + if (event.isPrimary === false) return; + + sliderPos = Math.max(0, Math.min(window.innerWidth, e.pageX)); + + slider.style.left = sliderPos - slider.offsetWidth / 2 + 'px'; + } + + slider.style.touchAction = 'none'; // disable touch scroll + slider.addEventListener('pointerdown', onPointerDown); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.setScissor(0, 0, sliderPos, window.innerHeight); + renderer.render(sceneL, camera); + + renderer.setScissor(sliderPos, 0, window.innerWidth, window.innerHeight); + renderer.render(sceneR, camera); +} diff --git a/examples-testing/examples/webgl_multiple_views.ts b/examples-testing/examples/webgl_multiple_views.ts new file mode 100644 index 000000000..672846f9f --- /dev/null +++ b/examples-testing/examples/webgl_multiple_views.ts @@ -0,0 +1,235 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let stats; + +let scene, renderer; + +let mouseX = 0; + +let windowWidth, windowHeight; + +const views = [ + { + left: 0, + bottom: 0, + width: 0.5, + height: 1.0, + background: new THREE.Color().setRGB(0.5, 0.5, 0.7, THREE.SRGBColorSpace), + eye: [0, 300, 1800], + up: [0, 1, 0], + fov: 30, + updateCamera: function (camera, scene, mouseX) { + camera.position.x += mouseX * 0.05; + camera.position.x = Math.max(Math.min(camera.position.x, 2000), -2000); + camera.lookAt(scene.position); + }, + }, + { + left: 0.5, + bottom: 0, + width: 0.5, + height: 0.5, + background: new THREE.Color().setRGB(0.7, 0.5, 0.5, THREE.SRGBColorSpace), + eye: [0, 1800, 0], + up: [0, 0, 1], + fov: 45, + updateCamera: function (camera, scene, mouseX) { + camera.position.x -= mouseX * 0.05; + camera.position.x = Math.max(Math.min(camera.position.x, 2000), -2000); + camera.lookAt(camera.position.clone().setY(0)); + }, + }, + { + left: 0.5, + bottom: 0.5, + width: 0.5, + height: 0.5, + background: new THREE.Color().setRGB(0.5, 0.7, 0.7, THREE.SRGBColorSpace), + eye: [1400, 800, 1400], + up: [0, 1, 0], + fov: 60, + updateCamera: function (camera, scene, mouseX) { + camera.position.y -= mouseX * 0.05; + camera.position.y = Math.max(Math.min(camera.position.y, 1600), -1600); + camera.lookAt(scene.position); + }, + }, +]; + +init(); + +function init() { + const container = document.getElementById('container'); + + for (let ii = 0; ii < views.length; ++ii) { + const view = views[ii]; + const camera = new THREE.PerspectiveCamera(view.fov, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.fromArray(view.eye); + camera.up.fromArray(view.up); + view.camera = camera; + } + + scene = new THREE.Scene(); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 0, 1); + scene.add(light); + + // shadow + + const canvas = document.createElement('canvas'); + canvas.width = 128; + canvas.height = 128; + + const context = canvas.getContext('2d'); + const gradient = context.createRadialGradient( + canvas.width / 2, + canvas.height / 2, + 0, + canvas.width / 2, + canvas.height / 2, + canvas.width / 2, + ); + gradient.addColorStop(0.1, 'rgba(0,0,0,0.15)'); + gradient.addColorStop(1, 'rgba(0,0,0,0)'); + + context.fillStyle = gradient; + context.fillRect(0, 0, canvas.width, canvas.height); + + const shadowTexture = new THREE.CanvasTexture(canvas); + + const shadowMaterial = new THREE.MeshBasicMaterial({ map: shadowTexture, transparent: true }); + const shadowGeo = new THREE.PlaneGeometry(300, 300, 1, 1); + + let shadowMesh; + + shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); + shadowMesh.position.y = -250; + shadowMesh.rotation.x = -Math.PI / 2; + scene.add(shadowMesh); + + shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); + shadowMesh.position.x = -400; + shadowMesh.position.y = -250; + shadowMesh.rotation.x = -Math.PI / 2; + scene.add(shadowMesh); + + shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); + shadowMesh.position.x = 400; + shadowMesh.position.y = -250; + shadowMesh.rotation.x = -Math.PI / 2; + scene.add(shadowMesh); + + const radius = 200; + + const geometry1 = new THREE.IcosahedronGeometry(radius, 1); + + const count = geometry1.attributes.position.count; + geometry1.setAttribute('color', new THREE.BufferAttribute(new Float32Array(count * 3), 3)); + + const geometry2 = geometry1.clone(); + const geometry3 = geometry1.clone(); + + const color = new THREE.Color(); + const positions1 = geometry1.attributes.position; + const positions2 = geometry2.attributes.position; + const positions3 = geometry3.attributes.position; + const colors1 = geometry1.attributes.color; + const colors2 = geometry2.attributes.color; + const colors3 = geometry3.attributes.color; + + for (let i = 0; i < count; i++) { + color.setHSL((positions1.getY(i) / radius + 1) / 2, 1.0, 0.5, THREE.SRGBColorSpace); + colors1.setXYZ(i, color.r, color.g, color.b); + + color.setHSL(0, (positions2.getY(i) / radius + 1) / 2, 0.5, THREE.SRGBColorSpace); + colors2.setXYZ(i, color.r, color.g, color.b); + + color.setRGB(1, 0.8 - (positions3.getY(i) / radius + 1) / 2, 0, THREE.SRGBColorSpace); + colors3.setXYZ(i, color.r, color.g, color.b); + } + + const material = new THREE.MeshPhongMaterial({ + color: 0xffffff, + flatShading: true, + vertexColors: true, + shininess: 0, + }); + + const wireframeMaterial = new THREE.MeshBasicMaterial({ color: 0x000000, wireframe: true, transparent: true }); + + let mesh = new THREE.Mesh(geometry1, material); + let wireframe = new THREE.Mesh(geometry1, wireframeMaterial); + mesh.add(wireframe); + mesh.position.x = -400; + mesh.rotation.x = -1.87; + scene.add(mesh); + + mesh = new THREE.Mesh(geometry2, material); + wireframe = new THREE.Mesh(geometry2, wireframeMaterial); + mesh.add(wireframe); + mesh.position.x = 400; + scene.add(mesh); + + mesh = new THREE.Mesh(geometry3, material); + wireframe = new THREE.Mesh(geometry3, wireframeMaterial); + mesh.add(wireframe); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + document.addEventListener('mousemove', onDocumentMouseMove); +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowWidth / 2; +} + +function updateSize() { + if (windowWidth != window.innerWidth || windowHeight != window.innerHeight) { + windowWidth = window.innerWidth; + windowHeight = window.innerHeight; + + renderer.setSize(windowWidth, windowHeight); + } +} + +function animate() { + render(); + stats.update(); +} + +function render() { + updateSize(); + + for (let ii = 0; ii < views.length; ++ii) { + const view = views[ii]; + const camera = view.camera; + + view.updateCamera(camera, scene, mouseX); + + const left = Math.floor(windowWidth * view.left); + const bottom = Math.floor(windowHeight * view.bottom); + const width = Math.floor(windowWidth * view.width); + const height = Math.floor(windowHeight * view.height); + + renderer.setViewport(left, bottom, width, height); + renderer.setScissor(left, bottom, width, height); + renderer.setScissorTest(true); + renderer.setClearColor(view.background); + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgl_multisampled_renderbuffers.ts b/examples-testing/examples/webgl_multisampled_renderbuffers.ts new file mode 100644 index 000000000..df84fb144 --- /dev/null +++ b/examples-testing/examples/webgl_multisampled_renderbuffers.ts @@ -0,0 +1,133 @@ +import * as THREE from 'three'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, renderer, group, container; + +let composer1, composer2; + +const params = { + animate: true, +}; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, container.offsetWidth / container.offsetHeight, 10, 2000); + camera.position.z = 500; + + const scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + scene.fog = new THREE.Fog(0xcccccc, 100, 1500); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x222222, 5); + hemiLight.position.set(1, 1, 1); + scene.add(hemiLight); + + // + + group = new THREE.Group(); + + const geometry = new THREE.SphereGeometry(10, 64, 40); + const material = new THREE.MeshLambertMaterial({ + color: 0xee0808, + polygonOffset: true, + polygonOffsetFactor: 1, // positive value pushes polygon further away + polygonOffsetUnits: 1, + }); + const material2 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); + + for (let i = 0; i < 50; i++) { + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = Math.random() * 600 - 300; + mesh.position.y = Math.random() * 600 - 300; + mesh.position.z = Math.random() * 600 - 300; + mesh.rotation.x = Math.random(); + mesh.rotation.z = Math.random(); + mesh.scale.setScalar(Math.random() * 5 + 5); + group.add(mesh); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.position.copy(mesh.position); + mesh2.rotation.copy(mesh.rotation); + mesh2.scale.copy(mesh.scale); + group.add(mesh2); + } + + scene.add(group); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(container.offsetWidth, container.offsetHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + container.appendChild(renderer.domElement); + + // + + const size = renderer.getDrawingBufferSize(new THREE.Vector2()); + const renderTarget = new THREE.WebGLRenderTarget(size.width, size.height, { + samples: 4, + type: THREE.HalfFloatType, + }); + + const renderPass = new RenderPass(scene, camera); + const outputPass = new OutputPass(); + + // + + composer1 = new EffectComposer(renderer); + composer1.addPass(renderPass); + composer1.addPass(outputPass); + + // + + composer2 = new EffectComposer(renderer, renderTarget); + composer2.addPass(renderPass); + composer2.addPass(outputPass); + + // + + const gui = new GUI(); + gui.add(params, 'animate'); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = container.offsetWidth / container.offsetHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(container.offsetWidth, container.offsetHeight); + composer1.setSize(container.offsetWidth, container.offsetHeight); + composer2.setSize(container.offsetWidth, container.offsetHeight); +} + +function animate() { + const halfWidth = container.offsetWidth / 2; + + if (params.animate) { + group.rotation.y += 0.002; + } + + renderer.setScissorTest(true); + + renderer.setScissor(0, 0, halfWidth - 1, container.offsetHeight); + composer1.render(); + + renderer.setScissor(halfWidth, 0, halfWidth, container.offsetHeight); + composer2.render(); + + renderer.setScissorTest(false); +} diff --git a/examples-testing/examples/webgl_panorama_cube.ts b/examples-testing/examples/webgl_panorama_cube.ts new file mode 100644 index 000000000..efd09cfc5 --- /dev/null +++ b/examples-testing/examples/webgl_panorama_cube.ts @@ -0,0 +1,83 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, controls; +let renderer; +let scene; + +init(); + +function init() { + const container = document.getElementById('container'); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(90, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 0.01; + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enablePan = false; + controls.enableDamping = true; + controls.rotateSpeed = -0.25; + + const textures = getTexturesFromAtlasFile('textures/cube/sun_temple_stripe.jpg', 6); + + const materials = []; + + for (let i = 0; i < 6; i++) { + materials.push(new THREE.MeshBasicMaterial({ map: textures[i] })); + } + + const skyBox = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), materials); + skyBox.geometry.scale(1, 1, -1); + scene.add(skyBox); + + window.addEventListener('resize', onWindowResize); +} + +function getTexturesFromAtlasFile(atlasImgUrl, tilesNum) { + const textures = []; + + for (let i = 0; i < tilesNum; i++) { + textures[i] = new THREE.Texture(); + } + + new THREE.ImageLoader().load(atlasImgUrl, image => { + let canvas, context; + const tileWidth = image.height; + + for (let i = 0; i < textures.length; i++) { + canvas = document.createElement('canvas'); + context = canvas.getContext('2d'); + canvas.height = tileWidth; + canvas.width = tileWidth; + context.drawImage(image, tileWidth * i, 0, tileWidth, tileWidth, 0, 0, tileWidth, tileWidth); + textures[i].colorSpace = THREE.SRGBColorSpace; + textures[i].image = canvas; + textures[i].needsUpdate = true; + } + }); + + return textures; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); // required when damping is enabled + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_panorama_equirectangular.ts b/examples-testing/examples/webgl_panorama_equirectangular.ts new file mode 100644 index 000000000..35949ee6f --- /dev/null +++ b/examples-testing/examples/webgl_panorama_equirectangular.ts @@ -0,0 +1,112 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; + +let isUserInteracting = false, + onPointerDownMouseX = 0, + onPointerDownMouseY = 0, + lon = 0, + onPointerDownLon = 0, + lat = 0, + onPointerDownLat = 0, + phi = 0, + theta = 0; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1100); + + scene = new THREE.Scene(); + + const geometry = new THREE.SphereGeometry(500, 60, 40); + // invert the geometry on the x-axis so that all of the faces point inward + geometry.scale(-1, 1, 1); + + const texture = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); + texture.colorSpace = THREE.SRGBColorSpace; + const material = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh = new THREE.Mesh(geometry, material); + + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + container.style.touchAction = 'none'; + container.addEventListener('pointerdown', onPointerDown); + + document.addEventListener('wheel', onDocumentMouseWheel); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerDown(event) { + if (event.isPrimary === false) return; + + isUserInteracting = true; + + onPointerDownMouseX = event.clientX; + onPointerDownMouseY = event.clientY; + + onPointerDownLon = lon; + onPointerDownLat = lat; + + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerup', onPointerUp); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + lon = (onPointerDownMouseX - event.clientX) * 0.1 + onPointerDownLon; + lat = (event.clientY - onPointerDownMouseY) * 0.1 + onPointerDownLat; +} + +function onPointerUp(event) { + if (event.isPrimary === false) return; + + isUserInteracting = false; + + document.removeEventListener('pointermove', onPointerMove); + document.removeEventListener('pointerup', onPointerUp); +} + +function onDocumentMouseWheel(event) { + const fov = camera.fov + event.deltaY * 0.05; + + camera.fov = THREE.MathUtils.clamp(fov, 10, 75); + + camera.updateProjectionMatrix(); +} + +function animate() { + if (isUserInteracting === false) { + lon += 0.1; + } + + lat = Math.max(-85, Math.min(85, lat)); + phi = THREE.MathUtils.degToRad(90 - lat); + theta = THREE.MathUtils.degToRad(lon); + + const x = 500 * Math.sin(phi) * Math.cos(theta); + const y = 500 * Math.cos(phi); + const z = 500 * Math.sin(phi) * Math.sin(theta); + + camera.lookAt(x, y, z); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_performance.ts b/examples-testing/examples/webgl_performance.ts new file mode 100644 index 000000000..697ea36fb --- /dev/null +++ b/examples-testing/examples/webgl_performance.ts @@ -0,0 +1,77 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +let camera, scene, renderer, stats; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(60, 60, 60); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.environment = texture; + + // model + + const loader = new GLTFLoader().setPath('models/gltf/'); + loader.load('dungeon_warkarma.glb', async function (gltf) { + const model = gltf.scene; + + // wait until the model can be added to the scene without blocking due to shader compilation + + await renderer.compileAsync(model, camera, scene); + + scene.add(model); + }); + }); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 60; + controls.target.set(0, 0, -0.2); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_pmrem_cubemap.ts b/examples-testing/examples/webgl_pmrem_cubemap.ts new file mode 100644 index 000000000..fb5bdafc1 --- /dev/null +++ b/examples-testing/examples/webgl_pmrem_cubemap.ts @@ -0,0 +1,76 @@ +import * as THREE from 'three'; + +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(0, 0, 8); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.update(); + + new HDRCubeTextureLoader() + .setPath('./textures/cube/pisaHDR/') + .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (map) { + const pmremGenerator = new THREE.PMREMGenerator(renderer); + const envMap = pmremGenerator.fromCubemap(map).texture; + + scene.background = envMap; + scene.backgroundBlurriness = 0.5; + + pmremGenerator.dispose(); + + const geometry = new THREE.SphereGeometry(0.4, 64, 64); + + for (let i = 0; i < 6; i++) { + for (let j = 0; j < 5; j++) { + const material = new THREE.MeshPhysicalMaterial({ + roughness: i / 5, + metalness: j / 4, + envMap: envMap, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = i - 2.5; + mesh.position.y = j - 2; + scene.add(mesh); + } + } + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_pmrem_equirectangular.ts b/examples-testing/examples/webgl_pmrem_equirectangular.ts new file mode 100644 index 000000000..e7b8e76df --- /dev/null +++ b/examples-testing/examples/webgl_pmrem_equirectangular.ts @@ -0,0 +1,76 @@ +import * as THREE from 'three'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(0, 0, 8); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.update(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (map) { + map.mapping = THREE.EquirectangularReflectionMapping; + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + const envMap = pmremGenerator.fromEquirectangular(map).texture; + + scene.background = envMap; + scene.backgroundBlurriness = 0.5; + + pmremGenerator.dispose(); + + const geometry = new THREE.SphereGeometry(0.4, 64, 64); + + for (let i = 0; i < 6; i++) { + for (let j = 0; j < 5; j++) { + const material = new THREE.MeshPhysicalMaterial({ + roughness: i / 5, + metalness: j / 4, + envMap: envMap, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = i - 2.5; + mesh.position.y = j - 2; + scene.add(mesh); + } + } + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_pmrem_test.ts b/examples-testing/examples/webgl_pmrem_test.ts new file mode 100644 index 000000000..3c482338f --- /dev/null +++ b/examples-testing/examples/webgl_pmrem_test.ts @@ -0,0 +1,141 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, controls, renderer; + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + const aspect = width / height; + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + + // tonemapping + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + // scene + + scene = new THREE.Scene(); + + // camera + + camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); + updateCamera(); + camera.position.set(0, 0, 16); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 4; + controls.maxDistance = 20; + + // light + + const directionalLight = new THREE.DirectionalLight(0xffffff, 0); // set intensity to 0 to start + const x = 597; + const y = 213; + const theta = ((x + 0.5) * Math.PI) / 512; + const phi = ((y + 0.5) * Math.PI) / 512; + + directionalLight.position.setFromSphericalCoords(100, -phi, Math.PI / 2 - theta); + + scene.add(directionalLight); + // scene.add( new THREE.DirectionalLightHelper( directionalLight ) ); + + // The spot1Lux HDR environment map is expressed in nits (lux / sr). The directional light has units of lux, + // so to match a 1 lux light, we set a single pixel with a value equal to 1 divided by the solid + // angle of the pixel in steradians. This image is 1024 x 512, + // so the value is 1 / ( sin( phi ) * ( pi / 512 ) ^ 2 ) = 27,490 nits. + + const gui = new GUI(); + gui.add({ enabled: true }, 'enabled') + .name('PMREM') + .onChange(value => { + directionalLight.intensity = value ? 0 : 1; + + scene.traverse(function (child) { + if (child.isMesh) { + child.material.envMapIntensity = 1 - directionalLight.intensity; + } + }); + + render(); + }); +} + +function createObjects() { + let radianceMap = null; + new HDRLoader() + // .setDataType( THREE.FloatType ) + .setPath('textures/equirectangular/') + .load('spot1Lux.hdr', function (texture) { + radianceMap = pmremGenerator.fromEquirectangular(texture).texture; + pmremGenerator.dispose(); + + scene.background = radianceMap; + + const geometry = new THREE.SphereGeometry(0.4, 32, 32); + + for (let x = 0; x <= 10; x++) { + for (let y = 0; y <= 2; y++) { + const material = new THREE.MeshPhysicalMaterial({ + roughness: x / 10, + metalness: y < 1 ? 1 : 0, + color: y < 2 ? 0xffffff : 0x000000, + envMap: radianceMap, + envMapIntensity: 1, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = x - 5; + mesh.position.y = 1 - y; + scene.add(mesh); + } + } + + render(); + }); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + pmremGenerator.compileEquirectangularShader(); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + updateCamera(); + + renderer.setSize(width, height); + + render(); +} + +function updateCamera() { + const horizontalFoV = 40; + const verticalFoV = + (2 * Math.atan(Math.tan(((horizontalFoV / 2) * Math.PI) / 180) / camera.aspect) * 180) / Math.PI; + camera.fov = verticalFoV; + camera.updateProjectionMatrix(); +} + +function render() { + renderer.render(scene, camera); +} + +Promise.resolve().then(init).then(createObjects).then(render); diff --git a/examples-testing/examples/webgl_points_billboards.ts b/examples-testing/examples/webgl_points_billboards.ts new file mode 100644 index 000000000..24d4de1a9 --- /dev/null +++ b/examples-testing/examples/webgl_points_billboards.ts @@ -0,0 +1,120 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, stats, material; +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 2, 2000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + scene.fog = new THREE.FogExp2(0x000000, 0.001); + + const geometry = new THREE.BufferGeometry(); + const vertices = []; + + const sprite = new THREE.TextureLoader().load('textures/sprites/disc.png'); + sprite.colorSpace = THREE.SRGBColorSpace; + + for (let i = 0; i < 10000; i++) { + const x = 2000 * Math.random() - 1000; + const y = 2000 * Math.random() - 1000; + const z = 2000 * Math.random() - 1000; + + vertices.push(x, y, z); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + material = new THREE.PointsMaterial({ + size: 35, + sizeAttenuation: true, + map: sprite, + alphaTest: 0.5, + transparent: true, + }); + material.color.setHSL(1.0, 0.3, 0.7, THREE.SRGBColorSpace); + + const particles = new THREE.Points(geometry, material); + scene.add(particles); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + const gui = new GUI(); + + gui.add(material, 'sizeAttenuation').onChange(function () { + material.needsUpdate = true; + }); + + gui.open(); + + // + + document.body.style.touchAction = 'none'; + document.body.addEventListener('pointermove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.00005; + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + const h = ((360 * (1.0 + time)) % 360) / 360; + material.color.setHSL(h, 0.5, 0.5); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_points_sprites.ts b/examples-testing/examples/webgl_points_sprites.ts new file mode 100644 index 000000000..31b9e2ce1 --- /dev/null +++ b/examples-testing/examples/webgl_points_sprites.ts @@ -0,0 +1,167 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, stats, parameters; +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +const materials = []; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + scene.fog = new THREE.FogExp2(0x000000, 0.0008); + + const geometry = new THREE.BufferGeometry(); + const vertices = []; + + const textureLoader = new THREE.TextureLoader(); + + const assignSRGB = texture => { + texture.colorSpace = THREE.SRGBColorSpace; + }; + + const sprite1 = textureLoader.load('textures/sprites/snowflake1.png', assignSRGB); + const sprite2 = textureLoader.load('textures/sprites/snowflake2.png', assignSRGB); + const sprite3 = textureLoader.load('textures/sprites/snowflake3.png', assignSRGB); + const sprite4 = textureLoader.load('textures/sprites/snowflake4.png', assignSRGB); + const sprite5 = textureLoader.load('textures/sprites/snowflake5.png', assignSRGB); + + for (let i = 0; i < 10000; i++) { + const x = Math.random() * 2000 - 1000; + const y = Math.random() * 2000 - 1000; + const z = Math.random() * 2000 - 1000; + + vertices.push(x, y, z); + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + parameters = [ + [[1.0, 0.2, 0.5], sprite2, 20], + [[0.95, 0.1, 0.5], sprite3, 15], + [[0.9, 0.05, 0.5], sprite1, 10], + [[0.85, 0, 0.5], sprite5, 8], + [[0.8, 0, 0.5], sprite4, 5], + ]; + + for (let i = 0; i < parameters.length; i++) { + const color = parameters[i][0]; + const sprite = parameters[i][1]; + const size = parameters[i][2]; + + materials[i] = new THREE.PointsMaterial({ + size: size, + map: sprite, + blending: THREE.AdditiveBlending, + depthTest: false, + transparent: true, + }); + materials[i].color.setHSL(color[0], color[1], color[2], THREE.SRGBColorSpace); + + const particles = new THREE.Points(geometry, materials[i]); + + particles.rotation.x = Math.random() * 6; + particles.rotation.y = Math.random() * 6; + particles.rotation.z = Math.random() * 6; + + scene.add(particles); + } + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + const gui = new GUI(); + + const params = { + texture: true, + }; + + gui.add(params, 'texture').onChange(function (value) { + for (let i = 0; i < materials.length; i++) { + materials[i].map = value === true ? parameters[i][1] : null; + materials[i].needsUpdate = true; + } + }); + + gui.open(); + + document.body.style.touchAction = 'none'; + document.body.addEventListener('pointermove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.00005; + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + for (let i = 0; i < scene.children.length; i++) { + const object = scene.children[i]; + + if (object instanceof THREE.Points) { + object.rotation.y = time * (i < 4 ? i + 1 : -(i + 1)); + } + } + + for (let i = 0; i < materials.length; i++) { + const color = parameters[i][0]; + + const h = ((360 * (color[0] + time)) % 360) / 360; + materials[i].color.setHSL(h, color[1], color[2], THREE.SRGBColorSpace); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_points_waves.ts b/examples-testing/examples/webgl_points_waves.ts new file mode 100644 index 000000000..91986e9e9 --- /dev/null +++ b/examples-testing/examples/webgl_points_waves.ts @@ -0,0 +1,145 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +const SEPARATION = 100, + AMOUNTX = 50, + AMOUNTY = 50; + +let container, stats; +let camera, scene, renderer; + +let particles, + count = 0; + +let mouseX = 0, + mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + + // + + const numParticles = AMOUNTX * AMOUNTY; + + const positions = new Float32Array(numParticles * 3); + const scales = new Float32Array(numParticles); + + let i = 0, + j = 0; + + for (let ix = 0; ix < AMOUNTX; ix++) { + for (let iy = 0; iy < AMOUNTY; iy++) { + positions[i] = ix * SEPARATION - (AMOUNTX * SEPARATION) / 2; // x + positions[i + 1] = 0; // y + positions[i + 2] = iy * SEPARATION - (AMOUNTY * SEPARATION) / 2; // z + + scales[j] = 1; + + i += 3; + j++; + } + } + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + geometry.setAttribute('scale', new THREE.BufferAttribute(scales, 1)); + + const material = new THREE.ShaderMaterial({ + uniforms: { + color: { value: new THREE.Color(0xffffff) }, + }, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + }); + + // + + particles = new THREE.Points(geometry, material); + scene.add(particles); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + container.style.touchAction = 'none'; + container.addEventListener('pointermove', onPointerMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + camera.lookAt(scene.position); + + const positions = particles.geometry.attributes.position.array; + const scales = particles.geometry.attributes.scale.array; + + let i = 0, + j = 0; + + for (let ix = 0; ix < AMOUNTX; ix++) { + for (let iy = 0; iy < AMOUNTY; iy++) { + positions[i + 1] = Math.sin((ix + count) * 0.3) * 50 + Math.sin((iy + count) * 0.5) * 50; + + scales[j] = (Math.sin((ix + count) * 0.3) + 1) * 20 + (Math.sin((iy + count) * 0.5) + 1) * 20; + + i += 3; + j++; + } + } + + particles.geometry.attributes.position.needsUpdate = true; + particles.geometry.attributes.scale.needsUpdate = true; + + renderer.render(scene, camera); + + count += 0.1; +} diff --git a/examples-testing/examples/webgl_portal.ts b/examples-testing/examples/webgl_portal.ts new file mode 100644 index 000000000..4bc59593f --- /dev/null +++ b/examples-testing/examples/webgl_portal.ts @@ -0,0 +1,218 @@ +import * as THREE from 'three'; + +import * as CameraUtils from 'three/addons/utils/CameraUtils.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; + +let cameraControls; + +let smallSphereOne, smallSphereTwo; + +let portalCamera, + leftPortal, + rightPortal, + leftPortalTexture, + reflectedPosition, + rightPortalTexture, + bottomLeftCorner, + bottomRightCorner, + topLeftCorner; + +init(); + +function init() { + const container = document.getElementById('container'); + + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.localClippingEnabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + container.appendChild(renderer.domElement); + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.set(0, 75, 160); + + cameraControls = new OrbitControls(camera, renderer.domElement); + cameraControls.target.set(0, 40, 0); + cameraControls.maxDistance = 400; + cameraControls.minDistance = 10; + cameraControls.update(); + + // + + const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); + + // bouncing icosphere + const portalPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0.0); + const geometry = new THREE.IcosahedronGeometry(5, 0); + const material = new THREE.MeshPhongMaterial({ + color: 0xffffff, + emissive: 0x333333, + flatShading: true, + clippingPlanes: [portalPlane], + clipShadows: true, + }); + smallSphereOne = new THREE.Mesh(geometry, material); + scene.add(smallSphereOne); + smallSphereTwo = new THREE.Mesh(geometry, material); + scene.add(smallSphereTwo); + + // portals + portalCamera = new THREE.PerspectiveCamera(45, 1.0, 0.1, 500.0); + scene.add(portalCamera); + //frustumHelper = new THREE.CameraHelper( portalCamera ); + //scene.add( frustumHelper ); + bottomLeftCorner = new THREE.Vector3(); + bottomRightCorner = new THREE.Vector3(); + topLeftCorner = new THREE.Vector3(); + reflectedPosition = new THREE.Vector3(); + + leftPortalTexture = new THREE.WebGLRenderTarget(256, 256); + leftPortal = new THREE.Mesh(planeGeo, new THREE.MeshBasicMaterial({ map: leftPortalTexture.texture })); + leftPortal.position.x = -30; + leftPortal.position.y = 20; + leftPortal.scale.set(0.35, 0.35, 0.35); + scene.add(leftPortal); + + rightPortalTexture = new THREE.WebGLRenderTarget(256, 256); + rightPortal = new THREE.Mesh(planeGeo, new THREE.MeshBasicMaterial({ map: rightPortalTexture.texture })); + rightPortal.position.x = 30; + rightPortal.position.y = 20; + rightPortal.scale.set(0.35, 0.35, 0.35); + scene.add(rightPortal); + + // walls + const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeTop.position.y = 100; + planeTop.rotateX(Math.PI / 2); + scene.add(planeTop); + + const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeBottom.rotateX(-Math.PI / 2); + scene.add(planeBottom); + + const planeFront = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); + planeFront.position.z = 50; + planeFront.position.y = 50; + planeFront.rotateY(Math.PI); + scene.add(planeFront); + + const planeBack = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff7fff })); + planeBack.position.z = -50; + planeBack.position.y = 50; + //planeBack.rotateY( Math.PI ); + scene.add(planeBack); + + const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); + planeRight.position.x = 50; + planeRight.position.y = 50; + planeRight.rotateY(-Math.PI / 2); + scene.add(planeRight); + + const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); + planeLeft.position.x = -50; + planeLeft.position.y = 50; + planeLeft.rotateY(Math.PI / 2); + scene.add(planeLeft); + + // lights + const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); + mainLight.position.y = 60; + scene.add(mainLight); + + const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); + greenLight.position.set(550, 50, 0); + scene.add(greenLight); + + const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); + redLight.position.set(-550, 50, 0); + scene.add(redLight); + + const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); + blueLight.position.set(0, 50, 550); + scene.add(blueLight); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function renderPortal(thisPortalMesh, otherPortalMesh, thisPortalTexture) { + // set the portal camera position to be reflected about the portal plane + thisPortalMesh.worldToLocal(reflectedPosition.copy(camera.position)); + reflectedPosition.x *= -1.0; + reflectedPosition.z *= -1.0; + otherPortalMesh.localToWorld(reflectedPosition); + portalCamera.position.copy(reflectedPosition); + + // grab the corners of the other portal + // - note: the portal is viewed backwards; flip the left/right coordinates + otherPortalMesh.localToWorld(bottomLeftCorner.set(50.05, -50.05, 0.0)); + otherPortalMesh.localToWorld(bottomRightCorner.set(-50.05, -50.05, 0.0)); + otherPortalMesh.localToWorld(topLeftCorner.set(50.05, 50.05, 0.0)); + // set the projection matrix to encompass the portal's frame + CameraUtils.frameCorners(portalCamera, bottomLeftCorner, bottomRightCorner, topLeftCorner, false); + + // render the portal + thisPortalTexture.texture.colorSpace = renderer.outputColorSpace; + renderer.setRenderTarget(thisPortalTexture); + renderer.state.buffers.depth.setMask(true); // make sure the depth buffer is writable so it can be properly cleared, see #18897 + if (renderer.autoClear === false) renderer.clear(); + thisPortalMesh.visible = false; // hide this portal from its own rendering + renderer.render(scene, portalCamera); + thisPortalMesh.visible = true; // re-enable this portal's visibility for general rendering +} + +function animate() { + // move the bouncing sphere(s) + const timerOne = Date.now() * 0.01; + const timerTwo = timerOne + Math.PI * 10.0; + + smallSphereOne.position.set( + Math.cos(timerOne * 0.1) * 30, + Math.abs(Math.cos(timerOne * 0.2)) * 20 + 5, + Math.sin(timerOne * 0.1) * 30, + ); + smallSphereOne.rotation.y = Math.PI / 2 - timerOne * 0.1; + smallSphereOne.rotation.z = timerOne * 0.8; + + smallSphereTwo.position.set( + Math.cos(timerTwo * 0.1) * 30, + Math.abs(Math.cos(timerTwo * 0.2)) * 20 + 5, + Math.sin(timerTwo * 0.1) * 30, + ); + smallSphereTwo.rotation.y = Math.PI / 2 - timerTwo * 0.1; + smallSphereTwo.rotation.z = timerTwo * 0.8; + + // save the original camera properties + const currentRenderTarget = renderer.getRenderTarget(); + const currentXrEnabled = renderer.xr.enabled; + const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; + renderer.xr.enabled = false; // Avoid camera modification + renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows + + // render the portal effect + renderPortal(leftPortal, rightPortal, leftPortalTexture); + renderPortal(rightPortal, leftPortal, rightPortalTexture); + + // restore the original rendering properties + renderer.xr.enabled = currentXrEnabled; + renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; + renderer.setRenderTarget(currentRenderTarget); + + // render the main scene + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_postprocessing.ts b/examples-testing/examples/webgl_postprocessing.ts new file mode 100644 index 000000000..ecc9b28ee --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing.ts @@ -0,0 +1,86 @@ +import * as THREE from 'three'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; + +import { RGBShiftShader } from 'three/addons/shaders/RGBShiftShader.js'; +import { DotScreenShader } from 'three/addons/shaders/DotScreenShader.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, renderer, composer; +let object; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 400; + + const scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x000000, 1, 1000); + + object = new THREE.Object3D(); + scene.add(object); + + const geometry = new THREE.SphereGeometry(1, 4, 4); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); + + for (let i = 0; i < 100; i++) { + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); + mesh.position.multiplyScalar(Math.random() * 400); + mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 50; + object.add(mesh); + } + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1); + scene.add(light); + + // postprocessing + + composer = new EffectComposer(renderer); + composer.addPass(new RenderPass(scene, camera)); + + const effect1 = new ShaderPass(DotScreenShader); + effect1.uniforms['scale'].value = 4; + composer.addPass(effect1); + + const effect2 = new ShaderPass(RGBShiftShader); + effect2.uniforms['amount'].value = 0.0015; + composer.addPass(effect2); + + const effect3 = new OutputPass(); + composer.addPass(effect3); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + object.rotation.x += 0.005; + object.rotation.y += 0.01; + + composer.render(); +} diff --git a/examples-testing/examples/webgl_postprocessing_advanced.ts b/examples-testing/examples/webgl_postprocessing_advanced.ts new file mode 100644 index 000000000..82fc39be3 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_advanced.ts @@ -0,0 +1,304 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; +import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; +import { FilmPass } from 'three/addons/postprocessing/FilmPass.js'; +import { DotScreenPass } from 'three/addons/postprocessing/DotScreenPass.js'; +import { MaskPass, ClearMaskPass } from 'three/addons/postprocessing/MaskPass.js'; +import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; + +import { BleachBypassShader } from 'three/addons/shaders/BleachBypassShader.js'; +import { ColorifyShader } from 'three/addons/shaders/ColorifyShader.js'; +import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; +import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; +import { SepiaShader } from 'three/addons/shaders/SepiaShader.js'; +import { VignetteShader } from 'three/addons/shaders/VignetteShader.js'; +import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let container, stats; + +let composerScene, composer1, composer2, composer3, composer4; + +let cameraOrtho, cameraPerspective, sceneModel, sceneBG, renderer, mesh, directionalLight; + +const width = window.innerWidth || 2; +const height = window.innerHeight || 2; + +let halfWidth = width / 2; +let halfHeight = height / 2; + +let quadBG, quadMask, renderScene; + +const delta = 0.01; + +init(); + +function init() { + container = document.getElementById('container'); + + // + + cameraOrtho = new THREE.OrthographicCamera(-halfWidth, halfWidth, halfHeight, -halfHeight, -10000, 10000); + cameraOrtho.position.z = 100; + + cameraPerspective = new THREE.PerspectiveCamera(50, width / height, 1, 10000); + cameraPerspective.position.z = 900; + + // + + sceneModel = new THREE.Scene(); + sceneBG = new THREE.Scene(); + + // + + directionalLight = new THREE.DirectionalLight(0xffffff, 3); + directionalLight.position.set(0, -0.1, 1).normalize(); + sceneModel.add(directionalLight); + + const loader = new GLTFLoader(); + loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + createMesh(gltf.scene.children[0].geometry, sceneModel, 100); + }); + + // + + const diffuseMap = new THREE.TextureLoader().load('textures/cube/SwedishRoyalCastle/pz.jpg'); + diffuseMap.colorSpace = THREE.SRGBColorSpace; + + const materialColor = new THREE.MeshBasicMaterial({ + map: diffuseMap, + depthTest: false, + }); + + quadBG = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), materialColor); + quadBG.position.z = -500; + quadBG.scale.set(width, height, 1); + sceneBG.add(quadBG); + + // + + const sceneMask = new THREE.Scene(); + + quadMask = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), new THREE.MeshBasicMaterial({ color: 0xffaa00 })); + quadMask.position.z = -300; + quadMask.scale.set(width / 2, height / 2, 1); + sceneMask.add(quadMask); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + + // + + container.appendChild(renderer.domElement); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + const shaderBleach = BleachBypassShader; + const shaderSepia = SepiaShader; + const shaderVignette = VignetteShader; + + const effectBleach = new ShaderPass(shaderBleach); + const effectSepia = new ShaderPass(shaderSepia); + const effectVignette = new ShaderPass(shaderVignette); + const gammaCorrection = new ShaderPass(GammaCorrectionShader); + + effectBleach.uniforms['opacity'].value = 0.95; + + effectSepia.uniforms['amount'].value = 0.9; + + effectVignette.uniforms['offset'].value = 1.6; + effectVignette.uniforms['darkness'].value = 0.95; + + const effectBloom = new BloomPass(0.5); + const effectFilm = new FilmPass(0.35); + const effectFilmBW = new FilmPass(0.35, true); + const effectDotScreen = new DotScreenPass(new THREE.Vector2(0, 0), 0.5, 0.8); + + const effectHBlur = new ShaderPass(HorizontalBlurShader); + const effectVBlur = new ShaderPass(VerticalBlurShader); + effectHBlur.uniforms['h'].value = 2 / (width / 2); + effectVBlur.uniforms['v'].value = 2 / (height / 2); + + const effectColorify1 = new ShaderPass(ColorifyShader); + const effectColorify2 = new ShaderPass(ColorifyShader); + effectColorify1.uniforms['color'] = new THREE.Uniform(new THREE.Color(1, 0.8, 0.8)); + effectColorify2.uniforms['color'] = new THREE.Uniform(new THREE.Color(1, 0.75, 0.5)); + + const clearMask = new ClearMaskPass(); + const renderMask = new MaskPass(sceneModel, cameraPerspective); + const renderMaskInverse = new MaskPass(sceneModel, cameraPerspective); + + renderMaskInverse.inverse = true; + + // + + const rtParameters = { + stencilBuffer: true, + }; + + const rtWidth = width / 2; + const rtHeight = height / 2; + + // + + const renderBackground = new RenderPass(sceneBG, cameraOrtho); + const renderModel = new RenderPass(sceneModel, cameraPerspective); + + renderModel.clear = false; + + composerScene = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth * 2, rtHeight * 2, rtParameters)); + + composerScene.addPass(renderBackground); + composerScene.addPass(renderModel); + composerScene.addPass(renderMaskInverse); + composerScene.addPass(effectHBlur); + composerScene.addPass(effectVBlur); + composerScene.addPass(clearMask); + + // + + renderScene = new TexturePass(composerScene.renderTarget2.texture); + + // + + composer1 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); + + composer1.addPass(renderScene); + composer1.addPass(gammaCorrection); + composer1.addPass(effectFilmBW); + composer1.addPass(effectVignette); + + // + + composer2 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); + + composer2.addPass(renderScene); + composer2.addPass(gammaCorrection); + composer2.addPass(effectDotScreen); + composer2.addPass(renderMask); + composer2.addPass(effectColorify1); + composer2.addPass(clearMask); + composer2.addPass(renderMaskInverse); + composer2.addPass(effectColorify2); + composer2.addPass(clearMask); + composer2.addPass(effectVignette); + + // + + composer3 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); + + composer3.addPass(renderScene); + composer3.addPass(gammaCorrection); + composer3.addPass(effectSepia); + composer3.addPass(effectFilm); + composer3.addPass(effectVignette); + + // + + composer4 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); + + composer4.addPass(renderScene); + composer4.addPass(gammaCorrection); + composer4.addPass(effectBloom); + composer4.addPass(effectFilm); + composer4.addPass(effectBleach); + composer4.addPass(effectVignette); + + renderScene.uniforms['tDiffuse'].value = composerScene.renderTarget2.texture; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + halfWidth = window.innerWidth / 2; + halfHeight = window.innerHeight / 2; + + cameraPerspective.aspect = window.innerWidth / window.innerHeight; + cameraPerspective.updateProjectionMatrix(); + + cameraOrtho.left = -halfWidth; + cameraOrtho.right = halfWidth; + cameraOrtho.top = halfHeight; + cameraOrtho.bottom = -halfHeight; + + cameraOrtho.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + composerScene.setSize(halfWidth * 2, halfHeight * 2); + + composer1.setSize(halfWidth, halfHeight); + composer2.setSize(halfWidth, halfHeight); + composer3.setSize(halfWidth, halfHeight); + composer4.setSize(halfWidth, halfHeight); + + renderScene.uniforms['tDiffuse'].value = composerScene.renderTarget2.texture; + + quadBG.scale.set(window.innerWidth, window.innerHeight, 1); + quadMask.scale.set(window.innerWidth / 2, window.innerHeight / 2, 1); +} + +function createMesh(geometry, scene, scale) { + const diffuseMap = new THREE.TextureLoader().load('models/gltf/LeePerrySmith/Map-COL.jpg'); + diffuseMap.colorSpace = THREE.SRGBColorSpace; + + const mat2 = new THREE.MeshPhongMaterial({ + color: 0xcbcbcb, + specular: 0x080808, + shininess: 20, + map: diffuseMap, + normalMap: new THREE.TextureLoader().load('models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg'), + normalScale: new THREE.Vector2(0.75, 0.75), + }); + + mesh = new THREE.Mesh(geometry, mat2); + mesh.position.set(0, -50, 0); + mesh.scale.set(scale, scale, scale); + + scene.add(mesh); +} + +// + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + const time = Date.now() * 0.0004; + + if (mesh) mesh.rotation.y = -time; + + renderer.setViewport(0, 0, halfWidth, halfHeight); + composerScene.render(delta); + + renderer.setViewport(0, 0, halfWidth, halfHeight); + composer1.render(delta); + + renderer.setViewport(halfWidth, 0, halfWidth, halfHeight); + composer2.render(delta); + + renderer.setViewport(0, halfHeight, halfWidth, halfHeight); + composer3.render(delta); + + renderer.setViewport(halfWidth, halfHeight, halfWidth, halfHeight); + composer4.render(delta); +} diff --git a/examples-testing/examples/webgl_postprocessing_afterimage.ts b/examples-testing/examples/webgl_postprocessing_afterimage.ts new file mode 100644 index 000000000..97353dcd2 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_afterimage.ts @@ -0,0 +1,72 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { AfterimagePass } from 'three/addons/postprocessing/AfterimagePass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, scene, renderer, composer; +let mesh; + +let afterimagePass; + +const params = { + enable: true, +}; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 400; + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x000000, 1, 1000); + + const geometry = new THREE.BoxGeometry(150, 150, 150, 2, 2, 2); + const material = new THREE.MeshNormalMaterial(); + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // postprocessing + + composer = new EffectComposer(renderer); + composer.addPass(new RenderPass(scene, camera)); + + afterimagePass = new AfterimagePass(); + composer.addPass(afterimagePass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI({ title: 'Damp setting' }); + gui.add(afterimagePass, 'damp', 0, 1).step(0.001); + gui.add(params, 'enable'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.rotation.x += 0.005; + mesh.rotation.y += 0.01; + + afterimagePass.enabled = params.enable; + + composer.render(); +} diff --git a/examples-testing/examples/webgl_postprocessing_backgrounds.ts b/examples-testing/examples/webgl_postprocessing_backgrounds.ts new file mode 100644 index 000000000..57a6a2dbd --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_backgrounds.ts @@ -0,0 +1,214 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; +import { CubeTexturePass } from 'three/addons/postprocessing/CubeTexturePass.js'; +import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let scene, renderer, composer; +let clearPass, texturePass, renderPass; +let cameraP, cubeTexturePassP; +let gui, stats; + +const params = { + clearPass: true, + clearColor: 'white', + clearAlpha: 1.0, + + texturePass: true, + texturePassOpacity: 1.0, + + cubeTexturePass: true, + cubeTexturePassOpacity: 1.0, + + renderPass: true, +}; + +init(); + +clearGui(); + +function clearGui() { + if (gui) gui.destroy(); + + gui = new GUI(); + + gui.add(params, 'clearPass'); + gui.add(params, 'clearColor', ['black', 'white', 'blue', 'green', 'red']); + gui.add(params, 'clearAlpha', 0, 1); + + gui.add(params, 'texturePass'); + gui.add(params, 'texturePassOpacity', 0, 1); + + gui.add(params, 'cubeTexturePass'); + gui.add(params, 'cubeTexturePassOpacity', 0, 1); + + gui.add(params, 'renderPass'); + + gui.open(); +} + +function init() { + const container = document.getElementById('container'); + + const width = window.innerWidth || 1; + const height = window.innerHeight || 1; + const aspect = width / height; + const devicePixelRatio = window.devicePixelRatio || 1; + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + cameraP = new THREE.PerspectiveCamera(65, aspect, 1, 10); + cameraP.position.z = 7; + + scene = new THREE.Scene(); + + const group = new THREE.Group(); + scene.add(group); + + const light = new THREE.PointLight(0xefffef, 500); + light.position.z = 10; + light.position.y = -10; + light.position.x = -10; + scene.add(light); + + const light2 = new THREE.PointLight(0xffefef, 500); + light2.position.z = 10; + light2.position.x = -10; + light2.position.y = 10; + scene.add(light2); + + const light3 = new THREE.PointLight(0xefefff, 500); + light3.position.z = 10; + light3.position.x = 10; + light3.position.y = -10; + scene.add(light3); + + const geometry = new THREE.SphereGeometry(1, 48, 24); + + const material = new THREE.MeshStandardMaterial(); + material.roughness = 0.5 * Math.random() + 0.25; + material.metalness = 0; + material.color.setHSL(Math.random(), 1.0, 0.3); + + const mesh = new THREE.Mesh(geometry, material); + group.add(mesh); + + // postprocessing + + const genCubeUrls = function (prefix, postfix) { + return [ + prefix + 'px' + postfix, + prefix + 'nx' + postfix, + prefix + 'py' + postfix, + prefix + 'ny' + postfix, + prefix + 'pz' + postfix, + prefix + 'nz' + postfix, + ]; + }; + + composer = new EffectComposer(renderer); + + clearPass = new ClearPass(params.clearColor, params.clearAlpha); + composer.addPass(clearPass); + + texturePass = new TexturePass(); + composer.addPass(texturePass); + + const textureLoader = new THREE.TextureLoader(); + textureLoader.load('textures/hardwood2_diffuse.jpg', function (map) { + map.colorSpace = THREE.SRGBColorSpace; + texturePass.map = map; + }); + + cubeTexturePassP = null; + + const ldrUrls = genCubeUrls('textures/cube/pisa/', '.png'); + new THREE.CubeTextureLoader().load(ldrUrls, function (ldrCubeMap) { + cubeTexturePassP = new CubeTexturePass(cameraP, ldrCubeMap); + composer.insertPass(cubeTexturePassP, 2); + }); + + renderPass = new RenderPass(scene, cameraP); + renderPass.clear = false; + composer.addPass(renderPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + const controls = new OrbitControls(cameraP, renderer.domElement); + controls.enableZoom = false; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + const aspect = width / height; + + cameraP.aspect = aspect; + cameraP.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + stats.begin(); + + cameraP.updateMatrixWorld(true); + + let newColor = clearPass.clearColor; + + switch (params.clearColor) { + case 'blue': + newColor = 0x0000ff; + break; + case 'red': + newColor = 0xff0000; + break; + case 'green': + newColor = 0x00ff00; + break; + case 'white': + newColor = 0xffffff; + break; + case 'black': + newColor = 0x000000; + break; + } + + clearPass.enabled = params.clearPass; + clearPass.clearColor = newColor; + clearPass.clearAlpha = params.clearAlpha; + + texturePass.enabled = params.texturePass; + texturePass.opacity = params.texturePassOpacity; + + if (cubeTexturePassP !== null) { + cubeTexturePassP.enabled = params.cubeTexturePass; + cubeTexturePassP.opacity = params.cubeTexturePassOpacity; + } + + renderPass.enabled = params.renderPass; + + composer.render(); + + stats.end(); +} diff --git a/examples-testing/examples/webgl_postprocessing_fxaa.ts b/examples-testing/examples/webgl_postprocessing_fxaa.ts new file mode 100644 index 000000000..c5e632ad7 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_fxaa.ts @@ -0,0 +1,122 @@ +import * as THREE from 'three'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +import { FXAAPass } from 'three/addons/postprocessing/FXAAPass.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, controls, container; + +let composer1, composer2, fxaaPass; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, container.offsetWidth / container.offsetHeight, 1, 2000); + camera.position.z = 500; + + scene = new THREE.Scene(); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d); + hemiLight.position.set(0, 1000, 0); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(-3000, 1000, -1000); + scene.add(dirLight); + + // + + const geometry = new THREE.TetrahedronGeometry(10); + const material = new THREE.MeshStandardMaterial({ color: 0xf73232, flatShading: true }); + + const mesh = new THREE.InstancedMesh(geometry, material, 100); + const dummy = new THREE.Object3D(); + + for (let i = 0; i < 100; i++) { + dummy.position.x = Math.random() * 500 - 250; + dummy.position.y = Math.random() * 500 - 250; + dummy.position.z = Math.random() * 500 - 250; + + dummy.scale.setScalar(Math.random() * 2 + 1); + + dummy.rotation.x = Math.random() * Math.PI; + dummy.rotation.y = Math.random() * Math.PI; + dummy.rotation.z = Math.random() * Math.PI; + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + } + + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(container.offsetWidth, container.offsetHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + container.appendChild(renderer.domElement); + + // + + const renderPass = new RenderPass(scene, camera); + renderPass.clearAlpha = 0; + + // + + fxaaPass = new FXAAPass(); + + const outputPass = new OutputPass(); + + composer1 = new EffectComposer(renderer); + composer1.addPass(renderPass); + composer1.addPass(outputPass); + + // + + composer2 = new EffectComposer(renderer); + composer2.addPass(renderPass); + composer2.addPass(outputPass); + + // FXAA is engineered to be applied towards the end of engine post processing after conversion to low dynamic range and conversion to the sRGB color space for display. + + composer2.addPass(fxaaPass); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = container.offsetWidth / container.offsetHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(container.offsetWidth, container.offsetHeight); + composer1.setSize(container.offsetWidth, container.offsetHeight); + composer2.setSize(container.offsetWidth, container.offsetHeight); +} + +function animate() { + const halfWidth = container.offsetWidth / 2; + + controls.update(); + + renderer.setScissorTest(true); + + renderer.setScissor(0, 0, halfWidth - 1, container.offsetHeight); + composer1.render(); + + renderer.setScissor(halfWidth, 0, halfWidth, container.offsetHeight); + composer2.render(); + + renderer.setScissorTest(false); +} diff --git a/examples-testing/examples/webgl_postprocessing_glitch.ts b/examples-testing/examples/webgl_postprocessing_glitch.ts new file mode 100644 index 000000000..02acda572 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_glitch.ts @@ -0,0 +1,108 @@ +import * as THREE from 'three'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { GlitchPass } from 'three/addons/postprocessing/GlitchPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, scene, renderer, composer; +let object, light; + +let glitchPass; + +const button = document.querySelector('#startButton'); +button.addEventListener('click', function () { + const overlay = document.getElementById('overlay'); + overlay.remove(); + + init(); +}); + +function updateOptions() { + const wildGlitch = document.getElementById('wildGlitch'); + glitchPass.goWild = wildGlitch.checked; +} + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 400; + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x000000, 1, 1000); + + object = new THREE.Object3D(); + scene.add(object); + + const geometry = new THREE.SphereGeometry(1, 4, 4); + const material = new THREE.MeshPhongMaterial({ flatShading: true }); + + const mesh = new THREE.InstancedMesh(geometry, material, 100); + const dummy = new THREE.Object3D(); + const color = new THREE.Color(); + + for (let i = 0; i < 100; i++) { + dummy.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); + dummy.position.multiplyScalar(Math.random() * 400); + dummy.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); + + const scale = Math.random() * 50; + dummy.scale.set(scale, scale, scale); + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + + color.setHex(0xffffff * Math.random()); + mesh.setColorAt(i, color); + } + + object.add(mesh); + + scene.add(new THREE.AmbientLight(0xcccccc)); + + light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1); + scene.add(light); + + // postprocessing + + composer = new EffectComposer(renderer); + composer.addPass(new RenderPass(scene, camera)); + + glitchPass = new GlitchPass(); + composer.addPass(glitchPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + // + + window.addEventListener('resize', onWindowResize); + + const wildGlitchOption = document.getElementById('wildGlitch'); + wildGlitchOption.addEventListener('change', updateOptions); + + updateOptions(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + object.rotation.x += 0.005; + object.rotation.y += 0.01; + + composer.render(); +} diff --git a/examples-testing/examples/webgl_postprocessing_godrays.ts b/examples-testing/examples/webgl_postprocessing_godrays.ts new file mode 100644 index 000000000..b7c2c6661 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_godrays.ts @@ -0,0 +1,176 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { EffectComposer, RenderPass } from 'postprocessing'; +import { GodraysPass } from 'goodrays'; + +let camera, scene, renderer, composer; +let controls, stats; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(-175, 50, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + // asset + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/godrays_demo.glb'); + scene.add(gltf.scene); + + const pillars = gltf.scene.getObjectByName('concrete'); + pillars.material = new THREE.MeshStandardMaterial({ + color: 0x333333, + }); + + const base = gltf.scene.getObjectByName('base'); + base.material = new THREE.MeshStandardMaterial({ + color: 0x333333, + side: THREE.DoubleSide, + }); + + setupBackdrop(); + + // lights + + const lightPos = new THREE.Vector3(0, 50, 0); + const lightSphereMaterial = new THREE.MeshBasicMaterial({ + color: 0xffffff, + }); + const lightSphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 16, 16), lightSphereMaterial); + lightSphere.position.copy(lightPos); + scene.add(lightSphere); + + scene.add(new THREE.AmbientLight(0xcccccc, 0.4)); + + const pointLight = new THREE.PointLight(0xf6287d, 10000); + pointLight.castShadow = true; + pointLight.shadow.bias = -0.001; + pointLight.shadow.mapSize.width = 1024; + pointLight.shadow.mapSize.height = 1024; + pointLight.position.copy(lightPos); + scene.add(pointLight); + + // shadow setup + + scene.traverse(obj => { + if (obj.isMesh === true) { + obj.castShadow = true; + obj.receiveShadow = true; + } + }); + + lightSphere.castShadow = false; + lightSphere.receiveShadow = false; + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // + + composer = new EffectComposer(renderer, { frameBufferType: THREE.HalfFloatType }); + + const renderPass = new RenderPass(scene, camera); + composer.addPass(renderPass); + + const params = { + density: 1 / 128, + maxDensity: 0.5, + edgeStrength: 2, + edgeRadius: 2, + distanceAttenuation: 2, + color: new THREE.Color(0xf6287d), + raymarchSteps: 60, + blur: true, + gammaCorrection: true, + }; + + const godraysPass = new GodraysPass(pointLight, camera, params); + godraysPass.renderToScreen = true; + composer.addPass(godraysPass); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.5, 0); + controls.enableDamping = true; + controls.maxDistance = 200; + controls.update(); + + // + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function setupBackdrop() { + const backdropDistance = 200; + // Add backdrop walls `backdropDistance` units away from the origin + const backdropGeometry = new THREE.PlaneGeometry(400, 200); + const backdropMaterial = new THREE.MeshBasicMaterial({ + color: 0x200808, + side: THREE.DoubleSide, + }); + const backdropLeft = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropLeft.position.set(-backdropDistance, 100, 0); + backdropLeft.rotateY(Math.PI / 2); + scene.add(backdropLeft); + + const backdropRight = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropRight.position.set(backdropDistance, 100, 0); + backdropRight.rotateY(Math.PI / 2); + scene.add(backdropRight); + + const backdropFront = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropFront.position.set(0, 100, -backdropDistance); + scene.add(backdropFront); + + const backdropBack = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropBack.position.set(0, 100, backdropDistance); + scene.add(backdropBack); + + const backdropTop = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropTop.position.set(0, 200, 0); + backdropTop.rotateX(Math.PI / 2); + backdropTop.scale.set(3, 6, 1); + scene.add(backdropTop); +} + +function animate() { + controls.update(); + + stats.begin(); + + composer.render(); + + //renderer.render( scene, camera ); + + stats.end(); +} diff --git a/examples-testing/examples/webgl_postprocessing_gtao.ts b/examples-testing/examples/webgl_postprocessing_gtao.ts new file mode 100644 index 000000000..7c39b8364 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_gtao.ts @@ -0,0 +1,216 @@ +import * as THREE from 'three'; +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { GTAOPass } from 'three/addons/postprocessing/GTAOPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, scene, renderer, composer, controls, timer, stats, mixer; + +init(); + +function init() { + const dracoLoader = new DRACOLoader(); + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + loader.setPath('models/gltf/'); + + timer = new THREE.Timer(); + timer.connect(document); + const container = document.createElement('div'); + document.body.appendChild(container); + + stats = new Stats(); + container.appendChild(stats.dom); + + renderer = new THREE.WebGLRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfe3dd); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); + camera.position.set(5, 2, 8); + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.5, 0); + controls.update(); + controls.enablePan = false; + controls.enableDamping = true; + + const width = window.innerWidth; + const height = window.innerHeight; + + composer = new EffectComposer(renderer); + + const renderPass = new RenderPass(scene, camera); + composer.addPass(renderPass); + + const gtaoPass = new GTAOPass(scene, camera, width, height); + gtaoPass.output = GTAOPass.OUTPUT.Denoise; + composer.addPass(gtaoPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + // + + loader.load( + 'LittlestTokyo.glb', + gltf => { + const model = gltf.scene; + model.position.set(1, 1, 0); + model.scale.set(0.01, 0.01, 0.01); + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + mixer.clipAction(gltf.animations[0]).play(); + + const box = new THREE.Box3().setFromObject(scene); + gtaoPass.setSceneClipBox(box); + }, + undefined, + e => console.error(e), + ); + + // Init gui + const gui = new GUI(); + + gui.add(gtaoPass, 'output', { + Default: GTAOPass.OUTPUT.Default, + Diffuse: GTAOPass.OUTPUT.Diffuse, + 'AO Only': GTAOPass.OUTPUT.AO, + 'AO Only + Denoise': GTAOPass.OUTPUT.Denoise, + Depth: GTAOPass.OUTPUT.Depth, + Normal: GTAOPass.OUTPUT.Normal, + }).onChange(function (value) { + gtaoPass.output = value; + }); + + const aoParameters = { + radius: 0.25, + distanceExponent: 1, + thickness: 1, + scale: 1, + samples: 16, + distanceFallOff: 1, + screenSpaceRadius: false, + }; + const pdParameters = { + lumaPhi: 10, + depthPhi: 2, + normalPhi: 3, + radius: 4, + radiusExponent: 1, + rings: 2, + samples: 16, + }; + gtaoPass.updateGtaoMaterial(aoParameters); + gtaoPass.updatePdMaterial(pdParameters); + gui.add(gtaoPass, 'blendIntensity').min(0).max(1).step(0.01); + gui.add(aoParameters, 'radius') + .min(0.01) + .max(1) + .step(0.01) + .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); + gui.add(aoParameters, 'distanceExponent') + .min(1) + .max(4) + .step(0.01) + .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); + gui.add(aoParameters, 'thickness') + .min(0.01) + .max(10) + .step(0.01) + .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); + gui.add(aoParameters, 'distanceFallOff') + .min(0) + .max(1) + .step(0.01) + .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); + gui.add(aoParameters, 'scale') + .min(0.01) + .max(2.0) + .step(0.01) + .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); + gui.add(aoParameters, 'samples') + .min(2) + .max(32) + .step(1) + .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); + gui.add(aoParameters, 'screenSpaceRadius').onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); + gui.add(pdParameters, 'lumaPhi') + .min(0) + .max(20) + .step(0.01) + .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); + gui.add(pdParameters, 'depthPhi') + .min(0.01) + .max(20) + .step(0.01) + .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); + gui.add(pdParameters, 'normalPhi') + .min(0.01) + .max(20) + .step(0.01) + .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); + gui.add(pdParameters, 'radius') + .min(0) + .max(32) + .step(1) + .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); + gui.add(pdParameters, 'radiusExponent') + .min(0.1) + .max(4) + .step(0.1) + .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); + gui.add(pdParameters, 'rings') + .min(1) + .max(16) + .step(0.125) + .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); + gui.add(pdParameters, 'samples') + .min(2) + .max(32) + .step(1) + .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) { + mixer.update(delta); + } + + controls.update(); + + stats.begin(); + composer.render(); + stats.end(); +} diff --git a/examples-testing/examples/webgl_postprocessing_masking.ts b/examples-testing/examples/webgl_postprocessing_masking.ts new file mode 100644 index 000000000..a4d09866d --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_masking.ts @@ -0,0 +1,101 @@ +import * as THREE from 'three'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; +import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; +import { MaskPass, ClearMaskPass } from 'three/addons/postprocessing/MaskPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, composer, renderer; +let box, torus; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 10; + + const scene1 = new THREE.Scene(); + const scene2 = new THREE.Scene(); + + box = new THREE.Mesh(new THREE.BoxGeometry(4, 4, 4)); + scene1.add(box); + + torus = new THREE.Mesh(new THREE.TorusGeometry(3, 1, 16, 32)); + scene2.add(torus); + + renderer = new THREE.WebGLRenderer(); + renderer.setClearColor(0xe0e0e0); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + document.body.appendChild(renderer.domElement); + + // + + const clearPass = new ClearPass(); + + const clearMaskPass = new ClearMaskPass(); + + const maskPass1 = new MaskPass(scene1, camera); + const maskPass2 = new MaskPass(scene2, camera); + + const texture1 = new THREE.TextureLoader().load('textures/758px-Canestra_di_frutta_(Caravaggio).jpg'); + texture1.colorSpace = THREE.SRGBColorSpace; + texture1.minFilter = THREE.LinearFilter; + texture1.generateMipmaps = false; + const texture2 = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); + texture2.colorSpace = THREE.SRGBColorSpace; + + const texturePass1 = new TexturePass(texture1); + const texturePass2 = new TexturePass(texture2); + + const outputPass = new OutputPass(); + + const parameters = { + stencilBuffer: true, + }; + + const renderTarget = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, parameters); + + composer = new EffectComposer(renderer, renderTarget); + composer.addPass(clearPass); + composer.addPass(maskPass1); + composer.addPass(texturePass1); + composer.addPass(clearMaskPass); + composer.addPass(maskPass2); + composer.addPass(texturePass2); + composer.addPass(clearMaskPass); + composer.addPass(outputPass); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + const time = performance.now() * 0.001 + 6000; + + box.position.x = Math.cos(time / 1.5) * 2; + box.position.y = Math.sin(time) * 2; + box.rotation.x = time; + box.rotation.y = time / 2; + + torus.position.x = Math.cos(time) * 2; + torus.position.y = Math.sin(time / 1.5) * 2; + torus.rotation.x = time; + torus.rotation.y = time / 2; + + renderer.clear(); + composer.render(time); +} diff --git a/examples-testing/examples/webgl_postprocessing_outline.ts b/examples-testing/examples/webgl_postprocessing_outline.ts new file mode 100644 index 000000000..f25d2d0d6 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_outline.ts @@ -0,0 +1,273 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; +import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +import { FXAAShader } from 'three/addons/shaders/FXAAShader.js'; + +let container, stats; +let camera, scene, renderer, controls; +let composer, effectFXAA, outlinePass; + +let selectedObjects = []; + +const raycaster = new THREE.Raycaster(); +const mouse = new THREE.Vector2(); + +const obj3d = new THREE.Object3D(); +const group = new THREE.Group(); + +const params = { + edgeStrength: 3.0, + edgeGlow: 0.0, + edgeThickness: 1.0, + pulsePeriod: 0, + rotate: false, + usePatternTexture: false, +}; + +// Init gui + +const gui = new GUI({ width: 280 }); + +gui.add(params, 'edgeStrength', 0.01, 10).onChange(function (value) { + outlinePass.edgeStrength = Number(value); +}); + +gui.add(params, 'edgeGlow', 0.0, 1).onChange(function (value) { + outlinePass.edgeGlow = Number(value); +}); + +gui.add(params, 'edgeThickness', 1, 4).onChange(function (value) { + outlinePass.edgeThickness = Number(value); +}); + +gui.add(params, 'pulsePeriod', 0.0, 5).onChange(function (value) { + outlinePass.pulsePeriod = Number(value); +}); + +gui.add(params, 'rotate'); + +gui.add(params, 'usePatternTexture').onChange(function (value) { + outlinePass.usePatternTexture = value; +}); + +function Configuration() { + this.visibleEdgeColor = '#ffffff'; + this.hiddenEdgeColor = '#190a05'; +} + +const conf = new Configuration(); + +gui.addColor(conf, 'visibleEdgeColor').onChange(function (value) { + outlinePass.visibleEdgeColor.set(value); +}); + +gui.addColor(conf, 'hiddenEdgeColor').onChange(function (value) { + outlinePass.hiddenEdgeColor.set(value); +}); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + const width = window.innerWidth; + const height = window.innerHeight; + + renderer = new THREE.WebGLRenderer(); + renderer.shadowMap.enabled = true; + // todo - support pixelRatio in this demo + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100); + camera.position.set(0, 0, 8); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 5; + controls.maxDistance = 20; + controls.enablePan = false; + controls.enableDamping = true; + controls.dampingFactor = 0.05; + + // + + scene.add(new THREE.AmbientLight(0xaaaaaa, 0.6)); + + const light = new THREE.SunLight(0xddffdd, 2); + light.position.set(5, 5, 5); + light.castShadow = true; + light.shadow.camera.far = 40; + light.shadow.mapSize.setScalar(2048); + scene.add(light); + + // model + + const loader = new OBJLoader(); + loader.load('models/obj/tree.obj', function (object) { + let scale = 1.0; + + object.traverse(function (child) { + if (child instanceof THREE.Mesh) { + child.geometry.center(); + child.geometry.computeBoundingSphere(); + scale = 0.2 * child.geometry.boundingSphere.radius; + + const phongMaterial = new THREE.MeshPhongMaterial({ + color: 0xffffff, + specular: 0x111111, + shininess: 5, + }); + child.material = phongMaterial; + child.receiveShadow = true; + child.castShadow = true; + } + }); + + object.position.y = 1; + object.scale.divideScalar(scale); + obj3d.add(object); + }); + + scene.add(group); + + group.add(obj3d); + + // + + const geometry = new THREE.SphereGeometry(3, 48, 24); + + for (let i = 0; i < 20; i++) { + const material = new THREE.MeshLambertMaterial(); + material.color.setHSL(Math.random(), 1.0, 0.3); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = Math.random() * 4 - 2; + mesh.position.y = Math.random() * 4 - 2; + mesh.position.z = Math.random() * 4 - 2; + mesh.receiveShadow = true; + mesh.castShadow = true; + mesh.scale.multiplyScalar(Math.random() * 0.3 + 0.1); + group.add(mesh); + } + + const floorMaterial = new THREE.MeshLambertMaterial({ side: THREE.DoubleSide }); + + const floorGeometry = new THREE.PlaneGeometry(12, 12); + const floorMesh = new THREE.Mesh(floorGeometry, floorMaterial); + floorMesh.rotation.x -= Math.PI * 0.5; + floorMesh.position.y -= 1.5; + group.add(floorMesh); + floorMesh.receiveShadow = true; + + const torusGeometry = new THREE.TorusGeometry(1, 0.3, 16, 100); + const torusMaterial = new THREE.MeshPhongMaterial({ color: 0xffaaff }); + const torus = new THREE.Mesh(torusGeometry, torusMaterial); + torus.position.z = -4; + group.add(torus); + torus.receiveShadow = true; + torus.castShadow = true; + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // postprocessing + + composer = new EffectComposer(renderer); + + const renderPass = new RenderPass(scene, camera); + composer.addPass(renderPass); + + outlinePass = new OutlinePass(new THREE.Vector2(window.innerWidth, window.innerHeight), scene, camera); + composer.addPass(outlinePass); + + const textureLoader = new THREE.TextureLoader(); + textureLoader.load('textures/tri_pattern.jpg', function (texture) { + outlinePass.patternTexture = texture; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + }); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + effectFXAA = new ShaderPass(FXAAShader); + effectFXAA.uniforms['resolution'].value.set(1 / window.innerWidth, 1 / window.innerHeight); + composer.addPass(effectFXAA); + + window.addEventListener('resize', onWindowResize); + + renderer.domElement.style.touchAction = 'none'; + renderer.domElement.addEventListener('pointermove', onPointerMove); + + function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; + + checkIntersection(); + } + + function addSelectedObject(object) { + selectedObjects = []; + selectedObjects.push(object); + } + + function checkIntersection() { + raycaster.setFromCamera(mouse, camera); + + const intersects = raycaster.intersectObject(scene, true); + + if (intersects.length > 0) { + const selectedObject = intersects[0].object; + addSelectedObject(selectedObject); + outlinePass.selectedObjects = selectedObjects; + } else { + // outlinePass.selectedObjects = []; + } + } +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); + + effectFXAA.uniforms['resolution'].value.set(1 / window.innerWidth, 1 / window.innerHeight); +} + +function animate() { + stats.begin(); + + const timer = performance.now(); + + if (params.rotate) { + group.rotation.y = timer * 0.0001; + } + + controls.update(); + + composer.render(); + + stats.end(); +} diff --git a/examples-testing/examples/webgl_postprocessing_pixel.ts b/examples-testing/examples/webgl_postprocessing_pixel.ts new file mode 100644 index 000000000..ca13ac6a2 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_pixel.ts @@ -0,0 +1,363 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, composer, controls, crystalMesh, timer; +let gui, params; + +init(); + +function init() { + const aspectRatio = window.innerWidth / window.innerHeight; + + camera = new THREE.OrthographicCamera(-aspectRatio, aspectRatio, 1, -1, 0.1, 10); + camera.position.y = 2 * Math.tan(Math.PI / 6); + camera.position.z = 2; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x151729); + + timer = new THREE.Timer(); + timer.connect(document); + + renderer = new THREE.WebGLRenderer(); + renderer.shadowMap.enabled = true; + //renderer.setPixelRatio( window.devicePixelRatio ); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + composer = new EffectComposer(renderer); + const renderPixelatedPass = new RenderPixelatedPass(6, scene, camera); + composer.addPass(renderPixelatedPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + window.addEventListener('resize', onWindowResize); + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxZoom = 2; + + // gui + + gui = new GUI(); + params = { + pixelSize: 6, + normalEdgeStrength: 0.3, + depthEdgeStrength: 0.4, + snapping: true, + pixelAlignedPanning: true, + pixelAlignedObjects: true, + rotationSnap: 15, + cameraRotationSnap: 9, + cameraZoomSnap: 0.1, + }; + gui.add(params, 'pixelSize') + .min(1) + .max(16) + .step(1) + .onChange(() => { + renderPixelatedPass.setPixelSize(params.pixelSize); + }); + gui.add(renderPixelatedPass, 'normalEdgeStrength').min(0).max(2).step(0.05); + gui.add(renderPixelatedPass, 'depthEdgeStrength').min(0).max(1).step(0.05); + + const snappingControl = gui.add(params, 'snapping').name('Enable Pixel Snapping'); + const snappingFolder = gui.addFolder('Snapping').close(); + snappingControl.onChange(enabled => snappingFolder.controllers.forEach(c => c.enable(enabled))); + snappingFolder.add(params, 'pixelAlignedPanning'); + snappingFolder.add(params, 'pixelAlignedObjects'); + snappingFolder.add(params, 'rotationSnap').min(0).max(90).step(1).name('rotationSnap (deg, 0 = off)'); + snappingFolder.add(params, 'cameraRotationSnap').min(0).max(90).step(1).name('cameraRotationSnap (deg, 0 = off)'); + snappingFolder.add(params, 'cameraZoomSnap').min(0).max(1).step(0.05).name('cameraZoomSnap (0 = off)'); + + // textures + + const loader = new THREE.TextureLoader(); + const texChecker = pixelTexture(loader.load('textures/checker.png')); + const texChecker2 = pixelTexture(loader.load('textures/checker.png')); + texChecker.repeat.set(3, 3); + texChecker2.repeat.set(1.5, 1.5); + + // meshes + + const boxMaterial = new THREE.MeshPhongMaterial({ map: texChecker2 }); + + function addBox(boxSideLength, x, z, rotation) { + const mesh = new THREE.Mesh(new THREE.BoxGeometry(boxSideLength, boxSideLength, boxSideLength), boxMaterial); + mesh.castShadow = true; + mesh.receiveShadow = true; + mesh.rotation.y = rotation; + mesh.position.y = boxSideLength / 2; + mesh.position.set(x, boxSideLength / 2 + 0.0001, z); + scene.add(mesh); + return mesh; + } + + addBox(0.4, 0, 0, Math.PI / 4); + addBox(0.5, -0.5, -0.5, Math.PI / 4); + + const planeSideLength = 2; + const planeMesh = new THREE.Mesh( + new THREE.PlaneGeometry(planeSideLength, planeSideLength), + new THREE.MeshPhongMaterial({ map: texChecker }), + ); + planeMesh.receiveShadow = true; + planeMesh.rotation.x = -Math.PI / 2; + scene.add(planeMesh); + + const radius = 0.2; + const geometry = new THREE.IcosahedronGeometry(radius); + crystalMesh = new THREE.Mesh( + geometry, + new THREE.MeshPhongMaterial({ + color: 0x68b7e9, + emissive: 0x4f7e8b, + shininess: 10, + specular: 0xffffff, + }), + ); + crystalMesh.receiveShadow = true; + crystalMesh.castShadow = true; + scene.add(crystalMesh); + + // lights + + scene.add(new THREE.AmbientLight(0x757f8e, 3)); + + const directionalLight = new THREE.DirectionalLight(0xfffecd, 1.5); + directionalLight.position.set(100, 100, 100); + directionalLight.castShadow = true; + directionalLight.shadow.mapSize.set(2048, 2048); + scene.add(directionalLight); + + const spotLight = new THREE.SpotLight(0xffc100, 10, 10, Math.PI / 16, 0.02, 2); + spotLight.position.set(2, 2, 0); + const target = spotLight.target; + scene.add(target); + target.position.set(0, 0, 0); + spotLight.castShadow = true; + scene.add(spotLight); +} + +function onWindowResize() { + const aspectRatio = window.innerWidth / window.innerHeight; + camera.left = -aspectRatio; + camera.right = aspectRatio; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const t = timer.getElapsed(); + + // Quantize the pulsing glow to a few discrete brightness levels to match the pixelated aesthetic + const brightnessLevels = 6; + crystalMesh.material.emissiveIntensity = + Math.round((Math.sin(t * 3) * 0.5 + 0.5) * (brightnessLevels - 1)) / (brightnessLevels - 1); + crystalMesh.position.y = 0.7 + Math.sin(t * 2) * 0.05; + crystalMesh.rotation.y = stopGoEased(t, 6, 8) * 2 * Math.PI; + + const rendererSize = renderer.getSize(new THREE.Vector2()); + const aspectRatio = rendererSize.x / rendererSize.y; + const pixelsPerScreenWidth = Math.floor(rendererSize.x / params['pixelSize']); + const pixelsPerScreenHeight = Math.floor(rendererSize.y / params['pixelSize']); + + // The top-level 'snapping' checkbox gates every individual snapping effect at once + const snapping = params['snapping']; + + // Remember the camera's true (unsnapped) transform so OrbitControls interaction is unaffected by snapping + const cameraPosition = camera.position.clone(); + const cameraQuaternion = camera.quaternion.clone(); + const cameraZoom = camera.zoom; + + // Snap the camera's rotation and scale first, so the translation snap below derives its pixel grid + // and screen-space basis from the already-snapped orientation and zoom + if (snapping && (params['cameraRotationSnap'] > 0 || params['cameraZoomSnap'] > 0)) { + pixelAlignCamera(camera, controls.target, params['cameraRotationSnap'], params['cameraZoomSnap']); + } + + if (snapping && params['pixelAlignedPanning']) { + pixelAlignFrustum(camera, aspectRatio, pixelsPerScreenWidth, pixelsPerScreenHeight); + } else if (camera.left != -aspectRatio || camera.top != 1.0) { + // Reset the Camera Frustum if it has been modified + camera.left = -aspectRatio; + camera.right = aspectRatio; + camera.top = 1.0; + camera.bottom = -1.0; + camera.updateProjectionMatrix(); + } + + // Remember the crystal's true (unsnapped) transform so its bulk movement is unaffected by snapping. + // We snapshot the euler rotation (not the quaternion) because that's what drives the spin: restoring + // the quaternion would let three.js re-derive a gimbal-equivalent euler and corrupt the y rotation. + const crystalPosition = crystalMesh.position.clone(); + const crystalRotation = crystalMesh.rotation.clone(); + + if (snapping && params['pixelAlignedObjects']) { + // Snap the moving objects to the screen-space pixel grid so they don't shimmer when pixelated + const worldScreenWidth = (camera.right - camera.left) / camera.zoom; + const worldScreenHeight = (camera.top - camera.bottom) / camera.zoom; + pixelAlignObject( + crystalMesh, + camera, + worldScreenWidth / pixelsPerScreenWidth, + worldScreenHeight / pixelsPerScreenHeight, + ); + } + + if (snapping && params['rotationSnap'] > 0) { + // Snap the moving objects' rotation to the nearest camera-relative euler increment + snapObjectRotation(crystalMesh, camera, params['rotationSnap']); + } + + composer.render(); + + // Restore the true transforms after rendering so the next frame's motion builds on the real trajectory + crystalMesh.position.copy(crystalPosition); + crystalMesh.rotation.copy(crystalRotation); + camera.position.copy(cameraPosition); + camera.quaternion.copy(cameraQuaternion); + camera.zoom = cameraZoom; + camera.updateProjectionMatrix(); +} + +// Helper functions + +function pixelTexture(texture) { + texture.minFilter = THREE.NearestFilter; + texture.magFilter = THREE.NearestFilter; + texture.generateMipmaps = false; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.colorSpace = THREE.SRGBColorSpace; + return texture; +} + +function easeInOutCubic(x) { + return x ** 2 * 3 - x ** 3 * 2; +} + +function linearStep(x, edge0, edge1) { + const w = edge1 - edge0; + const m = 1 / w; + const y0 = -m * edge0; + return THREE.MathUtils.clamp(y0 + m * x, 0, 1); +} + +function stopGoEased(x, downtime, period) { + const cycle = (x / period) | 0; + const tween = x - cycle * period; + const linStep = easeInOutCubic(linearStep(tween, downtime, period)); + return cycle + linStep; +} + +function pixelAlignCamera(camera, target, rotationIncrementDegrees, zoomIncrement) { + // Snap the camera's orbit to the nearest increment of azimuth/polar angle around the target. Working + // in spherical coordinates (rather than snapping the euler angles) keeps the orbit translation locked + // onto the target and guarantees a roll-free orientation, since we re-aim with lookAt and world up. + if (rotationIncrementDegrees > 0) { + const increment = THREE.MathUtils.degToRad(rotationIncrementDegrees); + const offset = new THREE.Vector3().subVectors(camera.position, target); + const spherical = new THREE.Spherical().setFromVector3(offset); + spherical.theta = Math.round(spherical.theta / increment) * increment; + spherical.phi = Math.round(spherical.phi / increment) * increment; + spherical.makeSafe(); + offset.setFromSpherical(spherical); + camera.position.copy(target).add(offset); + camera.up.set(0.0, 1.0, 0.0); + camera.lookAt(target); + } + + // Snap the camera's zoom to the nearest increment so the pixel grid stays a stable size while scaling + if (zoomIncrement > 0) { + camera.zoom = Math.max(zoomIncrement, Math.round(camera.zoom / zoomIncrement) * zoomIncrement); + camera.updateProjectionMatrix(); + } +} + +function pixelAlignFrustum(camera, aspectRatio, pixelsPerScreenWidth, pixelsPerScreenHeight) { + // 0. Get Pixel Grid Units + const worldScreenWidth = (camera.right - camera.left) / camera.zoom; + const worldScreenHeight = (camera.top - camera.bottom) / camera.zoom; + const pixelWidth = worldScreenWidth / pixelsPerScreenWidth; + const pixelHeight = worldScreenHeight / pixelsPerScreenHeight; + + // 1. Project the current camera position along its local rotation bases + const camPos = new THREE.Vector3(); + camera.getWorldPosition(camPos); + const camRot = new THREE.Quaternion(); + camera.getWorldQuaternion(camRot); + const camRight = new THREE.Vector3(1.0, 0.0, 0.0).applyQuaternion(camRot); + const camUp = new THREE.Vector3(0.0, 1.0, 0.0).applyQuaternion(camRot); + const camPosRight = camPos.dot(camRight); + const camPosUp = camPos.dot(camUp); + + // 2. Find how far along its position is along these bases in pixel units + const camPosRightPx = camPosRight / pixelWidth; + const camPosUpPx = camPosUp / pixelHeight; + + // 3. Find the fractional pixel units and convert to world units + const fractX = camPosRightPx - Math.round(camPosRightPx); + const fractY = camPosUpPx - Math.round(camPosUpPx); + + // 4. Add fractional world units to the left/right top/bottom to align with the pixel grid + camera.left = -aspectRatio - fractX * pixelWidth; + camera.right = aspectRatio - fractX * pixelWidth; + camera.top = 1.0 - fractY * pixelHeight; + camera.bottom = -1.0 - fractY * pixelHeight; + camera.updateProjectionMatrix(); +} + +function pixelAlignObject(object, camera, pixelWidth, pixelHeight) { + // 1. Build the camera's orthonormal screen-space basis + const camRot = new THREE.Quaternion(); + camera.getWorldQuaternion(camRot); + const camRight = new THREE.Vector3(1.0, 0.0, 0.0).applyQuaternion(camRot); + const camUp = new THREE.Vector3(0.0, 1.0, 0.0).applyQuaternion(camRot); + const camForward = new THREE.Vector3(0.0, 0.0, -1.0).applyQuaternion(camRot); + + // 2. Decompose the object's world position onto that basis + const pos = object.position; + const posRight = pos.dot(camRight); + const posUp = pos.dot(camUp); + const posForward = pos.dot(camForward); + + // 3. Snap the screen-space (right/up) components to the pixel grid, leaving depth untouched + const snappedRight = Math.round(posRight / pixelWidth) * pixelWidth; + const snappedUp = Math.round(posUp / pixelHeight) * pixelHeight; + + // 4. Recompose the world position from the snapped basis components + pos.set(0, 0, 0); + pos.addScaledVector(camRight, snappedRight); + pos.addScaledVector(camUp, snappedUp); + pos.addScaledVector(camForward, posForward); +} + +function snapObjectRotation(object, camera, incrementDegrees) { + const increment = THREE.MathUtils.degToRad(incrementDegrees); + + // 1. Express the object's rotation relative to the camera + const camRot = new THREE.Quaternion(); + camera.getWorldQuaternion(camRot); + const relative = camRot.clone().invert().multiply(object.quaternion); + + // 2. Snap each euler axis (in camera space) to the nearest increment + const euler = new THREE.Euler().setFromQuaternion(relative); + euler.x = Math.round(euler.x / increment) * increment; + euler.y = Math.round(euler.y / increment) * increment; + euler.z = Math.round(euler.z / increment) * increment; + + // 3. Convert back to a world-space rotation + relative.setFromEuler(euler); + object.quaternion.copy(camRot.multiply(relative)); +} diff --git a/examples-testing/examples/webgl_postprocessing_procedural.ts b/examples-testing/examples/webgl_postprocessing_procedural.ts new file mode 100644 index 000000000..869824270 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_procedural.ts @@ -0,0 +1,77 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let postCamera, postScene, renderer; +let postMaterial, noiseRandom1DMaterial, noiseRandom2DMaterial, noiseRandom3DMaterial, postQuad; +let stats; + +const params = { procedure: 'noiseRandom3D' }; + +init(); + +function init() { + const container = document.getElementById('container'); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // Setup post processing stage + postCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); + noiseRandom1DMaterial = new THREE.ShaderMaterial({ + vertexShader: document.querySelector('#procedural-vert').textContent.trim(), + fragmentShader: document.querySelector('#noiseRandom1D-frag').textContent.trim(), + }); + noiseRandom2DMaterial = new THREE.ShaderMaterial({ + vertexShader: document.querySelector('#procedural-vert').textContent.trim(), + fragmentShader: document.querySelector('#noiseRandom2D-frag').textContent.trim(), + }); + noiseRandom3DMaterial = new THREE.ShaderMaterial({ + vertexShader: document.querySelector('#procedural-vert').textContent.trim(), + fragmentShader: document.querySelector('#noiseRandom3D-frag').textContent.trim(), + }); + postMaterial = noiseRandom3DMaterial; + const postPlane = new THREE.PlaneGeometry(2, 2); + postQuad = new THREE.Mesh(postPlane, postMaterial); + postScene = new THREE.Scene(); + postScene.add(postQuad); + + window.addEventListener('resize', onWindowResize); + + // + + const gui = new GUI(); + gui.add(params, 'procedure', ['noiseRandom1D', 'noiseRandom2D', 'noiseRandom3D']); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + switch (params.procedure) { + case 'noiseRandom1D': + postMaterial = noiseRandom1DMaterial; + break; + case 'noiseRandom2D': + postMaterial = noiseRandom2DMaterial; + break; + case 'noiseRandom3D': + postMaterial = noiseRandom3DMaterial; + break; + } + + postQuad.material = postMaterial; + + // render post FX + renderer.render(postScene, postCamera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_postprocessing_rgb_halftone.ts b/examples-testing/examples/webgl_postprocessing_rgb_halftone.ts new file mode 100644 index 000000000..5a40f9793 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_rgb_halftone.ts @@ -0,0 +1,170 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { HalftonePass } from 'three/addons/postprocessing/HalftonePass.js'; + +let renderer, timer, camera, stats; + +const rotationSpeed = Math.PI / 64; + +let composer, group; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + timer = new THREE.Timer(); + timer.connect(document); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 12; + + stats = new Stats(); + + document.body.appendChild(renderer.domElement); + document.body.appendChild(stats.dom); + + // camera controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0, 0); + controls.update(); + + // scene + + const scene = new THREE.Scene(); + scene.background = new THREE.Color(0x444444); + + group = new THREE.Group(); + const floor = new THREE.Mesh(new THREE.BoxGeometry(100, 1, 100), new THREE.MeshPhongMaterial({})); + floor.position.y = -10; + const light = new THREE.PointLight(0xffffff, 250); + light.position.y = 2; + group.add(floor, light); + scene.add(group); + + const mat = new THREE.ShaderMaterial({ + uniforms: {}, + + vertexShader: [ + 'varying vec2 vUV;', + 'varying vec3 vNormal;', + + 'void main() {', + + 'vUV = uv;', + 'vNormal = vec3( normal );', + 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', + + '}', + ].join('\n'), + + fragmentShader: [ + 'varying vec2 vUV;', + 'varying vec3 vNormal;', + + 'void main() {', + + 'vec4 c = vec4( abs( vNormal ) + vec3( vUV, 0.0 ), 0.0 );', + 'gl_FragColor = c;', + + '}', + ].join('\n'), + }); + + for (let i = 0; i < 50; ++i) { + // fill scene with coloured cubes + const mesh = new THREE.Mesh(new THREE.BoxGeometry(2, 2, 2), mat); + mesh.position.set(Math.random() * 16 - 8, Math.random() * 16 - 8, Math.random() * 16 - 8); + mesh.rotation.set(Math.random() * Math.PI * 2, Math.random() * Math.PI * 2, Math.random() * Math.PI * 2); + group.add(mesh); + } + + // post-processing + + composer = new EffectComposer(renderer); + const renderPass = new RenderPass(scene, camera); + const params = { + shape: 1, + radius: 4, + rotateR: Math.PI / 12, + rotateB: (Math.PI / 12) * 2, + rotateG: (Math.PI / 12) * 3, + scatter: 0, + blending: 1, + blendingMode: 1, + greyscale: false, + disable: false, + }; + const halftonePass = new HalftonePass(params); + composer.addPass(renderPass); + composer.addPass(halftonePass); + + window.onresize = function () { + // resize composer + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + }; + + // GUI + + const controller = { + radius: halftonePass.uniforms['radius'].value, + rotateR: halftonePass.uniforms['rotateR'].value / (Math.PI / 180), + rotateG: halftonePass.uniforms['rotateG'].value / (Math.PI / 180), + rotateB: halftonePass.uniforms['rotateB'].value / (Math.PI / 180), + scatter: halftonePass.uniforms['scatter'].value, + shape: halftonePass.uniforms['shape'].value, + greyscale: halftonePass.uniforms['greyscale'].value, + blending: halftonePass.uniforms['blending'].value, + blendingMode: halftonePass.uniforms['blendingMode'].value, + disable: halftonePass.uniforms['disable'].value, + }; + + function onGUIChange() { + // update uniforms + halftonePass.uniforms['radius'].value = controller.radius; + halftonePass.uniforms['rotateR'].value = controller.rotateR * (Math.PI / 180); + halftonePass.uniforms['rotateG'].value = controller.rotateG * (Math.PI / 180); + halftonePass.uniforms['rotateB'].value = controller.rotateB * (Math.PI / 180); + halftonePass.uniforms['scatter'].value = controller.scatter; + halftonePass.uniforms['shape'].value = controller.shape; + halftonePass.uniforms['greyscale'].value = controller.greyscale; + halftonePass.uniforms['blending'].value = controller.blending; + halftonePass.uniforms['blendingMode'].value = controller.blendingMode; + halftonePass.uniforms['disable'].value = controller.disable; + } + + const gui = new GUI(); + gui.add(controller, 'shape', { Dot: 1, Ellipse: 2, Line: 3, Square: 4, Diamond: 5 }).onChange(onGUIChange); + gui.add(controller, 'radius', 1, 25).onChange(onGUIChange); + gui.add(controller, 'rotateR', 0, 90).onChange(onGUIChange); + gui.add(controller, 'rotateG', 0, 90).onChange(onGUIChange); + gui.add(controller, 'rotateB', 0, 90).onChange(onGUIChange); + gui.add(controller, 'scatter', 0, 1, 0.01).onChange(onGUIChange); + gui.add(controller, 'greyscale').onChange(onGUIChange); + gui.add(controller, 'blending', 0, 1, 0.01).onChange(onGUIChange); + gui.add(controller, 'blendingMode', { Linear: 1, Multiply: 2, Add: 3, Lighter: 4, Darker: 5 }).onChange( + onGUIChange, + ); + gui.add(controller, 'disable').onChange(onGUIChange); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + stats.update(); + group.rotation.y += delta * rotationSpeed; + composer.render(delta); +} diff --git a/examples-testing/examples/webgl_postprocessing_sao.ts b/examples-testing/examples/webgl_postprocessing_sao.ts new file mode 100644 index 000000000..0c6298e6b --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_sao.ts @@ -0,0 +1,146 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { SAOPass } from 'three/addons/postprocessing/SAOPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let container, stats; +let camera, scene, renderer; +let composer, renderPass, saoPass; +let group; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + const width = window.innerWidth; + const height = window.innerHeight; + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(65, width / height, 3, 10); + camera.position.z = 7; + + scene = new THREE.Scene(); + + group = new THREE.Object3D(); + scene.add(group); + + const light = new THREE.PointLight(0xefffef, 500); + light.position.z = 10; + light.position.y = -10; + light.position.x = -10; + scene.add(light); + + const light2 = new THREE.PointLight(0xffefef, 500); + light2.position.z = 10; + light2.position.x = -10; + light2.position.y = 10; + scene.add(light2); + + const light3 = new THREE.PointLight(0xefefff, 500); + light3.position.z = 10; + light3.position.x = 10; + light3.position.y = -10; + scene.add(light3); + + const light4 = new THREE.AmbientLight(0xffffff, 0.2); + scene.add(light4); + + const geometry = new THREE.SphereGeometry(3, 48, 24); + const material = new THREE.MeshStandardMaterial(); + material.roughness = 0.5; + material.metalness = 0; + + const mesh = new THREE.InstancedMesh(geometry, material, 120); + const dummy = new THREE.Object3D(); + const color = new THREE.Color(); + + for (let i = 0; i < 120; i++) { + dummy.position.x = Math.random() * 4 - 2; + dummy.position.y = Math.random() * 4 - 2; + dummy.position.z = Math.random() * 4 - 2; + dummy.rotation.x = Math.random(); + dummy.rotation.y = Math.random(); + dummy.rotation.z = Math.random(); + + const scale = Math.random() * 0.2 + 0.05; + dummy.scale.set(scale, scale, scale); + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + + color.setHSL(Math.random(), 1.0, 0.3); + mesh.setColorAt(i, color); + } + + group.add(mesh); + + stats = new Stats(); + container.appendChild(stats.dom); + + composer = new EffectComposer(renderer); + renderPass = new RenderPass(scene, camera); + composer.addPass(renderPass); + saoPass = new SAOPass(scene, camera); + composer.addPass(saoPass); + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + // Init gui + const gui = new GUI(); + gui.add(saoPass.params, 'output', { + Default: SAOPass.OUTPUT.Default, + 'SAO Only': SAOPass.OUTPUT.SAO, + Normal: SAOPass.OUTPUT.Normal, + }).onChange(function (value) { + saoPass.params.output = value; + }); + gui.add(saoPass.params, 'saoBias', -1, 1); + gui.add(saoPass.params, 'saoIntensity', 0, 1); + gui.add(saoPass.params, 'saoScale', 0, 10); + gui.add(saoPass.params, 'saoKernelRadius', 1, 100); + gui.add(saoPass.params, 'saoMinResolution', 0, 1); + gui.add(saoPass.params, 'saoBlur'); + gui.add(saoPass.params, 'saoBlurRadius', 0, 200); + gui.add(saoPass.params, 'saoBlurStdDev', 0.5, 150); + gui.add(saoPass.params, 'saoBlurDepthCutoff', 0.0, 0.1); + gui.add(saoPass, 'enabled'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth || 1; + const height = window.innerHeight || 1; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + renderer.setSize(width, height); + + composer.setSize(width, height); +} + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + const timer = performance.now(); + group.rotation.x = timer * 0.0002; + group.rotation.y = timer * 0.0001; + + composer.render(); +} diff --git a/examples-testing/examples/webgl_postprocessing_smaa.ts b/examples-testing/examples/webgl_postprocessing_smaa.ts new file mode 100644 index 000000000..9e73d38b0 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_smaa.ts @@ -0,0 +1,106 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { SMAAPass } from 'three/addons/postprocessing/SMAAPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, scene, renderer, composer, stats, smaaPass; + +const params = { + enabled: true, + autoRotate: true, +}; + +init(); + +function init() { + const container = document.getElementById('container'); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 300; + + scene = new THREE.Scene(); + + const geometry = new THREE.BoxGeometry(120, 120, 120); + const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.position.x = -100; + scene.add(mesh1); + + const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); + texture.anisotropy = renderer.capabilities.getMaxAnisotropy(); + texture.colorSpace = THREE.SRGBColorSpace; + + const material2 = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.position.x = 100; + scene.add(mesh2); + + // postprocessing + + composer = new EffectComposer(renderer); + composer.addPass(new RenderPass(scene, camera)); + + smaaPass = new SMAAPass(); + composer.addPass(smaaPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + window.addEventListener('resize', onWindowResize); + + const gui = new GUI(); + + const smaaFolder = gui.addFolder('SMAA'); + smaaFolder.add(params, 'enabled'); + + const sceneFolder = gui.addFolder('Scene'); + sceneFolder.add(params, 'autoRotate'); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + stats.begin(); + + if (params.autoRotate === true) { + for (let i = 0; i < scene.children.length; i++) { + const child = scene.children[i]; + + child.rotation.x += 0.005; + child.rotation.y += 0.01; + } + } + + smaaPass.enabled = params.enabled; + + composer.render(); + + stats.end(); +} diff --git a/examples-testing/examples/webgl_postprocessing_sobel.ts b/examples-testing/examples/webgl_postprocessing_sobel.ts new file mode 100644 index 000000000..55d88dc02 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_sobel.ts @@ -0,0 +1,111 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; + +import { LuminosityShader } from 'three/addons/shaders/LuminosityShader.js'; +import { SobelOperatorShader } from 'three/addons/shaders/SobelOperatorShader.js'; + +let camera, scene, renderer, composer; + +let effectSobel; + +const params = { + enable: true, +}; + +init(); + +function init() { + // + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 1, 3); + camera.lookAt(scene.position); + + // + + const geometry = new THREE.TorusKnotGeometry(1, 0.3, 256, 32); + const material = new THREE.MeshPhongMaterial({ color: 0xffff00 }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const ambientLight = new THREE.AmbientLight(0xe7e7e7); + scene.add(ambientLight); + + const pointLight = new THREE.PointLight(0xffffff, 20); + camera.add(pointLight); + scene.add(camera); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // postprocessing + + composer = new EffectComposer(renderer); + const renderPass = new RenderPass(scene, camera); + composer.addPass(renderPass); + + // color to grayscale conversion + + const effectGrayScale = new ShaderPass(LuminosityShader); + composer.addPass(effectGrayScale); + + // you might want to use a gaussian blur filter before + // the next pass to improve the result of the Sobel operator + + // Sobel operator + + effectSobel = new ShaderPass(SobelOperatorShader); + effectSobel.uniforms['resolution'].value.x = window.innerWidth * window.devicePixelRatio; + effectSobel.uniforms['resolution'].value.y = window.innerHeight * window.devicePixelRatio; + composer.addPass(effectSobel); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + + // + + const gui = new GUI(); + + gui.add(params, 'enable'); + gui.open(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); + + effectSobel.uniforms['resolution'].value.x = window.innerWidth * window.devicePixelRatio; + effectSobel.uniforms['resolution'].value.y = window.innerHeight * window.devicePixelRatio; +} + +function animate() { + if (params.enable === true) { + composer.render(); + } else { + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgl_postprocessing_ssaa.ts b/examples-testing/examples/webgl_postprocessing_ssaa.ts new file mode 100644 index 000000000..45d8767b1 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_ssaa.ts @@ -0,0 +1,214 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { SSAARenderPass } from 'three/addons/postprocessing/SSAARenderPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let scene, renderer, composer; +let cameraP, ssaaRenderPassP; +let cameraO, ssaaRenderPassO; +let gui, stats; + +const params = { + sampleLevel: 4, + unbiased: true, + camera: 'perspective', + clearColor: 'black', + clearAlpha: 1.0, + viewOffsetX: 0, + autoRotate: true, +}; + +init(); + +clearGui(); + +function clearGui() { + if (gui) gui.destroy(); + + gui = new GUI(); + + gui.add(params, 'unbiased'); + gui.add(params, 'sampleLevel', { + 'Level 0: 1 Sample': 0, + 'Level 1: 2 Samples': 1, + 'Level 2: 4 Samples': 2, + 'Level 3: 8 Samples': 3, + 'Level 4: 16 Samples': 4, + 'Level 5: 32 Samples': 5, + }); + gui.add(params, 'camera', ['perspective', 'orthographic']); + gui.add(params, 'clearColor', ['black', 'white', 'blue', 'green', 'red']); + gui.add(params, 'clearAlpha', 0, 1); + gui.add(params, 'viewOffsetX', -100, 100); + gui.add(params, 'autoRotate'); + + gui.open(); +} + +function init() { + const container = document.getElementById('container'); + + const width = window.innerWidth || 1; + const height = window.innerHeight || 1; + const aspect = width / height; + const devicePixelRatio = window.devicePixelRatio || 1; + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + cameraP = new THREE.PerspectiveCamera(65, aspect, 3, 10); + cameraP.position.z = 7; + cameraP.setViewOffset(width, height, params.viewOffsetX, 0, width, height); + + cameraO = new THREE.OrthographicCamera(width / -2, width / 2, height / 2, height / -2, 3, 10); + cameraO.position.z = 7; + + const fov = THREE.MathUtils.degToRad(cameraP.fov); + const hyperfocus = (cameraP.near + cameraP.far) / 2; + const _height = 2 * Math.tan(fov / 2) * hyperfocus; + cameraO.zoom = height / _height; + + scene = new THREE.Scene(); + + const group = new THREE.Group(); + scene.add(group); + + const light = new THREE.PointLight(0xefffef, 500); + light.position.z = 10; + light.position.y = -10; + light.position.x = -10; + scene.add(light); + + const light2 = new THREE.PointLight(0xffefef, 500); + light2.position.z = 10; + light2.position.x = -10; + light2.position.y = 10; + scene.add(light2); + + const light3 = new THREE.PointLight(0xefefff, 500); + light3.position.z = 10; + light3.position.x = 10; + light3.position.y = -10; + scene.add(light3); + + const light4 = new THREE.AmbientLight(0xffffff, 0.2); + scene.add(light4); + + const geometry = new THREE.SphereGeometry(3, 48, 24); + const material = new THREE.MeshStandardMaterial(); + material.roughness = 0.5; + material.metalness = 0; + + const mesh = new THREE.InstancedMesh(geometry, material, 120); + const dummy = new THREE.Object3D(); + const color = new THREE.Color(); + + for (let i = 0; i < 120; i++) { + dummy.position.x = Math.random() * 4 - 2; + dummy.position.y = Math.random() * 4 - 2; + dummy.position.z = Math.random() * 4 - 2; + dummy.rotation.x = Math.random(); + dummy.rotation.y = Math.random(); + dummy.rotation.z = Math.random(); + + dummy.scale.setScalar(Math.random() * 0.2 + 0.05); + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + + color.setHSL(Math.random(), 1.0, 0.3); + mesh.setColorAt(i, color); + } + + group.add(mesh); + + // postprocessing + + composer = new EffectComposer(renderer); + composer.setPixelRatio(1); // ensure pixel ratio is always 1 for performance reasons + ssaaRenderPassP = new SSAARenderPass(scene, cameraP); + composer.addPass(ssaaRenderPassP); + ssaaRenderPassO = new SSAARenderPass(scene, cameraO); + composer.addPass(ssaaRenderPassO); + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + const aspect = width / height; + + cameraP.aspect = aspect; + cameraP.setViewOffset(width, height, params.viewOffsetX, 0, width, height); + cameraO.updateProjectionMatrix(); + + cameraO.left = -height * aspect; + cameraO.right = height * aspect; + cameraO.top = height; + cameraO.bottom = -height; + cameraO.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + stats.begin(); + + if (params.autoRotate) { + for (let i = 0; i < scene.children.length; i++) { + const child = scene.children[i]; + + child.rotation.x += 0.005; + child.rotation.y += 0.01; + } + } + + let newColor = ssaaRenderPassP.clearColor; + + switch (params.clearColor) { + case 'blue': + newColor = 0x0000ff; + break; + case 'red': + newColor = 0xff0000; + break; + case 'green': + newColor = 0x00ff00; + break; + case 'white': + newColor = 0xffffff; + break; + case 'black': + newColor = 0x000000; + break; + } + + ssaaRenderPassP.clearColor = ssaaRenderPassO.clearColor = newColor; + ssaaRenderPassP.clearAlpha = ssaaRenderPassO.clearAlpha = params.clearAlpha; + + ssaaRenderPassP.sampleLevel = ssaaRenderPassO.sampleLevel = params.sampleLevel; + ssaaRenderPassP.unbiased = ssaaRenderPassO.unbiased = params.unbiased; + + ssaaRenderPassP.enabled = params.camera === 'perspective'; + ssaaRenderPassO.enabled = params.camera === 'orthographic'; + + cameraP.view.offsetX = params.viewOffsetX; + + composer.render(); + + stats.end(); +} diff --git a/examples-testing/examples/webgl_postprocessing_ssao.ts b/examples-testing/examples/webgl_postprocessing_ssao.ts new file mode 100644 index 000000000..fd3739af3 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_ssao.ts @@ -0,0 +1,125 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let container, stats; +let camera, scene, renderer; +let composer; +let group; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGLRenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(65, window.innerWidth / window.innerHeight, 100, 700); + camera.position.z = 500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xaaaaaa); + + scene.add(new THREE.DirectionalLight(0xffffff, 4)); + scene.add(new THREE.AmbientLight(0xffffff)); + + group = new THREE.Group(); + scene.add(group); + + const geometry = new THREE.BoxGeometry(10, 10, 10); + const material = new THREE.MeshLambertMaterial(); + + const mesh = new THREE.InstancedMesh(geometry, material, 100); + const dummy = new THREE.Object3D(); + const color = new THREE.Color(); + + for (let i = 0; i < 100; i++) { + dummy.position.x = Math.random() * 400 - 200; + dummy.position.y = Math.random() * 400 - 200; + dummy.position.z = Math.random() * 400 - 200; + dummy.rotation.x = Math.random(); + dummy.rotation.y = Math.random(); + dummy.rotation.z = Math.random(); + + dummy.scale.setScalar(Math.random() * 10 + 2); + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + + color.setHex(Math.random() * 0xffffff); + mesh.setColorAt(i, color); + } + + group.add(mesh); + + stats = new Stats(); + container.appendChild(stats.dom); + + const width = window.innerWidth; + const height = window.innerHeight; + + composer = new EffectComposer(renderer); + + const renderPass = new RenderPass(scene, camera); + composer.addPass(renderPass); + + const ssaoPass = new SSAOPass(scene, camera, width, height); + composer.addPass(ssaoPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + // Init gui + const gui = new GUI(); + + gui.add(ssaoPass, 'output', { + Default: SSAOPass.OUTPUT.Default, + 'SSAO Only': SSAOPass.OUTPUT.SSAO, + 'SSAO Only + Blur': SSAOPass.OUTPUT.Blur, + Depth: SSAOPass.OUTPUT.Depth, + Normal: SSAOPass.OUTPUT.Normal, + }).onChange(function (value) { + ssaoPass.output = value; + }); + gui.add(ssaoPass, 'kernelRadius').min(0).max(32); + gui.add(ssaoPass, 'minDistance').min(0.001).max(0.02); + gui.add(ssaoPass, 'maxDistance').min(0.01).max(0.3); + gui.add(ssaoPass, 'enabled'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + const timer = performance.now(); + group.rotation.x = timer * 0.0002; + group.rotation.y = timer * 0.0001; + + composer.render(); +} diff --git a/examples-testing/examples/webgl_postprocessing_ssr.ts b/examples-testing/examples/webgl_postprocessing_ssr.ts new file mode 100644 index 000000000..77f8365d1 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_ssr.ts @@ -0,0 +1,260 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { SSRPass } from 'three/addons/postprocessing/SSRPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js'; + +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; + +const params = { + enableSSR: true, + autoRotate: true, + otherMeshes: true, + groundReflector: true, +}; +let composer; +let ssrPass; +let gui; +let stats; +let controls; +let camera, scene, renderer; +const otherMeshes = []; +let groundReflector; +const selects = []; + +const container = document.querySelector('#container'); + +// Configure and create Draco decoder. +const dracoLoader = new DRACOLoader(); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 15); + camera.position.set(0.13271600513224902, 0.3489546826045913, 0.43921296427927076); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x443333); + scene.fog = new THREE.Fog(0x443333, 1, 4); + + // Ground + const plane = new THREE.Mesh(new THREE.PlaneGeometry(8, 8), new THREE.MeshPhongMaterial({ color: 0xcbcbcb })); + plane.rotation.x = -Math.PI / 2; + plane.position.y = -0.0001; + // plane.receiveShadow = true; + scene.add(plane); + + // Lights + const hemiLight = new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3); + scene.add(hemiLight); + + const spotLight = new THREE.SpotLight(); + spotLight.intensity = 8; + spotLight.angle = Math.PI / 16; + spotLight.penumbra = 0.5; + // spotLight.castShadow = true; + spotLight.position.set(-1, 1, 1); + scene.add(spotLight); + + dracoLoader.load('models/draco/bunny.drc', function (geometry) { + geometry.computeVertexNormals(); + + const material = new THREE.MeshStandardMaterial({ color: 0xa5a5a5 }); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.y = -0.0365; + scene.add(mesh); + selects.push(mesh); + + // Release decoder resources. + dracoLoader.dispose(); + }); + + let geometry, material, mesh; + + geometry = new THREE.BoxGeometry(0.05, 0.05, 0.05); + material = new THREE.MeshStandardMaterial({ color: 'green' }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.set(-0.12, 0.025, 0.015); + scene.add(mesh); + otherMeshes.push(mesh); + selects.push(mesh); + + geometry = new THREE.IcosahedronGeometry(0.025, 4); + material = new THREE.MeshStandardMaterial({ color: 'cyan' }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.set(-0.05, 0.025, 0.08); + scene.add(mesh); + otherMeshes.push(mesh); + selects.push(mesh); + + geometry = new THREE.ConeGeometry(0.025, 0.05, 64); + material = new THREE.MeshStandardMaterial({ color: 'yellow' }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.set(-0.05, 0.025, -0.055); + scene.add(mesh); + otherMeshes.push(mesh); + selects.push(mesh); + + geometry = new THREE.PlaneGeometry(1, 1); + groundReflector = new ReflectorForSSRPass(geometry, { + clipBias: 0.0003, + textureWidth: window.innerWidth, + textureHeight: window.innerHeight, + color: 0x888888, + useDepthTexture: true, + }); + groundReflector.material.depthWrite = false; + groundReflector.rotation.x = -Math.PI / 2; + groundReflector.visible = false; + scene.add(groundReflector); + + // renderer + renderer = new THREE.WebGLRenderer({ antialias: false }); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target.set(0, 0.0635, 0); + controls.update(); + controls.enabled = !params.autoRotate; + + // STATS + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); + + // composer + + composer = new EffectComposer(renderer); + ssrPass = new SSRPass({ + renderer, + scene, + camera, + width: innerWidth, + height: innerHeight, + groundReflector: params.groundReflector ? groundReflector : null, + selects: params.groundReflector ? selects : null, + }); + + composer.addPass(ssrPass); + composer.addPass(new OutputPass()); + + // GUI + + gui = new GUI({ width: 260 }); + gui.add(params, 'enableSSR').name('Enable SSR'); + gui.add(params, 'groundReflector').onChange(() => { + if (params.groundReflector) { + ((ssrPass.groundReflector = groundReflector), (ssrPass.selects = selects)); + } else { + ((ssrPass.groundReflector = null), (ssrPass.selects = null)); + } + }); + ssrPass.thickness = 0.018; + gui.add(ssrPass, 'resolutionScale').min(0).max(1); + gui.add(ssrPass, 'thickness').min(0).max(0.1).step(0.0001); + ssrPass.infiniteThick = false; + gui.add(ssrPass, 'infiniteThick'); + gui.add(params, 'autoRotate').onChange(() => { + controls.enabled = !params.autoRotate; + }); + + const folder = gui.addFolder('more settings'); + folder.add(ssrPass, 'fresnel').onChange(() => { + groundReflector.fresnel = ssrPass.fresnel; + }); + folder.add(ssrPass, 'distanceAttenuation').onChange(() => { + groundReflector.distanceAttenuation = ssrPass.distanceAttenuation; + }); + ssrPass.maxDistance = 0.1; + groundReflector.maxDistance = ssrPass.maxDistance; + folder + .add(ssrPass, 'maxDistance') + .min(0) + .max(0.5) + .step(0.001) + .onChange(() => { + groundReflector.maxDistance = ssrPass.maxDistance; + }); + folder.add(params, 'otherMeshes').onChange(() => { + if (params.otherMeshes) { + otherMeshes.forEach(mesh => (mesh.visible = true)); + } else { + otherMeshes.forEach(mesh => (mesh.visible = false)); + } + }); + folder.add(ssrPass, 'bouncing'); + folder + .add(ssrPass, 'output', { + Default: SSRPass.OUTPUT.Default, + 'SSR Only': SSRPass.OUTPUT.SSR, + Beauty: SSRPass.OUTPUT.Beauty, + Depth: SSRPass.OUTPUT.Depth, + Normal: SSRPass.OUTPUT.Normal, + Metalness: SSRPass.OUTPUT.Metalness, + }) + .onChange(function (value) { + ssrPass.output = value; + }); + ssrPass.opacity = 1; + groundReflector.opacity = ssrPass.opacity; + folder + .add(ssrPass, 'opacity') + .min(0) + .max(1) + .onChange(() => { + groundReflector.opacity = ssrPass.opacity; + }); + folder.add(ssrPass, 'blur'); + // folder.open() + // gui.close() +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); + groundReflector.getRenderTarget().setSize(window.innerWidth, window.innerHeight); + groundReflector.resolution.set(window.innerWidth, window.innerHeight); +} + +function animate() { + stats.begin(); + render(); + stats.end(); +} + +function render() { + if (params.autoRotate) { + const timer = Date.now() * 0.0003; + + camera.position.x = Math.sin(timer) * 0.5; + camera.position.y = 0.2135; + camera.position.z = Math.cos(timer) * 0.5; + camera.lookAt(0, 0.0635, 0); + } else { + controls.update(); + } + + if (params.enableSSR) { + // TODO: groundReflector has full ground info, need use it to solve reflection gaps problem on objects when camera near ground. + // TODO: the normal and depth info where groundReflector reflected need to be changed. + composer.render(); + } else { + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgl_postprocessing_taa.ts b/examples-testing/examples/webgl_postprocessing_taa.ts new file mode 100644 index 000000000..11a986741 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_taa.ts @@ -0,0 +1,139 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, scene, renderer, composer, taaRenderPass, renderPass; +let gui, stats; +let index = 0; + +const param = { TAAEnabled: '1', TAASampleLevel: 0 }; + +init(); + +clearGui(); + +function clearGui() { + if (gui) gui.destroy(); + + gui = new GUI(); + + gui.add(param, 'TAAEnabled', { + Disabled: '0', + Enabled: '1', + }).onFinishChange(function () { + if (taaRenderPass) { + taaRenderPass.enabled = param.TAAEnabled === '1'; + renderPass.enabled = param.TAAEnabled !== '1'; + } + }); + + gui.add(param, 'TAASampleLevel', { + 'Level 0: 1 Sample': 0, + 'Level 1: 2 Samples': 1, + 'Level 2: 4 Samples': 2, + 'Level 3: 8 Samples': 3, + 'Level 4: 16 Samples': 4, + 'Level 5: 32 Samples': 5, + }).onFinishChange(function () { + if (taaRenderPass) { + taaRenderPass.sampleLevel = param.TAASampleLevel; + } + }); + + gui.open(); +} + +function init() { + const container = document.getElementById('container'); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 300; + + scene = new THREE.Scene(); + + const geometry = new THREE.BoxGeometry(120, 120, 120); + const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.position.x = -100; + scene.add(mesh1); + + const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); + texture.minFilter = THREE.NearestFilter; + texture.magFilter = THREE.NearestFilter; + texture.anisotropy = 1; + texture.generateMipmaps = false; + texture.colorSpace = THREE.SRGBColorSpace; + + const material2 = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.position.x = 100; + scene.add(mesh2); + + // postprocessing + + composer = new EffectComposer(renderer); + + taaRenderPass = new TAARenderPass(scene, camera); + taaRenderPass.unbiased = false; + composer.addPass(taaRenderPass); + + renderPass = new RenderPass(scene, camera); + renderPass.enabled = false; + composer.addPass(renderPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + index++; + + if (Math.round(index / 200) % 2 === 0) { + for (let i = 0; i < scene.children.length; i++) { + const child = scene.children[i]; + + child.rotation.x += 0.005; + child.rotation.y += 0.01; + } + + if (taaRenderPass) taaRenderPass.accumulate = false; + } else { + if (taaRenderPass) taaRenderPass.accumulate = true; + } + + composer.render(); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_postprocessing_transition.ts b/examples-testing/examples/webgl_postprocessing_transition.ts new file mode 100644 index 000000000..1cf5dd3cb --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_transition.ts @@ -0,0 +1,214 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import TWEEN from 'three/addons/libs/tween.module.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderTransitionPass } from 'three/addons/postprocessing/RenderTransitionPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let stats; +let renderer, composer, renderTransitionPass; + +const textures = []; +const timer = new THREE.Timer(); +timer.connect(document); + +const params = { + sceneAnimate: true, + transitionAnimate: true, + transition: 0, + useTexture: true, + texture: 5, + cycle: true, + threshold: 0.1, +}; + +const fxSceneA = new FXScene(new THREE.BoxGeometry(2, 2, 2), new THREE.Vector3(0, -0.4, 0), 0xffffff); +const fxSceneB = new FXScene(new THREE.IcosahedronGeometry(1, 1), new THREE.Vector3(0, 0.2, 0.1), 0x000000); + +init(); + +function init() { + initGUI(); + initTextures(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + composer = new EffectComposer(renderer); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + renderTransitionPass = new RenderTransitionPass(fxSceneA.scene, fxSceneA.camera, fxSceneB.scene, fxSceneB.camera); + renderTransitionPass.setTexture(textures[0]); + composer.addPass(renderTransitionPass); + + const outputPass = new OutputPass(); + composer.addPass(outputPass); +} + +window.addEventListener('resize', onWindowResize); + +function onWindowResize() { + fxSceneA.resize(); + fxSceneB.resize(); + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); +} + +new TWEEN.Tween(params) + .to({ transition: 1 }, 1500) + .onUpdate(function () { + renderTransitionPass.setTransition(params.transition); + + // Change the current alpha texture after each transition + if (params.cycle) { + if (params.transition == 0 || params.transition == 1) { + params.texture = (params.texture + 1) % textures.length; + renderTransitionPass.setTexture(textures[params.texture]); + } + } + }) + .repeat(Infinity) + .delay(2000) + .yoyo(true) + .start(); + +function animate() { + timer.update(); + + // Transition animation + if (params.transitionAnimate) TWEEN.update(); + + const delta = timer.getDelta(); + fxSceneA.update(delta); + fxSceneB.update(delta); + + render(); + stats.update(); +} + +function initTextures() { + const loader = new THREE.TextureLoader(); + + for (let i = 0; i < 6; i++) { + textures[i] = loader.load('textures/transition/transition' + (i + 1) + '.png'); + } +} + +function initGUI() { + const gui = new GUI(); + + gui.add(params, 'sceneAnimate').name('Animate scene'); + gui.add(params, 'transitionAnimate').name('Animate transition'); + gui.add(params, 'transition', 0, 1, 0.01) + .onChange(function (value) { + renderTransitionPass.setTransition(value); + }) + .listen(); + + gui.add(params, 'useTexture').onChange(function (value) { + renderTransitionPass.useTexture(value); + }); + + gui.add(params, 'texture', { Perlin: 0, Squares: 1, Cells: 2, Distort: 3, Gradient: 4, Radial: 5 }) + .onChange(function (value) { + renderTransitionPass.setTexture(textures[value]); + }) + .listen(); + + gui.add(params, 'cycle'); + + gui.add(params, 'threshold', 0, 1, 0.01).onChange(function (value) { + renderTransitionPass.setTextureThreshold(value); + }); +} + +function render() { + // Prevent render both scenes when it's not necessary + if (params.transition === 0) { + renderer.render(fxSceneB.scene, fxSceneB.camera); + } else if (params.transition === 1) { + renderer.render(fxSceneA.scene, fxSceneA.camera); + } else { + // When 0 < transition < 1 render transition between two scenes + composer.render(); + } +} + +function FXScene(geometry, rotationSpeed, backgroundColor) { + const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 20; + + // Setup scene + const scene = new THREE.Scene(); + scene.background = new THREE.Color(backgroundColor); + scene.add(new THREE.AmbientLight(0xaaaaaa, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 1, 4); + scene.add(light); + + this.rotationSpeed = rotationSpeed; + + const color = geometry.type === 'BoxGeometry' ? 0x0000ff : 0xff0000; + const material = new THREE.MeshPhongMaterial({ color: color, flatShading: true }); + const mesh = generateInstancedMesh(geometry, material, 500); + scene.add(mesh); + + this.scene = scene; + this.camera = camera; + this.mesh = mesh; + + this.update = function (delta) { + if (params.sceneAnimate) { + mesh.rotation.x += this.rotationSpeed.x * delta; + mesh.rotation.y += this.rotationSpeed.y * delta; + mesh.rotation.z += this.rotationSpeed.z * delta; + } + }; + + this.resize = function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + }; +} + +function generateInstancedMesh(geometry, material, count) { + const mesh = new THREE.InstancedMesh(geometry, material, count); + + const dummy = new THREE.Object3D(); + const color = new THREE.Color(); + + for (let i = 0; i < count; i++) { + dummy.position.x = Math.random() * 100 - 50; + dummy.position.y = Math.random() * 60 - 30; + dummy.position.z = Math.random() * 80 - 40; + + dummy.rotation.x = Math.random() * 2 * Math.PI; + dummy.rotation.y = Math.random() * 2 * Math.PI; + dummy.rotation.z = Math.random() * 2 * Math.PI; + + dummy.scale.x = Math.random() * 2 + 1; + + if (geometry.type === 'BoxGeometry') { + dummy.scale.y = Math.random() * 2 + 1; + dummy.scale.z = Math.random() * 2 + 1; + } else { + dummy.scale.y = dummy.scale.x; + dummy.scale.z = dummy.scale.x; + } + + dummy.updateMatrix(); + + mesh.setMatrixAt(i, dummy.matrix); + mesh.setColorAt(i, color.setScalar(0.1 + 0.9 * Math.random())); + } + + return mesh; +} diff --git a/examples-testing/examples/webgl_postprocessing_unreal_bloom.ts b/examples-testing/examples/webgl_postprocessing_unreal_bloom.ts new file mode 100644 index 000000000..b5e2ee0f9 --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_unreal_bloom.ts @@ -0,0 +1,139 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, stats; +let composer, renderer, mixer, timer; + +const params = { + threshold: 0, + strength: 1, + radius: 0.5, + exposure: 1, +}; + +init(); + +async function init() { + const container = document.getElementById('container'); + + timer = new THREE.Timer(); + timer.connect(document); + + const scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); + camera.position.set(-5, 2.5, -3.5); + scene.add(camera); + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const pointLight = new THREE.PointLight(0xffffff, 100); + camera.add(pointLight); + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/PrimaryIonDrive.glb'); + + const model = gltf.scene; + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + const clip = gltf.animations[0]; + mixer.clipAction(clip.optimize()).play(); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + container.appendChild(renderer.domElement); + + // + + const renderScene = new RenderPass(scene, camera); + + const bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); + bloomPass.threshold = params.threshold; + bloomPass.strength = params.strength; + bloomPass.radius = params.radius; + + const outputPass = new OutputPass(); + + composer = new EffectComposer(renderer); + composer.addPass(renderScene); + composer.addPass(bloomPass); + composer.addPass(outputPass); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI * 0.5; + controls.minDistance = 3; + controls.maxDistance = 8; + + // + + const gui = new GUI(); + + const bloomFolder = gui.addFolder('bloom'); + + bloomFolder.add(params, 'threshold', 0.0, 1.0).onChange(function (value) { + bloomPass.threshold = Number(value); + }); + + bloomFolder.add(params, 'strength', 0.0, 3.0).onChange(function (value) { + bloomPass.strength = Number(value); + }); + + gui.add(params, 'radius', 0.0, 1.0) + .step(0.01) + .onChange(function (value) { + bloomPass.radius = Number(value); + }); + + const toneMappingFolder = gui.addFolder('tone mapping'); + + toneMappingFolder.add(params, 'exposure', 0.1, 2).onChange(function (value) { + renderer.toneMappingExposure = Math.pow(value, 4.0); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + composer.setSize(width, height); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + mixer.update(delta); + + stats.update(); + + composer.render(); +} diff --git a/examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts b/examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts new file mode 100644 index 000000000..288b4477d --- /dev/null +++ b/examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts @@ -0,0 +1,208 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; +import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +const BLOOM_SCENE = 1; + +const bloomLayer = new THREE.Layers(); +bloomLayer.set(BLOOM_SCENE); + +const params = { + threshold: 0, + strength: 1, + radius: 0.5, + exposure: 1, +}; + +const darkMaterial = new THREE.MeshBasicMaterial({ color: 'black' }); +const materials = {}; + +const renderer = new THREE.WebGLRenderer({ antialias: false }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.toneMapping = THREE.NeutralToneMapping; +document.body.appendChild(renderer.domElement); + +const scene = new THREE.Scene(); +const pmremGenerator = new THREE.PMREMGenerator(renderer); +scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + +const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 200); +camera.position.set(0, 0, 20); +camera.lookAt(0, 0, 0); + +const controls = new OrbitControls(camera, renderer.domElement); +controls.maxPolarAngle = Math.PI * 0.5; +controls.minDistance = 1; +controls.maxDistance = 100; +controls.addEventListener('change', render); + +const renderScene = new RenderPass(scene, camera); + +const bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); +bloomPass.threshold = params.threshold; +bloomPass.strength = params.strength; +bloomPass.radius = params.radius; + +const bloomRenderTarget = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, { + type: THREE.HalfFloatType, +}); +const bloomComposer = new EffectComposer(renderer, bloomRenderTarget); +bloomComposer.renderToScreen = false; +bloomComposer.addPass(renderScene); +bloomComposer.addPass(bloomPass); + +const mixPass = new ShaderPass( + new THREE.ShaderMaterial({ + uniforms: { + baseTexture: { value: null }, + bloomTexture: { value: bloomComposer.renderTarget2.texture }, + bloomStrength: { value: params.strength }, + }, + vertexShader: document.getElementById('vertexshader').textContent, + fragmentShader: document.getElementById('fragmentshader').textContent, + defines: {}, + }), + 'baseTexture', +); +mixPass.needsSwap = true; + +const outputPass = new OutputPass(); + +const finalRenderTarget = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, { + type: THREE.HalfFloatType, + samples: 4, +}); +const finalComposer = new EffectComposer(renderer, finalRenderTarget); +finalComposer.addPass(renderScene); +finalComposer.addPass(mixPass); +finalComposer.addPass(outputPass); + +const raycaster = new THREE.Raycaster(); + +const mouse = new THREE.Vector2(); + +window.addEventListener('pointerdown', onPointerDown); + +const gui = new GUI(); + +const bloomFolder = gui.addFolder('bloom'); + +bloomFolder.add(params, 'threshold', 0.0, 1.0).onChange(function (value) { + bloomPass.threshold = Number(value); + render(); +}); + +bloomFolder.add(params, 'strength', 0.0, 3).onChange(function (value) { + bloomPass.strength = Number(value); + mixPass.material.uniforms.bloomStrength.value = bloomPass.strength; + + render(); +}); + +bloomFolder + .add(params, 'radius', 0.0, 1.0) + .step(0.01) + .onChange(function (value) { + bloomPass.radius = Number(value); + render(); + }); + +const toneMappingFolder = gui.addFolder('tone mapping'); + +toneMappingFolder.add(params, 'exposure', 0.1, 2).onChange(function (value) { + renderer.toneMappingExposure = Math.pow(value, 4.0); + render(); +}); + +setupScene(); + +function onPointerDown(event) { + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; + + raycaster.setFromCamera(mouse, camera); + const intersects = raycaster.intersectObjects(scene.children, false); + if (intersects.length > 0) { + const object = intersects[0].object; + object.layers.toggle(BLOOM_SCENE); + render(); + } +} + +window.onresize = function () { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + + bloomComposer.setSize(width, height); + finalComposer.setSize(width, height); + + render(); +}; + +function setupScene() { + scene.traverse(disposeMaterial); + scene.children.length = 0; + + const geometry = new THREE.IcosahedronGeometry(1, 15); + + for (let i = 0; i < 50; i++) { + const color = new THREE.Color(); + color.setHSL(Math.random(), 0.7, Math.random() * 0.2 + 0.05); + + const material = new THREE.MeshStandardMaterial({ color: color, roughness: 1, metalness: 1 }); + const sphere = new THREE.Mesh(geometry, material); + sphere.position.x = Math.random() * 10 - 5; + sphere.position.y = Math.random() * 10 - 5; + sphere.position.z = Math.random() * 10 - 5; + sphere.position.normalize().multiplyScalar(Math.random() * 4.0 + 2.0); + sphere.scale.setScalar(Math.random() * Math.random() + 0.5); + scene.add(sphere); + + if (Math.random() < 0.25) sphere.layers.enable(BLOOM_SCENE); + } + + render(); +} + +function disposeMaterial(obj) { + if (obj.material) { + obj.material.dispose(); + } +} + +function render() { + scene.traverse(darkenNonBloomed); + bloomComposer.render(); + scene.traverse(restoreMaterial); + + // render the entire scene, then render bloom scene on top + finalComposer.render(); +} + +function darkenNonBloomed(obj) { + if (obj.isMesh && bloomLayer.test(obj.layers) === false) { + materials[obj.uuid] = obj.material; + obj.material = darkMaterial; + } +} + +function restoreMaterial(obj) { + if (materials[obj.uuid]) { + obj.material = materials[obj.uuid]; + delete materials[obj.uuid]; + } +} diff --git a/examples-testing/examples/webgl_random_uv.ts b/examples-testing/examples/webgl_random_uv.ts new file mode 100644 index 000000000..c9db614da --- /dev/null +++ b/examples-testing/examples/webgl_random_uv.ts @@ -0,0 +1,338 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, dirLight, ground, gui, material, materialIn, uniforms, uniformsIn; + +init(); +render(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); + camera.position.set(-0.8, 0.6, 1.5); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.7; + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.VSMShadowMap; + container.appendChild(renderer.domElement); + + dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(-0.5, 1, 0.8); + dirLight.castShadow = true; + scene.add(dirLight); + const shadow = dirLight.shadow; + shadow.mapSize.width = shadow.mapSize.height = 1024; + shadow.radius = 16; + shadow.bias = -0.0005; + const shadowCam = shadow.camera, + s = 2; + shadowCam.near = 0.5; + shadowCam.far = 3; + shadowCam.right = shadowCam.top = s; + shadowCam.left = shadowCam.bottom = -s; + // debug shadow + //scene.add( new THREE.CameraHelper(shadowCam) ); + + // add ground plane + const plane = new THREE.PlaneGeometry(2, 2); + plane.rotateX(-Math.PI * 0.5); + ground = new THREE.Mesh(plane, new THREE.ShadowMaterial({ opacity: 0.5 })); + ground.receiveShadow = true; + ground.position.z = -0.5; + scene.add(ground); + + const map = new THREE.TextureLoader().load('textures/jade.jpg'); + map.colorSpace = THREE.SRGBColorSpace; + map.wrapS = map.wrapT = THREE.RepeatWrapping; + map.repeat.set(20, 20); + map.flipY = false; + + const disolveMap = new THREE.TextureLoader().load('textures/shaderball_ds.jpg'); + disolveMap.flipY = false; + + const noise = new THREE.TextureLoader().load('textures/noise.png'); + + new HDRLoader().setPath('textures/equirectangular/').load('lobe.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + scene.backgroundBlurriness = 0.5; + scene.backgroundIntensity = 1.0; + scene.environmentIntensity = 1.5; + + render(); + + // model + + const loader = new GLTFLoader().setPath('models/gltf/'); + loader.setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)); + loader.load('ShaderBall2.glb', function (gltf) { + const shaderBall = gltf.scene.children[0]; + + // shaderBall is a group with 3 children : base, inside and logo + // ao map is include in model + + let i = shaderBall.children.length, + n = 0; + + while (i--) { + shaderBall.children[i].receiveShadow = true; + shaderBall.children[i].castShadow = true; + shaderBall.children[i].renderOrder = n++; + } + + material = shaderBall.children[0].material; + material.map = map; + material.alphaMap = disolveMap; + material.transparent = true; + + materialIn = shaderBall.children[1].material; + materialIn.alphaMap = disolveMap; + materialIn.transparent = true; + + material.onBeforeCompile = function (shader) { + shader.uniforms['disolve'] = { value: 0 }; + shader.uniforms['threshold'] = { value: 0.2 }; + + shader.uniforms['noiseMap'] = { value: noise }; + shader.uniforms['enableRandom'] = { value: 1 }; + shader.uniforms['useNoiseMap'] = { value: 1 }; + shader.uniforms['useSuslikMethod'] = { value: 0 }; + shader.uniforms['debugNoise'] = { value: 0 }; + + shader.fragmentShader = shader.fragmentShader.replace( + '#include ', + '#include ' + randomUV, + ); + shader.fragmentShader = shader.fragmentShader.replace('#include ', map_fragment); + + // for disolve + shader.fragmentShader = shader.fragmentShader.replace( + '#include ', + alphamap_pars_fragment, + ); + shader.fragmentShader = shader.fragmentShader.replace( + '#include ', + alphamap_fragment, + ); + + uniforms = shader.uniforms; + }; + + materialIn.onBeforeCompile = function (shader) { + shader.uniforms['disolve'] = { value: 0 }; + shader.uniforms['threshold'] = { value: 0.2 }; + // for disolve + shader.fragmentShader = shader.fragmentShader.replace( + '#include ', + alphamap_pars_fragment, + ); + shader.fragmentShader = shader.fragmentShader.replace( + '#include ', + alphamap_fragment, + ); + + uniformsIn = shader.uniforms; + }; + + scene.add(shaderBall); + + render(); + + createGUI(); + }); + }); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 0.3; + controls.maxDistance = 10; + controls.target.set(0, 0.4, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function createGUI() { + const setting = { + get Enabled() { + return uniforms.enableRandom.value ? true : false; + }, + set Enabled(v) { + uniforms.enableRandom.value = v ? 1 : 0; + render(); + }, + + get UseNoiseMap() { + return uniforms.useNoiseMap.value ? true : false; + }, + set UseNoiseMap(v) { + uniforms.useNoiseMap.value = v ? 1 : 0; + render(); + }, + + get SuslikMethod() { + return uniforms.useSuslikMethod.value ? true : false; + }, + set SuslikMethod(v) { + uniforms.useSuslikMethod.value = v ? 1 : 0; + render(); + }, + + get DebugNoise() { + return uniforms.debugNoise.value ? true : false; + }, + set DebugNoise(v) { + uniforms.debugNoise.value = v ? 1 : 0; + render(); + }, + + // disolve + get disolve() { + return uniforms.disolve.value; + }, + set disolve(v) { + uniforms.disolve.value = v; + uniformsIn.disolve.value = v; + ground.material.opacity = (1 - v) * 0.5; + render(); + }, + + get threshold() { + return uniforms.threshold.value; + }, + set threshold(v) { + uniforms.threshold.value = v; + uniformsIn.threshold.value = v; + render(); + }, + }; + + gui = new GUI(); + gui.add(material, 'roughness', 0, 1, 0.01).onChange(render); + gui.add(material, 'metalness', 0, 1, 0.01).onChange(render); + gui.add(setting, 'disolve', 0, 1, 0.01).onChange(render); + gui.add(setting, 'threshold', 0, 1, 0.01).onChange(render); + gui.add(setting, 'Enabled'); + gui.add(setting, 'UseNoiseMap'); + gui.add(setting, 'SuslikMethod'); + gui.add(setting, 'DebugNoise'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +// + +function render() { + renderer.render(scene, camera); +} + +const randomUV = /* glsl */ ` + + uniform sampler2D noiseMap; + uniform float enableRandom; + uniform float useNoiseMap; + uniform float debugNoise; + uniform float useSuslikMethod; + + float directNoise(vec2 p){ + vec2 ip = floor(p); + vec2 u = fract(p); + u = u*u*(3.0-2.0*u); + + float res = mix( + mix(rand(ip),rand(ip+vec2(1.0,0.0)),u.x), + mix(rand(ip+vec2(0.0,1.0)),rand(ip+vec2(1.0,1.0)),u.x),u.y); + return res*res; + } + + float sum( vec4 v ) { return v.x+v.y+v.z; } + + vec4 textureNoTile( sampler2D mapper, in vec2 uv ){ + + // sample variation pattern + float k = 0.0; + if( useNoiseMap == 1.0 ) k = texture2D( noiseMap, 0.005*uv ).x; + else k = directNoise( uv ); + + // compute index + float index = k*8.0; + float f = fract( index ); + float ia = 0.0; + float ib = 0.0; + + if( useSuslikMethod == 1.0 ){ + ia = floor(index+0.5); + ib = floor(index); + f = min(f, 1.0-f)*2.0; + } else { + ia = floor( index ); + ib = ia + 1.0; + } + + // offsets for the different virtual patterns + vec2 offa = sin(vec2(3.0,7.0)*ia); // can replace with any other hash + vec2 offb = sin(vec2(3.0,7.0)*ib); // can replace with any other hash + + // compute derivatives for mip-mapping + vec2 dx = dFdx(uv); + vec2 dy = dFdy(uv); + + // sample the two closest virtual patterns + vec4 cola = textureGrad( mapper, uv + offa, dx, dy ); + vec4 colb = textureGrad( mapper, uv + offb, dx, dy ); + if( debugNoise == 1.0 ){ + cola = vec4( 0.1,0.0,0.0,1.0 ); + colb = vec4( 0.0,0.0,1.0,1.0 ); + } + + // interpolate between the two virtual patterns + return mix( cola, colb, smoothstep(0.2,0.8,f-0.1*sum(cola-colb)) ); + + }`; + +const map_fragment = /* glsl */ ` + #ifdef USE_MAP + + if( enableRandom == 1.0 ) diffuseColor *= textureNoTile( map, vMapUv ); + else diffuseColor *= texture2D( map, vMapUv ); + + #endif + `; + +const alphamap_pars_fragment = /* glsl */ ` + #ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; + uniform float disolve; + uniform float threshold; + #endif + `; + +const alphamap_fragment = /* glsl */ ` + #ifdef USE_ALPHAMAP + float vv = texture2D( alphaMap, vAlphaMapUv ).g; + float r = disolve * (1.0 + threshold * 2.0) - threshold; + float mixf = clamp((vv - r)*(1.0/threshold), 0.0, 1.0); + diffuseColor.a = mixf; + #endif + `; diff --git a/examples-testing/examples/webgl_raycaster_sprite.ts b/examples-testing/examples/webgl_raycaster_sprite.ts new file mode 100644 index 000000000..f35d5de17 --- /dev/null +++ b/examples-testing/examples/webgl_raycaster_sprite.ts @@ -0,0 +1,103 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let renderer, scene, camera; +let group; + +let selectedObject = null; +const raycaster = new THREE.Raycaster(); +const pointer = new THREE.Vector2(); + +init(); + +function init() { + // init renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // init scene + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + group = new THREE.Group(); + scene.add(group); + + // init camera + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(15, 15, 15); + camera.lookAt(scene.position); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 15; + controls.maxDistance = 250; + + // add sprites + + const sprite1 = new THREE.Sprite(new THREE.SpriteMaterial({ color: '#69f' })); + sprite1.position.set(6, 5, 5); + sprite1.scale.set(2, 5, 1); + group.add(sprite1); + + const sprite2 = new THREE.Sprite(new THREE.SpriteMaterial({ color: '#69f', sizeAttenuation: false })); + sprite2.material.rotation = (Math.PI / 3) * 4; + sprite2.position.set(8, -2, 2); + sprite2.center.set(0.5, 0); + sprite2.scale.set(0.1, 0.5, 0.1); + group.add(sprite2); + + const group2 = new THREE.Object3D(); + group2.scale.set(1, 2, 1); + group2.position.set(-5, 0, 0); + group2.rotation.set(Math.PI / 2, 0, 0); + group.add(group2); + + const sprite3 = new THREE.Sprite(new THREE.SpriteMaterial({ color: '#69f' })); + sprite3.position.set(0, 2, 5); + sprite3.scale.set(10, 2, 3); + sprite3.center.set(-0.1, 0); + sprite3.material.rotation = Math.PI / 3; + group2.add(sprite3); + + window.addEventListener('resize', onWindowResize); + document.addEventListener('pointermove', onPointerMove); +} + +function animate() { + renderer.render(scene, camera); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + if (selectedObject) { + selectedObject.material.color.set('#69f'); + selectedObject = null; + } + + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObject(group, true); + + if (intersects.length > 0) { + const res = intersects.filter(function (res) { + return res && res.object; + })[0]; + + if (res && res.object) { + selectedObject = res.object; + selectedObject.material.color.set('#f00'); + } + } +} diff --git a/examples-testing/examples/webgl_raycaster_texture.ts b/examples-testing/examples/webgl_raycaster_texture.ts new file mode 100644 index 000000000..72c7054dc --- /dev/null +++ b/examples-testing/examples/webgl_raycaster_texture.ts @@ -0,0 +1,286 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +const WRAPPING = { + RepeatWrapping: THREE.RepeatWrapping, + ClampToEdgeWrapping: THREE.ClampToEdgeWrapping, + MirroredRepeatWrapping: THREE.MirroredRepeatWrapping, +}; + +const params = { + wrapS: THREE.RepeatWrapping, + wrapT: THREE.RepeatWrapping, + offsetX: 0, + offsetY: 0, + repeatX: 1, + repeatY: 1, + rotation: 0, +}; + +function CanvasTexture(parentTexture) { + this._canvas = document.createElement('canvas'); + this._canvas.width = this._canvas.height = 1024; + this._context2D = this._canvas.getContext('2d'); + + if (parentTexture) { + this._parentTexture.push(parentTexture); + parentTexture.image = this._canvas; + } + + const that = this; + this._background = document.createElement('img'); + this._background.addEventListener('load', function () { + that._canvas.width = that._background.naturalWidth; + that._canvas.height = that._background.naturalHeight; + + that._crossRadius = Math.ceil(Math.min(that._canvas.width, that._canvas.height / 30)); + that._crossMax = Math.ceil(0.70710678 * that._crossRadius); + that._crossMin = Math.ceil(that._crossMax / 10); + that._crossThickness = Math.ceil(that._crossMax / 10); + + that._draw(); + }); + this._background.crossOrigin = ''; + this._background.src = 'textures/uv_grid_opengl.jpg'; + + this._draw(); +} + +CanvasTexture.prototype = { + constructor: CanvasTexture, + + _canvas: null, + _context2D: null, + _xCross: 0, + _yCross: 0, + + _crossRadius: 57, + _crossMax: 40, + _crossMin: 4, + _crossThickness: 4, + + _parentTexture: [], + + addParent: function (parentTexture) { + if (this._parentTexture.indexOf(parentTexture) === -1) { + this._parentTexture.push(parentTexture); + parentTexture.image = this._canvas; + } + }, + + setCrossPosition: function (x, y) { + this._xCross = x * this._canvas.width; + this._yCross = y * this._canvas.height; + + this._draw(); + }, + + _draw: function () { + if (!this._context2D) return; + + this._context2D.clearRect(0, 0, this._canvas.width, this._canvas.height); + + // Background. + this._context2D.drawImage(this._background, 0, 0); + + // Yellow cross. + this._context2D.lineWidth = this._crossThickness * 3; + this._context2D.strokeStyle = '#FFFF00'; + + this._context2D.beginPath(); + this._context2D.moveTo(this._xCross - this._crossMax - 2, this._yCross - this._crossMax - 2); + this._context2D.lineTo(this._xCross - this._crossMin, this._yCross - this._crossMin); + + this._context2D.moveTo(this._xCross + this._crossMin, this._yCross + this._crossMin); + this._context2D.lineTo(this._xCross + this._crossMax + 2, this._yCross + this._crossMax + 2); + + this._context2D.moveTo(this._xCross - this._crossMax - 2, this._yCross + this._crossMax + 2); + this._context2D.lineTo(this._xCross - this._crossMin, this._yCross + this._crossMin); + + this._context2D.moveTo(this._xCross + this._crossMin, this._yCross - this._crossMin); + this._context2D.lineTo(this._xCross + this._crossMax + 2, this._yCross - this._crossMax - 2); + + this._context2D.stroke(); + + for (let i = 0; i < this._parentTexture.length; i++) { + this._parentTexture[i].needsUpdate = true; + } + }, +}; + +const width = window.innerWidth; +const height = window.innerHeight; + +let canvas; +let planeTexture, cubeTexture, circleTexture; + +let container; + +let camera, scene, renderer; + +const raycaster = new THREE.Raycaster(); +const mouse = new THREE.Vector2(); +const onClickPosition = new THREE.Vector2(); + +init(); + +function init() { + container = document.getElementById('container'); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xeeeeee); + + camera = new THREE.PerspectiveCamera(45, width / height, 1, 1000); + camera.position.x = -30; + camera.position.y = 40; + camera.position.z = 50; + camera.lookAt(scene.position); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // A cube, in the middle. + cubeTexture = new THREE.Texture(undefined, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping); + cubeTexture.colorSpace = THREE.SRGBColorSpace; + canvas = new CanvasTexture(cubeTexture); + const cubeMaterial = new THREE.MeshBasicMaterial({ map: cubeTexture }); + const cubeGeometry = new THREE.BoxGeometry(20, 20, 20); + let uvs = cubeGeometry.attributes.uv.array; + // Set a specific texture mapping. + for (let i = 0; i < uvs.length; i++) { + uvs[i] *= 2; + } + + const cube = new THREE.Mesh(cubeGeometry, cubeMaterial); + cube.position.x = 4; + cube.position.y = -5; + cube.position.z = 0; + scene.add(cube); + + // A plane on the left + + planeTexture = new THREE.Texture( + undefined, + THREE.UVMapping, + THREE.MirroredRepeatWrapping, + THREE.MirroredRepeatWrapping, + ); + planeTexture.colorSpace = THREE.SRGBColorSpace; + canvas.addParent(planeTexture); + const planeMaterial = new THREE.MeshBasicMaterial({ map: planeTexture }); + const planeGeometry = new THREE.PlaneGeometry(25, 25, 1, 1); + uvs = planeGeometry.attributes.uv.array; + + // Set a specific texture mapping. + + for (let i = 0; i < uvs.length; i++) { + uvs[i] *= 2; + } + + const plane = new THREE.Mesh(planeGeometry, planeMaterial); + plane.position.x = -16; + plane.position.y = -5; + plane.position.z = 0; + scene.add(plane); + + // A circle on the right. + + circleTexture = new THREE.Texture(undefined, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping); + circleTexture.colorSpace = THREE.SRGBColorSpace; + canvas.addParent(circleTexture); + const circleMaterial = new THREE.MeshBasicMaterial({ map: circleTexture }); + const circleGeometry = new THREE.CircleGeometry(25, 40, 0, Math.PI * 2); + uvs = circleGeometry.attributes.uv.array; + + // Set a specific texture mapping. + + for (let i = 0; i < uvs.length; i++) { + uvs[i] = (uvs[i] - 0.25) * 2; + } + + const circle = new THREE.Mesh(circleGeometry, circleMaterial); + circle.position.x = 24; + circle.position.y = -5; + circle.position.z = 0; + scene.add(circle); + + window.addEventListener('resize', onWindowResize); + container.addEventListener('mousemove', onMouseMove); + + // + + const gui = new GUI(); + gui.title('Circle Texture Settings'); + + gui.add(params, 'wrapS', WRAPPING).onChange(setwrapS); + gui.add(params, 'wrapT', WRAPPING).onChange(setwrapT); + gui.add(params, 'offsetX', 0, 5); + gui.add(params, 'offsetY', 0, 5); + gui.add(params, 'repeatX', 0, 5); + gui.add(params, 'repeatY', 0, 5); + gui.add(params, 'rotation', 0, 2 * Math.PI); + gui.open(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onMouseMove(evt) { + evt.preventDefault(); + + const array = getMousePosition(container, evt.clientX, evt.clientY); + onClickPosition.fromArray(array); + + const intersects = getIntersects(onClickPosition, scene.children); + + if (intersects.length > 0 && intersects[0].uv) { + const uv = intersects[0].uv; + intersects[0].object.material.map.transformUv(uv); + canvas.setCrossPosition(uv.x, uv.y); + } +} + +function getMousePosition(dom, x, y) { + const rect = dom.getBoundingClientRect(); + return [(x - rect.left) / rect.width, (y - rect.top) / rect.height]; +} + +function getIntersects(point, objects) { + mouse.set(point.x * 2 - 1, -(point.y * 2) + 1); + + raycaster.setFromCamera(mouse, camera); + + return raycaster.intersectObjects(objects, false); +} + +function animate() { + // update texture parameters + + circleTexture.offset.x = params.offsetX; + circleTexture.offset.y = params.offsetY; + circleTexture.repeat.x = params.repeatX; + circleTexture.repeat.y = params.repeatY; + circleTexture.rotation = params.rotation; + + // + + renderer.render(scene, camera); +} + +function setwrapS(value) { + circleTexture.wrapS = value; + circleTexture.needsUpdate = true; +} + +function setwrapT(value) { + circleTexture.wrapT = value; + circleTexture.needsUpdate = true; +} diff --git a/examples-testing/examples/webgl_read_float_buffer.ts b/examples-testing/examples/webgl_read_float_buffer.ts new file mode 100644 index 000000000..69f847729 --- /dev/null +++ b/examples-testing/examples/webgl_read_float_buffer.ts @@ -0,0 +1,153 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let cameraRTT, sceneRTT, sceneScreen, renderer, zmesh1, zmesh2; + +let mouseX = 0, + mouseY = 0; + +const windowHalfX = window.innerWidth / 2; +const windowHalfY = window.innerHeight / 2; + +let rtTexture, material, quad; + +let delta = 0.01; +let valueNode; + +init(); + +function init() { + container = document.getElementById('container'); + + cameraRTT = new THREE.OrthographicCamera( + window.innerWidth / -2, + window.innerWidth / 2, + window.innerHeight / 2, + window.innerHeight / -2, + 1, + 1000, + ); + cameraRTT.position.z = 500; + + // + + sceneRTT = new THREE.Scene(); + sceneScreen = new THREE.Scene(); + + let light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 0, 1).normalize(); + sceneRTT.add(light); + + light = new THREE.DirectionalLight(0xffd5d5, 4.5); + light.position.set(0, 0, -1).normalize(); + sceneRTT.add(light); + + rtTexture = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, { + minFilter: THREE.LinearFilter, + magFilter: THREE.NearestFilter, + format: THREE.RGBAFormat, + type: THREE.FloatType, + }); + + material = new THREE.ShaderMaterial({ + uniforms: { time: { value: 0.0 } }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragment_shader_pass_1').textContent, + }); + + const materialScreen = new THREE.ShaderMaterial({ + uniforms: { tDiffuse: { value: rtTexture.texture } }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragment_shader_screen').textContent, + + depthWrite: false, + }); + + const plane = new THREE.PlaneGeometry(window.innerWidth, window.innerHeight); + + quad = new THREE.Mesh(plane, material); + quad.position.z = -100; + sceneRTT.add(quad); + + const geometry = new THREE.TorusGeometry(100, 25, 15, 30); + + const mat1 = new THREE.MeshPhongMaterial({ color: 0x9c9c9c, specular: 0xffaa00, shininess: 5 }); + const mat2 = new THREE.MeshPhongMaterial({ color: 0x9c0000, specular: 0xff2200, shininess: 5 }); + + zmesh1 = new THREE.Mesh(geometry, mat1); + zmesh1.position.set(0, 0, 100); + zmesh1.scale.set(1.5, 1.5, 1.5); + sceneRTT.add(zmesh1); + + zmesh2 = new THREE.Mesh(geometry, mat2); + zmesh2.position.set(0, 150, 100); + zmesh2.scale.set(0.75, 0.75, 0.75); + sceneRTT.add(zmesh2); + + quad = new THREE.Mesh(plane, materialScreen); + quad.position.z = -100; + sceneScreen.add(quad); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + valueNode = document.getElementById('values'); + + document.addEventListener('mousemove', onDocumentMouseMove); +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.0015; + + if (zmesh1 && zmesh2) { + zmesh1.rotation.y = -time; + zmesh2.rotation.y = -time + Math.PI / 2; + } + + if (material.uniforms['time'].value > 1 || material.uniforms['time'].value < 0) { + delta *= -1; + } + + material.uniforms['time'].value += delta; + + renderer.clear(); + + // Render first scene into texture + + renderer.setRenderTarget(rtTexture); + renderer.clear(); + renderer.render(sceneRTT, cameraRTT); + + // Render full screen quad with generated texture + + renderer.setRenderTarget(null); + renderer.render(sceneScreen, cameraRTT); + + const read = new Float32Array(4); + renderer.readRenderTargetPixels(rtTexture, windowHalfX + mouseX, windowHalfY - mouseY, 1, 1, read); + + valueNode.innerHTML = 'r:' + read[0] + '
g:' + read[1] + '
b:' + read[2]; +} diff --git a/examples-testing/examples/webgl_refraction.ts b/examples-testing/examples/webgl_refraction.ts new file mode 100644 index 000000000..b8ef7143d --- /dev/null +++ b/examples-testing/examples/webgl_refraction.ts @@ -0,0 +1,138 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Refractor } from 'three/addons/objects/Refractor.js'; +import { WaterRefractionShader } from 'three/addons/shaders/WaterRefractionShader.js'; + +let camera, scene, renderer, timer; + +let refractor, smallSphere; + +init(); + +async function init() { + const container = document.getElementById('container'); + + timer = new THREE.Timer(); + timer.connect(document); + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); + camera.position.set(0, 75, 160); + + // refractor + + const refractorGeometry = new THREE.PlaneGeometry(90, 90); + + refractor = new Refractor(refractorGeometry, { + color: 0xcbcbcb, + textureWidth: 1024, + textureHeight: 1024, + shader: WaterRefractionShader, + }); + + refractor.position.set(0, 50, 0); + + scene.add(refractor); + + // load dudv map for distortion effect + + const loader = new THREE.TextureLoader(); + const dudvMap = await loader.loadAsync('textures/waterdudv.jpg'); + + dudvMap.wrapS = dudvMap.wrapT = THREE.RepeatWrapping; + refractor.material.uniforms.tDudv.value = dudvMap; + + // + + const geometry = new THREE.IcosahedronGeometry(5, 0); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x333333, flatShading: true }); + smallSphere = new THREE.Mesh(geometry, material); + scene.add(smallSphere); + + // walls + const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); + + const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeTop.position.y = 100; + planeTop.rotateX(Math.PI / 2); + scene.add(planeTop); + + const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeBottom.rotateX(-Math.PI / 2); + scene.add(planeBottom); + + const planeBack = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); + planeBack.position.z = -50; + planeBack.position.y = 50; + scene.add(planeBack); + + const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); + planeRight.position.x = 50; + planeRight.position.y = 50; + planeRight.rotateY(-Math.PI / 2); + scene.add(planeRight); + + const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); + planeLeft.position.x = -50; + planeLeft.position.y = 50; + planeLeft.rotateY(Math.PI / 2); + scene.add(planeLeft); + + // lights + const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); + mainLight.position.y = 60; + scene.add(mainLight); + + const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); + greenLight.position.set(550, 50, 0); + scene.add(greenLight); + + const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); + redLight.position.set(-550, 50, 0); + scene.add(redLight); + + const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); + blueLight.position.set(0, 50, 550); + scene.add(blueLight); + + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 40, 0); + controls.maxDistance = 400; + controls.minDistance = 10; + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const time = timer.getElapsed(); + + refractor.material.uniforms.time.value = time; + + smallSphere.position.set(Math.cos(time) * 30, Math.abs(Math.cos(time * 2)) * 20 + 5, Math.sin(time) * 30); + smallSphere.rotation.y = Math.PI / 2 - time; + smallSphere.rotation.z = time * 8; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_rtt.ts b/examples-testing/examples/webgl_rtt.ts new file mode 100644 index 000000000..b80e78ed3 --- /dev/null +++ b/examples-testing/examples/webgl_rtt.ts @@ -0,0 +1,171 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +let container, stats; + +let cameraRTT, camera, sceneRTT, sceneScreen, scene, renderer, zmesh1, zmesh2; + +let mouseX = 0, + mouseY = 0; + +const windowHalfX = window.innerWidth / 2; +const windowHalfY = window.innerHeight / 2; + +let rtTexture, material, quad; + +let delta = 0.01; + +init(); + +function init() { + container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 100; + + cameraRTT = new THREE.OrthographicCamera( + window.innerWidth / -2, + window.innerWidth / 2, + window.innerHeight / 2, + window.innerHeight / -2, + 1, + 1000, + ); + cameraRTT.position.z = 500; + + // + + scene = new THREE.Scene(); + sceneRTT = new THREE.Scene(); + sceneScreen = new THREE.Scene(); + + let light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 0, 1).normalize(); + sceneRTT.add(light); + + light = new THREE.DirectionalLight(0xffd5d5, 4.5); + light.position.set(0, 0, -1).normalize(); + sceneRTT.add(light); + + rtTexture = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight); + + material = new THREE.ShaderMaterial({ + uniforms: { time: { value: 0.0 } }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragment_shader_pass_1').textContent, + }); + + const materialScreen = new THREE.ShaderMaterial({ + uniforms: { tDiffuse: { value: rtTexture.texture } }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragment_shader_screen').textContent, + + depthWrite: false, + }); + + const plane = new THREE.PlaneGeometry(window.innerWidth, window.innerHeight); + + quad = new THREE.Mesh(plane, material); + quad.position.z = -100; + sceneRTT.add(quad); + + const torusGeometry = new THREE.TorusGeometry(100, 25, 15, 30); + + const mat1 = new THREE.MeshPhongMaterial({ color: 0x9c9c9c, specular: 0xffaa00, shininess: 5 }); + const mat2 = new THREE.MeshPhongMaterial({ color: 0x9c0000, specular: 0xff2200, shininess: 5 }); + + zmesh1 = new THREE.Mesh(torusGeometry, mat1); + zmesh1.position.set(0, 0, 100); + zmesh1.scale.set(1.5, 1.5, 1.5); + sceneRTT.add(zmesh1); + + zmesh2 = new THREE.Mesh(torusGeometry, mat2); + zmesh2.position.set(0, 150, 100); + zmesh2.scale.set(0.75, 0.75, 0.75); + sceneRTT.add(zmesh2); + + quad = new THREE.Mesh(plane, materialScreen); + quad.position.z = -100; + sceneScreen.add(quad); + + const n = 5, + geometry = new THREE.SphereGeometry(10, 64, 32), + material2 = new THREE.MeshBasicMaterial({ color: 0xffffff, map: rtTexture.texture }); + + for (let j = 0; j < n; j++) { + for (let i = 0; i < n; i++) { + const mesh = new THREE.Mesh(geometry, material2); + + mesh.position.x = (i - (n - 1) / 2) * 20; + mesh.position.y = (j - (n - 1) / 2) * 20; + mesh.position.z = 0; + + mesh.rotation.y = -Math.PI / 2; + + scene.add(mesh); + } + } + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + + container.appendChild(renderer.domElement); + + stats = new Stats(); + container.appendChild(stats.dom); + + document.addEventListener('mousemove', onDocumentMouseMove); +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +// + +function animate() { + render(); + stats.update(); +} + +function render() { + const time = Date.now() * 0.0015; + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + if (zmesh1 && zmesh2) { + zmesh1.rotation.y = -time; + zmesh2.rotation.y = -time + Math.PI / 2; + } + + if (material.uniforms['time'].value > 1 || material.uniforms['time'].value < 0) { + delta *= -1; + } + + material.uniforms['time'].value += delta; + + // Render first scene into texture + + renderer.setRenderTarget(rtTexture); + renderer.clear(); + renderer.render(sceneRTT, cameraRTT); + + // Render full screen quad with generated texture + + renderer.setRenderTarget(null); + renderer.clear(); + renderer.render(sceneScreen, cameraRTT); + + // Render second scene to screen + // (using first scene as regular texture) + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_shader.ts b/examples-testing/examples/webgl_shader.ts new file mode 100644 index 000000000..47a6c7ece --- /dev/null +++ b/examples-testing/examples/webgl_shader.ts @@ -0,0 +1,50 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; + +let uniforms; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); + + scene = new THREE.Scene(); + + const geometry = new THREE.PlaneGeometry(2, 2); + + uniforms = { + time: { value: 1.0 }, + }; + + const material = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + uniforms['time'].value = performance.now() / 1000; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_shader_lava.ts b/examples-testing/examples/webgl_shader_lava.ts new file mode 100644 index 000000000..0c974f5b9 --- /dev/null +++ b/examples-testing/examples/webgl_shader_lava.ts @@ -0,0 +1,104 @@ +import * as THREE from 'three'; + +import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; +import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; +import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; +import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; + +let camera, renderer, composer, timer; + +let uniforms, mesh; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 3000); + camera.position.z = 4; + + const scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + const textureLoader = new THREE.TextureLoader(); + + const cloudTexture = textureLoader.load('textures/lava/cloud.png'); + const lavaTexture = textureLoader.load('textures/lava/lavatile.jpg'); + + lavaTexture.colorSpace = THREE.SRGBColorSpace; + + cloudTexture.wrapS = cloudTexture.wrapT = THREE.RepeatWrapping; + lavaTexture.wrapS = lavaTexture.wrapT = THREE.RepeatWrapping; + + uniforms = { + fogDensity: { value: 0.45 }, + fogColor: { value: new THREE.Vector3(0, 0, 0) }, + time: { value: 1.0 }, + uvScale: { value: new THREE.Vector2(3.0, 1.0) }, + texture1: { value: cloudTexture }, + texture2: { value: lavaTexture }, + }; + + const size = 0.65; + + const material = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + }); + + mesh = new THREE.Mesh(new THREE.TorusGeometry(size, 0.3, 30, 30), material); + mesh.rotation.x = 0.3; + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + container.appendChild(renderer.domElement); + + // + + const renderModel = new RenderPass(scene, camera); + const effectBloom = new BloomPass(1.25); + const outputPass = new OutputPass(); + + composer = new EffectComposer(renderer); + + composer.addPass(renderModel); + composer.addPass(effectBloom); + composer.addPass(outputPass); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + composer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const delta = 5 * timer.getDelta(); + + uniforms['time'].value += 0.2 * delta; + + mesh.rotation.y += 0.0125 * delta; + mesh.rotation.x += 0.05 * delta; + + renderer.clear(); + composer.render(0.01); +} diff --git a/examples-testing/examples/webgl_shaders_ocean.ts b/examples-testing/examples/webgl_shaders_ocean.ts new file mode 100644 index 000000000..ab123d972 --- /dev/null +++ b/examples-testing/examples/webgl_shaders_ocean.ts @@ -0,0 +1,200 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Water } from 'three/addons/objects/Water.js'; +import { Sky } from 'three/addons/objects/Sky.js'; +import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; + +let container, stats, timer; +let camera, scene, renderer; +let controls, water, sun, sky, mesh, bloomPass; + +init(); + +function init() { + container = document.getElementById('container'); + + // + + renderer = new THREE.WebGLRenderer({ outputBufferType: THREE.HalfFloatType }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.1; + container.appendChild(renderer.domElement); + + bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); + bloomPass.threshold = 0; + bloomPass.strength = 0.1; + bloomPass.radius = 0; + renderer.setEffects([bloomPass]); + + // + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 1, 20000); + camera.position.set(30, 30, 100); + + timer = new THREE.Timer(); + + // + + sun = new THREE.Vector3(); + + // Water + + const waterGeometry = new THREE.PlaneGeometry(10000, 10000); + + water = new Water(waterGeometry, { + textureWidth: 512, + textureHeight: 512, + waterNormals: new THREE.TextureLoader().load('textures/waternormals.jpg', function (texture) { + texture.wrapS = texture.wrapT = THREE.RepeatWrapping; + }), + sunDirection: new THREE.Vector3(), + sunColor: 0xffffff, + waterColor: 0x001e0f, + distortionScale: 3.7, + fog: scene.fog !== undefined, + }); + + water.rotation.x = -Math.PI / 2; + + scene.add(water); + + // Skybox + + sky = new Sky(); + sky.scale.setScalar(10000); + scene.add(sky); + + const skyUniforms = sky.material.uniforms; + + skyUniforms['turbidity'].value = 10; + skyUniforms['rayleigh'].value = 2; + skyUniforms['mieCoefficient'].value = 0.005; + skyUniforms['mieDirectionalG'].value = 0.8; + skyUniforms['cloudCoverage'].value = 0.4; + skyUniforms['cloudDensity'].value = 0.5; + skyUniforms['cloudElevation'].value = 0.5; + + const parameters = { + elevation: 2, + azimuth: 180, + exposure: 0.1, + }; + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + const sceneEnv = new THREE.Scene(); + + let renderTarget; + + function updateSun() { + const phi = THREE.MathUtils.degToRad(90 - parameters.elevation); + const theta = THREE.MathUtils.degToRad(parameters.azimuth); + + sun.setFromSphericalCoords(1, phi, theta); + + sky.material.uniforms['sunPosition'].value.copy(sun); + water.material.uniforms['sunDirection'].value.copy(sun).normalize(); + + if (renderTarget !== undefined) renderTarget.dispose(); + + sceneEnv.add(sky); + renderTarget = pmremGenerator.fromScene(sceneEnv); + scene.add(sky); + + scene.environment = renderTarget.texture; + } + + updateSun(); + + // + + const geometry = new THREE.BoxGeometry(30, 30, 30); + const material = new THREE.MeshStandardMaterial({ roughness: 0 }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI * 0.495; + controls.target.set(0, 10, 0); + controls.minDistance = 40.0; + controls.maxDistance = 200.0; + controls.update(); + + // + + stats = new Stats(); + container.appendChild(stats.dom); + + // GUI + + const gui = new GUI(); + + const folderSky = gui.addFolder('Sky'); + folderSky.add(parameters, 'elevation', 0, 90, 0.1).onChange(updateSun); + folderSky.add(parameters, 'azimuth', -180, 180, 0.1).onChange(updateSun); + folderSky.add(parameters, 'exposure', 0, 1, 0.0001).onChange(function (value) { + renderer.toneMappingExposure = value; + }); + folderSky.open(); + + const waterUniforms = water.material.uniforms; + + const folderWater = gui.addFolder('Water'); + folderWater.add(waterUniforms.distortionScale, 'value', 0, 8, 0.1).name('distortionScale'); + folderWater.add(waterUniforms.size, 'value', 0.1, 10, 0.1).name('size'); + folderWater.open(); + + const folderBloom = gui.addFolder('Bloom'); + folderBloom.add(bloomPass, 'strength', 0, 3, 0.01); + folderBloom.add(bloomPass, 'radius', 0, 1, 0.01); + folderBloom.open(); + + const folderClouds = gui.addFolder('Clouds'); + folderClouds.add(skyUniforms.cloudCoverage, 'value', 0, 1, 0.01).name('coverage'); + folderClouds.add(skyUniforms.cloudDensity, 'value', 0, 1, 0.01).name('density'); + folderClouds.add(skyUniforms.cloudElevation, 'value', 0, 1, 0.01).name('elevation'); + folderClouds.open(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + render(); + stats.update(); +} + +function render() { + const time = performance.now() * 0.001; + + mesh.position.y = Math.sin(time) * 20 + 5; + mesh.rotation.x = time * 0.5; + mesh.rotation.z = time * 0.51; + + const delta = timer.getDelta(); + + water.material.uniforms['time'].value += delta; + sky.material.uniforms['time'].value = time; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_shaders_sky.ts b/examples-testing/examples/webgl_shaders_sky.ts new file mode 100644 index 000000000..5210662b0 --- /dev/null +++ b/examples-testing/examples/webgl_shaders_sky.ts @@ -0,0 +1,127 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Sky } from 'three/addons/objects/Sky.js'; + +let camera, scene, renderer; + +let sky, sun; + +let sphere, cubeCamera; + +init(); + +function initSky() { + // Add Sky + sky = new Sky(); + sky.scale.setScalar(450000); + scene.add(sky); + + sun = new THREE.Vector3(); + + /// GUI + + const effectController = { + turbidity: 10, + rayleigh: 3, + mieCoefficient: 0.005, + mieDirectionalG: 0.7, + elevation: 65, + azimuth: 0, + exposure: 0.05, + cloudCoverage: 0.4, + cloudDensity: 0.4, + cloudElevation: 0.5, + showSunDisc: true, + }; + + function guiChanged() { + const uniforms = sky.material.uniforms; + uniforms['turbidity'].value = effectController.turbidity; + uniforms['rayleigh'].value = effectController.rayleigh; + uniforms['mieCoefficient'].value = effectController.mieCoefficient; + uniforms['mieDirectionalG'].value = effectController.mieDirectionalG; + uniforms['cloudCoverage'].value = effectController.cloudCoverage; + uniforms['cloudDensity'].value = effectController.cloudDensity; + uniforms['cloudElevation'].value = effectController.cloudElevation; + uniforms['showSunDisc'].value = effectController.showSunDisc; + + const phi = THREE.MathUtils.degToRad(90 - effectController.elevation); + const theta = THREE.MathUtils.degToRad(effectController.azimuth); + + sun.setFromSphericalCoords(1, phi, theta); + + uniforms['sunPosition'].value.copy(sun); + + renderer.toneMappingExposure = effectController.exposure; + } + + const gui = new GUI(); + + gui.add(effectController, 'turbidity', 0.0, 20.0, 0.1).onChange(guiChanged); + gui.add(effectController, 'rayleigh', 0.0, 4, 0.001).onChange(guiChanged); + gui.add(effectController, 'mieCoefficient', 0.0, 0.1, 0.001).onChange(guiChanged); + gui.add(effectController, 'mieDirectionalG', 0.0, 1, 0.001).onChange(guiChanged); + gui.add(effectController, 'elevation', 0, 90, 0.1).onChange(guiChanged); + gui.add(effectController, 'azimuth', -180, 180, 0.1).onChange(guiChanged); + gui.add(effectController, 'exposure', 0, 1, 0.0001).onChange(guiChanged); + gui.add(effectController, 'showSunDisc').onChange(guiChanged); + + const folderClouds = gui.addFolder('Clouds'); + folderClouds.add(effectController, 'cloudCoverage', 0, 1, 0.01).name('coverage').onChange(guiChanged); + folderClouds.add(effectController, 'cloudDensity', 0, 1, 0.01).name('density').onChange(guiChanged); + folderClouds.add(effectController, 'cloudElevation', 0, 1, 0.01).name('elevation').onChange(guiChanged); + + guiChanged(); +} + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 100, 2000000); + camera.position.set(0, 100, 2000); + + scene = new THREE.Scene(); + + const cubeRenderTarget = new THREE.WebGLCubeRenderTarget(256, { type: THREE.HalfFloatType }); + cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); + + sphere = new THREE.Mesh( + new THREE.SphereGeometry(400, 64, 32), + new THREE.MeshBasicMaterial({ envMap: cubeRenderTarget.texture }), + ); + scene.add(sphere); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.5; + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + //controls.maxPolarAngle = Math.PI / 2; + controls.enableZoom = false; + controls.enablePan = false; + + initSky(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + sky.material.uniforms['time'].value = performance.now() * 0.001; + + sphere.visible = false; + cubeCamera.update(renderer, scene); + sphere.visible = true; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_shadow_contact.ts b/examples-testing/examples/webgl_shadow_contact.ts new file mode 100644 index 000000000..f402fa20d --- /dev/null +++ b/examples-testing/examples/webgl_shadow_contact.ts @@ -0,0 +1,272 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; +import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; + +let camera, scene, renderer, stats, gui; + +const meshes = []; + +const PLANE_WIDTH = 2.5; +const PLANE_HEIGHT = 2.5; +const CAMERA_HEIGHT = 0.3; + +const state = { + shadow: { + blur: 3.5, + darkness: 1, + opacity: 1, + }, + plane: { + color: '#ffffff', + opacity: 1, + }, + showWireframe: false, +}; + +let shadowGroup, + renderTarget, + renderTargetBlur, + shadowCamera, + cameraHelper, + depthMaterial, + horizontalBlurMaterial, + verticalBlurMaterial; + +let plane, blurPlane, fillPlane; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0.5, 1, 2); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); + + // add the example meshes + + const geometries = [ + new THREE.BoxGeometry(0.4, 0.4, 0.4), + new THREE.IcosahedronGeometry(0.3), + new THREE.TorusKnotGeometry(0.4, 0.05, 256, 24, 1, 3), + ]; + + const material = new THREE.MeshNormalMaterial(); + + for (let i = 0, l = geometries.length; i < l; i++) { + const angle = (i / l) * Math.PI * 2; + + const geometry = geometries[i]; + const mesh = new THREE.Mesh(geometry, material); + mesh.position.y = 0.1; + mesh.position.x = Math.cos(angle) / 2.0; + mesh.position.z = Math.sin(angle) / 2.0; + scene.add(mesh); + meshes.push(mesh); + } + + // the container, if you need to move the plane just move this + shadowGroup = new THREE.Group(); + shadowGroup.position.y = -0.3; + scene.add(shadowGroup); + + // the render target that will show the shadows in the plane texture + renderTarget = new THREE.WebGLRenderTarget(512, 512); + renderTarget.texture.generateMipmaps = false; + + // the render target that we will use to blur the first render target + renderTargetBlur = new THREE.WebGLRenderTarget(512, 512); + renderTargetBlur.texture.generateMipmaps = false; + + // make a plane and make it face up + const planeGeometry = new THREE.PlaneGeometry(PLANE_WIDTH, PLANE_HEIGHT).rotateX(Math.PI / 2); + const planeMaterial = new THREE.MeshBasicMaterial({ + map: renderTarget.texture, + opacity: state.shadow.opacity, + transparent: true, + depthWrite: false, + }); + plane = new THREE.Mesh(planeGeometry, planeMaterial); + // make sure it's rendered after the fillPlane + plane.renderOrder = 1; + shadowGroup.add(plane); + + // the y from the texture is flipped! + plane.scale.y = -1; + + // the plane onto which to blur the texture + blurPlane = new THREE.Mesh(planeGeometry); + blurPlane.visible = false; + shadowGroup.add(blurPlane); + + // the plane with the color of the ground + const fillPlaneMaterial = new THREE.MeshBasicMaterial({ + color: state.plane.color, + opacity: state.plane.opacity, + transparent: true, + depthWrite: false, + }); + fillPlane = new THREE.Mesh(planeGeometry, fillPlaneMaterial); + fillPlane.rotateX(Math.PI); + shadowGroup.add(fillPlane); + + // the camera to render the depth material from + shadowCamera = new THREE.OrthographicCamera( + -PLANE_WIDTH / 2, + PLANE_WIDTH / 2, + PLANE_HEIGHT / 2, + -PLANE_HEIGHT / 2, + 0, + CAMERA_HEIGHT, + ); + shadowCamera.rotation.x = Math.PI / 2; // get the camera to look up + shadowGroup.add(shadowCamera); + + cameraHelper = new THREE.CameraHelper(shadowCamera); + + // like MeshDepthMaterial, but goes from black to transparent + depthMaterial = new THREE.MeshDepthMaterial(); + depthMaterial.userData.darkness = { value: state.shadow.darkness }; + depthMaterial.onBeforeCompile = function (shader) { + shader.uniforms.darkness = depthMaterial.userData.darkness; + shader.fragmentShader = /* glsl */ ` + uniform float darkness; + ${shader.fragmentShader.replace( + 'gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );', + 'gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );', + )} + `; + }; + + depthMaterial.depthTest = false; + depthMaterial.depthWrite = false; + + horizontalBlurMaterial = new THREE.ShaderMaterial(HorizontalBlurShader); + horizontalBlurMaterial.depthTest = false; + + verticalBlurMaterial = new THREE.ShaderMaterial(VerticalBlurShader); + verticalBlurMaterial.depthTest = false; + + // + + gui = new GUI(); + const shadowFolder = gui.addFolder('shadow'); + shadowFolder.open(); + const planeFolder = gui.addFolder('plane'); + planeFolder.open(); + + shadowFolder.add(state.shadow, 'blur', 0, 15, 0.1); + shadowFolder.add(state.shadow, 'darkness', 1, 5, 0.1).onChange(function () { + depthMaterial.userData.darkness.value = state.shadow.darkness; + }); + shadowFolder.add(state.shadow, 'opacity', 0, 1, 0.01).onChange(function () { + plane.material.opacity = state.shadow.opacity; + }); + planeFolder.addColor(state.plane, 'color').onChange(function () { + fillPlane.material.color = new THREE.Color(state.plane.color); + }); + planeFolder.add(state.plane, 'opacity', 0, 1, 0.01).onChange(function () { + fillPlane.material.opacity = state.plane.opacity; + }); + + gui.add(state, 'showWireframe').onChange(function () { + if (state.showWireframe) { + scene.add(cameraHelper); + } else { + scene.remove(cameraHelper); + } + }); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + new OrbitControls(camera, renderer.domElement); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// renderTarget --> blurPlane (horizontalBlur) --> renderTargetBlur --> blurPlane (verticalBlur) --> renderTarget +function blurShadow(amount) { + blurPlane.visible = true; + + // blur horizontally and draw in the renderTargetBlur + blurPlane.material = horizontalBlurMaterial; + blurPlane.material.uniforms.tDiffuse.value = renderTarget.texture; + horizontalBlurMaterial.uniforms.h.value = (amount * 1) / 256; + + renderer.setRenderTarget(renderTargetBlur); + renderer.render(blurPlane, shadowCamera); + + // blur vertically and draw in the main renderTarget + blurPlane.material = verticalBlurMaterial; + blurPlane.material.uniforms.tDiffuse.value = renderTargetBlur.texture; + verticalBlurMaterial.uniforms.v.value = (amount * 1) / 256; + + renderer.setRenderTarget(renderTarget); + renderer.render(blurPlane, shadowCamera); + + blurPlane.visible = false; +} + +function animate() { + meshes.forEach(mesh => { + mesh.rotation.x += 0.01; + mesh.rotation.y += 0.02; + }); + + // + + // remove the background + const initialBackground = scene.background; + scene.background = null; + + // force the depthMaterial to everything + cameraHelper.visible = false; + scene.overrideMaterial = depthMaterial; + + // set renderer clear alpha + const initialClearAlpha = renderer.getClearAlpha(); + renderer.setClearAlpha(0); + + // render to the render target to get the depths + renderer.setRenderTarget(renderTarget); + renderer.render(scene, shadowCamera); + + // and reset the override material + scene.overrideMaterial = null; + cameraHelper.visible = true; + + blurShadow(state.shadow.blur); + + // a second pass to reduce the artifacts + // (0.4 is the minimum blur amount so that the artifacts are gone) + blurShadow(state.shadow.blur * 0.4); + + // reset and render the normal scene + renderer.setRenderTarget(null); + renderer.setClearAlpha(initialClearAlpha); + scene.background = initialBackground; + + renderer.render(scene, camera); + stats.update(); +} diff --git a/examples-testing/examples/webgl_shadowmap.ts b/examples-testing/examples/webgl_shadowmap.ts new file mode 100644 index 000000000..9557bb051 --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap.ts @@ -0,0 +1,310 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; +import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; + +const SHADOW_MAP_WIDTH = 2048, + SHADOW_MAP_HEIGHT = 1024; + +const SCREEN_WIDTH = window.innerWidth; +const SCREEN_HEIGHT = window.innerHeight; +const FLOOR = -250; + +let camera, controls, scene, renderer; +let container, stats; + +const NEAR = 10, + FAR = 3000; + +let mixer; + +const morphs = []; + +let light; +let lightShadowMapViewer; + +const timer = new THREE.Timer(); +timer.connect(document); + +let showHUD = false; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // CAMERA + + camera = new THREE.PerspectiveCamera(23, SCREEN_WIDTH / SCREEN_HEIGHT, NEAR, FAR); + camera.position.set(700, 50, 1900); + + // SCENE + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x59472b); + scene.fog = new THREE.Fog(0x59472b, 1000, FAR); + + // LIGHTS + + const ambient = new THREE.AmbientLight(0xffffff); + scene.add(ambient); + + light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 1500, 1000); + light.castShadow = true; + light.shadow.camera.top = 2000; + light.shadow.camera.bottom = -2000; + light.shadow.camera.left = -2000; + light.shadow.camera.right = 2000; + light.shadow.camera.near = 1200; + light.shadow.camera.far = 2500; + light.shadow.bias = 0.0001; + + light.shadow.mapSize.width = SHADOW_MAP_WIDTH; + light.shadow.mapSize.height = SHADOW_MAP_HEIGHT; + + scene.add(light); + + createHUD(); + createScene(); + + // RENDERER + + renderer = new THREE.WebGLRenderer({ antialias: true, reversedDepthBuffer: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + renderer.autoClear = false; + + // + + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + + // CONTROLS + + controls = new OrbitControls(camera, renderer.domElement); + controls.enablePan = false; + controls.maxPolarAngle = Math.PI / 2; + controls.minDistance = 200; + controls.maxDistance = 2200; + + controls.target.set(0, -75, 25); + controls.update(); + + // STATS + + stats = new Stats(); + //container.appendChild( stats.dom ); + + // + + window.addEventListener('resize', onWindowResize); + window.addEventListener('keydown', onKeyDown); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onKeyDown(event) { + switch (event.keyCode) { + case 84 /*t*/: + showHUD = !showHUD; + break; + } +} + +function createHUD() { + lightShadowMapViewer = new ShadowMapViewer(light); + lightShadowMapViewer.position.x = 10; + lightShadowMapViewer.position.y = SCREEN_HEIGHT - SHADOW_MAP_HEIGHT / 4 - 10; + lightShadowMapViewer.size.width = SHADOW_MAP_WIDTH / 4; + lightShadowMapViewer.size.height = SHADOW_MAP_HEIGHT / 4; + lightShadowMapViewer.update(); +} + +function createScene() { + // GROUND + + const geometry = new THREE.PlaneGeometry(100, 100); + const planeMaterial = new THREE.MeshPhongMaterial({ color: 0xffdd99 }); + + const ground = new THREE.Mesh(geometry, planeMaterial); + + ground.position.set(0, FLOOR, 0); + ground.rotation.x = -Math.PI / 2; + ground.scale.set(100, 100, 100); + + ground.castShadow = false; + ground.receiveShadow = true; + + scene.add(ground); + + // TEXT + + const loader = new FontLoader(); + loader.load('fonts/helvetiker_bold.typeface.json', function (font) { + const textGeo = new TextGeometry('THREE.JS', { + font: font, + + size: 200, + depth: 50, + curveSegments: 12, + + bevelThickness: 2, + bevelSize: 5, + bevelEnabled: true, + }); + + textGeo.computeBoundingBox(); + const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); + + const textMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000, specular: 0xffffff }); + + const mesh = new THREE.Mesh(textGeo, textMaterial); + mesh.position.x = centerOffset; + mesh.position.y = FLOOR + 67; + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); + }); + + // CUBES + + const cubes1 = new THREE.Mesh(new THREE.BoxGeometry(1500, 220, 150), planeMaterial); + + cubes1.position.y = FLOOR - 50; + cubes1.position.z = 20; + + cubes1.castShadow = true; + cubes1.receiveShadow = true; + + scene.add(cubes1); + + const cubes2 = new THREE.Mesh(new THREE.BoxGeometry(1600, 170, 250), planeMaterial); + + cubes2.position.y = FLOOR - 50; + cubes2.position.z = 20; + + cubes2.castShadow = true; + cubes2.receiveShadow = true; + + scene.add(cubes2); + + // MORPHS + + mixer = new THREE.AnimationMixer(scene); + + function addMorph(mesh, clip, speed, duration, x, y, z, fudgeColor) { + mesh = mesh.clone(); + mesh.material = mesh.material.clone(); + + if (fudgeColor) { + mesh.material.color.offsetHSL(0, Math.random() * 0.5 - 0.25, Math.random() * 0.5 - 0.25); + } + + mesh.speed = speed; + + mixer + .clipAction(clip, mesh) + .setDuration(duration) + // to shift the playback out of phase: + .startAt(-duration * Math.random()) + .play(); + + mesh.position.set(x, y, z); + mesh.rotation.y = Math.PI / 2; + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); + + morphs.push(mesh); + } + + const gltfloader = new GLTFLoader(); + + gltfloader.load('models/gltf/Horse.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + + const clip = gltf.animations[0]; + + addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, 300, true); + addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, 450, true); + addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, 600, true); + + addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, -300, true); + addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, -450, true); + addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, -600, true); + }); + + gltfloader.load('models/gltf/Flamingo.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + const clip = gltf.animations[0]; + + addMorph(mesh, clip, 500, 1, 500 - Math.random() * 500, FLOOR + 350, 40); + }); + + gltfloader.load('models/gltf/Stork.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + const clip = gltf.animations[0]; + + addMorph(mesh, clip, 350, 1, 500 - Math.random() * 500, FLOOR + 350, 340); + }); + + gltfloader.load('models/gltf/Parrot.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + const clip = gltf.animations[0]; + + addMorph(mesh, clip, 450, 0.5, 500 - Math.random() * 500, FLOOR + 300, 700); + }); +} + +function animate() { + timer.update(); + + render(); + stats.update(); +} + +function render() { + const delta = timer.getDelta(); + + mixer.update(delta); + + for (let i = 0; i < morphs.length; i++) { + const morph = morphs[i]; + + morph.position.x += morph.speed * delta; + + if (morph.position.x > 2000) { + morph.position.x = -1000 - Math.random() * 500; + } + } + + controls.update(delta); + + renderer.clear(); + renderer.render(scene, camera); + + // Render debug HUD with shadow map + + if (showHUD) { + lightShadowMapViewer.render(renderer); + } +} diff --git a/examples-testing/examples/webgl_shadowmap_csm.ts b/examples-testing/examples/webgl_shadowmap_csm.ts new file mode 100644 index 000000000..c8e959a0b --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap_csm.ts @@ -0,0 +1,253 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { CSM } from 'three/addons/csm/CSM.js'; +import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; + +let renderer, scene, camera, orthoCamera, controls, csm, csmHelper; + +const params = { + orthographic: false, + fade: false, + shadows: true, + far: 1000, + mode: 'practical', + lightX: -1, + lightY: -1, + lightZ: -1, + margin: 100, + lightFar: 5000, + lightNear: 1, + autoUpdateHelper: true, + updateHelper: function () { + csmHelper.update(); + }, +}; + +init(); + +function updateOrthoCamera() { + const size = controls.target.distanceTo(camera.position); + const aspect = camera.aspect; + + orthoCamera.left = (size * aspect) / -2; + orthoCamera.right = (size * aspect) / 2; + + orthoCamera.top = size / 2; + orthoCamera.bottom = size / -2; + orthoCamera.position.copy(camera.position); + orthoCamera.rotation.copy(camera.rotation); + orthoCamera.updateProjectionMatrix(); +} + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color('#454e61'); + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 5000); + orthoCamera = new THREE.OrthographicCamera(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + renderer.shadowMap.enabled = params.shadows; + renderer.shadowMap.type = THREE.PCFShadowMap; + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI / 2; + camera.position.set(60, 60, 0); + controls.target = new THREE.Vector3(-100, 10, 0); + controls.update(); + + const ambientLight = new THREE.AmbientLight(0xffffff, 1.5); + scene.add(ambientLight); + + const additionalDirectionalLight = new THREE.DirectionalLight(0x000020, 1.5); + additionalDirectionalLight.position + .set(params.lightX, params.lightY, params.lightZ) + .normalize() + .multiplyScalar(-200); + scene.add(additionalDirectionalLight); + + csm = new CSM({ + maxFar: params.far, + cascades: 4, + mode: params.mode, + parent: scene, + shadowMapSize: 1024, + lightDirection: new THREE.Vector3(params.lightX, params.lightY, params.lightZ).normalize(), + camera: camera, + }); + + csmHelper = new CSMHelper(csm); + csmHelper.visible = false; + scene.add(csmHelper); + + const floorMaterial = new THREE.MeshPhongMaterial({ color: '#252a34' }); + csm.setupMaterial(floorMaterial); + + const floor = new THREE.Mesh(new THREE.PlaneGeometry(10000, 10000, 8, 8), floorMaterial); + floor.rotation.x = -Math.PI / 2; + floor.castShadow = true; + floor.receiveShadow = true; + scene.add(floor); + + const material1 = new THREE.MeshPhongMaterial({ color: '#08d9d6' }); + csm.setupMaterial(material1); + + const material2 = new THREE.MeshPhongMaterial({ color: '#ff2e63' }); + csm.setupMaterial(material2); + + const geometry = new THREE.BoxGeometry(10, 10, 10); + + for (let i = 0; i < 40; i++) { + const cube1 = new THREE.Mesh(geometry, i % 2 === 0 ? material1 : material2); + cube1.castShadow = true; + cube1.receiveShadow = true; + scene.add(cube1); + cube1.position.set(-i * 25, 20, 30); + cube1.scale.y = Math.random() * 2 + 6; + + const cube2 = new THREE.Mesh(geometry, i % 2 === 0 ? material2 : material1); + cube2.castShadow = true; + cube2.receiveShadow = true; + scene.add(cube2); + cube2.position.set(-i * 25, 20, -30); + cube2.scale.y = Math.random() * 2 + 6; + } + + const gui = new GUI(); + + gui.add(params, 'orthographic').onChange(function (value) { + csm.camera = value ? orthoCamera : camera; + csm.updateFrustums(); + }); + + gui.add(params, 'fade').onChange(function (value) { + csm.fade = value; + csm.updateFrustums(); + }); + + gui.add(params, 'shadows').onChange(function (value) { + renderer.shadowMap.enabled = value; + + scene.traverse(function (child) { + if (child.material) { + child.material.needsUpdate = true; + } + }); + }); + + gui.add(params, 'far', 1, 5000) + .step(1) + .name('shadow far') + .onChange(function (value) { + csm.maxFar = value; + csm.updateFrustums(); + }); + + gui.add(params, 'mode', ['uniform', 'logarithmic', 'practical']) + .name('frustum split mode') + .onChange(function (value) { + csm.mode = value; + csm.updateFrustums(); + }); + + gui.add(params, 'lightX', -1, 1) + .name('light direction x') + .onChange(function (value) { + csm.lightDirection.x = value; + }); + + gui.add(params, 'lightY', -1, 1) + .name('light direction y') + .onChange(function (value) { + csm.lightDirection.y = value; + }); + + gui.add(params, 'lightZ', -1, 1) + .name('light direction z') + .onChange(function (value) { + csm.lightDirection.z = value; + }); + + gui.add(params, 'margin', 0, 200) + .name('light margin') + .onChange(function (value) { + csm.lightMargin = value; + }); + + gui.add(params, 'lightNear', 1, 10000) + .name('light near') + .onChange(function (value) { + for (let i = 0; i < csm.lights.length; i++) { + csm.lights[i].shadow.camera.near = value; + csm.lights[i].shadow.camera.updateProjectionMatrix(); + } + }); + + gui.add(params, 'lightFar', 1, 10000) + .name('light far') + .onChange(function (value) { + for (let i = 0; i < csm.lights.length; i++) { + csm.lights[i].shadow.camera.far = value; + csm.lights[i].shadow.camera.updateProjectionMatrix(); + } + }); + + const helperFolder = gui.addFolder('helper'); + + helperFolder.add(csmHelper, 'visible'); + + helperFolder.add(csmHelper, 'displayFrustum').onChange(function () { + csmHelper.updateVisibility(); + }); + + helperFolder.add(csmHelper, 'displayPlanes').onChange(function () { + csmHelper.updateVisibility(); + }); + + helperFolder.add(csmHelper, 'displayShadowBounds').onChange(function () { + csmHelper.updateVisibility(); + }); + + helperFolder.add(params, 'autoUpdateHelper').name('auto update'); + + helperFolder.add(params, 'updateHelper').name('update'); + + helperFolder.open(); + + window.addEventListener('resize', function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + updateOrthoCamera(); + csm.updateFrustums(); + + renderer.setSize(window.innerWidth, window.innerHeight); + }); +} + +function animate() { + camera.updateMatrixWorld(); + csm.update(); + controls.update(); + + if (params.orthographic) { + updateOrthoCamera(); + csm.updateFrustums(); + + if (params.autoUpdateHelper) { + csmHelper.update(); + } + + renderer.render(scene, orthoCamera); + } else { + if (params.autoUpdateHelper) { + csmHelper.update(); + } + + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgl_shadowmap_pcss.ts b/examples-testing/examples/webgl_shadowmap_pcss.ts new file mode 100644 index 000000000..de5426883 --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap_pcss.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let stats; +let camera, scene, renderer; + +let group; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + // scene + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0xcce0ff, 5, 100); + + // camera + + camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); + + // We use this particular camera position in order to expose a bug that can sometimes happen presumably + // due to lack of precision when interpolating values over really large triangles. + // It reproduced on at least NVIDIA GTX 1080 and GTX 1050 Ti GPUs when the ground plane was not + // subdivided into segments. + camera.position.x = 7; + camera.position.y = 13; + camera.position.z = 7; + + scene.add(camera); + + // lights + + scene.add(new THREE.AmbientLight(0xaaaaaa, 3)); + + const light = new THREE.DirectionalLight(0xf0f6ff, 4.5); + light.position.set(2, 8, 4); + + light.castShadow = true; + light.shadow.mapSize.width = 1024; + light.shadow.mapSize.height = 1024; + light.shadow.camera.far = 20; + + scene.add(light); + + // scene.add( new DirectionalLightHelper( light ) ); + scene.add(new THREE.CameraHelper(light.shadow.camera)); + + // group + + group = new THREE.Group(); + scene.add(group); + + const geometry = new THREE.SphereGeometry(0.3, 20, 20); + + for (let i = 0; i < 20; i++) { + const material = new THREE.MeshPhongMaterial({ color: Math.random() * 0xffffff }); + + const sphere = new THREE.Mesh(geometry, material); + sphere.position.x = Math.random() - 0.5; + sphere.position.z = Math.random() - 0.5; + sphere.position.normalize(); + sphere.position.multiplyScalar(Math.random() * 2 + 1); + sphere.castShadow = true; + sphere.receiveShadow = true; + sphere.userData.phase = Math.random() * Math.PI; + group.add(sphere); + } + + // ground + + const groundMaterial = new THREE.MeshPhongMaterial({ color: 0x898989 }); + + const ground = new THREE.Mesh(new THREE.PlaneGeometry(20000, 20000, 8, 8), groundMaterial); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + // column + + const column = new THREE.Mesh(new THREE.BoxGeometry(1, 4, 1), groundMaterial); + column.position.y = 2; + column.castShadow = true; + column.receiveShadow = true; + scene.add(column); + + // overwrite shadowmap code + + let shader = THREE.ShaderChunk.shadowmap_pars_fragment; + + shader = shader.replace( + '#ifdef USE_SHADOWMAP', + '#ifdef USE_SHADOWMAP' + document.getElementById('PCSS').textContent, + ); + + shader = shader.replace( + '\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;', + '\t\t\tif ( frustumTest ) {\n' + + document.getElementById('PCSSGetShadow').textContent + + '\n' + + '\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;', + ); + + THREE.ShaderChunk.shadowmap_pars_fragment = shader; + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.setClearColor(scene.fog.color); + + container.appendChild(renderer.domElement); + + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.BasicShadowMap; // PCSS requires reading raw depth values + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI * 0.5; + controls.minDistance = 10; + controls.maxDistance = 75; + controls.target.set(0, 2.5, 0); + controls.update(); + + // performance monitor + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + const time = performance.now() / 1000; + + group.traverse(function (child) { + if ('phase' in child.userData) { + child.position.y = Math.abs(Math.sin(time + child.userData.phase)) * 4 + 0.3; + } + }); + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_shadowmap_performance.ts b/examples-testing/examples/webgl_shadowmap_performance.ts new file mode 100644 index 000000000..437e986a9 --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap_performance.ts @@ -0,0 +1,270 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +let SCREEN_WIDTH = window.innerWidth; +let SCREEN_HEIGHT = window.innerHeight; +const FLOOR = -250; + +const ANIMATION_GROUPS = 25; + +let camera, controls, scene, renderer; +let stats; + +const NEAR = 5, + FAR = 3000; + +let morph, mixer; + +const morphs = [], + animGroups = []; + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + // CAMERA + + camera = new THREE.PerspectiveCamera(23, SCREEN_WIDTH / SCREEN_HEIGHT, NEAR, FAR); + camera.position.set(700, 50, 1900); + + // SCENE + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x59472b); + scene.fog = new THREE.Fog(0x59472b, 1000, FAR); + + // LIGHTS + + const ambient = new THREE.AmbientLight(0xffffff); + scene.add(ambient); + + const sunLight = new THREE.SunLight(0xffffff, 3); + sunLight.position.set(0, 1500, 1000); + sunLight.castShadow = true; + sunLight.shadow.camera.far = FAR; + sunLight.shadow.normalBias = 1; + scene.add(sunLight); + + createScene(); + + // RENDERER + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + renderer.autoClear = false; + + // + + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + + // CONTROLS + + controls = new FirstPersonControls(camera, renderer.domElement); + + controls.lookSpeed = 0.0125; + controls.movementSpeed = 500; + controls.lookVertical = true; + + controls.lookAt(scene.position); + + // STATS + + stats = new Stats(); + container.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + SCREEN_WIDTH = window.innerWidth; + SCREEN_HEIGHT = window.innerHeight; + + camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + camera.updateProjectionMatrix(); + + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); +} + +function createScene() { + // GROUND + + const geometry = new THREE.PlaneGeometry(100, 100); + const planeMaterial = new THREE.MeshPhongMaterial({ color: 0xffdd99 }); + + const ground = new THREE.Mesh(geometry, planeMaterial); + + ground.position.set(0, FLOOR, 0); + ground.rotation.x = -Math.PI / 2; + ground.scale.set(100, 100, 100); + + ground.castShadow = false; + ground.receiveShadow = true; + + scene.add(ground); + + // TEXT + + const loader = new FontLoader(); + loader.load('fonts/helvetiker_bold.typeface.json', function (font) { + const textGeo = new TextGeometry('THREE.JS', { + font: font, + + size: 200, + depth: 50, + curveSegments: 12, + + bevelThickness: 2, + bevelSize: 5, + bevelEnabled: true, + }); + + textGeo.computeBoundingBox(); + const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); + + const textMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000, specular: 0xffffff }); + + const mesh = new THREE.Mesh(textGeo, textMaterial); + mesh.position.x = centerOffset; + mesh.position.y = FLOOR + 67; + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); + }); + + // CUBES + + const cubes1 = new THREE.Mesh(new THREE.BoxGeometry(1500, 220, 150), planeMaterial); + + cubes1.position.y = FLOOR - 50; + cubes1.position.z = 20; + + cubes1.castShadow = true; + cubes1.receiveShadow = true; + + scene.add(cubes1); + + const cubes2 = new THREE.Mesh(new THREE.BoxGeometry(1600, 170, 250), planeMaterial); + + cubes2.position.y = FLOOR - 50; + cubes2.position.z = 20; + + cubes2.castShadow = true; + cubes2.receiveShadow = true; + + scene.add(cubes2); + + mixer = new THREE.AnimationMixer(scene); + + for (let i = 0; i !== ANIMATION_GROUPS; ++i) { + const group = new THREE.AnimationObjectGroup(); + animGroups.push(group); + } + + // MORPHS + + function addMorph(mesh, clip, speed, duration, x, y, z, fudgeColor, massOptimization) { + mesh = mesh.clone(); + mesh.material = mesh.material.clone(); + + if (fudgeColor) { + mesh.material.color.offsetHSL(0, Math.random() * 0.5 - 0.25, Math.random() * 0.5 - 0.25); + } + + mesh.speed = speed; + + if (massOptimization) { + const index = Math.floor(Math.random() * ANIMATION_GROUPS), + animGroup = animGroups[index]; + + animGroup.add(mesh); + + if (!mixer.existingAction(clip, animGroup)) { + const randomness = 0.6 * Math.random() - 0.3; + const phase = (index + randomness) / ANIMATION_GROUPS; + + mixer + .clipAction(clip, animGroup) + .setDuration(duration) + .startAt(-duration * phase) + .play(); + } + } else { + mixer + .clipAction(clip, mesh) + .setDuration(duration) + .startAt(-duration * Math.random()) + .play(); + } + + mesh.position.set(x, y, z); + mesh.rotation.y = Math.PI / 2; + + mesh.castShadow = true; + mesh.receiveShadow = true; + + scene.add(mesh); + + morphs.push(mesh); + } + + const gltfLoader = new GLTFLoader(); + gltfLoader.load('models/gltf/Horse.glb', function (gltf) { + const mesh = gltf.scene.children[0]; + const clip = gltf.animations[0]; + + for (let i = -600; i < 601; i += 2) { + addMorph(mesh, clip, 550, 1, 100 - Math.random() * 3000, FLOOR, i, true, true); + } + }); +} + +// + +function animate() { + timer.update(); + + stats.begin(); + render(); + stats.end(); +} + +function render() { + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + for (let i = 0; i < morphs.length; i++) { + morph = morphs[i]; + + morph.position.x += morph.speed * delta; + + if (morph.position.x > 2000) { + morph.position.x = -1000 - Math.random() * 500; + } + } + + controls.update(delta); + + renderer.clear(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_shadowmap_pointlight.ts b/examples-testing/examples/webgl_shadowmap_pointlight.ts new file mode 100644 index 000000000..8ec939c12 --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap_pointlight.ts @@ -0,0 +1,141 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, stats; +let pointLight, pointLight2; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 10, 40); + + scene = new THREE.Scene(); + scene.add(new THREE.AmbientLight(0x111122, 3)); + + // lights + + function createLight(color) { + const intensity = 200; + + const light = new THREE.PointLight(color, intensity, 20); + light.castShadow = true; + light.shadow.bias = -0.005; // reduces self-shadowing on double-sided objects + light.shadow.mapSize.setScalar(128); + light.shadow.radius = 10; + + let geometry = new THREE.SphereGeometry(0.3, 12, 6); + let material = new THREE.MeshBasicMaterial({ color: color }); + material.color.multiplyScalar(intensity); + let sphere = new THREE.Mesh(geometry, material); + light.add(sphere); + + const texture = new THREE.CanvasTexture(generateTexture()); + texture.magFilter = THREE.NearestFilter; + texture.wrapT = THREE.RepeatWrapping; + texture.wrapS = THREE.RepeatWrapping; + texture.repeat.set(1, 4.5); + + geometry = new THREE.SphereGeometry(2, 32, 8); + material = new THREE.MeshPhongMaterial({ + side: THREE.DoubleSide, + alphaMap: texture, + alphaTest: 0.5, + }); + + sphere = new THREE.Mesh(geometry, material); + sphere.castShadow = true; + sphere.receiveShadow = true; + light.add(sphere); + + return light; + } + + pointLight = createLight(0x0088ff); + scene.add(pointLight); + + pointLight2 = createLight(0xff8888); + scene.add(pointLight2); + // + + const geometry = new THREE.BoxGeometry(30, 30, 30); + + const material = new THREE.MeshPhongMaterial({ + color: 0xa0adaf, + shininess: 10, + specular: 0x111111, + side: THREE.BackSide, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.y = 10; + mesh.receiveShadow = true; + scene.add(mesh); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + // renderer.shadowMap.type = THREE.BasicShadowMap; + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 10, 0); + controls.update(); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function generateTexture() { + const canvas = document.createElement('canvas'); + canvas.width = 2; + canvas.height = 2; + + const context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 1, 2, 1); + + return canvas; +} + +function animate() { + let time = performance.now() * 0.001; + + pointLight.position.x = Math.sin(time * 0.6) * 9; + pointLight.position.y = Math.sin(time * 0.7) * 9 + 6; + pointLight.position.z = Math.sin(time * 0.8) * 9; + + pointLight.rotation.x = time; + pointLight.rotation.z = time; + + time += 10000; + + pointLight2.position.x = Math.sin(time * 0.6) * 9; + pointLight2.position.y = Math.sin(time * 0.7) * 9 + 6; + pointLight2.position.z = Math.sin(time * 0.8) * 9; + + pointLight2.rotation.x = time; + pointLight2.rotation.z = time; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_shadowmap_progressive.ts b/examples-testing/examples/webgl_shadowmap_progressive.ts new file mode 100644 index 000000000..29298630f --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap_progressive.ts @@ -0,0 +1,204 @@ +import * as THREE from 'three'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TransformControls } from 'three/addons/controls/TransformControls.js'; +import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js'; + +// ShadowMap + LightMap Res and Number of Directional Lights +const shadowMapRes = 512, + lightMapRes = 1024, + lightCount = 8; +let camera, + scene, + renderer, + controls, + control, + control2, + object = new THREE.Mesh(), + lightOrigin = null, + progressiveSurfacemap; +const dirLights = [], + lightmapObjects = []; +const params = { + Enable: true, + 'Blur Edges': true, + 'Blend Window': 200, + 'Light Radius': 50, + 'Ambient Weight': 0.5, + 'Debug Lightmap': false, +}; +init(); +createGUI(); + +function init() { + // renderer + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // camera + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 100, 200); + camera.name = 'Camera'; + + // scene + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x949494); + scene.fog = new THREE.Fog(0x949494, 1000, 3000); + + // progressive lightmap + progressiveSurfacemap = new ProgressiveLightMap(renderer, lightMapRes); + + // directional lighting "origin" + lightOrigin = new THREE.Group(); + lightOrigin.position.set(60, 150, 100); + scene.add(lightOrigin); + + // transform gizmo + control = new TransformControls(camera, renderer.domElement); + control.addEventListener('dragging-changed', event => { + controls.enabled = !event.value; + }); + control.attach(lightOrigin); + scene.add(control.getHelper()); + + // create 8 directional lights to speed up the convergence + for (let l = 0; l < lightCount; l++) { + const dirLight = new THREE.DirectionalLight(0xffffff, Math.PI / lightCount); + dirLight.name = 'Dir. Light ' + l; + dirLight.position.set(200, 200, 200); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 100; + dirLight.shadow.camera.far = 5000; + dirLight.shadow.camera.right = 150; + dirLight.shadow.camera.left = -150; + dirLight.shadow.camera.top = 150; + dirLight.shadow.camera.bottom = -150; + dirLight.shadow.mapSize.width = shadowMapRes; + dirLight.shadow.mapSize.height = shadowMapRes; + lightmapObjects.push(dirLight); + dirLights.push(dirLight); + } + + // ground + const groundMesh = new THREE.Mesh( + new THREE.PlaneGeometry(600, 600), + new THREE.MeshPhongMaterial({ color: 0xffffff, depthWrite: true }), + ); + groundMesh.position.y = -0.1; + groundMesh.rotation.x = -Math.PI / 2; + groundMesh.name = 'Ground Mesh'; + lightmapObjects.push(groundMesh); + scene.add(groundMesh); + + // model + function loadModel() { + object.traverse(function (child) { + if (child.isMesh) { + child.name = 'Loaded Mesh'; + child.castShadow = true; + child.receiveShadow = true; + child.material = new THREE.MeshPhongMaterial(); + + // This adds the model to the lightmap + lightmapObjects.push(child); + progressiveSurfacemap.addObjectsToLightMap(lightmapObjects); + } else { + child.layers.disableAll(); // Disable Rendering for this + } + }); + scene.add(object); + object.scale.set(2, 2, 2); + object.position.set(0, -16, 0); + control2 = new TransformControls(camera, renderer.domElement); + control2.addEventListener('dragging-changed', event => { + controls.enabled = !event.value; + }); + control2.attach(object); + scene.add(control2.getHelper()); + const lightTarget = new THREE.Group(); + lightTarget.position.set(0, 20, 0); + for (let l = 0; l < dirLights.length; l++) { + dirLights[l].target = lightTarget; + } + + object.add(lightTarget); + } + + const manager = new THREE.LoadingManager(loadModel); + const loader = new GLTFLoader(manager); + loader.load('models/gltf/ShadowmappableMesh.glb', function (obj) { + object = obj.scene.children[0]; + }); + + // controls + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled + controls.dampingFactor = 0.05; + controls.screenSpacePanning = true; + controls.minDistance = 100; + controls.maxDistance = 500; + controls.maxPolarAngle = Math.PI / 1.5; + controls.target.set(0, 100, 0); + + window.addEventListener('resize', onWindowResize); +} + +function createGUI() { + const gui = new GUI({ title: 'Accumulation Settings' }); + gui.add(params, 'Enable'); + gui.add(params, 'Blur Edges'); + gui.add(params, 'Blend Window', 1, 500).step(1); + gui.add(params, 'Light Radius', 0, 200).step(10); + gui.add(params, 'Ambient Weight', 0, 1).step(0.1); + gui.add(params, 'Debug Lightmap'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + // Update the inertia on the orbit controls + controls.update(); + + // Accumulate Surface Maps + if (params['Enable']) { + progressiveSurfacemap.update(camera, params['Blend Window'], params['Blur Edges']); + + if (!progressiveSurfacemap.firstUpdate) { + progressiveSurfacemap.showDebugLightmap(params['Debug Lightmap']); + } + } + + // Manually Update the Directional Lights + for (let l = 0; l < dirLights.length; l++) { + // Sometimes they will be sampled from the target direction + // Sometimes they will be uniformly sampled from the upper hemisphere + if (Math.random() > params['Ambient Weight']) { + dirLights[l].position.set( + lightOrigin.position.x + Math.random() * params['Light Radius'], + lightOrigin.position.y + Math.random() * params['Light Radius'], + lightOrigin.position.z + Math.random() * params['Light Radius'], + ); + } else { + // Uniform Hemispherical Surface Distribution for Ambient Occlusion + const lambda = Math.acos(2 * Math.random() - 1) - 3.14159 / 2.0; + const phi = 2 * 3.14159 * Math.random(); + dirLights[l].position.set( + Math.cos(lambda) * Math.cos(phi) * 300 + object.position.x, + Math.abs(Math.cos(lambda) * Math.sin(phi) * 300) + object.position.y + 20, + Math.sin(lambda) * 300 + object.position.z, + ); + } + } + + // Render Scene + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_shadowmap_viewer.ts b/examples-testing/examples/webgl_shadowmap_viewer.ts new file mode 100644 index 000000000..2ed16e992 --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap_viewer.ts @@ -0,0 +1,181 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; + +let camera, scene, renderer, timer, stats; +let dirLight, spotLight; +let torusKnot, cube; +let dirLightShadowMapViewer, spotLightShadowMapViewer; + +init(); + +function init() { + initScene(); + initShadowMapViewers(); + initMisc(); + + document.body.appendChild(renderer.domElement); + window.addEventListener('resize', onWindowResize); +} + +function initScene() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 15, 35); + + scene = new THREE.Scene(); + + // Lights + + scene.add(new THREE.AmbientLight(0x404040, 3)); + + spotLight = new THREE.SpotLight(0xffffff, 500); + spotLight.name = 'Spot Light'; + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.3; + spotLight.position.set(10, 10, 5); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 8; + spotLight.shadow.camera.far = 30; + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + scene.add(spotLight); + + scene.add(new THREE.CameraHelper(spotLight.shadow.camera)); + + dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.name = 'Dir. Light'; + dirLight.position.set(0, 10, 0); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 1; + dirLight.shadow.camera.far = 10; + dirLight.shadow.camera.right = 15; + dirLight.shadow.camera.left = -15; + dirLight.shadow.camera.top = 15; + dirLight.shadow.camera.bottom = -15; + dirLight.shadow.mapSize.width = 1024; + dirLight.shadow.mapSize.height = 1024; + scene.add(dirLight); + + scene.add(new THREE.CameraHelper(dirLight.shadow.camera)); + + // Geometry + let geometry = new THREE.TorusKnotGeometry(25, 8, 75, 20); + let material = new THREE.MeshPhongMaterial({ + color: 0xff0000, + shininess: 150, + specular: 0x222222, + }); + + torusKnot = new THREE.Mesh(geometry, material); + torusKnot.scale.multiplyScalar(1 / 18); + torusKnot.position.y = 3; + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + geometry = new THREE.BoxGeometry(3, 3, 3); + cube = new THREE.Mesh(geometry, material); + cube.position.set(8, 3, 8); + cube.castShadow = true; + cube.receiveShadow = true; + scene.add(cube); + + geometry = new THREE.BoxGeometry(10, 0.15, 10); + material = new THREE.MeshPhongMaterial({ + color: 0xa0adaf, + shininess: 150, + specular: 0x111111, + }); + + const ground = new THREE.Mesh(geometry, material); + ground.scale.multiplyScalar(3); + ground.castShadow = false; + ground.receiveShadow = true; + scene.add(ground); +} + +function initShadowMapViewers() { + dirLightShadowMapViewer = new ShadowMapViewer(dirLight); + spotLightShadowMapViewer = new ShadowMapViewer(spotLight); + resizeShadowMapViewers(); +} + +function initMisc() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.BasicShadowMap; + + // Mouse control + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2, 0); + controls.update(); + + timer = new THREE.Timer(); + timer.connect(document); + + stats = new Stats(); + document.body.appendChild(stats.dom); +} + +function resizeShadowMapViewers() { + const size = window.innerWidth * 0.15; + + dirLightShadowMapViewer.position.x = 10; + dirLightShadowMapViewer.position.y = 10; + dirLightShadowMapViewer.size.width = size; + dirLightShadowMapViewer.size.height = size; + dirLightShadowMapViewer.update(); //Required when setting position or size directly + + spotLightShadowMapViewer.size.set(size, size); + spotLightShadowMapViewer.position.set(size + 20, 10); + // spotLightShadowMapViewer.update(); //NOT required because .set updates automatically +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + resizeShadowMapViewers(); + dirLightShadowMapViewer.updateForWindowResize(); + spotLightShadowMapViewer.updateForWindowResize(); +} + +function animate() { + timer.update(); + + render(); + + stats.update(); +} + +function renderScene() { + renderer.render(scene, camera); +} + +function renderShadowMapViewers() { + dirLightShadowMapViewer.render(renderer); + spotLightShadowMapViewer.render(renderer); +} + +function render() { + const delta = timer.getDelta(); + + renderScene(); + renderShadowMapViewers(); + + torusKnot.rotation.x += 0.25 * delta; + torusKnot.rotation.y += 2 * delta; + torusKnot.rotation.z += 1 * delta; + + cube.rotation.x += 0.25 * delta; + cube.rotation.y += 2 * delta; + cube.rotation.z += 1 * delta; +} diff --git a/examples-testing/examples/webgl_shadowmap_vsm.ts b/examples-testing/examples/webgl_shadowmap_vsm.ts new file mode 100644 index 000000000..d5bf4f7bb --- /dev/null +++ b/examples-testing/examples/webgl_shadowmap_vsm.ts @@ -0,0 +1,203 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, timer, stats; +let dirLight, spotLight; +let torusKnot, dirGroup; + +init(); + +function init() { + initScene(); + initMisc(); + + // Init gui + const gui = new GUI(); + + const config = { + spotlightRadius: 4, + spotlightSamples: 8, + dirlightRadius: 4, + dirlightSamples: 8, + }; + + const spotlightFolder = gui.addFolder('Spotlight'); + spotlightFolder + .add(config, 'spotlightRadius') + .name('radius') + .min(0) + .max(25) + .onChange(function (value) { + spotLight.shadow.radius = value; + }); + + spotlightFolder + .add(config, 'spotlightSamples', 1, 25, 1) + .name('samples') + .onChange(function (value) { + spotLight.shadow.blurSamples = value; + }); + spotlightFolder.open(); + + const dirlightFolder = gui.addFolder('Directional Light'); + dirlightFolder + .add(config, 'dirlightRadius') + .name('radius') + .min(0) + .max(25) + .onChange(function (value) { + dirLight.shadow.radius = value; + }); + + dirlightFolder + .add(config, 'dirlightSamples', 1, 25, 1) + .name('samples') + .onChange(function (value) { + dirLight.shadow.blurSamples = value; + }); + dirlightFolder.open(); + + document.body.appendChild(renderer.domElement); + window.addEventListener('resize', onWindowResize); +} + +function initScene() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 10, 30); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222244); + scene.fog = new THREE.Fog(0x222244, 50, 100); + + // Lights + + scene.add(new THREE.AmbientLight(0x444444)); + + spotLight = new THREE.SpotLight(0xff8888, 400); + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.3; + spotLight.position.set(8, 10, 5); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 8; + spotLight.shadow.camera.far = 200; + spotLight.shadow.mapSize.width = 256; + spotLight.shadow.mapSize.height = 256; + spotLight.shadow.bias = -0.002; + spotLight.shadow.radius = 4; + scene.add(spotLight); + + dirLight = new THREE.DirectionalLight(0x8888ff, 3); + dirLight.position.set(3, 12, 17); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = 500; + dirLight.shadow.camera.right = 17; + dirLight.shadow.camera.left = -17; + dirLight.shadow.camera.top = 17; + dirLight.shadow.camera.bottom = -17; + dirLight.shadow.mapSize.width = 512; + dirLight.shadow.mapSize.height = 512; + dirLight.shadow.radius = 4; + dirLight.shadow.bias = -0.0005; + + dirGroup = new THREE.Group(); + dirGroup.add(dirLight); + scene.add(dirGroup); + + // Geometry + + const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 20); + const material = new THREE.MeshPhongMaterial({ + color: 0x999999, + shininess: 0, + specular: 0x222222, + }); + + torusKnot = new THREE.Mesh(geometry, material); + torusKnot.scale.multiplyScalar(1 / 18); + torusKnot.position.y = 3; + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); + + const pillar1 = new THREE.Mesh(cylinderGeometry, material); + pillar1.position.set(8, 3.5, 8); + pillar1.castShadow = true; + pillar1.receiveShadow = true; + + const pillar2 = pillar1.clone(); + pillar2.position.set(8, 3.5, -8); + const pillar3 = pillar1.clone(); + pillar3.position.set(-8, 3.5, 8); + const pillar4 = pillar1.clone(); + pillar4.position.set(-8, 3.5, -8); + + scene.add(pillar1); + scene.add(pillar2); + scene.add(pillar3); + scene.add(pillar4); + + const planeGeometry = new THREE.PlaneGeometry(200, 200); + const planeMaterial = new THREE.MeshPhongMaterial({ + color: 0x999999, + shininess: 0, + specular: 0x111111, + }); + + const ground = new THREE.Mesh(planeGeometry, planeMaterial); + ground.rotation.x = -Math.PI / 2; + ground.scale.multiplyScalar(3); + ground.castShadow = true; + ground.receiveShadow = true; + scene.add(ground); +} + +function initMisc() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.VSMShadowMap; + + // Mouse control + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2, 0); + controls.update(); + + timer = new THREE.Timer(); + timer.connect(document); + + stats = new Stats(); + document.body.appendChild(stats.dom); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(time) { + timer.update(); + + const delta = timer.getDelta(); + + torusKnot.rotation.x += 0.25 * delta; + torusKnot.rotation.y += 0.5 * delta; + torusKnot.rotation.z += 1 * delta; + + dirGroup.rotation.y += 0.7 * delta; + dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_shadowmesh.ts b/examples-testing/examples/webgl_shadowmesh.ts new file mode 100644 index 000000000..e4f7ebb8f --- /dev/null +++ b/examples-testing/examples/webgl_shadowmesh.ts @@ -0,0 +1,253 @@ +import * as THREE from 'three'; + +import { ShadowMesh } from 'three/addons/objects/ShadowMesh.js'; + +let SCREEN_WIDTH = window.innerWidth; +let SCREEN_HEIGHT = window.innerHeight; + +const scene = new THREE.Scene(); +const camera = new THREE.PerspectiveCamera(55, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 3000); +const timer = new THREE.Timer(); +timer.connect(document); +const renderer = new THREE.WebGLRenderer({ stencil: true }); + +const sunLight = new THREE.DirectionalLight('rgb(255,255,255)', 3); +let useDirectionalLight = true; +let arrowHelper1, arrowHelper2, arrowHelper3; +const arrowDirection = new THREE.Vector3(); +const arrowPosition1 = new THREE.Vector3(); +const arrowPosition2 = new THREE.Vector3(); +const arrowPosition3 = new THREE.Vector3(); +let groundMesh; +let lightSphere, lightHolder; +let pyramid, pyramidShadow; +let sphere, sphereShadow; +let cube, cubeShadow; +let cylinder, cylinderShadow; +let torus, torusShadow; +const normalVector = new THREE.Vector3(0, 1, 0); +const planeConstant = 0.01; // this value must be slightly higher than the groundMesh's y position of 0.0 +const groundPlane = new THREE.Plane(normalVector, planeConstant); +const lightPosition4D = new THREE.Vector4(); +let verticalAngle = 0; +let horizontalAngle = 0; +let frameTime = 0; +const TWO_PI = Math.PI * 2; + +init(); + +function init() { + scene.background = new THREE.Color(0x0096ff); + + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + document.getElementById('container').appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + camera.position.set(0, 2.5, 10); + scene.add(camera); + onWindowResize(); + + sunLight.position.set(5, 7, -1); + sunLight.lookAt(scene.position); + scene.add(sunLight); + + lightPosition4D.x = sunLight.position.x; + lightPosition4D.y = sunLight.position.y; + lightPosition4D.z = sunLight.position.z; + // amount of light-ray divergence. Ranging from: + // 0.001 = sunlight(min divergence) to 1.0 = pointlight(max divergence) + lightPosition4D.w = 0.001; // must be slightly greater than 0, due to 0 causing matrixInverse errors + + // YELLOW ARROW HELPERS + arrowDirection.subVectors(scene.position, sunLight.position).normalize(); + + arrowPosition1.copy(sunLight.position); + arrowHelper1 = new THREE.ArrowHelper(arrowDirection, arrowPosition1, 0.9, 0xffff00, 0.25, 0.08); + scene.add(arrowHelper1); + + arrowPosition2.copy(sunLight.position).add(new THREE.Vector3(0, 0.2, 0)); + arrowHelper2 = new THREE.ArrowHelper(arrowDirection, arrowPosition2, 0.9, 0xffff00, 0.25, 0.08); + scene.add(arrowHelper2); + + arrowPosition3.copy(sunLight.position).add(new THREE.Vector3(0, -0.2, 0)); + arrowHelper3 = new THREE.ArrowHelper(arrowDirection, arrowPosition3, 0.9, 0xffff00, 0.25, 0.08); + scene.add(arrowHelper3); + + // LIGHTBULB + const lightSphereGeometry = new THREE.SphereGeometry(0.09); + const lightSphereMaterial = new THREE.MeshBasicMaterial({ color: 'rgb(255,255,255)' }); + lightSphere = new THREE.Mesh(lightSphereGeometry, lightSphereMaterial); + scene.add(lightSphere); + lightSphere.visible = false; + + const lightHolderGeometry = new THREE.CylinderGeometry(0.05, 0.05, 0.13); + const lightHolderMaterial = new THREE.MeshBasicMaterial({ color: 'rgb(75,75,75)' }); + lightHolder = new THREE.Mesh(lightHolderGeometry, lightHolderMaterial); + scene.add(lightHolder); + lightHolder.visible = false; + + // GROUND + const groundGeometry = new THREE.BoxGeometry(30, 0.01, 40); + const groundMaterial = new THREE.MeshLambertMaterial({ color: 'rgb(0,130,0)' }); + groundMesh = new THREE.Mesh(groundGeometry, groundMaterial); + groundMesh.position.y = 0.0; //this value must be slightly lower than the planeConstant (0.01) parameter above + scene.add(groundMesh); + + // RED CUBE and CUBE's SHADOW + const cubeGeometry = new THREE.BoxGeometry(1, 1, 1); + const cubeMaterial = new THREE.MeshLambertMaterial({ color: 'rgb(255,0,0)', emissive: 0x200000 }); + cube = new THREE.Mesh(cubeGeometry, cubeMaterial); + cube.position.z = -1; + scene.add(cube); + + cubeShadow = new ShadowMesh(cube); + scene.add(cubeShadow); + + // BLUE CYLINDER and CYLINDER's SHADOW + const cylinderGeometry = new THREE.CylinderGeometry(0.3, 0.3, 2); + const cylinderMaterial = new THREE.MeshPhongMaterial({ color: 'rgb(0,0,255)', emissive: 0x000020 }); + cylinder = new THREE.Mesh(cylinderGeometry, cylinderMaterial); + cylinder.position.z = -2.5; + scene.add(cylinder); + + cylinderShadow = new ShadowMesh(cylinder); + scene.add(cylinderShadow); + + // MAGENTA TORUS and TORUS' SHADOW + const torusGeometry = new THREE.TorusGeometry(1, 0.2, 10, 16, TWO_PI); + const torusMaterial = new THREE.MeshPhongMaterial({ color: 'rgb(255,0,255)', emissive: 0x200020 }); + torus = new THREE.Mesh(torusGeometry, torusMaterial); + torus.position.z = -6; + scene.add(torus); + + torusShadow = new ShadowMesh(torus); + scene.add(torusShadow); + + // WHITE SPHERE and SPHERE'S SHADOW + const sphereGeometry = new THREE.SphereGeometry(0.5, 20, 10); + const sphereMaterial = new THREE.MeshPhongMaterial({ color: 'rgb(255,255,255)', emissive: 0x222222 }); + sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); + sphere.position.set(4, 0.5, 2); + scene.add(sphere); + + sphereShadow = new ShadowMesh(sphere); + scene.add(sphereShadow); + + // YELLOW PYRAMID and PYRAMID'S SHADOW + const pyramidGeometry = new THREE.CylinderGeometry(0, 0.5, 2, 4); + const pyramidMaterial = new THREE.MeshPhongMaterial({ + color: 'rgb(255,255,0)', + emissive: 0x440000, + flatShading: true, + shininess: 0, + }); + pyramid = new THREE.Mesh(pyramidGeometry, pyramidMaterial); + pyramid.position.set(-4, 1, 2); + scene.add(pyramid); + + pyramidShadow = new ShadowMesh(pyramid); + scene.add(pyramidShadow); + + document.getElementById('lightButton').addEventListener('click', lightButtonHandler); +} + +function animate() { + timer.update(); + + frameTime = timer.getDelta(); + + cube.rotation.x += 1.0 * frameTime; + cube.rotation.y += 1.0 * frameTime; + + cylinder.rotation.y += 1.0 * frameTime; + cylinder.rotation.z -= 1.0 * frameTime; + + torus.rotation.x -= 1.0 * frameTime; + torus.rotation.y -= 1.0 * frameTime; + + pyramid.rotation.y += 0.5 * frameTime; + + horizontalAngle += 0.5 * frameTime; + if (horizontalAngle > TWO_PI) horizontalAngle -= TWO_PI; + cube.position.x = Math.sin(horizontalAngle) * 4; + cylinder.position.x = Math.sin(horizontalAngle) * -4; + torus.position.x = Math.cos(horizontalAngle) * 4; + + verticalAngle += 1.5 * frameTime; + if (verticalAngle > TWO_PI) verticalAngle -= TWO_PI; + cube.position.y = Math.sin(verticalAngle) * 2 + 2.9; + cylinder.position.y = Math.sin(verticalAngle) * 2 + 3.1; + torus.position.y = Math.cos(verticalAngle) * 2 + 3.3; + + // update the ShadowMeshes to follow their shadow-casting objects + cubeShadow.update(groundPlane, lightPosition4D); + cylinderShadow.update(groundPlane, lightPosition4D); + torusShadow.update(groundPlane, lightPosition4D); + sphereShadow.update(groundPlane, lightPosition4D); + pyramidShadow.update(groundPlane, lightPosition4D); + + renderer.render(scene, camera); +} + +function onWindowResize() { + SCREEN_WIDTH = window.innerWidth; + SCREEN_HEIGHT = window.innerHeight; + + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + + camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + camera.updateProjectionMatrix(); +} + +function lightButtonHandler() { + useDirectionalLight = !useDirectionalLight; + + if (useDirectionalLight) { + scene.background.setHex(0x0096ff); + + groundMesh.material.color.setHex(0x008200); + sunLight.position.set(5, 7, -1); + sunLight.lookAt(scene.position); + + lightPosition4D.x = sunLight.position.x; + lightPosition4D.y = sunLight.position.y; + lightPosition4D.z = sunLight.position.z; + lightPosition4D.w = 0.001; // more of a directional Light value + + arrowHelper1.visible = true; + arrowHelper2.visible = true; + arrowHelper3.visible = true; + + lightSphere.visible = false; + lightHolder.visible = false; + + document.getElementById('lightButton').value = 'Switch to PointLight'; + } else { + scene.background.setHex(0x000000); + + groundMesh.material.color.setHex(0x969696); + + sunLight.position.set(0, 6, -2); + sunLight.lookAt(scene.position); + lightSphere.position.copy(sunLight.position); + lightHolder.position.copy(lightSphere.position); + lightHolder.position.y += 0.12; + + lightPosition4D.x = sunLight.position.x; + lightPosition4D.y = sunLight.position.y; + lightPosition4D.z = sunLight.position.z; + lightPosition4D.w = 0.9; // more of a point Light value + + arrowHelper1.visible = false; + arrowHelper2.visible = false; + arrowHelper3.visible = false; + + lightSphere.visible = true; + lightHolder.visible = true; + + document.getElementById('lightButton').value = 'Switch to THREE.DirectionalLight'; + } +} diff --git a/examples-testing/examples/webgl_simple_gi.ts b/examples-testing/examples/webgl_simple_gi.ts new file mode 100644 index 000000000..4ab6dc895 --- /dev/null +++ b/examples-testing/examples/webgl_simple_gi.ts @@ -0,0 +1,172 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +class GIMesh extends THREE.Mesh { + copy(source) { + super.copy(source); + + this.geometry = source.geometry.clone(); + + return this; + } +} + +// + +const SimpleGI = function (renderer, scene) { + const SIZE = 32, + SIZE2 = SIZE * SIZE; + + const camera = new THREE.PerspectiveCamera(90, 1, 0.01, 100); + + scene.updateMatrixWorld(true); + + let clone = scene.clone(); + clone.matrixWorldAutoUpdate = false; + + const rt = new THREE.WebGLRenderTarget(SIZE, SIZE); + + const normalMatrix = new THREE.Matrix3(); + + const position = new THREE.Vector3(); + const normal = new THREE.Vector3(); + + let bounces = 0; + let currentVertex = 0; + + const color = new Float32Array(3); + const buffer = new Uint8Array(SIZE2 * 4); + + function compute() { + if (bounces === 3) return; + + const object = scene.children[0]; // torusKnot + const geometry = object.geometry; + + const attributes = geometry.attributes; + const positions = attributes.position.array; + const normals = attributes.normal.array; + + if (attributes.color === undefined) { + const colors = new Float32Array(positions.length); + geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3).setUsage(THREE.DynamicDrawUsage)); + } + + const colors = attributes.color.array; + + const startVertex = currentVertex; + const totalVertex = positions.length / 3; + + for (let i = 0; i < 32; i++) { + if (currentVertex >= totalVertex) break; + + position.fromArray(positions, currentVertex * 3); + position.applyMatrix4(object.matrixWorld); + + normal.fromArray(normals, currentVertex * 3); + normal.applyMatrix3(normalMatrix.getNormalMatrix(object.matrixWorld)).normalize(); + + camera.position.copy(position); + camera.lookAt(position.add(normal)); + + renderer.setRenderTarget(rt); + renderer.render(clone, camera); + + renderer.readRenderTargetPixels(rt, 0, 0, SIZE, SIZE, buffer); + + color[0] = 0; + color[1] = 0; + color[2] = 0; + + for (let k = 0, kl = buffer.length; k < kl; k += 4) { + color[0] += buffer[k + 0]; + color[1] += buffer[k + 1]; + color[2] += buffer[k + 2]; + } + + colors[currentVertex * 3 + 0] = color[0] / (SIZE2 * 255); + colors[currentVertex * 3 + 1] = color[1] / (SIZE2 * 255); + colors[currentVertex * 3 + 2] = color[2] / (SIZE2 * 255); + + currentVertex++; + } + + attributes.color.addUpdateRange(startVertex * 3, (currentVertex - startVertex) * 3); + attributes.color.needsUpdate = true; + + if (currentVertex >= totalVertex) { + clone = scene.clone(); + clone.matrixWorldAutoUpdate = false; + + bounces++; + currentVertex = 0; + } + + requestAnimationFrame(compute); + } + + requestAnimationFrame(compute); +}; + +// + +let camera, scene, renderer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 4; + + scene = new THREE.Scene(); + + // torus knot + + const torusGeometry = new THREE.TorusKnotGeometry(0.75, 0.3, 128, 32, 1); + const material = new THREE.MeshBasicMaterial({ vertexColors: true }); + + const torusKnot = new GIMesh(torusGeometry, material); + scene.add(torusKnot); + + // room + + const materials = []; + + for (let i = 0; i < 8; i++) { + materials.push(new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff, side: THREE.BackSide })); + } + + const boxGeometry = new THREE.BoxGeometry(3, 3, 3); + + const box = new THREE.Mesh(boxGeometry, materials); + scene.add(box); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + new SimpleGI(renderer, scene); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 10; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.setRenderTarget(null); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_sprites.ts b/examples-testing/examples/webgl_sprites.ts new file mode 100644 index 000000000..2e4189347 --- /dev/null +++ b/examples-testing/examples/webgl_sprites.ts @@ -0,0 +1,187 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; +let cameraOrtho, sceneOrtho; + +let spriteTL, spriteTR, spriteBL, spriteBR, spriteC; + +let mapC; + +let group; + +init(); + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera = new THREE.PerspectiveCamera(60, width / height, 1, 2100); + camera.position.z = 1500; + + cameraOrtho = new THREE.OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, 1, 10); + cameraOrtho.position.z = 10; + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x000000, 1500, 2100); + + sceneOrtho = new THREE.Scene(); + + // create sprites + + const amount = 200; + const radius = 500; + + const textureLoader = new THREE.TextureLoader(); + + textureLoader.load('textures/sprite0.png', createHUDSprites); + const mapB = textureLoader.load('textures/sprite1.png'); + mapC = textureLoader.load('textures/sprite2.png'); + + mapB.colorSpace = THREE.SRGBColorSpace; + mapC.colorSpace = THREE.SRGBColorSpace; + + group = new THREE.Group(); + + const materialC = new THREE.SpriteMaterial({ map: mapC, color: 0xffffff, fog: true }); + const materialB = new THREE.SpriteMaterial({ map: mapB, color: 0xffffff, fog: true }); + + for (let a = 0; a < amount; a++) { + const x = Math.random() - 0.5; + const y = Math.random() - 0.5; + const z = Math.random() - 0.5; + + let material; + + if (z < 0) { + material = materialB.clone(); + } else { + material = materialC.clone(); + material.color.setHSL(0.5 * Math.random(), 0.75, 0.5); + material.map.offset.set(-0.5, -0.5); + material.map.repeat.set(2, 2); + } + + const sprite = new THREE.Sprite(material); + + sprite.position.set(x, y, z); + sprite.position.normalize(); + sprite.position.multiplyScalar(radius); + + group.add(sprite); + } + + scene.add(group); + + // renderer + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; // To allow render overlay on top of sprited sphere + + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function createHUDSprites(texture) { + texture.colorSpace = THREE.SRGBColorSpace; + + const material = new THREE.SpriteMaterial({ map: texture }); + + const width = material.map.image.width; + const height = material.map.image.height; + + spriteTL = new THREE.Sprite(material); + spriteTL.center.set(0.0, 1.0); + spriteTL.scale.set(width, height, 1); + sceneOrtho.add(spriteTL); + + spriteTR = new THREE.Sprite(material); + spriteTR.center.set(1.0, 1.0); + spriteTR.scale.set(width, height, 1); + sceneOrtho.add(spriteTR); + + spriteBL = new THREE.Sprite(material); + spriteBL.center.set(0.0, 0.0); + spriteBL.scale.set(width, height, 1); + sceneOrtho.add(spriteBL); + + spriteBR = new THREE.Sprite(material); + spriteBR.center.set(1.0, 0.0); + spriteBR.scale.set(width, height, 1); + sceneOrtho.add(spriteBR); + + spriteC = new THREE.Sprite(material); + spriteC.center.set(0.5, 0.5); + spriteC.scale.set(width, height, 1); + sceneOrtho.add(spriteC); + + updateHUDSprites(); +} + +function updateHUDSprites() { + const width = window.innerWidth / 2; + const height = window.innerHeight / 2; + + spriteTL.position.set(-width, height, 1); // top left + spriteTR.position.set(width, height, 1); // top right + spriteBL.position.set(-width, -height, 1); // bottom left + spriteBR.position.set(width, -height, 1); // bottom right + spriteC.position.set(0, 0, 1); // center +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + cameraOrtho.left = -width / 2; + cameraOrtho.right = width / 2; + cameraOrtho.top = height / 2; + cameraOrtho.bottom = -height / 2; + cameraOrtho.updateProjectionMatrix(); + + updateHUDSprites(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = Date.now() / 1000; + + for (let i = 0, l = group.children.length; i < l; i++) { + const sprite = group.children[i]; + const material = sprite.material; + const scale = Math.sin(time + sprite.position.x * 0.01) * 0.3 + 1.0; + + let imageWidth = 1; + let imageHeight = 1; + + if (material.map && material.map.image && material.map.image.width) { + imageWidth = material.map.image.width; + imageHeight = material.map.image.height; + } + + sprite.material.rotation += 0.1 * (i / l); + sprite.scale.set(scale * imageWidth, scale * imageHeight, 1.0); + + if (material.map !== mapC) { + material.opacity = Math.sin(time + sprite.position.x * 0.01) * 0.4 + 0.6; + } + } + + group.rotation.x = time * 0.5; + group.rotation.y = time * 0.75; + group.rotation.z = time * 1.0; + + renderer.clear(); + renderer.render(scene, camera); + renderer.clearDepth(); + renderer.render(sceneOrtho, cameraOrtho); +} diff --git a/examples-testing/examples/webgl_test_memory.ts b/examples-testing/examples/webgl_test_memory.ts new file mode 100644 index 000000000..f5d0e112d --- /dev/null +++ b/examples-testing/examples/webgl_test_memory.ts @@ -0,0 +1,65 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 200; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); +} + +function createImage() { + const canvas = document.createElement('canvas'); + canvas.width = 256; + canvas.height = 256; + + const context = canvas.getContext('2d'); + context.fillStyle = + 'rgb(' + + Math.floor(Math.random() * 256) + + ',' + + Math.floor(Math.random() * 256) + + ',' + + Math.floor(Math.random() * 256) + + ')'; + context.fillRect(0, 0, 256, 256); + + return canvas; +} + +// + +function animate() { + const geometry = new THREE.SphereGeometry(50, Math.random() * 64, Math.random() * 32); + + const texture = new THREE.CanvasTexture(createImage()); + + const material = new THREE.MeshBasicMaterial({ map: texture, wireframe: true }); + + const mesh = new THREE.Mesh(geometry, material); + + scene.add(mesh); + + renderer.render(scene, camera); + + scene.remove(mesh); + + // clean up + + geometry.dispose(); + material.dispose(); + texture.dispose(); +} diff --git a/examples-testing/examples/webgl_test_memory2.ts b/examples-testing/examples/webgl_test_memory2.ts new file mode 100644 index 000000000..366a27914 --- /dev/null +++ b/examples-testing/examples/webgl_test_memory2.ts @@ -0,0 +1,81 @@ +import * as THREE from 'three'; + +const N = 100; + +let container; + +let camera, scene, renderer; + +let geometry; + +const meshes = []; + +let fragmentShader, vertexShader; + +init(); +setInterval(render, 1000 / 60); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + vertexShader = document.getElementById('vertexShader').textContent; + fragmentShader = document.getElementById('fragmentShader').textContent; + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 2000; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + geometry = new THREE.SphereGeometry(15, 64, 32); + + for (let i = 0; i < N; i++) { + const material = new THREE.ShaderMaterial({ + vertexShader: vertexShader, + fragmentShader: generateFragmentShader(), + }); + + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = (0.5 - Math.random()) * 1000; + mesh.position.y = (0.5 - Math.random()) * 1000; + mesh.position.z = (0.5 - Math.random()) * 1000; + + scene.add(mesh); + + meshes.push(mesh); + } + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + container.appendChild(renderer.domElement); +} + +// + +function generateFragmentShader() { + return fragmentShader.replace('XXX', Math.random() + ',' + Math.random() + ',' + Math.random()); +} + +function render() { + for (let i = 0; i < N; i++) { + const mesh = meshes[i]; + mesh.material = new THREE.ShaderMaterial({ + vertexShader: vertexShader, + fragmentShader: generateFragmentShader(), + }); + } + + renderer.render(scene, camera); + + console.log('before', renderer.info.programs.length); + + for (let i = 0; i < N; i++) { + const mesh = meshes[i]; + mesh.material.dispose(); + } + + console.log('after', renderer.info.programs.length); +} diff --git a/examples-testing/examples/webgl_test_wide_gamut.ts b/examples-testing/examples/webgl_test_wide_gamut.ts new file mode 100644 index 000000000..5988299e1 --- /dev/null +++ b/examples-testing/examples/webgl_test_wide_gamut.ts @@ -0,0 +1,130 @@ +import * as THREE from 'three'; + +import { + DisplayP3ColorSpace, + DisplayP3ColorSpaceImpl, + LinearDisplayP3ColorSpace, + LinearDisplayP3ColorSpaceImpl, +} from 'three/addons/math/ColorSpaces.js'; + +import WebGL from 'three/addons/capabilities/WebGL.js'; + +let container, camera, renderer, loader; +let sceneL, sceneR, textureL, textureR; + +let sliderPos = window.innerWidth / 2; + +const slider = document.querySelector('.slider'); + +const isP3Context = WebGL.isColorSpaceAvailable(DisplayP3ColorSpace); + +THREE.ColorManagement.define({ + [DisplayP3ColorSpace]: DisplayP3ColorSpaceImpl, + [LinearDisplayP3ColorSpace]: LinearDisplayP3ColorSpaceImpl, +}); + +if (isP3Context) { + THREE.ColorManagement.workingColorSpace = LinearDisplayP3ColorSpace; +} + +init(); + +function init() { + container = document.querySelector('.container'); + + sceneL = new THREE.Scene(); + sceneR = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 6; + + loader = new THREE.TextureLoader(); + + initTextures(); + initSlider(); + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.setScissorTest(true); + container.appendChild(renderer.domElement); + + if (isP3Context && window.matchMedia('( color-gamut: p3 )').matches) { + renderer.outputColorSpace = DisplayP3ColorSpace; + } + + window.addEventListener('resize', onWindowResize); + window.matchMedia('( color-gamut: p3 )').addEventListener('change', onGamutChange); +} + +async function initTextures() { + const path = 'textures/wide_gamut/logo_{colorSpace}.png'; + + textureL = await loader.loadAsync(path.replace('{colorSpace}', 'srgb')); + textureR = await loader.loadAsync(path.replace('{colorSpace}', 'p3')); + + textureL.colorSpace = THREE.SRGBColorSpace; + textureR.colorSpace = DisplayP3ColorSpace; + + sceneL.background = THREE.TextureUtils.contain(textureL, window.innerWidth / window.innerHeight); + sceneR.background = THREE.TextureUtils.contain(textureR, window.innerWidth / window.innerHeight); +} + +function initSlider() { + function onPointerDown() { + if (event.isPrimary === false) return; + + window.addEventListener('pointermove', onPointerMove); + window.addEventListener('pointerup', onPointerUp); + } + + function onPointerUp() { + window.removeEventListener('pointermove', onPointerMove); + window.removeEventListener('pointerup', onPointerUp); + } + + function onPointerMove(e) { + if (event.isPrimary === false) return; + + updateSlider(e.pageX); + } + + updateSlider(sliderPos); + + slider.style.touchAction = 'none'; // disable touch scroll + slider.addEventListener('pointerdown', onPointerDown); +} + +function updateSlider(offset) { + sliderPos = Math.max(10, Math.min(window.innerWidth - 10, offset)); + + slider.style.left = sliderPos - slider.offsetWidth / 2 + 'px'; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + THREE.TextureUtils.contain(sceneL.background, window.innerWidth / window.innerHeight); + THREE.TextureUtils.contain(sceneR.background, window.innerWidth / window.innerHeight); + + updateSlider(sliderPos); +} + +function onGamutChange({ matches }) { + renderer.outputColorSpace = isP3Context && matches ? DisplayP3ColorSpace : THREE.SRGBColorSpace; + + textureL.needsUpdate = true; + textureR.needsUpdate = true; +} + +function animate() { + renderer.setScissor(0, 0, sliderPos, window.innerHeight); + renderer.render(sceneL, camera); + + renderer.setScissor(sliderPos, 0, window.innerWidth, window.innerHeight); + renderer.render(sceneR, camera); +} diff --git a/examples-testing/examples/webgl_texture2darray_compressed.ts b/examples-testing/examples/webgl_texture2darray_compressed.ts new file mode 100644 index 000000000..0ce11a28a --- /dev/null +++ b/examples-testing/examples/webgl_texture2darray_compressed.ts @@ -0,0 +1,90 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; + +let camera, scene, mesh, renderer, stats, timer; + +const planeWidth = 50; +const planeHeight = 25; + +let depthStep = 1; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); + camera.position.z = 70; + + scene = new THREE.Scene(); + + // + timer = new THREE.Timer(); + timer.connect(document); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + // + + const ktx2Loader = new KTX2Loader(); + ktx2Loader.detectSupport(renderer); + + ktx2Loader.load('textures/spiritedaway.ktx2', function (texturearray) { + const material = new THREE.ShaderMaterial({ + uniforms: { + diffuse: { value: texturearray }, + depth: { value: 55 }, + size: { value: new THREE.Vector2(planeWidth, planeHeight) }, + }, + vertexShader: document.getElementById('vs').textContent.trim(), + fragmentShader: document.getElementById('fs').textContent.trim(), + glslVersion: THREE.GLSL3, + }); + + const geometry = new THREE.PlaneGeometry(planeWidth, planeHeight); + + mesh = new THREE.Mesh(geometry, material); + + scene.add(mesh); + }); + + stats = new Stats(); + container.appendChild(stats.dom); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + if (mesh) { + const delta = timer.getDelta() * 10; + + depthStep += delta; + + const value = depthStep % 5; + + mesh.material.uniforms['depth'].value = value; + } + + render(); + stats.update(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_texture2darray_layerupdate.ts b/examples-testing/examples/webgl_texture2darray_layerupdate.ts new file mode 100644 index 000000000..688f89b4a --- /dev/null +++ b/examples-testing/examples/webgl_texture2darray_layerupdate.ts @@ -0,0 +1,130 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; + +let camera, scene, mesh, renderer; + +const planeWidth = 20; +const planeHeight = 10; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); + camera.position.z = 70; + + scene = new THREE.Scene(); + + // Configure the renderer. + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + container.appendChild(renderer.domElement); + + // Configure the KTX2 loader. + + const ktx2Loader = new KTX2Loader(); + ktx2Loader.detectSupport(renderer); + + // Load several KTX2 textures which will later be used to modify + // specific texture array layers. + + const spiritedaway = await ktx2Loader.loadAsync('textures/spiritedaway.ktx2'); + + // Create a texture array for rendering. + + const layerByteLength = THREE.TextureUtils.getByteLength( + spiritedaway.image.width, + spiritedaway.image.height, + spiritedaway.format, + spiritedaway.type, + ); + + const textureArray = new THREE.CompressedArrayTexture( + [ + { + data: new Uint8Array(layerByteLength * 3), + width: spiritedaway.image.width, + height: spiritedaway.image.height, + }, + ], + spiritedaway.image.width, + spiritedaway.image.height, + 3, + spiritedaway.format, + spiritedaway.type, + ); + + // Setup the GUI + + const formData = { + srcLayer: 0, + destLayer: 0, + transfer() { + const layerElementLength = layerByteLength / spiritedaway.mipmaps[0].data.BYTES_PER_ELEMENT; + textureArray.mipmaps[0].data.set( + spiritedaway.mipmaps[0].data.subarray( + layerElementLength * (formData.srcLayer % spiritedaway.image.depth), + layerElementLength * ((formData.srcLayer % spiritedaway.image.depth) + 1), + ), + layerByteLength * formData.destLayer, + ); + textureArray.addLayerUpdate(formData.destLayer); + textureArray.needsUpdate = true; + + renderer.render(scene, camera); + }, + }; + + const gui = new GUI(); + gui.add(formData, 'srcLayer', 0, spiritedaway.image.depth - 1, 1); + gui.add(formData, 'destLayer', 0, textureArray.image.depth - 1, 1); + gui.add(formData, 'transfer'); + + /// Setup the scene. + + const material = new THREE.ShaderMaterial({ + uniforms: { + diffuse: { value: textureArray }, + size: { value: new THREE.Vector2(planeWidth, planeHeight) }, + }, + vertexShader: document.getElementById('vs').textContent.trim(), + fragmentShader: document.getElementById('fs').textContent.trim(), + glslVersion: THREE.GLSL3, + }); + + const geometry = new THREE.InstancedBufferGeometry(); + geometry.copy(new THREE.PlaneGeometry(planeWidth, planeHeight)); + geometry.instanceCount = 3; + + const instancedIndexAttribute = new THREE.InstancedBufferAttribute(new Uint16Array([0, 1, 2]), 1, false, 1); + instancedIndexAttribute.gpuType = THREE.IntType; + geometry.setAttribute('instancedIndex', instancedIndexAttribute); + + mesh = new THREE.InstancedMesh(geometry, material, 3); + + scene.add(mesh); + + window.addEventListener('resize', onWindowResize); + + // Initialize the texture array by first rendering the spirited away + // frames in order. + + textureArray.mipmaps[0].data.set(spiritedaway.mipmaps[0].data.subarray(0, textureArray.mipmaps[0].data.length)); + textureArray.needsUpdate = true; + renderer.render(scene, camera); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_texture3d.ts b/examples-testing/examples/webgl_texture3d.ts new file mode 100644 index 000000000..5979d5945 --- /dev/null +++ b/examples-testing/examples/webgl_texture3d.ts @@ -0,0 +1,128 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { NRRDLoader } from 'three/addons/loaders/NRRDLoader.js'; +import { VolumeRenderShader1 } from 'three/addons/shaders/VolumeShader.js'; + +let renderer, scene, camera, controls, material, volconfig, cmtextures; + +init(); + +function init() { + scene = new THREE.Scene(); + + // Create renderer + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + // Create camera + const h = 512; // frustum height + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 1000); + camera.position.set(-64, -64, 128); + camera.up.set(0, 0, 1); // In our data, z is up + + // Create controls + controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.target.set(64, 64, 128); + controls.minZoom = 0.5; + controls.maxZoom = 4; + controls.enablePan = false; + controls.update(); + + // scene.add( new AxesHelper( 128 ) ); + + // Lighting is baked into the shader a.t.m. + // let dirLight = new DirectionalLight( 0xffffff ); + + // The gui for interaction + volconfig = { clim1: 0, clim2: 1, renderstyle: 'iso', isothreshold: 0.15, colormap: 'viridis' }; + const gui = new GUI(); + gui.add(volconfig, 'clim1', 0, 1, 0.01).onChange(updateUniforms); + gui.add(volconfig, 'clim2', 0, 1, 0.01).onChange(updateUniforms); + gui.add(volconfig, 'colormap', { gray: 'gray', viridis: 'viridis' }).onChange(updateUniforms); + gui.add(volconfig, 'renderstyle', { mip: 'mip', iso: 'iso' }).onChange(updateUniforms); + gui.add(volconfig, 'isothreshold', 0, 1, 0.01).onChange(updateUniforms); + + // Load the data ... + new NRRDLoader().load('models/nrrd/stent.nrrd', function (volume) { + // Texture to hold the volume. We have scalars, so we put our data in the red channel. + // THREEJS will select R32F (33326) based on the THREE.RedFormat and THREE.FloatType. + // Also see https://www.khronos.org/registry/webgl/specs/latest/2.0/#TEXTURE_TYPES_FORMATS_FROM_DOM_ELEMENTS_TABLE + // TODO: look the dtype up in the volume metadata + const texture = new THREE.Data3DTexture(volume.data, volume.xLength, volume.yLength, volume.zLength); + texture.format = THREE.RedFormat; + texture.type = THREE.FloatType; + texture.minFilter = texture.magFilter = THREE.LinearFilter; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + // Colormap textures + cmtextures = { + viridis: new THREE.TextureLoader().load('textures/cm_viridis.png', render), + gray: new THREE.TextureLoader().load('textures/cm_gray.png', render), + }; + + // Material + const shader = VolumeRenderShader1; + + const uniforms = THREE.UniformsUtils.clone(shader.uniforms); + + uniforms['u_data'].value = texture; + uniforms['u_size'].value.set(volume.xLength, volume.yLength, volume.zLength); + uniforms['u_clim'].value.set(volconfig.clim1, volconfig.clim2); + uniforms['u_renderstyle'].value = volconfig.renderstyle == 'mip' ? 0 : 1; // 0: MIP, 1: ISO + uniforms['u_renderthreshold'].value = volconfig.isothreshold; // For ISO renderstyle + uniforms['u_cmdata'].value = cmtextures[volconfig.colormap]; + + material = new THREE.ShaderMaterial({ + uniforms: uniforms, + vertexShader: shader.vertexShader, + fragmentShader: shader.fragmentShader, + side: THREE.BackSide, // The volume shader uses the backface as its "reference point" + }); + + // THREE.Mesh + const geometry = new THREE.BoxGeometry(volume.xLength, volume.yLength, volume.zLength); + geometry.translate(volume.xLength / 2 - 0.5, volume.yLength / 2 - 0.5, volume.zLength / 2 - 0.5); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + render(); + }); + + window.addEventListener('resize', onWindowResize); +} + +function updateUniforms() { + material.uniforms['u_clim'].value.set(volconfig.clim1, volconfig.clim2); + material.uniforms['u_renderstyle'].value = volconfig.renderstyle == 'mip' ? 0 : 1; // 0: MIP, 1: ISO + material.uniforms['u_renderthreshold'].value = volconfig.isothreshold; // For ISO renderstyle + material.uniforms['u_cmdata'].value = cmtextures[volconfig.colormap]; + + render(); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + const aspect = window.innerWidth / window.innerHeight; + + const frustumHeight = camera.top - camera.bottom; + + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + + camera.updateProjectionMatrix(); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_texture3d_partialupdate.ts b/examples-testing/examples/webgl_texture3d_partialupdate.ts new file mode 100644 index 000000000..58615db84 --- /dev/null +++ b/examples-testing/examples/webgl_texture3d_partialupdate.ts @@ -0,0 +1,326 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +const INITIAL_CLOUD_SIZE = 128; + +let renderer, scene, camera; +let mesh; +let prevTime = performance.now(); +let cloudTexture = null; + +init(); + +function generateCloudTexture(size, scaleFactor = 1.0) { + const data = new Uint8Array(size * size * size); + const scale = (scaleFactor * 10.0) / size; + + let i = 0; + const perlin = new ImprovedNoise(); + const vector = new THREE.Vector3(); + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const dist = vector + .set(x, y, z) + .subScalar(size / 2) + .divideScalar(size) + .length(); + const fadingFactor = (1.0 - dist) * (1.0 - dist); + data[i] = (128 + 128 * perlin.noise((x * scale) / 1.5, y * scale, (z * scale) / 1.5)) * fadingFactor; + + i++; + } + } + } + + return new THREE.Data3DTexture(data, size, size, size); +} + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 1.5); + + new OrbitControls(camera, renderer.domElement); + + // Sky + + const canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 32; + + const context = canvas.getContext('2d'); + const gradient = context.createLinearGradient(0, 0, 0, 32); + gradient.addColorStop(0.0, '#014a84'); + gradient.addColorStop(0.5, '#0561a0'); + gradient.addColorStop(1.0, '#437ab6'); + context.fillStyle = gradient; + context.fillRect(0, 0, 1, 32); + + const skyMap = new THREE.CanvasTexture(canvas); + skyMap.colorSpace = THREE.SRGBColorSpace; + + const sky = new THREE.Mesh( + new THREE.SphereGeometry(10), + new THREE.MeshBasicMaterial({ map: skyMap, side: THREE.BackSide }), + ); + scene.add(sky); + + // Texture + + const texture = new THREE.Data3DTexture( + new Uint8Array(INITIAL_CLOUD_SIZE * INITIAL_CLOUD_SIZE * INITIAL_CLOUD_SIZE).fill(0), + INITIAL_CLOUD_SIZE, + INITIAL_CLOUD_SIZE, + INITIAL_CLOUD_SIZE, + ); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + cloudTexture = texture; + + // Material + + const vertexShader = /* glsl */ ` + in vec3 position; + + uniform mat4 modelMatrix; + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + uniform vec3 cameraPos; + + out vec3 vOrigin; + out vec3 vDirection; + + void main() { + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + + vOrigin = vec3( inverse( modelMatrix ) * vec4( cameraPos, 1.0 ) ).xyz; + vDirection = position - vOrigin; + + gl_Position = projectionMatrix * mvPosition; + } + `; + + const fragmentShader = /* glsl */ ` + precision highp float; + precision highp sampler3D; + + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + + in vec3 vOrigin; + in vec3 vDirection; + + out vec4 color; + + uniform vec3 base; + uniform sampler3D map; + + uniform float threshold; + uniform float range; + uniform float opacity; + uniform float steps; + uniform float frame; + + uint wang_hash(uint seed) + { + seed = (seed ^ 61u) ^ (seed >> 16u); + seed *= 9u; + seed = seed ^ (seed >> 4u); + seed *= 0x27d4eb2du; + seed = seed ^ (seed >> 15u); + return seed; + } + + float randomFloat(inout uint seed) + { + return float(wang_hash(seed)) / 4294967296.; + } + + vec2 hitBox( vec3 orig, vec3 dir ) { + const vec3 box_min = vec3( - 0.5 ); + const vec3 box_max = vec3( 0.5 ); + vec3 inv_dir = 1.0 / dir; + vec3 tmin_tmp = ( box_min - orig ) * inv_dir; + vec3 tmax_tmp = ( box_max - orig ) * inv_dir; + vec3 tmin = min( tmin_tmp, tmax_tmp ); + vec3 tmax = max( tmin_tmp, tmax_tmp ); + float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); + float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); + return vec2( t0, t1 ); + } + + float sample1( vec3 p ) { + return texture( map, p ).r; + } + + float shading( vec3 coord ) { + float step = 0.01; + return sample1( coord + vec3( - step ) ) - sample1( coord + vec3( step ) ); + } + + vec4 linearToSRGB( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); + } + + void main(){ + vec3 rayDir = normalize( vDirection ); + vec2 bounds = hitBox( vOrigin, rayDir ); + + if ( bounds.x > bounds.y ) discard; + + bounds.x = max( bounds.x, 0.0 ); + + vec3 p = vOrigin + bounds.x * rayDir; + vec3 inc = 1.0 / abs( rayDir ); + float delta = min( inc.x, min( inc.y, inc.z ) ); + delta /= steps; + + // Jitter + + // Nice little seed from + // https://blog.demofox.org/2020/05/25/casual-shadertoy-path-tracing-1-basic-camera-diffuse-emissive/ + uint seed = uint( gl_FragCoord.x ) * uint( 1973 ) + uint( gl_FragCoord.y ) * uint( 9277 ) + uint( frame ) * uint( 26699 ); + vec3 size = vec3( textureSize( map, 0 ) ); + float randNum = randomFloat( seed ) * 2.0 - 1.0; + p += rayDir * randNum * ( 1.0 / size ); + + // + + vec4 ac = vec4( base, 0.0 ); + + for ( float t = bounds.x; t < bounds.y; t += delta ) { + + float d = sample1( p + 0.5 ); + + d = smoothstep( threshold - range, threshold + range, d ) * opacity; + + float col = shading( p + 0.5 ) * 3.0 + ( ( p.x + p.y ) * 0.25 ) + 0.2; + + ac.rgb += ( 1.0 - ac.a ) * d * col; + + ac.a += ( 1.0 - ac.a ) * d; + + if ( ac.a >= 0.95 ) break; + + p += rayDir * delta; + + } + + color = linearToSRGB( ac ); + + if ( color.a == 0.0 ) discard; + + } + `; + + const geometry = new THREE.BoxGeometry(1, 1, 1); + const material = new THREE.RawShaderMaterial({ + glslVersion: THREE.GLSL3, + uniforms: { + base: { value: new THREE.Color(0x798aa0) }, + map: { value: texture }, + cameraPos: { value: new THREE.Vector3() }, + threshold: { value: 0.25 }, + opacity: { value: 0.25 }, + range: { value: 0.1 }, + steps: { value: 100 }, + frame: { value: 0 }, + }, + vertexShader, + fragmentShader, + side: THREE.BackSide, + transparent: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const parameters = { + threshold: 0.25, + opacity: 0.25, + range: 0.1, + steps: 100, + }; + + function update() { + material.uniforms.threshold.value = parameters.threshold; + material.uniforms.opacity.value = parameters.opacity; + material.uniforms.range.value = parameters.range; + material.uniforms.steps.value = parameters.steps; + } + + const gui = new GUI(); + gui.add(parameters, 'threshold', 0, 1, 0.01).onChange(update); + gui.add(parameters, 'opacity', 0, 1, 0.01).onChange(update); + gui.add(parameters, 'range', 0, 1, 0.01).onChange(update); + gui.add(parameters, 'steps', 0, 200, 1).onChange(update); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +let curr = 0; +const countPerRow = 4; +const countPerSlice = countPerRow * countPerRow; +const sliceCount = 4; +const totalCount = sliceCount * countPerSlice; +const margins = 8; + +const perElementPaddedSize = (INITIAL_CLOUD_SIZE - margins) / countPerRow; +const perElementSize = Math.floor((INITIAL_CLOUD_SIZE - 1) / countPerRow); + +function animate() { + const time = performance.now(); + if (time - prevTime > 1500.0 && curr < totalCount) { + const position = new THREE.Vector3( + Math.floor(curr % countPerRow) * perElementSize + margins * 0.5, + Math.floor((curr % countPerSlice) / countPerRow) * perElementSize + margins * 0.5, + Math.floor(curr / countPerSlice) * perElementSize + margins * 0.5, + ).floor(); + + const maxDimension = perElementPaddedSize - 1; + const box = new THREE.Box3( + new THREE.Vector3(0, 0, 0), + new THREE.Vector3(maxDimension, maxDimension, maxDimension), + ); + const scaleFactor = (Math.random() + 0.5) * 0.5; + const source = generateCloudTexture(perElementPaddedSize, scaleFactor); + + renderer.copyTextureToTexture(source, cloudTexture, box, position); + + prevTime = time; + + curr++; + } + + mesh.material.uniforms.cameraPos.value.copy(camera.position); + // mesh.rotation.y = - performance.now() / 7500; + + mesh.material.uniforms.frame.value++; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_tonemapping.ts b/examples-testing/examples/webgl_tonemapping.ts new file mode 100644 index 000000000..00aee8de5 --- /dev/null +++ b/examples-testing/examples/webgl_tonemapping.ts @@ -0,0 +1,170 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let renderer, scene, camera, controls; +let gui, + guiExposure = null; + +const params = { + exposure: 1.0, + toneMapping: 'Neutral', + blurriness: 0.3, + intensity: 1.0, +}; + +const toneMappingOptions = { + None: THREE.NoToneMapping, + Linear: THREE.LinearToneMapping, + Reinhard: THREE.ReinhardToneMapping, + Cineon: THREE.CineonToneMapping, + ACESFilmic: THREE.ACESFilmicToneMapping, + AgX: THREE.AgXToneMapping, + Neutral: THREE.NeutralToneMapping, + Custom: THREE.CustomToneMapping, +}; + +init().catch(function (err) { + console.error(err); +}); + +async function init() { + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderer.toneMapping = toneMappingOptions[params.toneMapping]; + renderer.toneMappingExposure = params.exposure; + + // Set CustomToneMapping to Uncharted2 + // source: http://filmicworlds.com/blog/filmic-tonemapping-operators/ + + THREE.ShaderChunk.tonemapping_pars_fragment = THREE.ShaderChunk.tonemapping_pars_fragment.replace( + 'vec3 CustomToneMapping( vec3 color ) { return color; }', + + `#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) ) + + float toneMappingWhitePoint = 1.0; + + vec3 CustomToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) ); + + }`, + ); + + scene = new THREE.Scene(); + scene.backgroundBlurriness = params.blurriness; + + const light = new THREE.DirectionalLight(0xfff3ee, 3); // simulate sun + light.position.set(1, 0.05, 0.7); + scene.add(light); + + // scene.add( new THREE.DirectionalLightHelper( light, 1, 0x000000 ) ); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.set(-0.02, 0.03, 0.05); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enablePan = false; + controls.enableDamping = true; + controls.minDistance = 0.03; + controls.maxDistance = 0.2; + controls.target.set(0, 0.03, 0); + controls.update(); + + const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); + + const dracoLoader = new DRACOLoader(); + const gltfLoader = new GLTFLoader(); + gltfLoader.setDRACOLoader(dracoLoader); + gltfLoader.setPath('models/gltf/'); + + const [texture, gltf] = await Promise.all([ + hdrLoader.loadAsync('venice_sunset_1k.hdr'), + gltfLoader.loadAsync('venice_mask.glb'), + ]); + + // environment + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + // model + + scene.add(gltf.scene); + + window.addEventListener('resize', onWindowResize); + + // + + gui = new GUI(); + const toneMappingFolder = gui.addFolder('Tone Mapping'); + + toneMappingFolder + .add(params, 'toneMapping', Object.keys(toneMappingOptions)) + + .name('type') + .onChange(function () { + updateGUI(); + + renderer.toneMapping = toneMappingOptions[params.toneMapping]; + }); + + guiExposure = toneMappingFolder + .add(params, 'exposure', 0, 2) + + .onChange(function (value) { + renderer.toneMappingExposure = value; + }); + + const backgroundFolder = gui.addFolder('Background'); + + backgroundFolder + .add(params, 'blurriness', 0, 1) + + .onChange(function (value) { + scene.backgroundBlurriness = value; + }); + + backgroundFolder + .add(params, 'intensity', 0, 1) + + .onChange(function (value) { + scene.backgroundIntensity = value; + }); + + updateGUI(); + + gui.open(); +} + +function updateGUI() { + if (params.toneMapping === 'None') { + guiExposure.hide(); + } else { + guiExposure.show(); + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_tsl_clearcoat.ts b/examples-testing/examples/webgl_tsl_clearcoat.ts new file mode 100644 index 000000000..75a62894f --- /dev/null +++ b/examples-testing/examples/webgl_tsl_clearcoat.ts @@ -0,0 +1,210 @@ +import * as THREE from 'three/webgpu'; +import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; +import { WebGLRenderer } from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; + +import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; + +let camera, scene, renderer; + +let particleLight; +let group; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.25, 50); + camera.position.z = 10; + + scene = new THREE.Scene(); + + group = new THREE.Group(); + + new HDRCubeTextureLoader() + .setPath('textures/cube/pisaHDR/') + .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], async function (texture) { + const geometry = new THREE.SphereGeometry(0.8, 64, 32); + + const textureLoader = new THREE.TextureLoader(); + + const diffuse = textureLoader.load('textures/carbon/Carbon.png'); + diffuse.colorSpace = THREE.SRGBColorSpace; + diffuse.wrapS = THREE.RepeatWrapping; + diffuse.wrapT = THREE.RepeatWrapping; + diffuse.repeat.x = 10; + diffuse.repeat.y = 10; + + const normalMap = textureLoader.load('textures/carbon/Carbon_Normal.png'); + normalMap.wrapS = THREE.RepeatWrapping; + normalMap.wrapT = THREE.RepeatWrapping; + normalMap.repeat.x = 10; + normalMap.repeat.y = 10; + + const normalMap2 = textureLoader.load('textures/water/Water_1_M_Normal.jpg'); + + const normalMap3 = new THREE.CanvasTexture(new FlakesTexture()); + normalMap3.wrapS = THREE.RepeatWrapping; + normalMap3.wrapT = THREE.RepeatWrapping; + normalMap3.repeat.x = 10; + normalMap3.repeat.y = 6; + normalMap3.anisotropy = 16; + + const normalMap4 = textureLoader.load('textures/golfball.jpg'); + + const clearcoatNormalMap = textureLoader.load( + 'textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png', + ); + + // car paint + + let material = new THREE.MeshPhysicalNodeMaterial({ + clearcoat: 1.0, + clearcoatRoughness: 0.1, + metalness: 0.9, + roughness: 0.5, + color: 0x0000ff, + normalMap: normalMap3, + normalScale: new THREE.Vector2(0.15, 0.15), + }); + let mesh = new THREE.Mesh(geometry, material); + mesh.position.x = -1; + mesh.position.y = 1; + mesh.castShadow = true; + mesh.receiveShadow = true; + group.add(mesh); + + // fibers + + material = new THREE.MeshPhysicalNodeMaterial({ + roughness: 0.5, + clearcoat: 1.0, + clearcoatRoughness: 0.1, + map: diffuse, + normalMap: normalMap, + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = 1; + mesh.position.y = 1; + mesh.castShadow = true; + mesh.receiveShadow = true; + group.add(mesh); + + // golf + + material = new THREE.MeshPhysicalNodeMaterial({ + metalness: 0.0, + roughness: 0.1, + clearcoat: 1.0, + normalMap: normalMap4, + clearcoatNormalMap: clearcoatNormalMap, + + // y scale is negated to compensate for normal map handedness. + clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = -1; + mesh.position.y = -1; + mesh.castShadow = true; + mesh.receiveShadow = true; + group.add(mesh); + + // clearcoat + normalmap + + material = new THREE.MeshPhysicalNodeMaterial({ + clearcoat: 1.0, + metalness: 1.0, + color: 0xff0000, + normalMap: normalMap2, + normalScale: new THREE.Vector2(0.15, 0.15), + clearcoatNormalMap: clearcoatNormalMap, + + // y scale is negated to compensate for normal map handedness. + clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = 1; + mesh.position.y = -1; + mesh.castShadow = true; + mesh.receiveShadow = true; + group.add(mesh); + + // + + scene.background = texture; + scene.environment = texture; + + // wait until the models can be added to the scene without blocking due to shader compilation + + await renderer.compileAsync(group, camera, scene); + + scene.add(group); + }); + + // LIGHTS + + particleLight = new THREE.Mesh( + new THREE.SphereGeometry(0.05, 8, 8), + new THREE.MeshBasicNodeMaterial({ color: 0xffffff }), + ); + scene.add(particleLight); + + const pointLight = new THREE.PointLight(0xffffff, 30); + pointLight.castShadow = true; + particleLight.add(pointLight); + + renderer = new WebGLRenderer({ antialias: true }); + renderer.setNodesHandler(new WebGLNodesHandler()); + renderer.shadowMap.enabled = true; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.25; + + // EVENTS + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 3; + controls.maxDistance = 30; + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +// + +function animate() { + render(); +} + +function render() { + const timer = Date.now() * 0.00025; + + particleLight.position.x = Math.sin(timer * 7) * 3; + particleLight.position.y = Math.cos(timer * 5) * 4; + particleLight.position.z = Math.cos(timer * 3) * 3; + + for (let i = 0; i < group.children.length; i++) { + const child = group.children[i]; + child.rotation.y += 0.005; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_tsl_instancing.ts b/examples-testing/examples/webgl_tsl_instancing.ts new file mode 100644 index 000000000..c80bebf9b --- /dev/null +++ b/examples-testing/examples/webgl_tsl_instancing.ts @@ -0,0 +1,286 @@ +import * as THREE from 'three'; +import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; +import { MeshPhongNodeMaterial } from 'three/webgpu'; +import { sin, time, vec3, positionWorld } from 'three/tsl'; + +let container, stats, gui, guiStatsEl; +let camera, controls, scene, renderer, material; + +// gui + +const Method = { + INSTANCED: 'INSTANCED', + MERGED: 'MERGED', + NAIVE: 'NAIVE', +}; + +const api = { + method: Method.INSTANCED, + count: 1000, +}; + +// + +init(); +initMesh(); + +// + +function clean() { + const meshes = []; + + scene.traverse(function (object) { + if (object.isMesh) meshes.push(object); + }); + + for (let i = 0; i < meshes.length; i++) { + const mesh = meshes[i]; + mesh.material.dispose(); + mesh.geometry.dispose(); + + scene.remove(mesh); + } +} + +const randomizeMatrix = (function () { + const position = new THREE.Vector3(); + const quaternion = new THREE.Quaternion(); + const scale = new THREE.Vector3(); + + return function (matrix) { + position.x = Math.random() * 40 - 20; + position.y = Math.random() * 40 - 20; + position.z = Math.random() * 40 - 20; + + quaternion.random(); + + scale.x = scale.y = scale.z = Math.random() * 1; + + matrix.compose(position, quaternion, scale); + }; +})(); + +function initMesh() { + clean(); + + // make instances + new THREE.BufferGeometryLoader().setPath('models/json/').load('suzanne_buffergeometry.json', function (geometry) { + const posY = positionWorld; + const t = time.mul(4); + material = new MeshPhongNodeMaterial(); + material.colorNode = vec3( + sin(posY.mul(0.1).add(t)).mul(0.5).add(0.5).x, + sin(posY.mul(0.1).add(t.mul(0.5).add(2))) + .mul(0.5) + .add(0.5).y, + sin(posY.mul(0.1).add(t.mul(1.5).add(4))) + .mul(0.5) + .add(0.5).z, + ); + + geometry.computeVertexNormals(); + + console.time(api.method + ' (build)'); + + switch (api.method) { + case Method.INSTANCED: + makeInstanced(geometry); + break; + + case Method.MERGED: + makeMerged(geometry); + break; + + case Method.NAIVE: + makeNaive(geometry); + break; + } + + console.timeEnd(api.method + ' (build)'); + }); +} + +function makeInstanced(geometry) { + const matrix = new THREE.Matrix4(); + const mesh = new THREE.InstancedMesh(geometry, material, api.count); + + for (let i = 0; i < api.count; i++) { + randomizeMatrix(matrix); + mesh.setMatrixAt(i, matrix); + } + + scene.add(mesh); + + // + + const geometryByteLength = getGeometryByteLength(geometry); + + guiStatsEl.innerHTML = [ + 'GPU draw calls: 1', + 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), + ].join('
'); +} + +function makeMerged(geometry) { + const geometries = []; + const matrix = new THREE.Matrix4(); + + for (let i = 0; i < api.count; i++) { + randomizeMatrix(matrix); + + const instanceGeometry = geometry.clone(); + instanceGeometry.applyMatrix4(matrix); + + geometries.push(instanceGeometry); + } + + const mergedGeometry = BufferGeometryUtils.mergeGeometries(geometries); + + scene.add(new THREE.Mesh(mergedGeometry, material)); + + // + + guiStatsEl.innerHTML = [ + 'GPU draw calls: 1', + 'GPU memory: ' + formatBytes(getGeometryByteLength(mergedGeometry), 2), + ].join('
'); +} + +function makeNaive(geometry) { + const matrix = new THREE.Matrix4(); + + for (let i = 0; i < api.count; i++) { + randomizeMatrix(matrix); + + const mesh = new THREE.Mesh(geometry, material); + mesh.applyMatrix4(matrix); + + scene.add(mesh); + } + + // + + const geometryByteLength = getGeometryByteLength(geometry); + + guiStatsEl.innerHTML = [ + 'GPU draw calls: ' + api.count, + 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), + ].join('
'); +} + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + + // camera + + camera = new THREE.PerspectiveCamera(70, width / height, 1, 100); + camera.position.z = 30; + + // renderer + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setNodesHandler(new WebGLNodesHandler()); + + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + container = document.getElementById('container'); + container.appendChild(renderer.domElement); + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = 0.5; + + // light + + const ambientLight = new THREE.AmbientLight(0xffffff, 2); + const directionalLight = new THREE.DirectionalLight(0xffffff, 2); + directionalLight.position.set(1, 1, 1); + scene.add(directionalLight, ambientLight); + + // stats + + stats = new Stats(); + container.appendChild(stats.dom); + + // gui + + gui = new GUI(); + gui.add(api, 'method', Method).onChange(initMesh); + gui.add(api, 'count', 1, 10000).step(1).onChange(initMesh); + + const perfFolder = gui.addFolder('Performance'); + + guiStatsEl = document.createElement('div'); + guiStatsEl.classList.add('gui-stats'); + + perfFolder.$children.appendChild(guiStatsEl); + perfFolder.open(); + + // listeners + + window.addEventListener('resize', onWindowResize); + + Object.assign(window, { scene }); +} + +// + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); + + stats.update(); +} + +// + +function getGeometryByteLength(geometry) { + let total = 0; + + if (geometry.index) total += geometry.index.array.byteLength; + + for (const name in geometry.attributes) { + total += geometry.attributes[name].array.byteLength; + } + + return total; +} + +// Source: https://stackoverflow.com/a/18650828/1314762 +function formatBytes(bytes, decimals) { + if (bytes === 0) return '0 bytes'; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ['bytes', 'KB', 'MB']; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; +} diff --git a/examples-testing/examples/webgl_tsl_shadowmap.ts b/examples-testing/examples/webgl_tsl_shadowmap.ts new file mode 100644 index 000000000..f006d7c1a --- /dev/null +++ b/examples-testing/examples/webgl_tsl_shadowmap.ts @@ -0,0 +1,160 @@ +import * as THREE from 'three/webgpu'; +import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; +import { WebGLRenderer } from 'three'; +import { mx_fractal_noise_float, mx_fractal_noise_vec3, positionLocal, positionWorld, Fn, color } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, timer; +let dirLight, spotLight; +let torusKnot, dirGroup; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 10, 20); + + scene = new THREE.Scene(); + scene.backgroundNode = color(0x222244); + scene.fog = new THREE.Fog(0x222244, 50, 100); + + // lights + + scene.add(new THREE.AmbientLight(0x444444, 2)); + + spotLight = new THREE.SpotLight(0xff8888, 400); + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.3; + spotLight.position.set(8, 10, 5); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 8; + spotLight.shadow.camera.far = 200; + spotLight.shadow.mapSize.width = 2048; + spotLight.shadow.mapSize.height = 2048; + spotLight.shadow.radius = 4; + scene.add(spotLight); + + dirLight = new THREE.DirectionalLight(0x8888ff, 3); + dirLight.position.set(3, 12, 17); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = 500; + dirLight.shadow.camera.right = 17; + dirLight.shadow.camera.left = -17; + dirLight.shadow.camera.top = 17; + dirLight.shadow.camera.bottom = -17; + dirLight.shadow.mapSize.width = 2048; + dirLight.shadow.mapSize.height = 2048; + dirLight.shadow.radius = 4; + + dirGroup = new THREE.Group(); + dirGroup.add(dirLight); + scene.add(dirGroup); + + // geometry + + const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 80); + const material = new THREE.MeshPhongNodeMaterial({ + color: 0x999999, + shininess: 0, + specular: 0x222222, + }); + + const materialCustomShadow = material.clone(); + materialCustomShadow.transparent = true; + + const discardNode = mx_fractal_noise_float(positionLocal.mul(0.1)).x.greaterThan(0.0); + + materialCustomShadow.maskNode = discardNode; + + torusKnot = new THREE.Mesh(geometry, materialCustomShadow); + torusKnot.scale.multiplyScalar(1 / 18); + torusKnot.position.y = 3; + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); + + const pillar1 = new THREE.Mesh(cylinderGeometry, material); + pillar1.position.set(8, 3.5, 8); + pillar1.castShadow = true; + + const pillar2 = pillar1.clone(); + pillar2.position.set(8, 3.5, -8); + const pillar3 = pillar1.clone(); + pillar3.position.set(-8, 3.5, 8); + const pillar4 = pillar1.clone(); + pillar4.position.set(-8, 3.5, -8); + + scene.add(pillar1); + scene.add(pillar2); + scene.add(pillar3); + scene.add(pillar4); + + const planeGeometry = new THREE.PlaneGeometry(200, 200); + + const planeMaterial = new THREE.MeshPhongNodeMaterial(); + planeMaterial.color.setHex(0x999999); + planeMaterial.shininess = 0; + planeMaterial.specular.setHex(0x111111); + + planeMaterial.colorNode = Fn(() => { + const pos = positionWorld.toVar(); + pos.xz.addAssign(mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().xz); + return mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().zzz.mul(0.2).add(0.5); + })(); + + const ground = new THREE.Mesh(planeGeometry, planeMaterial); + ground.rotation.x = -Math.PI / 2; + ground.scale.multiplyScalar(3); + ground.castShadow = true; + ground.receiveShadow = true; + scene.add(ground); + + // renderer + + renderer = new WebGLRenderer({ antialias: true }); + renderer.setNodesHandler(new WebGLNodesHandler()); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + document.body.appendChild(renderer.domElement); + + // Mouse control + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2, 0); + controls.minDistance = 7; + controls.maxDistance = 40; + controls.update(); + + timer = new THREE.Timer(); + timer.connect(document); + + window.addEventListener('resize', resize); +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(time) { + timer.update(); + + const delta = timer.getDelta(); + + torusKnot.rotation.x += 0.25 * delta; + torusKnot.rotation.y += 0.5 * delta; + torusKnot.rotation.z += 1 * delta; + + dirGroup.rotation.y += 0.7 * delta; + dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_tsl_skinning.ts b/examples-testing/examples/webgl_tsl_skinning.ts new file mode 100644 index 000000000..6164dbab6 --- /dev/null +++ b/examples-testing/examples/webgl_tsl_skinning.ts @@ -0,0 +1,74 @@ +import * as THREE from 'three/webgpu'; +import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; +import { WebGLRenderer } from 'three'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer; + +let mixer, timer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.set(1, 2, 3); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x3355aa); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + //lights + + const light = new THREE.PointLight(0xffffff, 1, 100); + light.power = 2500; + camera.add(light); + scene.add(camera); + + const ambient = new THREE.AmbientLight(0x4466ff, 1); + scene.add(ambient); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Michelle.glb', function (gltf) { + const object = gltf.scene; + mixer = new THREE.AnimationMixer(object); + + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + scene.add(object); + }); + + //renderer + + renderer = new WebGLRenderer({ antialias: true }); + renderer.setNodesHandler(new WebGLNodesHandler()); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.LinearToneMapping; + renderer.toneMappingExposure = 0.4; + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_ubo.ts b/examples-testing/examples/webgl_ubo.ts new file mode 100644 index 000000000..a34a5b2ff --- /dev/null +++ b/examples-testing/examples/webgl_ubo.ts @@ -0,0 +1,140 @@ +import * as THREE from 'three'; + +let camera, scene, renderer, timer; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 25); + + scene = new THREE.Scene(); + camera.lookAt(scene.position); + + timer = new THREE.Timer(); + timer.connect(document); + + // geometry + + const geometry1 = new THREE.TetrahedronGeometry(); + const geometry2 = new THREE.BoxGeometry(); + + // texture + + const texture = new THREE.TextureLoader().load('textures/crate.gif'); + texture.colorSpace = THREE.SRGBColorSpace; + + // uniforms groups + + // Camera and lighting related data are perfect examples of using UBOs since you have to store these + // data just once. They can be shared across all shader programs. + + const cameraUniformsGroup = new THREE.UniformsGroup(); + cameraUniformsGroup.setName('ViewData'); + cameraUniformsGroup.add(new THREE.Uniform(camera.projectionMatrix)); // projection matrix + cameraUniformsGroup.add(new THREE.Uniform(camera.matrixWorldInverse)); // view matrix + + const lightingUniformsGroup = new THREE.UniformsGroup(); + lightingUniformsGroup.setName('LightingData'); + lightingUniformsGroup.add(new THREE.Uniform(new THREE.Vector3(0, 0, 10))); // light position + lightingUniformsGroup.add(new THREE.Uniform(new THREE.Color(0x7c7c7c))); // ambient color + lightingUniformsGroup.add(new THREE.Uniform(new THREE.Color(0xd5d5d5))); // diffuse color + lightingUniformsGroup.add(new THREE.Uniform(new THREE.Color(0xe7e7e7))); // specular color + lightingUniformsGroup.add(new THREE.Uniform(64)); // shininess + + // materials + + const material1 = new THREE.RawShaderMaterial({ + uniforms: { + modelMatrix: { value: null }, + normalMatrix: { value: null }, + color: { value: null }, + }, + vertexShader: document.getElementById('vertexShader1').textContent, + fragmentShader: document.getElementById('fragmentShader1').textContent, + glslVersion: THREE.GLSL3, + }); + + const material2 = new THREE.RawShaderMaterial({ + uniforms: { + modelMatrix: { value: null }, + diffuseMap: { value: null }, + }, + vertexShader: document.getElementById('vertexShader2').textContent, + fragmentShader: document.getElementById('fragmentShader2').textContent, + glslVersion: THREE.GLSL3, + }); + + // meshes + + for (let i = 0; i < 200; i++) { + let mesh; + + if (i % 2 === 0) { + mesh = new THREE.Mesh(geometry1, material1.clone()); + + mesh.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; + mesh.material.uniforms.modelMatrix.value = mesh.matrixWorld; + mesh.material.uniforms.normalMatrix.value = mesh.normalMatrix; + mesh.material.uniforms.color.value = new THREE.Color(0xffffff * Math.random()); + } else { + mesh = new THREE.Mesh(geometry2, material2.clone()); + + mesh.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; + mesh.material.uniforms.modelMatrix.value = mesh.matrixWorld; + mesh.material.uniforms.diffuseMap.value = texture; + } + + scene.add(mesh); + + const s = 1 + Math.random() * 0.5; + + mesh.scale.x = s; + mesh.scale.y = s; + mesh.scale.z = s; + + mesh.rotation.x = Math.random() * Math.PI; + mesh.rotation.y = Math.random() * Math.PI; + mesh.rotation.z = Math.random() * Math.PI; + + mesh.position.x = Math.random() * 40 - 20; + mesh.position.y = Math.random() * 40 - 20; + mesh.position.z = Math.random() * 20 - 10; + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize, false); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + scene.traverse(function (child) { + if (child.isMesh) { + child.rotation.x += delta * 0.5; + child.rotation.y += delta * 0.3; + } + }); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_ubo_arrays.ts b/examples-testing/examples/webgl_ubo_arrays.ts new file mode 100644 index 000000000..1d8f5f763 --- /dev/null +++ b/examples-testing/examples/webgl_ubo_arrays.ts @@ -0,0 +1,174 @@ +import * as THREE from 'three'; + +import Stats from 'three/addons/libs/stats.module.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, timer, stats; + +let lightingUniformsGroup, lightCenters; + +const container = document.getElementById('container'); + +const pointLightsMax = 300; + +const api = { + count: 200, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 50, 50); + + scene = new THREE.Scene(); + camera.lookAt(scene.position); + + timer = new THREE.Timer(); + timer.connect(document); + + // geometry + + const geometry = new THREE.SphereGeometry(); + + // uniforms groups + + lightingUniformsGroup = new THREE.UniformsGroup(); + lightingUniformsGroup.setName('LightingData'); + + const data = []; + const dataColors = []; + lightCenters = []; + + for (let i = 0; i < pointLightsMax; i++) { + const col = new THREE.Color(0xffffff * Math.random()).toArray(); + const x = Math.random() * 50 - 25; + const z = Math.random() * 50 - 25; + + data.push(new THREE.Uniform(new THREE.Vector4(x, 1, z, 0))); // light position + dataColors.push(new THREE.Uniform(new THREE.Vector4(col[0], col[1], col[2], 0))); // light color + + // Store the center positions + lightCenters.push({ x, z }); + } + + lightingUniformsGroup.add(data); // light position + lightingUniformsGroup.add(dataColors); // light position + lightingUniformsGroup.add(new THREE.Uniform(pointLightsMax)); // light position + + const cameraUniformsGroup = new THREE.UniformsGroup(); + cameraUniformsGroup.setName('ViewData'); + cameraUniformsGroup.add(new THREE.Uniform(camera.projectionMatrix)); // projection matrix + cameraUniformsGroup.add(new THREE.Uniform(camera.matrixWorldInverse)); // view matrix + + const material = new THREE.RawShaderMaterial({ + uniforms: { + modelMatrix: { value: null }, + normalMatrix: { value: null }, + }, + // uniformsGroups: [ cameraUniformsGroup, lightingUniformsGroup ], + name: 'Box', + defines: { + POINTLIGHTS_MAX: pointLightsMax, + }, + vertexShader: document.getElementById('vertexShader').textContent, + fragmentShader: document.getElementById('fragmentShader').textContent, + glslVersion: THREE.GLSL3, + }); + + const plane = new THREE.Mesh(new THREE.PlaneGeometry(100, 100), material.clone()); + plane.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; + plane.material.uniforms.modelMatrix.value = plane.matrixWorld; + plane.material.uniforms.normalMatrix.value = plane.normalMatrix; + plane.rotation.x = -Math.PI / 2; + plane.position.y = -1; + scene.add(plane); + + // meshes + const gridSize = { x: 10, y: 1, z: 10 }; + const spacing = 6; + + for (let i = 0; i < gridSize.x; i++) { + for (let j = 0; j < gridSize.y; j++) { + for (let k = 0; k < gridSize.z; k++) { + const mesh = new THREE.Mesh(geometry, material.clone()); + mesh.name = 'Sphere'; + mesh.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; + mesh.material.uniforms.modelMatrix.value = mesh.matrixWorld; + mesh.material.uniforms.normalMatrix.value = mesh.normalMatrix; + scene.add(mesh); + + mesh.position.x = i * spacing - (gridSize.x * spacing) / 2; + mesh.position.y = 0; + mesh.position.z = k * spacing - (gridSize.z * spacing) / 2; + } + } + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize, false); + + // controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enablePan = false; + + // stats + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // gui + const gui = new GUI(); + gui.add(api, 'count', 1, pointLightsMax) + .step(1) + .onChange(function () { + lightingUniformsGroup.uniforms[2].value = api.count; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const elapsedTime = timer.getElapsed(); + + const lights = lightingUniformsGroup.uniforms[0]; + + // Parameters for circular movement + const radius = 5; // Smaller radius for individual circular movements + const speed = 0.5; // Speed of rotation + + // Update each light's position + for (let i = 0; i < lights.length; i++) { + const light = lights[i]; + const center = lightCenters[i]; + + // Calculate circular movement around the light's center + const angle = speed * elapsedTime + i * 0.5; // Phase difference for each light + const x = center.x + Math.sin(angle) * radius; + const z = center.z + Math.cos(angle) * radius; + + // Update the light's position + light.value.set(x, 1, z, 0); + } + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgl_video_kinect.ts b/examples-testing/examples/webgl_video_kinect.ts new file mode 100644 index 000000000..4ba1b2b49 --- /dev/null +++ b/examples-testing/examples/webgl_video_kinect.ts @@ -0,0 +1,109 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer; +let geometry, mesh, material; +let mouse, center; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.set(0, 0, 500); + + scene = new THREE.Scene(); + center = new THREE.Vector3(); + center.z = -1000; + + const video = document.getElementById('video'); + + const texture = new THREE.VideoTexture(video); + texture.minFilter = THREE.NearestFilter; + texture.generateMipmaps = false; + + const width = 640, + height = 480; + const nearClipping = 850, + farClipping = 4000; + + geometry = new THREE.BufferGeometry(); + + const vertices = new Float32Array(width * height * 3); + + for (let i = 0, j = 0, l = vertices.length; i < l; i += 3, j++) { + vertices[i] = j % width; + vertices[i + 1] = Math.floor(j / width); + } + + geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)); + + material = new THREE.ShaderMaterial({ + uniforms: { + map: { value: texture }, + width: { value: width }, + height: { value: height }, + nearClipping: { value: nearClipping }, + farClipping: { value: farClipping }, + + pointSize: { value: 2 }, + zOffset: { value: 1000 }, + }, + vertexShader: document.getElementById('vs').textContent, + fragmentShader: document.getElementById('fs').textContent, + blending: THREE.AdditiveBlending, + depthTest: false, + depthWrite: false, + transparent: true, + }); + + mesh = new THREE.Points(geometry, material); + scene.add(mesh); + + const gui = new GUI(); + gui.add(material.uniforms.nearClipping, 'value', 1, 10000, 1.0).name('nearClipping'); + gui.add(material.uniforms.farClipping, 'value', 1, 10000, 1.0).name('farClipping'); + gui.add(material.uniforms.pointSize, 'value', 1, 10, 1.0).name('pointSize'); + gui.add(material.uniforms.zOffset, 'value', 0, 4000, 1.0).name('zOffset'); + + video.play(); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + mouse = new THREE.Vector3(0, 0, 1); + + document.addEventListener('mousemove', onDocumentMouseMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentMouseMove(event) { + mouse.x = (event.clientX - window.innerWidth / 2) * 8; + mouse.y = (event.clientY - window.innerHeight / 2) * 8; +} + +function animate() { + camera.position.x += (mouse.x - camera.position.x) * 0.05; + camera.position.y += (-mouse.y - camera.position.y) * 0.05; + camera.lookAt(center); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_video_panorama_equirectangular.ts b/examples-testing/examples/webgl_video_panorama_equirectangular.ts new file mode 100644 index 000000000..866eca16a --- /dev/null +++ b/examples-testing/examples/webgl_video_panorama_equirectangular.ts @@ -0,0 +1,95 @@ +import * as THREE from 'three'; + +let camera, scene, renderer; + +let isUserInteracting = false, + lon = 0, + lat = 0, + phi = 0, + theta = 0, + onPointerDownPointerX = 0, + onPointerDownPointerY = 0, + onPointerDownLon = 0, + onPointerDownLat = 0; + +const distance = 0.5; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.25, 10); + + scene = new THREE.Scene(); + + const geometry = new THREE.SphereGeometry(5, 60, 40); + // invert the geometry on the x-axis so that all of the faces point inward + geometry.scale(-1, 1, 1); + + const video = document.getElementById('video'); + video.play(); + + const texture = new THREE.VideoTexture(video); + texture.colorSpace = THREE.SRGBColorSpace; + const material = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + document.addEventListener('pointerdown', onPointerDown); + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerup', onPointerUp); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerDown(event) { + isUserInteracting = true; + + onPointerDownPointerX = event.clientX; + onPointerDownPointerY = event.clientY; + + onPointerDownLon = lon; + onPointerDownLat = lat; +} + +function onPointerMove(event) { + if (isUserInteracting === true) { + lon = (onPointerDownPointerX - event.clientX) * 0.1 + onPointerDownLon; + lat = (onPointerDownPointerY - event.clientY) * 0.1 + onPointerDownLat; + } +} + +function onPointerUp() { + isUserInteracting = false; +} + +function animate() { + lat = Math.max(-85, Math.min(85, lat)); + phi = THREE.MathUtils.degToRad(90 - lat); + theta = THREE.MathUtils.degToRad(lon); + + camera.position.x = distance * Math.sin(phi) * Math.cos(theta); + camera.position.y = distance * Math.cos(phi); + camera.position.z = distance * Math.sin(phi) * Math.sin(theta); + + camera.lookAt(0, 0, 0); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_volume_cloud.ts b/examples-testing/examples/webgl_volume_cloud.ts new file mode 100644 index 000000000..9aa07b98f --- /dev/null +++ b/examples-testing/examples/webgl_volume_cloud.ts @@ -0,0 +1,279 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let renderer, scene, camera; +let mesh; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 1.5); + + new OrbitControls(camera, renderer.domElement); + + // Sky + + const canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 32; + + const context = canvas.getContext('2d'); + const gradient = context.createLinearGradient(0, 0, 0, 32); + gradient.addColorStop(0.0, '#014a84'); + gradient.addColorStop(0.5, '#0561a0'); + gradient.addColorStop(1.0, '#437ab6'); + context.fillStyle = gradient; + context.fillRect(0, 0, 1, 32); + + const skyMap = new THREE.CanvasTexture(canvas); + skyMap.colorSpace = THREE.SRGBColorSpace; + + const sky = new THREE.Mesh( + new THREE.SphereGeometry(10), + new THREE.MeshBasicMaterial({ map: skyMap, side: THREE.BackSide }), + ); + scene.add(sky); + + // Texture + + const size = 128; + const data = new Uint8Array(size * size * size); + + let i = 0; + const scale = 0.05; + const perlin = new ImprovedNoise(); + const vector = new THREE.Vector3(); + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const d = + 1.0 - + vector + .set(x, y, z) + .subScalar(size / 2) + .divideScalar(size) + .length(); + data[i] = (128 + 128 * perlin.noise((x * scale) / 1.5, y * scale, (z * scale) / 1.5)) * d * d; + i++; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + // Material + + const vertexShader = /* glsl */ ` + in vec3 position; + + uniform mat4 modelMatrix; + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + uniform vec3 cameraPos; + + out vec3 vOrigin; + out vec3 vDirection; + + void main() { + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + + vOrigin = vec3( inverse( modelMatrix ) * vec4( cameraPos, 1.0 ) ).xyz; + vDirection = position - vOrigin; + + gl_Position = projectionMatrix * mvPosition; + } + `; + + const fragmentShader = /* glsl */ ` + precision highp float; + precision highp sampler3D; + + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + + in vec3 vOrigin; + in vec3 vDirection; + + out vec4 color; + + uniform vec3 base; + uniform sampler3D map; + + uniform float threshold; + uniform float range; + uniform float opacity; + uniform float steps; + uniform float frame; + + uint wang_hash(uint seed) + { + seed = (seed ^ 61u) ^ (seed >> 16u); + seed *= 9u; + seed = seed ^ (seed >> 4u); + seed *= 0x27d4eb2du; + seed = seed ^ (seed >> 15u); + return seed; + } + + float randomFloat(inout uint seed) + { + return float(wang_hash(seed)) / 4294967296.; + } + + vec2 hitBox( vec3 orig, vec3 dir ) { + const vec3 box_min = vec3( - 0.5 ); + const vec3 box_max = vec3( 0.5 ); + vec3 inv_dir = 1.0 / dir; + vec3 tmin_tmp = ( box_min - orig ) * inv_dir; + vec3 tmax_tmp = ( box_max - orig ) * inv_dir; + vec3 tmin = min( tmin_tmp, tmax_tmp ); + vec3 tmax = max( tmin_tmp, tmax_tmp ); + float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); + float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); + return vec2( t0, t1 ); + } + + float sample1( vec3 p ) { + return texture( map, p ).r; + } + + float shading( vec3 coord ) { + float step = 0.01; + return sample1( coord + vec3( - step ) ) - sample1( coord + vec3( step ) ); + } + + vec4 linearToSRGB( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); + } + + void main(){ + vec3 rayDir = normalize( vDirection ); + vec2 bounds = hitBox( vOrigin, rayDir ); + + if ( bounds.x > bounds.y ) discard; + + bounds.x = max( bounds.x, 0.0 ); + + float stepSize = ( bounds.y - bounds.x ) / steps; + + // Jitter + + // Nice little seed from + // https://blog.demofox.org/2020/05/25/casual-shadertoy-path-tracing-1-basic-camera-diffuse-emissive/ + uint seed = uint( gl_FragCoord.x ) * uint( 1973 ) + uint( gl_FragCoord.y ) * uint( 9277 ) + uint( frame ) * uint( 26699 ); + vec3 size = vec3( textureSize( map, 0 ) ); + float randNum = randomFloat( seed ) * 2.0 - 1.0; + vec3 p = vOrigin + bounds.x * rayDir; + p += rayDir * randNum * ( 1.0 / size ); + + // + + vec4 ac = vec4( base, 0.0 ); + + for ( float i = 0.0; i < steps; i += 1.0 ) { + + float t = bounds.x + i * stepSize; + + float d = sample1( p + 0.5 ); + + d = smoothstep( threshold - range, threshold + range, d ) * opacity; + + float col = shading( p + 0.5 ) * 3.0 + ( ( p.x + p.y ) * 0.25 ) + 0.2; + + ac.rgb += ( 1.0 - ac.a ) * d * col; + + ac.a += ( 1.0 - ac.a ) * d; + + if ( ac.a >= 0.95 ) break; + + p += rayDir * stepSize; + + } + + color = linearToSRGB( ac ); + + if ( color.a == 0.0 ) discard; + + } + `; + + const geometry = new THREE.BoxGeometry(1, 1, 1); + const material = new THREE.RawShaderMaterial({ + glslVersion: THREE.GLSL3, + uniforms: { + base: { value: new THREE.Color(0x798aa0) }, + map: { value: texture }, + cameraPos: { value: new THREE.Vector3() }, + threshold: { value: 0.25 }, + opacity: { value: 0.25 }, + range: { value: 0.1 }, + steps: { value: 100 }, + frame: { value: 0 }, + }, + vertexShader, + fragmentShader, + side: THREE.BackSide, + transparent: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const parameters = { + threshold: 0.25, + opacity: 0.25, + range: 0.1, + steps: 100, + }; + + function update() { + material.uniforms.threshold.value = parameters.threshold; + material.uniforms.opacity.value = parameters.opacity; + material.uniforms.range.value = parameters.range; + material.uniforms.steps.value = parameters.steps; + } + + const gui = new GUI(); + gui.add(parameters, 'threshold', 0, 1, 0.01).onChange(update); + gui.add(parameters, 'opacity', 0, 1, 0.01).onChange(update); + gui.add(parameters, 'range', 0, 1, 0.01).onChange(update); + gui.add(parameters, 'steps', 0, 200, 1).onChange(update); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.material.uniforms.cameraPos.value.copy(camera.position); + mesh.rotation.y = -performance.now() / 7500; + + mesh.material.uniforms.frame.value++; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_volume_instancing.ts b/examples-testing/examples/webgl_volume_instancing.ts new file mode 100644 index 000000000..7045732d6 --- /dev/null +++ b/examples-testing/examples/webgl_volume_instancing.ts @@ -0,0 +1,222 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { VOXLoader, buildData3DTexture } from 'three/addons/loaders/VOXLoader.js'; + +let renderer, scene, camera, controls, timer; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(0, 0, 4); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = -1.0; + controls.enableDamping = true; + + timer = new THREE.Timer(); + timer.connect(document); + + // Material + + const vertexShader = /* glsl */ ` + in vec3 position; + in mat4 instanceMatrix; + + uniform mat4 modelMatrix; + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + uniform vec3 cameraPos; + + out vec4 vScreenPosition; + out mat4 vInstanceToViewMatrix; + + void main() { + vec4 mvPosition = modelViewMatrix * instanceMatrix * vec4( position, 1.0 ); + + gl_Position = projectionMatrix * mvPosition; + vScreenPosition = vec4( gl_Position.xy, 0.0, gl_Position.w ); + vInstanceToViewMatrix = modelViewMatrix * instanceMatrix; + } + `; + + const fragmentShader = /* glsl */ ` + precision highp float; + precision highp sampler3D; + + uniform mat4 viewMatrix; + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + + in vec4 vScreenPosition; + in mat4 vInstanceToViewMatrix; + + out vec4 color; + + uniform sampler3D map; + + vec2 hitBox( vec3 orig, vec3 dir ) { + const vec3 box_min = vec3( - 0.5 ); + const vec3 box_max = vec3( 0.5 ); + vec3 inv_dir = 1.0 / dir; + vec3 tmin_tmp = ( box_min - orig ) * inv_dir; + vec3 tmax_tmp = ( box_max - orig ) * inv_dir; + vec3 tmin = min( tmin_tmp, tmax_tmp ); + vec3 tmax = max( tmin_tmp, tmax_tmp ); + float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); + float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); + return vec2( t0, t1 ); + } + + float sample1( vec3 p ) { + return texture( map, p ).r; + } + + #define epsilon .0001 + + vec3 normal( vec3 coord ) { + if ( coord.x < epsilon ) return vec3( 1.0, 0.0, 0.0 ); + if ( coord.y < epsilon ) return vec3( 0.0, 1.0, 0.0 ); + if ( coord.z < epsilon ) return vec3( 0.0, 0.0, 1.0 ); + if ( coord.x > 1.0 - epsilon ) return vec3( - 1.0, 0.0, 0.0 ); + if ( coord.y > 1.0 - epsilon ) return vec3( 0.0, - 1.0, 0.0 ); + if ( coord.z > 1.0 - epsilon ) return vec3( 0.0, 0.0, - 1.0 ); + + float step = 0.01; + float x = sample1( coord + vec3( - step, 0.0, 0.0 ) ) - sample1( coord + vec3( step, 0.0, 0.0 ) ); + float y = sample1( coord + vec3( 0.0, - step, 0.0 ) ) - sample1( coord + vec3( 0.0, step, 0.0 ) ); + float z = sample1( coord + vec3( 0.0, 0.0, - step ) ) - sample1( coord + vec3( 0.0, 0.0, step ) ); + + return normalize( vec3( x, y, z ) ); + } + + void main() { + + // perform w divide in the fragment shader to avoid interpolation artifacts + vec2 screenUv = vScreenPosition.xy / vScreenPosition.w; + mat4 invProjectionMatrix = inverse( projectionMatrix ); + mat4 invInstanceToViewMatrix = inverse( vInstanceToViewMatrix ); + + // get camera ray + vec4 temp; + vec3 camRayOrigin, camRayEnd; + temp = invProjectionMatrix * vec4( screenUv, - 1.0, 1.0 ); + camRayOrigin = temp.xyz / temp.w; + + temp = invProjectionMatrix * vec4( screenUv, 1.0, 1.0 ); + camRayEnd = temp.xyz / temp.w; + + // get local ray + vec3 instRayOrigin, instRayDirection, instRayEnd; + instRayOrigin = ( invInstanceToViewMatrix * vec4( camRayOrigin, 1.0 ) ).xyz; + instRayEnd = ( invInstanceToViewMatrix * vec4( camRayEnd, 1.0 ) ).xyz; + instRayDirection = normalize( instRayEnd - instRayOrigin ); + + // calculate the start of the ray at the box edge + vec2 bounds = hitBox( instRayOrigin, instRayDirection ); + + if ( bounds.x > bounds.y ) discard; + + bounds.x = max( bounds.x, 0.0 ); + + float stepSize = ( bounds.y - bounds.x ) / 100.0; + + vec3 p; + + // march through the volume + for ( float i = 0.0; i < 100.0; i += 1.0 ) { + + float t = bounds.x + i * stepSize; + p = instRayOrigin + t * instRayDirection; + float d = sample1( p + 0.5 ); + + if ( d > 0.5 ) { + + color.rgb = p * 2.0; + color.a = 1.; + break; + + } + + } + + if ( color.a == 0.0 ) discard; + + // calculate the final point in the ndc coords + vec4 ndc = projectionMatrix * vInstanceToViewMatrix * vec4( p, 1.0 ); + ndc /= ndc.w; + + // map the ndc coordinate to depth + // https://stackoverflow.com/questions/10264949/glsl-gl-fragcoord-z-calculation-and-setting-gl-fragdepth + float far = gl_DepthRange.far; + float near = gl_DepthRange.near; + gl_FragDepth = ( ( ( far - near ) * ndc.z ) + near + far ) / 2.0; + + } + `; + + const loader = new VOXLoader(); + loader.load('models/vox/menger.vox', function (chunks) { + for (let i = 0; i < chunks.length; i++) { + const chunk = chunks[i]; + + const geometry = new THREE.BoxGeometry(1, 1, 1); + const material = new THREE.RawShaderMaterial({ + glslVersion: THREE.GLSL3, + uniforms: { + map: { value: buildData3DTexture(chunk) }, + cameraPos: { value: new THREE.Vector3() }, + }, + vertexShader, + fragmentShader, + side: THREE.BackSide, + }); + + const mesh = new THREE.InstancedMesh(geometry, material, 50000); + mesh.onBeforeRender = function () { + this.material.uniforms.cameraPos.value.copy(camera.position); + }; + + const transform = new THREE.Object3D(); + + for (let i = 0; i < mesh.count; i++) { + transform.position.random().subScalar(0.5).multiplyScalar(150); + transform.rotation.x = Math.random() * Math.PI; + transform.rotation.y = Math.random() * Math.PI; + transform.rotation.z = Math.random() * Math.PI; + transform.updateMatrix(); + + mesh.setMatrixAt(i, transform.matrix); + } + + scene.add(mesh); + } + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + controls.update(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_volume_perlin.ts b/examples-testing/examples/webgl_volume_perlin.ts new file mode 100644 index 000000000..cd66fc7e6 --- /dev/null +++ b/examples-testing/examples/webgl_volume_perlin.ts @@ -0,0 +1,235 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let renderer, scene, camera; +let mesh; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 2); + + new OrbitControls(camera, renderer.domElement); + + // Texture + + const size = 128; + const data = new Uint8Array(size * size * size); + + let i = 0; + const perlin = new ImprovedNoise(); + const vector = new THREE.Vector3(); + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + vector.set(x, y, z).divideScalar(size); + + const d = perlin.noise(vector.x * 6.5, vector.y * 6.5, vector.z * 6.5); + + data[i++] = d * 128 + 128; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + // Material + + const vertexShader = /* glsl */ ` + in vec3 position; + + uniform mat4 modelMatrix; + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + uniform vec3 cameraPos; + + out vec3 vOrigin; + out vec3 vDirection; + + void main() { + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + + vOrigin = vec3( inverse( modelMatrix ) * vec4( cameraPos, 1.0 ) ).xyz; + vDirection = position - vOrigin; + + gl_Position = projectionMatrix * mvPosition; + } + `; + + const fragmentShader = /* glsl */ ` + precision highp float; + precision highp sampler3D; + + uniform mat4 modelViewMatrix; + uniform mat4 projectionMatrix; + + in vec3 vOrigin; + in vec3 vDirection; + + out vec4 color; + + uniform sampler3D map; + + uniform float threshold; + uniform float steps; + uniform bool refine; + + #define REFINEMENT_STEPS 4 + + vec2 hitBox( vec3 orig, vec3 dir ) { + const vec3 box_min = vec3( - 0.5 ); + const vec3 box_max = vec3( 0.5 ); + vec3 inv_dir = 1.0 / dir; + vec3 tmin_tmp = ( box_min - orig ) * inv_dir; + vec3 tmax_tmp = ( box_max - orig ) * inv_dir; + vec3 tmin = min( tmin_tmp, tmax_tmp ); + vec3 tmax = max( tmin_tmp, tmax_tmp ); + float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); + float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); + return vec2( t0, t1 ); + } + + float sample1( vec3 p ) { + return texture( map, p ).r; + } + + #define epsilon .0001 + + vec3 normal( vec3 coord ) { + if ( coord.x < epsilon ) return vec3( 1.0, 0.0, 0.0 ); + if ( coord.y < epsilon ) return vec3( 0.0, 1.0, 0.0 ); + if ( coord.z < epsilon ) return vec3( 0.0, 0.0, 1.0 ); + if ( coord.x > 1.0 - epsilon ) return vec3( - 1.0, 0.0, 0.0 ); + if ( coord.y > 1.0 - epsilon ) return vec3( 0.0, - 1.0, 0.0 ); + if ( coord.z > 1.0 - epsilon ) return vec3( 0.0, 0.0, - 1.0 ); + + float step = 0.01; + float x = sample1( coord + vec3( - step, 0.0, 0.0 ) ) - sample1( coord + vec3( step, 0.0, 0.0 ) ); + float y = sample1( coord + vec3( 0.0, - step, 0.0 ) ) - sample1( coord + vec3( 0.0, step, 0.0 ) ); + float z = sample1( coord + vec3( 0.0, 0.0, - step ) ) - sample1( coord + vec3( 0.0, 0.0, step ) ); + + return normalize( vec3( x, y, z ) ); + } + + void main(){ + + vec3 rayDir = normalize( vDirection ); + vec2 bounds = hitBox( vOrigin, rayDir ); + + if ( bounds.x > bounds.y ) discard; + + bounds.x = max( bounds.x, 0.0 ); + + float stepSize = ( bounds.y - bounds.x ) / steps; + + for ( float i = 0.0; i < steps; i += 1.0 ) { + + float t = bounds.x + i * stepSize; + vec3 p = vOrigin + t * rayDir; + float d = sample1( p + 0.5 ); + + if ( d > threshold ) { + + if ( refine ) { + + // The surface lies between the previous ray parameter i.e. (t - stepSize) + // and the current ray parameter (t). Bisect that interval to localize + // the crossing precisely. + + float t0 = max( t - stepSize, bounds.x ); + float t1 = t; + + for ( int j = 0; j < REFINEMENT_STEPS; j ++ ) { + + float tm = ( t0 + t1 ) * 0.5; + float dm = sample1( vOrigin + tm * rayDir + 0.5 ); + + bool isGreater = dm > threshold; + t1 = isGreater ? tm : t1; + t0 = isGreater ? t0 : tm; + + } + + p = vOrigin + t1 * rayDir; + + } + + color.rgb = normal( p + 0.5 ) * 0.5 + ( p * 1.5 + 0.25 ); + color.a = 1.; + break; + + } + + } + + if ( color.a == 0.0 ) discard; + + } + `; + + const geometry = new THREE.BoxGeometry(1, 1, 1); + const material = new THREE.RawShaderMaterial({ + glslVersion: THREE.GLSL3, + uniforms: { + map: { value: texture }, + cameraPos: { value: new THREE.Vector3() }, + threshold: { value: 0.6 }, + steps: { value: 200 }, + refine: { value: true }, + }, + vertexShader, + fragmentShader, + side: THREE.BackSide, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const parameters = { threshold: 0.6, steps: 200, refine: true }; + + function update() { + material.uniforms.threshold.value = parameters.threshold; + material.uniforms.steps.value = parameters.steps; + material.uniforms.refine.value = parameters.refine; + } + + const gui = new GUI(); + gui.add(parameters, 'threshold', 0, 1, 0.01).onChange(update); + gui.add(parameters, 'steps', 0, 300, 1).onChange(update); + gui.add(parameters, 'refine').onChange(update); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.material.uniforms.cameraPos.value.copy(camera.position); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgl_watch.ts b/examples-testing/examples/webgl_watch.ts new file mode 100644 index 000000000..8f3d76c4c --- /dev/null +++ b/examples-testing/examples/webgl_watch.ts @@ -0,0 +1,243 @@ +import * as THREE from 'three'; +import * as TWEEN from 'tween'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; +import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; + +let camera, scene, renderer; +let gui, dirLight, pointLight, controls, bloomPass, taaPass; +let ready = false; + +const meshes = {}; +const materials = {}; +const torad = Math.PI / 180; + +const setting = { + roughness: 0.1, + metalness: 1.0, + opacity: 0.8, + threshold: 0, + strength: 0.007, + radius: 0.0, + postProcess: false, +}; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.1, 20); + camera.position.set(0.8, 0.5, -1.5); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGLRenderer({ antialias: true, outputBufferType: THREE.HalfFloatType }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 0.7; + renderer.shadowMap.enabled = true; + container.appendChild(renderer.domElement); + + taaPass = new TAARenderPass(scene, camera); + taaPass.sampleLevel = 2; + + bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); + bloomPass.threshold = setting.threshold; + bloomPass.strength = setting.strength; + bloomPass.radius = setting.radius; + + new HDRLoader().setPath('textures/equirectangular/').load('lobe.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + scene.background = texture; + scene.environment = texture; + scene.backgroundBlurriness = 0.5; + scene.backgroundIntensity = 1.0; + scene.environmentIntensity = 1.5; + + // model + + const loader = new GLTFLoader().setPath('models/gltf/'); + loader.setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)); + loader.load('rolex.glb', function (gltf) { + gltf.scene.rotation.x = Math.PI * 0.25; + + gltf.scene.traverse(child => { + if (child.isMesh || child.isGroup) { + if (child.isMesh) { + child.material.vertexColors = false; + if (materials[child.material.name]) child.material = materials[child.material.name]; + else materials[child.material.name] = child.material; + if (child.name !== 'glass' && child.name !== 'floor') { + child.receiveShadow = true; + child.castShadow = true; + } + } + + meshes[child.name] = child; + } + }); + + scene.add(gltf.scene); + + meshes.glass.material = new THREE.MeshPhysicalMaterial({ + color: 0x020205, + transparent: true, + opacity: setting.opacity, + metalness: 0, + roughness: 0, + iridescence: 0.3, + clearcoat: 1.0, + blending: THREE.AdditiveBlending, + }); + + ready = true; + + createGUI(); + }); + }); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 0.3; + controls.maxDistance = 10; + controls.target.set(0, -0.1, 0); + controls.enableDamping = true; + controls.dampingFactor = 0.05; + controls.update(); + + dirLight = new THREE.DirectionalLight(0xffffff, 6); + dirLight.position.set(0.2, 0.6, 0.4); + dirLight.castShadow = true; + scene.add(dirLight); + const shadow = dirLight.shadow; + shadow.mapSize.width = shadow.mapSize.height = 2048; + shadow.radius = 8; + shadow.bias = -0.0005; + const shadowCam = shadow.camera, + s = 0.5; + shadowCam.near = 0.1; + shadowCam.far = 2; + shadowCam.right = shadowCam.top = s; + shadowCam.left = shadowCam.bottom = -s; + // debug shadow + //scene.add( new THREE.CameraHelper(shadowCam) ); + + pointLight = new THREE.PointLight(0x7b8cad, 1, 0, 2); + pointLight.position.set(-0.3, -0.2, -0.2); + scene.add(pointLight); + + window.addEventListener('resize', onWindowResize); + + moveCamera(); +} + +function moveCamera() { + controls.enabled = false; + controls.enableDamping = false; + + const sph = new THREE.Spherical(); + const target = controls.target; + const tmp = { + distance: controls.getDistance(), + phi: controls.getPolarAngle(), + theta: controls.getAzimuthalAngle(), + }; + + new TWEEN.Tween(tmp) + .to({ distance: 1, theta: -Math.PI * 0.2 }, 6000) + .easing(TWEEN.Easing.Quadratic.Out) + .onUpdate(function (n) { + sph.set(n.distance, n.phi, n.theta); + camera.position.setFromSpherical(sph).add(target); + camera.lookAt(target); + }) + .onComplete(function () { + controls.enabled = true; + controls.enableDamping = true; + }) + .start(); +} + +function postProcess(b) { + if (b) { + renderer.setEffects([taaPass, bloomPass]); + } else { + renderer.setEffects(null); + } +} + +function createGUI() { + gui = new GUI(); + gui.add(setting, 'roughness', 0, 1, 0.01).onChange(upMaterial); + gui.add(setting, 'metalness', 0, 1, 0.01).onChange(upMaterial); + gui.add(setting, 'opacity', 0, 1, 0.01).onChange(upMaterial); + + // + + gui.add(setting, 'postProcess').onChange(postProcess); + gui.add(setting, 'threshold', 0, 1, 0.01).onChange(upBloom); + gui.add(setting, 'strength', 0, 0.1, 0.001).onChange(upBloom); + gui.add(setting, 'radius', 0, 1, 0.01).onChange(upBloom); +} + +function upMaterial() { + materials.Gold.metalness = materials.Silver.metalness = setting.metalness; + materials.Gold.roughness = materials.Silver.roughness = setting.roughness; + meshes.glass.material.opacity = setting.opacity; +} + +function upBloom() { + if (!bloomPass) return; + bloomPass.threshold = setting.threshold; + bloomPass.strength = setting.strength; + bloomPass.radius = setting.radius; +} + +function getTime() { + const currentDate = new Date(); + let hour = currentDate.getHours(); + const minute = currentDate.getMinutes(); + const second = currentDate.getSeconds(); + let day = currentDate.getDay(); + const month = currentDate.getMonth(); + const milli = currentDate.getMilliseconds(); + if (hour >= 12) hour -= 12; + if (day > 30) day = 30; + + meshes.hour.rotation.y = -hour * 30 * torad; + meshes.minute.rotation.y = -minute * 6 * torad; + meshes.second.rotation.y = -second * 6 * torad; + meshes.mini_03.rotation.y = -day * 12 * torad; + meshes.mini_02.rotation.y = -month * 30 * torad; + meshes.mini_01.rotation.y = -milli * 0.36 * torad; +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + renderer.setSize(width, height); +} + +// + +function animate() { + controls.update(); + + TWEEN.update(); + + renderer.render(scene, camera); + + if (ready) getTime(); +} diff --git a/examples-testing/examples/webgpu_animation_retargeting.ts b/examples-testing/examples/webgpu_animation_retargeting.ts new file mode 100644 index 000000000..23ebb2af4 --- /dev/null +++ b/examples-testing/examples/webgpu_animation_retargeting.ts @@ -0,0 +1,295 @@ +import * as THREE from 'three/webgpu'; +import { + color, + screenUV, + hue, + reflector, + time, + Fn, + vec2, + length, + atan, + float, + sin, + cos, + vec3, + sub, + mul, + pow, + blendDodge, + normalWorldGeometry, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; + +const [sourceModel, targetModel] = await Promise.all([ + new Promise((resolve, reject) => { + new GLTFLoader().load('./models/gltf/Michelle.glb', resolve, undefined, reject); + }), + + new Promise((resolve, reject) => { + new GLTFLoader().load('./models/gltf/Soldier.glb', resolve, undefined, reject); + }), +]); + +// + +const timer = new THREE.Timer(); +timer.connect(document); + +export const lightSpeed = /*#__PURE__*/ Fn(([suv_immutable]) => { + // forked from https://www.shadertoy.com/view/7ly3D1 + + const suv = vec2(suv_immutable); + const uv = vec2(length(suv), atan(suv.y, suv.x)); + const offset = float( + float(0.1) + .mul(sin(uv.y.mul(10).sub(time.mul(0.6)))) + .mul(cos(uv.y.mul(48).add(time.mul(0.3)))) + .mul(cos(uv.y.mul(3.7).add(time))), + ); + const rays = vec3( + vec3(sin(uv.y.mul(150).add(time)).mul(0.5).add(0.5)) + .mul( + vec3( + sin(uv.y.mul(80).sub(time.mul(0.6))) + .mul(0.5) + .add(0.5), + ), + ) + .mul( + vec3( + sin(uv.y.mul(45).add(time.mul(0.8))) + .mul(0.5) + .add(0.5), + ), + ) + .mul(vec3(sub(1, cos(uv.y.add(mul(22, time).sub(pow(uv.x.add(offset), 0.3).mul(60))))))) + .mul(vec3(uv.x.mul(2))), + ); + + return rays; +}).setLayout({ + name: 'lightSpeed', + type: 'vec3', + inputs: [{ name: 'suv', type: 'vec2' }], +}); + +// scene + +const scene = new THREE.Scene(); + +// background + +const coloredVignette = screenUV + .distance(0.5) + .mix(hue(color(0x0175ad), time.mul(0.1)), hue(color(0x02274f), time.mul(0.5))); +const lightSpeedEffect = lightSpeed(normalWorldGeometry).clamp(); +const lightSpeedSky = normalWorldGeometry.y.remapClamp(-0.1, 1).mix(0, lightSpeedEffect); +const composedBackground = blendDodge(coloredVignette, lightSpeedSky); + +scene.backgroundNode = composedBackground; + +// + +const helpers = new THREE.Group(); +helpers.visible = false; +scene.add(helpers); + +const light = new THREE.HemisphereLight(0xe9c0a5, 0x0175ad, 5); +scene.add(light); + +const dirLight = new THREE.DirectionalLight(0xfff9ea, 4); +dirLight.position.set(2, 5, 2); +scene.add(dirLight); + +const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.25, 50); +camera.position.set(0, 1, 4); + +// add models to scene +scene.add(sourceModel.scene); +scene.add(targetModel.scene); + +// reposition models +sourceModel.scene.position.x -= 0.8; +targetModel.scene.position.x += 0.7; + +targetModel.scene.position.z -= 0.1; + +// reajust model +targetModel.scene.scale.setScalar(0.01); + +// flip model +sourceModel.scene.rotation.y = Math.PI / 2; +targetModel.scene.rotation.y = -Math.PI / 2; + +// retarget +const source = getSource(sourceModel); +const mixer = retargetModel(source, targetModel); + +// floor +const reflection = reflector(); +reflection.target.rotateX(-Math.PI / 2); +scene.add(reflection.target); + +const floorMaterial = new THREE.NodeMaterial(); +floorMaterial.colorNode = reflection; +floorMaterial.opacity = 0.2; +floorMaterial.transparent = true; + +const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); +floor.receiveShadow = true; + +floor.position.set(0, 0, 0); +scene.add(floor); + +// renderer +const renderer = new THREE.WebGPURenderer({ antialias: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setAnimationLoop(animate); +renderer.toneMapping = THREE.NeutralToneMapping; +renderer.inspector = new Inspector(); +document.body.appendChild(renderer.domElement); + +const controls = new OrbitControls(camera, renderer.domElement); +controls.minDistance = 3; +controls.maxDistance = 12; +controls.target.set(0, 1, 0); +controls.maxPolarAngle = Math.PI / 2; + +const gui = renderer.inspector.createParameters('Scene settings'); +gui.add(helpers, 'visible').name('show helpers'); + +// + +function getSource(sourceModel) { + const clip = sourceModel.animations[0]; + + const helper = new THREE.SkeletonHelper(sourceModel.scene); + helpers.add(helper); + + const skeleton = new THREE.Skeleton(helper.bones); + + const mixer = new THREE.AnimationMixer(sourceModel.scene); + mixer.clipAction(sourceModel.animations[0]).play(); + + return { clip, skeleton, mixer }; +} + +function retargetModel(sourceModel, targetModel) { + const targetSkin = targetModel.scene.children[0].children[0]; + + const targetSkelHelper = new THREE.SkeletonHelper(targetModel.scene); + helpers.add(targetSkelHelper); + + const rotateCW45 = new THREE.Matrix4().makeRotationY(THREE.MathUtils.degToRad(45)); + const rotateCCW180 = new THREE.Matrix4().makeRotationY(THREE.MathUtils.degToRad(-180)); + const rotateCW180 = new THREE.Matrix4().makeRotationY(THREE.MathUtils.degToRad(180)); + const rotateFoot = new THREE.Matrix4().makeRotationFromEuler( + new THREE.Euler(THREE.MathUtils.degToRad(45), THREE.MathUtils.degToRad(180), THREE.MathUtils.degToRad(0)), + ); + + const retargetOptions = { + // specify the name of the source's hip bone. + hip: 'mixamorigHips', + + // specify the influence of the source's hip bone. + // use ( 0, 1, 0 ) to ignore xz hip movement. + //hipInfluence: new THREE.Vector3( 0, 1, 0 ), + + // specify an animation range in seconds. + //trim: [ 3.0, 4.0 ], + + // preserve the scale of the target model + scale: 1 / targetModel.scene.scale.y, + + // offset target bones -> { targetBoneName: offsetMatrix } + localOffsets: { + mixamorigLeftShoulder: rotateCW45, + mixamorigRightShoulder: rotateCCW180, + mixamorigLeftArm: rotateCW45, + mixamorigRightArm: rotateCCW180, + mixamorigLeftForeArm: rotateCW45, + mixamorigRightForeArm: rotateCCW180, + mixamorigLeftHand: rotateCW45, + mixamorigRightHand: rotateCCW180, + + mixamorigLeftUpLeg: rotateCW180, + mixamorigRightUpLeg: rotateCW180, + mixamorigLeftLeg: rotateCW180, + mixamorigRightLeg: rotateCW180, + mixamorigLeftFoot: rotateFoot, + mixamorigRightFoot: rotateFoot, + mixamorigLeftToeBase: rotateCW180, + mixamorigRightToeBase: rotateCW180, + }, + + // Map of target's bone names to source's bone names -> { targetBoneName: sourceBoneName } + names: { + mixamorigHips: 'mixamorigHips', + + mixamorigSpine: 'mixamorigSpine', + mixamorigSpine2: 'mixamorigSpine2', + mixamorigHead: 'mixamorigHead', + + mixamorigLeftShoulder: 'mixamorigLeftShoulder', + mixamorigRightShoulder: 'mixamorigRightShoulder', + mixamorigLeftArm: 'mixamorigLeftArm', + mixamorigRightArm: 'mixamorigRightArm', + mixamorigLeftForeArm: 'mixamorigLeftForeArm', + mixamorigRightForeArm: 'mixamorigRightForeArm', + mixamorigLeftHand: 'mixamorigLeftHand', + mixamorigRightHand: 'mixamorigRightHand', + + mixamorigLeftUpLeg: 'mixamorigLeftUpLeg', + mixamorigRightUpLeg: 'mixamorigRightUpLeg', + mixamorigLeftLeg: 'mixamorigLeftLeg', + mixamorigRightLeg: 'mixamorigRightLeg', + mixamorigLeftFoot: 'mixamorigLeftFoot', + mixamorigRightFoot: 'mixamorigRightFoot', + mixamorigLeftToeBase: 'mixamorigLeftToeBase', + mixamorigRightToeBase: 'mixamorigRightToeBase', + }, + }; + + const retargetedClip = SkeletonUtils.retargetClip( + targetSkin, + sourceModel.skeleton, + sourceModel.clip, + retargetOptions, + ); + + // Apply the mixer directly to the SkinnedMesh, not any + // ancestor node, because that's what + // SkeletonUtils.retargetClip outputs the clip to be + // compatible with. + const mixer = new THREE.AnimationMixer(targetSkin); + mixer.clipAction(retargetedClip).play(); + + return mixer; +} + +window.onresize = function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +}; + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + source.mixer.update(delta); + mixer.update(delta); + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts b/examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts new file mode 100644 index 000000000..de90d890f --- /dev/null +++ b/examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three/webgpu'; +import { screenUV, color, vec2, vec4, reflector, positionWorld } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; + +const [sourceModel, targetModel] = await Promise.all([ + new Promise((resolve, reject) => { + new FBXLoader().load('./models/fbx/mixamo.fbx', resolve, undefined, reject); + }), + + new Promise((resolve, reject) => { + new GLTFLoader().load('./models/gltf/readyplayer.me.glb', resolve, undefined, reject); + }), +]); + +// + +const timer = new THREE.Timer(); +timer.connect(document); + +// scene + +const scene = new THREE.Scene(); + +// background + +const horizontalEffect = screenUV.x.mix(color(0x13172b), color(0x311649)); +const lightEffect = screenUV.distance(vec2(0.5, 1.0)).oneMinus().mul(color(0x0c5d68)); + +scene.backgroundNode = horizontalEffect.add(lightEffect); + +// + +const light = new THREE.HemisphereLight(0x311649, 0x0c5d68, 10); +scene.add(light); + +const backLight = new THREE.DirectionalLight(0xffffff, 10); +backLight.position.set(0, 5, -5); +scene.add(backLight); + +const keyLight = new THREE.DirectionalLight(0xfff9ea, 4); +keyLight.position.set(3, 5, 3); +scene.add(keyLight); + +const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.25, 50); +camera.position.set(0, 3, 5); + +// add models to scene +scene.add(sourceModel); +scene.add(targetModel.scene); + +// reposition models +sourceModel.position.x -= 0.9; +targetModel.scene.position.x += 0.9; + +// reajust model - mixamo use centimeters, readyplayer.me use meters (three.js scale is meters) +sourceModel.scale.setScalar(0.01); + +// retarget +const source = getSource(sourceModel); +const mixer = retargetModel(source, targetModel); + +// renderer +const renderer = new THREE.WebGPURenderer({ antialias: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setAnimationLoop(animate); +renderer.inspector = new Inspector(); +renderer.toneMapping = THREE.NeutralToneMapping; +document.body.appendChild(renderer.domElement); + +const controls = new OrbitControls(camera, renderer.domElement); +controls.minDistance = 3; +controls.maxDistance = 12; +controls.target.set(0, 1, 0); +controls.maxPolarAngle = Math.PI / 2; + +// floor +const reflection = reflector(); +reflection.target.rotateX(-Math.PI / 2); +scene.add(reflection.target); + +const reflectionMask = positionWorld.xz.distance(0).mul(0.1).clamp().oneMinus(); + +const floorMaterial = new THREE.NodeMaterial(); +floorMaterial.colorNode = vec4(reflection.rgb, reflectionMask); +floorMaterial.opacity = 0.2; +floorMaterial.transparent = true; + +const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); +floor.receiveShadow = true; + +floor.position.set(0, 0, 0); +scene.add(floor); + +// + +function getSource(sourceModel) { + const clip = sourceModel.animations[0]; + + const helper = new THREE.SkeletonHelper(sourceModel); + const skeleton = new THREE.Skeleton(helper.bones); + + const mixer = new THREE.AnimationMixer(sourceModel); + mixer.clipAction(sourceModel.animations[0]).play(); + + return { clip, skeleton, mixer }; +} + +function retargetModel(sourceModel, targetModel) { + const targetSkin = targetModel.scene.children[0].children[1]; + + const retargetOptions = { + // specify the name of the source's hip bone. + hip: 'mixamorigHips', + + // preserve the scale of the target model + scale: 0.01, + + // use ( 0, 1, 0 ) to ignore xz hip movement. + //hipInfluence: new THREE.Vector3( 0, 1, 0 ), + + // Map of target's bone names to source's bone names -> { targetBoneName: sourceBoneName } + getBoneName: function (bone) { + return 'mixamorig' + bone.name; + }, + }; + + const retargetedClip = SkeletonUtils.retargetClip( + targetSkin, + sourceModel.skeleton, + sourceModel.clip, + retargetOptions, + ); + + const mixer = new THREE.AnimationMixer(targetSkin); + mixer.clipAction(retargetedClip).play(); + + return mixer; +} + +window.onresize = function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +}; + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + source.mixer.update(delta); + mixer.update(delta); + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_backdrop.ts b/examples-testing/examples/webgpu_backdrop.ts new file mode 100644 index 000000000..af6dcc399 --- /dev/null +++ b/examples-testing/examples/webgpu_backdrop.ts @@ -0,0 +1,134 @@ +import * as THREE from 'three/webgpu'; +import { + float, + vec3, + color, + viewportSharedTexture, + hue, + blendOverlay, + posterize, + grayscale, + saturation, + viewportSafeUV, + screenUV, + checker, + uv, + time, + oscSine, + output, +} from 'three/tsl'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; +let portals, + rotate = true; +let mixer, timer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.set(1, 2, 3); + + scene = new THREE.Scene(); + scene.backgroundNode = screenUV.y.mix(color(0x66bbff), color(0x4466ff)); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + // lights + + const light = new THREE.SpotLight(0xffffff, 1); + light.power = 2000; + camera.add(light); + scene.add(camera); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Michelle.glb', function (gltf) { + const object = gltf.scene; + mixer = new THREE.AnimationMixer(object); + + const material = object.children[0].children[0].material; + material.outputNode = oscSine(time.mul(0.1)).mix(output, posterize(output.add(0.1), 4).mul(2)); + + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + scene.add(object); + }); + + // portals + + const geometry = new THREE.SphereGeometry(0.3, 32, 16); + + portals = new THREE.Group(); + scene.add(portals); + + function addBackdropSphere(backdropNode, backdropAlphaNode = null) { + const distance = 1; + const id = portals.children.length; + const rotation = THREE.MathUtils.degToRad(id * 45); + + const material = new THREE.MeshStandardNodeMaterial({ color: 0x0066ff }); + material.roughnessNode = float(0.2); + material.metalnessNode = float(0); + material.backdropNode = backdropNode; + material.backdropAlphaNode = backdropAlphaNode; + material.transparent = true; + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(Math.cos(rotation) * distance, 1, Math.sin(rotation) * distance); + + portals.add(mesh); + } + + addBackdropSphere(hue(viewportSharedTexture().bgr, oscSine().mul(Math.PI))); + addBackdropSphere(viewportSharedTexture().rgb.oneMinus()); + addBackdropSphere(grayscale(viewportSharedTexture().rgb)); + addBackdropSphere(saturation(viewportSharedTexture().rgb, 10), oscSine()); + addBackdropSphere(blendOverlay(viewportSharedTexture().rgb, checker(uv().mul(10)))); + addBackdropSphere(viewportSharedTexture(viewportSafeUV(screenUV.mul(40).floor().div(40)))); + addBackdropSphere(viewportSharedTexture(viewportSafeUV(screenUV.mul(80).floor().div(80))).add(color(0x0033ff))); + addBackdropSphere(vec3(0, 0, viewportSharedTexture().b)); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: false }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 0.3; + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1, 0); + controls.addEventListener('start', () => (rotate = false)); + controls.addEventListener('end', () => (rotate = true)); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + if (rotate) portals.rotation.y += delta * 0.5; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_backdrop_area.ts b/examples-testing/examples/webgpu_backdrop_area.ts new file mode 100644 index 000000000..6aa3e9275 --- /dev/null +++ b/examples-testing/examples/webgpu_backdrop_area.ts @@ -0,0 +1,157 @@ +import * as THREE from 'three/webgpu'; +import { + color, + positionWorld, + linearDepth, + viewportLinearDepth, + viewportSharedTexture, + screenUV, + hue, + time, + checker, + uv, + modelScale, +} from 'three/tsl'; +import { hashBlur } from 'three/addons/tsl/display/hashBlur.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; +let mixer, timer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 25); + camera.position.set(3, 2, 3); + + scene = new THREE.Scene(); + scene.backgroundNode = hue(screenUV.y.mix(color(0x66bbff), color(0x4466ff)), time.mul(0.1)); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + const ambient = new THREE.AmbientLight(0xffffff, 2.5); + scene.add(ambient); + + // model + + const loader = new GLTFLoader(); + loader.load('models/gltf/Michelle.glb', function (gltf) { + const object = gltf.scene; + mixer = new THREE.AnimationMixer(object); + + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + scene.add(object); + }); + + // volume + + // compare depth from viewportLinearDepth with linearDepth() to create a distance field + // viewportLinearDepth return the linear depth of the scene + // linearDepth() returns the linear depth of the mesh + const depthDistance = viewportLinearDepth.distance(linearDepth()); + + const depthAlphaNode = depthDistance.oneMinus().smoothstep(0.9, 2).mul(10).saturate(); + const depthBlurred = hashBlur(viewportSharedTexture(), depthDistance.smoothstep(0, 0.6).mul(40).clamp().mul(0.1)); + + const blurredBlur = new THREE.MeshBasicNodeMaterial(); + blurredBlur.backdropNode = depthBlurred.add(depthAlphaNode.mix(color(0x003399).mul(0.3), 0)); + blurredBlur.transparent = true; + blurredBlur.side = THREE.DoubleSide; + + const depthMaterial = new THREE.MeshBasicNodeMaterial(); + depthMaterial.backdropNode = depthAlphaNode; + depthMaterial.transparent = true; + depthMaterial.side = THREE.DoubleSide; + + const checkerMaterial = new THREE.MeshBasicNodeMaterial(); + checkerMaterial.backdropNode = hashBlur(viewportSharedTexture(), 0.05); + checkerMaterial.backdropAlphaNode = checker(uv().mul(3).mul(modelScale.xy)); + checkerMaterial.opacityNode = checkerMaterial.backdropAlphaNode; + checkerMaterial.transparent = true; + checkerMaterial.side = THREE.DoubleSide; + + const pixelMaterial = new THREE.MeshBasicNodeMaterial(); + pixelMaterial.backdropNode = viewportSharedTexture(screenUV.mul(100).floor().div(100)); + pixelMaterial.transparent = true; + + // box / floor + + const box = new THREE.Mesh(new THREE.BoxGeometry(2, 2, 2), blurredBlur); + box.position.set(0, 1, 0); + box.renderOrder = 1; + scene.add(box); + + const floor = new THREE.Mesh( + new THREE.BoxGeometry(5, 0.01, 5), + new THREE.MeshBasicNodeMaterial({ + color: 0xff6600, + opacityNode: positionWorld.xz.distance(0).oneMinus().clamp(), + transparent: true, + depthWrite: false, + }), + ); + floor.position.set(0, 0, 0); + scene.add(floor); + + // renderer + + renderer = new THREE.WebGPURenderer(/*{ antialias: true }*/); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 0.9; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); + + // gui + + const materials = { + blurred: blurredBlur, + checker: checkerMaterial, + depth: depthMaterial, + pixel: pixelMaterial, + }; + + const options = { material: 'checker' }; + box.material = materials[options.material]; + + const gui = renderer.inspector.createParameters('Scene settings'); + gui.add(box.scale, 'x', 0.1, 2, 0.01).name('box scale x'); + gui.add(box.scale, 'y', 0.1, 2, 0.01).name('box scale y'); + gui.add(options, 'material', Object.keys(materials)).onChange(name => { + box.material = materials[name]; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_backdrop_water.ts b/examples-testing/examples/webgpu_backdrop_water.ts new file mode 100644 index 000000000..e9f17b575 --- /dev/null +++ b/examples-testing/examples/webgpu_backdrop_water.ts @@ -0,0 +1,261 @@ +import * as THREE from 'three/webgpu'; +import { + color, + vec2, + pass, + linearDepth, + normalWorld, + triplanarTexture, + texture, + objectPosition, + screenUV, + viewportLinearDepth, + viewportDepthTexture, + viewportSharedTexture, + positionWorld, + time, +} from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; +import { voronoi2d, voronoi3d } from 'three/addons/tsl/math/voronoiNoise.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; +let mixer, objects, timer; +let model, floor, floorPosition; +let renderPipeline; +let controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); + camera.position.set(3, 2, 4); + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x0487e2, 7, 25); + scene.backgroundNode = normalWorld.y.mix(color(0x0487e2), color(0x0066ff)); + camera.lookAt(0, 1, 0); + + const sunLight = new THREE.DirectionalLight(0xffe499, 5); + sunLight.position.set(0.5, 3, 0.5); + sunLight.castShadow = true; + sunLight.shadow.mapSize.width = 512; + sunLight.shadow.mapSize.height = 512; + sunLight.shadow.camera.near = 0.5; + sunLight.shadow.camera.far = 15; + sunLight.shadow.camera.left = -1.5; + sunLight.shadow.camera.right = 1.5; + sunLight.shadow.camera.top = 1.5; + sunLight.shadow.camera.bottom = -1.5; + sunLight.shadow.bias = -0.001; + + const waterAmbientLight = new THREE.HemisphereLight(0x333366, 0x74ccf4, 5); + const skyAmbientLight = new THREE.HemisphereLight(0x74ccf4, 0, 1); + + scene.add(sunLight); + scene.add(skyAmbientLight); + scene.add(waterAmbientLight); + + timer = new THREE.Timer(); + timer.connect(document); + + // animated model + + const loader = new GLTFLoader(); + loader.load('models/gltf/Michelle.glb', function (gltf) { + model = gltf.scene; + model.traverse(child => { + if (child.isMesh) { + child.castShadow = true; + child.receiveShadow = true; + } + }); + + mixer = new THREE.AnimationMixer(model); + + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + scene.add(model); + }); + + // objects + + const textureLoader = new THREE.TextureLoader(); + const iceDiffuse = textureLoader.load('./textures/water.jpg'); + iceDiffuse.wrapS = THREE.RepeatWrapping; + iceDiffuse.wrapT = THREE.RepeatWrapping; + iceDiffuse.colorSpace = THREE.NoColorSpace; + + const iceColorNode = triplanarTexture(texture(iceDiffuse)).add(color(0x0066ff)).mul(0.8); + + const geometry = new THREE.IcosahedronGeometry(1, 3); + const material = new THREE.MeshStandardNodeMaterial({ colorNode: iceColorNode }); + + const count = 100; + const scale = 3.5; + const column = 10; + + objects = new THREE.Group(); + + for (let i = 0; i < count; i++) { + const x = i % column; + const y = i / column; + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(x * scale, 0, y * scale); + mesh.rotation.set(Math.random(), Math.random(), Math.random()); + objects.add(mesh); + } + + objects.position.set((column - 1) * scale * -0.5, -1, (count / column) * scale * -0.5); + + scene.add(objects); + + // water + + const t = time.mul(0.8); + const floorUV = positionWorld.xz; + + const waterLayer0 = voronoi2d(floorUV.mul(6), t); + const waterLayer1 = voronoi2d(floorUV.mul(3), t); + + const waterIntensity = waterLayer0.mul(waterLayer1); + const waterColor = waterIntensity.mul(1.4).mix(color(0x0487e2), color(0x74ccf4)); + + // linearDepth() returns the linear depth of the mesh + const depth = linearDepth(); + const depthWater = viewportLinearDepth.sub(depth).toInspector('Water / Depth', node => node.oneMinus()); + const depthEffect = depthWater.remapClamp(-0.002, 0.04); + + const refractionUV = screenUV.add(vec2(0, waterIntensity.mul(0.1))).toInspector('Water / Refraction UV'); + + // linearDepth( viewportDepthTexture( uv ) ) return the linear depth of the scene + const depthTestForRefraction = linearDepth(viewportDepthTexture(refractionUV)).sub(depth); + + const depthRefraction = depthTestForRefraction.remapClamp(0, 0.1); + + const finalUV = depthTestForRefraction.lessThan(0).select(screenUV, refractionUV); + + const viewportTexture = viewportSharedTexture(finalUV).toInspector('Water / Viewport Texture + Refraction UV'); + + const waterMaterial = new THREE.MeshBasicNodeMaterial(); + waterMaterial.colorNode = waterColor.toInspector('Water / Color'); + waterMaterial.backdropNode = depthEffect + .mix(viewportSharedTexture(), viewportTexture.mul(depthRefraction.mix(1, waterColor))) + .mul(color(0xd3ebf8)); + waterMaterial.backdropAlphaNode = depthRefraction.oneMinus(); + waterMaterial.transparent = true; + + const water = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), waterMaterial); + water.position.set(0, 0, 0); + scene.add(water); + + // floor + + floor = new THREE.Mesh( + new THREE.CylinderGeometry(1.1, 1.1, 10), + new THREE.MeshStandardNodeMaterial({ colorNode: iceColorNode }), + ); + floor.position.set(0, -5, 0); + floor.receiveShadow = true; + scene.add(floor); + + // caustics + + const causticFade = normalWorld.y.mix(positionWorld.y.distance(0).oneMinus().saturate(), 0); + + const causticNoise = voronoi3d(positionWorld.mul(6), t); + + //material.colorNode = colorNode; + floor.material.colorNode = causticFade.mix(material.colorNode, material.colorNode.add(causticNoise)); + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 10; + controls.maxPolarAngle = Math.PI * 0.9; + controls.autoRotate = true; + controls.autoRotateSpeed = 1; + controls.target.set(0, 0.2, 0); + controls.update(); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + + floorPosition = new THREE.Vector3(0, 0.2, 0); + + gui.add(floorPosition, 'y', -1, 1, 0.001).name('floor position'); + + // post processing + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode(); + const scenePassDepth = scenePass.getLinearDepthNode().remapClamp(0.3, 0.5); + + const waterMask = objectPosition(camera) + .y.greaterThan(screenUV.y.sub(0.5).mul(camera.near)) + .toInspector('Post-Processing / Water Mask'); + + const scenePassColorBlurred = gaussianBlur(scenePassColor); + scenePassColorBlurred.directionNode = waterMask + .select(scenePassDepth, scenePass.getLinearDepthNode().mul(5)) + .toInspector('Post-Processing / Blur Strength [ Depth ]', node => node.toFloat()); + + const vignette = screenUV.distance(0.5).mul(1.35).clamp().oneMinus().toInspector('Post-Processing / Vignette'); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = waterMask.select( + scenePassColorBlurred, + scenePassColorBlurred.mul(color(0x74ccf4)).mul(vignette), + ); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + controls.update(); + + const delta = timer.getDelta(); + + floor.position.y = floorPosition.y - 5; + + if (model) { + mixer.update(delta); + + model.position.y = floorPosition.y; + } + + for (const object of objects.children) { + object.position.y = Math.sin(timer.getElapsed() + object.id) * 0.3; + object.rotation.y += delta * 0.3; + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_camera.ts b/examples-testing/examples/webgpu_camera.ts new file mode 100644 index 000000000..bf4724ac8 --- /dev/null +++ b/examples-testing/examples/webgpu_camera.ts @@ -0,0 +1,211 @@ +import * as THREE from 'three/webgpu'; + +let SCREEN_WIDTH = window.innerWidth; +let SCREEN_HEIGHT = window.innerHeight; +let aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + +let container; +let camera, scene, renderer, mesh; +let cameraRig, activeCamera, activeHelper; +let cameraPerspective, cameraOrtho; +let cameraPerspectiveHelper, cameraOrthoHelper; +const frustumSize = 600; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + + // + + camera = new THREE.PerspectiveCamera(50, 0.5 * aspect, 1, 10000); + camera.position.z = 2500; + + cameraPerspective = new THREE.PerspectiveCamera(50, 0.5 * aspect, 150, 1000); + + cameraPerspectiveHelper = new THREE.CameraHelper(cameraPerspective); + scene.add(cameraPerspectiveHelper); + + // + cameraOrtho = new THREE.OrthographicCamera( + (0.5 * frustumSize * aspect) / -2, + (0.5 * frustumSize * aspect) / 2, + frustumSize / 2, + frustumSize / -2, + 150, + 1000, + ); + + cameraOrthoHelper = new THREE.CameraHelper(cameraOrtho); + scene.add(cameraOrthoHelper); + + // + + activeCamera = cameraPerspective; + activeHelper = cameraPerspectiveHelper; + + // counteract different front orientation of cameras vs rig + + cameraOrtho.rotation.y = Math.PI; + cameraPerspective.rotation.y = Math.PI; + + cameraRig = new THREE.Group(); + + cameraRig.add(cameraPerspective); + cameraRig.add(cameraOrtho); + + scene.add(cameraRig); + + // + + mesh = new THREE.Mesh( + new THREE.SphereGeometry(100, 16, 8), + new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }), + ); + scene.add(mesh); + + const mesh2 = new THREE.Mesh( + new THREE.SphereGeometry(50, 16, 8), + new THREE.MeshBasicMaterial({ color: 0x00ff00, wireframe: true }), + ); + mesh2.position.y = 150; + mesh.add(mesh2); + + const mesh3 = new THREE.Mesh( + new THREE.SphereGeometry(5, 16, 8), + new THREE.MeshBasicMaterial({ color: 0x0000ff, wireframe: true }), + ); + mesh3.position.z = 150; + cameraRig.add(mesh3); + + // + + const geometry = new THREE.BufferGeometry(); + const vertices = []; + + for (let i = 0; i < 10000; i++) { + vertices.push(THREE.MathUtils.randFloatSpread(2000)); // x + vertices.push(THREE.MathUtils.randFloatSpread(2000)); // y + vertices.push(THREE.MathUtils.randFloatSpread(2000)); // z + } + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + + const particles = new THREE.Points(geometry, new THREE.PointsMaterial({ color: 0xffffff })); + scene.add(particles); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + renderer.setScissorTest(true); + renderer.setClearColor(0x000000, 1); + + // + + window.addEventListener('resize', onWindowResize); + document.addEventListener('keydown', onKeyDown); +} + +// + +function onKeyDown(event) { + switch (event.keyCode) { + case 79 /*O*/: + activeCamera = cameraOrtho; + activeHelper = cameraOrthoHelper; + + break; + + case 80 /*P*/: + activeCamera = cameraPerspective; + activeHelper = cameraPerspectiveHelper; + + break; + } +} + +// + +function onWindowResize() { + SCREEN_WIDTH = window.innerWidth; + SCREEN_HEIGHT = window.innerHeight; + aspect = SCREEN_WIDTH / SCREEN_HEIGHT; + + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + + camera.aspect = 0.5 * aspect; + camera.updateProjectionMatrix(); + + cameraPerspective.aspect = 0.5 * aspect; + cameraPerspective.updateProjectionMatrix(); + + cameraOrtho.left = (-0.5 * frustumSize * aspect) / 2; + cameraOrtho.right = (0.5 * frustumSize * aspect) / 2; + cameraOrtho.top = frustumSize / 2; + cameraOrtho.bottom = -frustumSize / 2; + cameraOrtho.updateProjectionMatrix(); +} + +// + +function animate() { + render(); +} + +function render() { + const r = Date.now() * 0.0005; + + mesh.position.x = 700 * Math.cos(r); + mesh.position.z = 700 * Math.sin(r); + mesh.position.y = 700 * Math.sin(r); + + mesh.children[0].position.x = 70 * Math.cos(2 * r); + mesh.children[0].position.z = 70 * Math.sin(r); + + if (activeCamera === cameraPerspective) { + cameraPerspective.fov = 35 + 30 * Math.sin(0.5 * r); + cameraPerspective.far = mesh.position.length(); + cameraPerspective.updateProjectionMatrix(); + + cameraPerspectiveHelper.update(); + cameraPerspectiveHelper.visible = true; + + cameraOrthoHelper.visible = false; + } else { + cameraOrtho.far = mesh.position.length(); + cameraOrtho.updateProjectionMatrix(); + + cameraOrthoHelper.update(); + cameraOrthoHelper.visible = true; + + cameraPerspectiveHelper.visible = false; + } + + cameraRig.lookAt(mesh.position); + + // + + activeHelper.visible = false; + + renderer.setClearColor(0x000000, 1); + renderer.setScissor(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.setViewport(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.render(scene, activeCamera); + + // + + activeHelper.visible = true; + + renderer.setClearColor(0x111111, 1); + renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.setViewport(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_camera_array.ts b/examples-testing/examples/webgpu_camera_array.ts new file mode 100644 index 000000000..a4d82a709 --- /dev/null +++ b/examples-testing/examples/webgpu_camera_array.ts @@ -0,0 +1,101 @@ +import * as THREE from 'three/webgpu'; + +let camera, scene, renderer; +let mesh; + +const AMOUNT = 6; + +init(); + +function init() { + const subCameras = []; + + for (let i = 0; i < AMOUNT * AMOUNT; i++) { + const subCamera = new THREE.PerspectiveCamera(40, 1, 0.1, 10); + subCamera.viewport = new THREE.Vector4(); + + subCameras.push(subCamera); + } + + camera = new THREE.ArrayCamera(subCameras); + camera.position.z = 3; + + updateCameras(); + + scene = new THREE.Scene(); + + scene.add(new THREE.AmbientLight(0x999999)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0.5, 0.5, 1); + light.castShadow = true; + light.shadow.camera.zoom = 4; // tighter shadow map + scene.add(light); + + const geometryBackground = new THREE.PlaneGeometry(100, 100); + const materialBackground = new THREE.MeshPhongMaterial({ color: 0x000066 }); + + const background = new THREE.Mesh(geometryBackground, materialBackground); + background.receiveShadow = true; + background.position.set(0, 0, -1); + scene.add(background); + + const geometryCylinder = new THREE.CylinderGeometry(0.5, 0.5, 1, 32); + const materialCylinder = new THREE.MeshPhongMaterial({ color: 0xff0000 }); + + mesh = new THREE.Mesh(geometryCylinder, materialCylinder); + mesh.castShadow = true; + mesh.receiveShadow = true; + scene.add(mesh); + + renderer = new THREE.WebGPURenderer(/*{ forceWebGL: true }*/); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function updateCameras() { + const ASPECT_RATIO = window.innerWidth / window.innerHeight; + const WIDTH = window.innerWidth / AMOUNT; + const HEIGHT = window.innerHeight / AMOUNT; + + camera.aspect = ASPECT_RATIO; + camera.updateProjectionMatrix(); + + for (let y = 0; y < AMOUNT; y++) { + for (let x = 0; x < AMOUNT; x++) { + const subcamera = camera.cameras[AMOUNT * y + x]; + subcamera.copy(camera); // copy fov, aspect ratio, near, far from the root camera + + subcamera.viewport.set(Math.floor(x * WIDTH), Math.floor(y * HEIGHT), Math.ceil(WIDTH), Math.ceil(HEIGHT)); + subcamera.updateProjectionMatrix(); + + subcamera.position.x = x / AMOUNT - 0.5; + subcamera.position.y = 0.5 - y / AMOUNT; + subcamera.position.z = 1.5 + (x + y) * 0.5; + subcamera.position.multiplyScalar(2); + + subcamera.lookAt(0, 0, 0); + subcamera.updateMatrixWorld(); + } + } +} + +function onWindowResize() { + updateCameras(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.rotation.x += 0.005; + mesh.rotation.z += 0.01; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts b/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts new file mode 100644 index 000000000..24eff6c1e --- /dev/null +++ b/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts @@ -0,0 +1,240 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +// 1 micrometer to 100 billion light years in one scene, with 1 unit = 1 meter? preposterous! and yet... +const NEAR = 1e-6, + FAR = 1e27; +let SCREEN_WIDTH = window.innerWidth; +let SCREEN_HEIGHT = window.innerHeight; +let screensplit = 0.25, + screensplit_right = 0; +const mouse = [0.5, 0.5]; +let zoompos = -100, + minzoomspeed = 0.015; +let zoomspeed = minzoomspeed; + +let border; +const objects = {}; + +// Generate a number of text labels, from 1µm in size up to 100,000,000 light years +// Try to use some descriptive real-world examples of objects at each scale + +const labeldata = [ + { size: 0.01, scale: 0.0001, label: 'microscopic (1µm)' }, // FIXME - triangulating text fails at this size, so we scale instead + { size: 0.01, scale: 0.1, label: 'minuscule (1mm)' }, + { size: 0.01, scale: 1.0, label: 'tiny (1cm)' }, + { size: 1, scale: 1.0, label: 'child-sized (1m)' }, + { size: 10, scale: 1.0, label: 'tree-sized (10m)' }, + { size: 100, scale: 1.0, label: 'building-sized (100m)' }, + { size: 1000, scale: 1.0, label: 'medium (1km)' }, + { size: 10000, scale: 1.0, label: 'city-sized (10km)' }, + { size: 3400000, scale: 1.0, label: 'moon-sized (3,400 Km)' }, + { size: 12000000, scale: 1.0, label: 'planet-sized (12,000 km)' }, + { size: 1400000000, scale: 1.0, label: 'sun-sized (1,400,000 km)' }, + { size: 7.47e12, scale: 1.0, label: 'solar system-sized (50Au)' }, + { size: 9.4605284e15, scale: 1.0, label: 'gargantuan (1 light year)' }, + { size: 3.08567758e16, scale: 1.0, label: 'ludicrous (1 parsec)' }, + { size: 1e19, scale: 1.0, label: 'mind boggling (1000 light years)' }, +]; + +init().then(animate); + +async function init() { + const loader = new FontLoader(); + const font = await loader.loadAsync('fonts/helvetiker_regular.typeface.json'); + + const scene = initScene(font); + + // Initialize two copies of the same scene, one with normal z-buffer and one with logarithmic z-buffer + objects.normal = await initView(scene, 'normal', false); + objects.logzbuf = await initView(scene, 'logzbuf', true); + + // Resize border allows the user to easily compare effects of logarithmic depth buffer over the whole scene + border = document.getElementById('renderer_border'); + border.addEventListener('pointerdown', onBorderPointerDown); + + window.addEventListener('mousemove', onMouseMove); + window.addEventListener('resize', onWindowResize); + window.addEventListener('wheel', onMouseWheel); +} + +async function initView(scene, name, logDepthBuf) { + const framecontainer = document.getElementById('container_' + name); + + const camera = new THREE.PerspectiveCamera(50, (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT, NEAR, FAR); + scene.add(camera); + + const renderer = new THREE.WebGPURenderer({ antialias: true, logarithmicDepthBuffer: logDepthBuf }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH / 2, SCREEN_HEIGHT); + renderer.domElement.style.position = 'relative'; + renderer.domElement.id = 'renderer_' + name; + renderer.inspector = new Inspector(); + framecontainer.appendChild(renderer.domElement); + + await renderer.init(); + + return { container: framecontainer, renderer: renderer, scene: scene, camera: camera }; +} + +function initScene(font) { + const scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + scene.add(new THREE.AmbientLight(0x777777)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(100, 100, 100); + scene.add(light); + + const materialargs = { + color: 0xffffff, + specular: 0x050505, + shininess: 50, + emissive: 0x000000, + }; + + const geometry = new THREE.SphereGeometry(0.5, 24, 12); + + for (let i = 0; i < labeldata.length; i++) { + const scale = labeldata[i].scale || 1; + + const labelgeo = new TextGeometry(labeldata[i].label, { + font: font, + size: labeldata[i].size, + depth: labeldata[i].size / 2, + }); + + labelgeo.computeBoundingSphere(); + + // center text + labelgeo.translate(-labelgeo.boundingSphere.radius, 0, 0); + + materialargs.color = new THREE.Color().setHSL(Math.random(), 0.5, 0.5); + + const material = new THREE.MeshPhongMaterial(materialargs); + + const group = new THREE.Group(); + group.position.z = -labeldata[i].size * scale; + scene.add(group); + + const textmesh = new THREE.Mesh(labelgeo, material); + textmesh.scale.set(scale, scale, scale); + textmesh.position.z = -labeldata[i].size * scale; + textmesh.position.y = (labeldata[i].size / 4) * scale; + group.add(textmesh); + + const dotmesh = new THREE.Mesh(geometry, material); + dotmesh.position.y = (-labeldata[i].size / 4) * scale; + dotmesh.scale.multiplyScalar(labeldata[i].size * scale); + group.add(dotmesh); + } + + return scene; +} + +function updateRendererSizes() { + // Recalculate size for both renderers when screen size or split location changes + + SCREEN_WIDTH = window.innerWidth; + SCREEN_HEIGHT = window.innerHeight; + + screensplit_right = 1 - screensplit; + + objects.normal.renderer.setSize(screensplit * SCREEN_WIDTH, SCREEN_HEIGHT); + objects.normal.camera.aspect = (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT; + objects.normal.camera.updateProjectionMatrix(); + objects.normal.camera.setViewOffset(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH * screensplit, SCREEN_HEIGHT); + objects.normal.container.style.width = screensplit * 100 + '%'; + + objects.logzbuf.renderer.setSize(screensplit_right * SCREEN_WIDTH, SCREEN_HEIGHT); + objects.logzbuf.camera.aspect = (screensplit_right * SCREEN_WIDTH) / SCREEN_HEIGHT; + objects.logzbuf.camera.updateProjectionMatrix(); + objects.logzbuf.camera.setViewOffset( + SCREEN_WIDTH, + SCREEN_HEIGHT, + SCREEN_WIDTH * screensplit, + 0, + SCREEN_WIDTH * screensplit_right, + SCREEN_HEIGHT, + ); + objects.logzbuf.container.style.width = screensplit_right * 100 + '%'; + + border.style.left = screensplit * 100 + '%'; +} + +function animate() { + requestAnimationFrame(animate); + + // Put some limits on zooming + const minzoom = labeldata[0].size * labeldata[0].scale * 1; + const maxzoom = labeldata[labeldata.length - 1].size * labeldata[labeldata.length - 1].scale * 100; + let damping = Math.abs(zoomspeed) > minzoomspeed ? 0.95 : 1.0; + + // Zoom out faster the further out you go + const zoom = THREE.MathUtils.clamp(Math.pow(Math.E, zoompos), minzoom, maxzoom); + zoompos = Math.log(zoom); + + // Slow down quickly at the zoom limits + if ((zoom == minzoom && zoomspeed < 0) || (zoom == maxzoom && zoomspeed > 0)) { + damping = 0.85; + } + + zoompos += zoomspeed; + zoomspeed *= damping; + + objects.normal.camera.position.x = Math.sin(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; + objects.normal.camera.position.y = Math.sin(0.25 * Math.PI * (mouse[1] - 0.5)) * zoom; + objects.normal.camera.position.z = Math.cos(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; + objects.normal.camera.lookAt(objects.normal.scene.position); + + // Clone camera settings across both scenes + objects.logzbuf.camera.position.copy(objects.normal.camera.position); + objects.logzbuf.camera.quaternion.copy(objects.normal.camera.quaternion); + + // Update renderer sizes if the split has changed + if (screensplit_right != 1 - screensplit) { + updateRendererSizes(); + } + + objects.normal.renderer.render(objects.normal.scene, objects.normal.camera); + objects.logzbuf.renderer.render(objects.logzbuf.scene, objects.logzbuf.camera); +} + +function onWindowResize() { + updateRendererSizes(); +} + +function onBorderPointerDown() { + // activate draggable window resizing bar + window.addEventListener('pointermove', onBorderPointerMove); + window.addEventListener('pointerup', onBorderPointerUp); +} + +function onBorderPointerMove(ev) { + screensplit = Math.max(0, Math.min(1, ev.clientX / window.innerWidth)); +} + +function onBorderPointerUp() { + window.removeEventListener('pointermove', onBorderPointerMove); + window.removeEventListener('pointerup', onBorderPointerUp); +} + +function onMouseMove(ev) { + mouse[0] = ev.clientX / window.innerWidth; + mouse[1] = ev.clientY / window.innerHeight; +} + +function onMouseWheel(ev) { + const amount = ev.deltaY; + if (amount === 0) return; + const dir = amount / Math.abs(amount); + zoomspeed = dir / 10; + + // Slow down default zoom speed after user starts zooming, to give them more control + minzoomspeed = 0.001; +} diff --git a/examples-testing/examples/webgpu_caustics.ts b/examples-testing/examples/webgpu_caustics.ts new file mode 100644 index 000000000..48225c325 --- /dev/null +++ b/examples-testing/examples/webgpu_caustics.ts @@ -0,0 +1,200 @@ +import * as THREE from 'three/webgpu'; + +import { + uniform, + refract, + div, + positionViewDirection, + positionLocal, + normalView, + texture, + Fn, + vec2, + vec3, + vec4, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls; +let gltf; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.025, 5); + camera.position.set(-0.5, 0.35, 0.2); + + scene = new THREE.Scene(); + + // light + + const spotLight = new THREE.SpotLight(0xffffff, 1); + spotLight.position.set(0.2, 0.3, 0.2); + spotLight.castShadow = true; + spotLight.angle = Math.PI / 6; + spotLight.penumbra = 1; + spotLight.decay = 2; + spotLight.distance = 0; + spotLight.shadow.mapType = THREE.HalfFloatType; // For HDR Caustics + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + spotLight.shadow.camera.near = 0.1; + spotLight.shadow.camera.far = 1; + spotLight.shadow.intensity = 0.95; + scene.add(spotLight); + + // model / textures + + const dracoLoader = new DRACOLoader(); + + gltf = (await new GLTFLoader().setDRACOLoader(dracoLoader).loadAsync('./models/gltf/duck.glb')).scene; + gltf.scale.setScalar(0.5); + scene.add(gltf); + + const causticMap = new THREE.TextureLoader().load('./textures/opengameart/Caustic_Free.jpg'); + causticMap.wrapS = causticMap.wrapT = THREE.RepeatWrapping; + causticMap.colorSpace = THREE.SRGBColorSpace; + + // objects / material + + const duck = gltf.children[0]; + duck.material = new THREE.MeshPhysicalNodeMaterial(); + duck.material.side = THREE.DoubleSide; + duck.material.transparent = true; + duck.material.color = new THREE.Color(0xffd700); + duck.material.transmission = 1; + duck.material.thickness = 0.25; + duck.material.ior = 1.5; + duck.material.metalness = 0; + duck.material.roughness = 0.1; + duck.castShadow = true; + + // tsl shader + + const causticOcclusion = uniform(20); + + duck.material.castShadowPositionNode = Fn(() => { + // optional: add some distortion to the geometry shadow position if needed + + return positionLocal; + })(); + + duck.material.castShadowNode = Fn(() => { + const refractionVector = refract( + positionViewDirection.negate(), + normalView, + div(1.0, duck.material.ior), + ).normalize(); + const viewZ = normalView.z.pow(causticOcclusion); + + const textureUV = refractionVector.xy.mul(0.6); + + const causticColor = uniform(duck.material.color); + const chromaticAberrationOffset = normalView.z.pow(-0.9).mul(0.004); + + const causticProjection = vec3( + texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset.negate(), 0))).r, + texture(causticMap, textureUV.add(vec2(0, chromaticAberrationOffset.negate()))).g, + texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset, chromaticAberrationOffset))).b, + ); + + return causticProjection.mul(viewZ.mul(25)).add(viewZ).mul(causticColor); + })(); + + // + + const textureLoader = new THREE.TextureLoader(); + + // glass + + const colorMap = textureLoader.load('textures/colors.png'); + colorMap.wrapS = colorMap.wrapT = THREE.RepeatWrapping; + colorMap.colorSpace = THREE.SRGBColorSpace; + + const glassMaterial = new THREE.MeshPhysicalNodeMaterial(); + glassMaterial.map = colorMap; + glassMaterial.side = THREE.DoubleSide; + glassMaterial.transparent = true; + glassMaterial.color = new THREE.Color(0xffffff); + glassMaterial.transmission = 1; + glassMaterial.ior = 1.5; + glassMaterial.metalness = 0; + glassMaterial.roughness = 0.1; + glassMaterial.castShadowNode = vec4(texture(colorMap).rgb, 0.8); + + const glass = new THREE.Mesh(new THREE.PlaneGeometry(0.2, 0.2), glassMaterial); + glass.position.y = 0.1; + glass.castShadow = true; + glass.visible = false; + scene.add(glass); + + // ground + + const map = textureLoader.load('textures/hardwood2_diffuse.jpg'); + map.wrapS = map.wrapT = THREE.RepeatWrapping; + map.repeat.set(10, 10); + + const geometry = new THREE.PlaneGeometry(2, 2); + const material = new THREE.MeshStandardMaterial({ color: 0x999999, map }); + + const ground = new THREE.Mesh(geometry, material); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.shadowMap.transmitted = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(causticOcclusion, 'value', 0, 20).name('caustic occlusion'); + gui.addColor(duck.material, 'color').name('material color'); + gui.add({ model: 'duck' }, 'model', ['duck', 'glass']).onChange(model => { + duck.visible = glass.visible = false; + + if (model === 'duck') { + duck.visible = true; + } else if (model === 'glass') { + glass.visible = true; + } + }); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxDistance = 3; + controls.maxPolarAngle = Math.PI / 2; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + for (const mesh of gltf.children) { + mesh.rotation.y -= 0.01; + } + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_centroid_sampling.ts b/examples-testing/examples/webgpu_centroid_sampling.ts new file mode 100644 index 000000000..ca159d04c --- /dev/null +++ b/examples-testing/examples/webgpu_centroid_sampling.ts @@ -0,0 +1,199 @@ +import * as THREE from 'three/webgpu'; +import { varying, uv, texture, Fn } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let rendererAntialiasingEnabled; +let rendererAntialiasingDisabled; +let camera; +let scene; +let gui; + +const effectController = { + sampling: 'normal', +}; + +const atlasCanvas = document.createElement('canvas'); +atlasCanvas.width = 16; +atlasCanvas.height = 16; + +const ctx = atlasCanvas.getContext('2d'); +ctx.fillStyle = 'red'; +ctx.fillRect(0, 0, 8, 8); + +const redUVs = [0, 1, 0.5, 1, 0.5, 0.5, 0, 0.5]; +ctx.fillStyle = 'green'; +ctx.fillRect(8, 0, 8, 8); + +const greenUVs = [1, 1, 0.5, 1, 0.5, 0.5, 1, 0.5]; + +ctx.fillStyle = 'blue'; +ctx.fillRect(0, 8, 8, 8); + +const blueUVs = [0, 0, 0.5, 0, 0.5, 0.5, 0, 0.5]; + +ctx.fillStyle = 'yellow'; +ctx.fillRect(8, 8, 8, 8); + +const yellowUVs = [1, 0, 0.5, 0, 0.5, 0.5, 1, 0.5]; + +const faces = [redUVs, greenUVs, blueUVs, yellowUVs]; + +const canvasTexture = new THREE.CanvasTexture(atlasCanvas); +canvasTexture.colorSpace = THREE.SRGBColorSpace; +canvasTexture.mapping = THREE.UVMapping; +canvasTexture.wrapS = THREE.RepeatWrapping; +canvasTexture.wrapT = THREE.RepeatWrapping; +canvasTexture.magFilter = THREE.NearestFilter; +canvasTexture.minFilter = THREE.NearestFilter; +canvasTexture.format = THREE.RGBAFormat; +canvasTexture.type = THREE.UnsignedByteType; + +const forceWebGL = false; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(); + camera.fov = 60; + camera.near = 1; + camera.far = 2100; + camera.position.z = 50; + + scene = new THREE.Scene(); + + const makeFaceGeometry = uvs => { + const geometry = new THREE.BufferGeometry(); + const positions = [-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]; + geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(positions), 3)); + + const indices = [0, 1, 2, 2, 3, 0]; + geometry.setIndex(indices); + + geometry.setAttribute('uv', new THREE.BufferAttribute(new Float32Array(uvs), 2)); + + return geometry; + }; + + const material = new THREE.MeshBasicNodeMaterial(); + const testUV = varying(uv(), 'testUV'); + + const createShader = (type, sampling) => { + return Fn(() => { + testUV.setInterpolation(type, sampling); + + return texture(canvasTexture, testUV).rgb; + }); + }; + + const withFlatFirstShader = createShader( + THREE.InterpolationSamplingType.FLAT, + THREE.InterpolationSamplingMode.FIRST, + ); + const withFlatEitherShader = createShader( + THREE.InterpolationSamplingType.FLAT, + THREE.InterpolationSamplingMode.EITHER, + ); + + const withSampleShader = Fn(() => { + testUV.setInterpolation(THREE.InterpolationSamplingType.PERSPECTIVE, THREE.InterpolationSamplingMode.SAMPLE); + + return texture(canvasTexture, testUV).rgb; + }); + + const withInterpolationShader = Fn(() => { + testUV.setInterpolation(THREE.InterpolationSamplingType.PERSPECTIVE, THREE.InterpolationSamplingMode.CENTROID); + + return texture(canvasTexture, testUV).rgb; + }); + + const withoutInterpolationShader = Fn(() => { + return texture(canvasTexture, uv()).rgb; + }); + + material.colorNode = withoutInterpolationShader(); + + const faceMeshes = []; + + for (let x = -5; x < 5; x++) { + for (let y = -5; y < 5; y++) { + const face = faces[Math.floor(Math.random() * faces.length)]; + const geometry = makeFaceGeometry(face); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(x * 2, y * 2, 0); + faceMeshes.push(mesh); + scene.add(mesh); + } + } + + // Create Standard Renderer + rendererAntialiasingDisabled = new THREE.WebGPURenderer({ + antialias: false, + forceWebGL: forceWebGL, + }); + + rendererAntialiasingDisabled.setPixelRatio(window.devicePixelRatio); + rendererAntialiasingDisabled.setSize(window.innerWidth / 2, window.innerHeight); + rendererAntialiasingDisabled.setAnimationLoop(animateStandard); + + // Create antialiased renderer + rendererAntialiasingEnabled = new THREE.WebGPURenderer({ + antialias: true, + forceWebGL: forceWebGL, + }); + + document.body.querySelector('#antialiasing-enabled').appendChild(rendererAntialiasingEnabled.domElement); + rendererAntialiasingEnabled.setPixelRatio(window.devicePixelRatio); + rendererAntialiasingEnabled.setSize(window.innerWidth / 2, window.innerHeight); + rendererAntialiasingEnabled.setAnimationLoop(animateAliased); + rendererAntialiasingEnabled.inspector = new Inspector(); + + document.body.querySelector('#antialiasing-disabled').appendChild(rendererAntialiasingDisabled.domElement); + document.body.querySelector('#antialiasing-disabled').appendChild(rendererAntialiasingDisabled.domElement); + + onWindowResize(); + + window.addEventListener('resize', onWindowResize); + + gui = rendererAntialiasingEnabled.inspector.createParameters('Settings'); + gui.add(effectController, 'sampling', [ + THREE.InterpolationSamplingMode.NORMAL, + THREE.InterpolationSamplingMode.CENTROID, + THREE.InterpolationSamplingMode.SAMPLE, + 'flat first', + 'flat either', + ]).onChange(() => { + const interpolationShaderLib = { + [THREE.InterpolationSamplingMode.NORMAL]: withoutInterpolationShader, + [THREE.InterpolationSamplingMode.CENTROID]: withInterpolationShader, + [THREE.InterpolationSamplingMode.SAMPLE]: withSampleShader, + ['flat first']: withFlatFirstShader, + ['flat either']: withFlatEitherShader, + }; + + const shader = interpolationShaderLib[effectController.sampling]; + + for (let i = 0; i < faceMeshes.length; i++) { + faceMeshes[i].material.colorNode = shader(); + faceMeshes[i].material.needsUpdate = true; + } + }); +} + +function onWindowResize() { + const halfWidth = window.innerWidth / 2; + rendererAntialiasingDisabled.setSize(halfWidth, window.innerHeight); + rendererAntialiasingEnabled.setSize(halfWidth, window.innerHeight); + const aspect = halfWidth / window.innerHeight; + + camera.aspect = aspect; + camera.updateProjectionMatrix(); +} + +function animateStandard() { + rendererAntialiasingDisabled.render(scene, camera); +} + +function animateAliased() { + rendererAntialiasingEnabled.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_clearcoat.ts b/examples-testing/examples/webgpu_clearcoat.ts new file mode 100644 index 000000000..02fbacb9d --- /dev/null +++ b/examples-testing/examples/webgpu_clearcoat.ts @@ -0,0 +1,194 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; + +import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; + +let camera, scene, renderer; + +let particleLight; +let group; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.25, 50); + camera.position.z = 10; + + scene = new THREE.Scene(); + + group = new THREE.Group(); + scene.add(group); + + new HDRCubeTextureLoader() + .setPath('textures/cube/pisaHDR/') + .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (texture) { + const geometry = new THREE.SphereGeometry(0.8, 64, 32); + + const textureLoader = new THREE.TextureLoader(); + + const diffuse = textureLoader.load('textures/carbon/Carbon.png'); + diffuse.colorSpace = THREE.SRGBColorSpace; + diffuse.wrapS = THREE.RepeatWrapping; + diffuse.wrapT = THREE.RepeatWrapping; + diffuse.repeat.x = 10; + diffuse.repeat.y = 10; + + const normalMap = textureLoader.load('textures/carbon/Carbon_Normal.png'); + normalMap.wrapS = THREE.RepeatWrapping; + normalMap.wrapT = THREE.RepeatWrapping; + normalMap.repeat.x = 10; + normalMap.repeat.y = 10; + + const normalMap2 = textureLoader.load('textures/water/Water_1_M_Normal.jpg'); + + const normalMap3 = new THREE.CanvasTexture(new FlakesTexture()); + normalMap3.wrapS = THREE.RepeatWrapping; + normalMap3.wrapT = THREE.RepeatWrapping; + normalMap3.repeat.x = 10; + normalMap3.repeat.y = 6; + normalMap3.anisotropy = 16; + + const normalMap4 = textureLoader.load('textures/golfball.jpg'); + + const clearcoatNormalMap = textureLoader.load( + 'textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png', + ); + + // car paint + + let material = new THREE.MeshPhysicalMaterial({ + clearcoat: 1.0, + clearcoatRoughness: 0.1, + metalness: 0.9, + roughness: 0.5, + color: 0x0000ff, + normalMap: normalMap3, + normalScale: new THREE.Vector2(0.15, 0.15), + }); + let mesh = new THREE.Mesh(geometry, material); + mesh.position.x = -1; + mesh.position.y = 1; + group.add(mesh); + + // fibers + + material = new THREE.MeshPhysicalMaterial({ + roughness: 0.5, + clearcoat: 1.0, + clearcoatRoughness: 0.1, + map: diffuse, + normalMap: normalMap, + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = 1; + mesh.position.y = 1; + group.add(mesh); + + // golf + + material = new THREE.MeshPhysicalMaterial({ + metalness: 0.0, + roughness: 0.1, + clearcoat: 1.0, + normalMap: normalMap4, + clearcoatNormalMap: clearcoatNormalMap, + + // y scale is negated to compensate for normal map handedness. + clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = -1; + mesh.position.y = -1; + group.add(mesh); + + // clearcoat + normalmap + + material = new THREE.MeshPhysicalMaterial({ + clearcoat: 1.0, + metalness: 1.0, + color: 0xff0000, + normalMap: normalMap2, + normalScale: new THREE.Vector2(0.15, 0.15), + clearcoatNormalMap: clearcoatNormalMap, + + // y scale is negated to compensate for normal map handedness. + clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), + }); + mesh = new THREE.Mesh(geometry, material); + mesh.position.x = 1; + mesh.position.y = -1; + group.add(mesh); + + // + + scene.background = texture; + scene.environment = texture; + }); + + // LIGHTS + + particleLight = new THREE.Mesh( + new THREE.SphereGeometry(0.05, 8, 8), + new THREE.MeshBasicMaterial({ color: 0xffffff }), + ); + scene.add(particleLight); + + particleLight.add(new THREE.PointLight(0xffffff, 30)); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.25; + renderer.inspector = new Inspector(); + + // EVENTS + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 3; + controls.maxDistance = 30; + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +// + +function animate() { + render(); +} + +function render() { + const timer = Date.now() * 0.00025; + + particleLight.position.x = Math.sin(timer * 7) * 3; + particleLight.position.y = Math.cos(timer * 5) * 4; + particleLight.position.z = Math.cos(timer * 3) * 3; + + for (let i = 0; i < group.children.length; i++) { + const child = group.children[i]; + child.rotation.y += 0.005; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_clipping.ts b/examples-testing/examples/webgpu_clipping.ts new file mode 100644 index 000000000..b2b567c9a --- /dev/null +++ b/examples-testing/examples/webgpu_clipping.ts @@ -0,0 +1,201 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, startTime, object; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 0.25, 16); + + camera.position.set(0, 1.3, 3); + + scene = new THREE.Scene(); + + // Lights + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const spotLight = new THREE.SpotLight(0xffffff, 60); + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.2; + spotLight.position.set(2, 3, 3); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 3; + spotLight.shadow.camera.far = 10; + spotLight.shadow.mapSize.width = 2048; + spotLight.shadow.mapSize.height = 2048; + spotLight.shadow.radius = 4; + scene.add(spotLight); + + const dirLight = new THREE.DirectionalLight(0x55505a, 3); + dirLight.position.set(0, 3, 0); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 1; + dirLight.shadow.camera.far = 10; + + dirLight.shadow.camera.right = 1; + dirLight.shadow.camera.left = -1; + dirLight.shadow.camera.top = 1; + dirLight.shadow.camera.bottom = -1; + + dirLight.shadow.mapSize.width = 1024; + dirLight.shadow.mapSize.height = 1024; + scene.add(dirLight); + + // Clipping planes + + const globalPlane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0.1); + const localPlane1 = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0.8); + const localPlane2 = new THREE.Plane(new THREE.Vector3(0, 0, -1), 0.1); + + // Clipping Groups + + const globalClippingGroup = new THREE.ClippingGroup(); + globalClippingGroup.clippingPlanes = [globalPlane]; + + const knotClippingGroup = new THREE.ClippingGroup(); + knotClippingGroup.clippingPlanes = [localPlane1, localPlane2]; + knotClippingGroup.clipIntersection = true; + + scene.add(globalClippingGroup); + globalClippingGroup.add(knotClippingGroup); + + // Geometry + + const material = new THREE.MeshPhongNodeMaterial({ + color: 0x80ee10, + shininess: 0, + side: THREE.DoubleSide, + alphaToCoverage: true, + }); + + const geometry = new THREE.TorusKnotGeometry(0.4, 0.08, 95, 20); + + object = new THREE.Mesh(geometry, material); + object.castShadow = true; + knotClippingGroup.add(object); + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(9, 9, 1, 1), + new THREE.MeshPhongNodeMaterial({ color: 0xa0adaf, shininess: 150, alphaToCoverage: true }), + ); + + ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z + ground.receiveShadow = true; + globalClippingGroup.add(ground); + + // Renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.shadowMap.enabled = true; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + window.addEventListener('resize', onWindowResize); + document.body.appendChild(renderer.domElement); + + // Controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1, 0); + controls.update(); + + // GUI + + const gui = renderer.inspector.createParameters('Clipping settings'); + const props = { + alphaToCoverage: true, + }; + + const folderKnot = gui.addFolder('Knot Clipping Group'); + const propsKnot = { + get Enabled() { + return knotClippingGroup.enabled; + }, + set Enabled(v) { + knotClippingGroup.enabled = v; + }, + + get Shadows() { + return knotClippingGroup.clipShadows; + }, + set Shadows(v) { + knotClippingGroup.clipShadows = v; + }, + + get Intersection() { + return knotClippingGroup.clipIntersection; + }, + + set Intersection(v) { + knotClippingGroup.clipIntersection = v; + }, + + get Plane() { + return localPlane1.constant; + }, + set Plane(v) { + localPlane1.constant = v; + }, + }; + + const folderGlobal = gui.addFolder('Global Clipping Group'); + const propsGlobal = { + get Enabled() { + return globalClippingGroup.enabled; + }, + set Enabled(v) { + globalClippingGroup.enabled = v; + }, + + get Plane() { + return globalPlane.constant; + }, + set Plane(v) { + globalPlane.constant = v; + }, + }; + + gui.add(props, 'alphaToCoverage').onChange(function (value) { + ground.material.alphaToCoverage = value; + ground.material.needsUpdate = true; + + material.alphaToCoverage = value; + material.needsUpdate = true; + }); + + folderKnot.add(propsKnot, 'Enabled'); + folderKnot.add(propsKnot, 'Shadows'); + folderKnot.add(propsKnot, 'Intersection'); + folderKnot.add(propsKnot, 'Plane', 0.3, 1.25); + + folderGlobal.add(propsGlobal, 'Enabled'); + folderGlobal.add(propsGlobal, 'Plane', -0.4, 3); + + // Start + + startTime = Date.now(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(currentTime) { + const time = (currentTime - startTime) / 1000; + + object.position.y = 0.8; + object.rotation.x = time * 0.5; + object.rotation.y = time * 0.2; + object.scale.setScalar(Math.cos(time) * 0.125 + 0.875); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_clipping_stencil.ts b/examples-testing/examples/webgpu_clipping_stencil.ts new file mode 100644 index 000000000..c117bcfa8 --- /dev/null +++ b/examples-testing/examples/webgpu_clipping_stencil.ts @@ -0,0 +1,240 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, object; +let planes, planeObjects, planeHelpers; +let timer; + +const params = { + animate: true, + planeX: { + constant: 0, + negated: false, + displayHelper: false, + }, + planeY: { + constant: 0, + negated: false, + displayHelper: false, + }, + planeZ: { + constant: 0, + negated: false, + displayHelper: false, + }, +}; + +init(); + +function createPlaneStencilGroup(geometry, plane, stencilBit, renderOrder) { + const group = new THREE.ClippingGroup(); + group.clippingPlanes = [plane]; + + const material = new THREE.MeshBasicNodeMaterial(); + material.side = THREE.DoubleSide; + material.depthWrite = false; + material.depthTest = false; + material.colorWrite = false; + material.stencilWrite = true; + material.stencilWriteMask = stencilBit; + material.stencilFunc = THREE.AlwaysStencilFunc; + material.stencilFail = THREE.InvertStencilOp; + material.stencilZFail = THREE.InvertStencilOp; + material.stencilZPass = THREE.InvertStencilOp; + + const mesh = new THREE.Mesh(geometry, material); + mesh.renderOrder = renderOrder; + group.add(mesh); + + return group; +} + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x263238); + + camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 1, 100); + camera.position.set(2, 2, 2); + + scene.add(new THREE.AmbientLight(0xffffff, 1.5)); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(5, 10, 7.5); + dirLight.castShadow = true; + dirLight.shadow.camera.right = 2; + dirLight.shadow.camera.left = -2; + dirLight.shadow.camera.top = 2; + dirLight.shadow.camera.bottom = -2; + + dirLight.shadow.mapSize.width = 1024; + dirLight.shadow.mapSize.height = 1024; + scene.add(dirLight); + + planes = [ + new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0), + new THREE.Plane(new THREE.Vector3(0, -1, 0), 0), + new THREE.Plane(new THREE.Vector3(0, 0, -1), 0), + ]; + + planeHelpers = planes.map(p => new THREE.PlaneHelper(p, 2, 0xffffff)); + planeHelpers.forEach(ph => { + ph.visible = false; + scene.add(ph); + }); + + const geometry = new THREE.TorusKnotGeometry(0.4, 0.15, 220, 60); + object = new THREE.Group(); + scene.add(object); + + // Set up clip plane rendering + + planeObjects = []; + const planeGeom = new THREE.PlaneGeometry(4, 4); + + for (let i = 0; i < 3; i++) { + const plane = planes[i]; + const stencilBit = 1 << i; + + const stencilGroup = createPlaneStencilGroup(geometry, plane, stencilBit, i + 1); + object.add(stencilGroup); + + // the cap is only rendered where the stencil bit of its plane is set + // and is clipped by the other clipping planes + + const planeMat = new THREE.MeshStandardNodeMaterial({ + color: 0xe91e63, + metalness: 0.1, + roughness: 0.75, + + stencilWrite: true, + stencilRef: 0, + stencilFuncMask: stencilBit, + stencilWriteMask: stencilBit, + stencilFunc: THREE.NotEqualStencilFunc, + stencilFail: THREE.ReplaceStencilOp, + stencilZFail: THREE.ReplaceStencilOp, + stencilZPass: THREE.ReplaceStencilOp, + }); + const po = new THREE.Mesh(planeGeom, planeMat); + po.renderOrder = i + 1.1; + + const poGroup = new THREE.ClippingGroup(); + poGroup.clippingPlanes = planes.filter(p => p !== plane); + poGroup.add(po); + + planeObjects.push(po); + scene.add(poGroup); + } + + const clippingGroup = new THREE.ClippingGroup(); + clippingGroup.clippingPlanes = planes; + clippingGroup.clipShadows = true; + object.add(clippingGroup); + + const material = new THREE.MeshStandardNodeMaterial({ + color: 0xffc107, + metalness: 0.1, + roughness: 0.75, + shadowSide: THREE.DoubleSide, + }); + + // add the color + + const clippedColorFront = new THREE.Mesh(geometry, material); + clippedColorFront.castShadow = true; + clippedColorFront.renderOrder = 6; + clippingGroup.add(clippedColorFront); + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(9, 9, 1, 1), + new THREE.ShadowNodeMaterial({ color: 0x000000, opacity: 0.25, side: THREE.DoubleSide }), + ); + + ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z + ground.position.y = -1; + ground.receiveShadow = true; + scene.add(ground); + + // Renderer + + renderer = new THREE.WebGPURenderer({ antialias: true, stencil: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); + + // Controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 20; + controls.update(); + + // GUI + + const gui = renderer.inspector.createParameters('Clipping settings'); + gui.add(params, 'animate'); + + const planeX = gui.addFolder('planeX'); + planeX.add(params.planeX, 'displayHelper').onChange(v => (planeHelpers[0].visible = v)); + planeX.add(params.planeX, 'constant', -1, 1).onChange(d => (planes[0].constant = d)); + planeX.add(params.planeX, 'negated').onChange(() => { + planes[0].negate(); + params.planeX.constant = planes[0].constant; + }); + + const planeY = gui.addFolder('planeY'); + planeY.add(params.planeY, 'displayHelper').onChange(v => (planeHelpers[1].visible = v)); + planeY.add(params.planeY, 'constant', -1, 1).onChange(d => (planes[1].constant = d)); + planeY.add(params.planeY, 'negated').onChange(() => { + planes[1].negate(); + params.planeY.constant = planes[1].constant; + }); + + const planeZ = gui.addFolder('planeZ'); + planeZ.add(params.planeZ, 'displayHelper').onChange(v => (planeHelpers[2].visible = v)); + planeZ.add(params.planeZ, 'constant', -1, 1).onChange(d => (planes[2].constant = d)); + planeZ.add(params.planeZ, 'negated').onChange(() => { + planes[2].negate(); + params.planeZ.constant = planes[2].constant; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (params.animate) { + object.rotation.x += delta * 0.5; + object.rotation.y += delta * 0.2; + } + + for (let i = 0; i < planeObjects.length; i++) { + const plane = planes[i]; + const po = planeObjects[i]; + plane.coplanarPoint(po.position); + po.lookAt(po.position.x - plane.normal.x, po.position.y - plane.normal.y, po.position.z - plane.normal.z); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compile_async.ts b/examples-testing/examples/webgpu_compile_async.ts new file mode 100644 index 000000000..fbcf0a7b0 --- /dev/null +++ b/examples-testing/examples/webgpu_compile_async.ts @@ -0,0 +1,265 @@ +import * as THREE from 'three/webgpu'; +import { + uv, + float, + vec3, + hash, + mx_noise_vec3, + mx_worley_noise_vec3, + mx_cell_noise_float, + mx_fractal_noise_vec3, +} from 'three/tsl'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let MESH_COUNT = 256; +let GRID_SIZE = 16; +const ADD_DELAY = 1000; + +let camera, scene, renderer; +let sphere; +let gui; + +// Frame timing +let lastFrameTime = 0; +let longestFrameTime = 0; +let isTracking = false; +let shouldStartTracking = false; +let sphereStartTime = 0; +let currentMode = ''; +let framesAfterComplete = 0; +let testDone = false; +let meshGroup = null; + +const longestFrameEl = document.getElementById('longestFrame'); +const meshCountEl = document.getElementById('meshCount'); +const compileModeEl = document.getElementById('compileMode'); + +const params = { + withoutCompile: function () { + window.location.href = window.location.pathname + '?mode=no-compile'; + }, + withCompileAsync: function () { + window.location.href = window.location.pathname + '?mode=compile-async'; + }, +}; + +init(); + +async function init() { + // GUI + gui = new GUI(); + gui.add(params, 'withoutCompile').name('Build on render'); + gui.add(params, 'withCompileAsync').name('Pre-build (compileAsync)'); + + window.addEventListener('resize', onWindowResize); + + // Orthographic camera + const aspect = window.innerWidth / window.innerHeight; + const frustumSize = 20; + camera = new THREE.OrthographicCamera( + (frustumSize * aspect) / -2, + (frustumSize * aspect) / 2, + frustumSize / 2, + frustumSize / -2, + 0.1, + 100, + ); + camera.position.set(0, 0, 20); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x111111); + + // Create animated sphere + const sphereGeometry = new THREE.SphereGeometry(0.5, 32, 32); + const sphereMaterial = new THREE.MeshNormalMaterial(); + sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); + scene.add(sphere); + + // Renderer + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // Reduce mesh count for WebGL (slower compilation) + if (renderer.backend.isWebGLBackend) { + MESH_COUNT = 64; + GRID_SIZE = 8; + document.getElementById('materialCount').textContent = '64'; + meshCountEl.textContent = '0 / 64'; + } + + // Get mode from URL + const urlParams = new URLSearchParams(window.location.search); + const mode = urlParams.get('mode') || 'compile-async'; + + const modeLabel = mode === 'compile-async' ? 'Pre-build (compileAsync)' : 'Build on render'; + compileModeEl.textContent = modeLabel; + + // Start sphere animation + sphereStartTime = performance.now(); + + // Schedule mesh addition after delay + setTimeout(() => addMeshes(mode), ADD_DELAY); +} + +function createUniqueMaterial(index) { + const material = new THREE.MeshBasicNodeMaterial(); + + const seed = float(index * 0.1 + 1.0); + const scale = float((index % 5) + 2.0); + const uvNode = uv() + .mul(scale) + .add(hash(float(index))); + + const noiseType = index % 4; + let colorNode; + + switch (noiseType) { + case 0: + colorNode = mx_noise_vec3(uvNode.mul(seed)).mul(0.5).add(0.5); + break; + + case 1: + colorNode = mx_worley_noise_vec3(uvNode.mul(seed.mul(0.5))); + break; + + case 2: + const cellNoise = mx_cell_noise_float(uvNode.mul(seed)); + colorNode = vec3(cellNoise, cellNoise.mul(0.7), cellNoise.mul(0.4)); + break; + + case 3: + colorNode = mx_fractal_noise_vec3(uvNode.mul(seed.mul(0.3)), float(3), float(2.0), float(0.5)) + .mul(0.5) + .add(0.5); + break; + } + + const tintR = hash(float(index * 3)); + const tintG = hash(float(index * 3 + 1)); + const tintB = hash(float(index * 3 + 2)); + const tint = vec3(tintR, tintG, tintB).mul(0.3).add(0.7); + + material.colorNode = colorNode.mul(tint); + + return material; +} + +async function addMeshes(mode) { + const geometry = new THREE.PlaneGeometry(0.9, 0.9); + const startX = -(GRID_SIZE - 1) / 2; + const startY = -(GRID_SIZE - 1) / 2; + + meshGroup = new THREE.Group(); + + for (let i = 0; i < MESH_COUNT; i++) { + const material = createUniqueMaterial(i); + const mesh = new THREE.Mesh(geometry, material); + + const col = i % GRID_SIZE; + const row = Math.floor(i / GRID_SIZE); + + mesh.position.x = startX + col; + mesh.position.y = startY + row; + + meshGroup.add(mesh); + } + + currentMode = mode; + + if (mode === 'compile-async') { + // Pre-compile all meshes before adding to scene + // Start tracking BEFORE compile to measure longest frame during compile + shouldStartTracking = true; + + await renderer.compileAsync(meshGroup, camera, scene); + + // Add all meshes at once (already compiled - should render instantly) + scene.add(meshGroup); + testDone = true; + } else { + // Add all meshes at once - renderer compiles on-demand + // Meshes appear progressively as they compile + scene.add(meshGroup); + + // Start tracking on next animate() frame + shouldStartTracking = true; + testDone = true; + } +} + +function finishTest() { + isTracking = false; + + longestFrameEl.textContent = longestFrameTime.toFixed(1) + ' ms'; + longestFrameEl.className = longestFrameTime > 100 ? 'value bad' : 'value'; +} + +function onWindowResize() { + if (!renderer || !camera) return; + + const aspect = window.innerWidth / window.innerHeight; + const frustumSize = 12; + + camera.left = (frustumSize * aspect) / -2; + camera.right = (frustumSize * aspect) / 2; + camera.top = frustumSize / 2; + camera.bottom = frustumSize / -2; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const now = performance.now(); + + // Initialize tracking on first frame after meshes added + if (shouldStartTracking) { + shouldStartTracking = false; + isTracking = true; + lastFrameTime = now; + longestFrameTime = 0; + framesAfterComplete = 0; + } + + // Track longest frame during test + if (isTracking && lastFrameTime > 0 && lastFrameTime !== now) { + const frameTime = now - lastFrameTime; + if (frameTime > longestFrameTime) { + longestFrameTime = frameTime; + } + } + + lastFrameTime = now; + + // Animate sphere left to right + if (sphere && sphereStartTime > 0) { + const elapsed = (now - sphereStartTime) / 1000; + sphere.position.x = Math.sin(elapsed * 2) * 8; + } + + renderer.render(scene, camera); + + // Update mesh count display + if (meshGroup) { + meshCountEl.textContent = meshGroup.children.length + ' / ' + MESH_COUNT; + } + + // Finish test - wait a few frames after testDone to capture frame times + if (isTracking && testDone) { + framesAfterComplete++; + + // Wait longer for deferred mode (meshes compile progressively) + const framesToWait = currentMode === 'compile-async' ? 2 : 60; + + if (framesAfterComplete >= framesToWait) { + finishTest(); + } + } +} diff --git a/examples-testing/examples/webgpu_compute_audio.ts b/examples-testing/examples/webgpu_compute_audio.ts new file mode 100644 index 000000000..229033d79 --- /dev/null +++ b/examples-testing/examples/webgpu_compute_audio.ts @@ -0,0 +1,178 @@ +import * as THREE from 'three/webgpu'; +import { Fn, uniform, instanceIndex, instancedArray, float, texture, screenUV, color } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let computeNode; +let waveBuffer, sampleRate; +let waveArray; +let currentAudio, currentAnalyser; +const analyserBuffer = new Uint8Array(1024); +let analyserTexture; + +const startButton = document.getElementById('startButton'); +startButton.addEventListener('click', init); + +async function playAudioBuffer() { + if (currentAudio) currentAudio.stop(); + + // compute audio + + renderer.compute(computeNode); + + const wave = new Float32Array(await renderer.getArrayBufferAsync(waveArray.value)); + + // play result + + const audioOutputContext = new AudioContext({ sampleRate }); + const audioOutputBuffer = audioOutputContext.createBuffer(1, wave.length, sampleRate); + + audioOutputBuffer.copyToChannel(wave, 0); + + const source = audioOutputContext.createBufferSource(); + source.connect(audioOutputContext.destination); + source.buffer = audioOutputBuffer; + source.start(); + + currentAudio = source; + + // visual feedback + + currentAnalyser = audioOutputContext.createAnalyser(); + currentAnalyser.fftSize = 2048; + + source.connect(currentAnalyser); +} + +async function init() { + const overlay = document.getElementById('overlay'); + overlay.remove(); + + // audio buffer + + const soundBuffer = await fetch('sounds/webgpu-audio-processing.mp3').then(res => res.arrayBuffer()); + const audioContext = new AudioContext(); + + const audioBuffer = await audioContext.decodeAudioData(soundBuffer); + + waveBuffer = audioBuffer.getChannelData(0); + + // adding extra silence to delay and pitch + waveBuffer = new Float32Array([...waveBuffer, ...new Float32Array(200000)]); + + sampleRate = audioBuffer.sampleRate / audioBuffer.numberOfChannels; + + // create webgpu buffers + + waveArray = instancedArray(waveBuffer); + + // read-only buffer + + const originalWave = instancedArray(waveBuffer).toReadOnly(); + + // The Pixel Buffer Object (PBO) is required to get the GPU computed data to the CPU in the WebGL2 fallback. + // As used in `renderer.getArrayBufferAsync( waveArray.value )`. + + originalWave.setPBO(true); + waveArray.setPBO(true); + + // params + + const pitch = uniform(1.5); + const delayVolume = uniform(0.2); + const delayOffset = uniform(0.55); + + // compute (shader-node) + + const computeShaderFn = Fn(() => { + const index = float(instanceIndex); + + // pitch + + const time = index.mul(pitch); + + let wave = originalWave.element(time); + + // delay + + for (let i = 1; i < 7; i++) { + const waveOffset = originalWave.element(index.sub(delayOffset.mul(sampleRate).mul(i)).mul(pitch)); + const waveOffsetVolume = waveOffset.mul(delayVolume.div(i * i)); + + wave = wave.add(waveOffsetVolume); + } + + // store + + const waveStorageElementNode = waveArray.element(instanceIndex); + + waveStorageElementNode.assign(wave); + }); + + // compute + + computeNode = computeShaderFn().compute(waveBuffer.length); + + // renderer + + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 30); + + // nodes + + analyserTexture = new THREE.DataTexture(analyserBuffer, analyserBuffer.length, 1, THREE.RedFormat); + + const spectrum = texture(analyserTexture, screenUV.x).x.mul(screenUV.y); + const backgroundNode = color(0x0000ff).mul(spectrum); + + // scene + + scene = new THREE.Scene(); + scene.backgroundNode = backgroundNode; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + await renderer.init(); + + window.addEventListener('resize', onWindowResize); + document.addEventListener('click', playAudioBuffer); + + // gui + + const gui = renderer.inspector.createParameters('Audio'); + + gui.add(pitch, 'value', 0.5, 2, 0.01).name('pitch'); + gui.add(delayVolume, 'value', 0, 1, 0.01).name('delayVolume'); + gui.add(delayOffset, 'value', 0.1, 1, 0.01).name('delayOffset'); + + // + + playAudioBuffer(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + if (currentAnalyser) { + currentAnalyser.getByteFrequencyData(analyserBuffer); + + analyserTexture.needsUpdate = true; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_birds.ts b/examples-testing/examples/webgpu_compute_birds.ts new file mode 100644 index 000000000..665a54528 --- /dev/null +++ b/examples-testing/examples/webgpu_compute_birds.ts @@ -0,0 +1,424 @@ +import * as THREE from 'three/webgpu'; +import { + uniform, + varying, + vec4, + add, + sub, + max, + dot, + sin, + mat3, + uint, + negate, + instancedArray, + cameraProjectionMatrix, + cameraViewMatrix, + positionLocal, + modelWorldMatrix, + sqrt, + float, + Fn, + If, + cos, + Loop, + Continue, + normalize, + instanceIndex, + length, + vertexIndex, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let container; +let camera, scene, renderer; + +let last = performance.now(); + +let pointer, raycaster; +let computeVelocity, computePosition, effectController; + +const BIRDS = 8192; +const SPEED_LIMIT = 9.0; +const BOUNDS = 800, + BOUNDS_HALF = BOUNDS / 2; + +// Custom Geometry - using 3 triangles each. No normals currently. +class BirdGeometry extends THREE.BufferGeometry { + constructor() { + super(); + + const points = 3 * 3; + + const vertices = new THREE.BufferAttribute(new Float32Array(points * 3), 3); + + this.setAttribute('position', vertices); + + let v = 0; + + function verts_push() { + for (let i = 0; i < arguments.length; i++) { + vertices.array[v++] = arguments[i]; + } + } + + const wingsSpan = 20; + + // Body + verts_push(0, 0, -20, 0, -8, 10, 0, 0, 30); + + // Left Wing + verts_push(0, 0, -15, -wingsSpan, 0, 5, 0, 0, 15); + + // Right Wing + verts_push(0, 0, 15, wingsSpan, 0, 5, 0, 0, -15); + + this.scale(0.2, 0.2, 0.2); + } +} + +// TODO: Fix example with WebGL backend + +if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); +} + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0xffffff, 700, 3000); + + // Pointer + + pointer = new THREE.Vector2(); + raycaster = new THREE.Raycaster(); + + // Sky + + const geometry = new THREE.IcosahedronGeometry(1, 6); + const material = new THREE.MeshBasicNodeMaterial({ + // Use vertex positions to create atmosphere colors + colorNode: varying( + vec4(sub(0.25, positionLocal.y), sub(-0.25, positionLocal.y), add(1.5, positionLocal.y), 1.0), + ), + side: THREE.BackSide, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.rotation.z = 0.75; + mesh.scale.setScalar(1200); + scene.add(mesh); + + // + + renderer = new THREE.WebGPURenderer({ + antialias: true, + forceWebGL: false, + requiredLimits: { maxStorageBuffersInVertexStage: 3 }, + }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera); + controls.connect(renderer.domElement); + + // Initialize position, velocity, and phase values + + const positionArray = new Float32Array(BIRDS * 3); + const velocityArray = new Float32Array(BIRDS * 3); + const phaseArray = new Float32Array(BIRDS); + + for (let i = 0; i < BIRDS; i++) { + const posX = Math.random() * BOUNDS - BOUNDS_HALF; + const posY = Math.random() * BOUNDS - BOUNDS_HALF; + const posZ = Math.random() * BOUNDS - BOUNDS_HALF; + + positionArray[i * 3 + 0] = posX; + positionArray[i * 3 + 1] = posY; + positionArray[i * 3 + 2] = posZ; + + const velX = Math.random() - 0.5; + const velY = Math.random() - 0.5; + const velZ = Math.random() - 0.5; + + velocityArray[i * 3 + 0] = velX * 10; + velocityArray[i * 3 + 1] = velY * 10; + velocityArray[i * 3 + 2] = velZ * 10; + + phaseArray[i] = 1; + } + + // Labels applied to storage nodes and uniform nodes are reflected within the shader output, + // and are useful for debugging purposes. + + const positionStorage = instancedArray(positionArray, 'vec3').setName('positionStorage'); + const velocityStorage = instancedArray(velocityArray, 'vec3').setName('velocityStorage'); + const phaseStorage = instancedArray(phaseArray, 'float').setName('phaseStorage'); + + // The Pixel Buffer Object (PBO) is required to get the GPU computed data in the WebGL2 fallback. + + positionStorage.setPBO(true); + velocityStorage.setPBO(true); + phaseStorage.setPBO(true); + + // Define Uniforms. Uniforms only need to be defined once rather than per shader. + + effectController = { + separation: uniform(15.0).setName('separation'), + alignment: uniform(20.0).setName('alignment'), + cohesion: uniform(20.0).setName('cohesion'), + freedom: uniform(0.75).setName('freedom'), + now: uniform(0.0), + deltaTime: uniform(0.0).setName('deltaTime'), + rayOrigin: uniform(new THREE.Vector3()).setName('rayOrigin'), + rayDirection: uniform(new THREE.Vector3()).setName('rayDirection'), + }; + + // Create geometry + + const birdGeometry = new BirdGeometry(); + const birdMaterial = new THREE.NodeMaterial(); + + // Animate bird mesh within vertex shader, then apply position offset to vertices. + + const birdVertexTSL = Fn(() => { + const position = positionLocal.toVar(); + const newPhase = phaseStorage.element(instanceIndex).toVar(); + const newVelocity = normalize(velocityStorage.element(instanceIndex)).toVar(); + + If(vertexIndex.equal(4).or(vertexIndex.equal(7)), () => { + // flap wings + position.y = sin(newPhase).mul(5.0); + }); + + const newPosition = modelWorldMatrix.mul(position); + + newVelocity.z.mulAssign(-1.0); + const xz = length(newVelocity.xz); + const xyz = float(1.0); + const x = sqrt(newVelocity.y.mul(newVelocity.y).oneMinus()); + + const cosry = newVelocity.x.div(xz).toVar(); + const sinry = newVelocity.z.div(xz).toVar(); + + const cosrz = x.div(xyz); + const sinrz = newVelocity.y.div(xyz).toVar(); + + // Nodes must be negated with negate(). Using '-', their values will resolve to NaN. + const maty = mat3(cosry, 0, negate(sinry), 0, 1, 0, sinry, 0, cosry); + + const matz = mat3(cosrz, sinrz, 0, negate(sinrz), cosrz, 0, 0, 0, 1); + + const finalVert = maty.mul(matz).mul(newPosition); + finalVert.addAssign(positionStorage.element(instanceIndex)); + + return cameraProjectionMatrix.mul(cameraViewMatrix).mul(finalVert); + }); + + birdMaterial.vertexNode = birdVertexTSL(); + birdMaterial.side = THREE.DoubleSide; + + const birdMesh = new THREE.InstancedMesh(birdGeometry, birdMaterial, BIRDS); + birdMesh.rotation.y = Math.PI / 2; + birdMesh.matrixAutoUpdate = false; + birdMesh.frustumCulled = false; + birdMesh.updateMatrix(); + + // Define GPU Compute shaders. + // Shaders are computationally identical to their GLSL counterparts outside of texture destructuring. + + computeVelocity = Fn(() => { + // Define consts + const PI = float(3.141592653589793); + const PI_2 = PI.mul(2.0); + const limit = float(SPEED_LIMIT).toVar('limit'); + + // Destructure uniforms + const { alignment, separation, cohesion, deltaTime, rayOrigin, rayDirection } = effectController; + + const zoneRadius = separation.add(alignment).add(cohesion).toConst(); + const separationThresh = separation.div(zoneRadius).toConst(); + const alignmentThresh = separation.add(alignment).div(zoneRadius).toConst(); + const zoneRadiusSq = zoneRadius.mul(zoneRadius).toConst(); + + // Cache current bird's position and velocity outside the loop + const birdIndex = instanceIndex.toConst('birdIndex'); + const position = positionStorage.element(birdIndex).toVar(); + const velocity = velocityStorage.element(birdIndex).toVar(); + + // Add influence of pointer position to velocity using cached position + const directionToRay = rayOrigin.sub(position).toConst(); + const projectionLength = dot(directionToRay, rayDirection).toConst(); + const closestPoint = rayOrigin.sub(rayDirection.mul(projectionLength)).toConst(); + const directionToClosestPoint = closestPoint.sub(position).toConst(); + const distanceToClosestPoint = length(directionToClosestPoint).toConst(); + const distanceToClosestPointSq = distanceToClosestPoint.mul(distanceToClosestPoint).toConst(); + + const rayRadius = float(150.0).toConst(); + const rayRadiusSq = rayRadius.mul(rayRadius).toConst(); + + If(distanceToClosestPointSq.lessThan(rayRadiusSq), () => { + const velocityAdjust = distanceToClosestPointSq.div(rayRadiusSq).sub(1.0).mul(deltaTime).mul(100.0); + velocity.addAssign(normalize(directionToClosestPoint).mul(velocityAdjust)); + limit.addAssign(5.0); + }); + + // Attract flocks to center + const dirToCenter = position.toVar(); + dirToCenter.y.mulAssign(2.5); + velocity.subAssign(normalize(dirToCenter).mul(deltaTime).mul(5.0)); + + Loop({ start: uint(0), end: uint(BIRDS), type: 'uint', condition: '<' }, ({ i }) => { + If(i.equal(birdIndex), () => { + Continue(); + }); + + // Cache bird's position and velocity + + const birdPosition = positionStorage.element(i); + const dirToBird = birdPosition.sub(position); + const distToBird = length(dirToBird); + + If(distToBird.lessThan(0.0001), () => { + Continue(); + }); + + const distToBirdSq = distToBird.mul(distToBird); + + // Don't apply any changes to velocity if changes if the bird is outsize the zone's radius. + If(distToBirdSq.greaterThan(zoneRadiusSq), () => { + Continue(); + }); + + // Determine which threshold the bird is flying within and adjust its velocity accordingly + + const percent = distToBirdSq.div(zoneRadiusSq); + + If(percent.lessThan(separationThresh), () => { + // Separation - Move apart for comfort + const velocityAdjust = separationThresh.div(percent).sub(1.0).mul(deltaTime); + velocity.subAssign(normalize(dirToBird).mul(velocityAdjust)); + }) + .ElseIf(percent.lessThan(alignmentThresh), () => { + // Alignment - fly the same direction + const threshDelta = alignmentThresh.sub(separationThresh); + const adjustedPercent = percent.sub(separationThresh).div(threshDelta); + const birdVelocity = velocityStorage.element(i); + + const cosRange = cos(adjustedPercent.mul(PI_2)); + const cosRangeAdjust = float(0.5).sub(cosRange.mul(0.5)).add(0.5); + const velocityAdjust = cosRangeAdjust.mul(deltaTime); + velocity.addAssign(normalize(birdVelocity).mul(velocityAdjust)); + }) + .Else(() => { + // Attraction / Cohesion - move closer + const threshDelta = alignmentThresh.oneMinus(); + const adjustedPercent = threshDelta + .equal(0.0) + .select(1.0, percent.sub(alignmentThresh).div(threshDelta)); + + const cosRange = cos(adjustedPercent.mul(PI_2)); + const adj1 = cosRange.mul(-0.5); + const adj2 = adj1.add(0.5); + const adj3 = float(0.5).sub(adj2); + + const velocityAdjust = adj3.mul(deltaTime); + velocity.addAssign(normalize(dirToBird).mul(velocityAdjust)); + }); + }); + + If(length(velocity).greaterThan(limit), () => { + velocity.assign(normalize(velocity).mul(limit)); + }); + + // Write back the final velocity to storage + velocityStorage.element(birdIndex).assign(velocity); + })() + .compute(BIRDS) + .setName('Birds Velocity'); + + computePosition = Fn(() => { + const { deltaTime } = effectController; + positionStorage + .element(instanceIndex) + .addAssign(velocityStorage.element(instanceIndex).mul(deltaTime).mul(15.0)); + + const velocity = velocityStorage.element(instanceIndex); + const phase = phaseStorage.element(instanceIndex); + + const modValue = phase + .add(deltaTime) + .add(length(velocity.xz).mul(deltaTime).mul(3.0)) + .add(max(velocity.y, 0.0).mul(deltaTime).mul(6.0)); + phaseStorage.element(instanceIndex).assign(modValue.mod(62.83)); + })() + .compute(BIRDS) + .setName('Birds Position'); + + scene.add(birdMesh); + + container.style.touchAction = 'none'; + container.addEventListener('pointermove', onPointerMove); + + window.addEventListener('resize', onWindowResize); + + const gui = renderer.inspector.createParameters('Birds settings'); + gui.add(effectController.separation, 'value', 0.0, 100.0, 1.0).name('Separation'); + gui.add(effectController.alignment, 'value', 0.0, 100, 0.001).name('Alignment '); + gui.add(effectController.cohesion, 'value', 0.0, 100, 0.025).name('Cohesion'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + if (event.isPrimary === false) return; + + pointer.x = (event.clientX / window.innerWidth) * 2.0 - 1.0; + pointer.y = 1.0 - (event.clientY / window.innerHeight) * 2.0; +} + +function render() { + const now = performance.now(); + let deltaTime = (now - last) / 1000; + + if (deltaTime > 1) deltaTime = 1; // safety cap on large deltas + last = now; + + raycaster.setFromCamera(pointer, camera); + + effectController.now.value = now; + effectController.deltaTime.value = deltaTime; + effectController.rayOrigin.value.copy(raycaster.ray.origin); + effectController.rayDirection.value.copy(raycaster.ray.direction); + + renderer.compute(computeVelocity); + renderer.compute(computePosition); + + renderer.render(scene, camera); + + // Move pointer away so we only affect birds when moving the mouse + pointer.y = 10; +} + +init(); diff --git a/examples-testing/examples/webgpu_compute_cloth.ts b/examples-testing/examples/webgpu_compute_cloth.ts new file mode 100644 index 000000000..c18af53f2 --- /dev/null +++ b/examples-testing/examples/webgpu_compute_cloth.ts @@ -0,0 +1,487 @@ +import * as THREE from 'three/webgpu'; + +import { + Fn, + If, + Return, + instancedArray, + instanceIndex, + uniform, + select, + attribute, + Loop, + float, + transformNormalToView, + cross, + triNoise3D, + time, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let renderer, scene, camera, controls; + +const clothWidth = 1; +const clothHeight = 1; +const clothNumSegmentsX = 30; +const clothNumSegmentsY = 30; +const sphereRadius = 0.15; + +let vertexPositionBuffer, vertexForceBuffer, vertexParamsBuffer; +let springVertexIdBuffer, springRestLengthBuffer, springForceBuffer; +let springListBuffer; +let computeSpringForces, computeVertexForces; +let dampeningUniform, spherePositionUniform, stiffnessUniform, sphereUniform, windUniform; +let vertexWireframeObject, springWireframeObject; +let clothMesh, clothMaterial, sphere; +let timeSinceLastStep = 0; +let timestamp = 0; +const verletVertices = []; +const verletSprings = []; +const verletVertexColumns = []; + +const timer = new THREE.Timer(); +timer.connect(document); + +const params = { + wireframe: false, + sphere: true, + wind: 1.0, +}; + +const API = { + color: 0x204080, // sRGB + sheenColor: 0xffffff, // sRGB +}; + +// TODO: Fix example with WebGL backend + +if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); +} + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true, requiredLimits: { maxStorageBuffersInVertexStage: 1 } }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.set(-1.6, -0.1, -1.6); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 3; + controls.target.set(0, -0.1, 0); + controls.update(); + + const hdrLoader = new UltraHDRLoader().setPath('textures/equirectangular/'); + + const hdrTexture = await hdrLoader.loadAsync('royal_esplanade_2k.hdr.jpg'); + hdrTexture.mapping = THREE.EquirectangularReflectionMapping; + scene.background = hdrTexture; + scene.backgroundBlurriness = 0.5; + scene.environment = hdrTexture; + + setupCloth(); + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(stiffnessUniform, 'value', 0.1, 0.5, 0.01).name('stiffness'); + gui.add(params, 'wireframe'); + gui.add(params, 'sphere'); + gui.add(params, 'wind', 0, 5, 0.1); + + const materialFolder = gui.addFolder('material'); + materialFolder.addColor(API, 'color').onChange(function (color) { + clothMaterial.color.setHex(color); + }); + materialFolder.add(clothMaterial, 'roughness', 0.0, 1, 0.01); + materialFolder.add(clothMaterial, 'sheen', 0.0, 1, 0.01); + materialFolder.add(clothMaterial, 'sheenRoughness', 0.0, 1, 0.01); + materialFolder.addColor(API, 'sheenColor').onChange(function (color) { + clothMaterial.sheenColor.setHex(color); + }); + + window.addEventListener('resize', onWindowResize); + + renderer.setAnimationLoop(render); +} + +function setupVerletGeometry() { + // this function sets up the geometry of the verlet system, a grid of vertices connected by springs + + const addVerletVertex = (x, y, z, isFixed) => { + const id = verletVertices.length; + const vertex = { + id, + position: new THREE.Vector3(x, y, z), + isFixed, + springIds: [], + }; + verletVertices.push(vertex); + return vertex; + }; + + const addVerletSpring = (vertex0, vertex1) => { + const id = verletSprings.length; + const spring = { + id, + vertex0, + vertex1, + }; + vertex0.springIds.push(id); + vertex1.springIds.push(id); + verletSprings.push(spring); + return spring; + }; + + // create the cloth's verlet vertices + for (let x = 0; x <= clothNumSegmentsX; x++) { + const column = []; + for (let y = 0; y <= clothNumSegmentsY; y++) { + const posX = x * (clothWidth / clothNumSegmentsX) - clothWidth * 0.5; + const posZ = y * (clothHeight / clothNumSegmentsY); + const isFixed = y === 0 && x % 5 === 0; // make some of the top vertices' positions fixed + const vertex = addVerletVertex(posX, clothHeight * 0.5, posZ, isFixed); + column.push(vertex); + } + + verletVertexColumns.push(column); + } + + // create the cloth's verlet springs + for (let x = 0; x <= clothNumSegmentsX; x++) { + for (let y = 0; y <= clothNumSegmentsY; y++) { + const vertex0 = verletVertexColumns[x][y]; + if (x > 0) addVerletSpring(vertex0, verletVertexColumns[x - 1][y]); + if (y > 0) addVerletSpring(vertex0, verletVertexColumns[x][y - 1]); + if (x > 0 && y > 0) addVerletSpring(vertex0, verletVertexColumns[x - 1][y - 1]); + if (x > 0 && y < clothNumSegmentsY) addVerletSpring(vertex0, verletVertexColumns[x - 1][y + 1]); + + // You can make the cloth more rigid by adding more springs between further apart vertices + //if (x > 1) addVerletSpring(vertex0, verletVertexColumns[x - 2][y]); + //if (y > 1) addVerletSpring(vertex0, verletVertexColumns[x][y - 2]); + } + } +} + +function setupVerletVertexBuffers() { + // setup the buffers holding the vertex data for the compute shaders + + const vertexCount = verletVertices.length; + + const springListArray = []; + // this springListArray will hold a list of spring ids, ordered by the id of the vertex affected by that spring. + // this is so the compute shader that accumulates the spring forces for each vertex can efficiently iterate over all springs affecting that vertex + + const vertexPositionArray = new Float32Array(vertexCount * 3); + const vertexParamsArray = new Uint32Array(vertexCount * 3); + // the params Array holds three values for each verlet vertex: + // x: isFixed, y: springCount, z: springPointer + // isFixed is 1 if the verlet is marked as immovable, 0 if not + // springCount is the number of springs connected to that vertex + // springPointer is the index of the first spring in the springListArray that is connected to that vertex + + for (let i = 0; i < vertexCount; i++) { + const vertex = verletVertices[i]; + vertexPositionArray[i * 3] = vertex.position.x; + vertexPositionArray[i * 3 + 1] = vertex.position.y; + vertexPositionArray[i * 3 + 2] = vertex.position.z; + vertexParamsArray[i * 3] = vertex.isFixed ? 1 : 0; + if (!vertex.isFixed) { + vertexParamsArray[i * 3 + 1] = vertex.springIds.length; + vertexParamsArray[i * 3 + 2] = springListArray.length; + springListArray.push(...vertex.springIds); + } + } + + vertexPositionBuffer = instancedArray(vertexPositionArray, 'vec3').setPBO(true); // setPBO(true) is only important for the WebGL Fallback + vertexForceBuffer = instancedArray(vertexCount, 'vec3'); + vertexParamsBuffer = instancedArray(vertexParamsArray, 'uvec3'); + + springListBuffer = instancedArray(new Uint32Array(springListArray), 'uint').setPBO(true); +} + +function setupVerletSpringBuffers() { + // setup the buffers holding the spring data for the compute shaders + + const springCount = verletSprings.length; + + const springVertexIdArray = new Uint32Array(springCount * 2); + const springRestLengthArray = new Float32Array(springCount); + + for (let i = 0; i < springCount; i++) { + const spring = verletSprings[i]; + springVertexIdArray[i * 2] = spring.vertex0.id; + springVertexIdArray[i * 2 + 1] = spring.vertex1.id; + springRestLengthArray[i] = spring.vertex0.position.distanceTo(spring.vertex1.position); + } + + springVertexIdBuffer = instancedArray(springVertexIdArray, 'uvec2').setPBO(true); + springRestLengthBuffer = instancedArray(springRestLengthArray, 'float'); + springForceBuffer = instancedArray(springCount * 3, 'vec3').setPBO(true); +} + +function setupUniforms() { + dampeningUniform = uniform(0.99); + spherePositionUniform = uniform(new THREE.Vector3(0, 0, 0)); + sphereUniform = uniform(1.0); + windUniform = uniform(1.0); + stiffnessUniform = uniform(0.2); +} + +function setupComputeShaders() { + // This function sets up the compute shaders for the verlet simulation + // There are two shaders that are executed for each simulation step + + const vertexCount = verletVertices.length; + const springCount = verletSprings.length; + + // 1. computeSpringForces: + // This shader computes a force for each spring, depending on the distance between the two vertices connected by that spring and the targeted rest length + computeSpringForces = Fn(() => { + const vertexIds = springVertexIdBuffer.element(instanceIndex); + const restLength = springRestLengthBuffer.element(instanceIndex); + + const vertex0Position = vertexPositionBuffer.element(vertexIds.x); + const vertex1Position = vertexPositionBuffer.element(vertexIds.y); + + const delta = vertex1Position.sub(vertex0Position).toVar(); + const dist = delta.length().max(0.000001).toVar(); + const force = dist.sub(restLength).mul(stiffnessUniform).mul(delta).mul(0.5).div(dist); + springForceBuffer.element(instanceIndex).assign(force); + })() + .compute(springCount) + .setName('Spring Forces'); + + // 2. computeVertexForces: + // This shader accumulates the force for each vertex. + // First it iterates over all springs connected to this vertex and accumulates their forces. + // Then it adds a gravital force, wind force, and the collision with the sphere. + // In the end it adds the force to the vertex' position. + computeVertexForces = Fn(() => { + const params = vertexParamsBuffer.element(instanceIndex).toVar(); + const isFixed = params.x; + const springCount = params.y; + const springPointer = params.z; + + If(isFixed, () => { + // don't need to calculate vertex forces if the vertex is set as immovable + Return(); + }); + + const position = vertexPositionBuffer.element(instanceIndex).toVar('vertexPosition'); + const force = vertexForceBuffer.element(instanceIndex).toVar('vertexForce'); + + force.mulAssign(dampeningUniform); + + const ptrStart = springPointer.toVar('ptrStart'); + const ptrEnd = ptrStart.add(springCount).toVar('ptrEnd'); + + Loop({ start: ptrStart, end: ptrEnd, type: 'uint', condition: '<' }, ({ i }) => { + const springId = springListBuffer.element(i).toVar('springId'); + const springForce = springForceBuffer.element(springId); + const springVertexIds = springVertexIdBuffer.element(springId); + const factor = select(springVertexIds.x.equal(instanceIndex), 1.0, -1.0); + force.addAssign(springForce.mul(factor)); + }); + + // gravity + force.y.subAssign(0.00005); + + // wind + const noise = triNoise3D(position, 1, time).sub(0.2).mul(0.0001); + const windForce = noise.mul(windUniform); + force.z.subAssign(windForce); + + // collision with sphere + const deltaSphere = position.add(force).sub(spherePositionUniform); + const dist = deltaSphere.length(); + const sphereForce = float(sphereRadius).sub(dist).max(0).mul(deltaSphere).div(dist).mul(sphereUniform); + force.addAssign(sphereForce); + + vertexForceBuffer.element(instanceIndex).assign(force); + vertexPositionBuffer.element(instanceIndex).addAssign(force); + })() + .compute(vertexCount) + .setName('Vertex Forces'); +} + +function setupWireframe() { + // adds helpers to visualize the verlet system + + // verlet vertex visualizer + const vertexWireframeMaterial = new THREE.SpriteNodeMaterial(); + vertexWireframeMaterial.positionNode = vertexPositionBuffer.element(instanceIndex); + vertexWireframeObject = new THREE.Mesh(new THREE.PlaneGeometry(0.01, 0.01), vertexWireframeMaterial); + vertexWireframeObject.frustumCulled = false; + vertexWireframeObject.count = verletVertices.length; + scene.add(vertexWireframeObject); + + // verlet spring visualizer + const springWireframePositionBuffer = new THREE.BufferAttribute(new Float32Array(6), 3, false); + const springWireframeIndexBuffer = new THREE.BufferAttribute(new Uint32Array([0, 1]), 1, false); + const springWireframeMaterial = new THREE.LineBasicNodeMaterial(); + springWireframeMaterial.positionNode = Fn(() => { + const vertexIds = springVertexIdBuffer.element(instanceIndex); + const vertexId = select(attribute('vertexIndex').equal(0), vertexIds.x, vertexIds.y); + return vertexPositionBuffer.element(vertexId); + })(); + + const springWireframeGeometry = new THREE.InstancedBufferGeometry(); + springWireframeGeometry.setAttribute('position', springWireframePositionBuffer); + springWireframeGeometry.setAttribute('vertexIndex', springWireframeIndexBuffer); + springWireframeGeometry.instanceCount = verletSprings.length; + + springWireframeObject = new THREE.Line(springWireframeGeometry, springWireframeMaterial); + springWireframeObject.frustumCulled = false; + springWireframeObject.count = verletSprings.length; + scene.add(springWireframeObject); +} + +function setupSphere() { + const geometry = new THREE.IcosahedronGeometry(sphereRadius * 0.95, 4); + const material = new THREE.MeshStandardNodeMaterial(); + sphere = new THREE.Mesh(geometry, material); + scene.add(sphere); +} + +function setupClothMesh() { + // This function generates a three Geometry and Mesh to render the cloth based on the verlet systems position data. + // Therefore it creates a plane mesh, in which each vertex will be centered in the center of 4 verlet vertices. + + const vertexCount = clothNumSegmentsX * clothNumSegmentsY; + const geometry = new THREE.BufferGeometry(); + + // verletVertexIdArray will hold the 4 verlet vertex ids that contribute to each geometry vertex's position + const verletVertexIdArray = new Uint32Array(vertexCount * 4); + const indices = []; + + const getIndex = (x, y) => { + return y * clothNumSegmentsX + x; + }; + + for (let x = 0; x < clothNumSegmentsX; x++) { + for (let y = 0; y < clothNumSegmentsX; y++) { + const index = getIndex(x, y); + verletVertexIdArray[index * 4] = verletVertexColumns[x][y].id; + verletVertexIdArray[index * 4 + 1] = verletVertexColumns[x + 1][y].id; + verletVertexIdArray[index * 4 + 2] = verletVertexColumns[x][y + 1].id; + verletVertexIdArray[index * 4 + 3] = verletVertexColumns[x + 1][y + 1].id; + + if (x > 0 && y > 0) { + indices.push(getIndex(x, y), getIndex(x - 1, y), getIndex(x - 1, y - 1)); + indices.push(getIndex(x, y), getIndex(x - 1, y - 1), getIndex(x, y - 1)); + } + } + } + + const verletVertexIdBuffer = new THREE.BufferAttribute(verletVertexIdArray, 4, false); + const positionBuffer = new THREE.BufferAttribute(new Float32Array(vertexCount * 3), 3, false); + geometry.setAttribute('position', positionBuffer); + geometry.setAttribute('vertexIds', verletVertexIdBuffer); + geometry.setIndex(indices); + + clothMaterial = new THREE.MeshPhysicalNodeMaterial({ + color: new THREE.Color().setHex(API.color), + side: THREE.DoubleSide, + transparent: true, + opacity: 0.85, + sheen: 1.0, + sheenRoughness: 0.5, + sheenColor: new THREE.Color().setHex(API.sheenColor), + }); + + clothMaterial.positionNode = Fn(({ material }) => { + // gather the position of the 4 verlet vertices and calculate the center position and normal from that + const vertexIds = attribute('vertexIds'); + const v0 = vertexPositionBuffer.element(vertexIds.x).toVar(); + const v1 = vertexPositionBuffer.element(vertexIds.y).toVar(); + const v2 = vertexPositionBuffer.element(vertexIds.z).toVar(); + const v3 = vertexPositionBuffer.element(vertexIds.w).toVar(); + + const top = v0.add(v1); + const right = v1.add(v3); + const bottom = v2.add(v3); + const left = v0.add(v2); + + const tangent = right.sub(left).normalize(); + const bitangent = bottom.sub(top).normalize(); + + const normal = cross(tangent, bitangent); + + // send the normalView from the vertex shader to the fragment shader + material.normalNode = transformNormalToView(normal).toVarying(); + + return v0.add(v1).add(v2).add(v3).mul(0.25); + })(); + + clothMesh = new THREE.Mesh(geometry, clothMaterial); + clothMesh.frustumCulled = false; + scene.add(clothMesh); +} + +function setupCloth() { + setupVerletGeometry(); + setupVerletVertexBuffers(); + setupVerletSpringBuffers(); + setupUniforms(); + setupComputeShaders(); + setupWireframe(); + setupSphere(); + setupClothMesh(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function updateSphere() { + sphere.position.set(Math.sin(timestamp * 2.1) * 0.1, 0, Math.sin(timestamp * 0.8)); + spherePositionUniform.value.copy(sphere.position); +} + +async function render() { + timer.update(); + + sphere.visible = params.sphere; + sphereUniform.value = params.sphere ? 1 : 0; + windUniform.value = params.wind; + clothMesh.visible = !params.wireframe; + vertexWireframeObject.visible = params.wireframe; + springWireframeObject.visible = params.wireframe; + + const deltaTime = Math.min(timer.getDelta(), 1 / 60); // don't advance the time too far, for example when the window is out of focus + const stepsPerSecond = 360; // ensure the same amount of simulation steps per second on all systems, independent of refresh rate + const timePerStep = 1 / stepsPerSecond; + + timeSinceLastStep += deltaTime; + + while (timeSinceLastStep >= timePerStep) { + // run a verlet system simulation step + timestamp += timePerStep; + timeSinceLastStep -= timePerStep; + updateSphere(); + renderer.compute(computeSpringForces); + renderer.compute(computeVertexForces); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_geometry.ts b/examples-testing/examples/webgpu_compute_geometry.ts new file mode 100644 index 000000000..9299e215b --- /dev/null +++ b/examples-testing/examples/webgpu_compute_geometry.ts @@ -0,0 +1,190 @@ +import * as THREE from 'three/webgpu'; +import { + vec4, + storage, + Fn, + If, + uniform, + instanceIndex, + objectWorldMatrix, + color, + screenUV, + attribute, +} from 'three/tsl'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let raycaster, pointer; + +let mesh; + +const pointerPosition = uniform(vec4(0)); +const elasticity = uniform(0.4); // elasticity ( how "strong" the spring is ) +const damping = uniform(0.94); // damping factor ( energy loss ) +const brushSize = uniform(0.25); +const brushStrength = uniform(0.22); + +init(); + +const jelly = Fn(({ renderer, geometry, object }) => { + const count = geometry.attributes.position.count; + + // Create storage buffer attribute for modified position. + + const positionBaseAttribute = geometry.attributes.position; + const positionStorageBufferAttribute = new THREE.StorageBufferAttribute(count, 3); + const speedBufferAttribute = new THREE.StorageBufferAttribute(count, 3); + + geometry.setAttribute('storagePosition', positionStorageBufferAttribute); + + // Attributes + + const positionAttribute = storage(positionBaseAttribute, 'vec3', count); + const positionStorageAttribute = storage(positionStorageBufferAttribute, 'vec3', count); + + const speedAttribute = storage(speedBufferAttribute, 'vec3', count); + + // Vectors + + // Base vec3 position of the mesh vertices. + const basePosition = positionAttribute.element(instanceIndex); + // Mesh vertices after compute modification. + const currentPosition = positionStorageAttribute.element(instanceIndex); + // Speed of each mesh vertex. + const currentSpeed = speedAttribute.element(instanceIndex); + + // + + const computeInit = Fn(() => { + // Modified storage position starts out the same as the base position. + + currentPosition.assign(basePosition); + })().compute(count); + + // + + const computeUpdate = Fn(() => { + // pinch + + If(pointerPosition.w.equal(1), () => { + const worldPosition = objectWorldMatrix(object).mul(currentPosition); + + const dist = worldPosition.distance(pointerPosition.xyz); + const direction = pointerPosition.xyz.sub(worldPosition).normalize(); + + const power = brushSize.sub(dist).max(0).mul(brushStrength); + + currentPosition.addAssign(direction.mul(power)); + }); + + // compute ( jelly ) + + const distance = basePosition.distance(currentPosition); + const force = elasticity.mul(distance).mul(basePosition.sub(currentPosition)); + + currentSpeed.addAssign(force); + currentSpeed.mulAssign(damping); + + currentPosition.addAssign(currentSpeed); + })() + .compute(count) + .setName('Update Jelly'); + + // initialize the storage buffer with the base position + + computeUpdate.onInit(() => renderer.compute(computeInit)); + + // + + return computeUpdate; +}); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(0, 0, 1); + + scene = new THREE.Scene(); + + raycaster = new THREE.Raycaster(); + pointer = new THREE.Vector2(); + + // background + + const bgColor = screenUV.y.mix(color(0x9f87f7), color(0xf2cdcd)); + const bgVignette = screenUV.distance(0.5).remapClamp(0.3, 0.8).oneMinus(); + const bgIntensity = 4; + + scene.backgroundNode = bgColor.mul(bgVignette.mul(color(0xa78ff6).mul(bgIntensity))); + + // model + + new GLTFLoader().load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + // create jelly effect material + + const material = new THREE.MeshNormalNodeMaterial(); + material.geometryNode = jelly(); + material.positionNode = attribute('storagePosition'); + + // apply the material to the mesh + + mesh = gltf.scene.children[0]; + mesh.scale.setScalar(0.1); + mesh.material = material; + scene.add(mesh); + }); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 0.7; + controls.maxDistance = 2; + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(elasticity, 'value', 0, 0.5).name('elasticity'); + gui.add(damping, 'value', 0.9, 0.98).name('damping'); + gui.add(brushSize, 'value', 0.1, 0.5).name('brush size'); + gui.add(brushStrength, 'value', 0.1, 0.3).name('brush strength'); + + window.addEventListener('resize', onWindowResize); + window.addEventListener('pointermove', onPointerMove); +} + +function onPointerMove(event) { + pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObject(scene); + + if (intersects.length > 0) { + const intersect = intersects[0]; + + pointerPosition.value.copy(intersect.point); + pointerPosition.value.w = 1; // enable + } else { + pointerPosition.value.w = 0; // disable + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_particles.ts b/examples-testing/examples/webgpu_compute_particles.ts new file mode 100644 index 000000000..cc8b96417 --- /dev/null +++ b/examples-testing/examples/webgpu_compute_particles.ts @@ -0,0 +1,226 @@ +import * as THREE from 'three/webgpu'; +import { Fn, If, uniform, float, uv, vec3, hash, shapeCircle, instancedArray, instanceIndex } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +const particleCount = 200000; + +const gravity = uniform(-0.00098); +const bounce = uniform(0.8); +const friction = uniform(0.99); +const size = uniform(0.12); + +const clickPosition = uniform(new THREE.Vector3()); + +let camera, scene, renderer; +let controls; +let computeParticles; + +let isOrbitControlsActive; + +init(); + +async function init() { + const { innerWidth, innerHeight } = window; + + camera = new THREE.PerspectiveCamera(50, innerWidth / innerHeight, 0.1, 1000); + camera.position.set(0, 5, 20); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + // + + const positions = instancedArray(particleCount, 'vec3'); + const velocities = instancedArray(particleCount, 'vec3'); + const colors = instancedArray(particleCount, 'vec3'); + + // compute + + const separation = 0.2; + const amount = Math.sqrt(particleCount); + const offset = float(amount / 2); + + const computeInit = Fn(() => { + const position = positions.element(instanceIndex); + const color = colors.element(instanceIndex); + + const x = instanceIndex.mod(amount); + const z = instanceIndex.div(amount); + + position.x = offset.sub(x).mul(separation); + position.z = offset.sub(z).mul(separation); + + color.x = hash(instanceIndex); + color.y = hash(instanceIndex.add(2)); + })() + .compute(particleCount) + .setName('Init Particles'); + + // + + const computeUpdate = Fn(() => { + const position = positions.element(instanceIndex); + const velocity = velocities.element(instanceIndex); + + velocity.addAssign(vec3(0.0, gravity, 0.0)); + position.addAssign(velocity); + + velocity.mulAssign(friction); + + // floor + + If(position.y.lessThan(0), () => { + position.y = 0; + velocity.y = velocity.y.negate().mul(bounce); + + // floor friction + + velocity.x = velocity.x.mul(0.9); + velocity.z = velocity.z.mul(0.9); + }); + }); + + computeParticles = computeUpdate().compute(particleCount).setName('Update Particles'); + + // create particles + + const material = new THREE.SpriteNodeMaterial(); + material.colorNode = uv().mul(colors.element(instanceIndex)); + material.positionNode = positions.toAttribute(); + material.scaleNode = size; + material.opacityNode = shapeCircle(); + material.alphaToCoverage = true; + material.transparent = true; + + const particles = new THREE.Sprite(material); + particles.count = particleCount; + particles.frustumCulled = false; + scene.add(particles); + + // + + const helper = new THREE.GridHelper(90, 45, 0x303030, 0x303030); + scene.add(helper); + + const geometry = new THREE.PlaneGeometry(200, 200); + geometry.rotateX(-Math.PI / 2); + + const plane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ visible: false })); + scene.add(plane); + + const raycaster = new THREE.Raycaster(); + const pointer = new THREE.Vector2(); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // + + renderer.compute(computeInit); + + // Hit + + const computeHit = Fn(() => { + const position = positions.element(instanceIndex); + const velocity = velocities.element(instanceIndex); + + const dist = position.distance(clickPosition); + const direction = position.sub(clickPosition).normalize(); + const distArea = float(3).sub(dist).max(0); + + const power = distArea.mul(0.01); + const relativePower = power.mul(hash(instanceIndex).mul(1.5).add(0.5)); + + velocity.assign(velocity.add(direction.mul(relativePower))); + })() + .compute(particleCount) + .setName('Hit Particles'); + + // + + function onMove(event) { + if (isOrbitControlsActive) return; + + pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObject(plane, false); + + if (intersects.length > 0) { + const { point } = intersects[0]; + + // move to uniform + + clickPosition.value.copy(point); + clickPosition.value.y = -1; + + // compute + + renderer.compute(computeHit); + } + } + + renderer.domElement.addEventListener('pointermove', onMove); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 5; + controls.maxDistance = 200; + controls.target.set(0, -8, 0); + controls.update(); + + controls.addEventListener('start', () => { + isOrbitControlsActive = true; + }); + controls.addEventListener('end', () => { + isOrbitControlsActive = false; + }); + + controls.touches = { + ONE: null, + TWO: THREE.TOUCH.DOLLY_PAN, + }; + + // + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(gravity, 'value', -0.0098, 0, 0.0001).name('gravity'); + gui.add(bounce, 'value', 0.1, 1, 0.01).name('bounce'); + gui.add(friction, 'value', 0.96, 0.99, 0.01).name('friction'); + gui.add(size, 'value', 0.12, 0.5, 0.01).name('size'); +} + +function onWindowResize() { + const { innerWidth, innerHeight } = window; + + camera.aspect = innerWidth / innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(innerWidth, innerHeight); +} + +function animate() { + controls.update(); + + renderer.compute(computeParticles); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_particles_rain.ts b/examples-testing/examples/webgpu_compute_particles_rain.ts new file mode 100644 index 000000000..2ad22271b --- /dev/null +++ b/examples-testing/examples/webgpu_compute_particles_rain.ts @@ -0,0 +1,334 @@ +import * as THREE from 'three/webgpu'; +import { + Fn, + texture, + uv, + uint, + instancedArray, + positionWorld, + billboarding, + time, + hash, + deltaTime, + vec2, + instanceIndex, + positionGeometry, + If, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; + +const maxParticleCount = 50000; +const instanceCount = maxParticleCount / 2; + +let camera, scene, renderer; +let controls; +let computeParticles; +let monkey; +let timer; + +let collisionBox, collisionCamera, collisionPosRT, collisionPosMaterial; +let collisionBoxPos, collisionBoxPosUI; + +init(); + +async function init() { + const { innerWidth, innerHeight } = window; + + camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 0.1, 110); + camera.position.set(40, 8, 0); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + const dirLight = new THREE.DirectionalLight(0xffffff, 0.5); + dirLight.position.set(3, 17, 17); + scene.add(dirLight); + + scene.add(new THREE.AmbientLight(0x111111)); + + // + + collisionCamera = new THREE.OrthographicCamera(-50, 50, 50, -50, 0.1, 50); + collisionCamera.position.y = 50; + collisionCamera.lookAt(0, 0, 0); + collisionCamera.layers.disableAll(); + collisionCamera.layers.enable(1); + + collisionPosRT = new THREE.RenderTarget(1024, 1024); + collisionPosRT.texture.type = THREE.HalfFloatType; + collisionPosRT.texture.magFilter = THREE.NearestFilter; + collisionPosRT.texture.minFilter = THREE.NearestFilter; + collisionPosRT.texture.generateMipmaps = false; + + collisionPosMaterial = new THREE.MeshBasicNodeMaterial(); + collisionPosMaterial.colorNode = positionWorld; + + // + + const positionBuffer = instancedArray(maxParticleCount, 'vec3'); + const velocityBuffer = instancedArray(maxParticleCount, 'vec3'); + const ripplePositionBuffer = instancedArray(maxParticleCount, 'vec3'); + const rippleTimeBuffer = instancedArray(maxParticleCount, 'vec3'); + + // compute + + const randUint = () => uint(Math.random() * 0xffffff); + + const computeInit = Fn(() => { + const position = positionBuffer.element(instanceIndex); + const velocity = velocityBuffer.element(instanceIndex); + const ripplePosition = ripplePositionBuffer.element(instanceIndex); + const rippleTime = rippleTimeBuffer.element(instanceIndex); + + const randX = hash(instanceIndex); + const randY = hash(instanceIndex.add(randUint())); + const randZ = hash(instanceIndex.add(randUint())); + + position.x = randX.mul(100).add(-50); + position.y = randY.mul(25); + position.z = randZ.mul(100).add(-50); + + velocity.y = randX.mul(-0.04).add(-0.2); + + ripplePosition.x = randZ.mul(100).add(-50); + ripplePosition.y = -1; + ripplePosition.z = randY.mul(100).add(-50); + + rippleTime.x = 1000; + })().compute(maxParticleCount); + + // + + const computeUpdate = Fn(() => { + const getCoord = pos => pos.add(50).div(100); + + const position = positionBuffer.element(instanceIndex); + const velocity = velocityBuffer.element(instanceIndex); + const ripplePosition = ripplePositionBuffer.element(instanceIndex); + const rippleTime = rippleTimeBuffer.element(instanceIndex); + + position.addAssign(velocity); + + rippleTime.x = rippleTime.x.add(deltaTime.mul(4)); + + // + + const collisionArea = texture(collisionPosRT.texture, getCoord(position.xz)); + + const surfaceOffset = 0.05; + + const floorPosition = collisionArea.y.add(surfaceOffset); + + // floor + + const ripplePivotOffsetY = -0.9; + + If(position.y.add(ripplePivotOffsetY).lessThan(floorPosition), () => { + position.y = 25; + + ripplePosition.xz = position.xz; + ripplePosition.y = floorPosition; + + // reset hit time: x = time + + rippleTime.x = 1; + + // next drops will not fall in the same place + + position.x = hash(instanceIndex.add(time)).mul(100).add(-50); + position.z = hash(instanceIndex.add(time.add(randUint()))) + .mul(100) + .add(-50); + }); + + const rippleOnSurface = texture(collisionPosRT.texture, getCoord(ripplePosition.xz)); + + const rippleFloorArea = rippleOnSurface.y.add(surfaceOffset); + + If(ripplePosition.y.greaterThan(rippleFloorArea), () => { + rippleTime.x = 1000; + }); + }); + + computeParticles = computeUpdate().compute(maxParticleCount).setName('Particles'); + + // rain + + const rainMaterial = new THREE.MeshBasicNodeMaterial(); + rainMaterial.colorNode = uv().distance(vec2(0.5, 0)).oneMinus().mul(3).exp().mul(0.1); + rainMaterial.positionNode = positionGeometry.add(positionBuffer.toAttribute()); + rainMaterial.vertexNode = billboarding({ horizontalRotation: true }); + rainMaterial.opacity = 0.2; + rainMaterial.depthWrite = false; + rainMaterial.depthTest = true; + rainMaterial.transparent = true; + + const rainParticles = new THREE.Mesh(new THREE.PlaneGeometry(0.1, 2), rainMaterial); + rainParticles.count = instanceCount; + scene.add(rainParticles); + + // ripple + + const rippleTime = rippleTimeBuffer.element(instanceIndex).x; + + const rippleEffect = Fn(() => { + const center = uv().add(vec2(-0.5)).length().mul(7); + const distance = rippleTime.sub(center); + + return distance.min(1).sub(distance.max(1).sub(1)); + }); + + const rippleMaterial = new THREE.MeshBasicNodeMaterial(); + rippleMaterial.colorNode = rippleEffect(); + rippleMaterial.positionNode = positionGeometry.add(ripplePositionBuffer.toAttribute()); + rippleMaterial.opacityNode = rippleTime.mul(0.3).oneMinus().max(0).mul(0.5); + rippleMaterial.side = THREE.DoubleSide; + rippleMaterial.forceSinglePass = true; + rippleMaterial.depthWrite = false; + rippleMaterial.depthTest = true; + rippleMaterial.transparent = true; + + // ripple geometry + + const surfaceRippleGeometry = new THREE.PlaneGeometry(2.5, 2.5); + surfaceRippleGeometry.rotateX(-Math.PI / 2); + + const xRippleGeometry = new THREE.PlaneGeometry(1, 2); + xRippleGeometry.rotateY(-Math.PI / 2); + + const zRippleGeometry = new THREE.PlaneGeometry(1, 2); + + const rippleGeometry = BufferGeometryUtils.mergeGeometries([ + surfaceRippleGeometry, + xRippleGeometry, + zRippleGeometry, + ]); + + const rippleParticles = new THREE.Mesh(rippleGeometry, rippleMaterial); + rippleParticles.count = instanceCount; + scene.add(rippleParticles); + + // floor geometry + + const floorGeometry = new THREE.PlaneGeometry(1000, 1000); + floorGeometry.rotateX(-Math.PI / 2); + + const plane = new THREE.Mesh(floorGeometry, new THREE.MeshBasicMaterial({ color: 0x050505 })); + scene.add(plane); + + // + + collisionBox = new THREE.Mesh(new THREE.BoxGeometry(30, 1, 15), new THREE.MeshStandardMaterial()); + collisionBox.material.color.set(0x333333); + collisionBox.position.y = 12; + collisionBox.scale.x = 3.5; + collisionBox.layers.enable(1); + scene.add(collisionBox); + + // + + const loader = new THREE.BufferGeometryLoader(); + loader.load('models/json/suzanne_buffergeometry.json', function (geometry) { + geometry.computeVertexNormals(); + + monkey = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial({ roughness: 1, metalness: 0 })); + monkey.scale.setScalar(5); + monkey.rotation.y = Math.PI / 2; + monkey.position.y = 4.5; + monkey.layers.enable(1); // add to collision layer + + scene.add(monkey); + }); + + // + + timer = new THREE.Timer(); + timer.connect(document); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // + + renderer.compute(computeInit); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 5; + controls.maxDistance = 50; + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + + // use lerp to smooth the movement + collisionBoxPosUI = new THREE.Vector3().copy(collisionBox.position); + collisionBoxPos = new THREE.Vector3(); + + gui.add(collisionBoxPosUI, 'z', -50, 50, 0.001).name('position'); + gui.add(collisionBox.scale, 'x', 0.1, 3.5, 0.01).name('scale'); + gui.add(rainParticles, 'count', 200, maxParticleCount, 1) + .name('drop count') + .onChange(v => (rippleParticles.count = v)); +} + +function onWindowResize() { + const { innerWidth, innerHeight } = window; + + camera.aspect = innerWidth / innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(innerWidth, innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (monkey) { + monkey.rotation.y += delta; + } + + collisionBoxPos.set(collisionBoxPosUI.x, collisionBoxPosUI.y, -collisionBoxPosUI.z); + + collisionBox.position.lerp(collisionBoxPos, 10 * delta); + + // position + + scene.overrideMaterial = collisionPosMaterial; + scene.name = 'Collision Scene'; + renderer.setRenderTarget(collisionPosRT); + renderer.render(scene, collisionCamera); + + // compute + + renderer.compute(computeParticles); + + // result + + scene.overrideMaterial = null; + scene.name = 'Scene'; + renderer.setRenderTarget(null); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_particles_snow.ts b/examples-testing/examples/webgpu_compute_particles_snow.ts new file mode 100644 index 000000000..da365200c --- /dev/null +++ b/examples-testing/examples/webgpu_compute_particles_snow.ts @@ -0,0 +1,331 @@ +import * as THREE from 'three/webgpu'; +import { + Fn, + texture, + vec3, + pass, + color, + uint, + screenUV, + instancedArray, + positionWorld, + positionLocal, + time, + vec2, + hash, + instanceIndex, + If, +} from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +const maxParticleCount = 100000; + +let camera, scene, renderer; +let controls; +let computeParticles; +let renderPipeline; + +let collisionCamera, collisionPosRT, collisionPosMaterial; + +init(); + +async function init() { + const { innerWidth, innerHeight } = window; + + camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 0.1, 100); + camera.position.set(20, 2, 20); + camera.layers.enable(2); + camera.lookAt(0, 40, 0); + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x0f3c37, 5, 40); + + const dirLight = new THREE.DirectionalLight(0xf9ff9b, 9); + dirLight.position.set(10, 10, 0); + scene.add(dirLight); + + scene.add(new THREE.HemisphereLight(0x0f3c37, 0x080d10, 100)); + + // + + collisionCamera = new THREE.OrthographicCamera(-50, 50, 50, -50, 0.1, 50); + collisionCamera.position.y = 50; + collisionCamera.lookAt(0, 0, 0); + collisionCamera.layers.enable(1); + + collisionPosRT = new THREE.RenderTarget(1024, 1024); + collisionPosRT.texture.format = THREE.RedFormat; + collisionPosRT.texture.type = THREE.HalfFloatType; + collisionPosRT.texture.magFilter = THREE.NearestFilter; + collisionPosRT.texture.minFilter = THREE.NearestFilter; + collisionPosRT.texture.generateMipmaps = false; + + collisionPosMaterial = new THREE.MeshBasicNodeMaterial(); + collisionPosMaterial.blending = THREE.NoBlending; + collisionPosMaterial.fog = false; + collisionPosMaterial.toneMapped = false; + collisionPosMaterial.colorNode = positionWorld.y; + + // + + const positionBuffer = instancedArray(maxParticleCount, 'vec3'); + const scaleBuffer = instancedArray(maxParticleCount, 'vec3'); + const staticPositionBuffer = instancedArray(maxParticleCount, 'vec3'); + const dataBuffer = instancedArray(maxParticleCount, 'vec4'); + + // compute + + const randUint = () => uint(Math.random() * 0xffffff); + + const computeInit = Fn(() => { + const position = positionBuffer.element(instanceIndex); + const scale = scaleBuffer.element(instanceIndex); + const particleData = dataBuffer.element(instanceIndex); + + const randX = hash(instanceIndex); + const randY = hash(instanceIndex.add(randUint())); + const randZ = hash(instanceIndex.add(randUint())); + + position.x = randX.mul(100).add(-50); + position.y = randY.mul(500).add(3); + position.z = randZ.mul(100).add(-50); + + scale.xyz = hash(instanceIndex.add(Math.random())).mul(0.8).add(0.2); + + staticPositionBuffer.element(instanceIndex).assign(vec3(1000, 10000, 1000)); + + particleData.y = randY.mul(-0.1).add(-0.02); + + particleData.x = position.x; + particleData.z = position.z; + particleData.w = randX; + })() + .compute(maxParticleCount) + .setName('Init Particles'); + + // + + const surfaceOffset = 0.2; + const speed = 0.4; + + const computeUpdate = Fn(() => { + const getCoord = pos => pos.add(50).div(100); + + const position = positionBuffer.element(instanceIndex); + const scale = scaleBuffer.element(instanceIndex); + const particleData = dataBuffer.element(instanceIndex); + + const velocity = particleData.y; + const random = particleData.w; + + const rippleOnSurface = texture(collisionPosRT.texture, getCoord(position.xz)).toInspector( + 'Collision Test', + () => { + return texture(collisionPosRT.texture); // .div( collisionCamera.position.y ); + }, + ); + + const rippleFloorArea = rippleOnSurface.add(scale.x.mul(surfaceOffset)); + + If(position.y.greaterThan(rippleFloorArea), () => { + position.x = particleData.x.add(time.mul(random.mul(random)).mul(speed).sin().mul(3)); + position.z = particleData.z.add(time.mul(random).mul(speed).cos().mul(random.mul(10))); + + position.y = position.y.add(velocity); + }).Else(() => { + staticPositionBuffer.element(instanceIndex).assign(position); + }); + }); + + computeParticles = computeUpdate().compute(maxParticleCount); + computeParticles.name = 'Update Particles'; + + // rain + + const geometry = new THREE.SphereGeometry(surfaceOffset, 5, 5); + + function particle(staticParticles) { + const posBuffer = staticParticles ? staticPositionBuffer : positionBuffer; + const layer = staticParticles ? 1 : 2; + + const staticMaterial = new THREE.MeshStandardNodeMaterial({ + color: 0xeeeeee, + roughness: 0.9, + metalness: 0, + }); + + staticMaterial.positionNode = positionLocal.mul(scaleBuffer.toAttribute()).add(posBuffer.toAttribute()); + + const rainParticles = new THREE.Mesh(geometry, staticMaterial); + rainParticles.count = maxParticleCount; + rainParticles.layers.disableAll(); + rainParticles.layers.enable(layer); + + return rainParticles; + } + + const dynamicParticles = particle(); + const staticParticles = particle(true); + + scene.add(dynamicParticles); + scene.add(staticParticles); + + // floor geometry + + const floorGeometry = new THREE.PlaneGeometry(100, 100); + floorGeometry.rotateX(-Math.PI / 2); + + const plane = new THREE.Mesh( + floorGeometry, + new THREE.MeshStandardMaterial({ + color: 0x0c1e1e, + roughness: 0.5, + metalness: 0, + transparent: true, + }), + ); + + plane.material.opacityNode = positionLocal.xz.mul(0.05).distance(0).saturate().oneMinus(); + + scene.add(plane); + + // tree + + function tree(count = 8) { + const coneMaterial = new THREE.MeshStandardNodeMaterial({ + color: 0x0d492c, + roughness: 0.6, + metalness: 0, + }); + + const object = new THREE.Group(); + + for (let i = 0; i < count; i++) { + const radius = 1 + i; + + const coneGeometry = new THREE.ConeGeometry(radius * 0.95, radius * 1.25, 32); + + const cone = new THREE.Mesh(coneGeometry, coneMaterial); + cone.position.y = (count - i) * 1.5 + count * 0.6; + object.add(cone); + } + + const geometry = new THREE.CylinderGeometry(1, 1, count, 32); + const cone = new THREE.Mesh(geometry, coneMaterial); + cone.position.y = count / 2; + object.add(cone); + + return object; + } + + const teapotTree = new THREE.Mesh( + new TeapotGeometry(0.5, 18), + new THREE.MeshBasicNodeMaterial({ + color: 0xfcfb9e, + }), + ); + + teapotTree.name = 'Teapot Pass'; + teapotTree.position.y = 18; + + scene.add(tree()); + scene.add(teapotTree); + + // + + scene.backgroundNode = screenUV.distance(0.5).mul(2).mix(color(0x0f4140), color(0x060a0d)); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setClearColor(0x000000); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 10, 0); + controls.minDistance = 25; + controls.maxDistance = 35; + controls.maxPolarAngle = Math.PI / 1.7; + controls.autoRotate = true; + controls.autoRotateSpeed = -0.7; + controls.update(); + + // post processing + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode(); + const vignette = screenUV.distance(0.5).mul(1.35).clamp().oneMinus(); + + const teapotTreePass = pass(teapotTree, camera).getTextureNode(); + const teapotTreePassBlurred = gaussianBlur(teapotTreePass, vec2(1), 6); + teapotTreePassBlurred.resolutionScale = 0.2; + + const scenePassColorBlurred = gaussianBlur(scenePassColor); + scenePassColorBlurred.resolutionScale = 0.5; + scenePassColorBlurred.directionNode = vec2(1); + + // compose + + let totalPass = scenePass.toInspector('Scene'); + totalPass = totalPass.add(scenePassColorBlurred.mul(0.1)); + totalPass = totalPass.mul(vignette); + totalPass = totalPass.add(teapotTreePass.mul(10).add(teapotTreePassBlurred).toInspector('Teapot Blur')); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = totalPass; + + // + + renderer.compute(computeInit); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const { innerWidth, innerHeight } = window; + + camera.aspect = innerWidth / innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(innerWidth, innerHeight); +} + +function animate() { + controls.update(); + + // position + + scene.name = 'Collider Position'; + scene.overrideMaterial = collisionPosMaterial; + renderer.setRenderTarget(collisionPosRT); + renderer.render(scene, collisionCamera); + + // compute + + renderer.compute(computeParticles); + + // result + + scene.name = 'Scene'; + scene.overrideMaterial = null; + renderer.setRenderTarget(null); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_compute_points.ts b/examples-testing/examples/webgpu_compute_points.ts new file mode 100644 index 000000000..eab1d9f61 --- /dev/null +++ b/examples-testing/examples/webgpu_compute_points.ts @@ -0,0 +1,124 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { Fn, uniform, instancedArray, float, vec2, color, instanceIndex } from 'three/tsl'; + +let camera, scene, renderer; +let computeNode; + +const pointerVector = new THREE.Vector2(-10.0, -10.0); // Out of bounds first +const scaleVector = new THREE.Vector2(1, 1); + +init(); + +async function init() { + camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, 0, 1); + camera.position.z = 1; + + scene = new THREE.Scene(); + + // initialize particles + + const particlesCount = 300000; + + const particleArray = instancedArray(particlesCount, 'vec2'); + const velocityArray = instancedArray(particlesCount, 'vec2'); + + // create function + + const computeShaderFn = Fn(() => { + const particle = particleArray.element(instanceIndex); + const velocity = velocityArray.element(instanceIndex); + + const pointer = uniform(pointerVector); + const limit = uniform(scaleVector); + + const position = particle.add(velocity).toVar(); + + velocity.x = position.x.abs().greaterThanEqual(limit.x).select(velocity.x.negate(), velocity.x); + velocity.y = position.y.abs().greaterThanEqual(limit.y).select(velocity.y.negate(), velocity.y); + + position.assign(position.min(limit).max(limit.negate())); + + const pointerSize = 0.1; + const distanceFromPointer = pointer.sub(position).length(); + + particle.assign(distanceFromPointer.lessThanEqual(pointerSize).select(vec2(), position)); + }); + + // compute + + computeNode = computeShaderFn().compute(particlesCount).setName('Update Particles'); + computeNode.onInit(({ renderer }) => { + const precomputeShaderNode = Fn(() => { + const particleIndex = float(instanceIndex); + + const randomAngle = particleIndex.mul(0.005).mul(Math.PI * 2); + const randomSpeed = particleIndex.mul(0.00000001).add(0.0000001); + + const velX = randomAngle.sin().mul(randomSpeed); + const velY = randomAngle.cos().mul(randomSpeed); + + const velocity = velocityArray.element(instanceIndex); + + velocity.xy = vec2(velX, velY); + }); + + renderer.compute(precomputeShaderNode().compute(particlesCount)); + }); + + // use a compute shader to animate the point cloud's vertex data. + + const pointsGeometry = new THREE.BufferGeometry(); + pointsGeometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(3), 3)); // single vertex ( not triangle ) + pointsGeometry.drawRange.count = 1; // force render points as instances ( not triangle ) + + const pointsMaterial = new THREE.PointsNodeMaterial(); + pointsMaterial.colorNode = particleArray.element(instanceIndex).add(color(0xffffff)); + pointsMaterial.positionNode = particleArray.element(instanceIndex); + + const mesh = new THREE.Points(pointsGeometry, pointsMaterial); + mesh.count = particlesCount; + scene.add(mesh); + + renderer = new THREE.WebGPURenderer({ antialias: true, requiredLimits: { maxStorageBuffersInVertexStage: 1 } }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + window.addEventListener('resize', onWindowResize); + window.addEventListener('mousemove', onMouseMove); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(scaleVector, 'x', 0, 1, 0.01); + gui.add(scaleVector, 'y', 0, 1, 0.01); +} + +function onWindowResize() { + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onMouseMove(event) { + const x = event.clientX; + const y = event.clientY; + + const width = window.innerWidth; + const height = window.innerHeight; + + pointerVector.set((x / width - 0.5) * 2.0, (-y / height + 0.5) * 2.0); +} + +function animate() { + renderer.compute(computeNode); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_sort_bitonic.ts b/examples-testing/examples/webgpu_compute_sort_bitonic.ts new file mode 100644 index 000000000..9a37a9ece --- /dev/null +++ b/examples-testing/examples/webgpu_compute_sort_bitonic.ts @@ -0,0 +1,457 @@ +import * as THREE from 'three/webgpu'; +import { storage, If, vec3, not, uniform, uv, uint, Fn, vec2, abs, int, uvec2, floor, instanceIndex } from 'three/tsl'; + +import { BitonicSort, getBitonicDisperseIndices, getBitonicFlipIndices } from 'three/addons/gpgpu/BitonicSort.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +const StepType = { + NONE: 0, + // Swap values within workgroup local values + SWAP_LOCAL: 1, + DISPERSE_LOCAL: 2, + // Swap values within global data buffer. + FLIP_GLOBAL: 3, + DISPERSE_GLOBAL: 4, +}; + +const timestamps = { + local_swap: document.getElementById('local_swap'), + global_swap: document.getElementById('global_swap'), +}; + +const localColors = ['rgb(203, 64, 203)', 'rgb(0, 215, 215)']; +const globalColors = ['rgb(1, 150, 1)', 'red']; + +// Total number of elements and the dimensions of the display grid. +const size = 16384; +const gridDim = Math.sqrt(size); + +const getNumSteps = () => { + const n = Math.log2(size); + return (n * (n + 1)) / 2; +}; + +// Total number of steps in a bitonic sort with 'size' elements. +const MAX_STEPS = getNumSteps(); + +const effectController = { + // Sqr root of 16834 + gridWidth: uniform(gridDim), + gridHeight: uniform(gridDim), + highlight: uniform(1), + stepBitonic: true, + 'Display Mode': 'Swap Zone Highlight', +}; + +const gui = new GUI(); +gui.add(effectController, 'Display Mode', ['Elements', 'Swap Zone Highlight']).onChange(() => { + if (effectController['Display Mode'] === 'Elements') { + effectController.highlight.value = 0; + } else { + effectController.highlight.value = 1; + } +}); + +if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); +} + +// Display utilities + +const getElementIndex = Fn( + ([uvNode, gridWidth, gridHeight]) => { + const newUV = uvNode.mul(vec2(gridWidth, gridHeight)); + const pixel = uvec2(uint(floor(newUV.x)), uint(floor(newUV.y))); + const elementIndex = uint(gridWidth).mul(pixel.y).add(pixel.x); + + return elementIndex; + }, + { + uvNode: 'vec2', + gridWidth: 'uint', + gridHeight: 'uint', + return: 'uint', + }, +); + +const getColor = Fn( + ([colorChanger, gridWidth, gridHeight]) => { + const subtracter = colorChanger.div(gridWidth.mul(gridHeight)); + return vec3(subtracter.oneMinus()).toVar(); + }, + { + colorChanger: 'float', + gridWidth: 'float', + gridHeight: 'float', + return: 'vec3', + }, +); + +const randomizeDataArray = array => { + let currentIndex = array.length; + while (currentIndex !== 0) { + const randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; + } +}; + +const windowResizeCallback = (renderer, scene, camera) => { + renderer.setSize(window.innerWidth / 2, window.innerHeight); + const aspect = window.innerWidth / 2 / window.innerHeight; + const frustumHeight = camera.top - camera.bottom; + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + camera.updateProjectionMatrix(); + renderer.render(scene, camera); +}; + +const constructInnerHTML = (isGlobal, colorsArr) => { + return ` + + Compute ${isGlobal ? 'Global' : 'Local'}: +
+ ${isGlobal ? 'Global Swaps' : 'Local Swaps'} Compare Region  +
+  to Region  +
+
`; +}; + +const createDisplayMesh = (elementsStorage, algoStorage = null, blockHeightStorage = null) => { + const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); + + const display = Fn(() => { + const { gridWidth, gridHeight, highlight } = effectController; + + const elementIndex = getElementIndex(uv(), gridWidth, gridHeight); + const color = getColor(elementsStorage.element(elementIndex), gridWidth, gridHeight).toVar(); + + if (algoStorage !== null && blockHeightStorage !== null) { + If(highlight.equal(1).and(not(algoStorage.element(0).equal(StepType.NONE))), () => { + const boolCheck = int( + elementIndex.mod(blockHeightStorage.element(0)).lessThan(blockHeightStorage.element(0).div(2)), + ); + color.z.assign(algoStorage.element(0).lessThanEqual(StepType.DISPERSE_LOCAL)); + color.x.mulAssign(boolCheck); + color.y.mulAssign(abs(boolCheck.sub(1))); + }); + } + + return color; + }); + + material.colorNode = display(); + const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + return plane; +}; + +const createDisplayMesh2 = (elementsStorage, infoStorage) => { + const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); + + const display = Fn(() => { + const { gridWidth, gridHeight, highlight } = effectController; + + const elementIndex = getElementIndex(uv(), gridWidth, gridHeight); + const color = getColor(elementsStorage.element(elementIndex), gridWidth, gridHeight).toVar(); + + If(highlight.equal(1).and(not(infoStorage.element(0).equal(StepType.SWAP_LOCAL))), () => { + const boolCheck = int(elementIndex.mod(infoStorage.element(1)).lessThan(infoStorage.element(1).div(2))); + color.z.assign(infoStorage.element(0).lessThanEqual(StepType.DISPERSE_LOCAL)); + color.x.mulAssign(boolCheck); + color.y.mulAssign(abs(boolCheck.sub(1))); + }); + + return color; + }); + + material.colorNode = display(); + const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + return plane; +}; + +const setupDomElement = renderer => { + document.body.appendChild(renderer.domElement); + renderer.domElement.style.position = 'absolute'; + renderer.domElement.style.top = '0'; + renderer.domElement.style.left = '0'; + renderer.domElement.style.width = '50%'; + renderer.domElement.style.height = '100%'; +}; + +async function initBitonicSort() { + let currentStep = 0; + + const aspect = window.innerWidth / 2 / window.innerHeight; + const camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); + camera.position.z = 1; + + const scene = new THREE.Scene(); + + const array = new Uint32Array( + Array.from({ length: size }, (_, i) => { + return i; + }), + ); + + randomizeDataArray(array); + + const currentElementsBuffer = new THREE.StorageInstancedBufferAttribute(array, 1); + const currentElementsStorage = storage(currentElementsBuffer, 'uint', size).setPBO(true).setName('Elements'); + const randomizedElementsBuffer = new THREE.StorageInstancedBufferAttribute(size, 1); + const randomizedElementsStorage = storage(randomizedElementsBuffer, 'uint', size) + .setPBO(true) + .setName('RandomizedElements'); + + const computeInitFn = Fn(() => { + randomizedElementsStorage.element(instanceIndex).assign(currentElementsStorage.element(instanceIndex)); + }); + + const computeResetBuffersFn = Fn(() => { + currentElementsStorage.element(instanceIndex).assign(randomizedElementsStorage.element(instanceIndex)); + }); + + const renderer = new THREE.WebGPURenderer({ antialias: false }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth / 2, window.innerHeight); + + await renderer.init(); + + const animate = () => { + renderer.render(scene, camera); + }; + + renderer.setAnimationLoop(animate); + setupDomElement(renderer); + scene.background = new THREE.Color(0x313131); + + const bitonicSortModule = new BitonicSort(renderer, currentElementsStorage, { + workgroupSize: 64, + }); + + scene.add(createDisplayMesh2(currentElementsStorage, bitonicSortModule.infoStorage)); + + // Initialize each value in the elements buffer. + const computeInit = computeInitFn().compute(size); + const computeReset = computeResetBuffersFn().compute(size); + + renderer.compute(computeInit); + + const stepAnimation = async function () { + renderer.info.reset(); + + if (currentStep < bitonicSortModule.stepCount) { + bitonicSortModule.computeStep(renderer); + + currentStep++; + } else { + renderer.compute(computeReset); + + currentStep = 0; + } + + timestamps['local_swap'].innerHTML = constructInnerHTML(false, localColors); + + if (currentStep === bitonicSortModule.stepCount) { + setTimeout(stepAnimation, 1000); + } else { + setTimeout(stepAnimation, 100); + } + }; + + stepAnimation(); + + window.addEventListener('resize', onWindowResize); + + function onWindowResize() { + windowResizeCallback(renderer, scene, camera); + } +} + +initBitonicSort(); + +// Global Swaps Only +initGlobalSwapOnly(); + +// When forceGlobalSwap is true, force all valid local swaps to be global swaps. +async function initGlobalSwapOnly() { + let currentStep = 0; + + const aspect = window.innerWidth / 2 / window.innerHeight; + const camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); + camera.position.z = 1; + + const scene = new THREE.Scene(); + + const infoArray = new Uint32Array([3, 2, 2]); + const infoBuffer = new THREE.StorageInstancedBufferAttribute(infoArray, 1); + const infoStorage = storage(infoBuffer, 'uint', infoBuffer.count).setPBO(true).setName('TheInfo'); + + const nextBlockHeightBuffer = new THREE.StorageInstancedBufferAttribute(new Uint32Array(1).fill(2), 1); + const nextBlockHeightStorage = storage(nextBlockHeightBuffer, 'uint', nextBlockHeightBuffer.count) + .setPBO(true) + .setName('NextBlockHeight'); + const nextBlockHeightRead = storage(nextBlockHeightBuffer, 'uint', nextBlockHeightBuffer.count) + .setPBO(true) + .setName('NextBlockHeight') + .toReadOnly(); + + const array = new Uint32Array( + Array.from({ length: size }, (_, i) => { + return i; + }), + ); + + randomizeDataArray(array); + + const currentElementsBuffer = new THREE.StorageInstancedBufferAttribute(array, 1); + const currentElementsStorage = storage(currentElementsBuffer, 'uint', size).setPBO(true).setName('Elements'); + const tempBuffer = new THREE.StorageInstancedBufferAttribute(array, 1); + const tempStorage = storage(tempBuffer, 'uint', size).setPBO(true).setName('Temp'); + const randomizedElementsBuffer = new THREE.StorageInstancedBufferAttribute(size, 1); + const randomizedElementsStorage = storage(randomizedElementsBuffer, 'uint', size) + .setPBO(true) + .setName('RandomizedElements'); + + // Swap the elements in local storage + const globalCompareAndSwap = (idxBefore, idxAfter) => { + // If the later element is less than the current element + If(currentElementsStorage.element(idxAfter).lessThan(currentElementsStorage.element(idxBefore)), () => { + // Apply the swapped values to temporary storage. + tempStorage.element(idxBefore).assign(currentElementsStorage.element(idxAfter)); + tempStorage.element(idxAfter).assign(currentElementsStorage.element(idxBefore)); + }).Else(() => { + // Otherwise apply the existing values to temporary storage. + tempStorage.element(idxBefore).assign(currentElementsStorage.element(idxBefore)); + tempStorage.element(idxAfter).assign(currentElementsStorage.element(idxAfter)); + }); + }; + + const computeInitFn = Fn(() => { + randomizedElementsStorage.element(instanceIndex).assign(currentElementsStorage.element(instanceIndex)); + }); + + const computeBitonicStepFn = Fn(() => { + const nextBlockHeight = nextBlockHeightStorage.element(0).toVar(); + const nextAlgo = infoStorage.element(0).toVar(); + + // TODO: Convert to switch block. + If(nextAlgo.equal(uint(StepType.FLIP_GLOBAL)), () => { + const idx = getBitonicFlipIndices(instanceIndex, nextBlockHeight); + globalCompareAndSwap(idx.x, idx.y); + }).ElseIf(nextAlgo.equal(uint(StepType.DISPERSE_GLOBAL)), () => { + const idx = getBitonicDisperseIndices(instanceIndex, nextBlockHeight); + globalCompareAndSwap(idx.x, idx.y); + }); + + // Since this algorithm is global only, we execute an additional compute step to sync the current buffer with the output buffer. + }); + + const computeSetAlgoFn = Fn(() => { + const nextBlockHeight = nextBlockHeightStorage.element(0).toVar(); + const nextAlgo = infoStorage.element(0); + const highestBlockHeight = infoStorage.element(2).toVar(); + + nextBlockHeight.divAssign(2); + + If(nextBlockHeight.equal(1), () => { + highestBlockHeight.mulAssign(2); + + If(highestBlockHeight.equal(size * 2), () => { + nextAlgo.assign(StepType.NONE); + nextBlockHeight.assign(0); + }).Else(() => { + nextAlgo.assign(StepType.FLIP_GLOBAL); + nextBlockHeight.assign(highestBlockHeight); + }); + }).Else(() => { + nextAlgo.assign(StepType.DISPERSE_GLOBAL); + }); + + nextBlockHeightStorage.element(0).assign(nextBlockHeight); + infoStorage.element(2).assign(highestBlockHeight); + }); + + const computeAlignCurrentFn = Fn(() => { + currentElementsStorage.element(instanceIndex).assign(tempStorage.element(instanceIndex)); + }); + + const computeResetBuffersFn = Fn(() => { + currentElementsStorage.element(instanceIndex).assign(randomizedElementsStorage.element(instanceIndex)); + }); + + const computeResetAlgoFn = Fn(() => { + infoStorage.element(0).assign(StepType.FLIP_GLOBAL); + nextBlockHeightStorage.element(0).assign(2); + infoStorage.element(2).assign(2); + }); + + // Initialize each value in the elements buffer. + const computeInit = computeInitFn().compute(size); + // Swap a pair of elements in the elements buffer. + const computeBitonicStep = computeBitonicStepFn().compute(size / 2); + // Set the conditions for the next swap. + const computeSetAlgo = computeSetAlgoFn().compute(1); + // Align the current buffer with the temp buffer if the previous sort was executed in a global scope. + const computeAlignCurrent = computeAlignCurrentFn().compute(size); + // Reset the buffers and algorithm information after a full bitonic sort has been completed. + const computeResetBuffers = computeResetBuffersFn().compute(size); + const computeResetAlgo = computeResetAlgoFn().compute(1); + + scene.add(createDisplayMesh(currentElementsStorage, infoStorage, nextBlockHeightRead)); + + const renderer = new THREE.WebGPURenderer({ antialias: false }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth / 2, window.innerHeight); + + await renderer.init(); + + const animate = () => { + renderer.render(scene, camera); + }; + + renderer.setAnimationLoop(animate); + setupDomElement(renderer); + renderer.domElement.style.left = '50%'; + scene.background = new THREE.Color(0x212121); + + renderer.compute(computeInit); + + const stepAnimation = async function () { + if (currentStep !== MAX_STEPS) { + renderer.compute(computeBitonicStep); + + renderer.compute(computeAlignCurrent); + + renderer.compute(computeSetAlgo); + + currentStep++; + } else { + renderer.compute(computeResetBuffers); + renderer.compute(computeResetAlgo); + + currentStep = 0; + } + + timestamps['global_swap'].innerHTML = constructInnerHTML(true, globalColors); + + if (currentStep === MAX_STEPS) { + setTimeout(stepAnimation, 1000); + } else { + setTimeout(stepAnimation, 100); + } + }; + + stepAnimation(); + + window.addEventListener('resize', onWindowResize); + + function onWindowResize() { + windowResizeCallback(renderer, scene, camera); + } +} diff --git a/examples-testing/examples/webgpu_compute_texture.ts b/examples-testing/examples/webgpu_compute_texture.ts new file mode 100644 index 000000000..43d162ab5 --- /dev/null +++ b/examples-testing/examples/webgpu_compute_texture.ts @@ -0,0 +1,96 @@ +import * as THREE from 'three/webgpu'; +import { texture, textureStore, Fn, instanceIndex, float, uvec2, vec4 } from 'three/tsl'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let camera, scene, renderer; + +init().then(render); + +async function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); + camera.position.z = 1; + + scene = new THREE.Scene(); + + // texture + + const width = 512, + height = 512; + + const storageTexture = new THREE.StorageTexture(width, height); + //storageTexture.minFilter = THREE.LinearMipMapLinearFilter; + + // create function + + const computeTexture = Fn(({ storageTexture }) => { + const posX = instanceIndex.mod(width); + const posY = instanceIndex.div(width); + const indexUV = uvec2(posX, posY); + + // https://www.shadertoy.com/view/Xst3zN + + const x = float(posX).div(50.0); + const y = float(posY).div(50.0); + + const v1 = x.sin(); + const v2 = y.sin(); + const v3 = x.add(y).sin(); + const v4 = x.mul(x).add(y.mul(y)).sqrt().add(5.0).sin(); + const v = v1.add(v2, v3, v4); + + const r = v.sin(); + const g = v.add(Math.PI).sin(); + const b = v.add(Math.PI).sub(0.5).sin(); + + textureStore(storageTexture, indexUV, vec4(r, g, b, 1)).toWriteOnly(); + }); + + // compute + + const computeNode = computeTexture({ storageTexture }).compute(width * height); + + const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); + material.colorNode = texture(storageTexture); + + const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + scene.add(plane); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // compute texture + renderer.compute(computeNode); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + const aspect = window.innerWidth / window.innerHeight; + + const frustumHeight = camera.top - camera.bottom; + + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + + camera.updateProjectionMatrix(); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_texture_3d.ts b/examples-testing/examples/webgpu_compute_texture_3d.ts new file mode 100644 index 000000000..ccdfba0be --- /dev/null +++ b/examples-testing/examples/webgpu_compute_texture_3d.ts @@ -0,0 +1,193 @@ +import * as THREE from 'three/webgpu'; +import { + time, + mx_noise_vec3, + instanceIndex, + textureStore, + float, + vec3, + vec4, + If, + Break, + Fn, + smoothstep, + texture3D, + uniform, +} from 'three/tsl'; + +import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let renderer, scene, camera; +let mesh; +let computeNode; + +if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); +} + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 1, 1.5); + + new OrbitControls(camera, renderer.domElement); + + // Sky + + const canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 32; + + const context = canvas.getContext('2d'); + const gradient = context.createLinearGradient(0, 0, 0, 32); + gradient.addColorStop(0.0, '#014a84'); + gradient.addColorStop(0.5, '#0561a0'); + gradient.addColorStop(1.0, '#437ab6'); + context.fillStyle = gradient; + context.fillRect(0, 0, 1, 32); + + const skyMap = new THREE.CanvasTexture(canvas); + skyMap.colorSpace = THREE.SRGBColorSpace; + + const sky = new THREE.Mesh( + new THREE.SphereGeometry(10), + new THREE.MeshBasicNodeMaterial({ map: skyMap, side: THREE.BackSide }), + ); + scene.add(sky); + + // Texture + + const size = 200; + + const computeCloud = Fn(({ storageTexture }) => { + const scale = float(0.05); + const id = instanceIndex; + + const x = id.mod(size); + const y = id.div(size).mod(size); + const z = id.div(size * size); + + const coord3d = vec3(x, y, z); + const centered = coord3d.sub(size / 2).div(size); + const d = float(1.0).sub(centered.length()); + + const noiseCoord = coord3d.mul(scale.div(1.5)).add(time); + + const noise = mx_noise_vec3(noiseCoord).toConst('noise'); + + const data = noise.mul(d).mul(d).toConst('data'); + + textureStore(storageTexture, vec3(x, y, z), vec4(vec3(data.x), 1.0)); + }); + + const storageTexture = new THREE.Storage3DTexture(size, size, size); + storageTexture.generateMipmaps = false; + storageTexture.name = 'cloud'; + + computeNode = computeCloud({ storageTexture }) + .compute(size * size * size) + .setName('computeCloud'); + + // Shader + + const transparentRaymarchingTexture = Fn( + ({ texture, range = float(0.14), threshold = float(0.08), opacity = float(0.18), steps = float(100) }) => { + const finalColor = vec4(0).toVar(); + + RaymarchingBox(steps, ({ positionRay }) => { + const mapValue = float(texture.sample(positionRay.add(0.5)).r).toVar(); + + mapValue.assign(smoothstep(threshold.sub(range), threshold.add(range), mapValue).mul(opacity)); + + const shading = texture + .sample(positionRay.add(vec3(-0.01))) + .r.sub(texture.sample(positionRay.add(vec3(0.01))).r); + + const col = shading.mul(4.0).add(positionRay.x.add(positionRay.y).mul(0.5)).add(0.3); + + finalColor.rgb.addAssign(finalColor.a.oneMinus().mul(mapValue).mul(col)); + + finalColor.a.addAssign(finalColor.a.oneMinus().mul(mapValue)); + + If(finalColor.a.greaterThanEqual(0.95), () => { + Break(); + }); + }); + + return finalColor; + }, + ); + + // Material + + const baseColor = uniform(new THREE.Color(0x798aa0)); + const range = uniform(0.1); + const threshold = uniform(0.08); + const opacity = uniform(0.08); + const steps = uniform(100); + + const cloud3d = transparentRaymarchingTexture({ + texture: texture3D(storageTexture, null, 0), + range, + threshold, + opacity, + steps, + }); + + const finalCloud = cloud3d.setRGB(cloud3d.rgb.add(baseColor)); + + const material = new THREE.NodeMaterial(); + material.colorNode = finalCloud; + material.side = THREE.BackSide; + material.transparent = true; + material.name = 'transparentRaymarchingMaterial'; + + mesh = new THREE.Mesh(new THREE.BoxGeometry(10, 10, 10), material); + scene.add(mesh); + + mesh.rotation.y = Math.PI / 2; + + // + + renderer.compute(computeNode); + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(threshold, 'value', 0, 1, 0.01).name('threshold'); + gui.add(opacity, 'value', 0, 1, 0.01).name('opacity'); + gui.add(range, 'value', 0, 1, 0.01).name('range'); + gui.add(steps, 'value', 0, 200, 1).name('steps'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.compute(computeNode); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_compute_texture_pingpong.ts b/examples-testing/examples/webgpu_compute_texture_pingpong.ts new file mode 100644 index 000000000..5c411fa69 --- /dev/null +++ b/examples-testing/examples/webgpu_compute_texture_pingpong.ts @@ -0,0 +1,170 @@ +import * as THREE from 'three/webgpu'; +import { + storageTexture, + textureStore, + Fn, + instanceIndex, + uniform, + float, + vec2, + vec4, + uvec2, + ivec2, + int, + NodeAccess, +} from 'three/tsl'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let camera, scene, renderer; +let computeInitNode, computeToPing, computeToPong; +let pingTexture, pongTexture; +let material; +let phase = true; +let lastUpdate = -1; + +const width = 512, + height = 512; + +const seed = uniform(new THREE.Vector2()); + +init(); + +async function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); + camera.position.z = 1; + + scene = new THREE.Scene(); + + // texture + + const hdr = true; + + pingTexture = new THREE.StorageTexture(width, height); + pongTexture = new THREE.StorageTexture(width, height); + + if (hdr) { + pingTexture.type = THREE.HalfFloatType; + pongTexture.type = THREE.HalfFloatType; + } + + const rand2 = Fn(([n]) => { + return n.dot(vec2(12.9898, 4.1414)).sin().mul(43758.5453).fract(); + }); + + // Create storage texture nodes with proper access + const writePing = storageTexture(pingTexture).setAccess(NodeAccess.WRITE_ONLY); + const readPing = storageTexture(pingTexture).setAccess(NodeAccess.READ_ONLY); + const writePong = storageTexture(pongTexture).setAccess(NodeAccess.WRITE_ONLY); + const readPong = storageTexture(pongTexture).setAccess(NodeAccess.READ_ONLY); + + const computeInit = Fn(() => { + const posX = instanceIndex.mod(width); + const posY = instanceIndex.div(width); + const indexUV = uvec2(posX, posY); + const uv = vec2(float(posX).div(width), float(posY).div(height)); + + const r = rand2(uv.add(seed.mul(100))).sub(rand2(uv.add(seed.mul(300)))); + const g = rand2(uv.add(seed.mul(200))).sub(rand2(uv.add(seed.mul(300)))); + const b = rand2(uv.add(seed.mul(200))).sub(rand2(uv.add(seed.mul(100)))); + + textureStore(writePing, indexUV, vec4(r, g, b, 1)); + }); + + computeInitNode = computeInit().compute(width * height); + + // compute ping-pong: blur function using .load() for textureLoad + const blur = Fn(([readTex, uv]) => { + const c0 = readTex.load(uv.add(ivec2(-1, 1))); + const c1 = readTex.load(uv.add(ivec2(-1, -1))); + const c2 = readTex.load(uv.add(ivec2(0, 0))); + const c3 = readTex.load(uv.add(ivec2(1, -1))); + const c4 = readTex.load(uv.add(ivec2(1, 1))); + + return c0.add(c1).add(c2).add(c3).add(c4).div(5.0); + }); + + // compute loop: read from one texture, blur, write to another + const computePingPong = Fn(([readTex, writeTex]) => { + const posX = instanceIndex.mod(width); + const posY = instanceIndex.div(width); + const indexUV = ivec2(int(posX), int(posY)); + + const color = blur(readTex, indexUV); + + textureStore(writeTex, indexUV, vec4(color.rgb.mul(1.05), 1)); + }); + + computeToPong = computePingPong(readPing, writePong).compute(width * height); + computeToPing = computePingPong(readPong, writePing).compute(width * height); + + // + + material = new THREE.MeshBasicMaterial({ color: 0xffffff, map: pongTexture }); + + const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + scene.add(plane); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + window.addEventListener('resize', onWindowResize); + + // compute init + + renderer.compute(computeInitNode); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + const aspect = window.innerWidth / window.innerHeight; + + const frustumHeight = camera.top - camera.bottom; + + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + + camera.updateProjectionMatrix(); +} + +function render() { + const time = performance.now(); + const seconds = Math.floor(time / 1000); + + // reset every second + + if (phase && seconds !== lastUpdate) { + seed.value.set(Math.random(), Math.random()); + + renderer.compute(computeInitNode); + + lastUpdate = seconds; + } + + // compute step + + renderer.compute(phase ? computeToPong : computeToPing); + + material.map = phase ? pongTexture : pingTexture; + + phase = !phase; + + // render step + + // update material texture node + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_cubemap_adjustments.ts b/examples-testing/examples/webgpu_cubemap_adjustments.ts new file mode 100644 index 000000000..2e886d824 --- /dev/null +++ b/examples-testing/examples/webgpu_cubemap_adjustments.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three/webgpu'; +import { + uniform, + mix, + pmremTexture, + reference, + positionLocal, + hue, + saturation, + positionWorld, + normalWorld, + positionWorldDirection, + reflectVector, +} from 'three/tsl'; + +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + const initialDistance = 2; + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8 * initialDistance, 0.6 * initialDistance, 2.7 * initialDistance); + + scene = new THREE.Scene(); + + // HDR textures + + const hdr1Texture = await new HDRLoader().loadAsync('./textures/equirectangular/pedestrian_overpass_1k.hdr'); + + hdr1Texture.mapping = THREE.EquirectangularReflectionMapping; + hdr1Texture.generateMipmaps = true; + hdr1Texture.minFilter = THREE.LinearMipmapLinearFilter; + + const hdr2Texture = await new HDRLoader().loadAsync('./textures/equirectangular/752-hdri-skies-com_1k.hdr'); + + hdr2Texture.mapping = THREE.EquirectangularReflectionMapping; + hdr2Texture.generateMipmaps = true; + hdr2Texture.minFilter = THREE.LinearMipmapLinearFilter; + + // nodes and environment + + const adjustments = { + mix: 0, + procedural: 0, + intensity: 1, + hue: 0, + saturation: 1, + }; + + const mixNode = reference('mix', 'float', adjustments); + const proceduralNode = reference('procedural', 'float', adjustments); + const intensityNode = reference('intensity', 'float', adjustments); + const hueNode = reference('hue', 'float', adjustments); + const saturationNode = reference('saturation', 'float', adjustments); + + const rotateY1Matrix = new THREE.Matrix4(); + const rotateY2Matrix = new THREE.Matrix4(); + + const getEnvironmentNode = (reflectNode, positionNode) => { + const custom1UV = reflectNode.xyz.mul(uniform(rotateY1Matrix)); + const custom2UV = reflectNode.xyz.mul(uniform(rotateY2Matrix)); + const mixCubeMaps = mix( + pmremTexture(hdr1Texture, custom1UV), + pmremTexture(hdr2Texture, custom2UV), + positionNode.y.add(mixNode).clamp(), + ); + + const proceduralEnv = mix(mixCubeMaps, normalWorld, proceduralNode); + + const intensityFilter = proceduralEnv.mul(intensityNode); + const hueFilter = hue(intensityFilter, hueNode); + return saturation(hueFilter, saturationNode); + }; + + const blurNode = uniform(0); + + scene.environmentNode = getEnvironmentNode(reflectVector, positionWorld); + + scene.backgroundNode = getEnvironmentNode(positionWorldDirection, positionLocal).context({ + getTextureLevel: () => blurNode, + }); + + // scene objects + + const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); + const gltf = await loader.loadAsync('DamagedHelmet.gltf'); + + scene.add(gltf.scene); + + const sphereGeometry = new THREE.SphereGeometry(0.5, 64, 32); + + const sphereRightView = new THREE.Mesh( + sphereGeometry, + new THREE.MeshStandardMaterial({ roughness: 0, metalness: 1 }), + ); + sphereRightView.position.x += 2; + + const sphereLeftView = new THREE.Mesh( + sphereGeometry, + new THREE.MeshStandardMaterial({ roughness: 1, metalness: 1 }), + ); + sphereLeftView.position.x -= 2; + + scene.add(sphereLeftView); + scene.add(sphereRightView); + + // renderer and controls + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.LinearToneMapping; + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(adjustments, 'mix', -1, 2, 0.01); + gui.add({ blurBackground: blurNode.value }, 'blurBackground', 0, 1, 0.01).onChange(value => { + blurNode.value = value; + }); + gui.add({ offsetHDR1: 0 }, 'offsetHDR1', 0, Math.PI * 2, 0.01).onChange(value => { + rotateY1Matrix.makeRotationY(value); + }); + gui.add({ offsetHDR2: 0 }, 'offsetHDR2', 0, Math.PI * 2, 0.01).onChange(value => { + rotateY2Matrix.makeRotationY(value); + }); + gui.add(adjustments, 'procedural', 0, 1, 0.01); + gui.add(adjustments, 'intensity', 0, 5, 0.01); + gui.add(adjustments, 'hue', 0, Math.PI * 2, 0.01); + gui.add(adjustments, 'saturation', 0, 2, 0.01); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_cubemap_dynamic.ts b/examples-testing/examples/webgpu_cubemap_dynamic.ts new file mode 100644 index 000000000..244b85935 --- /dev/null +++ b/examples-testing/examples/webgpu_cubemap_dynamic.ts @@ -0,0 +1,130 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let cube, sphere, torus, material; + +let cubeCamera, cubeRenderTarget; + +let controls; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 75; + + scene = new THREE.Scene(); + + const uvTexture = new THREE.TextureLoader().load('./textures/uv_grid_opengl.jpg'); + + const hdrUrls = ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']; + const texture = await new HDRCubeTextureLoader().setPath('./textures/cube/pisaHDR/').loadAsync(hdrUrls); + + texture.name = 'pisaHDR'; + texture.minFilter = THREE.LinearMipmapLinearFilter; + texture.magFilter = THREE.LinearFilter; + + scene.background = texture; + scene.environment = texture; + + // + + cubeRenderTarget = new THREE.CubeRenderTarget(256); + cubeRenderTarget.texture.type = THREE.HalfFloatType; + cubeRenderTarget.texture.minFilter = THREE.LinearMipmapLinearFilter; + cubeRenderTarget.texture.magFilter = THREE.LinearFilter; + cubeRenderTarget.texture.generateMipmaps = true; + + cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); + + // + + material = new THREE.MeshStandardNodeMaterial({ + envMap: cubeRenderTarget.texture, + roughness: 0.05, + metalness: 1, + }); + + sphere = new THREE.Mesh(new THREE.IcosahedronGeometry(15, 8), material); + scene.add(sphere); + + const material1 = new THREE.MeshStandardNodeMaterial({ + map: uvTexture, + roughness: 0.1, + metalness: 0, + }); + + const material2 = new THREE.MeshStandardNodeMaterial({ + map: uvTexture, + roughness: 0.1, + metalness: 0, + envMap: texture, + }); + + cube = new THREE.Mesh(new THREE.BoxGeometry(15, 15, 15), material1); + scene.add(cube); + + torus = new THREE.Mesh(new THREE.TorusKnotGeometry(8, 3, 128, 16), material2); + scene.add(torus); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animation); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResized); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(material, 'roughness', 0, 1); + gui.add(material, 'metalness', 0, 1); + gui.add(renderer, 'toneMappingExposure', 0, 2).name('exposure'); + gui.add(scene, 'environmentIntensity', 0, 1); + gui.add(material2, 'envMapIntensity', 0, 1); +} + +function onWindowResized() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +function animation(msTime) { + const time = msTime / 1000; + + cube.position.x = Math.cos(time) * 30; + cube.position.y = Math.sin(time) * 30; + cube.position.z = Math.sin(time) * 30; + + cube.rotation.x += 0.02; + cube.rotation.y += 0.03; + + torus.position.x = Math.cos(time + 10) * 30; + torus.position.y = Math.sin(time + 10) * 30; + torus.position.z = Math.sin(time + 10) * 30; + + torus.rotation.x += 0.02; + torus.rotation.y += 0.03; + + material.visible = false; + + cubeCamera.update(renderer, scene); + + material.visible = true; + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_cubemap_mix.ts b/examples-testing/examples/webgpu_cubemap_mix.ts new file mode 100644 index 000000000..6fbdb55ae --- /dev/null +++ b/examples-testing/examples/webgpu_cubemap_mix.ts @@ -0,0 +1,78 @@ +import * as THREE from 'three/webgpu'; +import { mix, oscSine, time, pmremTexture, float } from 'three/tsl'; + +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + const hdrUrls = ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']; + const cube1Texture = new HDRCubeTextureLoader().setPath('./textures/cube/pisaHDR/').load(hdrUrls); + + cube1Texture.generateMipmaps = true; + cube1Texture.minFilter = THREE.LinearMipmapLinearFilter; + + const cube2Urls = [ + 'dark-s_px.jpg', + 'dark-s_nx.jpg', + 'dark-s_py.jpg', + 'dark-s_ny.jpg', + 'dark-s_pz.jpg', + 'dark-s_nz.jpg', + ]; + const cube2Texture = await new THREE.CubeTextureLoader().setPath('./textures/cube/MilkyWay/').loadAsync(cube2Urls); + + cube2Texture.generateMipmaps = true; + cube2Texture.minFilter = THREE.LinearMipmapLinearFilter; + + scene.environmentNode = mix(pmremTexture(cube2Texture), pmremTexture(cube1Texture), oscSine(time.mul(0.1))); + + scene.backgroundNode = scene.environmentNode.context({ + getTextureLevel: () => float(0.5), + }); + + const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); + const gltf = await loader.loadAsync('DamagedHelmet.gltf'); + + scene.add(gltf.scene); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.LinearToneMapping; + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_custom_fog.ts b/examples-testing/examples/webgpu_custom_fog.ts new file mode 100644 index 000000000..3a6c59a36 --- /dev/null +++ b/examples-testing/examples/webgpu_custom_fog.ts @@ -0,0 +1,225 @@ +import * as THREE from 'three/webgpu'; +import { color, fog, positionWorld, triNoise3D, normalWorld, uniform, densityFogFactor } from 'three/tsl'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; +import { TerrainGenerator } from 'three/addons/generators/TerrainGenerator.js'; +import { ForestGenerator } from 'three/addons/generators/ForestGenerator.js'; + +let camera, scene, renderer, controls, timer; +let terrain, forest, terrainGroup, forestGroup; +let sky, sun, sunLight, pmremGenerator, envScene; + +const parameters = { + elevation: 11, // sun height above the horizon, in degrees ( low = golden hour ) + azimuth: 150, // sun compass direction, in degrees +}; + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.62; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + pmremGenerator = new THREE.PMREMGenerator(renderer); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20000); + camera.position.set(-50, 88, 230); + + scene = new THREE.Scene(); + scene.environmentIntensity = 0.16; // a dim, cool sky fill so the warm sun stays the key and shadows read + + // a physical sky, used only to bake the image-based lighting ( it is not + // the visible background — the fog gradient below is ); elevation / azimuth move the sun + + sky = new SkyMesh(); + sky.scale.setScalar(10000); + sky.turbidity.value = 12; + sky.rayleigh.value = 2; + sky.mieCoefficient.value = 0.005; + sky.mieDirectionalG.value = 0.88; + + sun = new THREE.Vector3(); + envScene = new THREE.Scene(); + + // custom fog. an animated, two-octave triNoise3D haze that settles into + // the valley as a level band: solid below `fogBase` ( down under the + // mountains ) and fading out by `fogTop` ( around mid-height ), so the + // peaks rise clear above it. the band sits at a fixed altitude whatever + // the distance, and the noise wobbles its top edge and drifts it through + // world space, so it reads as slow-moving cloud. ( the peaks reach ~130 ) + + const skyColorValue = 0xf0f5f5; + const groundColorValue = 0xd0dee7; + + const skyColor = color(skyColorValue); + const groundColor = color(groundColorValue); + + const fogBase = uniform(-20); // world-y the fog is solid below ( the valley floor ) + const fogTop = uniform(55); // world-y the fog fades out by ( mid-mountain ) + const haze = uniform(0.0012); // distance haze, so the far peaks dissolve into the same grey + + // a alternative way to create a TimerNode + const time = uniform(0).onFrameUpdate(frame => frame.time); + + const fogNoiseA = triNoise3D(positionWorld.mul(0.005), 0.2, time); + const fogNoiseB = triNoise3D(positionWorld.mul(0.01), 0.2, time.mul(1.2)); + + const fogNoise = fogNoiseA.add(fogNoiseB); + + // the noise lifts and drops the top of the band so it breaks into wisps + const top = fogTop.add(fogNoise.sub(0.7).mul(22)); + const groundFogArea = top.sub(positionWorld.y).div(top.sub(fogBase)).saturate().mul(0.98); + + // the valley band plus a distance haze, so the far peaks dissolve into the grey too + const fogArea = groundFogArea.oneMinus().mul(densityFogFactor(haze).oneMinus()).oneMinus(); + + scene.fogNode = fog(groundColor, fogArea); + scene.backgroundNode = normalWorld.y.max(0).mix(groundColor, skyColor); + + // terrain + forest + + terrain = new TerrainGenerator({ + seed: 1, + size: 900, + segments: 512, + frequency: 0.0065, + heightScale: 150, + erosion: 0.7, + valleyBias: 1.2, + }); + + forest = new ForestGenerator({ count: 500000, castShadow: true }); + + generate(); + + // a single directional key aligned with the sky's sun, for the crisp relief + // shadows the sky fill alone can't give. its colour, intensity and position — + // and the baked environment — are set by updateSun() + + sunLight = new THREE.DirectionalLight(); + sunLight.castShadow = true; + sunLight.shadow.camera.left = -420; + sunLight.shadow.camera.right = 420; + sunLight.shadow.camera.top = 420; + sunLight.shadow.camera.bottom = -420; + sunLight.shadow.camera.near = 200; + sunLight.shadow.camera.far = 1800; + sunLight.shadow.mapSize.set(4096, 4096); + sunLight.shadow.bias = -0.0004; + sunLight.shadow.normalBias = 0.15; + sunLight.shadow.autoUpdate = false; // the scene is static — re-render the shadow map only when the sun moves ( see updateSun ), not every frame + scene.add(sunLight); + + updateSun(); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + + const skyFolder = gui.addFolder('Sun'); + skyFolder.add(parameters, 'elevation', 1, 40).step(0.5).name('elevation').onChange(updateSun); + skyFolder.add(parameters, 'azimuth', 0, 360).step(1).name('azimuth').onChange(updateSun); + + const fogFolder = gui.addFolder('Fog'); + fogFolder.add(fogBase, 'value', -40, 20).step(1).name('base'); + fogFolder.add(fogTop, 'value', 0, 130).step(1).name('top'); + fogFolder.add(haze, 'value', 0, 0.005).step(0.0001).name('haze'); + + const forestFolder = gui.addFolder('Forest'); + forestFolder.add(forest.from, 'value', 50, 1000).step(10).name('cull from'); + forestFolder.add(forest.to, 'value', 100, 1400).step(10).name('cull to'); + + const terrainFolder = gui.addFolder('Terrain'); + terrainFolder.add(terrain.parameters, 'erosion', 0, 1.5).step(0.05).name('erosion'); + terrainFolder.add(terrain.parameters, 'valleyBias', 1, 3).step(0.1).name('valley bias'); + terrainFolder.add({ newSeed }, 'newSeed').name('regenerate'); + + // controls + + timer = new THREE.Timer(); + + controls = new FirstPersonControls(camera, renderer.domElement); + controls.movementSpeed = 20; + controls.lookSpeed = 0.1; + controls.lookAt(0, 5, -120); // face across the valley + + window.addEventListener('resize', resize); +} + +// walks the sun: aligns the sky and the key light ( warm and dim near the +// horizon ), then re-bakes the sky into the IBL environment +function updateSun() { + const elevation = parameters.elevation; + + sun.setFromSphericalCoords( + 1, + THREE.MathUtils.degToRad(90 - elevation), + THREE.MathUtils.degToRad(parameters.azimuth), + ); + sky.sunPosition.value.copy(sun); + + // the longer air path near the horizon dims and warms the sun. it stays + // far brighter than the sky fill, so it reads as the key and casts firm shadows + const transmittance = Math.sqrt(Math.max(Math.sin(THREE.MathUtils.degToRad(elevation)), 0)); + sunLight.color.set(0xff7a2f).lerp(new THREE.Color(0xfff2e0), transmittance); // deep orange → warm white + sunLight.intensity = 11 * transmittance + 0.3; + sunLight.position.copy(sun).multiplyScalar(900); + sunLight.shadow.needsUpdate = true; // the sun moved, so the on-demand shadow map needs one refresh + + // re-bake the sky ( without the sun disc ) into the environment map for IBL. + // the sky lives only in envScene; it is never added to the visible scene + sky.showSunDisc.value = false; + envScene.add(sky); + const env = pmremGenerator.fromScene(envScene).texture; + if (scene.environment) scene.environment.dispose(); + scene.environment = env; +} + +// a new seed ( and whatever erosion / valley bias is dialled in ) rebuilds +// the terrain, and with it the forest that sits on top +function newSeed() { + terrain.parameters.seed++; + generate(); +} + +// the forest sits on the terrain, so a new terrain means a new forest +function generate() { + if (terrainGroup) scene.remove(terrainGroup); + if (forestGroup) scene.remove(forestGroup); + + terrainGroup = terrain.build(); + forestGroup = forest.build(terrain); + + scene.add(terrainGroup); + scene.add(forestGroup); + + if (sunLight) sunLight.shadow.needsUpdate = true; // rebuilt geometry ⇒ re-render the shadow map ( skipped on the first build, before the light exists; updateSun covers it ) +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + controls.update(timer.getDelta()); + + forest.setCameraPosition(camera.position); // drives the forest cull + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_custom_fog_background.ts b/examples-testing/examples/webgpu_custom_fog_background.ts new file mode 100644 index 000000000..a9b619345 --- /dev/null +++ b/examples-testing/examples/webgpu_custom_fog_background.ts @@ -0,0 +1,86 @@ +import * as THREE from 'three/webgpu'; +import { pass, color, rangeFogFactor } from 'three/tsl'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer; +let renderPipeline; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NoToneMapping; // apply tone mapping in post processing, instead + document.body.appendChild(renderer.domElement); + + // post processing + + // render scene pass + const scenePass = pass(scene, camera); + const scenePassViewZ = scenePass.getViewZNode(); + + // fog color + const fogColor = color(0x4080cc); // in sRGB color space + + // get fog factor from the scene pass context + // equivalent to: scene.fog = new THREE.Fog( 0x4080cc, 2.7, 4 ); + const fogFactor = rangeFogFactor(2.7, 4).context({ getViewZ: () => scenePassViewZ }); + + // tone-mapped scene pass + const scenePassTM = scenePass.toneMapping(THREE.ACESFilmicToneMapping, 1); + + // mix fog using fog factor and fog color + const compose = fogFactor.mix(scenePassTM, fogColor); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = true; // no tone mapping will be applied, only the default color space transform + renderPipeline.outputNode = compose; + + // + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + scene.environment = texture; + + // model + + const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); + loader.load('DamagedHelmet.gltf', function (gltf) { + scene.add(gltf.scene); + }); + }); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 5; + controls.target.set(0, -0.1, -0.2); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_custom_fog_scattering.ts b/examples-testing/examples/webgpu_custom_fog_scattering.ts new file mode 100644 index 000000000..e0da158f9 --- /dev/null +++ b/examples-testing/examples/webgpu_custom_fog_scattering.ts @@ -0,0 +1,193 @@ +import * as THREE from 'three/webgpu'; +import { densityFogFactor, mix, pass, reference, uniform, vec2 } from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { TreeGenerator } from 'three/addons/generators/TreeGenerator.js'; + +let camera, scene, renderer, renderPipeline, controls; + +const timer = new THREE.Timer(); + +const params = { + scatteringEnabled: true, +}; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.1, 120); + camera.position.set(0.4, 1.7, 9); // ~human eye height + + scene = new THREE.Scene(); + + // fog: a bright, cool haze. the background matches it so the trunks read + // as dark silhouettes that dissolve into depth — the scattering subject + + scene.fog = new THREE.FogExp2(0xc6cace, 0.11); + scene.background = new THREE.Color(0xc6cace); + + // everything is a flat black silhouette — the fog and the scattering blur + // do all the shaping, so no lights are needed ( MeshBasicMaterial is unlit ) + + const material = new THREE.MeshBasicMaterial({ color: 0x000000 }); + + // a few seeded variants of a tall scots pine: a clean bole rising into a + // high, open crown of fine bare branches + + const variants = []; + + const generator = new TreeGenerator(material); + + for (let v = 0; v < 6; v++) { + const mesh = generator + .setSeed(v + 1) + .setTrunkLength(2.6 + v * 0.3) // the crowns ride high in the fog + .setTrunkRadius(0.06) + .setTaper(0.28) // slender, tapers slowly + .setLevels(4) + .setChildren([7, 5, 4]) // a wide whorl of limbs ramifying into many fine twigs + .setBranchAngle([55, 50, 46]) // a rounded crown that turns up + .setAngleVariance(22) + .setLengthRatio(0.46) // short crown limbs ( a modest pine crown ) + .setMinLength(0.04) + .setDroop(0.05) + .setUpPull(0.42) // crown branches reach up toward the light + .setGnarl([0, 0.14, 0.24, 0.34]) // dead-straight trunk, wispier twigs + .setSectionLength(0.34) + .setRadialSegments(7) + .setRadiusExponent(2.5) // slender bole, whippy thin twigs + .setMinRadius(0.0023) // very fine twigs + .setTrunkClear(0.72) // tall clean bole; the crown sits only at the top + .build(); + + variants.push(mesh.geometry); + } + + const placements = variants.map(() => []); + + const dummy = new THREE.Object3D(); + const cols = 13, + rows = 12, + spacing = 1.9; + + for (let i = 0; i < cols; i++) { + for (let j = 0; j < rows; j++) { + const v = Math.floor(Math.random() * variants.length); + + const x = (i - cols / 2) * spacing + (Math.random() - 0.5) * spacing * 0.8; + const z = j * spacing - rows * spacing + 4.2 + (Math.random() - 0.5) * spacing * 0.8; + + dummy.position.set(x, 0, z); + + const scale = 0.85 + Math.random() * 0.4; + dummy.rotation.set((Math.random() - 0.5) * 0.05, Math.random() * Math.PI * 2, (Math.random() - 0.5) * 0.05); // slight lean + dummy.scale.set(scale, scale * (0.9 + Math.random() * 0.3), scale); + dummy.updateMatrix(); + + placements[v].push(dummy.matrix.clone()); + } + } + + variants.forEach((geometry, v) => { + const list = placements[v]; + const mesh = new THREE.InstancedMesh(geometry, material, list.length); + for (let k = 0; k < list.length; k++) mesh.setMatrixAt(k, list[k]); + mesh.instanceMatrix.needsUpdate = true; + scene.add(mesh); + }); + + // a couple of dominant trunks close to the camera to anchor the depth + + [ + [-1.1, 4.9, 1.5, 1.1], + [1.5, 4, 1.2, 0.3], + ].forEach(([x, z, s, ry]) => { + const hero = new THREE.Mesh(variants[variants.length - 1], material); + hero.position.set(x, 0, z); + hero.rotation.y = ry; + hero.scale.setScalar(s); + scene.add(hero); + }); + + // ground + + const ground = new THREE.Mesh(new THREE.PlaneGeometry(600, 600).rotateX(-Math.PI / 2), material); + scene.add(ground); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new FirstPersonControls(camera, renderer.domElement); + controls.movementSpeed = 2; + controls.lookSpeed = 0.1; + controls.lookAt(-0.2, 1.7, -8); + + renderPipeline = new THREE.RenderPipeline(renderer); + + // uniforms + + const density = reference('density', 'float', scene.fog); + const scattering = uniform(2); + + // scene pass + + const scenePass = pass(scene, camera); + + const scenePassColor = scenePass.getTextureNode('output'); + const scenePassViewZ = scenePass.getViewZNode(); + + // blur pass (always downsampled to improve performance) + + const sceneColorBlurred = gaussianBlur(scenePassColor, vec2(scattering), 4, { resolutionScale: 0.5 }); + + // composite + + const fogFactor = densityFogFactor(density).context({ getViewZ: () => scenePassViewZ }); + + const compositeNode = mix(scenePassColor, sceneColorBlurred, fogFactor); + + renderPipeline.outputNode = compositeNode; + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(scene.fog, 'density', 0.025, 0.16).step(0.0005).name('fog density'); + gui.add(scattering, 'value', 0, 5).name('scattering factor'); + gui.add(params, 'scatteringEnabled') + .name('enable scattering') + .onChange(value => { + if (value === true) { + renderPipeline.outputNode = compositeNode; + } else { + renderPipeline.outputNode = scenePassColor; + } + + renderPipeline.needsUpdate = true; + }); + + window.addEventListener('resize', resize); +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + controls.update(timer.getDelta()); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_deferred.ts b/examples-testing/examples/webgpu_deferred.ts new file mode 100644 index 000000000..71538bc7c --- /dev/null +++ b/examples-testing/examples/webgpu_deferred.ts @@ -0,0 +1,254 @@ +import * as THREE from 'three/webgpu'; +import { + vec4, + normalView, + pass, + diffuseColor, + positionGeometry, + positionView, + positionViewDirection, + roughness, + metalness, + mrt, + Fn, + overrideNodes, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + +const RESOLVE_LAYER = 2; + +let camera, scene, renderer; +let renderPipeline; +let lightGroup, planesGroup; +let params; + +const timer = new THREE.Timer(); + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + // scene + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + // teapot model + const teapotGeometry = new TeapotGeometry(0.4, 18); + const teapotMaterial = new THREE.MeshStandardMaterial({ color: 0x333333, roughness: 0.2, metalness: 0.8 }); + const teapot = new THREE.Mesh(teapotGeometry, teapotMaterial); + teapot.position.y = -0.15; + scene.add(teapot); + }); + + // light group + lightGroup = new THREE.Group(); + lightGroup.position.y = -0.15; + scene.add(lightGroup); + + const numLights = 8; + const radius = 1.2; + const sphereGeometry = new THREE.SphereGeometry(0.03, 16, 8); + + for (let i = 0; i < numLights; i++) { + const angle = (i / numLights) * Math.PI * 2; + const x = Math.cos(angle) * radius; + const z = Math.sin(angle) * radius; + + const colorHex = new THREE.Color().setHSL(i / numLights, 1.0, 0.5); + + const lightMat = new THREE.MeshStandardMaterial({ color: colorHex }); + const lightMesh = new THREE.Mesh(sphereGeometry, lightMat); + + const light = new THREE.PointLight(colorHex, 5, 5); + light.layers.enable(RESOLVE_LAYER); + light.position.set(x, 0, z); + light.add(lightMesh); + + lightGroup.add(light); + } + + // planes group + planesGroup = new THREE.Group(); + planesGroup.position.y = -0.15; + scene.add(planesGroup); + + const planeGeometry = new THREE.PlaneGeometry(0.4, 0.4); + const planeMaterial = new THREE.MeshStandardMaterial({ + color: 0x999999, + roughness: 0.5, + metalness: 0.5, + side: THREE.DoubleSide, + transparent: true, + opacity: 0.5, + }); + + const numPlanes = 6; + const planesRadius = 1.5; + + for (let i = 0; i < numPlanes; i++) { + const angle = (i / numPlanes) * Math.PI * 2; + + const pivot = new THREE.Group(); + pivot.rotation.y = angle; + planesGroup.add(pivot); + + const plane = new THREE.Mesh(planeGeometry, planeMaterial); + plane.position.z = planesRadius; + pivot.add(plane); + } + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // opaque pass + + const opaquePass = pass(scene, camera); + opaquePass.name = 'opaque pass'; + opaquePass.transparent = false; + opaquePass.setLayers(new THREE.Layers()); // default layer 0 is used by the renderer + opaquePass.setMRT( + mrt({ + output: diffuseColor, + position: vec4(positionView, metalness), + normal: vec4(normalView, roughness), + }), + ); + + opaquePass.lighting = new THREE.Lighting(); + opaquePass.lighting.enabled = false; + + // opaque nodes + + const opaqueOutputNode = opaquePass.getTextureNode('output').toInspector('output'); + const opaquePositionView = opaquePass.getTextureNode('position').xyz.toInspector('position'); + const opaqueNormalView = opaquePass.getTextureNode('normal').xyz.toInspector('normal'); + const opaqueDepthNode = opaquePass.getTextureNode('depth').toInspector('depth'); + const opaqueMetalness = opaquePass.getTextureNode('position').w.toInspector('metalness'); + const opaqueRoughness = opaquePass.getTextureNode('normal').w.toInspector('roughness'); + + // resolve opaque pass - deferred lighting + + const resolveLayers = new THREE.Layers(); + resolveLayers.disableAll(); + resolveLayers.enable(RESOLVE_LAYER); + + // the resolve material must be compatible with the other materials in the scene; + // in common deferred rendering scenarios, a standardized material is used. + + const resolveMaterial = new THREE.MeshStandardNodeMaterial(); + resolveMaterial.colorNode = Fn(() => { + opaqueDepthNode.greaterThanEqual(1.0).discard(); + + return opaqueOutputNode; + })(); + resolveMaterial.metalnessNode = opaqueMetalness; + resolveMaterial.roughnessNode = opaqueRoughness; + resolveMaterial.vertexNode = vec4(positionGeometry.xy, 0.0, 1.0); + resolveMaterial.depthNode = opaqueDepthNode; + resolveMaterial.contextNode = overrideNodes([ + [positionView, opaquePositionView], + [positionViewDirection, opaquePositionView.negate().normalize()], + [normalView, opaqueNormalView], + ]); + + const resolveMesh = new THREE.QuadMesh(resolveMaterial); + resolveMesh.layers.set(RESOLVE_LAYER); + scene.add(resolveMesh); + + const resolvedPass = pass(scene, camera); + resolvedPass.setLayers(resolveLayers); + resolvedPass.lighting = new THREE.Lighting(); + + // transparent pass + + const opaqueDepthTexture = opaquePass.getTexture('depth'); + + const transparentPass = pass(scene, camera, { depthTexture: opaqueDepthTexture, autoClearDepth: false }); + transparentPass.name = 'transparent pass'; + transparentPass.setLayers(new THREE.Layers()); // default layer 0 is used by the renderer + transparentPass.opaque = false; + + // forward pass + + const forwardPass = pass(scene, camera).toInspector('forward'); + + // resolved - render pipeline + + const opaqueNode = resolvedPass.toInspector('resolved opaque'); + const transparentNode = transparentPass.toInspector('transparent'); + + const deferredNode = vec4(opaqueNode.rgb.mul(transparentNode.a.oneMinus()).add(transparentNode.rgb), 1.0); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = deferredNode; + + // gui + + params = { + mode: 'deferred', + animated: true, + }; + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'mode', ['forward', 'deferred']).onChange(value => { + renderPipeline.outputNode = value === 'forward' ? forwardPass : deferredNode; + renderPipeline.needsUpdate = true; + }); + gui.add(params, 'animated'); + + // controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.target.set(0, 0, -0.2); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + timer.update(); + + if (params.animated) { + const delta = timer.getDelta(); + + lightGroup.rotation.y += delta * 1.0; + planesGroup.rotation.y -= delta * 0.5; + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_depth_texture.ts b/examples-testing/examples/webgpu_depth_texture.ts new file mode 100644 index 000000000..0bc38eeba --- /dev/null +++ b/examples-testing/examples/webgpu_depth_texture.ts @@ -0,0 +1,83 @@ +import * as THREE from 'three/webgpu'; +import { texture } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, controls, renderer; + +let quad, renderTarget; + +const dpr = window.devicePixelRatio; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 20); + camera.position.z = 4; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222222); + scene.overrideMaterial = new THREE.MeshBasicNodeMaterial(); + + // + + const geometry = new THREE.TorusKnotGeometry(1, 0.3, 128, 64); + + const count = 50; + const scale = 5; + + for (let i = 0; i < count; i++) { + const r = Math.random() * 2.0 * Math.PI; + const z = Math.random() * 2.0 - 1.0; + const zScale = Math.sqrt(1.0 - z * z) * scale; + + const mesh = new THREE.Mesh(geometry); + mesh.position.set(Math.cos(r) * zScale, Math.sin(r) * zScale, z * scale); + mesh.rotation.set(Math.random(), Math.random(), Math.random()); + scene.add(mesh); + } + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(dpr); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + const depthTexture = new THREE.DepthTexture(); + depthTexture.type = THREE.FloatType; + + renderTarget = new THREE.RenderTarget(window.innerWidth * dpr, window.innerHeight * dpr); + renderTarget.depthTexture = depthTexture; + + window.addEventListener('resize', onWindowResize); + + // FX + + const materialFX = new THREE.MeshBasicNodeMaterial(); + materialFX.colorNode = texture(depthTexture); + + quad = new THREE.QuadMesh(materialFX); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); +} + +function animate() { + renderer.setRenderTarget(renderTarget); + renderer.render(scene, camera); + + renderer.setRenderTarget(null); + quad.render(renderer); +} diff --git a/examples-testing/examples/webgpu_display_stereo.ts b/examples-testing/examples/webgpu_display_stereo.ts new file mode 100644 index 000000000..7f1ade726 --- /dev/null +++ b/examples-testing/examples/webgpu_display_stereo.ts @@ -0,0 +1,191 @@ +import * as THREE from 'three/webgpu'; + +import { stereoPass } from 'three/addons/tsl/display/StereoPassNode.js'; +import { anaglyphPass, AnaglyphAlgorithm, AnaglyphColorMode } from 'three/addons/tsl/display/AnaglyphPassNode.js'; +import { parallaxBarrierPass } from 'three/addons/tsl/display/ParallaxBarrierPassNode.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline; + +let stereo, anaglyph, parallaxBarrier; + +let mesh, dummy, timer; + +let anaglyphFolder; + +const position = new THREE.Vector3(); + +const params = { + effect: 'stereo', + eyeSep: 0.064, + planeDistance: 3, + anaglyphAlgorithm: 'dubois', + anaglyphColorMode: 'redCyan', +}; + +const effects = { Stereo: 'stereo', Anaglyph: 'anaglyph', ParallaxBarrier: 'parallaxBarrier' }; + +const anaglyphAlgorithms = { + True: AnaglyphAlgorithm.TRUE, + Grey: AnaglyphAlgorithm.GREY, + Colour: AnaglyphAlgorithm.COLOUR, + 'Half-Colour': AnaglyphAlgorithm.HALF_COLOUR, + Dubois: AnaglyphAlgorithm.DUBOIS, + Optimised: AnaglyphAlgorithm.OPTIMISED, + Compromise: AnaglyphAlgorithm.COMPROMISE, +}; + +const anaglyphColorModes = { + 'Red / Cyan': AnaglyphColorMode.RED_CYAN, + 'Magenta / Cyan': AnaglyphColorMode.MAGENTA_CYAN, + 'Magenta / Green': AnaglyphColorMode.MAGENTA_GREEN, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 3; + + scene = new THREE.Scene(); + scene.background = new THREE.CubeTextureLoader() + .setPath('textures/cube/Park3Med/') + .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); + + timer = new THREE.Timer(); + timer.connect(document); + + const geometry = new THREE.SphereGeometry(0.1, 32, 16); + + const textureCube = new THREE.CubeTextureLoader() + .setPath('textures/cube/Park3Med/') + .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); + + const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); + + mesh = new THREE.InstancedMesh(geometry, material, 500); + mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); + + dummy = new THREE.Mesh(); + + for (let i = 0; i < 500; i++) { + dummy.position.x = Math.random() * 10 - 5; + dummy.position.y = Math.random() * 10 - 5; + dummy.position.z = Math.random() * 10 - 5; + dummy.scale.x = dummy.scale.y = dummy.scale.z = Math.random() * 3 + 1; + + dummy.updateMatrix(); + + mesh.setMatrixAt(i, dummy.matrix); + } + + scene.add(mesh); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + renderPipeline = new THREE.RenderPipeline(renderer); + stereo = stereoPass(scene, camera); + anaglyph = anaglyphPass(scene, camera); + parallaxBarrier = parallaxBarrierPass(scene, camera); + + // Configure anaglyph for physically-correct stereo with zero parallax at scene center + anaglyph.eyeSep = params.eyeSep; + anaglyph.planeDistance = params.planeDistance; + + renderPipeline.outputNode = stereo; + + const gui = renderer.inspector.createParameters('Stereo Settings'); + gui.add(params, 'effect', effects).onChange(update); + gui.add(params, 'eyeSep', 0.001, 0.15, 0.001).onChange(function (value) { + stereo.stereo.eyeSep = value; + anaglyph.eyeSep = value; // Anaglyph has direct eyeSep property + parallaxBarrier.stereo.eyeSep = value; + }); + + // Anaglyph-specific settings folder + anaglyphFolder = gui.addFolder('Anaglyph Options'); + anaglyphFolder + .add(params, 'anaglyphAlgorithm', anaglyphAlgorithms) + .name('Algorithm') + .onChange(function (value) { + anaglyph.algorithm = value; + }); + anaglyphFolder + .add(params, 'anaglyphColorMode', anaglyphColorModes) + .name('Color Mode') + .onChange(function (value) { + anaglyph.colorMode = value; + }); + anaglyphFolder + .add(params, 'planeDistance', 0.5, 10, 0.1) + .name('Plane Distance') + .onChange(function (value) { + anaglyph.planeDistance = value; + }); + anaglyphFolder.paramList.domElement.style.display = 'none'; + + window.addEventListener('resize', onWindowResize); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 25; +} + +function update(value) { + if (value === 'stereo') { + renderPipeline.outputNode = stereo; + anaglyphFolder.paramList.domElement.style.display = 'none'; + } else if (value === 'anaglyph') { + renderPipeline.outputNode = anaglyph; + anaglyphFolder.paramList.domElement.style.display = ''; + } else if (value === 'parallaxBarrier') { + renderPipeline.outputNode = parallaxBarrier; + anaglyphFolder.paramList.domElement.style.display = 'none'; + } + + renderPipeline.needsUpdate = true; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function extractPosition(matrix, position) { + position.x = matrix.elements[12]; + position.y = matrix.elements[13]; + position.z = matrix.elements[14]; +} + +function animate() { + timer.update(); + + const elapsedTime = timer.getElapsed() * 0.1; + + for (let i = 0; i < mesh.count; i++) { + mesh.getMatrixAt(i, dummy.matrix); + + extractPosition(dummy.matrix, position); + + position.x = 5 * Math.cos(elapsedTime + i); + position.y = 5 * Math.sin(elapsedTime + i * 1.1); + + dummy.matrix.setPosition(position); + + mesh.setMatrixAt(i, dummy.matrix); + + mesh.instanceMatrix.needsUpdate = true; + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_equirectangular.ts b/examples-testing/examples/webgpu_equirectangular.ts new file mode 100644 index 000000000..9e159e465 --- /dev/null +++ b/examples-testing/examples/webgpu_equirectangular.ts @@ -0,0 +1,57 @@ +import * as THREE from 'three/webgpu'; +import { texture, equirectUV } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let controls; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(1, 0, 0); + + const equirectTexture = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); + equirectTexture.colorSpace = THREE.SRGBColorSpace; + + scene = new THREE.Scene(); + scene.backgroundNode = texture(equirectTexture, equirectUV(), 0); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.rotateSpeed = -0.125; // negative, to track mouse pointer + controls.autoRotateSpeed = 1.0; + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(scene, 'backgroundIntensity', 0, 1).name('background intensity'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_fog_height.ts b/examples-testing/examples/webgpu_fog_height.ts new file mode 100644 index 000000000..65bda9cd8 --- /dev/null +++ b/examples-testing/examples/webgpu_fog_height.ts @@ -0,0 +1,99 @@ +import * as THREE from 'three/webgpu'; +import { exponentialHeightFogFactor, uniform, fog, color } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 600); + camera.position.set(20, 10, 25); + + scene = new THREE.Scene(); + + // height fog + + const density = uniform(0.04); + const height = uniform(2); + + const fogFactor = exponentialHeightFogFactor(density, height); + + scene.fogNode = fog(color(0xffdfc1), fogFactor); + scene.backgroundNode = color(0xffdfc1); + + // meshes + + const geometry = new THREE.BoxGeometry(1, 25, 1); + const material = new THREE.MeshPhongNodeMaterial({ color: 0xcd959a }); + + const mesh = new THREE.InstancedMesh(geometry, material, 100); + mesh.position.y = -10; + scene.add(mesh); + + const dummy = new THREE.Object3D(); + + let index = 0; + + for (let i = 0; i < 10; i++) { + for (let j = 0; j < 10; j++) { + dummy.position.x = -18 + i * 4; + dummy.position.z = -18 + j * 4; + + dummy.updateMatrix(); + + mesh.setMatrixAt(index++, dummy.matrix); + } + } + + // lights + + const directionalLight = new THREE.DirectionalLight(0xffc0cb, 2); + directionalLight.position.set(-10, 10, 10); + scene.add(directionalLight); + + const ambientLight = new THREE.AmbientLight(0xcccccc); + scene.add(ambientLight); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // gui + + const gui = renderer.inspector.createParameters('Fog Settings'); + + gui.add(density, 'value', 0.001, 0.1).step(0.0001).name('Density'); + gui.add(height, 'value', -5, 5).name('Height'); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 7; + controls.maxDistance = 100; + controls.maxPolarAngle = Math.PI / 2; + controls.enableDamping = true; + + window.addEventListener('resize', resize); +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_furnace_test.ts b/examples-testing/examples/webgpu_furnace_test.ts new file mode 100644 index 000000000..4afa5d2d0 --- /dev/null +++ b/examples-testing/examples/webgpu_furnace_test.ts @@ -0,0 +1,111 @@ +import * as THREE from 'three'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let scene, camera, renderer, radianceMap; + +let gui; + +const COLOR = 0xcccccc; + +async function init() { + const width = window.innerWidth; + const height = window.innerHeight; + const aspect = width / height; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setSize(width, height); + renderer.setPixelRatio(window.devicePixelRatio); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // scene + + scene = new THREE.Scene(); + + // camera + + camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); + camera.position.set(0, 0, 18); + + // + + initGui(); + + window.addEventListener('resize', onWindowResize); +} + +function createObjects() { + const geometry = new THREE.SphereGeometry(0.4, 32, 16); + + for (let x = 0; x <= 10; x++) { + for (let y = 0; y <= 10; y++) { + const material = new THREE.MeshPhysicalMaterial({ + roughness: x / 10, + metalness: y / 10, + color: 0xffffff, + envMap: radianceMap, + envMapIntensity: 1, + transmission: 0, + ior: 1.5, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = x - 5; + mesh.position.y = 5 - y; + scene.add(mesh); + } + } +} + +function createEnvironment() { + const envScene = new THREE.Scene(); + envScene.background = new THREE.Color(COLOR); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + radianceMap = pmremGenerator.fromScene(envScene).texture; + pmremGenerator.dispose(); + + scene.background = envScene.background; +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + + render(); +} + +function render() { + renderer.render(scene, camera); +} + +function initGui() { + gui = new GUI(); + + const param = { + tint: false, + }; + + gui.add(param, 'tint') + .name('Tint for Visibility') + .onChange(function (val) { + scene.traverse(function (child) { + const tint = val ? 0xccccff : 0xffffff; + + if (child.isMesh) child.material.color.setHex(tint); + }); + + render(); + }); +} + +Promise.resolve().then(init).then(createEnvironment).then(createObjects).then(render); diff --git a/examples-testing/examples/webgpu_gaussian_splat.ts b/examples-testing/examples/webgpu_gaussian_splat.ts new file mode 100644 index 000000000..555853fda --- /dev/null +++ b/examples-testing/examples/webgpu_gaussian_splat.ts @@ -0,0 +1,193 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { SPLATLoader } from 'three/addons/loaders/SPLATLoader.js'; +import { SPZLoader } from 'three/addons/loaders/SPZLoader.js'; +import { GaussianSplat } from 'three/addons/objects/GaussianSplat.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls, splats, splatRoot; +THREE.ColorManagement.workingColorSpace = THREE.SRGBColorSpace; + +const zeroVector = new THREE.Vector3(); + +const sources = { + millipede: { + name: 'Millipede (SPLAT)', + url: './models/splat/millipede.splat', + loader: SPLATLoader, + rotation: new THREE.Euler(-Math.PI * -1.1, Math.PI * -0.1, Math.PI * 0.15), + cameraPosition: new THREE.Vector3(0, 0.4, 1), + credit: { + author: 'Fabian Plum', + authorUrl: 'https://superspl.at/user?id=scant3d', + source: 'https://superspl.at/scene/3d5482d4', + license: 'CC Attribution', + licenseUrl: 'http://creativecommons.org/licenses/by/4.0/', + }, + }, + lion: { + name: 'Lion (SPZ)', + url: './models/spz/lion.v3.spz', + loader: SPZLoader, + rotation: new THREE.Euler(Math.PI, 0, 0), + cameraPosition: new THREE.Vector3(0, 0.2, 1), + credit: { + author: 'Renaud', + authorUrl: 'https://superspl.at/user?id=rohls', + source: 'https://superspl.at/scene/56155c3f', + license: 'CC Attribution', + licenseUrl: 'http://creativecommons.org/licenses/by/4.0/', + }, + }, + tomatoes: { + name: 'Tomatoes (SPZ v4)', + url: './models/spz/tomatoes.v4.spz', + loader: SPZLoader, + cameraPosition: new THREE.Vector3(0, 0.35, 1), + credit: { + author: 'Grail', + authorUrl: 'https://superspl.at/user/grail', + source: 'https://superspl.at/scene/2826d2c0', + license: 'CC Attribution', + licenseUrl: 'http://creativecommons.org/licenses/by/4.0/', + }, + }, +}; +const sourceNames = Object.values(sources).map(source => source.name); +const params = { + source: sources.lion.name, +}; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.set(0, 0.35, 3.2); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x07080f); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 1.2; + controls.maxDistance = 8; + controls.target.set(0, 0, 0); + controls.update(); + + const gui = renderer.inspector.createParameters('Building'); + gui.add(params, 'source', sourceNames) + .name('Splat') + .onChange(async value => { + await loadSplatSource(getSourceKeyByName(value)); + }); + + await loadSplatSource(getSourceKeyByName(params.source)); + + window.addEventListener('resize', onWindowResize); +} + +async function loadSplatSource(sourceKey) { + const source = sources[sourceKey]; + const splatData = await new source.loader().loadAsync(source.url); + + disposeCurrentSplats(); + + splats = new GaussianSplat(splatData, { autoSort: false }); + splatRoot = splats; + + if (source.rotation !== undefined) splatRoot.rotation.copy(source.rotation); + + scene.add(splatRoot); + + fitCameraToSplats(splats, source); + + updateLicenseInfo(source); +} + +function updateLicenseInfo(source) { + const license = document.getElementById('license'); + const credit = source.credit; + + if (credit === undefined) { + license.innerHTML = ''; + return; + } + + license.innerHTML = + 'Model by ' + + credit.author + + ', ' + + 'via superspl.at. ' + + 'Licensed under ' + + credit.license + + '.'; +} + +function getSourceKeyByName(sourceName) { + return Object.keys(sources).find(key => sources[key].name === sourceName); +} + +function disposeCurrentSplats() { + if (splatRoot === undefined) return; + + scene.remove(splatRoot); + splats.geometry.dispose(); + splats.material.dispose(); + splats = undefined; + splatRoot = undefined; +} + +function fitCameraToSplats(mesh, source) { + mesh.updateWorldMatrix(true, false); + + const sphere = mesh.splatGeometry.boundingSphere.clone().applyMatrix4(mesh.matrixWorld); + const radius = Math.max(sphere.radius, 0.01); + const distance = radius / Math.sin(THREE.MathUtils.degToRad(camera.fov) * 0.5); + + controls.minDistance = source.minDistance || radius * 1.1; + controls.maxDistance = source.maxDistance || radius * 8; + controls.target.copy(sphere.center).add(source.cameraTarget || zeroVector); + camera.position + .copy(source.cameraPosition) + .normalize() + .multiplyScalar(distance * 1.15) + .add(sphere.center); + camera.near = Math.max(distance / 1000, 0.001); + camera.far = Math.max(distance * 10, 10); + + camera.updateProjectionMatrix(); + controls.update(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + if (splats !== undefined) { + splats.updateSort(renderer, camera); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_generator_building.ts b/examples-testing/examples/webgpu_generator_building.ts new file mode 100644 index 000000000..ec0088e0e --- /dev/null +++ b/examples-testing/examples/webgpu_generator_building.ts @@ -0,0 +1,225 @@ +import * as THREE from 'three/webgpu'; +import { uniform } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; +import { + SkyscraperGenerator, + createSkyscraperMaterial, + pickBuildingColor, +} from 'three/addons/generators/city/SkyscraperGenerator.js'; + +let camera, scene, renderer, controls, generator, building, material; +let sky, sunLight, pmremGenerator, envScene; + +// reused by updateSun(): the current sun direction and the key-light +// colours it blends between as the sun nears the horizon or climbs high +const sun = new THREE.Vector3(); +const sunHorizonColor = new THREE.Color(0xffb072); +const sunMiddayColor = new THREE.Color(0xfff4e8); + +// every building takes one flat masonry colour; a uniform lets the seed +// repick it without recompiling the shared material +const baseColor = uniform(new THREE.Color(0xc6c0b2)); + +const parameters = { + seed: 7, + height: 100, + width: 34, + depth: 28, + floorHeight: 4, + bayWidth: 2.6, + chamfer: 5, + setback: 1.5, + timeOfDay: 17, // hours: 6 sunrise, 12 noon, 18 sunset +}; + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.25; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.environmentIntensity = 0.25; // sky as a soft fill; the sun is the key + + // a physical sky drives both the backdrop and the image-based lighting; + // updateSun() positions the sun and bakes it into the IBL environment + + sky = new SkyMesh(); + sky.scale.setScalar(10000); + sky.turbidity.value = 8; + sky.rayleigh.value = 3; + sky.mieCoefficient.value = 0.008; + sky.mieDirectionalG.value = 0.88; + + // the sky is baked into the environment map from this scene, then moved + // to the main scene as the backdrop ( see updateSun ) + envScene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20000); + camera.position.set(120, 95, 155); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target.set(0, 58, 0); + controls.maxPolarAngle = Math.PI * 0.495; + controls.minDistance = 30; + controls.maxDistance = 600; + controls.autoRotate = true; + controls.autoRotateSpeed = 0.3; + controls.update(); + + // a single directional key aligned with the sky's sun, for the crisp + // relief shadows the IBL alone can't give. updateSun() and + // fitShadowCamera() drive its colour, intensity and shadow frustum + + sunLight = new THREE.DirectionalLight(); + sunLight.castShadow = true; + sunLight.shadow.mapSize.set(2048, 2048); + sunLight.shadow.bias = -0.0004; + scene.add(sunLight); + scene.add(sunLight.target); + + // place the sun ( sky, IBL, key light and shadow ) for the current time + updateSun(); + + // an invisible ground that only catches the tower's shadow, large + // enough to hold the long shadow the low sun casts + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(2000, 2000).rotateX(-Math.PI / 2), + new THREE.ShadowMaterial({ color: 0x000000, opacity: 0.35 }), + ); + ground.receiveShadow = true; + scene.add(ground); + + material = createSkyscraperMaterial(baseColor); + generate(); + + const gui = renderer.inspector.createParameters('Building'); + gui.add(parameters, 'seed', 0, 100, 1).onChange(generate); + gui.add(parameters, 'height', 60, 200, 1).onChange(generate); + gui.add(parameters, 'width', 18, 60, 1).onChange(generate); + gui.add(parameters, 'depth', 16, 50, 1).onChange(generate); + gui.add(parameters, 'floorHeight', 3, 6, 0.1).onChange(generate); + gui.add(parameters, 'bayWidth', 1.8, 4.5, 0.1).onChange(generate); + gui.add(parameters, 'chamfer', 0, 10, 0.5).onChange(generate); + gui.add(parameters, 'setback', 0, 4, 0.1).onChange(generate); + gui.add(parameters, 'timeOfDay', 6, 18, 0.1).name('time of day').onChange(updateSun); + + window.addEventListener('resize', onWindowResize); +} + +function generate() { + if (building) { + scene.remove(building); + building.geometry.dispose(); + } + + baseColor.value.setHex(pickBuildingColor(parameters.seed)); + + generator = new SkyscraperGenerator( + { + seed: parameters.seed, + totalHeight: parameters.height, + footprint: { width: parameters.width, depth: parameters.depth }, + floorHeight: parameters.floorHeight, + bayWidth: parameters.bayWidth, + chamferWidth: parameters.chamfer, + setbackDepth: parameters.setback, + }, + material, + ); + building = generator.build(); + building.castShadow = building.receiveShadow = true; + scene.add(building); + + fitShadowCamera(); +} + +function updateSun() { + // map the time of day to a sun arc: low and warm at dawn / dusk, high and + // bright at noon, sweeping east → west across the day + + const t = parameters.timeOfDay; + const u = (t - 12) / 6; // -1 at sunrise, 0 at noon, +1 at sunset + const elevation = Math.max(0, 1 - u * u) * 72; // degrees above the horizon, peaks at noon + const azimuth = 90 - u * 55; // the sun swings east → west across the day + + sun.setFromSphericalCoords(1, THREE.MathUtils.degToRad(90 - elevation), THREE.MathUtils.degToRad(azimuth)); + sky.sunPosition.value.copy(sun); + + // physically-motivated key light: real sunlight is far brighter than the + // sky, so the sun stays the dominant source and cast shadows read clearly + // against the soft sky fill. the longer air path near the horizon dims and + // warms it ( the fill dims with it, as the environment is re-baked below ). + + const sinElevation = Math.sin(THREE.MathUtils.degToRad(elevation)); + const transmittance = Math.sqrt(Math.max(sinElevation, 0)); // 0 at the horizon → 1 at the zenith + sunLight.color.copy(sunHorizonColor).lerp(sunMiddayColor, transmittance); + sunLight.intensity = 6 * transmittance; // illuminance perpendicular to the rays; the renderer applies N·L per surface + + // re-bake the sky ( without the sun disc ) into the environment map for IBL + + sky.showSunDisc.value = false; + envScene.add(sky); + const env = pmremGenerator.fromScene(envScene).texture; + if (scene.environment) scene.environment.dispose(); + scene.environment = env; + sky.showSunDisc.value = true; + scene.add(sky); + + fitShadowCamera(); +} + +function fitShadowCamera() { + // fit the directional light's shadow frustum to the tower and the full + // ground shadow it casts, so a low sun's long shadow isn't clipped + + const height = parameters.height; + const tipDistance = height / Math.max(sun.y, 0.05); // shadow tip on the ground + const centerX = -sun.x * tipDistance * 0.5; + const centerZ = -sun.z * tipDistance * 0.5; + + const radius = Math.hypot(parameters.width, parameters.depth) * 0.5; + const half = Math.hypot(centerX, centerZ) + radius + 20; + const distance = half + height; // place the light clear of the whole scene + + sunLight.target.position.set(centerX, 0, centerZ); + sunLight.target.updateMatrixWorld(); + sunLight.position.set(centerX + sun.x * distance, sun.y * distance, centerZ + sun.z * distance); + + const shadowCamera = sunLight.shadow.camera; + shadowCamera.left = -half; + shadowCamera.right = half; + shadowCamera.top = half; + shadowCamera.bottom = -half; + shadowCamera.near = 1; + shadowCamera.far = distance * 2; + shadowCamera.updateProjectionMatrix(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_generator_city.ts b/examples-testing/examples/webgpu_generator_city.ts new file mode 100644 index 000000000..739569814 --- /dev/null +++ b/examples-testing/examples/webgpu_generator_city.ts @@ -0,0 +1,169 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; +import { CityGenerator, createBuildingMaterial, createRoadMaterial } from 'three/addons/generators/CityGenerator.js'; + +let camera, scene, renderer, controls, timer; +let cityGroup, materials, city, renderPipeline; +let sky, sun, sunLight, pmremGenerator, envScene; + +const parameters = { + seed: 94, + timeOfDay: 6.4, // hours: 6 sunrise, 12 noon, 18 sunset +}; + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.45; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.environmentIntensity = 0.2; // sky as a soft fill; the sun is the key + + // a physical sky drives both the backdrop and the image-based + // lighting; the time-of-day slider walks the sun along its arc + + sky = new SkyMesh(); + sky.scale.setScalar(10000); + sky.turbidity.value = 8; + sky.rayleigh.value = 3; + sky.mieCoefficient.value = 0.008; + sky.mieDirectionalG.value = 0.88; + + sun = new THREE.Vector3(); + envScene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 1, 20000); + camera.position.set(-35, 55, -100); + + controls = new FirstPersonControls(camera, renderer.domElement); + controls.movementSpeed = 15; + controls.lookSpeed = 0.25; + controls.lookAt(35, 55, 0); + + timer = new THREE.Timer(); + + city = new CityGenerator({ seed: parameters.seed }); + + // road: wet asphalt with sidewalks, lane lines and crosswalks, all + // aligned to the city grid via TSL. sized to the city footprint plus + // one street ( a crosswalk's width ) of margin all round + + const floorW = city.layout.cityW + 2 * city.layout.street; + const floorD = city.layout.cityD + 2 * city.layout.street; + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(floorW, floorD).rotateX(-Math.PI / 2), + createRoadMaterial(city.layout), + ); + ground.receiveShadow = true; + scene.add(ground); + + // a single directional key aligned with the sky's sun, for the crisp + // relief shadows the IBL alone can't give. its colour, intensity and + // position — and the baked environment — are set by updateSun() + + sunLight = new THREE.DirectionalLight(); + sunLight.castShadow = true; + sunLight.shadow.camera.left = -280; + sunLight.shadow.camera.right = 280; + sunLight.shadow.camera.top = 360; + sunLight.shadow.camera.bottom = -40; + sunLight.shadow.camera.far = 2400; + sunLight.shadow.mapSize.set(4096, 4096); + sunLight.shadow.bias = -0.0004; + scene.add(sunLight); + + updateSun(); + + materials = { building: createBuildingMaterial(city.layout, parameters.seed) }; + generateCity(); + + // bloom: a soft glow on the brightest areas, run on the linear HDR scene + // colour before tone mapping folds it back to display range + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePassColor = pass(scene, camera).getTextureNode('output'); + const bloomPass = bloom(scenePassColor, 0.05, 0.0, 0.0); + + renderPipeline.outputNode = scenePassColor.add(bloomPass); + + // parameters + + const gui = renderer.inspector.createParameters('City'); + gui.add(parameters, 'seed', 0, 100, 1).onChange(generateCity); + gui.add(parameters, 'timeOfDay', 6, 18, 0.1).name('time of day').onChange(updateSun); + gui.add(renderer, 'toneMappingExposure', 0.01, 1).name('exposure'); + gui.add(bloomPass.strength, 'value', 0, 2).name('bloom'); + + window.addEventListener('resize', onWindowResize); +} + +function updateSun() { + const t = parameters.timeOfDay; + const u = (t - 12) / 6; // -1 at sunrise, 0 at noon, +1 at sunset + const elevation = Math.max(0, 1 - u * u) * 72; // degrees above the horizon, peaks at noon + const azimuth = 90 - u * 55; // the sun swings east → west across the day + + sun.setFromSphericalCoords(1, THREE.MathUtils.degToRad(90 - elevation), THREE.MathUtils.degToRad(azimuth)); + sky.sunPosition.value.copy(sun); + + // physically-motivated key light: real sunlight is far brighter than the + // sky, so the sun stays the dominant source and cast shadows read clearly + // against the soft sky fill. the longer air path near the horizon dims and + // warms it ( the fill dims with it, as the environment is re-baked below ). + + const sinElevation = Math.sin(THREE.MathUtils.degToRad(elevation)); + const transmittance = Math.sqrt(Math.max(sinElevation, 0)); // 0 at the horizon → 1 at the zenith + sunLight.color.set(0xffb072).lerp(new THREE.Color(0xfff4e8), transmittance); + sunLight.intensity = 6 * transmittance; // illuminance perpendicular to the rays; the renderer applies N·L per surface + sunLight.position.copy(sun).multiplyScalar(600); + + // re-bake the sky ( without the sun disc ) into the environment map for IBL + + sky.showSunDisc.value = false; + envScene.add(sky); + const env = pmremGenerator.fromScene(envScene).texture; + if (scene.environment) scene.environment.dispose(); + scene.environment = env; + sky.showSunDisc.value = true; + scene.add(sky); +} + +function generateCity() { + if (cityGroup) scene.remove(cityGroup); + + city.parameters.seed = parameters.seed; + cityGroup = city.build(materials); + scene.add(cityGroup); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + controls.update(timer.getDelta()); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_geometry_loft.ts b/examples-testing/examples/webgpu_geometry_loft.ts new file mode 100644 index 000000000..f378f3384 --- /dev/null +++ b/examples-testing/examples/webgpu_geometry_loft.ts @@ -0,0 +1,955 @@ +import * as THREE from 'three/webgpu'; +import { + bumpMap, + color, + cos, + float, + mix, + mx_fractal_noise_float, + mx_noise_float, + mx_worley_noise_float, + positionLocal, + screenUV, + sin, + smoothstep, + uv, + vec3, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { LoftGeometry } from 'three/addons/geometries/LoftGeometry.js'; + +let group, camera, scene, renderer; + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + scene.environmentIntensity = 0.4; + + // a vignette in the background + + const background = screenUV.distance(0.5).mix(color(0x5d5d84), color(0x2e2e44)); + + scene.backgroundNode = background; + + // camera + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 15, 40); + + // controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 15; + controls.maxDistance = 50; // stay inside the curtain + controls.target.set(0, -3, 0); + controls.update(); + + // everything stands on a rotating floor. all surface detail is + // procedural: the loft uvs run along the loft ( uv().x ) and around + // the sections ( uv().y ), so patterns can follow the geometry + + group = new THREE.Group(); + scene.add(group); + + // floor: large, softly mottled, running under the curtain so its + // edge is never seen + + const floorMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 1 }); + floorMaterial.colorNode = color(0x555577).mul(mx_noise_float(positionLocal.mul(0.4)).mul(0.1).add(0.95)); + + const floor = new THREE.Mesh(new THREE.CircleGeometry(58, 64).rotateX(-Math.PI / 2), floorMaterial); + floor.position.y = -5.01; + floor.receiveShadow = true; + group.add(floor); + + // a theater curtain encircles the exhibition + + const curtainMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.9, side: THREE.DoubleSide }); + curtainMaterial.colorNode = color(0x86222e).mul( + mx_noise_float(vec3(uv().y.mul(300), uv().x.mul(6), 0)) + .mul(0.08) + .add(0.96), + ); + + const curtain = new THREE.Mesh(createCurtainGeometry(), curtainMaterial); + group.add(curtain); + + // light + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(18, 30, 12); + light.castShadow = true; + light.shadow.camera.left = -60; + light.shadow.camera.right = 60; + light.shadow.camera.top = 60; + light.shadow.camera.bottom = -60; + light.shadow.camera.far = 110; + light.shadow.mapSize.set(4096, 4096); + light.shadow.bias = -0.0005; + scene.add(light); + + // pedestals: polished marble. the veins meander and branch along the + // zero crossings of a domain warped fractal noise — a sharp dark + // core inside a soft halo — over a gently clouded white base + + const p = positionLocal.mul(0.9); + + const vein = mx_fractal_noise_float(p.add(mx_fractal_noise_float(p.mul(0.4), 3).mul(2)), 4) + .abs() + .oneMinus(); + const fine = mx_fractal_noise_float(p.mul(3).add(11), 3).abs().oneMinus(); + + const veining = vein.pow(4).mul(0.3).add(vein.pow(12).mul(0.7)).add(fine.pow(14).mul(0.2)); + const clouds = mx_noise_float(p.mul(0.5)).mul(0.5).add(0.5); + + const pedestalMaterial = new THREE.MeshStandardNodeMaterial(); + pedestalMaterial.colorNode = mix(mix(color(0xf4f4f7), color(0xeeeef2), clouds), color(0xd0d0d5), veining); + pedestalMaterial.roughnessNode = veining.mul(0.14).add(0.07); + pedestalMaterial.envMapIntensity = 1.5; + + function addPedestal(x, z, radius, height) { + const pedestal = new THREE.Mesh(createPedestalGeometry(radius, height), pedestalMaterial); + pedestal.position.set(x, -5, z); + pedestal.rotation.y = x * 0.7 + z * 1.3; // so the marbling differs per pedestal + group.add(pedestal); + + return -5 + height; // the top of the pedestal + } + + // a coffee set: a cup and a saucer lofted from the bottom center, up + // one side of the wall and back down the inside, and a handle swept + // along a spline. the porcelain glaze has a faint waviness + + const porcelain = new THREE.MeshStandardNodeMaterial(); + porcelain.roughnessNode = mx_noise_float(positionLocal.mul(6)).mul(0.08).add(0.2); + porcelain.normalNode = bumpMap(mx_noise_float(positionLocal.mul(2)).mul(0.05)); + + const coffee = new THREE.Group(); + coffee.position.y = addPedestal(0, 0, 3.6, 2.2); + coffee.scale.setScalar(0.75); + group.add(coffee); + + const saucer = new THREE.Mesh(createSaucerGeometry(), porcelain); + coffee.add(saucer); + + const cup = new THREE.Mesh(createCupGeometry(), porcelain); + cup.position.y = 0.3; + coffee.add(cup); + + const handle = new THREE.Mesh(createHandleGeometry(), porcelain); + handle.position.y = 0.3; + handle.rotation.y = 0.15; + coffee.add(handle); + + // the coffee has a lazy swirl on its surface + + const liquidMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.08 }); + liquidMaterial.colorNode = mix( + color(0x2b1a12), + color(0x4a2c1a), + mx_noise_float(positionLocal.mul(1.5)).mul(0.5).add(0.5), + ); + + const liquid = new THREE.Mesh(new THREE.CircleGeometry(2, 48).rotateX(-Math.PI / 2), liquidMaterial); + liquid.position.y = 3.6; + coffee.add(liquid); + + // a vase: circular sections with a varying radius. the glaze pools + // in throwing rings along the profile + + const vaseRings = sin(uv().x.mul(160)); + + const vaseMaterial = new THREE.MeshStandardNodeMaterial({ side: THREE.DoubleSide }); + vaseMaterial.colorNode = mix( + color(0x2e6f9e), + color(0x82b8d8), + mx_noise_float(positionLocal.mul(1.2)).mul(0.5).add(0.5), + ); + vaseMaterial.roughnessNode = vaseRings.mul(0.08).add(0.3); + vaseMaterial.normalNode = bumpMap(vaseRings.mul(0.012)); + + const vase = new THREE.Mesh(createVaseGeometry(), vaseMaterial); + vase.position.set(-10.5, addPedestal(-10.5, -10.5, 3.6, 1.1), -10.5); + group.add(vase); + + // a seashell: circular sections that grow while sweeping along a + // logarithmic spiral, with growth bands and fine ridges along it + + const shellMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.5, side: THREE.DoubleSide }); + shellMaterial.colorNode = mix( + color(0xc9a87f), + color(0xf2e6d8), + mx_noise_float(vec3(uv().x.mul(24), 0, 0)) + .mul(0.5) + .add(0.5), + ); + shellMaterial.normalNode = bumpMap(sin(uv().x.mul(480)).mul(0.02)); + + const shell = new THREE.Mesh(createShellGeometry(), shellMaterial); + shell.position.set(10.5, addPedestal(10.5, -10.5, 3.6, 1.1) + 1.92, -10.5); + shell.rotation.y = -Math.PI / 2; + shell.scale.setScalar(0.8); + group.add(shell); + + // a twisted star: non-circular sections that rotate and scale along + // the loft, in sandy terracotta + + const starMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.6 }); + starMaterial.colorNode = color(0xcc5544).mul(mx_noise_float(positionLocal.mul(3)).mul(0.12).add(0.94)); + starMaterial.normalNode = bumpMap(mx_noise_float(positionLocal.mul(50)).mul(0.008)); + + const star = new THREE.Mesh(createStarGeometry(), starMaterial); + star.position.set(-10.5, addPedestal(-10.5, 10.5, 3.6, 1.1), 10.5); + star.scale.setScalar(0.8); + group.add(star); + + // a ribbon: open two-point sections ( closed: false ), in gold + // brushed along its length + + const brush = mx_noise_float(vec3(uv().x.mul(6), uv().y.mul(160), 0)); + + const ribbonMaterial = new THREE.MeshStandardNodeMaterial({ + color: 0xffcc44, + metalness: 1, + side: THREE.DoubleSide, + }); + ribbonMaterial.roughnessNode = brush.mul(0.08).add(0.1); + ribbonMaterial.normalNode = bumpMap(brush.mul(0.004)); + ribbonMaterial.envMapIntensity = 2.5; + + const ribbon = new THREE.Mesh(createRibbonGeometry(), ribbonMaterial); + ribbon.position.set(10.5, addPedestal(10.5, 10.5, 3.6, 1.1), 10.5); + group.add(ribbon); + + // a toothpaste tube: circular sections that morph into a flat + // crimped seam, with stripes printed around the body + + const tubeU = uv().x; + const tealStripe = smoothstep(0.48, 0.5, tubeU).sub(smoothstep(0.6, 0.62, tubeU)); + const redStripe = smoothstep(0.66, 0.68, tubeU).sub(smoothstep(0.72, 0.74, tubeU)); + + const tubeMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.25 }); + tubeMaterial.colorNode = mix(mix(color(0xf2f2f2), color(0x2aa6b8), tealStripe), color(0xd0543a), redStripe); + + const tube = new THREE.Mesh(createToothpasteGeometry(), tubeMaterial); + tube.position.set(7.8, addPedestal(7.8, 0, 2, 1.6), 0); + tube.rotation.y = 0.5; + group.add(tube); + + // a pumpkin: lobed sections around a squashed profile. the shading + // follows the same crease function as the geometry, so the narrow + // creases are darker and rougher than the broad lobes + + const lobe = cos(uv().y.mul(Math.PI * 7)) + .abs() + .pow(0.35); + + const pumpkinMaterial = new THREE.MeshStandardNodeMaterial(); + pumpkinMaterial.colorNode = mix( + mix(color(0x9c4f16), color(0xe6913d), lobe), + color(0x8a7a2e), // greener around the stem + smoothstep(0.88, 1, uv().x).mul(0.6), + ); + pumpkinMaterial.roughnessNode = float(0.7).sub(lobe.mul(0.2)); + pumpkinMaterial.normalNode = bumpMap(mx_noise_float(vec3(uv().y.mul(120), uv().x.mul(5), 0)).mul(0.01)); + + const pumpkinY = addPedestal(0, 7.8, 2, 1.6); + + const pumpkin = new THREE.Mesh(createPumpkinGeometry(), pumpkinMaterial); + pumpkin.position.set(0, pumpkinY, 7.8); + group.add(pumpkin); + + const pumpkinStemMaterial = new THREE.MeshStandardNodeMaterial({ color: 0x667744 }); + pumpkinStemMaterial.roughnessNode = mx_noise_float(positionLocal.mul(20)).mul(0.2).add(0.7); + + const pumpkinStem = new THREE.Mesh(createPumpkinStemGeometry(), pumpkinStemMaterial); + pumpkinStem.position.set(0, pumpkinY, 7.8); + group.add(pumpkinStem); + + // a mushroom: a cap that folds under its own rim. the cap uvs run + // from under the rim ( u 0 ) over the edge to the top center ( u 1 ), + // so the red dome with its raised warts and the pale underside with + // its radial gills can share one material + + const capU = uv().x; + const dome = smoothstep(0.42, 0.58, capU); + const warts = smoothstep(0.18, 0.38, mx_worley_noise_float(positionLocal.mul(2.4))) + .oneMinus() + .mul(dome); + const gills = sin(uv().y.mul(Math.PI * 120)) + .mul(0.5) + .add(0.5) + .mul(dome.oneMinus()); + + const capMaterial = new THREE.MeshStandardNodeMaterial(); + capMaterial.colorNode = mix( + mix(color(0xe8dcc4), color(0xbfae8e), gills), + mix(color(0xa32d20), color(0xf2e9d8), warts), + dome, + ); + capMaterial.roughnessNode = float(0.55).sub(dome.mul(0.2)).add(warts.mul(0.25)); + capMaterial.normalNode = bumpMap(warts.mul(0.08).sub(gills.mul(0.015))); + + const mushroomY = addPedestal(-7.8, 0, 2, 1.6); + + const mushroomCap = new THREE.Mesh(createMushroomCapGeometry(), capMaterial); + mushroomCap.position.set(-7.8, mushroomY, 0); + group.add(mushroomCap); + + const mushroomStemMaterial = new THREE.MeshStandardNodeMaterial(); + mushroomStemMaterial.colorNode = color(0xe5d5b5).mul( + mx_noise_float(vec3(uv().y.mul(24), uv().x.mul(2), 0)) + .mul(0.1) + .add(0.94), + ); + mushroomStemMaterial.roughnessNode = mx_noise_float(positionLocal.mul(12)).mul(0.15).add(0.55); + + const mushroomStem = new THREE.Mesh(createMushroomStemGeometry(), mushroomStemMaterial); + mushroomStem.position.set(-7.8, mushroomY, 0); + group.add(mushroomStem); + + // a goblet: a foot, a thin stem and a bowl with folded back walls, + // in hammered copper + + const dents = mx_worley_noise_float(positionLocal.mul(5)); + + const gobletMaterial = new THREE.MeshStandardNodeMaterial({ color: 0xb87333, metalness: 1 }); + gobletMaterial.roughnessNode = dents.mul(0.18).add(0.12); + gobletMaterial.normalNode = bumpMap(dents.mul(0.1)); + gobletMaterial.envMapIntensity = 2; + + const goblet = new THREE.Mesh(createGobletGeometry(), gobletMaterial); + goblet.position.set(0, addPedestal(0, -7.8, 2, 1.6), -7.8); + group.add(goblet); + + // a rope barrier around the exhibition: brass stanchions, and a + // twisted cord sagging between them + + const brassMaterial = new THREE.MeshStandardNodeMaterial({ color: 0xc9a86a, metalness: 1 }); + brassMaterial.roughnessNode = mx_noise_float(positionLocal.mul(10)).mul(0.06).add(0.16); + brassMaterial.envMapIntensity = 2; + + const ropeMaterial = new THREE.MeshStandardNodeMaterial({ color: 0x8a2433, roughness: 0.65 }); + ropeMaterial.normalNode = bumpMap( + sin( + uv() + .x.mul(200) + .add(uv().y.mul(Math.PI * 2)), + ).mul(0.015), + ); // the twist of the cord + + const posts = 14; + const barrierRadius = 20; + + const stanchionGeometry = createStanchionGeometry(); + const ropeGeometry = createRopeGeometry(2 * barrierRadius * Math.sin(Math.PI / posts)); + + for (let i = 0; i < posts; i++) { + const angle = ((i + 0.5) / posts) * Math.PI * 2; + + const post = new THREE.Mesh(stanchionGeometry, brassMaterial); + post.position.set(Math.sin(angle) * barrierRadius, -5, Math.cos(angle) * barrierRadius); + group.add(post); + + const mid = angle + Math.PI / posts; + const midRadius = barrierRadius * Math.cos(Math.PI / posts); + + const rope = new THREE.Mesh(ropeGeometry, ropeMaterial); + rope.position.set(Math.sin(mid) * midRadius, -5 + 2.05, Math.cos(mid) * midRadius); + rope.rotation.y = mid; + group.add(rope); + } + + // shadows + + group.traverse(child => { + if (child.isMesh) child.castShadow = child.receiveShadow = true; + }); + + floor.castShadow = false; + liquid.castShadow = false; + + // every loft remembers the sections it was skinned through in + // geometry.parameters, so a skeleton of rings can be rebuilt from + // the meshes themselves + + const skeleton = new THREE.Group(); + skeleton.visible = false; + group.add(skeleton); + + const lofts = []; + + group.traverse(child => { + if (child.isMesh && child.geometry.type === 'LoftGeometry') lofts.push(child); + }); + + const lineMaterial = new THREE.LineBasicMaterial({ color: 0xaaccee }); + + group.updateMatrixWorld(true); + + for (const mesh of lofts) { + const { sections, closed } = mesh.geometry.parameters; + const step = Math.max(1, Math.round(sections.length / 20)); + + const positions = []; + + function addRing(ring) { + const segments = closed ? ring.length : ring.length - 1; + + for (let j = 0; j < segments; j++) { + const a = ring[j], + b = ring[(j + 1) % ring.length]; + positions.push(a.x, a.y, a.z, b.x, b.y, b.z); + } + } + + for (let i = 0; i < sections.length; i += step) addRing(sections[i]); + if ((sections.length - 1) % step !== 0) addRing(sections[sections.length - 1]); + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + + const lines = new THREE.LineSegments(geometry, lineMaterial); + lines.applyMatrix4(mesh.matrixWorld); + skeleton.add(lines); + } + + // parameters + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.add({ sections: false }, 'sections').onChange(value => { + skeleton.visible = value; + liquid.visible = !value; + + for (const mesh of lofts) mesh.visible = !value; + }); + + gui.add({ wireframe: false }, 'wireframe').onChange(value => { + group.traverse(child => { + if (child.isMesh) { + child.material.wireframe = value; + child.material.needsUpdate = true; + } + }); + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +// revolves a smoothed 2d profile ( x = radius, y = height ) into +// circular sections, like a lathe + +function createRevolvedSections(profile, divisions, segments) { + const points = new THREE.SplineCurve(profile).getPoints(divisions); + + const sections = []; + + for (let i = 0; i <= divisions; i++) { + const point = points[i]; + + const ring = []; + + for (let j = 0; j < segments; j++) { + const angle = (j / segments) * Math.PI * 2; + ring.push(new THREE.Vector3(Math.sin(angle) * point.x, point.y, Math.cos(angle) * point.x)); + } + + sections.push(ring); + } + + return sections; +} + +function createPedestalGeometry(radius, height) { + // a stepped plinth, a tapered shaft and a cornice; revolved without + // smoothing, one ring per profile point. doubled points split the + // vertex normals, keeping those turnings crisp + + const profile = [ + new THREE.Vector2(0.2, 0), + new THREE.Vector2(radius * 1.06, 0), + new THREE.Vector2(radius * 1.06, height * 0.1), + new THREE.Vector2(radius * 1.06, height * 0.1), + new THREE.Vector2(radius * 0.98, height * 0.16), + new THREE.Vector2(radius * 0.94, height * 0.55), + new THREE.Vector2(radius * 0.97, height * 0.84), + new THREE.Vector2(radius * 1.04, height * 0.88), + new THREE.Vector2(radius * 1.04, height * 0.97), + new THREE.Vector2(radius * 1.04, height * 0.97), + new THREE.Vector2(radius * 0.98, height), + new THREE.Vector2(radius * 0.98, height), + new THREE.Vector2(radius * 0.5, height - 0.004), + new THREE.Vector2(0.2, height), + ]; + + const sections = []; + + for (const point of profile) { + const ring = []; + + for (let j = 0; j < 48; j++) { + const angle = (j / 48) * Math.PI * 2; + ring.push(new THREE.Vector3(Math.sin(angle) * point.x, point.y, Math.cos(angle) * point.x)); + } + + sections.push(ring); + } + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createCupGeometry() { + // from the bottom center, up the egg shaped outer wall, over the lip + // and back down the inner wall + + const profile = [ + new THREE.Vector2(0.2, 0), + new THREE.Vector2(0.7, 0.04), + new THREE.Vector2(1.05, 0.1), + new THREE.Vector2(1.75, 0.55), + new THREE.Vector2(2.25, 1.45), + new THREE.Vector2(2.36, 2.2), + new THREE.Vector2(2.3, 3.1), + new THREE.Vector2(2.22, 3.82), + new THREE.Vector2(2.18, 3.95), + new THREE.Vector2(2.06, 3.8), + new THREE.Vector2(2.18, 2.2), + new THREE.Vector2(1.5, 0.75), + new THREE.Vector2(0.9, 0.55), + new THREE.Vector2(0.2, 0.62), + ]; + + const sections = createRevolvedSections(profile, 120, 64); + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createSaucerGeometry() { + // from the bottom center, out along the underside, around the thin + // rim and back across the gently dished top + + const profile = [ + new THREE.Vector2(0.2, 0), + new THREE.Vector2(1.3, 0.08), + new THREE.Vector2(2.6, 0.35), + new THREE.Vector2(3.7, 0.8), + new THREE.Vector2(4.2, 1), + new THREE.Vector2(3.4, 0.68), + new THREE.Vector2(2, 0.3), + new THREE.Vector2(1, 0.18), + new THREE.Vector2(0.2, 0.26), + ]; + + const sections = createRevolvedSections(profile, 120, 64); + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createHandleGeometry() { + // an ear shaped loop swept along a spline, slightly tapering; the + // ends slim down so they stay buried inside the thin cup wall + + const path = new THREE.SplineCurve([ + new THREE.Vector2(2.2, 3.3), + new THREE.Vector2(2.9, 3.45), + new THREE.Vector2(3.6, 2.85), + new THREE.Vector2(3.65, 1.95), + new THREE.Vector2(3, 1.2), + new THREE.Vector2(1.78, 1.05), + ]); + + const divisions = 60; + const points = path.getPoints(divisions); + + const sections = []; + + for (let i = 0; i <= divisions; i++) { + const t = i / divisions; + + const point = points[i]; + const tangent = path.getTangent(t); + + const scale = + (1 - 0.25 * t) * + (0.28 + 0.72 * THREE.MathUtils.smoothstep(t, 0, 0.12)) * + (0.28 + 0.72 * (1 - THREE.MathUtils.smoothstep(t, 0.88, 1))); + + const a = 0.22 * scale; // in the plane of the loop + const b = 0.27 * scale; // across the loop + + const ring = []; + + for (let j = 0; j < 16; j++) { + const phi = (j / 16) * Math.PI * 2; + const radial = a * Math.cos(phi); + + ring.push(new THREE.Vector3(point.x - radial * tangent.y, point.y + radial * tangent.x, b * Math.sin(phi))); + } + + sections.push(ring); + } + + return new LoftGeometry(sections); +} + +function createVaseGeometry() { + // a full belly, a slender waist and a flared lip + + const profile = [ + new THREE.Vector2(0.2, 0), + new THREE.Vector2(1.05, 0.05), + new THREE.Vector2(1.5, 0.3), + new THREE.Vector2(2.1, 1.4), + new THREE.Vector2(2.2, 2.3), + new THREE.Vector2(1.8, 3.6), + new THREE.Vector2(1.2, 4.8), + new THREE.Vector2(0.85, 5.8), + new THREE.Vector2(0.72, 6.6), + new THREE.Vector2(0.8, 7.3), + new THREE.Vector2(1.1, 7.9), + new THREE.Vector2(1.3, 8.2), + ]; + + const sections = createRevolvedSections(profile, 100, 48); + + return new LoftGeometry(sections, { capStart: true }); +} + +function createShellGeometry() { + const turns = 3; + const growth = 0.18; + const scale = Math.exp(growth * turns * Math.PI * 2); + + const sections = []; + + for (let i = 0; i <= 150; i++) { + const t = i / 150; + + const angle = turns * Math.PI * 2 * t; + const e = Math.exp(growth * angle) / scale; + + const pathRadius = 3 * e; + const sectionRadius = 2.4 * e; + const sin = Math.sin(angle); + const cos = Math.cos(angle); + + const points = []; + + for (let j = 0; j < 32; j++) { + const phi = (j / 32) * Math.PI * 2; + const r = pathRadius + sectionRadius * Math.cos(phi); + + points.push(new THREE.Vector3(r * sin, 4.5 * (1 - e) + sectionRadius * Math.sin(phi), r * cos)); + } + + sections.push(points); + } + + return new LoftGeometry(sections); +} + +function createStarGeometry() { + const sections = []; + + for (let i = 0; i <= 60; i++) { + const t = i / 60; + + const twist = (t * Math.PI) / 3; + const scale = 1 - 0.35 * Math.sin(t * Math.PI); + + const points = []; + + for (let j = 0; j < 96; j++) { + const angle = (j / 96) * Math.PI * 2; + const radius = (2.4 + 0.7 * Math.cos(5 * angle)) * scale; + points.push(new THREE.Vector3(Math.sin(angle + twist) * radius, t * 10, Math.cos(angle + twist) * radius)); + } + + sections.push(points); + } + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createRibbonGeometry() { + const sections = []; + + for (let i = 0; i <= 120; i++) { + const t = i / 120; + + const angle = t * Math.PI * 2 * 2.5; + const sin = Math.sin(angle); + const cos = Math.cos(angle); + + sections.push([new THREE.Vector3(3 * sin, t * 7.5, 3 * cos), new THREE.Vector3(3 * sin, t * 7.5 + 2, 3 * cos)]); + } + + return new LoftGeometry(sections, { closed: false }); +} + +function createToothpasteGeometry() { + // a cap, a shoulder, and a body whose circular sections flatten + // into a wide crimped seam at the top + + const sections = []; + + for (let i = 0; i <= 80; i++) { + const t = i / 80; + + const radius = 0.5 + 0.28 * THREE.MathUtils.smoothstep(t, 0.08, 0.2); + const crimp = THREE.MathUtils.smoothstep(t, 0.3, 0.95); + + const width = radius * (1 - crimp) + 1.15 * crimp; + const depth = radius * (1 - crimp) + 0.05 * crimp; + + const points = []; + + for (let j = 0; j < 48; j++) { + const angle = (j / 48) * Math.PI * 2; + points.push(new THREE.Vector3(Math.sin(angle) * width, t * 4.2, Math.cos(angle) * depth)); + } + + sections.push(points); + } + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createPumpkinGeometry() { + // a squashed sphere with broad lobes split by narrow creases, and + // a sunken hollow around the stem + + const sections = []; + + for (let i = 0; i <= 60; i++) { + const t = i / 60; + + const angle = Math.PI * (0.03 + 0.94 * t); + const radius = 1.85 * Math.pow(Math.sin(angle), 0.62); + const creases = 0.15 * Math.sin(Math.PI * t); + + const y = 2.05 * t - 0.75 * THREE.MathUtils.smoothstep(t, 0.8, 1); + + const points = []; + + for (let j = 0; j < 96; j++) { + const theta = (j / 96) * Math.PI * 2; + const lobe = Math.pow(Math.abs(Math.cos(3.5 * theta)), 0.35); + const r = radius * (1 - creases + creases * lobe); + + points.push(new THREE.Vector3(Math.sin(theta) * r, y, Math.cos(theta) * r)); + } + + sections.push(points); + } + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createPumpkinStemGeometry() { + // a ribbed stalk, flared at its base, that rises out of the hollow + // and leans over + + const sections = []; + + for (let i = 0; i <= 30; i++) { + const t = i / 30; + + const radius = 0.2 - 0.09 * t + 0.14 * Math.pow(1 - t, 4); + const lean = 0.45 * t * t; + + const points = []; + + for (let j = 0; j < 32; j++) { + const angle = (j / 32) * Math.PI * 2; + const r = radius * (0.92 + 0.13 * Math.pow(Math.abs(Math.cos(2.5 * angle)), 0.5)); + + points.push(new THREE.Vector3(lean + Math.sin(angle) * r, 1.3 + 1.15 * t, Math.cos(angle) * r)); + } + + sections.push(points); + } + + return new LoftGeometry(sections, { capEnd: true }); +} + +function createMushroomCapGeometry() { + // from under the rim, around the edge and over the dome + + const profile = [ + new THREE.Vector2(0.35, 2.02), + new THREE.Vector2(1.1, 2), + new THREE.Vector2(1.65, 2.15), + new THREE.Vector2(1.78, 2.4), + new THREE.Vector2(1.5, 2.85), + new THREE.Vector2(0.95, 3.18), + new THREE.Vector2(0.2, 3.32), + ]; + + const sections = createRevolvedSections(profile, 80, 48); + + return new LoftGeometry(sections, { capEnd: true }); +} + +function createMushroomStemGeometry() { + const profile = [ + new THREE.Vector2(0.2, 0), + new THREE.Vector2(0.55, 0.05), + new THREE.Vector2(0.45, 0.9), + new THREE.Vector2(0.4, 1.7), + new THREE.Vector2(0.42, 2.3), + ]; + + const sections = createRevolvedSections(profile, 60, 32); + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createGobletGeometry() { + // a foot, a thin stem, and a bowl that folds back down inside + + const profile = [ + new THREE.Vector2(0.2, 0), + new THREE.Vector2(1.25, 0.05), + new THREE.Vector2(1.35, 0.2), + new THREE.Vector2(0.6, 0.5), + new THREE.Vector2(0.28, 0.9), + new THREE.Vector2(0.24, 1.7), + new THREE.Vector2(0.7, 2.15), + new THREE.Vector2(1.15, 2.8), + new THREE.Vector2(1.28, 3.5), + new THREE.Vector2(1.27, 3.62), + new THREE.Vector2(1.16, 3.5), + new THREE.Vector2(0.95, 2.85), + new THREE.Vector2(0.45, 2.25), + new THREE.Vector2(0.2, 2.32), + ]; + + const sections = createRevolvedSections(profile, 140, 48); + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createStanchionGeometry() { + // a flat disc base, a slender pole and a small ball finial + + const profile = [ + new THREE.Vector2(0.16, 0), + new THREE.Vector2(0.42, 0.04), + new THREE.Vector2(0.46, 0.12), + new THREE.Vector2(0.28, 0.22), + new THREE.Vector2(0.08, 0.38), + new THREE.Vector2(0.06, 1), + new THREE.Vector2(0.06, 1.85), + new THREE.Vector2(0.11, 1.95), + new THREE.Vector2(0.19, 2.08), + new THREE.Vector2(0.2, 2.2), + new THREE.Vector2(0.11, 2.3), + new THREE.Vector2(0.04, 2.34), + ]; + + const sections = createRevolvedSections(profile, 80, 24); + + return new LoftGeometry(sections, { capStart: true, capEnd: true }); +} + +function createRopeGeometry(length) { + // a cord sagging between two stanchions, with both ends buried in + // their poles + + const sag = 0.9; + + const sections = []; + + for (let i = 0; i <= 40; i++) { + const t = i / 40; + + const x = (t - 0.5) * length; + const y = -sag * 4 * t * (1 - t); + + // the in plane tangent orients the rings along the curve + + const tx = length; + const ty = -sag * 4 * (1 - 2 * t); + const tl = Math.sqrt(tx * tx + ty * ty); + + const points = []; + + for (let j = 0; j < 16; j++) { + const phi = (j / 16) * Math.PI * 2; + const radial = 0.08 * Math.cos(phi); + + points.push(new THREE.Vector3(x - (radial * ty) / tl, y + (radial * tx) / tl, 0.08 * Math.sin(phi))); + } + + sections.push(points); + } + + return new LoftGeometry(sections); +} + +function createCurtainGeometry() { + // rows of pleated rings hanging from above; the folds deepen and + // drift sideways as they fall + + const sections = []; + + for (let i = 0; i <= 30; i++) { + const t = i / 30; + const y = -5 + 25 * t; + + const points = []; + + for (let j = 0; j < 480; j++) { + const s = j / 480; + + const folds = (1.2 - 0.5 * t) * Math.sin(s * Math.PI * 2 * 48 + t * 2); + const sway = 0.5 * Math.sin(s * Math.PI * 2 * 5 + t * 3); + + const theta = s * Math.PI * 2; + const r = 55 + folds + sway; + + points.push(new THREE.Vector3(Math.sin(theta) * r, y, Math.cos(theta) * r)); + } + + sections.push(points); + } + + return new LoftGeometry(sections); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + group.rotation.y += 0.001; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_hdr.ts b/examples-testing/examples/webgpu_hdr.ts new file mode 100644 index 000000000..b96ba5f42 --- /dev/null +++ b/examples-testing/examples/webgpu_hdr.ts @@ -0,0 +1,124 @@ +import * as THREE from 'three/webgpu'; +import { pass, uv, uniform } from 'three/tsl'; +import WebGPU from 'three/addons/capabilities/WebGPU.js'; +import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { ExtendedSRGBColorSpace, ExtendedSRGBColorSpaceImpl } from 'three/addons/math/ColorSpaces.js'; + +const params = { + intensity: uniform(4.0, 'float').setName('intensity'), + hardness: uniform(0.4, 'float').setName('hardness'), + radius: uniform(0.5, 'float').setName('radius'), + afterImageDecay: uniform(0.985, 'float').setName('afterImageDecay'), +}; + +const hdrMediaQuery = window.matchMedia('(dynamic-range: high)'); + +function updateHDRWarning() { + const displayIsHDR = hdrMediaQuery.matches; + document.querySelector('#no-hdr').style.display = displayIsHDR ? 'none' : ''; +} + +hdrMediaQuery.addEventListener('change', updateHDRWarning); +updateHDRWarning(); + +if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + throw new Error('No WebGPU support'); +} + +// Enable Extended sRGB output color space for HDR presentation +THREE.ColorManagement.define({ [ExtendedSRGBColorSpace]: ExtendedSRGBColorSpaceImpl }); + +// Renderer (HalfFloat output + Extended sRGB) +const renderer = new THREE.WebGPURenderer({ + antialias: true, + outputType: THREE.HalfFloatType, +}); + +renderer.outputColorSpace = ExtendedSRGBColorSpace; +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.inspector = new Inspector(); +document.body.appendChild(renderer.domElement); + +const camera = new THREE.OrthographicCamera(0, window.innerWidth, window.innerHeight, 0, 1, 2); +camera.position.z = 1; + +// Brush scene (rendered into drawTarget) +const brushScene = new THREE.Scene(); + +brushScene.background = new THREE.Color(0xffffff); +const brushMat = new THREE.MeshBasicNodeMaterial(); +brushMat.transparent = true; +brushMat.depthTest = false; +brushMat.depthWrite = false; +brushMat.blending = THREE.AdditiveBlending; // additive to build HDR energy + +const renderPipeline = new THREE.RenderPipeline(renderer); +const brushPass = pass(brushScene, camera, { type: THREE.HalfFloatType }); +brushPass.renderTarget.texture.colorSpace = ExtendedSRGBColorSpace; + +renderPipeline.outputNode = afterImage(brushPass, params.afterImageDecay); + +// HDR brush uniforms +const uColor = params.intensity; +const uHard = params.hardness; +const uRadius = params.radius; + +// Radial falloff in TSL +const d = uv().sub(0.5).length(); +const t = d.div(uRadius); +const a = t.clamp().oneMinus().pow(uHard.mul(8.0).add(1.0)); + +brushMat.colorNode = uColor.mul(a); +brushMat.opacityNode = a; // premultiplied style with additive blending + +const brushMesh = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), brushMat); +brushMesh.scale.set(300, 300, 1); // ~300px default brush size +brushScene.add(brushMesh); + +function onPointerMove(e) { + const rect = renderer.domElement.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + + // camera has origin at bottom-left (0,0) + brushMesh.position.set(x, window.innerHeight - y, 0); +} + +window.addEventListener('pointermove', onPointerMove, { passive: false }); + +// Prevent mobile scroll on touch +renderer.domElement.addEventListener('touchstart', e => e.preventDefault(), { passive: false }); +renderer.domElement.addEventListener('touchmove', e => e.preventDefault(), { passive: false }); +renderer.domElement.addEventListener('touchend', e => e.preventDefault(), { passive: false }); + +// GUI setup +const gui = renderer.inspector.createParameters('Settings'); + +const colorFolder = gui.addFolder('HDR'); +colorFolder.add(params.intensity, 'value', 0, 10, 0.1).name('Intensity'); + +const brushFolder = gui.addFolder('Brush Settings'); +brushFolder.add(params.hardness, 'value', 0, 0.99, 0.01).name('Hardness'); +brushFolder.add(params.radius, 'value', 0.1, 2.0, 0.01).name('Radius'); + +const effectFolder = gui.addFolder('Effects'); +effectFolder.add(params.afterImageDecay, 'value', 0.9, 0.999, 0.001).name('After Image Decay'); + +// Resize handling +function onResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + camera.right = window.innerWidth; + camera.top = window.innerHeight; + camera.updateProjectionMatrix(); +} + +window.addEventListener('resize', onResize); + +// Main loop +renderer.setAnimationLoop(async () => { + renderPipeline.render(); +}); diff --git a/examples-testing/examples/webgpu_instance_mesh.ts b/examples-testing/examples/webgpu_instance_mesh.ts new file mode 100644 index 000000000..0abd2f26c --- /dev/null +++ b/examples-testing/examples/webgpu_instance_mesh.ts @@ -0,0 +1,98 @@ +import * as THREE from 'three/webgpu'; +import { mix, range, normalWorld, oscSine, time } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +let mesh; +const amount = parseInt(window.location.search.slice(1)) || 10; +const count = Math.pow(amount, 3); +const dummy = new THREE.Object3D(); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(amount * 0.9, amount * 0.9, amount * 0.9); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + + const material = new THREE.MeshBasicMaterial(); + + // random colors between instances from 0x000000 to 0xFFFFFF + const randomColors = range(new THREE.Color(0x000000), new THREE.Color(0xffffff)); + + material.colorNode = mix(normalWorld, randomColors, oscSine(time.mul(0.1))); + + const loader = new THREE.BufferGeometryLoader(); + loader.load('models/json/suzanne_buffergeometry.json', function (geometry) { + geometry.computeVertexNormals(); + geometry.scale(0.5, 0.5, 0.5); + + mesh = new THREE.InstancedMesh(geometry, material, count); + mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); + + scene.add(mesh); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(mesh, 'count', 1, count, 1).name('instance count'); + }); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + render(); +} + +async function render() { + if (mesh) { + const time = Date.now() * 0.001; + + mesh.rotation.x = Math.sin(time / 4); + mesh.rotation.y = Math.sin(time / 2); + + let i = 0; + const offset = (amount - 1) / 2; + + for (let x = 0; x < amount; x++) { + for (let y = 0; y < amount; y++) { + for (let z = 0; z < amount; z++) { + dummy.position.set(offset - x, offset - y, offset - z); + dummy.rotation.y = Math.sin(x / 4 + time) + Math.sin(y / 4 + time) + Math.sin(z / 4 + time); + dummy.rotation.z = dummy.rotation.y * 2; + + dummy.updateMatrix(); + + mesh.setMatrixAt(i++, dummy.matrix); + } + } + } + } + + await renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_instance_path.ts b/examples-testing/examples/webgpu_instance_path.ts new file mode 100644 index 000000000..a5bce3225 --- /dev/null +++ b/examples-testing/examples/webgpu_instance_path.ts @@ -0,0 +1,147 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { + abs, + add, + instancedBufferAttribute, + positionLocal, + mod, + time, + sin, + vec3, + select, + float, + screenUV, + color, +} from 'three/tsl'; + +let camera, scene, renderer, controls; + +const count = 1000; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.z = 15; + + scene = new THREE.Scene(); + scene.backgroundNode = screenUV.distance(0.5).remap(0, 0.65).mix(color(0x94254c), color(0x000000)); + + // generate a path representing a heart shape + + const x = 0, + y = 0; + + const path = new THREE.Path() + .moveTo(x - 2.5, y - 2.5) + .bezierCurveTo(x - 2.5, y - 2.5, x - 2, y, x, y) + .bezierCurveTo(x + 3, y, x + 3, y - 3.5, x + 3, y - 3.5) + .bezierCurveTo(x + 3, y - 5.5, x + 1, y - 7.7, x - 2.5, y - 9.5) + .bezierCurveTo(x - 6, y - 7.7, x - 8, y - 5.5, x - 8, y - 3.5) + .bezierCurveTo(x - 8, y - 3.5, x - 8, y, x - 5, y) + .bezierCurveTo(x - 3.5, y, x - 2.5, y - 2.5, x - 2.5, y - 2.5); + + // generate instanced ico-spheres along the path + + const geometry = new THREE.IcosahedronGeometry(0.1); + const material = new THREE.MeshStandardNodeMaterial(); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(2.5, 5, 0); + mesh.count = count; + mesh.frustumCulled = false; + + scene.add(mesh); + + // instance data + + const v = new THREE.Vector3(); + const c = new THREE.Color(); + + const positions = []; + const times = []; + const seeds = []; + const colors = []; + + for (let i = 0; i < count; i++) { + const t = i / count; + path.getPointAt(t, v); + + v.x += 0.5 - Math.random(); + v.y += 0.5 - Math.random(); + v.z = 0.5 - Math.random(); + + positions.push(v.x, v.y, v.z); + times.push(t); + seeds.push(Math.random()); + + c.setHSL(0.75 + Math.random() * 0.25, 1, 0.4); + + colors.push(c.r, c.g, c.b); + } + + const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); + const colorAttribute = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); + const timeAttribute = new THREE.InstancedBufferAttribute(new Float32Array(times), 1); + const seedAttribute = new THREE.InstancedBufferAttribute(new Float32Array(seeds), 1); + + // TSL + + const instancePosition = instancedBufferAttribute(positionAttribute); + const instanceColor = instancedBufferAttribute(colorAttribute); + const instanceSeed = instancedBufferAttribute(seedAttribute); + const instanceTime = instancedBufferAttribute(timeAttribute); + + const localTime = instanceTime.add(time); + const modTime = mod(time.mul(0.4), 1); + + const s0 = sin(localTime.add(instanceSeed)).mul(0.25); + + const dist = abs(instanceTime.sub(modTime)).toConst(); // modTime and instanceTime are in the range [0,1] + const wrapDist = select(dist.greaterThan(0.5), dist.oneMinus(), dist).toConst(); // the normalized distance should wrap around 0/1 + const s1 = select(wrapDist.greaterThan(0.1), float(1), wrapDist.remap(0, 0.1, 3, 1)); // compute a scale in a range around the current interpolated value + + const offset = vec3(instancePosition.x, instancePosition.y.add(s0), instancePosition.z).toConst('offset'); + material.positionNode = add(positionLocal.mul(s1), offset); + material.colorNode = instanceColor; + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_instance_points.ts b/examples-testing/examples/webgpu_instance_points.ts new file mode 100644 index 000000000..3722e6488 --- /dev/null +++ b/examples-testing/examples/webgpu_instance_points.ts @@ -0,0 +1,204 @@ +import * as THREE from 'three/webgpu'; +import { + color, + storage, + Fn, + instancedBufferAttribute, + instanceIndex, + sin, + time, + float, + uniform, + shapeCircle, + mix, + vec3, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; + +let renderer, scene, camera, camera2, controls, backgroundNode; +let material; +let effectController; + +// viewport +let insetWidth; +let insetHeight; + +// compute +let computeSize; + +init(); + +async function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-40, 0, 60); + + camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); + camera2.position.copy(camera.position); + + backgroundNode = color(0x222222); + + effectController = { + pulseSpeed: uniform(6), + minWidth: uniform(6), + maxWidth: uniform(20), + }; + + // Position and THREE.Color Data + + const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 20.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); + + const spline = new THREE.CatmullRomCurve3(points); + const divisions = Math.round(4 * points.length); + const point = new THREE.Vector3(); + const pointColor = new THREE.Color(); + + const positions = []; + const colors = []; + const sizes = new Float32Array(divisions); + + for (let i = 0, l = divisions; i < l; i++) { + const t = i / l; + + spline.getPoint(t, point); + positions.push(point.x, point.y, point.z); + + pointColor.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); + colors.push(pointColor.r, pointColor.g, pointColor.b); + + sizes[i] = 10.0; + } + + // Instanced Points + + const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); + const colorsAttribute = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); + + const instanceSizeBufferAttribute = new THREE.StorageInstancedBufferAttribute(sizes, 1); + const instanceSizeStorage = storage(instanceSizeBufferAttribute, 'float', instanceSizeBufferAttribute.count); + + computeSize = Fn(() => { + const { pulseSpeed, minWidth, maxWidth } = effectController; + + const relativeTime = time.add(float(instanceIndex)); + + const sizeFactor = sin(relativeTime.mul(pulseSpeed)).add(1).div(2); + + instanceSizeStorage.element(instanceIndex).assign(sizeFactor.mul(maxWidth.sub(minWidth)).add(minWidth)); + })().compute(divisions); + + // Material / Sprites + + const attributeRange = instancedBufferAttribute(instanceSizeBufferAttribute); + const pointColors = mix( + vec3(0.0), + instancedBufferAttribute(colorsAttribute), + attributeRange.div(float(effectController.maxWidth)), + ); + + material = new THREE.PointsNodeMaterial({ + colorNode: pointColors, + opacityNode: shapeCircle(), + positionNode: instancedBufferAttribute(positionAttribute), + // rotationNode: time, + sizeNode: instancedBufferAttribute(instanceSizeBufferAttribute), + // size: 40, // in pixels units + vertexColors: true, + sizeAttenuation: false, + alphaToCoverage: true, + }); + + const instancedPoints = new THREE.Sprite(material); + instancedPoints.count = divisions; + scene.add(instancedPoints); + + // Renderer / Controls + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 10; + controls.maxDistance = 500; + + window.addEventListener('resize', onWindowResize); + onWindowResize(); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(material, 'alphaToCoverage'); + + gui.add(effectController.minWidth, 'value', 1, 30, 1).name('minWidth'); + gui.add(effectController.maxWidth, 'value', 2, 30, 1).name('maxWidth'); + gui.add(effectController.pulseSpeed, 'value', 1, 20, 0.1).name('pulseSpeed'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + insetWidth = window.innerHeight / 4; // square + insetHeight = window.innerHeight / 4; + + camera2.aspect = insetWidth / insetHeight; + camera2.updateProjectionMatrix(); +} + +function animate() { + // compute + + renderer.compute(computeSize); + + // main scene + + renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); + + controls.update(); + + renderer.autoClear = true; + + scene.backgroundNode = null; + + renderer.render(scene, camera); + + // inset scene + + const posY = window.innerHeight - insetHeight - 20; + + renderer.clearDepth(); // important! + + renderer.setScissorTest(true); + + renderer.setScissor(20, posY, insetWidth, insetHeight); + + renderer.setViewport(20, posY, insetWidth, insetHeight); + + camera2.position.copy(camera.position); + + camera2.quaternion.copy(camera.quaternion); + + renderer.autoClear = false; + + scene.backgroundNode = backgroundNode; + + renderer.render(scene, camera2); + + renderer.setScissorTest(false); +} + +// diff --git a/examples-testing/examples/webgpu_instancing_morph.ts b/examples-testing/examples/webgpu_instancing_morph.ts new file mode 100644 index 000000000..f8f5c5fe5 --- /dev/null +++ b/examples-testing/examples/webgpu_instancing_morph.ts @@ -0,0 +1,145 @@ +import * as THREE from 'three/webgpu'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, mesh, mixer, dummy; + +const offset = 5000; + +const timeOffsets = new Float32Array(1024); + +for (let i = 0; i < 1024; i++) { + timeOffsets[i] = Math.random() * 3; +} + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 100, 10000); + + scene = new THREE.Scene(); + + scene.background = new THREE.Color(0x99ddff); + + scene.fog = new THREE.Fog(0x99ddff, 5000, 10000); + + // + + const light = new THREE.DirectionalLight(0xffffff, 1); + + light.position.set(200, 1000, 50); + + light.shadow.mapSize.width = 2048; + light.shadow.mapSize.height = 2048; + light.castShadow = true; + + light.shadow.camera.left = -5000; + light.shadow.camera.right = 5000; + light.shadow.camera.top = 5000; + light.shadow.camera.bottom = -5000; + light.shadow.camera.far = 2000; + + light.shadow.camera.updateProjectionMatrix(); + + scene.add(light); + + const hemi = new THREE.HemisphereLight(0x99ddff, 0x669933, 1 / 3); + + scene.add(hemi); + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(1000000, 1000000), + new THREE.MeshStandardMaterial({ color: 0x669933 }), + ); + + ground.rotation.x = -Math.PI / 2; + + ground.receiveShadow = true; + + scene.add(ground); + + const loader = new GLTFLoader(); + + loader.load('models/gltf/Horse.glb', function (glb) { + dummy = glb.scene.children[0]; + + mesh = new THREE.InstancedMesh( + dummy.geometry, + new THREE.MeshStandardNodeMaterial({ + flatShading: true, + }), + 1024, + ); + + mesh.castShadow = true; + + for (let x = 0, i = 0; x < 32; x++) { + for (let y = 0; y < 32; y++) { + dummy.position.set(offset - 300 * x + 200 * Math.random(), 0, offset - 300 * y); + + dummy.updateMatrix(); + + mesh.setMatrixAt(i, dummy.matrix); + + mesh.setColorAt(i, new THREE.Color(`hsl(${Math.random() * 360}, 50%, 66%)`)); + + i++; + } + } + + scene.add(mesh); + + mixer = new THREE.AnimationMixer(glb.scene); + + const action = mixer.clipAction(glb.animations[0]); + + action.play(); + }); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setAnimationLoop(animate); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const time = timer.getElapsed(); + + const r = 3000; + camera.position.set(Math.sin(time / 10) * r, 1500 + 1000 * Math.cos(time / 5), Math.cos(time / 10) * r); + camera.lookAt(0, 0, 0); + + if (mesh) { + for (let i = 0; i < 1024; i++) { + mixer.setTime(time + timeOffsets[i]); + + mesh.setMorphAt(i, dummy); + } + + mesh.morphTexture.needsUpdate = true; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_layers.ts b/examples-testing/examples/webgpu_layers.ts new file mode 100644 index 000000000..c1db7d60c --- /dev/null +++ b/examples-testing/examples/webgpu_layers.ts @@ -0,0 +1,144 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { positionLocal, time, mod, instancedBufferAttribute, rotate, screenUV, color, vec2 } from 'three/tsl'; + +let camera, scene, renderer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.layers.enable(0); // enabled by default + camera.layers.enable(1); + camera.layers.enable(2); + + camera.position.z = 10; + + scene = new THREE.Scene(); + + const horizontalEffect = screenUV.x.mix(color(0xf996ae), color(0xf6f0a3)); + const lightEffect = screenUV.distance(vec2(0.5, 1.0)).oneMinus().mul(color(0xd9b6fd)); + + scene.backgroundNode = horizontalEffect.add(lightEffect); + + const sprite = new THREE.TextureLoader().load('textures/sprites/blossom.png'); + sprite.colorSpace = THREE.SRGBColorSpace; + + const count = 2500; + + const geometry = new THREE.PlaneGeometry(0.25, 0.25); + + const colors = [0xd70654, 0xffd95f, 0xb8d576]; + + for (let i = 0; i < 3; i++) { + const particles = new THREE.Mesh(geometry, getMaterial(count, colors[i], sprite)); + particles.layers.set(i); + particles.count = count; + scene.add(particles); + } + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // GUI + + const layers = { + Red: true, + Yellow: true, + Green: true, + }; + + const gui = renderer.inspector.createParameters('Layers'); + + gui.add(layers, 'Red').onChange(() => { + camera.layers.toggle(0); + }); + + gui.add(layers, 'Yellow').onChange(() => { + camera.layers.toggle(1); + }); + + gui.add(layers, 'Green').onChange(() => { + camera.layers.toggle(2); + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function getMaterial(count, color, sprite) { + // instance data + + const positions = []; + const rotations = []; + const directions = []; + const timeOffsets = []; + + const v = new THREE.Vector3(); + + for (let i = 0; i < count; i++) { + positions.push( + THREE.MathUtils.randFloat(-25, -20), + THREE.MathUtils.randFloat(-10, 50), + THREE.MathUtils.randFloat(-5, 5), + ); + + v.set(THREE.MathUtils.randFloat(0.7, 0.9), THREE.MathUtils.randFloat(-0.3, -0.15), 0).normalize(); + + rotations.push(Math.random(), Math.random(), Math.random()); + + directions.push(v.x, v.y, v.z); + + timeOffsets.push(i / count); + } + + const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); + const rotationAttribute = new THREE.InstancedBufferAttribute(new Float32Array(rotations), 3); + const directionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(directions), 3); + const timeAttribute = new THREE.InstancedBufferAttribute(new Float32Array(timeOffsets), 1); + + // material + + const material = new THREE.MeshBasicNodeMaterial({ + color: color, + map: sprite, + alphaMap: sprite, + alphaTest: 0.1, + side: THREE.DoubleSide, + forceSinglePass: true, + }); + + // TSL + + const instancePosition = instancedBufferAttribute(positionAttribute); + const instanceDirection = instancedBufferAttribute(directionAttribute); + const instanceRotation = instancedBufferAttribute(rotationAttribute); + + const localTime = instancedBufferAttribute(timeAttribute).add(time.mul(0.02)); + const modTime = mod(localTime, 1.0); + + const rotatedPosition = rotate(positionLocal, instanceRotation.mul(modTime.mul(20))); + material.positionNode = rotatedPosition.add(instancePosition).add(instanceDirection.mul(modTime.mul(50))); + + return material; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lensflares.ts b/examples-testing/examples/webgpu_lensflares.ts new file mode 100644 index 000000000..ab4e49677 --- /dev/null +++ b/examples-testing/examples/webgpu_lensflares.ts @@ -0,0 +1,137 @@ +import * as THREE from 'three/webgpu'; + +import { FlyControls } from 'three/addons/controls/FlyControls.js'; +import { LensflareMesh, LensflareElement } from 'three/addons/objects/LensflareMesh.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let container; + +let camera, scene, renderer; +let controls; + +const timer = new THREE.Timer(); +timer.connect(document); + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + // camera + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 15000); + camera.position.z = 250; + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color().setHSL(0.51, 0.4, 0.01, THREE.SRGBColorSpace); + scene.fog = new THREE.Fog(scene.background, 3500, 15000); + + // world + + const s = 250; + + const geometry = new THREE.BoxGeometry(s, s, s); + const material = new THREE.MeshPhongNodeMaterial({ color: 0xffffff, specular: 0xffffff, shininess: 50 }); + + for (let i = 0; i < 3000; i++) { + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = 8000 * (2.0 * Math.random() - 1.0); + mesh.position.y = 8000 * (2.0 * Math.random() - 1.0); + mesh.position.z = 8000 * (2.0 * Math.random() - 1.0); + + mesh.rotation.x = Math.random() * Math.PI; + mesh.rotation.y = Math.random() * Math.PI; + mesh.rotation.z = Math.random() * Math.PI; + + mesh.matrixAutoUpdate = false; + mesh.updateMatrix(); + + scene.add(mesh); + } + + // lights + + const dirLight = new THREE.DirectionalLight(0xffffff, 0.15); + dirLight.position.set(0, -1, 0).normalize(); + dirLight.color.setHSL(0.1, 0.7, 0.5); + scene.add(dirLight); + + // lensflares + const textureLoader = new THREE.TextureLoader(); + + const textureFlare0 = textureLoader.load('textures/lensflare/lensflare0.png'); + const textureFlare3 = textureLoader.load('textures/lensflare/lensflare3.png'); + + textureFlare0.colorSpace = THREE.SRGBColorSpace; + textureFlare3.colorSpace = THREE.SRGBColorSpace; + + addLight(0.55, 0.95, 0.6, 5000, 0, -1000); + addLight(0.1, 0.85, 0.65, 0, 0, -1000); + addLight(0.995, 0.5, 0.95, 5000, 5000, -1000); + + function addLight(h, s, l, x, y, z) { + const light = new THREE.PointLight(0xffffff, 1.5, 2000, 0); + light.color.setHSL(h, s, l); + light.position.set(x, y, z); + scene.add(light); + + const lensflare = new LensflareMesh(); + lensflare.addElement(new LensflareElement(textureFlare0, 700, 0, light.color)); + lensflare.addElement(new LensflareElement(textureFlare3, 60, 0.6)); + lensflare.addElement(new LensflareElement(textureFlare3, 70, 0.7)); + lensflare.addElement(new LensflareElement(textureFlare3, 120, 0.9)); + lensflare.addElement(new LensflareElement(textureFlare3, 70, 1)); + light.add(lensflare); + } + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // + + controls = new FlyControls(camera, renderer.domElement); + + controls.movementSpeed = 2500; + controls.domElement = container; + controls.rollSpeed = Math.PI / 6; + controls.autoForward = false; + controls.dragToLook = false; + + // events + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +// + +function animate() { + timer.update(); + + render(); +} + +function render() { + const delta = timer.getDelta(); + + controls.update(delta); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lightprobe.ts b/examples-testing/examples/webgpu_lightprobe.ts new file mode 100644 index 000000000..3e90b6f66 --- /dev/null +++ b/examples-testing/examples/webgpu_lightprobe.ts @@ -0,0 +1,136 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; + +import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js'; + +let mesh, renderer, scene, camera; + +let gui; + +let lightProbe; +let directionalLight; + +// linear color space +const API = { + lightProbeIntensity: 1.0, + directionalLightIntensity: 0.6, + envMapIntensity: 1, +}; + +init(); + +function init() { + // renderer + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // tone mapping + renderer.toneMapping = THREE.NoToneMapping; + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 30); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 10; + controls.maxDistance = 50; + controls.enablePan = false; + + // probe + lightProbe = new THREE.LightProbe(); + scene.add(lightProbe); + + // light + directionalLight = new THREE.DirectionalLight(0xffffff, API.directionalLightIntensity); + directionalLight.position.set(10, 10, 10); + scene.add(directionalLight); + + // envmap + const genCubeUrls = function (prefix, postfix) { + return [ + prefix + 'px' + postfix, + prefix + 'nx' + postfix, + prefix + 'py' + postfix, + prefix + 'ny' + postfix, + prefix + 'pz' + postfix, + prefix + 'nz' + postfix, + ]; + }; + + const urls = genCubeUrls('textures/cube/pisa/', '.png'); + + new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { + scene.background = cubeTexture; + + lightProbe.copy(LightProbeGenerator.fromCubeTexture(cubeTexture)); + lightProbe.intensity = API.lightProbeIntensity; + lightProbe.position.set(-10, 0, 0); // position not used in scene lighting calculations (helper honors the position, however) + + const geometry = new THREE.SphereGeometry(5, 64, 32); + //const geometry = new THREE.TorusKnotGeometry( 4, 1.5, 256, 32, 2, 3 ); + + const material = new THREE.MeshStandardMaterial({ + color: 0xffffff, + metalness: 0, + roughness: 0, + envMap: cubeTexture, + envMapIntensity: API.envMapIntensity, + }); + + // mesh + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // helper + const helper = new LightProbeHelper(lightProbe, 1); + scene.add(helper); + }); + + // gui + gui = renderer.inspector.createParameters('Intensity'); + + gui.add(API, 'lightProbeIntensity', 0, 1, 0.02) + .name('light probe') + .onChange(function () { + lightProbe.intensity = API.lightProbeIntensity; + }); + + gui.add(API, 'directionalLightIntensity', 0, 1, 0.02) + .name('directional light') + .onChange(function () { + directionalLight.intensity = API.directionalLightIntensity; + }); + + gui.add(API, 'envMapIntensity', 0, 1, 0.02) + .name('envMap') + .onChange(function () { + mesh.material.envMapIntensity = API.envMapIntensity; + }); + + // listener + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lightprobe_cubecamera.ts b/examples-testing/examples/webgpu_lightprobe_cubecamera.ts new file mode 100644 index 000000000..60fe6ccc9 --- /dev/null +++ b/examples-testing/examples/webgpu_lightprobe_cubecamera.ts @@ -0,0 +1,90 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js'; +import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; + +let renderer, scene, camera, cubeCamera; + +let lightProbe; + +init(); + +function init() { + // renderer + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 0, 30); + + const cubeRenderTarget = new THREE.CubeRenderTarget(256); + + cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); + controls.minDistance = 10; + controls.maxDistance = 50; + controls.enablePan = false; + + // probe + lightProbe = new THREE.LightProbe(); + scene.add(lightProbe); + + // envmap + const genCubeUrls = function (prefix, postfix) { + return [ + prefix + 'px' + postfix, + prefix + 'nx' + postfix, + prefix + 'py' + postfix, + prefix + 'ny' + postfix, + prefix + 'pz' + postfix, + prefix + 'nz' + postfix, + ]; + }; + + const urls = genCubeUrls('textures/cube/pisa/', '.png'); + + new THREE.CubeTextureLoader().load(urls, async function (cubeTexture) { + scene.background = cubeTexture; + + await renderer.init(); + + cubeCamera.update(renderer, scene); + + const probe = await LightProbeGenerator.fromCubeRenderTarget(renderer, cubeRenderTarget); + + lightProbe.copy(probe); + + scene.add(new LightProbeHelper(lightProbe, 5)); + + render(); + }); + + // listener + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lightprobes.ts b/examples-testing/examples/webgpu_lightprobes.ts new file mode 100644 index 000000000..1afef5fde --- /dev/null +++ b/examples-testing/examples/webgpu_lightprobes.ts @@ -0,0 +1,195 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; +import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; + +let camera, scene, renderer, controls; +let probes, probesHelper; + +init(); + +async function init() { + // Camera + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 2.5, 8); + + // Scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x111111); + + // Cornell box + + const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc }); + const redMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 }); + const greenMaterial = new THREE.MeshStandardMaterial({ color: 0x00ff00 }); + + // Floor + const floor = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); + floor.rotation.x = -Math.PI / 2; + floor.receiveShadow = true; + scene.add(floor); + + // Ceiling + const ceiling = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); + ceiling.rotation.x = Math.PI / 2; + ceiling.position.y = 5; + ceiling.receiveShadow = true; + scene.add(ceiling); + + // Back wall + const backWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); + backWall.position.set(0, 2.5, -3); + backWall.receiveShadow = true; + scene.add(backWall); + + // Front wall + const frontWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); + frontWall.rotation.y = Math.PI; + frontWall.position.set(0, 2.5, 3); + frontWall.receiveShadow = true; + scene.add(frontWall); + + // Left wall (red) + const leftWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), redMaterial); + leftWall.rotation.y = Math.PI / 2; + leftWall.position.set(-3, 2.5, 0); + leftWall.receiveShadow = true; + scene.add(leftWall); + + // Right wall (green) + const rightWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), greenMaterial); + rightWall.rotation.y = -Math.PI / 2; + rightWall.position.set(3, 2.5, 0); + rightWall.receiveShadow = true; + scene.add(rightWall); + + // Objects inside the box + + const objectMaterial = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); + + // Tall box + const tallBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 2.5, 1.2), objectMaterial); + tallBox.position.set(-0.8, 1.25, -0.8); + tallBox.rotation.y = Math.PI / 8; + tallBox.castShadow = true; + tallBox.receiveShadow = true; + scene.add(tallBox); + + // Short box + const shortBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 1.2, 1.2), objectMaterial); + shortBox.position.set(1, 0.6, 0.5); + shortBox.rotation.y = -Math.PI / 6; + shortBox.castShadow = true; + shortBox.receiveShadow = true; + scene.add(shortBox); + + // Sphere (to show smooth GI variation) + const sphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 32, 32), objectMaterial.clone()); + sphere.position.set(1, 1.9, 0.5); + sphere.castShadow = true; + sphere.receiveShadow = true; + scene.add(sphere); + + // Light + const light = new THREE.PointLight(0xffffff, 40); + light.position.set(0, 4.5, 0); + light.castShadow = true; + light.shadow.mapSize.setScalar(256); + light.shadow.radius = 10; + light.shadow.normalBias = -0.02; + scene.add(light); + + // Renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.0; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // Controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2.5, 0); + controls.update(); + + // Bake light probe volume + + async function bake(resolution) { + if (probes) { + scene.remove(probes); + probes.dispose(); + } + + probes = new LightProbeGrid(5.6, 4.7, 5.6, resolution, resolution, resolution); + probes.position.set(0, 2.45, 0); + await probes.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); + probes.visible = params.enabled; + scene.add(probes); + + // Update debug visualization + + if (!probesHelper) { + probesHelper = new LightProbeGridHelper(probes); + probesHelper.visible = params.showProbes; + scene.add(probesHelper); + } else { + probesHelper.probes = probes; + probesHelper.update(); + } + } + + const params = { + enabled: true, + showProbes: false, + resolution: 6, + }; + + await bake(params.resolution); + + // GUI + + const gui = renderer.inspector.createParameters('Light Probes'); + gui.add(params, 'enabled') + .name('GI') + .onChange(value => { + probes.visible = value; + }); + + gui.add(params, 'resolution', 2, 12, 1) + .name('Resolution') + .onChange(value => { + bake(value); + }) + .debounce(250); + gui.add(params, 'showProbes') + .name('Show Probes') + .onChange(value => { + probesHelper.visible = value; + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lightprobes_complex.ts b/examples-testing/examples/webgpu_lightprobes_complex.ts new file mode 100644 index 000000000..944b5fc7c --- /dev/null +++ b/examples-testing/examples/webgpu_lightprobes_complex.ts @@ -0,0 +1,313 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; +import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; + +let camera, scene, renderer, controls; +let probesLeft, probesRight; +let probesHelperLeft, probesHelperRight; + +init(); + +async function init() { + // Camera + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 2.5, 16); + + // Scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x111111); + + // Materials + + const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc, side: THREE.BackSide }); + const whiteMat = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); + + // Room shell: x=-8 to 8, z=-4 to 4, y=0 to 5 + + const room = new THREE.Mesh(new THREE.BoxGeometry(16, 5, 8), wallMaterial); + room.position.set(0, 2.5, 0); + room.receiveShadow = true; + scene.add(room); + + const redWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0xdd2200 })); + redWall.rotation.y = Math.PI / 2; + redWall.position.set(-7.99, 2.5, 0); + scene.add(redWall); + + const blueWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0x0044ff })); + blueWall.rotation.y = -Math.PI / 2; + blueWall.position.set(7.99, 2.5, 0); + scene.add(blueWall); + + // Dividing wall at x=0 with doorway + + const dividerMat = new THREE.MeshStandardMaterial({ color: 0xcccccc }); + const doorwayHalfGap = 1.25; + + // Left section of divider (z = -4 to -1.25) + const dividerLeft = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); + dividerLeft.position.set(0, 2.5, -(doorwayHalfGap + (4 - doorwayHalfGap) / 2)); + dividerLeft.castShadow = true; + dividerLeft.receiveShadow = true; + scene.add(dividerLeft); + + // Right section of divider (z = 1.25 to 4) + const dividerRight = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); + dividerRight.position.set(0, 2.5, doorwayHalfGap + (4 - doorwayHalfGap) / 2); + dividerRight.castShadow = true; + dividerRight.receiveShadow = true; + scene.add(dividerRight); + + // Lintel above doorway + const lintel = new THREE.Mesh(new THREE.BoxGeometry(0.3, 1.2, doorwayHalfGap * 2), dividerMat); + lintel.position.set(0, 4.4, 0); + lintel.castShadow = true; + lintel.receiveShadow = true; + scene.add(lintel); + + // Left room objects + + // Columns + const columnGeom = new THREE.CylinderGeometry(0.3, 0.3, 4, 16); + + for (const x of [-6, -2]) { + for (const z of [-2.5, 2.5]) { + const col = new THREE.Mesh(columnGeom, whiteMat); + col.position.set(x, 2, z); + col.castShadow = true; + col.receiveShadow = true; + scene.add(col); + } + } + + // Table with golden sphere + const tableTop = new THREE.Mesh( + new THREE.BoxGeometry(2.4, 0.12, 1.4), + new THREE.MeshStandardMaterial({ color: 0x886644 }), + ); + tableTop.position.set(-4, 1.0, 0); + tableTop.castShadow = true; + tableTop.receiveShadow = true; + scene.add(tableTop); + + const legGeom = new THREE.BoxGeometry(0.1, 1, 0.1); + + for (const x of [-5.05, -2.95]) { + for (const z of [-0.55, 0.55]) { + const leg = new THREE.Mesh(legGeom, tableTop.material); + leg.position.set(x, 0.5, z); + leg.castShadow = true; + scene.add(leg); + } + } + + const sphere = new THREE.Mesh( + new THREE.SphereGeometry(0.35, 32, 32), + new THREE.MeshStandardMaterial({ color: 0xffd700, metalness: 0.3, roughness: 0.4 }), + ); + sphere.position.set(-4, 1.41, 0); + sphere.castShadow = true; + sphere.receiveShadow = true; + scene.add(sphere); + + // Stepped blocks near red wall + const step1 = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.5, 1), whiteMat); + step1.position.set(-7, 0.25, 0); + step1.castShadow = true; + step1.receiveShadow = true; + scene.add(step1); + + const step2 = new THREE.Mesh(new THREE.BoxGeometry(1.0, 1.0, 1), whiteMat); + step2.position.set(-7, 0.5, 0); + step2.castShadow = true; + step2.receiveShadow = true; + scene.add(step2); + + const step3 = new THREE.Mesh(new THREE.BoxGeometry(0.5, 1.5, 1), whiteMat); + step3.position.set(-7, 0.75, 0); + step3.castShadow = true; + step3.receiveShadow = true; + scene.add(step3); + + // Right room objects + + // Columns + for (const x of [2, 6]) { + for (const z of [-2.5, 2.5]) { + const col = new THREE.Mesh(columnGeom, whiteMat); + col.position.set(x, 2, z); + col.castShadow = true; + col.receiveShadow = true; + scene.add(col); + } + } + + // Pedestal with torus knot + const pedestal = new THREE.Mesh(new THREE.BoxGeometry(0.8, 1.2, 0.8), whiteMat); + pedestal.position.set(4, 0.6, 0); + pedestal.castShadow = true; + pedestal.receiveShadow = true; + scene.add(pedestal); + + const torusKnot = new THREE.Mesh( + new THREE.TorusKnotGeometry(0.3, 0.1, 64, 16), + new THREE.MeshStandardMaterial({ color: 0xff44aa, metalness: 0.2, roughness: 0.5 }), + ); + torusKnot.position.set(4, 1.65, 0); + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + // Tall cone sculpture + const sculpture = new THREE.Mesh(new THREE.ConeGeometry(0.4, 2.5, 5), whiteMat); + sculpture.position.set(6.5, 1.25, -1.5); + sculpture.castShadow = true; + sculpture.receiveShadow = true; + scene.add(sculpture); + + // Lights + + // Warm point light in left room + const warmLight = new THREE.PointLight(0xffaa44, 30); + warmLight.position.set(-4, 4.5, 0); + warmLight.castShadow = true; + warmLight.shadow.mapSize.setScalar(256); + warmLight.shadow.radius = 12; + warmLight.shadow.bias = -0.002; + scene.add(warmLight); + + // Cool point light in right room + const coolLight = new THREE.PointLight(0x88bbff, 30); + coolLight.position.set(4, 4.5, 0); + coolLight.castShadow = true; + coolLight.shadow.mapSize.setScalar(256); + coolLight.shadow.radius = 12; + coolLight.shadow.bias = -0.002; + scene.add(coolLight); + + // Renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.0; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // Controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2.5, 0); + controls.update(); + + // Probe volumes + + const params = { + enabled: true, + showProbes: false, + resolution: 6, + }; + + async function bake(resolution) { + // Remove both volumes before baking to prevent feedback + + if (probesLeft) { + scene.remove(probesLeft); + probesLeft.dispose(); + } + + if (probesRight) { + scene.remove(probesRight); + probesRight.dispose(); + } + + // Bake both volumes. The `falloff` fades each volume past its + // boundary so the two rooms blend smoothly without bleeding into + // each other. + + probesLeft = new LightProbeGrid(7.8, 4.7, 7.6, resolution, resolution, resolution); + probesLeft.position.set(-3.9, 2.45, 0); + probesLeft.falloff = 1.0; + await probesLeft.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); + probesLeft.visible = params.enabled; + + probesRight = new LightProbeGrid(7.8, 4.7, 7.6, resolution, resolution, resolution); + probesRight.position.set(3.9, 2.45, 0); + probesRight.falloff = 1.0; + await probesRight.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); + probesRight.visible = params.enabled; + + // Add both after baking + + scene.add(probesLeft); + scene.add(probesRight); + + // Update debug visualization + + if (!probesHelperLeft) { + probesHelperLeft = new LightProbeGridHelper(probesLeft); + probesHelperLeft.visible = params.showProbes; + scene.add(probesHelperLeft); + + probesHelperRight = new LightProbeGridHelper(probesRight); + probesHelperRight.visible = params.showProbes; + scene.add(probesHelperRight); + } else { + probesHelperLeft.probes = probesLeft; + probesHelperLeft.update(); + + probesHelperRight.probes = probesRight; + probesHelperRight.update(); + } + } + + await bake(params.resolution); + + // GUI + + const gui = renderer.inspector.createParameters('Light Probes'); + gui.add(params, 'enabled') + .name('GI') + .onChange(value => { + probesLeft.visible = value; + probesRight.visible = value; + }); + + gui.add(params, 'resolution', 2, 12, 1) + .name('Resolution') + .onChange(value => { + bake(value); + }) + .debounce(250); + gui.add(params, 'showProbes') + .name('Show Probes') + .onChange(value => { + probesHelperLeft.visible = value; + probesHelperRight.visible = value; + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lightprobes_sponza.ts b/examples-testing/examples/webgpu_lightprobes_sponza.ts new file mode 100644 index 000000000..a73fd1e5b --- /dev/null +++ b/examples-testing/examples/webgpu_lightprobes_sponza.ts @@ -0,0 +1,339 @@ +import * as THREE from 'three/webgpu'; + +import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; +import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; +import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; + +const MODEL_INDEX_URL = + 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json'; +const SAMPLE_ASSETS_BASE_URL = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/'; + +let camera, scene, renderer, controls, timer; +let probes = null, + probesHelper = null; +let modelSize = null; +let dirLight = null, + sky = null; + +const sun = new THREE.Vector3(); + +const _box = new THREE.Box3(); +const _size = new THREE.Vector3(); +const _center = new THREE.Vector3(); + +init(); + +async function init() { + timer = new THREE.Timer(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(-10.25, 4.99, 0.4); + camera.rotation.set(1.6505, -1.5008, 1.6507); + + scene = new THREE.Scene(); + + sky = new SkyMesh(); + sky.scale.setScalar(450000); + sky.turbidity.value = 10; + sky.rayleigh.value = 2; + sky.mieCoefficient.value = 0.005; + sky.mieDirectionalG.value = 0.8; + scene.add(sky); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.0; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + controls = new FirstPersonControls(camera, renderer.domElement); + controls.movementSpeed = 2.0; + controls.lookSpeed = 0.16; + + const progressBar = document.getElementById('progressBar'); + + const manager = new THREE.LoadingManager(); + manager.onProgress = function (url, loaded, total) { + progressBar.value = (loaded / total) * 100; + }; + + manager.onLoad = function () { + progressBar.remove(); + }; + + const loader = new GLTFLoader(manager); + const modelURL = await getSponzaModelURL(); + const gltf = await loader.loadAsync(modelURL); + const model = gltf.scene; + const embeddedLights = []; + + model.traverse(child => { + if (child.isMesh) { + child.castShadow = true; + child.receiveShadow = true; + } else if (child.isLight) { + embeddedLights.push(child); + } + }); + + for (const light of embeddedLights) { + if (light.parent) light.parent.remove(light); + } + + scene.add(model); + + _box.setFromObject(model); + modelSize = _box.getSize(_size).clone(); + const modelCenter = _box.getCenter(_center).clone(); + const targetY = modelCenter.y + modelSize.y * 0.2; + const lightBaseDistance = Math.max(modelSize.x, modelSize.z); + const probeFar = Math.max(modelSize.x, modelSize.y, modelSize.z) * 2.0; + let rebakeTimer = null; + let isBaking = false; + let bakeQueued = false; + + dirLight = new THREE.DirectionalLight(0xfff2dc, 100.0); + dirLight.target.position.set(modelCenter.x, targetY, modelCenter.z); + scene.add(dirLight.target); + dirLight.castShadow = true; + dirLight.shadow.mapSize.setScalar(2048); + const shadowExtent = Math.max(modelSize.x, modelSize.z) * 0.7; + dirLight.shadow.camera.left = -shadowExtent; + dirLight.shadow.camera.right = shadowExtent; + dirLight.shadow.camera.top = shadowExtent; + dirLight.shadow.camera.bottom = -shadowExtent; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = modelSize.y * 4.0; + scene.add(dirLight); + + const params = { + enabled: true, + showProbes: false, + probeSize: 0.2, + boundsX: -0.5, + boundsY: 6, + boundsZ: -0.3, + sizeX: 21, + sizeY: 11, + sizeZ: 9, + countX: 10, + countY: 7, + countZ: 7, + bounces: 1, + lightAzimuth: -45, + lightElevation: 55, + lightIntensity: 100.0, + shadows: true, + }; + + function updateLightPosition() { + const azimuth = THREE.MathUtils.degToRad(params.lightAzimuth); + const elevation = THREE.MathUtils.degToRad(params.lightElevation); + const radius = lightBaseDistance; + const horizontal = Math.cos(elevation) * radius; + const vertical = Math.sin(elevation) * radius; + + dirLight.position.set( + modelCenter.x + Math.cos(azimuth) * horizontal, + targetY + vertical, + modelCenter.z + Math.sin(azimuth) * horizontal, + ); + dirLight.target.position.set(modelCenter.x, targetY, modelCenter.z); + dirLight.target.updateMatrixWorld(); + + const phi = THREE.MathUtils.degToRad(90 - params.lightElevation); + const theta = THREE.MathUtils.degToRad(params.lightAzimuth); + sun.setFromSphericalCoords(1, phi, theta); + sky.sunPosition.value.copy(sun); + } + + function scheduleRebake() { + if (rebakeTimer !== null) clearTimeout(rebakeTimer); + rebakeTimer = setTimeout(() => { + rebakeTimer = null; + bakeWithSettings(); + }, 250); + } + + async function bakeWithSettings() { + if (isBaking) { + bakeQueued = true; + return; + } + + isBaking = true; + + do { + bakeQueued = false; + + if (probes) { + scene.remove(probes); + probes.dispose(); + } + + probes = new LightProbeGrid( + params.sizeX, + params.sizeY, + params.sizeZ, + params.countX, + params.countY, + params.countZ, + ); + probes.position.set(params.boundsX, params.boundsY, params.boundsZ); + // Add to the scene before baking so bounce passes can sample the prior pass's atlas. + scene.add(probes); + // Hide the helper spheres so they don't appear in the cubemap captures. + if (probesHelper) probesHelper.visible = false; + await probes.bake(renderer, scene, { + cubemapSize: 32, + near: 0.05, + far: probeFar, + bounces: params.bounces, + }); + probes.visible = params.enabled; + + if (!probesHelper) { + probesHelper = new LightProbeGridHelper(probes, params.probeSize); + probesHelper.visible = params.showProbes; + scene.add(probesHelper); + } else { + probesHelper.probes = probes; + probesHelper.update(); + probesHelper.visible = params.showProbes; + } + } while (bakeQueued); + + isBaking = false; + } + + updateLightPosition(); + + const gui = renderer.inspector.createParameters('Light Probes'); + gui.add(params, 'enabled') + .name('GI') + .onChange(value => { + if (probes) probes.visible = value; + }); + + gui.add(params, 'lightAzimuth', -180, 180, 1) + .name('Light Azimuth') + .onChange(() => { + updateLightPosition(); + scheduleRebake(); + }); + gui.add(params, 'lightElevation', 5, 85, 1) + .name('Light Elevation') + .onChange(() => { + updateLightPosition(); + scheduleRebake(); + }); + gui.add(params, 'lightIntensity', 0, 100, 0.1) + .name('Light Intensity') + .onChange(value => { + dirLight.intensity = value; + scheduleRebake(); + }); + gui.add(params, 'shadows') + .name('Shadows') + .onChange(value => { + setShadowsEnabled(value); + scheduleRebake(); + }); + + gui.add(params, 'countX', 2, 32, 1).name('Probes X').onChange(scheduleRebake); + gui.add(params, 'countY', 2, 16, 1).name('Probes Y').onChange(scheduleRebake); + gui.add(params, 'countZ', 2, 16, 1).name('Probes Z').onChange(scheduleRebake); + gui.add(params, 'bounces', 0, 2, 1).name('Bounces').onChange(scheduleRebake); + + gui.add(params, 'showProbes') + .name('Show Probes') + .onChange(value => { + if (probesHelper) probesHelper.visible = value; + }); + gui.add(params, 'probeSize', 0.05, 2.0, 0.05) + .name('Probe Size') + .onChange(value => { + if (probesHelper) { + scene.remove(probesHelper); + probesHelper.dispose(); + probesHelper = new LightProbeGridHelper(probes, value); + probesHelper.visible = params.showProbes; + scene.add(probesHelper); + } + }); + + gui.add( + { + log: () => { + console.log( + 'position:', + camera.position.x.toFixed(2), + camera.position.y.toFixed(2), + camera.position.z.toFixed(2), + ); + console.log( + 'rotation:', + camera.rotation.x.toFixed(4), + camera.rotation.y.toFixed(4), + camera.rotation.z.toFixed(4), + ); + }, + }, + 'log', + ).name('Log Camera'); + + setShadowsEnabled(params.shadows); + await bakeWithSettings(); + + window.addEventListener('resize', onWindowResize); +} + +async function getSponzaModelURL() { + const response = await fetch(MODEL_INDEX_URL); + const models = await response.json(); + const sponzaInfo = models.find(model => model.name === 'Sponza'); + + if (!sponzaInfo) { + throw new Error('Sponza entry was not found in the glTF sample model index.'); + } + + const variants = sponzaInfo.variants || {}; + const variantName = + variants['glTF-Binary'] || variants['glTF'] || variants['glTF-Embedded'] || Object.values(variants)[0]; + + if (!variantName) { + throw new Error('Sponza has no supported glTF variant in the model index.'); + } + + const variantFolder = variantName.endsWith('.glb') ? 'glTF-Binary' : 'glTF'; + return `${SAMPLE_ASSETS_BASE_URL}${sponzaInfo.name}/${variantFolder}/${variantName}`; +} + +function setShadowsEnabled(enabled) { + if (!renderer || !dirLight) return; + + renderer.shadowMap.enabled = enabled; + dirLight.castShadow = enabled; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(timestamp) { + timer.update(timestamp); + controls.update(timer.getDelta()); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lights_clustered.ts b/examples-testing/examples/webgpu_lights_clustered.ts new file mode 100644 index 000000000..cf86514ba --- /dev/null +++ b/examples-testing/examples/webgpu_lights_clustered.ts @@ -0,0 +1,228 @@ +import * as THREE from 'three/webgpu'; +import { instancedBufferAttribute, pass, uniform, vec3, float, mix, step, renderOutput } from 'three/tsl'; +import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; + +import { ClusteredLighting } from 'three/addons/lighting/ClusteredLighting.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +const GRID = 30; // GRID x GRID spheres +const SPACING = 5; +const RADIUS = 0.5; +const WAVE_HEIGHT = 4; +const BIG_RADIUS = 6; +const BASE_POWER = 45; + +let camera, scene, renderer, controls, spheresMesh, lighting; +let renderPipeline, scenePass, clusterInfluence, debugZSliceNode; + +const balls = []; +const dummy = new THREE.Object3D(); + +const params = { + intensity: 1, + animate: true, +}; + +init(); + +async function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 200); + camera.position.set(36, 18, 36); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1; + lighting = new ClusteredLighting(); + renderer.lighting = lighting; // set lighting system + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // ground + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(1000, 1000).rotateX(-Math.PI / 2), + new THREE.MeshPhongNodeMaterial({ color: 0x2a2a2a, shininess: 80 }), + ); + scene.add(ground); + + // four big spheres in the middle for the surrounding lights to play across + + const bigPositions = [ + new THREE.Vector3(-9, BIG_RADIUS, -9), + new THREE.Vector3(9, BIG_RADIUS, -9), + new THREE.Vector3(-9, BIG_RADIUS, 9), + new THREE.Vector3(9, BIG_RADIUS, 9), + ]; + + const bigGeometry = new THREE.SphereGeometry(BIG_RADIUS, 64, 32); + const bigMaterial = new THREE.MeshPhongNodeMaterial({ color: 0xdddddd, shininess: 80 }); + + for (const position of bigPositions) { + const bigSphere = new THREE.Mesh(bigGeometry, bigMaterial); + bigSphere.position.copy(position); + scene.add(bigSphere); + } + + // a grid of coloured spheres drawn as a single InstancedMesh; each is + // unlit in its own colour and holds a matching point light at its centre + + const maxCount = GRID * GRID; + const colorAttribute = new THREE.InstancedBufferAttribute(new Float32Array(maxCount * 3), 3); + + const material = new THREE.MeshBasicNodeMaterial(); + material.colorNode = instancedBufferAttribute(colorAttribute); + + spheresMesh = new THREE.InstancedMesh(new THREE.SphereGeometry(RADIUS, 32, 16), material, maxCount); + spheresMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); + scene.add(spheresMesh); + + const color = new THREE.Color(); + const span = (GRID - 1) * SPACING; + + let i = 0; + + for (let ix = 0; ix < GRID; ix++) { + for (let iz = 0; iz < GRID; iz++) { + const x = ix * SPACING - span / 2; + const z = iz * SPACING - span / 2; + + // leave a clearing where a big sphere sits + if (bigPositions.some(position => Math.hypot(x - position.x, z - position.z) < BIG_RADIUS + 1)) continue; + + const phase = (ix + iz) * 0.5; + + dummy.position.set(x, RADIUS, z); + dummy.updateMatrix(); + spheresMesh.setMatrixAt(i, dummy.matrix); + + color.setHSL((ix * GRID + iz) / (GRID * GRID), 1.0, 0.5); + colorAttribute.setXYZ(i, color.r, color.g, color.b); + + const light = new THREE.PointLight(color, 1, 9); + light.power = BASE_POWER; + light.position.set(x, RADIUS, z); + scene.add(light); + + balls.push({ x, z, phase, light }); + + i++; + } + } + + spheresMesh.count = i; + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target.set(0, 6, 0); + controls.maxPolarAngle = Math.PI * 0.49; + controls.minDistance = 4; + controls.maxDistance = 400; + controls.update(); + + // post-processing: a debug overlay that tints each screen tile by how many + // lights its cluster holds, for the selected depth slice + + scenePass = pass(scene, camera); + clusterInfluence = uniform(0); + + debugZSliceNode = uniform(20, 'int'); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = false; + + updatePostProcessing(); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'intensity', 0, 3) + .name('light intensity') + .onChange(value => { + for (const ball of balls) ball.light.power = BASE_POWER * value; + }); + gui.add(params, 'animate'); + gui.add(clusterInfluence, 'value', 0, 0.7).name('lights per tile'); + gui.add(debugZSliceNode, 'value', 0, lighting.zSlices - 1, 1).name('z-slice'); + + // events + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + updatePostProcessing(); +} + +function updatePostProcessing() { + // the overlay samples the cluster grid at the current resolution, so it + // is rebuilt whenever the renderer size changes + + const lightingNode = lighting + .getNode(scene) + .setSize(window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio); + + // map the light count of each cluster ( 0 … maxLightsPerCluster ) to a + // blue → green → red gradient + const lightCount = lightingNode.getClusterLightCount(debugZSliceNode); + const heatmap = float(lightCount).div(float(lighting.maxLightsPerCluster)); + + let heatColor = mix(vec3(0.0, 0.0, 1.0), vec3(0.0, 1.0, 0.0), heatmap.mul(2.0).saturate()); + heatColor = mix(heatColor, vec3(1.0, 0.0, 0.0), heatmap.sub(0.5).mul(2.0).saturate()); + + // blend the heatmap over the scene by the slider amount; step() keeps + // empty clusters transparent + const finalInfluence = clusterInfluence.mul(step(0.0001, heatmap)); + + const outputPass = renderOutput(mix(scenePass, heatColor, finalInfluence)); + + renderPipeline.outputNode = fxaa(outputPass); + renderPipeline.needsUpdate = true; +} + +function animate() { + if (params.animate === true) { + const time = performance.now() / 1000; + + for (let i = 0; i < balls.length; i++) { + const ball = balls[i]; + const y = RADIUS + (0.5 + 0.5 * Math.sin(time * 1.5 + ball.phase)) * WAVE_HEIGHT; + + dummy.position.set(ball.x, y, ball.z); + dummy.updateMatrix(); + spheresMesh.setMatrixAt(i, dummy.matrix); + + ball.light.position.y = y; + } + + spheresMesh.instanceMatrix.needsUpdate = true; + } + + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_lights_dynamic.ts b/examples-testing/examples/webgpu_lights_dynamic.ts new file mode 100644 index 000000000..b08c5902f --- /dev/null +++ b/examples-testing/examples/webgpu_lights_dynamic.ts @@ -0,0 +1,242 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { DynamicLighting } from 'three/addons/lighting/DynamicLighting.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer, controls, timer, stats; + +const pointLights = []; +let autoAddInterval = null; + +const params = { + dynamic: true, + autoAdd: false, + lightCount: 2, + addLight() { + addLight(); + }, + removeLight() { + removeLight(); + }, + removeAll() { + removeAllLights(); + }, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 200); + camera.position.set(0, 15, 30); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // Stats + + stats = new Stats(); + document.body.appendChild(stats.dom); + + // Floor + + const floorGeometry = new THREE.PlaneGeometry(120, 120); + const floorMaterial = new THREE.MeshStandardMaterial({ color: 0x444444, roughness: 0.8 }); + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.rotation.x = -Math.PI / 2; + scene.add(floor); + + // Shared geometries + + const sphereGeometry = new THREE.SphereGeometry(0.8, 128, 128); + const boxGeometry = new THREE.BoxGeometry(1.2, 1.2, 1.2, 64, 64, 64); + const torusGeometry = new THREE.TorusGeometry(0.6, 0.25, 128, 128); + const cylinderGeometry = new THREE.CylinderGeometry(0.5, 0.5, 1.4, 128, 64); + const coneGeometry = new THREE.ConeGeometry(0.6, 1.4, 128, 64); + + const geometries = [sphereGeometry, boxGeometry, torusGeometry, cylinderGeometry, coneGeometry]; + + // 100 meshes — first 50 with unique PBR materials, remaining 50 reuse them + + const uniqueMaterials = []; + + for (let i = 0; i < 50; i++) { + const material = new THREE.MeshStandardMaterial({ + color: new THREE.Color().setHSL(i / 50, 0.6 + Math.random() * 0.4, 0.35 + Math.random() * 0.3), + roughness: Math.random(), + metalness: Math.random(), + }); + material.name = 'Standard_' + i; + + uniqueMaterials.push(material); + } + + const meshesPerRing = 10; + + for (let i = 0; i < 100; i++) { + const material = i < 50 ? uniqueMaterials[i] : uniqueMaterials[i - 50]; + const geometry = geometries[i % geometries.length]; + const mesh = new THREE.Mesh(geometry, material); + + const ring = Math.floor(i / meshesPerRing); + const indexInRing = i % meshesPerRing; + const angle = (indexInRing / meshesPerRing) * Math.PI * 2 + ring * 0.3; + const radius = 6 + ring * 4; + + mesh.position.set(Math.cos(angle) * radius, 0.7 + Math.random() * 2, Math.sin(angle) * radius); + + mesh.rotation.set(Math.random() * Math.PI, Math.random() * Math.PI, 0); + + scene.add(mesh); + } + + // Center sphere + + const centerMaterial = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.1, metalness: 0.9 }); + const centerSphere = new THREE.Mesh(new THREE.SphereGeometry(2, 128, 128), centerMaterial); + centerSphere.position.y = 2; + scene.add(centerSphere); + + // Ambient light + + scene.add(new THREE.AmbientLight(0x404040, 0.5)); + + // Start with a couple point lights + + addLight(); + addLight(); + + // Renderer + + createRenderer(); + + // Inspector GUI + + window.addEventListener('resize', onWindowResize); +} + +function createRenderer() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + if (params.dynamic) renderer.lighting = new DynamicLighting(); + + // Inspector GUI + + const gui = renderer.inspector.createParameters('Dynamic Lights'); + + gui.add(params, 'dynamic') + .name('dynamic mode') + .onChange(() => { + renderer.dispose(); + document.body.removeChild(renderer.domElement); + clearInterval(autoAddInterval); + autoAddInterval = null; + params.autoAdd = false; + createRenderer(); + }); + + gui.add(params, 'autoAdd') + .name('auto-add lights') + .onChange(value => { + if (value) { + autoAddInterval = setInterval(() => { + addLight(); + }, 500); + } else { + clearInterval(autoAddInterval); + autoAddInterval = null; + } + }); + + gui.add(params, 'addLight').name('add light'); + gui.add(params, 'removeLight').name('remove light'); + gui.add(params, 'removeAll').name('remove all lights'); + gui.add(params, 'lightCount').name('point lights').listen(); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target.set(0, 2, 0); + controls.update(); +} + +function addLight() { + const color = new THREE.Color().setHSL(Math.random(), 0.8, 0.5); + const light = new THREE.PointLight(color, 1000); + + const angle = Math.random() * Math.PI * 2; + const radius = 5 + Math.random() * 20; + light.position.set(Math.cos(angle) * radius, 1 + Math.random() * 6, Math.sin(angle) * radius); + + light.userData.angle = angle; + light.userData.radius = radius; + light.userData.speed = 0.2 + Math.random() * 0.8; + light.userData.baseY = light.position.y; + + // Visual indicator + const sphere = new THREE.Mesh(new THREE.SphereGeometry(0.15, 8, 8), new THREE.MeshBasicMaterial({ color: color })); + light.add(sphere); + + scene.add(light); + pointLights.push(light); + + params.lightCount = pointLights.length; +} + +function removeLight() { + if (pointLights.length === 0) return; + + const light = pointLights.pop(); + scene.remove(light); + light.dispose(); + + params.lightCount = pointLights.length; +} + +function removeAllLights() { + while (pointLights.length > 0) { + const light = pointLights.pop(); + scene.remove(light); + light.dispose(); + } + + params.lightCount = 0; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const time = timer.getElapsed(); + + controls.update(); + + // Animate lights + + for (let i = 0; i < pointLights.length; i++) { + const light = pointLights[i]; + const d = light.userData; + const t = time * d.speed + d.angle; + + light.position.x = Math.cos(t) * d.radius; + light.position.z = Math.sin(t) * d.radius; + light.position.y = d.baseY + Math.sin(t * 2) * 0.5; + } + + renderer.render(scene, camera); + + stats.update(); +} diff --git a/examples-testing/examples/webgpu_lights_ies_spotlight.ts b/examples-testing/examples/webgpu_lights_ies_spotlight.ts new file mode 100644 index 000000000..edfc51efa --- /dev/null +++ b/examples-testing/examples/webgpu_lights_ies_spotlight.ts @@ -0,0 +1,168 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from './jsm/controls/OrbitControls.js'; + +import { IESLoader } from 'three/addons/loaders/IESLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let renderer, scene, camera; +let lights; + +async function init() { + const iesLoader = new IESLoader().setPath('./ies/'); + //iesLoader.type = THREE.UnsignedByteType; // LDR + + const [iesTexture1, iesTexture2, iesTexture3, iesTexture4] = await Promise.all([ + iesLoader.loadAsync('007cfb11e343e2f42e3b476be4ab684e.ies'), + iesLoader.loadAsync('06b4cfdc8805709e767b5e2e904be8ad.ies'), + iesLoader.loadAsync('02a7562c650498ebb301153dbbf59207.ies'), + iesLoader.loadAsync('1a936937a49c63374e6d4fbed9252b29.ies'), + ]); + + // + + scene = new THREE.Scene(); + + // + + const spotLight = new THREE.IESSpotLight(0xff0000, 500); + spotLight.position.set(6.5, 3, 6.5); + spotLight.angle = Math.PI / 8; + spotLight.penumbra = 0.7; + spotLight.distance = 20; + spotLight.castShadow = true; + spotLight.iesMap = iesTexture1; + spotLight.userData.helper = new THREE.SpotLightHelper(spotLight); + scene.add(spotLight); + scene.add(spotLight.target); + scene.add(spotLight.userData.helper); + + // + + const spotLight2 = new THREE.IESSpotLight(0x00ff00, 500); + spotLight2.position.set(-6.5, 3, 6.5); + spotLight2.angle = Math.PI / 8; + spotLight2.penumbra = 0.7; + spotLight2.distance = 20; + spotLight2.castShadow = true; + spotLight2.iesMap = iesTexture2; + spotLight2.userData.helper = new THREE.SpotLightHelper(spotLight2); + scene.add(spotLight2); + scene.add(spotLight2.target); + scene.add(spotLight2.userData.helper); + + // + + const spotLight3 = new THREE.IESSpotLight(0x0000ff, 500); + spotLight3.position.set(-6.5, 3, -6.5); + spotLight3.angle = Math.PI / 8; + spotLight3.penumbra = 0.7; + spotLight3.distance = 20; + spotLight3.castShadow = true; + spotLight3.iesMap = iesTexture3; + spotLight3.userData.helper = new THREE.SpotLightHelper(spotLight3); + scene.add(spotLight3); + scene.add(spotLight3.target); + scene.add(spotLight3.userData.helper); + + // + + const spotLight4 = new THREE.IESSpotLight(0xffffff, 500); + spotLight4.position.set(6.5, 3, -6.5); + spotLight4.angle = Math.PI / 8; + spotLight4.penumbra = 0.7; + spotLight4.distance = 20; + spotLight4.castShadow = true; + spotLight4.iesMap = iesTexture4; + spotLight4.userData.helper = new THREE.SpotLightHelper(spotLight4); + scene.add(spotLight4); + scene.add(spotLight4.target); + scene.add(spotLight4.userData.helper); + + // + + lights = [spotLight, spotLight2, spotLight3, spotLight4]; + + // + + const material = new THREE.MeshPhongMaterial({ color: 0x999999 /*, dithering: true*/ }); + + const geometry = new THREE.PlaneGeometry(200, 200); + + const mesh = new THREE.Mesh(geometry, material); + mesh.rotation.x = -Math.PI * 0.5; + mesh.receiveShadow = true; + scene.add(mesh); + + const geometry2 = new THREE.BoxGeometry(2, 2, 2); + //const geometry2 = new THREE.IcosahedronGeometry( 1, 5 ); + + const mesh2 = new THREE.Mesh(geometry2, material); + mesh2.position.y = 1; + mesh2.castShadow = true; + scene.add(mesh2); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(16, 4, 1); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 50; + controls.enablePan = false; + + // + + function setHelperVisible(value) { + for (let i = 0; i < lights.length; i++) { + lights[i].userData.helper.visible = value; + } + } + + setHelperVisible(false); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add({ helper: false }, 'helper').onChange(v => setHelperVisible(v)); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render(time) { + time = time / 1000; + + for (let i = 0; i < lights.length; i++) { + const t = (Math.sin((time + i) * (Math.PI / 2)) + 1) / 2; + + const x = THREE.MathUtils.lerp(lights[i].position.x, 0, t); + const z = THREE.MathUtils.lerp(lights[i].position.z, 0, t); + + lights[i].target.position.x = x; + lights[i].target.position.z = z; + if (lights[i].userData.helper) lights[i].userData.helper.update(); + } + + renderer.render(scene, camera); +} + +init(); diff --git a/examples-testing/examples/webgpu_lights_phong.ts b/examples-testing/examples/webgpu_lights_phong.ts new file mode 100644 index 000000000..c2cdf4393 --- /dev/null +++ b/examples-testing/examples/webgpu_lights_phong.ts @@ -0,0 +1,136 @@ +import * as THREE from 'three/webgpu'; +import { color, fog, rangeFogFactor, checker, uv, mix, texture, lights, normalMap } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + +let camera, scene, renderer, light1, light2, light3, light4, controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.z = 7; + + scene = new THREE.Scene(); + scene.fogNode = fog(color(0xff00ff), rangeFogFactor(12, 30)); + + const sphereGeometry = new THREE.SphereGeometry(0.1, 16, 8); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const normalMapTexture = textureLoader.load('./textures/water/Water_1_M_Normal.jpg'); + normalMapTexture.wrapS = THREE.RepeatWrapping; + normalMapTexture.wrapT = THREE.RepeatWrapping; + + const alphaTexture = textureLoader.load('./textures/roughness_map.jpg'); + alphaTexture.wrapS = THREE.RepeatWrapping; + alphaTexture.wrapT = THREE.RepeatWrapping; + + // lights + + const addLight = (hexColor, power = 1700, distance = 100) => { + const material = new THREE.MeshPhongNodeMaterial(); + material.colorNode = color(hexColor); + material.lights = false; + + const mesh = new THREE.Mesh(sphereGeometry, material); + + const light = new THREE.PointLight(hexColor, 1, distance); + light.power = power; + light.add(mesh); + + scene.add(light); + + return light; + }; + + light1 = addLight(0x0040ff); + light2 = addLight(0xffffff); + light3 = addLight(0x80ff80); + light4 = addLight(0xffaa00); + + // light nodes ( selective lights ) + + const blueLightsNode = lights([light1]); + const whiteLightsNode = lights([light2]); + + // models + + const geometryTeapot = new TeapotGeometry(0.8, 18); + + const leftObject = new THREE.Mesh(geometryTeapot, new THREE.MeshPhongNodeMaterial({ color: 0x555555 })); + leftObject.material.lightsNode = blueLightsNode; + leftObject.material.specularNode = texture(alphaTexture); + leftObject.position.x = -3; + scene.add(leftObject); + + const centerObject = new THREE.Mesh(geometryTeapot, new THREE.MeshPhongNodeMaterial({ color: 0x555555 })); + centerObject.material.normalNode = normalMap(texture(normalMapTexture)); + centerObject.material.shininess = 80; + scene.add(centerObject); + + const rightObject = new THREE.Mesh(geometryTeapot, new THREE.MeshPhongNodeMaterial({ color: 0x555555 })); + rightObject.material.lightsNode = whiteLightsNode; + //rightObject.material.specular.setHex( 0xFF00FF ); + rightObject.material.specularNode = mix(color(0x0000ff), color(0xff0000), checker(uv().mul(5))); + rightObject.material.shininess = 90; + rightObject.position.x = 3; + scene.add(rightObject); + + leftObject.rotation.y = centerObject.rotation.y = rightObject.rotation.y = Math.PI * -0.5; + leftObject.position.y = centerObject.position.y = rightObject.position.y = -1; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 3; + controls.maxDistance = 25; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now() / 1000; + const lightTime = time * 0.5; + + light1.position.x = Math.sin(lightTime * 0.7) * 3; + light1.position.y = Math.cos(lightTime * 0.5) * 4; + light1.position.z = Math.cos(lightTime * 0.3) * 3; + + light2.position.x = Math.cos(lightTime * 0.3) * 3; + light2.position.y = Math.sin(lightTime * 0.5) * 4; + light2.position.z = Math.sin(lightTime * 0.7) * 3; + + light3.position.x = Math.sin(lightTime * 0.7) * 3; + light3.position.y = Math.cos(lightTime * 0.3) * 4; + light3.position.z = Math.sin(lightTime * 0.5) * 3; + + light4.position.x = Math.sin(lightTime * 0.3) * 3; + light4.position.y = Math.cos(lightTime * 0.7) * 4; + light4.position.z = Math.sin(lightTime * 0.5) * 3; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lights_physical.ts b/examples-testing/examples/webgpu_lights_physical.ts new file mode 100644 index 000000000..43d7ce723 --- /dev/null +++ b/examples-testing/examples/webgpu_lights_physical.ts @@ -0,0 +1,236 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, bulbLight, bulbMat, hemiLight; +let ballMat, cubeMat, floorMat; + +let previousShadowMap = false; + +// ref for lumens: http://www.power-sure.com/lumens.htm +const bulbLuminousPowers = { + '110000 lm (1000W)': 110000, + '3500 lm (300W)': 3500, + '1700 lm (100W)': 1700, + '800 lm (60W)': 800, + '400 lm (40W)': 400, + '180 lm (25W)': 180, + '20 lm (4W)': 20, + Off: 0, +}; + +// ref for solar irradiances: https://en.wikipedia.org/wiki/Lux +const hemiLuminousIrradiances = { + '0.0001 lx (Moonless Night)': 0.0001, + '0.002 lx (Night Airglow)': 0.002, + '0.5 lx (Full Moon)': 0.5, + '3.4 lx (City Twilight)': 3.4, + '50 lx (Living Room)': 50, + '100 lx (Very Overcast)': 100, + '350 lx (Office Room)': 350, + '400 lx (Sunrise/Sunset)': 400, + '1000 lx (Overcast)': 1000, + '18000 lx (Daylight)': 18000, + '50000 lx (Direct Sun)': 50000, +}; + +const params = { + shadows: true, + exposure: 0.68, + bulbPower: Object.keys(bulbLuminousPowers)[4], + hemiIrradiance: Object.keys(hemiLuminousIrradiances)[0], +}; + +init(); + +function init() { + const container = document.getElementById('container'); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.x = -4; + camera.position.z = 4; + camera.position.y = 2; + + scene = new THREE.Scene(); + + const bulbGeometry = new THREE.SphereGeometry(0.02, 16, 8); + bulbLight = new THREE.PointLight(0xffee88, 1, 100, 2); + + bulbMat = new THREE.MeshStandardMaterial({ + emissive: 0xffffee, + emissiveIntensity: 1, + color: 0x000000, + }); + bulbLight.add(new THREE.Mesh(bulbGeometry, bulbMat)); + bulbLight.position.set(0, 2, 0); + bulbLight.castShadow = true; + scene.add(bulbLight); + + hemiLight = new THREE.HemisphereLight(0xddeeff, 0x0f0e0d, 0.02); + scene.add(hemiLight); + + floorMat = new THREE.MeshStandardMaterial({ + roughness: 0.8, + color: 0xffffff, + metalness: 0.2, + bumpScale: 1, + }); + const textureLoader = new THREE.TextureLoader(); + textureLoader.load('textures/hardwood2_diffuse.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(10, 24); + map.colorSpace = THREE.SRGBColorSpace; + floorMat.map = map; + floorMat.needsUpdate = true; + }); + textureLoader.load('textures/hardwood2_bump.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(10, 24); + floorMat.bumpMap = map; + floorMat.needsUpdate = true; + }); + textureLoader.load('textures/hardwood2_roughness.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(10, 24); + floorMat.roughnessMap = map; + floorMat.needsUpdate = true; + }); + + cubeMat = new THREE.MeshStandardMaterial({ + roughness: 0.7, + color: 0xffffff, + bumpScale: 1, + metalness: 0.2, + }); + textureLoader.load('textures/brick_diffuse.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(1, 1); + map.colorSpace = THREE.SRGBColorSpace; + cubeMat.map = map; + cubeMat.needsUpdate = true; + }); + textureLoader.load('textures/brick_bump.jpg', function (map) { + map.wrapS = THREE.RepeatWrapping; + map.wrapT = THREE.RepeatWrapping; + map.anisotropy = 4; + map.repeat.set(1, 1); + cubeMat.bumpMap = map; + cubeMat.needsUpdate = true; + }); + + ballMat = new THREE.MeshStandardMaterial({ + color: 0xffffff, + roughness: 0.5, + metalness: 1.0, + }); + textureLoader.load('textures/planets/earth_atmos_2048.jpg', function (map) { + map.anisotropy = 4; + map.colorSpace = THREE.SRGBColorSpace; + ballMat.map = map; + ballMat.needsUpdate = true; + }); + textureLoader.load('textures/planets/earth_specular_2048.jpg', function (map) { + map.anisotropy = 4; + map.colorSpace = THREE.SRGBColorSpace; + ballMat.metalnessMap = map; + ballMat.needsUpdate = true; + }); + + const floorGeometry = new THREE.PlaneGeometry(20, 20); + const floorMesh = new THREE.Mesh(floorGeometry, floorMat); + floorMesh.receiveShadow = true; + floorMesh.rotation.x = -Math.PI / 2.0; + scene.add(floorMesh); + + const ballGeometry = new THREE.SphereGeometry(0.25, 32, 32); + const ballMesh = new THREE.Mesh(ballGeometry, ballMat); + ballMesh.position.set(1, 0.25, 1); + ballMesh.rotation.y = Math.PI; + ballMesh.castShadow = true; + scene.add(ballMesh); + + const boxGeometry = new THREE.BoxGeometry(0.5, 0.5, 0.5); + const boxMesh = new THREE.Mesh(boxGeometry, cubeMat); + boxMesh.position.set(-0.5, 0.25, -1); + boxMesh.castShadow = true; + scene.add(boxMesh); + + const boxMesh2 = new THREE.Mesh(boxGeometry, cubeMat); + boxMesh2.position.set(0, 0.25, -5); + boxMesh2.castShadow = true; + scene.add(boxMesh2); + + const boxMesh3 = new THREE.Mesh(boxGeometry, cubeMat); + boxMesh3.position.set(7, 0.25, 0); + boxMesh3.castShadow = true; + scene.add(boxMesh3); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ReinhardToneMapping; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 20; + + window.addEventListener('resize', onWindowResize); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'hemiIrradiance', Object.keys(hemiLuminousIrradiances)); + gui.add(params, 'bulbPower', Object.keys(bulbLuminousPowers)); + gui.add(params, 'exposure', 0, 1); + gui.add(params, 'shadows'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.toneMappingExposure = Math.pow(params.exposure, 5.0); // to allow for very bright scenes. + renderer.shadowMap.enabled = params.shadows; + bulbLight.castShadow = params.shadows; + + if (params.shadows !== previousShadowMap) { + ballMat.needsUpdate = true; + cubeMat.needsUpdate = true; + floorMat.needsUpdate = true; + previousShadowMap = params.shadows; + } + + bulbLight.power = bulbLuminousPowers[params.bulbPower]; + bulbMat.emissiveIntensity = bulbLight.intensity / Math.pow(0.02, 2.0); // convert from intensity to irradiance at bulb surface + + hemiLight.intensity = hemiLuminousIrradiances[params.hemiIrradiance]; + const time = Date.now() * 0.0005; + + bulbLight.position.y = Math.cos(time) * 0.75 + 1.25; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lights_pointlights.ts b/examples-testing/examples/webgpu_lights_pointlights.ts new file mode 100644 index 000000000..802ab90bd --- /dev/null +++ b/examples-testing/examples/webgpu_lights_pointlights.ts @@ -0,0 +1,190 @@ +import * as THREE from 'three/webgpu'; + +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { + abs, + attribute, + distance, + float, + max, + modelWorldMatrixInverse, + positionLocal, + sin, + time, + uniform, +} from 'three/tsl'; + +let camera, scene, timer, renderer, controls; + +let light1, light2; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 100; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + timer = new THREE.Timer(); + timer.connect(document); + + // model + + const loader = new OBJLoader(); + loader.load('models/obj/walt/WaltHead.obj', function (obj) { + const mesh = obj.children[0]; + mesh.geometry = createGeometry(mesh.geometry); + mesh.material = createMaterial(); + + mesh.scale.multiplyScalar(0.8); + mesh.position.y = -30; + scene.add(mesh); + }); + + const sphere = new THREE.SphereGeometry(0.5, 16, 8); + + // lights + + light1 = new THREE.PointLight(0xff0040, 2000); + light1.add(new THREE.Mesh(sphere, new THREE.MeshBasicMaterial({ color: 0xff0040 }))); + scene.add(light1); + + light2 = new THREE.PointLight(0x0040ff, 2000); + light2.add(new THREE.Mesh(sphere, new THREE.MeshBasicMaterial({ color: 0x0040ff }))); + scene.add(light2); + + scene.add(new THREE.AmbientLight(0xaaaaaa, 0.1)); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const time = timer.getElapsed() * 0.5; + + controls.update(); + + light1.position.x = Math.sin(time) * 20; + light1.position.y = Math.cos(time * 0.75) * -30; + light1.position.z = Math.cos(time * 0.5) * 20; + + light2.position.x = Math.cos(time * 0.5) * 20; + light2.position.y = Math.sin(time * 0.75) * -30; + light2.position.z = Math.sin(time) * 20; + + renderer.render(scene, camera); +} + +// helpers + +function createMaterial() { + const material = new THREE.MeshPhongNodeMaterial(); + + const seedAttribute = attribute('seed'); + const displaceNormalAttribute = attribute('displaceNormal'); + + const localTime = attribute('time').add(time); + + const effector1 = uniform(light1.position).toVar(); + const effector2 = uniform(light2.position).toVar(); + + const distance1 = distance(positionLocal, modelWorldMatrixInverse.mul(effector1)); + const distance2 = distance(positionLocal, modelWorldMatrixInverse.mul(effector2)); + + const invDistance1 = max(0.0, float(20.0).sub(distance1)).div(2.0); + const invDistance2 = max(0.0, float(20.0).sub(distance2)).div(2.0); + + const s = abs(sin(localTime.mul(2).add(seedAttribute)).mul(0.5)) + .add(invDistance1) + .add(invDistance2); + + material.positionNode = positionLocal.add(displaceNormalAttribute.mul(s)); + + return material; +} + +function createGeometry(geometry) { + const positionAttribute = geometry.getAttribute('position'); + + const v0 = new THREE.Vector3(); + const v1 = new THREE.Vector3(); + const v2 = new THREE.Vector3(); + const v3 = new THREE.Vector3(); + const n = new THREE.Vector3(); + + const plane = new THREE.Plane(); + + const vertices = []; + const times = []; + const seeds = []; + const displaceNormal = []; + + for (let i = 0; i < positionAttribute.count; i += 3) { + v0.fromBufferAttribute(positionAttribute, i); + v1.fromBufferAttribute(positionAttribute, i + 1); + v2.fromBufferAttribute(positionAttribute, i + 2); + + plane.setFromCoplanarPoints(v0, v1, v2); + + v3.copy(v0).add(v1).add(v2).divideScalar(3); // compute center + v3.add(n.copy(plane.normal).multiplyScalar(-1)); // displace center inwards + + // generate tetrahedron for each triangle + + vertices.push(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, v2.x, v2.y, v2.z); + vertices.push(v3.x, v3.y, v3.z, v1.x, v1.y, v1.z, v0.x, v0.y, v0.z); + vertices.push(v3.x, v3.y, v3.z, v2.x, v2.y, v2.z, v1.x, v1.y, v1.z); + vertices.push(v3.x, v3.y, v3.z, v0.x, v0.y, v0.z, v2.x, v2.y, v2.z); + + const t = Math.random(); + const s = Math.random(); + n.copy(plane.normal); + + times.push(t, t, t); + times.push(t, t, t); + times.push(t, t, t); + times.push(t, t, t); + seeds.push(s, s, s); + seeds.push(s, s, s); + seeds.push(s, s, s); + seeds.push(s, s, s); + + displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); + displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); + displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); + displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); + } + + const newGeometry = new THREE.BufferGeometry(); + newGeometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); + newGeometry.setAttribute('time', new THREE.Float32BufferAttribute(times, 1)); + newGeometry.setAttribute('seed', new THREE.Float32BufferAttribute(seeds, 1)); + newGeometry.setAttribute('displaceNormal', new THREE.Float32BufferAttribute(displaceNormal, 3)); + + newGeometry.computeVertexNormals(); + + return newGeometry; +} diff --git a/examples-testing/examples/webgpu_lights_rectarealight.ts b/examples-testing/examples/webgpu_lights_rectarealight.ts new file mode 100644 index 000000000..75e2cc442 --- /dev/null +++ b/examples-testing/examples/webgpu_lights_rectarealight.ts @@ -0,0 +1,87 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; +import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; + +import { checker, uv } from 'three/tsl'; + +let renderer, scene, camera; +let rectLight1, rectLight2, rectLight3; +let timer; + +init(); + +function init() { + THREE.RectAreaLightNode.setLTC(RectAreaLightTexturesLib.init()); + + timer = new THREE.Timer(); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animation); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 5, -15); + + scene = new THREE.Scene(); + + rectLight1 = new THREE.RectAreaLight(0xff0000, 5, 4, 10); + rectLight1.position.set(-5, 6, 5); + scene.add(rectLight1); + + rectLight2 = new THREE.RectAreaLight(0x00ff00, 5, 4, 10); + rectLight2.position.set(0, 6, 5); + scene.add(rectLight2); + + rectLight3 = new THREE.RectAreaLight(0x0000ff, 5, 4, 10); + rectLight3.position.set(5, 6, 5); + scene.add(rectLight3); + + scene.add(new RectAreaLightHelper(rectLight1)); + scene.add(new RectAreaLightHelper(rectLight2)); + scene.add(new RectAreaLightHelper(rectLight3)); + + const geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000); + const matStdFloor = new THREE.MeshStandardMaterial({ color: 0x444444 }); + matStdFloor.roughnessNode = checker(uv().mul(400)); + const mshStdFloor = new THREE.Mesh(geoFloor, matStdFloor); + scene.add(mshStdFloor); + + const geoKnot = new THREE.TorusKnotGeometry(1.5, 0.5, 200, 16); + const matKnot = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0, metalness: 0 }); + const meshKnot = new THREE.Mesh(geoKnot, matKnot); + meshKnot.position.set(0, 5.5, 0); + scene.add(meshKnot); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.copy(meshKnot.position); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +function animation() { + timer.update(); + + const delta = timer.getDelta(); + + rectLight1.rotation.y += -delta; + rectLight2.rotation.y += delta * 0.5; + rectLight3.rotation.y += delta; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lights_selective.ts b/examples-testing/examples/webgpu_lights_selective.ts new file mode 100644 index 000000000..d00048347 --- /dev/null +++ b/examples-testing/examples/webgpu_lights_selective.ts @@ -0,0 +1,150 @@ +import * as THREE from 'three/webgpu'; +import { fog, rangeFogFactor, color, lights, texture, normalMap } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + +let camera, scene, renderer, light1, light2, light3, light4, controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.z = 7; + + scene = new THREE.Scene(); + scene.fogNode = fog(color(0xff00ff), rangeFogFactor(12, 30)); + + const sphereGeometry = new THREE.SphereGeometry(0.1, 16, 8); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const normalMapTexture = textureLoader.load('./textures/water/Water_1_M_Normal.jpg'); + normalMapTexture.wrapS = THREE.RepeatWrapping; + normalMapTexture.wrapT = THREE.RepeatWrapping; + + const alphaTexture = textureLoader.load('./textures/roughness_map.jpg'); + alphaTexture.wrapS = THREE.RepeatWrapping; + alphaTexture.wrapT = THREE.RepeatWrapping; + + // lights + + const addLight = (hexColor, power = 1700, distance = 100) => { + const material = new THREE.MeshStandardNodeMaterial(); + material.colorNode = color(hexColor); + material.lights = false; + + const mesh = new THREE.Mesh(sphereGeometry, material); + + const light = new THREE.PointLight(hexColor, 1, distance); + light.power = power; + light.add(mesh); + + scene.add(light); + + return light; + }; + + light1 = addLight(0xff0040); + light2 = addLight(0x0040ff); + light3 = addLight(0x80ff80); + light4 = addLight(0xffaa00); + + // light nodes ( selective lights ) + + const redLightsNode = lights([light1]); + const blueLightsNode = lights([light2]); + + // models + + const geometryTeapot = new TeapotGeometry(0.8, 18); + + const leftObject = new THREE.Mesh(geometryTeapot, new THREE.MeshStandardNodeMaterial({ color: 0x555555 })); + leftObject.material.lightsNode = redLightsNode; + leftObject.material.roughnessNode = texture(alphaTexture); + leftObject.material.metalness = 0; + leftObject.position.x = -3; + scene.add(leftObject); + + const centerObject = new THREE.Mesh(geometryTeapot, new THREE.MeshStandardNodeMaterial({ color: 0x555555 })); + centerObject.material.normalNode = normalMap(texture(normalMapTexture)); + centerObject.material.metalness = 0.5; + centerObject.material.roughness = 0.5; + scene.add(centerObject); + + const rightObject = new THREE.Mesh(geometryTeapot, new THREE.MeshStandardNodeMaterial({ color: 0x555555 })); + rightObject.material.lightsNode = blueLightsNode; + rightObject.material.metalnessNode = texture(alphaTexture); + rightObject.position.x = 3; + scene.add(rightObject); + + leftObject.rotation.y = centerObject.rotation.y = rightObject.rotation.y = Math.PI * -0.5; + leftObject.position.y = centerObject.position.y = rightObject.position.y = -1; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 3; + controls.maxDistance = 25; + + // events + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Material'); + + gui.add(centerObject.material, 'roughness', 0, 1, 0.01); + gui.add(centerObject.material, 'metalness', 0, 1, 0.01); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now() / 1000; + const lightTime = time * 0.5; + + light1.position.x = Math.sin(lightTime * 0.7) * 3; + light1.position.y = Math.cos(lightTime * 0.5) * 4; + light1.position.z = Math.cos(lightTime * 0.3) * 3; + + light2.position.x = Math.cos(lightTime * 0.3) * 3; + light2.position.y = Math.sin(lightTime * 0.5) * 4; + light2.position.z = Math.sin(lightTime * 0.7) * 3; + + light3.position.x = Math.sin(lightTime * 0.7) * 3; + light3.position.y = Math.cos(lightTime * 0.3) * 4; + light3.position.z = Math.sin(lightTime * 0.5) * 3; + + light4.position.x = Math.sin(lightTime * 0.3) * 3; + light4.position.y = Math.cos(lightTime * 0.7) * 4; + light4.position.z = Math.sin(lightTime * 0.5) * 3; + /* + @TODO: Used to test scene light change ( currently unavailable ) + + if ( time > 2.0 && light1.parent === null ) scene.add( light1 ); + if ( time > 2.5 && light2.parent === null ) scene.add( light2 ); + if ( time > 3.0 && light3.parent === null ) scene.add( light3 ); + if ( time > 3.5 && light4.parent === null ) scene.add( light4 ); + */ + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lights_spotlight.ts b/examples-testing/examples/webgpu_lights_spotlight.ts new file mode 100644 index 000000000..e01b9823f --- /dev/null +++ b/examples-testing/examples/webgpu_lights_spotlight.ts @@ -0,0 +1,200 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let renderer, scene, camera; + +let spotLight; + +init(); + +function init() { + // Renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderer.inspector = new Inspector(); + + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1; + + renderer.shadowMap.enabled = true; + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(7, 4, 1); + + // Controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.maxPolarAngle = Math.PI / 2; + controls.target.set(0, 1, 0); + controls.update(); + + // Textures + + const loader = new THREE.TextureLoader().setPath('textures/'); + const filenames = ['disturb.jpg', 'colors.png', 'uv_grid_opengl.jpg']; + + const textures = { none: null }; + + for (let i = 0; i < filenames.length; i++) { + const filename = filenames[i]; + + const texture = loader.load(filename); + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + texture.colorSpace = THREE.SRGBColorSpace; + + textures[filename] = texture; + } + + // Lights + + const ambient = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 0.25); + scene.add(ambient); + + spotLight = new THREE.SpotLight(0xffffff, 100); + spotLight.name = 'spotLight'; + spotLight.map = textures['disturb.jpg']; + spotLight.position.set(2.5, 5, 2.5); + spotLight.angle = Math.PI / 6; + spotLight.penumbra = 1; + spotLight.decay = 2; + spotLight.distance = 0; + + spotLight.castShadow = true; + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + spotLight.shadow.camera.near = 2; + spotLight.shadow.camera.far = 10; + spotLight.shadow.focus = 1; + spotLight.shadow.intensity = 1; + scene.add(spotLight); + + spotLight.lightHelper = new THREE.SpotLightHelper(spotLight); + spotLight.lightHelper.visible = false; + scene.add(spotLight.lightHelper); + + spotLight.shadowCameraHelper = new THREE.CameraHelper(spotLight.shadow.camera); // colored lines + spotLight.shadowCameraHelper.visible = false; + scene.add(spotLight.shadowCameraHelper); + + // + + const geometry = new THREE.PlaneGeometry(10, 10); + const material = new THREE.MeshLambertMaterial({ color: 0xbcbcbc }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(0, -1, 0); + mesh.rotation.x = -Math.PI / 2; + mesh.receiveShadow = true; + scene.add(mesh); + + // Model + + new PLYLoader().load('models/ply/binary/Lucy100k.ply', function (geometry) { + geometry.scale(0.0024, 0.0024, 0.0024); + geometry.computeVertexNormals(); + + const material = new THREE.MeshLambertMaterial(); + + const mesh = new THREE.Mesh(geometry, material); + mesh.rotation.y = -Math.PI / 2; + mesh.position.y = 0.8; + mesh.castShadow = true; + mesh.receiveShadow = true; + scene.add(mesh); + }); + + // + + window.addEventListener('resize', onWindowResize); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + + const params = { + map: textures['disturb.jpg'], + color: spotLight.color.getHex(), + intensity: spotLight.intensity, + distance: spotLight.distance, + angle: spotLight.angle, + penumbra: spotLight.penumbra, + decay: spotLight.decay, + focus: spotLight.shadow.focus, + shadowIntensity: spotLight.shadow.intensity, + helpers: false, + }; + + gui.add(params, 'map', textures).onChange(function (val) { + spotLight.map = val; + }); + + gui.addColor(params, 'color').onChange(function (val) { + spotLight.color.setHex(val); + }); + + gui.add(params, 'intensity', 0, 500).onChange(function (val) { + spotLight.intensity = val; + }); + + gui.add(params, 'distance', 0, 20).onChange(function (val) { + spotLight.distance = val; + }); + + gui.add(params, 'angle', 0, Math.PI / 3).onChange(function (val) { + spotLight.angle = val; + }); + + gui.add(params, 'penumbra', 0, 1).onChange(function (val) { + spotLight.penumbra = val; + }); + + gui.add(params, 'decay', 1, 2).onChange(function (val) { + spotLight.decay = val; + }); + + gui.add(params, 'focus', 0, 1).onChange(function (val) { + spotLight.shadow.focus = val; + }); + + gui.add(params, 'shadowIntensity', 0, 1).onChange(function (val) { + spotLight.shadow.intensity = val; + }); + + gui.add(params, 'helpers').onChange(function (val) { + spotLight.lightHelper.visible = val; + spotLight.shadowCameraHelper.visible = val; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now() / 3000; + + spotLight.position.x = Math.cos(time) * 2.5; + spotLight.position.z = Math.sin(time) * 2.5; + + spotLight.lightHelper.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_lines_fat.ts b/examples-testing/examples/webgpu_lines_fat.ts new file mode 100644 index 000000000..96b8d414a --- /dev/null +++ b/examples-testing/examples/webgpu_lines_fat.ts @@ -0,0 +1,266 @@ +import * as THREE from 'three/webgpu'; +import { color } from 'three/tsl'; + +import Stats from 'three/addons/libs/stats.module.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Line2 } from 'three/addons/lines/webgpu/Line2.js'; +import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; +import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; + +let line, renderer, scene, camera, camera2, controls, backgroundNode; +let line1; +let matLine, matLineBasic, matLineDashed; +let stats; +let gui; + +// viewport +let insetWidth; +let insetHeight; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setClearColor(0x000000); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-40, 0, 60); + + camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); + camera2.position.copy(camera.position); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 10; + controls.maxDistance = 500; + + backgroundNode = color(0x222222); + + // Position and THREE.Color Data + + const positions = []; + const colors = []; + + const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 20.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); + + const spline = new THREE.CatmullRomCurve3(points); + const divisions = Math.round(12 * points.length); + const point = new THREE.Vector3(); + const lineColor = new THREE.Color(); + + for (let i = 0, l = divisions; i < l; i++) { + const t = i / l; + + spline.getPoint(t, point); + positions.push(point.x, point.y, point.z); + + lineColor.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); + colors.push(lineColor.r, lineColor.g, lineColor.b); + } + + // Line2 ( LineGeometry, LineMaterial ) + + const geometry = new LineGeometry(); + geometry.setPositions(positions); + geometry.setColors(colors); + + matLine = new THREE.Line2NodeMaterial({ + color: 0xffffff, + linewidth: 5, // in world units with size attenuation, pixels otherwise + vertexColors: true, + dashed: false, + alphaToCoverage: false, + }); + + line = new Line2(geometry, matLine); + line.computeLineDistances(); + line.scale.set(1, 1, 1); + scene.add(line); + + // THREE.Line ( THREE.BufferGeometry, THREE.LineBasicNodeMaterial ) - rendered with gl.LINE_STRIP + + const geo = new THREE.BufferGeometry(); + geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + matLineBasic = new THREE.LineBasicNodeMaterial({ vertexColors: true }); + matLineDashed = new THREE.LineDashedNodeMaterial({ vertexColors: true, scale: 2, dashSize: 1, gapSize: 1 }); + + line1 = new THREE.Line(geo, matLineBasic); + line1.computeLineDistances(); + line1.visible = false; + scene.add(line1); + + // + + window.addEventListener('resize', onWindowResize); + onWindowResize(); + + stats = new Stats(); + document.body.appendChild(stats.dom); + + initGui(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + insetWidth = window.innerHeight / 4; // square + insetHeight = window.innerHeight / 4; + + camera2.aspect = insetWidth / insetHeight; + camera2.updateProjectionMatrix(); +} + +function animate() { + stats.update(); + + // main scene + + renderer.setClearColor(0x000000); + + renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); + + controls.update(); + + renderer.autoClear = true; + + scene.backgroundNode = null; + renderer.render(scene, camera); + + // inset scene + + const posY = window.innerHeight - insetHeight - 20; + + renderer.clearDepth(); // important! + + renderer.setScissorTest(true); + + renderer.setScissor(20, posY, insetWidth, insetHeight); + + renderer.setViewport(20, posY, insetWidth, insetHeight); + + camera2.position.copy(camera.position); + camera2.quaternion.copy(camera.quaternion); + + renderer.autoClear = false; + + scene.backgroundNode = backgroundNode; + renderer.render(scene, camera2); + + renderer.setScissorTest(false); +} + +// + +function initGui() { + gui = new GUI(); + + const param = { + 'line type': 0, + 'world units': false, + width: 10, + alphaToCoverage: false, + dashed: false, + 'dash offset': 0, + 'dash scale': 1, + 'dash / gap': 1, + }; + + gui.add(param, 'line type', { LineGeometry: 0, '"line-strip"': 1 }).onChange(function (val) { + switch (val) { + case 0: + line.visible = true; + + line1.visible = false; + + break; + + case 1: + line.visible = false; + + line1.visible = true; + + break; + } + }); + + gui.add(param, 'world units').onChange(function (val) { + matLine.worldUnits = val; + matLine.needsUpdate = true; + + if (val) { + widthController.name('width (world units)').min(0.1).max(0.5).setValue(0.5); + } else { + widthController.name('width (pixels)').min(1).max(10).setValue(10); + } + }); + + const widthController = gui + .add(param, 'width', 1, 10) + .name('width (pixels)') + .onChange(function (val) { + matLine.linewidth = val; + }); + + gui.add(param, 'alphaToCoverage').onChange(function (val) { + matLine.alphaToCoverage = val; + }); + + gui.add(param, 'dashed').onChange(function (val) { + matLine.dashed = val; + line1.material = val ? matLineDashed : matLineBasic; + }); + + gui.add(param, 'dash scale', 0.5, 2, 0.1).onChange(function (val) { + matLine.scale = val; + matLineDashed.scale = val; + }); + + gui.add(param, 'dash offset', 0, 5, 0.1).onChange(function (val) { + matLine.dashOffset = val; + matLineDashed.dashOffset = val; + }); + + gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { + switch (val) { + case 0: + matLine.dashSize = 2; + matLine.gapSize = 1; + + matLineDashed.dashSize = 2; + matLineDashed.gapSize = 1; + + break; + + case 1: + matLine.dashSize = 1; + matLine.gapSize = 1; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 1; + + break; + + case 2: + matLine.dashSize = 1; + matLine.gapSize = 2; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 2; + + break; + } + }); +} diff --git a/examples-testing/examples/webgpu_lines_fat_raycasting.ts b/examples-testing/examples/webgpu_lines_fat_raycasting.ts new file mode 100644 index 000000000..baca80965 --- /dev/null +++ b/examples-testing/examples/webgpu_lines_fat_raycasting.ts @@ -0,0 +1,286 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { LineSegments2 } from 'three/addons/lines/webgpu/LineSegments2.js'; +import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; +import { Line2 } from 'three/addons/lines/webgpu/Line2.js'; +import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; + +// + +let line, thresholdLine, segments, thresholdSegments; +let renderer, scene, camera, controls; +let sphereInter, sphereOnLine; +let gui; +let timer; + +const color = new THREE.Color(); + +const pointer = new THREE.Vector2(Infinity, Infinity); + +const raycaster = new THREE.Raycaster(); + +raycaster.params.Line2 = {}; +raycaster.params.Line2.threshold = 0; + +const matLine = new THREE.Line2NodeMaterial({ + color: 0xffffff, + linewidth: 1, // in world units with size attenuation, pixels otherwise + worldUnits: true, + vertexColors: true, + + alphaToCoverage: true, +}); + +const matThresholdLine = new THREE.Line2NodeMaterial({ + color: 0xffffff, + linewidth: matLine.linewidth, // in world units with size attenuation, pixels otherwise + worldUnits: true, + // vertexColors: true, + transparent: true, + opacity: 0.2, + depthTest: false, + visible: false, +}); + +const params = { + 'line type': 1, + 'world units': matLine.worldUnits, + 'visualize threshold': matThresholdLine.visible, + width: matLine.linewidth, + alphaToCoverage: matLine.alphaToCoverage, + threshold: raycaster.params.Line2.threshold, + translation: 0, + animate: true, +}; + +init(); + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + renderer = new THREE.WebGPURenderer({ antialias: true, alpha: true, trackTimestamp: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setClearColor(0x000000); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-40, 0, 60); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 10; + controls.maxDistance = 500; + + const sphereGeometry = new THREE.SphereGeometry(0.25, 8, 4); + const sphereInterMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, depthTest: false }); + const sphereOnLineMaterial = new THREE.MeshBasicMaterial({ color: 0x00ff00, depthTest: false }); + + sphereInter = new THREE.Mesh(sphereGeometry, sphereInterMaterial); + sphereOnLine = new THREE.Mesh(sphereGeometry, sphereOnLineMaterial); + sphereInter.visible = false; + sphereOnLine.visible = false; + sphereInter.renderOrder = 10; + sphereOnLine.renderOrder = 10; + scene.add(sphereInter); + scene.add(sphereOnLine); + + // Position and THREE.Color Data + + const positions = []; + const colors = []; + const points = []; + for (let i = -50; i < 50; i++) { + const t = i / 3; + points.push(new THREE.Vector3(t * Math.sin(2 * t), t, t * Math.cos(2 * t))); + } + + const spline = new THREE.CatmullRomCurve3(points); + const divisions = Math.round(3 * points.length); + const point = new THREE.Vector3(); + const color = new THREE.Color(); + + for (let i = 0, l = divisions; i < l; i++) { + const t = i / l; + + spline.getPoint(t, point); + positions.push(point.x, point.y, point.z); + + color.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); + colors.push(color.r, color.g, color.b); + } + + const lineGeometry = new LineGeometry(); + lineGeometry.setPositions(positions); + lineGeometry.setColors(colors); + + const segmentsGeometry = new LineSegmentsGeometry(); + segmentsGeometry.setPositions(positions); + segmentsGeometry.setColors(colors); + + segments = new LineSegments2(segmentsGeometry, matLine); + segments.computeLineDistances(); + segments.scale.set(1, 1, 1); + scene.add(segments); + + thresholdSegments = new LineSegments2(segmentsGeometry, matThresholdLine); + thresholdSegments.computeLineDistances(); + thresholdSegments.scale.set(1, 1, 1); + scene.add(thresholdSegments); + + line = new Line2(lineGeometry, matLine); + line.computeLineDistances(); + line.scale.set(1, 1, 1); + scene.add(line); + + thresholdLine = new Line2(lineGeometry, matThresholdLine); + thresholdLine.computeLineDistances(); + thresholdLine.scale.set(1, 1, 1); + scene.add(thresholdLine); + + const geo = new THREE.BufferGeometry(); + geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); + + // + + switchLine(params['line type']); + + // + + document.addEventListener('pointermove', onPointerMove); + window.addEventListener('resize', onWindowResize); + onWindowResize(); + + initGui(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +async function animate() { + timer.update(); + + const delta = timer.getDelta(); + + const obj = line.visible ? line : segments; + thresholdLine.position.copy(line.position); + thresholdLine.quaternion.copy(line.quaternion); + thresholdSegments.position.copy(segments.position); + thresholdSegments.quaternion.copy(segments.quaternion); + + if (params.animate) { + line.rotation.y += delta * 0.1; + + segments.rotation.y = line.rotation.y; + } + + raycaster.setFromCamera(pointer, camera); + + const intersects = raycaster.intersectObject(obj); + + if (intersects.length > 0) { + sphereInter.visible = true; + sphereOnLine.visible = true; + + sphereInter.position.copy(intersects[0].point); + sphereOnLine.position.copy(intersects[0].pointOnLine); + + const index = intersects[0].faceIndex; + const colors = obj.geometry.getAttribute('instanceColorStart'); + + color.fromBufferAttribute(colors, index); + + sphereInter.material.color.copy(color).offsetHSL(0.3, 0, 0); + sphereOnLine.material.color.copy(color).offsetHSL(0.7, 0, 0); + + renderer.domElement.style.cursor = 'crosshair'; + } else { + sphereInter.visible = false; + sphereOnLine.visible = false; + renderer.domElement.style.cursor = ''; + } + + renderer.render(scene, camera); +} + +// + +function switchLine(val) { + switch (val) { + case 0: + line.visible = true; + thresholdLine.visible = true; + + segments.visible = false; + thresholdSegments.visible = false; + + break; + + case 1: + line.visible = false; + thresholdLine.visible = false; + + segments.visible = true; + thresholdSegments.visible = true; + + break; + } +} + +function initGui() { + gui = renderer.inspector.createParameters('Settings'); + + gui.add(params, 'line type', { LineGeometry: 0, LineSegmentsGeometry: 1 }).onChange(function (val) { + switchLine(val); + }); + + gui.add(params, 'world units').onChange(function (val) { + matLine.worldUnits = val; + matLine.needsUpdate = true; + + matThresholdLine.worldUnits = val; + matThresholdLine.needsUpdate = true; + }); + + gui.add(params, 'visualize threshold').onChange(function (val) { + matThresholdLine.visible = val; + }); + + gui.add(params, 'width', 1, 10).onChange(function (val) { + matLine.linewidth = val; + matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; + }); + + gui.add(params, 'alphaToCoverage').onChange(function (val) { + matLine.alphaToCoverage = val; + }); + + gui.add(params, 'threshold', 0, 10).onChange(function (val) { + raycaster.params.Line2.threshold = val; + matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; + }); + + gui.add(params, 'translation', 0, 10).onChange(function (val) { + line.position.x = val; + segments.position.x = val; + }); + + gui.add(params, 'animate'); +} diff --git a/examples-testing/examples/webgpu_lines_fat_wireframe.ts b/examples-testing/examples/webgpu_lines_fat_wireframe.ts new file mode 100644 index 000000000..1bd916fee --- /dev/null +++ b/examples-testing/examples/webgpu_lines_fat_wireframe.ts @@ -0,0 +1,208 @@ +import * as THREE from 'three/webgpu'; +import { color } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Wireframe } from 'three/addons/lines/webgpu/Wireframe.js'; +import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; + +let wireframe, renderer, scene, camera, camera2, controls, backgroundNode; +let wireframe1; +let matLine, matLineBasic, matLineDashed; +let gui; + +// viewport +let insetWidth; +let insetHeight; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setClearColor(0x000000); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-50, 0, 50); + + camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); + camera2.position.copy(camera.position); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 10; + controls.maxDistance = 500; + + backgroundNode = color(0x222222); + + // Wireframe ( WireframeGeometry2, Line2NodeMaterial ) + + let geo = new THREE.IcosahedronGeometry(20, 1); + + const geometry = new WireframeGeometry2(geo); + + matLine = new THREE.Line2NodeMaterial({ + color: 0x4080ff, + linewidth: 5, // in world units with size attenuation, pixels otherwise + dashed: false, + }); + + wireframe = new Wireframe(geometry, matLine); + wireframe.computeLineDistances(); + wireframe.scale.set(1, 1, 1); + scene.add(wireframe); + + // Line ( THREE.WireframeGeometry, THREE.LineBasicMaterial ) - rendered with gl.LINE + + geo = new THREE.WireframeGeometry(geo); + + matLineBasic = new THREE.LineBasicMaterial({ color: 0x4080ff }); + matLineDashed = new THREE.LineDashedMaterial({ scale: 2, dashSize: 1, gapSize: 1 }); + + wireframe1 = new THREE.LineSegments(geo, matLineBasic); + wireframe1.computeLineDistances(); + wireframe1.visible = false; + scene.add(wireframe1); + + // + + window.addEventListener('resize', onWindowResize); + onWindowResize(); + + initGui(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + insetWidth = window.innerHeight / 4; // square + insetHeight = window.innerHeight / 4; + + camera2.aspect = insetWidth / insetHeight; + camera2.updateProjectionMatrix(); +} + +function animate() { + // main scene + + renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); + + renderer.autoClear = true; + + scene.backgroundNode = null; + + scene.name = 'Scene'; + + renderer.render(scene, camera); + + // inset scene + + const posY = window.innerHeight - insetHeight - 20; + + renderer.clearDepth(); // important! + + renderer.setScissorTest(true); + + renderer.setScissor(20, posY, insetWidth, insetHeight); + + renderer.setViewport(20, posY, insetWidth, insetHeight); + + camera2.position.copy(camera.position); + camera2.quaternion.copy(camera.quaternion); + + renderer.autoClear = false; + + scene.backgroundNode = backgroundNode; + + scene.name = 'Scene [ Scissor ]'; + + renderer.render(scene, camera2); + + renderer.setScissorTest(false); +} + +// + +function initGui() { + gui = renderer.inspector.createParameters('Settings'); + + const param = { + 'line type': 0, + 'width (px)': 5, + dashed: false, + 'dash scale': 1, + 'dash / gap': 1, + }; + + gui.add(param, 'line type', { LineGeometry: 0, 'gl.LINE': 1 }).onChange(function (val) { + switch (val) { + case 0: + wireframe.visible = true; + + wireframe1.visible = false; + + break; + + case 1: + wireframe.visible = false; + + wireframe1.visible = true; + + break; + } + }); + + gui.add(param, 'width (px)', 1, 10).onChange(function (val) { + matLine.linewidth = val; + }); + + gui.add(param, 'dashed').onChange(function (val) { + matLine.dashed = val; + wireframe1.material = val ? matLineDashed : matLineBasic; + }); + + gui.add(param, 'dash scale', 0.5, 1, 0.1).onChange(function (val) { + matLine.scale = val; + matLineDashed.scale = val; + }); + + gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { + switch (val) { + case 0: + matLine.dashSize = 2; + matLine.gapSize = 1; + + matLineDashed.dashSize = 2; + matLineDashed.gapSize = 1; + + break; + + case 1: + matLine.dashSize = 1; + matLine.gapSize = 1; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 1; + + break; + + case 2: + matLine.dashSize = 1; + matLine.gapSize = 2; + + matLineDashed.dashSize = 1; + matLineDashed.gapSize = 2; + + break; + } + }); +} diff --git a/examples-testing/examples/webgpu_loader_gltf.ts b/examples-testing/examples/webgpu_loader_gltf.ts new file mode 100644 index 000000000..6380bd903 --- /dev/null +++ b/examples-testing/examples/webgpu_loader_gltf.ts @@ -0,0 +1,183 @@ +import * as THREE from 'three/webgpu'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls; +let currentModel, mixer; +let currentLoadId = 0; + +const timer = new THREE.Timer(); + +init().then(render); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + //texture.minFilter = THREE.LinearMipmapLinearFilter; + //texture.generateMipmaps = true; + + scene.background = texture; + scene.environment = texture; + + // model + + fetch('https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json') + .then(response => response.json()) + .then(models => { + const gui = renderer.inspector.createParameters('Model'); + const modelNames = models.map(m => m.name); + const params = { model: 'DamagedHelmet' }; + + if (!modelNames.includes(params.model) && modelNames.length > 0) { + params.model = modelNames[0]; + } + + gui.add(params, 'model', modelNames).onChange(name => { + const modelInfo = models.find(m => m.name === name); + loadModel(modelInfo); + }); + + gui.add(scene, 'backgroundBlurriness', 0, 1); + + const initialModel = models.find(m => m.name === params.model); + if (initialModel) loadModel(initialModel); + }); + }); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + await renderer.init(); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2; + controls.maxDistance = 10; + controls.target.set(0, 0, -0.2); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function loadModel(modelInfo) { + const variants = modelInfo.variants; + const variant = variants['glTF-Binary'] || variants['glTF']; + const url = `https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/${modelInfo.name}/${variant.endsWith('.glb') ? 'glTF-Binary' : 'glTF'}/${variant}`; + + if (currentModel) { + currentModel.traverse(model => { + if (model.isMesh) { + model.geometry.dispose(); + model.material.dispose(); + + for (const value of Object.values(model.material)) { + if (value && value.isTexture) { + value.dispose(); + } + } + } + }); + + scene.remove(currentModel); + currentModel = null; + } + + if (mixer) { + mixer.stopAllAction(); + mixer = null; + } + + const loadId = ++currentLoadId; + + const loader = new GLTFLoader(); + loader.load(url, async function (gltf) { + if (loadId !== currentLoadId) return; + + currentModel = gltf.scene; + + // wait until the model can be added to the scene without blocking due to shader compilation + + await renderer.compileAsync(currentModel, camera, scene); + + if (loadId !== currentLoadId) return; + + scene.add(currentModel); + + fitCameraToSelection(camera, controls, currentModel); + + // animations + + if (gltf.animations.length > 0) { + mixer = new THREE.AnimationMixer(currentModel); + + for (const animation of gltf.animations) { + mixer.clipAction(animation).play(); + } + } + }); +} + +function fitCameraToSelection(camera, controls, selection, fitOffset = 1.3) { + const box = new THREE.Box3(); + box.setFromObject(selection); + + const size = box.getSize(new THREE.Vector3()); + const center = box.getCenter(new THREE.Vector3()); + + const maxSize = Math.max(size.x, size.y, size.z); + const fitHeightDistance = maxSize / (2 * Math.atan((Math.PI * camera.fov) / 360)); + // const fitWidthDistance = fitHeightDistance / camera.aspect; + // const distance = fitOffset * Math.max( fitHeightDistance, fitWidthDistance ); + const distance = fitOffset * fitHeightDistance; + + const direction = controls.target.clone().sub(camera.position).normalize().multiplyScalar(distance); + + controls.maxDistance = distance * 10; + controls.minDistance = distance / 10; + controls.target.copy(center); + + camera.near = distance / 100; + camera.far = distance * 100; + camera.updateProjectionMatrix(); + + camera.position.copy(controls.target).sub(direction); + + controls.update(); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + timer.update(); + + controls.update(); + + if (mixer) mixer.update(timer.getDelta()); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_gltf_anisotropy.ts b/examples-testing/examples/webgpu_loader_gltf_anisotropy.ts new file mode 100644 index 000000000..a3aa95e15 --- /dev/null +++ b/examples-testing/examples/webgpu_loader_gltf_anisotropy.ts @@ -0,0 +1,64 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +let renderer, scene, camera, controls; + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.35; + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.set(-0.35, -0.2, 0.35); + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, -0.08, 0.11); + controls.minDistance = 0.1; + controls.maxDistance = 2; + controls.update(); + + const hdrLoader = new UltraHDRLoader().setPath('textures/equirectangular/'); + const gltfLoader = new GLTFLoader().setPath('models/gltf/'); + + const [texture, gltf] = await Promise.all([ + hdrLoader.loadAsync('royal_esplanade_2k.hdr.jpg'), + gltfLoader.loadAsync('AnisotropyBarnLamp.glb'), + ]); + + // environment + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.backgroundBlurriness = 0.5; + scene.environment = texture; + + // model + + scene.add(gltf.scene); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_gltf_compressed.ts b/examples-testing/examples/webgpu_loader_gltf_compressed.ts new file mode 100644 index 000000000..d6d437517 --- /dev/null +++ b/examples-testing/examples/webgpu_loader_gltf_compressed.ts @@ -0,0 +1,69 @@ +import * as THREE from 'three/webgpu'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 20); + camera.position.set(2, 2, 2); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xeeeeee); + + //lights + + const light = new THREE.PointLight(0xffffff); + light.power = 1300; + camera.add(light); + scene.add(camera); + + //renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ReinhardToneMapping; + renderer.toneMappingExposure = 1; + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 3; + controls.maxDistance = 6; + controls.update(); + + const ktx2Loader = await new KTX2Loader().detectSupport(renderer); + + const loader = new GLTFLoader(); + loader.setKTX2Loader(ktx2Loader); + loader.setMeshoptDecoder(MeshoptDecoder); + loader.load('models/gltf/coffeemat.glb', function (gltf) { + const gltfScene = gltf.scene; + gltfScene.position.y = -0.8; + gltfScene.scale.setScalar(0.01); + + scene.add(gltfScene); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_gltf_dispersion.ts b/examples-testing/examples/webgpu_loader_gltf_dispersion.ts new file mode 100644 index 000000000..a2e815ddb --- /dev/null +++ b/examples-testing/examples/webgpu_loader_gltf_dispersion.ts @@ -0,0 +1,63 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 5); + camera.position.set(0.1, 0.05, 0.15); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ReinhardToneMapping; // TODO: Add THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1; + container.appendChild(renderer.domElement); + + const hdrTexture = await new HDRLoader() + .setPath('textures/equirectangular/') + .loadAsync('pedestrian_overpass_1k.hdr'); + hdrTexture.mapping = THREE.EquirectangularReflectionMapping; + + scene = new THREE.Scene(); + scene.backgroundBlurriness = 0.5; + scene.environment = hdrTexture; + scene.background = hdrTexture; + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/DispersionTest.glb'); + + scene.add(gltf.scene); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 0.1; + controls.maxDistance = 10; + controls.target.set(0, 0, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_gltf_iridescence.ts b/examples-testing/examples/webgpu_loader_gltf_iridescence.ts new file mode 100644 index 000000000..8007d5e65 --- /dev/null +++ b/examples-testing/examples/webgpu_loader_gltf_iridescence.ts @@ -0,0 +1,70 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let renderer, scene, camera, controls; + +init().catch(function (err) { + console.error(err); +}); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setAnimationLoop(render); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.05, 20); + camera.position.set(0.35, 0.05, 0.35); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = -0.5; + controls.target.set(0, 0.2, 0); + controls.update(); + + const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); + + const gltfLoader = new GLTFLoader().setPath('models/gltf/'); + + const [texture, gltf] = await Promise.all([ + hdrLoader.loadAsync('venice_sunset_1k.hdr'), + gltfLoader.loadAsync('IridescenceLamp.glb'), + ]); + + // environment + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + // model + + scene.add(gltf.scene); + + render(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + render(); +} + +function render() { + controls.update(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_gltf_sheen.ts b/examples-testing/examples/webgpu_loader_gltf_sheen.ts new file mode 100644 index 000000000..442edc7fb --- /dev/null +++ b/examples-testing/examples/webgpu_loader_gltf_sheen.ts @@ -0,0 +1,81 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); + camera.position.set(-0.75, 0.7, 1.25); + + scene = new THREE.Scene(); + //scene.add( new THREE.DirectionalLight( 0xffffff, 2 ) ); + + // model + + new GLTFLoader().setPath('models/gltf/').load('SheenChair.glb', function (gltf) { + scene.add(gltf.scene); + + const object = gltf.scene.getObjectByName('SheenChair_fabric'); + + const gui = renderer.inspector.createParameters('SheenChair_fabric'); + + gui.add(object.material, 'sheen', 0, 1); + }); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + scene.background = new THREE.Color(0xaaaaaa); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + //scene.backgroundBlurriness = 1; // @TODO: Needs PMREM + scene.environment = texture; + }); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 1; + controls.maxDistance = 10; + controls.target.set(0, 0.35, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + controls.update(); // required if damping enabled + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_gltf_transmission.ts b/examples-testing/examples/webgpu_loader_gltf_transmission.ts new file mode 100644 index 000000000..de3fa7909 --- /dev/null +++ b/examples-testing/examples/webgpu_loader_gltf_transmission.ts @@ -0,0 +1,83 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +let camera, scene, renderer, controls, timer, mixer; + +init(); + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(0, 0.4, 0.7); + + scene = new THREE.Scene(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.backgroundBlurriness = 0.35; + + scene.environment = texture; + + // model + + new GLTFLoader() + .setPath('models/gltf/') + .setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)) + .load('IridescentDishWithOlives.glb', function (gltf) { + mixer = new THREE.AnimationMixer(gltf.scene); + mixer.clipAction(gltf.animations[0]).play(); + + scene.add(gltf.scene); + }); + }); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setAnimationLoop(render); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + container.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = -0.75; + controls.enableDamping = true; + controls.minDistance = 0.5; + controls.maxDistance = 1; + controls.target.set(0, 0.1, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + timer.update(); + + if (mixer) mixer.update(timer.getDelta()); + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_materialx.ts b/examples-testing/examples/webgpu_loader_materialx.ts new file mode 100644 index 000000000..5b53bb90a --- /dev/null +++ b/examples-testing/examples/webgpu_loader_materialx.ts @@ -0,0 +1,300 @@ +import * as THREE from 'three/webgpu'; + +import { Fn, abs, fract, fwidth, length, max, saturate, smoothstep, vec4, positionWorld, float } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import * as MikkTSpace from 'three/addons/libs/mikktspace.module.js'; +import { computeMikkTSpaceTangents } from 'three/addons/utils/BufferGeometryUtils.js'; + +import { MaterialXLoader } from 'three/addons/loaders/MaterialXLoader.js'; +import { createStrictInterfaceValidator } from 'three/addons/loaders/materialx/MaterialXInterfaceValidation.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const SAMPLE_PATH = + 'https://raw.githubusercontent.com/materialx/MaterialX/main/resources/Materials/Examples/StandardSurface/'; +const LOCAL_SAMPLE_PATH = 'materialx/'; +const samples = [ + 'standard_surface_brass_tiled.mtlx', + 'standard_surface_brick_procedural.mtlx', + 'standard_surface_carpaint.mtlx', + //'standard_surface_chess_set.mtlx', + 'standard_surface_chrome.mtlx', + 'standard_surface_copper.mtlx', + //'standard_surface_default.mtlx', + //'standard_surface_glass.mtlx', + //'standard_surface_glass_tinted.mtlx', + 'standard_surface_gold.mtlx', + //'standard_surface_greysphere.mtlx', + //'standard_surface_greysphere_calibration.mtlx', + 'standard_surface_jade.mtlx', + //'standard_surface_look_brass_tiled.mtlx', + //'standard_surface_look_wood_tiled.mtlx', + 'standard_surface_marble_solid.mtlx', + 'standard_surface_metal_brushed.mtlx', + 'standard_surface_plastic.mtlx', + //'standard_surface_thin_film.mtlx', + 'standard_surface_velvet.mtlx', + 'standard_surface_wood_tiled.mtlx', +]; + +const localSamples = [ + 'standard_surface_heightnormal.mtlx', + 'standard_surface_conditional_if_float.mtlx', + 'standard_surface_image_transform.mtlx', + 'standard_surface_color3_vec3_cm_test.mtlx', + 'standard_surface_rotate2d_test.mtlx', + 'standard_surface_rotate3d_test.mtlx', + 'standard_surface_heighttonormal_normal_input.mtlx', + 'standard_surface_roughness_test.mtlx', + 'standard_surface_opacity_test.mtlx', + 'standard_surface_opacity_only_test.mtlx', + 'standard_surface_specular_test.mtlx', + 'standard_surface_ior_test.mtlx', + 'standard_surface_combined_test.mtlx', + 'standard_surface_texture_opacity_test.mtlx', + 'standard_surface_transmission_test.mtlx', + 'standard_surface_transmission_only_test.mtlx', + 'standard_surface_transmission_rough.mtlx', + 'standard_surface_thin_film_rainbow_test.mtlx', + 'standard_surface_thin_film_ior_clamp_test.mtlx', + 'standard_surface_sheen_test.mtlx', + 'gltf_pbr_glass_dispersion.mtlx', + 'open_pbr_surface_velvet.mtlx', + 'open_pbr_surface_pearl.mtlx', + 'open_pbr_surface_honey.mtlx', +]; + +let camera, scene, renderer; +let controls, prefab; +const models = []; +const strictInterfaceValidator = createStrictInterfaceValidator(); + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.LinearToneMapping; + renderer.toneMappingExposure = 0.5; + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 200); + camera.position.set(10, 10, 20); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + // Ground plane + + const material = new THREE.MeshBasicNodeMaterial(); + + const grid = Fn(([coord, lineWidth = float(0.01), dotSize = float(0.03)]) => { + // https://bgolus.medium.com/the-best-darn-grid-shader-yet-727f9278b9d8 + + const g = fract(coord); + const fw = fwidth(coord); + const gx = abs(g.x.sub(0.5)); + const gy = abs(g.y.sub(0.5)); + + const lineX = saturate(lineWidth.sub(gx).div(fw.x).add(0.5)); + const lineY = saturate(lineWidth.sub(gy).div(fw.y).add(0.5)); + const lines = max(lineX, lineY); + + const squareDist = max(gx, gy); + const aa = max(fw.x, fw.y); + const dots = smoothstep(dotSize.add(aa), dotSize.sub(aa), squareDist); + + return max(dots, lines); + }); + + const fade = Fn(([radius = float(10.0), falloff = float(1.0)]) => { + return smoothstep(radius, radius.sub(falloff), length(positionWorld)); + }); + + const gridColor = vec4(0.5, 0.5, 0.5, 1.0); + const baseColor = vec4(1.0, 1.0, 1.0, 0.0); + + material.colorNode = grid(positionWorld.xz, 0.007, 0.03).mix(baseColor, gridColor).mul(fade(30.0, 20.0)); + material.transparent = true; + + const plane = new THREE.Mesh(new THREE.CircleGeometry(40), material); + plane.rotation.x = -Math.PI / 2; + plane.renderOrder = -1; + scene.add(plane); + + // + + controls = new OrbitControls(camera); + controls.connect(renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2; + controls.maxDistance = 40; + + // + + new HDRLoader().setPath('textures/equirectangular/').load('san_giuseppe_bridge_2k.hdr', async texture => { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.environment = texture; + + prefab = (await new GLTFLoader().loadAsync('./models/gltf/ShaderBall.glb')).scene; + await computePrefabTangents(); + + for (const sample of samples) { + await addSample(sample, SAMPLE_PATH); + } + + for (const sample of localSamples) { + await addSample(sample, LOCAL_SAMPLE_PATH); + } + + addGUI(); + }); + + window.addEventListener('resize', onWindowResize); +} + +async function computePrefabTangents() { + await MikkTSpace.ready; + + prefab.traverse(function (node) { + if (node.isMesh === false) return; + + const geometry = node.geometry; + + if (geometry === undefined) return; + + if (geometry.hasAttribute('tangent')) return; + + if (geometry.hasAttribute('position') && geometry.hasAttribute('normal') && geometry.hasAttribute('uv')) { + computeMikkTSpaceTangents(geometry, MikkTSpace); + } + }); +} + +function updateModelsAlign() { + const COLUMN_COUNT = 6; + const DIST_X = 3; + const DIST_Z = 3; + + const lineCount = Math.floor(models.length / COLUMN_COUNT) - 1.5; + + const offsetX = DIST_X * (COLUMN_COUNT - 1) * -0.5; + const offsetZ = DIST_Z * lineCount * 0.5; + + for (let i = 0; i < models.length; i++) { + const model = models[i]; + + model.position.x = (i % COLUMN_COUNT) * DIST_X + offsetX; + model.position.z = Math.floor(i / COLUMN_COUNT) * -DIST_Z + offsetZ; + } +} + +function reportMaterialXLog(sample, materialName, log) { + if (log.length === 0) return; + + const label = materialName ? `"${materialName}"` : `"${sample}"`; + const errorCount = log.filter(entry => entry.severity === 'error').length; + const warningCount = log.filter(entry => entry.severity === 'warning').length; + console.groupCollapsed( + `THREE.MaterialXLoader: ${errorCount} error(s), ${warningCount} warning(s) for ${label} (${sample})`, + ); + + for (const entry of log) { + const nodeName = entry.nodeName ? ` [${entry.nodeName}]` : ''; + const style = entry.severity === 'warning' ? 'color: #c90' : 'color: #c00'; + console[entry.severity === 'warning' ? 'warn' : 'error']( + `%c${entry.severity}: ${entry.code}${nodeName}: ${entry.message}`, + style, + ); + } + + console.groupEnd(); +} + +async function addSample(sample, path) { + const model = prefab.clone(); + + models.push(model); + + scene.add(model); + + updateModelsAlign(); + + // + + const { materials, log } = await new MaterialXLoader().setPath(path).loadAsync(sample, { + uvSpace: 'top-left', + interfaceValidator: strictInterfaceValidator, + throwOnErrors: false, + }); + const material = Object.values(materials).pop(); + reportMaterialXLog(sample, material ? material.name : null, log); + + const calibrationMesh = model.getObjectByName('Calibration_Mesh'); + calibrationMesh.material = material; + + const previewMesh = model.getObjectByName('Preview_Mesh'); + previewMesh.material = material; + + if (material.transparent) { + calibrationMesh.renderOrder = 1; + previewMesh.renderOrder = 2; + } + + await renderer.compileAsync(model, camera, scene); +} + +function addGUI() { + const gui = renderer.inspector.createParameters('MaterialX Loader'); + + const API = { + showCalibrationMesh: true, + showPreviewMesh: true, + }; + + gui.add(API, 'showCalibrationMesh') + .name('Calibration Mesh') + .onChange(function (value) { + setVisibility('Calibration_Mesh', value); + }); + + gui.add(API, 'showPreviewMesh') + .name('Preview Mesh') + .onChange(function (value) { + setVisibility('Preview_Mesh', value); + }); +} + +function setVisibility(name, visible) { + scene.traverse(function (node) { + if (node.isMesh) { + if (node.name == name) node.visible = visible; + } + }); +} + +// + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + controls.update(); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_loader_texture_ktx2.ts b/examples-testing/examples/webgpu_loader_texture_ktx2.ts new file mode 100644 index 000000000..031495f06 --- /dev/null +++ b/examples-testing/examples/webgpu_loader_texture_ktx2.ts @@ -0,0 +1,186 @@ +import * as THREE from 'three'; + +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; + +let canvas, renderer; + +const scenes = []; + +const sections = [ + { + title: 'Uncompressed', + description: + 'Uncompressed formats (rgba8, rgba16, rgba32) load as THREE.DataTexture objects.' + + ' Lossless, easy to read/write, uncompressed on GPU, optionally compressed over the network.', + textures: [ + { path: '2d_rgba8.ktx2' }, + { path: '2d_rgba8_linear.ktx2' }, + { path: '2d_rgba16_linear.ktx2' }, + { path: '2d_rgba32_linear.ktx2' }, + { path: '2d_rgb9e5_linear.ktx2' }, + { path: '2d_r11g11b10_linear.ktx2' }, + ], + }, + { + title: 'Compressed', + description: + 'Compressed formats (ASTC, BCn, ...) load as THREE.CompressedTexture objects,' + + ' reducing memory cost. Requires native support on the device GPU: no single compressed' + + ' format is supported on every device.', + textures: [ + { path: '2d_astc4x4.ktx2' }, + { path: '2d_etc1.ktx2' }, + { path: '2d_etc2.ktx2' }, + { path: '2d_bc1.ktx2' }, + { path: '2d_bc3.ktx2' }, + { path: '2d_bc4.ktx2' }, + { path: '2d_bc5.ktx2' }, + { path: '2d_bc7.ktx2' }, + ], + }, + + { + title: 'Universal', + description: + 'Basis Universal textures are specialized intermediate formats supporting fast' + + ' runtime transcoding into other GPU texture compression formats. After transcoding,' + + ' universal textures can be used on any device at reduced memory cost.', + textures: [{ path: '2d_etc1s.ktx2' }, { path: '2d_uastc.ktx2' }], + }, +]; + +init(); + +async function init() { + canvas = document.getElementById('c'); + + renderer = new THREE.WebGPURenderer({ canvas, antialias: true, forceWebGL: false }); + renderer.setClearColor(0xffffff, 1); + renderer.setPixelRatio(window.devicePixelRatio); + + await renderer.init(); + + const loader = new KTX2Loader().setPath('textures/ktx2/').detectSupport(renderer); + + const geometry = flipY(new THREE.PlaneGeometry(1, 1)); + + const content = document.getElementById('content'); + + for (const section of sections) { + const sectionElement = document.createElement('section'); + + const sectionHeader = document.createElement('h2'); + sectionHeader.textContent = section.title; + sectionElement.appendChild(sectionHeader); + + const sectionDescription = document.createElement('p'); + sectionDescription.className = 'description'; + sectionDescription.textContent = section.description; + sectionElement.appendChild(sectionDescription); + + for (const { path, supported } of section.textures) { + const scene = new THREE.Scene(); + + // make a list item + const element = document.createElement('div'); + element.className = 'list-item'; + + const sceneElement = document.createElement('div'); + element.appendChild(sceneElement); + + const labelElement = document.createElement('div'); + labelElement.innerText = 'file: ' + path; + element.appendChild(labelElement); + + // the element that represents the area we want to render the scene + scene.userData.element = sceneElement; + sectionElement.appendChild(element); + + const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); + camera.position.z = 2; + scene.userData.camera = camera; + + try { + const texture = await loader.loadAsync(supported === false ? 'fail_load.ktx2' : path); + const mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ map: texture })); + + labelElement.innerText += '\ncolorSpace: ' + texture.colorSpace; + + scene.add(mesh); + scenes.push(scene); + } catch (e) { + console.error(`Failed to load ${path}`, e); + } + } + + content.appendChild(sectionElement); + } + + renderer.setAnimationLoop(animate); +} + +function updateSize() { + const width = canvas.clientWidth; + const height = canvas.clientHeight; + + if (canvas.width !== width || canvas.height !== height) { + renderer.setSize(width, height, false); + } +} + +// Rewrite UVs for `flipY=false` textures. + +function flipY(geometry) { + const uv = geometry.attributes.uv; + + for (let i = 0; i < uv.count; i++) { + uv.setY(i, 1 - uv.getY(i)); + } + + return geometry; +} + +function animate() { + updateSize(); + + canvas.style.transform = `translateY(${window.scrollY}px)`; + + renderer.setClearColor(0xffffff); + renderer.setScissorTest(false); + renderer.clear(); + + renderer.setClearColor(0xe0e0e0); + renderer.setScissorTest(true); + + scenes.forEach(function (scene) { + // get the element that is a place holder for where we want to + // draw the scene + const element = scene.userData.element; + + // get its position relative to the page's viewport + const rect = element.getBoundingClientRect(); + + // check if it's offscreen. If so skip it + if ( + rect.top < 0 || + rect.bottom > renderer.domElement.clientHeight || + rect.left < 0 || + rect.right > renderer.domElement.clientWidth + ) { + return; // it's off screen + } + + // set the viewport + const width = rect.right - rect.left; + const height = rect.bottom - rect.top; + const left = rect.left; + const top = rect.top; + + renderer.setViewport(left, top, width, height); + renderer.setScissor(left, top, width, height); + + const camera = scene.userData.camera; + + renderer.render(scene, camera); + }); +} diff --git a/examples-testing/examples/webgpu_materials_alphahash.ts b/examples-testing/examples/webgpu_materials_alphahash.ts new file mode 100644 index 000000000..264abcd99 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_alphahash.ts @@ -0,0 +1,130 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; + +import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; + +let camera, scene, renderer, controls, mesh, material, renderPipeline; + +const amount = parseInt(window.location.search.slice(1)) || 3; +const count = Math.pow(amount, 3); + +const color = new THREE.Color(); + +const params = { + alpha: 0.5, + alphaHash: true, +}; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(amount, amount, amount); + camera.lookAt(0, 0, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + const geometry = new THREE.IcosahedronGeometry(0.5, 3); + + material = new THREE.MeshStandardMaterial({ + color: 0xffffff, + alphaHash: params.alphaHash, + opacity: params.alpha, + }); + + mesh = new THREE.InstancedMesh(geometry, material, count); + + let i = 0; + const offset = (amount - 1) / 2; + + const matrix = new THREE.Matrix4(); + + for (let x = 0; x < amount; x++) { + for (let y = 0; y < amount; y++) { + for (let z = 0; z < amount; z++) { + matrix.setPosition(offset - x, offset - y, offset - z); + + mesh.setMatrixAt(i, matrix); + mesh.setColorAt(i, color.setHex(Math.random() * 0xffffff)); + + i++; + } + } + } + + scene.add(mesh); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + environment.dispose(); + + // + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + const scenePass = ssaaPass(scene, camera); + scenePass.sampleLevel = 3; + + renderPipeline.outputNode = scenePass; + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enablePan = false; + + // + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.add(params, 'alpha', 0, 1).onChange(onMaterialUpdate); + gui.add(params, 'alphaHash').onChange(onMaterialUpdate); + + const ssaaFolder = gui.addFolder('SSAA'); + ssaaFolder.add(scenePass, 'sampleLevel', 0, 4, 1); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onMaterialUpdate() { + material.opacity = params.alpha; + material.alphaHash = params.alphaHash; + material.transparent = !params.alphaHash; + material.depthWrite = params.alphaHash; + + material.needsUpdate = true; +} + +function animate() { + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_materials_arrays.ts b/examples-testing/examples/webgpu_materials_arrays.ts new file mode 100644 index 000000000..92b7a9c24 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_arrays.ts @@ -0,0 +1,185 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let renderer, scene, camera, controls; +let materials; + +const _a = new THREE.Vector3(), + _b = new THREE.Vector3(); + +init(); + +function init() { + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.shadowMap.enabled = true; + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222222); + + // camera + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-6, 7, 14); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.5, 0); + controls.minDistance = 5; + controls.maxDistance = 50; + controls.enableDamping = true; + controls.update(); + + // environment + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x0e696c); + scene.add(hemiLight); + + // lights + + const dirLight = new THREE.DirectionalLight(0xffffff, 6); + dirLight.position.set(5, 10, 6); + dirLight.castShadow = true; + dirLight.shadow.camera.left = -10; + dirLight.shadow.camera.right = 10; + dirLight.shadow.camera.top = 10; + dirLight.shadow.camera.bottom = -10; + dirLight.shadow.camera.far = 20; + dirLight.shadow.mapSize.set(2048, 2048); + dirLight.shadow.radius = 10; + scene.add(dirLight); + + // scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) ); + + // materials, one per paper color, shared across all solids + + const palette = [0xe4002b, 0xff7f11, 0xffd100, 0x00a651, 0x0072ce, 0x8a2be2]; + + materials = palette.map(color => new THREE.MeshStandardMaterial({ color, roughness: 0.8, side: THREE.DoubleSide })); + + const geometries = [ + makeHoleyGeometry(new THREE.TetrahedronGeometry(1.2), 3), // 4 faces, 1 triangle each + makeHoleyGeometry(new THREE.BoxGeometry(1.5, 1.5, 1.5), 6), // 6 faces, 2 triangles each (indexed) + makeHoleyGeometry(new THREE.OctahedronGeometry(1.2), 3), // 8 faces, 1 triangle each + makeHoleyGeometry(new THREE.DodecahedronGeometry(1.1), 9), // 12 faces, 3 triangles each + makeHoleyGeometry(new THREE.IcosahedronGeometry(1.1), 3), // 20 faces, 1 triangle each + ]; + + // table + + const table = new THREE.Mesh( + new THREE.BoxGeometry(17, 0.5, 17), + new THREE.MeshStandardMaterial({ color: 0x0e696c, roughness: 0.5 }), + ); + table.position.y = -0.25; + table.receiveShadow = true; + scene.add(table); + + // grid + + const order = [0, 1, 2, 3, 3, 4, 0, 1, 1, 2, 3, 4, 4, 0, 1, 2]; + + for (let i = 0; i < 16; i++) { + const row = Math.floor(i / 4); + const col = i % 4; + + const mesh = new THREE.Mesh(geometries[order[i]], materials); + mesh.castShadow = true; + + mesh.scale.setScalar(0.5 + row * 0.25); + mesh.position.set((col - 1.5) * 3.5, 0, (1.5 - row) * 3.5); + + mesh.position.y = -new THREE.Box3().setFromObject(mesh, true).min.y - 0.01; + + scene.add(mesh); + } + + // listeners + + window.addEventListener('resize', onWindowResize); +} + +// rebuilds a polyhedron with a hole cut into each polygon face, like an open paper model + +function makeHoleyGeometry(geometry, verticesPerFace, holeScale = 0.6) { + if (geometry.index !== null) geometry = geometry.toNonIndexed(); + + const position = geometry.getAttribute('position'); + + const positions = []; + const holey = new THREE.BufferGeometry(); + + for (let face = 0; face < position.count / verticesPerFace; face++) { + // collect the unique corner vertices of the face + + const corners = []; + const keys = new Set(); + + for (let i = 0; i < verticesPerFace; i++) { + const v = new THREE.Vector3().fromBufferAttribute(position, face * verticesPerFace + i); + const key = v.toArray().join(','); + + if (keys.has(key) === false) { + keys.add(key); + corners.push(v); + } + } + + // sort the corners counterclockwise around the face centroid + + const centroid = corners.reduce((c, v) => c.add(v), new THREE.Vector3()).divideScalar(corners.length); + + const normal = new THREE.Vector3() + .crossVectors(_a.subVectors(corners[1], corners[0]), _b.subVectors(corners[2], corners[0])) + .normalize(); + const tangent = new THREE.Vector3().subVectors(corners[0], centroid).normalize(); + const bitangent = new THREE.Vector3().crossVectors(normal, tangent); + + const angleOf = v => Math.atan2(_b.subVectors(v, centroid).dot(bitangent), _b.dot(tangent)); + corners.sort((p, q) => angleOf(p) - angleOf(q)); + + // bridge each outer edge with its scaled-down inner edge + + const inner = corners.map(v => new THREE.Vector3().lerpVectors(centroid, v, holeScale)); + + holey.addGroup(positions.length / 3, corners.length * 6, face % materials.length); + + for (let i = 0; i < corners.length; i++) { + const j = (i + 1) % corners.length; + + positions.push(...corners[i], ...corners[j], ...inner[j], ...corners[i], ...inner[j], ...inner[i]); + } + } + + holey.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + holey.computeVertexNormals(); + + return holey; +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_basic.ts b/examples-testing/examples/webgpu_materials_basic.ts new file mode 100644 index 000000000..6aca76c97 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_basic.ts @@ -0,0 +1,129 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +const spheres = []; + +let mouseX = 0; +let mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +const params = { + color: '#ffffff', + mapping: THREE.CubeReflectionMapping, + refractionRatio: 0.98, + transparent: false, + opacity: 1, +}; + +const mappings = { ReflectionMapping: THREE.CubeReflectionMapping, RefractionMapping: THREE.CubeRefractionMapping }; + +document.addEventListener('mousemove', onDocumentMouseMove); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.z = 3; + + const path = './textures/cube/pisa/'; + const format = '.png'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const textureCube = new THREE.CubeTextureLoader().load(urls); + + scene = new THREE.Scene(); + scene.background = textureCube; + + const geometry = new THREE.SphereGeometry(0.1, 32, 16); + const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); + + for (let i = 0; i < 500; i++) { + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = Math.random() * 10 - 5; + mesh.position.y = Math.random() * 10 - 5; + mesh.position.z = Math.random() * 10 - 5; + + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; + + scene.add(mesh); + + spheres.push(mesh); + } + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.addColor(params, 'color').onChange(value => material.color.set(value)); + gui.add(params, 'mapping', mappings).onChange(value => { + textureCube.mapping = value; + material.needsUpdate = true; + }); + gui.add(params, 'refractionRatio', 0, 1, 0.01).onChange(value => (material.refractionRatio = value)); + gui.add(params, 'transparent').onChange(value => { + material.transparent = value; + material.needsUpdate = true; + }); + gui.add(params, 'opacity', 0, 1, 0.01).onChange(value => (material.opacity = value)); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentMouseMove(event) { + mouseX = (event.clientX - windowHalfX) / 100; + mouseY = (event.clientY - windowHalfY) / 100; +} + +// + +function animate() { + const timer = 0.0001 * Date.now(); + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + for (let i = 0, il = spheres.length; i < il; i++) { + const sphere = spheres[i]; + + sphere.position.x = 5 * Math.cos(timer + i); + sphere.position.y = 5 * Math.sin(timer + i * 1.1); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts b/examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts new file mode 100644 index 000000000..6c66f9d35 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts @@ -0,0 +1,119 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container; + +let camera, scene, renderer; + +init(); + +// load customized cube texture +async function loadCubeTextureWithMipmaps() { + const path = 'textures/cube/angus/'; + const format = '.jpg'; + const mipmaps = []; + const maxLevel = 8; + + async function loadCubeTexture(urls) { + return new Promise(function (resolve) { + new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { + resolve(cubeTexture); + }); + }); + } + + // load mipmaps + const pendings = []; + + for (let level = 0; level <= maxLevel; ++level) { + const urls = []; + + for (let face = 0; face < 6; ++face) { + urls.push(path + 'cube_m0' + level + '_c0' + face + format); + } + + const mipmapLevel = level; + + pendings.push( + loadCubeTexture(urls).then(function (cubeTexture) { + mipmaps[mipmapLevel] = cubeTexture; + }), + ); + } + + await Promise.all(pendings); + + const customizedCubeTexture = mipmaps.shift(); + customizedCubeTexture.mipmaps = mipmaps; + customizedCubeTexture.colorSpace = THREE.SRGBColorSpace; + customizedCubeTexture.minFilter = THREE.LinearMipMapLinearFilter; + customizedCubeTexture.magFilter = THREE.LinearFilter; + customizedCubeTexture.generateMipmaps = false; + customizedCubeTexture.needsUpdate = true; + + return customizedCubeTexture; +} + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 500; + + scene = new THREE.Scene(); + + loadCubeTextureWithMipmaps().then(function (cubeTexture) { + // model + const sphere = new THREE.SphereGeometry(100, 128, 128); + + // manual mipmaps + let material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: cubeTexture }); + material.name = 'manual mipmaps'; + + let mesh = new THREE.Mesh(sphere, material); + mesh.position.set(100, 0, 0); + scene.add(mesh); + + // auto mipmaps + material = material.clone(); + material.name = 'auto mipmaps'; + + const autoCubeTexture = cubeTexture.clone(); + autoCubeTexture.mipmaps = []; + autoCubeTexture.generateMipmaps = true; + autoCubeTexture.needsUpdate = true; + + material.envMap = autoCubeTexture; + + mesh = new THREE.Mesh(sphere, material); + mesh.position.set(-100, 0, 0); + scene.add(mesh); + }); + + //renderer + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + //controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.minPolarAngle = Math.PI / 4; + controls.maxPolarAngle = Math.PI / 1.5; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_displacementmap.ts b/examples-testing/examples/webgpu_materials_displacementmap.ts new file mode 100644 index 000000000..17a01f324 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_displacementmap.ts @@ -0,0 +1,195 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; + +let camera, scene, renderer, controls; + +const settings = { + metalness: 1.0, + roughness: 0.4, + ambientIntensity: 0.2, + aoMapIntensity: 1.0, + envMapIntensity: 1.0, + displacementScale: 2.436143, // from original model + normalScale: 1.0, +}; + +let mesh, material; + +let pointLight, ambientLight; + +const height = 500; // of camera frustum + +let r = 0.0; + +init(); +initGui(); + +// Init gui +function initGui() { + const gui = renderer.inspector.createParameters('settings'); + + gui.add(settings, 'metalness', 0, 1).onChange(function (value) { + material.metalness = value; + }); + + gui.add(settings, 'roughness', 0, 1).onChange(function (value) { + material.roughness = value; + }); + + gui.add(settings, 'aoMapIntensity', 0, 1).onChange(function (value) { + material.aoMapIntensity = value; + }); + + gui.add(settings, 'ambientIntensity', 0, 1).onChange(function (value) { + ambientLight.intensity = value; + }); + + gui.add(settings, 'envMapIntensity', 0, 3).onChange(function (value) { + material.envMapIntensity = value; + }); + + gui.add(settings, 'displacementScale', 0, 3.0).onChange(function (value) { + material.displacementScale = value; + }); + + gui.add(settings, 'normalScale', -1, 1).onChange(function (value) { + material.normalScale.set(1, -1).multiplyScalar(value); + }); +} + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGPURenderer(); + renderer.setAnimationLoop(animate); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // + + scene = new THREE.Scene(); + + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera(-height * aspect, height * aspect, height, -height, 1, 10000); + camera.position.z = 1500; + scene.add(camera); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enableDamping = true; + + // lights + + ambientLight = new THREE.AmbientLight(0xffffff, settings.ambientIntensity); + scene.add(ambientLight); + + pointLight = new THREE.PointLight(0xff0000, 1.5, 0, 0); + pointLight.position.z = 2500; + scene.add(pointLight); + + const pointLight2 = new THREE.PointLight(0xff6666, 3, 0, 0); + camera.add(pointLight2); + + const pointLight3 = new THREE.PointLight(0x0000ff, 1.5, 0, 0); + pointLight3.position.x = -1000; + pointLight3.position.z = 1000; + scene.add(pointLight3); + + // env map + + const path = 'textures/cube/SwedishRoyalCastle/'; + const format = '.jpg'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const reflectionCube = new THREE.CubeTextureLoader().load(urls); + + // textures + + const textureLoader = new THREE.TextureLoader(); + const normalMap = textureLoader.load('models/obj/ninja/normal.png'); + const aoMap = textureLoader.load('models/obj/ninja/ao.jpg'); + const displacementMap = textureLoader.load('models/obj/ninja/displacement.jpg'); + + // material + + material = new THREE.MeshStandardNodeMaterial({ + color: 0xc1c1c1, + roughness: settings.roughness, + metalness: settings.metalness, + + normalMap: normalMap, + normalScale: new THREE.Vector2(1, -1), // why does the normal map require negation in this case? + + aoMap: aoMap, + aoMapIntensity: 1, + + displacementMap: displacementMap, + displacementScale: settings.displacementScale, + displacementBias: -0.428408, // from original model + + envMap: reflectionCube, + envMapIntensity: settings.envMapIntensity, + + side: THREE.DoubleSide, + }); + + // + + const loader = new OBJLoader(); + loader.load('models/obj/ninja/ninjaHead_Low.obj', function (group) { + const geometry = group.children[0].geometry; + geometry.center(); + + mesh = new THREE.Mesh(geometry, material); + mesh.scale.multiplyScalar(25); + scene.add(mesh); + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const aspect = window.innerWidth / window.innerHeight; + + camera.left = -height * aspect; + camera.right = height * aspect; + camera.top = height; + camera.bottom = -height; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + controls.update(); + + render(); +} + +function render() { + pointLight.position.x = 2500 * Math.cos(r); + pointLight.position.z = 2500 * Math.sin(r); + + r += 0.01; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_envmaps.ts b/examples-testing/examples/webgpu_materials_envmaps.ts new file mode 100644 index 000000000..6862caeed --- /dev/null +++ b/examples-testing/examples/webgpu_materials_envmaps.ts @@ -0,0 +1,132 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let controls, camera, scene, renderer; +let textureEquirec, textureCube; +let sphereMesh, sphereMaterial, params; + +init(); + +function init() { + // CAMERAS + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 2.5); + + // SCENE + + scene = new THREE.Scene(); + + // Textures + + const loader = new THREE.CubeTextureLoader(); + loader.setPath('textures/cube/Bridge2/'); + + textureCube = loader.load(['posx.jpg', 'negx.jpg', 'posy.jpg', 'negy.jpg', 'posz.jpg', 'negz.jpg']); + + const textureLoader = new THREE.TextureLoader(); + + textureEquirec = textureLoader.load('textures/2294472375_24a3b8ef46_o.jpg'); + textureEquirec.mapping = THREE.EquirectangularReflectionMapping; + textureEquirec.colorSpace = THREE.SRGBColorSpace; + + scene.background = textureCube; + + // + + const geometry = new THREE.IcosahedronGeometry(1, 15); + sphereMaterial = new THREE.MeshBasicMaterial({ envMap: textureCube }); + sphereMesh = new THREE.Mesh(geometry, sphereMaterial); + scene.add(sphereMesh); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1.5; + controls.maxDistance = 6; + + // + + params = { + Type: 'Cube', + Refraction: false, + backgroundRotationX: false, + backgroundRotationY: false, + backgroundRotationZ: false, + syncMaterial: false, + }; + + const gui = renderer.inspector.createParameters('Parameters'); + gui.add(params, 'Type', ['Cube', 'Equirectangular']).onChange(function (value) { + if (value === 'Cube') { + scene.background = textureCube; + + sphereMaterial.envMap = textureCube; + sphereMaterial.needsUpdate = true; + } else if (value === 'Equirectangular') { + scene.background = textureEquirec; + + sphereMaterial.envMap = textureEquirec; + sphereMaterial.needsUpdate = true; + } + }); + gui.add(params, 'Refraction').onChange(function (value) { + if (value) { + textureEquirec.mapping = THREE.EquirectangularRefractionMapping; + textureCube.mapping = THREE.CubeRefractionMapping; + } else { + textureEquirec.mapping = THREE.EquirectangularReflectionMapping; + textureCube.mapping = THREE.CubeReflectionMapping; + } + + sphereMaterial.needsUpdate = true; + }); + gui.add(params, 'backgroundRotationX'); + gui.add(params, 'backgroundRotationY'); + gui.add(params, 'backgroundRotationZ'); + gui.add(params, 'syncMaterial'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + if (params.backgroundRotationX) { + scene.backgroundRotation.x += 0.001; + } + + if (params.backgroundRotationY) { + scene.backgroundRotation.y += 0.001; + } + + if (params.backgroundRotationZ) { + scene.backgroundRotation.z += 0.001; + } + + if (params.syncMaterial) { + sphereMesh.material.envMapRotation.copy(scene.backgroundRotation); + } + + camera.lookAt(scene.position); + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_envmaps_bpcem.ts b/examples-testing/examples/webgpu_materials_envmaps_bpcem.ts new file mode 100644 index 000000000..f7fe4d644 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_envmaps_bpcem.ts @@ -0,0 +1,202 @@ +import * as THREE from 'three/webgpu'; +import { + bumpMap, + float, + getParallaxCorrectNormal, + pmremTexture, + reflectVector, + texture, + uniform, + vec3, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; +import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; + +let camera, scene, renderer; + +let controls, cubeCamera; + +let groundPlane, wallMat; + +init(); + +async function init() { + THREE.RectAreaLightNode.setLTC(RectAreaLightTexturesLib.init()); + + // scene + + scene = new THREE.Scene(); + + // camera + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(0, 200, -200); + + // cube camera for environment map + + const renderTarget = new THREE.CubeRenderTarget(512); + renderTarget.texture.type = THREE.HalfFloatType; + renderTarget.texture.minFilter = THREE.LinearMipmapLinearFilter; + renderTarget.texture.magFilter = THREE.LinearFilter; + renderTarget.texture.generateMipmaps = true; + renderTarget.texture.mapping = THREE.CubeReflectionMapping; + + cubeCamera = new THREE.CubeCamera(1, 1000, renderTarget); + cubeCamera.position.set(0, -100, 0); + + // ground floor ( with box projected environment mapping ) + + const loader = new THREE.TextureLoader(); + const rMap = loader.load('textures/lava/lavatile.jpg'); + rMap.wrapS = THREE.RepeatWrapping; + rMap.wrapT = THREE.RepeatWrapping; + rMap.repeat.set(2, 1); + + const roughnessUniform = uniform(0.25); + + const defaultMat = new THREE.MeshStandardNodeMaterial(); + defaultMat.envNode = pmremTexture(renderTarget.texture); + defaultMat.roughnessNode = texture(rMap).mul(roughnessUniform); + defaultMat.metalnessNode = float(1); + + const boxProjectedMat = new THREE.MeshStandardNodeMaterial(); + boxProjectedMat.envNode = pmremTexture( + renderTarget.texture, + getParallaxCorrectNormal(reflectVector, vec3(200, 200, 100), vec3(0, -50, 0)), + ); + boxProjectedMat.roughnessNode = texture(rMap).mul(roughnessUniform); + boxProjectedMat.metalnessNode = float(1); + + groundPlane = new THREE.Mesh(new THREE.PlaneGeometry(200, 100, 100), boxProjectedMat); + groundPlane.rotateX(-Math.PI / 2); + groundPlane.position.set(0, -49, 0); + scene.add(groundPlane); + + // walls + + const [diffuseTex, bumpTex] = await Promise.all([ + loader.loadAsync('textures/brick_diffuse.jpg'), + loader.loadAsync('textures/brick_bump.jpg'), + ]); + diffuseTex.colorSpace = THREE.SRGBColorSpace; + + wallMat = new THREE.MeshStandardNodeMaterial(); + + wallMat.colorNode = texture(diffuseTex); + wallMat.normalNode = bumpMap(texture(bumpTex), float(5)); + + const planeGeo = new THREE.PlaneGeometry(100, 100); + + const planeBack1 = new THREE.Mesh(planeGeo, wallMat); + planeBack1.position.z = -50; + planeBack1.position.x = -50; + scene.add(planeBack1); + + const planeBack2 = new THREE.Mesh(planeGeo, wallMat); + planeBack2.position.z = -50; + planeBack2.position.x = 50; + scene.add(planeBack2); + + const planeFront1 = new THREE.Mesh(planeGeo, wallMat); + planeFront1.position.z = 50; + planeFront1.position.x = -50; + planeFront1.rotateY(Math.PI); + scene.add(planeFront1); + + const planeFront2 = new THREE.Mesh(planeGeo, wallMat); + planeFront2.position.z = 50; + planeFront2.position.x = 50; + planeFront2.rotateY(Math.PI); + scene.add(planeFront2); + + const planeRight = new THREE.Mesh(planeGeo, wallMat); + planeRight.position.x = 100; + planeRight.rotateY(-Math.PI / 2); + scene.add(planeRight); + + const planeLeft = new THREE.Mesh(planeGeo, wallMat); + planeLeft.position.x = -100; + planeLeft.rotateY(Math.PI / 2); + scene.add(planeLeft); + + // area lights + + const width = 50; + const height = 50; + const intensity = 5; + + const blueRectLight = new THREE.RectAreaLight(0x9aaeff, intensity, width, height); + blueRectLight.position.set(-99, 5, 0); + blueRectLight.lookAt(0, 5, 0); + scene.add(blueRectLight); + + const blueRectLightHelper = new RectAreaLightHelper(blueRectLight, 0xffffff); + blueRectLight.add(blueRectLightHelper); + + const redRectLight = new THREE.RectAreaLight(0xf3aaaa, intensity, width, height); + redRectLight.position.set(99, 5, 0); + redRectLight.lookAt(0, 5, 0); + scene.add(redRectLight); + + const redRectLightHelper = new RectAreaLightHelper(redRectLight, 0xffffff); + redRectLight.add(redRectLightHelper); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + updateCubeMap(); + + window.addEventListener('resize', onWindowResize); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, -10, 0); + controls.maxDistance = 400; + controls.minDistance = 10; + controls.update(); + + // gui + + const gui = renderer.inspector.createParameters('Parameters'); + const params = { + 'box projected': true, + }; + gui.add(params, 'box projected').onChange(value => { + groundPlane.material = value ? boxProjectedMat : defaultMat; + }); + gui.add(roughnessUniform, 'value', 0, 1).name('roughness'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function updateCubeMap() { + groundPlane.visible = false; + + cubeCamera.position.copy(groundPlane.position); + + cubeCamera.update(renderer, scene); + + groundPlane.visible = true; +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts b/examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts new file mode 100644 index 000000000..489b04201 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts @@ -0,0 +1,160 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { getGroundProjectedNormal } from 'three/addons/tsl/utils/GroundedSkybox.js'; + +import { cubeTexture, float } from 'three/tsl'; + +const params = { + height: 15, + radius: 100, + enabled: true, +}; + +let camera, scene, renderer; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(-20, 7, 20); + camera.lookAt(0, 4, 0); + + scene = new THREE.Scene(); + + const hdrLoader = new HDRLoader(); + const envMap = await hdrLoader.loadAsync('textures/equirectangular/blouberg_sunrise_2_1k.hdr'); + envMap.mapping = THREE.EquirectangularReflectionMapping; + + scene.environment = envMap; + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + + const shadow = new THREE.TextureLoader().load('models/gltf/ferrari_ao.png'); + + loader.load('models/gltf/ferrari.glb', function (gltf) { + const bodyMaterial = new THREE.MeshPhysicalMaterial({ + color: 0x000000, + metalness: 1.0, + roughness: 0.8, + clearcoat: 1.0, + clearcoatRoughness: 0.2, + }); + + const detailsMaterial = new THREE.MeshStandardMaterial({ + color: 0xffffff, + metalness: 1.0, + roughness: 0.5, + }); + + const glassMaterial = new THREE.MeshPhysicalMaterial({ + color: 0xffffff, + metalness: 0.25, + roughness: 0, + transmission: 1.0, + }); + + const carModel = gltf.scene.children[0]; + carModel.scale.multiplyScalar(4); + carModel.rotation.y = Math.PI; + + carModel.getObjectByName('body').material = bodyMaterial; + + carModel.getObjectByName('rim_fl').material = detailsMaterial; + carModel.getObjectByName('rim_fr').material = detailsMaterial; + carModel.getObjectByName('rim_rr').material = detailsMaterial; + carModel.getObjectByName('rim_rl').material = detailsMaterial; + carModel.getObjectByName('trim').material = detailsMaterial; + + carModel.getObjectByName('glass').material = glassMaterial; + + // shadow + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(0.655 * 4, 1.3 * 4), + new THREE.MeshBasicMaterial({ + map: shadow, + blending: THREE.MultiplyBlending, + toneMapped: false, + transparent: true, + premultipliedAlpha: true, + }), + ); + mesh.rotation.x = -Math.PI / 2; + carModel.add(mesh); + + scene.add(carModel); + }); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // use a cube map to avoid visual artifacts at the skybox's poles + + const size = envMap.image.height; + const cubeRenderTarget = new THREE.CubeRenderTarget(size); + cubeRenderTarget.fromEquirectangularTexture(renderer, envMap); + const cubeMap = cubeRenderTarget.texture; + + // grounded skybox + + const geometry = new THREE.IcosahedronGeometry(1, 16); + const material = new THREE.MeshBasicNodeMaterial({ side: THREE.DoubleSide }); + material.colorNode = cubeTexture(cubeMap, getGroundProjectedNormal(float(params.radius), float(params.height))); + + const skybox = new THREE.Mesh(geometry, material); + skybox.scale.setScalar(params.radius); + scene.add(skybox); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2, 0); + controls.maxPolarAngle = THREE.MathUtils.degToRad(90); + controls.maxDistance = 80; + controls.minDistance = 20; + controls.enablePan = false; + controls.update(); + + window.addEventListener('resize', onWindowResize); + + const gui = renderer.inspector.createParameters('Parameters'); + gui.add(params, 'enabled') + .name('Grounded') + .onChange(function (value) { + if (value) { + scene.add(skybox); + scene.background = null; + } else { + scene.remove(skybox); + scene.background = scene.environment; + } + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_lightmap.ts b/examples-testing/examples/webgpu_materials_lightmap.ts new file mode 100644 index 000000000..081de95ac --- /dev/null +++ b/examples-testing/examples/webgpu_materials_lightmap.ts @@ -0,0 +1,105 @@ +import * as THREE from 'three/webgpu'; +import { vec4, color, positionLocal, mix } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container; +let camera, scene, renderer; + +const params = { + intensity: 1, +}; + +init(); + +async function init() { + const { innerWidth, innerHeight } = window; + + container = document.createElement('div'); + document.body.appendChild(container); + + // CAMERA + + camera = new THREE.PerspectiveCamera(40, innerWidth / innerHeight, 1, 10000); + camera.position.set(700, 200, -500); + + // SCENE + + scene = new THREE.Scene(); + + // LIGHTS + + const light = new THREE.DirectionalLight(0xd5deff); + light.position.x = 300; + light.position.y = 250; + light.position.z = -500; + scene.add(light); + + // SKYDOME + + const topColor = new THREE.Color().copy(light.color); + const bottomColor = new THREE.Color(0xffffff); + const offset = 400; + const exponent = 0.6; + + const h = positionLocal.add(offset).normalize().y; + + const skyMat = new THREE.MeshBasicNodeMaterial(); + skyMat.colorNode = vec4(mix(color(bottomColor), color(topColor), h.max(0.0).pow(exponent)), 1.0); + skyMat.side = THREE.BackSide; + + const sky = new THREE.Mesh(new THREE.SphereGeometry(4000, 32, 15), skyMat); + scene.add(sky); + + // MODEL + + const loader = new THREE.ObjectLoader(); + const object = await loader.loadAsync('models/json/lightmap/lightmap.json'); + scene.add(object); + + // RENDERER + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setAnimationLoop(animate); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(innerWidth, innerHeight); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // CONTROLS + + const controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = (0.9 * Math.PI) / 2; + controls.enableZoom = false; + + // GUI + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.add(params, 'intensity', 0, 1) + .name('Light Map Intensity') + .onChange(value => { + for (const material of object.material) { + material.lightMapIntensity = value; + } + }); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_matcap.ts b/examples-testing/examples/webgpu_materials_matcap.ts new file mode 100644 index 000000000..b72e65a07 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_matcap.ts @@ -0,0 +1,175 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; + +let mesh, renderer, scene, camera; + +const API = { + color: 0xffffff, // sRGB + exposure: 1.0, +}; + +init(); + +function init() { + // renderer + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // tone mapping + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = API.exposure; + + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); + camera.position.set(0, 0, 13); + + // controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + controls.enablePan = false; + + // matcap + const loaderEXR = new EXRLoader(); + const matcap = loaderEXR.load('textures/matcaps/040full.exr'); + + // normalmap + const loader = new THREE.TextureLoader(); + + const normalmap = loader.load('models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg'); + + // model + new GLTFLoader().load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { + mesh = gltf.scene.children[0]; + mesh.position.y = -0.25; + + mesh.material = new THREE.MeshMatcapNodeMaterial({ + color: new THREE.Color().setHex(API.color), + matcap: matcap, + normalMap: normalmap, + }); + + scene.add(mesh); + }); + + // gui + const gui = renderer.inspector.createParameters('Parameters'); + + gui.addColor(API, 'color') + .listen() + .onChange(function () { + mesh.material.color.set(API.color); + }); + + gui.add(API, 'exposure', 0, 2) + .listen() + .onChange(function () { + renderer.toneMappingExposure = API.exposure; + }); + + // drag 'n drop + initDragAndDrop(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); +} + +function animate() { + renderer.render(scene, camera); +} + +// +// drag and drop anywhere in document +// + +function updateMatcap(texture) { + if (mesh.material.matcap) { + mesh.material.matcap.dispose(); + } + + mesh.material.matcap = texture; + + texture.needsUpdate = true; + + mesh.material.needsUpdate = true; // because the color space can change +} + +function handleJPG(event) { + // PNG, WebP, AVIF, too + + function imgCallback(event) { + const texture = new THREE.Texture(event.target); + + texture.colorSpace = THREE.SRGBColorSpace; + + updateMatcap(texture); + } + + const img = new Image(); + + img.onload = imgCallback; + + img.src = event.target.result; +} + +function handleEXR(event) { + const loader = new EXRLoader(); + const texture = loader.createDataTexture(event.target.result); + + updateMatcap(texture); +} + +function loadFile(file) { + const filename = file.name; + const extension = filename.split('.').pop().toLowerCase(); + + if (extension === 'exr') { + const reader = new FileReader(); + + reader.addEventListener('load', function (event) { + handleEXR(event); + }); + + reader.readAsArrayBuffer(file); + } else { + // 'jpg', 'png' + + const reader = new FileReader(); + + reader.addEventListener('load', function (event) { + handleJPG(event); + }); + + reader.readAsDataURL(file); + } +} + +function initDragAndDrop() { + document.addEventListener('dragover', function (event) { + event.preventDefault(); + event.dataTransfer.dropEffect = 'copy'; + }); + + document.addEventListener('drop', function (event) { + event.preventDefault(); + + loadFile(event.dataTransfer.files[0]); + }); +} diff --git a/examples-testing/examples/webgpu_materials_retroreflection.ts b/examples-testing/examples/webgpu_materials_retroreflection.ts new file mode 100644 index 000000000..893b88cf7 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_retroreflection.ts @@ -0,0 +1,132 @@ +import * as THREE from 'three/webgpu'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let camera, scene, renderer; +let frontLight, bandMaterial; + +const params = { + retroreflective: true, + retroreflectivity: 1.0, + frontLightIntensity: 5.0, +}; + +init(); + +function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(4, 2.5, 6); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x11151d); + scene.add(camera); + + scene.add(new THREE.HemisphereLight(0xffffff, 0x223344, 0.8)); + + frontLight = new THREE.PointLight(0xffffff, params.frontLightIntensity, 18, 1.4); + camera.add(frontLight); + + createCone(); + + const grid = new THREE.GridHelper(8, 16, 0x344055, 0x202838); + scene.add(grid); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1.5, 0); + controls.update(); + + const gui = new GUI(); + gui.add(params, 'retroreflective').name('retroreflective').onChange(updateMaterial); + gui.add(params, 'retroreflectivity', 0, 1, 0.01).name('retroreflectivity').onChange(updateMaterial); + gui.add(params, 'frontLightIntensity', 0, 30, 0.1).name('front light intensity').onChange(updateMaterial); + + window.addEventListener('resize', onWindowResize); + + updateMaterial(); +} + +function createCone() { + const cone = new THREE.Group(); + scene.add(cone); + + const orangeMaterial = new THREE.MeshPhysicalNodeMaterial({ + color: 0xff6a00, + roughness: 0.45, + metalness: 0.0, + }); + + bandMaterial = new THREE.MeshPhysicalNodeMaterial({ + color: 0xf7f0d6, + roughness: 0.22, + metalness: 0.0, + retroreflectivity: params.retroreflectivity, + }); + + const base = new THREE.Mesh(new THREE.BoxGeometry(2.6, 0.24, 2.6), orangeMaterial); + base.position.y = 0.12; + cone.add(base); + + const bodyHeight = 3.2; + const bodyBottom = 0.24; + const bodyRadiusBottom = 1.0; + const bodyRadiusTop = 0.18; + + const body = new THREE.Mesh( + new THREE.CylinderGeometry(bodyRadiusTop, bodyRadiusBottom, bodyHeight, 96, 1, false), + orangeMaterial, + ); + body.position.y = bodyBottom + bodyHeight * 0.5; + cone.add(body); + + const bandHeight = 0.48; + const bandCenter = bodyBottom + bodyHeight * 0.52; + const bandBottom = bandCenter - bandHeight * 0.5; + const bandTop = bandCenter + bandHeight * 0.5; + const bandRadiusBottom = radiusAtHeight(bandBottom, bodyBottom, bodyHeight, bodyRadiusBottom, bodyRadiusTop) * 1.01; + const bandRadiusTop = radiusAtHeight(bandTop, bodyBottom, bodyHeight, bodyRadiusBottom, bodyRadiusTop) * 1.01; + + const band = new THREE.Mesh( + new THREE.CylinderGeometry(bandRadiusTop, bandRadiusBottom, bandHeight, 96, 1, true), + bandMaterial, + ); + band.position.y = bandCenter; + cone.add(band); +} + +function radiusAtHeight(y, bodyBottom, bodyHeight, radiusBottom, radiusTop) { + const t = THREE.MathUtils.clamp((y - bodyBottom) / bodyHeight, 0, 1); + return THREE.MathUtils.lerp(radiusBottom, radiusTop, t); +} + +function updateMaterial() { + bandMaterial.retroreflectivity = params.retroreflective ? params.retroreflectivity : 0; + frontLight.intensity = params.frontLightIntensity; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_sss.ts b/examples-testing/examples/webgpu_materials_sss.ts new file mode 100644 index 000000000..c76df99dc --- /dev/null +++ b/examples-testing/examples/webgpu_materials_sss.ts @@ -0,0 +1,153 @@ +import * as THREE from 'three/webgpu'; +import { texture, uniform, vec3 } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; + +let container; +let camera, scene, renderer; +let model; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 5000); + camera.position.set(0.0, 300, 400 * 4); + + scene = new THREE.Scene(); + + // Lights + + scene.add(new THREE.AmbientLight(0xc1c1c1)); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 0.03); + directionalLight.position.set(0.0, 0.5, 0.5).normalize(); + scene.add(directionalLight); + + const pointLight1 = new THREE.Mesh( + new THREE.SphereGeometry(4, 8, 8), + new THREE.MeshBasicMaterial({ color: 0xc1c1c1 }), + ); + pointLight1.add(new THREE.PointLight(0xc1c1c1, 4.0, 300, 0)); + scene.add(pointLight1); + pointLight1.position.x = 0; + pointLight1.position.y = -50; + pointLight1.position.z = 350; + + const pointLight2 = new THREE.Mesh( + new THREE.SphereGeometry(4, 8, 8), + new THREE.MeshBasicMaterial({ color: 0xc1c100 }), + ); + pointLight2.add(new THREE.PointLight(0xc1c100, 0.75, 500, 0)); + scene.add(pointLight2); + pointLight2.position.x = -100; + pointLight2.position.y = 20; + pointLight2.position.z = -260; + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + // + + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.inspector.domElement); + + // + + const controls = new OrbitControls(camera, container); + controls.minDistance = 500; + controls.maxDistance = 3000; + + window.addEventListener('resize', onWindowResize); + + initMaterial(); +} + +function initMaterial() { + const loader = new THREE.TextureLoader(); + const imgTexture = loader.load('models/fbx/white.jpg'); + imgTexture.colorSpace = THREE.SRGBColorSpace; + + const thicknessTexture = loader.load('models/fbx/bunny_thickness.jpg'); + imgTexture.wrapS = imgTexture.wrapT = THREE.RepeatWrapping; + + const material = new THREE.MeshSSSNodeMaterial(); + material.color = new THREE.Color(1.0, 0.2, 0.2); + material.roughness = 0.3; + material.thicknessColorNode = texture(thicknessTexture).mul(vec3(0.5, 0.3, 0.0)); + material.thicknessDistortionNode = uniform(0.1); + material.thicknessAmbientNode = uniform(0.4); + material.thicknessAttenuationNode = uniform(0.8); + material.thicknessPowerNode = uniform(2.0); + material.thicknessScaleNode = uniform(16.0); + + // LOADER + + const loaderFBX = new FBXLoader(); + loaderFBX.load('models/fbx/stanford-bunny.fbx', function (object) { + model = object.children[0]; + model.position.set(0, 0, 10); + model.scale.setScalar(1); + model.material = material; + scene.add(model); + }); + + initGUI(material); +} + +function initGUI(material) { + const gui = renderer.inspector.createParameters('Parameters'); + + const ThicknessControls = function () { + this.distortion = material.thicknessDistortionNode.value; + this.ambient = material.thicknessAmbientNode.value; + this.attenuation = material.thicknessAttenuationNode.value; + this.power = material.thicknessPowerNode.value; + this.scale = material.thicknessScaleNode.value; + }; + + const thicknessControls = new ThicknessControls(); + + gui.add(thicknessControls, 'distortion', 0.01, 1, 0.01).onChange(function () { + material.thicknessDistortionNode.value = thicknessControls.distortion; + }); + + gui.add(thicknessControls, 'ambient', 0.01, 5.0, 0.05).onChange(function () { + material.thicknessAmbientNode.value = thicknessControls.ambient; + }); + + gui.add(thicknessControls, 'attenuation', 0.01, 5.0, 0.05).onChange(function () { + material.thicknessAttenuationNode.value = thicknessControls.attenuation; + }); + + gui.add(thicknessControls, 'power', 0.01, 16.0, 0.1).onChange(function () { + material.thicknessPowerNode.value = thicknessControls.power; + }); + + gui.add(thicknessControls, 'scale', 0.01, 50.0, 0.1).onChange(function () { + material.thicknessScaleNode.value = thicknessControls.scale; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + if (model) model.rotation.y = performance.now() / 5000; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_texture_html.ts b/examples-testing/examples/webgpu_materials_texture_html.ts new file mode 100644 index 000000000..922c63a1d --- /dev/null +++ b/examples-testing/examples/webgpu_materials_texture_html.ts @@ -0,0 +1,95 @@ +import * as THREE from 'three'; +import { installHtmlInCanvasPolyfill } from 'three-html-render/polyfill'; +import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { InteractionManager } from 'three/addons/interaction/InteractionManager.js'; + +if (!('requestPaint' in HTMLCanvasElement.prototype)) { + installHtmlInCanvasPolyfill(); + info.innerHTML += + '
HTML-in-Canvas API not available. Using polyfill.'; +} + +let camera, scene, renderer, mesh, interactions; + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + await renderer.init(); + + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.z = 500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xaaaaaa); + scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.02).texture; + + // HTML element + + const element = document.createElement('div'); + element.id = 'draw_element'; + element.innerHTML = ` + Hello world!
I'm multi-line, formatted, + rotated text with emoji (😀), RTL text + من فارسی صحبت میکنم, + vertical text, +

+ 这是垂直文本 +

+ an inline image (), and + + + + SVG + + ! +
+ + + `; + + const geometry = new RoundedBoxGeometry(200, 200, 200, 10, 10); + + const material = new THREE.MeshStandardMaterial({ roughness: 0, metalness: 0.5 }); + material.map = new THREE.HTMLTexture(element); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // Interaction + + interactions = new InteractionManager(); + interactions.connect(renderer, camera); + interactions.add(mesh); + + // Button click handler + + element.querySelector('button').addEventListener('click', function () { + this.textContent = 'Clicked!'; + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(time) { + mesh.rotation.x = Math.sin(time * 0.0005) * 0.5; + mesh.rotation.y = Math.cos(time * 0.0008) * 0.5; + + interactions.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_texture_manualmipmap.ts b/examples-testing/examples/webgpu_materials_texture_manualmipmap.ts new file mode 100644 index 000000000..090372729 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_texture_manualmipmap.ts @@ -0,0 +1,170 @@ +import * as THREE from 'three/webgpu'; + +const SCREEN_WIDTH = window.innerWidth; +const SCREEN_HEIGHT = window.innerHeight; + +let container; + +let camera, scene1, scene2, renderer; + +let mouseX = 0, + mouseY = 0; + +const windowHalfX = window.innerWidth / 2; +const windowHalfY = window.innerHeight / 2; + +init(); + +async function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000); + camera.position.z = 1500; + + scene1 = new THREE.Scene(); + scene1.background = new THREE.Color(0x000000); + scene1.fog = new THREE.Fog(0x000000, 1500, 4000); + + scene2 = new THREE.Scene(); + scene2.background = new THREE.Color(0x000000); + scene2.fog = new THREE.Fog(0x000000, 1500, 4000); + + // GROUND + + const canvas = mipmap(128, '#f00'); + const textureCanvas1 = new THREE.CanvasTexture(canvas); + textureCanvas1.mipmaps[0] = canvas; + textureCanvas1.mipmaps[1] = mipmap(64, '#0f0'); + textureCanvas1.mipmaps[2] = mipmap(32, '#00f'); + textureCanvas1.mipmaps[3] = mipmap(16, '#400'); + textureCanvas1.mipmaps[4] = mipmap(8, '#040'); + textureCanvas1.mipmaps[5] = mipmap(4, '#004'); + textureCanvas1.mipmaps[6] = mipmap(2, '#044'); + textureCanvas1.mipmaps[7] = mipmap(1, '#404'); + textureCanvas1.colorSpace = THREE.SRGBColorSpace; + textureCanvas1.repeat.set(1000, 1000); + textureCanvas1.wrapS = THREE.RepeatWrapping; + textureCanvas1.wrapT = THREE.RepeatWrapping; + + const textureCanvas2 = textureCanvas1.clone(); + textureCanvas2.magFilter = THREE.NearestFilter; + textureCanvas2.minFilter = THREE.NearestMipmapNearestFilter; + + const materialCanvas1 = new THREE.MeshBasicMaterial({ map: textureCanvas1 }); + const materialCanvas2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: textureCanvas2 }); + + const geometry = new THREE.PlaneGeometry(100, 100); + + const meshCanvas1 = new THREE.Mesh(geometry, materialCanvas1); + meshCanvas1.rotation.x = -Math.PI / 2; + meshCanvas1.scale.set(1000, 1000, 1000); + + const meshCanvas2 = new THREE.Mesh(geometry, materialCanvas2); + meshCanvas2.rotation.x = -Math.PI / 2; + meshCanvas2.scale.set(1000, 1000, 1000); + + scene1.add(meshCanvas1); + scene2.add(meshCanvas2); + + // PAINTING + + const texturePainting1 = await new THREE.TextureLoader().loadAsync( + 'textures/758px-Canestra_di_frutta_(Caravaggio).jpg', + ); + const texturePainting2 = texturePainting1.clone(); + + texturePainting1.colorSpace = THREE.SRGBColorSpace; + texturePainting2.colorSpace = THREE.SRGBColorSpace; + + texturePainting1.minFilter = texturePainting1.magFilter = THREE.LinearFilter; + texturePainting2.minFilter = texturePainting2.magFilter = THREE.NearestFilter; + + const materialPainting1 = new THREE.MeshBasicMaterial({ color: 0xffffff, map: texturePainting1 }); + const materialPainting2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: texturePainting2 }); + + const geometryPainting = new THREE.PlaneGeometry(100, 100); + const mesh1 = new THREE.Mesh(geometryPainting, materialPainting1); + const mesh2 = new THREE.Mesh(geometryPainting, materialPainting2); + + addPainting(scene1, mesh1); + addPainting(scene2, mesh2); + + function addPainting(zscene, zmesh) { + const image = texturePainting1.image; + + zmesh.scale.x = image.width / 100; + zmesh.scale.y = image.height / 100; + + zscene.add(zmesh); + + const meshFrame = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000 })); + meshFrame.position.z = -10.0; + meshFrame.scale.x = (1.1 * image.width) / 100; + meshFrame.scale.y = (1.1 * image.height) / 100; + zscene.add(meshFrame); + + const meshShadow = new THREE.Mesh( + geometry, + new THREE.MeshBasicMaterial({ color: 0x000000, opacity: 0.75, transparent: true }), + ); + meshShadow.position.y = (-1.1 * image.height) / 2; + meshShadow.position.z = (-1.1 * image.height) / 2; + meshShadow.rotation.x = -Math.PI / 2; + meshShadow.scale.x = (1.1 * image.width) / 100; + meshShadow.scale.y = (1.1 * image.height) / 100; + zscene.add(meshShadow); + + const floorHeight = (-1.117 * image.height) / 2; + meshCanvas1.position.y = meshCanvas2.position.y = floorHeight; + } + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(animate); + renderer.autoClear = false; + + renderer.domElement.style.position = 'relative'; + container.appendChild(renderer.domElement); + + document.addEventListener('mousemove', onDocumentMouseMove); +} + +function mipmap(size, color) { + const imageCanvas = document.createElement('canvas'); + const context = imageCanvas.getContext('2d'); + + imageCanvas.width = imageCanvas.height = size; + + context.fillStyle = '#444'; + context.fillRect(0, 0, size, size); + + context.fillStyle = color; + context.fillRect(0, 0, size / 2, size / 2); + context.fillRect(size / 2, size / 2, size / 2, size / 2); + return imageCanvas; +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +function animate() { + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-(mouseY - 200) - camera.position.y) * 0.05; + + camera.lookAt(scene1.position); + + renderer.clear(); + renderer.setScissorTest(true); + + renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene1, camera); + + renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene2, camera); + + renderer.setScissorTest(false); +} diff --git a/examples-testing/examples/webgpu_materials_toon.ts b/examples-testing/examples/webgpu_materials_toon.ts new file mode 100644 index 000000000..78cb62ed6 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_toon.ts @@ -0,0 +1,149 @@ +import * as THREE from 'three/webgpu'; +import { toonOutlinePass } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +let container; + +let camera, scene, renderer, renderPipeline; +let particleLight; + +const loader = new FontLoader(); +loader.load('fonts/gentilis_regular.typeface.json', function (font) { + init(font); +}); + +function init(font) { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2500); + camera.position.set(0.0, 400, 400 * 3.5); + + // + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x444488); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // + + renderPipeline = new THREE.RenderPipeline(renderer); + + renderPipeline.outputNode = toonOutlinePass(scene, camera); + + // Materials + + const cubeWidth = 400; + const numberOfSpheresPerSide = 5; + const sphereRadius = (cubeWidth / numberOfSpheresPerSide) * 0.8 * 0.5; + const stepSize = 1.0 / numberOfSpheresPerSide; + + const geometry = new THREE.SphereGeometry(sphereRadius, 32, 16); + + for (let alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex++) { + const colors = new Uint8Array(alphaIndex + 2); + + for (let c = 0; c <= colors.length; c++) { + colors[c] = (c / colors.length) * 256; + } + + const gradientMap = new THREE.DataTexture(colors, colors.length, 1, THREE.RedFormat); + gradientMap.needsUpdate = true; + + for (let beta = 0; beta <= 1.0; beta += stepSize) { + for (let gamma = 0; gamma <= 1.0; gamma += stepSize) { + // basic monochromatic energy preservation + const diffuseColor = new THREE.Color() + .setHSL(alpha, 0.5, gamma * 0.5 + 0.1) + .multiplyScalar(1 - beta * 0.2); + + const material = new THREE.MeshToonNodeMaterial({ + color: diffuseColor, + gradientMap: gradientMap, + }); + + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = alpha * 400 - 200; + mesh.position.y = beta * 400 - 200; + mesh.position.z = gamma * 400 - 200; + + scene.add(mesh); + } + } + } + + function addLabel(name, location) { + const textGeo = new TextGeometry(name, { + font: font, + + size: 20, + depth: 1, + curveSegments: 1, + }); + + const textMaterial = new THREE.MeshBasicNodeMaterial(); + const textMesh = new THREE.Mesh(textGeo, textMaterial); + textMesh.position.copy(location); + scene.add(textMesh); + } + + addLabel('-gradientMap', new THREE.Vector3(-350, 0, 0)); + addLabel('+gradientMap', new THREE.Vector3(350, 0, 0)); + + addLabel('-diffuse', new THREE.Vector3(0, 0, -300)); + addLabel('+diffuse', new THREE.Vector3(0, 0, 300)); + + particleLight = new THREE.Mesh( + new THREE.SphereGeometry(4, 8, 8), + new THREE.MeshBasicNodeMaterial({ color: 0xffffff }), + ); + scene.add(particleLight); + + // Lights + + scene.add(new THREE.AmbientLight(0xc1c1c1, 3)); + + const pointLight = new THREE.PointLight(0xffffff, 2, 800, 0); + particleLight.add(pointLight); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 200; + controls.maxDistance = 2000; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + const timer = Date.now() * 0.00025; + + particleLight.position.x = Math.sin(timer * 7) * 300; + particleLight.position.y = Math.cos(timer * 5) * 400; + particleLight.position.z = Math.cos(timer * 3) * 300; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_materials_transmission.ts b/examples-testing/examples/webgpu_materials_transmission.ts new file mode 100644 index 000000000..310d979d5 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_transmission.ts @@ -0,0 +1,173 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +const params = { + color: 0xffffff, + transmission: 1, + opacity: 1, + metalness: 0, + roughness: 0, + ior: 1.5, + thickness: 0.01, + specularIntensity: 1, + specularColor: 0xffffff, + envMapIntensity: 1, + lightIntensity: 1, + exposure: 1, +}; + +let camera, scene, renderer; + +let mesh; + +const hdrEquirect = new UltraHDRLoader() + .setPath('textures/equirectangular/') + .load('royal_esplanade_2k.hdr.jpg', function () { + hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; + + init(); + }); + +function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = params.exposure; + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2000); + camera.position.set(0, 0, 120); + + // + + scene.background = hdrEquirect; + + // + + const geometry = new THREE.SphereGeometry(20, 64, 32); + + const texture = new THREE.CanvasTexture(generateTexture()); + texture.magFilter = THREE.NearestFilter; + texture.wrapT = THREE.RepeatWrapping; + texture.wrapS = THREE.RepeatWrapping; + texture.repeat.set(1, 3.5); + + const material = new THREE.MeshPhysicalMaterial({ + color: params.color, + metalness: params.metalness, + roughness: params.roughness, + ior: params.ior, + alphaMap: texture, + envMap: hdrEquirect, + envMapIntensity: params.envMapIntensity, + transmission: params.transmission, // use material.transmission for glass materials + specularIntensity: params.specularIntensity, + specularColor: params.specularColor, + opacity: params.opacity, + side: THREE.DoubleSide, + transparent: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 10; + controls.maxDistance = 150; + + window.addEventListener('resize', onWindowResize); + + // + + const gui = renderer.inspector.createParameters('Settings'); + + gui.addColor(params, 'color').onChange(function () { + material.color.set(params.color); + }); + + gui.add(params, 'transmission', 0, 1, 0.01).onChange(function () { + material.transmission = params.transmission; + }); + + gui.add(params, 'opacity', 0, 1, 0.01).onChange(function () { + material.opacity = params.opacity; + }); + + gui.add(params, 'metalness', 0, 1, 0.01).onChange(function () { + material.metalness = params.metalness; + }); + + gui.add(params, 'roughness', 0, 1, 0.01).onChange(function () { + material.roughness = params.roughness; + }); + + gui.add(params, 'ior', 1, 2, 0.01).onChange(function () { + material.ior = params.ior; + }); + + gui.add(params, 'thickness', 0, 5, 0.01).onChange(function () { + material.thickness = params.thickness; + }); + + gui.add(params, 'specularIntensity', 0, 1, 0.01) + .name('specular intensity') + .onChange(function () { + material.specularIntensity = params.specularIntensity; + }); + + gui.addColor(params, 'specularColor') + .name('specular color') + .onChange(function () { + material.specularColor.set(params.specularColor); + }); + + gui.add(params, 'envMapIntensity', 0, 1, 0.01) + .name('envMap intensity') + .onChange(function () { + material.envMapIntensity = params.envMapIntensity; + }); + + gui.add(params, 'exposure', 0, 1, 0.01).onChange(function () { + renderer.toneMappingExposure = params.exposure; + }); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +// + +function generateTexture() { + const canvas = document.createElement('canvas'); + canvas.width = 2; + canvas.height = 2; + + const context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 1, 2, 1); + + return canvas; +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materials_video.ts b/examples-testing/examples/webgpu_materials_video.ts new file mode 100644 index 000000000..084030e44 --- /dev/null +++ b/examples-testing/examples/webgpu_materials_video.ts @@ -0,0 +1,179 @@ +import * as THREE from 'three/webgpu'; + +let container; + +let camera, scene, renderer; + +let video, texture, material, mesh; + +let mouseX = 0; +let mouseY = 0; + +let windowHalfX = window.innerWidth / 2; +let windowHalfY = window.innerHeight / 2; + +let cube_count; + +const meshes = [], + materials = [], + xgrid = 20, + ygrid = 10; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 500; + + scene = new THREE.Scene(); + + const light = new THREE.DirectionalLight(0xffffff, 7); + light.position.set(0.5, 1, 1).normalize(); + scene.add(light); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + video = document.getElementById('video'); + video.play(); + video.addEventListener('play', function () { + this.currentTime = 3; + }); + + texture = new THREE.VideoTexture(video); + texture.colorSpace = THREE.SRGBColorSpace; + + // + + let i, j, ox, oy, geometry; + + const ux = 1 / xgrid; + const uy = 1 / ygrid; + + const xsize = 480 / xgrid; + const ysize = 204 / ygrid; + + const parameters = { color: 0xffffff, map: texture }; + + cube_count = 0; + + for (i = 0; i < xgrid; i++) { + for (j = 0; j < ygrid; j++) { + ox = i; + oy = j; + + geometry = new THREE.BoxGeometry(xsize, ysize, xsize); + + change_uvs(geometry, ux, uy, ox, oy); + + materials[cube_count] = new THREE.MeshPhongMaterial(parameters); + + material = materials[cube_count]; + + material.hue = i / xgrid; + material.saturation = 1 - j / ygrid; + + material.color.setHSL(material.hue, material.saturation, 0.5); + + mesh = new THREE.Mesh(geometry, material); + + mesh.position.x = (i - xgrid / 2) * xsize; + mesh.position.y = (j - ygrid / 2) * ysize; + mesh.position.z = 0; + + mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; + + scene.add(mesh); + + mesh.dx = 0.001 * (0.5 - Math.random()); + mesh.dy = 0.001 * (0.5 - Math.random()); + + meshes[cube_count] = mesh; + + cube_count += 1; + } + } + + document.addEventListener('mousemove', onDocumentMouseMove); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + windowHalfX = window.innerWidth / 2; + windowHalfY = window.innerHeight / 2; + + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function change_uvs(geometry, unitx, unity, offsetx, offsety) { + const uvs = geometry.attributes.uv.array; + + for (let i = 0; i < uvs.length; i += 2) { + uvs[i] = (uvs[i] + offsetx) * unitx; + uvs[i + 1] = (uvs[i + 1] + offsety) * unity; + } +} + +function onDocumentMouseMove(event) { + mouseX = event.clientX - windowHalfX; + mouseY = (event.clientY - windowHalfY) * 0.3; +} + +// + +let h, + counter = 1; + +function render() { + const time = Date.now() * 0.00005; + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y += (-mouseY - camera.position.y) * 0.05; + + camera.lookAt(scene.position); + + for (let i = 0; i < cube_count; i++) { + material = materials[i]; + + h = ((360 * (material.hue + time)) % 360) / 360; + material.color.setHSL(h, material.saturation, 0.5); + } + + if (counter % 1000 > 200) { + for (let i = 0; i < cube_count; i++) { + mesh = meshes[i]; + + mesh.rotation.x += 10 * mesh.dx; + mesh.rotation.y += 10 * mesh.dy; + + mesh.position.x -= 150 * mesh.dx; + mesh.position.y += 150 * mesh.dy; + mesh.position.z += 300 * mesh.dx; + } + } + + if (counter % 1000 === 0) { + for (let i = 0; i < cube_count; i++) { + mesh = meshes[i]; + + mesh.dx *= -1; + mesh.dy *= -1; + } + } + + counter++; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_materialx_noise.ts b/examples-testing/examples/webgpu_materialx_noise.ts new file mode 100644 index 000000000..2edfe8b4d --- /dev/null +++ b/examples-testing/examples/webgpu_materialx_noise.ts @@ -0,0 +1,355 @@ +import * as THREE from 'three/webgpu'; +import { + Fn, + add, + dot, + element, + float, + floor, + int, + mix, + mul, + normalWorld, + sub, + time, + uv, + vec2, + vec3, + mx_cell_noise_float, + mx_fractal_noise_vec3, + mx_modulo, + mx_noise_vec3, + mx_unifiednoise2d, + mx_unifiednoise3d, + mx_worley_noise_float_2d, + mx_worley_noise_float_3d, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; +import { mxHextileComputeBlendWeights, mxHextileCoord } from 'three/addons/loaders/materialx/MaterialXHextile.js'; + +let container; + +let camera, scene, renderer; + +let particleLight; +let group; +const spheres = []; + +init(); + +async function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 190; + + scene = new THREE.Scene(); + + group = new THREE.Group(); + scene.add(group); + + const [hdrTexture, font] = await Promise.all([ + new HDRCubeTextureLoader() + .setPath('textures/cube/pisaHDR/') + .loadAsync(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']), + new FontLoader().loadAsync('fonts/helvetiker_regular.typeface.json'), + ]); + + const geometry = new THREE.SphereGeometry(5, 64, 32); + const labelMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff }); + + const position2D = uv(0) + .mul(12) + .add(vec2(time.mul(0.35), time.mul(0.19))); + const position3D = normalWorld.mul(4).add(vec3(time.mul(0.35), time.mul(0.19), time.mul(0.27))); + const fractal2D = vec3(position2D.x, position2D.y, 0).mul(0.35); + const fractal3D = position3D.mul(0.35); + const unifiedOffset2D = vec2(time.mul(0.35), time.mul(0.19)); + const unifiedOffset3D = vec3(time.mul(0.35), time.mul(0.19), time.mul(0.27)); + const unifiedNoise3D = ( + noiseType, + position, + freq, + offset, + jitter = 1, + outmin = 0, + outmax = 1, + clampoutput = false, + octaves = 1, + lacunarity = 2, + diminish = 0.5, + style = 0, + ) => + Fn(() => + mx_unifiednoise3d( + noiseType, + position, + freq, + offset, + jitter, + outmin, + outmax, + clampoutput, + octaves, + lacunarity, + diminish, + style, + ), + )(); + const textileTexcoord = (speedX, speedY) => + uv(0) + .mul(3) + .add(vec2(time.mul(speedX), time.mul(speedY))); + const checkerboard = (color1, color2, uvtiling, uvoffset, texcoord) => { + const tiledUv = sub(mul(texcoord, uvtiling), uvoffset); + const checkerMix = mx_modulo(dot(floor(tiledUv), vec2(1, 1)), float(2)); + return mix(color2, color1, checkerMix); + }; + const hextiledCheckerboard = ( + texcoord, + { + color1 = vec3(1, 1, 1), + color2 = vec3(0, 0, 0), + uvtiling = vec2(4, 4), + uvoffset = vec2(0, 0), + tiling = vec2(1, 1), + rotation = 0, + rotationrange = vec2(0, 360), + scale = 0, + scalerange = vec2(0.5, 2), + offset = 0, + offsetrange = vec2(0, 1), + falloff = 0.5, + falloffcontrast = 0.5, + lumacoeffs = vec3(0.2722287, 0.6740818, 0.0536895), + } = {}, + ) => { + const tileData = mxHextileCoord( + mul(texcoord, tiling), + rotation, + rotationrange, + scale, + scalerange, + offset, + offsetrange, + ); + const c0 = checkerboard(color1, color2, uvtiling, uvoffset, tileData.coords[0]); + const c1 = checkerboard(color1, color2, uvtiling, uvoffset, tileData.coords[1]); + const c2 = checkerboard(color1, color2, uvtiling, uvoffset, tileData.coords[2]); + const luminanceWeights = mix( + vec3(1, 1, 1), + vec3(dot(c0, lumacoeffs), dot(c1, lumacoeffs), dot(c2, lumacoeffs)), + vec3(falloffcontrast, falloffcontrast, falloffcontrast), + ); + const blendWeights = mxHextileComputeBlendWeights(luminanceWeights, tileData.weights, falloff); + return add( + add(mul(element(blendWeights, 0), c0), mul(element(blendWeights, 1), c1)), + mul(element(blendWeights, 2), c2), + ); + }; + + const noiseExamples = [ + { label: ['Noise', '2D'], createNode: () => mx_noise_vec3(position2D) }, + { label: ['Noise', '3D'], createNode: () => mx_noise_vec3(position3D) }, + { label: ['Cellnoise', '2D'], createNode: () => mx_cell_noise_float(position2D) }, + { label: ['Cellnoise', '3D'], createNode: () => mx_cell_noise_float(position3D) }, + { label: ['Worley', '2D style 0'], createNode: () => mx_worley_noise_float_2d(position2D, 1, 0) }, + { label: ['Worley', '3D style 0'], createNode: () => mx_worley_noise_float_3d(position3D, 1, 0) }, + { label: ['Worley', '2D style 1'], createNode: () => mx_worley_noise_float_2d(position2D, 1, 1) }, + { label: ['Worley', '3D style 1'], createNode: () => mx_worley_noise_float_3d(position3D, 1, 1) }, + { label: ['Fractal', '2D'], createNode: () => mx_fractal_noise_vec3(fractal2D) }, + { label: ['Fractal', '3D'], createNode: () => mx_fractal_noise_vec3(fractal3D) }, + { + label: ['Unified Perlin', '2D'], + createNode: () => mx_unifiednoise2d(int(0), position2D, vec2(1, 1), unifiedOffset2D), + }, + { + label: ['Unified Perlin', '3D'], + createNode: () => unifiedNoise3D(int(0), position3D, vec3(1, 1, 1), unifiedOffset3D), + }, + { + label: ['Unified Cell', '2D'], + createNode: () => mx_unifiednoise2d(int(1), position2D, vec2(1, 1), unifiedOffset2D), + }, + { + label: ['Unified Cell', '3D'], + createNode: () => unifiedNoise3D(int(1), position3D, vec3(1, 1, 1), unifiedOffset3D), + }, + { + label: ['Unified Worley', '2D style 0'], + createNode: () => + mx_unifiednoise2d(int(2), position2D, vec2(1, 1), unifiedOffset2D, 1, 0, 1, false, 1, 2, 0.5, 0), + }, + { + label: ['Unified Worley', '3D style 0'], + createNode: () => + unifiedNoise3D(int(2), position3D, vec3(1, 1, 1), unifiedOffset3D, 1, 0, 1, false, 1, 2, 0.5, 0), + }, + { + label: ['Unified Worley', '2D style 1'], + createNode: () => + mx_unifiednoise2d(int(2), position2D, vec2(1, 1), unifiedOffset2D, 1, 0, 1, false, 1, 2, 0.5, 1), + }, + { + label: ['Unified Worley', '3D style 1'], + createNode: () => + unifiedNoise3D(int(2), position3D, vec3(1, 1, 1), unifiedOffset3D, 1, 0, 1, false, 1, 2, 0.5, 1), + }, + { + label: ['Unified Fractal', '2D'], + createNode: () => mx_unifiednoise2d(int(3), position2D, vec2(1, 1), unifiedOffset2D, 1, 0, 1, false, 3), + }, + { + label: ['Unified Fractal', '3D'], + createNode: () => unifiedNoise3D(int(3), position3D, vec3(1, 1, 1), unifiedOffset3D, 1, 0, 1, false, 3), + }, + { + label: ['Hex Tiled', 'checkerboard'], + createNode: () => + hextiledCheckerboard(textileTexcoord(0.08, 0.04), { + color1: vec3(1, 1, 1), + color2: vec3(0, 0, 0), + uvtiling: vec2(8, 8), + tiling: vec2(2.2, 2.2), + rotation: 0.25, + scale: 0.1, + offset: 0.2, + falloff: 0.35, + falloffcontrast: 0.25, + }), + }, + ]; + + createNoiseGrid(noiseExamples, geometry, font, labelMaterial); + + scene.background = hdrTexture; + scene.environment = hdrTexture; + + // LIGHTS + + particleLight = new THREE.Mesh( + new THREE.SphereGeometry(0.4, 8, 8), + new THREE.MeshBasicMaterial({ color: 0xffffff }), + ); + scene.add(particleLight); + + particleLight.add(new THREE.PointLight(0xffffff, 1000)); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setAnimationLoop(render); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.25; + + // EVENTS + + new OrbitControls(camera, renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +// + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +// + +function render() { + const timer = Date.now() * 0.00025; + + particleLight.position.x = Math.sin(timer * 7) * 30; + particleLight.position.y = Math.cos(timer * 5) * 40; + particleLight.position.z = Math.cos(timer * 3) * 30; + + for (let i = 0; i < spheres.length; i++) { + const child = spheres[i]; + child.rotation.y += 0.005; + } + + renderer.render(scene, camera); +} + +function createNoiseGrid(noiseExamples, geometry, font, labelMaterial) { + const columns = 7; + const spacingX = 15.5; + const spacingY = 18; + const rowOffset = (Math.ceil(noiseExamples.length / columns) - 1) * spacingY * 0.5; + const columnOffset = (columns - 1) * spacingX * 0.5; + const errorMaterial = new THREE.MeshBasicMaterial({ color: 0xff3333 }); + + for (let i = 0; i < noiseExamples.length; i++) { + const example = noiseExamples[i]; + const column = i % columns; + const row = Math.floor(i / columns); + const x = column * spacingX - columnOffset; + const y = rowOffset - row * spacingY; + const labelLines = example.label.slice(); + + const material = new THREE.MeshPhysicalNodeMaterial(); + + try { + material.colorNode = example.createNode(); + } catch (error) { + console.error(`Failed to create MaterialX noise sample: ${example.label.join(' ')}`, error); + labelLines.push('Failed'); + } + + const mesh = new THREE.Mesh(geometry, material.colorNode ? material : errorMaterial); + mesh.position.set(x, y, 0); + group.add(mesh); + spheres.push(mesh); + + const label = createLabel(labelLines, font, labelMaterial); + label.position.set(x, y - 7.5, 0); + group.add(label); + } +} + +function createLabel(lines, font, material) { + const label = new THREE.Group(); + const lineHeight = 1.55; + const startY = (lines.length - 1) * lineHeight * 0.5; + + for (let i = 0; i < lines.length; i++) { + const textGeometry = new TextGeometry(lines[i], { + font: font, + size: 1.15, + depth: 0.02, + curveSegments: 2, + }); + + textGeometry.computeBoundingBox(); + + const boundingBox = textGeometry.boundingBox; + const offsetX = -0.5 * (boundingBox.max.x - boundingBox.min.x); + const offsetY = -0.5 * (boundingBox.max.y - boundingBox.min.y); + textGeometry.translate(offsetX, offsetY, 0); + + const textMesh = new THREE.Mesh(textGeometry, material); + textMesh.position.y = startY - i * lineHeight; + label.add(textMesh); + } + + return label; +} diff --git a/examples-testing/examples/webgpu_mesh_batch.ts b/examples-testing/examples/webgpu_mesh_batch.ts new file mode 100644 index 000000000..6a6656e21 --- /dev/null +++ b/examples-testing/examples/webgpu_mesh_batch.ts @@ -0,0 +1,265 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { radixSort } from 'three/addons/utils/SortUtils.js'; + +import { normalView, packNormalToRGB, diffuseColor, vec4 } from 'three/tsl'; + +let camera, scene, renderer; +let controls; +let gui; +let geometries, mesh, material; +const ids = []; + +const matrix = new THREE.Matrix4(); + +// + +const position = new THREE.Vector3(); +const rotation = new THREE.Euler(); +const quaternion = new THREE.Quaternion(); +const scale = new THREE.Vector3(); + +// + +const MAX_GEOMETRY_COUNT = 20000; + +const api = { + webgpu: true, + count: 512, + dynamic: 16, + + sortObjects: true, + perObjectFrustumCulled: true, + opacity: 1, + useCustomSort: true, + randomizeGeometry: () => { + for (let i = 0; i < api.count; i++) { + mesh.setGeometryIdAt(i, Math.floor(Math.random() * geometries.length)); + } + }, +}; + +init(); + +// + +function randomizeMatrix(matrix) { + position.x = Math.random() * 40 - 20; + position.y = Math.random() * 40 - 20; + position.z = Math.random() * 40 - 20; + + rotation.x = Math.random() * 2 * Math.PI; + rotation.y = Math.random() * 2 * Math.PI; + rotation.z = Math.random() * 2 * Math.PI; + + quaternion.setFromEuler(rotation); + + scale.x = scale.y = scale.z = 0.5 + Math.random() * 0.5; + + return matrix.compose(position, quaternion, scale); +} + +function randomizeRotationSpeed(rotation) { + rotation.x = Math.random() * 0.01; + rotation.y = Math.random() * 0.01; + rotation.z = Math.random() * 0.01; + return rotation; +} + +function initGeometries() { + geometries = [ + new THREE.ConeGeometry(1.0, 2.0), + new THREE.BoxGeometry(2.0, 2.0, 2.0), + new THREE.SphereGeometry(1.0, 16, 8), + ]; +} + +function createMaterial() { + if (!material) { + material = new THREE.MeshBasicNodeMaterial(); + material.outputNode = vec4(diffuseColor.mul(packNormalToRGB(normalView).y.add(0.5)).rgb, diffuseColor.a); + } + + return material; +} + +function cleanup() { + if (mesh) { + mesh.parent.remove(mesh); + + if (mesh.dispose) { + mesh.dispose(); + } + } +} + +function initMesh() { + cleanup(); + initBatchedMesh(); +} + +function initBatchedMesh() { + const geometryCount = api.count; + const vertexCount = geometries.length * 512; + const indexCount = geometries.length * 1024; + + const euler = new THREE.Euler(); + const matrix = new THREE.Matrix4(); + mesh = new THREE.BatchedMesh(geometryCount, vertexCount, indexCount, createMaterial()); + mesh.userData.rotationSpeeds = []; + + // disable full-object frustum culling since all of the objects can be dynamic. + mesh.frustumCulled = false; + + ids.length = 0; + + const geometryIds = [ + mesh.addGeometry(geometries[0]), + mesh.addGeometry(geometries[1]), + mesh.addGeometry(geometries[2]), + ]; + for (let i = 0; i < api.count; i++) { + const id = mesh.addInstance(geometryIds[i % geometryIds.length]); + mesh.setMatrixAt(id, randomizeMatrix(matrix)); + mesh.setColorAt(id, new THREE.Color(Math.random() * 0xffffff)); + + const rotationMatrix = new THREE.Matrix4(); + rotationMatrix.makeRotationFromEuler(randomizeRotationSpeed(euler)); + mesh.userData.rotationSpeeds.push(rotationMatrix); + + ids.push(id); + } + + scene.add(mesh); +} + +function init(forceWebGL = false) { + if (renderer) { + renderer.dispose(); + controls.dispose(); + document.body.removeChild(renderer.domElement); + } + + // camera + + const aspect = window.innerWidth / window.innerHeight; + + camera = new THREE.PerspectiveCamera(70, aspect, 1, 100); + camera.position.z = 30; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(animate); + + // scene + + scene = new THREE.Scene(); + scene.background = forceWebGL ? new THREE.Color(0xffc1c1) : new THREE.Color(0xc1c1ff); + + document.body.appendChild(renderer.domElement); + + initGeometries(); + initMesh(); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = 1.0; + + // gui + + gui = renderer.inspector.createParameters('Settings'); + gui.add(api, 'webgpu').onChange(() => { + init(!api.webgpu); + }); + gui.add(api, 'count', 1, MAX_GEOMETRY_COUNT, 1).onChange(initMesh); + gui.add(api, 'dynamic', 0, MAX_GEOMETRY_COUNT, 1); + + gui.add(api, 'opacity', 0, 1).onChange(v => { + if (v < 1) { + material.transparent = true; + material.depthWrite = false; + } else { + material.transparent = false; + material.depthWrite = true; + } + + material.opacity = v; + material.needsUpdate = true; + }); + gui.add(api, 'sortObjects'); + gui.add(api, 'perObjectFrustumCulled'); + gui.add(api, 'useCustomSort'); + gui.add(api, 'randomizeGeometry').name('randomize geometry'); + + // listeners + + window.addEventListener('resize', onWindowResize); + + function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + } + + async function animate() { + animateMeshes(); + + controls.update(); + + if (mesh.isBatchedMesh) { + mesh.sortObjects = api.sortObjects; + mesh.perObjectFrustumCulled = api.perObjectFrustumCulled; + mesh.setCustomSort(api.useCustomSort ? sortFunction : null); + } + + renderer.render(scene, camera); + } + + function animateMeshes() { + const loopNum = Math.min(api.count, api.dynamic); + + for (let i = 0; i < loopNum; i++) { + const rotationMatrix = mesh.userData.rotationSpeeds[i]; + const id = ids[i]; + + mesh.getMatrixAt(id, matrix); + matrix.multiply(rotationMatrix); + mesh.setMatrixAt(id, matrix); + } + } +} + +// + +function sortFunction(list, camera) { + // initialize options + this._options = this._options || { + get: el => el.z, + aux: new Array(this.maxInstanceCount), + }; + + const options = this._options; + options.reversed = this.material.transparent; + + // convert depth to unsigned 32 bit range + const factor = (2 ** 32 - 1) / camera.far; // UINT32_MAX / max_depth + for (let i = 0, l = list.length; i < l; i++) { + list[i].z *= factor; + } + + // perform a fast-sort using the hybrid radix sort function + radixSort(list, options); +} diff --git a/examples-testing/examples/webgpu_mirror.ts b/examples-testing/examples/webgpu_mirror.ts new file mode 100644 index 000000000..565467340 --- /dev/null +++ b/examples-testing/examples/webgpu_mirror.ts @@ -0,0 +1,195 @@ +import * as THREE from 'three/webgpu'; +import { reflector, uv, texture, color } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +let cameraControls; + +let sphereGroup, smallSphere; + +init(); + +function init() { + // scene + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + // camera + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); + camera.position.set(0, 75, 160); + + // + + let geometry, material; + + // + + sphereGroup = new THREE.Object3D(); + scene.add(sphereGroup); + + geometry = new THREE.CylinderGeometry(0.1, 15 * Math.cos((Math.PI / 180) * 30), 0.1, 24, 1); + material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x8d8d8d }); + const sphereCap = new THREE.Mesh(geometry, material); + sphereCap.position.y = -15 * Math.sin((Math.PI / 180) * 30) - 0.05; + sphereCap.rotateX(-Math.PI); + + geometry = new THREE.SphereGeometry(15, 24, 24, Math.PI / 2, Math.PI * 2, 0, (Math.PI / 180) * 120); + const halfSphere = new THREE.Mesh(geometry, material); + halfSphere.add(sphereCap); + halfSphere.rotateX((-Math.PI / 180) * 135); + halfSphere.rotateZ((-Math.PI / 180) * 20); + halfSphere.position.y = 7.5 + 15 * Math.sin((Math.PI / 180) * 30); + + sphereGroup.add(halfSphere); + + geometry = new THREE.IcosahedronGeometry(5, 0); + material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x7b7b7b, flatShading: true }); + smallSphere = new THREE.Mesh(geometry, material); + scene.add(smallSphere); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const floorNormal = textureLoader.load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); + floorNormal.wrapS = THREE.RepeatWrapping; + floorNormal.wrapT = THREE.RepeatWrapping; + + const decalDiffuse = textureLoader.load('textures/decal/decal-diffuse.png'); + decalDiffuse.colorSpace = THREE.SRGBColorSpace; + + const decalNormal = textureLoader.load('textures/decal/decal-normal.jpg'); + + // reflectors / mirrors + + const groundReflector = reflector().toInspector('Ground Reflector'); + const verticalReflector = reflector().toInspector('Vertical Reflector'); + + const groundNormalScale = -0.08; + const verticalNormalScale = 0.1; + + const groundUVOffset = texture(decalNormal).xy.mul(2).sub(1).mul(groundNormalScale); + const verticalUVOffset = texture(floorNormal, uv().mul(5)).xy.mul(2).sub(1).mul(verticalNormalScale); + + groundReflector.uvNode = groundReflector.uvNode.add(groundUVOffset); + verticalReflector.uvNode = verticalReflector.uvNode.add(verticalUVOffset); + + const groundNode = texture(decalDiffuse).a.mix(color(0xffffff), groundReflector); + const verticalNode = color(0x0000ff).mul(0.1).add(verticalReflector); + + // walls + + const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); + + // + + const planeBottom = new THREE.Mesh( + planeGeo, + new THREE.MeshPhongNodeMaterial({ + colorNode: groundNode, + }), + ); + planeBottom.rotateX(-Math.PI / 2); + planeBottom.add(groundReflector.target); + scene.add(planeBottom); + + const planeBack = new THREE.Mesh( + planeGeo, + new THREE.MeshPhongNodeMaterial({ + colorNode: verticalNode, + }), + ); + planeBack.position.z = -50; + planeBack.position.y = 50; + planeBack.add(verticalReflector.target); + scene.add(planeBack); + + // + + const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeTop.position.y = 100; + planeTop.rotateX(Math.PI / 2); + scene.add(planeTop); + + const planeFront = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); + planeFront.position.z = 50; + planeFront.position.y = 50; + planeFront.rotateY(Math.PI); + scene.add(planeFront); + + const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); + planeRight.position.x = 50; + planeRight.position.y = 50; + planeRight.rotateY(-Math.PI / 2); + scene.add(planeRight); + + const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); + planeLeft.position.x = -50; + planeLeft.position.y = 50; + planeLeft.rotateY(Math.PI / 2); + scene.add(planeLeft); + + // lights + + const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); + mainLight.position.y = 60; + scene.add(mainLight); + + const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); + greenLight.position.set(550, 50, 0); + scene.add(greenLight); + + const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); + redLight.position.set(-550, 50, 0); + scene.add(redLight); + + const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); + blueLight.position.set(0, 50, 550); + scene.add(blueLight); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + cameraControls = new OrbitControls(camera, renderer.domElement); + cameraControls.target.set(0, 40, 0); + cameraControls.maxDistance = 400; + cameraControls.minDistance = 10; + cameraControls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const timer = Date.now() * 0.01; + + sphereGroup.rotation.y -= 0.002; + + smallSphere.position.set( + Math.cos(timer * 0.1) * 30, + Math.abs(Math.cos(timer * 0.2)) * 20 + 5, + Math.sin(timer * 0.1) * 30, + ); + smallSphere.rotation.y = Math.PI / 2 - timer * 0.1; + smallSphere.rotation.z = timer * 0.8; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_modifier_curve.ts b/examples-testing/examples/webgpu_modifier_curve.ts new file mode 100644 index 000000000..c465ddc57 --- /dev/null +++ b/examples-testing/examples/webgpu_modifier_curve.ts @@ -0,0 +1,154 @@ +import * as THREE from 'three/webgpu'; +import { TransformControls } from 'three/addons/controls/TransformControls.js'; + +import { Flow } from 'three/addons/modifiers/CurveModifierGPU.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +const ACTION_SELECT = 1, + ACTION_NONE = 0; +const curveHandles = []; +const mouse = new THREE.Vector2(); + +let scene, + camera, + renderer, + rayCaster, + control, + flow, + action = ACTION_NONE; + +init(); + +function init() { + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(2, 2, 4); + camera.lookAt(scene.position); + + const initialPoints = [ + { x: 1, y: 0, z: -1 }, + { x: 1, y: 0, z: 1 }, + { x: -1, y: 0, z: 1 }, + { x: -1, y: 0, z: -1 }, + ]; + + const boxGeometry = new THREE.BoxGeometry(0.1, 0.1, 0.1); + const boxMaterial = new THREE.MeshBasicNodeMaterial(); + + for (const handlePos of initialPoints) { + const handle = new THREE.Mesh(boxGeometry, boxMaterial); + handle.position.copy(handlePos); + curveHandles.push(handle); + scene.add(handle); + } + + const curve = new THREE.CatmullRomCurve3(curveHandles.map(handle => handle.position)); + curve.curveType = 'centripetal'; + curve.closed = true; + + const points = curve.getPoints(50); + const line = new THREE.Line( + new THREE.BufferGeometry().setFromPoints(points), + new THREE.LineBasicMaterial({ color: 0x00ff00 }), + ); + + scene.add(line); + + // + + const light = new THREE.DirectionalLight(0xffaa33, 3); + light.position.set(-10, 10, 10); + scene.add(light); + + const light2 = new THREE.AmbientLight(0x003973, 3); + scene.add(light2); + + // + + const loader = new FontLoader(); + loader.load('fonts/helvetiker_regular.typeface.json', function (font) { + const geometry = new TextGeometry('Hello three.js!', { + font: font, + size: 0.2, + depth: 0.05, + curveSegments: 12, + bevelEnabled: true, + bevelThickness: 0.02, + bevelSize: 0.01, + bevelOffset: 0, + bevelSegments: 5, + }); + + geometry.rotateX(Math.PI); + + const material = new THREE.MeshStandardNodeMaterial({ + color: 0x99ffff, + }); + + const objectToCurve = new THREE.Mesh(geometry, material); + + flow = new Flow(objectToCurve); + flow.updateCurve(0, curve); + scene.add(flow.object3D); + }); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderer.domElement.addEventListener('pointerdown', onPointerDown); + + rayCaster = new THREE.Raycaster(); + control = new TransformControls(camera, renderer.domElement); + control.addEventListener('dragging-changed', function (event) { + if (!event.value) { + const points = curve.getPoints(50); + line.geometry.setFromPoints(points); + flow.updateCurve(0, curve); + } + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerDown(event) { + action = ACTION_SELECT; + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; +} + +function animate() { + if (action === ACTION_SELECT) { + rayCaster.setFromCamera(mouse, camera); + action = ACTION_NONE; + const intersects = rayCaster.intersectObjects(curveHandles, false); + if (intersects.length) { + const target = intersects[0].object; + control.attach(target); + scene.add(control.getHelper()); + } + } + + if (flow) { + flow.moveAlongCurve(0.001); + } + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_morphtargets.ts b/examples-testing/examples/webgpu_morphtargets.ts new file mode 100644 index 000000000..cde3ae83b --- /dev/null +++ b/examples-testing/examples/webgpu_morphtargets.ts @@ -0,0 +1,119 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let container, camera, scene, renderer, mesh; + +init(); + +function init() { + container = document.getElementById('container'); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x8fbcd4); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); + camera.position.z = 10; + scene.add(camera); + + scene.add(new THREE.AmbientLight(0x8fbcd4, 1.5)); + + const pointLight = new THREE.PointLight(0xffffff, 200); + camera.add(pointLight); + + const geometry = createGeometry(); + + const material = new THREE.MeshPhongMaterial({ + color: 0xff0000, + flatShading: true, + }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.inspector = new Inspector(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(function () { + renderer.render(scene, camera); + }); + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableZoom = false; + + window.addEventListener('resize', onWindowResize); + + initGUI(); +} + +function createGeometry() { + const geometry = new THREE.BoxGeometry(2, 2, 2, 32, 32, 32); + + // create an empty array to hold targets for the attribute we want to morph + // morphing positions and normals is supported + geometry.morphAttributes.position = []; + + // the original positions of the cube's vertices + const positionAttribute = geometry.attributes.position; + + // for the first morph target we'll move the cube's vertices onto the surface of a sphere + const spherePositions = []; + + // for the second morph target, we'll twist the cubes vertices + const twistPositions = []; + const direction = new THREE.Vector3(1, 0, 0); + const vertex = new THREE.Vector3(); + + for (let i = 0; i < positionAttribute.count; i++) { + const x = positionAttribute.getX(i); + const y = positionAttribute.getY(i); + const z = positionAttribute.getZ(i); + + spherePositions.push( + x * Math.sqrt(1 - (y * y) / 2 - (z * z) / 2 + (y * y * z * z) / 3), + y * Math.sqrt(1 - (z * z) / 2 - (x * x) / 2 + (z * z * x * x) / 3), + z * Math.sqrt(1 - (x * x) / 2 - (y * y) / 2 + (x * x * y * y) / 3), + ); + + // stretch along the x-axis so we can see the twist better + vertex.set(x * 2, y, z); + + vertex.applyAxisAngle(direction, (Math.PI * x) / 2).toArray(twistPositions, twistPositions.length); + } + + // add the spherical positions as the first morph target + geometry.morphAttributes.position[0] = new THREE.Float32BufferAttribute(spherePositions, 3); + + // add the twisted positions as the second morph target + geometry.morphAttributes.position[1] = new THREE.Float32BufferAttribute(twistPositions, 3); + + return geometry; +} + +function initGUI() { + // Set up dat.GUI to control targets + const params = { + Spherify: 0, + Twist: 0, + }; + + const gui = renderer.inspector.createParameters('Morph Targets'); + + gui.add(params, 'Spherify', 0, 1, 0.01).onChange(function (value) { + mesh.morphTargetInfluences[0] = value; + }); + gui.add(params, 'Twist', 0, 1, 0.01).onChange(function (value) { + mesh.morphTargetInfluences[1] = value; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} diff --git a/examples-testing/examples/webgpu_morphtargets_face.ts b/examples-testing/examples/webgpu_morphtargets_face.ts new file mode 100644 index 000000000..86bc871d9 --- /dev/null +++ b/examples-testing/examples/webgpu_morphtargets_face.ts @@ -0,0 +1,98 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; +import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +init(); + +async function init() { + let mixer; + + const timer = new THREE.Timer(); + timer.connect(document); + + const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); + camera.position.set(-1.8, 0.8, 3); + + const scene = new THREE.Scene(); + + const renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.background = new THREE.Color(0x666666); + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + + const ktx2Loader = await new KTX2Loader().detectSupport(renderer); + + new GLTFLoader() + .setKTX2Loader(ktx2Loader) + .setMeshoptDecoder(MeshoptDecoder) + .load('models/gltf/facecap.glb', gltf => { + const mesh = gltf.scene.children[0]; + + scene.add(mesh); + + mixer = new THREE.AnimationMixer(mesh); + + mixer.clipAction(gltf.animations[0]).play(); + + // GUI + + const head = mesh.getObjectByName('mesh_2'); + const influences = head.morphTargetInfluences; + + const gui = renderer.inspector.createParameters('Morph Targets'); + + for (const [key, value] of Object.entries(head.morphTargetDictionary)) { + gui.add(influences, value, 0, 1, 0.01).name(key.replace('blendShape1.', '')).listen(); + } + }); + + scene.background = new THREE.Color(0x666666); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2.5; + controls.maxDistance = 5; + controls.minAzimuthAngle = -Math.PI / 2; + controls.maxAzimuthAngle = Math.PI / 2; + controls.maxPolarAngle = Math.PI / 1.8; + controls.target.set(0, 0.15, -0.2); + + function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) { + mixer.update(delta); + } + + renderer.render(scene, camera); + + controls.update(); + } + + window.addEventListener('resize', () => { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + }); +} diff --git a/examples-testing/examples/webgpu_mrt.ts b/examples-testing/examples/webgpu_mrt.ts new file mode 100644 index 000000000..b3b42bec0 --- /dev/null +++ b/examples-testing/examples/webgpu_mrt.ts @@ -0,0 +1,123 @@ +import * as THREE from 'three/webgpu'; +import { + output, + normalView, + pass, + step, + diffuseColor, + emissive, + packNormalToRGB, + screenUV, + mix, + mrt, + Fn, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer; +let renderPipeline; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + // scene + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + // model + + const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); + loader.load('DamagedHelmet.gltf', function (gltf) { + scene.add(gltf.scene); + }); + }); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true, requiredLimits: { maxColorAttachments: 5 } }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // post processing + + const scenePass = pass(scene, camera, { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }); + scenePass.setMRT( + mrt({ + output: output, + normal: packNormalToRGB(normalView), + diffuse: diffuseColor, + emissive: emissive, + }), + ); + + // optimize textures + + const normalTexture = scenePass.getTexture('normal'); + const diffuseTexture = scenePass.getTexture('diffuse'); + const emissiveTexture = scenePass.getTexture('emissive'); + + normalTexture.type = diffuseTexture.type = emissiveTexture.type = THREE.UnsignedByteType; + + // post processing - mrt + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = false; + renderPipeline.outputNode = Fn(() => { + const output = scenePass.getTextureNode('output'); // output name is optional here + const normal = scenePass.getTextureNode('normal'); + const diffuse = scenePass.getTextureNode('diffuse'); + const emissive = scenePass.getTextureNode('emissive'); + + const out = mix(output.renderOutput(), output, step(0.2, screenUV.x)); + const nor = mix(out, normal, step(0.4, screenUV.x)); + const emi = mix(nor, emissive, step(0.6, screenUV.x)); + const dif = mix(emi, diffuse, step(0.8, screenUV.x)); + + return dif; + })(); + + // controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.target.set(0, 0, -0.2); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_mrt_mask.ts b/examples-testing/examples/webgpu_mrt_mask.ts new file mode 100644 index 000000000..2bb80b84e --- /dev/null +++ b/examples-testing/examples/webgpu_mrt_mask.ts @@ -0,0 +1,132 @@ +import * as THREE from 'three/webgpu'; +import { color, screenUV, mrt, output, pass, vec4 } from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; +let renderPipeline; +let spheres, + rotate = true; +let mixer, timer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.set(1, 2, 3); + + scene = new THREE.Scene(); + scene.backgroundNode = screenUV.y.mix(color(0x66bbff), color(0x4466ff)).mul(0.05); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + // lights + + const light = new THREE.SpotLight(0xffffff, 1); + light.power = 2000; + camera.add(light); + scene.add(camera); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Michelle.glb', function (gltf) { + const object = gltf.scene; + mixer = new THREE.AnimationMixer(object); + + const material = object.children[0].children[0].material; + + // add glow effect + material.mrtNode = mrt({ mask: output.add(1) }); + + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + scene.add(object); + }); + + // spheres + + const geometry = new THREE.SphereGeometry(0.3, 32, 16); + + spheres = new THREE.Group(); + scene.add(spheres); + + function addSphere(color, mrtNode = null) { + const distance = 1; + const id = spheres.children.length; + const rotation = THREE.MathUtils.degToRad(id * 90); + + const material = new THREE.MeshStandardNodeMaterial({ color }); + material.mrtNode = mrtNode; + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(Math.cos(rotation) * distance, 1, Math.sin(rotation) * distance); + + spheres.add(mesh); + } + + addSphere(0x0000ff, mrt({ mask: output })); + addSphere(0x00ff00); + addSphere(0xff0000); + addSphere(0x00ffff); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 0.4; + document.body.appendChild(renderer.domElement); + + // post processing + + const scenePass = pass(scene, camera); + scenePass.setMRT( + mrt({ + output: output.renderOutput(), + mask: vec4(0), // empty as default, custom materials can set this + }), + ); + + const colorPass = scenePass.getTextureNode(); + const maskPass = scenePass.getTextureNode('mask'); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = false; + renderPipeline.outputNode = colorPass.add(gaussianBlur(maskPass, 1, 20).mul(0.3)).renderOutput(); + + // controls + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1, 0); + controls.addEventListener('start', () => (rotate = false)); + controls.addEventListener('end', () => (rotate = true)); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + if (rotate) spheres.rotation.y += delta * 0.5; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_multiple_canvas.ts b/examples-testing/examples/webgpu_multiple_canvas.ts new file mode 100644 index 000000000..db55fe165 --- /dev/null +++ b/examples-testing/examples/webgpu_multiple_canvas.ts @@ -0,0 +1,111 @@ +import * as THREE from 'three'; +import { color } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +// + +if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); +} + +// + +let renderer; + +const scenes = []; + +init(); + +function init() { + const geometries = [ + new THREE.BoxGeometry(1, 1, 1), + new THREE.SphereGeometry(0.5, 12, 8), + new THREE.DodecahedronGeometry(0.5), + new THREE.CylinderGeometry(0.5, 0.5, 1, 12), + ]; + + const content = document.getElementById('content'); + + for (let i = 0; i < 40; i++) { + const scene = new THREE.Scene(); + scene.backgroundNode = color(0xeeeeee); + + // make a list item + const element = document.createElement('div'); + element.className = 'list-item'; + + const sceneCanvas = document.createElement('canvas'); + element.appendChild(sceneCanvas); + + const descriptionElement = document.createElement('div'); + descriptionElement.innerText = 'Scene ' + (i + 1); + element.appendChild(descriptionElement); + + const canvasTarget = new THREE.CanvasTarget(sceneCanvas); + canvasTarget.setPixelRatio(window.devicePixelRatio); + canvasTarget.setSize(200, 200); + + // the element that represents the area we want to render the scene + scene.userData.canvasTarget = canvasTarget; + content.appendChild(element); + + const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); + camera.position.z = 2; + scene.userData.camera = camera; + + const controls = new OrbitControls(scene.userData.camera, scene.userData.canvasTarget.domElement); + controls.minDistance = 2; + controls.maxDistance = 5; + controls.enablePan = false; + controls.enableZoom = false; + scene.userData.controls = controls; + + // add one random mesh to each scene + const geometry = geometries[(geometries.length * Math.random()) | 0]; + + const material = new THREE.MeshStandardMaterial({ + color: new THREE.Color().setHSL(Math.random(), 1, 0.75, THREE.SRGBColorSpace), + roughness: 0.5, + metalness: 0, + flatShading: true, + }); + + scene.add(new THREE.Mesh(geometry, material)); + + scene.add(new THREE.HemisphereLight(0xaaaaaa, 0x444444, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 1.5); + light.position.set(1, 1, 1); + scene.add(light); + + scenes.push(scene); + } + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setClearColor(0xffffff, 1); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setAnimationLoop(animate); +} + +function animate() { + scenes.forEach(function (scene) { + // so something moves + //scene.children[ 0 ].rotation.y = Date.now() * 0.001; + + // get the canvas and camera for this scene + const { canvasTarget, camera } = scene.userData; + + //camera.aspect = width / height; // not changing in this example + //camera.updateProjectionMatrix(); + + //scene.userData.controls.update(); + + renderer.setCanvasTarget(canvasTarget); + renderer.render(scene, camera); + }); +} diff --git a/examples-testing/examples/webgpu_multiple_elements.ts b/examples-testing/examples/webgpu_multiple_elements.ts new file mode 100644 index 000000000..65bd3e75d --- /dev/null +++ b/examples-testing/examples/webgpu_multiple_elements.ts @@ -0,0 +1,142 @@ +import * as THREE from 'three'; +import { color } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let canvas, renderer; + +const scenes = []; + +init(); + +function init() { + canvas = document.getElementById('c'); + + const geometries = [ + new THREE.BoxGeometry(1, 1, 1), + new THREE.SphereGeometry(0.5, 12, 8), + new THREE.DodecahedronGeometry(0.5), + new THREE.CylinderGeometry(0.5, 0.5, 1, 12), + ]; + + const content = document.getElementById('content'); + + for (let i = 0; i < 40; i++) { + const scene = new THREE.Scene(); + scene.backgroundNode = color(0xeeeeee); + + // make a list item + const element = document.createElement('div'); + element.className = 'list-item'; + + const sceneElement = document.createElement('div'); + element.appendChild(sceneElement); + + const descriptionElement = document.createElement('div'); + descriptionElement.innerText = 'Scene ' + (i + 1); + element.appendChild(descriptionElement); + + // the element that represents the area we want to render the scene + scene.userData.element = sceneElement; + content.appendChild(element); + + const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); + camera.position.z = 2; + scene.userData.camera = camera; + + const controls = new OrbitControls(scene.userData.camera, scene.userData.element); + controls.minDistance = 2; + controls.maxDistance = 5; + controls.enablePan = false; + controls.enableZoom = false; + scene.userData.controls = controls; + + // add one random mesh to each scene + const geometry = geometries[(geometries.length * Math.random()) | 0]; + + const material = new THREE.MeshStandardMaterial({ + color: new THREE.Color().setHSL(Math.random(), 1, 0.75, THREE.SRGBColorSpace), + roughness: 0.5, + metalness: 0, + flatShading: true, + }); + + scene.add(new THREE.Mesh(geometry, material)); + + scene.add(new THREE.HemisphereLight(0xaaaaaa, 0x444444, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 1.5); + light.position.set(1, 1, 1); + scene.add(light); + + scenes.push(scene); + } + + renderer = new THREE.WebGPURenderer({ canvas: canvas, antialias: true }); + renderer.setClearColor(0xffffff, 1); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setAnimationLoop(animate); +} + +function updateSize() { + const width = canvas.clientWidth; + const height = canvas.clientHeight; + + if (canvas.width !== width || canvas.height !== height) { + renderer.setSize(width, height, false); + } +} + +function animate() { + updateSize(); + + canvas.style.transform = `translateY(${window.scrollY}px)`; + + renderer.setClearColor(0xffffff); + renderer.setScissorTest(false); + renderer.setViewport(0, 0, canvas.width, canvas.height); + renderer.clear(); + + //renderer.setClearColor( 0xe0e0e0 ); + renderer.setScissorTest(true); + + scenes.forEach(function (scene) { + // so something moves + scene.children[0].rotation.y = Date.now() * 0.001; + + // get the element that is a place holder for where we want to + // draw the scene + const element = scene.userData.element; + + // get its position relative to the page's viewport + const rect = element.getBoundingClientRect(); + + // check if it's offscreen. If so skip it + if ( + rect.bottom < 0 || + rect.top > renderer.domElement.clientHeight || + rect.right < 0 || + rect.left > renderer.domElement.clientWidth + ) { + return; // it's off screen + } + + // set the viewport + const width = rect.right - rect.left; + const height = rect.bottom - rect.top; + const left = rect.left; + const top = rect.top; + + renderer.setViewport(left, top, width, height); + renderer.setScissor(left, top, width, height); + + const camera = scene.userData.camera; + + //camera.aspect = width / height; // not changing in this example + //camera.updateProjectionMatrix(); + + //scene.userData.controls.update(); + + renderer.render(scene, camera); + }); +} diff --git a/examples-testing/examples/webgpu_multiple_rendertargets.ts b/examples-testing/examples/webgpu_multiple_rendertargets.ts new file mode 100644 index 000000000..2085d3c63 --- /dev/null +++ b/examples-testing/examples/webgpu_multiple_rendertargets.ts @@ -0,0 +1,97 @@ +import * as THREE from 'three/webgpu'; +import { mix, vec2, step, texture, uv, screenUV, normalWorld, output, mrt } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, torus; +let renderPipeline, renderTarget; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + // Create a multi render target with Float buffers + + renderTarget = new THREE.RenderTarget( + window.innerWidth * window.devicePixelRatio, + window.innerHeight * window.devicePixelRatio, + { count: 2, minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }, + ); + + // Name our G-Buffer attachments for debugging + + renderTarget.textures[0].name = 'output'; + renderTarget.textures[1].name = 'normal'; + + // Scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222222); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.z = 4; + + const loader = new THREE.TextureLoader(); + + const diffuse = loader.load('textures/hardwood2_diffuse.jpg'); + diffuse.colorSpace = THREE.SRGBColorSpace; + diffuse.wrapS = THREE.RepeatWrapping; + diffuse.wrapT = THREE.RepeatWrapping; + + const torusMaterial = new THREE.NodeMaterial(); + torusMaterial.colorNode = texture(diffuse, uv().mul(vec2(10, 4))); + + torus = new THREE.Mesh(new THREE.TorusKnotGeometry(1, 0.3, 128, 32), torusMaterial); + scene.add(torus); + + // MRT + + renderer.setMRT( + mrt({ + output: output, + normal: normalWorld, + }), + ); + + // Post Processing + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = mix( + texture(renderTarget.textures[0]), + texture(renderTarget.textures[1]), + step(0.5, screenUV.x), + ); + + // Controls + + new OrbitControls(camera, renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + const dpr = renderer.getPixelRatio(); + renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); +} + +function render(time) { + torus.rotation.y = (time / 1000) * 0.4; + + // render scene into target + renderer.setRenderTarget(renderTarget); + renderer.render(scene, camera); + + // render post FX + renderer.setRenderTarget(null); + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts b/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts new file mode 100644 index 000000000..2232ab182 --- /dev/null +++ b/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts @@ -0,0 +1,161 @@ +import * as THREE from 'three/webgpu'; +import { mix, step, texture, screenUV, mrt, output, normalWorld, uv, vec2 } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, torus; +let quadMesh, sceneMRT, renderTarget, readbackTarget, material, readbackMaterial, pixelBuffer, pixelBufferTexture; + +const options = { + selection: 'mrt', +}; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + // + + renderer.inspector = new Inspector(); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(options, 'selection', ['mrt', 'diffuse', 'normal']); + + // Create a multi render target with Float buffers + + renderTarget = new THREE.RenderTarget( + window.innerWidth * window.devicePixelRatio, + window.innerHeight * window.devicePixelRatio, + { count: 2, minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }, + ); + + // Name our G-Buffer attachments for debugging + + renderTarget.textures[0].name = 'output'; + renderTarget.textures[1].name = 'normal'; + + // Init readback render target, readback data texture, readback material + // Be careful with the size! 512 is already big. Reading data back from the GPU is computationally intensive + + const size = 512; + + readbackTarget = new THREE.RenderTarget(size, size, { count: 2 }); + + pixelBuffer = new Uint8Array(size ** 2 * 4).fill(0); + pixelBufferTexture = new THREE.DataTexture(pixelBuffer, size, size); + pixelBufferTexture.type = THREE.UnsignedByteType; + pixelBufferTexture.format = THREE.RGBAFormat; + + readbackMaterial = new THREE.MeshBasicNodeMaterial(); + readbackMaterial.colorNode = texture(pixelBufferTexture); + + // MRT + + sceneMRT = mrt({ + output: output, + normal: normalWorld, + }); + + // Scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222222); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.z = 4; + + const loader = new THREE.TextureLoader(); + + const diffuse = loader.load('textures/hardwood2_diffuse.jpg'); + diffuse.colorSpace = THREE.SRGBColorSpace; + diffuse.wrapS = THREE.RepeatWrapping; + diffuse.wrapT = THREE.RepeatWrapping; + + const torusMaterial = new THREE.NodeMaterial(); + torusMaterial.colorNode = texture(diffuse, uv().mul(vec2(10, 4))); + + torus = new THREE.Mesh(new THREE.TorusKnotGeometry(1, 0.3, 128, 32), torusMaterial); + scene.add(torus); + + // Output + + material = new THREE.NodeMaterial(); + material.colorNode = mix( + texture(renderTarget.textures[0]), + texture(renderTarget.textures[1]), + step(0.5, screenUV.x), + ); + + quadMesh = new THREE.QuadMesh(material); + + // Controls + + new OrbitControls(camera, renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + + const dpr = renderer.getPixelRatio(); + renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); +} + +async function render(time) { + const selection = options.selection; + + torus.rotation.y = (time / 1000) * 0.4; + + const isReadback = selection !== 'mrt'; + + // render scene into target + renderer.setMRT(sceneMRT); + renderer.setRenderTarget(isReadback ? readbackTarget : renderTarget); + renderer.render(scene, camera); + + // render post FX + renderer.setMRT(null); + renderer.setRenderTarget(null); + + if (isReadback) { + quadMesh.material = readbackMaterial; + + await readback(); + } else { + quadMesh.material = material; + } + + quadMesh.render(renderer); +} + +async function readback() { + const width = readbackTarget.width; + const height = readbackTarget.height; + + const selection = options.selection; + + if (selection === 'diffuse') { + pixelBuffer = await renderer.readRenderTargetPixelsAsync(readbackTarget, 0, 0, width, height, 0); // zero is optional + + pixelBufferTexture.image.data = pixelBuffer; + pixelBufferTexture.needsUpdate = true; + } else if (selection === 'normal') { + pixelBuffer = await renderer.readRenderTargetPixelsAsync(readbackTarget, 0, 0, width, height, 1); + + pixelBufferTexture.image.data = pixelBuffer; + pixelBufferTexture.needsUpdate = true; + } +} diff --git a/examples-testing/examples/webgpu_multisampled_renderbuffers.ts b/examples-testing/examples/webgpu_multisampled_renderbuffers.ts new file mode 100644 index 000000000..a00e37d77 --- /dev/null +++ b/examples-testing/examples/webgpu_multisampled_renderbuffers.ts @@ -0,0 +1,129 @@ +import * as THREE from 'three/webgpu'; +import { texture } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +const mouse = new THREE.Vector2(); + +let quadMesh, renderTarget; + +let box, box2; + +const dpr = 1; + +const params = { + animated: true, + multisampling: true, +}; + +const mat4 = new THREE.Matrix4(); + +const count = 50; +const fullRadius = 20; // Radius of the sphere +const halfRadius = 10; // Radius of the sphere +const positions = new Array(count).fill().map((_, i) => { + const radius = i % 2 === 0 ? fullRadius : halfRadius; + + const phi = Math.acos(2 * Math.random() - 1) - Math.PI / 2; // phi: latitude, range -π/2 to π/2 + const theta = 2 * Math.PI * Math.random(); // theta: longitude, range 0 to 2π + + return new THREE.Vector3( + radius * Math.cos(phi) * Math.cos(theta), // x + radius * Math.sin(phi), // y + radius * Math.cos(phi) * Math.sin(theta), // z + ); +}); + +init(); +initGUI(); + +function initGUI() { + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'multisampling'); + gui.add(params, 'animated'); +} + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.z = 3; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x111111); + + // textured mesh + + const geometryBox = new THREE.BoxGeometry(7, 7, 7, 12, 12, 12); + const materialBox = new THREE.MeshBasicNodeMaterial(); + const materialBoxInner = new THREE.MeshBasicNodeMaterial({ color: 0xff0000 }); + + materialBox.wireframe = true; + + // + + box = new THREE.InstancedMesh(geometryBox, materialBox, count); + box2 = new THREE.InstancedMesh(geometryBox, materialBoxInner, count); + + for (let i = 0; i < count; i++) { + box.setMatrixAt(i, mat4.identity().setPosition(positions[i])); + box2.setMatrixAt(i, mat4.multiplyScalar(0.996).setPosition(positions[i])); + } + + scene.add(box, box2); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.inspector = new Inspector(); + renderer.setPixelRatio(dpr); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderTarget = new THREE.RenderTarget(window.innerWidth * dpr, window.innerHeight * dpr, { + samples: params.multisampling ? 4 : 1, + depthBuffer: true, + }); + + window.addEventListener('mousemove', onWindowMouseMove); + window.addEventListener('resize', onWindowResize); + + // FX + + // modulate the final color based on the mouse position + + const materialFX = new THREE.MeshBasicNodeMaterial(); + materialFX.colorNode = texture(renderTarget.texture).rgb; + + quadMesh = new THREE.QuadMesh(materialFX); +} + +function onWindowMouseMove(e) { + mouse.x = e.offsetX / window.innerWidth; + mouse.y = e.offsetY / window.innerHeight; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); +} + +function animate() { + if (params.animated) { + box.rotation.x += 0.001; + box.rotation.y += 0.002; + box2.rotation.x += 0.001; + box2.rotation.y += 0.002; + } + + renderTarget.samples = params.multisampling ? 4 : 1; + + renderer.setRenderTarget(renderTarget); + renderer.render(scene, camera); + + renderer.setRenderTarget(null); + quadMesh.render(renderer); +} diff --git a/examples-testing/examples/webgpu_occlusion.ts b/examples-testing/examples/webgpu_occlusion.ts new file mode 100644 index 000000000..376dc987d --- /dev/null +++ b/examples-testing/examples/webgpu_occlusion.ts @@ -0,0 +1,97 @@ +import * as THREE from 'three/webgpu'; +import { uniform } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, controls; + +class OcclusionNode extends THREE.Node { + constructor(testObject, normalColor, occludedColor) { + super('vec3'); + + this.updateType = THREE.NodeUpdateType.OBJECT; + + this.uniformNode = uniform(new THREE.Color()); + + this.testObject = testObject; + this.normalColor = normalColor; + this.occludedColor = occludedColor; + } + + async update(frame) { + const isOccluded = frame.renderer.isOccluded(this.testObject); + + this.uniformNode.value.copy(isOccluded ? this.occludedColor : this.normalColor); + } + + setup(/* builder */) { + return this.uniformNode; + } +} + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.z = 7; + + scene = new THREE.Scene(); + + // lights + + const ambientLight = new THREE.AmbientLight(0xb0b0b0); + + const light = new THREE.DirectionalLight(0xffffff, 1.0); + light.position.set(0.32, 0.39, 0.7); + + scene.add(ambientLight); + scene.add(light); + + // models + + const planeGeometry = new THREE.PlaneGeometry(2, 2); + const sphereGeometry = new THREE.SphereGeometry(0.5); + + const plane = new THREE.Mesh( + planeGeometry, + new THREE.MeshPhongNodeMaterial({ color: 0x00ff00, side: THREE.DoubleSide }), + ); + const sphere = new THREE.Mesh(sphereGeometry, new THREE.MeshPhongNodeMaterial({ color: 0xffff00 })); + + const instanceUniform = new OcclusionNode(sphere, new THREE.Color(0x0000ff), new THREE.Color(0x00ff00)); + + plane.material.colorNode = instanceUniform; + + sphere.position.z = -1; + sphere.occlusionTest = true; + + scene.add(plane); + scene.add(sphere); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 3; + controls.maxDistance = 25; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_ocean.ts b/examples-testing/examples/webgpu_ocean.ts new file mode 100644 index 000000000..a7939461e --- /dev/null +++ b/examples-testing/examples/webgpu_ocean.ts @@ -0,0 +1,181 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { WaterMesh } from 'three/addons/objects/WaterMesh.js'; +import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; + +let container; +let camera, scene, renderer, renderPipeline; +let controls, water, sun, sky, mesh, bloomPass; + +init(); + +function init() { + container = document.getElementById('container'); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.1; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 1, 20000); + camera.position.set(30, 30, 100); + + // Post-processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode('output'); + + bloomPass = bloom(scenePassColor); + bloomPass.threshold.value = 0; + bloomPass.strength.value = 0.1; + bloomPass.radius.value = 0; + + renderPipeline.outputNode = scenePassColor.add(bloomPass); + + // + + sun = new THREE.Vector3(); + + // Water + + const waterGeometry = new THREE.PlaneGeometry(10000, 10000); + const loader = new THREE.TextureLoader(); + const waterNormals = loader.load('textures/waternormals.jpg'); + waterNormals.wrapS = waterNormals.wrapT = THREE.RepeatWrapping; + + water = new WaterMesh(waterGeometry, { + waterNormals: waterNormals, + sunDirection: new THREE.Vector3(), + sunColor: 0xffffff, + waterColor: 0x001e0f, + distortionScale: 3.7, + }); + + water.rotation.x = -Math.PI / 2; + + scene.add(water); + + // Skybox + + sky = new SkyMesh(); + sky.scale.setScalar(10000); + scene.add(sky); + + sky.turbidity.value = 10; + sky.rayleigh.value = 2; + sky.mieCoefficient.value = 0.005; + sky.mieDirectionalG.value = 0.8; + sky.cloudCoverage.value = 0.4; + sky.cloudDensity.value = 0.5; + sky.cloudElevation.value = 0.5; + + const parameters = { + elevation: 2, + azimuth: 180, + exposure: 0.1, + }; + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + const sceneEnv = new THREE.Scene(); + + let renderTarget; + + function updateSun() { + const phi = THREE.MathUtils.degToRad(90 - parameters.elevation); + const theta = THREE.MathUtils.degToRad(parameters.azimuth); + + sun.setFromSphericalCoords(1, phi, theta); + + sky.sunPosition.value.copy(sun); + water.sunDirection.value.copy(sun).normalize(); + + if (renderTarget !== undefined) renderTarget.dispose(); + + sceneEnv.add(sky); + renderTarget = pmremGenerator.fromScene(sceneEnv); + scene.add(sky); + + scene.environment = renderTarget.texture; + } + + renderer.init().then(updateSun); + + // + + const geometry = new THREE.BoxGeometry(30, 30, 30); + const material = new THREE.MeshStandardMaterial({ roughness: 0 }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI * 0.495; + controls.target.set(0, 10, 0); + controls.minDistance = 40.0; + controls.maxDistance = 200.0; + controls.update(); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + + const folderSky = gui.addFolder('Sky'); + folderSky.add(parameters, 'elevation', 0, 90, 0.1).onChange(updateSun); + folderSky.add(parameters, 'azimuth', -180, 180, 0.1).onChange(updateSun); + folderSky.add(parameters, 'exposure', 0, 1, 0.0001).onChange(function (value) { + renderer.toneMappingExposure = value; + }); + + const folderWater = gui.addFolder('Water'); + folderWater.add(water.distortionScale, 'value', 0, 8, 0.1).name('distortionScale'); + folderWater.add(water.size, 'value', 0.1, 10, 0.1).name('size'); + + const folderBloom = gui.addFolder('Bloom'); + folderBloom.add(bloomPass.strength, 'value', 0, 3, 0.01).name('strength'); + folderBloom.add(bloomPass.radius, 'value', 0, 1, 0.01).name('radius'); + + const folderClouds = gui.addFolder('Clouds'); + folderClouds.add(sky.cloudCoverage, 'value', 0, 1, 0.01).name('coverage'); + folderClouds.add(sky.cloudDensity, 'value', 0, 1, 0.01).name('density'); + folderClouds.add(sky.cloudElevation, 'value', 0, 1, 0.01).name('elevation'); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + const time = performance.now() * 0.001; + + mesh.position.y = Math.sin(time) * 20 + 5; + mesh.rotation.x = time * 0.5; + mesh.rotation.z = time * 0.51; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_oit.ts b/examples-testing/examples/webgpu_oit.ts new file mode 100644 index 000000000..3818d8a00 --- /dev/null +++ b/examples-testing/examples/webgpu_oit.ts @@ -0,0 +1,148 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; +import { oitPass } from 'three/addons/tsl/display/OITPassNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let renderPipeline, scenePassOIT, scenePass; +let spheres, controls; + +const transparentMaterials = []; + +const params = { + oit: true, + opacity: 0.5, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(8, 4, 10); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x202020); + + // lights + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 1.5); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 2.5); + dirLight.position.set(4, 10, 6); + scene.add(dirLight); + + // opaque center object + + const torusKnot = new THREE.Mesh( + new THREE.TorusKnotGeometry(1, 0.4, 128, 32), + new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.2 }), + ); + scene.add(torusKnot); + + // intersecting transparent planes. no draw order can resolve them correctly + // with sorting-based transparency + + const planeGeometry = new THREE.PlaneGeometry(6, 6); + const planeColors = [0xff4030, 0x30d060, 0x3070ff]; + + for (let i = 0; i < planeColors.length; i++) { + const material = new THREE.MeshStandardMaterial({ + color: planeColors[i], + roughness: 0.5, + transparent: true, + opacity: params.opacity, + side: THREE.DoubleSide, + }); + transparentMaterials.push(material); + + const plane = new THREE.Mesh(planeGeometry, material); + plane.rotation.y = (i / planeColors.length) * Math.PI; + scene.add(plane); + } + + // orbiting transparent spheres. their sort order flips while they rotate + // which results in popping with sorting-based transparency + + spheres = new THREE.Group(); + + const sphereGeometry = new THREE.SphereGeometry(0.8, 32, 16); + const sphereColors = [0xffc020, 0xd040d0, 0x40c0d0, 0xa0d040]; + + for (let i = 0; i < sphereColors.length; i++) { + const material = new THREE.MeshStandardMaterial({ + color: sphereColors[i], + roughness: 0.3, + transparent: true, + opacity: params.opacity, + }); + transparentMaterials.push(material); + + const sphere = new THREE.Mesh(sphereGeometry, material); + + const angle = (i / sphereColors.length) * Math.PI * 2; + sphere.position.set(Math.cos(angle) * 2.5, 0, Math.sin(angle) * 2.5); + + spheres.add(sphere); + } + + scene.add(spheres); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + scenePassOIT = oitPass(scene, camera); + scenePass = pass(scene, camera); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = scenePassOIT; + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.enableDamping = true; + controls.minDistance = 5; + controls.maxDistance = 25; + + // + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(params, 'oit').onChange(value => { + renderPipeline.outputNode = value === true ? scenePassOIT : scenePass; + renderPipeline.needsUpdate = true; + }); + + gui.add(params, 'opacity', 0, 1).onChange(value => { + for (const material of transparentMaterials) { + material.opacity = value; + } + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_parallax_uv.ts b/examples-testing/examples/webgpu_parallax_uv.ts new file mode 100644 index 000000000..b6282d89f --- /dev/null +++ b/examples-testing/examples/webgpu_parallax_uv.ts @@ -0,0 +1,135 @@ +import * as THREE from 'three/webgpu'; +import { texture, parallaxUV, blendOverlay, uv, normalMap, uniform } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +let controls; + +init(); + +async function init() { + // scene + + scene = new THREE.Scene(); + + // camera + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(15, 7, 15); + + // environment + + const environmentTexture = await new HDRLoader().loadAsync('./textures/equirectangular/752-hdri-skies-com_1k.hdr'); + + environmentTexture.mapping = THREE.EquirectangularReflectionMapping; + + scene.environment = environmentTexture; + scene.background = environmentTexture; + scene.backgroundBlurriness = 0.4; + + // textures + + const loader = new THREE.TextureLoader(); + + const topTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_Color.jpg'); + topTexture.colorSpace = THREE.SRGBColorSpace; + topTexture.wrapS = THREE.RepeatWrapping; + topTexture.wrapT = THREE.RepeatWrapping; + + const roughnessTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_Roughness.jpg'); + roughnessTexture.colorSpace = THREE.NoColorSpace; + roughnessTexture.wrapS = THREE.RepeatWrapping; + roughnessTexture.wrapT = THREE.RepeatWrapping; + + const normalTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_NormalGL.jpg'); + normalTexture.colorSpace = THREE.NoColorSpace; + normalTexture.wrapS = THREE.RepeatWrapping; + normalTexture.wrapT = THREE.RepeatWrapping; + + const displaceTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_Displacement.jpg'); + displaceTexture.colorSpace = THREE.NoColorSpace; + displaceTexture.wrapS = THREE.RepeatWrapping; + displaceTexture.wrapT = THREE.RepeatWrapping; + + // + + const bottomTexture = await loader.loadAsync('textures/ambientcg/Ice003_1K-JPG_Color.jpg'); + bottomTexture.colorSpace = THREE.SRGBColorSpace; + bottomTexture.wrapS = THREE.RepeatWrapping; + bottomTexture.wrapT = THREE.RepeatWrapping; + + // parallax effect + + const scaleUV = uniform(3); + const scaledUV = uv().mul(scaleUV); + + const parallaxScale = uniform(0.5); // parallax scale + const offsetUV = texture(displaceTexture, scaledUV).mul(parallaxScale); + + const parallaxUVOffset = parallaxUV(scaledUV, offsetUV); + const parallaxResult = texture(bottomTexture, parallaxUVOffset); + + const iceNode = blendOverlay(texture(topTexture, scaledUV), parallaxResult); + + // material + + const material = new THREE.MeshStandardNodeMaterial(); + material.colorNode = iceNode.mul(5); // increase the color intensity to 5 ( contrast ) + material.roughnessNode = texture(roughnessTexture, scaledUV); + material.normalNode = normalMap(texture(normalTexture, scaledUV)); + material.metalness = 0; + + const geometry = new THREE.CircleGeometry(25, 64); + + const ground = new THREE.Mesh(geometry, material); + ground.rotateX(-Math.PI / 2); + scene.add(ground); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ReinhardToneMapping; + renderer.toneMappingExposure = 6; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // gui + + const gui = renderer.inspector.createParameters('Scene'); + gui.add(scene, 'backgroundBlurriness', 0, 1).name('Background Blurriness'); + gui.add(parallaxScale, 'value', 0.2, 0.5).name('Parallax Scale'); + gui.add(scaleUV, 'value', 1, 5).name('UV Scale'); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0, 0); + controls.maxDistance = 40; + controls.minDistance = 10; + controls.autoRotate = true; + controls.autoRotateSpeed = -1; + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_particles.ts b/examples-testing/examples/webgpu_particles.ts new file mode 100644 index 000000000..9e81f0761 --- /dev/null +++ b/examples-testing/examples/webgpu_particles.ts @@ -0,0 +1,151 @@ +import * as THREE from 'three/webgpu'; +import { range, texture, mix, uv, color, rotateUV, positionLocal, time, uniform } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let camera, scene, renderer; +let controls; + +init(); + +function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + const { innerWidth, innerHeight } = window; + + camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 1, 5000); + camera.position.set(1300, 500, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x333333); + + // textures + + const textureLoader = new THREE.TextureLoader(); + const map = textureLoader.load('textures/opengameart/smoke1.png'); + + // create nodes + + const lifeRange = range(0.1, 1); + const offsetRange = range(new THREE.Vector3(-2, 3, -2), new THREE.Vector3(2, 5, 2)); + + const speed = uniform(0.2); + const scaledTime = time.add(5).mul(speed); + + const lifeTime = scaledTime.mul(lifeRange).mod(1); + const scaleRange = range(0.3, 2); + const rotateRange = range(0.1, 4); + + const life = lifeTime.div(lifeRange); + + const fakeLightEffect = positionLocal.y.oneMinus().max(0.2); + + const textureNode = texture(map, rotateUV(uv(), scaledTime.mul(rotateRange))); + + const opacityNode = textureNode.a.mul(life.oneMinus()); + + const smokeColor = mix(color(0x2c1501), color(0x222222), positionLocal.y.mul(3).clamp()); + + // create particles + + const smokeNodeMaterial = new THREE.SpriteNodeMaterial(); + smokeNodeMaterial.colorNode = mix(color(0xf27d0c), smokeColor, life.mul(2.5).min(1)).mul(fakeLightEffect); + smokeNodeMaterial.opacityNode = opacityNode; + smokeNodeMaterial.positionNode = offsetRange.mul(lifeTime); + smokeNodeMaterial.scaleNode = scaleRange.mul(lifeTime.max(0.3)); + smokeNodeMaterial.depthWrite = false; + + const smokeInstancedSprite = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), smokeNodeMaterial); + smokeInstancedSprite.scale.setScalar(400); + smokeInstancedSprite.count = 2000; + scene.add(smokeInstancedSprite); + + // + + const fireGeometry = new THREE.PlaneGeometry(1, 1); + const fireCount = 1000; + + const fireNodeMaterial = new THREE.SpriteNodeMaterial(); + fireNodeMaterial.colorNode = mix(color(0xb72f17), color(0xb72f17), life); + fireNodeMaterial.positionNode = range(new THREE.Vector3(-1, 1, -1), new THREE.Vector3(1, 2, 1)).mul(lifeTime); + fireNodeMaterial.scaleNode = smokeNodeMaterial.scaleNode; + fireNodeMaterial.opacityNode = opacityNode.mul(0.5); + fireNodeMaterial.blending = THREE.AdditiveBlending; + fireNodeMaterial.transparent = true; + fireNodeMaterial.depthWrite = false; + + const fireInstancedSprite = new THREE.Mesh(fireGeometry, fireNodeMaterial); + fireInstancedSprite.scale.setScalar(400); + fireInstancedSprite.count = fireCount; + fireInstancedSprite.position.y = -100; + fireInstancedSprite.renderOrder = 1; + scene.add(fireInstancedSprite); + + // indirect draw ( optional ) + // each indirect draw call is 5 uint32 values for indexes ( different structure for non-indexed draw calls using 4 uint32 values ) + + const indexCount = fireGeometry.index.array.length; + + const uint32 = new Uint32Array(5); + uint32[0] = indexCount; // indexCount + uint32[1] = fireCount; // instanceCount + uint32[2] = 0; // firstIndex + uint32[3] = 0; // baseVertex + uint32[4] = 0; // firstInstance + + const indirectAttribute = new THREE.IndirectStorageBufferAttribute(uint32, 5); + fireGeometry.setIndirect(indirectAttribute); + + // + + const helper = new THREE.GridHelper(3000, 40, 0x444444, 0x444444); + helper.position.y = -75; + scene.add(helper); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxDistance = 2700; + controls.target.set(0, 500, 0); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(speed, 'value', 0, 1, 0.01).name('speed'); +} + +function onWindowResize() { + const { innerWidth, innerHeight } = window; + + camera.aspect = innerWidth / innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(innerWidth, innerHeight); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_particles_soft.ts b/examples-testing/examples/webgpu_particles_soft.ts new file mode 100644 index 000000000..5aada557b --- /dev/null +++ b/examples-testing/examples/webgpu_particles_soft.ts @@ -0,0 +1,153 @@ +import * as THREE from 'three/webgpu'; +import { float, range, texture, mix, uv, color, rotateUV, positionLocal, time, uniform } from 'three/tsl'; +import { softParticles } from 'three/addons/tsl/utils/SoftParticles.js'; + +import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(6, 8, 8); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + scene.fog = new THREE.FogExp2(0x000000, 0.025); + + // lights + + scene.add(new THREE.AmbientLight(0xffffff, 0.25)); + + const spotLight = new THREE.SpotLight(0xffffff, 800); + spotLight.position.set(10, 15, 8); + spotLight.target.position.set(0, 4, 0); + spotLight.angle = 0.5; + spotLight.penumbra = 0.7; + spotLight.distance = 0; + + scene.add(spotLight); + + // + + const loader = new PLYLoader(); + loader.load('./models/ply/binary/Lucy100k.ply', function (geometry) { + geometry.computeVertexNormals(); + + const material = new THREE.MeshStandardMaterial(); + const mesh = new THREE.Mesh(geometry, material); + + mesh.position.y = 4; + mesh.rotation.y = Math.PI; + mesh.scale.multiplyScalar(0.005); + + scene.add(mesh); + }); + + const groundMaterial = new THREE.MeshStandardNodeMaterial({ color: 0x444444, roughness: 1 }); + const ground = new THREE.Mesh(new THREE.PlaneGeometry(100, 100), groundMaterial); + ground.rotation.x = -Math.PI / 2; + scene.add(ground); + + // smoke texture + + const textureLoader = new THREE.TextureLoader(); + const map = textureLoader.load('textures/opengameart/smoke1.png'); + map.colorSpace = THREE.SRGBColorSpace; + + // simple smoke particle system + + const lifeRange = range(0.1, 1); + const offsetRange = range(new THREE.Vector3(-2, 0, -2), new THREE.Vector3(2, 7, 2)); + + const speed = float(0.2); + const scaledTime = time.add(20).mul(speed); + + const lifeTime = scaledTime.mul(lifeRange).mod(1); + const scaleRange = range(6, 8); + const rotateRange = range(0.1, 2); + + const life = lifeTime.div(lifeRange); + + const textureNode = texture(map, rotateUV(uv(), scaledTime.mul(rotateRange))); + + const fade = life.smoothstep(0, 0.3).mul(life.smoothstep(1, 0.7)); + + // soft particles + + const softEnabled = uniform(1); // 0 = hard particles, 1 = soft particles + const softDistance = uniform(1); // world-space fade distance + const softContrast = uniform(2); + + const baseOpacity = textureNode.a.mul(fade); + + const smokeOpacity = mix( + baseOpacity, + softParticles({ + opacity: baseOpacity, + distance: softDistance, + contrast: softContrast, + }), + softEnabled, + ); + + const smokeColor = mix(color(0x6f6f6f), color(0x303030), positionLocal.y.mul(0.1).clamp()); + + // instanced sprites + + const smokeMaterial = new THREE.SpriteNodeMaterial(); + smokeMaterial.colorNode = smokeColor; + smokeMaterial.opacityNode = smokeOpacity; + smokeMaterial.positionNode = offsetRange.mul(lifeTime); + smokeMaterial.scaleNode = scaleRange.mul(lifeTime.max(0.3)); + smokeMaterial.depthWrite = false; + + const smoke = new THREE.Sprite(smokeMaterial); + smoke.count = 50; + smoke.frustumCulled = false; + scene.add(smoke); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 6; + controls.maxDistance = 20; + controls.target.set(0, 4, 0); + controls.enableDamping = true; + controls.update(); + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(softEnabled, 'value', { hard: 0, soft: 1 }).name('mode'); + gui.add(softDistance, 'value', 0.1, 2, 0.01).name('soft distance'); + gui.add(softContrast, 'value', 1, 6, 0.01).name('soft contrast'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_performance.ts b/examples-testing/examples/webgpu_performance.ts new file mode 100644 index 000000000..595965a6c --- /dev/null +++ b/examples-testing/examples/webgpu_performance.ts @@ -0,0 +1,101 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +let camera, scene, renderer; +let model; + +const options = { static: true }; + +init(); + +function setStatic(object, value) { + object.traverse(child => { + if (child.isMesh) { + child.static = value; + } + }); +} + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(60, 60, 60); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + // + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.environment = texture; + + // model + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const loader = new GLTFLoader().setPath('models/gltf/'); + loader.setDRACOLoader(dracoLoader); + + loader.load('dungeon_warkarma.glb', async function (gltf) { + model = gltf.scene; + + // wait until the model can be added to the scene without blocking due to shader compilation + + await renderer.compileAsync(model, camera, scene); + + scene.add(model); + + // + + setStatic(model, options.static); + }); + }); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 60; + controls.target.set(0, 0, -0.2); + controls.update(); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(options, 'static').onChange(() => { + setStatic(model, options.static); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_performance_renderbundle.ts b/examples-testing/examples/webgpu_performance_renderbundle.ts new file mode 100644 index 000000000..303b02e3f --- /dev/null +++ b/examples-testing/examples/webgpu_performance_renderbundle.ts @@ -0,0 +1,229 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; +let controls; +let gui; +let geometries, group, instancedMesh; + +// + +const position = new THREE.Vector3(); +const rotation = new THREE.Euler(); +const quaternion = new THREE.Quaternion(); +const scale = new THREE.Vector3(); + +const instanceMatrix = new THREE.Matrix4(); +const rotationMatrix = new THREE.Matrix4(); + +// + +const api = { + webgpu: true, + renderBundle: true, + count: 4000, + opacity: 1, + dynamic: false, +}; + +init(); + +// + +function randomizeMatrix(matrix) { + position.x = Math.random() * 80 - 40; + position.y = Math.random() * 80 - 40; + position.z = Math.random() * 80 - 40; + + rotation.x = Math.random() * 2 * Math.PI; + rotation.y = Math.random() * 2 * Math.PI; + rotation.z = Math.random() * 2 * Math.PI; + + quaternion.setFromEuler(rotation); + + scale.x = scale.y = scale.z = 0.35 + Math.random() * 0.5; + + return matrix.compose(position, quaternion, scale); +} + +function randomizeRotationSpeed(rotation) { + rotation.x = Math.random() * 0.05; + rotation.y = Math.random() * 0.05; + rotation.z = Math.random() * 0.05; + return rotation; +} + +function initGeometries() { + geometries = [ + new THREE.ConeGeometry(1.0, 2.0, 3, 1), + new THREE.BoxGeometry(2.0, 2.0, 2.0), + new THREE.PlaneGeometry(2.0, 2, 1, 1), + new THREE.CapsuleGeometry(), + new THREE.CircleGeometry(1.0, 3), + new THREE.CylinderGeometry(1.0, 1.0, 2.0, 3, 1), + new THREE.DodecahedronGeometry(1.0, 0), + new THREE.IcosahedronGeometry(1.0, 0), + new THREE.OctahedronGeometry(1.0, 0), + new THREE.PolyhedronGeometry([0, 0, 0], [0, 0, 0], 1, 0), + new THREE.RingGeometry(1.0, 1.5, 3), + new THREE.SphereGeometry(1.0, 3, 2), + new THREE.TetrahedronGeometry(1.0, 0), + new THREE.TorusGeometry(1.0, 0.5, 3, 3), + new THREE.TorusKnotGeometry(1.0, 0.5, 20, 3, 1, 1), + ]; +} + +function initMesh(count) { + group = api.renderBundle ? new THREE.BundleGroup() : new THREE.Group(); + + for (let i = 0; i < count; i++) { + const material = new THREE.MeshToonNodeMaterial({ + color: new THREE.Color(Math.random() * 0xffffff), + side: THREE.DoubleSide, + }); + + const child = new THREE.Mesh(geometries[i % geometries.length], material); + randomizeMatrix(child.matrix); + child.matrix.decompose(child.position, child.quaternion, child.scale); + child.userData.rotationSpeed = randomizeRotationSpeed(new THREE.Euler()); + child.frustumCulled = false; + group.add(child); + } + + // instanced meshes are supported inside a bundle group, too + + instancedMesh = new THREE.InstancedMesh(geometries[0], new THREE.MeshToonNodeMaterial(), 10); + instancedMesh.userData.rotationSpeeds = []; + + const matrix = new THREE.Matrix4(); + + for (let i = 0; i < instancedMesh.count; i++) { + randomizeMatrix(matrix); + instancedMesh.setMatrixAt(i, matrix); + + instancedMesh.userData.rotationSpeeds.push(randomizeRotationSpeed(new THREE.Euler())); + } + + group.add(instancedMesh); + + // + + scene.add(group); +} + +function init() { + const searchParams = new URLSearchParams(window.location.search); + api.webgpu = searchParams.get('backend') !== 'webgl'; + api.renderBundle = searchParams.get('renderBundle') !== 'false'; + api.count = parseFloat(searchParams.get('count') || 4000); + + const count = api.count; + + // camera + + const aspect = window.innerWidth / window.innerHeight; + + camera = new THREE.PerspectiveCamera(70, aspect, 1, 100); + camera.position.z = 50; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL: !api.webgpu }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(animate); + + // scene + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xc1c1c1); + + const light = new THREE.DirectionalLight(0xffffff, 3.4); + scene.add(light); + + document.body.appendChild(renderer.domElement); + + initGeometries(); + initMesh(count); + + controls = new OrbitControls(camera, renderer.domElement); + controls.autoRotate = true; + controls.autoRotateSpeed = 1.0; + + // gui + + gui = renderer.inspector.createParameters('Settings'); + gui.add(api, 'renderBundle').name('render bundle').onChange(reload); + + gui.add(api, 'webgpu').onChange(reload); + + gui.add(api, 'dynamic').onChange(() => { + group.static = !group.static; + }); + + // listeners + + window.addEventListener('resize', onWindowResize); + + function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); + group.needsUpdate = true; + } + + function reload() { + const backendParam = 'backend=' + (api.webgpu ? 'webgpu' : 'webgl'); + const renderBundleParam = '&renderBundle=' + (api.renderBundle ? 'true' : 'false'); + const countParam = '&count=' + api.count; + + location.href = location.pathname + '?' + backendParam + renderBundleParam + countParam; // relative redirect with parameters + } + + function animate() { + animateMeshes(); + + controls.update(); + + renderer.render(scene, camera); + } + + function animateMeshes() { + if (api.dynamic === false) return; + + // rotate the regular meshes + + for (let i = 0; i < api.count; i++) { + const child = group.children[i]; + const rotationSpeed = child.userData.rotationSpeed; + + child.rotation.set( + child.rotation.x + rotationSpeed.x, + child.rotation.y + rotationSpeed.y, + child.rotation.z + rotationSpeed.z, + ); + } + + // rotate each instance of the instanced mesh individually + + const rotationSpeeds = instancedMesh.userData.rotationSpeeds; + + for (let i = 0; i < instancedMesh.count; i++) { + rotationMatrix.makeRotationFromEuler(rotationSpeeds[i]); + + instancedMesh.getMatrixAt(i, instanceMatrix); + instanceMatrix.multiply(rotationMatrix); + instancedMesh.setMatrixAt(i, instanceMatrix); + } + + instancedMesh.instanceMatrix.needsUpdate = true; + } +} diff --git a/examples-testing/examples/webgpu_pmrem_cubemap.ts b/examples-testing/examples/webgpu_pmrem_cubemap.ts new file mode 100644 index 000000000..bd751ba33 --- /dev/null +++ b/examples-testing/examples/webgpu_pmrem_cubemap.ts @@ -0,0 +1,75 @@ +import * as THREE from 'three/webgpu'; +import { normalWorldGeometry, uniform, pmremTexture } from 'three/tsl'; + +import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(0, 0, 8); + + scene = new THREE.Scene(); + + const forceWebGL = false; + + renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + await renderer.init(); + + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.update(); + + new HDRCubeTextureLoader() + .setPath('./textures/cube/pisaHDR/') + .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (map) { + scene.backgroundNode = pmremTexture(map, normalWorldGeometry, uniform(0.5)); + + const geometry = new THREE.SphereGeometry(0.4, 64, 64); + + for (let i = 0; i < 6; i++) { + for (let j = 0; j < 5; j++) { + const material = new THREE.MeshPhysicalNodeMaterial({ + roughness: i / 5, + metalness: j / 4, + envMap: map, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = i - 2.5; + mesh.position.y = j - 2; + scene.add(mesh); + } + } + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_pmrem_equirectangular.ts b/examples-testing/examples/webgpu_pmrem_equirectangular.ts new file mode 100644 index 000000000..76f8326d3 --- /dev/null +++ b/examples-testing/examples/webgpu_pmrem_equirectangular.ts @@ -0,0 +1,75 @@ +import * as THREE from 'three/webgpu'; +import { normalWorldGeometry, uniform, pmremTexture } from 'three/tsl'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(0, 0, 8); + + scene = new THREE.Scene(); + + const forceWebGL = false; + + renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + + await renderer.init(); + + container.appendChild(renderer.domElement); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.update(); + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (map) { + map.mapping = THREE.EquirectangularReflectionMapping; + + scene.backgroundNode = pmremTexture(map, normalWorldGeometry, uniform(0.5)); + + const geometry = new THREE.SphereGeometry(0.4, 64, 64); + + for (let i = 0; i < 6; i++) { + for (let j = 0; j < 5; j++) { + const material = new THREE.MeshPhysicalNodeMaterial({ + roughness: i / 5, + metalness: j / 4, + envMap: map, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = i - 2.5; + mesh.position.y = j - 2; + scene.add(mesh); + } + } + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_pmrem_scene.ts b/examples-testing/examples/webgpu_pmrem_scene.ts new file mode 100644 index 000000000..deab005fc --- /dev/null +++ b/examples-testing/examples/webgpu_pmrem_scene.ts @@ -0,0 +1,106 @@ +import * as THREE from 'three/webgpu'; +import { normalWorld, uniform, pmremTexture } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + const forceWebGL = false; + + renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + await renderer.init(); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.addEventListener('change', render); // use if there is no animation loop + controls.minDistance = 2; + controls.maxDistance = 10; + controls.update(); + + // + const loader = new THREE.CubeTextureLoader().setPath('./textures/cube/Park3Med/'); + + scene.background = await loader.loadAsync(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); + + let model; + + model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0x0000ff })); + model.position.z -= 1; + scene.add(model); + + model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0xff0000 })); + model.position.z += 1; + scene.add(model); + + model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0xff00ff })); + model.position.x += 1; + scene.add(model); + + model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0x00ffff })); + model.position.x -= 1; + scene.add(model); + + model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0xffff00 })); + model.position.y -= 1; + scene.add(model); + + model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0x00ff00 })); + model.position.y += 1; + scene.add(model); + + //while ( scene.children.length > 0 ) scene.remove( scene.children[ 0 ] ); + + const sceneRT = new THREE.PMREMGenerator(renderer).fromScene(scene); + + // + + const pmremRoughness = uniform(0.5); + const pmremNode = pmremTexture(sceneRT.texture, normalWorld, pmremRoughness); + + scene.add( + new THREE.Mesh( + new THREE.SphereGeometry(0.5, 64, 64), + new THREE.MeshBasicNodeMaterial({ colorNode: pmremNode }), + ), + ); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(pmremRoughness, 'value', 0, 1, 0.001) + .name('roughness') + .onChange(() => render()); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_pmrem_test.ts b/examples-testing/examples/webgpu_pmrem_test.ts new file mode 100644 index 000000000..3e1ea3ef9 --- /dev/null +++ b/examples-testing/examples/webgpu_pmrem_test.ts @@ -0,0 +1,138 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let scene, camera, controls, renderer; + +async function init() { + const width = window.innerWidth; + const height = window.innerHeight; + const aspect = width / height; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(render); + renderer.inspector = new Inspector(); + + // tonemapping + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + await renderer.init(); + + // scene + + scene = new THREE.Scene(); + + // camera + + camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); + updateCamera(); + camera.position.set(0, 0, 16); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 4; + controls.maxDistance = 20; + + // light + + const directionalLight = new THREE.DirectionalLight(0xffffff, 0); // set intensity to 0 to start + const x = 597; + const y = 213; + const theta = ((x + 0.5) * Math.PI) / 512; + const phi = ((y + 0.5) * Math.PI) / 512; + + directionalLight.position.setFromSphericalCoords(100, -phi, Math.PI / 2 - theta); + + scene.add(directionalLight); + // scene.add( new THREE.DirectionalLightHelper( directionalLight ) ); + + // The spot1Lux HDR environment map is expressed in nits (lux / sr). The directional light has units of lux, + // so to match a 1 lux light, we set a single pixel with a value equal to 1 divided by the solid + // angle of the pixel in steradians. This image is 1024 x 512, + // so the value is 1 / ( sin( phi ) * ( pi / 512 ) ^ 2 ) = 27,490 nits. + + const gui = renderer.inspector.createParameters('Settings'); + gui.add({ enabled: true }, 'enabled') + .name('PMREM') + .onChange(value => { + directionalLight.intensity = value ? 0 : 1; + + scene.traverse(function (child) { + if (child.isMesh) { + child.material.envMapIntensity = 1 - directionalLight.intensity; + } + }); + }); +} + +function createObjects() { + let radianceMap = null; + new HDRLoader() + // .setDataType( THREE.FloatType ) + .setPath('textures/equirectangular/') + .load('spot1Lux.hdr', function (texture) { + radianceMap = pmremGenerator.fromEquirectangular(texture).texture; + pmremGenerator.dispose(); + + scene.background = radianceMap; + + const geometry = new THREE.SphereGeometry(0.4, 32, 32); + + for (let x = 0; x <= 10; x++) { + for (let y = 0; y <= 2; y++) { + const material = new THREE.MeshPhysicalMaterial({ + roughness: x / 10, + metalness: y < 1 ? 1 : 0, + color: y < 2 ? 0xffffff : 0x000000, + envMap: radianceMap, + envMapIntensity: 1, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = x - 5; + mesh.position.y = 1 - y; + scene.add(mesh); + } + } + }); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + pmremGenerator.compileEquirectangularShader(); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + updateCamera(); + + renderer.setSize(width, height); +} + +function updateCamera() { + const horizontalFoV = 40; + const verticalFoV = + (2 * Math.atan(Math.tan(((horizontalFoV / 2) * Math.PI) / 180) / camera.aspect) * 180) / Math.PI; + camera.fov = verticalFoV; + camera.updateProjectionMatrix(); +} + +function render() { + renderer.render(scene, camera); +} + +Promise.resolve().then(init).then(createObjects); diff --git a/examples-testing/examples/webgpu_portal.ts b/examples-testing/examples/webgpu_portal.ts new file mode 100644 index 000000000..df2e400f3 --- /dev/null +++ b/examples-testing/examples/webgpu_portal.ts @@ -0,0 +1,156 @@ +import * as THREE from 'three/webgpu'; +import { + pass, + color, + mx_worley_noise_float, + time, + screenUV, + vec2, + uv, + normalWorld, + mx_fractal_noise_vec3, +} from 'three/tsl'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, sceneMain, scenePortal, renderer; +let timer; + +const mixers = []; + +init(); + +function init() { + // + + sceneMain = new THREE.Scene(); + sceneMain.background = new THREE.Color(0x222222); + sceneMain.backgroundNode = normalWorld.y.mix(color(0x0066ff), color(0xff0066)); + + scenePortal = new THREE.Scene(); + scenePortal.backgroundNode = mx_worley_noise_float(normalWorld.mul(20).add(vec2(0, time.oneMinus()))).mul( + color(0x0066ff), + ); + scenePortal.name = 'Portal Scene'; + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 30); + camera.position.set(2.5, 1, 3); + camera.position.multiplyScalar(0.8); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + // lights + + const light = new THREE.PointLight(0xffffff, 1); + light.position.set(0, 1, 5); + light.power = 17000; + + sceneMain.add(new THREE.HemisphereLight(0xff0066, 0x0066ff, 7)); + sceneMain.add(light); + scenePortal.add(light.clone()); + + // models + + const loader = new GLTFLoader(); + loader.load('models/gltf/Xbot.glb', function (gltf) { + const createModel = (colorNode = null) => { + let object; + + if (mixers.length === 0) { + object = gltf.scene; + } else { + object = gltf.scene.clone(); + + const children = object.children[0].children; + + const applyFX = index => { + children[index].material = children[index].material.clone(); + children[index].material.colorNode = colorNode; + children[index].material.wireframe = true; + }; + + applyFX(0); + applyFX(1); + } + + const mixer = new THREE.AnimationMixer(object); + + const action = mixer.clipAction(gltf.animations[6]); + action.play(); + + mixers.push(mixer); + + return object; + }; + + const colorNode = mx_fractal_noise_vec3(uv().mul(20).add(time)); + + const modelMain = createModel(); + const modelPortal = createModel(colorNode); + + // model portal + + sceneMain.add(modelMain); + scenePortal.add(modelPortal); + }); + + // portal + + const geometry = new THREE.PlaneGeometry(1.7, 2); + + const material = new THREE.MeshBasicNodeMaterial(); + material.colorNode = pass(scenePortal, camera).context({ getUV: () => screenUV }); + material.opacityNode = uv().distance(0.5).remapClamp(0.3, 0.5).oneMinus(); + material.side = THREE.DoubleSide; + material.transparent = true; + + const plane = new THREE.Mesh(geometry, material); + plane.position.set(0, 1, 0.8); + sceneMain.add(plane); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.LinearToneMapping; + renderer.toneMappingExposure = 0.15; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 1, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + for (const mixer of mixers) { + mixer.update(delta); + } + + renderer.render(sceneMain, camera); +} diff --git a/examples-testing/examples/webgpu_postprocessing.ts b/examples-testing/examples/webgpu_postprocessing.ts new file mode 100644 index 000000000..150ffa0cc --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing.ts @@ -0,0 +1,82 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; +import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js'; +import { rgbShift } from 'three/addons/tsl/display/RGBShiftNode.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, renderer, renderPipeline; +let object; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 400; + + const scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + scene.fog = new THREE.Fog(0x000000, 1, 1000); + + object = new THREE.Object3D(); + scene.add(object); + + const geometry = new THREE.SphereGeometry(1, 4, 4); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); + + for (let i = 0; i < 100; i++) { + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); + mesh.position.multiplyScalar(Math.random() * 400); + mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); + mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 50; + object.add(mesh); + } + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1); + scene.add(light); + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode().toInspector('Scene Color'); + + const dotScreenPass = dotScreen(scenePassColor); + dotScreenPass.scale.value = 0.3; + + const rgbShiftPass = rgbShift(dotScreenPass); + rgbShiftPass.amount.value = 0.001; + + renderPipeline.outputNode = rgbShiftPass; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + object.rotation.x += 0.005; + object.rotation.y += 0.01; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_3dlut.ts b/examples-testing/examples/webgpu_postprocessing_3dlut.ts new file mode 100644 index 000000000..defe54915 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_3dlut.ts @@ -0,0 +1,229 @@ +import * as THREE from 'three/webgpu'; +import { + mix, + mul, + oneMinus, + positionLocal, + smoothstep, + texture, + time, + rotateUV, + Fn, + uv, + vec2, + vec3, + vec4, + pass, + texture3D, + uniform, + renderOutput, +} from 'three/tsl'; +import { lut3D } from 'three/addons/tsl/display/Lut3DNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js'; +import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js'; +import { LUTImageLoader } from 'three/addons/loaders/LUTImageLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const params = { + lut: 'Bourbon 64.CUBE', + intensity: 1, +}; + +const lutMap = { + 'Bourbon 64.CUBE': null, + 'Chemical 168.CUBE': null, + 'Clayton 33.CUBE': null, + 'Cubicle 99.CUBE': null, + 'Remy 24.CUBE': null, + 'Presetpro-Cinematic.3dl': null, + NeutralLUT: null, + 'B&WLUT': null, + NightLUT: null, +}; + +let camera, scene, renderer, renderPipeline, controls, lutPass; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(8, 10, 12); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + // Loaders + + const gltfLoader = new GLTFLoader(); + const textureLoader = new THREE.TextureLoader(); + + // LUTs + + const lutCubeLoader = new LUTCubeLoader(); + const lutImageLoader = new LUTImageLoader(); + const lut3dlLoader = new LUT3dlLoader(); + + for (const name in lutMap) { + if (/\.CUBE$/i.test(name)) { + lutMap[name] = lutCubeLoader.loadAsync('luts/' + name); + } else if (/\LUT$/i.test(name)) { + lutMap[name] = lutImageLoader.loadAsync(`luts/${name}.png`); + } else { + lutMap[name] = lut3dlLoader.loadAsync('luts/' + name); + } + } + + const pendings = Object.values(lutMap); + await Promise.all(pendings); + + for (const name in lutMap) { + lutMap[name] = await lutMap[name]; + } + + // baked model + + gltfLoader.load('./models/gltf/coffeeMug.glb', gltf => { + gltf.scene.getObjectByName('baked').material.map.anisotropy = 8; + scene.add(gltf.scene); + }); + + // geometry + + const smokeGeometry = new THREE.PlaneGeometry(1, 1, 16, 64); + smokeGeometry.translate(0, 0.5, 0); + smokeGeometry.scale(1.5, 6, 1.5); + + // texture + + const noiseTexture = textureLoader.load('./textures/noises/perlin/128x128.png'); + noiseTexture.wrapS = THREE.RepeatWrapping; + noiseTexture.wrapT = THREE.RepeatWrapping; + + // material + + const smokeMaterial = new THREE.MeshBasicNodeMaterial({ + transparent: true, + side: THREE.DoubleSide, + depthWrite: false, + }); + + // position + + smokeMaterial.positionNode = Fn(() => { + // twist + + const twistNoiseUv = vec2(0.5, uv().y.mul(0.2).sub(time.mul(0.005)).mod(1)); + const twist = texture(noiseTexture, twistNoiseUv).r.mul(10); + positionLocal.xz.assign(rotateUV(positionLocal.xz, twist, vec2(0))); + + // wind + + const windOffset = vec2( + texture(noiseTexture, vec2(0.25, time.mul(0.01)).mod(1)).r.sub(0.5), + texture(noiseTexture, vec2(0.75, time.mul(0.01)).mod(1)).r.sub(0.5), + ).mul(uv().y.pow(2).mul(10)); + positionLocal.addAssign(windOffset); + + return positionLocal; + })(); + + // color + + smokeMaterial.colorNode = Fn(() => { + // alpha + + const alphaNoiseUv = uv() + .mul(vec2(0.5, 0.3)) + .add(vec2(0, time.mul(0.03).negate())); + const alpha = mul( + // pattern + texture(noiseTexture, alphaNoiseUv).r.smoothstep(0.4, 1), + + // edges fade + smoothstep(0, 0.1, uv().x), + smoothstep(0, 0.1, oneMinus(uv().x)), + smoothstep(0, 0.1, uv().y), + smoothstep(0, 0.1, oneMinus(uv().y)), + ); + + // color + + const finalColor = mix(vec3(0.6, 0.3, 0.2), vec3(1, 1, 1), alpha.pow(3)); + + return vec4(finalColor, alpha); + })(); + + // mesh + + const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial); + smoke.position.y = 1.83; + scene.add(smoke); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // ignore default output color transform ( toneMapping and outputColorSpace ) + // use renderOutput() for control the sequence + + renderPipeline.outputColorTransform = false; + + // scene pass + + const scenePass = pass(scene, camera); + const outputPass = renderOutput(scenePass); + + const lut = lutMap[params.lut]; + lutPass = lut3D(outputPass, texture3D(lut.texture3D), lut.texture3D.image.width, uniform(1)); + + renderPipeline.outputNode = lutPass; + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + controls.target.y = 3; + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'lut', Object.keys(lutMap)); + gui.add(params, 'intensity', 0, 1); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + controls.update(); + + lutPass.intensityNode.value = params.intensity; + + if (lutMap[params.lut]) { + const lut = lutMap[params.lut]; + lutPass.lutNode.value = lut.texture3D; + lutPass.size.value = lut.texture3D.image.width; + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_afterimage.ts b/examples-testing/examples/webgpu_postprocessing_afterimage.ts new file mode 100644 index 000000000..0d21da69a --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_afterimage.ts @@ -0,0 +1,152 @@ +import * as THREE from 'three/webgpu'; +import { + instancedBufferAttribute, + uniform, + mod, + pass, + texture, + float, + time, + vec2, + vec3, + vec4, + sin, + cos, +} from 'three/tsl'; +import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, particles; +let renderPipeline, afterImagePass, scenePass; + +const params = { + damp: uniform(0.8, 'float').setName('damp'), + enabled: true, +}; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 1000; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + const sprite = new THREE.TextureLoader().load('textures/sprites/circle.png'); + + // geometry + + const radius = 600; + const count = 50000; + + const vertex = new THREE.Vector3(); + const color = new THREE.Color(); + + const colors = []; + const vertices = []; + const timeOffsets = []; + + for (var i = 0; i < count; i++) { + getRandomPointOnSphere(radius, vertex); + vertices.push(vertex.x, vertex.y, vertex.z); + + color.setHSL(i / count, 0.7, 0.7, THREE.SRGBColorSpace); + colors.push(color.r, color.g, color.b); + + timeOffsets.push(i / count); + } + + const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(vertices), 3); + const colorAttribute = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); + const timeAttribute = new THREE.InstancedBufferAttribute(new Float32Array(timeOffsets), 1); + + // material and TSL + + const material = new THREE.SpriteNodeMaterial({ blending: THREE.AdditiveBlending, depthWrite: false }); + + const localTime = instancedBufferAttribute(timeAttribute).add(time.mul(0.1)); + const modTime = mod(localTime, 1.0); + const accTime = modTime.mul(modTime); + + const angle = accTime.mul(40.0); + const pulse = vec2(sin(angle).mul(20.0), cos(angle).mul(20.0)); + const pos = instancedBufferAttribute(positionAttribute); + + const animated = vec3( + pos.x.mul(accTime).add(pulse.x), + pos.y.mul(accTime).add(pulse.y), + pos.z.mul(accTime).mul(1.75), + ); + const fAlpha = modTime.oneMinus().mul(2.0); + + material.colorNode = texture(sprite).mul(vec4(instancedBufferAttribute(colorAttribute), fAlpha)); + material.positionNode = animated; + material.scaleNode = float(2); + + particles = new THREE.Sprite(material); + particles.count = count; + scene.add(particles); + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + + scenePass = pass(scene, camera); + + afterImagePass = afterImage(scenePass, params.damp); + + renderPipeline.outputNode = afterImagePass; + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(afterImagePass.damp, 'value', 0.25, 1); + gui.add(params, 'enabled').onChange(updatePassChain); + + window.addEventListener('resize', onWindowResize); +} + +function updatePassChain() { + if (params.enabled === true) { + renderPipeline.outputNode = afterImagePass; + } else { + renderPipeline.outputNode = scenePass; + } + + renderPipeline.needsUpdate = true; +} + +function getRandomPointOnSphere(r, v) { + const angle = Math.random() * Math.PI * 2; + const u = Math.random() * 2 - 1; + + v.set( + Math.cos(angle) * Math.sqrt(1 - Math.pow(u, 2)) * r, + Math.sin(angle) * Math.sqrt(1 - Math.pow(u, 2)) * r, + u * r, + ); + + return v; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(time) { + particles.rotation.z = time * 0.001; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_anamorphic.ts b/examples-testing/examples/webgpu_postprocessing_anamorphic.ts new file mode 100644 index 000000000..20118247a --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_anamorphic.ts @@ -0,0 +1,166 @@ +import * as THREE from 'three/webgpu'; +import { + pass, + screenUV, + uniform, + uv, + vec2, + vec3, + color, + Fn, + vec4, + Loop, + float, + mix, + luminance, + smoothstep, + rtt, + time, + viewportSize, + instanceIndex, + positionLocal, +} from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, instancedMesh, controls; +let renderPipeline; + +const _dummy = new THREE.Object3D(); + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 250); + camera.position.set(0, 0, 20); + + scene = new THREE.Scene(); + scene.backgroundNode = Fn(() => { + const dist = screenUV.distance(0.5).mul(2.0); + return mix(color(0x111111), color(0x000000), dist); + })(); + + const timeScale = uniform(0.5); + + const material = new THREE.MeshBasicNodeMaterial({ + color: 0xffffff, + // Animate the spheres up and down continuously using TSL and their instanceIndex as a phase offset + positionNode: positionLocal.add( + vec3(0, time.add(float(instanceIndex).mul(0.5)).mul(timeScale).sin().mul(5.0), 0), + ), + }); + + const maxCount = 200; + + instancedMesh = new THREE.InstancedMesh(new THREE.SphereGeometry(0.1, 32, 32), material, maxCount); + + const _color = new THREE.Color(); + + for (let i = 0; i < maxCount; i++) { + _dummy.position.x = (Math.random() - 0.5) * 20; + _dummy.position.y = (Math.random() - 0.5) * 20; + _dummy.position.z = (Math.random() - 0.5) * 20; + _dummy.updateMatrix(); + instancedMesh.setMatrixAt(i, _dummy.matrix); + + _color.setHex(Math.random() * 0xffffff); + instancedMesh.setColorAt(i, _color); + } + + scene.add(instancedMesh); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1; + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 25; + + // post-processing + + const scenePass = pass(scene, camera); + + const intensity = uniform(5.0); + const tintColor = uniform(new THREE.Color(0x7a8aff)); + const threshold = uniform(0.3); + const radius = uniform(0.0); + const samples = uniform(80); + + const bloomPass = bloom(scenePass.getTextureNode().toInspector('Color'), intensity, radius, threshold); + bloomPass.setResolutionScale(0.25); + + // Custom high pass for anamorphic bloom + bloomPass.highPassFn = Fn(({ input, threshold, smoothWidth }) => { + // Extract bright areas to a texture (computed once, sampled many times) + const v = luminance(input.rgb); + const alpha = smoothstep(threshold, threshold.add(smoothWidth), v); + const brightPass = rtt(mix(vec4(0), input, alpha), null, null, { + wrapS: THREE.MirroredRepeatWrapping, + wrapT: THREE.MirroredRepeatWrapping, + }); + + // Horizontal blur + const total = vec4(0); + const halfSamples = samples.div(2); + + const invSize = vec2(1.0).div(viewportSize); + + Loop({ start: halfSamples.negate(), end: halfSamples }, ({ i }) => { + let softness = float(i).abs().div(halfSamples).oneMinus(); + softness = softness.pow(2.0); + + const shiftedUV = vec2(uv().x.add(invSize.x.mul(i).mul(4.0)), uv().y); + total.addAssign(brightPass.sample(shiftedUV).mul(softness)); + }); + + return total.div(samples.div(3.0)); + }); + + const anamorphicPass = bloomPass.mul(tintColor).toInspector('Anamorphic'); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = scenePass.add(anamorphicPass); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(intensity, 'value', 0, 10).name('intensity'); + gui.add(threshold, 'value', 0, 0.9).name('threshold'); + gui.add(samples, 'value', 2, 128, 1).name('samples'); + gui.addColor(tintColor, 'value').name('tint color'); + gui.add(radius, 'value', 0, 1, 0.01).name('bloom radius'); + gui.add(timeScale, 'value', 0, 1).name('time scale'); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_ao.ts b/examples-testing/examples/webgpu_postprocessing_ao.ts new file mode 100644 index 000000000..ab0a271a1 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_ao.ts @@ -0,0 +1,582 @@ +import * as THREE from 'three/webgpu'; +import { + sample, + pass, + mrt, + screenUV, + normalView, + velocity, + vec3, + vec4, + packNormalToRGB, + unpackRGBToNormal, + colorSpaceToWorking, + builtinAOContext, +} from 'three/tsl'; +import { ao } from 'three/addons/tsl/display/GTAONode.js'; +import { ssao } from 'three/addons/tsl/display/SSAONode.js'; +import { traa } from 'three/addons/tsl/display/TRAANode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline, controls; + +let aoPass, traaPass, transparentMesh; + +const params = { + aoType: 'GTAO', + samples: 16, + radius: 0.4, + resolutionScale: 0.5, + scale: 0.8, // GTAO + thickness: 1, // GTAO + temporalFiltering: true, // GTAO + intensity: 2, // SSAO + bias: 0.025, // SSAO + blurEnabled: true, // SSAO + blurSharpness: 2, // SSAO + aoOnly: false, + transparentOpacity: 0.3, +}; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.set(1, 3, 7); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGPURenderer(); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2; + controls.maxDistance = 16; + controls.target.set(0, 1.2, 0); + + // environment + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.background = new THREE.Color(0x666666); + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + scene.environmentIntensity = 0.3; + environment.dispose(); + pmremGenerator.dispose(); + + // post-processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // pre-pass + + const prePass = pass(scene, camera).toInspector('Normal', inspectNode => + colorSpaceToWorking(inspectNode, THREE.SRGBColorSpace), + ); + prePass.name = 'Pre-Pass'; + prePass.transparent = false; + + prePass.setMRT( + mrt({ + output: packNormalToRGB(normalView), + velocity: velocity, + }), + ); + + const prePassNormal = sample(uv => { + return unpackRGBToNormal(prePass.getTextureNode().sample(uv)); + }); + + const prePassDepth = prePass.getTextureNode('depth').toInspector('Depth', () => prePass.getLinearDepthNode()); + const prePassVelocity = prePass.getTextureNode('velocity').toInspector('Velocity'); + + // pre-pass - bandwidth optimization + + const normalTexture = prePass.getTexture('output'); + normalTexture.type = THREE.UnsignedByteType; + + // scene pass + + const scenePass = pass(scene, camera).toInspector('Color'); + + // traa ( resolves the temporal noise of GTAO ) + + traaPass = traa(scenePass, prePassDepth, prePassVelocity, camera); + traaPass.useSubpixelCorrection = false; + + // ao: the AO node feeds the scene's ambient term via `builtinAOContext`, and + // can be switched between GTAO ( ground-truth, needs temporal denoise ) and the + // cheaper SSAO ( self-denoised ) + + function updateOutput() { + // SSAO is self-denoised so it can skip TRAA and use MSAA for edge anti-aliasing instead + + const useTRAA = params.aoType === 'GTAO'; + + scenePass.options.samples = useTRAA ? 0 : 4; + + renderPipeline.outputNode = params.aoOnly + ? vec4(vec3(aoPass.getTextureNode().sample(screenUV).r), 1) + : useTRAA + ? traaPass + : scenePass; + renderer.toneMapping = params.aoOnly ? THREE.NoToneMapping : THREE.NeutralToneMapping; + renderPipeline.needsUpdate = true; + } + + function createAO() { + if (aoPass) aoPass.dispose(); + + aoPass = + params.aoType === 'SSAO' + ? ssao(prePassDepth, prePassNormal, camera).toInspector('SSAO', inspectNode => inspectNode.r) + : ao(prePassDepth, prePassNormal, camera).toInspector('GTAO', inspectNode => inspectNode.r); + + updateParameters(); + + scenePass.contextNode = builtinAOContext(aoPass.getTextureNode().sample(screenUV).r); + scenePass.needsUpdate = true; + + updateOutput(); + } + + createAO(); + + // models + + const dracoLoader = new DRACOLoader(); + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + loader.setPath('models/gltf/'); + + // wall-mounted spotlights + + function addSpotLight(position, targetPosition) { + const light = new THREE.SpotLight(0xffe09e, 40); + light.position.copy(position); + light.angle = 0.6; + light.penumbra = 1; + light.distance = 6.5; + light.decay = 2; + light.target.position.copy(targetPosition); + scene.add(light); + scene.add(light.target); + } + + addSpotLight(new THREE.Vector3(-2.5, 5, -4.8), new THREE.Vector3(-2.5, -2, -4.8)); + addSpotLight(new THREE.Vector3(2.5, 5, -4.8), new THREE.Vector3(2.5, -2, -4.8)); + addSpotLight(new THREE.Vector3(-5.3, 5, 0), new THREE.Vector3(-5.3, -2, 0)); + + // checkerboard floor + + const tilesX = 16; + const tilesZ = 16; + const floorCanvas = document.createElement('canvas'); + floorCanvas.width = tilesX * 32; + floorCanvas.height = tilesZ * 32; + const floorCtx = floorCanvas.getContext('2d'); + + for (let x = 0; x < tilesX; x++) { + for (let z = 0; z < tilesZ; z++) { + floorCtx.fillStyle = (x + z) % 2 === 0 ? '#d8d0c8' : '#b8b0a8'; + floorCtx.fillRect(x * 32, z * 32, 32, 32); + } + } + + const floorTexture = new THREE.CanvasTexture(floorCanvas); + floorTexture.colorSpace = THREE.SRGBColorSpace; + floorTexture.wrapS = THREE.RepeatWrapping; + floorTexture.wrapT = THREE.RepeatWrapping; + + const floorMat = new THREE.MeshStandardMaterial({ map: floorTexture, roughness: 0.7, metalness: 0.05 }); + const floor = new THREE.Mesh(new THREE.PlaneGeometry(tilesX, tilesZ), floorMat); + floor.rotation.x = -Math.PI / 2; + floor.position.y = -2; + scene.add(floor); + + // walls + + const wallMat = new THREE.MeshStandardMaterial({ color: '#e0d8d0', roughness: 0.9, metalness: 0 }); + + const backWall = new THREE.Mesh(new THREE.PlaneGeometry(16, 10), wallMat); + backWall.position.set(0, 3, -5); + scene.add(backWall); + + const leftWall = new THREE.Mesh(new THREE.PlaneGeometry(16, 10), wallMat); + leftWall.rotation.y = Math.PI / 2; + leftWall.position.set(-5.5, 3, 0); + scene.add(leftWall); + + // central pedestal + + const pedestalMat = new THREE.MeshStandardMaterial({ color: '#f0ece8', roughness: 0.4, metalness: 0.05 }); + + const pedestalBase = new THREE.Mesh(new THREE.CylinderGeometry(0.9, 1.0, 0.2, 32), pedestalMat); + pedestalBase.position.set(0, -1.9, 0); + scene.add(pedestalBase); + + const pedestalShaft = new THREE.Mesh(new THREE.CylinderGeometry(0.55, 0.65, 1.5, 32), pedestalMat); + pedestalShaft.position.set(0, -1.05, 0); + scene.add(pedestalShaft); + + const pedestalTop = new THREE.Mesh(new THREE.CylinderGeometry(0.8, 0.7, 0.25, 32), pedestalMat); + pedestalTop.position.set(0, -0.18, 0); + scene.add(pedestalTop); + + // torus knot + + const knotMat = new THREE.MeshStandardMaterial({ color: '#c0a060', roughness: 0.45, metalness: 0 }); + const torusKnot = new THREE.Mesh(new THREE.TorusKnotGeometry(0.5, 0.17, 128, 32), knotMat); + torusKnot.position.set(0, 0.82, 0); + scene.add(torusKnot); + + // columns + + const columnMat = new THREE.MeshStandardMaterial({ color: '#e8e4de', roughness: 0.5, metalness: 0 }); + + function addColumn(x, z) { + const columnGroup = new THREE.Group(); + + const base = new THREE.Mesh(new THREE.BoxGeometry(0.6, 0.2, 0.6), columnMat); + base.position.y = -1.9; + columnGroup.add(base); + + const shaft = new THREE.Mesh(new THREE.CylinderGeometry(0.18, 0.22, 5, 16), columnMat); + shaft.position.y = 0.7; + columnGroup.add(shaft); + + const capital = new THREE.Mesh(new THREE.BoxGeometry(0.55, 0.25, 0.55), columnMat); + capital.position.y = 3.35; + columnGroup.add(capital); + + columnGroup.scale.setScalar(1.5); + columnGroup.position.set(x, 1.0, z); + scene.add(columnGroup); + } + + addColumn(-5.05, -4.55); + addColumn(4.5, -4.55); + addColumn(-5.05, 3); + + // vase on its own pedestal + + const vaseProfile = [ + new THREE.Vector2(0, 0.5), + new THREE.Vector2(0.12, 0.5), + new THREE.Vector2(0.18, 0.7), + new THREE.Vector2(0.28, 0.9), + new THREE.Vector2(0.32, 1.0), + new THREE.Vector2(0.3, 1.1), + new THREE.Vector2(0.22, 1.15), + new THREE.Vector2(0.2, 1.2), + new THREE.Vector2(0.22, 1.25), + new THREE.Vector2(0, 1.25), + ]; + + const vaseMat = new THREE.MeshStandardMaterial({ color: '#d4806a', roughness: 0.6, metalness: 0.02 }); + + const vasePedestalBase = new THREE.Mesh(new THREE.CylinderGeometry(0.6, 0.7, 0.15, 32), pedestalMat); + vasePedestalBase.position.set(-5, -1.925, -2); + scene.add(vasePedestalBase); + + const vasePedestalShaft = new THREE.Mesh(new THREE.CylinderGeometry(0.35, 0.42, 1, 32), pedestalMat); + vasePedestalShaft.position.set(-5, -1.35, -2); + scene.add(vasePedestalShaft); + + const vasePedestalTop = new THREE.Mesh(new THREE.CylinderGeometry(0.55, 0.48, 0.15, 32), pedestalMat); + vasePedestalTop.position.set(-5, -0.775, -2); + scene.add(vasePedestalTop); + + const vase = new THREE.Mesh(new THREE.LatheGeometry(vaseProfile, 24), vaseMat); + vase.position.set(-5, -1.6, -2); + vase.scale.setScalar(1.8); + scene.add(vase); + + // armchair + + const woodMat = new THREE.MeshStandardMaterial({ color: '#8b6840', roughness: 0.8, metalness: 0 }); + const fabricMat = new THREE.MeshStandardMaterial({ color: '#8b3a3a', roughness: 0.9, metalness: 0 }); + + const chairGroup = new THREE.Group(); + + const seat = new THREE.Mesh(new RoundedBoxGeometry(0.9, 0.25, 0.8, 4, 0.06), fabricMat); + seat.position.set(0, -1.35, 0); + chairGroup.add(seat); + + const backrest = new THREE.Mesh(new RoundedBoxGeometry(0.9, 0.6, 0.12, 4, 0.04), fabricMat); + backrest.position.set(0, -0.95, -0.4); + backrest.rotation.x = -0.3; + chairGroup.add(backrest); + + for (const side of [-1, 1]) { + const armrest = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.25, 0.7), woodMat); + armrest.position.set(side * 0.5, -1.2, 0); + chairGroup.add(armrest); + + const armTop = new THREE.Mesh(new THREE.BoxGeometry(0.14, 0.06, 0.8), woodMat); + armTop.position.set(side * 0.5, -1.07, 0); + chairGroup.add(armTop); + } + + const legPositions = [ + [-0.38, -0.32], + [-0.38, 0.32], + [0.38, -0.32], + [0.38, 0.32], + ]; + for (const [lx, lz] of legPositions) { + const leg = new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0.035, 0.2, 8), woodMat); + leg.position.set(lx, -1.575, lz); + chairGroup.add(leg); + } + + chairGroup.scale.setScalar(1.76); + chairGroup.position.set(4, 0.948, -2.5); + chairGroup.rotation.y = -0.6; + scene.add(chairGroup); + + // side table with cup + + const tableGroup = new THREE.Group(); + + const tableTop = new THREE.Mesh(new THREE.CylinderGeometry(0.4, 0.4, 0.05, 24), woodMat); + tableTop.position.y = -1.05; + tableGroup.add(tableTop); + + const tableLeg = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.06, 0.9, 8), woodMat); + tableLeg.position.y = -1.5; + tableGroup.add(tableLeg); + + const tableBase = new THREE.Mesh(new THREE.CylinderGeometry(0.25, 0.28, 0.06, 24), woodMat); + tableBase.position.y = -1.92; + tableGroup.add(tableBase); + + const cupMat = new THREE.MeshStandardMaterial({ color: '#f0ece0', roughness: 0.4, metalness: 0.05 }); + const cupBody = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.08, 0.2, 16), cupMat); + cupBody.scale.setScalar(1 / 2.2); + cupBody.position.set(0.15, -0.98, 0); + tableGroup.add(cupBody); + + tableGroup.scale.setScalar(2.2); + tableGroup.position.set(2, 2.29, -4); + scene.add(tableGroup); + + // rug + + const rugMat = new THREE.MeshStandardMaterial({ color: '#c8a0a8', roughness: 0.95, metalness: 0 }); + const rug = new THREE.Mesh(new THREE.BoxGeometry(6, 0.02, 5), rugMat); + rug.position.set(0, -1.99, 0.5); + scene.add(rug); + + const rugBorderMat = new THREE.MeshStandardMaterial({ color: '#d4b880', roughness: 0.95, metalness: 0 }); + const rugBorder = new THREE.Mesh(new THREE.BoxGeometry(6.3, 0.015, 5.3), rugBorderMat); + rugBorder.position.set(0, -1.9925, 0.5); + scene.add(rugBorder); + + // picture frames + + function addFrame(x, y, z, width, height, paintColor, rotY = 0) { + const frameGroup = new THREE.Group(); + const t = 0.1; + + const outerW = width + t * 2; + const outerH = height + t * 2; + const frameShape = new THREE.Shape(); + frameShape.moveTo(-outerW / 2, -outerH / 2); + frameShape.lineTo(outerW / 2, -outerH / 2); + frameShape.lineTo(outerW / 2, outerH / 2); + frameShape.lineTo(-outerW / 2, outerH / 2); + frameShape.closePath(); + + const hole = new THREE.Path(); + hole.moveTo(-width / 2, -height / 2); + hole.lineTo(width / 2, -height / 2); + hole.lineTo(width / 2, height / 2); + hole.lineTo(-width / 2, height / 2); + hole.closePath(); + frameShape.holes.push(hole); + + const frameMat = new THREE.MeshStandardMaterial({ color: '#8b6840', roughness: 0.7, metalness: 0 }); + const geo = new THREE.ExtrudeGeometry(frameShape, { + depth: 0.12, + bevelEnabled: true, + bevelThickness: 0.02, + bevelSize: 0.02, + bevelSegments: 2, + }); + const frame = new THREE.Mesh(geo, frameMat); + frameGroup.add(frame); + + const paintMat = new THREE.MeshStandardMaterial({ color: paintColor, roughness: 0.95, metalness: 0 }); + const canvas = new THREE.Mesh(new THREE.PlaneGeometry(width, height), paintMat); + canvas.position.z = 0.001; + frameGroup.add(canvas); + + frameGroup.position.set(x, y, z); + if (rotY) frameGroup.rotation.y = rotY; + scene.add(frameGroup); + } + + addFrame(-3.2, 2.0, -4.9, 1.8, 1.2, '#e8a8a0'); + addFrame(-0.5, 2.6, -4.9, 1.1, 1.6, '#a0c0e0'); + addFrame(2, 1.8, -4.9, 2.0, 1.4, '#a0d0a8'); + addFrame(-5.4, 2.2, -3, 1.5, 1.1, '#d0b0d8', Math.PI / 2); + addFrame(-5.4, 1.8, 1, 1.8, 1.3, '#e0c8a0', Math.PI / 2); + + // bust pedestal + + const bustX = -3; + const bustZ = -3.2; + + const bustBase = new THREE.Mesh(new THREE.CylinderGeometry(0.6, 0.7, 0.15, 32), pedestalMat); + bustBase.position.set(bustX, -1.925, bustZ); + scene.add(bustBase); + + const bustShaft = new THREE.Mesh(new THREE.CylinderGeometry(0.35, 0.42, 1, 32), pedestalMat); + bustShaft.position.set(bustX, -1.35, bustZ); + scene.add(bustShaft); + + const bustTop = new THREE.Mesh(new THREE.CylinderGeometry(0.55, 0.48, 0.15, 32), pedestalMat); + bustTop.position.set(bustX, -0.775, bustZ); + scene.add(bustTop); + + // Transparent plane for testing + + transparentMesh = new THREE.Mesh( + new THREE.PlaneGeometry(1.8, 2), + new THREE.MeshStandardNodeMaterial({ transparent: true, opacity: params.transparentOpacity }), + ); + transparentMesh.visible = false; + transparentMesh.position.set(0, 1.2, 1.5); + scene.add(transparentMesh); + + updateParameters(); + + // bust GLB + + const gltf = await loader.loadAsync('tennyson-bust.glb'); + const bust = gltf.scene; + bust.rotation.y = Math.PI; + + const targetHeight = 2.64; + const sizeBox = new THREE.Box3().setFromObject(bust); + const size = new THREE.Vector3(); + sizeBox.getSize(size); + bust.scale.setScalar(targetHeight / size.y); + + const fitBox = new THREE.Box3().setFromObject(bust); + const center = new THREE.Vector3(); + fitBox.getCenter(center); + bust.position.set(bustX - center.x, -0.7 - fitBox.min.y, bustZ - center.z + 0.1); + scene.add(bust); + + // events + + window.addEventListener('resize', onWindowResize); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'aoType', ['GTAO', 'SSAO']) + .name('AO type') + .onChange(() => { + // half resolution suffices for GTAO since TRAA smooths it, SSAO looks best at full resolution + + resolutionScaleControl.setValue(params.aoType === 'SSAO' ? 1 : 0.5); + + createAO(); + updateControls(); + }); + const resolutionScaleControl = gui + .add(params, 'resolutionScale', 0, 1) + .name('resolution') + .onChange(updateParameters); + gui.add(params, 'samples', 4, 32, 1).onChange(updateParameters).debounce(250); + gui.add(params, 'radius', 0.1, 1).onChange(updateParameters); + + const gtaoControls = [ + gui.add(params, 'scale', 0.01, 1).onChange(updateParameters), + gui.add(params, 'thickness', 0.01, 2).onChange(updateParameters), + gui.add(params, 'temporalFiltering').name('temporal filtering').onChange(updateParameters), + ]; + + const ssaoControls = [ + gui.add(params, 'intensity', 0, 4).onChange(updateParameters), + gui.add(params, 'bias', 0, 0.2).onChange(updateParameters), + gui.add(params, 'blurEnabled').name('blur').onChange(updateParameters), + gui.add(params, 'blurSharpness', 0, 8).name('blur sharpness').onChange(updateParameters), + ]; + + gui.add(transparentMesh, 'visible').name('show transparent mesh'); + gui.add(params, 'transparentOpacity', 0, 1, 0.01) + .name('mesh opacity') + .onChange(value => { + transparentMesh.material.opacity = value; + }); + gui.add(params, 'aoOnly').onChange(updateOutput); + + // show only the controls that apply to the active AO type + + function updateControls() { + if (params.aoType === 'GTAO') { + gtaoControls.forEach(control => control.show()); + ssaoControls.forEach(control => control.hide()); + } else { + gtaoControls.forEach(control => control.hide()); + ssaoControls.forEach(control => control.show()); + } + } + + updateControls(); +} + +function updateParameters() { + aoPass.samples.value = params.samples; + aoPass.radius.value = params.radius; + aoPass.resolutionScale = params.resolutionScale; + + if (params.aoType === 'SSAO') { + aoPass.intensity.value = params.intensity; + aoPass.bias.value = params.bias; + aoPass.blurEnabled = params.blurEnabled; + aoPass.blurSharpness.value = params.blurSharpness; + } else { + aoPass.scale.value = params.scale; + aoPass.thickness.value = params.thickness; + aoPass.useTemporalFiltering = params.temporalFiltering; + } +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_bloom.ts b/examples-testing/examples/webgpu_postprocessing_bloom.ts new file mode 100644 index 000000000..f8194ac62 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_bloom.ts @@ -0,0 +1,132 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera; +let renderPipeline, renderer, mixer, timer; + +const params = { + threshold: 0, + strength: 1, + radius: 0, + exposure: 1, +}; + +init(); + +async function init() { + timer = new THREE.Timer(); + timer.connect(document); + + const scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); + camera.position.set(-5, 2.5, -3.5); + scene.add(camera); + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const pointLight = new THREE.PointLight(0xffffff, 100); + camera.add(pointLight); + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/PrimaryIonDrive.glb'); + + const model = gltf.scene; + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + const clip = gltf.animations[0]; + mixer.clipAction(clip.optimize()).play(); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ReinhardToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + renderPipeline = new THREE.RenderPipeline(renderer); + + // below optimized config is only relevant when using MSAA and also optional. + // store no multisampled data and only resolve color + + const config = { + storeMultisampledColorBuffer: false, + storeMultisampledDepthBuffer: false, + storeMultisampledStencilBuffer: false, + resolveColorBuffer: true, + resolveDepthBuffer: false, + resolveStencilBuffer: false, + }; + + const scenePass = pass(scene, camera, config); + const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); + + const bloomPass = bloom(scenePassColor).toInspector('Bloom'); + + renderPipeline.outputNode = scenePassColor.add(bloomPass); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI * 0.5; + controls.minDistance = 3; + controls.maxDistance = 8; + + // + + const gui = renderer.inspector.createParameters('Settings'); + + const bloomFolder = gui.addFolder('bloom'); + + bloomFolder.add(params, 'threshold', 0.0, 1.0).onChange(function (value) { + bloomPass.threshold.value = value; + }); + + bloomFolder.add(params, 'strength', 0.0, 3.0).onChange(function (value) { + bloomPass.strength.value = value; + }); + + bloomFolder.add(params, 'radius', 0.0, 1.0, 0.01).onChange(function (value) { + bloomPass.radius.value = value; + }); + + const toneMappingFolder = gui.addFolder('tone mapping'); + + toneMappingFolder.add(params, 'exposure', 0.1, 2).onChange(function (value) { + renderer.toneMappingExposure = Math.pow(value, 4.0); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + mixer.update(delta); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts b/examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts new file mode 100644 index 000000000..faa5b67fb --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts @@ -0,0 +1,115 @@ +import * as THREE from 'three/webgpu'; +import { pass, mrt, output, emissive, vec4 } from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let renderPipeline; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + // + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); + camera.position.set(-1.8, 0.6, 2.7); + + scene = new THREE.Scene(); + + new HDRLoader().setPath('textures/equirectangular/').load('moonless_golf_1k.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + // model + + const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); + loader.load('DamagedHelmet.gltf', function (gltf) { + scene.add(gltf.scene); + }); + }); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + // + + const scenePass = pass(scene, camera); + + // set up MRT with emissive + + const mrtNode = mrt({ + output: output, + emissive: vec4(emissive, output.a), + }); + + mrtNode.setBlendMode('emissive', new THREE.BlendMode(THREE.NormalBlending)); + + scenePass.setMRT(mrtNode); + + // optimize the bandwidth + + const emissiveTexture = scenePass.getTexture('emissive'); + emissiveTexture.type = THREE.UnsignedByteType; + + // + + const outputPass = scenePass.getTextureNode().toInspector('Color'); + const emissivePass = scenePass.getTextureNode('emissive').toInspector('Emissive'); + + const bloomPass = bloom(emissivePass, 2.5, 0.5); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = outputPass.add(bloomPass); + + // + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.target.set(0, 0, -0.2); + controls.update(); + + window.addEventListener('resize', onWindowResize); + + // + + const gui = renderer.inspector.createParameters('Settings'); + + const bloomFolder = gui.addFolder('Bloom'); + bloomFolder.add(bloomPass.strength, 'value', 0.0, 5.0).name('strength'); + bloomFolder.add(bloomPass.radius, 'value', 0.0, 1.0).name('radius'); + + const toneMappingFolder = gui.addFolder('Tone Mapping'); + toneMappingFolder.add(renderer, 'toneMappingExposure', 0.1, 2).name('exposure'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts b/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts new file mode 100644 index 000000000..b8f2427d4 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts @@ -0,0 +1,124 @@ +import * as THREE from 'three/webgpu'; +import { pass, mrt, output, float, uniform } from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +// scene + +const scene = new THREE.Scene(); + +const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 200); +camera.position.set(0, 0, 20); +camera.lookAt(0, 0, 0); + +const geometry = new THREE.IcosahedronGeometry(1, 15); + +for (let i = 0; i < 50; i++) { + const color = new THREE.Color(); + color.setHSL(Math.random(), 0.7, Math.random() * 0.2 + 0.05); + + const bloomIntensity = Math.random() > 0.5 ? 1 : 0; + + const material = new THREE.MeshBasicNodeMaterial({ color: color }); + material.mrtNode = mrt({ + bloomIntensity: uniform(bloomIntensity), + }); + + const sphere = new THREE.Mesh(geometry, material); + sphere.position.x = Math.random() * 10 - 5; + sphere.position.y = Math.random() * 10 - 5; + sphere.position.z = Math.random() * 10 - 5; + sphere.position.normalize().multiplyScalar(Math.random() * 4.0 + 2.0); + sphere.scale.setScalar(Math.random() * Math.random() + 0.5); + scene.add(sphere); +} + +// renderer + +const renderer = new THREE.WebGPURenderer(); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setAnimationLoop(animate); +renderer.inspector = new Inspector(); +renderer.toneMapping = THREE.NeutralToneMapping; +document.body.appendChild(renderer.domElement); + +// post processing + +const scenePass = pass(scene, camera); +scenePass.setMRT( + mrt({ + output, + bloomIntensity: float(0), // default bloom intensity + }), +); + +const outputPass = scenePass.getTextureNode().toInspector('Color'); +const bloomIntensityPass = scenePass.getTextureNode('bloomIntensity').toInspector('Bloom Intensity'); + +const bloomPass = bloom(outputPass.mul(bloomIntensityPass)); + +const renderPipeline = new THREE.RenderPipeline(renderer); +renderPipeline.outputColorTransform = false; +renderPipeline.outputNode = outputPass.add(bloomPass).renderOutput(); + +// controls + +const controls = new OrbitControls(camera, renderer.domElement); +controls.maxPolarAngle = Math.PI * 0.5; +controls.minDistance = 1; +controls.maxDistance = 100; + +// raycaster + +const raycaster = new THREE.Raycaster(); +const mouse = new THREE.Vector2(); + +window.addEventListener('pointerdown', event => { + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; + + raycaster.setFromCamera(mouse, camera); + + const intersects = raycaster.intersectObjects(scene.children, false); + + if (intersects.length > 0) { + const material = intersects[0].object.material; + + const bloomIntensity = material.mrtNode.get('bloomIntensity'); + bloomIntensity.value = bloomIntensity.value === 0 ? 1 : 0; + } +}); + +// gui + +const gui = renderer.inspector.createParameters('Settings'); + +const bloomFolder = gui.addFolder('Bloom'); +bloomFolder.add(bloomPass.threshold, 'value', 0.0, 1.0).name('threshold'); +bloomFolder.add(bloomPass.strength, 'value', 0.0, 3).name('strength'); +bloomFolder.add(bloomPass.radius, 'value', 0.0, 1.0).name('radius'); + +const toneMappingFolder = gui.addFolder('Tone Mapping'); +toneMappingFolder.add(renderer, 'toneMappingExposure', 0.1, 3).name('exposure'); + +// events + +window.onresize = function () { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +}; + +// animate + +function animate() { + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_ca.ts b/examples-testing/examples/webgpu_postprocessing_ca.ts new file mode 100644 index 000000000..48b549050 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_ca.ts @@ -0,0 +1,266 @@ +import * as THREE from 'three/webgpu'; +import { pass, renderOutput, uniform } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { chromaticAberration } from 'three/addons/tsl/display/ChromaticAberrationNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const params = { + enabled: true, + animated: true, + strength: 1.5, + center: new THREE.Vector2(0.5, 0.5), + scale: 1.2, + autoRotate: true, + cameraDistance: 40, +}; + +let camera, scene, renderer, timer, mainGroup; +let controls, renderPipeline; + +init(); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); + camera.position.set(0, 15, params.cameraDistance); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.dampingFactor = 0.1; + controls.autoRotate = true; + controls.autoRotateSpeed = -0.1; + controls.target.set(0, 0.5, 0); + controls.update(); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x0a0a0a); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + + timer = new THREE.Timer(); + timer.connect(document); + + // Create main group + mainGroup = new THREE.Group(); + scene.add(mainGroup); + + // Create shapes + createShapes(); + + // Add a grid for reference + const gridHelper = new THREE.GridHelper(40, 20, 0x444444, 0x222222); + gridHelper.position.y = -10; + scene.add(gridHelper); + + // post processing + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = false; + + // scene pass + const scenePass = pass(scene, camera); + const outputPass = renderOutput(scenePass); + + // Create uniform nodes for the static version that can be updated + const staticStrength = uniform(params.strength); + const staticCenter = uniform(new THREE.Vector2(params.center.x, params.center.y)); + const staticScale = uniform(params.scale); + + // With static values (using uniform nodes) + const caPass = chromaticAberration(outputPass, staticStrength, staticCenter, staticScale); + + // Set initial output based on params + renderPipeline.outputNode = params.enabled ? caPass : outputPass; + + window.addEventListener('resize', onWindowResize); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(params, 'enabled').onChange(value => { + renderPipeline.outputNode = value ? caPass : outputPass; + renderPipeline.needsUpdate = true; + }); + + const staticFolder = gui.addFolder('Static Parameters'); + + staticFolder.add(staticStrength, 'value', 0, 3).name('Strength'); + staticFolder.add(staticCenter.value, 'x', -1, 1).name('Center X'); + staticFolder.add(staticCenter.value, 'y', -1, 1).name('Center Y'); + staticFolder.add(staticScale, 'value', 0.5, 2).name('Scale'); + + const animationFolder = gui.addFolder('Animation'); + animationFolder.add(params, 'animated'); + animationFolder.add(params, 'autoRotate').onChange(value => { + controls.autoRotate = value; + }); +} + +function createShapes() { + const shapes = []; + const materials = []; + + // Define colors for different materials + const colors = [ + 0xff0000, // Red + 0x00ff00, // Green + 0x0000ff, // Blue + 0xffff00, // Yellow + 0xff00ff, // Magenta + 0x00ffff, // Cyan + 0xffffff, // White + 0xff8800, // Orange + ]; + + // Create materials + colors.forEach(color => { + materials.push( + new THREE.MeshStandardMaterial({ + color: color, + roughness: 0.2, + metalness: 0.8, + }), + ); + }); + + // Create geometries + const geometries = [ + new THREE.BoxGeometry(3, 3, 3), + new THREE.SphereGeometry(2, 32, 16), + new THREE.ConeGeometry(2, 4, 8), + new THREE.CylinderGeometry(1.5, 1.5, 4, 8), + new THREE.TorusGeometry(2, 0.8, 8, 16), + new THREE.OctahedronGeometry(2.5), + new THREE.IcosahedronGeometry(2.5), + new THREE.TorusKnotGeometry(1.5, 0.5, 64, 8), + ]; + + // Create central showcase + const centralGroup = new THREE.Group(); + + // Large central torus + const centralTorus = new THREE.Mesh( + new THREE.TorusGeometry(5, 1.5, 16, 32), + new THREE.MeshStandardMaterial({ + color: 0xffffff, + roughness: 0.1, + metalness: 1, + emissive: 0x222222, + }), + ); + centralGroup.add(centralTorus); + + // Inner rotating shapes + for (let i = 0; i < 6; i++) { + const angle = (i / 6) * Math.PI * 2; + const radius = 3; + + const mesh = new THREE.Mesh(geometries[i % geometries.length], materials[i % materials.length]); + + mesh.position.set(Math.cos(angle) * radius, 0, Math.sin(angle) * radius); + + mesh.scale.setScalar(0.5); + centralGroup.add(mesh); + shapes.push(mesh); + } + + mainGroup.add(centralGroup); + shapes.push(centralGroup); + + // Create outer ring of shapes + const numShapes = 12; + const outerRadius = 15; + + for (let i = 0; i < numShapes; i++) { + const angle = (i / numShapes) * Math.PI * 2; + const shapesGroup = new THREE.Group(); + + const geometry = geometries[i % geometries.length]; + const material = materials[i % materials.length]; + + const mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + mesh.receiveShadow = true; + + shapesGroup.add(mesh); + shapesGroup.position.set(Math.cos(angle) * outerRadius, Math.sin(i * 0.5) * 2, Math.sin(angle) * outerRadius); + + mainGroup.add(shapesGroup); + shapes.push(shapesGroup); + } + + // Add floating particles + const particlesGeometry = new THREE.BufferGeometry(); + const particlesCount = 200; + const positions = new Float32Array(particlesCount * 3); + + for (let i = 0; i < particlesCount * 3; i += 3) { + const radius = 25 + Math.random() * 10; + const theta = Math.random() * Math.PI * 2; + const phi = Math.random() * Math.PI; + + positions[i] = radius * Math.sin(phi) * Math.cos(theta); + positions[i + 1] = radius * Math.cos(phi); + positions[i + 2] = radius * Math.sin(phi) * Math.sin(theta); + } + + particlesGeometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + + const particlesMaterial = new THREE.PointsMaterial({ + color: 0xffffff, + size: 0.5, + sizeAttenuation: true, + }); + + const particles = new THREE.Points(particlesGeometry, particlesMaterial); + mainGroup.add(particles); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const time = timer.getElapsed(); + + controls.update(); + + if (params.animated) { + // Animate individual shapes + mainGroup.children.forEach((child, index) => { + if (child.children.length > 0) { + // Central group + child.rotation.y = time * 0.5; + child.children.forEach((subChild, subIndex) => { + if (subChild.geometry) { + subChild.rotation.x = time * (1 + subIndex * 0.1); + subChild.rotation.z = time * (1 - subIndex * 0.1); + } + }); + } else if (child.type === 'Group') { + // Outer shapes + child.rotation.x = time * 0.5 + index; + child.rotation.y = time * 0.3 + index; + child.position.y = Math.sin(time + index) * 2; + } + }); + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_difference.ts b/examples-testing/examples/webgpu_postprocessing_difference.ts new file mode 100644 index 000000000..91cc4cbf5 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_difference.ts @@ -0,0 +1,93 @@ +import * as THREE from 'three/webgpu'; +import { pass, luminance, saturation } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const params = { + speed: 0, +}; + +let camera, renderer, renderPipeline; +let timer, mesh, controls; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.toneMapping = THREE.NeutralToneMapping; + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 100); + camera.position.set(1, 2, 3); + + const scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x0487e2, 7, 25); + scene.background = new THREE.Color(0x0487e2); + + timer = new THREE.Timer(); + timer.connect(document); + + const texture = new THREE.TextureLoader().load('textures/crate.gif'); + texture.colorSpace = THREE.SRGBColorSpace; + + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshBasicMaterial({ map: texture }); + + mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + + const currentTexture = scenePass.getTextureNode(); + const previousTexture = scenePass.getPreviousTextureNode(); + + const frameDiff = previousTexture.sub(currentTexture).abs(); + + const saturationAmount = luminance(frameDiff).mul(1000).clamp(0, 3); + + renderPipeline.outputNode = saturation(currentTexture, saturationAmount); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 2; + controls.maxDistance = 10; + controls.enableDamping = true; + controls.dampingFactor = 0.01; + + window.addEventListener('resize', onWindowResize); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'speed', 0, 2); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + controls.update(); + + mesh.rotation.y += timer.getDelta() * 5 * params.speed; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_direct.ts b/examples-testing/examples/webgpu_postprocessing_direct.ts new file mode 100644 index 000000000..a2d690312 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_direct.ts @@ -0,0 +1,78 @@ +import * as THREE from 'three/webgpu'; +import { output, saturation, uniform, vec4 } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline; +let object; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 400; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + object = new THREE.Object3D(); + scene.add(object); + + const geometry = new THREE.SphereGeometry(1, 4, 4); + + for (let i = 0; i < 100; i++) { + const material = new THREE.MeshPhongMaterial({ color: Math.random() * 0xffffff, flatShading: true }); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); + mesh.position.multiplyScalar(Math.random() * 400); + mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); + mesh.scale.setScalar(Math.random() * 50); + object.add(mesh); + } + + scene.add(new THREE.AmbientLight(0xcccccc)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1); + scene.add(light); + + // direct post-processing + + const saturationFactor = uniform(0); + + renderPipeline = new THREE.DirectRenderPipeline(renderer); + renderPipeline.outputNode = vec4(saturation(output.rgb, saturationFactor), output.a); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(saturationFactor, 'value', 0, 1, 0.01).name('Saturation'); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + object.rotation.x += 0.005; + object.rotation.y += 0.01; + + renderPipeline.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_postprocessing_dof.ts b/examples-testing/examples/webgpu_postprocessing_dof.ts new file mode 100644 index 000000000..862c2802b --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_dof.ts @@ -0,0 +1,132 @@ +import * as THREE from 'three/webgpu'; +import { cubeTexture, positionWorld, oscSine, time, pass, uniform } from 'three/tsl'; +import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +// + +let camera, scene, renderer, mesh, controls; + +let width = window.innerWidth; +let height = window.innerHeight; + +let renderPipeline; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, width / height, 1, 3500); + camera.position.z = 200; + + scene = new THREE.Scene(); + + const path = 'textures/cube/SwedishRoyalCastle/'; + const format = '.jpg'; + const urls = [ + path + 'px' + format, + path + 'nx' + format, + path + 'py' + format, + path + 'ny' + format, + path + 'pz' + format, + path + 'nz' + format, + ]; + + const xgrid = 14, + ygrid = 9, + zgrid = 14; + const count = xgrid * ygrid * zgrid; + + const textureCube = new THREE.CubeTextureLoader().load(urls); + const cubeTextureNode = cubeTexture(textureCube); + const oscPos = oscSine(positionWorld.div(1000 /* scene distance */).add(time.mul(0.2))); + + const geometry = new THREE.SphereGeometry(60, 20, 10); + const material = new THREE.MeshBasicNodeMaterial(); + material.colorNode = cubeTextureNode.mul(oscPos); + + mesh = new THREE.InstancedMesh(geometry, material, count); + scene.add(mesh); + + const matrix = new THREE.Matrix4(); + + let index = 0; + + for (let i = 0; i < xgrid; i++) { + for (let j = 0; j < ygrid; j++) { + for (let k = 0; k < zgrid; k++) { + const x = 200 * (i - xgrid / 2); + const y = 200 * (j - ygrid / 2); + const z = 200 * (k - zgrid / 2); + + mesh.setMatrixAt(index, matrix.identity().setPosition(x, y, z)); + index++; + } + } + } + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + const effectController = { + focusDistance: uniform(500), + focalLength: uniform(200), + bokehScale: uniform(10), + }; + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + + const scenePassColor = scenePass.getTextureNode().toInspector('Color'); + const scenePassViewZ = scenePass.getViewZNode(); + + const dofPass = dof( + scenePassColor, + scenePassViewZ, + effectController.focusDistance, + effectController.focalLength, + effectController.bokehScale, + ); + + renderPipeline.outputNode = dofPass; + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(effectController.focusDistance, 'value', 10.0, 3000.0).name('focus distance'); + gui.add(effectController.focalLength, 'value', 50, 750).name('focal length'); + gui.add(effectController.bokehScale, 'value', 1, 20).name('bokeh scale'); +} + +function onWindowResize() { + width = window.innerWidth; + height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_dof_basic.ts b/examples-testing/examples/webgpu_postprocessing_dof_basic.ts new file mode 100644 index 000000000..8be1a3276 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_dof_basic.ts @@ -0,0 +1,154 @@ +import * as THREE from 'three/webgpu'; +import { mix, pass, renderOutput, smoothstep, uniform, vec3 } from 'three/tsl'; +import { boxBlur } from 'three/addons/tsl/display/boxBlur.js'; +import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import TWEEN from 'three/addons/libs/tween.module.js'; + +let camera, controls, scene, timer, renderer, model, mixer, raycaster, renderPipeline; + +const pointerCoords = new THREE.Vector2(); +const focusPoint = new THREE.Vector3(1, 1.75, -0.4); +const focusPointView = uniform(vec3()); + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-6, 5, 6); + + controls = new OrbitControls(camera); + controls.target.set(0, 2, 0); + controls.enableDamping = true; + controls.update(); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x90d5ff); + + raycaster = new THREE.Raycaster(); + + timer = new THREE.Timer(); + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + const gltf = await loader.loadAsync('models/gltf/bath_day.glb'); + + model = gltf.scene; + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + // + + const hdrLoader = new UltraHDRLoader(); + const envMap = await hdrLoader.loadAsync('textures/equirectangular/spruit_sunrise_2k.hdr.jpg'); + envMap.mapping = THREE.EquirectangularReflectionMapping; + scene.environmentRotation.y = Math.PI * -0.5; + scene.environment = envMap; + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.toneMapping = THREE.NeutralToneMapping; + document.body.appendChild(renderer.domElement); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = false; + + // DOF uniforms + + const blurSize = uniform(2); // determines the kernel size of the blur + const blurSpread = uniform(4); // determines how far the blur is spread + const minDistance = uniform(1); // all positions at or below minDistance will be completely in focus. + const maxDistance = uniform(3); // all positions at or beyond maxDistance will be completely out of focus. + + // beauty and blur/out-of-focus pass + + const scenePass = pass(scene, camera); + + const scenePassColor = scenePass.getTextureNode().toInspector('Color'); + const scenePassViewZ = scenePass.getViewZNode(); + const scenePassBlurred = boxBlur(scenePassColor, { size: blurSize, separation: blurSpread }); + + // simple DOF from https://lettier.github.io/3d-game-shaders-for-beginners/depth-of-field.html + + const blur = smoothstep(minDistance, maxDistance, scenePassViewZ.sub(focusPointView.z).abs()); + const dofPass = mix(scenePassColor, scenePassBlurred, blur); + + const outputPass = renderOutput(dofPass); + const fxaaPass = fxaa(outputPass); + + renderPipeline.outputNode = fxaaPass; + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(minDistance, 'value', 0, 3).name('min distance'); + gui.add(maxDistance, 'value', 0, 5).name('max distance'); + gui.add(blurSize, 'value', 1, 3, 1).name('blur size'); + gui.add(blurSpread, 'value', 1, 7, 1).name('blur spread'); + + // + + controls.connect(renderer.domElement); + + renderer.domElement.addEventListener('pointerdown', onPointerDown); + + window.addEventListener('resize', onWindowResize); +} + +function onPointerDown(event) { + pointerCoords.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); + + raycaster.setFromCamera(pointerCoords, camera); + + const intersects = raycaster.intersectObject(model); + + if (intersects.length > 0) { + TWEEN.removeAll(); + + new TWEEN.Tween(focusPoint).to(intersects[0].point, 500).easing(TWEEN.Easing.Cubic.InOut).start(); + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + TWEEN.update(); + + controls.update(); + + timer.update(); + + mixer.update(timer.getDelta()); + + // since the focus point is expressed in view space, it must be updated on every + // camera change. for simplicity, do this every frame. + + camera.updateMatrixWorld(); + focusPointView.value.copy(focusPoint).applyMatrix4(camera.matrixWorldInverse); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_fxaa.ts b/examples-testing/examples/webgpu_postprocessing_fxaa.ts new file mode 100644 index 000000000..24c01a950 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_fxaa.ts @@ -0,0 +1,129 @@ +import * as THREE from 'three/webgpu'; +import { pass, renderOutput } from 'three/tsl'; +import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const params = { + enabled: true, + animated: false, +}; + +let camera, scene, renderer, timer, group; +let renderPipeline; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); + camera.position.z = 50; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + timer = new THREE.Timer(); + timer.connect(document); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d); + hemiLight.position.set(0, 1000, 0); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(-3000, 1000, -1000); + scene.add(dirLight); + + // + + group = new THREE.Group(); + + const geometry = new THREE.TetrahedronGeometry(); + const material = new THREE.MeshStandardMaterial({ color: 0xf73232, flatShading: true }); + + const mesh = new THREE.InstancedMesh(geometry, material, 100); + const dummy = new THREE.Object3D(); + + for (let i = 0; i < 100; i++) { + dummy.position.x = Math.random() * 50 - 25; + dummy.position.y = Math.random() * 50 - 25; + dummy.position.z = Math.random() * 50 - 25; + + dummy.scale.setScalar(Math.random() * 2 + 1); + + dummy.rotation.x = Math.random() * Math.PI; + dummy.rotation.y = Math.random() * Math.PI; + dummy.rotation.z = Math.random() * Math.PI; + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + } + + group.add(mesh); + scene.add(group); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // ignore default output color transform ( toneMapping and outputColorSpace ) + // use renderOutput() for control the sequence + + renderPipeline.outputColorTransform = false; + + // scene pass + + const scenePass = pass(scene, camera).toInspector('Color'); + const outputPass = renderOutput(scenePass); + + // FXAA must be computed in sRGB color space (so after tone mapping and color space conversion) + + const fxaaPass = fxaa(outputPass); + renderPipeline.outputNode = fxaaPass; + + // + + window.addEventListener('resize', onWindowResize); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'enabled').onChange(value => { + if (value === true) { + renderPipeline.outputNode = fxaaPass; + } else { + renderPipeline.outputNode = outputPass; + } + + renderPipeline.needsUpdate = true; + }); + gui.add(params, 'animated'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (params.animated === true) { + group.rotation.y += delta * 0.1; + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_godrays.ts b/examples-testing/examples/webgpu_postprocessing_godrays.ts new file mode 100644 index 000000000..32e619a47 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_godrays.ts @@ -0,0 +1,209 @@ +import * as THREE from 'three/webgpu'; +import { pass, uniform, float, int, color } from 'three/tsl'; +import { godrays } from 'three/addons/tsl/display/GodraysNode.js'; +import { bilateralBlur } from 'three/addons/tsl/display/BilateralBlurNode.js'; +import { depthAwareBlend } from 'three/addons/tsl/display/depthAwareBlend.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, controls, scene, renderer, renderPipeline; + +const params = { + enabledBlur: true, +}; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(-175, 50, 0); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + // asset + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/godrays_demo.glb'); + scene.add(gltf.scene); + + const pillars = gltf.scene.getObjectByName('concrete'); + pillars.material = new THREE.MeshStandardMaterial({ + color: 0x333333, + }); + + const base = gltf.scene.getObjectByName('base'); + base.material = new THREE.MeshStandardMaterial({ + color: 0x333333, + side: THREE.DoubleSide, + }); + + // lights + + const lightPos = new THREE.Vector3(0, 50, 0); + const lightSphereMaterial = new THREE.MeshBasicMaterial({ + color: 0xffffff, + }); + const lightSphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 16, 16), lightSphereMaterial); + lightSphere.position.copy(lightPos); + scene.add(lightSphere); + + scene.add(new THREE.AmbientLight(0xcccccc, 0.4)); + + const pointLight = new THREE.PointLight(0xf6287d, 10000); + pointLight.castShadow = true; + pointLight.shadow.bias = -0.00001; + pointLight.shadow.mapSize.width = 2048; + pointLight.shadow.mapSize.height = 2048; + pointLight.position.copy(lightPos); + scene.add(pointLight); + + setupBackdrop(); + + // shadow setup + + scene.traverse(obj => { + if (obj.isMesh === true) { + obj.castShadow = true; + obj.receiveShadow = true; + } + }); + + lightSphere.castShadow = false; + lightSphere.receiveShadow = false; + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // beauty + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode('output'); + const scenePassDepth = scenePass.getTextureNode('depth'); + + // godrays + + const godraysPass = godrays(scenePassDepth, camera, pointLight); + const godraysPassColor = godraysPass.getTextureNode(); + + // blur + + const blurPass = bilateralBlur(godraysPassColor); + const blurPassColor = blurPass.getTextureNode(); + + // composite + + const blendColor = uniform(color(0xf6287d)); + const edgeRadius = uniform(int(2)); + const edgeStrength = uniform(float(2)); + + const outputBlurred = depthAwareBlend(scenePassColor, blurPassColor, scenePassDepth, camera, { + blendColor, + edgeRadius, + edgeStrength, + }); + const outputRaw = depthAwareBlend(scenePassColor, godraysPassColor, scenePassDepth, camera, { + blendColor, + edgeRadius, + edgeStrength, + }); + + renderPipeline.outputNode = outputBlurred; + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + const godraysFolder = gui.addFolder('Godrays'); + godraysFolder.add(godraysPass.raymarchSteps, 'value', 24, 120).step(1).name('raymarch steps'); + godraysFolder.add(godraysPass.density, 'value', 0, 1).name('density'); + godraysFolder.add(godraysPass.maxDensity, 'value', 0, 1).name('max density'); + godraysFolder.add(godraysPass.distanceAttenuation, 'value', 0, 5).name('distance attenuation'); + + const compositeFolder = gui.addFolder('composite'); + compositeFolder.add(edgeRadius, 'value', 0, 5, 1).name('edge radius'); + compositeFolder.add(edgeStrength, 'value', 0, 5).name('edge strength'); + + const blurFolder = gui.addFolder('blur'); + blurFolder + .add(params, 'enabledBlur') + .name('enabled') + .onChange(value => { + if (value === true) { + renderPipeline.outputNode = outputBlurred; + } else { + renderPipeline.outputNode = outputRaw; + } + + renderPipeline.needsUpdate = true; + }); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.5, 0); + controls.enableDamping = true; + controls.maxDistance = 200; + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function setupBackdrop() { + const backdropDistance = 200; + // Add backdrop walls `backdropDistance` units away from the origin + const backdropGeometry = new THREE.PlaneGeometry(400, 200); + const backdropMaterial = new THREE.MeshBasicMaterial({ + color: 0x000000, + side: THREE.DoubleSide, + }); + const backdropLeft = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropLeft.position.set(-backdropDistance, 100, 0); + backdropLeft.rotateY(Math.PI / 2); + scene.add(backdropLeft); + + const backdropRight = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropRight.position.set(backdropDistance, 100, 0); + backdropRight.rotateY(Math.PI / 2); + scene.add(backdropRight); + + const backdropFront = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropFront.position.set(0, 100, -backdropDistance); + scene.add(backdropFront); + + const backdropBack = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropBack.position.set(0, 100, backdropDistance); + scene.add(backdropBack); + + const backdropTop = new THREE.Mesh(backdropGeometry, backdropMaterial); + backdropTop.position.set(0, 200, 0); + backdropTop.rotateX(Math.PI / 2); + backdropTop.scale.set(3, 6, 1); + scene.add(backdropTop); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_lensflare.ts b/examples-testing/examples/webgpu_postprocessing_lensflare.ts new file mode 100644 index 000000000..39b1e5f6e --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_lensflare.ts @@ -0,0 +1,135 @@ +import * as THREE from 'three/webgpu'; +import { pass, mrt, output, emissive, uniform } from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; +import { lensflare } from 'three/addons/tsl/display/LensflareNode.js'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls; +let renderPipeline; + +init(); + +async function init() { + // + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0.5, -0.5); + + scene = new THREE.Scene(); + + const texture = await new UltraHDRLoader().loadAsync('textures/equirectangular/ice_planet_close.jpg'); + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + scene.backgroundIntensity = 2; + scene.environmentIntensity = 15; + + // model + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/space_ship_hallway.glb'); + + const object = gltf.scene; + + const aabb = new THREE.Box3().setFromObject(object); + const center = aabb.getCenter(new THREE.Vector3()); + + object.position.x += object.position.x - center.x; + object.position.y += object.position.y - center.y; + object.position.z += object.position.z - center.z; + + scene.add(object); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + const scenePass = pass(scene, camera); + scenePass.setMRT( + mrt({ + output, + emissive, + }), + ); + + const outputPass = scenePass.getTextureNode().toInspector('Color'); + const emissivePass = scenePass.getTextureNode('emissive').toInspector('Emissive'); + + const bloomPass = bloom(emissivePass, 1, 1).toInspector('Bloom'); + + const threshold = uniform(0.5); + const ghostAttenuationFactor = uniform(25); + const ghostSpacing = uniform(0.25); + + const flarePass = lensflare(bloomPass, { + threshold, + ghostAttenuationFactor, + ghostSpacing, + }); + + const blurPass = gaussianBlur(flarePass, 8); // optional (blurring produces better flare quality but also adds some overhead) + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = outputPass.add(bloomPass).add(blurPass); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.enablePan = false; + controls.enableZoom = false; + controls.target.copy(camera.position); + controls.target.z -= 0.01; + controls.update(); + + window.addEventListener('resize', onWindowResize); + + // + + const gui = renderer.inspector.createParameters('Settings'); + + const bloomFolder = gui.addFolder('bloom'); + bloomFolder.add(bloomPass.strength, 'value', 0.0, 2.0).name('strength'); + bloomFolder.add(bloomPass.radius, 'value', 0.0, 1.0).name('radius'); + + const lensflareFolder = gui.addFolder('lensflare'); + lensflareFolder.add(threshold, 'value', 0.0, 1.0).name('threshold'); + lensflareFolder.add(ghostAttenuationFactor, 'value', 10.0, 50.0).name('attenuation'); + lensflareFolder.add(ghostSpacing, 'value', 0.0, 0.3).name('spacing'); + + const toneMappingFolder = gui.addFolder('tone mapping'); + toneMappingFolder.add(renderer, 'toneMappingExposure', 0.1, 2).name('exposure'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_masking.ts b/examples-testing/examples/webgpu_postprocessing_masking.ts new file mode 100644 index 000000000..b234abc66 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_masking.ts @@ -0,0 +1,88 @@ +import * as THREE from 'three/webgpu'; +import { pass, texture } from 'three/tsl'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, renderPipeline, renderer; +let box, torus; + +init(); + +function init() { + // scene + + const baseScene = new THREE.Scene(); + baseScene.background = new THREE.Color(0xe0e0e0); + + const maskScene1 = new THREE.Scene(); + box = new THREE.Mesh(new THREE.BoxGeometry(4, 4, 4)); + maskScene1.add(box); + + const maskScene2 = new THREE.Scene(); + torus = new THREE.Mesh(new THREE.TorusGeometry(3, 1, 16, 32)); + maskScene2.add(torus); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 10; + + // textures + + const texture1 = new THREE.TextureLoader().load('textures/758px-Canestra_di_frutta_(Caravaggio).jpg'); + texture1.colorSpace = THREE.SRGBColorSpace; + texture1.minFilter = THREE.LinearFilter; + texture1.generateMipmaps = false; + texture1.flipY = false; + + const texture2 = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); + texture2.colorSpace = THREE.SRGBColorSpace; + texture2.flipY = false; + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + // post processing + + const base = pass(baseScene, camera); + const sceneMask1 = pass(maskScene1, camera).a; + const sceneMask2 = pass(maskScene2, camera).a; + + let compose = base; + compose = sceneMask1.mix(compose, texture(texture1)); + compose = sceneMask2.mix(compose, texture(texture2)); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = compose; +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + const time = performance.now() * 0.001 + 6000; + + box.position.x = Math.cos(time / 1.5) * 2; + box.position.y = Math.sin(time) * 2; + box.rotation.x = time; + box.rotation.y = time / 2; + + torus.position.x = Math.cos(time) * 2; + torus.position.y = Math.sin(time / 1.5) * 2; + torus.rotation.x = time; + torus.rotation.y = time / 2; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_motion_blur.ts b/examples-testing/examples/webgpu_postprocessing_motion_blur.ts new file mode 100644 index 000000000..1b5785ef1 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_motion_blur.ts @@ -0,0 +1,199 @@ +import * as THREE from 'three/webgpu'; +import { pass, texture, uniform, output, mrt, velocity, uv, screenUV, vec4 } from 'three/tsl'; +import { motionBlur } from 'three/addons/tsl/display/MotionBlur.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let boxLeft, boxRight, model, mixer, timer; +let renderPipeline; +let controls; + +const params = { + speed: 1.0, +}; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); + camera.position.set(0, 1.5, 4.5); + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x0487e2, 7, 25); + + const sunLight = new THREE.DirectionalLight(0xffe499, 5); + sunLight.castShadow = true; + sunLight.shadow.camera.near = 0.1; + sunLight.shadow.camera.far = 10; + sunLight.shadow.camera.right = 2; + sunLight.shadow.camera.left = -2; + sunLight.shadow.camera.top = 2; + sunLight.shadow.camera.bottom = -2; + sunLight.shadow.mapSize.width = 1024; + sunLight.shadow.mapSize.height = 1024; + sunLight.position.set(4, 4, 2); + + const waterAmbientLight = new THREE.HemisphereLight(0x333366, 0x74ccf4, 5); + const skyAmbientLight = new THREE.HemisphereLight(0x74ccf4, 0, 1); + + scene.add(sunLight); + scene.add(skyAmbientLight); + scene.add(waterAmbientLight); + + timer = new THREE.Timer(); + timer.connect(document); + + // animated model + + const loader = new GLTFLoader(); + loader.load('models/gltf/Xbot.glb', function (gltf) { + model = gltf.scene; + + model.rotation.y = Math.PI / 2; + + model.traverse(function (child) { + if (child.isMesh) { + child.castShadow = true; + child.receiveShadow = true; + } + }); + + mixer = new THREE.AnimationMixer(model); + + const action = mixer.clipAction(gltf.animations[3]); + action.play(); + + scene.add(model); + }); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const floorColor = textureLoader.load('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); + floorColor.wrapS = THREE.RepeatWrapping; + floorColor.wrapT = THREE.RepeatWrapping; + floorColor.colorSpace = THREE.SRGBColorSpace; + + const floorNormal = textureLoader.load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); + floorNormal.wrapS = THREE.RepeatWrapping; + floorNormal.wrapT = THREE.RepeatWrapping; + + // floor + + const floorUV = uv().mul(5); + + const floorMaterial = new THREE.MeshPhongNodeMaterial(); + floorMaterial.colorNode = texture(floorColor, floorUV); + + const floor = new THREE.Mesh(new THREE.BoxGeometry(15, 0.001, 15), floorMaterial); + floor.receiveShadow = true; + + floor.position.set(0, 0, 0); + scene.add(floor); + + const walls = new THREE.Mesh( + new THREE.BoxGeometry(15, 15, 15), + new THREE.MeshPhongNodeMaterial({ colorNode: floorMaterial.colorNode, side: THREE.BackSide }), + ); + scene.add(walls); + + const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); + map.colorSpace = THREE.SRGBColorSpace; + + const geometry = new THREE.TorusGeometry(0.8); + const material = new THREE.MeshBasicMaterial({ map }); + + boxRight = new THREE.Mesh(geometry, material); + boxRight.position.set(3.5, 1.5, -4); + scene.add(boxRight); + + boxLeft = new THREE.Mesh(geometry, material); + boxLeft.position.set(-3.5, 1.5, -4); + scene.add(boxLeft); + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 10; + controls.maxPolarAngle = Math.PI / 2; + controls.autoRotate = true; + controls.autoRotateSpeed = 1; + controls.target.set(0, 1, 0); + controls.enableDamping = true; + controls.dampingFactor = 0.05; + controls.update(); + + // post-processing + + const blurAmount = uniform(1); + + const scenePass = pass(scene, camera); + + scenePass.setMRT( + mrt({ + output, + velocity, + }), + ); + + const beauty = scenePass.getTextureNode().toInspector('Color'); + const vel = scenePass.getTextureNode('velocity').toInspector('Velocity').mul(blurAmount); + + const mBlur = motionBlur(beauty, vel); + + const vignette = screenUV.distance(0.5).remap(0.6, 1).mul(2).clamp().oneMinus(); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = vec4(mBlur.mul(vignette).rgb, mBlur.a); + + // + + const gui = renderer.inspector.createParameters('Motion Blur Settings'); + gui.add(controls, 'autoRotate'); + gui.add(blurAmount, 'value', 0, 3).name('blur amount'); + gui.add(params, 'speed', 0, 2); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + controls.update(); + + const delta = timer.getDelta(); + const speed = params.speed; + + boxRight.rotation.y += delta * 4 * speed; + boxLeft.scale.setScalar(1 + Math.sin(timer.getElapsed() * 10 * speed) * 0.2); + + if (model) { + mixer.update(delta * speed); + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_outline.ts b/examples-testing/examples/webgpu_postprocessing_outline.ts new file mode 100644 index 000000000..f87415b74 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_outline.ts @@ -0,0 +1,232 @@ +import * as THREE from 'three/webgpu'; +import { pass, uniform, time, oscSine } from 'three/tsl'; +import { outline } from 'three/addons/tsl/display/OutlineNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; + +let camera, scene, renderer, controls; +let renderPipeline, outlinePass; + +let selectedObjects = []; + +const raycaster = new THREE.Raycaster(); +const mouse = new THREE.Vector2(); + +const obj3d = new THREE.Object3D(); +const group = new THREE.Group(); + +init(); + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(width, height); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100); + camera.position.set(0, 0, 8); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 5; + controls.maxDistance = 20; + controls.enablePan = false; + controls.enableDamping = true; + controls.dampingFactor = 0.05; + + // + + scene.add(new THREE.AmbientLight(0xaaaaaa, 0.6)); + + const light = new THREE.DirectionalLight(0xddffdd, 2); + light.position.set(5, 5, 5); + light.castShadow = true; + light.shadow.mapSize.width = 2048; + light.shadow.mapSize.height = 2048; + + const d = 10; + + light.shadow.camera.left = -d; + light.shadow.camera.right = d; + light.shadow.camera.top = d; + light.shadow.camera.bottom = -d; + light.shadow.camera.far = 25; + + scene.add(light); + + // model + + const loader = new OBJLoader(); + loader.load('models/obj/tree.obj', function (object) { + let scale = 1.0; + + object.traverse(function (child) { + if (child instanceof THREE.Mesh) { + child.geometry.center(); + child.geometry.computeBoundingSphere(); + scale = 0.2 * child.geometry.boundingSphere.radius; + + const phongMaterial = new THREE.MeshPhongMaterial({ + color: 0xffffff, + specular: 0x111111, + shininess: 5, + }); + child.material = phongMaterial; + child.receiveShadow = true; + child.castShadow = true; + } + }); + + object.position.y = 1; + object.scale.divideScalar(scale); + obj3d.add(object); + }); + + scene.add(group); + + group.add(obj3d); + + // + + const geometry = new THREE.SphereGeometry(3, 48, 24); + + for (let i = 0; i < 20; i++) { + const material = new THREE.MeshLambertMaterial(); + material.color.setHSL(Math.random(), 1.0, 0.3); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.x = Math.random() * 4 - 2; + mesh.position.y = Math.random() * 4 - 2; + mesh.position.z = Math.random() * 4 - 2; + mesh.receiveShadow = true; + mesh.castShadow = true; + mesh.scale.multiplyScalar(Math.random() * 0.3 + 0.1); + group.add(mesh); + } + + const floorMaterial = new THREE.MeshLambertMaterial({ side: THREE.DoubleSide }); + + const floorGeometry = new THREE.PlaneGeometry(12, 12); + const floorMesh = new THREE.Mesh(floorGeometry, floorMaterial); + floorMesh.rotation.x -= Math.PI * 0.5; + floorMesh.position.y -= 1.5; + group.add(floorMesh); + floorMesh.receiveShadow = true; + + const torusGeometry = new THREE.TorusGeometry(1, 0.3, 16, 100); + const torusMaterial = new THREE.MeshPhongMaterial({ color: 0xffaaff }); + const torus = new THREE.Mesh(torusGeometry, torusMaterial); + torus.position.z = -4; + group.add(torus); + torus.receiveShadow = true; + torus.castShadow = true; + + // outline pass + + const edgeStrength = uniform(3.0); + const edgeGlow = uniform(0.0); + const edgeThickness = uniform(1.0); + const pulsePeriod = uniform(0); + const visibleEdgeColor = uniform(new THREE.Color(0xffffff)); + const hiddenEdgeColor = uniform(new THREE.Color(0x4e3636)); + + outlinePass = outline(scene, camera, { + selectedObjects, + edgeGlow, + edgeThickness, + }); + + const { visibleEdge, hiddenEdge } = outlinePass; + + const period = time.div(pulsePeriod).mul(2); + const osc = oscSine(period).mul(0.5).add(0.5); // osc [ 0.5, 1.0 ] + + const outlineColor = visibleEdge.mul(visibleEdgeColor).add(hiddenEdge.mul(hiddenEdgeColor)).mul(edgeStrength); + const outlinePulse = pulsePeriod.greaterThan(0).select(outlineColor.mul(osc), outlineColor); + + // postprocessing + + const scenePass = pass(scene, camera).toInspector('Color'); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = outlinePulse.add(scenePass); + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(edgeStrength, 'value', 0.01, 10).name('edgeStrength'); + gui.add(edgeGlow, 'value', 0.0, 1).name('edgeGlow'); + gui.add(edgeThickness, 'value', 1, 4).name('edgeThickness'); + gui.add(pulsePeriod, 'value', 0.0, 5).name('pulsePeriod'); + gui.addColor({ color: visibleEdgeColor.value.getHex(THREE.SRGBColorSpace) }, 'color') + .onChange(value => { + visibleEdgeColor.value.set(value); + }) + .name('visibleEdgeColor'); + gui.addColor({ color: hiddenEdgeColor.value.getHex(THREE.SRGBColorSpace) }, 'color') + .onChange(value => { + hiddenEdgeColor.value.set(value); + }) + .name('hiddenEdgeColor'); + + // + + window.addEventListener('resize', onWindowResize); + + renderer.domElement.style.touchAction = 'none'; + renderer.domElement.addEventListener('pointermove', onPointerMove); + + function onPointerMove(event) { + if (event.isPrimary === false) return; + + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; + + checkIntersection(); + } + + function addSelectedObject(object) { + selectedObjects = []; + selectedObjects.push(object); + } + + function checkIntersection() { + raycaster.setFromCamera(mouse, camera); + + const intersects = raycaster.intersectObject(scene, true); + + if (intersects.length > 0) { + const selectedObject = intersects[0].object; + addSelectedObject(selectedObject); + outlinePass.selectedObjects = selectedObjects; + } else { + // outlinePass.selectedObjects = []; + } + } +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_pixel.ts b/examples-testing/examples/webgpu_postprocessing_pixel.ts new file mode 100644 index 000000000..a3d58f203 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_pixel.ts @@ -0,0 +1,237 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { uniform } from 'three/tsl'; +import { pixelationPass } from 'three/addons/tsl/display/PixelationPassNode.js'; + +let camera, scene, renderer, renderPipeline, crystalMesh, timer; +let effectController; + +init(); + +function init() { + const aspectRatio = window.innerWidth / window.innerHeight; + + camera = new THREE.OrthographicCamera(-aspectRatio, aspectRatio, 1, -1, 0.1, 10); + camera.position.y = 2 * Math.tan(Math.PI / 6); + camera.position.z = 2; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x151729); + + timer = new THREE.Timer(); + timer.connect(document); + + // textures + + const loader = new THREE.TextureLoader(); + const texChecker = pixelTexture(loader.load('textures/checker.png')); + const texChecker2 = pixelTexture(loader.load('textures/checker.png')); + texChecker.repeat.set(3, 3); + texChecker2.repeat.set(1.5, 1.5); + + // meshes + + const boxMaterial = new THREE.MeshPhongMaterial({ map: texChecker2 }); + + function addBox(boxSideLength, x, z, rotation) { + const mesh = new THREE.Mesh(new THREE.BoxGeometry(boxSideLength, boxSideLength, boxSideLength), boxMaterial); + mesh.castShadow = true; + mesh.receiveShadow = true; + mesh.rotation.y = rotation; + mesh.position.y = boxSideLength / 2; + mesh.position.set(x, boxSideLength / 2 + 0.0001, z); + scene.add(mesh); + return mesh; + } + + addBox(0.4, 0, 0, Math.PI / 4); + addBox(0.5, -0.5, -0.5, Math.PI / 4); + + const planeSideLength = 2; + const planeMesh = new THREE.Mesh( + new THREE.PlaneGeometry(planeSideLength, planeSideLength), + new THREE.MeshPhongMaterial({ map: texChecker }), + ); + planeMesh.receiveShadow = true; + planeMesh.rotation.x = -Math.PI / 2; + scene.add(planeMesh); + + const radius = 0.2; + const geometry = new THREE.IcosahedronGeometry(radius); + crystalMesh = new THREE.Mesh( + geometry, + new THREE.MeshPhongMaterial({ + color: 0x68b7e9, + emissive: 0x4f7e8b, + shininess: 10, + specular: 0xffffff, + }), + ); + crystalMesh.receiveShadow = true; + crystalMesh.castShadow = true; + scene.add(crystalMesh); + + // lights + + scene.add(new THREE.AmbientLight(0x757f8e, 3)); + + const directionalLight = new THREE.DirectionalLight(0xfffecd, 1.5); + directionalLight.position.set(100, 100, 100); + directionalLight.castShadow = true; + directionalLight.shadow.mapSize.set(2048, 2048); + scene.add(directionalLight); + + const spotLight = new THREE.SpotLight(0xffc100, 10, 10, Math.PI / 16, 0.02, 2); + spotLight.position.set(2, 2, 0); + const target = spotLight.target; + scene.add(target); + target.position.set(0, 0, 0); + spotLight.castShadow = true; + scene.add(spotLight); + + renderer = new THREE.WebGPURenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.BasicShadowMap; + document.body.appendChild(renderer.domElement); + + effectController = { + pixelSize: uniform(6), + normalEdgeStrength: uniform(0.3), + depthEdgeStrength: uniform(0.4), + pixelAlignedPanning: true, + }; + + renderPipeline = new THREE.RenderPipeline(renderer); + const scenePass = pixelationPass( + scene, + camera, + effectController.pixelSize, + effectController.normalEdgeStrength, + effectController.depthEdgeStrength, + ); + renderPipeline.outputNode = scenePass; + + window.addEventListener('resize', onWindowResize); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.maxZoom = 2; + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(effectController.pixelSize, 'value', 1, 16, 1).name('Pixel Size'); + gui.add(effectController.normalEdgeStrength, 'value', 0, 2, 0.05).name('Normal Edge Strength'); + gui.add(effectController.depthEdgeStrength, 'value', 0, 1, 0.05).name('Depth Edge Strength'); + gui.add(effectController, 'pixelAlignedPanning'); +} + +function onWindowResize() { + const aspectRatio = window.innerWidth / window.innerHeight; + camera.left = -aspectRatio; + camera.right = aspectRatio; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const t = timer.getElapsed(); + + crystalMesh.material.emissiveIntensity = Math.sin(t * 3) * 0.5 + 0.5; + crystalMesh.position.y = 0.7 + Math.sin(t * 2) * 0.05; + crystalMesh.rotation.y = stopGoEased(t, 2, 4) * 2 * Math.PI; + + const rendererSize = renderer.getSize(new THREE.Vector2()); + const aspectRatio = rendererSize.x / rendererSize.y; + + if (effectController.pixelAlignedPanning) { + const pixelSize = effectController.pixelSize.value; + + pixelAlignFrustum( + camera, + aspectRatio, + Math.floor(rendererSize.x / pixelSize), + Math.floor(rendererSize.y / pixelSize), + ); + } else if (camera.left != -aspectRatio || camera.top != 1.0) { + // Reset the Camera Frustum if it has been modified + camera.left = -aspectRatio; + camera.right = aspectRatio; + camera.top = 1.0; + camera.bottom = -1.0; + camera.updateProjectionMatrix(); + } + + renderPipeline.render(); +} + +// Helper functions + +function pixelTexture(texture) { + texture.minFilter = THREE.NearestFilter; + texture.magFilter = THREE.NearestFilter; + texture.generateMipmaps = false; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.colorSpace = THREE.SRGBColorSpace; + return texture; +} + +function easeInOutCubic(x) { + return x ** 2 * 3 - x ** 3 * 2; +} + +function linearStep(x, edge0, edge1) { + const w = edge1 - edge0; + const m = 1 / w; + const y0 = -m * edge0; + return THREE.MathUtils.clamp(y0 + m * x, 0, 1); +} + +function stopGoEased(x, downtime, period) { + const cycle = (x / period) | 0; + const tween = x - cycle * period; + const linStep = easeInOutCubic(linearStep(tween, downtime, period)); + return cycle + linStep; +} + +function pixelAlignFrustum(camera, aspectRatio, pixelsPerScreenWidth, pixelsPerScreenHeight) { + // 0. Get Pixel Grid Units + const worldScreenWidth = (camera.right - camera.left) / camera.zoom; + const worldScreenHeight = (camera.top - camera.bottom) / camera.zoom; + const pixelWidth = worldScreenWidth / pixelsPerScreenWidth; + const pixelHeight = worldScreenHeight / pixelsPerScreenHeight; + + // 1. Project the current camera position along its local rotation bases + const camPos = new THREE.Vector3(); + camera.getWorldPosition(camPos); + const camRot = new THREE.Quaternion(); + camera.getWorldQuaternion(camRot); + const camRight = new THREE.Vector3(1.0, 0.0, 0.0).applyQuaternion(camRot); + const camUp = new THREE.Vector3(0.0, 1.0, 0.0).applyQuaternion(camRot); + const camPosRight = camPos.dot(camRight); + const camPosUp = camPos.dot(camUp); + + // 2. Find how far along its position is along these bases in pixel units + const camPosRightPx = camPosRight / pixelWidth; + const camPosUpPx = camPosUp / pixelHeight; + + // 3. Find the fractional pixel units and convert to world units + const fractX = camPosRightPx - Math.round(camPosRightPx); + const fractY = camPosUpPx - Math.round(camPosUpPx); + + // 4. Add fractional world units to the left/right top/bottom to align with the pixel grid + camera.left = -aspectRatio - fractX * pixelWidth; + camera.right = aspectRatio - fractX * pixelWidth; + camera.top = 1.0 - fractY * pixelHeight; + camera.bottom = -1.0 - fractY * pixelHeight; + camera.updateProjectionMatrix(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_radial_blur.ts b/examples-testing/examples/webgpu_postprocessing_radial_blur.ts new file mode 100644 index 000000000..f358421e3 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_radial_blur.ts @@ -0,0 +1,149 @@ +import * as THREE from 'three/webgpu'; +import { float, int, pass, uniform } from 'three/tsl'; +import { radialBlur } from 'three/addons/tsl/display/radialBlur.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const params = { + enabled: true, + animated: true, +}; + +let camera, scene, renderer, timer, group; +let renderPipeline; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); + camera.position.z = 50; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + timer = new THREE.Timer(); + + // + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d); + hemiLight.position.set(0, 1000, 0); + scene.add(hemiLight); + + const pointLight = new THREE.PointLight(0xffffff, 1000); + pointLight.position.set(0, 0, 0); + scene.add(pointLight); + + // + + group = new THREE.Group(); + + const geometry = new THREE.TetrahedronGeometry(); + const material = new THREE.MeshStandardMaterial({ flatShading: true }); + + const mesh = new THREE.InstancedMesh(geometry, material, 100); + const dummy = new THREE.Object3D(); + const col = new THREE.Color(); + const center = new THREE.Vector2(); + + for (let i = 0; i < mesh.count; i++) { + dummy.position.x = Math.random() * 50 - 25; + dummy.position.y = Math.random() * 50 - 25; + dummy.position.z = Math.random() * 50 - 25; + + center.set(dummy.position.x, dummy.position.y); + + // make sure tetrahedrons are not positioned at the origin + + if (center.length() < 6) { + center.normalize().multiplyScalar(6); + dummy.position.x = center.x; + dummy.position.y = center.y; + } + + dummy.scale.setScalar(Math.random() * 2 + 1); + + dummy.rotation.x = Math.random() * Math.PI; + dummy.rotation.y = Math.random() * Math.PI; + dummy.rotation.z = Math.random() * Math.PI; + + dummy.updateMatrix(); + mesh.setMatrixAt(i, dummy.matrix); + + col.setHSL(0.55 + (i / mesh.count) * 0.15, 1, 0.2); + + mesh.setColorAt(i, col); + } + + group.add(mesh); + scene.add(group); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.toneMapping = THREE.NeutralToneMapping; + document.body.appendChild(renderer.domElement); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + + const weightUniform = uniform(float(0.9)); + const decayUniform = uniform(float(0.95)); + const exposureUniform = uniform(int(5)); + const countUniform = uniform(int(32)); + + const blurPass = radialBlur(scenePass, { + weight: weightUniform, + decay: decayUniform, + count: countUniform, + exposure: exposureUniform, + }); + + renderPipeline.outputNode = blurPass; + + // + + window.addEventListener('resize', onWindowResize); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(weightUniform, 'value', 0, 1).name('weight'); + gui.add(decayUniform, 'value', 0, 1).name('decay'); + gui.add(countUniform, 'value', 16, 64, 1).name('sample count'); + gui.add(exposureUniform, 'value', 1, 10).name('exposure'); + gui.add(params, 'enabled').onChange(value => { + if (value === true) { + renderPipeline.outputNode = blurPass; + } else { + renderPipeline.outputNode = scenePass; + } + + renderPipeline.needsUpdate = true; + }); + gui.add(params, 'animated'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + const delta = timer.getDelta(); + + if (params.animated === true) { + group.rotation.y += delta * 0.1; + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_retro.ts b/examples-testing/examples/webgpu_postprocessing_retro.ts new file mode 100644 index 000000000..b9958352f --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_retro.ts @@ -0,0 +1,370 @@ +import * as THREE from 'three/webgpu'; +import { + pass, + mix, + mul, + oneMinus, + positionLocal, + smoothstep, + texture, + time, + rotateUV, + Fn, + uv, + vec2, + vec3, + vec4, + uniform, + posterize, + floor, + float, + sin, + fract, + dot, + step, + color, + normalWorld, + length, + atan, + replaceDefaultUV, + screenSize, +} from 'three/tsl'; +import { retroPass } from 'three/addons/tsl/display/RetroPassNode.js'; +import { bayerDither } from 'three/addons/tsl/math/Bayer.js'; +import { scanlines, vignette, colorBleeding, barrelUV } from 'three/addons/tsl/display/CRT.js'; +import { circle } from 'three/addons/tsl/display/Shape.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline, controls; +let environment; +let currentModel; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(8, 5, 20); + + scene = new THREE.Scene(); + + // PS1-style background: gradient sky with simple stars + + const ps1Background = Fn(() => { + // Flip Y coordinate for correct orientation + const flippedY = normalWorld.y.negate(); + const skyUV = flippedY.mul(0.5).add(0.5); + + // Simple gradient sky (dark blue at top to purple/orange at horizon) + const topColor = color(0x000033); // dark blue night sky + const midColor = color(0x330066); // purple + const horizonColor = color(0x663322); // warm orange/brown horizon + + // Two-step gradient (inverted - top is dark, horizon is warm) + const skyGradient = mix( + horizonColor, + mix(midColor, topColor, skyUV.smoothstep(0.4, 0.9)), + skyUV.smoothstep(0.0, 0.4), + ); + + // PS1-style "stars" using spherical coordinates + const longitude = atan(normalWorld.x, normalWorld.z); + const latitude = flippedY.asin(); // Use flipped Y for latitude too + + // More stars with smaller scale + const starScale = float(50.0); + const starUV = vec2(longitude.mul(starScale), latitude.mul(starScale)); + const starCell = floor(starUV); + + // Hash for randomness + const cellHash = fract(sin(dot(starCell, vec2(12.9898, 78.233))).mul(43758.5453)); + + // Position within cell (0-1) + const cellUV = fract(starUV); + const toCenter = cellUV.sub(0.5); + + // Gemini-style star: bright center with soft glow + cross flare + const distToCenter = length(toCenter); + + // Core (small bright center) + const core = smoothstep(float(0.08), float(0.0), distToCenter); + + // Soft glow around + const glow = smoothstep(float(0.25), float(0.0), distToCenter).mul(0.4); + + // Cross/diamond flare effect + const crossX = smoothstep(float(0.15), float(0.0), toCenter.x.abs()).mul( + smoothstep(float(0.4), float(0.0), toCenter.y.abs()), + ); + const crossY = smoothstep(float(0.15), float(0.0), toCenter.y.abs()).mul( + smoothstep(float(0.4), float(0.0), toCenter.x.abs()), + ); + const cross = crossX.add(crossY).mul(0.3); + + // Combine star shape + const starShape = core.add(glow).add(cross); + + // More stars (lower threshold = more stars) + const isStar = step(0.85, cellHash); + + // Show stars from horizon up + const aboveHorizon = smoothstep(float(-0.2), float(0.1), flippedY); + + // Star brightness varies + twinkle color + const starIntensity = isStar.mul(aboveHorizon).mul(starShape).mul(cellHash.mul(0.6).add(0.4)); + + // Slight color variation (white to light blue) + const starColor = mix(vec3(1.0, 1.0, 0.95), vec3(0.8, 0.9, 1.0), cellHash); + + // Combine sky and stars + const finalColor = mix(skyGradient, starColor, starIntensity.clamp(0.0, 1.0)); + + return finalColor; + })(); + + scene.backgroundNode = ps1Background; + + // Loaders + + const gltfLoader = new GLTFLoader(); + const textureLoader = new THREE.TextureLoader(); + + // Model + + const models = { + 'Coffee Mug': 'models/gltf/coffeeMug.glb', + 'Damaged Helmet': 'models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', + }; + + function loadModel(name) { + function loadEnvironment() { + if (environment) return; + + environment = new HDRLoader().setPath('textures/equirectangular/').load('venice_sunset_1k.hdr', texture => { + texture.mapping = THREE.EquirectangularReflectionMapping; + scene.environment = texture; + + // re-invalidate retro pass textures + + retro.dispose(); + }); + } + + if (currentModel) { + scene.remove(currentModel); + currentModel.traverse(child => { + if (child.isMesh) { + child.geometry.dispose(); + child.material.dispose(); + } + }); + } + + gltfLoader.load(models[name], gltf => { + currentModel = gltf.scene; + currentModel.position.set(0, 0, 0); + + smoke.visible = false; + + if (name === 'Damaged Helmet') { + loadEnvironment(); + + currentModel.scale.setScalar(3); + currentModel.position.y = 1; + } else if (name === 'Coffee Mug') { + smoke.visible = true; + } + + scene.add(currentModel); + }); + } + + loadModel('Coffee Mug'); + + // lighting + + const ambientLight = new THREE.AmbientLight(0x404040, 2); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight(0xffffff, 3); + directionalLight.position.set(5, 10, 5); + scene.add(directionalLight); + + const pointLight = new THREE.PointLight(0xff6600, 5, 20); + pointLight.position.set(-3, 3, 2); + scene.add(pointLight); + + // geometry + + const smokeGeometry = new THREE.PlaneGeometry(1, 1, 16, 64); + smokeGeometry.translate(0, 0.5, 0); + smokeGeometry.scale(1.5, 6, 1.5); + + // texture + + const noiseTexture = textureLoader.load('./textures/noises/perlin/128x128.png'); + noiseTexture.wrapS = THREE.RepeatWrapping; + noiseTexture.wrapT = THREE.RepeatWrapping; + + // material + + const smokeMaterial = new THREE.MeshBasicNodeMaterial({ + transparent: true, + side: THREE.DoubleSide, + depthWrite: false, + }); + + // position + + smokeMaterial.positionNode = Fn(() => { + // twist + + const twistNoiseUv = vec2(0.5, uv().y.mul(0.2).sub(time.mul(0.005)).mod(1)); + const twist = texture(noiseTexture, twistNoiseUv).r.mul(10); + positionLocal.xz.assign(rotateUV(positionLocal.xz, twist, vec2(0))); + + // wind + + const windOffset = vec2( + texture(noiseTexture, vec2(0.25, time.mul(0.01)).mod(1)).r.sub(0.5), + texture(noiseTexture, vec2(0.75, time.mul(0.01)).mod(1)).r.sub(0.5), + ).mul(uv().y.pow(2).mul(10)); + positionLocal.addAssign(windOffset); + + return positionLocal; + })(); + + // color + + smokeMaterial.colorNode = Fn(() => { + // alpha + + const alphaNoiseUv = uv() + .mul(vec2(0.5, 0.3)) + .add(vec2(0, time.mul(0.03).negate())); + const alpha = mul( + // pattern + texture(noiseTexture, alphaNoiseUv).r.smoothstep(0.4, 1), + + // edges fade + smoothstep(0, 0.1, uv().x), + smoothstep(0, 0.1, oneMinus(uv().x)), + smoothstep(0, 0.1, uv().y), + smoothstep(0, 0.1, oneMinus(uv().y)), + ); + + // color + + const finalColor = mix(vec3(0.6, 0.3, 0.2), vec3(1, 1, 1), alpha.pow(3)); + + return vec4(finalColor, alpha); + })(); + + // mesh + + const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial); + smoke.position.y = 1.83; + scene.add(smoke); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // uniforms + + // PS1-style: 15-bit color (32 levels per channel) + const colorDepthSteps = uniform(32); + + // CRT effect parameters (subtle for PS1 look) + const scanlineIntensity = uniform(0.3); // subtle scanlines + const scanlineDensity = uniform(1); // 0.1-1: normalized scanline density (1 = full screen resolution) + const scanlineSpeed = uniform(0.0); // no scanline movement + const vignetteIntensity = uniform(0.3); // subtle vignette + const bleeding = uniform(0.001); // minimal bleeding + const curvature = uniform(0.02); // subtle curve + const affineDistortion = uniform(0); // no affine distortion + + // render pipeline + + renderPipeline = new THREE.RenderPipeline(renderer); + + // retro pipeline + + const distortedUV = barrelUV(curvature); + const distortedDelta = circle(curvature.add(0.1).mul(10), 1).mul(curvature).mul(0.05); + + const retro = retroPass(scene, camera, { affineDistortion }); + + let retroPipeline = retro; + retroPipeline = replaceDefaultUV(distortedUV, retroPipeline); + retroPipeline = colorBleeding(retroPipeline, bleeding.add(distortedDelta)); + retroPipeline = bayerDither(retroPipeline, colorDepthSteps); + retroPipeline = posterize(retroPipeline, colorDepthSteps); + retroPipeline = vignette(retroPipeline, vignetteIntensity, 0.6); + retroPipeline = scanlines(retroPipeline, scanlineIntensity, screenSize.y.mul(scanlineDensity), scanlineSpeed); + + renderPipeline.outputNode = retroPipeline; + + // default pass (no post-processing) + + const defaultPass = pass(scene, camera); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + controls.target.y = 1; + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add({ model: 'Coffee Mug' }, 'model', Object.keys(models)).name('Model').onChange(loadModel); + + gui.add({ enabled: true }, 'enabled') + .onChange(v => { + renderPipeline.outputNode = v ? retroPipeline : defaultPass; + renderPipeline.needsUpdate = true; + }) + .name('Retro Pipeline'); + + gui.add(curvature, 'value', 0, 0.2, 0.01).name('Curvature'); + gui.add(colorDepthSteps, 'value', 4, 32, 1).name('Color Depth'); + gui.add(scanlineIntensity, 'value', 0, 1, 0.01).name('Scanlines'); + gui.add(scanlineDensity, 'value', 0.02, 1, 0.01).name('Scanline Density'); + gui.add(scanlineSpeed, 'value', 0, 0.1, 0.01).name('Scanline Speed'); + gui.add(vignetteIntensity, 'value', 0, 1, 0.01).name('Vignette'); + gui.add(bleeding, 'value', 0, 0.005, 0.001).name('Color Bleeding'); + gui.add(affineDistortion, 'value', 0, 1).name('Affine Distortion'); + gui.add(retro, 'filterTextures') + .name('Filter Textures') + .onChange(() => { + retro.dispose(); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_smaa.ts b/examples-testing/examples/webgpu_postprocessing_smaa.ts new file mode 100644 index 000000000..f06374258 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_smaa.ts @@ -0,0 +1,98 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; +import { smaa } from 'three/addons/tsl/display/SMAANode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline; + +const params = { + enabled: true, + autoRotate: true, +}; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.z = 300; + + scene = new THREE.Scene(); + + const geometry = new THREE.BoxGeometry(120, 120, 120); + const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.position.x = -100; + scene.add(mesh1); + + const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); + texture.colorSpace = THREE.SRGBColorSpace; + + const material2 = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.position.x = 100; + scene.add(mesh2); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera).toInspector('Color'); + const smaaPass = smaa(scenePass); + + renderPipeline.outputNode = smaaPass; + + // + + window.addEventListener('resize', onWindowResize); + + const gui = renderer.inspector.createParameters('Settings'); + + const smaaFolder = gui.addFolder('SMAA'); + smaaFolder.add(params, 'enabled').onChange(value => { + if (value === true) { + renderPipeline.outputNode = smaaPass; + } else { + renderPipeline.outputNode = scenePass; + } + + renderPipeline.needsUpdate = true; + }); + + const sceneFolder = gui.addFolder('Scene'); + sceneFolder.add(params, 'autoRotate'); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + if (params.autoRotate === true) { + for (let i = 0; i < scene.children.length; i++) { + const child = scene.children[i]; + + child.rotation.x += 0.005; + child.rotation.y += 0.01; + } + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_sobel.ts b/examples-testing/examples/webgpu_postprocessing_sobel.ts new file mode 100644 index 000000000..52cbe53a4 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_sobel.ts @@ -0,0 +1,95 @@ +import * as THREE from 'three/webgpu'; +import { pass, renderOutput } from 'three/tsl'; +import { sobel } from 'three/addons/tsl/display/SobelOperatorNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls; +let renderPipeline; + +const params = { + enabled: true, +}; + +init(); + +async function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 1, 3); + + // + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/DragonAttenuation.glb'); + const model = gltf.scene.children[1]; + model.material = new THREE.MeshStandardNodeMaterial(); + + scene.add(model); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.toneMapping = THREE.LinearToneMapping; + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + pmremGenerator.dispose(); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.enableZoom = false; + controls.target.set(0, 0.5, 0); + controls.update(); + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = false; + + const scenePass = pass(scene, camera); + + renderPipeline.outputNode = sobel(renderOutput(scenePass)); + + // + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'enabled'); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + if (params.enabled === true) { + renderPipeline.render(); + } else { + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgpu_postprocessing_ssaa.ts b/examples-testing/examples/webgpu_postprocessing_ssaa.ts new file mode 100644 index 000000000..2c60c4842 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_ssaa.ts @@ -0,0 +1,169 @@ +import * as THREE from 'three/webgpu'; +import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let scene, mesh, renderer, renderPipeline; +let camera, ssaaRenderPass; +let timer; + +const params = { + sampleLevel: 3, + camera: 'perspective', + clearColor: 'black', + clearAlpha: 1.0, + viewOffsetX: 0, + autoRotate: true, +}; + +init(); + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + timer = new THREE.Timer(); + timer.connect(document); + + camera = new THREE.PerspectiveCamera(65, width / height, 3, 10); + camera.position.z = 7; + camera.setViewOffset(width, height, params.viewOffsetX, 0, width, height); + + scene = new THREE.Scene(); + + const group = new THREE.Group(); + scene.add(group); + + const light = new THREE.PointLight(0xefffef, 500); + light.position.z = 10; + light.position.y = -10; + light.position.x = -10; + scene.add(light); + + const light2 = new THREE.PointLight(0xffefef, 500); + light2.position.z = 10; + light2.position.x = -10; + light2.position.y = 10; + scene.add(light2); + + const light3 = new THREE.PointLight(0xefefff, 500); + light3.position.z = 10; + light3.position.x = 10; + light3.position.y = -10; + scene.add(light3); + + const light4 = new THREE.AmbientLight(0xffffff, 0.2); + scene.add(light4); + + const geometry = new THREE.SphereGeometry(3, 48, 24); + const material = new THREE.MeshStandardMaterial(); + + mesh = new THREE.InstancedMesh(geometry, material, 120); + + const dummy = new THREE.Mesh(); + const color = new THREE.Color(); + + for (let i = 0; i < mesh.count; i++) { + dummy.position.x = Math.random() * 4 - 2; + dummy.position.y = Math.random() * 4 - 2; + dummy.position.z = Math.random() * 4 - 2; + dummy.rotation.x = Math.random(); + dummy.rotation.y = Math.random(); + dummy.rotation.z = Math.random(); + dummy.scale.setScalar(Math.random() * 0.2 + 0.05); + + dummy.updateMatrix(); + + color.setHSL(Math.random(), 1.0, 0.3); + + mesh.setMatrixAt(i, dummy.matrix); + mesh.setColorAt(i, color); + } + + scene.add(mesh); + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + + ssaaRenderPass = ssaaPass(scene, camera); + const scenePassColor = ssaaRenderPass.getTextureNode(); + + renderPipeline.outputNode = scenePassColor; + + window.addEventListener('resize', onWindowResize); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(params, 'sampleLevel', { + 'Level 0: 1 Sample': 0, + 'Level 1: 2 Samples': 1, + 'Level 2: 4 Samples': 2, + 'Level 3: 8 Samples': 3, + 'Level 4: 16 Samples': 4, + 'Level 5: 32 Samples': 5, + }); + gui.add(params, 'clearColor', ['black', 'white', 'blue', 'green', 'red']); + gui.add(params, 'clearAlpha', 0, 1); + gui.add(params, 'viewOffsetX', -100, 100); + gui.add(params, 'autoRotate'); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.setViewOffset(width, height, params.viewOffsetX, 0, width, height); + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + timer.update(); + + if (params.autoRotate) { + const delta = timer.getDelta(); + + mesh.rotation.x += delta * 0.25; + mesh.rotation.y += delta * 0.5; + } + + let newColor; + + switch (params.clearColor) { + case 'blue': + newColor = 0x0000ff; + break; + case 'red': + newColor = 0xff0000; + break; + case 'green': + newColor = 0x00ff00; + break; + case 'white': + newColor = 0xffffff; + break; + case 'black': + newColor = 0x000000; + break; + } + + renderer.setClearColor(newColor, params.clearAlpha); + + ssaaRenderPass.sampleLevel = params.sampleLevel; + + camera.view.offsetX = params.viewOffsetX; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_ssgi.ts b/examples-testing/examples/webgpu_postprocessing_ssgi.ts new file mode 100644 index 000000000..cdb24ae66 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_ssgi.ts @@ -0,0 +1,244 @@ +import * as THREE from 'three/webgpu'; +import { + pass, + mrt, + output, + normalView, + diffuseColor, + velocity, + add, + vec3, + vec4, + packNormalToRGB, + unpackRGBToNormal, + sample, +} from 'three/tsl'; +import { ssgi } from 'three/addons/tsl/display/SSGINode.js'; +import { traa } from 'three/addons/tsl/display/TRAANode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline, controls; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 10, 30); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xaaaaaa); + + renderer = new THREE.WebGPURenderer(); + //renderer.setPixelRatio( window.devicePixelRatio ); // probably too costly for most hardware + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 7, 0); + controls.enablePan = true; + controls.minDistance = 1; + controls.maxDistance = 100; + controls.update(); + + // + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + scenePass.setMRT( + mrt({ + output: output, + diffuseColor: diffuseColor, + normal: packNormalToRGB(normalView), + velocity: velocity, + }), + ); + + const scenePassColor = scenePass.getTextureNode('output'); + const scenePassDiffuse = scenePass.getTextureNode('diffuseColor').toInspector('Diffuse Color'); + const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { + return scenePass.getLinearDepthNode(); + }); + + const scenePassNormal = scenePass.getTextureNode('normal').toInspector('Normal'); + const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); + + // bandwidth optimization + + const diffuseTexture = scenePass.getTexture('diffuseColor'); + diffuseTexture.type = THREE.UnsignedByteType; + + const normalTexture = scenePass.getTexture('normal'); + normalTexture.type = THREE.UnsignedByteType; + + const sceneNormal = sample(uv => { + return unpackRGBToNormal(scenePassNormal.sample(uv)); + }); + + // gi + + const giPass = ssgi(scenePassColor, scenePassDepth, sceneNormal, camera); + giPass.sliceCount.value = 2; + giPass.stepCount.value = 8; + + // composite + + const ao = giPass.getAONode().toInspector('SSGI.AO'); + const gi = giPass.getGINode().toInspector('SSGI.GI'); + + const compositePass = vec4(add(scenePassColor.rgb.mul(ao), scenePassDiffuse.rgb.mul(gi.rgb)), scenePassColor.a); + compositePass.name = 'Composite'; + + // traa + + const traaPass = traa(compositePass, scenePassDepth, scenePassVelocity, camera); + renderPipeline.outputNode = traaPass; + + // Cornell Box inspired scene + + // Walls + const wallGeometry = new THREE.PlaneGeometry(1, 1); + + // Left wall - red + const redWallMaterial = new THREE.MeshPhysicalMaterial({ color: '#ff0000' }); + const leftWall = new THREE.Mesh(wallGeometry, redWallMaterial); + leftWall.scale.set(20, 15, 1); + leftWall.rotation.y = Math.PI * 0.5; + leftWall.position.set(-10, 7.5, 0); + leftWall.receiveShadow = true; + scene.add(leftWall); + + // Right wall - green + const greenWallMaterial = new THREE.MeshPhysicalMaterial({ color: '#00ff00' }); + const rightWall = new THREE.Mesh(wallGeometry, greenWallMaterial); + rightWall.scale.set(20, 15, 1); + rightWall.rotation.y = Math.PI * -0.5; + rightWall.position.set(10, 7.5, 0); + rightWall.receiveShadow = true; + scene.add(rightWall); + + // White walls and boxes + const whiteMaterial = new THREE.MeshPhysicalMaterial({ color: '#fff' }); + + // Floor + const floor = new THREE.Mesh(wallGeometry, whiteMaterial); + floor.scale.set(20, 20, 1); + floor.rotation.x = Math.PI * -0.5; + floor.receiveShadow = true; + scene.add(floor); + + // Back wall + const backWall = new THREE.Mesh(wallGeometry, whiteMaterial); + backWall.scale.set(15, 20, 1); + backWall.rotation.z = Math.PI * -0.5; + backWall.position.set(0, 7.5, -10); + backWall.receiveShadow = true; + scene.add(backWall); + + // Ceiling + const ceiling = new THREE.Mesh(wallGeometry, whiteMaterial); + ceiling.scale.set(20, 20, 1); + ceiling.rotation.x = Math.PI * 0.5; + ceiling.position.set(0, 15, 0); + ceiling.receiveShadow = true; + scene.add(ceiling); + + // Boxes + const tallBoxGeometry = new THREE.BoxGeometry(5, 7, 5); + const tallBox = new THREE.Mesh(tallBoxGeometry, whiteMaterial); + tallBox.rotation.y = Math.PI * 0.25; + tallBox.position.set(-3, 3.5, -2); + tallBox.castShadow = true; + tallBox.receiveShadow = true; + scene.add(tallBox); + + const shortBoxGeometry = new THREE.BoxGeometry(4, 4, 4); + const shortBox = new THREE.Mesh(shortBoxGeometry, whiteMaterial); + shortBox.rotation.y = Math.PI * -0.1; + shortBox.position.set(4, 2, 4); + shortBox.castShadow = true; + shortBox.receiveShadow = true; + scene.add(shortBox); + + // Light source geometry + const lightSourceGeometry = new THREE.CylinderGeometry(2.5, 2.5, 1, 64); + const lightSourceMaterial = new THREE.MeshBasicMaterial(); + const lightSource = new THREE.Mesh(lightSourceGeometry, lightSourceMaterial); + lightSource.position.y = 15; + scene.add(lightSource); + + // Point light + const pointLight = new THREE.PointLight('#ffffff', 100); + pointLight.position.set(0, 13, 0); + pointLight.distance = 100; + pointLight.castShadow = true; + pointLight.shadow.mapSize.width = 1024; + pointLight.shadow.mapSize.height = 1024; + scene.add(pointLight); + + // Ambient light + const ambientLight = new THREE.AmbientLight('#0c0c0c'); + scene.add(ambientLight); + + window.addEventListener('resize', onWindowResize); + + // + + const params = { + output: 0, + }; + + const types = { Combined: 0, Direct: 3, AO: 1, GI: 2 }; + + const gui = renderer.inspector.createParameters('SSGI settings'); + gui.add(params, 'output', types).onChange(updatePostprocessing); + gui.add(giPass.sliceCount, 'value', 1, 4, 1).name('slice count'); + gui.add(giPass.stepCount, 'value', 1, 32, 1).name('step count'); + gui.add(giPass.radius, 'value', 1, 25).name('radius'); + gui.add(giPass.expFactor, 'value', 1, 3).name('exp factor'); + gui.add(giPass.thickness, 'value', 0.01, 10).name('thickness'); + gui.add(giPass.backfaceLighting, 'value', 0, 1).name('backface lighting'); + gui.add(giPass.aoIntensity, 'value', 0, 4).name('AO intensity'); + gui.add(giPass.giIntensity, 'value', 0, 100).name('GI intensity'); + gui.add(giPass.useLinearThickness, 'value').name('use linear thickness'); + gui.add(giPass.useScreenSpaceSampling, 'value').name('screen-space sampling'); + gui.add(giPass, 'useTemporalFiltering').name('temporal filtering').onChange(updatePostprocessing); + + function updatePostprocessing(value) { + if (value === 1) { + renderPipeline.outputNode = vec4(vec3(ao), 1); + } else if (value === 2) { + renderPipeline.outputNode = vec4(gi, 1); + } else if (value === 3) { + renderPipeline.outputNode = scenePassColor; + } else { + renderPipeline.outputNode = giPass.useTemporalFiltering ? traaPass : compositePass; + } + + renderPipeline.needsUpdate = true; + } +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts b/examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts new file mode 100644 index 000000000..9670ab3d3 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts @@ -0,0 +1,416 @@ +import * as THREE from 'three/webgpu'; +import { + pass, + mrt, + output, + normalView, + diffuseColor, + velocity, + add, + vec4, + packNormalToRGB, + unpackRGBToNormal, + sample, +} from 'three/tsl'; +import { ssgi } from 'three/addons/tsl/display/SSGINode.js'; +import { traa } from 'three/addons/tsl/display/TRAANode.js'; +import { World } from '@perplexdotgg/bounce'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const BALL_RADIUS = 0.4; +const FILL_RATIO = 0.4; +const PACKING = 0.6; +const BOX_HEIGHT = 6; +const BOX_DEPTH = 8; +const WALL_THICKNESS = 0.5; +const CAM_FOV = 45; +const EASE_SPEED = 8; + +let camera, scene, renderer, renderPipeline; +let raycaster, pointer; +let mouseLight; + +let world; +let ballCount = 0; +let bodies = []; +let ballsMesh = null; +let wallMeshes = []; +const boxSize = { w: 8, h: BOX_HEIGHT, d: BOX_DEPTH }; + +const mouseRayOrigin = new THREE.Vector3(); +const mouseRayDir = new THREE.Vector3(); +let mouseMoving = false; +let mouseStopTimer = 0; +let pointerDown = false; +const activePointers = new Set(); +const mouseLightTarget = new THREE.Vector3(0, BOX_HEIGHT / 2, BOX_DEPTH / 2); +const mouseRayOriginTarget = new THREE.Vector3(); +const mouseRayDirTarget = new THREE.Vector3(); + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(CAM_FOV, window.innerWidth / window.innerHeight, 0.1, 100); + + scene = new THREE.Scene(); + + renderer = new THREE.WebGPURenderer({ antialias: false }); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.5; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + scenePass.setMRT( + mrt({ + output: output, + diffuseColor: diffuseColor, + normal: packNormalToRGB(normalView), + velocity: velocity, + }), + ); + + const scenePassColor = scenePass.getTextureNode('output'); + const scenePassDiffuse = scenePass.getTextureNode('diffuseColor'); + const scenePassDepth = scenePass.getTextureNode('depth'); + const scenePassNormal = scenePass.getTextureNode('normal'); + const scenePassVelocity = scenePass.getTextureNode('velocity'); + + // bandwidth optimization + + const diffuseTexture = scenePass.getTexture('diffuseColor'); + diffuseTexture.type = THREE.UnsignedByteType; + + const normalTexture = scenePass.getTexture('normal'); + normalTexture.type = THREE.UnsignedByteType; + + const sceneNormal = sample(uv => { + return unpackRGBToNormal(scenePassNormal.sample(uv)); + }); + + // gi + + const giPass = ssgi(scenePassColor, scenePassDepth, sceneNormal, camera); + giPass.sliceCount.value = 2; + giPass.stepCount.value = 8; + + // composite + + const ao = giPass.getAONode().toInspector('SSGI.AO'); + const gi = giPass.getGINode().toInspector('SSGI.GI'); + + const compositePass = vec4(add(scenePassColor.rgb.mul(ao), scenePassDiffuse.rgb.mul(gi.rgb)), scenePassColor.a); + + // traa + + const traaPass = traa(compositePass, scenePassDepth, scenePassVelocity, camera); + renderPipeline.outputNode = traaPass; + + // light + + mouseLight = new THREE.PointLight(0xffffff, 80); + mouseLight.position.set(0, BOX_HEIGHT / 2, BOX_DEPTH / 2); + mouseLight.castShadow = true; + mouseLight.shadow.mapSize.set(1024, 1024); + mouseLight.shadow.radius = 20; + scene.add(mouseLight); + + // + + raycaster = new THREE.Raycaster(); + pointer = new THREE.Vector2(); + + rebuildScene(); + + // + + renderer.domElement.addEventListener('pointerdown', onPointerDown); + renderer.domElement.addEventListener('pointermove', onPointerMove); + renderer.domElement.addEventListener('pointerup', onPointerUp); + renderer.domElement.addEventListener('pointercancel', onPointerUp); + window.addEventListener('resize', onWindowResize); +} + +function getBoxWidth() { + const aspect = window.innerWidth / window.innerHeight; + const vFov = THREE.MathUtils.degToRad(CAM_FOV / 2); + const dist = BOX_HEIGHT / 2 / Math.tan(vFov); + return Math.tan(vFov) * aspect * dist * 2; +} + +function getBallCount() { + const roomVolume = boxSize.w * boxSize.h * boxSize.d; + const ballVolume = (4 / 3) * Math.PI * Math.pow(BALL_RADIUS, 3); + return Math.floor((roomVolume * FILL_RATIO * PACKING) / ballVolume); +} + +function rebuildScene() { + for (const mesh of wallMeshes) { + scene.remove(mesh); + mesh.geometry.dispose(); + } + + wallMeshes = []; + + if (ballsMesh) { + scene.remove(ballsMesh); + ballsMesh.dispose(); + ballsMesh = null; + } + + bodies = []; + + boxSize.w = getBoxWidth(); + ballCount = getBallCount(); + + world = new World({ + gravity: [0, -9.81, 0], + solveVelocityIterations: 6, + solvePositionIterations: 2, + linearDamping: 0.1, + angularDamping: 0.1, + restitution: 0.4, + friction: 0.5, + }); + + fitCameraToBox(); + createBox(); + createBalls(); +} + +function createBox() { + const hw = boxSize.w / 2; + const hh = boxSize.h / 2; + const hd = boxSize.d / 2; + const t = WALL_THICKNESS; + + const whiteMaterial = new THREE.MeshPhysicalMaterial({ + color: 0xeeeeee, + roughness: 0.7, + metalness: 0.0, + }); + + const redMaterial = new THREE.MeshPhysicalMaterial({ + color: 0xff2222, + roughness: 0.7, + metalness: 0.0, + }); + + const greenMaterial = new THREE.MeshPhysicalMaterial({ + color: 0x22ff22, + roughness: 0.7, + metalness: 0.0, + }); + + const walls = [ + { size: [boxSize.w, t, boxSize.d], pos: [0, -t / 2, 0], mat: whiteMaterial }, + { size: [boxSize.w, t, boxSize.d], pos: [0, boxSize.h + t / 2, 0], mat: whiteMaterial }, + { size: [boxSize.w, boxSize.h, t], pos: [0, hh, -hd - t / 2], mat: whiteMaterial }, + { size: [boxSize.w, boxSize.h, t], pos: [0, hh, hd + t / 2], noMesh: true }, + { size: [t, boxSize.h, boxSize.d], pos: [-hw - t / 2, hh, 0], mat: redMaterial }, + { size: [t, boxSize.h, boxSize.d], pos: [hw + t / 2, hh, 0], mat: greenMaterial }, + ]; + + for (const w of walls) { + const shape = world.createBox({ width: w.size[0], height: w.size[1], depth: w.size[2] }); + world.createStaticBody({ shape, position: w.pos }); + + if (!w.noMesh) { + const geo = new THREE.BoxGeometry(w.size[0], w.size[1], w.size[2]); + const mesh = new THREE.Mesh(geo, w.mat); + mesh.position.set(...w.pos); + mesh.receiveShadow = true; + scene.add(mesh); + wallMeshes.push(mesh); + } + } +} + +function createBalls() { + const sphereGeo = new THREE.SphereGeometry(BALL_RADIUS, 32, 16); + const sphereShape = world.createSphere({ radius: BALL_RADIUS }); + + const material = new THREE.MeshPhysicalMaterial({ + roughness: 0.3, + metalness: 0.1, + }); + + ballsMesh = new THREE.InstancedMesh(sphereGeo, material, ballCount); + ballsMesh.castShadow = true; + ballsMesh.receiveShadow = true; + scene.add(ballsMesh); + + const colors = [0xff4444, 0x44ff44, 0x4488ff, 0xffaa00, 0xff44ff, 0x44ffff, 0xffff44, 0xff8844, 0x8844ff, 0x44ff88]; + + const color = new THREE.Color(); + const hw = boxSize.w / 2 - BALL_RADIUS - 0.1; + const hd = boxSize.d / 2 - BALL_RADIUS - 0.1; + + for (let i = 0; i < ballCount; i++) { + color.set(colors[i % colors.length]); + ballsMesh.setColorAt(i, color); + + const x = (Math.random() - 0.5) * 2 * hw; + const y = BALL_RADIUS + Math.random() * (boxSize.h - BALL_RADIUS * 2); + const z = (Math.random() - 0.5) * 2 * hd; + + const body = world.createDynamicBody({ + shape: sphereShape, + position: [x, y, z], + mass: 1, + restitution: 0.5, + friction: 0.4, + }); + + bodies.push(body); + } +} + +function onPointerDown(event) { + activePointers.add(event.pointerId); + + if (event.pointerType === 'touch') { + pointerDown = activePointers.size >= 2; + } else { + pointerDown = true; + } +} + +function onPointerUp(event) { + activePointers.delete(event.pointerId); + + if (event.pointerType === 'touch') { + pointerDown = activePointers.size >= 2; + } else { + pointerDown = false; + } +} + +function onPointerMove(event) { + pointer.x = (event.clientX / window.innerWidth) * 2 - 1; + pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; + + raycaster.setFromCamera(pointer, camera); + + mouseRayOriginTarget.copy(raycaster.ray.origin); + mouseRayDirTarget.copy(raycaster.ray.direction); + mouseMoving = true; + clearTimeout(mouseStopTimer); + mouseStopTimer = setTimeout(() => (mouseMoving = false), 50); + + const frontPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), -boxSize.d / 2); + const hit = new THREE.Vector3(); + if (raycaster.ray.intersectPlane(frontPlane, hit)) { + mouseLightTarget.copy(hit); + } +} + +function respawnBalls() { + const hw = boxSize.w / 2 - BALL_RADIUS - 0.1; + const hd = boxSize.d / 2 - BALL_RADIUS - 0.1; + const count = 5; + + for (let i = 0; i < count; i++) { + const body = bodies[Math.floor(Math.random() * bodies.length)]; + + body.position.set([ + (Math.random() - 0.5) * 2 * hw, + boxSize.h - BALL_RADIUS - Math.random() * 1, + (Math.random() - 0.5) * 2 * hd, + ]); + body.linearVelocity.set([0, 0, 0]); + body.angularVelocity.set([0, 0, 0]); + body.commitChanges(); + } +} + +function fitCameraToBox() { + const vFov = THREE.MathUtils.degToRad(CAM_FOV / 2); + const dist = boxSize.h / 2 / Math.tan(vFov); + + camera.aspect = window.innerWidth / window.innerHeight; + camera.position.set(0, boxSize.h / 2, dist + boxSize.d / 2); + camera.lookAt(0, boxSize.h / 2, 0); + camera.updateProjectionMatrix(); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + rebuildScene(); +} + +const timer = new THREE.Timer(); +const _dummy = new THREE.Object3D(); + +function animate() { + timer.update(); + const dt = Math.min(timer.getDelta(), 1 / 30); + + const easeFactor = 1 - Math.exp(-EASE_SPEED * dt); + mouseRayOrigin.lerp(mouseRayOriginTarget, easeFactor); + mouseRayDir.lerp(mouseRayDirTarget, easeFactor); + mouseLight.position.lerp(mouseLightTarget, easeFactor); + + if (pointerDown) { + respawnBalls(); + } + + if (mouseMoving) { + const pushRadius = 1.5; + const pushStrength = 15; + const _closest = new THREE.Vector3(); + const _ballPos = new THREE.Vector3(); + const _pushDir = new THREE.Vector3(); + + for (const body of bodies) { + const bp = body.position; + _ballPos.set(bp.x, bp.y, bp.z); + + const ray = new THREE.Ray(mouseRayOrigin, mouseRayDir); + ray.closestPointToPoint(_ballPos, _closest); + + const dist = _closest.distanceTo(_ballPos); + + if (dist < pushRadius) { + _pushDir.subVectors(_ballPos, _closest); + if (_pushDir.lengthSq() < 0.001) _pushDir.set(0, 1, 0); + _pushDir.normalize(); + + const strength = pushStrength * (1 - dist / pushRadius); + body.applyLinearImpulse({ + x: _pushDir.x * strength, + y: _pushDir.y * strength, + z: _pushDir.z * strength, + }); + } + } + } + + if (world) { + world.advanceTime(1 / 60, dt); + } + + for (let i = 0; i < bodies.length; i++) { + const body = bodies[i]; + const p = body.position; + const q = body.orientation; + + _dummy.position.set(p.x, p.y, p.z); + _dummy.quaternion.set(q.x, q.y, q.z, q.w); + _dummy.updateMatrix(); + + ballsMesh.setMatrixAt(i, _dummy.matrix); + } + + ballsMesh.instanceMatrix.needsUpdate = true; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_ssr.ts b/examples-testing/examples/webgpu_postprocessing_ssr.ts new file mode 100644 index 000000000..a5db67638 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_ssr.ts @@ -0,0 +1,212 @@ +import * as THREE from 'three/webgpu'; +import { + pass, + mrt, + output, + normalView, + metalness, + roughness, + screenUV, + color, + sample, + packNormalToRGB, + unpackRGBToNormal, + vec2, + colorSpaceToWorking, +} from 'three/tsl'; +import { ssr } from 'three/addons/tsl/display/SSRNode.js'; +import { smaa } from 'three/addons/tsl/display/SMAANode.js'; + +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const params = { + quality: 0.5, + blurQuality: 1, + maxDistance: 1, + intensity: 1, + thickness: 0.03, + binaryRefine: false, + roughness: 1, + enabled: true, +}; + +let camera, scene, model, renderer, renderPipeline, ssrPass; +let controls; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.set(3, 2, 3); + + scene = new THREE.Scene(); + scene.backgroundNode = screenUV.distance(0.5).remap(0, 0.5).mix(color(0x888877), color(0x776666)); + + const dracoLoader = new DRACOLoader(); + + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + loader.load('models/gltf/steampunk_camera.glb', function (gltf) { + model = gltf.scene; + + model.traverse(function (object) { + if (object.material) { + if (object.material.name === 'Lense_Casing') { + object.material.transparent = true; + } + + // Avoid overdrawing + object.material.side = THREE.FrontSide; + } + }); + + model.position.y = 0.1; + scene.add(model); + }); + + // Add a reflective plane under the camera + + const floorGeometry = new THREE.CircleGeometry(2, 64); + const floorMaterial = new THREE.MeshStandardMaterial({ + color: 0xffffff, + metalness: 1, + roughness: 0.5, + }); + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.rotation.x = -Math.PI / 2; + floor.position.y = -0.8; + scene.add(floor); + + // + + renderer = new THREE.WebGPURenderer(); + // renderer.setPixelRatio( window.devicePixelRatio ); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const environment = new RoomEnvironment(); + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; + scene.environmentIntensity = 1.25; + pmremGenerator.dispose(); + + // + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + scenePass.setMRT( + mrt({ + output: output, + normal: packNormalToRGB(normalView), + metalrough: vec2(metalness, roughness), // pack metalness and roughness into a single attachment + }), + ); + + const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); + const scenePassNormal = scenePass.getTextureNode('normal').toInspector('Normal', node => { + return colorSpaceToWorking(node, THREE.SRGBColorSpace); + }); + const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { + return scenePass.getLinearDepthNode(); + }); + const scenePassMetalRough = scenePass.getTextureNode('metalrough').toInspector('Metalness-Roughness'); + + // optional: optimize bandwidth by reducing the texture precision for normals and metal/roughness + + const normalTexture = scenePass.getTexture('normal'); + normalTexture.type = THREE.UnsignedByteType; + + const metalRoughTexture = scenePass.getTexture('metalrough'); + metalRoughTexture.type = THREE.UnsignedByteType; + + const sceneNormal = sample(uv => { + return unpackRGBToNormal(scenePassNormal.sample(uv)); + }); + + // + + ssrPass = ssr(scenePassColor, scenePassDepth, sceneNormal, { + metalnessNode: scenePassMetalRough.r, + roughnessNode: scenePassMetalRough.g, + }).toInspector('SSR'); + + // blend SSR over beauty (SSR outputs premultiplied color, so use additive blending) + + const outputNode = smaa(scenePassColor.add(ssrPass.rgb)); + + renderPipeline.outputNode = outputNode; + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.update(); + + window.addEventListener('resize', onWindowResize); + + // GUI + + const gui = renderer.inspector.createParameters('Settings'); + const ssrFolder = gui.addFolder('SSR'); + ssrFolder.add(params, 'quality', 0, 1).onChange(updateParameters); + ssrFolder.add(params, 'blurQuality', 1, 3, 1).onChange(updateParameters); + ssrFolder.add(params, 'maxDistance', 0, 1).onChange(updateParameters); + ssrFolder.add(params, 'intensity', 0, 1).onChange(updateParameters); + ssrFolder.add(params, 'thickness', 0, 0.05).onChange(updateParameters); + ssrFolder.add(params, 'binaryRefine').name('binary refine').onChange(updateParameters); + ssrFolder.add(params, 'enabled').onChange(() => { + if (params.enabled === true) { + renderPipeline.outputNode = outputNode; + } else { + renderPipeline.outputNode = scenePass; + } + + renderPipeline.needsUpdate = true; + }); + const modelFolder = gui.addFolder('Model'); + modelFolder.add(params, 'roughness', 0, 1).onChange(value => { + model.traverse(function (object) { + if (object.material) { + object.material.roughness = value; + } + }); + }); + + updateParameters(); +} + +function updateParameters() { + ssrPass.quality.value = params.quality; + // blurQuality is a build-time constant: assigning it recompiles the blur material + // (the setter no-ops when the value is unchanged). + ssrPass.blurQuality = params.blurQuality; + ssrPass.maxDistance.value = params.maxDistance; + ssrPass.intensity.value = params.intensity; + ssrPass.thickness.value = params.thickness; + // build-time constant: assigning it recompiles the SSR material (setter no-ops if unchanged) + ssrPass.binaryRefine = params.binaryRefine; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts b/examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts new file mode 100644 index 000000000..978c8ed67 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts @@ -0,0 +1,504 @@ +import * as THREE from 'three/webgpu'; +import { + pass, + mrt, + output, + normalView, + materialMetalness, + materialRoughness, + screenUV, + sample, + packNormalToRGB, + unpackRGBToNormal, + vec2, + velocity, + diffuseColor, + vec3, + vec4, + uniform, + mix, + step, + abs, + float, + renderOutput, + saturation, +} from 'three/tsl'; +import { ssr } from 'three/addons/tsl/display/SSRNode.js'; +import { temporalReproject } from 'three/addons/tsl/display/TemporalReprojectNode.js'; +import { recurrentDenoise } from 'three/addons/tsl/display/RecurrentDenoiseNode.js'; +import { sharpen } from 'three/addons/tsl/display/SharpenNode.js'; +import { traa } from 'three/addons/tsl/display/TRAANode.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +// Disable env map specular (radiance and clearcoat radiance) for every PBR material +// in this scene, since SSR provides the specular reflections instead. Diffuse env +// (irradiance) is left untouched. Equivalent to zeroing EnvironmentNode contributions, +// but scoped to this example rather than modifying the core library. +const _indirectSpecular = THREE.PhysicalLightingModel.prototype.indirectSpecular; +THREE.PhysicalLightingModel.prototype.indirectSpecular = function (builder) { + builder.context.radiance = vec3(0); + + if (this.clearcoatRadiance) { + this.clearcoatRadiance.assign(vec3(0)); + } + + _indirectSpecular.call(this, builder); +}; + +const OUTPUT_COMPARE_DENOISE = 8; +const OUTPUT_COMPARE_SSR = 9; + +const GRADED_OUTPUTS = new Set([0, 1, 3, 4, OUTPUT_COMPARE_DENOISE, OUTPUT_COMPARE_SSR]); + +const compareHint = document.getElementById('compare-hint'); + +function isCompareMode(output) { + return output === OUTPUT_COMPARE_DENOISE || output === OUTPUT_COMPARE_SSR; +} + +function updateCompareHint(output) { + compareHint.hidden = !isCompareMode(output); +} + +const compareSplit = uniform(0.5); +const compareResolution = uniform(new THREE.Vector2(window.innerWidth, window.innerHeight)); + +function buildCompareNode(noisy, denoised) { + const compareColor = mix(noisy, denoised, step(compareSplit, screenUV.x)); + const lineWidth = float(1).div(compareResolution.x); + const onLine = float(1).sub(step(lineWidth, abs(screenUV.x.sub(compareSplit)))); + + return mix(compareColor, vec4(1), onLine); +} + +const params = { + output: 0, + roughness: 0.3, + + ssr: { + resolutionScale: 1, + quality: 0.25, + mirrorBias: 0.5, + maxDistance: 0.4, + intensity: 1, + thickness: 0.1, + maxLuminance: 35, + binaryRefine: false, + stepExponent: 3, + envImportanceSampling: false, + screenEdgeFade: 0.2, + screenEdgeFadeBlack: false, // for indoor scenes, set to true + environmentIntensity: 3.14, // not too sure why exactly, but multiplying by ~PI makes the env map reflections match Blender more + }, + + temporalReproject: { + maxFrames: 16, + clampIntensity: 0.25, + flickerSuppression: 1, + hitPointReprojection: true, + }, + + denoise: { + enabled: true, + lumaPhi: 0.75, + depthPhi: 20, + normalPhi: 0.3, + roughnessPhi: 100, + radius: 1.5, + alphaPhi: 5, + strength: 0.725, + adapt: 0.5, + smoothDisocclusions: true, + flickerSuppression: 1, + adaptiveTrust: 1, + }, + + post: { + grading: { toneMapping: 'AgX', exposure: 1.57, gamma: 0.89, contrast: 1.31, saturation: 1 }, + }, +}; + +let camera, scene, model, renderer, postProcessing, ssrNode, temporalReprojectNode, denoiseNode; +let controls; +let scenePassNode, combinedOutputNode, scenePassDepth, scenePassVelocity; +let gammaUniform, contrastUniform, saturationUniform; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 8); + + camera.position.set(0.9210513838983053, 0.16195074025403253, 0.431687274895316); + + scene = new THREE.Scene(); + + const loader = new GLTFLoader(); + loader.load('models/gltf/dungeon_warkarma.glb', function (gltf) { + gltf.scene.scale.multiplyScalar(0.1); + + gltf.scene.traverse(function (object) { + if (!object.material) return; + + object.castShadow = true; + object.receiveShadow = true; + object.material.roughness = 0.3; + object.material.normalMap = null; + }); + + model = gltf.scene; + scene.add(model); + }); + + renderer = new THREE.WebGPURenderer(); + renderer.inspector = new Inspector(); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.AgXToneMapping; + renderer.toneMappingExposure = params.post.grading.exposure; + renderer.shadowMap.enabled = true; + document.body.appendChild(renderer.domElement); + + const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); + const hdrTexture = await hdrLoader.loadAsync('quarry_01_1k.hdr'); + hdrTexture.mapping = THREE.EquirectangularReflectionMapping; + scene.background = hdrTexture; + scene.environment = hdrTexture; + hdrTexture.generateMipmaps = true; + hdrTexture.needsUpdate = true; + + const directionalLight = new THREE.DirectionalLight('#ffffff', 20); + directionalLight.position.set(-10.9, 2.2, 10.75); + directionalLight.castShadow = true; + directionalLight.shadow.autoUpdate = false; + directionalLight.shadow.needsUpdate = true; + directionalLight.shadow.mapSize.width = 4096; + directionalLight.shadow.mapSize.height = 4096; + directionalLight.shadow.camera.left = -1.75; + directionalLight.shadow.camera.right = 1.75; + directionalLight.shadow.camera.top = 1.75; + directionalLight.shadow.camera.bottom = -1.75; + directionalLight.shadow.camera.near = 0.1; + directionalLight.shadow.camera.far = 50; + directionalLight.shadow.bias = -0.0005; + scene.add(directionalLight); + + await renderer.init(); + + scene.environmentIntensity = 1; + + postProcessing = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + scenePassNode = scenePass; + scenePass.setMRT( + mrt({ + output: output, + // Store base color (albedo) in RGB + metalness in alpha. The albedo is needed for + // metal Fresnel f0; do NOT bake in the (1-metalness) diffuse attenuation here, as + // that zeroes metals and destroys their specular tint (f0 would become 0 → black). + diffuseColor: vec4(diffuseColor.rgb, materialMetalness), + // Pack roughness into normal alpha channel to save MRT bandwidth + normal: vec4(packNormalToRGB(normalView).rgb, materialRoughness), + velocity: velocity, + }), + ); + + const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); + const scenePassNormal = scenePass.getTextureNode('normal').toInspector('Normal'); + scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { + return scenePass.getLinearDepthNode(); + }); + scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); + const scenePassDiffuseColor = scenePass.getTextureNode('diffuseColor').toInspector('Diffuse Color'); + + const normalTexture = scenePass.getTexture('normal'); + normalTexture.type = THREE.UnsignedByteType; + + const diffuseTexture = scenePass.getTexture('diffuseColor'); + diffuseTexture.type = THREE.UnsignedByteType; + + const sceneNormal = sample(uv => unpackRGBToNormal(scenePassNormal.sample(uv).rgb)); + + // metalness in diffuseColor.a, roughness in normal.a (no separate metalrough MRT) + const scenePassMetalRough = sample(uv => + vec2(scenePassDiffuseColor.sample(uv).a, scenePassNormal.sample(uv).a), + ).toInspector('Metalness/Roughness'); + + ssrNode = ssr(scenePassColor, scenePassDepth, sceneNormal, { + stochastic: true, + diffuseNode: scenePassDiffuseColor, + metalnessNode: scenePassDiffuseColor.a, + roughnessNode: scenePassNormal.a, + environmentNode: hdrTexture, + envImportanceSampling: params.ssr.envImportanceSampling, + binaryRefine: params.ssr.binaryRefine, + }); + ssrNode.setEnvMap(hdrTexture); + ssrNode.toInspector('SSR'); + + temporalReprojectNode = temporalReproject(ssrNode, scenePassDepth, scenePassNormal, scenePassVelocity, camera, { + mode: 'specular', + accumulate: false, + }); + temporalReprojectNode.toInspector('Temporal Reproject'); + + denoiseNode = recurrentDenoise(temporalReprojectNode, camera, { + depth: scenePassDepth, + normal: scenePassNormal, + raw: ssrNode, + metalRoughness: scenePassMetalRough, + mode: 'specular', + accumulate: true, + }); + denoiseNode.alphaSource = 'raylength'; // SSR alpha channel contains ray length + denoiseNode.toInspector('Denoise'); + // feed the denoised result + velocity back into SSR for multi-bounce reflections + ssrNode.setHistory(denoiseNode, scenePassVelocity); + temporalReprojectNode.setHistoryTexture(denoiseNode); + + const denoisePassBlend = vec4(denoiseNode.rgb, ssrNode.a.greaterThan(0).toVar()); + + gammaUniform = uniform(params.post.grading.gamma); + contrastUniform = uniform(params.post.grading.contrast); + saturationUniform = uniform(params.post.grading.saturation); + + const litColor = scenePassColor.rgb.add(denoisePassBlend.rgb); + + const outputNode = vec4(litColor, 1); + outputNode.toInspector('Combined SSR'); + combinedOutputNode = outputNode; + + postProcessing.outputNode = applyPostProcessing(combinedOutputNode); + postProcessing.outputColorTransform = false; + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.update(); + + // Initial camera transform + camera.position.set(1.259878548682251, 0.5391287340899181, -0.27217301481427114); + camera.rotation.set(-0.3158233106804791, 0.26820684188431526, 0.08637696823742165); + controls.target.set(1.0258536154689288, 0.2746440590977971, -1.0815876858987743); + + window.addEventListener('resize', onWindowResize); + renderer.domElement.addEventListener('pointermove', onComparePointerMove); + + applyParams(); + applyPost(); + + const outputTypes = { + Combined: 0, + 'Denoised SSR': 4, + 'Compare (Denoise)': OUTPUT_COMPARE_DENOISE, + 'Compare (Reflections)': OUTPUT_COMPARE_SSR, + 'SSR (Raw)': 1, + 'Ray Length': 7, + 'Accumulation Speed (Alpha)': 6, + }; + + const ssrGui = renderer.inspector.createParameters('SSR settings'); + ssrGui.add(params, 'output', outputTypes).onChange(updateOutputNode); + ssrGui.add(params.ssr, 'quality', 0, 1).name('quality').onChange(applyParams); + ssrGui.add(params.ssr, 'mirrorBias', 0, 1).name('mirror bias').onChange(applyParams); + ssrGui.add(params.ssr, 'stepExponent', 1, 4, 0.5).name('step exponent').onChange(applyParams); + ssrGui.add(params.ssr, 'binaryRefine').name('binary refine').onChange(applyParams); + ssrGui.add(params.ssr, 'maxDistance', 0, 5).name('max distance').onChange(applyParams); + ssrGui.add(params.ssr, 'intensity', 0, 4).name('intensity').onChange(applyParams); + ssrGui.add(params.ssr, 'thickness', 0, 0.25).name('thickness').onChange(applyParams); + ssrGui.add(params.ssr, 'environmentIntensity', 0, 10).name('env intensity').onChange(applyParams); + ssrGui.add(params, 'roughness', 0, 1).onChange(value => { + scene.traverse(object => { + if (object.material) object.material.roughness = value; + }); + }); + + const denoiseGui = renderer.inspector.createParameters('Denoise settings'); + denoiseGui.add(params.denoise, 'enabled').name('enabled').onChange(applyParams); + denoiseGui.add(params.denoise, 'lumaPhi', 0, 3).name('luma phi').onChange(applyParams); + denoiseGui.add(params.denoise, 'depthPhi', 0, 50).name('depth phi').onChange(applyParams); + denoiseGui.add(params.denoise, 'normalPhi', 0.01, 1, 0.01).name('normal phi').onChange(applyParams); + + // We have uniform roughness in the scene, so we don't need to adjust the roughness phi + // denoiseGui.add( params.denoise, 'roughnessPhi', 0, 500 ).name( 'roughness phi' ).onChange( applyParams ); + + denoiseGui.add(params.denoise, 'alphaPhi', 0, 15).name('ray length phi').onChange(applyParams); + denoiseGui.add(params.denoise, 'radius', 0, 3).name('radius').onChange(applyParams); + denoiseGui.add(params.denoise, 'strength', 0.5, 0.95).name('strength').onChange(applyParams); + denoiseGui.add(params.denoise, 'adapt', 0, 1).name('adapt').onChange(applyParams); + + // Extra options that are not used in this example + // denoiseGui.add( params.denoise, 'smoothDisocclusions' ).name( 'smooth disocclusions' ).onChange( applyParams ); + // denoiseGui.add( params.denoise, 'flickerSuppression', 0, 1 ).name( 'flicker suppression' ).onChange( applyParams ); + // denoiseGui.add( params.denoise, 'adaptiveTrust', 0, 1 ).name( 'adaptive trust' ).onChange( applyParams ); + + const temporalReprojectGui = renderer.inspector.createParameters('Temporal Reproject settings'); + temporalReprojectGui.add(params.temporalReproject, 'maxFrames', 1, 128, 1).name('max frames').onChange(applyParams); + temporalReprojectGui + .add(params.temporalReproject, 'clampIntensity', 0, 1) + .name('clamp intensity') + .onChange(applyParams); + temporalReprojectGui + .add(params.temporalReproject, 'flickerSuppression', 0, 1) + .name('flicker suppression') + .onChange(applyParams); + temporalReprojectGui + .add(params.temporalReproject, 'hitPointReprojection') + .name('hit point reprojection') + .onChange(applyParams); + temporalReprojectGui.close(); + + // Concise UI for Directional Light controls + const lightGui = renderer.inspector.createParameters('Light').close(); + ['x', 'y', 'z'].forEach(axis => { + lightGui + .add(directionalLight.position, axis, -30, 30) + .name(axis.toUpperCase()) + .onChange(() => (directionalLight.shadow.needsUpdate = true)); + }); + lightGui.add(directionalLight, 'intensity', 0, 50).name('Intensity'); + + updateOutputNode(); + renderer.setAnimationLoop(animate); +} + +function applyParams() { + if (!ssrNode) return; + + ssrNode.resolutionScale = params.ssr.resolutionScale; + ssrNode.quality.value = params.ssr.quality; + ssrNode.mirrorBias.value = params.ssr.mirrorBias; + // stepExponent / screenEdgeFadeBlack / binaryRefine are build-time constants: assigning + // them recompiles the SSR material (the setters no-op when the value is unchanged). + ssrNode.stepExponent = params.ssr.stepExponent; + ssrNode.binaryRefine = params.ssr.binaryRefine; + ssrNode.maxDistance.value = params.ssr.maxDistance; + ssrNode.intensity.value = params.ssr.intensity; + ssrNode.thickness.value = params.ssr.thickness; + ssrNode.maxLuminance.value = params.ssr.maxLuminance; + ssrNode.screenEdgeFade.value = params.ssr.screenEdgeFade; + ssrNode.screenEdgeFadeBlack = params.ssr.screenEdgeFadeBlack; + ssrNode.environmentIntensity.value = params.ssr.environmentIntensity; + + if (temporalReprojectNode) { + temporalReprojectNode.maxFrames.value = params.temporalReproject.maxFrames; + temporalReprojectNode.clampIntensity.value = params.temporalReproject.clampIntensity; + temporalReprojectNode.flickerSuppression.value = params.temporalReproject.flickerSuppression; + temporalReprojectNode.hitPointReprojection.value = params.temporalReproject.hitPointReprojection; + } + + if (denoiseNode) { + denoiseNode.lumaPhi.value = params.denoise.lumaPhi; + denoiseNode.depthPhi.value = params.denoise.depthPhi; + denoiseNode.normalPhi.value = params.denoise.normalPhi; + denoiseNode.roughnessPhi.value = params.denoise.roughnessPhi; + denoiseNode.radius.value = params.denoise.enabled ? params.denoise.radius : 0; + denoiseNode.alphaPhi.value = params.denoise.alphaPhi; + denoiseNode.strength.value = params.denoise.strength; + denoiseNode.adapt.value = params.denoise.adapt; + denoiseNode.smoothDisocclusions.value = params.denoise.smoothDisocclusions; + denoiseNode.flickerSuppression.value = params.denoise.flickerSuppression; + denoiseNode.adaptiveTrust.value = params.denoise.adaptiveTrust; + } +} + +function applyGrading(source) { + let rgb = source.rgb; + + rgb = renderOutput(vec4(rgb, 1), THREE.AgXToneMapping, THREE.SRGBColorSpace).rgb; + rgb = rgb.sub(0.5).mul(contrastUniform).add(0.5); + rgb = saturation(rgb, saturationUniform); + rgb = rgb.max(0.0).pow(float(1).div(gammaUniform)); + + return vec4(rgb, 1); +} + +function applyPostProcessing(source) { + return sharpen(traa(applyGrading(source), scenePassDepth, scenePassVelocity, camera), 0); +} + +function applyPost() { + const g = params.post.grading; + gammaUniform.value = g.gamma; + contrastUniform.value = g.contrast; + saturationUniform.value = g.saturation; + + renderer.toneMapping = THREE.AgXToneMapping; + renderer.toneMappingExposure = g.exposure; +} + +function updateOutputNode() { + if (!postProcessing) return; + + let node; + + switch (params.output) { + case 0: + node = applyPostProcessing(combinedOutputNode); + break; // Combined + case 1: + node = applyPostProcessing(vec4(ssrNode.rgb, 1)); + break; // SSR (Raw) + case 4: + node = applyPostProcessing(vec4(denoiseNode.rgb, 1)); + break; // Denoised SSR + case 6: + node = vec4(denoiseNode.aaa, 1); + break; // Samples (Alpha) + case 7: + node = vec4(ssrNode.aaa, 1); + break; // Ray Length (Raw) + case OUTPUT_COMPARE_DENOISE: { + // Compare (denoised | noisy) + + const noisySSR = applyPostProcessing(vec4(ssrNode.rgb, 1)); + const denoisedSSR = applyPostProcessing(vec4(denoiseNode.rgb, 1)); + node = buildCompareNode(denoisedSSR, noisySSR); + break; + } + + case OUTPUT_COMPARE_SSR: { + // Compare (combined SSR vs. scene only) + + node = buildCompareNode(applyPostProcessing(combinedOutputNode), applyPostProcessing(scenePassNode)); + break; + } + } + + if (!isCompareMode(params.output)) controls.enabled = true; + + updateCompareHint(params.output); + + postProcessing.outputColorTransform = !GRADED_OUTPUTS.has(params.output); + postProcessing.outputNode = node; + postProcessing.needsUpdate = true; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + compareResolution.value.set(window.innerWidth, window.innerHeight); +} + +function onComparePointerMove(event) { + if (!isCompareMode(params.output)) return; + + if (event.shiftKey) { + controls.enabled = false; + + const rect = renderer.domElement.getBoundingClientRect(); + compareSplit.value = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width)); + } else { + controls.enabled = true; + } +} + +function animate() { + controls.update(); + + postProcessing.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_sss.ts b/examples-testing/examples/webgpu_postprocessing_sss.ts new file mode 100644 index 000000000..b79e94375 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_sss.ts @@ -0,0 +1,185 @@ +import * as THREE from 'three/webgpu'; +import { pass, vec3, vec4, mrt, screenUV, velocity, builtinShadowContext } from 'three/tsl'; +import { sss } from 'three/addons/tsl/display/SSSNode.js'; +import { traa } from 'three/addons/tsl/display/TRAANode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline, controls; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(1, 2.5, -3.5); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + scene.fog = new THREE.Fog(0xa0a0a0, 10, 50); + + // lights + + const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 2); + hemiLight.position.set(0, 20, 0); + scene.add(hemiLight); + + const dirLight = new THREE.DirectionalLight(0xffffff, 3); + dirLight.position.set(-3, 10, -10); + dirLight.castShadow = true; + dirLight.shadow.bias = -0.001; // remove self-shadowing artifacts + dirLight.shadow.camera.top = 4; + dirLight.shadow.radius = 2; + dirLight.shadow.camera.bottom = -4; + dirLight.shadow.camera.left = -4; + dirLight.shadow.camera.right = 4; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = 40; + dirLight.shadow.mapSize.width = 1024; + dirLight.shadow.mapSize.height = 1024; + scene.add(dirLight); + + // scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) ); + + // ground + + const mesh = new THREE.Mesh( + new THREE.PlaneGeometry(100, 100), + new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), + ); + mesh.rotation.x = -Math.PI / 2; + mesh.receiveShadow = true; + scene.add(mesh); + + // + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + loader.load('models/gltf/nemetona.glb', function (gltf) { + const model = gltf.scene; + model.rotation.y = Math.PI; + model.scale.setScalar(10); + model.position.y = 0.45; + + scene.add(model); + + model.traverse(function (object) { + if (object.isMesh) { + object.castShadow = true; + object.receiveShadow = true; + object.material.aoMap = null; // remove AO to better see the effect of shadows + } + }); + }); + + // + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // post-processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // pre-pass + + const prePass = pass(scene, camera); + prePass.name = 'Pre-Pass'; + prePass.transparent = false; + + prePass.setMRT( + mrt({ + output: velocity, + }), + ); + + const prePassDepth = prePass.getTextureNode('depth').toInspector('Depth', () => prePass.getLinearDepthNode()); + const prePassVelocity = prePass.getTextureNode('output').toInspector('Velocity'); + + // scene pass + + const scenePass = pass(scene, camera).toInspector('Color'); + + // sss + + const sssPass = sss(prePassDepth, camera, dirLight); + sssPass.maxDistance.value = 0.2; + sssPass.useTemporalFiltering = true; + + // scene context + + const sssSample = sssPass.getTextureNode().sample(screenUV).r; + const sssContext = builtinShadowContext(sssSample, dirLight); + + scenePass.contextNode = sssContext; + + // traa + + const traaPass = traa(scenePass, prePassDepth, prePassVelocity, camera); + renderPipeline.outputNode = traaPass; + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 20; + controls.target.set(0, 2, 0); + controls.enableDamping = true; + controls.update(); + + // + + const params = { + output: 0, + }; + + const types = { 'Scene with Shadow Maps + SSS': 0, 'Scene with Shadow Maps': 1, SSS: 2 }; + + const gui = renderer.inspector.createParameters('SSS settings'); + gui.add(params, 'output', types).onChange(updatePostprocessing); + gui.add(sssPass.shadowIntensity, 'value', 0, 1).name('shadow intensity'); + gui.add(sssPass.maxDistance, 'value', 0.01, 1).name('max ray distance'); + gui.add(sssPass.quality, 'value', 0, 1).name('quality'); + gui.add(sssPass.thickness, 'value', 0.01, 0.1).name('thickness'); + gui.add(sssPass, 'useTemporalFiltering').name('temporal filtering').onChange(updatePostprocessing); + + function updatePostprocessing() { + scenePass.contextNode = params.output !== 1 ? sssContext : null; + + if (params.output === 2) { + renderPipeline.outputNode = vec4(vec3(sssPass.r), 1); + } else { + renderPipeline.outputNode = sssPass.useTemporalFiltering ? traaPass : scenePass; + } + + renderPipeline.needsUpdate = true; + } + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_traa.ts b/examples-testing/examples/webgpu_postprocessing_traa.ts new file mode 100644 index 000000000..01d17ca17 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_traa.ts @@ -0,0 +1,93 @@ +import * as THREE from 'three/webgpu'; +import { mrt, output, pass, velocity } from 'three/tsl'; +import { traa } from 'three/addons/tsl/display/TRAANode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline; +let index = 0; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.z = 2.5; + + scene = new THREE.Scene(); + + const geometry = new THREE.BoxGeometry(); + const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.position.x = -1; + scene.add(mesh1); + + const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); + texture.minFilter = THREE.NearestFilter; + texture.magFilter = THREE.NearestFilter; + texture.generateMipmaps = false; + texture.colorSpace = THREE.SRGBColorSpace; + + const material2 = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.position.x = 1; + scene.add(mesh2); + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + const scenePass = pass(scene, camera); + scenePass.setMRT( + mrt({ + output: output, + velocity: velocity, + }), + ); + + const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); + const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { + return scenePass.getLinearDepthNode(); + }); + const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); + + const traaNode = traa(scenePassColor, scenePassDepth, scenePassVelocity, camera); + + renderPipeline.outputNode = traaNode; + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + index++; + + if (Math.round(index / 200) % 2 === 0) { + for (let i = 0; i < scene.children.length; i++) { + const child = scene.children[i]; + + child.rotation.x += 0.005; + child.rotation.y += 0.01; + } + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_postprocessing_transition.ts b/examples-testing/examples/webgpu_postprocessing_transition.ts new file mode 100644 index 000000000..1a5a88fc1 --- /dev/null +++ b/examples-testing/examples/webgpu_postprocessing_transition.ts @@ -0,0 +1,207 @@ +import * as THREE from 'three/webgpu'; + +import TWEEN from 'three/addons/libs/tween.module.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { uniform, pass } from 'three/tsl'; +import { transition } from 'three/addons/tsl/display/TransitionNode.js'; + +let renderer, renderPipeline, transitionController, transitionPass; + +const textures = []; +const timer = new THREE.Timer(); +timer.connect(document); + +const effectController = { + animateScene: true, + animateTransition: true, + transition: 0, + _transition: uniform(0), + useTexture: true, + _useTexture: uniform(1), + texture: 5, + cycle: true, + threshold: uniform(0.1), +}; + +function generateInstancedMesh(geometry, material, count) { + const mesh = new THREE.InstancedMesh(geometry, material, count); + + const dummy = new THREE.Object3D(); + const color = new THREE.Color(); + + for (let i = 0; i < count; i++) { + dummy.position.x = Math.random() * 100 - 50; + dummy.position.y = Math.random() * 60 - 30; + dummy.position.z = Math.random() * 80 - 40; + + dummy.rotation.x = Math.random() * 2 * Math.PI; + dummy.rotation.y = Math.random() * 2 * Math.PI; + dummy.rotation.z = Math.random() * 2 * Math.PI; + + dummy.scale.x = Math.random() * 2 + 1; + + if (geometry.type === 'BoxGeometry') { + dummy.scale.y = Math.random() * 2 + 1; + dummy.scale.z = Math.random() * 2 + 1; + } else { + dummy.scale.y = dummy.scale.x; + dummy.scale.z = dummy.scale.x; + } + + dummy.updateMatrix(); + + mesh.setMatrixAt(i, dummy.matrix); + mesh.setColorAt(i, color.setScalar(0.1 + 0.9 * Math.random())); + } + + return mesh; +} + +function FXScene(geometry, rotationSpeed, backgroundColor) { + const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.z = 20; + + // Setup scene + const scene = new THREE.Scene(); + scene.background = new THREE.Color(backgroundColor); + scene.add(new THREE.AmbientLight(0xaaaaaa, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 1, 4); + scene.add(light); + + this.rotationSpeed = rotationSpeed; + + const color = geometry.type === 'BoxGeometry' ? 0x0000ff : 0xff0000; + const material = new THREE.MeshPhongNodeMaterial({ color: color, flatShading: true }); + const mesh = generateInstancedMesh(geometry, material, 500); + scene.add(mesh); + + this.scene = scene; + this.camera = camera; + this.mesh = mesh; + + this.update = function (delta) { + if (effectController.animateScene) { + mesh.rotation.x += this.rotationSpeed.x * delta; + mesh.rotation.y += this.rotationSpeed.y * delta; + mesh.rotation.z += this.rotationSpeed.z * delta; + } + }; + + this.resize = function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + }; +} + +const fxSceneA = new FXScene(new THREE.BoxGeometry(2, 2, 2), new THREE.Vector3(0, -0.4, 0), 0xffffff); +const fxSceneB = new FXScene(new THREE.IcosahedronGeometry(1, 1), new THREE.Vector3(0, 0.2, 0.1), 0x000000); + +function init() { + // Initialize textures + + const loader = new THREE.TextureLoader(); + + for (let i = 0; i < 6; i++) { + textures[i] = loader.load('textures/transition/transition' + (i + 1) + '.png'); + } + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.inspector = new Inspector(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePassA = pass(fxSceneA.scene, fxSceneA.camera); + const scenePassB = pass(fxSceneB.scene, fxSceneB.camera); + + transitionPass = transition( + scenePassA, + scenePassB, + new THREE.TextureNode(textures[effectController.texture]), + effectController._transition, + effectController.threshold, + effectController._useTexture, + ); + + renderPipeline.outputNode = transitionPass; + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(effectController, 'animateScene').name('Animate Scene'); + gui.add(effectController, 'animateTransition').name('Animate Transition'); + transitionController = gui + .add(effectController, 'transition', 0, 1, 0.01) + .name('transition') + .onChange(() => { + effectController._transition.value = effectController.transition; + }); + gui.add(effectController, 'useTexture').onChange(() => { + const value = effectController.useTexture ? 1 : 0; + effectController._useTexture.value = value; + }); + gui.add(effectController, 'texture', { Perlin: 0, Squares: 1, Cells: 2, Distort: 3, Gradient: 4, Radial: 5 }); + gui.add(effectController, 'cycle'); + gui.add(effectController.threshold, 'value', 0, 1, 0.01).name('threshold'); +} + +window.addEventListener('resize', onWindowResize); + +function onWindowResize() { + fxSceneA.resize(); + fxSceneB.resize(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +new TWEEN.Tween(effectController) + .to({ transition: 1 }, 1500) + .onUpdate(function () { + transitionController.setValue(effectController.transition); + + // Change the current alpha texture after each transition + if (effectController.cycle) { + if (effectController.transition == 0 || effectController.transition == 1) { + effectController.texture = (effectController.texture + 1) % textures.length; + } + } + }) + .repeat(Infinity) + .delay(2000) + .yoyo(true) + .start(); + +function animate() { + timer.update(); + + if (effectController.animateTransition) TWEEN.update(); + + if (textures[effectController.texture]) { + const mixTexture = textures[effectController.texture]; + transitionPass.mixTextureNode.value = mixTexture; + } + + const delta = timer.getDelta(); + fxSceneA.update(delta); + fxSceneB.update(delta); + + render(); +} + +function render() { + // Prevent render both scenes when it's not necessary + if (effectController.transition === 0) { + renderer.render(fxSceneB.scene, fxSceneB.camera); + } else if (effectController.transition === 1) { + renderer.render(fxSceneA.scene, fxSceneA.camera); + } else { + renderPipeline.render(); + } +} + +init(); diff --git a/examples-testing/examples/webgpu_procedural_texture.ts b/examples-testing/examples/webgpu_procedural_texture.ts new file mode 100644 index 000000000..21fb4a3c2 --- /dev/null +++ b/examples-testing/examples/webgpu_procedural_texture.ts @@ -0,0 +1,75 @@ +import * as THREE from 'three/webgpu'; +import { checker, uv, uniform, convertToTexture } from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +init(); + +function init() { + const aspect = window.innerWidth / window.innerHeight; + camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); + camera.position.z = 1; + + scene = new THREE.Scene(); + + // procedural to texture + + const uvScale = uniform(4); + const blurAmount = uniform(0.5); + + const procedural = checker(uv().mul(uvScale)); + const proceduralToTexture = convertToTexture(procedural, 512, 512); // ( node, width, height ) + + const colorNode = gaussianBlur(proceduralToTexture, blurAmount, 20); + + // extra + + //proceduralToTexture.autoUpdate = false; // update just once + //proceduralToTexture.textureNeedsUpdate = true; // manually update + + // scene + + const material = new THREE.MeshBasicNodeMaterial(); + material.colorNode = colorNode; + + const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + scene.add(plane); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + // gui + + const gui = renderer.inspector.createParameters('Procedural Texture'); + gui.add(uvScale, 'value', 1, 10).name('uv scale ( before rtt )'); + gui.add(blurAmount, 'value', 0, 2).name('blur amount ( after rtt )'); + gui.add(proceduralToTexture, 'autoUpdate').name('auto update'); +} + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); + + const aspect = window.innerWidth / window.innerHeight; + + const frustumHeight = camera.top - camera.bottom; + + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + + camera.updateProjectionMatrix(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_reflection.ts b/examples-testing/examples/webgpu_reflection.ts new file mode 100644 index 000000000..d26a86aa2 --- /dev/null +++ b/examples-testing/examples/webgpu_reflection.ts @@ -0,0 +1,344 @@ +import * as THREE from 'three/webgpu'; + +import { + abs, + blendOverlay, + color, + float, + Fn, + instancedBufferAttribute, + max, + normalWorldGeometry, + pass, + positionGeometry, + positionLocal, + pow2, + reflector, + screenUV, + sin, + sub, + texture, + time, + uniform, + uv, + vec2, + vec3, +} from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import TWEEN from 'three/addons/libs/tween.module.js'; + +let camera, scene, renderer; +let renderPipeline; +let controls; + +// below uniforms will be animated via TWEEN.js + +const uniformEffector1 = uniform(-0.2); +const uniformEffector2 = uniform(-0.2); + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); + camera.position.set(4, 2, 4); + + scene = new THREE.Scene(); + scene.fog = new THREE.Fog(0x4195a4, 1, 20); + scene.backgroundNode = normalWorldGeometry.y.mix(color(0x4195a4), color(0x0066ff)); + camera.lookAt(0, 1, 0); + + const sunLight = new THREE.DirectionalLight(0xffe499, 2); + sunLight.position.set(7, 5, 7); + sunLight.castShadow = true; + sunLight.shadow.camera.zoom = 1.5; + sunLight.shadow.mapSize.set(1024, 1024); + sunLight.shadow.bias = -0.0001; // remove self-shadowing artifacts + scene.add(sunLight); + + const backLight = new THREE.DirectionalLight(0x0487e2, 0.5); + backLight.position.set(7, -5, 7); + scene.add(backLight); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const floorColor = await textureLoader.loadAsync('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); + floorColor.wrapS = THREE.RepeatWrapping; + floorColor.wrapT = THREE.RepeatWrapping; + floorColor.colorSpace = THREE.SRGBColorSpace; + floorColor.repeat.set(15, 15); + + const floorNormal = await textureLoader.loadAsync('textures/floors/FloorsCheckerboard_S_Normal.jpg'); + floorNormal.wrapS = THREE.RepeatWrapping; + floorNormal.wrapT = THREE.RepeatWrapping; + floorNormal.repeat.set(15, 15); + + // tree + + const treeMesh = createTreeMesh(); + treeMesh.castShadow = true; + treeMesh.receiveShadow = true; + scene.add(treeMesh); + + // floor + + const floorUV = uv().mul(15); + const floorNormalOffset = texture(floorNormal, floorUV).xy.mul(2).sub(1).mul(0.02); + + const reflection = reflector({ resolutionScale: 0.2 }); + reflection.target.rotateX(-Math.PI / 2); + reflection.uvNode = reflection.uvNode.add(floorNormalOffset); + scene.add(reflection.target); + + const floorMaterial = new THREE.MeshPhongNodeMaterial(); + floorMaterial.colorNode = texture(floorColor, floorUV); + floorMaterial.emissiveNode = reflection.mul(0.25); + floorMaterial.normalMap = floorNormal; + floorMaterial.normalScale.set(0.2, -0.2); + + const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); + floor.receiveShadow = true; + scene.add(floor); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 10; + controls.maxPolarAngle = Math.PI / 2; + controls.enableDamping = true; + controls.autoRotate = true; + controls.autoRotateSpeed = 1; + controls.target.set(0, 1, 0); + controls.update(); + + // post-processing + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode(); + const scenePassDepth = scenePass.getLinearDepthNode().remapClamp(0.3, 0.7); + + const scenePassColorBlurred = gaussianBlur(scenePassColor); + scenePassColorBlurred.directionNode = scenePassDepth; + + const vignette = screenUV.distance(0.5).mul(1.25).clamp().oneMinus().sub(0.2); + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = blendOverlay(scenePassColorBlurred, vignette); + + // tweens + + new TWEEN.Tween(uniformEffector1) + .to({ value: 1.2 }, 3000) + .delay(800) + .repeat(Infinity) + .easing(TWEEN.Easing.Sinusoidal.InOut) + .start(); + + new TWEEN.Tween(uniformEffector2) + .to({ value: 1.2 }, 3000) + .repeat(Infinity) + .easing(TWEEN.Easing.Sinusoidal.InOut) + .start(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + TWEEN.update(); + + renderPipeline.render(); +} + +function random() { + return (Math.random() - 0.5) * 2.0; +} + +function createTreeMesh() { + const maxSteps = 5; + const lengthMult = 0.8; + + const positions = []; + const normals = []; + const colors = []; + const data = []; // will save seed, size and time + + let instanceCount = 0; + + const newPosition = new THREE.Vector3(); + const position = new THREE.Vector3(); + const normal = new THREE.Vector3(); + const color = new THREE.Color(); + + function createTreePart(angle, x, y, z, length, count) { + if (Math.random() > (maxSteps / count) * 0.25) return; + + if (count < maxSteps) { + const newLength = length * lengthMult; + const newX = x + Math.cos(angle) * length; + const newY = y + Math.sin(angle) * length; + const countSq = Math.min(3.2, count * count); + const newZ = z + (Math.random() * countSq - countSq / 2) * length; + + let size = 30 - count * 8; + if (size > 25) size = 25; + if (size < 10) size = 10; + + size = size / 100; + + const subSteps = 50; + + // below loop generates the instanced data for a tree part + + for (let i = 0; i < subSteps; i++) { + instanceCount++; + + const percent = i / subSteps; + const extra = 1 / maxSteps; + + // position + + newPosition.set(x, y, z).lerp(new THREE.Vector3(newX, newY, newZ), percent); + position.copy(newPosition); + + position.x += random() * size * 3; + position.y += random() * size * 3; + position.z += random() * size * 3; + + positions.push(position.x, position.y, position.z); + + const scale = Math.random() + 5; + + // normal + + normal.copy(position).sub(newPosition).normalize(); + normals.push(normal.x, normal.y, normal.z); + + // color + + color.setHSL((count / maxSteps) * 0.5 + Math.random() * 0.05, 0.75, 0.6 + Math.random() * 0.1); + colors.push(color.r, color.g, color.b); + + // to save vertex buffers, we store the size, time and seed in a single attribute + + const instanceSize = size * scale; + const instanceTime = count / maxSteps + percent * extra; + const instanceSeed = Math.random(); + + data.push(instanceSize, instanceTime, instanceSeed); + } + + createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); + createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); + createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); + createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); + createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); + createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); + } + } + + const angle = Math.PI * 0.5; + + // the tree is represented as a collection of instances boxes generated with below recursive function + + createTreePart(angle, 0, 0, 0, 16, 0); + + const geometry = new THREE.BoxGeometry(); + const material = new THREE.MeshStandardNodeMaterial(); + const mesh = new THREE.Mesh(geometry, material); + mesh.scale.setScalar(0.05); + mesh.count = instanceCount; + mesh.frustumCulled = false; + + // instanced data + + const attributePosition = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); + const attributeNormal = new THREE.InstancedBufferAttribute(new Float32Array(normals), 3); + const attributeColor = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); + const attributeData = new THREE.InstancedBufferAttribute(new Float32Array(data), 3); + + // TSL + + const instancePosition = instancedBufferAttribute(attributePosition); + const instanceNormal = instancedBufferAttribute(attributeNormal); + const instanceColor = instancedBufferAttribute(attributeColor); + const instanceData = instancedBufferAttribute(attributeData); + + material.positionNode = Fn(() => { + const instanceSize = instanceData.x; + const instanceTime = instanceData.y; + const instanceSeed = instanceData.z; + + // effectors (these are responsible for the blob-like scale effects) + + const dif1 = abs(instanceTime.sub(uniformEffector1)).toConst(); + let effect = dif1.lessThanEqual(0.15).select(sub(0.15, dif1).mul(sub(1.7, instanceTime).mul(10)), float(0)); + + const dif2 = abs(instanceTime.sub(uniformEffector2)).toConst(); + effect = dif2.lessThanEqual(0.15).select(sub(0.15, dif2).mul(sub(1.7, instanceTime).mul(10)), effect); + + // accumulate different vertex animations + + let animated = positionLocal.add(instancePosition).toVar(); + const direction = positionGeometry.normalize().toConst(); + + animated = animated.add(direction.mul(effect.add(instanceSize))); + animated = animated.sub(direction.mul(effect)); + animated = animated.add(instanceNormal.mul(effect.mul(1))); + animated = animated.add(instanceNormal.mul(abs(sin(time.add(instanceSeed.mul(2))).mul(1.5)))); + + return animated; + })(); + + const squareEdge = Fn(() => { + const pos = uv().sub(vec2(0.5, 0.5)); + const squareDistance = max(abs(pos.x), abs(pos.y)); + return squareDistance.div(0.5).clamp(0.85, 1).sub(0.5).mul(2.0); + })(); + + material.colorNode = Fn(() => { + return squareEdge.sub(instanceColor); + })(); + + material.emissiveNode = Fn(() => { + const instanceTime = instanceData.y; + + const dif1 = abs(instanceTime.sub(uniformEffector1)).toConst(); + const effect1 = dif1.lessThanEqual(0.15).select(sub(0.15, dif1).mul(sub(1.7, instanceTime).mul(10)), float(0)); + + const dif2 = abs(instanceTime.sub(uniformEffector2)).toConst(); + const effect2 = dif2.lessThanEqual(0.15).select(sub(0.15, dif2).mul(sub(1.7, instanceTime).mul(10)), effect1); + + return pow2(vec3(effect1, 0, effect2)).mul(instanceColor); + })(); + + return mesh; +} diff --git a/examples-testing/examples/webgpu_reflection_roughness.ts b/examples-testing/examples/webgpu_reflection_roughness.ts new file mode 100644 index 000000000..2b6b4a78d --- /dev/null +++ b/examples-testing/examples/webgpu_reflection_roughness.ts @@ -0,0 +1,121 @@ +import * as THREE from 'three/webgpu'; +import { Fn, vec2, vec4, texture, uv, textureBicubic, rangeFogFactor, reflector, time } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let controls; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); + camera.position.set(-4, 1, 4); + + scene = new THREE.Scene(); + + const loader = new UltraHDRLoader(); + loader.load('textures/equirectangular/spruit_sunrise_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + texture.needsUpdate = true; + + scene.background = texture; + scene.environment = texture; + }); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const uvMap = textureLoader.load('textures/uv_grid_directx.jpg'); + uvMap.colorSpace = THREE.SRGBColorSpace; + + const perlinMap = textureLoader.load('./textures/noises/perlin/rgb-256x256.png'); + perlinMap.wrapS = THREE.RepeatWrapping; + perlinMap.wrapT = THREE.RepeatWrapping; + perlinMap.colorSpace = THREE.SRGBColorSpace; + + // uv box for debugging + + const mesh = new THREE.Mesh( + new THREE.BoxGeometry(1, 1, 1), + new THREE.MeshStandardNodeMaterial({ + map: uvMap, + roughnessMap: uvMap, + emissiveMap: uvMap, + emissive: 0xffffff, + }), + ); + mesh.position.set(0, 1.25, 0); + mesh.scale.setScalar(2); + scene.add(mesh); + + // reflection + + const reflection = reflector({ resolutionScale: 0.5, bounces: false, generateMipmaps: true }); // 0.5 is half of the rendering view + reflection.target.rotateX(-Math.PI / 2); + scene.add(reflection.target); + + const animatedUV = uv() + .mul(10) + .add(vec2(time.mul(0.1), 0)); + const roughness = texture(perlinMap, animatedUV).r.mul(2).saturate(); + + const floorMaterial = new THREE.MeshStandardNodeMaterial(); + floorMaterial.transparent = true; + floorMaterial.metalness = 1; + floorMaterial.roughnessNode = roughness.mul(0.2); + floorMaterial.colorNode = Fn(() => { + // blur reflection using textureBicubic() + const dirtyReflection = textureBicubic(reflection, roughness.mul(0.9)); + + // falloff opacity by distance like an opacity-fog + const opacity = rangeFogFactor(7, 25).oneMinus(); + + return vec4(dirtyReflection.rgb, opacity); + })(); + + const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); + floor.position.set(0, 0, 0); + scene.add(floor); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1.5; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 1; + controls.maxDistance = 10; + controls.maxPolarAngle = Math.PI / 2; + controls.autoRotate = true; + controls.autoRotateSpeed = -0.1; + controls.target.set(0, 0.75, 0); + controls.update(); + + // events + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_refraction.ts b/examples-testing/examples/webgpu_refraction.ts new file mode 100644 index 000000000..d475ed2de --- /dev/null +++ b/examples-testing/examples/webgpu_refraction.ts @@ -0,0 +1,144 @@ +import * as THREE from 'three/webgpu'; +import { viewportSafeUV, viewportSharedTexture, screenUV, texture, uv } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; + +let cameraControls; + +let smallSphere; + +init(); + +function init() { + // scene + scene = new THREE.Scene(); + + // camera + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); + camera.position.set(0, 50, 160); + + // + + const geometry = new THREE.IcosahedronGeometry(5, 0); + const material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x7b7b7b, flatShading: true }); + smallSphere = new THREE.Mesh(geometry, material); + scene.add(smallSphere); + + // textures + + const loader = new THREE.TextureLoader(); + + const floorNormal = loader.load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); + floorNormal.wrapS = THREE.RepeatWrapping; + floorNormal.wrapT = THREE.RepeatWrapping; + + // refractor + + const verticalNormalScale = 0.1; + const verticalUVOffset = texture(floorNormal, uv().mul(5)).xy.mul(2).sub(1).mul(verticalNormalScale); + + const refractorUV = screenUV.add(verticalUVOffset); + const verticalRefractor = viewportSharedTexture(viewportSafeUV(refractorUV)).toInspector('Viewport Texture'); + + const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); + + const planeRefractor = new THREE.Mesh( + planeGeo, + new THREE.MeshBasicNodeMaterial({ + backdropNode: verticalRefractor, + }), + ); + planeRefractor.material.transparent = true; + planeRefractor.position.y = 50; + scene.add(planeRefractor); + + // walls + + const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeTop.position.y = 100; + planeTop.rotateX(Math.PI / 2); + scene.add(planeTop); + + const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); + planeBottom.rotateX(-Math.PI / 2); + scene.add(planeBottom); + + const planeBack = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); + planeBack.position.z = -50; + planeBack.position.y = 50; + scene.add(planeBack); + + const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); + planeRight.position.x = 50; + planeRight.position.y = 50; + planeRight.rotateY(-Math.PI / 2); + scene.add(planeRight); + + const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); + planeLeft.position.x = -50; + planeLeft.position.y = 50; + planeLeft.rotateY(Math.PI / 2); + scene.add(planeLeft); + + // lights + + const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); + mainLight.position.y = 60; + scene.add(mainLight); + + const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); + greenLight.position.set(550, 50, 0); + scene.add(greenLight); + + const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); + redLight.position.set(-550, 50, 0); + scene.add(redLight); + + const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); + blueLight.position.set(0, 50, 550); + scene.add(blueLight); + + // renderer + + renderer = new THREE.WebGPURenderer(/*{ antialias: true }*/); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + cameraControls = new OrbitControls(camera, renderer.domElement); + cameraControls.target.set(0, 50, 0); + cameraControls.maxDistance = 400; + cameraControls.minDistance = 10; + cameraControls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const timer = Date.now() * 0.01; + + smallSphere.position.set( + Math.cos(timer * 0.1) * 30, + Math.abs(Math.cos(timer * 0.2)) * 20 + 5, + Math.sin(timer * 0.1) * 30, + ); + smallSphere.rotation.y = Math.PI / 2 - timer * 0.1; + smallSphere.rotation.z = timer * 0.8; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts b/examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts new file mode 100644 index 000000000..627fd6b18 --- /dev/null +++ b/examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts @@ -0,0 +1,237 @@ +import * as THREE from 'three/webgpu'; +import { vec2, uniform, screenUV, color, texture, diffuseColor, attribute, vec3, vec4 } from 'three/tsl'; + +import { TextureHelper } from 'three/addons/helpers/TextureHelperGPU.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { unzipSync } from 'three/addons/libs/fflate.module.js'; + +let renderer; +let views = []; + +class View { + constructor(left, top, width, height) { + this.left = left; + this.top = top; + this.width = width; + this.height = height; + + const aspect = (window.innerWidth * width) / (window.innerHeight * height); + + // Set up perspective camera + this.camera = new THREE.PerspectiveCamera(50, aspect, 0.1, 100); + this.camera.position.set(-7, 0, 10); + this.camera.lookAt(0, 0, 0); + this.camera.updateProjectionMatrix(); + + this.scene = new THREE.Scene(); + + const normalizedUV = screenUV.mul(vec2(1, -1)).add(vec2(0, 1)); // Flip Y and offset + + // Calculate viewport center in normalized coordinates + const viewportCenter = vec2( + this.left + this.width * 0.5, + this.top + this.height * 0.5, // Invert Y coordinate for proper alignment + ); + + const distanceEffect = normalizedUV.distance(viewportCenter).smoothstep(0, 0.2); + + const backgroundEffect = color(this.top > 0 ? 0x212121 : 0x616161).sub(distanceEffect.pow(0.3).mul(0.1)); + + this.scene.backgroundNode = backgroundEffect; + } + + // Method to handle viewport resize + updateSize(left, top, width, height) { + this.left = left; + this.top = top; + this.width = width; + this.height = height; + + const aspect = (window.innerWidth * width) / (window.innerHeight * height); + this.camera.aspect = aspect; + this.camera.updateProjectionMatrix(); + } +} + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.autoClear = false; + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + await renderer.init(); + + // Create views after renderer initialization + views = [ + new View(0.0, 0.0, 0.5, 0.5), + new View(0.5, 0.0, 0.5, 0.5), + new View(0.0, 0.5, 0.5, 0.5), + new View(0.5, 0.5, 0.5, 0.5), + ]; + + // Add OrbitControls after views and renderer are created + views.forEach(view => { + view.controls = new OrbitControls(view.camera, renderer.domElement); + view.controls.minDistance = 1; + view.controls.maxDistance = 20; + view.controls.minAzimuthAngle = -Math.PI / 3; + view.controls.maxAzimuthAngle = Math.PI / 3; + view.controls.minPolarAngle = Math.PI / 4; + view.controls.maxPolarAngle = Math.PI / 1.25; + view.controls.enableDamping = true; + }); + + const size = { + width: 256, + height: 256, + depth: 109, + }; + + new THREE.FileLoader().setResponseType('arraybuffer').load('textures/3d/head256x256x109.zip', function (data) { + const zip = unzipSync(new Uint8Array(data)); + const array = new Uint8Array(zip['head256x256x109'].buffer); + + const map3D = new THREE.Data3DTexture(array, size.width, size.height, size.depth); + map3D.name = 'Data3DTexture'; + map3D.format = THREE.RedFormat; + map3D.minFilter = THREE.LinearFilter; + map3D.magFilter = THREE.LinearFilter; + map3D.unpackAlignment = 1; + map3D.needsUpdate = true; + + const depth = size.depth / 20; + + // 3D + const helper3D = new TextureHelper(map3D, 10, 10, depth); + helper3D.material.outputNode = vec4( + vec3(diffuseColor.r.mul(attribute('uvw').z.mul(diffuseColor.r))), + diffuseColor.r.mul(diffuseColor.a), + ); + views[1].scene.add(helper3D); + + const fbo3D = new THREE.RenderTarget3D(size.width, size.height, size.depth, { + depthBuffer: false, + }); + fbo3D.texture.name = 'RenderTarget3D'; + + const fbo3DHelper = new TextureHelper(fbo3D.texture, 10, 10, depth); + fbo3DHelper.material.outputNode = vec4(vec3(diffuseColor.r), diffuseColor.r); + views[3].scene.add(fbo3DHelper); + + // 2D Array + + const mapArray = new THREE.DataArrayTexture(array, size.width, size.height, size.depth); + mapArray.name = 'DataArrayTexture'; + mapArray.format = THREE.RedFormat; + mapArray.minFilter = THREE.LinearFilter; + mapArray.magFilter = THREE.LinearFilter; + mapArray.unpackAlignment = 1; + mapArray.needsUpdate = true; + + const helperArray = new TextureHelper(mapArray, 10, 10, depth); + helperArray.material.outputNode = vec4( + vec3(diffuseColor.r.mul(attribute('uvw').z.div(size.depth).mul(diffuseColor.r))), + diffuseColor.r.mul(diffuseColor.a), + ); + views[0].scene.add(helperArray); + + // Setup render targets + const materialQuad = new THREE.NodeMaterial(); + const uZCoord = uniform(0); + materialQuad.depthTest = false; + materialQuad.outputNode = vec4(texture(mapArray).depth(uZCoord).rgb, 1); + + const fboArray = new THREE.RenderTarget(size.width, size.height, { + depthBuffer: false, + depth: size.depth, + }); + fboArray.texture.name = 'RenderTargetArray'; + + const fboArrayHelper = new TextureHelper(fboArray.texture, 10, 10, depth); + fboArrayHelper.material.outputNode = vec4(vec3(diffuseColor.r), diffuseColor.r); + views[2].scene.add(fboArrayHelper); + + const quadMesh = new THREE.QuadMesh(materialQuad); + + // In WebGPU we need to clear all the layers of the 3D render target before rendering to it (WebGPU limitation?) + if (renderer.backend.isWebGPUBackend) { + const materialClear = new THREE.NodeMaterial(); + materialClear.outputNode = vec4(0); + const clearQuadMesh = new THREE.QuadMesh(materialClear); + for (let i = 0; i < size.depth; i++) { + renderer.setRenderTarget(fbo3D, i); + clearQuadMesh.render(renderer); + } + } + + let j = 0; + + const loop = () => { + if (j === size.depth) { + clearInterval(interval); + return; + } + + // Disable viewport and scissor for FBO rendering + renderer.setViewport(0, 0, size.width, size.height); + renderer.setScissor(0, 0, size.width, size.height); + renderer.setScissorTest(false); + + uZCoord.value = j; + + renderer.setRenderTarget(fboArray, j); + renderer.clear(); + quadMesh.render(renderer); + + renderer.setRenderTarget(fbo3D, j); + renderer.clear(); + quadMesh.render(renderer); + + renderer.setRenderTarget(null); + + j = (j + 1) % size.depth; + }; + + const interval = setInterval(loop, 50); + + loop(); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + renderer.setSize(width, height); + + views.forEach(view => { + view.updateSize(view.left, view.top, view.width, view.height); + }); +} + +function animate() { + views.forEach(view => { + view.controls.update(); + + const left = Math.floor(view.left * window.innerWidth); + const bottom = Math.floor((1 - view.top - view.height) * window.innerHeight); + const width = Math.floor(view.width * window.innerWidth); + const height = Math.floor(view.height * window.innerHeight); + + renderer.setViewport(left, bottom, width, height); + renderer.setScissor(left, bottom, width, height); + renderer.setScissorTest(true); + + renderer.clear(); + renderer.render(view.scene, view.camera); + }); +} + +init(); diff --git a/examples-testing/examples/webgpu_reversed_depth_buffer.ts b/examples-testing/examples/webgpu_reversed_depth_buffer.ts new file mode 100644 index 000000000..d159748f5 --- /dev/null +++ b/examples-testing/examples/webgpu_reversed_depth_buffer.ts @@ -0,0 +1,169 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; + +let camera, reversedCamera, scene; +let normalRenderer, logarithmicRenderer, reverseRenderer; +let normalRenderPipeline, logarithmicRenderPipeline, reverseRenderPipeline; +const meshes = []; + +init().then(animate); + +async function init() { + camera = new THREE.PerspectiveCamera(72, (0.33 * window.innerWidth) / window.innerHeight, 5, 9999); + camera.position.z = 12; + + reversedCamera = camera.clone(); + + scene = new THREE.Scene(); + + const xCount = 1; + const yCount = 5; + const numInstances = xCount * yCount; + + const d = 0.0001; // half distance between two planes + const o = 0.5; // half x offset to shift planes so they are only partially overlapping + + const positions = new Float32Array([ + -1 - o, + -1, + d, + 1 - o, + -1, + d, + -1 - o, + 1, + d, + 1 - o, + -1, + d, + 1 - o, + 1, + d, + -1 - o, + 1, + d, + + -1 + o, + -1, + -d, + 1 + o, + -1, + -d, + -1 + o, + 1, + -d, + 1 + o, + -1, + -d, + 1 + o, + 1, + -d, + -1 + o, + 1, + -d, + ]); + + const colors = new Float32Array([ + 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, + + 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, + ]); + + const geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); + geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3)); + + const material = new THREE.MeshBasicMaterial({ vertexColors: true }); + + for (let i = 0; i < numInstances; i++) { + const mesh = new THREE.Mesh(geometry, material); + meshes.push(mesh); + scene.add(mesh); + } + + let i = 0; + for (let x = 0; x < xCount; x++) { + for (let y = 0; y < yCount; y++) { + const z = -800 * i; + const s = 1 + 50 * i; + + const mesh = meshes[i]; + mesh.position.set(x - xCount / 2 + 0.5, (4.0 - 0.2 * z) * (y - yCount / 2 + 1.0), z); + mesh.scale.setScalar(s); + + i++; + } + } + + const normalContainer = document.getElementById('container_normal'); + normalRenderer = new THREE.WebGPURenderer(); + normalRenderer.setPixelRatio(window.devicePixelRatio); + normalRenderer.setSize(0.33 * window.innerWidth, window.innerHeight); + normalRenderer.domElement.style.position = 'relative'; + normalContainer.appendChild(normalRenderer.domElement); + + const logarithmicContainer = document.getElementById('container_logarithmic'); + logarithmicRenderer = new THREE.WebGPURenderer({ logarithmicDepthBuffer: true }); + logarithmicRenderer.setPixelRatio(window.devicePixelRatio); + logarithmicRenderer.setSize(0.33 * window.innerWidth, window.innerHeight); + logarithmicRenderer.domElement.style.position = 'relative'; + logarithmicContainer.appendChild(logarithmicRenderer.domElement); + + const reverseContainer = document.getElementById('container_reverse'); + reverseRenderer = new THREE.WebGPURenderer({ reversedDepthBuffer: true }); + reverseRenderer.setPixelRatio(window.devicePixelRatio); + reverseRenderer.setSize(0.33 * window.innerWidth, window.innerHeight); + reverseRenderer.domElement.style.position = 'relative'; + reverseContainer.appendChild(reverseRenderer.domElement); + + // + + normalRenderPipeline = new THREE.RenderPipeline(normalRenderer); + normalRenderPipeline.outputNode = pass(scene, camera); + + logarithmicRenderPipeline = new THREE.RenderPipeline(logarithmicRenderer); + logarithmicRenderPipeline.outputNode = pass(scene, camera); + + reverseRenderPipeline = new THREE.RenderPipeline(reverseRenderer); + reverseRenderPipeline.outputNode = pass(scene, reversedCamera); + + await Promise.all([normalRenderer.init(), logarithmicRenderer.init(), reverseRenderer.init()]); + + window.addEventListener('resize', onWindowResize); + onWindowResize(); +} + +function animate() { + requestAnimationFrame(animate); + + const now = performance.now() / 1000; + + for (let i = 0; i < meshes.length; i++) { + const angle = THREE.MathUtils.degToRad(30); + const axis = new THREE.Vector3(Math.sin(now), Math.cos(now), 0); + meshes[i].quaternion.setFromAxisAngle(axis, angle); + } + + render(); +} + +function render() { + normalRenderPipeline.render(); + logarithmicRenderPipeline.render(); + reverseRenderPipeline.render(); +} + +function onWindowResize() { + const width = 0.33 * window.innerWidth; + const height = window.innerHeight; + + normalRenderer.setSize(width, height); + logarithmicRenderer.setSize(width, height); + reverseRenderer.setSize(width, height); + + camera.aspect = (0.33 * window.innerWidth) / window.innerHeight; + camera.updateProjectionMatrix(); + + reversedCamera.aspect = (0.33 * window.innerWidth) / window.innerHeight; + reversedCamera.updateProjectionMatrix(); +} diff --git a/examples-testing/examples/webgpu_rtt.ts b/examples-testing/examples/webgpu_rtt.ts new file mode 100644 index 000000000..fa7577ea8 --- /dev/null +++ b/examples-testing/examples/webgpu_rtt.ts @@ -0,0 +1,90 @@ +import * as THREE from 'three/webgpu'; +import { texture, uniform, saturation, hue } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +const mouse = new THREE.Vector2(); + +let quadMesh, renderTarget; + +let box; + +const dpr = window.devicePixelRatio; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.z = 3; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x0066ff); + + // textured mesh + + const loader = new THREE.TextureLoader(); + const uvTexture = loader.load('./textures/uv_grid_opengl.jpg'); + + const geometryBox = new THREE.BoxGeometry(); + const materialBox = new THREE.MeshBasicNodeMaterial(); + materialBox.colorNode = texture(uvTexture); + + // + + box = new THREE.Mesh(geometryBox, materialBox); + scene.add(box); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(dpr); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderer.inspector = new Inspector(); + + renderTarget = new THREE.RenderTarget(window.innerWidth * dpr, window.innerHeight * dpr); + + window.addEventListener('mousemove', onWindowMouseMove); + window.addEventListener('resize', onWindowResize); + + // FX + + // modulate the final color based on the mouse position + + const screenFXNode = uniform(mouse); + + const materialFX = new THREE.MeshBasicNodeMaterial(); + + const scenePassTexture = texture(renderTarget.texture).toInspector('Scene Pass'); + materialFX.colorNode = hue(saturation(scenePassTexture.rgb, screenFXNode.x.oneMinus()), screenFXNode.y); + + quadMesh = new THREE.QuadMesh(materialFX); + quadMesh.name = 'Post-Processing'; +} + +function onWindowMouseMove(e) { + mouse.x = e.offsetX / window.innerWidth; + mouse.y = e.offsetY / window.innerHeight; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); + renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); +} + +function animate() { + box.rotation.x += 0.01; + box.rotation.y += 0.02; + + renderer.setRenderTarget(renderTarget); + renderer.render(scene, camera); + + renderer.setRenderTarget(null); + quadMesh.render(renderer); +} diff --git a/examples-testing/examples/webgpu_shadow_contact.ts b/examples-testing/examples/webgpu_shadow_contact.ts new file mode 100644 index 000000000..ac3e4fbd8 --- /dev/null +++ b/examples-testing/examples/webgpu_shadow_contact.ts @@ -0,0 +1,205 @@ +import * as THREE from 'three/webgpu'; +import { vec3, uniform, texture, depth, float } from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let shadowCamera, shadowGroup; +let renderTarget; +let plane, fillPlane, cameraHelper; +let depthMaterial, shadowPlaneMaterial, fillPlaneMaterial; + +const meshes = []; + +const PLANE_WIDTH = 2.5; +const PLANE_HEIGHT = 2.5; +const CAMERA_HEIGHT = 0.3; + +const state = { + shadow: { blur: 3.5, darkness: 1.0, opacity: 1.0 }, + plane: { color: '#ffffff', opacity: 1.0 }, + showWireframe: false, +}; + +const uBlur = uniform(state.shadow.blur); +const uDarkness = uniform(state.shadow.darkness); +const uShadowOpacity = uniform(state.shadow.opacity); +const uPlaneOpacity = uniform(state.plane.opacity); +const uPlaneColor = uniform(new THREE.Color(state.plane.color)); +const uPlaneY = uniform(-0.3); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0.5, 1, 2); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + window.addEventListener('resize', onWindowResize); + + const geometries = [ + new THREE.BoxGeometry(0.4, 0.4, 0.4), + new THREE.IcosahedronGeometry(0.3), + new THREE.TorusKnotGeometry(0.4, 0.05, 256, 24, 1, 3), + ]; + + const material = new THREE.MeshNormalMaterial(); + + for (let i = 0, l = geometries.length; i < l; i++) { + const angle = (i / l) * Math.PI * 2; + const mesh = new THREE.Mesh(geometries[i], material); + mesh.position.y = 0.1; + mesh.position.x = Math.cos(angle) / 2.0; + mesh.position.z = Math.sin(angle) / 2.0; + scene.add(mesh); + meshes.push(mesh); + } + + shadowGroup = new THREE.Group(); + shadowGroup.position.y = uPlaneY.value; + scene.add(shadowGroup); + + renderTarget = new THREE.RenderTarget(512, 512, { depthBuffer: true }); + renderTarget.texture.generateMipmaps = false; + + const planeGeometry = new THREE.PlaneGeometry(PLANE_WIDTH, PLANE_HEIGHT).rotateX(Math.PI / 2); + + depthMaterial = new THREE.NodeMaterial(); + + const alphaDepth = float(1).sub(depth).mul(uDarkness); + + depthMaterial.colorNode = vec3(0); + depthMaterial.opacityNode = alphaDepth; + depthMaterial.depthTest = false; + depthMaterial.depthWrite = false; + + shadowPlaneMaterial = new THREE.NodeMaterial(); + shadowPlaneMaterial.transparent = true; + shadowPlaneMaterial.depthWrite = false; + + if (!renderTarget.texture.image) renderTarget.texture.image = { width: 512, height: 512 }; + + const blurredShadow = gaussianBlur(texture(renderTarget.texture), uBlur, 4, { premultipliedAlpha: false }); + shadowPlaneMaterial.colorNode = vec3(0); + shadowPlaneMaterial.opacityNode = blurredShadow.a.mul(uShadowOpacity); + + plane = new THREE.Mesh(planeGeometry, shadowPlaneMaterial); + plane.renderOrder = 1; + plane.scale.y = -1; + plane.scale.z = -1; + shadowGroup.add(plane); + + fillPlaneMaterial = new THREE.NodeMaterial(); + fillPlaneMaterial.transparent = true; + fillPlaneMaterial.depthWrite = false; + fillPlaneMaterial.colorNode = uPlaneColor; + fillPlaneMaterial.opacityNode = uPlaneOpacity; + fillPlane = new THREE.Mesh(planeGeometry, fillPlaneMaterial); + fillPlane.rotateX(Math.PI); + shadowGroup.add(fillPlane); + + shadowCamera = new THREE.OrthographicCamera( + -PLANE_WIDTH / 2, + PLANE_WIDTH / 2, + PLANE_HEIGHT / 2, + -PLANE_HEIGHT / 2, + 0, + CAMERA_HEIGHT, + ); + shadowCamera.rotation.x = Math.PI / 2; + shadowGroup.add(shadowCamera); + + cameraHelper = new THREE.CameraHelper(shadowCamera); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + renderer.inspector = new Inspector(); + + const params = { + shadowBlur: state.shadow.blur, + shadowDarkness: state.shadow.darkness, + shadowOpacity: state.shadow.opacity, + planeColor: state.plane.color, + planeOpacity: state.plane.opacity, + showWireframe: state.showWireframe, + }; + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(params, 'shadowBlur', 0, 15, 0.1).onChange(() => { + state.shadow.blur = params.shadowBlur; + uBlur.value = state.shadow.blur; + }); + + gui.add(params, 'shadowDarkness', 0.1, 5, 0.1).onChange(() => { + state.shadow.darkness = params.shadowDarkness; + uDarkness.value = state.shadow.darkness; + }); + + gui.add(params, 'shadowOpacity', 0, 1, 0.01).onChange(() => { + state.shadow.opacity = params.shadowOpacity; + uShadowOpacity.value = state.shadow.opacity; + }); + + gui.addColor(params, 'planeColor').onChange(() => { + state.plane.color = params.planeColor; + uPlaneColor.value.set(state.plane.color); + }); + + gui.add(params, 'planeOpacity', 0, 1, 0.01).onChange(() => { + state.plane.opacity = params.planeOpacity; + uPlaneOpacity.value = state.plane.opacity; + }); + + gui.add(params, 'showWireframe').onChange(() => { + if (params.showWireframe) scene.add(cameraHelper); + else scene.remove(cameraHelper); + }); + + new OrbitControls(camera, renderer.domElement); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + meshes.forEach(m => { + m.rotation.x += 0.01; + m.rotation.y += 0.02; + }); + + const initialBackground = scene.background; + scene.background = null; + + const prevOverride = scene.overrideMaterial; + const prevHelperVisible = cameraHelper.visible; + cameraHelper.visible = false; + scene.overrideMaterial = depthMaterial; + const initialAutoClear = renderer.autoClear; + renderer.autoClear = true; + const initialClearAlpha = renderer.getClearAlpha ? renderer.getClearAlpha() : undefined; + if (initialClearAlpha !== undefined) renderer.setClearAlpha(0); + + renderer.setRenderTarget(renderTarget); + renderer.clear(); + renderer.render(scene, shadowCamera); + + scene.overrideMaterial = prevOverride; + renderer.setRenderTarget(null); + renderer.autoClear = initialAutoClear; + if (initialClearAlpha !== undefined) renderer.setClearAlpha(initialClearAlpha); + scene.background = initialBackground; + cameraHelper.visible = prevHelperVisible; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_shadowmap.ts b/examples-testing/examples/webgpu_shadowmap.ts new file mode 100644 index 000000000..f6edec750 --- /dev/null +++ b/examples-testing/examples/webgpu_shadowmap.ts @@ -0,0 +1,166 @@ +import * as THREE from 'three/webgpu'; +import { mx_fractal_noise_float, mx_fractal_noise_vec3, positionLocal, positionWorld, Fn, color } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, timer; +let dirLight, spotLight; +let torusKnot, dirGroup; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 10, 20); + + scene = new THREE.Scene(); + scene.backgroundNode = color(0x222244); + scene.fog = new THREE.Fog(0x222244, 50, 100); + + // lights + + scene.add(new THREE.AmbientLight(0x444444, 2)); + + spotLight = new THREE.SpotLight(0xff8888, 400); + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.3; + spotLight.position.set(8, 10, 5); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 8; + spotLight.shadow.camera.far = 200; + spotLight.shadow.mapSize.width = 2048; + spotLight.shadow.mapSize.height = 2048; + spotLight.shadow.radius = 4; + scene.add(spotLight); + + dirLight = new THREE.DirectionalLight(0x8888ff, 3); + dirLight.position.set(3, 12, 17); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = 500; + dirLight.shadow.camera.right = 17; + dirLight.shadow.camera.left = -17; + dirLight.shadow.camera.top = 17; + dirLight.shadow.camera.bottom = -17; + dirLight.shadow.mapSize.width = 2048; + dirLight.shadow.mapSize.height = 2048; + dirLight.shadow.radius = 4; + + dirGroup = new THREE.Group(); + dirGroup.add(dirLight); + scene.add(dirGroup); + + // geometry + + const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 80); + const material = new THREE.MeshPhongNodeMaterial({ + color: 0x999999, + shininess: 0, + specular: 0x222222, + }); + + const materialCustomShadow = material.clone(); + materialCustomShadow.transparent = true; + + const discardNode = mx_fractal_noise_float(positionLocal.mul(0.1)).x.greaterThan(0.0); + + materialCustomShadow.maskNode = discardNode; + + torusKnot = new THREE.Mesh(geometry, materialCustomShadow); + torusKnot.scale.multiplyScalar(1 / 18); + torusKnot.position.y = 3; + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); + + const pillar1 = new THREE.Mesh(cylinderGeometry, material); + pillar1.position.set(8, 3.5, 8); + pillar1.castShadow = true; + + const pillar2 = pillar1.clone(); + pillar2.position.set(8, 3.5, -8); + const pillar3 = pillar1.clone(); + pillar3.position.set(-8, 3.5, 8); + const pillar4 = pillar1.clone(); + pillar4.position.set(-8, 3.5, -8); + + scene.add(pillar1); + scene.add(pillar2); + scene.add(pillar3); + scene.add(pillar4); + + const planeGeometry = new THREE.PlaneGeometry(200, 200); + + const planeMaterial = new THREE.MeshPhongNodeMaterial(); + planeMaterial.color.setHex(0x999999); + planeMaterial.shininess = 0; + planeMaterial.specular.setHex(0x111111); + + planeMaterial.receivedShadowPositionNode = Fn(() => { + const pos = positionWorld.toVar(); + pos.xz.addAssign(mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().xz); + return pos; + })(); + + planeMaterial.colorNode = Fn(() => { + const pos = positionWorld.toVar(); + pos.xz.addAssign(mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().xz); + return mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().zzz.mul(0.2).add(0.5); + })(); + + const ground = new THREE.Mesh(planeGeometry, planeMaterial); + ground.rotation.x = -Math.PI / 2; + ground.scale.multiplyScalar(3); + ground.castShadow = true; + ground.receiveShadow = true; + scene.add(ground); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // Mouse control + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2, 0); + controls.minDistance = 7; + controls.maxDistance = 40; + controls.update(); + + timer = new THREE.Timer(); + timer.connect(document); + + window.addEventListener('resize', resize); +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(time) { + timer.update(); + + const delta = timer.getDelta(); + + torusKnot.rotation.x += 0.25 * delta; + torusKnot.rotation.y += 0.5 * delta; + torusKnot.rotation.z += 1 * delta; + + dirGroup.rotation.y += 0.7 * delta; + dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_shadowmap_array.ts b/examples-testing/examples/webgpu_shadowmap_array.ts new file mode 100644 index 000000000..03c7f2a45 --- /dev/null +++ b/examples-testing/examples/webgpu_shadowmap_array.ts @@ -0,0 +1,329 @@ +import * as THREE from 'three/webgpu'; +import { mx_fractal_noise_vec3, positionWorld, Fn, color } from 'three/tsl'; + +import { TileShadowNode } from 'three/addons/tsl/shadows/TileShadowNode.js'; +import { TileShadowNodeHelper } from 'three/addons/tsl/shadows/TileShadowNodeHelper.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, timer; +let dirLight; +let torusKnot, dirGroup; +let tsmHelper; + +init(); + +async function init() { + // Renderer setup + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + renderer.inspector = new Inspector(); + + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.BasicShadowMap; + + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.2; + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(45, 60, 100); + + scene = new THREE.Scene(); + scene.backgroundNode = color(0xccccff); // Brighter blue sky + scene.fog = new THREE.Fog(0xccccff, 700, 1000); + + // Enhanced lighting for a brighter scene + scene.add(new THREE.AmbientLight(0xccccff, 3)); + + // Main directional light (sun) + dirLight = new THREE.DirectionalLight(0xffffaa, 5); + dirLight.position.set(0, 80, 30); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 1; + dirLight.shadow.camera.far = 200; + dirLight.shadow.camera.right = 180; + dirLight.shadow.camera.left = -180; + dirLight.shadow.camera.top = 180; + dirLight.shadow.camera.bottom = -160; + dirLight.shadow.mapSize.width = 1024 * 4; + dirLight.shadow.mapSize.height = 1024 * 4; + dirLight.shadow.radius = 1; + + // Set up the tile shadow mapping + const tsm = new TileShadowNode(dirLight, { + tilesX: 2, + tilesY: 2, + }); + + dirLight.shadow.shadowNode = tsm; + scene.add(dirLight); + + tsmHelper = new TileShadowNodeHelper(tsm); + scene.add(tsmHelper); + + dirGroup = new THREE.Group(); + dirGroup.add(dirLight); + scene.add(dirGroup); + + // Create the ground with enhanced texture + const planeGeometry = new THREE.PlaneGeometry(1500, 1500, 2, 2); + const planeMaterial = new THREE.MeshPhongMaterial({ + color: 0x88aa44, + shininess: 5, + specular: 0x222222, + }); + + planeMaterial.colorNode = Fn(() => { + const noise = mx_fractal_noise_vec3(positionWorld.mul(0.05)).saturate(); + // Mix of greens and browns for a more natural ground + const green = color(0.4, 0.7, 0.3); + const brown = color(0.6, 0.5, 0.3); + return noise.x.mix(green, brown); + })(); + + const ground = new THREE.Mesh(planeGeometry, planeMaterial); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + // Spread various objects across the scene + createScenery(); + + // Camera controls + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 5, 0); + controls.minDistance = 0.01; + controls.maxDistance = 400; + controls.maxPolarAngle = Math.PI / 2 - 0.1; // Prevent camera from going below ground + controls.update(); + + timer = new THREE.Timer(); + timer.connect(document); + + window.addEventListener('resize', resize); +} + +function createScenery() { + // 1. Columns using instanced mesh + const columnGeometry = new THREE.CylinderGeometry(0.8, 1, 1, 16); + const columnMaterial = new THREE.MeshPhongMaterial({ + color: 0xdddddd, + shininess: 20, + }); + + const columnPositions = []; + const columnScales = []; + + for (let x = -100; x <= 100; x += 40) { + for (let z = -100; z <= 100; z += 40) { + if (Math.random() > 0.3) { + const height = 5 + Math.random() * 10; + const posX = x + (Math.random() * 10 - 5); + const posY = height / 2; + const posZ = z + (Math.random() * 10 - 5); + + columnPositions.push(posX, posY, posZ); + columnScales.push(1, height, 1); // Only scale Y to match height + } + } + } + + const columnCount = columnPositions.length / 3; + const columnInstancedMesh = new THREE.InstancedMesh(columnGeometry, columnMaterial, columnCount); + + const matrix = new THREE.Matrix4(); + for (let i = 0; i < columnCount; i++) { + const x = columnPositions[i * 3]; + const y = columnPositions[i * 3 + 1]; + const z = columnPositions[i * 3 + 2]; + const scaleY = columnScales[i * 3 + 1]; + + matrix.makeScale(1, scaleY, 1); + matrix.setPosition(x, y, z); + columnInstancedMesh.setMatrixAt(i, matrix); + } + + columnInstancedMesh.castShadow = true; + columnInstancedMesh.receiveShadow = true; + scene.add(columnInstancedMesh); + + // 2. Add a central feature - the torus knot (kept as regular mesh for animation) + const torusKnotGeometry = new THREE.TorusKnotGeometry(25, 8, 100, 30); + const torusKnotMaterial = new THREE.MeshPhongNodeMaterial({ + color: 0xff6347, // Tomato color + shininess: 30, + }); + + torusKnot = new THREE.Mesh(torusKnotGeometry, torusKnotMaterial); + torusKnot.scale.multiplyScalar(1 / 18); + torusKnot.position.x = 5; + torusKnot.position.y = 5; + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + // 3. Cubes using instanced mesh + const cubeGeometry = new THREE.BoxGeometry(3, 3, 3); + const cubeMaterials = [ + new THREE.MeshPhongMaterial({ color: 0x6699cc, shininess: 20 }), + new THREE.MeshPhongMaterial({ color: 0xcc6666, shininess: 20 }), + new THREE.MeshPhongMaterial({ color: 0xcccc66, shininess: 20 }), + ]; + + const cubeCount = 10; + const cubeInstances = cubeMaterials.map(material => { + return new THREE.InstancedMesh(cubeGeometry, material, cubeCount); + }); + + for (let i = 0; i < 30; i++) { + const materialIndex = i % 3; + const instanceIndex = Math.floor(i / 3); + + const x = Math.random() * 300 - 150; + const y = 1.5; + const z = Math.random() * 300 - 150; + const rotY = Math.random() * Math.PI * 2; + + matrix.makeRotationY(rotY); + matrix.setPosition(x, y, z); + + cubeInstances[materialIndex].setMatrixAt(instanceIndex, matrix); + } + + cubeInstances.forEach(instance => { + instance.castShadow = true; + instance.receiveShadow = true; + scene.add(instance); + }); + + // 4. Spheres using instanced mesh + const sphereGeometry = new THREE.SphereGeometry(2, 32, 32); + const sphereMaterial = new THREE.MeshPhongMaterial({ + color: 0x88ccaa, + shininess: 40, + }); + + const sphereCount = 25; + const sphereInstancedMesh = new THREE.InstancedMesh(sphereGeometry, sphereMaterial, sphereCount); + + for (let i = 0; i < sphereCount; i++) { + const x = Math.random() * 180 - 90; + const y = 2; + const z = Math.random() * 180 - 90; + + matrix.makeScale(1, 1, 1); + matrix.setPosition(x, y, z); + sphereInstancedMesh.setMatrixAt(i, matrix); + } + + sphereInstancedMesh.castShadow = true; + sphereInstancedMesh.receiveShadow = true; + scene.add(sphereInstancedMesh); + + // 5. Trees using instanced mesh for trunks and tops separately + const trunkGeometry = new THREE.CylinderGeometry(0.5, 0.5, 2, 8); + const topGeometry = new THREE.ConeGeometry(2, 8, 8); + const treeMaterial = new THREE.MeshPhongMaterial({ + vertexColors: true, + shininess: 5, + }); + + const treeCount = 40; + const totalInstanceCount = treeCount * 2; + + const trunkVertexCount = trunkGeometry.attributes.position.count; + const trunkIndexCount = trunkGeometry.index ? trunkGeometry.index.count : 0; + const topVertexCount = topGeometry.attributes.position.count; + const topIndexCount = topGeometry.index ? topGeometry.index.count : 0; + + const totalVertexCount = (trunkVertexCount + topVertexCount) * 2; // Multiple for safety + const totalIndexCount = (trunkIndexCount + topIndexCount) * 2; + const treeBatchedMesh = new THREE.BatchedMesh(totalInstanceCount, totalVertexCount, totalIndexCount, treeMaterial); + treeBatchedMesh.castShadow = true; + treeBatchedMesh.perObjectFrustumCulled = false; + const trunkGeometryId = treeBatchedMesh.addGeometry(trunkGeometry); + const topGeometryId = treeBatchedMesh.addGeometry(topGeometry); + + const trunkColor = new THREE.Color(0x8b4513); + const topColor = new THREE.Color(0x336633); + + for (let i = 0; i < treeCount; i++) { + const x = Math.random() * 300 - 150; + const z = Math.random() * 300 - 150; + + const trunkId = treeBatchedMesh.addInstance(trunkGeometryId); + matrix.makeScale(1, 1, 1); + matrix.setPosition(x, 1, z); + treeBatchedMesh.setMatrixAt(trunkId, matrix); + treeBatchedMesh.setColorAt(trunkId, trunkColor); + + const topId = treeBatchedMesh.addInstance(topGeometryId); + matrix.makeScale(1, 1, 1); + matrix.setPosition(x, 6, z); + treeBatchedMesh.setMatrixAt(topId, matrix); + treeBatchedMesh.setColorAt(topId, topColor); + } + + scene.add(treeBatchedMesh); + + // 6. Torus shapes using instanced mesh + const torusGeometry = new THREE.TorusGeometry(3, 1, 16, 50); + const torusMaterial = new THREE.MeshPhongMaterial({ + color: 0xff99cc, + shininess: 30, + }); + + const torusCount = 15; + const torusInstancedMesh = new THREE.InstancedMesh(torusGeometry, torusMaterial, torusCount); + + for (let i = 0; i < torusCount; i++) { + const x = Math.random() * 320 - 160; + const y = 2; + const z = Math.random() * 320 - 160; + const rotZ = Math.random() * Math.PI * 2; + + // Apply rotation (PI/2 on X-axis and random on Z-axis) + matrix.makeRotationX(Math.PI / 2); + const rotMatrix = new THREE.Matrix4().makeRotationZ(rotZ); + matrix.multiply(rotMatrix); + matrix.setPosition(x, y, z); + + torusInstancedMesh.setMatrixAt(i, matrix); + } + + torusInstancedMesh.castShadow = true; + torusInstancedMesh.receiveShadow = true; + scene.add(torusInstancedMesh); +} + +function resize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate(time) { + timer.update(); + + const delta = timer.getDelta(); + + // Rotate the central torus knot + torusKnot.rotation.x += 0.25 * delta; + torusKnot.rotation.y += 0.5 * delta; + torusKnot.rotation.z += 1 * delta; + + dirLight.position.x = Math.sin(time * 0.0001) * 30; + dirLight.position.z = Math.cos(time * 0.0001) * 30; + + renderer.render(scene, camera); + + tsmHelper.update(); +} diff --git a/examples-testing/examples/webgpu_shadowmap_csm.ts b/examples-testing/examples/webgpu_shadowmap_csm.ts new file mode 100644 index 000000000..34c38a16b --- /dev/null +++ b/examples-testing/examples/webgpu_shadowmap_csm.ts @@ -0,0 +1,267 @@ +import * as THREE from 'three/webgpu'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { CSMShadowNode } from 'three/addons/csm/CSMShadowNode.js'; +import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; + +let renderer, scene, camera, orthoCamera, controls, csm, csmHelper, csmDirectionalLight; + +const params = { + orthographic: false, + fade: false, + shadows: true, + maxFar: 1000, + mode: 'practical', + lightX: -1, + lightY: -1, + lightZ: -1, + margin: 100, + shadowNear: 1, + shadowFar: 2000, + autoUpdateHelper: true, + updateHelper: function () { + csmHelper.update(); + }, +}; + +init(); + +function updateOrthoCamera() { + const size = controls.target.distanceTo(camera.position); + const aspect = camera.aspect; + + orthoCamera.left = (size * aspect) / -2; + orthoCamera.right = (size * aspect) / 2; + + orthoCamera.top = size / 2; + orthoCamera.bottom = size / -2; + orthoCamera.position.copy(camera.position); + orthoCamera.rotation.copy(camera.rotation); + orthoCamera.updateProjectionMatrix(); +} + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color('#454e61'); + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 5000); + orthoCamera = new THREE.OrthographicCamera(); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + + renderer.shadowMap.enabled = params.shadows; + + renderer.inspector = new Inspector(); + + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI / 2; + camera.position.set(60, 60, 0); + controls.target = new THREE.Vector3(-100, 10, 0); + controls.update(); + + const ambientLight = new THREE.AmbientLight(0xffffff, 1.5); + scene.add(ambientLight); + + const additionalDirectionalLight = new THREE.DirectionalLight(0x000020, 1.5); + additionalDirectionalLight.position + .set(params.lightX, params.lightY, params.lightZ) + .normalize() + .multiplyScalar(-200); + scene.add(additionalDirectionalLight); + + csmDirectionalLight = new THREE.DirectionalLight(0xffffff, 3.0); + + csmDirectionalLight.castShadow = true; + csmDirectionalLight.shadow.mapSize.width = 2048; + csmDirectionalLight.shadow.mapSize.height = 2048; + csmDirectionalLight.shadow.camera.near = params.shadowNear; + csmDirectionalLight.shadow.camera.far = params.shadowFar; + csmDirectionalLight.shadow.camera.top = 1000; + csmDirectionalLight.shadow.camera.bottom = -1000; + csmDirectionalLight.shadow.camera.left = -1000; + csmDirectionalLight.shadow.camera.right = 1000; + + csm = new CSMShadowNode(csmDirectionalLight, { cascades: 4, maxFar: params.maxFar, mode: params.mode }); + + csmDirectionalLight.position.set(params.lightX, params.lightY, params.lightZ).normalize().multiplyScalar(-200); + + csmDirectionalLight.shadow.shadowNode = csm; + + scene.add(csmDirectionalLight); + + csmHelper = new CSMHelper(csm); + csmHelper.visible = false; + scene.add(csmHelper); + + const floorMaterial = new THREE.MeshPhongMaterial({ color: '#252a34' }); + + const floor = new THREE.Mesh(new THREE.PlaneGeometry(10000, 10000, 8, 8), floorMaterial); + floor.rotation.x = -Math.PI / 2; + floor.castShadow = true; + floor.receiveShadow = true; + scene.add(floor); + + const material1 = new THREE.MeshPhongMaterial({ color: '#08d9d6' }); + + const material2 = new THREE.MeshPhongMaterial({ color: '#ff2e63' }); + + const geometry = new THREE.BoxGeometry(10, 10, 10); + + for (let i = 0; i < 40; i++) { + const cube1 = new THREE.Mesh(geometry, i % 2 === 0 ? material1 : material2); + cube1.castShadow = true; + cube1.receiveShadow = true; + scene.add(cube1); + cube1.position.set(-i * 25, 20, 30); + cube1.scale.y = Math.random() * 2 + 6; + + const cube2 = new THREE.Mesh(geometry, i % 2 === 0 ? material2 : material1); + cube2.castShadow = true; + cube2.receiveShadow = true; + scene.add(cube2); + cube2.position.set(-i * 25, 20, -30); + cube2.scale.y = Math.random() * 2 + 6; + } + + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(params, 'orthographic').onChange(function (value) { + csm.camera = value ? orthoCamera : camera; + csm.updateFrustums(); + }); + + // gui.add( params, 'fade' ).onChange( function ( value ) { + + // csm.fade = value; + // csm.updateFrustums(); + // TODO: Changing "fade" requires toggling shadows right now + + // } ); + + gui.add(params, 'shadows').onChange(function (value) { + csmDirectionalLight.castShadow = value; + }); + + gui.add(params, 'maxFar', 1, 5000, 1) + .name('max shadow far') + .onChange(function (value) { + csm.maxFar = value; + csm.updateFrustums(); + }); + + gui.add(params, 'mode', ['uniform', 'logarithmic', 'practical']) + .name('frustum split mode') + .onChange(function (value) { + csm.mode = value; + csm.updateFrustums(); + }); + + gui.add(params, 'lightX', -1, 1) + .name('light direction x') + .onChange(function () { + csmDirectionalLight.position + .set(params.lightX, params.lightY, params.lightZ) + .normalize() + .multiplyScalar(-200); + }); + + gui.add(params, 'lightY', -1, 1) + .name('light direction y') + .onChange(function () { + csmDirectionalLight.position + .set(params.lightX, params.lightY, params.lightZ) + .normalize() + .multiplyScalar(-200); + }); + + gui.add(params, 'lightZ', -1, 1) + .name('light direction z') + .onChange(function () { + csmDirectionalLight.position + .set(params.lightX, params.lightY, params.lightZ) + .normalize() + .multiplyScalar(-200); + }); + + gui.add(params, 'margin', 0, 200) + .name('light margin') + .onChange(function (value) { + csm.lightMargin = value; + }); + + gui.add(params, 'shadowNear', 1, 10000) + .name('shadow near') + .onChange(function (value) { + for (let i = 0; i < csm.lights.length; i++) { + csm.lights[i].shadow.camera.near = value; + csm.lights[i].shadow.camera.updateProjectionMatrix(); + } + }); + + gui.add(params, 'shadowFar', 1, 10000) + .name('shadow far') + .onChange(function (value) { + for (let i = 0; i < csm.lights.length; i++) { + csm.lights[i].shadow.camera.far = value; + csm.lights[i].shadow.camera.updateProjectionMatrix(); + } + }); + + const helperFolder = gui.addFolder('helper'); + + helperFolder.add(csmHelper, 'visible'); + + helperFolder.add(csmHelper, 'displayFrustum').onChange(function () { + csmHelper.updateVisibility(); + }); + + helperFolder.add(csmHelper, 'displayPlanes').onChange(function () { + csmHelper.updateVisibility(); + }); + + helperFolder.add(csmHelper, 'displayShadowBounds').onChange(function () { + csmHelper.updateVisibility(); + }); + + helperFolder.add(params, 'autoUpdateHelper').name('auto update'); + + helperFolder.add(params, 'updateHelper').name('update'); + + window.addEventListener('resize', function () { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + updateOrthoCamera(); + csm.updateFrustums(); + + renderer.setSize(window.innerWidth, window.innerHeight); + }); +} + +function animate() { + camera.updateMatrixWorld(); + controls.update(); + + if (params.orthographic) { + updateOrthoCamera(); + csm.updateFrustums(); + + if (params.autoUpdateHelper) { + csmHelper.update(); + } + + renderer.render(scene, orthoCamera); + } else { + if (params.autoUpdateHelper) { + csmHelper.update(); + } + + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgpu_shadowmap_opacity.ts b/examples-testing/examples/webgpu_shadowmap_opacity.ts new file mode 100644 index 000000000..e508e1039 --- /dev/null +++ b/examples-testing/examples/webgpu_shadowmap_opacity.ts @@ -0,0 +1,117 @@ +import * as THREE from 'three/webgpu'; +import { Fn, mix } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 40); + camera.position.set(-4, 2, 6); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + renderer.toneMapping = THREE.AgXToneMapping; + renderer.toneMappingExposure = 1.5; + renderer.shadowMap.enabled = true; + renderer.shadowMap.transmitted = true; + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x9e9eff); + + // light + shadow + + const hemi = new THREE.AmbientLight(0xffffff, 0.5); + scene.add(hemi); + + const dirLight = new THREE.DirectionalLight(0x6666ff, 10); + dirLight.position.set(3, 5, 17); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = 50; + dirLight.shadow.camera.right = 5; + dirLight.shadow.camera.left = -5; + dirLight.shadow.camera.top = 5; + dirLight.shadow.camera.bottom = -5; + dirLight.shadow.mapSize.width = 2048; + dirLight.shadow.mapSize.height = 2048; + dirLight.shadow.radius = 4; + + dirLight.shadow.autoUpdate = false; + dirLight.shadow.needsUpdate = true; + + scene.add(dirLight); + + // + + const loader = new GLTFLoader(); + const gltf = await loader.loadAsync('models/gltf/DragonAttenuation.glb'); + gltf.scene.position.set(0, 0, -0.5); + + const floor = gltf.scene.children[0]; + floor.scale.x += 4; + floor.scale.y += 4; + + const dragon = gltf.scene.children[1]; + dragon.position.set(-1.5, -0.8, 1); + + const dragon2 = dragon.clone(); + dragon2.material = dragon.material.clone(); + dragon2.material.attenuationColor = new THREE.Color(0xff0000); + dragon2.position.x += 4; + gltf.scene.add(dragon2); + + // shadow node + + const customShadow = Fn(([color, opacity = 1]) => { + //return vec4( color, opacity ); // opacity by blending + return mix(1, color, opacity); // opacity by color + }); + + // apply shadow + + floor.receiveShadow = true; + + dragon.castShadow = dragon2.castShadow = true; + dragon.receiveShadow = dragon2.receiveShadow = true; + + dragon.material.castShadowNode = customShadow(dragon.material.attenuationColor); + dragon2.material.castShadowNode = customShadow(dragon2.material.attenuationColor); + + // + + scene.add(gltf.scene); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 0.1; + controls.maxDistance = 10; + controls.target.set(0, 0, 0); + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_shadowmap_pointlight.ts b/examples-testing/examples/webgpu_shadowmap_pointlight.ts new file mode 100644 index 000000000..a528d261c --- /dev/null +++ b/examples-testing/examples/webgpu_shadowmap_pointlight.ts @@ -0,0 +1,139 @@ +import * as THREE from 'three'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer; +let pointLight, pointLight2; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 10, 40); + + scene = new THREE.Scene(); + scene.add(new THREE.AmbientLight(0x111122, 3)); + + // lights + + function createLight(color) { + const intensity = 200; + + const light = new THREE.PointLight(color, intensity, 20); + light.castShadow = true; + light.shadow.bias = -0.005; // reduces self-shadowing on double-sided objects + light.shadow.mapSize.setScalar(128); + light.shadow.radius = 10; + + let geometry = new THREE.SphereGeometry(0.3, 12, 6); + let material = new THREE.MeshBasicMaterial({ color: color }); + material.color.multiplyScalar(intensity); + let sphere = new THREE.Mesh(geometry, material); + light.add(sphere); + + const texture = new THREE.CanvasTexture(generateTexture()); + texture.magFilter = THREE.NearestFilter; + texture.wrapT = THREE.RepeatWrapping; + texture.wrapS = THREE.RepeatWrapping; + texture.repeat.set(1, 4.5); + + geometry = new THREE.SphereGeometry(2, 32, 8); + material = new THREE.MeshPhongNodeMaterial({ + side: THREE.DoubleSide, + alphaMap: texture, + alphaTest: 0.5, + }); + + sphere = new THREE.Mesh(geometry, material); + sphere.castShadow = true; + sphere.receiveShadow = true; + light.add(sphere); + + return light; + } + + pointLight = createLight(0x0088ff); + scene.add(pointLight); + + pointLight2 = createLight(0xff8888); + scene.add(pointLight2); + // + + const geometry = new THREE.BoxGeometry(30, 30, 30); + + const material = new THREE.MeshPhongNodeMaterial({ + color: 0xa0adaf, + shininess: 10, + specular: 0x111111, + side: THREE.BackSide, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.position.y = 10; + mesh.receiveShadow = true; + scene.add(mesh); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + // renderer.shadowMap.type = THREE.BasicShadowMap; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 10, 0); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function generateTexture() { + const canvas = document.createElement('canvas'); + canvas.width = 2; + canvas.height = 2; + + const context = canvas.getContext('2d'); + context.fillStyle = 'white'; + context.fillRect(0, 1, 2, 1); + + return canvas; +} + +function animate() { + let time = performance.now() * 0.001; + + pointLight.position.x = Math.sin(time * 0.6) * 9; + pointLight.position.y = Math.sin(time * 0.7) * 9 + 6; + pointLight.position.z = Math.sin(time * 0.8) * 9; + + pointLight.rotation.x = time; + pointLight.rotation.z = time; + + time += 10000; + + pointLight2.position.x = Math.sin(time * 0.6) * 9; + pointLight2.position.y = Math.sin(time * 0.7) * 9 + 6; + pointLight2.position.z = Math.sin(time * 0.8) * 9; + + pointLight2.rotation.x = time; + pointLight2.rotation.z = time; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_shadowmap_progressive.ts b/examples-testing/examples/webgpu_shadowmap_progressive.ts new file mode 100644 index 000000000..ca5ee0f72 --- /dev/null +++ b/examples-testing/examples/webgpu_shadowmap_progressive.ts @@ -0,0 +1,203 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { TransformControls } from 'three/addons/controls/TransformControls.js'; +import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMapGPU.js'; + +// ShadowMap + LightMap Res and Number of Directional Lights +const shadowMapRes = 1024, + lightMapRes = 1024, + lightCount = 4; +let camera, + scene, + renderer, + controls, + control, + control2, + object = new THREE.Mesh(), + lightOrigin = null, + progressiveSurfacemap; +const dirLights = [], + lightmapObjects = []; +const params = { + Enable: true, + 'Blur Edges': true, + 'Blend Window': 200, + 'Light Radius': 50, + 'Ambient Weight': 0.5, + 'Debug Lightmap': false, +}; +init(); +createGUI(); + +function init() { + // renderer + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // camera + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 100, 200); + camera.name = 'Camera'; + + // scene + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x949494); + scene.fog = new THREE.Fog(0x949494, 1000, 3000); + + // progressive lightmap + progressiveSurfacemap = new ProgressiveLightMap(renderer, lightMapRes); + + // directional lighting "origin" + lightOrigin = new THREE.Group(); + lightOrigin.position.set(60, 150, 100); + scene.add(lightOrigin); + + // transform gizmo + control = new TransformControls(camera, renderer.domElement); + control.addEventListener('dragging-changed', event => { + controls.enabled = !event.value; + }); + control.attach(lightOrigin); + scene.add(control.getHelper()); + + // create 8 directional lights to speed up the convergence + for (let l = 0; l < lightCount; l++) { + const dirLight = new THREE.DirectionalLight(0xffffff, Math.PI / lightCount); + dirLight.name = 'Dir. Light ' + l; + dirLight.position.set(200, 200, 200); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 100; + dirLight.shadow.camera.far = 5000; + dirLight.shadow.camera.right = 150; + dirLight.shadow.camera.left = -150; + dirLight.shadow.camera.top = 150; + dirLight.shadow.camera.bottom = -150; + dirLight.shadow.mapSize.width = shadowMapRes; + dirLight.shadow.mapSize.height = shadowMapRes; + lightmapObjects.push(dirLight); + dirLights.push(dirLight); + } + + // ground + const groundMesh = new THREE.Mesh( + new THREE.PlaneGeometry(600, 600), + new THREE.MeshPhongMaterial({ color: 0xffffff, depthWrite: true }), + ); + groundMesh.position.y = -0.1; + groundMesh.rotation.x = -Math.PI / 2; + groundMesh.name = 'Ground Mesh'; + lightmapObjects.push(groundMesh); + scene.add(groundMesh); + + // model + function loadModel() { + object.traverse(function (child) { + if (child.isMesh) { + child.name = 'Loaded Mesh'; + child.castShadow = true; + child.receiveShadow = true; + child.material = new THREE.MeshPhongMaterial(); + + // This adds the model to the lightmap + lightmapObjects.push(child); + progressiveSurfacemap.addObjectsToLightMap(lightmapObjects); + } else { + child.layers.disableAll(); // Disable Rendering for this + } + }); + scene.add(object); + object.scale.set(2, 2, 2); + object.position.set(0, -16, 0); + control2 = new TransformControls(camera, renderer.domElement); + control2.addEventListener('dragging-changed', event => { + controls.enabled = !event.value; + }); + control2.attach(object); + scene.add(control2.getHelper()); + const lightTarget = new THREE.Group(); + lightTarget.position.set(0, 20, 0); + for (let l = 0; l < dirLights.length; l++) { + dirLights[l].target = lightTarget; + } + + object.add(lightTarget); + } + + const manager = new THREE.LoadingManager(loadModel); + const loader = new GLTFLoader(manager); + loader.load('models/gltf/ShadowmappableMesh.glb', function (obj) { + object = obj.scene.children[0]; + }); + + // controls + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled + controls.dampingFactor = 0.05; + controls.screenSpacePanning = true; + controls.minDistance = 100; + controls.maxDistance = 500; + controls.maxPolarAngle = Math.PI / 1.5; + controls.target.set(0, 100, 0); + + window.addEventListener('resize', onWindowResize); +} + +function createGUI() { + const gui = renderer.inspector.createParameters('Accumulation Settings'); + gui.add(params, 'Enable'); + gui.add(params, 'Blur Edges'); + gui.add(params, 'Blend Window', 1, 500, 1); + gui.add(params, 'Light Radius', 0, 200, 10); + gui.add(params, 'Ambient Weight', 0, 1, 0.1); + gui.add(params, 'Debug Lightmap').onChange(value => progressiveSurfacemap.showDebugLightmap(value)); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + // Update the inertia on the orbit controls + controls.update(); + + // Accumulate Surface Maps + if (params['Enable']) { + progressiveSurfacemap.update(camera, params['Blend Window'], params['Blur Edges']); + } + + // Manually Update the Directional Lights + for (let l = 0; l < dirLights.length; l++) { + // Sometimes they will be sampled from the target direction + // Sometimes they will be uniformly sampled from the upper hemisphere + if (Math.random() > params['Ambient Weight']) { + dirLights[l].position.set( + lightOrigin.position.x + Math.random() * params['Light Radius'], + lightOrigin.position.y + Math.random() * params['Light Radius'], + lightOrigin.position.z + Math.random() * params['Light Radius'], + ); + } else { + // Uniform Hemispherical Surface Distribution for Ambient Occlusion + const lambda = Math.acos(2 * Math.random() - 1) - 3.14159 / 2.0; + const phi = 2 * 3.14159 * Math.random(); + dirLights[l].position.set( + Math.cos(lambda) * Math.cos(phi) * 300 + object.position.x, + Math.abs(Math.cos(lambda) * Math.sin(phi) * 300) + object.position.y + 20, + Math.sin(lambda) * 300 + object.position.z, + ); + } + } + + // Render Scene + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_shadowmap_vsm.ts b/examples-testing/examples/webgpu_shadowmap_vsm.ts new file mode 100644 index 000000000..edaf4fd9e --- /dev/null +++ b/examples-testing/examples/webgpu_shadowmap_vsm.ts @@ -0,0 +1,197 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, timer; +let dirLight, spotLight; +let torusKnot, dirGroup; + +const config = { + spotlightRadius: 4, + spotlightSamples: 8, + dirlightRadius: 4, + dirlightSamples: 8, + animate: true, +}; + +init(); + +function init() { + initScene(); + initMisc(); + + // Init gui + const gui = renderer.inspector.createParameters('Settings'); + + const spotlightFolder = gui.addFolder('Spotlight'); + spotlightFolder + .add(config, 'spotlightRadius', 0, 25) + .name('radius') + .onChange(function (value) { + spotLight.shadow.radius = value; + }); + + spotlightFolder + .add(config, 'spotlightSamples', 1, 25, 1) + .name('samples') + .onChange(function (value) { + spotLight.shadow.blurSamples = value; + }); + + const dirlightFolder = gui.addFolder('Directional Light'); + dirlightFolder + .add(config, 'dirlightRadius', 0, 25) + .name('radius') + .onChange(function (value) { + dirLight.shadow.radius = value; + }); + + dirlightFolder + .add(config, 'dirlightSamples', 1, 25, 1) + .name('samples') + .onChange(function (value) { + dirLight.shadow.blurSamples = value; + }); + + gui.add(config, 'animate'); + + document.body.appendChild(renderer.domElement); + window.addEventListener('resize', onWindowResize); +} + +function initScene() { + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); + camera.position.set(0, 10, 30); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x222244); + scene.fog = new THREE.Fog(0x222244, 50, 100); + + // Lights + + scene.add(new THREE.AmbientLight(0x444444)); + + spotLight = new THREE.SpotLight(0xff8888, 400); + spotLight.angle = Math.PI / 5; + spotLight.penumbra = 0.3; + spotLight.position.set(8, 10, 5); + spotLight.castShadow = true; + spotLight.shadow.camera.near = 8; + spotLight.shadow.camera.far = 200; + spotLight.shadow.mapSize.width = 256; + spotLight.shadow.mapSize.height = 256; + spotLight.shadow.bias = -0.002; + spotLight.shadow.radius = 4; + scene.add(spotLight); + + dirLight = new THREE.DirectionalLight(0x8888ff, 3); + dirLight.position.set(3, 12, 17); + dirLight.castShadow = true; + dirLight.shadow.camera.near = 0.1; + dirLight.shadow.camera.far = 500; + dirLight.shadow.camera.right = 17; + dirLight.shadow.camera.left = -17; + dirLight.shadow.camera.top = 17; + dirLight.shadow.camera.bottom = -17; + dirLight.shadow.mapSize.width = 512; + dirLight.shadow.mapSize.height = 512; + dirLight.shadow.radius = 4; + dirLight.shadow.bias = -0.0005; + + dirGroup = new THREE.Group(); + dirGroup.add(dirLight); + scene.add(dirGroup); + + // Geometry + + const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 20); + const material = new THREE.MeshPhongMaterial({ + color: 0x999999, + shininess: 0, + specular: 0x222222, + }); + + torusKnot = new THREE.Mesh(geometry, material); + torusKnot.scale.multiplyScalar(1 / 18); + torusKnot.position.y = 3; + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); + + const pillar1 = new THREE.Mesh(cylinderGeometry, material); + pillar1.position.set(8, 3.5, 8); + pillar1.castShadow = true; + pillar1.receiveShadow = true; + + const pillar2 = pillar1.clone(); + pillar2.position.set(8, 3.5, -8); + const pillar3 = pillar1.clone(); + pillar3.position.set(-8, 3.5, 8); + const pillar4 = pillar1.clone(); + pillar4.position.set(-8, 3.5, -8); + + scene.add(pillar1); + scene.add(pillar2); + scene.add(pillar3); + scene.add(pillar4); + + const planeGeometry = new THREE.PlaneGeometry(200, 200); + const planeMaterial = new THREE.MeshPhongMaterial({ + color: 0x999999, + shininess: 0, + specular: 0x111111, + }); + + const ground = new THREE.Mesh(planeGeometry, planeMaterial); + ground.rotation.x = -Math.PI / 2; + ground.scale.multiplyScalar(3); + ground.castShadow = true; + ground.receiveShadow = true; + scene.add(ground); +} + +function initMisc() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.VSMShadowMap; + + // Mouse control + const controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 2, 0); + controls.update(); + + timer = new THREE.Timer(); + timer.connect(document); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate(time) { + timer.update(); + + const delta = timer.getDelta(); + + if (config.animate === true) { + torusKnot.rotation.x += 0.25 * delta; + torusKnot.rotation.y += 0.5 * delta; + torusKnot.rotation.z += 1 * delta; + + dirGroup.rotation.y += 0.7 * delta; + dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_skinning.ts b/examples-testing/examples/webgpu_skinning.ts new file mode 100644 index 000000000..36669a5d4 --- /dev/null +++ b/examples-testing/examples/webgpu_skinning.ts @@ -0,0 +1,72 @@ +import * as THREE from 'three/webgpu'; +import { color, screenUV } from 'three/tsl'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer; + +let mixer, timer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); + camera.position.set(1, 2, 3); + + scene = new THREE.Scene(); + scene.backgroundNode = screenUV.y.mix(color(0x66bbff), color(0x4466ff)); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + //lights + + const light = new THREE.PointLight(0xffffff, 1, 100); + light.power = 2500; + camera.add(light); + scene.add(camera); + + const ambient = new THREE.AmbientLight(0x4466ff, 1); + scene.add(ambient); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Michelle.glb', function (gltf) { + const object = gltf.scene; + mixer = new THREE.AnimationMixer(object); + + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + scene.add(object); + }); + + //renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.LinearToneMapping; + renderer.toneMappingExposure = 0.4; + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_skinning_instancing.ts b/examples-testing/examples/webgpu_skinning_instancing.ts new file mode 100644 index 000000000..877ee46cb --- /dev/null +++ b/examples-testing/examples/webgpu_skinning_instancing.ts @@ -0,0 +1,128 @@ +import * as THREE from 'three/webgpu'; +import { pass, mix, range, color, oscSine, time } from 'three/tsl'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer; +let renderPipeline; + +let mixer, timer; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 40); + camera.position.set(1, 2, 3); + + scene = new THREE.Scene(); + camera.lookAt(0, 1, 0); + + timer = new THREE.Timer(); + timer.connect(document); + + // lights + + const centerLight = new THREE.PointLight(0xff9900, 1, 100); + centerLight.position.y = 4.5; + centerLight.position.z = -2; + centerLight.power = 400; + scene.add(centerLight); + + const cameraLight = new THREE.PointLight(0x0099ff, 1, 100); + cameraLight.power = 400; + camera.add(cameraLight); + scene.add(camera); + + const geometry = new THREE.PlaneGeometry(1000, 1000); + geometry.rotateX(-Math.PI / 2); + + const plane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000, visible: true })); + scene.add(plane); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Michelle.glb', function (gltf) { + const object = gltf.scene; + + mixer = new THREE.AnimationMixer(object); + + const action = mixer.clipAction(gltf.animations[0]); + action.play(); + + const instanceCount = 30; + const dummy = new THREE.Object3D(); + + object.traverse(child => { + if (child.isMesh) { + const oscNode = oscSine(time.mul(0.1)); + + // random colors between instances from 0x000000 to 0xFFFFFF + const randomColors = range(new THREE.Color(0x000000), new THREE.Color(0xffffff)); + + // random [ 0, 1 ] values between instances + const randomMetalness = range(0, 1); + + child.material = new THREE.MeshStandardNodeMaterial(); + child.material.roughness = 0.1; + child.material.metalnessNode = mix(0.0, randomMetalness, oscNode); + child.material.colorNode = mix(color(0xffffff), randomColors, oscNode); + + child.isInstancedMesh = true; + child.instanceMatrix = new THREE.InstancedBufferAttribute(new Float32Array(instanceCount * 16), 16); + child.count = instanceCount; + + for (let i = 0; i < instanceCount; i++) { + dummy.position.x = -200 + (i % 5) * 70; + dummy.position.y = Math.floor(i / 5) * -200; + + dummy.updateMatrix(); + + dummy.matrix.toArray(child.instanceMatrix.array, i * 16); + } + } + }); + + scene.add(object); + }); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // post processing + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode(); + const scenePassDepth = scenePass.getLinearDepthNode().remapClamp(0.15, 0.3); + + const scenePassColorBlurred = gaussianBlur(scenePassColor); + scenePassColorBlurred.directionNode = scenePassDepth; + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputNode = scenePassColorBlurred; + + // events + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) mixer.update(delta); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_skinning_instancing_individual.ts b/examples-testing/examples/webgpu_skinning_instancing_individual.ts new file mode 100644 index 000000000..2abb7022e --- /dev/null +++ b/examples-testing/examples/webgpu_skinning_instancing_individual.ts @@ -0,0 +1,431 @@ +import * as THREE from 'three/webgpu'; +import { + Fn, + add, + attributeArray, + color, + instanceIndex, + screenUV, + storage, + transformNormal, + transformNormalToView, + uint, + uniform, + vec4, + vertexIndex, + mat3, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let camera, scene, renderer, controls; +let mixer, timer, animatedObject, proportionBones, referenceMesh, footBones, groundFoot, dummy; +let instanceMatrices, instanceMatricesNode, bellyWeightsNode; +let computeSkinning; + +const skeletonStates = new Map(); +const timeOffsets = []; +const variations = []; +const leftFoot = new THREE.Vector3(); +const rightFoot = new THREE.Vector3(); + +init(); + +function createSourceVertexAttribute(geometry) { + const position = geometry.getAttribute('position'); + const normal = geometry.getAttribute('normal'); + const bellyPosition = position.clone(); + const data = new Float32Array(position.count * 12); + + for (let i = 0; i < position.count; i++) { + const amount = Math.max(0, 1 - Math.abs(position.getY(i) - 0.94) / 0.3) * 0.8; + + bellyPosition.setXYZ(i, position.getX(i) * amount, 0, position.getZ(i) * amount); + + const offset = i * 12; + + data[offset + 0] = position.getX(i); + data[offset + 1] = position.getY(i); + data[offset + 2] = position.getZ(i); + data[offset + 4] = normal.getX(i); + data[offset + 5] = normal.getY(i); + data[offset + 6] = normal.getZ(i); + data[offset + 8] = bellyPosition.getX(i); + data[offset + 9] = bellyPosition.getY(i); + data[offset + 10] = bellyPosition.getZ(i); + } + + return new THREE.StorageBufferAttribute(data, 4); +} + +function getSkeletonState(skeleton, instanceCount) { + let state = skeletonStates.get(skeleton); + + if (state === undefined) { + const boneCount = skeleton.bones.length; + const boneMatrices = new THREE.StorageBufferAttribute(instanceCount * boneCount, 16); + + state = { + skeleton, + boneCount, + boneMatrices, + boneMatricesNode: storage(boneMatrices, 'mat4', boneMatrices.count).toReadOnly(), + }; + + skeletonStates.set(skeleton, state); + } + + return state; +} + +function createComputedMesh(source, instanceCount) { + const geometry = source.geometry.clone(); + const material = source.material.clone(); + const vertexCount = geometry.getAttribute('position').count; + const skeletonState = getSkeletonState(source.skeleton, instanceCount); + + const sourceVertices = storage(createSourceVertexAttribute(geometry), 'vec4', vertexCount * 3).toReadOnly(); + const skinIndices = storage( + new THREE.StorageBufferAttribute(new Uint32Array(geometry.getAttribute('skinIndex').array), 4), + 'uvec4', + vertexCount, + ).toReadOnly(); + const skinWeights = storage( + new THREE.StorageBufferAttribute(geometry.getAttribute('skinWeight').array, 4), + 'vec4', + vertexCount, + ).toReadOnly(); + const bindMatrix = uniform(source.bindMatrix, 'mat4'); + const bindMatrixInverse = uniform(source.bindMatrixInverse, 'mat4'); + const vertices = attributeArray(instanceCount * vertexCount * 2, 'vec4'); + + computeSkinning = Fn(() => { + const sourceVertex = instanceIndex.mod(uint(vertexCount)); + const meshInstance = instanceIndex.div(uint(vertexCount)); + const sourceOffset = sourceVertex.mul(uint(3)); + const targetOffset = instanceIndex.mul(uint(2)); + const boneOffset = meshInstance.mul(uint(skeletonState.boneCount)); + const skinIndex = skinIndices.element(sourceVertex); + const skinWeight = skinWeights.element(sourceVertex); + const morphPosition = sourceVertices + .element(sourceOffset) + .xyz.add(sourceVertices.element(sourceOffset.add(uint(2))).xyz.mul(bellyWeightsNode.element(meshInstance))); + const skinVertex = bindMatrix.mul(morphPosition); + const boneMatX = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.x)); + const boneMatY = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.y)); + const boneMatZ = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.z)); + const boneMatW = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.w)); + const skinMatrix = add( + skinWeight.x.mul(boneMatX), + skinWeight.y.mul(boneMatY), + skinWeight.z.mul(boneMatZ), + skinWeight.w.mul(boneMatW), + ); + const skinPosition = bindMatrixInverse.mul( + add( + boneMatX.mul(skinWeight.x).mul(skinVertex), + boneMatY.mul(skinWeight.y).mul(skinVertex), + boneMatZ.mul(skinWeight.z).mul(skinVertex), + boneMatW.mul(skinWeight.w).mul(skinVertex), + ), + ).xyz; + + const skinMatrix3 = mat3(bindMatrixInverse.mul(skinMatrix).mul(bindMatrix)); + const skinNormal = skinMatrix3.mul(sourceVertices.element(sourceOffset.add(uint(1))).xyz); + const instanceMatrix = instanceMatricesNode.element(meshInstance); + + vertices.element(targetOffset).assign(vec4(instanceMatrix.mul(skinPosition).xyz, 1)); + vertices.element(targetOffset.add(uint(1))).assign(vec4(transformNormal(skinNormal, instanceMatrix), 0)); + })() + .compute(instanceCount * vertexCount) + .setName('Compute Instanced Skinning'); + + const meshVertex = instanceIndex.mul(uint(vertexCount)).add(vertexIndex).mul(uint(2)); + + material.positionNode = vertices.element(meshVertex).xyz; + material.normalNode = transformNormalToView(vertices.element(meshVertex.add(uint(1))).xyz).toVarying(); + + const mesh = new THREE.Mesh(geometry, material); + mesh.count = instanceCount; + mesh.castShadow = true; + mesh.frustumCulled = false; + + source.parent.add(mesh); + source.visible = false; +} + +async function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 60); + camera.position.set(4.6, 3.3, 6.2); + + scene = new THREE.Scene(); + scene.backgroundNode = screenUV.y.mix(color(0x8f989c), color(0xe7eaeb)); + + timer = new THREE.Timer(); + timer.connect(document); + + scene.add(new THREE.HemisphereLight(0xffffff, 0x939b9e, 1.2)); + + const directionalLight = new THREE.DirectionalLight(0xfffbf4, 2.8); + directionalLight.position.set(-4, 10, 8); + directionalLight.castShadow = true; + directionalLight.shadow.mapSize.set(2048, 2048); + directionalLight.shadow.camera.left = -5; + directionalLight.shadow.camera.right = 5; + directionalLight.shadow.camera.top = 5; + directionalLight.shadow.camera.bottom = -5; + directionalLight.shadow.camera.near = 0.1; + directionalLight.shadow.camera.far = 30; + directionalLight.shadow.camera.updateProjectionMatrix(); + scene.add(directionalLight); + + const rimLight = new THREE.DirectionalLight(0xe8f4ff, 0.85); + rimLight.position.set(7, 5, -5); + scene.add(rimLight); + + const ground = new THREE.Mesh( + new THREE.PlaneGeometry(400, 400), + new THREE.ShadowMaterial({ color: 0x5d6568, opacity: 0.3 }), + ); + + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + new GLTFLoader().load('models/gltf/Michelle.glb', function (gltf) { + const object = gltf.scene; + const instanceCount = 30; + const duration = gltf.animations[0].duration; + const skinnedMeshes = []; + + dummy = new THREE.Object3D(); + animatedObject = object; + mixer = new THREE.AnimationMixer(object); + mixer.clipAction(gltf.animations[0]).play(); + + object.traverse(child => { + if (child.isSkinnedMesh === true) skinnedMeshes.push(child); + }); + + referenceMesh = skinnedMeshes[0]; + const skeleton = referenceMesh.skeleton; + const getBone = name => skeleton.bones.find(bone => bone.name.endsWith(name)); + const proportionTargets = [ + getBone('Head'), + getBone('Spine'), + getBone('Spine2'), + getBone('LeftArm'), + getBone('RightArm'), + getBone('LeftForeArm'), + getBone('RightForeArm'), + getBone('LeftUpLeg'), + getBone('RightUpLeg'), + getBone('LeftLeg'), + getBone('RightLeg'), + ]; + + proportionBones = { + head: proportionTargets[0], + belly: proportionTargets[1], + chest: proportionTargets[2], + arms: proportionTargets.slice(3, 7), + legs: proportionTargets.slice(7), + baseScales: proportionTargets.map(bone => bone.scale.clone()), + }; + footBones = [getBone('LeftFoot'), getBone('RightFoot')]; + + const bodyTypes = [ + { + width: 0.92, + height: 1.09, + depth: 0.92, + belly: 0, + headScale: 0.96, + bellyWidth: 0.98, + chestWidth: 0.98, + armLength: 1.03, + legLength: 1.04, + }, + { + width: 1.0, + height: 1.05, + depth: 0.99, + belly: 0, + headScale: 0.98, + bellyWidth: 1.0, + chestWidth: 1.03, + armLength: 1.02, + legLength: 1.02, + }, + { + width: 1.0, + height: 1.0, + depth: 1.0, + belly: 0, + headScale: 1.0, + bellyWidth: 1.0, + chestWidth: 1.0, + armLength: 1.0, + legLength: 1.0, + }, + { + width: 1.08, + height: 0.9, + depth: 1.1, + belly: 0.75, + headScale: 1.06, + bellyWidth: 1.12, + chestWidth: 1.0, + armLength: 0.9, + legLength: 0.9, + }, + { + width: 1.2, + height: 0.8, + depth: 1.22, + belly: 1.6, + headScale: 1.12, + bellyWidth: 1.24, + chestWidth: 1.04, + armLength: 0.72, + legLength: 0.7, + }, + ]; + + const bellyWeights = new THREE.StorageBufferAttribute(instanceCount, 1); + instanceMatrices = new THREE.StorageBufferAttribute(instanceCount, 16); + bellyWeightsNode = storage(bellyWeights, 'float', instanceCount).toReadOnly(); + instanceMatricesNode = storage(instanceMatrices, 'mat4', instanceCount).toReadOnly(); + + for (let i = 0; i < instanceCount; i++) { + const bodyType = bodyTypes[i % bodyTypes.length]; + const isChild = i % 2 === 0; + const size = isChild ? (i % 4 === 0 ? 0.68 : 0.78) : 1; + const innerRing = i < 10; + const ringIndex = innerRing ? i : i - 10; + const ringCount = innerRing ? 10 : 20; + const angle = (ringIndex / ringCount) * Math.PI * 2; + const radius = innerRing ? 175 : 340; + + timeOffsets.push((duration * i) / instanceCount); + variations.push({ + ...bodyType, + size, + x: Math.sin(angle) * radius, + y: Math.cos(angle) * radius, + }); + bellyWeights.array[i] = bodyType.belly; + } + + bellyWeights.needsUpdate = true; + animatedObject.updateMatrixWorld(true); + skeleton.update(); + groundFoot = getFootCoordinate(); + + for (const child of skinnedMeshes) createComputedMesh(child, instanceCount); + + scene.add(object); + }); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 0.96; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + await renderer.init(); + scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture; + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0.75, 0); + controls.enableDamping = true; + controls.minDistance = 3; + controls.maxDistance = 25; + controls.maxPolarAngle = Math.PI / 2; + controls.update(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function applyProportions(variation) { + const { head, belly, chest, arms, legs, baseScales } = proportionBones; + const bones = [head, belly, chest, ...arms, ...legs]; + + for (let i = 0; i < bones.length; i++) bones[i].scale.copy(baseScales[i]); + + head.scale.multiplyScalar(variation.headScale); + belly.scale.x *= variation.bellyWidth; + belly.scale.z *= variation.bellyWidth; + chest.scale.x *= variation.chestWidth; + chest.scale.z *= variation.chestWidth; + + for (const bone of arms) bone.scale.y *= variation.armLength; + for (const bone of legs) bone.scale.y *= variation.legLength; +} + +function getFootCoordinate() { + footBones[0].getWorldPosition(leftFoot); + footBones[1].getWorldPosition(rightFoot); + referenceMesh.worldToLocal(leftFoot); + referenceMesh.worldToLocal(rightFoot); + + return Math.max(leftFoot.z, rightFoot.z); +} + +function updateInstanceMatrix(index, variation) { + const foot = getFootCoordinate(); + + dummy.position.set(variation.x, variation.y, groundFoot - foot * variation.height * variation.size); + dummy.scale.set(variation.width, variation.depth, variation.height).multiplyScalar(variation.size); + dummy.updateMatrix(); + dummy.matrix.toArray(instanceMatrices.array, index * 16); +} + +function animate() { + timer.update(); + controls.update(); + + if (mixer) { + const elapsed = timer.getElapsed(); + + for (let i = 0; i < timeOffsets.length; i++) { + mixer.setTime(elapsed + timeOffsets[i]); + applyProportions(variations[i]); + animatedObject.updateMatrixWorld(true); + + for (const state of skeletonStates.values()) { + state.skeleton.update(); + state.boneMatrices.array.set(state.skeleton.boneMatrices, i * state.boneCount * 16); + } + + updateInstanceMatrix(i, variations[i]); + } + + for (const state of skeletonStates.values()) state.boneMatrices.needsUpdate = true; + instanceMatrices.needsUpdate = true; + renderer.compute(computeSkinning); + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_sprites.ts b/examples-testing/examples/webgpu_sprites.ts new file mode 100644 index 000000000..1c2f7995c --- /dev/null +++ b/examples-testing/examples/webgpu_sprites.ts @@ -0,0 +1,103 @@ +import * as THREE from 'three/webgpu'; +import { texture, uv, userData, fog, rangeFogFactor, color } from 'three/tsl'; + +let camera, scene, renderer; + +let map; + +let group; + +let imageWidth = 1, + imageHeight = 1; + +init(); + +function init() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera = new THREE.PerspectiveCamera(60, width / height, 1, 2100); + camera.position.z = 1500; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + scene.fogNode = fog(color(0x0000ff), rangeFogFactor(1500, 2100)); + + // create sprites + + const amount = 200; + const radius = 500; + + const textureLoader = new THREE.TextureLoader(); + + map = textureLoader.load('textures/sprite1.png', map => { + imageWidth = map.image.width; + imageHeight = map.image.height; + }); + + group = new THREE.Group(); + + const textureNode = texture(map); + + const material = new THREE.SpriteNodeMaterial(); + material.colorNode = textureNode.mul(uv()).mul(2).saturate(); + material.opacityNode = textureNode.a; + material.rotationNode = userData('rotation', 'float'); // get value of: sprite.userData.rotation + + for (let a = 0; a < amount; a++) { + const x = Math.random() - 0.5; + const y = Math.random() - 0.5; + const z = Math.random() - 0.5; + + const sprite = new THREE.Sprite(material); + + sprite.position.set(x, y, z); + sprite.position.normalize(); + sprite.position.multiplyScalar(radius); + + // individual rotation per sprite + sprite.userData.rotation = 0; + + group.add(sprite); + } + + scene.add(group); + + // + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + const time = Date.now() / 1000; + + for (let i = 0, l = group.children.length; i < l; i++) { + const sprite = group.children[i]; + const scale = Math.sin(time + sprite.position.x * 0.01) * 0.3 + 1.0; + + sprite.userData.rotation += 0.1 * (i / l); + sprite.scale.set(scale * imageWidth, scale * imageHeight, 1.0); + } + + group.rotation.x = time * 0.5; + group.rotation.y = time * 0.75; + group.rotation.z = time * 1.0; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_storage_buffer.ts b/examples-testing/examples/webgpu_storage_buffer.ts new file mode 100644 index 000000000..1b4461d33 --- /dev/null +++ b/examples-testing/examples/webgpu_storage_buffer.ts @@ -0,0 +1,169 @@ +import * as THREE from 'three/webgpu'; +import { storage, If, vec3, uv, uint, float, Fn, instanceIndex, workgroupBarrier } from 'three/tsl'; + +const timestamps = { + webgpu: document.getElementById('timestamps'), + webgl: document.getElementById('timestamps_webgl'), +}; + +// WebGPU Backend +init(); + +// WebGL Backend +init(true); + +async function init(forceWebGL = false) { + const aspect = window.innerWidth / 2 / window.innerHeight; + const camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); + camera.position.z = 1; + + const scene = new THREE.Scene(); + + // texture + + const size = 32; // non power of two buffer size is not well supported in WebGPU + const barCount = 32; + + const type = ['float', 'vec2', 'vec3', 'vec4']; + + const arrayBufferNodes = []; + + for (let i = 0; i < type.length; i++) { + const typeSize = i + 1; + const array = new Array(size * typeSize).fill(0); + + const arrayBuffer = new THREE.StorageInstancedBufferAttribute(new Float32Array(array), typeSize); + + arrayBufferNodes.push(storage(arrayBuffer, type[i], size).setPBO(true)); + } + + const computeInitOrder = Fn(() => { + for (let i = 0; i < type.length; i++) { + arrayBufferNodes[i].element(instanceIndex).assign(instanceIndex); + } + }); + + const computeInvertOrder = Fn(() => { + for (let i = 0; i < type.length; i++) { + const invertIndex = arrayBufferNodes[i].element(uint(size - 1).sub(instanceIndex)).toVar(); + workgroupBarrier(); + arrayBufferNodes[i].element(instanceIndex).assign(invertIndex); + } + }); + + // compute + + const computeInit = computeInitOrder().compute(size); + + const compute = computeInvertOrder().compute(size); + + const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); + + material.colorNode = Fn(() => { + const index = uint(uv().x.mul(size).floor()).toVar(); + + If(index.greaterThanEqual(size), () => { + index.assign(uint(size).sub(1)); + }); + + const color = vec3(0, 0, 0).toVar(); + + If(uv().y.greaterThan(0.0), () => { + const indexValue = arrayBufferNodes[0].element(index).toVar(); + const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); + + color.assign(vec3(value, 0, 0)); + }); + + If(uv().y.greaterThan(0.25), () => { + const indexValue = arrayBufferNodes[1].element(index).toVar(); + const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); + + color.assign(vec3(0, value, 0)); + }); + + If(uv().y.greaterThan(0.5), () => { + const indexValue = arrayBufferNodes[2].element(index).toVar(); + const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); + + color.assign(vec3(0, 0, value)); + }); + + If(uv().y.greaterThan(0.75), () => { + const indexValue = arrayBufferNodes[3].element(index).toVar(); + const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); + + color.assign(vec3(value, value, value)); + }); + + return color; + })(); + + // + + const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + scene.add(plane); + + const renderer = new THREE.WebGPURenderer({ antialias: false, forceWebGL: forceWebGL, trackTimestamp: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth / 2, window.innerHeight); + + await renderer.init(); + + document.body.appendChild(renderer.domElement); + renderer.domElement.style.position = 'absolute'; + renderer.domElement.style.top = '0'; + renderer.domElement.style.left = '0'; + renderer.domElement.style.width = '50%'; + renderer.domElement.style.height = '100%'; + + if (forceWebGL) { + renderer.domElement.style.left = '50%'; + + scene.background = new THREE.Color(0x212121); + } else { + scene.background = new THREE.Color(0x313131); + } + + renderer.compute(computeInit); + + // + + renderer.info.autoReset = false; + + const stepAnimation = async function () { + renderer.info.reset(); + + renderer.compute(compute); + renderer.render(scene, camera); + + renderer.resolveTimestampsAsync(THREE.TimestampQuery.COMPUTE); + renderer.resolveTimestampsAsync(THREE.TimestampQuery.RENDER); + + timestamps[forceWebGL ? 'webgl' : 'webgpu'].innerHTML = ` + + Compute ${renderer.info.compute.frameCalls} pass in ${renderer.info.compute.timestamp.toFixed(6)}ms
+ Draw ${renderer.info.render.drawCalls} pass in ${renderer.info.render.timestamp.toFixed(6)}ms`; + + setTimeout(stepAnimation, 1000); + }; + + stepAnimation(); + + window.addEventListener('resize', onWindowResize); + + function onWindowResize() { + renderer.setSize(window.innerWidth / 2, window.innerHeight); + + const aspect = window.innerWidth / 2 / window.innerHeight; + + const frustumHeight = camera.top - camera.bottom; + + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + + camera.updateProjectionMatrix(); + + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgpu_struct_drawindirect.ts b/examples-testing/examples/webgpu_struct_drawindirect.ts new file mode 100644 index 000000000..b0d1139db --- /dev/null +++ b/examples-testing/examples/webgpu_struct_drawindirect.ts @@ -0,0 +1,212 @@ +import * as THREE from 'three/webgpu'; +import { + struct, + storage, + sin, + cross, + normalize, + abs, + mix, + Fn, + vec4, + max, + pow, + time, + varyingProperty, + attribute, + uint, + atomicStore, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); +} + +const renderer = new THREE.WebGPURenderer({ antialias: true }); +renderer.outputColorSpace = THREE.SRGBColorSpace; +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setClearColor(0x000000); +renderer.setClearAlpha(0); +document.body.appendChild(renderer.domElement); + +const aspect = window.innerWidth / window.innerHeight; + +const camera = new THREE.PerspectiveCamera(50.0, aspect, 0.1, 10000); +const scene = new THREE.Scene(); + +scene.background = new THREE.Color(0x00001f); +camera.position.set(1, 1, 1); +const controls = new OrbitControls(camera, renderer.domElement); + +let computeDrawBuffer, computeInitDrawBuffer; + +init(); + +async function init() { + await renderer.init(); + + // geometry + + const vector = new THREE.Vector4(); + + const instances = 100000; + + const positions = []; + const offsets = []; + const colors = []; + const orientationsStart = []; + const orientationsEnd = []; + + positions.push(0.025, -0.025, 0); + positions.push(-0.025, 0.025, 0); + positions.push(0, 0, 0.025); + + // instanced attributes + + for (let i = 0; i < instances; i++) { + // offsets + + offsets.push(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); + + // colors + + colors.push(Math.random(), Math.random(), Math.random(), Math.random()); + + // orientation start + + vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); + vector.normalize(); + + orientationsStart.push(vector.x, vector.y, vector.z, vector.w); + + // orientation end + + vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); + vector.normalize(); + + orientationsEnd.push(vector.x, vector.y, vector.z, vector.w); + } + + const geometry = new THREE.InstancedBufferGeometry(); + geometry.instanceCount = instances; + + geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); + geometry.setAttribute('offset', new THREE.InstancedBufferAttribute(new Float32Array(offsets), 3)); + geometry.setAttribute('color', new THREE.InstancedBufferAttribute(new Float32Array(colors), 4)); + geometry.setAttribute( + 'orientationStart', + new THREE.InstancedBufferAttribute(new Float32Array(orientationsStart), 4), + ); + geometry.setAttribute('orientationEnd', new THREE.InstancedBufferAttribute(new Float32Array(orientationsEnd), 4)); + + const drawBuffer = new THREE.IndirectStorageBufferAttribute(new Uint32Array(5), 5); + geometry.setIndirect(drawBuffer); + + const drawBufferStruct = struct( + { + vertexCount: 'uint', + instanceCount: { type: 'uint', atomic: true }, + firstVertex: 'uint', + firstInstance: 'uint', + offset: 'uint', + }, + 'DrawBuffer', + ); + + const drawStorage = storage(drawBuffer, drawBufferStruct, drawBuffer.count); + + computeDrawBuffer = Fn(() => { + const halfTime = sin(time.mul(0.5)); + + const instanceCount = max(pow(halfTime.add(1), 4.0).mul(instances), 100).toVar('instanceCount'); + atomicStore(drawStorage.get('instanceCount'), instanceCount); + })().compute(instances); + + computeInitDrawBuffer = Fn(() => { + const drawInfo = drawStorage; + + drawInfo.get('vertexCount').assign(3); + atomicStore(drawInfo.get('instanceCount'), uint(0)); + drawInfo.get('firstVertex').assign(0); + drawInfo.get('firstInstance').assign(0); + drawInfo.get('offset').assign(0); + })().compute(1); + + const vPosition = varyingProperty('vec3', 'vPosition'); + const vColor = varyingProperty('vec4', 'vColor'); + + const positionShaderParams = { + position: attribute('position'), + offset: attribute('offset'), + color: attribute('color'), + orientationStart: attribute('orientationStart'), + orientationEnd: attribute('orientationEnd'), + time: time, + }; + + const positionFn = Fn(() => { + const { position, offset, color, orientationStart, orientationEnd } = positionShaderParams; + + const halfTime = sin(time.mul(0.5)); + + // Convert slowed sign range of (-1 to 1) to range of (1 -> 0 / 0.5 -> 3) + const oscilationRange = max(abs(halfTime.mul(2.0).add(1.0)), 0.5); + + const sphereOscilation = offset.mul(oscilationRange).add(position).toVar(); + + const orientation = normalize(mix(orientationStart, orientationEnd, halfTime)); + const vcV = cross(orientation.xyz, sphereOscilation); + const crossvcV = cross(orientation.xyz, vcV); + + vPosition.assign(vcV.mul(orientation.w.mul(2.0)).add(crossvcV.mul(2.0).add(sphereOscilation))); + vColor.assign(color); + + return vPosition; + })(); + + const fragmentFn = Fn(() => { + const color = vec4(vColor).toVar(); + + color.r.addAssign(sin(vPosition.x.mul(10.0).add(time)).mul(0.5)); + + return color; + })(); + + const material = new THREE.MeshBasicNodeMaterial({ + side: THREE.DoubleSide, + forceSinglePass: true, + transparent: true, + }); + + material.positionNode = positionFn; + material.fragmentNode = fragmentFn; + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + renderer.setAnimationLoop(render); + + window.addEventListener('resize', onWindowResize, false); +} + +function render() { + controls.update(); + + renderer.render(scene, camera); + + renderer.compute(computeInitDrawBuffer); + renderer.compute(computeDrawBuffer); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} diff --git a/examples-testing/examples/webgpu_test_memory.ts b/examples-testing/examples/webgpu_test_memory.ts new file mode 100644 index 000000000..0c7248fbf --- /dev/null +++ b/examples-testing/examples/webgpu_test_memory.ts @@ -0,0 +1,223 @@ +import * as THREE from 'three/webgpu'; +import { pass, mrt, packNormalToRGB, normalView, screenUV, context, sample, unpackRGBToNormal } from 'three/tsl'; +import { outline } from 'three/addons/tsl/display/OutlineNode.js'; +import { ao } from 'three/addons/tsl/display/GTAONode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, light; +let generateMeshes = true; +let mesh; +let renderPipeline; +let aoNode, outlineNode, scenePass, prePass; +const selectedObjects = []; + +const params = { + castShadow: true, + enablePP: false, + enableOutline: true, + enableAO: true, + recreateLight: () => { + // Remove existing light + if (light) { + scene.remove(light); + light.dispose(); + light = null; + } + + // Create new directional light + light = new THREE.DirectionalLight(0xffffff, 1); + light.position.set(Math.random() * 200 - 100, 100, Math.random() * 200 - 100); + light.castShadow = params.castShadow; + scene.add(light); + }, + start: () => { + generateMeshes = true; + }, + stop: () => { + generateMeshes = false; + }, +}; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); + camera.position.z = 200; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + renderer = new THREE.WebGPURenderer(); + renderer.shadowMap.enabled = true; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + container.appendChild(renderer.domElement); + + await renderer.init(); + + light = new THREE.DirectionalLight(0xffffff, 1); + light.position.set(0, 100, 0); + light.castShadow = true; + scene.add(light); + + const planeGeometry = new THREE.PlaneGeometry(1000, 1000); + const planeMaterial = new THREE.MeshLambertMaterial({ color: 0xcccccc }); + const plane = new THREE.Mesh(planeGeometry, planeMaterial); + plane.rotation.x = -Math.PI / 2; + plane.position.y = -100; + plane.receiveShadow = true; + scene.add(plane); + + // Inspector UI + const gui = renderer.inspector.createParameters('Settings'); + + gui.add(params, 'castShadow') + .name('Cast Shadow') + .onChange(value => { + if (light) light.castShadow = value; + }); + + const ppFolder = gui.addFolder('Post Processing'); + ppFolder.add(params, 'enablePP').name('Enable').onChange(updatePostProcessing); + ppFolder.add(params, 'enableOutline').name('Outline').onChange(updatePostProcessing); + ppFolder.add(params, 'enableAO').name('AO').onChange(updatePostProcessing); + + gui.add(params, 'recreateLight').name('Recreate Directional Light'); + gui.add(params, 'start').name('Start Creating Meshes'); + gui.add(params, 'stop').name('Stop Creating Meshes'); + + window.addEventListener('resize', onWindowResize); +} + +function updatePostProcessing() { + if (renderPipeline) { + renderPipeline.dispose(); + renderPipeline = null; + } + + if (scenePass) { + scenePass.dispose(); + scenePass = null; + } + + if (prePass) { + prePass.dispose(); + prePass = null; + } + + if (aoNode) { + aoNode.dispose(); + aoNode = null; + } + + if (outlineNode) { + outlineNode.dispose(); + outlineNode = null; + } + + if (params.enablePP) { + renderPipeline = new THREE.RenderPipeline(renderer); + + scenePass = pass(scene, camera); + let colorNode = scenePass; + + if (params.enableAO) { + prePass = pass(scene, camera); + prePass.setMRT( + mrt({ + output: packNormalToRGB(normalView), + }), + ); + + const prePassNormal = sample(uv => { + return unpackRGBToNormal(prePass.getTextureNode().sample(uv)); + }); + const prePassDepth = prePass.getTextureNode('depth'); + + aoNode = ao(prePassDepth, prePassNormal, camera); + + scenePass.contextNode = context({ + ao: aoNode.getTextureNode().sample(screenUV).r, + }); + } + + if (params.enableOutline) { + outlineNode = outline(scene, camera, { + selectedObjects: selectedObjects, + }); + colorNode = colorNode.add(outlineNode); + } + + renderPipeline.outputNode = colorNode; + } +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function createImage() { + const canvas = document.createElement('canvas'); + canvas.width = 256; + canvas.height = 256; + + const canvas2DContext = canvas.getContext('2d'); + canvas2DContext.fillStyle = + 'rgb(' + + Math.floor(Math.random() * 256) + + ',' + + Math.floor(Math.random() * 256) + + ',' + + Math.floor(Math.random() * 256) + + ')'; + canvas2DContext.fillRect(0, 0, 256, 256); + + return canvas; +} + +// + +function animate() { + if (generateMeshes) { + if (mesh) { + scene.remove(mesh); + + mesh.geometry.dispose(); + mesh.material.map.dispose(); + mesh.material.dispose(); + } + + const geometry = new THREE.SphereGeometry(50, Math.random() * 64, Math.random() * 32); + + const texture = new THREE.CanvasTexture(createImage()); + + const material = new THREE.MeshLambertMaterial({ map: texture }); + + mesh = new THREE.Mesh(geometry, material); + mesh.castShadow = true; + + scene.add(mesh); + + if (outlineNode) { + selectedObjects[0] = mesh; + } + } + + if (renderPipeline) { + renderPipeline.render(); + } else { + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgpu_texturegather.ts b/examples-testing/examples/webgpu_texturegather.ts new file mode 100644 index 000000000..0487eda9e --- /dev/null +++ b/examples-testing/examples/webgpu_texturegather.ts @@ -0,0 +1,120 @@ +import * as THREE from 'three/webgpu'; +import { If, vec4, uv, ivec2, texture, Fn } from 'three/tsl'; + +// WebGPU Backend +init(); + +// WebGL Backend +init(true); + +async function init(forceWebGL = false) { + const aspect = window.innerWidth / 2 / window.innerHeight; + const camera = new THREE.OrthographicCamera(-aspect, aspect); + camera.position.z = 2; + + const scene = new THREE.Scene(); + + // texture + + const material = new THREE.MeshBasicNodeMaterial({ color: 0xffffff }); + + const colorNode = texture(); + const depthNode = texture(); + + material.colorNode = Fn(() => { + const color = vec4(1).toVar(); + + const vuv = uv().toVar(); + + If(vuv.y.greaterThan(0.5), () => { + color.assign(colorNode.sample(vuv.mul(10)).offset(ivec2(0, 7)).gather(0)); + }).Else(() => { + color.assign(depthNode.sample(vuv).offset(ivec2(0, 7)).gather(0).compare(1)); + }); + + return color; + })(); + + // + + const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + scene.add(plane); + + const renderer = new THREE.WebGPURenderer({ antialias: false, forceWebGL: forceWebGL }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth / 2, window.innerHeight); + renderer.setAnimationLoop(animate); + await renderer.init(); + + document.body.appendChild(renderer.domElement); + renderer.domElement.style.position = 'absolute'; + renderer.domElement.style.top = '0'; + renderer.domElement.style.left = '0'; + renderer.domElement.style.width = '50%'; + renderer.domElement.style.height = '100%'; + + if (forceWebGL) { + renderer.domElement.style.left = '50%'; + + scene.background = new THREE.Color(0x212121); + } else { + scene.background = new THREE.Color(0x313131); + } + + // + + const depthTexture = new THREE.DepthTexture(); + depthTexture.compareFunction = THREE.LessEqualCompare; + const rt = new THREE.RenderTarget(100, 100, { + depthTexture, + generateMipmaps: true, + minFilter: THREE.LinearMipmapLinearFilter, + }); + rt.texture.wrapS = THREE.RepeatWrapping; + rt.texture.wrapT = THREE.RepeatWrapping; + + const cameraZ = 2.5; + const rtScene = new THREE.Scene(); + rtScene.background = new THREE.Color(0x808080); + const rtCamera = new THREE.PerspectiveCamera(50, 1, cameraZ - 0.5 * Math.sqrt(3), cameraZ + 0.5 * Math.sqrt(3)); + rtCamera.position.z = cameraZ; + + const dirLight = new THREE.DirectionalLight(); + dirLight.position.set(1, 1, 0); + rtScene.add(dirLight); + rtScene.add(new THREE.AmbientLight(0xffffff, 0.1)); + + const box = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshStandardNodeMaterial({ color: 0xff0000 })); + box.rotation.set(Math.PI / 4, Math.PI / 4, 0); + rtScene.add(box); + + renderer.setRenderTarget(rt); + renderer.render(rtScene, rtCamera); + renderer.setRenderTarget(null); + + colorNode.value = rt.texture; + depthNode.value = rt.depthTexture; + + // + + function animate() { + renderer.render(scene, camera); + } + + window.addEventListener('resize', onWindowResize); + + function onWindowResize() { + renderer.setSize(window.innerWidth / 2, window.innerHeight); + + const aspect = window.innerWidth / 2 / window.innerHeight; + + const frustumHeight = camera.top - camera.bottom; + + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + + camera.updateProjectionMatrix(); + + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgpu_texturegrad.ts b/examples-testing/examples/webgpu_texturegrad.ts new file mode 100644 index 000000000..da07b4d31 --- /dev/null +++ b/examples-testing/examples/webgpu_texturegrad.ts @@ -0,0 +1,116 @@ +import * as THREE from 'three/webgpu'; +import { If, vec4, float, time, cos, pow, vec2, uv, texture, Fn } from 'three/tsl'; + +// WebGPU Backend +init(); + +// WebGL Backend +init(true); + +async function init(forceWebGL = false) { + const aspect = window.innerWidth / 2 / window.innerHeight; + const camera = new THREE.OrthographicCamera(-aspect, aspect); + camera.position.z = 2; + + const scene = new THREE.Scene(); + + // texture + + const material = new THREE.MeshBasicNodeMaterial({ color: 0xffffff }); + + // load async brick_diffuse + const map = await new THREE.TextureLoader().loadAsync('textures/uv_grid_opengl.jpg'); + + material.colorNode = Fn(() => { + const color = vec4(1).toVar(); + + const vuv = uv().toVar(); + const blur = pow( + float(0.0625) + .sub(cos(vuv.x.mul(20.0).add(time))) + .mul(0.0625), + 2.0, + ); + + const grad = vec2(blur).toVar(); + + If(vuv.y.greaterThan(0.5), () => { + grad.assign(0); + }); + + color.assign( + texture(map, vuv.add(vec2(blur, blur).mul(0.5))) + .grad(grad, grad) + .mul(0.25) + .add( + texture(map, vuv.add(vec2(blur, blur.negate()).mul(0.5))) + .grad(grad, grad) + .mul(0.25), + ) + .add( + texture(map, vuv.add(vec2(blur.negate(), blur).mul(0.5))) + .grad(grad, grad) + .mul(0.25), + ) + .add( + texture(map, vuv.add(vec2(blur.negate(), blur.negate()).mul(0.5))) + .grad(grad, grad) + .mul(0.25), + ), + ); + + If(vuv.y.greaterThan(0.497).and(vuv.y.lessThan(0.503)), () => { + color.assign(1); + }); + + return color; + })(); + + // + + const box = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); + scene.add(box); + + const renderer = new THREE.WebGPURenderer({ antialias: false, forceWebGL: forceWebGL }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth / 2, window.innerHeight); + renderer.setAnimationLoop(animate); + + document.body.appendChild(renderer.domElement); + renderer.domElement.style.position = 'absolute'; + renderer.domElement.style.top = '0'; + renderer.domElement.style.left = '0'; + renderer.domElement.style.width = '50%'; + renderer.domElement.style.height = '100%'; + + if (forceWebGL) { + renderer.domElement.style.left = '50%'; + + scene.background = new THREE.Color(0x212121); + } else { + scene.background = new THREE.Color(0x313131); + } + + // + + function animate() { + renderer.render(scene, camera); + } + + window.addEventListener('resize', onWindowResize); + + function onWindowResize() { + renderer.setSize(window.innerWidth / 2, window.innerHeight); + + const aspect = window.innerWidth / 2 / window.innerHeight; + + const frustumHeight = camera.top - camera.bottom; + + camera.left = (-frustumHeight * aspect) / 2; + camera.right = (frustumHeight * aspect) / 2; + + camera.updateProjectionMatrix(); + + renderer.render(scene, camera); + } +} diff --git a/examples-testing/examples/webgpu_textures_2d-array.ts b/examples-testing/examples/webgpu_textures_2d-array.ts new file mode 100644 index 000000000..a1a354ff7 --- /dev/null +++ b/examples-testing/examples/webgpu_textures_2d-array.ts @@ -0,0 +1,69 @@ +import * as THREE from 'three/webgpu'; +import { texture, uv, time, oscTriangle } from 'three/tsl'; + +import { unzipSync } from 'three/addons/libs/fflate.module.js'; + +// + +let camera, scene, mesh, renderer; + +const planeWidth = 50; +const planeHeight = 50; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); + camera.position.z = 70; + + scene = new THREE.Scene(); + + // width 256, height 256, depth 109, 8-bit, zip archived raw data + + new THREE.FileLoader().setResponseType('arraybuffer').load('textures/3d/head256x256x109.zip', function (data) { + const zip = unzipSync(new Uint8Array(data)); + const array = new Uint8Array(zip['head256x256x109'].buffer); + + const map = new THREE.DataArrayTexture(array, 256, 256, 109); + map.format = THREE.RedFormat; + map.needsUpdate = true; + + let coord = uv(); + coord = coord.setY(coord.y.oneMinus()); // flip y + + let oscLayers = oscTriangle(time.mul(0.5)); // [ /\/ ] triangle osc animation + oscLayers = oscLayers.add(1).mul(0.5); // convert osc range of [ -1, 1 ] to [ 0, 1 ] + oscLayers = oscLayers.mul(map.image.depth); // scale osc range to texture depth + + const material = new THREE.MeshBasicNodeMaterial(); + material.colorNode = texture(map, coord).depth(oscLayers).r.remap(0, 1, -0.1, 1.8); // remap to make it more visible + + const geometry = new THREE.PlaneGeometry(planeWidth, planeHeight); + + mesh = new THREE.Mesh(geometry, material); + + scene.add(mesh); + }); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(render); + container.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_textures_2d-array_compressed.ts b/examples-testing/examples/webgpu_textures_2d-array_compressed.ts new file mode 100644 index 000000000..1a44e04c4 --- /dev/null +++ b/examples-testing/examples/webgpu_textures_2d-array_compressed.ts @@ -0,0 +1,85 @@ +import * as THREE from 'three/webgpu'; + +import { texture, uniform, uv } from 'three/tsl'; + +import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; + +// + +let camera, scene, mesh, renderer, timer; + +const depth = uniform(0); + +const planeWidth = 50; +const planeHeight = 25; + +let depthStep = 1; + +init(); + +async function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); + camera.position.z = 70; + + scene = new THREE.Scene(); + + // + timer = new THREE.Timer(); + timer.connect(document); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + await renderer.init(); + + // + + const ktx2Loader = new KTX2Loader(); + ktx2Loader.detectSupport(renderer); + + ktx2Loader.load('textures/spiritedaway.ktx2', function (texturearray) { + const material = new THREE.NodeMaterial(); + + material.colorNode = texture(texturearray, uv().flipY()).depth(depth); + const geometry = new THREE.PlaneGeometry(planeWidth, planeHeight); + + mesh = new THREE.Mesh(geometry, material); + + scene.add(mesh); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + if (mesh) { + const delta = timer.getDelta() * 10; + + depthStep += delta; + + const value = depthStep % 5; + + depth.value = value; + } + + render(); +} + +function render() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_textures_anisotropy.ts b/examples-testing/examples/webgpu_textures_anisotropy.ts new file mode 100644 index 000000000..0444823f5 --- /dev/null +++ b/examples-testing/examples/webgpu_textures_anisotropy.ts @@ -0,0 +1,145 @@ +import * as THREE from 'three/webgpu'; + +let container; + +let camera, scene1, scene2, renderer; + +let mouseX = 0, + mouseY = 0; + +init(); + +function init() { + const SCREEN_WIDTH = window.innerWidth; + const SCREEN_HEIGHT = window.innerHeight; + + container = document.createElement('div'); + document.body.appendChild(container); + + renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL: false }); + + // RENDERER + + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); + renderer.setAnimationLoop(render); + renderer.autoClear = false; + + renderer.domElement.style.position = 'relative'; + container.appendChild(renderer.domElement); + + // + + camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 25000); + camera.position.z = 1500; + + scene1 = new THREE.Scene(); + scene1.fog = new THREE.Fog(0xf2f7ff, 1, 25000); + + scene2 = new THREE.Scene(); + scene2.fog = new THREE.Fog(0xf2f7ff, 1, 25000); + + scene1.add(new THREE.AmbientLight(0xeef0ff, 3)); + scene2.add(new THREE.AmbientLight(0xeef0ff, 3)); + + const light1 = new THREE.DirectionalLight(0xffffff, 6); + light1.position.set(1, 1, 1); + scene1.add(light1); + + const light2 = new THREE.DirectionalLight(0xffffff, 6); + light2.position.set(1, 1, 1); + scene2.add(light2); + + // GROUND + + const textureLoader = new THREE.TextureLoader(); + + const maxAnisotropy = renderer.getMaxAnisotropy(); + + const texture1 = textureLoader.load('textures/crate.gif'); + const material1 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture1 }); + + texture1.colorSpace = THREE.SRGBColorSpace; + texture1.anisotropy = renderer.getMaxAnisotropy(); + texture1.wrapS = texture1.wrapT = THREE.RepeatWrapping; + texture1.repeat.set(512, 512); + + const texture2 = textureLoader.load('textures/crate.gif'); + const material2 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture2 }); + + texture2.colorSpace = THREE.SRGBColorSpace; + texture2.anisotropy = 1; + texture2.wrapS = texture2.wrapT = THREE.RepeatWrapping; + texture2.repeat.set(512, 512); + + if (maxAnisotropy > 0) { + document.getElementById('val_left').innerHTML = texture1.anisotropy; + document.getElementById('val_right').innerHTML = texture2.anisotropy; + } else { + document.getElementById('val_left').innerHTML = 'not supported'; + document.getElementById('val_right').innerHTML = 'not supported'; + } + + // + + const geometry = new THREE.PlaneGeometry(100, 100); + + const mesh1 = new THREE.Mesh(geometry, material1); + mesh1.rotation.x = -Math.PI / 2; + mesh1.scale.set(1000, 1000, 1000); + + const mesh2 = new THREE.Mesh(geometry, material2); + mesh2.rotation.x = -Math.PI / 2; + mesh2.scale.set(1000, 1000, 1000); + + scene1.add(mesh1); + scene2.add(mesh2); + + // + + document.addEventListener('mousemove', onDocumentMouseMove); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onDocumentMouseMove(event) { + const windowHalfX = window.innerWidth / 2; + const windowHalfY = window.innerHeight / 2; + + mouseX = event.clientX - windowHalfX; + mouseY = event.clientY - windowHalfY; +} + +function render() { + const SCREEN_WIDTH = window.innerWidth; + const SCREEN_HEIGHT = window.innerHeight; + + camera.position.x += (mouseX - camera.position.x) * 0.05; + camera.position.y = THREE.MathUtils.clamp( + camera.position.y + (-(mouseY - 200) - camera.position.y) * 0.05, + 50, + 1000, + ); + + camera.lookAt(scene1.position); + renderer.clear(); + + renderer.setScissorTest(true); + + renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene1, camera); + + renderer.setScissorTest(true); + + renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); + renderer.render(scene2, camera); + + renderer.setScissorTest(false); +} diff --git a/examples-testing/examples/webgpu_textures_partialupdate.ts b/examples-testing/examples/webgpu_textures_partialupdate.ts new file mode 100644 index 000000000..d893a041d --- /dev/null +++ b/examples-testing/examples/webgpu_textures_partialupdate.ts @@ -0,0 +1,105 @@ +import * as THREE from 'three/webgpu'; + +let camera, scene, renderer, timer, dataTexture, diffuseMap; + +let last = 0; +const position = new THREE.Vector2(); +const color = new THREE.Color(); + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.z = 2; + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + const loader = new THREE.TextureLoader(); + diffuseMap = loader.load('textures/carbon/Carbon.png'); + diffuseMap.colorSpace = THREE.SRGBColorSpace; + diffuseMap.minFilter = THREE.LinearFilter; + diffuseMap.generateMipmaps = false; + + const geometry = new THREE.PlaneGeometry(2, 2); + const material = new THREE.MeshBasicMaterial({ map: diffuseMap }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // + + const width = 32; + const height = 32; + + const data = new Uint8Array(width * height * 4); + dataTexture = new THREE.DataTexture(data, width, height); + dataTexture.colorSpace = THREE.SRGBColorSpace; + + // + + renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL: false }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const elapsedTime = timer.getElapsed(); + + renderer.render(scene, camera); + + if (elapsedTime - last > 0.1) { + last = elapsedTime; + + position.x = 32 * THREE.MathUtils.randInt(1, 16) - 32; + position.y = 32 * THREE.MathUtils.randInt(1, 16) - 32; + + // generate new color data + updateDataTexture(dataTexture); + + // perform copy from src to dest texture to a random position + + renderer.copyTextureToTexture(dataTexture, diffuseMap, null, position); + } +} + +function updateDataTexture(texture) { + const size = texture.image.width * texture.image.height; + const data = texture.image.data; + + // generate a random color and update texture data + + color.setHex(Math.random() * 0xffffff); + + const r = Math.floor(color.r * 255); + const g = Math.floor(color.g * 255); + const b = Math.floor(color.b * 255); + + for (let i = 0; i < size; i++) { + const stride = i * 4; + + data[stride] = r; + data[stride + 1] = g; + data[stride + 2] = b; + data[stride + 3] = 1; + } + + texture.needsUpdate = true; +} diff --git a/examples-testing/examples/webgpu_tonemapping.ts b/examples-testing/examples/webgpu_tonemapping.ts new file mode 100644 index 000000000..9c2161578 --- /dev/null +++ b/examples-testing/examples/webgpu_tonemapping.ts @@ -0,0 +1,141 @@ +import * as THREE from 'three/webgpu'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let renderer, scene, camera, controls; +let gui; + +const params = { + exposure: 1.0, + toneMapping: 'Neutral', + blurriness: 0.3, + intensity: 1.0, +}; + +const toneMappingOptions = { + None: THREE.NoToneMapping, + Linear: THREE.LinearToneMapping, + Reinhard: THREE.ReinhardToneMapping, + Cineon: THREE.CineonToneMapping, + ACESFilmic: THREE.ACESFilmicToneMapping, + AgX: THREE.AgXToneMapping, + Neutral: THREE.NeutralToneMapping, +}; + +init().catch(function (err) { + console.error(err); +}); + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + renderer.toneMapping = toneMappingOptions[params.toneMapping]; + renderer.toneMappingExposure = params.exposure; + + scene = new THREE.Scene(); + scene.backgroundBlurriness = params.blurriness; + + const light = new THREE.DirectionalLight(0xfff3ee, 3); // simulate sun + light.position.set(1, 0.05, 0.7); + scene.add(light); + + // scene.add( new THREE.DirectionalLightHelper( light, 1, 0x000000 ) ); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); + camera.position.set(-0.02, 0.03, 0.05); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enablePan = false; + controls.enableDamping = true; + controls.minDistance = 0.03; + controls.maxDistance = 0.2; + controls.target.set(0, 0.03, 0); + controls.update(); + + const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const gltfLoader = new GLTFLoader(); + gltfLoader.setDRACOLoader(dracoLoader); + gltfLoader.setPath('models/gltf/'); + + const [texture, gltf] = await Promise.all([ + hdrLoader.loadAsync('venice_sunset_1k.hdr'), + gltfLoader.loadAsync('venice_mask.glb'), + ]); + + // environment + + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + + // model + + scene.add(gltf.scene); + + window.addEventListener('resize', onWindowResize); + + // + + gui = renderer.inspector.createParameters('Settings'); + const toneMappingFolder = gui.addFolder('Tone Mapping'); + + toneMappingFolder + .add(params, 'toneMapping', Object.keys(toneMappingOptions)) + + .name('type') + .onChange(function () { + renderer.toneMapping = toneMappingOptions[params.toneMapping]; + }); + + toneMappingFolder + .add(params, 'exposure', 0, 2) + + .onChange(function (value) { + renderer.toneMappingExposure = value; + }); + + const backgroundFolder = gui.addFolder('Background'); + + backgroundFolder + .add(params, 'blurriness', 0, 1) + + .onChange(function (value) { + scene.backgroundBlurriness = value; + }); + + backgroundFolder + .add(params, 'intensity', 0, 1) + + .onChange(function (value) { + scene.backgroundIntensity = value; + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_angular_slicing.ts b/examples-testing/examples/webgpu_tsl_angular_slicing.ts new file mode 100644 index 000000000..cf503b783 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_angular_slicing.ts @@ -0,0 +1,174 @@ +import * as THREE from 'three/webgpu'; +import { If, TWO_PI, atan, color, frontFacing, output, positionLocal, Fn, uniform, vec4 } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-5, 5, 12); + + scene = new THREE.Scene(); + + // environment + + const hdrLoader = new UltraHDRLoader(); + hdrLoader.load('textures/equirectangular/royal_esplanade_2k.hdr.jpg', environmentMap => { + environmentMap.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = environmentMap; + scene.environment = environmentMap; + }); + + // lights + + const directionalLight = new THREE.DirectionalLight('#ffffff', 4); + directionalLight.position.set(6.25, 3, 4); + directionalLight.castShadow = true; + directionalLight.shadow.mapSize.set(2048, 2048); + directionalLight.shadow.camera.near = 0.1; + directionalLight.shadow.camera.far = 30; + directionalLight.shadow.camera.top = 8; + directionalLight.shadow.camera.right = 8; + directionalLight.shadow.camera.bottom = -8; + directionalLight.shadow.camera.left = -8; + directionalLight.shadow.normalBias = 0.05; + scene.add(directionalLight); + + // TSL functions + + const inAngle = Fn(([position, angleStart, angleArc]) => { + const angle = atan(position.y, position.x).sub(angleStart).mod(TWO_PI).toVar(); + return angle.greaterThan(0).and(angle.lessThan(angleArc)); + }); + + // materials + + const defaultMaterial = new THREE.MeshPhysicalNodeMaterial({ + metalness: 0.5, + roughness: 0.25, + envMapIntensity: 0.5, + color: '#858080', + }); + + const slicedMaterial = new THREE.MeshPhysicalNodeMaterial({ + metalness: 0.5, + roughness: 0.25, + envMapIntensity: 0.5, + color: '#858080', + side: THREE.DoubleSide, + }); + + // uniforms + + const sliceStart = uniform(1.75); + const sliceArc = uniform(1.25); + const sliceColor = uniform(color('#b62f58')); + + // mask + + const mask = inAngle(positionLocal.xy, sliceStart, sliceArc).not(); + + slicedMaterial.maskNode = mask; + //slicedMaterial.maskShadowNode = mask; // optional: custom mask shadows + + // output + + slicedMaterial.outputNode = Fn(() => { + // backface color + + const finalOutput = output; + If(frontFacing.not(), () => { + finalOutput.assign(vec4(sliceColor, 1)); + }); + + return finalOutput; + })(); + + // model + + const dracoLoader = new DRACOLoader(); + + const gltfLoader = new GLTFLoader(); + gltfLoader.setDRACOLoader(dracoLoader); + + gltfLoader.load('./models/gltf/gears.glb', gltf => { + const model = gltf.scene; + + model.traverse(child => { + if (child.isMesh) { + if (child.name === 'outerHull') child.material = slicedMaterial; + else child.material = defaultMaterial; + + child.castShadow = true; + child.receiveShadow = true; + } + }); + + scene.add(model); + }); + + // plane + + const plane = new THREE.Mesh( + new THREE.PlaneGeometry(10, 10, 10), + new THREE.MeshStandardMaterial({ color: '#aaaaaa' }), + ); + plane.receiveShadow = true; + plane.position.set(-4, -3, -4); + plane.lookAt(new THREE.Vector3(0, 0, 0)); + scene.add(plane); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + // events + + window.addEventListener('resize', onWindowResize); + + // debug + + const gui = renderer.inspector.createParameters('Parameters'); + gui.add(sliceStart, 'value', -Math.PI, Math.PI, 0.001).name('sliceStart'); + gui.add(sliceArc, 'value', 0, Math.PI * 2, 0.001).name('sliceArc'); + gui.addColor({ color: sliceColor.value.getHexString(THREE.SRGBColorSpace) }, 'color').onChange(value => + sliceColor.value.set(value), + ); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_earth.ts b/examples-testing/examples/webgpu_tsl_earth.ts new file mode 100644 index 000000000..7530c7eba --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_earth.ts @@ -0,0 +1,175 @@ +import * as THREE from 'three/webgpu'; +import { + step, + normalWorldGeometry, + output, + texture, + vec3, + vec4, + normalize, + positionWorld, + bumpMap, + cameraPosition, + color, + uniform, + mix, + uv, + max, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls, globe, timer; + +init(); + +function init() { + timer = new THREE.Timer(); + timer.connect(document); + + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(4.5, 2, 3); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x000000); + + // sun + + const sun = new THREE.DirectionalLight('#ffffff', 2); + sun.position.set(0, 0, 3); + scene.add(sun); + + // uniforms + + const atmosphereDayColor = uniform(color('#4db2ff')); + const atmosphereTwilightColor = uniform(color('#bc490b')); + const roughnessLow = uniform(0.25); + const roughnessHigh = uniform(0.35); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const dayTexture = textureLoader.load('./textures/planets/earth_day_4096.jpg'); + dayTexture.colorSpace = THREE.SRGBColorSpace; + dayTexture.anisotropy = 8; + + const nightTexture = textureLoader.load('./textures/planets/earth_night_4096.jpg'); + nightTexture.colorSpace = THREE.SRGBColorSpace; + nightTexture.anisotropy = 8; + + const bumpRoughnessCloudsTexture = textureLoader.load('./textures/planets/earth_bump_roughness_clouds_4096.jpg'); + bumpRoughnessCloudsTexture.anisotropy = 8; + + // fresnel + + const viewDirection = positionWorld.sub(cameraPosition).normalize(); + const fresnel = viewDirection.dot(normalWorldGeometry).abs().oneMinus().toVar(); + + // sun orientation + + const sunOrientation = normalWorldGeometry.dot(normalize(sun.position)).toVar(); + + // atmosphere color + + const atmosphereColor = mix(atmosphereTwilightColor, atmosphereDayColor, sunOrientation.smoothstep(-0.25, 0.75)); + + // globe + + const globeMaterial = new THREE.MeshStandardNodeMaterial(); + + const cloudsStrength = texture(bumpRoughnessCloudsTexture, uv()).b.smoothstep(0.2, 1); + + globeMaterial.colorNode = mix(texture(dayTexture), vec3(1), cloudsStrength.mul(2)); + + const roughness = max(texture(bumpRoughnessCloudsTexture).g, step(0.01, cloudsStrength)); + globeMaterial.roughnessNode = roughness.remap(0, 1, roughnessLow, roughnessHigh); + + const night = texture(nightTexture); + const dayStrength = sunOrientation.smoothstep(-0.25, 0.5); + + const atmosphereDayStrength = sunOrientation.smoothstep(-0.5, 1); + const atmosphereMix = atmosphereDayStrength.mul(fresnel.pow(2)).clamp(0, 1); + + let finalOutput = mix(night.rgb, output.rgb, dayStrength); + finalOutput = mix(finalOutput, atmosphereColor, atmosphereMix); + + globeMaterial.outputNode = vec4(finalOutput, output.a); + + const bumpElevation = max(texture(bumpRoughnessCloudsTexture).r, cloudsStrength); + globeMaterial.normalNode = bumpMap(bumpElevation); + + const sphereGeometry = new THREE.SphereGeometry(1, 64, 64); + globe = new THREE.Mesh(sphereGeometry, globeMaterial); + scene.add(globe); + + // atmosphere + + const atmosphereMaterial = new THREE.MeshBasicNodeMaterial({ side: THREE.BackSide, transparent: true }); + let alpha = fresnel.remap(0.73, 1, 1, 0).pow(3); + alpha = alpha.mul(sunOrientation.smoothstep(-0.5, 1)); + atmosphereMaterial.outputNode = vec4(atmosphereColor, alpha); + + const atmosphere = new THREE.Mesh(sphereGeometry, atmosphereMaterial); + atmosphere.scale.setScalar(1.04); + scene.add(atmosphere); + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + // events + + window.addEventListener('resize', onWindowResize); + + // debug + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.addColor({ color: atmosphereDayColor.value.getHex(THREE.SRGBColorSpace) }, 'color') + .onChange(value => { + atmosphereDayColor.value.set(value); + }) + .name('atmosphereDayColor'); + + gui.addColor({ color: atmosphereTwilightColor.value.getHex(THREE.SRGBColorSpace) }, 'color') + .onChange(value => { + atmosphereTwilightColor.value.set(value); + }) + .name('atmosphereTwilightColor'); + + gui.add(roughnessLow, 'value', 0, 1, 0.001).name('roughnessLow'); + gui.add(roughnessHigh, 'value', 0, 1, 0.001).name('roughnessHigh'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + timer.update(); + + const delta = timer.getDelta(); + globe.rotation.y += delta * 0.025; + + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_galaxy.ts b/examples-testing/examples/webgpu_tsl_galaxy.ts new file mode 100644 index 000000000..739138504 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_galaxy.ts @@ -0,0 +1,99 @@ +import * as THREE from 'three/webgpu'; +import { color, cos, float, mix, range, sin, time, uniform, uv, vec3, vec4, TWO_PI } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +let camera, scene, renderer, controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(4, 2, 5); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x201919); + + // galaxy + + const material = new THREE.SpriteNodeMaterial({ + depthWrite: false, + blending: THREE.AdditiveBlending, + }); + + const size = uniform(0.08); + material.scaleNode = range(0, 1).mul(size); + + const radiusRatio = range(0, 1); + const radius = radiusRatio.pow(1.5).mul(5).toVar(); + + const branches = 3; + const branchAngle = range(0, branches).floor().mul(TWO_PI.div(branches)); + const angle = branchAngle.add(time.mul(radiusRatio.oneMinus())); + + const position = vec3(cos(angle), 0, sin(angle)).mul(radius); + + const randomOffset = range(vec3(-1), vec3(1)).pow3().mul(radiusRatio).add(0.2); + + material.positionNode = position.add(randomOffset); + + const colorInside = uniform(color('#ffa575')); + const colorOutside = uniform(color('#311599')); + const colorFinal = mix(colorInside, colorOutside, radiusRatio.oneMinus().pow(2).oneMinus()); + const alpha = float(0.1).div(uv().sub(0.5).length()).sub(0.2); + material.colorNode = vec4(colorFinal, alpha); + + const mesh = new THREE.InstancedMesh(new THREE.PlaneGeometry(1, 1), material, 20000); + scene.add(mesh); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + // events + + window.addEventListener('resize', onWindowResize); + + // debug + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.add(size, 'value', 0, 1, 0.001).name('size'); + + gui.addColor({ color: colorInside.value.getHex(THREE.SRGBColorSpace) }, 'color') + .name('colorInside') + .onChange(function (value) { + colorInside.value.set(value); + }); + + gui.addColor({ color: colorOutside.value.getHex(THREE.SRGBColorSpace) }, 'color') + .name('colorOutside') + .onChange(function (value) { + colorOutside.value.set(value); + }); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_graph.ts b/examples-testing/examples/webgpu_tsl_graph.ts new file mode 100644 index 000000000..cdde58a9a --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_graph.ts @@ -0,0 +1,228 @@ +import * as THREE from 'three/webgpu'; + +import { Fn, abs, fract, fwidth, length, max, saturate, smoothstep, vec3, vec4, positionWorld, float } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { TSLGraphLoader } from 'three/addons/inspector/extensions/tsl-graph/TSLGraphLoader.js'; + +let camera, scene, renderer; +let controls; +let prefab; + +init(); + +async function initTSLGraph() { + // Create Materials + + const m1 = new THREE.MeshPhysicalNodeMaterial(); + m1.userData.graphId = 'mat_1-physical'; + + const m2 = new THREE.MeshStandardNodeMaterial(); + m2.userData.graphId = 'mat_2-standard'; + + const m3 = new THREE.MeshPhongNodeMaterial(); + m3.userData.graphId = 'mat_3-phong'; + + const m4 = new THREE.MeshBasicNodeMaterial(); + m4.userData.graphId = 'mat_4-basic'; + + const materials = [m1, m2, m3, m4]; + + for (let i = 0; i < materials.length; i++) { + createShaderBall(materials[i], new THREE.Vector3((i & 1) * 4 - 2, 0, (i & 2) * 2 - 2)); + } + + // TSL Graph Editor + + renderer.inspector.onExtension('TSL Graph', async tslGraph => { + renderer.inspector.setActiveTab(tslGraph); + + // Apply TSL Graph from Local Storage if exists + // Every time a TSL Graph is changed, it will be stored in the local storage + + if (tslGraph.hasGraphs) { + tslGraph.apply(scene); + } else { + // Load a TSL Graph from a file + // Use it for production + + const tslLoader = new TSLGraphLoader(); + const applier = await tslLoader.setPath('./shaders/').loadAsync('tsl-graphs.json'); + + applier.apply(scene); + } + }); + + // Active TSL Graph Editor + // Only is needed if you don't activate it from the GUI + + renderer.inspector.setActiveExtension('TSL Graph', true); +} + +async function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 0.9; + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 200); + camera.position.set(3, 5, 8); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x444444); + + await renderer.init(); + + // Ground plane + + const plane = new THREE.Mesh(new THREE.CircleGeometry(40), createGroudMaterial()); + plane.rotation.x = -Math.PI / 2; + plane.renderOrder = -1; + scene.add(plane); + + // + + controls = new OrbitControls(camera); + controls.connect(renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 2; + controls.maxDistance = 40; + + // + + const environment = await new HDRLoader() + .setPath('textures/equirectangular/') + .loadAsync('monochrome_studio_02_1k.hdr'); + environment.mapping = THREE.EquirectangularReflectionMapping; + + const light = new THREE.DirectionalLight(0xffffff, 1); + light.position.set(1, 1, 1); + scene.add(light); + + scene.environment = environment; + + prefab = (await new GLTFLoader().loadAsync('./models/gltf/ShaderBall.glb')).scene; + + await initTSLGraph(); + + initGUI(); + + // Events + + resize(); + + window.addEventListener('resize', resize); + renderer.inspector.addEventListener('resize', resize); +} + +async function createShaderBall(material, position = new THREE.Vector3()) { + const model = prefab.clone(); + model.position.copy(position); + scene.add(model); + + // + + const calibrationMesh = model.getObjectByName('Calibration_Mesh'); + calibrationMesh.material = material; + + const previewMesh = model.getObjectByName('Preview_Mesh'); + previewMesh.material = material; + + calibrationMesh.renderOrder = 1; + previewMesh.renderOrder = 2; +} + +function initGUI() { + const gui = renderer.inspector.createParameters('Shader Ball'); + + const API = { + showCalibrationMesh: true, + showPreviewMesh: true, + }; + + gui.add(API, 'showCalibrationMesh') + .name('Calibration Mesh') + .onChange(function (value) { + setVisibility('Calibration_Mesh', value); + }); + + gui.add(API, 'showPreviewMesh') + .name('Preview Mesh') + .onChange(function (value) { + setVisibility('Preview_Mesh', value); + }); + + renderer.inspector.hide(); +} + +function resize() { + const size = renderer.inspector.getSize(); + const width = window.innerWidth - size.width; + const height = window.innerHeight - size.height; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function render() { + if (controls) controls.update(); + + renderer.render(scene, camera); +} + +// + +function setVisibility(name, visible) { + scene.traverse(function (node) { + if (node.isMesh) { + if (node.name == name) node.visible = visible; + } + }); +} + +function createGroudMaterial() { + const material = new THREE.MeshBasicNodeMaterial(); + + const grid = Fn(([coord, lineWidth = float(0.01), dotSize = float(0.03)]) => { + // https://bgolus.medium.com/the-best-darn-grid-shader-yet-727f9278b9d8 + + const g = fract(coord); + const fw = fwidth(coord); + const gx = abs(g.x.sub(0.5)); + const gy = abs(g.y.sub(0.5)); + + const lineX = saturate(lineWidth.sub(gx).div(fw.x).add(0.5)); + const lineY = saturate(lineWidth.sub(gy).div(fw.y).add(0.5)); + const lines = max(lineX, lineY); + + const squareDist = max(gx, gy); + const aa = max(fw.x, fw.y); + const dots = smoothstep(dotSize.add(aa), dotSize.sub(aa), squareDist); + + return max(dots, lines); + }); + + const fade = Fn(([radius = float(10.0), falloff = float(1.0)]) => { + return smoothstep(radius, radius.sub(falloff), length(positionWorld)); + }); + + const gridColor = vec4(vec3(0.2), 1.0); + const baseColor = vec4(vec3(0.4), 0.0); + + material.colorNode = grid(positionWorld.xz, 0.007, 0.03).mix(baseColor, gridColor).mul(fade(30.0, 20.0)); + material.transparent = true; + + return material; +} diff --git a/examples-testing/examples/webgpu_tsl_halftone.ts b/examples-testing/examples/webgpu_tsl_halftone.ts new file mode 100644 index 000000000..682e1df64 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_halftone.ts @@ -0,0 +1,214 @@ +import * as THREE from 'three/webgpu'; +import { color, mix, normalWorld, output, Fn, uniform, vec4, rotate, screenCoordinate, screenSize } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let camera, scene, renderer, controls, timer, halftoneSettings; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(6, 3, 10); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.setClearColor('#000000'); + document.body.appendChild(renderer.domElement); + + // inspector/gui + + renderer.inspector = new Inspector(); + + const gui = renderer.inspector.createParameters('Parameters'); + + // lights + + const ambientLight = new THREE.AmbientLight('#ffffff', 3); + scene.add(ambientLight); + + const directionalLight = new THREE.DirectionalLight('#ffffff', 8); + directionalLight.position.set(4, 3, 1); + scene.add(directionalLight); + + const lightsFolder = gui.addFolder('💡 lights'); + lightsFolder.add(ambientLight, 'intensity', 0, 10, 0.001).name('ambient intensity'); + lightsFolder.add(directionalLight, 'intensity', 0, 20, 0.001).name('directional intensity'); + + // halftone settings + + halftoneSettings = [ + // purple shade + + { + count: 140, + color: '#fb00ff', + direction: new THREE.Vector3(-0.4, -1, 0.5), + start: 1, + end: 0, + mixLow: 0, + mixHigh: 0.5, + radius: 0.8, + }, + + // cyan highlight + + { + count: 180, + color: '#94ffd1', + direction: new THREE.Vector3(0.5, 0.5, -0.2), + start: 0.55, + end: 0.2, + mixLow: 0.5, + mixHigh: 1, + radius: 0.8, + }, + ]; + + for (const index in halftoneSettings) { + const settings = halftoneSettings[index]; + + // uniforms + + const uniforms = {}; + + uniforms.count = uniform(settings.count); + uniforms.color = uniform(color(settings.color)); + uniforms.direction = uniform(settings.direction); + uniforms.start = uniform(settings.start); + uniforms.end = uniform(settings.end); + uniforms.mixLow = uniform(settings.mixLow); + uniforms.mixHigh = uniform(settings.mixHigh); + uniforms.radius = uniform(settings.radius); + + settings.uniforms = uniforms; + + // debug + + const folder = gui.addFolder(`⚪️ halftone ${index}`); + + folder.addColor({ color: uniforms.color.value }, 'color'); + folder.add(uniforms.count, 'value', 1, 200, 1).name('count'); + folder.add(uniforms.direction.value, 'x', -1, 1, 0.01).listen(); + folder.add(uniforms.direction.value, 'y', -1, 1, 0.01).listen(); + folder.add(uniforms.direction.value, 'z', -1, 1, 0.01).listen(); + folder.add(uniforms.start, 'value', -1, 1, 0.01).name('start'); + folder.add(uniforms.end, 'value', -1, 1, 0.01).name('end'); + folder.add(uniforms.mixLow, 'value', 0, 1, 0.01).name('mix low'); + folder.add(uniforms.mixHigh, 'value', 0, 1, 0.01).name('mix high'); + folder.add(uniforms.radius, 'value', 0, 1, 0.01).name('radius'); + } + + // halftone functions + + const halftone = Fn(([count, color, direction, start, end, radius, mixLow, mixHigh]) => { + // grid pattern + + let gridUv = screenCoordinate.xy.div(screenSize.yy).mul(count); + gridUv = rotate(gridUv, Math.PI * 0.25).mod(1); + + // orientation strength + + const orientationStrength = normalWorld.dot(direction.normalize()).remapClamp(end, start, 0, 1); + + // mask + + const mask = orientationStrength + .mul(radius) + .mul(0.5) + .step(gridUv.sub(0.5).length()) + .mul(mix(mixLow, mixHigh, orientationStrength)); + + return vec4(color, mask); + }); + + const halftones = Fn(([input]) => { + const halftonesOutput = input; + + for (const settings of halftoneSettings) { + const halfToneOutput = halftone( + settings.uniforms.count, + settings.uniforms.color, + settings.uniforms.direction, + settings.uniforms.start, + settings.uniforms.end, + settings.uniforms.radius, + settings.uniforms.mixLow, + settings.uniforms.mixHigh, + ); + halftonesOutput.rgb.assign(mix(halftonesOutput.rgb, halfToneOutput.rgb, halfToneOutput.a)); + } + + return halftonesOutput; + }); + + // default material + + const defaultMaterial = new THREE.MeshStandardNodeMaterial({ color: '#ff622e' }); + defaultMaterial.outputNode = halftones(output); + + const folder = gui.addFolder('🎨 default material'); + folder.addColor({ color: defaultMaterial.color }, 'color'); + + // objects + + const torusKnot = new THREE.Mesh(new THREE.TorusKnotGeometry(0.6, 0.25, 128, 32), defaultMaterial); + torusKnot.position.x = 3; + scene.add(torusKnot); + + const sphere = new THREE.Mesh(new THREE.SphereGeometry(1, 64, 64), defaultMaterial); + sphere.position.x = -3; + scene.add(sphere); + + const gltfLoader = new GLTFLoader(); + gltfLoader.load('./models/gltf/Michelle.glb', gltf => { + const model = gltf.scene; + model.position.y = -2; + model.scale.setScalar(2.5); + model.traverse(child => { + if (child.isMesh) child.material.outputNode = halftones(output); + }); + + scene.add(model); + }); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + timer.update(); + + controls.update(); + + const time = timer.getElapsed(); + halftoneSettings[1].uniforms.direction.value.x = Math.cos(time); + halftoneSettings[1].uniforms.direction.value.y = Math.sin(time); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_interoperability.ts b/examples-testing/examples/webgpu_tsl_interoperability.ts new file mode 100644 index 000000000..e57c66eeb --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_interoperability.ts @@ -0,0 +1,263 @@ +import * as THREE from 'three/webgpu'; +import { + Fn, + attribute, + varyingProperty, + time, + uniform, + wgslFn, + texture, + sampler, + uv, + clamp, + float, + vec2, + vec3, + fract, + floor, + positionGeometry, + sin, +} from 'three/tsl'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let renderer, camera, scene; +const dpr = window.devicePixelRatio; + +const crtWidthUniform = uniform(1608); +const crtHeightUniform = uniform(1608); + +const canvas = document.getElementById('c'); + +function onWindowResize() { + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} + +function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + const vUv = varyingProperty('vec2', 'vUv'); + + // In WGSL, access varying properties from the varying struct + const wgslVertexShader = wgslFn( + ` + fn crtVertex( + position: vec3f, + uv: vec2f + ) -> vec3 { + varyings.vUv = uv; + return position; + } + `, + [vUv], + ); + + // Only wgsl vertex shaders take varyings arguments when defined. + // For a wgsl fragment shader, pass the varyingProperty node to the + // fragment shader's constructor to access the varying value computed + // by the vertex shader. + const wgslFragmentShader = wgslFn(` + fn crtFragment( + vUv: vec2f, + tex: texture_2d, + texSampler: sampler, + crtWidth: f32, + crtHeight: f32, + cellOffset: f32, + cellSize: f32, + borderMask: f32, + time: f32, + speed: f32, + pulseIntensity: f32, + pulseWidth: f32, + pulseRate: f32 + ) -> vec3 { + // Convert uv into map of pixels + var pixel = ( vUv * 0.5 + 0.5 ) * vec2( + crtWidth, + crtHeight + ); + // Coordinate for each cell in the pixel map + let coord = pixel / cellSize; + // Three color values for each cell (r, g, b) + let subcoord = coord * vec2f( 3.0, 1.0 ); + let offset = vec2( 0, fract( floor( coord.x ) * cellOffset ) ); + + let maskCoord = floor( coord + offset ) * cellSize; + + var samplePoint = maskCoord / vec2(crtWidth, crtHeight); + samplePoint.x += fract( time * speed / 20 ); + + var color = textureSample( + tex, + texSampler, + samplePoint + ).xyz; + + // Current implementation does not give an even amount of space to each r, g, b unit of a cell + // Fix/hack this by multiplying subCoord.x by cellSize at cellSizes below 6 + let ind = floor( subcoord.x ) % 3; + + var maskColor = vec3( + f32( ind == 0.0 ), + f32( ind == 1.0 ), + f32( ind == 2.0 ) + ) * 3.0; + + let cellUV = fract( subcoord + offset ) * 2.0 - 1.0; + var border: vec2 = 1.0 - cellUV * cellUV * borderMask; + + maskColor *= vec3f( clamp( border.x, 0.0, 1.0 ) * clamp( border.y, 0.0, 1.0) ); + + color *= maskColor; + + color.r *= 1.0 + pulseIntensity * sin( pixel.y / pulseWidth + time * pulseRate ); + color.b *= 1.0 + pulseIntensity * sin( pixel.y / pulseWidth + time * pulseRate ); + color.g *= 1.0 + pulseIntensity * sin( pixel.y / pulseWidth + time * pulseRate ); + + return color; + } + `); + + const textureLoader = new THREE.TextureLoader(); + const planetTexture = textureLoader.load('textures/planets/earth_lights_2048.png'); + planetTexture.wrapS = THREE.RepeatWrapping; + planetTexture.wrapT = THREE.RepeatWrapping; + + // Node Uniforms: + // Passed to WGSL Functions. + // Manipulated directly in TSL Functions. + const cellOffsetUniform = uniform(0.5); + const cellSizeUniform = uniform(6); + const borderMaskUniform = uniform(1); + const pulseIntensityUniform = uniform(0.06); + const pulseWidthUniform = uniform(60); + const pulseRateUniform = uniform(20); + const wgslShaderSpeedUniform = uniform(1.0); + const tslShaderSpeedUniform = uniform(1.0); + + // + + const wgslShaderMaterial = new THREE.MeshBasicNodeMaterial(); + + // Accessed attributes correspond to a Mesh or BufferGeometry's setAttribute() calls. + wgslShaderMaterial.positionNode = wgslVertexShader({ + position: attribute('position'), + uv: attribute('uv'), + }); + + wgslShaderMaterial.fragmentNode = wgslFragmentShader({ + vUv: vUv, + tex: texture(planetTexture), + texSampler: sampler(planetTexture), + crtWidth: crtWidthUniform, + crtHeight: crtHeightUniform, + cellOffset: cellOffsetUniform, + cellSize: cellSizeUniform, + borderMask: borderMaskUniform, + time: time, + speed: wgslShaderSpeedUniform, + pulseIntensity: pulseIntensityUniform, + pulseWidth: pulseWidthUniform, + pulseRate: pulseRateUniform, + }); + + // + + const tslVertexShader = Fn(() => { + vUv.assign(uv()); + return positionGeometry; + }); + + const tslFragmentShader = Fn(() => { + const dimensions = vec2(crtWidthUniform, crtHeightUniform); + const translatedUV = vUv.mul(0.5).add(0.5); + const pixel = translatedUV.mul(dimensions); + + const coord = pixel.div(cellSizeUniform); + const subCoord = coord.mul(vec2(3.0, 1.0)); + + const cellOffset = vec2(0.0, fract(floor(coord.x).mul(cellOffsetUniform))); + + const maskCoord = floor(coord.add(cellOffset)).mul(cellSizeUniform); + const samplePoint = maskCoord.div(dimensions); + const scaledTime = time.mul(tslShaderSpeedUniform); + samplePoint.x = samplePoint.x.add(fract(scaledTime.div(20))); + samplePoint.y = samplePoint.y.sub(1.5); + + let color = texture(planetTexture, samplePoint); + + const ind = floor(subCoord.x).mod(3); + + let maskColor = vec3(ind.equal(0.0), ind.equal(1.0), ind.equal(2.0)).mul(3.0); + + const subCoordOffset = fract(subCoord.add(cellOffset)); + let cellUV = subCoordOffset.mul(2.0); + cellUV = cellUV.sub(1.0); + + const border = float(1.0).sub(cellUV.mul(cellUV).mul(borderMaskUniform)); + + const clampX = clamp(border.x, 0.0, 1.0); + const clampY = clamp(border.y, 0.0, 1.0); + const borderClamp = clampX.mul(clampY); + maskColor = maskColor.mul(borderClamp); + + color = color.mul(maskColor); + + const pixelDampen = pixel.y.div(pulseWidthUniform); + let pulse = sin(pixelDampen.add(time.mul(pulseRateUniform))); + pulse = pulse.mul(pulseIntensityUniform); + color = color.mul(float(1.0).add(pulse)); + + return color; + }); + + const tslShaderMaterial = new THREE.MeshBasicNodeMaterial(); + tslShaderMaterial.positionNode = tslVertexShader(); + tslShaderMaterial.colorNode = tslFragmentShader(); + + camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); + scene = new THREE.Scene(); + + const geometry = new THREE.PlaneGeometry(2, 1); + + const wgslQuad = new THREE.Mesh(geometry, wgslShaderMaterial); + wgslQuad.position.y += 0.5; + scene.add(wgslQuad); + + const tslQuad = new THREE.Mesh(geometry, tslShaderMaterial); + tslQuad.position.y -= 0.5; + scene.add(tslQuad); + + renderer = new THREE.WebGPURenderer({ antialias: true, canvas: canvas }); + renderer.setPixelRatio(dpr); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.outputColorSpace = THREE.LinearSRGBColorSpace; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + window.addEventListener('resize', onWindowResize); + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.add(cellSizeUniform, 'value', 6, 50, 1).name('Cell Size'); + gui.add(cellOffsetUniform, 'value', 0, 1, 0.1).name('Cell Offset'); + gui.add(borderMaskUniform, 'value', 0, 5, 0.1).name('Border Mask'); + gui.add(pulseIntensityUniform, 'value', 0, 0.5, 0.01).name('Pulse Intensity'); + gui.add(pulseWidthUniform, 'value', 10, 100, 5).name('Pulse Width'); + gui.add(wgslShaderSpeedUniform, 'value', 1, 10).name('WGSL Shader Speed'); + gui.add(tslShaderSpeedUniform, 'value', 1, 10).name('TSL Shader Speed'); +} + +init(); diff --git a/examples-testing/examples/webgpu_tsl_procedural_terrain.ts b/examples-testing/examples/webgpu_tsl_procedural_terrain.ts new file mode 100644 index 000000000..5630137b8 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_procedural_terrain.ts @@ -0,0 +1,318 @@ +import * as THREE from 'three/webgpu'; +import { + mx_noise_float, + color, + cross, + dot, + float, + transformNormalToView, + positionLocal, + sign, + step, + Fn, + uniform, + varying, + vec2, + vec3, + Loop, +} from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; + +let camera, scene, renderer, controls, drag; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-10, 8, -2.2); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x201919); + + // environment + + const hdrLoader = new HDRLoader(); + hdrLoader.load('./textures/equirectangular/pedestrian_overpass_1k.hdr', environmentMap => { + environmentMap.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = environmentMap; + scene.backgroundBlurriness = 0.5; + scene.environment = environmentMap; + }); + + // lights + + const directionalLight = new THREE.DirectionalLight('#ffffff', 2); + directionalLight.position.set(6.25, 3, 4); + directionalLight.castShadow = true; + directionalLight.shadow.mapSize.set(1024, 1024); + directionalLight.shadow.camera.near = 0.1; + directionalLight.shadow.camera.far = 30; + directionalLight.shadow.camera.top = 8; + directionalLight.shadow.camera.right = 8; + directionalLight.shadow.camera.bottom = -8; + directionalLight.shadow.camera.left = -8; + directionalLight.shadow.normalBias = 0.05; + scene.add(directionalLight); + + // terrain + + const material = new THREE.MeshStandardNodeMaterial({ + metalness: 0, + roughness: 0.5, + color: '#85d534', + }); + + const noiseIterations = uniform(3); + const positionFrequency = uniform(0.175); + const warpFrequency = uniform(6); + const warpStrength = uniform(1); + const strength = uniform(10); + const offset = uniform(vec2(0, 0)); + const normalLookUpShift = uniform(0.01); + const colorSand = uniform(color('#ffe894')); + const colorGrass = uniform(color('#85d534')); + const colorSnow = uniform(color('#ffffff')); + const colorRock = uniform(color('#bfbd8d')); + + const vNormal = varying(vec3()); + const vPosition = varying(vec3()); + + const terrainElevation = Fn(([position]) => { + const warpedPosition = position.add(offset).toVar(); + warpedPosition.addAssign( + mx_noise_float(warpedPosition.mul(positionFrequency).mul(warpFrequency), 1, 0).mul(warpStrength), + ); + + const elevation = float(0).toVar(); + Loop({ type: 'float', start: float(1), end: noiseIterations.toFloat(), condition: '<=' }, ({ i }) => { + const noiseInput = warpedPosition.mul(positionFrequency).mul(i.mul(2)).add(i.mul(987)); + const noise = mx_noise_float(noiseInput, 1, 0).div(i.add(1).mul(2)); + elevation.addAssign(noise); + }); + + const elevationSign = sign(elevation); + elevation.assign(elevation.abs().pow(2).mul(elevationSign).mul(strength)); + + return elevation; + }); + + material.positionNode = Fn(() => { + // neighbours positions + + const neighbourA = positionLocal.xyz.add(vec3(normalLookUpShift, 0.0, 0.0)).toVar(); + const neighbourB = positionLocal.xyz.add(vec3(0.0, 0.0, normalLookUpShift.negate())).toVar(); + + // elevations + + const position = positionLocal.xyz.toVar(); + const elevation = terrainElevation(positionLocal.xz); + position.y.addAssign(elevation); + + neighbourA.y.addAssign(terrainElevation(neighbourA.xz)); + neighbourB.y.addAssign(terrainElevation(neighbourB.xz)); + + // compute normal + + const toA = neighbourA.sub(position).normalize(); + const toB = neighbourB.sub(position).normalize(); + vNormal.assign(cross(toA, toB)); + + // varyings + + vPosition.assign(position.add(vec3(offset.x, 0, offset.y))); + + return position; + })(); + + material.normalNode = transformNormalToView(vNormal); + + material.colorNode = Fn(() => { + const finalColor = colorSand.toVar(); + + // grass + + const grassMix = step(-0.06, vPosition.y); + finalColor.assign(grassMix.mix(finalColor, colorGrass)); + + // rock + + const rockMix = step(0.5, dot(vNormal, vec3(0, 1, 0))) + .oneMinus() + .mul(step(-0.06, vPosition.y)); + finalColor.assign(rockMix.mix(finalColor, colorRock)); + + // snow + + const snowThreshold = mx_noise_float(vPosition.xz.mul(25), 1, 0).mul(0.1).add(0.45); + const snowMix = step(snowThreshold, vPosition.y); + finalColor.assign(snowMix.mix(finalColor, colorSnow)); + + return finalColor; + })(); + + const geometry = new THREE.PlaneGeometry(10, 10, 500, 500); + geometry.deleteAttribute('uv'); + geometry.deleteAttribute('normal'); + geometry.rotateX(-Math.PI * 0.5); + + const terrain = new THREE.Mesh(geometry, material); + terrain.receiveShadow = true; + terrain.castShadow = true; + scene.add(terrain); + + // water + + const water = new THREE.Mesh( + new THREE.PlaneGeometry(10, 10, 1, 1), + new THREE.MeshPhysicalMaterial({ + transmission: 1, + roughness: 0.5, + ior: 1.333, + color: '#4db2ff', + }), + ); + water.rotation.x = -Math.PI * 0.5; + water.position.y = -0.1; + scene.add(water); + + // drag + + drag = {}; + drag.screenCoords = new THREE.Vector2(); + drag.prevWorldCoords = new THREE.Vector3(); + drag.worldCoords = new THREE.Vector3(); + drag.raycaster = new THREE.Raycaster(); + drag.down = false; + drag.hover = false; + + drag.object = new THREE.Mesh(new THREE.PlaneGeometry(10, 10, 1, 1), new THREE.MeshBasicMaterial()); + drag.object.rotation.x = -Math.PI * 0.5; + drag.object.visible = false; + scene.add(drag.object); + + drag.getIntersect = () => { + drag.raycaster.setFromCamera(drag.screenCoords, camera); + const intersects = drag.raycaster.intersectObject(drag.object); + if (intersects.length) return intersects[0]; + + return null; + }; + + drag.update = () => { + const intersect = drag.getIntersect(); + + if (intersect) { + drag.hover = true; + + if (!drag.down) renderer.domElement.style.cursor = 'grab'; + } else { + drag.hover = false; + renderer.domElement.style.cursor = 'default'; + } + + if (drag.hover && drag.down) { + drag.worldCoords.copy(intersect.point); + const delta = drag.prevWorldCoords.sub(drag.worldCoords); + + offset.value.x += delta.x; + offset.value.y += delta.z; + } + + drag.prevWorldCoords.copy(drag.worldCoords); + }; + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.shadowMap.enabled = true; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // inspector + + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.inspector.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.maxPolarAngle = Math.PI * 0.45; + controls.target.y = -0.5; + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + // debug + + const gui = renderer.inspector.createParameters('Parameters'); + + const terrainGui = gui.addFolder('🏔️ terrain'); + + terrainGui.add(noiseIterations, 'value', 0, 10, 1).name('noiseIterations'); + terrainGui.add(positionFrequency, 'value', 0, 1, 0.001).name('positionFrequency'); + terrainGui.add(strength, 'value', 0, 20, 0.001).name('strength'); + terrainGui.add(warpFrequency, 'value', 0, 20, 0.001).name('warpFrequency'); + terrainGui.add(warpStrength, 'value', 0, 2, 0.001).name('warpStrength'); + + terrainGui.addColor({ color: colorSand.value }, 'color').name('colorSand'); + terrainGui.addColor({ color: colorGrass.value }, 'color').name('colorGrass'); + terrainGui.addColor({ color: colorSnow.value }, 'color').name('colorSnow'); + terrainGui.addColor({ color: colorRock.value }, 'color').name('colorRock'); + + const waterGui = gui.addFolder('💧 water'); + + waterGui.add(water.material, 'roughness', 0, 1, 0.01); + waterGui.add(water.material, 'ior', 1, 2, 0.001); + waterGui.addColor({ color: water.material.color }, 'color').name('color'); + + // events + + window.addEventListener('pointermove', event => { + drag.screenCoords.x = (event.clientX / window.innerWidth - 0.5) * 2; + drag.screenCoords.y = -(event.clientY / window.innerHeight - 0.5) * 2; + }); + + renderer.domElement.addEventListener('pointerdown', () => { + if (drag.hover) { + renderer.domElement.style.cursor = 'grabbing'; + controls.enabled = false; + drag.down = true; + drag.object.scale.setScalar(10); + + const intersect = drag.getIntersect(); + drag.prevWorldCoords.copy(intersect.point); + drag.worldCoords.copy(intersect.point); + } + }); + + window.addEventListener('pointerup', () => { + drag.down = false; + controls.enabled = true; + drag.object.scale.setScalar(1); + }); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + controls.update(); + + drag.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_raging_sea.ts b/examples-testing/examples/webgpu_tsl_raging_sea.ts new file mode 100644 index 000000000..cb513d075 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_raging_sea.ts @@ -0,0 +1,178 @@ +import * as THREE from 'three/webgpu'; +import { + float, + mx_noise_float, + Loop, + color, + positionLocal, + sin, + vec2, + vec3, + mul, + time, + uniform, + Fn, + transformNormalToView, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(1.25, 1.25, 1.25); + + scene = new THREE.Scene(); + + // lights + + const directionalLight = new THREE.DirectionalLight('#ffffff', 3); + directionalLight.position.set(-4, 2, 0); + scene.add(directionalLight); + + // material + + const material = new THREE.MeshStandardNodeMaterial({ color: '#271442', roughness: 0.15 }); + + const emissiveColor = uniform(color('#ff0a81')); + const emissiveLow = uniform(-0.25); + const emissiveHigh = uniform(0.2); + const emissivePower = uniform(7); + const largeWavesFrequency = uniform(vec2(3, 1)); + const largeWavesSpeed = uniform(1.25); + const largeWavesMultiplier = uniform(0.15); + const smallWavesIterations = uniform(3); + const smallWavesFrequency = uniform(2); + const smallWavesSpeed = uniform(0.3); + const smallWavesMultiplier = uniform(0.18); + const normalComputeShift = uniform(0.01); + + // TSL functions + + const wavesElevation = Fn(([position]) => { + // large waves + + const elevation = mul( + sin(position.x.mul(largeWavesFrequency.x).add(time.mul(largeWavesSpeed))), + sin(position.z.mul(largeWavesFrequency.y).add(time.mul(largeWavesSpeed))), + largeWavesMultiplier, + ).toVar(); + + Loop({ start: float(1), end: smallWavesIterations.add(1) }, ({ i }) => { + const noiseInput = vec3( + position.xz + .add(2) // avoids a-hole pattern + .mul(smallWavesFrequency) + .mul(i), + time.mul(smallWavesSpeed), + ); + + const wave = mx_noise_float(noiseInput, 1, 0).mul(smallWavesMultiplier).div(i).abs(); + + elevation.subAssign(wave); + }); + + return elevation; + }); + + // position + + const elevation = wavesElevation(positionLocal); + const position = positionLocal.add(vec3(0, elevation, 0)); + + material.positionNode = position; + + // normals + + let positionA = positionLocal.add(vec3(normalComputeShift, 0, 0)); + let positionB = positionLocal.add(vec3(0, 0, normalComputeShift.negate())); + + positionA = positionA.add(vec3(0, wavesElevation(positionA), 0)); + positionB = positionB.add(vec3(0, wavesElevation(positionB), 0)); + + const toA = positionA.sub(position).normalize(); + const toB = positionB.sub(position).normalize(); + const normal = toA.cross(toB); + + material.normalNode = transformNormalToView(normal); + + // emissive + + const emissive = elevation.remap(emissiveHigh, emissiveLow).pow(emissivePower); + material.emissiveNode = emissiveColor.mul(emissive); + + // mesh + + const geometry = new THREE.PlaneGeometry(2, 2, 256, 256); + geometry.rotateX(-Math.PI * 0.5); + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.y = -0.25; + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + // debug + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.addColor({ color: material.color.getHex(THREE.SRGBColorSpace) }, 'color') + .name('color') + .onChange(value => material.color.set(value)); + gui.add(material, 'roughness', 0, 1, 0.001); + + const colorGui = gui.addFolder('emissive'); + colorGui + .addColor({ color: emissiveColor.value.getHex(THREE.SRGBColorSpace) }, 'color') + .name('color') + .onChange(value => emissiveColor.value.set(value)); + colorGui.add(emissiveLow, 'value', -1, 0, 0.001).name('low'); + colorGui.add(emissiveHigh, 'value', 0, 1, 0.001).name('high'); + colorGui.add(emissivePower, 'value', 1, 10, 1).name('power'); + + const wavesGui = gui.addFolder('waves'); + wavesGui.add(largeWavesSpeed, 'value', 0, 5).name('largeSpeed'); + wavesGui.add(largeWavesMultiplier, 'value', 0, 1).name('largeMultiplier'); + wavesGui.add(largeWavesFrequency.value, 'x', 0, 10).name('largeFrequencyX'); + wavesGui.add(largeWavesFrequency.value, 'y', 0, 10).name('largeFrequencyY'); + wavesGui.add(smallWavesIterations, 'value', 0, 5, 1).name('smallIterations'); + wavesGui.add(smallWavesFrequency, 'value', 0, 10).name('smallFrequency'); + wavesGui.add(smallWavesSpeed, 'value', 0, 1).name('smallSpeed'); + wavesGui.add(smallWavesMultiplier, 'value', 0, 1).name('smallMultiplier'); + wavesGui.add(normalComputeShift, 'value', 0, 0.1, 0.0001).name('normalComputeShift'); + + // events + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_vfx_flames.ts b/examples-testing/examples/webgpu_tsl_vfx_flames.ts new file mode 100644 index 000000000..61a142400 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_vfx_flames.ts @@ -0,0 +1,203 @@ +import * as THREE from 'three/webgpu'; +import { + TWO_PI, + oneMinus, + spherizeUV, + sin, + step, + texture, + time, + Fn, + uv, + vec2, + vec3, + vec4, + mix, + billboarding, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(1, 1, 3); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x201919); + + // textures + + const textureLoader = new THREE.TextureLoader(); + + const cellularTexture = textureLoader.load('./textures/noises/voronoi/grayscale-256x256.png'); + const perlinTexture = textureLoader.load('./textures/noises/perlin/rgb-256x256.png'); + + // gradient canvas + + const gradient = {}; + gradient.element = document.createElement('canvas'); + gradient.element.width = 128; + gradient.element.height = 1; + gradient.context = gradient.element.getContext('2d'); + + gradient.colors = ['#090033', '#5f1f93', '#e02e96', '#ffbd80', '#fff0db']; + + gradient.texture = new THREE.CanvasTexture(gradient.element); + gradient.texture.colorSpace = THREE.SRGBColorSpace; + + gradient.update = () => { + const fillGradient = gradient.context.createLinearGradient(0, 0, gradient.element.width, 0); + + for (let i = 0; i < gradient.colors.length; i++) { + const progress = i / (gradient.colors.length - 1); + const color = gradient.colors[i]; + fillGradient.addColorStop(progress, color); + } + + gradient.context.fillStyle = fillGradient; + gradient.context.fillRect(0, 0, gradient.element.width, gradient.element.height); + + gradient.texture.needsUpdate = true; + }; + + gradient.update(); + + // flame 1 material + + const flame1Material = new THREE.SpriteNodeMaterial({ side: THREE.DoubleSide }); + + flame1Material.colorNode = Fn(() => { + // main UV + const mainUv = uv().toVar(); + mainUv.assign(spherizeUV(mainUv, 10).mul(0.6).add(0.2)); // spherize + mainUv.assign(mainUv.pow(vec2(1, 2))); // stretch + mainUv.assign(mainUv.mul(2, 1).sub(vec2(0.5, 0))); // scale + + // gradients + const gradient1 = sin(time.mul(10).sub(mainUv.y.mul(TWO_PI).mul(2))).toVar(); + const gradient2 = mainUv.y.smoothstep(0, 1).toVar(); + mainUv.x.addAssign(gradient1.mul(gradient2).mul(0.2)); + + // cellular noise + const cellularUv = mainUv + .mul(0.5) + .add(vec2(0, time.negate().mul(0.5))) + .mod(1); + const cellularNoise = texture(cellularTexture, cellularUv, 0).r.oneMinus().smoothstep(0, 0.5).oneMinus(); + cellularNoise.mulAssign(gradient2); + + // shape + const shape = mainUv.sub(0.5).mul(vec2(3, 2)).length().oneMinus().toVar(); + shape.assign(shape.sub(cellularNoise)); + + // gradient color + const gradientColor = texture(gradient.texture, vec2(shape.remap(0, 1, 0, 1), 0)); + + // output + const color = mix(gradientColor, vec3(1), shape.step(0.8)); + const alpha = shape.smoothstep(0, 0.3); + return vec4(color.rgb, alpha); + })(); + + // flame 2 material + + const flame2Material = new THREE.SpriteNodeMaterial({ side: THREE.DoubleSide }); + + flame2Material.colorNode = Fn(() => { + // main UV + const mainUv = uv().toVar(); + mainUv.assign(spherizeUV(mainUv, 10).mul(0.6).add(0.2)); // spherize + mainUv.assign(mainUv.abs().pow(vec2(1, 3)).mul(mainUv.sign())); // stretch + mainUv.assign(mainUv.mul(2, 1).sub(vec2(0.5, 0))); // scale + + // perlin noise + const perlinUv = mainUv.add(vec2(0, time.negate().mul(1))).mod(1); + const perlinNoise = texture(perlinTexture, perlinUv, 0).sub(0.5).mul(1); + mainUv.x.addAssign(perlinNoise.x.mul(0.5)); + + // gradients + const gradient1 = sin(time.mul(10).sub(mainUv.y.mul(TWO_PI).mul(2))); + const gradient2 = mainUv.y.smoothstep(0, 1); + const gradient3 = oneMinus(mainUv.y).smoothstep(0, 0.3); + mainUv.x.addAssign(gradient1.mul(gradient2).mul(0.2)); + + // displaced perlin noise + const displacementPerlinUv = mainUv + .mul(0.5) + .add(vec2(0, time.negate().mul(0.25))) + .mod(1); + const displacementPerlinNoise = texture(perlinTexture, displacementPerlinUv, 0).sub(0.5).mul(1); + const displacedPerlinUv = mainUv + .add(vec2(0, time.negate().mul(0.5))) + .add(displacementPerlinNoise) + .mod(1); + const displacedPerlinNoise = texture(perlinTexture, displacedPerlinUv, 0).sub(0.5).mul(1); + mainUv.x.addAssign(displacedPerlinNoise.mul(0.5)); + + // cellular noise + const cellularUv = mainUv.add(vec2(0, time.negate().mul(1.5))).mod(1); + const cellularNoise = texture(cellularTexture, cellularUv, 0).r.oneMinus().smoothstep(0.25, 1); + + // shape + const shape = step(mainUv.sub(0.5).mul(vec2(6, 1)).length(), 0.5); + shape.assign(shape.mul(cellularNoise)); + shape.mulAssign(gradient3); + shape.assign(step(0.01, shape)); + + // output + return vec4(vec3(1), shape); + })(); + + // billboarding - follow the camera rotation only horizontally + + flame1Material.vertexNode = billboarding({ horizontalRotation: true }); + flame2Material.vertexNode = billboarding({ horizontalRotation: true }); + + // meshes + + const flame1 = new THREE.Sprite(flame1Material); + flame1.center.set(0.5, 0); + flame1.scale.x = 0.5; // optional + flame1.position.x = -0.5; + scene.add(flame1); + + const flame2 = new THREE.Sprite(flame2Material); + flame2.center.set(0.5, 0); + flame2.position.x = 0.5; + scene.add(flame2); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + controls.update(); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts b/examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts new file mode 100644 index 000000000..e220c164b --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts @@ -0,0 +1,445 @@ +import * as THREE from 'three/webgpu'; +import { + atan, + cos, + float, + max, + min, + mix, + PI, + TWO_PI, + sin, + vec2, + vec3, + color, + Fn, + hash, + hue, + If, + instanceIndex, + Loop, + mx_fractal_noise_float, + mx_fractal_noise_vec3, + pass, + pcurve, + storage, + deltaTime, + time, + uv, + uniform, + step, +} from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +let camera, scene, renderer, renderPipeline, controls, timer, light; + +let updateParticles, spawnParticles; // TSL compute nodes +let getInstanceColor; // TSL function + +const screenPointer = new THREE.Vector2(); +const scenePointer = new THREE.Vector3(); +const raycastPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0); +const raycaster = new THREE.Raycaster(); + +const nbParticles = Math.pow(2, 13); + +const timeScale = uniform(1.0); +const particleLifetime = uniform(0.5); +const particleSize = uniform(1.0); +const linksWidth = uniform(0.005); + +const colorOffset = uniform(0.0); +const colorVariance = uniform(2.0); +const colorRotationSpeed = uniform(1.0); + +const spawnIndex = uniform(0); +const nbToSpawn = uniform(5); +const spawnPosition = uniform(vec3(0.0)); +const previousSpawnPosition = uniform(vec3(0.0)); + +const turbFrequency = uniform(0.5); +const turbAmplitude = uniform(0.5); +const turbOctaves = uniform(2); +const turbLacunarity = uniform(2.0); +const turbGain = uniform(0.5); +const turbFriction = uniform(0.01); + +init(); + +async function init() { + if (WebGPU.isAvailable() === false) { + document.body.appendChild(WebGPU.getErrorMessage()); + + throw new Error('No WebGPU support'); + } + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 200); + camera.position.set(0, 0, 10); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setClearColor(0x14171a); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + // TSL function + // current color from index + getInstanceColor = Fn(([i]) => { + return hue( + color(0x0000ff), + colorOffset.add(mx_fractal_noise_float(i.toFloat().mul(0.1), 2, 2.0, 0.5, colorVariance)), + ); + }); + + // Particles + // storage buffers + const particlePositions = storage(new THREE.StorageInstancedBufferAttribute(nbParticles, 4), 'vec4', nbParticles); + const particleVelocities = storage(new THREE.StorageInstancedBufferAttribute(nbParticles, 4), 'vec4', nbParticles); + + // init particles buffers + renderer.compute( + Fn(() => { + particlePositions.element(instanceIndex).xyz.assign(vec3(10000.0)); + particlePositions.element(instanceIndex).w.assign(vec3(-1.0)); // life is stored in w component; x<0 means dead + })().compute(nbParticles), + ); + + // particles output + const particleQuadSize = 0.05; + const particleGeom = new THREE.PlaneGeometry(particleQuadSize, particleQuadSize); + + const particleMaterial = new THREE.SpriteNodeMaterial(); + particleMaterial.blending = THREE.AdditiveBlending; + particleMaterial.depthWrite = false; + particleMaterial.positionNode = particlePositions.toAttribute(); + particleMaterial.scaleNode = vec2(particleSize); + particleMaterial.rotationNode = atan(particleVelocities.toAttribute().y, particleVelocities.toAttribute().x); + + particleMaterial.colorNode = Fn(() => { + const life = particlePositions.toAttribute().w; + const modLife = pcurve(life.oneMinus(), 8.0, 1.0); + const pulse = pcurve( + sin(hash(instanceIndex).mul(TWO_PI).add(time.mul(0.5).mul(TWO_PI))) + .mul(0.5) + .add(0.5), + 0.25, + 0.25, + ) + .mul(10.0) + .add(1.0); + + return getInstanceColor(instanceIndex).mul(pulse.mul(modLife)); + })(); + + particleMaterial.opacityNode = Fn(() => { + const circle = step(uv().xy.sub(0.5).length(), 0.5); + const life = particlePositions.toAttribute().w; + + return circle.mul(life); + })(); + + const particleMesh = new THREE.InstancedMesh(particleGeom, particleMaterial, nbParticles); + particleMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); + particleMesh.frustumCulled = false; + + scene.add(particleMesh); + + // Links between particles + // first, we define the indices for the links, 2 quads per particle, the indexation is fixed + const linksIndices = []; + for (let i = 0; i < nbParticles; i++) { + const baseIndex = i * 8; + for (let j = 0; j < 2; j++) { + const offset = baseIndex + j * 4; + linksIndices.push(offset, offset + 1, offset + 2, offset, offset + 2, offset + 3); + } + } + + // storage buffers attributes for the links + const nbVertices = nbParticles * 8; + const linksVerticesSBA = new THREE.StorageBufferAttribute(nbVertices, 4); + const linksColorsSBA = new THREE.StorageBufferAttribute(nbVertices, 4); + + // links output + const linksGeom = new THREE.BufferGeometry(); + linksGeom.setAttribute('position', linksVerticesSBA); + linksGeom.setAttribute('color', linksColorsSBA); + linksGeom.setIndex(linksIndices); + + const linksMaterial = new THREE.MeshBasicNodeMaterial(); + linksMaterial.vertexColors = true; + linksMaterial.side = THREE.DoubleSide; + linksMaterial.transparent = true; + linksMaterial.depthWrite = false; + linksMaterial.depthTest = false; + linksMaterial.blending = THREE.AdditiveBlending; + linksMaterial.opacityNode = storage(linksColorsSBA, 'vec4', linksColorsSBA.count).toAttribute().w; + + const linksMesh = new THREE.Mesh(linksGeom, linksMaterial); + linksMesh.frustumCulled = false; + scene.add(linksMesh); + + // compute nodes + updateParticles = Fn(() => { + const position = particlePositions.element(instanceIndex).xyz; + const life = particlePositions.element(instanceIndex).w; + const velocity = particleVelocities.element(instanceIndex).xyz; + const dt = deltaTime.mul(0.1).mul(timeScale); + + If(life.greaterThan(0.0), () => { + // first we update the particles positions and velocities + // velocity comes from a turbulence field, and is multiplied by the particle lifetime so that it slows down over time + const localVel = mx_fractal_noise_vec3( + position.mul(turbFrequency), + turbOctaves, + turbLacunarity, + turbGain, + turbAmplitude, + ).mul(life.add(0.01)); + velocity.addAssign(localVel); + velocity.mulAssign(turbFriction.oneMinus()); + position.addAssign(velocity.mul(dt)); + + // then we decrease the lifetime + life.subAssign(dt.mul(particleLifetime.reciprocal())); + + // then we find the two closest particles and set a quad to each of them + const closestDist1 = float(10000.0).toVar(); + const closestPos1 = vec3(0.0).toVar(); + const closestLife1 = float(0.0).toVar(); + const closestDist2 = float(10000.0).toVar(); + const closestPos2 = vec3(0.0).toVar(); + const closestLife2 = float(0.0).toVar(); + + Loop(nbParticles, ({ i }) => { + const otherPart = particlePositions.element(i); + + If(i.notEqual(instanceIndex).and(otherPart.w.greaterThan(0.0)), () => { + // if not self and other particle is alive + + const otherPosition = otherPart.xyz; + const dist = position.sub(otherPosition).lengthSq(); + const moreThanZero = dist.greaterThan(0.0); + + If(dist.lessThan(closestDist1).and(moreThanZero), () => { + closestDist1.assign(dist); + closestPos1.assign(otherPosition.xyz); + closestLife1.assign(otherPart.w); + }).ElseIf(dist.lessThan(closestDist2).and(moreThanZero), () => { + closestDist2.assign(dist); + closestPos2.assign(otherPosition.xyz); + closestLife2.assign(otherPart.w); + }); + }); + }); + + // then we update the links correspondingly + const linksPositions = storage(linksVerticesSBA, 'vec4', linksVerticesSBA.count); + const linksColors = storage(linksColorsSBA, 'vec4', linksColorsSBA.count); + const firstLinkIndex = instanceIndex.mul(8); + const secondLinkIndex = firstLinkIndex.add(4); + + // positions link 1 + linksPositions.element(firstLinkIndex).xyz.assign(position); + linksPositions.element(firstLinkIndex).y.addAssign(linksWidth); + linksPositions.element(firstLinkIndex.add(1)).xyz.assign(position); + linksPositions.element(firstLinkIndex.add(1)).y.addAssign(linksWidth.negate()); + linksPositions.element(firstLinkIndex.add(2)).xyz.assign(closestPos1); + linksPositions.element(firstLinkIndex.add(2)).y.addAssign(linksWidth.negate()); + linksPositions.element(firstLinkIndex.add(3)).xyz.assign(closestPos1); + linksPositions.element(firstLinkIndex.add(3)).y.addAssign(linksWidth); + + // positions link 2 + linksPositions.element(secondLinkIndex).xyz.assign(position); + linksPositions.element(secondLinkIndex).y.addAssign(linksWidth); + linksPositions.element(secondLinkIndex.add(1)).xyz.assign(position); + linksPositions.element(secondLinkIndex.add(1)).y.addAssign(linksWidth.negate()); + linksPositions.element(secondLinkIndex.add(2)).xyz.assign(closestPos2); + linksPositions.element(secondLinkIndex.add(2)).y.addAssign(linksWidth.negate()); + linksPositions.element(secondLinkIndex.add(3)).xyz.assign(closestPos2); + linksPositions.element(secondLinkIndex.add(3)).y.addAssign(linksWidth); + + // colors are the same for all vertices of both quads + const linkColor = getInstanceColor(instanceIndex); + + // store the minimum lifetime of the closest particles in the w component of colors + const l1 = max(0.0, min(closestLife1, life)).pow(0.8); // pow is here to apply a slight curve to the opacity + const l2 = max(0.0, min(closestLife2, life)).pow(0.8); + + Loop(4, ({ i }) => { + linksColors.element(firstLinkIndex.add(i)).xyz.assign(linkColor); + linksColors.element(firstLinkIndex.add(i)).w.assign(l1); + linksColors.element(secondLinkIndex.add(i)).xyz.assign(linkColor); + linksColors.element(secondLinkIndex.add(i)).w.assign(l2); + }); + }); + })() + .compute(nbParticles) + .setName('Update Particles'); + + spawnParticles = Fn(() => { + const particleIndex = spawnIndex.add(instanceIndex).mod(nbParticles).toInt(); + const position = particlePositions.element(particleIndex).xyz; + const life = particlePositions.element(particleIndex).w; + const velocity = particleVelocities.element(particleIndex).xyz; + + life.assign(1.0); // sets it alive + + // random spherical direction + const rRange = float(0.01); + const rTheta = hash(particleIndex).mul(TWO_PI); + const rPhi = hash(particleIndex.add(1)).mul(PI); + const rx = sin(rTheta).mul(cos(rPhi)); + const ry = sin(rTheta).mul(sin(rPhi)); + const rz = cos(rTheta); + const rDir = vec3(rx, ry, rz); + + // position is interpolated between the previous cursor position and the current one over the number of particles spawned + const pos = mix( + previousSpawnPosition, + spawnPosition, + instanceIndex.toFloat().div(nbToSpawn.sub(1).toFloat()).clamp(), + ); + position.assign(pos.add(rDir.mul(rRange))); + + // start in that direction + velocity.assign(rDir.mul(5.0)); + })() + .compute(nbToSpawn.value) + .setName('Spawn Particles'); + + // background , an inverted icosahedron + const backgroundGeom = new THREE.IcosahedronGeometry(100, 5).applyMatrix4(new THREE.Matrix4().makeScale(-1, 1, 1)); + const backgroundMaterial = new THREE.MeshStandardNodeMaterial(); + backgroundMaterial.roughness = 0.4; + backgroundMaterial.metalness = 0.9; + backgroundMaterial.flatShading = true; + backgroundMaterial.colorNode = color(0x0); + + const backgroundMesh = new THREE.Mesh(backgroundGeom, backgroundMaterial); + scene.add(backgroundMesh); + + // light for the background + light = new THREE.PointLight(0xffffff, 3000); + scene.add(light); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode('output'); + + const bloomPass = bloom(scenePassColor, 0.75, 0.1, 0.5); + + renderPipeline.outputNode = scenePassColor.add(bloomPass); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.autoRotate = true; + controls.maxDistance = 75; + window.addEventListener('resize', onWindowResize); + + // pointer handling + + window.addEventListener('pointermove', onPointerMove); + + // GUI + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.add(controls, 'autoRotate').name('Auto Rotate'); + gui.add(controls, 'autoRotateSpeed', -10.0, 10.0, 0.01).name('Auto Rotate Speed'); + + const partFolder = gui.addFolder('Particles'); + partFolder.add(timeScale, 'value', 0.0, 4.0, 0.01).name('timeScale'); + partFolder.add(nbToSpawn, 'value', 1, 100, 1).name('Spawn rate'); + partFolder.add(particleSize, 'value', 0.01, 3.0, 0.01).name('Size'); + partFolder.add(particleLifetime, 'value', 0.01, 2.0, 0.01).name('Lifetime'); + partFolder.add(linksWidth, 'value', 0.001, 0.1, 0.001).name('Links width'); + partFolder.add(colorVariance, 'value', 0.0, 10.0, 0.01).name('Color variance'); + partFolder.add(colorRotationSpeed, 'value', 0.0, 5.0, 0.01).name('Color rotation speed'); + + const turbFolder = gui.addFolder('Turbulence'); + turbFolder.add(turbFriction, 'value', 0.0, 0.3, 0.01).name('Friction'); + turbFolder.add(turbFrequency, 'value', 0.0, 1.0, 0.01).name('Frequency'); + turbFolder.add(turbAmplitude, 'value', 0.0, 10.0, 0.01).name('Amplitude'); + turbFolder.add(turbOctaves, 'value', 1, 9, 1).name('Octaves'); + turbFolder.add(turbLacunarity, 'value', 1.0, 5.0, 0.01).name('Lacunarity'); + turbFolder.add(turbGain, 'value', 0.0, 1.0, 0.01).name('Gain'); + + const bloomFolder = gui.addFolder('bloom'); + bloomFolder.add(bloomPass.threshold, 'value', 0, 2.0, 0.01).name('Threshold'); + bloomFolder.add(bloomPass.strength, 'value', 0, 10, 0.01).name('Strength'); + bloomFolder.add(bloomPass.radius, 'value', 0, 1, 0.01).name('Radius'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerMove(e) { + screenPointer.x = (e.clientX / window.innerWidth) * 2 - 1; + screenPointer.y = -(e.clientY / window.innerHeight) * 2 + 1; +} + +function updatePointer() { + raycaster.setFromCamera(screenPointer, camera); + raycaster.ray.intersectPlane(raycastPlane, scenePointer); +} + +function animate() { + timer.update(); + + // compute particles + renderer.compute(updateParticles); + renderer.compute(spawnParticles); + + // update particle index for next spawn + spawnIndex.value = (spawnIndex.value + nbToSpawn.value) % nbParticles; + + // update raycast plane to face camera + raycastPlane.normal.applyEuler(camera.rotation); + updatePointer(); + + // lerping spawn position + previousSpawnPosition.value.copy(spawnPosition.value); + spawnPosition.value.lerp(scenePointer, 0.1); + + // rotating colors + colorOffset.value += timer.getDelta() * colorRotationSpeed.value * timeScale.value; + + const elapsedTime = timer.getElapsed(); + light.position.set( + Math.sin(elapsedTime * 0.5) * 30, + Math.cos(elapsedTime * 0.3) * 30, + Math.sin(elapsedTime * 0.2) * 30, + ); + + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_tsl_vfx_tornado.ts b/examples-testing/examples/webgpu_tsl_vfx_tornado.ts new file mode 100644 index 000000000..625a9d209 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_vfx_tornado.ts @@ -0,0 +1,289 @@ +import * as THREE from 'three/webgpu'; +import { + luminance, + cos, + min, + time, + atan, + uniform, + pass, + PI, + TWO_PI, + color, + positionLocal, + sin, + texture, + Fn, + uv, + vec2, + vec3, + vec4, +} from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let camera, scene, renderer, renderPipeline, controls; + +init(); + +function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 50); + camera.position.set(1, 1, 3); + + scene = new THREE.Scene(); + + // textures + + const textureLoader = new THREE.TextureLoader(); + const perlinTexture = textureLoader.load('./textures/noises/perlin/rgb-256x256.png'); + perlinTexture.wrapS = THREE.RepeatWrapping; + perlinTexture.wrapT = THREE.RepeatWrapping; + + // TSL functions + + const toRadialUv = Fn(([uv, multiplier, rotation, offset]) => { + const centeredUv = uv.sub(0.5).toVar(); + const distanceToCenter = centeredUv.length(); + const angle = atan(centeredUv.y, centeredUv.x); + const radialUv = vec2(angle.add(PI).div(TWO_PI), distanceToCenter).toVar(); + radialUv.mulAssign(multiplier); + radialUv.x.addAssign(rotation); + radialUv.y.addAssign(offset); + + return radialUv; + }); + + const toSkewedUv = Fn(([uv, skew]) => { + return vec2(uv.x.add(uv.y.mul(skew.x)), uv.y.add(uv.x.mul(skew.y))); + }); + + const twistedCylinder = Fn(([position, parabolStrength, parabolOffset, parabolAmplitude, time]) => { + const angle = atan(position.z, position.x).toVar(); + const elevation = position.y; + + // parabol + const radius = parabolStrength.mul(position.y.sub(parabolOffset)).pow(2).add(parabolAmplitude).toVar(); + + // turbulences + radius.addAssign(sin(elevation.sub(time).mul(20).add(angle.mul(2))).mul(0.05)); + + const twistedPosition = vec3(cos(angle).mul(radius), elevation, sin(angle).mul(radius)); + + return twistedPosition; + }); + + // uniforms + + const emissiveColor = uniform(color('#ff8b4d')); + const timeScale = uniform(0.2); + const parabolStrength = uniform(1); + const parabolOffset = uniform(0.3); + const parabolAmplitude = uniform(0.2); + + // tornado floor + + const floorMaterial = new THREE.MeshBasicNodeMaterial({ transparent: true, wireframe: false }); + + floorMaterial.outputNode = Fn(() => { + const scaledTime = time.mul(timeScale); + + // noise 1 + const noise1Uv = toRadialUv(uv(), vec2(0.5, 0.5), scaledTime, scaledTime); + noise1Uv.assign(toSkewedUv(noise1Uv, vec2(-1, 0))); + noise1Uv.mulAssign(vec2(4, 1)); + const noise1 = texture(perlinTexture, noise1Uv, 1).r.remap(0.45, 0.7); + + // noise 2 + const noise2Uv = toRadialUv(uv(), vec2(2, 8), scaledTime.mul(2), scaledTime.mul(8)); + noise2Uv.assign(toSkewedUv(noise2Uv, vec2(-0.25, 0))); + noise2Uv.mulAssign(vec2(2, 0.25)); + const noise2 = texture(perlinTexture, noise2Uv, 1).b.remap(0.45, 0.7); + + // outer fade + const distanceToCenter = uv().sub(0.5).toVar(); + const outerFade = min( + distanceToCenter.length().oneMinus().smoothstep(0.5, 0.9), + distanceToCenter.length().smoothstep(0, 0.2), + ); + + // effect + const effect = noise1.mul(noise2).mul(outerFade).toVar(); + + // output + return vec4( + emissiveColor.mul(effect.step(0.2)).mul(3), // Emissive + effect.smoothstep(0, 0.01), // Alpha + ); + })(); + + const floor = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), floorMaterial); + floor.rotation.x = -Math.PI * 0.5; + scene.add(floor); + + // tornado cylinder geometry + + const cylinderGeometry = new THREE.CylinderGeometry(1, 1, 1, 20, 20, true); + cylinderGeometry.translate(0, 0.5, 0); + + // tornado emissive cylinder + + const emissiveMaterial = new THREE.MeshBasicNodeMaterial({ + transparent: true, + side: THREE.DoubleSide, + wireframe: false, + }); + + emissiveMaterial.positionNode = twistedCylinder( + positionLocal, + parabolStrength, + parabolOffset, + parabolAmplitude.sub(0.05), + time.mul(timeScale), + ); + + emissiveMaterial.outputNode = Fn(() => { + const scaledTime = time.mul(timeScale); + + // noise 1 + const noise1Uv = uv().add(vec2(scaledTime, scaledTime.negate())).toVar(); + noise1Uv.assign(toSkewedUv(noise1Uv, vec2(-1, 0))); + noise1Uv.mulAssign(vec2(2, 0.25)); + const noise1 = texture(perlinTexture, noise1Uv, 1).r.remap(0.45, 0.7); + + // noise 2 + const noise2Uv = uv() + .add(vec2(scaledTime.mul(0.5), scaledTime.negate())) + .toVar(); + noise2Uv.assign(toSkewedUv(noise2Uv, vec2(-1, 0))); + noise2Uv.mulAssign(vec2(5, 1)); + const noise2 = texture(perlinTexture, noise2Uv, 1).g.remap(0.45, 0.7); + + // outer fade + const outerFade = min(uv().y.smoothstep(0, 0.1), uv().y.oneMinus().smoothstep(0, 0.4)); + + // effect + const effect = noise1.mul(noise2).mul(outerFade); + + const emissiveColorLuminance = luminance(emissiveColor); + + // output + return vec4( + emissiveColor.mul(1.2).div(emissiveColorLuminance), // emissive + effect.smoothstep(0, 0.1), // alpha + ); + })(); + + const emissive = new THREE.Mesh(cylinderGeometry, emissiveMaterial); + emissive.scale.set(1, 1, 1); + scene.add(emissive); + + // tornado dark cylinder + + const darkMaterial = new THREE.MeshBasicNodeMaterial({ + transparent: true, + side: THREE.DoubleSide, + wireframe: false, + }); + + darkMaterial.positionNode = twistedCylinder( + positionLocal, + parabolStrength, + parabolOffset, + parabolAmplitude, + time.mul(timeScale), + ); + + darkMaterial.outputNode = Fn(() => { + const scaledTime = time.mul(timeScale).add(123.4); + + // noise 1 + const noise1Uv = uv().add(vec2(scaledTime, scaledTime.negate())).toVar(); + noise1Uv.assign(toSkewedUv(noise1Uv, vec2(-1, 0))); + noise1Uv.mulAssign(vec2(2, 0.25)); + const noise1 = texture(perlinTexture, noise1Uv, 1).g.remap(0.45, 0.7); + + // noise 2 + const noise2Uv = uv() + .add(vec2(scaledTime.mul(0.5), scaledTime.negate())) + .toVar(); + noise2Uv.assign(toSkewedUv(noise2Uv, vec2(-1, 0))); + noise2Uv.mulAssign(vec2(5, 1)); + const noise2 = texture(perlinTexture, noise2Uv, 1).b.remap(0.45, 0.7); + + // outer fade + const outerFade = min(uv().y.smoothstep(0, 0.2), uv().y.oneMinus().smoothstep(0, 0.4)); + + // effect + const effect = noise1.mul(noise2).mul(outerFade); + + return vec4(vec3(0), effect.smoothstep(0, 0.01)); + })(); + + const dark = new THREE.Mesh(cylinderGeometry, darkMaterial); + dark.scale.set(1, 1, 1); + scene.add(dark); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setClearColor(0x201919); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // post processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera); + const scenePassColor = scenePass.getTextureNode('output'); + + const bloomPass = bloom(scenePassColor, 1, 0.1, 1); + + renderPipeline.outputNode = scenePassColor.add(bloomPass); + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.y = 0.4; + controls.enableDamping = true; + controls.minDistance = 0.1; + controls.maxDistance = 50; + + window.addEventListener('resize', onWindowResize); + + // debug + + const gui = renderer.inspector.createParameters('Parameters'); + + gui.addColor({ color: emissiveColor.value.getHexString(THREE.SRGBColorSpace) }, 'color') + .onChange(value => emissiveColor.value.set(value)) + .name('emissiveColor'); + gui.add(timeScale, 'value', -1, 1, 0.01).name('timeScale'); + gui.add(parabolStrength, 'value', 0, 2, 0.01).name('parabolStrength'); + gui.add(parabolOffset, 'value', 0, 1, 0.01).name('parabolOffset'); + gui.add(parabolAmplitude, 'value', 0, 2, 0.01).name('parabolAmplitude'); + + const bloomGui = gui.addFolder('bloom'); + bloomGui.add(bloomPass.strength, 'value', 0, 10, 0.01).name('strength'); + bloomGui.add(bloomPass.radius, 'value', 0, 1, 0.01).name('radius'); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +async function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_tsl_wood.ts b/examples-testing/examples/webgpu_tsl_wood.ts new file mode 100644 index 000000000..5a4e06502 --- /dev/null +++ b/examples-testing/examples/webgpu_tsl_wood.ts @@ -0,0 +1,249 @@ +import * as THREE from 'three'; +import * as TSL from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import WebGPU from 'three/addons/capabilities/WebGPU.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { FontLoader } from 'three/addons/loaders/FontLoader.js'; +import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; + +import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; +import { WoodNodeMaterial, WoodGenuses, Finishes } from 'three/addons/materials/WoodNodeMaterial.js'; + +let scene, base, camera, renderer, controls, font, blockGeometry, gui; + +// Helper function to get grid position +function getGridPosition(woodIndex, finishIndex) { + return { + x: 0, + y: (finishIndex - Finishes.length / 2) * 1.0, + z: (woodIndex - WoodGenuses.length / 2 + 0.45) * 1.0, + }; +} + +// Helper function to create the grid plane +function createGridPlane() { + const material = new THREE.MeshBasicNodeMaterial(); + + const gridXZ = TSL.Fn(([gridSize = TSL.float(1.0), dotWidth = TSL.float(0.1), lineWidth = TSL.float(0.02)]) => { + const coord = TSL.positionWorld.xz.div(gridSize); + const grid = TSL.fract(coord); + + // Screen-space derivative for automatic antialiasing + const fw = TSL.fwidth(coord); + const smoothing = TSL.max(fw.x, fw.y).mul(0.5); + + // Create squares at cell centers + const squareDist = TSL.max(TSL.abs(grid.x.sub(0.5)), TSL.abs(grid.y.sub(0.5))); + const dots = TSL.smoothstep(dotWidth.add(smoothing), dotWidth.sub(smoothing), squareDist); + + // Create grid lines + const lineX = TSL.smoothstep(lineWidth.add(smoothing), lineWidth.sub(smoothing), TSL.abs(grid.x.sub(0.5))); + const lineZ = TSL.smoothstep(lineWidth.add(smoothing), lineWidth.sub(smoothing), TSL.abs(grid.y.sub(0.5))); + const lines = TSL.max(lineX, lineZ); + + return TSL.max(dots, lines); + }); + + const radialGradient = TSL.Fn(([radius = TSL.float(10.0), falloff = TSL.float(1.0)]) => { + return TSL.smoothstep(radius, radius.sub(falloff), TSL.length(TSL.positionWorld)); + }); + + // Create grid pattern + const gridPattern = gridXZ(1.0, 0.03, 0.005); + const baseColor = TSL.vec4(1.0, 1.0, 1.0, 0.0); + const gridColor = TSL.vec4(0.5, 0.5, 0.5, 1.0); + + // Mix base color with grid lines + material.colorNode = gridPattern.mix(baseColor, gridColor).mul(radialGradient(30.0, 20.0)); + material.transparent = true; + + const plane = new THREE.Mesh(new THREE.CircleGeometry(40), material); + plane.rotation.x = -Math.PI / 2; + plane.renderOrder = -1; + + return plane; +} + +// Helper function to create and position labels +function createLabel(text, font, material, position) { + const txt_geo = new TextGeometry(text, { + font: font, + size: 0.1, + depth: 0.001, + curveSegments: 12, + bevelEnabled: false, + }); + + txt_geo.computeBoundingBox(); + const offx = -0.5 * (txt_geo.boundingBox.max.x - txt_geo.boundingBox.min.x); + const offy = -0.5 * (txt_geo.boundingBox.max.y - txt_geo.boundingBox.min.y); + const offz = -0.5 * (txt_geo.boundingBox.max.z - txt_geo.boundingBox.min.z); + txt_geo.translate(offx, offy, offz); + + const label = new THREE.Group(); + const mesh = new THREE.Mesh(txt_geo); + label.add(mesh); + + // Apply default rotation for labels + label.rotateY(-Math.PI / 2); + + label.children[0].material = material; + label.position.copy(position); + base.add(label); +} + +async function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xffffff); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); + camera.position.set(-0.1, 5, 0.548); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(1.0); // important for performance + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 1.0; + renderer.inspector = new Inspector(); + renderer.setAnimationLoop(render); + document.body.appendChild(renderer.domElement); + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.set(0, 0, 0.548); + + gui = renderer.inspector.createParameters('Parameters'); + + font = await new FontLoader().loadAsync('./fonts/helvetiker_regular.typeface.json'); + + // Create shared block geometry + blockGeometry = new RoundedBoxGeometry(0.125, 0.9, 0.9, 10, 0.02); + + base = new THREE.Group(); + base.rotation.set(0, 0, -Math.PI / 2); + base.position.set(0, 0, 0.548); + scene.add(base); + + const text_mat = new THREE.MeshStandardMaterial(); + text_mat.colorNode = TSL.color('#000000'); + + // Create finish labels (using negative wood index for left column) + for (let y = 0; y < Finishes.length; y++) { + createLabel(Finishes[y], font, text_mat, getGridPosition(-1, y)); + } + + // Create and add the grid plane + const plane = createGridPlane(); + scene.add(plane); + + await new HDRLoader() + .setPath('textures/equirectangular/') + .loadAsync('san_giuseppe_bridge_2k.hdr') + .then(texture => { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.environment = texture; + scene.environmentIntensity = 2; + }); + + // Create wood labels (using negative finish index for top row) + for (let x = 0; x < WoodGenuses.length; x++) { + createLabel(WoodGenuses[x], font, text_mat, getGridPosition(x, -1)); + } + + // Create wood blocks + for (let x = 0; x < WoodGenuses.length; x++) { + for (let y = 0; y < Finishes.length; y++) { + const material = WoodNodeMaterial.fromPreset(WoodGenuses[x], Finishes[y]); + const cube = new THREE.Mesh(blockGeometry, material); + + cube.position.copy(getGridPosition(x, y)); + material.transformationMatrix = new THREE.Matrix4().setPosition(new THREE.Vector3(-0.1, 0, Math.random())); + base.add(cube); + + await new Promise(resolve => setTimeout(resolve, 0)); + } + } + + add_custom_wood(text_mat); +} + +function render() { + controls.update(); + + renderer.render(scene, camera); +} + +window.addEventListener('resize', () => { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +}); + +if (WebGPU.isAvailable()) { + init(); +} else { + document.body.appendChild(WebGPU.getErrorMessage()); +} + +function add_custom_wood(text_mat) { + // Add "Custom" label (positioned at the end of the grid) + createLabel('custom', font, text_mat, getGridPosition(Math.round(WoodGenuses.length / 2 - 1), 5)); + + // Create custom wood material with unique parameters + const customMaterial = new WoodNodeMaterial({ + centerSize: 1.11, + largeWarpScale: 0.32, + largeGrainStretch: 0.24, + smallWarpStrength: 0.059, + smallWarpScale: 2, + fineWarpStrength: 0.006, + fineWarpScale: 32.8, + ringThickness: 1 / 34, + ringBias: 0.03, + ringSizeVariance: 0.03, + ringVarianceScale: 4.4, + barkThickness: 0.3, + splotchScale: 0.2, + splotchIntensity: 0.541, + cellScale: 910, + cellSize: 0.1, + darkGrainColor: new THREE.Color('#0c0504'), + lightGrainColor: new THREE.Color('#926c50'), + clearcoat: 1, + clearcoatRoughness: 0.2, + }); + + gui.add(customMaterial, 'centerSize', 0.0, 2.0, 0.01).name('centerSize'); + gui.add(customMaterial, 'largeWarpScale', 0.0, 1.0, 0.001).name('largeWarpScale'); + gui.add(customMaterial, 'largeGrainStretch', 0.0, 1.0, 0.001).name('largeGrainStretch'); + gui.add(customMaterial, 'smallWarpStrength', 0.0, 0.2, 0.001).name('smallWarpStrength'); + gui.add(customMaterial, 'smallWarpScale', 0.0, 5.0, 0.01).name('smallWarpScale'); + gui.add(customMaterial, 'fineWarpStrength', 0.0, 0.05, 0.001).name('fineWarpStrength'); + gui.add(customMaterial, 'fineWarpScale', 0.0, 50.0, 0.1).name('fineWarpScale'); + gui.add(customMaterial, 'ringThickness', 0.0, 0.1, 0.001).name('ringThickness'); + gui.add(customMaterial, 'ringBias', -0.2, 0.2, 0.001).name('ringBias'); + gui.add(customMaterial, 'ringSizeVariance', 0.0, 0.2, 0.001).name('ringSizeVariance'); + gui.add(customMaterial, 'ringVarianceScale', 0.0, 10.0, 0.1).name('ringVarianceScale'); + gui.add(customMaterial, 'barkThickness', 0.0, 1.0, 0.01).name('barkThickness'); + gui.add(customMaterial, 'splotchScale', 0.0, 1.0, 0.01).name('splotchScale'); + gui.add(customMaterial, 'splotchIntensity', 0.0, 1.0, 0.01).name('splotchIntensity'); + gui.add(customMaterial, 'cellScale', 100, 2000, 1).name('cellScale'); + gui.add(customMaterial, 'cellSize', 0.01, 0.5, 0.001).name('cellSize'); + gui.addColor({ darkGrainColor: '#0c0504' }, 'darkGrainColor').onChange(v => customMaterial.darkGrainColor.set(v)); + gui.addColor({ lightGrainColor: '#926c50' }, 'lightGrainColor').onChange(v => + customMaterial.lightGrainColor.set(v), + ); + gui.add(customMaterial, 'clearcoat', 0.0, 1.0, 0.01).name('clearcoat'); + gui.add(customMaterial, 'clearcoatRoughness', 0.0, 1.0, 0.01).name('clearcoatRoughness'); + + const cube = new THREE.Mesh(blockGeometry, customMaterial); + + customMaterial.transformationMatrix = new THREE.Matrix4().setPosition(new THREE.Vector3(-0.1, 0, Math.random())); + cube.position.copy(getGridPosition(Math.round(WoodGenuses.length / 2), 5)); + + base.add(cube); +} diff --git a/examples-testing/examples/webgpu_upscaling_fsr1.ts b/examples-testing/examples/webgpu_upscaling_fsr1.ts new file mode 100644 index 000000000..c4a749307 --- /dev/null +++ b/examples-testing/examples/webgpu_upscaling_fsr1.ts @@ -0,0 +1,122 @@ +import * as THREE from 'three/webgpu'; +import { pass } from 'three/tsl'; +import { fsr1 } from 'three/addons/tsl/display/FSR1Node.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; + +const params = { + upscaleMethod: 'FSR1', + resolutionScale: 0.5, +}; + +let camera, scene, renderer, renderPipeline, controls, mixer, timer; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-0.5, 0, 12); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // model + + const dracoLoader = new DRACOLoader(); + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + + loader.load('models/gltf/LittlestTokyo.glb', function (gltf) { + const model = gltf.scene; + model.scale.set(0.01, 0.01, 0.01); + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + mixer.clipAction(gltf.animations[0]).play(); + }); + + // renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfe3dd); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target.set(-0.5, 0, 0); + + // render pipeline + + renderPipeline = new THREE.RenderPipeline(renderer); + + const scenePass = pass(scene, camera).toInspector('Color'); + scenePass.setResolutionScale(params.resolutionScale); + + // FSR 1 + + const fsr1Node = fsr1(scenePass).toInspector('FSR1'); + + // + + function updatePipeline() { + if (params.upscaleMethod === 'FSR1') { + renderPipeline.outputNode = fsr1Node; + } else { + renderPipeline.outputNode = scenePass; + } + + renderPipeline.needsUpdate = true; + } + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'upscaleMethod', ['Bilinear', 'FSR1']).onChange(updatePipeline); + gui.add(params, 'resolutionScale', 0.25, 1.0, 0.25).onChange(value => { + scenePass.setResolutionScale(value); + }); + + updatePipeline(); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) { + mixer.update(delta); + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_upscaling_taau.ts b/examples-testing/examples/webgpu_upscaling_taau.ts new file mode 100644 index 000000000..d4169bafa --- /dev/null +++ b/examples-testing/examples/webgpu_upscaling_taau.ts @@ -0,0 +1,142 @@ +import * as THREE from 'three/webgpu'; +import { mrt, output, pass, velocity } from 'three/tsl'; +import { taau } from 'three/addons/tsl/display/TAAUNode.js'; +import { sharpen } from 'three/addons/tsl/display/SharpenNode.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { Inspector } from 'three/addons/inspector/Inspector.js'; +import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; + +const params = { + upscaleMethod: 'TAAU', + resolutionScale: 0.5, + sharpening: true, + sharpness: 0.2, +}; + +let camera, scene, renderer, renderPipeline, controls, mixer, timer; + +init(); + +async function init() { + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-0.5, 0, 12); + + scene = new THREE.Scene(); + + timer = new THREE.Timer(); + timer.connect(document); + + // model + + const dracoLoader = new DRACOLoader(); + const loader = new GLTFLoader(); + loader.setDRACOLoader(dracoLoader); + + loader.load('models/gltf/LittlestTokyo.glb', function (gltf) { + const model = gltf.scene; + model.scale.set(0.01, 0.01, 0.01); + scene.add(model); + + mixer = new THREE.AnimationMixer(model); + mixer.clipAction(gltf.animations[0]).play(); + }); + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + await renderer.init(); + + const pmremGenerator = new THREE.PMREMGenerator(renderer); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xbfe3dd); + scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; + + // controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target.set(-0.5, 0, 0); + + // render pipeline + + renderPipeline = new THREE.RenderPipeline(renderer); + const scenePass = pass(scene, camera); + scenePass.setResolutionScale(params.resolutionScale); + scenePass.setMRT( + mrt({ + output: output, + velocity: velocity, + }), + ); + + const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); + const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { + return scenePass.getLinearDepthNode(); + }); + const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); + + const taauNode = taau(scenePassColor, scenePassDepth, scenePassVelocity, camera); + const sharpenNode = sharpen(taauNode.getTextureNode(), params.sharpness); + + function updatePipeline() { + if (params.upscaleMethod === 'TAAU') { + renderPipeline.outputNode = params.sharpening ? sharpenNode : taauNode; + } else { + renderPipeline.outputNode = scenePass; + } + + renderPipeline.needsUpdate = true; + } + + // gui + + const gui = renderer.inspector.createParameters('Settings'); + gui.add(params, 'upscaleMethod', ['Bilinear', 'TAAU']).onChange(updatePipeline); + gui.add(params, 'resolutionScale', 0.25, 1.0, 0.25).onChange(value => { + scenePass.setResolutionScale(value); + }); + gui.add(params, 'sharpening').onChange(updatePipeline); + gui.add(params, 'sharpness', 0, 2, 0.05).onChange(value => { + sharpenNode.sharpness.value = value; + }); + + updatePipeline(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + const width = window.innerWidth; + const height = window.innerHeight; + + camera.aspect = width / height; + camera.updateProjectionMatrix(); + + renderer.setSize(width, height); +} + +function animate() { + controls.update(); + + timer.update(); + + const delta = timer.getDelta(); + + if (mixer) { + mixer.update(delta); + } + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_video_panorama.ts b/examples-testing/examples/webgpu_video_panorama.ts new file mode 100644 index 000000000..f52b15ffe --- /dev/null +++ b/examples-testing/examples/webgpu_video_panorama.ts @@ -0,0 +1,99 @@ +import * as THREE from 'three/webgpu'; + +let camera, scene, renderer; + +let isUserInteracting = false, + lon = 0, + lat = 0, + phi = 0, + theta = 0, + onPointerDownPointerX = 0, + onPointerDownPointerY = 0, + onPointerDownLon = 0, + onPointerDownLat = 0; + +const distance = 0.5; + +init(); + +function init() { + const container = document.getElementById('container'); + + camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.25, 10); + + scene = new THREE.Scene(); + + const geometry = new THREE.SphereGeometry(5, 60, 40); + // invert the geometry on the x-axis so that all of the faces point inward + geometry.scale(-1, 1, 1); + + const video = document.getElementById('video'); + video.play(); + + const texture = new THREE.VideoTexture(video); + texture.colorSpace = THREE.SRGBColorSpace; + const material = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh = new THREE.Mesh(geometry, material); + scene.add(mesh); + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + container.appendChild(renderer.domElement); + + document.addEventListener('pointerdown', onPointerDown); + document.addEventListener('pointermove', onPointerMove); + document.addEventListener('pointerup', onPointerUp); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onPointerDown(event) { + isUserInteracting = true; + + onPointerDownPointerX = event.clientX; + onPointerDownPointerY = event.clientY; + + onPointerDownLon = lon; + onPointerDownLat = lat; +} + +function onPointerMove(event) { + if (isUserInteracting === true) { + lon = (onPointerDownPointerX - event.clientX) * 0.1 + onPointerDownLon; + lat = (onPointerDownPointerY - event.clientY) * 0.1 + onPointerDownLat; + } +} + +function onPointerUp() { + isUserInteracting = false; +} + +function animate() { + update(); +} + +function update() { + lat = Math.max(-85, Math.min(85, lat)); + phi = THREE.MathUtils.degToRad(90 - lat); + theta = THREE.MathUtils.degToRad(lon); + + camera.position.x = distance * Math.sin(phi) * Math.cos(theta); + camera.position.y = distance * Math.cos(phi); + camera.position.z = distance * Math.sin(phi) * Math.sin(theta); + + camera.lookAt(0, 0, 0); + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_volume_caustics.ts b/examples-testing/examples/webgpu_volume_caustics.ts new file mode 100644 index 000000000..d4a68aa74 --- /dev/null +++ b/examples-testing/examples/webgpu_volume_caustics.ts @@ -0,0 +1,302 @@ +import * as THREE from 'three/webgpu'; + +import { + uniform, + refract, + div, + frameId, + lightViewPosition, + float, + positionView, + positionViewDirection, + screenUV, + pass, + texture3D, + time, + screenCoordinate, + normalView, + texture, + Fn, + vec2, + vec3, +} from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; + +let camera, scene, renderer, controls; +let renderPipeline; +let gltf; + +init(); + +async function init() { + const LAYER_VOLUMETRIC_LIGHTING = 10; + + camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.025, 5); + camera.position.set(-0.7, 0.2, 0.2); + + scene = new THREE.Scene(); + + // Light + + const spotLight = new THREE.SpotLight(0xffffff, 1); + spotLight.position.set(0.2, 0.3, 0.2); + spotLight.castShadow = true; + spotLight.angle = Math.PI / 6; + spotLight.penumbra = 1; + spotLight.decay = 2; + spotLight.distance = 0; + spotLight.shadow.mapType = THREE.HalfFloatType; // For HDR Caustics + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + spotLight.shadow.camera.near = 0.1; + spotLight.shadow.camera.far = 1; + spotLight.shadow.intensity = 0.95; + spotLight.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + scene.add(spotLight); + + // Model / Textures + + const dracoLoader = new DRACOLoader(); + + gltf = (await new GLTFLoader().setDRACOLoader(dracoLoader).loadAsync('./models/gltf/duck.glb')).scene; + gltf.scale.setScalar(0.5); + scene.add(gltf); + + const causticMap = new THREE.TextureLoader().load('./textures/opengameart/Caustic_Free.jpg'); + causticMap.wrapS = causticMap.wrapT = THREE.RepeatWrapping; + causticMap.colorSpace = THREE.SRGBColorSpace; + + // Material + + const duck = gltf.children[0]; + duck.material = new THREE.MeshPhysicalNodeMaterial(); + duck.material.side = THREE.DoubleSide; + duck.material.transparent = true; + duck.material.color = new THREE.Color(0xffd700); + duck.material.transmission = 1; + duck.material.thickness = 0.25; + duck.material.ior = 1.5; + duck.material.metalness = 0; + duck.material.roughness = 0.1; + duck.castShadow = true; + + // TSL Shader + + const causticOcclusion = uniform(1); + + const causticEffect = Fn(() => { + const refractionVector = refract( + positionViewDirection.negate(), + normalView, + div(1.0, duck.material.ior), + ).normalize(); + const viewZ = normalView.z.pow(causticOcclusion); + + const textureUV = refractionVector.xy.mul(0.6); + + const causticColor = uniform(duck.material.color); + const chromaticAberrationOffset = normalView.z.pow(-0.9).mul(0.004); + + const causticProjection = vec3( + texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset.negate(), 0))).r, + texture(causticMap, textureUV.add(vec2(0, chromaticAberrationOffset.negate()))).g, + texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset, chromaticAberrationOffset))).b, + ); + + return causticProjection.mul(viewZ.mul(60)).add(viewZ).mul(causticColor); + })().toVar(); + + duck.material.castShadowNode = causticEffect; + + duck.material.emissiveNode = Fn(() => { + // Custom emissive for illuminating backside of the mesh based on the caustic effect and light direction + + const thicknessPowerNode = float(3.0); + + const scatteringHalf = lightViewPosition(spotLight).sub(positionView).normalize(); + const scatteringDot = float( + positionViewDirection.dot(scatteringHalf.negate()).saturate().pow(thicknessPowerNode), + ); + + return causticEffect.mul(scatteringDot.add(0.1)).mul(0.02); + })(); + + // Ground + + const textureLoader = new THREE.TextureLoader(); + const map = textureLoader.load('textures/hardwood2_diffuse.jpg'); + map.wrapS = map.wrapT = THREE.RepeatWrapping; + map.repeat.set(10, 10); + + const geometry = new THREE.PlaneGeometry(2, 2); + const material = new THREE.MeshStandardMaterial({ color: 0 }); + + const ground = new THREE.Mesh(geometry, material); + ground.rotation.x = -Math.PI / 2; + ground.receiveShadow = true; + scene.add(ground); + + // Renderer + + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.shadowMap.enabled = true; + renderer.shadowMap.transmitted = true; + renderer.inspector = new Inspector(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + document.body.appendChild(renderer.domElement); + + // GUI + + const gui = renderer.inspector.createParameters('Volumetric Caustics'); + gui.add(causticOcclusion, 'value', 0, 20).name('caustic occlusion'); + gui.addColor(duck.material, 'color').name('material color'); + + // Post-Processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // Layers + + const volumetricLightingIntensity = uniform(0.7); + + const volumetricLayer = new THREE.Layers(); + volumetricLayer.disableAll(); + volumetricLayer.enable(LAYER_VOLUMETRIC_LIGHTING); + + // Volumetric Fog Area + + function createTexture3D() { + let i = 0; + + const size = 128; + const data = new Uint8Array(size * size * size); + + const scale = 10; + const perlin = new ImprovedNoise(); + + const repeatFactor = 5.0; + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const nx = (x / size) * repeatFactor; + const ny = (y / size) * repeatFactor; + const nz = (z / size) * repeatFactor; + + const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); + + data[i] = 128 + 128 * noiseValue; + + i++; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + return texture; + } + + const noiseTexture3D = createTexture3D(); + + const smokeAmount = uniform(3); + + const volumetricMaterial = new THREE.VolumeNodeMaterial(); + volumetricMaterial.steps = 20; + volumetricMaterial.offsetNode = bayer16(screenCoordinate.add(frameId)); // Add dithering to reduce banding + volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { + // Return the amount of fog based on the noise texture + + const timeScaled = vec3(time.mul(0.01), 0, time.mul(0.03)); + + const sampleGrain = (scale, timeScale = 1) => + texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); + + let density = sampleGrain(1); + density = density.mul(sampleGrain(0.5, 1)); + density = density.mul(sampleGrain(0.2, 2)); + + return smokeAmount.mix(1, density); + }); + + const volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.5, 1.5), volumetricMaterial); + volumetricMesh.receiveShadow = true; + volumetricMesh.position.y = 0.25; + volumetricMesh.layers.disableAll(); + volumetricMesh.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + scene.add(volumetricMesh); + + // Scene Pass + + const scenePass = pass(scene, camera).toInspector(); + scenePass.name = 'Scene'; + + const sceneDepth = scenePass.getTextureNode('depth'); + sceneDepth.name = 'Scene Depth'; + + // Material - Apply occlusion depth of volumetric lighting based on the scene depth + + volumetricMaterial.depthNode = sceneDepth.sample(screenUV); + + // Volumetric Lighting Pass + + const volumetricPass = pass(scene, camera, { depthBuffer: false, samples: 0 }).toInspector( + 'Volumetric Lighting / Raw', + ); + volumetricPass.name = 'Volumetric Lighting'; + volumetricPass.setLayers(volumetricLayer); + volumetricPass.setResolutionScale(0.5); + + // Compose and Denoise + + const bloomPass = bloom(volumetricPass, 1, 1, 0).toInspector('Volumetric Lighting / Mip-Chain Gaussian Blur'); + bloomPass.name = 'Bloom'; + + const scenePassColor = scenePass.add(bloomPass.mul(volumetricLightingIntensity)); + + renderPipeline.outputNode = scenePassColor; + + // Controls + + controls = new OrbitControls(camera, renderer.domElement); + controls.target.z = -0.05; + controls.target.y = 0.02; + controls.maxDistance = 1; + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + for (const mesh of gltf.children) { + mesh.rotation.y -= 0.01; + } + + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_volume_cloud.ts b/examples-testing/examples/webgpu_volume_cloud.ts new file mode 100644 index 000000000..1d46c3543 --- /dev/null +++ b/examples-testing/examples/webgpu_volume_cloud.ts @@ -0,0 +1,165 @@ +import * as THREE from 'three/webgpu'; +import { float, vec3, vec4, If, Break, Fn, smoothstep, texture3D, uniform } from 'three/tsl'; + +import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +let renderer, scene, camera; +let mesh; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 1.5); + + new OrbitControls(camera, renderer.domElement); + + // Sky + + const canvas = document.createElement('canvas'); + canvas.width = 1; + canvas.height = 32; + + const context = canvas.getContext('2d'); + const gradient = context.createLinearGradient(0, 0, 0, 32); + gradient.addColorStop(0.0, '#014a84'); + gradient.addColorStop(0.5, '#0561a0'); + gradient.addColorStop(1.0, '#437ab6'); + context.fillStyle = gradient; + context.fillRect(0, 0, 1, 32); + + const skyMap = new THREE.CanvasTexture(canvas); + skyMap.colorSpace = THREE.SRGBColorSpace; + + const sky = new THREE.Mesh( + new THREE.SphereGeometry(10), + new THREE.MeshBasicNodeMaterial({ map: skyMap, side: THREE.BackSide }), + ); + scene.add(sky); + + // Texture + + const size = 128; + const data = new Uint8Array(size * size * size); + + let i = 0; + const scale = 0.05; + const perlin = new ImprovedNoise(); + const vector = new THREE.Vector3(); + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const d = + 1.0 - + vector + .set(x, y, z) + .subScalar(size / 2) + .divideScalar(size) + .length(); + data[i] = (128 + 128 * perlin.noise((x * scale) / 1.5, y * scale, (z * scale) / 1.5)) * d * d; + i++; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + // Shader + + const transparentRaymarchingTexture = Fn( + ({ texture, range = float(0.1), threshold = float(0.25), opacity = float(0.25), steps = float(100) }) => { + const finalColor = vec4(0).toVar(); + + RaymarchingBox(steps, ({ positionRay }) => { + const mapValue = float(texture.sample(positionRay.add(0.5)).r).toVar(); + + mapValue.assign(smoothstep(threshold.sub(range), threshold.add(range), mapValue).mul(opacity)); + + const shading = texture + .sample(positionRay.add(vec3(-0.01))) + .r.sub(texture.sample(positionRay.add(vec3(0.01))).r); + + const col = shading.mul(3.0).add(positionRay.x.add(positionRay.y).mul(0.25)).add(0.2); + + finalColor.rgb.addAssign(finalColor.a.oneMinus().mul(mapValue).mul(col)); + + finalColor.a.addAssign(finalColor.a.oneMinus().mul(mapValue)); + + If(finalColor.a.greaterThanEqual(0.95), () => { + Break(); + }); + }); + + return finalColor; + }, + ); + + // Material + + const baseColor = uniform(new THREE.Color(0x798aa0)); + const range = uniform(0.1); + const threshold = uniform(0.25); + const opacity = uniform(0.25); + const steps = uniform(100); + + const cloud3d = transparentRaymarchingTexture({ + texture: texture3D(texture, null, 0), + range, + threshold, + opacity, + steps, + }); + + const finalCloud = cloud3d.setRGB(cloud3d.rgb.add(baseColor)); + + const material = new THREE.NodeMaterial(); + material.colorNode = finalCloud; + material.side = THREE.BackSide; + material.transparent = true; + + mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), material); + scene.add(mesh); + + // + + const gui = renderer.inspector.createParameters('Parameters'); + gui.add(threshold, 'value', 0, 1, 0.01).name('threshold'); + gui.add(opacity, 'value', 0, 1, 0.01).name('opacity'); + gui.add(range, 'value', 0, 1, 0.01).name('range'); + gui.add(steps, 'value', 0, 200, 1).name('steps'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + mesh.rotation.y = -performance.now() / 7500; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_volume_lighting.ts b/examples-testing/examples/webgpu_volume_lighting.ts new file mode 100644 index 000000000..38099c6a5 --- /dev/null +++ b/examples-testing/examples/webgpu_volume_lighting.ts @@ -0,0 +1,248 @@ +import * as THREE from 'three/webgpu'; +import { vec3, Fn, time, texture3D, screenUV, uniform, screenCoordinate, pass } from 'three/tsl'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + +import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +let renderer, scene, camera; +let volumetricMesh, teapot, pointLight, spotLight; +let renderPipeline; + +init(); + +function createTexture3D() { + let i = 0; + + const size = 128; + const data = new Uint8Array(size * size * size); + + const scale = 10; + const perlin = new ImprovedNoise(); + + const repeatFactor = 5.0; + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const nx = (x / size) * repeatFactor; + const ny = (y / size) * repeatFactor; + const nz = (z / size) * repeatFactor; + + const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); + + data[i] = 128 + 128 * noiseValue; + + i++; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + return texture; +} + +function init() { + const LAYER_VOLUMETRIC_LIGHTING = 10; + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 2; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-8, 1, -6); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.maxDistance = 40; + controls.minDistance = 2; + + // Volumetric Fog Area + + const noiseTexture3D = createTexture3D(); + + const smokeAmount = uniform(2); + + const volumetricMaterial = new THREE.VolumeNodeMaterial(); + volumetricMaterial.steps = 12; + volumetricMaterial.offsetNode = bayer16(screenCoordinate); // Add dithering to reduce banding + volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { + // Return the amount of fog based on the noise texture + + const timeScaled = vec3(time, 0, time.mul(0.3)); + + const sampleGrain = (scale, timeScale = 1) => + texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); + + let density = sampleGrain(0.1); + density = density.mul(sampleGrain(0.05, 1)); + density = density.mul(sampleGrain(0.02, 2)); + + return smokeAmount.mix(1, density); + }); + + volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(20, 10, 20), volumetricMaterial); + volumetricMesh.receiveShadow = true; + volumetricMesh.position.y = 2; + volumetricMesh.layers.disableAll(); + volumetricMesh.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + scene.add(volumetricMesh); + + // Objects + + teapot = new THREE.Mesh( + new TeapotGeometry(0.8, 18), + new THREE.MeshStandardMaterial({ color: 0xffffff, side: THREE.DoubleSide }), + ); + teapot.castShadow = true; + scene.add(teapot); + + const floor = new THREE.Mesh( + new THREE.PlaneGeometry(100, 100), + new THREE.MeshStandardMaterial({ color: 0xffffff }), + ); + floor.rotation.x = -Math.PI / 2; + floor.position.y = -3; + floor.receiveShadow = true; + scene.add(floor); + + // Lights + + pointLight = new THREE.PointLight(0xf9bb50, 3, 100); + pointLight.castShadow = true; + pointLight.position.set(0, 1.4, 0); + pointLight.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + //lightBase.add( new THREE.Mesh( new THREE.SphereGeometry( 0.1, 16, 16 ), new THREE.MeshBasicMaterial( { color: 0xf9bb50 } ) ) ); + scene.add(pointLight); + + spotLight = new THREE.SpotLight(0xffffff, 100); + spotLight.position.set(2.5, 5, 2.5); + spotLight.angle = Math.PI / 6; + spotLight.penumbra = 1; + spotLight.decay = 2; + spotLight.distance = 0; + spotLight.map = new THREE.TextureLoader().setPath('textures/').load('colors.png'); + spotLight.castShadow = true; + spotLight.shadow.intensity = 0.98; + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + spotLight.shadow.camera.near = 1; + spotLight.shadow.camera.far = 15; + spotLight.shadow.focus = 1; + spotLight.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + //sunLight.add( new THREE.Mesh( new THREE.SphereGeometry( 0.1, 16, 16 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) ) ); + scene.add(spotLight); + + // Post-Processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // Layers + + const volumetricLightingIntensity = uniform(1); + + const volumetricLayer = new THREE.Layers(); + volumetricLayer.disableAll(); + volumetricLayer.enable(LAYER_VOLUMETRIC_LIGHTING); + + // Scene Pass + + const scenePass = pass(scene, camera); + const sceneDepth = scenePass.getTextureNode('depth'); + + // Material - Apply occlusion depth of volumetric lighting based on the scene depth + + volumetricMaterial.depthNode = sceneDepth.sample(screenUV); + + // Volumetric Lighting Pass + + const volumetricPass = pass(scene, camera, { depthBuffer: false }); + volumetricPass.name = 'Volumetric Lighting'; + volumetricPass.setLayers(volumetricLayer); + volumetricPass.setResolutionScale(0.25); + + // Compose and Denoise + + const denoiseStrength = uniform(0.6); + + const blurredVolumetricPass = gaussianBlur(volumetricPass, denoiseStrength); + + const scenePassColor = scenePass.add(blurredVolumetricPass.mul(volumetricLightingIntensity)); + + renderPipeline.outputNode = scenePassColor; + + // GUI + + const params = { + resolution: volumetricPass.getResolutionScale(), + denoise: true, + }; + + const gui = renderer.inspector.createParameters('Volumetric Lighting'); + + const rayMarching = gui.addFolder('Ray Marching'); + rayMarching.add(params, 'resolution', 0.1, 1).onChange(resolution => { + volumetricPass.setResolutionScale(resolution); + }); + rayMarching.add(volumetricMaterial, 'steps', 2, 16).name('step count'); + rayMarching.add(denoiseStrength, 'value', 0, 1).name('denoise strength'); + rayMarching.add(params, 'denoise').onChange(denoise => { + const volumetric = denoise ? blurredVolumetricPass : volumetricPass; + + const scenePassColor = scenePass.add(volumetric.mul(volumetricLightingIntensity)); + + renderPipeline.outputNode = scenePassColor; + renderPipeline.needsUpdate = true; + }); + + const lighting = gui.addFolder('Lighting / Scene'); + lighting.add(pointLight, 'intensity', 0, 6).name('light intensity'); + lighting.add(spotLight, 'intensity', 0, 200).name('spot intensity'); + lighting.add(volumetricLightingIntensity, 'value', 0, 2).name('fog intensity'); + lighting.add(smokeAmount, 'value', 0, 3).name('smoke amount'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now() * 0.001; + const scale = 2.4; + + pointLight.position.x = Math.sin(time * 0.7) * scale; + pointLight.position.y = Math.cos(time * 0.5) * scale; + pointLight.position.z = Math.cos(time * 0.3) * scale; + + spotLight.position.x = Math.cos(time * 0.3) * scale; + spotLight.lookAt(0, 0, 0); + + teapot.rotation.y = time * 0.2; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_volume_lighting_rectarea.ts b/examples-testing/examples/webgpu_volume_lighting_rectarea.ts new file mode 100644 index 000000000..47c82841c --- /dev/null +++ b/examples-testing/examples/webgpu_volume_lighting_rectarea.ts @@ -0,0 +1,256 @@ +import * as THREE from 'three/webgpu'; +import { vec3, Fn, time, texture3D, screenUV, uniform, screenCoordinate, pass, checker, uv } from 'three/tsl'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; +import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; +import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; + +let renderer, scene, camera; +let volumetricMesh; +let rectLight1, rectLight2, rectLight3; +let timer; +let renderPipeline; + +init(); + +function createTexture3D() { + let i = 0; + + const size = 128; + const data = new Uint8Array(size * size * size); + + const scale = 10; + const perlin = new ImprovedNoise(); + + const repeatFactor = 5.0; + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const nx = (x / size) * repeatFactor; + const ny = (y / size) * repeatFactor; + const nz = (z / size) * repeatFactor; + + const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); + + data[i] = 128 + 128 * noiseValue; + + i++; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + return texture; +} + +function init() { + THREE.RectAreaLightNode.setLTC(RectAreaLightTexturesLib.init()); + + const LAYER_VOLUMETRIC_LIGHTING = 10; + + timer = new THREE.Timer(); + + renderer = new THREE.WebGPURenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 2; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 250); + camera.position.set(0, 5, -15); + + // Volumetric Fog Area + + const noiseTexture3D = createTexture3D(); + + const smokeAmount = uniform(2); + + const volumetricMaterial = new THREE.VolumeNodeMaterial(); + volumetricMaterial.steps = 12; + volumetricMaterial.offsetNode = bayer16(screenCoordinate); // Add dithering to reduce banding + volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { + // Return the amount of fog based on the noise texture + + const timeScaled = vec3(time, 0, time.mul(0.3)); + + const sampleGrain = (scale, timeScale = 1) => + texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); + + let density = sampleGrain(0.1); + density = density.mul(sampleGrain(0.05, 1)); + density = density.mul(sampleGrain(0.02, 2)); + + return smokeAmount.mix(1, density); + }); + + volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(50, 40, 50), volumetricMaterial); + volumetricMesh.receiveShadow = true; + volumetricMesh.position.y = 20; + volumetricMesh.layers.disableAll(); + volumetricMesh.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + scene.add(volumetricMesh); + + // Objects + + rectLight1 = new THREE.RectAreaLight(0xff0000, 5, 4, 10); + rectLight1.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + rectLight1.position.set(-5, 6, 5); + scene.add(rectLight1); + + rectLight2 = new THREE.RectAreaLight(0x00ff00, 5, 4, 10); + rectLight2.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + rectLight2.position.set(0, 6, 5); + scene.add(rectLight2); + + rectLight3 = new THREE.RectAreaLight(0x0000ff, 5, 4, 10); + rectLight3.layers.enable(LAYER_VOLUMETRIC_LIGHTING); + rectLight3.position.set(5, 6, 5); + scene.add(rectLight3); + + // + + const createRectLightMesh = rectLight => { + const geometry = new THREE.PlaneGeometry(4, 10); + const frontMaterial = new THREE.MeshBasicMaterial({ color: rectLight.color, side: THREE.BackSide }); + const backMaterial = new THREE.MeshStandardMaterial({ color: 0x111111 }); + + const backSide = new THREE.Mesh(geometry, backMaterial); + backSide.position.set(0, 0, 0.08); + + const frontSide = new THREE.Mesh(geometry, frontMaterial); + frontSide.position.set(0, 0, 0.01); + + rectLight.add(backSide); + rectLight.add(frontSide); + }; + + createRectLightMesh(rectLight1); + createRectLightMesh(rectLight2); + createRectLightMesh(rectLight3); + + // + + const geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000); + const matStdFloor = new THREE.MeshStandardMaterial({ color: 0x444444 }); + matStdFloor.roughnessNode = checker(uv().mul(400)); + const mshStdFloor = new THREE.Mesh(geoFloor, matStdFloor); + scene.add(mshStdFloor); + + const geoKnot = new THREE.TorusKnotGeometry(1.5, 0.5, 200, 16); + const matKnot = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0, metalness: 0 }); + const meshKnot = new THREE.Mesh(geoKnot, matKnot); + meshKnot.position.set(0, 5.5, 0); + scene.add(meshKnot); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.minDistance = 5; + controls.maxDistance = 200; + controls.target.copy(meshKnot.position); + controls.update(); + + // Post-Processing + + renderPipeline = new THREE.RenderPipeline(renderer); + + // Layers + + const volumetricLightingIntensity = uniform(1); + + const volumetricLayer = new THREE.Layers(); + volumetricLayer.disableAll(); + volumetricLayer.enable(LAYER_VOLUMETRIC_LIGHTING); + + // Scene Pass + + const scenePass = pass(scene, camera); + const sceneDepth = scenePass.getTextureNode('depth'); + + // Material - Apply occlusion depth of volumetric lighting based on the scene depth + + volumetricMaterial.depthNode = sceneDepth.sample(screenUV); + + // Volumetric Lighting Pass + + const volumetricPass = pass(scene, camera, { depthBuffer: false }); + volumetricPass.setLayers(volumetricLayer); + volumetricPass.setResolutionScale(0.25); + + // Compose and Denoise + + const denoiseStrength = uniform(0.6); + + const blurredVolumetricPass = gaussianBlur(volumetricPass, denoiseStrength); + + const scenePassColor = scenePass.add(blurredVolumetricPass.mul(volumetricLightingIntensity)); + + renderPipeline.outputNode = scenePassColor; + + // GUI + + const params = { + resolution: volumetricPass.getResolutionScale(), + denoise: true, + }; + + const gui = renderer.inspector.createParameters('Volumetric Lighting'); + + const rayMarching = gui.addFolder('Ray Marching'); + rayMarching.add(params, 'resolution', 0.1, 1).onChange(resolution => { + volumetricPass.setResolutionScale(resolution); + }); + rayMarching.add(volumetricMaterial, 'steps', 2, 16).name('step count'); + rayMarching.add(denoiseStrength, 'value', 0, 1).name('denoise strength'); + rayMarching.add(params, 'denoise').onChange(denoise => { + const volumetric = denoise ? blurredVolumetricPass : volumetricPass; + + const scenePassColor = scenePass.add(volumetric.mul(volumetricLightingIntensity)); + + renderPipeline.outputNode = scenePassColor; + renderPipeline.needsUpdate = true; + }); + + const lighting = gui.addFolder('Lighting / Scene'); + lighting.add(volumetricLightingIntensity, 'value', 0, 2).name('fog intensity'); + lighting.add(smokeAmount, 'value', 0, 3).name('smoke amount'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const delta = timer.getDelta(); + + rectLight1.rotation.y += -delta; + rectLight2.rotation.y += delta * 0.5; + rectLight3.rotation.y += delta; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_volume_lighting_traa.ts b/examples-testing/examples/webgpu_volume_lighting_traa.ts new file mode 100644 index 000000000..c5cc55e71 --- /dev/null +++ b/examples-testing/examples/webgpu_volume_lighting_traa.ts @@ -0,0 +1,298 @@ +import * as THREE from 'three/webgpu'; +import { + vec2, + vec3, + Fn, + texture3D, + screenUV, + uniform, + screenCoordinate, + pass, + depthPass, + mrt, + output, + velocity, + fract, + interleavedGradientNoise, +} from 'three/tsl'; + +import { traa } from 'three/addons/tsl/display/TRAANode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; +import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; + +// Halton sequence for temporal offset - matches TRAA's 32-sample Halton jitter +// This creates optimal low-discrepancy distribution that accumulates well with TRAA +function halton(index, base) { + let result = 0; + let f = 1; + + while (index > 0) { + f /= base; + result += f * (index % base); + index = Math.floor(index / base); + } + + return result; +} + +// Generate 32 Halton offsets (base 2, 3) - same length as TRAA +const _haltonOffsets = Array.from({ length: 32 }, (_, i) => [halton(i + 1, 2), halton(i + 1, 3)]); + +let renderer, scene, camera; +let volumetricMesh, teapot, pointLight, spotLight; +let renderPipeline; +let temporalOffset, temporalRotation, shaderTime; +let params; + +init(); + +function createTexture3D() { + let i = 0; + + const size = 128; + const data = new Uint8Array(size * size * size); + + const scale = 10; + const perlin = new ImprovedNoise(); + + const repeatFactor = 5.0; + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + const nx = (x / size) * repeatFactor; + const ny = (y / size) * repeatFactor; + const nz = (z / size) * repeatFactor; + + const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); + + data[i] = 128 + 128 * noiseValue; + + i++; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.wrapS = THREE.RepeatWrapping; + texture.wrapT = THREE.RepeatWrapping; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + return texture; +} + +function init() { + renderer = new THREE.WebGPURenderer(); + // renderer.setPixelRatio( window.devicePixelRatio ); // Disable DPR for performance + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.NeutralToneMapping; + renderer.toneMappingExposure = 2; + renderer.shadowMap.enabled = true; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(-8, 1, -6); + + const controls = new OrbitControls(camera, renderer.domElement); + controls.maxDistance = 40; + controls.minDistance = 2; + + // Volumetric Fog Area + + const noiseTexture3D = createTexture3D(); + + const smokeAmount = uniform(2); + + const volumetricMaterial = new THREE.VolumeNodeMaterial(); + volumetricMaterial.steps = 12; + volumetricMaterial.transparent = true; + volumetricMaterial.blending = THREE.AdditiveBlending; + + // Temporal dithering using Interleaved Gradient Noise (IGN) + Halton sequence + temporalOffset = uniform(0); + temporalRotation = uniform(0); + shaderTime = uniform(0); + + const temporalJitter2D = vec2(temporalOffset, temporalRotation); + volumetricMaterial.offsetNode = fract( + interleavedGradientNoise(screenCoordinate.add(temporalJitter2D.mul(100))).add(temporalOffset), + ); + volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { + const timeScaled = vec3(shaderTime, 0, shaderTime.mul(0.3)); + + const sampleGrain = (scale, timeScale = 1) => + texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); + + let density = sampleGrain(0.1); + density = density.mul(sampleGrain(0.05, 1)); + density = density.mul(sampleGrain(0.02, 2)); + + return smokeAmount.mix(1, density); + }); + + volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(20, 10, 20), volumetricMaterial); + volumetricMesh.receiveShadow = true; + volumetricMesh.position.y = 2; + scene.add(volumetricMesh); + + // Objects + + teapot = new THREE.Mesh( + new TeapotGeometry(0.8, 18), + new THREE.MeshStandardMaterial({ color: 0xffffff, side: THREE.DoubleSide }), + ); + teapot.castShadow = true; + scene.add(teapot); + + const floor = new THREE.Mesh( + new THREE.PlaneGeometry(100, 100), + new THREE.MeshStandardMaterial({ color: 0xffffff }), + ); + floor.rotation.x = -Math.PI / 2; + floor.position.y = -3; + floor.receiveShadow = true; + scene.add(floor); + + // Lights + + pointLight = new THREE.PointLight(0xf9bb50, 3, 100); + pointLight.castShadow = true; + pointLight.position.set(0, 1.4, 0); + scene.add(pointLight); + + spotLight = new THREE.SpotLight(0xffffff, 100); + spotLight.position.set(2.5, 5, 2.5); + spotLight.angle = Math.PI / 6; + spotLight.penumbra = 1; + spotLight.decay = 2; + spotLight.distance = 0; + spotLight.map = new THREE.TextureLoader().setPath('textures/').load('colors.png'); + spotLight.castShadow = true; + spotLight.shadow.intensity = 0.98; + spotLight.shadow.mapSize.width = 1024; + spotLight.shadow.mapSize.height = 1024; + spotLight.shadow.camera.near = 1; + spotLight.shadow.camera.far = 15; + spotLight.shadow.focus = 1; + scene.add(spotLight); + + // Render Pipeline + + renderPipeline = new THREE.RenderPipeline(renderer); + + const volumetricIntensity = uniform(1); + + // Pre-Pass: Opaque objects only (volumetric is transparent, excluded automatically) + + const prePass = depthPass(scene, camera); + prePass.name = 'Pre Pass'; + prePass.transparent = false; + + const prePassDepth = prePass.getTextureNode('depth').toInspector('Depth', () => prePass.getLinearDepthNode()); + + // Apply depth to volumetric material for proper occlusion + + volumetricMaterial.depthNode = prePassDepth.sample(screenUV); + + // Scene Pass: Full scene including volumetric with MRT + + const scenePass = pass(scene, camera).toInspector('Scene'); + scenePass.name = 'Scene Pass'; + scenePass.setMRT( + mrt({ + output: output, + velocity: velocity, + }), + ); + + const scenePassColor = scenePass.getTextureNode().toInspector('Output'); + const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); + + // TRAA with scene pass depth/velocity (includes volumetric) + + const traaPass = traa(scenePassColor, prePassDepth, scenePassVelocity, camera); + + renderPipeline.outputNode = traaPass; + + // GUI + + params = { + traa: true, + animated: true, + }; + + const gui = renderer.inspector.createParameters('Volumetric Lighting'); + + gui.add(params, 'animated'); + gui.add(params, 'traa').name('TRAA').onChange(updatePostProcessing); + + const rayMarching = gui.addFolder('Ray Marching'); + rayMarching.add(volumetricMaterial, 'steps', 2, 16, 1).name('step count'); + + function updatePostProcessing() { + renderPipeline.outputNode = params.traa ? traaPass : scenePassColor; + renderPipeline.needsUpdate = true; + } + + const lighting = gui.addFolder('Lighting / Scene'); + lighting.add(pointLight, 'intensity', 0, 6).name('light intensity'); + lighting.add(spotLight, 'intensity', 0, 200).name('spot intensity'); + lighting.add(volumetricIntensity, 'value', 0, 2).name('volumetric intensity'); + lighting.add(smokeAmount, 'value', 0, 3).name('smoke amount'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +let frameCount = 0; +let animationTime = 0; +let lastTime = performance.now(); + +function animate() { + const currentTime = performance.now(); + const delta = (currentTime - lastTime) * 0.001; + lastTime = currentTime; + + // Update temporal uniforms - synced with TRAA's Halton sequence for optimal accumulation + const haltonIndex = frameCount % 32; + temporalOffset.value = _haltonOffsets[haltonIndex][0]; + temporalRotation.value = _haltonOffsets[haltonIndex][1]; + frameCount++; + + if (params.animated) { + animationTime += delta; + } + + shaderTime.value = animationTime; + + const scale = 2.4; + + pointLight.position.x = Math.sin(animationTime * 0.7) * scale; + pointLight.position.y = Math.cos(animationTime * 0.5) * scale; + pointLight.position.z = Math.cos(animationTime * 0.3) * scale; + + spotLight.position.x = Math.cos(animationTime * 0.3) * scale; + spotLight.lookAt(0, 0, 0); + + teapot.rotation.y = animationTime * 0.2; + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_volume_perlin.ts b/examples-testing/examples/webgpu_volume_perlin.ts new file mode 100644 index 000000000..eed45c392 --- /dev/null +++ b/examples-testing/examples/webgpu_volume_perlin.ts @@ -0,0 +1,148 @@ +import * as THREE from 'three/webgpu'; +import { Break, If, Loop, select, bool, vec3, vec4, texture3D, uniform, Fn } from 'three/tsl'; + +import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +const REFINEMENT_STEPS = 4; + +let renderer, scene, camera; +let mesh; + +init(); + +function init() { + renderer = new THREE.WebGPURenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); + camera.position.set(0, 0, 2); + + new OrbitControls(camera, renderer.domElement); + + // Texture + + const size = 128; + const data = new Uint8Array(size * size * size); + + let i = 0; + const perlin = new ImprovedNoise(); + const vector = new THREE.Vector3(); + + for (let z = 0; z < size; z++) { + for (let y = 0; y < size; y++) { + for (let x = 0; x < size; x++) { + vector.set(x, y, z).divideScalar(size); + + const d = perlin.noise(vector.x * 6.5, vector.y * 6.5, vector.z * 6.5); + + data[i++] = d * 128 + 128; + } + } + } + + const texture = new THREE.Data3DTexture(data, size, size, size); + texture.format = THREE.RedFormat; + texture.minFilter = THREE.LinearFilter; + texture.magFilter = THREE.LinearFilter; + texture.unpackAlignment = 1; + texture.needsUpdate = true; + + // Shader + + const opaqueRaymarchingTexture = Fn(({ texture, steps, threshold, refine }) => { + const finalColor = vec4(0).toVar(); + + const positionPrev = vec3(0).toVar(); + const hasPrev = bool(false).toVar(); + + RaymarchingBox(steps, ({ positionRay }) => { + const mapValue = texture.sample(positionRay.add(0.5)).r.toVar(); + + If(mapValue.greaterThan(threshold), () => { + const surfacePos = positionRay.toVar(); + + If(refine.and(hasPrev), () => { + // The surface lies between the previous sample (below the threshold) + // and the current one (above it). Bisect that interval to localize + // the crossing precisely. + + const p0 = positionPrev.toVar(); + const p1 = positionRay.toVar(); + + Loop(REFINEMENT_STEPS, () => { + const pm = p0.add(p1).mul(0.5).toConst(); + const dm = texture.sample(pm.add(0.5)).r.toConst(); + + const isGreater = dm.greaterThan(threshold); + + p1.assign(select(isGreater, pm, p1).uniformFlow()); + p0.assign(select(isGreater, p0, pm).uniformFlow()); + }); + + surfacePos.assign(p1); + }); + + const p = vec3(surfacePos).add(0.5); + + finalColor.rgb.assign(texture.normal(p).mul(0.5).add(surfacePos.mul(1.5).add(0.25))); + finalColor.a.assign(1); + Break(); + }); + + positionPrev.assign(positionRay); + hasPrev.assign(true); + }); + + return finalColor; + }); + + // + + const threshold = uniform(0.6); + const steps = uniform(200); + const refine = uniform(true); + + const material = new THREE.NodeMaterial(); + material.colorNode = opaqueRaymarchingTexture({ + texture: texture3D(texture, null, 0), + steps, + threshold, + refine, + }); + material.side = THREE.BackSide; + material.transparent = true; + + mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), material); + scene.add(mesh); + + // + + const gui = renderer.inspector.createParameters('Parameters'); + gui.add(threshold, 'value', 0, 1, 0.01).name('threshold'); + gui.add(steps, 'value', 0, 300, 1).name('steps'); + gui.add(refine, 'value').name('refine'); + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_water.ts b/examples-testing/examples/webgpu_water.ts new file mode 100644 index 000000000..7a6556618 --- /dev/null +++ b/examples-testing/examples/webgpu_water.ts @@ -0,0 +1,199 @@ +import * as THREE from 'three/webgpu'; + +import { pass, mrt, output, emissive, renderOutput } from 'three/tsl'; +import { bloom } from 'three/addons/tsl/display/BloomNode.js'; +import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; + +import { Inspector } from 'three/addons/inspector/Inspector.js'; + +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; + +import { WaterMesh } from 'three/addons/objects/Water2Mesh.js'; +import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; + +let scene, camera, renderer, water, renderPipeline, controls; + +const params = { + color: '#99e0ff', + scale: 2, + flowX: 1, + flowY: 1, +}; + +init(); + +async function init() { + scene = new THREE.Scene(); + + const loader = new UltraHDRLoader(); + loader.load('textures/equirectangular/moonless_golf_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + texture.needsUpdate = true; + + scene.background = texture; + scene.environment = texture; + }); + + // camera + + camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); + camera.position.set(-20, 6, -30); + + // asset loading + + const dracoLoader = new DRACOLoader(); + dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); + + const gltfLoader = new GLTFLoader(); + gltfLoader.setDRACOLoader(dracoLoader); + + const textureLoader = new THREE.TextureLoader(); + + const [gltf, normalMap0, normalMap1] = await Promise.all([ + gltfLoader.loadAsync('models/gltf/pool.glb'), + textureLoader.loadAsync('textures/water/Water_1_M_Normal.jpg'), + textureLoader.loadAsync('textures/water/Water_2_M_Normal.jpg'), + ]); + + gltf.scene.position.z = 2; + gltf.scene.scale.setScalar(0.1); + scene.add(gltf.scene); + + // water + + normalMap0.wrapS = normalMap0.wrapT = THREE.RepeatWrapping; + normalMap1.wrapS = normalMap1.wrapT = THREE.RepeatWrapping; + + const waterGeometry = new THREE.PlaneGeometry(30, 40); + + water = new WaterMesh(waterGeometry, { + color: params.color, + scale: params.scale, + flowDirection: new THREE.Vector2(params.flowX, params.flowY), + normalMap0: normalMap0, + normalMap1: normalMap1, + }); + + water.position.set(0, 0.2, -2); + water.rotation.x = Math.PI * -0.5; + water.renderOrder = Infinity; + scene.add(water); + + // floor + + const floorGeometry = new THREE.PlaneGeometry(1, 1); + floorGeometry.rotateX(-Math.PI * 0.5); + const floorMaterial = new THREE.MeshStandardMaterial({ + color: 0x444444, + roughness: 1, + metalness: 0, + side: THREE.DoubleSide, + }); + + { + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.position.set(20, 0, 0); + floor.scale.set(15, 1, 80); + scene.add(floor); + } + + { + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.position.set(-20, 0, 0); + floor.scale.set(15, 1, 80); + scene.add(floor); + } + + { + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.position.set(0, 0, 30); + floor.scale.set(30, 1, 20); + scene.add(floor); + } + + { + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.position.set(0, 0, -30); + floor.scale.set(30, 1, 20); + scene.add(floor); + } + + // renderer + + renderer = new THREE.WebGPURenderer(); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setAnimationLoop(animate); + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 0.5; + renderer.inspector = new Inspector(); + document.body.appendChild(renderer.domElement); + + // postprocessing + + renderPipeline = new THREE.RenderPipeline(renderer); + renderPipeline.outputColorTransform = false; + + const scenePass = pass(scene, camera); + scenePass.setMRT( + mrt({ + output, + emissive, + }), + ); + + const beautyPass = scenePass.getTextureNode(); + const emissivePass = scenePass.getTextureNode('emissive'); + + const bloomPass = bloom(emissivePass, 2); + + const outputPass = renderOutput(beautyPass.add(bloomPass)); + + const fxaaPass = fxaa(outputPass); + renderPipeline.outputNode = fxaaPass; + + // gui + + const gui = renderer.inspector.createParameters('Water'); + const waterNode = water.material.colorNode; + + gui.addColor(params, 'color').onChange(function (value) { + waterNode.color.value.set(value); + }); + gui.add(params, 'scale', 1, 10).onChange(function (value) { + waterNode.scale.value = value; + }); + gui.add(params, 'flowX', -1, 1, 0.01).onChange(function (value) { + waterNode.flowDirection.value.x = value; + waterNode.flowDirection.value.normalize(); + }); + gui.add(params, 'flowY', -1, 1, 0.01).onChange(function (value) { + waterNode.flowDirection.value.y = value; + waterNode.flowDirection.value.normalize(); + }); + + // + + controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.target.set(0, 0, -5); + controls.update(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + controls.update(); + + renderPipeline.render(); +} diff --git a/examples-testing/examples/webgpu_xr_cubes.ts b/examples-testing/examples/webgpu_xr_cubes.ts new file mode 100644 index 000000000..c6d89c154 --- /dev/null +++ b/examples-testing/examples/webgpu_xr_cubes.ts @@ -0,0 +1,242 @@ +import * as THREE from 'three/webgpu'; + +import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; +import { XRButton } from 'three/addons/webxr/XRButton.js'; +import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; +import { setupWebGLXRFallback } from 'three/addons/webxr/WebGLXRFallback.js'; + +const timer = new THREE.Timer(); +timer.connect(document); + +const rendererParameters = { antialias: true, outputBufferType: THREE.UnsignedByteType, multiview: true }; +const controllerModelFactory = new XRControllerModelFactory(); + +let container; +let camera, scene, raycaster, renderer, renderPipeline; + +let room; + +let controller, controllerGrip; +let INTERSECTED; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x505050); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(0, 1.6, 3); + scene.add(camera); + + room = new THREE.LineSegments( + new BoxLineGeometry(6, 6, 6, 10, 10, 10).translate(0, 3, 0), + new THREE.LineBasicMaterial({ color: 0xbcbcbc }), + ); + scene.add(room); + + scene.add(new THREE.HemisphereLight(0xa5a5a5, 0x898989, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(1, 1, 1).normalize(); + scene.add(light); + + const geometry = new THREE.BoxGeometry(0.15, 0.15, 0.15); + + for (let i = 0; i < 200; i++) { + const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); + + object.position.x = Math.random() * 4 - 2; + object.position.y = Math.random() * 4; + object.position.z = Math.random() * 4 - 2; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.x = Math.random() + 0.5; + object.scale.y = Math.random() + 0.5; + object.scale.z = Math.random() + 0.5; + + object.userData.velocity = new THREE.Vector3(); + object.userData.velocity.x = Math.random() * 0.01 - 0.005; + object.userData.velocity.y = Math.random() * 0.01 - 0.005; + object.userData.velocity.z = Math.random() * 0.01 - 0.005; + + room.add(object); + } + + raycaster = new THREE.Raycaster(); + + renderer = createRenderer(); + setRenderer(renderer); + setupWebGLXRFallback(renderer, () => createRenderer(true), setRenderer); + + // + + window.addEventListener('resize', onWindowResize); + + // + + document.body.appendChild(XRButton.createButton(renderer, { optionalFeatures: ['webgpu'] })); +} + +function createRenderer(forceWebGL = false) { + const parameters = { ...rendererParameters }; + + if (forceWebGL === true) parameters.forceWebGL = true; + + const renderer = new THREE.WebGPURenderer(parameters); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + + return renderer; +} + +function setRenderer(newRenderer, oldRenderer = null) { + if (controller !== undefined) scene.remove(controller); + if (controllerGrip !== undefined) scene.remove(controllerGrip); + + if (oldRenderer === null) { + container.appendChild(newRenderer.domElement); + } else { + container.replaceChild(newRenderer.domElement, oldRenderer.domElement); + oldRenderer.dispose(); + } + + renderer = newRenderer; + renderPipeline = new THREE.DirectRenderPipeline(renderer); + setupControllers(); +} + +function setupControllers() { + controller = renderer.xr.getController(0); + controller.addEventListener('selectstart', onSelectStart); + controller.addEventListener('selectend', onSelectEnd); + controller.addEventListener('connected', function (event) { + const targetRayMode = event.data.targetRayMode; + + if (targetRayMode === 'tracked-pointer' || targetRayMode === 'gaze') { + this.add(buildController(event.data)); + } + }); + controller.addEventListener('disconnected', function () { + this.remove(this.children[0]); + }); + scene.add(controller); + + controllerGrip = renderer.xr.getControllerGrip(0); + controllerGrip.add(controllerModelFactory.createControllerModel(controllerGrip)); + scene.add(controllerGrip); +} + +function onSelectStart() { + this.userData.isSelecting = true; +} + +function onSelectEnd() { + this.userData.isSelecting = false; +} + +function buildController(data) { + let geometry, material; + + switch (data.targetRayMode) { + case 'tracked-pointer': + geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 0, 0, -1], 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute([0.5, 0.5, 0.5, 0, 0, 0], 3)); + + material = new THREE.LineBasicMaterial({ vertexColors: true, blending: THREE.AdditiveBlending }); + + return new THREE.Line(geometry, material); + + case 'gaze': + geometry = new THREE.RingGeometry(0.02, 0.04, 32).translate(0, 0, -1); + material = new THREE.MeshBasicMaterial({ opacity: 0.5, transparent: true }); + return new THREE.Mesh(geometry, material); + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + timer.update(); + + const delta = timer.getDelta() * 60; + + if (controller.userData.isSelecting === true) { + const cube = room.children[0]; + room.remove(cube); + + cube.position.copy(controller.position); + cube.userData.velocity.x = (Math.random() - 0.5) * 0.02 * delta; + cube.userData.velocity.y = (Math.random() - 0.5) * 0.02 * delta; + cube.userData.velocity.z = (Math.random() * 0.01 - 0.05) * delta; + cube.userData.velocity.applyQuaternion(controller.quaternion); + room.add(cube); + } + + // find intersections + + raycaster.setFromXRController(controller); + + const intersects = raycaster.intersectObjects(room.children, false); + + if (intersects.length > 0) { + if (INTERSECTED != intersects[0].object) { + if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + + INTERSECTED = intersects[0].object; + INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex(); + INTERSECTED.material.emissive.setHex(0xff0000); + } + } else { + if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); + + INTERSECTED = undefined; + } + + // Keep cubes inside room + + for (let i = 0; i < room.children.length; i++) { + const cube = room.children[i]; + + cube.userData.velocity.multiplyScalar(1 - 0.001 * delta); + + cube.position.add(cube.userData.velocity); + + if (cube.position.x < -3 || cube.position.x > 3) { + cube.position.x = THREE.MathUtils.clamp(cube.position.x, -3, 3); + cube.userData.velocity.x = -cube.userData.velocity.x; + } + + if (cube.position.y < 0 || cube.position.y > 6) { + cube.position.y = THREE.MathUtils.clamp(cube.position.y, 0, 6); + cube.userData.velocity.y = -cube.userData.velocity.y; + } + + if (cube.position.z < -3 || cube.position.z > 3) { + cube.position.z = THREE.MathUtils.clamp(cube.position.z, -3, 3); + cube.userData.velocity.z = -cube.userData.velocity.z; + } + + cube.rotation.x += cube.userData.velocity.x * 2 * delta; + cube.rotation.y += cube.userData.velocity.y * 2 * delta; + cube.rotation.z += cube.userData.velocity.z * 2 * delta; + } + + renderPipeline.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_xr_native_layers.ts b/examples-testing/examples/webgpu_xr_native_layers.ts new file mode 100644 index 000000000..a93accfc8 --- /dev/null +++ b/examples-testing/examples/webgpu_xr_native_layers.ts @@ -0,0 +1,637 @@ +import * as THREE from 'three/webgpu'; + +import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; +import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; +import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; +import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; +import { + RollerCoasterGeometry, + RollerCoasterShadowGeometry, + RollerCoasterLiftersGeometry, + TreesGeometry, + SkyGeometry, +} from 'three/addons/misc/RollerCoaster.js'; +import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; + +let camera, scene, renderer, renderPipeline; +let controller1, controller2; +let controllerGrip1, controllerGrip2; + +let room; + +let count = 0; +const radius = 0.08; +let normal = new THREE.Vector3(); +const relativeVelocity = new THREE.Vector3(); + +const timer = new THREE.Timer(); +timer.connect(document); +const funfairs = []; +const train = new THREE.Object3D(); +const rcdelta = timer.getDelta() * 0.8; // slow down simulation +const PI2 = Math.PI * 2; +let rccamera = null; +let rcscene = null; + +const tempMatrix = new THREE.Matrix4(); +let raycaster = null; + +const curve = (function () { + const vector = new THREE.Vector3(); + const vector2 = new THREE.Vector3(); + + return { + getPointAt: function (t) { + t = t * PI2; + + const x = Math.sin(t * 3) * Math.cos(t * 4) * 50; + const y = Math.sin(t * 10) * 2 + Math.cos(t * 17) * 2 + 5; + const z = Math.sin(t) * Math.sin(t * 4) * 50; + + return vector.set(x, y, z).multiplyScalar(2); + }, + + getTangentAt: function (t) { + const delta = 0.0001; + const t1 = Math.max(0, t - delta); + const t2 = Math.min(1, t + delta); + + return vector2.copy(this.getPointAt(t2)).sub(this.getPointAt(t1)).normalize(); + }, + }; +})(); + +let horseCamera = null; +let horseScene = null; +let horseMixer = null; +let horseTheta = 0; +let horseMesh = null; +const horseRadius = 600; + +let guiScene = null; +let guiCamera = null; +let guiGroup = null; + +let rollercoasterLayer = null; +let horseLayer = null; +let guiLayer = null; + +const parameters = { + radius: 0.6, + tube: 0.2, + tubularSegments: 150, + radialSegments: 20, + p: 2, + q: 3, + thickness: 0.5, +}; + +init(); + +function getIntersections(controller) { + tempMatrix.identity().extractRotation(controller.matrixWorld); + + raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld); + raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix); + + return raycaster.intersectObjects(scene.children, false); +} + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x505050); + + raycaster = new THREE.Raycaster(); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(0, 1.6, 3); + + room = new THREE.LineSegments( + new BoxLineGeometry(6, 6, 6, 10, 10, 10), + new THREE.LineBasicMaterial({ color: 0x808080 }), + ); + room.geometry.translate(0, 3, 0); + scene.add(room); + + scene.add(new THREE.HemisphereLight(0x606060, 0x404040)); + + const light = new THREE.DirectionalLight(0xffffff); + light.position.set(1, 1, 1).normalize(); + scene.add(light); + + const geometry = new THREE.IcosahedronGeometry(radius, 3); + + for (let i = 0; i < 200; i++) { + const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); + + object.position.x = Math.random() * 4 - 2; + object.position.y = Math.random() * 4; + object.position.z = Math.random() * 4 - 2; + + object.userData.velocity = new THREE.Vector3(); + object.userData.velocity.x = Math.random() * 0.01 - 0.005; + object.userData.velocity.y = Math.random() * 0.01 - 0.005; + object.userData.velocity.z = Math.random() * 0.01 - 0.005; + + room.add(object); + } + + // + + renderer = new THREE.WebGPURenderer({ + antialias: true, + forceWebGL: true, + outputBufferType: THREE.UnsignedByteType, + multiview: true, + }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + document.body.appendChild(renderer.domElement); + renderer.setAnimationLoop(render); + renderer.xr.enabled = true; + renderPipeline = new THREE.DirectRenderPipeline(renderer); + + // + + document.body.appendChild(VRButton.createButton(renderer)); + + // controllers + + function onSqueezeStart() { + this.userData.isSelecting = true; + } + + function onSqueezeEnd() { + this.userData.isSelecting = false; + } + + function onSelectStart(event) { + const controller = event.target; + + const intersections = getIntersections(controller); + let hadSelection = false; + + for (let x = 0; x < intersections.length; x++) { + if (intersections[x].object == horseLayer) { + horseLayer.visible = false; + hadSelection = true; + } + + if (intersections[x].object == rollercoasterLayer) { + controller.attach(rollercoasterLayer); + hadSelection = true; + } + + if (intersections[x].object == guiLayer) { + const uv = intersections[x].uv; + guiGroup.children[0].dispatchEvent({ + type: 'mousedown', + data: { x: uv.x, y: 1 - uv.y }, + target: guiGroup, + }); + hadSelection = true; + } + } + + this.userData.isSelecting = hadSelection === false; + } + + function onSelectEnd() { + horseLayer.visible = true; + scene.attach(rollercoasterLayer); + guiGroup.children[0].dispatchEvent({ type: 'mouseup', data: { x: 0, y: 0 }, target: guiGroup }); + this.userData.isSelecting = false; + } + + controller1 = renderer.xr.getController(0); + controller1.addEventListener('selectstart', onSelectStart); + controller1.addEventListener('selectend', onSelectEnd); + controller1.addEventListener('squeezestart', onSqueezeStart); + controller1.addEventListener('squeezeend', onSqueezeEnd); + controller1.addEventListener('connected', function (event) { + this.add(buildController(event.data)); + }); + controller1.addEventListener('disconnected', function () { + this.remove(this.children[0]); + }); + scene.add(controller1); + + controller2 = renderer.xr.getController(1); + controller2.addEventListener('selectstart', onSelectStart); + controller2.addEventListener('selectend', onSelectEnd); + controller2.addEventListener('squeezestart', onSqueezeStart); + controller2.addEventListener('squeezeend', onSqueezeEnd); + controller2.addEventListener('connected', function (event) { + this.add(buildController(event.data)); + }); + controller2.addEventListener('disconnected', function () { + this.remove(this.children[0]); + }); + scene.add(controller2); + + // The XRControllerModelFactory will automatically fetch controller models + // that match what the user is holding as closely as possible. The models + // should be attached to the object returned from getControllerGrip in + // order to match the orientation of the held device. + + const controllerModelFactory = new XRControllerModelFactory(); + + controllerGrip1 = renderer.xr.getControllerGrip(0); + controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); + scene.add(controllerGrip1); + + controllerGrip2 = renderer.xr.getControllerGrip(1); + controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); + scene.add(controllerGrip2); + + // + + window.addEventListener('resize', onWindowResize); + + // set up rollercoaster + rollercoasterLayer = renderer.xr.createCylinderLayer( + 1, + Math.PI / 2, + 2, + new THREE.Vector3(0, 1.5, -0.5), + new THREE.Quaternion(), + 1500, + 1000, + renderRollercoaster, + ); + scene.add(rollercoasterLayer); + + rcscene = new THREE.Scene(); + rcscene.background = new THREE.Color(0xf0f0ff); + + const rclight = new THREE.HemisphereLight(0xfff0f0, 0x606066); + rclight.position.set(1, 1, 1); + rcscene.add(rclight); + + rcscene.add(train); + + rccamera = new THREE.PerspectiveCamera(50, 1, 0.1, 500); + train.add(rccamera); + + // environment + + let rcgeometry = new THREE.PlaneGeometry(500, 500, 15, 15); + rcgeometry.rotateX(-Math.PI / 2); + + const positions = rcgeometry.attributes.position.array; + const vertex = new THREE.Vector3(); + + for (let i = 0; i < positions.length; i += 3) { + vertex.fromArray(positions, i); + + vertex.x += Math.random() * 10 - 5; + vertex.z += Math.random() * 10 - 5; + + const distance = vertex.distanceTo(scene.position) / 5 - 25; + vertex.y = Math.random() * Math.max(0, distance); + + vertex.toArray(positions, i); + } + + rcgeometry.computeVertexNormals(); + + let rcmaterial = new THREE.MeshLambertMaterial({ + color: 0x407000, + }); + + let rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcscene.add(rcmesh); + + rcgeometry = new TreesGeometry(rcmesh); + rcmaterial = new THREE.MeshBasicMaterial({ + side: THREE.DoubleSide, + vertexColors: true, + }); + rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcscene.add(rcmesh); + + rcgeometry = new SkyGeometry(); + rcmaterial = new THREE.MeshBasicMaterial({ color: 0xffffff }); + rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcscene.add(rcmesh); + + // + + rcgeometry = new RollerCoasterGeometry(curve, 1500); + rcmaterial = new THREE.MeshPhongMaterial({ + vertexColors: true, + }); + rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcscene.add(rcmesh); + + rcgeometry = new RollerCoasterLiftersGeometry(curve, 100); + rcmaterial = new THREE.MeshPhongMaterial(); + rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcmesh.position.y = 0.1; + rcscene.add(rcmesh); + + rcgeometry = new RollerCoasterShadowGeometry(curve, 500); + rcmaterial = new THREE.MeshBasicMaterial({ + color: 0x305000, + depthWrite: false, + transparent: true, + }); + rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcmesh.position.y = 0.1; + rcscene.add(rcmesh); + + // + + rcgeometry = new THREE.CylinderGeometry(10, 10, 5, 15); + rcmaterial = new THREE.MeshLambertMaterial({ + color: 0xff8080, + }); + rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcmesh.position.set(-80, 10, -70); + rcmesh.rotation.x = Math.PI / 2; + rcscene.add(rcmesh); + + funfairs.push(rcmesh); + + rcgeometry = new THREE.CylinderGeometry(5, 6, 4, 10); + rcmaterial = new THREE.MeshLambertMaterial({ + color: 0x8080ff, + }); + rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); + rcmesh.position.set(50, 2, 30); + rcscene.add(rcmesh); + + funfairs.push(rcmesh); + + // set up horse animation + horseLayer = renderer.xr.createQuadLayer( + 1, + 1, + new THREE.Vector3(-1.5, 1.5, -1.5), + new THREE.Quaternion(), + 800, + 800, + renderQuad, + ); + scene.add(horseLayer); + + horseLayer.geometry = new THREE.CircleGeometry(0.5, 64); + + horseCamera = new THREE.PerspectiveCamera(50, 1, 1, 10000); + horseCamera.position.y = 300; + + horseScene = new THREE.Scene(); + horseScene.background = new THREE.Color(0xf0f0f0); + + // + + const light1 = new THREE.DirectionalLight(0xefefff, 1.5); + light1.position.set(1, 1, 1).normalize(); + horseScene.add(light1); + + const light2 = new THREE.DirectionalLight(0xffefef, 1.5); + light2.position.set(-1, -1, -1).normalize(); + horseScene.add(light2); + + const loader = new GLTFLoader(); + loader.load('models/gltf/Horse.glb', function (gltf) { + horseMesh = gltf.scene.children[0]; + horseMesh.scale.set(1.5, 1.5, 1.5); + horseScene.add(horseMesh); + + horseMixer = new THREE.AnimationMixer(horseMesh); + + horseMixer.clipAction(gltf.animations[0]).setDuration(1).play(); + }); + + function onChange() {} + + function onThicknessChange() {} + + // set up ui + guiScene = new THREE.Scene(); + guiScene.background = new THREE.Color(0x0); + + guiCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); + guiScene.add(guiCamera); + + const gui = new GUI({ width: 300 }); + gui.add(parameters, 'radius', 0.0, 1.0).onChange(onChange); + gui.add(parameters, 'tube', 0.0, 1.0).onChange(onChange); + gui.add(parameters, 'tubularSegments', 10, 150, 1).onChange(onChange); + gui.add(parameters, 'radialSegments', 2, 20, 1).onChange(onChange); + gui.add(parameters, 'p', 1, 10, 1).onChange(onChange); + gui.add(parameters, 'q', 0, 10, 1).onChange(onChange); + gui.add(parameters, 'thickness', 0, 1).onChange(onThicknessChange); + gui.domElement.style.visibility = 'hidden'; + + guiGroup = new InteractiveGroup(); + guiScene.add(guiGroup); + + const mesh = new HTMLMesh(gui.domElement); + guiGroup.add(mesh); + + const bbox = new THREE.Box3().setFromObject(guiScene); + + guiLayer = renderer.xr.createQuadLayer( + 1.2, + 0.8, + new THREE.Vector3(1.5, 1.5, -1.5), + new THREE.Quaternion(), + 1280, + 800, + renderGui, + ); + scene.add(guiLayer); + + guiCamera.left = bbox.min.x; + guiCamera.right = bbox.max.x; + guiCamera.top = bbox.max.y; + guiCamera.bottom = bbox.min.y; + guiCamera.updateProjectionMatrix(); +} + +function renderGui() { + renderer.render(guiScene, guiCamera); +} + +function renderQuad() { + horseTheta += 0.1; + + horseCamera.position.x = horseRadius * Math.sin(THREE.MathUtils.degToRad(horseTheta)); + horseCamera.position.z = horseRadius * Math.cos(THREE.MathUtils.degToRad(horseTheta)); + + horseCamera.lookAt(0, 150, 0); + + if (horseMixer) { + const time = Date.now(); + + horseMixer.update((time - prevTime) * 0.001); + + prevTime = time; + } + + renderer.render(horseScene, horseCamera); +} + +const rcposition = new THREE.Vector3(); +const tangent = new THREE.Vector3(); + +const lookAt = new THREE.Vector3(); + +let rcvelocity = 0; +let progress = 0; + +let prevTime = performance.now(); + +function renderRollercoaster() { + const time = performance.now(); + for (let i = 0; i < funfairs.length; i++) { + funfairs[i].rotation.y = time * 0.0004; + } + + // + + progress += rcvelocity; + progress = progress % 1; + + rcposition.copy(curve.getPointAt(progress)); + rcposition.y += 0.3; + + train.position.copy(rcposition); + + tangent.copy(curve.getTangentAt(progress)); + + rcvelocity -= tangent.y * 0.0000001 * rcdelta; + rcvelocity = Math.max(0.00004, Math.min(0.0002, rcvelocity)); + + train.lookAt(lookAt.copy(rcposition).sub(tangent)); + + // + + renderer.render(rcscene, rccamera); +} + +function buildController(data) { + let geometry, material; + + switch (data.targetRayMode) { + case 'tracked-pointer': + geometry = new THREE.BufferGeometry(); + geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 0, 0, -1], 3)); + geometry.setAttribute('color', new THREE.Float32BufferAttribute([0.5, 0.5, 0.5, 0, 0, 0], 3)); + + material = new THREE.LineBasicMaterial({ vertexColors: true, blending: THREE.AdditiveBlending }); + + return new THREE.Line(geometry, material); + + case 'gaze': + geometry = new THREE.RingGeometry(0.02, 0.04, 32).translate(0, 0, -1); + material = new THREE.MeshBasicMaterial({ opacity: 0.5, transparent: true }); + return new THREE.Mesh(geometry, material); + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function handleController(controller) { + if (controller.userData.isSelecting) { + const object = room.children[count++]; + + object.position.copy(controller.position); + object.userData.velocity.x = (Math.random() - 0.5) * 3; + object.userData.velocity.y = (Math.random() - 0.5) * 3; + object.userData.velocity.z = Math.random() - 9; + object.userData.velocity.applyQuaternion(controller.quaternion); + + if (count === room.children.length) count = 0; + } + + const intersections = getIntersections(controller); + for (let x = 0; x < intersections.length; x++) { + if (intersections[x].object == guiLayer) { + const uv = intersections[x].uv; + guiGroup.children[0].dispatchEvent({ type: 'mousemove', data: { x: uv.x, y: 1 - uv.y }, target: guiGroup }); + } + } +} + +// + +function render() { + timer.update(); + + handleController(controller1); + handleController(controller2); + + // rotate horse + horseLayer.rotation.y -= 0.02; + + // + const delta = timer.getDelta() * 0.8; + + const range = 3 - radius; + + for (let i = 0; i < room.children.length; i++) { + const object = room.children[i]; + + object.position.x += object.userData.velocity.x * delta; + object.position.y += object.userData.velocity.y * delta; + object.position.z += object.userData.velocity.z * delta; + + // keep objects inside room + + if (object.position.x < -range || object.position.x > range) { + object.position.x = THREE.MathUtils.clamp(object.position.x, -range, range); + object.userData.velocity.x = -object.userData.velocity.x; + } + + if (object.position.y < radius || object.position.y > 6) { + object.position.y = Math.max(object.position.y, radius); + + object.userData.velocity.x *= 0.98; + object.userData.velocity.y = -object.userData.velocity.y * 0.8; + object.userData.velocity.z *= 0.98; + } + + if (object.position.z < -range || object.position.z > range) { + object.position.z = THREE.MathUtils.clamp(object.position.z, -range, range); + object.userData.velocity.z = -object.userData.velocity.z; + } + + for (let j = i + 1; j < room.children.length; j++) { + const object2 = room.children[j]; + + normal.copy(object.position).sub(object2.position); + + const distance = normal.length(); + + if (distance < 2 * radius) { + normal.multiplyScalar(0.5 * distance - radius); + + object.position.sub(normal); + object2.position.add(normal); + + normal.normalize(); + + relativeVelocity.copy(object.userData.velocity).sub(object2.userData.velocity); + + normal = normal.multiplyScalar(relativeVelocity.dot(normal)); + + object.userData.velocity.sub(normal); + object2.userData.velocity.add(normal); + } + } + + object.userData.velocity.y -= 9.8 * delta; + } + + renderPipeline.render(scene, camera); +} diff --git a/examples-testing/examples/webgpu_xr_rollercoaster.ts b/examples-testing/examples/webgpu_xr_rollercoaster.ts new file mode 100644 index 000000000..4c4998ce1 --- /dev/null +++ b/examples-testing/examples/webgpu_xr_rollercoaster.ts @@ -0,0 +1,259 @@ +import * as THREE from 'three/webgpu'; + +import { + RollerCoasterGeometry, + RollerCoasterShadowGeometry, + RollerCoasterLiftersGeometry, + TreesGeometry, + SkyGeometry, +} from 'three/addons/misc/RollerCoaster.js'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; +import { setupWebGLXRFallback } from 'three/addons/webxr/WebGLXRFallback.js'; + +let mesh, material, geometry; +let renderer, renderPipeline; + +const rendererParameters = { antialias: true, outputBufferType: THREE.UnsignedByteType, multiview: false }; + +renderer = createRenderer(); +setRenderer(renderer); +setupWebGLXRFallback(renderer, () => createRenderer(true), setRenderer); + +document.body.appendChild(VRButton.createButton(renderer, { optionalFeatures: ['webgpu'] })); + +// + +function createRenderer(forceWebGL = false) { + const parameters = { ...rendererParameters }; + + if (forceWebGL === true) parameters.forceWebGL = true; + + const renderer = new THREE.WebGPURenderer(parameters); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + renderer.xr.setReferenceSpaceType('local'); + + return renderer; +} + +function setRenderer(newRenderer, oldRenderer = null) { + if (oldRenderer === null) { + document.body.appendChild(newRenderer.domElement); + } else { + document.body.replaceChild(newRenderer.domElement, oldRenderer.domElement); + oldRenderer.dispose(); + } + + renderer = newRenderer; + renderPipeline = new THREE.DirectRenderPipeline(renderer); +} + +const scene = new THREE.Scene(); +scene.background = new THREE.Color(0xf0f0ff); + +const light = new THREE.HemisphereLight(0xfff0f0, 0x60606, 3); +light.position.set(1, 1, 1); +scene.add(light); + +const train = new THREE.Object3D(); +scene.add(train); + +const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 500); +train.add(camera); + +// environment + +geometry = new THREE.PlaneGeometry(500, 500, 15, 15); +geometry.rotateX(-Math.PI / 2); + +const positions = geometry.attributes.position.array; +const vertex = new THREE.Vector3(); + +for (let i = 0; i < positions.length; i += 3) { + vertex.fromArray(positions, i); + + vertex.x += Math.random() * 10 - 5; + vertex.z += Math.random() * 10 - 5; + + const distance = vertex.distanceTo(scene.position) / 5 - 25; + vertex.y = Math.random() * Math.max(0, distance); + + vertex.toArray(positions, i); +} + +geometry.computeVertexNormals(); + +material = new THREE.MeshLambertMaterial({ + color: 0x407000, +}); + +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +geometry = new TreesGeometry(mesh); +material = new THREE.MeshBasicMaterial({ + side: THREE.DoubleSide, + vertexColors: true, +}); +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +geometry = new SkyGeometry(); +material = new THREE.MeshBasicMaterial({ color: 0xffffff }); +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +// + +const PI2 = Math.PI * 2; + +const curve = (function () { + const vector = new THREE.Vector3(); + const vector2 = new THREE.Vector3(); + + return { + getPointAt: function (t) { + t = t * PI2; + + const x = Math.sin(t * 3) * Math.cos(t * 4) * 50; + const y = Math.sin(t * 10) * 2 + Math.cos(t * 17) * 2 + 5; + const z = Math.sin(t) * Math.sin(t * 4) * 50; + + return vector.set(x, y, z).multiplyScalar(2); + }, + + getTangentAt: function (t) { + const delta = 0.0001; + const t1 = Math.max(0, t - delta); + const t2 = Math.min(1, t + delta); + + return vector2.copy(this.getPointAt(t2)).sub(this.getPointAt(t1)).normalize(); + }, + }; +})(); + +geometry = new RollerCoasterGeometry(curve, 1500); +material = new THREE.MeshPhongMaterial({ + vertexColors: true, +}); +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +geometry = new RollerCoasterLiftersGeometry(curve, 100); +material = new THREE.MeshPhongMaterial(); +mesh = new THREE.Mesh(geometry, material); +mesh.position.y = 0.1; +scene.add(mesh); + +geometry = new RollerCoasterShadowGeometry(curve, 500); +material = new THREE.MeshBasicMaterial({ + color: 0x305000, + depthWrite: false, + transparent: true, +}); +mesh = new THREE.Mesh(geometry, material); +mesh.position.y = 0.1; +scene.add(mesh); + +const funfairs = []; + +// + +geometry = new THREE.CylinderGeometry(10, 10, 5, 15); +material = new THREE.MeshLambertMaterial({ + color: 0xff8080, +}); +mesh = new THREE.Mesh(geometry, material); +mesh.position.set(-80, 10, -70); +mesh.rotation.x = Math.PI / 2; +scene.add(mesh); + +funfairs.push(mesh); + +geometry = new THREE.CylinderGeometry(5, 6, 4, 10); +material = new THREE.MeshLambertMaterial({ + color: 0x8080ff, +}); +mesh = new THREE.Mesh(geometry, material); +mesh.position.set(50, 2, 30); +scene.add(mesh); + +funfairs.push(mesh); + +// + +window.addEventListener('resize', onWindowResize); + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +const position = new THREE.Vector3(); +const tangent = new THREE.Vector3(); + +const lookAt = new THREE.Vector3(); + +const tangent1 = new THREE.Vector3(); +const tangent2 = new THREE.Vector3(); +const bankQuaternion = new THREE.Quaternion(); + +let velocity = 0; +let progress = 0; + +let prevTime = performance.now(); + +function animate() { + const time = performance.now(); + const delta = time - prevTime; + + for (let i = 0; i < funfairs.length; i++) { + funfairs[i].rotation.y = time * 0.0004; + } + + // + + progress += velocity; + progress = progress % 1; + + position.copy(curve.getPointAt(progress)); + position.y += 0.3; + + train.position.copy(position); + + tangent.copy(curve.getTangentAt(progress)); + + velocity -= tangent.y * 0.0000001 * delta; + velocity = Math.max(0.00004, Math.min(0.0002, velocity)); + + // banking + + const bankDelta = 0.01; + const t1 = (((progress - bankDelta) % 1) + 1) % 1; + const t2 = (progress + bankDelta) % 1; + + tangent1.copy(curve.getTangentAt(t1)); + tangent2.copy(curve.getTangentAt(t2)); + + let headingChange = Math.atan2(tangent2.x, tangent2.z) - Math.atan2(tangent1.x, tangent1.z); + if (headingChange > Math.PI) headingChange -= Math.PI * 2; + if (headingChange < -Math.PI) headingChange += Math.PI * 2; + + train.up.set(0, 1, 0); + bankQuaternion.setFromAxisAngle(tangent, -Math.atan(headingChange * 8) * 0.5); + train.up.applyQuaternion(bankQuaternion); + + train.lookAt(lookAt.copy(position).sub(tangent)); + + // + + renderPipeline.render(scene, camera); + + prevTime = time; +} diff --git a/examples-testing/examples/webgpu_xr_shadows.ts b/examples-testing/examples/webgpu_xr_shadows.ts new file mode 100644 index 000000000..c3d948e33 --- /dev/null +++ b/examples-testing/examples/webgpu_xr_shadows.ts @@ -0,0 +1,195 @@ +import * as THREE from 'three/webgpu'; + +import { VRButton } from 'three/addons/webxr/VRButton.js'; +import { setupWebGLXRFallback } from 'three/addons/webxr/WebGLXRFallback.js'; + +const rendererParameters = { antialias: true, outputBufferType: THREE.UnsignedByteType, multiview: false }; +const timer = new THREE.Timer(); +timer.connect(document); + +let camera, cameraRig, scene, renderer; +let directionalLight, torusKnot, box, icosahedron, cone, glass; + +init(); + +function init() { + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x24282f); + scene.fog = new THREE.Fog(0x24282f, 8, 16); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 30); + camera.position.y = 1.6; + + cameraRig = new THREE.Group(); + cameraRig.position.z = 4; + cameraRig.add(camera); + scene.add(cameraRig); + + // lights + + scene.add(new THREE.HemisphereLight(0xb8c5df, 0x3c3028, 1.5)); + + directionalLight = new THREE.DirectionalLight(0xfff1d6, 4); + directionalLight.position.set(-4, 6, 2); + directionalLight.castShadow = true; + directionalLight.shadow.camera.near = 0.1; + directionalLight.shadow.camera.far = 15; + directionalLight.shadow.camera.left = -5; + directionalLight.shadow.camera.right = 5; + directionalLight.shadow.camera.top = 5; + directionalLight.shadow.camera.bottom = -5; + directionalLight.shadow.mapSize.set(2048, 2048); + directionalLight.shadow.bias = -0.0005; + scene.add(directionalLight); + scene.add(directionalLight.target); + + // environment + + const floor = new THREE.Mesh( + new THREE.PlaneGeometry(14, 14), + new THREE.MeshStandardMaterial({ color: 0x73786f, roughness: 0.9 }), + ); + floor.rotation.x = -Math.PI / 2; + floor.receiveShadow = true; + scene.add(floor); + + const platform = new THREE.Mesh( + new THREE.CylinderGeometry(1.25, 1.4, 0.3, 64), + new THREE.MeshStandardMaterial({ color: 0x40464d, roughness: 0.6, metalness: 0.2 }), + ); + platform.position.y = 0.15; + platform.castShadow = true; + platform.receiveShadow = true; + scene.add(platform); + + // shadow casters + + torusKnot = new THREE.Mesh( + new THREE.TorusKnotGeometry(0.55, 0.18, 128, 24), + new THREE.MeshStandardMaterial({ color: 0xe7ad52, roughness: 0.25, metalness: 0.35 }), + ); + torusKnot.position.y = 1.35; + torusKnot.castShadow = true; + torusKnot.receiveShadow = true; + scene.add(torusKnot); + + box = new THREE.Mesh( + new THREE.BoxGeometry(0.7, 0.7, 0.7), + new THREE.MeshStandardMaterial({ color: 0xd85f50, roughness: 0.5 }), + ); + box.position.set(-1.8, 0.6, 0.25); + box.rotation.set(0.2, 0.4, 0.1); + box.castShadow = true; + box.receiveShadow = true; + scene.add(box); + + icosahedron = new THREE.Mesh( + new THREE.IcosahedronGeometry(0.5, 2), + new THREE.MeshStandardMaterial({ color: 0x4f91b8, roughness: 0.35, metalness: 0.15 }), + ); + icosahedron.position.set(1.8, 0.7, 0.1); + icosahedron.castShadow = true; + icosahedron.receiveShadow = true; + scene.add(icosahedron); + + cone = new THREE.Mesh( + new THREE.ConeGeometry(0.5, 1.1, 48), + new THREE.MeshStandardMaterial({ color: 0x68a66b, roughness: 0.65 }), + ); + cone.position.set(0, 0.55, -2); + cone.castShadow = true; + cone.receiveShadow = true; + scene.add(cone); + + // transmission + + glass = new THREE.Mesh( + new THREE.IcosahedronGeometry(0.65, 4), + new THREE.MeshPhysicalMaterial({ + color: 0xb9e7ff, + roughness: 0.05, + metalness: 0, + transmission: 1, + thickness: 0.9, + ior: 1.45, + attenuationColor: 0x72b5d4, + attenuationDistance: 3, + specularIntensity: 1, + side: THREE.DoubleSide, + }), + ); + glass.position.set(0.9, 1.15, 1.2); + glass.castShadow = true; + glass.receiveShadow = true; + scene.add(glass); + + // renderer + + renderer = createRenderer(); + setRenderer(renderer); + setupWebGLXRFallback(renderer, () => createRenderer(true), setRenderer); + + document.body.appendChild(VRButton.createButton(renderer, { optionalFeatures: ['webgpu'] })); + + window.addEventListener('resize', onWindowResize); +} + +function createRenderer(forceWebGL = false) { + const parameters = { ...rendererParameters }; + + if (forceWebGL === true) parameters.forceWebGL = true; + + const renderer = new THREE.WebGPURenderer(parameters); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.shadowMap.type = THREE.PCFShadowMap; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1.2; + renderer.xr.enabled = true; + + return renderer; +} + +function setRenderer(newRenderer, oldRenderer = null) { + if (oldRenderer === null) { + document.body.appendChild(newRenderer.domElement); + } else { + document.body.replaceChild(newRenderer.domElement, oldRenderer.domElement); + oldRenderer.dispose(); + } + + renderer = newRenderer; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + const elapsed = timer.getElapsed(); + const delta = timer.getDelta(); + + torusKnot.position.y = 1.35 + Math.sin(elapsed * 1.5) * 0.15; + torusKnot.rotation.x += delta * 0.35; + torusKnot.rotation.y += delta * 0.7; + + box.rotation.y += delta * 0.4; + icosahedron.rotation.x += delta * 0.3; + icosahedron.rotation.y -= delta * 0.5; + cone.rotation.y -= delta * 0.35; + glass.position.y = 1.15 + Math.sin(elapsed * 1.1) * 0.08; + glass.rotation.x -= delta * 0.2; + glass.rotation.y += delta * 0.3; + + directionalLight.position.x = Math.cos(elapsed * 0.25) * 4; + directionalLight.position.z = Math.sin(elapsed * 0.25) * 4; + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_ar_cones.ts b/examples-testing/examples/webxr_ar_cones.ts new file mode 100644 index 000000000..95eb34393 --- /dev/null +++ b/examples-testing/examples/webxr_ar_cones.ts @@ -0,0 +1,66 @@ +import * as THREE from 'three'; +import { ARButton } from 'three/addons/webxr/ARButton.js'; + +let camera, scene, renderer; +let controller; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); + + const light = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 3); + light.position.set(0.5, 1, 0.25); + scene.add(light); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + container.appendChild(renderer.domElement); + + // + + document.body.appendChild(ARButton.createButton(renderer)); + + // + + const geometry = new THREE.CylinderGeometry(0, 0.05, 0.2, 32).rotateX(Math.PI / 2); + + function onSelect() { + const material = new THREE.MeshPhongMaterial({ color: 0xffffff * Math.random() }); + const mesh = new THREE.Mesh(geometry, material); + mesh.position.set(0, 0, -0.3).applyMatrix4(controller.matrixWorld); + mesh.quaternion.setFromRotationMatrix(controller.matrixWorld); + scene.add(mesh); + } + + controller = renderer.xr.getController(0); + controller.addEventListener('select', onSelect); + scene.add(controller); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_ar_hittest.ts b/examples-testing/examples/webxr_ar_hittest.ts new file mode 100644 index 000000000..009b4b976 --- /dev/null +++ b/examples-testing/examples/webxr_ar_hittest.ts @@ -0,0 +1,119 @@ +import * as THREE from 'three'; +import { ARButton } from 'three/addons/webxr/ARButton.js'; + +let container; +let camera, scene, renderer; +let controller1, controller2; + +let reticle; + +let hitTestSource = null; +let hitTestSourceRequested = false; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); + + const light = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 3); + light.position.set(0.5, 1, 0.25); + scene.add(light); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + container.appendChild(renderer.domElement); + + // + + document.body.appendChild(ARButton.createButton(renderer, { requiredFeatures: ['hit-test'] })); + + // + + const geometry = new THREE.CylinderGeometry(0.1, 0.1, 0.2, 32).translate(0, 0.1, 0); + + function onSelect() { + if (reticle.visible) { + const material = new THREE.MeshPhongMaterial({ color: 0xffffff * Math.random() }); + const mesh = new THREE.Mesh(geometry, material); + reticle.matrix.decompose(mesh.position, mesh.quaternion, mesh.scale); + mesh.scale.y = Math.random() * 2 + 1; + scene.add(mesh); + } + } + + controller1 = renderer.xr.getController(0); + controller1.addEventListener('select', onSelect); + scene.add(controller1); + + controller2 = renderer.xr.getController(1); + controller2.addEventListener('select', onSelect); + scene.add(controller2); + + reticle = new THREE.Mesh( + new THREE.RingGeometry(0.15, 0.2, 32).rotateX(-Math.PI / 2), + new THREE.MeshBasicMaterial(), + ); + reticle.matrixAutoUpdate = false; + reticle.visible = false; + scene.add(reticle); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate(timestamp, frame) { + if (frame) { + const referenceSpace = renderer.xr.getReferenceSpace(); + const session = renderer.xr.getSession(); + + if (hitTestSourceRequested === false) { + session.requestReferenceSpace('viewer').then(function (referenceSpace) { + session.requestHitTestSource({ space: referenceSpace }).then(function (source) { + hitTestSource = source; + }); + }); + + session.addEventListener('end', function () { + hitTestSourceRequested = false; + hitTestSource = null; + }); + + hitTestSourceRequested = true; + } + + if (hitTestSource) { + const hitTestResults = frame.getHitTestResults(hitTestSource); + + if (hitTestResults.length) { + const hit = hitTestResults[0]; + + reticle.visible = true; + reticle.matrix.fromArray(hit.getPose(referenceSpace).transform.matrix); + } else { + reticle.visible = false; + } + } + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_ar_lighting.ts b/examples-testing/examples/webxr_ar_lighting.ts new file mode 100644 index 000000000..10f49f0bf --- /dev/null +++ b/examples-testing/examples/webxr_ar_lighting.ts @@ -0,0 +1,124 @@ +import * as THREE from 'three'; +import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; +import { ARButton } from 'three/addons/webxr/ARButton.js'; +import { XREstimatedLight } from 'three/addons/webxr/XREstimatedLight.js'; + +let camera, scene, renderer; +let controller; +let defaultEnvironment; + +init(); + +function init() { + const container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); + + const defaultLight = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 1); + defaultLight.position.set(0.5, 1, 0.25); + scene.add(defaultLight); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + container.appendChild(renderer.domElement); + + // Don't add the XREstimatedLight to the scene initially. + // It doesn't have any estimated lighting values until an AR session starts. + + const xrLight = new XREstimatedLight(renderer); + + xrLight.addEventListener('estimationstart', () => { + // Swap the default light out for the estimated one once we start getting some estimated values. + scene.add(xrLight); + scene.remove(defaultLight); + + // The estimated lighting also provides an environment cubemap, which we can apply here. + if (xrLight.environment) { + scene.environment = xrLight.environment; + } + }); + + xrLight.addEventListener('estimationend', () => { + // Swap the lights back when we stop receiving estimated values. + scene.add(defaultLight); + scene.remove(xrLight); + + // Revert back to the default environment. + scene.environment = defaultEnvironment; + }); + + // + + new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + defaultEnvironment = texture; + + scene.environment = defaultEnvironment; + }); + + // + + // In order for lighting estimation to work, 'light-estimation' must be included as either an optional or required feature. + document.body.appendChild(ARButton.createButton(renderer, { optionalFeatures: ['light-estimation'] })); + + // + + const ballGeometry = new THREE.SphereGeometry(0.175, 32, 32); + const ballGroup = new THREE.Group(); + ballGroup.position.z = -2; + + const rows = 3; + const cols = 3; + + for (let i = 0; i < rows; i++) { + for (let j = 0; j < cols; j++) { + const ballMaterial = new THREE.MeshStandardMaterial({ + color: 0xdddddd, + roughness: i / rows, + metalness: j / cols, + }); + const ballMesh = new THREE.Mesh(ballGeometry, ballMaterial); + ballMesh.position.set((i + 0.5 - rows * 0.5) * 0.4, (j + 0.5 - cols * 0.5) * 0.4, 0); + ballGroup.add(ballMesh); + } + } + + scene.add(ballGroup); + + // + + function onSelect() { + ballGroup.position.set(0, 0, -2).applyMatrix4(controller.matrixWorld); + ballGroup.quaternion.setFromRotationMatrix(controller.matrixWorld); + } + + controller = renderer.xr.getController(0); + controller.addEventListener('select', onSelect); + scene.add(controller); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_ar_plane_detection.ts b/examples-testing/examples/webxr_ar_plane_detection.ts new file mode 100644 index 000000000..841b6b04b --- /dev/null +++ b/examples-testing/examples/webxr_ar_plane_detection.ts @@ -0,0 +1,46 @@ +import * as THREE from 'three'; +import { ARButton } from 'three/addons/webxr/ARButton.js'; +import { XRPlanes } from 'three/addons/webxr/XRPlanes.js'; + +// + +const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setAnimationLoop(animate); +renderer.xr.enabled = true; +document.body.appendChild(renderer.domElement); + +document.body.appendChild( + ARButton.createButton(renderer, { + requiredFeatures: ['plane-detection'], + }), +); + +window.addEventListener('resize', onWindowResize); + +// + +const scene = new THREE.Scene(); + +const planes = new XRPlanes(renderer); +scene.add(planes); + +const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); + +const light = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 3); +light.position.set(0.5, 1, 0.25); +scene.add(light); + +// + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_vr_handinput.ts b/examples-testing/examples/webxr_vr_handinput.ts new file mode 100644 index 000000000..d746e4582 --- /dev/null +++ b/examples-testing/examples/webxr_vr_handinput.ts @@ -0,0 +1,126 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; +import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; +import { XRHandModelFactory } from 'three/addons/webxr/XRHandModelFactory.js'; + +let container; +let camera, scene, renderer; +let hand1, hand2; +let controller1, controller2; +let controllerGrip1, controllerGrip2; + +let controls; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x444444); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(0, 1.6, 3); + + controls = new OrbitControls(camera, container); + controls.target.set(0, 1.6, 0); + controls.update(); + + const floorGeometry = new THREE.PlaneGeometry(4, 4); + const floorMaterial = new THREE.MeshStandardMaterial({ color: 0x666666 }); + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.rotation.x = -Math.PI / 2; + floor.receiveShadow = true; + scene.add(floor); + + scene.add(new THREE.HemisphereLight(0xbcbcbc, 0xa5a5a5, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 6, 0); + light.castShadow = true; + light.shadow.camera.top = 2; + light.shadow.camera.bottom = -2; + light.shadow.camera.right = 2; + light.shadow.camera.left = -2; + light.shadow.mapSize.set(4096, 4096); + scene.add(light); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.xr.enabled = true; + + container.appendChild(renderer.domElement); + + const sessionInit = { + requiredFeatures: ['hand-tracking'], + }; + + document.body.appendChild(VRButton.createButton(renderer, sessionInit)); + + // controllers + + controller1 = renderer.xr.getController(0); + scene.add(controller1); + + controller2 = renderer.xr.getController(1); + scene.add(controller2); + + const controllerModelFactory = new XRControllerModelFactory(); + const handModelFactory = new XRHandModelFactory(); + + // Hand 1 + controllerGrip1 = renderer.xr.getControllerGrip(0); + controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); + scene.add(controllerGrip1); + + hand1 = renderer.xr.getHand(0); + hand1.add(handModelFactory.createHandModel(hand1)); + + scene.add(hand1); + + // Hand 2 + controllerGrip2 = renderer.xr.getControllerGrip(1); + controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); + scene.add(controllerGrip2); + + hand2 = renderer.xr.getHand(1); + hand2.add(handModelFactory.createHandModel(hand2)); + scene.add(hand2); + + // + + const geometry = new THREE.BufferGeometry().setFromPoints([ + new THREE.Vector3(0, 0, 0), + new THREE.Vector3(0, 0, -1), + ]); + + const line = new THREE.Line(geometry); + line.name = 'line'; + line.scale.z = 5; + + controller1.add(line.clone()); + controller2.add(line.clone()); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} +// + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_vr_panorama.ts b/examples-testing/examples/webxr_vr_panorama.ts new file mode 100644 index 000000000..535e1c937 --- /dev/null +++ b/examples-testing/examples/webxr_vr_panorama.ts @@ -0,0 +1,92 @@ +import * as THREE from 'three'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; + +let camera; +let renderer; +let scene; + +init(); + +function init() { + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + renderer.xr.setReferenceSpaceType('local'); + document.body.appendChild(renderer.domElement); + + document.body.appendChild(VRButton.createButton(renderer)); + + // + + scene = new THREE.Scene(); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); + camera.layers.enable(1); + + const geometry = new THREE.BoxGeometry(100, 100, 100); + geometry.scale(1, 1, -1); + + const textures = getTexturesFromAtlasFile('textures/cube/sun_temple_stripe_stereo.jpg', 12); + + const materials = []; + + for (let i = 0; i < 6; i++) { + materials.push(new THREE.MeshBasicMaterial({ map: textures[i] })); + } + + const skyBox = new THREE.Mesh(geometry, materials); + skyBox.layers.set(1); + scene.add(skyBox); + + const materialsR = []; + + for (let i = 6; i < 12; i++) { + materialsR.push(new THREE.MeshBasicMaterial({ map: textures[i] })); + } + + const skyBoxR = new THREE.Mesh(geometry, materialsR); + skyBoxR.layers.set(2); + scene.add(skyBoxR); + + window.addEventListener('resize', onWindowResize); +} + +function getTexturesFromAtlasFile(atlasImgUrl, tilesNum) { + const textures = []; + + for (let i = 0; i < tilesNum; i++) { + textures[i] = new THREE.Texture(); + } + + const loader = new THREE.ImageLoader(); + loader.load(atlasImgUrl, function (imageObj) { + let canvas, context; + const tileWidth = imageObj.height; + + for (let i = 0; i < textures.length; i++) { + canvas = document.createElement('canvas'); + context = canvas.getContext('2d'); + canvas.height = tileWidth; + canvas.width = tileWidth; + context.drawImage(imageObj, tileWidth * i, 0, tileWidth, tileWidth, 0, 0, tileWidth, tileWidth); + textures[i].colorSpace = THREE.SRGBColorSpace; + textures[i].image = canvas; + textures[i].needsUpdate = true; + } + }); + + return textures; +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_vr_panorama_depth.ts b/examples-testing/examples/webxr_vr_panorama_depth.ts new file mode 100644 index 000000000..ea3d76199 --- /dev/null +++ b/examples-testing/examples/webxr_vr_panorama_depth.ts @@ -0,0 +1,93 @@ +import * as THREE from 'three'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; + +let camera, scene, renderer, sphere, timer; + +init(); + +function init() { + const container = document.getElementById('container'); + + timer = new THREE.Timer(); + timer.connect(document); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x101010); + + const light = new THREE.AmbientLight(0xffffff, 3); + scene.add(light); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 2000); + scene.add(camera); + + // Create the panoramic sphere geometry + const panoSphereGeo = new THREE.SphereGeometry(6, 256, 256); + + // Create the panoramic sphere material + const panoSphereMat = new THREE.MeshStandardMaterial({ + side: THREE.BackSide, + displacementScale: -4.0, + }); + + // Create the panoramic sphere mesh + sphere = new THREE.Mesh(panoSphereGeo, panoSphereMat); + + // Load and assign the texture and depth map + const manager = new THREE.LoadingManager(); + const loader = new THREE.TextureLoader(manager); + + loader.load('./textures/kandao3.jpg', function (texture) { + texture.colorSpace = THREE.SRGBColorSpace; + texture.minFilter = THREE.NearestFilter; + texture.generateMipmaps = false; + sphere.material.map = texture; + }); + + loader.load('./textures/kandao3_depthmap.jpg', function (depth) { + depth.minFilter = THREE.NearestFilter; + depth.generateMipmaps = false; + sphere.material.displacementMap = depth; + }); + + // On load complete add the panoramic sphere to the scene + manager.onLoad = function () { + scene.add(sphere); + }; + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + renderer.xr.setReferenceSpaceType('local'); + container.appendChild(renderer.domElement); + + document.body.appendChild(VRButton.createButton(renderer)); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + timer.update(); + + // If we are not presenting move the camera a little so the effect is visible + + if (renderer.xr.isPresenting === false) { + const time = timer.getElapsed(); + + sphere.rotation.y += 0.001; + sphere.position.x = Math.sin(time) * 0.2; + sphere.position.z = Math.cos(time) * 0.2; + } + + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_vr_rollercoaster.ts b/examples-testing/examples/webxr_vr_rollercoaster.ts new file mode 100644 index 000000000..50baf50f8 --- /dev/null +++ b/examples-testing/examples/webxr_vr_rollercoaster.ts @@ -0,0 +1,232 @@ +import * as THREE from 'three'; + +import { + RollerCoasterGeometry, + RollerCoasterShadowGeometry, + RollerCoasterLiftersGeometry, + TreesGeometry, + SkyGeometry, +} from 'three/addons/misc/RollerCoaster.js'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; + +let mesh, material, geometry; + +const renderer = new THREE.WebGLRenderer({ antialias: true }); +renderer.setPixelRatio(window.devicePixelRatio); +renderer.setSize(window.innerWidth, window.innerHeight); +renderer.setAnimationLoop(animate); +renderer.xr.enabled = true; +renderer.xr.setReferenceSpaceType('local'); +document.body.appendChild(renderer.domElement); + +document.body.appendChild(VRButton.createButton(renderer)); + +// + +const scene = new THREE.Scene(); +scene.background = new THREE.Color(0xf0f0ff); + +const light = new THREE.HemisphereLight(0xfff0f0, 0x60606, 3); +light.position.set(1, 1, 1); +scene.add(light); + +const train = new THREE.Object3D(); +scene.add(train); + +const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 500); +train.add(camera); + +// environment + +geometry = new THREE.PlaneGeometry(500, 500, 15, 15); +geometry.rotateX(-Math.PI / 2); + +const positions = geometry.attributes.position.array; +const vertex = new THREE.Vector3(); + +for (let i = 0; i < positions.length; i += 3) { + vertex.fromArray(positions, i); + + vertex.x += Math.random() * 10 - 5; + vertex.z += Math.random() * 10 - 5; + + const distance = vertex.distanceTo(scene.position) / 5 - 25; + vertex.y = Math.random() * Math.max(0, distance); + + vertex.toArray(positions, i); +} + +geometry.computeVertexNormals(); + +material = new THREE.MeshLambertMaterial({ + color: 0x407000, +}); + +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +geometry = new TreesGeometry(mesh); +material = new THREE.MeshBasicMaterial({ + side: THREE.DoubleSide, + vertexColors: true, +}); +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +geometry = new SkyGeometry(); +material = new THREE.MeshBasicMaterial({ color: 0xffffff }); +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +// + +const PI2 = Math.PI * 2; + +const curve = (function () { + const vector = new THREE.Vector3(); + const vector2 = new THREE.Vector3(); + + return { + getPointAt: function (t) { + t = t * PI2; + + const x = Math.sin(t * 3) * Math.cos(t * 4) * 50; + const y = Math.sin(t * 10) * 2 + Math.cos(t * 17) * 2 + 5; + const z = Math.sin(t) * Math.sin(t * 4) * 50; + + return vector.set(x, y, z).multiplyScalar(2); + }, + + getTangentAt: function (t) { + const delta = 0.0001; + const t1 = Math.max(0, t - delta); + const t2 = Math.min(1, t + delta); + + return vector2.copy(this.getPointAt(t2)).sub(this.getPointAt(t1)).normalize(); + }, + }; +})(); + +geometry = new RollerCoasterGeometry(curve, 1500); +material = new THREE.MeshPhongMaterial({ + vertexColors: true, +}); +mesh = new THREE.Mesh(geometry, material); +scene.add(mesh); + +geometry = new RollerCoasterLiftersGeometry(curve, 100); +material = new THREE.MeshPhongMaterial(); +mesh = new THREE.Mesh(geometry, material); +mesh.position.y = 0.1; +scene.add(mesh); + +geometry = new RollerCoasterShadowGeometry(curve, 500); +material = new THREE.MeshBasicMaterial({ + color: 0x305000, + depthWrite: false, + transparent: true, +}); +mesh = new THREE.Mesh(geometry, material); +mesh.position.y = 0.1; +scene.add(mesh); + +const funfairs = []; + +// + +geometry = new THREE.CylinderGeometry(10, 10, 5, 15); +material = new THREE.MeshLambertMaterial({ + color: 0xff8080, +}); +mesh = new THREE.Mesh(geometry, material); +mesh.position.set(-80, 10, -70); +mesh.rotation.x = Math.PI / 2; +scene.add(mesh); + +funfairs.push(mesh); + +geometry = new THREE.CylinderGeometry(5, 6, 4, 10); +material = new THREE.MeshLambertMaterial({ + color: 0x8080ff, +}); +mesh = new THREE.Mesh(geometry, material); +mesh.position.set(50, 2, 30); +scene.add(mesh); + +funfairs.push(mesh); + +// + +window.addEventListener('resize', onWindowResize); + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +const position = new THREE.Vector3(); +const tangent = new THREE.Vector3(); + +const lookAt = new THREE.Vector3(); + +const tangent1 = new THREE.Vector3(); +const tangent2 = new THREE.Vector3(); +const bankQuaternion = new THREE.Quaternion(); + +let velocity = 0; +let progress = 0; + +let prevTime = performance.now(); + +function animate() { + const time = performance.now(); + const delta = time - prevTime; + + for (let i = 0; i < funfairs.length; i++) { + funfairs[i].rotation.y = time * 0.0004; + } + + // + + progress += velocity; + progress = progress % 1; + + position.copy(curve.getPointAt(progress)); + position.y += 0.3; + + train.position.copy(position); + + tangent.copy(curve.getTangentAt(progress)); + + velocity -= tangent.y * 0.0000001 * delta; + velocity = Math.max(0.00004, Math.min(0.0002, velocity)); + + // banking + + const bankDelta = 0.01; + const t1 = (((progress - bankDelta) % 1) + 1) % 1; + const t2 = (progress + bankDelta) % 1; + + tangent1.copy(curve.getTangentAt(t1)); + tangent2.copy(curve.getTangentAt(t2)); + + let headingChange = Math.atan2(tangent2.x, tangent2.z) - Math.atan2(tangent1.x, tangent1.z); + if (headingChange > Math.PI) headingChange -= Math.PI * 2; + if (headingChange < -Math.PI) headingChange += Math.PI * 2; + + train.up.set(0, 1, 0); + bankQuaternion.setFromAxisAngle(tangent, -Math.atan(headingChange * 8) * 0.5); + train.up.applyQuaternion(bankQuaternion); + + train.lookAt(lookAt.copy(position).sub(tangent)); + + // + + renderer.render(scene, camera); + + prevTime = time; +} diff --git a/examples-testing/examples/webxr_vr_sandbox.ts b/examples-testing/examples/webxr_vr_sandbox.ts new file mode 100644 index 000000000..19108d589 --- /dev/null +++ b/examples-testing/examples/webxr_vr_sandbox.ts @@ -0,0 +1,192 @@ +import * as THREE from 'three'; + +import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; +import { Reflector } from 'three/addons/objects/Reflector.js'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; + +import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; +import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; +import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; + +import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; +import Stats from 'three/addons/libs/stats.module.js'; + +let camera, scene, renderer; +let reflector; +let stats, statsMesh; + +const parameters = { + radius: 0.6, + tube: 0.2, + tubularSegments: 150, + radialSegments: 20, + p: 2, + q: 3, + thickness: 0.5, +}; + +init(); + +function init() { + scene = new THREE.Scene(); + + new HDRLoader().setPath('textures/equirectangular/').load('moonless_golf_1k.hdr', function (texture) { + texture.mapping = THREE.EquirectangularReflectionMapping; + + scene.background = texture; + scene.environment = texture; + }); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(0, 1.6, 1.5); + + // + + const torusGeometry = new THREE.TorusKnotGeometry(...Object.values(parameters)); + const torusMaterial = new THREE.MeshPhysicalMaterial({ + transmission: 1.0, + roughness: 0, + metalness: 0.25, + thickness: 0.5, + side: THREE.DoubleSide, + }); + const torus = new THREE.Mesh(torusGeometry, torusMaterial); + torus.name = 'torus'; + torus.position.y = 1.5; + torus.position.z = -2; + scene.add(torus); + + const cylinderGeometry = new THREE.CylinderGeometry(1, 1, 0.1, 50); + const cylinderMaterial = new THREE.MeshLambertMaterial(); + const cylinder = new THREE.Mesh(cylinderGeometry, cylinderMaterial); + cylinder.position.z = -2; + scene.add(cylinder); + + // + + reflector = new Reflector(new THREE.PlaneGeometry(2, 2), { + textureWidth: window.innerWidth, + textureHeight: window.innerHeight, + }); + reflector.position.x = 1; + reflector.position.y = 1.5; + reflector.position.z = -3; + reflector.rotation.y = -Math.PI / 4; + scene.add(reflector); + + const frameGeometry = new THREE.BoxGeometry(2.1, 2.1, 0.1); + const frameMaterial = new THREE.MeshLambertMaterial({ color: 0x888888 }); + const frame = new THREE.Mesh(frameGeometry, frameMaterial); + frame.position.z = -0.07; + reflector.add(frame); + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.autoClear = false; + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.toneMappingExposure = 1; + document.body.appendChild(renderer.domElement); + + document.body.appendChild(VRButton.createButton(renderer)); + + window.addEventListener('resize', onWindowResize); + + // + + const geometry = new THREE.BufferGeometry(); + geometry.setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, -5)]); + + const controller1 = renderer.xr.getController(0); + controller1.add(new THREE.Line(geometry)); + scene.add(controller1); + + const controller2 = renderer.xr.getController(1); + controller2.add(new THREE.Line(geometry)); + scene.add(controller2); + + // + + const controllerModelFactory = new XRControllerModelFactory(); + + const controllerGrip1 = renderer.xr.getControllerGrip(0); + controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); + scene.add(controllerGrip1); + + const controllerGrip2 = renderer.xr.getControllerGrip(1); + controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); + scene.add(controllerGrip2); + + // GUI + + function onChange() { + torus.geometry.dispose(); + torus.geometry = new THREE.TorusKnotGeometry(...Object.values(parameters)); + } + + function onThicknessChange() { + torus.material.thickness = parameters.thickness; + } + + const gui = new GUI({ width: 300 }); + gui.add(parameters, 'radius', 0.0, 1.0).onChange(onChange); + gui.add(parameters, 'tube', 0.0, 1.0).onChange(onChange); + gui.add(parameters, 'tubularSegments', 10, 150, 1).onChange(onChange); + gui.add(parameters, 'radialSegments', 2, 20, 1).onChange(onChange); + gui.add(parameters, 'p', 1, 10, 1).onChange(onChange); + gui.add(parameters, 'q', 0, 10, 1).onChange(onChange); + gui.add(parameters, 'thickness', 0, 1).onChange(onThicknessChange); + gui.domElement.style.visibility = 'hidden'; + + const group = new InteractiveGroup(); + group.listenToPointerEvents(renderer, camera); + group.listenToXRControllerEvents(controller1); + group.listenToXRControllerEvents(controller2); + scene.add(group); + + const mesh = new HTMLMesh(gui.domElement); + mesh.position.x = -0.75; + mesh.position.y = 1.5; + mesh.position.z = -0.5; + mesh.rotation.y = Math.PI / 4; + mesh.scale.setScalar(2); + group.add(mesh); + + // Add stats.js + stats = new Stats(); + stats.dom.style.width = '80px'; + stats.dom.style.height = '48px'; + document.body.appendChild(stats.dom); + + statsMesh = new HTMLMesh(stats.dom); + statsMesh.position.x = -0.75; + statsMesh.position.y = 2; + statsMesh.position.z = -0.6; + statsMesh.rotation.y = Math.PI / 4; + statsMesh.scale.setScalar(2.5); + group.add(statsMesh); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + const time = performance.now() * 0.0002; + const torus = scene.getObjectByName('torus'); + torus.rotation.x = time * 0.4; + torus.rotation.y = time; + + renderer.render(scene, camera); + stats.update(); + + // Canvas elements doesn't trigger DOM updates, so we have to update the texture + statsMesh.material.map.update(); +} diff --git a/examples-testing/examples/webxr_vr_video.ts b/examples-testing/examples/webxr_vr_video.ts new file mode 100644 index 000000000..50a990412 --- /dev/null +++ b/examples-testing/examples/webxr_vr_video.ts @@ -0,0 +1,92 @@ +import * as THREE from 'three'; +import { VRButton } from 'three/addons/webxr/VRButton.js'; + +let camera, scene, renderer; + +init(); + +function init() { + const container = document.getElementById('container'); + container.addEventListener('click', function () { + video.play(); + }); + + camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 2000); + camera.layers.enable(1); // render left view when no stereo available + + // video + + const video = document.getElementById('video'); + video.play(); + + const texture = new THREE.VideoTexture(video); + texture.colorSpace = THREE.SRGBColorSpace; + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x101010); + + // left + + const geometry1 = new THREE.SphereGeometry(500, 60, 40); + // invert the geometry on the x-axis so that all of the faces point inward + geometry1.scale(-1, 1, 1); + + const uvs1 = geometry1.attributes.uv.array; + + for (let i = 0; i < uvs1.length; i += 2) { + uvs1[i] *= 0.5; + } + + const material1 = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh1 = new THREE.Mesh(geometry1, material1); + mesh1.rotation.y = -Math.PI / 2; + mesh1.layers.set(1); // display in left eye only + scene.add(mesh1); + + // right + + const geometry2 = new THREE.SphereGeometry(500, 60, 40); + geometry2.scale(-1, 1, 1); + + const uvs2 = geometry2.attributes.uv.array; + + for (let i = 0; i < uvs2.length; i += 2) { + uvs2[i] *= 0.5; + uvs2[i] += 0.5; + } + + const material2 = new THREE.MeshBasicMaterial({ map: texture }); + + const mesh2 = new THREE.Mesh(geometry2, material2); + mesh2.rotation.y = -Math.PI / 2; + mesh2.layers.set(2); // display in right eye only + scene.add(mesh2); + + // + + renderer = new THREE.WebGLRenderer(); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.xr.enabled = true; + renderer.xr.setReferenceSpaceType('local'); + container.appendChild(renderer.domElement); + + document.body.appendChild(VRButton.createButton(renderer)); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_xr_controls_transform.ts b/examples-testing/examples/webxr_xr_controls_transform.ts new file mode 100644 index 000000000..cd9b1290d --- /dev/null +++ b/examples-testing/examples/webxr_xr_controls_transform.ts @@ -0,0 +1,218 @@ +import * as THREE from 'three'; +import { TransformControls } from 'three/addons/controls/TransformControls.js'; +import { XRButton } from 'three/addons/webxr/XRButton.js'; +import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; +import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; + +let container; +let camera, scene, renderer; +let bloomPass; +let controller1, controller2, line; +let controllerGrip1, controllerGrip2; + +let raycaster; + +let controls, group; + +init(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x808080); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(0, 1.6, 0); + + const floorGeometry = new THREE.PlaneGeometry(6, 6); + const floorMaterial = new THREE.ShadowMaterial({ + opacity: 0.25, + blending: THREE.CustomBlending, + transparent: false, + }); + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.rotation.x = -Math.PI / 2; + floor.receiveShadow = true; + scene.add(floor); + + scene.add(new THREE.HemisphereLight(0xbcbcbc, 0xa5a5a5, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 6, 0); + light.castShadow = true; + light.shadow.camera.top = 3; + light.shadow.camera.bottom = -3; + light.shadow.camera.right = 3; + light.shadow.camera.left = -3; + light.shadow.mapSize.set(4096, 4096); + scene.add(light); + + group = new THREE.Group(); + scene.add(group); + + const geometries = [ + new THREE.BoxGeometry(0.2, 0.2, 0.2), + new THREE.ConeGeometry(0.2, 0.4, 64), + new THREE.CylinderGeometry(0.2, 0.2, 0.2, 64), + new THREE.IcosahedronGeometry(0.2, 8), + new THREE.TorusGeometry(0.2, 0.04, 64, 32), + ]; + + for (let i = 0; i < 16; i++) { + const geometry = geometries[Math.floor(Math.random() * geometries.length)]; + const material = new THREE.MeshStandardMaterial({ + color: Math.random() * 0xffffff, + roughness: 0.7, + metalness: 0.0, + }); + + const object = new THREE.Mesh(geometry, material); + + object.position.x = Math.random() - 0.5; + object.position.y = Math.random() * 2 + 0.5; + object.position.z = Math.random() - 2.5; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.setScalar(Math.random() + 0.5); + + object.castShadow = true; + object.receiveShadow = true; + + group.add(object); + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true, outputBufferType: THREE.HalfFloatType }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.setAnimationLoop(animate); + renderer.shadowMap.enabled = true; + renderer.toneMapping = THREE.ACESFilmicToneMapping; + renderer.xr.enabled = true; + container.appendChild(renderer.domElement); + + // post-processing + + bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); + renderer.setEffects([bloomPass]); + + document.body.appendChild(XRButton.createButton(renderer)); + + // controllers + + controller1 = renderer.xr.getController(0); + controller1.addEventListener('select', onSelect); + controller1.addEventListener('selectstart', onControllerEvent); + controller1.addEventListener('selectend', onControllerEvent); + controller1.addEventListener('move', onControllerEvent); + controller1.userData.active = false; + scene.add(controller1); + + controller2 = renderer.xr.getController(1); + controller2.addEventListener('select', onSelect); + controller2.addEventListener('selectstart', onControllerEvent); + controller2.addEventListener('selectend', onControllerEvent); + controller2.addEventListener('move', onControllerEvent); + controller2.userData.active = true; + scene.add(controller2); + + const controllerModelFactory = new XRControllerModelFactory(); + + controllerGrip1 = renderer.xr.getControllerGrip(0); + controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); + scene.add(controllerGrip1); + + controllerGrip2 = renderer.xr.getControllerGrip(1); + controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); + scene.add(controllerGrip2); + + // + + const geometry = new THREE.BufferGeometry().setFromPoints([ + new THREE.Vector3(0, 0, 0), + new THREE.Vector3(0, 0, -1), + ]); + + line = new THREE.Line(geometry); + line.name = 'line'; + line.scale.z = 5; + + raycaster = new THREE.Raycaster(); + + // controls + + controls = new TransformControls(camera, renderer.domElement); + controls.attach(group.children[0]); + scene.add(controls.getHelper()); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onSelect(event) { + const controller = event.target; + + controller1.userData.active = false; + controller2.userData.active = false; + + if (controller === controller1) { + controller1.userData.active = true; + controller1.add(line); + } + + if (controller === controller2) { + controller2.userData.active = true; + controller2.add(line); + } + + raycaster.setFromXRController(controller); + + const intersects = raycaster.intersectObjects(group.children); + + if (intersects.length > 0) { + controls.attach(intersects[0].object); + } +} + +function onControllerEvent(event) { + const controller = event.target; + + if (controller.userData.active === false) return; + + controls.getRaycaster().setFromXRController(controller); + + switch (event.type) { + case 'selectstart': + controls.pointerDown(null); + break; + + case 'selectend': + controls.pointerUp(null); + break; + + case 'move': + controls.pointerHover(null); + controls.pointerMove(null); + break; + } +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +// + +function animate() { + renderer.render(scene, camera); +} diff --git a/examples-testing/examples/webxr_xr_dragging_custom_depth.ts b/examples-testing/examples/webxr_xr_dragging_custom_depth.ts new file mode 100644 index 000000000..2cd50ba4c --- /dev/null +++ b/examples-testing/examples/webxr_xr_dragging_custom_depth.ts @@ -0,0 +1,395 @@ +import * as THREE from 'three'; +import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; +import { XRButton } from 'three/addons/webxr/XRButton.js'; +import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; + +let container; +let camera, scene, renderer; +let controller1, controller2; +let controllerGrip1, controllerGrip2; +let isDepthSupplied = false; + +let raycaster; + +const intersected = []; +const tempMatrix = new THREE.Matrix4(); + +let controls, group; + +init(); +animate(); + +function init() { + container = document.createElement('div'); + document.body.appendChild(container); + + scene = new THREE.Scene(); + scene.background = new THREE.Color(0x808080); + + camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); + camera.position.set(0, 1.6, 3); + + controls = new OrbitControls(camera, container); + controls.target.set(0, 1.6, 0); + controls.update(); + + const floorGeometry = new THREE.PlaneGeometry(6, 6); + const floorMaterial = new THREE.ShadowMaterial({ + opacity: 0.25, + blending: THREE.CustomBlending, + transparent: false, + }); + const floor = new THREE.Mesh(floorGeometry, floorMaterial); + floor.rotation.x = -Math.PI / 2; + floor.receiveShadow = true; + scene.add(floor); + + scene.add(new THREE.HemisphereLight(0xbcbcbc, 0xa5a5a5, 3)); + + const light = new THREE.DirectionalLight(0xffffff, 3); + light.position.set(0, 6, 0); + light.castShadow = true; + light.shadow.camera.top = 3; + light.shadow.camera.bottom = -3; + light.shadow.camera.right = 3; + light.shadow.camera.left = -3; + light.shadow.mapSize.set(4096, 4096); + scene.add(light); + + group = new THREE.Group(); + scene.add(group); + + const geometries = [ + new THREE.BoxGeometry(0.2, 0.2, 0.2), + new THREE.ConeGeometry(0.2, 0.2, 64), + new THREE.CylinderGeometry(0.2, 0.2, 0.2, 64), + new THREE.IcosahedronGeometry(0.2, 8), + new THREE.TorusGeometry(0.2, 0.04, 64, 32), + ]; + + for (let i = 0; i < 50; i++) { + const geometry = geometries[Math.floor(Math.random() * geometries.length)]; + const material = new THREE.ShaderMaterial({ + vertexShader: /* glsl */ ` + varying vec3 vNormal; + varying vec2 vUv; + void main() { + vNormal = normalize(normalMatrix * normal); + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); + } + `, + + fragmentShader: /* glsl */ ` + uniform vec3 diffuseColor; + uniform float roughness; + uniform float metalness; + uniform float emissive; + varying vec3 vNormal; + varying vec2 vUv; + uniform sampler2DArray depthColor; + uniform float depthWidth; + uniform float depthHeight; + #define saturate( a ) clamp( a, 0.0, 1.0 ) + float Depth_GetCameraDepthInMeters(const sampler2DArray depthTexture, + const vec2 depthUv, int arrayIndex) { + return texture(depthColor, vec3(depthUv.x, depthUv.y, arrayIndex)).r; + } + float Depth_GetOcclusion(const sampler2DArray depthTexture, const vec2 depthUv, float assetDepthM, int arrayIndex) { + float depthMm = Depth_GetCameraDepthInMeters(depthTexture, depthUv, arrayIndex); + const float kDepthTolerancePerM = 0.001; + return clamp(1.0 - + 0.5 * (depthMm - assetDepthM) / + (kDepthTolerancePerM * assetDepthM) + + 0.5, 0.0, 1.0); + } + float Depth_GetBlurredOcclusionAroundUV(const sampler2DArray depthTexture, const vec2 uv, float assetDepthM, int arrayIndex) { + // Kernel used: + // 0 4 7 4 0 + // 4 16 26 16 4 + // 7 26 41 26 7 + // 4 16 26 16 4 + // 0 4 7 4 0 + const float kKernelTotalWeights = 269.0; + float sum = 0.0; + const float kOcclusionBlurAmount = 0.0005; + vec2 blurriness = + vec2(kOcclusionBlurAmount, kOcclusionBlurAmount /** u_DepthAspectRatio*/); + float current = 0.0; + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-1.0, -2.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+1.0, -2.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-1.0, +2.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+1.0, +2.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-2.0, +1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+2.0, +1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-2.0, -1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+2.0, -1.0) * blurriness, assetDepthM, arrayIndex); + sum += current * 4.0; + current = 0.0; + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-2.0, -0.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+2.0, +0.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+0.0, +2.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-0.0, -2.0) * blurriness, assetDepthM, arrayIndex); + sum += current * 7.0; + current = 0.0; + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-1.0, -1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+1.0, -1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-1.0, +1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+1.0, +1.0) * blurriness, assetDepthM, arrayIndex); + sum += current * 16.0; + current = 0.0; + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+0.0, +1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-0.0, -1.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(-1.0, -0.0) * blurriness, assetDepthM, arrayIndex); + current += Depth_GetOcclusion( + depthTexture, uv + vec2(+1.0, +0.0) * blurriness, assetDepthM, arrayIndex); + sum += current * 26.0; + sum += Depth_GetOcclusion(depthTexture, uv, assetDepthM, arrayIndex) * 41.0; + return sum / kKernelTotalWeights; + } + void main() { + vec3 normal = normalize(vNormal); + vec3 diffuse = diffuseColor; + float specularIntensity = pow(max(dot(normal, normalize(vec3(0, 0, 1))), 0.0), 64.0); + vec3 specular = vec3(specularIntensity) * mix(vec3(0.04), diffuse, metalness); + gl_FragColor = vec4(diffuse * (1.0 - specular) + specular, 1.0) * (1.0 + emissive); + + if (depthWidth > 0.0) { + int arrayIndex = 0; + vec2 depthUv; + if (gl_FragCoord.x>=depthWidth) { + arrayIndex = 1; + depthUv = vec2((gl_FragCoord.x-depthWidth)/depthWidth, gl_FragCoord.y/depthHeight); + } else { + depthUv = vec2(gl_FragCoord.x/depthWidth, gl_FragCoord.y/depthHeight); + } + float assetDepthM = gl_FragCoord.z; + + float occlusion = Depth_GetBlurredOcclusionAroundUV(depthColor, depthUv, assetDepthM, arrayIndex); + float depthMm = Depth_GetCameraDepthInMeters(depthColor, depthUv, arrayIndex); + + float absDistance = abs(assetDepthM - depthMm); + float v = 0.0025; + absDistance = saturate(v - absDistance) / v; + + gl_FragColor.rgb += vec3(absDistance * 2.0, absDistance * 2.0, absDistance * 12.0); + gl_FragColor = mix(gl_FragColor, vec4(0.0, 0.0, 0.0, 0.0), occlusion * 0.7); + } + } + `, + + uniforms: { + diffuseColor: { value: new THREE.Color(Math.random() * 0xffffff) }, + roughness: { value: 0.7 }, + metalness: { value: 0.0 }, + emissive: { value: 0.0 }, + depthWidth: { value: 0.0 }, + depthHeight: { value: 0.0 }, + depthColor: { value: new THREE.Texture() }, + }, + }); + + const object = new THREE.Mesh(geometry, material); + + object.position.x = Math.random() * 4 - 2; + object.position.y = Math.random() * 2; + object.position.z = Math.random() * 4 - 2; + + object.rotation.x = Math.random() * 2 * Math.PI; + object.rotation.y = Math.random() * 2 * Math.PI; + object.rotation.z = Math.random() * 2 * Math.PI; + + object.scale.setScalar(Math.random() + 0.5); + + group.add(object); + } + + // + + renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setPixelRatio(window.devicePixelRatio); + renderer.setSize(window.innerWidth, window.innerHeight); + renderer.shadowMap.enabled = true; + renderer.xr.enabled = true; + container.appendChild(renderer.domElement); + + document.body.appendChild( + XRButton.createButton(renderer, { + optionalFeatures: ['depth-sensing'], + depthSensing: { usagePreference: ['gpu-optimized'], dataFormatPreference: [] }, + }), + ); + + // controllers + + controller1 = renderer.xr.getController(0); + controller1.addEventListener('selectstart', onSelectStart); + controller1.addEventListener('selectend', onSelectEnd); + scene.add(controller1); + + controller2 = renderer.xr.getController(1); + controller2.addEventListener('selectstart', onSelectStart); + controller2.addEventListener('selectend', onSelectEnd); + scene.add(controller2); + + const controllerModelFactory = new XRControllerModelFactory(); + + controllerGrip1 = renderer.xr.getControllerGrip(0); + controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); + scene.add(controllerGrip1); + + controllerGrip2 = renderer.xr.getControllerGrip(1); + controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); + scene.add(controllerGrip2); + + // + + const geometry = new THREE.BufferGeometry().setFromPoints([ + new THREE.Vector3(0, 0, 0), + new THREE.Vector3(0, 0, -1), + ]); + + const line = new THREE.Line(geometry); + line.name = 'line'; + line.scale.z = 5; + + controller1.add(line.clone()); + controller2.add(line.clone()); + + raycaster = new THREE.Raycaster(); + + // + + window.addEventListener('resize', onWindowResize); +} + +function onWindowResize() { + camera.aspect = window.innerWidth / window.innerHeight; + camera.updateProjectionMatrix(); + + renderer.setSize(window.innerWidth, window.innerHeight); +} + +function onSelectStart(event) { + const controller = event.target; + + const intersections = getIntersections(controller); + + if (intersections.length > 0) { + const intersection = intersections[0]; + + const object = intersection.object; + object.material.uniforms.emissive.value = 1; + controller.attach(object); + + controller.userData.selected = object; + } + + controller.userData.targetRayMode = event.data.targetRayMode; +} + +function onSelectEnd(event) { + const controller = event.target; + + if (controller.userData.selected !== undefined) { + const object = controller.userData.selected; + object.material.uniforms.emissive.value = 0; + group.attach(object); + + controller.userData.selected = undefined; + } +} + +function getIntersections(controller) { + controller.updateMatrixWorld(); + + tempMatrix.identity().extractRotation(controller.matrixWorld); + + raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld); + raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix); + + return raycaster.intersectObjects(group.children, false); +} + +function intersectObjects(controller) { + // Do not highlight in mobile-ar + + if (controller.userData.targetRayMode === 'screen') return; + + // Do not highlight when already selected + + if (controller.userData.selected !== undefined) return; + + const line = controller.getObjectByName('line'); + const intersections = getIntersections(controller); + + if (intersections.length > 0) { + const intersection = intersections[0]; + + const object = intersection.object; + object.material.uniforms.emissive.value = 1; + intersected.push(object); + + line.scale.z = intersection.distance; + } else { + line.scale.z = 5; + } +} + +function cleanIntersected() { + while (intersected.length) { + const object = intersected.pop(); + object.material.uniforms.emissive.value = 0; + } +} + +// + +function animate() { + renderer.setAnimationLoop(render); +} + +function render() { + if (renderer.xr.hasDepthSensing() && !isDepthSupplied) { + group.children.forEach(child => { + child.material.uniforms.depthColor.value = renderer.xr.getDepthTexture(); + child.material.uniforms.depthWidth.value = 1680; + child.material.uniforms.depthHeight.value = 1760; + + isDepthSupplied = true; + }); + } else if (!renderer.xr.hasDepthSensing() && isDepthSupplied) { + group.children.forEach(child => { + child.material.uniforms.depthWidth.value = 0; + child.material.uniforms.depthHeight.value = 0; + + isDepthSupplied = false; + }); + } + + cleanIntersected(); + + intersectObjects(controller1); + intersectObjects(controller2); + + renderer.render(scene, camera); +} From 30101d85dbba2ceb37a6e41d3f856b9ffab4b221 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sat, 22 Aug 2026 10:10:32 -0400 Subject: [PATCH 6/6] Update patch and delete examples --- examples-testing/changes.patch | 40 + examples-testing/examples/css2d_label.ts | 189 ---- examples-testing/examples/css3d_mixed.ts | 138 --- examples-testing/examples/css3d_molecules.ts | 353 ------- .../examples/css3d_orthographic.ts | 208 ---- .../examples/css3d_periodictable.ts | 793 --------------- examples-testing/examples/css3d_sandbox.ts | 180 ---- examples-testing/examples/css3d_sprites.ts | 157 --- examples-testing/examples/css3d_youtube.ts | 79 -- examples-testing/examples/games_fps.ts | 377 ------- .../examples/misc_animation_groups.ts | 128 --- .../examples/misc_animation_keys.ts | 132 --- .../examples/misc_boxselection.ts | 137 --- .../examples/misc_controls_arcball.ts | 211 ---- .../examples/misc_controls_drag.ts | 153 --- .../examples/misc_controls_fly.ts | 219 ---- .../examples/misc_controls_map.ts | 102 -- .../examples/misc_controls_orbit.ts | 95 -- .../examples/misc_controls_pointerlock.ts | 245 ----- .../examples/misc_controls_trackball.ts | 147 --- .../examples/misc_controls_transform.ts | 182 ---- .../examples/misc_exporter_draco.ts | 117 --- .../examples/misc_exporter_exr.ts | 158 --- .../examples/misc_exporter_gltf.ts | 534 ---------- .../examples/misc_exporter_gltf_normals.ts | 163 --- .../examples/misc_exporter_ktx2.ts | 145 --- .../examples/misc_exporter_obj.ts | 192 ---- .../examples/misc_exporter_ply.ts | 162 --- .../examples/misc_exporter_stl.ts | 129 --- .../examples/misc_exporter_usdz.ts | 111 -- examples-testing/examples/misc_uv_tests.ts | 44 - .../examples/physics_ammo_instancing.ts | 132 --- .../examples/physics_jolt_instancing.ts | 133 --- .../examples/physics_rapier_basic.ts | 144 --- .../physics_rapier_character_controller.ts | 187 ---- .../examples/physics_rapier_instancing.ts | 158 --- .../examples/physics_rapier_joints.ts | 130 --- .../examples/physics_rapier_terrain.ts | 295 ------ .../physics_rapier_vehicle_controller.ts | 297 ------ examples-testing/examples/svg_lines.ts | 87 -- examples-testing/examples/svg_sandbox.ts | 212 ---- .../examples/webaudio_orientation.ts | 141 --- examples-testing/examples/webaudio_sandbox.ts | 223 ---- examples-testing/examples/webaudio_timing.ts | 155 --- .../examples/webaudio_visualizer.ts | 86 -- .../examples/webgl_animation_keyframes.ts | 96 -- .../examples/webgl_animation_multiple.ts | 193 ---- .../webgl_animation_skinning_morph.ts | 190 ---- .../examples/webgl_animation_walk.ts | 367 ------- .../examples/webgl_buffergeometry.ts | 178 ---- ...webgl_buffergeometry_attributes_integer.ts | 142 --- .../webgl_buffergeometry_attributes_none.ts | 56 - ...fergeometry_custom_attributes_particles.ts | 103 -- .../webgl_buffergeometry_drawrange.ts | 239 ----- .../webgl_buffergeometry_glbufferattribute.ts | 140 --- .../examples/webgl_buffergeometry_indexed.ts | 137 --- .../webgl_buffergeometry_instancing.ts | 138 --- ...gl_buffergeometry_instancing_billboards.ts | 86 -- ...l_buffergeometry_instancing_interleaved.ts | 152 --- .../examples/webgl_buffergeometry_lines.ts | 121 --- .../webgl_buffergeometry_lines_indexed.ts | 179 ---- .../examples/webgl_buffergeometry_points.ts | 109 -- ...webgl_buffergeometry_points_interleaved.ts | 122 --- .../webgl_buffergeometry_rawshader.ts | 97 -- .../webgl_buffergeometry_selective_draw.ts | 150 --- .../examples/webgl_buffergeometry_uint.ts | 177 ---- examples-testing/examples/webgl_camera.ts | 218 ---- .../examples/webgl_camera_array.ts | 104 -- .../webgl_camera_logarithmicdepthbuffer.ts | 248 ----- .../examples/webgl_clipculldistance.ts | 113 --- examples-testing/examples/webgl_clipping.ts | 195 ---- .../examples/webgl_clipping_advanced.ts | 357 ------- .../examples/webgl_clipping_intersection.ts | 137 --- .../examples/webgl_clipping_stencil.ts | 263 ----- .../examples/webgl_custom_attributes.ts | 100 -- .../examples/webgl_custom_attributes_lines.ts | 121 --- .../webgl_custom_attributes_points.ts | 117 --- .../webgl_custom_attributes_points2.ts | 193 ---- .../webgl_custom_attributes_points3.ts | 200 ---- examples-testing/examples/webgl_decals.ts | 240 ----- .../examples/webgl_effects_anaglyph.ts | 120 --- .../examples/webgl_effects_ascii.ts | 81 -- .../examples/webgl_effects_parallaxbarrier.ts | 110 -- .../examples/webgl_effects_stereo.ts | 98 -- .../examples/webgl_framebuffer_texture.ts | 151 --- .../examples/webgl_furnace_test.ts | 108 -- examples-testing/examples/webgl_geometries.ts | 165 --- .../examples/webgl_geometry_colors.ts | 177 ---- .../webgl_geometry_colors_lookuptable.ts | 148 --- .../examples/webgl_geometry_convex.ts | 117 --- .../examples/webgl_geometry_cube.ts | 46 - .../examples/webgl_geometry_extrude_shapes.ts | 149 --- .../webgl_geometry_extrude_splines.ts | 310 ------ .../examples/webgl_geometry_minecraft.ts | 184 ---- .../examples/webgl_geometry_nurbs.ts | 298 ------ .../examples/webgl_geometry_shapes.ts | 363 ------- .../examples/webgl_geometry_teapot.ts | 185 ---- .../examples/webgl_geometry_terrain.ts | 174 ---- .../webgl_geometry_terrain_raycast.ts | 206 ---- .../examples/webgl_geometry_text.ts | 312 ------ .../examples/webgl_geometry_text_shapes.ts | 112 -- .../examples/webgl_geometry_text_stroke.ts | 146 --- .../examples/webgl_gpgpu_birds.ts | 313 ------ .../examples/webgl_gpgpu_birds_gltf.ts | 413 -------- .../examples/webgl_gpgpu_protoplanet.ts | 280 ----- .../examples/webgl_gpgpu_water.ts | 574 ----------- examples-testing/examples/webgl_helpers.ts | 117 --- .../examples/webgl_instancing_dynamic.ts | 175 ---- .../examples/webgl_instancing_morph.ts | 143 --- .../examples/webgl_instancing_performance.ts | 262 ----- .../examples/webgl_instancing_raycast.ts | 116 --- .../examples/webgl_instancing_scatter.ts | 257 ----- .../webgl_interactive_buffergeometry.ts | 244 ----- .../examples/webgl_interactive_cubes.ts | 114 --- .../examples/webgl_interactive_cubes_gpu.ts | 231 ----- .../examples/webgl_interactive_cubes_ortho.ts | 129 --- .../examples/webgl_interactive_lines.ts | 151 --- .../examples/webgl_interactive_points.ts | 143 --- .../webgl_interactive_raycasting_points.ts | 223 ---- .../webgl_interactive_voxelpainter.ts | 158 --- examples-testing/examples/webgl_lensflares.ts | 140 --- examples-testing/examples/webgl_lightprobe.ts | 142 --- .../examples/webgl_lightprobe_cubecamera.ts | 85 -- .../examples/webgl_lightprobes.ts | 190 ---- .../examples/webgl_lightprobes_complex.ts | 304 ------ .../examples/webgl_lightprobes_sponza.ts | 312 ------ .../examples/webgl_lights_hemisphere.ts | 191 ---- .../examples/webgl_lights_physical.ts | 237 ----- .../examples/webgl_lights_rectarealight.ts | 110 -- .../examples/webgl_lights_spotlight.ts | 202 ---- .../examples/webgl_lights_spotlights.ts | 133 --- .../examples/webgl_lights_sunlight.ts | 226 ----- .../examples/webgl_lines_colors.ts | 181 ---- .../examples/webgl_lines_dashed.ts | 186 ---- examples-testing/examples/webgl_lines_fat.ts | 245 ----- .../examples/webgl_lines_fat_raycasting.ts | 280 ----- .../examples/webgl_lines_fat_wireframe.ts | 210 ---- examples-testing/examples/webgl_loader_3dm.ts | 94 -- examples-testing/examples/webgl_loader_3ds.ts | 62 -- examples-testing/examples/webgl_loader_3mf.ts | 113 --- .../examples/webgl_loader_3mf_materials.ts | 98 -- examples-testing/examples/webgl_loader_amf.ts | 62 -- examples-testing/examples/webgl_loader_bvh.ts | 64 -- .../examples/webgl_loader_collada.ts | 86 -- .../examples/webgl_loader_collada_skinning.ts | 100 -- .../examples/webgl_loader_draco.ts | 81 -- examples-testing/examples/webgl_loader_fbx.ts | 216 ---- .../examples/webgl_loader_fbx_nurbs.ts | 61 -- .../examples/webgl_loader_gcode.ts | 81 -- .../examples/webgl_loader_gltf.ts | 167 --- .../webgl_loader_gltf_animation_pointer.ts | 91 -- .../examples/webgl_loader_gltf_anisotropy.ts | 68 -- .../examples/webgl_loader_gltf_avif.ts | 61 -- .../examples/webgl_loader_gltf_compressed.ts | 83 -- .../examples/webgl_loader_gltf_dispersion.ts | 66 -- .../examples/webgl_loader_gltf_instancing.ts | 69 -- .../examples/webgl_loader_gltf_iridescence.ts | 66 -- .../webgl_loader_gltf_progressive_lod.ts | 143 --- .../examples/webgl_loader_gltf_sheen.ts | 72 -- .../webgl_loader_gltf_transmission.ts | 83 -- .../examples/webgl_loader_imagebitmap.ts | 113 --- examples-testing/examples/webgl_loader_kmz.ts | 59 -- .../examples/webgl_loader_md2_control.ts | 278 ----- examples-testing/examples/webgl_loader_mdd.ts | 65 -- examples-testing/examples/webgl_loader_obj.ts | 72 -- examples-testing/examples/webgl_loader_pcd.ts | 78 -- examples-testing/examples/webgl_loader_pdb.ts | 208 ---- examples-testing/examples/webgl_loader_ply.ts | 146 --- examples-testing/examples/webgl_loader_svg.ts | 202 ---- .../examples/webgl_loader_texture_dds.ts | 218 ---- .../examples/webgl_loader_texture_ktx.ts | 165 --- .../examples/webgl_loader_texture_tga.ts | 90 -- .../examples/webgl_loader_texture_tiff.ts | 87 -- .../examples/webgl_loader_texture_ultrahdr.ts | 101 -- examples-testing/examples/webgl_loader_ttf.ts | 231 ----- .../examples/webgl_loader_usdz.ts | 68 -- examples-testing/examples/webgl_loader_vox.ts | 99 -- .../examples/webgl_loader_vrml.ts | 120 --- examples-testing/examples/webgl_loader_xyz.ts | 65 -- examples-testing/examples/webgl_lod.ts | 91 -- .../examples/webgl_marchingcubes.ts | 312 ------ .../examples/webgl_materials_alphahash.ts | 178 ---- .../examples/webgl_materials_blending.ts | 149 --- .../webgl_materials_blending_custom.ts | 214 ---- .../examples/webgl_materials_bumpmap.ts | 134 --- .../examples/webgl_materials_car.ts | 168 --- .../examples/webgl_materials_cubemap.ts | 115 --- .../webgl_materials_cubemap_dynamic.ts | 115 --- .../webgl_materials_cubemap_mipmaps.ts | 119 --- .../webgl_materials_cubemap_refraction.ts | 126 --- ...bgl_materials_cubemap_render_to_mipmaps.ts | 183 ---- .../webgl_materials_displacementmap.ts | 224 ---- .../examples/webgl_materials_envmaps.ts | 131 --- .../examples/webgl_materials_envmaps_exr.ts | 153 --- .../webgl_materials_envmaps_fasthdr.ts | 169 ---- ...webgl_materials_envmaps_groundprojected.ts | 151 --- .../examples/webgl_materials_envmaps_hdr.ts | 163 --- .../examples/webgl_materials_modified.ts | 115 --- .../webgl_materials_normalmap_object_space.ts | 82 -- .../webgl_materials_physical_clearcoat.ts | 208 ---- .../webgl_materials_physical_transmission.ts | 192 ---- ...l_materials_physical_transmission_alpha.ts | 194 ---- .../webgl_materials_texture_anisotropy.ts | 143 --- .../webgl_materials_texture_canvas.ts | 92 -- .../webgl_materials_texture_filters.ts | 165 --- .../examples/webgl_materials_texture_html.ts | 94 -- .../webgl_materials_texture_manualmipmap.ts | 175 ---- .../webgl_materials_texture_partialupdate.ts | 104 -- .../webgl_materials_texture_rotation.ts | 112 -- .../examples/webgl_materials_toon.ts | 152 --- .../examples/webgl_materials_video.ts | 202 ---- .../examples/webgl_materials_video_webcam.ts | 79 -- .../examples/webgl_materials_wireframe.ts | 107 -- examples-testing/examples/webgl_math_obb.ts | 192 ---- .../webgl_math_orientation_transform.ts | 120 --- examples-testing/examples/webgl_mesh_batch.ts | 347 ------- examples-testing/examples/webgl_mirror.ts | 193 ---- .../examples/webgl_modifier_edgesplit.ts | 128 --- .../examples/webgl_modifier_simplifier.ts | 84 -- .../examples/webgl_modifier_tessellation.ts | 142 --- .../examples/webgl_morphtargets.ts | 116 --- .../examples/webgl_morphtargets_face.ts | 108 -- .../examples/webgl_morphtargets_horse.ts | 100 -- .../examples/webgl_morphtargets_sphere.ts | 105 -- .../examples/webgl_multiple_elements.ts | 139 --- .../examples/webgl_multiple_rendertargets.ts | 133 --- .../webgl_multiple_scenes_comparison.ts | 98 -- .../examples/webgl_multiple_views.ts | 235 ----- .../webgl_multisampled_renderbuffers.ts | 133 --- .../examples/webgl_panorama_cube.ts | 83 -- .../webgl_panorama_equirectangular.ts | 112 -- .../examples/webgl_performance.ts | 77 -- .../examples/webgl_pmrem_cubemap.ts | 76 -- .../examples/webgl_pmrem_equirectangular.ts | 76 -- examples-testing/examples/webgl_pmrem_test.ts | 141 --- .../examples/webgl_points_billboards.ts | 120 --- .../examples/webgl_points_sprites.ts | 167 --- .../examples/webgl_points_waves.ts | 145 --- examples-testing/examples/webgl_portal.ts | 218 ---- .../examples/webgl_postprocessing.ts | 86 -- .../examples/webgl_postprocessing_advanced.ts | 304 ------ .../webgl_postprocessing_afterimage.ts | 72 -- .../webgl_postprocessing_backgrounds.ts | 214 ---- .../examples/webgl_postprocessing_fxaa.ts | 122 --- .../examples/webgl_postprocessing_glitch.ts | 108 -- .../examples/webgl_postprocessing_godrays.ts | 176 ---- .../examples/webgl_postprocessing_gtao.ts | 216 ---- .../examples/webgl_postprocessing_masking.ts | 101 -- .../examples/webgl_postprocessing_outline.ts | 273 ----- .../examples/webgl_postprocessing_pixel.ts | 363 ------- .../webgl_postprocessing_procedural.ts | 77 -- .../webgl_postprocessing_rgb_halftone.ts | 170 ---- .../examples/webgl_postprocessing_sao.ts | 146 --- .../examples/webgl_postprocessing_smaa.ts | 106 -- .../examples/webgl_postprocessing_sobel.ts | 111 -- .../examples/webgl_postprocessing_ssaa.ts | 214 ---- .../examples/webgl_postprocessing_ssao.ts | 125 --- .../examples/webgl_postprocessing_ssr.ts | 260 ----- .../examples/webgl_postprocessing_taa.ts | 139 --- .../webgl_postprocessing_transition.ts | 214 ---- .../webgl_postprocessing_unreal_bloom.ts | 139 --- ...l_postprocessing_unreal_bloom_selective.ts | 208 ---- examples-testing/examples/webgl_random_uv.ts | 338 ------- .../examples/webgl_raycaster_sprite.ts | 103 -- .../examples/webgl_raycaster_texture.ts | 286 ------ .../examples/webgl_read_float_buffer.ts | 153 --- examples-testing/examples/webgl_refraction.ts | 138 --- examples-testing/examples/webgl_rtt.ts | 171 ---- examples-testing/examples/webgl_shader.ts | 50 - .../examples/webgl_shader_lava.ts | 104 -- .../examples/webgl_shaders_ocean.ts | 200 ---- .../examples/webgl_shaders_sky.ts | 127 --- .../examples/webgl_shadow_contact.ts | 272 ----- examples-testing/examples/webgl_shadowmap.ts | 310 ------ .../examples/webgl_shadowmap_csm.ts | 253 ----- .../examples/webgl_shadowmap_pcss.ts | 165 --- .../examples/webgl_shadowmap_performance.ts | 270 ----- .../examples/webgl_shadowmap_pointlight.ts | 141 --- .../examples/webgl_shadowmap_progressive.ts | 204 ---- .../examples/webgl_shadowmap_viewer.ts | 181 ---- .../examples/webgl_shadowmap_vsm.ts | 203 ---- examples-testing/examples/webgl_shadowmesh.ts | 253 ----- examples-testing/examples/webgl_simple_gi.ts | 172 ---- examples-testing/examples/webgl_sprites.ts | 187 ---- .../examples/webgl_test_memory.ts | 65 -- .../examples/webgl_test_memory2.ts | 81 -- .../examples/webgl_test_wide_gamut.ts | 130 --- .../webgl_texture2darray_compressed.ts | 90 -- .../webgl_texture2darray_layerupdate.ts | 130 --- examples-testing/examples/webgl_texture3d.ts | 128 --- .../examples/webgl_texture3d_partialupdate.ts | 326 ------ .../examples/webgl_tonemapping.ts | 170 ---- .../examples/webgl_tsl_clearcoat.ts | 210 ---- .../examples/webgl_tsl_instancing.ts | 286 ------ .../examples/webgl_tsl_shadowmap.ts | 160 --- .../examples/webgl_tsl_skinning.ts | 74 -- examples-testing/examples/webgl_ubo.ts | 140 --- examples-testing/examples/webgl_ubo_arrays.ts | 174 ---- .../examples/webgl_video_kinect.ts | 109 -- .../webgl_video_panorama_equirectangular.ts | 95 -- .../examples/webgl_volume_cloud.ts | 279 ----- .../examples/webgl_volume_instancing.ts | 222 ---- .../examples/webgl_volume_perlin.ts | 235 ----- examples-testing/examples/webgl_watch.ts | 243 ----- .../examples/webgpu_animation_retargeting.ts | 295 ------ ...ebgpu_animation_retargeting_readyplayer.ts | 165 --- examples-testing/examples/webgpu_backdrop.ts | 134 --- .../examples/webgpu_backdrop_area.ts | 157 --- .../examples/webgpu_backdrop_water.ts | 261 ----- examples-testing/examples/webgpu_camera.ts | 211 ---- .../examples/webgpu_camera_array.ts | 101 -- .../webgpu_camera_logarithmicdepthbuffer.ts | 240 ----- examples-testing/examples/webgpu_caustics.ts | 200 ---- .../examples/webgpu_centroid_sampling.ts | 199 ---- examples-testing/examples/webgpu_clearcoat.ts | 194 ---- examples-testing/examples/webgpu_clipping.ts | 201 ---- .../examples/webgpu_clipping_stencil.ts | 240 ----- .../examples/webgpu_compile_async.ts | 265 ----- .../examples/webgpu_compute_audio.ts | 178 ---- .../examples/webgpu_compute_birds.ts | 424 -------- .../examples/webgpu_compute_cloth.ts | 487 --------- .../examples/webgpu_compute_geometry.ts | 190 ---- .../examples/webgpu_compute_particles.ts | 226 ----- .../examples/webgpu_compute_particles_rain.ts | 334 ------ .../examples/webgpu_compute_particles_snow.ts | 331 ------ .../examples/webgpu_compute_points.ts | 124 --- .../examples/webgpu_compute_sort_bitonic.ts | 457 --------- .../examples/webgpu_compute_texture.ts | 96 -- .../examples/webgpu_compute_texture_3d.ts | 193 ---- .../webgpu_compute_texture_pingpong.ts | 170 ---- .../examples/webgpu_cubemap_adjustments.ts | 165 --- .../examples/webgpu_cubemap_dynamic.ts | 130 --- .../examples/webgpu_cubemap_mix.ts | 78 -- .../examples/webgpu_custom_fog.ts | 225 ----- .../examples/webgpu_custom_fog_background.ts | 86 -- .../examples/webgpu_custom_fog_scattering.ts | 193 ---- examples-testing/examples/webgpu_deferred.ts | 254 ----- .../examples/webgpu_depth_texture.ts | 83 -- .../examples/webgpu_display_stereo.ts | 191 ---- .../examples/webgpu_equirectangular.ts | 57 -- .../examples/webgpu_fog_height.ts | 99 -- .../examples/webgpu_furnace_test.ts | 111 -- .../examples/webgpu_gaussian_splat.ts | 193 ---- .../examples/webgpu_generator_building.ts | 225 ----- .../examples/webgpu_generator_city.ts | 169 ---- .../examples/webgpu_geometry_loft.ts | 955 ------------------ examples-testing/examples/webgpu_hdr.ts | 124 --- .../examples/webgpu_instance_mesh.ts | 98 -- .../examples/webgpu_instance_path.ts | 147 --- .../examples/webgpu_instance_points.ts | 204 ---- .../examples/webgpu_instancing_morph.ts | 145 --- examples-testing/examples/webgpu_layers.ts | 144 --- .../examples/webgpu_lensflares.ts | 137 --- .../examples/webgpu_lightprobe.ts | 136 --- .../examples/webgpu_lightprobe_cubecamera.ts | 90 -- .../examples/webgpu_lightprobes.ts | 195 ---- .../examples/webgpu_lightprobes_complex.ts | 313 ------ .../examples/webgpu_lightprobes_sponza.ts | 339 ------- .../examples/webgpu_lights_clustered.ts | 228 ----- .../examples/webgpu_lights_dynamic.ts | 242 ----- .../examples/webgpu_lights_ies_spotlight.ts | 168 --- .../examples/webgpu_lights_phong.ts | 136 --- .../examples/webgpu_lights_physical.ts | 236 ----- .../examples/webgpu_lights_pointlights.ts | 190 ---- .../examples/webgpu_lights_rectarealight.ts | 87 -- .../examples/webgpu_lights_selective.ts | 150 --- .../examples/webgpu_lights_spotlight.ts | 200 ---- examples-testing/examples/webgpu_lines_fat.ts | 266 ----- .../examples/webgpu_lines_fat_raycasting.ts | 286 ------ .../examples/webgpu_lines_fat_wireframe.ts | 208 ---- .../examples/webgpu_loader_gltf.ts | 183 ---- .../examples/webgpu_loader_gltf_anisotropy.ts | 64 -- .../examples/webgpu_loader_gltf_compressed.ts | 69 -- .../examples/webgpu_loader_gltf_dispersion.ts | 63 -- .../webgpu_loader_gltf_iridescence.ts | 70 -- .../examples/webgpu_loader_gltf_sheen.ts | 81 -- .../webgpu_loader_gltf_transmission.ts | 83 -- .../examples/webgpu_loader_materialx.ts | 300 ------ .../examples/webgpu_loader_texture_ktx2.ts | 186 ---- .../examples/webgpu_materials_alphahash.ts | 130 --- .../examples/webgpu_materials_arrays.ts | 185 ---- .../examples/webgpu_materials_basic.ts | 129 --- .../webgpu_materials_cubemap_mipmaps.ts | 119 --- .../webgpu_materials_displacementmap.ts | 195 ---- .../examples/webgpu_materials_envmaps.ts | 132 --- .../webgpu_materials_envmaps_bpcem.ts | 202 ---- ...ebgpu_materials_envmaps_groundprojected.ts | 160 --- .../examples/webgpu_materials_lightmap.ts | 105 -- .../examples/webgpu_materials_matcap.ts | 175 ---- .../webgpu_materials_retroreflection.ts | 132 --- .../examples/webgpu_materials_sss.ts | 153 --- .../examples/webgpu_materials_texture_html.ts | 95 -- .../webgpu_materials_texture_manualmipmap.ts | 170 ---- .../examples/webgpu_materials_toon.ts | 149 --- .../examples/webgpu_materials_transmission.ts | 173 ---- .../examples/webgpu_materials_video.ts | 179 ---- .../examples/webgpu_materialx_noise.ts | 355 ------- .../examples/webgpu_mesh_batch.ts | 265 ----- examples-testing/examples/webgpu_mirror.ts | 195 ---- .../examples/webgpu_modifier_curve.ts | 154 --- .../examples/webgpu_morphtargets.ts | 119 --- .../examples/webgpu_morphtargets_face.ts | 98 -- examples-testing/examples/webgpu_mrt.ts | 123 --- examples-testing/examples/webgpu_mrt_mask.ts | 132 --- .../examples/webgpu_multiple_canvas.ts | 111 -- .../examples/webgpu_multiple_elements.ts | 142 --- .../examples/webgpu_multiple_rendertargets.ts | 97 -- .../webgpu_multiple_rendertargets_readback.ts | 161 --- .../webgpu_multisampled_renderbuffers.ts | 129 --- examples-testing/examples/webgpu_occlusion.ts | 97 -- examples-testing/examples/webgpu_ocean.ts | 181 ---- examples-testing/examples/webgpu_oit.ts | 148 --- .../examples/webgpu_parallax_uv.ts | 135 --- examples-testing/examples/webgpu_particles.ts | 151 --- .../examples/webgpu_particles_soft.ts | 153 --- .../examples/webgpu_performance.ts | 101 -- .../webgpu_performance_renderbundle.ts | 229 ----- .../examples/webgpu_pmrem_cubemap.ts | 75 -- .../examples/webgpu_pmrem_equirectangular.ts | 75 -- .../examples/webgpu_pmrem_scene.ts | 106 -- .../examples/webgpu_pmrem_test.ts | 138 --- examples-testing/examples/webgpu_portal.ts | 156 --- .../examples/webgpu_postprocessing.ts | 82 -- .../examples/webgpu_postprocessing_3dlut.ts | 229 ----- .../webgpu_postprocessing_afterimage.ts | 152 --- .../webgpu_postprocessing_anamorphic.ts | 166 --- .../examples/webgpu_postprocessing_ao.ts | 582 ----------- .../examples/webgpu_postprocessing_bloom.ts | 132 --- .../webgpu_postprocessing_bloom_emissive.ts | 115 --- .../webgpu_postprocessing_bloom_selective.ts | 124 --- .../examples/webgpu_postprocessing_ca.ts | 266 ----- .../webgpu_postprocessing_difference.ts | 93 -- .../examples/webgpu_postprocessing_direct.ts | 78 -- .../examples/webgpu_postprocessing_dof.ts | 132 --- .../webgpu_postprocessing_dof_basic.ts | 154 --- .../examples/webgpu_postprocessing_fxaa.ts | 129 --- .../examples/webgpu_postprocessing_godrays.ts | 209 ---- .../webgpu_postprocessing_lensflare.ts | 135 --- .../examples/webgpu_postprocessing_masking.ts | 88 -- .../webgpu_postprocessing_motion_blur.ts | 199 ---- .../examples/webgpu_postprocessing_outline.ts | 232 ----- .../examples/webgpu_postprocessing_pixel.ts | 237 ----- .../webgpu_postprocessing_radial_blur.ts | 149 --- .../examples/webgpu_postprocessing_retro.ts | 370 ------- .../examples/webgpu_postprocessing_smaa.ts | 98 -- .../examples/webgpu_postprocessing_sobel.ts | 95 -- .../examples/webgpu_postprocessing_ssaa.ts | 169 ---- .../examples/webgpu_postprocessing_ssgi.ts | 244 ----- .../webgpu_postprocessing_ssgi_ballpool.ts | 416 -------- .../examples/webgpu_postprocessing_ssr.ts | 212 ---- .../webgpu_postprocessing_ssr_denoise.ts | 504 --------- .../examples/webgpu_postprocessing_sss.ts | 185 ---- .../examples/webgpu_postprocessing_traa.ts | 93 -- .../webgpu_postprocessing_transition.ts | 207 ---- .../examples/webgpu_procedural_texture.ts | 75 -- .../examples/webgpu_reflection.ts | 344 ------- .../examples/webgpu_reflection_roughness.ts | 121 --- .../examples/webgpu_refraction.ts | 144 --- .../webgpu_rendertarget_2d-array_3d.ts | 237 ----- .../examples/webgpu_reversed_depth_buffer.ts | 169 ---- examples-testing/examples/webgpu_rtt.ts | 90 -- .../examples/webgpu_shadow_contact.ts | 205 ---- examples-testing/examples/webgpu_shadowmap.ts | 166 --- .../examples/webgpu_shadowmap_array.ts | 329 ------ .../examples/webgpu_shadowmap_csm.ts | 267 ----- .../examples/webgpu_shadowmap_opacity.ts | 117 --- .../examples/webgpu_shadowmap_pointlight.ts | 139 --- .../examples/webgpu_shadowmap_progressive.ts | 203 ---- .../examples/webgpu_shadowmap_vsm.ts | 197 ---- examples-testing/examples/webgpu_skinning.ts | 72 -- .../examples/webgpu_skinning_instancing.ts | 128 --- .../webgpu_skinning_instancing_individual.ts | 431 -------- examples-testing/examples/webgpu_sprites.ts | 103 -- .../examples/webgpu_storage_buffer.ts | 169 ---- .../examples/webgpu_struct_drawindirect.ts | 212 ---- .../examples/webgpu_test_memory.ts | 223 ---- .../examples/webgpu_texturegather.ts | 120 --- .../examples/webgpu_texturegrad.ts | 116 --- .../examples/webgpu_textures_2d-array.ts | 69 -- .../webgpu_textures_2d-array_compressed.ts | 85 -- .../examples/webgpu_textures_anisotropy.ts | 145 --- .../examples/webgpu_textures_partialupdate.ts | 105 -- .../examples/webgpu_tonemapping.ts | 141 --- .../examples/webgpu_tsl_angular_slicing.ts | 174 ---- examples-testing/examples/webgpu_tsl_earth.ts | 175 ---- .../examples/webgpu_tsl_galaxy.ts | 99 -- examples-testing/examples/webgpu_tsl_graph.ts | 228 ----- .../examples/webgpu_tsl_halftone.ts | 214 ---- .../examples/webgpu_tsl_interoperability.ts | 263 ----- .../examples/webgpu_tsl_procedural_terrain.ts | 318 ------ .../examples/webgpu_tsl_raging_sea.ts | 178 ---- .../examples/webgpu_tsl_vfx_flames.ts | 203 ---- .../webgpu_tsl_vfx_linkedparticles.ts | 445 -------- .../examples/webgpu_tsl_vfx_tornado.ts | 289 ------ examples-testing/examples/webgpu_tsl_wood.ts | 249 ----- .../examples/webgpu_upscaling_fsr1.ts | 122 --- .../examples/webgpu_upscaling_taau.ts | 142 --- .../examples/webgpu_video_panorama.ts | 99 -- .../examples/webgpu_volume_caustics.ts | 302 ------ .../examples/webgpu_volume_cloud.ts | 165 --- .../examples/webgpu_volume_lighting.ts | 248 ----- .../webgpu_volume_lighting_rectarea.ts | 256 ----- .../examples/webgpu_volume_lighting_traa.ts | 298 ------ .../examples/webgpu_volume_perlin.ts | 148 --- examples-testing/examples/webgpu_water.ts | 199 ---- examples-testing/examples/webgpu_xr_cubes.ts | 242 ----- .../examples/webgpu_xr_native_layers.ts | 637 ------------ .../examples/webgpu_xr_rollercoaster.ts | 259 ----- .../examples/webgpu_xr_shadows.ts | 195 ---- examples-testing/examples/webxr_ar_cones.ts | 66 -- examples-testing/examples/webxr_ar_hittest.ts | 119 --- .../examples/webxr_ar_lighting.ts | 124 --- .../examples/webxr_ar_plane_detection.ts | 46 - .../examples/webxr_vr_handinput.ts | 126 --- .../examples/webxr_vr_panorama.ts | 92 -- .../examples/webxr_vr_panorama_depth.ts | 93 -- .../examples/webxr_vr_rollercoaster.ts | 232 ----- examples-testing/examples/webxr_vr_sandbox.ts | 192 ---- examples-testing/examples/webxr_vr_video.ts | 92 -- .../examples/webxr_xr_controls_transform.ts | 218 ---- .../webxr_xr_dragging_custom_depth.ts | 395 -------- 521 files changed, 40 insertions(+), 90542 deletions(-) delete mode 100644 examples-testing/examples/css2d_label.ts delete mode 100644 examples-testing/examples/css3d_mixed.ts delete mode 100644 examples-testing/examples/css3d_molecules.ts delete mode 100644 examples-testing/examples/css3d_orthographic.ts delete mode 100644 examples-testing/examples/css3d_periodictable.ts delete mode 100644 examples-testing/examples/css3d_sandbox.ts delete mode 100644 examples-testing/examples/css3d_sprites.ts delete mode 100644 examples-testing/examples/css3d_youtube.ts delete mode 100644 examples-testing/examples/games_fps.ts delete mode 100644 examples-testing/examples/misc_animation_groups.ts delete mode 100644 examples-testing/examples/misc_animation_keys.ts delete mode 100644 examples-testing/examples/misc_boxselection.ts delete mode 100644 examples-testing/examples/misc_controls_arcball.ts delete mode 100644 examples-testing/examples/misc_controls_drag.ts delete mode 100644 examples-testing/examples/misc_controls_fly.ts delete mode 100644 examples-testing/examples/misc_controls_map.ts delete mode 100644 examples-testing/examples/misc_controls_orbit.ts delete mode 100644 examples-testing/examples/misc_controls_pointerlock.ts delete mode 100644 examples-testing/examples/misc_controls_trackball.ts delete mode 100644 examples-testing/examples/misc_controls_transform.ts delete mode 100644 examples-testing/examples/misc_exporter_draco.ts delete mode 100644 examples-testing/examples/misc_exporter_exr.ts delete mode 100644 examples-testing/examples/misc_exporter_gltf.ts delete mode 100644 examples-testing/examples/misc_exporter_gltf_normals.ts delete mode 100644 examples-testing/examples/misc_exporter_ktx2.ts delete mode 100644 examples-testing/examples/misc_exporter_obj.ts delete mode 100644 examples-testing/examples/misc_exporter_ply.ts delete mode 100644 examples-testing/examples/misc_exporter_stl.ts delete mode 100644 examples-testing/examples/misc_exporter_usdz.ts delete mode 100644 examples-testing/examples/misc_uv_tests.ts delete mode 100644 examples-testing/examples/physics_ammo_instancing.ts delete mode 100644 examples-testing/examples/physics_jolt_instancing.ts delete mode 100644 examples-testing/examples/physics_rapier_basic.ts delete mode 100644 examples-testing/examples/physics_rapier_character_controller.ts delete mode 100644 examples-testing/examples/physics_rapier_instancing.ts delete mode 100644 examples-testing/examples/physics_rapier_joints.ts delete mode 100644 examples-testing/examples/physics_rapier_terrain.ts delete mode 100644 examples-testing/examples/physics_rapier_vehicle_controller.ts delete mode 100644 examples-testing/examples/svg_lines.ts delete mode 100644 examples-testing/examples/svg_sandbox.ts delete mode 100644 examples-testing/examples/webaudio_orientation.ts delete mode 100644 examples-testing/examples/webaudio_sandbox.ts delete mode 100644 examples-testing/examples/webaudio_timing.ts delete mode 100644 examples-testing/examples/webaudio_visualizer.ts delete mode 100644 examples-testing/examples/webgl_animation_keyframes.ts delete mode 100644 examples-testing/examples/webgl_animation_multiple.ts delete mode 100644 examples-testing/examples/webgl_animation_skinning_morph.ts delete mode 100644 examples-testing/examples/webgl_animation_walk.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_attributes_integer.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_attributes_none.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_drawrange.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_indexed.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_instancing.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_lines.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_lines_indexed.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_points.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_points_interleaved.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_rawshader.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_selective_draw.ts delete mode 100644 examples-testing/examples/webgl_buffergeometry_uint.ts delete mode 100644 examples-testing/examples/webgl_camera.ts delete mode 100644 examples-testing/examples/webgl_camera_array.ts delete mode 100644 examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts delete mode 100644 examples-testing/examples/webgl_clipculldistance.ts delete mode 100644 examples-testing/examples/webgl_clipping.ts delete mode 100644 examples-testing/examples/webgl_clipping_advanced.ts delete mode 100644 examples-testing/examples/webgl_clipping_intersection.ts delete mode 100644 examples-testing/examples/webgl_clipping_stencil.ts delete mode 100644 examples-testing/examples/webgl_custom_attributes.ts delete mode 100644 examples-testing/examples/webgl_custom_attributes_lines.ts delete mode 100644 examples-testing/examples/webgl_custom_attributes_points.ts delete mode 100644 examples-testing/examples/webgl_custom_attributes_points2.ts delete mode 100644 examples-testing/examples/webgl_custom_attributes_points3.ts delete mode 100644 examples-testing/examples/webgl_decals.ts delete mode 100644 examples-testing/examples/webgl_effects_anaglyph.ts delete mode 100644 examples-testing/examples/webgl_effects_ascii.ts delete mode 100644 examples-testing/examples/webgl_effects_parallaxbarrier.ts delete mode 100644 examples-testing/examples/webgl_effects_stereo.ts delete mode 100644 examples-testing/examples/webgl_framebuffer_texture.ts delete mode 100644 examples-testing/examples/webgl_furnace_test.ts delete mode 100644 examples-testing/examples/webgl_geometries.ts delete mode 100644 examples-testing/examples/webgl_geometry_colors.ts delete mode 100644 examples-testing/examples/webgl_geometry_colors_lookuptable.ts delete mode 100644 examples-testing/examples/webgl_geometry_convex.ts delete mode 100644 examples-testing/examples/webgl_geometry_cube.ts delete mode 100644 examples-testing/examples/webgl_geometry_extrude_shapes.ts delete mode 100644 examples-testing/examples/webgl_geometry_extrude_splines.ts delete mode 100644 examples-testing/examples/webgl_geometry_minecraft.ts delete mode 100644 examples-testing/examples/webgl_geometry_nurbs.ts delete mode 100644 examples-testing/examples/webgl_geometry_shapes.ts delete mode 100644 examples-testing/examples/webgl_geometry_teapot.ts delete mode 100644 examples-testing/examples/webgl_geometry_terrain.ts delete mode 100644 examples-testing/examples/webgl_geometry_terrain_raycast.ts delete mode 100644 examples-testing/examples/webgl_geometry_text.ts delete mode 100644 examples-testing/examples/webgl_geometry_text_shapes.ts delete mode 100644 examples-testing/examples/webgl_geometry_text_stroke.ts delete mode 100644 examples-testing/examples/webgl_gpgpu_birds.ts delete mode 100644 examples-testing/examples/webgl_gpgpu_birds_gltf.ts delete mode 100644 examples-testing/examples/webgl_gpgpu_protoplanet.ts delete mode 100644 examples-testing/examples/webgl_gpgpu_water.ts delete mode 100644 examples-testing/examples/webgl_helpers.ts delete mode 100644 examples-testing/examples/webgl_instancing_dynamic.ts delete mode 100644 examples-testing/examples/webgl_instancing_morph.ts delete mode 100644 examples-testing/examples/webgl_instancing_performance.ts delete mode 100644 examples-testing/examples/webgl_instancing_raycast.ts delete mode 100644 examples-testing/examples/webgl_instancing_scatter.ts delete mode 100644 examples-testing/examples/webgl_interactive_buffergeometry.ts delete mode 100644 examples-testing/examples/webgl_interactive_cubes.ts delete mode 100644 examples-testing/examples/webgl_interactive_cubes_gpu.ts delete mode 100644 examples-testing/examples/webgl_interactive_cubes_ortho.ts delete mode 100644 examples-testing/examples/webgl_interactive_lines.ts delete mode 100644 examples-testing/examples/webgl_interactive_points.ts delete mode 100644 examples-testing/examples/webgl_interactive_raycasting_points.ts delete mode 100644 examples-testing/examples/webgl_interactive_voxelpainter.ts delete mode 100644 examples-testing/examples/webgl_lensflares.ts delete mode 100644 examples-testing/examples/webgl_lightprobe.ts delete mode 100644 examples-testing/examples/webgl_lightprobe_cubecamera.ts delete mode 100644 examples-testing/examples/webgl_lightprobes.ts delete mode 100644 examples-testing/examples/webgl_lightprobes_complex.ts delete mode 100644 examples-testing/examples/webgl_lightprobes_sponza.ts delete mode 100644 examples-testing/examples/webgl_lights_hemisphere.ts delete mode 100644 examples-testing/examples/webgl_lights_physical.ts delete mode 100644 examples-testing/examples/webgl_lights_rectarealight.ts delete mode 100644 examples-testing/examples/webgl_lights_spotlight.ts delete mode 100644 examples-testing/examples/webgl_lights_spotlights.ts delete mode 100644 examples-testing/examples/webgl_lights_sunlight.ts delete mode 100644 examples-testing/examples/webgl_lines_colors.ts delete mode 100644 examples-testing/examples/webgl_lines_dashed.ts delete mode 100644 examples-testing/examples/webgl_lines_fat.ts delete mode 100644 examples-testing/examples/webgl_lines_fat_raycasting.ts delete mode 100644 examples-testing/examples/webgl_lines_fat_wireframe.ts delete mode 100644 examples-testing/examples/webgl_loader_3dm.ts delete mode 100644 examples-testing/examples/webgl_loader_3ds.ts delete mode 100644 examples-testing/examples/webgl_loader_3mf.ts delete mode 100644 examples-testing/examples/webgl_loader_3mf_materials.ts delete mode 100644 examples-testing/examples/webgl_loader_amf.ts delete mode 100644 examples-testing/examples/webgl_loader_bvh.ts delete mode 100644 examples-testing/examples/webgl_loader_collada.ts delete mode 100644 examples-testing/examples/webgl_loader_collada_skinning.ts delete mode 100644 examples-testing/examples/webgl_loader_draco.ts delete mode 100644 examples-testing/examples/webgl_loader_fbx.ts delete mode 100644 examples-testing/examples/webgl_loader_fbx_nurbs.ts delete mode 100644 examples-testing/examples/webgl_loader_gcode.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_animation_pointer.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_anisotropy.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_avif.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_compressed.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_dispersion.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_instancing.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_iridescence.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_progressive_lod.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_sheen.ts delete mode 100644 examples-testing/examples/webgl_loader_gltf_transmission.ts delete mode 100644 examples-testing/examples/webgl_loader_imagebitmap.ts delete mode 100644 examples-testing/examples/webgl_loader_kmz.ts delete mode 100644 examples-testing/examples/webgl_loader_md2_control.ts delete mode 100644 examples-testing/examples/webgl_loader_mdd.ts delete mode 100644 examples-testing/examples/webgl_loader_obj.ts delete mode 100644 examples-testing/examples/webgl_loader_pcd.ts delete mode 100644 examples-testing/examples/webgl_loader_pdb.ts delete mode 100644 examples-testing/examples/webgl_loader_ply.ts delete mode 100644 examples-testing/examples/webgl_loader_svg.ts delete mode 100644 examples-testing/examples/webgl_loader_texture_dds.ts delete mode 100644 examples-testing/examples/webgl_loader_texture_ktx.ts delete mode 100644 examples-testing/examples/webgl_loader_texture_tga.ts delete mode 100644 examples-testing/examples/webgl_loader_texture_tiff.ts delete mode 100644 examples-testing/examples/webgl_loader_texture_ultrahdr.ts delete mode 100644 examples-testing/examples/webgl_loader_ttf.ts delete mode 100644 examples-testing/examples/webgl_loader_usdz.ts delete mode 100644 examples-testing/examples/webgl_loader_vox.ts delete mode 100644 examples-testing/examples/webgl_loader_vrml.ts delete mode 100644 examples-testing/examples/webgl_loader_xyz.ts delete mode 100644 examples-testing/examples/webgl_lod.ts delete mode 100644 examples-testing/examples/webgl_marchingcubes.ts delete mode 100644 examples-testing/examples/webgl_materials_alphahash.ts delete mode 100644 examples-testing/examples/webgl_materials_blending.ts delete mode 100644 examples-testing/examples/webgl_materials_blending_custom.ts delete mode 100644 examples-testing/examples/webgl_materials_bumpmap.ts delete mode 100644 examples-testing/examples/webgl_materials_car.ts delete mode 100644 examples-testing/examples/webgl_materials_cubemap.ts delete mode 100644 examples-testing/examples/webgl_materials_cubemap_dynamic.ts delete mode 100644 examples-testing/examples/webgl_materials_cubemap_mipmaps.ts delete mode 100644 examples-testing/examples/webgl_materials_cubemap_refraction.ts delete mode 100644 examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts delete mode 100644 examples-testing/examples/webgl_materials_displacementmap.ts delete mode 100644 examples-testing/examples/webgl_materials_envmaps.ts delete mode 100644 examples-testing/examples/webgl_materials_envmaps_exr.ts delete mode 100644 examples-testing/examples/webgl_materials_envmaps_fasthdr.ts delete mode 100644 examples-testing/examples/webgl_materials_envmaps_groundprojected.ts delete mode 100644 examples-testing/examples/webgl_materials_envmaps_hdr.ts delete mode 100644 examples-testing/examples/webgl_materials_modified.ts delete mode 100644 examples-testing/examples/webgl_materials_normalmap_object_space.ts delete mode 100644 examples-testing/examples/webgl_materials_physical_clearcoat.ts delete mode 100644 examples-testing/examples/webgl_materials_physical_transmission.ts delete mode 100644 examples-testing/examples/webgl_materials_physical_transmission_alpha.ts delete mode 100644 examples-testing/examples/webgl_materials_texture_anisotropy.ts delete mode 100644 examples-testing/examples/webgl_materials_texture_canvas.ts delete mode 100644 examples-testing/examples/webgl_materials_texture_filters.ts delete mode 100644 examples-testing/examples/webgl_materials_texture_html.ts delete mode 100644 examples-testing/examples/webgl_materials_texture_manualmipmap.ts delete mode 100644 examples-testing/examples/webgl_materials_texture_partialupdate.ts delete mode 100644 examples-testing/examples/webgl_materials_texture_rotation.ts delete mode 100644 examples-testing/examples/webgl_materials_toon.ts delete mode 100644 examples-testing/examples/webgl_materials_video.ts delete mode 100644 examples-testing/examples/webgl_materials_video_webcam.ts delete mode 100644 examples-testing/examples/webgl_materials_wireframe.ts delete mode 100644 examples-testing/examples/webgl_math_obb.ts delete mode 100644 examples-testing/examples/webgl_math_orientation_transform.ts delete mode 100644 examples-testing/examples/webgl_mesh_batch.ts delete mode 100644 examples-testing/examples/webgl_mirror.ts delete mode 100644 examples-testing/examples/webgl_modifier_edgesplit.ts delete mode 100644 examples-testing/examples/webgl_modifier_simplifier.ts delete mode 100644 examples-testing/examples/webgl_modifier_tessellation.ts delete mode 100644 examples-testing/examples/webgl_morphtargets.ts delete mode 100644 examples-testing/examples/webgl_morphtargets_face.ts delete mode 100644 examples-testing/examples/webgl_morphtargets_horse.ts delete mode 100644 examples-testing/examples/webgl_morphtargets_sphere.ts delete mode 100644 examples-testing/examples/webgl_multiple_elements.ts delete mode 100644 examples-testing/examples/webgl_multiple_rendertargets.ts delete mode 100644 examples-testing/examples/webgl_multiple_scenes_comparison.ts delete mode 100644 examples-testing/examples/webgl_multiple_views.ts delete mode 100644 examples-testing/examples/webgl_multisampled_renderbuffers.ts delete mode 100644 examples-testing/examples/webgl_panorama_cube.ts delete mode 100644 examples-testing/examples/webgl_panorama_equirectangular.ts delete mode 100644 examples-testing/examples/webgl_performance.ts delete mode 100644 examples-testing/examples/webgl_pmrem_cubemap.ts delete mode 100644 examples-testing/examples/webgl_pmrem_equirectangular.ts delete mode 100644 examples-testing/examples/webgl_pmrem_test.ts delete mode 100644 examples-testing/examples/webgl_points_billboards.ts delete mode 100644 examples-testing/examples/webgl_points_sprites.ts delete mode 100644 examples-testing/examples/webgl_points_waves.ts delete mode 100644 examples-testing/examples/webgl_portal.ts delete mode 100644 examples-testing/examples/webgl_postprocessing.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_advanced.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_afterimage.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_backgrounds.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_fxaa.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_glitch.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_godrays.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_gtao.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_masking.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_outline.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_pixel.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_procedural.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_rgb_halftone.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_sao.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_smaa.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_sobel.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_ssaa.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_ssao.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_ssr.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_taa.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_transition.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_unreal_bloom.ts delete mode 100644 examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts delete mode 100644 examples-testing/examples/webgl_random_uv.ts delete mode 100644 examples-testing/examples/webgl_raycaster_sprite.ts delete mode 100644 examples-testing/examples/webgl_raycaster_texture.ts delete mode 100644 examples-testing/examples/webgl_read_float_buffer.ts delete mode 100644 examples-testing/examples/webgl_refraction.ts delete mode 100644 examples-testing/examples/webgl_rtt.ts delete mode 100644 examples-testing/examples/webgl_shader.ts delete mode 100644 examples-testing/examples/webgl_shader_lava.ts delete mode 100644 examples-testing/examples/webgl_shaders_ocean.ts delete mode 100644 examples-testing/examples/webgl_shaders_sky.ts delete mode 100644 examples-testing/examples/webgl_shadow_contact.ts delete mode 100644 examples-testing/examples/webgl_shadowmap.ts delete mode 100644 examples-testing/examples/webgl_shadowmap_csm.ts delete mode 100644 examples-testing/examples/webgl_shadowmap_pcss.ts delete mode 100644 examples-testing/examples/webgl_shadowmap_performance.ts delete mode 100644 examples-testing/examples/webgl_shadowmap_pointlight.ts delete mode 100644 examples-testing/examples/webgl_shadowmap_progressive.ts delete mode 100644 examples-testing/examples/webgl_shadowmap_viewer.ts delete mode 100644 examples-testing/examples/webgl_shadowmap_vsm.ts delete mode 100644 examples-testing/examples/webgl_shadowmesh.ts delete mode 100644 examples-testing/examples/webgl_simple_gi.ts delete mode 100644 examples-testing/examples/webgl_sprites.ts delete mode 100644 examples-testing/examples/webgl_test_memory.ts delete mode 100644 examples-testing/examples/webgl_test_memory2.ts delete mode 100644 examples-testing/examples/webgl_test_wide_gamut.ts delete mode 100644 examples-testing/examples/webgl_texture2darray_compressed.ts delete mode 100644 examples-testing/examples/webgl_texture2darray_layerupdate.ts delete mode 100644 examples-testing/examples/webgl_texture3d.ts delete mode 100644 examples-testing/examples/webgl_texture3d_partialupdate.ts delete mode 100644 examples-testing/examples/webgl_tonemapping.ts delete mode 100644 examples-testing/examples/webgl_tsl_clearcoat.ts delete mode 100644 examples-testing/examples/webgl_tsl_instancing.ts delete mode 100644 examples-testing/examples/webgl_tsl_shadowmap.ts delete mode 100644 examples-testing/examples/webgl_tsl_skinning.ts delete mode 100644 examples-testing/examples/webgl_ubo.ts delete mode 100644 examples-testing/examples/webgl_ubo_arrays.ts delete mode 100644 examples-testing/examples/webgl_video_kinect.ts delete mode 100644 examples-testing/examples/webgl_video_panorama_equirectangular.ts delete mode 100644 examples-testing/examples/webgl_volume_cloud.ts delete mode 100644 examples-testing/examples/webgl_volume_instancing.ts delete mode 100644 examples-testing/examples/webgl_volume_perlin.ts delete mode 100644 examples-testing/examples/webgl_watch.ts delete mode 100644 examples-testing/examples/webgpu_animation_retargeting.ts delete mode 100644 examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts delete mode 100644 examples-testing/examples/webgpu_backdrop.ts delete mode 100644 examples-testing/examples/webgpu_backdrop_area.ts delete mode 100644 examples-testing/examples/webgpu_backdrop_water.ts delete mode 100644 examples-testing/examples/webgpu_camera.ts delete mode 100644 examples-testing/examples/webgpu_camera_array.ts delete mode 100644 examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts delete mode 100644 examples-testing/examples/webgpu_caustics.ts delete mode 100644 examples-testing/examples/webgpu_centroid_sampling.ts delete mode 100644 examples-testing/examples/webgpu_clearcoat.ts delete mode 100644 examples-testing/examples/webgpu_clipping.ts delete mode 100644 examples-testing/examples/webgpu_clipping_stencil.ts delete mode 100644 examples-testing/examples/webgpu_compile_async.ts delete mode 100644 examples-testing/examples/webgpu_compute_audio.ts delete mode 100644 examples-testing/examples/webgpu_compute_birds.ts delete mode 100644 examples-testing/examples/webgpu_compute_cloth.ts delete mode 100644 examples-testing/examples/webgpu_compute_geometry.ts delete mode 100644 examples-testing/examples/webgpu_compute_particles.ts delete mode 100644 examples-testing/examples/webgpu_compute_particles_rain.ts delete mode 100644 examples-testing/examples/webgpu_compute_particles_snow.ts delete mode 100644 examples-testing/examples/webgpu_compute_points.ts delete mode 100644 examples-testing/examples/webgpu_compute_sort_bitonic.ts delete mode 100644 examples-testing/examples/webgpu_compute_texture.ts delete mode 100644 examples-testing/examples/webgpu_compute_texture_3d.ts delete mode 100644 examples-testing/examples/webgpu_compute_texture_pingpong.ts delete mode 100644 examples-testing/examples/webgpu_cubemap_adjustments.ts delete mode 100644 examples-testing/examples/webgpu_cubemap_dynamic.ts delete mode 100644 examples-testing/examples/webgpu_cubemap_mix.ts delete mode 100644 examples-testing/examples/webgpu_custom_fog.ts delete mode 100644 examples-testing/examples/webgpu_custom_fog_background.ts delete mode 100644 examples-testing/examples/webgpu_custom_fog_scattering.ts delete mode 100644 examples-testing/examples/webgpu_deferred.ts delete mode 100644 examples-testing/examples/webgpu_depth_texture.ts delete mode 100644 examples-testing/examples/webgpu_display_stereo.ts delete mode 100644 examples-testing/examples/webgpu_equirectangular.ts delete mode 100644 examples-testing/examples/webgpu_fog_height.ts delete mode 100644 examples-testing/examples/webgpu_furnace_test.ts delete mode 100644 examples-testing/examples/webgpu_gaussian_splat.ts delete mode 100644 examples-testing/examples/webgpu_generator_building.ts delete mode 100644 examples-testing/examples/webgpu_generator_city.ts delete mode 100644 examples-testing/examples/webgpu_geometry_loft.ts delete mode 100644 examples-testing/examples/webgpu_hdr.ts delete mode 100644 examples-testing/examples/webgpu_instance_mesh.ts delete mode 100644 examples-testing/examples/webgpu_instance_path.ts delete mode 100644 examples-testing/examples/webgpu_instance_points.ts delete mode 100644 examples-testing/examples/webgpu_instancing_morph.ts delete mode 100644 examples-testing/examples/webgpu_layers.ts delete mode 100644 examples-testing/examples/webgpu_lensflares.ts delete mode 100644 examples-testing/examples/webgpu_lightprobe.ts delete mode 100644 examples-testing/examples/webgpu_lightprobe_cubecamera.ts delete mode 100644 examples-testing/examples/webgpu_lightprobes.ts delete mode 100644 examples-testing/examples/webgpu_lightprobes_complex.ts delete mode 100644 examples-testing/examples/webgpu_lightprobes_sponza.ts delete mode 100644 examples-testing/examples/webgpu_lights_clustered.ts delete mode 100644 examples-testing/examples/webgpu_lights_dynamic.ts delete mode 100644 examples-testing/examples/webgpu_lights_ies_spotlight.ts delete mode 100644 examples-testing/examples/webgpu_lights_phong.ts delete mode 100644 examples-testing/examples/webgpu_lights_physical.ts delete mode 100644 examples-testing/examples/webgpu_lights_pointlights.ts delete mode 100644 examples-testing/examples/webgpu_lights_rectarealight.ts delete mode 100644 examples-testing/examples/webgpu_lights_selective.ts delete mode 100644 examples-testing/examples/webgpu_lights_spotlight.ts delete mode 100644 examples-testing/examples/webgpu_lines_fat.ts delete mode 100644 examples-testing/examples/webgpu_lines_fat_raycasting.ts delete mode 100644 examples-testing/examples/webgpu_lines_fat_wireframe.ts delete mode 100644 examples-testing/examples/webgpu_loader_gltf.ts delete mode 100644 examples-testing/examples/webgpu_loader_gltf_anisotropy.ts delete mode 100644 examples-testing/examples/webgpu_loader_gltf_compressed.ts delete mode 100644 examples-testing/examples/webgpu_loader_gltf_dispersion.ts delete mode 100644 examples-testing/examples/webgpu_loader_gltf_iridescence.ts delete mode 100644 examples-testing/examples/webgpu_loader_gltf_sheen.ts delete mode 100644 examples-testing/examples/webgpu_loader_gltf_transmission.ts delete mode 100644 examples-testing/examples/webgpu_loader_materialx.ts delete mode 100644 examples-testing/examples/webgpu_loader_texture_ktx2.ts delete mode 100644 examples-testing/examples/webgpu_materials_alphahash.ts delete mode 100644 examples-testing/examples/webgpu_materials_arrays.ts delete mode 100644 examples-testing/examples/webgpu_materials_basic.ts delete mode 100644 examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts delete mode 100644 examples-testing/examples/webgpu_materials_displacementmap.ts delete mode 100644 examples-testing/examples/webgpu_materials_envmaps.ts delete mode 100644 examples-testing/examples/webgpu_materials_envmaps_bpcem.ts delete mode 100644 examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts delete mode 100644 examples-testing/examples/webgpu_materials_lightmap.ts delete mode 100644 examples-testing/examples/webgpu_materials_matcap.ts delete mode 100644 examples-testing/examples/webgpu_materials_retroreflection.ts delete mode 100644 examples-testing/examples/webgpu_materials_sss.ts delete mode 100644 examples-testing/examples/webgpu_materials_texture_html.ts delete mode 100644 examples-testing/examples/webgpu_materials_texture_manualmipmap.ts delete mode 100644 examples-testing/examples/webgpu_materials_toon.ts delete mode 100644 examples-testing/examples/webgpu_materials_transmission.ts delete mode 100644 examples-testing/examples/webgpu_materials_video.ts delete mode 100644 examples-testing/examples/webgpu_materialx_noise.ts delete mode 100644 examples-testing/examples/webgpu_mesh_batch.ts delete mode 100644 examples-testing/examples/webgpu_mirror.ts delete mode 100644 examples-testing/examples/webgpu_modifier_curve.ts delete mode 100644 examples-testing/examples/webgpu_morphtargets.ts delete mode 100644 examples-testing/examples/webgpu_morphtargets_face.ts delete mode 100644 examples-testing/examples/webgpu_mrt.ts delete mode 100644 examples-testing/examples/webgpu_mrt_mask.ts delete mode 100644 examples-testing/examples/webgpu_multiple_canvas.ts delete mode 100644 examples-testing/examples/webgpu_multiple_elements.ts delete mode 100644 examples-testing/examples/webgpu_multiple_rendertargets.ts delete mode 100644 examples-testing/examples/webgpu_multiple_rendertargets_readback.ts delete mode 100644 examples-testing/examples/webgpu_multisampled_renderbuffers.ts delete mode 100644 examples-testing/examples/webgpu_occlusion.ts delete mode 100644 examples-testing/examples/webgpu_ocean.ts delete mode 100644 examples-testing/examples/webgpu_oit.ts delete mode 100644 examples-testing/examples/webgpu_parallax_uv.ts delete mode 100644 examples-testing/examples/webgpu_particles.ts delete mode 100644 examples-testing/examples/webgpu_particles_soft.ts delete mode 100644 examples-testing/examples/webgpu_performance.ts delete mode 100644 examples-testing/examples/webgpu_performance_renderbundle.ts delete mode 100644 examples-testing/examples/webgpu_pmrem_cubemap.ts delete mode 100644 examples-testing/examples/webgpu_pmrem_equirectangular.ts delete mode 100644 examples-testing/examples/webgpu_pmrem_scene.ts delete mode 100644 examples-testing/examples/webgpu_pmrem_test.ts delete mode 100644 examples-testing/examples/webgpu_portal.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_3dlut.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_afterimage.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_anamorphic.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_ao.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_bloom.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_bloom_selective.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_ca.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_difference.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_direct.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_dof.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_dof_basic.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_fxaa.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_godrays.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_lensflare.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_masking.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_motion_blur.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_outline.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_pixel.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_radial_blur.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_retro.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_smaa.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_sobel.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_ssaa.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_ssgi.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_ssr.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_sss.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_traa.ts delete mode 100644 examples-testing/examples/webgpu_postprocessing_transition.ts delete mode 100644 examples-testing/examples/webgpu_procedural_texture.ts delete mode 100644 examples-testing/examples/webgpu_reflection.ts delete mode 100644 examples-testing/examples/webgpu_reflection_roughness.ts delete mode 100644 examples-testing/examples/webgpu_refraction.ts delete mode 100644 examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts delete mode 100644 examples-testing/examples/webgpu_reversed_depth_buffer.ts delete mode 100644 examples-testing/examples/webgpu_rtt.ts delete mode 100644 examples-testing/examples/webgpu_shadow_contact.ts delete mode 100644 examples-testing/examples/webgpu_shadowmap.ts delete mode 100644 examples-testing/examples/webgpu_shadowmap_array.ts delete mode 100644 examples-testing/examples/webgpu_shadowmap_csm.ts delete mode 100644 examples-testing/examples/webgpu_shadowmap_opacity.ts delete mode 100644 examples-testing/examples/webgpu_shadowmap_pointlight.ts delete mode 100644 examples-testing/examples/webgpu_shadowmap_progressive.ts delete mode 100644 examples-testing/examples/webgpu_shadowmap_vsm.ts delete mode 100644 examples-testing/examples/webgpu_skinning.ts delete mode 100644 examples-testing/examples/webgpu_skinning_instancing.ts delete mode 100644 examples-testing/examples/webgpu_skinning_instancing_individual.ts delete mode 100644 examples-testing/examples/webgpu_sprites.ts delete mode 100644 examples-testing/examples/webgpu_storage_buffer.ts delete mode 100644 examples-testing/examples/webgpu_struct_drawindirect.ts delete mode 100644 examples-testing/examples/webgpu_test_memory.ts delete mode 100644 examples-testing/examples/webgpu_texturegather.ts delete mode 100644 examples-testing/examples/webgpu_texturegrad.ts delete mode 100644 examples-testing/examples/webgpu_textures_2d-array.ts delete mode 100644 examples-testing/examples/webgpu_textures_2d-array_compressed.ts delete mode 100644 examples-testing/examples/webgpu_textures_anisotropy.ts delete mode 100644 examples-testing/examples/webgpu_textures_partialupdate.ts delete mode 100644 examples-testing/examples/webgpu_tonemapping.ts delete mode 100644 examples-testing/examples/webgpu_tsl_angular_slicing.ts delete mode 100644 examples-testing/examples/webgpu_tsl_earth.ts delete mode 100644 examples-testing/examples/webgpu_tsl_galaxy.ts delete mode 100644 examples-testing/examples/webgpu_tsl_graph.ts delete mode 100644 examples-testing/examples/webgpu_tsl_halftone.ts delete mode 100644 examples-testing/examples/webgpu_tsl_interoperability.ts delete mode 100644 examples-testing/examples/webgpu_tsl_procedural_terrain.ts delete mode 100644 examples-testing/examples/webgpu_tsl_raging_sea.ts delete mode 100644 examples-testing/examples/webgpu_tsl_vfx_flames.ts delete mode 100644 examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts delete mode 100644 examples-testing/examples/webgpu_tsl_vfx_tornado.ts delete mode 100644 examples-testing/examples/webgpu_tsl_wood.ts delete mode 100644 examples-testing/examples/webgpu_upscaling_fsr1.ts delete mode 100644 examples-testing/examples/webgpu_upscaling_taau.ts delete mode 100644 examples-testing/examples/webgpu_video_panorama.ts delete mode 100644 examples-testing/examples/webgpu_volume_caustics.ts delete mode 100644 examples-testing/examples/webgpu_volume_cloud.ts delete mode 100644 examples-testing/examples/webgpu_volume_lighting.ts delete mode 100644 examples-testing/examples/webgpu_volume_lighting_rectarea.ts delete mode 100644 examples-testing/examples/webgpu_volume_lighting_traa.ts delete mode 100644 examples-testing/examples/webgpu_volume_perlin.ts delete mode 100644 examples-testing/examples/webgpu_water.ts delete mode 100644 examples-testing/examples/webgpu_xr_cubes.ts delete mode 100644 examples-testing/examples/webgpu_xr_native_layers.ts delete mode 100644 examples-testing/examples/webgpu_xr_rollercoaster.ts delete mode 100644 examples-testing/examples/webgpu_xr_shadows.ts delete mode 100644 examples-testing/examples/webxr_ar_cones.ts delete mode 100644 examples-testing/examples/webxr_ar_hittest.ts delete mode 100644 examples-testing/examples/webxr_ar_lighting.ts delete mode 100644 examples-testing/examples/webxr_ar_plane_detection.ts delete mode 100644 examples-testing/examples/webxr_vr_handinput.ts delete mode 100644 examples-testing/examples/webxr_vr_panorama.ts delete mode 100644 examples-testing/examples/webxr_vr_panorama_depth.ts delete mode 100644 examples-testing/examples/webxr_vr_rollercoaster.ts delete mode 100644 examples-testing/examples/webxr_vr_sandbox.ts delete mode 100644 examples-testing/examples/webxr_vr_video.ts delete mode 100644 examples-testing/examples/webxr_xr_controls_transform.ts delete mode 100644 examples-testing/examples/webxr_xr_dragging_custom_depth.ts diff --git a/examples-testing/changes.patch b/examples-testing/changes.patch index 58caef265..3e0597a04 100644 --- a/examples-testing/changes.patch +++ b/examples-testing/changes.patch @@ -14784,6 +14784,46 @@ index b2b567c9a..6c1ad5f2c 100644 const time = (currentTime - startTime) / 1000; object.position.y = 0.8; +diff --git a/examples-testing/examples/webgpu_clipping_stencil.ts b/examples-testing/examples/webgpu_clipping_stencil.ts +index c117bcfa8..584957a68 100644 +--- a/examples-testing/examples/webgpu_clipping_stencil.ts ++++ b/examples-testing/examples/webgpu_clipping_stencil.ts +@@ -4,9 +4,9 @@ import { Inspector } from 'three/addons/inspector/Inspector.js'; + + import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; + +-let camera, scene, renderer, object; +-let planes, planeObjects, planeHelpers; +-let timer; ++let camera: THREE.PerspectiveCamera, scene: THREE.Scene, renderer: THREE.WebGPURenderer, object: THREE.Group; ++let planes: THREE.Plane[], planeObjects: THREE.Mesh[], planeHelpers: THREE.PlaneHelper[]; ++let timer: THREE.Timer; + + const params = { + animate: true, +@@ -29,7 +29,12 @@ const params = { + + init(); + +-function createPlaneStencilGroup(geometry, plane, stencilBit, renderOrder) { ++function createPlaneStencilGroup( ++ geometry: THREE.TorusKnotGeometry, ++ plane: THREE.Plane, ++ stencilBit: number, ++ renderOrder: number, ++) { + const group = new THREE.ClippingGroup(); + group.clippingPlanes = [plane]; + +@@ -184,7 +189,7 @@ function init() { + + // GUI + +- const gui = renderer.inspector.createParameters('Clipping settings'); ++ const gui = (renderer.inspector as Inspector).createParameters('Clipping settings'); + gui.add(params, 'animate'); + + const planeX = gui.addFolder('planeX'); diff --git a/examples-testing/examples/webgpu_compile_async.ts b/examples-testing/examples/webgpu_compile_async.ts index fbcf0a7b0..b80719c41 100644 --- a/examples-testing/examples/webgpu_compile_async.ts diff --git a/examples-testing/examples/css2d_label.ts b/examples-testing/examples/css2d_label.ts deleted file mode 100644 index 1b2889980..000000000 --- a/examples-testing/examples/css2d_label.ts +++ /dev/null @@ -1,189 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let gui; - -let camera, scene, renderer, labelRenderer; - -const layers = { - 'Toggle Name': function () { - camera.layers.toggle(0); - }, - 'Toggle Mass': function () { - camera.layers.toggle(1); - }, - 'Enable All': function () { - camera.layers.enableAll(); - }, - - 'Disable All': function () { - camera.layers.disableAll(); - }, -}; - -const timer = new THREE.Timer(); -timer.connect(document); -const textureLoader = new THREE.TextureLoader(); - -let moon; - -init(); -animate(); - -function init() { - const EARTH_RADIUS = 1; - const MOON_RADIUS = 0.27; - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); - camera.position.set(10, 5, 20); - camera.layers.enableAll(); - - scene = new THREE.Scene(); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(0, 0, 1); - dirLight.layers.enableAll(); - scene.add(dirLight); - - const axesHelper = new THREE.AxesHelper(5); - axesHelper.layers.enableAll(); - scene.add(axesHelper); - - // - - const earthGeometry = new THREE.SphereGeometry(EARTH_RADIUS, 16, 16); - const earthMaterial = new THREE.MeshPhongMaterial({ - specular: 0x333333, - shininess: 5, - map: textureLoader.load('textures/planets/earth_atmos_2048.jpg'), - specularMap: textureLoader.load('textures/planets/earth_specular_2048.jpg'), - normalMap: textureLoader.load('textures/planets/earth_normal_2048.jpg'), - normalScale: new THREE.Vector2(0.85, 0.85), - }); - earthMaterial.map.colorSpace = THREE.SRGBColorSpace; - const earth = new THREE.Mesh(earthGeometry, earthMaterial); - scene.add(earth); - - const moonGeometry = new THREE.SphereGeometry(MOON_RADIUS, 16, 16); - const moonMaterial = new THREE.MeshPhongMaterial({ - shininess: 5, - map: textureLoader.load('textures/planets/moon_1024.jpg'), - }); - moonMaterial.map.colorSpace = THREE.SRGBColorSpace; - moon = new THREE.Mesh(moonGeometry, moonMaterial); - scene.add(moon); - - // - - earth.layers.enableAll(); - moon.layers.enableAll(); - - const earthDiv = document.createElement('div'); - earthDiv.className = 'label'; - earthDiv.textContent = 'Earth'; - earthDiv.style.backgroundColor = 'transparent'; - - const earthLabel = new CSS2DObject(earthDiv); - earthLabel.position.set(1.5 * EARTH_RADIUS, 0, 0); - earthLabel.center.set(0, 1); - earth.add(earthLabel); - earthLabel.layers.set(0); - - const earthMassDiv = document.createElement('div'); - earthMassDiv.className = 'label'; - earthMassDiv.textContent = '5.97237e24 kg'; - earthMassDiv.style.backgroundColor = 'transparent'; - - const earthMassLabel = new CSS2DObject(earthMassDiv); - earthMassLabel.position.set(1.5 * EARTH_RADIUS, 0, 0); - earthMassLabel.center.set(0, 0); - earth.add(earthMassLabel); - earthMassLabel.layers.set(1); - - const moonDiv = document.createElement('div'); - moonDiv.className = 'label'; - moonDiv.textContent = 'Moon'; - moonDiv.style.backgroundColor = 'transparent'; - - const moonLabel = new CSS2DObject(moonDiv); - moonLabel.position.set(1.5 * MOON_RADIUS, 0, 0); - moonLabel.center.set(0, 1); - moon.add(moonLabel); - moonLabel.layers.set(0); - - const moonMassDiv = document.createElement('div'); - moonMassDiv.className = 'label'; - moonMassDiv.textContent = '7.342e22 kg'; - moonMassDiv.style.backgroundColor = 'transparent'; - - const moonMassLabel = new CSS2DObject(moonMassDiv); - moonMassLabel.position.set(1.5 * MOON_RADIUS, 0, 0); - moonMassLabel.center.set(0, 0); - moon.add(moonMassLabel); - moonMassLabel.layers.set(1); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - labelRenderer = new CSS2DRenderer(); - labelRenderer.setSize(window.innerWidth, window.innerHeight); - labelRenderer.domElement.style.position = 'absolute'; - labelRenderer.domElement.style.top = '0px'; - document.body.appendChild(labelRenderer.domElement); - - const controls = new OrbitControls(camera, labelRenderer.domElement); - controls.minDistance = 5; - controls.maxDistance = 100; - - // - - window.addEventListener('resize', onWindowResize); - - initGui(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - labelRenderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - requestAnimationFrame(animate); - - const elapsed = timer.getElapsed(); - - moon.position.set(Math.sin(elapsed) * 5, 0, Math.cos(elapsed) * 5); - - renderer.render(scene, camera); - labelRenderer.render(scene, camera); -} - -// - -function initGui() { - gui = new GUI(); - - gui.title('Camera Layers'); - - gui.add(layers, 'Toggle Name'); - gui.add(layers, 'Toggle Mass'); - gui.add(layers, 'Enable All'); - gui.add(layers, 'Disable All'); - - gui.open(); -} diff --git a/examples-testing/examples/css3d_mixed.ts b/examples-testing/examples/css3d_mixed.ts deleted file mode 100644 index b526e73e5..000000000 --- a/examples-testing/examples/css3d_mixed.ts +++ /dev/null @@ -1,138 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; - -let camera, scene, rendererCSS3D, rendererWebGL; -let controls; - -init(); - -function init() { - const controlsDomElement = document.createElement('div'); - controlsDomElement.style.position = 'absolute'; - controlsDomElement.style.top = '0'; - controlsDomElement.style.width = '100%'; - controlsDomElement.style.height = '100%'; - document.body.appendChild(controlsDomElement); - - rendererCSS3D = new CSS3DRenderer(); - rendererCSS3D.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(rendererCSS3D.domElement); - - rendererWebGL = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - rendererWebGL.domElement.style.position = 'absolute'; - rendererWebGL.domElement.style.top = '0'; - rendererWebGL.domElement.style.pointerEvents = 'none'; - rendererWebGL.setPixelRatio(window.devicePixelRatio); - rendererWebGL.setSize(window.innerWidth, window.innerHeight); - rendererWebGL.toneMapping = THREE.NeutralToneMapping; - rendererWebGL.setAnimationLoop(animate); - document.body.appendChild(rendererWebGL.domElement); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(-1000, 500, 1500); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - // Add room - const roomGeometry = new THREE.EdgesGeometry(new THREE.BoxGeometry(4000, 2000, 4000, 10, 5, 10)); - const roomMaterial = new THREE.LineBasicMaterial({ color: 0x000000, opacity: 0.2, transparent: true }); - const room = new THREE.LineSegments(roomGeometry, roomMaterial); - scene.add(room); - - // Add light - const hemisphereLight = new THREE.HemisphereLight(0xffffff, 0x444444, 4); - hemisphereLight.position.set(-25, 100, 50); - scene.add(hemisphereLight); - - // Add cutout mesh - const geometry = new THREE.PlaneGeometry(1024, 768); - const material = new THREE.MeshBasicMaterial({ - color: 0xff0000, - blending: THREE.NoBlending, - opacity: 0, - premultipliedAlpha: true, - }); - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // Add frame - const frame = buildFrame(1024, 768, 50); - scene.add(frame); - - // Add CSS3D element - const iframe = document.createElement('iframe'); - iframe.style.width = '1028px'; - iframe.style.height = '768px'; - iframe.style.border = '0px'; - iframe.style.backfaceVisibility = 'hidden'; - iframe.src = './#webgl_animation_keyframes'; - scene.add(new CSS3DObject(iframe)); - - // Add controls - controls = new OrbitControls(camera); - controls.connect(controlsDomElement); - controls.addEventListener('start', () => (iframe.style.pointerEvents = 'none')); - controls.addEventListener('end', () => (iframe.style.pointerEvents = 'auto')); - controls.enableDamping = true; - - window.addEventListener('resize', onWindowResize); -} - -function buildFrame(width, height, thickness) { - const group = new THREE.Group(); - const material = new THREE.MeshStandardMaterial({ color: 0x2200ff }); - - // Create the frame border - const outerShape = new THREE.Shape(); - outerShape.moveTo(-(width / 2 + thickness), -(height / 2 + thickness)); - outerShape.lineTo(width / 2 + thickness, -(height / 2 + thickness)); - outerShape.lineTo(width / 2 + thickness, height / 2 + thickness); - outerShape.lineTo(-(width / 2 + thickness), height / 2 + thickness); - outerShape.lineTo(-(width / 2 + thickness), -(height / 2 + thickness)); - - // Create inner rectangle (hole) - const innerHole = new THREE.Path(); - innerHole.moveTo(-width / 2, -height / 2); - innerHole.lineTo(width / 2, -height / 2); - innerHole.lineTo(width / 2, height / 2); - innerHole.lineTo(-width / 2, height / 2); - innerHole.lineTo(-width / 2, -height / 2); - - outerShape.holes.push(innerHole); - - const frameGeometry = new THREE.ExtrudeGeometry(outerShape, { - depth: thickness, - bevelEnabled: false, - }); - - const frameMesh = new THREE.Mesh(frameGeometry, material); - frameMesh.position.z = -thickness / 2; - group.add(frameMesh); - - // Add back plane - const backGeometry = new THREE.PlaneGeometry(width + thickness * 2, height + thickness * 2); - const backMesh = new THREE.Mesh(backGeometry, material); - backMesh.position.set(0, 0, -thickness / 2); - backMesh.rotation.y = Math.PI; - group.add(backMesh); - - return group; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - rendererWebGL.setSize(window.innerWidth, window.innerHeight); - rendererCSS3D.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - rendererWebGL.render(scene, camera); - rendererCSS3D.render(scene, camera); -} diff --git a/examples-testing/examples/css3d_molecules.ts b/examples-testing/examples/css3d_molecules.ts deleted file mode 100644 index 538472607..000000000 --- a/examples-testing/examples/css3d_molecules.ts +++ /dev/null @@ -1,353 +0,0 @@ -import * as THREE from 'three'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; -import { CSS3DRenderer, CSS3DObject, CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer; -let controls; -let root; - -const objects = []; -const tmpVec1 = new THREE.Vector3(); -const tmpVec2 = new THREE.Vector3(); -const tmpVec3 = new THREE.Vector3(); -const tmpVec4 = new THREE.Vector3(); -const offset = new THREE.Vector3(); - -const VIZ_TYPE = { - Atoms: 0, - Bonds: 1, - 'Atoms + Bonds': 2, -}; - -const MOLECULES = { - Ethanol: 'ethanol.pdb', - Aspirin: 'aspirin.pdb', - Caffeine: 'caffeine.pdb', - Nicotine: 'nicotine.pdb', - LSD: 'lsd.pdb', - Cocaine: 'cocaine.pdb', - Cholesterol: 'cholesterol.pdb', - Lycopene: 'lycopene.pdb', - Glucose: 'glucose.pdb', - 'Aluminium oxide': 'Al2O3.pdb', - Cubane: 'cubane.pdb', - Copper: 'cu.pdb', - Fluorite: 'caf2.pdb', - Salt: 'nacl.pdb', - 'YBCO superconductor': 'ybco.pdb', - Buckyball: 'buckyball.pdb', - // 'Diamond': 'diamond.pdb', - Graphite: 'graphite.pdb', -}; - -const params = { - vizType: 2, - molecule: 'caffeine.pdb', -}; - -const loader = new PDBLoader(); -const colorSpriteMap = {}; -const baseSprite = document.createElement('img'); - -init(); -animate(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - - root = new THREE.Object3D(); - scene.add(root); - - // - - renderer = new CSS3DRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - document.getElementById('container').appendChild(renderer.domElement); - - // - - controls = new TrackballControls(camera, renderer.domElement); - controls.rotateSpeed = 0.5; - - // - - baseSprite.onload = function () { - loadMolecule(params.molecule); - }; - - baseSprite.src = 'textures/sprites/ball.png'; - - // - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - - gui.add(params, 'vizType', VIZ_TYPE).onChange(changeVizType); - gui.add(params, 'molecule', MOLECULES).onChange(loadMolecule); - gui.open(); -} - -function changeVizType(value) { - if (value === 0) showAtoms(); - else if (value === 1) showBonds(); - else showAtomsBonds(); -} - -// - -function showAtoms() { - for (let i = 0; i < objects.length; i++) { - const object = objects[i]; - - if (object instanceof CSS3DSprite) { - object.element.style.display = ''; - object.visible = true; - } else { - object.element.style.display = 'none'; - object.visible = false; - } - } -} - -function showBonds() { - for (let i = 0; i < objects.length; i++) { - const object = objects[i]; - - if (object instanceof CSS3DSprite) { - object.element.style.display = 'none'; - object.visible = false; - } else { - object.element.style.display = ''; - object.element.style.height = object.userData.bondLengthFull; - object.visible = true; - } - } -} - -function showAtomsBonds() { - for (let i = 0; i < objects.length; i++) { - const object = objects[i]; - - object.element.style.display = ''; - object.visible = true; - - if (!(object instanceof CSS3DSprite)) { - object.element.style.height = object.userData.bondLengthShort; - } - } -} - -// - -function colorify(ctx, width, height, color) { - const r = color.r, - g = color.g, - b = color.b; - - const imageData = ctx.getImageData(0, 0, width, height); - const data = imageData.data; - - for (let i = 0, l = data.length; i < l; i += 4) { - data[i + 0] *= r; - data[i + 1] *= g; - data[i + 2] *= b; - } - - ctx.putImageData(imageData, 0, 0); -} - -function imageToCanvas(image) { - const width = image.width; - const height = image.height; - - const canvas = document.createElement('canvas'); - - canvas.width = width; - canvas.height = height; - - const context = canvas.getContext('2d'); - context.drawImage(image, 0, 0, width, height); - - return canvas; -} - -// - -function loadMolecule(model) { - const url = 'models/pdb/' + model; - - for (let i = 0; i < objects.length; i++) { - const object = objects[i]; - object.parent.remove(object); - } - - objects.length = 0; - - loader.load(url, function (pdb) { - const geometryAtoms = pdb.geometryAtoms; - const geometryBonds = pdb.geometryBonds; - const json = pdb.json; - - geometryAtoms.computeBoundingBox(); - geometryAtoms.boundingBox.getCenter(offset).negate(); - - geometryAtoms.translate(offset.x, offset.y, offset.z); - geometryBonds.translate(offset.x, offset.y, offset.z); - - const positionAtoms = geometryAtoms.getAttribute('position'); - const colorAtoms = geometryAtoms.getAttribute('color'); - - const position = new THREE.Vector3(); - const color = new THREE.Color(); - - for (let i = 0; i < positionAtoms.count; i++) { - position.fromBufferAttribute(positionAtoms, i); - color.fromBufferAttribute(colorAtoms, i); - - const atomJSON = json.atoms[i]; - const element = atomJSON[4]; - - if (!colorSpriteMap[element]) { - const canvas = imageToCanvas(baseSprite); - const context = canvas.getContext('2d'); - - colorify(context, canvas.width, canvas.height, color); - - const dataUrl = canvas.toDataURL(); - - colorSpriteMap[element] = dataUrl; - } - - const colorSprite = colorSpriteMap[element]; - - const atom = document.createElement('img'); - atom.src = colorSprite; - - const object = new CSS3DSprite(atom); - object.position.copy(position); - object.position.multiplyScalar(75); - - object.matrixAutoUpdate = false; - object.updateMatrix(); - - root.add(object); - - objects.push(object); - } - - const positionBonds = geometryBonds.getAttribute('position'); - - const start = new THREE.Vector3(); - const end = new THREE.Vector3(); - - for (let i = 0; i < positionBonds.count; i += 2) { - start.fromBufferAttribute(positionBonds, i); - end.fromBufferAttribute(positionBonds, i + 1); - - start.multiplyScalar(75); - end.multiplyScalar(75); - - tmpVec1.subVectors(end, start); - const bondLength = tmpVec1.length() - 50; - - // - - let bond = document.createElement('div'); - bond.className = 'bond'; - bond.style.height = bondLength + 'px'; - - let object = new CSS3DObject(bond); - object.position.copy(start); - object.position.lerp(end, 0.5); - - object.userData.bondLengthShort = bondLength + 'px'; - object.userData.bondLengthFull = bondLength + 55 + 'px'; - - // - - const axis = tmpVec2.set(0, 1, 0).cross(tmpVec1); - const radians = Math.acos(tmpVec3.set(0, 1, 0).dot(tmpVec4.copy(tmpVec1).normalize())); - - const objMatrix = new THREE.Matrix4().makeRotationAxis(axis.normalize(), radians); - object.matrix.copy(objMatrix); - object.quaternion.setFromRotationMatrix(object.matrix); - - object.matrixAutoUpdate = false; - object.updateMatrix(); - - root.add(object); - - objects.push(object); - - // - - const joint = new THREE.Object3D(); - joint.position.copy(start); - joint.position.lerp(end, 0.5); - - joint.matrix.copy(objMatrix); - joint.quaternion.setFromRotationMatrix(joint.matrix); - - joint.matrixAutoUpdate = false; - joint.updateMatrix(); - - bond = document.createElement('div'); - bond.className = 'bond'; - bond.style.height = bondLength + 'px'; - - object = new CSS3DObject(bond); - object.rotation.y = Math.PI / 2; - - object.matrixAutoUpdate = false; - object.updateMatrix(); - - object.userData.bondLengthShort = bondLength + 'px'; - object.userData.bondLengthFull = bondLength + 55 + 'px'; - - object.userData.joint = joint; - - joint.add(object); - root.add(joint); - - objects.push(object); - } - - //console.log( "CSS3DObjects:", objects.length ); - - changeVizType(params.vizType); - }); -} - -// - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - requestAnimationFrame(animate); - controls.update(); - - const time = Date.now() * 0.0004; - - root.rotation.x = time; - root.rotation.y = time * 0.7; - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/css3d_orthographic.ts b/examples-testing/examples/css3d_orthographic.ts deleted file mode 100644 index 4aabbed08..000000000 --- a/examples-testing/examples/css3d_orthographic.ts +++ /dev/null @@ -1,208 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer; - -let scene2, renderer2; - -const frustumSize = 500; - -init(); -animate(); - -function init() { - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera( - (frustumSize * aspect) / -2, - (frustumSize * aspect) / 2, - frustumSize / 2, - frustumSize / -2, - 1, - 1000, - ); - - camera.position.set(-200, 200, 200); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - scene2 = new THREE.Scene(); - - const material = new THREE.MeshBasicMaterial({ - color: 0x000000, - wireframe: true, - wireframeLinewidth: 1, - side: THREE.DoubleSide, - }); - - // left - createPlane( - 100, - 100, - 'chocolate', - new THREE.Vector3(-50, 0, 0), - new THREE.Euler(0, -90 * THREE.MathUtils.DEG2RAD, 0), - ); - // right - createPlane(100, 100, 'saddlebrown', new THREE.Vector3(0, 0, 50), new THREE.Euler(0, 0, 0)); - // top - createPlane( - 100, - 100, - 'yellowgreen', - new THREE.Vector3(0, 50, 0), - new THREE.Euler(-90 * THREE.MathUtils.DEG2RAD, 0, 0), - ); - // bottom - createPlane( - 300, - 300, - 'seagreen', - new THREE.Vector3(0, -50, 0), - new THREE.Euler(-90 * THREE.MathUtils.DEG2RAD, 0, 0), - ); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - renderer2 = new CSS3DRenderer(); - renderer2.setSize(window.innerWidth, window.innerHeight); - renderer2.domElement.style.position = 'absolute'; - renderer2.domElement.style.top = 0; - document.body.appendChild(renderer2.domElement); - - const controls = new OrbitControls(camera, renderer2.domElement); - controls.minZoom = 0.5; - controls.maxZoom = 2; - - function createPlane(width, height, cssColor, pos, rot) { - const element = document.createElement('div'); - element.style.width = width + 'px'; - element.style.height = height + 'px'; - element.style.opacity = 0.75; - element.style.background = cssColor; - - const object = new CSS3DObject(element); - object.position.copy(pos); - object.rotation.copy(rot); - scene2.add(object); - - const geometry = new THREE.PlaneGeometry(width, height); - const mesh = new THREE.Mesh(geometry, material); - mesh.position.copy(object.position); - mesh.rotation.copy(object.rotation); - scene.add(mesh); - } - - window.addEventListener('resize', onWindowResize); - createPanel(); -} - -function onWindowResize() { - const aspect = window.innerWidth / window.innerHeight; - - camera.left = (-frustumSize * aspect) / 2; - camera.right = (frustumSize * aspect) / 2; - camera.top = frustumSize / 2; - camera.bottom = -frustumSize / 2; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - renderer2.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - requestAnimationFrame(animate); - - renderer.render(scene, camera); - renderer2.render(scene2, camera); -} - -function createPanel() { - const panel = new GUI(); - const folder1 = panel.addFolder('camera setViewOffset').close(); - - const settings = { - setViewOffset() { - folder1.children[1].enable().setValue(window.innerWidth); - folder1.children[2].enable().setValue(window.innerHeight); - folder1.children[3].enable().setValue(0); - folder1.children[4].enable().setValue(0); - folder1.children[5].enable().setValue(window.innerWidth); - folder1.children[6].enable().setValue(window.innerHeight); - }, - fullWidth: 0, - fullHeight: 0, - offsetX: 0, - offsetY: 0, - width: 0, - height: 0, - clearViewOffset() { - folder1.children[1].setValue(0).disable(); - folder1.children[2].setValue(0).disable(); - folder1.children[3].setValue(0).disable(); - folder1.children[4].setValue(0).disable(); - folder1.children[5].setValue(0).disable(); - folder1.children[6].setValue(0).disable(); - camera.clearViewOffset(); - }, - }; - - folder1.add(settings, 'setViewOffset'); - folder1 - .add(settings, 'fullWidth', window.screen.width / 4, window.screen.width * 2, 1) - .onChange(val => updateCameraViewOffset({ fullWidth: val })) - .disable(); - folder1 - .add(settings, 'fullHeight', window.screen.height / 4, window.screen.height * 2, 1) - .onChange(val => updateCameraViewOffset({ fullHeight: val })) - .disable(); - folder1 - .add(settings, 'offsetX', 0, 256, 1) - .onChange(val => updateCameraViewOffset({ x: val })) - .disable(); - folder1 - .add(settings, 'offsetY', 0, 256, 1) - .onChange(val => updateCameraViewOffset({ y: val })) - .disable(); - folder1 - .add(settings, 'width', window.screen.width / 4, window.screen.width * 2, 1) - .onChange(val => updateCameraViewOffset({ width: val })) - .disable(); - folder1 - .add(settings, 'height', window.screen.height / 4, window.screen.height * 2, 1) - .onChange(val => updateCameraViewOffset({ height: val })) - .disable(); - folder1.add(settings, 'clearViewOffset'); -} - -function updateCameraViewOffset({ fullWidth, fullHeight, x, y, width, height }) { - if (!camera.view) { - camera.setViewOffset( - fullWidth || window.innerWidth, - fullHeight || window.innerHeight, - x || 0, - y || 0, - width || window.innerWidth, - height || window.innerHeight, - ); - } else { - camera.setViewOffset( - fullWidth || camera.view.fullWidth, - fullHeight || camera.view.fullHeight, - x || camera.view.offsetX, - y || camera.view.offsetY, - width || camera.view.width, - height || camera.view.height, - ); - } -} diff --git a/examples-testing/examples/css3d_periodictable.ts b/examples-testing/examples/css3d_periodictable.ts deleted file mode 100644 index e3a33f796..000000000 --- a/examples-testing/examples/css3d_periodictable.ts +++ /dev/null @@ -1,793 +0,0 @@ -import * as THREE from 'three'; - -import TWEEN from 'three/addons/libs/tween.module.js'; -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; - -const table = [ - 'H', - 'Hydrogen', - '1.00794', - 1, - 1, - 'He', - 'Helium', - '4.002602', - 18, - 1, - 'Li', - 'Lithium', - '6.941', - 1, - 2, - 'Be', - 'Beryllium', - '9.012182', - 2, - 2, - 'B', - 'Boron', - '10.811', - 13, - 2, - 'C', - 'Carbon', - '12.0107', - 14, - 2, - 'N', - 'Nitrogen', - '14.0067', - 15, - 2, - 'O', - 'Oxygen', - '15.9994', - 16, - 2, - 'F', - 'Fluorine', - '18.9984032', - 17, - 2, - 'Ne', - 'Neon', - '20.1797', - 18, - 2, - 'Na', - 'Sodium', - '22.98976...', - 1, - 3, - 'Mg', - 'Magnesium', - '24.305', - 2, - 3, - 'Al', - 'Aluminium', - '26.9815386', - 13, - 3, - 'Si', - 'Silicon', - '28.0855', - 14, - 3, - 'P', - 'Phosphorus', - '30.973762', - 15, - 3, - 'S', - 'Sulfur', - '32.065', - 16, - 3, - 'Cl', - 'Chlorine', - '35.453', - 17, - 3, - 'Ar', - 'Argon', - '39.948', - 18, - 3, - 'K', - 'Potassium', - '39.948', - 1, - 4, - 'Ca', - 'Calcium', - '40.078', - 2, - 4, - 'Sc', - 'Scandium', - '44.955912', - 3, - 4, - 'Ti', - 'Titanium', - '47.867', - 4, - 4, - 'V', - 'Vanadium', - '50.9415', - 5, - 4, - 'Cr', - 'Chromium', - '51.9961', - 6, - 4, - 'Mn', - 'Manganese', - '54.938045', - 7, - 4, - 'Fe', - 'Iron', - '55.845', - 8, - 4, - 'Co', - 'Cobalt', - '58.933195', - 9, - 4, - 'Ni', - 'Nickel', - '58.6934', - 10, - 4, - 'Cu', - 'Copper', - '63.546', - 11, - 4, - 'Zn', - 'Zinc', - '65.38', - 12, - 4, - 'Ga', - 'Gallium', - '69.723', - 13, - 4, - 'Ge', - 'Germanium', - '72.63', - 14, - 4, - 'As', - 'Arsenic', - '74.9216', - 15, - 4, - 'Se', - 'Selenium', - '78.96', - 16, - 4, - 'Br', - 'Bromine', - '79.904', - 17, - 4, - 'Kr', - 'Krypton', - '83.798', - 18, - 4, - 'Rb', - 'Rubidium', - '85.4678', - 1, - 5, - 'Sr', - 'Strontium', - '87.62', - 2, - 5, - 'Y', - 'Yttrium', - '88.90585', - 3, - 5, - 'Zr', - 'Zirconium', - '91.224', - 4, - 5, - 'Nb', - 'Niobium', - '92.90628', - 5, - 5, - 'Mo', - 'Molybdenum', - '95.96', - 6, - 5, - 'Tc', - 'Technetium', - '(98)', - 7, - 5, - 'Ru', - 'Ruthenium', - '101.07', - 8, - 5, - 'Rh', - 'Rhodium', - '102.9055', - 9, - 5, - 'Pd', - 'Palladium', - '106.42', - 10, - 5, - 'Ag', - 'Silver', - '107.8682', - 11, - 5, - 'Cd', - 'Cadmium', - '112.411', - 12, - 5, - 'In', - 'Indium', - '114.818', - 13, - 5, - 'Sn', - 'Tin', - '118.71', - 14, - 5, - 'Sb', - 'Antimony', - '121.76', - 15, - 5, - 'Te', - 'Tellurium', - '127.6', - 16, - 5, - 'I', - 'Iodine', - '126.90447', - 17, - 5, - 'Xe', - 'Xenon', - '131.293', - 18, - 5, - 'Cs', - 'Caesium', - '132.9054', - 1, - 6, - 'Ba', - 'Barium', - '132.9054', - 2, - 6, - 'La', - 'Lanthanum', - '138.90547', - 4, - 9, - 'Ce', - 'Cerium', - '140.116', - 5, - 9, - 'Pr', - 'Praseodymium', - '140.90765', - 6, - 9, - 'Nd', - 'Neodymium', - '144.242', - 7, - 9, - 'Pm', - 'Promethium', - '(145)', - 8, - 9, - 'Sm', - 'Samarium', - '150.36', - 9, - 9, - 'Eu', - 'Europium', - '151.964', - 10, - 9, - 'Gd', - 'Gadolinium', - '157.25', - 11, - 9, - 'Tb', - 'Terbium', - '158.92535', - 12, - 9, - 'Dy', - 'Dysprosium', - '162.5', - 13, - 9, - 'Ho', - 'Holmium', - '164.93032', - 14, - 9, - 'Er', - 'Erbium', - '167.259', - 15, - 9, - 'Tm', - 'Thulium', - '168.93421', - 16, - 9, - 'Yb', - 'Ytterbium', - '173.054', - 17, - 9, - 'Lu', - 'Lutetium', - '174.9668', - 18, - 9, - 'Hf', - 'Hafnium', - '178.49', - 4, - 6, - 'Ta', - 'Tantalum', - '180.94788', - 5, - 6, - 'W', - 'Tungsten', - '183.84', - 6, - 6, - 'Re', - 'Rhenium', - '186.207', - 7, - 6, - 'Os', - 'Osmium', - '190.23', - 8, - 6, - 'Ir', - 'Iridium', - '192.217', - 9, - 6, - 'Pt', - 'Platinum', - '195.084', - 10, - 6, - 'Au', - 'Gold', - '196.966569', - 11, - 6, - 'Hg', - 'Mercury', - '200.59', - 12, - 6, - 'Tl', - 'Thallium', - '204.3833', - 13, - 6, - 'Pb', - 'Lead', - '207.2', - 14, - 6, - 'Bi', - 'Bismuth', - '208.9804', - 15, - 6, - 'Po', - 'Polonium', - '(209)', - 16, - 6, - 'At', - 'Astatine', - '(210)', - 17, - 6, - 'Rn', - 'Radon', - '(222)', - 18, - 6, - 'Fr', - 'Francium', - '(223)', - 1, - 7, - 'Ra', - 'Radium', - '(226)', - 2, - 7, - 'Ac', - 'Actinium', - '(227)', - 4, - 10, - 'Th', - 'Thorium', - '232.03806', - 5, - 10, - 'Pa', - 'Protactinium', - '231.0588', - 6, - 10, - 'U', - 'Uranium', - '238.02891', - 7, - 10, - 'Np', - 'Neptunium', - '(237)', - 8, - 10, - 'Pu', - 'Plutonium', - '(244)', - 9, - 10, - 'Am', - 'Americium', - '(243)', - 10, - 10, - 'Cm', - 'Curium', - '(247)', - 11, - 10, - 'Bk', - 'Berkelium', - '(247)', - 12, - 10, - 'Cf', - 'Californium', - '(251)', - 13, - 10, - 'Es', - 'Einstenium', - '(252)', - 14, - 10, - 'Fm', - 'Fermium', - '(257)', - 15, - 10, - 'Md', - 'Mendelevium', - '(258)', - 16, - 10, - 'No', - 'Nobelium', - '(259)', - 17, - 10, - 'Lr', - 'Lawrencium', - '(262)', - 18, - 10, - 'Rf', - 'Rutherfordium', - '(267)', - 4, - 7, - 'Db', - 'Dubnium', - '(268)', - 5, - 7, - 'Sg', - 'Seaborgium', - '(271)', - 6, - 7, - 'Bh', - 'Bohrium', - '(272)', - 7, - 7, - 'Hs', - 'Hassium', - '(270)', - 8, - 7, - 'Mt', - 'Meitnerium', - '(276)', - 9, - 7, - 'Ds', - 'Darmstadium', - '(281)', - 10, - 7, - 'Rg', - 'Roentgenium', - '(280)', - 11, - 7, - 'Cn', - 'Copernicium', - '(285)', - 12, - 7, - 'Nh', - 'Nihonium', - '(286)', - 13, - 7, - 'Fl', - 'Flerovium', - '(289)', - 14, - 7, - 'Mc', - 'Moscovium', - '(290)', - 15, - 7, - 'Lv', - 'Livermorium', - '(293)', - 16, - 7, - 'Ts', - 'Tennessine', - '(294)', - 17, - 7, - 'Og', - 'Oganesson', - '(294)', - 18, - 7, -]; - -let camera, scene, renderer; -let controls; - -const objects = []; -const targets = { table: [], sphere: [], helix: [], grid: [] }; - -init(); -animate(); - -function init() { - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 3000; - - scene = new THREE.Scene(); - - // table - - for (let i = 0; i < table.length; i += 5) { - const element = document.createElement('div'); - element.className = 'element'; - element.style.backgroundColor = 'rgba(0,127,127,' + (Math.random() * 0.5 + 0.25) + ')'; - - const number = document.createElement('div'); - number.className = 'number'; - number.textContent = i / 5 + 1; - element.appendChild(number); - - const symbol = document.createElement('div'); - symbol.className = 'symbol'; - symbol.textContent = table[i]; - element.appendChild(symbol); - - const details = document.createElement('div'); - details.className = 'details'; - details.innerHTML = table[i + 1] + '
' + table[i + 2]; - element.appendChild(details); - - const objectCSS = new CSS3DObject(element); - objectCSS.position.x = Math.random() * 4000 - 2000; - objectCSS.position.y = Math.random() * 4000 - 2000; - objectCSS.position.z = Math.random() * 4000 - 2000; - scene.add(objectCSS); - - objects.push(objectCSS); - - // - - const object = new THREE.Object3D(); - object.position.x = table[i + 3] * 140 - 1330; - object.position.y = -(table[i + 4] * 180) + 990; - - targets.table.push(object); - } - - // sphere - - const vector = new THREE.Vector3(); - - for (let i = 0, l = objects.length; i < l; i++) { - const phi = Math.acos(-1 + (2 * i) / l); - const theta = Math.sqrt(l * Math.PI) * phi; - - const object = new THREE.Object3D(); - - object.position.setFromSphericalCoords(800, phi, theta); - - vector.copy(object.position).multiplyScalar(2); - - object.lookAt(vector); - - targets.sphere.push(object); - } - - // helix - - for (let i = 0, l = objects.length; i < l; i++) { - const theta = i * 0.175 + Math.PI; - const y = -(i * 8) + 450; - - const object = new THREE.Object3D(); - - object.position.setFromCylindricalCoords(900, theta, y); - - vector.x = object.position.x * 2; - vector.y = object.position.y; - vector.z = object.position.z * 2; - - object.lookAt(vector); - - targets.helix.push(object); - } - - // grid - - for (let i = 0; i < objects.length; i++) { - const object = new THREE.Object3D(); - - object.position.x = (i % 5) * 400 - 800; - object.position.y = -(Math.floor(i / 5) % 5) * 400 + 800; - object.position.z = Math.floor(i / 25) * 1000 - 2000; - - targets.grid.push(object); - } - - // - - renderer = new CSS3DRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - document.getElementById('container').appendChild(renderer.domElement); - - // - - controls = new TrackballControls(camera, renderer.domElement); - controls.minDistance = 500; - controls.maxDistance = 6000; - controls.addEventListener('change', render); - - const buttonTable = document.getElementById('table'); - buttonTable.addEventListener('click', function () { - transform(targets.table, 2000); - }); - - const buttonSphere = document.getElementById('sphere'); - buttonSphere.addEventListener('click', function () { - transform(targets.sphere, 2000); - }); - - const buttonHelix = document.getElementById('helix'); - buttonHelix.addEventListener('click', function () { - transform(targets.helix, 2000); - }); - - const buttonGrid = document.getElementById('grid'); - buttonGrid.addEventListener('click', function () { - transform(targets.grid, 2000); - }); - - transform(targets.table, 2000); - - // - - window.addEventListener('resize', onWindowResize); -} - -function transform(targets, duration) { - TWEEN.removeAll(); - - for (let i = 0; i < objects.length; i++) { - const object = objects[i]; - const target = targets[i]; - - new TWEEN.Tween(object.position) - .to( - { x: target.position.x, y: target.position.y, z: target.position.z }, - Math.random() * duration + duration, - ) - .easing(TWEEN.Easing.Exponential.InOut) - .start(); - - new TWEEN.Tween(object.rotation) - .to( - { x: target.rotation.x, y: target.rotation.y, z: target.rotation.z }, - Math.random() * duration + duration, - ) - .easing(TWEEN.Easing.Exponential.InOut) - .start(); - } - - new TWEEN.Tween(this) - .to({}, duration * 2) - .onUpdate(render) - .start(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function animate() { - requestAnimationFrame(animate); - - TWEEN.update(); - - controls.update(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/css3d_sandbox.ts b/examples-testing/examples/css3d_sandbox.ts deleted file mode 100644 index 1088b84b1..000000000 --- a/examples-testing/examples/css3d_sandbox.ts +++ /dev/null @@ -1,180 +0,0 @@ -import * as THREE from 'three'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer; - -let scene2, renderer2; - -let controls; - -init(); -animate(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(200, 200, 200); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - scene2 = new THREE.Scene(); - - const material = new THREE.MeshBasicMaterial({ - color: 0x000000, - wireframe: true, - wireframeLinewidth: 1, - side: THREE.DoubleSide, - }); - - // - - for (let i = 0; i < 10; i++) { - const element = document.createElement('div'); - element.style.width = '100px'; - element.style.height = '100px'; - element.style.opacity = i < 5 ? 0.5 : 1; - element.style.background = new THREE.Color(Math.random() * 0xffffff).getStyle(); - - const object = new CSS3DObject(element); - object.position.x = Math.random() * 200 - 100; - object.position.y = Math.random() * 200 - 100; - object.position.z = Math.random() * 200 - 100; - object.rotation.x = Math.random(); - object.rotation.y = Math.random(); - object.rotation.z = Math.random(); - object.scale.x = Math.random() + 0.5; - object.scale.y = Math.random() + 0.5; - scene2.add(object); - - const geometry = new THREE.PlaneGeometry(100, 100); - const mesh = new THREE.Mesh(geometry, material); - mesh.position.copy(object.position); - mesh.rotation.copy(object.rotation); - mesh.scale.copy(object.scale); - scene.add(mesh); - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - renderer2 = new CSS3DRenderer(); - renderer2.setSize(window.innerWidth, window.innerHeight); - renderer2.domElement.style.position = 'absolute'; - renderer2.domElement.style.top = 0; - document.body.appendChild(renderer2.domElement); - - controls = new TrackballControls(camera, renderer2.domElement); - - window.addEventListener('resize', onWindowResize); - createPanel(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - renderer2.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - requestAnimationFrame(animate); - - controls.update(); - - renderer.render(scene, camera); - renderer2.render(scene2, camera); -} - -function createPanel() { - const panel = new GUI(); - const folder1 = panel.addFolder('camera setViewOffset').close(); - - const settings = { - setViewOffset() { - folder1.children[1].enable().setValue(window.innerWidth); - folder1.children[2].enable().setValue(window.innerHeight); - folder1.children[3].enable().setValue(0); - folder1.children[4].enable().setValue(0); - folder1.children[5].enable().setValue(window.innerWidth); - folder1.children[6].enable().setValue(window.innerHeight); - }, - fullWidth: 0, - fullHeight: 0, - offsetX: 0, - offsetY: 0, - width: 0, - height: 0, - clearViewOffset() { - folder1.children[1].setValue(0).disable(); - folder1.children[2].setValue(0).disable(); - folder1.children[3].setValue(0).disable(); - folder1.children[4].setValue(0).disable(); - folder1.children[5].setValue(0).disable(); - folder1.children[6].setValue(0).disable(); - camera.clearViewOffset(); - }, - }; - - folder1.add(settings, 'setViewOffset'); - folder1 - .add(settings, 'fullWidth', window.screen.width / 4, window.screen.width * 2, 1) - .onChange(val => updateCameraViewOffset({ fullWidth: val })) - .disable(); - folder1 - .add(settings, 'fullHeight', window.screen.height / 4, window.screen.height * 2, 1) - .onChange(val => updateCameraViewOffset({ fullHeight: val })) - .disable(); - folder1 - .add(settings, 'offsetX', 0, 256, 1) - .onChange(val => updateCameraViewOffset({ x: val })) - .disable(); - folder1 - .add(settings, 'offsetY', 0, 256, 1) - .onChange(val => updateCameraViewOffset({ y: val })) - .disable(); - folder1 - .add(settings, 'width', window.screen.width / 4, window.screen.width * 2, 1) - .onChange(val => updateCameraViewOffset({ width: val })) - .disable(); - folder1 - .add(settings, 'height', window.screen.height / 4, window.screen.height * 2, 1) - .onChange(val => updateCameraViewOffset({ height: val })) - .disable(); - folder1.add(settings, 'clearViewOffset'); -} - -function updateCameraViewOffset({ fullWidth, fullHeight, x, y, width, height }) { - if (!camera.view) { - camera.setViewOffset( - fullWidth || window.innerWidth, - fullHeight || window.innerHeight, - x || 0, - y || 0, - width || window.innerWidth, - height || window.innerHeight, - ); - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - } else { - camera.setViewOffset( - fullWidth || camera.view.fullWidth, - fullHeight || camera.view.fullHeight, - x || camera.view.offsetX, - y || camera.view.offsetY, - width || camera.view.width, - height || camera.view.height, - ); - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - } -} diff --git a/examples-testing/examples/css3d_sprites.ts b/examples-testing/examples/css3d_sprites.ts deleted file mode 100644 index 39c3455a5..000000000 --- a/examples-testing/examples/css3d_sprites.ts +++ /dev/null @@ -1,157 +0,0 @@ -import * as THREE from 'three'; - -import TWEEN from 'three/addons/libs/tween.module.js'; -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { CSS3DRenderer, CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; - -let camera, scene, renderer; -let controls; - -const particlesTotal = 512; -const positions = []; -const objects = []; -let current = 0; - -init(); -animate(); - -function init() { - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.set(600, 400, 1500); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - - const image = document.createElement('img'); - image.addEventListener('load', function () { - for (let i = 0; i < particlesTotal; i++) { - const object = new CSS3DSprite(image.cloneNode()); - ((object.position.x = Math.random() * 4000 - 2000), - (object.position.y = Math.random() * 4000 - 2000), - (object.position.z = Math.random() * 4000 - 2000)); - scene.add(object); - - objects.push(object); - } - - transition(); - }); - image.src = 'textures/sprite.png'; - - // Plane - - const amountX = 16; - const amountZ = 32; - const separationPlane = 150; - const offsetX = ((amountX - 1) * separationPlane) / 2; - const offsetZ = ((amountZ - 1) * separationPlane) / 2; - - for (let i = 0; i < particlesTotal; i++) { - const x = (i % amountX) * separationPlane; - const z = Math.floor(i / amountX) * separationPlane; - const y = (Math.sin(x * 0.5) + Math.sin(z * 0.5)) * 200; - - positions.push(x - offsetX, y, z - offsetZ); - } - - // Cube - - const amount = 8; - const separationCube = 150; - const offset = ((amount - 1) * separationCube) / 2; - - for (let i = 0; i < particlesTotal; i++) { - const x = (i % amount) * separationCube; - const y = Math.floor((i / amount) % amount) * separationCube; - const z = Math.floor(i / (amount * amount)) * separationCube; - - positions.push(x - offset, y - offset, z - offset); - } - - // Random - - for (let i = 0; i < particlesTotal; i++) { - positions.push(Math.random() * 4000 - 2000, Math.random() * 4000 - 2000, Math.random() * 4000 - 2000); - } - - // Sphere - - const radius = 750; - - for (let i = 0; i < particlesTotal; i++) { - const phi = Math.acos(-1 + (2 * i) / particlesTotal); - const theta = Math.sqrt(particlesTotal * Math.PI) * phi; - - positions.push( - radius * Math.cos(theta) * Math.sin(phi), - radius * Math.sin(theta) * Math.sin(phi), - radius * Math.cos(phi), - ); - } - - // - - renderer = new CSS3DRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - document.getElementById('container').appendChild(renderer.domElement); - - // - - controls = new TrackballControls(camera, renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function transition() { - const offset = current * particlesTotal * 3; - const duration = 2000; - - for (let i = 0, j = offset; i < particlesTotal; i++, j += 3) { - const object = objects[i]; - - new TWEEN.Tween(object.position) - .to( - { - x: positions[j], - y: positions[j + 1], - z: positions[j + 2], - }, - Math.random() * duration + duration, - ) - .easing(TWEEN.Easing.Exponential.InOut) - .start(); - } - - new TWEEN.Tween(this) - .to({}, duration * 3) - .onComplete(transition) - .start(); - - current = (current + 1) % 4; -} - -function animate() { - requestAnimationFrame(animate); - - TWEEN.update(); - controls.update(); - - const time = performance.now(); - - for (let i = 0, l = objects.length; i < l; i++) { - const object = objects[i]; - const scale = Math.sin((Math.floor(object.position.x) + time) * 0.002) * 0.3 + 1; - object.scale.set(scale, scale, scale); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/css3d_youtube.ts b/examples-testing/examples/css3d_youtube.ts deleted file mode 100644 index 62652f87f..000000000 --- a/examples-testing/examples/css3d_youtube.ts +++ /dev/null @@ -1,79 +0,0 @@ -import * as THREE from 'three'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { CSS3DRenderer, CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; - -let camera, scene, renderer; -let controls; - -function Element(id, x, y, z, ry) { - const div = document.createElement('div'); - div.style.width = '480px'; - div.style.height = '360px'; - div.style.backgroundColor = '#000'; - - const iframe = document.createElement('iframe'); - iframe.style.width = '480px'; - iframe.style.height = '360px'; - iframe.style.border = '0px'; - iframe.src = ['https://www.youtube.com/embed/', id, '?rel=0'].join(''); - div.appendChild(iframe); - - const object = new CSS3DObject(div); - object.position.set(x, y, z); - object.rotation.y = ry; - - return object; -} - -init(); -animate(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.set(500, 350, 750); - - scene = new THREE.Scene(); - - renderer = new CSS3DRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - container.appendChild(renderer.domElement); - - const group = new THREE.Group(); - group.add(new Element('SJOz3qjfQXU', 0, 0, 240, 0)); - group.add(new Element('Y2-xZ-1HE-Q', 240, 0, 0, Math.PI / 2)); - group.add(new Element('IrydklNpcFI', 0, 0, -240, Math.PI)); - group.add(new Element('9ubytEsCaS0', -240, 0, 0, -Math.PI / 2)); - scene.add(group); - - controls = new TrackballControls(camera, renderer.domElement); - controls.rotateSpeed = 4; - - window.addEventListener('resize', onWindowResize); - - // Block iframe events when dragging camera - - const blocker = document.getElementById('blocker'); - blocker.style.display = 'none'; - - controls.addEventListener('start', function () { - blocker.style.display = ''; - }); - controls.addEventListener('end', function () { - blocker.style.display = 'none'; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - requestAnimationFrame(animate); - controls.update(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/games_fps.ts b/examples-testing/examples/games_fps.ts deleted file mode 100644 index ed08fb5fa..000000000 --- a/examples-testing/examples/games_fps.ts +++ /dev/null @@ -1,377 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Octree } from 'three/addons/math/Octree.js'; -import { OctreeHelper } from 'three/addons/helpers/OctreeHelper.js'; - -import { Capsule } from 'three/addons/math/Capsule.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -const timer = new THREE.Timer(); -timer.connect(document); - -const scene = new THREE.Scene(); -scene.background = new THREE.Color(0x88ccee); -scene.fog = new THREE.Fog(0x88ccee, 0, 50); - -const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 1000); -camera.rotation.order = 'YXZ'; - -const fillLight1 = new THREE.HemisphereLight(0x8dc1de, 0x00668d, 1.5); -fillLight1.position.set(2, 1, 1); -scene.add(fillLight1); - -const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); -directionalLight.position.set(-5, 25, -1); -directionalLight.castShadow = true; -directionalLight.shadow.camera.near = 0.01; -directionalLight.shadow.camera.far = 500; -directionalLight.shadow.camera.right = 30; -directionalLight.shadow.camera.left = -30; -directionalLight.shadow.camera.top = 30; -directionalLight.shadow.camera.bottom = -30; -directionalLight.shadow.mapSize.width = 1024; -directionalLight.shadow.mapSize.height = 1024; -directionalLight.shadow.radius = 4; -directionalLight.shadow.bias = -0.00006; -scene.add(directionalLight); - -const container = document.getElementById('container'); - -const renderer = new THREE.WebGLRenderer({ antialias: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setAnimationLoop(animate); -renderer.shadowMap.enabled = true; -renderer.shadowMap.type = THREE.VSMShadowMap; -renderer.toneMapping = THREE.ACESFilmicToneMapping; -container.appendChild(renderer.domElement); - -const stats = new Stats(); -stats.domElement.style.position = 'absolute'; -stats.domElement.style.top = '0px'; -container.appendChild(stats.domElement); - -const GRAVITY = 30; - -const NUM_SPHERES = 100; -const SPHERE_RADIUS = 0.2; - -const STEPS_PER_FRAME = 5; - -const sphereGeometry = new THREE.IcosahedronGeometry(SPHERE_RADIUS, 5); -const sphereMaterial = new THREE.MeshLambertMaterial({ color: 0xdede8d }); - -const spheres = []; -let sphereIdx = 0; - -for (let i = 0; i < NUM_SPHERES; i++) { - const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); - sphere.castShadow = true; - sphere.receiveShadow = true; - - scene.add(sphere); - - spheres.push({ - mesh: sphere, - collider: new THREE.Sphere(new THREE.Vector3(0, -100, 0), SPHERE_RADIUS), - velocity: new THREE.Vector3(), - }); -} - -const worldOctree = new Octree(); - -const playerCollider = new Capsule(new THREE.Vector3(0, 0.35, 0), new THREE.Vector3(0, 1, 0), 0.35); - -const playerVelocity = new THREE.Vector3(); -const playerDirection = new THREE.Vector3(); - -let playerOnFloor = false; -let mouseTime = 0; - -const keyStates = {}; - -const vector1 = new THREE.Vector3(); -const vector2 = new THREE.Vector3(); -const vector3 = new THREE.Vector3(); - -document.addEventListener('keydown', event => { - keyStates[event.code] = true; -}); - -document.addEventListener('keyup', event => { - keyStates[event.code] = false; -}); - -container.addEventListener('mousedown', () => { - document.body.requestPointerLock(); - - mouseTime = performance.now(); -}); - -document.addEventListener('mouseup', () => { - if (document.pointerLockElement !== null) throwBall(); -}); - -document.body.addEventListener('mousemove', event => { - if (document.pointerLockElement === document.body) { - camera.rotation.y -= event.movementX / 500; - camera.rotation.x -= event.movementY / 500; - } -}); - -window.addEventListener('resize', onWindowResize); - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function throwBall() { - const sphere = spheres[sphereIdx]; - - camera.getWorldDirection(playerDirection); - - sphere.collider.center.copy(playerCollider.end).addScaledVector(playerDirection, playerCollider.radius * 1.5); - - // throw the ball with more force if we hold the button longer, and if we move forward - - const impulse = 15 + 30 * (1 - Math.exp((mouseTime - performance.now()) * 0.001)); - - sphere.velocity.copy(playerDirection).multiplyScalar(impulse); - sphere.velocity.addScaledVector(playerVelocity, 2); - - sphereIdx = (sphereIdx + 1) % spheres.length; -} - -function playerCollisions() { - const result = worldOctree.capsuleIntersect(playerCollider); - - playerOnFloor = false; - - if (result) { - // determine if the surface we bumped into is something we can stand on - - playerOnFloor = result.normal.y >= 0.15; // allow slopes up to ~81° but ignore sheer vertical walls - - if (!playerOnFloor) { - playerVelocity.addScaledVector(result.normal, -result.normal.dot(playerVelocity)); - } - - if (result.depth >= 1e-10) { - playerCollider.translate(result.normal.multiplyScalar(result.depth)); - } - } -} - -function updatePlayer(deltaTime) { - let damping = Math.exp(-4 * deltaTime) - 1; - - if (!playerOnFloor) { - playerVelocity.y -= GRAVITY * deltaTime; - - // small air resistance - damping *= 0.1; - } - - playerVelocity.addScaledVector(playerVelocity, damping); - - const deltaPosition = playerVelocity.clone().multiplyScalar(deltaTime); - playerCollider.translate(deltaPosition); - - playerCollisions(); - - camera.position.copy(playerCollider.end); -} - -function playerSphereCollision(sphere) { - const center = vector1.addVectors(playerCollider.start, playerCollider.end).multiplyScalar(0.5); - - const sphere_center = sphere.collider.center; - - const r = playerCollider.radius + sphere.collider.radius; - const r2 = r * r; - - // approximation: player = 3 spheres - - for (const point of [playerCollider.start, playerCollider.end, center]) { - const d2 = point.distanceToSquared(sphere_center); - - if (d2 < r2) { - const normal = vector1.subVectors(point, sphere_center).normalize(); - const v1 = vector2.copy(normal).multiplyScalar(normal.dot(playerVelocity)); - const v2 = vector3.copy(normal).multiplyScalar(normal.dot(sphere.velocity)); - - playerVelocity.add(v2).sub(v1); - sphere.velocity.add(v1).sub(v2); - - const d = (r - Math.sqrt(d2)) / 2; - sphere_center.addScaledVector(normal, -d); - } - } -} - -function spheresCollisions() { - for (let i = 0, length = spheres.length; i < length; i++) { - const s1 = spheres[i]; - - for (let j = i + 1; j < length; j++) { - const s2 = spheres[j]; - - const d2 = s1.collider.center.distanceToSquared(s2.collider.center); - const r = s1.collider.radius + s2.collider.radius; - const r2 = r * r; - - if (d2 < r2) { - const normal = vector1.subVectors(s1.collider.center, s2.collider.center).normalize(); - const v1 = vector2.copy(normal).multiplyScalar(normal.dot(s1.velocity)); - const v2 = vector3.copy(normal).multiplyScalar(normal.dot(s2.velocity)); - - s1.velocity.add(v2).sub(v1); - s2.velocity.add(v1).sub(v2); - - const d = (r - Math.sqrt(d2)) / 2; - - s1.collider.center.addScaledVector(normal, d); - s2.collider.center.addScaledVector(normal, -d); - } - } - } -} - -function updateSpheres(deltaTime) { - spheres.forEach(sphere => { - sphere.collider.center.addScaledVector(sphere.velocity, deltaTime); - - const result = worldOctree.sphereIntersect(sphere.collider); - - if (result) { - sphere.velocity.addScaledVector(result.normal, -result.normal.dot(sphere.velocity) * 1.5); - sphere.collider.center.add(result.normal.multiplyScalar(result.depth)); - } else { - sphere.velocity.y -= GRAVITY * deltaTime; - } - - const damping = Math.exp(-1.5 * deltaTime) - 1; - sphere.velocity.addScaledVector(sphere.velocity, damping); - - playerSphereCollision(sphere); - }); - - spheresCollisions(); - - for (const sphere of spheres) { - sphere.mesh.position.copy(sphere.collider.center); - } -} - -function getForwardVector() { - camera.getWorldDirection(playerDirection); - playerDirection.y = 0; - playerDirection.normalize(); - - return playerDirection; -} - -function getSideVector() { - camera.getWorldDirection(playerDirection); - playerDirection.y = 0; - playerDirection.normalize(); - playerDirection.cross(camera.up); - - return playerDirection; -} - -function controls(deltaTime) { - // gives a bit of air control - const speedDelta = deltaTime * (playerOnFloor ? 25 : 8); - - if (keyStates['KeyW']) { - playerVelocity.add(getForwardVector().multiplyScalar(speedDelta)); - } - - if (keyStates['KeyS']) { - playerVelocity.add(getForwardVector().multiplyScalar(-speedDelta)); - } - - if (keyStates['KeyA']) { - playerVelocity.add(getSideVector().multiplyScalar(-speedDelta)); - } - - if (keyStates['KeyD']) { - playerVelocity.add(getSideVector().multiplyScalar(speedDelta)); - } - - if (playerOnFloor) { - if (keyStates['Space']) { - playerVelocity.y = 15; - } - } -} - -const loader = new GLTFLoader().setPath('./models/gltf/'); - -loader.load('collision-world.glb', gltf => { - scene.add(gltf.scene); - - worldOctree.fromGraphNode(gltf.scene); - - gltf.scene.traverse(child => { - if (child.isMesh) { - child.castShadow = true; - child.receiveShadow = true; - - if (child.material.map) { - child.material.map.anisotropy = 4; - } - } - }); - - const helper = new OctreeHelper(worldOctree); - helper.visible = false; - scene.add(helper); - - const gui = new GUI({ width: 200 }); - gui.add({ debug: false }, 'debug').onChange(function (value) { - helper.visible = value; - }); -}); - -function teleportPlayerIfOob() { - if (camera.position.y <= -25) { - playerCollider.start.set(0, 0.35, 0); - playerCollider.end.set(0, 1, 0); - playerCollider.radius = 0.35; - camera.position.copy(playerCollider.end); - camera.rotation.set(0, 0, 0); - } -} - -function animate() { - timer.update(); - - const deltaTime = Math.min(0.05, timer.getDelta()) / STEPS_PER_FRAME; - - // we look for collisions in substeps to mitigate the risk of - // an object traversing another too quickly for detection. - - for (let i = 0; i < STEPS_PER_FRAME; i++) { - controls(deltaTime); - - updatePlayer(deltaTime); - - updateSpheres(deltaTime); - - teleportPlayerIfOob(); - } - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/misc_animation_groups.ts b/examples-testing/examples/misc_animation_groups.ts deleted file mode 100644 index 9fed234fc..000000000 --- a/examples-testing/examples/misc_animation_groups.ts +++ /dev/null @@ -1,128 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let stats, timer; -let scene, camera, renderer, mixer; - -init(); - -function init() { - scene = new THREE.Scene(); - - // - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(50, 50, 100); - camera.lookAt(scene.position); - - // all objects of this animation group share a common animation state - - const animationGroup = new THREE.AnimationObjectGroup(); - - // - - const geometry = new THREE.BoxGeometry(5, 5, 5); - const material = new THREE.MeshBasicMaterial({ transparent: true }); - - // - - for (let i = 0; i < 5; i++) { - for (let j = 0; j < 5; j++) { - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = 32 - 16 * i; - mesh.position.y = 0; - mesh.position.z = 32 - 16 * j; - - scene.add(mesh); - animationGroup.add(mesh); - } - } - - // create some keyframe tracks - - const xAxis = new THREE.Vector3(1, 0, 0); - const qInitial = new THREE.Quaternion().setFromAxisAngle(xAxis, 0); - const qFinal = new THREE.Quaternion().setFromAxisAngle(xAxis, Math.PI); - const quaternionKF = new THREE.QuaternionKeyframeTrack( - '.quaternion', - [0, 1, 2], - [ - qInitial.x, - qInitial.y, - qInitial.z, - qInitial.w, - qFinal.x, - qFinal.y, - qFinal.z, - qFinal.w, - qInitial.x, - qInitial.y, - qInitial.z, - qInitial.w, - ], - ); - - const colorKF = new THREE.ColorKeyframeTrack( - '.material.color', - [0, 1, 2], - [1, 0, 0, 0, 1, 0, 0, 0, 1], - THREE.InterpolateDiscrete, - ); - const opacityKF = new THREE.NumberKeyframeTrack('.material.opacity', [0, 1, 2], [1, 0, 1]); - - // create clip - - const clip = new THREE.AnimationClip('default', 3, [quaternionKF, colorKF, opacityKF]); - - // apply the animation group to the mixer as the root object - - mixer = new THREE.AnimationMixer(animationGroup); - - const clipAction = mixer.clipAction(clip); - clipAction.play(); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - timer = new THREE.Timer(); - timer.connect(document); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) { - mixer.update(delta); - } - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/misc_animation_keys.ts b/examples-testing/examples/misc_animation_keys.ts deleted file mode 100644 index 32d497e5a..000000000 --- a/examples-testing/examples/misc_animation_keys.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let stats, timer; -let scene, camera, renderer, mixer; - -init(); - -function init() { - scene = new THREE.Scene(); - - // - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(25, 25, 50); - camera.lookAt(scene.position); - - // - - const axesHelper = new THREE.AxesHelper(10); - scene.add(axesHelper); - - // - - const geometry = new THREE.BoxGeometry(5, 5, 5); - const material = new THREE.MeshBasicMaterial({ color: 0xffffff, transparent: true }); - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // create a keyframe track (i.e. a timed sequence of keyframes) for each animated property - // Note: the keyframe track type should correspond to the type of the property being animated - - // POSITION - const positionKF = new THREE.VectorKeyframeTrack('.position', [0, 1, 2], [0, 0, 0, 30, 0, 0, 0, 0, 0]); - - // SCALE - const scaleKF = new THREE.VectorKeyframeTrack('.scale', [0, 1, 2], [1, 1, 1, 2, 2, 2, 1, 1, 1]); - - // ROTATION - // Rotation should be performed using quaternions, using a THREE.QuaternionKeyframeTrack - // Interpolating Euler angles (.rotation property) can be problematic and is currently not supported - - // set up rotation about x axis - const xAxis = new THREE.Vector3(1, 0, 0); - - const qInitial = new THREE.Quaternion().setFromAxisAngle(xAxis, 0); - const qFinal = new THREE.Quaternion().setFromAxisAngle(xAxis, Math.PI); - const quaternionKF = new THREE.QuaternionKeyframeTrack( - '.quaternion', - [0, 1, 2], - [ - qInitial.x, - qInitial.y, - qInitial.z, - qInitial.w, - qFinal.x, - qFinal.y, - qFinal.z, - qFinal.w, - qInitial.x, - qInitial.y, - qInitial.z, - qInitial.w, - ], - ); - - // COLOR - const colorKF = new THREE.ColorKeyframeTrack( - '.material.color', - [0, 1, 2], - [1, 0, 0, 0, 1, 0, 0, 0, 1], - THREE.InterpolateDiscrete, - ); - - // OPACITY - const opacityKF = new THREE.NumberKeyframeTrack('.material.opacity', [0, 1, 2], [1, 0, 1]); - - // create an animation sequence with the tracks - // If a negative time value is passed, the duration will be calculated from the times of the passed tracks array - const clip = new THREE.AnimationClip('Action', 3, [scaleKF, positionKF, quaternionKF, colorKF, opacityKF]); - - // setup the THREE.AnimationMixer - mixer = new THREE.AnimationMixer(mesh); - - // create a ClipAction and set it to play - const clipAction = mixer.clipAction(clip); - clipAction.play(); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - timer = new THREE.Timer(); - timer.connect(document); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) { - mixer.update(delta); - } - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/misc_boxselection.ts b/examples-testing/examples/misc_boxselection.ts deleted file mode 100644 index e7079c405..000000000 --- a/examples-testing/examples/misc_boxselection.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { SelectionBox } from 'three/addons/interactive/SelectionBox.js'; -import { SelectionHelper } from 'three/addons/interactive/SelectionHelper.js'; - -let container, stats; -let camera, scene, renderer; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 500); - camera.position.z = 50; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - scene.add(new THREE.AmbientLight(0xaaaaaa)); - - const light = new THREE.SpotLight(0xffffff, 10000); - light.position.set(0, 25, 50); - light.angle = Math.PI / 5; - - light.castShadow = true; - light.shadow.camera.near = 10; - light.shadow.camera.far = 100; - light.shadow.mapSize.width = 1024; - light.shadow.mapSize.height = 1024; - - scene.add(light); - - const geometry = new THREE.BoxGeometry(); - - for (let i = 0; i < 200; i++) { - const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); - - object.position.x = Math.random() * 80 - 40; - object.position.y = Math.random() * 45 - 25; - object.position.z = Math.random() * 45 - 25; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.x = Math.random() * 2 + 1; - object.scale.y = Math.random() * 2 + 1; - object.scale.z = Math.random() * 2 + 1; - - object.castShadow = true; - object.receiveShadow = true; - - scene.add(object); - } - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.render(scene, camera); - - stats.update(); -} - -const selectionBox = new SelectionBox(camera, scene); -const helper = new SelectionHelper(renderer, 'selectBox'); - -document.addEventListener('pointerdown', function (event) { - for (const item of selectionBox.collection) { - item.material.emissive.set(0x000000); - } - - selectionBox.startPoint.set( - (event.clientX / window.innerWidth) * 2 - 1, - -(event.clientY / window.innerHeight) * 2 + 1, - 0.5, - ); -}); - -document.addEventListener('pointermove', function (event) { - if (helper.isDown) { - for (let i = 0; i < selectionBox.collection.length; i++) { - selectionBox.collection[i].material.emissive.set(0x000000); - } - - selectionBox.endPoint.set( - (event.clientX / window.innerWidth) * 2 - 1, - -(event.clientY / window.innerHeight) * 2 + 1, - 0.5, - ); - - const allSelected = selectionBox.select(); - - for (let i = 0; i < allSelected.length; i++) { - allSelected[i].material.emissive.set(0xffffff); - } - } -}); - -document.addEventListener('pointerup', function (event) { - selectionBox.endPoint.set( - (event.clientX / window.innerWidth) * 2 - 1, - -(event.clientY / window.innerHeight) * 2 + 1, - 0.5, - ); - - const allSelected = selectionBox.select(); - - for (let i = 0; i < allSelected.length; i++) { - allSelected[i].material.emissive.set(0xffffff); - } -}); diff --git a/examples-testing/examples/misc_controls_arcball.ts b/examples-testing/examples/misc_controls_arcball.ts deleted file mode 100644 index f2611be64..000000000 --- a/examples-testing/examples/misc_controls_arcball.ts +++ /dev/null @@ -1,211 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { ArcballControls } from 'three/addons/controls/ArcballControls.js'; - -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -const cameras = ['Orthographic', 'Perspective']; -const cameraType = { type: 'Perspective' }; - -const perspectiveDistance = 2.5; -const orthographicDistance = 120; -let camera, controls, scene, renderer, gui; -let folderOptions, folderAnimations; - -const arcballGui = { - gizmoVisible: true, - - setArcballControls: function () { - controls = new ArcballControls(camera, renderer.domElement, scene); - controls.addEventListener('change', render); - - this.gizmoVisible = true; - - this.populateGui(); - }, - - populateGui: function () { - folderOptions.add(controls, 'enabled').name('Enable controls'); - folderOptions.add(controls, 'enableFocus').name('Enable focus'); - folderOptions.add(controls, 'enableGrid').name('Enable Grid'); - folderOptions.add(controls, 'enableRotate').name('Enable rotate'); - folderOptions.add(controls, 'enablePan').name('Enable pan'); - folderOptions.add(controls, 'enableZoom').name('Enable zoom'); - folderOptions.add(controls, 'cursorZoom').name('Cursor zoom'); - folderOptions.add(controls, 'adjustNearFar').name('adjust near/far'); - folderOptions.add(controls, 'scaleFactor', 1.1, 10, 0.1).name('Scale factor'); - folderOptions.add(controls, 'minDistance', 0, 50, 0.5).name('Min distance'); - folderOptions.add(controls, 'maxDistance', 0, 50, 0.5).name('Max distance'); - folderOptions.add(controls, 'minZoom', 0, 50, 0.5).name('Min zoom'); - folderOptions.add(controls, 'maxZoom', 0, 50, 0.5).name('Max zoom'); - folderOptions - .add(arcballGui, 'gizmoVisible') - .name('Show gizmos') - .onChange(function () { - controls.setGizmosVisible(arcballGui.gizmoVisible); - }); - folderOptions.add(controls, 'copyState').name('Copy state(ctrl+c)'); - folderOptions.add(controls, 'pasteState').name('Paste state(ctrl+v)'); - folderOptions.add(controls, 'reset').name('Reset'); - folderAnimations.add(controls, 'enableAnimations').name('Enable anim.'); - folderAnimations.add(controls, 'dampingFactor', 0, 100, 1).name('Damping'); - folderAnimations.add(controls, 'wMax', 0, 100, 1).name('Angular spd'); - }, -}; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ReinhardToneMapping; - renderer.toneMappingExposure = 3; - renderer.domElement.style.background = 'linear-gradient( 180deg, rgba( 0,0,0,1 ) 0%, rgba( 128,128,255,1 ) 100% )'; - container.appendChild(renderer.domElement); - - // - - scene = new THREE.Scene(); - - camera = makePerspectiveCamera(); - camera.position.set(0, 0, perspectiveDistance); - - const material = new THREE.MeshStandardMaterial(); - - new OBJLoader().setPath('models/obj/cerberus/').load('Cerberus.obj', function (group) { - const textureLoader = new THREE.TextureLoader().setPath('models/obj/cerberus/'); - - material.roughness = 1; - material.metalness = 1; - - const diffuseMap = textureLoader.load('Cerberus_A.jpg', render); - diffuseMap.colorSpace = THREE.SRGBColorSpace; - material.map = diffuseMap; - - material.metalnessMap = material.roughnessMap = textureLoader.load('Cerberus_RM.jpg', render); - material.normalMap = textureLoader.load('Cerberus_N.jpg', render); - - material.map.wrapS = THREE.RepeatWrapping; - material.roughnessMap.wrapS = THREE.RepeatWrapping; - material.metalnessMap.wrapS = THREE.RepeatWrapping; - material.normalMap.wrapS = THREE.RepeatWrapping; - - group.traverse(function (child) { - if (child.isMesh) { - child.material = material; - } - }); - - group.rotation.y = Math.PI / 2; - group.position.x += 0.25; - scene.add(group); - render(); - - new HDRLoader().setPath('textures/equirectangular/').load('venice_sunset_1k.hdr', function (hdrEquirect) { - hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; - - scene.environment = hdrEquirect; - - render(); - }); - - window.addEventListener('keydown', onKeyDown); - window.addEventListener('resize', onWindowResize); - - // - - gui = new GUI(); - gui.add(cameraType, 'type', cameras) - .name('Choose Camera') - .onChange(function () { - setCamera(cameraType.type); - }); - - folderOptions = gui.addFolder('Arcball parameters'); - folderAnimations = folderOptions.addFolder('Animations'); - - arcballGui.setArcballControls(); - - render(); - }); -} - -function makeOrthographicCamera() { - const halfFovV = THREE.MathUtils.DEG2RAD * 45 * 0.5; - const halfFovH = Math.atan((window.innerWidth / window.innerHeight) * Math.tan(halfFovV)); - - const halfW = perspectiveDistance * Math.tan(halfFovH); - const halfH = perspectiveDistance * Math.tan(halfFovV); - const near = 0.01; - const far = 2000; - const newCamera = new THREE.OrthographicCamera(-halfW, halfW, halfH, -halfH, near, far); - return newCamera; -} - -function makePerspectiveCamera() { - const fov = 45; - const aspect = window.innerWidth / window.innerHeight; - const near = 0.01; - const far = 2000; - const newCamera = new THREE.PerspectiveCamera(fov, aspect, near, far); - return newCamera; -} - -function onWindowResize() { - if (camera.type == 'OrthographicCamera') { - const halfFovV = THREE.MathUtils.DEG2RAD * 45 * 0.5; - const halfFovH = Math.atan((window.innerWidth / window.innerHeight) * Math.tan(halfFovV)); - - const halfW = perspectiveDistance * Math.tan(halfFovH); - const halfH = perspectiveDistance * Math.tan(halfFovV); - camera.left = -halfW; - camera.right = halfW; - camera.top = halfH; - camera.bottom = -halfH; - } else if (camera.type == 'PerspectiveCamera') { - camera.aspect = window.innerWidth / window.innerHeight; - } - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} - -function onKeyDown(event) { - if (event.key === 'c') { - if (event.ctrlKey || event.metaKey) { - controls.copyState(); - } - } else if (event.key === 'v') { - if (event.ctrlKey || event.metaKey) { - controls.pasteState(); - } - } -} - -function setCamera(type) { - if (type == 'Orthographic') { - camera = makeOrthographicCamera(); - camera.position.set(0, 0, orthographicDistance); - } else if (type == 'Perspective') { - camera = makePerspectiveCamera(); - camera.position.set(0, 0, perspectiveDistance); - } - - controls.setCamera(camera); - - render(); -} diff --git a/examples-testing/examples/misc_controls_drag.ts b/examples-testing/examples/misc_controls_drag.ts deleted file mode 100644 index b12b0421e..000000000 --- a/examples-testing/examples/misc_controls_drag.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as THREE from 'three'; - -import { DragControls } from 'three/addons/controls/DragControls.js'; - -let container; -let camera, scene, renderer; -let controls, group; -let enableSelection = false; - -const objects = []; - -const mouse = new THREE.Vector2(), - raycaster = new THREE.Raycaster(); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 500); - camera.position.z = 25; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - scene.add(new THREE.AmbientLight(0xaaaaaa)); - - const light = new THREE.SpotLight(0xffffff, 10000); - light.position.set(0, 25, 50); - light.angle = Math.PI / 9; - - light.castShadow = true; - light.shadow.camera.near = 10; - light.shadow.camera.far = 100; - light.shadow.mapSize.width = 1024; - light.shadow.mapSize.height = 1024; - - scene.add(light); - - group = new THREE.Group(); - scene.add(group); - - const geometry = new THREE.BoxGeometry(); - - for (let i = 0; i < 200; i++) { - const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); - - object.position.x = Math.random() * 30 - 15; - object.position.y = Math.random() * 15 - 7.5; - object.position.z = Math.random() * 20 - 10; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.x = Math.random() * 2 + 1; - object.scale.y = Math.random() * 2 + 1; - object.scale.z = Math.random() * 2 + 1; - - object.castShadow = true; - object.receiveShadow = true; - - scene.add(object); - - objects.push(object); - } - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - - container.appendChild(renderer.domElement); - - controls = new DragControls([...objects], camera, renderer.domElement); - controls.rotateSpeed = 2; - controls.addEventListener('drag', render); - - // - - window.addEventListener('resize', onWindowResize); - - document.addEventListener('click', onClick); - window.addEventListener('keydown', onKeyDown); - window.addEventListener('keyup', onKeyUp); - - render(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function onKeyDown(event) { - enableSelection = event.keyCode === 16 ? true : false; - - if (event.keyCode === 77) { - controls.touches.ONE = controls.touches.ONE === THREE.TOUCH.PAN ? THREE.TOUCH.ROTATE : THREE.TOUCH.PAN; - } -} - -function onKeyUp() { - enableSelection = false; -} - -function onClick(event) { - event.preventDefault(); - - if (enableSelection === true) { - const draggableObjects = controls.objects; - draggableObjects.length = 0; - - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; - - raycaster.setFromCamera(mouse, camera); - - const intersections = raycaster.intersectObjects(objects, true); - - if (intersections.length > 0) { - const object = intersections[0].object; - - if (group.children.includes(object) === true) { - object.material.emissive.set(0x000000); - scene.attach(object); - } else { - object.material.emissive.set(0xaaaaaa); - group.attach(object); - } - - controls.transformGroup = true; - draggableObjects.push(group); - } - - if (group.children.length === 0) { - controls.transformGroup = false; - draggableObjects.push(...objects); - } - } - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/misc_controls_fly.ts b/examples-testing/examples/misc_controls_fly.ts deleted file mode 100644 index b47be6f1d..000000000 --- a/examples-testing/examples/misc_controls_fly.ts +++ /dev/null @@ -1,219 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; -import { film } from 'three/addons/tsl/display/FilmNode.js'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { FlyControls } from 'three/addons/controls/FlyControls.js'; - -const radius = 6371; -const tilt = 0.41; -const rotationSpeed = 0.02; - -const cloudsScale = 1.005; -const moonScale = 0.23; - -const MARGIN = 0; -let SCREEN_HEIGHT = window.innerHeight - MARGIN * 2; -let SCREEN_WIDTH = window.innerWidth; - -let camera, controls, scene, renderer, stats; -let geometry, meshPlanet, meshClouds, meshMoon; -let dirLight; - -let renderPipeline; - -const textureLoader = new THREE.TextureLoader(); - -let d, dPlanet, dMoon; -const dMoonVec = new THREE.Vector3(); - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(25, SCREEN_WIDTH / SCREEN_HEIGHT, 50, 1e7); - camera.position.z = radius * 5; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - scene.fog = new THREE.FogExp2(0x000000, 0.00000025); - - dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(-1, 0, 1).normalize(); - scene.add(dirLight); - - const materialNormalMap = new THREE.MeshPhongMaterial({ - specular: 0x7c7c7c, - shininess: 15, - map: textureLoader.load('textures/planets/earth_atmos_2048.jpg'), - specularMap: textureLoader.load('textures/planets/earth_specular_2048.jpg'), - normalMap: textureLoader.load('textures/planets/earth_normal_2048.jpg'), - - // y scale is negated to compensate for normal map handedness. - normalScale: new THREE.Vector2(0.85, -0.85), - }); - materialNormalMap.map.colorSpace = THREE.SRGBColorSpace; - - // planet - - geometry = new THREE.SphereGeometry(radius, 100, 50); - - meshPlanet = new THREE.Mesh(geometry, materialNormalMap); - meshPlanet.rotation.y = 0; - meshPlanet.rotation.z = tilt; - scene.add(meshPlanet); - - // clouds - - const materialClouds = new THREE.MeshLambertMaterial({ - map: textureLoader.load('textures/planets/earth_clouds_1024.png'), - transparent: true, - }); - materialClouds.map.colorSpace = THREE.SRGBColorSpace; - - meshClouds = new THREE.Mesh(geometry, materialClouds); - meshClouds.scale.set(cloudsScale, cloudsScale, cloudsScale); - meshClouds.rotation.z = tilt; - scene.add(meshClouds); - - // moon - - const materialMoon = new THREE.MeshPhongMaterial({ - map: textureLoader.load('textures/planets/moon_1024.jpg'), - }); - materialMoon.map.colorSpace = THREE.SRGBColorSpace; - - meshMoon = new THREE.Mesh(geometry, materialMoon); - meshMoon.position.set(radius * 5, 0, 0); - meshMoon.scale.set(moonScale, moonScale, moonScale); - scene.add(meshMoon); - - // stars - - const r = radius, - starsGeometry = [new THREE.BufferGeometry(), new THREE.BufferGeometry()]; - - const vertices1 = []; - const vertices2 = []; - - const vertex = new THREE.Vector3(); - - for (let i = 0; i < 250; i++) { - vertex.x = Math.random() * 2 - 1; - vertex.y = Math.random() * 2 - 1; - vertex.z = Math.random() * 2 - 1; - vertex.multiplyScalar(r); - - vertices1.push(vertex.x, vertex.y, vertex.z); - } - - for (let i = 0; i < 1500; i++) { - vertex.x = Math.random() * 2 - 1; - vertex.y = Math.random() * 2 - 1; - vertex.z = Math.random() * 2 - 1; - vertex.multiplyScalar(r); - - vertices2.push(vertex.x, vertex.y, vertex.z); - } - - starsGeometry[0].setAttribute('position', new THREE.Float32BufferAttribute(vertices1, 3)); - starsGeometry[1].setAttribute('position', new THREE.Float32BufferAttribute(vertices2, 3)); - - const starsMaterials = [ - new THREE.PointsMaterial({ color: 0x9c9c9c }), - new THREE.PointsMaterial({ color: 0x838383 }), - new THREE.PointsMaterial({ color: 0x5a5a5a }), - ]; - - for (let i = 10; i < 30; i++) { - const stars = new THREE.Points(starsGeometry[i % 2], starsMaterials[i % 3]); - - stars.rotation.x = Math.random() * 6; - stars.rotation.y = Math.random() * 6; - stars.rotation.z = Math.random() * 6; - stars.scale.setScalar(i * 10); - - stars.matrixAutoUpdate = false; - stars.updateMatrix(); - - scene.add(stars); - } - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - controls = new FlyControls(camera, renderer.domElement); - - controls.movementSpeed = 1000; - controls.domElement = renderer.domElement; - controls.rollSpeed = Math.PI / 24; - controls.autoForward = false; - controls.dragToLook = false; - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode(); - - renderPipeline.outputNode = film(scenePassColor); -} - -function onWindowResize() { - SCREEN_HEIGHT = window.innerHeight; - SCREEN_WIDTH = window.innerWidth; - - camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - camera.updateProjectionMatrix(); - - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); -} - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - // rotate the planet and clouds - - const delta = timer.getDelta(); - - meshPlanet.rotation.y += rotationSpeed * delta; - meshClouds.rotation.y += 1.25 * rotationSpeed * delta; - - // slow down as we approach the surface - - dPlanet = camera.position.length(); - - dMoonVec.subVectors(camera.position, meshMoon.position); - dMoon = dMoonVec.length(); - - if (dMoon < dPlanet) { - d = dMoon - radius * moonScale * 1.01; - } else { - d = dPlanet - radius * 1.01; - } - - controls.movementSpeed = 0.33 * d; - controls.update(delta); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/misc_controls_map.ts b/examples-testing/examples/misc_controls_map.ts deleted file mode 100644 index 9c7af0cda..000000000 --- a/examples-testing/examples/misc_controls_map.ts +++ /dev/null @@ -1,102 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { MapControls } from 'three/addons/controls/MapControls.js'; - -let camera, controls, scene, renderer; - -init(); -//render(); // remove when using animation loop - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xcccccc); - scene.fog = new THREE.FogExp2(0xcccccc, 0.002); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 200, -200); - - // controls - - controls = new MapControls(camera, renderer.domElement); - - //controls.addEventListener( 'change', render ); // call this only in static scenes (i.e., if there is no animation loop) - - controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled - controls.dampingFactor = 0.05; - - controls.screenSpacePanning = false; - - controls.minDistance = 100; - controls.maxDistance = 500; - - controls.maxPolarAngle = Math.PI / 2; - - // world - - const geometry = new THREE.BoxGeometry(); - geometry.translate(0, 0.5, 0); - const material = new THREE.MeshPhongMaterial({ color: 0xeeeeee, flatShading: true }); - - const mesh = new THREE.InstancedMesh(geometry, material, 500); - const dummy = new THREE.Object3D(); - - for (let i = 0; i < 500; i++) { - dummy.position.x = Math.random() * 1600 - 800; - dummy.position.y = 0; - dummy.position.z = Math.random() * 1600 - 800; - dummy.scale.x = 20; - dummy.scale.y = Math.random() * 80 + 10; - dummy.scale.z = 20; - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - } - - scene.add(mesh); - - // lights - - const dirLight1 = new THREE.DirectionalLight(0xffffff, 3); - dirLight1.position.set(1, 1, 1); - scene.add(dirLight1); - - const dirLight2 = new THREE.DirectionalLight(0x002288, 3); - dirLight2.position.set(-1, -1, -1); - scene.add(dirLight2); - - const ambientLight = new THREE.AmbientLight(0x555555); - scene.add(ambientLight); - - // - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - gui.add(controls, 'zoomToCursor'); - gui.add(controls, 'screenSpacePanning'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); // only required if controls.enableDamping = true, or if controls.autoRotate = true - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/misc_controls_orbit.ts b/examples-testing/examples/misc_controls_orbit.ts deleted file mode 100644 index 7d2ec2626..000000000 --- a/examples-testing/examples/misc_controls_orbit.ts +++ /dev/null @@ -1,95 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, controls, scene, renderer; - -init(); -//render(); // remove when using animation loop - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xcccccc); - scene.fog = new THREE.FogExp2(0xcccccc, 0.002); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(400, 200, 0); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.listenToKeyEvents(window); // optional - - //controls.addEventListener( 'change', render ); // call this only in static scenes (i.e., if there is no animation loop) - - controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled - controls.dampingFactor = 0.05; - - controls.screenSpacePanning = false; - - controls.minDistance = 100; - controls.maxDistance = 500; - - controls.cursorStyle = 'grab'; - - controls.maxPolarAngle = Math.PI / 2; - - // world - - const geometry = new THREE.ConeGeometry(10, 30, 4, 1); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); - - const mesh = new THREE.InstancedMesh(geometry, material, 500); - const dummy = new THREE.Object3D(); - - for (let i = 0; i < 500; i++) { - dummy.position.x = Math.random() * 1600 - 800; - dummy.position.y = 0; - dummy.position.z = Math.random() * 1600 - 800; - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - } - - scene.add(mesh); - - // lights - - const dirLight1 = new THREE.DirectionalLight(0xffffff, 3); - dirLight1.position.set(1, 1, 1); - scene.add(dirLight1); - - const dirLight2 = new THREE.DirectionalLight(0x002288, 3); - dirLight2.position.set(-1, -1, -1); - scene.add(dirLight2); - - const ambientLight = new THREE.AmbientLight(0x555555); - scene.add(ambientLight); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); // only required if controls.enableDamping = true, or if controls.autoRotate = true - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/misc_controls_pointerlock.ts b/examples-testing/examples/misc_controls_pointerlock.ts deleted file mode 100644 index 0b6fcc516..000000000 --- a/examples-testing/examples/misc_controls_pointerlock.ts +++ /dev/null @@ -1,245 +0,0 @@ -import * as THREE from 'three'; - -import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js'; - -let camera, scene, renderer, controls; - -const objects = []; - -let raycaster; - -let moveForward = false; -let moveBackward = false; -let moveLeft = false; -let moveRight = false; -let canJump = false; - -let prevTime = performance.now(); -const velocity = new THREE.Vector3(); -const direction = new THREE.Vector3(); -const vertex = new THREE.Vector3(); -const color = new THREE.Color(); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.y = 10; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - scene.fog = new THREE.Fog(0xffffff, 0, 750); - - const light = new THREE.HemisphereLight(0xeeeeff, 0x777788, 2.5); - light.position.set(0.5, 1, 0.75); - scene.add(light); - - controls = new PointerLockControls(camera, document.body); - - const blocker = document.getElementById('blocker'); - const instructions = document.getElementById('instructions'); - - instructions.addEventListener('click', function () { - controls.lock(); - }); - - controls.addEventListener('lock', function () { - instructions.style.display = 'none'; - blocker.style.display = 'none'; - }); - - controls.addEventListener('unlock', function () { - blocker.style.display = 'block'; - instructions.style.display = ''; - }); - - scene.add(controls.object); - - const onKeyDown = function (event) { - switch (event.code) { - case 'ArrowUp': - case 'KeyW': - moveForward = true; - break; - - case 'ArrowLeft': - case 'KeyA': - moveLeft = true; - break; - - case 'ArrowDown': - case 'KeyS': - moveBackward = true; - break; - - case 'ArrowRight': - case 'KeyD': - moveRight = true; - break; - - case 'Space': - if (canJump === true) velocity.y += 350; - canJump = false; - break; - } - }; - - const onKeyUp = function (event) { - switch (event.code) { - case 'ArrowUp': - case 'KeyW': - moveForward = false; - break; - - case 'ArrowLeft': - case 'KeyA': - moveLeft = false; - break; - - case 'ArrowDown': - case 'KeyS': - moveBackward = false; - break; - - case 'ArrowRight': - case 'KeyD': - moveRight = false; - break; - } - }; - - document.addEventListener('keydown', onKeyDown); - document.addEventListener('keyup', onKeyUp); - - raycaster = new THREE.Raycaster(new THREE.Vector3(), new THREE.Vector3(0, -1, 0), 0, 10); - - // floor - - let floorGeometry = new THREE.PlaneGeometry(2000, 2000, 100, 100); - floorGeometry.rotateX(-Math.PI / 2); - - // vertex displacement - - let position = floorGeometry.attributes.position; - - for (let i = 0, l = position.count; i < l; i++) { - vertex.fromBufferAttribute(position, i); - - vertex.x += Math.random() * 20 - 10; - vertex.y += Math.random() * 2; - vertex.z += Math.random() * 20 - 10; - - position.setXYZ(i, vertex.x, vertex.y, vertex.z); - } - - floorGeometry = floorGeometry.toNonIndexed(); // ensure each face has unique vertices - - position = floorGeometry.attributes.position; - const colorsFloor = []; - - for (let i = 0, l = position.count; i < l; i++) { - color.setHSL(Math.random() * 0.3 + 0.5, 0.75, Math.random() * 0.25 + 0.75, THREE.SRGBColorSpace); - colorsFloor.push(color.r, color.g, color.b); - } - - floorGeometry.setAttribute('color', new THREE.Float32BufferAttribute(colorsFloor, 3)); - - const floorMaterial = new THREE.MeshBasicMaterial({ vertexColors: true }); - - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - scene.add(floor); - - // objects - - const boxGeometry = new THREE.BoxGeometry(20, 20, 20).toNonIndexed(); - - position = boxGeometry.attributes.position; - const colorsBox = []; - - for (let i = 0, l = position.count; i < l; i++) { - color.setHSL(Math.random() * 0.3 + 0.5, 0.75, Math.random() * 0.25 + 0.75, THREE.SRGBColorSpace); - colorsBox.push(color.r, color.g, color.b); - } - - boxGeometry.setAttribute('color', new THREE.Float32BufferAttribute(colorsBox, 3)); - - for (let i = 0; i < 500; i++) { - const boxMaterial = new THREE.MeshPhongMaterial({ specular: 0xffffff, flatShading: true, vertexColors: true }); - boxMaterial.color.setHSL(Math.random() * 0.2 + 0.5, 0.75, Math.random() * 0.25 + 0.75, THREE.SRGBColorSpace); - - const box = new THREE.Mesh(boxGeometry, boxMaterial); - box.position.x = Math.floor(Math.random() * 20 - 10) * 20; - box.position.y = Math.floor(Math.random() * 20) * 20 + 10; - box.position.z = Math.floor(Math.random() * 20 - 10) * 20; - - scene.add(box); - objects.push(box); - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now(); - - if (controls.isLocked === true) { - raycaster.ray.origin.copy(controls.object.position); - raycaster.ray.origin.y -= 10; - - const intersections = raycaster.intersectObjects(objects, false); - - const onObject = intersections.length > 0; - - const delta = (time - prevTime) / 1000; - - velocity.x -= velocity.x * 10.0 * delta; - velocity.z -= velocity.z * 10.0 * delta; - - velocity.y -= 9.8 * 100.0 * delta; // 100.0 = mass - - direction.z = Number(moveForward) - Number(moveBackward); - direction.x = Number(moveRight) - Number(moveLeft); - direction.normalize(); // this ensures consistent movements in all directions - - if (moveForward || moveBackward) velocity.z -= direction.z * 400.0 * delta; - if (moveLeft || moveRight) velocity.x -= direction.x * 400.0 * delta; - - if (onObject === true) { - velocity.y = Math.max(0, velocity.y); - canJump = true; - } - - controls.moveRight(-velocity.x * delta); - controls.moveForward(-velocity.z * delta); - - controls.object.position.y += velocity.y * delta; // new behavior - - if (controls.object.position.y < 10) { - velocity.y = 0; - controls.object.position.y = 10; - - canJump = true; - } - } - - prevTime = time; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/misc_controls_trackball.ts b/examples-testing/examples/misc_controls_trackball.ts deleted file mode 100644 index da24a8e8d..000000000 --- a/examples-testing/examples/misc_controls_trackball.ts +++ /dev/null @@ -1,147 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; - -let perspectiveCamera, orthographicCamera, controls, scene, renderer, stats; - -const params = { - orthographicCamera: false, - multiTouchRoll: false, -}; - -const frustumSize = 400; - -init(); - -function init() { - const aspect = window.innerWidth / window.innerHeight; - - perspectiveCamera = new THREE.PerspectiveCamera(60, aspect, 1, 1000); - perspectiveCamera.position.z = 500; - - orthographicCamera = new THREE.OrthographicCamera( - (frustumSize * aspect) / -2, - (frustumSize * aspect) / 2, - frustumSize / 2, - frustumSize / -2, - 1, - 1000, - ); - orthographicCamera.position.z = 500; - - // world - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xcccccc); - scene.fog = new THREE.FogExp2(0xcccccc, 0.002); - - const geometry = new THREE.ConeGeometry(10, 30, 4, 1); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); - - const mesh = new THREE.InstancedMesh(geometry, material, 500); - const dummy = new THREE.Object3D(); - - for (let i = 0; i < 500; i++) { - dummy.position.x = (Math.random() - 0.5) * 1000; - dummy.position.y = (Math.random() - 0.5) * 1000; - dummy.position.z = (Math.random() - 0.5) * 1000; - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - } - - scene.add(mesh); - - // lights - - const dirLight1 = new THREE.DirectionalLight(0xffffff, 3); - dirLight1.position.set(1, 1, 1); - scene.add(dirLight1); - - const dirLight2 = new THREE.DirectionalLight(0x002288, 3); - dirLight2.position.set(-1, -1, -1); - scene.add(dirLight2); - - const ambientLight = new THREE.AmbientLight(0x555555); - scene.add(ambientLight); - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - const gui = new GUI(); - gui.add(params, 'orthographicCamera') - .name('use orthographic') - .onChange(function (value) { - controls.dispose(); - - createControls(value ? orthographicCamera : perspectiveCamera); - }); - - gui.add(params, 'multiTouchRoll') - .name('multi touch roll') - .onChange(function (value) { - controls.multiTouchRoll = value; - }); - - // - - window.addEventListener('resize', onWindowResize); - - createControls(perspectiveCamera); -} - -function createControls(camera) { - controls = new TrackballControls(camera, renderer.domElement); - - controls.rotateSpeed = 1.0; - controls.zoomSpeed = 1.2; - controls.panSpeed = 0.8; - - controls.multiTouchRoll = params.multiTouchRoll; - - controls.keys = ['KeyA', 'KeyS', 'KeyD']; -} - -function onWindowResize() { - const aspect = window.innerWidth / window.innerHeight; - - perspectiveCamera.aspect = aspect; - perspectiveCamera.updateProjectionMatrix(); - - orthographicCamera.left = (-frustumSize * aspect) / 2; - orthographicCamera.right = (frustumSize * aspect) / 2; - orthographicCamera.top = frustumSize / 2; - orthographicCamera.bottom = -frustumSize / 2; - orthographicCamera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - controls.handleResize(); -} - -function animate() { - controls.update(); - - render(); - - stats.update(); -} - -function render() { - const camera = params.orthographicCamera ? orthographicCamera : perspectiveCamera; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/misc_controls_transform.ts b/examples-testing/examples/misc_controls_transform.ts deleted file mode 100644 index 6f7793d33..000000000 --- a/examples-testing/examples/misc_controls_transform.ts +++ /dev/null @@ -1,182 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TransformControls } from 'three/addons/controls/TransformControls.js'; - -let cameraPersp, cameraOrtho, currentCamera; -let scene, renderer, control, orbit; - -init(); -render(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - const aspect = window.innerWidth / window.innerHeight; - - const frustumSize = 5; - - cameraPersp = new THREE.PerspectiveCamera(50, aspect, 0.1, 100); - cameraOrtho = new THREE.OrthographicCamera( - -frustumSize * aspect, - frustumSize * aspect, - frustumSize, - -frustumSize, - 0.1, - 100, - ); - currentCamera = cameraPersp; - - currentCamera.position.set(5, 2.5, 5); - - scene = new THREE.Scene(); - scene.add(new THREE.GridHelper(5, 10, 0x888888, 0x444444)); - - const ambientLight = new THREE.AmbientLight(0xffffff); - scene.add(ambientLight); - - const light = new THREE.DirectionalLight(0xffffff, 4); - light.position.set(1, 1, 1); - scene.add(light); - - const texture = new THREE.TextureLoader().load('textures/crate.gif', render); - texture.colorSpace = THREE.SRGBColorSpace; - texture.anisotropy = renderer.capabilities.getMaxAnisotropy(); - - const geometry = new THREE.BoxGeometry(); - const material = new THREE.MeshLambertMaterial({ map: texture }); - - orbit = new OrbitControls(currentCamera, renderer.domElement); - orbit.update(); - orbit.addEventListener('change', render); - - control = new TransformControls(currentCamera, renderer.domElement); - control.addEventListener('change', render); - control.addEventListener('dragging-changed', function (event) { - orbit.enabled = !event.value; - }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - control.attach(mesh); - - const gizmo = control.getHelper(); - scene.add(gizmo); - - window.addEventListener('resize', onWindowResize); - - window.addEventListener('keydown', function (event) { - switch (event.key) { - case 'q': - control.setSpace(control.space === 'local' ? 'world' : 'local'); - break; - - case 'Shift': - control.setTranslationSnap(1); - control.setRotationSnap(THREE.MathUtils.degToRad(15)); - control.setScaleSnap(0.25); - break; - - case 'w': - control.setMode('translate'); - break; - - case 'e': - control.setMode('rotate'); - break; - - case 'r': - control.setMode('scale'); - break; - - case 'c': - const position = currentCamera.position.clone(); - - currentCamera = currentCamera.isPerspectiveCamera ? cameraOrtho : cameraPersp; - currentCamera.position.copy(position); - - orbit.object = currentCamera; - control.camera = currentCamera; - - currentCamera.lookAt(orbit.target.x, orbit.target.y, orbit.target.z); - onWindowResize(); - break; - - case 'v': - const randomFoV = Math.random() + 0.1; - const randomZoom = Math.random() + 0.1; - - cameraPersp.fov = randomFoV * 160; - cameraOrtho.bottom = -randomFoV * 500; - cameraOrtho.top = randomFoV * 500; - - cameraPersp.zoom = randomZoom * 5; - cameraOrtho.zoom = randomZoom * 5; - onWindowResize(); - break; - - case '+': - case '=': - control.setSize(control.size + 0.1); - break; - - case '-': - case '_': - control.setSize(Math.max(control.size - 0.1, 0.1)); - break; - - case 'x': - control.showX = !control.showX; - break; - - case 'y': - control.showY = !control.showY; - break; - - case 'z': - control.showZ = !control.showZ; - break; - - case ' ': - control.enabled = !control.enabled; - break; - - case 'Escape': - control.reset(); - break; - } - }); - - window.addEventListener('keyup', function (event) { - switch (event.key) { - case 'Shift': - control.setTranslationSnap(null); - control.setRotationSnap(null); - control.setScaleSnap(null); - break; - } - }); -} - -function onWindowResize() { - const aspect = window.innerWidth / window.innerHeight; - - cameraPersp.aspect = aspect; - cameraPersp.updateProjectionMatrix(); - - cameraOrtho.left = cameraOrtho.bottom * aspect; - cameraOrtho.right = cameraOrtho.top * aspect; - cameraOrtho.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, currentCamera); -} diff --git a/examples-testing/examples/misc_exporter_draco.ts b/examples-testing/examples/misc_exporter_draco.ts deleted file mode 100644 index 4d1398eaa..000000000 --- a/examples-testing/examples/misc_exporter_draco.ts +++ /dev/null @@ -1,117 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer, exporter, mesh; - -const params = { - export: exportFile, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(4, 2, 4); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 4, 20); - - exporter = new DRACOExporter(); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 3); - hemiLight.position.set(0, 20, 0); - scene.add(hemiLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 3); - directionalLight.position.set(0, 20, 10); - directionalLight.castShadow = true; - directionalLight.shadow.camera.top = 2; - directionalLight.shadow.camera.bottom = -2; - directionalLight.shadow.camera.left = -2; - directionalLight.shadow.camera.right = 2; - scene.add(directionalLight); - - // ground - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(40, 40), - new THREE.MeshPhongMaterial({ color: 0xbbbbbb, depthWrite: false }), - ); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - const grid = new THREE.GridHelper(40, 20, 0x000000, 0x000000); - grid.material.opacity = 0.2; - grid.material.transparent = true; - scene.add(grid); - - // export mesh - - const geometry = new THREE.TorusKnotGeometry(0.75, 0.2, 200, 30); - const material = new THREE.MeshPhongMaterial({ color: 0x00ff00 }); - mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - mesh.position.y = 1.5; - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1.5, 0); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'export').name('Export DRC'); - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} - -async function exportFile() { - const result = await exporter.parseAsync(mesh); - saveArrayBuffer(result, 'file.drc'); -} - -const link = document.createElement('a'); -link.style.display = 'none'; -document.body.appendChild(link); - -function save(blob, filename) { - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); -} - -function saveArrayBuffer(buffer, filename) { - save(new Blob([buffer], { type: 'application/octet-stream' }), filename); -} diff --git a/examples-testing/examples/misc_exporter_exr.ts b/examples-testing/examples/misc_exporter_exr.ts deleted file mode 100644 index 014ea58a0..000000000 --- a/examples-testing/examples/misc_exporter_exr.ts +++ /dev/null @@ -1,158 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { EXRExporter, ZIP_COMPRESSION, ZIPS_COMPRESSION, NO_COMPRESSION } from 'three/addons/exporters/EXRExporter.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer, exporter, mesh, controls, renderTarget, dataTexture; - -const params = { - target: 'pmrem', - type: 'HalfFloatType', - compression: 'ZIP', - export: exportFile, -}; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(10, 0, 0); - - scene = new THREE.Scene(); - - exporter = new EXRExporter(); - const hdrLoader = new HDRLoader(); - - // - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - pmremGenerator.compileEquirectangularShader(); - - hdrLoader.load('textures/equirectangular/san_giuseppe_bridge_2k.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - renderTarget = pmremGenerator.fromEquirectangular(texture); - scene.background = renderTarget.texture; - }); - - createDataTexture(); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.rotateSpeed = -0.25; // negative, to track mouse pointer - - // - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - const input = gui.addFolder('Input'); - input.add(params, 'target').options(['pmrem', 'data-texture']).onChange(swapScene); - - const options = gui.addFolder('Output Options'); - options.add(params, 'type').options(['FloatType', 'HalfFloatType']); - options.add(params, 'compression').options(['ZIP', 'ZIPS', 'NONE']); - - gui.add(params, 'export').name('Export EXR'); - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - renderer.render(scene, camera); -} - -function createDataTexture() { - const normal = new THREE.Vector3(); - const coord = new THREE.Vector2(); - const size = 800, - radius = 320, - factor = (Math.PI * 0.5) / radius; - const data = new Float32Array(4 * size * size); - - for (let i = 0; i < size; i++) { - for (let j = 0; j < size; j++) { - const idx = i * size * 4 + j * 4; - coord.set(j, i).subScalar(size / 2); - - if (coord.length() < radius) - normal.set(Math.sin(coord.x * factor), Math.sin(coord.y * factor), Math.cos(coord.x * factor)); - else normal.set(0, 0, 1); - - data[idx + 0] = 0.5 + 0.5 * normal.x; - data[idx + 1] = 0.5 + 0.5 * normal.y; - data[idx + 2] = 0.5 + 0.5 * normal.z; - data[idx + 3] = 1; - } - } - - dataTexture = new THREE.DataTexture(data, size, size, THREE.RGBAFormat, THREE.FloatType); - dataTexture.needsUpdate = true; - - const material = new THREE.MeshBasicMaterial({ map: dataTexture }); - const quad = new THREE.PlaneGeometry(50, 50); - mesh = new THREE.Mesh(quad, material); - mesh.visible = false; - - scene.add(mesh); -} - -function swapScene() { - if (params.target == 'pmrem') { - camera.position.set(10, 0, 0); - controls.enabled = true; - scene.background = renderTarget.texture; - mesh.visible = false; - } else { - camera.position.set(0, 0, 70); - controls.enabled = false; - scene.background = new THREE.Color(0, 0, 0); - mesh.visible = true; - } -} - -async function exportFile() { - let result, exportType, exportCompression; - - if (params.type == 'HalfFloatType') exportType = THREE.HalfFloatType; - else exportType = THREE.FloatType; - - if (params.compression == 'ZIP') exportCompression = ZIP_COMPRESSION; - else if (params.compression == 'ZIPS') exportCompression = ZIPS_COMPRESSION; - else exportCompression = NO_COMPRESSION; - - if (params.target == 'pmrem') - result = await exporter.parse(renderer, renderTarget, { type: exportType, compression: exportCompression }); - else result = await exporter.parse(dataTexture, { type: exportType, compression: exportCompression }); - - saveArrayBuffer(result, params.target + '.exr'); -} - -function saveArrayBuffer(buffer, filename) { - const blob = new Blob([buffer], { type: 'image/x-exr' }); - const link = document.createElement('a'); - - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); -} diff --git a/examples-testing/examples/misc_exporter_gltf.ts b/examples-testing/examples/misc_exporter_gltf.ts deleted file mode 100644 index c19eb94a6..000000000 --- a/examples-testing/examples/misc_exporter_gltf.ts +++ /dev/null @@ -1,534 +0,0 @@ -import * as THREE from 'three'; - -import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; -import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import * as TextureUtils from 'three/addons/utils/WebGLTextureUtils.js'; - -function exportGLTF(input) { - const gltfExporter = new GLTFExporter().setTextureUtils(TextureUtils); - - const options = { - trs: params.trs, - onlyVisible: params.onlyVisible, - binary: params.binary, - maxTextureSize: params.maxTextureSize, - }; - gltfExporter.parse( - input, - function (result) { - if (result instanceof ArrayBuffer) { - saveArrayBuffer(result, 'scene.glb'); - } else { - const output = JSON.stringify(result, null, 2); - console.log(output); - saveString(output, 'scene.gltf'); - } - }, - function (error) { - console.log('An error happened during parsing', error); - }, - options, - ); -} - -const link = document.createElement('a'); -link.style.display = 'none'; -document.body.appendChild(link); // Firefox workaround, see #6594 - -function save(blob, filename) { - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); - - // URL.revokeObjectURL( url ); breaks Firefox... -} - -function saveString(text, filename) { - save(new Blob([text], { type: 'text/plain' }), filename); -} - -function saveArrayBuffer(buffer, filename) { - save(new Blob([buffer], { type: 'application/octet-stream' }), filename); -} - -let container; - -let camera, object, object2, material, geometry, scene1, scene2, renderer; -let gridHelper, sphere, model, coffeemat, webpBox; - -const params = { - trs: false, - onlyVisible: true, - binary: false, - maxTextureSize: 4096, - exportScene1: exportScene1, - exportScenes: exportScenes, - exportSphere: exportSphere, - exportModel: exportModel, - exportObjects: exportObjects, - exportSceneObject: exportSceneObject, - exportCompressedObject: exportCompressedObject, - exportWebPModel: exportWebPModel, -}; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // Make linear gradient texture - - const data = new Uint8ClampedArray(100 * 100 * 4); - - for (let y = 0; y < 100; y++) { - for (let x = 0; x < 100; x++) { - const stride = 4 * (100 * y + x); - - data[stride] = Math.round((255 * y) / 99); - data[stride + 1] = Math.round(255 - (255 * y) / 99); - data[stride + 2] = 0; - data[stride + 3] = 255; - } - } - - const gradientTexture = new THREE.DataTexture(data, 100, 100, THREE.RGBAFormat); - gradientTexture.minFilter = THREE.LinearFilter; - gradientTexture.magFilter = THREE.LinearFilter; - gradientTexture.needsUpdate = true; - - scene1 = new THREE.Scene(); - scene1.name = 'Scene1'; - - // --------------------------------------------------------------------- - // Perspective Camera - // --------------------------------------------------------------------- - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(600, 400, 0); - - camera.name = 'PerspectiveCamera'; - scene1.add(camera); - - // --------------------------------------------------------------------- - // Ambient light - // --------------------------------------------------------------------- - const ambientLight = new THREE.AmbientLight(0xcccccc); - ambientLight.name = 'AmbientLight'; - scene1.add(ambientLight); - - // --------------------------------------------------------------------- - // DirectLight - // --------------------------------------------------------------------- - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.target.position.set(0, 0, -1); - dirLight.add(dirLight.target); - dirLight.lookAt(-1, -1, 0); - dirLight.name = 'DirectionalLight'; - scene1.add(dirLight); - - // --------------------------------------------------------------------- - // Grid - // --------------------------------------------------------------------- - gridHelper = new THREE.GridHelper(2000, 20, 0xc1c1c1, 0x8d8d8d); - gridHelper.position.y = -50; - gridHelper.name = 'Grid'; - scene1.add(gridHelper); - - // --------------------------------------------------------------------- - // Axes - // --------------------------------------------------------------------- - const axes = new THREE.AxesHelper(500); - axes.name = 'AxesHelper'; - scene1.add(axes); - - // --------------------------------------------------------------------- - // Simple geometry with basic material - // --------------------------------------------------------------------- - // Icosahedron - const mapGrid = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); - mapGrid.wrapS = mapGrid.wrapT = THREE.RepeatWrapping; - mapGrid.colorSpace = THREE.SRGBColorSpace; - material = new THREE.MeshBasicMaterial({ - color: 0xffffff, - map: mapGrid, - }); - - object = new THREE.Mesh(new THREE.IcosahedronGeometry(75, 0), material); - object.position.set(-200, 0, 200); - object.name = 'Icosahedron'; - scene1.add(object); - - // Octahedron - material = new THREE.MeshBasicMaterial({ - color: 0x0000ff, - wireframe: true, - }); - object = new THREE.Mesh(new THREE.OctahedronGeometry(75, 1), material); - object.position.set(0, 0, 200); - object.name = 'Octahedron'; - scene1.add(object); - - // Tetrahedron - material = new THREE.MeshBasicMaterial({ - color: 0xff0000, - transparent: true, - opacity: 0.5, - }); - - object = new THREE.Mesh(new THREE.TetrahedronGeometry(75, 0), material); - object.position.set(200, 0, 200); - object.name = 'Tetrahedron'; - scene1.add(object); - - // --------------------------------------------------------------------- - // Buffered geometry primitives - // --------------------------------------------------------------------- - // Sphere - material = new THREE.MeshStandardMaterial({ - color: 0xffff00, - metalness: 0.5, - roughness: 1.0, - flatShading: true, - }); - material.map = gradientTexture; - material.bumpMap = mapGrid; - sphere = new THREE.Mesh(new THREE.SphereGeometry(70, 10, 10), material); - sphere.position.set(0, 0, 0); - sphere.name = 'Sphere'; - scene1.add(sphere); - - // Cylinder - material = new THREE.MeshStandardMaterial({ - color: 0xff00ff, - flatShading: true, - }); - object = new THREE.Mesh(new THREE.CylinderGeometry(10, 80, 100), material); - object.position.set(200, 0, 0); - object.name = 'Cylinder'; - scene1.add(object); - - // TorusKnot - material = new THREE.MeshStandardMaterial({ - color: 0xff0000, - roughness: 1, - }); - object = new THREE.Mesh(new THREE.TorusKnotGeometry(50, 15, 40, 10), material); - object.position.set(-200, 0, 0); - object.name = 'Cylinder'; - scene1.add(object); - - // --------------------------------------------------------------------- - // Hierarchy - // --------------------------------------------------------------------- - const mapWood = new THREE.TextureLoader().load('textures/hardwood2_diffuse.jpg'); - material = new THREE.MeshStandardMaterial({ map: mapWood, side: THREE.DoubleSide }); - - object = new THREE.Mesh(new THREE.BoxGeometry(40, 100, 100), material); - object.position.set(-200, 0, 400); - object.name = 'Cube'; - scene1.add(object); - - object2 = new THREE.Mesh(new THREE.BoxGeometry(40, 40, 40, 2, 2, 2), material); - object2.position.set(0, 0, 50); - object2.rotation.set(0, 45, 0); - object2.name = 'SubCube'; - object.add(object2); - - // --------------------------------------------------------------------- - // Groups - // --------------------------------------------------------------------- - const group1 = new THREE.Group(); - group1.name = 'Group'; - scene1.add(group1); - - const group2 = new THREE.Group(); - group2.name = 'subGroup'; - group2.position.set(0, 50, 0); - group1.add(group2); - - object2 = new THREE.Mesh(new THREE.BoxGeometry(30, 30, 30), material); - object2.name = 'Cube in group'; - object2.position.set(0, 0, 400); - group2.add(object2); - - // --------------------------------------------------------------------- - // THREE.Line Strip - // --------------------------------------------------------------------- - geometry = new THREE.BufferGeometry(); - let numPoints = 100; - let positions = new Float32Array(numPoints * 3); - - for (let i = 0; i < numPoints; i++) { - positions[i * 3] = i; - positions[i * 3 + 1] = Math.sin(i / 2) * 20; - positions[i * 3 + 2] = 0; - } - - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - object = new THREE.Line(geometry, new THREE.LineBasicMaterial({ color: 0xffff00 })); - object.position.set(-50, 0, -200); - scene1.add(object); - - // --------------------------------------------------------------------- - // THREE.Line Loop - // --------------------------------------------------------------------- - geometry = new THREE.BufferGeometry(); - numPoints = 5; - const radius = 70; - positions = new Float32Array(numPoints * 3); - - for (let i = 0; i < numPoints; i++) { - const s = (i * Math.PI * 2) / numPoints; - positions[i * 3] = radius * Math.sin(s); - positions[i * 3 + 1] = radius * Math.cos(s); - positions[i * 3 + 2] = 0; - } - - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - object = new THREE.LineLoop(geometry, new THREE.LineBasicMaterial({ color: 0xffff00 })); - object.position.set(0, 0, -200); - - scene1.add(object); - - // --------------------------------------------------------------------- - // THREE.Points - // --------------------------------------------------------------------- - numPoints = 100; - const pointsArray = new Float32Array(numPoints * 3); - for (let i = 0; i < numPoints; i++) { - pointsArray[3 * i] = -50 + Math.random() * 100; - pointsArray[3 * i + 1] = Math.random() * 100; - pointsArray[3 * i + 2] = -50 + Math.random() * 100; - } - - const pointsGeo = new THREE.BufferGeometry(); - pointsGeo.setAttribute('position', new THREE.BufferAttribute(pointsArray, 3)); - - const pointsMaterial = new THREE.PointsMaterial({ color: 0xffff00, size: 5 }); - const pointCloud = new THREE.Points(pointsGeo, pointsMaterial); - pointCloud.name = 'Points'; - pointCloud.position.set(-200, 0, -200); - scene1.add(pointCloud); - - // --------------------------------------------------------------------- - // Ortho camera - // --------------------------------------------------------------------- - - const height = 1000; // frustum height - const aspect = window.innerWidth / window.innerHeight; - - const cameraOrtho = new THREE.OrthographicCamera(-height * aspect, height * aspect, height, -height, 0, 2000); - cameraOrtho.position.set(600, 400, 0); - cameraOrtho.lookAt(0, 0, 0); - scene1.add(cameraOrtho); - cameraOrtho.name = 'OrthographicCamera'; - - material = new THREE.MeshLambertMaterial({ - color: 0xffff00, - side: THREE.DoubleSide, - }); - - object = new THREE.Mesh(new THREE.CircleGeometry(50, 20, 0, Math.PI * 2), material); - object.position.set(200, 0, -400); - scene1.add(object); - - object = new THREE.Mesh(new THREE.RingGeometry(10, 50, 20, 5, 0, Math.PI * 2), material); - object.position.set(0, 0, -400); - scene1.add(object); - - object = new THREE.Mesh(new THREE.CylinderGeometry(25, 75, 100, 40, 5), material); - object.position.set(-200, 0, -400); - scene1.add(object); - - // - const points = []; - - for (let i = 0; i < 50; i++) { - points.push(new THREE.Vector2(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, (i - 5) * 2)); - } - - object = new THREE.Mesh(new THREE.LatheGeometry(points, 20), material); - object.position.set(200, 0, 400); - scene1.add(object); - - // --------------------------------------------------------------------- - // Big red box hidden just for testing `onlyVisible` option - // --------------------------------------------------------------------- - material = new THREE.MeshBasicMaterial({ - color: 0xff0000, - }); - object = new THREE.Mesh(new THREE.BoxGeometry(200, 200, 200), material); - object.position.set(0, 0, 0); - object.name = 'CubeHidden'; - object.visible = false; - scene1.add(object); - - // --------------------------------------------------------------------- - // Model requiring KHR_mesh_quantization - // --------------------------------------------------------------------- - const loader = new GLTFLoader(); - loader.load('models/gltf/ShaderBall.glb', function (gltf) { - model = gltf.scene; - model.scale.setScalar(50); - model.position.set(200, -40, -200); - scene1.add(model); - }); - - // --------------------------------------------------------------------- - // Model requiring KHR_mesh_quantization - // --------------------------------------------------------------------- - - material = new THREE.MeshBasicMaterial({ - color: 0xffffff, - }); - object = new THREE.InstancedMesh(new THREE.BoxGeometry(10, 10, 10, 2, 2, 2), material, 50); - const matrix = new THREE.Matrix4(); - const color = new THREE.Color(); - for (let i = 0; i < 50; i++) { - matrix.setPosition(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); - object.setMatrixAt(i, matrix); - object.setColorAt(i, color.setHSL(i / 50, 1, 0.5)); - } - - object.position.set(400, 0, 200); - scene1.add(object); - - // --------------------------------------------------------------------- - // 2nd THREE.Scene - // --------------------------------------------------------------------- - scene2 = new THREE.Scene(); - object = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100), material); - object.position.set(0, 0, 0); - object.name = 'Cube2ndScene'; - scene2.name = 'Scene2'; - scene2.add(object); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - - container.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); - - // --------------------------------------------------------------------- - // Exporting compressed textures and meshes (KTX2 / Draco / Meshopt) - // --------------------------------------------------------------------- - const ktx2Loader = new KTX2Loader().detectSupport(renderer); - - const gltfLoader = new GLTFLoader().setPath('models/gltf/'); - gltfLoader.setKTX2Loader(ktx2Loader); - gltfLoader.setMeshoptDecoder(MeshoptDecoder); - gltfLoader.load('coffeemat.glb', function (gltf) { - gltf.scene.position.x = 400; - gltf.scene.position.z = -200; - - scene1.add(gltf.scene); - - coffeemat = gltf.scene; - }); - - // --------------------------------------------------------------------- - // Box with WebP texture (EXT_texture_webp) - // --------------------------------------------------------------------- - const canvas = document.createElement('canvas'); - canvas.width = 64; - canvas.height = 64; - const ctx = canvas.getContext('2d'); - ctx.fillStyle = '#005BBB'; - ctx.fillRect(0, 0, 64, 64); - ctx.fillStyle = '#FFD500'; - ctx.fillRect(16, 16, 32, 32); - - const webpTexture = new THREE.CanvasTexture(canvas); - webpTexture.userData.mimeType = 'image/webp'; - webpTexture.colorSpace = THREE.SRGBColorSpace; - - webpBox = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100), new THREE.MeshBasicMaterial({ map: webpTexture })); - webpBox.position.set(400, 0, 0); - webpBox.name = 'WebPBox'; - scene1.add(webpBox); - - // - - const gui = new GUI(); - - let h = gui.addFolder('Settings'); - h.add(params, 'trs').name('Use TRS'); - h.add(params, 'onlyVisible').name('Only Visible Objects'); - h.add(params, 'binary').name('Binary (GLB)'); - h.add(params, 'maxTextureSize', 2, 8192).name('Max Texture Size').step(1); - - h = gui.addFolder('Export'); - h.add(params, 'exportScene1').name('Export Scene 1'); - h.add(params, 'exportScenes').name('Export Scene 1 and 2'); - h.add(params, 'exportSphere').name('Export Sphere'); - h.add(params, 'exportModel').name('Export Model'); - h.add(params, 'exportObjects').name('Export Sphere With Grid'); - h.add(params, 'exportSceneObject').name('Export Scene 1 and Object'); - h.add(params, 'exportCompressedObject').name('Export Coffeemat (from compressed data)'); - h.add(params, 'exportWebPModel').name('Export WebP Model (EXT_texture_webp)'); - - gui.open(); -} - -function exportScene1() { - exportGLTF(scene1); -} - -function exportScenes() { - exportGLTF([scene1, scene2]); -} - -function exportSphere() { - exportGLTF(sphere); -} - -function exportModel() { - exportGLTF(model); -} - -function exportObjects() { - exportGLTF([sphere, gridHelper]); -} - -function exportSceneObject() { - exportGLTF([scene1, gridHelper]); -} - -function exportCompressedObject() { - exportGLTF([coffeemat]); -} - -function exportWebPModel() { - exportGLTF(webpBox); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const timer = Date.now() * 0.0001; - - camera.position.x = Math.cos(timer) * 800; - camera.position.z = Math.sin(timer) * 800; - - camera.lookAt(scene1.position); - renderer.render(scene1, camera); -} diff --git a/examples-testing/examples/misc_exporter_gltf_normals.ts b/examples-testing/examples/misc_exporter_gltf_normals.ts deleted file mode 100644 index c2981aa33..000000000 --- a/examples-testing/examples/misc_exporter_gltf_normals.ts +++ /dev/null @@ -1,163 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFExporter } from 'three/addons/exporters/GLTFExporter.js'; - -// - -let container; - -let camera, scene, renderer; -let mesh1, mesh2; - -init(); -render(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - - container.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - scene.name = 'Scene'; - - // camera - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 150); - camera.name = 'PerspectiveCamera'; - scene.add(camera); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 100; - controls.maxDistance = 200; - - // lights - const light = new THREE.DirectionalLight(0xffffff, 4); - light.position.set(0, 1, 1); - light.name = 'DirectionalLight'; - scene.add(light); - - const light2 = new THREE.DirectionalLight(0xffffff, 4); // for back-sided objects - light2.position.set(0, 1, -1); - light2.name = 'DirectionalLight2'; - scene.add(light2); - - // geometry1 - three.js convention: uv (0,0) bottom left - const geometry1 = new THREE.PlaneGeometry(50, 50); - - // geometry2 - glTF convention: uv (0,0) top left - const geometry2 = new THREE.PlaneGeometry(50, 50); - geometry2.setAttribute('uv', new THREE.BufferAttribute(new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), 2)); - - // textures - const normalMapOpenGL = new THREE.TextureLoader().load('textures/NormalMapOpenGL.png', render); - const normalMapDirectX = new THREE.TextureLoader().load('textures/NormalMapDirectX.png', render); - - // material - const material = new THREE.MeshStandardMaterial({ - color: 0x636389, - roughness: 0.3, - normalMap: null, - normalScale: new THREE.Vector2(0.5, 0.5), - side: THREE.DoubleSide, - }); - - // pick one - // --------------------------------------------------- - const GEOMETRY = geometry1; // geometry1 or geometry2 - // --------------------------------------------------- - - // mesh1 - mesh1 = new THREE.Mesh(GEOMETRY, material.clone()); - mesh1.position.set(-30, 0, 0); - - mesh1.material.normalMap = normalMapOpenGL; - //mesh1.material.normalMap.flipY = false; // default true - //mesh1.material.normalScale.y *= - 1; // exporter ignores negative normalScale.y - - mesh1.name = 'Mesh1'; - scene.add(mesh1); - - // mesh2 - mesh2 = new THREE.Mesh(GEOMETRY, material.clone()); - mesh2.position.set(30, 0, 0); - - mesh2.material.normalMap = normalMapDirectX; - //mesh2.material.normalMap.flipY = false; // default true - mesh2.material.normalScale.y *= -1; // exporter ignores negative normalScale.y - - mesh2.name = 'Mesh2'; - scene.add(mesh2); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - renderer.render(scene, camera); -} - -// - -function exportGLTF(input) { - const gltfExporter = new GLTFExporter(); - - const options = { - binary: true, - }; - - gltfExporter.parse( - input, - function (result) { - if (result instanceof ArrayBuffer) { - saveArrayBuffer(result, 'scene.glb'); - } else { - const output = JSON.stringify(result, null, 2); - console.log(output); - saveString(output, 'scene.gltf'); - } - }, - null, - options, - ); -} - -document.getElementById('export_objects').addEventListener('click', function () { - exportGLTF([mesh1, mesh2]); -}); - -const link = document.createElement('a'); -link.style.display = 'none'; -document.body.appendChild(link); // Firefox workaround, see #6594 - -function save(blob, filename) { - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); - - // URL.revokeObjectURL( url ); breaks Firefox... -} - -function saveString(text, filename) { - save(new Blob([text], { type: 'text/plain' }), filename); -} - -function saveArrayBuffer(buffer, filename) { - save(new Blob([buffer], { type: 'application/octet-stream' }), filename); -} diff --git a/examples-testing/examples/misc_exporter_ktx2.ts b/examples-testing/examples/misc_exporter_ktx2.ts deleted file mode 100644 index c96889a24..000000000 --- a/examples-testing/examples/misc_exporter_ktx2.ts +++ /dev/null @@ -1,145 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { KTX2Exporter } from 'three/addons/exporters/KTX2Exporter.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer, exporter, mesh, controls, renderTarget, dataTexture; - -const params = { - target: 'pmrem', - export: exportFile, -}; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.toneMapping = THREE.AgXToneMapping; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(10, 0, 0); - - scene = new THREE.Scene(); - - exporter = new KTX2Exporter(); - const hdrLoader = new HDRLoader(); - - // - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - pmremGenerator.compileEquirectangularShader(); - - hdrLoader.load('textures/equirectangular/venice_sunset_1k.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - renderTarget = pmremGenerator.fromEquirectangular(texture); - scene.background = renderTarget.texture; - }); - - createDataTexture(); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.rotateSpeed = -0.25; // negative, to track mouse pointer - - // - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'target').options(['pmrem', 'data-texture']).onChange(swapScene); - gui.add(params, 'export').name('Export KTX2'); - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - renderer.render(scene, camera); -} - -function createDataTexture() { - const normal = new THREE.Vector3(); - const coord = new THREE.Vector2(); - const size = 800, - radius = 320, - factor = (Math.PI * 0.5) / radius; - const data = new Float32Array(4 * size * size); - - for (let i = 0; i < size; i++) { - for (let j = 0; j < size; j++) { - const idx = i * size * 4 + j * 4; - coord.set(j, i).subScalar(size / 2); - - if (coord.length() < radius) - normal.set(Math.sin(coord.x * factor), Math.sin(coord.y * factor), Math.cos(coord.x * factor)); - else normal.set(0, 0, 1); - - data[idx + 0] = 0.5 + 0.5 * normal.x; - data[idx + 1] = 0.5 + 0.5 * normal.y; - data[idx + 2] = 0.5 + 0.5 * normal.z; - data[idx + 3] = 1; - } - } - - dataTexture = new THREE.DataTexture(data, size, size, THREE.RGBAFormat, THREE.FloatType); - dataTexture.needsUpdate = true; - - const material = new THREE.MeshBasicMaterial({ map: dataTexture }); - const quad = new THREE.PlaneGeometry(50, 50); - mesh = new THREE.Mesh(quad, material); - mesh.visible = false; - - scene.add(mesh); -} - -function swapScene() { - if (params.target == 'pmrem') { - camera.position.set(10, 0, 0); - controls.enabled = true; - scene.background = renderTarget.texture; - mesh.visible = false; - renderer.toneMapping = THREE.AgXToneMapping; - } else { - camera.position.set(0, 0, 70); - controls.enabled = false; - scene.background = new THREE.Color(0, 0, 0); - mesh.visible = true; - renderer.toneMapping = THREE.NoToneMapping; - } -} - -async function exportFile() { - let result; - - if (params.target == 'pmrem') result = await exporter.parse(renderer, renderTarget); - else result = await exporter.parse(dataTexture); - - saveArrayBuffer(result, params.target + '.ktx2'); -} - -function saveArrayBuffer(buffer, filename) { - const blob = new Blob([buffer], { type: 'image/ktx2' }); - const link = document.createElement('a'); - - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); -} diff --git a/examples-testing/examples/misc_exporter_obj.ts b/examples-testing/examples/misc_exporter_obj.ts deleted file mode 100644 index 025034daf..000000000 --- a/examples-testing/examples/misc_exporter_obj.ts +++ /dev/null @@ -1,192 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJExporter } from 'three/addons/exporters/OBJExporter.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer; - -const params = { - addTriangle: addTriangle, - addCube: addCube, - addCylinder: addCylinder, - addMultiple: addMultiple, - addTransformed: addTransformed, - addPoints: addPoints, - exportToObj: exportToObj, -}; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 400); - - scene = new THREE.Scene(); - - const ambientLight = new THREE.AmbientLight(0xffffff); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); - directionalLight.position.set(0, 1, 1); - scene.add(directionalLight); - - const gui = new GUI(); - - let h = gui.addFolder('Geometry Selection'); - h.add(params, 'addTriangle').name('Triangle'); - h.add(params, 'addCube').name('Cube'); - h.add(params, 'addCylinder').name('Cylinder'); - h.add(params, 'addMultiple').name('Multiple objects'); - h.add(params, 'addTransformed').name('Transformed objects'); - h.add(params, 'addPoints').name('Point Cloud'); - - h = gui.addFolder('Export'); - h.add(params, 'exportToObj').name('Export OBJ'); - - gui.open(); - - addGeometry(1); - - window.addEventListener('resize', onWindowResize); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enablePan = false; -} - -function exportToObj() { - const exporter = new OBJExporter(); - const result = exporter.parse(scene); - saveString(result, 'object.obj'); -} - -function addGeometry(type) { - for (let i = 0; i < scene.children.length; i++) { - const child = scene.children[i]; - - if (child.isMesh || child.isPoints) { - child.geometry.dispose(); - scene.remove(child); - i--; - } - } - - if (type === 1) { - const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); - const geometry = generateTriangleGeometry(); - - scene.add(new THREE.Mesh(geometry, material)); - } else if (type === 2) { - const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); - const geometry = new THREE.BoxGeometry(100, 100, 100); - scene.add(new THREE.Mesh(geometry, material)); - } else if (type === 3) { - const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); - const geometry = new THREE.CylinderGeometry(50, 50, 100, 30, 1); - scene.add(new THREE.Mesh(geometry, material)); - } else if (type === 4 || type === 5) { - const material = new THREE.MeshLambertMaterial({ color: 0x00cc00 }); - const geometry = generateTriangleGeometry(); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = -200; - scene.add(mesh); - - const geometry2 = new THREE.BoxGeometry(100, 100, 100); - const mesh2 = new THREE.Mesh(geometry2, material); - scene.add(mesh2); - - const geometry3 = new THREE.CylinderGeometry(50, 50, 100, 30, 1); - const mesh3 = new THREE.Mesh(geometry3, material); - mesh3.position.x = 200; - scene.add(mesh3); - - if (type === 5) { - mesh.rotation.y = Math.PI / 4.0; - mesh2.rotation.y = Math.PI / 4.0; - mesh3.rotation.y = Math.PI / 4.0; - } - } else if (type === 6) { - const points = [0, 0, 0, 100, 0, 0, 100, 100, 0, 0, 100, 0]; - const colors = [0.5, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0.5, 0]; - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.Float32BufferAttribute(points, 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - const material = new THREE.PointsMaterial({ size: 10, vertexColors: true }); - - const pointCloud = new THREE.Points(geometry, material); - pointCloud.name = 'point cloud'; - scene.add(pointCloud); - } -} - -function addTriangle() { - addGeometry(1); -} - -function addCube() { - addGeometry(2); -} - -function addCylinder() { - addGeometry(3); -} - -function addMultiple() { - addGeometry(4); -} - -function addTransformed() { - addGeometry(5); -} - -function addPoints() { - addGeometry(6); -} - -const link = document.createElement('a'); -link.style.display = 'none'; -document.body.appendChild(link); - -function save(blob, filename) { - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); -} - -function saveString(text, filename) { - save(new Blob([text], { type: 'text/plain' }), filename); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} - -function generateTriangleGeometry() { - const geometry = new THREE.BufferGeometry(); - const vertices = []; - - vertices.push(-50, -50, 0); - vertices.push(50, -50, 0); - vertices.push(50, 50, 0); - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - geometry.computeVertexNormals(); - - return geometry; -} diff --git a/examples-testing/examples/misc_exporter_ply.ts b/examples-testing/examples/misc_exporter_ply.ts deleted file mode 100644 index 8a5c52626..000000000 --- a/examples-testing/examples/misc_exporter_ply.ts +++ /dev/null @@ -1,162 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { PLYExporter } from 'three/addons/exporters/PLYExporter.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer, exporter, mesh; - -const params = { - exportASCII: exportASCII, - exportBinaryBigEndian: exportBinaryBigEndian, - exportBinaryLittleEndian: exportBinaryLittleEndian, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(4, 2, 4); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 4, 20); - - exporter = new PLYExporter(); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 3); - hemiLight.position.set(0, 20, 0); - scene.add(hemiLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 3); - directionalLight.position.set(0, 20, 10); - directionalLight.castShadow = true; - directionalLight.shadow.camera.top = 2; - directionalLight.shadow.camera.bottom = -2; - directionalLight.shadow.camera.left = -2; - directionalLight.shadow.camera.right = 2; - scene.add(directionalLight); - - // ground - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(40, 40), - new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), - ); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - const grid = new THREE.GridHelper(40, 20, 0x000000, 0x000000); - grid.material.opacity = 0.2; - grid.material.transparent = true; - scene.add(grid); - - // export mesh - - const geometry = new THREE.BoxGeometry(); - const material = new THREE.MeshPhongMaterial({ vertexColors: true }); - - // color vertices based on vertex positions - const positions = geometry.getAttribute('position'); - const colors = new THREE.Uint8BufferAttribute(positions.array, 3, true); - const vertex = new THREE.Vector3(); - - for (let i = 0, l = positions.count; i < l; i++) { - vertex.fromBufferAttribute(positions, i); - - colors.setX(i, vertex.x > 0 ? 0.5 : 0); - colors.setY(i, vertex.y > 0 ? 0.5 : 0); - colors.setZ(i, vertex.z > 0 ? 0.5 : 0); - } - - geometry.setAttribute('color', colors); - - mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - mesh.position.y = 0.5; - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.5, 0); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'exportASCII').name('Export PLY (ASCII)'); - gui.add(params, 'exportBinaryBigEndian').name('Export PLY (Binary BE)'); - gui.add(params, 'exportBinaryLittleEndian').name('Export PLY (Binary LE)'); - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} - -function exportASCII() { - exporter.parse(mesh, function (result) { - saveString(result, 'box.ply'); - }); -} - -function exportBinaryBigEndian() { - exporter.parse( - mesh, - function (result) { - saveArrayBuffer(result, 'box.ply'); - }, - { binary: true }, - ); -} - -function exportBinaryLittleEndian() { - exporter.parse( - mesh, - function (result) { - saveArrayBuffer(result, 'box.ply'); - }, - { binary: true, littleEndian: true }, - ); -} - -const link = document.createElement('a'); -link.style.display = 'none'; -document.body.appendChild(link); - -function save(blob, filename) { - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); -} - -function saveString(text, filename) { - save(new Blob([text], { type: 'text/plain' }), filename); -} - -function saveArrayBuffer(buffer, filename) { - save(new Blob([buffer], { type: 'application/octet-stream' }), filename); -} diff --git a/examples-testing/examples/misc_exporter_stl.ts b/examples-testing/examples/misc_exporter_stl.ts deleted file mode 100644 index ff6d6e2b5..000000000 --- a/examples-testing/examples/misc_exporter_stl.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { STLExporter } from 'three/addons/exporters/STLExporter.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer, exporter, mesh; - -const params = { - exportASCII: exportASCII, - exportBinary: exportBinary, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(4, 2, 4); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 4, 20); - - exporter = new STLExporter(); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 3); - hemiLight.position.set(0, 20, 0); - scene.add(hemiLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 3); - directionalLight.position.set(0, 20, 10); - directionalLight.castShadow = true; - directionalLight.shadow.camera.top = 2; - directionalLight.shadow.camera.bottom = -2; - directionalLight.shadow.camera.left = -2; - directionalLight.shadow.camera.right = 2; - scene.add(directionalLight); - - // ground - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(40, 40), - new THREE.MeshPhongMaterial({ color: 0xbbbbbb, depthWrite: false }), - ); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - const grid = new THREE.GridHelper(40, 20, 0x000000, 0x000000); - grid.material.opacity = 0.2; - grid.material.transparent = true; - scene.add(grid); - - // export mesh - - const geometry = new THREE.BoxGeometry(); - const material = new THREE.MeshPhongMaterial({ color: 0x00ff00 }); - - mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - mesh.position.y = 0.5; - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.5, 0); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'exportASCII').name('Export STL (ASCII)'); - gui.add(params, 'exportBinary').name('Export STL (Binary)'); - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} - -function exportASCII() { - const result = exporter.parse(mesh); - saveString(result, 'box.stl'); -} - -function exportBinary() { - const result = exporter.parse(mesh, { binary: true }); - saveArrayBuffer(result, 'box.stl'); -} - -const link = document.createElement('a'); -link.style.display = 'none'; -document.body.appendChild(link); - -function save(blob, filename) { - link.href = URL.createObjectURL(blob); - link.download = filename; - link.click(); -} - -function saveString(text, filename) { - save(new Blob([text], { type: 'text/plain' }), filename); -} - -function saveArrayBuffer(buffer, filename) { - save(new Blob([buffer], { type: 'application/octet-stream' }), filename); -} diff --git a/examples-testing/examples/misc_exporter_usdz.ts b/examples-testing/examples/misc_exporter_usdz.ts deleted file mode 100644 index 4c84a8ffb..000000000 --- a/examples-testing/examples/misc_exporter_usdz.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; -import { USDZExporter } from 'three/addons/exporters/USDZExporter.js'; -import * as WebGLTextureUtils from 'three/addons/utils/WebGLTextureUtils.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, mixer, timer, controls; - -const params = { - exportUSDZ: exportUSDZ, -}; - -init(); - -function init() { - timer = new THREE.Timer(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-2.5, 1.6, 3.0); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - - const ktx2loader = new KTX2Loader().detectSupport(renderer); - const dracoLoader = new DRACOLoader(); - const gltfLoader = new GLTFLoader(); - - gltfLoader.setDRACOLoader(dracoLoader); - gltfLoader.setKTX2Loader(ktx2loader); - gltfLoader.setPath('models/gltf/'); - gltfLoader.load('CarbonFrameBike.glb', async function (gltf) { - scene.add(gltf.scene); - - if (gltf.animations.length > 0) { - mixer = new THREE.AnimationMixer(gltf.scene); - const action = mixer.clipAction(gltf.animations[0]); - action.setLoop(THREE.LoopRepeat, Infinity); - action.play(); - } - - // USDZ - - const exporter = new USDZExporter(); - exporter.setTextureUtils(WebGLTextureUtils); // for texture decompresssing - const arraybuffer = await exporter.parseAsync(gltf.scene, { animations: gltf.animations }); - const blob = new Blob([arraybuffer], { type: 'application/octet-stream' }); - - const link = document.getElementById('link'); - link.href = URL.createObjectURL(blob); - }); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.enableDamping = true; - controls.target.set(0, 0.7, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); - - const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent); - - if (isIOS === false) { - const gui = new GUI(); - - gui.add(params, 'exportUSDZ').name('Export USDZ'); - gui.open(); - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function exportUSDZ() { - const link = document.getElementById('link'); - link.click(); -} - -// - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/misc_uv_tests.ts b/examples-testing/examples/misc_uv_tests.ts deleted file mode 100644 index 4f782d45f..000000000 --- a/examples-testing/examples/misc_uv_tests.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as THREE from 'three'; - -import { UVsDebug } from 'three/addons/utils/UVsDebug.js'; - -/* - * This is to help debug UVs problems in geometry, - * as well as allow a new user to visualize what UVs are about. - */ - -function test(name, geometry) { - const d = document.createElement('div'); - - d.innerHTML = '

' + name + '

'; - - d.appendChild(UVsDebug(geometry)); - - document.body.appendChild(d); -} - -const points = []; - -for (let i = 0; i < 10; i++) { - points.push(new THREE.Vector2(Math.sin(i * 0.2) * 15 + 50, (i - 5) * 2)); -} - -// - -test('new THREE.PlaneGeometry( 100, 100, 4, 4 )', new THREE.PlaneGeometry(100, 100, 4, 4)); - -test('new THREE.SphereGeometry( 75, 12, 6 )', new THREE.SphereGeometry(75, 12, 6)); - -test('new THREE.IcosahedronGeometry( 30, 1 )', new THREE.IcosahedronGeometry(30, 1)); - -test('new THREE.OctahedronGeometry( 30, 2 )', new THREE.OctahedronGeometry(30, 2)); - -test('new THREE.CylinderGeometry( 25, 75, 100, 10, 5 )', new THREE.CylinderGeometry(25, 75, 100, 10, 5)); - -test('new THREE.BoxGeometry( 100, 100, 100, 4, 4, 4 )', new THREE.BoxGeometry(100, 100, 100, 4, 4, 4)); - -test('new THREE.LatheGeometry( points, 8 )', new THREE.LatheGeometry(points, 8)); - -test('new THREE.TorusGeometry( 50, 20, 8, 8 )', new THREE.TorusGeometry(50, 20, 8, 8)); - -test('new THREE.TorusKnotGeometry( 50, 10, 12, 6 )', new THREE.TorusKnotGeometry(50, 10, 12, 6)); diff --git a/examples-testing/examples/physics_ammo_instancing.ts b/examples-testing/examples/physics_ammo_instancing.ts deleted file mode 100644 index 5cbee3260..000000000 --- a/examples-testing/examples/physics_ammo_instancing.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { AmmoPhysics } from 'three/addons/physics/AmmoPhysics.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let physics, position; - -let boxes, spheres; - -init(); - -async function init() { - physics = await AmmoPhysics(); - position = new THREE.Vector3(); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-1, 1.5, 2); - camera.lookAt(0, 0.5, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x666666); - - const hemiLight = new THREE.HemisphereLight(); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(5, 5, 5); - dirLight.castShadow = true; - dirLight.shadow.camera.zoom = 2; - scene.add(dirLight); - - const shadowPlane = new THREE.Mesh( - new THREE.PlaneGeometry(10, 10), - new THREE.ShadowMaterial({ - color: 0x444444, - }), - ); - shadowPlane.rotation.x = -Math.PI / 2; - shadowPlane.receiveShadow = true; - scene.add(shadowPlane); - - const floorCollider = new THREE.Mesh( - new THREE.BoxGeometry(10, 5, 10), - new THREE.MeshBasicMaterial({ color: 0x666666 }), - ); - floorCollider.position.y = -2.5; - floorCollider.userData.physics = { mass: 0 }; - floorCollider.visible = false; - scene.add(floorCollider); - - // - - const material = new THREE.MeshLambertMaterial(); - - const matrix = new THREE.Matrix4(); - const color = new THREE.Color(); - - // Boxes - - const geometryBox = new THREE.BoxGeometry(0.075, 0.075, 0.075); - boxes = new THREE.InstancedMesh(geometryBox, material, 400); - boxes.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame - boxes.castShadow = true; - boxes.receiveShadow = true; - boxes.userData.physics = { mass: 1 }; - scene.add(boxes); - - for (let i = 0; i < boxes.count; i++) { - matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); - boxes.setMatrixAt(i, matrix); - boxes.setColorAt(i, color.setHex(0xffffff * Math.random())); - } - - // Spheres - - const geometrySphere = new THREE.IcosahedronGeometry(0.05, 4); - spheres = new THREE.InstancedMesh(geometrySphere, material, 400); - spheres.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame - spheres.castShadow = true; - spheres.receiveShadow = true; - spheres.userData.physics = { mass: 1 }; - scene.add(spheres); - - for (let i = 0; i < spheres.count; i++) { - matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); - spheres.setMatrixAt(i, matrix); - spheres.setColorAt(i, color.setHex(0xffffff * Math.random())); - } - - physics.addScene(scene); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.y = 0.5; - controls.update(); - - setInterval(() => { - let index = Math.floor(Math.random() * boxes.count); - - position.set(0, Math.random() + 1, 0); - physics.setMeshPosition(boxes, position, index); - - // - - index = Math.floor(Math.random() * spheres.count); - - position.set(0, Math.random() + 1, 0); - physics.setMeshPosition(spheres, position, index); - }, 1000 / 60); -} - -function animate() { - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/physics_jolt_instancing.ts b/examples-testing/examples/physics_jolt_instancing.ts deleted file mode 100644 index 70980b8d5..000000000 --- a/examples-testing/examples/physics_jolt_instancing.ts +++ /dev/null @@ -1,133 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { JoltPhysics } from 'three/addons/physics/JoltPhysics.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let physics, position; - -let boxes, spheres; - -init(); - -async function init() { - physics = await JoltPhysics(); - position = new THREE.Vector3(); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-1, 1.5, 2); - camera.lookAt(0, 0.5, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x666666); - - const hemiLight = new THREE.HemisphereLight(); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(5, 5, 5); - dirLight.castShadow = true; - dirLight.shadow.camera.zoom = 2; - dirLight.shadow.bias = -0.001; - scene.add(dirLight); - - const shadowPlane = new THREE.Mesh( - new THREE.PlaneGeometry(10, 10), - new THREE.ShadowMaterial({ - color: 0x444444, - }), - ); - shadowPlane.rotation.x = -Math.PI / 2; - shadowPlane.receiveShadow = true; - scene.add(shadowPlane); - - const floorCollider = new THREE.Mesh( - new THREE.BoxGeometry(10, 5, 10), - new THREE.MeshBasicMaterial({ color: 0x666666 }), - ); - floorCollider.position.y = -2.5; - floorCollider.userData.physics = { mass: 0 }; - floorCollider.visible = false; - scene.add(floorCollider); - - // - - const material = new THREE.MeshLambertMaterial(); - - const matrix = new THREE.Matrix4(); - const color = new THREE.Color(); - - // Boxes - - const geometryBox = new THREE.BoxGeometry(0.075, 0.075, 0.075); - boxes = new THREE.InstancedMesh(geometryBox, material, 400); - boxes.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame - boxes.castShadow = true; - boxes.receiveShadow = true; - boxes.userData.physics = { mass: 1 }; - scene.add(boxes); - - for (let i = 0; i < boxes.count; i++) { - matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); - boxes.setMatrixAt(i, matrix); - boxes.setColorAt(i, color.setHex(0xffffff * Math.random())); - } - - // Spheres - - const geometrySphere = new THREE.IcosahedronGeometry(0.05, 4); - spheres = new THREE.InstancedMesh(geometrySphere, material, 400); - spheres.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame - spheres.castShadow = true; - spheres.receiveShadow = true; - spheres.userData.physics = { mass: 1 }; - scene.add(spheres); - - for (let i = 0; i < spheres.count; i++) { - matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); - spheres.setMatrixAt(i, matrix); - spheres.setColorAt(i, color.setHex(0xffffff * Math.random())); - } - - physics.addScene(scene); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.y = 0.5; - controls.update(); - - setInterval(() => { - let index = Math.floor(Math.random() * boxes.count); - - position.set(0, Math.random() + 1, 0); - physics.setMeshPosition(boxes, position, index); - - // - - index = Math.floor(Math.random() * spheres.count); - - position.set(0, Math.random() + 1, 0); - physics.setMeshPosition(spheres, position, index); - }, 1000 / 60); -} - -function animate() { - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/physics_rapier_basic.ts b/examples-testing/examples/physics_rapier_basic.ts deleted file mode 100644 index 0bacda80c..000000000 --- a/examples-testing/examples/physics_rapier_basic.ts +++ /dev/null @@ -1,144 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; -import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; -import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats, controls; -let physics, physicsHelper; - -init(); - -async function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfd1e5); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 3, 10); - - const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); - - scene.add(ambient); - - const light = new THREE.DirectionalLight(0xffffff, 4); - - light.position.set(0, 12.5, 12.5); - light.castShadow = true; - light.shadow.radius = 3; - light.shadow.blurSamples = 8; - light.shadow.mapSize.width = 1024; - light.shadow.mapSize.height = 1024; - - const size = 10; - light.shadow.camera.left = -size; - light.shadow.camera.bottom = -size; - light.shadow.camera.right = size; - light.shadow.camera.top = size; - light.shadow.camera.near = 1; - light.shadow.camera.far = 50; - - scene.add(light); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - renderer.setAnimationLoop(animate); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target = new THREE.Vector3(0, 2, 0); - controls.update(); - - const geometry = new THREE.BoxGeometry(10, 0.5, 10); - const material = new THREE.MeshStandardMaterial({ color: 0xffffff }); - - const floor = new THREE.Mesh(geometry, material); - floor.receiveShadow = true; - - floor.position.y = -0.25; - floor.userData.physics = { mass: 0 }; - - scene.add(floor); - - new THREE.TextureLoader().load('textures/grid.png', function (texture) { - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.repeat.set(20, 20); - floor.material.map = texture; - floor.material.needsUpdate = true; - }); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - initPhysics(); - - onWindowResize(); - - window.addEventListener('resize', onWindowResize, false); -} - -async function initPhysics() { - //Initialize physics engine using the script in the jsm/physics folder - physics = await RapierPhysics(); - - physics.addScene(scene); - - addBody(); - - //Optionally display collider outlines - physicsHelper = new RapierHelper(physics.world); - scene.add(physicsHelper); - - setInterval(addBody, 1000); -} - -const geometries = [ - new THREE.BoxGeometry(1, 1, 1), - new THREE.SphereGeometry(0.5), - new RoundedBoxGeometry(1, 1, 1, 2, 0.25), -]; - -function addBody() { - const geometry = geometries[Math.floor(Math.random() * geometries.length)]; - const material = new THREE.MeshStandardMaterial({ color: Math.floor(Math.random() * 0xffffff) }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - - mesh.position.set(Math.random() * 2 - 1, Math.random() * 3 + 6, Math.random() * 2 - 1); - - scene.add(mesh); - - //parameter 2 - mass, parameter 3 - restitution ( how bouncy ) - physics.addMesh(mesh, 1, 0.5); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - for (const object of scene.children) { - if (object.isMesh) { - if (object.position.y < -10) { - scene.remove(object); - physics.removeMesh(object); - } - } - } - - if (physicsHelper) physicsHelper.update(); - - controls.update(); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/physics_rapier_character_controller.ts b/examples-testing/examples/physics_rapier_character_controller.ts deleted file mode 100644 index 8e797a98c..000000000 --- a/examples-testing/examples/physics_rapier_character_controller.ts +++ /dev/null @@ -1,187 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; -import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let physics, characterController, physicsHelper; -let player, movement; - -init(); - -async function init() { - scene = new THREE.Scene(); - - scene.background = new THREE.Color(0xbfd1e5); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(2, 5, 15); - - const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); - - scene.add(ambient); - - const light = new THREE.DirectionalLight(0xffffff, 3); - - light.position.set(0, 12.5, 12.5); - light.castShadow = true; - light.shadow.radius = 3; - light.shadow.blurSamples = 8; - light.shadow.mapSize.width = 1024; - light.shadow.mapSize.height = 1024; - - const size = 10; - light.shadow.camera.left = -size; - light.shadow.camera.bottom = -size; - light.shadow.camera.right = size; - light.shadow.camera.top = size; - light.shadow.camera.near = 1; - light.shadow.camera.far = 50; - - scene.add(light); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - renderer.setAnimationLoop(animate); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target = new THREE.Vector3(0, 2, 0); - controls.update(); - - const geometry = new THREE.BoxGeometry(20, 0.5, 20); - const material = new THREE.MeshStandardMaterial({ color: 0xffffff }); - - const ground = new THREE.Mesh(geometry, material); - ground.receiveShadow = true; - - ground.position.y = -0.25; - ground.userData.physics = { mass: 0 }; - - scene.add(ground); - - new THREE.TextureLoader().load('textures/grid.png', function (texture) { - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.repeat.set(20, 20); - ground.material.map = texture; - ground.material.needsUpdate = true; - }); - - for (let i = 0; i < 10; i++) addBody(Math.random() > 0.7); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - initPhysics(); - - onWindowResize(); - - // Movement input - movement = { forward: 0, right: 0 }; - - window.addEventListener('keydown', event => { - if (event.key === 'w' || event.key === 'ArrowUp') movement.forward = 1; - if (event.key === 's' || event.key === 'ArrowDown') movement.forward = -1; - if (event.key === 'a' || event.key === 'ArrowLeft') movement.right = -1; - if (event.key === 'd' || event.key === 'ArrowRight') movement.right = 1; - }); - - window.addEventListener('keyup', event => { - if (event.key === 'w' || event.key === 's' || event.key === 'ArrowUp' || event.key === 'ArrowDown') - movement.forward = 0; - if (event.key === 'a' || event.key === 'd' || event.key === 'ArrowLeft' || event.key === 'ArrowRight') - movement.right = 0; - }); - - window.addEventListener('resize', onWindowResize, false); -} - -function random(min, max) { - return Math.random() * (max - min) + min; -} - -async function initPhysics() { - //Initialize physics engine using the script in the jsm/physics folder - physics = await RapierPhysics(); - - //Optionally display collider outlines - physicsHelper = new RapierHelper(physics.world); - scene.add(physicsHelper); - - physics.addScene(scene); - - addCharacterController(); -} - -function addCharacterController() { - // Character Capsule - const geometry = new THREE.CapsuleGeometry(0.3, 1, 8, 8); - const material = new THREE.MeshStandardMaterial({ color: 0x0000ff }); - player = new THREE.Mesh(geometry, material); - player.castShadow = true; - player.position.set(0, 0.8, 0); - scene.add(player); - - // Rapier Character Controller - characterController = physics.world.createCharacterController(0.01); - characterController.setApplyImpulsesToDynamicBodies(true); - characterController.setCharacterMass(3); - const colliderDesc = physics.RAPIER.ColliderDesc.capsule(0.5, 0.3).setTranslation(0, 0.8, 0); - player.userData.collider = physics.world.createCollider(colliderDesc); -} - -function addBody(fixed = true) { - const geometry = fixed ? new THREE.BoxGeometry(1, 1, 1) : new THREE.SphereGeometry(0.25); - const material = new THREE.MeshStandardMaterial({ color: fixed ? 0xff0000 : 0x00ff00 }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - - mesh.position.set(random(-10, 10), 0.5, random(-10, 10)); - - mesh.userData.physics = { mass: fixed ? 0 : 0.5, restitution: fixed ? 0 : 0.3 }; - - scene.add(mesh); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - if (physicsHelper) physicsHelper.update(); - - renderer.render(scene, camera); - - if (physics && characterController) { - const deltaTime = 1 / 60; - - // Character movement - const speed = 2.5 * deltaTime; - const moveVector = new physics.RAPIER.Vector3(movement.right * speed, 0, -movement.forward * speed); - - characterController.computeColliderMovement(player.userData.collider, moveVector); - - // Read the result. - const translation = characterController.computedMovement(); - const position = player.userData.collider.translation(); - - position.x += translation.x; - position.y += translation.y; - position.z += translation.z; - - player.userData.collider.setTranslation(position); - - // Sync Three.js mesh with Rapier collider - player.position.set(position.x, position.y, position.z); - } - - stats.update(); -} diff --git a/examples-testing/examples/physics_rapier_instancing.ts b/examples-testing/examples/physics_rapier_instancing.ts deleted file mode 100644 index d65c631c5..000000000 --- a/examples-testing/examples/physics_rapier_instancing.ts +++ /dev/null @@ -1,158 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let physics, position; - -let boxes, spheres; - -init(); - -async function init() { - physics = await RapierPhysics(); - position = new THREE.Vector3(); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-1, 1.5, 2); - camera.lookAt(0, 0.5, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x666666); - - const hemiLight = new THREE.HemisphereLight(); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(5, 5, 5); - dirLight.castShadow = true; - dirLight.shadow.camera.zoom = 2; - scene.add(dirLight); - - const shadowPlane = new THREE.Mesh( - new THREE.PlaneGeometry(10, 10), - new THREE.ShadowMaterial({ - color: 0x444444, - }), - ); - shadowPlane.rotation.x = -Math.PI / 2; - shadowPlane.receiveShadow = true; - scene.add(shadowPlane); - - const floorCollider = new THREE.Mesh( - new THREE.BoxGeometry(10, 5, 10), - new THREE.MeshBasicMaterial({ color: 0x666666 }), - ); - floorCollider.position.y = -2.5; - floorCollider.userData.physics = { mass: 0 }; - floorCollider.visible = false; - scene.add(floorCollider); - - // - - const material = new THREE.MeshLambertMaterial(); - - const matrix = new THREE.Matrix4(); - const color = new THREE.Color(); - - // Boxes - - const geometryBox = new THREE.BoxGeometry(0.075, 0.075, 0.075); - boxes = new THREE.InstancedMesh(geometryBox, material, 400); - boxes.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame - boxes.castShadow = true; - boxes.receiveShadow = true; - boxes.userData.physics = { mass: 1 }; - scene.add(boxes); - - for (let i = 0; i < boxes.count; i++) { - matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); - boxes.setMatrixAt(i, matrix); - boxes.setColorAt(i, color.setHex(0xffffff * Math.random())); - } - - // Spheres - - const geometrySphere = new THREE.IcosahedronGeometry(0.05, 4); - spheres = new THREE.InstancedMesh(geometrySphere, material, 400); - spheres.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame - spheres.castShadow = true; - spheres.receiveShadow = true; - spheres.userData.physics = { mass: 1 }; - scene.add(spheres); - - for (let i = 0; i < spheres.count; i++) { - matrix.setPosition(Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5); - spheres.setMatrixAt(i, matrix); - spheres.setColorAt(i, color.setHex(0xffffff * Math.random())); - } - - physics.addScene(scene); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.y = 0.5; - controls.update(); - - document.querySelector('button#shake').addEventListener('click', () => { - const impulse = new THREE.Vector3(); - - for (let i = 0; i < spheres.count; i++) { - impulse.set((Math.random() - 0.5) * 5, Math.random() * 5, (Math.random() - 0.5) * 5); - - physics.applyImpulse(spheres, impulse, i); - } - - for (let i = 0; i < boxes.count; i++) { - impulse.set((Math.random() - 0.5) * 5, Math.random() * 5, (Math.random() - 0.5) * 5); - - physics.applyImpulse(boxes, impulse, i); - } - }); - - setInterval(() => { - let index = Math.floor(Math.random() * boxes.count); - - position.set(0, Math.random() + 1, 0); - physics.setMeshPosition(boxes, position, index); - - // - - index = Math.floor(Math.random() * spheres.count); - - position.set(0, Math.random() + 1, 0); - physics.setMeshPosition(spheres, position, index); - }, 1000 / 60); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/physics_rapier_joints.ts b/examples-testing/examples/physics_rapier_joints.ts deleted file mode 100644 index 5f8805fe1..000000000 --- a/examples-testing/examples/physics_rapier_joints.ts +++ /dev/null @@ -1,130 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; -import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let physics, pivot, physicsHelper; - -init(); - -async function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfd1e5); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 3, 10); - - const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); - - scene.add(ambient); - - const light = new THREE.DirectionalLight(0xffffff, 4); - - light.position.set(0, 12.5, 12.5); - light.castShadow = true; - light.shadow.radius = 3; - light.shadow.blurSamples = 8; - light.shadow.mapSize.width = 1024; - light.shadow.mapSize.height = 1024; - - const size = 10; - light.shadow.camera.left = -size; - light.shadow.camera.bottom = -size; - light.shadow.camera.right = size; - light.shadow.camera.top = size; - light.shadow.camera.near = 1; - light.shadow.camera.far = 50; - - scene.add(light); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - renderer.setAnimationLoop(animate); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target = new THREE.Vector3(0, 2, 0); - controls.update(); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - //Create pivot point - const geometry = new THREE.SphereGeometry(0.5); - const material = new THREE.MeshStandardMaterial({ color: 0xff0000 }); - - pivot = new THREE.Mesh(geometry, material); - - pivot.position.y = 6; - pivot.userData.physics = { mass: 0 }; - - scene.add(pivot); - - initPhysics(); - - onWindowResize(); - - window.addEventListener('resize', onWindowResize, false); -} - -async function initPhysics() { - //Initialize physics engine using the script in the jsm/physics folder - physics = await RapierPhysics(); - - physics.addScene(scene); - - //Optionally display collider outlines - physicsHelper = new RapierHelper(physics.world); - scene.add(physicsHelper); - - const link1 = addLink(pivot, 0); - const link2 = addLink(link1, 2); - addLink(link2, 4); -} - -//link - the mesh that the new link will be attached to -//x - used to position the new link -function addLink(link, x) { - const geometry = new THREE.CapsuleGeometry(0.25, 1.8); - const material = new THREE.MeshStandardMaterial({ color: 0xcccc00 }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.rotateZ(Math.PI * 0.5); - - mesh.position.set(x + 0.9, 5.8, 0); - - scene.add(mesh); - - physics.addMesh(mesh, 1, 0.5); - - const jointParams = physics.RAPIER.JointData.spherical( - link == pivot ? new physics.RAPIER.Vector3(0, -0.5, 0) : new physics.RAPIER.Vector3(0, -1.15, 0), // Joint position in world space - new physics.RAPIER.Vector3(0, 1.15, 0), // Corresponding attachment on sphere - ); - const body1 = link.userData.physics.body; - const body2 = mesh.userData.physics.body; - body2.setAngularDamping(10.0); - - physics.world.createImpulseJoint(jointParams, body1, body2, true); - - return mesh; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - if (physicsHelper) physicsHelper.update(); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/physics_rapier_terrain.ts b/examples-testing/examples/physics_rapier_terrain.ts deleted file mode 100644 index 7708ceab8..000000000 --- a/examples-testing/examples/physics_rapier_terrain.ts +++ /dev/null @@ -1,295 +0,0 @@ -import * as THREE from 'three'; -import Stats from 'three/addons/libs/stats.module.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; - -// Heightfield parameters -const terrainWidthExtents = 100; -const terrainDepthExtents = 100; -const terrainWidth = 128; -const terrainDepth = 128; -const terrainHalfWidth = terrainWidth / 2; -const terrainHalfDepth = terrainDepth / 2; -const terrainMaxHeight = 8; -const terrainMinHeight = -2; - -// Graphics variables -let container, stats; -let camera, scene, renderer; -let terrainMesh; -const timer = new THREE.Timer(); -timer.connect(document); - -// Physics variables -let physics; -const dynamicObjects = []; -let heightData = null; - -let time = 0; -const objectTimePeriod = 3; -let timeNextSpawn = time + objectTimePeriod; -const maxNumObjects = 30; - -init(); - -async function init() { - heightData = generateHeight(terrainWidth, terrainDepth, terrainMinHeight, terrainMaxHeight); - initGraphics(); - await initPhysics(); - // Start animation loop only after physics is initialized - renderer.setAnimationLoop(animate); -} - -function initGraphics() { - container = document.getElementById('container'); - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - // Remove setAnimationLoop from here since we'll start it after physics init - renderer.shadowMap.enabled = true; - container.appendChild(renderer.domElement); - - stats = new Stats(); - stats.domElement.style.position = 'absolute'; - stats.domElement.style.top = '0px'; - container.appendChild(stats.domElement); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.2, 2000); - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfd1e5); - - camera.position.y = - heightData[terrainHalfWidth + terrainHalfDepth * terrainWidth] * (terrainMaxHeight - terrainMinHeight) + 5; - camera.position.z = terrainDepthExtents / 2; - camera.lookAt(0, 0, 0); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - - const geometry = new THREE.PlaneGeometry( - terrainWidthExtents, - terrainDepthExtents, - terrainWidth - 1, - terrainDepth - 1, - ); - geometry.rotateX(-Math.PI / 2); - - const vertices = geometry.attributes.position.array; - - for (let i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) { - vertices[j + 1] = heightData[i]; - } - - geometry.computeVertexNormals(); - - const groundMaterial = new THREE.MeshPhongMaterial({ color: 0xc7c7c7 }); - terrainMesh = new THREE.Mesh(geometry, groundMaterial); - terrainMesh.receiveShadow = true; - terrainMesh.castShadow = true; - scene.add(terrainMesh); - - const textureLoader = new THREE.TextureLoader(); - textureLoader.load('textures/grid.png', function (texture) { - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.repeat.set(terrainWidth - 1, terrainDepth - 1); - groundMaterial.map = texture; - groundMaterial.needsUpdate = true; - }); - - const ambientLight = new THREE.AmbientLight(0xbbbbbb); - scene.add(ambientLight); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(100, 100, 50); - light.castShadow = true; - const dLight = 200; - const sLight = dLight * 0.25; - light.shadow.camera.left = -sLight; - light.shadow.camera.right = sLight; - light.shadow.camera.top = sLight; - light.shadow.camera.bottom = -sLight; - light.shadow.camera.near = dLight / 30; - light.shadow.camera.far = dLight; - light.shadow.mapSize.x = 1024 * 2; - light.shadow.mapSize.y = 1024 * 2; - scene.add(light); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function initPhysics() { - physics = await RapierPhysics(); - - // Create the terrain body using RapierPhysics module - physics.addHeightfield(terrainMesh, terrainWidth - 1, terrainDepth - 1, heightData, { - x: terrainWidthExtents, - y: 1.0, - z: terrainDepthExtents, - }); - - // Continue with adding other dynamic objects as needed -} - -function generateHeight(width, depth, minHeight, maxHeight) { - const size = width * depth; - const data = new Float32Array(size); - const hRange = maxHeight - minHeight; - const w2 = width / 2; - const d2 = depth / 2; - const phaseMult = 12; - let p = 0; - - for (let j = 0; j < depth; j++) { - for (let i = 0; i < width; i++) { - const radius = Math.sqrt(Math.pow((i - w2) / w2, 2.0) + Math.pow((j - d2) / d2, 2.0)); - const height = (Math.sin(radius * phaseMult) + 1) * 0.5 * hRange + minHeight; - data[p] = height; - p++; - } - } - - return data; -} - -function generateObject() { - const numTypes = 3; // cones not working - const objectType = Math.ceil(Math.random() * numTypes); - let threeObject = null; - const objectSize = 3; - let radius, height; - - switch (objectType) { - case 1: // Sphere - radius = 1 + Math.random() * objectSize; - threeObject = new THREE.Mesh(new THREE.SphereGeometry(radius, 20, 20), createObjectMaterial()); - break; - case 2: // Box - const sx = 1 + Math.random() * objectSize; - const sy = 1 + Math.random() * objectSize; - const sz = 1 + Math.random() * objectSize; - threeObject = new THREE.Mesh(new THREE.BoxGeometry(sx, sy, sz, 1, 1, 1), createObjectMaterial()); - break; - case 3: // Cylinder - radius = 1 + Math.random() * objectSize; - height = 1 + Math.random() * objectSize; - threeObject = new THREE.Mesh( - new THREE.CylinderGeometry(radius, radius, height, 20, 1), - createObjectMaterial(), - ); - break; - default: // Cone - radius = 1 + Math.random() * objectSize; - height = 2 + Math.random() * objectSize; - threeObject = new THREE.Mesh(new THREE.ConeGeometry(radius, height, 20, 2), createObjectMaterial()); - break; - } - - // Position objects higher and with more randomization to prevent clustering - threeObject.position.set( - (Math.random() - 0.5) * terrainWidth * 0.6, - terrainMaxHeight + objectSize + 15 + Math.random() * 5, // Even higher with randomization - (Math.random() - 0.5) * terrainDepth * 0.6, - ); - - const mass = objectSize * 5; - const restitution = 0.3; // Add some bounciness - - // Add to scene first - scene.add(threeObject); - - // Add physics to the object - physics.addMesh(threeObject, mass, restitution); - - // Store the object for later reference - dynamicObjects.push(threeObject); - - // Force a small delay before adding the next object - timeNextSpawn = time + 0.5; - - threeObject.receiveShadow = true; - threeObject.castShadow = true; -} - -function createObjectMaterial() { - const c = Math.floor(Math.random() * (1 << 24)); - return new THREE.MeshPhongMaterial({ color: c }); -} - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - const deltaTime = timer.getDelta(); - - // Generate new objects with a delay between them - if (dynamicObjects.length < maxNumObjects && time > timeNextSpawn) { - // Generate object directly in this frame - generateObject(); - // timeNextSpawn is now set in generateObject() - } - - // Clean up objects that have fallen off the terrain - for (let i = dynamicObjects.length - 1; i >= 0; i--) { - const obj = dynamicObjects[i]; - if (obj.position.y < terrainMinHeight - 10) { - // Remove from scene and physics world - scene.remove(obj); - dynamicObjects.splice(i, 1); - } - } - - updatePhysics(); - renderer.render(scene, camera); - time += deltaTime; -} - -function updatePhysics() { - // Check for objects that might need help with physics - for (let i = 0, il = dynamicObjects.length; i < il; i++) { - const objThree = dynamicObjects[i]; - - // If object is not moving but should be (based on height), try to fix it - if (objThree.position.y > 1.0) { - // Check if physics body exists - if (objThree.userData && objThree.userData.physics && objThree.userData.physics.body) { - const body = objThree.userData.physics.body; - - // Make sure body is awake - if (typeof body.wakeUp === 'function') { - body.wakeUp(); - } - - // Check velocity and apply impulse if needed - if (typeof body.linvel === 'function') { - const velocity = body.linvel(); - const speed = Math.sqrt( - velocity.x * velocity.x + velocity.y * velocity.y + velocity.z * velocity.z, - ); - - // If object is very slow, give it a stronger impulse - if (speed < 0.5) { - body.applyImpulse({ x: 0, y: -2.0, z: 0 }, true); - } - } - } else { - // If the object doesn't have a physics body but should, recreate it - const mass = 5; // Default mass - const restitution = 0.3; // Default restitution - - // Recreate physics for the object - physics.addMesh(objThree, mass, restitution); - } - } - } -} diff --git a/examples-testing/examples/physics_rapier_vehicle_controller.ts b/examples-testing/examples/physics_rapier_vehicle_controller.ts deleted file mode 100644 index fac5ef082..000000000 --- a/examples-testing/examples/physics_rapier_vehicle_controller.ts +++ /dev/null @@ -1,297 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; -import { RapierHelper } from 'three/addons/helpers/RapierHelper.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let physics, physicsHelper, controls; -let car, chassis, wheels, movement, vehicleController; - -init(); - -async function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfd1e5); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 4, 10); - - const ambient = new THREE.HemisphereLight(0x555555, 0xffffff); - - scene.add(ambient); - - const light = new THREE.DirectionalLight(0xffffff, 4); - - light.position.set(0, 12.5, 12.5); - light.castShadow = true; - light.shadow.radius = 3; - light.shadow.blurSamples = 8; - light.shadow.mapSize.width = 2048; - light.shadow.mapSize.height = 2048; - - const size = 40; - light.shadow.camera.left = -size; - light.shadow.camera.bottom = -size; - light.shadow.camera.right = size; - light.shadow.camera.top = size; - light.shadow.camera.near = 1; - light.shadow.camera.far = 50; - - scene.add(light); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - renderer.setAnimationLoop(animate); - - controls = new OrbitControls(camera, renderer.domElement); - controls.target = new THREE.Vector3(0, 2, 0); - controls.update(); - - const geometry = new THREE.BoxGeometry(100, 0.5, 100); - const material = new THREE.MeshStandardMaterial({ color: 0xffffff }); - - const ground = new THREE.Mesh(geometry, material); - ground.receiveShadow = true; - - ground.position.set(0, -0.25, -20); - ground.userData.physics = { mass: 0 }; - - scene.add(ground); - - new THREE.TextureLoader().load('textures/grid.png', function (texture) { - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.repeat.set(80, 80); - ground.material.map = texture; - ground.material.needsUpdate = true; - }); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - initPhysics(); - - onWindowResize(); - - // Movement input - movement = { - forward: 0, - right: 0, - brake: 0, - reset: false, - accelerateForce: { value: 0, min: -30, max: 30, step: 1 }, - brakeForce: { value: 0, min: 0, max: 1, step: 0.05 }, - }; - - window.addEventListener('keydown', event => { - //console.log( event.key ); - if (event.key === 'w' || event.key === 'ArrowUp') movement.forward = -1; - if (event.key === 's' || event.key === 'ArrowDown') movement.forward = 1; - if (event.key === 'a' || event.key === 'ArrowLeft') movement.right = 1; - if (event.key === 'd' || event.key === 'ArrowRight') movement.right = -1; - if (event.key === 'r') movement.reset = true; - if (event.key === ' ') movement.brake = 1; - }); - - window.addEventListener('keyup', event => { - if (event.key === 'w' || event.key === 's' || event.key === 'ArrowUp' || event.key === 'ArrowDown') - movement.forward = 0; - if (event.key === 'a' || event.key === 'd' || event.key === 'ArrowLeft' || event.key === 'ArrowRight') - movement.right = 0; - if (event.key === 'r') movement.reset = false; - if (event.key === ' ') movement.brake = 0; - }); - - window.addEventListener('resize', onWindowResize, false); -} - -async function initPhysics() { - //Initialize physics engine using the script in the jsm/physics folder - physics = await RapierPhysics(); - - //Optionally display collider outlines - physicsHelper = new RapierHelper(physics.world); - scene.add(physicsHelper); - - physics.addScene(scene); - - createCar(); -} - -function createCar() { - const geometry = new THREE.BoxGeometry(2, 1, 4); - const material = new THREE.MeshStandardMaterial({ color: 0xff0000 }); - const mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - scene.add(mesh); - car = mesh; - - mesh.position.y = 1; - - physics.addMesh(mesh, 10, 0.8); // addMesh places the RigidBody in the mesh.userData.physics object - chassis = mesh.userData.physics.body; - - vehicleController = physics.world.createVehicleController(chassis); - - wheels = []; - - addWheel(0, { x: -1, y: 0, z: -1.5 }, mesh); - addWheel(1, { x: 1, y: 0, z: -1.5 }, mesh); - addWheel(2, { x: -1, y: 0, z: 1.5 }, mesh); - addWheel(3, { x: 1, y: 0, z: 1.5 }, mesh); - - vehicleController.setWheelSteering(0, Math.PI / 4); - vehicleController.setWheelSteering(1, Math.PI / 4); -} - -function addWheel(index, pos, carMesh) { - // Define wheel properties - const wheelRadius = 0.3; - const wheelWidth = 0.4; - const suspensionRestLength = 0.8; - const wheelPosition = pos; // Position relative to chassis - const wheelDirection = { x: 0.0, y: -1.0, z: 0.0 }; // Downward direction - const wheelAxle = { x: -1.0, y: 0.0, z: 0.0 }; // Axle direction - - // Add the wheel to the vehicle controller - vehicleController.addWheel(wheelPosition, wheelDirection, wheelAxle, suspensionRestLength, wheelRadius); - - // Set suspension stiffness for wheel - vehicleController.setWheelSuspensionStiffness(index, 24.0); - - // Set wheel friction - vehicleController.setWheelFrictionSlip(index, 1000.0); - - // Enable steering for the wheel - vehicleController.setWheelSteering(index, pos.z < 0); - - // Create a wheel mesh - const geometry = new THREE.CylinderGeometry(wheelRadius, wheelRadius, wheelWidth, 16); - geometry.rotateZ(Math.PI * 0.5); - const material = new THREE.MeshStandardMaterial({ color: 0x000000 }); - const wheel = new THREE.Mesh(geometry, material); - - wheel.castShadow = true; - - wheel.position.copy(pos); - - wheels.push(wheel); - carMesh.add(wheel); -} - -function updateWheels() { - if (vehicleController === undefined) return; - - const wheelSteeringQuat = new THREE.Quaternion(); - const wheelRotationQuat = new THREE.Quaternion(); - const up = new THREE.Vector3(0, 1, 0); - - //const chassisPosition = chassis.translation(); - - wheels.forEach((wheel, index) => { - const wheelAxleCs = vehicleController.wheelAxleCs(index); - const connection = vehicleController.wheelChassisConnectionPointCs(index).y || 0; - const suspension = vehicleController.wheelSuspensionLength(index) || 0; - const steering = vehicleController.wheelSteering(index) || 0; - const rotationRad = vehicleController.wheelRotation(index) || 0; - - wheel.position.y = connection - suspension; - - wheelSteeringQuat.setFromAxisAngle(up, steering); - wheelRotationQuat.setFromAxisAngle(wheelAxleCs, rotationRad); - - wheel.quaternion.multiplyQuaternions(wheelSteeringQuat, wheelRotationQuat); - }); -} - -function updateCarControl() { - if (movement.reset) { - chassis.setTranslation(new physics.RAPIER.Vector3(0, 1, 0), true); - chassis.setRotation(new physics.RAPIER.Quaternion(0, 0, 0, 1), true); - chassis.setLinvel(new physics.RAPIER.Vector3(0, 0, 0), true); - chassis.setAngvel(new physics.RAPIER.Vector3(0, 0, 0), true); - - movement.accelerateForce.value = 0; - movement.brakeForce.value = 0; - - return; - } - - let accelerateForce = 0; - - if (movement.forward < 0) { - //if (movement.accelerateForce.value === 0) chassis.wakeUp(); - accelerateForce = movement.accelerateForce.value - movement.accelerateForce.step; - if (accelerateForce < movement.accelerateForce.min) accelerateForce = movement.accelerateForce.min; - } else if (movement.forward > 0) { - //if (movement.accelerateForce.value === 0) chassis.wakeUp(); - accelerateForce = movement.accelerateForce.value + movement.accelerateForce.step; - - if (accelerateForce > movement.accelerateForce.max) accelerateForce = movement.accelerateForce.max; - } else { - if (chassis.isSleeping()) chassis.wakeUp(); - } - - movement.accelerateForce.value = accelerateForce; - - //console.log(accelerateForce); - - let brakeForce = 0; - - if (movement.brake > 0) { - brakeForce = movement.brakeForce.value + movement.brakeForce.step; - if (brakeForce > movement.brakeForce.max) brakeForce = movement.brakeForce.max; - } - - movement.brakeForce.value = brakeForce; - - const engineForce = accelerateForce; - - vehicleController.setWheelEngineForce(0, engineForce); - vehicleController.setWheelEngineForce(1, engineForce); - - const currentSteering = vehicleController.wheelSteering(0); - const steerDirection = movement.right; - const steerAngle = Math.PI / 4; - - const steering = THREE.MathUtils.lerp(currentSteering, steerAngle * steerDirection, 0.25); - - vehicleController.setWheelSteering(0, steering); - vehicleController.setWheelSteering(1, steering); - - const wheelBrake = movement.brake * brakeForce; - vehicleController.setWheelBrake(0, wheelBrake); - vehicleController.setWheelBrake(1, wheelBrake); - vehicleController.setWheelBrake(2, wheelBrake); - vehicleController.setWheelBrake(3, wheelBrake); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - if (vehicleController) { - updateCarControl(); - vehicleController.updateVehicle(1 / 60); - updateWheels(); - } - - if (controls && car) { - controls.target.copy(car.position); - controls.update(); - } - - if (physicsHelper) physicsHelper.update(); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/svg_lines.ts b/examples-testing/examples/svg_lines.ts deleted file mode 100644 index 99b74c405..000000000 --- a/examples-testing/examples/svg_lines.ts +++ /dev/null @@ -1,87 +0,0 @@ -import * as THREE from 'three'; - -import { SVGRenderer } from 'three/addons/renderers/SVGRenderer.js'; - -THREE.ColorManagement.enabled = false; - -let camera, scene, renderer; - -init(); -animate(); - -function init() { - camera = new THREE.PerspectiveCamera(33, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 10; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0, 0, 0); - - renderer = new SVGRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - // - - const vertices = []; - const divisions = 50; - - for (let i = 0; i <= divisions; i++) { - const v = (i / divisions) * (Math.PI * 2); - - const x = Math.sin(v); - const z = Math.cos(v); - - vertices.push(x, 0, z); - } - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - // - - for (let i = 1; i <= 3; i++) { - const material = new THREE.LineBasicMaterial({ - color: Math.random() * 0xffffff, - linewidth: 10, - }); - const line = new THREE.Line(geometry, material); - line.scale.setScalar(i / 3); - scene.add(line); - } - - const material = new THREE.LineDashedMaterial({ - color: 'blue', - linewidth: 1, - dashSize: 10, - gapSize: 10, - }); - const line = new THREE.Line(geometry, material); - line.scale.setScalar(2); - scene.add(line); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - let count = 0; - const time = performance.now() / 1000; - - scene.traverse(function (child) { - child.rotation.x = count + time / 3; - child.rotation.z = count + time / 4; - - count++; - }); - - renderer.render(scene, camera); - requestAnimationFrame(animate); -} diff --git a/examples-testing/examples/svg_sandbox.ts b/examples-testing/examples/svg_sandbox.ts deleted file mode 100644 index fa66f10e1..000000000 --- a/examples-testing/examples/svg_sandbox.ts +++ /dev/null @@ -1,212 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { SVGRenderer, SVGObject } from 'three/addons/renderers/SVGRenderer.js'; - -THREE.ColorManagement.enabled = false; - -let camera, scene, renderer, stats, controls; - -let group; - -init(); -animate(); - -function init() { - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - // QRCODE - - const loader = new THREE.BufferGeometryLoader(); - loader.load('models/json/QRCode_buffergeometry.json', function (geometry) { - mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ vertexColors: true })); - mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.add(mesh); - }); - - // CUBES - - const boxGeometry = new THREE.BoxGeometry(100, 100, 100); - - let mesh = new THREE.Mesh( - boxGeometry, - new THREE.MeshBasicMaterial({ color: 0x0000ff, opacity: 0.5, transparent: true }), - ); - mesh.position.x = 500; - mesh.rotation.x = Math.random(); - mesh.rotation.y = Math.random(); - mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.add(mesh); - - mesh = new THREE.Mesh(boxGeometry, new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff })); - mesh.position.x = 500; - mesh.position.y = 500; - mesh.rotation.x = Math.random(); - mesh.rotation.y = Math.random(); - mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.add(mesh); - - // PLANE - - mesh = new THREE.Mesh( - new THREE.PlaneGeometry(100, 100), - new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff, side: THREE.DoubleSide }), - ); - mesh.position.y = -500; - mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.add(mesh); - - // CYLINDER - - mesh = new THREE.Mesh( - new THREE.CylinderGeometry(20, 100, 200, 10), - new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff }), - ); - mesh.position.x = -500; - mesh.rotation.x = -Math.PI / 2; - mesh.scale.x = mesh.scale.y = mesh.scale.z = 2; - scene.add(mesh); - - // POLYFIELD - - const geometry = new THREE.BufferGeometry(); - const material = new THREE.MeshBasicMaterial({ vertexColors: true, side: THREE.DoubleSide }); - - const v = new THREE.Vector3(); - const v0 = new THREE.Vector3(); - const v1 = new THREE.Vector3(); - const v2 = new THREE.Vector3(); - const color = new THREE.Color(); - - const vertices = []; - const colors = []; - - for (let i = 0; i < 100; i++) { - v.set(Math.random() * 1000 - 500, Math.random() * 1000 - 500, Math.random() * 1000 - 500); - - v0.set(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); - - v1.set(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); - - v2.set(Math.random() * 100 - 50, Math.random() * 100 - 50, Math.random() * 100 - 50); - - v0.add(v); - v1.add(v); - v2.add(v); - - color.setHex(Math.random() * 0xffffff); - - // create a single triangle - - vertices.push(v0.x, v0.y, v0.z); - vertices.push(v1.x, v1.y, v1.z); - vertices.push(v2.x, v2.y, v2.z); - - colors.push(color.r, color.g, color.b); - colors.push(color.r, color.g, color.b); - colors.push(color.r, color.g, color.b); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - group = new THREE.Mesh(geometry, material); - group.scale.set(2, 2, 2); - scene.add(group); - - // SPRITES - - for (let i = 0; i < 50; i++) { - const material = new THREE.SpriteMaterial({ color: Math.random() * 0xffffff }); - const sprite = new THREE.Sprite(material); - sprite.position.x = Math.random() * 1000 - 500; - sprite.position.y = Math.random() * 1000 - 500; - sprite.position.z = Math.random() * 1000 - 500; - sprite.scale.set(64, 64, 1); - scene.add(sprite); - } - - // CUSTOM - - const node = document.createElementNS('http://www.w3.org/2000/svg', 'circle'); - node.setAttribute('stroke', 'black'); - node.setAttribute('fill', 'red'); - node.setAttribute('r', '40'); - - for (let i = 0; i < 50; i++) { - const object = new SVGObject(node.cloneNode()); - object.position.x = Math.random() * 1000 - 500; - object.position.y = Math.random() * 1000 - 500; - object.position.z = Math.random() * 1000 - 500; - scene.add(object); - } - - // CUSTOM FROM FILE - - const fileLoader = new THREE.FileLoader(); - fileLoader.load('models/svg/hexagon.svg', function (svg) { - const node = document.createElementNS('http://www.w3.org/2000/svg', 'g'); - const parser = new DOMParser(); - const doc = parser.parseFromString(svg, 'image/svg+xml'); - - node.appendChild(doc.documentElement); - - const object = new SVGObject(node); - object.position.x = 500; - scene.add(object); - }); - - // LIGHTS - - const ambient = new THREE.AmbientLight(0x80ffff); - scene.add(ambient); - - const directional = new THREE.DirectionalLight(0xffff00); - directional.position.set(-1, 0.5, 0); - scene.add(directional); - - renderer = new SVGRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setQuality('low'); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - requestAnimationFrame(animate); - - render(); - stats.update(); -} - -function render() { - group.rotation.x += 0.01; - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webaudio_orientation.ts b/examples-testing/examples/webaudio_orientation.ts deleted file mode 100644 index 7baaa88a0..000000000 --- a/examples-testing/examples/webaudio_orientation.ts +++ /dev/null @@ -1,141 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { PositionalAudioHelper } from 'three/addons/helpers/PositionalAudioHelper.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let scene, camera, renderer; - -const startButton = document.getElementById('startButton'); -startButton.addEventListener('click', init); - -function init() { - const overlay = document.getElementById('overlay'); - overlay.remove(); - - const container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(3, 2, 3); - - const reflectionCube = new THREE.CubeTextureLoader() - .setPath('textures/cube/SwedishRoyalCastle/') - .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 2, 20); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); - hemiLight.position.set(0, 20, 0); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(5, 5, 0); - dirLight.castShadow = true; - dirLight.shadow.camera.top = 1; - dirLight.shadow.camera.bottom = -1; - dirLight.shadow.camera.left = -1; - dirLight.shadow.camera.right = 1; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = 20; - scene.add(dirLight); - - // scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) ); - - // - - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(50, 50), - new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), - ); - mesh.rotation.x = -Math.PI / 2; - mesh.receiveShadow = true; - scene.add(mesh); - - const grid = new THREE.GridHelper(50, 50, 0xc1c1c1, 0xc1c1c1); - scene.add(grid); - - // - - const listener = new THREE.AudioListener(); - camera.add(listener); - - const audioElement = document.getElementById('music'); - audioElement.play(); - - const positionalAudio = new THREE.PositionalAudio(listener); - positionalAudio.setMediaElementSource(audioElement); - positionalAudio.setRefDistance(1); - positionalAudio.setDirectionalCone(180, 230, 0.1); - - const helper = new PositionalAudioHelper(positionalAudio, 0.1); - positionalAudio.add(helper); - - // - - const gltfLoader = new GLTFLoader(); - gltfLoader.load('models/gltf/BoomBox.glb', function (gltf) { - const boomBox = gltf.scene; - boomBox.position.set(0, 0.2, 0); - boomBox.scale.set(20, 20, 20); - - boomBox.traverse(function (object) { - if (object.isMesh) { - object.material.envMap = reflectionCube; - object.geometry.rotateY(-Math.PI); - object.castShadow = true; - } - }); - - boomBox.add(positionalAudio); - scene.add(boomBox); - - renderer.setAnimationLoop(animate); - }); - - // sound is damped behind this wall - - const wallGeometry = new THREE.BoxGeometry(2, 1, 0.1); - const wallMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, transparent: true, opacity: 0.5 }); - - const wall = new THREE.Mesh(wallGeometry, wallMaterial); - wall.position.set(0, 0.5, -0.5); - scene.add(wall); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - container.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.1, 0); - controls.update(); - controls.minDistance = 0.5; - controls.maxDistance = 10; - controls.maxPolarAngle = 0.5 * Math.PI; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webaudio_sandbox.ts b/examples-testing/examples/webaudio_sandbox.ts deleted file mode 100644 index 34afca985..000000000 --- a/examples-testing/examples/webaudio_sandbox.ts +++ /dev/null @@ -1,223 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; - -let camera, controls, scene, renderer, light; - -let material1, material2, material3; - -let analyser1, analyser2, analyser3; - -const timer = new THREE.Timer(); -timer.connect(document); - -const startButton = document.getElementById('startButton'); -startButton.addEventListener('click', init); - -function init() { - const overlay = document.getElementById('overlay'); - overlay.remove(); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(0, 25, 0); - - const listener = new THREE.AudioListener(); - camera.add(listener); - - scene = new THREE.Scene(); - scene.fog = new THREE.FogExp2(0x000000, 0.0025); - - light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 0.5, 1).normalize(); - scene.add(light); - - const sphere = new THREE.SphereGeometry(20, 32, 16); - - material1 = new THREE.MeshPhongMaterial({ color: 0xffaa00, flatShading: true, shininess: 0 }); - material2 = new THREE.MeshPhongMaterial({ color: 0xff2200, flatShading: true, shininess: 0 }); - material3 = new THREE.MeshPhongMaterial({ color: 0x6622aa, flatShading: true, shininess: 0 }); - - // sound spheres - - const mesh1 = new THREE.Mesh(sphere, material1); - mesh1.position.set(-250, 30, 0); - scene.add(mesh1); - - const sound1 = new THREE.PositionalAudio(listener); - const songElement = document.getElementById('song'); - sound1.setMediaElementSource(songElement); - sound1.setRefDistance(20); - songElement.play(); - mesh1.add(sound1); - - // - - const mesh2 = new THREE.Mesh(sphere, material2); - mesh2.position.set(250, 30, 0); - scene.add(mesh2); - - const sound2 = new THREE.PositionalAudio(listener); - const skullbeatzElement = document.getElementById('skullbeatz'); - sound2.setMediaElementSource(skullbeatzElement); - sound2.setRefDistance(20); - skullbeatzElement.play(); - mesh2.add(sound2); - - // - - const mesh3 = new THREE.Mesh(sphere, material3); - mesh3.position.set(0, 30, -250); - scene.add(mesh3); - - const sound3 = new THREE.PositionalAudio(listener); - const oscillator = listener.context.createOscillator(); - oscillator.type = 'sine'; - oscillator.frequency.setValueAtTime(144, sound3.context.currentTime); - oscillator.start(0); - sound3.setNodeSource(oscillator); - sound3.setRefDistance(20); - sound3.setVolume(0.5); - mesh3.add(sound3); - - // analysers - - analyser1 = new THREE.AudioAnalyser(sound1, 32); - analyser2 = new THREE.AudioAnalyser(sound2, 32); - analyser3 = new THREE.AudioAnalyser(sound3, 32); - - // global ambient audio - - const sound4 = new THREE.Audio(listener); - const utopiaElement = document.getElementById('utopia'); - sound4.setMediaElementSource(utopiaElement); - sound4.setVolume(0.5); - utopiaElement.play(); - - // ground - - const helper = new THREE.GridHelper(1000, 10, 0x444444, 0x444444); - helper.position.y = 0.1; - scene.add(helper); - - // - - const SoundControls = function () { - this.master = listener.getMasterVolume(); - this.firstSphere = sound1.getVolume(); - this.secondSphere = sound2.getVolume(); - this.thirdSphere = sound3.getVolume(); - this.Ambient = sound4.getVolume(); - }; - - const GeneratorControls = function () { - this.frequency = oscillator.frequency.value; - this.wavetype = oscillator.type; - }; - - const gui = new GUI(); - const soundControls = new SoundControls(); - const generatorControls = new GeneratorControls(); - const volumeFolder = gui.addFolder('sound volume'); - const generatorFolder = gui.addFolder('sound generator'); - - volumeFolder - .add(soundControls, 'master') - .min(0.0) - .max(1.0) - .step(0.01) - .onChange(function () { - listener.setMasterVolume(soundControls.master); - }); - volumeFolder - .add(soundControls, 'firstSphere') - .min(0.0) - .max(1.0) - .step(0.01) - .onChange(function () { - sound1.setVolume(soundControls.firstSphere); - }); - volumeFolder - .add(soundControls, 'secondSphere') - .min(0.0) - .max(1.0) - .step(0.01) - .onChange(function () { - sound2.setVolume(soundControls.secondSphere); - }); - - volumeFolder - .add(soundControls, 'thirdSphere') - .min(0.0) - .max(1.0) - .step(0.01) - .onChange(function () { - sound3.setVolume(soundControls.thirdSphere); - }); - volumeFolder - .add(soundControls, 'Ambient') - .min(0.0) - .max(1.0) - .step(0.01) - .onChange(function () { - sound4.setVolume(soundControls.Ambient); - }); - volumeFolder.open(); - generatorFolder - .add(generatorControls, 'frequency') - .min(50.0) - .max(5000.0) - .step(1.0) - .onChange(function () { - oscillator.frequency.setValueAtTime(generatorControls.frequency, listener.context.currentTime); - }); - generatorFolder - .add(generatorControls, 'wavetype', ['sine', 'square', 'sawtooth', 'triangle']) - .onChange(function () { - oscillator.type = generatorControls.wavetype; - }); - - generatorFolder.open(); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - controls = new FirstPersonControls(camera, renderer.domElement); - - controls.movementSpeed = 70; - controls.lookSpeed = 0.05; - controls.lookVertical = false; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - controls.update(delta); - - material1.emissive.b = analyser1.getAverageFrequency() / 256; - material2.emissive.b = analyser2.getAverageFrequency() / 256; - material3.emissive.b = analyser3.getAverageFrequency() / 256; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webaudio_timing.ts b/examples-testing/examples/webaudio_timing.ts deleted file mode 100644 index f37b5c5cf..000000000 --- a/examples-testing/examples/webaudio_timing.ts +++ /dev/null @@ -1,155 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let scene, camera, renderer, timer; - -const objects = []; - -const speed = 2.5; -const height = 3; -const offset = 0.5; - -const startButton = document.getElementById('startButton'); -startButton.addEventListener('click', init); - -function init() { - const overlay = document.getElementById('overlay'); - overlay.remove(); - - const container = document.getElementById('container'); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(7, 3, 7); - - // lights - - const ambientLight = new THREE.AmbientLight(0xcccccc); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); - directionalLight.position.set(0, 5, 5); - scene.add(directionalLight); - - const d = 5; - directionalLight.castShadow = true; - directionalLight.shadow.camera.left = -d; - directionalLight.shadow.camera.right = d; - directionalLight.shadow.camera.top = d; - directionalLight.shadow.camera.bottom = -d; - - directionalLight.shadow.camera.near = 1; - directionalLight.shadow.camera.far = 20; - - directionalLight.shadow.mapSize.x = 1024; - directionalLight.shadow.mapSize.y = 1024; - - // audio - - const audioLoader = new THREE.AudioLoader(); - - const listener = new THREE.AudioListener(); - camera.add(listener); - - // floor - - const floorGeometry = new THREE.PlaneGeometry(10, 10); - const floorMaterial = new THREE.MeshLambertMaterial({ color: 0x4676b6 }); - - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.rotation.x = Math.PI * -0.5; - floor.receiveShadow = true; - scene.add(floor); - - // objects - - const count = 5; - const radius = 3; - - const ballGeometry = new THREE.SphereGeometry(0.3, 32, 16); - ballGeometry.translate(0, 0.3, 0); - const ballMaterial = new THREE.MeshLambertMaterial({ color: 0xcccccc }); - - // create objects when audio buffer is loaded - - audioLoader.load('sounds/ping_pong.mp3', function (buffer) { - for (let i = 0; i < count; i++) { - const s = (i / count) * Math.PI * 2; - - const ball = new THREE.Mesh(ballGeometry, ballMaterial); - ball.castShadow = true; - ball.userData.down = false; - - ball.position.x = radius * Math.cos(s); - ball.position.z = radius * Math.sin(s); - - const audio = new THREE.PositionalAudio(listener); - audio.setBuffer(buffer); - ball.add(audio); - - scene.add(ball); - objects.push(ball); - } - - renderer.setAnimationLoop(animate); - }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - container.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 25; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const time = timer.getElapsed(); - - for (let i = 0; i < objects.length; i++) { - const ball = objects[i]; - - const previousHeight = ball.position.y; - ball.position.y = Math.abs(Math.sin(i * offset + time * speed) * height); - - if (ball.position.y < previousHeight) { - ball.userData.down = true; - } else { - if (ball.userData.down === true) { - // ball changed direction from down to up - - const audio = ball.children[0]; - audio.play(); // play audio with perfect timing when ball hits the surface - ball.userData.down = false; - } - } - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webaudio_visualizer.ts b/examples-testing/examples/webaudio_visualizer.ts deleted file mode 100644 index a3f58cb36..000000000 --- a/examples-testing/examples/webaudio_visualizer.ts +++ /dev/null @@ -1,86 +0,0 @@ -import * as THREE from 'three'; - -let scene, camera, renderer, analyser, uniforms; - -const startButton = document.getElementById('startButton'); -startButton.addEventListener('click', init); - -function init() { - const fftSize = 128; - - // - - const overlay = document.getElementById('overlay'); - overlay.remove(); - - // - - const container = document.getElementById('container'); - - scene = new THREE.Scene(); - - camera = new THREE.Camera(); - - // - - const listener = new THREE.AudioListener(); - - const audio = new THREE.Audio(listener); - const file = './sounds/376737_Skullbeatz___Bad_Cat_Maste.mp3'; - - if (/(iPad|iPhone|iPod)/g.test(navigator.userAgent)) { - const loader = new THREE.AudioLoader(); - loader.load(file, function (buffer) { - audio.setBuffer(buffer); - audio.play(); - }); - } else { - const mediaElement = new Audio(file); - mediaElement.play(); - - audio.setMediaElementSource(mediaElement); - } - - analyser = new THREE.AudioAnalyser(audio, fftSize); - - // - - uniforms = { - tAudioData: { value: new THREE.DataTexture(analyser.data, fftSize / 2, 1, THREE.RedFormat) }, - }; - - const material = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - }); - - const geometry = new THREE.PlaneGeometry(1, 1); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - analyser.getFrequencyData(); - - uniforms.tAudioData.value.needsUpdate = true; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_animation_keyframes.ts b/examples-testing/examples/webgl_animation_keyframes.ts deleted file mode 100644 index 117e7032e..000000000 --- a/examples-testing/examples/webgl_animation_keyframes.ts +++ /dev/null @@ -1,96 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Sky } from 'three/addons/objects/Sky.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -let mixer; - -const timer = new THREE.Timer(); -timer.connect(document); -const container = document.getElementById('container'); - -const stats = new Stats(); -container.appendChild(stats.dom); - -const renderer = new THREE.WebGLRenderer({ antialias: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.toneMapping = THREE.ACESFilmicToneMapping; -container.appendChild(renderer.domElement); - -const scene = new THREE.Scene(); - -// Sky - -const sky = new Sky(); -sky.scale.setScalar(10000); -scene.add(sky); - -const uniforms = sky.material.uniforms; -uniforms['turbidity'].value = 0; -uniforms['rayleigh'].value = 3; -uniforms['mieDirectionalG'].value = 0.7; -uniforms['cloudElevation'].value = 1; -uniforms['sunPosition'].value.set(-0.8, 0.19, 0.56); // elevation: 11, azimuth: -55 - -const pmremGenerator = new THREE.PMREMGenerator(renderer); -const environment = pmremGenerator.fromScene(sky).texture; -scene.environment = environment; - -const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); -camera.position.set(5, 2, 8); - -const controls = new OrbitControls(camera, renderer.domElement); -controls.enableDamping = true; -controls.target.set(0, 0.7, 0); -controls.update(); - -const dracoLoader = new DRACOLoader(); -dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - -const loader = new GLTFLoader(); -loader.setDRACOLoader(dracoLoader); -loader.load( - 'models/gltf/LittlestTokyo.glb', - function (gltf) { - const model = gltf.scene; - model.position.set(1, 1, 0); - model.scale.set(0.01, 0.01, 0.01); - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - mixer.clipAction(gltf.animations[0]).play(); - - renderer.setAnimationLoop(animate); - }, - undefined, - function (e) { - console.error(e); - }, -); - -window.onresize = function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -}; - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - mixer.update(delta); - - controls.update(); - - stats.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_animation_multiple.ts b/examples-testing/examples/webgl_animation_multiple.ts deleted file mode 100644 index 2456cb4cf..000000000 --- a/examples-testing/examples/webgl_animation_multiple.ts +++ /dev/null @@ -1,193 +0,0 @@ -import * as THREE from 'three'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, timer; -let model, animations; - -const mixers = [], - objects = []; - -const params = { - sharedSkeleton: false, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(2, 3, -6); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 10, 50); - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); - hemiLight.position.set(0, 20, 0); - scene.add(hemiLight); - - const sunLight = new THREE.SunLight(0xffffff, 3); - sunLight.position.set(-3, 10, -10); - sunLight.castShadow = true; - sunLight.shadow.camera.far = 20; - scene.add(sunLight); - - // ground - - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(200, 200), - new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), - ); - mesh.rotation.x = -Math.PI / 2; - mesh.receiveShadow = true; - scene.add(mesh); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Soldier.glb', function (gltf) { - model = gltf.scene; - animations = gltf.animations; - - model.traverse(function (object) { - if (object.isMesh) object.castShadow = true; - }); - - setupDefaultScene(); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'sharedSkeleton').onChange(function () { - clearScene(); - - if (params.sharedSkeleton === true) { - setupSharedSkeletonScene(); - } else { - setupDefaultScene(); - } - }); - gui.open(); -} - -function clearScene() { - for (const mixer of mixers) { - mixer.stopAllAction(); - } - - mixers.length = 0; - - // - - for (const object of objects) { - scene.remove(object); - - scene.traverse(function (child) { - if (child.isSkinnedMesh) child.skeleton.dispose(); - }); - } -} - -function setupDefaultScene() { - // three cloned models with independent skeletons. - // each model can have its own animation state - - const model1 = SkeletonUtils.clone(model); - const model2 = SkeletonUtils.clone(model); - const model3 = SkeletonUtils.clone(model); - - model1.position.x = -2; - model2.position.x = 0; - model3.position.x = 2; - - const mixer1 = new THREE.AnimationMixer(model1); - const mixer2 = new THREE.AnimationMixer(model2); - const mixer3 = new THREE.AnimationMixer(model3); - - mixer1.clipAction(animations[0]).play(); // idle - mixer2.clipAction(animations[1]).play(); // run - mixer3.clipAction(animations[3]).play(); // walk - - scene.add(model1, model2, model3); - - objects.push(model1, model2, model3); - mixers.push(mixer1, mixer2, mixer3); -} - -function setupSharedSkeletonScene() { - // three cloned models with a single shared skeleton. - // all models share the same animation state - - const sharedModel = SkeletonUtils.clone(model); - const shareSkinnedMesh = sharedModel.getObjectByName('vanguard_Mesh'); - const sharedSkeleton = shareSkinnedMesh.skeleton; - const sharedParentBone = sharedModel.getObjectByName('mixamorigHips'); - scene.add(sharedParentBone); // the bones need to be in the scene for the animation to work - - const model1 = shareSkinnedMesh.clone(); - const model2 = shareSkinnedMesh.clone(); - const model3 = shareSkinnedMesh.clone(); - - model1.bindMode = THREE.DetachedBindMode; - model2.bindMode = THREE.DetachedBindMode; - model3.bindMode = THREE.DetachedBindMode; - - const identity = new THREE.Matrix4(); - - model1.bind(sharedSkeleton, identity); - model2.bind(sharedSkeleton, identity); - model3.bind(sharedSkeleton, identity); - - model1.position.x = -2; - model2.position.x = 0; - model3.position.x = 2; - - // apply transformation from the glTF asset - - model1.scale.setScalar(0.01); - model1.rotation.x = -Math.PI * 0.5; - model2.scale.setScalar(0.01); - model2.rotation.x = -Math.PI * 0.5; - model3.scale.setScalar(0.01); - model3.rotation.x = -Math.PI * 0.5; - - // - - const mixer = new THREE.AnimationMixer(sharedParentBone); - mixer.clipAction(animations[1]).play(); - - scene.add(sharedParentBone, model1, model2, model3); - - objects.push(sharedParentBone, model1, model2, model3); - mixers.push(mixer); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - for (const mixer of mixers) mixer.update(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_animation_skinning_morph.ts b/examples-testing/examples/webgl_animation_skinning_morph.ts deleted file mode 100644 index 0ae68e7d7..000000000 --- a/examples-testing/examples/webgl_animation_skinning_morph.ts +++ /dev/null @@ -1,190 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let container, stats, timer, gui, mixer, actions, activeAction, previousAction; -let camera, scene, renderer, model, face; - -const api = { state: 'Walking' }; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 100); - camera.position.set(-5, 3, 10); - camera.lookAt(0, 2, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xe0e0e0); - scene.fog = new THREE.Fog(0xe0e0e0, 20, 100); - - timer = new THREE.Timer(); - timer.connect(document); - - // lights - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); - hemiLight.position.set(0, 20, 0); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(0, 20, 10); - scene.add(dirLight); - - // ground - - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(2000, 2000), - new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), - ); - mesh.rotation.x = -Math.PI / 2; - scene.add(mesh); - - const grid = new THREE.GridHelper(200, 40, 0x000000, 0x000000); - grid.material.opacity = 0.2; - grid.material.transparent = true; - scene.add(grid); - - // model - - const loader = new GLTFLoader(); - loader.load( - 'models/gltf/RobotExpressive/RobotExpressive.glb', - function (gltf) { - model = gltf.scene; - scene.add(model); - - createGUI(model, gltf.animations); - }, - undefined, - function (e) { - console.error(e); - }, - ); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - // stats - stats = new Stats(); - container.appendChild(stats.dom); -} - -function createGUI(model, animations) { - const states = ['Idle', 'Walking', 'Running', 'Dance', 'Death', 'Sitting', 'Standing']; - const emotes = ['Jump', 'Yes', 'No', 'Wave', 'Punch', 'ThumbsUp']; - - gui = new GUI(); - - mixer = new THREE.AnimationMixer(model); - - actions = {}; - - for (let i = 0; i < animations.length; i++) { - const clip = animations[i]; - const action = mixer.clipAction(clip); - actions[clip.name] = action; - - if (emotes.indexOf(clip.name) >= 0 || states.indexOf(clip.name) >= 4) { - action.clampWhenFinished = true; - action.loop = THREE.LoopOnce; - } - } - - // states - - const statesFolder = gui.addFolder('States'); - - const clipCtrl = statesFolder.add(api, 'state').options(states); - - clipCtrl.onChange(function () { - fadeToAction(api.state, 0.5); - }); - - statesFolder.open(); - - // emotes - - const emoteFolder = gui.addFolder('Emotes'); - - function createEmoteCallback(name) { - api[name] = function () { - fadeToAction(name, 0.2); - - mixer.addEventListener('finished', restoreState); - }; - - emoteFolder.add(api, name); - } - - function restoreState() { - mixer.removeEventListener('finished', restoreState); - - fadeToAction(api.state, 0.2); - } - - for (let i = 0; i < emotes.length; i++) { - createEmoteCallback(emotes[i]); - } - - emoteFolder.open(); - - // expressions - - face = model.getObjectByName('Head_4'); - - const expressions = Object.keys(face.morphTargetDictionary); - const expressionFolder = gui.addFolder('Expressions'); - - for (let i = 0; i < expressions.length; i++) { - expressionFolder.add(face.morphTargetInfluences, i, 0, 1, 0.01).name(expressions[i]); - } - - activeAction = actions['Walking']; - activeAction.play(); - - expressionFolder.open(); -} - -function fadeToAction(name, duration) { - previousAction = activeAction; - activeAction = actions[name]; - - if (previousAction !== activeAction) { - previousAction.fadeOut(duration); - } - - activeAction.reset().setEffectiveTimeScale(1).setEffectiveWeight(1).fadeIn(duration).play(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const dt = timer.getDelta(); - - if (mixer) mixer.update(dt); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_animation_walk.ts b/examples-testing/examples/webgl_animation_walk.ts deleted file mode 100644 index 88f4da5e8..000000000 --- a/examples-testing/examples/webgl_animation_walk.ts +++ /dev/null @@ -1,367 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let scene, renderer, camera, floor, orbitControls; -let group, model, skeleton, mixer, timer; - -let actions; - -const settings = { - show_skeleton: false, - fixe_transition: true, -}; - -const PI = Math.PI; -const PI90 = Math.PI / 2; - -const controls = { - key: [0, 0], - ease: new THREE.Vector3(), - position: new THREE.Vector3(), - up: new THREE.Vector3(0, 1, 0), - rotate: new THREE.Quaternion(), - current: 'Idle', - fadeDuration: 0.5, - runVelocity: 5, - walkVelocity: 1.8, - rotateSpeed: 0.05, - floorDecale: 0, -}; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 2, -5); - - timer = new THREE.Timer(); - timer.connect(document); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x5e5d5d); - scene.fog = new THREE.Fog(0x5e5d5d, 2, 20); - - group = new THREE.Group(); - scene.add(group); - - const sunLight = new THREE.SunLight(0xffffff, 5); - sunLight.position.set(-2, 5, -3); - sunLight.castShadow = true; - sunLight.shadow.camera.far = 20; - scene.add(sunLight); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.5; - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - container.appendChild(renderer.domElement); - - orbitControls = new OrbitControls(camera, renderer.domElement); - orbitControls.target.set(0, 1, 0); - orbitControls.enableDamping = true; - orbitControls.enablePan = false; - orbitControls.maxPolarAngle = PI90 - 0.05; - orbitControls.update(); - - // EVENTS - - window.addEventListener('resize', onWindowResize); - document.addEventListener('keydown', onKeyDown); - document.addEventListener('keyup', onKeyUp); - - // DEMO - - new HDRLoader().setPath('textures/equirectangular/').load('lobe.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - scene.environment = texture; - scene.environmentIntensity = 1.5; - - loadModel(); - addFloor(); - }); -} - -function addFloor() { - const size = 50; - const repeat = 16; - - const maxAnisotropy = renderer.capabilities.getMaxAnisotropy(); - - const floorT = new THREE.TextureLoader().load('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); - floorT.colorSpace = THREE.SRGBColorSpace; - floorT.repeat.set(repeat, repeat); - floorT.wrapS = floorT.wrapT = THREE.RepeatWrapping; - floorT.anisotropy = maxAnisotropy; - - const floorN = new THREE.TextureLoader().load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); - floorN.repeat.set(repeat, repeat); - floorN.wrapS = floorN.wrapT = THREE.RepeatWrapping; - floorN.anisotropy = maxAnisotropy; - - const mat = new THREE.MeshStandardMaterial({ - map: floorT, - normalMap: floorN, - normalScale: new THREE.Vector2(0.5, 0.5), - color: 0x404040, - depthWrite: false, - roughness: 0.85, - }); - - const g = new THREE.PlaneGeometry(size, size, 50, 50); - g.rotateX(-PI90); - - floor = new THREE.Mesh(g, mat); - floor.receiveShadow = true; - scene.add(floor); - - controls.floorDecale = (size / repeat) * 4; - - const bulbGeometry = new THREE.SphereGeometry(0.05, 16, 8); - const bulbLight = new THREE.PointLight(0xffee88, 2, 500, 2); - - const bulbMat = new THREE.MeshStandardMaterial({ emissive: 0xffffee, emissiveIntensity: 1, color: 0x000000 }); - bulbLight.add(new THREE.Mesh(bulbGeometry, bulbMat)); - bulbLight.position.set(1, 0.1, -3); - bulbLight.castShadow = true; - floor.add(bulbLight); -} - -function loadModel() { - const loader = new GLTFLoader(); - loader.load('models/gltf/Soldier.glb', function (gltf) { - model = gltf.scene; - group.add(model); - model.rotation.y = PI; - group.rotation.y = PI; - - model.traverse(function (object) { - if (object.isMesh) { - if (object.name == 'vanguard_Mesh') { - object.castShadow = true; - object.receiveShadow = true; - //object.material.envMapIntensity = 0.5; - object.material.metalness = 1.0; - object.material.roughness = 0.2; - object.material.color.set(1, 1, 1); - object.material.metalnessMap = object.material.map; - } else { - object.material.metalness = 1; - object.material.roughness = 0; - object.material.transparent = true; - object.material.opacity = 0.8; - object.material.color.set(1, 1, 1); - } - } - }); - - // - - skeleton = new THREE.SkeletonHelper(model); - skeleton.setColors(new THREE.Color(0xe000ff), new THREE.Color(0x00e0ff)); - skeleton.visible = false; - scene.add(skeleton); - - // - - createPanel(); - - // - - const animations = gltf.animations; - - mixer = new THREE.AnimationMixer(model); - - actions = { - Idle: mixer.clipAction(animations[0]), - Walk: mixer.clipAction(animations[3]), - Run: mixer.clipAction(animations[1]), - }; - - for (const m in actions) { - actions[m].enabled = true; - actions[m].setEffectiveTimeScale(1); - if (m !== 'Idle') actions[m].setEffectiveWeight(0); - } - - actions.Idle.play(); - - animate(); - }); -} - -function updateCharacter(delta) { - const fade = controls.fadeDuration; - const key = controls.key; - const up = controls.up; - const ease = controls.ease; - const rotate = controls.rotate; - const position = controls.position; - const azimuth = orbitControls.getAzimuthalAngle(); - - const active = key[0] === 0 && key[1] === 0 ? false : true; - const play = active ? (key[2] ? 'Run' : 'Walk') : 'Idle'; - - // change animation - - if (controls.current != play) { - const current = actions[play]; - const old = actions[controls.current]; - controls.current = play; - - if (settings.fixe_transition) { - current.reset(); - current.weight = 1.0; - current.stopFading(); - old.stopFading(); - // synchro if not idle - if (play !== 'Idle') current.time = old.time * (current.getClip().duration / old.getClip().duration); - old._scheduleFading(fade, old.getEffectiveWeight(), 0); - current._scheduleFading(fade, current.getEffectiveWeight(), 1); - current.play(); - } else { - setWeight(current, 1.0); - old.fadeOut(fade); - current.reset().fadeIn(fade).play(); - } - } - - // move object - - if (controls.current !== 'Idle') { - // run/walk velocity - const velocity = controls.current == 'Run' ? controls.runVelocity : controls.walkVelocity; - - // direction with key - ease.set(key[1], 0, key[0]).multiplyScalar(velocity * delta); - - // calculate camera direction - const angle = unwrapRad(Math.atan2(ease.x, ease.z) + azimuth); - rotate.setFromAxisAngle(up, angle); - - // apply camera angle on ease - controls.ease.applyAxisAngle(up, azimuth); - - position.add(ease); - camera.position.add(ease); - - group.position.copy(position); - group.quaternion.rotateTowards(rotate, controls.rotateSpeed); - - orbitControls.target.copy(position).add({ x: 0, y: 1, z: 0 }); - - // Move the floor without any limit - const dx = position.x - floor.position.x; - const dz = position.z - floor.position.z; - if (Math.abs(dx) > controls.floorDecale) floor.position.x += dx; - if (Math.abs(dz) > controls.floorDecale) floor.position.z += dz; - } - - if (mixer) mixer.update(delta); - - orbitControls.update(); -} - -function unwrapRad(r) { - return Math.atan2(Math.sin(r), Math.cos(r)); -} - -function createPanel() { - const panel = new GUI({ width: 310 }); - - panel.add(settings, 'show_skeleton').onChange(b => { - skeleton.visible = b; - }); - - panel.add(settings, 'fixe_transition'); -} - -function setWeight(action, weight) { - action.enabled = true; - action.setEffectiveTimeScale(1); - action.setEffectiveWeight(weight); -} - -function onKeyDown(event) { - const key = controls.key; - switch (event.code) { - case 'ArrowUp': - case 'KeyW': - case 'KeyZ': - key[0] = -1; - break; - case 'ArrowDown': - case 'KeyS': - key[0] = 1; - break; - case 'ArrowLeft': - case 'KeyA': - case 'KeyQ': - key[1] = -1; - break; - case 'ArrowRight': - case 'KeyD': - key[1] = 1; - break; - case 'ShiftLeft': - case 'ShiftRight': - key[2] = 1; - break; - } -} - -function onKeyUp(event) { - const key = controls.key; - switch (event.code) { - case 'ArrowUp': - case 'KeyW': - case 'KeyZ': - key[0] = key[0] < 0 ? 0 : key[0]; - break; - case 'ArrowDown': - case 'KeyS': - key[0] = key[0] > 0 ? 0 : key[0]; - break; - case 'ArrowLeft': - case 'KeyA': - case 'KeyQ': - key[1] = key[1] < 0 ? 0 : key[1]; - break; - case 'ArrowRight': - case 'KeyD': - key[1] = key[1] > 0 ? 0 : key[1]; - break; - case 'ShiftLeft': - case 'ShiftRight': - key[2] = 0; - break; - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - // Render loop - - const delta = timer.getDelta(); - - updateCharacter(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_buffergeometry.ts b/examples-testing/examples/webgl_buffergeometry.ts deleted file mode 100644 index 28b2c96a4..000000000 --- a/examples-testing/examples/webgl_buffergeometry.ts +++ /dev/null @@ -1,178 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let mesh; - -init(); -animate(); - -function init() { - container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); - camera.position.z = 2750; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const light1 = new THREE.DirectionalLight(0xffffff, 1.5); - light1.position.set(1, 1, 1); - scene.add(light1); - - const light2 = new THREE.DirectionalLight(0xffffff, 4.5); - light2.position.set(0, -1, 0); - scene.add(light2); - - // - - const triangles = 160000; - - const geometry = new THREE.BufferGeometry(); - - const positions = []; - const normals = []; - const colors = []; - - const color = new THREE.Color(); - - const n = 800, - n2 = n / 2; // triangles spread in the cube - const d = 12, - d2 = d / 2; // individual triangle size - - const pA = new THREE.Vector3(); - const pB = new THREE.Vector3(); - const pC = new THREE.Vector3(); - - const cb = new THREE.Vector3(); - const ab = new THREE.Vector3(); - - for (let i = 0; i < triangles; i++) { - // positions - - const x = Math.random() * n - n2; - const y = Math.random() * n - n2; - const z = Math.random() * n - n2; - - const ax = x + Math.random() * d - d2; - const ay = y + Math.random() * d - d2; - const az = z + Math.random() * d - d2; - - const bx = x + Math.random() * d - d2; - const by = y + Math.random() * d - d2; - const bz = z + Math.random() * d - d2; - - const cx = x + Math.random() * d - d2; - const cy = y + Math.random() * d - d2; - const cz = z + Math.random() * d - d2; - - positions.push(ax, ay, az); - positions.push(bx, by, bz); - positions.push(cx, cy, cz); - - // flat face normals - - pA.set(ax, ay, az); - pB.set(bx, by, bz); - pC.set(cx, cy, cz); - - cb.subVectors(pC, pB); - ab.subVectors(pA, pB); - cb.cross(ab); - - cb.normalize(); - - const nx = cb.x; - const ny = cb.y; - const nz = cb.z; - - normals.push(nx, ny, nz); - normals.push(nx, ny, nz); - normals.push(nx, ny, nz); - - // colors - - const vx = x / n + 0.5; - const vy = y / n + 0.5; - const vz = z / n + 0.5; - - color.setRGB(vx, vy, vz); - - const alpha = Math.random(); - - colors.push(color.r, color.g, color.b, alpha); - colors.push(color.r, color.g, color.b, alpha); - colors.push(color.r, color.g, color.b, alpha); - } - - function disposeArray() { - this.array = null; - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3).onUpload(disposeArray)); - geometry.setAttribute('normal', new THREE.Float32BufferAttribute(normals, 3).onUpload(disposeArray)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 4).onUpload(disposeArray)); - - geometry.computeBoundingSphere(); - - const material = new THREE.MeshPhongMaterial({ - color: 0xd5d5d5, - specular: 0xffffff, - shininess: 250, - side: THREE.DoubleSide, - vertexColors: true, - transparent: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = Date.now() * 0.001; - - mesh.rotation.x = time * 0.25; - mesh.rotation.y = time * 0.5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_attributes_integer.ts b/examples-testing/examples/webgl_buffergeometry_attributes_integer.ts deleted file mode 100644 index 00490b716..000000000 --- a/examples-testing/examples/webgl_buffergeometry_attributes_integer.ts +++ /dev/null @@ -1,142 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer, mesh; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); - camera.position.z = 2500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // geometry - - const triangles = 10000; - - const geometry = new THREE.BufferGeometry(); - - const positions = []; - const uvs = []; - const textureIndices = []; - - const n = 800, - n2 = n / 2; // triangles spread in the cube - const d = 50, - d2 = d / 2; // individual triangle size - - for (let i = 0; i < triangles; i++) { - // positions - - const x = Math.random() * n - n2; - const y = Math.random() * n - n2; - const z = Math.random() * n - n2; - - const ax = x + Math.random() * d - d2; - const ay = y + Math.random() * d - d2; - const az = z + Math.random() * d - d2; - - const bx = x + Math.random() * d - d2; - const by = y + Math.random() * d - d2; - const bz = z + Math.random() * d - d2; - - const cx = x + Math.random() * d - d2; - const cy = y + Math.random() * d - d2; - const cz = z + Math.random() * d - d2; - - positions.push(ax, ay, az); - positions.push(bx, by, bz); - positions.push(cx, cy, cz); - - // uvs - - uvs.push(0, 0); - uvs.push(0.5, 1); - uvs.push(1, 0); - - // texture indices - - const t = i % 3; - textureIndices.push(t, t, t); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geometry.setAttribute('uv', new THREE.Float32BufferAttribute(uvs, 2)); - geometry.setAttribute('textureIndex', new THREE.Int16BufferAttribute(textureIndices, 1)); - geometry.attributes.textureIndex.gpuType = THREE.IntType; - - geometry.computeBoundingSphere(); - - // material - - const loader = new THREE.TextureLoader(); - - const map1 = loader.load('textures/crate.gif'); - const map2 = loader.load('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); - const map3 = loader.load('textures/terrain/grasslight-big.jpg'); - - const material = new THREE.ShaderMaterial({ - uniforms: { - uTextures: { - value: [map1, map2, map3], - }, - }, - vertexShader: /* glsl */ ` - in int textureIndex; - - flat out int vIndex; // "flat" indicates that the value will not be interpolated (required for integer attributes) - out vec2 vUv; - - void main() { - - vIndex = textureIndex; - vUv = uv; - - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - `, - fragmentShader: /* glsl */ ` - flat in int vIndex; - in vec2 vUv; - - uniform sampler2D uTextures[ 3 ]; - - out vec4 outColor; - - void main() { - - if ( vIndex == 0 ) outColor = texture( uTextures[ 0 ], vUv ); - else if ( vIndex == 1 ) outColor = texture( uTextures[ 1 ], vUv ); - else if ( vIndex == 2 ) outColor = texture( uTextures[ 2 ], vUv ); - - } - `, - side: THREE.DoubleSide, - glslVersion: THREE.GLSL3, - }); - - // mesh - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); -} - -function animate() { - const time = Date.now() * 0.001; - - mesh.rotation.x = time * 0.25; - mesh.rotation.y = time * 0.5; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_buffergeometry_attributes_none.ts b/examples-testing/examples/webgl_buffergeometry_attributes_none.ts deleted file mode 100644 index a1424e871..000000000 --- a/examples-testing/examples/webgl_buffergeometry_attributes_none.ts +++ /dev/null @@ -1,56 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer, mesh; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); - camera.position.z = 4; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // geometry - - const triangleCount = 10000; - const vertexCountPerTriangle = 3; - const vertexCount = triangleCount * vertexCountPerTriangle; - - const geometry = new THREE.BufferGeometry(); - geometry.setDrawRange(0, vertexCount); - - // material - - const material = new THREE.RawShaderMaterial({ - uniforms: { - seed: { value: 42 }, - }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - side: THREE.DoubleSide, - glslVersion: THREE.GLSL3, - }); - - // mesh - - mesh = new THREE.Mesh(geometry, material); - mesh.frustumCulled = false; - scene.add(mesh); - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); -} - -function animate(time) { - mesh.rotation.x = (time / 1000.0) * 0.25; - mesh.rotation.y = (time / 1000.0) * 0.5; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts b/examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts deleted file mode 100644 index 0dffa65cc..000000000 --- a/examples-testing/examples/webgl_buffergeometry_custom_attributes_particles.ts +++ /dev/null @@ -1,103 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let renderer, scene, camera, stats; - -let particleSystem, uniforms, geometry; - -const particles = 100000; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 300; - - scene = new THREE.Scene(); - - uniforms = { - pointTexture: { value: new THREE.TextureLoader().load('textures/sprites/spark1.png') }, - }; - - const shaderMaterial = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - - blending: THREE.AdditiveBlending, - depthTest: false, - transparent: true, - vertexColors: true, - }); - - const radius = 200; - - geometry = new THREE.BufferGeometry(); - - const positions = []; - const colors = []; - const sizes = []; - - const color = new THREE.Color(); - - for (let i = 0; i < particles; i++) { - positions.push((Math.random() * 2 - 1) * radius); - positions.push((Math.random() * 2 - 1) * radius); - positions.push((Math.random() * 2 - 1) * radius); - - color.setHSL(i / particles, 1.0, 0.5); - - colors.push(color.r, color.g, color.b); - - sizes.push(20); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1).setUsage(THREE.DynamicDrawUsage)); - - particleSystem = new THREE.Points(geometry, shaderMaterial); - - scene.add(particleSystem); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - const container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = Date.now() * 0.005; - - particleSystem.rotation.z = 0.01 * time; - - const sizes = geometry.attributes.size.array; - - for (let i = 0; i < particles; i++) { - sizes[i] = 10 * (1 + Math.sin(0.1 * i + time)); - } - - geometry.attributes.size.needsUpdate = true; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_drawrange.ts b/examples-testing/examples/webgl_buffergeometry_drawrange.ts deleted file mode 100644 index 142ff43bf..000000000 --- a/examples-testing/examples/webgl_buffergeometry_drawrange.ts +++ /dev/null @@ -1,239 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let group; -let container, stats; -const particlesData = []; -let camera, scene, renderer; -let positions, colors; -let particles; -let pointCloud; -let particlePositions; -let linesMesh; - -const maxParticleCount = 1000; -let particleCount = 500; -const r = 800; -const rHalf = r / 2; - -const effectController = { - showDots: true, - showLines: true, - minDistance: 150, - limitConnections: false, - maxConnections: 20, - particleCount: 500, -}; - -init(); - -function initGUI() { - const gui = new GUI(); - - gui.add(effectController, 'showDots').onChange(function (value) { - pointCloud.visible = value; - }); - gui.add(effectController, 'showLines').onChange(function (value) { - linesMesh.visible = value; - }); - gui.add(effectController, 'minDistance', 10, 300); - gui.add(effectController, 'limitConnections'); - gui.add(effectController, 'maxConnections', 0, 30, 1); - gui.add(effectController, 'particleCount', 0, maxParticleCount, 1).onChange(function (value) { - particleCount = value; - particles.setDrawRange(0, particleCount); - }); -} - -function init() { - initGUI(); - - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 4000); - camera.position.z = 1750; - - const controls = new OrbitControls(camera, container); - controls.minDistance = 1000; - controls.maxDistance = 3000; - - scene = new THREE.Scene(); - - group = new THREE.Group(); - scene.add(group); - - const helper = new THREE.BoxHelper(new THREE.Mesh(new THREE.BoxGeometry(r, r, r))); - helper.material.color.setHex(0x474747); - helper.material.blending = THREE.AdditiveBlending; - helper.material.transparent = true; - group.add(helper); - - const segments = maxParticleCount * maxParticleCount; - - positions = new Float32Array(segments * 3); - colors = new Float32Array(segments * 3); - - const pMaterial = new THREE.PointsMaterial({ - color: 0xffffff, - size: 3, - blending: THREE.AdditiveBlending, - transparent: true, - sizeAttenuation: false, - }); - - particles = new THREE.BufferGeometry(); - particlePositions = new Float32Array(maxParticleCount * 3); - - for (let i = 0; i < maxParticleCount; i++) { - const x = Math.random() * r - r / 2; - const y = Math.random() * r - r / 2; - const z = Math.random() * r - r / 2; - - particlePositions[i * 3] = x; - particlePositions[i * 3 + 1] = y; - particlePositions[i * 3 + 2] = z; - - // add it to the geometry - particlesData.push({ - velocity: new THREE.Vector3(-1 + Math.random() * 2, -1 + Math.random() * 2, -1 + Math.random() * 2), - numConnections: 0, - }); - } - - particles.setDrawRange(0, particleCount); - particles.setAttribute( - 'position', - new THREE.BufferAttribute(particlePositions, 3).setUsage(THREE.DynamicDrawUsage), - ); - - // create the particle system - pointCloud = new THREE.Points(particles, pMaterial); - group.add(pointCloud); - - const geometry = new THREE.BufferGeometry(); - - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3).setUsage(THREE.DynamicDrawUsage)); - geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3).setUsage(THREE.DynamicDrawUsage)); - - geometry.computeBoundingSphere(); - - geometry.setDrawRange(0, 0); - - const material = new THREE.LineBasicMaterial({ - vertexColors: true, - blending: THREE.AdditiveBlending, - transparent: true, - }); - - linesMesh = new THREE.LineSegments(geometry, material); - group.add(linesMesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - let vertexpos = 0; - let colorpos = 0; - let numConnected = 0; - - for (let i = 0; i < particleCount; i++) particlesData[i].numConnections = 0; - - for (let i = 0; i < particleCount; i++) { - // get the particle - const particleData = particlesData[i]; - - particlePositions[i * 3] += particleData.velocity.x; - particlePositions[i * 3 + 1] += particleData.velocity.y; - particlePositions[i * 3 + 2] += particleData.velocity.z; - - if (particlePositions[i * 3 + 1] < -rHalf || particlePositions[i * 3 + 1] > rHalf) - particleData.velocity.y = -particleData.velocity.y; - - if (particlePositions[i * 3] < -rHalf || particlePositions[i * 3] > rHalf) - particleData.velocity.x = -particleData.velocity.x; - - if (particlePositions[i * 3 + 2] < -rHalf || particlePositions[i * 3 + 2] > rHalf) - particleData.velocity.z = -particleData.velocity.z; - - if (effectController.limitConnections && particleData.numConnections >= effectController.maxConnections) - continue; - - // Check collision - for (let j = i + 1; j < particleCount; j++) { - const particleDataB = particlesData[j]; - if (effectController.limitConnections && particleDataB.numConnections >= effectController.maxConnections) - continue; - - const dx = particlePositions[i * 3] - particlePositions[j * 3]; - const dy = particlePositions[i * 3 + 1] - particlePositions[j * 3 + 1]; - const dz = particlePositions[i * 3 + 2] - particlePositions[j * 3 + 2]; - const dist = Math.sqrt(dx * dx + dy * dy + dz * dz); - - if (dist < effectController.minDistance) { - particleData.numConnections++; - particleDataB.numConnections++; - - const alpha = 1.0 - dist / effectController.minDistance; - - positions[vertexpos++] = particlePositions[i * 3]; - positions[vertexpos++] = particlePositions[i * 3 + 1]; - positions[vertexpos++] = particlePositions[i * 3 + 2]; - - positions[vertexpos++] = particlePositions[j * 3]; - positions[vertexpos++] = particlePositions[j * 3 + 1]; - positions[vertexpos++] = particlePositions[j * 3 + 2]; - - colors[colorpos++] = alpha; - colors[colorpos++] = alpha; - colors[colorpos++] = alpha; - - colors[colorpos++] = alpha; - colors[colorpos++] = alpha; - colors[colorpos++] = alpha; - - numConnected++; - } - } - } - - linesMesh.geometry.setDrawRange(0, numConnected * 2); - linesMesh.geometry.attributes.position.needsUpdate = true; - linesMesh.geometry.attributes.color.needsUpdate = true; - - pointCloud.geometry.attributes.position.needsUpdate = true; - - render(); - - stats.update(); -} - -function render() { - const time = Date.now() * 0.001; - - group.rotation.y = time * 0.1; - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts b/examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts deleted file mode 100644 index 80fa828bb..000000000 --- a/examples-testing/examples/webgl_buffergeometry_glbufferattribute.ts +++ /dev/null @@ -1,140 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let points; - -const particles = 300000; -let drawCount = 10000; - -init(); -animate(); - -function init() { - container = document.getElementById('container'); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 5, 3500); - camera.position.z = 2750; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // - - const geometry = new THREE.BufferGeometry(); - - const positions = []; - const positions2 = []; - const colors = []; - - const color = new THREE.Color(); - - const n = 1000, - n2 = n / 2; // particles spread in the cube - - for (let i = 0; i < particles; i++) { - // positions - - const x = Math.random() * n - n2; - const y = Math.random() * n - n2; - const z = Math.random() * n - n2; - - positions.push(x, y, z); - positions2.push(z * 0.3, x * 0.3, y * 0.3); - - // colors - - const vx = x / n + 0.5; - const vy = y / n + 0.5; - const vz = z / n + 0.5; - - color.setRGB(vx, vy, vz, THREE.SRGBColorSpace); - - const hex = color.getHex(THREE.LinearSRGBColorSpace); - colors.push((hex >> 16) & 255, (hex >> 8) & 255, hex & 255); - } - - const gl = renderer.getContext(); - - const pos = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, pos); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); - - const pos2 = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, pos2); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions2), gl.STATIC_DRAW); - - const rgb = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, rgb); - gl.bufferData(gl.ARRAY_BUFFER, new Uint8Array(colors), gl.STATIC_DRAW); - - const posAttr1 = new THREE.GLBufferAttribute(pos, gl.FLOAT, 3, 4, particles); - const posAttr2 = new THREE.GLBufferAttribute(pos2, gl.FLOAT, 3, 4, particles); - geometry.setAttribute('position', posAttr1); - - setInterval(function () { - const attr = geometry.getAttribute('position'); - - geometry.setAttribute('position', attr === posAttr1 ? posAttr2 : posAttr1); - }, 2000); - - geometry.setAttribute('color', new THREE.GLBufferAttribute(rgb, gl.UNSIGNED_BYTE, 3, 1, particles, true)); - - // - - const material = new THREE.PointsMaterial({ size: 15, vertexColors: true }); - - points = new THREE.Points(geometry, material); - - geometry.boundingSphere = new THREE.Sphere().set(new THREE.Vector3(), 500); - - scene.add(points); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - drawCount = (Math.max(5000, drawCount) + Math.floor(500 * Math.random())) % particles; - points.geometry.setDrawRange(0, drawCount); - - const time = Date.now() * 0.001; - - points.rotation.x = time * 0.1; - points.rotation.y = time * 0.2; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_indexed.ts b/examples-testing/examples/webgl_buffergeometry_indexed.ts deleted file mode 100644 index a2f9f3795..000000000 --- a/examples-testing/examples/webgl_buffergeometry_indexed.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, stats; - -let mesh; - -init(); - -function init() { - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); - camera.position.z = 64; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - - // - - const light = new THREE.HemisphereLight(); - light.intensity = 3; - scene.add(light); - - // - - const geometry = new THREE.BufferGeometry(); - - const indices = []; - - const vertices = []; - const normals = []; - const colors = []; - - const size = 20; - const segments = 10; - - const halfSize = size / 2; - const segmentSize = size / segments; - - const _color = new THREE.Color(); - - // generate vertices, normals and color data for a simple grid geometry - - for (let i = 0; i <= segments; i++) { - const y = i * segmentSize - halfSize; - - for (let j = 0; j <= segments; j++) { - const x = j * segmentSize - halfSize; - - vertices.push(x, -y, 0); - normals.push(0, 0, 1); - - const r = x / size + 0.5; - const g = y / size + 0.5; - - _color.setRGB(r, g, 1, THREE.SRGBColorSpace); - - colors.push(_color.r, _color.g, _color.b); - } - } - - // generate indices (data for element array buffer) - - for (let i = 0; i < segments; i++) { - for (let j = 0; j < segments; j++) { - const a = i * (segments + 1) + (j + 1); - const b = i * (segments + 1) + j; - const c = (i + 1) * (segments + 1) + j; - const d = (i + 1) * (segments + 1) + (j + 1); - - // generate two faces (triangles) per iteration - - indices.push(a, b, d); // face one - indices.push(b, c, d); // face two - } - } - - // - - geometry.setIndex(indices); - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - geometry.setAttribute('normal', new THREE.Float32BufferAttribute(normals, 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - const material = new THREE.MeshPhongMaterial({ - side: THREE.DoubleSide, - vertexColors: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - const gui = new GUI(); - gui.add(material, 'wireframe'); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = Date.now() * 0.001; - - mesh.rotation.x = time * 0.25; - mesh.rotation.y = time * 0.5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_instancing.ts b/examples-testing/examples/webgl_buffergeometry_instancing.ts deleted file mode 100644 index b27f500f0..000000000 --- a/examples-testing/examples/webgl_buffergeometry_instancing.ts +++ /dev/null @@ -1,138 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let container, stats; - -let camera, scene, renderer; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10); - camera.position.z = 2; - - scene = new THREE.Scene(); - - // geometry - - const vector = new THREE.Vector4(); - - const instances = 50000; - - const positions = []; - const offsets = []; - const colors = []; - const orientationsStart = []; - const orientationsEnd = []; - - positions.push(0.025, -0.025, 0); - positions.push(-0.025, 0.025, 0); - positions.push(0, 0, 0.025); - - // instanced attributes - - for (let i = 0; i < instances; i++) { - // offsets - - offsets.push(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); - - // colors - - colors.push(Math.random(), Math.random(), Math.random(), Math.random()); - - // orientation start - - vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); - vector.normalize(); - - orientationsStart.push(vector.x, vector.y, vector.z, vector.w); - - // orientation end - - vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); - vector.normalize(); - - orientationsEnd.push(vector.x, vector.y, vector.z, vector.w); - } - - const geometry = new THREE.InstancedBufferGeometry(); - geometry.instanceCount = instances; // set so its initialized for dat.GUI, will be set in first draw otherwise - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - - geometry.setAttribute('offset', new THREE.InstancedBufferAttribute(new Float32Array(offsets), 3)); - geometry.setAttribute('color', new THREE.InstancedBufferAttribute(new Float32Array(colors), 4)); - geometry.setAttribute( - 'orientationStart', - new THREE.InstancedBufferAttribute(new Float32Array(orientationsStart), 4), - ); - geometry.setAttribute('orientationEnd', new THREE.InstancedBufferAttribute(new Float32Array(orientationsEnd), 4)); - - // material - - const material = new THREE.RawShaderMaterial({ - uniforms: { - time: { value: 1.0 }, - sineTime: { value: 1.0 }, - }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - side: THREE.DoubleSide, - forceSinglePass: true, - transparent: true, - }); - - // - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - const gui = new GUI({ width: 350 }); - gui.add(geometry, 'instanceCount', 0, instances); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = performance.now(); - - const object = scene.children[0]; - - object.rotation.y = time * 0.0005; - object.material.uniforms['time'].value = time * 0.005; - object.material.uniforms['sineTime'].value = Math.sin(object.material.uniforms['time'].value * 0.05); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts b/examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts deleted file mode 100644 index 2158dff39..000000000 --- a/examples-testing/examples/webgl_buffergeometry_instancing_billboards.ts +++ /dev/null @@ -1,86 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; -let geometry, material, mesh; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.z = 1400; - - scene = new THREE.Scene(); - - const circleGeometry = new THREE.CircleGeometry(1, 6); - - geometry = new THREE.InstancedBufferGeometry(); - geometry.index = circleGeometry.index; - geometry.attributes = circleGeometry.attributes; - - const particleCount = 75000; - - const translateArray = new Float32Array(particleCount * 3); - - for (let i = 0, i3 = 0, l = particleCount; i < l; i++, i3 += 3) { - translateArray[i3 + 0] = Math.random() * 2 - 1; - translateArray[i3 + 1] = Math.random() * 2 - 1; - translateArray[i3 + 2] = Math.random() * 2 - 1; - } - - geometry.setAttribute('translate', new THREE.InstancedBufferAttribute(translateArray, 3)); - - material = new THREE.RawShaderMaterial({ - uniforms: { - map: { value: new THREE.TextureLoader().load('textures/sprites/circle.png') }, - time: { value: 0.0 }, - }, - vertexShader: document.getElementById('vshader').textContent, - fragmentShader: document.getElementById('fshader').textContent, - depthTest: true, - depthWrite: true, - }); - - mesh = new THREE.Mesh(geometry, material); - mesh.scale.set(500, 500, 500); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); - - return true; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now() * 0.0005; - - material.uniforms['time'].value = time; - - mesh.rotation.x = time * 0.2; - mesh.rotation.y = time * 0.4; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts b/examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts deleted file mode 100644 index bef2c264d..000000000 --- a/examples-testing/examples/webgl_buffergeometry_instancing_interleaved.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; -let camera, scene, renderer, mesh; - -const instances = 5000; -let lastTime = 0; - -const moveQ = new THREE.Quaternion(0.5, 0.5, 0.5, 0.0).normalize(); -const tmpQ = new THREE.Quaternion(); -const tmpM = new THREE.Matrix4(); -const currentM = new THREE.Matrix4(); - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x101010); - - // geometry - - const geometry = new THREE.InstancedBufferGeometry(); - - // per mesh data x,y,z,w,u,v,s,t for 4-element alignment - // only use x,y,z and u,v; but x, y, z, nx, ny, nz, u, v would be a good layout - const vertexBuffer = new THREE.InterleavedBuffer( - new Float32Array([ - // Front - -1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, -1, -1, 1, 0, 0, 1, 0, 0, 1, -1, 1, 0, 1, 1, 0, 0, - // Back - 1, 1, -1, 0, 1, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 1, 0, 0, -1, -1, -1, 0, 0, 1, 0, 0, - // Left - -1, 1, -1, 0, 1, 1, 0, 0, -1, 1, 1, 0, 1, 0, 0, 0, -1, -1, -1, 0, 0, 1, 0, 0, -1, -1, 1, 0, 0, 0, 0, 0, - // Right - 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, -1, 0, 1, 1, 0, 0, 1, -1, 1, 0, 0, 0, 0, 0, 1, -1, -1, 0, 0, 1, 0, 0, - // Top - -1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, -1, 1, -1, 0, 0, 1, 0, 0, 1, 1, -1, 0, 1, 1, 0, 0, - // Bottom - 1, -1, 1, 0, 1, 0, 0, 0, -1, -1, 1, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 1, 0, 0, -1, -1, -1, 0, 0, 1, 0, 0, - ]), - 8, - ); - - // Use vertexBuffer, starting at offset 0, 3 items in position attribute - const positions = new THREE.InterleavedBufferAttribute(vertexBuffer, 3, 0); - geometry.setAttribute('position', positions); - // Use vertexBuffer, starting at offset 4, 2 items in uv attribute - const uvs = new THREE.InterleavedBufferAttribute(vertexBuffer, 2, 4); - geometry.setAttribute('uv', uvs); - - const indices = new Uint16Array([ - 0, 2, 1, 2, 3, 1, 4, 6, 5, 6, 7, 5, 8, 10, 9, 10, 11, 9, 12, 14, 13, 14, 15, 13, 16, 17, 18, 18, 17, 19, 20, 21, - 22, 22, 21, 23, - ]); - - geometry.setIndex(new THREE.BufferAttribute(indices, 1)); - - // material - - const material = new THREE.MeshBasicMaterial(); - material.map = new THREE.TextureLoader().load('textures/crate.gif'); - material.map.colorSpace = THREE.SRGBColorSpace; - material.map.flipY = false; - - // per instance data - - const matrix = new THREE.Matrix4(); - const offset = new THREE.Vector3(); - const orientation = new THREE.Quaternion(); - const scale = new THREE.Vector3(1, 1, 1); - let x, y, z, w; - - mesh = new THREE.InstancedMesh(geometry, material, instances); - - for (let i = 0; i < instances; i++) { - // offsets - - x = Math.random() * 100 - 50; - y = Math.random() * 100 - 50; - z = Math.random() * 100 - 50; - - offset.set(x, y, z).normalize(); - offset.multiplyScalar(5); // move out at least 5 units from center in current direction - offset.set(x + offset.x, y + offset.y, z + offset.z); - - // orientations - - x = Math.random() * 2 - 1; - y = Math.random() * 2 - 1; - z = Math.random() * 2 - 1; - w = Math.random() * 2 - 1; - - orientation.set(x, y, z, w).normalize(); - - matrix.compose(offset, orientation, scale); - - mesh.setMatrixAt(i, matrix); - } - - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = performance.now(); - - mesh.rotation.y = time * 0.00005; - - const delta = (time - lastTime) / 5000; - tmpQ.set(moveQ.x * delta, moveQ.y * delta, moveQ.z * delta, 1).normalize(); - tmpM.makeRotationFromQuaternion(tmpQ); - - for (let i = 0, il = instances; i < il; i++) { - mesh.getMatrixAt(i, currentM); - currentM.multiply(tmpM); - mesh.setMatrixAt(i, currentM); - } - - mesh.instanceMatrix.needsUpdate = true; - mesh.computeBoundingSphere(); - - lastTime = time; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_lines.ts b/examples-testing/examples/webgl_buffergeometry_lines.ts deleted file mode 100644 index d039e0112..000000000 --- a/examples-testing/examples/webgl_buffergeometry_lines.ts +++ /dev/null @@ -1,121 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats, timer; - -let camera, scene, renderer; - -let line; - -const segments = 10000; -const r = 800; -let t = 0; - -init(); - -function init() { - container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 4000); - camera.position.z = 2750; - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - const geometry = new THREE.BufferGeometry(); - const material = new THREE.LineBasicMaterial({ vertexColors: true }); - - const positions = []; - const colors = []; - - for (let i = 0; i < segments; i++) { - const x = Math.random() * r - r / 2; - const y = Math.random() * r - r / 2; - const z = Math.random() * r - r / 2; - - // positions - - positions.push(x, y, z); - - // colors - - colors.push(x / r + 0.5); - colors.push(y / r + 0.5); - colors.push(z / r + 0.5); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - generateMorphTargets(geometry); - - geometry.computeBoundingSphere(); - - line = new THREE.Line(geometry, material); - scene.add(line); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - const time = timer.getElapsed(); - - line.rotation.x = time * 0.25; - line.rotation.y = time * 0.5; - - t += delta * 0.5; - line.morphTargetInfluences[0] = Math.abs(Math.sin(t)); - - renderer.render(scene, camera); - - stats.update(); -} - -function generateMorphTargets(geometry) { - const data = []; - - for (let i = 0; i < segments; i++) { - const x = Math.random() * r - r / 2; - const y = Math.random() * r - r / 2; - const z = Math.random() * r - r / 2; - - data.push(x, y, z); - } - - const morphTarget = new THREE.Float32BufferAttribute(data, 3); - morphTarget.name = 'target1'; - - geometry.morphAttributes.position = [morphTarget]; -} diff --git a/examples-testing/examples/webgl_buffergeometry_lines_indexed.ts b/examples-testing/examples/webgl_buffergeometry_lines_indexed.ts deleted file mode 100644 index 58296087e..000000000 --- a/examples-testing/examples/webgl_buffergeometry_lines_indexed.ts +++ /dev/null @@ -1,179 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let parent_node; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 9000; - - scene = new THREE.Scene(); - - const geometry = new THREE.BufferGeometry(); - const material = new THREE.LineBasicMaterial({ vertexColors: true }); - - const indices = []; - const positions = []; - const colors = []; - - let next_positions_index = 0; - - // - - const iteration_count = 4; - const rangle = (60 * Math.PI) / 180.0; - - function add_vertex(v) { - positions.push(v.x, v.y, v.z); - colors.push(Math.random() * 0.5 + 0.5, Math.random() * 0.5 + 0.5, 1); - - return next_positions_index++; - } - - // simple Koch curve - - function snowflake_iteration(p0, p4, depth) { - if (--depth < 0) { - const i = next_positions_index - 1; // p0 already there - add_vertex(p4); - indices.push(i, i + 1); - - return; - } - - const v = p4.clone().sub(p0); - const v_tier = v.clone().multiplyScalar(1 / 3); - const p1 = p0.clone().add(v_tier); - - const angle = Math.atan2(v.y, v.x) + rangle; - const length = v_tier.length(); - const p2 = p1.clone(); - p2.x += Math.cos(angle) * length; - p2.y += Math.sin(angle) * length; - - const p3 = p0.clone().add(v_tier).add(v_tier); - - snowflake_iteration(p0, p1, depth); - snowflake_iteration(p1, p2, depth); - snowflake_iteration(p2, p3, depth); - snowflake_iteration(p3, p4, depth); - } - - function snowflake(points, loop, x_offset) { - for (let iteration = 0; iteration != iteration_count; iteration++) { - add_vertex(points[0]); - - for (let p_index = 0, p_count = points.length - 1; p_index != p_count; p_index++) { - snowflake_iteration(points[p_index], points[p_index + 1], iteration); - } - - if (loop) snowflake_iteration(points[points.length - 1], points[0], iteration); - - // translate input curve for next iteration - - for (let p_index = 0, p_count = points.length; p_index != p_count; p_index++) { - points[p_index].x += x_offset; - } - } - } - - let y = 0; - - snowflake([new THREE.Vector3(0, y, 0), new THREE.Vector3(500, y, 0)], false, 600); - - y += 600; - snowflake( - [new THREE.Vector3(0, y, 0), new THREE.Vector3(250, y + 400, 0), new THREE.Vector3(500, y, 0)], - true, - 600, - ); - - y += 600; - snowflake( - [ - new THREE.Vector3(0, y, 0), - new THREE.Vector3(500, y, 0), - new THREE.Vector3(500, y + 500, 0), - new THREE.Vector3(0, y + 500, 0), - ], - true, - 600, - ); - - y += 1000; - snowflake( - [ - new THREE.Vector3(250, y, 0), - new THREE.Vector3(500, y, 0), - new THREE.Vector3(250, y, 0), - new THREE.Vector3(250, y + 250, 0), - new THREE.Vector3(250, y, 0), - new THREE.Vector3(0, y, 0), - new THREE.Vector3(250, y, 0), - new THREE.Vector3(250, y - 250, 0), - new THREE.Vector3(250, y, 0), - ], - false, - 600, - ); - - // - - geometry.setIndex(indices); - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - geometry.computeBoundingSphere(); - - const lineSegments = new THREE.LineSegments(geometry, material); - lineSegments.position.x -= 1200; - lineSegments.position.y -= 1200; - - parent_node = new THREE.Object3D(); - parent_node.add(lineSegments); - - scene.add(parent_node); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = Date.now() * 0.001; - - parent_node.rotation.z = time * 0.5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_points.ts b/examples-testing/examples/webgl_buffergeometry_points.ts deleted file mode 100644 index 4547d9d08..000000000 --- a/examples-testing/examples/webgl_buffergeometry_points.ts +++ /dev/null @@ -1,109 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let points; - -init(); -animate(); - -function init() { - container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 5, 3500); - camera.position.z = 2750; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // - - const particles = 500000; - - const geometry = new THREE.BufferGeometry(); - - const positions = []; - const colors = []; - - const color = new THREE.Color(); - - const n = 1000, - n2 = n / 2; // particles spread in the cube - - for (let i = 0; i < particles; i++) { - // positions - - const x = Math.random() * n - n2; - const y = Math.random() * n - n2; - const z = Math.random() * n - n2; - - positions.push(x, y, z); - - // colors - - const vx = x / n + 0.5; - const vy = y / n + 0.5; - const vz = z / n + 0.5; - - color.setRGB(vx, vy, vz, THREE.SRGBColorSpace); - - colors.push(color.r, color.g, color.b); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - geometry.computeBoundingSphere(); - - // - - const material = new THREE.PointsMaterial({ size: 15, vertexColors: true }); - - points = new THREE.Points(geometry, material); - scene.add(points); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = Date.now() * 0.001; - - points.rotation.x = time * 0.25; - points.rotation.y = time * 0.5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_points_interleaved.ts b/examples-testing/examples/webgl_buffergeometry_points_interleaved.ts deleted file mode 100644 index 93eed992e..000000000 --- a/examples-testing/examples/webgl_buffergeometry_points_interleaved.ts +++ /dev/null @@ -1,122 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let points; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 5, 3500); - camera.position.z = 2750; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // - - const particles = 500000; - - const geometry = new THREE.BufferGeometry(); - - // create a generic buffer of binary data (a single particle has 16 bytes of data) - - const arrayBuffer = new ArrayBuffer(particles * 16); - - // the following typed arrays share the same buffer - - const interleavedFloat32Buffer = new Float32Array(arrayBuffer); - const interleavedUint8Buffer = new Uint8Array(arrayBuffer); - - // - - const color = new THREE.Color(); - - const n = 1000, - n2 = n / 2; // particles spread in the cube - - for (let i = 0; i < interleavedFloat32Buffer.length; i += 4) { - // position (first 12 bytes) - - const x = Math.random() * n - n2; - const y = Math.random() * n - n2; - const z = Math.random() * n - n2; - - interleavedFloat32Buffer[i + 0] = x; - interleavedFloat32Buffer[i + 1] = y; - interleavedFloat32Buffer[i + 2] = z; - - // color (last 4 bytes) - - const vx = x / n + 0.5; - const vy = y / n + 0.5; - const vz = z / n + 0.5; - - color.setRGB(vx, vy, vz, THREE.SRGBColorSpace); - - const j = (i + 3) * 4; - - interleavedUint8Buffer[j + 0] = color.r * 255; - interleavedUint8Buffer[j + 1] = color.g * 255; - interleavedUint8Buffer[j + 2] = color.b * 255; - interleavedUint8Buffer[j + 3] = 0; // not needed - } - - const interleavedBuffer32 = new THREE.InterleavedBuffer(interleavedFloat32Buffer, 4); - const interleavedBuffer8 = new THREE.InterleavedBuffer(interleavedUint8Buffer, 16); - - geometry.setAttribute('position', new THREE.InterleavedBufferAttribute(interleavedBuffer32, 3, 0, false)); - geometry.setAttribute('color', new THREE.InterleavedBufferAttribute(interleavedBuffer8, 3, 12, true)); - - // - - const material = new THREE.PointsMaterial({ size: 15, vertexColors: true }); - - points = new THREE.Points(geometry, material); - scene.add(points); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = Date.now() * 0.001; - - points.rotation.x = time * 0.25; - points.rotation.y = time * 0.5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_rawshader.ts b/examples-testing/examples/webgl_buffergeometry_rawshader.ts deleted file mode 100644 index 5bc113dc3..000000000 --- a/examples-testing/examples/webgl_buffergeometry_rawshader.ts +++ /dev/null @@ -1,97 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10); - camera.position.z = 2; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x101010); - - // geometry - // nr of triangles with 3 vertices per triangle - const vertexCount = 200 * 3; - - const geometry = new THREE.BufferGeometry(); - - const positions = []; - const colors = []; - - for (let i = 0; i < vertexCount; i++) { - // adding x,y,z - positions.push(Math.random() - 0.5); - positions.push(Math.random() - 0.5); - positions.push(Math.random() - 0.5); - - // adding r,g,b,a - colors.push(Math.random() * 255); - colors.push(Math.random() * 255); - colors.push(Math.random() * 255); - colors.push(Math.random() * 255); - } - - const positionAttribute = new THREE.Float32BufferAttribute(positions, 3); - const colorAttribute = new THREE.Uint8BufferAttribute(colors, 4); - - colorAttribute.normalized = true; // this will map the buffer values to 0.0f - +1.0f in the shader - - geometry.setAttribute('position', positionAttribute); - geometry.setAttribute('color', colorAttribute); - - // material - - const material = new THREE.RawShaderMaterial({ - uniforms: { - time: { value: 1.0 }, - }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - side: THREE.DoubleSide, - transparent: true, - }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = performance.now(); - - const object = scene.children[0]; - - object.rotation.y = time * 0.0005; - object.material.uniforms.time.value = time * 0.005; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_selective_draw.ts b/examples-testing/examples/webgl_buffergeometry_selective_draw.ts deleted file mode 100644 index 1264c7cad..000000000 --- a/examples-testing/examples/webgl_buffergeometry_selective_draw.ts +++ /dev/null @@ -1,150 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let geometry, mesh; -const numLat = 100; -const numLng = 200; -let numLinesCulled = 0; - -init(); - -function init() { - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.z = 3.5; - - stats = new Stats(); - document.body.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); - - addLines(1.0); - - const hideLinesButton = document.getElementById('hideLines'); - hideLinesButton.addEventListener('click', hideLines); - - const showAllLinesButton = document.getElementById('showAllLines'); - showAllLinesButton.addEventListener('click', showAllLines); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); -} - -function addLines(radius) { - geometry = new THREE.BufferGeometry(); - const linePositions = new Float32Array(numLat * numLng * 3 * 2); - const lineColors = new Float32Array(numLat * numLng * 3 * 2); - const visible = new Float32Array(numLat * numLng * 2); - - for (let i = 0; i < numLat; ++i) { - for (let j = 0; j < numLng; ++j) { - const lat = (Math.random() * Math.PI) / 50.0 + (i / numLat) * Math.PI; - const lng = (Math.random() * Math.PI) / 50.0 + (j / numLng) * 2 * Math.PI; - - const index = i * numLng + j; - - linePositions[index * 6 + 0] = 0; - linePositions[index * 6 + 1] = 0; - linePositions[index * 6 + 2] = 0; - linePositions[index * 6 + 3] = radius * Math.sin(lat) * Math.cos(lng); - linePositions[index * 6 + 4] = radius * Math.cos(lat); - linePositions[index * 6 + 5] = radius * Math.sin(lat) * Math.sin(lng); - - const color = new THREE.Color(0xffffff); - - color.setHSL(lat / Math.PI, 1.0, 0.2); - lineColors[index * 6 + 0] = color.r; - lineColors[index * 6 + 1] = color.g; - lineColors[index * 6 + 2] = color.b; - - color.setHSL(lat / Math.PI, 1.0, 0.7); - lineColors[index * 6 + 3] = color.r; - lineColors[index * 6 + 4] = color.g; - lineColors[index * 6 + 5] = color.b; - - // non-0 is visible - visible[index * 2 + 0] = 1.0; - visible[index * 2 + 1] = 1.0; - } - } - - geometry.setAttribute('position', new THREE.BufferAttribute(linePositions, 3)); - geometry.setAttribute('vertColor', new THREE.BufferAttribute(lineColors, 3)); - geometry.setAttribute('visible', new THREE.BufferAttribute(visible, 1)); - - geometry.computeBoundingSphere(); - - const shaderMaterial = new THREE.ShaderMaterial({ - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - }); - - mesh = new THREE.LineSegments(geometry, shaderMaterial); - scene.add(mesh); - - updateCount(); -} - -function updateCount() { - const str = - '1 draw call, ' + - numLat * numLng + - ' lines, ' + - numLinesCulled + - ' culled (author)'; - document.getElementById('title').innerHTML = str.replace(/\B(?=(\d{3})+(?!\d))/g, ','); -} - -function hideLines() { - for (let i = 0; i < geometry.attributes.visible.array.length; i += 2) { - if (Math.random() > 0.75) { - if (geometry.attributes.visible.array[i + 0]) { - ++numLinesCulled; - } - - geometry.attributes.visible.array[i + 0] = 0; - geometry.attributes.visible.array[i + 1] = 0; - } - } - - geometry.attributes.visible.needsUpdate = true; - - updateCount(); -} - -function showAllLines() { - numLinesCulled = 0; - - for (let i = 0; i < geometry.attributes.visible.array.length; i += 2) { - geometry.attributes.visible.array[i + 0] = 1; - geometry.attributes.visible.array[i + 1] = 1; - } - - geometry.attributes.visible.needsUpdate = true; - - updateCount(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = Date.now() * 0.001; - - mesh.rotation.x = time * 0.25; - mesh.rotation.y = time * 0.5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_buffergeometry_uint.ts b/examples-testing/examples/webgl_buffergeometry_uint.ts deleted file mode 100644 index 0b8df6ec7..000000000 --- a/examples-testing/examples/webgl_buffergeometry_uint.ts +++ /dev/null @@ -1,177 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let mesh; - -init(); - -function init() { - container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); - camera.position.z = 2750; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const light1 = new THREE.DirectionalLight(0xffffff, 1.5); - light1.position.set(1, 1, 1); - scene.add(light1); - - const light2 = new THREE.DirectionalLight(0xffffff, 4.5); - light2.position.set(0, -1, 0); - scene.add(light2); - - // - - const triangles = 500000; - - const geometry = new THREE.BufferGeometry(); - - const positions = []; - const normals = []; - const colors = []; - - const color = new THREE.Color(); - - const n = 800, - n2 = n / 2; // triangles spread in the cube - const d = 12, - d2 = d / 2; // individual triangle size - - const pA = new THREE.Vector3(); - const pB = new THREE.Vector3(); - const pC = new THREE.Vector3(); - - const cb = new THREE.Vector3(); - const ab = new THREE.Vector3(); - - for (let i = 0; i < triangles; i++) { - // positions - - const x = Math.random() * n - n2; - const y = Math.random() * n - n2; - const z = Math.random() * n - n2; - - const ax = x + Math.random() * d - d2; - const ay = y + Math.random() * d - d2; - const az = z + Math.random() * d - d2; - - const bx = x + Math.random() * d - d2; - const by = y + Math.random() * d - d2; - const bz = z + Math.random() * d - d2; - - const cx = x + Math.random() * d - d2; - const cy = y + Math.random() * d - d2; - const cz = z + Math.random() * d - d2; - - positions.push(ax, ay, az); - positions.push(bx, by, bz); - positions.push(cx, cy, cz); - - // flat face normals - - pA.set(ax, ay, az); - pB.set(bx, by, bz); - pC.set(cx, cy, cz); - - cb.subVectors(pC, pB); - ab.subVectors(pA, pB); - cb.cross(ab); - - cb.normalize(); - - const nx = cb.x; - const ny = cb.y; - const nz = cb.z; - - normals.push(nx * 32767, ny * 32767, nz * 32767); - normals.push(nx * 32767, ny * 32767, nz * 32767); - normals.push(nx * 32767, ny * 32767, nz * 32767); - - // colors - - const vx = x / n + 0.5; - const vy = y / n + 0.5; - const vz = z / n + 0.5; - - color.setRGB(vx, vy, vz); - - colors.push(color.r * 255, color.g * 255, color.b * 255); - colors.push(color.r * 255, color.g * 255, color.b * 255); - colors.push(color.r * 255, color.g * 255, color.b * 255); - } - - const positionAttribute = new THREE.Float32BufferAttribute(positions, 3); - const normalAttribute = new THREE.Int16BufferAttribute(normals, 3); - const colorAttribute = new THREE.Uint8BufferAttribute(colors, 3); - - normalAttribute.normalized = true; // this will map the buffer values to 0.0f - +1.0f in the shader - colorAttribute.normalized = true; - - geometry.setAttribute('position', positionAttribute); - geometry.setAttribute('normal', normalAttribute); - geometry.setAttribute('color', colorAttribute); - - geometry.computeBoundingSphere(); - - const material = new THREE.MeshPhongMaterial({ - color: 0xd5d5d5, - specular: 0xffffff, - shininess: 250, - side: THREE.DoubleSide, - vertexColors: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = Date.now() * 0.001; - - mesh.rotation.x = time * 0.25; - mesh.rotation.y = time * 0.5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_camera.ts b/examples-testing/examples/webgl_camera.ts deleted file mode 100644 index f3d663603..000000000 --- a/examples-testing/examples/webgl_camera.ts +++ /dev/null @@ -1,218 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let SCREEN_WIDTH = window.innerWidth; -let SCREEN_HEIGHT = window.innerHeight; -let aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - -let container, stats; -let camera, scene, renderer, mesh; -let cameraRig, activeCamera, activeHelper; -let cameraPerspective, cameraOrtho; -let cameraPerspectiveHelper, cameraOrthoHelper; -const frustumSize = 600; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - - // - - camera = new THREE.PerspectiveCamera(50, 0.5 * aspect, 1, 10000); - camera.position.z = 2500; - - cameraPerspective = new THREE.PerspectiveCamera(50, 0.5 * aspect, 150, 1000); - - cameraPerspectiveHelper = new THREE.CameraHelper(cameraPerspective); - scene.add(cameraPerspectiveHelper); - - // - cameraOrtho = new THREE.OrthographicCamera( - (0.5 * frustumSize * aspect) / -2, - (0.5 * frustumSize * aspect) / 2, - frustumSize / 2, - frustumSize / -2, - 150, - 1000, - ); - - cameraOrthoHelper = new THREE.CameraHelper(cameraOrtho); - scene.add(cameraOrthoHelper); - - // - - activeCamera = cameraPerspective; - activeHelper = cameraPerspectiveHelper; - - // counteract different front orientation of cameras vs rig - - cameraOrtho.rotation.y = Math.PI; - cameraPerspective.rotation.y = Math.PI; - - cameraRig = new THREE.Group(); - - cameraRig.add(cameraPerspective); - cameraRig.add(cameraOrtho); - - scene.add(cameraRig); - - // - - mesh = new THREE.Mesh( - new THREE.SphereGeometry(100, 16, 8), - new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }), - ); - scene.add(mesh); - - const mesh2 = new THREE.Mesh( - new THREE.SphereGeometry(50, 16, 8), - new THREE.MeshBasicMaterial({ color: 0x00ff00, wireframe: true }), - ); - mesh2.position.y = 150; - mesh.add(mesh2); - - const mesh3 = new THREE.Mesh( - new THREE.SphereGeometry(5, 16, 8), - new THREE.MeshBasicMaterial({ color: 0x0000ff, wireframe: true }), - ); - mesh3.position.z = 150; - cameraRig.add(mesh3); - - // - - const geometry = new THREE.BufferGeometry(); - const vertices = []; - - for (let i = 0; i < 10000; i++) { - vertices.push(THREE.MathUtils.randFloatSpread(2000)); // x - vertices.push(THREE.MathUtils.randFloatSpread(2000)); // y - vertices.push(THREE.MathUtils.randFloatSpread(2000)); // z - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - const particles = new THREE.Points(geometry, new THREE.PointsMaterial({ color: 0x888888 })); - scene.add(particles); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - renderer.setScissorTest(true); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); - document.addEventListener('keydown', onKeyDown); -} - -// - -function onKeyDown(event) { - switch (event.keyCode) { - case 79 /*O*/: - activeCamera = cameraOrtho; - activeHelper = cameraOrthoHelper; - - break; - - case 80 /*P*/: - activeCamera = cameraPerspective; - activeHelper = cameraPerspectiveHelper; - - break; - } -} - -// - -function onWindowResize() { - SCREEN_WIDTH = window.innerWidth; - SCREEN_HEIGHT = window.innerHeight; - aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - - camera.aspect = 0.5 * aspect; - camera.updateProjectionMatrix(); - - cameraPerspective.aspect = 0.5 * aspect; - cameraPerspective.updateProjectionMatrix(); - - cameraOrtho.left = (-0.5 * frustumSize * aspect) / 2; - cameraOrtho.right = (0.5 * frustumSize * aspect) / 2; - cameraOrtho.top = frustumSize / 2; - cameraOrtho.bottom = -frustumSize / 2; - cameraOrtho.updateProjectionMatrix(); -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const r = Date.now() * 0.0005; - - mesh.position.x = 700 * Math.cos(r); - mesh.position.z = 700 * Math.sin(r); - mesh.position.y = 700 * Math.sin(r); - - mesh.children[0].position.x = 70 * Math.cos(2 * r); - mesh.children[0].position.z = 70 * Math.sin(r); - - if (activeCamera === cameraPerspective) { - cameraPerspective.fov = 35 + 30 * Math.sin(0.5 * r); - cameraPerspective.far = mesh.position.length(); - cameraPerspective.updateProjectionMatrix(); - - cameraPerspectiveHelper.update(); - cameraPerspectiveHelper.visible = true; - - cameraOrthoHelper.visible = false; - } else { - cameraOrtho.far = mesh.position.length(); - cameraOrtho.updateProjectionMatrix(); - - cameraOrthoHelper.update(); - cameraOrthoHelper.visible = true; - - cameraPerspectiveHelper.visible = false; - } - - cameraRig.lookAt(mesh.position); - - // - - activeHelper.visible = false; - - renderer.setClearColor(0x000000, 1); - renderer.setScissor(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.setViewport(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.render(scene, activeCamera); - - // - - activeHelper.visible = true; - - renderer.setClearColor(0x111111, 1); - renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.setViewport(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_camera_array.ts b/examples-testing/examples/webgl_camera_array.ts deleted file mode 100644 index 8b10e27cb..000000000 --- a/examples-testing/examples/webgl_camera_array.ts +++ /dev/null @@ -1,104 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; -let mesh; -const AMOUNT = 6; - -init(); - -function init() { - const ASPECT_RATIO = window.innerWidth / window.innerHeight; - - const WIDTH = (window.innerWidth / AMOUNT) * window.devicePixelRatio; - const HEIGHT = (window.innerHeight / AMOUNT) * window.devicePixelRatio; - - const cameras = []; - - for (let y = 0; y < AMOUNT; y++) { - for (let x = 0; x < AMOUNT; x++) { - const subcamera = new THREE.PerspectiveCamera(40, ASPECT_RATIO, 0.1, 10); - subcamera.viewport = new THREE.Vector4( - Math.floor(x * WIDTH), - Math.floor(y * HEIGHT), - Math.ceil(WIDTH), - Math.ceil(HEIGHT), - ); - subcamera.position.x = x / AMOUNT - 0.5; - subcamera.position.y = 0.5 - y / AMOUNT; - subcamera.position.z = 1.5; - subcamera.position.multiplyScalar(2); - subcamera.lookAt(0, 0, 0); - subcamera.updateMatrixWorld(); - cameras.push(subcamera); - } - } - - camera = new THREE.ArrayCamera(cameras); - camera.position.z = 3; - - scene = new THREE.Scene(); - - scene.add(new THREE.AmbientLight(0x999999)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0.5, 0.5, 1); - light.castShadow = true; - light.shadow.camera.zoom = 4; // tighter shadow map - scene.add(light); - - const geometryBackground = new THREE.PlaneGeometry(100, 100); - const materialBackground = new THREE.MeshPhongMaterial({ color: 0x000066 }); - - const background = new THREE.Mesh(geometryBackground, materialBackground); - background.receiveShadow = true; - background.position.set(0, 0, -1); - scene.add(background); - - const geometryCylinder = new THREE.CylinderGeometry(0.5, 0.5, 1, 32); - const materialCylinder = new THREE.MeshPhongMaterial({ color: 0xff0000 }); - - mesh = new THREE.Mesh(geometryCylinder, materialCylinder); - mesh.castShadow = true; - mesh.receiveShadow = true; - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const ASPECT_RATIO = window.innerWidth / window.innerHeight; - const WIDTH = (window.innerWidth / AMOUNT) * window.devicePixelRatio; - const HEIGHT = (window.innerHeight / AMOUNT) * window.devicePixelRatio; - - camera.aspect = ASPECT_RATIO; - camera.updateProjectionMatrix(); - - for (let y = 0; y < AMOUNT; y++) { - for (let x = 0; x < AMOUNT; x++) { - const subcamera = camera.cameras[AMOUNT * y + x]; - - subcamera.viewport.set(Math.floor(x * WIDTH), Math.floor(y * HEIGHT), Math.ceil(WIDTH), Math.ceil(HEIGHT)); - - subcamera.aspect = ASPECT_RATIO; - subcamera.updateProjectionMatrix(); - } - } - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.rotation.x += 0.005; - mesh.rotation.z += 0.01; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts b/examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts deleted file mode 100644 index f1d440004..000000000 --- a/examples-testing/examples/webgl_camera_logarithmicdepthbuffer.ts +++ /dev/null @@ -1,248 +0,0 @@ -import * as THREE from 'three'; - -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -import Stats from 'three/addons/libs/stats.module.js'; - -// 1 micrometer to 100 billion light years in one scene, with 1 unit = 1 meter? preposterous! and yet... -const NEAR = 1e-6, - FAR = 1e27; -let SCREEN_WIDTH = window.innerWidth; -let SCREEN_HEIGHT = window.innerHeight; -let screensplit = 0.25, - screensplit_right = 0; -const mouse = [0.5, 0.5]; -let zoompos = -100, - minzoomspeed = 0.015; -let zoomspeed = minzoomspeed; - -let container, border, stats; -const objects = {}; - -// Generate a number of text labels, from 1µm in size up to 100,000,000 light years -// Try to use some descriptive real-world examples of objects at each scale - -const labeldata = [ - { size: 0.01, scale: 0.0001, label: 'microscopic (1µm)' }, // FIXME - triangulating text fails at this size, so we scale instead - { size: 0.01, scale: 0.1, label: 'minuscule (1mm)' }, - { size: 0.01, scale: 1.0, label: 'tiny (1cm)' }, - { size: 1, scale: 1.0, label: 'child-sized (1m)' }, - { size: 10, scale: 1.0, label: 'tree-sized (10m)' }, - { size: 100, scale: 1.0, label: 'building-sized (100m)' }, - { size: 1000, scale: 1.0, label: 'medium (1km)' }, - { size: 10000, scale: 1.0, label: 'city-sized (10km)' }, - { size: 3400000, scale: 1.0, label: 'moon-sized (3,400 Km)' }, - { size: 12000000, scale: 1.0, label: 'planet-sized (12,000 km)' }, - { size: 1400000000, scale: 1.0, label: 'sun-sized (1,400,000 km)' }, - { size: 7.47e12, scale: 1.0, label: 'solar system-sized (50Au)' }, - { size: 9.4605284e15, scale: 1.0, label: 'gargantuan (1 light year)' }, - { size: 3.08567758e16, scale: 1.0, label: 'ludicrous (1 parsec)' }, - { size: 1e19, scale: 1.0, label: 'mind boggling (1000 light years)' }, -]; - -init(); - -function init() { - container = document.getElementById('container'); - - const loader = new FontLoader(); - loader.load('fonts/helvetiker_regular.typeface.json', function (font) { - const scene = initScene(font); - - // Initialize two copies of the same scene, one with normal z-buffer and one with logarithmic z-buffer - objects.normal = initView(scene, 'normal', false); - objects.logzbuf = initView(scene, 'logzbuf', true); - - animate(); - }); - - stats = new Stats(); - container.appendChild(stats.dom); - - // Resize border allows the user to easily compare effects of logarithmic depth buffer over the whole scene - border = document.getElementById('renderer_border'); - border.addEventListener('pointerdown', onBorderPointerDown); - - window.addEventListener('mousemove', onMouseMove); - window.addEventListener('resize', onWindowResize); - window.addEventListener('wheel', onMouseWheel); -} - -function initView(scene, name, logDepthBuf) { - const framecontainer = document.getElementById('container_' + name); - - const camera = new THREE.PerspectiveCamera(50, (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT, NEAR, FAR); - scene.add(camera); - - const renderer = new THREE.WebGLRenderer({ antialias: true, logarithmicDepthBuffer: logDepthBuf }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.domElement.style.position = 'relative'; - renderer.domElement.id = 'renderer_' + name; - framecontainer.appendChild(renderer.domElement); - - return { container: framecontainer, renderer: renderer, scene: scene, camera: camera }; -} - -function initScene(font) { - const scene = new THREE.Scene(); - - scene.add(new THREE.AmbientLight(0x777777)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(100, 100, 100); - scene.add(light); - - const materialargs = { - color: 0xffffff, - specular: 0x050505, - shininess: 50, - emissive: 0x000000, - }; - - const geometry = new THREE.SphereGeometry(0.5, 24, 12); - - for (let i = 0; i < labeldata.length; i++) { - const scale = labeldata[i].scale || 1; - - const labelgeo = new TextGeometry(labeldata[i].label, { - font: font, - size: labeldata[i].size, - depth: labeldata[i].size / 2, - }); - - labelgeo.computeBoundingSphere(); - - // center text - labelgeo.translate(-labelgeo.boundingSphere.radius, 0, 0); - - materialargs.color = new THREE.Color().setHSL(Math.random(), 0.5, 0.5); - - const material = new THREE.MeshPhongMaterial(materialargs); - - const group = new THREE.Group(); - group.position.z = -labeldata[i].size * scale; - scene.add(group); - - const textmesh = new THREE.Mesh(labelgeo, material); - textmesh.scale.set(scale, scale, scale); - textmesh.position.z = -labeldata[i].size * scale; - textmesh.position.y = (labeldata[i].size / 4) * scale; - group.add(textmesh); - - const dotmesh = new THREE.Mesh(geometry, material); - dotmesh.position.y = (-labeldata[i].size / 4) * scale; - dotmesh.scale.multiplyScalar(labeldata[i].size * scale); - group.add(dotmesh); - } - - return scene; -} - -function updateRendererSizes() { - // Recalculate size for both renderers when screen size or split location changes - - SCREEN_WIDTH = window.innerWidth; - SCREEN_HEIGHT = window.innerHeight; - - screensplit_right = 1 - screensplit; - - objects.normal.renderer.setSize(screensplit * SCREEN_WIDTH, SCREEN_HEIGHT); - objects.normal.camera.aspect = (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT; - objects.normal.camera.updateProjectionMatrix(); - objects.normal.camera.setViewOffset(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH * screensplit, SCREEN_HEIGHT); - objects.normal.container.style.width = screensplit * 100 + '%'; - - objects.logzbuf.renderer.setSize(screensplit_right * SCREEN_WIDTH, SCREEN_HEIGHT); - objects.logzbuf.camera.aspect = (screensplit_right * SCREEN_WIDTH) / SCREEN_HEIGHT; - objects.logzbuf.camera.updateProjectionMatrix(); - objects.logzbuf.camera.setViewOffset( - SCREEN_WIDTH, - SCREEN_HEIGHT, - SCREEN_WIDTH * screensplit, - 0, - SCREEN_WIDTH * screensplit_right, - SCREEN_HEIGHT, - ); - objects.logzbuf.container.style.width = screensplit_right * 100 + '%'; - - border.style.left = screensplit * 100 + '%'; -} - -function animate() { - requestAnimationFrame(animate); - render(); -} - -function render() { - // Put some limits on zooming - const minzoom = labeldata[0].size * labeldata[0].scale * 1; - const maxzoom = labeldata[labeldata.length - 1].size * labeldata[labeldata.length - 1].scale * 100; - let damping = Math.abs(zoomspeed) > minzoomspeed ? 0.95 : 1.0; - - // Zoom out faster the further out you go - const zoom = THREE.MathUtils.clamp(Math.pow(Math.E, zoompos), minzoom, maxzoom); - zoompos = Math.log(zoom); - - // Slow down quickly at the zoom limits - if ((zoom == minzoom && zoomspeed < 0) || (zoom == maxzoom && zoomspeed > 0)) { - damping = 0.85; - } - - zoompos += zoomspeed; - zoomspeed *= damping; - - objects.normal.camera.position.x = Math.sin(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; - objects.normal.camera.position.y = Math.sin(0.25 * Math.PI * (mouse[1] - 0.5)) * zoom; - objects.normal.camera.position.z = Math.cos(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; - objects.normal.camera.lookAt(objects.normal.scene.position); - - // Clone camera settings across both scenes - objects.logzbuf.camera.position.copy(objects.normal.camera.position); - objects.logzbuf.camera.quaternion.copy(objects.normal.camera.quaternion); - - // Update renderer sizes if the split has changed - if (screensplit_right != 1 - screensplit) { - updateRendererSizes(); - } - - objects.normal.renderer.render(objects.normal.scene, objects.normal.camera); - objects.logzbuf.renderer.render(objects.logzbuf.scene, objects.logzbuf.camera); - - stats.update(); -} - -function onWindowResize() { - updateRendererSizes(); -} - -function onBorderPointerDown() { - // activate draggable window resizing bar - window.addEventListener('pointermove', onBorderPointerMove); - window.addEventListener('pointerup', onBorderPointerUp); -} - -function onBorderPointerMove(ev) { - screensplit = Math.max(0, Math.min(1, ev.clientX / window.innerWidth)); -} - -function onBorderPointerUp() { - window.removeEventListener('pointermove', onBorderPointerMove); - window.removeEventListener('pointerup', onBorderPointerUp); -} - -function onMouseMove(ev) { - mouse[0] = ev.clientX / window.innerWidth; - mouse[1] = ev.clientY / window.innerHeight; -} - -function onMouseWheel(ev) { - const amount = ev.deltaY; - if (amount === 0) return; - const dir = amount / Math.abs(amount); - zoomspeed = dir / 10; - - // Slow down default zoom speed after user starts zooming, to give them more control - minzoomspeed = 0.001; -} diff --git a/examples-testing/examples/webgl_clipculldistance.ts b/examples-testing/examples/webgl_clipculldistance.ts deleted file mode 100644 index 42c1ff17f..000000000 --- a/examples-testing/examples/webgl_clipculldistance.ts +++ /dev/null @@ -1,113 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, controls, timer, scene, renderer, stats; - -let material; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10); - camera.position.z = 2; - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - if (renderer.extensions.has('WEBGL_clip_cull_distance') === false) { - document.getElementById('notSupported').style.display = ''; - return; - } - - const ext = renderer.getContext().getExtension('WEBGL_clip_cull_distance'); - const gl = renderer.getContext(); - - gl.enable(ext.CLIP_DISTANCE0_WEBGL); - - // geometry - - const vertexCount = 200 * 3; - - const geometry = new THREE.BufferGeometry(); - - const positions = []; - const colors = []; - - for (let i = 0; i < vertexCount; i++) { - // adding x,y,z - positions.push(Math.random() - 0.5); - positions.push(Math.random() - 0.5); - positions.push(Math.random() - 0.5); - - // adding r,g,b,a - colors.push(Math.random() * 255); - colors.push(Math.random() * 255); - colors.push(Math.random() * 255); - colors.push(Math.random() * 255); - } - - const positionAttribute = new THREE.Float32BufferAttribute(positions, 3); - const colorAttribute = new THREE.Uint8BufferAttribute(colors, 4); - colorAttribute.normalized = true; - - geometry.setAttribute('position', positionAttribute); - geometry.setAttribute('color', colorAttribute); - - // material - - material = new THREE.ShaderMaterial({ - uniforms: { - time: { value: 1.0 }, - }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - side: THREE.DoubleSide, - transparent: true, - vertexColors: true, - }); - - material.extensions.clipCullDistance = true; - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - controls = new OrbitControls(camera, renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - controls.update(); - stats.update(); - - material.uniforms.time.value = timer.getElapsed(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_clipping.ts b/examples-testing/examples/webgl_clipping.ts deleted file mode 100644 index cde10c7d1..000000000 --- a/examples-testing/examples/webgl_clipping.ts +++ /dev/null @@ -1,195 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, startTime, object, stats; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 0.25, 16); - - camera.position.set(0, 1.3, 3); - - scene = new THREE.Scene(); - - // Lights - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const spotLight = new THREE.SpotLight(0xffffff, 60); - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.2; - spotLight.position.set(2, 3, 3); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 3; - spotLight.shadow.camera.far = 10; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - scene.add(spotLight); - - const dirLight = new THREE.DirectionalLight(0x55505a, 3); - dirLight.position.set(0, 3, 0); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 1; - dirLight.shadow.camera.far = 10; - - dirLight.shadow.camera.right = 1; - dirLight.shadow.camera.left = -1; - dirLight.shadow.camera.top = 1; - dirLight.shadow.camera.bottom = -1; - - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; - scene.add(dirLight); - - // ***** Clipping planes: ***** - - const localPlane = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0.8); - const globalPlane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0.1); - - // Geometry - - const material = new THREE.MeshPhongMaterial({ - color: 0x80ee10, - shininess: 100, - side: THREE.DoubleSide, - - // ***** Clipping setup (material): ***** - clippingPlanes: [localPlane], - clipShadows: true, - - alphaToCoverage: true, - }); - - const geometry = new THREE.TorusKnotGeometry(0.4, 0.08, 95, 20); - - object = new THREE.Mesh(geometry, material); - object.castShadow = true; - scene.add(object); - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(9, 9, 1, 1), - new THREE.MeshPhongMaterial({ color: 0xa0adaf, shininess: 150 }), - ); - - ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z - ground.receiveShadow = true; - scene.add(ground); - - // Renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - // ***** Clipping setup (renderer): ***** - const globalPlanes = [globalPlane], - Empty = Object.freeze([]); - renderer.clippingPlanes = Empty; // GUI sets it to globalPlanes - renderer.localClippingEnabled = true; - - // Stats - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // Controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1, 0); - controls.update(); - - // GUI - - const gui = new GUI(), - props = { - alphaToCoverage: true, - }, - folderLocal = gui.addFolder('Local Clipping'), - propsLocal = { - get Enabled() { - return renderer.localClippingEnabled; - }, - set Enabled(v) { - renderer.localClippingEnabled = v; - }, - - get Shadows() { - return material.clipShadows; - }, - set Shadows(v) { - material.clipShadows = v; - }, - - get Plane() { - return localPlane.constant; - }, - set Plane(v) { - localPlane.constant = v; - }, - }, - folderGlobal = gui.addFolder('Global Clipping'), - propsGlobal = { - get Enabled() { - return renderer.clippingPlanes !== Empty; - }, - set Enabled(v) { - renderer.clippingPlanes = v ? globalPlanes : Empty; - }, - - get Plane() { - return globalPlane.constant; - }, - set Plane(v) { - globalPlane.constant = v; - }, - }; - - gui.add(props, 'alphaToCoverage').onChange(function (value) { - ground.material.alphaToCoverage = value; - ground.material.needsUpdate = true; - - material.alphaToCoverage = value; - material.needsUpdate = true; - }); - folderLocal.add(propsLocal, 'Enabled'); - folderLocal.add(propsLocal, 'Shadows'); - folderLocal.add(propsLocal, 'Plane', 0.3, 1.25); - - folderGlobal.add(propsGlobal, 'Enabled'); - folderGlobal.add(propsGlobal, 'Plane', -0.4, 3); - - // Start - - startTime = Date.now(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const currentTime = Date.now(); - const time = (currentTime - startTime) / 1000; - - object.position.y = 0.8; - object.rotation.x = time * 0.5; - object.rotation.y = time * 0.2; - object.scale.setScalar(Math.cos(time) * 0.125 + 0.875); - - stats.begin(); - renderer.render(scene, camera); - stats.end(); -} diff --git a/examples-testing/examples/webgl_clipping_advanced.ts b/examples-testing/examples/webgl_clipping_advanced.ts deleted file mode 100644 index f65f00043..000000000 --- a/examples-testing/examples/webgl_clipping_advanced.ts +++ /dev/null @@ -1,357 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -function planesFromMesh(vertices, indices) { - // creates a clipping volume from a convex triangular mesh - // specified by the arrays 'vertices' and 'indices' - - const n = indices.length / 3, - result = new Array(n); - - for (let i = 0, j = 0; i < n; ++i, j += 3) { - const a = vertices[indices[j]], - b = vertices[indices[j + 1]], - c = vertices[indices[j + 2]]; - - result[i] = new THREE.Plane().setFromCoplanarPoints(a, b, c); - } - - return result; -} - -function createPlanes(n) { - // creates an array of n uninitialized plane objects - - const result = new Array(n); - - for (let i = 0; i !== n; ++i) result[i] = new THREE.Plane(); - - return result; -} - -function assignTransformedPlanes(planesOut, planesIn, matrix) { - // sets an array of existing planes to transformed 'planesIn' - - for (let i = 0, n = planesIn.length; i !== n; ++i) planesOut[i].copy(planesIn[i]).applyMatrix4(matrix); -} - -function cylindricalPlanes(n, innerRadius) { - const result = createPlanes(n); - - for (let i = 0; i !== n; ++i) { - const plane = result[i], - angle = (i * Math.PI * 2) / n; - - plane.normal.set(Math.cos(angle), 0, Math.sin(angle)); - - plane.constant = innerRadius; - } - - return result; -} - -const planeToMatrix = (function () { - // creates a matrix that aligns X/Y to a given plane - - // temporaries: - const xAxis = new THREE.Vector3(), - yAxis = new THREE.Vector3(), - trans = new THREE.Vector3(); - - return function planeToMatrix(plane) { - const zAxis = plane.normal, - matrix = new THREE.Matrix4(); - - // Hughes & Moeller '99 - // "Building an Orthonormal Basis from a Unit Vector." - - if (Math.abs(zAxis.x) > Math.abs(zAxis.z)) { - yAxis.set(-zAxis.y, zAxis.x, 0); - } else { - yAxis.set(0, -zAxis.z, zAxis.y); - } - - xAxis.crossVectors(yAxis.normalize(), zAxis); - - plane.coplanarPoint(trans); - return matrix.set( - xAxis.x, - yAxis.x, - zAxis.x, - trans.x, - xAxis.y, - yAxis.y, - zAxis.y, - trans.y, - xAxis.z, - yAxis.z, - zAxis.z, - trans.z, - 0, - 0, - 0, - 1, - ); - }; -})(); - -// A regular tetrahedron for the clipping volume: - -const Vertices = [ - new THREE.Vector3(+1, 0, +Math.SQRT1_2), - new THREE.Vector3(-1, 0, +Math.SQRT1_2), - new THREE.Vector3(0, +1, -Math.SQRT1_2), - new THREE.Vector3(0, -1, -Math.SQRT1_2), - ], - Indices = [0, 1, 2, 0, 2, 3, 0, 3, 1, 1, 3, 2], - Planes = planesFromMesh(Vertices, Indices), - PlaneMatrices = Planes.map(planeToMatrix), - GlobalClippingPlanes = cylindricalPlanes(5, 2.5), - Empty = Object.freeze([]); - -let camera, scene, renderer, startTime, stats, object, clipMaterial, volumeVisualization, globalClippingPlanes; - -function init() { - camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 0.25, 16); - - camera.position.set(0, 1.5, 3); - - scene = new THREE.Scene(); - - // Lights - - scene.add(new THREE.AmbientLight(0xffffff)); - - const spotLight = new THREE.SpotLight(0xffffff, 60); - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.2; - spotLight.position.set(2, 3, 3); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 3; - spotLight.shadow.camera.far = 10; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - scene.add(spotLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 1.5); - dirLight.position.set(0, 2, 0); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 1; - dirLight.shadow.camera.far = 10; - - dirLight.shadow.camera.right = 1; - dirLight.shadow.camera.left = -1; - dirLight.shadow.camera.top = 1; - dirLight.shadow.camera.bottom = -1; - - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; - scene.add(dirLight); - - // Geometry - - clipMaterial = new THREE.MeshPhongMaterial({ - color: 0xee0a10, - shininess: 100, - side: THREE.DoubleSide, - // Clipping setup: - clippingPlanes: createPlanes(Planes.length), - clipShadows: true, - }); - - const count = 5 * 5 * 5; - const geometry = new THREE.BoxGeometry(0.18, 0.18, 0.18); - object = new THREE.InstancedMesh(geometry, clipMaterial, count); - object.castShadow = true; - - let i = 0; - const matrix = new THREE.Matrix4(); - - for (let z = -2; z <= 2; ++z) - for (let y = -2; y <= 2; ++y) - for (let x = -2; x <= 2; ++x) { - matrix.setPosition(x / 5, y / 5, z / 5); - object.setMatrixAt(i++, matrix); - } - - scene.add(object); - - const planeGeometry = new THREE.PlaneGeometry(3, 3, 1, 1), - color = new THREE.Color(); - - volumeVisualization = new THREE.Group(); - volumeVisualization.visible = false; - - for (let i = 0, n = Planes.length; i !== n; ++i) { - const material = new THREE.MeshBasicMaterial({ - color: color.setHSL(i / n, 0.5, 0.5).getHex(), - side: THREE.DoubleSide, - - opacity: 0.2, - transparent: true, - - // clip to the others to show the volume (wildly - // intersecting transparent planes look bad) - clippingPlanes: clipMaterial.clippingPlanes.filter(function (_, j) { - return j !== i; - }), - - // no need to enable shadow clipping - the plane - // visualization does not cast shadows - }); - - const mesh = new THREE.Mesh(planeGeometry, material); - mesh.matrixAutoUpdate = false; - - volumeVisualization.add(mesh); - } - - scene.add(volumeVisualization); - - const ground = new THREE.Mesh( - planeGeometry, - new THREE.MeshPhongMaterial({ - color: 0xa0adaf, - shininess: 10, - }), - ); - ground.rotation.x = -Math.PI / 2; - ground.scale.multiplyScalar(3); - ground.receiveShadow = true; - scene.add(ground); - - // Renderer - - const container = document.body; - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - container.appendChild(renderer.domElement); - // Clipping setup: - globalClippingPlanes = createPlanes(GlobalClippingPlanes.length); - renderer.clippingPlanes = Empty; - renderer.localClippingEnabled = true; - - window.addEventListener('resize', onWindowResize); - - // Stats - - stats = new Stats(); - container.appendChild(stats.dom); - - // Controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 8; - controls.target.set(0, 1, 0); - controls.update(); - - // GUI - - const gui = new GUI(), - folder = gui.addFolder('Local Clipping'), - props = { - get Enabled() { - return renderer.localClippingEnabled; - }, - set Enabled(v) { - renderer.localClippingEnabled = v; - if (!v) volumeVisualization.visible = false; - }, - - get Shadows() { - return clipMaterial.clipShadows; - }, - set Shadows(v) { - clipMaterial.clipShadows = v; - }, - - get Visualize() { - return volumeVisualization.visible; - }, - set Visualize(v) { - if (renderer.localClippingEnabled) volumeVisualization.visible = v; - }, - }; - - folder.add(props, 'Enabled'); - folder.add(props, 'Shadows'); - folder.add(props, 'Visualize').listen(); - - gui.addFolder('Global Clipping').add( - { - get Enabled() { - return renderer.clippingPlanes !== Empty; - }, - set Enabled(v) { - renderer.clippingPlanes = v ? globalClippingPlanes : Empty; - }, - }, - 'Enabled', - ); - - // Start - - startTime = Date.now(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function setObjectWorldMatrix(object, matrix) { - // set the orientation of an object based on a world matrix - - const parent = object.parent; - scene.updateMatrixWorld(); - object.matrix.copy(parent.matrixWorld).invert(); - object.applyMatrix4(matrix); -} - -const transform = new THREE.Matrix4(), - tmpMatrix = new THREE.Matrix4(); - -function animate() { - const currentTime = Date.now(), - time = (currentTime - startTime) / 1000; - - object.position.y = 1; - object.rotation.x = time * 0.5; - object.rotation.y = time * 0.2; - - object.updateMatrix(); - transform.copy(object.matrix); - - const bouncy = Math.cos(time * 0.5) * 0.5 + 0.7; - transform.multiply(tmpMatrix.makeScale(bouncy, bouncy, bouncy)); - - assignTransformedPlanes(clipMaterial.clippingPlanes, Planes, transform); - - const planeMeshes = volumeVisualization.children; - - for (let i = 0, n = planeMeshes.length; i !== n; ++i) { - tmpMatrix.multiplyMatrices(transform, PlaneMatrices[i]); - setObjectWorldMatrix(planeMeshes[i], tmpMatrix); - } - - transform.makeRotationY(time * 0.1); - - assignTransformedPlanes(globalClippingPlanes, GlobalClippingPlanes, transform); - - stats.begin(); - renderer.render(scene, camera); - stats.end(); -} - -init(); diff --git a/examples-testing/examples/webgl_clipping_intersection.ts b/examples-testing/examples/webgl_clipping_intersection.ts deleted file mode 100644 index 5f45e45df..000000000 --- a/examples-testing/examples/webgl_clipping_intersection.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; - -const params = { - clipIntersection: true, - planeConstant: 0, - showHelpers: false, - alphaToCoverage: true, -}; - -const clipPlanes = [ - new THREE.Plane(new THREE.Vector3(1, 0, 0), 0), - new THREE.Plane(new THREE.Vector3(0, -1, 0), 0), - new THREE.Plane(new THREE.Vector3(0, 0, -1), 0), -]; - -init(); -render(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.localClippingEnabled = true; - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 200); - - camera.position.set(-1.5, 2.5, 3.0); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use only if there is no animation loop - controls.minDistance = 1; - controls.maxDistance = 10; - controls.enablePan = false; - - const light = new THREE.HemisphereLight(0xffffff, 0x080808, 4.5); - light.position.set(-1.25, 1, 1.25); - scene.add(light); - - // - - const group = new THREE.Group(); - - for (let i = 1; i <= 30; i += 2) { - const geometry = new THREE.SphereGeometry(i / 30, 48, 24); - - const material = new THREE.MeshPhongMaterial({ - color: new THREE.Color().setHSL(Math.random(), 0.5, 0.5, THREE.SRGBColorSpace), - side: THREE.DoubleSide, - clippingPlanes: clipPlanes, - clipIntersection: params.clipIntersection, - alphaToCoverage: true, - }); - - group.add(new THREE.Mesh(geometry, material)); - } - - scene.add(group); - - // helpers - - const helpers = new THREE.Group(); - helpers.add(new THREE.PlaneHelper(clipPlanes[0], 2, 0xff0000)); - helpers.add(new THREE.PlaneHelper(clipPlanes[1], 2, 0x00ff00)); - helpers.add(new THREE.PlaneHelper(clipPlanes[2], 2, 0x0000ff)); - helpers.visible = false; - scene.add(helpers); - - // gui - - const gui = new GUI(); - - gui.add(params, 'alphaToCoverage').onChange(function (value) { - group.children.forEach(c => { - c.material.alphaToCoverage = Boolean(value); - c.material.needsUpdate = true; - }); - - render(); - }); - - gui.add(params, 'clipIntersection') - .name('clip intersection') - .onChange(function (value) { - const children = group.children; - - for (let i = 0; i < children.length; i++) { - children[i].material.clipIntersection = value; - } - - render(); - }); - - gui.add(params, 'planeConstant', -1, 1) - .step(0.01) - .name('plane constant') - .onChange(function (value) { - for (let j = 0; j < clipPlanes.length; j++) { - clipPlanes[j].constant = value; - } - - render(); - }); - - gui.add(params, 'showHelpers') - .name('show helpers') - .onChange(function (value) { - helpers.visible = value; - - render(); - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_clipping_stencil.ts b/examples-testing/examples/webgl_clipping_stencil.ts deleted file mode 100644 index 7cb1f5c52..000000000 --- a/examples-testing/examples/webgl_clipping_stencil.ts +++ /dev/null @@ -1,263 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, object, stats; -let planes, planeObjects, planeHelpers; -let timer; - -const params = { - animate: true, - planeX: { - constant: 0, - negated: false, - displayHelper: false, - }, - planeY: { - constant: 0, - negated: false, - displayHelper: false, - }, - planeZ: { - constant: 0, - negated: false, - displayHelper: false, - }, -}; - -init(); - -function createPlaneStencilGroup(geometry, plane, renderOrder) { - const group = new THREE.Group(); - const baseMat = new THREE.MeshBasicMaterial(); - baseMat.depthWrite = false; - baseMat.depthTest = false; - baseMat.colorWrite = false; - baseMat.stencilWrite = true; - baseMat.stencilFunc = THREE.AlwaysStencilFunc; - - // back faces - const mat0 = baseMat.clone(); - mat0.side = THREE.BackSide; - mat0.clippingPlanes = [plane]; - mat0.stencilFail = THREE.IncrementWrapStencilOp; - mat0.stencilZFail = THREE.IncrementWrapStencilOp; - mat0.stencilZPass = THREE.IncrementWrapStencilOp; - - const mesh0 = new THREE.Mesh(geometry, mat0); - mesh0.renderOrder = renderOrder; - group.add(mesh0); - - // front faces - const mat1 = baseMat.clone(); - mat1.side = THREE.FrontSide; - mat1.clippingPlanes = [plane]; - mat1.stencilFail = THREE.DecrementWrapStencilOp; - mat1.stencilZFail = THREE.DecrementWrapStencilOp; - mat1.stencilZPass = THREE.DecrementWrapStencilOp; - - const mesh1 = new THREE.Mesh(geometry, mat1); - mesh1.renderOrder = renderOrder; - - group.add(mesh1); - - return group; -} - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 1, 100); - camera.position.set(2, 2, 2); - - scene.add(new THREE.AmbientLight(0xffffff, 1.5)); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(5, 10, 7.5); - dirLight.castShadow = true; - dirLight.shadow.camera.right = 2; - dirLight.shadow.camera.left = -2; - dirLight.shadow.camera.top = 2; - dirLight.shadow.camera.bottom = -2; - - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; - scene.add(dirLight); - - planes = [ - new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0), - new THREE.Plane(new THREE.Vector3(0, -1, 0), 0), - new THREE.Plane(new THREE.Vector3(0, 0, -1), 0), - ]; - - planeHelpers = planes.map(p => new THREE.PlaneHelper(p, 2, 0xffffff)); - planeHelpers.forEach(ph => { - ph.visible = false; - scene.add(ph); - }); - - const geometry = new THREE.TorusKnotGeometry(0.4, 0.15, 220, 60); - object = new THREE.Group(); - scene.add(object); - - // Set up clip plane rendering - planeObjects = []; - const planeGeom = new THREE.PlaneGeometry(4, 4); - - for (let i = 0; i < 3; i++) { - const poGroup = new THREE.Group(); - const plane = planes[i]; - const stencilGroup = createPlaneStencilGroup(geometry, plane, i + 1); - - // plane is clipped by the other clipping planes - const planeMat = new THREE.MeshStandardMaterial({ - color: 0xe91e63, - metalness: 0.1, - roughness: 0.75, - clippingPlanes: planes.filter(p => p !== plane), - - stencilWrite: true, - stencilRef: 0, - stencilFunc: THREE.NotEqualStencilFunc, - stencilFail: THREE.ReplaceStencilOp, - stencilZFail: THREE.ReplaceStencilOp, - stencilZPass: THREE.ReplaceStencilOp, - }); - const po = new THREE.Mesh(planeGeom, planeMat); - po.onAfterRender = function (renderer) { - renderer.clearStencil(); - }; - - po.renderOrder = i + 1.1; - - object.add(stencilGroup); - poGroup.add(po); - planeObjects.push(po); - scene.add(poGroup); - } - - const material = new THREE.MeshStandardMaterial({ - color: 0xffc107, - metalness: 0.1, - roughness: 0.75, - clippingPlanes: planes, - clipShadows: true, - shadowSide: THREE.DoubleSide, - }); - - // add the color - const clippedColorFront = new THREE.Mesh(geometry, material); - clippedColorFront.castShadow = true; - clippedColorFront.renderOrder = 6; - object.add(clippedColorFront); - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(9, 9, 1, 1), - new THREE.ShadowMaterial({ color: 0x000000, opacity: 0.25, side: THREE.DoubleSide }), - ); - - ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z - ground.position.y = -1; - ground.receiveShadow = true; - scene.add(ground); - - // Renderer - renderer = new THREE.WebGLRenderer({ antialias: true, stencil: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setClearColor(0x263238); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.localClippingEnabled = true; - document.body.appendChild(renderer.domElement); - - // Stats - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); - - // Controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 20; - controls.update(); - - // GUI - const gui = new GUI(); - gui.add(params, 'animate'); - - const planeX = gui.addFolder('planeX'); - planeX.add(params.planeX, 'displayHelper').onChange(v => (planeHelpers[0].visible = v)); - planeX - .add(params.planeX, 'constant') - .min(-1) - .max(1) - .onChange(d => (planes[0].constant = d)); - planeX.add(params.planeX, 'negated').onChange(() => { - planes[0].negate(); - params.planeX.constant = planes[0].constant; - }); - planeX.open(); - - const planeY = gui.addFolder('planeY'); - planeY.add(params.planeY, 'displayHelper').onChange(v => (planeHelpers[1].visible = v)); - planeY - .add(params.planeY, 'constant') - .min(-1) - .max(1) - .onChange(d => (planes[1].constant = d)); - planeY.add(params.planeY, 'negated').onChange(() => { - planes[1].negate(); - params.planeY.constant = planes[1].constant; - }); - planeY.open(); - - const planeZ = gui.addFolder('planeZ'); - planeZ.add(params.planeZ, 'displayHelper').onChange(v => (planeHelpers[2].visible = v)); - planeZ - .add(params.planeZ, 'constant') - .min(-1) - .max(1) - .onChange(d => (planes[2].constant = d)); - planeZ.add(params.planeZ, 'negated').onChange(() => { - planes[2].negate(); - params.planeZ.constant = planes[2].constant; - }); - planeZ.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (params.animate) { - object.rotation.x += delta * 0.5; - object.rotation.y += delta * 0.2; - } - - for (let i = 0; i < planeObjects.length; i++) { - const plane = planes[i]; - const po = planeObjects[i]; - plane.coplanarPoint(po.position); - po.lookAt(po.position.x - plane.normal.x, po.position.y - plane.normal.y, po.position.z - plane.normal.z); - } - - stats.begin(); - renderer.render(scene, camera); - stats.end(); -} diff --git a/examples-testing/examples/webgl_custom_attributes.ts b/examples-testing/examples/webgl_custom_attributes.ts deleted file mode 100644 index 0dc897748..000000000 --- a/examples-testing/examples/webgl_custom_attributes.ts +++ /dev/null @@ -1,100 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let renderer, scene, camera, stats; - -let sphere, uniforms; - -let displacement, noise; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 300; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - - uniforms = { - amplitude: { value: 1.0 }, - color: { value: new THREE.Color(0xff2200) }, - colorTexture: { value: new THREE.TextureLoader().load('textures/water.jpg') }, - }; - - uniforms['colorTexture'].value.wrapS = uniforms['colorTexture'].value.wrapT = THREE.RepeatWrapping; - - const shaderMaterial = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - }); - - const radius = 50, - segments = 128, - rings = 64; - - const geometry = new THREE.SphereGeometry(radius, segments, rings); - - displacement = new Float32Array(geometry.attributes.position.count); - noise = new Float32Array(geometry.attributes.position.count); - - for (let i = 0; i < displacement.length; i++) { - noise[i] = Math.random() * 5; - } - - geometry.setAttribute('displacement', new THREE.BufferAttribute(displacement, 1)); - - sphere = new THREE.Mesh(geometry, shaderMaterial); - scene.add(sphere); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - const container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.01; - - sphere.rotation.y = sphere.rotation.z = 0.01 * time; - - uniforms['amplitude'].value = 2.5 * Math.sin(sphere.rotation.y * 0.125); - uniforms['color'].value.offsetHSL(0.0005, 0, 0); - - for (let i = 0; i < displacement.length; i++) { - displacement[i] = Math.sin(0.1 * i + time); - - noise[i] += 0.5 * (0.5 - Math.random()); - noise[i] = THREE.MathUtils.clamp(noise[i], -5, 5); - - displacement[i] += noise[i]; - } - - sphere.geometry.attributes.displacement.needsUpdate = true; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_custom_attributes_lines.ts b/examples-testing/examples/webgl_custom_attributes_lines.ts deleted file mode 100644 index 3e2454e92..000000000 --- a/examples-testing/examples/webgl_custom_attributes_lines.ts +++ /dev/null @@ -1,121 +0,0 @@ -import * as THREE from 'three'; - -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let renderer, scene, camera, stats; - -let line, uniforms; - -const loader = new FontLoader(); -loader.load('fonts/helvetiker_bold.typeface.json', function (font) { - init(font); -}); - -function init(font) { - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 400; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - - uniforms = { - amplitude: { value: 5.0 }, - opacity: { value: 0.3 }, - color: { value: new THREE.Color(0xffffff) }, - }; - - const shaderMaterial = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - blending: THREE.AdditiveBlending, - depthTest: false, - transparent: true, - }); - - const geometry = new TextGeometry('three.js', { - font: font, - - size: 50, - depth: 15, - curveSegments: 10, - - bevelThickness: 5, - bevelSize: 1.5, - bevelEnabled: true, - bevelSegments: 10, - }); - - geometry.center(); - - const count = geometry.attributes.position.count; - - const displacement = new THREE.Float32BufferAttribute(count * 3, 3); - geometry.setAttribute('displacement', displacement); - - const customColor = new THREE.Float32BufferAttribute(count * 3, 3); - geometry.setAttribute('customColor', customColor); - - const color = new THREE.Color(0xffffff); - - for (let i = 0, l = customColor.count; i < l; i++) { - color.setHSL(i / l, 0.5, 0.5); - color.toArray(customColor.array, i * customColor.itemSize); - } - - line = new THREE.Line(geometry, shaderMaterial); - line.rotation.x = 0.2; - scene.add(line); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - const container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.001; - - line.rotation.y = 0.25 * time; - - uniforms.amplitude.value = Math.sin(0.5 * time); - uniforms.color.value.offsetHSL(0.0005, 0, 0); - - const attributes = line.geometry.attributes; - const array = attributes.displacement.array; - - for (let i = 0, l = array.length; i < l; i += 3) { - array[i] += 0.3 * (0.5 - Math.random()); - array[i + 1] += 0.3 * (0.5 - Math.random()); - array[i + 2] += 0.3 * (0.5 - Math.random()); - } - - attributes.displacement.needsUpdate = true; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_custom_attributes_points.ts b/examples-testing/examples/webgl_custom_attributes_points.ts deleted file mode 100644 index ae112980a..000000000 --- a/examples-testing/examples/webgl_custom_attributes_points.ts +++ /dev/null @@ -1,117 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let renderer, scene, camera, stats; - -let sphere; - -const WIDTH = window.innerWidth; -const HEIGHT = window.innerHeight; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(40, WIDTH / HEIGHT, 1, 10000); - camera.position.z = 300; - - scene = new THREE.Scene(); - - const amount = 100000; - const radius = 200; - - const positions = new Float32Array(amount * 3); - const colors = new Float32Array(amount * 3); - const sizes = new Float32Array(amount); - - const vertex = new THREE.Vector3(); - const color = new THREE.Color(0xffffff); - - for (let i = 0; i < amount; i++) { - vertex.x = (Math.random() * 2 - 1) * radius; - vertex.y = (Math.random() * 2 - 1) * radius; - vertex.z = (Math.random() * 2 - 1) * radius; - vertex.toArray(positions, i * 3); - - if (vertex.x < 0) { - color.setHSL(0.5 + 0.1 * (i / amount), 0.7, 0.5); - } else { - color.setHSL(0.0 + 0.1 * (i / amount), 0.9, 0.5); - } - - color.toArray(colors, i * 3); - - sizes[i] = 10; - } - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - geometry.setAttribute('customColor', new THREE.BufferAttribute(colors, 3)); - geometry.setAttribute('size', new THREE.BufferAttribute(sizes, 1)); - - // - - const material = new THREE.ShaderMaterial({ - uniforms: { - color: { value: new THREE.Color(0xffffff) }, - pointTexture: { value: new THREE.TextureLoader().load('textures/sprites/spark1.png') }, - }, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - - blending: THREE.AdditiveBlending, - depthTest: false, - transparent: true, - }); - - // - - sphere = new THREE.Points(geometry, material); - scene.add(sphere); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(WIDTH, HEIGHT); - renderer.setAnimationLoop(animate); - - const container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.005; - - sphere.rotation.z = 0.01 * time; - - const geometry = sphere.geometry; - const attributes = geometry.attributes; - - for (let i = 0; i < attributes.size.array.length; i++) { - attributes.size.array[i] = 14 + 13 * Math.sin(0.1 * i + time); - } - - attributes.size.needsUpdate = true; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_custom_attributes_points2.ts b/examples-testing/examples/webgl_custom_attributes_points2.ts deleted file mode 100644 index edd158fa1..000000000 --- a/examples-testing/examples/webgl_custom_attributes_points2.ts +++ /dev/null @@ -1,193 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -let renderer, scene, camera, stats; -let sphere, length1; - -const WIDTH = window.innerWidth; -const HEIGHT = window.innerHeight; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, WIDTH / HEIGHT, 1, 10000); - camera.position.z = 300; - - scene = new THREE.Scene(); - - const radius = 100, - segments = 68, - rings = 38; - - let sphereGeometry = new THREE.SphereGeometry(radius, segments, rings); - let boxGeometry = new THREE.BoxGeometry(0.8 * radius, 0.8 * radius, 0.8 * radius, 10, 10, 10); - - // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data - - sphereGeometry.deleteAttribute('normal'); - sphereGeometry.deleteAttribute('uv'); - - boxGeometry.deleteAttribute('normal'); - boxGeometry.deleteAttribute('uv'); - - sphereGeometry = BufferGeometryUtils.mergeVertices(sphereGeometry); - boxGeometry = BufferGeometryUtils.mergeVertices(boxGeometry); - - const combinedGeometry = BufferGeometryUtils.mergeGeometries([sphereGeometry, boxGeometry]); - const positionAttribute = combinedGeometry.getAttribute('position'); - - const colors = []; - const sizes = []; - - const color = new THREE.Color(); - const vertex = new THREE.Vector3(); - - length1 = sphereGeometry.getAttribute('position').count; - - for (let i = 0, l = positionAttribute.count; i < l; i++) { - vertex.fromBufferAttribute(positionAttribute, i); - - if (i < length1) { - color.setHSL(0.01 + 0.1 * (i / length1), 0.99, (vertex.y + radius) / (4 * radius)); - } else { - color.setHSL(0.6, 0.75, 0.25 + vertex.y / (2 * radius)); - } - - color.toArray(colors, i * 3); - - sizes[i] = i < length1 ? 10 : 40; - } - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', positionAttribute); - geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1)); - geometry.setAttribute('ca', new THREE.Float32BufferAttribute(colors, 3)); - - // - - const texture = new THREE.TextureLoader().load('textures/sprites/disc.png'); - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - - const material = new THREE.ShaderMaterial({ - uniforms: { - color: { value: new THREE.Color(0xffffff) }, - pointTexture: { value: texture }, - }, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - transparent: true, - }); - - // - - sphere = new THREE.Points(geometry, material); - scene.add(sphere); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(WIDTH, HEIGHT); - renderer.setAnimationLoop(animate); - - const container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function sortPoints() { - const vector = new THREE.Vector3(); - - // Model View Projection matrix - - const matrix = new THREE.Matrix4(); - matrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - matrix.multiply(sphere.matrixWorld); - - // - - const geometry = sphere.geometry; - - let index = geometry.getIndex(); - const positions = geometry.getAttribute('position').array; - const length = positions.length / 3; - - if (index === null) { - const array = new Uint16Array(length); - - for (let i = 0; i < length; i++) { - array[i] = i; - } - - index = new THREE.BufferAttribute(array, 1); - - geometry.setIndex(index); - } - - const sortArray = []; - - for (let i = 0; i < length; i++) { - vector.fromArray(positions, i * 3); - vector.applyMatrix4(matrix); - - sortArray.push([vector.z, i]); - } - - function numericalSort(a, b) { - return b[0] - a[0]; - } - - sortArray.sort(numericalSort); - - const indices = index.array; - - for (let i = 0; i < length; i++) { - indices[i] = sortArray[i][1]; - } - - geometry.index.needsUpdate = true; -} - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.005; - - sphere.rotation.y = 0.02 * time; - sphere.rotation.z = 0.02 * time; - - const geometry = sphere.geometry; - const attributes = geometry.attributes; - - for (let i = 0; i < attributes.size.array.length; i++) { - if (i < length1) { - attributes.size.array[i] = 16 + 12 * Math.sin(0.1 * i + time); - } - } - - attributes.size.needsUpdate = true; - - sortPoints(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_custom_attributes_points3.ts b/examples-testing/examples/webgl_custom_attributes_points3.ts deleted file mode 100644 index 1bca8ccd4..000000000 --- a/examples-testing/examples/webgl_custom_attributes_points3.ts +++ /dev/null @@ -1,200 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -let renderer, scene, camera, stats; - -let object; - -let vertices1; - -const WIDTH = window.innerWidth; -const HEIGHT = window.innerHeight; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(40, WIDTH / HEIGHT, 1, 1000); - camera.position.z = 500; - - scene = new THREE.Scene(); - - let radius = 100; - const inner = 0.6 * radius; - const vertex = new THREE.Vector3(); - const vertices = []; - - for (let i = 0; i < 100000; i++) { - vertex.x = Math.random() * 2 - 1; - vertex.y = Math.random() * 2 - 1; - vertex.z = Math.random() * 2 - 1; - vertex.multiplyScalar(radius); - - if ( - vertex.x > inner || - vertex.x < -inner || - vertex.y > inner || - vertex.y < -inner || - vertex.z > inner || - vertex.z < -inner - ) - vertices.push(vertex.x, vertex.y, vertex.z); - } - - vertices1 = vertices.length / 3; - - radius = 200; - - let boxGeometry1 = new THREE.BoxGeometry(radius, 0.1 * radius, 0.1 * radius, 50, 5, 5); - - // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data - - boxGeometry1.deleteAttribute('normal'); - boxGeometry1.deleteAttribute('uv'); - - boxGeometry1 = BufferGeometryUtils.mergeVertices(boxGeometry1); - - const matrix = new THREE.Matrix4(); - const position = new THREE.Vector3(); - const rotation = new THREE.Euler(); - const quaternion = new THREE.Quaternion(); - const scale = new THREE.Vector3(1, 1, 1); - - function addGeo(geo, x, y, z, ry) { - position.set(x, y, z); - rotation.set(0, ry, 0); - - matrix.compose(position, quaternion.setFromEuler(rotation), scale); - - const positionAttribute = geo.getAttribute('position'); - - for (let i = 0, l = positionAttribute.count; i < l; i++) { - vertex.fromBufferAttribute(positionAttribute, i); - vertex.applyMatrix4(matrix); - vertices.push(vertex.x, vertex.y, vertex.z); - } - } - - // side 1 - - addGeo(boxGeometry1, 0, 110, 110, 0); - addGeo(boxGeometry1, 0, 110, -110, 0); - addGeo(boxGeometry1, 0, -110, 110, 0); - addGeo(boxGeometry1, 0, -110, -110, 0); - - // side 2 - - addGeo(boxGeometry1, 110, 110, 0, Math.PI / 2); - addGeo(boxGeometry1, 110, -110, 0, Math.PI / 2); - addGeo(boxGeometry1, -110, 110, 0, Math.PI / 2); - addGeo(boxGeometry1, -110, -110, 0, Math.PI / 2); - - // corner edges - - let boxGeometry2 = new THREE.BoxGeometry(0.1 * radius, radius * 1.2, 0.1 * radius, 5, 60, 5); - - boxGeometry2.deleteAttribute('normal'); - boxGeometry2.deleteAttribute('uv'); - - boxGeometry2 = BufferGeometryUtils.mergeVertices(boxGeometry2); - - addGeo(boxGeometry2, 110, 0, 110, 0); - addGeo(boxGeometry2, 110, 0, -110, 0); - addGeo(boxGeometry2, -110, 0, 110, 0); - addGeo(boxGeometry2, -110, 0, -110, 0); - - const positionAttribute = new THREE.Float32BufferAttribute(vertices, 3); - - const colors = []; - const sizes = []; - - const color = new THREE.Color(); - - for (let i = 0; i < positionAttribute.count; i++) { - if (i < vertices1) { - color.setHSL(0.5 + 0.2 * (i / vertices1), 1, 0.5); - } else { - color.setHSL(0.1, 1, 0.5); - } - - color.toArray(colors, i * 3); - - sizes[i] = i < vertices1 ? 10 : 40; - } - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', positionAttribute); - geometry.setAttribute('ca', new THREE.Float32BufferAttribute(colors, 3)); - geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1)); - - // - - const texture = new THREE.TextureLoader().load('textures/sprites/ball.png'); - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - - const material = new THREE.ShaderMaterial({ - uniforms: { - amplitude: { value: 1.0 }, - color: { value: new THREE.Color(0xffffff) }, - pointTexture: { value: texture }, - }, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - }); - - // - - object = new THREE.Points(geometry, material); - scene.add(object); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(WIDTH, HEIGHT); - renderer.setAnimationLoop(animate); - - const container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.01; - - object.rotation.y = object.rotation.z = 0.02 * time; - - const geometry = object.geometry; - const attributes = geometry.attributes; - - for (let i = 0; i < attributes.size.array.length; i++) { - if (i < vertices1) { - attributes.size.array[i] = Math.max(0, 26 + 32 * Math.sin(0.1 * i + 0.6 * time)); - } - } - - attributes.size.needsUpdate = true; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_decals.ts b/examples-testing/examples/webgl_decals.ts deleted file mode 100644 index 8f77c30fc..000000000 --- a/examples-testing/examples/webgl_decals.ts +++ /dev/null @@ -1,240 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js'; - -const container = document.getElementById('container'); - -let renderer, scene, camera, stats; -let mesh; -let raycaster; -let line; - -const intersection = { - intersects: false, - point: new THREE.Vector3(), - normal: new THREE.Vector3(), -}; -const mouse = new THREE.Vector2(); -const intersects = []; - -const textureLoader = new THREE.TextureLoader(); -const decalDiffuse = textureLoader.load('textures/decal/decal-diffuse.png'); -decalDiffuse.colorSpace = THREE.SRGBColorSpace; -const decalNormal = textureLoader.load('textures/decal/decal-normal.jpg'); - -const decalMaterial = new THREE.MeshPhongMaterial({ - specular: 0x444444, - map: decalDiffuse, - normalMap: decalNormal, - normalScale: new THREE.Vector2(1, 1), - shininess: 30, - transparent: true, - depthTest: true, - depthWrite: false, - polygonOffset: true, - polygonOffsetFactor: -4, - wireframe: false, -}); - -const decals = []; -let mouseHelper; -const position = new THREE.Vector3(); -const orientation = new THREE.Euler(); -const size = new THREE.Vector3(10, 10, 10); - -const params = { - minScale: 10, - maxScale: 20, - rotate: true, - clear: function () { - removeDecals(); - }, -}; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 120; - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 50; - controls.maxDistance = 200; - - scene.add(new THREE.AmbientLight(0x666666)); - - const dirLight1 = new THREE.DirectionalLight(0xffddcc, 3); - dirLight1.position.set(1, 0.75, 0.5); - scene.add(dirLight1); - - const dirLight2 = new THREE.DirectionalLight(0xccccff, 3); - dirLight2.position.set(-1, 0.75, -0.5); - scene.add(dirLight2); - - const geometry = new THREE.BufferGeometry(); - geometry.setFromPoints([new THREE.Vector3(), new THREE.Vector3()]); - - line = new THREE.Line(geometry, new THREE.LineBasicMaterial()); - scene.add(line); - - loadLeePerrySmith(); - - raycaster = new THREE.Raycaster(); - - mouseHelper = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 10), new THREE.MeshNormalMaterial()); - mouseHelper.visible = false; - scene.add(mouseHelper); - - window.addEventListener('resize', onWindowResize); - - let moved = false; - - controls.addEventListener('change', function () { - moved = true; - }); - - window.addEventListener('pointerdown', function () { - moved = false; - }); - - window.addEventListener('pointerup', function (event) { - if (moved === false) { - checkIntersection(event.clientX, event.clientY); - - if (intersection.intersects) shoot(); - } - }); - - window.addEventListener('pointermove', onPointerMove); - - function onPointerMove(event) { - if (event.isPrimary) { - checkIntersection(event.clientX, event.clientY); - } - } - - function checkIntersection(x, y) { - if (mesh === undefined) return; - - mouse.x = (x / window.innerWidth) * 2 - 1; - mouse.y = -(y / window.innerHeight) * 2 + 1; - - raycaster.setFromCamera(mouse, camera); - raycaster.intersectObject(mesh, false, intersects); - - if (intersects.length > 0) { - const p = intersects[0].point; - mouseHelper.position.copy(p); - intersection.point.copy(p); - - const normalMatrix = new THREE.Matrix3().getNormalMatrix(mesh.matrixWorld); - - const n = intersects[0].face.normal.clone(); - n.applyNormalMatrix(normalMatrix); - n.multiplyScalar(10); - n.add(intersects[0].point); - - intersection.normal.copy(intersects[0].face.normal); - mouseHelper.lookAt(n); - - const positions = line.geometry.attributes.position; - positions.setXYZ(0, p.x, p.y, p.z); - positions.setXYZ(1, n.x, n.y, n.z); - positions.needsUpdate = true; - - intersection.intersects = true; - - intersects.length = 0; - } else { - intersection.intersects = false; - } - } - - const gui = new GUI(); - - gui.add(params, 'minScale', 1, 30); - gui.add(params, 'maxScale', 1, 30); - gui.add(params, 'rotate'); - gui.add(params, 'clear'); - gui.open(); -} - -function loadLeePerrySmith() { - const map = textureLoader.load('models/gltf/LeePerrySmith/Map-COL.jpg'); - map.colorSpace = THREE.SRGBColorSpace; - const specularMap = textureLoader.load('models/gltf/LeePerrySmith/Map-SPEC.jpg'); - const normalMap = textureLoader.load('models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg'); - - const loader = new GLTFLoader(); - - loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - mesh = gltf.scene.children[0]; - mesh.material = new THREE.MeshPhongMaterial({ - specular: 0x111111, - map: map, - specularMap: specularMap, - normalMap: normalMap, - shininess: 25, - }); - - scene.add(mesh); - mesh.scale.multiplyScalar(10); - }); -} - -function shoot() { - position.copy(intersection.point); - orientation.copy(mouseHelper.rotation); - - if (params.rotate) orientation.z = Math.random() * 2 * Math.PI; - - const scale = params.minScale + Math.random() * (params.maxScale - params.minScale); - size.set(scale, scale, scale); - - const material = decalMaterial.clone(); - material.color.setHex(Math.random() * 0xffffff); - - const m = new THREE.Mesh(new DecalGeometry(mesh, position, orientation, size), material); - m.renderOrder = decals.length; // give decals a fixed render order - - decals.push(m); - - mesh.attach(m); -} - -function removeDecals() { - decals.forEach(function (d) { - mesh.remove(d); - }); - - decals.length = 0; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_effects_anaglyph.ts b/examples-testing/examples/webgl_effects_anaglyph.ts deleted file mode 100644 index 7e67c9173..000000000 --- a/examples-testing/examples/webgl_effects_anaglyph.ts +++ /dev/null @@ -1,120 +0,0 @@ -import * as THREE from 'three'; - -import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js'; - -let container, camera, scene, renderer, effect; - -const spheres = []; - -let mouseX = 0; -let mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -document.addEventListener('mousemove', onDocumentMouseMove); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.z = 3; - - const path = 'textures/cube/pisa/'; - const format = '.png'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const textureCube = new THREE.CubeTextureLoader().load(urls); - - scene = new THREE.Scene(); - scene.background = textureCube; - - const geometry = new THREE.SphereGeometry(0.1, 32, 16); - const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); - - for (let i = 0; i < 500; i++) { - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = Math.random() * 10 - 5; - mesh.position.y = Math.random() * 10 - 5; - mesh.position.z = Math.random() * 10 - 5; - - mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - - scene.add(mesh); - - spheres.push(mesh); - } - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - const width = window.innerWidth || 2; - const height = window.innerHeight || 2; - - effect = new AnaglyphEffect(renderer); - effect.setSize(width, height); - - // Configure stereo parameters for physically-correct rendering - // eyeSep: interpupillary distance (default 0.064m / 64mm for humans) - // planeDistance: distance to the zero-parallax plane (objects here appear at screen depth) - effect.eyeSep = 0.064; - effect.planeDistance = 3; // Match camera distance to origin for zero parallax at scene center - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - effect.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentMouseMove(event) { - mouseX = (event.clientX - windowHalfX) / 100; - mouseY = (event.clientY - windowHalfY) / 100; -} - -// - -function animate() { - render(); -} - -function render() { - const timer = 0.0001 * Date.now(); - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - for (let i = 0, il = spheres.length; i < il; i++) { - const sphere = spheres[i]; - - sphere.position.x = 5 * Math.cos(timer + i); - sphere.position.y = 5 * Math.sin(timer + i * 1.1); - } - - effect.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_effects_ascii.ts b/examples-testing/examples/webgl_effects_ascii.ts deleted file mode 100644 index a412bb79e..000000000 --- a/examples-testing/examples/webgl_effects_ascii.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as THREE from 'three'; - -import { AsciiEffect } from 'three/addons/effects/AsciiEffect.js'; -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; - -let camera, controls, scene, renderer, effect; - -let sphere, plane; - -const start = Date.now(); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.y = 150; - camera.position.z = 500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0, 0, 0); - - const pointLight1 = new THREE.PointLight(0xffffff, 3, 0, 0); - pointLight1.position.set(500, 500, 500); - scene.add(pointLight1); - - const pointLight2 = new THREE.PointLight(0xffffff, 1, 0, 0); - pointLight2.position.set(-500, -500, -500); - scene.add(pointLight2); - - sphere = new THREE.Mesh(new THREE.SphereGeometry(200, 20, 10), new THREE.MeshPhongMaterial({ flatShading: true })); - scene.add(sphere); - - // Plane - - plane = new THREE.Mesh(new THREE.PlaneGeometry(400, 400), new THREE.MeshBasicMaterial({ color: 0xe0e0e0 })); - plane.position.y = -200; - plane.rotation.x = -Math.PI / 2; - scene.add(plane); - - renderer = new THREE.WebGLRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - effect = new AsciiEffect(renderer, ' .:-+*=%@#', { invert: true }); - effect.setSize(window.innerWidth, window.innerHeight); - effect.domElement.style.color = 'white'; - effect.domElement.style.backgroundColor = 'black'; - - // Special case: append effect.domElement, instead of renderer.domElement. - // AsciiEffect creates a custom domElement (a div container) where the ASCII elements are placed. - - document.body.appendChild(effect.domElement); - - controls = new TrackballControls(camera, effect.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - effect.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const timer = Date.now() - start; - - sphere.position.y = Math.abs(Math.sin(timer * 0.002)) * 150; - sphere.rotation.x = timer * 0.0003; - sphere.rotation.z = timer * 0.0002; - - controls.update(); - - effect.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_effects_parallaxbarrier.ts b/examples-testing/examples/webgl_effects_parallaxbarrier.ts deleted file mode 100644 index 90c867973..000000000 --- a/examples-testing/examples/webgl_effects_parallaxbarrier.ts +++ /dev/null @@ -1,110 +0,0 @@ -import * as THREE from 'three'; - -import { ParallaxBarrierEffect } from 'three/addons/effects/ParallaxBarrierEffect.js'; - -let container, camera, scene, renderer, effect; - -const spheres = []; - -let mouseX = 0; -let mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -document.addEventListener('mousemove', onDocumentMouseMove); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.z = 3; - - const path = 'textures/cube/pisa/'; - const format = '.png'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const textureCube = new THREE.CubeTextureLoader().load(urls); - - scene = new THREE.Scene(); - scene.background = textureCube; - - const geometry = new THREE.SphereGeometry(0.1, 32, 16); - const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); - - for (let i = 0; i < 500; i++) { - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = Math.random() * 10 - 5; - mesh.position.y = Math.random() * 10 - 5; - mesh.position.z = Math.random() * 10 - 5; - - mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - - scene.add(mesh); - - spheres.push(mesh); - } - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - const width = window.innerWidth || 2; - const height = window.innerHeight || 2; - - effect = new ParallaxBarrierEffect(renderer); - effect.setSize(width, height); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - effect.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentMouseMove(event) { - mouseX = (event.clientX - windowHalfX) / 100; - mouseY = (event.clientY - windowHalfY) / 100; -} - -// - -function animate() { - const timer = 0.0001 * Date.now(); - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - for (let i = 0, il = spheres.length; i < il; i++) { - const sphere = spheres[i]; - - sphere.position.x = 5 * Math.cos(timer + i); - sphere.position.y = 5 * Math.sin(timer + i * 1.1); - } - - effect.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_effects_stereo.ts b/examples-testing/examples/webgl_effects_stereo.ts deleted file mode 100644 index 673850541..000000000 --- a/examples-testing/examples/webgl_effects_stereo.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as THREE from 'three'; - -import { StereoEffect } from 'three/addons/effects/StereoEffect.js'; - -let container, camera, scene, renderer, effect; - -const spheres = []; - -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -document.addEventListener('mousemove', onDocumentMouseMove); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 3; - - scene = new THREE.Scene(); - scene.background = new THREE.CubeTextureLoader() - .setPath('textures/cube/Park3Med/') - .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); - - const geometry = new THREE.SphereGeometry(0.1, 32, 16); - - const textureCube = new THREE.CubeTextureLoader() - .setPath('textures/cube/Park3Med/') - .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); - textureCube.mapping = THREE.CubeRefractionMapping; - - const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 }); - - for (let i = 0; i < 500; i++) { - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = Math.random() * 10 - 5; - mesh.position.y = Math.random() * 10 - 5; - mesh.position.z = Math.random() * 10 - 5; - mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - scene.add(mesh); - - spheres.push(mesh); - } - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - effect = new StereoEffect(renderer); - effect.setSize(window.innerWidth, window.innerHeight); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - effect.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentMouseMove(event) { - mouseX = (event.clientX - windowHalfX) * 0.01; - mouseY = (event.clientY - windowHalfY) * 0.01; -} - -// - -function animate() { - const timer = 0.0001 * Date.now(); - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - camera.lookAt(scene.position); - - for (let i = 0, il = spheres.length; i < il; i++) { - const sphere = spheres[i]; - - sphere.position.x = 5 * Math.cos(timer + i); - sphere.position.y = 5 * Math.sin(timer + i * 1.1); - } - - effect.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_framebuffer_texture.ts b/examples-testing/examples/webgl_framebuffer_texture.ts deleted file mode 100644 index df4acc9d6..000000000 --- a/examples-testing/examples/webgl_framebuffer_texture.ts +++ /dev/null @@ -1,151 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; - -let camera, scene, renderer; -let line, sprite, texture; - -let cameraOrtho, sceneOrtho; - -let offset = 0; - -const dpr = window.devicePixelRatio; - -const textureSize = 128 * dpr; -const vector = new THREE.Vector2(); -const color = new THREE.Color(); - -init(); - -function init() { - // - - const width = window.innerWidth; - const height = window.innerHeight; - - camera = new THREE.PerspectiveCamera(70, width / height, 1, 1000); - camera.position.z = 20; - - cameraOrtho = new THREE.OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, 1, 10); - cameraOrtho.position.z = 10; - - scene = new THREE.Scene(); - sceneOrtho = new THREE.Scene(); - - // - - const points = GeometryUtils.gosper(8); - - const geometry = new THREE.BufferGeometry(); - const positionAttribute = new THREE.Float32BufferAttribute(points, 3); - geometry.setAttribute('position', positionAttribute); - geometry.center(); - - const colorAttribute = new THREE.BufferAttribute(new Float32Array(positionAttribute.array.length), 3); - colorAttribute.setUsage(THREE.DynamicDrawUsage); - geometry.setAttribute('color', colorAttribute); - - const material = new THREE.LineBasicMaterial({ vertexColors: true }); - - line = new THREE.Line(geometry, material); - line.scale.setScalar(0.05); - scene.add(line); - - // - - texture = new THREE.FramebufferTexture(textureSize, textureSize); - - // - - const spriteMaterial = new THREE.SpriteMaterial({ map: texture }); - sprite = new THREE.Sprite(spriteMaterial); - sprite.scale.set(textureSize, textureSize, 1); - sceneOrtho.add(sprite); - - updateSpritePosition(); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - document.body.appendChild(renderer.domElement); - - // - - const selection = document.getElementById('selection'); - const controls = new OrbitControls(camera, selection); - controls.enablePan = false; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - cameraOrtho.left = -width / 2; - cameraOrtho.right = width / 2; - cameraOrtho.top = height / 2; - cameraOrtho.bottom = -height / 2; - cameraOrtho.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - updateSpritePosition(); -} - -function updateSpritePosition() { - const halfWidth = window.innerWidth / 2; - const halfHeight = window.innerHeight / 2; - - const halfImageWidth = textureSize / 2; - const halfImageHeight = textureSize / 2; - - sprite.position.set(-halfWidth + halfImageWidth, halfHeight - halfImageHeight, 1); -} - -function animate() { - const colorAttribute = line.geometry.getAttribute('color'); - updateColors(colorAttribute); - - // scene rendering - - renderer.clear(); - renderer.render(scene, camera); - - // calculate start position for copying data - - vector.x = (window.innerWidth * dpr) / 2 - textureSize / 2; - vector.y = (window.innerHeight * dpr) / 2 - textureSize / 2; - - renderer.copyFramebufferToTexture(texture, vector); - - renderer.clearDepth(); - renderer.render(sceneOrtho, cameraOrtho); -} - -function updateColors(colorAttribute) { - const l = colorAttribute.count; - - for (let i = 0; i < l; i++) { - const h = ((offset + i) % l) / l; - - color.setHSL(h, 1, 0.5); - colorAttribute.setX(i, color.r); - colorAttribute.setY(i, color.g); - colorAttribute.setZ(i, color.b); - } - - colorAttribute.needsUpdate = true; - - offset -= 25; -} diff --git a/examples-testing/examples/webgl_furnace_test.ts b/examples-testing/examples/webgl_furnace_test.ts deleted file mode 100644 index f89857366..000000000 --- a/examples-testing/examples/webgl_furnace_test.ts +++ /dev/null @@ -1,108 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer, radianceMap; - -let gui; - -const COLOR = 0xcccccc; - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - const aspect = width / height; - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setSize(width, height); - renderer.setPixelRatio(window.devicePixelRatio); - document.body.appendChild(renderer.domElement); - - // scene - - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); - camera.position.set(0, 0, 18); - - // - - initGui(); - - window.addEventListener('resize', onWindowResize); -} - -function createObjects() { - const geometry = new THREE.SphereGeometry(0.4, 32, 16); - - for (let x = 0; x <= 10; x++) { - for (let y = 0; y <= 10; y++) { - const material = new THREE.MeshPhysicalMaterial({ - roughness: x / 10, - metalness: y / 10, - color: 0xffffff, - envMap: radianceMap, - envMapIntensity: 1, - transmission: 0, - ior: 1.5, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = x - 5; - mesh.position.y = 5 - y; - scene.add(mesh); - } - } -} - -function createEnvironment() { - const envScene = new THREE.Scene(); - envScene.background = new THREE.Color(COLOR); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - radianceMap = pmremGenerator.fromScene(envScene).texture; - pmremGenerator.dispose(); - - scene.background = envScene.background; -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - - render(); -} - -function render() { - renderer.render(scene, camera); -} - -function initGui() { - gui = new GUI(); - - const param = { - tint: false, - }; - - gui.add(param, 'tint') - .name('Tint for Visibility') - .onChange(function (val) { - scene.traverse(function (child) { - const tint = val ? 0xccccff : 0xffffff; - - if (child.isMesh) child.material.color.setHex(tint); - }); - - render(); - }); -} - -Promise.resolve().then(init).then(createEnvironment).then(createObjects).then(render); diff --git a/examples-testing/examples/webgl_geometries.ts b/examples-testing/examples/webgl_geometries.ts deleted file mode 100644 index 0eb50120c..000000000 --- a/examples-testing/examples/webgl_geometries.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; -import { plane, klein, mobius } from 'three/addons/geometries/ParametricFunctions.js'; - -let camera, scene, renderer, stats; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.y = 500; - - scene = new THREE.Scene(); - - let object, geometry; - - const ambientLight = new THREE.AmbientLight(0xcccccc, 1.5); - scene.add(ambientLight); - - const pointLight = new THREE.PointLight(0xffffff, 2.5, 0, 0); - camera.add(pointLight); - scene.add(camera); - - const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); - map.wrapS = map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 16; - map.colorSpace = THREE.SRGBColorSpace; - - const material = new THREE.MeshPhongMaterial({ map: map, side: THREE.DoubleSide }); - - // - - object = new THREE.Mesh(new THREE.SphereGeometry(75, 20, 10), material); - object.position.set(-300, 0, 300); - scene.add(object); - - object = new THREE.Mesh(new THREE.IcosahedronGeometry(75), material); - object.position.set(-100, 0, 300); - scene.add(object); - - object = new THREE.Mesh(new THREE.OctahedronGeometry(75), material); - object.position.set(100, 0, 300); - scene.add(object); - - object = new THREE.Mesh(new THREE.TetrahedronGeometry(75), material); - object.position.set(300, 0, 300); - scene.add(object); - - // - - object = new THREE.Mesh(new THREE.PlaneGeometry(100, 100, 4, 4), material); - object.position.set(-300, 0, 100); - scene.add(object); - - object = new THREE.Mesh(new THREE.BoxGeometry(100, 100, 100, 4, 4, 4), material); - object.position.set(-100, 0, 100); - scene.add(object); - - object = new THREE.Mesh(new THREE.CircleGeometry(50, 20, 0, Math.PI * 2), material); - object.position.set(100, 0, 100); - scene.add(object); - - object = new THREE.Mesh(new THREE.RingGeometry(10, 50, 20, 5, 0, Math.PI * 2), material); - object.position.set(300, 0, 100); - scene.add(object); - - // - - object = new THREE.Mesh(new THREE.CylinderGeometry(25, 75, 100, 40, 5), material); - object.position.set(-300, 0, -100); - scene.add(object); - - const points = []; - - for (let i = 0; i < 50; i++) { - points.push(new THREE.Vector2(Math.sin(i * 0.2) * Math.sin(i * 0.1) * 15 + 50, (i - 5) * 2)); - } - - object = new THREE.Mesh(new THREE.LatheGeometry(points, 20), material); - object.position.set(-100, 0, -100); - scene.add(object); - - object = new THREE.Mesh(new THREE.TorusGeometry(50, 20, 20, 20), material); - object.position.set(100, 0, -100); - scene.add(object); - - object = new THREE.Mesh(new THREE.TorusKnotGeometry(50, 10, 50, 20), material); - object.position.set(300, 0, -100); - scene.add(object); - - // - - object = new THREE.Mesh(new THREE.CapsuleGeometry(20, 50), material); - object.position.set(-300, 0, -300); - scene.add(object); - - geometry = new ParametricGeometry(plane, 10, 10); - geometry.scale(100, 100, 100); - geometry.center(); - object = new THREE.Mesh(geometry, material); - object.position.set(-100, 0, -300); - scene.add(object); - - geometry = new ParametricGeometry(klein, 20, 20); - object = new THREE.Mesh(geometry, material); - object.position.set(100, 0, -300); - object.scale.multiplyScalar(5); - scene.add(object); - - geometry = new ParametricGeometry(mobius, 20, 20); - object = new THREE.Mesh(geometry, material); - object.position.set(300, 0, -300); - object.scale.multiplyScalar(30); - scene.add(object); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const timer = Date.now() * 0.0001; - - camera.position.x = Math.cos(timer) * 800; - camera.position.z = Math.sin(timer) * 800; - - camera.lookAt(scene.position); - - scene.traverse(function (object) { - if (object.isMesh === true) { - object.rotation.x = timer * 5; - object.rotation.y = timer * 2.5; - } - }); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_colors.ts b/examples-testing/examples/webgl_geometry_colors.ts deleted file mode 100644 index 3166c03bc..000000000 --- a/examples-testing/examples/webgl_geometry_colors.ts +++ /dev/null @@ -1,177 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(20, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 1800; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 0, 1); - scene.add(light); - - // shadow - - const canvas = document.createElement('canvas'); - canvas.width = 128; - canvas.height = 128; - - const context = canvas.getContext('2d'); - const gradient = context.createRadialGradient( - canvas.width / 2, - canvas.height / 2, - 0, - canvas.width / 2, - canvas.height / 2, - canvas.width / 2, - ); - gradient.addColorStop(0.1, 'rgba(210,210,210,1)'); - gradient.addColorStop(1, 'rgba(255,255,255,1)'); - - context.fillStyle = gradient; - context.fillRect(0, 0, canvas.width, canvas.height); - - const shadowTexture = new THREE.CanvasTexture(canvas); - - const shadowMaterial = new THREE.MeshBasicMaterial({ map: shadowTexture }); - const shadowGeo = new THREE.PlaneGeometry(300, 300, 1, 1); - - let shadowMesh; - - shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); - shadowMesh.position.y = -250; - shadowMesh.rotation.x = -Math.PI / 2; - scene.add(shadowMesh); - - shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); - shadowMesh.position.y = -250; - shadowMesh.position.x = -400; - shadowMesh.rotation.x = -Math.PI / 2; - scene.add(shadowMesh); - - shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); - shadowMesh.position.y = -250; - shadowMesh.position.x = 400; - shadowMesh.rotation.x = -Math.PI / 2; - scene.add(shadowMesh); - - const radius = 200; - - const geometry1 = new THREE.IcosahedronGeometry(radius, 1); - - const count = geometry1.attributes.position.count; - const arrayType = typeof Float16Array !== 'undefined' ? Float16Array : Float32Array; - geometry1.setAttribute('color', new THREE.BufferAttribute(new arrayType(count * 3), 3)); - - const geometry2 = geometry1.clone(); - const geometry3 = geometry1.clone(); - - const color = new THREE.Color(); - const positions1 = geometry1.attributes.position; - const positions2 = geometry2.attributes.position; - const positions3 = geometry3.attributes.position; - const colors1 = geometry1.attributes.color; - const colors2 = geometry2.attributes.color; - const colors3 = geometry3.attributes.color; - - for (let i = 0; i < count; i++) { - color.setHSL((positions1.getY(i) / radius + 1) / 2, 1.0, 0.5, THREE.SRGBColorSpace); - colors1.setXYZ(i, color.r, color.g, color.b); - - color.setHSL(0, (positions2.getY(i) / radius + 1) / 2, 0.5, THREE.SRGBColorSpace); - colors2.setXYZ(i, color.r, color.g, color.b); - - color.setRGB(1, 0.8 - (positions3.getY(i) / radius + 1) / 2, 0, THREE.SRGBColorSpace); - colors3.setXYZ(i, color.r, color.g, color.b); - } - - const material = new THREE.MeshPhongMaterial({ - color: 0xffffff, - flatShading: true, - vertexColors: true, - shininess: 0, - }); - - const wireframeMaterial = new THREE.MeshBasicMaterial({ color: 0x000000, wireframe: true, transparent: true }); - - let mesh = new THREE.Mesh(geometry1, material); - let wireframe = new THREE.Mesh(geometry1, wireframeMaterial); - mesh.add(wireframe); - mesh.position.x = -400; - mesh.rotation.x = -1.87; - scene.add(mesh); - - mesh = new THREE.Mesh(geometry2, material); - wireframe = new THREE.Mesh(geometry2, wireframeMaterial); - mesh.add(wireframe); - mesh.position.x = 400; - scene.add(mesh); - - mesh = new THREE.Mesh(geometry3, material); - wireframe = new THREE.Mesh(geometry3, wireframeMaterial); - mesh.add(wireframe); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - document.addEventListener('mousemove', onDocumentMouseMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_colors_lookuptable.ts b/examples-testing/examples/webgl_geometry_colors_lookuptable.ts deleted file mode 100644 index 6b0138529..000000000 --- a/examples-testing/examples/webgl_geometry_colors_lookuptable.ts +++ /dev/null @@ -1,148 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Lut } from 'three/addons/math/Lut.js'; - -let container; - -let perpCamera, orthoCamera, renderer, lut; - -let mesh, sprite; -let scene, uiScene; - -let params; - -init(); - -function init() { - container = document.getElementById('container'); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - uiScene = new THREE.Scene(); - - lut = new Lut(); - - const width = window.innerWidth; - const height = window.innerHeight; - - perpCamera = new THREE.PerspectiveCamera(60, width / height, 1, 100); - perpCamera.position.set(0, 0, 10); - scene.add(perpCamera); - - orthoCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 1, 2); - orthoCamera.position.set(0.5, 0, 1); - - sprite = new THREE.Sprite( - new THREE.SpriteMaterial({ - map: new THREE.CanvasTexture(lut.createCanvas()), - }), - ); - sprite.material.map.colorSpace = THREE.SRGBColorSpace; - sprite.scale.x = 0.125; - uiScene.add(sprite); - - mesh = new THREE.Mesh( - undefined, - new THREE.MeshLambertMaterial({ - side: THREE.DoubleSide, - color: 0xf5f5f5, - vertexColors: true, - }), - ); - scene.add(mesh); - - params = { - colorMap: 'rainbow', - }; - loadModel(); - - const pointLight = new THREE.PointLight(0xffffff, 3, 0, 0); - perpCamera.add(pointLight); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.autoClear = false; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - const controls = new OrbitControls(perpCamera, renderer.domElement); - controls.addEventListener('change', render); - - const gui = new GUI(); - - gui.add(params, 'colorMap', ['rainbow', 'cooltowarm', 'blackbody', 'grayscale']).onChange(function () { - updateColors(); - render(); - }); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - perpCamera.aspect = width / height; - perpCamera.updateProjectionMatrix(); - - renderer.setSize(width, height); - render(); -} - -function render() { - renderer.clear(); - renderer.render(scene, perpCamera); - renderer.render(uiScene, orthoCamera); -} - -function loadModel() { - const loader = new THREE.BufferGeometryLoader(); - loader.load('models/json/pressure.json', function (geometry) { - geometry.center(); - geometry.computeVertexNormals(); - - // default color attribute - const colors = []; - - for (let i = 0, n = geometry.attributes.position.count; i < n; ++i) { - colors.push(1, 1, 1); - } - - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - mesh.geometry = geometry; - updateColors(); - - render(); - }); -} - -function updateColors() { - lut.setColorMap(params.colorMap); - - lut.setMax(2000); - lut.setMin(0); - - const geometry = mesh.geometry; - const pressures = geometry.attributes.pressure; - const colors = geometry.attributes.color; - const color = new THREE.Color(); - - for (let i = 0; i < pressures.array.length; i++) { - const colorValue = pressures.array[i]; - - color.copy(lut.getColor(colorValue)).convertSRGBToLinear(); - - colors.setXYZ(i, color.r, color.g, color.b); - } - - colors.needsUpdate = true; - - const map = sprite.material.map; - lut.updateCanvas(map.image); - map.needsUpdate = true; -} diff --git a/examples-testing/examples/webgl_geometry_convex.ts b/examples-testing/examples/webgl_geometry_convex.ts deleted file mode 100644 index 09516c070..000000000 --- a/examples-testing/examples/webgl_geometry_convex.ts +++ /dev/null @@ -1,117 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js'; -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -let group, camera, scene, renderer; - -init(); - -function init() { - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // camera - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(15, 20, 30); - scene.add(camera); - - // controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 20; - controls.maxDistance = 50; - controls.maxPolarAngle = Math.PI / 2; - - // ambient light - - scene.add(new THREE.AmbientLight(0x666666)); - - // point light - - const light = new THREE.PointLight(0xffffff, 3, 0, 0); - camera.add(light); - - // helper - - scene.add(new THREE.AxesHelper(20)); - - // textures - - const loader = new THREE.TextureLoader(); - const texture = loader.load('textures/sprites/disc.png'); - texture.colorSpace = THREE.SRGBColorSpace; - - group = new THREE.Group(); - scene.add(group); - - // points - - let dodecahedronGeometry = new THREE.DodecahedronGeometry(10); - - // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data - - dodecahedronGeometry.deleteAttribute('normal'); - dodecahedronGeometry.deleteAttribute('uv'); - - dodecahedronGeometry = BufferGeometryUtils.mergeVertices(dodecahedronGeometry); - - const vertices = []; - const positionAttribute = dodecahedronGeometry.getAttribute('position'); - - for (let i = 0; i < positionAttribute.count; i++) { - const vertex = new THREE.Vector3(); - vertex.fromBufferAttribute(positionAttribute, i); - vertices.push(vertex); - } - - const pointsMaterial = new THREE.PointsMaterial({ - color: 0x0080ff, - map: texture, - size: 1, - alphaTest: 0.5, - }); - - const pointsGeometry = new THREE.BufferGeometry().setFromPoints(vertices); - - const points = new THREE.Points(pointsGeometry, pointsMaterial); - group.add(points); - - // convex hull - - const meshMaterial = new THREE.MeshLambertMaterial({ - color: 0xffffff, - opacity: 0.5, - side: THREE.DoubleSide, - transparent: true, - }); - - const meshGeometry = new ConvexGeometry(vertices); - - const mesh = new THREE.Mesh(meshGeometry, meshMaterial); - group.add(mesh); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - group.rotation.y += 0.005; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_cube.ts b/examples-testing/examples/webgl_geometry_cube.ts deleted file mode 100644 index 572601acb..000000000 --- a/examples-testing/examples/webgl_geometry_cube.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; -let mesh; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 2; - - scene = new THREE.Scene(); - - const texture = new THREE.TextureLoader().load('textures/crate.gif'); - texture.colorSpace = THREE.SRGBColorSpace; - - const geometry = new THREE.BoxGeometry(); - const material = new THREE.MeshBasicMaterial({ map: texture }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.rotation.x += 0.005; - mesh.rotation.y += 0.01; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_extrude_shapes.ts b/examples-testing/examples/webgl_geometry_extrude_shapes.ts deleted file mode 100644 index dea62d0e6..000000000 --- a/examples-testing/examples/webgl_geometry_extrude_shapes.ts +++ /dev/null @@ -1,149 +0,0 @@ -import * as THREE from 'three'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; - -let camera, scene, renderer, controls; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222222); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 500); - - controls = new TrackballControls(camera, renderer.domElement); - controls.minDistance = 200; - controls.maxDistance = 500; - - scene.add(new THREE.AmbientLight(0x666666)); - - const light = new THREE.PointLight(0xffffff, 3, 0, 0); - light.position.copy(camera.position); - scene.add(light); - - // - - const closedSpline = new THREE.CatmullRomCurve3([ - new THREE.Vector3(-60, -100, 60), - new THREE.Vector3(-60, 20, 60), - new THREE.Vector3(-60, 120, 60), - new THREE.Vector3(60, 20, -60), - new THREE.Vector3(60, -100, -60), - ]); - - closedSpline.curveType = 'catmullrom'; - closedSpline.closed = true; - - const extrudeSettings1 = { - steps: 100, - bevelEnabled: false, - extrudePath: closedSpline, - }; - - const pts1 = [], - count = 3; - - for (let i = 0; i < count; i++) { - const l = 20; - - const a = ((2 * i) / count) * Math.PI; - - pts1.push(new THREE.Vector2(Math.cos(a) * l, Math.sin(a) * l)); - } - - const shape1 = new THREE.Shape(pts1); - - const geometry1 = new THREE.ExtrudeGeometry(shape1, extrudeSettings1); - - const material1 = new THREE.MeshLambertMaterial({ color: 0xb00000, wireframe: false }); - - const mesh1 = new THREE.Mesh(geometry1, material1); - - scene.add(mesh1); - - // - - const randomPoints = []; - - for (let i = 0; i < 10; i++) { - randomPoints.push( - new THREE.Vector3((i - 4.5) * 50, THREE.MathUtils.randFloat(-50, 50), THREE.MathUtils.randFloat(-50, 50)), - ); - } - - const randomSpline = new THREE.CatmullRomCurve3(randomPoints); - - // - - const extrudeSettings2 = { - steps: 200, - bevelEnabled: false, - extrudePath: randomSpline, - }; - - const pts2 = [], - numPts = 5; - - for (let i = 0; i < numPts * 2; i++) { - const l = i % 2 == 1 ? 10 : 20; - - const a = (i / numPts) * Math.PI; - - pts2.push(new THREE.Vector2(Math.cos(a) * l, Math.sin(a) * l)); - } - - const shape2 = new THREE.Shape(pts2); - - const geometry2 = new THREE.ExtrudeGeometry(shape2, extrudeSettings2); - - const material2 = new THREE.MeshLambertMaterial({ color: 0xff8000, wireframe: false }); - - const mesh2 = new THREE.Mesh(geometry2, material2); - - scene.add(mesh2); - - // - - const materials = [material1, material2]; - - const extrudeSettings3 = { - depth: 20, - steps: 1, - bevelEnabled: true, - bevelThickness: 2, - bevelSize: 4, - bevelSegments: 1, - }; - - const geometry3 = new THREE.ExtrudeGeometry(shape2, extrudeSettings3); - - const mesh3 = new THREE.Mesh(geometry3, materials); - - mesh3.position.set(50, 100, 50); - - scene.add(mesh3); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_extrude_splines.ts b/examples-testing/examples/webgl_geometry_extrude_splines.ts deleted file mode 100644 index 8636812f7..000000000 --- a/examples-testing/examples/webgl_geometry_extrude_splines.ts +++ /dev/null @@ -1,310 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import * as Curves from 'three/addons/curves/CurveExtras.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container, stats; - -let camera, scene, renderer, splineCamera, cameraHelper, cameraEye; - -const direction = new THREE.Vector3(); -const binormal = new THREE.Vector3(); -const normal = new THREE.Vector3(); -const position = new THREE.Vector3(); -const lookAt = new THREE.Vector3(); - -const pipeSpline = new THREE.CatmullRomCurve3([ - new THREE.Vector3(0, 10, -10), - new THREE.Vector3(10, 0, -10), - new THREE.Vector3(20, 0, 0), - new THREE.Vector3(30, 0, 10), - new THREE.Vector3(30, 0, 20), - new THREE.Vector3(20, 0, 30), - new THREE.Vector3(10, 0, 30), - new THREE.Vector3(0, 0, 30), - new THREE.Vector3(-10, 10, 30), - new THREE.Vector3(-10, 20, 30), - new THREE.Vector3(0, 30, 30), - new THREE.Vector3(10, 30, 30), - new THREE.Vector3(20, 30, 15), - new THREE.Vector3(10, 30, 10), - new THREE.Vector3(0, 30, 10), - new THREE.Vector3(-10, 20, 10), - new THREE.Vector3(-10, 10, 10), - new THREE.Vector3(0, 0, 10), - new THREE.Vector3(10, -10, 10), - new THREE.Vector3(20, -15, 10), - new THREE.Vector3(30, -15, 10), - new THREE.Vector3(40, -15, 10), - new THREE.Vector3(50, -15, 10), - new THREE.Vector3(60, 0, 10), - new THREE.Vector3(70, 0, 0), - new THREE.Vector3(80, 0, 0), - new THREE.Vector3(90, 0, 0), - new THREE.Vector3(100, 0, 0), -]); - -const sampleClosedSpline = new THREE.CatmullRomCurve3([ - new THREE.Vector3(0, -40, -40), - new THREE.Vector3(0, 40, -40), - new THREE.Vector3(0, 140, -40), - new THREE.Vector3(0, 40, 40), - new THREE.Vector3(0, -40, 40), -]); - -sampleClosedSpline.curveType = 'catmullrom'; -sampleClosedSpline.closed = true; - -// Keep a dictionary of Curve instances -const splines = { - GrannyKnot: new Curves.GrannyKnot(), - HeartCurve: new Curves.HeartCurve(3.5), - VivianiCurve: new Curves.VivianiCurve(70), - KnotCurve: new Curves.KnotCurve(), - HelixCurve: new Curves.HelixCurve(), - TrefoilKnot: new Curves.TrefoilKnot(), - TorusKnot: new Curves.TorusKnot(20), - CinquefoilKnot: new Curves.CinquefoilKnot(20), - TrefoilPolynomialKnot: new Curves.TrefoilPolynomialKnot(14), - FigureEightPolynomialKnot: new Curves.FigureEightPolynomialKnot(), - DecoratedTorusKnot4a: new Curves.DecoratedTorusKnot4a(), - DecoratedTorusKnot4b: new Curves.DecoratedTorusKnot4b(), - DecoratedTorusKnot5a: new Curves.DecoratedTorusKnot5a(), - DecoratedTorusKnot5c: new Curves.DecoratedTorusKnot5c(), - PipeSpline: pipeSpline, - SampleClosedSpline: sampleClosedSpline, -}; - -let parent, tubeGeometry, mesh; - -const params = { - spline: 'GrannyKnot', - scale: 4, - extrusionSegments: 100, - radiusSegments: 3, - closed: true, - animationView: false, - lookAhead: false, - cameraHelper: false, -}; - -const material = new THREE.MeshLambertMaterial({ color: 0xff00ff }); - -const wireframeMaterial = new THREE.MeshBasicMaterial({ - color: 0x000000, - opacity: 0.3, - wireframe: true, - transparent: true, -}); - -function addTube() { - if (mesh !== undefined) { - parent.remove(mesh); - mesh.geometry.dispose(); - } - - const extrudePath = splines[params.spline]; - - tubeGeometry = new THREE.TubeGeometry( - extrudePath, - params.extrusionSegments, - 2, - params.radiusSegments, - params.closed, - ); - - addGeometry(tubeGeometry); - - setScale(); -} - -function setScale() { - mesh.scale.set(params.scale, params.scale, params.scale); -} - -function addGeometry(geometry) { - // 3D shape - - mesh = new THREE.Mesh(geometry, material); - const wireframe = new THREE.Mesh(geometry, wireframeMaterial); - mesh.add(wireframe); - - parent.add(mesh); -} - -function animateCamera() { - cameraHelper.visible = params.cameraHelper; - cameraEye.visible = params.cameraHelper; -} - -init(); - -function init() { - container = document.getElementById('container'); - - // camera - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 10000); - camera.position.set(0, 50, 500); - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - // light - - scene.add(new THREE.AmbientLight(0xffffff)); - - const light = new THREE.DirectionalLight(0xffffff, 1.5); - light.position.set(0, 0, 1); - scene.add(light); - - // tube - - parent = new THREE.Object3D(); - scene.add(parent); - - splineCamera = new THREE.PerspectiveCamera(84, window.innerWidth / window.innerHeight, 0.01, 1000); - parent.add(splineCamera); - - cameraHelper = new THREE.CameraHelper(splineCamera); - scene.add(cameraHelper); - - addTube(); - - // debug camera - - cameraEye = new THREE.Mesh(new THREE.SphereGeometry(5), new THREE.MeshBasicMaterial({ color: 0xdddddd })); - parent.add(cameraEye); - - cameraHelper.visible = params.cameraHelper; - cameraEye.visible = params.cameraHelper; - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // stats - - stats = new Stats(); - container.appendChild(stats.dom); - - // dat.GUI - - const gui = new GUI({ width: 285 }); - - const folderGeometry = gui.addFolder('Geometry'); - folderGeometry.add(params, 'spline', Object.keys(splines)).onChange(function () { - addTube(); - }); - folderGeometry - .add(params, 'scale', 2, 10) - .step(2) - .onChange(function () { - setScale(); - }); - folderGeometry - .add(params, 'extrusionSegments', 50, 500) - .step(50) - .onChange(function () { - addTube(); - }); - folderGeometry - .add(params, 'radiusSegments', 2, 12) - .step(1) - .onChange(function () { - addTube(); - }); - folderGeometry.add(params, 'closed').onChange(function () { - addTube(); - }); - folderGeometry.open(); - - const folderCamera = gui.addFolder('Camera'); - folderCamera.add(params, 'animationView').onChange(function () { - animateCamera(); - }); - folderCamera.add(params, 'lookAhead').onChange(function () { - animateCamera(); - }); - folderCamera.add(params, 'cameraHelper').onChange(function () { - animateCamera(); - }); - folderCamera.open(); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 100; - controls.maxDistance = 2000; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - // animate camera along spline - - const time = Date.now(); - const looptime = 20 * 1000; - const t = (time % looptime) / looptime; - - tubeGeometry.parameters.path.getPointAt(t, position); - position.multiplyScalar(params.scale); - - // interpolation - - const segments = tubeGeometry.tangents.length; - const pickt = t * segments; - const pick = Math.floor(pickt); - const pickNext = (pick + 1) % segments; - - binormal.subVectors(tubeGeometry.binormals[pickNext], tubeGeometry.binormals[pick]); - binormal.multiplyScalar(pickt - pick).add(tubeGeometry.binormals[pick]); - - tubeGeometry.parameters.path.getTangentAt(t, direction); - const offset = 15; - - normal.copy(binormal).cross(direction); - - // we move on a offset on its binormal - - position.add(normal.clone().multiplyScalar(offset)); - - splineCamera.position.copy(position); - cameraEye.position.copy(position); - - // using arclength for stabilization in look ahead - - tubeGeometry.parameters.path.getPointAt((t + 30 / tubeGeometry.parameters.path.getLength()) % 1, lookAt); - lookAt.multiplyScalar(params.scale); - - // camera orientation 2 - up orientation via normal - - if (!params.lookAhead) lookAt.copy(position).add(direction); - splineCamera.matrix.lookAt(splineCamera.position, lookAt, normal); - splineCamera.quaternion.setFromRotationMatrix(splineCamera.matrix); - - cameraHelper.update(); - - renderer.render(scene, params.animationView === true ? splineCamera : camera); -} diff --git a/examples-testing/examples/webgl_geometry_minecraft.ts b/examples-testing/examples/webgl_geometry_minecraft.ts deleted file mode 100644 index 220156552..000000000 --- a/examples-testing/examples/webgl_geometry_minecraft.ts +++ /dev/null @@ -1,184 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -let container, stats; - -let camera, controls, scene, renderer; - -const worldWidth = 128, - worldDepth = 128; -const worldHalfWidth = worldWidth / 2; -const worldHalfDepth = worldDepth / 2; -const data = generateHeight(worldWidth, worldDepth); - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 20000); - camera.position.y = getY(worldHalfWidth, worldHalfDepth) * 100 + 100; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfd1e5); - - // sides - - const matrix = new THREE.Matrix4(); - - const pxGeometry = new THREE.PlaneGeometry(100, 100); - pxGeometry.attributes.uv.array[1] = 0.5; - pxGeometry.attributes.uv.array[3] = 0.5; - pxGeometry.rotateY(Math.PI / 2); - pxGeometry.translate(50, 0, 0); - - const nxGeometry = new THREE.PlaneGeometry(100, 100); - nxGeometry.attributes.uv.array[1] = 0.5; - nxGeometry.attributes.uv.array[3] = 0.5; - nxGeometry.rotateY(-Math.PI / 2); - nxGeometry.translate(-50, 0, 0); - - const pyGeometry = new THREE.PlaneGeometry(100, 100); - pyGeometry.attributes.uv.array[5] = 0.5; - pyGeometry.attributes.uv.array[7] = 0.5; - pyGeometry.rotateX(-Math.PI / 2); - pyGeometry.translate(0, 50, 0); - - const pzGeometry = new THREE.PlaneGeometry(100, 100); - pzGeometry.attributes.uv.array[1] = 0.5; - pzGeometry.attributes.uv.array[3] = 0.5; - pzGeometry.translate(0, 0, 50); - - const nzGeometry = new THREE.PlaneGeometry(100, 100); - nzGeometry.attributes.uv.array[1] = 0.5; - nzGeometry.attributes.uv.array[3] = 0.5; - nzGeometry.rotateY(Math.PI); - nzGeometry.translate(0, 0, -50); - - // - - const geometries = []; - - for (let z = 0; z < worldDepth; z++) { - for (let x = 0; x < worldWidth; x++) { - const h = getY(x, z); - - matrix.makeTranslation(x * 100 - worldHalfWidth * 100, h * 100, z * 100 - worldHalfDepth * 100); - - const px = getY(x + 1, z); - const nx = getY(x - 1, z); - const pz = getY(x, z + 1); - const nz = getY(x, z - 1); - - geometries.push(pyGeometry.clone().applyMatrix4(matrix)); - - if ((px !== h && px !== h + 1) || x === 0) { - geometries.push(pxGeometry.clone().applyMatrix4(matrix)); - } - - if ((nx !== h && nx !== h + 1) || x === worldWidth - 1) { - geometries.push(nxGeometry.clone().applyMatrix4(matrix)); - } - - if ((pz !== h && pz !== h + 1) || z === worldDepth - 1) { - geometries.push(pzGeometry.clone().applyMatrix4(matrix)); - } - - if ((nz !== h && nz !== h + 1) || z === 0) { - geometries.push(nzGeometry.clone().applyMatrix4(matrix)); - } - } - } - - const geometry = BufferGeometryUtils.mergeGeometries(geometries); - geometry.computeBoundingSphere(); - - const texture = new THREE.TextureLoader().load('textures/minecraft/atlas.png'); - texture.colorSpace = THREE.SRGBColorSpace; - texture.magFilter = THREE.NearestFilter; - - const mesh = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ map: texture, side: THREE.DoubleSide })); - scene.add(mesh); - - const ambientLight = new THREE.AmbientLight(0xeeeeee, 3); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 12); - directionalLight.position.set(1, 1, 0.5).normalize(); - scene.add(directionalLight); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - controls = new FirstPersonControls(camera, renderer.domElement); - - controls.movementSpeed = 1000; - controls.lookSpeed = 0.125; - controls.lookVertical = true; - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function generateHeight(width, height) { - const data = [], - perlin = new ImprovedNoise(), - size = width * height, - z = Math.random() * 100; - - let quality = 2; - - for (let j = 0; j < 4; j++) { - if (j === 0) for (let i = 0; i < size; i++) data[i] = 0; - - for (let i = 0; i < size; i++) { - const x = i % width, - y = (i / width) | 0; - data[i] += perlin.noise(x / quality, y / quality, z) * quality; - } - - quality *= 4; - } - - return data; -} - -function getY(x, z) { - return (data[x + z * worldWidth] * 0.15) | 0; -} - -// - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - controls.update(timer.getDelta()); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_nurbs.ts b/examples-testing/examples/webgl_geometry_nurbs.ts deleted file mode 100644 index ecd79c67e..000000000 --- a/examples-testing/examples/webgl_geometry_nurbs.ts +++ /dev/null @@ -1,298 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js'; -import { NURBSSurface } from 'three/addons/curves/NURBSSurface.js'; -import { NURBSVolume } from 'three/addons/curves/NURBSVolume.js'; -import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; - -let container, stats; - -let camera, scene, renderer; -let group; - -let targetRotation = 0; -let targetRotationOnPointerDown = 0; - -let pointerX = 0; -let pointerXOnPointerDown = 0; - -let windowHalfX = window.innerWidth / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(0, 150, 750); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - scene.add(new THREE.AmbientLight(0xffffff)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1); - scene.add(light); - - group = new THREE.Group(); - group.position.y = 50; - scene.add(group); - - // NURBS curve - - const nurbsControlPoints = []; - const nurbsKnots = []; - const nurbsDegree = 3; - - for (let i = 0; i <= nurbsDegree; i++) { - nurbsKnots.push(0); - } - - for (let i = 0, j = 20; i < j; i++) { - nurbsControlPoints.push( - new THREE.Vector4( - Math.random() * 400 - 200, - Math.random() * 400, - Math.random() * 400 - 200, - 1, // weight of control point: higher means stronger attraction - ), - ); - - const knot = (i + 1) / (j - nurbsDegree); - nurbsKnots.push(THREE.MathUtils.clamp(knot, 0, 1)); - } - - const nurbsCurve = new NURBSCurve(nurbsDegree, nurbsKnots, nurbsControlPoints); - - const nurbsGeometry = new THREE.BufferGeometry(); - nurbsGeometry.setFromPoints(nurbsCurve.getPoints(200)); - - const nurbsMaterial = new THREE.LineBasicMaterial({ color: 0x333333 }); - - const nurbsLine = new THREE.Line(nurbsGeometry, nurbsMaterial); - nurbsLine.position.set(0, -100, 0); - group.add(nurbsLine); - - const nurbsControlPointsGeometry = new THREE.BufferGeometry(); - nurbsControlPointsGeometry.setFromPoints(nurbsCurve.controlPoints); - - const nurbsControlPointsMaterial = new THREE.LineBasicMaterial({ - color: 0x333333, - opacity: 0.25, - transparent: true, - }); - - const nurbsControlPointsLine = new THREE.Line(nurbsControlPointsGeometry, nurbsControlPointsMaterial); - nurbsControlPointsLine.position.copy(nurbsLine.position); - group.add(nurbsControlPointsLine); - - // NURBS surface - { - const nsControlPoints = [ - [ - new THREE.Vector4(-200, -200, 100, 1), - new THREE.Vector4(-200, -100, -200, 1), - new THREE.Vector4(-200, 100, 250, 1), - new THREE.Vector4(-200, 200, -100, 1), - ], - [ - new THREE.Vector4(0, -200, 0, 1), - new THREE.Vector4(0, -100, -100, 5), - new THREE.Vector4(0, 100, 150, 5), - new THREE.Vector4(0, 200, 0, 1), - ], - [ - new THREE.Vector4(200, -200, -100, 1), - new THREE.Vector4(200, -100, 200, 1), - new THREE.Vector4(200, 100, -250, 1), - new THREE.Vector4(200, 200, 100, 1), - ], - ]; - const degree1 = 2; - const degree2 = 3; - const knots1 = [0, 0, 0, 1, 1, 1]; - const knots2 = [0, 0, 0, 0, 1, 1, 1, 1]; - const nurbsSurface = new NURBSSurface(degree1, degree2, knots1, knots2, nsControlPoints); - - const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); - map.wrapS = map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 16; - map.colorSpace = THREE.SRGBColorSpace; - - function getSurfacePoint(u, v, target) { - return nurbsSurface.getPoint(u, v, target); - } - - const geometry = new ParametricGeometry(getSurfacePoint, 20, 20); - const material = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); - const object = new THREE.Mesh(geometry, material); - object.position.set(-400, 100, 0); - object.scale.multiplyScalar(1); - group.add(object); - } - - // NURBS volume - { - const nsControlPoints = [ - [ - [new THREE.Vector4(-200, -200, -200, 1), new THREE.Vector4(-200, -200, 200, 1)], - [new THREE.Vector4(-200, -100, -200, 1), new THREE.Vector4(-200, -100, 200, 1)], - [new THREE.Vector4(-200, 100, -200, 1), new THREE.Vector4(-200, 100, 200, 1)], - [new THREE.Vector4(-200, 200, -200, 1), new THREE.Vector4(-200, 200, 200, 1)], - ], - [ - [new THREE.Vector4(0, -200, -200, 1), new THREE.Vector4(0, -200, 200, 1)], - [new THREE.Vector4(0, -100, -200, 1), new THREE.Vector4(0, -100, 200, 1)], - [new THREE.Vector4(0, 100, -200, 1), new THREE.Vector4(0, 100, 200, 1)], - [new THREE.Vector4(0, 200, -200, 1), new THREE.Vector4(0, 200, 200, 1)], - ], - [ - [new THREE.Vector4(200, -200, -200, 1), new THREE.Vector4(200, -200, 200, 1)], - [new THREE.Vector4(200, -100, 0, 1), new THREE.Vector4(200, -100, 100, 1)], - [new THREE.Vector4(200, 100, 0, 1), new THREE.Vector4(200, 100, 100, 1)], - [new THREE.Vector4(200, 200, 0, 1), new THREE.Vector4(200, 200, 100, 1)], - ], - ]; - const degree1 = 2; - const degree2 = 3; - const degree3 = 1; - const knots1 = [0, 0, 0, 1, 1, 1]; - const knots2 = [0, 0, 0, 0, 1, 1, 1, 1]; - const knots3 = [0, 0, 1, 1]; - const nurbsVolume = new NURBSVolume(degree1, degree2, degree3, knots1, knots2, knots3, nsControlPoints); - - const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); - map.wrapS = map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 16; - map.colorSpace = THREE.SRGBColorSpace; - - // Since ParametricGeometry() only support bi-variate parametric geometries - // we create evaluation functions for different surfaces with one of the three - // parameter values (u, v, w) kept constant and create multiple THREE.Mesh - // objects one for each surface - function getSurfacePointFront(u, v, target) { - return nurbsVolume.getPoint(u, v, 0, target); - } - - function getSurfacePointMiddle(u, v, target) { - return nurbsVolume.getPoint(u, v, 0.5, target); - } - - function getSurfacePointBack(u, v, target) { - return nurbsVolume.getPoint(u, v, 1, target); - } - - function getSurfacePointTop(u, w, target) { - return nurbsVolume.getPoint(u, 1, w, target); - } - - function getSurfacePointSide(v, w, target) { - return nurbsVolume.getPoint(0, v, w, target); - } - - const geometryFront = new ParametricGeometry(getSurfacePointFront, 20, 20); - const materialFront = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); - const objectFront = new THREE.Mesh(geometryFront, materialFront); - objectFront.position.set(400, 100, 0); - objectFront.scale.multiplyScalar(0.5); - group.add(objectFront); - - const geometryMiddle = new ParametricGeometry(getSurfacePointMiddle, 20, 20); - const materialMiddle = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); - const objectMiddle = new THREE.Mesh(geometryMiddle, materialMiddle); - objectMiddle.position.set(400, 100, 0); - objectMiddle.scale.multiplyScalar(0.5); - group.add(objectMiddle); - - const geometryBack = new ParametricGeometry(getSurfacePointBack, 20, 20); - const materialBack = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); - const objectBack = new THREE.Mesh(geometryBack, materialBack); - objectBack.position.set(400, 100, 0); - objectBack.scale.multiplyScalar(0.5); - group.add(objectBack); - - const geometryTop = new ParametricGeometry(getSurfacePointTop, 20, 20); - const materialTop = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); - const objectTop = new THREE.Mesh(geometryTop, materialTop); - objectTop.position.set(400, 100, 0); - objectTop.scale.multiplyScalar(0.5); - group.add(objectTop); - - const geometrySide = new ParametricGeometry(getSurfacePointSide, 20, 20); - const materialSide = new THREE.MeshLambertMaterial({ map: map, side: THREE.DoubleSide }); - const objectSide = new THREE.Mesh(geometrySide, materialSide); - objectSide.position.set(400, 100, 0); - objectSide.scale.multiplyScalar(0.5); - group.add(objectSide); - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - container.style.touchAction = 'none'; - container.addEventListener('pointerdown', onPointerDown); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function onPointerDown(event) { - if (event.isPrimary === false) return; - - pointerXOnPointerDown = event.clientX - windowHalfX; - targetRotationOnPointerDown = targetRotation; - - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerup', onPointerUp); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - pointerX = event.clientX - windowHalfX; - - targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; -} - -function onPointerUp(event) { - if (event.isPrimary === false) return; - - document.removeEventListener('pointermove', onPointerMove); - document.removeEventListener('pointerup', onPointerUp); -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - group.rotation.y += (targetRotation - group.rotation.y) * 0.05; - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_shapes.ts b/examples-testing/examples/webgl_geometry_shapes.ts deleted file mode 100644 index 0c25d8855..000000000 --- a/examples-testing/examples/webgl_geometry_shapes.ts +++ /dev/null @@ -1,363 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let group; - -let targetRotation = 0; -let targetRotationOnPointerDown = 0; - -let pointerX = 0; -let pointerXOnPointerDown = 0; - -let windowHalfX = window.innerWidth / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 150, 500); - scene.add(camera); - - const light = new THREE.PointLight(0xffffff, 2.5, 0, 0); - camera.add(light); - - group = new THREE.Group(); - group.position.y = 50; - scene.add(group); - - const loader = new THREE.TextureLoader(); - const texture = loader.load('textures/uv_grid_opengl.jpg'); - texture.colorSpace = THREE.SRGBColorSpace; - - // it's necessary to apply these settings in order to correctly display the texture on a shape geometry - - texture.wrapS = texture.wrapT = THREE.RepeatWrapping; - texture.repeat.set(0.008, 0.008); - - function addShape(shape, extrudeSettings, color, x, y, z, rx, ry, rz, s) { - // flat shape with texture - // note: default UVs generated by THREE.ShapeGeometry are simply the x- and y-coordinates of the vertices - - let geometry = new THREE.ShapeGeometry(shape); - - let mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({ side: THREE.DoubleSide, map: texture })); - mesh.position.set(x, y, z - 175); - mesh.rotation.set(rx, ry, rz); - mesh.scale.set(s, s, s); - group.add(mesh); - - // flat shape - - geometry = new THREE.ShapeGeometry(shape); - - mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({ color: color, side: THREE.DoubleSide })); - mesh.position.set(x, y, z - 125); - mesh.rotation.set(rx, ry, rz); - mesh.scale.set(s, s, s); - group.add(mesh); - - // extruded shape - - geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings); - - mesh = new THREE.Mesh(geometry, new THREE.MeshPhongMaterial({ color: color })); - mesh.position.set(x, y, z - 75); - mesh.rotation.set(rx, ry, rz); - mesh.scale.set(s, s, s); - group.add(mesh); - - addLineShape(shape, color, x, y, z, rx, ry, rz, s); - } - - function addLineShape(shape, color, x, y, z, rx, ry, rz, s) { - // lines - - shape.autoClose = true; - - const points = shape.getPoints(); - const spacedPoints = shape.getSpacedPoints(50); - - const geometryPoints = new THREE.BufferGeometry().setFromPoints(points); - const geometrySpacedPoints = new THREE.BufferGeometry().setFromPoints(spacedPoints); - - // solid line - - let line = new THREE.Line(geometryPoints, new THREE.LineBasicMaterial({ color: color })); - line.position.set(x, y, z - 25); - line.rotation.set(rx, ry, rz); - line.scale.set(s, s, s); - group.add(line); - - // line from equidistance sampled points - - line = new THREE.Line(geometrySpacedPoints, new THREE.LineBasicMaterial({ color: color })); - line.position.set(x, y, z + 25); - line.rotation.set(rx, ry, rz); - line.scale.set(s, s, s); - group.add(line); - - // vertices from real points - - let particles = new THREE.Points(geometryPoints, new THREE.PointsMaterial({ color: color, size: 4 })); - particles.position.set(x, y, z + 75); - particles.rotation.set(rx, ry, rz); - particles.scale.set(s, s, s); - group.add(particles); - - // equidistance sampled points - - particles = new THREE.Points(geometrySpacedPoints, new THREE.PointsMaterial({ color: color, size: 4 })); - particles.position.set(x, y, z + 125); - particles.rotation.set(rx, ry, rz); - particles.scale.set(s, s, s); - group.add(particles); - } - - // California - - const californiaPts = []; - - californiaPts.push(new THREE.Vector2(610, 320)); - californiaPts.push(new THREE.Vector2(450, 300)); - californiaPts.push(new THREE.Vector2(392, 392)); - californiaPts.push(new THREE.Vector2(266, 438)); - californiaPts.push(new THREE.Vector2(190, 570)); - californiaPts.push(new THREE.Vector2(190, 600)); - californiaPts.push(new THREE.Vector2(160, 620)); - californiaPts.push(new THREE.Vector2(160, 650)); - californiaPts.push(new THREE.Vector2(180, 640)); - californiaPts.push(new THREE.Vector2(165, 680)); - californiaPts.push(new THREE.Vector2(150, 670)); - californiaPts.push(new THREE.Vector2(90, 737)); - californiaPts.push(new THREE.Vector2(80, 795)); - californiaPts.push(new THREE.Vector2(50, 835)); - californiaPts.push(new THREE.Vector2(64, 870)); - californiaPts.push(new THREE.Vector2(60, 945)); - californiaPts.push(new THREE.Vector2(300, 945)); - californiaPts.push(new THREE.Vector2(300, 743)); - californiaPts.push(new THREE.Vector2(600, 473)); - californiaPts.push(new THREE.Vector2(626, 425)); - californiaPts.push(new THREE.Vector2(600, 370)); - californiaPts.push(new THREE.Vector2(610, 320)); - - for (let i = 0; i < californiaPts.length; i++) californiaPts[i].multiplyScalar(0.25); - - const californiaShape = new THREE.Shape(californiaPts); - - // Triangle - - const triangleShape = new THREE.Shape().moveTo(80, 20).lineTo(40, 80).lineTo(120, 80).lineTo(80, 20); // close path - - // Heart - - const x = 0, - y = 0; - - const heartShape = new THREE.Shape() - .moveTo(x + 25, y + 25) - .bezierCurveTo(x + 25, y + 25, x + 20, y, x, y) - .bezierCurveTo(x - 30, y, x - 30, y + 35, x - 30, y + 35) - .bezierCurveTo(x - 30, y + 55, x - 10, y + 77, x + 25, y + 95) - .bezierCurveTo(x + 60, y + 77, x + 80, y + 55, x + 80, y + 35) - .bezierCurveTo(x + 80, y + 35, x + 80, y, x + 50, y) - .bezierCurveTo(x + 35, y, x + 25, y + 25, x + 25, y + 25); - - // Square - - const sqLength = 80; - - const squareShape = new THREE.Shape() - .moveTo(0, 0) - .lineTo(0, sqLength) - .lineTo(sqLength, sqLength) - .lineTo(sqLength, 0) - .lineTo(0, 0); - - // Rounded rectangle - - const roundedRectShape = new THREE.Shape(); - - (function roundedRect(ctx, x, y, width, height, radius) { - ctx.moveTo(x, y + radius); - ctx.lineTo(x, y + height - radius); - ctx.quadraticCurveTo(x, y + height, x + radius, y + height); - ctx.lineTo(x + width - radius, y + height); - ctx.quadraticCurveTo(x + width, y + height, x + width, y + height - radius); - ctx.lineTo(x + width, y + radius); - ctx.quadraticCurveTo(x + width, y, x + width - radius, y); - ctx.lineTo(x + radius, y); - ctx.quadraticCurveTo(x, y, x, y + radius); - })(roundedRectShape, 0, 0, 50, 50, 20); - - // Track - - const trackShape = new THREE.Shape() - .moveTo(40, 40) - .lineTo(40, 160) - .absarc(60, 160, 20, Math.PI, 0, true) - .lineTo(80, 40) - .absarc(60, 40, 20, 2 * Math.PI, Math.PI, true); - - // Circle - - const circleRadius = 40; - const circleShape = new THREE.Shape() - .moveTo(0, circleRadius) - .quadraticCurveTo(circleRadius, circleRadius, circleRadius, 0) - .quadraticCurveTo(circleRadius, -circleRadius, 0, -circleRadius) - .quadraticCurveTo(-circleRadius, -circleRadius, -circleRadius, 0) - .quadraticCurveTo(-circleRadius, circleRadius, 0, circleRadius); - - // Fish - - const fishShape = new THREE.Shape() - .moveTo(x, y) - .quadraticCurveTo(x + 50, y - 80, x + 90, y - 10) - .quadraticCurveTo(x + 100, y - 10, x + 115, y - 40) - .quadraticCurveTo(x + 115, y, x + 115, y + 40) - .quadraticCurveTo(x + 100, y + 10, x + 90, y + 10) - .quadraticCurveTo(x + 50, y + 80, x, y); - - // Arc circle - - const arcShape = new THREE.Shape().moveTo(50, 10).absarc(10, 10, 40, 0, Math.PI * 2, false); - - const holePath = new THREE.Path().moveTo(20, 10).absarc(10, 10, 10, 0, Math.PI * 2, true); - - arcShape.holes.push(holePath); - - // Smiley - - const smileyShape = new THREE.Shape().moveTo(80, 40).absarc(40, 40, 40, 0, Math.PI * 2, false); - - const smileyEye1Path = new THREE.Path().moveTo(35, 20).absellipse(25, 20, 10, 10, 0, Math.PI * 2, true); - - const smileyEye2Path = new THREE.Path().moveTo(65, 20).absarc(55, 20, 10, 0, Math.PI * 2, true); - - const smileyMouthPath = new THREE.Path() - .moveTo(20, 40) - .quadraticCurveTo(40, 60, 60, 40) - .bezierCurveTo(70, 45, 70, 50, 60, 60) - .quadraticCurveTo(40, 80, 20, 60) - .quadraticCurveTo(5, 50, 20, 40); - - smileyShape.holes.push(smileyEye1Path); - smileyShape.holes.push(smileyEye2Path); - smileyShape.holes.push(smileyMouthPath); - - // Spline shape - - const splinepts = []; - splinepts.push(new THREE.Vector2(70, 20)); - splinepts.push(new THREE.Vector2(80, 90)); - splinepts.push(new THREE.Vector2(-30, 70)); - splinepts.push(new THREE.Vector2(0, 0)); - - const splineShape = new THREE.Shape().moveTo(0, 0).splineThru(splinepts); - - const extrudeSettings = { - depth: 8, - bevelEnabled: true, - bevelSegments: 2, - steps: 2, - bevelSize: 1, - bevelThickness: 1, - }; - - // addShape( shape, color, x, y, z, rx, ry,rz, s ); - - addShape(californiaShape, extrudeSettings, 0xf08000, -300, -100, 0, 0, 0, 0, 1); - addShape(triangleShape, extrudeSettings, 0x8080f0, -180, 0, 0, 0, 0, 0, 1); - addShape(roundedRectShape, extrudeSettings, 0x008000, -150, 150, 0, 0, 0, 0, 1); - addShape(trackShape, extrudeSettings, 0x008080, 200, -100, 0, 0, 0, 0, 1); - addShape(squareShape, extrudeSettings, 0x0040f0, 150, 100, 0, 0, 0, 0, 1); - addShape(heartShape, extrudeSettings, 0xf00000, 60, 100, 0, 0, 0, Math.PI, 1); - addShape(circleShape, extrudeSettings, 0x00f000, 120, 250, 0, 0, 0, 0, 1); - addShape(fishShape, extrudeSettings, 0x404040, -60, 200, 0, 0, 0, 0, 1); - addShape(smileyShape, extrudeSettings, 0xf000f0, -200, 250, 0, 0, 0, Math.PI, 1); - addShape(arcShape, extrudeSettings, 0x804000, 150, 0, 0, 0, 0, 0, 1); - addShape(splineShape, extrudeSettings, 0x808080, -50, -100, 0, 0, 0, 0, 1); - - addLineShape(arcShape.holes[0], 0x804000, 150, 0, 0, 0, 0, 0, 1); - - for (let i = 0; i < smileyShape.holes.length; i += 1) { - addLineShape(smileyShape.holes[i], 0xf000f0, -200, 250, 0, 0, 0, Math.PI, 1); - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - container.style.touchAction = 'none'; - container.addEventListener('pointerdown', onPointerDown); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function onPointerDown(event) { - if (event.isPrimary === false) return; - - pointerXOnPointerDown = event.clientX - windowHalfX; - targetRotationOnPointerDown = targetRotation; - - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerup', onPointerUp); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - pointerX = event.clientX - windowHalfX; - - targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; -} - -function onPointerUp(event) { - if (event.isPrimary === false) return; - - document.removeEventListener('pointermove', onPointerMove); - document.removeEventListener('pointerup', onPointerUp); -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - group.rotation.y += (targetRotation - group.rotation.y) * 0.05; - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_teapot.ts b/examples-testing/examples/webgl_geometry_teapot.ts deleted file mode 100644 index 2516d660c..000000000 --- a/examples-testing/examples/webgl_geometry_teapot.ts +++ /dev/null @@ -1,185 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - -let camera, scene, renderer; -let cameraControls; -let effectController; -const teapotSize = 300; -let ambientLight, light; - -let tess = -1; // force initialization -let bBottom; -let bLid; -let bBody; -let bFitLid; -let bNonBlinn; -let shading; - -let teapot, textureCube; -const materials = {}; - -init(); -render(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - const canvasWidth = window.innerWidth; - const canvasHeight = window.innerHeight; - - // CAMERA - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 80000); - camera.position.set(-600, 550, 1300); - - // LIGHTS - ambientLight = new THREE.AmbientLight(0x7c7c7c, 2.0); - - light = new THREE.DirectionalLight(0xffffff, 2.0); - light.position.set(0.32, 0.39, 0.7); - - // RENDERER - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(canvasWidth, canvasHeight); - container.appendChild(renderer.domElement); - - // EVENTS - window.addEventListener('resize', onWindowResize); - - // CONTROLS - cameraControls = new OrbitControls(camera, renderer.domElement); - cameraControls.addEventListener('change', render); - - // TEXTURE MAP - const textureMap = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); - textureMap.wrapS = textureMap.wrapT = THREE.RepeatWrapping; - textureMap.anisotropy = 16; - textureMap.colorSpace = THREE.SRGBColorSpace; - - // REFLECTION MAP - const path = 'textures/cube/pisa/'; - const urls = ['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']; - - textureCube = new THREE.CubeTextureLoader().setPath(path).load(urls); - - materials['wireframe'] = new THREE.MeshBasicMaterial({ wireframe: true }); - materials['flat'] = new THREE.MeshPhongMaterial({ specular: 0x000000, flatShading: true, side: THREE.DoubleSide }); - materials['smooth'] = new THREE.MeshLambertMaterial({ side: THREE.DoubleSide }); - materials['glossy'] = new THREE.MeshPhongMaterial({ - color: 0xc0c0c0, - specular: 0x404040, - shininess: 300, - side: THREE.DoubleSide, - }); - materials['textured'] = new THREE.MeshPhongMaterial({ map: textureMap, side: THREE.DoubleSide }); - materials['reflective'] = new THREE.MeshPhongMaterial({ envMap: textureCube, side: THREE.DoubleSide }); - - // scene itself - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xaaaaaa); - - scene.add(ambientLight); - scene.add(light); - - // GUI - setupGui(); -} - -// EVENT HANDLERS - -function onWindowResize() { - const canvasWidth = window.innerWidth; - const canvasHeight = window.innerHeight; - - renderer.setSize(canvasWidth, canvasHeight); - - camera.aspect = canvasWidth / canvasHeight; - camera.updateProjectionMatrix(); - - render(); -} - -function setupGui() { - effectController = { - newTess: 15, - bottom: true, - lid: true, - body: true, - fitLid: false, - nonblinn: false, - newShading: 'glossy', - }; - - const gui = new GUI(); - gui.add(effectController, 'newTess', [2, 3, 4, 5, 6, 8, 10, 15, 20, 30, 40, 50]) - .name('Tessellation Level') - .onChange(render); - gui.add(effectController, 'lid').name('display lid').onChange(render); - gui.add(effectController, 'body').name('display body').onChange(render); - gui.add(effectController, 'bottom').name('display bottom').onChange(render); - gui.add(effectController, 'fitLid').name('snug lid').onChange(render); - gui.add(effectController, 'nonblinn').name('original scale').onChange(render); - gui.add(effectController, 'newShading', ['wireframe', 'flat', 'smooth', 'glossy', 'textured', 'reflective']) - .name('Shading') - .onChange(render); -} - -// - -function render() { - if ( - effectController.newTess !== tess || - effectController.bottom !== bBottom || - effectController.lid !== bLid || - effectController.body !== bBody || - effectController.fitLid !== bFitLid || - effectController.nonblinn !== bNonBlinn || - effectController.newShading !== shading - ) { - tess = effectController.newTess; - bBottom = effectController.bottom; - bLid = effectController.lid; - bBody = effectController.body; - bFitLid = effectController.fitLid; - bNonBlinn = effectController.nonblinn; - shading = effectController.newShading; - - createNewTeapot(); - } - - // skybox is rendered separately, so that it is always behind the teapot. - if (shading === 'reflective') { - scene.background = textureCube; - } else { - scene.background = null; - } - - renderer.render(scene, camera); -} - -// Whenever the teapot changes, the scene is rebuilt from scratch (not much to it). -function createNewTeapot() { - if (teapot !== undefined) { - teapot.geometry.dispose(); - scene.remove(teapot); - } - - const geometry = new TeapotGeometry( - teapotSize, - tess, - effectController.bottom, - effectController.lid, - effectController.body, - effectController.fitLid, - !effectController.nonblinn, - ); - - teapot = new THREE.Mesh(geometry, materials[shading]); - - scene.add(teapot); -} diff --git a/examples-testing/examples/webgl_geometry_terrain.ts b/examples-testing/examples/webgl_geometry_terrain.ts deleted file mode 100644 index 55b4aa474..000000000 --- a/examples-testing/examples/webgl_geometry_terrain.ts +++ /dev/null @@ -1,174 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -let container, stats; -let camera, controls, scene, renderer; -let mesh, texture; - -const worldWidth = 256, - worldDepth = 256; -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xefd1b5); - scene.fog = new THREE.FogExp2(0xefd1b5, 0.0025); - - const data = generateHeight(worldWidth, worldDepth); - - camera.position.set(100, 800, -800); - camera.lookAt(-100, 810, -800); - - const geometry = new THREE.PlaneGeometry(7500, 7500, worldWidth - 1, worldDepth - 1); - geometry.rotateX(-Math.PI / 2); - - const vertices = geometry.attributes.position.array; - - for (let i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) { - vertices[j + 1] = data[i] * 10; - } - - texture = new THREE.CanvasTexture(generateTexture(data, worldWidth, worldDepth)); - texture.wrapS = THREE.ClampToEdgeWrapping; - texture.wrapT = THREE.ClampToEdgeWrapping; - texture.colorSpace = THREE.SRGBColorSpace; - - mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ map: texture })); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - controls = new FirstPersonControls(camera, renderer.domElement); - controls.movementSpeed = 150; - controls.lookSpeed = 0.1; - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function generateHeight(width, height) { - let seed = Math.PI / 4; - window.Math.random = function () { - const x = Math.sin(seed++) * 10000; - return x - Math.floor(x); - }; - - const size = width * height, - data = new Uint8Array(size); - const perlin = new ImprovedNoise(), - z = Math.random() * 100; - - let quality = 1; - - for (let j = 0; j < 4; j++) { - for (let i = 0; i < size; i++) { - const x = i % width, - y = ~~(i / width); - data[i] += Math.abs(perlin.noise(x / quality, y / quality, z) * quality * 1.75); - } - - quality *= 5; - } - - return data; -} - -function generateTexture(data, width, height) { - let context, image, imageData, shade; - - const vector3 = new THREE.Vector3(0, 0, 0); - - const sun = new THREE.Vector3(1, 1, 1); - sun.normalize(); - - const canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - - context = canvas.getContext('2d'); - context.fillStyle = '#000'; - context.fillRect(0, 0, width, height); - - image = context.getImageData(0, 0, canvas.width, canvas.height); - imageData = image.data; - - for (let i = 0, j = 0, l = imageData.length; i < l; i += 4, j++) { - vector3.x = data[j - 2] - data[j + 2]; - vector3.y = 2; - vector3.z = data[j - width * 2] - data[j + width * 2]; - vector3.normalize(); - - shade = vector3.dot(sun); - - imageData[i] = (96 + shade * 128) * (0.5 + data[j] * 0.007); - imageData[i + 1] = (32 + shade * 96) * (0.5 + data[j] * 0.007); - imageData[i + 2] = shade * 96 * (0.5 + data[j] * 0.007); - } - - context.putImageData(image, 0, 0); - - // Scaled 4x - - const canvasScaled = document.createElement('canvas'); - canvasScaled.width = width * 4; - canvasScaled.height = height * 4; - - context = canvasScaled.getContext('2d'); - context.scale(4, 4); - context.drawImage(canvas, 0, 0); - - image = context.getImageData(0, 0, canvasScaled.width, canvasScaled.height); - imageData = image.data; - - for (let i = 0, l = imageData.length; i < l; i += 4) { - const v = ~~(Math.random() * 5); - - imageData[i] += v; - imageData[i + 1] += v; - imageData[i + 2] += v; - } - - context.putImageData(image, 0, 0); - - return canvasScaled; -} - -// - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - controls.update(timer.getDelta()); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_terrain_raycast.ts b/examples-testing/examples/webgl_geometry_terrain_raycast.ts deleted file mode 100644 index f1383c138..000000000 --- a/examples-testing/examples/webgl_geometry_terrain_raycast.ts +++ /dev/null @@ -1,206 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -let container, stats; - -let camera, controls, scene, renderer; - -let mesh, texture; - -const worldWidth = 256, - worldDepth = 256, - worldHalfWidth = worldWidth / 2, - worldHalfDepth = worldDepth / 2; - -let helper; - -const raycaster = new THREE.Raycaster(); -const pointer = new THREE.Vector2(); - -init(); - -function init() { - container = document.getElementById('container'); - container.innerHTML = ''; - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfd1e5); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 10, 20000); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1000; - controls.maxDistance = 10000; - controls.maxPolarAngle = Math.PI / 2; - - // - - const data = generateHeight(worldWidth, worldDepth); - - controls.target.y = data[worldHalfWidth + worldHalfDepth * worldWidth] + 500; - camera.position.y = controls.target.y + 2000; - camera.position.x = 2000; - controls.update(); - - const geometry = new THREE.PlaneGeometry(7500, 7500, worldWidth - 1, worldDepth - 1); - geometry.rotateX(-Math.PI / 2); - - const vertices = geometry.attributes.position.array; - - for (let i = 0, j = 0, l = vertices.length; i < l; i++, j += 3) { - vertices[j + 1] = data[i] * 10; - } - - // - - texture = new THREE.CanvasTexture(generateTexture(data, worldWidth, worldDepth)); - texture.wrapS = THREE.ClampToEdgeWrapping; - texture.wrapT = THREE.ClampToEdgeWrapping; - texture.colorSpace = THREE.SRGBColorSpace; - - mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ map: texture })); - scene.add(mesh); - - const geometryHelper = new THREE.ConeGeometry(20, 100, 3); - geometryHelper.translate(0, 50, 0); - geometryHelper.rotateX(Math.PI / 2); - helper = new THREE.Mesh(geometryHelper, new THREE.MeshNormalMaterial()); - scene.add(helper); - - container.addEventListener('pointermove', onPointerMove); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function generateHeight(width, height) { - const size = width * height, - data = new Uint8Array(size), - perlin = new ImprovedNoise(), - z = Math.random() * 100; - - let quality = 1; - - for (let j = 0; j < 4; j++) { - for (let i = 0; i < size; i++) { - const x = i % width, - y = ~~(i / width); - data[i] += Math.abs(perlin.noise(x / quality, y / quality, z) * quality * 1.75); - } - - quality *= 5; - } - - return data; -} - -function generateTexture(data, width, height) { - // bake lighting into texture - - let context, image, imageData, shade; - - const vector3 = new THREE.Vector3(0, 0, 0); - - const sun = new THREE.Vector3(1, 1, 1); - sun.normalize(); - - const canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - - context = canvas.getContext('2d'); - context.fillStyle = '#000'; - context.fillRect(0, 0, width, height); - - image = context.getImageData(0, 0, canvas.width, canvas.height); - imageData = image.data; - - for (let i = 0, j = 0, l = imageData.length; i < l; i += 4, j++) { - vector3.x = data[j - 2] - data[j + 2]; - vector3.y = 2; - vector3.z = data[j - width * 2] - data[j + width * 2]; - vector3.normalize(); - - shade = vector3.dot(sun); - - imageData[i] = (96 + shade * 128) * (0.5 + data[j] * 0.007); - imageData[i + 1] = (32 + shade * 96) * (0.5 + data[j] * 0.007); - imageData[i + 2] = shade * 96 * (0.5 + data[j] * 0.007); - } - - context.putImageData(image, 0, 0); - - // Scaled 4x - - const canvasScaled = document.createElement('canvas'); - canvasScaled.width = width * 4; - canvasScaled.height = height * 4; - - context = canvasScaled.getContext('2d'); - context.scale(4, 4); - context.drawImage(canvas, 0, 0); - - image = context.getImageData(0, 0, canvasScaled.width, canvasScaled.height); - imageData = image.data; - - for (let i = 0, l = imageData.length; i < l; i += 4) { - const v = ~~(Math.random() * 5); - - imageData[i] += v; - imageData[i + 1] += v; - imageData[i + 2] += v; - } - - context.putImageData(image, 0, 0); - - return canvasScaled; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - renderer.render(scene, camera); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / renderer.domElement.clientWidth) * 2 - 1; - pointer.y = -(event.clientY / renderer.domElement.clientHeight) * 2 + 1; - raycaster.setFromCamera(pointer, camera); - - // See if the ray from the camera into the world hits one of our meshes - const intersects = raycaster.intersectObject(mesh); - - // Toggle rotation bool for meshes that we clicked - if (intersects.length > 0) { - helper.position.set(0, 0, 0); - helper.lookAt(intersects[0].face.normal); - - helper.position.copy(intersects[0].point); - } -} diff --git a/examples-testing/examples/webgl_geometry_text.ts b/examples-testing/examples/webgl_geometry_text.ts deleted file mode 100644 index 1a9d00d06..000000000 --- a/examples-testing/examples/webgl_geometry_text.ts +++ /dev/null @@ -1,312 +0,0 @@ -import * as THREE from 'three'; - -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -THREE.Cache.enabled = true; - -let container; - -let camera, cameraTarget, scene, renderer; - -let group, textMesh1, textMesh2, textGeo, materials; - -let firstLetter = true; - -let text = 'three.js', - bevelEnabled = true, - font = undefined, - fontName = 'optimer', // helvetiker, optimer, gentilis, droid sans, droid serif - fontWeight = 'bold'; // normal bold - -const depth = 20, - size = 70, - hover = 30, - curveSegments = 4, - bevelThickness = 2, - bevelSize = 1.5; - -const mirror = true; - -const fontMap = { - helvetiker: 0, - optimer: 1, - gentilis: 2, - 'droid/droid_sans': 3, - 'droid/droid_serif': 4, -}; - -const weightMap = { - regular: 0, - bold: 1, -}; - -const reverseFontMap = []; -const reverseWeightMap = []; - -for (const i in fontMap) reverseFontMap[fontMap[i]] = i; -for (const i in weightMap) reverseWeightMap[weightMap[i]] = i; - -let targetRotation = 0; -let targetRotationOnPointerDown = 0; - -let pointerX = 0; -let pointerXOnPointerDown = 0; - -let windowHalfX = window.innerWidth / 2; - -let fontIndex = 1; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // CAMERA - - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1500); - camera.position.set(0, 400, 700); - - cameraTarget = new THREE.Vector3(0, 150, 0); - - // SCENE - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - scene.fog = new THREE.Fog(0x000000, 250, 1400); - - // LIGHTS - - const dirLight = new THREE.DirectionalLight(0xffffff, 0.4); - dirLight.position.set(0, 0, 1).normalize(); - scene.add(dirLight); - - const pointLight = new THREE.PointLight(0xffffff, 4.5, 0, 0); - pointLight.color.setHSL(Math.random(), 1, 0.5); - pointLight.position.set(0, 100, 90); - scene.add(pointLight); - - materials = [ - new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }), // front - new THREE.MeshPhongMaterial({ color: 0xffffff }), // side - ]; - - group = new THREE.Group(); - group.position.y = 100; - - scene.add(group); - - loadFont(); - - const plane = new THREE.Mesh( - new THREE.PlaneGeometry(10000, 10000), - new THREE.MeshBasicMaterial({ color: 0xffffff, opacity: 0.5, transparent: true }), - ); - plane.position.y = 100; - plane.rotation.x = -Math.PI / 2; - scene.add(plane); - - // RENDERER - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // EVENTS - - container.style.touchAction = 'none'; - container.addEventListener('pointerdown', onPointerDown); - - document.addEventListener('keypress', onDocumentKeyPress); - document.addEventListener('keydown', onDocumentKeyDown); - - // - - const params = { - changeColor: function () { - pointLight.color.setHSL(Math.random(), 1, 0.5); - }, - changeFont: function () { - fontIndex++; - - fontName = reverseFontMap[fontIndex % reverseFontMap.length]; - - loadFont(); - }, - changeWeight: function () { - if (fontWeight === 'bold') { - fontWeight = 'regular'; - } else { - fontWeight = 'bold'; - } - - loadFont(); - }, - changeBevel: function () { - bevelEnabled = !bevelEnabled; - - refreshText(); - }, - }; - - // - - const gui = new GUI(); - - gui.add(params, 'changeColor').name('change color'); - gui.add(params, 'changeFont').name('change font'); - gui.add(params, 'changeWeight').name('change weight'); - gui.add(params, 'changeBevel').name('change bevel'); - gui.open(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function onDocumentKeyDown(event) { - if (firstLetter) { - firstLetter = false; - text = ''; - } - - const keyCode = event.keyCode; - - // backspace - - if (keyCode == 8) { - event.preventDefault(); - - text = text.substring(0, text.length - 1); - refreshText(); - - return false; - } -} - -function onDocumentKeyPress(event) { - const keyCode = event.which; - - // backspace - - if (keyCode == 8) { - event.preventDefault(); - } else { - const ch = String.fromCharCode(keyCode); - text += ch; - - refreshText(); - } -} - -function loadFont() { - const loader = new FontLoader(); - loader.load('fonts/' + fontName + '_' + fontWeight + '.typeface.json', function (response) { - font = response; - - refreshText(); - }); -} - -function createText() { - textGeo = new TextGeometry(text, { - font: font, - - size: size, - depth: depth, - curveSegments: curveSegments, - - bevelThickness: bevelThickness, - bevelSize: bevelSize, - bevelEnabled: bevelEnabled, - }); - - textGeo.computeBoundingBox(); - - const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); - - textMesh1 = new THREE.Mesh(textGeo, materials); - - textMesh1.position.x = centerOffset; - textMesh1.position.y = hover; - textMesh1.position.z = 0; - - textMesh1.rotation.x = 0; - textMesh1.rotation.y = Math.PI * 2; - - group.add(textMesh1); - - if (mirror) { - textMesh2 = new THREE.Mesh(textGeo, materials); - - textMesh2.position.x = centerOffset; - textMesh2.position.y = -hover; - textMesh2.position.z = depth; - - textMesh2.rotation.x = Math.PI; - textMesh2.rotation.y = Math.PI * 2; - - group.add(textMesh2); - } -} - -function refreshText() { - group.remove(textMesh1); - if (mirror) group.remove(textMesh2); - - if (!text) return; - - createText(); -} - -function onPointerDown(event) { - if (event.isPrimary === false) return; - - pointerXOnPointerDown = event.clientX - windowHalfX; - targetRotationOnPointerDown = targetRotation; - - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerup', onPointerUp); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - pointerX = event.clientX - windowHalfX; - - targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; -} - -function onPointerUp(event) { - if (event.isPrimary === false) return; - - document.removeEventListener('pointermove', onPointerMove); - document.removeEventListener('pointerup', onPointerUp); -} - -// - -function animate() { - group.rotation.y += (targetRotation - group.rotation.y) * 0.05; - - camera.lookAt(cameraTarget); - - renderer.clear(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_text_shapes.ts b/examples-testing/examples/webgl_geometry_text_shapes.ts deleted file mode 100644 index d9633cd15..000000000 --- a/examples-testing/examples/webgl_geometry_text_shapes.ts +++ /dev/null @@ -1,112 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; - -let camera, scene, renderer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(0, -400, 600); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - const loader = new FontLoader(); - loader.load('fonts/helvetiker_regular.typeface.json', function (font) { - const color = 0x006699; - - const matDark = new THREE.LineBasicMaterial({ - color: color, - side: THREE.DoubleSide, - }); - - const matLite = new THREE.MeshBasicMaterial({ - color: color, - transparent: true, - opacity: 0.4, - side: THREE.DoubleSide, - }); - - const message = ' Three.js\nSimple text.'; - - const shapes = font.generateShapes(message, 100); - - const geometry = new THREE.ShapeGeometry(shapes); - - geometry.computeBoundingBox(); - - const xMid = -0.5 * (geometry.boundingBox.max.x - geometry.boundingBox.min.x); - - geometry.translate(xMid, 0, 0); - - // make shape ( N.B. edge view not visible ) - - const text = new THREE.Mesh(geometry, matLite); - text.position.z = -150; - scene.add(text); - - // make line shape ( N.B. edge view remains visible ) - - const holeShapes = []; - - for (let i = 0; i < shapes.length; i++) { - const shape = shapes[i]; - - if (shape.holes && shape.holes.length > 0) { - for (let j = 0; j < shape.holes.length; j++) { - const hole = shape.holes[j]; - holeShapes.push(hole); - } - } - } - - shapes.push(...holeShapes); - - const lineText = new THREE.Object3D(); - - for (let i = 0; i < shapes.length; i++) { - const shape = shapes[i]; - - const points = shape.getPoints(); - const geometry = new THREE.BufferGeometry().setFromPoints(points); - - geometry.translate(xMid, 0, 0); - - const lineMesh = new THREE.Line(geometry, matDark); - lineText.add(lineMesh); - } - - scene.add(lineText); - - render(); - }); //end load function - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0, 0); - controls.update(); - - controls.addEventListener('change', render); - - window.addEventListener('resize', onWindowResize); -} // end init - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_geometry_text_stroke.ts b/examples-testing/examples/webgl_geometry_text_stroke.ts deleted file mode 100644 index 49ca9aa8c..000000000 --- a/examples-testing/examples/webgl_geometry_text_stroke.ts +++ /dev/null @@ -1,146 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { SVGLoader } from 'three/addons/loaders/SVGLoader.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; - -let camera, scene, renderer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(0, -400, 1000); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - const loader = new FontLoader(); - loader.load('fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json', function (font) { - const color = new THREE.Color(0x006699); - - const matDark = new THREE.MeshBasicMaterial({ - color: color, - side: THREE.DoubleSide, - }); - - const matLite = new THREE.MeshBasicMaterial({ - color: color, - transparent: true, - opacity: 0.4, - side: THREE.DoubleSide, - }); - - const material = { - dark: matDark, - lite: matLite, - color: color, - }; - - const english = ' Three.js\nStroke text.'; // Left to right - - const hebrew = 'טקסט קו'; // Right to left - - const chinese = '文字描邊'; // Top to bottom - - const message1 = generateStrokeText(font, material, english, 80, 'ltr'); - - const message2 = generateStrokeText(font, material, hebrew, 80, 'rtl'); - - const message3 = generateStrokeText(font, material, chinese, 80, 'tb'); - - message1.position.x = -100; - - message2.position.x = -100; - message2.position.y = -300; - - message3.position.x = 300; - message3.position.y = -300; - - scene.add(message1, message2, message3); - - render(); - }); //end load function - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0, 0); - controls.update(); - - controls.addEventListener('change', render); - - window.addEventListener('resize', onWindowResize); -} // end init - -function generateStrokeText(font, material, message, size, direction = 'ltr') { - const shapes = font.generateShapes(message, size, direction); - - const geometry = new THREE.ShapeGeometry(shapes); - - const strokeText = new THREE.Group(); - - geometry.computeBoundingBox(); - - const xMid = -0.5 * (geometry.boundingBox.max.x - geometry.boundingBox.min.x); - - geometry.translate(xMid, 0, 0); - - // make shape ( N.B. edge view not visible ) - - const text = new THREE.Mesh(geometry, material.lite); - - text.position.z = -150; - - strokeText.add(text); - - // make line shape ( N.B. edge view remains visible ) - - const holeShapes = []; - - for (let i = 0; i < shapes.length; i++) { - const shape = shapes[i]; - - if (shape.holes && shape.holes.length > 0) { - for (let j = 0; j < shape.holes.length; j++) { - const hole = shape.holes[j]; - holeShapes.push(hole); - } - } - } - - shapes.push(...holeShapes); - - const style = SVGLoader.getStrokeStyle(5, material.color.getStyle()); - - for (let i = 0; i < shapes.length; i++) { - const shape = shapes[i]; - - const points = shape.getPoints(); - - const geometry = SVGLoader.pointsToStroke(points, style); - - geometry.translate(xMid, 0, 0); - - const strokeMesh = new THREE.Mesh(geometry, material.dark); - strokeText.add(strokeMesh); - } - - return strokeText; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_gpgpu_birds.ts b/examples-testing/examples/webgl_gpgpu_birds.ts deleted file mode 100644 index 20a5e0d97..000000000 --- a/examples-testing/examples/webgl_gpgpu_birds.ts +++ /dev/null @@ -1,313 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; - -/* TEXTURE WIDTH FOR SIMULATION */ -const WIDTH = 32; - -const BIRDS = WIDTH * WIDTH; - -// Custom Geometry - using 3 triangles each. No UVs, no normals currently. -class BirdGeometry extends THREE.BufferGeometry { - constructor() { - super(); - - const trianglesPerBird = 3; - const triangles = BIRDS * trianglesPerBird; - const points = triangles * 3; - - const vertices = new THREE.BufferAttribute(new Float32Array(points * 3), 3); - const birdColors = new THREE.BufferAttribute(new Float32Array(points * 3), 3); - const references = new THREE.BufferAttribute(new Float32Array(points * 2), 2); - const birdVertex = new THREE.BufferAttribute(new Float32Array(points), 1); - - this.setAttribute('position', vertices); - this.setAttribute('birdColor', birdColors); - this.setAttribute('reference', references); - this.setAttribute('birdVertex', birdVertex); - - // this.setAttribute( 'normal', new Float32Array( points * 3 ), 3 ); - - let v = 0; - - function verts_push() { - for (let i = 0; i < arguments.length; i++) { - vertices.array[v++] = arguments[i]; - } - } - - const wingsSpan = 20; - - for (let f = 0; f < BIRDS; f++) { - // Body - - verts_push(0, -0, -20, 0, 4, -20, 0, 0, 30); - - // Wings - - verts_push(0, 0, -15, -wingsSpan, 0, 0, 0, 0, 15); - - verts_push(0, 0, 15, wingsSpan, 0, 0, 0, 0, -15); - } - - for (let v = 0; v < triangles * 3; v++) { - const triangleIndex = ~~(v / 3); - const birdIndex = ~~(triangleIndex / trianglesPerBird); - const x = (birdIndex % WIDTH) / WIDTH; - const y = ~~(birdIndex / WIDTH) / WIDTH; - - const c = new THREE.Color(0x666666 + (~~(v / 9) / BIRDS) * 0x666666); - - birdColors.array[v * 3 + 0] = c.r; - birdColors.array[v * 3 + 1] = c.g; - birdColors.array[v * 3 + 2] = c.b; - - references.array[v * 2] = x; - references.array[v * 2 + 1] = y; - - birdVertex.array[v] = v % 9; - } - - this.scale(0.2, 0.2, 0.2); - } -} - -// - -let container, stats; -let camera, scene, renderer; -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -const BOUNDS = 800, - BOUNDS_HALF = BOUNDS / 2; - -let last = performance.now(); - -let gpuCompute; -let velocityVariable; -let positionVariable; -let positionUniforms; -let velocityUniforms; -let birdUniforms; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 3000); - camera.position.z = 350; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - scene.fog = new THREE.Fog(0xffffff, 100, 1000); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - initComputeRenderer(); - - stats = new Stats(); - container.appendChild(stats.dom); - - container.style.touchAction = 'none'; - container.addEventListener('pointermove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - const effectController = { - separation: 20.0, - alignment: 20.0, - cohesion: 20.0, - freedom: 0.75, - }; - - const valuesChanger = function () { - velocityUniforms['separationDistance'].value = effectController.separation; - velocityUniforms['alignmentDistance'].value = effectController.alignment; - velocityUniforms['cohesionDistance'].value = effectController.cohesion; - velocityUniforms['freedomFactor'].value = effectController.freedom; - }; - - valuesChanger(); - - gui.add(effectController, 'separation', 0.0, 100.0, 1.0).onChange(valuesChanger); - gui.add(effectController, 'alignment', 0.0, 100, 0.001).onChange(valuesChanger); - gui.add(effectController, 'cohesion', 0.0, 100, 0.025).onChange(valuesChanger); - gui.close(); - - initBirds(); -} - -function initComputeRenderer() { - gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); - - const dtPosition = gpuCompute.createTexture(); - const dtVelocity = gpuCompute.createTexture(); - fillPositionTexture(dtPosition); - fillVelocityTexture(dtVelocity); - - velocityVariable = gpuCompute.addVariable( - 'textureVelocity', - document.getElementById('fragmentShaderVelocity').textContent, - dtVelocity, - ); - positionVariable = gpuCompute.addVariable( - 'texturePosition', - document.getElementById('fragmentShaderPosition').textContent, - dtPosition, - ); - - gpuCompute.setVariableDependencies(velocityVariable, [positionVariable, velocityVariable]); - gpuCompute.setVariableDependencies(positionVariable, [positionVariable, velocityVariable]); - - positionUniforms = positionVariable.material.uniforms; - velocityUniforms = velocityVariable.material.uniforms; - - positionUniforms['time'] = { value: 0.0 }; - positionUniforms['delta'] = { value: 0.0 }; - velocityUniforms['time'] = { value: 1.0 }; - velocityUniforms['delta'] = { value: 0.0 }; - velocityUniforms['testing'] = { value: 1.0 }; - velocityUniforms['separationDistance'] = { value: 1.0 }; - velocityUniforms['alignmentDistance'] = { value: 1.0 }; - velocityUniforms['cohesionDistance'] = { value: 1.0 }; - velocityUniforms['freedomFactor'] = { value: 1.0 }; - velocityUniforms['predator'] = { value: new THREE.Vector3() }; - velocityVariable.material.defines.BOUNDS = BOUNDS.toFixed(2); - - velocityVariable.wrapS = THREE.RepeatWrapping; - velocityVariable.wrapT = THREE.RepeatWrapping; - positionVariable.wrapS = THREE.RepeatWrapping; - positionVariable.wrapT = THREE.RepeatWrapping; - - const error = gpuCompute.init(); - - if (error !== null) { - console.error(error); - } -} - -function initBirds() { - const geometry = new BirdGeometry(); - - // For Vertex and Fragment - birdUniforms = { - color: { value: new THREE.Color(0xff2200) }, - texturePosition: { value: null }, - textureVelocity: { value: null }, - time: { value: 1.0 }, - delta: { value: 0.0 }, - }; - - // THREE.ShaderMaterial - const material = new THREE.ShaderMaterial({ - uniforms: birdUniforms, - vertexShader: document.getElementById('birdVS').textContent, - fragmentShader: document.getElementById('birdFS').textContent, - side: THREE.DoubleSide, - }); - - const birdMesh = new THREE.Mesh(geometry, material); - birdMesh.rotation.y = Math.PI / 2; - birdMesh.matrixAutoUpdate = false; - birdMesh.updateMatrix(); - - scene.add(birdMesh); -} - -function fillPositionTexture(texture) { - const theArray = texture.image.data; - - for (let k = 0, kl = theArray.length; k < kl; k += 4) { - const x = Math.random() * BOUNDS - BOUNDS_HALF; - const y = Math.random() * BOUNDS - BOUNDS_HALF; - const z = Math.random() * BOUNDS - BOUNDS_HALF; - - theArray[k + 0] = x; - theArray[k + 1] = y; - theArray[k + 2] = z; - theArray[k + 3] = 1; - } -} - -function fillVelocityTexture(texture) { - const theArray = texture.image.data; - - for (let k = 0, kl = theArray.length; k < kl; k += 4) { - const x = Math.random() - 0.5; - const y = Math.random() - 0.5; - const z = Math.random() - 0.5; - - theArray[k + 0] = x * 10; - theArray[k + 1] = y * 10; - theArray[k + 2] = z * 10; - theArray[k + 3] = 1; - } -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const now = performance.now(); - let delta = (now - last) / 1000; - - if (delta > 1) delta = 1; // safety cap on large deltas - last = now; - - positionUniforms['time'].value = now; - positionUniforms['delta'].value = delta; - velocityUniforms['time'].value = now; - velocityUniforms['delta'].value = delta; - birdUniforms['time'].value = now; - birdUniforms['delta'].value = delta; - - velocityUniforms['predator'].value.set((0.5 * mouseX) / windowHalfX, (-0.5 * mouseY) / windowHalfY, 0); - - mouseX = 10000; - mouseY = 10000; - - gpuCompute.compute(); - - birdUniforms['texturePosition'].value = gpuCompute.getCurrentRenderTarget(positionVariable).texture; - birdUniforms['textureVelocity'].value = gpuCompute.getCurrentRenderTarget(velocityVariable).texture; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_gpgpu_birds_gltf.ts b/examples-testing/examples/webgl_gpgpu_birds_gltf.ts deleted file mode 100644 index 05f81a869..000000000 --- a/examples-testing/examples/webgl_gpgpu_birds_gltf.ts +++ /dev/null @@ -1,413 +0,0 @@ -import * as THREE from 'three'; -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; - -/* TEXTURE WIDTH FOR SIMULATION */ -const WIDTH = 64; -const BIRDS = WIDTH * WIDTH; - -/* BAKE ANIMATION INTO TEXTURE and CREATE GEOMETRY FROM BASE MODEL */ -const BirdGeometry = new THREE.BufferGeometry(); -let textureAnimation, durationAnimation, birdMesh, materialShader, indicesPerBird; - -function nextPowerOf2(n) { - return Math.pow(2, Math.ceil(Math.log(n) / Math.log(2))); -} - -const gltfs = ['models/gltf/Parrot.glb', 'models/gltf/Flamingo.glb']; -const colors = [0xccffff, 0xffdeff]; -const sizes = [0.2, 0.1]; -const selectModel = Math.floor(Math.random() * gltfs.length); -new GLTFLoader().load(gltfs[selectModel], function (gltf) { - const animations = gltf.animations; - durationAnimation = Math.round(animations[0].duration * 60); - const birdGeo = gltf.scene.children[0].geometry; - const morphAttributes = birdGeo.morphAttributes.position; - const tHeight = nextPowerOf2(durationAnimation); - const tWidth = nextPowerOf2(birdGeo.getAttribute('position').count); - indicesPerBird = birdGeo.index.count; - const tData = new Float32Array(4 * tWidth * tHeight); - - for (let i = 0; i < tWidth; i++) { - for (let j = 0; j < tHeight; j++) { - const offset = j * tWidth * 4; - - const curMorph = Math.floor((j / durationAnimation) * morphAttributes.length); - const nextMorph = - (Math.floor((j / durationAnimation) * morphAttributes.length) + 1) % morphAttributes.length; - const lerpAmount = ((j / durationAnimation) * morphAttributes.length) % 1; - - if (j < durationAnimation) { - let d0, d1; - - d0 = morphAttributes[curMorph].array[i * 3]; - d1 = morphAttributes[nextMorph].array[i * 3]; - - if (d0 !== undefined && d1 !== undefined) - tData[offset + i * 4] = THREE.MathUtils.lerp(d0, d1, lerpAmount); - - d0 = morphAttributes[curMorph].array[i * 3 + 1]; - d1 = morphAttributes[nextMorph].array[i * 3 + 1]; - - if (d0 !== undefined && d1 !== undefined) - tData[offset + i * 4 + 1] = THREE.MathUtils.lerp(d0, d1, lerpAmount); - - d0 = morphAttributes[curMorph].array[i * 3 + 2]; - d1 = morphAttributes[nextMorph].array[i * 3 + 2]; - - if (d0 !== undefined && d1 !== undefined) - tData[offset + i * 4 + 2] = THREE.MathUtils.lerp(d0, d1, lerpAmount); - - tData[offset + i * 4 + 3] = 1; - } - } - } - - textureAnimation = new THREE.DataTexture(tData, tWidth, tHeight, THREE.RGBAFormat, THREE.FloatType); - textureAnimation.needsUpdate = true; - - const vertices = [], - color = [], - reference = [], - seeds = [], - indices = []; - const totalVertices = birdGeo.getAttribute('position').count * 3 * BIRDS; - for (let i = 0; i < totalVertices; i++) { - const bIndex = i % (birdGeo.getAttribute('position').count * 3); - vertices.push(birdGeo.getAttribute('position').array[bIndex]); - color.push(birdGeo.getAttribute('color').array[bIndex]); - } - - let r = Math.random(); - for (let i = 0; i < birdGeo.getAttribute('position').count * BIRDS; i++) { - const bIndex = i % birdGeo.getAttribute('position').count; - const bird = Math.floor(i / birdGeo.getAttribute('position').count); - if (bIndex == 0) r = Math.random(); - const j = ~~bird; - const x = (j % WIDTH) / WIDTH; - const y = ~~(j / WIDTH) / WIDTH; - reference.push(x, y, bIndex / tWidth, durationAnimation / tHeight); - seeds.push(bird, r, Math.random(), Math.random()); - } - - for (let i = 0; i < birdGeo.index.array.length * BIRDS; i++) { - const offset = Math.floor(i / birdGeo.index.array.length) * birdGeo.getAttribute('position').count; - indices.push(birdGeo.index.array[i % birdGeo.index.array.length] + offset); - } - - BirdGeometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(vertices), 3)); - BirdGeometry.setAttribute('birdColor', new THREE.BufferAttribute(new Float32Array(color), 3)); - BirdGeometry.setAttribute('color', new THREE.BufferAttribute(new Float32Array(color), 3)); - BirdGeometry.setAttribute('reference', new THREE.BufferAttribute(new Float32Array(reference), 4)); - BirdGeometry.setAttribute('seeds', new THREE.BufferAttribute(new Float32Array(seeds), 4)); - - BirdGeometry.setIndex(indices); - - init(); -}); - -let container, stats; -let camera, scene, renderer; -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -const BOUNDS = 800, - BOUNDS_HALF = BOUNDS / 2; - -let last = performance.now(); - -let gpuCompute; -let velocityVariable; -let positionVariable; -let positionUniforms; -let velocityUniforms; - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 3000); - camera.position.z = 350; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(colors[selectModel]); - scene.fog = new THREE.Fog(colors[selectModel], 100, 1000); - - // LIGHTS - - const hemiLight = new THREE.HemisphereLight(colors[selectModel], 0xffffff, 4.5); - hemiLight.color.setHSL(0.6, 1, 0.6, THREE.SRGBColorSpace); - hemiLight.groundColor.setHSL(0.095, 1, 0.75, THREE.SRGBColorSpace); - hemiLight.position.set(0, 50, 0); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0x00ced1, 2.0); - dirLight.color.setHSL(0.1, 1, 0.95, THREE.SRGBColorSpace); - dirLight.position.set(-1, 1.75, 1); - dirLight.position.multiplyScalar(30); - scene.add(dirLight); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - initComputeRenderer(); - - stats = new Stats(); - container.appendChild(stats.dom); - - container.style.touchAction = 'none'; - container.addEventListener('pointermove', onPointerMove); - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - const effectController = { - separation: 20.0, - alignment: 20.0, - cohesion: 20.0, - freedom: 0.75, - size: sizes[selectModel], - count: Math.floor(BIRDS / 4), - }; - - const valuesChanger = function () { - velocityUniforms['separationDistance'].value = effectController.separation; - velocityUniforms['alignmentDistance'].value = effectController.alignment; - velocityUniforms['cohesionDistance'].value = effectController.cohesion; - velocityUniforms['freedomFactor'].value = effectController.freedom; - if (materialShader) materialShader.uniforms['size'].value = effectController.size; - BirdGeometry.setDrawRange(0, indicesPerBird * effectController.count); - }; - - valuesChanger(); - - gui.add(effectController, 'separation', 0.0, 100.0, 1.0).onChange(valuesChanger); - gui.add(effectController, 'alignment', 0.0, 100, 0.001).onChange(valuesChanger); - gui.add(effectController, 'cohesion', 0.0, 100, 0.025).onChange(valuesChanger); - gui.add(effectController, 'size', 0, 1, 0.01).onChange(valuesChanger); - gui.add(effectController, 'count', 0, BIRDS, 1).onChange(valuesChanger); - gui.close(); - - initBirds(effectController); -} - -function initComputeRenderer() { - gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); - - const dtPosition = gpuCompute.createTexture(); - const dtVelocity = gpuCompute.createTexture(); - fillPositionTexture(dtPosition); - fillVelocityTexture(dtVelocity); - - velocityVariable = gpuCompute.addVariable( - 'textureVelocity', - document.getElementById('fragmentShaderVelocity').textContent, - dtVelocity, - ); - positionVariable = gpuCompute.addVariable( - 'texturePosition', - document.getElementById('fragmentShaderPosition').textContent, - dtPosition, - ); - - gpuCompute.setVariableDependencies(velocityVariable, [positionVariable, velocityVariable]); - gpuCompute.setVariableDependencies(positionVariable, [positionVariable, velocityVariable]); - - positionUniforms = positionVariable.material.uniforms; - velocityUniforms = velocityVariable.material.uniforms; - - positionUniforms['time'] = { value: 0.0 }; - positionUniforms['delta'] = { value: 0.0 }; - velocityUniforms['time'] = { value: 1.0 }; - velocityUniforms['delta'] = { value: 0.0 }; - velocityUniforms['testing'] = { value: 1.0 }; - velocityUniforms['separationDistance'] = { value: 1.0 }; - velocityUniforms['alignmentDistance'] = { value: 1.0 }; - velocityUniforms['cohesionDistance'] = { value: 1.0 }; - velocityUniforms['freedomFactor'] = { value: 1.0 }; - velocityUniforms['predator'] = { value: new THREE.Vector3() }; - velocityVariable.material.defines.BOUNDS = BOUNDS.toFixed(2); - - velocityVariable.wrapS = THREE.RepeatWrapping; - velocityVariable.wrapT = THREE.RepeatWrapping; - positionVariable.wrapS = THREE.RepeatWrapping; - positionVariable.wrapT = THREE.RepeatWrapping; - - const error = gpuCompute.init(); - - if (error !== null) { - console.error(error); - } -} - -function initBirds(effectController) { - const geometry = BirdGeometry; - - const m = new THREE.MeshStandardMaterial({ - vertexColors: true, - flatShading: true, - roughness: 1, - metalness: 0, - }); - - m.onBeforeCompile = shader => { - shader.uniforms.texturePosition = { value: null }; - shader.uniforms.textureVelocity = { value: null }; - shader.uniforms.textureAnimation = { value: textureAnimation }; - shader.uniforms.time = { value: 1.0 }; - shader.uniforms.size = { value: effectController.size }; - shader.uniforms.delta = { value: 0.0 }; - - let token = '#define STANDARD'; - - let insert = /* glsl */ ` - attribute vec4 reference; - attribute vec4 seeds; - attribute vec3 birdColor; - uniform sampler2D texturePosition; - uniform sampler2D textureVelocity; - uniform sampler2D textureAnimation; - uniform float size; - uniform float time; - `; - - shader.vertexShader = shader.vertexShader.replace(token, token + insert); - - token = '#include '; - - insert = /* glsl */ ` - vec4 tmpPos = texture2D( texturePosition, reference.xy ); - - vec3 pos = tmpPos.xyz; - vec3 velocity = normalize(texture2D( textureVelocity, reference.xy ).xyz); - vec3 aniPos = texture2D( textureAnimation, vec2( reference.z, mod( time + ( seeds.x ) * ( ( 0.0004 + seeds.y / 10000.0) + normalize( velocity ) / 20000.0 ), reference.w ) ) ).xyz; - vec3 newPosition = position; - - newPosition = mat3( modelMatrix ) * ( newPosition + aniPos ); - newPosition *= size + seeds.y * size * 0.2; - - velocity.z *= -1.; - float xz = length( velocity.xz ); - float xyz = 1.; - float x = sqrt( 1. - velocity.y * velocity.y ); - - float cosry = velocity.x / xz; - float sinry = velocity.z / xz; - - float cosrz = x / xyz; - float sinrz = velocity.y / xyz; - - mat3 maty = mat3( cosry, 0, -sinry, 0 , 1, 0 , sinry, 0, cosry ); - mat3 matz = mat3( cosrz , sinrz, 0, -sinrz, cosrz, 0, 0 , 0 , 1 ); - - newPosition = maty * matz * newPosition; - newPosition += pos; - - vec3 transformed = vec3( newPosition ); - `; - - shader.vertexShader = shader.vertexShader.replace(token, insert); - - materialShader = shader; - }; - - birdMesh = new THREE.Mesh(geometry, m); - birdMesh.rotation.y = Math.PI / 2; - - birdMesh.castShadow = true; - birdMesh.receiveShadow = true; - - scene.add(birdMesh); -} - -function fillPositionTexture(texture) { - const theArray = texture.image.data; - - for (let k = 0, kl = theArray.length; k < kl; k += 4) { - const x = Math.random() * BOUNDS - BOUNDS_HALF; - const y = Math.random() * BOUNDS - BOUNDS_HALF; - const z = Math.random() * BOUNDS - BOUNDS_HALF; - - theArray[k + 0] = x; - theArray[k + 1] = y; - theArray[k + 2] = z; - theArray[k + 3] = 1; - } -} - -function fillVelocityTexture(texture) { - const theArray = texture.image.data; - - for (let k = 0, kl = theArray.length; k < kl; k += 4) { - const x = Math.random() - 0.5; - const y = Math.random() - 0.5; - const z = Math.random() - 0.5; - - theArray[k + 0] = x * 10; - theArray[k + 1] = y * 10; - theArray[k + 2] = z * 10; - theArray[k + 3] = 1; - } -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const now = performance.now(); - let delta = (now - last) / 1000; - - if (delta > 1) delta = 1; // safety cap on large deltas - last = now; - - positionUniforms['time'].value = now; - positionUniforms['delta'].value = delta; - velocityUniforms['time'].value = now; - velocityUniforms['delta'].value = delta; - if (materialShader) materialShader.uniforms['time'].value = now / 1000; - if (materialShader) materialShader.uniforms['delta'].value = delta; - - velocityUniforms['predator'].value.set((0.5 * mouseX) / windowHalfX, (-0.5 * mouseY) / windowHalfY, 0); - - mouseX = 10000; - mouseY = 10000; - - gpuCompute.compute(); - - if (materialShader) - materialShader.uniforms['texturePosition'].value = gpuCompute.getCurrentRenderTarget(positionVariable).texture; - if (materialShader) - materialShader.uniforms['textureVelocity'].value = gpuCompute.getCurrentRenderTarget(velocityVariable).texture; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_gpgpu_protoplanet.ts b/examples-testing/examples/webgl_gpgpu_protoplanet.ts deleted file mode 100644 index 30444ddba..000000000 --- a/examples-testing/examples/webgl_gpgpu_protoplanet.ts +++ /dev/null @@ -1,280 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; - -// Texture width for simulation (each texel is a debris particle) -const WIDTH = 64; - -let container, stats; -let camera, scene, renderer, geometry; - -const PARTICLES = WIDTH * WIDTH; - -let gpuCompute; -let velocityVariable; -let positionVariable; -let velocityUniforms; -let particleUniforms; -let effectController; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 5, 15000); - camera.position.y = 120; - camera.position.z = 400; - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 100; - controls.maxDistance = 1000; - - effectController = { - // Can be changed dynamically - gravityConstant: 100.0, - density: 0.45, - - // Must restart simulation - radius: 300, - height: 8, - exponent: 0.4, - maxMass: 15.0, - velocity: 70, - velocityExponent: 0.2, - randVelocity: 0.001, - }; - - initComputeRenderer(); - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); - - initGUI(); - - initProtoplanets(); - - dynamicValuesChanger(); -} - -function initComputeRenderer() { - gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); - - const dtPosition = gpuCompute.createTexture(); - const dtVelocity = gpuCompute.createTexture(); - - fillTextures(dtPosition, dtVelocity); - - velocityVariable = gpuCompute.addVariable( - 'textureVelocity', - document.getElementById('computeShaderVelocity').textContent, - dtVelocity, - ); - positionVariable = gpuCompute.addVariable( - 'texturePosition', - document.getElementById('computeShaderPosition').textContent, - dtPosition, - ); - - gpuCompute.setVariableDependencies(velocityVariable, [positionVariable, velocityVariable]); - gpuCompute.setVariableDependencies(positionVariable, [positionVariable, velocityVariable]); - - velocityUniforms = velocityVariable.material.uniforms; - - velocityUniforms['gravityConstant'] = { value: 0.0 }; - velocityUniforms['density'] = { value: 0.0 }; - - const error = gpuCompute.init(); - - if (error !== null) { - console.error(error); - } -} - -function restartSimulation() { - const dtPosition = gpuCompute.createTexture(); - const dtVelocity = gpuCompute.createTexture(); - - fillTextures(dtPosition, dtVelocity); - - gpuCompute.renderTexture(dtPosition, positionVariable.renderTargets[0]); - gpuCompute.renderTexture(dtPosition, positionVariable.renderTargets[1]); - gpuCompute.renderTexture(dtVelocity, velocityVariable.renderTargets[0]); - gpuCompute.renderTexture(dtVelocity, velocityVariable.renderTargets[1]); -} - -function initProtoplanets() { - geometry = new THREE.BufferGeometry(); - - const positions = new Float32Array(PARTICLES * 3); - let p = 0; - - for (let i = 0; i < PARTICLES; i++) { - positions[p++] = (Math.random() * 2 - 1) * effectController.radius; - positions[p++] = 0; //( Math.random() * 2 - 1 ) * effectController.radius; - positions[p++] = (Math.random() * 2 - 1) * effectController.radius; - } - - const uvs = new Float32Array(PARTICLES * 2); - p = 0; - - for (let j = 0; j < WIDTH; j++) { - for (let i = 0; i < WIDTH; i++) { - uvs[p++] = i / (WIDTH - 1); - uvs[p++] = j / (WIDTH - 1); - } - } - - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2)); - - particleUniforms = { - texturePosition: { value: null }, - textureVelocity: { value: null }, - cameraConstant: { value: getCameraConstant(camera) }, - density: { value: 0.0 }, - }; - - // THREE.ShaderMaterial - const material = new THREE.ShaderMaterial({ - uniforms: particleUniforms, - vertexShader: document.getElementById('particleVertexShader').textContent, - fragmentShader: document.getElementById('particleFragmentShader').textContent, - }); - - const particles = new THREE.Points(geometry, material); - particles.matrixAutoUpdate = false; - particles.updateMatrix(); - - scene.add(particles); -} - -function fillTextures(texturePosition, textureVelocity) { - const posArray = texturePosition.image.data; - const velArray = textureVelocity.image.data; - - const radius = effectController.radius; - const height = effectController.height; - const exponent = effectController.exponent; - const maxMass = (effectController.maxMass * 1024) / PARTICLES; - const maxVel = effectController.velocity; - const velExponent = effectController.velocityExponent; - const randVel = effectController.randVelocity; - - for (let k = 0, kl = posArray.length; k < kl; k += 4) { - // Position - let x, z, rr; - - do { - x = Math.random() * 2 - 1; - z = Math.random() * 2 - 1; - rr = x * x + z * z; - } while (rr > 1); - - rr = Math.sqrt(rr); - - const rExp = radius * Math.pow(rr, exponent); - - // Velocity - const vel = maxVel * Math.pow(rr, velExponent); - - const vx = vel * z + (Math.random() * 2 - 1) * randVel; - const vy = (Math.random() * 2 - 1) * randVel * 0.05; - const vz = -vel * x + (Math.random() * 2 - 1) * randVel; - - x *= rExp; - z *= rExp; - const y = (Math.random() * 2 - 1) * height; - - const mass = Math.random() * maxMass + 1; - - // Fill in texture values - posArray[k + 0] = x; - posArray[k + 1] = y; - posArray[k + 2] = z; - posArray[k + 3] = 1; - - velArray[k + 0] = vx; - velArray[k + 1] = vy; - velArray[k + 2] = vz; - velArray[k + 3] = mass; - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - particleUniforms['cameraConstant'].value = getCameraConstant(camera); -} - -function dynamicValuesChanger() { - velocityUniforms['gravityConstant'].value = effectController.gravityConstant; - velocityUniforms['density'].value = effectController.density; - particleUniforms['density'].value = effectController.density; -} - -function initGUI() { - const gui = new GUI({ width: 280 }); - - const folder1 = gui.addFolder('Dynamic parameters'); - - folder1.add(effectController, 'gravityConstant', 0.0, 1000.0, 0.05).onChange(dynamicValuesChanger); - folder1.add(effectController, 'density', 0.0, 10.0, 0.001).onChange(dynamicValuesChanger); - - const folder2 = gui.addFolder('Static parameters'); - - folder2.add(effectController, 'radius', 10.0, 1000.0, 1.0); - folder2.add(effectController, 'height', 0.0, 50.0, 0.01); - folder2.add(effectController, 'exponent', 0.0, 2.0, 0.001); - folder2.add(effectController, 'maxMass', 1.0, 50.0, 0.1); - folder2.add(effectController, 'velocity', 0.0, 150.0, 0.1); - folder2.add(effectController, 'velocityExponent', 0.0, 1.0, 0.01); - folder2.add(effectController, 'randVelocity', 0.0, 50.0, 0.1); - - const buttonRestart = { - restartSimulation: function () { - restartSimulation(); - }, - }; - - folder2.add(buttonRestart, 'restartSimulation'); - - folder1.open(); - folder2.open(); -} - -function getCameraConstant(camera) { - return window.innerHeight / (Math.tan(THREE.MathUtils.DEG2RAD * 0.5 * camera.fov) / camera.zoom); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - gpuCompute.compute(); - - particleUniforms['texturePosition'].value = gpuCompute.getCurrentRenderTarget(positionVariable).texture; - particleUniforms['textureVelocity'].value = gpuCompute.getCurrentRenderTarget(velocityVariable).texture; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_gpgpu_water.ts b/examples-testing/examples/webgl_gpgpu_water.ts deleted file mode 100644 index 6474339cf..000000000 --- a/examples-testing/examples/webgl_gpgpu_water.ts +++ /dev/null @@ -1,574 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; -import { SimplexNoise } from 'three/addons/math/SimplexNoise.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -// Texture width for simulation -const WIDTH = 128; - -// Water size in system units -const BOUNDS = 6; -const BOUNDS_HALF = BOUNDS * 0.5; - -let tmpHeightmap = null; -const tmpQuat = new THREE.Quaternion(); -const tmpQuatX = new THREE.Quaternion(); -const tmpQuatZ = new THREE.Quaternion(); -let duckModel = null; - -let container, stats; -let camera, scene, renderer, controls; -let mousedown = false; -const mouseCoords = new THREE.Vector2(); -const raycaster = new THREE.Raycaster(); - -let sun; -let waterMesh; -let poolBorder; -let meshRay; -let gpuCompute; -let heightmapVariable; -// let smoothShader; -let readWaterLevelShader; -let readWaterLevelRenderTarget; -let readWaterLevelImage; -const waterNormal = new THREE.Vector3(); - -const NUM_DUCK = 12; -const ducks = []; -let ducksEnabled = true; - -const simplex = new SimplexNoise(); - -let frame = 0; - -const effectController = { - mouseSize: 0.2, - mouseDeep: 0.01, - viscosity: 0.93, - speed: 5, - ducksEnabled: ducksEnabled, - wireframe: false, - shadow: false, -}; - -init(); - -async function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(0, 2.0, 4); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - - sun = new THREE.SunLight(0xffffff, 4.0); - sun.position.set(-1, 2.6, 1.4); - scene.add(sun); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.5; - container.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, container); - - stats = new Stats(); - container.appendChild(stats.dom); - - container.style.touchAction = 'none'; - container.addEventListener('pointermove', onPointerMove); - container.addEventListener('pointerdown', onPointerDown); - container.addEventListener('pointerup', onPointerUp); - - window.addEventListener('resize', onWindowResize); - - const hdrLoader = new HDRLoader().setPath('./textures/equirectangular/'); - const glbloader = new GLTFLoader().setPath('models/gltf/'); - glbloader.setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)); - - const [env, model] = await Promise.all([ - hdrLoader.loadAsync('blouberg_sunrise_2_1k.hdr'), - glbloader.loadAsync('duck.glb'), - ]); - env.mapping = THREE.EquirectangularReflectionMapping; - scene.environment = env; - scene.background = env; - scene.backgroundBlurriness = 0.3; - scene.environmentIntensity = 1.25; - - duckModel = model.scene.children[0]; - duckModel.receiveShadow = true; - duckModel.castShadow = true; - - const gui = new GUI(); - gui.domElement.style.right = '0px'; - - const valuesChanger = function () { - heightmapVariable.material.uniforms['mouseSize'].value = effectController.mouseSize; - heightmapVariable.material.uniforms['deep'].value = effectController.mouseDeep; - heightmapVariable.material.uniforms['viscosity'].value = effectController.viscosity; - ducksEnabled = effectController.ducksEnabled; - - let i = NUM_DUCK; - while (i--) { - if (ducks[i]) ducks[i].visible = ducksEnabled; - } - }; - - gui.add(effectController, 'mouseSize', 0.1, 1.0, 0.1).onChange(valuesChanger); - gui.add(effectController, 'mouseDeep', 0.01, 1.0, 0.01).onChange(valuesChanger); - gui.add(effectController, 'viscosity', 0.9, 0.999, 0.001).onChange(valuesChanger); - gui.add(effectController, 'speed', 1, 6, 1); - gui.add(effectController, 'ducksEnabled').onChange(valuesChanger); - gui.add(effectController, 'wireframe').onChange(v => { - waterMesh.material.wireframe = v; - poolBorder.material.wireframe = v; - }); - gui.add(effectController, 'shadow').onChange(addShadow); - - //const buttonSmooth = { smoothWater: function () {smoothWater();} }; - //gui.add( buttonSmooth, 'smoothWater' ); - - initWater(); - - createducks(); - - valuesChanger(); - - renderer.setAnimationLoop(animate); -} - -function initWater() { - const geometry = new THREE.PlaneGeometry(BOUNDS, BOUNDS, WIDTH - 1, WIDTH - 1); - - const material = new WaterMaterial({ - color: 0x9bd2ec, - metalness: 0.9, - roughness: 0, - transparent: true, - opacity: 0.8, - side: THREE.DoubleSide, - }); - - waterMesh = new THREE.Mesh(geometry, material); - waterMesh.rotation.x = -Math.PI * 0.5; - waterMesh.matrixAutoUpdate = false; - waterMesh.updateMatrix(); - - waterMesh.receiveShadow = true; - waterMesh.castShadow = true; - - scene.add(waterMesh); - - // pool border - const borderGeom = new THREE.TorusGeometry(4.2, 0.1, 12, 4); - borderGeom.rotateX(Math.PI * 0.5); - borderGeom.rotateY(Math.PI * 0.25); - poolBorder = new THREE.Mesh(borderGeom, new THREE.MeshStandardMaterial({ color: 0x908877, roughness: 0.2 })); - scene.add(poolBorder); - poolBorder.receiveShadow = true; - poolBorder.castShadow = true; - - // THREE.Mesh just for mouse raycasting - const geometryRay = new THREE.PlaneGeometry(BOUNDS, BOUNDS, 1, 1); - meshRay = new THREE.Mesh(geometryRay, new THREE.MeshBasicMaterial({ color: 0xffffff, visible: false })); - meshRay.rotation.x = -Math.PI / 2; - meshRay.matrixAutoUpdate = false; - meshRay.updateMatrix(); - scene.add(meshRay); - - // Creates the gpu computation class and sets it up - - gpuCompute = new GPUComputationRenderer(WIDTH, WIDTH, renderer); - - const heightmap0 = gpuCompute.createTexture(); - - fillTexture(heightmap0); - - heightmapVariable = gpuCompute.addVariable('heightmap', shaderChange.heightmap_frag, heightmap0); - - gpuCompute.setVariableDependencies(heightmapVariable, [heightmapVariable]); - - heightmapVariable.material.uniforms['mousePos'] = { value: new THREE.Vector2(10000, 10000) }; - heightmapVariable.material.uniforms['mouseSize'] = { value: 0.2 }; - heightmapVariable.material.uniforms['viscosity'] = { value: 0.93 }; - heightmapVariable.material.uniforms['deep'] = { value: 0.01 }; - heightmapVariable.material.defines.BOUNDS = BOUNDS.toFixed(1); - - const error = gpuCompute.init(); - if (error !== null) console.error(error); - - // Create compute shader to smooth the water surface and velocity - //smoothShader = gpuCompute.createShaderMaterial( document.getElementById( 'smoothFragmentShader' ).textContent, { smoothTexture: { value: null } } ); - - // Create compute shader to read water level - readWaterLevelShader = gpuCompute.createShaderMaterial( - document.getElementById('readWaterLevelFragmentShader').textContent, - { - point1: { value: new THREE.Vector2() }, - levelTexture: { value: null }, - }, - ); - readWaterLevelShader.defines.WIDTH = WIDTH.toFixed(1); - readWaterLevelShader.defines.BOUNDS = BOUNDS.toFixed(1); - - // Create a 4x1 pixel image and a render target (Uint8, 4 channels, 1 byte per channel) to read water height and orientation - readWaterLevelImage = new Uint8Array(4 * 1 * 4); - - readWaterLevelRenderTarget = new THREE.WebGLRenderTarget(4, 1, { - wrapS: THREE.ClampToEdgeWrapping, - wrapT: THREE.ClampToEdgeWrapping, - minFilter: THREE.NearestFilter, - magFilter: THREE.NearestFilter, - format: THREE.RGBAFormat, - type: THREE.UnsignedByteType, - depthBuffer: false, - }); -} - -function fillTexture(texture) { - const waterMaxHeight = 0.1; - - function noise(x, y) { - let multR = waterMaxHeight; - let mult = 0.025; - let r = 0; - for (let i = 0; i < 15; i++) { - r += multR * simplex.noise(x * mult, y * mult); - multR *= 0.53 + 0.025 * i; - mult *= 1.25; - } - - return r; - } - - const pixels = texture.image.data; - - let p = 0; - for (let j = 0; j < WIDTH; j++) { - for (let i = 0; i < WIDTH; i++) { - const x = (i * 128) / WIDTH; - const y = (j * 128) / WIDTH; - - pixels[p + 0] = noise(x, y); - pixels[p + 1] = pixels[p + 0]; - pixels[p + 2] = 0; - pixels[p + 3] = 1; - - p += 4; - } - } -} - -function addShadow(v) { - renderer.shadowMap.enabled = v; - sun.castShadow = v; - - if (v) { - renderer.shadowMap.type = THREE.VSMShadowMap; - const shadow = sun.shadow; - shadow.radius = 2; - shadow.bias = -0.0005; - shadow.camera.far = 6; - } else { - if (sun.shadow) sun.shadow.dispose(); - } -} - -// function smoothWater() { - -// const currentRenderTarget = gpuCompute.getCurrentRenderTarget( heightmapVariable ); -// const alternateRenderTarget = gpuCompute.getAlternateRenderTarget( heightmapVariable ); - -// for ( let i = 0; i < 10; i ++ ) { - -// smoothShader.uniforms[ 'smoothTexture' ].value = currentRenderTarget.texture; -// gpuCompute.doRenderTarget( smoothShader, alternateRenderTarget ); - -// smoothShader.uniforms[ 'smoothTexture' ].value = alternateRenderTarget.texture; -// gpuCompute.doRenderTarget( smoothShader, currentRenderTarget ); - -// } - -// } - -function createducks() { - for (let i = 0; i < NUM_DUCK; i++) { - let sphere = duckModel; - if (i < NUM_DUCK - 1) { - sphere = duckModel.clone(); - } - - sphere.position.x = (Math.random() - 0.5) * BOUNDS * 0.7; - sphere.position.z = (Math.random() - 0.5) * BOUNDS * 0.7; - - sphere.userData.velocity = new THREE.Vector3(); - - scene.add(sphere); - - ducks[i] = sphere; - } -} - -function duckDynamics() { - readWaterLevelShader.uniforms['levelTexture'].value = tmpHeightmap; - - for (let i = 0; i < NUM_DUCK; i++) { - const sphere = ducks[i]; - - if (sphere) { - // Read water level and orientation - const u = (0.5 * sphere.position.x) / BOUNDS_HALF + 0.5; - const v = 1 - ((0.5 * sphere.position.z) / BOUNDS_HALF + 0.5); - readWaterLevelShader.uniforms['point1'].value.set(u, v); - gpuCompute.doRenderTarget(readWaterLevelShader, readWaterLevelRenderTarget); - - renderer.readRenderTargetPixels(readWaterLevelRenderTarget, 0, 0, 4, 1, readWaterLevelImage); - const pixels = new Float32Array(readWaterLevelImage.buffer); - - // Get orientation - waterNormal.set(pixels[1], 0, -pixels[2]); - - const pos = sphere.position; - - const startPos = pos.clone(); - - // Set height - pos.y = pixels[0]; - - // Move sphere - waterNormal.multiplyScalar(0.01); - sphere.userData.velocity.add(waterNormal); - sphere.userData.velocity.multiplyScalar(0.998); - pos.add(sphere.userData.velocity); - - const decal = 0.001; - const limit = BOUNDS_HALF - 0.2; - - if (pos.x < -limit) { - pos.x = -limit + decal; - sphere.userData.velocity.x *= -0.3; - } else if (pos.x > limit) { - pos.x = limit - decal; - sphere.userData.velocity.x *= -0.3; - } - - if (pos.z < -limit) { - pos.z = -limit + decal; - sphere.userData.velocity.z *= -0.3; - } else if (pos.z > limit) { - pos.z = limit - decal; - sphere.userData.velocity.z *= -0.3; - } - - // duck orientation test - - const startNormal = new THREE.Vector3(pixels[1], 1, -pixels[2]).normalize(); - - const dir = startPos.sub(pos); - dir.y = 0; - dir.normalize(); - - const yAxis = new THREE.Vector3(0, 1, 0); - const zAxis = new THREE.Vector3(0, 0, -1); - tmpQuatX.setFromUnitVectors(zAxis, dir); - tmpQuatZ.setFromUnitVectors(yAxis, startNormal); - tmpQuat.multiplyQuaternions(tmpQuatZ, tmpQuatX); - sphere.quaternion.slerp(tmpQuat, 0.017); - } - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerDown() { - mousedown = true; -} - -function onPointerUp() { - mousedown = false; - controls.enabled = true; -} - -function onPointerMove(event) { - const dom = renderer.domElement; - mouseCoords.set((event.clientX / dom.clientWidth) * 2 - 1, -(event.clientY / dom.clientHeight) * 2 + 1); -} - -function raycast() { - // Set uniforms: mouse interaction - const uniforms = heightmapVariable.material.uniforms; - if (mousedown) { - raycaster.setFromCamera(mouseCoords, camera); - - const intersects = raycaster.intersectObject(meshRay); - - if (intersects.length > 0) { - const point = intersects[0].point; - uniforms['mousePos'].value.set(point.x, point.z); - if (controls.enabled) controls.enabled = false; - } else { - uniforms['mousePos'].value.set(10000, 10000); - } - } else { - uniforms['mousePos'].value.set(10000, 10000); - } -} - -function animate() { - render(); - stats.update(); -} - -function render() { - raycast(); - - frame++; - - if (frame >= 7 - effectController.speed) { - // Do the gpu computation - gpuCompute.compute(); - tmpHeightmap = gpuCompute.getCurrentRenderTarget(heightmapVariable).texture; - - if (ducksEnabled) duckDynamics(); - - // Get compute output in custom uniform - if (waterMesh) waterMesh.material.heightmap = tmpHeightmap; - - frame = 0; - } - - // Render - renderer.render(scene, camera); -} - -//---------------------- - -class WaterMaterial extends THREE.MeshStandardMaterial { - constructor(parameters) { - super(); - - this.defines = { - STANDARD: '', - USE_UV: '', - WIDTH: WIDTH.toFixed(1), - BOUNDS: BOUNDS.toFixed(1), - }; - - this.extra = {}; - - this.addParameter('heightmap', null); - - this.setValues(parameters); - } - - addParameter(name, value) { - this.extra[name] = value; - Object.defineProperty(this, name, { - get: () => this.extra[name], - set: v => { - this.extra[name] = v; - if (this.userData.shader) this.userData.shader.uniforms[name].value = this.extra[name]; - }, - }); - } - - onBeforeCompile(shader) { - for (const name in this.extra) { - shader.uniforms[name] = { value: this.extra[name] }; - } - - shader.vertexShader = shader.vertexShader.replace('#include ', shaderChange.common); - //shader.vertexShader = 'uniform sampler2D heightmap;\n' + shader.vertexShader; - shader.vertexShader = shader.vertexShader.replace( - '#include ', - shaderChange.beginnormal_vertex, - ); - shader.vertexShader = shader.vertexShader.replace('#include ', shaderChange.begin_vertex); - - this.userData.shader = shader; - } -} - -const shaderChange = { - heightmap_frag: /* glsl */ ` - #include - - uniform vec2 mousePos; - uniform float mouseSize; - uniform float viscosity; - uniform float deep; - - void main() { - - vec2 cellSize = 1.0 / resolution.xy; - - vec2 uv = gl_FragCoord.xy * cellSize; - - // heightmapValue.x == height from previous frame - // heightmapValue.y == height from penultimate frame - // heightmapValue.z, heightmapValue.w not used - vec4 heightmapValue = texture2D( heightmap, uv ); - - // Get neighbours - vec4 north = texture2D( heightmap, uv + vec2( 0.0, cellSize.y ) ); - vec4 south = texture2D( heightmap, uv + vec2( 0.0, - cellSize.y ) ); - vec4 east = texture2D( heightmap, uv + vec2( cellSize.x, 0.0 ) ); - vec4 west = texture2D( heightmap, uv + vec2( - cellSize.x, 0.0 ) ); - - //float newHeight = ( ( north.x + south.x + east.x + west.x ) * 0.5 - heightmapValue.y ) * viscosity; - float newHeight = ( ( north.x + south.x + east.x + west.x ) * 0.5 - (heightmapValue.y) ) * viscosity; - - - // Mouse influence - float mousePhase = clamp( length( ( uv - vec2( 0.5 ) ) * BOUNDS - vec2( mousePos.x, - mousePos.y ) ) * PI / mouseSize, 0.0, PI ); - //newHeight += ( cos( mousePhase ) + 1.0 ) * 0.28 * 10.0; - newHeight -= ( cos( mousePhase ) + 1.0 ) * deep; - - heightmapValue.y = heightmapValue.x; - heightmapValue.x = newHeight; - - gl_FragColor = heightmapValue; - - } - `, - // FOR MATERIAL - common: /* glsl */ ` - #include - uniform sampler2D heightmap; - `, - beginnormal_vertex: /* glsl */ ` - vec2 cellSize = vec2( 1.0 / WIDTH, 1.0 / WIDTH ); - vec3 objectNormal = vec3( - ( texture2D( heightmap, uv + vec2( - cellSize.x, 0 ) ).x - texture2D( heightmap, uv + vec2( cellSize.x, 0 ) ).x ) * WIDTH / BOUNDS, - ( texture2D( heightmap, uv + vec2( 0, - cellSize.y ) ).x - texture2D( heightmap, uv + vec2( 0, cellSize.y ) ).x ) * WIDTH / BOUNDS, - 1.0 ); - #ifdef USE_TANGENT - vec3 objectTangent = vec3( tangent.xyz ); - #endif - `, - begin_vertex: /* glsl */ ` - float heightValue = texture2D( heightmap, uv ).x; - vec3 transformed = vec3( position.x, position.y, heightValue ); - #ifdef USE_ALPHAHASH - vPosition = vec3( position ); - #endif - `, -}; diff --git a/examples-testing/examples/webgl_helpers.ts b/examples-testing/examples/webgl_helpers.ts deleted file mode 100644 index a8c3b9773..000000000 --- a/examples-testing/examples/webgl_helpers.ts +++ /dev/null @@ -1,117 +0,0 @@ -import * as THREE from 'three'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { VertexNormalsHelper } from 'three/addons/helpers/VertexNormalsHelper.js'; -import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js'; - -let scene, renderer; -let camera, light; -let vnh; -let vth; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 400; - - scene = new THREE.Scene(); - - light = new THREE.PointLight(); - light.position.set(200, 100, 150); - scene.add(light); - - scene.add(new THREE.PointLightHelper(light, 15)); - - const gridHelper = new THREE.GridHelper(400, 40, 0x0000ff, 0x808080); - gridHelper.position.y = -150; - gridHelper.position.x = -150; - scene.add(gridHelper); - - const polarGridHelper = new THREE.PolarGridHelper(200, 16, 8, 64, 0x0000ff, 0x808080); - polarGridHelper.position.y = -150; - polarGridHelper.position.x = 200; - scene.add(polarGridHelper); - - const loader = new GLTFLoader(); - loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - - mesh.geometry.computeTangents(); // generates bad data due to degenerate UVs - - const group = new THREE.Group(); - group.scale.multiplyScalar(50); - scene.add(group); - - // To make sure that the matrixWorld is up to date for the boxhelpers - group.updateMatrixWorld(true); - - group.add(mesh); - - vnh = new VertexNormalsHelper(mesh, 5); - scene.add(vnh); - - vth = new VertexTangentsHelper(mesh, 5); - scene.add(vth); - - scene.add(new THREE.BoxHelper(mesh)); - - const wireframe = new THREE.WireframeGeometry(mesh.geometry); - let line = new THREE.LineSegments(wireframe); - line.material.depthTest = false; - line.material.opacity = 0.25; - line.material.transparent = true; - line.position.x = 4; - group.add(line); - scene.add(new THREE.BoxHelper(line)); - - const edges = new THREE.EdgesGeometry(mesh.geometry); - line = new THREE.LineSegments(edges); - line.material.depthTest = false; - line.material.opacity = 0.25; - line.material.transparent = true; - line.position.x = -4; - group.add(line); - scene.add(new THREE.BoxHelper(line)); - - scene.add(new THREE.BoxHelper(group)); - scene.add(new THREE.BoxHelper(scene)); - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = -performance.now() * 0.0003; - - camera.position.x = 400 * Math.cos(time); - camera.position.z = 400 * Math.sin(time); - camera.lookAt(scene.position); - - light.position.x = Math.sin(time * 1.7) * 300; - light.position.y = Math.cos(time * 1.5) * 400; - light.position.z = Math.cos(time * 1.3) * 300; - - if (vnh) vnh.update(); - if (vth) vth.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_instancing_dynamic.ts b/examples-testing/examples/webgl_instancing_dynamic.ts deleted file mode 100644 index bc4a88662..000000000 --- a/examples-testing/examples/webgl_instancing_dynamic.ts +++ /dev/null @@ -1,175 +0,0 @@ -import * as THREE from 'three'; - -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import TWEEN from 'three/addons/libs/tween.module.js'; - -let camera, scene, renderer, timer, mesh; - -const amount = 100; - -const count = Math.pow(amount, 2); -const dummy = new THREE.Object3D(); - -const seeds = []; -const baseColors = []; - -const color = new THREE.Color(); -const colors = [new THREE.Color(0x00ffff), new THREE.Color(0xffff00), new THREE.Color(0xff00ff)]; -const animation = { t: 0 }; -let currentColorIndex = 0; -let nextColorIndex = 1; - -const maxDistance = 75; -const cameraTarget = new THREE.Vector3(); - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(10, 10, 10); - camera.lookAt(0, 0, 0); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xadd8e6); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - - timer = new THREE.Timer(); - timer.connect(document); - - const loader = new THREE.TextureLoader(); - const texture = loader.load('textures/edge3.jpg'); - texture.colorSpace = THREE.SRGBColorSpace; - - const geometry = new THREE.BoxGeometry(); - const material = new THREE.MeshStandardMaterial({ map: texture }); - - mesh = new THREE.InstancedMesh(geometry, material, count); - mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); // will be updated every frame - scene.add(mesh); - - let i = 0; - const offset = (amount - 1) / 2; - - for (let x = 0; x < amount; x++) { - for (let z = 0; z < amount; z++) { - dummy.position.set(offset - x, 0, offset - z); - dummy.scale.set(1, 2, 1); - - dummy.updateMatrix(); - - color.setHSL(1, 0.5 + Math.random() * 0.5, 0.5 + Math.random() * 0.5); - baseColors.push(color.getHex()); - - mesh.setMatrixAt(i, dummy.matrix); - mesh.setColorAt(i, color.multiply(colors[0])); - - i++; - - seeds.push(Math.random()); - } - } - - // - - window.addEventListener('resize', onWindowResize); - - setInterval(startTween, 3000); -} - -function startTween() { - // tween for animating color transition - - new TWEEN.Tween(animation) - .to( - { - t: 1, - }, - 2000, - ) - .easing(TWEEN.Easing.Sinusoidal.In) - .onComplete(() => { - animation.t = 0; - - currentColorIndex = nextColorIndex; - nextColorIndex++; - - if (nextColorIndex >= colors.length) nextColorIndex = 0; - }) - .start(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const time = timer.getElapsed(); - - TWEEN.update(); - - // animate camera - - camera.position.x = Math.sin(time / 4) * 10; - camera.position.z = Math.cos(time / 4) * 10; - camera.position.y = 8 + Math.cos(time / 2) * 2; - - cameraTarget.x = Math.sin(time / 4) * -8; - cameraTarget.z = Math.cos(time / 2) * -8; - - camera.lookAt(cameraTarget); - - camera.up.x = Math.sin(time / 400); - - // animate instance positions and colors - - for (let i = 0; i < mesh.count; i++) { - mesh.getMatrixAt(i, dummy.matrix); - dummy.matrix.decompose(dummy.position, dummy.quaternion, dummy.scale); - - dummy.position.y = Math.abs(Math.sin((time + seeds[i]) * 2 + seeds[i])); - - dummy.updateMatrix(); - - mesh.setMatrixAt(i, dummy.matrix); - - // colors - - if (animation.t > 0) { - const currentColor = colors[currentColorIndex]; - const nextColor = colors[nextColorIndex]; - - const f = dummy.position.length() / maxDistance; - - if (f <= animation.t) { - color.set(baseColors[i]).multiply(nextColor); - } else { - color.set(baseColors[i]).multiply(currentColor); - } - - mesh.setColorAt(i, color); - } - } - - mesh.instanceMatrix.needsUpdate = true; - if (animation.t > 0) mesh.instanceColor.needsUpdate = true; - - mesh.computeBoundingSphere(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_instancing_morph.ts b/examples-testing/examples/webgl_instancing_morph.ts deleted file mode 100644 index fd3e66786..000000000 --- a/examples-testing/examples/webgl_instancing_morph.ts +++ /dev/null @@ -1,143 +0,0 @@ -import * as THREE from 'three'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats, mesh, mixer, dummy; - -const offset = 5000; - -const timeOffsets = new Float32Array(1024); - -for (let i = 0; i < 1024; i++) { - timeOffsets[i] = Math.random() * 3; -} - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 100, 10000); - - scene = new THREE.Scene(); - - scene.background = new THREE.Color(0x99ddff); - - scene.fog = new THREE.Fog(0x99ddff, 5000, 10000); - - const light = new THREE.SunLight(0xffffff, 2); - - light.position.set(200, 1000, 50); - - light.castShadow = true; - - light.shadow.camera.far = 10000; - - light.shadow.mapSize.setScalar(2048); - - scene.add(light); - - const hemi = new THREE.HemisphereLight(0x99ddff, 0x669933, 0.5); - - scene.add(hemi); - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(1000000, 1000000), - new THREE.MeshStandardMaterial({ color: 0x669933, depthWrite: true }), - ); - - ground.rotation.x = -Math.PI / 2; - - ground.receiveShadow = true; - - scene.add(ground); - - const loader = new GLTFLoader(); - - loader.load('models/gltf/Horse.glb', function (glb) { - dummy = glb.scene.children[0]; - - mesh = new THREE.InstancedMesh(dummy.geometry, dummy.material, 1024); - - mesh.castShadow = true; - - for (let x = 0, i = 0; x < 32; x++) { - for (let y = 0; y < 32; y++) { - dummy.position.set(offset - 300 * x + 200 * Math.random(), 0, offset - 300 * y); - - dummy.updateMatrix(); - - mesh.setMatrixAt(i, dummy.matrix); - - mesh.setColorAt(i, new THREE.Color(`hsl(${Math.random() * 360}, 50%, 66%)`)); - - i++; - } - } - - scene.add(mesh); - - mixer = new THREE.AnimationMixer(glb.scene); - - const action = mixer.clipAction(glb.animations[0]); - - action.play(); - }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - renderer.shadowMap.enabled = true; - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - render(); - - stats.update(); -} - -function render() { - const time = timer.getElapsed(); - - const r = 3000; - camera.position.set(Math.sin(time / 10) * r, 1500 + 1000 * Math.cos(time / 5), Math.cos(time / 10) * r); - camera.lookAt(0, 0, 0); - - if (mesh) { - for (let i = 0; i < 1024; i++) { - mixer.setTime(time + timeOffsets[i]); - - mesh.setMorphAt(i, dummy); - } - - mesh.morphTexture.needsUpdate = true; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_instancing_performance.ts b/examples-testing/examples/webgl_instancing_performance.ts deleted file mode 100644 index bf1deabad..000000000 --- a/examples-testing/examples/webgl_instancing_performance.ts +++ /dev/null @@ -1,262 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -let container, stats, gui, guiStatsEl; -let camera, controls, scene, renderer, material; - -// gui - -const Method = { - INSTANCED: 'INSTANCED', - MERGED: 'MERGED', - NAIVE: 'NAIVE', -}; - -const api = { - method: Method.INSTANCED, - count: 1000, -}; - -// - -init(); -initMesh(); - -// - -function clean() { - const meshes = []; - - scene.traverse(function (object) { - if (object.isMesh) meshes.push(object); - }); - - for (let i = 0; i < meshes.length; i++) { - const mesh = meshes[i]; - mesh.material.dispose(); - mesh.geometry.dispose(); - - scene.remove(mesh); - } -} - -const randomizeMatrix = (function () { - const position = new THREE.Vector3(); - const quaternion = new THREE.Quaternion(); - const scale = new THREE.Vector3(); - - return function (matrix) { - position.x = Math.random() * 40 - 20; - position.y = Math.random() * 40 - 20; - position.z = Math.random() * 40 - 20; - - quaternion.random(); - - scale.x = scale.y = scale.z = Math.random() * 1; - - matrix.compose(position, quaternion, scale); - }; -})(); - -function initMesh() { - clean(); - - // make instances - new THREE.BufferGeometryLoader().setPath('models/json/').load('suzanne_buffergeometry.json', function (geometry) { - material = new THREE.MeshNormalMaterial(); - - geometry.computeVertexNormals(); - - console.time(api.method + ' (build)'); - - switch (api.method) { - case Method.INSTANCED: - makeInstanced(geometry); - break; - - case Method.MERGED: - makeMerged(geometry); - break; - - case Method.NAIVE: - makeNaive(geometry); - break; - } - - console.timeEnd(api.method + ' (build)'); - }); -} - -function makeInstanced(geometry) { - const matrix = new THREE.Matrix4(); - const mesh = new THREE.InstancedMesh(geometry, material, api.count); - - for (let i = 0; i < api.count; i++) { - randomizeMatrix(matrix); - mesh.setMatrixAt(i, matrix); - } - - scene.add(mesh); - - // - - const geometryByteLength = getGeometryByteLength(geometry); - - guiStatsEl.innerHTML = [ - 'GPU draw calls: 1', - 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), - ].join('
'); -} - -function makeMerged(geometry) { - const geometries = []; - const matrix = new THREE.Matrix4(); - - for (let i = 0; i < api.count; i++) { - randomizeMatrix(matrix); - - const instanceGeometry = geometry.clone(); - instanceGeometry.applyMatrix4(matrix); - - geometries.push(instanceGeometry); - } - - const mergedGeometry = BufferGeometryUtils.mergeGeometries(geometries); - - scene.add(new THREE.Mesh(mergedGeometry, material)); - - // - - guiStatsEl.innerHTML = [ - 'GPU draw calls: 1', - 'GPU memory: ' + formatBytes(getGeometryByteLength(mergedGeometry), 2), - ].join('
'); -} - -function makeNaive(geometry) { - const matrix = new THREE.Matrix4(); - - for (let i = 0; i < api.count; i++) { - randomizeMatrix(matrix); - - const mesh = new THREE.Mesh(geometry, material); - mesh.applyMatrix4(matrix); - - scene.add(mesh); - } - - // - - const geometryByteLength = getGeometryByteLength(geometry); - - guiStatsEl.innerHTML = [ - 'GPU draw calls: ' + api.count, - 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), - ].join('
'); -} - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - - // camera - - camera = new THREE.PerspectiveCamera(70, width / height, 1, 100); - camera.position.z = 30; - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - - // stats - - stats = new Stats(); - container.appendChild(stats.dom); - - // gui - - gui = new GUI(); - gui.add(api, 'method', Method).onChange(initMesh); - gui.add(api, 'count', 1, 10000).step(1).onChange(initMesh); - - const perfFolder = gui.addFolder('Performance'); - - guiStatsEl = document.createElement('div'); - guiStatsEl.classList.add('gui-stats'); - - perfFolder.$children.appendChild(guiStatsEl); - perfFolder.open(); - - // listeners - - window.addEventListener('resize', onWindowResize); - - Object.assign(window, { scene }); -} - -// - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); - - stats.update(); -} - -// - -function getGeometryByteLength(geometry) { - let total = 0; - - if (geometry.index) total += geometry.index.array.byteLength; - - for (const name in geometry.attributes) { - total += geometry.attributes[name].array.byteLength; - } - - return total; -} - -// Source: https://stackoverflow.com/a/18650828/1314762 -function formatBytes(bytes, decimals) { - if (bytes === 0) return '0 bytes'; - - const k = 1024; - const dm = decimals < 0 ? 0 : decimals; - const sizes = ['bytes', 'KB', 'MB']; - - const i = Math.floor(Math.log(bytes) / Math.log(k)); - - return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; -} diff --git a/examples-testing/examples/webgl_instancing_raycast.ts b/examples-testing/examples/webgl_instancing_raycast.ts deleted file mode 100644 index 371ea070b..000000000 --- a/examples-testing/examples/webgl_instancing_raycast.ts +++ /dev/null @@ -1,116 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, controls, stats; - -let mesh; -const amount = parseInt(window.location.search.slice(1)) || 10; -const count = Math.pow(amount, 3); - -const raycaster = new THREE.Raycaster(); -const mouse = new THREE.Vector2(1, 1); - -const color = new THREE.Color(); -const white = new THREE.Color().setHex(0xffffff); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(amount, amount, amount); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - - const light = new THREE.HemisphereLight(0xffffff, 0x888888, 3); - light.position.set(0, 1, 0); - scene.add(light); - - const geometry = new THREE.IcosahedronGeometry(0.5, 3); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff }); - - mesh = new THREE.InstancedMesh(geometry, material, count); - - let i = 0; - const offset = (amount - 1) / 2; - - const matrix = new THREE.Matrix4(); - - for (let x = 0; x < amount; x++) { - for (let y = 0; y < amount; y++) { - for (let z = 0; z < amount; z++) { - matrix.setPosition(offset - x, offset - y, offset - z); - - mesh.setMatrixAt(i, matrix); - mesh.setColorAt(i, color); - - i++; - } - } - } - - scene.add(mesh); - - // - - const gui = new GUI(); - gui.add(mesh, 'count', 0, count); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.enableZoom = false; - controls.enablePan = false; - - stats = new Stats(); - document.body.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); - document.addEventListener('mousemove', onMouseMove); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onMouseMove(event) { - event.preventDefault(); - - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -function animate() { - controls.update(); - - raycaster.setFromCamera(mouse, camera); - - const intersection = raycaster.intersectObject(mesh); - - if (intersection.length > 0) { - const instanceId = intersection[0].instanceId; - - mesh.getColorAt(instanceId, color); - - if (color.equals(white)) { - mesh.setColorAt(instanceId, color.setHex(Math.random() * 0xffffff)); - - mesh.instanceColor.needsUpdate = true; - } - } - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_instancing_scatter.ts b/examples-testing/examples/webgl_instancing_scatter.ts deleted file mode 100644 index fc3b9cc9f..000000000 --- a/examples-testing/examples/webgl_instancing_scatter.ts +++ /dev/null @@ -1,257 +0,0 @@ -import * as THREE from 'three'; - -import { MeshSurfaceSampler } from 'three/addons/math/MeshSurfaceSampler.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, stats; - -const api = { - count: 2000, - distribution: 'random', - resample: resample, - surfaceColor: 0xfff784, - backgroundColor: 0xe39469, -}; - -let stemMesh, blossomMesh; -let stemGeometry, blossomGeometry; -let stemMaterial, blossomMaterial; - -let sampler; -const count = api.count; -const ages = new Float32Array(count); -const scales = new Float32Array(count); -const dummy = new THREE.Object3D(); - -const _position = new THREE.Vector3(); -const _normal = new THREE.Vector3(); -const _scale = new THREE.Vector3(); - -// let surfaceGeometry = new THREE.BoxGeometry( 10, 10, 10 ).toNonIndexed(); -const surfaceGeometry = new THREE.TorusKnotGeometry(10, 3, 100, 16).toNonIndexed(); -const surfaceMaterial = new THREE.MeshLambertMaterial({ color: api.surfaceColor, wireframe: false }); -const surface = new THREE.Mesh(surfaceGeometry, surfaceMaterial); - -// Source: https://gist.github.com/gre/1650294 -const easeOutCubic = function (t) { - return --t * t * t + 1; -}; - -// Scaling curve causes particles to grow quickly, ease gradually into full scale, then -// disappear quickly. More of the particle's lifetime is spent around full scale. -const scaleCurve = function (t) { - return Math.abs(easeOutCubic((t > 0.5 ? 1 - t : t) * 2)); -}; - -const loader = new GLTFLoader(); - -loader.load('./models/gltf/Flower/Flower.glb', function (gltf) { - const _stemMesh = gltf.scene.getObjectByName('Stem'); - const _blossomMesh = gltf.scene.getObjectByName('Blossom'); - - stemGeometry = _stemMesh.geometry.clone(); - blossomGeometry = _blossomMesh.geometry.clone(); - - const defaultTransform = new THREE.Matrix4() - .makeRotationX(Math.PI) - .multiply(new THREE.Matrix4().makeScale(7, 7, 7)); - - stemGeometry.applyMatrix4(defaultTransform); - blossomGeometry.applyMatrix4(defaultTransform); - - stemMaterial = _stemMesh.material; - blossomMaterial = _blossomMesh.material; - - stemMesh = new THREE.InstancedMesh(stemGeometry, stemMaterial, count); - blossomMesh = new THREE.InstancedMesh(blossomGeometry, blossomMaterial, count); - - // Assign random colors to the blossoms. - const color = new THREE.Color(); - const blossomPalette = [0xf20587, 0xf2d479, 0xf2c879, 0xf2b077, 0xf24405]; - - for (let i = 0; i < count; i++) { - color.setHex(blossomPalette[Math.floor(Math.random() * blossomPalette.length)]); - blossomMesh.setColorAt(i, color); - } - - // Instance matrices will be updated every frame. - stemMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); - blossomMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); - - resample(); - - init(); -}); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(25, 25, 25); - camera.lookAt(0, 0, 0); - - // - - scene = new THREE.Scene(); - scene.background = new THREE.Color(api.backgroundColor); - - const pointLight = new THREE.PointLight(0xaa8899, 2.5, 0, 0); - pointLight.position.set(50, -25, 75); - scene.add(pointLight); - - scene.add(new THREE.AmbientLight(0xffffff, 3)); - - // - - scene.add(stemMesh); - scene.add(blossomMesh); - - scene.add(surface); - - // - - const gui = new GUI(); - gui.add(api, 'count', 0, count).onChange(function () { - stemMesh.count = api.count; - blossomMesh.count = api.count; - }); - - // gui.addColor( api, 'backgroundColor' ).onChange( function () { - - // scene.background.setHex( api.backgroundColor ); - - // } ); - - // gui.addColor( api, 'surfaceColor' ).onChange( function () { - - // surfaceMaterial.color.setHex( api.surfaceColor ); - - // } ); - - gui.add(api, 'distribution').options(['random', 'weighted']).onChange(resample); - gui.add(api, 'resample'); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function resample() { - const vertexCount = surface.geometry.getAttribute('position').count; - - console.info('Sampling ' + count + ' points from a surface with ' + vertexCount + ' vertices...'); - - // - - console.time('.build()'); - - sampler = new MeshSurfaceSampler(surface).setWeightAttribute(api.distribution === 'weighted' ? 'uv' : null).build(); - - console.timeEnd('.build()'); - - // - - console.time('.sample()'); - - for (let i = 0; i < count; i++) { - ages[i] = Math.random(); - scales[i] = scaleCurve(ages[i]); - - resampleParticle(i); - } - - console.timeEnd('.sample()'); - - stemMesh.instanceMatrix.needsUpdate = true; - blossomMesh.instanceMatrix.needsUpdate = true; -} - -function resampleParticle(i) { - sampler.sample(_position, _normal); - _normal.add(_position); - - dummy.position.copy(_position); - dummy.scale.set(scales[i], scales[i], scales[i]); - dummy.lookAt(_normal); - dummy.updateMatrix(); - - stemMesh.setMatrixAt(i, dummy.matrix); - blossomMesh.setMatrixAt(i, dummy.matrix); -} - -function updateParticle(i) { - // Update lifecycle. - - ages[i] += 0.005; - - if (ages[i] >= 1) { - ages[i] = 0.001; - scales[i] = scaleCurve(ages[i]); - - resampleParticle(i); - - return; - } - - // Update scale. - - const prevScale = scales[i]; - scales[i] = scaleCurve(ages[i]); - _scale.set(scales[i] / prevScale, scales[i] / prevScale, scales[i] / prevScale); - - // Update transform. - - stemMesh.getMatrixAt(i, dummy.matrix); - dummy.matrix.scale(_scale); - stemMesh.setMatrixAt(i, dummy.matrix); - blossomMesh.setMatrixAt(i, dummy.matrix); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - render(); - - stats.update(); -} - -function render() { - if (stemMesh && blossomMesh) { - const time = Date.now() * 0.001; - - scene.rotation.x = Math.sin(time / 4); - scene.rotation.y = Math.sin(time / 2); - - for (let i = 0; i < api.count; i++) { - updateParticle(i); - } - - stemMesh.instanceMatrix.needsUpdate = true; - blossomMesh.instanceMatrix.needsUpdate = true; - - stemMesh.computeBoundingSphere(); - blossomMesh.computeBoundingSphere(); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_buffergeometry.ts b/examples-testing/examples/webgl_interactive_buffergeometry.ts deleted file mode 100644 index 1d6608b13..000000000 --- a/examples-testing/examples/webgl_interactive_buffergeometry.ts +++ /dev/null @@ -1,244 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let camera, scene, renderer; - -let raycaster, pointer; - -let mesh, line; - -init(); - -function init() { - container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 3500); - camera.position.z = 2750; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - scene.fog = new THREE.Fog(0x050505, 2000, 3500); - - // - - scene.add(new THREE.AmbientLight(0x444444, 3)); - - const light1 = new THREE.DirectionalLight(0xffffff, 1.5); - light1.position.set(1, 1, 1); - scene.add(light1); - - const light2 = new THREE.DirectionalLight(0xffffff, 4.5); - light2.position.set(0, -1, 0); - scene.add(light2); - - // - - const triangles = 5000; - - let geometry = new THREE.BufferGeometry(); - - const positions = new Float32Array(triangles * 3 * 3); - const normals = new Float32Array(triangles * 3 * 3); - const colors = new Float32Array(triangles * 3 * 3); - - const color = new THREE.Color(); - - const n = 800, - n2 = n / 2; // triangles spread in the cube - const d = 120, - d2 = d / 2; // individual triangle size - - const pA = new THREE.Vector3(); - const pB = new THREE.Vector3(); - const pC = new THREE.Vector3(); - - const cb = new THREE.Vector3(); - const ab = new THREE.Vector3(); - - for (let i = 0; i < positions.length; i += 9) { - // positions - - const x = Math.random() * n - n2; - const y = Math.random() * n - n2; - const z = Math.random() * n - n2; - - const ax = x + Math.random() * d - d2; - const ay = y + Math.random() * d - d2; - const az = z + Math.random() * d - d2; - - const bx = x + Math.random() * d - d2; - const by = y + Math.random() * d - d2; - const bz = z + Math.random() * d - d2; - - const cx = x + Math.random() * d - d2; - const cy = y + Math.random() * d - d2; - const cz = z + Math.random() * d - d2; - - positions[i] = ax; - positions[i + 1] = ay; - positions[i + 2] = az; - - positions[i + 3] = bx; - positions[i + 4] = by; - positions[i + 5] = bz; - - positions[i + 6] = cx; - positions[i + 7] = cy; - positions[i + 8] = cz; - - // flat face normals - - pA.set(ax, ay, az); - pB.set(bx, by, bz); - pC.set(cx, cy, cz); - - cb.subVectors(pC, pB); - ab.subVectors(pA, pB); - cb.cross(ab); - - cb.normalize(); - - const nx = cb.x; - const ny = cb.y; - const nz = cb.z; - - normals[i] = nx; - normals[i + 1] = ny; - normals[i + 2] = nz; - - normals[i + 3] = nx; - normals[i + 4] = ny; - normals[i + 5] = nz; - - normals[i + 6] = nx; - normals[i + 7] = ny; - normals[i + 8] = nz; - - // colors - - const vx = x / n + 0.5; - const vy = y / n + 0.5; - const vz = z / n + 0.5; - - color.setRGB(vx, vy, vz); - - colors[i] = color.r; - colors[i + 1] = color.g; - colors[i + 2] = color.b; - - colors[i + 3] = color.r; - colors[i + 4] = color.g; - colors[i + 5] = color.b; - - colors[i + 6] = color.r; - colors[i + 7] = color.g; - colors[i + 8] = color.b; - } - - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - geometry.setAttribute('normal', new THREE.BufferAttribute(normals, 3)); - geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3)); - - geometry.computeBoundingSphere(); - - let material = new THREE.MeshPhongMaterial({ - color: 0xaaaaaa, - specular: 0xffffff, - shininess: 250, - side: THREE.DoubleSide, - vertexColors: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - raycaster = new THREE.Raycaster(); - - pointer = new THREE.Vector2(); - - geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(4 * 3), 3)); - - material = new THREE.LineBasicMaterial({ color: 0xffffff, transparent: true }); - - line = new THREE.Line(geometry, material); - scene.add(line); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); - document.addEventListener('pointermove', onPointerMove); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.001; - - mesh.rotation.x = time * 0.15; - mesh.rotation.y = time * 0.25; - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObject(mesh); - - if (intersects.length > 0) { - const intersect = intersects[0]; - const face = intersect.face; - - const linePosition = line.geometry.attributes.position; - const meshPosition = mesh.geometry.attributes.position; - - linePosition.copyAt(0, meshPosition, face.a); - linePosition.copyAt(1, meshPosition, face.b); - linePosition.copyAt(2, meshPosition, face.c); - linePosition.copyAt(3, meshPosition, face.a); - - mesh.updateMatrix(); - - line.geometry.applyMatrix4(mesh.matrix); - - line.visible = true; - } else { - line.visible = false; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_cubes.ts b/examples-testing/examples/webgl_interactive_cubes.ts deleted file mode 100644 index adfcfddf8..000000000 --- a/examples-testing/examples/webgl_interactive_cubes.ts +++ /dev/null @@ -1,114 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let stats; -let camera, scene, raycaster, renderer; - -let INTERSECTED; -let theta = 0; - -const pointer = new THREE.Vector2(); -const radius = 5; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1).normalize(); - scene.add(light); - - const geometry = new THREE.BoxGeometry(); - - for (let i = 0; i < 2000; i++) { - const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); - - object.position.x = Math.random() * 40 - 20; - object.position.y = Math.random() * 40 - 20; - object.position.z = Math.random() * 40 - 20; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.x = Math.random() + 0.5; - object.scale.y = Math.random() + 0.5; - object.scale.z = Math.random() + 0.5; - - scene.add(object); - } - - raycaster = new THREE.Raycaster(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - document.addEventListener('mousemove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - theta += 0.1; - - camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); - camera.position.y = radius * Math.sin(THREE.MathUtils.degToRad(theta)); - camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); - camera.lookAt(scene.position); - - camera.updateMatrixWorld(); - - // find intersections - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObjects(scene.children, false); - - if (intersects.length > 0) { - if (INTERSECTED != intersects[0].object) { - if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); - - INTERSECTED = intersects[0].object; - INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex(); - INTERSECTED.material.emissive.setHex(0xff0000); - } - } else { - if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); - - INTERSECTED = null; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_cubes_gpu.ts b/examples-testing/examples/webgl_interactive_cubes_gpu.ts deleted file mode 100644 index 5b19d2085..000000000 --- a/examples-testing/examples/webgl_interactive_cubes_gpu.ts +++ /dev/null @@ -1,231 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -let container, stats; -let camera, controls, scene, renderer; -let pickingTexture, pickingScene; -let highlightBox; - -const pickingData = []; - -const pointer = new THREE.Vector2(); -const offset = new THREE.Vector3(10, 10, 10); -const clearColor = new THREE.Color(); - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 500, 2000); - scene.add(light); - - const defaultMaterial = new THREE.MeshPhongMaterial({ - color: 0xffffff, - flatShading: true, - vertexColors: true, - shininess: 0, - }); - - // set up the picking texture to use a 32 bit integer so we can write and read integer ids from it - pickingScene = new THREE.Scene(); - pickingTexture = new THREE.WebGLRenderTarget(1, 1, { - type: THREE.IntType, - format: THREE.RGBAIntegerFormat, - internalFormat: 'RGBA32I', - }); - const pickingMaterial = new THREE.ShaderMaterial({ - glslVersion: THREE.GLSL3, - - vertexShader: /* glsl */ ` - attribute int id; - flat varying int vid; - void main() { - - vid = id; - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); - - } - `, - - fragmentShader: /* glsl */ ` - layout(location = 0) out int out_id; - flat varying int vid; - - void main() { - - out_id = vid; - - } - `, - }); - - function applyId(geometry, id) { - const position = geometry.attributes.position; - const array = new Int16Array(position.count); - array.fill(id); - - const bufferAttribute = new THREE.Int16BufferAttribute(array, 1, false); - bufferAttribute.gpuType = THREE.IntType; - geometry.setAttribute('id', bufferAttribute); - } - - function applyVertexColors(geometry, color) { - const position = geometry.attributes.position; - const colors = []; - - for (let i = 0; i < position.count; i++) { - colors.push(color.r, color.g, color.b); - } - - geometry.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - } - - const geometries = []; - const matrix = new THREE.Matrix4(); - const quaternion = new THREE.Quaternion(); - const color = new THREE.Color(); - - for (let i = 0; i < 5000; i++) { - const geometry = new THREE.BoxGeometry(); - - const position = new THREE.Vector3(); - position.x = Math.random() * 10000 - 5000; - position.y = Math.random() * 6000 - 3000; - position.z = Math.random() * 8000 - 4000; - - const rotation = new THREE.Euler(); - rotation.x = Math.random() * 2 * Math.PI; - rotation.y = Math.random() * 2 * Math.PI; - rotation.z = Math.random() * 2 * Math.PI; - - const scale = new THREE.Vector3(); - scale.x = Math.random() * 200 + 100; - scale.y = Math.random() * 200 + 100; - scale.z = Math.random() * 200 + 100; - - quaternion.setFromEuler(rotation); - matrix.compose(position, quaternion, scale); - - geometry.applyMatrix4(matrix); - - // give the geometry's vertices a random color to be displayed and an integer - // identifier as a vertex attribute so boxes can be identified after being merged. - applyVertexColors(geometry, color.setHex(Math.random() * 0xffffff)); - applyId(geometry, i); - - geometries.push(geometry); - - pickingData[i] = { - position: position, - rotation: rotation, - scale: scale, - }; - } - - const mergedGeometry = BufferGeometryUtils.mergeGeometries(geometries); - scene.add(new THREE.Mesh(mergedGeometry, defaultMaterial)); - pickingScene.add(new THREE.Mesh(mergedGeometry, pickingMaterial)); - - highlightBox = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshLambertMaterial({ color: 0xffff00 })); - scene.add(highlightBox); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - controls = new TrackballControls(camera, renderer.domElement); - controls.rotateSpeed = 1.0; - controls.zoomSpeed = 1.2; - controls.panSpeed = 0.8; - controls.noZoom = false; - controls.noPan = false; - controls.staticMoving = true; - controls.dynamicDampingFactor = 0.3; - - stats = new Stats(); - container.appendChild(stats.dom); - - renderer.domElement.addEventListener('pointermove', onPointerMove); -} - -// - -function onPointerMove(e) { - pointer.x = e.clientX; - pointer.y = e.clientY; -} - -function animate() { - render(); - stats.update(); -} - -function pick() { - // render the picking scene off-screen - // set the view offset to represent just a single pixel under the mouse - const dpr = window.devicePixelRatio; - camera.setViewOffset( - renderer.domElement.width, - renderer.domElement.height, - Math.floor(pointer.x * dpr), - Math.floor(pointer.y * dpr), - 1, - 1, - ); - - // render the scene - renderer.setRenderTarget(pickingTexture); - - // clear the background to - 1 meaning no item was hit - clearColor.setRGB(-1, -1, -1); - renderer.setClearColor(clearColor); - renderer.render(pickingScene, camera); - - // Restore active render target to canvas - renderer.setRenderTarget(null); - - // clear the view offset so rendering returns to normal - camera.clearViewOffset(); - - // create buffer for reading single pixel - const pixelBuffer = new Int32Array(4); - - // read the pixel - renderer.readRenderTargetPixelsAsync(pickingTexture, 0, 0, 1, 1, pixelBuffer).then(() => { - const id = pixelBuffer[0]; - if (id !== -1) { - // move our highlightBox so that it surrounds the picked object - const data = pickingData[id]; - highlightBox.position.copy(data.position); - highlightBox.rotation.copy(data.rotation); - highlightBox.scale.copy(data.scale).add(offset); - highlightBox.visible = true; - } else { - highlightBox.visible = false; - } - }); -} - -function render() { - controls.update(); - - pick(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_cubes_ortho.ts b/examples-testing/examples/webgl_interactive_cubes_ortho.ts deleted file mode 100644 index 520674b5f..000000000 --- a/examples-testing/examples/webgl_interactive_cubes_ortho.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let stats; -let camera, scene, raycaster, renderer; - -let theta = 0; -let INTERSECTED; - -const pointer = new THREE.Vector2(); -const radius = 25; -const frustumSize = 50; - -init(); - -function init() { - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera( - (frustumSize * aspect) / -2, - (frustumSize * aspect) / 2, - frustumSize / 2, - frustumSize / -2, - 0.1, - 100, - ); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1).normalize(); - scene.add(light); - - const geometry = new THREE.BoxGeometry(); - - for (let i = 0; i < 2000; i++) { - const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); - - object.position.x = Math.random() * 40 - 20; - object.position.y = Math.random() * 40 - 20; - object.position.z = Math.random() * 40 - 20; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.x = Math.random() + 0.5; - object.scale.y = Math.random() + 0.5; - object.scale.z = Math.random() + 0.5; - - scene.add(object); - } - - raycaster = new THREE.Raycaster(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - document.addEventListener('pointermove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const aspect = window.innerWidth / window.innerHeight; - - camera.left = (-frustumSize * aspect) / 2; - camera.right = (frustumSize * aspect) / 2; - camera.top = frustumSize / 2; - camera.bottom = -frustumSize / 2; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - theta += 0.1; - - camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); - camera.position.y = radius * Math.sin(THREE.MathUtils.degToRad(theta)); - camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); - camera.lookAt(scene.position); - - camera.updateMatrixWorld(); - - // find intersections - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObjects(scene.children, false); - - if (intersects.length > 0) { - if (INTERSECTED != intersects[0].object) { - if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); - - INTERSECTED = intersects[0].object; - INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex(); - INTERSECTED.material.emissive.setHex(0xff0000); - } - } else { - if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); - - INTERSECTED = null; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_lines.ts b/examples-testing/examples/webgl_interactive_lines.ts deleted file mode 100644 index f81ad5b5f..000000000 --- a/examples-testing/examples/webgl_interactive_lines.ts +++ /dev/null @@ -1,151 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; -let camera, scene, raycaster, renderer, parentTransform, sphereInter; - -const pointer = new THREE.Vector2(); -const radius = 100; -let theta = 0; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 10000); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - const geometry = new THREE.SphereGeometry(5); - const material = new THREE.MeshBasicMaterial({ color: 0xff0000 }); - - sphereInter = new THREE.Mesh(geometry, material); - sphereInter.visible = false; - scene.add(sphereInter); - - const lineGeometry = new THREE.BufferGeometry(); - const points = []; - - const point = new THREE.Vector3(); - const direction = new THREE.Vector3(); - - for (let i = 0; i < 50; i++) { - direction.x += Math.random() - 0.5; - direction.y += Math.random() - 0.5; - direction.z += Math.random() - 0.5; - direction.normalize().multiplyScalar(10); - - point.add(direction); - points.push(point.x, point.y, point.z); - } - - lineGeometry.setAttribute('position', new THREE.Float32BufferAttribute(points, 3)); - - parentTransform = new THREE.Object3D(); - parentTransform.position.x = Math.random() * 40 - 20; - parentTransform.position.y = Math.random() * 40 - 20; - parentTransform.position.z = Math.random() * 40 - 20; - - parentTransform.rotation.x = Math.random() * 2 * Math.PI; - parentTransform.rotation.y = Math.random() * 2 * Math.PI; - parentTransform.rotation.z = Math.random() * 2 * Math.PI; - - parentTransform.scale.x = Math.random() + 0.5; - parentTransform.scale.y = Math.random() + 0.5; - parentTransform.scale.z = Math.random() + 0.5; - - for (let i = 0; i < 50; i++) { - let object; - - const lineMaterial = new THREE.LineBasicMaterial({ color: Math.random() * 0xffffff }); - - if (Math.random() > 0.5) { - object = new THREE.Line(lineGeometry, lineMaterial); - } else { - object = new THREE.LineSegments(lineGeometry, lineMaterial); - } - - object.position.x = Math.random() * 400 - 200; - object.position.y = Math.random() * 400 - 200; - object.position.z = Math.random() * 400 - 200; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.x = Math.random() + 0.5; - object.scale.y = Math.random() + 0.5; - object.scale.z = Math.random() + 0.5; - - parentTransform.add(object); - } - - scene.add(parentTransform); - - raycaster = new THREE.Raycaster(); - raycaster.params.Line.threshold = 3; - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - document.addEventListener('pointermove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - theta += 0.1; - - camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); - camera.position.y = radius * Math.sin(THREE.MathUtils.degToRad(theta)); - camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); - camera.lookAt(scene.position); - - camera.updateMatrixWorld(); - - // find intersections - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObjects(parentTransform.children, true); - - if (intersects.length > 0) { - sphereInter.visible = true; - sphereInter.position.copy(intersects[0].point); - } else { - sphereInter.visible = false; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_points.ts b/examples-testing/examples/webgl_interactive_points.ts deleted file mode 100644 index b6be0df05..000000000 --- a/examples-testing/examples/webgl_interactive_points.ts +++ /dev/null @@ -1,143 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -let renderer, scene, camera, stats; - -let particles; - -const PARTICLE_SIZE = 20; - -let raycaster, intersects; -let pointer, INTERSECTED; - -init(); - -function init() { - const container = document.getElementById('container'); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 250; - - // - - let boxGeometry = new THREE.BoxGeometry(200, 200, 200, 16, 16, 16); - - // if normal and uv attributes are not removed, mergeVertices() can't consolidate identical vertices with different normal/uv data - - boxGeometry.deleteAttribute('normal'); - boxGeometry.deleteAttribute('uv'); - - boxGeometry = BufferGeometryUtils.mergeVertices(boxGeometry); - - // - - const positionAttribute = boxGeometry.getAttribute('position'); - - const colors = []; - const sizes = []; - - const color = new THREE.Color(); - - for (let i = 0, l = positionAttribute.count; i < l; i++) { - color.setHSL(0.01 + 0.1 * (i / l), 1.0, 0.5); - color.toArray(colors, i * 3); - - sizes[i] = PARTICLE_SIZE * 0.5; - } - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', positionAttribute); - geometry.setAttribute('customColor', new THREE.Float32BufferAttribute(colors, 3)); - geometry.setAttribute('size', new THREE.Float32BufferAttribute(sizes, 1)); - - // - - const material = new THREE.ShaderMaterial({ - uniforms: { - color: { value: new THREE.Color(0xffffff) }, - pointTexture: { value: new THREE.TextureLoader().load('textures/sprites/disc.png') }, - alphaTest: { value: 0.9 }, - }, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - }); - - // - - particles = new THREE.Points(geometry, material); - scene.add(particles); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - raycaster = new THREE.Raycaster(); - pointer = new THREE.Vector2(); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); - document.addEventListener('pointermove', onPointerMove); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - particles.rotation.x += 0.0005; - particles.rotation.y += 0.001; - - const geometry = particles.geometry; - const attributes = geometry.attributes; - - raycaster.setFromCamera(pointer, camera); - - intersects = raycaster.intersectObject(particles); - - if (intersects.length > 0) { - if (INTERSECTED != intersects[0].index) { - attributes.size.array[INTERSECTED] = PARTICLE_SIZE; - - INTERSECTED = intersects[0].index; - - attributes.size.array[INTERSECTED] = PARTICLE_SIZE * 1.25; - attributes.size.needsUpdate = true; - } - } else if (INTERSECTED !== null) { - attributes.size.array[INTERSECTED] = PARTICLE_SIZE; - attributes.size.needsUpdate = true; - INTERSECTED = null; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_raycasting_points.ts b/examples-testing/examples/webgl_interactive_raycasting_points.ts deleted file mode 100644 index 50b8d1e1d..000000000 --- a/examples-testing/examples/webgl_interactive_raycasting_points.ts +++ /dev/null @@ -1,223 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let renderer, scene, camera, stats; -let pointclouds; -let raycaster; -let intersection = null; -let spheresIndex = 0; -let timer; -let toggle = 0; - -const pointer = new THREE.Vector2(); -const spheres = []; - -const threshold = 0.1; -const pointSize = 0.05; -const width = 80; -const length = 160; -const rotateY = new THREE.Matrix4().makeRotationY(0.005); - -init(); - -function generatePointCloudGeometry(color, width, length) { - const geometry = new THREE.BufferGeometry(); - const numPoints = width * length; - - const positions = new Float32Array(numPoints * 3); - const colors = new Float32Array(numPoints * 3); - - let k = 0; - - for (let i = 0; i < width; i++) { - for (let j = 0; j < length; j++) { - const u = i / width; - const v = j / length; - const x = u - 0.5; - const y = (Math.cos(u * Math.PI * 4) + Math.sin(v * Math.PI * 8)) / 20; - const z = v - 0.5; - - positions[3 * k] = x; - positions[3 * k + 1] = y; - positions[3 * k + 2] = z; - - const intensity = (y + 0.1) * 5; - colors[3 * k] = color.r * intensity; - colors[3 * k + 1] = color.g * intensity; - colors[3 * k + 2] = color.b * intensity; - - k++; - } - } - - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3)); - geometry.computeBoundingBox(); - - return geometry; -} - -function generatePointcloud(color, width, length) { - const geometry = generatePointCloudGeometry(color, width, length); - const material = new THREE.PointsMaterial({ size: pointSize, vertexColors: true }); - - return new THREE.Points(geometry, material); -} - -function generateIndexedPointcloud(color, width, length) { - const geometry = generatePointCloudGeometry(color, width, length); - const numPoints = width * length; - const indices = new Uint16Array(numPoints); - - let k = 0; - - for (let i = 0; i < width; i++) { - for (let j = 0; j < length; j++) { - indices[k] = k; - k++; - } - } - - geometry.setIndex(new THREE.BufferAttribute(indices, 1)); - - const material = new THREE.PointsMaterial({ size: pointSize, vertexColors: true }); - - return new THREE.Points(geometry, material); -} - -function generateIndexedWithOffsetPointcloud(color, width, length) { - const geometry = generatePointCloudGeometry(color, width, length); - const numPoints = width * length; - const indices = new Uint16Array(numPoints); - - let k = 0; - - for (let i = 0; i < width; i++) { - for (let j = 0; j < length; j++) { - indices[k] = k; - k++; - } - } - - geometry.setIndex(new THREE.BufferAttribute(indices, 1)); - geometry.addGroup(0, indices.length); - - const material = new THREE.PointsMaterial({ size: pointSize, vertexColors: true }); - - return new THREE.Points(geometry, material); -} - -function init() { - const container = document.getElementById('container'); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(10, 10, 10); - camera.lookAt(scene.position); - camera.updateMatrix(); - - // - - const pcBuffer = generatePointcloud(new THREE.Color(1, 0, 0), width, length); - pcBuffer.scale.set(5, 10, 10); - pcBuffer.position.set(-5, 0, 0); - scene.add(pcBuffer); - - const pcIndexed = generateIndexedPointcloud(new THREE.Color(0, 1, 0), width, length); - pcIndexed.scale.set(5, 10, 10); - pcIndexed.position.set(0, 0, 0); - scene.add(pcIndexed); - - const pcIndexedOffset = generateIndexedWithOffsetPointcloud(new THREE.Color(0, 1, 1), width, length); - pcIndexedOffset.scale.set(5, 10, 10); - pcIndexedOffset.position.set(5, 0, 0); - scene.add(pcIndexedOffset); - - pointclouds = [pcBuffer, pcIndexed, pcIndexedOffset]; - - // - - const sphereGeometry = new THREE.SphereGeometry(0.1, 32, 32); - const sphereMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 }); - - for (let i = 0; i < 40; i++) { - const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); - scene.add(sphere); - spheres.push(sphere); - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - raycaster = new THREE.Raycaster(); - raycaster.params.Points.threshold = threshold; - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); - document.addEventListener('pointermove', onPointerMove); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - camera.applyMatrix4(rotateY); - camera.updateMatrixWorld(); - - raycaster.setFromCamera(pointer, camera); - - const intersections = raycaster.intersectObjects(pointclouds, false); - intersection = intersections.length > 0 ? intersections[0] : null; - - if (toggle > 0.02 && intersection !== null) { - spheres[spheresIndex].position.copy(intersection.point); - spheres[spheresIndex].scale.set(1, 1, 1); - spheresIndex = (spheresIndex + 1) % spheres.length; - - toggle = 0; - } - - for (let i = 0; i < spheres.length; i++) { - const sphere = spheres[i]; - sphere.scale.multiplyScalar(0.98); - sphere.scale.clampScalar(0.01, 1); - } - - toggle += timer.getDelta(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_interactive_voxelpainter.ts b/examples-testing/examples/webgl_interactive_voxelpainter.ts deleted file mode 100644 index 48b16f3b7..000000000 --- a/examples-testing/examples/webgl_interactive_voxelpainter.ts +++ /dev/null @@ -1,158 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; -let plane; -let pointer, - raycaster, - isShiftDown = false; - -let rollOverMesh, rollOverMaterial; -let cubeGeo, cubeMaterial; - -const objects = []; - -init(); -render(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(500, 800, 1300); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - // roll-over helpers - - const rollOverGeo = new THREE.BoxGeometry(50, 50, 50); - rollOverMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, opacity: 0.5, transparent: true }); - rollOverMesh = new THREE.Mesh(rollOverGeo, rollOverMaterial); - scene.add(rollOverMesh); - - // cubes - - const map = new THREE.TextureLoader().load('textures/square-outline-textured.png'); - map.colorSpace = THREE.SRGBColorSpace; - cubeGeo = new THREE.BoxGeometry(50, 50, 50); - cubeMaterial = new THREE.MeshLambertMaterial({ color: 0xfeb74c, map: map }); - - // grid - - const gridHelper = new THREE.GridHelper(1000, 20); - scene.add(gridHelper); - - // - - raycaster = new THREE.Raycaster(); - pointer = new THREE.Vector2(); - - const geometry = new THREE.PlaneGeometry(1000, 1000); - geometry.rotateX(-Math.PI / 2); - - plane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ visible: false })); - scene.add(plane); - - objects.push(plane); - - // lights - - const ambientLight = new THREE.AmbientLight(0x606060, 3); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 3); - directionalLight.position.set(1, 0.75, 0.5).normalize(); - scene.add(directionalLight); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerdown', onPointerDown); - document.addEventListener('keydown', onDocumentKeyDown); - document.addEventListener('keyup', onDocumentKeyUp); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function onPointerMove(event) { - pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObjects(objects, false); - - if (intersects.length > 0) { - const intersect = intersects[0]; - - rollOverMesh.position.copy(intersect.point).add(intersect.face.normal); - rollOverMesh.position.divideScalar(50).floor().multiplyScalar(50).addScalar(25); - - render(); - } -} - -function onPointerDown(event) { - pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObjects(objects, false); - - if (intersects.length > 0) { - const intersect = intersects[0]; - - // delete cube - - if (isShiftDown) { - if (intersect.object !== plane) { - scene.remove(intersect.object); - - objects.splice(objects.indexOf(intersect.object), 1); - } - - // create cube - } else { - const voxel = new THREE.Mesh(cubeGeo, cubeMaterial); - voxel.position.copy(intersect.point).add(intersect.face.normal); - voxel.position.divideScalar(50).floor().multiplyScalar(50).addScalar(25); - scene.add(voxel); - - objects.push(voxel); - } - - render(); - } -} - -function onDocumentKeyDown(event) { - switch (event.keyCode) { - case 16: - isShiftDown = true; - break; - } -} - -function onDocumentKeyUp(event) { - switch (event.keyCode) { - case 16: - isShiftDown = false; - break; - } -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lensflares.ts b/examples-testing/examples/webgl_lensflares.ts deleted file mode 100644 index 0a55bec42..000000000 --- a/examples-testing/examples/webgl_lensflares.ts +++ /dev/null @@ -1,140 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { FlyControls } from 'three/addons/controls/FlyControls.js'; -import { Lensflare, LensflareElement } from 'three/addons/objects/Lensflare.js'; - -let container, stats; - -let camera, scene, renderer; -let controls; - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // camera - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 15000); - camera.position.z = 250; - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color().setHSL(0.51, 0.4, 0.01, THREE.SRGBColorSpace); - scene.fog = new THREE.Fog(scene.background, 3500, 15000); - - // world - - const s = 250; - - const geometry = new THREE.BoxGeometry(s, s, s); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff, specular: 0xffffff, shininess: 50 }); - - for (let i = 0; i < 3000; i++) { - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = 8000 * (2.0 * Math.random() - 1.0); - mesh.position.y = 8000 * (2.0 * Math.random() - 1.0); - mesh.position.z = 8000 * (2.0 * Math.random() - 1.0); - - mesh.rotation.x = Math.random() * Math.PI; - mesh.rotation.y = Math.random() * Math.PI; - mesh.rotation.z = Math.random() * Math.PI; - - mesh.matrixAutoUpdate = false; - mesh.updateMatrix(); - - scene.add(mesh); - } - - // lights - - const dirLight = new THREE.DirectionalLight(0xffffff, 0.15); - dirLight.position.set(0, -1, 0).normalize(); - dirLight.color.setHSL(0.1, 0.7, 0.5); - scene.add(dirLight); - - // lensflares - const textureLoader = new THREE.TextureLoader(); - - const textureFlare0 = textureLoader.load('textures/lensflare/lensflare0.png'); - const textureFlare3 = textureLoader.load('textures/lensflare/lensflare3.png'); - - addLight(0.55, 0.9, 0.5, 5000, 0, -1000); - addLight(0.08, 0.8, 0.5, 0, 0, -1000); - addLight(0.995, 0.5, 0.9, 5000, 5000, -1000); - - function addLight(h, s, l, x, y, z) { - const light = new THREE.PointLight(0xffffff, 1.5, 2000, 0); - light.color.setHSL(h, s, l); - light.position.set(x, y, z); - scene.add(light); - - const lensflare = new Lensflare(); - lensflare.addElement(new LensflareElement(textureFlare0, 700, 0, light.color)); - lensflare.addElement(new LensflareElement(textureFlare3, 60, 0.6)); - lensflare.addElement(new LensflareElement(textureFlare3, 70, 0.7)); - lensflare.addElement(new LensflareElement(textureFlare3, 120, 0.9)); - lensflare.addElement(new LensflareElement(textureFlare3, 70, 1)); - light.add(lensflare); - } - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - controls = new FlyControls(camera, renderer.domElement); - - controls.movementSpeed = 2500; - controls.domElement = container; - controls.rollSpeed = Math.PI / 6; - controls.autoForward = false; - controls.dragToLook = false; - - // stats - - stats = new Stats(); - container.appendChild(stats.dom); - - // events - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -// - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - const delta = timer.getDelta(); - - controls.update(delta); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lightprobe.ts b/examples-testing/examples/webgl_lightprobe.ts deleted file mode 100644 index 58f021e6d..000000000 --- a/examples-testing/examples/webgl_lightprobe.ts +++ /dev/null @@ -1,142 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; - -import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; - -let mesh, renderer, scene, camera; - -let gui; - -let lightProbe; -let directionalLight; - -// linear color space -const API = { - lightProbeIntensity: 1.0, - directionalLightIntensity: 0.6, - envMapIntensity: 1, -}; - -init(); - -function init() { - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - // tone mapping - renderer.toneMapping = THREE.NoToneMapping; - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 30); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.minDistance = 10; - controls.maxDistance = 50; - controls.enablePan = false; - - // probe - lightProbe = new THREE.LightProbe(); - scene.add(lightProbe); - - // light - directionalLight = new THREE.DirectionalLight(0xffffff, API.directionalLightIntensity); - directionalLight.position.set(10, 10, 10); - scene.add(directionalLight); - - // envmap - const genCubeUrls = function (prefix, postfix) { - return [ - prefix + 'px' + postfix, - prefix + 'nx' + postfix, - prefix + 'py' + postfix, - prefix + 'ny' + postfix, - prefix + 'pz' + postfix, - prefix + 'nz' + postfix, - ]; - }; - - const urls = genCubeUrls('textures/cube/pisa/', '.png'); - - new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { - scene.background = cubeTexture; - - lightProbe.copy(LightProbeGenerator.fromCubeTexture(cubeTexture)); - lightProbe.intensity = API.lightProbeIntensity; - lightProbe.position.set(-10, 0, 0); // position not used in scene lighting calculations (helper honors the position, however) - - const geometry = new THREE.SphereGeometry(5, 64, 32); - //const geometry = new THREE.TorusKnotGeometry( 4, 1.5, 256, 32, 2, 3 ); - - const material = new THREE.MeshStandardMaterial({ - color: 0xffffff, - metalness: 0, - roughness: 0, - envMap: cubeTexture, - envMapIntensity: API.envMapIntensity, - }); - - // mesh - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // helper - const helper = new LightProbeHelper(lightProbe, 1); - scene.add(helper); - - render(); - }); - - // gui - gui = new GUI({ title: 'Intensity' }); - - gui.add(API, 'lightProbeIntensity', 0, 1, 0.02) - .name('light probe') - .onChange(function () { - lightProbe.intensity = API.lightProbeIntensity; - render(); - }); - - gui.add(API, 'directionalLightIntensity', 0, 1, 0.02) - .name('directional light') - .onChange(function () { - directionalLight.intensity = API.directionalLightIntensity; - render(); - }); - - gui.add(API, 'envMapIntensity', 0, 1, 0.02) - .name('envMap') - .onChange(function () { - mesh.material.envMapIntensity = API.envMapIntensity; - render(); - }); - - // listener - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lightprobe_cubecamera.ts b/examples-testing/examples/webgl_lightprobe_cubecamera.ts deleted file mode 100644 index 65425d4e7..000000000 --- a/examples-testing/examples/webgl_lightprobe_cubecamera.ts +++ /dev/null @@ -1,85 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; -import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; - -let renderer, scene, camera, cubeCamera; - -let lightProbe; - -init(); - -function init() { - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 30); - - const cubeRenderTarget = new THREE.WebGLCubeRenderTarget(256); - - cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.minDistance = 10; - controls.maxDistance = 50; - controls.enablePan = false; - - // probe - lightProbe = new THREE.LightProbe(); - scene.add(lightProbe); - - // envmap - const genCubeUrls = function (prefix, postfix) { - return [ - prefix + 'px' + postfix, - prefix + 'nx' + postfix, - prefix + 'py' + postfix, - prefix + 'ny' + postfix, - prefix + 'pz' + postfix, - prefix + 'nz' + postfix, - ]; - }; - - const urls = genCubeUrls('textures/cube/pisa/', '.png'); - - new THREE.CubeTextureLoader().load(urls, async function (cubeTexture) { - scene.background = cubeTexture; - - cubeCamera.update(renderer, scene); - - const probe = await LightProbeGenerator.fromCubeRenderTarget(renderer, cubeRenderTarget); - - lightProbe.copy(probe); - - scene.add(new LightProbeHelper(lightProbe, 5)); - - render(); - }); - - // listener - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lightprobes.ts b/examples-testing/examples/webgl_lightprobes.ts deleted file mode 100644 index 1018f47a7..000000000 --- a/examples-testing/examples/webgl_lightprobes.ts +++ /dev/null @@ -1,190 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; -import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; - -let camera, scene, renderer, controls; -let probes, probesHelper; - -init(); - -async function init() { - // Camera - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 2.5, 8); - - // Scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x111111); - - // Cornell box - - const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc }); - const redMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 }); - const greenMaterial = new THREE.MeshStandardMaterial({ color: 0x00ff00 }); - - // Floor - const floor = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); - floor.rotation.x = -Math.PI / 2; - floor.receiveShadow = true; - scene.add(floor); - - // Ceiling - const ceiling = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); - ceiling.rotation.x = Math.PI / 2; - ceiling.position.y = 5; - ceiling.receiveShadow = true; - scene.add(ceiling); - - // Back wall - const backWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); - backWall.position.set(0, 2.5, -3); - backWall.receiveShadow = true; - scene.add(backWall); - - // Front wall - const frontWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); - frontWall.rotation.y = Math.PI; - frontWall.position.set(0, 2.5, 3); - frontWall.receiveShadow = true; - scene.add(frontWall); - - // Left wall (red) - const leftWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), redMaterial); - leftWall.rotation.y = Math.PI / 2; - leftWall.position.set(-3, 2.5, 0); - leftWall.receiveShadow = true; - scene.add(leftWall); - - // Right wall (green) - const rightWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), greenMaterial); - rightWall.rotation.y = -Math.PI / 2; - rightWall.position.set(3, 2.5, 0); - rightWall.receiveShadow = true; - scene.add(rightWall); - - // Objects inside the box - - const objectMaterial = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); - - // Tall box - const tallBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 2.5, 1.2), objectMaterial); - tallBox.position.set(-0.8, 1.25, -0.8); - tallBox.rotation.y = Math.PI / 8; - tallBox.castShadow = true; - tallBox.receiveShadow = true; - scene.add(tallBox); - - // Short box - const shortBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 1.2, 1.2), objectMaterial); - shortBox.position.set(1, 0.6, 0.5); - shortBox.rotation.y = -Math.PI / 6; - shortBox.castShadow = true; - shortBox.receiveShadow = true; - scene.add(shortBox); - - // Sphere (to show smooth GI variation) - const sphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 32, 32), objectMaterial.clone()); - sphere.position.set(1, 1.9, 0.5); - sphere.castShadow = true; - sphere.receiveShadow = true; - scene.add(sphere); - - // Light - const light = new THREE.PointLight(0xffffff, 40); - light.position.set(0, 4.5, 0); - light.castShadow = true; - light.shadow.mapSize.setScalar(256); - light.shadow.radius = 10; - light.shadow.normalBias = -0.02; - scene.add(light); - - // Renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.0; - document.body.appendChild(renderer.domElement); - - // Controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2.5, 0); - controls.update(); - - // Bake light probe volume - - async function bake(resolution) { - if (probes) { - scene.remove(probes); - probes.dispose(); - } - - probes = new LightProbeGridWebGL(5.6, 4.7, 5.6, resolution, resolution, resolution); - probes.position.set(0, 2.45, 0); - probes.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); - probes.visible = params.enabled; - scene.add(probes); - - // Update debug visualization - - if (!probesHelper) { - probesHelper = new LightProbeGridHelperWebGL(probes); - probesHelper.visible = params.showProbes; - scene.add(probesHelper); - } else { - probesHelper.probes = probes; - probesHelper.update(); - } - } - - const params = { - enabled: true, - showProbes: false, - resolution: 6, - }; - - await bake(params.resolution); - - // GUI - - const gui = new GUI(); - gui.add(params, 'enabled') - .name('GI') - .onChange(value => { - probes.visible = value; - }); - gui.add(params, 'resolution', 2, 12, 1) - .name('Resolution') - .onFinishChange(value => { - bake(value); - }); - gui.add(params, 'showProbes') - .name('Show Probes') - .onChange(value => { - probesHelper.visible = value; - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lightprobes_complex.ts b/examples-testing/examples/webgl_lightprobes_complex.ts deleted file mode 100644 index e15a909c3..000000000 --- a/examples-testing/examples/webgl_lightprobes_complex.ts +++ /dev/null @@ -1,304 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; -import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; - -let camera, scene, renderer, controls; -let probesLeft, probesRight; -let probesHelperLeft, probesHelperRight; - -init(); - -async function init() { - // Camera - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 2.5, 16); - - // Scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x111111); - - // Materials - - const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc, side: THREE.BackSide }); - const whiteMat = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); - - // Room shell: x=-8 to 8, z=-4 to 4, y=0 to 5 - - const room = new THREE.Mesh(new THREE.BoxGeometry(16, 5, 8), wallMaterial); - room.position.set(0, 2.5, 0); - room.receiveShadow = true; - scene.add(room); - - const redWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0xdd2200 })); - redWall.rotation.y = Math.PI / 2; - redWall.position.set(-7.99, 2.5, 0); - scene.add(redWall); - - const blueWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0x0044ff })); - blueWall.rotation.y = -Math.PI / 2; - blueWall.position.set(7.99, 2.5, 0); - scene.add(blueWall); - - // Dividing wall at x=0 with doorway - - const dividerMat = new THREE.MeshStandardMaterial({ color: 0xcccccc }); - const doorwayHalfGap = 1.25; - - // Left section of divider (z = -4 to -1.25) - const dividerLeft = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); - dividerLeft.position.set(0, 2.5, -(doorwayHalfGap + (4 - doorwayHalfGap) / 2)); - dividerLeft.castShadow = true; - dividerLeft.receiveShadow = true; - scene.add(dividerLeft); - - // Right section of divider (z = 1.25 to 4) - const dividerRight = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); - dividerRight.position.set(0, 2.5, doorwayHalfGap + (4 - doorwayHalfGap) / 2); - dividerRight.castShadow = true; - dividerRight.receiveShadow = true; - scene.add(dividerRight); - - // Lintel above doorway - const lintel = new THREE.Mesh(new THREE.BoxGeometry(0.3, 1.2, doorwayHalfGap * 2), dividerMat); - lintel.position.set(0, 4.4, 0); - lintel.castShadow = true; - lintel.receiveShadow = true; - scene.add(lintel); - - // Left room objects - - // Columns - const columnGeom = new THREE.CylinderGeometry(0.3, 0.3, 4, 16); - - for (const x of [-6, -2]) { - for (const z of [-2.5, 2.5]) { - const col = new THREE.Mesh(columnGeom, whiteMat); - col.position.set(x, 2, z); - col.castShadow = true; - col.receiveShadow = true; - scene.add(col); - } - } - - // Table with golden sphere - const tableTop = new THREE.Mesh( - new THREE.BoxGeometry(2.4, 0.12, 1.4), - new THREE.MeshStandardMaterial({ color: 0x886644 }), - ); - tableTop.position.set(-4, 1.0, 0); - tableTop.castShadow = true; - tableTop.receiveShadow = true; - scene.add(tableTop); - - const legGeom = new THREE.BoxGeometry(0.1, 1, 0.1); - - for (const x of [-5.05, -2.95]) { - for (const z of [-0.55, 0.55]) { - const leg = new THREE.Mesh(legGeom, tableTop.material); - leg.position.set(x, 0.5, z); - leg.castShadow = true; - scene.add(leg); - } - } - - const sphere = new THREE.Mesh( - new THREE.SphereGeometry(0.35, 32, 32), - new THREE.MeshStandardMaterial({ color: 0xffd700, metalness: 0.3, roughness: 0.4 }), - ); - sphere.position.set(-4, 1.41, 0); - sphere.castShadow = true; - sphere.receiveShadow = true; - scene.add(sphere); - - // Stepped blocks near red wall - const step1 = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.5, 1), whiteMat); - step1.position.set(-7, 0.25, 0); - step1.castShadow = true; - step1.receiveShadow = true; - scene.add(step1); - - const step2 = new THREE.Mesh(new THREE.BoxGeometry(1.0, 1.0, 1), whiteMat); - step2.position.set(-7, 0.5, 0); - step2.castShadow = true; - step2.receiveShadow = true; - scene.add(step2); - - const step3 = new THREE.Mesh(new THREE.BoxGeometry(0.5, 1.5, 1), whiteMat); - step3.position.set(-7, 0.75, 0); - step3.castShadow = true; - step3.receiveShadow = true; - scene.add(step3); - - // Right room objects - - // Columns - for (const x of [2, 6]) { - for (const z of [-2.5, 2.5]) { - const col = new THREE.Mesh(columnGeom, whiteMat); - col.position.set(x, 2, z); - col.castShadow = true; - col.receiveShadow = true; - scene.add(col); - } - } - - // Pedestal with torus knot - const pedestal = new THREE.Mesh(new THREE.BoxGeometry(0.8, 1.2, 0.8), whiteMat); - pedestal.position.set(4, 0.6, 0); - pedestal.castShadow = true; - pedestal.receiveShadow = true; - scene.add(pedestal); - - const torusKnot = new THREE.Mesh( - new THREE.TorusKnotGeometry(0.3, 0.1, 64, 16), - new THREE.MeshStandardMaterial({ color: 0xff44aa, metalness: 0.2, roughness: 0.5 }), - ); - torusKnot.position.set(4, 1.65, 0); - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - // Tall cone sculpture - const sculpture = new THREE.Mesh(new THREE.ConeGeometry(0.4, 2.5, 5), whiteMat); - sculpture.position.set(6.5, 1.25, -1.5); - sculpture.castShadow = true; - sculpture.receiveShadow = true; - scene.add(sculpture); - - // Lights - - // Warm point light in left room - const warmLight = new THREE.PointLight(0xffaa44, 30); - warmLight.position.set(-4, 4.5, 0); - warmLight.castShadow = true; - warmLight.shadow.mapSize.setScalar(256); - warmLight.shadow.radius = 12; - warmLight.shadow.bias = -0.002; - scene.add(warmLight); - - // Cool point light in right room - const coolLight = new THREE.PointLight(0x88bbff, 30); - coolLight.position.set(4, 4.5, 0); - coolLight.castShadow = true; - coolLight.shadow.mapSize.setScalar(256); - coolLight.shadow.radius = 12; - coolLight.shadow.bias = -0.002; - scene.add(coolLight); - - // Renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.0; - document.body.appendChild(renderer.domElement); - - // Controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2.5, 0); - controls.update(); - - // Probe volumes - - const params = { - enabled: true, - showProbes: false, - resolution: 6, - }; - - async function bake(resolution) { - // Remove both volumes before baking to prevent feedback - - if (probesLeft) { - scene.remove(probesLeft); - probesLeft.dispose(); - } - - if (probesRight) { - scene.remove(probesRight); - probesRight.dispose(); - } - - // Bake both volumes - - probesLeft = new LightProbeGridWebGL(7.8, 4.7, 7.6, resolution, resolution, resolution); - probesLeft.position.set(-3.9, 2.45, 0); - probesLeft.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); - probesLeft.visible = params.enabled; - - probesRight = new LightProbeGridWebGL(7.8, 4.7, 7.6, resolution, resolution, resolution); - probesRight.position.set(3.9, 2.45, 0); - probesRight.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); - probesRight.visible = params.enabled; - - // Add both after baking - - scene.add(probesLeft); - scene.add(probesRight); - - // Update debug visualization - - if (!probesHelperLeft) { - probesHelperLeft = new LightProbeGridHelperWebGL(probesLeft); - probesHelperLeft.visible = params.showProbes; - scene.add(probesHelperLeft); - - probesHelperRight = new LightProbeGridHelperWebGL(probesRight); - probesHelperRight.visible = params.showProbes; - scene.add(probesHelperRight); - } else { - probesHelperLeft.probes = probesLeft; - probesHelperLeft.update(); - - probesHelperRight.probes = probesRight; - probesHelperRight.update(); - } - } - - await bake(params.resolution); - - // GUI - - const gui = new GUI(); - gui.add(params, 'enabled') - .name('GI') - .onChange(value => { - probesLeft.visible = value; - probesRight.visible = value; - }); - gui.add(params, 'resolution', 2, 12, 1) - .name('Resolution') - .onFinishChange(value => { - bake(value); - }); - gui.add(params, 'showProbes') - .name('Show Probes') - .onChange(value => { - probesHelperLeft.visible = value; - probesHelperRight.visible = value; - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lightprobes_sponza.ts b/examples-testing/examples/webgl_lightprobes_sponza.ts deleted file mode 100644 index 6130445da..000000000 --- a/examples-testing/examples/webgl_lightprobes_sponza.ts +++ /dev/null @@ -1,312 +0,0 @@ -import * as THREE from 'three'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { Sky } from 'three/addons/objects/Sky.js'; -import { LightProbeGridWebGL } from 'three/addons/lighting/LightProbeGridWebGL.js'; -import { LightProbeGridHelperWebGL } from 'three/addons/helpers/LightProbeGridHelperWebGL.js'; - -const MODEL_INDEX_URL = - 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json'; -const SAMPLE_ASSETS_BASE_URL = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/'; - -let camera, scene, renderer, controls, timer; -let probes = null, - probesHelper = null; -let modelSize = null; -let sunLight = null, - sky = null; - -const _box = new THREE.Box3(); -const _size = new THREE.Vector3(); - -init(); - -async function init() { - timer = new THREE.Timer(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(-10.25, 4.99, 0.4); - camera.rotation.set(1.6505, -1.5008, 1.6507); - - scene = new THREE.Scene(); - - sky = new Sky(); - sky.scale.setScalar(450000); - scene.add(sky); - - const skyUniforms = sky.material.uniforms; - skyUniforms['turbidity'].value = 10; - skyUniforms['rayleigh'].value = 2; - skyUniforms['mieCoefficient'].value = 0.005; - skyUniforms['mieDirectionalG'].value = 0.8; - skyUniforms['showSunDisc'].value = false; // the sun is represented by the light - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.0; - document.body.appendChild(renderer.domElement); - - controls = new FirstPersonControls(camera, renderer.domElement); - controls.movementSpeed = 2.0; - controls.lookSpeed = 0.16; - - const progressBar = document.getElementById('progressBar'); - - const manager = new THREE.LoadingManager(); - manager.onProgress = function (url, loaded, total) { - progressBar.value = (loaded / total) * 100; - }; - - manager.onLoad = function () { - progressBar.remove(); - }; - - const loader = new GLTFLoader(manager); - const modelURL = await getSponzaModelURL(); - const gltf = await loader.loadAsync(modelURL); - const model = gltf.scene; - const embeddedLights = []; - - model.traverse(child => { - if (child.isMesh) { - child.castShadow = true; - child.receiveShadow = true; - } else if (child.isLight) { - embeddedLights.push(child); - } - }); - - for (const light of embeddedLights) { - if (light.parent) light.parent.remove(light); - } - - scene.add(model); - - _box.setFromObject(model); - modelSize = _box.getSize(_size).clone(); - const probeFar = Math.max(modelSize.x, modelSize.y, modelSize.z) * 2.0; - let rebakeTimer = null; - let isBaking = false; - let bakeQueued = false; - - sunLight = new THREE.SunLight(0xfff2dc, 100.0); - sunLight.castShadow = true; - sunLight.shadow.camera.far = 50; - sunLight.shadow.mapSize.setScalar(2048); - scene.add(sunLight); - - const params = { - enabled: true, - showProbes: false, - probeSize: 0.2, - boundsX: -0.5, - boundsY: 6, - boundsZ: -0.3, - sizeX: 21, - sizeY: 11, - sizeZ: 9, - countX: 10, - countY: 7, - countZ: 7, - bounces: 1, - lightAzimuth: -75, - lightElevation: 60, - lightIntensity: 100.0, - shadows: true, - }; - - function updateLightPosition() { - const elevation = THREE.MathUtils.degToRad(params.lightElevation); - const azimuth = THREE.MathUtils.degToRad(params.lightAzimuth); - - sunLight.position.setFromSphericalCoords(1, Math.PI / 2 - elevation, azimuth); - sky.material.uniforms['sunPosition'].value.copy(sunLight.position); - } - - function scheduleRebake() { - if (rebakeTimer !== null) clearTimeout(rebakeTimer); - rebakeTimer = setTimeout(() => { - rebakeTimer = null; - bakeWithSettings(); - }, 250); - } - - async function bakeWithSettings() { - if (isBaking) { - bakeQueued = true; - return; - } - - isBaking = true; - - do { - bakeQueued = false; - - if (probes) { - scene.remove(probes); - probes.dispose(); - } - - probes = new LightProbeGridWebGL( - params.sizeX, - params.sizeY, - params.sizeZ, - params.countX, - params.countY, - params.countZ, - ); - probes.position.set(params.boundsX, params.boundsY, params.boundsZ); - // Add to the scene before baking so bounce passes can sample the prior pass's atlas. - scene.add(probes); - // Hide the helper spheres so they don't appear in the cubemap captures. - if (probesHelper) probesHelper.visible = false; - probes.bake(renderer, scene, { - cubemapSize: 32, - near: 0.05, - far: probeFar, - bounces: params.bounces, - }); - probes.visible = params.enabled; - - if (!probesHelper) { - probesHelper = new LightProbeGridHelperWebGL(probes, params.probeSize); - probesHelper.visible = params.showProbes; - scene.add(probesHelper); - } else { - probesHelper.probes = probes; - probesHelper.update(); - probesHelper.visible = params.showProbes; - } - } while (bakeQueued); - - isBaking = false; - } - - updateLightPosition(); - - const gui = new GUI(); - gui.add(params, 'enabled') - .name('GI') - .onChange(value => { - if (probes) probes.visible = value; - }); - - gui.add(params, 'lightAzimuth', -180, 180, 1) - .name('Light Azimuth') - .onChange(() => { - updateLightPosition(); - scheduleRebake(); - }); - gui.add(params, 'lightElevation', 5, 85, 1) - .name('Light Elevation') - .onChange(() => { - updateLightPosition(); - scheduleRebake(); - }); - gui.add(params, 'lightIntensity', 0, 100, 0.1) - .name('Light Intensity') - .onChange(value => { - sunLight.intensity = value; - scheduleRebake(); - }); - gui.add(params, 'shadows') - .name('Shadows') - .onChange(value => { - setShadowsEnabled(value); - scheduleRebake(); - }); - - gui.add(params, 'countX', 2, 32, 1).name('Probes X').onChange(scheduleRebake); - gui.add(params, 'countY', 2, 16, 1).name('Probes Y').onChange(scheduleRebake); - gui.add(params, 'countZ', 2, 16, 1).name('Probes Z').onChange(scheduleRebake); - gui.add(params, 'bounces', 0, 2, 1).name('Bounces').onChange(scheduleRebake); - - gui.add(params, 'showProbes') - .name('Show Probes') - .onChange(value => { - if (probesHelper) probesHelper.visible = value; - }); - gui.add(params, 'probeSize', 0.05, 2.0, 0.05) - .name('Probe Size') - .onChange(value => { - if (probesHelper) { - scene.remove(probesHelper); - probesHelper.dispose(); - probesHelper = new LightProbeGridHelperWebGL(probes, value); - probesHelper.visible = params.showProbes; - scene.add(probesHelper); - } - }); - - gui.add( - { - log: () => { - console.log( - 'position:', - camera.position.x.toFixed(2), - camera.position.y.toFixed(2), - camera.position.z.toFixed(2), - ); - console.log( - 'rotation:', - camera.rotation.x.toFixed(4), - camera.rotation.y.toFixed(4), - camera.rotation.z.toFixed(4), - ); - }, - }, - 'log', - ).name('Log Camera'); - - setShadowsEnabled(params.shadows); - await bakeWithSettings(); - - window.addEventListener('resize', onWindowResize); -} - -async function getSponzaModelURL() { - const response = await fetch(MODEL_INDEX_URL); - const models = await response.json(); - const sponzaInfo = models.find(model => model.name === 'Sponza'); - - if (!sponzaInfo) { - throw new Error('Sponza entry was not found in the glTF sample model index.'); - } - - const variants = sponzaInfo.variants || {}; - const variantName = - variants['glTF-Binary'] || variants['glTF'] || variants['glTF-Embedded'] || Object.values(variants)[0]; - - if (!variantName) { - throw new Error('Sponza has no supported glTF variant in the model index.'); - } - - const variantFolder = variantName.endsWith('.glb') ? 'glTF-Binary' : 'glTF'; - return `${SAMPLE_ASSETS_BASE_URL}${sponzaInfo.name}/${variantFolder}/${variantName}`; -} - -function setShadowsEnabled(enabled) { - if (!renderer || !sunLight) return; - - renderer.shadowMap.enabled = enabled; - sunLight.castShadow = enabled; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(timestamp) { - timer.update(timestamp); - controls.update(timer.getDelta()); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lights_hemisphere.ts b/examples-testing/examples/webgl_lights_hemisphere.ts deleted file mode 100644 index 2910b15de..000000000 --- a/examples-testing/examples/webgl_lights_hemisphere.ts +++ /dev/null @@ -1,191 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer; -const mixers = []; -let stats; - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.set(0, 0, 250); - - scene = new THREE.Scene(); - scene.background = new THREE.Color().setHSL(0.6, 0, 1); - scene.fog = new THREE.Fog(scene.background, 1, 5000); - - // LIGHTS - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0xffffff, 2); - hemiLight.color.setHSL(0.6, 1, 0.6); - hemiLight.groundColor.setHSL(0.095, 1, 0.75); - hemiLight.position.set(0, 50, 0); - scene.add(hemiLight); - - const hemiLightHelper = new THREE.HemisphereLightHelper(hemiLight, 10); - scene.add(hemiLightHelper); - - // - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.color.setHSL(0.1, 1, 0.95); - dirLight.position.set(-1, 1.75, 1); - dirLight.position.multiplyScalar(30); - scene.add(dirLight); - - dirLight.castShadow = true; - - dirLight.shadow.mapSize.width = 2048; - dirLight.shadow.mapSize.height = 2048; - - const d = 50; - - dirLight.shadow.camera.left = -d; - dirLight.shadow.camera.right = d; - dirLight.shadow.camera.top = d; - dirLight.shadow.camera.bottom = -d; - - dirLight.shadow.camera.far = 3500; - dirLight.shadow.bias = -0.0001; - - const dirLightHelper = new THREE.DirectionalLightHelper(dirLight, 10); - scene.add(dirLightHelper); - - // GROUND - - const groundGeo = new THREE.PlaneGeometry(10000, 10000); - const groundMat = new THREE.MeshLambertMaterial({ color: 0xffffff }); - groundMat.color.setHSL(0.095, 1, 0.75); - - const ground = new THREE.Mesh(groundGeo, groundMat); - ground.position.y = -33; - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - // SKYDOME - - const vertexShader = document.getElementById('vertexShader').textContent; - const fragmentShader = document.getElementById('fragmentShader').textContent; - const uniforms = { - topColor: { value: new THREE.Color(0x0077ff) }, - bottomColor: { value: new THREE.Color(0xffffff) }, - offset: { value: 33 }, - exponent: { value: 0.6 }, - }; - uniforms['topColor'].value.copy(hemiLight.color); - - scene.fog.color.copy(uniforms['bottomColor'].value); - - const skyGeo = new THREE.SphereGeometry(4000, 32, 15); - const skyMat = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: vertexShader, - fragmentShader: fragmentShader, - side: THREE.BackSide, - }); - - const sky = new THREE.Mesh(skyGeo, skyMat); - scene.add(sky); - - // MODEL - - const loader = new GLTFLoader(); - - loader.load('models/gltf/Flamingo.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - - const s = 0.35; - mesh.scale.set(s, s, s); - mesh.position.y = 15; - mesh.rotation.y = -1; - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); - - const mixer = new THREE.AnimationMixer(mesh); - mixer.clipAction(gltf.animations[0]).setDuration(1).play(); - mixers.push(mixer); - }); - - // RENDERER - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - renderer.shadowMap.enabled = true; - - // STATS - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - const params = { - toggleHemisphereLight: function () { - hemiLight.visible = !hemiLight.visible; - hemiLightHelper.visible = !hemiLightHelper.visible; - }, - toggleDirectionalLight: function () { - dirLight.visible = !dirLight.visible; - dirLightHelper.visible = !dirLightHelper.visible; - }, - shadowIntensity: 1, - }; - - const gui = new GUI(); - - gui.add(params, 'toggleHemisphereLight').name('toggle hemisphere light'); - gui.add(params, 'toggleDirectionalLight').name('toggle directional light'); - gui.add(params, 'shadowIntensity', 0, 1) - .name('shadow intensity') - .onChange(value => { - dirLight.shadow.intensity = value; - }); - gui.open(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - const delta = timer.getDelta(); - - for (let i = 0; i < mixers.length; i++) { - mixers[i].update(delta); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lights_physical.ts b/examples-testing/examples/webgl_lights_physical.ts deleted file mode 100644 index 707ef200e..000000000 --- a/examples-testing/examples/webgl_lights_physical.ts +++ /dev/null @@ -1,237 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, bulbLight, bulbMat, hemiLight, stats; -let ballMat, cubeMat, floorMat; - -let previousShadowMap = false; - -// ref for lumens: http://www.power-sure.com/lumens.htm -const bulbLuminousPowers = { - '110000 lm (1000W)': 110000, - '3500 lm (300W)': 3500, - '1700 lm (100W)': 1700, - '800 lm (60W)': 800, - '400 lm (40W)': 400, - '180 lm (25W)': 180, - '20 lm (4W)': 20, - Off: 0, -}; - -// ref for solar irradiances: https://en.wikipedia.org/wiki/Lux -const hemiLuminousIrradiances = { - '0.0001 lx (Moonless Night)': 0.0001, - '0.002 lx (Night Airglow)': 0.002, - '0.5 lx (Full Moon)': 0.5, - '3.4 lx (City Twilight)': 3.4, - '50 lx (Living Room)': 50, - '100 lx (Very Overcast)': 100, - '350 lx (Office Room)': 350, - '400 lx (Sunrise/Sunset)': 400, - '1000 lx (Overcast)': 1000, - '18000 lx (Daylight)': 18000, - '50000 lx (Direct Sun)': 50000, -}; - -const params = { - shadows: true, - exposure: 0.68, - bulbPower: Object.keys(bulbLuminousPowers)[4], - hemiIrradiance: Object.keys(hemiLuminousIrradiances)[0], -}; - -init(); - -function init() { - const container = document.getElementById('container'); - - stats = new Stats(); - container.appendChild(stats.dom); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.x = -4; - camera.position.z = 4; - camera.position.y = 2; - - scene = new THREE.Scene(); - - const bulbGeometry = new THREE.SphereGeometry(0.02, 16, 8); - bulbLight = new THREE.PointLight(0xffee88, 1, 100, 2); - - bulbMat = new THREE.MeshStandardMaterial({ - emissive: 0xffffee, - emissiveIntensity: 1, - color: 0x000000, - }); - bulbLight.add(new THREE.Mesh(bulbGeometry, bulbMat)); - bulbLight.position.set(0, 2, 0); - bulbLight.castShadow = true; - scene.add(bulbLight); - - hemiLight = new THREE.HemisphereLight(0xddeeff, 0x0f0e0d, 0.02); - scene.add(hemiLight); - - floorMat = new THREE.MeshStandardMaterial({ - roughness: 0.8, - color: 0xffffff, - metalness: 0.2, - bumpScale: 1, - }); - const textureLoader = new THREE.TextureLoader(); - textureLoader.load('textures/hardwood2_diffuse.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(10, 24); - map.colorSpace = THREE.SRGBColorSpace; - floorMat.map = map; - floorMat.needsUpdate = true; - }); - textureLoader.load('textures/hardwood2_bump.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(10, 24); - floorMat.bumpMap = map; - floorMat.needsUpdate = true; - }); - textureLoader.load('textures/hardwood2_roughness.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(10, 24); - floorMat.roughnessMap = map; - floorMat.needsUpdate = true; - }); - - cubeMat = new THREE.MeshStandardMaterial({ - roughness: 0.7, - color: 0xffffff, - bumpScale: 1, - metalness: 0.2, - }); - textureLoader.load('textures/brick_diffuse.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(1, 1); - map.colorSpace = THREE.SRGBColorSpace; - cubeMat.map = map; - cubeMat.needsUpdate = true; - }); - textureLoader.load('textures/brick_bump.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(1, 1); - cubeMat.bumpMap = map; - cubeMat.needsUpdate = true; - }); - - ballMat = new THREE.MeshStandardMaterial({ - color: 0xffffff, - roughness: 0.5, - metalness: 1.0, - }); - textureLoader.load('textures/planets/earth_atmos_2048.jpg', function (map) { - map.anisotropy = 4; - map.colorSpace = THREE.SRGBColorSpace; - ballMat.map = map; - ballMat.needsUpdate = true; - }); - textureLoader.load('textures/planets/earth_specular_2048.jpg', function (map) { - map.anisotropy = 4; - map.colorSpace = THREE.SRGBColorSpace; - ballMat.metalnessMap = map; - ballMat.needsUpdate = true; - }); - - const floorGeometry = new THREE.PlaneGeometry(20, 20); - const floorMesh = new THREE.Mesh(floorGeometry, floorMat); - floorMesh.receiveShadow = true; - floorMesh.rotation.x = -Math.PI / 2.0; - scene.add(floorMesh); - - const ballGeometry = new THREE.SphereGeometry(0.25, 32, 32); - const ballMesh = new THREE.Mesh(ballGeometry, ballMat); - ballMesh.position.set(1, 0.25, 1); - ballMesh.rotation.y = Math.PI; - ballMesh.castShadow = true; - scene.add(ballMesh); - - const boxGeometry = new THREE.BoxGeometry(0.5, 0.5, 0.5); - const boxMesh = new THREE.Mesh(boxGeometry, cubeMat); - boxMesh.position.set(-0.5, 0.25, -1); - boxMesh.castShadow = true; - scene.add(boxMesh); - - const boxMesh2 = new THREE.Mesh(boxGeometry, cubeMat); - boxMesh2.position.set(0, 0.25, -5); - boxMesh2.castShadow = true; - scene.add(boxMesh2); - - const boxMesh3 = new THREE.Mesh(boxGeometry, cubeMat); - boxMesh3.position.set(7, 0.25, 0); - boxMesh3.castShadow = true; - scene.add(boxMesh3); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ReinhardToneMapping; - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 20; - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'hemiIrradiance', Object.keys(hemiLuminousIrradiances)); - gui.add(params, 'bulbPower', Object.keys(bulbLuminousPowers)); - gui.add(params, 'exposure', 0, 1); - gui.add(params, 'shadows'); - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.toneMappingExposure = Math.pow(params.exposure, 5.0); // to allow for very bright scenes. - renderer.shadowMap.enabled = params.shadows; - bulbLight.castShadow = params.shadows; - - if (params.shadows !== previousShadowMap) { - ballMat.needsUpdate = true; - cubeMat.needsUpdate = true; - floorMat.needsUpdate = true; - previousShadowMap = params.shadows; - } - - bulbLight.power = bulbLuminousPowers[params.bulbPower]; - bulbMat.emissiveIntensity = bulbLight.intensity / Math.pow(0.02, 2.0); // convert from intensity to irradiance at bulb surface - - hemiLight.intensity = hemiLuminousIrradiances[params.hemiIrradiance]; - const time = Date.now() * 0.0005; - - bulbLight.position.y = Math.cos(time) * 0.75 + 1.25; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_lights_rectarealight.ts b/examples-testing/examples/webgl_lights_rectarealight.ts deleted file mode 100644 index 621d183d8..000000000 --- a/examples-testing/examples/webgl_lights_rectarealight.ts +++ /dev/null @@ -1,110 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; -import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js'; - -let renderer, scene, camera; -let rectLight1, rectLight2, rectLight3; -let timer, stats; - -init(); - -function init() { - timer = new THREE.Timer(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animation); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 5, -15); - - scene = new THREE.Scene(); - - RectAreaLightUniformsLib.init(); - - rectLight1 = new THREE.RectAreaLight(0xff0000, 5, 4, 10); - rectLight1.position.set(-5, 6, 5); - scene.add(rectLight1); - - rectLight2 = new THREE.RectAreaLight(0x00ff00, 5, 4, 10); - rectLight2.position.set(0, 6, 5); - scene.add(rectLight2); - - rectLight3 = new THREE.RectAreaLight(0x0000ff, 5, 4, 10); - rectLight3.position.set(5, 6, 5); - scene.add(rectLight3); - - scene.add(new RectAreaLightHelper(rectLight1)); - scene.add(new RectAreaLightHelper(rectLight2)); - scene.add(new RectAreaLightHelper(rectLight3)); - - const geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000); - const matStdFloor = new THREE.MeshStandardMaterial({ color: 0x444444 }); - matStdFloor.roughnessMap = createCheckerTexture(400); - const mshStdFloor = new THREE.Mesh(geoFloor, matStdFloor); - scene.add(mshStdFloor); - - const geoKnot = new THREE.TorusKnotGeometry(1.5, 0.5, 200, 16); - const matKnot = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0, metalness: 0 }); - const meshKnot = new THREE.Mesh(geoKnot, matKnot); - meshKnot.position.set(0, 5.5, 0); - scene.add(meshKnot); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.copy(meshKnot.position); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); - - stats = new Stats(); - document.body.appendChild(stats.dom); -} - -function createCheckerTexture(repeat = 1) { - const canvas = document.createElement('canvas'); - canvas.width = 2; - canvas.height = 2; - - const ctx = canvas.getContext('2d'); - ctx.fillStyle = '#000'; - ctx.fillRect(0, 0, 2, 2); - ctx.fillStyle = '#fff'; - ctx.fillRect(0, 0, 1, 1); - ctx.fillRect(1, 1, 1, 1); - - const texture = new THREE.CanvasTexture(canvas); - texture.repeat.set(repeat, repeat); - texture.magFilter = THREE.NearestFilter; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - - return texture; -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -function animation() { - timer.update(); - - const delta = timer.getDelta(); - - rectLight1.rotation.y += -delta; - rectLight2.rotation.y += delta * 0.5; - rectLight3.rotation.y += delta; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_lights_spotlight.ts b/examples-testing/examples/webgl_lights_spotlight.ts deleted file mode 100644 index 78fec9d4e..000000000 --- a/examples-testing/examples/webgl_lights_spotlight.ts +++ /dev/null @@ -1,202 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let renderer, scene, camera; - -let spotLight; - -init(); - -function init() { - // Renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1; - - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(7, 4, 1); - - // Controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.maxPolarAngle = Math.PI / 2; - controls.target.set(0, 1, 0); - controls.update(); - - // Textures - - const loader = new THREE.TextureLoader().setPath('textures/'); - const filenames = ['disturb.jpg', 'colors.png', 'uv_grid_opengl.jpg']; - - const textures = { none: null }; - - for (let i = 0; i < filenames.length; i++) { - const filename = filenames[i]; - - const texture = loader.load(filename); - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - texture.colorSpace = THREE.SRGBColorSpace; - - textures[filename] = texture; - } - - // Lights - - const ambient = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 0.25); - scene.add(ambient); - - spotLight = new THREE.SpotLight(0xffffff, 100); - spotLight.name = 'spotLight'; - spotLight.map = textures['disturb.jpg']; - spotLight.position.set(2.5, 5, 2.5); - spotLight.angle = Math.PI / 6; - spotLight.penumbra = 1; - spotLight.decay = 2; - spotLight.distance = 0; - - spotLight.castShadow = true; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - spotLight.shadow.camera.near = 2; - spotLight.shadow.camera.far = 10; - spotLight.shadow.focus = 1; - spotLight.shadow.bias = -0.003; - spotLight.shadow.intensity = 1; - scene.add(spotLight); - - spotLight.lightHelper = new THREE.SpotLightHelper(spotLight); - spotLight.lightHelper.visible = false; - scene.add(spotLight.lightHelper); - - spotLight.shadowCameraHelper = new THREE.CameraHelper(spotLight.shadow.camera); // colored lines - spotLight.shadowCameraHelper.visible = false; - scene.add(spotLight.shadowCameraHelper); - - // - - const geometry = new THREE.PlaneGeometry(10, 10); - const material = new THREE.MeshLambertMaterial({ color: 0xbcbcbc }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(0, -1, 0); - mesh.rotation.x = -Math.PI / 2; - mesh.receiveShadow = true; - scene.add(mesh); - - // Model - - new PLYLoader().load('models/ply/binary/Lucy100k.ply', function (geometry) { - geometry.scale(0.0024, 0.0024, 0.0024); - geometry.computeVertexNormals(); - - const material = new THREE.MeshLambertMaterial(); - - const mesh = new THREE.Mesh(geometry, material); - mesh.rotation.y = -Math.PI / 2; - mesh.position.y = 0.8; - mesh.castShadow = true; - mesh.receiveShadow = true; - scene.add(mesh); - }); - - // - - window.addEventListener('resize', onWindowResize); - - // GUI - - const gui = new GUI(); - - const params = { - map: textures['disturb.jpg'], - color: spotLight.color.getHex(), - intensity: spotLight.intensity, - distance: spotLight.distance, - angle: spotLight.angle, - penumbra: spotLight.penumbra, - decay: spotLight.decay, - focus: spotLight.shadow.focus, - shadowIntensity: spotLight.shadow.intensity, - helpers: false, - }; - - gui.add(params, 'map', textures).onChange(function (val) { - spotLight.map = val; - }); - - gui.addColor(params, 'color').onChange(function (val) { - spotLight.color.setHex(val); - }); - - gui.add(params, 'intensity', 0, 500).onChange(function (val) { - spotLight.intensity = val; - }); - - gui.add(params, 'distance', 0, 20).onChange(function (val) { - spotLight.distance = val; - }); - - gui.add(params, 'angle', 0, Math.PI / 3).onChange(function (val) { - spotLight.angle = val; - }); - - gui.add(params, 'penumbra', 0, 1).onChange(function (val) { - spotLight.penumbra = val; - }); - - gui.add(params, 'decay', 1, 2).onChange(function (val) { - spotLight.decay = val; - }); - - gui.add(params, 'focus', 0, 1).onChange(function (val) { - spotLight.shadow.focus = val; - }); - - gui.add(params, 'shadowIntensity', 0, 1).onChange(function (val) { - spotLight.shadow.intensity = val; - }); - - gui.add(params, 'helpers').onChange(function (val) { - spotLight.lightHelper.visible = val; - spotLight.shadowCameraHelper.visible = val; - }); - - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now() / 3000; - - spotLight.position.x = Math.cos(time) * 2.5; - spotLight.position.z = Math.sin(time) * 2.5; - - spotLight.lightHelper.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lights_spotlights.ts b/examples-testing/examples/webgl_lights_spotlights.ts deleted file mode 100644 index be8dfd69d..000000000 --- a/examples-testing/examples/webgl_lights_spotlights.ts +++ /dev/null @@ -1,133 +0,0 @@ -import * as THREE from 'three'; -import TWEEN from 'three/addons/libs/tween.module.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -const renderer = new THREE.WebGLRenderer({ antialias: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setAnimationLoop(animate); - -const camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); - -const controls = new OrbitControls(camera, renderer.domElement); - -const scene = new THREE.Scene(); - -const matFloor = new THREE.MeshPhongMaterial({ color: 0x808080 }); -const matBox = new THREE.MeshPhongMaterial({ color: 0xaaaaaa }); - -const geoFloor = new THREE.PlaneGeometry(100, 100); -const geoBox = new THREE.BoxGeometry(0.3, 0.1, 0.2); - -const mshFloor = new THREE.Mesh(geoFloor, matFloor); -mshFloor.rotation.x = -Math.PI * 0.5; -const mshBox = new THREE.Mesh(geoBox, matBox); - -const ambient = new THREE.AmbientLight(0x444444); - -const spotLight1 = createSpotlight(0xff7f00); -const spotLight2 = createSpotlight(0x00ff7f); -const spotLight3 = createSpotlight(0x7f00ff); - -let lightHelper1, lightHelper2, lightHelper3; - -function init() { - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - - camera.position.set(4.6, 2.2, -2.1); - - spotLight1.position.set(1.5, 4, 4.5); - spotLight2.position.set(0, 4, 3.5); - spotLight3.position.set(-1.5, 4, 4.5); - - lightHelper1 = new THREE.SpotLightHelper(spotLight1); - lightHelper2 = new THREE.SpotLightHelper(spotLight2); - lightHelper3 = new THREE.SpotLightHelper(spotLight3); - - mshFloor.receiveShadow = true; - mshFloor.position.set(0, -0.05, 0); - - mshBox.castShadow = true; - mshBox.receiveShadow = true; - mshBox.position.set(0, 0.5, 0); - - scene.add(mshFloor); - scene.add(mshBox); - scene.add(ambient); - scene.add(spotLight1, spotLight2, spotLight3); - scene.add(lightHelper1, lightHelper2, lightHelper3); - - document.body.appendChild(renderer.domElement); - window.addEventListener('resize', onWindowResize); - - controls.target.set(0, 0.5, 0); - controls.maxPolarAngle = Math.PI / 2; - controls.minDistance = 1; - controls.maxDistance = 10; - controls.update(); -} - -function createSpotlight(color) { - const newObj = new THREE.SpotLight(color, 10); - - newObj.castShadow = true; - newObj.angle = 0.3; - newObj.penumbra = 0.2; - newObj.decay = 2; - newObj.distance = 50; - - return newObj; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function tween(light) { - new TWEEN.Tween(light) - .to( - { - angle: Math.random() * 0.7 + 0.1, - penumbra: Math.random() + 1, - }, - Math.random() * 3000 + 2000, - ) - .easing(TWEEN.Easing.Quadratic.Out) - .start(); - - new TWEEN.Tween(light.position) - .to( - { - x: Math.random() * 3 - 1.5, - y: Math.random() * 1 + 1.5, - z: Math.random() * 3 - 1.5, - }, - Math.random() * 3000 + 2000, - ) - .easing(TWEEN.Easing.Quadratic.Out) - .start(); -} - -function updateTweens() { - tween(spotLight1); - tween(spotLight2); - tween(spotLight3); - - setTimeout(updateTweens, 5000); -} - -function animate() { - TWEEN.update(); - - if (lightHelper1) lightHelper1.update(); - if (lightHelper2) lightHelper2.update(); - if (lightHelper3) lightHelper3.update(); - - renderer.render(scene, camera); -} - -init(); -updateTweens(); diff --git a/examples-testing/examples/webgl_lights_sunlight.ts b/examples-testing/examples/webgl_lights_sunlight.ts deleted file mode 100644 index 9cfe10948..000000000 --- a/examples-testing/examples/webgl_lights_sunlight.ts +++ /dev/null @@ -1,226 +0,0 @@ -import * as THREE from 'three'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { Sky } from 'three/addons/objects/Sky.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let renderer, scene, camera, controls, timer, sunLight, sky, sceneEnv, pmremGenerator, renderTarget; - -const params = { - showCascades: false, - far: 1000, - resolution: 2048, - azimuth: 135, - elevation: 10, -}; - -const _sunDay = new THREE.Color(0xfff2e3), - _sunDusk = new THREE.Color(0xff8a3d); -const _fogDay = new THREE.Color(0xd8e2ea), - _fogDusk = new THREE.Color(0xd9a273); - -// tints each fragment by its cascade, using the data of the built-in sun shadow shader - -function tintCascades(shader) { - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - /* glsl */ ` - #include - - #if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0 - - float cascade = 0.0; - for ( int i = 0; i < 4; i ++ ) cascade += step( sunShadowCascade[ i ].y, vSunShadowWorldPosition.w ); - gl_FragColor.rgb *= 0.7 + 0.3 * cos( cascade * 1.2 + vec3( 0.0, 4.2, 2.1 ) ); - - #endif - `, - ); -} - -init(); - -function updateSun() { - sunLight.position.setFromSphericalCoords( - 1, - THREE.MathUtils.degToRad(90 - params.elevation), - THREE.MathUtils.degToRad(params.azimuth), - ); - - // the sun light warms up and fades towards the horizon - - const daylight = Math.min(1, params.elevation / 30); - - sunLight.color.lerpColors(_sunDusk, _sunDay, daylight); - sunLight.intensity = 3 + daylight * 2; - - scene.fog.color.lerpColors(_fogDusk, _fogDay, daylight); - - sky.material.uniforms.sunPosition.value.copy(sunLight.position); - - // light the scene with the sky itself - - if (renderTarget !== undefined) renderTarget.dispose(); - - sceneEnv.add(sky); - renderTarget = pmremGenerator.fromScene(sceneEnv); - scene.add(sky); - - scene.environment = renderTarget.texture; -} - -function init() { - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x000000, 500, 4000); - scene.environmentIntensity = 0.5; - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.5, 5000); - camera.position.set(60, 8, 0); - camera.lookAt(-60, 8, 0); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.6; - document.body.appendChild(renderer.domElement); - - controls = new FirstPersonControls(camera, renderer.domElement); - controls.movementSpeed = 40; - controls.lookSpeed = 0.05; - - timer = new THREE.Timer(); - pmremGenerator = new THREE.PMREMGenerator(renderer); - sceneEnv = new THREE.Scene(); - - // sky and sun - - sky = new Sky(); - sky.scale.setScalar(9000); - scene.add(sky); - - sky.material.uniforms.turbidity.value = 3; - sky.material.uniforms.rayleigh.value = 2; - sky.material.uniforms.showSunDisc.value = false; // the sun is represented by the light - - sunLight = new THREE.SunLight(); - sunLight.castShadow = true; - sunLight.shadow.camera.far = params.far; // maximum shadow distance - sunLight.shadow.mapSize.setScalar(params.resolution); - sunLight.shadow.normalBias = 0.05; - scene.add(sunLight); - - updateSun(); - - // ground - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(10000, 10000), - new THREE.MeshStandardMaterial({ color: 0xa39f8e }), - ); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - const dummy = new THREE.Object3D(); - - // an avenue of thin posts shows the shadow resolution from up close - // all the way down to the shadow distance - - const posts = new THREE.InstancedMesh( - new THREE.BoxGeometry(1, 10, 1), - new THREE.MeshStandardMaterial({ color: 0x475161 }), - 120, - ); - posts.castShadow = true; - posts.receiveShadow = true; - scene.add(posts); - - for (let i = 0; i < 60; i++) { - for (const side of [-1, 1]) { - dummy.position.set(30 - i * 17, 5, side * 13); - dummy.updateMatrix(); - posts.setMatrixAt(i * 2 + (side + 1) / 2, dummy.matrix); - } - } - - // towers for large shadows in the distance - - const towers = new THREE.InstancedMesh(new THREE.BoxGeometry(10, 1, 10), new THREE.MeshStandardMaterial(), 60); - towers.castShadow = true; - towers.receiveShadow = true; - scene.add(towers); - - const towerColors = [new THREE.Color(0x08d9d6), new THREE.Color(0xff2e63)]; - - THREE.MathUtils.seededRandom(6); - - for (let i = 0; i < 30; i++) { - for (const side of [-1, 1]) { - const height = 20 + THREE.MathUtils.seededRandom() * 40; - - dummy.position.set( - -40 - i * 32 - THREE.MathUtils.seededRandom() * 10, - height / 2, - side * (38 + THREE.MathUtils.seededRandom() * 55), - ); - dummy.scale.y = height; - dummy.updateMatrix(); - - const index = i * 2 + (side + 1) / 2; - towers.setMatrixAt(index, dummy.matrix); - towers.setColorAt(index, towerColors[(i + (side + 1) / 2) % 2]); - } - } - - // gui - - const materials = [ground.material, posts.material, towers.material]; - - const gui = new GUI(); - - gui.add(params, 'showCascades') - .name('show cascades') - .onChange(function (value) { - for (const material of materials) { - if (value) material.onBeforeCompile = tintCascades; - else delete material.onBeforeCompile; - - material.needsUpdate = true; - } - }); - - gui.add(params, 'far', 100, 3000) - .step(1) - .name('shadow far') - .onChange(function (value) { - sunLight.shadow.camera.far = value; - }); - - gui.add(params, 'resolution', [256, 512, 1024, 2048, 4096]) - .name('shadow resolution') - .onChange(function (value) { - sunLight.shadow.mapSize.setScalar(value); - }); - - gui.add(params, 'azimuth', 0, 360).onChange(updateSun); - gui.add(params, 'elevation', 5, 80).onChange(updateSun); - - window.addEventListener('resize', function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - controls.handleResize(); - }); -} - -function animate() { - timer.update(); - - controls.update(timer.getDelta()); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lines_colors.ts b/examples-testing/examples/webgl_lines_colors.ts deleted file mode 100644 index 9da19ee2e..000000000 --- a/examples-testing/examples/webgl_lines_colors.ts +++ /dev/null @@ -1,181 +0,0 @@ -import * as THREE from 'three'; - -import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; - -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -let camera, scene, renderer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(33, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - const hilbertPoints = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 200.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); - - const geometry1 = new THREE.BufferGeometry(); - const geometry2 = new THREE.BufferGeometry(); - const geometry3 = new THREE.BufferGeometry(); - - const subdivisions = 6; - - let vertices = []; - let colors1 = []; - let colors2 = []; - let colors3 = []; - - const point = new THREE.Vector3(); - const color = new THREE.Color(); - - const spline = new THREE.CatmullRomCurve3(hilbertPoints); - - for (let i = 0; i < hilbertPoints.length * subdivisions; i++) { - const t = i / (hilbertPoints.length * subdivisions); - spline.getPoint(t, point); - - vertices.push(point.x, point.y, point.z); - - color.setHSL(0.6, 1.0, Math.max(0, -point.x / 200) + 0.5, THREE.SRGBColorSpace); - colors1.push(color.r, color.g, color.b); - - color.setHSL(0.9, 1.0, Math.max(0, -point.y / 200) + 0.5, THREE.SRGBColorSpace); - colors2.push(color.r, color.g, color.b); - - color.setHSL(i / (hilbertPoints.length * subdivisions), 1.0, 0.5, THREE.SRGBColorSpace); - colors3.push(color.r, color.g, color.b); - } - - geometry1.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - geometry2.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - geometry3.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - geometry1.setAttribute('color', new THREE.Float32BufferAttribute(colors1, 3)); - geometry2.setAttribute('color', new THREE.Float32BufferAttribute(colors2, 3)); - geometry3.setAttribute('color', new THREE.Float32BufferAttribute(colors3, 3)); - - // - - const geometry4 = new THREE.BufferGeometry(); - const geometry5 = new THREE.BufferGeometry(); - const geometry6 = new THREE.BufferGeometry(); - - vertices = []; - colors1 = []; - colors2 = []; - colors3 = []; - - for (let i = 0; i < hilbertPoints.length; i++) { - const point = hilbertPoints[i]; - - vertices.push(point.x, point.y, point.z); - - color.setHSL(0.6, 1.0, Math.max(0, (200 - hilbertPoints[i].x) / 400) * 0.5 + 0.5, THREE.SRGBColorSpace); - colors1.push(color.r, color.g, color.b); - - color.setHSL(0.3, 1.0, Math.max(0, (200 + hilbertPoints[i].x) / 400) * 0.5, THREE.SRGBColorSpace); - colors2.push(color.r, color.g, color.b); - - color.setHSL(i / hilbertPoints.length, 1.0, 0.5, THREE.SRGBColorSpace); - colors3.push(color.r, color.g, color.b); - } - - geometry4.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - geometry5.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - geometry6.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - geometry4.setAttribute('color', new THREE.Float32BufferAttribute(colors1, 3)); - geometry5.setAttribute('color', new THREE.Float32BufferAttribute(colors2, 3)); - geometry6.setAttribute('color', new THREE.Float32BufferAttribute(colors3, 3)); - - // Create lines and add to scene - - const material = new THREE.LineBasicMaterial({ color: 0xffffff, vertexColors: true }); - - let line, p; - const scale = 0.3, - d = 225; - - const parameters = [ - [material, scale * 1.5, [-d, -d / 2, 0], geometry1], - [material, scale * 1.5, [0, -d / 2, 0], geometry2], - [material, scale * 1.5, [d, -d / 2, 0], geometry3], - - [material, scale * 1.5, [-d, d / 2, 0], geometry4], - [material, scale * 1.5, [0, d / 2, 0], geometry5], - [material, scale * 1.5, [d, d / 2, 0], geometry6], - ]; - - for (let i = 0; i < parameters.length; i++) { - p = parameters[i]; - line = new THREE.Line(p[3], p[0]); - line.scale.x = line.scale.y = line.scale.z = p[1]; - line.position.x = p[2][0]; - line.position.y = p[2][1]; - line.position.z = p[2][2]; - scene.add(line); - } - - // - - document.body.style.touchAction = 'none'; - document.body.addEventListener('pointermove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY + 200 - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - const time = Date.now() * 0.0005; - - for (let i = 0; i < scene.children.length; i++) { - const object = scene.children[i]; - - if (object.isLine) { - object.rotation.y = time * (i % 2 ? 1 : -1); - } - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lines_dashed.ts b/examples-testing/examples/webgl_lines_dashed.ts deleted file mode 100644 index 3e3ee3041..000000000 --- a/examples-testing/examples/webgl_lines_dashed.ts +++ /dev/null @@ -1,186 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; - -let renderer, scene, camera, stats; -const objects = []; - -const WIDTH = window.innerWidth, - HEIGHT = window.innerHeight; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, WIDTH / HEIGHT, 1, 200); - camera.position.z = 150; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x111111); - scene.fog = new THREE.Fog(0x111111, 150, 200); - - const subdivisions = 6; - const recursion = 1; - - const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 25.0, recursion, 0, 1, 2, 3, 4, 5, 6, 7); - const spline = new THREE.CatmullRomCurve3(points); - - const samples = spline.getPoints(points.length * subdivisions); - const geometrySpline = new THREE.BufferGeometry().setFromPoints(samples); - - const line = new THREE.Line( - geometrySpline, - new THREE.LineDashedMaterial({ color: 0xffffff, dashSize: 1, gapSize: 0.5 }), - ); - line.computeLineDistances(); - - objects.push(line); - scene.add(line); - - const geometryBox = box(50, 50, 50); - - const lineSegments = new THREE.LineSegments( - geometryBox, - new THREE.LineDashedMaterial({ color: 0xffaa00, dashSize: 3, gapSize: 1 }), - ); - lineSegments.computeLineDistances(); - - objects.push(lineSegments); - scene.add(lineSegments); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(WIDTH, HEIGHT); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function box(width, height, depth) { - ((width = width * 0.5), (height = height * 0.5), (depth = depth * 0.5)); - - const geometry = new THREE.BufferGeometry(); - const position = []; - - position.push( - -width, - -height, - -depth, - -width, - height, - -depth, - - -width, - height, - -depth, - width, - height, - -depth, - - width, - height, - -depth, - width, - -height, - -depth, - - width, - -height, - -depth, - -width, - -height, - -depth, - - -width, - -height, - depth, - -width, - height, - depth, - - -width, - height, - depth, - width, - height, - depth, - - width, - height, - depth, - width, - -height, - depth, - - width, - -height, - depth, - -width, - -height, - depth, - - -width, - -height, - -depth, - -width, - -height, - depth, - - -width, - height, - -depth, - -width, - height, - depth, - - width, - height, - -depth, - width, - height, - depth, - - width, - -height, - -depth, - width, - -height, - depth, - ); - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(position, 3)); - - return geometry; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.001; - - scene.traverse(function (object) { - if (object.isLine) { - object.rotation.x = 0.25 * time; - object.rotation.y = 0.25 * time; - } - }); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lines_fat.ts b/examples-testing/examples/webgl_lines_fat.ts deleted file mode 100644 index 73b29ad70..000000000 --- a/examples-testing/examples/webgl_lines_fat.ts +++ /dev/null @@ -1,245 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Line2 } from 'three/addons/lines/Line2.js'; -import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; -import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; -import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; - -let line, renderer, scene, camera, camera2, controls; -let line1; -let matLine, matLineBasic, matLineDashed; -let gui; - -// viewport -let insetWidth; -let insetHeight; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setClearColor(0x000000, 0.0); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-40, 0, 60); - - camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); - camera2.position.copy(camera.position); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 10; - controls.maxDistance = 500; - - // Position and THREE.Color Data - - const positions = []; - const colors = []; - - const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 20.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); - - const spline = new THREE.CatmullRomCurve3(points); - const divisions = Math.round(12 * points.length); - const point = new THREE.Vector3(); - const color = new THREE.Color(); - - for (let i = 0, l = divisions; i < l; i++) { - const t = i / l; - - spline.getPoint(t, point); - positions.push(point.x, point.y, point.z); - - color.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); - colors.push(color.r, color.g, color.b); - } - - // Line2 ( LineGeometry, LineMaterial ) - - const geometry = new LineGeometry(); - geometry.setPositions(positions); - geometry.setColors(colors); - - matLine = new LineMaterial({ - color: 0xffffff, - linewidth: 5, // in world units with size attenuation, pixels otherwise - vertexColors: true, - - dashed: false, - alphaToCoverage: true, - }); - - line = new Line2(geometry, matLine); - line.computeLineDistances(); - line.scale.set(1, 1, 1); - scene.add(line); - - // THREE.Line ( THREE.BufferGeometry, THREE.LineBasicMaterial ) - rendered with gl.LINE_STRIP - - const geo = new THREE.BufferGeometry(); - geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - matLineBasic = new THREE.LineBasicMaterial({ vertexColors: true }); - matLineDashed = new THREE.LineDashedMaterial({ vertexColors: true, scale: 2, dashSize: 1, gapSize: 1 }); - - line1 = new THREE.Line(geo, matLineBasic); - line1.computeLineDistances(); - line1.visible = false; - scene.add(line1); - - // - - window.addEventListener('resize', onWindowResize); - onWindowResize(); - - initGui(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - insetWidth = window.innerHeight / 4; // square - insetHeight = window.innerHeight / 4; - - camera2.aspect = insetWidth / insetHeight; - camera2.updateProjectionMatrix(); -} - -function animate() { - // main scene - - renderer.setClearColor(0x000000, 0); - - renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); - - controls.update(); - - renderer.render(scene, camera); - - // inset scene - - renderer.setClearColor(0x222222, 1); - - renderer.clearDepth(); // important! - - renderer.setScissorTest(true); - - renderer.setScissor(20, 20, insetWidth, insetHeight); - - renderer.setViewport(20, 20, insetWidth, insetHeight); - - camera2.position.copy(camera.position); - camera2.quaternion.copy(camera.quaternion); - - renderer.render(scene, camera2); - - renderer.setScissorTest(false); -} - -// - -function initGui() { - gui = new GUI(); - - const param = { - 'line type': 0, - 'world units': false, - width: 10, - alphaToCoverage: false, - dashed: false, - 'dash scale': 1, - 'dash / gap': 1, - }; - - gui.add(param, 'line type', { LineGeometry: 0, 'gl.LINE': 1 }).onChange(function (val) { - switch (val) { - case 0: - line.visible = true; - - line1.visible = false; - - break; - - case 1: - line.visible = false; - - line1.visible = true; - - break; - } - }); - - gui.add(param, 'world units').onChange(function (val) { - matLine.worldUnits = val; - matLine.needsUpdate = true; - - if (val) { - widthController.name('width (world units)').min(0.1).max(0.5).setValue(0.5); - } else { - widthController.name('width (pixels)').min(1).max(10).setValue(10); - } - }); - - const widthController = gui - .add(param, 'width', 1, 10) - .name('width (pixels)') - .onChange(function (val) { - matLine.linewidth = val; - }); - - gui.add(param, 'alphaToCoverage').onChange(function (val) { - matLine.alphaToCoverage = val; - }); - - gui.add(param, 'dashed').onChange(function (val) { - matLine.dashed = val; - line1.material = val ? matLineDashed : matLineBasic; - }); - - gui.add(param, 'dash scale', 0.5, 2, 0.1).onChange(function (val) { - matLine.dashScale = val; - matLineDashed.scale = val; - }); - - gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { - switch (val) { - case 0: - matLine.dashSize = 2; - matLine.gapSize = 1; - - matLineDashed.dashSize = 2; - matLineDashed.gapSize = 1; - - break; - - case 1: - matLine.dashSize = 1; - matLine.gapSize = 1; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 1; - - break; - - case 2: - matLine.dashSize = 1; - matLine.gapSize = 2; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 2; - - break; - } - }); -} diff --git a/examples-testing/examples/webgl_lines_fat_raycasting.ts b/examples-testing/examples/webgl_lines_fat_raycasting.ts deleted file mode 100644 index ac9400da3..000000000 --- a/examples-testing/examples/webgl_lines_fat_raycasting.ts +++ /dev/null @@ -1,280 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; -import { LineSegments2 } from 'three/addons/lines/LineSegments2.js'; -import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; -import { Line2 } from 'three/addons/lines/Line2.js'; -import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; - -let line, thresholdLine, segments, thresholdSegments; -let renderer, scene, camera, controls; -let sphereInter, sphereOnLine; -let gui; -let timer; - -const color = new THREE.Color(); - -const pointer = new THREE.Vector2(Infinity, Infinity); - -const raycaster = new THREE.Raycaster(); - -raycaster.params.Line2 = {}; -raycaster.params.Line2.threshold = 0; - -const matLine = new LineMaterial({ - color: 0xffffff, - linewidth: 1, // in world units with size attenuation, pixels otherwise - worldUnits: true, - vertexColors: true, - - alphaToCoverage: true, -}); - -const matThresholdLine = new LineMaterial({ - color: 0xffffff, - linewidth: matLine.linewidth, // in world units with size attenuation, pixels otherwise - worldUnits: true, - // vertexColors: true, - transparent: true, - opacity: 0.2, - depthTest: false, - visible: false, -}); - -const params = { - 'line type': 0, - 'world units': matLine.worldUnits, - 'visualize threshold': matThresholdLine.visible, - width: matLine.linewidth, - alphaToCoverage: matLine.alphaToCoverage, - threshold: raycaster.params.Line2.threshold, - translation: 0, - animate: true, -}; - -init(); - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setClearColor(0x000000, 0.0); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-40, 0, 60); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 10; - controls.maxDistance = 500; - - const sphereGeometry = new THREE.SphereGeometry(0.25, 8, 4); - const sphereInterMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, depthTest: false }); - const sphereOnLineMaterial = new THREE.MeshBasicMaterial({ color: 0x00ff00, depthTest: false }); - - sphereInter = new THREE.Mesh(sphereGeometry, sphereInterMaterial); - sphereOnLine = new THREE.Mesh(sphereGeometry, sphereOnLineMaterial); - sphereInter.visible = false; - sphereOnLine.visible = false; - sphereInter.renderOrder = 10; - sphereOnLine.renderOrder = 10; - scene.add(sphereInter); - scene.add(sphereOnLine); - - // Position and THREE.Color Data - - const positions = []; - const colors = []; - const points = []; - for (let i = -50; i < 50; i++) { - const t = i / 3; - points.push(new THREE.Vector3(t * Math.sin(2 * t), t, t * Math.cos(2 * t))); - } - - const spline = new THREE.CatmullRomCurve3(points); - const divisions = Math.round(3 * points.length); - const point = new THREE.Vector3(); - const color = new THREE.Color(); - - for (let i = 0, l = divisions; i < l; i++) { - const t = i / l; - - spline.getPoint(t, point); - positions.push(point.x, point.y, point.z); - - color.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); - colors.push(color.r, color.g, color.b); - } - - const lineGeometry = new LineGeometry(); - lineGeometry.setPositions(positions); - lineGeometry.setColors(colors); - - const segmentsGeometry = new LineSegmentsGeometry(); - segmentsGeometry.setPositions(positions); - segmentsGeometry.setColors(colors); - - segments = new LineSegments2(segmentsGeometry, matLine); - segments.computeLineDistances(); - segments.scale.set(1, 1, 1); - scene.add(segments); - segments.visible = false; - - thresholdSegments = new LineSegments2(segmentsGeometry, matThresholdLine); - thresholdSegments.computeLineDistances(); - thresholdSegments.scale.set(1, 1, 1); - scene.add(thresholdSegments); - thresholdSegments.visible = false; - - line = new Line2(lineGeometry, matLine); - line.computeLineDistances(); - line.scale.set(1, 1, 1); - scene.add(line); - - thresholdLine = new Line2(lineGeometry, matThresholdLine); - thresholdLine.computeLineDistances(); - thresholdLine.scale.set(1, 1, 1); - scene.add(thresholdLine); - - const geo = new THREE.BufferGeometry(); - geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - // - - document.addEventListener('pointermove', onPointerMove); - window.addEventListener('resize', onWindowResize); - onWindowResize(); - - initGui(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - const obj = line.visible ? line : segments; - thresholdLine.position.copy(line.position); - thresholdLine.quaternion.copy(line.quaternion); - thresholdSegments.position.copy(segments.position); - thresholdSegments.quaternion.copy(segments.quaternion); - - if (params.animate) { - line.rotation.y += delta * 0.1; - - segments.rotation.y = line.rotation.y; - } - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObject(obj); - - if (intersects.length > 0) { - sphereInter.visible = true; - sphereOnLine.visible = true; - - sphereInter.position.copy(intersects[0].point); - sphereOnLine.position.copy(intersects[0].pointOnLine); - - const index = intersects[0].faceIndex; - const colors = obj.geometry.getAttribute('instanceColorStart'); - - color.fromBufferAttribute(colors, index); - - sphereInter.material.color.copy(color).offsetHSL(0.3, 0, 0); - sphereOnLine.material.color.copy(color).offsetHSL(0.7, 0, 0); - - renderer.domElement.style.cursor = 'crosshair'; - } else { - sphereInter.visible = false; - sphereOnLine.visible = false; - renderer.domElement.style.cursor = ''; - } - - renderer.render(scene, camera); -} - -// - -function switchLine(val) { - switch (val) { - case 0: - line.visible = true; - thresholdLine.visible = true; - - segments.visible = false; - thresholdSegments.visible = false; - - break; - - case 1: - line.visible = false; - thresholdLine.visible = false; - - segments.visible = true; - thresholdSegments.visible = true; - - break; - } -} - -function initGui() { - gui = new GUI(); - - gui.add(params, 'line type', { LineGeometry: 0, LineSegmentsGeometry: 1 }) - .onChange(function (val) { - switchLine(val); - }) - .setValue(1); - - gui.add(params, 'world units').onChange(function (val) { - matLine.worldUnits = val; - matThresholdLine.worldUnits = val; - }); - - gui.add(params, 'visualize threshold').onChange(function (val) { - matThresholdLine.visible = val; - }); - - gui.add(params, 'width', 1, 10).onChange(function (val) { - matLine.linewidth = val; - matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; - }); - - gui.add(params, 'alphaToCoverage').onChange(function (val) { - matLine.alphaToCoverage = val; - }); - - gui.add(params, 'threshold', 0, 10).onChange(function (val) { - raycaster.params.Line2.threshold = val; - matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; - }); - - gui.add(params, 'translation', 0, 10).onChange(function (val) { - line.position.x = val; - segments.position.x = val; - }); - - gui.add(params, 'animate'); -} diff --git a/examples-testing/examples/webgl_lines_fat_wireframe.ts b/examples-testing/examples/webgl_lines_fat_wireframe.ts deleted file mode 100644 index 59660ad7e..000000000 --- a/examples-testing/examples/webgl_lines_fat_wireframe.ts +++ /dev/null @@ -1,210 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; -import { Wireframe } from 'three/addons/lines/Wireframe.js'; -import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; - -let wireframe, renderer, scene, camera, camera2, controls; -let wireframe1; -let matLine, matLineBasic, matLineDashed; -let stats; -let gui; - -// viewport -let insetWidth; -let insetHeight; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setClearColor(0x000000, 0.0); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-50, 0, 50); - - camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); - camera2.position.copy(camera.position); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 10; - controls.maxDistance = 500; - - // Wireframe ( WireframeGeometry2, LineMaterial ) - - let geo = new THREE.IcosahedronGeometry(20, 1); - - const geometry = new WireframeGeometry2(geo); - - matLine = new LineMaterial({ - color: 0x4080ff, - linewidth: 5, // in pixels - dashed: false, - }); - - wireframe = new Wireframe(geometry, matLine); - wireframe.computeLineDistances(); - wireframe.scale.set(1, 1, 1); - scene.add(wireframe); - - // Line ( THREE.WireframeGeometry, THREE.LineBasicMaterial ) - rendered with gl.LINE - - geo = new THREE.WireframeGeometry(geo); - - matLineBasic = new THREE.LineBasicMaterial({ color: 0x4080ff }); - matLineDashed = new THREE.LineDashedMaterial({ scale: 2, dashSize: 1, gapSize: 1 }); - - wireframe1 = new THREE.LineSegments(geo, matLineBasic); - wireframe1.computeLineDistances(); - wireframe1.visible = false; - scene.add(wireframe1); - - // - - window.addEventListener('resize', onWindowResize); - onWindowResize(); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - initGui(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - insetWidth = window.innerHeight / 4; // square - insetHeight = window.innerHeight / 4; - - camera2.aspect = insetWidth / insetHeight; - camera2.updateProjectionMatrix(); -} - -function animate() { - // main scene - - renderer.setClearColor(0x000000, 0); - - renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); - - renderer.render(scene, camera); - - // inset scene - - renderer.setClearColor(0x222222, 1); - - renderer.clearDepth(); // important! - - renderer.setScissorTest(true); - - renderer.setScissor(20, 20, insetWidth, insetHeight); - - renderer.setViewport(20, 20, insetWidth, insetHeight); - - camera2.position.copy(camera.position); - camera2.quaternion.copy(camera.quaternion); - - renderer.render(scene, camera2); - - renderer.setScissorTest(false); - - stats.update(); -} - -// - -function initGui() { - gui = new GUI(); - - const param = { - 'line type': 0, - 'width (px)': 5, - dashed: false, - 'dash scale': 1, - 'dash / gap': 1, - }; - - gui.add(param, 'line type', { LineGeometry: 0, 'gl.LINE': 1 }).onChange(function (val) { - switch (val) { - case 0: - wireframe.visible = true; - - wireframe1.visible = false; - - break; - - case 1: - wireframe.visible = false; - - wireframe1.visible = true; - - break; - } - }); - - gui.add(param, 'width (px)', 1, 10).onChange(function (val) { - matLine.linewidth = val; - }); - - gui.add(param, 'dashed').onChange(function (val) { - matLine.dashed = val; - - // dashed is implemented as a defines -- not as a uniform. this could be changed. - // ... or THREE.LineDashedMaterial could be implemented as a separate material - // temporary hack - renderer should do this eventually - if (val) matLine.defines.USE_DASH = ''; - else delete matLine.defines.USE_DASH; - matLine.needsUpdate = true; - - wireframe1.material = val ? matLineDashed : matLineBasic; - }); - - gui.add(param, 'dash scale', 0.5, 1, 0.1).onChange(function (val) { - matLine.dashScale = val; - matLineDashed.scale = val; - }); - - gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { - switch (val) { - case 0: - matLine.dashSize = 2; - matLine.gapSize = 1; - - matLineDashed.dashSize = 2; - matLineDashed.gapSize = 1; - - break; - - case 1: - matLine.dashSize = 1; - matLine.gapSize = 1; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 1; - - break; - - case 2: - matLine.dashSize = 1; - matLine.gapSize = 2; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 2; - - break; - } - }); -} diff --git a/examples-testing/examples/webgl_loader_3dm.ts b/examples-testing/examples/webgl_loader_3dm.ts deleted file mode 100644 index 292295699..000000000 --- a/examples-testing/examples/webgl_loader_3dm.ts +++ /dev/null @@ -1,94 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer; -let controls, gui; - -init(); - -function init() { - THREE.Object3D.DEFAULT_UP.set(0, 0, 1); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(26, -40, 5); - - scene = new THREE.Scene(); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 6); - directionalLight.position.set(0, 0, 2); - scene.add(directionalLight); - - const loader = new Rhino3dmLoader(); - loader.setLibraryPath('https://cdn.jsdelivr.net/npm/rhino3dm@8.32.1/'); - loader.load( - 'models/3dm/Rhino_Logo.3dm', - function (object) { - scene.add(object); - initGUI(object.userData.layers); - - // hide spinner - document.getElementById('loader').style.display = 'none'; - }, - function (progress) { - console.log((progress.loaded / progress.total) * 100 + '%'); - }, - function (error) { - console.log(error); - }, - ); - - controls = new OrbitControls(camera, renderer.domElement); - - window.addEventListener('resize', resize); -} - -function resize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - renderer.render(scene, camera); -} - -function initGUI(layers) { - gui = new GUI({ title: 'layers' }); - - for (let i = 0; i < layers.length; i++) { - const layer = layers[i]; - gui.add(layer, 'visible') - .name(layer.name) - .onChange(function (val) { - const name = this.object.name; - - scene.traverse(function (child) { - if (child.userData.hasOwnProperty('attributes')) { - if ('layerIndex' in child.userData.attributes) { - const layerName = layers[child.userData.attributes.layerIndex].name; - - if (layerName === name) { - child.visible = val; - layer.visible = val; - } - } - } - }); - }); - } -} diff --git a/examples-testing/examples/webgl_loader_3ds.ts b/examples-testing/examples/webgl_loader_3ds.ts deleted file mode 100644 index 10ce34076..000000000 --- a/examples-testing/examples/webgl_loader_3ds.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as THREE from 'three'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { TDSLoader } from 'three/addons/loaders/TDSLoader.js'; - -let container, controls; -let camera, scene, renderer; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.z = 2; - - scene = new THREE.Scene(); - scene.add(new THREE.AmbientLight(0xffffff, 3)); - - const directionalLight = new THREE.DirectionalLight(0xffeedd, 3); - directionalLight.position.set(0, 0, 2); - scene.add(directionalLight); - - //3ds files dont store normal maps - const normal = new THREE.TextureLoader().load('models/3ds/portalgun/textures/normal.jpg'); - - const loader = new TDSLoader(); - loader.setResourcePath('models/3ds/portalgun/textures/'); - loader.load('models/3ds/portalgun/portalgun.3ds', function (object) { - object.traverse(function (child) { - if (child.isMesh) { - child.material.specular.setScalar(0.1); - child.material.normalMap = normal; - } - }); - - scene.add(object); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - controls = new TrackballControls(camera, renderer.domElement); - - window.addEventListener('resize', resize); -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_3mf.ts b/examples-testing/examples/webgl_loader_3mf.ts deleted file mode 100644 index 83fac845e..000000000 --- a/examples-testing/examples/webgl_loader_3mf.ts +++ /dev/null @@ -1,113 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, object, loader, controls; - -const params = { - asset: 'cube_gears', -}; - -const assets = [ - 'cube_gears', - 'facecolors', - 'multipletextures', - 'pyramid', - 'spinal implant', - 'variable voronoi', - 'vertexcolors', -]; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x333333); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); - - // Z is up for objects intended to be 3D printed. - - camera.up.set(0, 0, 1); - camera.position.set(-100, -250, 100); - scene.add(camera); - - controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.minDistance = 50; - controls.maxDistance = 400; - controls.enablePan = false; - controls.update(); - - scene.add(new THREE.AmbientLight(0xffffff, 0.6)); - - const light = new THREE.DirectionalLight(0xffffff, 2); - light.position.set(-1, -2.5, 1); - scene.add(light); - - const manager = new THREE.LoadingManager(); - - manager.onLoad = function () { - const aabb = new THREE.Box3().setFromObject(object); - const center = aabb.getCenter(new THREE.Vector3()); - - object.position.x += object.position.x - center.x; - object.position.y += object.position.y - center.y; - object.position.z += object.position.z - center.z; - - controls.reset(); - - scene.add(object); - render(); - }; - - loader = new ThreeMFLoader(manager); - loadAsset(params.asset); - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - gui.add(params, 'asset', assets).onChange(function (value) { - loadAsset(value); - }); -} - -function loadAsset(asset) { - loader.load('models/3mf/' + asset + '.3mf', function (group) { - if (object) { - object.traverse(function (child) { - if (child.material) child.material.dispose(); - if (child.material && child.material.map) child.material.map.dispose(); - if (child.geometry) child.geometry.dispose(); - }); - - scene.remove(object); - } - - // - - object = group; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_3mf_materials.ts b/examples-testing/examples/webgl_loader_3mf_materials.ts deleted file mode 100644 index b33ffc3e0..000000000 --- a/examples-testing/examples/webgl_loader_3mf_materials.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; - -let camera, scene, renderer; - -init(); - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 10, 500); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); - camera.position.set(-50, 40, 50); - scene.add(camera); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 3); - hemiLight.position.set(0, 100, 0); - scene.add(hemiLight); - - const sunLight = new THREE.SunLight(0xffffff, 3); - sunLight.position.set(0, 40, 50); - sunLight.castShadow = true; - sunLight.shadow.camera.far = 100; - scene.add(sunLight); - - // - - const manager = new THREE.LoadingManager(); - - const loader = new ThreeMFLoader(manager); - loader.load('./models/3mf/truck.3mf', function (object) { - object.rotation.set(-Math.PI / 2, 0, 0); // z-up conversion - - object.traverse(function (child) { - child.castShadow = true; - }); - - scene.add(object); - }); - - // - - manager.onLoad = function () { - render(); - }; - - // - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(1000, 1000), - new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), - ); - ground.rotation.x = -Math.PI / 2; - ground.position.y = 11; - ground.receiveShadow = true; - scene.add(ground); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - document.body.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.minDistance = 50; - controls.maxDistance = 200; - controls.enablePan = false; - controls.target.set(0, 20, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); - - render(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_amf.ts b/examples-testing/examples/webgl_loader_amf.ts deleted file mode 100644 index ee576e04f..000000000 --- a/examples-testing/examples/webgl_loader_amf.ts +++ /dev/null @@ -1,62 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { AMFLoader } from 'three/addons/loaders/AMFLoader.js'; - -let camera, scene, renderer; - -init(); - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x999999); - - scene.add(new THREE.AmbientLight(0x999999)); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); - - // Z is up for objects intended to be 3D printed. - - camera.up.set(0, 0, 1); - camera.position.set(0, -9, 6); - - camera.add(new THREE.PointLight(0xffffff, 250)); - - scene.add(camera); - - const grid = new THREE.GridHelper(50, 50, 0xffffff, 0x555555); - grid.rotateOnAxis(new THREE.Vector3(1, 0, 0), 90 * (Math.PI / 180)); - scene.add(grid); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - const loader = new AMFLoader(); - loader.load('./models/amf/rook.amf', function (amfobject) { - scene.add(amfobject); - render(); - }); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.target.set(0, 0, 2); - controls.enableZoom = false; - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_bvh.ts b/examples-testing/examples/webgl_loader_bvh.ts deleted file mode 100644 index 70cec7e6a..000000000 --- a/examples-testing/examples/webgl_loader_bvh.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { BVHLoader } from 'three/addons/loaders/BVHLoader.js'; - -const timer = new THREE.Timer(); -timer.connect(document); - -let camera, controls, scene, renderer; -let mixer; - -init(); - -const loader = new BVHLoader(); -loader.load('models/bvh/pirouette.bvh', function (result) { - const skeletonHelper = new THREE.SkeletonHelper(result.skeleton.bones[0]); - - scene.add(result.skeleton.bones[0]); - scene.add(skeletonHelper); - - // play animation - mixer = new THREE.AnimationMixer(result.skeleton.bones[0]); - mixer.clipAction(result.clip).play(); -}); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 200, 300); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xeeeeee); - - scene.add(new THREE.GridHelper(400, 10)); - - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 300; - controls.maxDistance = 700; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_collada.ts b/examples-testing/examples/webgl_loader_collada.ts deleted file mode 100644 index 3106369c8..000000000 --- a/examples-testing/examples/webgl_loader_collada.ts +++ /dev/null @@ -1,86 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js'; - -let container, stats, timer; -let camera, scene, renderer, elf; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); - camera.position.set(8, 10, 8); - camera.lookAt(0, 3, 0); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // loading manager - - const loadingManager = new THREE.LoadingManager(function () { - scene.add(elf); - }); - - // collada - - const loader = new ColladaLoader(loadingManager); - loader.load('./models/collada/elf/elf.dae', function (collada) { - elf = collada.scene; - }); - - // - - const ambientLight = new THREE.AmbientLight(0xffffff); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 2.5); - directionalLight.position.set(1, 1, 0).normalize(); - scene.add(directionalLight); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - const delta = timer.getDelta(); - - if (elf !== undefined) { - elf.rotation.z += delta * 0.5; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_collada_skinning.ts b/examples-testing/examples/webgl_loader_collada_skinning.ts deleted file mode 100644 index bbbd0ac3e..000000000 --- a/examples-testing/examples/webgl_loader_collada_skinning.ts +++ /dev/null @@ -1,100 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { ColladaLoader } from 'three/addons/loaders/ColladaLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container, stats, timer, controls; -let camera, scene, renderer, mixer; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(15, 10, -15); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // collada - - const loader = new ColladaLoader(); - loader.load('./models/collada/stormtrooper/stormtrooper.dae', function (collada) { - const avatar = collada.scene; - const animations = avatar.animations; - - mixer = new THREE.AnimationMixer(avatar); - mixer.clipAction(animations[0]).play(); - - scene.add(avatar); - }); - - // - - const gridHelper = new THREE.GridHelper(10, 20, 0xc1c1c1, 0x8d8d8d); - scene.add(gridHelper); - - // - - const ambientLight = new THREE.AmbientLight(0xffffff, 0.6); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 3); - directionalLight.position.set(1.5, 1, -1.5); - scene.add(directionalLight); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.screenSpacePanning = true; - controls.minDistance = 5; - controls.maxDistance = 40; - controls.target.set(0, 2, 0); - controls.update(); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - const delta = timer.getDelta(); - - if (mixer !== undefined) { - mixer.update(delta); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_draco.ts b/examples-testing/examples/webgl_loader_draco.ts deleted file mode 100644 index 4d41740e6..000000000 --- a/examples-testing/examples/webgl_loader_draco.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as THREE from 'three'; - -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; - -let camera, scene, renderer; - -const container = document.querySelector('#container'); - -// Configure and create Draco decoder. -const dracoLoader = new DRACOLoader(); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 15); - camera.position.set(3, 0.25, 3); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x443333); - scene.fog = new THREE.Fog(0x443333, 1, 4); - - // Ground - const plane = new THREE.Mesh(new THREE.PlaneGeometry(8, 8), new THREE.MeshLambertMaterial({ color: 0xcbcbcb })); - plane.rotation.x = -Math.PI / 2; - plane.position.y = 0.03; - plane.receiveShadow = true; - scene.add(plane); - - // Lights - const hemiLight = new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3); - scene.add(hemiLight); - - const spotLight = new THREE.SpotLight(); - spotLight.intensity = 7; - spotLight.angle = Math.PI / 16; - spotLight.penumbra = 0.5; - spotLight.castShadow = true; - spotLight.shadow.radius = 8; - spotLight.position.set(-1, 1, 1); - scene.add(spotLight); - - dracoLoader.load('models/draco/bunny.drc', function (geometry) { - geometry.computeVertexNormals(); - - const material = new THREE.MeshStandardMaterial({ color: 0xa5a5a5 }); - const mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - mesh.receiveShadow = true; - scene.add(mesh); - - // Release decoder resources. - dracoLoader.dispose(); - }); - - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const timer = Date.now() * 0.0003; - - camera.position.x = Math.sin(timer) * 0.5; - camera.position.z = Math.cos(timer) * 0.5; - camera.lookAt(0, 0.1, 0); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_fbx.ts b/examples-testing/examples/webgl_loader_fbx.ts deleted file mode 100644 index 01e72722a..000000000 --- a/examples-testing/examples/webgl_loader_fbx.ts +++ /dev/null @@ -1,216 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -const manager = new THREE.LoadingManager(); - -let camera, scene, renderer, controls, stats, object, loader, guiMorphsFolder, guiAnimationsFolder; -let mixer; - -const timer = new THREE.Timer(); -timer.connect(document); - -const params = { - asset: 'Samba Dancing', -}; - -const assets = [ - 'Samba Dancing', - 'morph_test', - 'monkey', - 'monkey_embedded_texture', - 'vCube', - 'archer/ArcherRi01', - 'warrior/Warrior', - 'stanford-bunny', - 'mixamo', - 'RotationTest', - 'exampleWindow', - 'Head_69', - 'morph-translation', - 'ball_anims_asc_2018', -]; - -const scales = new Map(); -scales.set('warrior/Warrior', 100); -scales.set('archer/ArcherRi01', 100); -scales.set('stanford-bunny', 0.001); -scales.set('Head_69', 100); -scales.set('ball_anims_asc_2018', 50); - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(100, 200, 300); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 200, 1000); - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 5); - hemiLight.position.set(0, 200, 0); - scene.add(hemiLight); - - const sunLight = new THREE.SunLight(0xffffff, 5); - sunLight.position.set(0, 200, 100); - sunLight.castShadow = true; - scene.add(sunLight); - - // ground - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(2000, 2000), - new THREE.MeshPhongMaterial({ color: 0x999999, depthWrite: false }), - ); - mesh.rotation.x = -Math.PI / 2; - mesh.receiveShadow = true; - scene.add(mesh); - - const grid = new THREE.GridHelper(2000, 20, 0x000000, 0x000000); - grid.material.opacity = 0.2; - grid.material.transparent = true; - scene.add(grid); - - loader = new FBXLoader(manager); - loadAsset(params.asset); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - container.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enablePan = false; - controls.enableDamping = true; - controls.target.set(0, 100, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); - - // stats - stats = new Stats(); - container.appendChild(stats.dom); - - const gui = new GUI(); - gui.add(params, 'asset', assets).onChange(function (value) { - loadAsset(value); - }); - - guiMorphsFolder = gui.addFolder('Morphs').hide(); - guiAnimationsFolder = gui.addFolder('Animations').hide(); -} - -function loadAsset(asset) { - loader.trimAnimationClips = asset === 'ball_anims_asc_2018'; - - loader.load('models/fbx/' + asset + '.fbx', function (group) { - if (object) { - object.traverse(function (child) { - if (child.isSkinnedMesh) { - child.skeleton.dispose(); - } - - if (child.material) { - const materials = Array.isArray(child.material) ? child.material : [child.material]; - materials.forEach(material => { - if (material.map) material.map.dispose(); - material.dispose(); - }); - } - - if (child.geometry) child.geometry.dispose(); - }); - - scene.remove(object); - } - - // - - object = group; - - const scale = scales.get(asset); - object.scale.setScalar(scale || 1); - - guiAnimationsFolder.children.forEach(child => child.destroy()); - guiAnimationsFolder.hide(); - - if (object.animations && object.animations.length) { - mixer = new THREE.AnimationMixer(object); - - const action = mixer.clipAction(object.animations[0]); - action.play(); - - const clips = object.animations; - const animationParams = { clip: clips[0].name }; - - guiAnimationsFolder.show(); - guiAnimationsFolder - .add( - animationParams, - 'clip', - clips.map(clip => clip.name), - ) - .onChange(function (name) { - mixer.stopAllAction(); - - const clip = THREE.AnimationClip.findByName(clips, name); - mixer.clipAction(clip).play(); - }); - } else { - mixer = null; - } - - guiMorphsFolder.children.forEach(child => child.destroy()); - guiMorphsFolder.hide(); - - object.traverse(function (child) { - if (child.isMesh) { - child.castShadow = true; - child.receiveShadow = true; - - if (child.morphTargetDictionary) { - guiMorphsFolder.show(); - const meshFolder = guiMorphsFolder.addFolder(child.name || child.uuid); - Object.keys(child.morphTargetDictionary).forEach(key => { - meshFolder.add(child.morphTargetInfluences, child.morphTargetDictionary[key], 0, 1, 0.01); - }); - } - } - }); - - scene.add(object); - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - controls.update(); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_loader_fbx_nurbs.ts b/examples-testing/examples/webgl_loader_fbx_nurbs.ts deleted file mode 100644 index f2e45bcb5..000000000 --- a/examples-testing/examples/webgl_loader_fbx_nurbs.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; - -let camera, scene, renderer, stats; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(2, 18, 28); - - scene = new THREE.Scene(); - - // grid - const gridHelper = new THREE.GridHelper(28, 28, 0x303030, 0x303030); - scene.add(gridHelper); - - // stats - stats = new Stats(); - container.appendChild(stats.dom); - - // model - const loader = new FBXLoader(); - loader.load('models/fbx/nurbs.fbx', function (object) { - scene.add(object); - }); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 12, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_loader_gcode.ts b/examples-testing/examples/webgl_loader_gcode.ts deleted file mode 100644 index 16dfb92e2..000000000 --- a/examples-testing/examples/webgl_loader_gcode.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, controls, loader; - -let model; - -const params = { - asset: 'benchy', -}; - -const assets = ['benchy', 'test_m82', 'test_m83']; - -const positions = [new THREE.Vector3(-100, -20, 100), new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, 0)]; - -init(); -render(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 70); - - scene = new THREE.Scene(); - - loader = new GCodeLoader(); - loadAsset(params.asset); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 10; - controls.maxDistance = 100; - - window.addEventListener('resize', resize); - - const gui = new GUI(); - - gui.add(params, 'asset', assets).onChange(function (value) { - if (model) { - model.traverse(function (object) { - if (object.material) object.material.dispose(); - if (object.geometry) object.geometry.dispose(); - }); - - scene.remove(model); - } - - loadAsset(value); - }); - - gui.open(); -} - -function loadAsset(asset) { - loader.load('models/gcode/' + asset + '.gcode', function (object) { - model = object; - model.position.copy(positions[assets.indexOf(asset)]); - scene.add(model); - controls.reset(); - }); -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf.ts b/examples-testing/examples/webgl_loader_gltf.ts deleted file mode 100644 index e0cb68546..000000000 --- a/examples-testing/examples/webgl_loader_gltf.ts +++ /dev/null @@ -1,167 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, controls; -let currentModel, mixer; -let currentLoadId = 0; - -const timer = new THREE.Timer(); - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - render(); - - // model - - fetch('https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json') - .then(response => response.json()) - .then(models => { - const gui = new GUI(); - const modelNames = models.map(m => m.name); - const params = { model: 'DamagedHelmet' }; - - if (!modelNames.includes(params.model) && modelNames.length > 0) { - params.model = modelNames[0]; - } - - gui.add(params, 'model', modelNames).onChange(name => { - const modelInfo = models.find(m => m.name === name); - loadModel(modelInfo); - }); - - gui.add(scene, 'backgroundBlurriness', 0, 1); - - const initialModel = models.find(m => m.name === params.model); - if (initialModel) loadModel(initialModel); - }); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - container.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2; - controls.maxDistance = 10; - controls.target.set(0, 0, -0.2); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function loadModel(modelInfo) { - const variants = modelInfo.variants; - const variant = variants['glTF-Binary'] || variants['glTF']; - const url = `https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/${modelInfo.name}/${variant.endsWith('.glb') ? 'glTF-Binary' : 'glTF'}/${variant}`; - - if (currentModel) { - scene.remove(currentModel); - currentModel = null; - } - - if (mixer) { - mixer.stopAllAction(); - mixer = null; - } - - const loadId = ++currentLoadId; - - const loader = new GLTFLoader(); - loader.load(url, async function (gltf) { - if (loadId !== currentLoadId) return; - - currentModel = gltf.scene; - - // wait until the model can be added to the scene without blocking due to shader compilation - - await renderer.compileAsync(currentModel, camera, scene); - - if (loadId !== currentLoadId) return; - - scene.add(currentModel); - - fitCameraToSelection(camera, controls, currentModel); - - // animations - - if (gltf.animations.length > 0) { - mixer = new THREE.AnimationMixer(currentModel); - - for (const animation of gltf.animations) { - mixer.clipAction(animation).play(); - } - } - }); -} - -function fitCameraToSelection(camera, controls, selection, fitOffset = 1.3) { - const box = new THREE.Box3(); - box.setFromObject(selection); - - const size = box.getSize(new THREE.Vector3()); - const center = box.getCenter(new THREE.Vector3()); - - const maxSize = Math.max(size.x, size.y, size.z); - const fitHeightDistance = maxSize / (2 * Math.atan((Math.PI * camera.fov) / 360)); - // const fitWidthDistance = fitHeightDistance / camera.aspect; - // const distance = fitOffset * Math.max( fitHeightDistance, fitWidthDistance ); - const distance = fitOffset * fitHeightDistance; - - const direction = controls.target.clone().sub(camera.position).normalize().multiplyScalar(distance); - - controls.maxDistance = distance * 10; - controls.minDistance = distance / 10; - controls.target.copy(center); - - camera.near = distance / 100; - camera.far = distance * 100; - camera.updateProjectionMatrix(); - - camera.position.copy(controls.target).sub(direction); - - controls.update(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -// - -function render() { - timer.update(); - - controls.update(); - - if (mixer) mixer.update(timer.getDelta()); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_animation_pointer.ts b/examples-testing/examples/webgl_loader_gltf_animation_pointer.ts deleted file mode 100644 index 7f94fafdd..000000000 --- a/examples-testing/examples/webgl_loader_gltf_animation_pointer.ts +++ /dev/null @@ -1,91 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; -import { GLTFAnimationPointerExtension } from '@needle-tools/three-animation-pointer'; - -let mixer; - -const timer = new THREE.Timer(); -timer.connect(document); -const container = document.getElementById('container'); - -const stats = new Stats(); -container.appendChild(stats.dom); - -const renderer = new THREE.WebGLRenderer({ antialias: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -container.appendChild(renderer.domElement); - -const pmremGenerator = new THREE.PMREMGenerator(renderer); - -const scene = new THREE.Scene(); -scene.background = new THREE.Color(0xbfe3dd); -scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - -const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.2, 100); -camera.position.set(-3, 2, 6); - -const controls = new OrbitControls(camera, renderer.domElement); -controls.target.set(0, 0.5, 0); -controls.update(); -controls.enablePan = false; -controls.enableDamping = true; - -const dracoLoader = new DRACOLoader(); -dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - -const ktx2Loader = new KTX2Loader().detectSupport(renderer); - -const loader = new GLTFLoader(); -loader.setDRACOLoader(dracoLoader); -loader.setKTX2Loader(ktx2Loader); - -loader.register(p => { - return new GLTFAnimationPointerExtension(p); -}); - -loader.load( - 'https://cloud.needle.tools/-/assets/Z23hmXB27L6Db-optimized/file', - function (gltf) { - const model = gltf.scene; - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - mixer.clipAction(gltf.animations[0]).play(); - - renderer.setAnimationLoop(animate); - }, - undefined, - function (e) { - console.error(e); - }, -); - -window.onresize = function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -}; - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - mixer.update(delta); - - controls.update(); - - stats.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_anisotropy.ts b/examples-testing/examples/webgl_loader_gltf_anisotropy.ts deleted file mode 100644 index f0dd05cfe..000000000 --- a/examples-testing/examples/webgl_loader_gltf_anisotropy.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -let renderer, scene, camera, controls; - -init(); - -async function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.35; - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.set(-0.35, -0.2, 0.35); - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, -0.08, 0.11); - controls.minDistance = 0.1; - controls.maxDistance = 2; - controls.addEventListener('change', render); - controls.update(); - - const hdrLoader = new UltraHDRLoader().setPath('textures/equirectangular/'); - const gltfLoader = new GLTFLoader().setPath('models/gltf/'); - - const [texture, gltf] = await Promise.all([ - hdrLoader.loadAsync('royal_esplanade_2k.hdr.jpg'), - gltfLoader.loadAsync('AnisotropyBarnLamp.glb'), - ]); - - // environment - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.backgroundBlurriness = 0.5; - scene.environment = texture; - - // model - - scene.add(gltf.scene); - - render(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_avif.ts b/examples-testing/examples/webgl_loader_gltf_avif.ts deleted file mode 100644 index 516987a9c..000000000 --- a/examples-testing/examples/webgl_loader_gltf_avif.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -let camera, scene, renderer; - -init(); -render(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(1.5, 4, 9); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf6eedc); - - // - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - loader.setPath('models/gltf/AVIFTest/'); - loader.load('forest_house.glb', function (gltf) { - scene.add(gltf.scene); - - render(); - }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.target.set(0, 2, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_compressed.ts b/examples-testing/examples/webgl_loader_gltf_compressed.ts deleted file mode 100644 index 24dec183d..000000000 --- a/examples-testing/examples/webgl_loader_gltf_compressed.ts +++ /dev/null @@ -1,83 +0,0 @@ -import * as THREE from 'three'; - -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; -import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; - -let camera, scene, renderer; - -init(); -render(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - container.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(0, 100, 0); - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbbbbbb); - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - environment.dispose(); - - const grid = new THREE.GridHelper(500, 10, 0xffffff, 0xffffff); - grid.material.opacity = 0.5; - grid.material.depthWrite = false; - grid.material.transparent = true; - scene.add(grid); - - const ktx2Loader = new KTX2Loader().detectSupport(renderer); - - const loader = new GLTFLoader().setPath('models/gltf/'); - loader.setKTX2Loader(ktx2Loader); - loader.setMeshoptDecoder(MeshoptDecoder); - loader.load('coffeemat.glb', function (gltf) { - // coffeemat.glb was produced from the source scene using gltfpack: - // gltfpack -i coffeemat/scene.gltf -o coffeemat.glb -cc -tc - // The resulting model uses EXT_meshopt_compression (for geometry) and KHR_texture_basisu (for texture compression using ETC1S/BasisLZ) - - gltf.scene.position.y = 8; - - scene.add(gltf.scene); - - render(); - }); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 400; - controls.maxDistance = 1000; - controls.target.set(10, 90, -16); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_dispersion.ts b/examples-testing/examples/webgl_loader_gltf_dispersion.ts deleted file mode 100644 index 0f1d7e57a..000000000 --- a/examples-testing/examples/webgl_loader_gltf_dispersion.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -let camera, scene, renderer; - -init().then(render); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 5); - camera.position.set(0.1, 0.05, 0.15); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1; - container.appendChild(renderer.domElement); - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.backgroundBlurriness = 0.5; - - const env = pmremGenerator.fromScene(environment, 0.04).texture; - scene.background = env; - scene.environment = env; - environment.dispose(); - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/DispersionTest.glb'); - - scene.add(gltf.scene); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 0.1; - controls.maxDistance = 10; - controls.target.set(0, 0, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_instancing.ts b/examples-testing/examples/webgl_loader_gltf_instancing.ts deleted file mode 100644 index 6acb140ec..000000000 --- a/examples-testing/examples/webgl_loader_gltf_instancing.ts +++ /dev/null @@ -1,69 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -let camera, scene, renderer; - -init(); -render(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-0.9, 0.41, -0.89); - - scene = new THREE.Scene(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - render(); - - // model - - const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF-instancing/'); - loader.load('DamagedHelmetGpuInstancing.gltf', function (gltf) { - scene.add(gltf.scene); - - render(); - }); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 0.2; - controls.maxDistance = 10; - controls.target.set(0, 0.25, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_iridescence.ts b/examples-testing/examples/webgl_loader_gltf_iridescence.ts deleted file mode 100644 index 5519835fe..000000000 --- a/examples-testing/examples/webgl_loader_gltf_iridescence.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let renderer, scene, camera, controls; - -init().catch(function (err) { - console.error(err); -}); - -async function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setAnimationLoop(animate); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.05, 20); - camera.position.set(0.35, 0.05, 0.35); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = -0.5; - controls.target.set(0, 0.2, 0); - controls.update(); - - const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); - - const gltfLoader = new GLTFLoader().setPath('models/gltf/'); - - const [texture, gltf] = await Promise.all([ - hdrLoader.loadAsync('venice_sunset_1k.hdr'), - gltfLoader.loadAsync('IridescenceLamp.glb'), - ]); - - // environment - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - // model - - scene.add(gltf.scene); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_progressive_lod.ts b/examples-testing/examples/webgl_loader_gltf_progressive_lod.ts deleted file mode 100644 index 8d1c60480..000000000 --- a/examples-testing/examples/webgl_loader_gltf_progressive_lod.ts +++ /dev/null @@ -1,143 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { useNeedleProgressive } from '@needle-tools/gltf-progressive'; - -let camera, scene, renderer, mixer; -let airshipModel; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 40); - camera.position.set(-9, 2, -13); - - const fog = new THREE.Fog('#131055', 15, 50); - scene.fog = fog; - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 0.1; - controls.maxDistance = 20; - controls.target.set(-1, 2.1, 0); - controls.update(); - - new HDRLoader().setPath('textures/equirectangular/').load('quarry_01_1k.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = new THREE.Color('#192022'); - scene.backgroundBlurriness = 0.5; - scene.environment = texture; - scene.environmentRotation = new THREE.Euler(0, Math.PI / -2, 0, 'XYZ'); - }); - - mixer = new THREE.AnimationMixer(scene); - - const loader = new GLTFLoader(); - - useNeedleProgressive(loader, renderer); - - loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ2sPRdk-world/file', function (gltf) { - const model = gltf.scene; - - model.scale.multiplyScalar(0.1); - - scene.add(model); - - const animations = gltf.animations; - if (animations && animations.length) { - for (const animation of animations) { - mixer.clipAction(animation).play(); - } - } - }); - - loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZnlceI-ZnlceI-world/file', function (gltf) { - const model = gltf.scene; - - model.scale.multiplyScalar(0.0005); - - model.position.set(1.6, 6, 7); - - model.rotation.set(0, Math.PI * 1.4, 0); - - scene.add(model); - - airshipModel = model; - - const animations = gltf.animations; - - if (animations && animations.length) { - for (const animation of animations) { - mixer.clipAction(animation).play(); - } - } - }); - - loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ21QnG-Z21QnG-product/file', function (gltf) { - const model = gltf.scene; - - model.scale.multiplyScalar(0.5); - - model.position.set(2, 5.15, 2.3); - - model.rotation.set(0, Math.PI * 1, 0); - - scene.add(model); - - const animations = gltf.animations; - if (animations && animations.length) { - for (const animation of animations) { - mixer.clipAction(animation).play(); - } - } - }); - - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -const timer = new THREE.Timer(); -timer.connect(document); -let time = 0; - -function animate() { - timer.update(); - - const dt = timer.getDelta(); - time += dt; - - mixer.update(dt); - - if (airshipModel) { - airshipModel.position.y += Math.sin(time) * 0.002; - } - - renderer.render(scene, camera); - - window.requestAnimationFrame(animate); -} - -animate(); diff --git a/examples-testing/examples/webgl_loader_gltf_sheen.ts b/examples-testing/examples/webgl_loader_gltf_sheen.ts deleted file mode 100644 index b058f1e27..000000000 --- a/examples-testing/examples/webgl_loader_gltf_sheen.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, controls; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); - camera.position.set(-0.75, 0.7, 1.25); - - scene = new THREE.Scene(); - - // model - - new GLTFLoader().setPath('models/gltf/').load('SheenChair.glb', function (gltf) { - scene.add(gltf.scene); - - const object = gltf.scene.getObjectByName('SheenChair_fabric'); - - const gui = new GUI(); - - gui.add(object.material, 'sheen', 0, 1); - gui.open(); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - container.appendChild(renderer.domElement); - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.background = new THREE.Color(0xbbbbbb); - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 1; - controls.maxDistance = 10; - controls.target.set(0, 0.35, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - controls.update(); // required if damping enabled - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_gltf_transmission.ts b/examples-testing/examples/webgl_loader_gltf_transmission.ts deleted file mode 100644 index 418bb373d..000000000 --- a/examples-testing/examples/webgl_loader_gltf_transmission.ts +++ /dev/null @@ -1,83 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -let camera, scene, renderer, controls, timer, mixer; - -init(); - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(0, 0.4, 0.7); - - scene = new THREE.Scene(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.backgroundBlurriness = 0.35; - - scene.environment = texture; - - // model - - new GLTFLoader() - .setPath('models/gltf/') - .setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)) - .load('IridescentDishWithOlives.glb', function (gltf) { - mixer = new THREE.AnimationMixer(gltf.scene); - mixer.clipAction(gltf.animations[0]).play(); - - scene.add(gltf.scene); - }); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - container.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = -0.75; - controls.enableDamping = true; - controls.minDistance = 0.5; - controls.maxDistance = 1; - controls.target.set(0, 0.1, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - if (mixer) mixer.update(timer.getDelta()); - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_imagebitmap.ts b/examples-testing/examples/webgl_loader_imagebitmap.ts deleted file mode 100644 index c02a03e17..000000000 --- a/examples-testing/examples/webgl_loader_imagebitmap.ts +++ /dev/null @@ -1,113 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; -let group, cubes; - -init(); - -function addImageBitmap() { - new THREE.ImageBitmapLoader().setOptions({ imageOrientation: 'flipY' }).load( - 'textures/planets/earth_atmos_2048.jpg?' + performance.now(), - function (imageBitmap) { - const texture = new THREE.CanvasTexture(imageBitmap); - texture.colorSpace = THREE.SRGBColorSpace; - const material = new THREE.MeshBasicMaterial({ map: texture }); - - // ImageBitmap should be disposed when done with it. - - texture.onUpdate = disposeImageBitmap; - - addCube(material); - }, - function (p) { - console.log(p); - }, - function (e) { - console.log(e); - }, - ); -} - -function addImage() { - new THREE.ImageLoader() - .setCrossOrigin('*') - .load('textures/planets/earth_atmos_2048.jpg?' + performance.now(), function (image) { - const texture = new THREE.CanvasTexture(image); - texture.colorSpace = THREE.SRGBColorSpace; - const material = new THREE.MeshBasicMaterial({ color: 0xff8888, map: texture }); - addCube(material); - }); -} - -const geometry = new THREE.BoxGeometry(); - -function addCube(material) { - const cube = new THREE.Mesh(geometry, material); - cube.position.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); - cube.rotation.set(Math.random() * 2 * Math.PI, Math.random() * 2 * Math.PI, Math.random() * 2 * Math.PI); - cubes.add(cube); -} - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - // CAMERA - - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1500); - camera.position.set(0, 4, 7); - camera.lookAt(0, 0, 0); - - // SCENE - - scene = new THREE.Scene(); - - // - - group = new THREE.Group(); - scene.add(group); - - group.add(new THREE.GridHelper(4, 12, 0x888888, 0x444444)); - - cubes = new THREE.Group(); - group.add(cubes); - - // RENDERER - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // TESTS - - setTimeout(addImage, 300); - setTimeout(addImage, 600); - setTimeout(addImage, 900); - setTimeout(addImageBitmap, 1300); - setTimeout(addImageBitmap, 1600); - setTimeout(addImageBitmap, 1900); - - // EVENTS - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - group.rotation.y = performance.now() / 3000; - - renderer.render(scene, camera); -} - -function disposeImageBitmap(texture) { - texture.source.data.close(); - texture.onUpdate = null; // make sure this callback is executed only once per texture -} diff --git a/examples-testing/examples/webgl_loader_kmz.ts b/examples-testing/examples/webgl_loader_kmz.ts deleted file mode 100644 index f93555e41..000000000 --- a/examples-testing/examples/webgl_loader_kmz.ts +++ /dev/null @@ -1,59 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { KMZLoader } from 'three/addons/loaders/KMZLoader.js'; - -let camera, scene, renderer; - -init(); - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x999999); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0.5, 1.0, 0.5).normalize(); - - scene.add(light); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 500); - - camera.position.y = 5; - camera.position.z = 10; - - scene.add(camera); - - const grid = new THREE.GridHelper(50, 50, 0xffffff, 0x7b7b7b); - scene.add(grid); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - const loader = new KMZLoader(); - loader.load('./models/kmz/Box.kmz', function (kmz) { - kmz.scene.position.y = 0.5; - scene.add(kmz.scene); - render(); - }); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_md2_control.ts b/examples-testing/examples/webgl_loader_md2_control.ts deleted file mode 100644 index df1eb6b3c..000000000 --- a/examples-testing/examples/webgl_loader_md2_control.ts +++ /dev/null @@ -1,278 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js'; -import { Gyroscope } from 'three/addons/misc/Gyroscope.js'; - -let SCREEN_WIDTH = window.innerWidth; -let SCREEN_HEIGHT = window.innerHeight; - -let container, stats; -let camera, scene, renderer; - -const characters = []; -let nCharacters = 0; - -let cameraControls; - -const controls = { - moveForward: false, - moveBackward: false, - moveLeft: false, - moveRight: false, -}; - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // CAMERA - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 4000); - camera.position.set(0, 150, 1300); - - // SCENE - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - scene.fog = new THREE.Fog(0xffffff, 1000, 4000); - - scene.add(camera); - - // LIGHTS - - scene.add(new THREE.AmbientLight(0x666666, 3)); - - const sunLight = new THREE.SunLight(0xffffff, 7); - sunLight.position.set(200, 450, 500); - sunLight.castShadow = true; - sunLight.shadow.camera.far = 2000; - scene.add(sunLight); - - // GROUND - - const gt = new THREE.TextureLoader().load('textures/terrain/grasslight-big.jpg'); - const gg = new THREE.PlaneGeometry(16000, 16000); - const gm = new THREE.MeshPhongMaterial({ color: 0xffffff, map: gt }); - - const ground = new THREE.Mesh(gg, gm); - ground.rotation.x = -Math.PI / 2; - ground.material.map.repeat.set(64, 64); - ground.material.map.wrapS = THREE.RepeatWrapping; - ground.material.map.wrapT = THREE.RepeatWrapping; - ground.material.map.colorSpace = THREE.SRGBColorSpace; - // note that because the ground does not cast a shadow, .castShadow is left false - ground.receiveShadow = true; - - scene.add(ground); - - // RENDERER - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - - // STATS - - stats = new Stats(); - container.appendChild(stats.dom); - - // EVENTS - - window.addEventListener('resize', onWindowResize); - document.addEventListener('keydown', onKeyDown); - document.addEventListener('keyup', onKeyUp); - - // CONTROLS - - cameraControls = new OrbitControls(camera, renderer.domElement); - cameraControls.target.set(0, 50, 0); - cameraControls.update(); - - // CHARACTER - - const configOgro = { - baseUrl: 'models/md2/ogro/', - - body: 'ogro.md2', - skins: [ - 'grok.jpg', - 'ogrobase.png', - 'arboshak.png', - 'ctf_r.png', - 'ctf_b.png', - 'darkam.png', - 'freedom.png', - 'gib.png', - 'gordogh.png', - 'igdosh.png', - 'khorne.png', - 'nabogro.png', - 'sharokh.png', - ], - weapons: [['weapon.md2', 'weapon.jpg']], - animations: { - move: 'run', - idle: 'stand', - jump: 'jump', - attack: 'attack', - crouchMove: 'cwalk', - crouchIdle: 'cstand', - crouchAttach: 'crattack', - }, - - walkSpeed: 350, - crouchSpeed: 175, - }; - - const nRows = 1; - const nSkins = configOgro.skins.length; - - nCharacters = nSkins * nRows; - - for (let i = 0; i < nCharacters; i++) { - const character = new MD2CharacterComplex(); - character.scale = 3; - character.controls = controls; - characters.push(character); - } - - const baseCharacter = new MD2CharacterComplex(); - baseCharacter.scale = 3; - - baseCharacter.onLoadComplete = function () { - let k = 0; - - for (let j = 0; j < nRows; j++) { - for (let i = 0; i < nSkins; i++) { - const cloneCharacter = characters[k]; - - cloneCharacter.shareParts(baseCharacter); - - // cast and receive shadows - cloneCharacter.enableShadows(true); - - cloneCharacter.setWeapon(0); - cloneCharacter.setSkin(i); - - cloneCharacter.root.position.x = (i - nSkins / 2) * 150; - cloneCharacter.root.position.z = j * 250; - - scene.add(cloneCharacter.root); - - k++; - } - } - - const gyro = new Gyroscope(); - gyro.add(camera); - - characters[Math.floor(nSkins / 2)].root.add(gyro); - }; - - baseCharacter.loadParts(configOgro); -} - -// EVENT HANDLERS - -function onWindowResize() { - SCREEN_WIDTH = window.innerWidth; - SCREEN_HEIGHT = window.innerHeight; - - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - - camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - camera.updateProjectionMatrix(); -} - -function onKeyDown(event) { - switch (event.code) { - case 'ArrowUp': - case 'KeyW': - controls.moveForward = true; - break; - - case 'ArrowDown': - case 'KeyS': - controls.moveBackward = true; - break; - - case 'ArrowLeft': - case 'KeyA': - controls.moveLeft = true; - break; - - case 'ArrowRight': - case 'KeyD': - controls.moveRight = true; - break; - - // case 'KeyC': controls.crouch = true; break; - // case 'Space': controls.jump = true; break; - // case 'ControlLeft': - // case 'ControlRight': controls.attack = true; break; - } -} - -function onKeyUp(event) { - switch (event.code) { - case 'ArrowUp': - case 'KeyW': - controls.moveForward = false; - break; - - case 'ArrowDown': - case 'KeyS': - controls.moveBackward = false; - break; - - case 'ArrowLeft': - case 'KeyA': - controls.moveLeft = false; - break; - - case 'ArrowRight': - case 'KeyD': - controls.moveRight = false; - break; - - // case 'KeyC': controls.crouch = false; break; - // case 'Space': controls.jump = false; break; - // case 'ControlLeft': - // case 'ControlRight': controls.attack = false; break; - } -} - -// - -function animate() { - timer.update(); - - render(); - - stats.update(); -} - -function render() { - const delta = timer.getDelta(); - - for (let i = 0; i < nCharacters; i++) { - characters[i].update(delta); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_mdd.ts b/examples-testing/examples/webgl_loader_mdd.ts deleted file mode 100644 index 16e49221c..000000000 --- a/examples-testing/examples/webgl_loader_mdd.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as THREE from 'three'; - -import { MDDLoader } from 'three/addons/loaders/MDDLoader.js'; - -let camera, scene, renderer, mixer, timer; - -init(); - -function init() { - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(8, 8, 8); - camera.lookAt(scene.position); - - timer = new THREE.Timer(); - timer.connect(document); - - // - - const loader = new MDDLoader(); - loader.load('models/mdd/cube.mdd', function (result) { - const morphTargets = result.morphTargets; - const clip = result.clip; - // clip.optimize(); // optional - - const geometry = new THREE.BoxGeometry(); - geometry.morphAttributes.position = morphTargets; // apply morph targets - - const material = new THREE.MeshNormalMaterial(); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - mixer = new THREE.AnimationMixer(mesh); - mixer.clipAction(clip).play(); // use clip - }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_obj.ts b/examples-testing/examples/webgl_loader_obj.ts deleted file mode 100644 index 42f1f3257..000000000 --- a/examples-testing/examples/webgl_loader_obj.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as THREE from 'three'; - -import { MTLLoader } from 'three/addons/loaders/MTLLoader.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, controls; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); - camera.position.z = 2.5; - - // scene - - scene = new THREE.Scene(); - - const ambientLight = new THREE.AmbientLight(0xffffff); - scene.add(ambientLight); - - const pointLight = new THREE.PointLight(0xffffff, 15); - camera.add(pointLight); - scene.add(camera); - - // model - - const mtlLoader = new MTLLoader().setPath('models/obj/male02/'); - const materials = await mtlLoader.loadAsync('male02.mtl'); - materials.preload(); - - const objLoader = new OBJLoader().setPath('models/obj/male02/'); - objLoader.setMaterials(materials); // optional since OBJ assets can be loaded without an accompanying MTL file - - const object = await objLoader.loadAsync('male02.obj'); - - object.position.y = -0.95; - object.scale.setScalar(0.01); - scene.add(object); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2; - controls.maxDistance = 5; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_pcd.ts b/examples-testing/examples/webgl_loader_pcd.ts deleted file mode 100644 index dd0f0b0f5..000000000 --- a/examples-testing/examples/webgl_loader_pcd.ts +++ /dev/null @@ -1,78 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { PCDLoader } from 'three/addons/loaders/PCDLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer; - -init(); -render(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 0.01, 40); - camera.position.set(0, 0, 1); - scene.add(camera); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 0.5; - controls.maxDistance = 10; - - //scene.add( new THREE.AxesHelper( 1 ) ); - - const loader = new PCDLoader(); - - const loadPointCloud = function (file) { - loader.load('./models/pcd/' + file, function (points) { - points.geometry.center(); - points.geometry.rotateX(Math.PI); - points.name = file; - scene.add(points); - - const gui = new GUI(); - - gui.add(points.material, 'size', 0.001, 0.01).onChange(render); - gui.addColor(points.material, 'color').onChange(render); - gui.add(points, 'name', [ - 'ascii/simple.pcd', - 'binary/Zaghetto.pcd', - 'binary/Zaghetto_8bit.pcd', - 'binary_compressed/pcl_logo.pcd', - ]) - .name('type') - .onChange(e => { - gui.destroy(); - scene.remove(points); - loadPointCloud(e); - }); - gui.open(); - - render(); - }); - }; - - loadPointCloud('binary/Zaghetto.pcd'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_pdb.ts b/examples-testing/examples/webgl_loader_pdb.ts deleted file mode 100644 index b560efa73..000000000 --- a/examples-testing/examples/webgl_loader_pdb.ts +++ /dev/null @@ -1,208 +0,0 @@ -import * as THREE from 'three'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; -import { CSS2DRenderer, CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, labelRenderer; -let controls; - -let root; - -const MOLECULES = { - Ethanol: 'ethanol.pdb', - Aspirin: 'aspirin.pdb', - Caffeine: 'caffeine.pdb', - Nicotine: 'nicotine.pdb', - LSD: 'lsd.pdb', - Cocaine: 'cocaine.pdb', - Cholesterol: 'cholesterol.pdb', - Lycopene: 'lycopene.pdb', - Glucose: 'glucose.pdb', - 'Aluminium oxide': 'Al2O3.pdb', - Cubane: 'cubane.pdb', - Copper: 'cu.pdb', - Fluorite: 'caf2.pdb', - Salt: 'nacl.pdb', - 'YBCO superconductor': 'ybco.pdb', - Buckyball: 'buckyball.pdb', - Graphite: 'graphite.pdb', -}; - -const params = { - molecule: 'caffeine.pdb', -}; - -const loader = new PDBLoader(); -const offset = new THREE.Vector3(); - -init(); - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.z = 1000; - scene.add(camera); - - const light1 = new THREE.DirectionalLight(0xffffff, 2.5); - light1.position.set(1, 1, 1); - scene.add(light1); - - const light2 = new THREE.DirectionalLight(0xffffff, 1.5); - light2.position.set(-1, -1, 1); - scene.add(light2); - - root = new THREE.Group(); - scene.add(root); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.getElementById('container').appendChild(renderer.domElement); - - labelRenderer = new CSS2DRenderer(); - labelRenderer.setSize(window.innerWidth, window.innerHeight); - labelRenderer.domElement.style.position = 'absolute'; - labelRenderer.domElement.style.top = '0px'; - labelRenderer.domElement.style.pointerEvents = 'none'; - document.getElementById('container').appendChild(labelRenderer.domElement); - - // - - controls = new TrackballControls(camera, renderer.domElement); - controls.minDistance = 500; - controls.maxDistance = 2000; - - // - - loadMolecule(params.molecule); - - // - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - - gui.add(params, 'molecule', MOLECULES).onChange(loadMolecule); - gui.open(); -} - -// - -function loadMolecule(model) { - const url = 'models/pdb/' + model; - - while (root.children.length > 0) { - const object = root.children[0]; - object.parent.remove(object); - } - - loader.load(url, function (pdb) { - const geometryAtoms = pdb.geometryAtoms; - const geometryBonds = pdb.geometryBonds; - const json = pdb.json; - - const boxGeometry = new THREE.BoxGeometry(1, 1, 1); - const sphereGeometry = new THREE.IcosahedronGeometry(1, 3); - - geometryAtoms.computeBoundingBox(); - geometryAtoms.boundingBox.getCenter(offset).negate(); - - geometryAtoms.translate(offset.x, offset.y, offset.z); - geometryBonds.translate(offset.x, offset.y, offset.z); - - let positions = geometryAtoms.getAttribute('position'); - const colors = geometryAtoms.getAttribute('color'); - - const position = new THREE.Vector3(); - const color = new THREE.Color(); - - for (let i = 0; i < positions.count; i++) { - position.x = positions.getX(i); - position.y = positions.getY(i); - position.z = positions.getZ(i); - - color.r = colors.getX(i); - color.g = colors.getY(i); - color.b = colors.getZ(i); - - const material = new THREE.MeshPhongMaterial({ color: color }); - - const object = new THREE.Mesh(sphereGeometry, material); - object.position.copy(position); - object.position.multiplyScalar(75); - object.scale.multiplyScalar(25); - root.add(object); - - const atom = json.atoms[i]; - - const text = document.createElement('div'); - text.className = 'label'; - text.style.color = 'rgb(' + atom[3][0] + ',' + atom[3][1] + ',' + atom[3][2] + ')'; - text.textContent = atom[4]; - - const label = new CSS2DObject(text); - label.position.copy(object.position); - root.add(label); - } - - positions = geometryBonds.getAttribute('position'); - - const start = new THREE.Vector3(); - const end = new THREE.Vector3(); - - for (let i = 0; i < positions.count; i += 2) { - start.x = positions.getX(i); - start.y = positions.getY(i); - start.z = positions.getZ(i); - - end.x = positions.getX(i + 1); - end.y = positions.getY(i + 1); - end.z = positions.getZ(i + 1); - - start.multiplyScalar(75); - end.multiplyScalar(75); - - const object = new THREE.Mesh(boxGeometry, new THREE.MeshPhongMaterial({ color: 0xffffff })); - object.position.copy(start); - object.position.lerp(end, 0.5); - object.scale.set(5, 5, start.distanceTo(end)); - object.lookAt(end); - root.add(object); - } - }); -} - -// - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - labelRenderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - const time = Date.now() * 0.0004; - - root.rotation.x = time; - root.rotation.y = time * 0.7; - - render(); -} - -function render() { - renderer.render(scene, camera); - labelRenderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_ply.ts b/examples-testing/examples/webgl_loader_ply.ts deleted file mode 100644 index 0f4042b7d..000000000 --- a/examples-testing/examples/webgl_loader_ply.ts +++ /dev/null @@ -1,146 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; - -let container, stats; - -let camera, cameraTarget, scene, renderer; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 15); - camera.position.set(3, 0.15, 3); - - cameraTarget = new THREE.Vector3(0, -0.1, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x72645b); - scene.fog = new THREE.Fog(0x72645b, 2, 15); - - // Ground - - const plane = new THREE.Mesh( - new THREE.PlaneGeometry(40, 40), - new THREE.MeshPhongMaterial({ color: 0xcbcbcb, specular: 0x474747 }), - ); - plane.rotation.x = -Math.PI / 2; - plane.position.y = -0.5; - scene.add(plane); - - plane.receiveShadow = true; - - // PLY file - - const loader = new PLYLoader(); - loader.load('./models/ply/ascii/dolphins.ply', function (geometry) { - geometry.computeVertexNormals(); - - const material = new THREE.MeshStandardMaterial({ color: 0x009cff, flatShading: true }); - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.y = -0.2; - mesh.position.z = 0.3; - mesh.rotation.x = -Math.PI / 2; - mesh.scale.multiplyScalar(0.001); - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); - }); - - loader.load('./models/ply/binary/Lucy100k.ply', function (geometry) { - geometry.computeVertexNormals(); - - const material = new THREE.MeshStandardMaterial({ color: 0x009cff, flatShading: true }); - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = -0.2; - mesh.position.y = -0.02; - mesh.position.z = -0.2; - mesh.scale.multiplyScalar(0.0006); - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); - }); - - // Lights - - scene.add(new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3)); - - addShadowedLight(1, 1, 1, 0xffffff, 3.5); - addShadowedLight(0.5, 1, -1, 0xffd500, 3); - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - renderer.shadowMap.enabled = true; - - container.appendChild(renderer.domElement); - - // stats - - stats = new Stats(); - container.appendChild(stats.dom); - - // resize - - window.addEventListener('resize', onWindowResize); -} - -function addShadowedLight(x, y, z, color, intensity) { - const directionalLight = new THREE.DirectionalLight(color, intensity); - directionalLight.position.set(x, y, z); - scene.add(directionalLight); - - directionalLight.castShadow = true; - - const d = 1; - directionalLight.shadow.camera.left = -d; - directionalLight.shadow.camera.right = d; - directionalLight.shadow.camera.top = d; - directionalLight.shadow.camera.bottom = -d; - - directionalLight.shadow.camera.near = 1; - directionalLight.shadow.camera.far = 4; - - directionalLight.shadow.mapSize.width = 1024; - directionalLight.shadow.mapSize.height = 1024; - - directionalLight.shadow.bias = -0.001; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - stats.update(); -} - -function render() { - const timer = Date.now() * 0.0005; - - camera.position.x = Math.sin(timer) * 2.5; - camera.position.z = Math.cos(timer) * 2.5; - - camera.lookAt(cameraTarget); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_svg.ts b/examples-testing/examples/webgl_loader_svg.ts deleted file mode 100644 index 2226a96b1..000000000 --- a/examples-testing/examples/webgl_loader_svg.ts +++ /dev/null @@ -1,202 +0,0 @@ -import * as THREE from 'three'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { SVGLoader } from 'three/addons/loaders/SVGLoader.js'; - -let renderer, scene, camera, gui, guiData; - -init(); - -// - -function init() { - const container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 200); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - container.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.screenSpacePanning = true; - - // - - window.addEventListener('resize', onWindowResize); - - guiData = { - currentURL: 'models/svg/tiger.svg', - drawFillShapes: true, - drawStrokes: true, - fillShapesWireframe: false, - strokesWireframe: false, - }; - - loadSVG(guiData.currentURL); - - createGUI(); -} - -function createGUI() { - if (gui) gui.destroy(); - - gui = new GUI(); - - gui.add(guiData, 'currentURL', { - Tiger: 'models/svg/tiger.svg', - 'Joins and caps': 'models/svg/lineJoinsAndCaps.svg', - Hexagon: 'models/svg/hexagon.svg', - Energy: 'models/svg/energy.svg', - 'Test 1': 'models/svg/tests/1.svg', - 'Test 2': 'models/svg/tests/2.svg', - 'Test 3': 'models/svg/tests/3.svg', - 'Test 4': 'models/svg/tests/4.svg', - 'Test 5': 'models/svg/tests/5.svg', - 'Test 6': 'models/svg/tests/6.svg', - 'Test 7': 'models/svg/tests/7.svg', - 'Test 8': 'models/svg/tests/8.svg', - 'Test 9': 'models/svg/tests/9.svg', - Units: 'models/svg/tests/units.svg', - Ordering: 'models/svg/tests/ordering.svg', - Defs: 'models/svg/tests/testDefs/Svg-defs.svg', - Defs2: 'models/svg/tests/testDefs/Svg-defs2.svg', - Defs3: 'models/svg/tests/testDefs/Wave-defs.svg', - Defs4: 'models/svg/tests/testDefs/defs4.svg', - Defs5: 'models/svg/tests/testDefs/defs5.svg', - 'Style CSS inside defs': 'models/svg/style-css-inside-defs.svg', - 'Styled Paths': 'models/svg/styled-paths.svg', - 'Multiple CSS classes': 'models/svg/multiple-css-classes.svg', - 'Zero Radius': 'models/svg/zero-radius.svg', - 'Styles in svg tag': 'models/svg/tests/styles.svg', - 'Round join': 'models/svg/tests/roundJoinPrecisionIssue.svg', - 'Ellipse Transformations': 'models/svg/tests/ellipseTransform.svg', - singlePointTest: 'models/svg/singlePointTest.svg', - singlePointTest2: 'models/svg/singlePointTest2.svg', - singlePointTest3: 'models/svg/singlePointTest3.svg', - emptyPath: 'models/svg/emptyPath.svg', - emoji: 'models/svg/emoji.svg', - blueprint: 'models/svg/blueprint.svg', - wideStroke: 'models/svg/tests/wideStroke.svg', - letter: 'models/svg/tests/letter.svg', - }) - .name('SVG File') - .onChange(update); - - gui.add(guiData, 'drawStrokes').name('Draw strokes').onChange(update); - - gui.add(guiData, 'drawFillShapes').name('Draw fill shapes').onChange(update); - - gui.add(guiData, 'strokesWireframe').name('Wireframe strokes').onChange(update); - - gui.add(guiData, 'fillShapesWireframe').name('Wireframe fill shapes').onChange(update); - - function update() { - loadSVG(guiData.currentURL); - } -} - -function loadSVG(url) { - // - - if (scene) disposeScene(scene); - - // - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xb0b0b0); - - // - - const helper = new THREE.GridHelper(160, 10, 0x8d8d8d, 0xc1c1c1); - helper.rotation.x = Math.PI / 2; - scene.add(helper); - - // - - const loader = new SVGLoader(); - - loader.load(url, function (data) { - const group = new THREE.Group(); - group.scale.multiplyScalar(0.25); - group.position.x = -70; - group.position.y = 70; - group.scale.y *= -1; - - let renderOrder = 0; - - for (const path of data.paths) { - if (guiData.drawFillShapes) { - const material = SVGLoader.createFillMaterial(path); - - if (material) { - material.wireframe = guiData.fillShapesWireframe; - - const shapes = path.toShapes(); - - for (const shape of shapes) { - const geometry = new THREE.ShapeGeometry(shape); - const mesh = new THREE.Mesh(geometry, material); - mesh.renderOrder = renderOrder++; - - group.add(mesh); - } - } - } - - if (guiData.drawStrokes) { - const material = SVGLoader.createStrokeMaterial(path); - - if (material) { - material.wireframe = guiData.strokesWireframe; - - for (const subPath of path.subPaths) { - const geometry = SVGLoader.pointsToStroke(subPath.getPoints(), path.userData.style); - - if (geometry) { - const mesh = new THREE.Mesh(geometry, material); - mesh.renderOrder = renderOrder++; - - group.add(mesh); - } - } - } - } - } - - scene.add(group); - - render(); - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - render(); -} - -function render() { - renderer.render(scene, camera); -} - -function disposeScene(scene) { - scene.traverse(function (object) { - if (object.isMesh || object.isLine) { - object.geometry.dispose(); - if (object.material.map) object.material.map.dispose(); - object.material.dispose(); - } - }); -} diff --git a/examples-testing/examples/webgl_loader_texture_dds.ts b/examples-testing/examples/webgl_loader_texture_dds.ts deleted file mode 100644 index ba9b18e9d..000000000 --- a/examples-testing/examples/webgl_loader_texture_dds.ts +++ /dev/null @@ -1,218 +0,0 @@ -import * as THREE from 'three'; - -import { DDSLoader } from 'three/addons/loaders/DDSLoader.js'; - -let camera, scene, renderer; -const meshes = []; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 100); - camera.position.y = -2; - camera.position.z = 16; - - scene = new THREE.Scene(); - - const geometry = new THREE.BoxGeometry(2, 2, 2); - - /* - This is how compressed textures are supposed to be used: - - DXT1 - RGB - opaque textures - DXT3 - RGBA - transparent textures with sharp alpha transitions - DXT5 - RGBA - transparent textures with full alpha range - */ - - const loader = new DDSLoader(); - - const map1 = loader.load('textures/compressed/disturb_dxt1_nomip.dds'); - map1.minFilter = map1.magFilter = THREE.LinearFilter; - map1.anisotropy = 4; - map1.colorSpace = THREE.SRGBColorSpace; - - const map2 = loader.load('textures/compressed/disturb_dxt1_mip.dds'); - map2.anisotropy = 4; - map2.colorSpace = THREE.SRGBColorSpace; - - const map3 = loader.load('textures/compressed/hepatica_dxt3_mip.dds'); - map3.anisotropy = 4; - map3.colorSpace = THREE.SRGBColorSpace; - - const map4 = loader.load('textures/compressed/explosion_dxt5_mip.dds'); - map4.anisotropy = 4; - map4.colorSpace = THREE.SRGBColorSpace; - - const map5 = loader.load('textures/compressed/disturb_argb_nomip.dds'); - map5.minFilter = map5.magFilter = THREE.LinearFilter; - map5.anisotropy = 4; - map5.colorSpace = THREE.SRGBColorSpace; - - const map6 = loader.load('textures/compressed/disturb_argb_mip.dds'); - map6.anisotropy = 4; - map6.colorSpace = THREE.SRGBColorSpace; - - const map7 = loader.load('textures/compressed/disturb_dx10_bc6h_signed_nomip.dds'); - map7.anisotropy = 4; - - const map8 = loader.load('textures/compressed/disturb_dx10_bc6h_signed_mip.dds'); - map8.anisotropy = 4; - - const map9 = loader.load('textures/compressed/disturb_dx10_bc6h_unsigned_nomip.dds'); - map9.anisotropy = 4; - - const map10 = loader.load('textures/compressed/disturb_dx10_bc6h_unsigned_mip.dds'); - map10.anisotropy = 4; - - const map11 = loader.load('textures/wave_normals_24bit_uncompressed.dds'); - map11.anisotropy = 4; - - const cubemap1 = loader.load('textures/compressed/Mountains.dds', function (texture) { - texture.magFilter = THREE.LinearFilter; - texture.minFilter = THREE.LinearFilter; - texture.mapping = THREE.CubeReflectionMapping; - texture.colorSpace = THREE.SRGBColorSpace; - material1.needsUpdate = true; - }); - - const cubemap2 = loader.load('textures/compressed/Mountains_argb_mip.dds', function (texture) { - texture.magFilter = THREE.LinearFilter; - texture.minFilter = THREE.LinearFilter; - texture.mapping = THREE.CubeReflectionMapping; - texture.colorSpace = THREE.SRGBColorSpace; - material5.needsUpdate = true; - }); - - const cubemap3 = loader.load('textures/compressed/Mountains_argb_nomip.dds', function (texture) { - texture.magFilter = THREE.LinearFilter; - texture.minFilter = THREE.LinearFilter; - texture.mapping = THREE.CubeReflectionMapping; - texture.colorSpace = THREE.SRGBColorSpace; - material6.needsUpdate = true; - }); - - const material1 = new THREE.MeshBasicMaterial({ map: map1, envMap: cubemap1 }); - const material2 = new THREE.MeshBasicMaterial({ map: map2 }); - const material3 = new THREE.MeshBasicMaterial({ map: map3, alphaTest: 0.5, side: THREE.DoubleSide }); - const material4 = new THREE.MeshBasicMaterial({ - map: map4, - side: THREE.DoubleSide, - blending: THREE.AdditiveBlending, - depthTest: false, - transparent: true, - }); - const material5 = new THREE.MeshBasicMaterial({ envMap: cubemap2 }); - const material6 = new THREE.MeshBasicMaterial({ envMap: cubemap3 }); - const material7 = new THREE.MeshBasicMaterial({ map: map5 }); - const material8 = new THREE.MeshBasicMaterial({ map: map6 }); - const material9 = new THREE.MeshBasicMaterial({ map: map7 }); - const material10 = new THREE.MeshBasicMaterial({ map: map8 }); - const material11 = new THREE.MeshBasicMaterial({ map: map9 }); - const material12 = new THREE.MeshBasicMaterial({ map: map10 }); - const material13 = new THREE.MeshBasicMaterial({ map: map11, transparent: true }); - - let mesh = new THREE.Mesh(new THREE.TorusGeometry(), material1); - mesh.position.x = -10; - mesh.position.y = -2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material2); - mesh.position.x = -6; - mesh.position.y = -2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material3); - mesh.position.x = -6; - mesh.position.y = 2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material4); - mesh.position.x = -10; - mesh.position.y = 2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material5); - mesh.position.x = -2; - mesh.position.y = 2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material6); - mesh.position.x = -2; - mesh.position.y = -2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material7); - mesh.position.x = 2; - mesh.position.y = -2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material8); - mesh.position.x = 2; - mesh.position.y = 2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material9); - mesh.position.x = 6; - mesh.position.y = -2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material10); - mesh.position.x = 6; - mesh.position.y = 2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material11); - mesh.position.x = 10; - mesh.position.y = -2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material12); - mesh.position.x = 10; - mesh.position.y = 2; - scene.add(mesh); - meshes.push(mesh); - - mesh = new THREE.Mesh(geometry, material13); - mesh.position.x = -10; - mesh.position.y = -6; - scene.add(mesh); - meshes.push(mesh); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = Date.now() * 0.001; - - for (let i = 0; i < meshes.length; i++) { - const mesh = meshes[i]; - mesh.rotation.x = time; - mesh.rotation.y = time; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_texture_ktx.ts b/examples-testing/examples/webgl_loader_texture_ktx.ts deleted file mode 100644 index a4e749301..000000000 --- a/examples-testing/examples/webgl_loader_texture_ktx.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as THREE from 'three'; - -import { KTXLoader } from 'three/addons/loaders/KTXLoader.js'; - -/* - This is how compressed textures are supposed to be used: - - best for desktop: - BC1(DXT1) - opaque textures - BC3(DXT5) - transparent textures with full alpha range - - best for iOS: - PVR2, PVR4 - opaque textures or alpha - - best for Android: - ETC1 - opaque textures - ASTC_4x4, ASTC8x8 - transparent textures with full alpha range - */ - -let camera, scene, renderer; -const meshes = []; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - const formats = { - astc: renderer.extensions.has('WEBGL_compressed_texture_astc'), - etc1: renderer.extensions.has('WEBGL_compressed_texture_etc1'), - etc2: renderer.extensions.has('WEBGL_compressed_texture_etc'), - s3tc: renderer.extensions.has('WEBGL_compressed_texture_s3tc'), - pvrtc: renderer.extensions.has('WEBGL_compressed_texture_pvrtc'), - }; - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - - const ambientLight = new THREE.AmbientLight(0xffffff, 0.02); - scene.add(ambientLight); - - const pointLight = new THREE.PointLight(0xffffff, 2, 0, 0); - pointLight.position.z = 300; - scene.add(pointLight); - - const geometry = new THREE.BoxGeometry(200, 200, 200); - let material1, material2, material3; - - // TODO: add cubemap support - const loader = new KTXLoader(); - - if (formats.pvrtc) { - material1 = new THREE.MeshBasicMaterial({ - map: loader.load('textures/compressed/disturb_PVR2bpp.ktx'), - }); - material1.map.colorSpace = THREE.SRGBColorSpace; - material2 = new THREE.MeshBasicMaterial({ - map: loader.load('textures/compressed/lensflare_PVR4bpp.ktx'), - depthTest: false, - transparent: true, - side: THREE.DoubleSide, - }); - material2.map.colorSpace = THREE.SRGBColorSpace; - - meshes.push(new THREE.Mesh(geometry, material1)); - meshes.push(new THREE.Mesh(geometry, material2)); - } - - if (formats.s3tc) { - material1 = new THREE.MeshBasicMaterial({ - map: loader.load('textures/compressed/disturb_BC1.ktx'), - }); - material1.map.colorSpace = THREE.SRGBColorSpace; - material2 = new THREE.MeshBasicMaterial({ - map: loader.load('textures/compressed/lensflare_BC3.ktx'), - depthTest: false, - transparent: true, - side: THREE.DoubleSide, - }); - material2.map.colorSpace = THREE.SRGBColorSpace; - material3 = new THREE.MeshStandardMaterial({ - normalMap: loader.load('textures/compressed/normal.bc5.ktx'), - }); - - meshes.push(new THREE.Mesh(geometry, material1)); - meshes.push(new THREE.Mesh(geometry, material2)); - meshes.push(new THREE.Mesh(geometry, material3)); - } - - if (formats.etc1) { - material1 = new THREE.MeshBasicMaterial({ - map: loader.load('textures/compressed/disturb_ETC1.ktx'), - }); - - meshes.push(new THREE.Mesh(geometry, material1)); - } - - if (formats.etc2) { - material1 = new THREE.MeshStandardMaterial({ - normalMap: loader.load('textures/compressed/normal.eac_rg.ktx'), - }); - - meshes.push(new THREE.Mesh(geometry, material1)); - } - - if (formats.astc) { - material1 = new THREE.MeshBasicMaterial({ - map: loader.load('textures/compressed/disturb_ASTC4x4.ktx'), - }); - material1.map.colorSpace = THREE.SRGBColorSpace; - material2 = new THREE.MeshBasicMaterial({ - map: loader.load('textures/compressed/lensflare_ASTC8x8.ktx'), - depthTest: false, - transparent: true, - side: THREE.DoubleSide, - }); - material2.map.colorSpace = THREE.SRGBColorSpace; - - meshes.push(new THREE.Mesh(geometry, material1)); - meshes.push(new THREE.Mesh(geometry, material2)); - } - - let x0 = (-Math.min(4, meshes.length) * 300) / 2 + 150; - for (let i = 0; i < Math.min(4, meshes.length); ++i, x0 += 300) { - const mesh = meshes[i]; - mesh.position.x = x0; - mesh.position.y = 150; - scene.add(mesh); - } - - let x1 = (-(meshes.length - 4) * 300) / 2 + 150; - for (let i = 4; i < meshes.length; ++i, x1 += 300) { - const mesh = meshes[i]; - mesh.position.x = x1; - mesh.position.y = -150; - scene.add(mesh); - } - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = Date.now() * 0.001; - - for (let i = 0; i < meshes.length; i++) { - const mesh = meshes[i]; - mesh.rotation.x = time; - mesh.rotation.y = time; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_texture_tga.ts b/examples-testing/examples/webgl_loader_texture_tga.ts deleted file mode 100644 index c4f65b79a..000000000 --- a/examples-testing/examples/webgl_loader_texture_tga.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TGALoader } from 'three/addons/loaders/TGALoader.js'; - -let camera, scene, renderer, stats; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 1, 5); - - scene = new THREE.Scene(); - - // - - const loader = new TGALoader(); - const geometry = new THREE.BoxGeometry(); - - // add box 1 - grey8 texture - - const texture1 = loader.load('textures/crate_grey8.tga'); - texture1.colorSpace = THREE.SRGBColorSpace; - const material1 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture1 }); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.position.x = -1; - - scene.add(mesh1); - - // add box 2 - tga texture - - const texture2 = loader.load('textures/crate_color8.tga'); - texture2.colorSpace = THREE.SRGBColorSpace; - const material2 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture2 }); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.position.x = 1; - - scene.add(mesh2); - - // - - const ambientLight = new THREE.AmbientLight(0xffffff, 1.5); - scene.add(ambientLight); - - const light = new THREE.DirectionalLight(0xffffff, 2.5); - light.position.set(1, 1, 1); - scene.add(light); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); - stats.update(); -} diff --git a/examples-testing/examples/webgl_loader_texture_tiff.ts b/examples-testing/examples/webgl_loader_texture_tiff.ts deleted file mode 100644 index f097774aa..000000000 --- a/examples-testing/examples/webgl_loader_texture_tiff.ts +++ /dev/null @@ -1,87 +0,0 @@ -import * as THREE from 'three'; - -import { TIFFLoader } from 'three/addons/loaders/TIFFLoader.js'; - -let renderer, scene, camera; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.set(0, 0, 4); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - const loader = new TIFFLoader(); - - const geometry = new THREE.PlaneGeometry(); - - // uncompressed - - loader.load('textures/tiff/crate_uncompressed.tif', function (texture) { - texture.colorSpace = THREE.SRGBColorSpace; - - const material = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(-1.5, 0, 0); - - scene.add(mesh); - - render(); - }); - - // LZW - - loader.load('textures/tiff/crate_lzw.tif', function (texture) { - texture.colorSpace = THREE.SRGBColorSpace; - - const material = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(0, 0, 0); - - scene.add(mesh); - - render(); - }); - - // JPEG - - loader.load('textures/tiff/crate_jpeg.tif', function (texture) { - texture.colorSpace = THREE.SRGBColorSpace; - - const material = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(1.5, 0, 0); - - scene.add(mesh); - - render(); - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_texture_ultrahdr.ts b/examples-testing/examples/webgl_loader_texture_ultrahdr.ts deleted file mode 100644 index c8bce4bf9..000000000 --- a/examples-testing/examples/webgl_loader_texture_ultrahdr.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -const params = { - autoRotate: true, - metalness: 1.0, - roughness: 0.0, - exposure: 1.0, - resolution: '2k', - type: 'HalfFloatType', -}; - -let renderer, scene, camera, controls, torusMesh, loader; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = params.exposure; - - renderer.setAnimationLoop(render); - - scene = new THREE.Scene(); - - torusMesh = new THREE.Mesh( - new THREE.TorusKnotGeometry(1, 0.4, 128, 128, 1, 3), - new THREE.MeshStandardMaterial({ roughness: params.roughness, metalness: params.metalness }), - ); - scene.add(torusMesh); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 500); - camera.position.set(0.0, 0.0, -6.0); - - controls = new OrbitControls(camera, renderer.domElement); - - loader = new UltraHDRLoader(); - loader.setDataType(THREE.FloatType); - - const loadEnvironment = function (resolution = '2k', type = 'HalfFloatType') { - loader.setDataType(THREE[type]); - - loader.load(`textures/equirectangular/spruit_sunrise_${resolution}.hdr.jpg`, function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - texture.needsUpdate = true; - - scene.background = texture; - scene.environment = texture; - }); - }; - - loadEnvironment(params.resolution, params.type); - - const gui = new GUI(); - - gui.add(params, 'autoRotate'); - gui.add(params, 'metalness', 0, 1, 0.01); - gui.add(params, 'roughness', 0, 1, 0.01); - gui.add(params, 'exposure', 0, 4, 0.01); - gui.add(params, 'resolution', ['2k', '4k']).onChange(value => { - loadEnvironment(value, params.type); - }); - gui.add(params, 'type', ['HalfFloatType', 'FloatType']).onChange(value => { - loadEnvironment(params.resolution, value); - }); - - gui.open(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - torusMesh.material.roughness = params.roughness; - torusMesh.material.metalness = params.metalness; - - if (params.autoRotate) { - torusMesh.rotation.y += 0.005; - } - - renderer.toneMappingExposure = params.exposure; - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_ttf.ts b/examples-testing/examples/webgl_loader_ttf.ts deleted file mode 100644 index b54b8c290..000000000 --- a/examples-testing/examples/webgl_loader_ttf.ts +++ /dev/null @@ -1,231 +0,0 @@ -import * as THREE from 'three'; - -import { TTFLoader } from 'three/addons/loaders/TTFLoader.js'; -import { Font } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -let container; -let camera, cameraTarget, scene, renderer; -let group, textMesh1, textMesh2, textGeo, material; -let firstLetter = true; - -let text = 'three.js'; -const depth = 20, - size = 70, - hover = 30, - curveSegments = 4, - bevelThickness = 2, - bevelSize = 1.5; - -let font = null; -const mirror = true; - -let targetRotation = 0; -let targetRotationOnPointerDown = 0; - -let pointerX = 0; -let pointerXOnPointerDown = 0; - -let windowHalfX = window.innerWidth / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // CAMERA - - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 1500); - camera.position.set(0, 400, 700); - - cameraTarget = new THREE.Vector3(0, 150, 0); - - // SCENE - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - scene.fog = new THREE.Fog(0x000000, 250, 1400); - - // LIGHTS - - const dirLight1 = new THREE.DirectionalLight(0xffffff, 0.4); - dirLight1.position.set(0, 0, 1).normalize(); - scene.add(dirLight1); - - const dirLight2 = new THREE.DirectionalLight(0xffffff, 2); - dirLight2.position.set(0, hover, 10).normalize(); - dirLight2.color.setHSL(Math.random(), 1, 0.5, THREE.SRGBColorSpace); - scene.add(dirLight2); - - material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); - - group = new THREE.Group(); - group.position.y = 100; - - scene.add(group); - - const loader = new TTFLoader(); - - loader.load('fonts/ttf/kenpixel.ttf', function (json) { - font = new Font(json); - createText(); - }); - - const plane = new THREE.Mesh( - new THREE.PlaneGeometry(10000, 10000), - new THREE.MeshBasicMaterial({ color: 0xffffff, opacity: 0.5, transparent: true }), - ); - plane.position.y = 100; - plane.rotation.x = -Math.PI / 2; - scene.add(plane); - - // RENDERER - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // EVENTS - - container.style.touchAction = 'none'; - container.addEventListener('pointerdown', onPointerDown); - - document.addEventListener('keypress', onDocumentKeyPress); - document.addEventListener('keydown', onDocumentKeyDown); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentKeyDown(event) { - if (firstLetter) { - firstLetter = false; - text = ''; - } - - const keyCode = event.keyCode; - - // backspace - - if (keyCode === 8) { - event.preventDefault(); - - text = text.substring(0, text.length - 1); - refreshText(); - - return false; - } -} - -function onDocumentKeyPress(event) { - const keyCode = event.which; - - // backspace - - if (keyCode === 8) { - event.preventDefault(); - } else { - const ch = String.fromCharCode(keyCode); - text += ch; - - refreshText(); - } -} - -function createText() { - textGeo = new TextGeometry(text, { - font: font, - - size: size, - depth: depth, - curveSegments: curveSegments, - - bevelThickness: bevelThickness, - bevelSize: bevelSize, - bevelEnabled: true, - }); - - textGeo.computeBoundingBox(); - textGeo.computeVertexNormals(); - - const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); - - textMesh1 = new THREE.Mesh(textGeo, material); - - textMesh1.position.x = centerOffset; - textMesh1.position.y = hover; - textMesh1.position.z = 0; - - textMesh1.rotation.x = 0; - textMesh1.rotation.y = Math.PI * 2; - - group.add(textMesh1); - - if (mirror) { - textMesh2 = new THREE.Mesh(textGeo, material); - - textMesh2.position.x = centerOffset; - textMesh2.position.y = -hover; - textMesh2.position.z = depth; - - textMesh2.rotation.x = Math.PI; - textMesh2.rotation.y = Math.PI * 2; - - group.add(textMesh2); - } -} - -function refreshText() { - group.remove(textMesh1); - if (mirror) group.remove(textMesh2); - - if (!text) return; - - createText(); -} - -function onPointerDown(event) { - if (event.isPrimary === false) return; - - pointerXOnPointerDown = event.clientX - windowHalfX; - targetRotationOnPointerDown = targetRotation; - - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerup', onPointerUp); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - pointerX = event.clientX - windowHalfX; - - targetRotation = targetRotationOnPointerDown + (pointerX - pointerXOnPointerDown) * 0.02; -} - -function onPointerUp(event) { - if (event.isPrimary === false) return; - - document.removeEventListener('pointermove', onPointerMove); - document.removeEventListener('pointerup', onPointerUp); -} - -// - -function animate() { - group.rotation.y += (targetRotation - group.rotation.y) * 0.05; - - camera.lookAt(cameraTarget); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_usdz.ts b/examples-testing/examples/webgl_loader_usdz.ts deleted file mode 100644 index 409c6b597..000000000 --- a/examples-testing/examples/webgl_loader_usdz.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { USDLoader } from 'three/addons/loaders/USDLoader.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0.75, -1.5); - - scene = new THREE.Scene(); - - const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); - - const usdzLoader = new USDLoader().setPath('models/usdz/'); - - const [texture, model] = await Promise.all([ - hdrLoader.loadAsync('venice_sunset_1k.hdr'), - usdzLoader.loadAsync('saeukkang.usdz'), - ]); - - // environment - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.backgroundBlurriness = 0.5; - scene.environment = texture; - - // model - - model.position.y = 0.25; - model.position.z = -0.25; - scene.add(model); - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 2.0; - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 8; - // controls.target.y = 15; - // controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_vox.ts b/examples-testing/examples/webgl_loader_vox.ts deleted file mode 100644 index 87e0b2f81..000000000 --- a/examples-testing/examples/webgl_loader_vox.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { VOXLoader } from 'three/addons/loaders/VOXLoader.js'; - -let camera, controls, scene, renderer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.set(0.175, 0.075, 0.175); - - scene = new THREE.Scene(); - scene.add(camera); - - // light - - const hemiLight = new THREE.HemisphereLight(0xcccccc, 0x444444, 3); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 2.5); - dirLight.position.set(1.5, 3, 2.5); - scene.add(dirLight); - - const dirLight2 = new THREE.DirectionalLight(0xffffff, 1.5); - dirLight2.position.set(-1.5, -3, -2.5); - scene.add(dirLight2); - - const loader = new VOXLoader(); - loader.load('models/vox/monu10.vox', function (result) { - const mesh = result.scene.children[0]; - mesh.position.y = 0; - mesh.scale.setScalar(0.0015); - scene.add(mesh); - }); - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 0.1; - controls.maxDistance = 0.5; - - // - - window.addEventListener('resize', onWindowResize); -} - -/* - function displayPalette( palette ) { - - const canvas = document.createElement( 'canvas' ); - canvas.width = 8; - canvas.height = 32; - canvas.style.position = 'absolute'; - canvas.style.top = '0'; - canvas.style.width = '100px'; - canvas.style.imageRendering = 'pixelated'; - document.body.appendChild( canvas ); - - const context = canvas.getContext( '2d' ); - - for ( let c = 0; c < 256; c ++ ) { - - const x = c % 8; - const y = Math.floor( c / 8 ); - - const hex = palette[ c + 1 ]; - const r = hex >> 0 & 0xff; - const g = hex >> 8 & 0xff; - const b = hex >> 16 & 0xff; - context.fillStyle = `rgba(${r},${g},${b},1)`; - context.fillRect( x, 31 - y, 1, 1 ); - - } - - } - */ - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_loader_vrml.ts b/examples-testing/examples/webgl_loader_vrml.ts deleted file mode 100644 index ce8b30513..000000000 --- a/examples-testing/examples/webgl_loader_vrml.ts +++ /dev/null @@ -1,120 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { VRMLLoader } from 'three/addons/loaders/VRMLLoader.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, stats, controls, loader; - -const params = { - asset: 'house', -}; - -const assets = [ - 'creaseAngle', - 'crystal', - 'house', - 'elevationGrid1', - 'elevationGrid2', - 'extrusion1', - 'extrusion2', - 'extrusion3', - 'lines', - 'linesTransparent', - 'meshWithLines', - 'meshWithTexture', - 'pixelTexture', - 'points', - 'camera', - 'multilineString', -]; - -let vrmlScene; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1e10); - camera.position.set(-10, 5, 10); - - scene = new THREE.Scene(); - scene.add(camera); - - // light - - const ambientLight = new THREE.AmbientLight(0xffffff, 1.2); - scene.add(ambientLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 2.0); - dirLight.position.set(200, 200, 200); - scene.add(dirLight); - - loader = new VRMLLoader(); - loadAsset(params.asset); - - // renderer - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 200; - controls.enableDamping = true; - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - gui.add(params, 'asset', assets).onChange(function (value) { - if (vrmlScene) { - vrmlScene.traverse(function (object) { - if (object.material) object.material.dispose(); - if (object.material && object.material.map) object.material.map.dispose(); - if (object.geometry) object.geometry.dispose(); - }); - - scene.remove(vrmlScene); - } - - loadAsset(value); - }); -} - -function loadAsset(asset) { - loader.load('models/vrml/' + asset + '.wrl', function (object) { - vrmlScene = object; - scene.add(object); - controls.reset(); - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); // to support damping - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_loader_xyz.ts b/examples-testing/examples/webgl_loader_xyz.ts deleted file mode 100644 index 315c6de39..000000000 --- a/examples-testing/examples/webgl_loader_xyz.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as THREE from 'three'; - -import { XYZLoader } from 'three/addons/loaders/XYZLoader.js'; - -let camera, scene, renderer, timer; - -let points; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(10, 7, 10); - - scene = new THREE.Scene(); - scene.add(camera); - camera.lookAt(scene.position); - - timer = new THREE.Timer(); - timer.connect(document); - - const loader = new XYZLoader(); - loader.load('models/xyz/helix_201.xyz', function (geometry) { - geometry.center(); - - const vertexColors = geometry.hasAttribute('color') === true; - - const material = new THREE.PointsMaterial({ size: 0.1, vertexColors: vertexColors }); - - points = new THREE.Points(geometry, material); - scene.add(points); - }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (points) { - points.rotation.x += delta * 0.2; - points.rotation.y += delta * 0.5; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_lod.ts b/examples-testing/examples/webgl_lod.ts deleted file mode 100644 index d957efbbd..000000000 --- a/examples-testing/examples/webgl_lod.ts +++ /dev/null @@ -1,91 +0,0 @@ -import * as THREE from 'three'; - -import { FlyControls } from 'three/addons/controls/FlyControls.js'; - -let container; - -let camera, scene, renderer, controls; - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 15000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x000000, 1, 15000); - - const pointLight = new THREE.PointLight(0xff2200, 3, 0, 0); - pointLight.position.set(0, 0, 0); - scene.add(pointLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(0, 0, 1).normalize(); - scene.add(dirLight); - - const geometry = [ - [new THREE.IcosahedronGeometry(100, 16), 50], - [new THREE.IcosahedronGeometry(100, 8), 300], - [new THREE.IcosahedronGeometry(100, 4), 1000], - [new THREE.IcosahedronGeometry(100, 2), 2000], - [new THREE.IcosahedronGeometry(100, 1), 8000], - ]; - - const material = new THREE.MeshLambertMaterial({ color: 0xffffff, wireframe: true }); - - for (let j = 0; j < 1000; j++) { - const lod = new THREE.LOD(); - - for (let i = 0; i < geometry.length; i++) { - const mesh = new THREE.Mesh(geometry[i][0], material); - mesh.scale.set(1.5, 1.5, 1.5); - mesh.updateMatrix(); - mesh.matrixAutoUpdate = false; - lod.addLevel(mesh, geometry[i][1]); - } - - lod.position.x = 10000 * (0.5 - Math.random()); - lod.position.y = 7500 * (0.5 - Math.random()); - lod.position.z = 10000 * (0.5 - Math.random()); - lod.updateMatrix(); - lod.matrixAutoUpdate = false; - scene.add(lod); - } - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - controls = new FlyControls(camera, renderer.domElement); - controls.movementSpeed = 1000; - controls.rollSpeed = Math.PI / 10; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - controls.update(timer.getDelta()); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_marchingcubes.ts b/examples-testing/examples/webgl_marchingcubes.ts deleted file mode 100644 index 4a4c6da0b..000000000 --- a/examples-testing/examples/webgl_marchingcubes.ts +++ /dev/null @@ -1,312 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { MarchingCubes } from 'three/addons/objects/MarchingCubes.js'; -import { ToonShader1, ToonShader2, ToonShaderHatching, ToonShaderDotted } from 'three/addons/shaders/ToonShader.js'; - -let container, stats; - -let camera, scene, renderer; - -let materials, current_material; - -let light, pointLight, ambientLight; - -let effect, resolution; - -let effectController; - -let time = 0; - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - container = document.getElementById('container'); - - // CAMERA - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(-500, 500, 1500); - - // SCENE - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - - // LIGHTS - - light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0.5, 0.5, 1); - scene.add(light); - - pointLight = new THREE.PointLight(0xff7c00, 3, 0, 0); - pointLight.position.set(0, 0, 100); - scene.add(pointLight); - - ambientLight = new THREE.AmbientLight(0x323232, 3); - scene.add(ambientLight); - - // MATERIALS - - materials = generateMaterials(); - current_material = 'shiny'; - - // MARCHING CUBES - - resolution = 28; - - effect = new MarchingCubes(resolution, materials[current_material], true, true, 100000); - effect.position.set(0, 0, 0); - effect.scale.set(700, 700, 700); - - effect.enableUvs = false; - effect.enableColors = false; - - scene.add(effect); - - // RENDERER - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // CONTROLS - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 500; - controls.maxDistance = 5000; - - // STATS - - stats = new Stats(); - container.appendChild(stats.dom); - - // GUI - - setupGui(); - - // EVENTS - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function generateMaterials() { - // environment map - - const path = 'textures/cube/SwedishRoyalCastle/'; - const format = '.jpg'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const cubeTextureLoader = new THREE.CubeTextureLoader(); - - const reflectionCube = cubeTextureLoader.load(urls); - const refractionCube = cubeTextureLoader.load(urls); - refractionCube.mapping = THREE.CubeRefractionMapping; - - // toons - - const toonMaterial1 = createShaderMaterial(ToonShader1, light, ambientLight); - const toonMaterial2 = createShaderMaterial(ToonShader2, light, ambientLight); - const hatchingMaterial = createShaderMaterial(ToonShaderHatching, light, ambientLight); - const dottedMaterial = createShaderMaterial(ToonShaderDotted, light, ambientLight); - - const texture = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.colorSpace = THREE.SRGBColorSpace; - - const materials = { - shiny: new THREE.MeshStandardMaterial({ - color: 0x9c0000, - envMap: reflectionCube, - roughness: 0.1, - metalness: 1.0, - }), - chrome: new THREE.MeshLambertMaterial({ color: 0xffffff, envMap: reflectionCube }), - liquid: new THREE.MeshLambertMaterial({ color: 0xffffff, envMap: refractionCube, refractionRatio: 0.85 }), - matte: new THREE.MeshPhongMaterial({ specular: 0x494949, shininess: 1 }), - flat: new THREE.MeshLambertMaterial({/*TODO flatShading: true */}), - textured: new THREE.MeshPhongMaterial({ color: 0xffffff, specular: 0x111111, shininess: 1, map: texture }), - colors: new THREE.MeshPhongMaterial({ color: 0xffffff, specular: 0xffffff, shininess: 2, vertexColors: true }), - multiColors: new THREE.MeshPhongMaterial({ shininess: 2, vertexColors: true }), - plastic: new THREE.MeshPhongMaterial({ specular: 0xc1c1c1, shininess: 250 }), - toon1: toonMaterial1, - toon2: toonMaterial2, - hatching: hatchingMaterial, - dotted: dottedMaterial, - }; - - return materials; -} - -function createShaderMaterial(shader, light, ambientLight) { - const u = THREE.UniformsUtils.clone(shader.uniforms); - - const vs = shader.vertexShader; - const fs = shader.fragmentShader; - - const material = new THREE.ShaderMaterial({ uniforms: u, vertexShader: vs, fragmentShader: fs }); - - material.uniforms['uDirLightPos'].value = light.position; - material.uniforms['uDirLightColor'].value = light.color; - - material.uniforms['uAmbientLightColor'].value = ambientLight.color; - - return material; -} - -// - -function setupGui() { - const createHandler = function (id) { - return function () { - current_material = id; - - effect.material = materials[id]; - effect.enableUvs = current_material === 'textured' ? true : false; - effect.enableColors = current_material === 'colors' || current_material === 'multiColors' ? true : false; - }; - }; - - effectController = { - material: 'shiny', - - speed: 1.0, - numBlobs: 10, - resolution: 28, - isolation: 80, - - floor: true, - wallx: false, - wallz: false, - - dummy: function () {}, - }; - - let h; - - const gui = new GUI(); - - // material (type) - - h = gui.addFolder('Materials'); - - for (const m in materials) { - effectController[m] = createHandler(m); - h.add(effectController, m).name(m); - } - - // simulation - - h = gui.addFolder('Simulation'); - - h.add(effectController, 'speed', 0.1, 8.0, 0.05); - h.add(effectController, 'numBlobs', 1, 50, 1); - h.add(effectController, 'resolution', 14, 100, 1); - h.add(effectController, 'isolation', 10, 300, 1); - - h.add(effectController, 'floor'); - h.add(effectController, 'wallx'); - h.add(effectController, 'wallz'); -} - -// this controls content of marching cubes voxel field - -function updateCubes(object, time, numblobs, floor, wallx, wallz) { - object.reset(); - - // fill the field with some metaballs - - const rainbow = [ - new THREE.Color(0xff0000), - new THREE.Color(0xffbb00), - new THREE.Color(0xffff00), - new THREE.Color(0x00ff00), - new THREE.Color(0x0000ff), - new THREE.Color(0x9400bd), - new THREE.Color(0xc800eb), - ]; - const subtract = 12; - const strength = 1.2 / ((Math.sqrt(numblobs) - 1) / 4 + 1); - - for (let i = 0; i < numblobs; i++) { - const ballx = Math.sin(i + 1.26 * time * (1.03 + 0.5 * Math.cos(0.21 * i))) * 0.27 + 0.5; - const bally = Math.abs(Math.cos(i + 1.12 * time * Math.cos(1.22 + 0.1424 * i))) * 0.77; // dip into the floor - const ballz = Math.cos(i + 1.32 * time * 0.1 * Math.sin(0.92 + 0.53 * i)) * 0.27 + 0.5; - - if (current_material === 'multiColors') { - object.addBall(ballx, bally, ballz, strength, subtract, rainbow[i % 7]); - } else { - object.addBall(ballx, bally, ballz, strength, subtract); - } - } - - if (floor) object.addPlaneY(2, 12); - if (wallz) object.addPlaneZ(2, 12); - if (wallx) object.addPlaneX(2, 12); - - object.update(); -} - -// - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - const delta = timer.getDelta(); - - time += delta * effectController.speed * 0.5; - - // marching cubes - - if (effectController.resolution !== resolution) { - resolution = effectController.resolution; - effect.init(Math.floor(resolution)); - } - - if (effectController.isolation !== effect.isolation) { - effect.isolation = effectController.isolation; - } - - updateCubes( - effect, - time, - effectController.numBlobs, - effectController.floor, - effectController.wallx, - effectController.wallz, - ); - - // render - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_alphahash.ts b/examples-testing/examples/webgl_materials_alphahash.ts deleted file mode 100644 index 790e31be4..000000000 --- a/examples-testing/examples/webgl_materials_alphahash.ts +++ /dev/null @@ -1,178 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, scene, renderer, controls, stats, mesh, material; - -let composer, renderPass, taaRenderPass, outputPass; - -let needsUpdate = false; - -const amount = parseInt(window.location.search.slice(1)) || 3; -const count = Math.pow(amount, 3); - -const color = new THREE.Color(); - -const params = { - alpha: 0.5, - alphaHash: true, - taa: true, - sampleLevel: 2, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(amount, amount, amount); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - - const geometry = new THREE.IcosahedronGeometry(0.5, 3); - - material = new THREE.MeshStandardMaterial({ - color: 0xffffff, - alphaHash: params.alphaHash, - opacity: params.alpha, - }); - - mesh = new THREE.InstancedMesh(geometry, material, count); - - let i = 0; - const offset = (amount - 1) / 2; - - const matrix = new THREE.Matrix4(); - - for (let x = 0; x < amount; x++) { - for (let y = 0; y < amount; y++) { - for (let z = 0; z < amount; z++) { - matrix.setPosition(offset - x, offset - y, offset - z); - - mesh.setMatrixAt(i, matrix); - mesh.setColorAt(i, color.setHex(Math.random() * 0xffffff)); - - i++; - } - } - } - - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - environment.dispose(); - - // - - composer = new EffectComposer(renderer); - - renderPass = new RenderPass(scene, camera); - renderPass.enabled = false; - - taaRenderPass = new TAARenderPass(scene, camera); - - outputPass = new OutputPass(); - - composer.addPass(renderPass); - composer.addPass(taaRenderPass); - composer.addPass(outputPass); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enablePan = false; - - controls.addEventListener('change', () => (needsUpdate = true)); - - // - - const gui = new GUI(); - - gui.add(params, 'alpha', 0, 1).onChange(onMaterialUpdate); - gui.add(params, 'alphaHash').onChange(onMaterialUpdate); - - const taaFolder = gui.addFolder('Temporal Anti-Aliasing'); - - taaFolder - .add(params, 'taa') - .name('enabled') - .onChange(() => { - renderPass.enabled = !params.taa; - taaRenderPass.enabled = params.taa; - - sampleLevelCtrl.enable(params.taa); - - needsUpdate = true; - }); - - const sampleLevelCtrl = taaFolder.add(params, 'sampleLevel', 0, 6, 1).onChange(() => (needsUpdate = true)); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); - - needsUpdate = true; -} - -function onMaterialUpdate() { - material.opacity = params.alpha; - material.alphaHash = params.alphaHash; - material.transparent = !params.alphaHash; - material.depthWrite = params.alphaHash; - - material.needsUpdate = true; - needsUpdate = true; -} - -function animate() { - render(); - - stats.update(); -} - -function render() { - if (needsUpdate) { - taaRenderPass.accumulate = false; - taaRenderPass.sampleLevel = 0; - - needsUpdate = false; - } else { - taaRenderPass.accumulate = true; - taaRenderPass.sampleLevel = params.sampleLevel; - } - - composer.render(); -} diff --git a/examples-testing/examples/webgl_materials_blending.ts b/examples-testing/examples/webgl_materials_blending.ts deleted file mode 100644 index fb2e6a91e..000000000 --- a/examples-testing/examples/webgl_materials_blending.ts +++ /dev/null @@ -1,149 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; -let mapBg; - -const textureLoader = new THREE.TextureLoader(); - -init(); - -function init() { - // CAMERA - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 600; - - // SCENE - - scene = new THREE.Scene(); - - // BACKGROUND - - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - canvas.width = canvas.height = 128; - ctx.fillStyle = '#ddd'; - ctx.fillRect(0, 0, 128, 128); - ctx.fillStyle = '#555'; - ctx.fillRect(0, 0, 64, 64); - ctx.fillStyle = '#999'; - ctx.fillRect(32, 32, 32, 32); - ctx.fillStyle = '#555'; - ctx.fillRect(64, 64, 64, 64); - ctx.fillStyle = '#777'; - ctx.fillRect(96, 96, 32, 32); - - mapBg = new THREE.CanvasTexture(canvas); - mapBg.colorSpace = THREE.SRGBColorSpace; - mapBg.wrapS = mapBg.wrapT = THREE.RepeatWrapping; - mapBg.repeat.set(64, 32); - - scene.background = mapBg; - - // OBJECTS - - const blendings = [ - { name: 'No', constant: THREE.NoBlending }, - { name: 'Normal', constant: THREE.NormalBlending }, - { name: 'Additive', constant: THREE.AdditiveBlending }, - { name: 'Subtractive', constant: THREE.SubtractiveBlending }, - { name: 'Multiply', constant: THREE.MultiplyBlending }, - ]; - - const assignSRGB = texture => { - texture.colorSpace = THREE.SRGBColorSpace; - }; - - const map0 = textureLoader.load('textures/uv_grid_opengl.jpg', assignSRGB); - const map1 = textureLoader.load('textures/sprite0.jpg', assignSRGB); - const map2 = textureLoader.load('textures/sprite0.png', assignSRGB); - const map3 = textureLoader.load('textures/lensflare/lensflare0.png', assignSRGB); - const map4 = textureLoader.load('textures/lensflare/lensflare0_alpha.png', assignSRGB); - - const geo1 = new THREE.PlaneGeometry(100, 100); - const geo2 = new THREE.PlaneGeometry(100, 25); - - addImageRow(map0, 300); - addImageRow(map1, 150); - addImageRow(map2, 0); - addImageRow(map3, -150); - addImageRow(map4, -300); - - function addImageRow(map, y) { - for (let i = 0; i < blendings.length; i++) { - const blending = blendings[i]; - - const material = new THREE.MeshBasicMaterial({ map: map }); - material.transparent = true; - material.blending = blending.constant; - - material.premultipliedAlpha = true; - - const x = (i - blendings.length / 2) * 110; - const z = 0; - - let mesh = new THREE.Mesh(geo1, material); - mesh.position.set(x, y, z); - scene.add(mesh); - - mesh = new THREE.Mesh(geo2, generateLabelMaterial(blending.name)); - mesh.position.set(x, y - 75, z); - scene.add(mesh); - } - } - - // RENDERER - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // EVENTS - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - const SCREEN_WIDTH = window.innerWidth; - const SCREEN_HEIGHT = window.innerHeight; - - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - - camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - camera.updateProjectionMatrix(); -} - -function generateLabelMaterial(text) { - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - canvas.width = 128; - canvas.height = 32; - - ctx.fillStyle = 'rgba( 0, 0, 0, 0.95 )'; - ctx.fillRect(0, 0, 128, 32); - - ctx.fillStyle = 'white'; - ctx.font = 'bold 12pt arial'; - ctx.fillText(text, 10, 22); - - const map = new THREE.CanvasTexture(canvas); - map.colorSpace = THREE.SRGBColorSpace; - - const material = new THREE.MeshBasicMaterial({ map: map, transparent: true }); - - return material; -} - -function animate() { - const time = Date.now() * 0.00025; - const ox = (time * -0.01 * mapBg.repeat.x) % 1; - const oy = (time * -0.01 * mapBg.repeat.y) % 1; - - mapBg.offset.set(ox, oy); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_blending_custom.ts b/examples-testing/examples/webgl_materials_blending_custom.ts deleted file mode 100644 index 072447426..000000000 --- a/examples-testing/examples/webgl_materials_blending_custom.ts +++ /dev/null @@ -1,214 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer; - -let mapBg; -const materials = []; - -const params = { - blendEquation: THREE.AddEquation, -}; - -const equations = { - Add: THREE.AddEquation, - Subtract: THREE.SubtractEquation, - ReverseSubtract: THREE.ReverseSubtractEquation, - Min: THREE.MinEquation, - Max: THREE.MaxEquation, -}; - -init(); - -function init() { - // CAMERA - - camera = new THREE.PerspectiveCamera(80, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 700; - - // SCENE - - scene = new THREE.Scene(); - - // BACKGROUND - - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - canvas.width = canvas.height = 128; - ctx.fillStyle = '#ddd'; - ctx.fillRect(0, 0, 128, 128); - ctx.fillStyle = '#555'; - ctx.fillRect(0, 0, 64, 64); - ctx.fillStyle = '#999'; - ctx.fillRect(32, 32, 32, 32); - ctx.fillStyle = '#555'; - ctx.fillRect(64, 64, 64, 64); - ctx.fillStyle = '#777'; - ctx.fillRect(96, 96, 32, 32); - - mapBg = new THREE.CanvasTexture(canvas); - mapBg.colorSpace = THREE.SRGBColorSpace; - mapBg.wrapS = mapBg.wrapT = THREE.RepeatWrapping; - mapBg.repeat.set(64, 32); - - scene.background = mapBg; - - // FOREGROUND OBJECTS - - const src = [ - { name: 'Zero', constant: THREE.ZeroFactor }, - { name: 'One', constant: THREE.OneFactor }, - { name: 'SrcColor', constant: THREE.SrcColorFactor }, - { name: 'OneMinusSrcColor', constant: THREE.OneMinusSrcColorFactor }, - { name: 'SrcAlpha', constant: THREE.SrcAlphaFactor }, - { name: 'OneMinusSrcAlpha', constant: THREE.OneMinusSrcAlphaFactor }, - { name: 'DstAlpha', constant: THREE.DstAlphaFactor }, - { name: 'OneMinusDstAlpha', constant: THREE.OneMinusDstAlphaFactor }, - { name: 'DstColor', constant: THREE.DstColorFactor }, - { name: 'OneMinusDstColor', constant: THREE.OneMinusDstColorFactor }, - { name: 'SrcAlphaSaturate', constant: THREE.SrcAlphaSaturateFactor }, - ]; - - const dst = [ - { name: 'Zero', constant: THREE.ZeroFactor }, - { name: 'One', constant: THREE.OneFactor }, - { name: 'SrcColor', constant: THREE.SrcColorFactor }, - { name: 'OneMinusSrcColor', constant: THREE.OneMinusSrcColorFactor }, - { name: 'SrcAlpha', constant: THREE.SrcAlphaFactor }, - { name: 'OneMinusSrcAlpha', constant: THREE.OneMinusSrcAlphaFactor }, - { name: 'DstAlpha', constant: THREE.DstAlphaFactor }, - { name: 'OneMinusDstAlpha', constant: THREE.OneMinusDstAlphaFactor }, - { name: 'DstColor', constant: THREE.DstColorFactor }, - { name: 'OneMinusDstColor', constant: THREE.OneMinusDstColorFactor }, - ]; - - const geo1 = new THREE.PlaneGeometry(100, 100); - const geo2 = new THREE.PlaneGeometry(100, 25); - - const texture = new THREE.TextureLoader().load('textures/lensflare/lensflare0_alpha.png'); - texture.colorSpace = THREE.SRGBColorSpace; - - for (let i = 0; i < dst.length; i++) { - const blendDst = dst[i]; - - for (let j = 0; j < src.length; j++) { - const blendSrc = src[j]; - - const material = new THREE.MeshBasicMaterial({ map: texture }); - material.transparent = true; - - material.blending = THREE.CustomBlending; - material.blendSrc = blendSrc.constant; - material.blendDst = blendDst.constant; - material.blendEquation = THREE.AddEquation; - - const x = (j - src.length / 2) * 110; - const z = 0; - const y = (i - dst.length / 2) * 110 + 50; - - const mesh = new THREE.Mesh(geo1, material); - mesh.position.set(x, -y, z); - mesh.matrixAutoUpdate = false; - mesh.updateMatrix(); - scene.add(mesh); - - materials.push(material); - } - } - - for (let j = 0; j < src.length; j++) { - const blendSrc = src[j]; - - const x = (j - src.length / 2) * 110; - const z = 0; - const y = (0 - dst.length / 2) * 110 + 50; - - const mesh = new THREE.Mesh(geo2, generateLabelMaterial(blendSrc.name, 'rgba( 0, 150, 0, 1 )')); - mesh.position.set(x, -(y - 70), z); - mesh.matrixAutoUpdate = false; - mesh.updateMatrix(); - scene.add(mesh); - } - - for (let i = 0; i < dst.length; i++) { - const blendDst = dst[i]; - - const x = (0 - src.length / 2) * 110 - 125; - const z = 0; - const y = (i - dst.length / 2) * 110 + 165; - - const mesh = new THREE.Mesh(geo2, generateLabelMaterial(blendDst.name, 'rgba( 150, 0, 0, 1 )')); - mesh.position.set(x, -(y - 120), z); - mesh.matrixAutoUpdate = false; - mesh.updateMatrix(); - scene.add(mesh); - } - - // RENDERER - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // EVENTS - - window.addEventListener('resize', onWindowResize); - - // GUI - - // - const gui = new GUI({ width: 300 }); - - gui.add(params, 'blendEquation', equations).onChange(updateBlendEquation); - gui.open(); -} - -// - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -// - -function generateLabelMaterial(text, bg) { - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - canvas.width = 128; - canvas.height = 32; - - ctx.fillStyle = bg; - ctx.fillRect(0, 0, 128, 32); - - ctx.fillStyle = 'white'; - ctx.font = 'bold 11pt arial'; - ctx.fillText(text, 8, 22); - - const map = new THREE.CanvasTexture(canvas); - map.colorSpace = THREE.SRGBColorSpace; - - const material = new THREE.MeshBasicMaterial({ map: map, transparent: true }); - return material; -} - -function updateBlendEquation(value) { - for (const material of materials) { - material.blendEquation = value; - } -} - -function animate() { - const time = Date.now() * 0.00025; - const ox = (time * -0.01 * mapBg.repeat.x) % 1; - const oy = (time * -0.01 * mapBg.repeat.y) % 1; - - mapBg.offset.set(ox, oy); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_bumpmap.ts b/examples-testing/examples/webgl_materials_bumpmap.ts deleted file mode 100644 index a09c21573..000000000 --- a/examples-testing/examples/webgl_materials_bumpmap.ts +++ /dev/null @@ -1,134 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container, loader; - -let camera, scene, renderer, controls; - -let mesh; - -let spotLight; - -const params = { - enableBumpMap: true, -}; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 12; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x060708); - - // LIGHTS - - scene.add(new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3)); - - spotLight = new THREE.SpotLight(0xffffde, 200); - spotLight.position.set(3.5, 0, 7); - scene.add(spotLight); - - spotLight.castShadow = true; - - spotLight.shadow.mapSize.width = 2048; - spotLight.shadow.mapSize.height = 2048; - - spotLight.shadow.camera.near = 2; - spotLight.shadow.camera.far = 15; - - spotLight.shadow.camera.fov = 40; - - spotLight.shadow.bias = -0.005; - - // - - const mapHeight = new THREE.TextureLoader().load( - 'models/gltf/LeePerrySmith/Infinite-Level_02_Disp_NoSmoothUV-4096.jpg', - ); - - const material = new THREE.MeshPhongMaterial({ - color: 0x9c6e49, - specular: 0x666666, - shininess: 25, - bumpMap: mapHeight, - bumpScale: 10, - }); - - loader = new GLTFLoader(); - loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - createScene(gltf.scene.children[0].geometry, 1, material); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - renderer.shadowMap.enabled = true; - - // EVENTS - - window.addEventListener('resize', onWindowResize); - - // GUI - - const gui = new GUI(); - - gui.add(params, 'enableBumpMap') - .name('enable bump map') - .onChange(value => { - mesh.material.bumpMap = value === true ? mapHeight : null; - mesh.material.needsUpdate = true; - }); - gui.add(material, 'bumpScale', 0, 40).name('bump scale'); - gui.open(); - - // CONTROLS - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 8; - controls.maxDistance = 50; - controls.enablePan = false; - controls.enableDamping = true; -} - -function createScene(geometry, scale, material) { - mesh = new THREE.Mesh(geometry, material); - - mesh.position.y = -0.5; - mesh.scale.set(scale, scale, scale); - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); -} - -// - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -// - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_car.ts b/examples-testing/examples/webgl_materials_car.ts deleted file mode 100644 index a839e8dce..000000000 --- a/examples-testing/examples/webgl_materials_car.ts +++ /dev/null @@ -1,168 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let camera, scene, renderer; -let stats; - -let grid; -let controls; - -const wheels = []; - -function init() { - const container = document.getElementById('container'); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.85; - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(4.25, 1.4, -4.5); - - controls = new OrbitControls(camera, container); - controls.maxDistance = 9; - controls.maxPolarAngle = THREE.MathUtils.degToRad(90); - controls.target.set(0, 0.5, 0); - controls.update(); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x333333); - scene.environment = new HDRLoader().load('textures/equirectangular/venice_sunset_1k.hdr'); - scene.environment.mapping = THREE.EquirectangularReflectionMapping; - scene.fog = new THREE.Fog(0x333333, 10, 15); - - grid = new THREE.GridHelper(20, 40, 0xffffff, 0xffffff); - grid.material.opacity = 0.2; - grid.material.depthWrite = false; - grid.material.transparent = true; - scene.add(grid); - - // materials - - const bodyMaterial = new THREE.MeshPhysicalMaterial({ - color: 0xff0000, - metalness: 1.0, - roughness: 0.5, - clearcoat: 1.0, - clearcoatRoughness: 0.03, - }); - - const detailsMaterial = new THREE.MeshStandardMaterial({ - color: 0xffffff, - metalness: 1.0, - roughness: 0.5, - }); - - const glassMaterial = new THREE.MeshPhysicalMaterial({ - color: 0xffffff, - metalness: 0.25, - roughness: 0, - transmission: 1.0, - }); - - const bodyColorInput = document.getElementById('body-color'); - bodyColorInput.addEventListener('input', function () { - bodyMaterial.color.set(this.value); - }); - - const detailsColorInput = document.getElementById('details-color'); - detailsColorInput.addEventListener('input', function () { - detailsMaterial.color.set(this.value); - }); - - const glassColorInput = document.getElementById('glass-color'); - glassColorInput.addEventListener('input', function () { - glassMaterial.color.set(this.value); - }); - - // Car - - const shadow = new THREE.TextureLoader().load('models/gltf/ferrari_ao.png'); - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - - loader.load('models/gltf/ferrari.glb', function (gltf) { - const carModel = gltf.scene.children[0]; - - carModel.getObjectByName('body').material = bodyMaterial; - - carModel.getObjectByName('rim_fl').material = detailsMaterial; - carModel.getObjectByName('rim_fr').material = detailsMaterial; - carModel.getObjectByName('rim_rr').material = detailsMaterial; - carModel.getObjectByName('rim_rl').material = detailsMaterial; - carModel.getObjectByName('trim').material = detailsMaterial; - - carModel.getObjectByName('glass').material = glassMaterial; - - wheels.push( - carModel.getObjectByName('wheel_fl'), - carModel.getObjectByName('wheel_fr'), - carModel.getObjectByName('wheel_rl'), - carModel.getObjectByName('wheel_rr'), - ); - - // shadow - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(0.655 * 4, 1.3 * 4), - new THREE.MeshBasicMaterial({ - map: shadow, - blending: THREE.MultiplyBlending, - toneMapped: false, - transparent: true, - premultipliedAlpha: true, - }), - ); - mesh.rotation.x = -Math.PI / 2; - mesh.renderOrder = 2; - carModel.add(mesh); - - scene.add(carModel); - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - const time = -performance.now() / 1000; - - for (let i = 0; i < wheels.length; i++) { - wheels[i].rotation.x = time * Math.PI * 2; - } - - grid.position.z = -time % 1; - - renderer.render(scene, camera); - - stats.update(); -} - -init(); diff --git a/examples-testing/examples/webgl_materials_cubemap.ts b/examples-testing/examples/webgl_materials_cubemap.ts deleted file mode 100644 index 5f2692751..000000000 --- a/examples-testing/examples/webgl_materials_cubemap.ts +++ /dev/null @@ -1,115 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; - -let container, stats; - -let camera, scene, renderer; - -let pointLight; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 13; - - //cubemap - const path = 'textures/cube/SwedishRoyalCastle/'; - const format = '.jpg'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const reflectionCube = new THREE.CubeTextureLoader().load(urls); - const refractionCube = new THREE.CubeTextureLoader().load(urls); - refractionCube.mapping = THREE.CubeRefractionMapping; - - scene = new THREE.Scene(); - scene.background = reflectionCube; - - //lights - const ambient = new THREE.AmbientLight(0xffffff, 3); - scene.add(ambient); - - pointLight = new THREE.PointLight(0xffffff, 200); - scene.add(pointLight); - - //materials - const cubeMaterial3 = new THREE.MeshLambertMaterial({ - color: 0xffaa00, - envMap: reflectionCube, - combine: THREE.MixOperation, - reflectivity: 0.3, - }); - const cubeMaterial2 = new THREE.MeshLambertMaterial({ - color: 0xfff700, - envMap: refractionCube, - refractionRatio: 0.95, - }); - const cubeMaterial1 = new THREE.MeshLambertMaterial({ color: 0xffffff, envMap: reflectionCube }); - - //models - const objLoader = new OBJLoader(); - - objLoader.setPath('models/obj/walt/'); - objLoader.load('WaltHead.obj', function (object) { - const head = object.children[0]; - head.scale.setScalar(0.1); - head.position.y = -3; - head.material = cubeMaterial1; - - const head2 = head.clone(); - head2.position.x = -6; - head2.material = cubeMaterial2; - - const head3 = head.clone(); - head3.position.x = 6; - head3.material = cubeMaterial3; - - scene.add(head, head2, head3); - }); - - //renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - //controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enablePan = false; - controls.minPolarAngle = Math.PI / 4; - controls.maxPolarAngle = Math.PI / 1.5; - - //stats - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); - stats.update(); -} diff --git a/examples-testing/examples/webgl_materials_cubemap_dynamic.ts b/examples-testing/examples/webgl_materials_cubemap_dynamic.ts deleted file mode 100644 index 301835dda..000000000 --- a/examples-testing/examples/webgl_materials_cubemap_dynamic.ts +++ /dev/null @@ -1,115 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, stats; -let cube, sphere, torus, material; - -let cubeCamera, cubeRenderTarget; - -let controls; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResized); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 75; - - scene = new THREE.Scene(); - scene.rotation.y = 0.5; // avoid flying objects occluding the sun - - new HDRLoader().setPath('textures/equirectangular/').load('quarry_01_1k.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - }); - - // - - cubeRenderTarget = new THREE.WebGLCubeRenderTarget(256); - cubeRenderTarget.texture.type = THREE.HalfFloatType; - - cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); - - // - - material = new THREE.MeshStandardMaterial({ - envMap: cubeRenderTarget.texture, - roughness: 0.05, - metalness: 1, - }); - - const gui = new GUI(); - gui.add(material, 'roughness', 0, 1); - gui.add(material, 'metalness', 0, 1); - gui.add(renderer, 'toneMappingExposure', 0, 2).name('exposure'); - - sphere = new THREE.Mesh(new THREE.IcosahedronGeometry(15, 8), material); - scene.add(sphere); - - const material2 = new THREE.MeshStandardMaterial({ - roughness: 0.1, - metalness: 0, - }); - - cube = new THREE.Mesh(new THREE.BoxGeometry(15, 15, 15), material2); - scene.add(cube); - - torus = new THREE.Mesh(new THREE.TorusKnotGeometry(8, 3, 128, 16), material2); - scene.add(torus); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; -} - -function onWindowResized() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -function animate(msTime) { - const time = msTime / 1000; - - cube.position.x = Math.cos(time) * 30; - cube.position.y = Math.sin(time) * 30; - cube.position.z = Math.sin(time) * 30; - - cube.rotation.x += 0.02; - cube.rotation.y += 0.03; - - torus.position.x = Math.cos(time + 10) * 30; - torus.position.y = Math.sin(time + 10) * 30; - torus.position.z = Math.sin(time + 10) * 30; - - torus.rotation.x += 0.02; - torus.rotation.y += 0.03; - - cubeCamera.update(renderer, scene); - - controls.update(); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_materials_cubemap_mipmaps.ts b/examples-testing/examples/webgl_materials_cubemap_mipmaps.ts deleted file mode 100644 index 944f4c18e..000000000 --- a/examples-testing/examples/webgl_materials_cubemap_mipmaps.ts +++ /dev/null @@ -1,119 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container; - -let camera, scene, renderer; - -init(); - -//load customized cube texture -async function loadCubeTextureWithMipmaps() { - const path = 'textures/cube/angus/'; - const format = '.jpg'; - const mipmaps = []; - const maxLevel = 8; - - async function loadCubeTexture(urls) { - return new Promise(function (resolve) { - new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { - resolve(cubeTexture); - }); - }); - } - - // load mipmaps - const pendings = []; - - for (let level = 0; level <= maxLevel; ++level) { - const urls = []; - - for (let face = 0; face < 6; ++face) { - urls.push(path + 'cube_m0' + level + '_c0' + face + format); - } - - const mipmapLevel = level; - - pendings.push( - loadCubeTexture(urls).then(function (cubeTexture) { - mipmaps[mipmapLevel] = cubeTexture; - }), - ); - } - - await Promise.all(pendings); - - const customizedCubeTexture = mipmaps.shift(); - customizedCubeTexture.mipmaps = mipmaps; - customizedCubeTexture.colorSpace = THREE.SRGBColorSpace; - customizedCubeTexture.minFilter = THREE.LinearMipMapLinearFilter; - customizedCubeTexture.magFilter = THREE.LinearFilter; - customizedCubeTexture.generateMipmaps = false; - customizedCubeTexture.needsUpdate = true; - - return customizedCubeTexture; -} - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 500; - - scene = new THREE.Scene(); - - loadCubeTextureWithMipmaps().then(function (cubeTexture) { - //model - const sphere = new THREE.SphereGeometry(100, 128, 128); - - //manual mipmaps - let material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: cubeTexture }); - material.name = 'manual mipmaps'; - - let mesh = new THREE.Mesh(sphere, material); - mesh.position.set(100, 0, 0); - scene.add(mesh); - - //webgl mipmaps - material = material.clone(); - material.name = 'auto mipmaps'; - - const autoCubeTexture = cubeTexture.clone(); - autoCubeTexture.mipmaps = []; - autoCubeTexture.generateMipmaps = true; - autoCubeTexture.needsUpdate = true; - - material.envMap = autoCubeTexture; - - mesh = new THREE.Mesh(sphere, material); - mesh.position.set(-100, 0, 0); - scene.add(mesh); - }); - - //renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - //controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.minPolarAngle = Math.PI / 4; - controls.maxPolarAngle = Math.PI / 1.5; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_cubemap_refraction.ts b/examples-testing/examples/webgl_materials_cubemap_refraction.ts deleted file mode 100644 index 8c025071f..000000000 --- a/examples-testing/examples/webgl_materials_cubemap_refraction.ts +++ /dev/null @@ -1,126 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; - -let container, stats; - -let camera, scene, renderer; - -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 100000); - camera.position.z = -4000; - - // - - const r = 'textures/cube/Park3Med/'; - - const urls = [r + 'px.jpg', r + 'nx.jpg', r + 'py.jpg', r + 'ny.jpg', r + 'pz.jpg', r + 'nz.jpg']; - - const textureCube = new THREE.CubeTextureLoader().load(urls); - textureCube.mapping = THREE.CubeRefractionMapping; - - scene = new THREE.Scene(); - scene.background = textureCube; - - // LIGHTS - - const ambient = new THREE.AmbientLight(0xffffff, 3.5); - scene.add(ambient); - - // material samples - - const cubeMaterial3 = new THREE.MeshPhongMaterial({ - color: 0xccddff, - envMap: textureCube, - refractionRatio: 0.98, - reflectivity: 0.9, - }); - const cubeMaterial2 = new THREE.MeshPhongMaterial({ color: 0xccfffd, envMap: textureCube, refractionRatio: 0.985 }); - const cubeMaterial1 = new THREE.MeshPhongMaterial({ color: 0xffffff, envMap: textureCube, refractionRatio: 0.98 }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - const loader = new PLYLoader(); - loader.load('models/ply/binary/Lucy100k.ply', function (geometry) { - createScene(geometry, cubeMaterial1, cubeMaterial2, cubeMaterial3); - }); - - document.addEventListener('mousemove', onDocumentMouseMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function createScene(geometry, m1, m2, m3) { - geometry.computeVertexNormals(); - - const s = 1.5; - - let mesh = new THREE.Mesh(geometry, m1); - mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.add(mesh); - - mesh = new THREE.Mesh(geometry, m2); - mesh.position.x = -1500; - mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.add(mesh); - - mesh = new THREE.Mesh(geometry, m3); - mesh.position.x = 1500; - mesh.scale.x = mesh.scale.y = mesh.scale.z = s; - scene.add(mesh); -} - -function onDocumentMouseMove(event) { - mouseX = (event.clientX - windowHalfX) * 4; - mouseY = (event.clientY - windowHalfY) * 4; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts b/examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts deleted file mode 100644 index 599a1369b..000000000 --- a/examples-testing/examples/webgl_materials_cubemap_render_to_mipmaps.ts +++ /dev/null @@ -1,183 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container; -let camera, scene, renderer; - -const CubemapFilterShader = { - name: 'CubemapFilterShader', - - uniforms: { - cubeTexture: { value: null }, - mipIndex: { value: 0 }, - }, - - vertexShader: /* glsl */ ` - - varying vec3 vWorldDirection; - - #include - - void main() { - vWorldDirection = transformDirection(position, modelMatrix); - #include - #include - gl_Position.z = gl_Position.w; // set z to camera.far - } - - `, - - fragmentShader: /* glsl */ ` - - uniform samplerCube cubeTexture; - varying vec3 vWorldDirection; - - uniform float mipIndex; - - #include - - void main() { - vec3 cubeCoordinates = normalize(vWorldDirection); - - // Colorize mip levels - vec4 color = vec4(1.0, 0.0, 0.0, 1.0); - if (mipIndex == 0.0) color.rgb = vec3(1.0, 1.0, 1.0); - else if (mipIndex == 1.0) color.rgb = vec3(0.0, 0.0, 1.0); - else if (mipIndex == 2.0) color.rgb = vec3(0.0, 1.0, 1.0); - else if (mipIndex == 3.0) color.rgb = vec3(0.0, 1.0, 0.0); - else if (mipIndex == 4.0) color.rgb = vec3(1.0, 1.0, 0.0); - - gl_FragColor = textureCube(cubeTexture, cubeCoordinates, 0.0) * color; - } - - `, -}; - -init(); - -async function loadCubeTexture(urls) { - return new Promise(function (resolve) { - new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { - resolve(cubeTexture); - }); - }); -} - -function allocateCubemapRenderTarget(cubeMapSize) { - const params = { - magFilter: THREE.LinearFilter, - minFilter: THREE.LinearMipMapLinearFilter, - generateMipmaps: false, - type: THREE.HalfFloatType, - format: THREE.RGBAFormat, - colorSpace: THREE.LinearSRGBColorSpace, - depthBuffer: false, - }; - - const rt = new THREE.WebGLCubeRenderTarget(cubeMapSize, params); - - const mipLevels = Math.log(cubeMapSize) * Math.LOG2E + 1.0; - for (let i = 0; i < mipLevels; i++) rt.texture.mipmaps.push({}); - - rt.texture.mapping = THREE.CubeReflectionMapping; - return rt; -} - -function renderToCubeTexture(cubeMapRenderTarget, sourceCubeTexture) { - const geometry = new THREE.BoxGeometry(5, 5, 5); - - const material = new THREE.ShaderMaterial({ - name: CubemapFilterShader.name, - uniforms: THREE.UniformsUtils.clone(CubemapFilterShader.uniforms), - vertexShader: CubemapFilterShader.vertexShader, - fragmentShader: CubemapFilterShader.fragmentShader, - side: THREE.BackSide, - blending: THREE.NoBlending, - }); - - material.uniforms.cubeTexture.value = sourceCubeTexture; - - const mesh = new THREE.Mesh(geometry, material); - const cubeCamera = new THREE.CubeCamera(1, 10, cubeMapRenderTarget); - const mipmapCount = Math.floor(Math.log2(Math.max(cubeMapRenderTarget.width, cubeMapRenderTarget.height))); - - for (let mipmap = 0; mipmap < mipmapCount; mipmap++) { - material.uniforms.mipIndex.value = mipmap; - material.needsUpdate = true; - - cubeMapRenderTarget.viewport.set( - 0, - 0, - cubeMapRenderTarget.width >> mipmap, - cubeMapRenderTarget.height >> mipmap, - ); - - cubeCamera.activeMipmapLevel = mipmap; - cubeCamera.update(renderer, mesh); - } - - mesh.geometry.dispose(); - mesh.material.dispose(); -} - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // Create renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 500; - - // Create controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.minPolarAngle = Math.PI / 4; - controls.maxPolarAngle = Math.PI / 1.5; - - window.addEventListener('resize', onWindowResize); - - // Load a cube texture - const r = 'textures/cube/Park3Med/'; - const urls = [r + 'px.jpg', r + 'nx.jpg', r + 'py.jpg', r + 'ny.jpg', r + 'pz.jpg', r + 'nz.jpg']; - - loadCubeTexture(urls).then(cubeTexture => { - // Allocate a cube map render target - const cubeMapRenderTarget = allocateCubemapRenderTarget(512); - - // Render to all the mip levels of cubeMapRenderTarget - renderToCubeTexture(cubeMapRenderTarget, cubeTexture); - - // Create geometry - const sphere = new THREE.SphereGeometry(100, 128, 128); - let material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: cubeTexture }); - - let mesh = new THREE.Mesh(sphere, material); - mesh.position.set(-100, 0, 0); - scene.add(mesh); - - material = material.clone(); - material.envMap = cubeMapRenderTarget.texture; - - mesh = new THREE.Mesh(sphere, material); - mesh.position.set(100, 0, 0); - scene.add(mesh); - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_displacementmap.ts b/examples-testing/examples/webgl_materials_displacementmap.ts deleted file mode 100644 index fd0be9a5e..000000000 --- a/examples-testing/examples/webgl_materials_displacementmap.ts +++ /dev/null @@ -1,224 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; - -let stats; -let camera, scene, renderer, controls; - -const settings = { - metalness: 1.0, - roughness: 0.4, - ambientIntensity: 0.2, - aoMapIntensity: 1.0, - envMapIntensity: 1.0, - displacementScale: 2.436143, // from original model - normalScale: 1.0, -}; - -let mesh, material; - -let pointLight, ambientLight; - -const height = 500; // of camera frustum - -let r = 0.0; - -init(); -initGui(); - -// Init gui -function initGui() { - const gui = new GUI(); - //let gui = gui.addFolder( "Material" ); - gui.add(settings, 'metalness') - .min(0) - .max(1) - .onChange(function (value) { - material.metalness = value; - }); - - gui.add(settings, 'roughness') - .min(0) - .max(1) - .onChange(function (value) { - material.roughness = value; - }); - - gui.add(settings, 'aoMapIntensity') - .min(0) - .max(1) - .onChange(function (value) { - material.aoMapIntensity = value; - }); - - gui.add(settings, 'ambientIntensity') - .min(0) - .max(1) - .onChange(function (value) { - ambientLight.intensity = value; - }); - - gui.add(settings, 'envMapIntensity') - .min(0) - .max(3) - .onChange(function (value) { - material.envMapIntensity = value; - }); - - gui.add(settings, 'displacementScale') - .min(0) - .max(3.0) - .onChange(function (value) { - material.displacementScale = value; - }); - - gui.add(settings, 'normalScale') - .min(-1) - .max(1) - .onChange(function (value) { - material.normalScale.set(1, -1).multiplyScalar(value); - }); -} - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - scene = new THREE.Scene(); - - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera(-height * aspect, height * aspect, height, -height, 1, 10000); - camera.position.z = 1500; - scene.add(camera); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enableDamping = true; - - // lights - - ambientLight = new THREE.AmbientLight(0xffffff, settings.ambientIntensity); - scene.add(ambientLight); - - pointLight = new THREE.PointLight(0xff0000, 1.5, 0, 0); - pointLight.position.z = 2500; - scene.add(pointLight); - - const pointLight2 = new THREE.PointLight(0xff6666, 3, 0, 0); - camera.add(pointLight2); - - const pointLight3 = new THREE.PointLight(0x0000ff, 1.5, 0, 0); - pointLight3.position.x = -1000; - pointLight3.position.z = 1000; - scene.add(pointLight3); - - // env map - - const path = 'textures/cube/SwedishRoyalCastle/'; - const format = '.jpg'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const reflectionCube = new THREE.CubeTextureLoader().load(urls); - - // textures - - const textureLoader = new THREE.TextureLoader(); - const normalMap = textureLoader.load('models/obj/ninja/normal.png'); - const aoMap = textureLoader.load('models/obj/ninja/ao.jpg'); - const displacementMap = textureLoader.load('models/obj/ninja/displacement.jpg'); - - // material - - material = new THREE.MeshStandardMaterial({ - color: 0xc1c1c1, - roughness: settings.roughness, - metalness: settings.metalness, - - normalMap: normalMap, - normalScale: new THREE.Vector2(1, -1), // why does the normal map require negation in this case? - - aoMap: aoMap, - aoMapIntensity: 1, - - displacementMap: displacementMap, - displacementScale: settings.displacementScale, - displacementBias: -0.428408, // from original model - - envMap: reflectionCube, - envMapIntensity: settings.envMapIntensity, - - side: THREE.DoubleSide, - }); - - // - - const loader = new OBJLoader(); - loader.load('models/obj/ninja/ninjaHead_Low.obj', function (group) { - const geometry = group.children[0].geometry; - geometry.center(); - - mesh = new THREE.Mesh(geometry, material); - mesh.scale.multiplyScalar(25); - scene.add(mesh); - }); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const aspect = window.innerWidth / window.innerHeight; - - camera.left = -height * aspect; - camera.right = height * aspect; - camera.top = height; - camera.bottom = -height; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - controls.update(); - - stats.begin(); - render(); - stats.end(); -} - -function render() { - pointLight.position.x = 2500 * Math.cos(r); - pointLight.position.z = 2500 * Math.sin(r); - - r += 0.01; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_envmaps.ts b/examples-testing/examples/webgl_materials_envmaps.ts deleted file mode 100644 index 18a5542ed..000000000 --- a/examples-testing/examples/webgl_materials_envmaps.ts +++ /dev/null @@ -1,131 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let controls, camera, scene, renderer; -let textureEquirec, textureCube; -let sphereMesh, sphereMaterial, params; - -init(); - -function init() { - // CAMERAS - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 2.5); - - // SCENE - - scene = new THREE.Scene(); - - // Textures - - const loader = new THREE.CubeTextureLoader(); - loader.setPath('textures/cube/Bridge2/'); - - textureCube = loader.load(['posx.jpg', 'negx.jpg', 'posy.jpg', 'negy.jpg', 'posz.jpg', 'negz.jpg']); - - const textureLoader = new THREE.TextureLoader(); - - textureEquirec = textureLoader.load('textures/2294472375_24a3b8ef46_o.jpg'); - textureEquirec.mapping = THREE.EquirectangularReflectionMapping; - textureEquirec.colorSpace = THREE.SRGBColorSpace; - - scene.background = textureCube; - - // - - const geometry = new THREE.IcosahedronGeometry(1, 15); - sphereMaterial = new THREE.MeshBasicMaterial({ envMap: textureCube }); - sphereMesh = new THREE.Mesh(geometry, sphereMaterial); - scene.add(sphereMesh); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1.5; - controls.maxDistance = 6; - - // - - params = { - Cube: function () { - scene.background = textureCube; - - sphereMaterial.envMap = textureCube; - sphereMaterial.needsUpdate = true; - }, - Equirectangular: function () { - scene.background = textureEquirec; - - sphereMaterial.envMap = textureEquirec; - sphereMaterial.needsUpdate = true; - }, - Refraction: false, - backgroundRotationX: false, - backgroundRotationY: false, - backgroundRotationZ: false, - syncMaterial: false, - }; - - const gui = new GUI({ width: 300 }); - gui.add(params, 'Cube'); - gui.add(params, 'Equirectangular'); - gui.add(params, 'Refraction').onChange(function (value) { - if (value) { - textureEquirec.mapping = THREE.EquirectangularRefractionMapping; - textureCube.mapping = THREE.CubeRefractionMapping; - } else { - textureEquirec.mapping = THREE.EquirectangularReflectionMapping; - textureCube.mapping = THREE.CubeReflectionMapping; - } - - sphereMaterial.needsUpdate = true; - }); - gui.add(params, 'backgroundRotationX'); - gui.add(params, 'backgroundRotationY'); - gui.add(params, 'backgroundRotationZ'); - gui.add(params, 'syncMaterial'); - gui.open(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - if (params.backgroundRotationX) { - scene.backgroundRotation.x += 0.001; - } - - if (params.backgroundRotationY) { - scene.backgroundRotation.y += 0.001; - } - - if (params.backgroundRotationZ) { - scene.backgroundRotation.z += 0.001; - } - - if (params.syncMaterial) { - sphereMesh.material.envMapRotation.copy(scene.backgroundRotation); - } - - camera.lookAt(scene.position); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_envmaps_exr.ts b/examples-testing/examples/webgl_materials_envmaps_exr.ts deleted file mode 100644 index c3f3f4f7d..000000000 --- a/examples-testing/examples/webgl_materials_envmaps_exr.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; - -const params = { - envMap: 'EXR', - roughness: 0.0, - metalness: 0.0, - exposure: 1.0, - debug: false, -}; - -let container, stats; -let camera, scene, renderer, controls; -let torusMesh, planeMesh; -let pngCubeRenderTarget, exrCubeRenderTarget; -let pngBackground, exrBackground; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 120); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - // - - let geometry = new THREE.TorusKnotGeometry(18, 8, 150, 20); - let material = new THREE.MeshStandardMaterial({ - metalness: params.metalness, - roughness: params.roughness, - envMapIntensity: 1.0, - }); - - torusMesh = new THREE.Mesh(geometry, material); - scene.add(torusMesh); - - geometry = new THREE.PlaneGeometry(200, 200); - material = new THREE.MeshBasicMaterial(); - - planeMesh = new THREE.Mesh(geometry, material); - planeMesh.position.y = -50; - planeMesh.rotation.x = -Math.PI * 0.5; - scene.add(planeMesh); - - THREE.DefaultLoadingManager.onLoad = function () { - pmremGenerator.dispose(); - }; - - new EXRLoader().load('textures/piz_compressed.exr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - exrCubeRenderTarget = pmremGenerator.fromEquirectangular(texture); - exrBackground = texture; - }); - - new THREE.TextureLoader().load('textures/equirectangular.png', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - texture.colorSpace = THREE.SRGBColorSpace; - - pngCubeRenderTarget = pmremGenerator.fromEquirectangular(texture); - pngBackground = texture; - }); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - pmremGenerator.compileEquirectangularShader(); - - stats = new Stats(); - container.appendChild(stats.dom); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 50; - controls.maxDistance = 300; - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'envMap', ['EXR', 'PNG']); - gui.add(params, 'roughness', 0, 1, 0.01); - gui.add(params, 'metalness', 0, 1, 0.01); - gui.add(params, 'exposure', 0, 2, 0.01); - gui.add(params, 'debug'); - gui.open(); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - torusMesh.material.roughness = params.roughness; - torusMesh.material.metalness = params.metalness; - - let newEnvMap = torusMesh.material.envMap; - let background = scene.background; - - switch (params.envMap) { - case 'EXR': - newEnvMap = exrCubeRenderTarget ? exrCubeRenderTarget.texture : null; - background = exrBackground; - break; - case 'PNG': - newEnvMap = pngCubeRenderTarget ? pngCubeRenderTarget.texture : null; - background = pngBackground; - break; - } - - if (newEnvMap !== torusMesh.material.envMap) { - torusMesh.material.envMap = newEnvMap; - torusMesh.material.needsUpdate = true; - - planeMesh.material.map = newEnvMap; - planeMesh.material.needsUpdate = true; - } - - torusMesh.rotation.y += 0.005; - planeMesh.visible = params.debug; - - scene.background = background; - renderer.toneMappingExposure = params.exposure; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_envmaps_fasthdr.ts b/examples-testing/examples/webgl_materials_envmaps_fasthdr.ts deleted file mode 100644 index f03862acf..000000000 --- a/examples-testing/examples/webgl_materials_envmaps_fasthdr.ts +++ /dev/null @@ -1,169 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; - -const params = { - image: 'ballroom', - fov: 40, - exposure: 1.0, - backgroundBlurriness: 0.0, -}; - -let container, stats; -let camera, scene, renderer, controls; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(params.fov, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.set(7, 0, 0); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - // - - const sphereGeometry = new THREE.SphereGeometry(0.45, 64, 32); - - const sphere01 = new THREE.Mesh( - sphereGeometry, - new THREE.MeshPhysicalMaterial({ - transmission: 1.0, - thickness: 2.0, - metalness: 0.0, - roughness: 0.0, - }), - ); - sphere01.position.z += 2; - scene.add(sphere01); - - const sphere02 = new THREE.Mesh( - sphereGeometry, - new THREE.MeshStandardMaterial({ - metalness: 0.0, - roughness: 1.0, - }), - ); - sphere02.position.z += 1; - scene.add(sphere02); - - const sphere03 = new THREE.Mesh( - sphereGeometry, - new THREE.MeshStandardMaterial({ - metalness: 1.0, - roughness: 0.0, - }), - ); - sphere03.position.z += 0; - scene.add(sphere03); - - const sphere04 = new THREE.Mesh( - sphereGeometry, - new THREE.MeshStandardMaterial({ - metalness: 1.0, - roughness: 0.5, - color: 0x888888, - }), - ); - sphere04.position.z -= 1; - scene.add(sphere04); - - const sphere05 = new THREE.Mesh( - sphereGeometry, - new THREE.MeshStandardMaterial({ - metalness: 0.0, - roughness: 0.0, - color: 0x6ab440, - }), - ); - sphere05.position.z -= 2; - scene.add(sphere05); - - const loader = new KTX2Loader().detectSupport(renderer); - - function loadTexture(url) { - loader.load(url, texture => { - texture.mapping = THREE.CubeUVReflectionMapping; - scene.environment = texture; - scene.background = texture; - }); - } - - loadTexture('https://cdn.needle.tools/static/hdris/ballroom_2k.pmrem.ktx2'); - - stats = new Stats(); - container.appendChild(stats.dom); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 0.1; - controls.maxDistance = 20; - controls.enableDamping = true; - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'image', { - ballroom: 'https://cdn.needle.tools/static/hdris/ballroom_2k.pmrem.ktx2', - 'brown photostudio': 'https://cdn.needle.tools/static/hdris/brown_photostudio_02_2k.pmrem.ktx2', - 'cape hill': 'https://cdn.needle.tools/static/hdris/cape_hill_2k.pmrem.ktx2', - cannon: 'https://cdn.needle.tools/static/hdris/cannon_2k.pmrem.ktx2', - 'metro noord': 'https://cdn.needle.tools/static/hdris/metro_noord_2k.pmrem.ktx2', - 'the sky is on fire': 'https://cdn.needle.tools/static/hdris/the_sky_is_on_fire_2k.pmrem.ktx2', - 'studio small 09': 'https://cdn.needle.tools/static/hdris/studio_small_09_2k.pmrem.ktx2', - 'wide street 01': 'https://cdn.needle.tools/static/hdris/wide_street_01_2k.pmrem.ktx2', - }).onChange(() => { - loadTexture(params.image); - }); - - gui.add(params, 'exposure', 0, 2, 0.01); - - gui.add(params, 'fov', 10, 100).onChange(() => { - camera.fov = params.fov; - camera.updateProjectionMatrix(); - }); - - gui.add(params, 'backgroundBlurriness', 0, 1, 0.01).name('background blurriness'); - - gui.open(); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - renderer.toneMappingExposure = params.exposure; - scene.backgroundBlurriness = params.backgroundBlurriness; - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_envmaps_groundprojected.ts b/examples-testing/examples/webgl_materials_envmaps_groundprojected.ts deleted file mode 100644 index 033b1dab3..000000000 --- a/examples-testing/examples/webgl_materials_envmaps_groundprojected.ts +++ /dev/null @@ -1,151 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GroundedSkybox } from 'three/addons/objects/GroundedSkybox.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -const params = { - height: 15, - radius: 100, - enabled: true, -}; - -let camera, scene, renderer, skybox; - -init().then(render); - -async function init() { - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-20, 7, 20); - camera.lookAt(0, 4, 0); - - scene = new THREE.Scene(); - - const hdrLoader = new HDRLoader(); - const envMap = await hdrLoader.loadAsync('textures/equirectangular/blouberg_sunrise_2_1k.hdr'); - envMap.mapping = THREE.EquirectangularReflectionMapping; - - skybox = new GroundedSkybox(envMap, params.height, params.radius); - skybox.position.y = params.height - 0.01; - scene.add(skybox); - - scene.environment = envMap; - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - - const shadow = new THREE.TextureLoader().load('models/gltf/ferrari_ao.png'); - - loader.load('models/gltf/ferrari.glb', function (gltf) { - const bodyMaterial = new THREE.MeshPhysicalMaterial({ - color: 0x000000, - metalness: 1.0, - roughness: 0.8, - clearcoat: 1.0, - clearcoatRoughness: 0.2, - }); - - const detailsMaterial = new THREE.MeshStandardMaterial({ - color: 0xffffff, - metalness: 1.0, - roughness: 0.5, - }); - - const glassMaterial = new THREE.MeshPhysicalMaterial({ - color: 0xffffff, - metalness: 0.25, - roughness: 0, - transmission: 1.0, - }); - - const carModel = gltf.scene.children[0]; - carModel.scale.multiplyScalar(4); - carModel.rotation.y = Math.PI; - - carModel.getObjectByName('body').material = bodyMaterial; - - carModel.getObjectByName('rim_fl').material = detailsMaterial; - carModel.getObjectByName('rim_fr').material = detailsMaterial; - carModel.getObjectByName('rim_rr').material = detailsMaterial; - carModel.getObjectByName('rim_rl').material = detailsMaterial; - carModel.getObjectByName('trim').material = detailsMaterial; - - carModel.getObjectByName('glass').material = glassMaterial; - - // shadow - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(0.655 * 4, 1.3 * 4), - new THREE.MeshBasicMaterial({ - map: shadow, - blending: THREE.MultiplyBlending, - toneMapped: false, - transparent: true, - premultipliedAlpha: true, - }), - ); - mesh.rotation.x = -Math.PI / 2; - carModel.add(mesh); - - scene.add(carModel); - - render(); - }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.target.set(0, 2, 0); - controls.maxPolarAngle = THREE.MathUtils.degToRad(90); - controls.maxDistance = 80; - controls.minDistance = 20; - controls.enablePan = false; - controls.update(); - - document.body.appendChild(renderer.domElement); - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'enabled') - .name('Grounded') - .onChange(function (value) { - if (value) { - scene.add(skybox); - scene.background = null; - } else { - scene.remove(skybox); - scene.background = scene.environment; - } - - render(); - }); - - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_envmaps_hdr.ts b/examples-testing/examples/webgl_materials_envmaps_hdr.ts deleted file mode 100644 index 2dc2b808a..000000000 --- a/examples-testing/examples/webgl_materials_envmaps_hdr.ts +++ /dev/null @@ -1,163 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; -import { DebugEnvironment } from 'three/addons/environments/DebugEnvironment.js'; - -const params = { - envMap: 'HDR', - roughness: 0.0, - metalness: 0.0, - exposure: 1.0, - debug: false, -}; - -let container, stats; -let camera, scene, renderer, controls; -let torusMesh, planeMesh; -let generatedCubeRenderTarget, ldrCubeRenderTarget, hdrCubeRenderTarget; -let ldrCubeMap, hdrCubeMap; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 120); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - renderer = new THREE.WebGLRenderer(); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - // - - let geometry = new THREE.TorusKnotGeometry(18, 8, 150, 20); - // let geometry = new THREE.SphereGeometry( 26, 64, 32 ); - let material = new THREE.MeshStandardMaterial({ - color: 0xffffff, - metalness: params.metalness, - roughness: params.roughness, - }); - - torusMesh = new THREE.Mesh(geometry, material); - scene.add(torusMesh); - - geometry = new THREE.PlaneGeometry(200, 200); - material = new THREE.MeshBasicMaterial(); - - planeMesh = new THREE.Mesh(geometry, material); - planeMesh.position.y = -50; - planeMesh.rotation.x = -Math.PI * 0.5; - scene.add(planeMesh); - - THREE.DefaultLoadingManager.onLoad = function () { - pmremGenerator.dispose(); - }; - - const hdrUrls = ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']; - hdrCubeMap = new HDRCubeTextureLoader().setPath('./textures/cube/pisaHDR/').load(hdrUrls, function () { - hdrCubeRenderTarget = pmremGenerator.fromCubemap(hdrCubeMap); - - hdrCubeMap.magFilter = THREE.LinearFilter; - hdrCubeMap.needsUpdate = true; - }); - - const ldrUrls = ['px.png', 'nx.png', 'py.png', 'ny.png', 'pz.png', 'nz.png']; - ldrCubeMap = new THREE.CubeTextureLoader().setPath('./textures/cube/pisa/').load(ldrUrls, function () { - ldrCubeRenderTarget = pmremGenerator.fromCubemap(ldrCubeMap); - }); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - pmremGenerator.compileCubemapShader(); - - const envScene = new DebugEnvironment(); - generatedCubeRenderTarget = pmremGenerator.fromScene(envScene); - - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - //renderer.toneMapping = ReinhardToneMapping; - - stats = new Stats(); - container.appendChild(stats.dom); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 50; - controls.maxDistance = 300; - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - gui.add(params, 'envMap', ['Generated', 'LDR', 'HDR']); - gui.add(params, 'roughness', 0, 1, 0.01); - gui.add(params, 'metalness', 0, 1, 0.01); - gui.add(params, 'exposure', 0, 2, 0.01); - gui.add(params, 'debug'); - gui.open(); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - torusMesh.material.roughness = params.roughness; - torusMesh.material.metalness = params.metalness; - - let renderTarget, cubeMap; - - switch (params.envMap) { - case 'Generated': - renderTarget = generatedCubeRenderTarget; - cubeMap = generatedCubeRenderTarget.texture; - break; - case 'LDR': - renderTarget = ldrCubeRenderTarget; - cubeMap = ldrCubeMap; - break; - case 'HDR': - renderTarget = hdrCubeRenderTarget; - cubeMap = hdrCubeMap; - break; - } - - const newEnvMap = renderTarget ? renderTarget.texture : null; - - if (newEnvMap && newEnvMap !== torusMesh.material.envMap) { - torusMesh.material.envMap = newEnvMap; - torusMesh.material.needsUpdate = true; - - planeMesh.material.map = newEnvMap; - planeMesh.material.needsUpdate = true; - } - - torusMesh.rotation.y += 0.005; - planeMesh.visible = params.debug; - - scene.background = cubeMap; - renderer.toneMappingExposure = params.exposure; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_modified.ts b/examples-testing/examples/webgl_materials_modified.ts deleted file mode 100644 index de36aeb7d..000000000 --- a/examples-testing/examples/webgl_materials_modified.ts +++ /dev/null @@ -1,115 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer, stats; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 20; - - scene = new THREE.Scene(); - - const loader = new GLTFLoader(); - loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - const geometry = gltf.scene.children[0].geometry; - - let mesh = new THREE.Mesh(geometry, buildTwistMaterial(2.0)); - mesh.position.x = -3.5; - mesh.position.y = -0.5; - scene.add(mesh); - - mesh = new THREE.Mesh(geometry, buildTwistMaterial(-2.0)); - mesh.position.x = 3.5; - mesh.position.y = -0.5; - scene.add(mesh); - }); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 10; - controls.maxDistance = 50; - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // EVENTS - - window.addEventListener('resize', onWindowResize); -} - -function buildTwistMaterial(amount) { - const material = new THREE.MeshNormalMaterial(); - material.onBeforeCompile = function (shader) { - shader.uniforms.time = { value: 0 }; - - shader.vertexShader = 'uniform float time;\n' + shader.vertexShader; - shader.vertexShader = shader.vertexShader.replace( - '#include ', - [ - `float theta = sin( time + position.y ) / ${amount.toFixed(1)};`, - 'float c = cos( theta );', - 'float s = sin( theta );', - 'mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );', - 'vec3 transformed = vec3( position ) * m;', - 'vNormal = vNormal * m;', - ].join('\n'), - ); - - material.userData.shader = shader; - }; - - // Make sure WebGLRenderer doesn't reuse a single program - - material.customProgramCacheKey = function () { - return amount.toFixed(1); - }; - - return material; -} - -// - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -// - -function animate() { - render(); - - stats.update(); -} - -function render() { - scene.traverse(function (child) { - if (child.isMesh) { - const shader = child.material.userData.shader; - - if (shader) { - shader.uniforms.time.value = performance.now() / 1000; - } - } - }); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_normalmap_object_space.ts b/examples-testing/examples/webgl_materials_normalmap_object_space.ts deleted file mode 100644 index 1fc6f8066..000000000 --- a/examples-testing/examples/webgl_materials_normalmap_object_space.ts +++ /dev/null @@ -1,82 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let renderer, scene, camera; - -init(); - -function init() { - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-10, 0, 23); - scene.add(camera); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.minDistance = 10; - controls.maxDistance = 50; - controls.enablePan = false; - - // ambient - scene.add(new THREE.AmbientLight(0xffffff, 0.6)); - - // light - const light = new THREE.PointLight(0xffffff, 4.5, 0, 0); - camera.add(light); - - // model - new GLTFLoader().load('models/gltf/Nefertiti/Nefertiti.glb', function (gltf) { - gltf.scene.traverse(function (child) { - if (child.isMesh) { - // glTF currently supports only tangent-space normal maps. - // this model has been modified to demonstrate the use of an object-space normal map. - - child.material.normalMapType = THREE.ObjectSpaceNormalMap; - - // attribute normals are not required with an object-space normal map. remove them. - - child.geometry.deleteAttribute('normal'); - - // - - child.material.side = THREE.DoubleSide; - - child.scale.multiplyScalar(0.5); - - // recenter - - new THREE.Box3().setFromObject(child).getCenter(child.position).multiplyScalar(-1); - - scene.add(child); - } - }); - - render(); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_physical_clearcoat.ts b/examples-testing/examples/webgl_materials_physical_clearcoat.ts deleted file mode 100644 index 408fd9921..000000000 --- a/examples-testing/examples/webgl_materials_physical_clearcoat.ts +++ /dev/null @@ -1,208 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; - -import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; - -let container, stats; - -let camera, scene, renderer; - -let particleLight; -let group; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.25, 50); - camera.position.z = 10; - - scene = new THREE.Scene(); - - group = new THREE.Group(); - scene.add(group); - - new HDRCubeTextureLoader() - .setPath('textures/cube/pisaHDR/') - .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (texture) { - const geometry = new THREE.SphereGeometry(0.8, 64, 32); - - const textureLoader = new THREE.TextureLoader(); - - const diffuse = textureLoader.load('textures/carbon/Carbon.png'); - diffuse.colorSpace = THREE.SRGBColorSpace; - diffuse.wrapS = THREE.RepeatWrapping; - diffuse.wrapT = THREE.RepeatWrapping; - diffuse.repeat.x = 10; - diffuse.repeat.y = 10; - - const normalMap = textureLoader.load('textures/carbon/Carbon_Normal.png'); - normalMap.wrapS = THREE.RepeatWrapping; - normalMap.wrapT = THREE.RepeatWrapping; - normalMap.repeat.x = 10; - normalMap.repeat.y = 10; - - const normalMap2 = textureLoader.load('textures/water/Water_1_M_Normal.jpg'); - - const normalMap3 = new THREE.CanvasTexture(new FlakesTexture()); - normalMap3.wrapS = THREE.RepeatWrapping; - normalMap3.wrapT = THREE.RepeatWrapping; - normalMap3.repeat.x = 10; - normalMap3.repeat.y = 6; - normalMap3.anisotropy = 16; - - const normalMap4 = textureLoader.load('textures/golfball.jpg'); - - const clearcoatNormalMap = textureLoader.load( - 'textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png', - ); - - // car paint - - let material = new THREE.MeshPhysicalMaterial({ - clearcoat: 1.0, - clearcoatRoughness: 0.1, - metalness: 0.9, - roughness: 0.5, - color: 0x0000ff, - normalMap: normalMap3, - normalScale: new THREE.Vector2(0.15, 0.15), - }); - - let mesh = new THREE.Mesh(geometry, material); - mesh.position.x = -1; - mesh.position.y = 1; - group.add(mesh); - - // fibers - - material = new THREE.MeshPhysicalMaterial({ - roughness: 0.5, - clearcoat: 1.0, - clearcoatRoughness: 0.1, - map: diffuse, - normalMap: normalMap, - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = 1; - mesh.position.y = 1; - group.add(mesh); - - // golf - - material = new THREE.MeshPhysicalMaterial({ - metalness: 0.0, - roughness: 0.1, - clearcoat: 1.0, - normalMap: normalMap4, - clearcoatNormalMap: clearcoatNormalMap, - - // y scale is negated to compensate for normal map handedness. - clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = -1; - mesh.position.y = -1; - group.add(mesh); - - // clearcoat + normalmap - - material = new THREE.MeshPhysicalMaterial({ - clearcoat: 1.0, - metalness: 1.0, - color: 0xff0000, - normalMap: normalMap2, - normalScale: new THREE.Vector2(0.15, 0.15), - clearcoatNormalMap: clearcoatNormalMap, - - // y scale is negated to compensate for normal map handedness. - clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = 1; - mesh.position.y = -1; - group.add(mesh); - - // - - scene.background = texture; - scene.environment = texture; - }); - - // LIGHTS - - particleLight = new THREE.Mesh( - new THREE.SphereGeometry(0.05, 8, 8), - new THREE.MeshBasicMaterial({ color: 0xffffff }), - ); - scene.add(particleLight); - - particleLight.add(new THREE.PointLight(0xffffff, 30)); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.25; - - // - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // EVENTS - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 3; - controls.maxDistance = 30; - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -// - -function animate() { - render(); - - stats.update(); -} - -function render() { - const timer = Date.now() * 0.00025; - - particleLight.position.x = Math.sin(timer * 7) * 3; - particleLight.position.y = Math.cos(timer * 5) * 4; - particleLight.position.z = Math.cos(timer * 3) * 3; - - for (let i = 0; i < group.children.length; i++) { - const child = group.children[i]; - child.rotation.y += 0.005; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_physical_transmission.ts b/examples-testing/examples/webgl_materials_physical_transmission.ts deleted file mode 100644 index 08ee08cac..000000000 --- a/examples-testing/examples/webgl_materials_physical_transmission.ts +++ /dev/null @@ -1,192 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -const params = { - color: 0xffffff, - transmission: 1, - opacity: 1, - metalness: 0, - roughness: 0, - ior: 1.5, - thickness: 0.01, - specularIntensity: 1, - specularColor: 0xffffff, - envMapIntensity: 1, - lightIntensity: 1, - exposure: 1, - transmissionResolutionScale: 1, -}; - -let camera, scene, renderer; - -let mesh; - -const hdrEquirect = new UltraHDRLoader() - .setPath('textures/equirectangular/') - .load('royal_esplanade_2k.hdr.jpg', function () { - hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; - - init(); - render(); - }); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = params.exposure; - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(0, 0, 120); - - // - - scene.background = hdrEquirect; - - // - - const geometry = new THREE.SphereGeometry(20, 64, 32); - - const texture = new THREE.CanvasTexture(generateTexture()); - texture.magFilter = THREE.NearestFilter; - texture.wrapT = THREE.RepeatWrapping; - texture.wrapS = THREE.RepeatWrapping; - texture.repeat.set(1, 3.5); - - const material = new THREE.MeshPhysicalMaterial({ - color: params.color, - metalness: params.metalness, - roughness: params.roughness, - ior: params.ior, - alphaMap: texture, - envMap: hdrEquirect, - envMapIntensity: params.envMapIntensity, - transmission: params.transmission, // use material.transmission for glass materials - specularIntensity: params.specularIntensity, - specularColor: params.specularColor, - opacity: params.opacity, - side: THREE.DoubleSide, - transparent: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 10; - controls.maxDistance = 150; - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - - gui.addColor(params, 'color').onChange(function () { - material.color.set(params.color); - render(); - }); - - gui.add(params, 'transmission', 0, 1, 0.01).onChange(function () { - material.transmission = params.transmission; - render(); - }); - - gui.add(params, 'opacity', 0, 1, 0.01).onChange(function () { - material.opacity = params.opacity; - render(); - }); - - gui.add(params, 'metalness', 0, 1, 0.01).onChange(function () { - material.metalness = params.metalness; - render(); - }); - - gui.add(params, 'roughness', 0, 1, 0.01).onChange(function () { - material.roughness = params.roughness; - render(); - }); - - gui.add(params, 'ior', 1, 2, 0.01).onChange(function () { - material.ior = params.ior; - render(); - }); - - gui.add(params, 'thickness', 0, 5, 0.01).onChange(function () { - material.thickness = params.thickness; - render(); - }); - - gui.add(params, 'specularIntensity', 0, 1, 0.01).onChange(function () { - material.specularIntensity = params.specularIntensity; - render(); - }); - - gui.addColor(params, 'specularColor').onChange(function () { - material.specularColor.set(params.specularColor); - render(); - }); - - gui.add(params, 'envMapIntensity', 0, 1, 0.01) - .name('envMap intensity') - .onChange(function () { - material.envMapIntensity = params.envMapIntensity; - render(); - }); - - gui.add(params, 'exposure', 0, 1, 0.01).onChange(function () { - renderer.toneMappingExposure = params.exposure; - render(); - }); - - gui.add(params, 'transmissionResolutionScale', 0.01, 1, 0.01) - .name('transmission resolution') - .onChange(function () { - renderer.transmissionResolutionScale = params.transmissionResolutionScale; - render(); - }); - - gui.open(); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - - render(); -} - -// - -function generateTexture() { - const canvas = document.createElement('canvas'); - canvas.width = 2; - canvas.height = 2; - - const context = canvas.getContext('2d'); - context.fillStyle = 'white'; - context.fillRect(0, 1, 2, 1); - - return canvas; -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_physical_transmission_alpha.ts b/examples-testing/examples/webgl_materials_physical_transmission_alpha.ts deleted file mode 100644 index 6318d7844..000000000 --- a/examples-testing/examples/webgl_materials_physical_transmission_alpha.ts +++ /dev/null @@ -1,194 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -const params = { - color: 0xffffff, - transmission: 1, - opacity: 1, - metalness: 0, - roughness: 0, - ior: 1.5, - thickness: 0.01, - attenuationColor: 0xffffff, - attenuationDistance: 1, - specularIntensity: 1, - specularColor: 0xffffff, - envMapIntensity: 1, - lightIntensity: 1, - exposure: 1, -}; - -let camera, scene, renderer; - -let mesh, material; - -const hdrEquirect = new UltraHDRLoader() - .setPath('textures/equirectangular/') - .load('royal_esplanade_2k.hdr.jpg', function () { - hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; - - new GLTFLoader().setPath('models/gltf/').load('DragonAttenuation.glb', function (gltf) { - gltf.scene.traverse(function (child) { - if (child.isMesh && child.material.isMeshPhysicalMaterial) { - mesh = child; - material = mesh.material; - - const color = new THREE.Color(); - - params.color = color.copy(mesh.material.color).getHex(); - params.roughness = mesh.material.roughness; - params.metalness = mesh.material.metalness; - - params.ior = mesh.material.ior; - params.specularIntensity = mesh.material.specularIntensity; - - params.transmission = mesh.material.transmission; - params.thickness = mesh.material.thickness; - params.attenuationColor = color.copy(mesh.material.attenuationColor).getHex(); - params.attenuationDistance = mesh.material.attenuationDistance; - } - }); - - init(); - - scene.add(gltf.scene); - - scene.environment = hdrEquirect; - //scene.background = hdrEquirect; - - render(); - }); - }); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = params.exposure; - - // accommodate CSS table - renderer.domElement.style.position = 'absolute'; - renderer.domElement.style.top = 0; - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(-5, 0.5, 0); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 5; - controls.maxDistance = 20; - controls.target.y = 0.5; - controls.update(); - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - - gui.addColor(params, 'color').onChange(function () { - material.color.set(params.color); - render(); - }); - - gui.add(params, 'transmission', 0, 1, 0.01).onChange(function () { - material.transmission = params.transmission; - render(); - }); - - gui.add(params, 'opacity', 0, 1, 0.01).onChange(function () { - material.opacity = params.opacity; - const transparent = params.opacity < 1; - - if (transparent !== material.transparent) { - material.transparent = transparent; - material.needsUpdate = true; - } - - render(); - }); - - gui.add(params, 'metalness', 0, 1, 0.01).onChange(function () { - material.metalness = params.metalness; - render(); - }); - - gui.add(params, 'roughness', 0, 1, 0.01).onChange(function () { - material.roughness = params.roughness; - render(); - }); - - gui.add(params, 'ior', 1, 2, 0.01).onChange(function () { - material.ior = params.ior; - render(); - }); - - gui.add(params, 'thickness', 0, 5, 0.01).onChange(function () { - material.thickness = params.thickness; - render(); - }); - - gui.addColor(params, 'attenuationColor') - .name('attenuation color') - .onChange(function () { - material.attenuationColor.set(params.attenuationColor); - render(); - }); - - gui.add(params, 'attenuationDistance', 0, 1, 0.01).onChange(function () { - material.attenuationDistance = params.attenuationDistance; - render(); - }); - - gui.add(params, 'specularIntensity', 0, 1, 0.01).onChange(function () { - material.specularIntensity = params.specularIntensity; - render(); - }); - - gui.addColor(params, 'specularColor').onChange(function () { - material.specularColor.set(params.specularColor); - render(); - }); - - gui.add(params, 'envMapIntensity', 0, 1, 0.01) - .name('envMap intensity') - .onChange(function () { - material.envMapIntensity = params.envMapIntensity; - render(); - }); - - gui.add(params, 'exposure', 0, 1, 0.01).onChange(function () { - renderer.toneMappingExposure = params.exposure; - render(); - }); - - gui.open(); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - - render(); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_texture_anisotropy.ts b/examples-testing/examples/webgl_materials_texture_anisotropy.ts deleted file mode 100644 index 1e030d64d..000000000 --- a/examples-testing/examples/webgl_materials_texture_anisotropy.ts +++ /dev/null @@ -1,143 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -const SCREEN_WIDTH = window.innerWidth; -const SCREEN_HEIGHT = window.innerHeight; - -let container, stats; - -let camera, scene1, scene2, renderer; - -let mouseX = 0, - mouseY = 0; - -const windowHalfX = window.innerWidth / 2; -const windowHalfY = window.innerHeight / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - - // - - camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 25000); - camera.position.z = 1500; - - scene1 = new THREE.Scene(); - scene1.background = new THREE.Color(0xf2f7ff); - scene1.fog = new THREE.Fog(0xf2f7ff, 1, 25000); - - scene2 = new THREE.Scene(); - scene2.background = new THREE.Color(0xf2f7ff); - scene2.fog = new THREE.Fog(0xf2f7ff, 1, 25000); - - scene1.add(new THREE.AmbientLight(0xeef0ff, 3)); - scene2.add(new THREE.AmbientLight(0xeef0ff, 3)); - - const light1 = new THREE.DirectionalLight(0xffffff, 6); - light1.position.set(1, 1, 1); - scene1.add(light1); - - const light2 = new THREE.DirectionalLight(0xffffff, 6); - light2.position.set(1, 1, 1); - scene2.add(light2); - - // GROUND - - const textureLoader = new THREE.TextureLoader(); - - const maxAnisotropy = renderer.capabilities.getMaxAnisotropy(); - - const texture1 = textureLoader.load('textures/crate.gif'); - const material1 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture1 }); - - texture1.colorSpace = THREE.SRGBColorSpace; - texture1.anisotropy = maxAnisotropy; - texture1.wrapS = texture1.wrapT = THREE.RepeatWrapping; - texture1.repeat.set(512, 512); - - const texture2 = textureLoader.load('textures/crate.gif'); - const material2 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture2 }); - - texture2.colorSpace = THREE.SRGBColorSpace; - texture2.anisotropy = 1; - texture2.wrapS = texture2.wrapT = THREE.RepeatWrapping; - texture2.repeat.set(512, 512); - - if (maxAnisotropy > 0) { - document.getElementById('val_left').innerHTML = texture1.anisotropy; - document.getElementById('val_right').innerHTML = texture2.anisotropy; - } else { - document.getElementById('val_left').innerHTML = 'not supported'; - document.getElementById('val_right').innerHTML = 'not supported'; - } - - // - - const geometry = new THREE.PlaneGeometry(100, 100); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.rotation.x = -Math.PI / 2; - mesh1.scale.set(1000, 1000, 1000); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.rotation.x = -Math.PI / 2; - mesh2.scale.set(1000, 1000, 1000); - - scene1.add(mesh1); - scene2.add(mesh2); - - // RENDERER - - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - - renderer.domElement.style.position = 'relative'; - container.appendChild(renderer.domElement); - - // STATS1 - - stats = new Stats(); - container.appendChild(stats.dom); - - document.addEventListener('mousemove', onDocumentMouseMove); -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -function animate() { - render(); - stats.update(); -} - -function render() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y = THREE.MathUtils.clamp( - camera.position.y + (-(mouseY - 200) - camera.position.y) * 0.05, - 50, - 1000, - ); - - camera.lookAt(scene1.position); - - renderer.clear(); - renderer.setScissorTest(true); - - renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene1, camera); - - renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene2, camera); - - renderer.setScissorTest(false); -} diff --git a/examples-testing/examples/webgl_materials_texture_canvas.ts b/examples-testing/examples/webgl_materials_texture_canvas.ts deleted file mode 100644 index d23c68436..000000000 --- a/examples-testing/examples/webgl_materials_texture_canvas.ts +++ /dev/null @@ -1,92 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer, mesh, material; -const drawStartPos = new THREE.Vector2(); - -init(); -setupCanvasDrawing(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.z = 500; - - scene = new THREE.Scene(); - - material = new THREE.MeshBasicMaterial(); - - mesh = new THREE.Mesh(new THREE.BoxGeometry(200, 200, 200), material); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -// Sets up the drawing canvas and adds it as the material map - -function setupCanvasDrawing() { - // get canvas and context - - const drawingCanvas = document.getElementById('drawing-canvas'); - const drawingContext = drawingCanvas.getContext('2d'); - - // draw white background - - drawingContext.fillStyle = '#FFFFFF'; - drawingContext.fillRect(0, 0, 128, 128); - - // set canvas as material.map (this could be done to any map, bump, displacement etc.) - - material.map = new THREE.CanvasTexture(drawingCanvas); - - // set the variable to keep track of when to draw - - let paint = false; - - // add canvas event listeners - drawingCanvas.addEventListener('pointerdown', function (e) { - paint = true; - drawStartPos.set(e.offsetX, e.offsetY); - }); - - drawingCanvas.addEventListener('pointermove', function (e) { - if (paint) draw(drawingContext, e.offsetX, e.offsetY); - }); - - drawingCanvas.addEventListener('pointerup', function () { - paint = false; - }); - - drawingCanvas.addEventListener('pointerleave', function () { - paint = false; - }); -} - -function draw(drawContext, x, y) { - drawContext.moveTo(drawStartPos.x, drawStartPos.y); - drawContext.strokeStyle = '#000000'; - drawContext.lineTo(x, y); - drawContext.stroke(); - // reset drawing start position to current position. - drawStartPos.set(x, y); - // need to flag the map as needing updating. - material.map.needsUpdate = true; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.rotation.x += 0.01; - mesh.rotation.y += 0.01; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_texture_filters.ts b/examples-testing/examples/webgl_materials_texture_filters.ts deleted file mode 100644 index 77b254684..000000000 --- a/examples-testing/examples/webgl_materials_texture_filters.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as THREE from 'three'; - -const SCREEN_WIDTH = window.innerWidth; -const SCREEN_HEIGHT = window.innerHeight; - -let container; - -let camera, scene, scene2, renderer; - -let mouseX = 0, - mouseY = 0; - -const windowHalfX = window.innerWidth / 2; -const windowHalfY = window.innerHeight / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000); - camera.position.z = 1500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - scene.fog = new THREE.Fog(0x000000, 1500, 4000); - - scene2 = new THREE.Scene(); - scene2.background = new THREE.Color(0x000000); - scene2.fog = new THREE.Fog(0x000000, 1500, 4000); - - // GROUND - - const imageCanvas = document.createElement('canvas'); - const context = imageCanvas.getContext('2d'); - - imageCanvas.width = imageCanvas.height = 128; - - context.fillStyle = '#444'; - context.fillRect(0, 0, 128, 128); - - context.fillStyle = '#fff'; - context.fillRect(0, 0, 64, 64); - context.fillRect(64, 64, 64, 64); - - const textureCanvas = new THREE.CanvasTexture(imageCanvas); - textureCanvas.colorSpace = THREE.SRGBColorSpace; - textureCanvas.repeat.set(1000, 1000); - textureCanvas.wrapS = THREE.RepeatWrapping; - textureCanvas.wrapT = THREE.RepeatWrapping; - - const textureCanvas2 = textureCanvas.clone(); - textureCanvas2.magFilter = THREE.NearestFilter; - textureCanvas2.minFilter = THREE.NearestFilter; - textureCanvas2.generateMipmaps = false; - - const materialCanvas = new THREE.MeshBasicMaterial({ map: textureCanvas }); - const materialCanvas2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: textureCanvas2 }); - - const geometry = new THREE.PlaneGeometry(100, 100); - - const meshCanvas = new THREE.Mesh(geometry, materialCanvas); - meshCanvas.rotation.x = -Math.PI / 2; - meshCanvas.scale.set(1000, 1000, 1000); - - const meshCanvas2 = new THREE.Mesh(geometry, materialCanvas2); - meshCanvas2.rotation.x = -Math.PI / 2; - meshCanvas2.scale.set(1000, 1000, 1000); - - // PAINTING - - const callbackPainting = function () { - const image = texturePainting.image; - - texturePainting2.image = image; - texturePainting2.needsUpdate = true; - - scene.add(meshCanvas); - scene2.add(meshCanvas2); - - const geometry = new THREE.PlaneGeometry(100, 100); - const mesh = new THREE.Mesh(geometry, materialPainting); - const mesh2 = new THREE.Mesh(geometry, materialPainting2); - - addPainting(scene, mesh); - addPainting(scene2, mesh2); - - function addPainting(zscene, zmesh) { - zmesh.scale.x = image.width / 100; - zmesh.scale.y = image.height / 100; - - zscene.add(zmesh); - - const meshFrame = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000 })); - meshFrame.position.z = -10.0; - meshFrame.scale.x = (1.1 * image.width) / 100; - meshFrame.scale.y = (1.1 * image.height) / 100; - zscene.add(meshFrame); - - const meshShadow = new THREE.Mesh( - geometry, - new THREE.MeshBasicMaterial({ color: 0x000000, opacity: 0.75, transparent: true }), - ); - meshShadow.position.y = (-1.1 * image.height) / 2; - meshShadow.position.z = (-1.1 * image.height) / 2; - meshShadow.rotation.x = -Math.PI / 2; - meshShadow.scale.x = (1.1 * image.width) / 100; - meshShadow.scale.y = (1.1 * image.height) / 100; - zscene.add(meshShadow); - - const floorHeight = (-1.117 * image.height) / 2; - meshCanvas.position.y = meshCanvas2.position.y = floorHeight; - } - }; - - const texturePainting = new THREE.TextureLoader().load( - 'textures/758px-Canestra_di_frutta_(Caravaggio).jpg', - callbackPainting, - ); - const texturePainting2 = new THREE.Texture(); - - const materialPainting = new THREE.MeshBasicMaterial({ color: 0xffffff, map: texturePainting }); - const materialPainting2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: texturePainting2 }); - - texturePainting.colorSpace = THREE.SRGBColorSpace; - texturePainting2.colorSpace = THREE.SRGBColorSpace; - texturePainting2.minFilter = texturePainting2.magFilter = THREE.NearestFilter; - texturePainting.minFilter = texturePainting.magFilter = THREE.LinearFilter; - texturePainting.mapping = THREE.UVMapping; - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - - renderer.domElement.style.position = 'relative'; - container.appendChild(renderer.domElement); - - document.addEventListener('mousemove', onDocumentMouseMove); -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -function animate() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-(mouseY - 200) - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - renderer.clear(); - renderer.setScissorTest(true); - - renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene, camera); - - renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene2, camera); - - renderer.setScissorTest(false); -} diff --git a/examples-testing/examples/webgl_materials_texture_html.ts b/examples-testing/examples/webgl_materials_texture_html.ts deleted file mode 100644 index c6c264e0f..000000000 --- a/examples-testing/examples/webgl_materials_texture_html.ts +++ /dev/null @@ -1,94 +0,0 @@ -import * as THREE from 'three'; -import { installHtmlInCanvasPolyfill } from 'three-html-render/polyfill'; -import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { InteractionManager } from 'three/addons/interaction/InteractionManager.js'; - -if (!('requestPaint' in HTMLCanvasElement.prototype)) { - installHtmlInCanvasPolyfill(); - info.innerHTML += - '
HTML-in-Canvas API not available. Using polyfill.'; -} - -let camera, scene, renderer, mesh, interactions; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.z = 500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xaaaaaa); - scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.02).texture; - - // HTML element - - const element = document.createElement('div'); - element.id = 'draw_element'; - element.innerHTML = ` - Hello world!
I'm multi-line, formatted, - rotated text with emoji (😀), RTL text - من فارسی صحبت میکنم, - vertical text, -

- 这是垂直文本 -

- an inline image (), and - - - - SVG - - ! -
- - - `; - - const geometry = new RoundedBoxGeometry(200, 200, 200, 10, 10); - - const material = new THREE.MeshStandardMaterial({ roughness: 0, metalness: 0.5 }); - material.map = new THREE.HTMLTexture(element); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // Interaction - - interactions = new InteractionManager(); - interactions.connect(renderer, camera); - interactions.add(mesh); - - // Button click handler - - element.querySelector('button').addEventListener('click', function () { - this.textContent = 'Clicked!'; - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(time) { - mesh.rotation.x = Math.sin(time * 0.0005) * 0.5; - mesh.rotation.y = Math.cos(time * 0.0008) * 0.5; - - interactions.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_texture_manualmipmap.ts b/examples-testing/examples/webgl_materials_texture_manualmipmap.ts deleted file mode 100644 index 24bd4eb9f..000000000 --- a/examples-testing/examples/webgl_materials_texture_manualmipmap.ts +++ /dev/null @@ -1,175 +0,0 @@ -import * as THREE from 'three'; - -const SCREEN_WIDTH = window.innerWidth; -const SCREEN_HEIGHT = window.innerHeight; - -let container; - -let camera, scene1, scene2, renderer; - -let mouseX = 0, - mouseY = 0; - -const windowHalfX = window.innerWidth / 2; -const windowHalfY = window.innerHeight / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000); - camera.position.z = 1500; - - scene1 = new THREE.Scene(); - scene1.background = new THREE.Color(0x000000); - scene1.fog = new THREE.Fog(0x000000, 1500, 4000); - - scene2 = new THREE.Scene(); - scene2.background = new THREE.Color(0x000000); - scene2.fog = new THREE.Fog(0x000000, 1500, 4000); - - // GROUND - - function mipmap(size, color) { - const imageCanvas = document.createElement('canvas'); - const context = imageCanvas.getContext('2d'); - - imageCanvas.width = imageCanvas.height = size; - - context.fillStyle = '#444'; - context.fillRect(0, 0, size, size); - - context.fillStyle = color; - context.fillRect(0, 0, size / 2, size / 2); - context.fillRect(size / 2, size / 2, size / 2, size / 2); - return imageCanvas; - } - - const canvas = mipmap(128, '#f00'); - const textureCanvas1 = new THREE.CanvasTexture(canvas); - textureCanvas1.mipmaps[0] = canvas; - textureCanvas1.mipmaps[1] = mipmap(64, '#0f0'); - textureCanvas1.mipmaps[2] = mipmap(32, '#00f'); - textureCanvas1.mipmaps[3] = mipmap(16, '#400'); - textureCanvas1.mipmaps[4] = mipmap(8, '#040'); - textureCanvas1.mipmaps[5] = mipmap(4, '#004'); - textureCanvas1.mipmaps[6] = mipmap(2, '#044'); - textureCanvas1.mipmaps[7] = mipmap(1, '#404'); - textureCanvas1.colorSpace = THREE.SRGBColorSpace; - textureCanvas1.repeat.set(1000, 1000); - textureCanvas1.wrapS = THREE.RepeatWrapping; - textureCanvas1.wrapT = THREE.RepeatWrapping; - - const textureCanvas2 = textureCanvas1.clone(); - textureCanvas2.magFilter = THREE.NearestFilter; - textureCanvas2.minFilter = THREE.NearestMipmapNearestFilter; - - const materialCanvas1 = new THREE.MeshBasicMaterial({ map: textureCanvas1 }); - const materialCanvas2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: textureCanvas2 }); - - const geometry = new THREE.PlaneGeometry(100, 100); - - const meshCanvas1 = new THREE.Mesh(geometry, materialCanvas1); - meshCanvas1.rotation.x = -Math.PI / 2; - meshCanvas1.scale.set(1000, 1000, 1000); - - const meshCanvas2 = new THREE.Mesh(geometry, materialCanvas2); - meshCanvas2.rotation.x = -Math.PI / 2; - meshCanvas2.scale.set(1000, 1000, 1000); - - // PAINTING - - const callbackPainting = function () { - const image = texturePainting1.image; - - texturePainting2.image = image; - texturePainting2.needsUpdate = true; - - scene1.add(meshCanvas1); - scene2.add(meshCanvas2); - - const geometry = new THREE.PlaneGeometry(100, 100); - const mesh1 = new THREE.Mesh(geometry, materialPainting1); - const mesh2 = new THREE.Mesh(geometry, materialPainting2); - - addPainting(scene1, mesh1); - addPainting(scene2, mesh2); - - function addPainting(zscene, zmesh) { - zmesh.scale.x = image.width / 100; - zmesh.scale.y = image.height / 100; - - zscene.add(zmesh); - - const meshFrame = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000 })); - meshFrame.position.z = -10.0; - meshFrame.scale.x = (1.1 * image.width) / 100; - meshFrame.scale.y = (1.1 * image.height) / 100; - zscene.add(meshFrame); - - const meshShadow = new THREE.Mesh( - geometry, - new THREE.MeshBasicMaterial({ color: 0x000000, opacity: 0.75, transparent: true }), - ); - meshShadow.position.y = (-1.1 * image.height) / 2; - meshShadow.position.z = (-1.1 * image.height) / 2; - meshShadow.rotation.x = -Math.PI / 2; - meshShadow.scale.x = (1.1 * image.width) / 100; - meshShadow.scale.y = (1.1 * image.height) / 100; - zscene.add(meshShadow); - - const floorHeight = (-1.117 * image.height) / 2; - meshCanvas1.position.y = meshCanvas2.position.y = floorHeight; - } - }; - - const texturePainting1 = new THREE.TextureLoader().load( - 'textures/758px-Canestra_di_frutta_(Caravaggio).jpg', - callbackPainting, - ); - const texturePainting2 = new THREE.Texture(); - const materialPainting1 = new THREE.MeshBasicMaterial({ color: 0xffffff, map: texturePainting1 }); - const materialPainting2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: texturePainting2 }); - - texturePainting1.colorSpace = THREE.SRGBColorSpace; - texturePainting2.colorSpace = THREE.SRGBColorSpace; - texturePainting2.minFilter = texturePainting2.magFilter = THREE.NearestFilter; - texturePainting1.minFilter = texturePainting1.magFilter = THREE.LinearFilter; - texturePainting1.mapping = THREE.UVMapping; - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - - renderer.domElement.style.position = 'relative'; - container.appendChild(renderer.domElement); - - document.addEventListener('mousemove', onDocumentMouseMove); -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -function animate() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-(mouseY - 200) - camera.position.y) * 0.05; - - camera.lookAt(scene1.position); - - renderer.clear(); - renderer.setScissorTest(true); - - renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene1, camera); - - renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene2, camera); - - renderer.setScissorTest(false); -} diff --git a/examples-testing/examples/webgl_materials_texture_partialupdate.ts b/examples-testing/examples/webgl_materials_texture_partialupdate.ts deleted file mode 100644 index cae161939..000000000 --- a/examples-testing/examples/webgl_materials_texture_partialupdate.ts +++ /dev/null @@ -1,104 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer, timer, dataTexture, diffuseMap; - -let last = 0; -const position = new THREE.Vector2(); -const color = new THREE.Color(); - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.z = 2; - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - const loader = new THREE.TextureLoader(); - diffuseMap = await loader.loadAsync('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); - diffuseMap.colorSpace = THREE.SRGBColorSpace; - diffuseMap.minFilter = THREE.LinearFilter; - diffuseMap.generateMipmaps = false; - - const geometry = new THREE.PlaneGeometry(2, 2); - const material = new THREE.MeshBasicMaterial({ map: diffuseMap }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const width = 32; - const height = 32; - - const data = new Uint8Array(width * height * 4); - dataTexture = new THREE.DataTexture(data, width, height); - dataTexture.colorSpace = THREE.SRGBColorSpace; - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const elapsedTime = timer.getElapsed(); - - if (elapsedTime - last > 0.1) { - last = elapsedTime; - - position.x = 32 * THREE.MathUtils.randInt(1, 16) - 32; - position.y = 32 * THREE.MathUtils.randInt(1, 16) - 32; - - // generate new color data - - updateDataTexture(dataTexture); - - // perform copy from src to dest texture to a random position - - renderer.copyTextureToTexture(dataTexture, diffuseMap, null, position); - } - - renderer.render(scene, camera); -} - -function updateDataTexture(texture) { - const size = texture.image.width * texture.image.height; - const data = texture.image.data; - - // generate a random color and update texture data - - color.setHex(Math.random() * 0xffffff); - - const r = Math.floor(color.r * 255); - const g = Math.floor(color.g * 255); - const b = Math.floor(color.b * 255); - - for (let i = 0; i < size; i++) { - const stride = i * 4; - - data[stride] = r; - data[stride + 1] = g; - data[stride + 2] = b; - data[stride + 3] = 1; - } -} diff --git a/examples-testing/examples/webgl_materials_texture_rotation.ts b/examples-testing/examples/webgl_materials_texture_rotation.ts deleted file mode 100644 index eedc80c6f..000000000 --- a/examples-testing/examples/webgl_materials_texture_rotation.ts +++ /dev/null @@ -1,112 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let mesh, renderer, scene, camera; - -let gui; - -const API = { - offsetX: 0, - offsetY: 0, - repeatX: 0.25, - repeatY: 0.25, - rotation: Math.PI / 4, // positive is counterclockwise - centerX: 0.5, - centerY: 0.5, -}; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(10, 15, 25); - scene.add(camera); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.minDistance = 20; - controls.maxDistance = 50; - controls.maxPolarAngle = Math.PI / 2; - - const geometry = new THREE.BoxGeometry(10, 10, 10); - - new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg', function (texture) { - texture.wrapS = texture.wrapT = THREE.RepeatWrapping; - texture.anisotropy = renderer.capabilities.getMaxAnisotropy(); - texture.colorSpace = THREE.SRGBColorSpace; - - //texture.matrixAutoUpdate = false; // default is true; set to false to update texture.matrix manually - - const material = new THREE.MeshBasicMaterial({ map: texture }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - updateUvTransform(); - - initGui(); - - render(); - }); - - window.addEventListener('resize', onWindowResize); -} - -function render() { - renderer.render(scene, camera); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function updateUvTransform() { - const texture = mesh.material.map; - - if (texture.matrixAutoUpdate === true) { - texture.offset.set(API.offsetX, API.offsetY); - texture.repeat.set(API.repeatX, API.repeatY); - texture.center.set(API.centerX, API.centerY); - texture.rotation = API.rotation; // rotation is around center - } else { - // setting the matrix uv transform directly - texture.matrix.setUvTransform( - API.offsetX, - API.offsetY, - API.repeatX, - API.repeatY, - API.rotation, - API.centerX, - API.centerY, - ); - } - - render(); -} - -function initGui() { - gui = new GUI(); - - gui.add(API, 'offsetX', 0.0, 1.0).name('offset.x').onChange(updateUvTransform); - gui.add(API, 'offsetY', 0.0, 1.0).name('offset.y').onChange(updateUvTransform); - gui.add(API, 'repeatX', 0.25, 2.0).name('repeat.x').onChange(updateUvTransform); - gui.add(API, 'repeatY', 0.25, 2.0).name('repeat.y').onChange(updateUvTransform); - gui.add(API, 'rotation', -2.0, 2.0).name('rotation').onChange(updateUvTransform); - gui.add(API, 'centerX', 0.0, 1.0).name('center.x').onChange(updateUvTransform); - gui.add(API, 'centerY', 0.0, 1.0).name('center.y').onChange(updateUvTransform); -} diff --git a/examples-testing/examples/webgl_materials_toon.ts b/examples-testing/examples/webgl_materials_toon.ts deleted file mode 100644 index 46c6a7e93..000000000 --- a/examples-testing/examples/webgl_materials_toon.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OutlineEffect } from 'three/addons/effects/OutlineEffect.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -let container, stats; - -let camera, scene, renderer, effect; -let particleLight; - -const loader = new FontLoader(); -loader.load('fonts/gentilis_regular.typeface.json', function (font) { - init(font); -}); - -function init(font) { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2500); - camera.position.set(0.0, 400, 400 * 3.5); - - // - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x444488); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // Materials - - const cubeWidth = 400; - const numberOfSpheresPerSide = 5; - const sphereRadius = (cubeWidth / numberOfSpheresPerSide) * 0.8 * 0.5; - const stepSize = 1.0 / numberOfSpheresPerSide; - - const geometry = new THREE.SphereGeometry(sphereRadius, 32, 16); - - for (let alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex++) { - const colors = new Uint8Array(alphaIndex + 2); - - for (let c = 0; c <= colors.length; c++) { - colors[c] = (c / colors.length) * 256; - } - - const gradientMap = new THREE.DataTexture(colors, colors.length, 1, THREE.RedFormat); - gradientMap.needsUpdate = true; - - for (let beta = 0; beta <= 1.0; beta += stepSize) { - for (let gamma = 0; gamma <= 1.0; gamma += stepSize) { - // basic monochromatic energy preservation - const diffuseColor = new THREE.Color() - .setHSL(alpha, 0.5, gamma * 0.5 + 0.1) - .multiplyScalar(1 - beta * 0.2); - - const material = new THREE.MeshToonMaterial({ - color: diffuseColor, - gradientMap: gradientMap, - }); - - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = alpha * 400 - 200; - mesh.position.y = beta * 400 - 200; - mesh.position.z = gamma * 400 - 200; - - scene.add(mesh); - } - } - } - - function addLabel(name, location) { - const textGeo = new TextGeometry(name, { - font: font, - - size: 20, - depth: 1, - curveSegments: 1, - }); - - const textMaterial = new THREE.MeshBasicMaterial(); - const textMesh = new THREE.Mesh(textGeo, textMaterial); - textMesh.position.copy(location); - scene.add(textMesh); - } - - addLabel('-gradientMap', new THREE.Vector3(-350, 0, 0)); - addLabel('+gradientMap', new THREE.Vector3(350, 0, 0)); - - addLabel('-diffuse', new THREE.Vector3(0, 0, -300)); - addLabel('+diffuse', new THREE.Vector3(0, 0, 300)); - - particleLight = new THREE.Mesh(new THREE.SphereGeometry(4, 8, 8), new THREE.MeshBasicMaterial({ color: 0xffffff })); - scene.add(particleLight); - - // Lights - - scene.add(new THREE.AmbientLight(0xc1c1c1, 3)); - - const pointLight = new THREE.PointLight(0xffffff, 2, 800, 0); - particleLight.add(pointLight); - - // - - effect = new OutlineEffect(renderer); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 200; - controls.maxDistance = 2000; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - const timer = Date.now() * 0.00025; - - particleLight.position.x = Math.sin(timer * 7) * 300; - particleLight.position.y = Math.cos(timer * 5) * 400; - particleLight.position.z = Math.cos(timer * 3) * 300; - - effect.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_video.ts b/examples-testing/examples/webgl_materials_video.ts deleted file mode 100644 index ddf079183..000000000 --- a/examples-testing/examples/webgl_materials_video.ts +++ /dev/null @@ -1,202 +0,0 @@ -import * as THREE from 'three'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let container; - -let camera, scene, renderer; - -let video, texture, material, mesh; - -let composer; - -let mouseX = 0; -let mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -let cube_count; - -const meshes = [], - materials = [], - xgrid = 20, - ygrid = 10; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 500; - - scene = new THREE.Scene(); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0.5, 1, 1).normalize(); - scene.add(light); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - video = document.getElementById('video'); - video.play(); - video.addEventListener('play', function () { - this.currentTime = 3; - }); - - texture = new THREE.VideoTexture(video); - texture.colorSpace = THREE.SRGBColorSpace; - - // - - let i, j, ox, oy, geometry; - - const ux = 1 / xgrid; - const uy = 1 / ygrid; - - const xsize = 480 / xgrid; - const ysize = 204 / ygrid; - - const parameters = { color: 0xffffff, map: texture }; - - cube_count = 0; - - for (i = 0; i < xgrid; i++) { - for (j = 0; j < ygrid; j++) { - ox = i; - oy = j; - - geometry = new THREE.BoxGeometry(xsize, ysize, xsize); - - change_uvs(geometry, ux, uy, ox, oy); - - materials[cube_count] = new THREE.MeshLambertMaterial(parameters); - - material = materials[cube_count]; - - material.hue = i / xgrid; - material.saturation = 1 - j / ygrid; - - material.color.setHSL(material.hue, material.saturation, 0.5); - - mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = (i - xgrid / 2) * xsize; - mesh.position.y = (j - ygrid / 2) * ysize; - mesh.position.z = 0; - - mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; - - scene.add(mesh); - - mesh.dx = 0.001 * (0.5 - Math.random()); - mesh.dy = 0.001 * (0.5 - Math.random()); - - meshes[cube_count] = mesh; - - cube_count += 1; - } - } - - renderer.autoClear = false; - - document.addEventListener('mousemove', onDocumentMouseMove); - - // postprocessing - - const renderPass = new RenderPass(scene, camera); - const bloomPass = new BloomPass(1.3); - const outputPass = new OutputPass(); - - composer = new EffectComposer(renderer); - - composer.addPass(renderPass); - composer.addPass(bloomPass); - composer.addPass(outputPass); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); -} - -function change_uvs(geometry, unitx, unity, offsetx, offsety) { - const uvs = geometry.attributes.uv.array; - - for (let i = 0; i < uvs.length; i += 2) { - uvs[i] = (uvs[i] + offsetx) * unitx; - uvs[i + 1] = (uvs[i + 1] + offsety) * unity; - } -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = (event.clientY - windowHalfY) * 0.3; -} - -// - -let h, - counter = 1; - -function animate() { - const time = Date.now() * 0.00005; - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - for (let i = 0; i < cube_count; i++) { - material = materials[i]; - - h = ((360 * (material.hue + time)) % 360) / 360; - material.color.setHSL(h, material.saturation, 0.5); - } - - if (counter % 1000 > 200) { - for (let i = 0; i < cube_count; i++) { - mesh = meshes[i]; - - mesh.rotation.x += 10 * mesh.dx; - mesh.rotation.y += 10 * mesh.dy; - - mesh.position.x -= 150 * mesh.dx; - mesh.position.y += 150 * mesh.dy; - mesh.position.z += 300 * mesh.dx; - } - } - - if (counter % 1000 === 0) { - for (let i = 0; i < cube_count; i++) { - mesh = meshes[i]; - - mesh.dx *= -1; - mesh.dy *= -1; - } - } - - counter++; - - renderer.clear(); - composer.render(); -} diff --git a/examples-testing/examples/webgl_materials_video_webcam.ts b/examples-testing/examples/webgl_materials_video_webcam.ts deleted file mode 100644 index cf6f8d50c..000000000 --- a/examples-testing/examples/webgl_materials_video_webcam.ts +++ /dev/null @@ -1,79 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, video; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 0.01; - - scene = new THREE.Scene(); - - video = document.getElementById('video'); - - const texture = new THREE.VideoTexture(video); - texture.colorSpace = THREE.SRGBColorSpace; - - const geometry = new THREE.PlaneGeometry(16, 9); - geometry.scale(0.5, 0.5, 0.5); - const material = new THREE.MeshBasicMaterial({ map: texture }); - - const count = 128; - const radius = 32; - - for (let i = 1, l = count; i <= l; i++) { - const phi = Math.acos(-1 + (2 * i) / l); - const theta = Math.sqrt(l * Math.PI) * phi; - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.setFromSphericalCoords(radius, phi, theta); - mesh.lookAt(camera.position); - scene.add(mesh); - } - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enablePan = false; - - window.addEventListener('resize', onWindowResize); - - // - - if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { - const constraints = { video: { width: 1280, height: 720, facingMode: 'user' } }; - - navigator.mediaDevices - .getUserMedia(constraints) - .then(function (stream) { - // apply the stream to the video element used in the texture - - video.srcObject = stream; - video.play(); - }) - .catch(function (error) { - console.error('Unable to access the camera/webcam.', error); - }); - } else { - console.error('MediaDevices interface not available.'); - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_materials_wireframe.ts b/examples-testing/examples/webgl_materials_wireframe.ts deleted file mode 100644 index 8adbd71d6..000000000 --- a/examples-testing/examples/webgl_materials_wireframe.ts +++ /dev/null @@ -1,107 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -const API = { - thickness: 1, -}; - -let renderer, scene, camera, mesh2; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 500); - camera.position.z = 200; - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.enablePan = false; - controls.enableZoom = false; - - new THREE.BufferGeometryLoader().load('models/json/WaltHeadLo_buffergeometry.json', function (geometry) { - geometry.deleteAttribute('normal'); - geometry.deleteAttribute('uv'); - - setupAttributes(geometry); - - // left - - const material1 = new THREE.MeshBasicMaterial({ - color: 0xe0e0ff, - wireframe: true, - }); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.position.set(-40, 0, 0); - - scene.add(mesh1); - - // right - - const material2 = new THREE.ShaderMaterial({ - uniforms: { thickness: { value: API.thickness } }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - side: THREE.DoubleSide, - alphaToCoverage: true, // only works when WebGLRenderer's "antialias" is set to "true" - }); - - mesh2 = new THREE.Mesh(geometry, material2); - mesh2.position.set(40, 0, 0); - - scene.add(mesh2); - - // - - render(); - }); - - // - - const gui = new GUI(); - - gui.add(API, 'thickness', 0, 4).onChange(function () { - mesh2.material.uniforms.thickness.value = API.thickness; - render(); - }); - - gui.open(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function setupAttributes(geometry) { - const vectors = [new THREE.Vector3(1, 0, 0), new THREE.Vector3(0, 1, 0), new THREE.Vector3(0, 0, 1)]; - - const position = geometry.attributes.position; - const centers = new Float32Array(position.count * 3); - - for (let i = 0, l = position.count; i < l; i++) { - vectors[i % 3].toArray(centers, i * 3); - } - - geometry.setAttribute('center', new THREE.BufferAttribute(centers, 3)); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_math_obb.ts b/examples-testing/examples/webgl_math_obb.ts deleted file mode 100644 index 71cb5a916..000000000 --- a/examples-testing/examples/webgl_math_obb.ts +++ /dev/null @@ -1,192 +0,0 @@ -import * as THREE from 'three'; - -import { OBB } from 'three/addons/math/OBB.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, timer, controls, stats, raycaster, hitbox; - -const objects = [], - mouse = new THREE.Vector2(); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 75); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - timer = new THREE.Timer(); - timer.connect(document); - - raycaster = new THREE.Raycaster(); - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x222222, 4); - hemiLight.position.set(1, 1, 1); - scene.add(hemiLight); - - const size = new THREE.Vector3(10, 5, 6); - const geometry = new THREE.BoxGeometry(size.x, size.y, size.z); - - // setup OBB on geometry level (doing this manually for now) - - geometry.userData.obb = new OBB(); - geometry.userData.obb.halfSize.copy(size).multiplyScalar(0.5); - - for (let i = 0; i < 100; i++) { - const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: 0x00ff00 })); - object.matrixAutoUpdate = false; - - object.position.x = Math.random() * 80 - 40; - object.position.y = Math.random() * 80 - 40; - object.position.z = Math.random() * 80 - 40; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.x = Math.random() + 0.5; - object.scale.y = Math.random() + 0.5; - object.scale.z = Math.random() + 0.5; - - scene.add(object); - - // bounding volume on object level (this will reflect the current world transform) - - object.userData.obb = new OBB(); - - objects.push(object); - } - - // - - hitbox = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000, wireframe: true })); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); - - document.addEventListener('click', onClick); -} - -function onClick(event) { - event.preventDefault(); - - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; - - raycaster.setFromCamera(mouse, camera); - - const intersectionPoint = new THREE.Vector3(); - const intersections = []; - - for (let i = 0, il = objects.length; i < il; i++) { - const object = objects[i]; - const obb = object.userData.obb; - - const ray = raycaster.ray; - - if (obb.intersectRay(ray, intersectionPoint) !== null) { - const distance = ray.origin.distanceTo(intersectionPoint); - intersections.push({ distance: distance, object: object }); - } - } - - if (intersections.length > 0) { - // determine closest intersection and highlight the respective 3D object - - intersections.sort(sortIntersections); - - intersections[0].object.add(hitbox); - } else { - const parent = hitbox.parent; - - if (parent) parent.remove(hitbox); - } -} - -function sortIntersections(a, b) { - return a.distance - b.distance; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - controls.update(); - - // transform cubes - - const delta = timer.getDelta(); - - for (let i = 0, il = objects.length; i < il; i++) { - const object = objects[i]; - - object.rotation.x += delta * Math.PI * 0.2; - object.rotation.y += delta * Math.PI * 0.1; - - object.updateMatrix(); - object.updateMatrixWorld(); - - // update OBB - - object.userData.obb.copy(object.geometry.userData.obb); - object.userData.obb.applyMatrix4(object.matrixWorld); - - // reset - - object.material.color.setHex(0x00ff00); - } - - // collision detection - - for (let i = 0, il = objects.length; i < il; i++) { - const object = objects[i]; - const obb = object.userData.obb; - - for (let j = i + 1, jl = objects.length; j < jl; j++) { - const objectToTest = objects[j]; - const obbToTest = objectToTest.userData.obb; - - // now perform intersection test - - if (obb.intersectsOBB(obbToTest) === true) { - object.material.color.setHex(0xff0000); - objectToTest.material.color.setHex(0xff0000); - } - } - } - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_math_orientation_transform.ts b/examples-testing/examples/webgl_math_orientation_transform.ts deleted file mode 100644 index 1d66997c4..000000000 --- a/examples-testing/examples/webgl_math_orientation_transform.ts +++ /dev/null @@ -1,120 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, mesh, target; - -const spherical = new THREE.Spherical(); -const rotationMatrix = new THREE.Matrix4(); -const targetQuaternion = new THREE.Quaternion(); -const timer = new THREE.Timer(); -timer.connect(document); -const speed = Math.PI / 2; - -const params = { - useLookAt: false, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.z = 5; - - scene = new THREE.Scene(); - - const geometry = new THREE.ConeGeometry(0.1, 0.5, 8); - geometry.rotateX(Math.PI * 0.5); - const material = new THREE.MeshNormalMaterial(); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const targetGeometry = new THREE.SphereGeometry(0.05); - const targetMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000 }); - target = new THREE.Mesh(targetGeometry, targetMaterial); - scene.add(target); - - // - - const sphereGeometry = new THREE.SphereGeometry(2, 32, 32); - const sphereMaterial = new THREE.MeshBasicMaterial({ - color: 0xcccccc, - wireframe: true, - transparent: true, - opacity: 0.3, - }); - const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); - scene.add(sphere); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - - gui.add(params, 'useLookAt'); - gui.open(); - - // - - generateTarget(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mesh.quaternion.equals(targetQuaternion) === false) { - if (params.useLookAt === true) { - // using lookAt() will make the mesh instantly look at the target - - mesh.lookAt(target.position); - } else { - // using rotateTowards() will gradually rotate the mesh towards the target - // the "speed" variable represents the rotation speed in radians per seconds - - const step = speed * delta; - mesh.quaternion.rotateTowards(targetQuaternion, step); - } - } - - renderer.render(scene, camera); -} - -function generateTarget() { - // generate a random point on a sphere - - spherical.theta = Math.random() * Math.PI * 2; - spherical.phi = Math.acos(2 * Math.random() - 1); - spherical.radius = 2; - - target.position.setFromSpherical(spherical); - - // compute target rotation - - rotationMatrix.lookAt(target.position, mesh.position, mesh.up); - targetQuaternion.setFromRotationMatrix(rotationMatrix); - - setTimeout(generateTarget, 2000); -} diff --git a/examples-testing/examples/webgl_mesh_batch.ts b/examples-testing/examples/webgl_mesh_batch.ts deleted file mode 100644 index e238e50a3..000000000 --- a/examples-testing/examples/webgl_mesh_batch.ts +++ /dev/null @@ -1,347 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { radixSort } from 'three/addons/utils/SortUtils.js'; - -let stats, gui, guiStatsEl; -let camera, controls, scene, renderer; -let geometries, mesh; -const ids = []; -const matrix = new THREE.Matrix4(); - -// - -const position = new THREE.Vector3(); -const rotation = new THREE.Euler(); -const quaternion = new THREE.Quaternion(); -const scale = new THREE.Vector3(); - -// - -const MAX_GEOMETRY_COUNT = 20000; - -const Method = { - BATCHED: 'BATCHED', - NAIVE: 'NAIVE', -}; - -const api = { - method: Method.BATCHED, - count: 256, - dynamic: 16, - - transparent: true, - sortObjects: true, - perObjectFrustumCulled: true, - useCustomSort: true, -}; - -init(); -initGeometries(); -initMesh(); - -// - -function randomizeMatrix(matrix) { - position.x = Math.random() * 40 - 20; - position.y = Math.random() * 40 - 20; - position.z = Math.random() * 40 - 20; - - rotation.x = Math.random() * 2 * Math.PI; - rotation.y = Math.random() * 2 * Math.PI; - rotation.z = Math.random() * 2 * Math.PI; - - quaternion.setFromEuler(rotation); - - scale.x = scale.y = scale.z = 0.5 + Math.random() * 0.5; - - return matrix.compose(position, quaternion, scale); -} - -function randomizeRotationSpeed(rotation) { - rotation.x = Math.random() * 0.01; - rotation.y = Math.random() * 0.01; - rotation.z = Math.random() * 0.01; - return rotation; -} - -function randomizeColor(color) { - return color.setHSL(Math.random() * 0.5, 0.6, 0.5); -} - -function randomizeAlpha() { - // make ~20% of all objects transparent - return Math.random() > 0.8 ? 0.5 : 1.0; -} - -function initGeometries() { - const cone = new THREE.ConeGeometry(1.0, 2.0); - const box = new THREE.BoxGeometry(2.0, 2.0, 2.0); - const sphere = new THREE.SphereGeometry(1.0, 16, 8); - - geometries = [cone, box, sphere]; - - for (const geometry of geometries) { - // add vertex colors for testing - const count = geometry.getAttribute('position').count; - const attribute = new THREE.BufferAttribute(new Float32Array(count * 3), 3); - geometry.setAttribute('color', attribute); - - for (let i = 0, l = attribute.array.length; i < l; ++i) { - attribute.array[i] = 1.0; - } - } -} - -function createMaterial() { - return new THREE.MeshPhongMaterial({ - vertexColors: true, - transparent: api.transparent, - depthWrite: !api.transparent, - }); -} - -function cleanup() { - if (mesh) { - mesh.traverse(node => { - if (node instanceof THREE.Mesh) { - node.material.dispose(); - } - }); - - mesh.parent.remove(mesh); - - if (mesh.dispose) { - mesh.dispose(); - } - } -} - -function initMesh() { - cleanup(); - - if (api.method === Method.BATCHED) { - initBatchedMesh(); - } else { - initRegularMesh(); - } -} - -function initRegularMesh() { - mesh = new THREE.Group(); - - for (let i = 0; i < api.count; i++) { - const material = createMaterial(); - randomizeColor(material.color); - material.opacity = randomizeAlpha(); - - const child = new THREE.Mesh(geometries[i % geometries.length], material); - randomizeMatrix(child.matrix); - child.matrix.decompose(child.position, child.quaternion, child.scale); - child.userData.rotationSpeed = randomizeRotationSpeed(new THREE.Euler()); - mesh.add(child); - } - - scene.add(mesh); -} - -function initBatchedMesh() { - const geometryCount = api.count; - const vertexCount = geometries.length * 512; - const indexCount = geometries.length * 1024; - - const euler = new THREE.Euler(); - const matrix = new THREE.Matrix4(); - const color = new THREE.Color(); - const colorWithAlpha = new THREE.Vector4(); - mesh = new THREE.BatchedMesh(geometryCount, vertexCount, indexCount, createMaterial()); - mesh.userData.rotationSpeeds = []; - - // disable full-object frustum culling since all of the objects can be dynamic. - mesh.frustumCulled = false; - - ids.length = 0; - - const geometryIds = [ - mesh.addGeometry(geometries[0]), - mesh.addGeometry(geometries[1]), - mesh.addGeometry(geometries[2]), - ]; - - for (let i = 0; i < api.count; i++) { - randomizeColor(color); - colorWithAlpha.set(color.r, color.g, color.b, randomizeAlpha()); - - const id = mesh.addInstance(geometryIds[i % geometryIds.length]); - mesh.setMatrixAt(id, randomizeMatrix(matrix)); - mesh.setColorAt(id, colorWithAlpha); - - const rotationMatrix = new THREE.Matrix4(); - rotationMatrix.makeRotationFromEuler(randomizeRotationSpeed(euler)); - mesh.userData.rotationSpeeds.push(rotationMatrix); - - ids.push(id); - } - - scene.add(mesh); -} - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - - // camera - - camera = new THREE.PerspectiveCamera(70, width / height, 1, 100); - camera.position.z = 30; - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = 1.0; - - // light - - const ambientLight = new THREE.AmbientLight(0xffffff, 2); - const directionalLight = new THREE.DirectionalLight(0xffffff, 2); - directionalLight.position.set(1, 1, 1); - scene.add(directionalLight, ambientLight); - - // stats - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // gui - - gui = new GUI(); - gui.add(api, 'count', 1, MAX_GEOMETRY_COUNT).step(1).onChange(initMesh); - gui.add(api, 'dynamic', 0, MAX_GEOMETRY_COUNT).step(1); - gui.add(api, 'method', Method).onChange(initMesh); - - gui.add(api, 'transparent').onChange(v => - mesh.traverse(node => { - if (node instanceof THREE.Mesh) { - const material = node.material; - material.transparent = v; - material.depthWrite = !v; - material.needsUpdate = true; - } - }), - ); - - gui.add(api, 'sortObjects'); - gui.add(api, 'perObjectFrustumCulled'); - gui.add(api, 'useCustomSort'); - - guiStatsEl = document.createElement('li'); - guiStatsEl.classList.add('gui-stats'); - - // listeners - - window.addEventListener('resize', onWindowResize); -} - -// - -function sortFunction(list) { - // initialize options - this._options = this._options || { - get: el => el.z, - aux: new Array(this.maxInstanceCount), - }; - - const options = this._options; - options.reversed = this.material.transparent; - - let minZ = Infinity; - let maxZ = -Infinity; - for (let i = 0, l = list.length; i < l; i++) { - const z = list[i].z; - if (z > maxZ) maxZ = z; - if (z < minZ) minZ = z; - } - - // convert depth to unsigned 32 bit range - const depthDelta = maxZ - minZ; - const factor = (2 ** 32 - 1) / depthDelta; // UINT32_MAX / z range - for (let i = 0, l = list.length; i < l; i++) { - list[i].z -= minZ; - list[i].z *= factor; - } - - // perform a fast-sort using the hybrid radix sort function - radixSort(list, options); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - animateMeshes(); - - controls.update(); - stats.update(); - - render(); -} - -function animateMeshes() { - const loopNum = Math.min(api.count, api.dynamic); - - if (api.method === Method.BATCHED) { - for (let i = 0; i < loopNum; i++) { - const rotationMatrix = mesh.userData.rotationSpeeds[i]; - const id = ids[i]; - - mesh.getMatrixAt(id, matrix); - matrix.multiply(rotationMatrix); - mesh.setMatrixAt(id, matrix); - } - } else { - for (let i = 0; i < loopNum; i++) { - const child = mesh.children[i]; - const rotationSpeed = child.userData.rotationSpeed; - - child.rotation.set( - child.rotation.x + rotationSpeed.x, - child.rotation.y + rotationSpeed.y, - child.rotation.z + rotationSpeed.z, - ); - } - } -} - -function render() { - if (mesh.isBatchedMesh) { - mesh.sortObjects = api.sortObjects; - mesh.perObjectFrustumCulled = api.perObjectFrustumCulled; - mesh.setCustomSort(api.useCustomSort ? sortFunction : null); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_mirror.ts b/examples-testing/examples/webgl_mirror.ts deleted file mode 100644 index 4f1f17f7d..000000000 --- a/examples-testing/examples/webgl_mirror.ts +++ /dev/null @@ -1,193 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Reflector } from 'three/addons/objects/Reflector.js'; - -let camera, scene, renderer; - -let cameraControls; - -let sphereGroup, smallSphere; - -let groundMirror, verticalMirror; - -let resolutionScale = 1; // render target scale factor in [ 0, 1 ] - -const size = new THREE.Vector2(); - -init(); - -function init() { - const container = document.getElementById('container'); - - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); - camera.position.set(0, 75, 160); - - cameraControls = new OrbitControls(camera, renderer.domElement); - cameraControls.target.set(0, 40, 0); - cameraControls.maxDistance = 400; - cameraControls.minDistance = 10; - cameraControls.update(); - - // - - const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); - - // reflectors/mirrors - - let geometry, material; - - renderer.getDrawingBufferSize(size); - size.multiplyScalar(resolutionScale).round(); - - geometry = new THREE.CircleGeometry(40, 64); - groundMirror = new Reflector(geometry, { - clipBias: 0.003, - textureWidth: size.width, - textureHeight: size.height, - color: 0xb5b5b5, - }); - groundMirror.position.y = 0.5; - groundMirror.rotateX(-Math.PI / 2); - scene.add(groundMirror); - - geometry = new THREE.PlaneGeometry(100, 100); - verticalMirror = new Reflector(geometry, { - clipBias: 0.003, - textureWidth: size.width, - textureHeight: size.height, - color: 0xc1cbcb, - }); - verticalMirror.position.y = 50; - verticalMirror.position.z = -50; - scene.add(verticalMirror); - - sphereGroup = new THREE.Object3D(); - scene.add(sphereGroup); - - geometry = new THREE.CylinderGeometry(0.1, 15 * Math.cos((Math.PI / 180) * 30), 0.1, 24, 1); - material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x8d8d8d }); - const sphereCap = new THREE.Mesh(geometry, material); - sphereCap.position.y = -15 * Math.sin((Math.PI / 180) * 30) - 0.05; - sphereCap.rotateX(-Math.PI); - - geometry = new THREE.SphereGeometry(15, 24, 24, Math.PI / 2, Math.PI * 2, 0, (Math.PI / 180) * 120); - const halfSphere = new THREE.Mesh(geometry, material); - halfSphere.add(sphereCap); - halfSphere.rotateX((-Math.PI / 180) * 135); - halfSphere.rotateZ((-Math.PI / 180) * 20); - halfSphere.position.y = 7.5 + 15 * Math.sin((Math.PI / 180) * 30); - - sphereGroup.add(halfSphere); - - geometry = new THREE.IcosahedronGeometry(5, 0); - material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x7b7b7b, flatShading: true }); - smallSphere = new THREE.Mesh(geometry, material); - scene.add(smallSphere); - - // walls - const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeTop.position.y = 100; - planeTop.rotateX(Math.PI / 2); - scene.add(planeTop); - - const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeBottom.rotateX(-Math.PI / 2); - scene.add(planeBottom); - - const planeFront = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); - planeFront.position.z = 50; - planeFront.position.y = 50; - planeFront.rotateY(Math.PI); - scene.add(planeFront); - - const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); - planeRight.position.x = 50; - planeRight.position.y = 50; - planeRight.rotateY(-Math.PI / 2); - scene.add(planeRight); - - const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); - planeLeft.position.x = -50; - planeLeft.position.y = 50; - planeLeft.rotateY(Math.PI / 2); - scene.add(planeLeft); - - // lights - const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); - mainLight.position.y = 60; - scene.add(mainLight); - - const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); - greenLight.position.set(550, 50, 0); - scene.add(greenLight); - - const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); - redLight.position.set(-550, 50, 0); - scene.add(redLight); - - const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); - blueLight.position.set(0, 50, 550); - scene.add(blueLight); - - // GUI - - const params = { - resolution: resolutionScale, - }; - - const gui = new GUI(); - - const folder = gui.addFolder('Mirrors'); - - folder.add(params, 'resolution', 0.2, 1, 0.1).onChange(function (val) { - resolutionScale = val; - onWindowResize(); - }); - - folder.open(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - renderer.getDrawingBufferSize(size); - size.multiplyScalar(resolutionScale).round(); - - groundMirror.getRenderTarget().setSize(size.width, size.height); - verticalMirror.getRenderTarget().setSize(size.width, size.height); -} - -function animate() { - const timer = Date.now() * 0.01; - - sphereGroup.rotation.y -= 0.002; - - smallSphere.position.set( - Math.cos(timer * 0.1) * 30, - Math.abs(Math.cos(timer * 0.2)) * 20 + 5, - Math.sin(timer * 0.1) * 30, - ); - smallSphere.rotation.y = Math.PI / 2 - timer * 0.1; - smallSphere.rotation.z = timer * 0.8; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_modifier_edgesplit.ts b/examples-testing/examples/webgl_modifier_edgesplit.ts deleted file mode 100644 index f02478ed9..000000000 --- a/examples-testing/examples/webgl_modifier_edgesplit.ts +++ /dev/null @@ -1,128 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; -import { EdgeSplitModifier } from 'three/addons/modifiers/EdgeSplitModifier.js'; -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let renderer, scene, camera; -let modifier, mesh, baseGeometry; -let map; - -const params = { - smoothShading: true, - edgeSplit: true, - cutOffAngle: 20, - showMap: false, - tryKeepNormals: true, -}; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.enableDamping = true; - controls.dampingFactor = 0.25; - controls.rotateSpeed = 0.35; - controls.minZoom = 1; - camera.position.set(0, 0, 4); - - scene.add(new THREE.HemisphereLight(0xffffff, 0x444444, 3)); - - new OBJLoader().load('./models/obj/cerberus/Cerberus.obj', function (group) { - const cerberus = group.children[0]; - const modelGeometry = cerberus.geometry; - - modifier = new EdgeSplitModifier(); - baseGeometry = BufferGeometryUtils.mergeVertices(modelGeometry); - - mesh = new THREE.Mesh(getGeometry(), new THREE.MeshStandardMaterial()); - mesh.material.flatShading = !params.smoothShading; - mesh.rotateY(-Math.PI / 2); - mesh.scale.set(3.5, 3.5, 3.5); - mesh.translateZ(1.5); - scene.add(mesh); - - if (map !== undefined && params.showMap) { - mesh.material.map = map; - mesh.material.needsUpdate = true; - } - - render(); - }); - - window.addEventListener('resize', onWindowResize); - - new THREE.TextureLoader().load('./models/obj/cerberus/Cerberus_A.jpg', function (texture) { - map = texture; - map.colorSpace = THREE.SRGBColorSpace; - - if (mesh !== undefined && params.showMap) { - mesh.material.map = map; - mesh.material.needsUpdate = true; - } - }); - - const gui = new GUI({ title: 'Edge split modifier parameters' }); - - gui.add(params, 'showMap').onFinishChange(updateMesh); - gui.add(params, 'smoothShading').onFinishChange(updateMesh); - gui.add(params, 'edgeSplit').onFinishChange(updateMesh); - gui.add(params, 'cutOffAngle').min(0).max(180).onFinishChange(updateMesh); - gui.add(params, 'tryKeepNormals').onFinishChange(updateMesh); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - render(); -} - -function getGeometry() { - let geometry; - - if (params.edgeSplit) { - geometry = modifier.modify(baseGeometry, (params.cutOffAngle * Math.PI) / 180, params.tryKeepNormals); - } else { - geometry = baseGeometry; - } - - return geometry; -} - -function updateMesh() { - if (mesh !== undefined) { - mesh.geometry = getGeometry(); - - let needsUpdate = mesh.material.flatShading === params.smoothShading; - mesh.material.flatShading = params.smoothShading === false; - - if (map !== undefined) { - needsUpdate = needsUpdate || mesh.material.map !== (params.showMap ? map : null); - mesh.material.map = params.showMap ? map : null; - } - - mesh.material.needsUpdate = needsUpdate; - - render(); - } -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_modifier_simplifier.ts b/examples-testing/examples/webgl_modifier_simplifier.ts deleted file mode 100644 index e1ddb45e7..000000000 --- a/examples-testing/examples/webgl_modifier_simplifier.ts +++ /dev/null @@ -1,84 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { SimplifyModifier } from 'three/addons/modifiers/SimplifyModifier.js'; - -let renderer, scene, camera; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 15; - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.enablePan = false; - controls.enableZoom = false; - - scene.add(new THREE.AmbientLight(0xffffff, 0.6)); - - const light = new THREE.PointLight(0xffffff, 400); - camera.add(light); - scene.add(camera); - - new GLTFLoader().load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - mesh.position.x = -3; - mesh.rotation.y = Math.PI / 2; - scene.add(mesh); - - const modifier = new SimplifyModifier(); - - const simplified = mesh.clone(); - simplified.material = simplified.material.clone(); - simplified.material.flatShading = true; - - simplified.position.x = 3; - simplified.rotation.y = -Math.PI / 2; - scene.add(simplified); - - const params = { ratio: 0.125 }; - - async function simplify() { - const count = Math.floor(mesh.geometry.attributes.position.count * (1 - params.ratio)); // number of vertices to remove - - const geometry = await modifier.modify(mesh.geometry, count); - - if (simplified.geometry !== mesh.geometry) simplified.geometry.dispose(); - - simplified.geometry = geometry; - - render(); - } - - simplify(); - - const gui = new GUI(); - gui.add(params, 'ratio', 0.01, 1, 0.01).onChange(simplify); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_modifier_tessellation.ts b/examples-testing/examples/webgl_modifier_tessellation.ts deleted file mode 100644 index 4600fc6cb..000000000 --- a/examples-testing/examples/webgl_modifier_tessellation.ts +++ /dev/null @@ -1,142 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; -import { TessellateModifier } from 'three/addons/modifiers/TessellateModifier.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -let renderer, scene, camera, stats; - -let controls; - -let mesh, uniforms; - -const WIDTH = window.innerWidth; -const HEIGHT = window.innerHeight; - -const loader = new FontLoader(); -loader.load('fonts/helvetiker_bold.typeface.json', function (font) { - init(font); -}); - -function init(font) { - camera = new THREE.PerspectiveCamera(40, WIDTH / HEIGHT, 1, 10000); - camera.position.set(-100, 100, 200); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x050505); - - // - - let geometry = new TextGeometry('THREE.JS', { - font: font, - - size: 40, - depth: 5, - curveSegments: 3, - - bevelThickness: 2, - bevelSize: 1, - bevelEnabled: true, - }); - - geometry.center(); - - const tessellateModifier = new TessellateModifier(8, 6); - - geometry = tessellateModifier.modify(geometry); - - // - - const numFaces = geometry.attributes.position.count / 3; - - const colors = new Float32Array(numFaces * 3 * 3); - const displacement = new Float32Array(numFaces * 3 * 3); - - const color = new THREE.Color(); - - for (let f = 0; f < numFaces; f++) { - const index = 9 * f; - - const h = 0.2 * Math.random(); - const s = 0.5 + 0.5 * Math.random(); - const l = 0.5 + 0.5 * Math.random(); - - color.setHSL(h, s, l); - - const d = 10 * (0.5 - Math.random()); - - for (let i = 0; i < 3; i++) { - colors[index + 3 * i] = color.r; - colors[index + 3 * i + 1] = color.g; - colors[index + 3 * i + 2] = color.b; - - displacement[index + 3 * i] = d; - displacement[index + 3 * i + 1] = d; - displacement[index + 3 * i + 2] = d; - } - } - - geometry.setAttribute('customColor', new THREE.BufferAttribute(colors, 3)); - geometry.setAttribute('displacement', new THREE.BufferAttribute(displacement, 3)); - - // - - uniforms = { - amplitude: { value: 0.0 }, - }; - - const shaderMaterial = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - }); - - // - - mesh = new THREE.Mesh(geometry, shaderMaterial); - - scene.add(mesh); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(WIDTH, HEIGHT); - renderer.setAnimationLoop(animate); - - const container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - controls = new TrackballControls(camera, renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - render(); - - stats.update(); -} - -function render() { - const time = Date.now() * 0.001; - - uniforms.amplitude.value = 1.0 + Math.sin(time * 0.5); - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_morphtargets.ts b/examples-testing/examples/webgl_morphtargets.ts deleted file mode 100644 index d8a4bbe8d..000000000 --- a/examples-testing/examples/webgl_morphtargets.ts +++ /dev/null @@ -1,116 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container, camera, scene, renderer, mesh; - -init(); - -function init() { - container = document.getElementById('container'); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x8fbcd4); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); - camera.position.z = 10; - scene.add(camera); - - scene.add(new THREE.AmbientLight(0x8fbcd4, 1.5)); - - const pointLight = new THREE.PointLight(0xffffff, 200); - camera.add(pointLight); - - const geometry = createGeometry(); - - const material = new THREE.MeshPhongMaterial({ - color: 0xff0000, - flatShading: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - initGUI(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(function () { - renderer.render(scene, camera); - }); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - - window.addEventListener('resize', onWindowResize); -} - -function createGeometry() { - const geometry = new THREE.BoxGeometry(2, 2, 2, 32, 32, 32); - - // create an empty array to hold targets for the attribute we want to morph - // morphing positions and normals is supported - geometry.morphAttributes.position = []; - - // the original positions of the cube's vertices - const positionAttribute = geometry.attributes.position; - - // for the first morph target we'll move the cube's vertices onto the surface of a sphere - const spherePositions = []; - - // for the second morph target, we'll twist the cubes vertices - const twistPositions = []; - const direction = new THREE.Vector3(1, 0, 0); - const vertex = new THREE.Vector3(); - - for (let i = 0; i < positionAttribute.count; i++) { - const x = positionAttribute.getX(i); - const y = positionAttribute.getY(i); - const z = positionAttribute.getZ(i); - - spherePositions.push( - x * Math.sqrt(1 - (y * y) / 2 - (z * z) / 2 + (y * y * z * z) / 3), - y * Math.sqrt(1 - (z * z) / 2 - (x * x) / 2 + (z * z * x * x) / 3), - z * Math.sqrt(1 - (x * x) / 2 - (y * y) / 2 + (x * x * y * y) / 3), - ); - - // stretch along the x-axis so we can see the twist better - vertex.set(x * 2, y, z); - - vertex.applyAxisAngle(direction, (Math.PI * x) / 2).toArray(twistPositions, twistPositions.length); - } - - // add the spherical positions as the first morph target - geometry.morphAttributes.position[0] = new THREE.Float32BufferAttribute(spherePositions, 3); - - // add the twisted positions as the second morph target - geometry.morphAttributes.position[1] = new THREE.Float32BufferAttribute(twistPositions, 3); - - return geometry; -} - -function initGUI() { - // Set up dat.GUI to control targets - const params = { - Spherify: 0, - Twist: 0, - }; - const gui = new GUI({ title: 'Morph Targets' }); - - gui.add(params, 'Spherify', 0, 1, 0.01).onChange(function (value) { - mesh.morphTargetInfluences[0] = value; - }); - gui.add(params, 'Twist', 0, 1, 0.01).onChange(function (value) { - mesh.morphTargetInfluences[1] = value; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} diff --git a/examples-testing/examples/webgl_morphtargets_face.ts b/examples-testing/examples/webgl_morphtargets_face.ts deleted file mode 100644 index 4e02c83ce..000000000 --- a/examples-testing/examples/webgl_morphtargets_face.ts +++ /dev/null @@ -1,108 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; -import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; - -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, stats, mixer, timer, controls; - -init(); - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); - camera.position.set(-1.8, 0.8, 3); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - container.appendChild(renderer.domElement); - - const ktx2Loader = new KTX2Loader().detectSupport(renderer); - - new GLTFLoader() - .setKTX2Loader(ktx2Loader) - .setMeshoptDecoder(MeshoptDecoder) - .load('models/gltf/facecap.glb', gltf => { - const mesh = gltf.scene.children[0]; - - scene.add(mesh); - - mixer = new THREE.AnimationMixer(mesh); - - mixer.clipAction(gltf.animations[0]).play(); - - // GUI - - const head = mesh.getObjectByName('mesh_2'); - const influences = head.morphTargetInfluences; - - const gui = new GUI(); - gui.close(); - - for (const [key, value] of Object.entries(head.morphTargetDictionary)) { - gui.add(influences, value, 0, 1, 0.01).name(key.replace('blendShape1.', '')).listen(); - } - }); - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.background = new THREE.Color(0x666666); - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2.5; - controls.maxDistance = 5; - controls.minAzimuthAngle = -Math.PI / 2; - controls.maxAzimuthAngle = Math.PI / 2; - controls.maxPolarAngle = Math.PI / 1.8; - controls.target.set(0, 0.15, -0.2); - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) { - mixer.update(delta); - } - - renderer.render(scene, camera); - - controls.update(); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_morphtargets_horse.ts b/examples-testing/examples/webgl_morphtargets_horse.ts deleted file mode 100644 index 2c29e9c0e..000000000 --- a/examples-testing/examples/webgl_morphtargets_horse.ts +++ /dev/null @@ -1,100 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let container, stats; -let camera, scene, renderer; -let mesh, mixer; - -const radius = 600; -let theta = 0; -let prevTime = Date.now(); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.y = 300; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xf0f0f0); - - // - - const light1 = new THREE.DirectionalLight(0xefefff, 5); - light1.position.set(1, 1, 1).normalize(); - scene.add(light1); - - const light2 = new THREE.DirectionalLight(0xffefef, 5); - light2.position.set(-1, -1, -1).normalize(); - scene.add(light2); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Horse.glb', function (gltf) { - mesh = gltf.scene.children[0]; - mesh.scale.set(1.5, 1.5, 1.5); - scene.add(mesh); - - mixer = new THREE.AnimationMixer(mesh); - - mixer.clipAction(gltf.animations[0]).setDuration(1).play(); - }); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - theta += 0.1; - - camera.position.x = radius * Math.sin(THREE.MathUtils.degToRad(theta)); - camera.position.z = radius * Math.cos(THREE.MathUtils.degToRad(theta)); - - camera.lookAt(0, 150, 0); - - if (mixer) { - const time = Date.now(); - - mixer.update((time - prevTime) * 0.001); - - prevTime = time; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_morphtargets_sphere.ts b/examples-testing/examples/webgl_morphtargets_sphere.ts deleted file mode 100644 index 3e36f002c..000000000 --- a/examples-testing/examples/webgl_morphtargets_sphere.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer, timer; - -let mesh; - -let sign = 1; -const speed = 0.5; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.2, 100); - camera.position.set(0, 5, 5); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - const light1 = new THREE.PointLight(0xff2200, 50000); - light1.position.set(100, 100, 100); - scene.add(light1); - - const light2 = new THREE.PointLight(0x22ff00, 10000); - light2.position.set(-100, -100, -100); - scene.add(light2); - - scene.add(new THREE.AmbientLight(0x111111)); - - const loader = new GLTFLoader(); - loader.load('models/gltf/AnimatedMorphSphere/glTF/AnimatedMorphSphere.gltf', function (gltf) { - mesh = gltf.scene.getObjectByName('AnimatedMorphSphere'); - mesh.rotation.z = Math.PI / 2; - scene.add(mesh); - - // - - const pointsMaterial = new THREE.PointsMaterial({ - size: 10, - sizeAttenuation: false, - map: new THREE.TextureLoader().load('textures/sprites/disc.png'), - alphaTest: 0.5, - }); - - const points = new THREE.Points(mesh.geometry, pointsMaterial); - points.morphTargetInfluences = mesh.morphTargetInfluences; - points.morphTargetDictionary = mesh.morphTargetDictionary; - mesh.add(points); - }); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - container.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 20; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - render(); -} - -function render() { - const delta = timer.getDelta(); - - if (mesh !== undefined) { - const step = delta * speed; - - mesh.rotation.y += step; - - mesh.morphTargetInfluences[1] = mesh.morphTargetInfluences[1] + step * sign; - - if (mesh.morphTargetInfluences[1] <= 0 || mesh.morphTargetInfluences[1] >= 1) { - sign *= -1; - } - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_multiple_elements.ts b/examples-testing/examples/webgl_multiple_elements.ts deleted file mode 100644 index 64f8a9c5f..000000000 --- a/examples-testing/examples/webgl_multiple_elements.ts +++ /dev/null @@ -1,139 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let canvas, renderer; - -const scenes = []; - -init(); - -function init() { - canvas = document.getElementById('c'); - - const geometries = [ - new THREE.BoxGeometry(1, 1, 1), - new THREE.SphereGeometry(0.5, 12, 8), - new THREE.DodecahedronGeometry(0.5), - new THREE.CylinderGeometry(0.5, 0.5, 1, 12), - ]; - - const content = document.getElementById('content'); - - for (let i = 0; i < 40; i++) { - const scene = new THREE.Scene(); - - // make a list item - const element = document.createElement('div'); - element.className = 'list-item'; - - const sceneElement = document.createElement('div'); - element.appendChild(sceneElement); - - const descriptionElement = document.createElement('div'); - descriptionElement.innerText = 'Scene ' + (i + 1); - element.appendChild(descriptionElement); - - // the element that represents the area we want to render the scene - scene.userData.element = sceneElement; - content.appendChild(element); - - const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); - camera.position.z = 2; - scene.userData.camera = camera; - - const controls = new OrbitControls(scene.userData.camera, scene.userData.element); - controls.minDistance = 2; - controls.maxDistance = 5; - controls.enablePan = false; - controls.enableZoom = false; - scene.userData.controls = controls; - - // add one random mesh to each scene - const geometry = geometries[(geometries.length * Math.random()) | 0]; - - const material = new THREE.MeshStandardMaterial({ - color: new THREE.Color().setHSL(Math.random(), 1, 0.75, THREE.SRGBColorSpace), - roughness: 0.5, - metalness: 0, - flatShading: true, - }); - - scene.add(new THREE.Mesh(geometry, material)); - - scene.add(new THREE.HemisphereLight(0xaaaaaa, 0x444444, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 1.5); - light.position.set(1, 1, 1); - scene.add(light); - - scenes.push(scene); - } - - renderer = new THREE.WebGLRenderer({ canvas: canvas, antialias: true }); - renderer.setClearColor(0xffffff, 1); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setAnimationLoop(animate); -} - -function updateSize() { - const width = canvas.clientWidth; - const height = canvas.clientHeight; - - if (canvas.width !== width || canvas.height !== height) { - renderer.setSize(width, height, false); - } -} - -function animate() { - updateSize(); - - canvas.style.transform = `translateY(${window.scrollY}px)`; - - renderer.setClearColor(0xffffff); - renderer.setScissorTest(false); - renderer.clear(); - - renderer.setClearColor(0xe0e0e0); - renderer.setScissorTest(true); - - scenes.forEach(function (scene) { - // so something moves - scene.children[0].rotation.y = Date.now() * 0.001; - - // get the element that is a place holder for where we want to - // draw the scene - const element = scene.userData.element; - - // get its position relative to the page's viewport - const rect = element.getBoundingClientRect(); - - // check if it's offscreen. If so skip it - if ( - rect.bottom < 0 || - rect.top > renderer.domElement.clientHeight || - rect.right < 0 || - rect.left > renderer.domElement.clientWidth - ) { - return; // it's off screen - } - - // set the viewport - const width = rect.right - rect.left; - const height = rect.bottom - rect.top; - const left = rect.left; - const bottom = renderer.domElement.clientHeight - rect.bottom; - - renderer.setViewport(left, bottom, width, height); - renderer.setScissor(left, bottom, width, height); - - const camera = scene.userData.camera; - - //camera.aspect = width / height; // not changing in this example - //camera.updateProjectionMatrix(); - - //scene.userData.controls.update(); - - renderer.render(scene, camera); - }); -} diff --git a/examples-testing/examples/webgl_multiple_rendertargets.ts b/examples-testing/examples/webgl_multiple_rendertargets.ts deleted file mode 100644 index 86708082b..000000000 --- a/examples-testing/examples/webgl_multiple_rendertargets.ts +++ /dev/null @@ -1,133 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, controls; -let renderTarget; -let postScene, postCamera; - -const parameters = { - samples: 4, - wireframe: false, -}; - -const gui = new GUI(); -gui.add(parameters, 'samples', 0, 4).step(1); -gui.add(parameters, 'wireframe'); -gui.onChange(render); - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - // Create a multi render target with Float buffers - - renderTarget = new THREE.WebGLRenderTarget( - window.innerWidth * window.devicePixelRatio, - window.innerHeight * window.devicePixelRatio, - { - count: 2, - minFilter: THREE.NearestFilter, - magFilter: THREE.NearestFilter, - }, - ); - - // Name our G-Buffer attachments for debugging - - renderTarget.textures[0].name = 'diffuse'; - renderTarget.textures[1].name = 'normal'; - - // Scene setup - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222222); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.z = 4; - - const loader = new THREE.TextureLoader(); - - const diffuse = loader.load('textures/hardwood2_diffuse.jpg', render); - diffuse.wrapS = THREE.RepeatWrapping; - diffuse.wrapT = THREE.RepeatWrapping; - diffuse.colorSpace = THREE.SRGBColorSpace; - - scene.add( - new THREE.Mesh( - new THREE.TorusKnotGeometry(1, 0.3, 128, 32), - new THREE.RawShaderMaterial({ - name: 'G-Buffer Shader', - vertexShader: document.querySelector('#gbuffer-vert').textContent.trim(), - fragmentShader: document.querySelector('#gbuffer-frag').textContent.trim(), - uniforms: { - tDiffuse: { value: diffuse }, - repeat: { value: new THREE.Vector2(5, 0.5) }, - }, - glslVersion: THREE.GLSL3, - }), - ), - ); - - // PostProcessing setup - - postScene = new THREE.Scene(); - postCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); - - postScene.add( - new THREE.Mesh( - new THREE.PlaneGeometry(2, 2), - new THREE.RawShaderMaterial({ - name: 'Post-FX Shader', - vertexShader: document.querySelector('#render-vert').textContent.trim(), - fragmentShader: document.querySelector('#render-frag').textContent.trim(), - uniforms: { - tDiffuse: { value: renderTarget.textures[0] }, - tNormal: { value: renderTarget.textures[1] }, - }, - glslVersion: THREE.GLSL3, - }), - ), - ); - - // Controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - const dpr = renderer.getPixelRatio(); - renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); - - render(); -} - -function render() { - renderTarget.samples = parameters.samples; - - scene.traverse(function (child) { - if (child.material !== undefined) { - child.material.wireframe = parameters.wireframe; - } - }); - - // render scene into target - renderer.setRenderTarget(renderTarget); - renderer.render(scene, camera); - - // render post FX - renderer.setRenderTarget(null); - renderer.render(postScene, postCamera); -} diff --git a/examples-testing/examples/webgl_multiple_scenes_comparison.ts b/examples-testing/examples/webgl_multiple_scenes_comparison.ts deleted file mode 100644 index 41a5130d4..000000000 --- a/examples-testing/examples/webgl_multiple_scenes_comparison.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container, camera, renderer, controls; -let sceneL, sceneR; - -let sliderPos = window.innerWidth / 2; - -init(); - -function init() { - container = document.querySelector('.container'); - - sceneL = new THREE.Scene(); - sceneL.background = new THREE.Color(0xbcd48f); - - sceneR = new THREE.Scene(); - sceneR.background = new THREE.Color(0x8fbcd4); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 6; - - controls = new OrbitControls(camera, container); - - const light = new THREE.HemisphereLight(0xffffff, 0x444444, 3); - light.position.set(-2, 2, 2); - sceneL.add(light.clone()); - sceneR.add(light.clone()); - - initMeshes(); - initSlider(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setScissorTest(true); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function initMeshes() { - const geometry = new THREE.IcosahedronGeometry(1, 3); - - const meshL = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial()); - sceneL.add(meshL); - - const meshR = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial({ wireframe: true })); - sceneR.add(meshR); -} - -function initSlider() { - const slider = document.querySelector('.slider'); - - function onPointerDown() { - if (event.isPrimary === false) return; - - controls.enabled = false; - - window.addEventListener('pointermove', onPointerMove); - window.addEventListener('pointerup', onPointerUp); - } - - function onPointerUp() { - controls.enabled = true; - - window.removeEventListener('pointermove', onPointerMove); - window.removeEventListener('pointerup', onPointerUp); - } - - function onPointerMove(e) { - if (event.isPrimary === false) return; - - sliderPos = Math.max(0, Math.min(window.innerWidth, e.pageX)); - - slider.style.left = sliderPos - slider.offsetWidth / 2 + 'px'; - } - - slider.style.touchAction = 'none'; // disable touch scroll - slider.addEventListener('pointerdown', onPointerDown); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.setScissor(0, 0, sliderPos, window.innerHeight); - renderer.render(sceneL, camera); - - renderer.setScissor(sliderPos, 0, window.innerWidth, window.innerHeight); - renderer.render(sceneR, camera); -} diff --git a/examples-testing/examples/webgl_multiple_views.ts b/examples-testing/examples/webgl_multiple_views.ts deleted file mode 100644 index 672846f9f..000000000 --- a/examples-testing/examples/webgl_multiple_views.ts +++ /dev/null @@ -1,235 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let stats; - -let scene, renderer; - -let mouseX = 0; - -let windowWidth, windowHeight; - -const views = [ - { - left: 0, - bottom: 0, - width: 0.5, - height: 1.0, - background: new THREE.Color().setRGB(0.5, 0.5, 0.7, THREE.SRGBColorSpace), - eye: [0, 300, 1800], - up: [0, 1, 0], - fov: 30, - updateCamera: function (camera, scene, mouseX) { - camera.position.x += mouseX * 0.05; - camera.position.x = Math.max(Math.min(camera.position.x, 2000), -2000); - camera.lookAt(scene.position); - }, - }, - { - left: 0.5, - bottom: 0, - width: 0.5, - height: 0.5, - background: new THREE.Color().setRGB(0.7, 0.5, 0.5, THREE.SRGBColorSpace), - eye: [0, 1800, 0], - up: [0, 0, 1], - fov: 45, - updateCamera: function (camera, scene, mouseX) { - camera.position.x -= mouseX * 0.05; - camera.position.x = Math.max(Math.min(camera.position.x, 2000), -2000); - camera.lookAt(camera.position.clone().setY(0)); - }, - }, - { - left: 0.5, - bottom: 0.5, - width: 0.5, - height: 0.5, - background: new THREE.Color().setRGB(0.5, 0.7, 0.7, THREE.SRGBColorSpace), - eye: [1400, 800, 1400], - up: [0, 1, 0], - fov: 60, - updateCamera: function (camera, scene, mouseX) { - camera.position.y -= mouseX * 0.05; - camera.position.y = Math.max(Math.min(camera.position.y, 1600), -1600); - camera.lookAt(scene.position); - }, - }, -]; - -init(); - -function init() { - const container = document.getElementById('container'); - - for (let ii = 0; ii < views.length; ++ii) { - const view = views[ii]; - const camera = new THREE.PerspectiveCamera(view.fov, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.fromArray(view.eye); - camera.up.fromArray(view.up); - view.camera = camera; - } - - scene = new THREE.Scene(); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 0, 1); - scene.add(light); - - // shadow - - const canvas = document.createElement('canvas'); - canvas.width = 128; - canvas.height = 128; - - const context = canvas.getContext('2d'); - const gradient = context.createRadialGradient( - canvas.width / 2, - canvas.height / 2, - 0, - canvas.width / 2, - canvas.height / 2, - canvas.width / 2, - ); - gradient.addColorStop(0.1, 'rgba(0,0,0,0.15)'); - gradient.addColorStop(1, 'rgba(0,0,0,0)'); - - context.fillStyle = gradient; - context.fillRect(0, 0, canvas.width, canvas.height); - - const shadowTexture = new THREE.CanvasTexture(canvas); - - const shadowMaterial = new THREE.MeshBasicMaterial({ map: shadowTexture, transparent: true }); - const shadowGeo = new THREE.PlaneGeometry(300, 300, 1, 1); - - let shadowMesh; - - shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); - shadowMesh.position.y = -250; - shadowMesh.rotation.x = -Math.PI / 2; - scene.add(shadowMesh); - - shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); - shadowMesh.position.x = -400; - shadowMesh.position.y = -250; - shadowMesh.rotation.x = -Math.PI / 2; - scene.add(shadowMesh); - - shadowMesh = new THREE.Mesh(shadowGeo, shadowMaterial); - shadowMesh.position.x = 400; - shadowMesh.position.y = -250; - shadowMesh.rotation.x = -Math.PI / 2; - scene.add(shadowMesh); - - const radius = 200; - - const geometry1 = new THREE.IcosahedronGeometry(radius, 1); - - const count = geometry1.attributes.position.count; - geometry1.setAttribute('color', new THREE.BufferAttribute(new Float32Array(count * 3), 3)); - - const geometry2 = geometry1.clone(); - const geometry3 = geometry1.clone(); - - const color = new THREE.Color(); - const positions1 = geometry1.attributes.position; - const positions2 = geometry2.attributes.position; - const positions3 = geometry3.attributes.position; - const colors1 = geometry1.attributes.color; - const colors2 = geometry2.attributes.color; - const colors3 = geometry3.attributes.color; - - for (let i = 0; i < count; i++) { - color.setHSL((positions1.getY(i) / radius + 1) / 2, 1.0, 0.5, THREE.SRGBColorSpace); - colors1.setXYZ(i, color.r, color.g, color.b); - - color.setHSL(0, (positions2.getY(i) / radius + 1) / 2, 0.5, THREE.SRGBColorSpace); - colors2.setXYZ(i, color.r, color.g, color.b); - - color.setRGB(1, 0.8 - (positions3.getY(i) / radius + 1) / 2, 0, THREE.SRGBColorSpace); - colors3.setXYZ(i, color.r, color.g, color.b); - } - - const material = new THREE.MeshPhongMaterial({ - color: 0xffffff, - flatShading: true, - vertexColors: true, - shininess: 0, - }); - - const wireframeMaterial = new THREE.MeshBasicMaterial({ color: 0x000000, wireframe: true, transparent: true }); - - let mesh = new THREE.Mesh(geometry1, material); - let wireframe = new THREE.Mesh(geometry1, wireframeMaterial); - mesh.add(wireframe); - mesh.position.x = -400; - mesh.rotation.x = -1.87; - scene.add(mesh); - - mesh = new THREE.Mesh(geometry2, material); - wireframe = new THREE.Mesh(geometry2, wireframeMaterial); - mesh.add(wireframe); - mesh.position.x = 400; - scene.add(mesh); - - mesh = new THREE.Mesh(geometry3, material); - wireframe = new THREE.Mesh(geometry3, wireframeMaterial); - mesh.add(wireframe); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - document.addEventListener('mousemove', onDocumentMouseMove); -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowWidth / 2; -} - -function updateSize() { - if (windowWidth != window.innerWidth || windowHeight != window.innerHeight) { - windowWidth = window.innerWidth; - windowHeight = window.innerHeight; - - renderer.setSize(windowWidth, windowHeight); - } -} - -function animate() { - render(); - stats.update(); -} - -function render() { - updateSize(); - - for (let ii = 0; ii < views.length; ++ii) { - const view = views[ii]; - const camera = view.camera; - - view.updateCamera(camera, scene, mouseX); - - const left = Math.floor(windowWidth * view.left); - const bottom = Math.floor(windowHeight * view.bottom); - const width = Math.floor(windowWidth * view.width); - const height = Math.floor(windowHeight * view.height); - - renderer.setViewport(left, bottom, width, height); - renderer.setScissor(left, bottom, width, height); - renderer.setScissorTest(true); - renderer.setClearColor(view.background); - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgl_multisampled_renderbuffers.ts b/examples-testing/examples/webgl_multisampled_renderbuffers.ts deleted file mode 100644 index df84fb144..000000000 --- a/examples-testing/examples/webgl_multisampled_renderbuffers.ts +++ /dev/null @@ -1,133 +0,0 @@ -import * as THREE from 'three'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, renderer, group, container; - -let composer1, composer2; - -const params = { - animate: true, -}; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, container.offsetWidth / container.offsetHeight, 10, 2000); - camera.position.z = 500; - - const scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - scene.fog = new THREE.Fog(0xcccccc, 100, 1500); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x222222, 5); - hemiLight.position.set(1, 1, 1); - scene.add(hemiLight); - - // - - group = new THREE.Group(); - - const geometry = new THREE.SphereGeometry(10, 64, 40); - const material = new THREE.MeshLambertMaterial({ - color: 0xee0808, - polygonOffset: true, - polygonOffsetFactor: 1, // positive value pushes polygon further away - polygonOffsetUnits: 1, - }); - const material2 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); - - for (let i = 0; i < 50; i++) { - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = Math.random() * 600 - 300; - mesh.position.y = Math.random() * 600 - 300; - mesh.position.z = Math.random() * 600 - 300; - mesh.rotation.x = Math.random(); - mesh.rotation.z = Math.random(); - mesh.scale.setScalar(Math.random() * 5 + 5); - group.add(mesh); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.position.copy(mesh.position); - mesh2.rotation.copy(mesh.rotation); - mesh2.scale.copy(mesh.scale); - group.add(mesh2); - } - - scene.add(group); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(container.offsetWidth, container.offsetHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - container.appendChild(renderer.domElement); - - // - - const size = renderer.getDrawingBufferSize(new THREE.Vector2()); - const renderTarget = new THREE.WebGLRenderTarget(size.width, size.height, { - samples: 4, - type: THREE.HalfFloatType, - }); - - const renderPass = new RenderPass(scene, camera); - const outputPass = new OutputPass(); - - // - - composer1 = new EffectComposer(renderer); - composer1.addPass(renderPass); - composer1.addPass(outputPass); - - // - - composer2 = new EffectComposer(renderer, renderTarget); - composer2.addPass(renderPass); - composer2.addPass(outputPass); - - // - - const gui = new GUI(); - gui.add(params, 'animate'); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = container.offsetWidth / container.offsetHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(container.offsetWidth, container.offsetHeight); - composer1.setSize(container.offsetWidth, container.offsetHeight); - composer2.setSize(container.offsetWidth, container.offsetHeight); -} - -function animate() { - const halfWidth = container.offsetWidth / 2; - - if (params.animate) { - group.rotation.y += 0.002; - } - - renderer.setScissorTest(true); - - renderer.setScissor(0, 0, halfWidth - 1, container.offsetHeight); - composer1.render(); - - renderer.setScissor(halfWidth, 0, halfWidth, container.offsetHeight); - composer2.render(); - - renderer.setScissorTest(false); -} diff --git a/examples-testing/examples/webgl_panorama_cube.ts b/examples-testing/examples/webgl_panorama_cube.ts deleted file mode 100644 index efd09cfc5..000000000 --- a/examples-testing/examples/webgl_panorama_cube.ts +++ /dev/null @@ -1,83 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, controls; -let renderer; -let scene; - -init(); - -function init() { - const container = document.getElementById('container'); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(90, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 0.01; - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enablePan = false; - controls.enableDamping = true; - controls.rotateSpeed = -0.25; - - const textures = getTexturesFromAtlasFile('textures/cube/sun_temple_stripe.jpg', 6); - - const materials = []; - - for (let i = 0; i < 6; i++) { - materials.push(new THREE.MeshBasicMaterial({ map: textures[i] })); - } - - const skyBox = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), materials); - skyBox.geometry.scale(1, 1, -1); - scene.add(skyBox); - - window.addEventListener('resize', onWindowResize); -} - -function getTexturesFromAtlasFile(atlasImgUrl, tilesNum) { - const textures = []; - - for (let i = 0; i < tilesNum; i++) { - textures[i] = new THREE.Texture(); - } - - new THREE.ImageLoader().load(atlasImgUrl, image => { - let canvas, context; - const tileWidth = image.height; - - for (let i = 0; i < textures.length; i++) { - canvas = document.createElement('canvas'); - context = canvas.getContext('2d'); - canvas.height = tileWidth; - canvas.width = tileWidth; - context.drawImage(image, tileWidth * i, 0, tileWidth, tileWidth, 0, 0, tileWidth, tileWidth); - textures[i].colorSpace = THREE.SRGBColorSpace; - textures[i].image = canvas; - textures[i].needsUpdate = true; - } - }); - - return textures; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); // required when damping is enabled - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_panorama_equirectangular.ts b/examples-testing/examples/webgl_panorama_equirectangular.ts deleted file mode 100644 index 35949ee6f..000000000 --- a/examples-testing/examples/webgl_panorama_equirectangular.ts +++ /dev/null @@ -1,112 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; - -let isUserInteracting = false, - onPointerDownMouseX = 0, - onPointerDownMouseY = 0, - lon = 0, - onPointerDownLon = 0, - lat = 0, - onPointerDownLat = 0, - phi = 0, - theta = 0; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1100); - - scene = new THREE.Scene(); - - const geometry = new THREE.SphereGeometry(500, 60, 40); - // invert the geometry on the x-axis so that all of the faces point inward - geometry.scale(-1, 1, 1); - - const texture = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); - texture.colorSpace = THREE.SRGBColorSpace; - const material = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh = new THREE.Mesh(geometry, material); - - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - container.style.touchAction = 'none'; - container.addEventListener('pointerdown', onPointerDown); - - document.addEventListener('wheel', onDocumentMouseWheel); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerDown(event) { - if (event.isPrimary === false) return; - - isUserInteracting = true; - - onPointerDownMouseX = event.clientX; - onPointerDownMouseY = event.clientY; - - onPointerDownLon = lon; - onPointerDownLat = lat; - - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerup', onPointerUp); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - lon = (onPointerDownMouseX - event.clientX) * 0.1 + onPointerDownLon; - lat = (event.clientY - onPointerDownMouseY) * 0.1 + onPointerDownLat; -} - -function onPointerUp(event) { - if (event.isPrimary === false) return; - - isUserInteracting = false; - - document.removeEventListener('pointermove', onPointerMove); - document.removeEventListener('pointerup', onPointerUp); -} - -function onDocumentMouseWheel(event) { - const fov = camera.fov + event.deltaY * 0.05; - - camera.fov = THREE.MathUtils.clamp(fov, 10, 75); - - camera.updateProjectionMatrix(); -} - -function animate() { - if (isUserInteracting === false) { - lon += 0.1; - } - - lat = Math.max(-85, Math.min(85, lat)); - phi = THREE.MathUtils.degToRad(90 - lat); - theta = THREE.MathUtils.degToRad(lon); - - const x = 500 * Math.sin(phi) * Math.cos(theta); - const y = 500 * Math.cos(phi); - const z = 500 * Math.sin(phi) * Math.sin(theta); - - camera.lookAt(x, y, z); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_performance.ts b/examples-testing/examples/webgl_performance.ts deleted file mode 100644 index 697ea36fb..000000000 --- a/examples-testing/examples/webgl_performance.ts +++ /dev/null @@ -1,77 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -let camera, scene, renderer, stats; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(60, 60, 60); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.environment = texture; - - // model - - const loader = new GLTFLoader().setPath('models/gltf/'); - loader.load('dungeon_warkarma.glb', async function (gltf) { - const model = gltf.scene; - - // wait until the model can be added to the scene without blocking due to shader compilation - - await renderer.compileAsync(model, camera, scene); - - scene.add(model); - }); - }); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 60; - controls.target.set(0, 0, -0.2); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_pmrem_cubemap.ts b/examples-testing/examples/webgl_pmrem_cubemap.ts deleted file mode 100644 index fb5bdafc1..000000000 --- a/examples-testing/examples/webgl_pmrem_cubemap.ts +++ /dev/null @@ -1,76 +0,0 @@ -import * as THREE from 'three'; - -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(0, 0, 8); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.update(); - - new HDRCubeTextureLoader() - .setPath('./textures/cube/pisaHDR/') - .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (map) { - const pmremGenerator = new THREE.PMREMGenerator(renderer); - const envMap = pmremGenerator.fromCubemap(map).texture; - - scene.background = envMap; - scene.backgroundBlurriness = 0.5; - - pmremGenerator.dispose(); - - const geometry = new THREE.SphereGeometry(0.4, 64, 64); - - for (let i = 0; i < 6; i++) { - for (let j = 0; j < 5; j++) { - const material = new THREE.MeshPhysicalMaterial({ - roughness: i / 5, - metalness: j / 4, - envMap: envMap, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = i - 2.5; - mesh.position.y = j - 2; - scene.add(mesh); - } - } - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_pmrem_equirectangular.ts b/examples-testing/examples/webgl_pmrem_equirectangular.ts deleted file mode 100644 index e7b8e76df..000000000 --- a/examples-testing/examples/webgl_pmrem_equirectangular.ts +++ /dev/null @@ -1,76 +0,0 @@ -import * as THREE from 'three'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(0, 0, 8); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.update(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (map) { - map.mapping = THREE.EquirectangularReflectionMapping; - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - const envMap = pmremGenerator.fromEquirectangular(map).texture; - - scene.background = envMap; - scene.backgroundBlurriness = 0.5; - - pmremGenerator.dispose(); - - const geometry = new THREE.SphereGeometry(0.4, 64, 64); - - for (let i = 0; i < 6; i++) { - for (let j = 0; j < 5; j++) { - const material = new THREE.MeshPhysicalMaterial({ - roughness: i / 5, - metalness: j / 4, - envMap: envMap, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = i - 2.5; - mesh.position.y = j - 2; - scene.add(mesh); - } - } - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_pmrem_test.ts b/examples-testing/examples/webgl_pmrem_test.ts deleted file mode 100644 index 3c482338f..000000000 --- a/examples-testing/examples/webgl_pmrem_test.ts +++ /dev/null @@ -1,141 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, controls, renderer; - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - const aspect = width / height; - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - - // tonemapping - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - // scene - - scene = new THREE.Scene(); - - // camera - - camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); - updateCamera(); - camera.position.set(0, 0, 16); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 4; - controls.maxDistance = 20; - - // light - - const directionalLight = new THREE.DirectionalLight(0xffffff, 0); // set intensity to 0 to start - const x = 597; - const y = 213; - const theta = ((x + 0.5) * Math.PI) / 512; - const phi = ((y + 0.5) * Math.PI) / 512; - - directionalLight.position.setFromSphericalCoords(100, -phi, Math.PI / 2 - theta); - - scene.add(directionalLight); - // scene.add( new THREE.DirectionalLightHelper( directionalLight ) ); - - // The spot1Lux HDR environment map is expressed in nits (lux / sr). The directional light has units of lux, - // so to match a 1 lux light, we set a single pixel with a value equal to 1 divided by the solid - // angle of the pixel in steradians. This image is 1024 x 512, - // so the value is 1 / ( sin( phi ) * ( pi / 512 ) ^ 2 ) = 27,490 nits. - - const gui = new GUI(); - gui.add({ enabled: true }, 'enabled') - .name('PMREM') - .onChange(value => { - directionalLight.intensity = value ? 0 : 1; - - scene.traverse(function (child) { - if (child.isMesh) { - child.material.envMapIntensity = 1 - directionalLight.intensity; - } - }); - - render(); - }); -} - -function createObjects() { - let radianceMap = null; - new HDRLoader() - // .setDataType( THREE.FloatType ) - .setPath('textures/equirectangular/') - .load('spot1Lux.hdr', function (texture) { - radianceMap = pmremGenerator.fromEquirectangular(texture).texture; - pmremGenerator.dispose(); - - scene.background = radianceMap; - - const geometry = new THREE.SphereGeometry(0.4, 32, 32); - - for (let x = 0; x <= 10; x++) { - for (let y = 0; y <= 2; y++) { - const material = new THREE.MeshPhysicalMaterial({ - roughness: x / 10, - metalness: y < 1 ? 1 : 0, - color: y < 2 ? 0xffffff : 0x000000, - envMap: radianceMap, - envMapIntensity: 1, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = x - 5; - mesh.position.y = 1 - y; - scene.add(mesh); - } - } - - render(); - }); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - pmremGenerator.compileEquirectangularShader(); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - updateCamera(); - - renderer.setSize(width, height); - - render(); -} - -function updateCamera() { - const horizontalFoV = 40; - const verticalFoV = - (2 * Math.atan(Math.tan(((horizontalFoV / 2) * Math.PI) / 180) / camera.aspect) * 180) / Math.PI; - camera.fov = verticalFoV; - camera.updateProjectionMatrix(); -} - -function render() { - renderer.render(scene, camera); -} - -Promise.resolve().then(init).then(createObjects).then(render); diff --git a/examples-testing/examples/webgl_points_billboards.ts b/examples-testing/examples/webgl_points_billboards.ts deleted file mode 100644 index 24d4de1a9..000000000 --- a/examples-testing/examples/webgl_points_billboards.ts +++ /dev/null @@ -1,120 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, stats, material; -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 2, 2000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - scene.fog = new THREE.FogExp2(0x000000, 0.001); - - const geometry = new THREE.BufferGeometry(); - const vertices = []; - - const sprite = new THREE.TextureLoader().load('textures/sprites/disc.png'); - sprite.colorSpace = THREE.SRGBColorSpace; - - for (let i = 0; i < 10000; i++) { - const x = 2000 * Math.random() - 1000; - const y = 2000 * Math.random() - 1000; - const z = 2000 * Math.random() - 1000; - - vertices.push(x, y, z); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - material = new THREE.PointsMaterial({ - size: 35, - sizeAttenuation: true, - map: sprite, - alphaTest: 0.5, - transparent: true, - }); - material.color.setHSL(1.0, 0.3, 0.7, THREE.SRGBColorSpace); - - const particles = new THREE.Points(geometry, material); - scene.add(particles); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - const gui = new GUI(); - - gui.add(material, 'sizeAttenuation').onChange(function () { - material.needsUpdate = true; - }); - - gui.open(); - - // - - document.body.style.touchAction = 'none'; - document.body.addEventListener('pointermove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.00005; - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - const h = ((360 * (1.0 + time)) % 360) / 360; - material.color.setHSL(h, 0.5, 0.5); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_points_sprites.ts b/examples-testing/examples/webgl_points_sprites.ts deleted file mode 100644 index 31b9e2ce1..000000000 --- a/examples-testing/examples/webgl_points_sprites.ts +++ /dev/null @@ -1,167 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, stats, parameters; -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -const materials = []; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - scene.fog = new THREE.FogExp2(0x000000, 0.0008); - - const geometry = new THREE.BufferGeometry(); - const vertices = []; - - const textureLoader = new THREE.TextureLoader(); - - const assignSRGB = texture => { - texture.colorSpace = THREE.SRGBColorSpace; - }; - - const sprite1 = textureLoader.load('textures/sprites/snowflake1.png', assignSRGB); - const sprite2 = textureLoader.load('textures/sprites/snowflake2.png', assignSRGB); - const sprite3 = textureLoader.load('textures/sprites/snowflake3.png', assignSRGB); - const sprite4 = textureLoader.load('textures/sprites/snowflake4.png', assignSRGB); - const sprite5 = textureLoader.load('textures/sprites/snowflake5.png', assignSRGB); - - for (let i = 0; i < 10000; i++) { - const x = Math.random() * 2000 - 1000; - const y = Math.random() * 2000 - 1000; - const z = Math.random() * 2000 - 1000; - - vertices.push(x, y, z); - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - parameters = [ - [[1.0, 0.2, 0.5], sprite2, 20], - [[0.95, 0.1, 0.5], sprite3, 15], - [[0.9, 0.05, 0.5], sprite1, 10], - [[0.85, 0, 0.5], sprite5, 8], - [[0.8, 0, 0.5], sprite4, 5], - ]; - - for (let i = 0; i < parameters.length; i++) { - const color = parameters[i][0]; - const sprite = parameters[i][1]; - const size = parameters[i][2]; - - materials[i] = new THREE.PointsMaterial({ - size: size, - map: sprite, - blending: THREE.AdditiveBlending, - depthTest: false, - transparent: true, - }); - materials[i].color.setHSL(color[0], color[1], color[2], THREE.SRGBColorSpace); - - const particles = new THREE.Points(geometry, materials[i]); - - particles.rotation.x = Math.random() * 6; - particles.rotation.y = Math.random() * 6; - particles.rotation.z = Math.random() * 6; - - scene.add(particles); - } - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - const gui = new GUI(); - - const params = { - texture: true, - }; - - gui.add(params, 'texture').onChange(function (value) { - for (let i = 0; i < materials.length; i++) { - materials[i].map = value === true ? parameters[i][1] : null; - materials[i].needsUpdate = true; - } - }); - - gui.open(); - - document.body.style.touchAction = 'none'; - document.body.addEventListener('pointermove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.00005; - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - for (let i = 0; i < scene.children.length; i++) { - const object = scene.children[i]; - - if (object instanceof THREE.Points) { - object.rotation.y = time * (i < 4 ? i + 1 : -(i + 1)); - } - } - - for (let i = 0; i < materials.length; i++) { - const color = parameters[i][0]; - - const h = ((360 * (color[0] + time)) % 360) / 360; - materials[i].color.setHSL(h, color[1], color[2], THREE.SRGBColorSpace); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_points_waves.ts b/examples-testing/examples/webgl_points_waves.ts deleted file mode 100644 index 91986e9e9..000000000 --- a/examples-testing/examples/webgl_points_waves.ts +++ /dev/null @@ -1,145 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -const SEPARATION = 100, - AMOUNTX = 50, - AMOUNTY = 50; - -let container, stats; -let camera, scene, renderer; - -let particles, - count = 0; - -let mouseX = 0, - mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - - // - - const numParticles = AMOUNTX * AMOUNTY; - - const positions = new Float32Array(numParticles * 3); - const scales = new Float32Array(numParticles); - - let i = 0, - j = 0; - - for (let ix = 0; ix < AMOUNTX; ix++) { - for (let iy = 0; iy < AMOUNTY; iy++) { - positions[i] = ix * SEPARATION - (AMOUNTX * SEPARATION) / 2; // x - positions[i + 1] = 0; // y - positions[i + 2] = iy * SEPARATION - (AMOUNTY * SEPARATION) / 2; // z - - scales[j] = 1; - - i += 3; - j++; - } - } - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - geometry.setAttribute('scale', new THREE.BufferAttribute(scales, 1)); - - const material = new THREE.ShaderMaterial({ - uniforms: { - color: { value: new THREE.Color(0xffffff) }, - }, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - }); - - // - - particles = new THREE.Points(geometry, material); - scene.add(particles); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - container.style.touchAction = 'none'; - container.addEventListener('pointermove', onPointerMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - camera.lookAt(scene.position); - - const positions = particles.geometry.attributes.position.array; - const scales = particles.geometry.attributes.scale.array; - - let i = 0, - j = 0; - - for (let ix = 0; ix < AMOUNTX; ix++) { - for (let iy = 0; iy < AMOUNTY; iy++) { - positions[i + 1] = Math.sin((ix + count) * 0.3) * 50 + Math.sin((iy + count) * 0.5) * 50; - - scales[j] = (Math.sin((ix + count) * 0.3) + 1) * 20 + (Math.sin((iy + count) * 0.5) + 1) * 20; - - i += 3; - j++; - } - } - - particles.geometry.attributes.position.needsUpdate = true; - particles.geometry.attributes.scale.needsUpdate = true; - - renderer.render(scene, camera); - - count += 0.1; -} diff --git a/examples-testing/examples/webgl_portal.ts b/examples-testing/examples/webgl_portal.ts deleted file mode 100644 index 4bc59593f..000000000 --- a/examples-testing/examples/webgl_portal.ts +++ /dev/null @@ -1,218 +0,0 @@ -import * as THREE from 'three'; - -import * as CameraUtils from 'three/addons/utils/CameraUtils.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; - -let cameraControls; - -let smallSphereOne, smallSphereTwo; - -let portalCamera, - leftPortal, - rightPortal, - leftPortalTexture, - reflectedPosition, - rightPortalTexture, - bottomLeftCorner, - bottomRightCorner, - topLeftCorner; - -init(); - -function init() { - const container = document.getElementById('container'); - - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.localClippingEnabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - container.appendChild(renderer.domElement); - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.set(0, 75, 160); - - cameraControls = new OrbitControls(camera, renderer.domElement); - cameraControls.target.set(0, 40, 0); - cameraControls.maxDistance = 400; - cameraControls.minDistance = 10; - cameraControls.update(); - - // - - const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); - - // bouncing icosphere - const portalPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0.0); - const geometry = new THREE.IcosahedronGeometry(5, 0); - const material = new THREE.MeshPhongMaterial({ - color: 0xffffff, - emissive: 0x333333, - flatShading: true, - clippingPlanes: [portalPlane], - clipShadows: true, - }); - smallSphereOne = new THREE.Mesh(geometry, material); - scene.add(smallSphereOne); - smallSphereTwo = new THREE.Mesh(geometry, material); - scene.add(smallSphereTwo); - - // portals - portalCamera = new THREE.PerspectiveCamera(45, 1.0, 0.1, 500.0); - scene.add(portalCamera); - //frustumHelper = new THREE.CameraHelper( portalCamera ); - //scene.add( frustumHelper ); - bottomLeftCorner = new THREE.Vector3(); - bottomRightCorner = new THREE.Vector3(); - topLeftCorner = new THREE.Vector3(); - reflectedPosition = new THREE.Vector3(); - - leftPortalTexture = new THREE.WebGLRenderTarget(256, 256); - leftPortal = new THREE.Mesh(planeGeo, new THREE.MeshBasicMaterial({ map: leftPortalTexture.texture })); - leftPortal.position.x = -30; - leftPortal.position.y = 20; - leftPortal.scale.set(0.35, 0.35, 0.35); - scene.add(leftPortal); - - rightPortalTexture = new THREE.WebGLRenderTarget(256, 256); - rightPortal = new THREE.Mesh(planeGeo, new THREE.MeshBasicMaterial({ map: rightPortalTexture.texture })); - rightPortal.position.x = 30; - rightPortal.position.y = 20; - rightPortal.scale.set(0.35, 0.35, 0.35); - scene.add(rightPortal); - - // walls - const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeTop.position.y = 100; - planeTop.rotateX(Math.PI / 2); - scene.add(planeTop); - - const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeBottom.rotateX(-Math.PI / 2); - scene.add(planeBottom); - - const planeFront = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); - planeFront.position.z = 50; - planeFront.position.y = 50; - planeFront.rotateY(Math.PI); - scene.add(planeFront); - - const planeBack = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff7fff })); - planeBack.position.z = -50; - planeBack.position.y = 50; - //planeBack.rotateY( Math.PI ); - scene.add(planeBack); - - const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); - planeRight.position.x = 50; - planeRight.position.y = 50; - planeRight.rotateY(-Math.PI / 2); - scene.add(planeRight); - - const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); - planeLeft.position.x = -50; - planeLeft.position.y = 50; - planeLeft.rotateY(Math.PI / 2); - scene.add(planeLeft); - - // lights - const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); - mainLight.position.y = 60; - scene.add(mainLight); - - const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); - greenLight.position.set(550, 50, 0); - scene.add(greenLight); - - const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); - redLight.position.set(-550, 50, 0); - scene.add(redLight); - - const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); - blueLight.position.set(0, 50, 550); - scene.add(blueLight); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function renderPortal(thisPortalMesh, otherPortalMesh, thisPortalTexture) { - // set the portal camera position to be reflected about the portal plane - thisPortalMesh.worldToLocal(reflectedPosition.copy(camera.position)); - reflectedPosition.x *= -1.0; - reflectedPosition.z *= -1.0; - otherPortalMesh.localToWorld(reflectedPosition); - portalCamera.position.copy(reflectedPosition); - - // grab the corners of the other portal - // - note: the portal is viewed backwards; flip the left/right coordinates - otherPortalMesh.localToWorld(bottomLeftCorner.set(50.05, -50.05, 0.0)); - otherPortalMesh.localToWorld(bottomRightCorner.set(-50.05, -50.05, 0.0)); - otherPortalMesh.localToWorld(topLeftCorner.set(50.05, 50.05, 0.0)); - // set the projection matrix to encompass the portal's frame - CameraUtils.frameCorners(portalCamera, bottomLeftCorner, bottomRightCorner, topLeftCorner, false); - - // render the portal - thisPortalTexture.texture.colorSpace = renderer.outputColorSpace; - renderer.setRenderTarget(thisPortalTexture); - renderer.state.buffers.depth.setMask(true); // make sure the depth buffer is writable so it can be properly cleared, see #18897 - if (renderer.autoClear === false) renderer.clear(); - thisPortalMesh.visible = false; // hide this portal from its own rendering - renderer.render(scene, portalCamera); - thisPortalMesh.visible = true; // re-enable this portal's visibility for general rendering -} - -function animate() { - // move the bouncing sphere(s) - const timerOne = Date.now() * 0.01; - const timerTwo = timerOne + Math.PI * 10.0; - - smallSphereOne.position.set( - Math.cos(timerOne * 0.1) * 30, - Math.abs(Math.cos(timerOne * 0.2)) * 20 + 5, - Math.sin(timerOne * 0.1) * 30, - ); - smallSphereOne.rotation.y = Math.PI / 2 - timerOne * 0.1; - smallSphereOne.rotation.z = timerOne * 0.8; - - smallSphereTwo.position.set( - Math.cos(timerTwo * 0.1) * 30, - Math.abs(Math.cos(timerTwo * 0.2)) * 20 + 5, - Math.sin(timerTwo * 0.1) * 30, - ); - smallSphereTwo.rotation.y = Math.PI / 2 - timerTwo * 0.1; - smallSphereTwo.rotation.z = timerTwo * 0.8; - - // save the original camera properties - const currentRenderTarget = renderer.getRenderTarget(); - const currentXrEnabled = renderer.xr.enabled; - const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate; - renderer.xr.enabled = false; // Avoid camera modification - renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows - - // render the portal effect - renderPortal(leftPortal, rightPortal, leftPortalTexture); - renderPortal(rightPortal, leftPortal, rightPortalTexture); - - // restore the original rendering properties - renderer.xr.enabled = currentXrEnabled; - renderer.shadowMap.autoUpdate = currentShadowAutoUpdate; - renderer.setRenderTarget(currentRenderTarget); - - // render the main scene - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_postprocessing.ts b/examples-testing/examples/webgl_postprocessing.ts deleted file mode 100644 index ecc9b28ee..000000000 --- a/examples-testing/examples/webgl_postprocessing.ts +++ /dev/null @@ -1,86 +0,0 @@ -import * as THREE from 'three'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; - -import { RGBShiftShader } from 'three/addons/shaders/RGBShiftShader.js'; -import { DotScreenShader } from 'three/addons/shaders/DotScreenShader.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, renderer, composer; -let object; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 400; - - const scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x000000, 1, 1000); - - object = new THREE.Object3D(); - scene.add(object); - - const geometry = new THREE.SphereGeometry(1, 4, 4); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); - - for (let i = 0; i < 100; i++) { - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); - mesh.position.multiplyScalar(Math.random() * 400); - mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); - mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 50; - object.add(mesh); - } - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1); - scene.add(light); - - // postprocessing - - composer = new EffectComposer(renderer); - composer.addPass(new RenderPass(scene, camera)); - - const effect1 = new ShaderPass(DotScreenShader); - effect1.uniforms['scale'].value = 4; - composer.addPass(effect1); - - const effect2 = new ShaderPass(RGBShiftShader); - effect2.uniforms['amount'].value = 0.0015; - composer.addPass(effect2); - - const effect3 = new OutputPass(); - composer.addPass(effect3); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - object.rotation.x += 0.005; - object.rotation.y += 0.01; - - composer.render(); -} diff --git a/examples-testing/examples/webgl_postprocessing_advanced.ts b/examples-testing/examples/webgl_postprocessing_advanced.ts deleted file mode 100644 index 82fc39be3..000000000 --- a/examples-testing/examples/webgl_postprocessing_advanced.ts +++ /dev/null @@ -1,304 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; -import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; -import { FilmPass } from 'three/addons/postprocessing/FilmPass.js'; -import { DotScreenPass } from 'three/addons/postprocessing/DotScreenPass.js'; -import { MaskPass, ClearMaskPass } from 'three/addons/postprocessing/MaskPass.js'; -import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; - -import { BleachBypassShader } from 'three/addons/shaders/BleachBypassShader.js'; -import { ColorifyShader } from 'three/addons/shaders/ColorifyShader.js'; -import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; -import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; -import { SepiaShader } from 'three/addons/shaders/SepiaShader.js'; -import { VignetteShader } from 'three/addons/shaders/VignetteShader.js'; -import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let container, stats; - -let composerScene, composer1, composer2, composer3, composer4; - -let cameraOrtho, cameraPerspective, sceneModel, sceneBG, renderer, mesh, directionalLight; - -const width = window.innerWidth || 2; -const height = window.innerHeight || 2; - -let halfWidth = width / 2; -let halfHeight = height / 2; - -let quadBG, quadMask, renderScene; - -const delta = 0.01; - -init(); - -function init() { - container = document.getElementById('container'); - - // - - cameraOrtho = new THREE.OrthographicCamera(-halfWidth, halfWidth, halfHeight, -halfHeight, -10000, 10000); - cameraOrtho.position.z = 100; - - cameraPerspective = new THREE.PerspectiveCamera(50, width / height, 1, 10000); - cameraPerspective.position.z = 900; - - // - - sceneModel = new THREE.Scene(); - sceneBG = new THREE.Scene(); - - // - - directionalLight = new THREE.DirectionalLight(0xffffff, 3); - directionalLight.position.set(0, -0.1, 1).normalize(); - sceneModel.add(directionalLight); - - const loader = new GLTFLoader(); - loader.load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - createMesh(gltf.scene.children[0].geometry, sceneModel, 100); - }); - - // - - const diffuseMap = new THREE.TextureLoader().load('textures/cube/SwedishRoyalCastle/pz.jpg'); - diffuseMap.colorSpace = THREE.SRGBColorSpace; - - const materialColor = new THREE.MeshBasicMaterial({ - map: diffuseMap, - depthTest: false, - }); - - quadBG = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), materialColor); - quadBG.position.z = -500; - quadBG.scale.set(width, height, 1); - sceneBG.add(quadBG); - - // - - const sceneMask = new THREE.Scene(); - - quadMask = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), new THREE.MeshBasicMaterial({ color: 0xffaa00 })); - quadMask.position.z = -300; - quadMask.scale.set(width / 2, height / 2, 1); - sceneMask.add(quadMask); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - - // - - container.appendChild(renderer.domElement); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - const shaderBleach = BleachBypassShader; - const shaderSepia = SepiaShader; - const shaderVignette = VignetteShader; - - const effectBleach = new ShaderPass(shaderBleach); - const effectSepia = new ShaderPass(shaderSepia); - const effectVignette = new ShaderPass(shaderVignette); - const gammaCorrection = new ShaderPass(GammaCorrectionShader); - - effectBleach.uniforms['opacity'].value = 0.95; - - effectSepia.uniforms['amount'].value = 0.9; - - effectVignette.uniforms['offset'].value = 1.6; - effectVignette.uniforms['darkness'].value = 0.95; - - const effectBloom = new BloomPass(0.5); - const effectFilm = new FilmPass(0.35); - const effectFilmBW = new FilmPass(0.35, true); - const effectDotScreen = new DotScreenPass(new THREE.Vector2(0, 0), 0.5, 0.8); - - const effectHBlur = new ShaderPass(HorizontalBlurShader); - const effectVBlur = new ShaderPass(VerticalBlurShader); - effectHBlur.uniforms['h'].value = 2 / (width / 2); - effectVBlur.uniforms['v'].value = 2 / (height / 2); - - const effectColorify1 = new ShaderPass(ColorifyShader); - const effectColorify2 = new ShaderPass(ColorifyShader); - effectColorify1.uniforms['color'] = new THREE.Uniform(new THREE.Color(1, 0.8, 0.8)); - effectColorify2.uniforms['color'] = new THREE.Uniform(new THREE.Color(1, 0.75, 0.5)); - - const clearMask = new ClearMaskPass(); - const renderMask = new MaskPass(sceneModel, cameraPerspective); - const renderMaskInverse = new MaskPass(sceneModel, cameraPerspective); - - renderMaskInverse.inverse = true; - - // - - const rtParameters = { - stencilBuffer: true, - }; - - const rtWidth = width / 2; - const rtHeight = height / 2; - - // - - const renderBackground = new RenderPass(sceneBG, cameraOrtho); - const renderModel = new RenderPass(sceneModel, cameraPerspective); - - renderModel.clear = false; - - composerScene = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth * 2, rtHeight * 2, rtParameters)); - - composerScene.addPass(renderBackground); - composerScene.addPass(renderModel); - composerScene.addPass(renderMaskInverse); - composerScene.addPass(effectHBlur); - composerScene.addPass(effectVBlur); - composerScene.addPass(clearMask); - - // - - renderScene = new TexturePass(composerScene.renderTarget2.texture); - - // - - composer1 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); - - composer1.addPass(renderScene); - composer1.addPass(gammaCorrection); - composer1.addPass(effectFilmBW); - composer1.addPass(effectVignette); - - // - - composer2 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); - - composer2.addPass(renderScene); - composer2.addPass(gammaCorrection); - composer2.addPass(effectDotScreen); - composer2.addPass(renderMask); - composer2.addPass(effectColorify1); - composer2.addPass(clearMask); - composer2.addPass(renderMaskInverse); - composer2.addPass(effectColorify2); - composer2.addPass(clearMask); - composer2.addPass(effectVignette); - - // - - composer3 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); - - composer3.addPass(renderScene); - composer3.addPass(gammaCorrection); - composer3.addPass(effectSepia); - composer3.addPass(effectFilm); - composer3.addPass(effectVignette); - - // - - composer4 = new EffectComposer(renderer, new THREE.WebGLRenderTarget(rtWidth, rtHeight, rtParameters)); - - composer4.addPass(renderScene); - composer4.addPass(gammaCorrection); - composer4.addPass(effectBloom); - composer4.addPass(effectFilm); - composer4.addPass(effectBleach); - composer4.addPass(effectVignette); - - renderScene.uniforms['tDiffuse'].value = composerScene.renderTarget2.texture; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - halfWidth = window.innerWidth / 2; - halfHeight = window.innerHeight / 2; - - cameraPerspective.aspect = window.innerWidth / window.innerHeight; - cameraPerspective.updateProjectionMatrix(); - - cameraOrtho.left = -halfWidth; - cameraOrtho.right = halfWidth; - cameraOrtho.top = halfHeight; - cameraOrtho.bottom = -halfHeight; - - cameraOrtho.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - composerScene.setSize(halfWidth * 2, halfHeight * 2); - - composer1.setSize(halfWidth, halfHeight); - composer2.setSize(halfWidth, halfHeight); - composer3.setSize(halfWidth, halfHeight); - composer4.setSize(halfWidth, halfHeight); - - renderScene.uniforms['tDiffuse'].value = composerScene.renderTarget2.texture; - - quadBG.scale.set(window.innerWidth, window.innerHeight, 1); - quadMask.scale.set(window.innerWidth / 2, window.innerHeight / 2, 1); -} - -function createMesh(geometry, scene, scale) { - const diffuseMap = new THREE.TextureLoader().load('models/gltf/LeePerrySmith/Map-COL.jpg'); - diffuseMap.colorSpace = THREE.SRGBColorSpace; - - const mat2 = new THREE.MeshPhongMaterial({ - color: 0xcbcbcb, - specular: 0x080808, - shininess: 20, - map: diffuseMap, - normalMap: new THREE.TextureLoader().load('models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg'), - normalScale: new THREE.Vector2(0.75, 0.75), - }); - - mesh = new THREE.Mesh(geometry, mat2); - mesh.position.set(0, -50, 0); - mesh.scale.set(scale, scale, scale); - - scene.add(mesh); -} - -// - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - const time = Date.now() * 0.0004; - - if (mesh) mesh.rotation.y = -time; - - renderer.setViewport(0, 0, halfWidth, halfHeight); - composerScene.render(delta); - - renderer.setViewport(0, 0, halfWidth, halfHeight); - composer1.render(delta); - - renderer.setViewport(halfWidth, 0, halfWidth, halfHeight); - composer2.render(delta); - - renderer.setViewport(0, halfHeight, halfWidth, halfHeight); - composer3.render(delta); - - renderer.setViewport(halfWidth, halfHeight, halfWidth, halfHeight); - composer4.render(delta); -} diff --git a/examples-testing/examples/webgl_postprocessing_afterimage.ts b/examples-testing/examples/webgl_postprocessing_afterimage.ts deleted file mode 100644 index 97353dcd2..000000000 --- a/examples-testing/examples/webgl_postprocessing_afterimage.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { AfterimagePass } from 'three/addons/postprocessing/AfterimagePass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, scene, renderer, composer; -let mesh; - -let afterimagePass; - -const params = { - enable: true, -}; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 400; - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x000000, 1, 1000); - - const geometry = new THREE.BoxGeometry(150, 150, 150, 2, 2, 2); - const material = new THREE.MeshNormalMaterial(); - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // postprocessing - - composer = new EffectComposer(renderer); - composer.addPass(new RenderPass(scene, camera)); - - afterimagePass = new AfterimagePass(); - composer.addPass(afterimagePass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI({ title: 'Damp setting' }); - gui.add(afterimagePass, 'damp', 0, 1).step(0.001); - gui.add(params, 'enable'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.rotation.x += 0.005; - mesh.rotation.y += 0.01; - - afterimagePass.enabled = params.enable; - - composer.render(); -} diff --git a/examples-testing/examples/webgl_postprocessing_backgrounds.ts b/examples-testing/examples/webgl_postprocessing_backgrounds.ts deleted file mode 100644 index 57a6a2dbd..000000000 --- a/examples-testing/examples/webgl_postprocessing_backgrounds.ts +++ /dev/null @@ -1,214 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; -import { CubeTexturePass } from 'three/addons/postprocessing/CubeTexturePass.js'; -import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let scene, renderer, composer; -let clearPass, texturePass, renderPass; -let cameraP, cubeTexturePassP; -let gui, stats; - -const params = { - clearPass: true, - clearColor: 'white', - clearAlpha: 1.0, - - texturePass: true, - texturePassOpacity: 1.0, - - cubeTexturePass: true, - cubeTexturePassOpacity: 1.0, - - renderPass: true, -}; - -init(); - -clearGui(); - -function clearGui() { - if (gui) gui.destroy(); - - gui = new GUI(); - - gui.add(params, 'clearPass'); - gui.add(params, 'clearColor', ['black', 'white', 'blue', 'green', 'red']); - gui.add(params, 'clearAlpha', 0, 1); - - gui.add(params, 'texturePass'); - gui.add(params, 'texturePassOpacity', 0, 1); - - gui.add(params, 'cubeTexturePass'); - gui.add(params, 'cubeTexturePassOpacity', 0, 1); - - gui.add(params, 'renderPass'); - - gui.open(); -} - -function init() { - const container = document.getElementById('container'); - - const width = window.innerWidth || 1; - const height = window.innerHeight || 1; - const aspect = width / height; - const devicePixelRatio = window.devicePixelRatio || 1; - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - cameraP = new THREE.PerspectiveCamera(65, aspect, 1, 10); - cameraP.position.z = 7; - - scene = new THREE.Scene(); - - const group = new THREE.Group(); - scene.add(group); - - const light = new THREE.PointLight(0xefffef, 500); - light.position.z = 10; - light.position.y = -10; - light.position.x = -10; - scene.add(light); - - const light2 = new THREE.PointLight(0xffefef, 500); - light2.position.z = 10; - light2.position.x = -10; - light2.position.y = 10; - scene.add(light2); - - const light3 = new THREE.PointLight(0xefefff, 500); - light3.position.z = 10; - light3.position.x = 10; - light3.position.y = -10; - scene.add(light3); - - const geometry = new THREE.SphereGeometry(1, 48, 24); - - const material = new THREE.MeshStandardMaterial(); - material.roughness = 0.5 * Math.random() + 0.25; - material.metalness = 0; - material.color.setHSL(Math.random(), 1.0, 0.3); - - const mesh = new THREE.Mesh(geometry, material); - group.add(mesh); - - // postprocessing - - const genCubeUrls = function (prefix, postfix) { - return [ - prefix + 'px' + postfix, - prefix + 'nx' + postfix, - prefix + 'py' + postfix, - prefix + 'ny' + postfix, - prefix + 'pz' + postfix, - prefix + 'nz' + postfix, - ]; - }; - - composer = new EffectComposer(renderer); - - clearPass = new ClearPass(params.clearColor, params.clearAlpha); - composer.addPass(clearPass); - - texturePass = new TexturePass(); - composer.addPass(texturePass); - - const textureLoader = new THREE.TextureLoader(); - textureLoader.load('textures/hardwood2_diffuse.jpg', function (map) { - map.colorSpace = THREE.SRGBColorSpace; - texturePass.map = map; - }); - - cubeTexturePassP = null; - - const ldrUrls = genCubeUrls('textures/cube/pisa/', '.png'); - new THREE.CubeTextureLoader().load(ldrUrls, function (ldrCubeMap) { - cubeTexturePassP = new CubeTexturePass(cameraP, ldrCubeMap); - composer.insertPass(cubeTexturePassP, 2); - }); - - renderPass = new RenderPass(scene, cameraP); - renderPass.clear = false; - composer.addPass(renderPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - const controls = new OrbitControls(cameraP, renderer.domElement); - controls.enableZoom = false; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - const aspect = width / height; - - cameraP.aspect = aspect; - cameraP.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - stats.begin(); - - cameraP.updateMatrixWorld(true); - - let newColor = clearPass.clearColor; - - switch (params.clearColor) { - case 'blue': - newColor = 0x0000ff; - break; - case 'red': - newColor = 0xff0000; - break; - case 'green': - newColor = 0x00ff00; - break; - case 'white': - newColor = 0xffffff; - break; - case 'black': - newColor = 0x000000; - break; - } - - clearPass.enabled = params.clearPass; - clearPass.clearColor = newColor; - clearPass.clearAlpha = params.clearAlpha; - - texturePass.enabled = params.texturePass; - texturePass.opacity = params.texturePassOpacity; - - if (cubeTexturePassP !== null) { - cubeTexturePassP.enabled = params.cubeTexturePass; - cubeTexturePassP.opacity = params.cubeTexturePassOpacity; - } - - renderPass.enabled = params.renderPass; - - composer.render(); - - stats.end(); -} diff --git a/examples-testing/examples/webgl_postprocessing_fxaa.ts b/examples-testing/examples/webgl_postprocessing_fxaa.ts deleted file mode 100644 index c5e632ad7..000000000 --- a/examples-testing/examples/webgl_postprocessing_fxaa.ts +++ /dev/null @@ -1,122 +0,0 @@ -import * as THREE from 'three'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; -import { FXAAPass } from 'three/addons/postprocessing/FXAAPass.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, controls, container; - -let composer1, composer2, fxaaPass; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, container.offsetWidth / container.offsetHeight, 1, 2000); - camera.position.z = 500; - - scene = new THREE.Scene(); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d); - hemiLight.position.set(0, 1000, 0); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(-3000, 1000, -1000); - scene.add(dirLight); - - // - - const geometry = new THREE.TetrahedronGeometry(10); - const material = new THREE.MeshStandardMaterial({ color: 0xf73232, flatShading: true }); - - const mesh = new THREE.InstancedMesh(geometry, material, 100); - const dummy = new THREE.Object3D(); - - for (let i = 0; i < 100; i++) { - dummy.position.x = Math.random() * 500 - 250; - dummy.position.y = Math.random() * 500 - 250; - dummy.position.z = Math.random() * 500 - 250; - - dummy.scale.setScalar(Math.random() * 2 + 1); - - dummy.rotation.x = Math.random() * Math.PI; - dummy.rotation.y = Math.random() * Math.PI; - dummy.rotation.z = Math.random() * Math.PI; - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - } - - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(container.offsetWidth, container.offsetHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - container.appendChild(renderer.domElement); - - // - - const renderPass = new RenderPass(scene, camera); - renderPass.clearAlpha = 0; - - // - - fxaaPass = new FXAAPass(); - - const outputPass = new OutputPass(); - - composer1 = new EffectComposer(renderer); - composer1.addPass(renderPass); - composer1.addPass(outputPass); - - // - - composer2 = new EffectComposer(renderer); - composer2.addPass(renderPass); - composer2.addPass(outputPass); - - // FXAA is engineered to be applied towards the end of engine post processing after conversion to low dynamic range and conversion to the sRGB color space for display. - - composer2.addPass(fxaaPass); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = container.offsetWidth / container.offsetHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(container.offsetWidth, container.offsetHeight); - composer1.setSize(container.offsetWidth, container.offsetHeight); - composer2.setSize(container.offsetWidth, container.offsetHeight); -} - -function animate() { - const halfWidth = container.offsetWidth / 2; - - controls.update(); - - renderer.setScissorTest(true); - - renderer.setScissor(0, 0, halfWidth - 1, container.offsetHeight); - composer1.render(); - - renderer.setScissor(halfWidth, 0, halfWidth, container.offsetHeight); - composer2.render(); - - renderer.setScissorTest(false); -} diff --git a/examples-testing/examples/webgl_postprocessing_glitch.ts b/examples-testing/examples/webgl_postprocessing_glitch.ts deleted file mode 100644 index 02acda572..000000000 --- a/examples-testing/examples/webgl_postprocessing_glitch.ts +++ /dev/null @@ -1,108 +0,0 @@ -import * as THREE from 'three'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { GlitchPass } from 'three/addons/postprocessing/GlitchPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, scene, renderer, composer; -let object, light; - -let glitchPass; - -const button = document.querySelector('#startButton'); -button.addEventListener('click', function () { - const overlay = document.getElementById('overlay'); - overlay.remove(); - - init(); -}); - -function updateOptions() { - const wildGlitch = document.getElementById('wildGlitch'); - glitchPass.goWild = wildGlitch.checked; -} - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 400; - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x000000, 1, 1000); - - object = new THREE.Object3D(); - scene.add(object); - - const geometry = new THREE.SphereGeometry(1, 4, 4); - const material = new THREE.MeshPhongMaterial({ flatShading: true }); - - const mesh = new THREE.InstancedMesh(geometry, material, 100); - const dummy = new THREE.Object3D(); - const color = new THREE.Color(); - - for (let i = 0; i < 100; i++) { - dummy.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); - dummy.position.multiplyScalar(Math.random() * 400); - dummy.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); - - const scale = Math.random() * 50; - dummy.scale.set(scale, scale, scale); - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - - color.setHex(0xffffff * Math.random()); - mesh.setColorAt(i, color); - } - - object.add(mesh); - - scene.add(new THREE.AmbientLight(0xcccccc)); - - light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1); - scene.add(light); - - // postprocessing - - composer = new EffectComposer(renderer); - composer.addPass(new RenderPass(scene, camera)); - - glitchPass = new GlitchPass(); - composer.addPass(glitchPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - // - - window.addEventListener('resize', onWindowResize); - - const wildGlitchOption = document.getElementById('wildGlitch'); - wildGlitchOption.addEventListener('change', updateOptions); - - updateOptions(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - object.rotation.x += 0.005; - object.rotation.y += 0.01; - - composer.render(); -} diff --git a/examples-testing/examples/webgl_postprocessing_godrays.ts b/examples-testing/examples/webgl_postprocessing_godrays.ts deleted file mode 100644 index b7c2c6661..000000000 --- a/examples-testing/examples/webgl_postprocessing_godrays.ts +++ /dev/null @@ -1,176 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { EffectComposer, RenderPass } from 'postprocessing'; -import { GodraysPass } from 'goodrays'; - -let camera, scene, renderer, composer; -let controls, stats; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(-175, 50, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - // asset - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/godrays_demo.glb'); - scene.add(gltf.scene); - - const pillars = gltf.scene.getObjectByName('concrete'); - pillars.material = new THREE.MeshStandardMaterial({ - color: 0x333333, - }); - - const base = gltf.scene.getObjectByName('base'); - base.material = new THREE.MeshStandardMaterial({ - color: 0x333333, - side: THREE.DoubleSide, - }); - - setupBackdrop(); - - // lights - - const lightPos = new THREE.Vector3(0, 50, 0); - const lightSphereMaterial = new THREE.MeshBasicMaterial({ - color: 0xffffff, - }); - const lightSphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 16, 16), lightSphereMaterial); - lightSphere.position.copy(lightPos); - scene.add(lightSphere); - - scene.add(new THREE.AmbientLight(0xcccccc, 0.4)); - - const pointLight = new THREE.PointLight(0xf6287d, 10000); - pointLight.castShadow = true; - pointLight.shadow.bias = -0.001; - pointLight.shadow.mapSize.width = 1024; - pointLight.shadow.mapSize.height = 1024; - pointLight.position.copy(lightPos); - scene.add(pointLight); - - // shadow setup - - scene.traverse(obj => { - if (obj.isMesh === true) { - obj.castShadow = true; - obj.receiveShadow = true; - } - }); - - lightSphere.castShadow = false; - lightSphere.receiveShadow = false; - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // - - composer = new EffectComposer(renderer, { frameBufferType: THREE.HalfFloatType }); - - const renderPass = new RenderPass(scene, camera); - composer.addPass(renderPass); - - const params = { - density: 1 / 128, - maxDensity: 0.5, - edgeStrength: 2, - edgeRadius: 2, - distanceAttenuation: 2, - color: new THREE.Color(0xf6287d), - raymarchSteps: 60, - blur: true, - gammaCorrection: true, - }; - - const godraysPass = new GodraysPass(pointLight, camera, params); - godraysPass.renderToScreen = true; - composer.addPass(godraysPass); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.5, 0); - controls.enableDamping = true; - controls.maxDistance = 200; - controls.update(); - - // - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function setupBackdrop() { - const backdropDistance = 200; - // Add backdrop walls `backdropDistance` units away from the origin - const backdropGeometry = new THREE.PlaneGeometry(400, 200); - const backdropMaterial = new THREE.MeshBasicMaterial({ - color: 0x200808, - side: THREE.DoubleSide, - }); - const backdropLeft = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropLeft.position.set(-backdropDistance, 100, 0); - backdropLeft.rotateY(Math.PI / 2); - scene.add(backdropLeft); - - const backdropRight = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropRight.position.set(backdropDistance, 100, 0); - backdropRight.rotateY(Math.PI / 2); - scene.add(backdropRight); - - const backdropFront = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropFront.position.set(0, 100, -backdropDistance); - scene.add(backdropFront); - - const backdropBack = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropBack.position.set(0, 100, backdropDistance); - scene.add(backdropBack); - - const backdropTop = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropTop.position.set(0, 200, 0); - backdropTop.rotateX(Math.PI / 2); - backdropTop.scale.set(3, 6, 1); - scene.add(backdropTop); -} - -function animate() { - controls.update(); - - stats.begin(); - - composer.render(); - - //renderer.render( scene, camera ); - - stats.end(); -} diff --git a/examples-testing/examples/webgl_postprocessing_gtao.ts b/examples-testing/examples/webgl_postprocessing_gtao.ts deleted file mode 100644 index 7c39b8364..000000000 --- a/examples-testing/examples/webgl_postprocessing_gtao.ts +++ /dev/null @@ -1,216 +0,0 @@ -import * as THREE from 'three'; -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { GTAOPass } from 'three/addons/postprocessing/GTAOPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, scene, renderer, composer, controls, timer, stats, mixer; - -init(); - -function init() { - const dracoLoader = new DRACOLoader(); - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - loader.setPath('models/gltf/'); - - timer = new THREE.Timer(); - timer.connect(document); - const container = document.createElement('div'); - document.body.appendChild(container); - - stats = new Stats(); - container.appendChild(stats.dom); - - renderer = new THREE.WebGLRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfe3dd); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); - camera.position.set(5, 2, 8); - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.5, 0); - controls.update(); - controls.enablePan = false; - controls.enableDamping = true; - - const width = window.innerWidth; - const height = window.innerHeight; - - composer = new EffectComposer(renderer); - - const renderPass = new RenderPass(scene, camera); - composer.addPass(renderPass); - - const gtaoPass = new GTAOPass(scene, camera, width, height); - gtaoPass.output = GTAOPass.OUTPUT.Denoise; - composer.addPass(gtaoPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - // - - loader.load( - 'LittlestTokyo.glb', - gltf => { - const model = gltf.scene; - model.position.set(1, 1, 0); - model.scale.set(0.01, 0.01, 0.01); - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - mixer.clipAction(gltf.animations[0]).play(); - - const box = new THREE.Box3().setFromObject(scene); - gtaoPass.setSceneClipBox(box); - }, - undefined, - e => console.error(e), - ); - - // Init gui - const gui = new GUI(); - - gui.add(gtaoPass, 'output', { - Default: GTAOPass.OUTPUT.Default, - Diffuse: GTAOPass.OUTPUT.Diffuse, - 'AO Only': GTAOPass.OUTPUT.AO, - 'AO Only + Denoise': GTAOPass.OUTPUT.Denoise, - Depth: GTAOPass.OUTPUT.Depth, - Normal: GTAOPass.OUTPUT.Normal, - }).onChange(function (value) { - gtaoPass.output = value; - }); - - const aoParameters = { - radius: 0.25, - distanceExponent: 1, - thickness: 1, - scale: 1, - samples: 16, - distanceFallOff: 1, - screenSpaceRadius: false, - }; - const pdParameters = { - lumaPhi: 10, - depthPhi: 2, - normalPhi: 3, - radius: 4, - radiusExponent: 1, - rings: 2, - samples: 16, - }; - gtaoPass.updateGtaoMaterial(aoParameters); - gtaoPass.updatePdMaterial(pdParameters); - gui.add(gtaoPass, 'blendIntensity').min(0).max(1).step(0.01); - gui.add(aoParameters, 'radius') - .min(0.01) - .max(1) - .step(0.01) - .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); - gui.add(aoParameters, 'distanceExponent') - .min(1) - .max(4) - .step(0.01) - .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); - gui.add(aoParameters, 'thickness') - .min(0.01) - .max(10) - .step(0.01) - .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); - gui.add(aoParameters, 'distanceFallOff') - .min(0) - .max(1) - .step(0.01) - .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); - gui.add(aoParameters, 'scale') - .min(0.01) - .max(2.0) - .step(0.01) - .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); - gui.add(aoParameters, 'samples') - .min(2) - .max(32) - .step(1) - .onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); - gui.add(aoParameters, 'screenSpaceRadius').onChange(() => gtaoPass.updateGtaoMaterial(aoParameters)); - gui.add(pdParameters, 'lumaPhi') - .min(0) - .max(20) - .step(0.01) - .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); - gui.add(pdParameters, 'depthPhi') - .min(0.01) - .max(20) - .step(0.01) - .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); - gui.add(pdParameters, 'normalPhi') - .min(0.01) - .max(20) - .step(0.01) - .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); - gui.add(pdParameters, 'radius') - .min(0) - .max(32) - .step(1) - .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); - gui.add(pdParameters, 'radiusExponent') - .min(0.1) - .max(4) - .step(0.1) - .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); - gui.add(pdParameters, 'rings') - .min(1) - .max(16) - .step(0.125) - .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); - gui.add(pdParameters, 'samples') - .min(2) - .max(32) - .step(1) - .onChange(() => gtaoPass.updatePdMaterial(pdParameters)); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) { - mixer.update(delta); - } - - controls.update(); - - stats.begin(); - composer.render(); - stats.end(); -} diff --git a/examples-testing/examples/webgl_postprocessing_masking.ts b/examples-testing/examples/webgl_postprocessing_masking.ts deleted file mode 100644 index a4d09866d..000000000 --- a/examples-testing/examples/webgl_postprocessing_masking.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as THREE from 'three'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; -import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; -import { MaskPass, ClearMaskPass } from 'three/addons/postprocessing/MaskPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, composer, renderer; -let box, torus; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 10; - - const scene1 = new THREE.Scene(); - const scene2 = new THREE.Scene(); - - box = new THREE.Mesh(new THREE.BoxGeometry(4, 4, 4)); - scene1.add(box); - - torus = new THREE.Mesh(new THREE.TorusGeometry(3, 1, 16, 32)); - scene2.add(torus); - - renderer = new THREE.WebGLRenderer(); - renderer.setClearColor(0xe0e0e0); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - document.body.appendChild(renderer.domElement); - - // - - const clearPass = new ClearPass(); - - const clearMaskPass = new ClearMaskPass(); - - const maskPass1 = new MaskPass(scene1, camera); - const maskPass2 = new MaskPass(scene2, camera); - - const texture1 = new THREE.TextureLoader().load('textures/758px-Canestra_di_frutta_(Caravaggio).jpg'); - texture1.colorSpace = THREE.SRGBColorSpace; - texture1.minFilter = THREE.LinearFilter; - texture1.generateMipmaps = false; - const texture2 = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); - texture2.colorSpace = THREE.SRGBColorSpace; - - const texturePass1 = new TexturePass(texture1); - const texturePass2 = new TexturePass(texture2); - - const outputPass = new OutputPass(); - - const parameters = { - stencilBuffer: true, - }; - - const renderTarget = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, parameters); - - composer = new EffectComposer(renderer, renderTarget); - composer.addPass(clearPass); - composer.addPass(maskPass1); - composer.addPass(texturePass1); - composer.addPass(clearMaskPass); - composer.addPass(maskPass2); - composer.addPass(texturePass2); - composer.addPass(clearMaskPass); - composer.addPass(outputPass); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - const time = performance.now() * 0.001 + 6000; - - box.position.x = Math.cos(time / 1.5) * 2; - box.position.y = Math.sin(time) * 2; - box.rotation.x = time; - box.rotation.y = time / 2; - - torus.position.x = Math.cos(time) * 2; - torus.position.y = Math.sin(time / 1.5) * 2; - torus.rotation.x = time; - torus.rotation.y = time / 2; - - renderer.clear(); - composer.render(time); -} diff --git a/examples-testing/examples/webgl_postprocessing_outline.ts b/examples-testing/examples/webgl_postprocessing_outline.ts deleted file mode 100644 index f25d2d0d6..000000000 --- a/examples-testing/examples/webgl_postprocessing_outline.ts +++ /dev/null @@ -1,273 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; -import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; -import { FXAAShader } from 'three/addons/shaders/FXAAShader.js'; - -let container, stats; -let camera, scene, renderer, controls; -let composer, effectFXAA, outlinePass; - -let selectedObjects = []; - -const raycaster = new THREE.Raycaster(); -const mouse = new THREE.Vector2(); - -const obj3d = new THREE.Object3D(); -const group = new THREE.Group(); - -const params = { - edgeStrength: 3.0, - edgeGlow: 0.0, - edgeThickness: 1.0, - pulsePeriod: 0, - rotate: false, - usePatternTexture: false, -}; - -// Init gui - -const gui = new GUI({ width: 280 }); - -gui.add(params, 'edgeStrength', 0.01, 10).onChange(function (value) { - outlinePass.edgeStrength = Number(value); -}); - -gui.add(params, 'edgeGlow', 0.0, 1).onChange(function (value) { - outlinePass.edgeGlow = Number(value); -}); - -gui.add(params, 'edgeThickness', 1, 4).onChange(function (value) { - outlinePass.edgeThickness = Number(value); -}); - -gui.add(params, 'pulsePeriod', 0.0, 5).onChange(function (value) { - outlinePass.pulsePeriod = Number(value); -}); - -gui.add(params, 'rotate'); - -gui.add(params, 'usePatternTexture').onChange(function (value) { - outlinePass.usePatternTexture = value; -}); - -function Configuration() { - this.visibleEdgeColor = '#ffffff'; - this.hiddenEdgeColor = '#190a05'; -} - -const conf = new Configuration(); - -gui.addColor(conf, 'visibleEdgeColor').onChange(function (value) { - outlinePass.visibleEdgeColor.set(value); -}); - -gui.addColor(conf, 'hiddenEdgeColor').onChange(function (value) { - outlinePass.hiddenEdgeColor.set(value); -}); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - const width = window.innerWidth; - const height = window.innerHeight; - - renderer = new THREE.WebGLRenderer(); - renderer.shadowMap.enabled = true; - // todo - support pixelRatio in this demo - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100); - camera.position.set(0, 0, 8); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 5; - controls.maxDistance = 20; - controls.enablePan = false; - controls.enableDamping = true; - controls.dampingFactor = 0.05; - - // - - scene.add(new THREE.AmbientLight(0xaaaaaa, 0.6)); - - const light = new THREE.SunLight(0xddffdd, 2); - light.position.set(5, 5, 5); - light.castShadow = true; - light.shadow.camera.far = 40; - light.shadow.mapSize.setScalar(2048); - scene.add(light); - - // model - - const loader = new OBJLoader(); - loader.load('models/obj/tree.obj', function (object) { - let scale = 1.0; - - object.traverse(function (child) { - if (child instanceof THREE.Mesh) { - child.geometry.center(); - child.geometry.computeBoundingSphere(); - scale = 0.2 * child.geometry.boundingSphere.radius; - - const phongMaterial = new THREE.MeshPhongMaterial({ - color: 0xffffff, - specular: 0x111111, - shininess: 5, - }); - child.material = phongMaterial; - child.receiveShadow = true; - child.castShadow = true; - } - }); - - object.position.y = 1; - object.scale.divideScalar(scale); - obj3d.add(object); - }); - - scene.add(group); - - group.add(obj3d); - - // - - const geometry = new THREE.SphereGeometry(3, 48, 24); - - for (let i = 0; i < 20; i++) { - const material = new THREE.MeshLambertMaterial(); - material.color.setHSL(Math.random(), 1.0, 0.3); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = Math.random() * 4 - 2; - mesh.position.y = Math.random() * 4 - 2; - mesh.position.z = Math.random() * 4 - 2; - mesh.receiveShadow = true; - mesh.castShadow = true; - mesh.scale.multiplyScalar(Math.random() * 0.3 + 0.1); - group.add(mesh); - } - - const floorMaterial = new THREE.MeshLambertMaterial({ side: THREE.DoubleSide }); - - const floorGeometry = new THREE.PlaneGeometry(12, 12); - const floorMesh = new THREE.Mesh(floorGeometry, floorMaterial); - floorMesh.rotation.x -= Math.PI * 0.5; - floorMesh.position.y -= 1.5; - group.add(floorMesh); - floorMesh.receiveShadow = true; - - const torusGeometry = new THREE.TorusGeometry(1, 0.3, 16, 100); - const torusMaterial = new THREE.MeshPhongMaterial({ color: 0xffaaff }); - const torus = new THREE.Mesh(torusGeometry, torusMaterial); - torus.position.z = -4; - group.add(torus); - torus.receiveShadow = true; - torus.castShadow = true; - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // postprocessing - - composer = new EffectComposer(renderer); - - const renderPass = new RenderPass(scene, camera); - composer.addPass(renderPass); - - outlinePass = new OutlinePass(new THREE.Vector2(window.innerWidth, window.innerHeight), scene, camera); - composer.addPass(outlinePass); - - const textureLoader = new THREE.TextureLoader(); - textureLoader.load('textures/tri_pattern.jpg', function (texture) { - outlinePass.patternTexture = texture; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - }); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - effectFXAA = new ShaderPass(FXAAShader); - effectFXAA.uniforms['resolution'].value.set(1 / window.innerWidth, 1 / window.innerHeight); - composer.addPass(effectFXAA); - - window.addEventListener('resize', onWindowResize); - - renderer.domElement.style.touchAction = 'none'; - renderer.domElement.addEventListener('pointermove', onPointerMove); - - function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; - - checkIntersection(); - } - - function addSelectedObject(object) { - selectedObjects = []; - selectedObjects.push(object); - } - - function checkIntersection() { - raycaster.setFromCamera(mouse, camera); - - const intersects = raycaster.intersectObject(scene, true); - - if (intersects.length > 0) { - const selectedObject = intersects[0].object; - addSelectedObject(selectedObject); - outlinePass.selectedObjects = selectedObjects; - } else { - // outlinePass.selectedObjects = []; - } - } -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); - - effectFXAA.uniforms['resolution'].value.set(1 / window.innerWidth, 1 / window.innerHeight); -} - -function animate() { - stats.begin(); - - const timer = performance.now(); - - if (params.rotate) { - group.rotation.y = timer * 0.0001; - } - - controls.update(); - - composer.render(); - - stats.end(); -} diff --git a/examples-testing/examples/webgl_postprocessing_pixel.ts b/examples-testing/examples/webgl_postprocessing_pixel.ts deleted file mode 100644 index ca13ac6a2..000000000 --- a/examples-testing/examples/webgl_postprocessing_pixel.ts +++ /dev/null @@ -1,363 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, composer, controls, crystalMesh, timer; -let gui, params; - -init(); - -function init() { - const aspectRatio = window.innerWidth / window.innerHeight; - - camera = new THREE.OrthographicCamera(-aspectRatio, aspectRatio, 1, -1, 0.1, 10); - camera.position.y = 2 * Math.tan(Math.PI / 6); - camera.position.z = 2; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x151729); - - timer = new THREE.Timer(); - timer.connect(document); - - renderer = new THREE.WebGLRenderer(); - renderer.shadowMap.enabled = true; - //renderer.setPixelRatio( window.devicePixelRatio ); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - composer = new EffectComposer(renderer); - const renderPixelatedPass = new RenderPixelatedPass(6, scene, camera); - composer.addPass(renderPixelatedPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - window.addEventListener('resize', onWindowResize); - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxZoom = 2; - - // gui - - gui = new GUI(); - params = { - pixelSize: 6, - normalEdgeStrength: 0.3, - depthEdgeStrength: 0.4, - snapping: true, - pixelAlignedPanning: true, - pixelAlignedObjects: true, - rotationSnap: 15, - cameraRotationSnap: 9, - cameraZoomSnap: 0.1, - }; - gui.add(params, 'pixelSize') - .min(1) - .max(16) - .step(1) - .onChange(() => { - renderPixelatedPass.setPixelSize(params.pixelSize); - }); - gui.add(renderPixelatedPass, 'normalEdgeStrength').min(0).max(2).step(0.05); - gui.add(renderPixelatedPass, 'depthEdgeStrength').min(0).max(1).step(0.05); - - const snappingControl = gui.add(params, 'snapping').name('Enable Pixel Snapping'); - const snappingFolder = gui.addFolder('Snapping').close(); - snappingControl.onChange(enabled => snappingFolder.controllers.forEach(c => c.enable(enabled))); - snappingFolder.add(params, 'pixelAlignedPanning'); - snappingFolder.add(params, 'pixelAlignedObjects'); - snappingFolder.add(params, 'rotationSnap').min(0).max(90).step(1).name('rotationSnap (deg, 0 = off)'); - snappingFolder.add(params, 'cameraRotationSnap').min(0).max(90).step(1).name('cameraRotationSnap (deg, 0 = off)'); - snappingFolder.add(params, 'cameraZoomSnap').min(0).max(1).step(0.05).name('cameraZoomSnap (0 = off)'); - - // textures - - const loader = new THREE.TextureLoader(); - const texChecker = pixelTexture(loader.load('textures/checker.png')); - const texChecker2 = pixelTexture(loader.load('textures/checker.png')); - texChecker.repeat.set(3, 3); - texChecker2.repeat.set(1.5, 1.5); - - // meshes - - const boxMaterial = new THREE.MeshPhongMaterial({ map: texChecker2 }); - - function addBox(boxSideLength, x, z, rotation) { - const mesh = new THREE.Mesh(new THREE.BoxGeometry(boxSideLength, boxSideLength, boxSideLength), boxMaterial); - mesh.castShadow = true; - mesh.receiveShadow = true; - mesh.rotation.y = rotation; - mesh.position.y = boxSideLength / 2; - mesh.position.set(x, boxSideLength / 2 + 0.0001, z); - scene.add(mesh); - return mesh; - } - - addBox(0.4, 0, 0, Math.PI / 4); - addBox(0.5, -0.5, -0.5, Math.PI / 4); - - const planeSideLength = 2; - const planeMesh = new THREE.Mesh( - new THREE.PlaneGeometry(planeSideLength, planeSideLength), - new THREE.MeshPhongMaterial({ map: texChecker }), - ); - planeMesh.receiveShadow = true; - planeMesh.rotation.x = -Math.PI / 2; - scene.add(planeMesh); - - const radius = 0.2; - const geometry = new THREE.IcosahedronGeometry(radius); - crystalMesh = new THREE.Mesh( - geometry, - new THREE.MeshPhongMaterial({ - color: 0x68b7e9, - emissive: 0x4f7e8b, - shininess: 10, - specular: 0xffffff, - }), - ); - crystalMesh.receiveShadow = true; - crystalMesh.castShadow = true; - scene.add(crystalMesh); - - // lights - - scene.add(new THREE.AmbientLight(0x757f8e, 3)); - - const directionalLight = new THREE.DirectionalLight(0xfffecd, 1.5); - directionalLight.position.set(100, 100, 100); - directionalLight.castShadow = true; - directionalLight.shadow.mapSize.set(2048, 2048); - scene.add(directionalLight); - - const spotLight = new THREE.SpotLight(0xffc100, 10, 10, Math.PI / 16, 0.02, 2); - spotLight.position.set(2, 2, 0); - const target = spotLight.target; - scene.add(target); - target.position.set(0, 0, 0); - spotLight.castShadow = true; - scene.add(spotLight); -} - -function onWindowResize() { - const aspectRatio = window.innerWidth / window.innerHeight; - camera.left = -aspectRatio; - camera.right = aspectRatio; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const t = timer.getElapsed(); - - // Quantize the pulsing glow to a few discrete brightness levels to match the pixelated aesthetic - const brightnessLevels = 6; - crystalMesh.material.emissiveIntensity = - Math.round((Math.sin(t * 3) * 0.5 + 0.5) * (brightnessLevels - 1)) / (brightnessLevels - 1); - crystalMesh.position.y = 0.7 + Math.sin(t * 2) * 0.05; - crystalMesh.rotation.y = stopGoEased(t, 6, 8) * 2 * Math.PI; - - const rendererSize = renderer.getSize(new THREE.Vector2()); - const aspectRatio = rendererSize.x / rendererSize.y; - const pixelsPerScreenWidth = Math.floor(rendererSize.x / params['pixelSize']); - const pixelsPerScreenHeight = Math.floor(rendererSize.y / params['pixelSize']); - - // The top-level 'snapping' checkbox gates every individual snapping effect at once - const snapping = params['snapping']; - - // Remember the camera's true (unsnapped) transform so OrbitControls interaction is unaffected by snapping - const cameraPosition = camera.position.clone(); - const cameraQuaternion = camera.quaternion.clone(); - const cameraZoom = camera.zoom; - - // Snap the camera's rotation and scale first, so the translation snap below derives its pixel grid - // and screen-space basis from the already-snapped orientation and zoom - if (snapping && (params['cameraRotationSnap'] > 0 || params['cameraZoomSnap'] > 0)) { - pixelAlignCamera(camera, controls.target, params['cameraRotationSnap'], params['cameraZoomSnap']); - } - - if (snapping && params['pixelAlignedPanning']) { - pixelAlignFrustum(camera, aspectRatio, pixelsPerScreenWidth, pixelsPerScreenHeight); - } else if (camera.left != -aspectRatio || camera.top != 1.0) { - // Reset the Camera Frustum if it has been modified - camera.left = -aspectRatio; - camera.right = aspectRatio; - camera.top = 1.0; - camera.bottom = -1.0; - camera.updateProjectionMatrix(); - } - - // Remember the crystal's true (unsnapped) transform so its bulk movement is unaffected by snapping. - // We snapshot the euler rotation (not the quaternion) because that's what drives the spin: restoring - // the quaternion would let three.js re-derive a gimbal-equivalent euler and corrupt the y rotation. - const crystalPosition = crystalMesh.position.clone(); - const crystalRotation = crystalMesh.rotation.clone(); - - if (snapping && params['pixelAlignedObjects']) { - // Snap the moving objects to the screen-space pixel grid so they don't shimmer when pixelated - const worldScreenWidth = (camera.right - camera.left) / camera.zoom; - const worldScreenHeight = (camera.top - camera.bottom) / camera.zoom; - pixelAlignObject( - crystalMesh, - camera, - worldScreenWidth / pixelsPerScreenWidth, - worldScreenHeight / pixelsPerScreenHeight, - ); - } - - if (snapping && params['rotationSnap'] > 0) { - // Snap the moving objects' rotation to the nearest camera-relative euler increment - snapObjectRotation(crystalMesh, camera, params['rotationSnap']); - } - - composer.render(); - - // Restore the true transforms after rendering so the next frame's motion builds on the real trajectory - crystalMesh.position.copy(crystalPosition); - crystalMesh.rotation.copy(crystalRotation); - camera.position.copy(cameraPosition); - camera.quaternion.copy(cameraQuaternion); - camera.zoom = cameraZoom; - camera.updateProjectionMatrix(); -} - -// Helper functions - -function pixelTexture(texture) { - texture.minFilter = THREE.NearestFilter; - texture.magFilter = THREE.NearestFilter; - texture.generateMipmaps = false; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.colorSpace = THREE.SRGBColorSpace; - return texture; -} - -function easeInOutCubic(x) { - return x ** 2 * 3 - x ** 3 * 2; -} - -function linearStep(x, edge0, edge1) { - const w = edge1 - edge0; - const m = 1 / w; - const y0 = -m * edge0; - return THREE.MathUtils.clamp(y0 + m * x, 0, 1); -} - -function stopGoEased(x, downtime, period) { - const cycle = (x / period) | 0; - const tween = x - cycle * period; - const linStep = easeInOutCubic(linearStep(tween, downtime, period)); - return cycle + linStep; -} - -function pixelAlignCamera(camera, target, rotationIncrementDegrees, zoomIncrement) { - // Snap the camera's orbit to the nearest increment of azimuth/polar angle around the target. Working - // in spherical coordinates (rather than snapping the euler angles) keeps the orbit translation locked - // onto the target and guarantees a roll-free orientation, since we re-aim with lookAt and world up. - if (rotationIncrementDegrees > 0) { - const increment = THREE.MathUtils.degToRad(rotationIncrementDegrees); - const offset = new THREE.Vector3().subVectors(camera.position, target); - const spherical = new THREE.Spherical().setFromVector3(offset); - spherical.theta = Math.round(spherical.theta / increment) * increment; - spherical.phi = Math.round(spherical.phi / increment) * increment; - spherical.makeSafe(); - offset.setFromSpherical(spherical); - camera.position.copy(target).add(offset); - camera.up.set(0.0, 1.0, 0.0); - camera.lookAt(target); - } - - // Snap the camera's zoom to the nearest increment so the pixel grid stays a stable size while scaling - if (zoomIncrement > 0) { - camera.zoom = Math.max(zoomIncrement, Math.round(camera.zoom / zoomIncrement) * zoomIncrement); - camera.updateProjectionMatrix(); - } -} - -function pixelAlignFrustum(camera, aspectRatio, pixelsPerScreenWidth, pixelsPerScreenHeight) { - // 0. Get Pixel Grid Units - const worldScreenWidth = (camera.right - camera.left) / camera.zoom; - const worldScreenHeight = (camera.top - camera.bottom) / camera.zoom; - const pixelWidth = worldScreenWidth / pixelsPerScreenWidth; - const pixelHeight = worldScreenHeight / pixelsPerScreenHeight; - - // 1. Project the current camera position along its local rotation bases - const camPos = new THREE.Vector3(); - camera.getWorldPosition(camPos); - const camRot = new THREE.Quaternion(); - camera.getWorldQuaternion(camRot); - const camRight = new THREE.Vector3(1.0, 0.0, 0.0).applyQuaternion(camRot); - const camUp = new THREE.Vector3(0.0, 1.0, 0.0).applyQuaternion(camRot); - const camPosRight = camPos.dot(camRight); - const camPosUp = camPos.dot(camUp); - - // 2. Find how far along its position is along these bases in pixel units - const camPosRightPx = camPosRight / pixelWidth; - const camPosUpPx = camPosUp / pixelHeight; - - // 3. Find the fractional pixel units and convert to world units - const fractX = camPosRightPx - Math.round(camPosRightPx); - const fractY = camPosUpPx - Math.round(camPosUpPx); - - // 4. Add fractional world units to the left/right top/bottom to align with the pixel grid - camera.left = -aspectRatio - fractX * pixelWidth; - camera.right = aspectRatio - fractX * pixelWidth; - camera.top = 1.0 - fractY * pixelHeight; - camera.bottom = -1.0 - fractY * pixelHeight; - camera.updateProjectionMatrix(); -} - -function pixelAlignObject(object, camera, pixelWidth, pixelHeight) { - // 1. Build the camera's orthonormal screen-space basis - const camRot = new THREE.Quaternion(); - camera.getWorldQuaternion(camRot); - const camRight = new THREE.Vector3(1.0, 0.0, 0.0).applyQuaternion(camRot); - const camUp = new THREE.Vector3(0.0, 1.0, 0.0).applyQuaternion(camRot); - const camForward = new THREE.Vector3(0.0, 0.0, -1.0).applyQuaternion(camRot); - - // 2. Decompose the object's world position onto that basis - const pos = object.position; - const posRight = pos.dot(camRight); - const posUp = pos.dot(camUp); - const posForward = pos.dot(camForward); - - // 3. Snap the screen-space (right/up) components to the pixel grid, leaving depth untouched - const snappedRight = Math.round(posRight / pixelWidth) * pixelWidth; - const snappedUp = Math.round(posUp / pixelHeight) * pixelHeight; - - // 4. Recompose the world position from the snapped basis components - pos.set(0, 0, 0); - pos.addScaledVector(camRight, snappedRight); - pos.addScaledVector(camUp, snappedUp); - pos.addScaledVector(camForward, posForward); -} - -function snapObjectRotation(object, camera, incrementDegrees) { - const increment = THREE.MathUtils.degToRad(incrementDegrees); - - // 1. Express the object's rotation relative to the camera - const camRot = new THREE.Quaternion(); - camera.getWorldQuaternion(camRot); - const relative = camRot.clone().invert().multiply(object.quaternion); - - // 2. Snap each euler axis (in camera space) to the nearest increment - const euler = new THREE.Euler().setFromQuaternion(relative); - euler.x = Math.round(euler.x / increment) * increment; - euler.y = Math.round(euler.y / increment) * increment; - euler.z = Math.round(euler.z / increment) * increment; - - // 3. Convert back to a world-space rotation - relative.setFromEuler(euler); - object.quaternion.copy(camRot.multiply(relative)); -} diff --git a/examples-testing/examples/webgl_postprocessing_procedural.ts b/examples-testing/examples/webgl_postprocessing_procedural.ts deleted file mode 100644 index 869824270..000000000 --- a/examples-testing/examples/webgl_postprocessing_procedural.ts +++ /dev/null @@ -1,77 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let postCamera, postScene, renderer; -let postMaterial, noiseRandom1DMaterial, noiseRandom2DMaterial, noiseRandom3DMaterial, postQuad; -let stats; - -const params = { procedure: 'noiseRandom3D' }; - -init(); - -function init() { - const container = document.getElementById('container'); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // Setup post processing stage - postCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); - noiseRandom1DMaterial = new THREE.ShaderMaterial({ - vertexShader: document.querySelector('#procedural-vert').textContent.trim(), - fragmentShader: document.querySelector('#noiseRandom1D-frag').textContent.trim(), - }); - noiseRandom2DMaterial = new THREE.ShaderMaterial({ - vertexShader: document.querySelector('#procedural-vert').textContent.trim(), - fragmentShader: document.querySelector('#noiseRandom2D-frag').textContent.trim(), - }); - noiseRandom3DMaterial = new THREE.ShaderMaterial({ - vertexShader: document.querySelector('#procedural-vert').textContent.trim(), - fragmentShader: document.querySelector('#noiseRandom3D-frag').textContent.trim(), - }); - postMaterial = noiseRandom3DMaterial; - const postPlane = new THREE.PlaneGeometry(2, 2); - postQuad = new THREE.Mesh(postPlane, postMaterial); - postScene = new THREE.Scene(); - postScene.add(postQuad); - - window.addEventListener('resize', onWindowResize); - - // - - const gui = new GUI(); - gui.add(params, 'procedure', ['noiseRandom1D', 'noiseRandom2D', 'noiseRandom3D']); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - switch (params.procedure) { - case 'noiseRandom1D': - postMaterial = noiseRandom1DMaterial; - break; - case 'noiseRandom2D': - postMaterial = noiseRandom2DMaterial; - break; - case 'noiseRandom3D': - postMaterial = noiseRandom3DMaterial; - break; - } - - postQuad.material = postMaterial; - - // render post FX - renderer.render(postScene, postCamera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_postprocessing_rgb_halftone.ts b/examples-testing/examples/webgl_postprocessing_rgb_halftone.ts deleted file mode 100644 index 5a40f9793..000000000 --- a/examples-testing/examples/webgl_postprocessing_rgb_halftone.ts +++ /dev/null @@ -1,170 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { HalftonePass } from 'three/addons/postprocessing/HalftonePass.js'; - -let renderer, timer, camera, stats; - -const rotationSpeed = Math.PI / 64; - -let composer, group; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - timer = new THREE.Timer(); - timer.connect(document); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 12; - - stats = new Stats(); - - document.body.appendChild(renderer.domElement); - document.body.appendChild(stats.dom); - - // camera controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0, 0); - controls.update(); - - // scene - - const scene = new THREE.Scene(); - scene.background = new THREE.Color(0x444444); - - group = new THREE.Group(); - const floor = new THREE.Mesh(new THREE.BoxGeometry(100, 1, 100), new THREE.MeshPhongMaterial({})); - floor.position.y = -10; - const light = new THREE.PointLight(0xffffff, 250); - light.position.y = 2; - group.add(floor, light); - scene.add(group); - - const mat = new THREE.ShaderMaterial({ - uniforms: {}, - - vertexShader: [ - 'varying vec2 vUV;', - 'varying vec3 vNormal;', - - 'void main() {', - - 'vUV = uv;', - 'vNormal = vec3( normal );', - 'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', - - '}', - ].join('\n'), - - fragmentShader: [ - 'varying vec2 vUV;', - 'varying vec3 vNormal;', - - 'void main() {', - - 'vec4 c = vec4( abs( vNormal ) + vec3( vUV, 0.0 ), 0.0 );', - 'gl_FragColor = c;', - - '}', - ].join('\n'), - }); - - for (let i = 0; i < 50; ++i) { - // fill scene with coloured cubes - const mesh = new THREE.Mesh(new THREE.BoxGeometry(2, 2, 2), mat); - mesh.position.set(Math.random() * 16 - 8, Math.random() * 16 - 8, Math.random() * 16 - 8); - mesh.rotation.set(Math.random() * Math.PI * 2, Math.random() * Math.PI * 2, Math.random() * Math.PI * 2); - group.add(mesh); - } - - // post-processing - - composer = new EffectComposer(renderer); - const renderPass = new RenderPass(scene, camera); - const params = { - shape: 1, - radius: 4, - rotateR: Math.PI / 12, - rotateB: (Math.PI / 12) * 2, - rotateG: (Math.PI / 12) * 3, - scatter: 0, - blending: 1, - blendingMode: 1, - greyscale: false, - disable: false, - }; - const halftonePass = new HalftonePass(params); - composer.addPass(renderPass); - composer.addPass(halftonePass); - - window.onresize = function () { - // resize composer - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - }; - - // GUI - - const controller = { - radius: halftonePass.uniforms['radius'].value, - rotateR: halftonePass.uniforms['rotateR'].value / (Math.PI / 180), - rotateG: halftonePass.uniforms['rotateG'].value / (Math.PI / 180), - rotateB: halftonePass.uniforms['rotateB'].value / (Math.PI / 180), - scatter: halftonePass.uniforms['scatter'].value, - shape: halftonePass.uniforms['shape'].value, - greyscale: halftonePass.uniforms['greyscale'].value, - blending: halftonePass.uniforms['blending'].value, - blendingMode: halftonePass.uniforms['blendingMode'].value, - disable: halftonePass.uniforms['disable'].value, - }; - - function onGUIChange() { - // update uniforms - halftonePass.uniforms['radius'].value = controller.radius; - halftonePass.uniforms['rotateR'].value = controller.rotateR * (Math.PI / 180); - halftonePass.uniforms['rotateG'].value = controller.rotateG * (Math.PI / 180); - halftonePass.uniforms['rotateB'].value = controller.rotateB * (Math.PI / 180); - halftonePass.uniforms['scatter'].value = controller.scatter; - halftonePass.uniforms['shape'].value = controller.shape; - halftonePass.uniforms['greyscale'].value = controller.greyscale; - halftonePass.uniforms['blending'].value = controller.blending; - halftonePass.uniforms['blendingMode'].value = controller.blendingMode; - halftonePass.uniforms['disable'].value = controller.disable; - } - - const gui = new GUI(); - gui.add(controller, 'shape', { Dot: 1, Ellipse: 2, Line: 3, Square: 4, Diamond: 5 }).onChange(onGUIChange); - gui.add(controller, 'radius', 1, 25).onChange(onGUIChange); - gui.add(controller, 'rotateR', 0, 90).onChange(onGUIChange); - gui.add(controller, 'rotateG', 0, 90).onChange(onGUIChange); - gui.add(controller, 'rotateB', 0, 90).onChange(onGUIChange); - gui.add(controller, 'scatter', 0, 1, 0.01).onChange(onGUIChange); - gui.add(controller, 'greyscale').onChange(onGUIChange); - gui.add(controller, 'blending', 0, 1, 0.01).onChange(onGUIChange); - gui.add(controller, 'blendingMode', { Linear: 1, Multiply: 2, Add: 3, Lighter: 4, Darker: 5 }).onChange( - onGUIChange, - ); - gui.add(controller, 'disable').onChange(onGUIChange); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - stats.update(); - group.rotation.y += delta * rotationSpeed; - composer.render(delta); -} diff --git a/examples-testing/examples/webgl_postprocessing_sao.ts b/examples-testing/examples/webgl_postprocessing_sao.ts deleted file mode 100644 index 0c6298e6b..000000000 --- a/examples-testing/examples/webgl_postprocessing_sao.ts +++ /dev/null @@ -1,146 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { SAOPass } from 'three/addons/postprocessing/SAOPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let container, stats; -let camera, scene, renderer; -let composer, renderPass, saoPass; -let group; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - const width = window.innerWidth; - const height = window.innerHeight; - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(65, width / height, 3, 10); - camera.position.z = 7; - - scene = new THREE.Scene(); - - group = new THREE.Object3D(); - scene.add(group); - - const light = new THREE.PointLight(0xefffef, 500); - light.position.z = 10; - light.position.y = -10; - light.position.x = -10; - scene.add(light); - - const light2 = new THREE.PointLight(0xffefef, 500); - light2.position.z = 10; - light2.position.x = -10; - light2.position.y = 10; - scene.add(light2); - - const light3 = new THREE.PointLight(0xefefff, 500); - light3.position.z = 10; - light3.position.x = 10; - light3.position.y = -10; - scene.add(light3); - - const light4 = new THREE.AmbientLight(0xffffff, 0.2); - scene.add(light4); - - const geometry = new THREE.SphereGeometry(3, 48, 24); - const material = new THREE.MeshStandardMaterial(); - material.roughness = 0.5; - material.metalness = 0; - - const mesh = new THREE.InstancedMesh(geometry, material, 120); - const dummy = new THREE.Object3D(); - const color = new THREE.Color(); - - for (let i = 0; i < 120; i++) { - dummy.position.x = Math.random() * 4 - 2; - dummy.position.y = Math.random() * 4 - 2; - dummy.position.z = Math.random() * 4 - 2; - dummy.rotation.x = Math.random(); - dummy.rotation.y = Math.random(); - dummy.rotation.z = Math.random(); - - const scale = Math.random() * 0.2 + 0.05; - dummy.scale.set(scale, scale, scale); - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - - color.setHSL(Math.random(), 1.0, 0.3); - mesh.setColorAt(i, color); - } - - group.add(mesh); - - stats = new Stats(); - container.appendChild(stats.dom); - - composer = new EffectComposer(renderer); - renderPass = new RenderPass(scene, camera); - composer.addPass(renderPass); - saoPass = new SAOPass(scene, camera); - composer.addPass(saoPass); - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - // Init gui - const gui = new GUI(); - gui.add(saoPass.params, 'output', { - Default: SAOPass.OUTPUT.Default, - 'SAO Only': SAOPass.OUTPUT.SAO, - Normal: SAOPass.OUTPUT.Normal, - }).onChange(function (value) { - saoPass.params.output = value; - }); - gui.add(saoPass.params, 'saoBias', -1, 1); - gui.add(saoPass.params, 'saoIntensity', 0, 1); - gui.add(saoPass.params, 'saoScale', 0, 10); - gui.add(saoPass.params, 'saoKernelRadius', 1, 100); - gui.add(saoPass.params, 'saoMinResolution', 0, 1); - gui.add(saoPass.params, 'saoBlur'); - gui.add(saoPass.params, 'saoBlurRadius', 0, 200); - gui.add(saoPass.params, 'saoBlurStdDev', 0.5, 150); - gui.add(saoPass.params, 'saoBlurDepthCutoff', 0.0, 0.1); - gui.add(saoPass, 'enabled'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth || 1; - const height = window.innerHeight || 1; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - renderer.setSize(width, height); - - composer.setSize(width, height); -} - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - const timer = performance.now(); - group.rotation.x = timer * 0.0002; - group.rotation.y = timer * 0.0001; - - composer.render(); -} diff --git a/examples-testing/examples/webgl_postprocessing_smaa.ts b/examples-testing/examples/webgl_postprocessing_smaa.ts deleted file mode 100644 index 9e73d38b0..000000000 --- a/examples-testing/examples/webgl_postprocessing_smaa.ts +++ /dev/null @@ -1,106 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { SMAAPass } from 'three/addons/postprocessing/SMAAPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, scene, renderer, composer, stats, smaaPass; - -const params = { - enabled: true, - autoRotate: true, -}; - -init(); - -function init() { - const container = document.getElementById('container'); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 300; - - scene = new THREE.Scene(); - - const geometry = new THREE.BoxGeometry(120, 120, 120); - const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.position.x = -100; - scene.add(mesh1); - - const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); - texture.anisotropy = renderer.capabilities.getMaxAnisotropy(); - texture.colorSpace = THREE.SRGBColorSpace; - - const material2 = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.position.x = 100; - scene.add(mesh2); - - // postprocessing - - composer = new EffectComposer(renderer); - composer.addPass(new RenderPass(scene, camera)); - - smaaPass = new SMAAPass(); - composer.addPass(smaaPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - window.addEventListener('resize', onWindowResize); - - const gui = new GUI(); - - const smaaFolder = gui.addFolder('SMAA'); - smaaFolder.add(params, 'enabled'); - - const sceneFolder = gui.addFolder('Scene'); - sceneFolder.add(params, 'autoRotate'); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - stats.begin(); - - if (params.autoRotate === true) { - for (let i = 0; i < scene.children.length; i++) { - const child = scene.children[i]; - - child.rotation.x += 0.005; - child.rotation.y += 0.01; - } - } - - smaaPass.enabled = params.enabled; - - composer.render(); - - stats.end(); -} diff --git a/examples-testing/examples/webgl_postprocessing_sobel.ts b/examples-testing/examples/webgl_postprocessing_sobel.ts deleted file mode 100644 index 55d88dc02..000000000 --- a/examples-testing/examples/webgl_postprocessing_sobel.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; - -import { LuminosityShader } from 'three/addons/shaders/LuminosityShader.js'; -import { SobelOperatorShader } from 'three/addons/shaders/SobelOperatorShader.js'; - -let camera, scene, renderer, composer; - -let effectSobel; - -const params = { - enable: true, -}; - -init(); - -function init() { - // - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 1, 3); - camera.lookAt(scene.position); - - // - - const geometry = new THREE.TorusKnotGeometry(1, 0.3, 256, 32); - const material = new THREE.MeshPhongMaterial({ color: 0xffff00 }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const ambientLight = new THREE.AmbientLight(0xe7e7e7); - scene.add(ambientLight); - - const pointLight = new THREE.PointLight(0xffffff, 20); - camera.add(pointLight); - scene.add(camera); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // postprocessing - - composer = new EffectComposer(renderer); - const renderPass = new RenderPass(scene, camera); - composer.addPass(renderPass); - - // color to grayscale conversion - - const effectGrayScale = new ShaderPass(LuminosityShader); - composer.addPass(effectGrayScale); - - // you might want to use a gaussian blur filter before - // the next pass to improve the result of the Sobel operator - - // Sobel operator - - effectSobel = new ShaderPass(SobelOperatorShader); - effectSobel.uniforms['resolution'].value.x = window.innerWidth * window.devicePixelRatio; - effectSobel.uniforms['resolution'].value.y = window.innerHeight * window.devicePixelRatio; - composer.addPass(effectSobel); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - - // - - const gui = new GUI(); - - gui.add(params, 'enable'); - gui.open(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); - - effectSobel.uniforms['resolution'].value.x = window.innerWidth * window.devicePixelRatio; - effectSobel.uniforms['resolution'].value.y = window.innerHeight * window.devicePixelRatio; -} - -function animate() { - if (params.enable === true) { - composer.render(); - } else { - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgl_postprocessing_ssaa.ts b/examples-testing/examples/webgl_postprocessing_ssaa.ts deleted file mode 100644 index 45d8767b1..000000000 --- a/examples-testing/examples/webgl_postprocessing_ssaa.ts +++ /dev/null @@ -1,214 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { SSAARenderPass } from 'three/addons/postprocessing/SSAARenderPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let scene, renderer, composer; -let cameraP, ssaaRenderPassP; -let cameraO, ssaaRenderPassO; -let gui, stats; - -const params = { - sampleLevel: 4, - unbiased: true, - camera: 'perspective', - clearColor: 'black', - clearAlpha: 1.0, - viewOffsetX: 0, - autoRotate: true, -}; - -init(); - -clearGui(); - -function clearGui() { - if (gui) gui.destroy(); - - gui = new GUI(); - - gui.add(params, 'unbiased'); - gui.add(params, 'sampleLevel', { - 'Level 0: 1 Sample': 0, - 'Level 1: 2 Samples': 1, - 'Level 2: 4 Samples': 2, - 'Level 3: 8 Samples': 3, - 'Level 4: 16 Samples': 4, - 'Level 5: 32 Samples': 5, - }); - gui.add(params, 'camera', ['perspective', 'orthographic']); - gui.add(params, 'clearColor', ['black', 'white', 'blue', 'green', 'red']); - gui.add(params, 'clearAlpha', 0, 1); - gui.add(params, 'viewOffsetX', -100, 100); - gui.add(params, 'autoRotate'); - - gui.open(); -} - -function init() { - const container = document.getElementById('container'); - - const width = window.innerWidth || 1; - const height = window.innerHeight || 1; - const aspect = width / height; - const devicePixelRatio = window.devicePixelRatio || 1; - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - cameraP = new THREE.PerspectiveCamera(65, aspect, 3, 10); - cameraP.position.z = 7; - cameraP.setViewOffset(width, height, params.viewOffsetX, 0, width, height); - - cameraO = new THREE.OrthographicCamera(width / -2, width / 2, height / 2, height / -2, 3, 10); - cameraO.position.z = 7; - - const fov = THREE.MathUtils.degToRad(cameraP.fov); - const hyperfocus = (cameraP.near + cameraP.far) / 2; - const _height = 2 * Math.tan(fov / 2) * hyperfocus; - cameraO.zoom = height / _height; - - scene = new THREE.Scene(); - - const group = new THREE.Group(); - scene.add(group); - - const light = new THREE.PointLight(0xefffef, 500); - light.position.z = 10; - light.position.y = -10; - light.position.x = -10; - scene.add(light); - - const light2 = new THREE.PointLight(0xffefef, 500); - light2.position.z = 10; - light2.position.x = -10; - light2.position.y = 10; - scene.add(light2); - - const light3 = new THREE.PointLight(0xefefff, 500); - light3.position.z = 10; - light3.position.x = 10; - light3.position.y = -10; - scene.add(light3); - - const light4 = new THREE.AmbientLight(0xffffff, 0.2); - scene.add(light4); - - const geometry = new THREE.SphereGeometry(3, 48, 24); - const material = new THREE.MeshStandardMaterial(); - material.roughness = 0.5; - material.metalness = 0; - - const mesh = new THREE.InstancedMesh(geometry, material, 120); - const dummy = new THREE.Object3D(); - const color = new THREE.Color(); - - for (let i = 0; i < 120; i++) { - dummy.position.x = Math.random() * 4 - 2; - dummy.position.y = Math.random() * 4 - 2; - dummy.position.z = Math.random() * 4 - 2; - dummy.rotation.x = Math.random(); - dummy.rotation.y = Math.random(); - dummy.rotation.z = Math.random(); - - dummy.scale.setScalar(Math.random() * 0.2 + 0.05); - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - - color.setHSL(Math.random(), 1.0, 0.3); - mesh.setColorAt(i, color); - } - - group.add(mesh); - - // postprocessing - - composer = new EffectComposer(renderer); - composer.setPixelRatio(1); // ensure pixel ratio is always 1 for performance reasons - ssaaRenderPassP = new SSAARenderPass(scene, cameraP); - composer.addPass(ssaaRenderPassP); - ssaaRenderPassO = new SSAARenderPass(scene, cameraO); - composer.addPass(ssaaRenderPassO); - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - const aspect = width / height; - - cameraP.aspect = aspect; - cameraP.setViewOffset(width, height, params.viewOffsetX, 0, width, height); - cameraO.updateProjectionMatrix(); - - cameraO.left = -height * aspect; - cameraO.right = height * aspect; - cameraO.top = height; - cameraO.bottom = -height; - cameraO.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - stats.begin(); - - if (params.autoRotate) { - for (let i = 0; i < scene.children.length; i++) { - const child = scene.children[i]; - - child.rotation.x += 0.005; - child.rotation.y += 0.01; - } - } - - let newColor = ssaaRenderPassP.clearColor; - - switch (params.clearColor) { - case 'blue': - newColor = 0x0000ff; - break; - case 'red': - newColor = 0xff0000; - break; - case 'green': - newColor = 0x00ff00; - break; - case 'white': - newColor = 0xffffff; - break; - case 'black': - newColor = 0x000000; - break; - } - - ssaaRenderPassP.clearColor = ssaaRenderPassO.clearColor = newColor; - ssaaRenderPassP.clearAlpha = ssaaRenderPassO.clearAlpha = params.clearAlpha; - - ssaaRenderPassP.sampleLevel = ssaaRenderPassO.sampleLevel = params.sampleLevel; - ssaaRenderPassP.unbiased = ssaaRenderPassO.unbiased = params.unbiased; - - ssaaRenderPassP.enabled = params.camera === 'perspective'; - ssaaRenderPassO.enabled = params.camera === 'orthographic'; - - cameraP.view.offsetX = params.viewOffsetX; - - composer.render(); - - stats.end(); -} diff --git a/examples-testing/examples/webgl_postprocessing_ssao.ts b/examples-testing/examples/webgl_postprocessing_ssao.ts deleted file mode 100644 index fd3739af3..000000000 --- a/examples-testing/examples/webgl_postprocessing_ssao.ts +++ /dev/null @@ -1,125 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let container, stats; -let camera, scene, renderer; -let composer; -let group; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGLRenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(65, window.innerWidth / window.innerHeight, 100, 700); - camera.position.z = 500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xaaaaaa); - - scene.add(new THREE.DirectionalLight(0xffffff, 4)); - scene.add(new THREE.AmbientLight(0xffffff)); - - group = new THREE.Group(); - scene.add(group); - - const geometry = new THREE.BoxGeometry(10, 10, 10); - const material = new THREE.MeshLambertMaterial(); - - const mesh = new THREE.InstancedMesh(geometry, material, 100); - const dummy = new THREE.Object3D(); - const color = new THREE.Color(); - - for (let i = 0; i < 100; i++) { - dummy.position.x = Math.random() * 400 - 200; - dummy.position.y = Math.random() * 400 - 200; - dummy.position.z = Math.random() * 400 - 200; - dummy.rotation.x = Math.random(); - dummy.rotation.y = Math.random(); - dummy.rotation.z = Math.random(); - - dummy.scale.setScalar(Math.random() * 10 + 2); - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - - color.setHex(Math.random() * 0xffffff); - mesh.setColorAt(i, color); - } - - group.add(mesh); - - stats = new Stats(); - container.appendChild(stats.dom); - - const width = window.innerWidth; - const height = window.innerHeight; - - composer = new EffectComposer(renderer); - - const renderPass = new RenderPass(scene, camera); - composer.addPass(renderPass); - - const ssaoPass = new SSAOPass(scene, camera, width, height); - composer.addPass(ssaoPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - // Init gui - const gui = new GUI(); - - gui.add(ssaoPass, 'output', { - Default: SSAOPass.OUTPUT.Default, - 'SSAO Only': SSAOPass.OUTPUT.SSAO, - 'SSAO Only + Blur': SSAOPass.OUTPUT.Blur, - Depth: SSAOPass.OUTPUT.Depth, - Normal: SSAOPass.OUTPUT.Normal, - }).onChange(function (value) { - ssaoPass.output = value; - }); - gui.add(ssaoPass, 'kernelRadius').min(0).max(32); - gui.add(ssaoPass, 'minDistance').min(0.001).max(0.02); - gui.add(ssaoPass, 'maxDistance').min(0.01).max(0.3); - gui.add(ssaoPass, 'enabled'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - const timer = performance.now(); - group.rotation.x = timer * 0.0002; - group.rotation.y = timer * 0.0001; - - composer.render(); -} diff --git a/examples-testing/examples/webgl_postprocessing_ssr.ts b/examples-testing/examples/webgl_postprocessing_ssr.ts deleted file mode 100644 index 77f8365d1..000000000 --- a/examples-testing/examples/webgl_postprocessing_ssr.ts +++ /dev/null @@ -1,260 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { SSRPass } from 'three/addons/postprocessing/SSRPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; -import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js'; - -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; - -const params = { - enableSSR: true, - autoRotate: true, - otherMeshes: true, - groundReflector: true, -}; -let composer; -let ssrPass; -let gui; -let stats; -let controls; -let camera, scene, renderer; -const otherMeshes = []; -let groundReflector; -const selects = []; - -const container = document.querySelector('#container'); - -// Configure and create Draco decoder. -const dracoLoader = new DRACOLoader(); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 15); - camera.position.set(0.13271600513224902, 0.3489546826045913, 0.43921296427927076); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x443333); - scene.fog = new THREE.Fog(0x443333, 1, 4); - - // Ground - const plane = new THREE.Mesh(new THREE.PlaneGeometry(8, 8), new THREE.MeshPhongMaterial({ color: 0xcbcbcb })); - plane.rotation.x = -Math.PI / 2; - plane.position.y = -0.0001; - // plane.receiveShadow = true; - scene.add(plane); - - // Lights - const hemiLight = new THREE.HemisphereLight(0x8d7c7c, 0x494966, 3); - scene.add(hemiLight); - - const spotLight = new THREE.SpotLight(); - spotLight.intensity = 8; - spotLight.angle = Math.PI / 16; - spotLight.penumbra = 0.5; - // spotLight.castShadow = true; - spotLight.position.set(-1, 1, 1); - scene.add(spotLight); - - dracoLoader.load('models/draco/bunny.drc', function (geometry) { - geometry.computeVertexNormals(); - - const material = new THREE.MeshStandardMaterial({ color: 0xa5a5a5 }); - const mesh = new THREE.Mesh(geometry, material); - mesh.position.y = -0.0365; - scene.add(mesh); - selects.push(mesh); - - // Release decoder resources. - dracoLoader.dispose(); - }); - - let geometry, material, mesh; - - geometry = new THREE.BoxGeometry(0.05, 0.05, 0.05); - material = new THREE.MeshStandardMaterial({ color: 'green' }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.set(-0.12, 0.025, 0.015); - scene.add(mesh); - otherMeshes.push(mesh); - selects.push(mesh); - - geometry = new THREE.IcosahedronGeometry(0.025, 4); - material = new THREE.MeshStandardMaterial({ color: 'cyan' }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.set(-0.05, 0.025, 0.08); - scene.add(mesh); - otherMeshes.push(mesh); - selects.push(mesh); - - geometry = new THREE.ConeGeometry(0.025, 0.05, 64); - material = new THREE.MeshStandardMaterial({ color: 'yellow' }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.set(-0.05, 0.025, -0.055); - scene.add(mesh); - otherMeshes.push(mesh); - selects.push(mesh); - - geometry = new THREE.PlaneGeometry(1, 1); - groundReflector = new ReflectorForSSRPass(geometry, { - clipBias: 0.0003, - textureWidth: window.innerWidth, - textureHeight: window.innerHeight, - color: 0x888888, - useDepthTexture: true, - }); - groundReflector.material.depthWrite = false; - groundReflector.rotation.x = -Math.PI / 2; - groundReflector.visible = false; - scene.add(groundReflector); - - // renderer - renderer = new THREE.WebGLRenderer({ antialias: false }); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target.set(0, 0.0635, 0); - controls.update(); - controls.enabled = !params.autoRotate; - - // STATS - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); - - // composer - - composer = new EffectComposer(renderer); - ssrPass = new SSRPass({ - renderer, - scene, - camera, - width: innerWidth, - height: innerHeight, - groundReflector: params.groundReflector ? groundReflector : null, - selects: params.groundReflector ? selects : null, - }); - - composer.addPass(ssrPass); - composer.addPass(new OutputPass()); - - // GUI - - gui = new GUI({ width: 260 }); - gui.add(params, 'enableSSR').name('Enable SSR'); - gui.add(params, 'groundReflector').onChange(() => { - if (params.groundReflector) { - ((ssrPass.groundReflector = groundReflector), (ssrPass.selects = selects)); - } else { - ((ssrPass.groundReflector = null), (ssrPass.selects = null)); - } - }); - ssrPass.thickness = 0.018; - gui.add(ssrPass, 'resolutionScale').min(0).max(1); - gui.add(ssrPass, 'thickness').min(0).max(0.1).step(0.0001); - ssrPass.infiniteThick = false; - gui.add(ssrPass, 'infiniteThick'); - gui.add(params, 'autoRotate').onChange(() => { - controls.enabled = !params.autoRotate; - }); - - const folder = gui.addFolder('more settings'); - folder.add(ssrPass, 'fresnel').onChange(() => { - groundReflector.fresnel = ssrPass.fresnel; - }); - folder.add(ssrPass, 'distanceAttenuation').onChange(() => { - groundReflector.distanceAttenuation = ssrPass.distanceAttenuation; - }); - ssrPass.maxDistance = 0.1; - groundReflector.maxDistance = ssrPass.maxDistance; - folder - .add(ssrPass, 'maxDistance') - .min(0) - .max(0.5) - .step(0.001) - .onChange(() => { - groundReflector.maxDistance = ssrPass.maxDistance; - }); - folder.add(params, 'otherMeshes').onChange(() => { - if (params.otherMeshes) { - otherMeshes.forEach(mesh => (mesh.visible = true)); - } else { - otherMeshes.forEach(mesh => (mesh.visible = false)); - } - }); - folder.add(ssrPass, 'bouncing'); - folder - .add(ssrPass, 'output', { - Default: SSRPass.OUTPUT.Default, - 'SSR Only': SSRPass.OUTPUT.SSR, - Beauty: SSRPass.OUTPUT.Beauty, - Depth: SSRPass.OUTPUT.Depth, - Normal: SSRPass.OUTPUT.Normal, - Metalness: SSRPass.OUTPUT.Metalness, - }) - .onChange(function (value) { - ssrPass.output = value; - }); - ssrPass.opacity = 1; - groundReflector.opacity = ssrPass.opacity; - folder - .add(ssrPass, 'opacity') - .min(0) - .max(1) - .onChange(() => { - groundReflector.opacity = ssrPass.opacity; - }); - folder.add(ssrPass, 'blur'); - // folder.open() - // gui.close() -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); - groundReflector.getRenderTarget().setSize(window.innerWidth, window.innerHeight); - groundReflector.resolution.set(window.innerWidth, window.innerHeight); -} - -function animate() { - stats.begin(); - render(); - stats.end(); -} - -function render() { - if (params.autoRotate) { - const timer = Date.now() * 0.0003; - - camera.position.x = Math.sin(timer) * 0.5; - camera.position.y = 0.2135; - camera.position.z = Math.cos(timer) * 0.5; - camera.lookAt(0, 0.0635, 0); - } else { - controls.update(); - } - - if (params.enableSSR) { - // TODO: groundReflector has full ground info, need use it to solve reflection gaps problem on objects when camera near ground. - // TODO: the normal and depth info where groundReflector reflected need to be changed. - composer.render(); - } else { - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgl_postprocessing_taa.ts b/examples-testing/examples/webgl_postprocessing_taa.ts deleted file mode 100644 index 11a986741..000000000 --- a/examples-testing/examples/webgl_postprocessing_taa.ts +++ /dev/null @@ -1,139 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, scene, renderer, composer, taaRenderPass, renderPass; -let gui, stats; -let index = 0; - -const param = { TAAEnabled: '1', TAASampleLevel: 0 }; - -init(); - -clearGui(); - -function clearGui() { - if (gui) gui.destroy(); - - gui = new GUI(); - - gui.add(param, 'TAAEnabled', { - Disabled: '0', - Enabled: '1', - }).onFinishChange(function () { - if (taaRenderPass) { - taaRenderPass.enabled = param.TAAEnabled === '1'; - renderPass.enabled = param.TAAEnabled !== '1'; - } - }); - - gui.add(param, 'TAASampleLevel', { - 'Level 0: 1 Sample': 0, - 'Level 1: 2 Samples': 1, - 'Level 2: 4 Samples': 2, - 'Level 3: 8 Samples': 3, - 'Level 4: 16 Samples': 4, - 'Level 5: 32 Samples': 5, - }).onFinishChange(function () { - if (taaRenderPass) { - taaRenderPass.sampleLevel = param.TAASampleLevel; - } - }); - - gui.open(); -} - -function init() { - const container = document.getElementById('container'); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 300; - - scene = new THREE.Scene(); - - const geometry = new THREE.BoxGeometry(120, 120, 120); - const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.position.x = -100; - scene.add(mesh1); - - const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); - texture.minFilter = THREE.NearestFilter; - texture.magFilter = THREE.NearestFilter; - texture.anisotropy = 1; - texture.generateMipmaps = false; - texture.colorSpace = THREE.SRGBColorSpace; - - const material2 = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.position.x = 100; - scene.add(mesh2); - - // postprocessing - - composer = new EffectComposer(renderer); - - taaRenderPass = new TAARenderPass(scene, camera); - taaRenderPass.unbiased = false; - composer.addPass(taaRenderPass); - - renderPass = new RenderPass(scene, camera); - renderPass.enabled = false; - composer.addPass(renderPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - index++; - - if (Math.round(index / 200) % 2 === 0) { - for (let i = 0; i < scene.children.length; i++) { - const child = scene.children[i]; - - child.rotation.x += 0.005; - child.rotation.y += 0.01; - } - - if (taaRenderPass) taaRenderPass.accumulate = false; - } else { - if (taaRenderPass) taaRenderPass.accumulate = true; - } - - composer.render(); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_postprocessing_transition.ts b/examples-testing/examples/webgl_postprocessing_transition.ts deleted file mode 100644 index 1cf5dd3cb..000000000 --- a/examples-testing/examples/webgl_postprocessing_transition.ts +++ /dev/null @@ -1,214 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import TWEEN from 'three/addons/libs/tween.module.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderTransitionPass } from 'three/addons/postprocessing/RenderTransitionPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let stats; -let renderer, composer, renderTransitionPass; - -const textures = []; -const timer = new THREE.Timer(); -timer.connect(document); - -const params = { - sceneAnimate: true, - transitionAnimate: true, - transition: 0, - useTexture: true, - texture: 5, - cycle: true, - threshold: 0.1, -}; - -const fxSceneA = new FXScene(new THREE.BoxGeometry(2, 2, 2), new THREE.Vector3(0, -0.4, 0), 0xffffff); -const fxSceneB = new FXScene(new THREE.IcosahedronGeometry(1, 1), new THREE.Vector3(0, 0.2, 0.1), 0x000000); - -init(); - -function init() { - initGUI(); - initTextures(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - composer = new EffectComposer(renderer); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - renderTransitionPass = new RenderTransitionPass(fxSceneA.scene, fxSceneA.camera, fxSceneB.scene, fxSceneB.camera); - renderTransitionPass.setTexture(textures[0]); - composer.addPass(renderTransitionPass); - - const outputPass = new OutputPass(); - composer.addPass(outputPass); -} - -window.addEventListener('resize', onWindowResize); - -function onWindowResize() { - fxSceneA.resize(); - fxSceneB.resize(); - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); -} - -new TWEEN.Tween(params) - .to({ transition: 1 }, 1500) - .onUpdate(function () { - renderTransitionPass.setTransition(params.transition); - - // Change the current alpha texture after each transition - if (params.cycle) { - if (params.transition == 0 || params.transition == 1) { - params.texture = (params.texture + 1) % textures.length; - renderTransitionPass.setTexture(textures[params.texture]); - } - } - }) - .repeat(Infinity) - .delay(2000) - .yoyo(true) - .start(); - -function animate() { - timer.update(); - - // Transition animation - if (params.transitionAnimate) TWEEN.update(); - - const delta = timer.getDelta(); - fxSceneA.update(delta); - fxSceneB.update(delta); - - render(); - stats.update(); -} - -function initTextures() { - const loader = new THREE.TextureLoader(); - - for (let i = 0; i < 6; i++) { - textures[i] = loader.load('textures/transition/transition' + (i + 1) + '.png'); - } -} - -function initGUI() { - const gui = new GUI(); - - gui.add(params, 'sceneAnimate').name('Animate scene'); - gui.add(params, 'transitionAnimate').name('Animate transition'); - gui.add(params, 'transition', 0, 1, 0.01) - .onChange(function (value) { - renderTransitionPass.setTransition(value); - }) - .listen(); - - gui.add(params, 'useTexture').onChange(function (value) { - renderTransitionPass.useTexture(value); - }); - - gui.add(params, 'texture', { Perlin: 0, Squares: 1, Cells: 2, Distort: 3, Gradient: 4, Radial: 5 }) - .onChange(function (value) { - renderTransitionPass.setTexture(textures[value]); - }) - .listen(); - - gui.add(params, 'cycle'); - - gui.add(params, 'threshold', 0, 1, 0.01).onChange(function (value) { - renderTransitionPass.setTextureThreshold(value); - }); -} - -function render() { - // Prevent render both scenes when it's not necessary - if (params.transition === 0) { - renderer.render(fxSceneB.scene, fxSceneB.camera); - } else if (params.transition === 1) { - renderer.render(fxSceneA.scene, fxSceneA.camera); - } else { - // When 0 < transition < 1 render transition between two scenes - composer.render(); - } -} - -function FXScene(geometry, rotationSpeed, backgroundColor) { - const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 20; - - // Setup scene - const scene = new THREE.Scene(); - scene.background = new THREE.Color(backgroundColor); - scene.add(new THREE.AmbientLight(0xaaaaaa, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 1, 4); - scene.add(light); - - this.rotationSpeed = rotationSpeed; - - const color = geometry.type === 'BoxGeometry' ? 0x0000ff : 0xff0000; - const material = new THREE.MeshPhongMaterial({ color: color, flatShading: true }); - const mesh = generateInstancedMesh(geometry, material, 500); - scene.add(mesh); - - this.scene = scene; - this.camera = camera; - this.mesh = mesh; - - this.update = function (delta) { - if (params.sceneAnimate) { - mesh.rotation.x += this.rotationSpeed.x * delta; - mesh.rotation.y += this.rotationSpeed.y * delta; - mesh.rotation.z += this.rotationSpeed.z * delta; - } - }; - - this.resize = function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - }; -} - -function generateInstancedMesh(geometry, material, count) { - const mesh = new THREE.InstancedMesh(geometry, material, count); - - const dummy = new THREE.Object3D(); - const color = new THREE.Color(); - - for (let i = 0; i < count; i++) { - dummy.position.x = Math.random() * 100 - 50; - dummy.position.y = Math.random() * 60 - 30; - dummy.position.z = Math.random() * 80 - 40; - - dummy.rotation.x = Math.random() * 2 * Math.PI; - dummy.rotation.y = Math.random() * 2 * Math.PI; - dummy.rotation.z = Math.random() * 2 * Math.PI; - - dummy.scale.x = Math.random() * 2 + 1; - - if (geometry.type === 'BoxGeometry') { - dummy.scale.y = Math.random() * 2 + 1; - dummy.scale.z = Math.random() * 2 + 1; - } else { - dummy.scale.y = dummy.scale.x; - dummy.scale.z = dummy.scale.x; - } - - dummy.updateMatrix(); - - mesh.setMatrixAt(i, dummy.matrix); - mesh.setColorAt(i, color.setScalar(0.1 + 0.9 * Math.random())); - } - - return mesh; -} diff --git a/examples-testing/examples/webgl_postprocessing_unreal_bloom.ts b/examples-testing/examples/webgl_postprocessing_unreal_bloom.ts deleted file mode 100644 index b5e2ee0f9..000000000 --- a/examples-testing/examples/webgl_postprocessing_unreal_bloom.ts +++ /dev/null @@ -1,139 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, stats; -let composer, renderer, mixer, timer; - -const params = { - threshold: 0, - strength: 1, - radius: 0.5, - exposure: 1, -}; - -init(); - -async function init() { - const container = document.getElementById('container'); - - timer = new THREE.Timer(); - timer.connect(document); - - const scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); - camera.position.set(-5, 2.5, -3.5); - scene.add(camera); - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const pointLight = new THREE.PointLight(0xffffff, 100); - camera.add(pointLight); - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/PrimaryIonDrive.glb'); - - const model = gltf.scene; - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - const clip = gltf.animations[0]; - mixer.clipAction(clip.optimize()).play(); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - container.appendChild(renderer.domElement); - - // - - const renderScene = new RenderPass(scene, camera); - - const bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); - bloomPass.threshold = params.threshold; - bloomPass.strength = params.strength; - bloomPass.radius = params.radius; - - const outputPass = new OutputPass(); - - composer = new EffectComposer(renderer); - composer.addPass(renderScene); - composer.addPass(bloomPass); - composer.addPass(outputPass); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI * 0.5; - controls.minDistance = 3; - controls.maxDistance = 8; - - // - - const gui = new GUI(); - - const bloomFolder = gui.addFolder('bloom'); - - bloomFolder.add(params, 'threshold', 0.0, 1.0).onChange(function (value) { - bloomPass.threshold = Number(value); - }); - - bloomFolder.add(params, 'strength', 0.0, 3.0).onChange(function (value) { - bloomPass.strength = Number(value); - }); - - gui.add(params, 'radius', 0.0, 1.0) - .step(0.01) - .onChange(function (value) { - bloomPass.radius = Number(value); - }); - - const toneMappingFolder = gui.addFolder('tone mapping'); - - toneMappingFolder.add(params, 'exposure', 0.1, 2).onChange(function (value) { - renderer.toneMappingExposure = Math.pow(value, 4.0); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - composer.setSize(width, height); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - mixer.update(delta); - - stats.update(); - - composer.render(); -} diff --git a/examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts b/examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts deleted file mode 100644 index 288b4477d..000000000 --- a/examples-testing/examples/webgl_postprocessing_unreal_bloom_selective.ts +++ /dev/null @@ -1,208 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; -import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -const BLOOM_SCENE = 1; - -const bloomLayer = new THREE.Layers(); -bloomLayer.set(BLOOM_SCENE); - -const params = { - threshold: 0, - strength: 1, - radius: 0.5, - exposure: 1, -}; - -const darkMaterial = new THREE.MeshBasicMaterial({ color: 'black' }); -const materials = {}; - -const renderer = new THREE.WebGLRenderer({ antialias: false }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.toneMapping = THREE.NeutralToneMapping; -document.body.appendChild(renderer.domElement); - -const scene = new THREE.Scene(); -const pmremGenerator = new THREE.PMREMGenerator(renderer); -scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - -const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 200); -camera.position.set(0, 0, 20); -camera.lookAt(0, 0, 0); - -const controls = new OrbitControls(camera, renderer.domElement); -controls.maxPolarAngle = Math.PI * 0.5; -controls.minDistance = 1; -controls.maxDistance = 100; -controls.addEventListener('change', render); - -const renderScene = new RenderPass(scene, camera); - -const bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); -bloomPass.threshold = params.threshold; -bloomPass.strength = params.strength; -bloomPass.radius = params.radius; - -const bloomRenderTarget = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, { - type: THREE.HalfFloatType, -}); -const bloomComposer = new EffectComposer(renderer, bloomRenderTarget); -bloomComposer.renderToScreen = false; -bloomComposer.addPass(renderScene); -bloomComposer.addPass(bloomPass); - -const mixPass = new ShaderPass( - new THREE.ShaderMaterial({ - uniforms: { - baseTexture: { value: null }, - bloomTexture: { value: bloomComposer.renderTarget2.texture }, - bloomStrength: { value: params.strength }, - }, - vertexShader: document.getElementById('vertexshader').textContent, - fragmentShader: document.getElementById('fragmentshader').textContent, - defines: {}, - }), - 'baseTexture', -); -mixPass.needsSwap = true; - -const outputPass = new OutputPass(); - -const finalRenderTarget = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, { - type: THREE.HalfFloatType, - samples: 4, -}); -const finalComposer = new EffectComposer(renderer, finalRenderTarget); -finalComposer.addPass(renderScene); -finalComposer.addPass(mixPass); -finalComposer.addPass(outputPass); - -const raycaster = new THREE.Raycaster(); - -const mouse = new THREE.Vector2(); - -window.addEventListener('pointerdown', onPointerDown); - -const gui = new GUI(); - -const bloomFolder = gui.addFolder('bloom'); - -bloomFolder.add(params, 'threshold', 0.0, 1.0).onChange(function (value) { - bloomPass.threshold = Number(value); - render(); -}); - -bloomFolder.add(params, 'strength', 0.0, 3).onChange(function (value) { - bloomPass.strength = Number(value); - mixPass.material.uniforms.bloomStrength.value = bloomPass.strength; - - render(); -}); - -bloomFolder - .add(params, 'radius', 0.0, 1.0) - .step(0.01) - .onChange(function (value) { - bloomPass.radius = Number(value); - render(); - }); - -const toneMappingFolder = gui.addFolder('tone mapping'); - -toneMappingFolder.add(params, 'exposure', 0.1, 2).onChange(function (value) { - renderer.toneMappingExposure = Math.pow(value, 4.0); - render(); -}); - -setupScene(); - -function onPointerDown(event) { - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; - - raycaster.setFromCamera(mouse, camera); - const intersects = raycaster.intersectObjects(scene.children, false); - if (intersects.length > 0) { - const object = intersects[0].object; - object.layers.toggle(BLOOM_SCENE); - render(); - } -} - -window.onresize = function () { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - - bloomComposer.setSize(width, height); - finalComposer.setSize(width, height); - - render(); -}; - -function setupScene() { - scene.traverse(disposeMaterial); - scene.children.length = 0; - - const geometry = new THREE.IcosahedronGeometry(1, 15); - - for (let i = 0; i < 50; i++) { - const color = new THREE.Color(); - color.setHSL(Math.random(), 0.7, Math.random() * 0.2 + 0.05); - - const material = new THREE.MeshStandardMaterial({ color: color, roughness: 1, metalness: 1 }); - const sphere = new THREE.Mesh(geometry, material); - sphere.position.x = Math.random() * 10 - 5; - sphere.position.y = Math.random() * 10 - 5; - sphere.position.z = Math.random() * 10 - 5; - sphere.position.normalize().multiplyScalar(Math.random() * 4.0 + 2.0); - sphere.scale.setScalar(Math.random() * Math.random() + 0.5); - scene.add(sphere); - - if (Math.random() < 0.25) sphere.layers.enable(BLOOM_SCENE); - } - - render(); -} - -function disposeMaterial(obj) { - if (obj.material) { - obj.material.dispose(); - } -} - -function render() { - scene.traverse(darkenNonBloomed); - bloomComposer.render(); - scene.traverse(restoreMaterial); - - // render the entire scene, then render bloom scene on top - finalComposer.render(); -} - -function darkenNonBloomed(obj) { - if (obj.isMesh && bloomLayer.test(obj.layers) === false) { - materials[obj.uuid] = obj.material; - obj.material = darkMaterial; - } -} - -function restoreMaterial(obj) { - if (materials[obj.uuid]) { - obj.material = materials[obj.uuid]; - delete materials[obj.uuid]; - } -} diff --git a/examples-testing/examples/webgl_random_uv.ts b/examples-testing/examples/webgl_random_uv.ts deleted file mode 100644 index c9db614da..000000000 --- a/examples-testing/examples/webgl_random_uv.ts +++ /dev/null @@ -1,338 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, dirLight, ground, gui, material, materialIn, uniforms, uniformsIn; - -init(); -render(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); - camera.position.set(-0.8, 0.6, 1.5); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.7; - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.VSMShadowMap; - container.appendChild(renderer.domElement); - - dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(-0.5, 1, 0.8); - dirLight.castShadow = true; - scene.add(dirLight); - const shadow = dirLight.shadow; - shadow.mapSize.width = shadow.mapSize.height = 1024; - shadow.radius = 16; - shadow.bias = -0.0005; - const shadowCam = shadow.camera, - s = 2; - shadowCam.near = 0.5; - shadowCam.far = 3; - shadowCam.right = shadowCam.top = s; - shadowCam.left = shadowCam.bottom = -s; - // debug shadow - //scene.add( new THREE.CameraHelper(shadowCam) ); - - // add ground plane - const plane = new THREE.PlaneGeometry(2, 2); - plane.rotateX(-Math.PI * 0.5); - ground = new THREE.Mesh(plane, new THREE.ShadowMaterial({ opacity: 0.5 })); - ground.receiveShadow = true; - ground.position.z = -0.5; - scene.add(ground); - - const map = new THREE.TextureLoader().load('textures/jade.jpg'); - map.colorSpace = THREE.SRGBColorSpace; - map.wrapS = map.wrapT = THREE.RepeatWrapping; - map.repeat.set(20, 20); - map.flipY = false; - - const disolveMap = new THREE.TextureLoader().load('textures/shaderball_ds.jpg'); - disolveMap.flipY = false; - - const noise = new THREE.TextureLoader().load('textures/noise.png'); - - new HDRLoader().setPath('textures/equirectangular/').load('lobe.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - scene.backgroundBlurriness = 0.5; - scene.backgroundIntensity = 1.0; - scene.environmentIntensity = 1.5; - - render(); - - // model - - const loader = new GLTFLoader().setPath('models/gltf/'); - loader.setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)); - loader.load('ShaderBall2.glb', function (gltf) { - const shaderBall = gltf.scene.children[0]; - - // shaderBall is a group with 3 children : base, inside and logo - // ao map is include in model - - let i = shaderBall.children.length, - n = 0; - - while (i--) { - shaderBall.children[i].receiveShadow = true; - shaderBall.children[i].castShadow = true; - shaderBall.children[i].renderOrder = n++; - } - - material = shaderBall.children[0].material; - material.map = map; - material.alphaMap = disolveMap; - material.transparent = true; - - materialIn = shaderBall.children[1].material; - materialIn.alphaMap = disolveMap; - materialIn.transparent = true; - - material.onBeforeCompile = function (shader) { - shader.uniforms['disolve'] = { value: 0 }; - shader.uniforms['threshold'] = { value: 0.2 }; - - shader.uniforms['noiseMap'] = { value: noise }; - shader.uniforms['enableRandom'] = { value: 1 }; - shader.uniforms['useNoiseMap'] = { value: 1 }; - shader.uniforms['useSuslikMethod'] = { value: 0 }; - shader.uniforms['debugNoise'] = { value: 0 }; - - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - '#include ' + randomUV, - ); - shader.fragmentShader = shader.fragmentShader.replace('#include ', map_fragment); - - // for disolve - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - alphamap_pars_fragment, - ); - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - alphamap_fragment, - ); - - uniforms = shader.uniforms; - }; - - materialIn.onBeforeCompile = function (shader) { - shader.uniforms['disolve'] = { value: 0 }; - shader.uniforms['threshold'] = { value: 0.2 }; - // for disolve - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - alphamap_pars_fragment, - ); - shader.fragmentShader = shader.fragmentShader.replace( - '#include ', - alphamap_fragment, - ); - - uniformsIn = shader.uniforms; - }; - - scene.add(shaderBall); - - render(); - - createGUI(); - }); - }); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 0.3; - controls.maxDistance = 10; - controls.target.set(0, 0.4, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function createGUI() { - const setting = { - get Enabled() { - return uniforms.enableRandom.value ? true : false; - }, - set Enabled(v) { - uniforms.enableRandom.value = v ? 1 : 0; - render(); - }, - - get UseNoiseMap() { - return uniforms.useNoiseMap.value ? true : false; - }, - set UseNoiseMap(v) { - uniforms.useNoiseMap.value = v ? 1 : 0; - render(); - }, - - get SuslikMethod() { - return uniforms.useSuslikMethod.value ? true : false; - }, - set SuslikMethod(v) { - uniforms.useSuslikMethod.value = v ? 1 : 0; - render(); - }, - - get DebugNoise() { - return uniforms.debugNoise.value ? true : false; - }, - set DebugNoise(v) { - uniforms.debugNoise.value = v ? 1 : 0; - render(); - }, - - // disolve - get disolve() { - return uniforms.disolve.value; - }, - set disolve(v) { - uniforms.disolve.value = v; - uniformsIn.disolve.value = v; - ground.material.opacity = (1 - v) * 0.5; - render(); - }, - - get threshold() { - return uniforms.threshold.value; - }, - set threshold(v) { - uniforms.threshold.value = v; - uniformsIn.threshold.value = v; - render(); - }, - }; - - gui = new GUI(); - gui.add(material, 'roughness', 0, 1, 0.01).onChange(render); - gui.add(material, 'metalness', 0, 1, 0.01).onChange(render); - gui.add(setting, 'disolve', 0, 1, 0.01).onChange(render); - gui.add(setting, 'threshold', 0, 1, 0.01).onChange(render); - gui.add(setting, 'Enabled'); - gui.add(setting, 'UseNoiseMap'); - gui.add(setting, 'SuslikMethod'); - gui.add(setting, 'DebugNoise'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -// - -function render() { - renderer.render(scene, camera); -} - -const randomUV = /* glsl */ ` - - uniform sampler2D noiseMap; - uniform float enableRandom; - uniform float useNoiseMap; - uniform float debugNoise; - uniform float useSuslikMethod; - - float directNoise(vec2 p){ - vec2 ip = floor(p); - vec2 u = fract(p); - u = u*u*(3.0-2.0*u); - - float res = mix( - mix(rand(ip),rand(ip+vec2(1.0,0.0)),u.x), - mix(rand(ip+vec2(0.0,1.0)),rand(ip+vec2(1.0,1.0)),u.x),u.y); - return res*res; - } - - float sum( vec4 v ) { return v.x+v.y+v.z; } - - vec4 textureNoTile( sampler2D mapper, in vec2 uv ){ - - // sample variation pattern - float k = 0.0; - if( useNoiseMap == 1.0 ) k = texture2D( noiseMap, 0.005*uv ).x; - else k = directNoise( uv ); - - // compute index - float index = k*8.0; - float f = fract( index ); - float ia = 0.0; - float ib = 0.0; - - if( useSuslikMethod == 1.0 ){ - ia = floor(index+0.5); - ib = floor(index); - f = min(f, 1.0-f)*2.0; - } else { - ia = floor( index ); - ib = ia + 1.0; - } - - // offsets for the different virtual patterns - vec2 offa = sin(vec2(3.0,7.0)*ia); // can replace with any other hash - vec2 offb = sin(vec2(3.0,7.0)*ib); // can replace with any other hash - - // compute derivatives for mip-mapping - vec2 dx = dFdx(uv); - vec2 dy = dFdy(uv); - - // sample the two closest virtual patterns - vec4 cola = textureGrad( mapper, uv + offa, dx, dy ); - vec4 colb = textureGrad( mapper, uv + offb, dx, dy ); - if( debugNoise == 1.0 ){ - cola = vec4( 0.1,0.0,0.0,1.0 ); - colb = vec4( 0.0,0.0,1.0,1.0 ); - } - - // interpolate between the two virtual patterns - return mix( cola, colb, smoothstep(0.2,0.8,f-0.1*sum(cola-colb)) ); - - }`; - -const map_fragment = /* glsl */ ` - #ifdef USE_MAP - - if( enableRandom == 1.0 ) diffuseColor *= textureNoTile( map, vMapUv ); - else diffuseColor *= texture2D( map, vMapUv ); - - #endif - `; - -const alphamap_pars_fragment = /* glsl */ ` - #ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; - uniform float disolve; - uniform float threshold; - #endif - `; - -const alphamap_fragment = /* glsl */ ` - #ifdef USE_ALPHAMAP - float vv = texture2D( alphaMap, vAlphaMapUv ).g; - float r = disolve * (1.0 + threshold * 2.0) - threshold; - float mixf = clamp((vv - r)*(1.0/threshold), 0.0, 1.0); - diffuseColor.a = mixf; - #endif - `; diff --git a/examples-testing/examples/webgl_raycaster_sprite.ts b/examples-testing/examples/webgl_raycaster_sprite.ts deleted file mode 100644 index f35d5de17..000000000 --- a/examples-testing/examples/webgl_raycaster_sprite.ts +++ /dev/null @@ -1,103 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let renderer, scene, camera; -let group; - -let selectedObject = null; -const raycaster = new THREE.Raycaster(); -const pointer = new THREE.Vector2(); - -init(); - -function init() { - // init renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // init scene - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - group = new THREE.Group(); - scene.add(group); - - // init camera - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(15, 15, 15); - camera.lookAt(scene.position); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 15; - controls.maxDistance = 250; - - // add sprites - - const sprite1 = new THREE.Sprite(new THREE.SpriteMaterial({ color: '#69f' })); - sprite1.position.set(6, 5, 5); - sprite1.scale.set(2, 5, 1); - group.add(sprite1); - - const sprite2 = new THREE.Sprite(new THREE.SpriteMaterial({ color: '#69f', sizeAttenuation: false })); - sprite2.material.rotation = (Math.PI / 3) * 4; - sprite2.position.set(8, -2, 2); - sprite2.center.set(0.5, 0); - sprite2.scale.set(0.1, 0.5, 0.1); - group.add(sprite2); - - const group2 = new THREE.Object3D(); - group2.scale.set(1, 2, 1); - group2.position.set(-5, 0, 0); - group2.rotation.set(Math.PI / 2, 0, 0); - group.add(group2); - - const sprite3 = new THREE.Sprite(new THREE.SpriteMaterial({ color: '#69f' })); - sprite3.position.set(0, 2, 5); - sprite3.scale.set(10, 2, 3); - sprite3.center.set(-0.1, 0); - sprite3.material.rotation = Math.PI / 3; - group2.add(sprite3); - - window.addEventListener('resize', onWindowResize); - document.addEventListener('pointermove', onPointerMove); -} - -function animate() { - renderer.render(scene, camera); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - if (selectedObject) { - selectedObject.material.color.set('#69f'); - selectedObject = null; - } - - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObject(group, true); - - if (intersects.length > 0) { - const res = intersects.filter(function (res) { - return res && res.object; - })[0]; - - if (res && res.object) { - selectedObject = res.object; - selectedObject.material.color.set('#f00'); - } - } -} diff --git a/examples-testing/examples/webgl_raycaster_texture.ts b/examples-testing/examples/webgl_raycaster_texture.ts deleted file mode 100644 index 72c7054dc..000000000 --- a/examples-testing/examples/webgl_raycaster_texture.ts +++ /dev/null @@ -1,286 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -const WRAPPING = { - RepeatWrapping: THREE.RepeatWrapping, - ClampToEdgeWrapping: THREE.ClampToEdgeWrapping, - MirroredRepeatWrapping: THREE.MirroredRepeatWrapping, -}; - -const params = { - wrapS: THREE.RepeatWrapping, - wrapT: THREE.RepeatWrapping, - offsetX: 0, - offsetY: 0, - repeatX: 1, - repeatY: 1, - rotation: 0, -}; - -function CanvasTexture(parentTexture) { - this._canvas = document.createElement('canvas'); - this._canvas.width = this._canvas.height = 1024; - this._context2D = this._canvas.getContext('2d'); - - if (parentTexture) { - this._parentTexture.push(parentTexture); - parentTexture.image = this._canvas; - } - - const that = this; - this._background = document.createElement('img'); - this._background.addEventListener('load', function () { - that._canvas.width = that._background.naturalWidth; - that._canvas.height = that._background.naturalHeight; - - that._crossRadius = Math.ceil(Math.min(that._canvas.width, that._canvas.height / 30)); - that._crossMax = Math.ceil(0.70710678 * that._crossRadius); - that._crossMin = Math.ceil(that._crossMax / 10); - that._crossThickness = Math.ceil(that._crossMax / 10); - - that._draw(); - }); - this._background.crossOrigin = ''; - this._background.src = 'textures/uv_grid_opengl.jpg'; - - this._draw(); -} - -CanvasTexture.prototype = { - constructor: CanvasTexture, - - _canvas: null, - _context2D: null, - _xCross: 0, - _yCross: 0, - - _crossRadius: 57, - _crossMax: 40, - _crossMin: 4, - _crossThickness: 4, - - _parentTexture: [], - - addParent: function (parentTexture) { - if (this._parentTexture.indexOf(parentTexture) === -1) { - this._parentTexture.push(parentTexture); - parentTexture.image = this._canvas; - } - }, - - setCrossPosition: function (x, y) { - this._xCross = x * this._canvas.width; - this._yCross = y * this._canvas.height; - - this._draw(); - }, - - _draw: function () { - if (!this._context2D) return; - - this._context2D.clearRect(0, 0, this._canvas.width, this._canvas.height); - - // Background. - this._context2D.drawImage(this._background, 0, 0); - - // Yellow cross. - this._context2D.lineWidth = this._crossThickness * 3; - this._context2D.strokeStyle = '#FFFF00'; - - this._context2D.beginPath(); - this._context2D.moveTo(this._xCross - this._crossMax - 2, this._yCross - this._crossMax - 2); - this._context2D.lineTo(this._xCross - this._crossMin, this._yCross - this._crossMin); - - this._context2D.moveTo(this._xCross + this._crossMin, this._yCross + this._crossMin); - this._context2D.lineTo(this._xCross + this._crossMax + 2, this._yCross + this._crossMax + 2); - - this._context2D.moveTo(this._xCross - this._crossMax - 2, this._yCross + this._crossMax + 2); - this._context2D.lineTo(this._xCross - this._crossMin, this._yCross + this._crossMin); - - this._context2D.moveTo(this._xCross + this._crossMin, this._yCross - this._crossMin); - this._context2D.lineTo(this._xCross + this._crossMax + 2, this._yCross - this._crossMax - 2); - - this._context2D.stroke(); - - for (let i = 0; i < this._parentTexture.length; i++) { - this._parentTexture[i].needsUpdate = true; - } - }, -}; - -const width = window.innerWidth; -const height = window.innerHeight; - -let canvas; -let planeTexture, cubeTexture, circleTexture; - -let container; - -let camera, scene, renderer; - -const raycaster = new THREE.Raycaster(); -const mouse = new THREE.Vector2(); -const onClickPosition = new THREE.Vector2(); - -init(); - -function init() { - container = document.getElementById('container'); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xeeeeee); - - camera = new THREE.PerspectiveCamera(45, width / height, 1, 1000); - camera.position.x = -30; - camera.position.y = 40; - camera.position.z = 50; - camera.lookAt(scene.position); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // A cube, in the middle. - cubeTexture = new THREE.Texture(undefined, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping); - cubeTexture.colorSpace = THREE.SRGBColorSpace; - canvas = new CanvasTexture(cubeTexture); - const cubeMaterial = new THREE.MeshBasicMaterial({ map: cubeTexture }); - const cubeGeometry = new THREE.BoxGeometry(20, 20, 20); - let uvs = cubeGeometry.attributes.uv.array; - // Set a specific texture mapping. - for (let i = 0; i < uvs.length; i++) { - uvs[i] *= 2; - } - - const cube = new THREE.Mesh(cubeGeometry, cubeMaterial); - cube.position.x = 4; - cube.position.y = -5; - cube.position.z = 0; - scene.add(cube); - - // A plane on the left - - planeTexture = new THREE.Texture( - undefined, - THREE.UVMapping, - THREE.MirroredRepeatWrapping, - THREE.MirroredRepeatWrapping, - ); - planeTexture.colorSpace = THREE.SRGBColorSpace; - canvas.addParent(planeTexture); - const planeMaterial = new THREE.MeshBasicMaterial({ map: planeTexture }); - const planeGeometry = new THREE.PlaneGeometry(25, 25, 1, 1); - uvs = planeGeometry.attributes.uv.array; - - // Set a specific texture mapping. - - for (let i = 0; i < uvs.length; i++) { - uvs[i] *= 2; - } - - const plane = new THREE.Mesh(planeGeometry, planeMaterial); - plane.position.x = -16; - plane.position.y = -5; - plane.position.z = 0; - scene.add(plane); - - // A circle on the right. - - circleTexture = new THREE.Texture(undefined, THREE.UVMapping, THREE.RepeatWrapping, THREE.RepeatWrapping); - circleTexture.colorSpace = THREE.SRGBColorSpace; - canvas.addParent(circleTexture); - const circleMaterial = new THREE.MeshBasicMaterial({ map: circleTexture }); - const circleGeometry = new THREE.CircleGeometry(25, 40, 0, Math.PI * 2); - uvs = circleGeometry.attributes.uv.array; - - // Set a specific texture mapping. - - for (let i = 0; i < uvs.length; i++) { - uvs[i] = (uvs[i] - 0.25) * 2; - } - - const circle = new THREE.Mesh(circleGeometry, circleMaterial); - circle.position.x = 24; - circle.position.y = -5; - circle.position.z = 0; - scene.add(circle); - - window.addEventListener('resize', onWindowResize); - container.addEventListener('mousemove', onMouseMove); - - // - - const gui = new GUI(); - gui.title('Circle Texture Settings'); - - gui.add(params, 'wrapS', WRAPPING).onChange(setwrapS); - gui.add(params, 'wrapT', WRAPPING).onChange(setwrapT); - gui.add(params, 'offsetX', 0, 5); - gui.add(params, 'offsetY', 0, 5); - gui.add(params, 'repeatX', 0, 5); - gui.add(params, 'repeatY', 0, 5); - gui.add(params, 'rotation', 0, 2 * Math.PI); - gui.open(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onMouseMove(evt) { - evt.preventDefault(); - - const array = getMousePosition(container, evt.clientX, evt.clientY); - onClickPosition.fromArray(array); - - const intersects = getIntersects(onClickPosition, scene.children); - - if (intersects.length > 0 && intersects[0].uv) { - const uv = intersects[0].uv; - intersects[0].object.material.map.transformUv(uv); - canvas.setCrossPosition(uv.x, uv.y); - } -} - -function getMousePosition(dom, x, y) { - const rect = dom.getBoundingClientRect(); - return [(x - rect.left) / rect.width, (y - rect.top) / rect.height]; -} - -function getIntersects(point, objects) { - mouse.set(point.x * 2 - 1, -(point.y * 2) + 1); - - raycaster.setFromCamera(mouse, camera); - - return raycaster.intersectObjects(objects, false); -} - -function animate() { - // update texture parameters - - circleTexture.offset.x = params.offsetX; - circleTexture.offset.y = params.offsetY; - circleTexture.repeat.x = params.repeatX; - circleTexture.repeat.y = params.repeatY; - circleTexture.rotation = params.rotation; - - // - - renderer.render(scene, camera); -} - -function setwrapS(value) { - circleTexture.wrapS = value; - circleTexture.needsUpdate = true; -} - -function setwrapT(value) { - circleTexture.wrapT = value; - circleTexture.needsUpdate = true; -} diff --git a/examples-testing/examples/webgl_read_float_buffer.ts b/examples-testing/examples/webgl_read_float_buffer.ts deleted file mode 100644 index 69f847729..000000000 --- a/examples-testing/examples/webgl_read_float_buffer.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let cameraRTT, sceneRTT, sceneScreen, renderer, zmesh1, zmesh2; - -let mouseX = 0, - mouseY = 0; - -const windowHalfX = window.innerWidth / 2; -const windowHalfY = window.innerHeight / 2; - -let rtTexture, material, quad; - -let delta = 0.01; -let valueNode; - -init(); - -function init() { - container = document.getElementById('container'); - - cameraRTT = new THREE.OrthographicCamera( - window.innerWidth / -2, - window.innerWidth / 2, - window.innerHeight / 2, - window.innerHeight / -2, - 1, - 1000, - ); - cameraRTT.position.z = 500; - - // - - sceneRTT = new THREE.Scene(); - sceneScreen = new THREE.Scene(); - - let light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 0, 1).normalize(); - sceneRTT.add(light); - - light = new THREE.DirectionalLight(0xffd5d5, 4.5); - light.position.set(0, 0, -1).normalize(); - sceneRTT.add(light); - - rtTexture = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, { - minFilter: THREE.LinearFilter, - magFilter: THREE.NearestFilter, - format: THREE.RGBAFormat, - type: THREE.FloatType, - }); - - material = new THREE.ShaderMaterial({ - uniforms: { time: { value: 0.0 } }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragment_shader_pass_1').textContent, - }); - - const materialScreen = new THREE.ShaderMaterial({ - uniforms: { tDiffuse: { value: rtTexture.texture } }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragment_shader_screen').textContent, - - depthWrite: false, - }); - - const plane = new THREE.PlaneGeometry(window.innerWidth, window.innerHeight); - - quad = new THREE.Mesh(plane, material); - quad.position.z = -100; - sceneRTT.add(quad); - - const geometry = new THREE.TorusGeometry(100, 25, 15, 30); - - const mat1 = new THREE.MeshPhongMaterial({ color: 0x9c9c9c, specular: 0xffaa00, shininess: 5 }); - const mat2 = new THREE.MeshPhongMaterial({ color: 0x9c0000, specular: 0xff2200, shininess: 5 }); - - zmesh1 = new THREE.Mesh(geometry, mat1); - zmesh1.position.set(0, 0, 100); - zmesh1.scale.set(1.5, 1.5, 1.5); - sceneRTT.add(zmesh1); - - zmesh2 = new THREE.Mesh(geometry, mat2); - zmesh2.position.set(0, 150, 100); - zmesh2.scale.set(0.75, 0.75, 0.75); - sceneRTT.add(zmesh2); - - quad = new THREE.Mesh(plane, materialScreen); - quad.position.z = -100; - sceneScreen.add(quad); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - valueNode = document.getElementById('values'); - - document.addEventListener('mousemove', onDocumentMouseMove); -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.0015; - - if (zmesh1 && zmesh2) { - zmesh1.rotation.y = -time; - zmesh2.rotation.y = -time + Math.PI / 2; - } - - if (material.uniforms['time'].value > 1 || material.uniforms['time'].value < 0) { - delta *= -1; - } - - material.uniforms['time'].value += delta; - - renderer.clear(); - - // Render first scene into texture - - renderer.setRenderTarget(rtTexture); - renderer.clear(); - renderer.render(sceneRTT, cameraRTT); - - // Render full screen quad with generated texture - - renderer.setRenderTarget(null); - renderer.render(sceneScreen, cameraRTT); - - const read = new Float32Array(4); - renderer.readRenderTargetPixels(rtTexture, windowHalfX + mouseX, windowHalfY - mouseY, 1, 1, read); - - valueNode.innerHTML = 'r:' + read[0] + '
g:' + read[1] + '
b:' + read[2]; -} diff --git a/examples-testing/examples/webgl_refraction.ts b/examples-testing/examples/webgl_refraction.ts deleted file mode 100644 index b8ef7143d..000000000 --- a/examples-testing/examples/webgl_refraction.ts +++ /dev/null @@ -1,138 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Refractor } from 'three/addons/objects/Refractor.js'; -import { WaterRefractionShader } from 'three/addons/shaders/WaterRefractionShader.js'; - -let camera, scene, renderer, timer; - -let refractor, smallSphere; - -init(); - -async function init() { - const container = document.getElementById('container'); - - timer = new THREE.Timer(); - timer.connect(document); - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); - camera.position.set(0, 75, 160); - - // refractor - - const refractorGeometry = new THREE.PlaneGeometry(90, 90); - - refractor = new Refractor(refractorGeometry, { - color: 0xcbcbcb, - textureWidth: 1024, - textureHeight: 1024, - shader: WaterRefractionShader, - }); - - refractor.position.set(0, 50, 0); - - scene.add(refractor); - - // load dudv map for distortion effect - - const loader = new THREE.TextureLoader(); - const dudvMap = await loader.loadAsync('textures/waterdudv.jpg'); - - dudvMap.wrapS = dudvMap.wrapT = THREE.RepeatWrapping; - refractor.material.uniforms.tDudv.value = dudvMap; - - // - - const geometry = new THREE.IcosahedronGeometry(5, 0); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x333333, flatShading: true }); - smallSphere = new THREE.Mesh(geometry, material); - scene.add(smallSphere); - - // walls - const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); - - const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeTop.position.y = 100; - planeTop.rotateX(Math.PI / 2); - scene.add(planeTop); - - const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeBottom.rotateX(-Math.PI / 2); - scene.add(planeBottom); - - const planeBack = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); - planeBack.position.z = -50; - planeBack.position.y = 50; - scene.add(planeBack); - - const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); - planeRight.position.x = 50; - planeRight.position.y = 50; - planeRight.rotateY(-Math.PI / 2); - scene.add(planeRight); - - const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); - planeLeft.position.x = -50; - planeLeft.position.y = 50; - planeLeft.rotateY(Math.PI / 2); - scene.add(planeLeft); - - // lights - const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); - mainLight.position.y = 60; - scene.add(mainLight); - - const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); - greenLight.position.set(550, 50, 0); - scene.add(greenLight); - - const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); - redLight.position.set(-550, 50, 0); - scene.add(redLight); - - const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); - blueLight.position.set(0, 50, 550); - scene.add(blueLight); - - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 40, 0); - controls.maxDistance = 400; - controls.minDistance = 10; - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const time = timer.getElapsed(); - - refractor.material.uniforms.time.value = time; - - smallSphere.position.set(Math.cos(time) * 30, Math.abs(Math.cos(time * 2)) * 20 + 5, Math.sin(time) * 30); - smallSphere.rotation.y = Math.PI / 2 - time; - smallSphere.rotation.z = time * 8; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_rtt.ts b/examples-testing/examples/webgl_rtt.ts deleted file mode 100644 index b80e78ed3..000000000 --- a/examples-testing/examples/webgl_rtt.ts +++ /dev/null @@ -1,171 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -let container, stats; - -let cameraRTT, camera, sceneRTT, sceneScreen, scene, renderer, zmesh1, zmesh2; - -let mouseX = 0, - mouseY = 0; - -const windowHalfX = window.innerWidth / 2; -const windowHalfY = window.innerHeight / 2; - -let rtTexture, material, quad; - -let delta = 0.01; - -init(); - -function init() { - container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 100; - - cameraRTT = new THREE.OrthographicCamera( - window.innerWidth / -2, - window.innerWidth / 2, - window.innerHeight / 2, - window.innerHeight / -2, - 1, - 1000, - ); - cameraRTT.position.z = 500; - - // - - scene = new THREE.Scene(); - sceneRTT = new THREE.Scene(); - sceneScreen = new THREE.Scene(); - - let light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 0, 1).normalize(); - sceneRTT.add(light); - - light = new THREE.DirectionalLight(0xffd5d5, 4.5); - light.position.set(0, 0, -1).normalize(); - sceneRTT.add(light); - - rtTexture = new THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight); - - material = new THREE.ShaderMaterial({ - uniforms: { time: { value: 0.0 } }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragment_shader_pass_1').textContent, - }); - - const materialScreen = new THREE.ShaderMaterial({ - uniforms: { tDiffuse: { value: rtTexture.texture } }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragment_shader_screen').textContent, - - depthWrite: false, - }); - - const plane = new THREE.PlaneGeometry(window.innerWidth, window.innerHeight); - - quad = new THREE.Mesh(plane, material); - quad.position.z = -100; - sceneRTT.add(quad); - - const torusGeometry = new THREE.TorusGeometry(100, 25, 15, 30); - - const mat1 = new THREE.MeshPhongMaterial({ color: 0x9c9c9c, specular: 0xffaa00, shininess: 5 }); - const mat2 = new THREE.MeshPhongMaterial({ color: 0x9c0000, specular: 0xff2200, shininess: 5 }); - - zmesh1 = new THREE.Mesh(torusGeometry, mat1); - zmesh1.position.set(0, 0, 100); - zmesh1.scale.set(1.5, 1.5, 1.5); - sceneRTT.add(zmesh1); - - zmesh2 = new THREE.Mesh(torusGeometry, mat2); - zmesh2.position.set(0, 150, 100); - zmesh2.scale.set(0.75, 0.75, 0.75); - sceneRTT.add(zmesh2); - - quad = new THREE.Mesh(plane, materialScreen); - quad.position.z = -100; - sceneScreen.add(quad); - - const n = 5, - geometry = new THREE.SphereGeometry(10, 64, 32), - material2 = new THREE.MeshBasicMaterial({ color: 0xffffff, map: rtTexture.texture }); - - for (let j = 0; j < n; j++) { - for (let i = 0; i < n; i++) { - const mesh = new THREE.Mesh(geometry, material2); - - mesh.position.x = (i - (n - 1) / 2) * 20; - mesh.position.y = (j - (n - 1) / 2) * 20; - mesh.position.z = 0; - - mesh.rotation.y = -Math.PI / 2; - - scene.add(mesh); - } - } - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - - container.appendChild(renderer.domElement); - - stats = new Stats(); - container.appendChild(stats.dom); - - document.addEventListener('mousemove', onDocumentMouseMove); -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -// - -function animate() { - render(); - stats.update(); -} - -function render() { - const time = Date.now() * 0.0015; - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - if (zmesh1 && zmesh2) { - zmesh1.rotation.y = -time; - zmesh2.rotation.y = -time + Math.PI / 2; - } - - if (material.uniforms['time'].value > 1 || material.uniforms['time'].value < 0) { - delta *= -1; - } - - material.uniforms['time'].value += delta; - - // Render first scene into texture - - renderer.setRenderTarget(rtTexture); - renderer.clear(); - renderer.render(sceneRTT, cameraRTT); - - // Render full screen quad with generated texture - - renderer.setRenderTarget(null); - renderer.clear(); - renderer.render(sceneScreen, cameraRTT); - - // Render second scene to screen - // (using first scene as regular texture) - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_shader.ts b/examples-testing/examples/webgl_shader.ts deleted file mode 100644 index 47a6c7ece..000000000 --- a/examples-testing/examples/webgl_shader.ts +++ /dev/null @@ -1,50 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; - -let uniforms; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); - - scene = new THREE.Scene(); - - const geometry = new THREE.PlaneGeometry(2, 2); - - uniforms = { - time: { value: 1.0 }, - }; - - const material = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - uniforms['time'].value = performance.now() / 1000; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_shader_lava.ts b/examples-testing/examples/webgl_shader_lava.ts deleted file mode 100644 index 0c974f5b9..000000000 --- a/examples-testing/examples/webgl_shader_lava.ts +++ /dev/null @@ -1,104 +0,0 @@ -import * as THREE from 'three'; - -import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; -import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; -import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; -import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; - -let camera, renderer, composer, timer; - -let uniforms, mesh; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 1, 3000); - camera.position.z = 4; - - const scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - const textureLoader = new THREE.TextureLoader(); - - const cloudTexture = textureLoader.load('textures/lava/cloud.png'); - const lavaTexture = textureLoader.load('textures/lava/lavatile.jpg'); - - lavaTexture.colorSpace = THREE.SRGBColorSpace; - - cloudTexture.wrapS = cloudTexture.wrapT = THREE.RepeatWrapping; - lavaTexture.wrapS = lavaTexture.wrapT = THREE.RepeatWrapping; - - uniforms = { - fogDensity: { value: 0.45 }, - fogColor: { value: new THREE.Vector3(0, 0, 0) }, - time: { value: 1.0 }, - uvScale: { value: new THREE.Vector2(3.0, 1.0) }, - texture1: { value: cloudTexture }, - texture2: { value: lavaTexture }, - }; - - const size = 0.65; - - const material = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - }); - - mesh = new THREE.Mesh(new THREE.TorusGeometry(size, 0.3, 30, 30), material); - mesh.rotation.x = 0.3; - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - container.appendChild(renderer.domElement); - - // - - const renderModel = new RenderPass(scene, camera); - const effectBloom = new BloomPass(1.25); - const outputPass = new OutputPass(); - - composer = new EffectComposer(renderer); - - composer.addPass(renderModel); - composer.addPass(effectBloom); - composer.addPass(outputPass); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - composer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const delta = 5 * timer.getDelta(); - - uniforms['time'].value += 0.2 * delta; - - mesh.rotation.y += 0.0125 * delta; - mesh.rotation.x += 0.05 * delta; - - renderer.clear(); - composer.render(0.01); -} diff --git a/examples-testing/examples/webgl_shaders_ocean.ts b/examples-testing/examples/webgl_shaders_ocean.ts deleted file mode 100644 index ab123d972..000000000 --- a/examples-testing/examples/webgl_shaders_ocean.ts +++ /dev/null @@ -1,200 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Water } from 'three/addons/objects/Water.js'; -import { Sky } from 'three/addons/objects/Sky.js'; -import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; - -let container, stats, timer; -let camera, scene, renderer; -let controls, water, sun, sky, mesh, bloomPass; - -init(); - -function init() { - container = document.getElementById('container'); - - // - - renderer = new THREE.WebGLRenderer({ outputBufferType: THREE.HalfFloatType }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.1; - container.appendChild(renderer.domElement); - - bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); - bloomPass.threshold = 0; - bloomPass.strength = 0.1; - bloomPass.radius = 0; - renderer.setEffects([bloomPass]); - - // - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 1, 20000); - camera.position.set(30, 30, 100); - - timer = new THREE.Timer(); - - // - - sun = new THREE.Vector3(); - - // Water - - const waterGeometry = new THREE.PlaneGeometry(10000, 10000); - - water = new Water(waterGeometry, { - textureWidth: 512, - textureHeight: 512, - waterNormals: new THREE.TextureLoader().load('textures/waternormals.jpg', function (texture) { - texture.wrapS = texture.wrapT = THREE.RepeatWrapping; - }), - sunDirection: new THREE.Vector3(), - sunColor: 0xffffff, - waterColor: 0x001e0f, - distortionScale: 3.7, - fog: scene.fog !== undefined, - }); - - water.rotation.x = -Math.PI / 2; - - scene.add(water); - - // Skybox - - sky = new Sky(); - sky.scale.setScalar(10000); - scene.add(sky); - - const skyUniforms = sky.material.uniforms; - - skyUniforms['turbidity'].value = 10; - skyUniforms['rayleigh'].value = 2; - skyUniforms['mieCoefficient'].value = 0.005; - skyUniforms['mieDirectionalG'].value = 0.8; - skyUniforms['cloudCoverage'].value = 0.4; - skyUniforms['cloudDensity'].value = 0.5; - skyUniforms['cloudElevation'].value = 0.5; - - const parameters = { - elevation: 2, - azimuth: 180, - exposure: 0.1, - }; - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - const sceneEnv = new THREE.Scene(); - - let renderTarget; - - function updateSun() { - const phi = THREE.MathUtils.degToRad(90 - parameters.elevation); - const theta = THREE.MathUtils.degToRad(parameters.azimuth); - - sun.setFromSphericalCoords(1, phi, theta); - - sky.material.uniforms['sunPosition'].value.copy(sun); - water.material.uniforms['sunDirection'].value.copy(sun).normalize(); - - if (renderTarget !== undefined) renderTarget.dispose(); - - sceneEnv.add(sky); - renderTarget = pmremGenerator.fromScene(sceneEnv); - scene.add(sky); - - scene.environment = renderTarget.texture; - } - - updateSun(); - - // - - const geometry = new THREE.BoxGeometry(30, 30, 30); - const material = new THREE.MeshStandardMaterial({ roughness: 0 }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI * 0.495; - controls.target.set(0, 10, 0); - controls.minDistance = 40.0; - controls.maxDistance = 200.0; - controls.update(); - - // - - stats = new Stats(); - container.appendChild(stats.dom); - - // GUI - - const gui = new GUI(); - - const folderSky = gui.addFolder('Sky'); - folderSky.add(parameters, 'elevation', 0, 90, 0.1).onChange(updateSun); - folderSky.add(parameters, 'azimuth', -180, 180, 0.1).onChange(updateSun); - folderSky.add(parameters, 'exposure', 0, 1, 0.0001).onChange(function (value) { - renderer.toneMappingExposure = value; - }); - folderSky.open(); - - const waterUniforms = water.material.uniforms; - - const folderWater = gui.addFolder('Water'); - folderWater.add(waterUniforms.distortionScale, 'value', 0, 8, 0.1).name('distortionScale'); - folderWater.add(waterUniforms.size, 'value', 0.1, 10, 0.1).name('size'); - folderWater.open(); - - const folderBloom = gui.addFolder('Bloom'); - folderBloom.add(bloomPass, 'strength', 0, 3, 0.01); - folderBloom.add(bloomPass, 'radius', 0, 1, 0.01); - folderBloom.open(); - - const folderClouds = gui.addFolder('Clouds'); - folderClouds.add(skyUniforms.cloudCoverage, 'value', 0, 1, 0.01).name('coverage'); - folderClouds.add(skyUniforms.cloudDensity, 'value', 0, 1, 0.01).name('density'); - folderClouds.add(skyUniforms.cloudElevation, 'value', 0, 1, 0.01).name('elevation'); - folderClouds.open(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - render(); - stats.update(); -} - -function render() { - const time = performance.now() * 0.001; - - mesh.position.y = Math.sin(time) * 20 + 5; - mesh.rotation.x = time * 0.5; - mesh.rotation.z = time * 0.51; - - const delta = timer.getDelta(); - - water.material.uniforms['time'].value += delta; - sky.material.uniforms['time'].value = time; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_shaders_sky.ts b/examples-testing/examples/webgl_shaders_sky.ts deleted file mode 100644 index 5210662b0..000000000 --- a/examples-testing/examples/webgl_shaders_sky.ts +++ /dev/null @@ -1,127 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Sky } from 'three/addons/objects/Sky.js'; - -let camera, scene, renderer; - -let sky, sun; - -let sphere, cubeCamera; - -init(); - -function initSky() { - // Add Sky - sky = new Sky(); - sky.scale.setScalar(450000); - scene.add(sky); - - sun = new THREE.Vector3(); - - /// GUI - - const effectController = { - turbidity: 10, - rayleigh: 3, - mieCoefficient: 0.005, - mieDirectionalG: 0.7, - elevation: 65, - azimuth: 0, - exposure: 0.05, - cloudCoverage: 0.4, - cloudDensity: 0.4, - cloudElevation: 0.5, - showSunDisc: true, - }; - - function guiChanged() { - const uniforms = sky.material.uniforms; - uniforms['turbidity'].value = effectController.turbidity; - uniforms['rayleigh'].value = effectController.rayleigh; - uniforms['mieCoefficient'].value = effectController.mieCoefficient; - uniforms['mieDirectionalG'].value = effectController.mieDirectionalG; - uniforms['cloudCoverage'].value = effectController.cloudCoverage; - uniforms['cloudDensity'].value = effectController.cloudDensity; - uniforms['cloudElevation'].value = effectController.cloudElevation; - uniforms['showSunDisc'].value = effectController.showSunDisc; - - const phi = THREE.MathUtils.degToRad(90 - effectController.elevation); - const theta = THREE.MathUtils.degToRad(effectController.azimuth); - - sun.setFromSphericalCoords(1, phi, theta); - - uniforms['sunPosition'].value.copy(sun); - - renderer.toneMappingExposure = effectController.exposure; - } - - const gui = new GUI(); - - gui.add(effectController, 'turbidity', 0.0, 20.0, 0.1).onChange(guiChanged); - gui.add(effectController, 'rayleigh', 0.0, 4, 0.001).onChange(guiChanged); - gui.add(effectController, 'mieCoefficient', 0.0, 0.1, 0.001).onChange(guiChanged); - gui.add(effectController, 'mieDirectionalG', 0.0, 1, 0.001).onChange(guiChanged); - gui.add(effectController, 'elevation', 0, 90, 0.1).onChange(guiChanged); - gui.add(effectController, 'azimuth', -180, 180, 0.1).onChange(guiChanged); - gui.add(effectController, 'exposure', 0, 1, 0.0001).onChange(guiChanged); - gui.add(effectController, 'showSunDisc').onChange(guiChanged); - - const folderClouds = gui.addFolder('Clouds'); - folderClouds.add(effectController, 'cloudCoverage', 0, 1, 0.01).name('coverage').onChange(guiChanged); - folderClouds.add(effectController, 'cloudDensity', 0, 1, 0.01).name('density').onChange(guiChanged); - folderClouds.add(effectController, 'cloudElevation', 0, 1, 0.01).name('elevation').onChange(guiChanged); - - guiChanged(); -} - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 100, 2000000); - camera.position.set(0, 100, 2000); - - scene = new THREE.Scene(); - - const cubeRenderTarget = new THREE.WebGLCubeRenderTarget(256, { type: THREE.HalfFloatType }); - cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); - - sphere = new THREE.Mesh( - new THREE.SphereGeometry(400, 64, 32), - new THREE.MeshBasicMaterial({ envMap: cubeRenderTarget.texture }), - ); - scene.add(sphere); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.5; - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - //controls.maxPolarAngle = Math.PI / 2; - controls.enableZoom = false; - controls.enablePan = false; - - initSky(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - sky.material.uniforms['time'].value = performance.now() * 0.001; - - sphere.visible = false; - cubeCamera.update(renderer, scene); - sphere.visible = true; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_shadow_contact.ts b/examples-testing/examples/webgl_shadow_contact.ts deleted file mode 100644 index f402fa20d..000000000 --- a/examples-testing/examples/webgl_shadow_contact.ts +++ /dev/null @@ -1,272 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; -import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; - -let camera, scene, renderer, stats, gui; - -const meshes = []; - -const PLANE_WIDTH = 2.5; -const PLANE_HEIGHT = 2.5; -const CAMERA_HEIGHT = 0.3; - -const state = { - shadow: { - blur: 3.5, - darkness: 1, - opacity: 1, - }, - plane: { - color: '#ffffff', - opacity: 1, - }, - showWireframe: false, -}; - -let shadowGroup, - renderTarget, - renderTargetBlur, - shadowCamera, - cameraHelper, - depthMaterial, - horizontalBlurMaterial, - verticalBlurMaterial; - -let plane, blurPlane, fillPlane; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0.5, 1, 2); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); - - // add the example meshes - - const geometries = [ - new THREE.BoxGeometry(0.4, 0.4, 0.4), - new THREE.IcosahedronGeometry(0.3), - new THREE.TorusKnotGeometry(0.4, 0.05, 256, 24, 1, 3), - ]; - - const material = new THREE.MeshNormalMaterial(); - - for (let i = 0, l = geometries.length; i < l; i++) { - const angle = (i / l) * Math.PI * 2; - - const geometry = geometries[i]; - const mesh = new THREE.Mesh(geometry, material); - mesh.position.y = 0.1; - mesh.position.x = Math.cos(angle) / 2.0; - mesh.position.z = Math.sin(angle) / 2.0; - scene.add(mesh); - meshes.push(mesh); - } - - // the container, if you need to move the plane just move this - shadowGroup = new THREE.Group(); - shadowGroup.position.y = -0.3; - scene.add(shadowGroup); - - // the render target that will show the shadows in the plane texture - renderTarget = new THREE.WebGLRenderTarget(512, 512); - renderTarget.texture.generateMipmaps = false; - - // the render target that we will use to blur the first render target - renderTargetBlur = new THREE.WebGLRenderTarget(512, 512); - renderTargetBlur.texture.generateMipmaps = false; - - // make a plane and make it face up - const planeGeometry = new THREE.PlaneGeometry(PLANE_WIDTH, PLANE_HEIGHT).rotateX(Math.PI / 2); - const planeMaterial = new THREE.MeshBasicMaterial({ - map: renderTarget.texture, - opacity: state.shadow.opacity, - transparent: true, - depthWrite: false, - }); - plane = new THREE.Mesh(planeGeometry, planeMaterial); - // make sure it's rendered after the fillPlane - plane.renderOrder = 1; - shadowGroup.add(plane); - - // the y from the texture is flipped! - plane.scale.y = -1; - - // the plane onto which to blur the texture - blurPlane = new THREE.Mesh(planeGeometry); - blurPlane.visible = false; - shadowGroup.add(blurPlane); - - // the plane with the color of the ground - const fillPlaneMaterial = new THREE.MeshBasicMaterial({ - color: state.plane.color, - opacity: state.plane.opacity, - transparent: true, - depthWrite: false, - }); - fillPlane = new THREE.Mesh(planeGeometry, fillPlaneMaterial); - fillPlane.rotateX(Math.PI); - shadowGroup.add(fillPlane); - - // the camera to render the depth material from - shadowCamera = new THREE.OrthographicCamera( - -PLANE_WIDTH / 2, - PLANE_WIDTH / 2, - PLANE_HEIGHT / 2, - -PLANE_HEIGHT / 2, - 0, - CAMERA_HEIGHT, - ); - shadowCamera.rotation.x = Math.PI / 2; // get the camera to look up - shadowGroup.add(shadowCamera); - - cameraHelper = new THREE.CameraHelper(shadowCamera); - - // like MeshDepthMaterial, but goes from black to transparent - depthMaterial = new THREE.MeshDepthMaterial(); - depthMaterial.userData.darkness = { value: state.shadow.darkness }; - depthMaterial.onBeforeCompile = function (shader) { - shader.uniforms.darkness = depthMaterial.userData.darkness; - shader.fragmentShader = /* glsl */ ` - uniform float darkness; - ${shader.fragmentShader.replace( - 'gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );', - 'gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * darkness );', - )} - `; - }; - - depthMaterial.depthTest = false; - depthMaterial.depthWrite = false; - - horizontalBlurMaterial = new THREE.ShaderMaterial(HorizontalBlurShader); - horizontalBlurMaterial.depthTest = false; - - verticalBlurMaterial = new THREE.ShaderMaterial(VerticalBlurShader); - verticalBlurMaterial.depthTest = false; - - // - - gui = new GUI(); - const shadowFolder = gui.addFolder('shadow'); - shadowFolder.open(); - const planeFolder = gui.addFolder('plane'); - planeFolder.open(); - - shadowFolder.add(state.shadow, 'blur', 0, 15, 0.1); - shadowFolder.add(state.shadow, 'darkness', 1, 5, 0.1).onChange(function () { - depthMaterial.userData.darkness.value = state.shadow.darkness; - }); - shadowFolder.add(state.shadow, 'opacity', 0, 1, 0.01).onChange(function () { - plane.material.opacity = state.shadow.opacity; - }); - planeFolder.addColor(state.plane, 'color').onChange(function () { - fillPlane.material.color = new THREE.Color(state.plane.color); - }); - planeFolder.add(state.plane, 'opacity', 0, 1, 0.01).onChange(function () { - fillPlane.material.opacity = state.plane.opacity; - }); - - gui.add(state, 'showWireframe').onChange(function () { - if (state.showWireframe) { - scene.add(cameraHelper); - } else { - scene.remove(cameraHelper); - } - }); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - new OrbitControls(camera, renderer.domElement); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// renderTarget --> blurPlane (horizontalBlur) --> renderTargetBlur --> blurPlane (verticalBlur) --> renderTarget -function blurShadow(amount) { - blurPlane.visible = true; - - // blur horizontally and draw in the renderTargetBlur - blurPlane.material = horizontalBlurMaterial; - blurPlane.material.uniforms.tDiffuse.value = renderTarget.texture; - horizontalBlurMaterial.uniforms.h.value = (amount * 1) / 256; - - renderer.setRenderTarget(renderTargetBlur); - renderer.render(blurPlane, shadowCamera); - - // blur vertically and draw in the main renderTarget - blurPlane.material = verticalBlurMaterial; - blurPlane.material.uniforms.tDiffuse.value = renderTargetBlur.texture; - verticalBlurMaterial.uniforms.v.value = (amount * 1) / 256; - - renderer.setRenderTarget(renderTarget); - renderer.render(blurPlane, shadowCamera); - - blurPlane.visible = false; -} - -function animate() { - meshes.forEach(mesh => { - mesh.rotation.x += 0.01; - mesh.rotation.y += 0.02; - }); - - // - - // remove the background - const initialBackground = scene.background; - scene.background = null; - - // force the depthMaterial to everything - cameraHelper.visible = false; - scene.overrideMaterial = depthMaterial; - - // set renderer clear alpha - const initialClearAlpha = renderer.getClearAlpha(); - renderer.setClearAlpha(0); - - // render to the render target to get the depths - renderer.setRenderTarget(renderTarget); - renderer.render(scene, shadowCamera); - - // and reset the override material - scene.overrideMaterial = null; - cameraHelper.visible = true; - - blurShadow(state.shadow.blur); - - // a second pass to reduce the artifacts - // (0.4 is the minimum blur amount so that the artifacts are gone) - blurShadow(state.shadow.blur * 0.4); - - // reset and render the normal scene - renderer.setRenderTarget(null); - renderer.setClearAlpha(initialClearAlpha); - scene.background = initialBackground; - - renderer.render(scene, camera); - stats.update(); -} diff --git a/examples-testing/examples/webgl_shadowmap.ts b/examples-testing/examples/webgl_shadowmap.ts deleted file mode 100644 index 9557bb051..000000000 --- a/examples-testing/examples/webgl_shadowmap.ts +++ /dev/null @@ -1,310 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; -import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; - -const SHADOW_MAP_WIDTH = 2048, - SHADOW_MAP_HEIGHT = 1024; - -const SCREEN_WIDTH = window.innerWidth; -const SCREEN_HEIGHT = window.innerHeight; -const FLOOR = -250; - -let camera, controls, scene, renderer; -let container, stats; - -const NEAR = 10, - FAR = 3000; - -let mixer; - -const morphs = []; - -let light; -let lightShadowMapViewer; - -const timer = new THREE.Timer(); -timer.connect(document); - -let showHUD = false; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // CAMERA - - camera = new THREE.PerspectiveCamera(23, SCREEN_WIDTH / SCREEN_HEIGHT, NEAR, FAR); - camera.position.set(700, 50, 1900); - - // SCENE - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x59472b); - scene.fog = new THREE.Fog(0x59472b, 1000, FAR); - - // LIGHTS - - const ambient = new THREE.AmbientLight(0xffffff); - scene.add(ambient); - - light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 1500, 1000); - light.castShadow = true; - light.shadow.camera.top = 2000; - light.shadow.camera.bottom = -2000; - light.shadow.camera.left = -2000; - light.shadow.camera.right = 2000; - light.shadow.camera.near = 1200; - light.shadow.camera.far = 2500; - light.shadow.bias = 0.0001; - - light.shadow.mapSize.width = SHADOW_MAP_WIDTH; - light.shadow.mapSize.height = SHADOW_MAP_HEIGHT; - - scene.add(light); - - createHUD(); - createScene(); - - // RENDERER - - renderer = new THREE.WebGLRenderer({ antialias: true, reversedDepthBuffer: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - renderer.autoClear = false; - - // - - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - - // CONTROLS - - controls = new OrbitControls(camera, renderer.domElement); - controls.enablePan = false; - controls.maxPolarAngle = Math.PI / 2; - controls.minDistance = 200; - controls.maxDistance = 2200; - - controls.target.set(0, -75, 25); - controls.update(); - - // STATS - - stats = new Stats(); - //container.appendChild( stats.dom ); - - // - - window.addEventListener('resize', onWindowResize); - window.addEventListener('keydown', onKeyDown); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onKeyDown(event) { - switch (event.keyCode) { - case 84 /*t*/: - showHUD = !showHUD; - break; - } -} - -function createHUD() { - lightShadowMapViewer = new ShadowMapViewer(light); - lightShadowMapViewer.position.x = 10; - lightShadowMapViewer.position.y = SCREEN_HEIGHT - SHADOW_MAP_HEIGHT / 4 - 10; - lightShadowMapViewer.size.width = SHADOW_MAP_WIDTH / 4; - lightShadowMapViewer.size.height = SHADOW_MAP_HEIGHT / 4; - lightShadowMapViewer.update(); -} - -function createScene() { - // GROUND - - const geometry = new THREE.PlaneGeometry(100, 100); - const planeMaterial = new THREE.MeshPhongMaterial({ color: 0xffdd99 }); - - const ground = new THREE.Mesh(geometry, planeMaterial); - - ground.position.set(0, FLOOR, 0); - ground.rotation.x = -Math.PI / 2; - ground.scale.set(100, 100, 100); - - ground.castShadow = false; - ground.receiveShadow = true; - - scene.add(ground); - - // TEXT - - const loader = new FontLoader(); - loader.load('fonts/helvetiker_bold.typeface.json', function (font) { - const textGeo = new TextGeometry('THREE.JS', { - font: font, - - size: 200, - depth: 50, - curveSegments: 12, - - bevelThickness: 2, - bevelSize: 5, - bevelEnabled: true, - }); - - textGeo.computeBoundingBox(); - const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); - - const textMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000, specular: 0xffffff }); - - const mesh = new THREE.Mesh(textGeo, textMaterial); - mesh.position.x = centerOffset; - mesh.position.y = FLOOR + 67; - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); - }); - - // CUBES - - const cubes1 = new THREE.Mesh(new THREE.BoxGeometry(1500, 220, 150), planeMaterial); - - cubes1.position.y = FLOOR - 50; - cubes1.position.z = 20; - - cubes1.castShadow = true; - cubes1.receiveShadow = true; - - scene.add(cubes1); - - const cubes2 = new THREE.Mesh(new THREE.BoxGeometry(1600, 170, 250), planeMaterial); - - cubes2.position.y = FLOOR - 50; - cubes2.position.z = 20; - - cubes2.castShadow = true; - cubes2.receiveShadow = true; - - scene.add(cubes2); - - // MORPHS - - mixer = new THREE.AnimationMixer(scene); - - function addMorph(mesh, clip, speed, duration, x, y, z, fudgeColor) { - mesh = mesh.clone(); - mesh.material = mesh.material.clone(); - - if (fudgeColor) { - mesh.material.color.offsetHSL(0, Math.random() * 0.5 - 0.25, Math.random() * 0.5 - 0.25); - } - - mesh.speed = speed; - - mixer - .clipAction(clip, mesh) - .setDuration(duration) - // to shift the playback out of phase: - .startAt(-duration * Math.random()) - .play(); - - mesh.position.set(x, y, z); - mesh.rotation.y = Math.PI / 2; - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); - - morphs.push(mesh); - } - - const gltfloader = new GLTFLoader(); - - gltfloader.load('models/gltf/Horse.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - - const clip = gltf.animations[0]; - - addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, 300, true); - addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, 450, true); - addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, 600, true); - - addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, -300, true); - addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, -450, true); - addMorph(mesh, clip, 550, 1, 100 - Math.random() * 1000, FLOOR, -600, true); - }); - - gltfloader.load('models/gltf/Flamingo.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - const clip = gltf.animations[0]; - - addMorph(mesh, clip, 500, 1, 500 - Math.random() * 500, FLOOR + 350, 40); - }); - - gltfloader.load('models/gltf/Stork.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - const clip = gltf.animations[0]; - - addMorph(mesh, clip, 350, 1, 500 - Math.random() * 500, FLOOR + 350, 340); - }); - - gltfloader.load('models/gltf/Parrot.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - const clip = gltf.animations[0]; - - addMorph(mesh, clip, 450, 0.5, 500 - Math.random() * 500, FLOOR + 300, 700); - }); -} - -function animate() { - timer.update(); - - render(); - stats.update(); -} - -function render() { - const delta = timer.getDelta(); - - mixer.update(delta); - - for (let i = 0; i < morphs.length; i++) { - const morph = morphs[i]; - - morph.position.x += morph.speed * delta; - - if (morph.position.x > 2000) { - morph.position.x = -1000 - Math.random() * 500; - } - } - - controls.update(delta); - - renderer.clear(); - renderer.render(scene, camera); - - // Render debug HUD with shadow map - - if (showHUD) { - lightShadowMapViewer.render(renderer); - } -} diff --git a/examples-testing/examples/webgl_shadowmap_csm.ts b/examples-testing/examples/webgl_shadowmap_csm.ts deleted file mode 100644 index c8e959a0b..000000000 --- a/examples-testing/examples/webgl_shadowmap_csm.ts +++ /dev/null @@ -1,253 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { CSM } from 'three/addons/csm/CSM.js'; -import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; - -let renderer, scene, camera, orthoCamera, controls, csm, csmHelper; - -const params = { - orthographic: false, - fade: false, - shadows: true, - far: 1000, - mode: 'practical', - lightX: -1, - lightY: -1, - lightZ: -1, - margin: 100, - lightFar: 5000, - lightNear: 1, - autoUpdateHelper: true, - updateHelper: function () { - csmHelper.update(); - }, -}; - -init(); - -function updateOrthoCamera() { - const size = controls.target.distanceTo(camera.position); - const aspect = camera.aspect; - - orthoCamera.left = (size * aspect) / -2; - orthoCamera.right = (size * aspect) / 2; - - orthoCamera.top = size / 2; - orthoCamera.bottom = size / -2; - orthoCamera.position.copy(camera.position); - orthoCamera.rotation.copy(camera.rotation); - orthoCamera.updateProjectionMatrix(); -} - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color('#454e61'); - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 5000); - orthoCamera = new THREE.OrthographicCamera(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - renderer.shadowMap.enabled = params.shadows; - renderer.shadowMap.type = THREE.PCFShadowMap; - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI / 2; - camera.position.set(60, 60, 0); - controls.target = new THREE.Vector3(-100, 10, 0); - controls.update(); - - const ambientLight = new THREE.AmbientLight(0xffffff, 1.5); - scene.add(ambientLight); - - const additionalDirectionalLight = new THREE.DirectionalLight(0x000020, 1.5); - additionalDirectionalLight.position - .set(params.lightX, params.lightY, params.lightZ) - .normalize() - .multiplyScalar(-200); - scene.add(additionalDirectionalLight); - - csm = new CSM({ - maxFar: params.far, - cascades: 4, - mode: params.mode, - parent: scene, - shadowMapSize: 1024, - lightDirection: new THREE.Vector3(params.lightX, params.lightY, params.lightZ).normalize(), - camera: camera, - }); - - csmHelper = new CSMHelper(csm); - csmHelper.visible = false; - scene.add(csmHelper); - - const floorMaterial = new THREE.MeshPhongMaterial({ color: '#252a34' }); - csm.setupMaterial(floorMaterial); - - const floor = new THREE.Mesh(new THREE.PlaneGeometry(10000, 10000, 8, 8), floorMaterial); - floor.rotation.x = -Math.PI / 2; - floor.castShadow = true; - floor.receiveShadow = true; - scene.add(floor); - - const material1 = new THREE.MeshPhongMaterial({ color: '#08d9d6' }); - csm.setupMaterial(material1); - - const material2 = new THREE.MeshPhongMaterial({ color: '#ff2e63' }); - csm.setupMaterial(material2); - - const geometry = new THREE.BoxGeometry(10, 10, 10); - - for (let i = 0; i < 40; i++) { - const cube1 = new THREE.Mesh(geometry, i % 2 === 0 ? material1 : material2); - cube1.castShadow = true; - cube1.receiveShadow = true; - scene.add(cube1); - cube1.position.set(-i * 25, 20, 30); - cube1.scale.y = Math.random() * 2 + 6; - - const cube2 = new THREE.Mesh(geometry, i % 2 === 0 ? material2 : material1); - cube2.castShadow = true; - cube2.receiveShadow = true; - scene.add(cube2); - cube2.position.set(-i * 25, 20, -30); - cube2.scale.y = Math.random() * 2 + 6; - } - - const gui = new GUI(); - - gui.add(params, 'orthographic').onChange(function (value) { - csm.camera = value ? orthoCamera : camera; - csm.updateFrustums(); - }); - - gui.add(params, 'fade').onChange(function (value) { - csm.fade = value; - csm.updateFrustums(); - }); - - gui.add(params, 'shadows').onChange(function (value) { - renderer.shadowMap.enabled = value; - - scene.traverse(function (child) { - if (child.material) { - child.material.needsUpdate = true; - } - }); - }); - - gui.add(params, 'far', 1, 5000) - .step(1) - .name('shadow far') - .onChange(function (value) { - csm.maxFar = value; - csm.updateFrustums(); - }); - - gui.add(params, 'mode', ['uniform', 'logarithmic', 'practical']) - .name('frustum split mode') - .onChange(function (value) { - csm.mode = value; - csm.updateFrustums(); - }); - - gui.add(params, 'lightX', -1, 1) - .name('light direction x') - .onChange(function (value) { - csm.lightDirection.x = value; - }); - - gui.add(params, 'lightY', -1, 1) - .name('light direction y') - .onChange(function (value) { - csm.lightDirection.y = value; - }); - - gui.add(params, 'lightZ', -1, 1) - .name('light direction z') - .onChange(function (value) { - csm.lightDirection.z = value; - }); - - gui.add(params, 'margin', 0, 200) - .name('light margin') - .onChange(function (value) { - csm.lightMargin = value; - }); - - gui.add(params, 'lightNear', 1, 10000) - .name('light near') - .onChange(function (value) { - for (let i = 0; i < csm.lights.length; i++) { - csm.lights[i].shadow.camera.near = value; - csm.lights[i].shadow.camera.updateProjectionMatrix(); - } - }); - - gui.add(params, 'lightFar', 1, 10000) - .name('light far') - .onChange(function (value) { - for (let i = 0; i < csm.lights.length; i++) { - csm.lights[i].shadow.camera.far = value; - csm.lights[i].shadow.camera.updateProjectionMatrix(); - } - }); - - const helperFolder = gui.addFolder('helper'); - - helperFolder.add(csmHelper, 'visible'); - - helperFolder.add(csmHelper, 'displayFrustum').onChange(function () { - csmHelper.updateVisibility(); - }); - - helperFolder.add(csmHelper, 'displayPlanes').onChange(function () { - csmHelper.updateVisibility(); - }); - - helperFolder.add(csmHelper, 'displayShadowBounds').onChange(function () { - csmHelper.updateVisibility(); - }); - - helperFolder.add(params, 'autoUpdateHelper').name('auto update'); - - helperFolder.add(params, 'updateHelper').name('update'); - - helperFolder.open(); - - window.addEventListener('resize', function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - updateOrthoCamera(); - csm.updateFrustums(); - - renderer.setSize(window.innerWidth, window.innerHeight); - }); -} - -function animate() { - camera.updateMatrixWorld(); - csm.update(); - controls.update(); - - if (params.orthographic) { - updateOrthoCamera(); - csm.updateFrustums(); - - if (params.autoUpdateHelper) { - csmHelper.update(); - } - - renderer.render(scene, orthoCamera); - } else { - if (params.autoUpdateHelper) { - csmHelper.update(); - } - - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgl_shadowmap_pcss.ts b/examples-testing/examples/webgl_shadowmap_pcss.ts deleted file mode 100644 index de5426883..000000000 --- a/examples-testing/examples/webgl_shadowmap_pcss.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let stats; -let camera, scene, renderer; - -let group; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - // scene - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0xcce0ff, 5, 100); - - // camera - - camera = new THREE.PerspectiveCamera(30, window.innerWidth / window.innerHeight, 1, 10000); - - // We use this particular camera position in order to expose a bug that can sometimes happen presumably - // due to lack of precision when interpolating values over really large triangles. - // It reproduced on at least NVIDIA GTX 1080 and GTX 1050 Ti GPUs when the ground plane was not - // subdivided into segments. - camera.position.x = 7; - camera.position.y = 13; - camera.position.z = 7; - - scene.add(camera); - - // lights - - scene.add(new THREE.AmbientLight(0xaaaaaa, 3)); - - const light = new THREE.DirectionalLight(0xf0f6ff, 4.5); - light.position.set(2, 8, 4); - - light.castShadow = true; - light.shadow.mapSize.width = 1024; - light.shadow.mapSize.height = 1024; - light.shadow.camera.far = 20; - - scene.add(light); - - // scene.add( new DirectionalLightHelper( light ) ); - scene.add(new THREE.CameraHelper(light.shadow.camera)); - - // group - - group = new THREE.Group(); - scene.add(group); - - const geometry = new THREE.SphereGeometry(0.3, 20, 20); - - for (let i = 0; i < 20; i++) { - const material = new THREE.MeshPhongMaterial({ color: Math.random() * 0xffffff }); - - const sphere = new THREE.Mesh(geometry, material); - sphere.position.x = Math.random() - 0.5; - sphere.position.z = Math.random() - 0.5; - sphere.position.normalize(); - sphere.position.multiplyScalar(Math.random() * 2 + 1); - sphere.castShadow = true; - sphere.receiveShadow = true; - sphere.userData.phase = Math.random() * Math.PI; - group.add(sphere); - } - - // ground - - const groundMaterial = new THREE.MeshPhongMaterial({ color: 0x898989 }); - - const ground = new THREE.Mesh(new THREE.PlaneGeometry(20000, 20000, 8, 8), groundMaterial); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - // column - - const column = new THREE.Mesh(new THREE.BoxGeometry(1, 4, 1), groundMaterial); - column.position.y = 2; - column.castShadow = true; - column.receiveShadow = true; - scene.add(column); - - // overwrite shadowmap code - - let shader = THREE.ShaderChunk.shadowmap_pars_fragment; - - shader = shader.replace( - '#ifdef USE_SHADOWMAP', - '#ifdef USE_SHADOWMAP' + document.getElementById('PCSS').textContent, - ); - - shader = shader.replace( - '\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;', - '\t\t\tif ( frustumTest ) {\n' + - document.getElementById('PCSSGetShadow').textContent + - '\n' + - '\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;', - ); - - THREE.ShaderChunk.shadowmap_pars_fragment = shader; - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.setClearColor(scene.fog.color); - - container.appendChild(renderer.domElement); - - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.BasicShadowMap; // PCSS requires reading raw depth values - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI * 0.5; - controls.minDistance = 10; - controls.maxDistance = 75; - controls.target.set(0, 2.5, 0); - controls.update(); - - // performance monitor - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - const time = performance.now() / 1000; - - group.traverse(function (child) { - if ('phase' in child.userData) { - child.position.y = Math.abs(Math.sin(time + child.userData.phase)) * 4 + 0.3; - } - }); - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_shadowmap_performance.ts b/examples-testing/examples/webgl_shadowmap_performance.ts deleted file mode 100644 index 437e986a9..000000000 --- a/examples-testing/examples/webgl_shadowmap_performance.ts +++ /dev/null @@ -1,270 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -let SCREEN_WIDTH = window.innerWidth; -let SCREEN_HEIGHT = window.innerHeight; -const FLOOR = -250; - -const ANIMATION_GROUPS = 25; - -let camera, controls, scene, renderer; -let stats; - -const NEAR = 5, - FAR = 3000; - -let morph, mixer; - -const morphs = [], - animGroups = []; - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - // CAMERA - - camera = new THREE.PerspectiveCamera(23, SCREEN_WIDTH / SCREEN_HEIGHT, NEAR, FAR); - camera.position.set(700, 50, 1900); - - // SCENE - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x59472b); - scene.fog = new THREE.Fog(0x59472b, 1000, FAR); - - // LIGHTS - - const ambient = new THREE.AmbientLight(0xffffff); - scene.add(ambient); - - const sunLight = new THREE.SunLight(0xffffff, 3); - sunLight.position.set(0, 1500, 1000); - sunLight.castShadow = true; - sunLight.shadow.camera.far = FAR; - sunLight.shadow.normalBias = 1; - scene.add(sunLight); - - createScene(); - - // RENDERER - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - renderer.autoClear = false; - - // - - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - - // CONTROLS - - controls = new FirstPersonControls(camera, renderer.domElement); - - controls.lookSpeed = 0.0125; - controls.movementSpeed = 500; - controls.lookVertical = true; - - controls.lookAt(scene.position); - - // STATS - - stats = new Stats(); - container.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - SCREEN_WIDTH = window.innerWidth; - SCREEN_HEIGHT = window.innerHeight; - - camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - camera.updateProjectionMatrix(); - - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); -} - -function createScene() { - // GROUND - - const geometry = new THREE.PlaneGeometry(100, 100); - const planeMaterial = new THREE.MeshPhongMaterial({ color: 0xffdd99 }); - - const ground = new THREE.Mesh(geometry, planeMaterial); - - ground.position.set(0, FLOOR, 0); - ground.rotation.x = -Math.PI / 2; - ground.scale.set(100, 100, 100); - - ground.castShadow = false; - ground.receiveShadow = true; - - scene.add(ground); - - // TEXT - - const loader = new FontLoader(); - loader.load('fonts/helvetiker_bold.typeface.json', function (font) { - const textGeo = new TextGeometry('THREE.JS', { - font: font, - - size: 200, - depth: 50, - curveSegments: 12, - - bevelThickness: 2, - bevelSize: 5, - bevelEnabled: true, - }); - - textGeo.computeBoundingBox(); - const centerOffset = -0.5 * (textGeo.boundingBox.max.x - textGeo.boundingBox.min.x); - - const textMaterial = new THREE.MeshPhongMaterial({ color: 0xff0000, specular: 0xffffff }); - - const mesh = new THREE.Mesh(textGeo, textMaterial); - mesh.position.x = centerOffset; - mesh.position.y = FLOOR + 67; - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); - }); - - // CUBES - - const cubes1 = new THREE.Mesh(new THREE.BoxGeometry(1500, 220, 150), planeMaterial); - - cubes1.position.y = FLOOR - 50; - cubes1.position.z = 20; - - cubes1.castShadow = true; - cubes1.receiveShadow = true; - - scene.add(cubes1); - - const cubes2 = new THREE.Mesh(new THREE.BoxGeometry(1600, 170, 250), planeMaterial); - - cubes2.position.y = FLOOR - 50; - cubes2.position.z = 20; - - cubes2.castShadow = true; - cubes2.receiveShadow = true; - - scene.add(cubes2); - - mixer = new THREE.AnimationMixer(scene); - - for (let i = 0; i !== ANIMATION_GROUPS; ++i) { - const group = new THREE.AnimationObjectGroup(); - animGroups.push(group); - } - - // MORPHS - - function addMorph(mesh, clip, speed, duration, x, y, z, fudgeColor, massOptimization) { - mesh = mesh.clone(); - mesh.material = mesh.material.clone(); - - if (fudgeColor) { - mesh.material.color.offsetHSL(0, Math.random() * 0.5 - 0.25, Math.random() * 0.5 - 0.25); - } - - mesh.speed = speed; - - if (massOptimization) { - const index = Math.floor(Math.random() * ANIMATION_GROUPS), - animGroup = animGroups[index]; - - animGroup.add(mesh); - - if (!mixer.existingAction(clip, animGroup)) { - const randomness = 0.6 * Math.random() - 0.3; - const phase = (index + randomness) / ANIMATION_GROUPS; - - mixer - .clipAction(clip, animGroup) - .setDuration(duration) - .startAt(-duration * phase) - .play(); - } - } else { - mixer - .clipAction(clip, mesh) - .setDuration(duration) - .startAt(-duration * Math.random()) - .play(); - } - - mesh.position.set(x, y, z); - mesh.rotation.y = Math.PI / 2; - - mesh.castShadow = true; - mesh.receiveShadow = true; - - scene.add(mesh); - - morphs.push(mesh); - } - - const gltfLoader = new GLTFLoader(); - gltfLoader.load('models/gltf/Horse.glb', function (gltf) { - const mesh = gltf.scene.children[0]; - const clip = gltf.animations[0]; - - for (let i = -600; i < 601; i += 2) { - addMorph(mesh, clip, 550, 1, 100 - Math.random() * 3000, FLOOR, i, true, true); - } - }); -} - -// - -function animate() { - timer.update(); - - stats.begin(); - render(); - stats.end(); -} - -function render() { - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - for (let i = 0; i < morphs.length; i++) { - morph = morphs[i]; - - morph.position.x += morph.speed * delta; - - if (morph.position.x > 2000) { - morph.position.x = -1000 - Math.random() * 500; - } - } - - controls.update(delta); - - renderer.clear(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_shadowmap_pointlight.ts b/examples-testing/examples/webgl_shadowmap_pointlight.ts deleted file mode 100644 index 8ec939c12..000000000 --- a/examples-testing/examples/webgl_shadowmap_pointlight.ts +++ /dev/null @@ -1,141 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, stats; -let pointLight, pointLight2; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 10, 40); - - scene = new THREE.Scene(); - scene.add(new THREE.AmbientLight(0x111122, 3)); - - // lights - - function createLight(color) { - const intensity = 200; - - const light = new THREE.PointLight(color, intensity, 20); - light.castShadow = true; - light.shadow.bias = -0.005; // reduces self-shadowing on double-sided objects - light.shadow.mapSize.setScalar(128); - light.shadow.radius = 10; - - let geometry = new THREE.SphereGeometry(0.3, 12, 6); - let material = new THREE.MeshBasicMaterial({ color: color }); - material.color.multiplyScalar(intensity); - let sphere = new THREE.Mesh(geometry, material); - light.add(sphere); - - const texture = new THREE.CanvasTexture(generateTexture()); - texture.magFilter = THREE.NearestFilter; - texture.wrapT = THREE.RepeatWrapping; - texture.wrapS = THREE.RepeatWrapping; - texture.repeat.set(1, 4.5); - - geometry = new THREE.SphereGeometry(2, 32, 8); - material = new THREE.MeshPhongMaterial({ - side: THREE.DoubleSide, - alphaMap: texture, - alphaTest: 0.5, - }); - - sphere = new THREE.Mesh(geometry, material); - sphere.castShadow = true; - sphere.receiveShadow = true; - light.add(sphere); - - return light; - } - - pointLight = createLight(0x0088ff); - scene.add(pointLight); - - pointLight2 = createLight(0xff8888); - scene.add(pointLight2); - // - - const geometry = new THREE.BoxGeometry(30, 30, 30); - - const material = new THREE.MeshPhongMaterial({ - color: 0xa0adaf, - shininess: 10, - specular: 0x111111, - side: THREE.BackSide, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.y = 10; - mesh.receiveShadow = true; - scene.add(mesh); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - // renderer.shadowMap.type = THREE.BasicShadowMap; - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 10, 0); - controls.update(); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function generateTexture() { - const canvas = document.createElement('canvas'); - canvas.width = 2; - canvas.height = 2; - - const context = canvas.getContext('2d'); - context.fillStyle = 'white'; - context.fillRect(0, 1, 2, 1); - - return canvas; -} - -function animate() { - let time = performance.now() * 0.001; - - pointLight.position.x = Math.sin(time * 0.6) * 9; - pointLight.position.y = Math.sin(time * 0.7) * 9 + 6; - pointLight.position.z = Math.sin(time * 0.8) * 9; - - pointLight.rotation.x = time; - pointLight.rotation.z = time; - - time += 10000; - - pointLight2.position.x = Math.sin(time * 0.6) * 9; - pointLight2.position.y = Math.sin(time * 0.7) * 9 + 6; - pointLight2.position.z = Math.sin(time * 0.8) * 9; - - pointLight2.rotation.x = time; - pointLight2.rotation.z = time; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_shadowmap_progressive.ts b/examples-testing/examples/webgl_shadowmap_progressive.ts deleted file mode 100644 index 29298630f..000000000 --- a/examples-testing/examples/webgl_shadowmap_progressive.ts +++ /dev/null @@ -1,204 +0,0 @@ -import * as THREE from 'three'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TransformControls } from 'three/addons/controls/TransformControls.js'; -import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js'; - -// ShadowMap + LightMap Res and Number of Directional Lights -const shadowMapRes = 512, - lightMapRes = 1024, - lightCount = 8; -let camera, - scene, - renderer, - controls, - control, - control2, - object = new THREE.Mesh(), - lightOrigin = null, - progressiveSurfacemap; -const dirLights = [], - lightmapObjects = []; -const params = { - Enable: true, - 'Blur Edges': true, - 'Blend Window': 200, - 'Light Radius': 50, - 'Ambient Weight': 0.5, - 'Debug Lightmap': false, -}; -init(); -createGUI(); - -function init() { - // renderer - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // camera - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 100, 200); - camera.name = 'Camera'; - - // scene - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x949494); - scene.fog = new THREE.Fog(0x949494, 1000, 3000); - - // progressive lightmap - progressiveSurfacemap = new ProgressiveLightMap(renderer, lightMapRes); - - // directional lighting "origin" - lightOrigin = new THREE.Group(); - lightOrigin.position.set(60, 150, 100); - scene.add(lightOrigin); - - // transform gizmo - control = new TransformControls(camera, renderer.domElement); - control.addEventListener('dragging-changed', event => { - controls.enabled = !event.value; - }); - control.attach(lightOrigin); - scene.add(control.getHelper()); - - // create 8 directional lights to speed up the convergence - for (let l = 0; l < lightCount; l++) { - const dirLight = new THREE.DirectionalLight(0xffffff, Math.PI / lightCount); - dirLight.name = 'Dir. Light ' + l; - dirLight.position.set(200, 200, 200); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 100; - dirLight.shadow.camera.far = 5000; - dirLight.shadow.camera.right = 150; - dirLight.shadow.camera.left = -150; - dirLight.shadow.camera.top = 150; - dirLight.shadow.camera.bottom = -150; - dirLight.shadow.mapSize.width = shadowMapRes; - dirLight.shadow.mapSize.height = shadowMapRes; - lightmapObjects.push(dirLight); - dirLights.push(dirLight); - } - - // ground - const groundMesh = new THREE.Mesh( - new THREE.PlaneGeometry(600, 600), - new THREE.MeshPhongMaterial({ color: 0xffffff, depthWrite: true }), - ); - groundMesh.position.y = -0.1; - groundMesh.rotation.x = -Math.PI / 2; - groundMesh.name = 'Ground Mesh'; - lightmapObjects.push(groundMesh); - scene.add(groundMesh); - - // model - function loadModel() { - object.traverse(function (child) { - if (child.isMesh) { - child.name = 'Loaded Mesh'; - child.castShadow = true; - child.receiveShadow = true; - child.material = new THREE.MeshPhongMaterial(); - - // This adds the model to the lightmap - lightmapObjects.push(child); - progressiveSurfacemap.addObjectsToLightMap(lightmapObjects); - } else { - child.layers.disableAll(); // Disable Rendering for this - } - }); - scene.add(object); - object.scale.set(2, 2, 2); - object.position.set(0, -16, 0); - control2 = new TransformControls(camera, renderer.domElement); - control2.addEventListener('dragging-changed', event => { - controls.enabled = !event.value; - }); - control2.attach(object); - scene.add(control2.getHelper()); - const lightTarget = new THREE.Group(); - lightTarget.position.set(0, 20, 0); - for (let l = 0; l < dirLights.length; l++) { - dirLights[l].target = lightTarget; - } - - object.add(lightTarget); - } - - const manager = new THREE.LoadingManager(loadModel); - const loader = new GLTFLoader(manager); - loader.load('models/gltf/ShadowmappableMesh.glb', function (obj) { - object = obj.scene.children[0]; - }); - - // controls - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled - controls.dampingFactor = 0.05; - controls.screenSpacePanning = true; - controls.minDistance = 100; - controls.maxDistance = 500; - controls.maxPolarAngle = Math.PI / 1.5; - controls.target.set(0, 100, 0); - - window.addEventListener('resize', onWindowResize); -} - -function createGUI() { - const gui = new GUI({ title: 'Accumulation Settings' }); - gui.add(params, 'Enable'); - gui.add(params, 'Blur Edges'); - gui.add(params, 'Blend Window', 1, 500).step(1); - gui.add(params, 'Light Radius', 0, 200).step(10); - gui.add(params, 'Ambient Weight', 0, 1).step(0.1); - gui.add(params, 'Debug Lightmap'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - // Update the inertia on the orbit controls - controls.update(); - - // Accumulate Surface Maps - if (params['Enable']) { - progressiveSurfacemap.update(camera, params['Blend Window'], params['Blur Edges']); - - if (!progressiveSurfacemap.firstUpdate) { - progressiveSurfacemap.showDebugLightmap(params['Debug Lightmap']); - } - } - - // Manually Update the Directional Lights - for (let l = 0; l < dirLights.length; l++) { - // Sometimes they will be sampled from the target direction - // Sometimes they will be uniformly sampled from the upper hemisphere - if (Math.random() > params['Ambient Weight']) { - dirLights[l].position.set( - lightOrigin.position.x + Math.random() * params['Light Radius'], - lightOrigin.position.y + Math.random() * params['Light Radius'], - lightOrigin.position.z + Math.random() * params['Light Radius'], - ); - } else { - // Uniform Hemispherical Surface Distribution for Ambient Occlusion - const lambda = Math.acos(2 * Math.random() - 1) - 3.14159 / 2.0; - const phi = 2 * 3.14159 * Math.random(); - dirLights[l].position.set( - Math.cos(lambda) * Math.cos(phi) * 300 + object.position.x, - Math.abs(Math.cos(lambda) * Math.sin(phi) * 300) + object.position.y + 20, - Math.sin(lambda) * 300 + object.position.z, - ); - } - } - - // Render Scene - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_shadowmap_viewer.ts b/examples-testing/examples/webgl_shadowmap_viewer.ts deleted file mode 100644 index 2ed16e992..000000000 --- a/examples-testing/examples/webgl_shadowmap_viewer.ts +++ /dev/null @@ -1,181 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; - -let camera, scene, renderer, timer, stats; -let dirLight, spotLight; -let torusKnot, cube; -let dirLightShadowMapViewer, spotLightShadowMapViewer; - -init(); - -function init() { - initScene(); - initShadowMapViewers(); - initMisc(); - - document.body.appendChild(renderer.domElement); - window.addEventListener('resize', onWindowResize); -} - -function initScene() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 15, 35); - - scene = new THREE.Scene(); - - // Lights - - scene.add(new THREE.AmbientLight(0x404040, 3)); - - spotLight = new THREE.SpotLight(0xffffff, 500); - spotLight.name = 'Spot Light'; - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.3; - spotLight.position.set(10, 10, 5); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 8; - spotLight.shadow.camera.far = 30; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - scene.add(spotLight); - - scene.add(new THREE.CameraHelper(spotLight.shadow.camera)); - - dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.name = 'Dir. Light'; - dirLight.position.set(0, 10, 0); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 1; - dirLight.shadow.camera.far = 10; - dirLight.shadow.camera.right = 15; - dirLight.shadow.camera.left = -15; - dirLight.shadow.camera.top = 15; - dirLight.shadow.camera.bottom = -15; - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; - scene.add(dirLight); - - scene.add(new THREE.CameraHelper(dirLight.shadow.camera)); - - // Geometry - let geometry = new THREE.TorusKnotGeometry(25, 8, 75, 20); - let material = new THREE.MeshPhongMaterial({ - color: 0xff0000, - shininess: 150, - specular: 0x222222, - }); - - torusKnot = new THREE.Mesh(geometry, material); - torusKnot.scale.multiplyScalar(1 / 18); - torusKnot.position.y = 3; - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - geometry = new THREE.BoxGeometry(3, 3, 3); - cube = new THREE.Mesh(geometry, material); - cube.position.set(8, 3, 8); - cube.castShadow = true; - cube.receiveShadow = true; - scene.add(cube); - - geometry = new THREE.BoxGeometry(10, 0.15, 10); - material = new THREE.MeshPhongMaterial({ - color: 0xa0adaf, - shininess: 150, - specular: 0x111111, - }); - - const ground = new THREE.Mesh(geometry, material); - ground.scale.multiplyScalar(3); - ground.castShadow = false; - ground.receiveShadow = true; - scene.add(ground); -} - -function initShadowMapViewers() { - dirLightShadowMapViewer = new ShadowMapViewer(dirLight); - spotLightShadowMapViewer = new ShadowMapViewer(spotLight); - resizeShadowMapViewers(); -} - -function initMisc() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.BasicShadowMap; - - // Mouse control - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2, 0); - controls.update(); - - timer = new THREE.Timer(); - timer.connect(document); - - stats = new Stats(); - document.body.appendChild(stats.dom); -} - -function resizeShadowMapViewers() { - const size = window.innerWidth * 0.15; - - dirLightShadowMapViewer.position.x = 10; - dirLightShadowMapViewer.position.y = 10; - dirLightShadowMapViewer.size.width = size; - dirLightShadowMapViewer.size.height = size; - dirLightShadowMapViewer.update(); //Required when setting position or size directly - - spotLightShadowMapViewer.size.set(size, size); - spotLightShadowMapViewer.position.set(size + 20, 10); - // spotLightShadowMapViewer.update(); //NOT required because .set updates automatically -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - resizeShadowMapViewers(); - dirLightShadowMapViewer.updateForWindowResize(); - spotLightShadowMapViewer.updateForWindowResize(); -} - -function animate() { - timer.update(); - - render(); - - stats.update(); -} - -function renderScene() { - renderer.render(scene, camera); -} - -function renderShadowMapViewers() { - dirLightShadowMapViewer.render(renderer); - spotLightShadowMapViewer.render(renderer); -} - -function render() { - const delta = timer.getDelta(); - - renderScene(); - renderShadowMapViewers(); - - torusKnot.rotation.x += 0.25 * delta; - torusKnot.rotation.y += 2 * delta; - torusKnot.rotation.z += 1 * delta; - - cube.rotation.x += 0.25 * delta; - cube.rotation.y += 2 * delta; - cube.rotation.z += 1 * delta; -} diff --git a/examples-testing/examples/webgl_shadowmap_vsm.ts b/examples-testing/examples/webgl_shadowmap_vsm.ts deleted file mode 100644 index d5bf4f7bb..000000000 --- a/examples-testing/examples/webgl_shadowmap_vsm.ts +++ /dev/null @@ -1,203 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, timer, stats; -let dirLight, spotLight; -let torusKnot, dirGroup; - -init(); - -function init() { - initScene(); - initMisc(); - - // Init gui - const gui = new GUI(); - - const config = { - spotlightRadius: 4, - spotlightSamples: 8, - dirlightRadius: 4, - dirlightSamples: 8, - }; - - const spotlightFolder = gui.addFolder('Spotlight'); - spotlightFolder - .add(config, 'spotlightRadius') - .name('radius') - .min(0) - .max(25) - .onChange(function (value) { - spotLight.shadow.radius = value; - }); - - spotlightFolder - .add(config, 'spotlightSamples', 1, 25, 1) - .name('samples') - .onChange(function (value) { - spotLight.shadow.blurSamples = value; - }); - spotlightFolder.open(); - - const dirlightFolder = gui.addFolder('Directional Light'); - dirlightFolder - .add(config, 'dirlightRadius') - .name('radius') - .min(0) - .max(25) - .onChange(function (value) { - dirLight.shadow.radius = value; - }); - - dirlightFolder - .add(config, 'dirlightSamples', 1, 25, 1) - .name('samples') - .onChange(function (value) { - dirLight.shadow.blurSamples = value; - }); - dirlightFolder.open(); - - document.body.appendChild(renderer.domElement); - window.addEventListener('resize', onWindowResize); -} - -function initScene() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 10, 30); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222244); - scene.fog = new THREE.Fog(0x222244, 50, 100); - - // Lights - - scene.add(new THREE.AmbientLight(0x444444)); - - spotLight = new THREE.SpotLight(0xff8888, 400); - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.3; - spotLight.position.set(8, 10, 5); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 8; - spotLight.shadow.camera.far = 200; - spotLight.shadow.mapSize.width = 256; - spotLight.shadow.mapSize.height = 256; - spotLight.shadow.bias = -0.002; - spotLight.shadow.radius = 4; - scene.add(spotLight); - - dirLight = new THREE.DirectionalLight(0x8888ff, 3); - dirLight.position.set(3, 12, 17); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = 500; - dirLight.shadow.camera.right = 17; - dirLight.shadow.camera.left = -17; - dirLight.shadow.camera.top = 17; - dirLight.shadow.camera.bottom = -17; - dirLight.shadow.mapSize.width = 512; - dirLight.shadow.mapSize.height = 512; - dirLight.shadow.radius = 4; - dirLight.shadow.bias = -0.0005; - - dirGroup = new THREE.Group(); - dirGroup.add(dirLight); - scene.add(dirGroup); - - // Geometry - - const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 20); - const material = new THREE.MeshPhongMaterial({ - color: 0x999999, - shininess: 0, - specular: 0x222222, - }); - - torusKnot = new THREE.Mesh(geometry, material); - torusKnot.scale.multiplyScalar(1 / 18); - torusKnot.position.y = 3; - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); - - const pillar1 = new THREE.Mesh(cylinderGeometry, material); - pillar1.position.set(8, 3.5, 8); - pillar1.castShadow = true; - pillar1.receiveShadow = true; - - const pillar2 = pillar1.clone(); - pillar2.position.set(8, 3.5, -8); - const pillar3 = pillar1.clone(); - pillar3.position.set(-8, 3.5, 8); - const pillar4 = pillar1.clone(); - pillar4.position.set(-8, 3.5, -8); - - scene.add(pillar1); - scene.add(pillar2); - scene.add(pillar3); - scene.add(pillar4); - - const planeGeometry = new THREE.PlaneGeometry(200, 200); - const planeMaterial = new THREE.MeshPhongMaterial({ - color: 0x999999, - shininess: 0, - specular: 0x111111, - }); - - const ground = new THREE.Mesh(planeGeometry, planeMaterial); - ground.rotation.x = -Math.PI / 2; - ground.scale.multiplyScalar(3); - ground.castShadow = true; - ground.receiveShadow = true; - scene.add(ground); -} - -function initMisc() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.VSMShadowMap; - - // Mouse control - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2, 0); - controls.update(); - - timer = new THREE.Timer(); - timer.connect(document); - - stats = new Stats(); - document.body.appendChild(stats.dom); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(time) { - timer.update(); - - const delta = timer.getDelta(); - - torusKnot.rotation.x += 0.25 * delta; - torusKnot.rotation.y += 0.5 * delta; - torusKnot.rotation.z += 1 * delta; - - dirGroup.rotation.y += 0.7 * delta; - dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_shadowmesh.ts b/examples-testing/examples/webgl_shadowmesh.ts deleted file mode 100644 index e4f7ebb8f..000000000 --- a/examples-testing/examples/webgl_shadowmesh.ts +++ /dev/null @@ -1,253 +0,0 @@ -import * as THREE from 'three'; - -import { ShadowMesh } from 'three/addons/objects/ShadowMesh.js'; - -let SCREEN_WIDTH = window.innerWidth; -let SCREEN_HEIGHT = window.innerHeight; - -const scene = new THREE.Scene(); -const camera = new THREE.PerspectiveCamera(55, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 3000); -const timer = new THREE.Timer(); -timer.connect(document); -const renderer = new THREE.WebGLRenderer({ stencil: true }); - -const sunLight = new THREE.DirectionalLight('rgb(255,255,255)', 3); -let useDirectionalLight = true; -let arrowHelper1, arrowHelper2, arrowHelper3; -const arrowDirection = new THREE.Vector3(); -const arrowPosition1 = new THREE.Vector3(); -const arrowPosition2 = new THREE.Vector3(); -const arrowPosition3 = new THREE.Vector3(); -let groundMesh; -let lightSphere, lightHolder; -let pyramid, pyramidShadow; -let sphere, sphereShadow; -let cube, cubeShadow; -let cylinder, cylinderShadow; -let torus, torusShadow; -const normalVector = new THREE.Vector3(0, 1, 0); -const planeConstant = 0.01; // this value must be slightly higher than the groundMesh's y position of 0.0 -const groundPlane = new THREE.Plane(normalVector, planeConstant); -const lightPosition4D = new THREE.Vector4(); -let verticalAngle = 0; -let horizontalAngle = 0; -let frameTime = 0; -const TWO_PI = Math.PI * 2; - -init(); - -function init() { - scene.background = new THREE.Color(0x0096ff); - - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - document.getElementById('container').appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - camera.position.set(0, 2.5, 10); - scene.add(camera); - onWindowResize(); - - sunLight.position.set(5, 7, -1); - sunLight.lookAt(scene.position); - scene.add(sunLight); - - lightPosition4D.x = sunLight.position.x; - lightPosition4D.y = sunLight.position.y; - lightPosition4D.z = sunLight.position.z; - // amount of light-ray divergence. Ranging from: - // 0.001 = sunlight(min divergence) to 1.0 = pointlight(max divergence) - lightPosition4D.w = 0.001; // must be slightly greater than 0, due to 0 causing matrixInverse errors - - // YELLOW ARROW HELPERS - arrowDirection.subVectors(scene.position, sunLight.position).normalize(); - - arrowPosition1.copy(sunLight.position); - arrowHelper1 = new THREE.ArrowHelper(arrowDirection, arrowPosition1, 0.9, 0xffff00, 0.25, 0.08); - scene.add(arrowHelper1); - - arrowPosition2.copy(sunLight.position).add(new THREE.Vector3(0, 0.2, 0)); - arrowHelper2 = new THREE.ArrowHelper(arrowDirection, arrowPosition2, 0.9, 0xffff00, 0.25, 0.08); - scene.add(arrowHelper2); - - arrowPosition3.copy(sunLight.position).add(new THREE.Vector3(0, -0.2, 0)); - arrowHelper3 = new THREE.ArrowHelper(arrowDirection, arrowPosition3, 0.9, 0xffff00, 0.25, 0.08); - scene.add(arrowHelper3); - - // LIGHTBULB - const lightSphereGeometry = new THREE.SphereGeometry(0.09); - const lightSphereMaterial = new THREE.MeshBasicMaterial({ color: 'rgb(255,255,255)' }); - lightSphere = new THREE.Mesh(lightSphereGeometry, lightSphereMaterial); - scene.add(lightSphere); - lightSphere.visible = false; - - const lightHolderGeometry = new THREE.CylinderGeometry(0.05, 0.05, 0.13); - const lightHolderMaterial = new THREE.MeshBasicMaterial({ color: 'rgb(75,75,75)' }); - lightHolder = new THREE.Mesh(lightHolderGeometry, lightHolderMaterial); - scene.add(lightHolder); - lightHolder.visible = false; - - // GROUND - const groundGeometry = new THREE.BoxGeometry(30, 0.01, 40); - const groundMaterial = new THREE.MeshLambertMaterial({ color: 'rgb(0,130,0)' }); - groundMesh = new THREE.Mesh(groundGeometry, groundMaterial); - groundMesh.position.y = 0.0; //this value must be slightly lower than the planeConstant (0.01) parameter above - scene.add(groundMesh); - - // RED CUBE and CUBE's SHADOW - const cubeGeometry = new THREE.BoxGeometry(1, 1, 1); - const cubeMaterial = new THREE.MeshLambertMaterial({ color: 'rgb(255,0,0)', emissive: 0x200000 }); - cube = new THREE.Mesh(cubeGeometry, cubeMaterial); - cube.position.z = -1; - scene.add(cube); - - cubeShadow = new ShadowMesh(cube); - scene.add(cubeShadow); - - // BLUE CYLINDER and CYLINDER's SHADOW - const cylinderGeometry = new THREE.CylinderGeometry(0.3, 0.3, 2); - const cylinderMaterial = new THREE.MeshPhongMaterial({ color: 'rgb(0,0,255)', emissive: 0x000020 }); - cylinder = new THREE.Mesh(cylinderGeometry, cylinderMaterial); - cylinder.position.z = -2.5; - scene.add(cylinder); - - cylinderShadow = new ShadowMesh(cylinder); - scene.add(cylinderShadow); - - // MAGENTA TORUS and TORUS' SHADOW - const torusGeometry = new THREE.TorusGeometry(1, 0.2, 10, 16, TWO_PI); - const torusMaterial = new THREE.MeshPhongMaterial({ color: 'rgb(255,0,255)', emissive: 0x200020 }); - torus = new THREE.Mesh(torusGeometry, torusMaterial); - torus.position.z = -6; - scene.add(torus); - - torusShadow = new ShadowMesh(torus); - scene.add(torusShadow); - - // WHITE SPHERE and SPHERE'S SHADOW - const sphereGeometry = new THREE.SphereGeometry(0.5, 20, 10); - const sphereMaterial = new THREE.MeshPhongMaterial({ color: 'rgb(255,255,255)', emissive: 0x222222 }); - sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); - sphere.position.set(4, 0.5, 2); - scene.add(sphere); - - sphereShadow = new ShadowMesh(sphere); - scene.add(sphereShadow); - - // YELLOW PYRAMID and PYRAMID'S SHADOW - const pyramidGeometry = new THREE.CylinderGeometry(0, 0.5, 2, 4); - const pyramidMaterial = new THREE.MeshPhongMaterial({ - color: 'rgb(255,255,0)', - emissive: 0x440000, - flatShading: true, - shininess: 0, - }); - pyramid = new THREE.Mesh(pyramidGeometry, pyramidMaterial); - pyramid.position.set(-4, 1, 2); - scene.add(pyramid); - - pyramidShadow = new ShadowMesh(pyramid); - scene.add(pyramidShadow); - - document.getElementById('lightButton').addEventListener('click', lightButtonHandler); -} - -function animate() { - timer.update(); - - frameTime = timer.getDelta(); - - cube.rotation.x += 1.0 * frameTime; - cube.rotation.y += 1.0 * frameTime; - - cylinder.rotation.y += 1.0 * frameTime; - cylinder.rotation.z -= 1.0 * frameTime; - - torus.rotation.x -= 1.0 * frameTime; - torus.rotation.y -= 1.0 * frameTime; - - pyramid.rotation.y += 0.5 * frameTime; - - horizontalAngle += 0.5 * frameTime; - if (horizontalAngle > TWO_PI) horizontalAngle -= TWO_PI; - cube.position.x = Math.sin(horizontalAngle) * 4; - cylinder.position.x = Math.sin(horizontalAngle) * -4; - torus.position.x = Math.cos(horizontalAngle) * 4; - - verticalAngle += 1.5 * frameTime; - if (verticalAngle > TWO_PI) verticalAngle -= TWO_PI; - cube.position.y = Math.sin(verticalAngle) * 2 + 2.9; - cylinder.position.y = Math.sin(verticalAngle) * 2 + 3.1; - torus.position.y = Math.cos(verticalAngle) * 2 + 3.3; - - // update the ShadowMeshes to follow their shadow-casting objects - cubeShadow.update(groundPlane, lightPosition4D); - cylinderShadow.update(groundPlane, lightPosition4D); - torusShadow.update(groundPlane, lightPosition4D); - sphereShadow.update(groundPlane, lightPosition4D); - pyramidShadow.update(groundPlane, lightPosition4D); - - renderer.render(scene, camera); -} - -function onWindowResize() { - SCREEN_WIDTH = window.innerWidth; - SCREEN_HEIGHT = window.innerHeight; - - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - - camera.aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - camera.updateProjectionMatrix(); -} - -function lightButtonHandler() { - useDirectionalLight = !useDirectionalLight; - - if (useDirectionalLight) { - scene.background.setHex(0x0096ff); - - groundMesh.material.color.setHex(0x008200); - sunLight.position.set(5, 7, -1); - sunLight.lookAt(scene.position); - - lightPosition4D.x = sunLight.position.x; - lightPosition4D.y = sunLight.position.y; - lightPosition4D.z = sunLight.position.z; - lightPosition4D.w = 0.001; // more of a directional Light value - - arrowHelper1.visible = true; - arrowHelper2.visible = true; - arrowHelper3.visible = true; - - lightSphere.visible = false; - lightHolder.visible = false; - - document.getElementById('lightButton').value = 'Switch to PointLight'; - } else { - scene.background.setHex(0x000000); - - groundMesh.material.color.setHex(0x969696); - - sunLight.position.set(0, 6, -2); - sunLight.lookAt(scene.position); - lightSphere.position.copy(sunLight.position); - lightHolder.position.copy(lightSphere.position); - lightHolder.position.y += 0.12; - - lightPosition4D.x = sunLight.position.x; - lightPosition4D.y = sunLight.position.y; - lightPosition4D.z = sunLight.position.z; - lightPosition4D.w = 0.9; // more of a point Light value - - arrowHelper1.visible = false; - arrowHelper2.visible = false; - arrowHelper3.visible = false; - - lightSphere.visible = true; - lightHolder.visible = true; - - document.getElementById('lightButton').value = 'Switch to THREE.DirectionalLight'; - } -} diff --git a/examples-testing/examples/webgl_simple_gi.ts b/examples-testing/examples/webgl_simple_gi.ts deleted file mode 100644 index 4ab6dc895..000000000 --- a/examples-testing/examples/webgl_simple_gi.ts +++ /dev/null @@ -1,172 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -class GIMesh extends THREE.Mesh { - copy(source) { - super.copy(source); - - this.geometry = source.geometry.clone(); - - return this; - } -} - -// - -const SimpleGI = function (renderer, scene) { - const SIZE = 32, - SIZE2 = SIZE * SIZE; - - const camera = new THREE.PerspectiveCamera(90, 1, 0.01, 100); - - scene.updateMatrixWorld(true); - - let clone = scene.clone(); - clone.matrixWorldAutoUpdate = false; - - const rt = new THREE.WebGLRenderTarget(SIZE, SIZE); - - const normalMatrix = new THREE.Matrix3(); - - const position = new THREE.Vector3(); - const normal = new THREE.Vector3(); - - let bounces = 0; - let currentVertex = 0; - - const color = new Float32Array(3); - const buffer = new Uint8Array(SIZE2 * 4); - - function compute() { - if (bounces === 3) return; - - const object = scene.children[0]; // torusKnot - const geometry = object.geometry; - - const attributes = geometry.attributes; - const positions = attributes.position.array; - const normals = attributes.normal.array; - - if (attributes.color === undefined) { - const colors = new Float32Array(positions.length); - geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3).setUsage(THREE.DynamicDrawUsage)); - } - - const colors = attributes.color.array; - - const startVertex = currentVertex; - const totalVertex = positions.length / 3; - - for (let i = 0; i < 32; i++) { - if (currentVertex >= totalVertex) break; - - position.fromArray(positions, currentVertex * 3); - position.applyMatrix4(object.matrixWorld); - - normal.fromArray(normals, currentVertex * 3); - normal.applyMatrix3(normalMatrix.getNormalMatrix(object.matrixWorld)).normalize(); - - camera.position.copy(position); - camera.lookAt(position.add(normal)); - - renderer.setRenderTarget(rt); - renderer.render(clone, camera); - - renderer.readRenderTargetPixels(rt, 0, 0, SIZE, SIZE, buffer); - - color[0] = 0; - color[1] = 0; - color[2] = 0; - - for (let k = 0, kl = buffer.length; k < kl; k += 4) { - color[0] += buffer[k + 0]; - color[1] += buffer[k + 1]; - color[2] += buffer[k + 2]; - } - - colors[currentVertex * 3 + 0] = color[0] / (SIZE2 * 255); - colors[currentVertex * 3 + 1] = color[1] / (SIZE2 * 255); - colors[currentVertex * 3 + 2] = color[2] / (SIZE2 * 255); - - currentVertex++; - } - - attributes.color.addUpdateRange(startVertex * 3, (currentVertex - startVertex) * 3); - attributes.color.needsUpdate = true; - - if (currentVertex >= totalVertex) { - clone = scene.clone(); - clone.matrixWorldAutoUpdate = false; - - bounces++; - currentVertex = 0; - } - - requestAnimationFrame(compute); - } - - requestAnimationFrame(compute); -}; - -// - -let camera, scene, renderer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 4; - - scene = new THREE.Scene(); - - // torus knot - - const torusGeometry = new THREE.TorusKnotGeometry(0.75, 0.3, 128, 32, 1); - const material = new THREE.MeshBasicMaterial({ vertexColors: true }); - - const torusKnot = new GIMesh(torusGeometry, material); - scene.add(torusKnot); - - // room - - const materials = []; - - for (let i = 0; i < 8; i++) { - materials.push(new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff, side: THREE.BackSide })); - } - - const boxGeometry = new THREE.BoxGeometry(3, 3, 3); - - const box = new THREE.Mesh(boxGeometry, materials); - scene.add(box); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - new SimpleGI(renderer, scene); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 10; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.setRenderTarget(null); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_sprites.ts b/examples-testing/examples/webgl_sprites.ts deleted file mode 100644 index 2e4189347..000000000 --- a/examples-testing/examples/webgl_sprites.ts +++ /dev/null @@ -1,187 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; -let cameraOrtho, sceneOrtho; - -let spriteTL, spriteTR, spriteBL, spriteBR, spriteC; - -let mapC; - -let group; - -init(); - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera = new THREE.PerspectiveCamera(60, width / height, 1, 2100); - camera.position.z = 1500; - - cameraOrtho = new THREE.OrthographicCamera(-width / 2, width / 2, height / 2, -height / 2, 1, 10); - cameraOrtho.position.z = 10; - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x000000, 1500, 2100); - - sceneOrtho = new THREE.Scene(); - - // create sprites - - const amount = 200; - const radius = 500; - - const textureLoader = new THREE.TextureLoader(); - - textureLoader.load('textures/sprite0.png', createHUDSprites); - const mapB = textureLoader.load('textures/sprite1.png'); - mapC = textureLoader.load('textures/sprite2.png'); - - mapB.colorSpace = THREE.SRGBColorSpace; - mapC.colorSpace = THREE.SRGBColorSpace; - - group = new THREE.Group(); - - const materialC = new THREE.SpriteMaterial({ map: mapC, color: 0xffffff, fog: true }); - const materialB = new THREE.SpriteMaterial({ map: mapB, color: 0xffffff, fog: true }); - - for (let a = 0; a < amount; a++) { - const x = Math.random() - 0.5; - const y = Math.random() - 0.5; - const z = Math.random() - 0.5; - - let material; - - if (z < 0) { - material = materialB.clone(); - } else { - material = materialC.clone(); - material.color.setHSL(0.5 * Math.random(), 0.75, 0.5); - material.map.offset.set(-0.5, -0.5); - material.map.repeat.set(2, 2); - } - - const sprite = new THREE.Sprite(material); - - sprite.position.set(x, y, z); - sprite.position.normalize(); - sprite.position.multiplyScalar(radius); - - group.add(sprite); - } - - scene.add(group); - - // renderer - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; // To allow render overlay on top of sprited sphere - - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function createHUDSprites(texture) { - texture.colorSpace = THREE.SRGBColorSpace; - - const material = new THREE.SpriteMaterial({ map: texture }); - - const width = material.map.image.width; - const height = material.map.image.height; - - spriteTL = new THREE.Sprite(material); - spriteTL.center.set(0.0, 1.0); - spriteTL.scale.set(width, height, 1); - sceneOrtho.add(spriteTL); - - spriteTR = new THREE.Sprite(material); - spriteTR.center.set(1.0, 1.0); - spriteTR.scale.set(width, height, 1); - sceneOrtho.add(spriteTR); - - spriteBL = new THREE.Sprite(material); - spriteBL.center.set(0.0, 0.0); - spriteBL.scale.set(width, height, 1); - sceneOrtho.add(spriteBL); - - spriteBR = new THREE.Sprite(material); - spriteBR.center.set(1.0, 0.0); - spriteBR.scale.set(width, height, 1); - sceneOrtho.add(spriteBR); - - spriteC = new THREE.Sprite(material); - spriteC.center.set(0.5, 0.5); - spriteC.scale.set(width, height, 1); - sceneOrtho.add(spriteC); - - updateHUDSprites(); -} - -function updateHUDSprites() { - const width = window.innerWidth / 2; - const height = window.innerHeight / 2; - - spriteTL.position.set(-width, height, 1); // top left - spriteTR.position.set(width, height, 1); // top right - spriteBL.position.set(-width, -height, 1); // bottom left - spriteBR.position.set(width, -height, 1); // bottom right - spriteC.position.set(0, 0, 1); // center -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - cameraOrtho.left = -width / 2; - cameraOrtho.right = width / 2; - cameraOrtho.top = height / 2; - cameraOrtho.bottom = -height / 2; - cameraOrtho.updateProjectionMatrix(); - - updateHUDSprites(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = Date.now() / 1000; - - for (let i = 0, l = group.children.length; i < l; i++) { - const sprite = group.children[i]; - const material = sprite.material; - const scale = Math.sin(time + sprite.position.x * 0.01) * 0.3 + 1.0; - - let imageWidth = 1; - let imageHeight = 1; - - if (material.map && material.map.image && material.map.image.width) { - imageWidth = material.map.image.width; - imageHeight = material.map.image.height; - } - - sprite.material.rotation += 0.1 * (i / l); - sprite.scale.set(scale * imageWidth, scale * imageHeight, 1.0); - - if (material.map !== mapC) { - material.opacity = Math.sin(time + sprite.position.x * 0.01) * 0.4 + 0.6; - } - } - - group.rotation.x = time * 0.5; - group.rotation.y = time * 0.75; - group.rotation.z = time * 1.0; - - renderer.clear(); - renderer.render(scene, camera); - renderer.clearDepth(); - renderer.render(sceneOrtho, cameraOrtho); -} diff --git a/examples-testing/examples/webgl_test_memory.ts b/examples-testing/examples/webgl_test_memory.ts deleted file mode 100644 index f5d0e112d..000000000 --- a/examples-testing/examples/webgl_test_memory.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 200; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); -} - -function createImage() { - const canvas = document.createElement('canvas'); - canvas.width = 256; - canvas.height = 256; - - const context = canvas.getContext('2d'); - context.fillStyle = - 'rgb(' + - Math.floor(Math.random() * 256) + - ',' + - Math.floor(Math.random() * 256) + - ',' + - Math.floor(Math.random() * 256) + - ')'; - context.fillRect(0, 0, 256, 256); - - return canvas; -} - -// - -function animate() { - const geometry = new THREE.SphereGeometry(50, Math.random() * 64, Math.random() * 32); - - const texture = new THREE.CanvasTexture(createImage()); - - const material = new THREE.MeshBasicMaterial({ map: texture, wireframe: true }); - - const mesh = new THREE.Mesh(geometry, material); - - scene.add(mesh); - - renderer.render(scene, camera); - - scene.remove(mesh); - - // clean up - - geometry.dispose(); - material.dispose(); - texture.dispose(); -} diff --git a/examples-testing/examples/webgl_test_memory2.ts b/examples-testing/examples/webgl_test_memory2.ts deleted file mode 100644 index 366a27914..000000000 --- a/examples-testing/examples/webgl_test_memory2.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as THREE from 'three'; - -const N = 100; - -let container; - -let camera, scene, renderer; - -let geometry; - -const meshes = []; - -let fragmentShader, vertexShader; - -init(); -setInterval(render, 1000 / 60); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - vertexShader = document.getElementById('vertexShader').textContent; - fragmentShader = document.getElementById('fragmentShader').textContent; - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 2000; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - geometry = new THREE.SphereGeometry(15, 64, 32); - - for (let i = 0; i < N; i++) { - const material = new THREE.ShaderMaterial({ - vertexShader: vertexShader, - fragmentShader: generateFragmentShader(), - }); - - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = (0.5 - Math.random()) * 1000; - mesh.position.y = (0.5 - Math.random()) * 1000; - mesh.position.z = (0.5 - Math.random()) * 1000; - - scene.add(mesh); - - meshes.push(mesh); - } - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - container.appendChild(renderer.domElement); -} - -// - -function generateFragmentShader() { - return fragmentShader.replace('XXX', Math.random() + ',' + Math.random() + ',' + Math.random()); -} - -function render() { - for (let i = 0; i < N; i++) { - const mesh = meshes[i]; - mesh.material = new THREE.ShaderMaterial({ - vertexShader: vertexShader, - fragmentShader: generateFragmentShader(), - }); - } - - renderer.render(scene, camera); - - console.log('before', renderer.info.programs.length); - - for (let i = 0; i < N; i++) { - const mesh = meshes[i]; - mesh.material.dispose(); - } - - console.log('after', renderer.info.programs.length); -} diff --git a/examples-testing/examples/webgl_test_wide_gamut.ts b/examples-testing/examples/webgl_test_wide_gamut.ts deleted file mode 100644 index 5988299e1..000000000 --- a/examples-testing/examples/webgl_test_wide_gamut.ts +++ /dev/null @@ -1,130 +0,0 @@ -import * as THREE from 'three'; - -import { - DisplayP3ColorSpace, - DisplayP3ColorSpaceImpl, - LinearDisplayP3ColorSpace, - LinearDisplayP3ColorSpaceImpl, -} from 'three/addons/math/ColorSpaces.js'; - -import WebGL from 'three/addons/capabilities/WebGL.js'; - -let container, camera, renderer, loader; -let sceneL, sceneR, textureL, textureR; - -let sliderPos = window.innerWidth / 2; - -const slider = document.querySelector('.slider'); - -const isP3Context = WebGL.isColorSpaceAvailable(DisplayP3ColorSpace); - -THREE.ColorManagement.define({ - [DisplayP3ColorSpace]: DisplayP3ColorSpaceImpl, - [LinearDisplayP3ColorSpace]: LinearDisplayP3ColorSpaceImpl, -}); - -if (isP3Context) { - THREE.ColorManagement.workingColorSpace = LinearDisplayP3ColorSpace; -} - -init(); - -function init() { - container = document.querySelector('.container'); - - sceneL = new THREE.Scene(); - sceneR = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 6; - - loader = new THREE.TextureLoader(); - - initTextures(); - initSlider(); - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.setScissorTest(true); - container.appendChild(renderer.domElement); - - if (isP3Context && window.matchMedia('( color-gamut: p3 )').matches) { - renderer.outputColorSpace = DisplayP3ColorSpace; - } - - window.addEventListener('resize', onWindowResize); - window.matchMedia('( color-gamut: p3 )').addEventListener('change', onGamutChange); -} - -async function initTextures() { - const path = 'textures/wide_gamut/logo_{colorSpace}.png'; - - textureL = await loader.loadAsync(path.replace('{colorSpace}', 'srgb')); - textureR = await loader.loadAsync(path.replace('{colorSpace}', 'p3')); - - textureL.colorSpace = THREE.SRGBColorSpace; - textureR.colorSpace = DisplayP3ColorSpace; - - sceneL.background = THREE.TextureUtils.contain(textureL, window.innerWidth / window.innerHeight); - sceneR.background = THREE.TextureUtils.contain(textureR, window.innerWidth / window.innerHeight); -} - -function initSlider() { - function onPointerDown() { - if (event.isPrimary === false) return; - - window.addEventListener('pointermove', onPointerMove); - window.addEventListener('pointerup', onPointerUp); - } - - function onPointerUp() { - window.removeEventListener('pointermove', onPointerMove); - window.removeEventListener('pointerup', onPointerUp); - } - - function onPointerMove(e) { - if (event.isPrimary === false) return; - - updateSlider(e.pageX); - } - - updateSlider(sliderPos); - - slider.style.touchAction = 'none'; // disable touch scroll - slider.addEventListener('pointerdown', onPointerDown); -} - -function updateSlider(offset) { - sliderPos = Math.max(10, Math.min(window.innerWidth - 10, offset)); - - slider.style.left = sliderPos - slider.offsetWidth / 2 + 'px'; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - THREE.TextureUtils.contain(sceneL.background, window.innerWidth / window.innerHeight); - THREE.TextureUtils.contain(sceneR.background, window.innerWidth / window.innerHeight); - - updateSlider(sliderPos); -} - -function onGamutChange({ matches }) { - renderer.outputColorSpace = isP3Context && matches ? DisplayP3ColorSpace : THREE.SRGBColorSpace; - - textureL.needsUpdate = true; - textureR.needsUpdate = true; -} - -function animate() { - renderer.setScissor(0, 0, sliderPos, window.innerHeight); - renderer.render(sceneL, camera); - - renderer.setScissor(sliderPos, 0, window.innerWidth, window.innerHeight); - renderer.render(sceneR, camera); -} diff --git a/examples-testing/examples/webgl_texture2darray_compressed.ts b/examples-testing/examples/webgl_texture2darray_compressed.ts deleted file mode 100644 index 0ce11a28a..000000000 --- a/examples-testing/examples/webgl_texture2darray_compressed.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; - -let camera, scene, mesh, renderer, stats, timer; - -const planeWidth = 50; -const planeHeight = 25; - -let depthStep = 1; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); - camera.position.z = 70; - - scene = new THREE.Scene(); - - // - timer = new THREE.Timer(); - timer.connect(document); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - // - - const ktx2Loader = new KTX2Loader(); - ktx2Loader.detectSupport(renderer); - - ktx2Loader.load('textures/spiritedaway.ktx2', function (texturearray) { - const material = new THREE.ShaderMaterial({ - uniforms: { - diffuse: { value: texturearray }, - depth: { value: 55 }, - size: { value: new THREE.Vector2(planeWidth, planeHeight) }, - }, - vertexShader: document.getElementById('vs').textContent.trim(), - fragmentShader: document.getElementById('fs').textContent.trim(), - glslVersion: THREE.GLSL3, - }); - - const geometry = new THREE.PlaneGeometry(planeWidth, planeHeight); - - mesh = new THREE.Mesh(geometry, material); - - scene.add(mesh); - }); - - stats = new Stats(); - container.appendChild(stats.dom); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - if (mesh) { - const delta = timer.getDelta() * 10; - - depthStep += delta; - - const value = depthStep % 5; - - mesh.material.uniforms['depth'].value = value; - } - - render(); - stats.update(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_texture2darray_layerupdate.ts b/examples-testing/examples/webgl_texture2darray_layerupdate.ts deleted file mode 100644 index 688f89b4a..000000000 --- a/examples-testing/examples/webgl_texture2darray_layerupdate.ts +++ /dev/null @@ -1,130 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; - -let camera, scene, mesh, renderer; - -const planeWidth = 20; -const planeHeight = 10; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); - camera.position.z = 70; - - scene = new THREE.Scene(); - - // Configure the renderer. - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - container.appendChild(renderer.domElement); - - // Configure the KTX2 loader. - - const ktx2Loader = new KTX2Loader(); - ktx2Loader.detectSupport(renderer); - - // Load several KTX2 textures which will later be used to modify - // specific texture array layers. - - const spiritedaway = await ktx2Loader.loadAsync('textures/spiritedaway.ktx2'); - - // Create a texture array for rendering. - - const layerByteLength = THREE.TextureUtils.getByteLength( - spiritedaway.image.width, - spiritedaway.image.height, - spiritedaway.format, - spiritedaway.type, - ); - - const textureArray = new THREE.CompressedArrayTexture( - [ - { - data: new Uint8Array(layerByteLength * 3), - width: spiritedaway.image.width, - height: spiritedaway.image.height, - }, - ], - spiritedaway.image.width, - spiritedaway.image.height, - 3, - spiritedaway.format, - spiritedaway.type, - ); - - // Setup the GUI - - const formData = { - srcLayer: 0, - destLayer: 0, - transfer() { - const layerElementLength = layerByteLength / spiritedaway.mipmaps[0].data.BYTES_PER_ELEMENT; - textureArray.mipmaps[0].data.set( - spiritedaway.mipmaps[0].data.subarray( - layerElementLength * (formData.srcLayer % spiritedaway.image.depth), - layerElementLength * ((formData.srcLayer % spiritedaway.image.depth) + 1), - ), - layerByteLength * formData.destLayer, - ); - textureArray.addLayerUpdate(formData.destLayer); - textureArray.needsUpdate = true; - - renderer.render(scene, camera); - }, - }; - - const gui = new GUI(); - gui.add(formData, 'srcLayer', 0, spiritedaway.image.depth - 1, 1); - gui.add(formData, 'destLayer', 0, textureArray.image.depth - 1, 1); - gui.add(formData, 'transfer'); - - /// Setup the scene. - - const material = new THREE.ShaderMaterial({ - uniforms: { - diffuse: { value: textureArray }, - size: { value: new THREE.Vector2(planeWidth, planeHeight) }, - }, - vertexShader: document.getElementById('vs').textContent.trim(), - fragmentShader: document.getElementById('fs').textContent.trim(), - glslVersion: THREE.GLSL3, - }); - - const geometry = new THREE.InstancedBufferGeometry(); - geometry.copy(new THREE.PlaneGeometry(planeWidth, planeHeight)); - geometry.instanceCount = 3; - - const instancedIndexAttribute = new THREE.InstancedBufferAttribute(new Uint16Array([0, 1, 2]), 1, false, 1); - instancedIndexAttribute.gpuType = THREE.IntType; - geometry.setAttribute('instancedIndex', instancedIndexAttribute); - - mesh = new THREE.InstancedMesh(geometry, material, 3); - - scene.add(mesh); - - window.addEventListener('resize', onWindowResize); - - // Initialize the texture array by first rendering the spirited away - // frames in order. - - textureArray.mipmaps[0].data.set(spiritedaway.mipmaps[0].data.subarray(0, textureArray.mipmaps[0].data.length)); - textureArray.needsUpdate = true; - renderer.render(scene, camera); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_texture3d.ts b/examples-testing/examples/webgl_texture3d.ts deleted file mode 100644 index 5979d5945..000000000 --- a/examples-testing/examples/webgl_texture3d.ts +++ /dev/null @@ -1,128 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { NRRDLoader } from 'three/addons/loaders/NRRDLoader.js'; -import { VolumeRenderShader1 } from 'three/addons/shaders/VolumeShader.js'; - -let renderer, scene, camera, controls, material, volconfig, cmtextures; - -init(); - -function init() { - scene = new THREE.Scene(); - - // Create renderer - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - // Create camera - const h = 512; // frustum height - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera((-h * aspect) / 2, (h * aspect) / 2, h / 2, -h / 2, 1, 1000); - camera.position.set(-64, -64, 128); - camera.up.set(0, 0, 1); // In our data, z is up - - // Create controls - controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.target.set(64, 64, 128); - controls.minZoom = 0.5; - controls.maxZoom = 4; - controls.enablePan = false; - controls.update(); - - // scene.add( new AxesHelper( 128 ) ); - - // Lighting is baked into the shader a.t.m. - // let dirLight = new DirectionalLight( 0xffffff ); - - // The gui for interaction - volconfig = { clim1: 0, clim2: 1, renderstyle: 'iso', isothreshold: 0.15, colormap: 'viridis' }; - const gui = new GUI(); - gui.add(volconfig, 'clim1', 0, 1, 0.01).onChange(updateUniforms); - gui.add(volconfig, 'clim2', 0, 1, 0.01).onChange(updateUniforms); - gui.add(volconfig, 'colormap', { gray: 'gray', viridis: 'viridis' }).onChange(updateUniforms); - gui.add(volconfig, 'renderstyle', { mip: 'mip', iso: 'iso' }).onChange(updateUniforms); - gui.add(volconfig, 'isothreshold', 0, 1, 0.01).onChange(updateUniforms); - - // Load the data ... - new NRRDLoader().load('models/nrrd/stent.nrrd', function (volume) { - // Texture to hold the volume. We have scalars, so we put our data in the red channel. - // THREEJS will select R32F (33326) based on the THREE.RedFormat and THREE.FloatType. - // Also see https://www.khronos.org/registry/webgl/specs/latest/2.0/#TEXTURE_TYPES_FORMATS_FROM_DOM_ELEMENTS_TABLE - // TODO: look the dtype up in the volume metadata - const texture = new THREE.Data3DTexture(volume.data, volume.xLength, volume.yLength, volume.zLength); - texture.format = THREE.RedFormat; - texture.type = THREE.FloatType; - texture.minFilter = texture.magFilter = THREE.LinearFilter; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - // Colormap textures - cmtextures = { - viridis: new THREE.TextureLoader().load('textures/cm_viridis.png', render), - gray: new THREE.TextureLoader().load('textures/cm_gray.png', render), - }; - - // Material - const shader = VolumeRenderShader1; - - const uniforms = THREE.UniformsUtils.clone(shader.uniforms); - - uniforms['u_data'].value = texture; - uniforms['u_size'].value.set(volume.xLength, volume.yLength, volume.zLength); - uniforms['u_clim'].value.set(volconfig.clim1, volconfig.clim2); - uniforms['u_renderstyle'].value = volconfig.renderstyle == 'mip' ? 0 : 1; // 0: MIP, 1: ISO - uniforms['u_renderthreshold'].value = volconfig.isothreshold; // For ISO renderstyle - uniforms['u_cmdata'].value = cmtextures[volconfig.colormap]; - - material = new THREE.ShaderMaterial({ - uniforms: uniforms, - vertexShader: shader.vertexShader, - fragmentShader: shader.fragmentShader, - side: THREE.BackSide, // The volume shader uses the backface as its "reference point" - }); - - // THREE.Mesh - const geometry = new THREE.BoxGeometry(volume.xLength, volume.yLength, volume.zLength); - geometry.translate(volume.xLength / 2 - 0.5, volume.yLength / 2 - 0.5, volume.zLength / 2 - 0.5); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - render(); - }); - - window.addEventListener('resize', onWindowResize); -} - -function updateUniforms() { - material.uniforms['u_clim'].value.set(volconfig.clim1, volconfig.clim2); - material.uniforms['u_renderstyle'].value = volconfig.renderstyle == 'mip' ? 0 : 1; // 0: MIP, 1: ISO - material.uniforms['u_renderthreshold'].value = volconfig.isothreshold; // For ISO renderstyle - material.uniforms['u_cmdata'].value = cmtextures[volconfig.colormap]; - - render(); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - const aspect = window.innerWidth / window.innerHeight; - - const frustumHeight = camera.top - camera.bottom; - - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - - camera.updateProjectionMatrix(); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_texture3d_partialupdate.ts b/examples-testing/examples/webgl_texture3d_partialupdate.ts deleted file mode 100644 index 58615db84..000000000 --- a/examples-testing/examples/webgl_texture3d_partialupdate.ts +++ /dev/null @@ -1,326 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -const INITIAL_CLOUD_SIZE = 128; - -let renderer, scene, camera; -let mesh; -let prevTime = performance.now(); -let cloudTexture = null; - -init(); - -function generateCloudTexture(size, scaleFactor = 1.0) { - const data = new Uint8Array(size * size * size); - const scale = (scaleFactor * 10.0) / size; - - let i = 0; - const perlin = new ImprovedNoise(); - const vector = new THREE.Vector3(); - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - const dist = vector - .set(x, y, z) - .subScalar(size / 2) - .divideScalar(size) - .length(); - const fadingFactor = (1.0 - dist) * (1.0 - dist); - data[i] = (128 + 128 * perlin.noise((x * scale) / 1.5, y * scale, (z * scale) / 1.5)) * fadingFactor; - - i++; - } - } - } - - return new THREE.Data3DTexture(data, size, size, size); -} - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 1.5); - - new OrbitControls(camera, renderer.domElement); - - // Sky - - const canvas = document.createElement('canvas'); - canvas.width = 1; - canvas.height = 32; - - const context = canvas.getContext('2d'); - const gradient = context.createLinearGradient(0, 0, 0, 32); - gradient.addColorStop(0.0, '#014a84'); - gradient.addColorStop(0.5, '#0561a0'); - gradient.addColorStop(1.0, '#437ab6'); - context.fillStyle = gradient; - context.fillRect(0, 0, 1, 32); - - const skyMap = new THREE.CanvasTexture(canvas); - skyMap.colorSpace = THREE.SRGBColorSpace; - - const sky = new THREE.Mesh( - new THREE.SphereGeometry(10), - new THREE.MeshBasicMaterial({ map: skyMap, side: THREE.BackSide }), - ); - scene.add(sky); - - // Texture - - const texture = new THREE.Data3DTexture( - new Uint8Array(INITIAL_CLOUD_SIZE * INITIAL_CLOUD_SIZE * INITIAL_CLOUD_SIZE).fill(0), - INITIAL_CLOUD_SIZE, - INITIAL_CLOUD_SIZE, - INITIAL_CLOUD_SIZE, - ); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - cloudTexture = texture; - - // Material - - const vertexShader = /* glsl */ ` - in vec3 position; - - uniform mat4 modelMatrix; - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - uniform vec3 cameraPos; - - out vec3 vOrigin; - out vec3 vDirection; - - void main() { - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - - vOrigin = vec3( inverse( modelMatrix ) * vec4( cameraPos, 1.0 ) ).xyz; - vDirection = position - vOrigin; - - gl_Position = projectionMatrix * mvPosition; - } - `; - - const fragmentShader = /* glsl */ ` - precision highp float; - precision highp sampler3D; - - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - - in vec3 vOrigin; - in vec3 vDirection; - - out vec4 color; - - uniform vec3 base; - uniform sampler3D map; - - uniform float threshold; - uniform float range; - uniform float opacity; - uniform float steps; - uniform float frame; - - uint wang_hash(uint seed) - { - seed = (seed ^ 61u) ^ (seed >> 16u); - seed *= 9u; - seed = seed ^ (seed >> 4u); - seed *= 0x27d4eb2du; - seed = seed ^ (seed >> 15u); - return seed; - } - - float randomFloat(inout uint seed) - { - return float(wang_hash(seed)) / 4294967296.; - } - - vec2 hitBox( vec3 orig, vec3 dir ) { - const vec3 box_min = vec3( - 0.5 ); - const vec3 box_max = vec3( 0.5 ); - vec3 inv_dir = 1.0 / dir; - vec3 tmin_tmp = ( box_min - orig ) * inv_dir; - vec3 tmax_tmp = ( box_max - orig ) * inv_dir; - vec3 tmin = min( tmin_tmp, tmax_tmp ); - vec3 tmax = max( tmin_tmp, tmax_tmp ); - float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); - float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); - return vec2( t0, t1 ); - } - - float sample1( vec3 p ) { - return texture( map, p ).r; - } - - float shading( vec3 coord ) { - float step = 0.01; - return sample1( coord + vec3( - step ) ) - sample1( coord + vec3( step ) ); - } - - vec4 linearToSRGB( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); - } - - void main(){ - vec3 rayDir = normalize( vDirection ); - vec2 bounds = hitBox( vOrigin, rayDir ); - - if ( bounds.x > bounds.y ) discard; - - bounds.x = max( bounds.x, 0.0 ); - - vec3 p = vOrigin + bounds.x * rayDir; - vec3 inc = 1.0 / abs( rayDir ); - float delta = min( inc.x, min( inc.y, inc.z ) ); - delta /= steps; - - // Jitter - - // Nice little seed from - // https://blog.demofox.org/2020/05/25/casual-shadertoy-path-tracing-1-basic-camera-diffuse-emissive/ - uint seed = uint( gl_FragCoord.x ) * uint( 1973 ) + uint( gl_FragCoord.y ) * uint( 9277 ) + uint( frame ) * uint( 26699 ); - vec3 size = vec3( textureSize( map, 0 ) ); - float randNum = randomFloat( seed ) * 2.0 - 1.0; - p += rayDir * randNum * ( 1.0 / size ); - - // - - vec4 ac = vec4( base, 0.0 ); - - for ( float t = bounds.x; t < bounds.y; t += delta ) { - - float d = sample1( p + 0.5 ); - - d = smoothstep( threshold - range, threshold + range, d ) * opacity; - - float col = shading( p + 0.5 ) * 3.0 + ( ( p.x + p.y ) * 0.25 ) + 0.2; - - ac.rgb += ( 1.0 - ac.a ) * d * col; - - ac.a += ( 1.0 - ac.a ) * d; - - if ( ac.a >= 0.95 ) break; - - p += rayDir * delta; - - } - - color = linearToSRGB( ac ); - - if ( color.a == 0.0 ) discard; - - } - `; - - const geometry = new THREE.BoxGeometry(1, 1, 1); - const material = new THREE.RawShaderMaterial({ - glslVersion: THREE.GLSL3, - uniforms: { - base: { value: new THREE.Color(0x798aa0) }, - map: { value: texture }, - cameraPos: { value: new THREE.Vector3() }, - threshold: { value: 0.25 }, - opacity: { value: 0.25 }, - range: { value: 0.1 }, - steps: { value: 100 }, - frame: { value: 0 }, - }, - vertexShader, - fragmentShader, - side: THREE.BackSide, - transparent: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const parameters = { - threshold: 0.25, - opacity: 0.25, - range: 0.1, - steps: 100, - }; - - function update() { - material.uniforms.threshold.value = parameters.threshold; - material.uniforms.opacity.value = parameters.opacity; - material.uniforms.range.value = parameters.range; - material.uniforms.steps.value = parameters.steps; - } - - const gui = new GUI(); - gui.add(parameters, 'threshold', 0, 1, 0.01).onChange(update); - gui.add(parameters, 'opacity', 0, 1, 0.01).onChange(update); - gui.add(parameters, 'range', 0, 1, 0.01).onChange(update); - gui.add(parameters, 'steps', 0, 200, 1).onChange(update); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -let curr = 0; -const countPerRow = 4; -const countPerSlice = countPerRow * countPerRow; -const sliceCount = 4; -const totalCount = sliceCount * countPerSlice; -const margins = 8; - -const perElementPaddedSize = (INITIAL_CLOUD_SIZE - margins) / countPerRow; -const perElementSize = Math.floor((INITIAL_CLOUD_SIZE - 1) / countPerRow); - -function animate() { - const time = performance.now(); - if (time - prevTime > 1500.0 && curr < totalCount) { - const position = new THREE.Vector3( - Math.floor(curr % countPerRow) * perElementSize + margins * 0.5, - Math.floor((curr % countPerSlice) / countPerRow) * perElementSize + margins * 0.5, - Math.floor(curr / countPerSlice) * perElementSize + margins * 0.5, - ).floor(); - - const maxDimension = perElementPaddedSize - 1; - const box = new THREE.Box3( - new THREE.Vector3(0, 0, 0), - new THREE.Vector3(maxDimension, maxDimension, maxDimension), - ); - const scaleFactor = (Math.random() + 0.5) * 0.5; - const source = generateCloudTexture(perElementPaddedSize, scaleFactor); - - renderer.copyTextureToTexture(source, cloudTexture, box, position); - - prevTime = time; - - curr++; - } - - mesh.material.uniforms.cameraPos.value.copy(camera.position); - // mesh.rotation.y = - performance.now() / 7500; - - mesh.material.uniforms.frame.value++; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_tonemapping.ts b/examples-testing/examples/webgl_tonemapping.ts deleted file mode 100644 index 00aee8de5..000000000 --- a/examples-testing/examples/webgl_tonemapping.ts +++ /dev/null @@ -1,170 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let renderer, scene, camera, controls; -let gui, - guiExposure = null; - -const params = { - exposure: 1.0, - toneMapping: 'Neutral', - blurriness: 0.3, - intensity: 1.0, -}; - -const toneMappingOptions = { - None: THREE.NoToneMapping, - Linear: THREE.LinearToneMapping, - Reinhard: THREE.ReinhardToneMapping, - Cineon: THREE.CineonToneMapping, - ACESFilmic: THREE.ACESFilmicToneMapping, - AgX: THREE.AgXToneMapping, - Neutral: THREE.NeutralToneMapping, - Custom: THREE.CustomToneMapping, -}; - -init().catch(function (err) { - console.error(err); -}); - -async function init() { - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderer.toneMapping = toneMappingOptions[params.toneMapping]; - renderer.toneMappingExposure = params.exposure; - - // Set CustomToneMapping to Uncharted2 - // source: http://filmicworlds.com/blog/filmic-tonemapping-operators/ - - THREE.ShaderChunk.tonemapping_pars_fragment = THREE.ShaderChunk.tonemapping_pars_fragment.replace( - 'vec3 CustomToneMapping( vec3 color ) { return color; }', - - `#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) ) - - float toneMappingWhitePoint = 1.0; - - vec3 CustomToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) ); - - }`, - ); - - scene = new THREE.Scene(); - scene.backgroundBlurriness = params.blurriness; - - const light = new THREE.DirectionalLight(0xfff3ee, 3); // simulate sun - light.position.set(1, 0.05, 0.7); - scene.add(light); - - // scene.add( new THREE.DirectionalLightHelper( light, 1, 0x000000 ) ); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.set(-0.02, 0.03, 0.05); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enablePan = false; - controls.enableDamping = true; - controls.minDistance = 0.03; - controls.maxDistance = 0.2; - controls.target.set(0, 0.03, 0); - controls.update(); - - const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); - - const dracoLoader = new DRACOLoader(); - const gltfLoader = new GLTFLoader(); - gltfLoader.setDRACOLoader(dracoLoader); - gltfLoader.setPath('models/gltf/'); - - const [texture, gltf] = await Promise.all([ - hdrLoader.loadAsync('venice_sunset_1k.hdr'), - gltfLoader.loadAsync('venice_mask.glb'), - ]); - - // environment - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - // model - - scene.add(gltf.scene); - - window.addEventListener('resize', onWindowResize); - - // - - gui = new GUI(); - const toneMappingFolder = gui.addFolder('Tone Mapping'); - - toneMappingFolder - .add(params, 'toneMapping', Object.keys(toneMappingOptions)) - - .name('type') - .onChange(function () { - updateGUI(); - - renderer.toneMapping = toneMappingOptions[params.toneMapping]; - }); - - guiExposure = toneMappingFolder - .add(params, 'exposure', 0, 2) - - .onChange(function (value) { - renderer.toneMappingExposure = value; - }); - - const backgroundFolder = gui.addFolder('Background'); - - backgroundFolder - .add(params, 'blurriness', 0, 1) - - .onChange(function (value) { - scene.backgroundBlurriness = value; - }); - - backgroundFolder - .add(params, 'intensity', 0, 1) - - .onChange(function (value) { - scene.backgroundIntensity = value; - }); - - updateGUI(); - - gui.open(); -} - -function updateGUI() { - if (params.toneMapping === 'None') { - guiExposure.hide(); - } else { - guiExposure.show(); - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_tsl_clearcoat.ts b/examples-testing/examples/webgl_tsl_clearcoat.ts deleted file mode 100644 index 75a62894f..000000000 --- a/examples-testing/examples/webgl_tsl_clearcoat.ts +++ /dev/null @@ -1,210 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; -import { WebGLRenderer } from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; - -import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; - -let camera, scene, renderer; - -let particleLight; -let group; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.25, 50); - camera.position.z = 10; - - scene = new THREE.Scene(); - - group = new THREE.Group(); - - new HDRCubeTextureLoader() - .setPath('textures/cube/pisaHDR/') - .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], async function (texture) { - const geometry = new THREE.SphereGeometry(0.8, 64, 32); - - const textureLoader = new THREE.TextureLoader(); - - const diffuse = textureLoader.load('textures/carbon/Carbon.png'); - diffuse.colorSpace = THREE.SRGBColorSpace; - diffuse.wrapS = THREE.RepeatWrapping; - diffuse.wrapT = THREE.RepeatWrapping; - diffuse.repeat.x = 10; - diffuse.repeat.y = 10; - - const normalMap = textureLoader.load('textures/carbon/Carbon_Normal.png'); - normalMap.wrapS = THREE.RepeatWrapping; - normalMap.wrapT = THREE.RepeatWrapping; - normalMap.repeat.x = 10; - normalMap.repeat.y = 10; - - const normalMap2 = textureLoader.load('textures/water/Water_1_M_Normal.jpg'); - - const normalMap3 = new THREE.CanvasTexture(new FlakesTexture()); - normalMap3.wrapS = THREE.RepeatWrapping; - normalMap3.wrapT = THREE.RepeatWrapping; - normalMap3.repeat.x = 10; - normalMap3.repeat.y = 6; - normalMap3.anisotropy = 16; - - const normalMap4 = textureLoader.load('textures/golfball.jpg'); - - const clearcoatNormalMap = textureLoader.load( - 'textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png', - ); - - // car paint - - let material = new THREE.MeshPhysicalNodeMaterial({ - clearcoat: 1.0, - clearcoatRoughness: 0.1, - metalness: 0.9, - roughness: 0.5, - color: 0x0000ff, - normalMap: normalMap3, - normalScale: new THREE.Vector2(0.15, 0.15), - }); - let mesh = new THREE.Mesh(geometry, material); - mesh.position.x = -1; - mesh.position.y = 1; - mesh.castShadow = true; - mesh.receiveShadow = true; - group.add(mesh); - - // fibers - - material = new THREE.MeshPhysicalNodeMaterial({ - roughness: 0.5, - clearcoat: 1.0, - clearcoatRoughness: 0.1, - map: diffuse, - normalMap: normalMap, - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = 1; - mesh.position.y = 1; - mesh.castShadow = true; - mesh.receiveShadow = true; - group.add(mesh); - - // golf - - material = new THREE.MeshPhysicalNodeMaterial({ - metalness: 0.0, - roughness: 0.1, - clearcoat: 1.0, - normalMap: normalMap4, - clearcoatNormalMap: clearcoatNormalMap, - - // y scale is negated to compensate for normal map handedness. - clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = -1; - mesh.position.y = -1; - mesh.castShadow = true; - mesh.receiveShadow = true; - group.add(mesh); - - // clearcoat + normalmap - - material = new THREE.MeshPhysicalNodeMaterial({ - clearcoat: 1.0, - metalness: 1.0, - color: 0xff0000, - normalMap: normalMap2, - normalScale: new THREE.Vector2(0.15, 0.15), - clearcoatNormalMap: clearcoatNormalMap, - - // y scale is negated to compensate for normal map handedness. - clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = 1; - mesh.position.y = -1; - mesh.castShadow = true; - mesh.receiveShadow = true; - group.add(mesh); - - // - - scene.background = texture; - scene.environment = texture; - - // wait until the models can be added to the scene without blocking due to shader compilation - - await renderer.compileAsync(group, camera, scene); - - scene.add(group); - }); - - // LIGHTS - - particleLight = new THREE.Mesh( - new THREE.SphereGeometry(0.05, 8, 8), - new THREE.MeshBasicNodeMaterial({ color: 0xffffff }), - ); - scene.add(particleLight); - - const pointLight = new THREE.PointLight(0xffffff, 30); - pointLight.castShadow = true; - particleLight.add(pointLight); - - renderer = new WebGLRenderer({ antialias: true }); - renderer.setNodesHandler(new WebGLNodesHandler()); - renderer.shadowMap.enabled = true; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.25; - - // EVENTS - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 3; - controls.maxDistance = 30; - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -// - -function animate() { - render(); -} - -function render() { - const timer = Date.now() * 0.00025; - - particleLight.position.x = Math.sin(timer * 7) * 3; - particleLight.position.y = Math.cos(timer * 5) * 4; - particleLight.position.z = Math.cos(timer * 3) * 3; - - for (let i = 0; i < group.children.length; i++) { - const child = group.children[i]; - child.rotation.y += 0.005; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_tsl_instancing.ts b/examples-testing/examples/webgl_tsl_instancing.ts deleted file mode 100644 index c80bebf9b..000000000 --- a/examples-testing/examples/webgl_tsl_instancing.ts +++ /dev/null @@ -1,286 +0,0 @@ -import * as THREE from 'three'; -import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; -import { MeshPhongNodeMaterial } from 'three/webgpu'; -import { sin, time, vec3, positionWorld } from 'three/tsl'; - -let container, stats, gui, guiStatsEl; -let camera, controls, scene, renderer, material; - -// gui - -const Method = { - INSTANCED: 'INSTANCED', - MERGED: 'MERGED', - NAIVE: 'NAIVE', -}; - -const api = { - method: Method.INSTANCED, - count: 1000, -}; - -// - -init(); -initMesh(); - -// - -function clean() { - const meshes = []; - - scene.traverse(function (object) { - if (object.isMesh) meshes.push(object); - }); - - for (let i = 0; i < meshes.length; i++) { - const mesh = meshes[i]; - mesh.material.dispose(); - mesh.geometry.dispose(); - - scene.remove(mesh); - } -} - -const randomizeMatrix = (function () { - const position = new THREE.Vector3(); - const quaternion = new THREE.Quaternion(); - const scale = new THREE.Vector3(); - - return function (matrix) { - position.x = Math.random() * 40 - 20; - position.y = Math.random() * 40 - 20; - position.z = Math.random() * 40 - 20; - - quaternion.random(); - - scale.x = scale.y = scale.z = Math.random() * 1; - - matrix.compose(position, quaternion, scale); - }; -})(); - -function initMesh() { - clean(); - - // make instances - new THREE.BufferGeometryLoader().setPath('models/json/').load('suzanne_buffergeometry.json', function (geometry) { - const posY = positionWorld; - const t = time.mul(4); - material = new MeshPhongNodeMaterial(); - material.colorNode = vec3( - sin(posY.mul(0.1).add(t)).mul(0.5).add(0.5).x, - sin(posY.mul(0.1).add(t.mul(0.5).add(2))) - .mul(0.5) - .add(0.5).y, - sin(posY.mul(0.1).add(t.mul(1.5).add(4))) - .mul(0.5) - .add(0.5).z, - ); - - geometry.computeVertexNormals(); - - console.time(api.method + ' (build)'); - - switch (api.method) { - case Method.INSTANCED: - makeInstanced(geometry); - break; - - case Method.MERGED: - makeMerged(geometry); - break; - - case Method.NAIVE: - makeNaive(geometry); - break; - } - - console.timeEnd(api.method + ' (build)'); - }); -} - -function makeInstanced(geometry) { - const matrix = new THREE.Matrix4(); - const mesh = new THREE.InstancedMesh(geometry, material, api.count); - - for (let i = 0; i < api.count; i++) { - randomizeMatrix(matrix); - mesh.setMatrixAt(i, matrix); - } - - scene.add(mesh); - - // - - const geometryByteLength = getGeometryByteLength(geometry); - - guiStatsEl.innerHTML = [ - 'GPU draw calls: 1', - 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), - ].join('
'); -} - -function makeMerged(geometry) { - const geometries = []; - const matrix = new THREE.Matrix4(); - - for (let i = 0; i < api.count; i++) { - randomizeMatrix(matrix); - - const instanceGeometry = geometry.clone(); - instanceGeometry.applyMatrix4(matrix); - - geometries.push(instanceGeometry); - } - - const mergedGeometry = BufferGeometryUtils.mergeGeometries(geometries); - - scene.add(new THREE.Mesh(mergedGeometry, material)); - - // - - guiStatsEl.innerHTML = [ - 'GPU draw calls: 1', - 'GPU memory: ' + formatBytes(getGeometryByteLength(mergedGeometry), 2), - ].join('
'); -} - -function makeNaive(geometry) { - const matrix = new THREE.Matrix4(); - - for (let i = 0; i < api.count; i++) { - randomizeMatrix(matrix); - - const mesh = new THREE.Mesh(geometry, material); - mesh.applyMatrix4(matrix); - - scene.add(mesh); - } - - // - - const geometryByteLength = getGeometryByteLength(geometry); - - guiStatsEl.innerHTML = [ - 'GPU draw calls: ' + api.count, - 'GPU memory: ' + formatBytes(api.count * 16 + geometryByteLength, 2), - ].join('
'); -} - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - - // camera - - camera = new THREE.PerspectiveCamera(70, width / height, 1, 100); - camera.position.z = 30; - - // renderer - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setNodesHandler(new WebGLNodesHandler()); - - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - container = document.getElementById('container'); - container.appendChild(renderer.domElement); - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = 0.5; - - // light - - const ambientLight = new THREE.AmbientLight(0xffffff, 2); - const directionalLight = new THREE.DirectionalLight(0xffffff, 2); - directionalLight.position.set(1, 1, 1); - scene.add(directionalLight, ambientLight); - - // stats - - stats = new Stats(); - container.appendChild(stats.dom); - - // gui - - gui = new GUI(); - gui.add(api, 'method', Method).onChange(initMesh); - gui.add(api, 'count', 1, 10000).step(1).onChange(initMesh); - - const perfFolder = gui.addFolder('Performance'); - - guiStatsEl = document.createElement('div'); - guiStatsEl.classList.add('gui-stats'); - - perfFolder.$children.appendChild(guiStatsEl); - perfFolder.open(); - - // listeners - - window.addEventListener('resize', onWindowResize); - - Object.assign(window, { scene }); -} - -// - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); - - stats.update(); -} - -// - -function getGeometryByteLength(geometry) { - let total = 0; - - if (geometry.index) total += geometry.index.array.byteLength; - - for (const name in geometry.attributes) { - total += geometry.attributes[name].array.byteLength; - } - - return total; -} - -// Source: https://stackoverflow.com/a/18650828/1314762 -function formatBytes(bytes, decimals) { - if (bytes === 0) return '0 bytes'; - - const k = 1024; - const dm = decimals < 0 ? 0 : decimals; - const sizes = ['bytes', 'KB', 'MB']; - - const i = Math.floor(Math.log(bytes) / Math.log(k)); - - return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]; -} diff --git a/examples-testing/examples/webgl_tsl_shadowmap.ts b/examples-testing/examples/webgl_tsl_shadowmap.ts deleted file mode 100644 index f006d7c1a..000000000 --- a/examples-testing/examples/webgl_tsl_shadowmap.ts +++ /dev/null @@ -1,160 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; -import { WebGLRenderer } from 'three'; -import { mx_fractal_noise_float, mx_fractal_noise_vec3, positionLocal, positionWorld, Fn, color } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, timer; -let dirLight, spotLight; -let torusKnot, dirGroup; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 10, 20); - - scene = new THREE.Scene(); - scene.backgroundNode = color(0x222244); - scene.fog = new THREE.Fog(0x222244, 50, 100); - - // lights - - scene.add(new THREE.AmbientLight(0x444444, 2)); - - spotLight = new THREE.SpotLight(0xff8888, 400); - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.3; - spotLight.position.set(8, 10, 5); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 8; - spotLight.shadow.camera.far = 200; - spotLight.shadow.mapSize.width = 2048; - spotLight.shadow.mapSize.height = 2048; - spotLight.shadow.radius = 4; - scene.add(spotLight); - - dirLight = new THREE.DirectionalLight(0x8888ff, 3); - dirLight.position.set(3, 12, 17); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = 500; - dirLight.shadow.camera.right = 17; - dirLight.shadow.camera.left = -17; - dirLight.shadow.camera.top = 17; - dirLight.shadow.camera.bottom = -17; - dirLight.shadow.mapSize.width = 2048; - dirLight.shadow.mapSize.height = 2048; - dirLight.shadow.radius = 4; - - dirGroup = new THREE.Group(); - dirGroup.add(dirLight); - scene.add(dirGroup); - - // geometry - - const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 80); - const material = new THREE.MeshPhongNodeMaterial({ - color: 0x999999, - shininess: 0, - specular: 0x222222, - }); - - const materialCustomShadow = material.clone(); - materialCustomShadow.transparent = true; - - const discardNode = mx_fractal_noise_float(positionLocal.mul(0.1)).x.greaterThan(0.0); - - materialCustomShadow.maskNode = discardNode; - - torusKnot = new THREE.Mesh(geometry, materialCustomShadow); - torusKnot.scale.multiplyScalar(1 / 18); - torusKnot.position.y = 3; - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); - - const pillar1 = new THREE.Mesh(cylinderGeometry, material); - pillar1.position.set(8, 3.5, 8); - pillar1.castShadow = true; - - const pillar2 = pillar1.clone(); - pillar2.position.set(8, 3.5, -8); - const pillar3 = pillar1.clone(); - pillar3.position.set(-8, 3.5, 8); - const pillar4 = pillar1.clone(); - pillar4.position.set(-8, 3.5, -8); - - scene.add(pillar1); - scene.add(pillar2); - scene.add(pillar3); - scene.add(pillar4); - - const planeGeometry = new THREE.PlaneGeometry(200, 200); - - const planeMaterial = new THREE.MeshPhongNodeMaterial(); - planeMaterial.color.setHex(0x999999); - planeMaterial.shininess = 0; - planeMaterial.specular.setHex(0x111111); - - planeMaterial.colorNode = Fn(() => { - const pos = positionWorld.toVar(); - pos.xz.addAssign(mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().xz); - return mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().zzz.mul(0.2).add(0.5); - })(); - - const ground = new THREE.Mesh(planeGeometry, planeMaterial); - ground.rotation.x = -Math.PI / 2; - ground.scale.multiplyScalar(3); - ground.castShadow = true; - ground.receiveShadow = true; - scene.add(ground); - - // renderer - - renderer = new WebGLRenderer({ antialias: true }); - renderer.setNodesHandler(new WebGLNodesHandler()); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - document.body.appendChild(renderer.domElement); - - // Mouse control - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2, 0); - controls.minDistance = 7; - controls.maxDistance = 40; - controls.update(); - - timer = new THREE.Timer(); - timer.connect(document); - - window.addEventListener('resize', resize); -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(time) { - timer.update(); - - const delta = timer.getDelta(); - - torusKnot.rotation.x += 0.25 * delta; - torusKnot.rotation.y += 0.5 * delta; - torusKnot.rotation.z += 1 * delta; - - dirGroup.rotation.y += 0.7 * delta; - dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_tsl_skinning.ts b/examples-testing/examples/webgl_tsl_skinning.ts deleted file mode 100644 index 6164dbab6..000000000 --- a/examples-testing/examples/webgl_tsl_skinning.ts +++ /dev/null @@ -1,74 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { WebGLNodesHandler } from 'three/addons/tsl/WebGLNodesHandler.js'; -import { WebGLRenderer } from 'three'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer; - -let mixer, timer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.set(1, 2, 3); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x3355aa); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - //lights - - const light = new THREE.PointLight(0xffffff, 1, 100); - light.power = 2500; - camera.add(light); - scene.add(camera); - - const ambient = new THREE.AmbientLight(0x4466ff, 1); - scene.add(ambient); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Michelle.glb', function (gltf) { - const object = gltf.scene; - mixer = new THREE.AnimationMixer(object); - - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - scene.add(object); - }); - - //renderer - - renderer = new WebGLRenderer({ antialias: true }); - renderer.setNodesHandler(new WebGLNodesHandler()); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.LinearToneMapping; - renderer.toneMappingExposure = 0.4; - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_ubo.ts b/examples-testing/examples/webgl_ubo.ts deleted file mode 100644 index a34a5b2ff..000000000 --- a/examples-testing/examples/webgl_ubo.ts +++ /dev/null @@ -1,140 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer, timer; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 25); - - scene = new THREE.Scene(); - camera.lookAt(scene.position); - - timer = new THREE.Timer(); - timer.connect(document); - - // geometry - - const geometry1 = new THREE.TetrahedronGeometry(); - const geometry2 = new THREE.BoxGeometry(); - - // texture - - const texture = new THREE.TextureLoader().load('textures/crate.gif'); - texture.colorSpace = THREE.SRGBColorSpace; - - // uniforms groups - - // Camera and lighting related data are perfect examples of using UBOs since you have to store these - // data just once. They can be shared across all shader programs. - - const cameraUniformsGroup = new THREE.UniformsGroup(); - cameraUniformsGroup.setName('ViewData'); - cameraUniformsGroup.add(new THREE.Uniform(camera.projectionMatrix)); // projection matrix - cameraUniformsGroup.add(new THREE.Uniform(camera.matrixWorldInverse)); // view matrix - - const lightingUniformsGroup = new THREE.UniformsGroup(); - lightingUniformsGroup.setName('LightingData'); - lightingUniformsGroup.add(new THREE.Uniform(new THREE.Vector3(0, 0, 10))); // light position - lightingUniformsGroup.add(new THREE.Uniform(new THREE.Color(0x7c7c7c))); // ambient color - lightingUniformsGroup.add(new THREE.Uniform(new THREE.Color(0xd5d5d5))); // diffuse color - lightingUniformsGroup.add(new THREE.Uniform(new THREE.Color(0xe7e7e7))); // specular color - lightingUniformsGroup.add(new THREE.Uniform(64)); // shininess - - // materials - - const material1 = new THREE.RawShaderMaterial({ - uniforms: { - modelMatrix: { value: null }, - normalMatrix: { value: null }, - color: { value: null }, - }, - vertexShader: document.getElementById('vertexShader1').textContent, - fragmentShader: document.getElementById('fragmentShader1').textContent, - glslVersion: THREE.GLSL3, - }); - - const material2 = new THREE.RawShaderMaterial({ - uniforms: { - modelMatrix: { value: null }, - diffuseMap: { value: null }, - }, - vertexShader: document.getElementById('vertexShader2').textContent, - fragmentShader: document.getElementById('fragmentShader2').textContent, - glslVersion: THREE.GLSL3, - }); - - // meshes - - for (let i = 0; i < 200; i++) { - let mesh; - - if (i % 2 === 0) { - mesh = new THREE.Mesh(geometry1, material1.clone()); - - mesh.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; - mesh.material.uniforms.modelMatrix.value = mesh.matrixWorld; - mesh.material.uniforms.normalMatrix.value = mesh.normalMatrix; - mesh.material.uniforms.color.value = new THREE.Color(0xffffff * Math.random()); - } else { - mesh = new THREE.Mesh(geometry2, material2.clone()); - - mesh.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; - mesh.material.uniforms.modelMatrix.value = mesh.matrixWorld; - mesh.material.uniforms.diffuseMap.value = texture; - } - - scene.add(mesh); - - const s = 1 + Math.random() * 0.5; - - mesh.scale.x = s; - mesh.scale.y = s; - mesh.scale.z = s; - - mesh.rotation.x = Math.random() * Math.PI; - mesh.rotation.y = Math.random() * Math.PI; - mesh.rotation.z = Math.random() * Math.PI; - - mesh.position.x = Math.random() * 40 - 20; - mesh.position.y = Math.random() * 40 - 20; - mesh.position.z = Math.random() * 20 - 10; - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize, false); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - scene.traverse(function (child) { - if (child.isMesh) { - child.rotation.x += delta * 0.5; - child.rotation.y += delta * 0.3; - } - }); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_ubo_arrays.ts b/examples-testing/examples/webgl_ubo_arrays.ts deleted file mode 100644 index 1d8f5f763..000000000 --- a/examples-testing/examples/webgl_ubo_arrays.ts +++ /dev/null @@ -1,174 +0,0 @@ -import * as THREE from 'three'; - -import Stats from 'three/addons/libs/stats.module.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, timer, stats; - -let lightingUniformsGroup, lightCenters; - -const container = document.getElementById('container'); - -const pointLightsMax = 300; - -const api = { - count: 200, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 50, 50); - - scene = new THREE.Scene(); - camera.lookAt(scene.position); - - timer = new THREE.Timer(); - timer.connect(document); - - // geometry - - const geometry = new THREE.SphereGeometry(); - - // uniforms groups - - lightingUniformsGroup = new THREE.UniformsGroup(); - lightingUniformsGroup.setName('LightingData'); - - const data = []; - const dataColors = []; - lightCenters = []; - - for (let i = 0; i < pointLightsMax; i++) { - const col = new THREE.Color(0xffffff * Math.random()).toArray(); - const x = Math.random() * 50 - 25; - const z = Math.random() * 50 - 25; - - data.push(new THREE.Uniform(new THREE.Vector4(x, 1, z, 0))); // light position - dataColors.push(new THREE.Uniform(new THREE.Vector4(col[0], col[1], col[2], 0))); // light color - - // Store the center positions - lightCenters.push({ x, z }); - } - - lightingUniformsGroup.add(data); // light position - lightingUniformsGroup.add(dataColors); // light position - lightingUniformsGroup.add(new THREE.Uniform(pointLightsMax)); // light position - - const cameraUniformsGroup = new THREE.UniformsGroup(); - cameraUniformsGroup.setName('ViewData'); - cameraUniformsGroup.add(new THREE.Uniform(camera.projectionMatrix)); // projection matrix - cameraUniformsGroup.add(new THREE.Uniform(camera.matrixWorldInverse)); // view matrix - - const material = new THREE.RawShaderMaterial({ - uniforms: { - modelMatrix: { value: null }, - normalMatrix: { value: null }, - }, - // uniformsGroups: [ cameraUniformsGroup, lightingUniformsGroup ], - name: 'Box', - defines: { - POINTLIGHTS_MAX: pointLightsMax, - }, - vertexShader: document.getElementById('vertexShader').textContent, - fragmentShader: document.getElementById('fragmentShader').textContent, - glslVersion: THREE.GLSL3, - }); - - const plane = new THREE.Mesh(new THREE.PlaneGeometry(100, 100), material.clone()); - plane.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; - plane.material.uniforms.modelMatrix.value = plane.matrixWorld; - plane.material.uniforms.normalMatrix.value = plane.normalMatrix; - plane.rotation.x = -Math.PI / 2; - plane.position.y = -1; - scene.add(plane); - - // meshes - const gridSize = { x: 10, y: 1, z: 10 }; - const spacing = 6; - - for (let i = 0; i < gridSize.x; i++) { - for (let j = 0; j < gridSize.y; j++) { - for (let k = 0; k < gridSize.z; k++) { - const mesh = new THREE.Mesh(geometry, material.clone()); - mesh.name = 'Sphere'; - mesh.material.uniformsGroups = [cameraUniformsGroup, lightingUniformsGroup]; - mesh.material.uniforms.modelMatrix.value = mesh.matrixWorld; - mesh.material.uniforms.normalMatrix.value = mesh.normalMatrix; - scene.add(mesh); - - mesh.position.x = i * spacing - (gridSize.x * spacing) / 2; - mesh.position.y = 0; - mesh.position.z = k * spacing - (gridSize.z * spacing) / 2; - } - } - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize, false); - - // controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enablePan = false; - - // stats - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // gui - const gui = new GUI(); - gui.add(api, 'count', 1, pointLightsMax) - .step(1) - .onChange(function () { - lightingUniformsGroup.uniforms[2].value = api.count; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const elapsedTime = timer.getElapsed(); - - const lights = lightingUniformsGroup.uniforms[0]; - - // Parameters for circular movement - const radius = 5; // Smaller radius for individual circular movements - const speed = 0.5; // Speed of rotation - - // Update each light's position - for (let i = 0; i < lights.length; i++) { - const light = lights[i]; - const center = lightCenters[i]; - - // Calculate circular movement around the light's center - const angle = speed * elapsedTime + i * 0.5; // Phase difference for each light - const x = center.x + Math.sin(angle) * radius; - const z = center.z + Math.cos(angle) * radius; - - // Update the light's position - light.value.set(x, 1, z, 0); - } - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgl_video_kinect.ts b/examples-testing/examples/webgl_video_kinect.ts deleted file mode 100644 index 4ba1b2b49..000000000 --- a/examples-testing/examples/webgl_video_kinect.ts +++ /dev/null @@ -1,109 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer; -let geometry, mesh, material; -let mouse, center; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.set(0, 0, 500); - - scene = new THREE.Scene(); - center = new THREE.Vector3(); - center.z = -1000; - - const video = document.getElementById('video'); - - const texture = new THREE.VideoTexture(video); - texture.minFilter = THREE.NearestFilter; - texture.generateMipmaps = false; - - const width = 640, - height = 480; - const nearClipping = 850, - farClipping = 4000; - - geometry = new THREE.BufferGeometry(); - - const vertices = new Float32Array(width * height * 3); - - for (let i = 0, j = 0, l = vertices.length; i < l; i += 3, j++) { - vertices[i] = j % width; - vertices[i + 1] = Math.floor(j / width); - } - - geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3)); - - material = new THREE.ShaderMaterial({ - uniforms: { - map: { value: texture }, - width: { value: width }, - height: { value: height }, - nearClipping: { value: nearClipping }, - farClipping: { value: farClipping }, - - pointSize: { value: 2 }, - zOffset: { value: 1000 }, - }, - vertexShader: document.getElementById('vs').textContent, - fragmentShader: document.getElementById('fs').textContent, - blending: THREE.AdditiveBlending, - depthTest: false, - depthWrite: false, - transparent: true, - }); - - mesh = new THREE.Points(geometry, material); - scene.add(mesh); - - const gui = new GUI(); - gui.add(material.uniforms.nearClipping, 'value', 1, 10000, 1.0).name('nearClipping'); - gui.add(material.uniforms.farClipping, 'value', 1, 10000, 1.0).name('farClipping'); - gui.add(material.uniforms.pointSize, 'value', 1, 10, 1.0).name('pointSize'); - gui.add(material.uniforms.zOffset, 'value', 0, 4000, 1.0).name('zOffset'); - - video.play(); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - mouse = new THREE.Vector3(0, 0, 1); - - document.addEventListener('mousemove', onDocumentMouseMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentMouseMove(event) { - mouse.x = (event.clientX - window.innerWidth / 2) * 8; - mouse.y = (event.clientY - window.innerHeight / 2) * 8; -} - -function animate() { - camera.position.x += (mouse.x - camera.position.x) * 0.05; - camera.position.y += (-mouse.y - camera.position.y) * 0.05; - camera.lookAt(center); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_video_panorama_equirectangular.ts b/examples-testing/examples/webgl_video_panorama_equirectangular.ts deleted file mode 100644 index 866eca16a..000000000 --- a/examples-testing/examples/webgl_video_panorama_equirectangular.ts +++ /dev/null @@ -1,95 +0,0 @@ -import * as THREE from 'three'; - -let camera, scene, renderer; - -let isUserInteracting = false, - lon = 0, - lat = 0, - phi = 0, - theta = 0, - onPointerDownPointerX = 0, - onPointerDownPointerY = 0, - onPointerDownLon = 0, - onPointerDownLat = 0; - -const distance = 0.5; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.25, 10); - - scene = new THREE.Scene(); - - const geometry = new THREE.SphereGeometry(5, 60, 40); - // invert the geometry on the x-axis so that all of the faces point inward - geometry.scale(-1, 1, 1); - - const video = document.getElementById('video'); - video.play(); - - const texture = new THREE.VideoTexture(video); - texture.colorSpace = THREE.SRGBColorSpace; - const material = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - document.addEventListener('pointerdown', onPointerDown); - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerup', onPointerUp); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerDown(event) { - isUserInteracting = true; - - onPointerDownPointerX = event.clientX; - onPointerDownPointerY = event.clientY; - - onPointerDownLon = lon; - onPointerDownLat = lat; -} - -function onPointerMove(event) { - if (isUserInteracting === true) { - lon = (onPointerDownPointerX - event.clientX) * 0.1 + onPointerDownLon; - lat = (onPointerDownPointerY - event.clientY) * 0.1 + onPointerDownLat; - } -} - -function onPointerUp() { - isUserInteracting = false; -} - -function animate() { - lat = Math.max(-85, Math.min(85, lat)); - phi = THREE.MathUtils.degToRad(90 - lat); - theta = THREE.MathUtils.degToRad(lon); - - camera.position.x = distance * Math.sin(phi) * Math.cos(theta); - camera.position.y = distance * Math.cos(phi); - camera.position.z = distance * Math.sin(phi) * Math.sin(theta); - - camera.lookAt(0, 0, 0); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_volume_cloud.ts b/examples-testing/examples/webgl_volume_cloud.ts deleted file mode 100644 index 9aa07b98f..000000000 --- a/examples-testing/examples/webgl_volume_cloud.ts +++ /dev/null @@ -1,279 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let renderer, scene, camera; -let mesh; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 1.5); - - new OrbitControls(camera, renderer.domElement); - - // Sky - - const canvas = document.createElement('canvas'); - canvas.width = 1; - canvas.height = 32; - - const context = canvas.getContext('2d'); - const gradient = context.createLinearGradient(0, 0, 0, 32); - gradient.addColorStop(0.0, '#014a84'); - gradient.addColorStop(0.5, '#0561a0'); - gradient.addColorStop(1.0, '#437ab6'); - context.fillStyle = gradient; - context.fillRect(0, 0, 1, 32); - - const skyMap = new THREE.CanvasTexture(canvas); - skyMap.colorSpace = THREE.SRGBColorSpace; - - const sky = new THREE.Mesh( - new THREE.SphereGeometry(10), - new THREE.MeshBasicMaterial({ map: skyMap, side: THREE.BackSide }), - ); - scene.add(sky); - - // Texture - - const size = 128; - const data = new Uint8Array(size * size * size); - - let i = 0; - const scale = 0.05; - const perlin = new ImprovedNoise(); - const vector = new THREE.Vector3(); - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - const d = - 1.0 - - vector - .set(x, y, z) - .subScalar(size / 2) - .divideScalar(size) - .length(); - data[i] = (128 + 128 * perlin.noise((x * scale) / 1.5, y * scale, (z * scale) / 1.5)) * d * d; - i++; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - // Material - - const vertexShader = /* glsl */ ` - in vec3 position; - - uniform mat4 modelMatrix; - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - uniform vec3 cameraPos; - - out vec3 vOrigin; - out vec3 vDirection; - - void main() { - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - - vOrigin = vec3( inverse( modelMatrix ) * vec4( cameraPos, 1.0 ) ).xyz; - vDirection = position - vOrigin; - - gl_Position = projectionMatrix * mvPosition; - } - `; - - const fragmentShader = /* glsl */ ` - precision highp float; - precision highp sampler3D; - - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - - in vec3 vOrigin; - in vec3 vDirection; - - out vec4 color; - - uniform vec3 base; - uniform sampler3D map; - - uniform float threshold; - uniform float range; - uniform float opacity; - uniform float steps; - uniform float frame; - - uint wang_hash(uint seed) - { - seed = (seed ^ 61u) ^ (seed >> 16u); - seed *= 9u; - seed = seed ^ (seed >> 4u); - seed *= 0x27d4eb2du; - seed = seed ^ (seed >> 15u); - return seed; - } - - float randomFloat(inout uint seed) - { - return float(wang_hash(seed)) / 4294967296.; - } - - vec2 hitBox( vec3 orig, vec3 dir ) { - const vec3 box_min = vec3( - 0.5 ); - const vec3 box_max = vec3( 0.5 ); - vec3 inv_dir = 1.0 / dir; - vec3 tmin_tmp = ( box_min - orig ) * inv_dir; - vec3 tmax_tmp = ( box_max - orig ) * inv_dir; - vec3 tmin = min( tmin_tmp, tmax_tmp ); - vec3 tmax = max( tmin_tmp, tmax_tmp ); - float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); - float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); - return vec2( t0, t1 ); - } - - float sample1( vec3 p ) { - return texture( map, p ).r; - } - - float shading( vec3 coord ) { - float step = 0.01; - return sample1( coord + vec3( - step ) ) - sample1( coord + vec3( step ) ); - } - - vec4 linearToSRGB( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); - } - - void main(){ - vec3 rayDir = normalize( vDirection ); - vec2 bounds = hitBox( vOrigin, rayDir ); - - if ( bounds.x > bounds.y ) discard; - - bounds.x = max( bounds.x, 0.0 ); - - float stepSize = ( bounds.y - bounds.x ) / steps; - - // Jitter - - // Nice little seed from - // https://blog.demofox.org/2020/05/25/casual-shadertoy-path-tracing-1-basic-camera-diffuse-emissive/ - uint seed = uint( gl_FragCoord.x ) * uint( 1973 ) + uint( gl_FragCoord.y ) * uint( 9277 ) + uint( frame ) * uint( 26699 ); - vec3 size = vec3( textureSize( map, 0 ) ); - float randNum = randomFloat( seed ) * 2.0 - 1.0; - vec3 p = vOrigin + bounds.x * rayDir; - p += rayDir * randNum * ( 1.0 / size ); - - // - - vec4 ac = vec4( base, 0.0 ); - - for ( float i = 0.0; i < steps; i += 1.0 ) { - - float t = bounds.x + i * stepSize; - - float d = sample1( p + 0.5 ); - - d = smoothstep( threshold - range, threshold + range, d ) * opacity; - - float col = shading( p + 0.5 ) * 3.0 + ( ( p.x + p.y ) * 0.25 ) + 0.2; - - ac.rgb += ( 1.0 - ac.a ) * d * col; - - ac.a += ( 1.0 - ac.a ) * d; - - if ( ac.a >= 0.95 ) break; - - p += rayDir * stepSize; - - } - - color = linearToSRGB( ac ); - - if ( color.a == 0.0 ) discard; - - } - `; - - const geometry = new THREE.BoxGeometry(1, 1, 1); - const material = new THREE.RawShaderMaterial({ - glslVersion: THREE.GLSL3, - uniforms: { - base: { value: new THREE.Color(0x798aa0) }, - map: { value: texture }, - cameraPos: { value: new THREE.Vector3() }, - threshold: { value: 0.25 }, - opacity: { value: 0.25 }, - range: { value: 0.1 }, - steps: { value: 100 }, - frame: { value: 0 }, - }, - vertexShader, - fragmentShader, - side: THREE.BackSide, - transparent: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const parameters = { - threshold: 0.25, - opacity: 0.25, - range: 0.1, - steps: 100, - }; - - function update() { - material.uniforms.threshold.value = parameters.threshold; - material.uniforms.opacity.value = parameters.opacity; - material.uniforms.range.value = parameters.range; - material.uniforms.steps.value = parameters.steps; - } - - const gui = new GUI(); - gui.add(parameters, 'threshold', 0, 1, 0.01).onChange(update); - gui.add(parameters, 'opacity', 0, 1, 0.01).onChange(update); - gui.add(parameters, 'range', 0, 1, 0.01).onChange(update); - gui.add(parameters, 'steps', 0, 200, 1).onChange(update); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.material.uniforms.cameraPos.value.copy(camera.position); - mesh.rotation.y = -performance.now() / 7500; - - mesh.material.uniforms.frame.value++; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_volume_instancing.ts b/examples-testing/examples/webgl_volume_instancing.ts deleted file mode 100644 index 7045732d6..000000000 --- a/examples-testing/examples/webgl_volume_instancing.ts +++ /dev/null @@ -1,222 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { VOXLoader, buildData3DTexture } from 'three/addons/loaders/VOXLoader.js'; - -let renderer, scene, camera, controls, timer; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(0, 0, 4); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = -1.0; - controls.enableDamping = true; - - timer = new THREE.Timer(); - timer.connect(document); - - // Material - - const vertexShader = /* glsl */ ` - in vec3 position; - in mat4 instanceMatrix; - - uniform mat4 modelMatrix; - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - uniform vec3 cameraPos; - - out vec4 vScreenPosition; - out mat4 vInstanceToViewMatrix; - - void main() { - vec4 mvPosition = modelViewMatrix * instanceMatrix * vec4( position, 1.0 ); - - gl_Position = projectionMatrix * mvPosition; - vScreenPosition = vec4( gl_Position.xy, 0.0, gl_Position.w ); - vInstanceToViewMatrix = modelViewMatrix * instanceMatrix; - } - `; - - const fragmentShader = /* glsl */ ` - precision highp float; - precision highp sampler3D; - - uniform mat4 viewMatrix; - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - - in vec4 vScreenPosition; - in mat4 vInstanceToViewMatrix; - - out vec4 color; - - uniform sampler3D map; - - vec2 hitBox( vec3 orig, vec3 dir ) { - const vec3 box_min = vec3( - 0.5 ); - const vec3 box_max = vec3( 0.5 ); - vec3 inv_dir = 1.0 / dir; - vec3 tmin_tmp = ( box_min - orig ) * inv_dir; - vec3 tmax_tmp = ( box_max - orig ) * inv_dir; - vec3 tmin = min( tmin_tmp, tmax_tmp ); - vec3 tmax = max( tmin_tmp, tmax_tmp ); - float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); - float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); - return vec2( t0, t1 ); - } - - float sample1( vec3 p ) { - return texture( map, p ).r; - } - - #define epsilon .0001 - - vec3 normal( vec3 coord ) { - if ( coord.x < epsilon ) return vec3( 1.0, 0.0, 0.0 ); - if ( coord.y < epsilon ) return vec3( 0.0, 1.0, 0.0 ); - if ( coord.z < epsilon ) return vec3( 0.0, 0.0, 1.0 ); - if ( coord.x > 1.0 - epsilon ) return vec3( - 1.0, 0.0, 0.0 ); - if ( coord.y > 1.0 - epsilon ) return vec3( 0.0, - 1.0, 0.0 ); - if ( coord.z > 1.0 - epsilon ) return vec3( 0.0, 0.0, - 1.0 ); - - float step = 0.01; - float x = sample1( coord + vec3( - step, 0.0, 0.0 ) ) - sample1( coord + vec3( step, 0.0, 0.0 ) ); - float y = sample1( coord + vec3( 0.0, - step, 0.0 ) ) - sample1( coord + vec3( 0.0, step, 0.0 ) ); - float z = sample1( coord + vec3( 0.0, 0.0, - step ) ) - sample1( coord + vec3( 0.0, 0.0, step ) ); - - return normalize( vec3( x, y, z ) ); - } - - void main() { - - // perform w divide in the fragment shader to avoid interpolation artifacts - vec2 screenUv = vScreenPosition.xy / vScreenPosition.w; - mat4 invProjectionMatrix = inverse( projectionMatrix ); - mat4 invInstanceToViewMatrix = inverse( vInstanceToViewMatrix ); - - // get camera ray - vec4 temp; - vec3 camRayOrigin, camRayEnd; - temp = invProjectionMatrix * vec4( screenUv, - 1.0, 1.0 ); - camRayOrigin = temp.xyz / temp.w; - - temp = invProjectionMatrix * vec4( screenUv, 1.0, 1.0 ); - camRayEnd = temp.xyz / temp.w; - - // get local ray - vec3 instRayOrigin, instRayDirection, instRayEnd; - instRayOrigin = ( invInstanceToViewMatrix * vec4( camRayOrigin, 1.0 ) ).xyz; - instRayEnd = ( invInstanceToViewMatrix * vec4( camRayEnd, 1.0 ) ).xyz; - instRayDirection = normalize( instRayEnd - instRayOrigin ); - - // calculate the start of the ray at the box edge - vec2 bounds = hitBox( instRayOrigin, instRayDirection ); - - if ( bounds.x > bounds.y ) discard; - - bounds.x = max( bounds.x, 0.0 ); - - float stepSize = ( bounds.y - bounds.x ) / 100.0; - - vec3 p; - - // march through the volume - for ( float i = 0.0; i < 100.0; i += 1.0 ) { - - float t = bounds.x + i * stepSize; - p = instRayOrigin + t * instRayDirection; - float d = sample1( p + 0.5 ); - - if ( d > 0.5 ) { - - color.rgb = p * 2.0; - color.a = 1.; - break; - - } - - } - - if ( color.a == 0.0 ) discard; - - // calculate the final point in the ndc coords - vec4 ndc = projectionMatrix * vInstanceToViewMatrix * vec4( p, 1.0 ); - ndc /= ndc.w; - - // map the ndc coordinate to depth - // https://stackoverflow.com/questions/10264949/glsl-gl-fragcoord-z-calculation-and-setting-gl-fragdepth - float far = gl_DepthRange.far; - float near = gl_DepthRange.near; - gl_FragDepth = ( ( ( far - near ) * ndc.z ) + near + far ) / 2.0; - - } - `; - - const loader = new VOXLoader(); - loader.load('models/vox/menger.vox', function (chunks) { - for (let i = 0; i < chunks.length; i++) { - const chunk = chunks[i]; - - const geometry = new THREE.BoxGeometry(1, 1, 1); - const material = new THREE.RawShaderMaterial({ - glslVersion: THREE.GLSL3, - uniforms: { - map: { value: buildData3DTexture(chunk) }, - cameraPos: { value: new THREE.Vector3() }, - }, - vertexShader, - fragmentShader, - side: THREE.BackSide, - }); - - const mesh = new THREE.InstancedMesh(geometry, material, 50000); - mesh.onBeforeRender = function () { - this.material.uniforms.cameraPos.value.copy(camera.position); - }; - - const transform = new THREE.Object3D(); - - for (let i = 0; i < mesh.count; i++) { - transform.position.random().subScalar(0.5).multiplyScalar(150); - transform.rotation.x = Math.random() * Math.PI; - transform.rotation.y = Math.random() * Math.PI; - transform.rotation.z = Math.random() * Math.PI; - transform.updateMatrix(); - - mesh.setMatrixAt(i, transform.matrix); - } - - scene.add(mesh); - } - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - controls.update(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_volume_perlin.ts b/examples-testing/examples/webgl_volume_perlin.ts deleted file mode 100644 index cd66fc7e6..000000000 --- a/examples-testing/examples/webgl_volume_perlin.ts +++ /dev/null @@ -1,235 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let renderer, scene, camera; -let mesh; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 2); - - new OrbitControls(camera, renderer.domElement); - - // Texture - - const size = 128; - const data = new Uint8Array(size * size * size); - - let i = 0; - const perlin = new ImprovedNoise(); - const vector = new THREE.Vector3(); - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - vector.set(x, y, z).divideScalar(size); - - const d = perlin.noise(vector.x * 6.5, vector.y * 6.5, vector.z * 6.5); - - data[i++] = d * 128 + 128; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - // Material - - const vertexShader = /* glsl */ ` - in vec3 position; - - uniform mat4 modelMatrix; - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - uniform vec3 cameraPos; - - out vec3 vOrigin; - out vec3 vDirection; - - void main() { - vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); - - vOrigin = vec3( inverse( modelMatrix ) * vec4( cameraPos, 1.0 ) ).xyz; - vDirection = position - vOrigin; - - gl_Position = projectionMatrix * mvPosition; - } - `; - - const fragmentShader = /* glsl */ ` - precision highp float; - precision highp sampler3D; - - uniform mat4 modelViewMatrix; - uniform mat4 projectionMatrix; - - in vec3 vOrigin; - in vec3 vDirection; - - out vec4 color; - - uniform sampler3D map; - - uniform float threshold; - uniform float steps; - uniform bool refine; - - #define REFINEMENT_STEPS 4 - - vec2 hitBox( vec3 orig, vec3 dir ) { - const vec3 box_min = vec3( - 0.5 ); - const vec3 box_max = vec3( 0.5 ); - vec3 inv_dir = 1.0 / dir; - vec3 tmin_tmp = ( box_min - orig ) * inv_dir; - vec3 tmax_tmp = ( box_max - orig ) * inv_dir; - vec3 tmin = min( tmin_tmp, tmax_tmp ); - vec3 tmax = max( tmin_tmp, tmax_tmp ); - float t0 = max( tmin.x, max( tmin.y, tmin.z ) ); - float t1 = min( tmax.x, min( tmax.y, tmax.z ) ); - return vec2( t0, t1 ); - } - - float sample1( vec3 p ) { - return texture( map, p ).r; - } - - #define epsilon .0001 - - vec3 normal( vec3 coord ) { - if ( coord.x < epsilon ) return vec3( 1.0, 0.0, 0.0 ); - if ( coord.y < epsilon ) return vec3( 0.0, 1.0, 0.0 ); - if ( coord.z < epsilon ) return vec3( 0.0, 0.0, 1.0 ); - if ( coord.x > 1.0 - epsilon ) return vec3( - 1.0, 0.0, 0.0 ); - if ( coord.y > 1.0 - epsilon ) return vec3( 0.0, - 1.0, 0.0 ); - if ( coord.z > 1.0 - epsilon ) return vec3( 0.0, 0.0, - 1.0 ); - - float step = 0.01; - float x = sample1( coord + vec3( - step, 0.0, 0.0 ) ) - sample1( coord + vec3( step, 0.0, 0.0 ) ); - float y = sample1( coord + vec3( 0.0, - step, 0.0 ) ) - sample1( coord + vec3( 0.0, step, 0.0 ) ); - float z = sample1( coord + vec3( 0.0, 0.0, - step ) ) - sample1( coord + vec3( 0.0, 0.0, step ) ); - - return normalize( vec3( x, y, z ) ); - } - - void main(){ - - vec3 rayDir = normalize( vDirection ); - vec2 bounds = hitBox( vOrigin, rayDir ); - - if ( bounds.x > bounds.y ) discard; - - bounds.x = max( bounds.x, 0.0 ); - - float stepSize = ( bounds.y - bounds.x ) / steps; - - for ( float i = 0.0; i < steps; i += 1.0 ) { - - float t = bounds.x + i * stepSize; - vec3 p = vOrigin + t * rayDir; - float d = sample1( p + 0.5 ); - - if ( d > threshold ) { - - if ( refine ) { - - // The surface lies between the previous ray parameter i.e. (t - stepSize) - // and the current ray parameter (t). Bisect that interval to localize - // the crossing precisely. - - float t0 = max( t - stepSize, bounds.x ); - float t1 = t; - - for ( int j = 0; j < REFINEMENT_STEPS; j ++ ) { - - float tm = ( t0 + t1 ) * 0.5; - float dm = sample1( vOrigin + tm * rayDir + 0.5 ); - - bool isGreater = dm > threshold; - t1 = isGreater ? tm : t1; - t0 = isGreater ? t0 : tm; - - } - - p = vOrigin + t1 * rayDir; - - } - - color.rgb = normal( p + 0.5 ) * 0.5 + ( p * 1.5 + 0.25 ); - color.a = 1.; - break; - - } - - } - - if ( color.a == 0.0 ) discard; - - } - `; - - const geometry = new THREE.BoxGeometry(1, 1, 1); - const material = new THREE.RawShaderMaterial({ - glslVersion: THREE.GLSL3, - uniforms: { - map: { value: texture }, - cameraPos: { value: new THREE.Vector3() }, - threshold: { value: 0.6 }, - steps: { value: 200 }, - refine: { value: true }, - }, - vertexShader, - fragmentShader, - side: THREE.BackSide, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const parameters = { threshold: 0.6, steps: 200, refine: true }; - - function update() { - material.uniforms.threshold.value = parameters.threshold; - material.uniforms.steps.value = parameters.steps; - material.uniforms.refine.value = parameters.refine; - } - - const gui = new GUI(); - gui.add(parameters, 'threshold', 0, 1, 0.01).onChange(update); - gui.add(parameters, 'steps', 0, 300, 1).onChange(update); - gui.add(parameters, 'refine').onChange(update); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.material.uniforms.cameraPos.value.copy(camera.position); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgl_watch.ts b/examples-testing/examples/webgl_watch.ts deleted file mode 100644 index 8f3d76c4c..000000000 --- a/examples-testing/examples/webgl_watch.ts +++ /dev/null @@ -1,243 +0,0 @@ -import * as THREE from 'three'; -import * as TWEEN from 'tween'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; -import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; - -let camera, scene, renderer; -let gui, dirLight, pointLight, controls, bloomPass, taaPass; -let ready = false; - -const meshes = {}; -const materials = {}; -const torad = Math.PI / 180; - -const setting = { - roughness: 0.1, - metalness: 1.0, - opacity: 0.8, - threshold: 0, - strength: 0.007, - radius: 0.0, - postProcess: false, -}; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.1, 20); - camera.position.set(0.8, 0.5, -1.5); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGLRenderer({ antialias: true, outputBufferType: THREE.HalfFloatType }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 0.7; - renderer.shadowMap.enabled = true; - container.appendChild(renderer.domElement); - - taaPass = new TAARenderPass(scene, camera); - taaPass.sampleLevel = 2; - - bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); - bloomPass.threshold = setting.threshold; - bloomPass.strength = setting.strength; - bloomPass.radius = setting.radius; - - new HDRLoader().setPath('textures/equirectangular/').load('lobe.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - scene.background = texture; - scene.environment = texture; - scene.backgroundBlurriness = 0.5; - scene.backgroundIntensity = 1.0; - scene.environmentIntensity = 1.5; - - // model - - const loader = new GLTFLoader().setPath('models/gltf/'); - loader.setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)); - loader.load('rolex.glb', function (gltf) { - gltf.scene.rotation.x = Math.PI * 0.25; - - gltf.scene.traverse(child => { - if (child.isMesh || child.isGroup) { - if (child.isMesh) { - child.material.vertexColors = false; - if (materials[child.material.name]) child.material = materials[child.material.name]; - else materials[child.material.name] = child.material; - if (child.name !== 'glass' && child.name !== 'floor') { - child.receiveShadow = true; - child.castShadow = true; - } - } - - meshes[child.name] = child; - } - }); - - scene.add(gltf.scene); - - meshes.glass.material = new THREE.MeshPhysicalMaterial({ - color: 0x020205, - transparent: true, - opacity: setting.opacity, - metalness: 0, - roughness: 0, - iridescence: 0.3, - clearcoat: 1.0, - blending: THREE.AdditiveBlending, - }); - - ready = true; - - createGUI(); - }); - }); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 0.3; - controls.maxDistance = 10; - controls.target.set(0, -0.1, 0); - controls.enableDamping = true; - controls.dampingFactor = 0.05; - controls.update(); - - dirLight = new THREE.DirectionalLight(0xffffff, 6); - dirLight.position.set(0.2, 0.6, 0.4); - dirLight.castShadow = true; - scene.add(dirLight); - const shadow = dirLight.shadow; - shadow.mapSize.width = shadow.mapSize.height = 2048; - shadow.radius = 8; - shadow.bias = -0.0005; - const shadowCam = shadow.camera, - s = 0.5; - shadowCam.near = 0.1; - shadowCam.far = 2; - shadowCam.right = shadowCam.top = s; - shadowCam.left = shadowCam.bottom = -s; - // debug shadow - //scene.add( new THREE.CameraHelper(shadowCam) ); - - pointLight = new THREE.PointLight(0x7b8cad, 1, 0, 2); - pointLight.position.set(-0.3, -0.2, -0.2); - scene.add(pointLight); - - window.addEventListener('resize', onWindowResize); - - moveCamera(); -} - -function moveCamera() { - controls.enabled = false; - controls.enableDamping = false; - - const sph = new THREE.Spherical(); - const target = controls.target; - const tmp = { - distance: controls.getDistance(), - phi: controls.getPolarAngle(), - theta: controls.getAzimuthalAngle(), - }; - - new TWEEN.Tween(tmp) - .to({ distance: 1, theta: -Math.PI * 0.2 }, 6000) - .easing(TWEEN.Easing.Quadratic.Out) - .onUpdate(function (n) { - sph.set(n.distance, n.phi, n.theta); - camera.position.setFromSpherical(sph).add(target); - camera.lookAt(target); - }) - .onComplete(function () { - controls.enabled = true; - controls.enableDamping = true; - }) - .start(); -} - -function postProcess(b) { - if (b) { - renderer.setEffects([taaPass, bloomPass]); - } else { - renderer.setEffects(null); - } -} - -function createGUI() { - gui = new GUI(); - gui.add(setting, 'roughness', 0, 1, 0.01).onChange(upMaterial); - gui.add(setting, 'metalness', 0, 1, 0.01).onChange(upMaterial); - gui.add(setting, 'opacity', 0, 1, 0.01).onChange(upMaterial); - - // - - gui.add(setting, 'postProcess').onChange(postProcess); - gui.add(setting, 'threshold', 0, 1, 0.01).onChange(upBloom); - gui.add(setting, 'strength', 0, 0.1, 0.001).onChange(upBloom); - gui.add(setting, 'radius', 0, 1, 0.01).onChange(upBloom); -} - -function upMaterial() { - materials.Gold.metalness = materials.Silver.metalness = setting.metalness; - materials.Gold.roughness = materials.Silver.roughness = setting.roughness; - meshes.glass.material.opacity = setting.opacity; -} - -function upBloom() { - if (!bloomPass) return; - bloomPass.threshold = setting.threshold; - bloomPass.strength = setting.strength; - bloomPass.radius = setting.radius; -} - -function getTime() { - const currentDate = new Date(); - let hour = currentDate.getHours(); - const minute = currentDate.getMinutes(); - const second = currentDate.getSeconds(); - let day = currentDate.getDay(); - const month = currentDate.getMonth(); - const milli = currentDate.getMilliseconds(); - if (hour >= 12) hour -= 12; - if (day > 30) day = 30; - - meshes.hour.rotation.y = -hour * 30 * torad; - meshes.minute.rotation.y = -minute * 6 * torad; - meshes.second.rotation.y = -second * 6 * torad; - meshes.mini_03.rotation.y = -day * 12 * torad; - meshes.mini_02.rotation.y = -month * 30 * torad; - meshes.mini_01.rotation.y = -milli * 0.36 * torad; -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - renderer.setSize(width, height); -} - -// - -function animate() { - controls.update(); - - TWEEN.update(); - - renderer.render(scene, camera); - - if (ready) getTime(); -} diff --git a/examples-testing/examples/webgpu_animation_retargeting.ts b/examples-testing/examples/webgpu_animation_retargeting.ts deleted file mode 100644 index 23ebb2af4..000000000 --- a/examples-testing/examples/webgpu_animation_retargeting.ts +++ /dev/null @@ -1,295 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - color, - screenUV, - hue, - reflector, - time, - Fn, - vec2, - length, - atan, - float, - sin, - cos, - vec3, - sub, - mul, - pow, - blendDodge, - normalWorldGeometry, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; - -const [sourceModel, targetModel] = await Promise.all([ - new Promise((resolve, reject) => { - new GLTFLoader().load('./models/gltf/Michelle.glb', resolve, undefined, reject); - }), - - new Promise((resolve, reject) => { - new GLTFLoader().load('./models/gltf/Soldier.glb', resolve, undefined, reject); - }), -]); - -// - -const timer = new THREE.Timer(); -timer.connect(document); - -export const lightSpeed = /*#__PURE__*/ Fn(([suv_immutable]) => { - // forked from https://www.shadertoy.com/view/7ly3D1 - - const suv = vec2(suv_immutable); - const uv = vec2(length(suv), atan(suv.y, suv.x)); - const offset = float( - float(0.1) - .mul(sin(uv.y.mul(10).sub(time.mul(0.6)))) - .mul(cos(uv.y.mul(48).add(time.mul(0.3)))) - .mul(cos(uv.y.mul(3.7).add(time))), - ); - const rays = vec3( - vec3(sin(uv.y.mul(150).add(time)).mul(0.5).add(0.5)) - .mul( - vec3( - sin(uv.y.mul(80).sub(time.mul(0.6))) - .mul(0.5) - .add(0.5), - ), - ) - .mul( - vec3( - sin(uv.y.mul(45).add(time.mul(0.8))) - .mul(0.5) - .add(0.5), - ), - ) - .mul(vec3(sub(1, cos(uv.y.add(mul(22, time).sub(pow(uv.x.add(offset), 0.3).mul(60))))))) - .mul(vec3(uv.x.mul(2))), - ); - - return rays; -}).setLayout({ - name: 'lightSpeed', - type: 'vec3', - inputs: [{ name: 'suv', type: 'vec2' }], -}); - -// scene - -const scene = new THREE.Scene(); - -// background - -const coloredVignette = screenUV - .distance(0.5) - .mix(hue(color(0x0175ad), time.mul(0.1)), hue(color(0x02274f), time.mul(0.5))); -const lightSpeedEffect = lightSpeed(normalWorldGeometry).clamp(); -const lightSpeedSky = normalWorldGeometry.y.remapClamp(-0.1, 1).mix(0, lightSpeedEffect); -const composedBackground = blendDodge(coloredVignette, lightSpeedSky); - -scene.backgroundNode = composedBackground; - -// - -const helpers = new THREE.Group(); -helpers.visible = false; -scene.add(helpers); - -const light = new THREE.HemisphereLight(0xe9c0a5, 0x0175ad, 5); -scene.add(light); - -const dirLight = new THREE.DirectionalLight(0xfff9ea, 4); -dirLight.position.set(2, 5, 2); -scene.add(dirLight); - -const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.25, 50); -camera.position.set(0, 1, 4); - -// add models to scene -scene.add(sourceModel.scene); -scene.add(targetModel.scene); - -// reposition models -sourceModel.scene.position.x -= 0.8; -targetModel.scene.position.x += 0.7; - -targetModel.scene.position.z -= 0.1; - -// reajust model -targetModel.scene.scale.setScalar(0.01); - -// flip model -sourceModel.scene.rotation.y = Math.PI / 2; -targetModel.scene.rotation.y = -Math.PI / 2; - -// retarget -const source = getSource(sourceModel); -const mixer = retargetModel(source, targetModel); - -// floor -const reflection = reflector(); -reflection.target.rotateX(-Math.PI / 2); -scene.add(reflection.target); - -const floorMaterial = new THREE.NodeMaterial(); -floorMaterial.colorNode = reflection; -floorMaterial.opacity = 0.2; -floorMaterial.transparent = true; - -const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); -floor.receiveShadow = true; - -floor.position.set(0, 0, 0); -scene.add(floor); - -// renderer -const renderer = new THREE.WebGPURenderer({ antialias: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setAnimationLoop(animate); -renderer.toneMapping = THREE.NeutralToneMapping; -renderer.inspector = new Inspector(); -document.body.appendChild(renderer.domElement); - -const controls = new OrbitControls(camera, renderer.domElement); -controls.minDistance = 3; -controls.maxDistance = 12; -controls.target.set(0, 1, 0); -controls.maxPolarAngle = Math.PI / 2; - -const gui = renderer.inspector.createParameters('Scene settings'); -gui.add(helpers, 'visible').name('show helpers'); - -// - -function getSource(sourceModel) { - const clip = sourceModel.animations[0]; - - const helper = new THREE.SkeletonHelper(sourceModel.scene); - helpers.add(helper); - - const skeleton = new THREE.Skeleton(helper.bones); - - const mixer = new THREE.AnimationMixer(sourceModel.scene); - mixer.clipAction(sourceModel.animations[0]).play(); - - return { clip, skeleton, mixer }; -} - -function retargetModel(sourceModel, targetModel) { - const targetSkin = targetModel.scene.children[0].children[0]; - - const targetSkelHelper = new THREE.SkeletonHelper(targetModel.scene); - helpers.add(targetSkelHelper); - - const rotateCW45 = new THREE.Matrix4().makeRotationY(THREE.MathUtils.degToRad(45)); - const rotateCCW180 = new THREE.Matrix4().makeRotationY(THREE.MathUtils.degToRad(-180)); - const rotateCW180 = new THREE.Matrix4().makeRotationY(THREE.MathUtils.degToRad(180)); - const rotateFoot = new THREE.Matrix4().makeRotationFromEuler( - new THREE.Euler(THREE.MathUtils.degToRad(45), THREE.MathUtils.degToRad(180), THREE.MathUtils.degToRad(0)), - ); - - const retargetOptions = { - // specify the name of the source's hip bone. - hip: 'mixamorigHips', - - // specify the influence of the source's hip bone. - // use ( 0, 1, 0 ) to ignore xz hip movement. - //hipInfluence: new THREE.Vector3( 0, 1, 0 ), - - // specify an animation range in seconds. - //trim: [ 3.0, 4.0 ], - - // preserve the scale of the target model - scale: 1 / targetModel.scene.scale.y, - - // offset target bones -> { targetBoneName: offsetMatrix } - localOffsets: { - mixamorigLeftShoulder: rotateCW45, - mixamorigRightShoulder: rotateCCW180, - mixamorigLeftArm: rotateCW45, - mixamorigRightArm: rotateCCW180, - mixamorigLeftForeArm: rotateCW45, - mixamorigRightForeArm: rotateCCW180, - mixamorigLeftHand: rotateCW45, - mixamorigRightHand: rotateCCW180, - - mixamorigLeftUpLeg: rotateCW180, - mixamorigRightUpLeg: rotateCW180, - mixamorigLeftLeg: rotateCW180, - mixamorigRightLeg: rotateCW180, - mixamorigLeftFoot: rotateFoot, - mixamorigRightFoot: rotateFoot, - mixamorigLeftToeBase: rotateCW180, - mixamorigRightToeBase: rotateCW180, - }, - - // Map of target's bone names to source's bone names -> { targetBoneName: sourceBoneName } - names: { - mixamorigHips: 'mixamorigHips', - - mixamorigSpine: 'mixamorigSpine', - mixamorigSpine2: 'mixamorigSpine2', - mixamorigHead: 'mixamorigHead', - - mixamorigLeftShoulder: 'mixamorigLeftShoulder', - mixamorigRightShoulder: 'mixamorigRightShoulder', - mixamorigLeftArm: 'mixamorigLeftArm', - mixamorigRightArm: 'mixamorigRightArm', - mixamorigLeftForeArm: 'mixamorigLeftForeArm', - mixamorigRightForeArm: 'mixamorigRightForeArm', - mixamorigLeftHand: 'mixamorigLeftHand', - mixamorigRightHand: 'mixamorigRightHand', - - mixamorigLeftUpLeg: 'mixamorigLeftUpLeg', - mixamorigRightUpLeg: 'mixamorigRightUpLeg', - mixamorigLeftLeg: 'mixamorigLeftLeg', - mixamorigRightLeg: 'mixamorigRightLeg', - mixamorigLeftFoot: 'mixamorigLeftFoot', - mixamorigRightFoot: 'mixamorigRightFoot', - mixamorigLeftToeBase: 'mixamorigLeftToeBase', - mixamorigRightToeBase: 'mixamorigRightToeBase', - }, - }; - - const retargetedClip = SkeletonUtils.retargetClip( - targetSkin, - sourceModel.skeleton, - sourceModel.clip, - retargetOptions, - ); - - // Apply the mixer directly to the SkinnedMesh, not any - // ancestor node, because that's what - // SkeletonUtils.retargetClip outputs the clip to be - // compatible with. - const mixer = new THREE.AnimationMixer(targetSkin); - mixer.clipAction(retargetedClip).play(); - - return mixer; -} - -window.onresize = function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -}; - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - source.mixer.update(delta); - mixer.update(delta); - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts b/examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts deleted file mode 100644 index de90d890f..000000000 --- a/examples-testing/examples/webgpu_animation_retargeting_readyplayer.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { screenUV, color, vec2, vec4, reflector, positionWorld } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; - -const [sourceModel, targetModel] = await Promise.all([ - new Promise((resolve, reject) => { - new FBXLoader().load('./models/fbx/mixamo.fbx', resolve, undefined, reject); - }), - - new Promise((resolve, reject) => { - new GLTFLoader().load('./models/gltf/readyplayer.me.glb', resolve, undefined, reject); - }), -]); - -// - -const timer = new THREE.Timer(); -timer.connect(document); - -// scene - -const scene = new THREE.Scene(); - -// background - -const horizontalEffect = screenUV.x.mix(color(0x13172b), color(0x311649)); -const lightEffect = screenUV.distance(vec2(0.5, 1.0)).oneMinus().mul(color(0x0c5d68)); - -scene.backgroundNode = horizontalEffect.add(lightEffect); - -// - -const light = new THREE.HemisphereLight(0x311649, 0x0c5d68, 10); -scene.add(light); - -const backLight = new THREE.DirectionalLight(0xffffff, 10); -backLight.position.set(0, 5, -5); -scene.add(backLight); - -const keyLight = new THREE.DirectionalLight(0xfff9ea, 4); -keyLight.position.set(3, 5, 3); -scene.add(keyLight); - -const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.25, 50); -camera.position.set(0, 3, 5); - -// add models to scene -scene.add(sourceModel); -scene.add(targetModel.scene); - -// reposition models -sourceModel.position.x -= 0.9; -targetModel.scene.position.x += 0.9; - -// reajust model - mixamo use centimeters, readyplayer.me use meters (three.js scale is meters) -sourceModel.scale.setScalar(0.01); - -// retarget -const source = getSource(sourceModel); -const mixer = retargetModel(source, targetModel); - -// renderer -const renderer = new THREE.WebGPURenderer({ antialias: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setAnimationLoop(animate); -renderer.inspector = new Inspector(); -renderer.toneMapping = THREE.NeutralToneMapping; -document.body.appendChild(renderer.domElement); - -const controls = new OrbitControls(camera, renderer.domElement); -controls.minDistance = 3; -controls.maxDistance = 12; -controls.target.set(0, 1, 0); -controls.maxPolarAngle = Math.PI / 2; - -// floor -const reflection = reflector(); -reflection.target.rotateX(-Math.PI / 2); -scene.add(reflection.target); - -const reflectionMask = positionWorld.xz.distance(0).mul(0.1).clamp().oneMinus(); - -const floorMaterial = new THREE.NodeMaterial(); -floorMaterial.colorNode = vec4(reflection.rgb, reflectionMask); -floorMaterial.opacity = 0.2; -floorMaterial.transparent = true; - -const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); -floor.receiveShadow = true; - -floor.position.set(0, 0, 0); -scene.add(floor); - -// - -function getSource(sourceModel) { - const clip = sourceModel.animations[0]; - - const helper = new THREE.SkeletonHelper(sourceModel); - const skeleton = new THREE.Skeleton(helper.bones); - - const mixer = new THREE.AnimationMixer(sourceModel); - mixer.clipAction(sourceModel.animations[0]).play(); - - return { clip, skeleton, mixer }; -} - -function retargetModel(sourceModel, targetModel) { - const targetSkin = targetModel.scene.children[0].children[1]; - - const retargetOptions = { - // specify the name of the source's hip bone. - hip: 'mixamorigHips', - - // preserve the scale of the target model - scale: 0.01, - - // use ( 0, 1, 0 ) to ignore xz hip movement. - //hipInfluence: new THREE.Vector3( 0, 1, 0 ), - - // Map of target's bone names to source's bone names -> { targetBoneName: sourceBoneName } - getBoneName: function (bone) { - return 'mixamorig' + bone.name; - }, - }; - - const retargetedClip = SkeletonUtils.retargetClip( - targetSkin, - sourceModel.skeleton, - sourceModel.clip, - retargetOptions, - ); - - const mixer = new THREE.AnimationMixer(targetSkin); - mixer.clipAction(retargetedClip).play(); - - return mixer; -} - -window.onresize = function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -}; - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - source.mixer.update(delta); - mixer.update(delta); - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_backdrop.ts b/examples-testing/examples/webgpu_backdrop.ts deleted file mode 100644 index af6dcc399..000000000 --- a/examples-testing/examples/webgpu_backdrop.ts +++ /dev/null @@ -1,134 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - float, - vec3, - color, - viewportSharedTexture, - hue, - blendOverlay, - posterize, - grayscale, - saturation, - viewportSafeUV, - screenUV, - checker, - uv, - time, - oscSine, - output, -} from 'three/tsl'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; -let portals, - rotate = true; -let mixer, timer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.set(1, 2, 3); - - scene = new THREE.Scene(); - scene.backgroundNode = screenUV.y.mix(color(0x66bbff), color(0x4466ff)); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - // lights - - const light = new THREE.SpotLight(0xffffff, 1); - light.power = 2000; - camera.add(light); - scene.add(camera); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Michelle.glb', function (gltf) { - const object = gltf.scene; - mixer = new THREE.AnimationMixer(object); - - const material = object.children[0].children[0].material; - material.outputNode = oscSine(time.mul(0.1)).mix(output, posterize(output.add(0.1), 4).mul(2)); - - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - scene.add(object); - }); - - // portals - - const geometry = new THREE.SphereGeometry(0.3, 32, 16); - - portals = new THREE.Group(); - scene.add(portals); - - function addBackdropSphere(backdropNode, backdropAlphaNode = null) { - const distance = 1; - const id = portals.children.length; - const rotation = THREE.MathUtils.degToRad(id * 45); - - const material = new THREE.MeshStandardNodeMaterial({ color: 0x0066ff }); - material.roughnessNode = float(0.2); - material.metalnessNode = float(0); - material.backdropNode = backdropNode; - material.backdropAlphaNode = backdropAlphaNode; - material.transparent = true; - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(Math.cos(rotation) * distance, 1, Math.sin(rotation) * distance); - - portals.add(mesh); - } - - addBackdropSphere(hue(viewportSharedTexture().bgr, oscSine().mul(Math.PI))); - addBackdropSphere(viewportSharedTexture().rgb.oneMinus()); - addBackdropSphere(grayscale(viewportSharedTexture().rgb)); - addBackdropSphere(saturation(viewportSharedTexture().rgb, 10), oscSine()); - addBackdropSphere(blendOverlay(viewportSharedTexture().rgb, checker(uv().mul(10)))); - addBackdropSphere(viewportSharedTexture(viewportSafeUV(screenUV.mul(40).floor().div(40)))); - addBackdropSphere(viewportSharedTexture(viewportSafeUV(screenUV.mul(80).floor().div(80))).add(color(0x0033ff))); - addBackdropSphere(vec3(0, 0, viewportSharedTexture().b)); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: false }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 0.3; - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1, 0); - controls.addEventListener('start', () => (rotate = false)); - controls.addEventListener('end', () => (rotate = true)); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - if (rotate) portals.rotation.y += delta * 0.5; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_backdrop_area.ts b/examples-testing/examples/webgpu_backdrop_area.ts deleted file mode 100644 index 6aa3e9275..000000000 --- a/examples-testing/examples/webgpu_backdrop_area.ts +++ /dev/null @@ -1,157 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - color, - positionWorld, - linearDepth, - viewportLinearDepth, - viewportSharedTexture, - screenUV, - hue, - time, - checker, - uv, - modelScale, -} from 'three/tsl'; -import { hashBlur } from 'three/addons/tsl/display/hashBlur.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; -let mixer, timer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 25); - camera.position.set(3, 2, 3); - - scene = new THREE.Scene(); - scene.backgroundNode = hue(screenUV.y.mix(color(0x66bbff), color(0x4466ff)), time.mul(0.1)); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - const ambient = new THREE.AmbientLight(0xffffff, 2.5); - scene.add(ambient); - - // model - - const loader = new GLTFLoader(); - loader.load('models/gltf/Michelle.glb', function (gltf) { - const object = gltf.scene; - mixer = new THREE.AnimationMixer(object); - - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - scene.add(object); - }); - - // volume - - // compare depth from viewportLinearDepth with linearDepth() to create a distance field - // viewportLinearDepth return the linear depth of the scene - // linearDepth() returns the linear depth of the mesh - const depthDistance = viewportLinearDepth.distance(linearDepth()); - - const depthAlphaNode = depthDistance.oneMinus().smoothstep(0.9, 2).mul(10).saturate(); - const depthBlurred = hashBlur(viewportSharedTexture(), depthDistance.smoothstep(0, 0.6).mul(40).clamp().mul(0.1)); - - const blurredBlur = new THREE.MeshBasicNodeMaterial(); - blurredBlur.backdropNode = depthBlurred.add(depthAlphaNode.mix(color(0x003399).mul(0.3), 0)); - blurredBlur.transparent = true; - blurredBlur.side = THREE.DoubleSide; - - const depthMaterial = new THREE.MeshBasicNodeMaterial(); - depthMaterial.backdropNode = depthAlphaNode; - depthMaterial.transparent = true; - depthMaterial.side = THREE.DoubleSide; - - const checkerMaterial = new THREE.MeshBasicNodeMaterial(); - checkerMaterial.backdropNode = hashBlur(viewportSharedTexture(), 0.05); - checkerMaterial.backdropAlphaNode = checker(uv().mul(3).mul(modelScale.xy)); - checkerMaterial.opacityNode = checkerMaterial.backdropAlphaNode; - checkerMaterial.transparent = true; - checkerMaterial.side = THREE.DoubleSide; - - const pixelMaterial = new THREE.MeshBasicNodeMaterial(); - pixelMaterial.backdropNode = viewportSharedTexture(screenUV.mul(100).floor().div(100)); - pixelMaterial.transparent = true; - - // box / floor - - const box = new THREE.Mesh(new THREE.BoxGeometry(2, 2, 2), blurredBlur); - box.position.set(0, 1, 0); - box.renderOrder = 1; - scene.add(box); - - const floor = new THREE.Mesh( - new THREE.BoxGeometry(5, 0.01, 5), - new THREE.MeshBasicNodeMaterial({ - color: 0xff6600, - opacityNode: positionWorld.xz.distance(0).oneMinus().clamp(), - transparent: true, - depthWrite: false, - }), - ); - floor.position.set(0, 0, 0); - scene.add(floor); - - // renderer - - renderer = new THREE.WebGPURenderer(/*{ antialias: true }*/); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 0.9; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); - - // gui - - const materials = { - blurred: blurredBlur, - checker: checkerMaterial, - depth: depthMaterial, - pixel: pixelMaterial, - }; - - const options = { material: 'checker' }; - box.material = materials[options.material]; - - const gui = renderer.inspector.createParameters('Scene settings'); - gui.add(box.scale, 'x', 0.1, 2, 0.01).name('box scale x'); - gui.add(box.scale, 'y', 0.1, 2, 0.01).name('box scale y'); - gui.add(options, 'material', Object.keys(materials)).onChange(name => { - box.material = materials[name]; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_backdrop_water.ts b/examples-testing/examples/webgpu_backdrop_water.ts deleted file mode 100644 index e9f17b575..000000000 --- a/examples-testing/examples/webgpu_backdrop_water.ts +++ /dev/null @@ -1,261 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - color, - vec2, - pass, - linearDepth, - normalWorld, - triplanarTexture, - texture, - objectPosition, - screenUV, - viewportLinearDepth, - viewportDepthTexture, - viewportSharedTexture, - positionWorld, - time, -} from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; -import { voronoi2d, voronoi3d } from 'three/addons/tsl/math/voronoiNoise.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; -let mixer, objects, timer; -let model, floor, floorPosition; -let renderPipeline; -let controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); - camera.position.set(3, 2, 4); - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x0487e2, 7, 25); - scene.backgroundNode = normalWorld.y.mix(color(0x0487e2), color(0x0066ff)); - camera.lookAt(0, 1, 0); - - const sunLight = new THREE.DirectionalLight(0xffe499, 5); - sunLight.position.set(0.5, 3, 0.5); - sunLight.castShadow = true; - sunLight.shadow.mapSize.width = 512; - sunLight.shadow.mapSize.height = 512; - sunLight.shadow.camera.near = 0.5; - sunLight.shadow.camera.far = 15; - sunLight.shadow.camera.left = -1.5; - sunLight.shadow.camera.right = 1.5; - sunLight.shadow.camera.top = 1.5; - sunLight.shadow.camera.bottom = -1.5; - sunLight.shadow.bias = -0.001; - - const waterAmbientLight = new THREE.HemisphereLight(0x333366, 0x74ccf4, 5); - const skyAmbientLight = new THREE.HemisphereLight(0x74ccf4, 0, 1); - - scene.add(sunLight); - scene.add(skyAmbientLight); - scene.add(waterAmbientLight); - - timer = new THREE.Timer(); - timer.connect(document); - - // animated model - - const loader = new GLTFLoader(); - loader.load('models/gltf/Michelle.glb', function (gltf) { - model = gltf.scene; - model.traverse(child => { - if (child.isMesh) { - child.castShadow = true; - child.receiveShadow = true; - } - }); - - mixer = new THREE.AnimationMixer(model); - - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - scene.add(model); - }); - - // objects - - const textureLoader = new THREE.TextureLoader(); - const iceDiffuse = textureLoader.load('./textures/water.jpg'); - iceDiffuse.wrapS = THREE.RepeatWrapping; - iceDiffuse.wrapT = THREE.RepeatWrapping; - iceDiffuse.colorSpace = THREE.NoColorSpace; - - const iceColorNode = triplanarTexture(texture(iceDiffuse)).add(color(0x0066ff)).mul(0.8); - - const geometry = new THREE.IcosahedronGeometry(1, 3); - const material = new THREE.MeshStandardNodeMaterial({ colorNode: iceColorNode }); - - const count = 100; - const scale = 3.5; - const column = 10; - - objects = new THREE.Group(); - - for (let i = 0; i < count; i++) { - const x = i % column; - const y = i / column; - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(x * scale, 0, y * scale); - mesh.rotation.set(Math.random(), Math.random(), Math.random()); - objects.add(mesh); - } - - objects.position.set((column - 1) * scale * -0.5, -1, (count / column) * scale * -0.5); - - scene.add(objects); - - // water - - const t = time.mul(0.8); - const floorUV = positionWorld.xz; - - const waterLayer0 = voronoi2d(floorUV.mul(6), t); - const waterLayer1 = voronoi2d(floorUV.mul(3), t); - - const waterIntensity = waterLayer0.mul(waterLayer1); - const waterColor = waterIntensity.mul(1.4).mix(color(0x0487e2), color(0x74ccf4)); - - // linearDepth() returns the linear depth of the mesh - const depth = linearDepth(); - const depthWater = viewportLinearDepth.sub(depth).toInspector('Water / Depth', node => node.oneMinus()); - const depthEffect = depthWater.remapClamp(-0.002, 0.04); - - const refractionUV = screenUV.add(vec2(0, waterIntensity.mul(0.1))).toInspector('Water / Refraction UV'); - - // linearDepth( viewportDepthTexture( uv ) ) return the linear depth of the scene - const depthTestForRefraction = linearDepth(viewportDepthTexture(refractionUV)).sub(depth); - - const depthRefraction = depthTestForRefraction.remapClamp(0, 0.1); - - const finalUV = depthTestForRefraction.lessThan(0).select(screenUV, refractionUV); - - const viewportTexture = viewportSharedTexture(finalUV).toInspector('Water / Viewport Texture + Refraction UV'); - - const waterMaterial = new THREE.MeshBasicNodeMaterial(); - waterMaterial.colorNode = waterColor.toInspector('Water / Color'); - waterMaterial.backdropNode = depthEffect - .mix(viewportSharedTexture(), viewportTexture.mul(depthRefraction.mix(1, waterColor))) - .mul(color(0xd3ebf8)); - waterMaterial.backdropAlphaNode = depthRefraction.oneMinus(); - waterMaterial.transparent = true; - - const water = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), waterMaterial); - water.position.set(0, 0, 0); - scene.add(water); - - // floor - - floor = new THREE.Mesh( - new THREE.CylinderGeometry(1.1, 1.1, 10), - new THREE.MeshStandardNodeMaterial({ colorNode: iceColorNode }), - ); - floor.position.set(0, -5, 0); - floor.receiveShadow = true; - scene.add(floor); - - // caustics - - const causticFade = normalWorld.y.mix(positionWorld.y.distance(0).oneMinus().saturate(), 0); - - const causticNoise = voronoi3d(positionWorld.mul(6), t); - - //material.colorNode = colorNode; - floor.material.colorNode = causticFade.mix(material.colorNode, material.colorNode.add(causticNoise)); - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 10; - controls.maxPolarAngle = Math.PI * 0.9; - controls.autoRotate = true; - controls.autoRotateSpeed = 1; - controls.target.set(0, 0.2, 0); - controls.update(); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - - floorPosition = new THREE.Vector3(0, 0.2, 0); - - gui.add(floorPosition, 'y', -1, 1, 0.001).name('floor position'); - - // post processing - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode(); - const scenePassDepth = scenePass.getLinearDepthNode().remapClamp(0.3, 0.5); - - const waterMask = objectPosition(camera) - .y.greaterThan(screenUV.y.sub(0.5).mul(camera.near)) - .toInspector('Post-Processing / Water Mask'); - - const scenePassColorBlurred = gaussianBlur(scenePassColor); - scenePassColorBlurred.directionNode = waterMask - .select(scenePassDepth, scenePass.getLinearDepthNode().mul(5)) - .toInspector('Post-Processing / Blur Strength [ Depth ]', node => node.toFloat()); - - const vignette = screenUV.distance(0.5).mul(1.35).clamp().oneMinus().toInspector('Post-Processing / Vignette'); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = waterMask.select( - scenePassColorBlurred, - scenePassColorBlurred.mul(color(0x74ccf4)).mul(vignette), - ); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - controls.update(); - - const delta = timer.getDelta(); - - floor.position.y = floorPosition.y - 5; - - if (model) { - mixer.update(delta); - - model.position.y = floorPosition.y; - } - - for (const object of objects.children) { - object.position.y = Math.sin(timer.getElapsed() + object.id) * 0.3; - object.rotation.y += delta * 0.3; - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_camera.ts b/examples-testing/examples/webgpu_camera.ts deleted file mode 100644 index bf4724ac8..000000000 --- a/examples-testing/examples/webgpu_camera.ts +++ /dev/null @@ -1,211 +0,0 @@ -import * as THREE from 'three/webgpu'; - -let SCREEN_WIDTH = window.innerWidth; -let SCREEN_HEIGHT = window.innerHeight; -let aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - -let container; -let camera, scene, renderer, mesh; -let cameraRig, activeCamera, activeHelper; -let cameraPerspective, cameraOrtho; -let cameraPerspectiveHelper, cameraOrthoHelper; -const frustumSize = 600; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - - // - - camera = new THREE.PerspectiveCamera(50, 0.5 * aspect, 1, 10000); - camera.position.z = 2500; - - cameraPerspective = new THREE.PerspectiveCamera(50, 0.5 * aspect, 150, 1000); - - cameraPerspectiveHelper = new THREE.CameraHelper(cameraPerspective); - scene.add(cameraPerspectiveHelper); - - // - cameraOrtho = new THREE.OrthographicCamera( - (0.5 * frustumSize * aspect) / -2, - (0.5 * frustumSize * aspect) / 2, - frustumSize / 2, - frustumSize / -2, - 150, - 1000, - ); - - cameraOrthoHelper = new THREE.CameraHelper(cameraOrtho); - scene.add(cameraOrthoHelper); - - // - - activeCamera = cameraPerspective; - activeHelper = cameraPerspectiveHelper; - - // counteract different front orientation of cameras vs rig - - cameraOrtho.rotation.y = Math.PI; - cameraPerspective.rotation.y = Math.PI; - - cameraRig = new THREE.Group(); - - cameraRig.add(cameraPerspective); - cameraRig.add(cameraOrtho); - - scene.add(cameraRig); - - // - - mesh = new THREE.Mesh( - new THREE.SphereGeometry(100, 16, 8), - new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }), - ); - scene.add(mesh); - - const mesh2 = new THREE.Mesh( - new THREE.SphereGeometry(50, 16, 8), - new THREE.MeshBasicMaterial({ color: 0x00ff00, wireframe: true }), - ); - mesh2.position.y = 150; - mesh.add(mesh2); - - const mesh3 = new THREE.Mesh( - new THREE.SphereGeometry(5, 16, 8), - new THREE.MeshBasicMaterial({ color: 0x0000ff, wireframe: true }), - ); - mesh3.position.z = 150; - cameraRig.add(mesh3); - - // - - const geometry = new THREE.BufferGeometry(); - const vertices = []; - - for (let i = 0; i < 10000; i++) { - vertices.push(THREE.MathUtils.randFloatSpread(2000)); // x - vertices.push(THREE.MathUtils.randFloatSpread(2000)); // y - vertices.push(THREE.MathUtils.randFloatSpread(2000)); // z - } - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - - const particles = new THREE.Points(geometry, new THREE.PointsMaterial({ color: 0xffffff })); - scene.add(particles); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - renderer.setScissorTest(true); - renderer.setClearColor(0x000000, 1); - - // - - window.addEventListener('resize', onWindowResize); - document.addEventListener('keydown', onKeyDown); -} - -// - -function onKeyDown(event) { - switch (event.keyCode) { - case 79 /*O*/: - activeCamera = cameraOrtho; - activeHelper = cameraOrthoHelper; - - break; - - case 80 /*P*/: - activeCamera = cameraPerspective; - activeHelper = cameraPerspectiveHelper; - - break; - } -} - -// - -function onWindowResize() { - SCREEN_WIDTH = window.innerWidth; - SCREEN_HEIGHT = window.innerHeight; - aspect = SCREEN_WIDTH / SCREEN_HEIGHT; - - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - - camera.aspect = 0.5 * aspect; - camera.updateProjectionMatrix(); - - cameraPerspective.aspect = 0.5 * aspect; - cameraPerspective.updateProjectionMatrix(); - - cameraOrtho.left = (-0.5 * frustumSize * aspect) / 2; - cameraOrtho.right = (0.5 * frustumSize * aspect) / 2; - cameraOrtho.top = frustumSize / 2; - cameraOrtho.bottom = -frustumSize / 2; - cameraOrtho.updateProjectionMatrix(); -} - -// - -function animate() { - render(); -} - -function render() { - const r = Date.now() * 0.0005; - - mesh.position.x = 700 * Math.cos(r); - mesh.position.z = 700 * Math.sin(r); - mesh.position.y = 700 * Math.sin(r); - - mesh.children[0].position.x = 70 * Math.cos(2 * r); - mesh.children[0].position.z = 70 * Math.sin(r); - - if (activeCamera === cameraPerspective) { - cameraPerspective.fov = 35 + 30 * Math.sin(0.5 * r); - cameraPerspective.far = mesh.position.length(); - cameraPerspective.updateProjectionMatrix(); - - cameraPerspectiveHelper.update(); - cameraPerspectiveHelper.visible = true; - - cameraOrthoHelper.visible = false; - } else { - cameraOrtho.far = mesh.position.length(); - cameraOrtho.updateProjectionMatrix(); - - cameraOrthoHelper.update(); - cameraOrthoHelper.visible = true; - - cameraPerspectiveHelper.visible = false; - } - - cameraRig.lookAt(mesh.position); - - // - - activeHelper.visible = false; - - renderer.setClearColor(0x000000, 1); - renderer.setScissor(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.setViewport(0, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.render(scene, activeCamera); - - // - - activeHelper.visible = true; - - renderer.setClearColor(0x111111, 1); - renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.setViewport(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_camera_array.ts b/examples-testing/examples/webgpu_camera_array.ts deleted file mode 100644 index a4d82a709..000000000 --- a/examples-testing/examples/webgpu_camera_array.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as THREE from 'three/webgpu'; - -let camera, scene, renderer; -let mesh; - -const AMOUNT = 6; - -init(); - -function init() { - const subCameras = []; - - for (let i = 0; i < AMOUNT * AMOUNT; i++) { - const subCamera = new THREE.PerspectiveCamera(40, 1, 0.1, 10); - subCamera.viewport = new THREE.Vector4(); - - subCameras.push(subCamera); - } - - camera = new THREE.ArrayCamera(subCameras); - camera.position.z = 3; - - updateCameras(); - - scene = new THREE.Scene(); - - scene.add(new THREE.AmbientLight(0x999999)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0.5, 0.5, 1); - light.castShadow = true; - light.shadow.camera.zoom = 4; // tighter shadow map - scene.add(light); - - const geometryBackground = new THREE.PlaneGeometry(100, 100); - const materialBackground = new THREE.MeshPhongMaterial({ color: 0x000066 }); - - const background = new THREE.Mesh(geometryBackground, materialBackground); - background.receiveShadow = true; - background.position.set(0, 0, -1); - scene.add(background); - - const geometryCylinder = new THREE.CylinderGeometry(0.5, 0.5, 1, 32); - const materialCylinder = new THREE.MeshPhongMaterial({ color: 0xff0000 }); - - mesh = new THREE.Mesh(geometryCylinder, materialCylinder); - mesh.castShadow = true; - mesh.receiveShadow = true; - scene.add(mesh); - - renderer = new THREE.WebGPURenderer(/*{ forceWebGL: true }*/); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function updateCameras() { - const ASPECT_RATIO = window.innerWidth / window.innerHeight; - const WIDTH = window.innerWidth / AMOUNT; - const HEIGHT = window.innerHeight / AMOUNT; - - camera.aspect = ASPECT_RATIO; - camera.updateProjectionMatrix(); - - for (let y = 0; y < AMOUNT; y++) { - for (let x = 0; x < AMOUNT; x++) { - const subcamera = camera.cameras[AMOUNT * y + x]; - subcamera.copy(camera); // copy fov, aspect ratio, near, far from the root camera - - subcamera.viewport.set(Math.floor(x * WIDTH), Math.floor(y * HEIGHT), Math.ceil(WIDTH), Math.ceil(HEIGHT)); - subcamera.updateProjectionMatrix(); - - subcamera.position.x = x / AMOUNT - 0.5; - subcamera.position.y = 0.5 - y / AMOUNT; - subcamera.position.z = 1.5 + (x + y) * 0.5; - subcamera.position.multiplyScalar(2); - - subcamera.lookAt(0, 0, 0); - subcamera.updateMatrixWorld(); - } - } -} - -function onWindowResize() { - updateCameras(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.rotation.x += 0.005; - mesh.rotation.z += 0.01; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts b/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts deleted file mode 100644 index 24eff6c1e..000000000 --- a/examples-testing/examples/webgpu_camera_logarithmicdepthbuffer.ts +++ /dev/null @@ -1,240 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -// 1 micrometer to 100 billion light years in one scene, with 1 unit = 1 meter? preposterous! and yet... -const NEAR = 1e-6, - FAR = 1e27; -let SCREEN_WIDTH = window.innerWidth; -let SCREEN_HEIGHT = window.innerHeight; -let screensplit = 0.25, - screensplit_right = 0; -const mouse = [0.5, 0.5]; -let zoompos = -100, - minzoomspeed = 0.015; -let zoomspeed = minzoomspeed; - -let border; -const objects = {}; - -// Generate a number of text labels, from 1µm in size up to 100,000,000 light years -// Try to use some descriptive real-world examples of objects at each scale - -const labeldata = [ - { size: 0.01, scale: 0.0001, label: 'microscopic (1µm)' }, // FIXME - triangulating text fails at this size, so we scale instead - { size: 0.01, scale: 0.1, label: 'minuscule (1mm)' }, - { size: 0.01, scale: 1.0, label: 'tiny (1cm)' }, - { size: 1, scale: 1.0, label: 'child-sized (1m)' }, - { size: 10, scale: 1.0, label: 'tree-sized (10m)' }, - { size: 100, scale: 1.0, label: 'building-sized (100m)' }, - { size: 1000, scale: 1.0, label: 'medium (1km)' }, - { size: 10000, scale: 1.0, label: 'city-sized (10km)' }, - { size: 3400000, scale: 1.0, label: 'moon-sized (3,400 Km)' }, - { size: 12000000, scale: 1.0, label: 'planet-sized (12,000 km)' }, - { size: 1400000000, scale: 1.0, label: 'sun-sized (1,400,000 km)' }, - { size: 7.47e12, scale: 1.0, label: 'solar system-sized (50Au)' }, - { size: 9.4605284e15, scale: 1.0, label: 'gargantuan (1 light year)' }, - { size: 3.08567758e16, scale: 1.0, label: 'ludicrous (1 parsec)' }, - { size: 1e19, scale: 1.0, label: 'mind boggling (1000 light years)' }, -]; - -init().then(animate); - -async function init() { - const loader = new FontLoader(); - const font = await loader.loadAsync('fonts/helvetiker_regular.typeface.json'); - - const scene = initScene(font); - - // Initialize two copies of the same scene, one with normal z-buffer and one with logarithmic z-buffer - objects.normal = await initView(scene, 'normal', false); - objects.logzbuf = await initView(scene, 'logzbuf', true); - - // Resize border allows the user to easily compare effects of logarithmic depth buffer over the whole scene - border = document.getElementById('renderer_border'); - border.addEventListener('pointerdown', onBorderPointerDown); - - window.addEventListener('mousemove', onMouseMove); - window.addEventListener('resize', onWindowResize); - window.addEventListener('wheel', onMouseWheel); -} - -async function initView(scene, name, logDepthBuf) { - const framecontainer = document.getElementById('container_' + name); - - const camera = new THREE.PerspectiveCamera(50, (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT, NEAR, FAR); - scene.add(camera); - - const renderer = new THREE.WebGPURenderer({ antialias: true, logarithmicDepthBuffer: logDepthBuf }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH / 2, SCREEN_HEIGHT); - renderer.domElement.style.position = 'relative'; - renderer.domElement.id = 'renderer_' + name; - renderer.inspector = new Inspector(); - framecontainer.appendChild(renderer.domElement); - - await renderer.init(); - - return { container: framecontainer, renderer: renderer, scene: scene, camera: camera }; -} - -function initScene(font) { - const scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - scene.add(new THREE.AmbientLight(0x777777)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(100, 100, 100); - scene.add(light); - - const materialargs = { - color: 0xffffff, - specular: 0x050505, - shininess: 50, - emissive: 0x000000, - }; - - const geometry = new THREE.SphereGeometry(0.5, 24, 12); - - for (let i = 0; i < labeldata.length; i++) { - const scale = labeldata[i].scale || 1; - - const labelgeo = new TextGeometry(labeldata[i].label, { - font: font, - size: labeldata[i].size, - depth: labeldata[i].size / 2, - }); - - labelgeo.computeBoundingSphere(); - - // center text - labelgeo.translate(-labelgeo.boundingSphere.radius, 0, 0); - - materialargs.color = new THREE.Color().setHSL(Math.random(), 0.5, 0.5); - - const material = new THREE.MeshPhongMaterial(materialargs); - - const group = new THREE.Group(); - group.position.z = -labeldata[i].size * scale; - scene.add(group); - - const textmesh = new THREE.Mesh(labelgeo, material); - textmesh.scale.set(scale, scale, scale); - textmesh.position.z = -labeldata[i].size * scale; - textmesh.position.y = (labeldata[i].size / 4) * scale; - group.add(textmesh); - - const dotmesh = new THREE.Mesh(geometry, material); - dotmesh.position.y = (-labeldata[i].size / 4) * scale; - dotmesh.scale.multiplyScalar(labeldata[i].size * scale); - group.add(dotmesh); - } - - return scene; -} - -function updateRendererSizes() { - // Recalculate size for both renderers when screen size or split location changes - - SCREEN_WIDTH = window.innerWidth; - SCREEN_HEIGHT = window.innerHeight; - - screensplit_right = 1 - screensplit; - - objects.normal.renderer.setSize(screensplit * SCREEN_WIDTH, SCREEN_HEIGHT); - objects.normal.camera.aspect = (screensplit * SCREEN_WIDTH) / SCREEN_HEIGHT; - objects.normal.camera.updateProjectionMatrix(); - objects.normal.camera.setViewOffset(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, SCREEN_WIDTH * screensplit, SCREEN_HEIGHT); - objects.normal.container.style.width = screensplit * 100 + '%'; - - objects.logzbuf.renderer.setSize(screensplit_right * SCREEN_WIDTH, SCREEN_HEIGHT); - objects.logzbuf.camera.aspect = (screensplit_right * SCREEN_WIDTH) / SCREEN_HEIGHT; - objects.logzbuf.camera.updateProjectionMatrix(); - objects.logzbuf.camera.setViewOffset( - SCREEN_WIDTH, - SCREEN_HEIGHT, - SCREEN_WIDTH * screensplit, - 0, - SCREEN_WIDTH * screensplit_right, - SCREEN_HEIGHT, - ); - objects.logzbuf.container.style.width = screensplit_right * 100 + '%'; - - border.style.left = screensplit * 100 + '%'; -} - -function animate() { - requestAnimationFrame(animate); - - // Put some limits on zooming - const minzoom = labeldata[0].size * labeldata[0].scale * 1; - const maxzoom = labeldata[labeldata.length - 1].size * labeldata[labeldata.length - 1].scale * 100; - let damping = Math.abs(zoomspeed) > minzoomspeed ? 0.95 : 1.0; - - // Zoom out faster the further out you go - const zoom = THREE.MathUtils.clamp(Math.pow(Math.E, zoompos), minzoom, maxzoom); - zoompos = Math.log(zoom); - - // Slow down quickly at the zoom limits - if ((zoom == minzoom && zoomspeed < 0) || (zoom == maxzoom && zoomspeed > 0)) { - damping = 0.85; - } - - zoompos += zoomspeed; - zoomspeed *= damping; - - objects.normal.camera.position.x = Math.sin(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; - objects.normal.camera.position.y = Math.sin(0.25 * Math.PI * (mouse[1] - 0.5)) * zoom; - objects.normal.camera.position.z = Math.cos(0.5 * Math.PI * (mouse[0] - 0.5)) * zoom; - objects.normal.camera.lookAt(objects.normal.scene.position); - - // Clone camera settings across both scenes - objects.logzbuf.camera.position.copy(objects.normal.camera.position); - objects.logzbuf.camera.quaternion.copy(objects.normal.camera.quaternion); - - // Update renderer sizes if the split has changed - if (screensplit_right != 1 - screensplit) { - updateRendererSizes(); - } - - objects.normal.renderer.render(objects.normal.scene, objects.normal.camera); - objects.logzbuf.renderer.render(objects.logzbuf.scene, objects.logzbuf.camera); -} - -function onWindowResize() { - updateRendererSizes(); -} - -function onBorderPointerDown() { - // activate draggable window resizing bar - window.addEventListener('pointermove', onBorderPointerMove); - window.addEventListener('pointerup', onBorderPointerUp); -} - -function onBorderPointerMove(ev) { - screensplit = Math.max(0, Math.min(1, ev.clientX / window.innerWidth)); -} - -function onBorderPointerUp() { - window.removeEventListener('pointermove', onBorderPointerMove); - window.removeEventListener('pointerup', onBorderPointerUp); -} - -function onMouseMove(ev) { - mouse[0] = ev.clientX / window.innerWidth; - mouse[1] = ev.clientY / window.innerHeight; -} - -function onMouseWheel(ev) { - const amount = ev.deltaY; - if (amount === 0) return; - const dir = amount / Math.abs(amount); - zoomspeed = dir / 10; - - // Slow down default zoom speed after user starts zooming, to give them more control - minzoomspeed = 0.001; -} diff --git a/examples-testing/examples/webgpu_caustics.ts b/examples-testing/examples/webgpu_caustics.ts deleted file mode 100644 index 48225c325..000000000 --- a/examples-testing/examples/webgpu_caustics.ts +++ /dev/null @@ -1,200 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { - uniform, - refract, - div, - positionViewDirection, - positionLocal, - normalView, - texture, - Fn, - vec2, - vec3, - vec4, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls; -let gltf; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.025, 5); - camera.position.set(-0.5, 0.35, 0.2); - - scene = new THREE.Scene(); - - // light - - const spotLight = new THREE.SpotLight(0xffffff, 1); - spotLight.position.set(0.2, 0.3, 0.2); - spotLight.castShadow = true; - spotLight.angle = Math.PI / 6; - spotLight.penumbra = 1; - spotLight.decay = 2; - spotLight.distance = 0; - spotLight.shadow.mapType = THREE.HalfFloatType; // For HDR Caustics - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - spotLight.shadow.camera.near = 0.1; - spotLight.shadow.camera.far = 1; - spotLight.shadow.intensity = 0.95; - scene.add(spotLight); - - // model / textures - - const dracoLoader = new DRACOLoader(); - - gltf = (await new GLTFLoader().setDRACOLoader(dracoLoader).loadAsync('./models/gltf/duck.glb')).scene; - gltf.scale.setScalar(0.5); - scene.add(gltf); - - const causticMap = new THREE.TextureLoader().load('./textures/opengameart/Caustic_Free.jpg'); - causticMap.wrapS = causticMap.wrapT = THREE.RepeatWrapping; - causticMap.colorSpace = THREE.SRGBColorSpace; - - // objects / material - - const duck = gltf.children[0]; - duck.material = new THREE.MeshPhysicalNodeMaterial(); - duck.material.side = THREE.DoubleSide; - duck.material.transparent = true; - duck.material.color = new THREE.Color(0xffd700); - duck.material.transmission = 1; - duck.material.thickness = 0.25; - duck.material.ior = 1.5; - duck.material.metalness = 0; - duck.material.roughness = 0.1; - duck.castShadow = true; - - // tsl shader - - const causticOcclusion = uniform(20); - - duck.material.castShadowPositionNode = Fn(() => { - // optional: add some distortion to the geometry shadow position if needed - - return positionLocal; - })(); - - duck.material.castShadowNode = Fn(() => { - const refractionVector = refract( - positionViewDirection.negate(), - normalView, - div(1.0, duck.material.ior), - ).normalize(); - const viewZ = normalView.z.pow(causticOcclusion); - - const textureUV = refractionVector.xy.mul(0.6); - - const causticColor = uniform(duck.material.color); - const chromaticAberrationOffset = normalView.z.pow(-0.9).mul(0.004); - - const causticProjection = vec3( - texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset.negate(), 0))).r, - texture(causticMap, textureUV.add(vec2(0, chromaticAberrationOffset.negate()))).g, - texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset, chromaticAberrationOffset))).b, - ); - - return causticProjection.mul(viewZ.mul(25)).add(viewZ).mul(causticColor); - })(); - - // - - const textureLoader = new THREE.TextureLoader(); - - // glass - - const colorMap = textureLoader.load('textures/colors.png'); - colorMap.wrapS = colorMap.wrapT = THREE.RepeatWrapping; - colorMap.colorSpace = THREE.SRGBColorSpace; - - const glassMaterial = new THREE.MeshPhysicalNodeMaterial(); - glassMaterial.map = colorMap; - glassMaterial.side = THREE.DoubleSide; - glassMaterial.transparent = true; - glassMaterial.color = new THREE.Color(0xffffff); - glassMaterial.transmission = 1; - glassMaterial.ior = 1.5; - glassMaterial.metalness = 0; - glassMaterial.roughness = 0.1; - glassMaterial.castShadowNode = vec4(texture(colorMap).rgb, 0.8); - - const glass = new THREE.Mesh(new THREE.PlaneGeometry(0.2, 0.2), glassMaterial); - glass.position.y = 0.1; - glass.castShadow = true; - glass.visible = false; - scene.add(glass); - - // ground - - const map = textureLoader.load('textures/hardwood2_diffuse.jpg'); - map.wrapS = map.wrapT = THREE.RepeatWrapping; - map.repeat.set(10, 10); - - const geometry = new THREE.PlaneGeometry(2, 2); - const material = new THREE.MeshStandardMaterial({ color: 0x999999, map }); - - const ground = new THREE.Mesh(geometry, material); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.shadowMap.transmitted = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(causticOcclusion, 'value', 0, 20).name('caustic occlusion'); - gui.addColor(duck.material, 'color').name('material color'); - gui.add({ model: 'duck' }, 'model', ['duck', 'glass']).onChange(model => { - duck.visible = glass.visible = false; - - if (model === 'duck') { - duck.visible = true; - } else if (model === 'glass') { - glass.visible = true; - } - }); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxDistance = 3; - controls.maxPolarAngle = Math.PI / 2; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - for (const mesh of gltf.children) { - mesh.rotation.y -= 0.01; - } - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_centroid_sampling.ts b/examples-testing/examples/webgpu_centroid_sampling.ts deleted file mode 100644 index ca159d04c..000000000 --- a/examples-testing/examples/webgpu_centroid_sampling.ts +++ /dev/null @@ -1,199 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { varying, uv, texture, Fn } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let rendererAntialiasingEnabled; -let rendererAntialiasingDisabled; -let camera; -let scene; -let gui; - -const effectController = { - sampling: 'normal', -}; - -const atlasCanvas = document.createElement('canvas'); -atlasCanvas.width = 16; -atlasCanvas.height = 16; - -const ctx = atlasCanvas.getContext('2d'); -ctx.fillStyle = 'red'; -ctx.fillRect(0, 0, 8, 8); - -const redUVs = [0, 1, 0.5, 1, 0.5, 0.5, 0, 0.5]; -ctx.fillStyle = 'green'; -ctx.fillRect(8, 0, 8, 8); - -const greenUVs = [1, 1, 0.5, 1, 0.5, 0.5, 1, 0.5]; - -ctx.fillStyle = 'blue'; -ctx.fillRect(0, 8, 8, 8); - -const blueUVs = [0, 0, 0.5, 0, 0.5, 0.5, 0, 0.5]; - -ctx.fillStyle = 'yellow'; -ctx.fillRect(8, 8, 8, 8); - -const yellowUVs = [1, 0, 0.5, 0, 0.5, 0.5, 1, 0.5]; - -const faces = [redUVs, greenUVs, blueUVs, yellowUVs]; - -const canvasTexture = new THREE.CanvasTexture(atlasCanvas); -canvasTexture.colorSpace = THREE.SRGBColorSpace; -canvasTexture.mapping = THREE.UVMapping; -canvasTexture.wrapS = THREE.RepeatWrapping; -canvasTexture.wrapT = THREE.RepeatWrapping; -canvasTexture.magFilter = THREE.NearestFilter; -canvasTexture.minFilter = THREE.NearestFilter; -canvasTexture.format = THREE.RGBAFormat; -canvasTexture.type = THREE.UnsignedByteType; - -const forceWebGL = false; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(); - camera.fov = 60; - camera.near = 1; - camera.far = 2100; - camera.position.z = 50; - - scene = new THREE.Scene(); - - const makeFaceGeometry = uvs => { - const geometry = new THREE.BufferGeometry(); - const positions = [-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]; - geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(positions), 3)); - - const indices = [0, 1, 2, 2, 3, 0]; - geometry.setIndex(indices); - - geometry.setAttribute('uv', new THREE.BufferAttribute(new Float32Array(uvs), 2)); - - return geometry; - }; - - const material = new THREE.MeshBasicNodeMaterial(); - const testUV = varying(uv(), 'testUV'); - - const createShader = (type, sampling) => { - return Fn(() => { - testUV.setInterpolation(type, sampling); - - return texture(canvasTexture, testUV).rgb; - }); - }; - - const withFlatFirstShader = createShader( - THREE.InterpolationSamplingType.FLAT, - THREE.InterpolationSamplingMode.FIRST, - ); - const withFlatEitherShader = createShader( - THREE.InterpolationSamplingType.FLAT, - THREE.InterpolationSamplingMode.EITHER, - ); - - const withSampleShader = Fn(() => { - testUV.setInterpolation(THREE.InterpolationSamplingType.PERSPECTIVE, THREE.InterpolationSamplingMode.SAMPLE); - - return texture(canvasTexture, testUV).rgb; - }); - - const withInterpolationShader = Fn(() => { - testUV.setInterpolation(THREE.InterpolationSamplingType.PERSPECTIVE, THREE.InterpolationSamplingMode.CENTROID); - - return texture(canvasTexture, testUV).rgb; - }); - - const withoutInterpolationShader = Fn(() => { - return texture(canvasTexture, uv()).rgb; - }); - - material.colorNode = withoutInterpolationShader(); - - const faceMeshes = []; - - for (let x = -5; x < 5; x++) { - for (let y = -5; y < 5; y++) { - const face = faces[Math.floor(Math.random() * faces.length)]; - const geometry = makeFaceGeometry(face); - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(x * 2, y * 2, 0); - faceMeshes.push(mesh); - scene.add(mesh); - } - } - - // Create Standard Renderer - rendererAntialiasingDisabled = new THREE.WebGPURenderer({ - antialias: false, - forceWebGL: forceWebGL, - }); - - rendererAntialiasingDisabled.setPixelRatio(window.devicePixelRatio); - rendererAntialiasingDisabled.setSize(window.innerWidth / 2, window.innerHeight); - rendererAntialiasingDisabled.setAnimationLoop(animateStandard); - - // Create antialiased renderer - rendererAntialiasingEnabled = new THREE.WebGPURenderer({ - antialias: true, - forceWebGL: forceWebGL, - }); - - document.body.querySelector('#antialiasing-enabled').appendChild(rendererAntialiasingEnabled.domElement); - rendererAntialiasingEnabled.setPixelRatio(window.devicePixelRatio); - rendererAntialiasingEnabled.setSize(window.innerWidth / 2, window.innerHeight); - rendererAntialiasingEnabled.setAnimationLoop(animateAliased); - rendererAntialiasingEnabled.inspector = new Inspector(); - - document.body.querySelector('#antialiasing-disabled').appendChild(rendererAntialiasingDisabled.domElement); - document.body.querySelector('#antialiasing-disabled').appendChild(rendererAntialiasingDisabled.domElement); - - onWindowResize(); - - window.addEventListener('resize', onWindowResize); - - gui = rendererAntialiasingEnabled.inspector.createParameters('Settings'); - gui.add(effectController, 'sampling', [ - THREE.InterpolationSamplingMode.NORMAL, - THREE.InterpolationSamplingMode.CENTROID, - THREE.InterpolationSamplingMode.SAMPLE, - 'flat first', - 'flat either', - ]).onChange(() => { - const interpolationShaderLib = { - [THREE.InterpolationSamplingMode.NORMAL]: withoutInterpolationShader, - [THREE.InterpolationSamplingMode.CENTROID]: withInterpolationShader, - [THREE.InterpolationSamplingMode.SAMPLE]: withSampleShader, - ['flat first']: withFlatFirstShader, - ['flat either']: withFlatEitherShader, - }; - - const shader = interpolationShaderLib[effectController.sampling]; - - for (let i = 0; i < faceMeshes.length; i++) { - faceMeshes[i].material.colorNode = shader(); - faceMeshes[i].material.needsUpdate = true; - } - }); -} - -function onWindowResize() { - const halfWidth = window.innerWidth / 2; - rendererAntialiasingDisabled.setSize(halfWidth, window.innerHeight); - rendererAntialiasingEnabled.setSize(halfWidth, window.innerHeight); - const aspect = halfWidth / window.innerHeight; - - camera.aspect = aspect; - camera.updateProjectionMatrix(); -} - -function animateStandard() { - rendererAntialiasingDisabled.render(scene, camera); -} - -function animateAliased() { - rendererAntialiasingEnabled.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_clearcoat.ts b/examples-testing/examples/webgpu_clearcoat.ts deleted file mode 100644 index 02fbacb9d..000000000 --- a/examples-testing/examples/webgpu_clearcoat.ts +++ /dev/null @@ -1,194 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; - -import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; - -let camera, scene, renderer; - -let particleLight; -let group; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 0.25, 50); - camera.position.z = 10; - - scene = new THREE.Scene(); - - group = new THREE.Group(); - scene.add(group); - - new HDRCubeTextureLoader() - .setPath('textures/cube/pisaHDR/') - .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (texture) { - const geometry = new THREE.SphereGeometry(0.8, 64, 32); - - const textureLoader = new THREE.TextureLoader(); - - const diffuse = textureLoader.load('textures/carbon/Carbon.png'); - diffuse.colorSpace = THREE.SRGBColorSpace; - diffuse.wrapS = THREE.RepeatWrapping; - diffuse.wrapT = THREE.RepeatWrapping; - diffuse.repeat.x = 10; - diffuse.repeat.y = 10; - - const normalMap = textureLoader.load('textures/carbon/Carbon_Normal.png'); - normalMap.wrapS = THREE.RepeatWrapping; - normalMap.wrapT = THREE.RepeatWrapping; - normalMap.repeat.x = 10; - normalMap.repeat.y = 10; - - const normalMap2 = textureLoader.load('textures/water/Water_1_M_Normal.jpg'); - - const normalMap3 = new THREE.CanvasTexture(new FlakesTexture()); - normalMap3.wrapS = THREE.RepeatWrapping; - normalMap3.wrapT = THREE.RepeatWrapping; - normalMap3.repeat.x = 10; - normalMap3.repeat.y = 6; - normalMap3.anisotropy = 16; - - const normalMap4 = textureLoader.load('textures/golfball.jpg'); - - const clearcoatNormalMap = textureLoader.load( - 'textures/pbr/Scratched_gold/Scratched_gold_01_1K_Normal.png', - ); - - // car paint - - let material = new THREE.MeshPhysicalMaterial({ - clearcoat: 1.0, - clearcoatRoughness: 0.1, - metalness: 0.9, - roughness: 0.5, - color: 0x0000ff, - normalMap: normalMap3, - normalScale: new THREE.Vector2(0.15, 0.15), - }); - let mesh = new THREE.Mesh(geometry, material); - mesh.position.x = -1; - mesh.position.y = 1; - group.add(mesh); - - // fibers - - material = new THREE.MeshPhysicalMaterial({ - roughness: 0.5, - clearcoat: 1.0, - clearcoatRoughness: 0.1, - map: diffuse, - normalMap: normalMap, - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = 1; - mesh.position.y = 1; - group.add(mesh); - - // golf - - material = new THREE.MeshPhysicalMaterial({ - metalness: 0.0, - roughness: 0.1, - clearcoat: 1.0, - normalMap: normalMap4, - clearcoatNormalMap: clearcoatNormalMap, - - // y scale is negated to compensate for normal map handedness. - clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = -1; - mesh.position.y = -1; - group.add(mesh); - - // clearcoat + normalmap - - material = new THREE.MeshPhysicalMaterial({ - clearcoat: 1.0, - metalness: 1.0, - color: 0xff0000, - normalMap: normalMap2, - normalScale: new THREE.Vector2(0.15, 0.15), - clearcoatNormalMap: clearcoatNormalMap, - - // y scale is negated to compensate for normal map handedness. - clearcoatNormalScale: new THREE.Vector2(2.0, -2.0), - }); - mesh = new THREE.Mesh(geometry, material); - mesh.position.x = 1; - mesh.position.y = -1; - group.add(mesh); - - // - - scene.background = texture; - scene.environment = texture; - }); - - // LIGHTS - - particleLight = new THREE.Mesh( - new THREE.SphereGeometry(0.05, 8, 8), - new THREE.MeshBasicMaterial({ color: 0xffffff }), - ); - scene.add(particleLight); - - particleLight.add(new THREE.PointLight(0xffffff, 30)); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.25; - renderer.inspector = new Inspector(); - - // EVENTS - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 3; - controls.maxDistance = 30; - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -// - -function animate() { - render(); -} - -function render() { - const timer = Date.now() * 0.00025; - - particleLight.position.x = Math.sin(timer * 7) * 3; - particleLight.position.y = Math.cos(timer * 5) * 4; - particleLight.position.z = Math.cos(timer * 3) * 3; - - for (let i = 0; i < group.children.length; i++) { - const child = group.children[i]; - child.rotation.y += 0.005; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_clipping.ts b/examples-testing/examples/webgpu_clipping.ts deleted file mode 100644 index b2b567c9a..000000000 --- a/examples-testing/examples/webgpu_clipping.ts +++ /dev/null @@ -1,201 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, startTime, object; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 0.25, 16); - - camera.position.set(0, 1.3, 3); - - scene = new THREE.Scene(); - - // Lights - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const spotLight = new THREE.SpotLight(0xffffff, 60); - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.2; - spotLight.position.set(2, 3, 3); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 3; - spotLight.shadow.camera.far = 10; - spotLight.shadow.mapSize.width = 2048; - spotLight.shadow.mapSize.height = 2048; - spotLight.shadow.radius = 4; - scene.add(spotLight); - - const dirLight = new THREE.DirectionalLight(0x55505a, 3); - dirLight.position.set(0, 3, 0); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 1; - dirLight.shadow.camera.far = 10; - - dirLight.shadow.camera.right = 1; - dirLight.shadow.camera.left = -1; - dirLight.shadow.camera.top = 1; - dirLight.shadow.camera.bottom = -1; - - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; - scene.add(dirLight); - - // Clipping planes - - const globalPlane = new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0.1); - const localPlane1 = new THREE.Plane(new THREE.Vector3(0, -1, 0), 0.8); - const localPlane2 = new THREE.Plane(new THREE.Vector3(0, 0, -1), 0.1); - - // Clipping Groups - - const globalClippingGroup = new THREE.ClippingGroup(); - globalClippingGroup.clippingPlanes = [globalPlane]; - - const knotClippingGroup = new THREE.ClippingGroup(); - knotClippingGroup.clippingPlanes = [localPlane1, localPlane2]; - knotClippingGroup.clipIntersection = true; - - scene.add(globalClippingGroup); - globalClippingGroup.add(knotClippingGroup); - - // Geometry - - const material = new THREE.MeshPhongNodeMaterial({ - color: 0x80ee10, - shininess: 0, - side: THREE.DoubleSide, - alphaToCoverage: true, - }); - - const geometry = new THREE.TorusKnotGeometry(0.4, 0.08, 95, 20); - - object = new THREE.Mesh(geometry, material); - object.castShadow = true; - knotClippingGroup.add(object); - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(9, 9, 1, 1), - new THREE.MeshPhongNodeMaterial({ color: 0xa0adaf, shininess: 150, alphaToCoverage: true }), - ); - - ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z - ground.receiveShadow = true; - globalClippingGroup.add(ground); - - // Renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.shadowMap.enabled = true; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - window.addEventListener('resize', onWindowResize); - document.body.appendChild(renderer.domElement); - - // Controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1, 0); - controls.update(); - - // GUI - - const gui = renderer.inspector.createParameters('Clipping settings'); - const props = { - alphaToCoverage: true, - }; - - const folderKnot = gui.addFolder('Knot Clipping Group'); - const propsKnot = { - get Enabled() { - return knotClippingGroup.enabled; - }, - set Enabled(v) { - knotClippingGroup.enabled = v; - }, - - get Shadows() { - return knotClippingGroup.clipShadows; - }, - set Shadows(v) { - knotClippingGroup.clipShadows = v; - }, - - get Intersection() { - return knotClippingGroup.clipIntersection; - }, - - set Intersection(v) { - knotClippingGroup.clipIntersection = v; - }, - - get Plane() { - return localPlane1.constant; - }, - set Plane(v) { - localPlane1.constant = v; - }, - }; - - const folderGlobal = gui.addFolder('Global Clipping Group'); - const propsGlobal = { - get Enabled() { - return globalClippingGroup.enabled; - }, - set Enabled(v) { - globalClippingGroup.enabled = v; - }, - - get Plane() { - return globalPlane.constant; - }, - set Plane(v) { - globalPlane.constant = v; - }, - }; - - gui.add(props, 'alphaToCoverage').onChange(function (value) { - ground.material.alphaToCoverage = value; - ground.material.needsUpdate = true; - - material.alphaToCoverage = value; - material.needsUpdate = true; - }); - - folderKnot.add(propsKnot, 'Enabled'); - folderKnot.add(propsKnot, 'Shadows'); - folderKnot.add(propsKnot, 'Intersection'); - folderKnot.add(propsKnot, 'Plane', 0.3, 1.25); - - folderGlobal.add(propsGlobal, 'Enabled'); - folderGlobal.add(propsGlobal, 'Plane', -0.4, 3); - - // Start - - startTime = Date.now(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(currentTime) { - const time = (currentTime - startTime) / 1000; - - object.position.y = 0.8; - object.rotation.x = time * 0.5; - object.rotation.y = time * 0.2; - object.scale.setScalar(Math.cos(time) * 0.125 + 0.875); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_clipping_stencil.ts b/examples-testing/examples/webgpu_clipping_stencil.ts deleted file mode 100644 index c117bcfa8..000000000 --- a/examples-testing/examples/webgpu_clipping_stencil.ts +++ /dev/null @@ -1,240 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, object; -let planes, planeObjects, planeHelpers; -let timer; - -const params = { - animate: true, - planeX: { - constant: 0, - negated: false, - displayHelper: false, - }, - planeY: { - constant: 0, - negated: false, - displayHelper: false, - }, - planeZ: { - constant: 0, - negated: false, - displayHelper: false, - }, -}; - -init(); - -function createPlaneStencilGroup(geometry, plane, stencilBit, renderOrder) { - const group = new THREE.ClippingGroup(); - group.clippingPlanes = [plane]; - - const material = new THREE.MeshBasicNodeMaterial(); - material.side = THREE.DoubleSide; - material.depthWrite = false; - material.depthTest = false; - material.colorWrite = false; - material.stencilWrite = true; - material.stencilWriteMask = stencilBit; - material.stencilFunc = THREE.AlwaysStencilFunc; - material.stencilFail = THREE.InvertStencilOp; - material.stencilZFail = THREE.InvertStencilOp; - material.stencilZPass = THREE.InvertStencilOp; - - const mesh = new THREE.Mesh(geometry, material); - mesh.renderOrder = renderOrder; - group.add(mesh); - - return group; -} - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x263238); - - camera = new THREE.PerspectiveCamera(36, window.innerWidth / window.innerHeight, 1, 100); - camera.position.set(2, 2, 2); - - scene.add(new THREE.AmbientLight(0xffffff, 1.5)); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(5, 10, 7.5); - dirLight.castShadow = true; - dirLight.shadow.camera.right = 2; - dirLight.shadow.camera.left = -2; - dirLight.shadow.camera.top = 2; - dirLight.shadow.camera.bottom = -2; - - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; - scene.add(dirLight); - - planes = [ - new THREE.Plane(new THREE.Vector3(-1, 0, 0), 0), - new THREE.Plane(new THREE.Vector3(0, -1, 0), 0), - new THREE.Plane(new THREE.Vector3(0, 0, -1), 0), - ]; - - planeHelpers = planes.map(p => new THREE.PlaneHelper(p, 2, 0xffffff)); - planeHelpers.forEach(ph => { - ph.visible = false; - scene.add(ph); - }); - - const geometry = new THREE.TorusKnotGeometry(0.4, 0.15, 220, 60); - object = new THREE.Group(); - scene.add(object); - - // Set up clip plane rendering - - planeObjects = []; - const planeGeom = new THREE.PlaneGeometry(4, 4); - - for (let i = 0; i < 3; i++) { - const plane = planes[i]; - const stencilBit = 1 << i; - - const stencilGroup = createPlaneStencilGroup(geometry, plane, stencilBit, i + 1); - object.add(stencilGroup); - - // the cap is only rendered where the stencil bit of its plane is set - // and is clipped by the other clipping planes - - const planeMat = new THREE.MeshStandardNodeMaterial({ - color: 0xe91e63, - metalness: 0.1, - roughness: 0.75, - - stencilWrite: true, - stencilRef: 0, - stencilFuncMask: stencilBit, - stencilWriteMask: stencilBit, - stencilFunc: THREE.NotEqualStencilFunc, - stencilFail: THREE.ReplaceStencilOp, - stencilZFail: THREE.ReplaceStencilOp, - stencilZPass: THREE.ReplaceStencilOp, - }); - const po = new THREE.Mesh(planeGeom, planeMat); - po.renderOrder = i + 1.1; - - const poGroup = new THREE.ClippingGroup(); - poGroup.clippingPlanes = planes.filter(p => p !== plane); - poGroup.add(po); - - planeObjects.push(po); - scene.add(poGroup); - } - - const clippingGroup = new THREE.ClippingGroup(); - clippingGroup.clippingPlanes = planes; - clippingGroup.clipShadows = true; - object.add(clippingGroup); - - const material = new THREE.MeshStandardNodeMaterial({ - color: 0xffc107, - metalness: 0.1, - roughness: 0.75, - shadowSide: THREE.DoubleSide, - }); - - // add the color - - const clippedColorFront = new THREE.Mesh(geometry, material); - clippedColorFront.castShadow = true; - clippedColorFront.renderOrder = 6; - clippingGroup.add(clippedColorFront); - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(9, 9, 1, 1), - new THREE.ShadowNodeMaterial({ color: 0x000000, opacity: 0.25, side: THREE.DoubleSide }), - ); - - ground.rotation.x = -Math.PI / 2; // rotates X/Y to X/Z - ground.position.y = -1; - ground.receiveShadow = true; - scene.add(ground); - - // Renderer - - renderer = new THREE.WebGPURenderer({ antialias: true, stencil: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); - - // Controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 20; - controls.update(); - - // GUI - - const gui = renderer.inspector.createParameters('Clipping settings'); - gui.add(params, 'animate'); - - const planeX = gui.addFolder('planeX'); - planeX.add(params.planeX, 'displayHelper').onChange(v => (planeHelpers[0].visible = v)); - planeX.add(params.planeX, 'constant', -1, 1).onChange(d => (planes[0].constant = d)); - planeX.add(params.planeX, 'negated').onChange(() => { - planes[0].negate(); - params.planeX.constant = planes[0].constant; - }); - - const planeY = gui.addFolder('planeY'); - planeY.add(params.planeY, 'displayHelper').onChange(v => (planeHelpers[1].visible = v)); - planeY.add(params.planeY, 'constant', -1, 1).onChange(d => (planes[1].constant = d)); - planeY.add(params.planeY, 'negated').onChange(() => { - planes[1].negate(); - params.planeY.constant = planes[1].constant; - }); - - const planeZ = gui.addFolder('planeZ'); - planeZ.add(params.planeZ, 'displayHelper').onChange(v => (planeHelpers[2].visible = v)); - planeZ.add(params.planeZ, 'constant', -1, 1).onChange(d => (planes[2].constant = d)); - planeZ.add(params.planeZ, 'negated').onChange(() => { - planes[2].negate(); - params.planeZ.constant = planes[2].constant; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (params.animate) { - object.rotation.x += delta * 0.5; - object.rotation.y += delta * 0.2; - } - - for (let i = 0; i < planeObjects.length; i++) { - const plane = planes[i]; - const po = planeObjects[i]; - plane.coplanarPoint(po.position); - po.lookAt(po.position.x - plane.normal.x, po.position.y - plane.normal.y, po.position.z - plane.normal.z); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compile_async.ts b/examples-testing/examples/webgpu_compile_async.ts deleted file mode 100644 index fbcf0a7b0..000000000 --- a/examples-testing/examples/webgpu_compile_async.ts +++ /dev/null @@ -1,265 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - uv, - float, - vec3, - hash, - mx_noise_vec3, - mx_worley_noise_vec3, - mx_cell_noise_float, - mx_fractal_noise_vec3, -} from 'three/tsl'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let MESH_COUNT = 256; -let GRID_SIZE = 16; -const ADD_DELAY = 1000; - -let camera, scene, renderer; -let sphere; -let gui; - -// Frame timing -let lastFrameTime = 0; -let longestFrameTime = 0; -let isTracking = false; -let shouldStartTracking = false; -let sphereStartTime = 0; -let currentMode = ''; -let framesAfterComplete = 0; -let testDone = false; -let meshGroup = null; - -const longestFrameEl = document.getElementById('longestFrame'); -const meshCountEl = document.getElementById('meshCount'); -const compileModeEl = document.getElementById('compileMode'); - -const params = { - withoutCompile: function () { - window.location.href = window.location.pathname + '?mode=no-compile'; - }, - withCompileAsync: function () { - window.location.href = window.location.pathname + '?mode=compile-async'; - }, -}; - -init(); - -async function init() { - // GUI - gui = new GUI(); - gui.add(params, 'withoutCompile').name('Build on render'); - gui.add(params, 'withCompileAsync').name('Pre-build (compileAsync)'); - - window.addEventListener('resize', onWindowResize); - - // Orthographic camera - const aspect = window.innerWidth / window.innerHeight; - const frustumSize = 20; - camera = new THREE.OrthographicCamera( - (frustumSize * aspect) / -2, - (frustumSize * aspect) / 2, - frustumSize / 2, - frustumSize / -2, - 0.1, - 100, - ); - camera.position.set(0, 0, 20); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x111111); - - // Create animated sphere - const sphereGeometry = new THREE.SphereGeometry(0.5, 32, 32); - const sphereMaterial = new THREE.MeshNormalMaterial(); - sphere = new THREE.Mesh(sphereGeometry, sphereMaterial); - scene.add(sphere); - - // Renderer - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // Reduce mesh count for WebGL (slower compilation) - if (renderer.backend.isWebGLBackend) { - MESH_COUNT = 64; - GRID_SIZE = 8; - document.getElementById('materialCount').textContent = '64'; - meshCountEl.textContent = '0 / 64'; - } - - // Get mode from URL - const urlParams = new URLSearchParams(window.location.search); - const mode = urlParams.get('mode') || 'compile-async'; - - const modeLabel = mode === 'compile-async' ? 'Pre-build (compileAsync)' : 'Build on render'; - compileModeEl.textContent = modeLabel; - - // Start sphere animation - sphereStartTime = performance.now(); - - // Schedule mesh addition after delay - setTimeout(() => addMeshes(mode), ADD_DELAY); -} - -function createUniqueMaterial(index) { - const material = new THREE.MeshBasicNodeMaterial(); - - const seed = float(index * 0.1 + 1.0); - const scale = float((index % 5) + 2.0); - const uvNode = uv() - .mul(scale) - .add(hash(float(index))); - - const noiseType = index % 4; - let colorNode; - - switch (noiseType) { - case 0: - colorNode = mx_noise_vec3(uvNode.mul(seed)).mul(0.5).add(0.5); - break; - - case 1: - colorNode = mx_worley_noise_vec3(uvNode.mul(seed.mul(0.5))); - break; - - case 2: - const cellNoise = mx_cell_noise_float(uvNode.mul(seed)); - colorNode = vec3(cellNoise, cellNoise.mul(0.7), cellNoise.mul(0.4)); - break; - - case 3: - colorNode = mx_fractal_noise_vec3(uvNode.mul(seed.mul(0.3)), float(3), float(2.0), float(0.5)) - .mul(0.5) - .add(0.5); - break; - } - - const tintR = hash(float(index * 3)); - const tintG = hash(float(index * 3 + 1)); - const tintB = hash(float(index * 3 + 2)); - const tint = vec3(tintR, tintG, tintB).mul(0.3).add(0.7); - - material.colorNode = colorNode.mul(tint); - - return material; -} - -async function addMeshes(mode) { - const geometry = new THREE.PlaneGeometry(0.9, 0.9); - const startX = -(GRID_SIZE - 1) / 2; - const startY = -(GRID_SIZE - 1) / 2; - - meshGroup = new THREE.Group(); - - for (let i = 0; i < MESH_COUNT; i++) { - const material = createUniqueMaterial(i); - const mesh = new THREE.Mesh(geometry, material); - - const col = i % GRID_SIZE; - const row = Math.floor(i / GRID_SIZE); - - mesh.position.x = startX + col; - mesh.position.y = startY + row; - - meshGroup.add(mesh); - } - - currentMode = mode; - - if (mode === 'compile-async') { - // Pre-compile all meshes before adding to scene - // Start tracking BEFORE compile to measure longest frame during compile - shouldStartTracking = true; - - await renderer.compileAsync(meshGroup, camera, scene); - - // Add all meshes at once (already compiled - should render instantly) - scene.add(meshGroup); - testDone = true; - } else { - // Add all meshes at once - renderer compiles on-demand - // Meshes appear progressively as they compile - scene.add(meshGroup); - - // Start tracking on next animate() frame - shouldStartTracking = true; - testDone = true; - } -} - -function finishTest() { - isTracking = false; - - longestFrameEl.textContent = longestFrameTime.toFixed(1) + ' ms'; - longestFrameEl.className = longestFrameTime > 100 ? 'value bad' : 'value'; -} - -function onWindowResize() { - if (!renderer || !camera) return; - - const aspect = window.innerWidth / window.innerHeight; - const frustumSize = 12; - - camera.left = (frustumSize * aspect) / -2; - camera.right = (frustumSize * aspect) / 2; - camera.top = frustumSize / 2; - camera.bottom = frustumSize / -2; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const now = performance.now(); - - // Initialize tracking on first frame after meshes added - if (shouldStartTracking) { - shouldStartTracking = false; - isTracking = true; - lastFrameTime = now; - longestFrameTime = 0; - framesAfterComplete = 0; - } - - // Track longest frame during test - if (isTracking && lastFrameTime > 0 && lastFrameTime !== now) { - const frameTime = now - lastFrameTime; - if (frameTime > longestFrameTime) { - longestFrameTime = frameTime; - } - } - - lastFrameTime = now; - - // Animate sphere left to right - if (sphere && sphereStartTime > 0) { - const elapsed = (now - sphereStartTime) / 1000; - sphere.position.x = Math.sin(elapsed * 2) * 8; - } - - renderer.render(scene, camera); - - // Update mesh count display - if (meshGroup) { - meshCountEl.textContent = meshGroup.children.length + ' / ' + MESH_COUNT; - } - - // Finish test - wait a few frames after testDone to capture frame times - if (isTracking && testDone) { - framesAfterComplete++; - - // Wait longer for deferred mode (meshes compile progressively) - const framesToWait = currentMode === 'compile-async' ? 2 : 60; - - if (framesAfterComplete >= framesToWait) { - finishTest(); - } - } -} diff --git a/examples-testing/examples/webgpu_compute_audio.ts b/examples-testing/examples/webgpu_compute_audio.ts deleted file mode 100644 index 229033d79..000000000 --- a/examples-testing/examples/webgpu_compute_audio.ts +++ /dev/null @@ -1,178 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { Fn, uniform, instanceIndex, instancedArray, float, texture, screenUV, color } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let computeNode; -let waveBuffer, sampleRate; -let waveArray; -let currentAudio, currentAnalyser; -const analyserBuffer = new Uint8Array(1024); -let analyserTexture; - -const startButton = document.getElementById('startButton'); -startButton.addEventListener('click', init); - -async function playAudioBuffer() { - if (currentAudio) currentAudio.stop(); - - // compute audio - - renderer.compute(computeNode); - - const wave = new Float32Array(await renderer.getArrayBufferAsync(waveArray.value)); - - // play result - - const audioOutputContext = new AudioContext({ sampleRate }); - const audioOutputBuffer = audioOutputContext.createBuffer(1, wave.length, sampleRate); - - audioOutputBuffer.copyToChannel(wave, 0); - - const source = audioOutputContext.createBufferSource(); - source.connect(audioOutputContext.destination); - source.buffer = audioOutputBuffer; - source.start(); - - currentAudio = source; - - // visual feedback - - currentAnalyser = audioOutputContext.createAnalyser(); - currentAnalyser.fftSize = 2048; - - source.connect(currentAnalyser); -} - -async function init() { - const overlay = document.getElementById('overlay'); - overlay.remove(); - - // audio buffer - - const soundBuffer = await fetch('sounds/webgpu-audio-processing.mp3').then(res => res.arrayBuffer()); - const audioContext = new AudioContext(); - - const audioBuffer = await audioContext.decodeAudioData(soundBuffer); - - waveBuffer = audioBuffer.getChannelData(0); - - // adding extra silence to delay and pitch - waveBuffer = new Float32Array([...waveBuffer, ...new Float32Array(200000)]); - - sampleRate = audioBuffer.sampleRate / audioBuffer.numberOfChannels; - - // create webgpu buffers - - waveArray = instancedArray(waveBuffer); - - // read-only buffer - - const originalWave = instancedArray(waveBuffer).toReadOnly(); - - // The Pixel Buffer Object (PBO) is required to get the GPU computed data to the CPU in the WebGL2 fallback. - // As used in `renderer.getArrayBufferAsync( waveArray.value )`. - - originalWave.setPBO(true); - waveArray.setPBO(true); - - // params - - const pitch = uniform(1.5); - const delayVolume = uniform(0.2); - const delayOffset = uniform(0.55); - - // compute (shader-node) - - const computeShaderFn = Fn(() => { - const index = float(instanceIndex); - - // pitch - - const time = index.mul(pitch); - - let wave = originalWave.element(time); - - // delay - - for (let i = 1; i < 7; i++) { - const waveOffset = originalWave.element(index.sub(delayOffset.mul(sampleRate).mul(i)).mul(pitch)); - const waveOffsetVolume = waveOffset.mul(delayVolume.div(i * i)); - - wave = wave.add(waveOffsetVolume); - } - - // store - - const waveStorageElementNode = waveArray.element(instanceIndex); - - waveStorageElementNode.assign(wave); - }); - - // compute - - computeNode = computeShaderFn().compute(waveBuffer.length); - - // renderer - - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 30); - - // nodes - - analyserTexture = new THREE.DataTexture(analyserBuffer, analyserBuffer.length, 1, THREE.RedFormat); - - const spectrum = texture(analyserTexture, screenUV.x).x.mul(screenUV.y); - const backgroundNode = color(0x0000ff).mul(spectrum); - - // scene - - scene = new THREE.Scene(); - scene.backgroundNode = backgroundNode; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - await renderer.init(); - - window.addEventListener('resize', onWindowResize); - document.addEventListener('click', playAudioBuffer); - - // gui - - const gui = renderer.inspector.createParameters('Audio'); - - gui.add(pitch, 'value', 0.5, 2, 0.01).name('pitch'); - gui.add(delayVolume, 'value', 0, 1, 0.01).name('delayVolume'); - gui.add(delayOffset, 'value', 0.1, 1, 0.01).name('delayOffset'); - - // - - playAudioBuffer(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - if (currentAnalyser) { - currentAnalyser.getByteFrequencyData(analyserBuffer); - - analyserTexture.needsUpdate = true; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_birds.ts b/examples-testing/examples/webgpu_compute_birds.ts deleted file mode 100644 index 665a54528..000000000 --- a/examples-testing/examples/webgpu_compute_birds.ts +++ /dev/null @@ -1,424 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - uniform, - varying, - vec4, - add, - sub, - max, - dot, - sin, - mat3, - uint, - negate, - instancedArray, - cameraProjectionMatrix, - cameraViewMatrix, - positionLocal, - modelWorldMatrix, - sqrt, - float, - Fn, - If, - cos, - Loop, - Continue, - normalize, - instanceIndex, - length, - vertexIndex, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let container; -let camera, scene, renderer; - -let last = performance.now(); - -let pointer, raycaster; -let computeVelocity, computePosition, effectController; - -const BIRDS = 8192; -const SPEED_LIMIT = 9.0; -const BOUNDS = 800, - BOUNDS_HALF = BOUNDS / 2; - -// Custom Geometry - using 3 triangles each. No normals currently. -class BirdGeometry extends THREE.BufferGeometry { - constructor() { - super(); - - const points = 3 * 3; - - const vertices = new THREE.BufferAttribute(new Float32Array(points * 3), 3); - - this.setAttribute('position', vertices); - - let v = 0; - - function verts_push() { - for (let i = 0; i < arguments.length; i++) { - vertices.array[v++] = arguments[i]; - } - } - - const wingsSpan = 20; - - // Body - verts_push(0, 0, -20, 0, -8, 10, 0, 0, 30); - - // Left Wing - verts_push(0, 0, -15, -wingsSpan, 0, 5, 0, 0, 15); - - // Right Wing - verts_push(0, 0, 15, wingsSpan, 0, 5, 0, 0, -15); - - this.scale(0.2, 0.2, 0.2); - } -} - -// TODO: Fix example with WebGL backend - -if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); -} - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0xffffff, 700, 3000); - - // Pointer - - pointer = new THREE.Vector2(); - raycaster = new THREE.Raycaster(); - - // Sky - - const geometry = new THREE.IcosahedronGeometry(1, 6); - const material = new THREE.MeshBasicNodeMaterial({ - // Use vertex positions to create atmosphere colors - colorNode: varying( - vec4(sub(0.25, positionLocal.y), sub(-0.25, positionLocal.y), add(1.5, positionLocal.y), 1.0), - ), - side: THREE.BackSide, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.rotation.z = 0.75; - mesh.scale.setScalar(1200); - scene.add(mesh); - - // - - renderer = new THREE.WebGPURenderer({ - antialias: true, - forceWebGL: false, - requiredLimits: { maxStorageBuffersInVertexStage: 3 }, - }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera); - controls.connect(renderer.domElement); - - // Initialize position, velocity, and phase values - - const positionArray = new Float32Array(BIRDS * 3); - const velocityArray = new Float32Array(BIRDS * 3); - const phaseArray = new Float32Array(BIRDS); - - for (let i = 0; i < BIRDS; i++) { - const posX = Math.random() * BOUNDS - BOUNDS_HALF; - const posY = Math.random() * BOUNDS - BOUNDS_HALF; - const posZ = Math.random() * BOUNDS - BOUNDS_HALF; - - positionArray[i * 3 + 0] = posX; - positionArray[i * 3 + 1] = posY; - positionArray[i * 3 + 2] = posZ; - - const velX = Math.random() - 0.5; - const velY = Math.random() - 0.5; - const velZ = Math.random() - 0.5; - - velocityArray[i * 3 + 0] = velX * 10; - velocityArray[i * 3 + 1] = velY * 10; - velocityArray[i * 3 + 2] = velZ * 10; - - phaseArray[i] = 1; - } - - // Labels applied to storage nodes and uniform nodes are reflected within the shader output, - // and are useful for debugging purposes. - - const positionStorage = instancedArray(positionArray, 'vec3').setName('positionStorage'); - const velocityStorage = instancedArray(velocityArray, 'vec3').setName('velocityStorage'); - const phaseStorage = instancedArray(phaseArray, 'float').setName('phaseStorage'); - - // The Pixel Buffer Object (PBO) is required to get the GPU computed data in the WebGL2 fallback. - - positionStorage.setPBO(true); - velocityStorage.setPBO(true); - phaseStorage.setPBO(true); - - // Define Uniforms. Uniforms only need to be defined once rather than per shader. - - effectController = { - separation: uniform(15.0).setName('separation'), - alignment: uniform(20.0).setName('alignment'), - cohesion: uniform(20.0).setName('cohesion'), - freedom: uniform(0.75).setName('freedom'), - now: uniform(0.0), - deltaTime: uniform(0.0).setName('deltaTime'), - rayOrigin: uniform(new THREE.Vector3()).setName('rayOrigin'), - rayDirection: uniform(new THREE.Vector3()).setName('rayDirection'), - }; - - // Create geometry - - const birdGeometry = new BirdGeometry(); - const birdMaterial = new THREE.NodeMaterial(); - - // Animate bird mesh within vertex shader, then apply position offset to vertices. - - const birdVertexTSL = Fn(() => { - const position = positionLocal.toVar(); - const newPhase = phaseStorage.element(instanceIndex).toVar(); - const newVelocity = normalize(velocityStorage.element(instanceIndex)).toVar(); - - If(vertexIndex.equal(4).or(vertexIndex.equal(7)), () => { - // flap wings - position.y = sin(newPhase).mul(5.0); - }); - - const newPosition = modelWorldMatrix.mul(position); - - newVelocity.z.mulAssign(-1.0); - const xz = length(newVelocity.xz); - const xyz = float(1.0); - const x = sqrt(newVelocity.y.mul(newVelocity.y).oneMinus()); - - const cosry = newVelocity.x.div(xz).toVar(); - const sinry = newVelocity.z.div(xz).toVar(); - - const cosrz = x.div(xyz); - const sinrz = newVelocity.y.div(xyz).toVar(); - - // Nodes must be negated with negate(). Using '-', their values will resolve to NaN. - const maty = mat3(cosry, 0, negate(sinry), 0, 1, 0, sinry, 0, cosry); - - const matz = mat3(cosrz, sinrz, 0, negate(sinrz), cosrz, 0, 0, 0, 1); - - const finalVert = maty.mul(matz).mul(newPosition); - finalVert.addAssign(positionStorage.element(instanceIndex)); - - return cameraProjectionMatrix.mul(cameraViewMatrix).mul(finalVert); - }); - - birdMaterial.vertexNode = birdVertexTSL(); - birdMaterial.side = THREE.DoubleSide; - - const birdMesh = new THREE.InstancedMesh(birdGeometry, birdMaterial, BIRDS); - birdMesh.rotation.y = Math.PI / 2; - birdMesh.matrixAutoUpdate = false; - birdMesh.frustumCulled = false; - birdMesh.updateMatrix(); - - // Define GPU Compute shaders. - // Shaders are computationally identical to their GLSL counterparts outside of texture destructuring. - - computeVelocity = Fn(() => { - // Define consts - const PI = float(3.141592653589793); - const PI_2 = PI.mul(2.0); - const limit = float(SPEED_LIMIT).toVar('limit'); - - // Destructure uniforms - const { alignment, separation, cohesion, deltaTime, rayOrigin, rayDirection } = effectController; - - const zoneRadius = separation.add(alignment).add(cohesion).toConst(); - const separationThresh = separation.div(zoneRadius).toConst(); - const alignmentThresh = separation.add(alignment).div(zoneRadius).toConst(); - const zoneRadiusSq = zoneRadius.mul(zoneRadius).toConst(); - - // Cache current bird's position and velocity outside the loop - const birdIndex = instanceIndex.toConst('birdIndex'); - const position = positionStorage.element(birdIndex).toVar(); - const velocity = velocityStorage.element(birdIndex).toVar(); - - // Add influence of pointer position to velocity using cached position - const directionToRay = rayOrigin.sub(position).toConst(); - const projectionLength = dot(directionToRay, rayDirection).toConst(); - const closestPoint = rayOrigin.sub(rayDirection.mul(projectionLength)).toConst(); - const directionToClosestPoint = closestPoint.sub(position).toConst(); - const distanceToClosestPoint = length(directionToClosestPoint).toConst(); - const distanceToClosestPointSq = distanceToClosestPoint.mul(distanceToClosestPoint).toConst(); - - const rayRadius = float(150.0).toConst(); - const rayRadiusSq = rayRadius.mul(rayRadius).toConst(); - - If(distanceToClosestPointSq.lessThan(rayRadiusSq), () => { - const velocityAdjust = distanceToClosestPointSq.div(rayRadiusSq).sub(1.0).mul(deltaTime).mul(100.0); - velocity.addAssign(normalize(directionToClosestPoint).mul(velocityAdjust)); - limit.addAssign(5.0); - }); - - // Attract flocks to center - const dirToCenter = position.toVar(); - dirToCenter.y.mulAssign(2.5); - velocity.subAssign(normalize(dirToCenter).mul(deltaTime).mul(5.0)); - - Loop({ start: uint(0), end: uint(BIRDS), type: 'uint', condition: '<' }, ({ i }) => { - If(i.equal(birdIndex), () => { - Continue(); - }); - - // Cache bird's position and velocity - - const birdPosition = positionStorage.element(i); - const dirToBird = birdPosition.sub(position); - const distToBird = length(dirToBird); - - If(distToBird.lessThan(0.0001), () => { - Continue(); - }); - - const distToBirdSq = distToBird.mul(distToBird); - - // Don't apply any changes to velocity if changes if the bird is outsize the zone's radius. - If(distToBirdSq.greaterThan(zoneRadiusSq), () => { - Continue(); - }); - - // Determine which threshold the bird is flying within and adjust its velocity accordingly - - const percent = distToBirdSq.div(zoneRadiusSq); - - If(percent.lessThan(separationThresh), () => { - // Separation - Move apart for comfort - const velocityAdjust = separationThresh.div(percent).sub(1.0).mul(deltaTime); - velocity.subAssign(normalize(dirToBird).mul(velocityAdjust)); - }) - .ElseIf(percent.lessThan(alignmentThresh), () => { - // Alignment - fly the same direction - const threshDelta = alignmentThresh.sub(separationThresh); - const adjustedPercent = percent.sub(separationThresh).div(threshDelta); - const birdVelocity = velocityStorage.element(i); - - const cosRange = cos(adjustedPercent.mul(PI_2)); - const cosRangeAdjust = float(0.5).sub(cosRange.mul(0.5)).add(0.5); - const velocityAdjust = cosRangeAdjust.mul(deltaTime); - velocity.addAssign(normalize(birdVelocity).mul(velocityAdjust)); - }) - .Else(() => { - // Attraction / Cohesion - move closer - const threshDelta = alignmentThresh.oneMinus(); - const adjustedPercent = threshDelta - .equal(0.0) - .select(1.0, percent.sub(alignmentThresh).div(threshDelta)); - - const cosRange = cos(adjustedPercent.mul(PI_2)); - const adj1 = cosRange.mul(-0.5); - const adj2 = adj1.add(0.5); - const adj3 = float(0.5).sub(adj2); - - const velocityAdjust = adj3.mul(deltaTime); - velocity.addAssign(normalize(dirToBird).mul(velocityAdjust)); - }); - }); - - If(length(velocity).greaterThan(limit), () => { - velocity.assign(normalize(velocity).mul(limit)); - }); - - // Write back the final velocity to storage - velocityStorage.element(birdIndex).assign(velocity); - })() - .compute(BIRDS) - .setName('Birds Velocity'); - - computePosition = Fn(() => { - const { deltaTime } = effectController; - positionStorage - .element(instanceIndex) - .addAssign(velocityStorage.element(instanceIndex).mul(deltaTime).mul(15.0)); - - const velocity = velocityStorage.element(instanceIndex); - const phase = phaseStorage.element(instanceIndex); - - const modValue = phase - .add(deltaTime) - .add(length(velocity.xz).mul(deltaTime).mul(3.0)) - .add(max(velocity.y, 0.0).mul(deltaTime).mul(6.0)); - phaseStorage.element(instanceIndex).assign(modValue.mod(62.83)); - })() - .compute(BIRDS) - .setName('Birds Position'); - - scene.add(birdMesh); - - container.style.touchAction = 'none'; - container.addEventListener('pointermove', onPointerMove); - - window.addEventListener('resize', onWindowResize); - - const gui = renderer.inspector.createParameters('Birds settings'); - gui.add(effectController.separation, 'value', 0.0, 100.0, 1.0).name('Separation'); - gui.add(effectController.alignment, 'value', 0.0, 100, 0.001).name('Alignment '); - gui.add(effectController.cohesion, 'value', 0.0, 100, 0.025).name('Cohesion'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - if (event.isPrimary === false) return; - - pointer.x = (event.clientX / window.innerWidth) * 2.0 - 1.0; - pointer.y = 1.0 - (event.clientY / window.innerHeight) * 2.0; -} - -function render() { - const now = performance.now(); - let deltaTime = (now - last) / 1000; - - if (deltaTime > 1) deltaTime = 1; // safety cap on large deltas - last = now; - - raycaster.setFromCamera(pointer, camera); - - effectController.now.value = now; - effectController.deltaTime.value = deltaTime; - effectController.rayOrigin.value.copy(raycaster.ray.origin); - effectController.rayDirection.value.copy(raycaster.ray.direction); - - renderer.compute(computeVelocity); - renderer.compute(computePosition); - - renderer.render(scene, camera); - - // Move pointer away so we only affect birds when moving the mouse - pointer.y = 10; -} - -init(); diff --git a/examples-testing/examples/webgpu_compute_cloth.ts b/examples-testing/examples/webgpu_compute_cloth.ts deleted file mode 100644 index c18af53f2..000000000 --- a/examples-testing/examples/webgpu_compute_cloth.ts +++ /dev/null @@ -1,487 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { - Fn, - If, - Return, - instancedArray, - instanceIndex, - uniform, - select, - attribute, - Loop, - float, - transformNormalToView, - cross, - triNoise3D, - time, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let renderer, scene, camera, controls; - -const clothWidth = 1; -const clothHeight = 1; -const clothNumSegmentsX = 30; -const clothNumSegmentsY = 30; -const sphereRadius = 0.15; - -let vertexPositionBuffer, vertexForceBuffer, vertexParamsBuffer; -let springVertexIdBuffer, springRestLengthBuffer, springForceBuffer; -let springListBuffer; -let computeSpringForces, computeVertexForces; -let dampeningUniform, spherePositionUniform, stiffnessUniform, sphereUniform, windUniform; -let vertexWireframeObject, springWireframeObject; -let clothMesh, clothMaterial, sphere; -let timeSinceLastStep = 0; -let timestamp = 0; -const verletVertices = []; -const verletSprings = []; -const verletVertexColumns = []; - -const timer = new THREE.Timer(); -timer.connect(document); - -const params = { - wireframe: false, - sphere: true, - wind: 1.0, -}; - -const API = { - color: 0x204080, // sRGB - sheenColor: 0xffffff, // sRGB -}; - -// TODO: Fix example with WebGL backend - -if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); -} - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true, requiredLimits: { maxStorageBuffersInVertexStage: 1 } }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.set(-1.6, -0.1, -1.6); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 3; - controls.target.set(0, -0.1, 0); - controls.update(); - - const hdrLoader = new UltraHDRLoader().setPath('textures/equirectangular/'); - - const hdrTexture = await hdrLoader.loadAsync('royal_esplanade_2k.hdr.jpg'); - hdrTexture.mapping = THREE.EquirectangularReflectionMapping; - scene.background = hdrTexture; - scene.backgroundBlurriness = 0.5; - scene.environment = hdrTexture; - - setupCloth(); - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(stiffnessUniform, 'value', 0.1, 0.5, 0.01).name('stiffness'); - gui.add(params, 'wireframe'); - gui.add(params, 'sphere'); - gui.add(params, 'wind', 0, 5, 0.1); - - const materialFolder = gui.addFolder('material'); - materialFolder.addColor(API, 'color').onChange(function (color) { - clothMaterial.color.setHex(color); - }); - materialFolder.add(clothMaterial, 'roughness', 0.0, 1, 0.01); - materialFolder.add(clothMaterial, 'sheen', 0.0, 1, 0.01); - materialFolder.add(clothMaterial, 'sheenRoughness', 0.0, 1, 0.01); - materialFolder.addColor(API, 'sheenColor').onChange(function (color) { - clothMaterial.sheenColor.setHex(color); - }); - - window.addEventListener('resize', onWindowResize); - - renderer.setAnimationLoop(render); -} - -function setupVerletGeometry() { - // this function sets up the geometry of the verlet system, a grid of vertices connected by springs - - const addVerletVertex = (x, y, z, isFixed) => { - const id = verletVertices.length; - const vertex = { - id, - position: new THREE.Vector3(x, y, z), - isFixed, - springIds: [], - }; - verletVertices.push(vertex); - return vertex; - }; - - const addVerletSpring = (vertex0, vertex1) => { - const id = verletSprings.length; - const spring = { - id, - vertex0, - vertex1, - }; - vertex0.springIds.push(id); - vertex1.springIds.push(id); - verletSprings.push(spring); - return spring; - }; - - // create the cloth's verlet vertices - for (let x = 0; x <= clothNumSegmentsX; x++) { - const column = []; - for (let y = 0; y <= clothNumSegmentsY; y++) { - const posX = x * (clothWidth / clothNumSegmentsX) - clothWidth * 0.5; - const posZ = y * (clothHeight / clothNumSegmentsY); - const isFixed = y === 0 && x % 5 === 0; // make some of the top vertices' positions fixed - const vertex = addVerletVertex(posX, clothHeight * 0.5, posZ, isFixed); - column.push(vertex); - } - - verletVertexColumns.push(column); - } - - // create the cloth's verlet springs - for (let x = 0; x <= clothNumSegmentsX; x++) { - for (let y = 0; y <= clothNumSegmentsY; y++) { - const vertex0 = verletVertexColumns[x][y]; - if (x > 0) addVerletSpring(vertex0, verletVertexColumns[x - 1][y]); - if (y > 0) addVerletSpring(vertex0, verletVertexColumns[x][y - 1]); - if (x > 0 && y > 0) addVerletSpring(vertex0, verletVertexColumns[x - 1][y - 1]); - if (x > 0 && y < clothNumSegmentsY) addVerletSpring(vertex0, verletVertexColumns[x - 1][y + 1]); - - // You can make the cloth more rigid by adding more springs between further apart vertices - //if (x > 1) addVerletSpring(vertex0, verletVertexColumns[x - 2][y]); - //if (y > 1) addVerletSpring(vertex0, verletVertexColumns[x][y - 2]); - } - } -} - -function setupVerletVertexBuffers() { - // setup the buffers holding the vertex data for the compute shaders - - const vertexCount = verletVertices.length; - - const springListArray = []; - // this springListArray will hold a list of spring ids, ordered by the id of the vertex affected by that spring. - // this is so the compute shader that accumulates the spring forces for each vertex can efficiently iterate over all springs affecting that vertex - - const vertexPositionArray = new Float32Array(vertexCount * 3); - const vertexParamsArray = new Uint32Array(vertexCount * 3); - // the params Array holds three values for each verlet vertex: - // x: isFixed, y: springCount, z: springPointer - // isFixed is 1 if the verlet is marked as immovable, 0 if not - // springCount is the number of springs connected to that vertex - // springPointer is the index of the first spring in the springListArray that is connected to that vertex - - for (let i = 0; i < vertexCount; i++) { - const vertex = verletVertices[i]; - vertexPositionArray[i * 3] = vertex.position.x; - vertexPositionArray[i * 3 + 1] = vertex.position.y; - vertexPositionArray[i * 3 + 2] = vertex.position.z; - vertexParamsArray[i * 3] = vertex.isFixed ? 1 : 0; - if (!vertex.isFixed) { - vertexParamsArray[i * 3 + 1] = vertex.springIds.length; - vertexParamsArray[i * 3 + 2] = springListArray.length; - springListArray.push(...vertex.springIds); - } - } - - vertexPositionBuffer = instancedArray(vertexPositionArray, 'vec3').setPBO(true); // setPBO(true) is only important for the WebGL Fallback - vertexForceBuffer = instancedArray(vertexCount, 'vec3'); - vertexParamsBuffer = instancedArray(vertexParamsArray, 'uvec3'); - - springListBuffer = instancedArray(new Uint32Array(springListArray), 'uint').setPBO(true); -} - -function setupVerletSpringBuffers() { - // setup the buffers holding the spring data for the compute shaders - - const springCount = verletSprings.length; - - const springVertexIdArray = new Uint32Array(springCount * 2); - const springRestLengthArray = new Float32Array(springCount); - - for (let i = 0; i < springCount; i++) { - const spring = verletSprings[i]; - springVertexIdArray[i * 2] = spring.vertex0.id; - springVertexIdArray[i * 2 + 1] = spring.vertex1.id; - springRestLengthArray[i] = spring.vertex0.position.distanceTo(spring.vertex1.position); - } - - springVertexIdBuffer = instancedArray(springVertexIdArray, 'uvec2').setPBO(true); - springRestLengthBuffer = instancedArray(springRestLengthArray, 'float'); - springForceBuffer = instancedArray(springCount * 3, 'vec3').setPBO(true); -} - -function setupUniforms() { - dampeningUniform = uniform(0.99); - spherePositionUniform = uniform(new THREE.Vector3(0, 0, 0)); - sphereUniform = uniform(1.0); - windUniform = uniform(1.0); - stiffnessUniform = uniform(0.2); -} - -function setupComputeShaders() { - // This function sets up the compute shaders for the verlet simulation - // There are two shaders that are executed for each simulation step - - const vertexCount = verletVertices.length; - const springCount = verletSprings.length; - - // 1. computeSpringForces: - // This shader computes a force for each spring, depending on the distance between the two vertices connected by that spring and the targeted rest length - computeSpringForces = Fn(() => { - const vertexIds = springVertexIdBuffer.element(instanceIndex); - const restLength = springRestLengthBuffer.element(instanceIndex); - - const vertex0Position = vertexPositionBuffer.element(vertexIds.x); - const vertex1Position = vertexPositionBuffer.element(vertexIds.y); - - const delta = vertex1Position.sub(vertex0Position).toVar(); - const dist = delta.length().max(0.000001).toVar(); - const force = dist.sub(restLength).mul(stiffnessUniform).mul(delta).mul(0.5).div(dist); - springForceBuffer.element(instanceIndex).assign(force); - })() - .compute(springCount) - .setName('Spring Forces'); - - // 2. computeVertexForces: - // This shader accumulates the force for each vertex. - // First it iterates over all springs connected to this vertex and accumulates their forces. - // Then it adds a gravital force, wind force, and the collision with the sphere. - // In the end it adds the force to the vertex' position. - computeVertexForces = Fn(() => { - const params = vertexParamsBuffer.element(instanceIndex).toVar(); - const isFixed = params.x; - const springCount = params.y; - const springPointer = params.z; - - If(isFixed, () => { - // don't need to calculate vertex forces if the vertex is set as immovable - Return(); - }); - - const position = vertexPositionBuffer.element(instanceIndex).toVar('vertexPosition'); - const force = vertexForceBuffer.element(instanceIndex).toVar('vertexForce'); - - force.mulAssign(dampeningUniform); - - const ptrStart = springPointer.toVar('ptrStart'); - const ptrEnd = ptrStart.add(springCount).toVar('ptrEnd'); - - Loop({ start: ptrStart, end: ptrEnd, type: 'uint', condition: '<' }, ({ i }) => { - const springId = springListBuffer.element(i).toVar('springId'); - const springForce = springForceBuffer.element(springId); - const springVertexIds = springVertexIdBuffer.element(springId); - const factor = select(springVertexIds.x.equal(instanceIndex), 1.0, -1.0); - force.addAssign(springForce.mul(factor)); - }); - - // gravity - force.y.subAssign(0.00005); - - // wind - const noise = triNoise3D(position, 1, time).sub(0.2).mul(0.0001); - const windForce = noise.mul(windUniform); - force.z.subAssign(windForce); - - // collision with sphere - const deltaSphere = position.add(force).sub(spherePositionUniform); - const dist = deltaSphere.length(); - const sphereForce = float(sphereRadius).sub(dist).max(0).mul(deltaSphere).div(dist).mul(sphereUniform); - force.addAssign(sphereForce); - - vertexForceBuffer.element(instanceIndex).assign(force); - vertexPositionBuffer.element(instanceIndex).addAssign(force); - })() - .compute(vertexCount) - .setName('Vertex Forces'); -} - -function setupWireframe() { - // adds helpers to visualize the verlet system - - // verlet vertex visualizer - const vertexWireframeMaterial = new THREE.SpriteNodeMaterial(); - vertexWireframeMaterial.positionNode = vertexPositionBuffer.element(instanceIndex); - vertexWireframeObject = new THREE.Mesh(new THREE.PlaneGeometry(0.01, 0.01), vertexWireframeMaterial); - vertexWireframeObject.frustumCulled = false; - vertexWireframeObject.count = verletVertices.length; - scene.add(vertexWireframeObject); - - // verlet spring visualizer - const springWireframePositionBuffer = new THREE.BufferAttribute(new Float32Array(6), 3, false); - const springWireframeIndexBuffer = new THREE.BufferAttribute(new Uint32Array([0, 1]), 1, false); - const springWireframeMaterial = new THREE.LineBasicNodeMaterial(); - springWireframeMaterial.positionNode = Fn(() => { - const vertexIds = springVertexIdBuffer.element(instanceIndex); - const vertexId = select(attribute('vertexIndex').equal(0), vertexIds.x, vertexIds.y); - return vertexPositionBuffer.element(vertexId); - })(); - - const springWireframeGeometry = new THREE.InstancedBufferGeometry(); - springWireframeGeometry.setAttribute('position', springWireframePositionBuffer); - springWireframeGeometry.setAttribute('vertexIndex', springWireframeIndexBuffer); - springWireframeGeometry.instanceCount = verletSprings.length; - - springWireframeObject = new THREE.Line(springWireframeGeometry, springWireframeMaterial); - springWireframeObject.frustumCulled = false; - springWireframeObject.count = verletSprings.length; - scene.add(springWireframeObject); -} - -function setupSphere() { - const geometry = new THREE.IcosahedronGeometry(sphereRadius * 0.95, 4); - const material = new THREE.MeshStandardNodeMaterial(); - sphere = new THREE.Mesh(geometry, material); - scene.add(sphere); -} - -function setupClothMesh() { - // This function generates a three Geometry and Mesh to render the cloth based on the verlet systems position data. - // Therefore it creates a plane mesh, in which each vertex will be centered in the center of 4 verlet vertices. - - const vertexCount = clothNumSegmentsX * clothNumSegmentsY; - const geometry = new THREE.BufferGeometry(); - - // verletVertexIdArray will hold the 4 verlet vertex ids that contribute to each geometry vertex's position - const verletVertexIdArray = new Uint32Array(vertexCount * 4); - const indices = []; - - const getIndex = (x, y) => { - return y * clothNumSegmentsX + x; - }; - - for (let x = 0; x < clothNumSegmentsX; x++) { - for (let y = 0; y < clothNumSegmentsX; y++) { - const index = getIndex(x, y); - verletVertexIdArray[index * 4] = verletVertexColumns[x][y].id; - verletVertexIdArray[index * 4 + 1] = verletVertexColumns[x + 1][y].id; - verletVertexIdArray[index * 4 + 2] = verletVertexColumns[x][y + 1].id; - verletVertexIdArray[index * 4 + 3] = verletVertexColumns[x + 1][y + 1].id; - - if (x > 0 && y > 0) { - indices.push(getIndex(x, y), getIndex(x - 1, y), getIndex(x - 1, y - 1)); - indices.push(getIndex(x, y), getIndex(x - 1, y - 1), getIndex(x, y - 1)); - } - } - } - - const verletVertexIdBuffer = new THREE.BufferAttribute(verletVertexIdArray, 4, false); - const positionBuffer = new THREE.BufferAttribute(new Float32Array(vertexCount * 3), 3, false); - geometry.setAttribute('position', positionBuffer); - geometry.setAttribute('vertexIds', verletVertexIdBuffer); - geometry.setIndex(indices); - - clothMaterial = new THREE.MeshPhysicalNodeMaterial({ - color: new THREE.Color().setHex(API.color), - side: THREE.DoubleSide, - transparent: true, - opacity: 0.85, - sheen: 1.0, - sheenRoughness: 0.5, - sheenColor: new THREE.Color().setHex(API.sheenColor), - }); - - clothMaterial.positionNode = Fn(({ material }) => { - // gather the position of the 4 verlet vertices and calculate the center position and normal from that - const vertexIds = attribute('vertexIds'); - const v0 = vertexPositionBuffer.element(vertexIds.x).toVar(); - const v1 = vertexPositionBuffer.element(vertexIds.y).toVar(); - const v2 = vertexPositionBuffer.element(vertexIds.z).toVar(); - const v3 = vertexPositionBuffer.element(vertexIds.w).toVar(); - - const top = v0.add(v1); - const right = v1.add(v3); - const bottom = v2.add(v3); - const left = v0.add(v2); - - const tangent = right.sub(left).normalize(); - const bitangent = bottom.sub(top).normalize(); - - const normal = cross(tangent, bitangent); - - // send the normalView from the vertex shader to the fragment shader - material.normalNode = transformNormalToView(normal).toVarying(); - - return v0.add(v1).add(v2).add(v3).mul(0.25); - })(); - - clothMesh = new THREE.Mesh(geometry, clothMaterial); - clothMesh.frustumCulled = false; - scene.add(clothMesh); -} - -function setupCloth() { - setupVerletGeometry(); - setupVerletVertexBuffers(); - setupVerletSpringBuffers(); - setupUniforms(); - setupComputeShaders(); - setupWireframe(); - setupSphere(); - setupClothMesh(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function updateSphere() { - sphere.position.set(Math.sin(timestamp * 2.1) * 0.1, 0, Math.sin(timestamp * 0.8)); - spherePositionUniform.value.copy(sphere.position); -} - -async function render() { - timer.update(); - - sphere.visible = params.sphere; - sphereUniform.value = params.sphere ? 1 : 0; - windUniform.value = params.wind; - clothMesh.visible = !params.wireframe; - vertexWireframeObject.visible = params.wireframe; - springWireframeObject.visible = params.wireframe; - - const deltaTime = Math.min(timer.getDelta(), 1 / 60); // don't advance the time too far, for example when the window is out of focus - const stepsPerSecond = 360; // ensure the same amount of simulation steps per second on all systems, independent of refresh rate - const timePerStep = 1 / stepsPerSecond; - - timeSinceLastStep += deltaTime; - - while (timeSinceLastStep >= timePerStep) { - // run a verlet system simulation step - timestamp += timePerStep; - timeSinceLastStep -= timePerStep; - updateSphere(); - renderer.compute(computeSpringForces); - renderer.compute(computeVertexForces); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_geometry.ts b/examples-testing/examples/webgpu_compute_geometry.ts deleted file mode 100644 index 9299e215b..000000000 --- a/examples-testing/examples/webgpu_compute_geometry.ts +++ /dev/null @@ -1,190 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - vec4, - storage, - Fn, - If, - uniform, - instanceIndex, - objectWorldMatrix, - color, - screenUV, - attribute, -} from 'three/tsl'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let raycaster, pointer; - -let mesh; - -const pointerPosition = uniform(vec4(0)); -const elasticity = uniform(0.4); // elasticity ( how "strong" the spring is ) -const damping = uniform(0.94); // damping factor ( energy loss ) -const brushSize = uniform(0.25); -const brushStrength = uniform(0.22); - -init(); - -const jelly = Fn(({ renderer, geometry, object }) => { - const count = geometry.attributes.position.count; - - // Create storage buffer attribute for modified position. - - const positionBaseAttribute = geometry.attributes.position; - const positionStorageBufferAttribute = new THREE.StorageBufferAttribute(count, 3); - const speedBufferAttribute = new THREE.StorageBufferAttribute(count, 3); - - geometry.setAttribute('storagePosition', positionStorageBufferAttribute); - - // Attributes - - const positionAttribute = storage(positionBaseAttribute, 'vec3', count); - const positionStorageAttribute = storage(positionStorageBufferAttribute, 'vec3', count); - - const speedAttribute = storage(speedBufferAttribute, 'vec3', count); - - // Vectors - - // Base vec3 position of the mesh vertices. - const basePosition = positionAttribute.element(instanceIndex); - // Mesh vertices after compute modification. - const currentPosition = positionStorageAttribute.element(instanceIndex); - // Speed of each mesh vertex. - const currentSpeed = speedAttribute.element(instanceIndex); - - // - - const computeInit = Fn(() => { - // Modified storage position starts out the same as the base position. - - currentPosition.assign(basePosition); - })().compute(count); - - // - - const computeUpdate = Fn(() => { - // pinch - - If(pointerPosition.w.equal(1), () => { - const worldPosition = objectWorldMatrix(object).mul(currentPosition); - - const dist = worldPosition.distance(pointerPosition.xyz); - const direction = pointerPosition.xyz.sub(worldPosition).normalize(); - - const power = brushSize.sub(dist).max(0).mul(brushStrength); - - currentPosition.addAssign(direction.mul(power)); - }); - - // compute ( jelly ) - - const distance = basePosition.distance(currentPosition); - const force = elasticity.mul(distance).mul(basePosition.sub(currentPosition)); - - currentSpeed.addAssign(force); - currentSpeed.mulAssign(damping); - - currentPosition.addAssign(currentSpeed); - })() - .compute(count) - .setName('Update Jelly'); - - // initialize the storage buffer with the base position - - computeUpdate.onInit(() => renderer.compute(computeInit)); - - // - - return computeUpdate; -}); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(0, 0, 1); - - scene = new THREE.Scene(); - - raycaster = new THREE.Raycaster(); - pointer = new THREE.Vector2(); - - // background - - const bgColor = screenUV.y.mix(color(0x9f87f7), color(0xf2cdcd)); - const bgVignette = screenUV.distance(0.5).remapClamp(0.3, 0.8).oneMinus(); - const bgIntensity = 4; - - scene.backgroundNode = bgColor.mul(bgVignette.mul(color(0xa78ff6).mul(bgIntensity))); - - // model - - new GLTFLoader().load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - // create jelly effect material - - const material = new THREE.MeshNormalNodeMaterial(); - material.geometryNode = jelly(); - material.positionNode = attribute('storagePosition'); - - // apply the material to the mesh - - mesh = gltf.scene.children[0]; - mesh.scale.setScalar(0.1); - mesh.material = material; - scene.add(mesh); - }); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 0.7; - controls.maxDistance = 2; - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(elasticity, 'value', 0, 0.5).name('elasticity'); - gui.add(damping, 'value', 0.9, 0.98).name('damping'); - gui.add(brushSize, 'value', 0.1, 0.5).name('brush size'); - gui.add(brushStrength, 'value', 0.1, 0.3).name('brush strength'); - - window.addEventListener('resize', onWindowResize); - window.addEventListener('pointermove', onPointerMove); -} - -function onPointerMove(event) { - pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObject(scene); - - if (intersects.length > 0) { - const intersect = intersects[0]; - - pointerPosition.value.copy(intersect.point); - pointerPosition.value.w = 1; // enable - } else { - pointerPosition.value.w = 0; // disable - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_particles.ts b/examples-testing/examples/webgpu_compute_particles.ts deleted file mode 100644 index cc8b96417..000000000 --- a/examples-testing/examples/webgpu_compute_particles.ts +++ /dev/null @@ -1,226 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { Fn, If, uniform, float, uv, vec3, hash, shapeCircle, instancedArray, instanceIndex } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -const particleCount = 200000; - -const gravity = uniform(-0.00098); -const bounce = uniform(0.8); -const friction = uniform(0.99); -const size = uniform(0.12); - -const clickPosition = uniform(new THREE.Vector3()); - -let camera, scene, renderer; -let controls; -let computeParticles; - -let isOrbitControlsActive; - -init(); - -async function init() { - const { innerWidth, innerHeight } = window; - - camera = new THREE.PerspectiveCamera(50, innerWidth / innerHeight, 0.1, 1000); - camera.position.set(0, 5, 20); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - // - - const positions = instancedArray(particleCount, 'vec3'); - const velocities = instancedArray(particleCount, 'vec3'); - const colors = instancedArray(particleCount, 'vec3'); - - // compute - - const separation = 0.2; - const amount = Math.sqrt(particleCount); - const offset = float(amount / 2); - - const computeInit = Fn(() => { - const position = positions.element(instanceIndex); - const color = colors.element(instanceIndex); - - const x = instanceIndex.mod(amount); - const z = instanceIndex.div(amount); - - position.x = offset.sub(x).mul(separation); - position.z = offset.sub(z).mul(separation); - - color.x = hash(instanceIndex); - color.y = hash(instanceIndex.add(2)); - })() - .compute(particleCount) - .setName('Init Particles'); - - // - - const computeUpdate = Fn(() => { - const position = positions.element(instanceIndex); - const velocity = velocities.element(instanceIndex); - - velocity.addAssign(vec3(0.0, gravity, 0.0)); - position.addAssign(velocity); - - velocity.mulAssign(friction); - - // floor - - If(position.y.lessThan(0), () => { - position.y = 0; - velocity.y = velocity.y.negate().mul(bounce); - - // floor friction - - velocity.x = velocity.x.mul(0.9); - velocity.z = velocity.z.mul(0.9); - }); - }); - - computeParticles = computeUpdate().compute(particleCount).setName('Update Particles'); - - // create particles - - const material = new THREE.SpriteNodeMaterial(); - material.colorNode = uv().mul(colors.element(instanceIndex)); - material.positionNode = positions.toAttribute(); - material.scaleNode = size; - material.opacityNode = shapeCircle(); - material.alphaToCoverage = true; - material.transparent = true; - - const particles = new THREE.Sprite(material); - particles.count = particleCount; - particles.frustumCulled = false; - scene.add(particles); - - // - - const helper = new THREE.GridHelper(90, 45, 0x303030, 0x303030); - scene.add(helper); - - const geometry = new THREE.PlaneGeometry(200, 200); - geometry.rotateX(-Math.PI / 2); - - const plane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ visible: false })); - scene.add(plane); - - const raycaster = new THREE.Raycaster(); - const pointer = new THREE.Vector2(); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // - - renderer.compute(computeInit); - - // Hit - - const computeHit = Fn(() => { - const position = positions.element(instanceIndex); - const velocity = velocities.element(instanceIndex); - - const dist = position.distance(clickPosition); - const direction = position.sub(clickPosition).normalize(); - const distArea = float(3).sub(dist).max(0); - - const power = distArea.mul(0.01); - const relativePower = power.mul(hash(instanceIndex).mul(1.5).add(0.5)); - - velocity.assign(velocity.add(direction.mul(relativePower))); - })() - .compute(particleCount) - .setName('Hit Particles'); - - // - - function onMove(event) { - if (isOrbitControlsActive) return; - - pointer.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObject(plane, false); - - if (intersects.length > 0) { - const { point } = intersects[0]; - - // move to uniform - - clickPosition.value.copy(point); - clickPosition.value.y = -1; - - // compute - - renderer.compute(computeHit); - } - } - - renderer.domElement.addEventListener('pointermove', onMove); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 5; - controls.maxDistance = 200; - controls.target.set(0, -8, 0); - controls.update(); - - controls.addEventListener('start', () => { - isOrbitControlsActive = true; - }); - controls.addEventListener('end', () => { - isOrbitControlsActive = false; - }); - - controls.touches = { - ONE: null, - TWO: THREE.TOUCH.DOLLY_PAN, - }; - - // - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(gravity, 'value', -0.0098, 0, 0.0001).name('gravity'); - gui.add(bounce, 'value', 0.1, 1, 0.01).name('bounce'); - gui.add(friction, 'value', 0.96, 0.99, 0.01).name('friction'); - gui.add(size, 'value', 0.12, 0.5, 0.01).name('size'); -} - -function onWindowResize() { - const { innerWidth, innerHeight } = window; - - camera.aspect = innerWidth / innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(innerWidth, innerHeight); -} - -function animate() { - controls.update(); - - renderer.compute(computeParticles); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_particles_rain.ts b/examples-testing/examples/webgpu_compute_particles_rain.ts deleted file mode 100644 index 2ad22271b..000000000 --- a/examples-testing/examples/webgpu_compute_particles_rain.ts +++ /dev/null @@ -1,334 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - Fn, - texture, - uv, - uint, - instancedArray, - positionWorld, - billboarding, - time, - hash, - deltaTime, - vec2, - instanceIndex, - positionGeometry, - If, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; - -const maxParticleCount = 50000; -const instanceCount = maxParticleCount / 2; - -let camera, scene, renderer; -let controls; -let computeParticles; -let monkey; -let timer; - -let collisionBox, collisionCamera, collisionPosRT, collisionPosMaterial; -let collisionBoxPos, collisionBoxPosUI; - -init(); - -async function init() { - const { innerWidth, innerHeight } = window; - - camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 0.1, 110); - camera.position.set(40, 8, 0); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - const dirLight = new THREE.DirectionalLight(0xffffff, 0.5); - dirLight.position.set(3, 17, 17); - scene.add(dirLight); - - scene.add(new THREE.AmbientLight(0x111111)); - - // - - collisionCamera = new THREE.OrthographicCamera(-50, 50, 50, -50, 0.1, 50); - collisionCamera.position.y = 50; - collisionCamera.lookAt(0, 0, 0); - collisionCamera.layers.disableAll(); - collisionCamera.layers.enable(1); - - collisionPosRT = new THREE.RenderTarget(1024, 1024); - collisionPosRT.texture.type = THREE.HalfFloatType; - collisionPosRT.texture.magFilter = THREE.NearestFilter; - collisionPosRT.texture.minFilter = THREE.NearestFilter; - collisionPosRT.texture.generateMipmaps = false; - - collisionPosMaterial = new THREE.MeshBasicNodeMaterial(); - collisionPosMaterial.colorNode = positionWorld; - - // - - const positionBuffer = instancedArray(maxParticleCount, 'vec3'); - const velocityBuffer = instancedArray(maxParticleCount, 'vec3'); - const ripplePositionBuffer = instancedArray(maxParticleCount, 'vec3'); - const rippleTimeBuffer = instancedArray(maxParticleCount, 'vec3'); - - // compute - - const randUint = () => uint(Math.random() * 0xffffff); - - const computeInit = Fn(() => { - const position = positionBuffer.element(instanceIndex); - const velocity = velocityBuffer.element(instanceIndex); - const ripplePosition = ripplePositionBuffer.element(instanceIndex); - const rippleTime = rippleTimeBuffer.element(instanceIndex); - - const randX = hash(instanceIndex); - const randY = hash(instanceIndex.add(randUint())); - const randZ = hash(instanceIndex.add(randUint())); - - position.x = randX.mul(100).add(-50); - position.y = randY.mul(25); - position.z = randZ.mul(100).add(-50); - - velocity.y = randX.mul(-0.04).add(-0.2); - - ripplePosition.x = randZ.mul(100).add(-50); - ripplePosition.y = -1; - ripplePosition.z = randY.mul(100).add(-50); - - rippleTime.x = 1000; - })().compute(maxParticleCount); - - // - - const computeUpdate = Fn(() => { - const getCoord = pos => pos.add(50).div(100); - - const position = positionBuffer.element(instanceIndex); - const velocity = velocityBuffer.element(instanceIndex); - const ripplePosition = ripplePositionBuffer.element(instanceIndex); - const rippleTime = rippleTimeBuffer.element(instanceIndex); - - position.addAssign(velocity); - - rippleTime.x = rippleTime.x.add(deltaTime.mul(4)); - - // - - const collisionArea = texture(collisionPosRT.texture, getCoord(position.xz)); - - const surfaceOffset = 0.05; - - const floorPosition = collisionArea.y.add(surfaceOffset); - - // floor - - const ripplePivotOffsetY = -0.9; - - If(position.y.add(ripplePivotOffsetY).lessThan(floorPosition), () => { - position.y = 25; - - ripplePosition.xz = position.xz; - ripplePosition.y = floorPosition; - - // reset hit time: x = time - - rippleTime.x = 1; - - // next drops will not fall in the same place - - position.x = hash(instanceIndex.add(time)).mul(100).add(-50); - position.z = hash(instanceIndex.add(time.add(randUint()))) - .mul(100) - .add(-50); - }); - - const rippleOnSurface = texture(collisionPosRT.texture, getCoord(ripplePosition.xz)); - - const rippleFloorArea = rippleOnSurface.y.add(surfaceOffset); - - If(ripplePosition.y.greaterThan(rippleFloorArea), () => { - rippleTime.x = 1000; - }); - }); - - computeParticles = computeUpdate().compute(maxParticleCount).setName('Particles'); - - // rain - - const rainMaterial = new THREE.MeshBasicNodeMaterial(); - rainMaterial.colorNode = uv().distance(vec2(0.5, 0)).oneMinus().mul(3).exp().mul(0.1); - rainMaterial.positionNode = positionGeometry.add(positionBuffer.toAttribute()); - rainMaterial.vertexNode = billboarding({ horizontalRotation: true }); - rainMaterial.opacity = 0.2; - rainMaterial.depthWrite = false; - rainMaterial.depthTest = true; - rainMaterial.transparent = true; - - const rainParticles = new THREE.Mesh(new THREE.PlaneGeometry(0.1, 2), rainMaterial); - rainParticles.count = instanceCount; - scene.add(rainParticles); - - // ripple - - const rippleTime = rippleTimeBuffer.element(instanceIndex).x; - - const rippleEffect = Fn(() => { - const center = uv().add(vec2(-0.5)).length().mul(7); - const distance = rippleTime.sub(center); - - return distance.min(1).sub(distance.max(1).sub(1)); - }); - - const rippleMaterial = new THREE.MeshBasicNodeMaterial(); - rippleMaterial.colorNode = rippleEffect(); - rippleMaterial.positionNode = positionGeometry.add(ripplePositionBuffer.toAttribute()); - rippleMaterial.opacityNode = rippleTime.mul(0.3).oneMinus().max(0).mul(0.5); - rippleMaterial.side = THREE.DoubleSide; - rippleMaterial.forceSinglePass = true; - rippleMaterial.depthWrite = false; - rippleMaterial.depthTest = true; - rippleMaterial.transparent = true; - - // ripple geometry - - const surfaceRippleGeometry = new THREE.PlaneGeometry(2.5, 2.5); - surfaceRippleGeometry.rotateX(-Math.PI / 2); - - const xRippleGeometry = new THREE.PlaneGeometry(1, 2); - xRippleGeometry.rotateY(-Math.PI / 2); - - const zRippleGeometry = new THREE.PlaneGeometry(1, 2); - - const rippleGeometry = BufferGeometryUtils.mergeGeometries([ - surfaceRippleGeometry, - xRippleGeometry, - zRippleGeometry, - ]); - - const rippleParticles = new THREE.Mesh(rippleGeometry, rippleMaterial); - rippleParticles.count = instanceCount; - scene.add(rippleParticles); - - // floor geometry - - const floorGeometry = new THREE.PlaneGeometry(1000, 1000); - floorGeometry.rotateX(-Math.PI / 2); - - const plane = new THREE.Mesh(floorGeometry, new THREE.MeshBasicMaterial({ color: 0x050505 })); - scene.add(plane); - - // - - collisionBox = new THREE.Mesh(new THREE.BoxGeometry(30, 1, 15), new THREE.MeshStandardMaterial()); - collisionBox.material.color.set(0x333333); - collisionBox.position.y = 12; - collisionBox.scale.x = 3.5; - collisionBox.layers.enable(1); - scene.add(collisionBox); - - // - - const loader = new THREE.BufferGeometryLoader(); - loader.load('models/json/suzanne_buffergeometry.json', function (geometry) { - geometry.computeVertexNormals(); - - monkey = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial({ roughness: 1, metalness: 0 })); - monkey.scale.setScalar(5); - monkey.rotation.y = Math.PI / 2; - monkey.position.y = 4.5; - monkey.layers.enable(1); // add to collision layer - - scene.add(monkey); - }); - - // - - timer = new THREE.Timer(); - timer.connect(document); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // - - renderer.compute(computeInit); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 5; - controls.maxDistance = 50; - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - - // use lerp to smooth the movement - collisionBoxPosUI = new THREE.Vector3().copy(collisionBox.position); - collisionBoxPos = new THREE.Vector3(); - - gui.add(collisionBoxPosUI, 'z', -50, 50, 0.001).name('position'); - gui.add(collisionBox.scale, 'x', 0.1, 3.5, 0.01).name('scale'); - gui.add(rainParticles, 'count', 200, maxParticleCount, 1) - .name('drop count') - .onChange(v => (rippleParticles.count = v)); -} - -function onWindowResize() { - const { innerWidth, innerHeight } = window; - - camera.aspect = innerWidth / innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(innerWidth, innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (monkey) { - monkey.rotation.y += delta; - } - - collisionBoxPos.set(collisionBoxPosUI.x, collisionBoxPosUI.y, -collisionBoxPosUI.z); - - collisionBox.position.lerp(collisionBoxPos, 10 * delta); - - // position - - scene.overrideMaterial = collisionPosMaterial; - scene.name = 'Collision Scene'; - renderer.setRenderTarget(collisionPosRT); - renderer.render(scene, collisionCamera); - - // compute - - renderer.compute(computeParticles); - - // result - - scene.overrideMaterial = null; - scene.name = 'Scene'; - renderer.setRenderTarget(null); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_particles_snow.ts b/examples-testing/examples/webgpu_compute_particles_snow.ts deleted file mode 100644 index da365200c..000000000 --- a/examples-testing/examples/webgpu_compute_particles_snow.ts +++ /dev/null @@ -1,331 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - Fn, - texture, - vec3, - pass, - color, - uint, - screenUV, - instancedArray, - positionWorld, - positionLocal, - time, - vec2, - hash, - instanceIndex, - If, -} from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -const maxParticleCount = 100000; - -let camera, scene, renderer; -let controls; -let computeParticles; -let renderPipeline; - -let collisionCamera, collisionPosRT, collisionPosMaterial; - -init(); - -async function init() { - const { innerWidth, innerHeight } = window; - - camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 0.1, 100); - camera.position.set(20, 2, 20); - camera.layers.enable(2); - camera.lookAt(0, 40, 0); - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x0f3c37, 5, 40); - - const dirLight = new THREE.DirectionalLight(0xf9ff9b, 9); - dirLight.position.set(10, 10, 0); - scene.add(dirLight); - - scene.add(new THREE.HemisphereLight(0x0f3c37, 0x080d10, 100)); - - // - - collisionCamera = new THREE.OrthographicCamera(-50, 50, 50, -50, 0.1, 50); - collisionCamera.position.y = 50; - collisionCamera.lookAt(0, 0, 0); - collisionCamera.layers.enable(1); - - collisionPosRT = new THREE.RenderTarget(1024, 1024); - collisionPosRT.texture.format = THREE.RedFormat; - collisionPosRT.texture.type = THREE.HalfFloatType; - collisionPosRT.texture.magFilter = THREE.NearestFilter; - collisionPosRT.texture.minFilter = THREE.NearestFilter; - collisionPosRT.texture.generateMipmaps = false; - - collisionPosMaterial = new THREE.MeshBasicNodeMaterial(); - collisionPosMaterial.blending = THREE.NoBlending; - collisionPosMaterial.fog = false; - collisionPosMaterial.toneMapped = false; - collisionPosMaterial.colorNode = positionWorld.y; - - // - - const positionBuffer = instancedArray(maxParticleCount, 'vec3'); - const scaleBuffer = instancedArray(maxParticleCount, 'vec3'); - const staticPositionBuffer = instancedArray(maxParticleCount, 'vec3'); - const dataBuffer = instancedArray(maxParticleCount, 'vec4'); - - // compute - - const randUint = () => uint(Math.random() * 0xffffff); - - const computeInit = Fn(() => { - const position = positionBuffer.element(instanceIndex); - const scale = scaleBuffer.element(instanceIndex); - const particleData = dataBuffer.element(instanceIndex); - - const randX = hash(instanceIndex); - const randY = hash(instanceIndex.add(randUint())); - const randZ = hash(instanceIndex.add(randUint())); - - position.x = randX.mul(100).add(-50); - position.y = randY.mul(500).add(3); - position.z = randZ.mul(100).add(-50); - - scale.xyz = hash(instanceIndex.add(Math.random())).mul(0.8).add(0.2); - - staticPositionBuffer.element(instanceIndex).assign(vec3(1000, 10000, 1000)); - - particleData.y = randY.mul(-0.1).add(-0.02); - - particleData.x = position.x; - particleData.z = position.z; - particleData.w = randX; - })() - .compute(maxParticleCount) - .setName('Init Particles'); - - // - - const surfaceOffset = 0.2; - const speed = 0.4; - - const computeUpdate = Fn(() => { - const getCoord = pos => pos.add(50).div(100); - - const position = positionBuffer.element(instanceIndex); - const scale = scaleBuffer.element(instanceIndex); - const particleData = dataBuffer.element(instanceIndex); - - const velocity = particleData.y; - const random = particleData.w; - - const rippleOnSurface = texture(collisionPosRT.texture, getCoord(position.xz)).toInspector( - 'Collision Test', - () => { - return texture(collisionPosRT.texture); // .div( collisionCamera.position.y ); - }, - ); - - const rippleFloorArea = rippleOnSurface.add(scale.x.mul(surfaceOffset)); - - If(position.y.greaterThan(rippleFloorArea), () => { - position.x = particleData.x.add(time.mul(random.mul(random)).mul(speed).sin().mul(3)); - position.z = particleData.z.add(time.mul(random).mul(speed).cos().mul(random.mul(10))); - - position.y = position.y.add(velocity); - }).Else(() => { - staticPositionBuffer.element(instanceIndex).assign(position); - }); - }); - - computeParticles = computeUpdate().compute(maxParticleCount); - computeParticles.name = 'Update Particles'; - - // rain - - const geometry = new THREE.SphereGeometry(surfaceOffset, 5, 5); - - function particle(staticParticles) { - const posBuffer = staticParticles ? staticPositionBuffer : positionBuffer; - const layer = staticParticles ? 1 : 2; - - const staticMaterial = new THREE.MeshStandardNodeMaterial({ - color: 0xeeeeee, - roughness: 0.9, - metalness: 0, - }); - - staticMaterial.positionNode = positionLocal.mul(scaleBuffer.toAttribute()).add(posBuffer.toAttribute()); - - const rainParticles = new THREE.Mesh(geometry, staticMaterial); - rainParticles.count = maxParticleCount; - rainParticles.layers.disableAll(); - rainParticles.layers.enable(layer); - - return rainParticles; - } - - const dynamicParticles = particle(); - const staticParticles = particle(true); - - scene.add(dynamicParticles); - scene.add(staticParticles); - - // floor geometry - - const floorGeometry = new THREE.PlaneGeometry(100, 100); - floorGeometry.rotateX(-Math.PI / 2); - - const plane = new THREE.Mesh( - floorGeometry, - new THREE.MeshStandardMaterial({ - color: 0x0c1e1e, - roughness: 0.5, - metalness: 0, - transparent: true, - }), - ); - - plane.material.opacityNode = positionLocal.xz.mul(0.05).distance(0).saturate().oneMinus(); - - scene.add(plane); - - // tree - - function tree(count = 8) { - const coneMaterial = new THREE.MeshStandardNodeMaterial({ - color: 0x0d492c, - roughness: 0.6, - metalness: 0, - }); - - const object = new THREE.Group(); - - for (let i = 0; i < count; i++) { - const radius = 1 + i; - - const coneGeometry = new THREE.ConeGeometry(radius * 0.95, radius * 1.25, 32); - - const cone = new THREE.Mesh(coneGeometry, coneMaterial); - cone.position.y = (count - i) * 1.5 + count * 0.6; - object.add(cone); - } - - const geometry = new THREE.CylinderGeometry(1, 1, count, 32); - const cone = new THREE.Mesh(geometry, coneMaterial); - cone.position.y = count / 2; - object.add(cone); - - return object; - } - - const teapotTree = new THREE.Mesh( - new TeapotGeometry(0.5, 18), - new THREE.MeshBasicNodeMaterial({ - color: 0xfcfb9e, - }), - ); - - teapotTree.name = 'Teapot Pass'; - teapotTree.position.y = 18; - - scene.add(tree()); - scene.add(teapotTree); - - // - - scene.backgroundNode = screenUV.distance(0.5).mul(2).mix(color(0x0f4140), color(0x060a0d)); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setClearColor(0x000000); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 10, 0); - controls.minDistance = 25; - controls.maxDistance = 35; - controls.maxPolarAngle = Math.PI / 1.7; - controls.autoRotate = true; - controls.autoRotateSpeed = -0.7; - controls.update(); - - // post processing - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode(); - const vignette = screenUV.distance(0.5).mul(1.35).clamp().oneMinus(); - - const teapotTreePass = pass(teapotTree, camera).getTextureNode(); - const teapotTreePassBlurred = gaussianBlur(teapotTreePass, vec2(1), 6); - teapotTreePassBlurred.resolutionScale = 0.2; - - const scenePassColorBlurred = gaussianBlur(scenePassColor); - scenePassColorBlurred.resolutionScale = 0.5; - scenePassColorBlurred.directionNode = vec2(1); - - // compose - - let totalPass = scenePass.toInspector('Scene'); - totalPass = totalPass.add(scenePassColorBlurred.mul(0.1)); - totalPass = totalPass.mul(vignette); - totalPass = totalPass.add(teapotTreePass.mul(10).add(teapotTreePassBlurred).toInspector('Teapot Blur')); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = totalPass; - - // - - renderer.compute(computeInit); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const { innerWidth, innerHeight } = window; - - camera.aspect = innerWidth / innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(innerWidth, innerHeight); -} - -function animate() { - controls.update(); - - // position - - scene.name = 'Collider Position'; - scene.overrideMaterial = collisionPosMaterial; - renderer.setRenderTarget(collisionPosRT); - renderer.render(scene, collisionCamera); - - // compute - - renderer.compute(computeParticles); - - // result - - scene.name = 'Scene'; - scene.overrideMaterial = null; - renderer.setRenderTarget(null); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_compute_points.ts b/examples-testing/examples/webgpu_compute_points.ts deleted file mode 100644 index eab1d9f61..000000000 --- a/examples-testing/examples/webgpu_compute_points.ts +++ /dev/null @@ -1,124 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { Fn, uniform, instancedArray, float, vec2, color, instanceIndex } from 'three/tsl'; - -let camera, scene, renderer; -let computeNode; - -const pointerVector = new THREE.Vector2(-10.0, -10.0); // Out of bounds first -const scaleVector = new THREE.Vector2(1, 1); - -init(); - -async function init() { - camera = new THREE.OrthographicCamera(-1.0, 1.0, 1.0, -1.0, 0, 1); - camera.position.z = 1; - - scene = new THREE.Scene(); - - // initialize particles - - const particlesCount = 300000; - - const particleArray = instancedArray(particlesCount, 'vec2'); - const velocityArray = instancedArray(particlesCount, 'vec2'); - - // create function - - const computeShaderFn = Fn(() => { - const particle = particleArray.element(instanceIndex); - const velocity = velocityArray.element(instanceIndex); - - const pointer = uniform(pointerVector); - const limit = uniform(scaleVector); - - const position = particle.add(velocity).toVar(); - - velocity.x = position.x.abs().greaterThanEqual(limit.x).select(velocity.x.negate(), velocity.x); - velocity.y = position.y.abs().greaterThanEqual(limit.y).select(velocity.y.negate(), velocity.y); - - position.assign(position.min(limit).max(limit.negate())); - - const pointerSize = 0.1; - const distanceFromPointer = pointer.sub(position).length(); - - particle.assign(distanceFromPointer.lessThanEqual(pointerSize).select(vec2(), position)); - }); - - // compute - - computeNode = computeShaderFn().compute(particlesCount).setName('Update Particles'); - computeNode.onInit(({ renderer }) => { - const precomputeShaderNode = Fn(() => { - const particleIndex = float(instanceIndex); - - const randomAngle = particleIndex.mul(0.005).mul(Math.PI * 2); - const randomSpeed = particleIndex.mul(0.00000001).add(0.0000001); - - const velX = randomAngle.sin().mul(randomSpeed); - const velY = randomAngle.cos().mul(randomSpeed); - - const velocity = velocityArray.element(instanceIndex); - - velocity.xy = vec2(velX, velY); - }); - - renderer.compute(precomputeShaderNode().compute(particlesCount)); - }); - - // use a compute shader to animate the point cloud's vertex data. - - const pointsGeometry = new THREE.BufferGeometry(); - pointsGeometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(3), 3)); // single vertex ( not triangle ) - pointsGeometry.drawRange.count = 1; // force render points as instances ( not triangle ) - - const pointsMaterial = new THREE.PointsNodeMaterial(); - pointsMaterial.colorNode = particleArray.element(instanceIndex).add(color(0xffffff)); - pointsMaterial.positionNode = particleArray.element(instanceIndex); - - const mesh = new THREE.Points(pointsGeometry, pointsMaterial); - mesh.count = particlesCount; - scene.add(mesh); - - renderer = new THREE.WebGPURenderer({ antialias: true, requiredLimits: { maxStorageBuffersInVertexStage: 1 } }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - window.addEventListener('resize', onWindowResize); - window.addEventListener('mousemove', onMouseMove); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(scaleVector, 'x', 0, 1, 0.01); - gui.add(scaleVector, 'y', 0, 1, 0.01); -} - -function onWindowResize() { - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onMouseMove(event) { - const x = event.clientX; - const y = event.clientY; - - const width = window.innerWidth; - const height = window.innerHeight; - - pointerVector.set((x / width - 0.5) * 2.0, (-y / height + 0.5) * 2.0); -} - -function animate() { - renderer.compute(computeNode); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_sort_bitonic.ts b/examples-testing/examples/webgpu_compute_sort_bitonic.ts deleted file mode 100644 index 9a37a9ece..000000000 --- a/examples-testing/examples/webgpu_compute_sort_bitonic.ts +++ /dev/null @@ -1,457 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { storage, If, vec3, not, uniform, uv, uint, Fn, vec2, abs, int, uvec2, floor, instanceIndex } from 'three/tsl'; - -import { BitonicSort, getBitonicDisperseIndices, getBitonicFlipIndices } from 'three/addons/gpgpu/BitonicSort.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -const StepType = { - NONE: 0, - // Swap values within workgroup local values - SWAP_LOCAL: 1, - DISPERSE_LOCAL: 2, - // Swap values within global data buffer. - FLIP_GLOBAL: 3, - DISPERSE_GLOBAL: 4, -}; - -const timestamps = { - local_swap: document.getElementById('local_swap'), - global_swap: document.getElementById('global_swap'), -}; - -const localColors = ['rgb(203, 64, 203)', 'rgb(0, 215, 215)']; -const globalColors = ['rgb(1, 150, 1)', 'red']; - -// Total number of elements and the dimensions of the display grid. -const size = 16384; -const gridDim = Math.sqrt(size); - -const getNumSteps = () => { - const n = Math.log2(size); - return (n * (n + 1)) / 2; -}; - -// Total number of steps in a bitonic sort with 'size' elements. -const MAX_STEPS = getNumSteps(); - -const effectController = { - // Sqr root of 16834 - gridWidth: uniform(gridDim), - gridHeight: uniform(gridDim), - highlight: uniform(1), - stepBitonic: true, - 'Display Mode': 'Swap Zone Highlight', -}; - -const gui = new GUI(); -gui.add(effectController, 'Display Mode', ['Elements', 'Swap Zone Highlight']).onChange(() => { - if (effectController['Display Mode'] === 'Elements') { - effectController.highlight.value = 0; - } else { - effectController.highlight.value = 1; - } -}); - -if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); -} - -// Display utilities - -const getElementIndex = Fn( - ([uvNode, gridWidth, gridHeight]) => { - const newUV = uvNode.mul(vec2(gridWidth, gridHeight)); - const pixel = uvec2(uint(floor(newUV.x)), uint(floor(newUV.y))); - const elementIndex = uint(gridWidth).mul(pixel.y).add(pixel.x); - - return elementIndex; - }, - { - uvNode: 'vec2', - gridWidth: 'uint', - gridHeight: 'uint', - return: 'uint', - }, -); - -const getColor = Fn( - ([colorChanger, gridWidth, gridHeight]) => { - const subtracter = colorChanger.div(gridWidth.mul(gridHeight)); - return vec3(subtracter.oneMinus()).toVar(); - }, - { - colorChanger: 'float', - gridWidth: 'float', - gridHeight: 'float', - return: 'vec3', - }, -); - -const randomizeDataArray = array => { - let currentIndex = array.length; - while (currentIndex !== 0) { - const randomIndex = Math.floor(Math.random() * currentIndex); - currentIndex -= 1; - [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; - } -}; - -const windowResizeCallback = (renderer, scene, camera) => { - renderer.setSize(window.innerWidth / 2, window.innerHeight); - const aspect = window.innerWidth / 2 / window.innerHeight; - const frustumHeight = camera.top - camera.bottom; - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - camera.updateProjectionMatrix(); - renderer.render(scene, camera); -}; - -const constructInnerHTML = (isGlobal, colorsArr) => { - return ` - - Compute ${isGlobal ? 'Global' : 'Local'}: -
- ${isGlobal ? 'Global Swaps' : 'Local Swaps'} Compare Region  -
-  to Region  -
-
`; -}; - -const createDisplayMesh = (elementsStorage, algoStorage = null, blockHeightStorage = null) => { - const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); - - const display = Fn(() => { - const { gridWidth, gridHeight, highlight } = effectController; - - const elementIndex = getElementIndex(uv(), gridWidth, gridHeight); - const color = getColor(elementsStorage.element(elementIndex), gridWidth, gridHeight).toVar(); - - if (algoStorage !== null && blockHeightStorage !== null) { - If(highlight.equal(1).and(not(algoStorage.element(0).equal(StepType.NONE))), () => { - const boolCheck = int( - elementIndex.mod(blockHeightStorage.element(0)).lessThan(blockHeightStorage.element(0).div(2)), - ); - color.z.assign(algoStorage.element(0).lessThanEqual(StepType.DISPERSE_LOCAL)); - color.x.mulAssign(boolCheck); - color.y.mulAssign(abs(boolCheck.sub(1))); - }); - } - - return color; - }); - - material.colorNode = display(); - const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - return plane; -}; - -const createDisplayMesh2 = (elementsStorage, infoStorage) => { - const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); - - const display = Fn(() => { - const { gridWidth, gridHeight, highlight } = effectController; - - const elementIndex = getElementIndex(uv(), gridWidth, gridHeight); - const color = getColor(elementsStorage.element(elementIndex), gridWidth, gridHeight).toVar(); - - If(highlight.equal(1).and(not(infoStorage.element(0).equal(StepType.SWAP_LOCAL))), () => { - const boolCheck = int(elementIndex.mod(infoStorage.element(1)).lessThan(infoStorage.element(1).div(2))); - color.z.assign(infoStorage.element(0).lessThanEqual(StepType.DISPERSE_LOCAL)); - color.x.mulAssign(boolCheck); - color.y.mulAssign(abs(boolCheck.sub(1))); - }); - - return color; - }); - - material.colorNode = display(); - const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - return plane; -}; - -const setupDomElement = renderer => { - document.body.appendChild(renderer.domElement); - renderer.domElement.style.position = 'absolute'; - renderer.domElement.style.top = '0'; - renderer.domElement.style.left = '0'; - renderer.domElement.style.width = '50%'; - renderer.domElement.style.height = '100%'; -}; - -async function initBitonicSort() { - let currentStep = 0; - - const aspect = window.innerWidth / 2 / window.innerHeight; - const camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); - camera.position.z = 1; - - const scene = new THREE.Scene(); - - const array = new Uint32Array( - Array.from({ length: size }, (_, i) => { - return i; - }), - ); - - randomizeDataArray(array); - - const currentElementsBuffer = new THREE.StorageInstancedBufferAttribute(array, 1); - const currentElementsStorage = storage(currentElementsBuffer, 'uint', size).setPBO(true).setName('Elements'); - const randomizedElementsBuffer = new THREE.StorageInstancedBufferAttribute(size, 1); - const randomizedElementsStorage = storage(randomizedElementsBuffer, 'uint', size) - .setPBO(true) - .setName('RandomizedElements'); - - const computeInitFn = Fn(() => { - randomizedElementsStorage.element(instanceIndex).assign(currentElementsStorage.element(instanceIndex)); - }); - - const computeResetBuffersFn = Fn(() => { - currentElementsStorage.element(instanceIndex).assign(randomizedElementsStorage.element(instanceIndex)); - }); - - const renderer = new THREE.WebGPURenderer({ antialias: false }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth / 2, window.innerHeight); - - await renderer.init(); - - const animate = () => { - renderer.render(scene, camera); - }; - - renderer.setAnimationLoop(animate); - setupDomElement(renderer); - scene.background = new THREE.Color(0x313131); - - const bitonicSortModule = new BitonicSort(renderer, currentElementsStorage, { - workgroupSize: 64, - }); - - scene.add(createDisplayMesh2(currentElementsStorage, bitonicSortModule.infoStorage)); - - // Initialize each value in the elements buffer. - const computeInit = computeInitFn().compute(size); - const computeReset = computeResetBuffersFn().compute(size); - - renderer.compute(computeInit); - - const stepAnimation = async function () { - renderer.info.reset(); - - if (currentStep < bitonicSortModule.stepCount) { - bitonicSortModule.computeStep(renderer); - - currentStep++; - } else { - renderer.compute(computeReset); - - currentStep = 0; - } - - timestamps['local_swap'].innerHTML = constructInnerHTML(false, localColors); - - if (currentStep === bitonicSortModule.stepCount) { - setTimeout(stepAnimation, 1000); - } else { - setTimeout(stepAnimation, 100); - } - }; - - stepAnimation(); - - window.addEventListener('resize', onWindowResize); - - function onWindowResize() { - windowResizeCallback(renderer, scene, camera); - } -} - -initBitonicSort(); - -// Global Swaps Only -initGlobalSwapOnly(); - -// When forceGlobalSwap is true, force all valid local swaps to be global swaps. -async function initGlobalSwapOnly() { - let currentStep = 0; - - const aspect = window.innerWidth / 2 / window.innerHeight; - const camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); - camera.position.z = 1; - - const scene = new THREE.Scene(); - - const infoArray = new Uint32Array([3, 2, 2]); - const infoBuffer = new THREE.StorageInstancedBufferAttribute(infoArray, 1); - const infoStorage = storage(infoBuffer, 'uint', infoBuffer.count).setPBO(true).setName('TheInfo'); - - const nextBlockHeightBuffer = new THREE.StorageInstancedBufferAttribute(new Uint32Array(1).fill(2), 1); - const nextBlockHeightStorage = storage(nextBlockHeightBuffer, 'uint', nextBlockHeightBuffer.count) - .setPBO(true) - .setName('NextBlockHeight'); - const nextBlockHeightRead = storage(nextBlockHeightBuffer, 'uint', nextBlockHeightBuffer.count) - .setPBO(true) - .setName('NextBlockHeight') - .toReadOnly(); - - const array = new Uint32Array( - Array.from({ length: size }, (_, i) => { - return i; - }), - ); - - randomizeDataArray(array); - - const currentElementsBuffer = new THREE.StorageInstancedBufferAttribute(array, 1); - const currentElementsStorage = storage(currentElementsBuffer, 'uint', size).setPBO(true).setName('Elements'); - const tempBuffer = new THREE.StorageInstancedBufferAttribute(array, 1); - const tempStorage = storage(tempBuffer, 'uint', size).setPBO(true).setName('Temp'); - const randomizedElementsBuffer = new THREE.StorageInstancedBufferAttribute(size, 1); - const randomizedElementsStorage = storage(randomizedElementsBuffer, 'uint', size) - .setPBO(true) - .setName('RandomizedElements'); - - // Swap the elements in local storage - const globalCompareAndSwap = (idxBefore, idxAfter) => { - // If the later element is less than the current element - If(currentElementsStorage.element(idxAfter).lessThan(currentElementsStorage.element(idxBefore)), () => { - // Apply the swapped values to temporary storage. - tempStorage.element(idxBefore).assign(currentElementsStorage.element(idxAfter)); - tempStorage.element(idxAfter).assign(currentElementsStorage.element(idxBefore)); - }).Else(() => { - // Otherwise apply the existing values to temporary storage. - tempStorage.element(idxBefore).assign(currentElementsStorage.element(idxBefore)); - tempStorage.element(idxAfter).assign(currentElementsStorage.element(idxAfter)); - }); - }; - - const computeInitFn = Fn(() => { - randomizedElementsStorage.element(instanceIndex).assign(currentElementsStorage.element(instanceIndex)); - }); - - const computeBitonicStepFn = Fn(() => { - const nextBlockHeight = nextBlockHeightStorage.element(0).toVar(); - const nextAlgo = infoStorage.element(0).toVar(); - - // TODO: Convert to switch block. - If(nextAlgo.equal(uint(StepType.FLIP_GLOBAL)), () => { - const idx = getBitonicFlipIndices(instanceIndex, nextBlockHeight); - globalCompareAndSwap(idx.x, idx.y); - }).ElseIf(nextAlgo.equal(uint(StepType.DISPERSE_GLOBAL)), () => { - const idx = getBitonicDisperseIndices(instanceIndex, nextBlockHeight); - globalCompareAndSwap(idx.x, idx.y); - }); - - // Since this algorithm is global only, we execute an additional compute step to sync the current buffer with the output buffer. - }); - - const computeSetAlgoFn = Fn(() => { - const nextBlockHeight = nextBlockHeightStorage.element(0).toVar(); - const nextAlgo = infoStorage.element(0); - const highestBlockHeight = infoStorage.element(2).toVar(); - - nextBlockHeight.divAssign(2); - - If(nextBlockHeight.equal(1), () => { - highestBlockHeight.mulAssign(2); - - If(highestBlockHeight.equal(size * 2), () => { - nextAlgo.assign(StepType.NONE); - nextBlockHeight.assign(0); - }).Else(() => { - nextAlgo.assign(StepType.FLIP_GLOBAL); - nextBlockHeight.assign(highestBlockHeight); - }); - }).Else(() => { - nextAlgo.assign(StepType.DISPERSE_GLOBAL); - }); - - nextBlockHeightStorage.element(0).assign(nextBlockHeight); - infoStorage.element(2).assign(highestBlockHeight); - }); - - const computeAlignCurrentFn = Fn(() => { - currentElementsStorage.element(instanceIndex).assign(tempStorage.element(instanceIndex)); - }); - - const computeResetBuffersFn = Fn(() => { - currentElementsStorage.element(instanceIndex).assign(randomizedElementsStorage.element(instanceIndex)); - }); - - const computeResetAlgoFn = Fn(() => { - infoStorage.element(0).assign(StepType.FLIP_GLOBAL); - nextBlockHeightStorage.element(0).assign(2); - infoStorage.element(2).assign(2); - }); - - // Initialize each value in the elements buffer. - const computeInit = computeInitFn().compute(size); - // Swap a pair of elements in the elements buffer. - const computeBitonicStep = computeBitonicStepFn().compute(size / 2); - // Set the conditions for the next swap. - const computeSetAlgo = computeSetAlgoFn().compute(1); - // Align the current buffer with the temp buffer if the previous sort was executed in a global scope. - const computeAlignCurrent = computeAlignCurrentFn().compute(size); - // Reset the buffers and algorithm information after a full bitonic sort has been completed. - const computeResetBuffers = computeResetBuffersFn().compute(size); - const computeResetAlgo = computeResetAlgoFn().compute(1); - - scene.add(createDisplayMesh(currentElementsStorage, infoStorage, nextBlockHeightRead)); - - const renderer = new THREE.WebGPURenderer({ antialias: false }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth / 2, window.innerHeight); - - await renderer.init(); - - const animate = () => { - renderer.render(scene, camera); - }; - - renderer.setAnimationLoop(animate); - setupDomElement(renderer); - renderer.domElement.style.left = '50%'; - scene.background = new THREE.Color(0x212121); - - renderer.compute(computeInit); - - const stepAnimation = async function () { - if (currentStep !== MAX_STEPS) { - renderer.compute(computeBitonicStep); - - renderer.compute(computeAlignCurrent); - - renderer.compute(computeSetAlgo); - - currentStep++; - } else { - renderer.compute(computeResetBuffers); - renderer.compute(computeResetAlgo); - - currentStep = 0; - } - - timestamps['global_swap'].innerHTML = constructInnerHTML(true, globalColors); - - if (currentStep === MAX_STEPS) { - setTimeout(stepAnimation, 1000); - } else { - setTimeout(stepAnimation, 100); - } - }; - - stepAnimation(); - - window.addEventListener('resize', onWindowResize); - - function onWindowResize() { - windowResizeCallback(renderer, scene, camera); - } -} diff --git a/examples-testing/examples/webgpu_compute_texture.ts b/examples-testing/examples/webgpu_compute_texture.ts deleted file mode 100644 index 43d162ab5..000000000 --- a/examples-testing/examples/webgpu_compute_texture.ts +++ /dev/null @@ -1,96 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture, textureStore, Fn, instanceIndex, float, uvec2, vec4 } from 'three/tsl'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let camera, scene, renderer; - -init().then(render); - -async function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); - camera.position.z = 1; - - scene = new THREE.Scene(); - - // texture - - const width = 512, - height = 512; - - const storageTexture = new THREE.StorageTexture(width, height); - //storageTexture.minFilter = THREE.LinearMipMapLinearFilter; - - // create function - - const computeTexture = Fn(({ storageTexture }) => { - const posX = instanceIndex.mod(width); - const posY = instanceIndex.div(width); - const indexUV = uvec2(posX, posY); - - // https://www.shadertoy.com/view/Xst3zN - - const x = float(posX).div(50.0); - const y = float(posY).div(50.0); - - const v1 = x.sin(); - const v2 = y.sin(); - const v3 = x.add(y).sin(); - const v4 = x.mul(x).add(y.mul(y)).sqrt().add(5.0).sin(); - const v = v1.add(v2, v3, v4); - - const r = v.sin(); - const g = v.add(Math.PI).sin(); - const b = v.add(Math.PI).sub(0.5).sin(); - - textureStore(storageTexture, indexUV, vec4(r, g, b, 1)).toWriteOnly(); - }); - - // compute - - const computeNode = computeTexture({ storageTexture }).compute(width * height); - - const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); - material.colorNode = texture(storageTexture); - - const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - scene.add(plane); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // compute texture - renderer.compute(computeNode); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - const aspect = window.innerWidth / window.innerHeight; - - const frustumHeight = camera.top - camera.bottom; - - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - - camera.updateProjectionMatrix(); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_texture_3d.ts b/examples-testing/examples/webgpu_compute_texture_3d.ts deleted file mode 100644 index ccdfba0be..000000000 --- a/examples-testing/examples/webgpu_compute_texture_3d.ts +++ /dev/null @@ -1,193 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - time, - mx_noise_vec3, - instanceIndex, - textureStore, - float, - vec3, - vec4, - If, - Break, - Fn, - smoothstep, - texture3D, - uniform, -} from 'three/tsl'; - -import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let renderer, scene, camera; -let mesh; -let computeNode; - -if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); -} - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 1, 1.5); - - new OrbitControls(camera, renderer.domElement); - - // Sky - - const canvas = document.createElement('canvas'); - canvas.width = 1; - canvas.height = 32; - - const context = canvas.getContext('2d'); - const gradient = context.createLinearGradient(0, 0, 0, 32); - gradient.addColorStop(0.0, '#014a84'); - gradient.addColorStop(0.5, '#0561a0'); - gradient.addColorStop(1.0, '#437ab6'); - context.fillStyle = gradient; - context.fillRect(0, 0, 1, 32); - - const skyMap = new THREE.CanvasTexture(canvas); - skyMap.colorSpace = THREE.SRGBColorSpace; - - const sky = new THREE.Mesh( - new THREE.SphereGeometry(10), - new THREE.MeshBasicNodeMaterial({ map: skyMap, side: THREE.BackSide }), - ); - scene.add(sky); - - // Texture - - const size = 200; - - const computeCloud = Fn(({ storageTexture }) => { - const scale = float(0.05); - const id = instanceIndex; - - const x = id.mod(size); - const y = id.div(size).mod(size); - const z = id.div(size * size); - - const coord3d = vec3(x, y, z); - const centered = coord3d.sub(size / 2).div(size); - const d = float(1.0).sub(centered.length()); - - const noiseCoord = coord3d.mul(scale.div(1.5)).add(time); - - const noise = mx_noise_vec3(noiseCoord).toConst('noise'); - - const data = noise.mul(d).mul(d).toConst('data'); - - textureStore(storageTexture, vec3(x, y, z), vec4(vec3(data.x), 1.0)); - }); - - const storageTexture = new THREE.Storage3DTexture(size, size, size); - storageTexture.generateMipmaps = false; - storageTexture.name = 'cloud'; - - computeNode = computeCloud({ storageTexture }) - .compute(size * size * size) - .setName('computeCloud'); - - // Shader - - const transparentRaymarchingTexture = Fn( - ({ texture, range = float(0.14), threshold = float(0.08), opacity = float(0.18), steps = float(100) }) => { - const finalColor = vec4(0).toVar(); - - RaymarchingBox(steps, ({ positionRay }) => { - const mapValue = float(texture.sample(positionRay.add(0.5)).r).toVar(); - - mapValue.assign(smoothstep(threshold.sub(range), threshold.add(range), mapValue).mul(opacity)); - - const shading = texture - .sample(positionRay.add(vec3(-0.01))) - .r.sub(texture.sample(positionRay.add(vec3(0.01))).r); - - const col = shading.mul(4.0).add(positionRay.x.add(positionRay.y).mul(0.5)).add(0.3); - - finalColor.rgb.addAssign(finalColor.a.oneMinus().mul(mapValue).mul(col)); - - finalColor.a.addAssign(finalColor.a.oneMinus().mul(mapValue)); - - If(finalColor.a.greaterThanEqual(0.95), () => { - Break(); - }); - }); - - return finalColor; - }, - ); - - // Material - - const baseColor = uniform(new THREE.Color(0x798aa0)); - const range = uniform(0.1); - const threshold = uniform(0.08); - const opacity = uniform(0.08); - const steps = uniform(100); - - const cloud3d = transparentRaymarchingTexture({ - texture: texture3D(storageTexture, null, 0), - range, - threshold, - opacity, - steps, - }); - - const finalCloud = cloud3d.setRGB(cloud3d.rgb.add(baseColor)); - - const material = new THREE.NodeMaterial(); - material.colorNode = finalCloud; - material.side = THREE.BackSide; - material.transparent = true; - material.name = 'transparentRaymarchingMaterial'; - - mesh = new THREE.Mesh(new THREE.BoxGeometry(10, 10, 10), material); - scene.add(mesh); - - mesh.rotation.y = Math.PI / 2; - - // - - renderer.compute(computeNode); - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(threshold, 'value', 0, 1, 0.01).name('threshold'); - gui.add(opacity, 'value', 0, 1, 0.01).name('opacity'); - gui.add(range, 'value', 0, 1, 0.01).name('range'); - gui.add(steps, 'value', 0, 200, 1).name('steps'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.compute(computeNode); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_compute_texture_pingpong.ts b/examples-testing/examples/webgpu_compute_texture_pingpong.ts deleted file mode 100644 index 5c411fa69..000000000 --- a/examples-testing/examples/webgpu_compute_texture_pingpong.ts +++ /dev/null @@ -1,170 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - storageTexture, - textureStore, - Fn, - instanceIndex, - uniform, - float, - vec2, - vec4, - uvec2, - ivec2, - int, - NodeAccess, -} from 'three/tsl'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let camera, scene, renderer; -let computeInitNode, computeToPing, computeToPong; -let pingTexture, pongTexture; -let material; -let phase = true; -let lastUpdate = -1; - -const width = 512, - height = 512; - -const seed = uniform(new THREE.Vector2()); - -init(); - -async function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); - camera.position.z = 1; - - scene = new THREE.Scene(); - - // texture - - const hdr = true; - - pingTexture = new THREE.StorageTexture(width, height); - pongTexture = new THREE.StorageTexture(width, height); - - if (hdr) { - pingTexture.type = THREE.HalfFloatType; - pongTexture.type = THREE.HalfFloatType; - } - - const rand2 = Fn(([n]) => { - return n.dot(vec2(12.9898, 4.1414)).sin().mul(43758.5453).fract(); - }); - - // Create storage texture nodes with proper access - const writePing = storageTexture(pingTexture).setAccess(NodeAccess.WRITE_ONLY); - const readPing = storageTexture(pingTexture).setAccess(NodeAccess.READ_ONLY); - const writePong = storageTexture(pongTexture).setAccess(NodeAccess.WRITE_ONLY); - const readPong = storageTexture(pongTexture).setAccess(NodeAccess.READ_ONLY); - - const computeInit = Fn(() => { - const posX = instanceIndex.mod(width); - const posY = instanceIndex.div(width); - const indexUV = uvec2(posX, posY); - const uv = vec2(float(posX).div(width), float(posY).div(height)); - - const r = rand2(uv.add(seed.mul(100))).sub(rand2(uv.add(seed.mul(300)))); - const g = rand2(uv.add(seed.mul(200))).sub(rand2(uv.add(seed.mul(300)))); - const b = rand2(uv.add(seed.mul(200))).sub(rand2(uv.add(seed.mul(100)))); - - textureStore(writePing, indexUV, vec4(r, g, b, 1)); - }); - - computeInitNode = computeInit().compute(width * height); - - // compute ping-pong: blur function using .load() for textureLoad - const blur = Fn(([readTex, uv]) => { - const c0 = readTex.load(uv.add(ivec2(-1, 1))); - const c1 = readTex.load(uv.add(ivec2(-1, -1))); - const c2 = readTex.load(uv.add(ivec2(0, 0))); - const c3 = readTex.load(uv.add(ivec2(1, -1))); - const c4 = readTex.load(uv.add(ivec2(1, 1))); - - return c0.add(c1).add(c2).add(c3).add(c4).div(5.0); - }); - - // compute loop: read from one texture, blur, write to another - const computePingPong = Fn(([readTex, writeTex]) => { - const posX = instanceIndex.mod(width); - const posY = instanceIndex.div(width); - const indexUV = ivec2(int(posX), int(posY)); - - const color = blur(readTex, indexUV); - - textureStore(writeTex, indexUV, vec4(color.rgb.mul(1.05), 1)); - }); - - computeToPong = computePingPong(readPing, writePong).compute(width * height); - computeToPing = computePingPong(readPong, writePing).compute(width * height); - - // - - material = new THREE.MeshBasicMaterial({ color: 0xffffff, map: pongTexture }); - - const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - scene.add(plane); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - window.addEventListener('resize', onWindowResize); - - // compute init - - renderer.compute(computeInitNode); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - const aspect = window.innerWidth / window.innerHeight; - - const frustumHeight = camera.top - camera.bottom; - - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - - camera.updateProjectionMatrix(); -} - -function render() { - const time = performance.now(); - const seconds = Math.floor(time / 1000); - - // reset every second - - if (phase && seconds !== lastUpdate) { - seed.value.set(Math.random(), Math.random()); - - renderer.compute(computeInitNode); - - lastUpdate = seconds; - } - - // compute step - - renderer.compute(phase ? computeToPong : computeToPing); - - material.map = phase ? pongTexture : pingTexture; - - phase = !phase; - - // render step - - // update material texture node - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_cubemap_adjustments.ts b/examples-testing/examples/webgpu_cubemap_adjustments.ts deleted file mode 100644 index 2e886d824..000000000 --- a/examples-testing/examples/webgpu_cubemap_adjustments.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - uniform, - mix, - pmremTexture, - reference, - positionLocal, - hue, - saturation, - positionWorld, - normalWorld, - positionWorldDirection, - reflectVector, -} from 'three/tsl'; - -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - const initialDistance = 2; - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8 * initialDistance, 0.6 * initialDistance, 2.7 * initialDistance); - - scene = new THREE.Scene(); - - // HDR textures - - const hdr1Texture = await new HDRLoader().loadAsync('./textures/equirectangular/pedestrian_overpass_1k.hdr'); - - hdr1Texture.mapping = THREE.EquirectangularReflectionMapping; - hdr1Texture.generateMipmaps = true; - hdr1Texture.minFilter = THREE.LinearMipmapLinearFilter; - - const hdr2Texture = await new HDRLoader().loadAsync('./textures/equirectangular/752-hdri-skies-com_1k.hdr'); - - hdr2Texture.mapping = THREE.EquirectangularReflectionMapping; - hdr2Texture.generateMipmaps = true; - hdr2Texture.minFilter = THREE.LinearMipmapLinearFilter; - - // nodes and environment - - const adjustments = { - mix: 0, - procedural: 0, - intensity: 1, - hue: 0, - saturation: 1, - }; - - const mixNode = reference('mix', 'float', adjustments); - const proceduralNode = reference('procedural', 'float', adjustments); - const intensityNode = reference('intensity', 'float', adjustments); - const hueNode = reference('hue', 'float', adjustments); - const saturationNode = reference('saturation', 'float', adjustments); - - const rotateY1Matrix = new THREE.Matrix4(); - const rotateY2Matrix = new THREE.Matrix4(); - - const getEnvironmentNode = (reflectNode, positionNode) => { - const custom1UV = reflectNode.xyz.mul(uniform(rotateY1Matrix)); - const custom2UV = reflectNode.xyz.mul(uniform(rotateY2Matrix)); - const mixCubeMaps = mix( - pmremTexture(hdr1Texture, custom1UV), - pmremTexture(hdr2Texture, custom2UV), - positionNode.y.add(mixNode).clamp(), - ); - - const proceduralEnv = mix(mixCubeMaps, normalWorld, proceduralNode); - - const intensityFilter = proceduralEnv.mul(intensityNode); - const hueFilter = hue(intensityFilter, hueNode); - return saturation(hueFilter, saturationNode); - }; - - const blurNode = uniform(0); - - scene.environmentNode = getEnvironmentNode(reflectVector, positionWorld); - - scene.backgroundNode = getEnvironmentNode(positionWorldDirection, positionLocal).context({ - getTextureLevel: () => blurNode, - }); - - // scene objects - - const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); - const gltf = await loader.loadAsync('DamagedHelmet.gltf'); - - scene.add(gltf.scene); - - const sphereGeometry = new THREE.SphereGeometry(0.5, 64, 32); - - const sphereRightView = new THREE.Mesh( - sphereGeometry, - new THREE.MeshStandardMaterial({ roughness: 0, metalness: 1 }), - ); - sphereRightView.position.x += 2; - - const sphereLeftView = new THREE.Mesh( - sphereGeometry, - new THREE.MeshStandardMaterial({ roughness: 1, metalness: 1 }), - ); - sphereLeftView.position.x -= 2; - - scene.add(sphereLeftView); - scene.add(sphereRightView); - - // renderer and controls - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.LinearToneMapping; - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(adjustments, 'mix', -1, 2, 0.01); - gui.add({ blurBackground: blurNode.value }, 'blurBackground', 0, 1, 0.01).onChange(value => { - blurNode.value = value; - }); - gui.add({ offsetHDR1: 0 }, 'offsetHDR1', 0, Math.PI * 2, 0.01).onChange(value => { - rotateY1Matrix.makeRotationY(value); - }); - gui.add({ offsetHDR2: 0 }, 'offsetHDR2', 0, Math.PI * 2, 0.01).onChange(value => { - rotateY2Matrix.makeRotationY(value); - }); - gui.add(adjustments, 'procedural', 0, 1, 0.01); - gui.add(adjustments, 'intensity', 0, 5, 0.01); - gui.add(adjustments, 'hue', 0, Math.PI * 2, 0.01); - gui.add(adjustments, 'saturation', 0, 2, 0.01); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_cubemap_dynamic.ts b/examples-testing/examples/webgpu_cubemap_dynamic.ts deleted file mode 100644 index 244b85935..000000000 --- a/examples-testing/examples/webgpu_cubemap_dynamic.ts +++ /dev/null @@ -1,130 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let cube, sphere, torus, material; - -let cubeCamera, cubeRenderTarget; - -let controls; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 75; - - scene = new THREE.Scene(); - - const uvTexture = new THREE.TextureLoader().load('./textures/uv_grid_opengl.jpg'); - - const hdrUrls = ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']; - const texture = await new HDRCubeTextureLoader().setPath('./textures/cube/pisaHDR/').loadAsync(hdrUrls); - - texture.name = 'pisaHDR'; - texture.minFilter = THREE.LinearMipmapLinearFilter; - texture.magFilter = THREE.LinearFilter; - - scene.background = texture; - scene.environment = texture; - - // - - cubeRenderTarget = new THREE.CubeRenderTarget(256); - cubeRenderTarget.texture.type = THREE.HalfFloatType; - cubeRenderTarget.texture.minFilter = THREE.LinearMipmapLinearFilter; - cubeRenderTarget.texture.magFilter = THREE.LinearFilter; - cubeRenderTarget.texture.generateMipmaps = true; - - cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); - - // - - material = new THREE.MeshStandardNodeMaterial({ - envMap: cubeRenderTarget.texture, - roughness: 0.05, - metalness: 1, - }); - - sphere = new THREE.Mesh(new THREE.IcosahedronGeometry(15, 8), material); - scene.add(sphere); - - const material1 = new THREE.MeshStandardNodeMaterial({ - map: uvTexture, - roughness: 0.1, - metalness: 0, - }); - - const material2 = new THREE.MeshStandardNodeMaterial({ - map: uvTexture, - roughness: 0.1, - metalness: 0, - envMap: texture, - }); - - cube = new THREE.Mesh(new THREE.BoxGeometry(15, 15, 15), material1); - scene.add(cube); - - torus = new THREE.Mesh(new THREE.TorusKnotGeometry(8, 3, 128, 16), material2); - scene.add(torus); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animation); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResized); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(material, 'roughness', 0, 1); - gui.add(material, 'metalness', 0, 1); - gui.add(renderer, 'toneMappingExposure', 0, 2).name('exposure'); - gui.add(scene, 'environmentIntensity', 0, 1); - gui.add(material2, 'envMapIntensity', 0, 1); -} - -function onWindowResized() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -function animation(msTime) { - const time = msTime / 1000; - - cube.position.x = Math.cos(time) * 30; - cube.position.y = Math.sin(time) * 30; - cube.position.z = Math.sin(time) * 30; - - cube.rotation.x += 0.02; - cube.rotation.y += 0.03; - - torus.position.x = Math.cos(time + 10) * 30; - torus.position.y = Math.sin(time + 10) * 30; - torus.position.z = Math.sin(time + 10) * 30; - - torus.rotation.x += 0.02; - torus.rotation.y += 0.03; - - material.visible = false; - - cubeCamera.update(renderer, scene); - - material.visible = true; - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_cubemap_mix.ts b/examples-testing/examples/webgpu_cubemap_mix.ts deleted file mode 100644 index 6fbdb55ae..000000000 --- a/examples-testing/examples/webgpu_cubemap_mix.ts +++ /dev/null @@ -1,78 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mix, oscSine, time, pmremTexture, float } from 'three/tsl'; - -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - const hdrUrls = ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']; - const cube1Texture = new HDRCubeTextureLoader().setPath('./textures/cube/pisaHDR/').load(hdrUrls); - - cube1Texture.generateMipmaps = true; - cube1Texture.minFilter = THREE.LinearMipmapLinearFilter; - - const cube2Urls = [ - 'dark-s_px.jpg', - 'dark-s_nx.jpg', - 'dark-s_py.jpg', - 'dark-s_ny.jpg', - 'dark-s_pz.jpg', - 'dark-s_nz.jpg', - ]; - const cube2Texture = await new THREE.CubeTextureLoader().setPath('./textures/cube/MilkyWay/').loadAsync(cube2Urls); - - cube2Texture.generateMipmaps = true; - cube2Texture.minFilter = THREE.LinearMipmapLinearFilter; - - scene.environmentNode = mix(pmremTexture(cube2Texture), pmremTexture(cube1Texture), oscSine(time.mul(0.1))); - - scene.backgroundNode = scene.environmentNode.context({ - getTextureLevel: () => float(0.5), - }); - - const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); - const gltf = await loader.loadAsync('DamagedHelmet.gltf'); - - scene.add(gltf.scene); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.LinearToneMapping; - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_custom_fog.ts b/examples-testing/examples/webgpu_custom_fog.ts deleted file mode 100644 index 3a6c59a36..000000000 --- a/examples-testing/examples/webgpu_custom_fog.ts +++ /dev/null @@ -1,225 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color, fog, positionWorld, triNoise3D, normalWorld, uniform, densityFogFactor } from 'three/tsl'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; -import { TerrainGenerator } from 'three/addons/generators/TerrainGenerator.js'; -import { ForestGenerator } from 'three/addons/generators/ForestGenerator.js'; - -let camera, scene, renderer, controls, timer; -let terrain, forest, terrainGroup, forestGroup; -let sky, sun, sunLight, pmremGenerator, envScene; - -const parameters = { - elevation: 11, // sun height above the horizon, in degrees ( low = golden hour ) - azimuth: 150, // sun compass direction, in degrees -}; - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.62; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - pmremGenerator = new THREE.PMREMGenerator(renderer); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20000); - camera.position.set(-50, 88, 230); - - scene = new THREE.Scene(); - scene.environmentIntensity = 0.16; // a dim, cool sky fill so the warm sun stays the key and shadows read - - // a physical sky, used only to bake the image-based lighting ( it is not - // the visible background — the fog gradient below is ); elevation / azimuth move the sun - - sky = new SkyMesh(); - sky.scale.setScalar(10000); - sky.turbidity.value = 12; - sky.rayleigh.value = 2; - sky.mieCoefficient.value = 0.005; - sky.mieDirectionalG.value = 0.88; - - sun = new THREE.Vector3(); - envScene = new THREE.Scene(); - - // custom fog. an animated, two-octave triNoise3D haze that settles into - // the valley as a level band: solid below `fogBase` ( down under the - // mountains ) and fading out by `fogTop` ( around mid-height ), so the - // peaks rise clear above it. the band sits at a fixed altitude whatever - // the distance, and the noise wobbles its top edge and drifts it through - // world space, so it reads as slow-moving cloud. ( the peaks reach ~130 ) - - const skyColorValue = 0xf0f5f5; - const groundColorValue = 0xd0dee7; - - const skyColor = color(skyColorValue); - const groundColor = color(groundColorValue); - - const fogBase = uniform(-20); // world-y the fog is solid below ( the valley floor ) - const fogTop = uniform(55); // world-y the fog fades out by ( mid-mountain ) - const haze = uniform(0.0012); // distance haze, so the far peaks dissolve into the same grey - - // a alternative way to create a TimerNode - const time = uniform(0).onFrameUpdate(frame => frame.time); - - const fogNoiseA = triNoise3D(positionWorld.mul(0.005), 0.2, time); - const fogNoiseB = triNoise3D(positionWorld.mul(0.01), 0.2, time.mul(1.2)); - - const fogNoise = fogNoiseA.add(fogNoiseB); - - // the noise lifts and drops the top of the band so it breaks into wisps - const top = fogTop.add(fogNoise.sub(0.7).mul(22)); - const groundFogArea = top.sub(positionWorld.y).div(top.sub(fogBase)).saturate().mul(0.98); - - // the valley band plus a distance haze, so the far peaks dissolve into the grey too - const fogArea = groundFogArea.oneMinus().mul(densityFogFactor(haze).oneMinus()).oneMinus(); - - scene.fogNode = fog(groundColor, fogArea); - scene.backgroundNode = normalWorld.y.max(0).mix(groundColor, skyColor); - - // terrain + forest - - terrain = new TerrainGenerator({ - seed: 1, - size: 900, - segments: 512, - frequency: 0.0065, - heightScale: 150, - erosion: 0.7, - valleyBias: 1.2, - }); - - forest = new ForestGenerator({ count: 500000, castShadow: true }); - - generate(); - - // a single directional key aligned with the sky's sun, for the crisp relief - // shadows the sky fill alone can't give. its colour, intensity and position — - // and the baked environment — are set by updateSun() - - sunLight = new THREE.DirectionalLight(); - sunLight.castShadow = true; - sunLight.shadow.camera.left = -420; - sunLight.shadow.camera.right = 420; - sunLight.shadow.camera.top = 420; - sunLight.shadow.camera.bottom = -420; - sunLight.shadow.camera.near = 200; - sunLight.shadow.camera.far = 1800; - sunLight.shadow.mapSize.set(4096, 4096); - sunLight.shadow.bias = -0.0004; - sunLight.shadow.normalBias = 0.15; - sunLight.shadow.autoUpdate = false; // the scene is static — re-render the shadow map only when the sun moves ( see updateSun ), not every frame - scene.add(sunLight); - - updateSun(); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - - const skyFolder = gui.addFolder('Sun'); - skyFolder.add(parameters, 'elevation', 1, 40).step(0.5).name('elevation').onChange(updateSun); - skyFolder.add(parameters, 'azimuth', 0, 360).step(1).name('azimuth').onChange(updateSun); - - const fogFolder = gui.addFolder('Fog'); - fogFolder.add(fogBase, 'value', -40, 20).step(1).name('base'); - fogFolder.add(fogTop, 'value', 0, 130).step(1).name('top'); - fogFolder.add(haze, 'value', 0, 0.005).step(0.0001).name('haze'); - - const forestFolder = gui.addFolder('Forest'); - forestFolder.add(forest.from, 'value', 50, 1000).step(10).name('cull from'); - forestFolder.add(forest.to, 'value', 100, 1400).step(10).name('cull to'); - - const terrainFolder = gui.addFolder('Terrain'); - terrainFolder.add(terrain.parameters, 'erosion', 0, 1.5).step(0.05).name('erosion'); - terrainFolder.add(terrain.parameters, 'valleyBias', 1, 3).step(0.1).name('valley bias'); - terrainFolder.add({ newSeed }, 'newSeed').name('regenerate'); - - // controls - - timer = new THREE.Timer(); - - controls = new FirstPersonControls(camera, renderer.domElement); - controls.movementSpeed = 20; - controls.lookSpeed = 0.1; - controls.lookAt(0, 5, -120); // face across the valley - - window.addEventListener('resize', resize); -} - -// walks the sun: aligns the sky and the key light ( warm and dim near the -// horizon ), then re-bakes the sky into the IBL environment -function updateSun() { - const elevation = parameters.elevation; - - sun.setFromSphericalCoords( - 1, - THREE.MathUtils.degToRad(90 - elevation), - THREE.MathUtils.degToRad(parameters.azimuth), - ); - sky.sunPosition.value.copy(sun); - - // the longer air path near the horizon dims and warms the sun. it stays - // far brighter than the sky fill, so it reads as the key and casts firm shadows - const transmittance = Math.sqrt(Math.max(Math.sin(THREE.MathUtils.degToRad(elevation)), 0)); - sunLight.color.set(0xff7a2f).lerp(new THREE.Color(0xfff2e0), transmittance); // deep orange → warm white - sunLight.intensity = 11 * transmittance + 0.3; - sunLight.position.copy(sun).multiplyScalar(900); - sunLight.shadow.needsUpdate = true; // the sun moved, so the on-demand shadow map needs one refresh - - // re-bake the sky ( without the sun disc ) into the environment map for IBL. - // the sky lives only in envScene; it is never added to the visible scene - sky.showSunDisc.value = false; - envScene.add(sky); - const env = pmremGenerator.fromScene(envScene).texture; - if (scene.environment) scene.environment.dispose(); - scene.environment = env; -} - -// a new seed ( and whatever erosion / valley bias is dialled in ) rebuilds -// the terrain, and with it the forest that sits on top -function newSeed() { - terrain.parameters.seed++; - generate(); -} - -// the forest sits on the terrain, so a new terrain means a new forest -function generate() { - if (terrainGroup) scene.remove(terrainGroup); - if (forestGroup) scene.remove(forestGroup); - - terrainGroup = terrain.build(); - forestGroup = forest.build(terrain); - - scene.add(terrainGroup); - scene.add(forestGroup); - - if (sunLight) sunLight.shadow.needsUpdate = true; // rebuilt geometry ⇒ re-render the shadow map ( skipped on the first build, before the light exists; updateSun covers it ) -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - controls.update(timer.getDelta()); - - forest.setCameraPosition(camera.position); // drives the forest cull - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_custom_fog_background.ts b/examples-testing/examples/webgpu_custom_fog_background.ts deleted file mode 100644 index a9b619345..000000000 --- a/examples-testing/examples/webgpu_custom_fog_background.ts +++ /dev/null @@ -1,86 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, color, rangeFogFactor } from 'three/tsl'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer; -let renderPipeline; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NoToneMapping; // apply tone mapping in post processing, instead - document.body.appendChild(renderer.domElement); - - // post processing - - // render scene pass - const scenePass = pass(scene, camera); - const scenePassViewZ = scenePass.getViewZNode(); - - // fog color - const fogColor = color(0x4080cc); // in sRGB color space - - // get fog factor from the scene pass context - // equivalent to: scene.fog = new THREE.Fog( 0x4080cc, 2.7, 4 ); - const fogFactor = rangeFogFactor(2.7, 4).context({ getViewZ: () => scenePassViewZ }); - - // tone-mapped scene pass - const scenePassTM = scenePass.toneMapping(THREE.ACESFilmicToneMapping, 1); - - // mix fog using fog factor and fog color - const compose = fogFactor.mix(scenePassTM, fogColor); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = true; // no tone mapping will be applied, only the default color space transform - renderPipeline.outputNode = compose; - - // - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - scene.environment = texture; - - // model - - const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); - loader.load('DamagedHelmet.gltf', function (gltf) { - scene.add(gltf.scene); - }); - }); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 5; - controls.target.set(0, -0.1, -0.2); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_custom_fog_scattering.ts b/examples-testing/examples/webgpu_custom_fog_scattering.ts deleted file mode 100644 index e0da158f9..000000000 --- a/examples-testing/examples/webgpu_custom_fog_scattering.ts +++ /dev/null @@ -1,193 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { densityFogFactor, mix, pass, reference, uniform, vec2 } from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { TreeGenerator } from 'three/addons/generators/TreeGenerator.js'; - -let camera, scene, renderer, renderPipeline, controls; - -const timer = new THREE.Timer(); - -const params = { - scatteringEnabled: true, -}; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 0.1, 120); - camera.position.set(0.4, 1.7, 9); // ~human eye height - - scene = new THREE.Scene(); - - // fog: a bright, cool haze. the background matches it so the trunks read - // as dark silhouettes that dissolve into depth — the scattering subject - - scene.fog = new THREE.FogExp2(0xc6cace, 0.11); - scene.background = new THREE.Color(0xc6cace); - - // everything is a flat black silhouette — the fog and the scattering blur - // do all the shaping, so no lights are needed ( MeshBasicMaterial is unlit ) - - const material = new THREE.MeshBasicMaterial({ color: 0x000000 }); - - // a few seeded variants of a tall scots pine: a clean bole rising into a - // high, open crown of fine bare branches - - const variants = []; - - const generator = new TreeGenerator(material); - - for (let v = 0; v < 6; v++) { - const mesh = generator - .setSeed(v + 1) - .setTrunkLength(2.6 + v * 0.3) // the crowns ride high in the fog - .setTrunkRadius(0.06) - .setTaper(0.28) // slender, tapers slowly - .setLevels(4) - .setChildren([7, 5, 4]) // a wide whorl of limbs ramifying into many fine twigs - .setBranchAngle([55, 50, 46]) // a rounded crown that turns up - .setAngleVariance(22) - .setLengthRatio(0.46) // short crown limbs ( a modest pine crown ) - .setMinLength(0.04) - .setDroop(0.05) - .setUpPull(0.42) // crown branches reach up toward the light - .setGnarl([0, 0.14, 0.24, 0.34]) // dead-straight trunk, wispier twigs - .setSectionLength(0.34) - .setRadialSegments(7) - .setRadiusExponent(2.5) // slender bole, whippy thin twigs - .setMinRadius(0.0023) // very fine twigs - .setTrunkClear(0.72) // tall clean bole; the crown sits only at the top - .build(); - - variants.push(mesh.geometry); - } - - const placements = variants.map(() => []); - - const dummy = new THREE.Object3D(); - const cols = 13, - rows = 12, - spacing = 1.9; - - for (let i = 0; i < cols; i++) { - for (let j = 0; j < rows; j++) { - const v = Math.floor(Math.random() * variants.length); - - const x = (i - cols / 2) * spacing + (Math.random() - 0.5) * spacing * 0.8; - const z = j * spacing - rows * spacing + 4.2 + (Math.random() - 0.5) * spacing * 0.8; - - dummy.position.set(x, 0, z); - - const scale = 0.85 + Math.random() * 0.4; - dummy.rotation.set((Math.random() - 0.5) * 0.05, Math.random() * Math.PI * 2, (Math.random() - 0.5) * 0.05); // slight lean - dummy.scale.set(scale, scale * (0.9 + Math.random() * 0.3), scale); - dummy.updateMatrix(); - - placements[v].push(dummy.matrix.clone()); - } - } - - variants.forEach((geometry, v) => { - const list = placements[v]; - const mesh = new THREE.InstancedMesh(geometry, material, list.length); - for (let k = 0; k < list.length; k++) mesh.setMatrixAt(k, list[k]); - mesh.instanceMatrix.needsUpdate = true; - scene.add(mesh); - }); - - // a couple of dominant trunks close to the camera to anchor the depth - - [ - [-1.1, 4.9, 1.5, 1.1], - [1.5, 4, 1.2, 0.3], - ].forEach(([x, z, s, ry]) => { - const hero = new THREE.Mesh(variants[variants.length - 1], material); - hero.position.set(x, 0, z); - hero.rotation.y = ry; - hero.scale.setScalar(s); - scene.add(hero); - }); - - // ground - - const ground = new THREE.Mesh(new THREE.PlaneGeometry(600, 600).rotateX(-Math.PI / 2), material); - scene.add(ground); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new FirstPersonControls(camera, renderer.domElement); - controls.movementSpeed = 2; - controls.lookSpeed = 0.1; - controls.lookAt(-0.2, 1.7, -8); - - renderPipeline = new THREE.RenderPipeline(renderer); - - // uniforms - - const density = reference('density', 'float', scene.fog); - const scattering = uniform(2); - - // scene pass - - const scenePass = pass(scene, camera); - - const scenePassColor = scenePass.getTextureNode('output'); - const scenePassViewZ = scenePass.getViewZNode(); - - // blur pass (always downsampled to improve performance) - - const sceneColorBlurred = gaussianBlur(scenePassColor, vec2(scattering), 4, { resolutionScale: 0.5 }); - - // composite - - const fogFactor = densityFogFactor(density).context({ getViewZ: () => scenePassViewZ }); - - const compositeNode = mix(scenePassColor, sceneColorBlurred, fogFactor); - - renderPipeline.outputNode = compositeNode; - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(scene.fog, 'density', 0.025, 0.16).step(0.0005).name('fog density'); - gui.add(scattering, 'value', 0, 5).name('scattering factor'); - gui.add(params, 'scatteringEnabled') - .name('enable scattering') - .onChange(value => { - if (value === true) { - renderPipeline.outputNode = compositeNode; - } else { - renderPipeline.outputNode = scenePassColor; - } - - renderPipeline.needsUpdate = true; - }); - - window.addEventListener('resize', resize); -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - controls.update(timer.getDelta()); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_deferred.ts b/examples-testing/examples/webgpu_deferred.ts deleted file mode 100644 index 71538bc7c..000000000 --- a/examples-testing/examples/webgpu_deferred.ts +++ /dev/null @@ -1,254 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - vec4, - normalView, - pass, - diffuseColor, - positionGeometry, - positionView, - positionViewDirection, - roughness, - metalness, - mrt, - Fn, - overrideNodes, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - -const RESOLVE_LAYER = 2; - -let camera, scene, renderer; -let renderPipeline; -let lightGroup, planesGroup; -let params; - -const timer = new THREE.Timer(); - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - // scene - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - // teapot model - const teapotGeometry = new TeapotGeometry(0.4, 18); - const teapotMaterial = new THREE.MeshStandardMaterial({ color: 0x333333, roughness: 0.2, metalness: 0.8 }); - const teapot = new THREE.Mesh(teapotGeometry, teapotMaterial); - teapot.position.y = -0.15; - scene.add(teapot); - }); - - // light group - lightGroup = new THREE.Group(); - lightGroup.position.y = -0.15; - scene.add(lightGroup); - - const numLights = 8; - const radius = 1.2; - const sphereGeometry = new THREE.SphereGeometry(0.03, 16, 8); - - for (let i = 0; i < numLights; i++) { - const angle = (i / numLights) * Math.PI * 2; - const x = Math.cos(angle) * radius; - const z = Math.sin(angle) * radius; - - const colorHex = new THREE.Color().setHSL(i / numLights, 1.0, 0.5); - - const lightMat = new THREE.MeshStandardMaterial({ color: colorHex }); - const lightMesh = new THREE.Mesh(sphereGeometry, lightMat); - - const light = new THREE.PointLight(colorHex, 5, 5); - light.layers.enable(RESOLVE_LAYER); - light.position.set(x, 0, z); - light.add(lightMesh); - - lightGroup.add(light); - } - - // planes group - planesGroup = new THREE.Group(); - planesGroup.position.y = -0.15; - scene.add(planesGroup); - - const planeGeometry = new THREE.PlaneGeometry(0.4, 0.4); - const planeMaterial = new THREE.MeshStandardMaterial({ - color: 0x999999, - roughness: 0.5, - metalness: 0.5, - side: THREE.DoubleSide, - transparent: true, - opacity: 0.5, - }); - - const numPlanes = 6; - const planesRadius = 1.5; - - for (let i = 0; i < numPlanes; i++) { - const angle = (i / numPlanes) * Math.PI * 2; - - const pivot = new THREE.Group(); - pivot.rotation.y = angle; - planesGroup.add(pivot); - - const plane = new THREE.Mesh(planeGeometry, planeMaterial); - plane.position.z = planesRadius; - pivot.add(plane); - } - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // opaque pass - - const opaquePass = pass(scene, camera); - opaquePass.name = 'opaque pass'; - opaquePass.transparent = false; - opaquePass.setLayers(new THREE.Layers()); // default layer 0 is used by the renderer - opaquePass.setMRT( - mrt({ - output: diffuseColor, - position: vec4(positionView, metalness), - normal: vec4(normalView, roughness), - }), - ); - - opaquePass.lighting = new THREE.Lighting(); - opaquePass.lighting.enabled = false; - - // opaque nodes - - const opaqueOutputNode = opaquePass.getTextureNode('output').toInspector('output'); - const opaquePositionView = opaquePass.getTextureNode('position').xyz.toInspector('position'); - const opaqueNormalView = opaquePass.getTextureNode('normal').xyz.toInspector('normal'); - const opaqueDepthNode = opaquePass.getTextureNode('depth').toInspector('depth'); - const opaqueMetalness = opaquePass.getTextureNode('position').w.toInspector('metalness'); - const opaqueRoughness = opaquePass.getTextureNode('normal').w.toInspector('roughness'); - - // resolve opaque pass - deferred lighting - - const resolveLayers = new THREE.Layers(); - resolveLayers.disableAll(); - resolveLayers.enable(RESOLVE_LAYER); - - // the resolve material must be compatible with the other materials in the scene; - // in common deferred rendering scenarios, a standardized material is used. - - const resolveMaterial = new THREE.MeshStandardNodeMaterial(); - resolveMaterial.colorNode = Fn(() => { - opaqueDepthNode.greaterThanEqual(1.0).discard(); - - return opaqueOutputNode; - })(); - resolveMaterial.metalnessNode = opaqueMetalness; - resolveMaterial.roughnessNode = opaqueRoughness; - resolveMaterial.vertexNode = vec4(positionGeometry.xy, 0.0, 1.0); - resolveMaterial.depthNode = opaqueDepthNode; - resolveMaterial.contextNode = overrideNodes([ - [positionView, opaquePositionView], - [positionViewDirection, opaquePositionView.negate().normalize()], - [normalView, opaqueNormalView], - ]); - - const resolveMesh = new THREE.QuadMesh(resolveMaterial); - resolveMesh.layers.set(RESOLVE_LAYER); - scene.add(resolveMesh); - - const resolvedPass = pass(scene, camera); - resolvedPass.setLayers(resolveLayers); - resolvedPass.lighting = new THREE.Lighting(); - - // transparent pass - - const opaqueDepthTexture = opaquePass.getTexture('depth'); - - const transparentPass = pass(scene, camera, { depthTexture: opaqueDepthTexture, autoClearDepth: false }); - transparentPass.name = 'transparent pass'; - transparentPass.setLayers(new THREE.Layers()); // default layer 0 is used by the renderer - transparentPass.opaque = false; - - // forward pass - - const forwardPass = pass(scene, camera).toInspector('forward'); - - // resolved - render pipeline - - const opaqueNode = resolvedPass.toInspector('resolved opaque'); - const transparentNode = transparentPass.toInspector('transparent'); - - const deferredNode = vec4(opaqueNode.rgb.mul(transparentNode.a.oneMinus()).add(transparentNode.rgb), 1.0); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = deferredNode; - - // gui - - params = { - mode: 'deferred', - animated: true, - }; - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'mode', ['forward', 'deferred']).onChange(value => { - renderPipeline.outputNode = value === 'forward' ? forwardPass : deferredNode; - renderPipeline.needsUpdate = true; - }); - gui.add(params, 'animated'); - - // controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.target.set(0, 0, -0.2); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - timer.update(); - - if (params.animated) { - const delta = timer.getDelta(); - - lightGroup.rotation.y += delta * 1.0; - planesGroup.rotation.y -= delta * 0.5; - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_depth_texture.ts b/examples-testing/examples/webgpu_depth_texture.ts deleted file mode 100644 index 0bc38eeba..000000000 --- a/examples-testing/examples/webgpu_depth_texture.ts +++ /dev/null @@ -1,83 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, controls, renderer; - -let quad, renderTarget; - -const dpr = window.devicePixelRatio; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 20); - camera.position.z = 4; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222222); - scene.overrideMaterial = new THREE.MeshBasicNodeMaterial(); - - // - - const geometry = new THREE.TorusKnotGeometry(1, 0.3, 128, 64); - - const count = 50; - const scale = 5; - - for (let i = 0; i < count; i++) { - const r = Math.random() * 2.0 * Math.PI; - const z = Math.random() * 2.0 - 1.0; - const zScale = Math.sqrt(1.0 - z * z) * scale; - - const mesh = new THREE.Mesh(geometry); - mesh.position.set(Math.cos(r) * zScale, Math.sin(r) * zScale, z * scale); - mesh.rotation.set(Math.random(), Math.random(), Math.random()); - scene.add(mesh); - } - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(dpr); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - const depthTexture = new THREE.DepthTexture(); - depthTexture.type = THREE.FloatType; - - renderTarget = new THREE.RenderTarget(window.innerWidth * dpr, window.innerHeight * dpr); - renderTarget.depthTexture = depthTexture; - - window.addEventListener('resize', onWindowResize); - - // FX - - const materialFX = new THREE.MeshBasicNodeMaterial(); - materialFX.colorNode = texture(depthTexture); - - quad = new THREE.QuadMesh(materialFX); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); -} - -function animate() { - renderer.setRenderTarget(renderTarget); - renderer.render(scene, camera); - - renderer.setRenderTarget(null); - quad.render(renderer); -} diff --git a/examples-testing/examples/webgpu_display_stereo.ts b/examples-testing/examples/webgpu_display_stereo.ts deleted file mode 100644 index 7f1ade726..000000000 --- a/examples-testing/examples/webgpu_display_stereo.ts +++ /dev/null @@ -1,191 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { stereoPass } from 'three/addons/tsl/display/StereoPassNode.js'; -import { anaglyphPass, AnaglyphAlgorithm, AnaglyphColorMode } from 'three/addons/tsl/display/AnaglyphPassNode.js'; -import { parallaxBarrierPass } from 'three/addons/tsl/display/ParallaxBarrierPassNode.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline; - -let stereo, anaglyph, parallaxBarrier; - -let mesh, dummy, timer; - -let anaglyphFolder; - -const position = new THREE.Vector3(); - -const params = { - effect: 'stereo', - eyeSep: 0.064, - planeDistance: 3, - anaglyphAlgorithm: 'dubois', - anaglyphColorMode: 'redCyan', -}; - -const effects = { Stereo: 'stereo', Anaglyph: 'anaglyph', ParallaxBarrier: 'parallaxBarrier' }; - -const anaglyphAlgorithms = { - True: AnaglyphAlgorithm.TRUE, - Grey: AnaglyphAlgorithm.GREY, - Colour: AnaglyphAlgorithm.COLOUR, - 'Half-Colour': AnaglyphAlgorithm.HALF_COLOUR, - Dubois: AnaglyphAlgorithm.DUBOIS, - Optimised: AnaglyphAlgorithm.OPTIMISED, - Compromise: AnaglyphAlgorithm.COMPROMISE, -}; - -const anaglyphColorModes = { - 'Red / Cyan': AnaglyphColorMode.RED_CYAN, - 'Magenta / Cyan': AnaglyphColorMode.MAGENTA_CYAN, - 'Magenta / Green': AnaglyphColorMode.MAGENTA_GREEN, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 3; - - scene = new THREE.Scene(); - scene.background = new THREE.CubeTextureLoader() - .setPath('textures/cube/Park3Med/') - .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); - - timer = new THREE.Timer(); - timer.connect(document); - - const geometry = new THREE.SphereGeometry(0.1, 32, 16); - - const textureCube = new THREE.CubeTextureLoader() - .setPath('textures/cube/Park3Med/') - .load(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); - - const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); - - mesh = new THREE.InstancedMesh(geometry, material, 500); - mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); - - dummy = new THREE.Mesh(); - - for (let i = 0; i < 500; i++) { - dummy.position.x = Math.random() * 10 - 5; - dummy.position.y = Math.random() * 10 - 5; - dummy.position.z = Math.random() * 10 - 5; - dummy.scale.x = dummy.scale.y = dummy.scale.z = Math.random() * 3 + 1; - - dummy.updateMatrix(); - - mesh.setMatrixAt(i, dummy.matrix); - } - - scene.add(mesh); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - renderPipeline = new THREE.RenderPipeline(renderer); - stereo = stereoPass(scene, camera); - anaglyph = anaglyphPass(scene, camera); - parallaxBarrier = parallaxBarrierPass(scene, camera); - - // Configure anaglyph for physically-correct stereo with zero parallax at scene center - anaglyph.eyeSep = params.eyeSep; - anaglyph.planeDistance = params.planeDistance; - - renderPipeline.outputNode = stereo; - - const gui = renderer.inspector.createParameters('Stereo Settings'); - gui.add(params, 'effect', effects).onChange(update); - gui.add(params, 'eyeSep', 0.001, 0.15, 0.001).onChange(function (value) { - stereo.stereo.eyeSep = value; - anaglyph.eyeSep = value; // Anaglyph has direct eyeSep property - parallaxBarrier.stereo.eyeSep = value; - }); - - // Anaglyph-specific settings folder - anaglyphFolder = gui.addFolder('Anaglyph Options'); - anaglyphFolder - .add(params, 'anaglyphAlgorithm', anaglyphAlgorithms) - .name('Algorithm') - .onChange(function (value) { - anaglyph.algorithm = value; - }); - anaglyphFolder - .add(params, 'anaglyphColorMode', anaglyphColorModes) - .name('Color Mode') - .onChange(function (value) { - anaglyph.colorMode = value; - }); - anaglyphFolder - .add(params, 'planeDistance', 0.5, 10, 0.1) - .name('Plane Distance') - .onChange(function (value) { - anaglyph.planeDistance = value; - }); - anaglyphFolder.paramList.domElement.style.display = 'none'; - - window.addEventListener('resize', onWindowResize); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 25; -} - -function update(value) { - if (value === 'stereo') { - renderPipeline.outputNode = stereo; - anaglyphFolder.paramList.domElement.style.display = 'none'; - } else if (value === 'anaglyph') { - renderPipeline.outputNode = anaglyph; - anaglyphFolder.paramList.domElement.style.display = ''; - } else if (value === 'parallaxBarrier') { - renderPipeline.outputNode = parallaxBarrier; - anaglyphFolder.paramList.domElement.style.display = 'none'; - } - - renderPipeline.needsUpdate = true; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function extractPosition(matrix, position) { - position.x = matrix.elements[12]; - position.y = matrix.elements[13]; - position.z = matrix.elements[14]; -} - -function animate() { - timer.update(); - - const elapsedTime = timer.getElapsed() * 0.1; - - for (let i = 0; i < mesh.count; i++) { - mesh.getMatrixAt(i, dummy.matrix); - - extractPosition(dummy.matrix, position); - - position.x = 5 * Math.cos(elapsedTime + i); - position.y = 5 * Math.sin(elapsedTime + i * 1.1); - - dummy.matrix.setPosition(position); - - mesh.setMatrixAt(i, dummy.matrix); - - mesh.instanceMatrix.needsUpdate = true; - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_equirectangular.ts b/examples-testing/examples/webgpu_equirectangular.ts deleted file mode 100644 index 9e159e465..000000000 --- a/examples-testing/examples/webgpu_equirectangular.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture, equirectUV } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let controls; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(1, 0, 0); - - const equirectTexture = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); - equirectTexture.colorSpace = THREE.SRGBColorSpace; - - scene = new THREE.Scene(); - scene.backgroundNode = texture(equirectTexture, equirectUV(), 0); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.rotateSpeed = -0.125; // negative, to track mouse pointer - controls.autoRotateSpeed = 1.0; - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(scene, 'backgroundIntensity', 0, 1).name('background intensity'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_fog_height.ts b/examples-testing/examples/webgpu_fog_height.ts deleted file mode 100644 index 65bda9cd8..000000000 --- a/examples-testing/examples/webgpu_fog_height.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { exponentialHeightFogFactor, uniform, fog, color } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 600); - camera.position.set(20, 10, 25); - - scene = new THREE.Scene(); - - // height fog - - const density = uniform(0.04); - const height = uniform(2); - - const fogFactor = exponentialHeightFogFactor(density, height); - - scene.fogNode = fog(color(0xffdfc1), fogFactor); - scene.backgroundNode = color(0xffdfc1); - - // meshes - - const geometry = new THREE.BoxGeometry(1, 25, 1); - const material = new THREE.MeshPhongNodeMaterial({ color: 0xcd959a }); - - const mesh = new THREE.InstancedMesh(geometry, material, 100); - mesh.position.y = -10; - scene.add(mesh); - - const dummy = new THREE.Object3D(); - - let index = 0; - - for (let i = 0; i < 10; i++) { - for (let j = 0; j < 10; j++) { - dummy.position.x = -18 + i * 4; - dummy.position.z = -18 + j * 4; - - dummy.updateMatrix(); - - mesh.setMatrixAt(index++, dummy.matrix); - } - } - - // lights - - const directionalLight = new THREE.DirectionalLight(0xffc0cb, 2); - directionalLight.position.set(-10, 10, 10); - scene.add(directionalLight); - - const ambientLight = new THREE.AmbientLight(0xcccccc); - scene.add(ambientLight); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // gui - - const gui = renderer.inspector.createParameters('Fog Settings'); - - gui.add(density, 'value', 0.001, 0.1).step(0.0001).name('Density'); - gui.add(height, 'value', -5, 5).name('Height'); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 7; - controls.maxDistance = 100; - controls.maxPolarAngle = Math.PI / 2; - controls.enableDamping = true; - - window.addEventListener('resize', resize); -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_furnace_test.ts b/examples-testing/examples/webgpu_furnace_test.ts deleted file mode 100644 index 4afa5d2d0..000000000 --- a/examples-testing/examples/webgpu_furnace_test.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as THREE from 'three'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let scene, camera, renderer, radianceMap; - -let gui; - -const COLOR = 0xcccccc; - -async function init() { - const width = window.innerWidth; - const height = window.innerHeight; - const aspect = width / height; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setSize(width, height); - renderer.setPixelRatio(window.devicePixelRatio); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // scene - - scene = new THREE.Scene(); - - // camera - - camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); - camera.position.set(0, 0, 18); - - // - - initGui(); - - window.addEventListener('resize', onWindowResize); -} - -function createObjects() { - const geometry = new THREE.SphereGeometry(0.4, 32, 16); - - for (let x = 0; x <= 10; x++) { - for (let y = 0; y <= 10; y++) { - const material = new THREE.MeshPhysicalMaterial({ - roughness: x / 10, - metalness: y / 10, - color: 0xffffff, - envMap: radianceMap, - envMapIntensity: 1, - transmission: 0, - ior: 1.5, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = x - 5; - mesh.position.y = 5 - y; - scene.add(mesh); - } - } -} - -function createEnvironment() { - const envScene = new THREE.Scene(); - envScene.background = new THREE.Color(COLOR); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - radianceMap = pmremGenerator.fromScene(envScene).texture; - pmremGenerator.dispose(); - - scene.background = envScene.background; -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - - render(); -} - -function render() { - renderer.render(scene, camera); -} - -function initGui() { - gui = new GUI(); - - const param = { - tint: false, - }; - - gui.add(param, 'tint') - .name('Tint for Visibility') - .onChange(function (val) { - scene.traverse(function (child) { - const tint = val ? 0xccccff : 0xffffff; - - if (child.isMesh) child.material.color.setHex(tint); - }); - - render(); - }); -} - -Promise.resolve().then(init).then(createEnvironment).then(createObjects).then(render); diff --git a/examples-testing/examples/webgpu_gaussian_splat.ts b/examples-testing/examples/webgpu_gaussian_splat.ts deleted file mode 100644 index 555853fda..000000000 --- a/examples-testing/examples/webgpu_gaussian_splat.ts +++ /dev/null @@ -1,193 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { SPLATLoader } from 'three/addons/loaders/SPLATLoader.js'; -import { SPZLoader } from 'three/addons/loaders/SPZLoader.js'; -import { GaussianSplat } from 'three/addons/objects/GaussianSplat.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls, splats, splatRoot; -THREE.ColorManagement.workingColorSpace = THREE.SRGBColorSpace; - -const zeroVector = new THREE.Vector3(); - -const sources = { - millipede: { - name: 'Millipede (SPLAT)', - url: './models/splat/millipede.splat', - loader: SPLATLoader, - rotation: new THREE.Euler(-Math.PI * -1.1, Math.PI * -0.1, Math.PI * 0.15), - cameraPosition: new THREE.Vector3(0, 0.4, 1), - credit: { - author: 'Fabian Plum', - authorUrl: 'https://superspl.at/user?id=scant3d', - source: 'https://superspl.at/scene/3d5482d4', - license: 'CC Attribution', - licenseUrl: 'http://creativecommons.org/licenses/by/4.0/', - }, - }, - lion: { - name: 'Lion (SPZ)', - url: './models/spz/lion.v3.spz', - loader: SPZLoader, - rotation: new THREE.Euler(Math.PI, 0, 0), - cameraPosition: new THREE.Vector3(0, 0.2, 1), - credit: { - author: 'Renaud', - authorUrl: 'https://superspl.at/user?id=rohls', - source: 'https://superspl.at/scene/56155c3f', - license: 'CC Attribution', - licenseUrl: 'http://creativecommons.org/licenses/by/4.0/', - }, - }, - tomatoes: { - name: 'Tomatoes (SPZ v4)', - url: './models/spz/tomatoes.v4.spz', - loader: SPZLoader, - cameraPosition: new THREE.Vector3(0, 0.35, 1), - credit: { - author: 'Grail', - authorUrl: 'https://superspl.at/user/grail', - source: 'https://superspl.at/scene/2826d2c0', - license: 'CC Attribution', - licenseUrl: 'http://creativecommons.org/licenses/by/4.0/', - }, - }, -}; -const sourceNames = Object.values(sources).map(source => source.name); -const params = { - source: sources.lion.name, -}; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.set(0, 0.35, 3.2); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x07080f); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 1.2; - controls.maxDistance = 8; - controls.target.set(0, 0, 0); - controls.update(); - - const gui = renderer.inspector.createParameters('Building'); - gui.add(params, 'source', sourceNames) - .name('Splat') - .onChange(async value => { - await loadSplatSource(getSourceKeyByName(value)); - }); - - await loadSplatSource(getSourceKeyByName(params.source)); - - window.addEventListener('resize', onWindowResize); -} - -async function loadSplatSource(sourceKey) { - const source = sources[sourceKey]; - const splatData = await new source.loader().loadAsync(source.url); - - disposeCurrentSplats(); - - splats = new GaussianSplat(splatData, { autoSort: false }); - splatRoot = splats; - - if (source.rotation !== undefined) splatRoot.rotation.copy(source.rotation); - - scene.add(splatRoot); - - fitCameraToSplats(splats, source); - - updateLicenseInfo(source); -} - -function updateLicenseInfo(source) { - const license = document.getElementById('license'); - const credit = source.credit; - - if (credit === undefined) { - license.innerHTML = ''; - return; - } - - license.innerHTML = - 'Model by ' + - credit.author + - ', ' + - 'via superspl.at. ' + - 'Licensed under ' + - credit.license + - '.'; -} - -function getSourceKeyByName(sourceName) { - return Object.keys(sources).find(key => sources[key].name === sourceName); -} - -function disposeCurrentSplats() { - if (splatRoot === undefined) return; - - scene.remove(splatRoot); - splats.geometry.dispose(); - splats.material.dispose(); - splats = undefined; - splatRoot = undefined; -} - -function fitCameraToSplats(mesh, source) { - mesh.updateWorldMatrix(true, false); - - const sphere = mesh.splatGeometry.boundingSphere.clone().applyMatrix4(mesh.matrixWorld); - const radius = Math.max(sphere.radius, 0.01); - const distance = radius / Math.sin(THREE.MathUtils.degToRad(camera.fov) * 0.5); - - controls.minDistance = source.minDistance || radius * 1.1; - controls.maxDistance = source.maxDistance || radius * 8; - controls.target.copy(sphere.center).add(source.cameraTarget || zeroVector); - camera.position - .copy(source.cameraPosition) - .normalize() - .multiplyScalar(distance * 1.15) - .add(sphere.center); - camera.near = Math.max(distance / 1000, 0.001); - camera.far = Math.max(distance * 10, 10); - - camera.updateProjectionMatrix(); - controls.update(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - if (splats !== undefined) { - splats.updateSort(renderer, camera); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_generator_building.ts b/examples-testing/examples/webgpu_generator_building.ts deleted file mode 100644 index ec0088e0e..000000000 --- a/examples-testing/examples/webgpu_generator_building.ts +++ /dev/null @@ -1,225 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { uniform } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; -import { - SkyscraperGenerator, - createSkyscraperMaterial, - pickBuildingColor, -} from 'three/addons/generators/city/SkyscraperGenerator.js'; - -let camera, scene, renderer, controls, generator, building, material; -let sky, sunLight, pmremGenerator, envScene; - -// reused by updateSun(): the current sun direction and the key-light -// colours it blends between as the sun nears the horizon or climbs high -const sun = new THREE.Vector3(); -const sunHorizonColor = new THREE.Color(0xffb072); -const sunMiddayColor = new THREE.Color(0xfff4e8); - -// every building takes one flat masonry colour; a uniform lets the seed -// repick it without recompiling the shared material -const baseColor = uniform(new THREE.Color(0xc6c0b2)); - -const parameters = { - seed: 7, - height: 100, - width: 34, - depth: 28, - floorHeight: 4, - bayWidth: 2.6, - chamfer: 5, - setback: 1.5, - timeOfDay: 17, // hours: 6 sunrise, 12 noon, 18 sunset -}; - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.25; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.environmentIntensity = 0.25; // sky as a soft fill; the sun is the key - - // a physical sky drives both the backdrop and the image-based lighting; - // updateSun() positions the sun and bakes it into the IBL environment - - sky = new SkyMesh(); - sky.scale.setScalar(10000); - sky.turbidity.value = 8; - sky.rayleigh.value = 3; - sky.mieCoefficient.value = 0.008; - sky.mieDirectionalG.value = 0.88; - - // the sky is baked into the environment map from this scene, then moved - // to the main scene as the backdrop ( see updateSun ) - envScene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20000); - camera.position.set(120, 95, 155); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target.set(0, 58, 0); - controls.maxPolarAngle = Math.PI * 0.495; - controls.minDistance = 30; - controls.maxDistance = 600; - controls.autoRotate = true; - controls.autoRotateSpeed = 0.3; - controls.update(); - - // a single directional key aligned with the sky's sun, for the crisp - // relief shadows the IBL alone can't give. updateSun() and - // fitShadowCamera() drive its colour, intensity and shadow frustum - - sunLight = new THREE.DirectionalLight(); - sunLight.castShadow = true; - sunLight.shadow.mapSize.set(2048, 2048); - sunLight.shadow.bias = -0.0004; - scene.add(sunLight); - scene.add(sunLight.target); - - // place the sun ( sky, IBL, key light and shadow ) for the current time - updateSun(); - - // an invisible ground that only catches the tower's shadow, large - // enough to hold the long shadow the low sun casts - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(2000, 2000).rotateX(-Math.PI / 2), - new THREE.ShadowMaterial({ color: 0x000000, opacity: 0.35 }), - ); - ground.receiveShadow = true; - scene.add(ground); - - material = createSkyscraperMaterial(baseColor); - generate(); - - const gui = renderer.inspector.createParameters('Building'); - gui.add(parameters, 'seed', 0, 100, 1).onChange(generate); - gui.add(parameters, 'height', 60, 200, 1).onChange(generate); - gui.add(parameters, 'width', 18, 60, 1).onChange(generate); - gui.add(parameters, 'depth', 16, 50, 1).onChange(generate); - gui.add(parameters, 'floorHeight', 3, 6, 0.1).onChange(generate); - gui.add(parameters, 'bayWidth', 1.8, 4.5, 0.1).onChange(generate); - gui.add(parameters, 'chamfer', 0, 10, 0.5).onChange(generate); - gui.add(parameters, 'setback', 0, 4, 0.1).onChange(generate); - gui.add(parameters, 'timeOfDay', 6, 18, 0.1).name('time of day').onChange(updateSun); - - window.addEventListener('resize', onWindowResize); -} - -function generate() { - if (building) { - scene.remove(building); - building.geometry.dispose(); - } - - baseColor.value.setHex(pickBuildingColor(parameters.seed)); - - generator = new SkyscraperGenerator( - { - seed: parameters.seed, - totalHeight: parameters.height, - footprint: { width: parameters.width, depth: parameters.depth }, - floorHeight: parameters.floorHeight, - bayWidth: parameters.bayWidth, - chamferWidth: parameters.chamfer, - setbackDepth: parameters.setback, - }, - material, - ); - building = generator.build(); - building.castShadow = building.receiveShadow = true; - scene.add(building); - - fitShadowCamera(); -} - -function updateSun() { - // map the time of day to a sun arc: low and warm at dawn / dusk, high and - // bright at noon, sweeping east → west across the day - - const t = parameters.timeOfDay; - const u = (t - 12) / 6; // -1 at sunrise, 0 at noon, +1 at sunset - const elevation = Math.max(0, 1 - u * u) * 72; // degrees above the horizon, peaks at noon - const azimuth = 90 - u * 55; // the sun swings east → west across the day - - sun.setFromSphericalCoords(1, THREE.MathUtils.degToRad(90 - elevation), THREE.MathUtils.degToRad(azimuth)); - sky.sunPosition.value.copy(sun); - - // physically-motivated key light: real sunlight is far brighter than the - // sky, so the sun stays the dominant source and cast shadows read clearly - // against the soft sky fill. the longer air path near the horizon dims and - // warms it ( the fill dims with it, as the environment is re-baked below ). - - const sinElevation = Math.sin(THREE.MathUtils.degToRad(elevation)); - const transmittance = Math.sqrt(Math.max(sinElevation, 0)); // 0 at the horizon → 1 at the zenith - sunLight.color.copy(sunHorizonColor).lerp(sunMiddayColor, transmittance); - sunLight.intensity = 6 * transmittance; // illuminance perpendicular to the rays; the renderer applies N·L per surface - - // re-bake the sky ( without the sun disc ) into the environment map for IBL - - sky.showSunDisc.value = false; - envScene.add(sky); - const env = pmremGenerator.fromScene(envScene).texture; - if (scene.environment) scene.environment.dispose(); - scene.environment = env; - sky.showSunDisc.value = true; - scene.add(sky); - - fitShadowCamera(); -} - -function fitShadowCamera() { - // fit the directional light's shadow frustum to the tower and the full - // ground shadow it casts, so a low sun's long shadow isn't clipped - - const height = parameters.height; - const tipDistance = height / Math.max(sun.y, 0.05); // shadow tip on the ground - const centerX = -sun.x * tipDistance * 0.5; - const centerZ = -sun.z * tipDistance * 0.5; - - const radius = Math.hypot(parameters.width, parameters.depth) * 0.5; - const half = Math.hypot(centerX, centerZ) + radius + 20; - const distance = half + height; // place the light clear of the whole scene - - sunLight.target.position.set(centerX, 0, centerZ); - sunLight.target.updateMatrixWorld(); - sunLight.position.set(centerX + sun.x * distance, sun.y * distance, centerZ + sun.z * distance); - - const shadowCamera = sunLight.shadow.camera; - shadowCamera.left = -half; - shadowCamera.right = half; - shadowCamera.top = half; - shadowCamera.bottom = -half; - shadowCamera.near = 1; - shadowCamera.far = distance * 2; - shadowCamera.updateProjectionMatrix(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_generator_city.ts b/examples-testing/examples/webgpu_generator_city.ts deleted file mode 100644 index 739569814..000000000 --- a/examples-testing/examples/webgpu_generator_city.ts +++ /dev/null @@ -1,169 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; -import { CityGenerator, createBuildingMaterial, createRoadMaterial } from 'three/addons/generators/CityGenerator.js'; - -let camera, scene, renderer, controls, timer; -let cityGroup, materials, city, renderPipeline; -let sky, sun, sunLight, pmremGenerator, envScene; - -const parameters = { - seed: 94, - timeOfDay: 6.4, // hours: 6 sunrise, 12 noon, 18 sunset -}; - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.45; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.environmentIntensity = 0.2; // sky as a soft fill; the sun is the key - - // a physical sky drives both the backdrop and the image-based - // lighting; the time-of-day slider walks the sun along its arc - - sky = new SkyMesh(); - sky.scale.setScalar(10000); - sky.turbidity.value = 8; - sky.rayleigh.value = 3; - sky.mieCoefficient.value = 0.008; - sky.mieDirectionalG.value = 0.88; - - sun = new THREE.Vector3(); - envScene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 1, 20000); - camera.position.set(-35, 55, -100); - - controls = new FirstPersonControls(camera, renderer.domElement); - controls.movementSpeed = 15; - controls.lookSpeed = 0.25; - controls.lookAt(35, 55, 0); - - timer = new THREE.Timer(); - - city = new CityGenerator({ seed: parameters.seed }); - - // road: wet asphalt with sidewalks, lane lines and crosswalks, all - // aligned to the city grid via TSL. sized to the city footprint plus - // one street ( a crosswalk's width ) of margin all round - - const floorW = city.layout.cityW + 2 * city.layout.street; - const floorD = city.layout.cityD + 2 * city.layout.street; - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(floorW, floorD).rotateX(-Math.PI / 2), - createRoadMaterial(city.layout), - ); - ground.receiveShadow = true; - scene.add(ground); - - // a single directional key aligned with the sky's sun, for the crisp - // relief shadows the IBL alone can't give. its colour, intensity and - // position — and the baked environment — are set by updateSun() - - sunLight = new THREE.DirectionalLight(); - sunLight.castShadow = true; - sunLight.shadow.camera.left = -280; - sunLight.shadow.camera.right = 280; - sunLight.shadow.camera.top = 360; - sunLight.shadow.camera.bottom = -40; - sunLight.shadow.camera.far = 2400; - sunLight.shadow.mapSize.set(4096, 4096); - sunLight.shadow.bias = -0.0004; - scene.add(sunLight); - - updateSun(); - - materials = { building: createBuildingMaterial(city.layout, parameters.seed) }; - generateCity(); - - // bloom: a soft glow on the brightest areas, run on the linear HDR scene - // colour before tone mapping folds it back to display range - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePassColor = pass(scene, camera).getTextureNode('output'); - const bloomPass = bloom(scenePassColor, 0.05, 0.0, 0.0); - - renderPipeline.outputNode = scenePassColor.add(bloomPass); - - // parameters - - const gui = renderer.inspector.createParameters('City'); - gui.add(parameters, 'seed', 0, 100, 1).onChange(generateCity); - gui.add(parameters, 'timeOfDay', 6, 18, 0.1).name('time of day').onChange(updateSun); - gui.add(renderer, 'toneMappingExposure', 0.01, 1).name('exposure'); - gui.add(bloomPass.strength, 'value', 0, 2).name('bloom'); - - window.addEventListener('resize', onWindowResize); -} - -function updateSun() { - const t = parameters.timeOfDay; - const u = (t - 12) / 6; // -1 at sunrise, 0 at noon, +1 at sunset - const elevation = Math.max(0, 1 - u * u) * 72; // degrees above the horizon, peaks at noon - const azimuth = 90 - u * 55; // the sun swings east → west across the day - - sun.setFromSphericalCoords(1, THREE.MathUtils.degToRad(90 - elevation), THREE.MathUtils.degToRad(azimuth)); - sky.sunPosition.value.copy(sun); - - // physically-motivated key light: real sunlight is far brighter than the - // sky, so the sun stays the dominant source and cast shadows read clearly - // against the soft sky fill. the longer air path near the horizon dims and - // warms it ( the fill dims with it, as the environment is re-baked below ). - - const sinElevation = Math.sin(THREE.MathUtils.degToRad(elevation)); - const transmittance = Math.sqrt(Math.max(sinElevation, 0)); // 0 at the horizon → 1 at the zenith - sunLight.color.set(0xffb072).lerp(new THREE.Color(0xfff4e8), transmittance); - sunLight.intensity = 6 * transmittance; // illuminance perpendicular to the rays; the renderer applies N·L per surface - sunLight.position.copy(sun).multiplyScalar(600); - - // re-bake the sky ( without the sun disc ) into the environment map for IBL - - sky.showSunDisc.value = false; - envScene.add(sky); - const env = pmremGenerator.fromScene(envScene).texture; - if (scene.environment) scene.environment.dispose(); - scene.environment = env; - sky.showSunDisc.value = true; - scene.add(sky); -} - -function generateCity() { - if (cityGroup) scene.remove(cityGroup); - - city.parameters.seed = parameters.seed; - cityGroup = city.build(materials); - scene.add(cityGroup); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - controls.update(timer.getDelta()); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_geometry_loft.ts b/examples-testing/examples/webgpu_geometry_loft.ts deleted file mode 100644 index f378f3384..000000000 --- a/examples-testing/examples/webgpu_geometry_loft.ts +++ /dev/null @@ -1,955 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - bumpMap, - color, - cos, - float, - mix, - mx_fractal_noise_float, - mx_noise_float, - mx_worley_noise_float, - positionLocal, - screenUV, - sin, - smoothstep, - uv, - vec3, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { LoftGeometry } from 'three/addons/geometries/LoftGeometry.js'; - -let group, camera, scene, renderer; - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - scene.environmentIntensity = 0.4; - - // a vignette in the background - - const background = screenUV.distance(0.5).mix(color(0x5d5d84), color(0x2e2e44)); - - scene.backgroundNode = background; - - // camera - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 15, 40); - - // controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 15; - controls.maxDistance = 50; // stay inside the curtain - controls.target.set(0, -3, 0); - controls.update(); - - // everything stands on a rotating floor. all surface detail is - // procedural: the loft uvs run along the loft ( uv().x ) and around - // the sections ( uv().y ), so patterns can follow the geometry - - group = new THREE.Group(); - scene.add(group); - - // floor: large, softly mottled, running under the curtain so its - // edge is never seen - - const floorMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 1 }); - floorMaterial.colorNode = color(0x555577).mul(mx_noise_float(positionLocal.mul(0.4)).mul(0.1).add(0.95)); - - const floor = new THREE.Mesh(new THREE.CircleGeometry(58, 64).rotateX(-Math.PI / 2), floorMaterial); - floor.position.y = -5.01; - floor.receiveShadow = true; - group.add(floor); - - // a theater curtain encircles the exhibition - - const curtainMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.9, side: THREE.DoubleSide }); - curtainMaterial.colorNode = color(0x86222e).mul( - mx_noise_float(vec3(uv().y.mul(300), uv().x.mul(6), 0)) - .mul(0.08) - .add(0.96), - ); - - const curtain = new THREE.Mesh(createCurtainGeometry(), curtainMaterial); - group.add(curtain); - - // light - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(18, 30, 12); - light.castShadow = true; - light.shadow.camera.left = -60; - light.shadow.camera.right = 60; - light.shadow.camera.top = 60; - light.shadow.camera.bottom = -60; - light.shadow.camera.far = 110; - light.shadow.mapSize.set(4096, 4096); - light.shadow.bias = -0.0005; - scene.add(light); - - // pedestals: polished marble. the veins meander and branch along the - // zero crossings of a domain warped fractal noise — a sharp dark - // core inside a soft halo — over a gently clouded white base - - const p = positionLocal.mul(0.9); - - const vein = mx_fractal_noise_float(p.add(mx_fractal_noise_float(p.mul(0.4), 3).mul(2)), 4) - .abs() - .oneMinus(); - const fine = mx_fractal_noise_float(p.mul(3).add(11), 3).abs().oneMinus(); - - const veining = vein.pow(4).mul(0.3).add(vein.pow(12).mul(0.7)).add(fine.pow(14).mul(0.2)); - const clouds = mx_noise_float(p.mul(0.5)).mul(0.5).add(0.5); - - const pedestalMaterial = new THREE.MeshStandardNodeMaterial(); - pedestalMaterial.colorNode = mix(mix(color(0xf4f4f7), color(0xeeeef2), clouds), color(0xd0d0d5), veining); - pedestalMaterial.roughnessNode = veining.mul(0.14).add(0.07); - pedestalMaterial.envMapIntensity = 1.5; - - function addPedestal(x, z, radius, height) { - const pedestal = new THREE.Mesh(createPedestalGeometry(radius, height), pedestalMaterial); - pedestal.position.set(x, -5, z); - pedestal.rotation.y = x * 0.7 + z * 1.3; // so the marbling differs per pedestal - group.add(pedestal); - - return -5 + height; // the top of the pedestal - } - - // a coffee set: a cup and a saucer lofted from the bottom center, up - // one side of the wall and back down the inside, and a handle swept - // along a spline. the porcelain glaze has a faint waviness - - const porcelain = new THREE.MeshStandardNodeMaterial(); - porcelain.roughnessNode = mx_noise_float(positionLocal.mul(6)).mul(0.08).add(0.2); - porcelain.normalNode = bumpMap(mx_noise_float(positionLocal.mul(2)).mul(0.05)); - - const coffee = new THREE.Group(); - coffee.position.y = addPedestal(0, 0, 3.6, 2.2); - coffee.scale.setScalar(0.75); - group.add(coffee); - - const saucer = new THREE.Mesh(createSaucerGeometry(), porcelain); - coffee.add(saucer); - - const cup = new THREE.Mesh(createCupGeometry(), porcelain); - cup.position.y = 0.3; - coffee.add(cup); - - const handle = new THREE.Mesh(createHandleGeometry(), porcelain); - handle.position.y = 0.3; - handle.rotation.y = 0.15; - coffee.add(handle); - - // the coffee has a lazy swirl on its surface - - const liquidMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.08 }); - liquidMaterial.colorNode = mix( - color(0x2b1a12), - color(0x4a2c1a), - mx_noise_float(positionLocal.mul(1.5)).mul(0.5).add(0.5), - ); - - const liquid = new THREE.Mesh(new THREE.CircleGeometry(2, 48).rotateX(-Math.PI / 2), liquidMaterial); - liquid.position.y = 3.6; - coffee.add(liquid); - - // a vase: circular sections with a varying radius. the glaze pools - // in throwing rings along the profile - - const vaseRings = sin(uv().x.mul(160)); - - const vaseMaterial = new THREE.MeshStandardNodeMaterial({ side: THREE.DoubleSide }); - vaseMaterial.colorNode = mix( - color(0x2e6f9e), - color(0x82b8d8), - mx_noise_float(positionLocal.mul(1.2)).mul(0.5).add(0.5), - ); - vaseMaterial.roughnessNode = vaseRings.mul(0.08).add(0.3); - vaseMaterial.normalNode = bumpMap(vaseRings.mul(0.012)); - - const vase = new THREE.Mesh(createVaseGeometry(), vaseMaterial); - vase.position.set(-10.5, addPedestal(-10.5, -10.5, 3.6, 1.1), -10.5); - group.add(vase); - - // a seashell: circular sections that grow while sweeping along a - // logarithmic spiral, with growth bands and fine ridges along it - - const shellMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.5, side: THREE.DoubleSide }); - shellMaterial.colorNode = mix( - color(0xc9a87f), - color(0xf2e6d8), - mx_noise_float(vec3(uv().x.mul(24), 0, 0)) - .mul(0.5) - .add(0.5), - ); - shellMaterial.normalNode = bumpMap(sin(uv().x.mul(480)).mul(0.02)); - - const shell = new THREE.Mesh(createShellGeometry(), shellMaterial); - shell.position.set(10.5, addPedestal(10.5, -10.5, 3.6, 1.1) + 1.92, -10.5); - shell.rotation.y = -Math.PI / 2; - shell.scale.setScalar(0.8); - group.add(shell); - - // a twisted star: non-circular sections that rotate and scale along - // the loft, in sandy terracotta - - const starMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.6 }); - starMaterial.colorNode = color(0xcc5544).mul(mx_noise_float(positionLocal.mul(3)).mul(0.12).add(0.94)); - starMaterial.normalNode = bumpMap(mx_noise_float(positionLocal.mul(50)).mul(0.008)); - - const star = new THREE.Mesh(createStarGeometry(), starMaterial); - star.position.set(-10.5, addPedestal(-10.5, 10.5, 3.6, 1.1), 10.5); - star.scale.setScalar(0.8); - group.add(star); - - // a ribbon: open two-point sections ( closed: false ), in gold - // brushed along its length - - const brush = mx_noise_float(vec3(uv().x.mul(6), uv().y.mul(160), 0)); - - const ribbonMaterial = new THREE.MeshStandardNodeMaterial({ - color: 0xffcc44, - metalness: 1, - side: THREE.DoubleSide, - }); - ribbonMaterial.roughnessNode = brush.mul(0.08).add(0.1); - ribbonMaterial.normalNode = bumpMap(brush.mul(0.004)); - ribbonMaterial.envMapIntensity = 2.5; - - const ribbon = new THREE.Mesh(createRibbonGeometry(), ribbonMaterial); - ribbon.position.set(10.5, addPedestal(10.5, 10.5, 3.6, 1.1), 10.5); - group.add(ribbon); - - // a toothpaste tube: circular sections that morph into a flat - // crimped seam, with stripes printed around the body - - const tubeU = uv().x; - const tealStripe = smoothstep(0.48, 0.5, tubeU).sub(smoothstep(0.6, 0.62, tubeU)); - const redStripe = smoothstep(0.66, 0.68, tubeU).sub(smoothstep(0.72, 0.74, tubeU)); - - const tubeMaterial = new THREE.MeshStandardNodeMaterial({ roughness: 0.25 }); - tubeMaterial.colorNode = mix(mix(color(0xf2f2f2), color(0x2aa6b8), tealStripe), color(0xd0543a), redStripe); - - const tube = new THREE.Mesh(createToothpasteGeometry(), tubeMaterial); - tube.position.set(7.8, addPedestal(7.8, 0, 2, 1.6), 0); - tube.rotation.y = 0.5; - group.add(tube); - - // a pumpkin: lobed sections around a squashed profile. the shading - // follows the same crease function as the geometry, so the narrow - // creases are darker and rougher than the broad lobes - - const lobe = cos(uv().y.mul(Math.PI * 7)) - .abs() - .pow(0.35); - - const pumpkinMaterial = new THREE.MeshStandardNodeMaterial(); - pumpkinMaterial.colorNode = mix( - mix(color(0x9c4f16), color(0xe6913d), lobe), - color(0x8a7a2e), // greener around the stem - smoothstep(0.88, 1, uv().x).mul(0.6), - ); - pumpkinMaterial.roughnessNode = float(0.7).sub(lobe.mul(0.2)); - pumpkinMaterial.normalNode = bumpMap(mx_noise_float(vec3(uv().y.mul(120), uv().x.mul(5), 0)).mul(0.01)); - - const pumpkinY = addPedestal(0, 7.8, 2, 1.6); - - const pumpkin = new THREE.Mesh(createPumpkinGeometry(), pumpkinMaterial); - pumpkin.position.set(0, pumpkinY, 7.8); - group.add(pumpkin); - - const pumpkinStemMaterial = new THREE.MeshStandardNodeMaterial({ color: 0x667744 }); - pumpkinStemMaterial.roughnessNode = mx_noise_float(positionLocal.mul(20)).mul(0.2).add(0.7); - - const pumpkinStem = new THREE.Mesh(createPumpkinStemGeometry(), pumpkinStemMaterial); - pumpkinStem.position.set(0, pumpkinY, 7.8); - group.add(pumpkinStem); - - // a mushroom: a cap that folds under its own rim. the cap uvs run - // from under the rim ( u 0 ) over the edge to the top center ( u 1 ), - // so the red dome with its raised warts and the pale underside with - // its radial gills can share one material - - const capU = uv().x; - const dome = smoothstep(0.42, 0.58, capU); - const warts = smoothstep(0.18, 0.38, mx_worley_noise_float(positionLocal.mul(2.4))) - .oneMinus() - .mul(dome); - const gills = sin(uv().y.mul(Math.PI * 120)) - .mul(0.5) - .add(0.5) - .mul(dome.oneMinus()); - - const capMaterial = new THREE.MeshStandardNodeMaterial(); - capMaterial.colorNode = mix( - mix(color(0xe8dcc4), color(0xbfae8e), gills), - mix(color(0xa32d20), color(0xf2e9d8), warts), - dome, - ); - capMaterial.roughnessNode = float(0.55).sub(dome.mul(0.2)).add(warts.mul(0.25)); - capMaterial.normalNode = bumpMap(warts.mul(0.08).sub(gills.mul(0.015))); - - const mushroomY = addPedestal(-7.8, 0, 2, 1.6); - - const mushroomCap = new THREE.Mesh(createMushroomCapGeometry(), capMaterial); - mushroomCap.position.set(-7.8, mushroomY, 0); - group.add(mushroomCap); - - const mushroomStemMaterial = new THREE.MeshStandardNodeMaterial(); - mushroomStemMaterial.colorNode = color(0xe5d5b5).mul( - mx_noise_float(vec3(uv().y.mul(24), uv().x.mul(2), 0)) - .mul(0.1) - .add(0.94), - ); - mushroomStemMaterial.roughnessNode = mx_noise_float(positionLocal.mul(12)).mul(0.15).add(0.55); - - const mushroomStem = new THREE.Mesh(createMushroomStemGeometry(), mushroomStemMaterial); - mushroomStem.position.set(-7.8, mushroomY, 0); - group.add(mushroomStem); - - // a goblet: a foot, a thin stem and a bowl with folded back walls, - // in hammered copper - - const dents = mx_worley_noise_float(positionLocal.mul(5)); - - const gobletMaterial = new THREE.MeshStandardNodeMaterial({ color: 0xb87333, metalness: 1 }); - gobletMaterial.roughnessNode = dents.mul(0.18).add(0.12); - gobletMaterial.normalNode = bumpMap(dents.mul(0.1)); - gobletMaterial.envMapIntensity = 2; - - const goblet = new THREE.Mesh(createGobletGeometry(), gobletMaterial); - goblet.position.set(0, addPedestal(0, -7.8, 2, 1.6), -7.8); - group.add(goblet); - - // a rope barrier around the exhibition: brass stanchions, and a - // twisted cord sagging between them - - const brassMaterial = new THREE.MeshStandardNodeMaterial({ color: 0xc9a86a, metalness: 1 }); - brassMaterial.roughnessNode = mx_noise_float(positionLocal.mul(10)).mul(0.06).add(0.16); - brassMaterial.envMapIntensity = 2; - - const ropeMaterial = new THREE.MeshStandardNodeMaterial({ color: 0x8a2433, roughness: 0.65 }); - ropeMaterial.normalNode = bumpMap( - sin( - uv() - .x.mul(200) - .add(uv().y.mul(Math.PI * 2)), - ).mul(0.015), - ); // the twist of the cord - - const posts = 14; - const barrierRadius = 20; - - const stanchionGeometry = createStanchionGeometry(); - const ropeGeometry = createRopeGeometry(2 * barrierRadius * Math.sin(Math.PI / posts)); - - for (let i = 0; i < posts; i++) { - const angle = ((i + 0.5) / posts) * Math.PI * 2; - - const post = new THREE.Mesh(stanchionGeometry, brassMaterial); - post.position.set(Math.sin(angle) * barrierRadius, -5, Math.cos(angle) * barrierRadius); - group.add(post); - - const mid = angle + Math.PI / posts; - const midRadius = barrierRadius * Math.cos(Math.PI / posts); - - const rope = new THREE.Mesh(ropeGeometry, ropeMaterial); - rope.position.set(Math.sin(mid) * midRadius, -5 + 2.05, Math.cos(mid) * midRadius); - rope.rotation.y = mid; - group.add(rope); - } - - // shadows - - group.traverse(child => { - if (child.isMesh) child.castShadow = child.receiveShadow = true; - }); - - floor.castShadow = false; - liquid.castShadow = false; - - // every loft remembers the sections it was skinned through in - // geometry.parameters, so a skeleton of rings can be rebuilt from - // the meshes themselves - - const skeleton = new THREE.Group(); - skeleton.visible = false; - group.add(skeleton); - - const lofts = []; - - group.traverse(child => { - if (child.isMesh && child.geometry.type === 'LoftGeometry') lofts.push(child); - }); - - const lineMaterial = new THREE.LineBasicMaterial({ color: 0xaaccee }); - - group.updateMatrixWorld(true); - - for (const mesh of lofts) { - const { sections, closed } = mesh.geometry.parameters; - const step = Math.max(1, Math.round(sections.length / 20)); - - const positions = []; - - function addRing(ring) { - const segments = closed ? ring.length : ring.length - 1; - - for (let j = 0; j < segments; j++) { - const a = ring[j], - b = ring[(j + 1) % ring.length]; - positions.push(a.x, a.y, a.z, b.x, b.y, b.z); - } - } - - for (let i = 0; i < sections.length; i += step) addRing(sections[i]); - if ((sections.length - 1) % step !== 0) addRing(sections[sections.length - 1]); - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - - const lines = new THREE.LineSegments(geometry, lineMaterial); - lines.applyMatrix4(mesh.matrixWorld); - skeleton.add(lines); - } - - // parameters - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.add({ sections: false }, 'sections').onChange(value => { - skeleton.visible = value; - liquid.visible = !value; - - for (const mesh of lofts) mesh.visible = !value; - }); - - gui.add({ wireframe: false }, 'wireframe').onChange(value => { - group.traverse(child => { - if (child.isMesh) { - child.material.wireframe = value; - child.material.needsUpdate = true; - } - }); - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -// revolves a smoothed 2d profile ( x = radius, y = height ) into -// circular sections, like a lathe - -function createRevolvedSections(profile, divisions, segments) { - const points = new THREE.SplineCurve(profile).getPoints(divisions); - - const sections = []; - - for (let i = 0; i <= divisions; i++) { - const point = points[i]; - - const ring = []; - - for (let j = 0; j < segments; j++) { - const angle = (j / segments) * Math.PI * 2; - ring.push(new THREE.Vector3(Math.sin(angle) * point.x, point.y, Math.cos(angle) * point.x)); - } - - sections.push(ring); - } - - return sections; -} - -function createPedestalGeometry(radius, height) { - // a stepped plinth, a tapered shaft and a cornice; revolved without - // smoothing, one ring per profile point. doubled points split the - // vertex normals, keeping those turnings crisp - - const profile = [ - new THREE.Vector2(0.2, 0), - new THREE.Vector2(radius * 1.06, 0), - new THREE.Vector2(radius * 1.06, height * 0.1), - new THREE.Vector2(radius * 1.06, height * 0.1), - new THREE.Vector2(radius * 0.98, height * 0.16), - new THREE.Vector2(radius * 0.94, height * 0.55), - new THREE.Vector2(radius * 0.97, height * 0.84), - new THREE.Vector2(radius * 1.04, height * 0.88), - new THREE.Vector2(radius * 1.04, height * 0.97), - new THREE.Vector2(radius * 1.04, height * 0.97), - new THREE.Vector2(radius * 0.98, height), - new THREE.Vector2(radius * 0.98, height), - new THREE.Vector2(radius * 0.5, height - 0.004), - new THREE.Vector2(0.2, height), - ]; - - const sections = []; - - for (const point of profile) { - const ring = []; - - for (let j = 0; j < 48; j++) { - const angle = (j / 48) * Math.PI * 2; - ring.push(new THREE.Vector3(Math.sin(angle) * point.x, point.y, Math.cos(angle) * point.x)); - } - - sections.push(ring); - } - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createCupGeometry() { - // from the bottom center, up the egg shaped outer wall, over the lip - // and back down the inner wall - - const profile = [ - new THREE.Vector2(0.2, 0), - new THREE.Vector2(0.7, 0.04), - new THREE.Vector2(1.05, 0.1), - new THREE.Vector2(1.75, 0.55), - new THREE.Vector2(2.25, 1.45), - new THREE.Vector2(2.36, 2.2), - new THREE.Vector2(2.3, 3.1), - new THREE.Vector2(2.22, 3.82), - new THREE.Vector2(2.18, 3.95), - new THREE.Vector2(2.06, 3.8), - new THREE.Vector2(2.18, 2.2), - new THREE.Vector2(1.5, 0.75), - new THREE.Vector2(0.9, 0.55), - new THREE.Vector2(0.2, 0.62), - ]; - - const sections = createRevolvedSections(profile, 120, 64); - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createSaucerGeometry() { - // from the bottom center, out along the underside, around the thin - // rim and back across the gently dished top - - const profile = [ - new THREE.Vector2(0.2, 0), - new THREE.Vector2(1.3, 0.08), - new THREE.Vector2(2.6, 0.35), - new THREE.Vector2(3.7, 0.8), - new THREE.Vector2(4.2, 1), - new THREE.Vector2(3.4, 0.68), - new THREE.Vector2(2, 0.3), - new THREE.Vector2(1, 0.18), - new THREE.Vector2(0.2, 0.26), - ]; - - const sections = createRevolvedSections(profile, 120, 64); - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createHandleGeometry() { - // an ear shaped loop swept along a spline, slightly tapering; the - // ends slim down so they stay buried inside the thin cup wall - - const path = new THREE.SplineCurve([ - new THREE.Vector2(2.2, 3.3), - new THREE.Vector2(2.9, 3.45), - new THREE.Vector2(3.6, 2.85), - new THREE.Vector2(3.65, 1.95), - new THREE.Vector2(3, 1.2), - new THREE.Vector2(1.78, 1.05), - ]); - - const divisions = 60; - const points = path.getPoints(divisions); - - const sections = []; - - for (let i = 0; i <= divisions; i++) { - const t = i / divisions; - - const point = points[i]; - const tangent = path.getTangent(t); - - const scale = - (1 - 0.25 * t) * - (0.28 + 0.72 * THREE.MathUtils.smoothstep(t, 0, 0.12)) * - (0.28 + 0.72 * (1 - THREE.MathUtils.smoothstep(t, 0.88, 1))); - - const a = 0.22 * scale; // in the plane of the loop - const b = 0.27 * scale; // across the loop - - const ring = []; - - for (let j = 0; j < 16; j++) { - const phi = (j / 16) * Math.PI * 2; - const radial = a * Math.cos(phi); - - ring.push(new THREE.Vector3(point.x - radial * tangent.y, point.y + radial * tangent.x, b * Math.sin(phi))); - } - - sections.push(ring); - } - - return new LoftGeometry(sections); -} - -function createVaseGeometry() { - // a full belly, a slender waist and a flared lip - - const profile = [ - new THREE.Vector2(0.2, 0), - new THREE.Vector2(1.05, 0.05), - new THREE.Vector2(1.5, 0.3), - new THREE.Vector2(2.1, 1.4), - new THREE.Vector2(2.2, 2.3), - new THREE.Vector2(1.8, 3.6), - new THREE.Vector2(1.2, 4.8), - new THREE.Vector2(0.85, 5.8), - new THREE.Vector2(0.72, 6.6), - new THREE.Vector2(0.8, 7.3), - new THREE.Vector2(1.1, 7.9), - new THREE.Vector2(1.3, 8.2), - ]; - - const sections = createRevolvedSections(profile, 100, 48); - - return new LoftGeometry(sections, { capStart: true }); -} - -function createShellGeometry() { - const turns = 3; - const growth = 0.18; - const scale = Math.exp(growth * turns * Math.PI * 2); - - const sections = []; - - for (let i = 0; i <= 150; i++) { - const t = i / 150; - - const angle = turns * Math.PI * 2 * t; - const e = Math.exp(growth * angle) / scale; - - const pathRadius = 3 * e; - const sectionRadius = 2.4 * e; - const sin = Math.sin(angle); - const cos = Math.cos(angle); - - const points = []; - - for (let j = 0; j < 32; j++) { - const phi = (j / 32) * Math.PI * 2; - const r = pathRadius + sectionRadius * Math.cos(phi); - - points.push(new THREE.Vector3(r * sin, 4.5 * (1 - e) + sectionRadius * Math.sin(phi), r * cos)); - } - - sections.push(points); - } - - return new LoftGeometry(sections); -} - -function createStarGeometry() { - const sections = []; - - for (let i = 0; i <= 60; i++) { - const t = i / 60; - - const twist = (t * Math.PI) / 3; - const scale = 1 - 0.35 * Math.sin(t * Math.PI); - - const points = []; - - for (let j = 0; j < 96; j++) { - const angle = (j / 96) * Math.PI * 2; - const radius = (2.4 + 0.7 * Math.cos(5 * angle)) * scale; - points.push(new THREE.Vector3(Math.sin(angle + twist) * radius, t * 10, Math.cos(angle + twist) * radius)); - } - - sections.push(points); - } - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createRibbonGeometry() { - const sections = []; - - for (let i = 0; i <= 120; i++) { - const t = i / 120; - - const angle = t * Math.PI * 2 * 2.5; - const sin = Math.sin(angle); - const cos = Math.cos(angle); - - sections.push([new THREE.Vector3(3 * sin, t * 7.5, 3 * cos), new THREE.Vector3(3 * sin, t * 7.5 + 2, 3 * cos)]); - } - - return new LoftGeometry(sections, { closed: false }); -} - -function createToothpasteGeometry() { - // a cap, a shoulder, and a body whose circular sections flatten - // into a wide crimped seam at the top - - const sections = []; - - for (let i = 0; i <= 80; i++) { - const t = i / 80; - - const radius = 0.5 + 0.28 * THREE.MathUtils.smoothstep(t, 0.08, 0.2); - const crimp = THREE.MathUtils.smoothstep(t, 0.3, 0.95); - - const width = radius * (1 - crimp) + 1.15 * crimp; - const depth = radius * (1 - crimp) + 0.05 * crimp; - - const points = []; - - for (let j = 0; j < 48; j++) { - const angle = (j / 48) * Math.PI * 2; - points.push(new THREE.Vector3(Math.sin(angle) * width, t * 4.2, Math.cos(angle) * depth)); - } - - sections.push(points); - } - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createPumpkinGeometry() { - // a squashed sphere with broad lobes split by narrow creases, and - // a sunken hollow around the stem - - const sections = []; - - for (let i = 0; i <= 60; i++) { - const t = i / 60; - - const angle = Math.PI * (0.03 + 0.94 * t); - const radius = 1.85 * Math.pow(Math.sin(angle), 0.62); - const creases = 0.15 * Math.sin(Math.PI * t); - - const y = 2.05 * t - 0.75 * THREE.MathUtils.smoothstep(t, 0.8, 1); - - const points = []; - - for (let j = 0; j < 96; j++) { - const theta = (j / 96) * Math.PI * 2; - const lobe = Math.pow(Math.abs(Math.cos(3.5 * theta)), 0.35); - const r = radius * (1 - creases + creases * lobe); - - points.push(new THREE.Vector3(Math.sin(theta) * r, y, Math.cos(theta) * r)); - } - - sections.push(points); - } - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createPumpkinStemGeometry() { - // a ribbed stalk, flared at its base, that rises out of the hollow - // and leans over - - const sections = []; - - for (let i = 0; i <= 30; i++) { - const t = i / 30; - - const radius = 0.2 - 0.09 * t + 0.14 * Math.pow(1 - t, 4); - const lean = 0.45 * t * t; - - const points = []; - - for (let j = 0; j < 32; j++) { - const angle = (j / 32) * Math.PI * 2; - const r = radius * (0.92 + 0.13 * Math.pow(Math.abs(Math.cos(2.5 * angle)), 0.5)); - - points.push(new THREE.Vector3(lean + Math.sin(angle) * r, 1.3 + 1.15 * t, Math.cos(angle) * r)); - } - - sections.push(points); - } - - return new LoftGeometry(sections, { capEnd: true }); -} - -function createMushroomCapGeometry() { - // from under the rim, around the edge and over the dome - - const profile = [ - new THREE.Vector2(0.35, 2.02), - new THREE.Vector2(1.1, 2), - new THREE.Vector2(1.65, 2.15), - new THREE.Vector2(1.78, 2.4), - new THREE.Vector2(1.5, 2.85), - new THREE.Vector2(0.95, 3.18), - new THREE.Vector2(0.2, 3.32), - ]; - - const sections = createRevolvedSections(profile, 80, 48); - - return new LoftGeometry(sections, { capEnd: true }); -} - -function createMushroomStemGeometry() { - const profile = [ - new THREE.Vector2(0.2, 0), - new THREE.Vector2(0.55, 0.05), - new THREE.Vector2(0.45, 0.9), - new THREE.Vector2(0.4, 1.7), - new THREE.Vector2(0.42, 2.3), - ]; - - const sections = createRevolvedSections(profile, 60, 32); - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createGobletGeometry() { - // a foot, a thin stem, and a bowl that folds back down inside - - const profile = [ - new THREE.Vector2(0.2, 0), - new THREE.Vector2(1.25, 0.05), - new THREE.Vector2(1.35, 0.2), - new THREE.Vector2(0.6, 0.5), - new THREE.Vector2(0.28, 0.9), - new THREE.Vector2(0.24, 1.7), - new THREE.Vector2(0.7, 2.15), - new THREE.Vector2(1.15, 2.8), - new THREE.Vector2(1.28, 3.5), - new THREE.Vector2(1.27, 3.62), - new THREE.Vector2(1.16, 3.5), - new THREE.Vector2(0.95, 2.85), - new THREE.Vector2(0.45, 2.25), - new THREE.Vector2(0.2, 2.32), - ]; - - const sections = createRevolvedSections(profile, 140, 48); - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createStanchionGeometry() { - // a flat disc base, a slender pole and a small ball finial - - const profile = [ - new THREE.Vector2(0.16, 0), - new THREE.Vector2(0.42, 0.04), - new THREE.Vector2(0.46, 0.12), - new THREE.Vector2(0.28, 0.22), - new THREE.Vector2(0.08, 0.38), - new THREE.Vector2(0.06, 1), - new THREE.Vector2(0.06, 1.85), - new THREE.Vector2(0.11, 1.95), - new THREE.Vector2(0.19, 2.08), - new THREE.Vector2(0.2, 2.2), - new THREE.Vector2(0.11, 2.3), - new THREE.Vector2(0.04, 2.34), - ]; - - const sections = createRevolvedSections(profile, 80, 24); - - return new LoftGeometry(sections, { capStart: true, capEnd: true }); -} - -function createRopeGeometry(length) { - // a cord sagging between two stanchions, with both ends buried in - // their poles - - const sag = 0.9; - - const sections = []; - - for (let i = 0; i <= 40; i++) { - const t = i / 40; - - const x = (t - 0.5) * length; - const y = -sag * 4 * t * (1 - t); - - // the in plane tangent orients the rings along the curve - - const tx = length; - const ty = -sag * 4 * (1 - 2 * t); - const tl = Math.sqrt(tx * tx + ty * ty); - - const points = []; - - for (let j = 0; j < 16; j++) { - const phi = (j / 16) * Math.PI * 2; - const radial = 0.08 * Math.cos(phi); - - points.push(new THREE.Vector3(x - (radial * ty) / tl, y + (radial * tx) / tl, 0.08 * Math.sin(phi))); - } - - sections.push(points); - } - - return new LoftGeometry(sections); -} - -function createCurtainGeometry() { - // rows of pleated rings hanging from above; the folds deepen and - // drift sideways as they fall - - const sections = []; - - for (let i = 0; i <= 30; i++) { - const t = i / 30; - const y = -5 + 25 * t; - - const points = []; - - for (let j = 0; j < 480; j++) { - const s = j / 480; - - const folds = (1.2 - 0.5 * t) * Math.sin(s * Math.PI * 2 * 48 + t * 2); - const sway = 0.5 * Math.sin(s * Math.PI * 2 * 5 + t * 3); - - const theta = s * Math.PI * 2; - const r = 55 + folds + sway; - - points.push(new THREE.Vector3(Math.sin(theta) * r, y, Math.cos(theta) * r)); - } - - sections.push(points); - } - - return new LoftGeometry(sections); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - group.rotation.y += 0.001; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_hdr.ts b/examples-testing/examples/webgpu_hdr.ts deleted file mode 100644 index b96ba5f42..000000000 --- a/examples-testing/examples/webgpu_hdr.ts +++ /dev/null @@ -1,124 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, uv, uniform } from 'three/tsl'; -import WebGPU from 'three/addons/capabilities/WebGPU.js'; -import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { ExtendedSRGBColorSpace, ExtendedSRGBColorSpaceImpl } from 'three/addons/math/ColorSpaces.js'; - -const params = { - intensity: uniform(4.0, 'float').setName('intensity'), - hardness: uniform(0.4, 'float').setName('hardness'), - radius: uniform(0.5, 'float').setName('radius'), - afterImageDecay: uniform(0.985, 'float').setName('afterImageDecay'), -}; - -const hdrMediaQuery = window.matchMedia('(dynamic-range: high)'); - -function updateHDRWarning() { - const displayIsHDR = hdrMediaQuery.matches; - document.querySelector('#no-hdr').style.display = displayIsHDR ? 'none' : ''; -} - -hdrMediaQuery.addEventListener('change', updateHDRWarning); -updateHDRWarning(); - -if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - throw new Error('No WebGPU support'); -} - -// Enable Extended sRGB output color space for HDR presentation -THREE.ColorManagement.define({ [ExtendedSRGBColorSpace]: ExtendedSRGBColorSpaceImpl }); - -// Renderer (HalfFloat output + Extended sRGB) -const renderer = new THREE.WebGPURenderer({ - antialias: true, - outputType: THREE.HalfFloatType, -}); - -renderer.outputColorSpace = ExtendedSRGBColorSpace; -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.inspector = new Inspector(); -document.body.appendChild(renderer.domElement); - -const camera = new THREE.OrthographicCamera(0, window.innerWidth, window.innerHeight, 0, 1, 2); -camera.position.z = 1; - -// Brush scene (rendered into drawTarget) -const brushScene = new THREE.Scene(); - -brushScene.background = new THREE.Color(0xffffff); -const brushMat = new THREE.MeshBasicNodeMaterial(); -brushMat.transparent = true; -brushMat.depthTest = false; -brushMat.depthWrite = false; -brushMat.blending = THREE.AdditiveBlending; // additive to build HDR energy - -const renderPipeline = new THREE.RenderPipeline(renderer); -const brushPass = pass(brushScene, camera, { type: THREE.HalfFloatType }); -brushPass.renderTarget.texture.colorSpace = ExtendedSRGBColorSpace; - -renderPipeline.outputNode = afterImage(brushPass, params.afterImageDecay); - -// HDR brush uniforms -const uColor = params.intensity; -const uHard = params.hardness; -const uRadius = params.radius; - -// Radial falloff in TSL -const d = uv().sub(0.5).length(); -const t = d.div(uRadius); -const a = t.clamp().oneMinus().pow(uHard.mul(8.0).add(1.0)); - -brushMat.colorNode = uColor.mul(a); -brushMat.opacityNode = a; // premultiplied style with additive blending - -const brushMesh = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), brushMat); -brushMesh.scale.set(300, 300, 1); // ~300px default brush size -brushScene.add(brushMesh); - -function onPointerMove(e) { - const rect = renderer.domElement.getBoundingClientRect(); - const x = e.clientX - rect.left; - const y = e.clientY - rect.top; - - // camera has origin at bottom-left (0,0) - brushMesh.position.set(x, window.innerHeight - y, 0); -} - -window.addEventListener('pointermove', onPointerMove, { passive: false }); - -// Prevent mobile scroll on touch -renderer.domElement.addEventListener('touchstart', e => e.preventDefault(), { passive: false }); -renderer.domElement.addEventListener('touchmove', e => e.preventDefault(), { passive: false }); -renderer.domElement.addEventListener('touchend', e => e.preventDefault(), { passive: false }); - -// GUI setup -const gui = renderer.inspector.createParameters('Settings'); - -const colorFolder = gui.addFolder('HDR'); -colorFolder.add(params.intensity, 'value', 0, 10, 0.1).name('Intensity'); - -const brushFolder = gui.addFolder('Brush Settings'); -brushFolder.add(params.hardness, 'value', 0, 0.99, 0.01).name('Hardness'); -brushFolder.add(params.radius, 'value', 0.1, 2.0, 0.01).name('Radius'); - -const effectFolder = gui.addFolder('Effects'); -effectFolder.add(params.afterImageDecay, 'value', 0.9, 0.999, 0.001).name('After Image Decay'); - -// Resize handling -function onResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - camera.right = window.innerWidth; - camera.top = window.innerHeight; - camera.updateProjectionMatrix(); -} - -window.addEventListener('resize', onResize); - -// Main loop -renderer.setAnimationLoop(async () => { - renderPipeline.render(); -}); diff --git a/examples-testing/examples/webgpu_instance_mesh.ts b/examples-testing/examples/webgpu_instance_mesh.ts deleted file mode 100644 index 0abd2f26c..000000000 --- a/examples-testing/examples/webgpu_instance_mesh.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mix, range, normalWorld, oscSine, time } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -let mesh; -const amount = parseInt(window.location.search.slice(1)) || 10; -const count = Math.pow(amount, 3); -const dummy = new THREE.Object3D(); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(amount * 0.9, amount * 0.9, amount * 0.9); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - - const material = new THREE.MeshBasicMaterial(); - - // random colors between instances from 0x000000 to 0xFFFFFF - const randomColors = range(new THREE.Color(0x000000), new THREE.Color(0xffffff)); - - material.colorNode = mix(normalWorld, randomColors, oscSine(time.mul(0.1))); - - const loader = new THREE.BufferGeometryLoader(); - loader.load('models/json/suzanne_buffergeometry.json', function (geometry) { - geometry.computeVertexNormals(); - geometry.scale(0.5, 0.5, 0.5); - - mesh = new THREE.InstancedMesh(geometry, material, count); - mesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); - - scene.add(mesh); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(mesh, 'count', 1, count, 1).name('instance count'); - }); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - render(); -} - -async function render() { - if (mesh) { - const time = Date.now() * 0.001; - - mesh.rotation.x = Math.sin(time / 4); - mesh.rotation.y = Math.sin(time / 2); - - let i = 0; - const offset = (amount - 1) / 2; - - for (let x = 0; x < amount; x++) { - for (let y = 0; y < amount; y++) { - for (let z = 0; z < amount; z++) { - dummy.position.set(offset - x, offset - y, offset - z); - dummy.rotation.y = Math.sin(x / 4 + time) + Math.sin(y / 4 + time) + Math.sin(z / 4 + time); - dummy.rotation.z = dummy.rotation.y * 2; - - dummy.updateMatrix(); - - mesh.setMatrixAt(i++, dummy.matrix); - } - } - } - } - - await renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_instance_path.ts b/examples-testing/examples/webgpu_instance_path.ts deleted file mode 100644 index a5bce3225..000000000 --- a/examples-testing/examples/webgpu_instance_path.ts +++ /dev/null @@ -1,147 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { - abs, - add, - instancedBufferAttribute, - positionLocal, - mod, - time, - sin, - vec3, - select, - float, - screenUV, - color, -} from 'three/tsl'; - -let camera, scene, renderer, controls; - -const count = 1000; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.z = 15; - - scene = new THREE.Scene(); - scene.backgroundNode = screenUV.distance(0.5).remap(0, 0.65).mix(color(0x94254c), color(0x000000)); - - // generate a path representing a heart shape - - const x = 0, - y = 0; - - const path = new THREE.Path() - .moveTo(x - 2.5, y - 2.5) - .bezierCurveTo(x - 2.5, y - 2.5, x - 2, y, x, y) - .bezierCurveTo(x + 3, y, x + 3, y - 3.5, x + 3, y - 3.5) - .bezierCurveTo(x + 3, y - 5.5, x + 1, y - 7.7, x - 2.5, y - 9.5) - .bezierCurveTo(x - 6, y - 7.7, x - 8, y - 5.5, x - 8, y - 3.5) - .bezierCurveTo(x - 8, y - 3.5, x - 8, y, x - 5, y) - .bezierCurveTo(x - 3.5, y, x - 2.5, y - 2.5, x - 2.5, y - 2.5); - - // generate instanced ico-spheres along the path - - const geometry = new THREE.IcosahedronGeometry(0.1); - const material = new THREE.MeshStandardNodeMaterial(); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(2.5, 5, 0); - mesh.count = count; - mesh.frustumCulled = false; - - scene.add(mesh); - - // instance data - - const v = new THREE.Vector3(); - const c = new THREE.Color(); - - const positions = []; - const times = []; - const seeds = []; - const colors = []; - - for (let i = 0; i < count; i++) { - const t = i / count; - path.getPointAt(t, v); - - v.x += 0.5 - Math.random(); - v.y += 0.5 - Math.random(); - v.z = 0.5 - Math.random(); - - positions.push(v.x, v.y, v.z); - times.push(t); - seeds.push(Math.random()); - - c.setHSL(0.75 + Math.random() * 0.25, 1, 0.4); - - colors.push(c.r, c.g, c.b); - } - - const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); - const colorAttribute = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); - const timeAttribute = new THREE.InstancedBufferAttribute(new Float32Array(times), 1); - const seedAttribute = new THREE.InstancedBufferAttribute(new Float32Array(seeds), 1); - - // TSL - - const instancePosition = instancedBufferAttribute(positionAttribute); - const instanceColor = instancedBufferAttribute(colorAttribute); - const instanceSeed = instancedBufferAttribute(seedAttribute); - const instanceTime = instancedBufferAttribute(timeAttribute); - - const localTime = instanceTime.add(time); - const modTime = mod(time.mul(0.4), 1); - - const s0 = sin(localTime.add(instanceSeed)).mul(0.25); - - const dist = abs(instanceTime.sub(modTime)).toConst(); // modTime and instanceTime are in the range [0,1] - const wrapDist = select(dist.greaterThan(0.5), dist.oneMinus(), dist).toConst(); // the normalized distance should wrap around 0/1 - const s1 = select(wrapDist.greaterThan(0.1), float(1), wrapDist.remap(0, 0.1, 3, 1)); // compute a scale in a range around the current interpolated value - - const offset = vec3(instancePosition.x, instancePosition.y.add(s0), instancePosition.z).toConst('offset'); - material.positionNode = add(positionLocal.mul(s1), offset); - material.colorNode = instanceColor; - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_instance_points.ts b/examples-testing/examples/webgpu_instance_points.ts deleted file mode 100644 index 3722e6488..000000000 --- a/examples-testing/examples/webgpu_instance_points.ts +++ /dev/null @@ -1,204 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - color, - storage, - Fn, - instancedBufferAttribute, - instanceIndex, - sin, - time, - float, - uniform, - shapeCircle, - mix, - vec3, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; - -let renderer, scene, camera, camera2, controls, backgroundNode; -let material; -let effectController; - -// viewport -let insetWidth; -let insetHeight; - -// compute -let computeSize; - -init(); - -async function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-40, 0, 60); - - camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); - camera2.position.copy(camera.position); - - backgroundNode = color(0x222222); - - effectController = { - pulseSpeed: uniform(6), - minWidth: uniform(6), - maxWidth: uniform(20), - }; - - // Position and THREE.Color Data - - const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 20.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); - - const spline = new THREE.CatmullRomCurve3(points); - const divisions = Math.round(4 * points.length); - const point = new THREE.Vector3(); - const pointColor = new THREE.Color(); - - const positions = []; - const colors = []; - const sizes = new Float32Array(divisions); - - for (let i = 0, l = divisions; i < l; i++) { - const t = i / l; - - spline.getPoint(t, point); - positions.push(point.x, point.y, point.z); - - pointColor.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); - colors.push(pointColor.r, pointColor.g, pointColor.b); - - sizes[i] = 10.0; - } - - // Instanced Points - - const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); - const colorsAttribute = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); - - const instanceSizeBufferAttribute = new THREE.StorageInstancedBufferAttribute(sizes, 1); - const instanceSizeStorage = storage(instanceSizeBufferAttribute, 'float', instanceSizeBufferAttribute.count); - - computeSize = Fn(() => { - const { pulseSpeed, minWidth, maxWidth } = effectController; - - const relativeTime = time.add(float(instanceIndex)); - - const sizeFactor = sin(relativeTime.mul(pulseSpeed)).add(1).div(2); - - instanceSizeStorage.element(instanceIndex).assign(sizeFactor.mul(maxWidth.sub(minWidth)).add(minWidth)); - })().compute(divisions); - - // Material / Sprites - - const attributeRange = instancedBufferAttribute(instanceSizeBufferAttribute); - const pointColors = mix( - vec3(0.0), - instancedBufferAttribute(colorsAttribute), - attributeRange.div(float(effectController.maxWidth)), - ); - - material = new THREE.PointsNodeMaterial({ - colorNode: pointColors, - opacityNode: shapeCircle(), - positionNode: instancedBufferAttribute(positionAttribute), - // rotationNode: time, - sizeNode: instancedBufferAttribute(instanceSizeBufferAttribute), - // size: 40, // in pixels units - vertexColors: true, - sizeAttenuation: false, - alphaToCoverage: true, - }); - - const instancedPoints = new THREE.Sprite(material); - instancedPoints.count = divisions; - scene.add(instancedPoints); - - // Renderer / Controls - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 10; - controls.maxDistance = 500; - - window.addEventListener('resize', onWindowResize); - onWindowResize(); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(material, 'alphaToCoverage'); - - gui.add(effectController.minWidth, 'value', 1, 30, 1).name('minWidth'); - gui.add(effectController.maxWidth, 'value', 2, 30, 1).name('maxWidth'); - gui.add(effectController.pulseSpeed, 'value', 1, 20, 0.1).name('pulseSpeed'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - insetWidth = window.innerHeight / 4; // square - insetHeight = window.innerHeight / 4; - - camera2.aspect = insetWidth / insetHeight; - camera2.updateProjectionMatrix(); -} - -function animate() { - // compute - - renderer.compute(computeSize); - - // main scene - - renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); - - controls.update(); - - renderer.autoClear = true; - - scene.backgroundNode = null; - - renderer.render(scene, camera); - - // inset scene - - const posY = window.innerHeight - insetHeight - 20; - - renderer.clearDepth(); // important! - - renderer.setScissorTest(true); - - renderer.setScissor(20, posY, insetWidth, insetHeight); - - renderer.setViewport(20, posY, insetWidth, insetHeight); - - camera2.position.copy(camera.position); - - camera2.quaternion.copy(camera.quaternion); - - renderer.autoClear = false; - - scene.backgroundNode = backgroundNode; - - renderer.render(scene, camera2); - - renderer.setScissorTest(false); -} - -// diff --git a/examples-testing/examples/webgpu_instancing_morph.ts b/examples-testing/examples/webgpu_instancing_morph.ts deleted file mode 100644 index f8f5c5fe5..000000000 --- a/examples-testing/examples/webgpu_instancing_morph.ts +++ /dev/null @@ -1,145 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, mesh, mixer, dummy; - -const offset = 5000; - -const timeOffsets = new Float32Array(1024); - -for (let i = 0; i < 1024; i++) { - timeOffsets[i] = Math.random() * 3; -} - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 100, 10000); - - scene = new THREE.Scene(); - - scene.background = new THREE.Color(0x99ddff); - - scene.fog = new THREE.Fog(0x99ddff, 5000, 10000); - - // - - const light = new THREE.DirectionalLight(0xffffff, 1); - - light.position.set(200, 1000, 50); - - light.shadow.mapSize.width = 2048; - light.shadow.mapSize.height = 2048; - light.castShadow = true; - - light.shadow.camera.left = -5000; - light.shadow.camera.right = 5000; - light.shadow.camera.top = 5000; - light.shadow.camera.bottom = -5000; - light.shadow.camera.far = 2000; - - light.shadow.camera.updateProjectionMatrix(); - - scene.add(light); - - const hemi = new THREE.HemisphereLight(0x99ddff, 0x669933, 1 / 3); - - scene.add(hemi); - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(1000000, 1000000), - new THREE.MeshStandardMaterial({ color: 0x669933 }), - ); - - ground.rotation.x = -Math.PI / 2; - - ground.receiveShadow = true; - - scene.add(ground); - - const loader = new GLTFLoader(); - - loader.load('models/gltf/Horse.glb', function (glb) { - dummy = glb.scene.children[0]; - - mesh = new THREE.InstancedMesh( - dummy.geometry, - new THREE.MeshStandardNodeMaterial({ - flatShading: true, - }), - 1024, - ); - - mesh.castShadow = true; - - for (let x = 0, i = 0; x < 32; x++) { - for (let y = 0; y < 32; y++) { - dummy.position.set(offset - 300 * x + 200 * Math.random(), 0, offset - 300 * y); - - dummy.updateMatrix(); - - mesh.setMatrixAt(i, dummy.matrix); - - mesh.setColorAt(i, new THREE.Color(`hsl(${Math.random() * 360}, 50%, 66%)`)); - - i++; - } - } - - scene.add(mesh); - - mixer = new THREE.AnimationMixer(glb.scene); - - const action = mixer.clipAction(glb.animations[0]); - - action.play(); - }); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setAnimationLoop(animate); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const time = timer.getElapsed(); - - const r = 3000; - camera.position.set(Math.sin(time / 10) * r, 1500 + 1000 * Math.cos(time / 5), Math.cos(time / 10) * r); - camera.lookAt(0, 0, 0); - - if (mesh) { - for (let i = 0; i < 1024; i++) { - mixer.setTime(time + timeOffsets[i]); - - mesh.setMorphAt(i, dummy); - } - - mesh.morphTexture.needsUpdate = true; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_layers.ts b/examples-testing/examples/webgpu_layers.ts deleted file mode 100644 index c1db7d60c..000000000 --- a/examples-testing/examples/webgpu_layers.ts +++ /dev/null @@ -1,144 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { positionLocal, time, mod, instancedBufferAttribute, rotate, screenUV, color, vec2 } from 'three/tsl'; - -let camera, scene, renderer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.layers.enable(0); // enabled by default - camera.layers.enable(1); - camera.layers.enable(2); - - camera.position.z = 10; - - scene = new THREE.Scene(); - - const horizontalEffect = screenUV.x.mix(color(0xf996ae), color(0xf6f0a3)); - const lightEffect = screenUV.distance(vec2(0.5, 1.0)).oneMinus().mul(color(0xd9b6fd)); - - scene.backgroundNode = horizontalEffect.add(lightEffect); - - const sprite = new THREE.TextureLoader().load('textures/sprites/blossom.png'); - sprite.colorSpace = THREE.SRGBColorSpace; - - const count = 2500; - - const geometry = new THREE.PlaneGeometry(0.25, 0.25); - - const colors = [0xd70654, 0xffd95f, 0xb8d576]; - - for (let i = 0; i < 3; i++) { - const particles = new THREE.Mesh(geometry, getMaterial(count, colors[i], sprite)); - particles.layers.set(i); - particles.count = count; - scene.add(particles); - } - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // GUI - - const layers = { - Red: true, - Yellow: true, - Green: true, - }; - - const gui = renderer.inspector.createParameters('Layers'); - - gui.add(layers, 'Red').onChange(() => { - camera.layers.toggle(0); - }); - - gui.add(layers, 'Yellow').onChange(() => { - camera.layers.toggle(1); - }); - - gui.add(layers, 'Green').onChange(() => { - camera.layers.toggle(2); - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function getMaterial(count, color, sprite) { - // instance data - - const positions = []; - const rotations = []; - const directions = []; - const timeOffsets = []; - - const v = new THREE.Vector3(); - - for (let i = 0; i < count; i++) { - positions.push( - THREE.MathUtils.randFloat(-25, -20), - THREE.MathUtils.randFloat(-10, 50), - THREE.MathUtils.randFloat(-5, 5), - ); - - v.set(THREE.MathUtils.randFloat(0.7, 0.9), THREE.MathUtils.randFloat(-0.3, -0.15), 0).normalize(); - - rotations.push(Math.random(), Math.random(), Math.random()); - - directions.push(v.x, v.y, v.z); - - timeOffsets.push(i / count); - } - - const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); - const rotationAttribute = new THREE.InstancedBufferAttribute(new Float32Array(rotations), 3); - const directionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(directions), 3); - const timeAttribute = new THREE.InstancedBufferAttribute(new Float32Array(timeOffsets), 1); - - // material - - const material = new THREE.MeshBasicNodeMaterial({ - color: color, - map: sprite, - alphaMap: sprite, - alphaTest: 0.1, - side: THREE.DoubleSide, - forceSinglePass: true, - }); - - // TSL - - const instancePosition = instancedBufferAttribute(positionAttribute); - const instanceDirection = instancedBufferAttribute(directionAttribute); - const instanceRotation = instancedBufferAttribute(rotationAttribute); - - const localTime = instancedBufferAttribute(timeAttribute).add(time.mul(0.02)); - const modTime = mod(localTime, 1.0); - - const rotatedPosition = rotate(positionLocal, instanceRotation.mul(modTime.mul(20))); - material.positionNode = rotatedPosition.add(instancePosition).add(instanceDirection.mul(modTime.mul(50))); - - return material; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lensflares.ts b/examples-testing/examples/webgpu_lensflares.ts deleted file mode 100644 index ab4e49677..000000000 --- a/examples-testing/examples/webgpu_lensflares.ts +++ /dev/null @@ -1,137 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { FlyControls } from 'three/addons/controls/FlyControls.js'; -import { LensflareMesh, LensflareElement } from 'three/addons/objects/LensflareMesh.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let container; - -let camera, scene, renderer; -let controls; - -const timer = new THREE.Timer(); -timer.connect(document); - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - // camera - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 15000); - camera.position.z = 250; - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color().setHSL(0.51, 0.4, 0.01, THREE.SRGBColorSpace); - scene.fog = new THREE.Fog(scene.background, 3500, 15000); - - // world - - const s = 250; - - const geometry = new THREE.BoxGeometry(s, s, s); - const material = new THREE.MeshPhongNodeMaterial({ color: 0xffffff, specular: 0xffffff, shininess: 50 }); - - for (let i = 0; i < 3000; i++) { - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = 8000 * (2.0 * Math.random() - 1.0); - mesh.position.y = 8000 * (2.0 * Math.random() - 1.0); - mesh.position.z = 8000 * (2.0 * Math.random() - 1.0); - - mesh.rotation.x = Math.random() * Math.PI; - mesh.rotation.y = Math.random() * Math.PI; - mesh.rotation.z = Math.random() * Math.PI; - - mesh.matrixAutoUpdate = false; - mesh.updateMatrix(); - - scene.add(mesh); - } - - // lights - - const dirLight = new THREE.DirectionalLight(0xffffff, 0.15); - dirLight.position.set(0, -1, 0).normalize(); - dirLight.color.setHSL(0.1, 0.7, 0.5); - scene.add(dirLight); - - // lensflares - const textureLoader = new THREE.TextureLoader(); - - const textureFlare0 = textureLoader.load('textures/lensflare/lensflare0.png'); - const textureFlare3 = textureLoader.load('textures/lensflare/lensflare3.png'); - - textureFlare0.colorSpace = THREE.SRGBColorSpace; - textureFlare3.colorSpace = THREE.SRGBColorSpace; - - addLight(0.55, 0.95, 0.6, 5000, 0, -1000); - addLight(0.1, 0.85, 0.65, 0, 0, -1000); - addLight(0.995, 0.5, 0.95, 5000, 5000, -1000); - - function addLight(h, s, l, x, y, z) { - const light = new THREE.PointLight(0xffffff, 1.5, 2000, 0); - light.color.setHSL(h, s, l); - light.position.set(x, y, z); - scene.add(light); - - const lensflare = new LensflareMesh(); - lensflare.addElement(new LensflareElement(textureFlare0, 700, 0, light.color)); - lensflare.addElement(new LensflareElement(textureFlare3, 60, 0.6)); - lensflare.addElement(new LensflareElement(textureFlare3, 70, 0.7)); - lensflare.addElement(new LensflareElement(textureFlare3, 120, 0.9)); - lensflare.addElement(new LensflareElement(textureFlare3, 70, 1)); - light.add(lensflare); - } - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // - - controls = new FlyControls(camera, renderer.domElement); - - controls.movementSpeed = 2500; - controls.domElement = container; - controls.rollSpeed = Math.PI / 6; - controls.autoForward = false; - controls.dragToLook = false; - - // events - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -// - -function animate() { - timer.update(); - - render(); -} - -function render() { - const delta = timer.getDelta(); - - controls.update(delta); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lightprobe.ts b/examples-testing/examples/webgpu_lightprobe.ts deleted file mode 100644 index 3e90b6f66..000000000 --- a/examples-testing/examples/webgpu_lightprobe.ts +++ /dev/null @@ -1,136 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; - -import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js'; - -let mesh, renderer, scene, camera; - -let gui; - -let lightProbe; -let directionalLight; - -// linear color space -const API = { - lightProbeIntensity: 1.0, - directionalLightIntensity: 0.6, - envMapIntensity: 1, -}; - -init(); - -function init() { - // renderer - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // tone mapping - renderer.toneMapping = THREE.NoToneMapping; - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 30); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 10; - controls.maxDistance = 50; - controls.enablePan = false; - - // probe - lightProbe = new THREE.LightProbe(); - scene.add(lightProbe); - - // light - directionalLight = new THREE.DirectionalLight(0xffffff, API.directionalLightIntensity); - directionalLight.position.set(10, 10, 10); - scene.add(directionalLight); - - // envmap - const genCubeUrls = function (prefix, postfix) { - return [ - prefix + 'px' + postfix, - prefix + 'nx' + postfix, - prefix + 'py' + postfix, - prefix + 'ny' + postfix, - prefix + 'pz' + postfix, - prefix + 'nz' + postfix, - ]; - }; - - const urls = genCubeUrls('textures/cube/pisa/', '.png'); - - new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { - scene.background = cubeTexture; - - lightProbe.copy(LightProbeGenerator.fromCubeTexture(cubeTexture)); - lightProbe.intensity = API.lightProbeIntensity; - lightProbe.position.set(-10, 0, 0); // position not used in scene lighting calculations (helper honors the position, however) - - const geometry = new THREE.SphereGeometry(5, 64, 32); - //const geometry = new THREE.TorusKnotGeometry( 4, 1.5, 256, 32, 2, 3 ); - - const material = new THREE.MeshStandardMaterial({ - color: 0xffffff, - metalness: 0, - roughness: 0, - envMap: cubeTexture, - envMapIntensity: API.envMapIntensity, - }); - - // mesh - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // helper - const helper = new LightProbeHelper(lightProbe, 1); - scene.add(helper); - }); - - // gui - gui = renderer.inspector.createParameters('Intensity'); - - gui.add(API, 'lightProbeIntensity', 0, 1, 0.02) - .name('light probe') - .onChange(function () { - lightProbe.intensity = API.lightProbeIntensity; - }); - - gui.add(API, 'directionalLightIntensity', 0, 1, 0.02) - .name('directional light') - .onChange(function () { - directionalLight.intensity = API.directionalLightIntensity; - }); - - gui.add(API, 'envMapIntensity', 0, 1, 0.02) - .name('envMap') - .onChange(function () { - mesh.material.envMapIntensity = API.envMapIntensity; - }); - - // listener - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lightprobe_cubecamera.ts b/examples-testing/examples/webgpu_lightprobe_cubecamera.ts deleted file mode 100644 index 60fe6ccc9..000000000 --- a/examples-testing/examples/webgpu_lightprobe_cubecamera.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js'; -import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; - -let renderer, scene, camera, cubeCamera; - -let lightProbe; - -init(); - -function init() { - // renderer - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 0, 30); - - const cubeRenderTarget = new THREE.CubeRenderTarget(256); - - cubeCamera = new THREE.CubeCamera(1, 1000, cubeRenderTarget); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); - controls.minDistance = 10; - controls.maxDistance = 50; - controls.enablePan = false; - - // probe - lightProbe = new THREE.LightProbe(); - scene.add(lightProbe); - - // envmap - const genCubeUrls = function (prefix, postfix) { - return [ - prefix + 'px' + postfix, - prefix + 'nx' + postfix, - prefix + 'py' + postfix, - prefix + 'ny' + postfix, - prefix + 'pz' + postfix, - prefix + 'nz' + postfix, - ]; - }; - - const urls = genCubeUrls('textures/cube/pisa/', '.png'); - - new THREE.CubeTextureLoader().load(urls, async function (cubeTexture) { - scene.background = cubeTexture; - - await renderer.init(); - - cubeCamera.update(renderer, scene); - - const probe = await LightProbeGenerator.fromCubeRenderTarget(renderer, cubeRenderTarget); - - lightProbe.copy(probe); - - scene.add(new LightProbeHelper(lightProbe, 5)); - - render(); - }); - - // listener - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lightprobes.ts b/examples-testing/examples/webgpu_lightprobes.ts deleted file mode 100644 index 1afef5fde..000000000 --- a/examples-testing/examples/webgpu_lightprobes.ts +++ /dev/null @@ -1,195 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; -import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; - -let camera, scene, renderer, controls; -let probes, probesHelper; - -init(); - -async function init() { - // Camera - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 2.5, 8); - - // Scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x111111); - - // Cornell box - - const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc }); - const redMaterial = new THREE.MeshStandardMaterial({ color: 0xff0000 }); - const greenMaterial = new THREE.MeshStandardMaterial({ color: 0x00ff00 }); - - // Floor - const floor = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); - floor.rotation.x = -Math.PI / 2; - floor.receiveShadow = true; - scene.add(floor); - - // Ceiling - const ceiling = new THREE.Mesh(new THREE.PlaneGeometry(6, 6), wallMaterial); - ceiling.rotation.x = Math.PI / 2; - ceiling.position.y = 5; - ceiling.receiveShadow = true; - scene.add(ceiling); - - // Back wall - const backWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); - backWall.position.set(0, 2.5, -3); - backWall.receiveShadow = true; - scene.add(backWall); - - // Front wall - const frontWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), wallMaterial); - frontWall.rotation.y = Math.PI; - frontWall.position.set(0, 2.5, 3); - frontWall.receiveShadow = true; - scene.add(frontWall); - - // Left wall (red) - const leftWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), redMaterial); - leftWall.rotation.y = Math.PI / 2; - leftWall.position.set(-3, 2.5, 0); - leftWall.receiveShadow = true; - scene.add(leftWall); - - // Right wall (green) - const rightWall = new THREE.Mesh(new THREE.PlaneGeometry(6, 5), greenMaterial); - rightWall.rotation.y = -Math.PI / 2; - rightWall.position.set(3, 2.5, 0); - rightWall.receiveShadow = true; - scene.add(rightWall); - - // Objects inside the box - - const objectMaterial = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); - - // Tall box - const tallBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 2.5, 1.2), objectMaterial); - tallBox.position.set(-0.8, 1.25, -0.8); - tallBox.rotation.y = Math.PI / 8; - tallBox.castShadow = true; - tallBox.receiveShadow = true; - scene.add(tallBox); - - // Short box - const shortBox = new THREE.Mesh(new THREE.BoxGeometry(1.2, 1.2, 1.2), objectMaterial); - shortBox.position.set(1, 0.6, 0.5); - shortBox.rotation.y = -Math.PI / 6; - shortBox.castShadow = true; - shortBox.receiveShadow = true; - scene.add(shortBox); - - // Sphere (to show smooth GI variation) - const sphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 32, 32), objectMaterial.clone()); - sphere.position.set(1, 1.9, 0.5); - sphere.castShadow = true; - sphere.receiveShadow = true; - scene.add(sphere); - - // Light - const light = new THREE.PointLight(0xffffff, 40); - light.position.set(0, 4.5, 0); - light.castShadow = true; - light.shadow.mapSize.setScalar(256); - light.shadow.radius = 10; - light.shadow.normalBias = -0.02; - scene.add(light); - - // Renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.0; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // Controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2.5, 0); - controls.update(); - - // Bake light probe volume - - async function bake(resolution) { - if (probes) { - scene.remove(probes); - probes.dispose(); - } - - probes = new LightProbeGrid(5.6, 4.7, 5.6, resolution, resolution, resolution); - probes.position.set(0, 2.45, 0); - await probes.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); - probes.visible = params.enabled; - scene.add(probes); - - // Update debug visualization - - if (!probesHelper) { - probesHelper = new LightProbeGridHelper(probes); - probesHelper.visible = params.showProbes; - scene.add(probesHelper); - } else { - probesHelper.probes = probes; - probesHelper.update(); - } - } - - const params = { - enabled: true, - showProbes: false, - resolution: 6, - }; - - await bake(params.resolution); - - // GUI - - const gui = renderer.inspector.createParameters('Light Probes'); - gui.add(params, 'enabled') - .name('GI') - .onChange(value => { - probes.visible = value; - }); - - gui.add(params, 'resolution', 2, 12, 1) - .name('Resolution') - .onChange(value => { - bake(value); - }) - .debounce(250); - gui.add(params, 'showProbes') - .name('Show Probes') - .onChange(value => { - probesHelper.visible = value; - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lightprobes_complex.ts b/examples-testing/examples/webgpu_lightprobes_complex.ts deleted file mode 100644 index 944b5fc7c..000000000 --- a/examples-testing/examples/webgpu_lightprobes_complex.ts +++ /dev/null @@ -1,313 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; -import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; - -let camera, scene, renderer, controls; -let probesLeft, probesRight; -let probesHelperLeft, probesHelperRight; - -init(); - -async function init() { - // Camera - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 2.5, 16); - - // Scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x111111); - - // Materials - - const wallMaterial = new THREE.MeshStandardMaterial({ color: 0xcccccc, side: THREE.BackSide }); - const whiteMat = new THREE.MeshStandardMaterial({ color: 0xeeeeee }); - - // Room shell: x=-8 to 8, z=-4 to 4, y=0 to 5 - - const room = new THREE.Mesh(new THREE.BoxGeometry(16, 5, 8), wallMaterial); - room.position.set(0, 2.5, 0); - room.receiveShadow = true; - scene.add(room); - - const redWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0xdd2200 })); - redWall.rotation.y = Math.PI / 2; - redWall.position.set(-7.99, 2.5, 0); - scene.add(redWall); - - const blueWall = new THREE.Mesh(new THREE.PlaneGeometry(8, 5), new THREE.MeshStandardMaterial({ color: 0x0044ff })); - blueWall.rotation.y = -Math.PI / 2; - blueWall.position.set(7.99, 2.5, 0); - scene.add(blueWall); - - // Dividing wall at x=0 with doorway - - const dividerMat = new THREE.MeshStandardMaterial({ color: 0xcccccc }); - const doorwayHalfGap = 1.25; - - // Left section of divider (z = -4 to -1.25) - const dividerLeft = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); - dividerLeft.position.set(0, 2.5, -(doorwayHalfGap + (4 - doorwayHalfGap) / 2)); - dividerLeft.castShadow = true; - dividerLeft.receiveShadow = true; - scene.add(dividerLeft); - - // Right section of divider (z = 1.25 to 4) - const dividerRight = new THREE.Mesh(new THREE.BoxGeometry(0.3, 5, 4 - doorwayHalfGap), dividerMat); - dividerRight.position.set(0, 2.5, doorwayHalfGap + (4 - doorwayHalfGap) / 2); - dividerRight.castShadow = true; - dividerRight.receiveShadow = true; - scene.add(dividerRight); - - // Lintel above doorway - const lintel = new THREE.Mesh(new THREE.BoxGeometry(0.3, 1.2, doorwayHalfGap * 2), dividerMat); - lintel.position.set(0, 4.4, 0); - lintel.castShadow = true; - lintel.receiveShadow = true; - scene.add(lintel); - - // Left room objects - - // Columns - const columnGeom = new THREE.CylinderGeometry(0.3, 0.3, 4, 16); - - for (const x of [-6, -2]) { - for (const z of [-2.5, 2.5]) { - const col = new THREE.Mesh(columnGeom, whiteMat); - col.position.set(x, 2, z); - col.castShadow = true; - col.receiveShadow = true; - scene.add(col); - } - } - - // Table with golden sphere - const tableTop = new THREE.Mesh( - new THREE.BoxGeometry(2.4, 0.12, 1.4), - new THREE.MeshStandardMaterial({ color: 0x886644 }), - ); - tableTop.position.set(-4, 1.0, 0); - tableTop.castShadow = true; - tableTop.receiveShadow = true; - scene.add(tableTop); - - const legGeom = new THREE.BoxGeometry(0.1, 1, 0.1); - - for (const x of [-5.05, -2.95]) { - for (const z of [-0.55, 0.55]) { - const leg = new THREE.Mesh(legGeom, tableTop.material); - leg.position.set(x, 0.5, z); - leg.castShadow = true; - scene.add(leg); - } - } - - const sphere = new THREE.Mesh( - new THREE.SphereGeometry(0.35, 32, 32), - new THREE.MeshStandardMaterial({ color: 0xffd700, metalness: 0.3, roughness: 0.4 }), - ); - sphere.position.set(-4, 1.41, 0); - sphere.castShadow = true; - sphere.receiveShadow = true; - scene.add(sphere); - - // Stepped blocks near red wall - const step1 = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.5, 1), whiteMat); - step1.position.set(-7, 0.25, 0); - step1.castShadow = true; - step1.receiveShadow = true; - scene.add(step1); - - const step2 = new THREE.Mesh(new THREE.BoxGeometry(1.0, 1.0, 1), whiteMat); - step2.position.set(-7, 0.5, 0); - step2.castShadow = true; - step2.receiveShadow = true; - scene.add(step2); - - const step3 = new THREE.Mesh(new THREE.BoxGeometry(0.5, 1.5, 1), whiteMat); - step3.position.set(-7, 0.75, 0); - step3.castShadow = true; - step3.receiveShadow = true; - scene.add(step3); - - // Right room objects - - // Columns - for (const x of [2, 6]) { - for (const z of [-2.5, 2.5]) { - const col = new THREE.Mesh(columnGeom, whiteMat); - col.position.set(x, 2, z); - col.castShadow = true; - col.receiveShadow = true; - scene.add(col); - } - } - - // Pedestal with torus knot - const pedestal = new THREE.Mesh(new THREE.BoxGeometry(0.8, 1.2, 0.8), whiteMat); - pedestal.position.set(4, 0.6, 0); - pedestal.castShadow = true; - pedestal.receiveShadow = true; - scene.add(pedestal); - - const torusKnot = new THREE.Mesh( - new THREE.TorusKnotGeometry(0.3, 0.1, 64, 16), - new THREE.MeshStandardMaterial({ color: 0xff44aa, metalness: 0.2, roughness: 0.5 }), - ); - torusKnot.position.set(4, 1.65, 0); - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - // Tall cone sculpture - const sculpture = new THREE.Mesh(new THREE.ConeGeometry(0.4, 2.5, 5), whiteMat); - sculpture.position.set(6.5, 1.25, -1.5); - sculpture.castShadow = true; - sculpture.receiveShadow = true; - scene.add(sculpture); - - // Lights - - // Warm point light in left room - const warmLight = new THREE.PointLight(0xffaa44, 30); - warmLight.position.set(-4, 4.5, 0); - warmLight.castShadow = true; - warmLight.shadow.mapSize.setScalar(256); - warmLight.shadow.radius = 12; - warmLight.shadow.bias = -0.002; - scene.add(warmLight); - - // Cool point light in right room - const coolLight = new THREE.PointLight(0x88bbff, 30); - coolLight.position.set(4, 4.5, 0); - coolLight.castShadow = true; - coolLight.shadow.mapSize.setScalar(256); - coolLight.shadow.radius = 12; - coolLight.shadow.bias = -0.002; - scene.add(coolLight); - - // Renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.0; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // Controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2.5, 0); - controls.update(); - - // Probe volumes - - const params = { - enabled: true, - showProbes: false, - resolution: 6, - }; - - async function bake(resolution) { - // Remove both volumes before baking to prevent feedback - - if (probesLeft) { - scene.remove(probesLeft); - probesLeft.dispose(); - } - - if (probesRight) { - scene.remove(probesRight); - probesRight.dispose(); - } - - // Bake both volumes. The `falloff` fades each volume past its - // boundary so the two rooms blend smoothly without bleeding into - // each other. - - probesLeft = new LightProbeGrid(7.8, 4.7, 7.6, resolution, resolution, resolution); - probesLeft.position.set(-3.9, 2.45, 0); - probesLeft.falloff = 1.0; - await probesLeft.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); - probesLeft.visible = params.enabled; - - probesRight = new LightProbeGrid(7.8, 4.7, 7.6, resolution, resolution, resolution); - probesRight.position.set(3.9, 2.45, 0); - probesRight.falloff = 1.0; - await probesRight.bake(renderer, scene, { cubemapSize: 32, near: 0.05, far: 20 }); - probesRight.visible = params.enabled; - - // Add both after baking - - scene.add(probesLeft); - scene.add(probesRight); - - // Update debug visualization - - if (!probesHelperLeft) { - probesHelperLeft = new LightProbeGridHelper(probesLeft); - probesHelperLeft.visible = params.showProbes; - scene.add(probesHelperLeft); - - probesHelperRight = new LightProbeGridHelper(probesRight); - probesHelperRight.visible = params.showProbes; - scene.add(probesHelperRight); - } else { - probesHelperLeft.probes = probesLeft; - probesHelperLeft.update(); - - probesHelperRight.probes = probesRight; - probesHelperRight.update(); - } - } - - await bake(params.resolution); - - // GUI - - const gui = renderer.inspector.createParameters('Light Probes'); - gui.add(params, 'enabled') - .name('GI') - .onChange(value => { - probesLeft.visible = value; - probesRight.visible = value; - }); - - gui.add(params, 'resolution', 2, 12, 1) - .name('Resolution') - .onChange(value => { - bake(value); - }) - .debounce(250); - gui.add(params, 'showProbes') - .name('Show Probes') - .onChange(value => { - probesHelperLeft.visible = value; - probesHelperRight.visible = value; - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lightprobes_sponza.ts b/examples-testing/examples/webgpu_lightprobes_sponza.ts deleted file mode 100644 index a73fd1e5b..000000000 --- a/examples-testing/examples/webgpu_lightprobes_sponza.ts +++ /dev/null @@ -1,339 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; -import { LightProbeGrid } from 'three/addons/lighting/LightProbeGrid.js'; -import { LightProbeGridHelper } from 'three/addons/helpers/LightProbeGridHelper.js'; - -const MODEL_INDEX_URL = - 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json'; -const SAMPLE_ASSETS_BASE_URL = 'https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/'; - -let camera, scene, renderer, controls, timer; -let probes = null, - probesHelper = null; -let modelSize = null; -let dirLight = null, - sky = null; - -const sun = new THREE.Vector3(); - -const _box = new THREE.Box3(); -const _size = new THREE.Vector3(); -const _center = new THREE.Vector3(); - -init(); - -async function init() { - timer = new THREE.Timer(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(-10.25, 4.99, 0.4); - camera.rotation.set(1.6505, -1.5008, 1.6507); - - scene = new THREE.Scene(); - - sky = new SkyMesh(); - sky.scale.setScalar(450000); - sky.turbidity.value = 10; - sky.rayleigh.value = 2; - sky.mieCoefficient.value = 0.005; - sky.mieDirectionalG.value = 0.8; - scene.add(sky); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(Math.min(window.devicePixelRatio, 1.5)); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.0; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - controls = new FirstPersonControls(camera, renderer.domElement); - controls.movementSpeed = 2.0; - controls.lookSpeed = 0.16; - - const progressBar = document.getElementById('progressBar'); - - const manager = new THREE.LoadingManager(); - manager.onProgress = function (url, loaded, total) { - progressBar.value = (loaded / total) * 100; - }; - - manager.onLoad = function () { - progressBar.remove(); - }; - - const loader = new GLTFLoader(manager); - const modelURL = await getSponzaModelURL(); - const gltf = await loader.loadAsync(modelURL); - const model = gltf.scene; - const embeddedLights = []; - - model.traverse(child => { - if (child.isMesh) { - child.castShadow = true; - child.receiveShadow = true; - } else if (child.isLight) { - embeddedLights.push(child); - } - }); - - for (const light of embeddedLights) { - if (light.parent) light.parent.remove(light); - } - - scene.add(model); - - _box.setFromObject(model); - modelSize = _box.getSize(_size).clone(); - const modelCenter = _box.getCenter(_center).clone(); - const targetY = modelCenter.y + modelSize.y * 0.2; - const lightBaseDistance = Math.max(modelSize.x, modelSize.z); - const probeFar = Math.max(modelSize.x, modelSize.y, modelSize.z) * 2.0; - let rebakeTimer = null; - let isBaking = false; - let bakeQueued = false; - - dirLight = new THREE.DirectionalLight(0xfff2dc, 100.0); - dirLight.target.position.set(modelCenter.x, targetY, modelCenter.z); - scene.add(dirLight.target); - dirLight.castShadow = true; - dirLight.shadow.mapSize.setScalar(2048); - const shadowExtent = Math.max(modelSize.x, modelSize.z) * 0.7; - dirLight.shadow.camera.left = -shadowExtent; - dirLight.shadow.camera.right = shadowExtent; - dirLight.shadow.camera.top = shadowExtent; - dirLight.shadow.camera.bottom = -shadowExtent; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = modelSize.y * 4.0; - scene.add(dirLight); - - const params = { - enabled: true, - showProbes: false, - probeSize: 0.2, - boundsX: -0.5, - boundsY: 6, - boundsZ: -0.3, - sizeX: 21, - sizeY: 11, - sizeZ: 9, - countX: 10, - countY: 7, - countZ: 7, - bounces: 1, - lightAzimuth: -45, - lightElevation: 55, - lightIntensity: 100.0, - shadows: true, - }; - - function updateLightPosition() { - const azimuth = THREE.MathUtils.degToRad(params.lightAzimuth); - const elevation = THREE.MathUtils.degToRad(params.lightElevation); - const radius = lightBaseDistance; - const horizontal = Math.cos(elevation) * radius; - const vertical = Math.sin(elevation) * radius; - - dirLight.position.set( - modelCenter.x + Math.cos(azimuth) * horizontal, - targetY + vertical, - modelCenter.z + Math.sin(azimuth) * horizontal, - ); - dirLight.target.position.set(modelCenter.x, targetY, modelCenter.z); - dirLight.target.updateMatrixWorld(); - - const phi = THREE.MathUtils.degToRad(90 - params.lightElevation); - const theta = THREE.MathUtils.degToRad(params.lightAzimuth); - sun.setFromSphericalCoords(1, phi, theta); - sky.sunPosition.value.copy(sun); - } - - function scheduleRebake() { - if (rebakeTimer !== null) clearTimeout(rebakeTimer); - rebakeTimer = setTimeout(() => { - rebakeTimer = null; - bakeWithSettings(); - }, 250); - } - - async function bakeWithSettings() { - if (isBaking) { - bakeQueued = true; - return; - } - - isBaking = true; - - do { - bakeQueued = false; - - if (probes) { - scene.remove(probes); - probes.dispose(); - } - - probes = new LightProbeGrid( - params.sizeX, - params.sizeY, - params.sizeZ, - params.countX, - params.countY, - params.countZ, - ); - probes.position.set(params.boundsX, params.boundsY, params.boundsZ); - // Add to the scene before baking so bounce passes can sample the prior pass's atlas. - scene.add(probes); - // Hide the helper spheres so they don't appear in the cubemap captures. - if (probesHelper) probesHelper.visible = false; - await probes.bake(renderer, scene, { - cubemapSize: 32, - near: 0.05, - far: probeFar, - bounces: params.bounces, - }); - probes.visible = params.enabled; - - if (!probesHelper) { - probesHelper = new LightProbeGridHelper(probes, params.probeSize); - probesHelper.visible = params.showProbes; - scene.add(probesHelper); - } else { - probesHelper.probes = probes; - probesHelper.update(); - probesHelper.visible = params.showProbes; - } - } while (bakeQueued); - - isBaking = false; - } - - updateLightPosition(); - - const gui = renderer.inspector.createParameters('Light Probes'); - gui.add(params, 'enabled') - .name('GI') - .onChange(value => { - if (probes) probes.visible = value; - }); - - gui.add(params, 'lightAzimuth', -180, 180, 1) - .name('Light Azimuth') - .onChange(() => { - updateLightPosition(); - scheduleRebake(); - }); - gui.add(params, 'lightElevation', 5, 85, 1) - .name('Light Elevation') - .onChange(() => { - updateLightPosition(); - scheduleRebake(); - }); - gui.add(params, 'lightIntensity', 0, 100, 0.1) - .name('Light Intensity') - .onChange(value => { - dirLight.intensity = value; - scheduleRebake(); - }); - gui.add(params, 'shadows') - .name('Shadows') - .onChange(value => { - setShadowsEnabled(value); - scheduleRebake(); - }); - - gui.add(params, 'countX', 2, 32, 1).name('Probes X').onChange(scheduleRebake); - gui.add(params, 'countY', 2, 16, 1).name('Probes Y').onChange(scheduleRebake); - gui.add(params, 'countZ', 2, 16, 1).name('Probes Z').onChange(scheduleRebake); - gui.add(params, 'bounces', 0, 2, 1).name('Bounces').onChange(scheduleRebake); - - gui.add(params, 'showProbes') - .name('Show Probes') - .onChange(value => { - if (probesHelper) probesHelper.visible = value; - }); - gui.add(params, 'probeSize', 0.05, 2.0, 0.05) - .name('Probe Size') - .onChange(value => { - if (probesHelper) { - scene.remove(probesHelper); - probesHelper.dispose(); - probesHelper = new LightProbeGridHelper(probes, value); - probesHelper.visible = params.showProbes; - scene.add(probesHelper); - } - }); - - gui.add( - { - log: () => { - console.log( - 'position:', - camera.position.x.toFixed(2), - camera.position.y.toFixed(2), - camera.position.z.toFixed(2), - ); - console.log( - 'rotation:', - camera.rotation.x.toFixed(4), - camera.rotation.y.toFixed(4), - camera.rotation.z.toFixed(4), - ); - }, - }, - 'log', - ).name('Log Camera'); - - setShadowsEnabled(params.shadows); - await bakeWithSettings(); - - window.addEventListener('resize', onWindowResize); -} - -async function getSponzaModelURL() { - const response = await fetch(MODEL_INDEX_URL); - const models = await response.json(); - const sponzaInfo = models.find(model => model.name === 'Sponza'); - - if (!sponzaInfo) { - throw new Error('Sponza entry was not found in the glTF sample model index.'); - } - - const variants = sponzaInfo.variants || {}; - const variantName = - variants['glTF-Binary'] || variants['glTF'] || variants['glTF-Embedded'] || Object.values(variants)[0]; - - if (!variantName) { - throw new Error('Sponza has no supported glTF variant in the model index.'); - } - - const variantFolder = variantName.endsWith('.glb') ? 'glTF-Binary' : 'glTF'; - return `${SAMPLE_ASSETS_BASE_URL}${sponzaInfo.name}/${variantFolder}/${variantName}`; -} - -function setShadowsEnabled(enabled) { - if (!renderer || !dirLight) return; - - renderer.shadowMap.enabled = enabled; - dirLight.castShadow = enabled; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(timestamp) { - timer.update(timestamp); - controls.update(timer.getDelta()); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lights_clustered.ts b/examples-testing/examples/webgpu_lights_clustered.ts deleted file mode 100644 index cf86514ba..000000000 --- a/examples-testing/examples/webgpu_lights_clustered.ts +++ /dev/null @@ -1,228 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { instancedBufferAttribute, pass, uniform, vec3, float, mix, step, renderOutput } from 'three/tsl'; -import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; - -import { ClusteredLighting } from 'three/addons/lighting/ClusteredLighting.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -const GRID = 30; // GRID x GRID spheres -const SPACING = 5; -const RADIUS = 0.5; -const WAVE_HEIGHT = 4; -const BIG_RADIUS = 6; -const BASE_POWER = 45; - -let camera, scene, renderer, controls, spheresMesh, lighting; -let renderPipeline, scenePass, clusterInfluence, debugZSliceNode; - -const balls = []; -const dummy = new THREE.Object3D(); - -const params = { - intensity: 1, - animate: true, -}; - -init(); - -async function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 200); - camera.position.set(36, 18, 36); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1; - lighting = new ClusteredLighting(); - renderer.lighting = lighting; // set lighting system - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // ground - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(1000, 1000).rotateX(-Math.PI / 2), - new THREE.MeshPhongNodeMaterial({ color: 0x2a2a2a, shininess: 80 }), - ); - scene.add(ground); - - // four big spheres in the middle for the surrounding lights to play across - - const bigPositions = [ - new THREE.Vector3(-9, BIG_RADIUS, -9), - new THREE.Vector3(9, BIG_RADIUS, -9), - new THREE.Vector3(-9, BIG_RADIUS, 9), - new THREE.Vector3(9, BIG_RADIUS, 9), - ]; - - const bigGeometry = new THREE.SphereGeometry(BIG_RADIUS, 64, 32); - const bigMaterial = new THREE.MeshPhongNodeMaterial({ color: 0xdddddd, shininess: 80 }); - - for (const position of bigPositions) { - const bigSphere = new THREE.Mesh(bigGeometry, bigMaterial); - bigSphere.position.copy(position); - scene.add(bigSphere); - } - - // a grid of coloured spheres drawn as a single InstancedMesh; each is - // unlit in its own colour and holds a matching point light at its centre - - const maxCount = GRID * GRID; - const colorAttribute = new THREE.InstancedBufferAttribute(new Float32Array(maxCount * 3), 3); - - const material = new THREE.MeshBasicNodeMaterial(); - material.colorNode = instancedBufferAttribute(colorAttribute); - - spheresMesh = new THREE.InstancedMesh(new THREE.SphereGeometry(RADIUS, 32, 16), material, maxCount); - spheresMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); - scene.add(spheresMesh); - - const color = new THREE.Color(); - const span = (GRID - 1) * SPACING; - - let i = 0; - - for (let ix = 0; ix < GRID; ix++) { - for (let iz = 0; iz < GRID; iz++) { - const x = ix * SPACING - span / 2; - const z = iz * SPACING - span / 2; - - // leave a clearing where a big sphere sits - if (bigPositions.some(position => Math.hypot(x - position.x, z - position.z) < BIG_RADIUS + 1)) continue; - - const phase = (ix + iz) * 0.5; - - dummy.position.set(x, RADIUS, z); - dummy.updateMatrix(); - spheresMesh.setMatrixAt(i, dummy.matrix); - - color.setHSL((ix * GRID + iz) / (GRID * GRID), 1.0, 0.5); - colorAttribute.setXYZ(i, color.r, color.g, color.b); - - const light = new THREE.PointLight(color, 1, 9); - light.power = BASE_POWER; - light.position.set(x, RADIUS, z); - scene.add(light); - - balls.push({ x, z, phase, light }); - - i++; - } - } - - spheresMesh.count = i; - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target.set(0, 6, 0); - controls.maxPolarAngle = Math.PI * 0.49; - controls.minDistance = 4; - controls.maxDistance = 400; - controls.update(); - - // post-processing: a debug overlay that tints each screen tile by how many - // lights its cluster holds, for the selected depth slice - - scenePass = pass(scene, camera); - clusterInfluence = uniform(0); - - debugZSliceNode = uniform(20, 'int'); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = false; - - updatePostProcessing(); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'intensity', 0, 3) - .name('light intensity') - .onChange(value => { - for (const ball of balls) ball.light.power = BASE_POWER * value; - }); - gui.add(params, 'animate'); - gui.add(clusterInfluence, 'value', 0, 0.7).name('lights per tile'); - gui.add(debugZSliceNode, 'value', 0, lighting.zSlices - 1, 1).name('z-slice'); - - // events - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - updatePostProcessing(); -} - -function updatePostProcessing() { - // the overlay samples the cluster grid at the current resolution, so it - // is rebuilt whenever the renderer size changes - - const lightingNode = lighting - .getNode(scene) - .setSize(window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio); - - // map the light count of each cluster ( 0 … maxLightsPerCluster ) to a - // blue → green → red gradient - const lightCount = lightingNode.getClusterLightCount(debugZSliceNode); - const heatmap = float(lightCount).div(float(lighting.maxLightsPerCluster)); - - let heatColor = mix(vec3(0.0, 0.0, 1.0), vec3(0.0, 1.0, 0.0), heatmap.mul(2.0).saturate()); - heatColor = mix(heatColor, vec3(1.0, 0.0, 0.0), heatmap.sub(0.5).mul(2.0).saturate()); - - // blend the heatmap over the scene by the slider amount; step() keeps - // empty clusters transparent - const finalInfluence = clusterInfluence.mul(step(0.0001, heatmap)); - - const outputPass = renderOutput(mix(scenePass, heatColor, finalInfluence)); - - renderPipeline.outputNode = fxaa(outputPass); - renderPipeline.needsUpdate = true; -} - -function animate() { - if (params.animate === true) { - const time = performance.now() / 1000; - - for (let i = 0; i < balls.length; i++) { - const ball = balls[i]; - const y = RADIUS + (0.5 + 0.5 * Math.sin(time * 1.5 + ball.phase)) * WAVE_HEIGHT; - - dummy.position.set(ball.x, y, ball.z); - dummy.updateMatrix(); - spheresMesh.setMatrixAt(i, dummy.matrix); - - ball.light.position.y = y; - } - - spheresMesh.instanceMatrix.needsUpdate = true; - } - - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_lights_dynamic.ts b/examples-testing/examples/webgpu_lights_dynamic.ts deleted file mode 100644 index b08c5902f..000000000 --- a/examples-testing/examples/webgpu_lights_dynamic.ts +++ /dev/null @@ -1,242 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { DynamicLighting } from 'three/addons/lighting/DynamicLighting.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer, controls, timer, stats; - -const pointLights = []; -let autoAddInterval = null; - -const params = { - dynamic: true, - autoAdd: false, - lightCount: 2, - addLight() { - addLight(); - }, - removeLight() { - removeLight(); - }, - removeAll() { - removeAllLights(); - }, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 200); - camera.position.set(0, 15, 30); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // Stats - - stats = new Stats(); - document.body.appendChild(stats.dom); - - // Floor - - const floorGeometry = new THREE.PlaneGeometry(120, 120); - const floorMaterial = new THREE.MeshStandardMaterial({ color: 0x444444, roughness: 0.8 }); - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.rotation.x = -Math.PI / 2; - scene.add(floor); - - // Shared geometries - - const sphereGeometry = new THREE.SphereGeometry(0.8, 128, 128); - const boxGeometry = new THREE.BoxGeometry(1.2, 1.2, 1.2, 64, 64, 64); - const torusGeometry = new THREE.TorusGeometry(0.6, 0.25, 128, 128); - const cylinderGeometry = new THREE.CylinderGeometry(0.5, 0.5, 1.4, 128, 64); - const coneGeometry = new THREE.ConeGeometry(0.6, 1.4, 128, 64); - - const geometries = [sphereGeometry, boxGeometry, torusGeometry, cylinderGeometry, coneGeometry]; - - // 100 meshes — first 50 with unique PBR materials, remaining 50 reuse them - - const uniqueMaterials = []; - - for (let i = 0; i < 50; i++) { - const material = new THREE.MeshStandardMaterial({ - color: new THREE.Color().setHSL(i / 50, 0.6 + Math.random() * 0.4, 0.35 + Math.random() * 0.3), - roughness: Math.random(), - metalness: Math.random(), - }); - material.name = 'Standard_' + i; - - uniqueMaterials.push(material); - } - - const meshesPerRing = 10; - - for (let i = 0; i < 100; i++) { - const material = i < 50 ? uniqueMaterials[i] : uniqueMaterials[i - 50]; - const geometry = geometries[i % geometries.length]; - const mesh = new THREE.Mesh(geometry, material); - - const ring = Math.floor(i / meshesPerRing); - const indexInRing = i % meshesPerRing; - const angle = (indexInRing / meshesPerRing) * Math.PI * 2 + ring * 0.3; - const radius = 6 + ring * 4; - - mesh.position.set(Math.cos(angle) * radius, 0.7 + Math.random() * 2, Math.sin(angle) * radius); - - mesh.rotation.set(Math.random() * Math.PI, Math.random() * Math.PI, 0); - - scene.add(mesh); - } - - // Center sphere - - const centerMaterial = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.1, metalness: 0.9 }); - const centerSphere = new THREE.Mesh(new THREE.SphereGeometry(2, 128, 128), centerMaterial); - centerSphere.position.y = 2; - scene.add(centerSphere); - - // Ambient light - - scene.add(new THREE.AmbientLight(0x404040, 0.5)); - - // Start with a couple point lights - - addLight(); - addLight(); - - // Renderer - - createRenderer(); - - // Inspector GUI - - window.addEventListener('resize', onWindowResize); -} - -function createRenderer() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - if (params.dynamic) renderer.lighting = new DynamicLighting(); - - // Inspector GUI - - const gui = renderer.inspector.createParameters('Dynamic Lights'); - - gui.add(params, 'dynamic') - .name('dynamic mode') - .onChange(() => { - renderer.dispose(); - document.body.removeChild(renderer.domElement); - clearInterval(autoAddInterval); - autoAddInterval = null; - params.autoAdd = false; - createRenderer(); - }); - - gui.add(params, 'autoAdd') - .name('auto-add lights') - .onChange(value => { - if (value) { - autoAddInterval = setInterval(() => { - addLight(); - }, 500); - } else { - clearInterval(autoAddInterval); - autoAddInterval = null; - } - }); - - gui.add(params, 'addLight').name('add light'); - gui.add(params, 'removeLight').name('remove light'); - gui.add(params, 'removeAll').name('remove all lights'); - gui.add(params, 'lightCount').name('point lights').listen(); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target.set(0, 2, 0); - controls.update(); -} - -function addLight() { - const color = new THREE.Color().setHSL(Math.random(), 0.8, 0.5); - const light = new THREE.PointLight(color, 1000); - - const angle = Math.random() * Math.PI * 2; - const radius = 5 + Math.random() * 20; - light.position.set(Math.cos(angle) * radius, 1 + Math.random() * 6, Math.sin(angle) * radius); - - light.userData.angle = angle; - light.userData.radius = radius; - light.userData.speed = 0.2 + Math.random() * 0.8; - light.userData.baseY = light.position.y; - - // Visual indicator - const sphere = new THREE.Mesh(new THREE.SphereGeometry(0.15, 8, 8), new THREE.MeshBasicMaterial({ color: color })); - light.add(sphere); - - scene.add(light); - pointLights.push(light); - - params.lightCount = pointLights.length; -} - -function removeLight() { - if (pointLights.length === 0) return; - - const light = pointLights.pop(); - scene.remove(light); - light.dispose(); - - params.lightCount = pointLights.length; -} - -function removeAllLights() { - while (pointLights.length > 0) { - const light = pointLights.pop(); - scene.remove(light); - light.dispose(); - } - - params.lightCount = 0; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const time = timer.getElapsed(); - - controls.update(); - - // Animate lights - - for (let i = 0; i < pointLights.length; i++) { - const light = pointLights[i]; - const d = light.userData; - const t = time * d.speed + d.angle; - - light.position.x = Math.cos(t) * d.radius; - light.position.z = Math.sin(t) * d.radius; - light.position.y = d.baseY + Math.sin(t * 2) * 0.5; - } - - renderer.render(scene, camera); - - stats.update(); -} diff --git a/examples-testing/examples/webgpu_lights_ies_spotlight.ts b/examples-testing/examples/webgpu_lights_ies_spotlight.ts deleted file mode 100644 index edfc51efa..000000000 --- a/examples-testing/examples/webgpu_lights_ies_spotlight.ts +++ /dev/null @@ -1,168 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from './jsm/controls/OrbitControls.js'; - -import { IESLoader } from 'three/addons/loaders/IESLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let renderer, scene, camera; -let lights; - -async function init() { - const iesLoader = new IESLoader().setPath('./ies/'); - //iesLoader.type = THREE.UnsignedByteType; // LDR - - const [iesTexture1, iesTexture2, iesTexture3, iesTexture4] = await Promise.all([ - iesLoader.loadAsync('007cfb11e343e2f42e3b476be4ab684e.ies'), - iesLoader.loadAsync('06b4cfdc8805709e767b5e2e904be8ad.ies'), - iesLoader.loadAsync('02a7562c650498ebb301153dbbf59207.ies'), - iesLoader.loadAsync('1a936937a49c63374e6d4fbed9252b29.ies'), - ]); - - // - - scene = new THREE.Scene(); - - // - - const spotLight = new THREE.IESSpotLight(0xff0000, 500); - spotLight.position.set(6.5, 3, 6.5); - spotLight.angle = Math.PI / 8; - spotLight.penumbra = 0.7; - spotLight.distance = 20; - spotLight.castShadow = true; - spotLight.iesMap = iesTexture1; - spotLight.userData.helper = new THREE.SpotLightHelper(spotLight); - scene.add(spotLight); - scene.add(spotLight.target); - scene.add(spotLight.userData.helper); - - // - - const spotLight2 = new THREE.IESSpotLight(0x00ff00, 500); - spotLight2.position.set(-6.5, 3, 6.5); - spotLight2.angle = Math.PI / 8; - spotLight2.penumbra = 0.7; - spotLight2.distance = 20; - spotLight2.castShadow = true; - spotLight2.iesMap = iesTexture2; - spotLight2.userData.helper = new THREE.SpotLightHelper(spotLight2); - scene.add(spotLight2); - scene.add(spotLight2.target); - scene.add(spotLight2.userData.helper); - - // - - const spotLight3 = new THREE.IESSpotLight(0x0000ff, 500); - spotLight3.position.set(-6.5, 3, -6.5); - spotLight3.angle = Math.PI / 8; - spotLight3.penumbra = 0.7; - spotLight3.distance = 20; - spotLight3.castShadow = true; - spotLight3.iesMap = iesTexture3; - spotLight3.userData.helper = new THREE.SpotLightHelper(spotLight3); - scene.add(spotLight3); - scene.add(spotLight3.target); - scene.add(spotLight3.userData.helper); - - // - - const spotLight4 = new THREE.IESSpotLight(0xffffff, 500); - spotLight4.position.set(6.5, 3, -6.5); - spotLight4.angle = Math.PI / 8; - spotLight4.penumbra = 0.7; - spotLight4.distance = 20; - spotLight4.castShadow = true; - spotLight4.iesMap = iesTexture4; - spotLight4.userData.helper = new THREE.SpotLightHelper(spotLight4); - scene.add(spotLight4); - scene.add(spotLight4.target); - scene.add(spotLight4.userData.helper); - - // - - lights = [spotLight, spotLight2, spotLight3, spotLight4]; - - // - - const material = new THREE.MeshPhongMaterial({ color: 0x999999 /*, dithering: true*/ }); - - const geometry = new THREE.PlaneGeometry(200, 200); - - const mesh = new THREE.Mesh(geometry, material); - mesh.rotation.x = -Math.PI * 0.5; - mesh.receiveShadow = true; - scene.add(mesh); - - const geometry2 = new THREE.BoxGeometry(2, 2, 2); - //const geometry2 = new THREE.IcosahedronGeometry( 1, 5 ); - - const mesh2 = new THREE.Mesh(geometry2, material); - mesh2.position.y = 1; - mesh2.castShadow = true; - scene.add(mesh2); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(16, 4, 1); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 50; - controls.enablePan = false; - - // - - function setHelperVisible(value) { - for (let i = 0; i < lights.length; i++) { - lights[i].userData.helper.visible = value; - } - } - - setHelperVisible(false); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add({ helper: false }, 'helper').onChange(v => setHelperVisible(v)); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render(time) { - time = time / 1000; - - for (let i = 0; i < lights.length; i++) { - const t = (Math.sin((time + i) * (Math.PI / 2)) + 1) / 2; - - const x = THREE.MathUtils.lerp(lights[i].position.x, 0, t); - const z = THREE.MathUtils.lerp(lights[i].position.z, 0, t); - - lights[i].target.position.x = x; - lights[i].target.position.z = z; - if (lights[i].userData.helper) lights[i].userData.helper.update(); - } - - renderer.render(scene, camera); -} - -init(); diff --git a/examples-testing/examples/webgpu_lights_phong.ts b/examples-testing/examples/webgpu_lights_phong.ts deleted file mode 100644 index c2cdf4393..000000000 --- a/examples-testing/examples/webgpu_lights_phong.ts +++ /dev/null @@ -1,136 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color, fog, rangeFogFactor, checker, uv, mix, texture, lights, normalMap } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - -let camera, scene, renderer, light1, light2, light3, light4, controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.z = 7; - - scene = new THREE.Scene(); - scene.fogNode = fog(color(0xff00ff), rangeFogFactor(12, 30)); - - const sphereGeometry = new THREE.SphereGeometry(0.1, 16, 8); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const normalMapTexture = textureLoader.load('./textures/water/Water_1_M_Normal.jpg'); - normalMapTexture.wrapS = THREE.RepeatWrapping; - normalMapTexture.wrapT = THREE.RepeatWrapping; - - const alphaTexture = textureLoader.load('./textures/roughness_map.jpg'); - alphaTexture.wrapS = THREE.RepeatWrapping; - alphaTexture.wrapT = THREE.RepeatWrapping; - - // lights - - const addLight = (hexColor, power = 1700, distance = 100) => { - const material = new THREE.MeshPhongNodeMaterial(); - material.colorNode = color(hexColor); - material.lights = false; - - const mesh = new THREE.Mesh(sphereGeometry, material); - - const light = new THREE.PointLight(hexColor, 1, distance); - light.power = power; - light.add(mesh); - - scene.add(light); - - return light; - }; - - light1 = addLight(0x0040ff); - light2 = addLight(0xffffff); - light3 = addLight(0x80ff80); - light4 = addLight(0xffaa00); - - // light nodes ( selective lights ) - - const blueLightsNode = lights([light1]); - const whiteLightsNode = lights([light2]); - - // models - - const geometryTeapot = new TeapotGeometry(0.8, 18); - - const leftObject = new THREE.Mesh(geometryTeapot, new THREE.MeshPhongNodeMaterial({ color: 0x555555 })); - leftObject.material.lightsNode = blueLightsNode; - leftObject.material.specularNode = texture(alphaTexture); - leftObject.position.x = -3; - scene.add(leftObject); - - const centerObject = new THREE.Mesh(geometryTeapot, new THREE.MeshPhongNodeMaterial({ color: 0x555555 })); - centerObject.material.normalNode = normalMap(texture(normalMapTexture)); - centerObject.material.shininess = 80; - scene.add(centerObject); - - const rightObject = new THREE.Mesh(geometryTeapot, new THREE.MeshPhongNodeMaterial({ color: 0x555555 })); - rightObject.material.lightsNode = whiteLightsNode; - //rightObject.material.specular.setHex( 0xFF00FF ); - rightObject.material.specularNode = mix(color(0x0000ff), color(0xff0000), checker(uv().mul(5))); - rightObject.material.shininess = 90; - rightObject.position.x = 3; - scene.add(rightObject); - - leftObject.rotation.y = centerObject.rotation.y = rightObject.rotation.y = Math.PI * -0.5; - leftObject.position.y = centerObject.position.y = rightObject.position.y = -1; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 3; - controls.maxDistance = 25; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now() / 1000; - const lightTime = time * 0.5; - - light1.position.x = Math.sin(lightTime * 0.7) * 3; - light1.position.y = Math.cos(lightTime * 0.5) * 4; - light1.position.z = Math.cos(lightTime * 0.3) * 3; - - light2.position.x = Math.cos(lightTime * 0.3) * 3; - light2.position.y = Math.sin(lightTime * 0.5) * 4; - light2.position.z = Math.sin(lightTime * 0.7) * 3; - - light3.position.x = Math.sin(lightTime * 0.7) * 3; - light3.position.y = Math.cos(lightTime * 0.3) * 4; - light3.position.z = Math.sin(lightTime * 0.5) * 3; - - light4.position.x = Math.sin(lightTime * 0.3) * 3; - light4.position.y = Math.cos(lightTime * 0.7) * 4; - light4.position.z = Math.sin(lightTime * 0.5) * 3; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lights_physical.ts b/examples-testing/examples/webgpu_lights_physical.ts deleted file mode 100644 index 43d7ce723..000000000 --- a/examples-testing/examples/webgpu_lights_physical.ts +++ /dev/null @@ -1,236 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, bulbLight, bulbMat, hemiLight; -let ballMat, cubeMat, floorMat; - -let previousShadowMap = false; - -// ref for lumens: http://www.power-sure.com/lumens.htm -const bulbLuminousPowers = { - '110000 lm (1000W)': 110000, - '3500 lm (300W)': 3500, - '1700 lm (100W)': 1700, - '800 lm (60W)': 800, - '400 lm (40W)': 400, - '180 lm (25W)': 180, - '20 lm (4W)': 20, - Off: 0, -}; - -// ref for solar irradiances: https://en.wikipedia.org/wiki/Lux -const hemiLuminousIrradiances = { - '0.0001 lx (Moonless Night)': 0.0001, - '0.002 lx (Night Airglow)': 0.002, - '0.5 lx (Full Moon)': 0.5, - '3.4 lx (City Twilight)': 3.4, - '50 lx (Living Room)': 50, - '100 lx (Very Overcast)': 100, - '350 lx (Office Room)': 350, - '400 lx (Sunrise/Sunset)': 400, - '1000 lx (Overcast)': 1000, - '18000 lx (Daylight)': 18000, - '50000 lx (Direct Sun)': 50000, -}; - -const params = { - shadows: true, - exposure: 0.68, - bulbPower: Object.keys(bulbLuminousPowers)[4], - hemiIrradiance: Object.keys(hemiLuminousIrradiances)[0], -}; - -init(); - -function init() { - const container = document.getElementById('container'); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.x = -4; - camera.position.z = 4; - camera.position.y = 2; - - scene = new THREE.Scene(); - - const bulbGeometry = new THREE.SphereGeometry(0.02, 16, 8); - bulbLight = new THREE.PointLight(0xffee88, 1, 100, 2); - - bulbMat = new THREE.MeshStandardMaterial({ - emissive: 0xffffee, - emissiveIntensity: 1, - color: 0x000000, - }); - bulbLight.add(new THREE.Mesh(bulbGeometry, bulbMat)); - bulbLight.position.set(0, 2, 0); - bulbLight.castShadow = true; - scene.add(bulbLight); - - hemiLight = new THREE.HemisphereLight(0xddeeff, 0x0f0e0d, 0.02); - scene.add(hemiLight); - - floorMat = new THREE.MeshStandardMaterial({ - roughness: 0.8, - color: 0xffffff, - metalness: 0.2, - bumpScale: 1, - }); - const textureLoader = new THREE.TextureLoader(); - textureLoader.load('textures/hardwood2_diffuse.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(10, 24); - map.colorSpace = THREE.SRGBColorSpace; - floorMat.map = map; - floorMat.needsUpdate = true; - }); - textureLoader.load('textures/hardwood2_bump.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(10, 24); - floorMat.bumpMap = map; - floorMat.needsUpdate = true; - }); - textureLoader.load('textures/hardwood2_roughness.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(10, 24); - floorMat.roughnessMap = map; - floorMat.needsUpdate = true; - }); - - cubeMat = new THREE.MeshStandardMaterial({ - roughness: 0.7, - color: 0xffffff, - bumpScale: 1, - metalness: 0.2, - }); - textureLoader.load('textures/brick_diffuse.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(1, 1); - map.colorSpace = THREE.SRGBColorSpace; - cubeMat.map = map; - cubeMat.needsUpdate = true; - }); - textureLoader.load('textures/brick_bump.jpg', function (map) { - map.wrapS = THREE.RepeatWrapping; - map.wrapT = THREE.RepeatWrapping; - map.anisotropy = 4; - map.repeat.set(1, 1); - cubeMat.bumpMap = map; - cubeMat.needsUpdate = true; - }); - - ballMat = new THREE.MeshStandardMaterial({ - color: 0xffffff, - roughness: 0.5, - metalness: 1.0, - }); - textureLoader.load('textures/planets/earth_atmos_2048.jpg', function (map) { - map.anisotropy = 4; - map.colorSpace = THREE.SRGBColorSpace; - ballMat.map = map; - ballMat.needsUpdate = true; - }); - textureLoader.load('textures/planets/earth_specular_2048.jpg', function (map) { - map.anisotropy = 4; - map.colorSpace = THREE.SRGBColorSpace; - ballMat.metalnessMap = map; - ballMat.needsUpdate = true; - }); - - const floorGeometry = new THREE.PlaneGeometry(20, 20); - const floorMesh = new THREE.Mesh(floorGeometry, floorMat); - floorMesh.receiveShadow = true; - floorMesh.rotation.x = -Math.PI / 2.0; - scene.add(floorMesh); - - const ballGeometry = new THREE.SphereGeometry(0.25, 32, 32); - const ballMesh = new THREE.Mesh(ballGeometry, ballMat); - ballMesh.position.set(1, 0.25, 1); - ballMesh.rotation.y = Math.PI; - ballMesh.castShadow = true; - scene.add(ballMesh); - - const boxGeometry = new THREE.BoxGeometry(0.5, 0.5, 0.5); - const boxMesh = new THREE.Mesh(boxGeometry, cubeMat); - boxMesh.position.set(-0.5, 0.25, -1); - boxMesh.castShadow = true; - scene.add(boxMesh); - - const boxMesh2 = new THREE.Mesh(boxGeometry, cubeMat); - boxMesh2.position.set(0, 0.25, -5); - boxMesh2.castShadow = true; - scene.add(boxMesh2); - - const boxMesh3 = new THREE.Mesh(boxGeometry, cubeMat); - boxMesh3.position.set(7, 0.25, 0); - boxMesh3.castShadow = true; - scene.add(boxMesh3); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ReinhardToneMapping; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 20; - - window.addEventListener('resize', onWindowResize); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'hemiIrradiance', Object.keys(hemiLuminousIrradiances)); - gui.add(params, 'bulbPower', Object.keys(bulbLuminousPowers)); - gui.add(params, 'exposure', 0, 1); - gui.add(params, 'shadows'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.toneMappingExposure = Math.pow(params.exposure, 5.0); // to allow for very bright scenes. - renderer.shadowMap.enabled = params.shadows; - bulbLight.castShadow = params.shadows; - - if (params.shadows !== previousShadowMap) { - ballMat.needsUpdate = true; - cubeMat.needsUpdate = true; - floorMat.needsUpdate = true; - previousShadowMap = params.shadows; - } - - bulbLight.power = bulbLuminousPowers[params.bulbPower]; - bulbMat.emissiveIntensity = bulbLight.intensity / Math.pow(0.02, 2.0); // convert from intensity to irradiance at bulb surface - - hemiLight.intensity = hemiLuminousIrradiances[params.hemiIrradiance]; - const time = Date.now() * 0.0005; - - bulbLight.position.y = Math.cos(time) * 0.75 + 1.25; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lights_pointlights.ts b/examples-testing/examples/webgpu_lights_pointlights.ts deleted file mode 100644 index 802ab90bd..000000000 --- a/examples-testing/examples/webgpu_lights_pointlights.ts +++ /dev/null @@ -1,190 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { - abs, - attribute, - distance, - float, - max, - modelWorldMatrixInverse, - positionLocal, - sin, - time, - uniform, -} from 'three/tsl'; - -let camera, scene, timer, renderer, controls; - -let light1, light2; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 100; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - timer = new THREE.Timer(); - timer.connect(document); - - // model - - const loader = new OBJLoader(); - loader.load('models/obj/walt/WaltHead.obj', function (obj) { - const mesh = obj.children[0]; - mesh.geometry = createGeometry(mesh.geometry); - mesh.material = createMaterial(); - - mesh.scale.multiplyScalar(0.8); - mesh.position.y = -30; - scene.add(mesh); - }); - - const sphere = new THREE.SphereGeometry(0.5, 16, 8); - - // lights - - light1 = new THREE.PointLight(0xff0040, 2000); - light1.add(new THREE.Mesh(sphere, new THREE.MeshBasicMaterial({ color: 0xff0040 }))); - scene.add(light1); - - light2 = new THREE.PointLight(0x0040ff, 2000); - light2.add(new THREE.Mesh(sphere, new THREE.MeshBasicMaterial({ color: 0x0040ff }))); - scene.add(light2); - - scene.add(new THREE.AmbientLight(0xaaaaaa, 0.1)); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const time = timer.getElapsed() * 0.5; - - controls.update(); - - light1.position.x = Math.sin(time) * 20; - light1.position.y = Math.cos(time * 0.75) * -30; - light1.position.z = Math.cos(time * 0.5) * 20; - - light2.position.x = Math.cos(time * 0.5) * 20; - light2.position.y = Math.sin(time * 0.75) * -30; - light2.position.z = Math.sin(time) * 20; - - renderer.render(scene, camera); -} - -// helpers - -function createMaterial() { - const material = new THREE.MeshPhongNodeMaterial(); - - const seedAttribute = attribute('seed'); - const displaceNormalAttribute = attribute('displaceNormal'); - - const localTime = attribute('time').add(time); - - const effector1 = uniform(light1.position).toVar(); - const effector2 = uniform(light2.position).toVar(); - - const distance1 = distance(positionLocal, modelWorldMatrixInverse.mul(effector1)); - const distance2 = distance(positionLocal, modelWorldMatrixInverse.mul(effector2)); - - const invDistance1 = max(0.0, float(20.0).sub(distance1)).div(2.0); - const invDistance2 = max(0.0, float(20.0).sub(distance2)).div(2.0); - - const s = abs(sin(localTime.mul(2).add(seedAttribute)).mul(0.5)) - .add(invDistance1) - .add(invDistance2); - - material.positionNode = positionLocal.add(displaceNormalAttribute.mul(s)); - - return material; -} - -function createGeometry(geometry) { - const positionAttribute = geometry.getAttribute('position'); - - const v0 = new THREE.Vector3(); - const v1 = new THREE.Vector3(); - const v2 = new THREE.Vector3(); - const v3 = new THREE.Vector3(); - const n = new THREE.Vector3(); - - const plane = new THREE.Plane(); - - const vertices = []; - const times = []; - const seeds = []; - const displaceNormal = []; - - for (let i = 0; i < positionAttribute.count; i += 3) { - v0.fromBufferAttribute(positionAttribute, i); - v1.fromBufferAttribute(positionAttribute, i + 1); - v2.fromBufferAttribute(positionAttribute, i + 2); - - plane.setFromCoplanarPoints(v0, v1, v2); - - v3.copy(v0).add(v1).add(v2).divideScalar(3); // compute center - v3.add(n.copy(plane.normal).multiplyScalar(-1)); // displace center inwards - - // generate tetrahedron for each triangle - - vertices.push(v0.x, v0.y, v0.z, v1.x, v1.y, v1.z, v2.x, v2.y, v2.z); - vertices.push(v3.x, v3.y, v3.z, v1.x, v1.y, v1.z, v0.x, v0.y, v0.z); - vertices.push(v3.x, v3.y, v3.z, v2.x, v2.y, v2.z, v1.x, v1.y, v1.z); - vertices.push(v3.x, v3.y, v3.z, v0.x, v0.y, v0.z, v2.x, v2.y, v2.z); - - const t = Math.random(); - const s = Math.random(); - n.copy(plane.normal); - - times.push(t, t, t); - times.push(t, t, t); - times.push(t, t, t); - times.push(t, t, t); - seeds.push(s, s, s); - seeds.push(s, s, s); - seeds.push(s, s, s); - seeds.push(s, s, s); - - displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); - displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); - displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); - displaceNormal.push(n.x, n.y, n.z, n.x, n.y, n.z, n.x, n.y, n.z); - } - - const newGeometry = new THREE.BufferGeometry(); - newGeometry.setAttribute('position', new THREE.Float32BufferAttribute(vertices, 3)); - newGeometry.setAttribute('time', new THREE.Float32BufferAttribute(times, 1)); - newGeometry.setAttribute('seed', new THREE.Float32BufferAttribute(seeds, 1)); - newGeometry.setAttribute('displaceNormal', new THREE.Float32BufferAttribute(displaceNormal, 3)); - - newGeometry.computeVertexNormals(); - - return newGeometry; -} diff --git a/examples-testing/examples/webgpu_lights_rectarealight.ts b/examples-testing/examples/webgpu_lights_rectarealight.ts deleted file mode 100644 index 75e2cc442..000000000 --- a/examples-testing/examples/webgpu_lights_rectarealight.ts +++ /dev/null @@ -1,87 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; -import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; - -import { checker, uv } from 'three/tsl'; - -let renderer, scene, camera; -let rectLight1, rectLight2, rectLight3; -let timer; - -init(); - -function init() { - THREE.RectAreaLightNode.setLTC(RectAreaLightTexturesLib.init()); - - timer = new THREE.Timer(); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animation); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 5, -15); - - scene = new THREE.Scene(); - - rectLight1 = new THREE.RectAreaLight(0xff0000, 5, 4, 10); - rectLight1.position.set(-5, 6, 5); - scene.add(rectLight1); - - rectLight2 = new THREE.RectAreaLight(0x00ff00, 5, 4, 10); - rectLight2.position.set(0, 6, 5); - scene.add(rectLight2); - - rectLight3 = new THREE.RectAreaLight(0x0000ff, 5, 4, 10); - rectLight3.position.set(5, 6, 5); - scene.add(rectLight3); - - scene.add(new RectAreaLightHelper(rectLight1)); - scene.add(new RectAreaLightHelper(rectLight2)); - scene.add(new RectAreaLightHelper(rectLight3)); - - const geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000); - const matStdFloor = new THREE.MeshStandardMaterial({ color: 0x444444 }); - matStdFloor.roughnessNode = checker(uv().mul(400)); - const mshStdFloor = new THREE.Mesh(geoFloor, matStdFloor); - scene.add(mshStdFloor); - - const geoKnot = new THREE.TorusKnotGeometry(1.5, 0.5, 200, 16); - const matKnot = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0, metalness: 0 }); - const meshKnot = new THREE.Mesh(geoKnot, matKnot); - meshKnot.position.set(0, 5.5, 0); - scene.add(meshKnot); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.copy(meshKnot.position); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -function animation() { - timer.update(); - - const delta = timer.getDelta(); - - rectLight1.rotation.y += -delta; - rectLight2.rotation.y += delta * 0.5; - rectLight3.rotation.y += delta; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lights_selective.ts b/examples-testing/examples/webgpu_lights_selective.ts deleted file mode 100644 index d00048347..000000000 --- a/examples-testing/examples/webgpu_lights_selective.ts +++ /dev/null @@ -1,150 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { fog, rangeFogFactor, color, lights, texture, normalMap } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - -let camera, scene, renderer, light1, light2, light3, light4, controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.z = 7; - - scene = new THREE.Scene(); - scene.fogNode = fog(color(0xff00ff), rangeFogFactor(12, 30)); - - const sphereGeometry = new THREE.SphereGeometry(0.1, 16, 8); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const normalMapTexture = textureLoader.load('./textures/water/Water_1_M_Normal.jpg'); - normalMapTexture.wrapS = THREE.RepeatWrapping; - normalMapTexture.wrapT = THREE.RepeatWrapping; - - const alphaTexture = textureLoader.load('./textures/roughness_map.jpg'); - alphaTexture.wrapS = THREE.RepeatWrapping; - alphaTexture.wrapT = THREE.RepeatWrapping; - - // lights - - const addLight = (hexColor, power = 1700, distance = 100) => { - const material = new THREE.MeshStandardNodeMaterial(); - material.colorNode = color(hexColor); - material.lights = false; - - const mesh = new THREE.Mesh(sphereGeometry, material); - - const light = new THREE.PointLight(hexColor, 1, distance); - light.power = power; - light.add(mesh); - - scene.add(light); - - return light; - }; - - light1 = addLight(0xff0040); - light2 = addLight(0x0040ff); - light3 = addLight(0x80ff80); - light4 = addLight(0xffaa00); - - // light nodes ( selective lights ) - - const redLightsNode = lights([light1]); - const blueLightsNode = lights([light2]); - - // models - - const geometryTeapot = new TeapotGeometry(0.8, 18); - - const leftObject = new THREE.Mesh(geometryTeapot, new THREE.MeshStandardNodeMaterial({ color: 0x555555 })); - leftObject.material.lightsNode = redLightsNode; - leftObject.material.roughnessNode = texture(alphaTexture); - leftObject.material.metalness = 0; - leftObject.position.x = -3; - scene.add(leftObject); - - const centerObject = new THREE.Mesh(geometryTeapot, new THREE.MeshStandardNodeMaterial({ color: 0x555555 })); - centerObject.material.normalNode = normalMap(texture(normalMapTexture)); - centerObject.material.metalness = 0.5; - centerObject.material.roughness = 0.5; - scene.add(centerObject); - - const rightObject = new THREE.Mesh(geometryTeapot, new THREE.MeshStandardNodeMaterial({ color: 0x555555 })); - rightObject.material.lightsNode = blueLightsNode; - rightObject.material.metalnessNode = texture(alphaTexture); - rightObject.position.x = 3; - scene.add(rightObject); - - leftObject.rotation.y = centerObject.rotation.y = rightObject.rotation.y = Math.PI * -0.5; - leftObject.position.y = centerObject.position.y = rightObject.position.y = -1; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 3; - controls.maxDistance = 25; - - // events - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Material'); - - gui.add(centerObject.material, 'roughness', 0, 1, 0.01); - gui.add(centerObject.material, 'metalness', 0, 1, 0.01); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now() / 1000; - const lightTime = time * 0.5; - - light1.position.x = Math.sin(lightTime * 0.7) * 3; - light1.position.y = Math.cos(lightTime * 0.5) * 4; - light1.position.z = Math.cos(lightTime * 0.3) * 3; - - light2.position.x = Math.cos(lightTime * 0.3) * 3; - light2.position.y = Math.sin(lightTime * 0.5) * 4; - light2.position.z = Math.sin(lightTime * 0.7) * 3; - - light3.position.x = Math.sin(lightTime * 0.7) * 3; - light3.position.y = Math.cos(lightTime * 0.3) * 4; - light3.position.z = Math.sin(lightTime * 0.5) * 3; - - light4.position.x = Math.sin(lightTime * 0.3) * 3; - light4.position.y = Math.cos(lightTime * 0.7) * 4; - light4.position.z = Math.sin(lightTime * 0.5) * 3; - /* - @TODO: Used to test scene light change ( currently unavailable ) - - if ( time > 2.0 && light1.parent === null ) scene.add( light1 ); - if ( time > 2.5 && light2.parent === null ) scene.add( light2 ); - if ( time > 3.0 && light3.parent === null ) scene.add( light3 ); - if ( time > 3.5 && light4.parent === null ) scene.add( light4 ); - */ - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lights_spotlight.ts b/examples-testing/examples/webgpu_lights_spotlight.ts deleted file mode 100644 index e01b9823f..000000000 --- a/examples-testing/examples/webgpu_lights_spotlight.ts +++ /dev/null @@ -1,200 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let renderer, scene, camera; - -let spotLight; - -init(); - -function init() { - // Renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderer.inspector = new Inspector(); - - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1; - - renderer.shadowMap.enabled = true; - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(7, 4, 1); - - // Controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.maxPolarAngle = Math.PI / 2; - controls.target.set(0, 1, 0); - controls.update(); - - // Textures - - const loader = new THREE.TextureLoader().setPath('textures/'); - const filenames = ['disturb.jpg', 'colors.png', 'uv_grid_opengl.jpg']; - - const textures = { none: null }; - - for (let i = 0; i < filenames.length; i++) { - const filename = filenames[i]; - - const texture = loader.load(filename); - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - texture.colorSpace = THREE.SRGBColorSpace; - - textures[filename] = texture; - } - - // Lights - - const ambient = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 0.25); - scene.add(ambient); - - spotLight = new THREE.SpotLight(0xffffff, 100); - spotLight.name = 'spotLight'; - spotLight.map = textures['disturb.jpg']; - spotLight.position.set(2.5, 5, 2.5); - spotLight.angle = Math.PI / 6; - spotLight.penumbra = 1; - spotLight.decay = 2; - spotLight.distance = 0; - - spotLight.castShadow = true; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - spotLight.shadow.camera.near = 2; - spotLight.shadow.camera.far = 10; - spotLight.shadow.focus = 1; - spotLight.shadow.intensity = 1; - scene.add(spotLight); - - spotLight.lightHelper = new THREE.SpotLightHelper(spotLight); - spotLight.lightHelper.visible = false; - scene.add(spotLight.lightHelper); - - spotLight.shadowCameraHelper = new THREE.CameraHelper(spotLight.shadow.camera); // colored lines - spotLight.shadowCameraHelper.visible = false; - scene.add(spotLight.shadowCameraHelper); - - // - - const geometry = new THREE.PlaneGeometry(10, 10); - const material = new THREE.MeshLambertMaterial({ color: 0xbcbcbc }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(0, -1, 0); - mesh.rotation.x = -Math.PI / 2; - mesh.receiveShadow = true; - scene.add(mesh); - - // Model - - new PLYLoader().load('models/ply/binary/Lucy100k.ply', function (geometry) { - geometry.scale(0.0024, 0.0024, 0.0024); - geometry.computeVertexNormals(); - - const material = new THREE.MeshLambertMaterial(); - - const mesh = new THREE.Mesh(geometry, material); - mesh.rotation.y = -Math.PI / 2; - mesh.position.y = 0.8; - mesh.castShadow = true; - mesh.receiveShadow = true; - scene.add(mesh); - }); - - // - - window.addEventListener('resize', onWindowResize); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - - const params = { - map: textures['disturb.jpg'], - color: spotLight.color.getHex(), - intensity: spotLight.intensity, - distance: spotLight.distance, - angle: spotLight.angle, - penumbra: spotLight.penumbra, - decay: spotLight.decay, - focus: spotLight.shadow.focus, - shadowIntensity: spotLight.shadow.intensity, - helpers: false, - }; - - gui.add(params, 'map', textures).onChange(function (val) { - spotLight.map = val; - }); - - gui.addColor(params, 'color').onChange(function (val) { - spotLight.color.setHex(val); - }); - - gui.add(params, 'intensity', 0, 500).onChange(function (val) { - spotLight.intensity = val; - }); - - gui.add(params, 'distance', 0, 20).onChange(function (val) { - spotLight.distance = val; - }); - - gui.add(params, 'angle', 0, Math.PI / 3).onChange(function (val) { - spotLight.angle = val; - }); - - gui.add(params, 'penumbra', 0, 1).onChange(function (val) { - spotLight.penumbra = val; - }); - - gui.add(params, 'decay', 1, 2).onChange(function (val) { - spotLight.decay = val; - }); - - gui.add(params, 'focus', 0, 1).onChange(function (val) { - spotLight.shadow.focus = val; - }); - - gui.add(params, 'shadowIntensity', 0, 1).onChange(function (val) { - spotLight.shadow.intensity = val; - }); - - gui.add(params, 'helpers').onChange(function (val) { - spotLight.lightHelper.visible = val; - spotLight.shadowCameraHelper.visible = val; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now() / 3000; - - spotLight.position.x = Math.cos(time) * 2.5; - spotLight.position.z = Math.sin(time) * 2.5; - - spotLight.lightHelper.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_lines_fat.ts b/examples-testing/examples/webgpu_lines_fat.ts deleted file mode 100644 index 96b8d414a..000000000 --- a/examples-testing/examples/webgpu_lines_fat.ts +++ /dev/null @@ -1,266 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color } from 'three/tsl'; - -import Stats from 'three/addons/libs/stats.module.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Line2 } from 'three/addons/lines/webgpu/Line2.js'; -import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; -import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; - -let line, renderer, scene, camera, camera2, controls, backgroundNode; -let line1; -let matLine, matLineBasic, matLineDashed; -let stats; -let gui; - -// viewport -let insetWidth; -let insetHeight; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setClearColor(0x000000); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-40, 0, 60); - - camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); - camera2.position.copy(camera.position); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 10; - controls.maxDistance = 500; - - backgroundNode = color(0x222222); - - // Position and THREE.Color Data - - const positions = []; - const colors = []; - - const points = GeometryUtils.hilbert3D(new THREE.Vector3(0, 0, 0), 20.0, 1, 0, 1, 2, 3, 4, 5, 6, 7); - - const spline = new THREE.CatmullRomCurve3(points); - const divisions = Math.round(12 * points.length); - const point = new THREE.Vector3(); - const lineColor = new THREE.Color(); - - for (let i = 0, l = divisions; i < l; i++) { - const t = i / l; - - spline.getPoint(t, point); - positions.push(point.x, point.y, point.z); - - lineColor.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); - colors.push(lineColor.r, lineColor.g, lineColor.b); - } - - // Line2 ( LineGeometry, LineMaterial ) - - const geometry = new LineGeometry(); - geometry.setPositions(positions); - geometry.setColors(colors); - - matLine = new THREE.Line2NodeMaterial({ - color: 0xffffff, - linewidth: 5, // in world units with size attenuation, pixels otherwise - vertexColors: true, - dashed: false, - alphaToCoverage: false, - }); - - line = new Line2(geometry, matLine); - line.computeLineDistances(); - line.scale.set(1, 1, 1); - scene.add(line); - - // THREE.Line ( THREE.BufferGeometry, THREE.LineBasicNodeMaterial ) - rendered with gl.LINE_STRIP - - const geo = new THREE.BufferGeometry(); - geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - matLineBasic = new THREE.LineBasicNodeMaterial({ vertexColors: true }); - matLineDashed = new THREE.LineDashedNodeMaterial({ vertexColors: true, scale: 2, dashSize: 1, gapSize: 1 }); - - line1 = new THREE.Line(geo, matLineBasic); - line1.computeLineDistances(); - line1.visible = false; - scene.add(line1); - - // - - window.addEventListener('resize', onWindowResize); - onWindowResize(); - - stats = new Stats(); - document.body.appendChild(stats.dom); - - initGui(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - insetWidth = window.innerHeight / 4; // square - insetHeight = window.innerHeight / 4; - - camera2.aspect = insetWidth / insetHeight; - camera2.updateProjectionMatrix(); -} - -function animate() { - stats.update(); - - // main scene - - renderer.setClearColor(0x000000); - - renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); - - controls.update(); - - renderer.autoClear = true; - - scene.backgroundNode = null; - renderer.render(scene, camera); - - // inset scene - - const posY = window.innerHeight - insetHeight - 20; - - renderer.clearDepth(); // important! - - renderer.setScissorTest(true); - - renderer.setScissor(20, posY, insetWidth, insetHeight); - - renderer.setViewport(20, posY, insetWidth, insetHeight); - - camera2.position.copy(camera.position); - camera2.quaternion.copy(camera.quaternion); - - renderer.autoClear = false; - - scene.backgroundNode = backgroundNode; - renderer.render(scene, camera2); - - renderer.setScissorTest(false); -} - -// - -function initGui() { - gui = new GUI(); - - const param = { - 'line type': 0, - 'world units': false, - width: 10, - alphaToCoverage: false, - dashed: false, - 'dash offset': 0, - 'dash scale': 1, - 'dash / gap': 1, - }; - - gui.add(param, 'line type', { LineGeometry: 0, '"line-strip"': 1 }).onChange(function (val) { - switch (val) { - case 0: - line.visible = true; - - line1.visible = false; - - break; - - case 1: - line.visible = false; - - line1.visible = true; - - break; - } - }); - - gui.add(param, 'world units').onChange(function (val) { - matLine.worldUnits = val; - matLine.needsUpdate = true; - - if (val) { - widthController.name('width (world units)').min(0.1).max(0.5).setValue(0.5); - } else { - widthController.name('width (pixels)').min(1).max(10).setValue(10); - } - }); - - const widthController = gui - .add(param, 'width', 1, 10) - .name('width (pixels)') - .onChange(function (val) { - matLine.linewidth = val; - }); - - gui.add(param, 'alphaToCoverage').onChange(function (val) { - matLine.alphaToCoverage = val; - }); - - gui.add(param, 'dashed').onChange(function (val) { - matLine.dashed = val; - line1.material = val ? matLineDashed : matLineBasic; - }); - - gui.add(param, 'dash scale', 0.5, 2, 0.1).onChange(function (val) { - matLine.scale = val; - matLineDashed.scale = val; - }); - - gui.add(param, 'dash offset', 0, 5, 0.1).onChange(function (val) { - matLine.dashOffset = val; - matLineDashed.dashOffset = val; - }); - - gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { - switch (val) { - case 0: - matLine.dashSize = 2; - matLine.gapSize = 1; - - matLineDashed.dashSize = 2; - matLineDashed.gapSize = 1; - - break; - - case 1: - matLine.dashSize = 1; - matLine.gapSize = 1; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 1; - - break; - - case 2: - matLine.dashSize = 1; - matLine.gapSize = 2; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 2; - - break; - } - }); -} diff --git a/examples-testing/examples/webgpu_lines_fat_raycasting.ts b/examples-testing/examples/webgpu_lines_fat_raycasting.ts deleted file mode 100644 index baca80965..000000000 --- a/examples-testing/examples/webgpu_lines_fat_raycasting.ts +++ /dev/null @@ -1,286 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { LineSegments2 } from 'three/addons/lines/webgpu/LineSegments2.js'; -import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; -import { Line2 } from 'three/addons/lines/webgpu/Line2.js'; -import { LineGeometry } from 'three/addons/lines/LineGeometry.js'; - -// - -let line, thresholdLine, segments, thresholdSegments; -let renderer, scene, camera, controls; -let sphereInter, sphereOnLine; -let gui; -let timer; - -const color = new THREE.Color(); - -const pointer = new THREE.Vector2(Infinity, Infinity); - -const raycaster = new THREE.Raycaster(); - -raycaster.params.Line2 = {}; -raycaster.params.Line2.threshold = 0; - -const matLine = new THREE.Line2NodeMaterial({ - color: 0xffffff, - linewidth: 1, // in world units with size attenuation, pixels otherwise - worldUnits: true, - vertexColors: true, - - alphaToCoverage: true, -}); - -const matThresholdLine = new THREE.Line2NodeMaterial({ - color: 0xffffff, - linewidth: matLine.linewidth, // in world units with size attenuation, pixels otherwise - worldUnits: true, - // vertexColors: true, - transparent: true, - opacity: 0.2, - depthTest: false, - visible: false, -}); - -const params = { - 'line type': 1, - 'world units': matLine.worldUnits, - 'visualize threshold': matThresholdLine.visible, - width: matLine.linewidth, - alphaToCoverage: matLine.alphaToCoverage, - threshold: raycaster.params.Line2.threshold, - translation: 0, - animate: true, -}; - -init(); - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - renderer = new THREE.WebGPURenderer({ antialias: true, alpha: true, trackTimestamp: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setClearColor(0x000000); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-40, 0, 60); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 10; - controls.maxDistance = 500; - - const sphereGeometry = new THREE.SphereGeometry(0.25, 8, 4); - const sphereInterMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, depthTest: false }); - const sphereOnLineMaterial = new THREE.MeshBasicMaterial({ color: 0x00ff00, depthTest: false }); - - sphereInter = new THREE.Mesh(sphereGeometry, sphereInterMaterial); - sphereOnLine = new THREE.Mesh(sphereGeometry, sphereOnLineMaterial); - sphereInter.visible = false; - sphereOnLine.visible = false; - sphereInter.renderOrder = 10; - sphereOnLine.renderOrder = 10; - scene.add(sphereInter); - scene.add(sphereOnLine); - - // Position and THREE.Color Data - - const positions = []; - const colors = []; - const points = []; - for (let i = -50; i < 50; i++) { - const t = i / 3; - points.push(new THREE.Vector3(t * Math.sin(2 * t), t, t * Math.cos(2 * t))); - } - - const spline = new THREE.CatmullRomCurve3(points); - const divisions = Math.round(3 * points.length); - const point = new THREE.Vector3(); - const color = new THREE.Color(); - - for (let i = 0, l = divisions; i < l; i++) { - const t = i / l; - - spline.getPoint(t, point); - positions.push(point.x, point.y, point.z); - - color.setHSL(t, 1.0, 0.5, THREE.SRGBColorSpace); - colors.push(color.r, color.g, color.b); - } - - const lineGeometry = new LineGeometry(); - lineGeometry.setPositions(positions); - lineGeometry.setColors(colors); - - const segmentsGeometry = new LineSegmentsGeometry(); - segmentsGeometry.setPositions(positions); - segmentsGeometry.setColors(colors); - - segments = new LineSegments2(segmentsGeometry, matLine); - segments.computeLineDistances(); - segments.scale.set(1, 1, 1); - scene.add(segments); - - thresholdSegments = new LineSegments2(segmentsGeometry, matThresholdLine); - thresholdSegments.computeLineDistances(); - thresholdSegments.scale.set(1, 1, 1); - scene.add(thresholdSegments); - - line = new Line2(lineGeometry, matLine); - line.computeLineDistances(); - line.scale.set(1, 1, 1); - scene.add(line); - - thresholdLine = new Line2(lineGeometry, matThresholdLine); - thresholdLine.computeLineDistances(); - thresholdLine.scale.set(1, 1, 1); - scene.add(thresholdLine); - - const geo = new THREE.BufferGeometry(); - geo.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geo.setAttribute('color', new THREE.Float32BufferAttribute(colors, 3)); - - // - - switchLine(params['line type']); - - // - - document.addEventListener('pointermove', onPointerMove); - window.addEventListener('resize', onWindowResize); - onWindowResize(); - - initGui(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -async function animate() { - timer.update(); - - const delta = timer.getDelta(); - - const obj = line.visible ? line : segments; - thresholdLine.position.copy(line.position); - thresholdLine.quaternion.copy(line.quaternion); - thresholdSegments.position.copy(segments.position); - thresholdSegments.quaternion.copy(segments.quaternion); - - if (params.animate) { - line.rotation.y += delta * 0.1; - - segments.rotation.y = line.rotation.y; - } - - raycaster.setFromCamera(pointer, camera); - - const intersects = raycaster.intersectObject(obj); - - if (intersects.length > 0) { - sphereInter.visible = true; - sphereOnLine.visible = true; - - sphereInter.position.copy(intersects[0].point); - sphereOnLine.position.copy(intersects[0].pointOnLine); - - const index = intersects[0].faceIndex; - const colors = obj.geometry.getAttribute('instanceColorStart'); - - color.fromBufferAttribute(colors, index); - - sphereInter.material.color.copy(color).offsetHSL(0.3, 0, 0); - sphereOnLine.material.color.copy(color).offsetHSL(0.7, 0, 0); - - renderer.domElement.style.cursor = 'crosshair'; - } else { - sphereInter.visible = false; - sphereOnLine.visible = false; - renderer.domElement.style.cursor = ''; - } - - renderer.render(scene, camera); -} - -// - -function switchLine(val) { - switch (val) { - case 0: - line.visible = true; - thresholdLine.visible = true; - - segments.visible = false; - thresholdSegments.visible = false; - - break; - - case 1: - line.visible = false; - thresholdLine.visible = false; - - segments.visible = true; - thresholdSegments.visible = true; - - break; - } -} - -function initGui() { - gui = renderer.inspector.createParameters('Settings'); - - gui.add(params, 'line type', { LineGeometry: 0, LineSegmentsGeometry: 1 }).onChange(function (val) { - switchLine(val); - }); - - gui.add(params, 'world units').onChange(function (val) { - matLine.worldUnits = val; - matLine.needsUpdate = true; - - matThresholdLine.worldUnits = val; - matThresholdLine.needsUpdate = true; - }); - - gui.add(params, 'visualize threshold').onChange(function (val) { - matThresholdLine.visible = val; - }); - - gui.add(params, 'width', 1, 10).onChange(function (val) { - matLine.linewidth = val; - matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; - }); - - gui.add(params, 'alphaToCoverage').onChange(function (val) { - matLine.alphaToCoverage = val; - }); - - gui.add(params, 'threshold', 0, 10).onChange(function (val) { - raycaster.params.Line2.threshold = val; - matThresholdLine.linewidth = matLine.linewidth + raycaster.params.Line2.threshold; - }); - - gui.add(params, 'translation', 0, 10).onChange(function (val) { - line.position.x = val; - segments.position.x = val; - }); - - gui.add(params, 'animate'); -} diff --git a/examples-testing/examples/webgpu_lines_fat_wireframe.ts b/examples-testing/examples/webgpu_lines_fat_wireframe.ts deleted file mode 100644 index 1bd916fee..000000000 --- a/examples-testing/examples/webgpu_lines_fat_wireframe.ts +++ /dev/null @@ -1,208 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Wireframe } from 'three/addons/lines/webgpu/Wireframe.js'; -import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; - -let wireframe, renderer, scene, camera, camera2, controls, backgroundNode; -let wireframe1; -let matLine, matLineBasic, matLineDashed; -let gui; - -// viewport -let insetWidth; -let insetHeight; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setClearColor(0x000000); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-50, 0, 50); - - camera2 = new THREE.PerspectiveCamera(40, 1, 1, 1000); - camera2.position.copy(camera.position); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 10; - controls.maxDistance = 500; - - backgroundNode = color(0x222222); - - // Wireframe ( WireframeGeometry2, Line2NodeMaterial ) - - let geo = new THREE.IcosahedronGeometry(20, 1); - - const geometry = new WireframeGeometry2(geo); - - matLine = new THREE.Line2NodeMaterial({ - color: 0x4080ff, - linewidth: 5, // in world units with size attenuation, pixels otherwise - dashed: false, - }); - - wireframe = new Wireframe(geometry, matLine); - wireframe.computeLineDistances(); - wireframe.scale.set(1, 1, 1); - scene.add(wireframe); - - // Line ( THREE.WireframeGeometry, THREE.LineBasicMaterial ) - rendered with gl.LINE - - geo = new THREE.WireframeGeometry(geo); - - matLineBasic = new THREE.LineBasicMaterial({ color: 0x4080ff }); - matLineDashed = new THREE.LineDashedMaterial({ scale: 2, dashSize: 1, gapSize: 1 }); - - wireframe1 = new THREE.LineSegments(geo, matLineBasic); - wireframe1.computeLineDistances(); - wireframe1.visible = false; - scene.add(wireframe1); - - // - - window.addEventListener('resize', onWindowResize); - onWindowResize(); - - initGui(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - insetWidth = window.innerHeight / 4; // square - insetHeight = window.innerHeight / 4; - - camera2.aspect = insetWidth / insetHeight; - camera2.updateProjectionMatrix(); -} - -function animate() { - // main scene - - renderer.setViewport(0, 0, window.innerWidth, window.innerHeight); - - renderer.autoClear = true; - - scene.backgroundNode = null; - - scene.name = 'Scene'; - - renderer.render(scene, camera); - - // inset scene - - const posY = window.innerHeight - insetHeight - 20; - - renderer.clearDepth(); // important! - - renderer.setScissorTest(true); - - renderer.setScissor(20, posY, insetWidth, insetHeight); - - renderer.setViewport(20, posY, insetWidth, insetHeight); - - camera2.position.copy(camera.position); - camera2.quaternion.copy(camera.quaternion); - - renderer.autoClear = false; - - scene.backgroundNode = backgroundNode; - - scene.name = 'Scene [ Scissor ]'; - - renderer.render(scene, camera2); - - renderer.setScissorTest(false); -} - -// - -function initGui() { - gui = renderer.inspector.createParameters('Settings'); - - const param = { - 'line type': 0, - 'width (px)': 5, - dashed: false, - 'dash scale': 1, - 'dash / gap': 1, - }; - - gui.add(param, 'line type', { LineGeometry: 0, 'gl.LINE': 1 }).onChange(function (val) { - switch (val) { - case 0: - wireframe.visible = true; - - wireframe1.visible = false; - - break; - - case 1: - wireframe.visible = false; - - wireframe1.visible = true; - - break; - } - }); - - gui.add(param, 'width (px)', 1, 10).onChange(function (val) { - matLine.linewidth = val; - }); - - gui.add(param, 'dashed').onChange(function (val) { - matLine.dashed = val; - wireframe1.material = val ? matLineDashed : matLineBasic; - }); - - gui.add(param, 'dash scale', 0.5, 1, 0.1).onChange(function (val) { - matLine.scale = val; - matLineDashed.scale = val; - }); - - gui.add(param, 'dash / gap', { '2 : 1': 0, '1 : 1': 1, '1 : 2': 2 }).onChange(function (val) { - switch (val) { - case 0: - matLine.dashSize = 2; - matLine.gapSize = 1; - - matLineDashed.dashSize = 2; - matLineDashed.gapSize = 1; - - break; - - case 1: - matLine.dashSize = 1; - matLine.gapSize = 1; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 1; - - break; - - case 2: - matLine.dashSize = 1; - matLine.gapSize = 2; - - matLineDashed.dashSize = 1; - matLineDashed.gapSize = 2; - - break; - } - }); -} diff --git a/examples-testing/examples/webgpu_loader_gltf.ts b/examples-testing/examples/webgpu_loader_gltf.ts deleted file mode 100644 index 6380bd903..000000000 --- a/examples-testing/examples/webgpu_loader_gltf.ts +++ /dev/null @@ -1,183 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls; -let currentModel, mixer; -let currentLoadId = 0; - -const timer = new THREE.Timer(); - -init().then(render); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - //texture.minFilter = THREE.LinearMipmapLinearFilter; - //texture.generateMipmaps = true; - - scene.background = texture; - scene.environment = texture; - - // model - - fetch('https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/model-index.json') - .then(response => response.json()) - .then(models => { - const gui = renderer.inspector.createParameters('Model'); - const modelNames = models.map(m => m.name); - const params = { model: 'DamagedHelmet' }; - - if (!modelNames.includes(params.model) && modelNames.length > 0) { - params.model = modelNames[0]; - } - - gui.add(params, 'model', modelNames).onChange(name => { - const modelInfo = models.find(m => m.name === name); - loadModel(modelInfo); - }); - - gui.add(scene, 'backgroundBlurriness', 0, 1); - - const initialModel = models.find(m => m.name === params.model); - if (initialModel) loadModel(initialModel); - }); - }); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - await renderer.init(); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2; - controls.maxDistance = 10; - controls.target.set(0, 0, -0.2); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function loadModel(modelInfo) { - const variants = modelInfo.variants; - const variant = variants['glTF-Binary'] || variants['glTF']; - const url = `https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Assets/main/Models/${modelInfo.name}/${variant.endsWith('.glb') ? 'glTF-Binary' : 'glTF'}/${variant}`; - - if (currentModel) { - currentModel.traverse(model => { - if (model.isMesh) { - model.geometry.dispose(); - model.material.dispose(); - - for (const value of Object.values(model.material)) { - if (value && value.isTexture) { - value.dispose(); - } - } - } - }); - - scene.remove(currentModel); - currentModel = null; - } - - if (mixer) { - mixer.stopAllAction(); - mixer = null; - } - - const loadId = ++currentLoadId; - - const loader = new GLTFLoader(); - loader.load(url, async function (gltf) { - if (loadId !== currentLoadId) return; - - currentModel = gltf.scene; - - // wait until the model can be added to the scene without blocking due to shader compilation - - await renderer.compileAsync(currentModel, camera, scene); - - if (loadId !== currentLoadId) return; - - scene.add(currentModel); - - fitCameraToSelection(camera, controls, currentModel); - - // animations - - if (gltf.animations.length > 0) { - mixer = new THREE.AnimationMixer(currentModel); - - for (const animation of gltf.animations) { - mixer.clipAction(animation).play(); - } - } - }); -} - -function fitCameraToSelection(camera, controls, selection, fitOffset = 1.3) { - const box = new THREE.Box3(); - box.setFromObject(selection); - - const size = box.getSize(new THREE.Vector3()); - const center = box.getCenter(new THREE.Vector3()); - - const maxSize = Math.max(size.x, size.y, size.z); - const fitHeightDistance = maxSize / (2 * Math.atan((Math.PI * camera.fov) / 360)); - // const fitWidthDistance = fitHeightDistance / camera.aspect; - // const distance = fitOffset * Math.max( fitHeightDistance, fitWidthDistance ); - const distance = fitOffset * fitHeightDistance; - - const direction = controls.target.clone().sub(camera.position).normalize().multiplyScalar(distance); - - controls.maxDistance = distance * 10; - controls.minDistance = distance / 10; - controls.target.copy(center); - - camera.near = distance / 100; - camera.far = distance * 100; - camera.updateProjectionMatrix(); - - camera.position.copy(controls.target).sub(direction); - - controls.update(); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - timer.update(); - - controls.update(); - - if (mixer) mixer.update(timer.getDelta()); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_gltf_anisotropy.ts b/examples-testing/examples/webgpu_loader_gltf_anisotropy.ts deleted file mode 100644 index a3aa95e15..000000000 --- a/examples-testing/examples/webgpu_loader_gltf_anisotropy.ts +++ /dev/null @@ -1,64 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -let renderer, scene, camera, controls; - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.35; - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.set(-0.35, -0.2, 0.35); - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, -0.08, 0.11); - controls.minDistance = 0.1; - controls.maxDistance = 2; - controls.update(); - - const hdrLoader = new UltraHDRLoader().setPath('textures/equirectangular/'); - const gltfLoader = new GLTFLoader().setPath('models/gltf/'); - - const [texture, gltf] = await Promise.all([ - hdrLoader.loadAsync('royal_esplanade_2k.hdr.jpg'), - gltfLoader.loadAsync('AnisotropyBarnLamp.glb'), - ]); - - // environment - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.backgroundBlurriness = 0.5; - scene.environment = texture; - - // model - - scene.add(gltf.scene); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_gltf_compressed.ts b/examples-testing/examples/webgpu_loader_gltf_compressed.ts deleted file mode 100644 index d6d437517..000000000 --- a/examples-testing/examples/webgpu_loader_gltf_compressed.ts +++ /dev/null @@ -1,69 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; -import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 20); - camera.position.set(2, 2, 2); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xeeeeee); - - //lights - - const light = new THREE.PointLight(0xffffff); - light.power = 1300; - camera.add(light); - scene.add(camera); - - //renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ReinhardToneMapping; - renderer.toneMappingExposure = 1; - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 3; - controls.maxDistance = 6; - controls.update(); - - const ktx2Loader = await new KTX2Loader().detectSupport(renderer); - - const loader = new GLTFLoader(); - loader.setKTX2Loader(ktx2Loader); - loader.setMeshoptDecoder(MeshoptDecoder); - loader.load('models/gltf/coffeemat.glb', function (gltf) { - const gltfScene = gltf.scene; - gltfScene.position.y = -0.8; - gltfScene.scale.setScalar(0.01); - - scene.add(gltfScene); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_gltf_dispersion.ts b/examples-testing/examples/webgpu_loader_gltf_dispersion.ts deleted file mode 100644 index a2e815ddb..000000000 --- a/examples-testing/examples/webgpu_loader_gltf_dispersion.ts +++ /dev/null @@ -1,63 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 5); - camera.position.set(0.1, 0.05, 0.15); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ReinhardToneMapping; // TODO: Add THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1; - container.appendChild(renderer.domElement); - - const hdrTexture = await new HDRLoader() - .setPath('textures/equirectangular/') - .loadAsync('pedestrian_overpass_1k.hdr'); - hdrTexture.mapping = THREE.EquirectangularReflectionMapping; - - scene = new THREE.Scene(); - scene.backgroundBlurriness = 0.5; - scene.environment = hdrTexture; - scene.background = hdrTexture; - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/DispersionTest.glb'); - - scene.add(gltf.scene); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 0.1; - controls.maxDistance = 10; - controls.target.set(0, 0, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_gltf_iridescence.ts b/examples-testing/examples/webgpu_loader_gltf_iridescence.ts deleted file mode 100644 index 8007d5e65..000000000 --- a/examples-testing/examples/webgpu_loader_gltf_iridescence.ts +++ /dev/null @@ -1,70 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let renderer, scene, camera, controls; - -init().catch(function (err) { - console.error(err); -}); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setAnimationLoop(render); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.05, 20); - camera.position.set(0.35, 0.05, 0.35); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = -0.5; - controls.target.set(0, 0.2, 0); - controls.update(); - - const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); - - const gltfLoader = new GLTFLoader().setPath('models/gltf/'); - - const [texture, gltf] = await Promise.all([ - hdrLoader.loadAsync('venice_sunset_1k.hdr'), - gltfLoader.loadAsync('IridescenceLamp.glb'), - ]); - - // environment - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - // model - - scene.add(gltf.scene); - - render(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - render(); -} - -function render() { - controls.update(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_gltf_sheen.ts b/examples-testing/examples/webgpu_loader_gltf_sheen.ts deleted file mode 100644 index 442edc7fb..000000000 --- a/examples-testing/examples/webgpu_loader_gltf_sheen.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 20); - camera.position.set(-0.75, 0.7, 1.25); - - scene = new THREE.Scene(); - //scene.add( new THREE.DirectionalLight( 0xffffff, 2 ) ); - - // model - - new GLTFLoader().setPath('models/gltf/').load('SheenChair.glb', function (gltf) { - scene.add(gltf.scene); - - const object = gltf.scene.getObjectByName('SheenChair_fabric'); - - const gui = renderer.inspector.createParameters('SheenChair_fabric'); - - gui.add(object.material, 'sheen', 0, 1); - }); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - scene.background = new THREE.Color(0xaaaaaa); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - //scene.backgroundBlurriness = 1; // @TODO: Needs PMREM - scene.environment = texture; - }); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 1; - controls.maxDistance = 10; - controls.target.set(0, 0.35, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - controls.update(); // required if damping enabled - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_gltf_transmission.ts b/examples-testing/examples/webgpu_loader_gltf_transmission.ts deleted file mode 100644 index de3fa7909..000000000 --- a/examples-testing/examples/webgpu_loader_gltf_transmission.ts +++ /dev/null @@ -1,83 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -let camera, scene, renderer, controls, timer, mixer; - -init(); - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(0, 0.4, 0.7); - - scene = new THREE.Scene(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.backgroundBlurriness = 0.35; - - scene.environment = texture; - - // model - - new GLTFLoader() - .setPath('models/gltf/') - .setDRACOLoader(new DRACOLoader().setDecoderPath(DRACO_GLTF_CONFIG)) - .load('IridescentDishWithOlives.glb', function (gltf) { - mixer = new THREE.AnimationMixer(gltf.scene); - mixer.clipAction(gltf.animations[0]).play(); - - scene.add(gltf.scene); - }); - }); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setAnimationLoop(render); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - container.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = -0.75; - controls.enableDamping = true; - controls.minDistance = 0.5; - controls.maxDistance = 1; - controls.target.set(0, 0.1, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - timer.update(); - - if (mixer) mixer.update(timer.getDelta()); - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_materialx.ts b/examples-testing/examples/webgpu_loader_materialx.ts deleted file mode 100644 index 5b53bb90a..000000000 --- a/examples-testing/examples/webgpu_loader_materialx.ts +++ /dev/null @@ -1,300 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Fn, abs, fract, fwidth, length, max, saturate, smoothstep, vec4, positionWorld, float } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import * as MikkTSpace from 'three/addons/libs/mikktspace.module.js'; -import { computeMikkTSpaceTangents } from 'three/addons/utils/BufferGeometryUtils.js'; - -import { MaterialXLoader } from 'three/addons/loaders/MaterialXLoader.js'; -import { createStrictInterfaceValidator } from 'three/addons/loaders/materialx/MaterialXInterfaceValidation.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const SAMPLE_PATH = - 'https://raw.githubusercontent.com/materialx/MaterialX/main/resources/Materials/Examples/StandardSurface/'; -const LOCAL_SAMPLE_PATH = 'materialx/'; -const samples = [ - 'standard_surface_brass_tiled.mtlx', - 'standard_surface_brick_procedural.mtlx', - 'standard_surface_carpaint.mtlx', - //'standard_surface_chess_set.mtlx', - 'standard_surface_chrome.mtlx', - 'standard_surface_copper.mtlx', - //'standard_surface_default.mtlx', - //'standard_surface_glass.mtlx', - //'standard_surface_glass_tinted.mtlx', - 'standard_surface_gold.mtlx', - //'standard_surface_greysphere.mtlx', - //'standard_surface_greysphere_calibration.mtlx', - 'standard_surface_jade.mtlx', - //'standard_surface_look_brass_tiled.mtlx', - //'standard_surface_look_wood_tiled.mtlx', - 'standard_surface_marble_solid.mtlx', - 'standard_surface_metal_brushed.mtlx', - 'standard_surface_plastic.mtlx', - //'standard_surface_thin_film.mtlx', - 'standard_surface_velvet.mtlx', - 'standard_surface_wood_tiled.mtlx', -]; - -const localSamples = [ - 'standard_surface_heightnormal.mtlx', - 'standard_surface_conditional_if_float.mtlx', - 'standard_surface_image_transform.mtlx', - 'standard_surface_color3_vec3_cm_test.mtlx', - 'standard_surface_rotate2d_test.mtlx', - 'standard_surface_rotate3d_test.mtlx', - 'standard_surface_heighttonormal_normal_input.mtlx', - 'standard_surface_roughness_test.mtlx', - 'standard_surface_opacity_test.mtlx', - 'standard_surface_opacity_only_test.mtlx', - 'standard_surface_specular_test.mtlx', - 'standard_surface_ior_test.mtlx', - 'standard_surface_combined_test.mtlx', - 'standard_surface_texture_opacity_test.mtlx', - 'standard_surface_transmission_test.mtlx', - 'standard_surface_transmission_only_test.mtlx', - 'standard_surface_transmission_rough.mtlx', - 'standard_surface_thin_film_rainbow_test.mtlx', - 'standard_surface_thin_film_ior_clamp_test.mtlx', - 'standard_surface_sheen_test.mtlx', - 'gltf_pbr_glass_dispersion.mtlx', - 'open_pbr_surface_velvet.mtlx', - 'open_pbr_surface_pearl.mtlx', - 'open_pbr_surface_honey.mtlx', -]; - -let camera, scene, renderer; -let controls, prefab; -const models = []; -const strictInterfaceValidator = createStrictInterfaceValidator(); - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.LinearToneMapping; - renderer.toneMappingExposure = 0.5; - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 200); - camera.position.set(10, 10, 20); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - // Ground plane - - const material = new THREE.MeshBasicNodeMaterial(); - - const grid = Fn(([coord, lineWidth = float(0.01), dotSize = float(0.03)]) => { - // https://bgolus.medium.com/the-best-darn-grid-shader-yet-727f9278b9d8 - - const g = fract(coord); - const fw = fwidth(coord); - const gx = abs(g.x.sub(0.5)); - const gy = abs(g.y.sub(0.5)); - - const lineX = saturate(lineWidth.sub(gx).div(fw.x).add(0.5)); - const lineY = saturate(lineWidth.sub(gy).div(fw.y).add(0.5)); - const lines = max(lineX, lineY); - - const squareDist = max(gx, gy); - const aa = max(fw.x, fw.y); - const dots = smoothstep(dotSize.add(aa), dotSize.sub(aa), squareDist); - - return max(dots, lines); - }); - - const fade = Fn(([radius = float(10.0), falloff = float(1.0)]) => { - return smoothstep(radius, radius.sub(falloff), length(positionWorld)); - }); - - const gridColor = vec4(0.5, 0.5, 0.5, 1.0); - const baseColor = vec4(1.0, 1.0, 1.0, 0.0); - - material.colorNode = grid(positionWorld.xz, 0.007, 0.03).mix(baseColor, gridColor).mul(fade(30.0, 20.0)); - material.transparent = true; - - const plane = new THREE.Mesh(new THREE.CircleGeometry(40), material); - plane.rotation.x = -Math.PI / 2; - plane.renderOrder = -1; - scene.add(plane); - - // - - controls = new OrbitControls(camera); - controls.connect(renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2; - controls.maxDistance = 40; - - // - - new HDRLoader().setPath('textures/equirectangular/').load('san_giuseppe_bridge_2k.hdr', async texture => { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.environment = texture; - - prefab = (await new GLTFLoader().loadAsync('./models/gltf/ShaderBall.glb')).scene; - await computePrefabTangents(); - - for (const sample of samples) { - await addSample(sample, SAMPLE_PATH); - } - - for (const sample of localSamples) { - await addSample(sample, LOCAL_SAMPLE_PATH); - } - - addGUI(); - }); - - window.addEventListener('resize', onWindowResize); -} - -async function computePrefabTangents() { - await MikkTSpace.ready; - - prefab.traverse(function (node) { - if (node.isMesh === false) return; - - const geometry = node.geometry; - - if (geometry === undefined) return; - - if (geometry.hasAttribute('tangent')) return; - - if (geometry.hasAttribute('position') && geometry.hasAttribute('normal') && geometry.hasAttribute('uv')) { - computeMikkTSpaceTangents(geometry, MikkTSpace); - } - }); -} - -function updateModelsAlign() { - const COLUMN_COUNT = 6; - const DIST_X = 3; - const DIST_Z = 3; - - const lineCount = Math.floor(models.length / COLUMN_COUNT) - 1.5; - - const offsetX = DIST_X * (COLUMN_COUNT - 1) * -0.5; - const offsetZ = DIST_Z * lineCount * 0.5; - - for (let i = 0; i < models.length; i++) { - const model = models[i]; - - model.position.x = (i % COLUMN_COUNT) * DIST_X + offsetX; - model.position.z = Math.floor(i / COLUMN_COUNT) * -DIST_Z + offsetZ; - } -} - -function reportMaterialXLog(sample, materialName, log) { - if (log.length === 0) return; - - const label = materialName ? `"${materialName}"` : `"${sample}"`; - const errorCount = log.filter(entry => entry.severity === 'error').length; - const warningCount = log.filter(entry => entry.severity === 'warning').length; - console.groupCollapsed( - `THREE.MaterialXLoader: ${errorCount} error(s), ${warningCount} warning(s) for ${label} (${sample})`, - ); - - for (const entry of log) { - const nodeName = entry.nodeName ? ` [${entry.nodeName}]` : ''; - const style = entry.severity === 'warning' ? 'color: #c90' : 'color: #c00'; - console[entry.severity === 'warning' ? 'warn' : 'error']( - `%c${entry.severity}: ${entry.code}${nodeName}: ${entry.message}`, - style, - ); - } - - console.groupEnd(); -} - -async function addSample(sample, path) { - const model = prefab.clone(); - - models.push(model); - - scene.add(model); - - updateModelsAlign(); - - // - - const { materials, log } = await new MaterialXLoader().setPath(path).loadAsync(sample, { - uvSpace: 'top-left', - interfaceValidator: strictInterfaceValidator, - throwOnErrors: false, - }); - const material = Object.values(materials).pop(); - reportMaterialXLog(sample, material ? material.name : null, log); - - const calibrationMesh = model.getObjectByName('Calibration_Mesh'); - calibrationMesh.material = material; - - const previewMesh = model.getObjectByName('Preview_Mesh'); - previewMesh.material = material; - - if (material.transparent) { - calibrationMesh.renderOrder = 1; - previewMesh.renderOrder = 2; - } - - await renderer.compileAsync(model, camera, scene); -} - -function addGUI() { - const gui = renderer.inspector.createParameters('MaterialX Loader'); - - const API = { - showCalibrationMesh: true, - showPreviewMesh: true, - }; - - gui.add(API, 'showCalibrationMesh') - .name('Calibration Mesh') - .onChange(function (value) { - setVisibility('Calibration_Mesh', value); - }); - - gui.add(API, 'showPreviewMesh') - .name('Preview Mesh') - .onChange(function (value) { - setVisibility('Preview_Mesh', value); - }); -} - -function setVisibility(name, visible) { - scene.traverse(function (node) { - if (node.isMesh) { - if (node.name == name) node.visible = visible; - } - }); -} - -// - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - controls.update(); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_loader_texture_ktx2.ts b/examples-testing/examples/webgpu_loader_texture_ktx2.ts deleted file mode 100644 index 031495f06..000000000 --- a/examples-testing/examples/webgpu_loader_texture_ktx2.ts +++ /dev/null @@ -1,186 +0,0 @@ -import * as THREE from 'three'; - -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; - -let canvas, renderer; - -const scenes = []; - -const sections = [ - { - title: 'Uncompressed', - description: - 'Uncompressed formats (rgba8, rgba16, rgba32) load as THREE.DataTexture objects.' + - ' Lossless, easy to read/write, uncompressed on GPU, optionally compressed over the network.', - textures: [ - { path: '2d_rgba8.ktx2' }, - { path: '2d_rgba8_linear.ktx2' }, - { path: '2d_rgba16_linear.ktx2' }, - { path: '2d_rgba32_linear.ktx2' }, - { path: '2d_rgb9e5_linear.ktx2' }, - { path: '2d_r11g11b10_linear.ktx2' }, - ], - }, - { - title: 'Compressed', - description: - 'Compressed formats (ASTC, BCn, ...) load as THREE.CompressedTexture objects,' + - ' reducing memory cost. Requires native support on the device GPU: no single compressed' + - ' format is supported on every device.', - textures: [ - { path: '2d_astc4x4.ktx2' }, - { path: '2d_etc1.ktx2' }, - { path: '2d_etc2.ktx2' }, - { path: '2d_bc1.ktx2' }, - { path: '2d_bc3.ktx2' }, - { path: '2d_bc4.ktx2' }, - { path: '2d_bc5.ktx2' }, - { path: '2d_bc7.ktx2' }, - ], - }, - - { - title: 'Universal', - description: - 'Basis Universal textures are specialized intermediate formats supporting fast' + - ' runtime transcoding into other GPU texture compression formats. After transcoding,' + - ' universal textures can be used on any device at reduced memory cost.', - textures: [{ path: '2d_etc1s.ktx2' }, { path: '2d_uastc.ktx2' }], - }, -]; - -init(); - -async function init() { - canvas = document.getElementById('c'); - - renderer = new THREE.WebGPURenderer({ canvas, antialias: true, forceWebGL: false }); - renderer.setClearColor(0xffffff, 1); - renderer.setPixelRatio(window.devicePixelRatio); - - await renderer.init(); - - const loader = new KTX2Loader().setPath('textures/ktx2/').detectSupport(renderer); - - const geometry = flipY(new THREE.PlaneGeometry(1, 1)); - - const content = document.getElementById('content'); - - for (const section of sections) { - const sectionElement = document.createElement('section'); - - const sectionHeader = document.createElement('h2'); - sectionHeader.textContent = section.title; - sectionElement.appendChild(sectionHeader); - - const sectionDescription = document.createElement('p'); - sectionDescription.className = 'description'; - sectionDescription.textContent = section.description; - sectionElement.appendChild(sectionDescription); - - for (const { path, supported } of section.textures) { - const scene = new THREE.Scene(); - - // make a list item - const element = document.createElement('div'); - element.className = 'list-item'; - - const sceneElement = document.createElement('div'); - element.appendChild(sceneElement); - - const labelElement = document.createElement('div'); - labelElement.innerText = 'file: ' + path; - element.appendChild(labelElement); - - // the element that represents the area we want to render the scene - scene.userData.element = sceneElement; - sectionElement.appendChild(element); - - const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); - camera.position.z = 2; - scene.userData.camera = camera; - - try { - const texture = await loader.loadAsync(supported === false ? 'fail_load.ktx2' : path); - const mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ map: texture })); - - labelElement.innerText += '\ncolorSpace: ' + texture.colorSpace; - - scene.add(mesh); - scenes.push(scene); - } catch (e) { - console.error(`Failed to load ${path}`, e); - } - } - - content.appendChild(sectionElement); - } - - renderer.setAnimationLoop(animate); -} - -function updateSize() { - const width = canvas.clientWidth; - const height = canvas.clientHeight; - - if (canvas.width !== width || canvas.height !== height) { - renderer.setSize(width, height, false); - } -} - -// Rewrite UVs for `flipY=false` textures. - -function flipY(geometry) { - const uv = geometry.attributes.uv; - - for (let i = 0; i < uv.count; i++) { - uv.setY(i, 1 - uv.getY(i)); - } - - return geometry; -} - -function animate() { - updateSize(); - - canvas.style.transform = `translateY(${window.scrollY}px)`; - - renderer.setClearColor(0xffffff); - renderer.setScissorTest(false); - renderer.clear(); - - renderer.setClearColor(0xe0e0e0); - renderer.setScissorTest(true); - - scenes.forEach(function (scene) { - // get the element that is a place holder for where we want to - // draw the scene - const element = scene.userData.element; - - // get its position relative to the page's viewport - const rect = element.getBoundingClientRect(); - - // check if it's offscreen. If so skip it - if ( - rect.top < 0 || - rect.bottom > renderer.domElement.clientHeight || - rect.left < 0 || - rect.right > renderer.domElement.clientWidth - ) { - return; // it's off screen - } - - // set the viewport - const width = rect.right - rect.left; - const height = rect.bottom - rect.top; - const left = rect.left; - const top = rect.top; - - renderer.setViewport(left, top, width, height); - renderer.setScissor(left, top, width, height); - - const camera = scene.userData.camera; - - renderer.render(scene, camera); - }); -} diff --git a/examples-testing/examples/webgpu_materials_alphahash.ts b/examples-testing/examples/webgpu_materials_alphahash.ts deleted file mode 100644 index 264abcd99..000000000 --- a/examples-testing/examples/webgpu_materials_alphahash.ts +++ /dev/null @@ -1,130 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; - -import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; - -let camera, scene, renderer, controls, mesh, material, renderPipeline; - -const amount = parseInt(window.location.search.slice(1)) || 3; -const count = Math.pow(amount, 3); - -const color = new THREE.Color(); - -const params = { - alpha: 0.5, - alphaHash: true, -}; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(amount, amount, amount); - camera.lookAt(0, 0, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - const geometry = new THREE.IcosahedronGeometry(0.5, 3); - - material = new THREE.MeshStandardMaterial({ - color: 0xffffff, - alphaHash: params.alphaHash, - opacity: params.alpha, - }); - - mesh = new THREE.InstancedMesh(geometry, material, count); - - let i = 0; - const offset = (amount - 1) / 2; - - const matrix = new THREE.Matrix4(); - - for (let x = 0; x < amount; x++) { - for (let y = 0; y < amount; y++) { - for (let z = 0; z < amount; z++) { - matrix.setPosition(offset - x, offset - y, offset - z); - - mesh.setMatrixAt(i, matrix); - mesh.setColorAt(i, color.setHex(Math.random() * 0xffffff)); - - i++; - } - } - } - - scene.add(mesh); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - environment.dispose(); - - // - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - const scenePass = ssaaPass(scene, camera); - scenePass.sampleLevel = 3; - - renderPipeline.outputNode = scenePass; - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enablePan = false; - - // - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.add(params, 'alpha', 0, 1).onChange(onMaterialUpdate); - gui.add(params, 'alphaHash').onChange(onMaterialUpdate); - - const ssaaFolder = gui.addFolder('SSAA'); - ssaaFolder.add(scenePass, 'sampleLevel', 0, 4, 1); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onMaterialUpdate() { - material.opacity = params.alpha; - material.alphaHash = params.alphaHash; - material.transparent = !params.alphaHash; - material.depthWrite = params.alphaHash; - - material.needsUpdate = true; -} - -function animate() { - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_materials_arrays.ts b/examples-testing/examples/webgpu_materials_arrays.ts deleted file mode 100644 index 92b7a9c24..000000000 --- a/examples-testing/examples/webgpu_materials_arrays.ts +++ /dev/null @@ -1,185 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let renderer, scene, camera, controls; -let materials; - -const _a = new THREE.Vector3(), - _b = new THREE.Vector3(); - -init(); - -function init() { - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.shadowMap.enabled = true; - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222222); - - // camera - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-6, 7, 14); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.5, 0); - controls.minDistance = 5; - controls.maxDistance = 50; - controls.enableDamping = true; - controls.update(); - - // environment - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x0e696c); - scene.add(hemiLight); - - // lights - - const dirLight = new THREE.DirectionalLight(0xffffff, 6); - dirLight.position.set(5, 10, 6); - dirLight.castShadow = true; - dirLight.shadow.camera.left = -10; - dirLight.shadow.camera.right = 10; - dirLight.shadow.camera.top = 10; - dirLight.shadow.camera.bottom = -10; - dirLight.shadow.camera.far = 20; - dirLight.shadow.mapSize.set(2048, 2048); - dirLight.shadow.radius = 10; - scene.add(dirLight); - - // scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) ); - - // materials, one per paper color, shared across all solids - - const palette = [0xe4002b, 0xff7f11, 0xffd100, 0x00a651, 0x0072ce, 0x8a2be2]; - - materials = palette.map(color => new THREE.MeshStandardMaterial({ color, roughness: 0.8, side: THREE.DoubleSide })); - - const geometries = [ - makeHoleyGeometry(new THREE.TetrahedronGeometry(1.2), 3), // 4 faces, 1 triangle each - makeHoleyGeometry(new THREE.BoxGeometry(1.5, 1.5, 1.5), 6), // 6 faces, 2 triangles each (indexed) - makeHoleyGeometry(new THREE.OctahedronGeometry(1.2), 3), // 8 faces, 1 triangle each - makeHoleyGeometry(new THREE.DodecahedronGeometry(1.1), 9), // 12 faces, 3 triangles each - makeHoleyGeometry(new THREE.IcosahedronGeometry(1.1), 3), // 20 faces, 1 triangle each - ]; - - // table - - const table = new THREE.Mesh( - new THREE.BoxGeometry(17, 0.5, 17), - new THREE.MeshStandardMaterial({ color: 0x0e696c, roughness: 0.5 }), - ); - table.position.y = -0.25; - table.receiveShadow = true; - scene.add(table); - - // grid - - const order = [0, 1, 2, 3, 3, 4, 0, 1, 1, 2, 3, 4, 4, 0, 1, 2]; - - for (let i = 0; i < 16; i++) { - const row = Math.floor(i / 4); - const col = i % 4; - - const mesh = new THREE.Mesh(geometries[order[i]], materials); - mesh.castShadow = true; - - mesh.scale.setScalar(0.5 + row * 0.25); - mesh.position.set((col - 1.5) * 3.5, 0, (1.5 - row) * 3.5); - - mesh.position.y = -new THREE.Box3().setFromObject(mesh, true).min.y - 0.01; - - scene.add(mesh); - } - - // listeners - - window.addEventListener('resize', onWindowResize); -} - -// rebuilds a polyhedron with a hole cut into each polygon face, like an open paper model - -function makeHoleyGeometry(geometry, verticesPerFace, holeScale = 0.6) { - if (geometry.index !== null) geometry = geometry.toNonIndexed(); - - const position = geometry.getAttribute('position'); - - const positions = []; - const holey = new THREE.BufferGeometry(); - - for (let face = 0; face < position.count / verticesPerFace; face++) { - // collect the unique corner vertices of the face - - const corners = []; - const keys = new Set(); - - for (let i = 0; i < verticesPerFace; i++) { - const v = new THREE.Vector3().fromBufferAttribute(position, face * verticesPerFace + i); - const key = v.toArray().join(','); - - if (keys.has(key) === false) { - keys.add(key); - corners.push(v); - } - } - - // sort the corners counterclockwise around the face centroid - - const centroid = corners.reduce((c, v) => c.add(v), new THREE.Vector3()).divideScalar(corners.length); - - const normal = new THREE.Vector3() - .crossVectors(_a.subVectors(corners[1], corners[0]), _b.subVectors(corners[2], corners[0])) - .normalize(); - const tangent = new THREE.Vector3().subVectors(corners[0], centroid).normalize(); - const bitangent = new THREE.Vector3().crossVectors(normal, tangent); - - const angleOf = v => Math.atan2(_b.subVectors(v, centroid).dot(bitangent), _b.dot(tangent)); - corners.sort((p, q) => angleOf(p) - angleOf(q)); - - // bridge each outer edge with its scaled-down inner edge - - const inner = corners.map(v => new THREE.Vector3().lerpVectors(centroid, v, holeScale)); - - holey.addGroup(positions.length / 3, corners.length * 6, face % materials.length); - - for (let i = 0; i < corners.length; i++) { - const j = (i + 1) % corners.length; - - positions.push(...corners[i], ...corners[j], ...inner[j], ...corners[i], ...inner[j], ...inner[i]); - } - } - - holey.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - holey.computeVertexNormals(); - - return holey; -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_basic.ts b/examples-testing/examples/webgpu_materials_basic.ts deleted file mode 100644 index 6aca76c97..000000000 --- a/examples-testing/examples/webgpu_materials_basic.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -const spheres = []; - -let mouseX = 0; -let mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -const params = { - color: '#ffffff', - mapping: THREE.CubeReflectionMapping, - refractionRatio: 0.98, - transparent: false, - opacity: 1, -}; - -const mappings = { ReflectionMapping: THREE.CubeReflectionMapping, RefractionMapping: THREE.CubeRefractionMapping }; - -document.addEventListener('mousemove', onDocumentMouseMove); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.z = 3; - - const path = './textures/cube/pisa/'; - const format = '.png'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const textureCube = new THREE.CubeTextureLoader().load(urls); - - scene = new THREE.Scene(); - scene.background = textureCube; - - const geometry = new THREE.SphereGeometry(0.1, 32, 16); - const material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: textureCube }); - - for (let i = 0; i < 500; i++) { - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = Math.random() * 10 - 5; - mesh.position.y = Math.random() * 10 - 5; - mesh.position.z = Math.random() * 10 - 5; - - mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 3 + 1; - - scene.add(mesh); - - spheres.push(mesh); - } - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.addColor(params, 'color').onChange(value => material.color.set(value)); - gui.add(params, 'mapping', mappings).onChange(value => { - textureCube.mapping = value; - material.needsUpdate = true; - }); - gui.add(params, 'refractionRatio', 0, 1, 0.01).onChange(value => (material.refractionRatio = value)); - gui.add(params, 'transparent').onChange(value => { - material.transparent = value; - material.needsUpdate = true; - }); - gui.add(params, 'opacity', 0, 1, 0.01).onChange(value => (material.opacity = value)); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentMouseMove(event) { - mouseX = (event.clientX - windowHalfX) / 100; - mouseY = (event.clientY - windowHalfY) / 100; -} - -// - -function animate() { - const timer = 0.0001 * Date.now(); - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - for (let i = 0, il = spheres.length; i < il; i++) { - const sphere = spheres[i]; - - sphere.position.x = 5 * Math.cos(timer + i); - sphere.position.y = 5 * Math.sin(timer + i * 1.1); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts b/examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts deleted file mode 100644 index 6c66f9d35..000000000 --- a/examples-testing/examples/webgpu_materials_cubemap_mipmaps.ts +++ /dev/null @@ -1,119 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container; - -let camera, scene, renderer; - -init(); - -// load customized cube texture -async function loadCubeTextureWithMipmaps() { - const path = 'textures/cube/angus/'; - const format = '.jpg'; - const mipmaps = []; - const maxLevel = 8; - - async function loadCubeTexture(urls) { - return new Promise(function (resolve) { - new THREE.CubeTextureLoader().load(urls, function (cubeTexture) { - resolve(cubeTexture); - }); - }); - } - - // load mipmaps - const pendings = []; - - for (let level = 0; level <= maxLevel; ++level) { - const urls = []; - - for (let face = 0; face < 6; ++face) { - urls.push(path + 'cube_m0' + level + '_c0' + face + format); - } - - const mipmapLevel = level; - - pendings.push( - loadCubeTexture(urls).then(function (cubeTexture) { - mipmaps[mipmapLevel] = cubeTexture; - }), - ); - } - - await Promise.all(pendings); - - const customizedCubeTexture = mipmaps.shift(); - customizedCubeTexture.mipmaps = mipmaps; - customizedCubeTexture.colorSpace = THREE.SRGBColorSpace; - customizedCubeTexture.minFilter = THREE.LinearMipMapLinearFilter; - customizedCubeTexture.magFilter = THREE.LinearFilter; - customizedCubeTexture.generateMipmaps = false; - customizedCubeTexture.needsUpdate = true; - - return customizedCubeTexture; -} - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 500; - - scene = new THREE.Scene(); - - loadCubeTextureWithMipmaps().then(function (cubeTexture) { - // model - const sphere = new THREE.SphereGeometry(100, 128, 128); - - // manual mipmaps - let material = new THREE.MeshBasicMaterial({ color: 0xffffff, envMap: cubeTexture }); - material.name = 'manual mipmaps'; - - let mesh = new THREE.Mesh(sphere, material); - mesh.position.set(100, 0, 0); - scene.add(mesh); - - // auto mipmaps - material = material.clone(); - material.name = 'auto mipmaps'; - - const autoCubeTexture = cubeTexture.clone(); - autoCubeTexture.mipmaps = []; - autoCubeTexture.generateMipmaps = true; - autoCubeTexture.needsUpdate = true; - - material.envMap = autoCubeTexture; - - mesh = new THREE.Mesh(sphere, material); - mesh.position.set(-100, 0, 0); - scene.add(mesh); - }); - - //renderer - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - //controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.minPolarAngle = Math.PI / 4; - controls.maxPolarAngle = Math.PI / 1.5; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_displacementmap.ts b/examples-testing/examples/webgpu_materials_displacementmap.ts deleted file mode 100644 index 17a01f324..000000000 --- a/examples-testing/examples/webgpu_materials_displacementmap.ts +++ /dev/null @@ -1,195 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; - -let camera, scene, renderer, controls; - -const settings = { - metalness: 1.0, - roughness: 0.4, - ambientIntensity: 0.2, - aoMapIntensity: 1.0, - envMapIntensity: 1.0, - displacementScale: 2.436143, // from original model - normalScale: 1.0, -}; - -let mesh, material; - -let pointLight, ambientLight; - -const height = 500; // of camera frustum - -let r = 0.0; - -init(); -initGui(); - -// Init gui -function initGui() { - const gui = renderer.inspector.createParameters('settings'); - - gui.add(settings, 'metalness', 0, 1).onChange(function (value) { - material.metalness = value; - }); - - gui.add(settings, 'roughness', 0, 1).onChange(function (value) { - material.roughness = value; - }); - - gui.add(settings, 'aoMapIntensity', 0, 1).onChange(function (value) { - material.aoMapIntensity = value; - }); - - gui.add(settings, 'ambientIntensity', 0, 1).onChange(function (value) { - ambientLight.intensity = value; - }); - - gui.add(settings, 'envMapIntensity', 0, 3).onChange(function (value) { - material.envMapIntensity = value; - }); - - gui.add(settings, 'displacementScale', 0, 3.0).onChange(function (value) { - material.displacementScale = value; - }); - - gui.add(settings, 'normalScale', -1, 1).onChange(function (value) { - material.normalScale.set(1, -1).multiplyScalar(value); - }); -} - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGPURenderer(); - renderer.setAnimationLoop(animate); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // - - scene = new THREE.Scene(); - - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera(-height * aspect, height * aspect, height, -height, 1, 10000); - camera.position.z = 1500; - scene.add(camera); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enableDamping = true; - - // lights - - ambientLight = new THREE.AmbientLight(0xffffff, settings.ambientIntensity); - scene.add(ambientLight); - - pointLight = new THREE.PointLight(0xff0000, 1.5, 0, 0); - pointLight.position.z = 2500; - scene.add(pointLight); - - const pointLight2 = new THREE.PointLight(0xff6666, 3, 0, 0); - camera.add(pointLight2); - - const pointLight3 = new THREE.PointLight(0x0000ff, 1.5, 0, 0); - pointLight3.position.x = -1000; - pointLight3.position.z = 1000; - scene.add(pointLight3); - - // env map - - const path = 'textures/cube/SwedishRoyalCastle/'; - const format = '.jpg'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const reflectionCube = new THREE.CubeTextureLoader().load(urls); - - // textures - - const textureLoader = new THREE.TextureLoader(); - const normalMap = textureLoader.load('models/obj/ninja/normal.png'); - const aoMap = textureLoader.load('models/obj/ninja/ao.jpg'); - const displacementMap = textureLoader.load('models/obj/ninja/displacement.jpg'); - - // material - - material = new THREE.MeshStandardNodeMaterial({ - color: 0xc1c1c1, - roughness: settings.roughness, - metalness: settings.metalness, - - normalMap: normalMap, - normalScale: new THREE.Vector2(1, -1), // why does the normal map require negation in this case? - - aoMap: aoMap, - aoMapIntensity: 1, - - displacementMap: displacementMap, - displacementScale: settings.displacementScale, - displacementBias: -0.428408, // from original model - - envMap: reflectionCube, - envMapIntensity: settings.envMapIntensity, - - side: THREE.DoubleSide, - }); - - // - - const loader = new OBJLoader(); - loader.load('models/obj/ninja/ninjaHead_Low.obj', function (group) { - const geometry = group.children[0].geometry; - geometry.center(); - - mesh = new THREE.Mesh(geometry, material); - mesh.scale.multiplyScalar(25); - scene.add(mesh); - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const aspect = window.innerWidth / window.innerHeight; - - camera.left = -height * aspect; - camera.right = height * aspect; - camera.top = height; - camera.bottom = -height; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - controls.update(); - - render(); -} - -function render() { - pointLight.position.x = 2500 * Math.cos(r); - pointLight.position.z = 2500 * Math.sin(r); - - r += 0.01; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_envmaps.ts b/examples-testing/examples/webgpu_materials_envmaps.ts deleted file mode 100644 index 6862caeed..000000000 --- a/examples-testing/examples/webgpu_materials_envmaps.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let controls, camera, scene, renderer; -let textureEquirec, textureCube; -let sphereMesh, sphereMaterial, params; - -init(); - -function init() { - // CAMERAS - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 2.5); - - // SCENE - - scene = new THREE.Scene(); - - // Textures - - const loader = new THREE.CubeTextureLoader(); - loader.setPath('textures/cube/Bridge2/'); - - textureCube = loader.load(['posx.jpg', 'negx.jpg', 'posy.jpg', 'negy.jpg', 'posz.jpg', 'negz.jpg']); - - const textureLoader = new THREE.TextureLoader(); - - textureEquirec = textureLoader.load('textures/2294472375_24a3b8ef46_o.jpg'); - textureEquirec.mapping = THREE.EquirectangularReflectionMapping; - textureEquirec.colorSpace = THREE.SRGBColorSpace; - - scene.background = textureCube; - - // - - const geometry = new THREE.IcosahedronGeometry(1, 15); - sphereMaterial = new THREE.MeshBasicMaterial({ envMap: textureCube }); - sphereMesh = new THREE.Mesh(geometry, sphereMaterial); - scene.add(sphereMesh); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1.5; - controls.maxDistance = 6; - - // - - params = { - Type: 'Cube', - Refraction: false, - backgroundRotationX: false, - backgroundRotationY: false, - backgroundRotationZ: false, - syncMaterial: false, - }; - - const gui = renderer.inspector.createParameters('Parameters'); - gui.add(params, 'Type', ['Cube', 'Equirectangular']).onChange(function (value) { - if (value === 'Cube') { - scene.background = textureCube; - - sphereMaterial.envMap = textureCube; - sphereMaterial.needsUpdate = true; - } else if (value === 'Equirectangular') { - scene.background = textureEquirec; - - sphereMaterial.envMap = textureEquirec; - sphereMaterial.needsUpdate = true; - } - }); - gui.add(params, 'Refraction').onChange(function (value) { - if (value) { - textureEquirec.mapping = THREE.EquirectangularRefractionMapping; - textureCube.mapping = THREE.CubeRefractionMapping; - } else { - textureEquirec.mapping = THREE.EquirectangularReflectionMapping; - textureCube.mapping = THREE.CubeReflectionMapping; - } - - sphereMaterial.needsUpdate = true; - }); - gui.add(params, 'backgroundRotationX'); - gui.add(params, 'backgroundRotationY'); - gui.add(params, 'backgroundRotationZ'); - gui.add(params, 'syncMaterial'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - if (params.backgroundRotationX) { - scene.backgroundRotation.x += 0.001; - } - - if (params.backgroundRotationY) { - scene.backgroundRotation.y += 0.001; - } - - if (params.backgroundRotationZ) { - scene.backgroundRotation.z += 0.001; - } - - if (params.syncMaterial) { - sphereMesh.material.envMapRotation.copy(scene.backgroundRotation); - } - - camera.lookAt(scene.position); - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_envmaps_bpcem.ts b/examples-testing/examples/webgpu_materials_envmaps_bpcem.ts deleted file mode 100644 index f7fe4d644..000000000 --- a/examples-testing/examples/webgpu_materials_envmaps_bpcem.ts +++ /dev/null @@ -1,202 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - bumpMap, - float, - getParallaxCorrectNormal, - pmremTexture, - reflectVector, - texture, - uniform, - vec3, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; -import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; - -let camera, scene, renderer; - -let controls, cubeCamera; - -let groundPlane, wallMat; - -init(); - -async function init() { - THREE.RectAreaLightNode.setLTC(RectAreaLightTexturesLib.init()); - - // scene - - scene = new THREE.Scene(); - - // camera - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(0, 200, -200); - - // cube camera for environment map - - const renderTarget = new THREE.CubeRenderTarget(512); - renderTarget.texture.type = THREE.HalfFloatType; - renderTarget.texture.minFilter = THREE.LinearMipmapLinearFilter; - renderTarget.texture.magFilter = THREE.LinearFilter; - renderTarget.texture.generateMipmaps = true; - renderTarget.texture.mapping = THREE.CubeReflectionMapping; - - cubeCamera = new THREE.CubeCamera(1, 1000, renderTarget); - cubeCamera.position.set(0, -100, 0); - - // ground floor ( with box projected environment mapping ) - - const loader = new THREE.TextureLoader(); - const rMap = loader.load('textures/lava/lavatile.jpg'); - rMap.wrapS = THREE.RepeatWrapping; - rMap.wrapT = THREE.RepeatWrapping; - rMap.repeat.set(2, 1); - - const roughnessUniform = uniform(0.25); - - const defaultMat = new THREE.MeshStandardNodeMaterial(); - defaultMat.envNode = pmremTexture(renderTarget.texture); - defaultMat.roughnessNode = texture(rMap).mul(roughnessUniform); - defaultMat.metalnessNode = float(1); - - const boxProjectedMat = new THREE.MeshStandardNodeMaterial(); - boxProjectedMat.envNode = pmremTexture( - renderTarget.texture, - getParallaxCorrectNormal(reflectVector, vec3(200, 200, 100), vec3(0, -50, 0)), - ); - boxProjectedMat.roughnessNode = texture(rMap).mul(roughnessUniform); - boxProjectedMat.metalnessNode = float(1); - - groundPlane = new THREE.Mesh(new THREE.PlaneGeometry(200, 100, 100), boxProjectedMat); - groundPlane.rotateX(-Math.PI / 2); - groundPlane.position.set(0, -49, 0); - scene.add(groundPlane); - - // walls - - const [diffuseTex, bumpTex] = await Promise.all([ - loader.loadAsync('textures/brick_diffuse.jpg'), - loader.loadAsync('textures/brick_bump.jpg'), - ]); - diffuseTex.colorSpace = THREE.SRGBColorSpace; - - wallMat = new THREE.MeshStandardNodeMaterial(); - - wallMat.colorNode = texture(diffuseTex); - wallMat.normalNode = bumpMap(texture(bumpTex), float(5)); - - const planeGeo = new THREE.PlaneGeometry(100, 100); - - const planeBack1 = new THREE.Mesh(planeGeo, wallMat); - planeBack1.position.z = -50; - planeBack1.position.x = -50; - scene.add(planeBack1); - - const planeBack2 = new THREE.Mesh(planeGeo, wallMat); - planeBack2.position.z = -50; - planeBack2.position.x = 50; - scene.add(planeBack2); - - const planeFront1 = new THREE.Mesh(planeGeo, wallMat); - planeFront1.position.z = 50; - planeFront1.position.x = -50; - planeFront1.rotateY(Math.PI); - scene.add(planeFront1); - - const planeFront2 = new THREE.Mesh(planeGeo, wallMat); - planeFront2.position.z = 50; - planeFront2.position.x = 50; - planeFront2.rotateY(Math.PI); - scene.add(planeFront2); - - const planeRight = new THREE.Mesh(planeGeo, wallMat); - planeRight.position.x = 100; - planeRight.rotateY(-Math.PI / 2); - scene.add(planeRight); - - const planeLeft = new THREE.Mesh(planeGeo, wallMat); - planeLeft.position.x = -100; - planeLeft.rotateY(Math.PI / 2); - scene.add(planeLeft); - - // area lights - - const width = 50; - const height = 50; - const intensity = 5; - - const blueRectLight = new THREE.RectAreaLight(0x9aaeff, intensity, width, height); - blueRectLight.position.set(-99, 5, 0); - blueRectLight.lookAt(0, 5, 0); - scene.add(blueRectLight); - - const blueRectLightHelper = new RectAreaLightHelper(blueRectLight, 0xffffff); - blueRectLight.add(blueRectLightHelper); - - const redRectLight = new THREE.RectAreaLight(0xf3aaaa, intensity, width, height); - redRectLight.position.set(99, 5, 0); - redRectLight.lookAt(0, 5, 0); - scene.add(redRectLight); - - const redRectLightHelper = new RectAreaLightHelper(redRectLight, 0xffffff); - redRectLight.add(redRectLightHelper); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - updateCubeMap(); - - window.addEventListener('resize', onWindowResize); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, -10, 0); - controls.maxDistance = 400; - controls.minDistance = 10; - controls.update(); - - // gui - - const gui = renderer.inspector.createParameters('Parameters'); - const params = { - 'box projected': true, - }; - gui.add(params, 'box projected').onChange(value => { - groundPlane.material = value ? boxProjectedMat : defaultMat; - }); - gui.add(roughnessUniform, 'value', 0, 1).name('roughness'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function updateCubeMap() { - groundPlane.visible = false; - - cubeCamera.position.copy(groundPlane.position); - - cubeCamera.update(renderer, scene); - - groundPlane.visible = true; -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts b/examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts deleted file mode 100644 index 489b04201..000000000 --- a/examples-testing/examples/webgpu_materials_envmaps_groundprojected.ts +++ /dev/null @@ -1,160 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { getGroundProjectedNormal } from 'three/addons/tsl/utils/GroundedSkybox.js'; - -import { cubeTexture, float } from 'three/tsl'; - -const params = { - height: 15, - radius: 100, - enabled: true, -}; - -let camera, scene, renderer; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(-20, 7, 20); - camera.lookAt(0, 4, 0); - - scene = new THREE.Scene(); - - const hdrLoader = new HDRLoader(); - const envMap = await hdrLoader.loadAsync('textures/equirectangular/blouberg_sunrise_2_1k.hdr'); - envMap.mapping = THREE.EquirectangularReflectionMapping; - - scene.environment = envMap; - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - - const shadow = new THREE.TextureLoader().load('models/gltf/ferrari_ao.png'); - - loader.load('models/gltf/ferrari.glb', function (gltf) { - const bodyMaterial = new THREE.MeshPhysicalMaterial({ - color: 0x000000, - metalness: 1.0, - roughness: 0.8, - clearcoat: 1.0, - clearcoatRoughness: 0.2, - }); - - const detailsMaterial = new THREE.MeshStandardMaterial({ - color: 0xffffff, - metalness: 1.0, - roughness: 0.5, - }); - - const glassMaterial = new THREE.MeshPhysicalMaterial({ - color: 0xffffff, - metalness: 0.25, - roughness: 0, - transmission: 1.0, - }); - - const carModel = gltf.scene.children[0]; - carModel.scale.multiplyScalar(4); - carModel.rotation.y = Math.PI; - - carModel.getObjectByName('body').material = bodyMaterial; - - carModel.getObjectByName('rim_fl').material = detailsMaterial; - carModel.getObjectByName('rim_fr').material = detailsMaterial; - carModel.getObjectByName('rim_rr').material = detailsMaterial; - carModel.getObjectByName('rim_rl').material = detailsMaterial; - carModel.getObjectByName('trim').material = detailsMaterial; - - carModel.getObjectByName('glass').material = glassMaterial; - - // shadow - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(0.655 * 4, 1.3 * 4), - new THREE.MeshBasicMaterial({ - map: shadow, - blending: THREE.MultiplyBlending, - toneMapped: false, - transparent: true, - premultipliedAlpha: true, - }), - ); - mesh.rotation.x = -Math.PI / 2; - carModel.add(mesh); - - scene.add(carModel); - }); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // use a cube map to avoid visual artifacts at the skybox's poles - - const size = envMap.image.height; - const cubeRenderTarget = new THREE.CubeRenderTarget(size); - cubeRenderTarget.fromEquirectangularTexture(renderer, envMap); - const cubeMap = cubeRenderTarget.texture; - - // grounded skybox - - const geometry = new THREE.IcosahedronGeometry(1, 16); - const material = new THREE.MeshBasicNodeMaterial({ side: THREE.DoubleSide }); - material.colorNode = cubeTexture(cubeMap, getGroundProjectedNormal(float(params.radius), float(params.height))); - - const skybox = new THREE.Mesh(geometry, material); - skybox.scale.setScalar(params.radius); - scene.add(skybox); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2, 0); - controls.maxPolarAngle = THREE.MathUtils.degToRad(90); - controls.maxDistance = 80; - controls.minDistance = 20; - controls.enablePan = false; - controls.update(); - - window.addEventListener('resize', onWindowResize); - - const gui = renderer.inspector.createParameters('Parameters'); - gui.add(params, 'enabled') - .name('Grounded') - .onChange(function (value) { - if (value) { - scene.add(skybox); - scene.background = null; - } else { - scene.remove(skybox); - scene.background = scene.environment; - } - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_lightmap.ts b/examples-testing/examples/webgpu_materials_lightmap.ts deleted file mode 100644 index 081de95ac..000000000 --- a/examples-testing/examples/webgpu_materials_lightmap.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { vec4, color, positionLocal, mix } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container; -let camera, scene, renderer; - -const params = { - intensity: 1, -}; - -init(); - -async function init() { - const { innerWidth, innerHeight } = window; - - container = document.createElement('div'); - document.body.appendChild(container); - - // CAMERA - - camera = new THREE.PerspectiveCamera(40, innerWidth / innerHeight, 1, 10000); - camera.position.set(700, 200, -500); - - // SCENE - - scene = new THREE.Scene(); - - // LIGHTS - - const light = new THREE.DirectionalLight(0xd5deff); - light.position.x = 300; - light.position.y = 250; - light.position.z = -500; - scene.add(light); - - // SKYDOME - - const topColor = new THREE.Color().copy(light.color); - const bottomColor = new THREE.Color(0xffffff); - const offset = 400; - const exponent = 0.6; - - const h = positionLocal.add(offset).normalize().y; - - const skyMat = new THREE.MeshBasicNodeMaterial(); - skyMat.colorNode = vec4(mix(color(bottomColor), color(topColor), h.max(0.0).pow(exponent)), 1.0); - skyMat.side = THREE.BackSide; - - const sky = new THREE.Mesh(new THREE.SphereGeometry(4000, 32, 15), skyMat); - scene.add(sky); - - // MODEL - - const loader = new THREE.ObjectLoader(); - const object = await loader.loadAsync('models/json/lightmap/lightmap.json'); - scene.add(object); - - // RENDERER - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setAnimationLoop(animate); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(innerWidth, innerHeight); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // CONTROLS - - const controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = (0.9 * Math.PI) / 2; - controls.enableZoom = false; - - // GUI - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.add(params, 'intensity', 0, 1) - .name('Light Map Intensity') - .onChange(value => { - for (const material of object.material) { - material.lightMapIntensity = value; - } - }); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_matcap.ts b/examples-testing/examples/webgpu_materials_matcap.ts deleted file mode 100644 index b72e65a07..000000000 --- a/examples-testing/examples/webgpu_materials_matcap.ts +++ /dev/null @@ -1,175 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; - -let mesh, renderer, scene, camera; - -const API = { - color: 0xffffff, // sRGB - exposure: 1.0, -}; - -init(); - -function init() { - // renderer - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // tone mapping - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = API.exposure; - - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); - camera.position.set(0, 0, 13); - - // controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - controls.enablePan = false; - - // matcap - const loaderEXR = new EXRLoader(); - const matcap = loaderEXR.load('textures/matcaps/040full.exr'); - - // normalmap - const loader = new THREE.TextureLoader(); - - const normalmap = loader.load('models/gltf/LeePerrySmith/Infinite-Level_02_Tangent_SmoothUV.jpg'); - - // model - new GLTFLoader().load('models/gltf/LeePerrySmith/LeePerrySmith.glb', function (gltf) { - mesh = gltf.scene.children[0]; - mesh.position.y = -0.25; - - mesh.material = new THREE.MeshMatcapNodeMaterial({ - color: new THREE.Color().setHex(API.color), - matcap: matcap, - normalMap: normalmap, - }); - - scene.add(mesh); - }); - - // gui - const gui = renderer.inspector.createParameters('Parameters'); - - gui.addColor(API, 'color') - .listen() - .onChange(function () { - mesh.material.color.set(API.color); - }); - - gui.add(API, 'exposure', 0, 2) - .listen() - .onChange(function () { - renderer.toneMappingExposure = API.exposure; - }); - - // drag 'n drop - initDragAndDrop(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); -} - -function animate() { - renderer.render(scene, camera); -} - -// -// drag and drop anywhere in document -// - -function updateMatcap(texture) { - if (mesh.material.matcap) { - mesh.material.matcap.dispose(); - } - - mesh.material.matcap = texture; - - texture.needsUpdate = true; - - mesh.material.needsUpdate = true; // because the color space can change -} - -function handleJPG(event) { - // PNG, WebP, AVIF, too - - function imgCallback(event) { - const texture = new THREE.Texture(event.target); - - texture.colorSpace = THREE.SRGBColorSpace; - - updateMatcap(texture); - } - - const img = new Image(); - - img.onload = imgCallback; - - img.src = event.target.result; -} - -function handleEXR(event) { - const loader = new EXRLoader(); - const texture = loader.createDataTexture(event.target.result); - - updateMatcap(texture); -} - -function loadFile(file) { - const filename = file.name; - const extension = filename.split('.').pop().toLowerCase(); - - if (extension === 'exr') { - const reader = new FileReader(); - - reader.addEventListener('load', function (event) { - handleEXR(event); - }); - - reader.readAsArrayBuffer(file); - } else { - // 'jpg', 'png' - - const reader = new FileReader(); - - reader.addEventListener('load', function (event) { - handleJPG(event); - }); - - reader.readAsDataURL(file); - } -} - -function initDragAndDrop() { - document.addEventListener('dragover', function (event) { - event.preventDefault(); - event.dataTransfer.dropEffect = 'copy'; - }); - - document.addEventListener('drop', function (event) { - event.preventDefault(); - - loadFile(event.dataTransfer.files[0]); - }); -} diff --git a/examples-testing/examples/webgpu_materials_retroreflection.ts b/examples-testing/examples/webgpu_materials_retroreflection.ts deleted file mode 100644 index 893b88cf7..000000000 --- a/examples-testing/examples/webgpu_materials_retroreflection.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let camera, scene, renderer; -let frontLight, bandMaterial; - -const params = { - retroreflective: true, - retroreflectivity: 1.0, - frontLightIntensity: 5.0, -}; - -init(); - -function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(4, 2.5, 6); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x11151d); - scene.add(camera); - - scene.add(new THREE.HemisphereLight(0xffffff, 0x223344, 0.8)); - - frontLight = new THREE.PointLight(0xffffff, params.frontLightIntensity, 18, 1.4); - camera.add(frontLight); - - createCone(); - - const grid = new THREE.GridHelper(8, 16, 0x344055, 0x202838); - scene.add(grid); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1.5, 0); - controls.update(); - - const gui = new GUI(); - gui.add(params, 'retroreflective').name('retroreflective').onChange(updateMaterial); - gui.add(params, 'retroreflectivity', 0, 1, 0.01).name('retroreflectivity').onChange(updateMaterial); - gui.add(params, 'frontLightIntensity', 0, 30, 0.1).name('front light intensity').onChange(updateMaterial); - - window.addEventListener('resize', onWindowResize); - - updateMaterial(); -} - -function createCone() { - const cone = new THREE.Group(); - scene.add(cone); - - const orangeMaterial = new THREE.MeshPhysicalNodeMaterial({ - color: 0xff6a00, - roughness: 0.45, - metalness: 0.0, - }); - - bandMaterial = new THREE.MeshPhysicalNodeMaterial({ - color: 0xf7f0d6, - roughness: 0.22, - metalness: 0.0, - retroreflectivity: params.retroreflectivity, - }); - - const base = new THREE.Mesh(new THREE.BoxGeometry(2.6, 0.24, 2.6), orangeMaterial); - base.position.y = 0.12; - cone.add(base); - - const bodyHeight = 3.2; - const bodyBottom = 0.24; - const bodyRadiusBottom = 1.0; - const bodyRadiusTop = 0.18; - - const body = new THREE.Mesh( - new THREE.CylinderGeometry(bodyRadiusTop, bodyRadiusBottom, bodyHeight, 96, 1, false), - orangeMaterial, - ); - body.position.y = bodyBottom + bodyHeight * 0.5; - cone.add(body); - - const bandHeight = 0.48; - const bandCenter = bodyBottom + bodyHeight * 0.52; - const bandBottom = bandCenter - bandHeight * 0.5; - const bandTop = bandCenter + bandHeight * 0.5; - const bandRadiusBottom = radiusAtHeight(bandBottom, bodyBottom, bodyHeight, bodyRadiusBottom, bodyRadiusTop) * 1.01; - const bandRadiusTop = radiusAtHeight(bandTop, bodyBottom, bodyHeight, bodyRadiusBottom, bodyRadiusTop) * 1.01; - - const band = new THREE.Mesh( - new THREE.CylinderGeometry(bandRadiusTop, bandRadiusBottom, bandHeight, 96, 1, true), - bandMaterial, - ); - band.position.y = bandCenter; - cone.add(band); -} - -function radiusAtHeight(y, bodyBottom, bodyHeight, radiusBottom, radiusTop) { - const t = THREE.MathUtils.clamp((y - bodyBottom) / bodyHeight, 0, 1); - return THREE.MathUtils.lerp(radiusBottom, radiusTop, t); -} - -function updateMaterial() { - bandMaterial.retroreflectivity = params.retroreflective ? params.retroreflectivity : 0; - frontLight.intensity = params.frontLightIntensity; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_sss.ts b/examples-testing/examples/webgpu_materials_sss.ts deleted file mode 100644 index c76df99dc..000000000 --- a/examples-testing/examples/webgpu_materials_sss.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture, uniform, vec3 } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { FBXLoader } from 'three/addons/loaders/FBXLoader.js'; - -let container; -let camera, scene, renderer; -let model; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 5000); - camera.position.set(0.0, 300, 400 * 4); - - scene = new THREE.Scene(); - - // Lights - - scene.add(new THREE.AmbientLight(0xc1c1c1)); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 0.03); - directionalLight.position.set(0.0, 0.5, 0.5).normalize(); - scene.add(directionalLight); - - const pointLight1 = new THREE.Mesh( - new THREE.SphereGeometry(4, 8, 8), - new THREE.MeshBasicMaterial({ color: 0xc1c1c1 }), - ); - pointLight1.add(new THREE.PointLight(0xc1c1c1, 4.0, 300, 0)); - scene.add(pointLight1); - pointLight1.position.x = 0; - pointLight1.position.y = -50; - pointLight1.position.z = 350; - - const pointLight2 = new THREE.Mesh( - new THREE.SphereGeometry(4, 8, 8), - new THREE.MeshBasicMaterial({ color: 0xc1c100 }), - ); - pointLight2.add(new THREE.PointLight(0xc1c100, 0.75, 500, 0)); - scene.add(pointLight2); - pointLight2.position.x = -100; - pointLight2.position.y = 20; - pointLight2.position.z = -260; - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - // - - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.inspector.domElement); - - // - - const controls = new OrbitControls(camera, container); - controls.minDistance = 500; - controls.maxDistance = 3000; - - window.addEventListener('resize', onWindowResize); - - initMaterial(); -} - -function initMaterial() { - const loader = new THREE.TextureLoader(); - const imgTexture = loader.load('models/fbx/white.jpg'); - imgTexture.colorSpace = THREE.SRGBColorSpace; - - const thicknessTexture = loader.load('models/fbx/bunny_thickness.jpg'); - imgTexture.wrapS = imgTexture.wrapT = THREE.RepeatWrapping; - - const material = new THREE.MeshSSSNodeMaterial(); - material.color = new THREE.Color(1.0, 0.2, 0.2); - material.roughness = 0.3; - material.thicknessColorNode = texture(thicknessTexture).mul(vec3(0.5, 0.3, 0.0)); - material.thicknessDistortionNode = uniform(0.1); - material.thicknessAmbientNode = uniform(0.4); - material.thicknessAttenuationNode = uniform(0.8); - material.thicknessPowerNode = uniform(2.0); - material.thicknessScaleNode = uniform(16.0); - - // LOADER - - const loaderFBX = new FBXLoader(); - loaderFBX.load('models/fbx/stanford-bunny.fbx', function (object) { - model = object.children[0]; - model.position.set(0, 0, 10); - model.scale.setScalar(1); - model.material = material; - scene.add(model); - }); - - initGUI(material); -} - -function initGUI(material) { - const gui = renderer.inspector.createParameters('Parameters'); - - const ThicknessControls = function () { - this.distortion = material.thicknessDistortionNode.value; - this.ambient = material.thicknessAmbientNode.value; - this.attenuation = material.thicknessAttenuationNode.value; - this.power = material.thicknessPowerNode.value; - this.scale = material.thicknessScaleNode.value; - }; - - const thicknessControls = new ThicknessControls(); - - gui.add(thicknessControls, 'distortion', 0.01, 1, 0.01).onChange(function () { - material.thicknessDistortionNode.value = thicknessControls.distortion; - }); - - gui.add(thicknessControls, 'ambient', 0.01, 5.0, 0.05).onChange(function () { - material.thicknessAmbientNode.value = thicknessControls.ambient; - }); - - gui.add(thicknessControls, 'attenuation', 0.01, 5.0, 0.05).onChange(function () { - material.thicknessAttenuationNode.value = thicknessControls.attenuation; - }); - - gui.add(thicknessControls, 'power', 0.01, 16.0, 0.1).onChange(function () { - material.thicknessPowerNode.value = thicknessControls.power; - }); - - gui.add(thicknessControls, 'scale', 0.01, 50.0, 0.1).onChange(function () { - material.thicknessScaleNode.value = thicknessControls.scale; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - if (model) model.rotation.y = performance.now() / 5000; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_texture_html.ts b/examples-testing/examples/webgpu_materials_texture_html.ts deleted file mode 100644 index 922c63a1d..000000000 --- a/examples-testing/examples/webgpu_materials_texture_html.ts +++ /dev/null @@ -1,95 +0,0 @@ -import * as THREE from 'three'; -import { installHtmlInCanvasPolyfill } from 'three-html-render/polyfill'; -import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { InteractionManager } from 'three/addons/interaction/InteractionManager.js'; - -if (!('requestPaint' in HTMLCanvasElement.prototype)) { - installHtmlInCanvasPolyfill(); - info.innerHTML += - '
HTML-in-Canvas API not available. Using polyfill.'; -} - -let camera, scene, renderer, mesh, interactions; - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - await renderer.init(); - - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.z = 500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xaaaaaa); - scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.02).texture; - - // HTML element - - const element = document.createElement('div'); - element.id = 'draw_element'; - element.innerHTML = ` - Hello world!
I'm multi-line, formatted, - rotated text with emoji (😀), RTL text - من فارسی صحبت میکنم, - vertical text, -

- 这是垂直文本 -

- an inline image (), and - - - - SVG - - ! -
- - - `; - - const geometry = new RoundedBoxGeometry(200, 200, 200, 10, 10); - - const material = new THREE.MeshStandardMaterial({ roughness: 0, metalness: 0.5 }); - material.map = new THREE.HTMLTexture(element); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // Interaction - - interactions = new InteractionManager(); - interactions.connect(renderer, camera); - interactions.add(mesh); - - // Button click handler - - element.querySelector('button').addEventListener('click', function () { - this.textContent = 'Clicked!'; - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(time) { - mesh.rotation.x = Math.sin(time * 0.0005) * 0.5; - mesh.rotation.y = Math.cos(time * 0.0008) * 0.5; - - interactions.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_texture_manualmipmap.ts b/examples-testing/examples/webgpu_materials_texture_manualmipmap.ts deleted file mode 100644 index 090372729..000000000 --- a/examples-testing/examples/webgpu_materials_texture_manualmipmap.ts +++ /dev/null @@ -1,170 +0,0 @@ -import * as THREE from 'three/webgpu'; - -const SCREEN_WIDTH = window.innerWidth; -const SCREEN_HEIGHT = window.innerHeight; - -let container; - -let camera, scene1, scene2, renderer; - -let mouseX = 0, - mouseY = 0; - -const windowHalfX = window.innerWidth / 2; -const windowHalfY = window.innerHeight / 2; - -init(); - -async function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 5000); - camera.position.z = 1500; - - scene1 = new THREE.Scene(); - scene1.background = new THREE.Color(0x000000); - scene1.fog = new THREE.Fog(0x000000, 1500, 4000); - - scene2 = new THREE.Scene(); - scene2.background = new THREE.Color(0x000000); - scene2.fog = new THREE.Fog(0x000000, 1500, 4000); - - // GROUND - - const canvas = mipmap(128, '#f00'); - const textureCanvas1 = new THREE.CanvasTexture(canvas); - textureCanvas1.mipmaps[0] = canvas; - textureCanvas1.mipmaps[1] = mipmap(64, '#0f0'); - textureCanvas1.mipmaps[2] = mipmap(32, '#00f'); - textureCanvas1.mipmaps[3] = mipmap(16, '#400'); - textureCanvas1.mipmaps[4] = mipmap(8, '#040'); - textureCanvas1.mipmaps[5] = mipmap(4, '#004'); - textureCanvas1.mipmaps[6] = mipmap(2, '#044'); - textureCanvas1.mipmaps[7] = mipmap(1, '#404'); - textureCanvas1.colorSpace = THREE.SRGBColorSpace; - textureCanvas1.repeat.set(1000, 1000); - textureCanvas1.wrapS = THREE.RepeatWrapping; - textureCanvas1.wrapT = THREE.RepeatWrapping; - - const textureCanvas2 = textureCanvas1.clone(); - textureCanvas2.magFilter = THREE.NearestFilter; - textureCanvas2.minFilter = THREE.NearestMipmapNearestFilter; - - const materialCanvas1 = new THREE.MeshBasicMaterial({ map: textureCanvas1 }); - const materialCanvas2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: textureCanvas2 }); - - const geometry = new THREE.PlaneGeometry(100, 100); - - const meshCanvas1 = new THREE.Mesh(geometry, materialCanvas1); - meshCanvas1.rotation.x = -Math.PI / 2; - meshCanvas1.scale.set(1000, 1000, 1000); - - const meshCanvas2 = new THREE.Mesh(geometry, materialCanvas2); - meshCanvas2.rotation.x = -Math.PI / 2; - meshCanvas2.scale.set(1000, 1000, 1000); - - scene1.add(meshCanvas1); - scene2.add(meshCanvas2); - - // PAINTING - - const texturePainting1 = await new THREE.TextureLoader().loadAsync( - 'textures/758px-Canestra_di_frutta_(Caravaggio).jpg', - ); - const texturePainting2 = texturePainting1.clone(); - - texturePainting1.colorSpace = THREE.SRGBColorSpace; - texturePainting2.colorSpace = THREE.SRGBColorSpace; - - texturePainting1.minFilter = texturePainting1.magFilter = THREE.LinearFilter; - texturePainting2.minFilter = texturePainting2.magFilter = THREE.NearestFilter; - - const materialPainting1 = new THREE.MeshBasicMaterial({ color: 0xffffff, map: texturePainting1 }); - const materialPainting2 = new THREE.MeshBasicMaterial({ color: 0xffccaa, map: texturePainting2 }); - - const geometryPainting = new THREE.PlaneGeometry(100, 100); - const mesh1 = new THREE.Mesh(geometryPainting, materialPainting1); - const mesh2 = new THREE.Mesh(geometryPainting, materialPainting2); - - addPainting(scene1, mesh1); - addPainting(scene2, mesh2); - - function addPainting(zscene, zmesh) { - const image = texturePainting1.image; - - zmesh.scale.x = image.width / 100; - zmesh.scale.y = image.height / 100; - - zscene.add(zmesh); - - const meshFrame = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000 })); - meshFrame.position.z = -10.0; - meshFrame.scale.x = (1.1 * image.width) / 100; - meshFrame.scale.y = (1.1 * image.height) / 100; - zscene.add(meshFrame); - - const meshShadow = new THREE.Mesh( - geometry, - new THREE.MeshBasicMaterial({ color: 0x000000, opacity: 0.75, transparent: true }), - ); - meshShadow.position.y = (-1.1 * image.height) / 2; - meshShadow.position.z = (-1.1 * image.height) / 2; - meshShadow.rotation.x = -Math.PI / 2; - meshShadow.scale.x = (1.1 * image.width) / 100; - meshShadow.scale.y = (1.1 * image.height) / 100; - zscene.add(meshShadow); - - const floorHeight = (-1.117 * image.height) / 2; - meshCanvas1.position.y = meshCanvas2.position.y = floorHeight; - } - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(animate); - renderer.autoClear = false; - - renderer.domElement.style.position = 'relative'; - container.appendChild(renderer.domElement); - - document.addEventListener('mousemove', onDocumentMouseMove); -} - -function mipmap(size, color) { - const imageCanvas = document.createElement('canvas'); - const context = imageCanvas.getContext('2d'); - - imageCanvas.width = imageCanvas.height = size; - - context.fillStyle = '#444'; - context.fillRect(0, 0, size, size); - - context.fillStyle = color; - context.fillRect(0, 0, size / 2, size / 2); - context.fillRect(size / 2, size / 2, size / 2, size / 2); - return imageCanvas; -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -function animate() { - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-(mouseY - 200) - camera.position.y) * 0.05; - - camera.lookAt(scene1.position); - - renderer.clear(); - renderer.setScissorTest(true); - - renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene1, camera); - - renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene2, camera); - - renderer.setScissorTest(false); -} diff --git a/examples-testing/examples/webgpu_materials_toon.ts b/examples-testing/examples/webgpu_materials_toon.ts deleted file mode 100644 index 78cb62ed6..000000000 --- a/examples-testing/examples/webgpu_materials_toon.ts +++ /dev/null @@ -1,149 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { toonOutlinePass } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -let container; - -let camera, scene, renderer, renderPipeline; -let particleLight; - -const loader = new FontLoader(); -loader.load('fonts/gentilis_regular.typeface.json', function (font) { - init(font); -}); - -function init(font) { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2500); - camera.position.set(0.0, 400, 400 * 3.5); - - // - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x444488); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // - - renderPipeline = new THREE.RenderPipeline(renderer); - - renderPipeline.outputNode = toonOutlinePass(scene, camera); - - // Materials - - const cubeWidth = 400; - const numberOfSpheresPerSide = 5; - const sphereRadius = (cubeWidth / numberOfSpheresPerSide) * 0.8 * 0.5; - const stepSize = 1.0 / numberOfSpheresPerSide; - - const geometry = new THREE.SphereGeometry(sphereRadius, 32, 16); - - for (let alpha = 0, alphaIndex = 0; alpha <= 1.0; alpha += stepSize, alphaIndex++) { - const colors = new Uint8Array(alphaIndex + 2); - - for (let c = 0; c <= colors.length; c++) { - colors[c] = (c / colors.length) * 256; - } - - const gradientMap = new THREE.DataTexture(colors, colors.length, 1, THREE.RedFormat); - gradientMap.needsUpdate = true; - - for (let beta = 0; beta <= 1.0; beta += stepSize) { - for (let gamma = 0; gamma <= 1.0; gamma += stepSize) { - // basic monochromatic energy preservation - const diffuseColor = new THREE.Color() - .setHSL(alpha, 0.5, gamma * 0.5 + 0.1) - .multiplyScalar(1 - beta * 0.2); - - const material = new THREE.MeshToonNodeMaterial({ - color: diffuseColor, - gradientMap: gradientMap, - }); - - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = alpha * 400 - 200; - mesh.position.y = beta * 400 - 200; - mesh.position.z = gamma * 400 - 200; - - scene.add(mesh); - } - } - } - - function addLabel(name, location) { - const textGeo = new TextGeometry(name, { - font: font, - - size: 20, - depth: 1, - curveSegments: 1, - }); - - const textMaterial = new THREE.MeshBasicNodeMaterial(); - const textMesh = new THREE.Mesh(textGeo, textMaterial); - textMesh.position.copy(location); - scene.add(textMesh); - } - - addLabel('-gradientMap', new THREE.Vector3(-350, 0, 0)); - addLabel('+gradientMap', new THREE.Vector3(350, 0, 0)); - - addLabel('-diffuse', new THREE.Vector3(0, 0, -300)); - addLabel('+diffuse', new THREE.Vector3(0, 0, 300)); - - particleLight = new THREE.Mesh( - new THREE.SphereGeometry(4, 8, 8), - new THREE.MeshBasicNodeMaterial({ color: 0xffffff }), - ); - scene.add(particleLight); - - // Lights - - scene.add(new THREE.AmbientLight(0xc1c1c1, 3)); - - const pointLight = new THREE.PointLight(0xffffff, 2, 800, 0); - particleLight.add(pointLight); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 200; - controls.maxDistance = 2000; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - const timer = Date.now() * 0.00025; - - particleLight.position.x = Math.sin(timer * 7) * 300; - particleLight.position.y = Math.cos(timer * 5) * 400; - particleLight.position.z = Math.cos(timer * 3) * 300; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_materials_transmission.ts b/examples-testing/examples/webgpu_materials_transmission.ts deleted file mode 100644 index 310d979d5..000000000 --- a/examples-testing/examples/webgpu_materials_transmission.ts +++ /dev/null @@ -1,173 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -const params = { - color: 0xffffff, - transmission: 1, - opacity: 1, - metalness: 0, - roughness: 0, - ior: 1.5, - thickness: 0.01, - specularIntensity: 1, - specularColor: 0xffffff, - envMapIntensity: 1, - lightIntensity: 1, - exposure: 1, -}; - -let camera, scene, renderer; - -let mesh; - -const hdrEquirect = new UltraHDRLoader() - .setPath('textures/equirectangular/') - .load('royal_esplanade_2k.hdr.jpg', function () { - hdrEquirect.mapping = THREE.EquirectangularReflectionMapping; - - init(); - }); - -function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = params.exposure; - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 2000); - camera.position.set(0, 0, 120); - - // - - scene.background = hdrEquirect; - - // - - const geometry = new THREE.SphereGeometry(20, 64, 32); - - const texture = new THREE.CanvasTexture(generateTexture()); - texture.magFilter = THREE.NearestFilter; - texture.wrapT = THREE.RepeatWrapping; - texture.wrapS = THREE.RepeatWrapping; - texture.repeat.set(1, 3.5); - - const material = new THREE.MeshPhysicalMaterial({ - color: params.color, - metalness: params.metalness, - roughness: params.roughness, - ior: params.ior, - alphaMap: texture, - envMap: hdrEquirect, - envMapIntensity: params.envMapIntensity, - transmission: params.transmission, // use material.transmission for glass materials - specularIntensity: params.specularIntensity, - specularColor: params.specularColor, - opacity: params.opacity, - side: THREE.DoubleSide, - transparent: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 10; - controls.maxDistance = 150; - - window.addEventListener('resize', onWindowResize); - - // - - const gui = renderer.inspector.createParameters('Settings'); - - gui.addColor(params, 'color').onChange(function () { - material.color.set(params.color); - }); - - gui.add(params, 'transmission', 0, 1, 0.01).onChange(function () { - material.transmission = params.transmission; - }); - - gui.add(params, 'opacity', 0, 1, 0.01).onChange(function () { - material.opacity = params.opacity; - }); - - gui.add(params, 'metalness', 0, 1, 0.01).onChange(function () { - material.metalness = params.metalness; - }); - - gui.add(params, 'roughness', 0, 1, 0.01).onChange(function () { - material.roughness = params.roughness; - }); - - gui.add(params, 'ior', 1, 2, 0.01).onChange(function () { - material.ior = params.ior; - }); - - gui.add(params, 'thickness', 0, 5, 0.01).onChange(function () { - material.thickness = params.thickness; - }); - - gui.add(params, 'specularIntensity', 0, 1, 0.01) - .name('specular intensity') - .onChange(function () { - material.specularIntensity = params.specularIntensity; - }); - - gui.addColor(params, 'specularColor') - .name('specular color') - .onChange(function () { - material.specularColor.set(params.specularColor); - }); - - gui.add(params, 'envMapIntensity', 0, 1, 0.01) - .name('envMap intensity') - .onChange(function () { - material.envMapIntensity = params.envMapIntensity; - }); - - gui.add(params, 'exposure', 0, 1, 0.01).onChange(function () { - renderer.toneMappingExposure = params.exposure; - }); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -// - -function generateTexture() { - const canvas = document.createElement('canvas'); - canvas.width = 2; - canvas.height = 2; - - const context = canvas.getContext('2d'); - context.fillStyle = 'white'; - context.fillRect(0, 1, 2, 1); - - return canvas; -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materials_video.ts b/examples-testing/examples/webgpu_materials_video.ts deleted file mode 100644 index 084030e44..000000000 --- a/examples-testing/examples/webgpu_materials_video.ts +++ /dev/null @@ -1,179 +0,0 @@ -import * as THREE from 'three/webgpu'; - -let container; - -let camera, scene, renderer; - -let video, texture, material, mesh; - -let mouseX = 0; -let mouseY = 0; - -let windowHalfX = window.innerWidth / 2; -let windowHalfY = window.innerHeight / 2; - -let cube_count; - -const meshes = [], - materials = [], - xgrid = 20, - ygrid = 10; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 500; - - scene = new THREE.Scene(); - - const light = new THREE.DirectionalLight(0xffffff, 7); - light.position.set(0.5, 1, 1).normalize(); - scene.add(light); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - video = document.getElementById('video'); - video.play(); - video.addEventListener('play', function () { - this.currentTime = 3; - }); - - texture = new THREE.VideoTexture(video); - texture.colorSpace = THREE.SRGBColorSpace; - - // - - let i, j, ox, oy, geometry; - - const ux = 1 / xgrid; - const uy = 1 / ygrid; - - const xsize = 480 / xgrid; - const ysize = 204 / ygrid; - - const parameters = { color: 0xffffff, map: texture }; - - cube_count = 0; - - for (i = 0; i < xgrid; i++) { - for (j = 0; j < ygrid; j++) { - ox = i; - oy = j; - - geometry = new THREE.BoxGeometry(xsize, ysize, xsize); - - change_uvs(geometry, ux, uy, ox, oy); - - materials[cube_count] = new THREE.MeshPhongMaterial(parameters); - - material = materials[cube_count]; - - material.hue = i / xgrid; - material.saturation = 1 - j / ygrid; - - material.color.setHSL(material.hue, material.saturation, 0.5); - - mesh = new THREE.Mesh(geometry, material); - - mesh.position.x = (i - xgrid / 2) * xsize; - mesh.position.y = (j - ygrid / 2) * ysize; - mesh.position.z = 0; - - mesh.scale.x = mesh.scale.y = mesh.scale.z = 1; - - scene.add(mesh); - - mesh.dx = 0.001 * (0.5 - Math.random()); - mesh.dy = 0.001 * (0.5 - Math.random()); - - meshes[cube_count] = mesh; - - cube_count += 1; - } - } - - document.addEventListener('mousemove', onDocumentMouseMove); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - windowHalfX = window.innerWidth / 2; - windowHalfY = window.innerHeight / 2; - - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function change_uvs(geometry, unitx, unity, offsetx, offsety) { - const uvs = geometry.attributes.uv.array; - - for (let i = 0; i < uvs.length; i += 2) { - uvs[i] = (uvs[i] + offsetx) * unitx; - uvs[i + 1] = (uvs[i + 1] + offsety) * unity; - } -} - -function onDocumentMouseMove(event) { - mouseX = event.clientX - windowHalfX; - mouseY = (event.clientY - windowHalfY) * 0.3; -} - -// - -let h, - counter = 1; - -function render() { - const time = Date.now() * 0.00005; - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y += (-mouseY - camera.position.y) * 0.05; - - camera.lookAt(scene.position); - - for (let i = 0; i < cube_count; i++) { - material = materials[i]; - - h = ((360 * (material.hue + time)) % 360) / 360; - material.color.setHSL(h, material.saturation, 0.5); - } - - if (counter % 1000 > 200) { - for (let i = 0; i < cube_count; i++) { - mesh = meshes[i]; - - mesh.rotation.x += 10 * mesh.dx; - mesh.rotation.y += 10 * mesh.dy; - - mesh.position.x -= 150 * mesh.dx; - mesh.position.y += 150 * mesh.dy; - mesh.position.z += 300 * mesh.dx; - } - } - - if (counter % 1000 === 0) { - for (let i = 0; i < cube_count; i++) { - mesh = meshes[i]; - - mesh.dx *= -1; - mesh.dy *= -1; - } - } - - counter++; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_materialx_noise.ts b/examples-testing/examples/webgpu_materialx_noise.ts deleted file mode 100644 index 2edfe8b4d..000000000 --- a/examples-testing/examples/webgpu_materialx_noise.ts +++ /dev/null @@ -1,355 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - Fn, - add, - dot, - element, - float, - floor, - int, - mix, - mul, - normalWorld, - sub, - time, - uv, - vec2, - vec3, - mx_cell_noise_float, - mx_fractal_noise_vec3, - mx_modulo, - mx_noise_vec3, - mx_unifiednoise2d, - mx_unifiednoise3d, - mx_worley_noise_float_2d, - mx_worley_noise_float_3d, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; -import { mxHextileComputeBlendWeights, mxHextileCoord } from 'three/addons/loaders/materialx/MaterialXHextile.js'; - -let container; - -let camera, scene, renderer; - -let particleLight; -let group; -const spheres = []; - -init(); - -async function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(27, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 190; - - scene = new THREE.Scene(); - - group = new THREE.Group(); - scene.add(group); - - const [hdrTexture, font] = await Promise.all([ - new HDRCubeTextureLoader() - .setPath('textures/cube/pisaHDR/') - .loadAsync(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr']), - new FontLoader().loadAsync('fonts/helvetiker_regular.typeface.json'), - ]); - - const geometry = new THREE.SphereGeometry(5, 64, 32); - const labelMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff }); - - const position2D = uv(0) - .mul(12) - .add(vec2(time.mul(0.35), time.mul(0.19))); - const position3D = normalWorld.mul(4).add(vec3(time.mul(0.35), time.mul(0.19), time.mul(0.27))); - const fractal2D = vec3(position2D.x, position2D.y, 0).mul(0.35); - const fractal3D = position3D.mul(0.35); - const unifiedOffset2D = vec2(time.mul(0.35), time.mul(0.19)); - const unifiedOffset3D = vec3(time.mul(0.35), time.mul(0.19), time.mul(0.27)); - const unifiedNoise3D = ( - noiseType, - position, - freq, - offset, - jitter = 1, - outmin = 0, - outmax = 1, - clampoutput = false, - octaves = 1, - lacunarity = 2, - diminish = 0.5, - style = 0, - ) => - Fn(() => - mx_unifiednoise3d( - noiseType, - position, - freq, - offset, - jitter, - outmin, - outmax, - clampoutput, - octaves, - lacunarity, - diminish, - style, - ), - )(); - const textileTexcoord = (speedX, speedY) => - uv(0) - .mul(3) - .add(vec2(time.mul(speedX), time.mul(speedY))); - const checkerboard = (color1, color2, uvtiling, uvoffset, texcoord) => { - const tiledUv = sub(mul(texcoord, uvtiling), uvoffset); - const checkerMix = mx_modulo(dot(floor(tiledUv), vec2(1, 1)), float(2)); - return mix(color2, color1, checkerMix); - }; - const hextiledCheckerboard = ( - texcoord, - { - color1 = vec3(1, 1, 1), - color2 = vec3(0, 0, 0), - uvtiling = vec2(4, 4), - uvoffset = vec2(0, 0), - tiling = vec2(1, 1), - rotation = 0, - rotationrange = vec2(0, 360), - scale = 0, - scalerange = vec2(0.5, 2), - offset = 0, - offsetrange = vec2(0, 1), - falloff = 0.5, - falloffcontrast = 0.5, - lumacoeffs = vec3(0.2722287, 0.6740818, 0.0536895), - } = {}, - ) => { - const tileData = mxHextileCoord( - mul(texcoord, tiling), - rotation, - rotationrange, - scale, - scalerange, - offset, - offsetrange, - ); - const c0 = checkerboard(color1, color2, uvtiling, uvoffset, tileData.coords[0]); - const c1 = checkerboard(color1, color2, uvtiling, uvoffset, tileData.coords[1]); - const c2 = checkerboard(color1, color2, uvtiling, uvoffset, tileData.coords[2]); - const luminanceWeights = mix( - vec3(1, 1, 1), - vec3(dot(c0, lumacoeffs), dot(c1, lumacoeffs), dot(c2, lumacoeffs)), - vec3(falloffcontrast, falloffcontrast, falloffcontrast), - ); - const blendWeights = mxHextileComputeBlendWeights(luminanceWeights, tileData.weights, falloff); - return add( - add(mul(element(blendWeights, 0), c0), mul(element(blendWeights, 1), c1)), - mul(element(blendWeights, 2), c2), - ); - }; - - const noiseExamples = [ - { label: ['Noise', '2D'], createNode: () => mx_noise_vec3(position2D) }, - { label: ['Noise', '3D'], createNode: () => mx_noise_vec3(position3D) }, - { label: ['Cellnoise', '2D'], createNode: () => mx_cell_noise_float(position2D) }, - { label: ['Cellnoise', '3D'], createNode: () => mx_cell_noise_float(position3D) }, - { label: ['Worley', '2D style 0'], createNode: () => mx_worley_noise_float_2d(position2D, 1, 0) }, - { label: ['Worley', '3D style 0'], createNode: () => mx_worley_noise_float_3d(position3D, 1, 0) }, - { label: ['Worley', '2D style 1'], createNode: () => mx_worley_noise_float_2d(position2D, 1, 1) }, - { label: ['Worley', '3D style 1'], createNode: () => mx_worley_noise_float_3d(position3D, 1, 1) }, - { label: ['Fractal', '2D'], createNode: () => mx_fractal_noise_vec3(fractal2D) }, - { label: ['Fractal', '3D'], createNode: () => mx_fractal_noise_vec3(fractal3D) }, - { - label: ['Unified Perlin', '2D'], - createNode: () => mx_unifiednoise2d(int(0), position2D, vec2(1, 1), unifiedOffset2D), - }, - { - label: ['Unified Perlin', '3D'], - createNode: () => unifiedNoise3D(int(0), position3D, vec3(1, 1, 1), unifiedOffset3D), - }, - { - label: ['Unified Cell', '2D'], - createNode: () => mx_unifiednoise2d(int(1), position2D, vec2(1, 1), unifiedOffset2D), - }, - { - label: ['Unified Cell', '3D'], - createNode: () => unifiedNoise3D(int(1), position3D, vec3(1, 1, 1), unifiedOffset3D), - }, - { - label: ['Unified Worley', '2D style 0'], - createNode: () => - mx_unifiednoise2d(int(2), position2D, vec2(1, 1), unifiedOffset2D, 1, 0, 1, false, 1, 2, 0.5, 0), - }, - { - label: ['Unified Worley', '3D style 0'], - createNode: () => - unifiedNoise3D(int(2), position3D, vec3(1, 1, 1), unifiedOffset3D, 1, 0, 1, false, 1, 2, 0.5, 0), - }, - { - label: ['Unified Worley', '2D style 1'], - createNode: () => - mx_unifiednoise2d(int(2), position2D, vec2(1, 1), unifiedOffset2D, 1, 0, 1, false, 1, 2, 0.5, 1), - }, - { - label: ['Unified Worley', '3D style 1'], - createNode: () => - unifiedNoise3D(int(2), position3D, vec3(1, 1, 1), unifiedOffset3D, 1, 0, 1, false, 1, 2, 0.5, 1), - }, - { - label: ['Unified Fractal', '2D'], - createNode: () => mx_unifiednoise2d(int(3), position2D, vec2(1, 1), unifiedOffset2D, 1, 0, 1, false, 3), - }, - { - label: ['Unified Fractal', '3D'], - createNode: () => unifiedNoise3D(int(3), position3D, vec3(1, 1, 1), unifiedOffset3D, 1, 0, 1, false, 3), - }, - { - label: ['Hex Tiled', 'checkerboard'], - createNode: () => - hextiledCheckerboard(textileTexcoord(0.08, 0.04), { - color1: vec3(1, 1, 1), - color2: vec3(0, 0, 0), - uvtiling: vec2(8, 8), - tiling: vec2(2.2, 2.2), - rotation: 0.25, - scale: 0.1, - offset: 0.2, - falloff: 0.35, - falloffcontrast: 0.25, - }), - }, - ]; - - createNoiseGrid(noiseExamples, geometry, font, labelMaterial); - - scene.background = hdrTexture; - scene.environment = hdrTexture; - - // LIGHTS - - particleLight = new THREE.Mesh( - new THREE.SphereGeometry(0.4, 8, 8), - new THREE.MeshBasicMaterial({ color: 0xffffff }), - ); - scene.add(particleLight); - - particleLight.add(new THREE.PointLight(0xffffff, 1000)); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setAnimationLoop(render); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.25; - - // EVENTS - - new OrbitControls(camera, renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -// - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -// - -function render() { - const timer = Date.now() * 0.00025; - - particleLight.position.x = Math.sin(timer * 7) * 30; - particleLight.position.y = Math.cos(timer * 5) * 40; - particleLight.position.z = Math.cos(timer * 3) * 30; - - for (let i = 0; i < spheres.length; i++) { - const child = spheres[i]; - child.rotation.y += 0.005; - } - - renderer.render(scene, camera); -} - -function createNoiseGrid(noiseExamples, geometry, font, labelMaterial) { - const columns = 7; - const spacingX = 15.5; - const spacingY = 18; - const rowOffset = (Math.ceil(noiseExamples.length / columns) - 1) * spacingY * 0.5; - const columnOffset = (columns - 1) * spacingX * 0.5; - const errorMaterial = new THREE.MeshBasicMaterial({ color: 0xff3333 }); - - for (let i = 0; i < noiseExamples.length; i++) { - const example = noiseExamples[i]; - const column = i % columns; - const row = Math.floor(i / columns); - const x = column * spacingX - columnOffset; - const y = rowOffset - row * spacingY; - const labelLines = example.label.slice(); - - const material = new THREE.MeshPhysicalNodeMaterial(); - - try { - material.colorNode = example.createNode(); - } catch (error) { - console.error(`Failed to create MaterialX noise sample: ${example.label.join(' ')}`, error); - labelLines.push('Failed'); - } - - const mesh = new THREE.Mesh(geometry, material.colorNode ? material : errorMaterial); - mesh.position.set(x, y, 0); - group.add(mesh); - spheres.push(mesh); - - const label = createLabel(labelLines, font, labelMaterial); - label.position.set(x, y - 7.5, 0); - group.add(label); - } -} - -function createLabel(lines, font, material) { - const label = new THREE.Group(); - const lineHeight = 1.55; - const startY = (lines.length - 1) * lineHeight * 0.5; - - for (let i = 0; i < lines.length; i++) { - const textGeometry = new TextGeometry(lines[i], { - font: font, - size: 1.15, - depth: 0.02, - curveSegments: 2, - }); - - textGeometry.computeBoundingBox(); - - const boundingBox = textGeometry.boundingBox; - const offsetX = -0.5 * (boundingBox.max.x - boundingBox.min.x); - const offsetY = -0.5 * (boundingBox.max.y - boundingBox.min.y); - textGeometry.translate(offsetX, offsetY, 0); - - const textMesh = new THREE.Mesh(textGeometry, material); - textMesh.position.y = startY - i * lineHeight; - label.add(textMesh); - } - - return label; -} diff --git a/examples-testing/examples/webgpu_mesh_batch.ts b/examples-testing/examples/webgpu_mesh_batch.ts deleted file mode 100644 index 6a6656e21..000000000 --- a/examples-testing/examples/webgpu_mesh_batch.ts +++ /dev/null @@ -1,265 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { radixSort } from 'three/addons/utils/SortUtils.js'; - -import { normalView, packNormalToRGB, diffuseColor, vec4 } from 'three/tsl'; - -let camera, scene, renderer; -let controls; -let gui; -let geometries, mesh, material; -const ids = []; - -const matrix = new THREE.Matrix4(); - -// - -const position = new THREE.Vector3(); -const rotation = new THREE.Euler(); -const quaternion = new THREE.Quaternion(); -const scale = new THREE.Vector3(); - -// - -const MAX_GEOMETRY_COUNT = 20000; - -const api = { - webgpu: true, - count: 512, - dynamic: 16, - - sortObjects: true, - perObjectFrustumCulled: true, - opacity: 1, - useCustomSort: true, - randomizeGeometry: () => { - for (let i = 0; i < api.count; i++) { - mesh.setGeometryIdAt(i, Math.floor(Math.random() * geometries.length)); - } - }, -}; - -init(); - -// - -function randomizeMatrix(matrix) { - position.x = Math.random() * 40 - 20; - position.y = Math.random() * 40 - 20; - position.z = Math.random() * 40 - 20; - - rotation.x = Math.random() * 2 * Math.PI; - rotation.y = Math.random() * 2 * Math.PI; - rotation.z = Math.random() * 2 * Math.PI; - - quaternion.setFromEuler(rotation); - - scale.x = scale.y = scale.z = 0.5 + Math.random() * 0.5; - - return matrix.compose(position, quaternion, scale); -} - -function randomizeRotationSpeed(rotation) { - rotation.x = Math.random() * 0.01; - rotation.y = Math.random() * 0.01; - rotation.z = Math.random() * 0.01; - return rotation; -} - -function initGeometries() { - geometries = [ - new THREE.ConeGeometry(1.0, 2.0), - new THREE.BoxGeometry(2.0, 2.0, 2.0), - new THREE.SphereGeometry(1.0, 16, 8), - ]; -} - -function createMaterial() { - if (!material) { - material = new THREE.MeshBasicNodeMaterial(); - material.outputNode = vec4(diffuseColor.mul(packNormalToRGB(normalView).y.add(0.5)).rgb, diffuseColor.a); - } - - return material; -} - -function cleanup() { - if (mesh) { - mesh.parent.remove(mesh); - - if (mesh.dispose) { - mesh.dispose(); - } - } -} - -function initMesh() { - cleanup(); - initBatchedMesh(); -} - -function initBatchedMesh() { - const geometryCount = api.count; - const vertexCount = geometries.length * 512; - const indexCount = geometries.length * 1024; - - const euler = new THREE.Euler(); - const matrix = new THREE.Matrix4(); - mesh = new THREE.BatchedMesh(geometryCount, vertexCount, indexCount, createMaterial()); - mesh.userData.rotationSpeeds = []; - - // disable full-object frustum culling since all of the objects can be dynamic. - mesh.frustumCulled = false; - - ids.length = 0; - - const geometryIds = [ - mesh.addGeometry(geometries[0]), - mesh.addGeometry(geometries[1]), - mesh.addGeometry(geometries[2]), - ]; - for (let i = 0; i < api.count; i++) { - const id = mesh.addInstance(geometryIds[i % geometryIds.length]); - mesh.setMatrixAt(id, randomizeMatrix(matrix)); - mesh.setColorAt(id, new THREE.Color(Math.random() * 0xffffff)); - - const rotationMatrix = new THREE.Matrix4(); - rotationMatrix.makeRotationFromEuler(randomizeRotationSpeed(euler)); - mesh.userData.rotationSpeeds.push(rotationMatrix); - - ids.push(id); - } - - scene.add(mesh); -} - -function init(forceWebGL = false) { - if (renderer) { - renderer.dispose(); - controls.dispose(); - document.body.removeChild(renderer.domElement); - } - - // camera - - const aspect = window.innerWidth / window.innerHeight; - - camera = new THREE.PerspectiveCamera(70, aspect, 1, 100); - camera.position.z = 30; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(animate); - - // scene - - scene = new THREE.Scene(); - scene.background = forceWebGL ? new THREE.Color(0xffc1c1) : new THREE.Color(0xc1c1ff); - - document.body.appendChild(renderer.domElement); - - initGeometries(); - initMesh(); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = 1.0; - - // gui - - gui = renderer.inspector.createParameters('Settings'); - gui.add(api, 'webgpu').onChange(() => { - init(!api.webgpu); - }); - gui.add(api, 'count', 1, MAX_GEOMETRY_COUNT, 1).onChange(initMesh); - gui.add(api, 'dynamic', 0, MAX_GEOMETRY_COUNT, 1); - - gui.add(api, 'opacity', 0, 1).onChange(v => { - if (v < 1) { - material.transparent = true; - material.depthWrite = false; - } else { - material.transparent = false; - material.depthWrite = true; - } - - material.opacity = v; - material.needsUpdate = true; - }); - gui.add(api, 'sortObjects'); - gui.add(api, 'perObjectFrustumCulled'); - gui.add(api, 'useCustomSort'); - gui.add(api, 'randomizeGeometry').name('randomize geometry'); - - // listeners - - window.addEventListener('resize', onWindowResize); - - function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - } - - async function animate() { - animateMeshes(); - - controls.update(); - - if (mesh.isBatchedMesh) { - mesh.sortObjects = api.sortObjects; - mesh.perObjectFrustumCulled = api.perObjectFrustumCulled; - mesh.setCustomSort(api.useCustomSort ? sortFunction : null); - } - - renderer.render(scene, camera); - } - - function animateMeshes() { - const loopNum = Math.min(api.count, api.dynamic); - - for (let i = 0; i < loopNum; i++) { - const rotationMatrix = mesh.userData.rotationSpeeds[i]; - const id = ids[i]; - - mesh.getMatrixAt(id, matrix); - matrix.multiply(rotationMatrix); - mesh.setMatrixAt(id, matrix); - } - } -} - -// - -function sortFunction(list, camera) { - // initialize options - this._options = this._options || { - get: el => el.z, - aux: new Array(this.maxInstanceCount), - }; - - const options = this._options; - options.reversed = this.material.transparent; - - // convert depth to unsigned 32 bit range - const factor = (2 ** 32 - 1) / camera.far; // UINT32_MAX / max_depth - for (let i = 0, l = list.length; i < l; i++) { - list[i].z *= factor; - } - - // perform a fast-sort using the hybrid radix sort function - radixSort(list, options); -} diff --git a/examples-testing/examples/webgpu_mirror.ts b/examples-testing/examples/webgpu_mirror.ts deleted file mode 100644 index 565467340..000000000 --- a/examples-testing/examples/webgpu_mirror.ts +++ /dev/null @@ -1,195 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { reflector, uv, texture, color } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -let cameraControls; - -let sphereGroup, smallSphere; - -init(); - -function init() { - // scene - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - // camera - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); - camera.position.set(0, 75, 160); - - // - - let geometry, material; - - // - - sphereGroup = new THREE.Object3D(); - scene.add(sphereGroup); - - geometry = new THREE.CylinderGeometry(0.1, 15 * Math.cos((Math.PI / 180) * 30), 0.1, 24, 1); - material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x8d8d8d }); - const sphereCap = new THREE.Mesh(geometry, material); - sphereCap.position.y = -15 * Math.sin((Math.PI / 180) * 30) - 0.05; - sphereCap.rotateX(-Math.PI); - - geometry = new THREE.SphereGeometry(15, 24, 24, Math.PI / 2, Math.PI * 2, 0, (Math.PI / 180) * 120); - const halfSphere = new THREE.Mesh(geometry, material); - halfSphere.add(sphereCap); - halfSphere.rotateX((-Math.PI / 180) * 135); - halfSphere.rotateZ((-Math.PI / 180) * 20); - halfSphere.position.y = 7.5 + 15 * Math.sin((Math.PI / 180) * 30); - - sphereGroup.add(halfSphere); - - geometry = new THREE.IcosahedronGeometry(5, 0); - material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x7b7b7b, flatShading: true }); - smallSphere = new THREE.Mesh(geometry, material); - scene.add(smallSphere); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const floorNormal = textureLoader.load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); - floorNormal.wrapS = THREE.RepeatWrapping; - floorNormal.wrapT = THREE.RepeatWrapping; - - const decalDiffuse = textureLoader.load('textures/decal/decal-diffuse.png'); - decalDiffuse.colorSpace = THREE.SRGBColorSpace; - - const decalNormal = textureLoader.load('textures/decal/decal-normal.jpg'); - - // reflectors / mirrors - - const groundReflector = reflector().toInspector('Ground Reflector'); - const verticalReflector = reflector().toInspector('Vertical Reflector'); - - const groundNormalScale = -0.08; - const verticalNormalScale = 0.1; - - const groundUVOffset = texture(decalNormal).xy.mul(2).sub(1).mul(groundNormalScale); - const verticalUVOffset = texture(floorNormal, uv().mul(5)).xy.mul(2).sub(1).mul(verticalNormalScale); - - groundReflector.uvNode = groundReflector.uvNode.add(groundUVOffset); - verticalReflector.uvNode = verticalReflector.uvNode.add(verticalUVOffset); - - const groundNode = texture(decalDiffuse).a.mix(color(0xffffff), groundReflector); - const verticalNode = color(0x0000ff).mul(0.1).add(verticalReflector); - - // walls - - const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); - - // - - const planeBottom = new THREE.Mesh( - planeGeo, - new THREE.MeshPhongNodeMaterial({ - colorNode: groundNode, - }), - ); - planeBottom.rotateX(-Math.PI / 2); - planeBottom.add(groundReflector.target); - scene.add(planeBottom); - - const planeBack = new THREE.Mesh( - planeGeo, - new THREE.MeshPhongNodeMaterial({ - colorNode: verticalNode, - }), - ); - planeBack.position.z = -50; - planeBack.position.y = 50; - planeBack.add(verticalReflector.target); - scene.add(planeBack); - - // - - const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeTop.position.y = 100; - planeTop.rotateX(Math.PI / 2); - scene.add(planeTop); - - const planeFront = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); - planeFront.position.z = 50; - planeFront.position.y = 50; - planeFront.rotateY(Math.PI); - scene.add(planeFront); - - const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); - planeRight.position.x = 50; - planeRight.position.y = 50; - planeRight.rotateY(-Math.PI / 2); - scene.add(planeRight); - - const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); - planeLeft.position.x = -50; - planeLeft.position.y = 50; - planeLeft.rotateY(Math.PI / 2); - scene.add(planeLeft); - - // lights - - const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); - mainLight.position.y = 60; - scene.add(mainLight); - - const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); - greenLight.position.set(550, 50, 0); - scene.add(greenLight); - - const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); - redLight.position.set(-550, 50, 0); - scene.add(redLight); - - const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); - blueLight.position.set(0, 50, 550); - scene.add(blueLight); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - cameraControls = new OrbitControls(camera, renderer.domElement); - cameraControls.target.set(0, 40, 0); - cameraControls.maxDistance = 400; - cameraControls.minDistance = 10; - cameraControls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const timer = Date.now() * 0.01; - - sphereGroup.rotation.y -= 0.002; - - smallSphere.position.set( - Math.cos(timer * 0.1) * 30, - Math.abs(Math.cos(timer * 0.2)) * 20 + 5, - Math.sin(timer * 0.1) * 30, - ); - smallSphere.rotation.y = Math.PI / 2 - timer * 0.1; - smallSphere.rotation.z = timer * 0.8; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_modifier_curve.ts b/examples-testing/examples/webgpu_modifier_curve.ts deleted file mode 100644 index c465ddc57..000000000 --- a/examples-testing/examples/webgpu_modifier_curve.ts +++ /dev/null @@ -1,154 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { TransformControls } from 'three/addons/controls/TransformControls.js'; - -import { Flow } from 'three/addons/modifiers/CurveModifierGPU.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -const ACTION_SELECT = 1, - ACTION_NONE = 0; -const curveHandles = []; -const mouse = new THREE.Vector2(); - -let scene, - camera, - renderer, - rayCaster, - control, - flow, - action = ACTION_NONE; - -init(); - -function init() { - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(2, 2, 4); - camera.lookAt(scene.position); - - const initialPoints = [ - { x: 1, y: 0, z: -1 }, - { x: 1, y: 0, z: 1 }, - { x: -1, y: 0, z: 1 }, - { x: -1, y: 0, z: -1 }, - ]; - - const boxGeometry = new THREE.BoxGeometry(0.1, 0.1, 0.1); - const boxMaterial = new THREE.MeshBasicNodeMaterial(); - - for (const handlePos of initialPoints) { - const handle = new THREE.Mesh(boxGeometry, boxMaterial); - handle.position.copy(handlePos); - curveHandles.push(handle); - scene.add(handle); - } - - const curve = new THREE.CatmullRomCurve3(curveHandles.map(handle => handle.position)); - curve.curveType = 'centripetal'; - curve.closed = true; - - const points = curve.getPoints(50); - const line = new THREE.Line( - new THREE.BufferGeometry().setFromPoints(points), - new THREE.LineBasicMaterial({ color: 0x00ff00 }), - ); - - scene.add(line); - - // - - const light = new THREE.DirectionalLight(0xffaa33, 3); - light.position.set(-10, 10, 10); - scene.add(light); - - const light2 = new THREE.AmbientLight(0x003973, 3); - scene.add(light2); - - // - - const loader = new FontLoader(); - loader.load('fonts/helvetiker_regular.typeface.json', function (font) { - const geometry = new TextGeometry('Hello three.js!', { - font: font, - size: 0.2, - depth: 0.05, - curveSegments: 12, - bevelEnabled: true, - bevelThickness: 0.02, - bevelSize: 0.01, - bevelOffset: 0, - bevelSegments: 5, - }); - - geometry.rotateX(Math.PI); - - const material = new THREE.MeshStandardNodeMaterial({ - color: 0x99ffff, - }); - - const objectToCurve = new THREE.Mesh(geometry, material); - - flow = new Flow(objectToCurve); - flow.updateCurve(0, curve); - scene.add(flow.object3D); - }); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderer.domElement.addEventListener('pointerdown', onPointerDown); - - rayCaster = new THREE.Raycaster(); - control = new TransformControls(camera, renderer.domElement); - control.addEventListener('dragging-changed', function (event) { - if (!event.value) { - const points = curve.getPoints(50); - line.geometry.setFromPoints(points); - flow.updateCurve(0, curve); - } - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerDown(event) { - action = ACTION_SELECT; - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; -} - -function animate() { - if (action === ACTION_SELECT) { - rayCaster.setFromCamera(mouse, camera); - action = ACTION_NONE; - const intersects = rayCaster.intersectObjects(curveHandles, false); - if (intersects.length) { - const target = intersects[0].object; - control.attach(target); - scene.add(control.getHelper()); - } - } - - if (flow) { - flow.moveAlongCurve(0.001); - } - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_morphtargets.ts b/examples-testing/examples/webgpu_morphtargets.ts deleted file mode 100644 index cde3ae83b..000000000 --- a/examples-testing/examples/webgpu_morphtargets.ts +++ /dev/null @@ -1,119 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let container, camera, scene, renderer, mesh; - -init(); - -function init() { - container = document.getElementById('container'); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x8fbcd4); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); - camera.position.z = 10; - scene.add(camera); - - scene.add(new THREE.AmbientLight(0x8fbcd4, 1.5)); - - const pointLight = new THREE.PointLight(0xffffff, 200); - camera.add(pointLight); - - const geometry = createGeometry(); - - const material = new THREE.MeshPhongMaterial({ - color: 0xff0000, - flatShading: true, - }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.inspector = new Inspector(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(function () { - renderer.render(scene, camera); - }); - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableZoom = false; - - window.addEventListener('resize', onWindowResize); - - initGUI(); -} - -function createGeometry() { - const geometry = new THREE.BoxGeometry(2, 2, 2, 32, 32, 32); - - // create an empty array to hold targets for the attribute we want to morph - // morphing positions and normals is supported - geometry.morphAttributes.position = []; - - // the original positions of the cube's vertices - const positionAttribute = geometry.attributes.position; - - // for the first morph target we'll move the cube's vertices onto the surface of a sphere - const spherePositions = []; - - // for the second morph target, we'll twist the cubes vertices - const twistPositions = []; - const direction = new THREE.Vector3(1, 0, 0); - const vertex = new THREE.Vector3(); - - for (let i = 0; i < positionAttribute.count; i++) { - const x = positionAttribute.getX(i); - const y = positionAttribute.getY(i); - const z = positionAttribute.getZ(i); - - spherePositions.push( - x * Math.sqrt(1 - (y * y) / 2 - (z * z) / 2 + (y * y * z * z) / 3), - y * Math.sqrt(1 - (z * z) / 2 - (x * x) / 2 + (z * z * x * x) / 3), - z * Math.sqrt(1 - (x * x) / 2 - (y * y) / 2 + (x * x * y * y) / 3), - ); - - // stretch along the x-axis so we can see the twist better - vertex.set(x * 2, y, z); - - vertex.applyAxisAngle(direction, (Math.PI * x) / 2).toArray(twistPositions, twistPositions.length); - } - - // add the spherical positions as the first morph target - geometry.morphAttributes.position[0] = new THREE.Float32BufferAttribute(spherePositions, 3); - - // add the twisted positions as the second morph target - geometry.morphAttributes.position[1] = new THREE.Float32BufferAttribute(twistPositions, 3); - - return geometry; -} - -function initGUI() { - // Set up dat.GUI to control targets - const params = { - Spherify: 0, - Twist: 0, - }; - - const gui = renderer.inspector.createParameters('Morph Targets'); - - gui.add(params, 'Spherify', 0, 1, 0.01).onChange(function (value) { - mesh.morphTargetInfluences[0] = value; - }); - gui.add(params, 'Twist', 0, 1, 0.01).onChange(function (value) { - mesh.morphTargetInfluences[1] = value; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} diff --git a/examples-testing/examples/webgpu_morphtargets_face.ts b/examples-testing/examples/webgpu_morphtargets_face.ts deleted file mode 100644 index 86bc871d9..000000000 --- a/examples-testing/examples/webgpu_morphtargets_face.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; -import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -init(); - -async function init() { - let mixer; - - const timer = new THREE.Timer(); - timer.connect(document); - - const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 20); - camera.position.set(-1.8, 0.8, 3); - - const scene = new THREE.Scene(); - - const renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.background = new THREE.Color(0x666666); - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - - const ktx2Loader = await new KTX2Loader().detectSupport(renderer); - - new GLTFLoader() - .setKTX2Loader(ktx2Loader) - .setMeshoptDecoder(MeshoptDecoder) - .load('models/gltf/facecap.glb', gltf => { - const mesh = gltf.scene.children[0]; - - scene.add(mesh); - - mixer = new THREE.AnimationMixer(mesh); - - mixer.clipAction(gltf.animations[0]).play(); - - // GUI - - const head = mesh.getObjectByName('mesh_2'); - const influences = head.morphTargetInfluences; - - const gui = renderer.inspector.createParameters('Morph Targets'); - - for (const [key, value] of Object.entries(head.morphTargetDictionary)) { - gui.add(influences, value, 0, 1, 0.01).name(key.replace('blendShape1.', '')).listen(); - } - }); - - scene.background = new THREE.Color(0x666666); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2.5; - controls.maxDistance = 5; - controls.minAzimuthAngle = -Math.PI / 2; - controls.maxAzimuthAngle = Math.PI / 2; - controls.maxPolarAngle = Math.PI / 1.8; - controls.target.set(0, 0.15, -0.2); - - function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) { - mixer.update(delta); - } - - renderer.render(scene, camera); - - controls.update(); - } - - window.addEventListener('resize', () => { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - }); -} diff --git a/examples-testing/examples/webgpu_mrt.ts b/examples-testing/examples/webgpu_mrt.ts deleted file mode 100644 index b3b42bec0..000000000 --- a/examples-testing/examples/webgpu_mrt.ts +++ /dev/null @@ -1,123 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - output, - normalView, - pass, - step, - diffuseColor, - emissive, - packNormalToRGB, - screenUV, - mix, - mrt, - Fn, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer; -let renderPipeline; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - // scene - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - // model - - const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); - loader.load('DamagedHelmet.gltf', function (gltf) { - scene.add(gltf.scene); - }); - }); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true, requiredLimits: { maxColorAttachments: 5 } }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // post processing - - const scenePass = pass(scene, camera, { minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }); - scenePass.setMRT( - mrt({ - output: output, - normal: packNormalToRGB(normalView), - diffuse: diffuseColor, - emissive: emissive, - }), - ); - - // optimize textures - - const normalTexture = scenePass.getTexture('normal'); - const diffuseTexture = scenePass.getTexture('diffuse'); - const emissiveTexture = scenePass.getTexture('emissive'); - - normalTexture.type = diffuseTexture.type = emissiveTexture.type = THREE.UnsignedByteType; - - // post processing - mrt - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = false; - renderPipeline.outputNode = Fn(() => { - const output = scenePass.getTextureNode('output'); // output name is optional here - const normal = scenePass.getTextureNode('normal'); - const diffuse = scenePass.getTextureNode('diffuse'); - const emissive = scenePass.getTextureNode('emissive'); - - const out = mix(output.renderOutput(), output, step(0.2, screenUV.x)); - const nor = mix(out, normal, step(0.4, screenUV.x)); - const emi = mix(nor, emissive, step(0.6, screenUV.x)); - const dif = mix(emi, diffuse, step(0.8, screenUV.x)); - - return dif; - })(); - - // controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.target.set(0, 0, -0.2); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_mrt_mask.ts b/examples-testing/examples/webgpu_mrt_mask.ts deleted file mode 100644 index 2bb80b84e..000000000 --- a/examples-testing/examples/webgpu_mrt_mask.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color, screenUV, mrt, output, pass, vec4 } from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; -let renderPipeline; -let spheres, - rotate = true; -let mixer, timer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.set(1, 2, 3); - - scene = new THREE.Scene(); - scene.backgroundNode = screenUV.y.mix(color(0x66bbff), color(0x4466ff)).mul(0.05); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - // lights - - const light = new THREE.SpotLight(0xffffff, 1); - light.power = 2000; - camera.add(light); - scene.add(camera); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Michelle.glb', function (gltf) { - const object = gltf.scene; - mixer = new THREE.AnimationMixer(object); - - const material = object.children[0].children[0].material; - - // add glow effect - material.mrtNode = mrt({ mask: output.add(1) }); - - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - scene.add(object); - }); - - // spheres - - const geometry = new THREE.SphereGeometry(0.3, 32, 16); - - spheres = new THREE.Group(); - scene.add(spheres); - - function addSphere(color, mrtNode = null) { - const distance = 1; - const id = spheres.children.length; - const rotation = THREE.MathUtils.degToRad(id * 90); - - const material = new THREE.MeshStandardNodeMaterial({ color }); - material.mrtNode = mrtNode; - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(Math.cos(rotation) * distance, 1, Math.sin(rotation) * distance); - - spheres.add(mesh); - } - - addSphere(0x0000ff, mrt({ mask: output })); - addSphere(0x00ff00); - addSphere(0xff0000); - addSphere(0x00ffff); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 0.4; - document.body.appendChild(renderer.domElement); - - // post processing - - const scenePass = pass(scene, camera); - scenePass.setMRT( - mrt({ - output: output.renderOutput(), - mask: vec4(0), // empty as default, custom materials can set this - }), - ); - - const colorPass = scenePass.getTextureNode(); - const maskPass = scenePass.getTextureNode('mask'); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = false; - renderPipeline.outputNode = colorPass.add(gaussianBlur(maskPass, 1, 20).mul(0.3)).renderOutput(); - - // controls - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1, 0); - controls.addEventListener('start', () => (rotate = false)); - controls.addEventListener('end', () => (rotate = true)); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - if (rotate) spheres.rotation.y += delta * 0.5; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_multiple_canvas.ts b/examples-testing/examples/webgpu_multiple_canvas.ts deleted file mode 100644 index db55fe165..000000000 --- a/examples-testing/examples/webgpu_multiple_canvas.ts +++ /dev/null @@ -1,111 +0,0 @@ -import * as THREE from 'three'; -import { color } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -// - -if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); -} - -// - -let renderer; - -const scenes = []; - -init(); - -function init() { - const geometries = [ - new THREE.BoxGeometry(1, 1, 1), - new THREE.SphereGeometry(0.5, 12, 8), - new THREE.DodecahedronGeometry(0.5), - new THREE.CylinderGeometry(0.5, 0.5, 1, 12), - ]; - - const content = document.getElementById('content'); - - for (let i = 0; i < 40; i++) { - const scene = new THREE.Scene(); - scene.backgroundNode = color(0xeeeeee); - - // make a list item - const element = document.createElement('div'); - element.className = 'list-item'; - - const sceneCanvas = document.createElement('canvas'); - element.appendChild(sceneCanvas); - - const descriptionElement = document.createElement('div'); - descriptionElement.innerText = 'Scene ' + (i + 1); - element.appendChild(descriptionElement); - - const canvasTarget = new THREE.CanvasTarget(sceneCanvas); - canvasTarget.setPixelRatio(window.devicePixelRatio); - canvasTarget.setSize(200, 200); - - // the element that represents the area we want to render the scene - scene.userData.canvasTarget = canvasTarget; - content.appendChild(element); - - const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); - camera.position.z = 2; - scene.userData.camera = camera; - - const controls = new OrbitControls(scene.userData.camera, scene.userData.canvasTarget.domElement); - controls.minDistance = 2; - controls.maxDistance = 5; - controls.enablePan = false; - controls.enableZoom = false; - scene.userData.controls = controls; - - // add one random mesh to each scene - const geometry = geometries[(geometries.length * Math.random()) | 0]; - - const material = new THREE.MeshStandardMaterial({ - color: new THREE.Color().setHSL(Math.random(), 1, 0.75, THREE.SRGBColorSpace), - roughness: 0.5, - metalness: 0, - flatShading: true, - }); - - scene.add(new THREE.Mesh(geometry, material)); - - scene.add(new THREE.HemisphereLight(0xaaaaaa, 0x444444, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 1.5); - light.position.set(1, 1, 1); - scene.add(light); - - scenes.push(scene); - } - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setClearColor(0xffffff, 1); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setAnimationLoop(animate); -} - -function animate() { - scenes.forEach(function (scene) { - // so something moves - //scene.children[ 0 ].rotation.y = Date.now() * 0.001; - - // get the canvas and camera for this scene - const { canvasTarget, camera } = scene.userData; - - //camera.aspect = width / height; // not changing in this example - //camera.updateProjectionMatrix(); - - //scene.userData.controls.update(); - - renderer.setCanvasTarget(canvasTarget); - renderer.render(scene, camera); - }); -} diff --git a/examples-testing/examples/webgpu_multiple_elements.ts b/examples-testing/examples/webgpu_multiple_elements.ts deleted file mode 100644 index 65bd3e75d..000000000 --- a/examples-testing/examples/webgpu_multiple_elements.ts +++ /dev/null @@ -1,142 +0,0 @@ -import * as THREE from 'three'; -import { color } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let canvas, renderer; - -const scenes = []; - -init(); - -function init() { - canvas = document.getElementById('c'); - - const geometries = [ - new THREE.BoxGeometry(1, 1, 1), - new THREE.SphereGeometry(0.5, 12, 8), - new THREE.DodecahedronGeometry(0.5), - new THREE.CylinderGeometry(0.5, 0.5, 1, 12), - ]; - - const content = document.getElementById('content'); - - for (let i = 0; i < 40; i++) { - const scene = new THREE.Scene(); - scene.backgroundNode = color(0xeeeeee); - - // make a list item - const element = document.createElement('div'); - element.className = 'list-item'; - - const sceneElement = document.createElement('div'); - element.appendChild(sceneElement); - - const descriptionElement = document.createElement('div'); - descriptionElement.innerText = 'Scene ' + (i + 1); - element.appendChild(descriptionElement); - - // the element that represents the area we want to render the scene - scene.userData.element = sceneElement; - content.appendChild(element); - - const camera = new THREE.PerspectiveCamera(50, 1, 1, 10); - camera.position.z = 2; - scene.userData.camera = camera; - - const controls = new OrbitControls(scene.userData.camera, scene.userData.element); - controls.minDistance = 2; - controls.maxDistance = 5; - controls.enablePan = false; - controls.enableZoom = false; - scene.userData.controls = controls; - - // add one random mesh to each scene - const geometry = geometries[(geometries.length * Math.random()) | 0]; - - const material = new THREE.MeshStandardMaterial({ - color: new THREE.Color().setHSL(Math.random(), 1, 0.75, THREE.SRGBColorSpace), - roughness: 0.5, - metalness: 0, - flatShading: true, - }); - - scene.add(new THREE.Mesh(geometry, material)); - - scene.add(new THREE.HemisphereLight(0xaaaaaa, 0x444444, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 1.5); - light.position.set(1, 1, 1); - scene.add(light); - - scenes.push(scene); - } - - renderer = new THREE.WebGPURenderer({ canvas: canvas, antialias: true }); - renderer.setClearColor(0xffffff, 1); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setAnimationLoop(animate); -} - -function updateSize() { - const width = canvas.clientWidth; - const height = canvas.clientHeight; - - if (canvas.width !== width || canvas.height !== height) { - renderer.setSize(width, height, false); - } -} - -function animate() { - updateSize(); - - canvas.style.transform = `translateY(${window.scrollY}px)`; - - renderer.setClearColor(0xffffff); - renderer.setScissorTest(false); - renderer.setViewport(0, 0, canvas.width, canvas.height); - renderer.clear(); - - //renderer.setClearColor( 0xe0e0e0 ); - renderer.setScissorTest(true); - - scenes.forEach(function (scene) { - // so something moves - scene.children[0].rotation.y = Date.now() * 0.001; - - // get the element that is a place holder for where we want to - // draw the scene - const element = scene.userData.element; - - // get its position relative to the page's viewport - const rect = element.getBoundingClientRect(); - - // check if it's offscreen. If so skip it - if ( - rect.bottom < 0 || - rect.top > renderer.domElement.clientHeight || - rect.right < 0 || - rect.left > renderer.domElement.clientWidth - ) { - return; // it's off screen - } - - // set the viewport - const width = rect.right - rect.left; - const height = rect.bottom - rect.top; - const left = rect.left; - const top = rect.top; - - renderer.setViewport(left, top, width, height); - renderer.setScissor(left, top, width, height); - - const camera = scene.userData.camera; - - //camera.aspect = width / height; // not changing in this example - //camera.updateProjectionMatrix(); - - //scene.userData.controls.update(); - - renderer.render(scene, camera); - }); -} diff --git a/examples-testing/examples/webgpu_multiple_rendertargets.ts b/examples-testing/examples/webgpu_multiple_rendertargets.ts deleted file mode 100644 index 2085d3c63..000000000 --- a/examples-testing/examples/webgpu_multiple_rendertargets.ts +++ /dev/null @@ -1,97 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mix, vec2, step, texture, uv, screenUV, normalWorld, output, mrt } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, torus; -let renderPipeline, renderTarget; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - // Create a multi render target with Float buffers - - renderTarget = new THREE.RenderTarget( - window.innerWidth * window.devicePixelRatio, - window.innerHeight * window.devicePixelRatio, - { count: 2, minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }, - ); - - // Name our G-Buffer attachments for debugging - - renderTarget.textures[0].name = 'output'; - renderTarget.textures[1].name = 'normal'; - - // Scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222222); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.z = 4; - - const loader = new THREE.TextureLoader(); - - const diffuse = loader.load('textures/hardwood2_diffuse.jpg'); - diffuse.colorSpace = THREE.SRGBColorSpace; - diffuse.wrapS = THREE.RepeatWrapping; - diffuse.wrapT = THREE.RepeatWrapping; - - const torusMaterial = new THREE.NodeMaterial(); - torusMaterial.colorNode = texture(diffuse, uv().mul(vec2(10, 4))); - - torus = new THREE.Mesh(new THREE.TorusKnotGeometry(1, 0.3, 128, 32), torusMaterial); - scene.add(torus); - - // MRT - - renderer.setMRT( - mrt({ - output: output, - normal: normalWorld, - }), - ); - - // Post Processing - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = mix( - texture(renderTarget.textures[0]), - texture(renderTarget.textures[1]), - step(0.5, screenUV.x), - ); - - // Controls - - new OrbitControls(camera, renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - const dpr = renderer.getPixelRatio(); - renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); -} - -function render(time) { - torus.rotation.y = (time / 1000) * 0.4; - - // render scene into target - renderer.setRenderTarget(renderTarget); - renderer.render(scene, camera); - - // render post FX - renderer.setRenderTarget(null); - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts b/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts deleted file mode 100644 index 2232ab182..000000000 --- a/examples-testing/examples/webgpu_multiple_rendertargets_readback.ts +++ /dev/null @@ -1,161 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mix, step, texture, screenUV, mrt, output, normalWorld, uv, vec2 } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, torus; -let quadMesh, sceneMRT, renderTarget, readbackTarget, material, readbackMaterial, pixelBuffer, pixelBufferTexture; - -const options = { - selection: 'mrt', -}; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - // - - renderer.inspector = new Inspector(); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(options, 'selection', ['mrt', 'diffuse', 'normal']); - - // Create a multi render target with Float buffers - - renderTarget = new THREE.RenderTarget( - window.innerWidth * window.devicePixelRatio, - window.innerHeight * window.devicePixelRatio, - { count: 2, minFilter: THREE.NearestFilter, magFilter: THREE.NearestFilter }, - ); - - // Name our G-Buffer attachments for debugging - - renderTarget.textures[0].name = 'output'; - renderTarget.textures[1].name = 'normal'; - - // Init readback render target, readback data texture, readback material - // Be careful with the size! 512 is already big. Reading data back from the GPU is computationally intensive - - const size = 512; - - readbackTarget = new THREE.RenderTarget(size, size, { count: 2 }); - - pixelBuffer = new Uint8Array(size ** 2 * 4).fill(0); - pixelBufferTexture = new THREE.DataTexture(pixelBuffer, size, size); - pixelBufferTexture.type = THREE.UnsignedByteType; - pixelBufferTexture.format = THREE.RGBAFormat; - - readbackMaterial = new THREE.MeshBasicNodeMaterial(); - readbackMaterial.colorNode = texture(pixelBufferTexture); - - // MRT - - sceneMRT = mrt({ - output: output, - normal: normalWorld, - }); - - // Scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222222); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.z = 4; - - const loader = new THREE.TextureLoader(); - - const diffuse = loader.load('textures/hardwood2_diffuse.jpg'); - diffuse.colorSpace = THREE.SRGBColorSpace; - diffuse.wrapS = THREE.RepeatWrapping; - diffuse.wrapT = THREE.RepeatWrapping; - - const torusMaterial = new THREE.NodeMaterial(); - torusMaterial.colorNode = texture(diffuse, uv().mul(vec2(10, 4))); - - torus = new THREE.Mesh(new THREE.TorusKnotGeometry(1, 0.3, 128, 32), torusMaterial); - scene.add(torus); - - // Output - - material = new THREE.NodeMaterial(); - material.colorNode = mix( - texture(renderTarget.textures[0]), - texture(renderTarget.textures[1]), - step(0.5, screenUV.x), - ); - - quadMesh = new THREE.QuadMesh(material); - - // Controls - - new OrbitControls(camera, renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - - const dpr = renderer.getPixelRatio(); - renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); -} - -async function render(time) { - const selection = options.selection; - - torus.rotation.y = (time / 1000) * 0.4; - - const isReadback = selection !== 'mrt'; - - // render scene into target - renderer.setMRT(sceneMRT); - renderer.setRenderTarget(isReadback ? readbackTarget : renderTarget); - renderer.render(scene, camera); - - // render post FX - renderer.setMRT(null); - renderer.setRenderTarget(null); - - if (isReadback) { - quadMesh.material = readbackMaterial; - - await readback(); - } else { - quadMesh.material = material; - } - - quadMesh.render(renderer); -} - -async function readback() { - const width = readbackTarget.width; - const height = readbackTarget.height; - - const selection = options.selection; - - if (selection === 'diffuse') { - pixelBuffer = await renderer.readRenderTargetPixelsAsync(readbackTarget, 0, 0, width, height, 0); // zero is optional - - pixelBufferTexture.image.data = pixelBuffer; - pixelBufferTexture.needsUpdate = true; - } else if (selection === 'normal') { - pixelBuffer = await renderer.readRenderTargetPixelsAsync(readbackTarget, 0, 0, width, height, 1); - - pixelBufferTexture.image.data = pixelBuffer; - pixelBufferTexture.needsUpdate = true; - } -} diff --git a/examples-testing/examples/webgpu_multisampled_renderbuffers.ts b/examples-testing/examples/webgpu_multisampled_renderbuffers.ts deleted file mode 100644 index a00e37d77..000000000 --- a/examples-testing/examples/webgpu_multisampled_renderbuffers.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -const mouse = new THREE.Vector2(); - -let quadMesh, renderTarget; - -let box, box2; - -const dpr = 1; - -const params = { - animated: true, - multisampling: true, -}; - -const mat4 = new THREE.Matrix4(); - -const count = 50; -const fullRadius = 20; // Radius of the sphere -const halfRadius = 10; // Radius of the sphere -const positions = new Array(count).fill().map((_, i) => { - const radius = i % 2 === 0 ? fullRadius : halfRadius; - - const phi = Math.acos(2 * Math.random() - 1) - Math.PI / 2; // phi: latitude, range -π/2 to π/2 - const theta = 2 * Math.PI * Math.random(); // theta: longitude, range 0 to 2π - - return new THREE.Vector3( - radius * Math.cos(phi) * Math.cos(theta), // x - radius * Math.sin(phi), // y - radius * Math.cos(phi) * Math.sin(theta), // z - ); -}); - -init(); -initGUI(); - -function initGUI() { - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'multisampling'); - gui.add(params, 'animated'); -} - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.z = 3; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x111111); - - // textured mesh - - const geometryBox = new THREE.BoxGeometry(7, 7, 7, 12, 12, 12); - const materialBox = new THREE.MeshBasicNodeMaterial(); - const materialBoxInner = new THREE.MeshBasicNodeMaterial({ color: 0xff0000 }); - - materialBox.wireframe = true; - - // - - box = new THREE.InstancedMesh(geometryBox, materialBox, count); - box2 = new THREE.InstancedMesh(geometryBox, materialBoxInner, count); - - for (let i = 0; i < count; i++) { - box.setMatrixAt(i, mat4.identity().setPosition(positions[i])); - box2.setMatrixAt(i, mat4.multiplyScalar(0.996).setPosition(positions[i])); - } - - scene.add(box, box2); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.inspector = new Inspector(); - renderer.setPixelRatio(dpr); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderTarget = new THREE.RenderTarget(window.innerWidth * dpr, window.innerHeight * dpr, { - samples: params.multisampling ? 4 : 1, - depthBuffer: true, - }); - - window.addEventListener('mousemove', onWindowMouseMove); - window.addEventListener('resize', onWindowResize); - - // FX - - // modulate the final color based on the mouse position - - const materialFX = new THREE.MeshBasicNodeMaterial(); - materialFX.colorNode = texture(renderTarget.texture).rgb; - - quadMesh = new THREE.QuadMesh(materialFX); -} - -function onWindowMouseMove(e) { - mouse.x = e.offsetX / window.innerWidth; - mouse.y = e.offsetY / window.innerHeight; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); -} - -function animate() { - if (params.animated) { - box.rotation.x += 0.001; - box.rotation.y += 0.002; - box2.rotation.x += 0.001; - box2.rotation.y += 0.002; - } - - renderTarget.samples = params.multisampling ? 4 : 1; - - renderer.setRenderTarget(renderTarget); - renderer.render(scene, camera); - - renderer.setRenderTarget(null); - quadMesh.render(renderer); -} diff --git a/examples-testing/examples/webgpu_occlusion.ts b/examples-testing/examples/webgpu_occlusion.ts deleted file mode 100644 index 376dc987d..000000000 --- a/examples-testing/examples/webgpu_occlusion.ts +++ /dev/null @@ -1,97 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { uniform } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, controls; - -class OcclusionNode extends THREE.Node { - constructor(testObject, normalColor, occludedColor) { - super('vec3'); - - this.updateType = THREE.NodeUpdateType.OBJECT; - - this.uniformNode = uniform(new THREE.Color()); - - this.testObject = testObject; - this.normalColor = normalColor; - this.occludedColor = occludedColor; - } - - async update(frame) { - const isOccluded = frame.renderer.isOccluded(this.testObject); - - this.uniformNode.value.copy(isOccluded ? this.occludedColor : this.normalColor); - } - - setup(/* builder */) { - return this.uniformNode; - } -} - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.z = 7; - - scene = new THREE.Scene(); - - // lights - - const ambientLight = new THREE.AmbientLight(0xb0b0b0); - - const light = new THREE.DirectionalLight(0xffffff, 1.0); - light.position.set(0.32, 0.39, 0.7); - - scene.add(ambientLight); - scene.add(light); - - // models - - const planeGeometry = new THREE.PlaneGeometry(2, 2); - const sphereGeometry = new THREE.SphereGeometry(0.5); - - const plane = new THREE.Mesh( - planeGeometry, - new THREE.MeshPhongNodeMaterial({ color: 0x00ff00, side: THREE.DoubleSide }), - ); - const sphere = new THREE.Mesh(sphereGeometry, new THREE.MeshPhongNodeMaterial({ color: 0xffff00 })); - - const instanceUniform = new OcclusionNode(sphere, new THREE.Color(0x0000ff), new THREE.Color(0x00ff00)); - - plane.material.colorNode = instanceUniform; - - sphere.position.z = -1; - sphere.occlusionTest = true; - - scene.add(plane); - scene.add(sphere); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 3; - controls.maxDistance = 25; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_ocean.ts b/examples-testing/examples/webgpu_ocean.ts deleted file mode 100644 index a7939461e..000000000 --- a/examples-testing/examples/webgpu_ocean.ts +++ /dev/null @@ -1,181 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { WaterMesh } from 'three/addons/objects/WaterMesh.js'; -import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; - -let container; -let camera, scene, renderer, renderPipeline; -let controls, water, sun, sky, mesh, bloomPass; - -init(); - -function init() { - container = document.getElementById('container'); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.1; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(55, window.innerWidth / window.innerHeight, 1, 20000); - camera.position.set(30, 30, 100); - - // Post-processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode('output'); - - bloomPass = bloom(scenePassColor); - bloomPass.threshold.value = 0; - bloomPass.strength.value = 0.1; - bloomPass.radius.value = 0; - - renderPipeline.outputNode = scenePassColor.add(bloomPass); - - // - - sun = new THREE.Vector3(); - - // Water - - const waterGeometry = new THREE.PlaneGeometry(10000, 10000); - const loader = new THREE.TextureLoader(); - const waterNormals = loader.load('textures/waternormals.jpg'); - waterNormals.wrapS = waterNormals.wrapT = THREE.RepeatWrapping; - - water = new WaterMesh(waterGeometry, { - waterNormals: waterNormals, - sunDirection: new THREE.Vector3(), - sunColor: 0xffffff, - waterColor: 0x001e0f, - distortionScale: 3.7, - }); - - water.rotation.x = -Math.PI / 2; - - scene.add(water); - - // Skybox - - sky = new SkyMesh(); - sky.scale.setScalar(10000); - scene.add(sky); - - sky.turbidity.value = 10; - sky.rayleigh.value = 2; - sky.mieCoefficient.value = 0.005; - sky.mieDirectionalG.value = 0.8; - sky.cloudCoverage.value = 0.4; - sky.cloudDensity.value = 0.5; - sky.cloudElevation.value = 0.5; - - const parameters = { - elevation: 2, - azimuth: 180, - exposure: 0.1, - }; - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - const sceneEnv = new THREE.Scene(); - - let renderTarget; - - function updateSun() { - const phi = THREE.MathUtils.degToRad(90 - parameters.elevation); - const theta = THREE.MathUtils.degToRad(parameters.azimuth); - - sun.setFromSphericalCoords(1, phi, theta); - - sky.sunPosition.value.copy(sun); - water.sunDirection.value.copy(sun).normalize(); - - if (renderTarget !== undefined) renderTarget.dispose(); - - sceneEnv.add(sky); - renderTarget = pmremGenerator.fromScene(sceneEnv); - scene.add(sky); - - scene.environment = renderTarget.texture; - } - - renderer.init().then(updateSun); - - // - - const geometry = new THREE.BoxGeometry(30, 30, 30); - const material = new THREE.MeshStandardMaterial({ roughness: 0 }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI * 0.495; - controls.target.set(0, 10, 0); - controls.minDistance = 40.0; - controls.maxDistance = 200.0; - controls.update(); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - - const folderSky = gui.addFolder('Sky'); - folderSky.add(parameters, 'elevation', 0, 90, 0.1).onChange(updateSun); - folderSky.add(parameters, 'azimuth', -180, 180, 0.1).onChange(updateSun); - folderSky.add(parameters, 'exposure', 0, 1, 0.0001).onChange(function (value) { - renderer.toneMappingExposure = value; - }); - - const folderWater = gui.addFolder('Water'); - folderWater.add(water.distortionScale, 'value', 0, 8, 0.1).name('distortionScale'); - folderWater.add(water.size, 'value', 0.1, 10, 0.1).name('size'); - - const folderBloom = gui.addFolder('Bloom'); - folderBloom.add(bloomPass.strength, 'value', 0, 3, 0.01).name('strength'); - folderBloom.add(bloomPass.radius, 'value', 0, 1, 0.01).name('radius'); - - const folderClouds = gui.addFolder('Clouds'); - folderClouds.add(sky.cloudCoverage, 'value', 0, 1, 0.01).name('coverage'); - folderClouds.add(sky.cloudDensity, 'value', 0, 1, 0.01).name('density'); - folderClouds.add(sky.cloudElevation, 'value', 0, 1, 0.01).name('elevation'); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - const time = performance.now() * 0.001; - - mesh.position.y = Math.sin(time) * 20 + 5; - mesh.rotation.x = time * 0.5; - mesh.rotation.z = time * 0.51; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_oit.ts b/examples-testing/examples/webgpu_oit.ts deleted file mode 100644 index 3818d8a00..000000000 --- a/examples-testing/examples/webgpu_oit.ts +++ /dev/null @@ -1,148 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; -import { oitPass } from 'three/addons/tsl/display/OITPassNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let renderPipeline, scenePassOIT, scenePass; -let spheres, controls; - -const transparentMaterials = []; - -const params = { - oit: true, - opacity: 0.5, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(8, 4, 10); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x202020); - - // lights - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x444444, 1.5); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 2.5); - dirLight.position.set(4, 10, 6); - scene.add(dirLight); - - // opaque center object - - const torusKnot = new THREE.Mesh( - new THREE.TorusKnotGeometry(1, 0.4, 128, 32), - new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.2 }), - ); - scene.add(torusKnot); - - // intersecting transparent planes. no draw order can resolve them correctly - // with sorting-based transparency - - const planeGeometry = new THREE.PlaneGeometry(6, 6); - const planeColors = [0xff4030, 0x30d060, 0x3070ff]; - - for (let i = 0; i < planeColors.length; i++) { - const material = new THREE.MeshStandardMaterial({ - color: planeColors[i], - roughness: 0.5, - transparent: true, - opacity: params.opacity, - side: THREE.DoubleSide, - }); - transparentMaterials.push(material); - - const plane = new THREE.Mesh(planeGeometry, material); - plane.rotation.y = (i / planeColors.length) * Math.PI; - scene.add(plane); - } - - // orbiting transparent spheres. their sort order flips while they rotate - // which results in popping with sorting-based transparency - - spheres = new THREE.Group(); - - const sphereGeometry = new THREE.SphereGeometry(0.8, 32, 16); - const sphereColors = [0xffc020, 0xd040d0, 0x40c0d0, 0xa0d040]; - - for (let i = 0; i < sphereColors.length; i++) { - const material = new THREE.MeshStandardMaterial({ - color: sphereColors[i], - roughness: 0.3, - transparent: true, - opacity: params.opacity, - }); - transparentMaterials.push(material); - - const sphere = new THREE.Mesh(sphereGeometry, material); - - const angle = (i / sphereColors.length) * Math.PI * 2; - sphere.position.set(Math.cos(angle) * 2.5, 0, Math.sin(angle) * 2.5); - - spheres.add(sphere); - } - - scene.add(spheres); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - scenePassOIT = oitPass(scene, camera); - scenePass = pass(scene, camera); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = scenePassOIT; - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.enableDamping = true; - controls.minDistance = 5; - controls.maxDistance = 25; - - // - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(params, 'oit').onChange(value => { - renderPipeline.outputNode = value === true ? scenePassOIT : scenePass; - renderPipeline.needsUpdate = true; - }); - - gui.add(params, 'opacity', 0, 1).onChange(value => { - for (const material of transparentMaterials) { - material.opacity = value; - } - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_parallax_uv.ts b/examples-testing/examples/webgpu_parallax_uv.ts deleted file mode 100644 index b6282d89f..000000000 --- a/examples-testing/examples/webgpu_parallax_uv.ts +++ /dev/null @@ -1,135 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture, parallaxUV, blendOverlay, uv, normalMap, uniform } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -let controls; - -init(); - -async function init() { - // scene - - scene = new THREE.Scene(); - - // camera - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(15, 7, 15); - - // environment - - const environmentTexture = await new HDRLoader().loadAsync('./textures/equirectangular/752-hdri-skies-com_1k.hdr'); - - environmentTexture.mapping = THREE.EquirectangularReflectionMapping; - - scene.environment = environmentTexture; - scene.background = environmentTexture; - scene.backgroundBlurriness = 0.4; - - // textures - - const loader = new THREE.TextureLoader(); - - const topTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_Color.jpg'); - topTexture.colorSpace = THREE.SRGBColorSpace; - topTexture.wrapS = THREE.RepeatWrapping; - topTexture.wrapT = THREE.RepeatWrapping; - - const roughnessTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_Roughness.jpg'); - roughnessTexture.colorSpace = THREE.NoColorSpace; - roughnessTexture.wrapS = THREE.RepeatWrapping; - roughnessTexture.wrapT = THREE.RepeatWrapping; - - const normalTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_NormalGL.jpg'); - normalTexture.colorSpace = THREE.NoColorSpace; - normalTexture.wrapS = THREE.RepeatWrapping; - normalTexture.wrapT = THREE.RepeatWrapping; - - const displaceTexture = await loader.loadAsync('textures/ambientcg/Ice002_1K-JPG_Displacement.jpg'); - displaceTexture.colorSpace = THREE.NoColorSpace; - displaceTexture.wrapS = THREE.RepeatWrapping; - displaceTexture.wrapT = THREE.RepeatWrapping; - - // - - const bottomTexture = await loader.loadAsync('textures/ambientcg/Ice003_1K-JPG_Color.jpg'); - bottomTexture.colorSpace = THREE.SRGBColorSpace; - bottomTexture.wrapS = THREE.RepeatWrapping; - bottomTexture.wrapT = THREE.RepeatWrapping; - - // parallax effect - - const scaleUV = uniform(3); - const scaledUV = uv().mul(scaleUV); - - const parallaxScale = uniform(0.5); // parallax scale - const offsetUV = texture(displaceTexture, scaledUV).mul(parallaxScale); - - const parallaxUVOffset = parallaxUV(scaledUV, offsetUV); - const parallaxResult = texture(bottomTexture, parallaxUVOffset); - - const iceNode = blendOverlay(texture(topTexture, scaledUV), parallaxResult); - - // material - - const material = new THREE.MeshStandardNodeMaterial(); - material.colorNode = iceNode.mul(5); // increase the color intensity to 5 ( contrast ) - material.roughnessNode = texture(roughnessTexture, scaledUV); - material.normalNode = normalMap(texture(normalTexture, scaledUV)); - material.metalness = 0; - - const geometry = new THREE.CircleGeometry(25, 64); - - const ground = new THREE.Mesh(geometry, material); - ground.rotateX(-Math.PI / 2); - scene.add(ground); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ReinhardToneMapping; - renderer.toneMappingExposure = 6; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // gui - - const gui = renderer.inspector.createParameters('Scene'); - gui.add(scene, 'backgroundBlurriness', 0, 1).name('Background Blurriness'); - gui.add(parallaxScale, 'value', 0.2, 0.5).name('Parallax Scale'); - gui.add(scaleUV, 'value', 1, 5).name('UV Scale'); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0, 0); - controls.maxDistance = 40; - controls.minDistance = 10; - controls.autoRotate = true; - controls.autoRotateSpeed = -1; - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_particles.ts b/examples-testing/examples/webgpu_particles.ts deleted file mode 100644 index 9e81f0761..000000000 --- a/examples-testing/examples/webgpu_particles.ts +++ /dev/null @@ -1,151 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { range, texture, mix, uv, color, rotateUV, positionLocal, time, uniform } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let camera, scene, renderer; -let controls; - -init(); - -function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - const { innerWidth, innerHeight } = window; - - camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 1, 5000); - camera.position.set(1300, 500, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x333333); - - // textures - - const textureLoader = new THREE.TextureLoader(); - const map = textureLoader.load('textures/opengameart/smoke1.png'); - - // create nodes - - const lifeRange = range(0.1, 1); - const offsetRange = range(new THREE.Vector3(-2, 3, -2), new THREE.Vector3(2, 5, 2)); - - const speed = uniform(0.2); - const scaledTime = time.add(5).mul(speed); - - const lifeTime = scaledTime.mul(lifeRange).mod(1); - const scaleRange = range(0.3, 2); - const rotateRange = range(0.1, 4); - - const life = lifeTime.div(lifeRange); - - const fakeLightEffect = positionLocal.y.oneMinus().max(0.2); - - const textureNode = texture(map, rotateUV(uv(), scaledTime.mul(rotateRange))); - - const opacityNode = textureNode.a.mul(life.oneMinus()); - - const smokeColor = mix(color(0x2c1501), color(0x222222), positionLocal.y.mul(3).clamp()); - - // create particles - - const smokeNodeMaterial = new THREE.SpriteNodeMaterial(); - smokeNodeMaterial.colorNode = mix(color(0xf27d0c), smokeColor, life.mul(2.5).min(1)).mul(fakeLightEffect); - smokeNodeMaterial.opacityNode = opacityNode; - smokeNodeMaterial.positionNode = offsetRange.mul(lifeTime); - smokeNodeMaterial.scaleNode = scaleRange.mul(lifeTime.max(0.3)); - smokeNodeMaterial.depthWrite = false; - - const smokeInstancedSprite = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), smokeNodeMaterial); - smokeInstancedSprite.scale.setScalar(400); - smokeInstancedSprite.count = 2000; - scene.add(smokeInstancedSprite); - - // - - const fireGeometry = new THREE.PlaneGeometry(1, 1); - const fireCount = 1000; - - const fireNodeMaterial = new THREE.SpriteNodeMaterial(); - fireNodeMaterial.colorNode = mix(color(0xb72f17), color(0xb72f17), life); - fireNodeMaterial.positionNode = range(new THREE.Vector3(-1, 1, -1), new THREE.Vector3(1, 2, 1)).mul(lifeTime); - fireNodeMaterial.scaleNode = smokeNodeMaterial.scaleNode; - fireNodeMaterial.opacityNode = opacityNode.mul(0.5); - fireNodeMaterial.blending = THREE.AdditiveBlending; - fireNodeMaterial.transparent = true; - fireNodeMaterial.depthWrite = false; - - const fireInstancedSprite = new THREE.Mesh(fireGeometry, fireNodeMaterial); - fireInstancedSprite.scale.setScalar(400); - fireInstancedSprite.count = fireCount; - fireInstancedSprite.position.y = -100; - fireInstancedSprite.renderOrder = 1; - scene.add(fireInstancedSprite); - - // indirect draw ( optional ) - // each indirect draw call is 5 uint32 values for indexes ( different structure for non-indexed draw calls using 4 uint32 values ) - - const indexCount = fireGeometry.index.array.length; - - const uint32 = new Uint32Array(5); - uint32[0] = indexCount; // indexCount - uint32[1] = fireCount; // instanceCount - uint32[2] = 0; // firstIndex - uint32[3] = 0; // baseVertex - uint32[4] = 0; // firstInstance - - const indirectAttribute = new THREE.IndirectStorageBufferAttribute(uint32, 5); - fireGeometry.setIndirect(indirectAttribute); - - // - - const helper = new THREE.GridHelper(3000, 40, 0x444444, 0x444444); - helper.position.y = -75; - scene.add(helper); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxDistance = 2700; - controls.target.set(0, 500, 0); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(speed, 'value', 0, 1, 0.01).name('speed'); -} - -function onWindowResize() { - const { innerWidth, innerHeight } = window; - - camera.aspect = innerWidth / innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(innerWidth, innerHeight); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_particles_soft.ts b/examples-testing/examples/webgpu_particles_soft.ts deleted file mode 100644 index 5aada557b..000000000 --- a/examples-testing/examples/webgpu_particles_soft.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { float, range, texture, mix, uv, color, rotateUV, positionLocal, time, uniform } from 'three/tsl'; -import { softParticles } from 'three/addons/tsl/utils/SoftParticles.js'; - -import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(6, 8, 8); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - scene.fog = new THREE.FogExp2(0x000000, 0.025); - - // lights - - scene.add(new THREE.AmbientLight(0xffffff, 0.25)); - - const spotLight = new THREE.SpotLight(0xffffff, 800); - spotLight.position.set(10, 15, 8); - spotLight.target.position.set(0, 4, 0); - spotLight.angle = 0.5; - spotLight.penumbra = 0.7; - spotLight.distance = 0; - - scene.add(spotLight); - - // - - const loader = new PLYLoader(); - loader.load('./models/ply/binary/Lucy100k.ply', function (geometry) { - geometry.computeVertexNormals(); - - const material = new THREE.MeshStandardMaterial(); - const mesh = new THREE.Mesh(geometry, material); - - mesh.position.y = 4; - mesh.rotation.y = Math.PI; - mesh.scale.multiplyScalar(0.005); - - scene.add(mesh); - }); - - const groundMaterial = new THREE.MeshStandardNodeMaterial({ color: 0x444444, roughness: 1 }); - const ground = new THREE.Mesh(new THREE.PlaneGeometry(100, 100), groundMaterial); - ground.rotation.x = -Math.PI / 2; - scene.add(ground); - - // smoke texture - - const textureLoader = new THREE.TextureLoader(); - const map = textureLoader.load('textures/opengameart/smoke1.png'); - map.colorSpace = THREE.SRGBColorSpace; - - // simple smoke particle system - - const lifeRange = range(0.1, 1); - const offsetRange = range(new THREE.Vector3(-2, 0, -2), new THREE.Vector3(2, 7, 2)); - - const speed = float(0.2); - const scaledTime = time.add(20).mul(speed); - - const lifeTime = scaledTime.mul(lifeRange).mod(1); - const scaleRange = range(6, 8); - const rotateRange = range(0.1, 2); - - const life = lifeTime.div(lifeRange); - - const textureNode = texture(map, rotateUV(uv(), scaledTime.mul(rotateRange))); - - const fade = life.smoothstep(0, 0.3).mul(life.smoothstep(1, 0.7)); - - // soft particles - - const softEnabled = uniform(1); // 0 = hard particles, 1 = soft particles - const softDistance = uniform(1); // world-space fade distance - const softContrast = uniform(2); - - const baseOpacity = textureNode.a.mul(fade); - - const smokeOpacity = mix( - baseOpacity, - softParticles({ - opacity: baseOpacity, - distance: softDistance, - contrast: softContrast, - }), - softEnabled, - ); - - const smokeColor = mix(color(0x6f6f6f), color(0x303030), positionLocal.y.mul(0.1).clamp()); - - // instanced sprites - - const smokeMaterial = new THREE.SpriteNodeMaterial(); - smokeMaterial.colorNode = smokeColor; - smokeMaterial.opacityNode = smokeOpacity; - smokeMaterial.positionNode = offsetRange.mul(lifeTime); - smokeMaterial.scaleNode = scaleRange.mul(lifeTime.max(0.3)); - smokeMaterial.depthWrite = false; - - const smoke = new THREE.Sprite(smokeMaterial); - smoke.count = 50; - smoke.frustumCulled = false; - scene.add(smoke); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 6; - controls.maxDistance = 20; - controls.target.set(0, 4, 0); - controls.enableDamping = true; - controls.update(); - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(softEnabled, 'value', { hard: 0, soft: 1 }).name('mode'); - gui.add(softDistance, 'value', 0.1, 2, 0.01).name('soft distance'); - gui.add(softContrast, 'value', 1, 6, 0.01).name('soft contrast'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_performance.ts b/examples-testing/examples/webgpu_performance.ts deleted file mode 100644 index 595965a6c..000000000 --- a/examples-testing/examples/webgpu_performance.ts +++ /dev/null @@ -1,101 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -let camera, scene, renderer; -let model; - -const options = { static: true }; - -init(); - -function setStatic(object, value) { - object.traverse(child => { - if (child.isMesh) { - child.static = value; - } - }); -} - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(60, 60, 60); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - // - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.environment = texture; - - // model - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const loader = new GLTFLoader().setPath('models/gltf/'); - loader.setDRACOLoader(dracoLoader); - - loader.load('dungeon_warkarma.glb', async function (gltf) { - model = gltf.scene; - - // wait until the model can be added to the scene without blocking due to shader compilation - - await renderer.compileAsync(model, camera, scene); - - scene.add(model); - - // - - setStatic(model, options.static); - }); - }); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 60; - controls.target.set(0, 0, -0.2); - controls.update(); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(options, 'static').onChange(() => { - setStatic(model, options.static); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_performance_renderbundle.ts b/examples-testing/examples/webgpu_performance_renderbundle.ts deleted file mode 100644 index 303b02e3f..000000000 --- a/examples-testing/examples/webgpu_performance_renderbundle.ts +++ /dev/null @@ -1,229 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; -let controls; -let gui; -let geometries, group, instancedMesh; - -// - -const position = new THREE.Vector3(); -const rotation = new THREE.Euler(); -const quaternion = new THREE.Quaternion(); -const scale = new THREE.Vector3(); - -const instanceMatrix = new THREE.Matrix4(); -const rotationMatrix = new THREE.Matrix4(); - -// - -const api = { - webgpu: true, - renderBundle: true, - count: 4000, - opacity: 1, - dynamic: false, -}; - -init(); - -// - -function randomizeMatrix(matrix) { - position.x = Math.random() * 80 - 40; - position.y = Math.random() * 80 - 40; - position.z = Math.random() * 80 - 40; - - rotation.x = Math.random() * 2 * Math.PI; - rotation.y = Math.random() * 2 * Math.PI; - rotation.z = Math.random() * 2 * Math.PI; - - quaternion.setFromEuler(rotation); - - scale.x = scale.y = scale.z = 0.35 + Math.random() * 0.5; - - return matrix.compose(position, quaternion, scale); -} - -function randomizeRotationSpeed(rotation) { - rotation.x = Math.random() * 0.05; - rotation.y = Math.random() * 0.05; - rotation.z = Math.random() * 0.05; - return rotation; -} - -function initGeometries() { - geometries = [ - new THREE.ConeGeometry(1.0, 2.0, 3, 1), - new THREE.BoxGeometry(2.0, 2.0, 2.0), - new THREE.PlaneGeometry(2.0, 2, 1, 1), - new THREE.CapsuleGeometry(), - new THREE.CircleGeometry(1.0, 3), - new THREE.CylinderGeometry(1.0, 1.0, 2.0, 3, 1), - new THREE.DodecahedronGeometry(1.0, 0), - new THREE.IcosahedronGeometry(1.0, 0), - new THREE.OctahedronGeometry(1.0, 0), - new THREE.PolyhedronGeometry([0, 0, 0], [0, 0, 0], 1, 0), - new THREE.RingGeometry(1.0, 1.5, 3), - new THREE.SphereGeometry(1.0, 3, 2), - new THREE.TetrahedronGeometry(1.0, 0), - new THREE.TorusGeometry(1.0, 0.5, 3, 3), - new THREE.TorusKnotGeometry(1.0, 0.5, 20, 3, 1, 1), - ]; -} - -function initMesh(count) { - group = api.renderBundle ? new THREE.BundleGroup() : new THREE.Group(); - - for (let i = 0; i < count; i++) { - const material = new THREE.MeshToonNodeMaterial({ - color: new THREE.Color(Math.random() * 0xffffff), - side: THREE.DoubleSide, - }); - - const child = new THREE.Mesh(geometries[i % geometries.length], material); - randomizeMatrix(child.matrix); - child.matrix.decompose(child.position, child.quaternion, child.scale); - child.userData.rotationSpeed = randomizeRotationSpeed(new THREE.Euler()); - child.frustumCulled = false; - group.add(child); - } - - // instanced meshes are supported inside a bundle group, too - - instancedMesh = new THREE.InstancedMesh(geometries[0], new THREE.MeshToonNodeMaterial(), 10); - instancedMesh.userData.rotationSpeeds = []; - - const matrix = new THREE.Matrix4(); - - for (let i = 0; i < instancedMesh.count; i++) { - randomizeMatrix(matrix); - instancedMesh.setMatrixAt(i, matrix); - - instancedMesh.userData.rotationSpeeds.push(randomizeRotationSpeed(new THREE.Euler())); - } - - group.add(instancedMesh); - - // - - scene.add(group); -} - -function init() { - const searchParams = new URLSearchParams(window.location.search); - api.webgpu = searchParams.get('backend') !== 'webgl'; - api.renderBundle = searchParams.get('renderBundle') !== 'false'; - api.count = parseFloat(searchParams.get('count') || 4000); - - const count = api.count; - - // camera - - const aspect = window.innerWidth / window.innerHeight; - - camera = new THREE.PerspectiveCamera(70, aspect, 1, 100); - camera.position.z = 50; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL: !api.webgpu }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(animate); - - // scene - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xc1c1c1); - - const light = new THREE.DirectionalLight(0xffffff, 3.4); - scene.add(light); - - document.body.appendChild(renderer.domElement); - - initGeometries(); - initMesh(count); - - controls = new OrbitControls(camera, renderer.domElement); - controls.autoRotate = true; - controls.autoRotateSpeed = 1.0; - - // gui - - gui = renderer.inspector.createParameters('Settings'); - gui.add(api, 'renderBundle').name('render bundle').onChange(reload); - - gui.add(api, 'webgpu').onChange(reload); - - gui.add(api, 'dynamic').onChange(() => { - group.static = !group.static; - }); - - // listeners - - window.addEventListener('resize', onWindowResize); - - function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); - group.needsUpdate = true; - } - - function reload() { - const backendParam = 'backend=' + (api.webgpu ? 'webgpu' : 'webgl'); - const renderBundleParam = '&renderBundle=' + (api.renderBundle ? 'true' : 'false'); - const countParam = '&count=' + api.count; - - location.href = location.pathname + '?' + backendParam + renderBundleParam + countParam; // relative redirect with parameters - } - - function animate() { - animateMeshes(); - - controls.update(); - - renderer.render(scene, camera); - } - - function animateMeshes() { - if (api.dynamic === false) return; - - // rotate the regular meshes - - for (let i = 0; i < api.count; i++) { - const child = group.children[i]; - const rotationSpeed = child.userData.rotationSpeed; - - child.rotation.set( - child.rotation.x + rotationSpeed.x, - child.rotation.y + rotationSpeed.y, - child.rotation.z + rotationSpeed.z, - ); - } - - // rotate each instance of the instanced mesh individually - - const rotationSpeeds = instancedMesh.userData.rotationSpeeds; - - for (let i = 0; i < instancedMesh.count; i++) { - rotationMatrix.makeRotationFromEuler(rotationSpeeds[i]); - - instancedMesh.getMatrixAt(i, instanceMatrix); - instanceMatrix.multiply(rotationMatrix); - instancedMesh.setMatrixAt(i, instanceMatrix); - } - - instancedMesh.instanceMatrix.needsUpdate = true; - } -} diff --git a/examples-testing/examples/webgpu_pmrem_cubemap.ts b/examples-testing/examples/webgpu_pmrem_cubemap.ts deleted file mode 100644 index bd751ba33..000000000 --- a/examples-testing/examples/webgpu_pmrem_cubemap.ts +++ /dev/null @@ -1,75 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { normalWorldGeometry, uniform, pmremTexture } from 'three/tsl'; - -import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(0, 0, 8); - - scene = new THREE.Scene(); - - const forceWebGL = false; - - renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - await renderer.init(); - - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.update(); - - new HDRCubeTextureLoader() - .setPath('./textures/cube/pisaHDR/') - .load(['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'], function (map) { - scene.backgroundNode = pmremTexture(map, normalWorldGeometry, uniform(0.5)); - - const geometry = new THREE.SphereGeometry(0.4, 64, 64); - - for (let i = 0; i < 6; i++) { - for (let j = 0; j < 5; j++) { - const material = new THREE.MeshPhysicalNodeMaterial({ - roughness: i / 5, - metalness: j / 4, - envMap: map, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = i - 2.5; - mesh.position.y = j - 2; - scene.add(mesh); - } - } - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_pmrem_equirectangular.ts b/examples-testing/examples/webgpu_pmrem_equirectangular.ts deleted file mode 100644 index 76f8326d3..000000000 --- a/examples-testing/examples/webgpu_pmrem_equirectangular.ts +++ /dev/null @@ -1,75 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { normalWorldGeometry, uniform, pmremTexture } from 'three/tsl'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(0, 0, 8); - - scene = new THREE.Scene(); - - const forceWebGL = false; - - renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - - await renderer.init(); - - container.appendChild(renderer.domElement); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.update(); - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (map) { - map.mapping = THREE.EquirectangularReflectionMapping; - - scene.backgroundNode = pmremTexture(map, normalWorldGeometry, uniform(0.5)); - - const geometry = new THREE.SphereGeometry(0.4, 64, 64); - - for (let i = 0; i < 6; i++) { - for (let j = 0; j < 5; j++) { - const material = new THREE.MeshPhysicalNodeMaterial({ - roughness: i / 5, - metalness: j / 4, - envMap: map, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = i - 2.5; - mesh.position.y = j - 2; - scene.add(mesh); - } - } - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_pmrem_scene.ts b/examples-testing/examples/webgpu_pmrem_scene.ts deleted file mode 100644 index deab005fc..000000000 --- a/examples-testing/examples/webgpu_pmrem_scene.ts +++ /dev/null @@ -1,106 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { normalWorld, uniform, pmremTexture } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - const forceWebGL = false; - - renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - await renderer.init(); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.addEventListener('change', render); // use if there is no animation loop - controls.minDistance = 2; - controls.maxDistance = 10; - controls.update(); - - // - const loader = new THREE.CubeTextureLoader().setPath('./textures/cube/Park3Med/'); - - scene.background = await loader.loadAsync(['px.jpg', 'nx.jpg', 'py.jpg', 'ny.jpg', 'pz.jpg', 'nz.jpg']); - - let model; - - model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0x0000ff })); - model.position.z -= 1; - scene.add(model); - - model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0xff0000 })); - model.position.z += 1; - scene.add(model); - - model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0xff00ff })); - model.position.x += 1; - scene.add(model); - - model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0x00ffff })); - model.position.x -= 1; - scene.add(model); - - model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0xffff00 })); - model.position.y -= 1; - scene.add(model); - - model = new THREE.Mesh(new THREE.SphereGeometry(0.2, 64, 64), new THREE.MeshBasicMaterial({ color: 0x00ff00 })); - model.position.y += 1; - scene.add(model); - - //while ( scene.children.length > 0 ) scene.remove( scene.children[ 0 ] ); - - const sceneRT = new THREE.PMREMGenerator(renderer).fromScene(scene); - - // - - const pmremRoughness = uniform(0.5); - const pmremNode = pmremTexture(sceneRT.texture, normalWorld, pmremRoughness); - - scene.add( - new THREE.Mesh( - new THREE.SphereGeometry(0.5, 64, 64), - new THREE.MeshBasicNodeMaterial({ colorNode: pmremNode }), - ), - ); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(pmremRoughness, 'value', 0, 1, 0.001) - .name('roughness') - .onChange(() => render()); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_pmrem_test.ts b/examples-testing/examples/webgpu_pmrem_test.ts deleted file mode 100644 index 3e1ea3ef9..000000000 --- a/examples-testing/examples/webgpu_pmrem_test.ts +++ /dev/null @@ -1,138 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let scene, camera, controls, renderer; - -async function init() { - const width = window.innerWidth; - const height = window.innerHeight; - const aspect = width / height; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(render); - renderer.inspector = new Inspector(); - - // tonemapping - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - await renderer.init(); - - // scene - - scene = new THREE.Scene(); - - // camera - - camera = new THREE.PerspectiveCamera(40, aspect, 1, 30); - updateCamera(); - camera.position.set(0, 0, 16); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 4; - controls.maxDistance = 20; - - // light - - const directionalLight = new THREE.DirectionalLight(0xffffff, 0); // set intensity to 0 to start - const x = 597; - const y = 213; - const theta = ((x + 0.5) * Math.PI) / 512; - const phi = ((y + 0.5) * Math.PI) / 512; - - directionalLight.position.setFromSphericalCoords(100, -phi, Math.PI / 2 - theta); - - scene.add(directionalLight); - // scene.add( new THREE.DirectionalLightHelper( directionalLight ) ); - - // The spot1Lux HDR environment map is expressed in nits (lux / sr). The directional light has units of lux, - // so to match a 1 lux light, we set a single pixel with a value equal to 1 divided by the solid - // angle of the pixel in steradians. This image is 1024 x 512, - // so the value is 1 / ( sin( phi ) * ( pi / 512 ) ^ 2 ) = 27,490 nits. - - const gui = renderer.inspector.createParameters('Settings'); - gui.add({ enabled: true }, 'enabled') - .name('PMREM') - .onChange(value => { - directionalLight.intensity = value ? 0 : 1; - - scene.traverse(function (child) { - if (child.isMesh) { - child.material.envMapIntensity = 1 - directionalLight.intensity; - } - }); - }); -} - -function createObjects() { - let radianceMap = null; - new HDRLoader() - // .setDataType( THREE.FloatType ) - .setPath('textures/equirectangular/') - .load('spot1Lux.hdr', function (texture) { - radianceMap = pmremGenerator.fromEquirectangular(texture).texture; - pmremGenerator.dispose(); - - scene.background = radianceMap; - - const geometry = new THREE.SphereGeometry(0.4, 32, 32); - - for (let x = 0; x <= 10; x++) { - for (let y = 0; y <= 2; y++) { - const material = new THREE.MeshPhysicalMaterial({ - roughness: x / 10, - metalness: y < 1 ? 1 : 0, - color: y < 2 ? 0xffffff : 0x000000, - envMap: radianceMap, - envMapIntensity: 1, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = x - 5; - mesh.position.y = 1 - y; - scene.add(mesh); - } - } - }); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - pmremGenerator.compileEquirectangularShader(); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - updateCamera(); - - renderer.setSize(width, height); -} - -function updateCamera() { - const horizontalFoV = 40; - const verticalFoV = - (2 * Math.atan(Math.tan(((horizontalFoV / 2) * Math.PI) / 180) / camera.aspect) * 180) / Math.PI; - camera.fov = verticalFoV; - camera.updateProjectionMatrix(); -} - -function render() { - renderer.render(scene, camera); -} - -Promise.resolve().then(init).then(createObjects); diff --git a/examples-testing/examples/webgpu_portal.ts b/examples-testing/examples/webgpu_portal.ts deleted file mode 100644 index df2e400f3..000000000 --- a/examples-testing/examples/webgpu_portal.ts +++ /dev/null @@ -1,156 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - pass, - color, - mx_worley_noise_float, - time, - screenUV, - vec2, - uv, - normalWorld, - mx_fractal_noise_vec3, -} from 'three/tsl'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, sceneMain, scenePortal, renderer; -let timer; - -const mixers = []; - -init(); - -function init() { - // - - sceneMain = new THREE.Scene(); - sceneMain.background = new THREE.Color(0x222222); - sceneMain.backgroundNode = normalWorld.y.mix(color(0x0066ff), color(0xff0066)); - - scenePortal = new THREE.Scene(); - scenePortal.backgroundNode = mx_worley_noise_float(normalWorld.mul(20).add(vec2(0, time.oneMinus()))).mul( - color(0x0066ff), - ); - scenePortal.name = 'Portal Scene'; - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 30); - camera.position.set(2.5, 1, 3); - camera.position.multiplyScalar(0.8); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - // lights - - const light = new THREE.PointLight(0xffffff, 1); - light.position.set(0, 1, 5); - light.power = 17000; - - sceneMain.add(new THREE.HemisphereLight(0xff0066, 0x0066ff, 7)); - sceneMain.add(light); - scenePortal.add(light.clone()); - - // models - - const loader = new GLTFLoader(); - loader.load('models/gltf/Xbot.glb', function (gltf) { - const createModel = (colorNode = null) => { - let object; - - if (mixers.length === 0) { - object = gltf.scene; - } else { - object = gltf.scene.clone(); - - const children = object.children[0].children; - - const applyFX = index => { - children[index].material = children[index].material.clone(); - children[index].material.colorNode = colorNode; - children[index].material.wireframe = true; - }; - - applyFX(0); - applyFX(1); - } - - const mixer = new THREE.AnimationMixer(object); - - const action = mixer.clipAction(gltf.animations[6]); - action.play(); - - mixers.push(mixer); - - return object; - }; - - const colorNode = mx_fractal_noise_vec3(uv().mul(20).add(time)); - - const modelMain = createModel(); - const modelPortal = createModel(colorNode); - - // model portal - - sceneMain.add(modelMain); - scenePortal.add(modelPortal); - }); - - // portal - - const geometry = new THREE.PlaneGeometry(1.7, 2); - - const material = new THREE.MeshBasicNodeMaterial(); - material.colorNode = pass(scenePortal, camera).context({ getUV: () => screenUV }); - material.opacityNode = uv().distance(0.5).remapClamp(0.3, 0.5).oneMinus(); - material.side = THREE.DoubleSide; - material.transparent = true; - - const plane = new THREE.Mesh(geometry, material); - plane.position.set(0, 1, 0.8); - sceneMain.add(plane); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.LinearToneMapping; - renderer.toneMappingExposure = 0.15; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 1, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - for (const mixer of mixers) { - mixer.update(delta); - } - - renderer.render(sceneMain, camera); -} diff --git a/examples-testing/examples/webgpu_postprocessing.ts b/examples-testing/examples/webgpu_postprocessing.ts deleted file mode 100644 index 150ffa0cc..000000000 --- a/examples-testing/examples/webgpu_postprocessing.ts +++ /dev/null @@ -1,82 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; -import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js'; -import { rgbShift } from 'three/addons/tsl/display/RGBShiftNode.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, renderer, renderPipeline; -let object; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 400; - - const scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - scene.fog = new THREE.Fog(0x000000, 1, 1000); - - object = new THREE.Object3D(); - scene.add(object); - - const geometry = new THREE.SphereGeometry(1, 4, 4); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff, flatShading: true }); - - for (let i = 0; i < 100; i++) { - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); - mesh.position.multiplyScalar(Math.random() * 400); - mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); - mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 50; - object.add(mesh); - } - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1); - scene.add(light); - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode().toInspector('Scene Color'); - - const dotScreenPass = dotScreen(scenePassColor); - dotScreenPass.scale.value = 0.3; - - const rgbShiftPass = rgbShift(dotScreenPass); - rgbShiftPass.amount.value = 0.001; - - renderPipeline.outputNode = rgbShiftPass; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - object.rotation.x += 0.005; - object.rotation.y += 0.01; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_3dlut.ts b/examples-testing/examples/webgpu_postprocessing_3dlut.ts deleted file mode 100644 index defe54915..000000000 --- a/examples-testing/examples/webgpu_postprocessing_3dlut.ts +++ /dev/null @@ -1,229 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - mix, - mul, - oneMinus, - positionLocal, - smoothstep, - texture, - time, - rotateUV, - Fn, - uv, - vec2, - vec3, - vec4, - pass, - texture3D, - uniform, - renderOutput, -} from 'three/tsl'; -import { lut3D } from 'three/addons/tsl/display/Lut3DNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js'; -import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js'; -import { LUTImageLoader } from 'three/addons/loaders/LUTImageLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const params = { - lut: 'Bourbon 64.CUBE', - intensity: 1, -}; - -const lutMap = { - 'Bourbon 64.CUBE': null, - 'Chemical 168.CUBE': null, - 'Clayton 33.CUBE': null, - 'Cubicle 99.CUBE': null, - 'Remy 24.CUBE': null, - 'Presetpro-Cinematic.3dl': null, - NeutralLUT: null, - 'B&WLUT': null, - NightLUT: null, -}; - -let camera, scene, renderer, renderPipeline, controls, lutPass; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(8, 10, 12); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - // Loaders - - const gltfLoader = new GLTFLoader(); - const textureLoader = new THREE.TextureLoader(); - - // LUTs - - const lutCubeLoader = new LUTCubeLoader(); - const lutImageLoader = new LUTImageLoader(); - const lut3dlLoader = new LUT3dlLoader(); - - for (const name in lutMap) { - if (/\.CUBE$/i.test(name)) { - lutMap[name] = lutCubeLoader.loadAsync('luts/' + name); - } else if (/\LUT$/i.test(name)) { - lutMap[name] = lutImageLoader.loadAsync(`luts/${name}.png`); - } else { - lutMap[name] = lut3dlLoader.loadAsync('luts/' + name); - } - } - - const pendings = Object.values(lutMap); - await Promise.all(pendings); - - for (const name in lutMap) { - lutMap[name] = await lutMap[name]; - } - - // baked model - - gltfLoader.load('./models/gltf/coffeeMug.glb', gltf => { - gltf.scene.getObjectByName('baked').material.map.anisotropy = 8; - scene.add(gltf.scene); - }); - - // geometry - - const smokeGeometry = new THREE.PlaneGeometry(1, 1, 16, 64); - smokeGeometry.translate(0, 0.5, 0); - smokeGeometry.scale(1.5, 6, 1.5); - - // texture - - const noiseTexture = textureLoader.load('./textures/noises/perlin/128x128.png'); - noiseTexture.wrapS = THREE.RepeatWrapping; - noiseTexture.wrapT = THREE.RepeatWrapping; - - // material - - const smokeMaterial = new THREE.MeshBasicNodeMaterial({ - transparent: true, - side: THREE.DoubleSide, - depthWrite: false, - }); - - // position - - smokeMaterial.positionNode = Fn(() => { - // twist - - const twistNoiseUv = vec2(0.5, uv().y.mul(0.2).sub(time.mul(0.005)).mod(1)); - const twist = texture(noiseTexture, twistNoiseUv).r.mul(10); - positionLocal.xz.assign(rotateUV(positionLocal.xz, twist, vec2(0))); - - // wind - - const windOffset = vec2( - texture(noiseTexture, vec2(0.25, time.mul(0.01)).mod(1)).r.sub(0.5), - texture(noiseTexture, vec2(0.75, time.mul(0.01)).mod(1)).r.sub(0.5), - ).mul(uv().y.pow(2).mul(10)); - positionLocal.addAssign(windOffset); - - return positionLocal; - })(); - - // color - - smokeMaterial.colorNode = Fn(() => { - // alpha - - const alphaNoiseUv = uv() - .mul(vec2(0.5, 0.3)) - .add(vec2(0, time.mul(0.03).negate())); - const alpha = mul( - // pattern - texture(noiseTexture, alphaNoiseUv).r.smoothstep(0.4, 1), - - // edges fade - smoothstep(0, 0.1, uv().x), - smoothstep(0, 0.1, oneMinus(uv().x)), - smoothstep(0, 0.1, uv().y), - smoothstep(0, 0.1, oneMinus(uv().y)), - ); - - // color - - const finalColor = mix(vec3(0.6, 0.3, 0.2), vec3(1, 1, 1), alpha.pow(3)); - - return vec4(finalColor, alpha); - })(); - - // mesh - - const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial); - smoke.position.y = 1.83; - scene.add(smoke); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // ignore default output color transform ( toneMapping and outputColorSpace ) - // use renderOutput() for control the sequence - - renderPipeline.outputColorTransform = false; - - // scene pass - - const scenePass = pass(scene, camera); - const outputPass = renderOutput(scenePass); - - const lut = lutMap[params.lut]; - lutPass = lut3D(outputPass, texture3D(lut.texture3D), lut.texture3D.image.width, uniform(1)); - - renderPipeline.outputNode = lutPass; - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - controls.target.y = 3; - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'lut', Object.keys(lutMap)); - gui.add(params, 'intensity', 0, 1); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - controls.update(); - - lutPass.intensityNode.value = params.intensity; - - if (lutMap[params.lut]) { - const lut = lutMap[params.lut]; - lutPass.lutNode.value = lut.texture3D; - lutPass.size.value = lut.texture3D.image.width; - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_afterimage.ts b/examples-testing/examples/webgpu_postprocessing_afterimage.ts deleted file mode 100644 index 0d21da69a..000000000 --- a/examples-testing/examples/webgpu_postprocessing_afterimage.ts +++ /dev/null @@ -1,152 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - instancedBufferAttribute, - uniform, - mod, - pass, - texture, - float, - time, - vec2, - vec3, - vec4, - sin, - cos, -} from 'three/tsl'; -import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, particles; -let renderPipeline, afterImagePass, scenePass; - -const params = { - damp: uniform(0.8, 'float').setName('damp'), - enabled: true, -}; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 1000; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - const sprite = new THREE.TextureLoader().load('textures/sprites/circle.png'); - - // geometry - - const radius = 600; - const count = 50000; - - const vertex = new THREE.Vector3(); - const color = new THREE.Color(); - - const colors = []; - const vertices = []; - const timeOffsets = []; - - for (var i = 0; i < count; i++) { - getRandomPointOnSphere(radius, vertex); - vertices.push(vertex.x, vertex.y, vertex.z); - - color.setHSL(i / count, 0.7, 0.7, THREE.SRGBColorSpace); - colors.push(color.r, color.g, color.b); - - timeOffsets.push(i / count); - } - - const positionAttribute = new THREE.InstancedBufferAttribute(new Float32Array(vertices), 3); - const colorAttribute = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); - const timeAttribute = new THREE.InstancedBufferAttribute(new Float32Array(timeOffsets), 1); - - // material and TSL - - const material = new THREE.SpriteNodeMaterial({ blending: THREE.AdditiveBlending, depthWrite: false }); - - const localTime = instancedBufferAttribute(timeAttribute).add(time.mul(0.1)); - const modTime = mod(localTime, 1.0); - const accTime = modTime.mul(modTime); - - const angle = accTime.mul(40.0); - const pulse = vec2(sin(angle).mul(20.0), cos(angle).mul(20.0)); - const pos = instancedBufferAttribute(positionAttribute); - - const animated = vec3( - pos.x.mul(accTime).add(pulse.x), - pos.y.mul(accTime).add(pulse.y), - pos.z.mul(accTime).mul(1.75), - ); - const fAlpha = modTime.oneMinus().mul(2.0); - - material.colorNode = texture(sprite).mul(vec4(instancedBufferAttribute(colorAttribute), fAlpha)); - material.positionNode = animated; - material.scaleNode = float(2); - - particles = new THREE.Sprite(material); - particles.count = count; - scene.add(particles); - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - - scenePass = pass(scene, camera); - - afterImagePass = afterImage(scenePass, params.damp); - - renderPipeline.outputNode = afterImagePass; - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(afterImagePass.damp, 'value', 0.25, 1); - gui.add(params, 'enabled').onChange(updatePassChain); - - window.addEventListener('resize', onWindowResize); -} - -function updatePassChain() { - if (params.enabled === true) { - renderPipeline.outputNode = afterImagePass; - } else { - renderPipeline.outputNode = scenePass; - } - - renderPipeline.needsUpdate = true; -} - -function getRandomPointOnSphere(r, v) { - const angle = Math.random() * Math.PI * 2; - const u = Math.random() * 2 - 1; - - v.set( - Math.cos(angle) * Math.sqrt(1 - Math.pow(u, 2)) * r, - Math.sin(angle) * Math.sqrt(1 - Math.pow(u, 2)) * r, - u * r, - ); - - return v; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(time) { - particles.rotation.z = time * 0.001; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_anamorphic.ts b/examples-testing/examples/webgpu_postprocessing_anamorphic.ts deleted file mode 100644 index 20118247a..000000000 --- a/examples-testing/examples/webgpu_postprocessing_anamorphic.ts +++ /dev/null @@ -1,166 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - pass, - screenUV, - uniform, - uv, - vec2, - vec3, - color, - Fn, - vec4, - Loop, - float, - mix, - luminance, - smoothstep, - rtt, - time, - viewportSize, - instanceIndex, - positionLocal, -} from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, instancedMesh, controls; -let renderPipeline; - -const _dummy = new THREE.Object3D(); - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 250); - camera.position.set(0, 0, 20); - - scene = new THREE.Scene(); - scene.backgroundNode = Fn(() => { - const dist = screenUV.distance(0.5).mul(2.0); - return mix(color(0x111111), color(0x000000), dist); - })(); - - const timeScale = uniform(0.5); - - const material = new THREE.MeshBasicNodeMaterial({ - color: 0xffffff, - // Animate the spheres up and down continuously using TSL and their instanceIndex as a phase offset - positionNode: positionLocal.add( - vec3(0, time.add(float(instanceIndex).mul(0.5)).mul(timeScale).sin().mul(5.0), 0), - ), - }); - - const maxCount = 200; - - instancedMesh = new THREE.InstancedMesh(new THREE.SphereGeometry(0.1, 32, 32), material, maxCount); - - const _color = new THREE.Color(); - - for (let i = 0; i < maxCount; i++) { - _dummy.position.x = (Math.random() - 0.5) * 20; - _dummy.position.y = (Math.random() - 0.5) * 20; - _dummy.position.z = (Math.random() - 0.5) * 20; - _dummy.updateMatrix(); - instancedMesh.setMatrixAt(i, _dummy.matrix); - - _color.setHex(Math.random() * 0xffffff); - instancedMesh.setColorAt(i, _color); - } - - scene.add(instancedMesh); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1; - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 25; - - // post-processing - - const scenePass = pass(scene, camera); - - const intensity = uniform(5.0); - const tintColor = uniform(new THREE.Color(0x7a8aff)); - const threshold = uniform(0.3); - const radius = uniform(0.0); - const samples = uniform(80); - - const bloomPass = bloom(scenePass.getTextureNode().toInspector('Color'), intensity, radius, threshold); - bloomPass.setResolutionScale(0.25); - - // Custom high pass for anamorphic bloom - bloomPass.highPassFn = Fn(({ input, threshold, smoothWidth }) => { - // Extract bright areas to a texture (computed once, sampled many times) - const v = luminance(input.rgb); - const alpha = smoothstep(threshold, threshold.add(smoothWidth), v); - const brightPass = rtt(mix(vec4(0), input, alpha), null, null, { - wrapS: THREE.MirroredRepeatWrapping, - wrapT: THREE.MirroredRepeatWrapping, - }); - - // Horizontal blur - const total = vec4(0); - const halfSamples = samples.div(2); - - const invSize = vec2(1.0).div(viewportSize); - - Loop({ start: halfSamples.negate(), end: halfSamples }, ({ i }) => { - let softness = float(i).abs().div(halfSamples).oneMinus(); - softness = softness.pow(2.0); - - const shiftedUV = vec2(uv().x.add(invSize.x.mul(i).mul(4.0)), uv().y); - total.addAssign(brightPass.sample(shiftedUV).mul(softness)); - }); - - return total.div(samples.div(3.0)); - }); - - const anamorphicPass = bloomPass.mul(tintColor).toInspector('Anamorphic'); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = scenePass.add(anamorphicPass); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(intensity, 'value', 0, 10).name('intensity'); - gui.add(threshold, 'value', 0, 0.9).name('threshold'); - gui.add(samples, 'value', 2, 128, 1).name('samples'); - gui.addColor(tintColor, 'value').name('tint color'); - gui.add(radius, 'value', 0, 1, 0.01).name('bloom radius'); - gui.add(timeScale, 'value', 0, 1).name('time scale'); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_ao.ts b/examples-testing/examples/webgpu_postprocessing_ao.ts deleted file mode 100644 index ab0a271a1..000000000 --- a/examples-testing/examples/webgpu_postprocessing_ao.ts +++ /dev/null @@ -1,582 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - sample, - pass, - mrt, - screenUV, - normalView, - velocity, - vec3, - vec4, - packNormalToRGB, - unpackRGBToNormal, - colorSpaceToWorking, - builtinAOContext, -} from 'three/tsl'; -import { ao } from 'three/addons/tsl/display/GTAONode.js'; -import { ssao } from 'three/addons/tsl/display/SSAONode.js'; -import { traa } from 'three/addons/tsl/display/TRAANode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline, controls; - -let aoPass, traaPass, transparentMesh; - -const params = { - aoType: 'GTAO', - samples: 16, - radius: 0.4, - resolutionScale: 0.5, - scale: 0.8, // GTAO - thickness: 1, // GTAO - temporalFiltering: true, // GTAO - intensity: 2, // SSAO - bias: 0.025, // SSAO - blurEnabled: true, // SSAO - blurSharpness: 2, // SSAO - aoOnly: false, - transparentOpacity: 0.3, -}; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.set(1, 3, 7); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGPURenderer(); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2; - controls.maxDistance = 16; - controls.target.set(0, 1.2, 0); - - // environment - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.background = new THREE.Color(0x666666); - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - scene.environmentIntensity = 0.3; - environment.dispose(); - pmremGenerator.dispose(); - - // post-processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // pre-pass - - const prePass = pass(scene, camera).toInspector('Normal', inspectNode => - colorSpaceToWorking(inspectNode, THREE.SRGBColorSpace), - ); - prePass.name = 'Pre-Pass'; - prePass.transparent = false; - - prePass.setMRT( - mrt({ - output: packNormalToRGB(normalView), - velocity: velocity, - }), - ); - - const prePassNormal = sample(uv => { - return unpackRGBToNormal(prePass.getTextureNode().sample(uv)); - }); - - const prePassDepth = prePass.getTextureNode('depth').toInspector('Depth', () => prePass.getLinearDepthNode()); - const prePassVelocity = prePass.getTextureNode('velocity').toInspector('Velocity'); - - // pre-pass - bandwidth optimization - - const normalTexture = prePass.getTexture('output'); - normalTexture.type = THREE.UnsignedByteType; - - // scene pass - - const scenePass = pass(scene, camera).toInspector('Color'); - - // traa ( resolves the temporal noise of GTAO ) - - traaPass = traa(scenePass, prePassDepth, prePassVelocity, camera); - traaPass.useSubpixelCorrection = false; - - // ao: the AO node feeds the scene's ambient term via `builtinAOContext`, and - // can be switched between GTAO ( ground-truth, needs temporal denoise ) and the - // cheaper SSAO ( self-denoised ) - - function updateOutput() { - // SSAO is self-denoised so it can skip TRAA and use MSAA for edge anti-aliasing instead - - const useTRAA = params.aoType === 'GTAO'; - - scenePass.options.samples = useTRAA ? 0 : 4; - - renderPipeline.outputNode = params.aoOnly - ? vec4(vec3(aoPass.getTextureNode().sample(screenUV).r), 1) - : useTRAA - ? traaPass - : scenePass; - renderer.toneMapping = params.aoOnly ? THREE.NoToneMapping : THREE.NeutralToneMapping; - renderPipeline.needsUpdate = true; - } - - function createAO() { - if (aoPass) aoPass.dispose(); - - aoPass = - params.aoType === 'SSAO' - ? ssao(prePassDepth, prePassNormal, camera).toInspector('SSAO', inspectNode => inspectNode.r) - : ao(prePassDepth, prePassNormal, camera).toInspector('GTAO', inspectNode => inspectNode.r); - - updateParameters(); - - scenePass.contextNode = builtinAOContext(aoPass.getTextureNode().sample(screenUV).r); - scenePass.needsUpdate = true; - - updateOutput(); - } - - createAO(); - - // models - - const dracoLoader = new DRACOLoader(); - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - loader.setPath('models/gltf/'); - - // wall-mounted spotlights - - function addSpotLight(position, targetPosition) { - const light = new THREE.SpotLight(0xffe09e, 40); - light.position.copy(position); - light.angle = 0.6; - light.penumbra = 1; - light.distance = 6.5; - light.decay = 2; - light.target.position.copy(targetPosition); - scene.add(light); - scene.add(light.target); - } - - addSpotLight(new THREE.Vector3(-2.5, 5, -4.8), new THREE.Vector3(-2.5, -2, -4.8)); - addSpotLight(new THREE.Vector3(2.5, 5, -4.8), new THREE.Vector3(2.5, -2, -4.8)); - addSpotLight(new THREE.Vector3(-5.3, 5, 0), new THREE.Vector3(-5.3, -2, 0)); - - // checkerboard floor - - const tilesX = 16; - const tilesZ = 16; - const floorCanvas = document.createElement('canvas'); - floorCanvas.width = tilesX * 32; - floorCanvas.height = tilesZ * 32; - const floorCtx = floorCanvas.getContext('2d'); - - for (let x = 0; x < tilesX; x++) { - for (let z = 0; z < tilesZ; z++) { - floorCtx.fillStyle = (x + z) % 2 === 0 ? '#d8d0c8' : '#b8b0a8'; - floorCtx.fillRect(x * 32, z * 32, 32, 32); - } - } - - const floorTexture = new THREE.CanvasTexture(floorCanvas); - floorTexture.colorSpace = THREE.SRGBColorSpace; - floorTexture.wrapS = THREE.RepeatWrapping; - floorTexture.wrapT = THREE.RepeatWrapping; - - const floorMat = new THREE.MeshStandardMaterial({ map: floorTexture, roughness: 0.7, metalness: 0.05 }); - const floor = new THREE.Mesh(new THREE.PlaneGeometry(tilesX, tilesZ), floorMat); - floor.rotation.x = -Math.PI / 2; - floor.position.y = -2; - scene.add(floor); - - // walls - - const wallMat = new THREE.MeshStandardMaterial({ color: '#e0d8d0', roughness: 0.9, metalness: 0 }); - - const backWall = new THREE.Mesh(new THREE.PlaneGeometry(16, 10), wallMat); - backWall.position.set(0, 3, -5); - scene.add(backWall); - - const leftWall = new THREE.Mesh(new THREE.PlaneGeometry(16, 10), wallMat); - leftWall.rotation.y = Math.PI / 2; - leftWall.position.set(-5.5, 3, 0); - scene.add(leftWall); - - // central pedestal - - const pedestalMat = new THREE.MeshStandardMaterial({ color: '#f0ece8', roughness: 0.4, metalness: 0.05 }); - - const pedestalBase = new THREE.Mesh(new THREE.CylinderGeometry(0.9, 1.0, 0.2, 32), pedestalMat); - pedestalBase.position.set(0, -1.9, 0); - scene.add(pedestalBase); - - const pedestalShaft = new THREE.Mesh(new THREE.CylinderGeometry(0.55, 0.65, 1.5, 32), pedestalMat); - pedestalShaft.position.set(0, -1.05, 0); - scene.add(pedestalShaft); - - const pedestalTop = new THREE.Mesh(new THREE.CylinderGeometry(0.8, 0.7, 0.25, 32), pedestalMat); - pedestalTop.position.set(0, -0.18, 0); - scene.add(pedestalTop); - - // torus knot - - const knotMat = new THREE.MeshStandardMaterial({ color: '#c0a060', roughness: 0.45, metalness: 0 }); - const torusKnot = new THREE.Mesh(new THREE.TorusKnotGeometry(0.5, 0.17, 128, 32), knotMat); - torusKnot.position.set(0, 0.82, 0); - scene.add(torusKnot); - - // columns - - const columnMat = new THREE.MeshStandardMaterial({ color: '#e8e4de', roughness: 0.5, metalness: 0 }); - - function addColumn(x, z) { - const columnGroup = new THREE.Group(); - - const base = new THREE.Mesh(new THREE.BoxGeometry(0.6, 0.2, 0.6), columnMat); - base.position.y = -1.9; - columnGroup.add(base); - - const shaft = new THREE.Mesh(new THREE.CylinderGeometry(0.18, 0.22, 5, 16), columnMat); - shaft.position.y = 0.7; - columnGroup.add(shaft); - - const capital = new THREE.Mesh(new THREE.BoxGeometry(0.55, 0.25, 0.55), columnMat); - capital.position.y = 3.35; - columnGroup.add(capital); - - columnGroup.scale.setScalar(1.5); - columnGroup.position.set(x, 1.0, z); - scene.add(columnGroup); - } - - addColumn(-5.05, -4.55); - addColumn(4.5, -4.55); - addColumn(-5.05, 3); - - // vase on its own pedestal - - const vaseProfile = [ - new THREE.Vector2(0, 0.5), - new THREE.Vector2(0.12, 0.5), - new THREE.Vector2(0.18, 0.7), - new THREE.Vector2(0.28, 0.9), - new THREE.Vector2(0.32, 1.0), - new THREE.Vector2(0.3, 1.1), - new THREE.Vector2(0.22, 1.15), - new THREE.Vector2(0.2, 1.2), - new THREE.Vector2(0.22, 1.25), - new THREE.Vector2(0, 1.25), - ]; - - const vaseMat = new THREE.MeshStandardMaterial({ color: '#d4806a', roughness: 0.6, metalness: 0.02 }); - - const vasePedestalBase = new THREE.Mesh(new THREE.CylinderGeometry(0.6, 0.7, 0.15, 32), pedestalMat); - vasePedestalBase.position.set(-5, -1.925, -2); - scene.add(vasePedestalBase); - - const vasePedestalShaft = new THREE.Mesh(new THREE.CylinderGeometry(0.35, 0.42, 1, 32), pedestalMat); - vasePedestalShaft.position.set(-5, -1.35, -2); - scene.add(vasePedestalShaft); - - const vasePedestalTop = new THREE.Mesh(new THREE.CylinderGeometry(0.55, 0.48, 0.15, 32), pedestalMat); - vasePedestalTop.position.set(-5, -0.775, -2); - scene.add(vasePedestalTop); - - const vase = new THREE.Mesh(new THREE.LatheGeometry(vaseProfile, 24), vaseMat); - vase.position.set(-5, -1.6, -2); - vase.scale.setScalar(1.8); - scene.add(vase); - - // armchair - - const woodMat = new THREE.MeshStandardMaterial({ color: '#8b6840', roughness: 0.8, metalness: 0 }); - const fabricMat = new THREE.MeshStandardMaterial({ color: '#8b3a3a', roughness: 0.9, metalness: 0 }); - - const chairGroup = new THREE.Group(); - - const seat = new THREE.Mesh(new RoundedBoxGeometry(0.9, 0.25, 0.8, 4, 0.06), fabricMat); - seat.position.set(0, -1.35, 0); - chairGroup.add(seat); - - const backrest = new THREE.Mesh(new RoundedBoxGeometry(0.9, 0.6, 0.12, 4, 0.04), fabricMat); - backrest.position.set(0, -0.95, -0.4); - backrest.rotation.x = -0.3; - chairGroup.add(backrest); - - for (const side of [-1, 1]) { - const armrest = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.25, 0.7), woodMat); - armrest.position.set(side * 0.5, -1.2, 0); - chairGroup.add(armrest); - - const armTop = new THREE.Mesh(new THREE.BoxGeometry(0.14, 0.06, 0.8), woodMat); - armTop.position.set(side * 0.5, -1.07, 0); - chairGroup.add(armTop); - } - - const legPositions = [ - [-0.38, -0.32], - [-0.38, 0.32], - [0.38, -0.32], - [0.38, 0.32], - ]; - for (const [lx, lz] of legPositions) { - const leg = new THREE.Mesh(new THREE.CylinderGeometry(0.03, 0.035, 0.2, 8), woodMat); - leg.position.set(lx, -1.575, lz); - chairGroup.add(leg); - } - - chairGroup.scale.setScalar(1.76); - chairGroup.position.set(4, 0.948, -2.5); - chairGroup.rotation.y = -0.6; - scene.add(chairGroup); - - // side table with cup - - const tableGroup = new THREE.Group(); - - const tableTop = new THREE.Mesh(new THREE.CylinderGeometry(0.4, 0.4, 0.05, 24), woodMat); - tableTop.position.y = -1.05; - tableGroup.add(tableTop); - - const tableLeg = new THREE.Mesh(new THREE.CylinderGeometry(0.04, 0.06, 0.9, 8), woodMat); - tableLeg.position.y = -1.5; - tableGroup.add(tableLeg); - - const tableBase = new THREE.Mesh(new THREE.CylinderGeometry(0.25, 0.28, 0.06, 24), woodMat); - tableBase.position.y = -1.92; - tableGroup.add(tableBase); - - const cupMat = new THREE.MeshStandardMaterial({ color: '#f0ece0', roughness: 0.4, metalness: 0.05 }); - const cupBody = new THREE.Mesh(new THREE.CylinderGeometry(0.1, 0.08, 0.2, 16), cupMat); - cupBody.scale.setScalar(1 / 2.2); - cupBody.position.set(0.15, -0.98, 0); - tableGroup.add(cupBody); - - tableGroup.scale.setScalar(2.2); - tableGroup.position.set(2, 2.29, -4); - scene.add(tableGroup); - - // rug - - const rugMat = new THREE.MeshStandardMaterial({ color: '#c8a0a8', roughness: 0.95, metalness: 0 }); - const rug = new THREE.Mesh(new THREE.BoxGeometry(6, 0.02, 5), rugMat); - rug.position.set(0, -1.99, 0.5); - scene.add(rug); - - const rugBorderMat = new THREE.MeshStandardMaterial({ color: '#d4b880', roughness: 0.95, metalness: 0 }); - const rugBorder = new THREE.Mesh(new THREE.BoxGeometry(6.3, 0.015, 5.3), rugBorderMat); - rugBorder.position.set(0, -1.9925, 0.5); - scene.add(rugBorder); - - // picture frames - - function addFrame(x, y, z, width, height, paintColor, rotY = 0) { - const frameGroup = new THREE.Group(); - const t = 0.1; - - const outerW = width + t * 2; - const outerH = height + t * 2; - const frameShape = new THREE.Shape(); - frameShape.moveTo(-outerW / 2, -outerH / 2); - frameShape.lineTo(outerW / 2, -outerH / 2); - frameShape.lineTo(outerW / 2, outerH / 2); - frameShape.lineTo(-outerW / 2, outerH / 2); - frameShape.closePath(); - - const hole = new THREE.Path(); - hole.moveTo(-width / 2, -height / 2); - hole.lineTo(width / 2, -height / 2); - hole.lineTo(width / 2, height / 2); - hole.lineTo(-width / 2, height / 2); - hole.closePath(); - frameShape.holes.push(hole); - - const frameMat = new THREE.MeshStandardMaterial({ color: '#8b6840', roughness: 0.7, metalness: 0 }); - const geo = new THREE.ExtrudeGeometry(frameShape, { - depth: 0.12, - bevelEnabled: true, - bevelThickness: 0.02, - bevelSize: 0.02, - bevelSegments: 2, - }); - const frame = new THREE.Mesh(geo, frameMat); - frameGroup.add(frame); - - const paintMat = new THREE.MeshStandardMaterial({ color: paintColor, roughness: 0.95, metalness: 0 }); - const canvas = new THREE.Mesh(new THREE.PlaneGeometry(width, height), paintMat); - canvas.position.z = 0.001; - frameGroup.add(canvas); - - frameGroup.position.set(x, y, z); - if (rotY) frameGroup.rotation.y = rotY; - scene.add(frameGroup); - } - - addFrame(-3.2, 2.0, -4.9, 1.8, 1.2, '#e8a8a0'); - addFrame(-0.5, 2.6, -4.9, 1.1, 1.6, '#a0c0e0'); - addFrame(2, 1.8, -4.9, 2.0, 1.4, '#a0d0a8'); - addFrame(-5.4, 2.2, -3, 1.5, 1.1, '#d0b0d8', Math.PI / 2); - addFrame(-5.4, 1.8, 1, 1.8, 1.3, '#e0c8a0', Math.PI / 2); - - // bust pedestal - - const bustX = -3; - const bustZ = -3.2; - - const bustBase = new THREE.Mesh(new THREE.CylinderGeometry(0.6, 0.7, 0.15, 32), pedestalMat); - bustBase.position.set(bustX, -1.925, bustZ); - scene.add(bustBase); - - const bustShaft = new THREE.Mesh(new THREE.CylinderGeometry(0.35, 0.42, 1, 32), pedestalMat); - bustShaft.position.set(bustX, -1.35, bustZ); - scene.add(bustShaft); - - const bustTop = new THREE.Mesh(new THREE.CylinderGeometry(0.55, 0.48, 0.15, 32), pedestalMat); - bustTop.position.set(bustX, -0.775, bustZ); - scene.add(bustTop); - - // Transparent plane for testing - - transparentMesh = new THREE.Mesh( - new THREE.PlaneGeometry(1.8, 2), - new THREE.MeshStandardNodeMaterial({ transparent: true, opacity: params.transparentOpacity }), - ); - transparentMesh.visible = false; - transparentMesh.position.set(0, 1.2, 1.5); - scene.add(transparentMesh); - - updateParameters(); - - // bust GLB - - const gltf = await loader.loadAsync('tennyson-bust.glb'); - const bust = gltf.scene; - bust.rotation.y = Math.PI; - - const targetHeight = 2.64; - const sizeBox = new THREE.Box3().setFromObject(bust); - const size = new THREE.Vector3(); - sizeBox.getSize(size); - bust.scale.setScalar(targetHeight / size.y); - - const fitBox = new THREE.Box3().setFromObject(bust); - const center = new THREE.Vector3(); - fitBox.getCenter(center); - bust.position.set(bustX - center.x, -0.7 - fitBox.min.y, bustZ - center.z + 0.1); - scene.add(bust); - - // events - - window.addEventListener('resize', onWindowResize); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'aoType', ['GTAO', 'SSAO']) - .name('AO type') - .onChange(() => { - // half resolution suffices for GTAO since TRAA smooths it, SSAO looks best at full resolution - - resolutionScaleControl.setValue(params.aoType === 'SSAO' ? 1 : 0.5); - - createAO(); - updateControls(); - }); - const resolutionScaleControl = gui - .add(params, 'resolutionScale', 0, 1) - .name('resolution') - .onChange(updateParameters); - gui.add(params, 'samples', 4, 32, 1).onChange(updateParameters).debounce(250); - gui.add(params, 'radius', 0.1, 1).onChange(updateParameters); - - const gtaoControls = [ - gui.add(params, 'scale', 0.01, 1).onChange(updateParameters), - gui.add(params, 'thickness', 0.01, 2).onChange(updateParameters), - gui.add(params, 'temporalFiltering').name('temporal filtering').onChange(updateParameters), - ]; - - const ssaoControls = [ - gui.add(params, 'intensity', 0, 4).onChange(updateParameters), - gui.add(params, 'bias', 0, 0.2).onChange(updateParameters), - gui.add(params, 'blurEnabled').name('blur').onChange(updateParameters), - gui.add(params, 'blurSharpness', 0, 8).name('blur sharpness').onChange(updateParameters), - ]; - - gui.add(transparentMesh, 'visible').name('show transparent mesh'); - gui.add(params, 'transparentOpacity', 0, 1, 0.01) - .name('mesh opacity') - .onChange(value => { - transparentMesh.material.opacity = value; - }); - gui.add(params, 'aoOnly').onChange(updateOutput); - - // show only the controls that apply to the active AO type - - function updateControls() { - if (params.aoType === 'GTAO') { - gtaoControls.forEach(control => control.show()); - ssaoControls.forEach(control => control.hide()); - } else { - gtaoControls.forEach(control => control.hide()); - ssaoControls.forEach(control => control.show()); - } - } - - updateControls(); -} - -function updateParameters() { - aoPass.samples.value = params.samples; - aoPass.radius.value = params.radius; - aoPass.resolutionScale = params.resolutionScale; - - if (params.aoType === 'SSAO') { - aoPass.intensity.value = params.intensity; - aoPass.bias.value = params.bias; - aoPass.blurEnabled = params.blurEnabled; - aoPass.blurSharpness.value = params.blurSharpness; - } else { - aoPass.scale.value = params.scale; - aoPass.thickness.value = params.thickness; - aoPass.useTemporalFiltering = params.temporalFiltering; - } -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_bloom.ts b/examples-testing/examples/webgpu_postprocessing_bloom.ts deleted file mode 100644 index f8194ac62..000000000 --- a/examples-testing/examples/webgpu_postprocessing_bloom.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera; -let renderPipeline, renderer, mixer, timer; - -const params = { - threshold: 0, - strength: 1, - radius: 0, - exposure: 1, -}; - -init(); - -async function init() { - timer = new THREE.Timer(); - timer.connect(document); - - const scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 100); - camera.position.set(-5, 2.5, -3.5); - scene.add(camera); - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const pointLight = new THREE.PointLight(0xffffff, 100); - camera.add(pointLight); - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/PrimaryIonDrive.glb'); - - const model = gltf.scene; - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - const clip = gltf.animations[0]; - mixer.clipAction(clip.optimize()).play(); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ReinhardToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - renderPipeline = new THREE.RenderPipeline(renderer); - - // below optimized config is only relevant when using MSAA and also optional. - // store no multisampled data and only resolve color - - const config = { - storeMultisampledColorBuffer: false, - storeMultisampledDepthBuffer: false, - storeMultisampledStencilBuffer: false, - resolveColorBuffer: true, - resolveDepthBuffer: false, - resolveStencilBuffer: false, - }; - - const scenePass = pass(scene, camera, config); - const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); - - const bloomPass = bloom(scenePassColor).toInspector('Bloom'); - - renderPipeline.outputNode = scenePassColor.add(bloomPass); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI * 0.5; - controls.minDistance = 3; - controls.maxDistance = 8; - - // - - const gui = renderer.inspector.createParameters('Settings'); - - const bloomFolder = gui.addFolder('bloom'); - - bloomFolder.add(params, 'threshold', 0.0, 1.0).onChange(function (value) { - bloomPass.threshold.value = value; - }); - - bloomFolder.add(params, 'strength', 0.0, 3.0).onChange(function (value) { - bloomPass.strength.value = value; - }); - - bloomFolder.add(params, 'radius', 0.0, 1.0, 0.01).onChange(function (value) { - bloomPass.radius.value = value; - }); - - const toneMappingFolder = gui.addFolder('tone mapping'); - - toneMappingFolder.add(params, 'exposure', 0.1, 2).onChange(function (value) { - renderer.toneMappingExposure = Math.pow(value, 4.0); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - mixer.update(delta); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts b/examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts deleted file mode 100644 index faa5b67fb..000000000 --- a/examples-testing/examples/webgpu_postprocessing_bloom_emissive.ts +++ /dev/null @@ -1,115 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, mrt, output, emissive, vec4 } from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let renderPipeline; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - // - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 20); - camera.position.set(-1.8, 0.6, 2.7); - - scene = new THREE.Scene(); - - new HDRLoader().setPath('textures/equirectangular/').load('moonless_golf_1k.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - // model - - const loader = new GLTFLoader().setPath('models/gltf/DamagedHelmet/glTF/'); - loader.load('DamagedHelmet.gltf', function (gltf) { - scene.add(gltf.scene); - }); - }); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - // - - const scenePass = pass(scene, camera); - - // set up MRT with emissive - - const mrtNode = mrt({ - output: output, - emissive: vec4(emissive, output.a), - }); - - mrtNode.setBlendMode('emissive', new THREE.BlendMode(THREE.NormalBlending)); - - scenePass.setMRT(mrtNode); - - // optimize the bandwidth - - const emissiveTexture = scenePass.getTexture('emissive'); - emissiveTexture.type = THREE.UnsignedByteType; - - // - - const outputPass = scenePass.getTextureNode().toInspector('Color'); - const emissivePass = scenePass.getTextureNode('emissive').toInspector('Emissive'); - - const bloomPass = bloom(emissivePass, 2.5, 0.5); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = outputPass.add(bloomPass); - - // - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.target.set(0, 0, -0.2); - controls.update(); - - window.addEventListener('resize', onWindowResize); - - // - - const gui = renderer.inspector.createParameters('Settings'); - - const bloomFolder = gui.addFolder('Bloom'); - bloomFolder.add(bloomPass.strength, 'value', 0.0, 5.0).name('strength'); - bloomFolder.add(bloomPass.radius, 'value', 0.0, 1.0).name('radius'); - - const toneMappingFolder = gui.addFolder('Tone Mapping'); - toneMappingFolder.add(renderer, 'toneMappingExposure', 0.1, 2).name('exposure'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts b/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts deleted file mode 100644 index b8f2427d4..000000000 --- a/examples-testing/examples/webgpu_postprocessing_bloom_selective.ts +++ /dev/null @@ -1,124 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, mrt, output, float, uniform } from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -// scene - -const scene = new THREE.Scene(); - -const camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 1, 200); -camera.position.set(0, 0, 20); -camera.lookAt(0, 0, 0); - -const geometry = new THREE.IcosahedronGeometry(1, 15); - -for (let i = 0; i < 50; i++) { - const color = new THREE.Color(); - color.setHSL(Math.random(), 0.7, Math.random() * 0.2 + 0.05); - - const bloomIntensity = Math.random() > 0.5 ? 1 : 0; - - const material = new THREE.MeshBasicNodeMaterial({ color: color }); - material.mrtNode = mrt({ - bloomIntensity: uniform(bloomIntensity), - }); - - const sphere = new THREE.Mesh(geometry, material); - sphere.position.x = Math.random() * 10 - 5; - sphere.position.y = Math.random() * 10 - 5; - sphere.position.z = Math.random() * 10 - 5; - sphere.position.normalize().multiplyScalar(Math.random() * 4.0 + 2.0); - sphere.scale.setScalar(Math.random() * Math.random() + 0.5); - scene.add(sphere); -} - -// renderer - -const renderer = new THREE.WebGPURenderer(); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setAnimationLoop(animate); -renderer.inspector = new Inspector(); -renderer.toneMapping = THREE.NeutralToneMapping; -document.body.appendChild(renderer.domElement); - -// post processing - -const scenePass = pass(scene, camera); -scenePass.setMRT( - mrt({ - output, - bloomIntensity: float(0), // default bloom intensity - }), -); - -const outputPass = scenePass.getTextureNode().toInspector('Color'); -const bloomIntensityPass = scenePass.getTextureNode('bloomIntensity').toInspector('Bloom Intensity'); - -const bloomPass = bloom(outputPass.mul(bloomIntensityPass)); - -const renderPipeline = new THREE.RenderPipeline(renderer); -renderPipeline.outputColorTransform = false; -renderPipeline.outputNode = outputPass.add(bloomPass).renderOutput(); - -// controls - -const controls = new OrbitControls(camera, renderer.domElement); -controls.maxPolarAngle = Math.PI * 0.5; -controls.minDistance = 1; -controls.maxDistance = 100; - -// raycaster - -const raycaster = new THREE.Raycaster(); -const mouse = new THREE.Vector2(); - -window.addEventListener('pointerdown', event => { - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; - - raycaster.setFromCamera(mouse, camera); - - const intersects = raycaster.intersectObjects(scene.children, false); - - if (intersects.length > 0) { - const material = intersects[0].object.material; - - const bloomIntensity = material.mrtNode.get('bloomIntensity'); - bloomIntensity.value = bloomIntensity.value === 0 ? 1 : 0; - } -}); - -// gui - -const gui = renderer.inspector.createParameters('Settings'); - -const bloomFolder = gui.addFolder('Bloom'); -bloomFolder.add(bloomPass.threshold, 'value', 0.0, 1.0).name('threshold'); -bloomFolder.add(bloomPass.strength, 'value', 0.0, 3).name('strength'); -bloomFolder.add(bloomPass.radius, 'value', 0.0, 1.0).name('radius'); - -const toneMappingFolder = gui.addFolder('Tone Mapping'); -toneMappingFolder.add(renderer, 'toneMappingExposure', 0.1, 3).name('exposure'); - -// events - -window.onresize = function () { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -}; - -// animate - -function animate() { - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_ca.ts b/examples-testing/examples/webgpu_postprocessing_ca.ts deleted file mode 100644 index 48b549050..000000000 --- a/examples-testing/examples/webgpu_postprocessing_ca.ts +++ /dev/null @@ -1,266 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, renderOutput, uniform } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { chromaticAberration } from 'three/addons/tsl/display/ChromaticAberrationNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const params = { - enabled: true, - animated: true, - strength: 1.5, - center: new THREE.Vector2(0.5, 0.5), - scale: 1.2, - autoRotate: true, - cameraDistance: 40, -}; - -let camera, scene, renderer, timer, mainGroup; -let controls, renderPipeline; - -init(); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); - camera.position.set(0, 15, params.cameraDistance); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.dampingFactor = 0.1; - controls.autoRotate = true; - controls.autoRotateSpeed = -0.1; - controls.target.set(0, 0.5, 0); - controls.update(); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x0a0a0a); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - - timer = new THREE.Timer(); - timer.connect(document); - - // Create main group - mainGroup = new THREE.Group(); - scene.add(mainGroup); - - // Create shapes - createShapes(); - - // Add a grid for reference - const gridHelper = new THREE.GridHelper(40, 20, 0x444444, 0x222222); - gridHelper.position.y = -10; - scene.add(gridHelper); - - // post processing - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = false; - - // scene pass - const scenePass = pass(scene, camera); - const outputPass = renderOutput(scenePass); - - // Create uniform nodes for the static version that can be updated - const staticStrength = uniform(params.strength); - const staticCenter = uniform(new THREE.Vector2(params.center.x, params.center.y)); - const staticScale = uniform(params.scale); - - // With static values (using uniform nodes) - const caPass = chromaticAberration(outputPass, staticStrength, staticCenter, staticScale); - - // Set initial output based on params - renderPipeline.outputNode = params.enabled ? caPass : outputPass; - - window.addEventListener('resize', onWindowResize); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(params, 'enabled').onChange(value => { - renderPipeline.outputNode = value ? caPass : outputPass; - renderPipeline.needsUpdate = true; - }); - - const staticFolder = gui.addFolder('Static Parameters'); - - staticFolder.add(staticStrength, 'value', 0, 3).name('Strength'); - staticFolder.add(staticCenter.value, 'x', -1, 1).name('Center X'); - staticFolder.add(staticCenter.value, 'y', -1, 1).name('Center Y'); - staticFolder.add(staticScale, 'value', 0.5, 2).name('Scale'); - - const animationFolder = gui.addFolder('Animation'); - animationFolder.add(params, 'animated'); - animationFolder.add(params, 'autoRotate').onChange(value => { - controls.autoRotate = value; - }); -} - -function createShapes() { - const shapes = []; - const materials = []; - - // Define colors for different materials - const colors = [ - 0xff0000, // Red - 0x00ff00, // Green - 0x0000ff, // Blue - 0xffff00, // Yellow - 0xff00ff, // Magenta - 0x00ffff, // Cyan - 0xffffff, // White - 0xff8800, // Orange - ]; - - // Create materials - colors.forEach(color => { - materials.push( - new THREE.MeshStandardMaterial({ - color: color, - roughness: 0.2, - metalness: 0.8, - }), - ); - }); - - // Create geometries - const geometries = [ - new THREE.BoxGeometry(3, 3, 3), - new THREE.SphereGeometry(2, 32, 16), - new THREE.ConeGeometry(2, 4, 8), - new THREE.CylinderGeometry(1.5, 1.5, 4, 8), - new THREE.TorusGeometry(2, 0.8, 8, 16), - new THREE.OctahedronGeometry(2.5), - new THREE.IcosahedronGeometry(2.5), - new THREE.TorusKnotGeometry(1.5, 0.5, 64, 8), - ]; - - // Create central showcase - const centralGroup = new THREE.Group(); - - // Large central torus - const centralTorus = new THREE.Mesh( - new THREE.TorusGeometry(5, 1.5, 16, 32), - new THREE.MeshStandardMaterial({ - color: 0xffffff, - roughness: 0.1, - metalness: 1, - emissive: 0x222222, - }), - ); - centralGroup.add(centralTorus); - - // Inner rotating shapes - for (let i = 0; i < 6; i++) { - const angle = (i / 6) * Math.PI * 2; - const radius = 3; - - const mesh = new THREE.Mesh(geometries[i % geometries.length], materials[i % materials.length]); - - mesh.position.set(Math.cos(angle) * radius, 0, Math.sin(angle) * radius); - - mesh.scale.setScalar(0.5); - centralGroup.add(mesh); - shapes.push(mesh); - } - - mainGroup.add(centralGroup); - shapes.push(centralGroup); - - // Create outer ring of shapes - const numShapes = 12; - const outerRadius = 15; - - for (let i = 0; i < numShapes; i++) { - const angle = (i / numShapes) * Math.PI * 2; - const shapesGroup = new THREE.Group(); - - const geometry = geometries[i % geometries.length]; - const material = materials[i % materials.length]; - - const mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - mesh.receiveShadow = true; - - shapesGroup.add(mesh); - shapesGroup.position.set(Math.cos(angle) * outerRadius, Math.sin(i * 0.5) * 2, Math.sin(angle) * outerRadius); - - mainGroup.add(shapesGroup); - shapes.push(shapesGroup); - } - - // Add floating particles - const particlesGeometry = new THREE.BufferGeometry(); - const particlesCount = 200; - const positions = new Float32Array(particlesCount * 3); - - for (let i = 0; i < particlesCount * 3; i += 3) { - const radius = 25 + Math.random() * 10; - const theta = Math.random() * Math.PI * 2; - const phi = Math.random() * Math.PI; - - positions[i] = radius * Math.sin(phi) * Math.cos(theta); - positions[i + 1] = radius * Math.cos(phi); - positions[i + 2] = radius * Math.sin(phi) * Math.sin(theta); - } - - particlesGeometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - - const particlesMaterial = new THREE.PointsMaterial({ - color: 0xffffff, - size: 0.5, - sizeAttenuation: true, - }); - - const particles = new THREE.Points(particlesGeometry, particlesMaterial); - mainGroup.add(particles); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const time = timer.getElapsed(); - - controls.update(); - - if (params.animated) { - // Animate individual shapes - mainGroup.children.forEach((child, index) => { - if (child.children.length > 0) { - // Central group - child.rotation.y = time * 0.5; - child.children.forEach((subChild, subIndex) => { - if (subChild.geometry) { - subChild.rotation.x = time * (1 + subIndex * 0.1); - subChild.rotation.z = time * (1 - subIndex * 0.1); - } - }); - } else if (child.type === 'Group') { - // Outer shapes - child.rotation.x = time * 0.5 + index; - child.rotation.y = time * 0.3 + index; - child.position.y = Math.sin(time + index) * 2; - } - }); - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_difference.ts b/examples-testing/examples/webgpu_postprocessing_difference.ts deleted file mode 100644 index 91cc4cbf5..000000000 --- a/examples-testing/examples/webgpu_postprocessing_difference.ts +++ /dev/null @@ -1,93 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, luminance, saturation } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const params = { - speed: 0, -}; - -let camera, renderer, renderPipeline; -let timer, mesh, controls; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.toneMapping = THREE.NeutralToneMapping; - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 100); - camera.position.set(1, 2, 3); - - const scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x0487e2, 7, 25); - scene.background = new THREE.Color(0x0487e2); - - timer = new THREE.Timer(); - timer.connect(document); - - const texture = new THREE.TextureLoader().load('textures/crate.gif'); - texture.colorSpace = THREE.SRGBColorSpace; - - const geometry = new THREE.BoxGeometry(); - const material = new THREE.MeshBasicMaterial({ map: texture }); - - mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - - const currentTexture = scenePass.getTextureNode(); - const previousTexture = scenePass.getPreviousTextureNode(); - - const frameDiff = previousTexture.sub(currentTexture).abs(); - - const saturationAmount = luminance(frameDiff).mul(1000).clamp(0, 3); - - renderPipeline.outputNode = saturation(currentTexture, saturationAmount); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 2; - controls.maxDistance = 10; - controls.enableDamping = true; - controls.dampingFactor = 0.01; - - window.addEventListener('resize', onWindowResize); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'speed', 0, 2); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - controls.update(); - - mesh.rotation.y += timer.getDelta() * 5 * params.speed; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_direct.ts b/examples-testing/examples/webgpu_postprocessing_direct.ts deleted file mode 100644 index a2d690312..000000000 --- a/examples-testing/examples/webgpu_postprocessing_direct.ts +++ /dev/null @@ -1,78 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { output, saturation, uniform, vec4 } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline; -let object; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 400; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - object = new THREE.Object3D(); - scene.add(object); - - const geometry = new THREE.SphereGeometry(1, 4, 4); - - for (let i = 0; i < 100; i++) { - const material = new THREE.MeshPhongMaterial({ color: Math.random() * 0xffffff, flatShading: true }); - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5).normalize(); - mesh.position.multiplyScalar(Math.random() * 400); - mesh.rotation.set(Math.random() * 2, Math.random() * 2, Math.random() * 2); - mesh.scale.setScalar(Math.random() * 50); - object.add(mesh); - } - - scene.add(new THREE.AmbientLight(0xcccccc)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1); - scene.add(light); - - // direct post-processing - - const saturationFactor = uniform(0); - - renderPipeline = new THREE.DirectRenderPipeline(renderer); - renderPipeline.outputNode = vec4(saturation(output.rgb, saturationFactor), output.a); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(saturationFactor, 'value', 0, 1, 0.01).name('Saturation'); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - object.rotation.x += 0.005; - object.rotation.y += 0.01; - - renderPipeline.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_postprocessing_dof.ts b/examples-testing/examples/webgpu_postprocessing_dof.ts deleted file mode 100644 index 862c2802b..000000000 --- a/examples-testing/examples/webgpu_postprocessing_dof.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { cubeTexture, positionWorld, oscSine, time, pass, uniform } from 'three/tsl'; -import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -// - -let camera, scene, renderer, mesh, controls; - -let width = window.innerWidth; -let height = window.innerHeight; - -let renderPipeline; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, width / height, 1, 3500); - camera.position.z = 200; - - scene = new THREE.Scene(); - - const path = 'textures/cube/SwedishRoyalCastle/'; - const format = '.jpg'; - const urls = [ - path + 'px' + format, - path + 'nx' + format, - path + 'py' + format, - path + 'ny' + format, - path + 'pz' + format, - path + 'nz' + format, - ]; - - const xgrid = 14, - ygrid = 9, - zgrid = 14; - const count = xgrid * ygrid * zgrid; - - const textureCube = new THREE.CubeTextureLoader().load(urls); - const cubeTextureNode = cubeTexture(textureCube); - const oscPos = oscSine(positionWorld.div(1000 /* scene distance */).add(time.mul(0.2))); - - const geometry = new THREE.SphereGeometry(60, 20, 10); - const material = new THREE.MeshBasicNodeMaterial(); - material.colorNode = cubeTextureNode.mul(oscPos); - - mesh = new THREE.InstancedMesh(geometry, material, count); - scene.add(mesh); - - const matrix = new THREE.Matrix4(); - - let index = 0; - - for (let i = 0; i < xgrid; i++) { - for (let j = 0; j < ygrid; j++) { - for (let k = 0; k < zgrid; k++) { - const x = 200 * (i - xgrid / 2); - const y = 200 * (j - ygrid / 2); - const z = 200 * (k - zgrid / 2); - - mesh.setMatrixAt(index, matrix.identity().setPosition(x, y, z)); - index++; - } - } - } - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - const effectController = { - focusDistance: uniform(500), - focalLength: uniform(200), - bokehScale: uniform(10), - }; - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - - const scenePassColor = scenePass.getTextureNode().toInspector('Color'); - const scenePassViewZ = scenePass.getViewZNode(); - - const dofPass = dof( - scenePassColor, - scenePassViewZ, - effectController.focusDistance, - effectController.focalLength, - effectController.bokehScale, - ); - - renderPipeline.outputNode = dofPass; - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(effectController.focusDistance, 'value', 10.0, 3000.0).name('focus distance'); - gui.add(effectController.focalLength, 'value', 50, 750).name('focal length'); - gui.add(effectController.bokehScale, 'value', 1, 20).name('bokeh scale'); -} - -function onWindowResize() { - width = window.innerWidth; - height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_dof_basic.ts b/examples-testing/examples/webgpu_postprocessing_dof_basic.ts deleted file mode 100644 index 8be1a3276..000000000 --- a/examples-testing/examples/webgpu_postprocessing_dof_basic.ts +++ /dev/null @@ -1,154 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mix, pass, renderOutput, smoothstep, uniform, vec3 } from 'three/tsl'; -import { boxBlur } from 'three/addons/tsl/display/boxBlur.js'; -import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import TWEEN from 'three/addons/libs/tween.module.js'; - -let camera, controls, scene, timer, renderer, model, mixer, raycaster, renderPipeline; - -const pointerCoords = new THREE.Vector2(); -const focusPoint = new THREE.Vector3(1, 1.75, -0.4); -const focusPointView = uniform(vec3()); - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-6, 5, 6); - - controls = new OrbitControls(camera); - controls.target.set(0, 2, 0); - controls.enableDamping = true; - controls.update(); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x90d5ff); - - raycaster = new THREE.Raycaster(); - - timer = new THREE.Timer(); - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - const gltf = await loader.loadAsync('models/gltf/bath_day.glb'); - - model = gltf.scene; - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - // - - const hdrLoader = new UltraHDRLoader(); - const envMap = await hdrLoader.loadAsync('textures/equirectangular/spruit_sunrise_2k.hdr.jpg'); - envMap.mapping = THREE.EquirectangularReflectionMapping; - scene.environmentRotation.y = Math.PI * -0.5; - scene.environment = envMap; - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.toneMapping = THREE.NeutralToneMapping; - document.body.appendChild(renderer.domElement); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = false; - - // DOF uniforms - - const blurSize = uniform(2); // determines the kernel size of the blur - const blurSpread = uniform(4); // determines how far the blur is spread - const minDistance = uniform(1); // all positions at or below minDistance will be completely in focus. - const maxDistance = uniform(3); // all positions at or beyond maxDistance will be completely out of focus. - - // beauty and blur/out-of-focus pass - - const scenePass = pass(scene, camera); - - const scenePassColor = scenePass.getTextureNode().toInspector('Color'); - const scenePassViewZ = scenePass.getViewZNode(); - const scenePassBlurred = boxBlur(scenePassColor, { size: blurSize, separation: blurSpread }); - - // simple DOF from https://lettier.github.io/3d-game-shaders-for-beginners/depth-of-field.html - - const blur = smoothstep(minDistance, maxDistance, scenePassViewZ.sub(focusPointView.z).abs()); - const dofPass = mix(scenePassColor, scenePassBlurred, blur); - - const outputPass = renderOutput(dofPass); - const fxaaPass = fxaa(outputPass); - - renderPipeline.outputNode = fxaaPass; - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(minDistance, 'value', 0, 3).name('min distance'); - gui.add(maxDistance, 'value', 0, 5).name('max distance'); - gui.add(blurSize, 'value', 1, 3, 1).name('blur size'); - gui.add(blurSpread, 'value', 1, 7, 1).name('blur spread'); - - // - - controls.connect(renderer.domElement); - - renderer.domElement.addEventListener('pointerdown', onPointerDown); - - window.addEventListener('resize', onWindowResize); -} - -function onPointerDown(event) { - pointerCoords.set((event.clientX / window.innerWidth) * 2 - 1, -(event.clientY / window.innerHeight) * 2 + 1); - - raycaster.setFromCamera(pointerCoords, camera); - - const intersects = raycaster.intersectObject(model); - - if (intersects.length > 0) { - TWEEN.removeAll(); - - new TWEEN.Tween(focusPoint).to(intersects[0].point, 500).easing(TWEEN.Easing.Cubic.InOut).start(); - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - TWEEN.update(); - - controls.update(); - - timer.update(); - - mixer.update(timer.getDelta()); - - // since the focus point is expressed in view space, it must be updated on every - // camera change. for simplicity, do this every frame. - - camera.updateMatrixWorld(); - focusPointView.value.copy(focusPoint).applyMatrix4(camera.matrixWorldInverse); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_fxaa.ts b/examples-testing/examples/webgpu_postprocessing_fxaa.ts deleted file mode 100644 index 24c01a950..000000000 --- a/examples-testing/examples/webgpu_postprocessing_fxaa.ts +++ /dev/null @@ -1,129 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, renderOutput } from 'three/tsl'; -import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const params = { - enabled: true, - animated: false, -}; - -let camera, scene, renderer, timer, group; -let renderPipeline; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); - camera.position.z = 50; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - timer = new THREE.Timer(); - timer.connect(document); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d); - hemiLight.position.set(0, 1000, 0); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(-3000, 1000, -1000); - scene.add(dirLight); - - // - - group = new THREE.Group(); - - const geometry = new THREE.TetrahedronGeometry(); - const material = new THREE.MeshStandardMaterial({ color: 0xf73232, flatShading: true }); - - const mesh = new THREE.InstancedMesh(geometry, material, 100); - const dummy = new THREE.Object3D(); - - for (let i = 0; i < 100; i++) { - dummy.position.x = Math.random() * 50 - 25; - dummy.position.y = Math.random() * 50 - 25; - dummy.position.z = Math.random() * 50 - 25; - - dummy.scale.setScalar(Math.random() * 2 + 1); - - dummy.rotation.x = Math.random() * Math.PI; - dummy.rotation.y = Math.random() * Math.PI; - dummy.rotation.z = Math.random() * Math.PI; - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - } - - group.add(mesh); - scene.add(group); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // ignore default output color transform ( toneMapping and outputColorSpace ) - // use renderOutput() for control the sequence - - renderPipeline.outputColorTransform = false; - - // scene pass - - const scenePass = pass(scene, camera).toInspector('Color'); - const outputPass = renderOutput(scenePass); - - // FXAA must be computed in sRGB color space (so after tone mapping and color space conversion) - - const fxaaPass = fxaa(outputPass); - renderPipeline.outputNode = fxaaPass; - - // - - window.addEventListener('resize', onWindowResize); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'enabled').onChange(value => { - if (value === true) { - renderPipeline.outputNode = fxaaPass; - } else { - renderPipeline.outputNode = outputPass; - } - - renderPipeline.needsUpdate = true; - }); - gui.add(params, 'animated'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (params.animated === true) { - group.rotation.y += delta * 0.1; - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_godrays.ts b/examples-testing/examples/webgpu_postprocessing_godrays.ts deleted file mode 100644 index 32e619a47..000000000 --- a/examples-testing/examples/webgpu_postprocessing_godrays.ts +++ /dev/null @@ -1,209 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, uniform, float, int, color } from 'three/tsl'; -import { godrays } from 'three/addons/tsl/display/GodraysNode.js'; -import { bilateralBlur } from 'three/addons/tsl/display/BilateralBlurNode.js'; -import { depthAwareBlend } from 'three/addons/tsl/display/depthAwareBlend.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, controls, scene, renderer, renderPipeline; - -const params = { - enabledBlur: true, -}; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(-175, 50, 0); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - // asset - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/godrays_demo.glb'); - scene.add(gltf.scene); - - const pillars = gltf.scene.getObjectByName('concrete'); - pillars.material = new THREE.MeshStandardMaterial({ - color: 0x333333, - }); - - const base = gltf.scene.getObjectByName('base'); - base.material = new THREE.MeshStandardMaterial({ - color: 0x333333, - side: THREE.DoubleSide, - }); - - // lights - - const lightPos = new THREE.Vector3(0, 50, 0); - const lightSphereMaterial = new THREE.MeshBasicMaterial({ - color: 0xffffff, - }); - const lightSphere = new THREE.Mesh(new THREE.SphereGeometry(0.5, 16, 16), lightSphereMaterial); - lightSphere.position.copy(lightPos); - scene.add(lightSphere); - - scene.add(new THREE.AmbientLight(0xcccccc, 0.4)); - - const pointLight = new THREE.PointLight(0xf6287d, 10000); - pointLight.castShadow = true; - pointLight.shadow.bias = -0.00001; - pointLight.shadow.mapSize.width = 2048; - pointLight.shadow.mapSize.height = 2048; - pointLight.position.copy(lightPos); - scene.add(pointLight); - - setupBackdrop(); - - // shadow setup - - scene.traverse(obj => { - if (obj.isMesh === true) { - obj.castShadow = true; - obj.receiveShadow = true; - } - }); - - lightSphere.castShadow = false; - lightSphere.receiveShadow = false; - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // beauty - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode('output'); - const scenePassDepth = scenePass.getTextureNode('depth'); - - // godrays - - const godraysPass = godrays(scenePassDepth, camera, pointLight); - const godraysPassColor = godraysPass.getTextureNode(); - - // blur - - const blurPass = bilateralBlur(godraysPassColor); - const blurPassColor = blurPass.getTextureNode(); - - // composite - - const blendColor = uniform(color(0xf6287d)); - const edgeRadius = uniform(int(2)); - const edgeStrength = uniform(float(2)); - - const outputBlurred = depthAwareBlend(scenePassColor, blurPassColor, scenePassDepth, camera, { - blendColor, - edgeRadius, - edgeStrength, - }); - const outputRaw = depthAwareBlend(scenePassColor, godraysPassColor, scenePassDepth, camera, { - blendColor, - edgeRadius, - edgeStrength, - }); - - renderPipeline.outputNode = outputBlurred; - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - const godraysFolder = gui.addFolder('Godrays'); - godraysFolder.add(godraysPass.raymarchSteps, 'value', 24, 120).step(1).name('raymarch steps'); - godraysFolder.add(godraysPass.density, 'value', 0, 1).name('density'); - godraysFolder.add(godraysPass.maxDensity, 'value', 0, 1).name('max density'); - godraysFolder.add(godraysPass.distanceAttenuation, 'value', 0, 5).name('distance attenuation'); - - const compositeFolder = gui.addFolder('composite'); - compositeFolder.add(edgeRadius, 'value', 0, 5, 1).name('edge radius'); - compositeFolder.add(edgeStrength, 'value', 0, 5).name('edge strength'); - - const blurFolder = gui.addFolder('blur'); - blurFolder - .add(params, 'enabledBlur') - .name('enabled') - .onChange(value => { - if (value === true) { - renderPipeline.outputNode = outputBlurred; - } else { - renderPipeline.outputNode = outputRaw; - } - - renderPipeline.needsUpdate = true; - }); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.5, 0); - controls.enableDamping = true; - controls.maxDistance = 200; - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function setupBackdrop() { - const backdropDistance = 200; - // Add backdrop walls `backdropDistance` units away from the origin - const backdropGeometry = new THREE.PlaneGeometry(400, 200); - const backdropMaterial = new THREE.MeshBasicMaterial({ - color: 0x000000, - side: THREE.DoubleSide, - }); - const backdropLeft = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropLeft.position.set(-backdropDistance, 100, 0); - backdropLeft.rotateY(Math.PI / 2); - scene.add(backdropLeft); - - const backdropRight = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropRight.position.set(backdropDistance, 100, 0); - backdropRight.rotateY(Math.PI / 2); - scene.add(backdropRight); - - const backdropFront = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropFront.position.set(0, 100, -backdropDistance); - scene.add(backdropFront); - - const backdropBack = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropBack.position.set(0, 100, backdropDistance); - scene.add(backdropBack); - - const backdropTop = new THREE.Mesh(backdropGeometry, backdropMaterial); - backdropTop.position.set(0, 200, 0); - backdropTop.rotateX(Math.PI / 2); - backdropTop.scale.set(3, 6, 1); - scene.add(backdropTop); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_lensflare.ts b/examples-testing/examples/webgpu_postprocessing_lensflare.ts deleted file mode 100644 index 39b1e5f6e..000000000 --- a/examples-testing/examples/webgpu_postprocessing_lensflare.ts +++ /dev/null @@ -1,135 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, mrt, output, emissive, uniform } from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; -import { lensflare } from 'three/addons/tsl/display/LensflareNode.js'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls; -let renderPipeline; - -init(); - -async function init() { - // - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0.5, -0.5); - - scene = new THREE.Scene(); - - const texture = await new UltraHDRLoader().loadAsync('textures/equirectangular/ice_planet_close.jpg'); - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - scene.backgroundIntensity = 2; - scene.environmentIntensity = 15; - - // model - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/space_ship_hallway.glb'); - - const object = gltf.scene; - - const aabb = new THREE.Box3().setFromObject(object); - const center = aabb.getCenter(new THREE.Vector3()); - - object.position.x += object.position.x - center.x; - object.position.y += object.position.y - center.y; - object.position.z += object.position.z - center.z; - - scene.add(object); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - const scenePass = pass(scene, camera); - scenePass.setMRT( - mrt({ - output, - emissive, - }), - ); - - const outputPass = scenePass.getTextureNode().toInspector('Color'); - const emissivePass = scenePass.getTextureNode('emissive').toInspector('Emissive'); - - const bloomPass = bloom(emissivePass, 1, 1).toInspector('Bloom'); - - const threshold = uniform(0.5); - const ghostAttenuationFactor = uniform(25); - const ghostSpacing = uniform(0.25); - - const flarePass = lensflare(bloomPass, { - threshold, - ghostAttenuationFactor, - ghostSpacing, - }); - - const blurPass = gaussianBlur(flarePass, 8); // optional (blurring produces better flare quality but also adds some overhead) - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = outputPass.add(bloomPass).add(blurPass); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.enablePan = false; - controls.enableZoom = false; - controls.target.copy(camera.position); - controls.target.z -= 0.01; - controls.update(); - - window.addEventListener('resize', onWindowResize); - - // - - const gui = renderer.inspector.createParameters('Settings'); - - const bloomFolder = gui.addFolder('bloom'); - bloomFolder.add(bloomPass.strength, 'value', 0.0, 2.0).name('strength'); - bloomFolder.add(bloomPass.radius, 'value', 0.0, 1.0).name('radius'); - - const lensflareFolder = gui.addFolder('lensflare'); - lensflareFolder.add(threshold, 'value', 0.0, 1.0).name('threshold'); - lensflareFolder.add(ghostAttenuationFactor, 'value', 10.0, 50.0).name('attenuation'); - lensflareFolder.add(ghostSpacing, 'value', 0.0, 0.3).name('spacing'); - - const toneMappingFolder = gui.addFolder('tone mapping'); - toneMappingFolder.add(renderer, 'toneMappingExposure', 0.1, 2).name('exposure'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_masking.ts b/examples-testing/examples/webgpu_postprocessing_masking.ts deleted file mode 100644 index b234abc66..000000000 --- a/examples-testing/examples/webgpu_postprocessing_masking.ts +++ /dev/null @@ -1,88 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, texture } from 'three/tsl'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, renderPipeline, renderer; -let box, torus; - -init(); - -function init() { - // scene - - const baseScene = new THREE.Scene(); - baseScene.background = new THREE.Color(0xe0e0e0); - - const maskScene1 = new THREE.Scene(); - box = new THREE.Mesh(new THREE.BoxGeometry(4, 4, 4)); - maskScene1.add(box); - - const maskScene2 = new THREE.Scene(); - torus = new THREE.Mesh(new THREE.TorusGeometry(3, 1, 16, 32)); - maskScene2.add(torus); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 10; - - // textures - - const texture1 = new THREE.TextureLoader().load('textures/758px-Canestra_di_frutta_(Caravaggio).jpg'); - texture1.colorSpace = THREE.SRGBColorSpace; - texture1.minFilter = THREE.LinearFilter; - texture1.generateMipmaps = false; - texture1.flipY = false; - - const texture2 = new THREE.TextureLoader().load('textures/2294472375_24a3b8ef46_o.jpg'); - texture2.colorSpace = THREE.SRGBColorSpace; - texture2.flipY = false; - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - // post processing - - const base = pass(baseScene, camera); - const sceneMask1 = pass(maskScene1, camera).a; - const sceneMask2 = pass(maskScene2, camera).a; - - let compose = base; - compose = sceneMask1.mix(compose, texture(texture1)); - compose = sceneMask2.mix(compose, texture(texture2)); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = compose; -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - const time = performance.now() * 0.001 + 6000; - - box.position.x = Math.cos(time / 1.5) * 2; - box.position.y = Math.sin(time) * 2; - box.rotation.x = time; - box.rotation.y = time / 2; - - torus.position.x = Math.cos(time) * 2; - torus.position.y = Math.sin(time / 1.5) * 2; - torus.rotation.x = time; - torus.rotation.y = time / 2; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_motion_blur.ts b/examples-testing/examples/webgpu_postprocessing_motion_blur.ts deleted file mode 100644 index 1b5785ef1..000000000 --- a/examples-testing/examples/webgpu_postprocessing_motion_blur.ts +++ /dev/null @@ -1,199 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, texture, uniform, output, mrt, velocity, uv, screenUV, vec4 } from 'three/tsl'; -import { motionBlur } from 'three/addons/tsl/display/MotionBlur.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let boxLeft, boxRight, model, mixer, timer; -let renderPipeline; -let controls; - -const params = { - speed: 1.0, -}; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); - camera.position.set(0, 1.5, 4.5); - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x0487e2, 7, 25); - - const sunLight = new THREE.DirectionalLight(0xffe499, 5); - sunLight.castShadow = true; - sunLight.shadow.camera.near = 0.1; - sunLight.shadow.camera.far = 10; - sunLight.shadow.camera.right = 2; - sunLight.shadow.camera.left = -2; - sunLight.shadow.camera.top = 2; - sunLight.shadow.camera.bottom = -2; - sunLight.shadow.mapSize.width = 1024; - sunLight.shadow.mapSize.height = 1024; - sunLight.position.set(4, 4, 2); - - const waterAmbientLight = new THREE.HemisphereLight(0x333366, 0x74ccf4, 5); - const skyAmbientLight = new THREE.HemisphereLight(0x74ccf4, 0, 1); - - scene.add(sunLight); - scene.add(skyAmbientLight); - scene.add(waterAmbientLight); - - timer = new THREE.Timer(); - timer.connect(document); - - // animated model - - const loader = new GLTFLoader(); - loader.load('models/gltf/Xbot.glb', function (gltf) { - model = gltf.scene; - - model.rotation.y = Math.PI / 2; - - model.traverse(function (child) { - if (child.isMesh) { - child.castShadow = true; - child.receiveShadow = true; - } - }); - - mixer = new THREE.AnimationMixer(model); - - const action = mixer.clipAction(gltf.animations[3]); - action.play(); - - scene.add(model); - }); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const floorColor = textureLoader.load('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); - floorColor.wrapS = THREE.RepeatWrapping; - floorColor.wrapT = THREE.RepeatWrapping; - floorColor.colorSpace = THREE.SRGBColorSpace; - - const floorNormal = textureLoader.load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); - floorNormal.wrapS = THREE.RepeatWrapping; - floorNormal.wrapT = THREE.RepeatWrapping; - - // floor - - const floorUV = uv().mul(5); - - const floorMaterial = new THREE.MeshPhongNodeMaterial(); - floorMaterial.colorNode = texture(floorColor, floorUV); - - const floor = new THREE.Mesh(new THREE.BoxGeometry(15, 0.001, 15), floorMaterial); - floor.receiveShadow = true; - - floor.position.set(0, 0, 0); - scene.add(floor); - - const walls = new THREE.Mesh( - new THREE.BoxGeometry(15, 15, 15), - new THREE.MeshPhongNodeMaterial({ colorNode: floorMaterial.colorNode, side: THREE.BackSide }), - ); - scene.add(walls); - - const map = new THREE.TextureLoader().load('textures/uv_grid_opengl.jpg'); - map.colorSpace = THREE.SRGBColorSpace; - - const geometry = new THREE.TorusGeometry(0.8); - const material = new THREE.MeshBasicMaterial({ map }); - - boxRight = new THREE.Mesh(geometry, material); - boxRight.position.set(3.5, 1.5, -4); - scene.add(boxRight); - - boxLeft = new THREE.Mesh(geometry, material); - boxLeft.position.set(-3.5, 1.5, -4); - scene.add(boxLeft); - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 10; - controls.maxPolarAngle = Math.PI / 2; - controls.autoRotate = true; - controls.autoRotateSpeed = 1; - controls.target.set(0, 1, 0); - controls.enableDamping = true; - controls.dampingFactor = 0.05; - controls.update(); - - // post-processing - - const blurAmount = uniform(1); - - const scenePass = pass(scene, camera); - - scenePass.setMRT( - mrt({ - output, - velocity, - }), - ); - - const beauty = scenePass.getTextureNode().toInspector('Color'); - const vel = scenePass.getTextureNode('velocity').toInspector('Velocity').mul(blurAmount); - - const mBlur = motionBlur(beauty, vel); - - const vignette = screenUV.distance(0.5).remap(0.6, 1).mul(2).clamp().oneMinus(); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = vec4(mBlur.mul(vignette).rgb, mBlur.a); - - // - - const gui = renderer.inspector.createParameters('Motion Blur Settings'); - gui.add(controls, 'autoRotate'); - gui.add(blurAmount, 'value', 0, 3).name('blur amount'); - gui.add(params, 'speed', 0, 2); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - controls.update(); - - const delta = timer.getDelta(); - const speed = params.speed; - - boxRight.rotation.y += delta * 4 * speed; - boxLeft.scale.setScalar(1 + Math.sin(timer.getElapsed() * 10 * speed) * 0.2); - - if (model) { - mixer.update(delta * speed); - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_outline.ts b/examples-testing/examples/webgpu_postprocessing_outline.ts deleted file mode 100644 index f87415b74..000000000 --- a/examples-testing/examples/webgpu_postprocessing_outline.ts +++ /dev/null @@ -1,232 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, uniform, time, oscSine } from 'three/tsl'; -import { outline } from 'three/addons/tsl/display/OutlineNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; - -let camera, scene, renderer, controls; -let renderPipeline, outlinePass; - -let selectedObjects = []; - -const raycaster = new THREE.Raycaster(); -const mouse = new THREE.Vector2(); - -const obj3d = new THREE.Object3D(); -const group = new THREE.Group(); - -init(); - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(width, height); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 100); - camera.position.set(0, 0, 8); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 5; - controls.maxDistance = 20; - controls.enablePan = false; - controls.enableDamping = true; - controls.dampingFactor = 0.05; - - // - - scene.add(new THREE.AmbientLight(0xaaaaaa, 0.6)); - - const light = new THREE.DirectionalLight(0xddffdd, 2); - light.position.set(5, 5, 5); - light.castShadow = true; - light.shadow.mapSize.width = 2048; - light.shadow.mapSize.height = 2048; - - const d = 10; - - light.shadow.camera.left = -d; - light.shadow.camera.right = d; - light.shadow.camera.top = d; - light.shadow.camera.bottom = -d; - light.shadow.camera.far = 25; - - scene.add(light); - - // model - - const loader = new OBJLoader(); - loader.load('models/obj/tree.obj', function (object) { - let scale = 1.0; - - object.traverse(function (child) { - if (child instanceof THREE.Mesh) { - child.geometry.center(); - child.geometry.computeBoundingSphere(); - scale = 0.2 * child.geometry.boundingSphere.radius; - - const phongMaterial = new THREE.MeshPhongMaterial({ - color: 0xffffff, - specular: 0x111111, - shininess: 5, - }); - child.material = phongMaterial; - child.receiveShadow = true; - child.castShadow = true; - } - }); - - object.position.y = 1; - object.scale.divideScalar(scale); - obj3d.add(object); - }); - - scene.add(group); - - group.add(obj3d); - - // - - const geometry = new THREE.SphereGeometry(3, 48, 24); - - for (let i = 0; i < 20; i++) { - const material = new THREE.MeshLambertMaterial(); - material.color.setHSL(Math.random(), 1.0, 0.3); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.x = Math.random() * 4 - 2; - mesh.position.y = Math.random() * 4 - 2; - mesh.position.z = Math.random() * 4 - 2; - mesh.receiveShadow = true; - mesh.castShadow = true; - mesh.scale.multiplyScalar(Math.random() * 0.3 + 0.1); - group.add(mesh); - } - - const floorMaterial = new THREE.MeshLambertMaterial({ side: THREE.DoubleSide }); - - const floorGeometry = new THREE.PlaneGeometry(12, 12); - const floorMesh = new THREE.Mesh(floorGeometry, floorMaterial); - floorMesh.rotation.x -= Math.PI * 0.5; - floorMesh.position.y -= 1.5; - group.add(floorMesh); - floorMesh.receiveShadow = true; - - const torusGeometry = new THREE.TorusGeometry(1, 0.3, 16, 100); - const torusMaterial = new THREE.MeshPhongMaterial({ color: 0xffaaff }); - const torus = new THREE.Mesh(torusGeometry, torusMaterial); - torus.position.z = -4; - group.add(torus); - torus.receiveShadow = true; - torus.castShadow = true; - - // outline pass - - const edgeStrength = uniform(3.0); - const edgeGlow = uniform(0.0); - const edgeThickness = uniform(1.0); - const pulsePeriod = uniform(0); - const visibleEdgeColor = uniform(new THREE.Color(0xffffff)); - const hiddenEdgeColor = uniform(new THREE.Color(0x4e3636)); - - outlinePass = outline(scene, camera, { - selectedObjects, - edgeGlow, - edgeThickness, - }); - - const { visibleEdge, hiddenEdge } = outlinePass; - - const period = time.div(pulsePeriod).mul(2); - const osc = oscSine(period).mul(0.5).add(0.5); // osc [ 0.5, 1.0 ] - - const outlineColor = visibleEdge.mul(visibleEdgeColor).add(hiddenEdge.mul(hiddenEdgeColor)).mul(edgeStrength); - const outlinePulse = pulsePeriod.greaterThan(0).select(outlineColor.mul(osc), outlineColor); - - // postprocessing - - const scenePass = pass(scene, camera).toInspector('Color'); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = outlinePulse.add(scenePass); - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(edgeStrength, 'value', 0.01, 10).name('edgeStrength'); - gui.add(edgeGlow, 'value', 0.0, 1).name('edgeGlow'); - gui.add(edgeThickness, 'value', 1, 4).name('edgeThickness'); - gui.add(pulsePeriod, 'value', 0.0, 5).name('pulsePeriod'); - gui.addColor({ color: visibleEdgeColor.value.getHex(THREE.SRGBColorSpace) }, 'color') - .onChange(value => { - visibleEdgeColor.value.set(value); - }) - .name('visibleEdgeColor'); - gui.addColor({ color: hiddenEdgeColor.value.getHex(THREE.SRGBColorSpace) }, 'color') - .onChange(value => { - hiddenEdgeColor.value.set(value); - }) - .name('hiddenEdgeColor'); - - // - - window.addEventListener('resize', onWindowResize); - - renderer.domElement.style.touchAction = 'none'; - renderer.domElement.addEventListener('pointermove', onPointerMove); - - function onPointerMove(event) { - if (event.isPrimary === false) return; - - mouse.x = (event.clientX / window.innerWidth) * 2 - 1; - mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; - - checkIntersection(); - } - - function addSelectedObject(object) { - selectedObjects = []; - selectedObjects.push(object); - } - - function checkIntersection() { - raycaster.setFromCamera(mouse, camera); - - const intersects = raycaster.intersectObject(scene, true); - - if (intersects.length > 0) { - const selectedObject = intersects[0].object; - addSelectedObject(selectedObject); - outlinePass.selectedObjects = selectedObjects; - } else { - // outlinePass.selectedObjects = []; - } - } -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_pixel.ts b/examples-testing/examples/webgpu_postprocessing_pixel.ts deleted file mode 100644 index a3d58f203..000000000 --- a/examples-testing/examples/webgpu_postprocessing_pixel.ts +++ /dev/null @@ -1,237 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { uniform } from 'three/tsl'; -import { pixelationPass } from 'three/addons/tsl/display/PixelationPassNode.js'; - -let camera, scene, renderer, renderPipeline, crystalMesh, timer; -let effectController; - -init(); - -function init() { - const aspectRatio = window.innerWidth / window.innerHeight; - - camera = new THREE.OrthographicCamera(-aspectRatio, aspectRatio, 1, -1, 0.1, 10); - camera.position.y = 2 * Math.tan(Math.PI / 6); - camera.position.z = 2; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x151729); - - timer = new THREE.Timer(); - timer.connect(document); - - // textures - - const loader = new THREE.TextureLoader(); - const texChecker = pixelTexture(loader.load('textures/checker.png')); - const texChecker2 = pixelTexture(loader.load('textures/checker.png')); - texChecker.repeat.set(3, 3); - texChecker2.repeat.set(1.5, 1.5); - - // meshes - - const boxMaterial = new THREE.MeshPhongMaterial({ map: texChecker2 }); - - function addBox(boxSideLength, x, z, rotation) { - const mesh = new THREE.Mesh(new THREE.BoxGeometry(boxSideLength, boxSideLength, boxSideLength), boxMaterial); - mesh.castShadow = true; - mesh.receiveShadow = true; - mesh.rotation.y = rotation; - mesh.position.y = boxSideLength / 2; - mesh.position.set(x, boxSideLength / 2 + 0.0001, z); - scene.add(mesh); - return mesh; - } - - addBox(0.4, 0, 0, Math.PI / 4); - addBox(0.5, -0.5, -0.5, Math.PI / 4); - - const planeSideLength = 2; - const planeMesh = new THREE.Mesh( - new THREE.PlaneGeometry(planeSideLength, planeSideLength), - new THREE.MeshPhongMaterial({ map: texChecker }), - ); - planeMesh.receiveShadow = true; - planeMesh.rotation.x = -Math.PI / 2; - scene.add(planeMesh); - - const radius = 0.2; - const geometry = new THREE.IcosahedronGeometry(radius); - crystalMesh = new THREE.Mesh( - geometry, - new THREE.MeshPhongMaterial({ - color: 0x68b7e9, - emissive: 0x4f7e8b, - shininess: 10, - specular: 0xffffff, - }), - ); - crystalMesh.receiveShadow = true; - crystalMesh.castShadow = true; - scene.add(crystalMesh); - - // lights - - scene.add(new THREE.AmbientLight(0x757f8e, 3)); - - const directionalLight = new THREE.DirectionalLight(0xfffecd, 1.5); - directionalLight.position.set(100, 100, 100); - directionalLight.castShadow = true; - directionalLight.shadow.mapSize.set(2048, 2048); - scene.add(directionalLight); - - const spotLight = new THREE.SpotLight(0xffc100, 10, 10, Math.PI / 16, 0.02, 2); - spotLight.position.set(2, 2, 0); - const target = spotLight.target; - scene.add(target); - target.position.set(0, 0, 0); - spotLight.castShadow = true; - scene.add(spotLight); - - renderer = new THREE.WebGPURenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.BasicShadowMap; - document.body.appendChild(renderer.domElement); - - effectController = { - pixelSize: uniform(6), - normalEdgeStrength: uniform(0.3), - depthEdgeStrength: uniform(0.4), - pixelAlignedPanning: true, - }; - - renderPipeline = new THREE.RenderPipeline(renderer); - const scenePass = pixelationPass( - scene, - camera, - effectController.pixelSize, - effectController.normalEdgeStrength, - effectController.depthEdgeStrength, - ); - renderPipeline.outputNode = scenePass; - - window.addEventListener('resize', onWindowResize); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.maxZoom = 2; - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(effectController.pixelSize, 'value', 1, 16, 1).name('Pixel Size'); - gui.add(effectController.normalEdgeStrength, 'value', 0, 2, 0.05).name('Normal Edge Strength'); - gui.add(effectController.depthEdgeStrength, 'value', 0, 1, 0.05).name('Depth Edge Strength'); - gui.add(effectController, 'pixelAlignedPanning'); -} - -function onWindowResize() { - const aspectRatio = window.innerWidth / window.innerHeight; - camera.left = -aspectRatio; - camera.right = aspectRatio; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const t = timer.getElapsed(); - - crystalMesh.material.emissiveIntensity = Math.sin(t * 3) * 0.5 + 0.5; - crystalMesh.position.y = 0.7 + Math.sin(t * 2) * 0.05; - crystalMesh.rotation.y = stopGoEased(t, 2, 4) * 2 * Math.PI; - - const rendererSize = renderer.getSize(new THREE.Vector2()); - const aspectRatio = rendererSize.x / rendererSize.y; - - if (effectController.pixelAlignedPanning) { - const pixelSize = effectController.pixelSize.value; - - pixelAlignFrustum( - camera, - aspectRatio, - Math.floor(rendererSize.x / pixelSize), - Math.floor(rendererSize.y / pixelSize), - ); - } else if (camera.left != -aspectRatio || camera.top != 1.0) { - // Reset the Camera Frustum if it has been modified - camera.left = -aspectRatio; - camera.right = aspectRatio; - camera.top = 1.0; - camera.bottom = -1.0; - camera.updateProjectionMatrix(); - } - - renderPipeline.render(); -} - -// Helper functions - -function pixelTexture(texture) { - texture.minFilter = THREE.NearestFilter; - texture.magFilter = THREE.NearestFilter; - texture.generateMipmaps = false; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.colorSpace = THREE.SRGBColorSpace; - return texture; -} - -function easeInOutCubic(x) { - return x ** 2 * 3 - x ** 3 * 2; -} - -function linearStep(x, edge0, edge1) { - const w = edge1 - edge0; - const m = 1 / w; - const y0 = -m * edge0; - return THREE.MathUtils.clamp(y0 + m * x, 0, 1); -} - -function stopGoEased(x, downtime, period) { - const cycle = (x / period) | 0; - const tween = x - cycle * period; - const linStep = easeInOutCubic(linearStep(tween, downtime, period)); - return cycle + linStep; -} - -function pixelAlignFrustum(camera, aspectRatio, pixelsPerScreenWidth, pixelsPerScreenHeight) { - // 0. Get Pixel Grid Units - const worldScreenWidth = (camera.right - camera.left) / camera.zoom; - const worldScreenHeight = (camera.top - camera.bottom) / camera.zoom; - const pixelWidth = worldScreenWidth / pixelsPerScreenWidth; - const pixelHeight = worldScreenHeight / pixelsPerScreenHeight; - - // 1. Project the current camera position along its local rotation bases - const camPos = new THREE.Vector3(); - camera.getWorldPosition(camPos); - const camRot = new THREE.Quaternion(); - camera.getWorldQuaternion(camRot); - const camRight = new THREE.Vector3(1.0, 0.0, 0.0).applyQuaternion(camRot); - const camUp = new THREE.Vector3(0.0, 1.0, 0.0).applyQuaternion(camRot); - const camPosRight = camPos.dot(camRight); - const camPosUp = camPos.dot(camUp); - - // 2. Find how far along its position is along these bases in pixel units - const camPosRightPx = camPosRight / pixelWidth; - const camPosUpPx = camPosUp / pixelHeight; - - // 3. Find the fractional pixel units and convert to world units - const fractX = camPosRightPx - Math.round(camPosRightPx); - const fractY = camPosUpPx - Math.round(camPosUpPx); - - // 4. Add fractional world units to the left/right top/bottom to align with the pixel grid - camera.left = -aspectRatio - fractX * pixelWidth; - camera.right = aspectRatio - fractX * pixelWidth; - camera.top = 1.0 - fractY * pixelHeight; - camera.bottom = -1.0 - fractY * pixelHeight; - camera.updateProjectionMatrix(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_radial_blur.ts b/examples-testing/examples/webgpu_postprocessing_radial_blur.ts deleted file mode 100644 index f358421e3..000000000 --- a/examples-testing/examples/webgpu_postprocessing_radial_blur.ts +++ /dev/null @@ -1,149 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { float, int, pass, uniform } from 'three/tsl'; -import { radialBlur } from 'three/addons/tsl/display/radialBlur.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const params = { - enabled: true, - animated: true, -}; - -let camera, scene, renderer, timer, group; -let renderPipeline; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); - camera.position.z = 50; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - timer = new THREE.Timer(); - - // - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d); - hemiLight.position.set(0, 1000, 0); - scene.add(hemiLight); - - const pointLight = new THREE.PointLight(0xffffff, 1000); - pointLight.position.set(0, 0, 0); - scene.add(pointLight); - - // - - group = new THREE.Group(); - - const geometry = new THREE.TetrahedronGeometry(); - const material = new THREE.MeshStandardMaterial({ flatShading: true }); - - const mesh = new THREE.InstancedMesh(geometry, material, 100); - const dummy = new THREE.Object3D(); - const col = new THREE.Color(); - const center = new THREE.Vector2(); - - for (let i = 0; i < mesh.count; i++) { - dummy.position.x = Math.random() * 50 - 25; - dummy.position.y = Math.random() * 50 - 25; - dummy.position.z = Math.random() * 50 - 25; - - center.set(dummy.position.x, dummy.position.y); - - // make sure tetrahedrons are not positioned at the origin - - if (center.length() < 6) { - center.normalize().multiplyScalar(6); - dummy.position.x = center.x; - dummy.position.y = center.y; - } - - dummy.scale.setScalar(Math.random() * 2 + 1); - - dummy.rotation.x = Math.random() * Math.PI; - dummy.rotation.y = Math.random() * Math.PI; - dummy.rotation.z = Math.random() * Math.PI; - - dummy.updateMatrix(); - mesh.setMatrixAt(i, dummy.matrix); - - col.setHSL(0.55 + (i / mesh.count) * 0.15, 1, 0.2); - - mesh.setColorAt(i, col); - } - - group.add(mesh); - scene.add(group); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.toneMapping = THREE.NeutralToneMapping; - document.body.appendChild(renderer.domElement); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - - const weightUniform = uniform(float(0.9)); - const decayUniform = uniform(float(0.95)); - const exposureUniform = uniform(int(5)); - const countUniform = uniform(int(32)); - - const blurPass = radialBlur(scenePass, { - weight: weightUniform, - decay: decayUniform, - count: countUniform, - exposure: exposureUniform, - }); - - renderPipeline.outputNode = blurPass; - - // - - window.addEventListener('resize', onWindowResize); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(weightUniform, 'value', 0, 1).name('weight'); - gui.add(decayUniform, 'value', 0, 1).name('decay'); - gui.add(countUniform, 'value', 16, 64, 1).name('sample count'); - gui.add(exposureUniform, 'value', 1, 10).name('exposure'); - gui.add(params, 'enabled').onChange(value => { - if (value === true) { - renderPipeline.outputNode = blurPass; - } else { - renderPipeline.outputNode = scenePass; - } - - renderPipeline.needsUpdate = true; - }); - gui.add(params, 'animated'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - const delta = timer.getDelta(); - - if (params.animated === true) { - group.rotation.y += delta * 0.1; - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_retro.ts b/examples-testing/examples/webgpu_postprocessing_retro.ts deleted file mode 100644 index b9958352f..000000000 --- a/examples-testing/examples/webgpu_postprocessing_retro.ts +++ /dev/null @@ -1,370 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - pass, - mix, - mul, - oneMinus, - positionLocal, - smoothstep, - texture, - time, - rotateUV, - Fn, - uv, - vec2, - vec3, - vec4, - uniform, - posterize, - floor, - float, - sin, - fract, - dot, - step, - color, - normalWorld, - length, - atan, - replaceDefaultUV, - screenSize, -} from 'three/tsl'; -import { retroPass } from 'three/addons/tsl/display/RetroPassNode.js'; -import { bayerDither } from 'three/addons/tsl/math/Bayer.js'; -import { scanlines, vignette, colorBleeding, barrelUV } from 'three/addons/tsl/display/CRT.js'; -import { circle } from 'three/addons/tsl/display/Shape.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline, controls; -let environment; -let currentModel; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(8, 5, 20); - - scene = new THREE.Scene(); - - // PS1-style background: gradient sky with simple stars - - const ps1Background = Fn(() => { - // Flip Y coordinate for correct orientation - const flippedY = normalWorld.y.negate(); - const skyUV = flippedY.mul(0.5).add(0.5); - - // Simple gradient sky (dark blue at top to purple/orange at horizon) - const topColor = color(0x000033); // dark blue night sky - const midColor = color(0x330066); // purple - const horizonColor = color(0x663322); // warm orange/brown horizon - - // Two-step gradient (inverted - top is dark, horizon is warm) - const skyGradient = mix( - horizonColor, - mix(midColor, topColor, skyUV.smoothstep(0.4, 0.9)), - skyUV.smoothstep(0.0, 0.4), - ); - - // PS1-style "stars" using spherical coordinates - const longitude = atan(normalWorld.x, normalWorld.z); - const latitude = flippedY.asin(); // Use flipped Y for latitude too - - // More stars with smaller scale - const starScale = float(50.0); - const starUV = vec2(longitude.mul(starScale), latitude.mul(starScale)); - const starCell = floor(starUV); - - // Hash for randomness - const cellHash = fract(sin(dot(starCell, vec2(12.9898, 78.233))).mul(43758.5453)); - - // Position within cell (0-1) - const cellUV = fract(starUV); - const toCenter = cellUV.sub(0.5); - - // Gemini-style star: bright center with soft glow + cross flare - const distToCenter = length(toCenter); - - // Core (small bright center) - const core = smoothstep(float(0.08), float(0.0), distToCenter); - - // Soft glow around - const glow = smoothstep(float(0.25), float(0.0), distToCenter).mul(0.4); - - // Cross/diamond flare effect - const crossX = smoothstep(float(0.15), float(0.0), toCenter.x.abs()).mul( - smoothstep(float(0.4), float(0.0), toCenter.y.abs()), - ); - const crossY = smoothstep(float(0.15), float(0.0), toCenter.y.abs()).mul( - smoothstep(float(0.4), float(0.0), toCenter.x.abs()), - ); - const cross = crossX.add(crossY).mul(0.3); - - // Combine star shape - const starShape = core.add(glow).add(cross); - - // More stars (lower threshold = more stars) - const isStar = step(0.85, cellHash); - - // Show stars from horizon up - const aboveHorizon = smoothstep(float(-0.2), float(0.1), flippedY); - - // Star brightness varies + twinkle color - const starIntensity = isStar.mul(aboveHorizon).mul(starShape).mul(cellHash.mul(0.6).add(0.4)); - - // Slight color variation (white to light blue) - const starColor = mix(vec3(1.0, 1.0, 0.95), vec3(0.8, 0.9, 1.0), cellHash); - - // Combine sky and stars - const finalColor = mix(skyGradient, starColor, starIntensity.clamp(0.0, 1.0)); - - return finalColor; - })(); - - scene.backgroundNode = ps1Background; - - // Loaders - - const gltfLoader = new GLTFLoader(); - const textureLoader = new THREE.TextureLoader(); - - // Model - - const models = { - 'Coffee Mug': 'models/gltf/coffeeMug.glb', - 'Damaged Helmet': 'models/gltf/DamagedHelmet/glTF/DamagedHelmet.gltf', - }; - - function loadModel(name) { - function loadEnvironment() { - if (environment) return; - - environment = new HDRLoader().setPath('textures/equirectangular/').load('venice_sunset_1k.hdr', texture => { - texture.mapping = THREE.EquirectangularReflectionMapping; - scene.environment = texture; - - // re-invalidate retro pass textures - - retro.dispose(); - }); - } - - if (currentModel) { - scene.remove(currentModel); - currentModel.traverse(child => { - if (child.isMesh) { - child.geometry.dispose(); - child.material.dispose(); - } - }); - } - - gltfLoader.load(models[name], gltf => { - currentModel = gltf.scene; - currentModel.position.set(0, 0, 0); - - smoke.visible = false; - - if (name === 'Damaged Helmet') { - loadEnvironment(); - - currentModel.scale.setScalar(3); - currentModel.position.y = 1; - } else if (name === 'Coffee Mug') { - smoke.visible = true; - } - - scene.add(currentModel); - }); - } - - loadModel('Coffee Mug'); - - // lighting - - const ambientLight = new THREE.AmbientLight(0x404040, 2); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight(0xffffff, 3); - directionalLight.position.set(5, 10, 5); - scene.add(directionalLight); - - const pointLight = new THREE.PointLight(0xff6600, 5, 20); - pointLight.position.set(-3, 3, 2); - scene.add(pointLight); - - // geometry - - const smokeGeometry = new THREE.PlaneGeometry(1, 1, 16, 64); - smokeGeometry.translate(0, 0.5, 0); - smokeGeometry.scale(1.5, 6, 1.5); - - // texture - - const noiseTexture = textureLoader.load('./textures/noises/perlin/128x128.png'); - noiseTexture.wrapS = THREE.RepeatWrapping; - noiseTexture.wrapT = THREE.RepeatWrapping; - - // material - - const smokeMaterial = new THREE.MeshBasicNodeMaterial({ - transparent: true, - side: THREE.DoubleSide, - depthWrite: false, - }); - - // position - - smokeMaterial.positionNode = Fn(() => { - // twist - - const twistNoiseUv = vec2(0.5, uv().y.mul(0.2).sub(time.mul(0.005)).mod(1)); - const twist = texture(noiseTexture, twistNoiseUv).r.mul(10); - positionLocal.xz.assign(rotateUV(positionLocal.xz, twist, vec2(0))); - - // wind - - const windOffset = vec2( - texture(noiseTexture, vec2(0.25, time.mul(0.01)).mod(1)).r.sub(0.5), - texture(noiseTexture, vec2(0.75, time.mul(0.01)).mod(1)).r.sub(0.5), - ).mul(uv().y.pow(2).mul(10)); - positionLocal.addAssign(windOffset); - - return positionLocal; - })(); - - // color - - smokeMaterial.colorNode = Fn(() => { - // alpha - - const alphaNoiseUv = uv() - .mul(vec2(0.5, 0.3)) - .add(vec2(0, time.mul(0.03).negate())); - const alpha = mul( - // pattern - texture(noiseTexture, alphaNoiseUv).r.smoothstep(0.4, 1), - - // edges fade - smoothstep(0, 0.1, uv().x), - smoothstep(0, 0.1, oneMinus(uv().x)), - smoothstep(0, 0.1, uv().y), - smoothstep(0, 0.1, oneMinus(uv().y)), - ); - - // color - - const finalColor = mix(vec3(0.6, 0.3, 0.2), vec3(1, 1, 1), alpha.pow(3)); - - return vec4(finalColor, alpha); - })(); - - // mesh - - const smoke = new THREE.Mesh(smokeGeometry, smokeMaterial); - smoke.position.y = 1.83; - scene.add(smoke); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // uniforms - - // PS1-style: 15-bit color (32 levels per channel) - const colorDepthSteps = uniform(32); - - // CRT effect parameters (subtle for PS1 look) - const scanlineIntensity = uniform(0.3); // subtle scanlines - const scanlineDensity = uniform(1); // 0.1-1: normalized scanline density (1 = full screen resolution) - const scanlineSpeed = uniform(0.0); // no scanline movement - const vignetteIntensity = uniform(0.3); // subtle vignette - const bleeding = uniform(0.001); // minimal bleeding - const curvature = uniform(0.02); // subtle curve - const affineDistortion = uniform(0); // no affine distortion - - // render pipeline - - renderPipeline = new THREE.RenderPipeline(renderer); - - // retro pipeline - - const distortedUV = barrelUV(curvature); - const distortedDelta = circle(curvature.add(0.1).mul(10), 1).mul(curvature).mul(0.05); - - const retro = retroPass(scene, camera, { affineDistortion }); - - let retroPipeline = retro; - retroPipeline = replaceDefaultUV(distortedUV, retroPipeline); - retroPipeline = colorBleeding(retroPipeline, bleeding.add(distortedDelta)); - retroPipeline = bayerDither(retroPipeline, colorDepthSteps); - retroPipeline = posterize(retroPipeline, colorDepthSteps); - retroPipeline = vignette(retroPipeline, vignetteIntensity, 0.6); - retroPipeline = scanlines(retroPipeline, scanlineIntensity, screenSize.y.mul(scanlineDensity), scanlineSpeed); - - renderPipeline.outputNode = retroPipeline; - - // default pass (no post-processing) - - const defaultPass = pass(scene, camera); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - controls.target.y = 1; - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add({ model: 'Coffee Mug' }, 'model', Object.keys(models)).name('Model').onChange(loadModel); - - gui.add({ enabled: true }, 'enabled') - .onChange(v => { - renderPipeline.outputNode = v ? retroPipeline : defaultPass; - renderPipeline.needsUpdate = true; - }) - .name('Retro Pipeline'); - - gui.add(curvature, 'value', 0, 0.2, 0.01).name('Curvature'); - gui.add(colorDepthSteps, 'value', 4, 32, 1).name('Color Depth'); - gui.add(scanlineIntensity, 'value', 0, 1, 0.01).name('Scanlines'); - gui.add(scanlineDensity, 'value', 0.02, 1, 0.01).name('Scanline Density'); - gui.add(scanlineSpeed, 'value', 0, 0.1, 0.01).name('Scanline Speed'); - gui.add(vignetteIntensity, 'value', 0, 1, 0.01).name('Vignette'); - gui.add(bleeding, 'value', 0, 0.005, 0.001).name('Color Bleeding'); - gui.add(affineDistortion, 'value', 0, 1).name('Affine Distortion'); - gui.add(retro, 'filterTextures') - .name('Filter Textures') - .onChange(() => { - retro.dispose(); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_smaa.ts b/examples-testing/examples/webgpu_postprocessing_smaa.ts deleted file mode 100644 index f06374258..000000000 --- a/examples-testing/examples/webgpu_postprocessing_smaa.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; -import { smaa } from 'three/addons/tsl/display/SMAANode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline; - -const params = { - enabled: true, - autoRotate: true, -}; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.z = 300; - - scene = new THREE.Scene(); - - const geometry = new THREE.BoxGeometry(120, 120, 120); - const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.position.x = -100; - scene.add(mesh1); - - const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); - texture.colorSpace = THREE.SRGBColorSpace; - - const material2 = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.position.x = 100; - scene.add(mesh2); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera).toInspector('Color'); - const smaaPass = smaa(scenePass); - - renderPipeline.outputNode = smaaPass; - - // - - window.addEventListener('resize', onWindowResize); - - const gui = renderer.inspector.createParameters('Settings'); - - const smaaFolder = gui.addFolder('SMAA'); - smaaFolder.add(params, 'enabled').onChange(value => { - if (value === true) { - renderPipeline.outputNode = smaaPass; - } else { - renderPipeline.outputNode = scenePass; - } - - renderPipeline.needsUpdate = true; - }); - - const sceneFolder = gui.addFolder('Scene'); - sceneFolder.add(params, 'autoRotate'); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - if (params.autoRotate === true) { - for (let i = 0; i < scene.children.length; i++) { - const child = scene.children[i]; - - child.rotation.x += 0.005; - child.rotation.y += 0.01; - } - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_sobel.ts b/examples-testing/examples/webgpu_postprocessing_sobel.ts deleted file mode 100644 index 52cbe53a4..000000000 --- a/examples-testing/examples/webgpu_postprocessing_sobel.ts +++ /dev/null @@ -1,95 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, renderOutput } from 'three/tsl'; -import { sobel } from 'three/addons/tsl/display/SobelOperatorNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls; -let renderPipeline; - -const params = { - enabled: true, -}; - -init(); - -async function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 1, 3); - - // - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/DragonAttenuation.glb'); - const model = gltf.scene.children[1]; - model.material = new THREE.MeshStandardNodeMaterial(); - - scene.add(model); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.toneMapping = THREE.LinearToneMapping; - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - pmremGenerator.dispose(); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.enableZoom = false; - controls.target.set(0, 0.5, 0); - controls.update(); - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = false; - - const scenePass = pass(scene, camera); - - renderPipeline.outputNode = sobel(renderOutput(scenePass)); - - // - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'enabled'); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - if (params.enabled === true) { - renderPipeline.render(); - } else { - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgpu_postprocessing_ssaa.ts b/examples-testing/examples/webgpu_postprocessing_ssaa.ts deleted file mode 100644 index 2c60c4842..000000000 --- a/examples-testing/examples/webgpu_postprocessing_ssaa.ts +++ /dev/null @@ -1,169 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let scene, mesh, renderer, renderPipeline; -let camera, ssaaRenderPass; -let timer; - -const params = { - sampleLevel: 3, - camera: 'perspective', - clearColor: 'black', - clearAlpha: 1.0, - viewOffsetX: 0, - autoRotate: true, -}; - -init(); - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - timer = new THREE.Timer(); - timer.connect(document); - - camera = new THREE.PerspectiveCamera(65, width / height, 3, 10); - camera.position.z = 7; - camera.setViewOffset(width, height, params.viewOffsetX, 0, width, height); - - scene = new THREE.Scene(); - - const group = new THREE.Group(); - scene.add(group); - - const light = new THREE.PointLight(0xefffef, 500); - light.position.z = 10; - light.position.y = -10; - light.position.x = -10; - scene.add(light); - - const light2 = new THREE.PointLight(0xffefef, 500); - light2.position.z = 10; - light2.position.x = -10; - light2.position.y = 10; - scene.add(light2); - - const light3 = new THREE.PointLight(0xefefff, 500); - light3.position.z = 10; - light3.position.x = 10; - light3.position.y = -10; - scene.add(light3); - - const light4 = new THREE.AmbientLight(0xffffff, 0.2); - scene.add(light4); - - const geometry = new THREE.SphereGeometry(3, 48, 24); - const material = new THREE.MeshStandardMaterial(); - - mesh = new THREE.InstancedMesh(geometry, material, 120); - - const dummy = new THREE.Mesh(); - const color = new THREE.Color(); - - for (let i = 0; i < mesh.count; i++) { - dummy.position.x = Math.random() * 4 - 2; - dummy.position.y = Math.random() * 4 - 2; - dummy.position.z = Math.random() * 4 - 2; - dummy.rotation.x = Math.random(); - dummy.rotation.y = Math.random(); - dummy.rotation.z = Math.random(); - dummy.scale.setScalar(Math.random() * 0.2 + 0.05); - - dummy.updateMatrix(); - - color.setHSL(Math.random(), 1.0, 0.3); - - mesh.setMatrixAt(i, dummy.matrix); - mesh.setColorAt(i, color); - } - - scene.add(mesh); - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - - ssaaRenderPass = ssaaPass(scene, camera); - const scenePassColor = ssaaRenderPass.getTextureNode(); - - renderPipeline.outputNode = scenePassColor; - - window.addEventListener('resize', onWindowResize); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(params, 'sampleLevel', { - 'Level 0: 1 Sample': 0, - 'Level 1: 2 Samples': 1, - 'Level 2: 4 Samples': 2, - 'Level 3: 8 Samples': 3, - 'Level 4: 16 Samples': 4, - 'Level 5: 32 Samples': 5, - }); - gui.add(params, 'clearColor', ['black', 'white', 'blue', 'green', 'red']); - gui.add(params, 'clearAlpha', 0, 1); - gui.add(params, 'viewOffsetX', -100, 100); - gui.add(params, 'autoRotate'); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.setViewOffset(width, height, params.viewOffsetX, 0, width, height); - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - timer.update(); - - if (params.autoRotate) { - const delta = timer.getDelta(); - - mesh.rotation.x += delta * 0.25; - mesh.rotation.y += delta * 0.5; - } - - let newColor; - - switch (params.clearColor) { - case 'blue': - newColor = 0x0000ff; - break; - case 'red': - newColor = 0xff0000; - break; - case 'green': - newColor = 0x00ff00; - break; - case 'white': - newColor = 0xffffff; - break; - case 'black': - newColor = 0x000000; - break; - } - - renderer.setClearColor(newColor, params.clearAlpha); - - ssaaRenderPass.sampleLevel = params.sampleLevel; - - camera.view.offsetX = params.viewOffsetX; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_ssgi.ts b/examples-testing/examples/webgpu_postprocessing_ssgi.ts deleted file mode 100644 index cdb24ae66..000000000 --- a/examples-testing/examples/webgpu_postprocessing_ssgi.ts +++ /dev/null @@ -1,244 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - pass, - mrt, - output, - normalView, - diffuseColor, - velocity, - add, - vec3, - vec4, - packNormalToRGB, - unpackRGBToNormal, - sample, -} from 'three/tsl'; -import { ssgi } from 'three/addons/tsl/display/SSGINode.js'; -import { traa } from 'three/addons/tsl/display/TRAANode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline, controls; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(40, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 10, 30); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xaaaaaa); - - renderer = new THREE.WebGPURenderer(); - //renderer.setPixelRatio( window.devicePixelRatio ); // probably too costly for most hardware - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 7, 0); - controls.enablePan = true; - controls.minDistance = 1; - controls.maxDistance = 100; - controls.update(); - - // - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - scenePass.setMRT( - mrt({ - output: output, - diffuseColor: diffuseColor, - normal: packNormalToRGB(normalView), - velocity: velocity, - }), - ); - - const scenePassColor = scenePass.getTextureNode('output'); - const scenePassDiffuse = scenePass.getTextureNode('diffuseColor').toInspector('Diffuse Color'); - const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { - return scenePass.getLinearDepthNode(); - }); - - const scenePassNormal = scenePass.getTextureNode('normal').toInspector('Normal'); - const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); - - // bandwidth optimization - - const diffuseTexture = scenePass.getTexture('diffuseColor'); - diffuseTexture.type = THREE.UnsignedByteType; - - const normalTexture = scenePass.getTexture('normal'); - normalTexture.type = THREE.UnsignedByteType; - - const sceneNormal = sample(uv => { - return unpackRGBToNormal(scenePassNormal.sample(uv)); - }); - - // gi - - const giPass = ssgi(scenePassColor, scenePassDepth, sceneNormal, camera); - giPass.sliceCount.value = 2; - giPass.stepCount.value = 8; - - // composite - - const ao = giPass.getAONode().toInspector('SSGI.AO'); - const gi = giPass.getGINode().toInspector('SSGI.GI'); - - const compositePass = vec4(add(scenePassColor.rgb.mul(ao), scenePassDiffuse.rgb.mul(gi.rgb)), scenePassColor.a); - compositePass.name = 'Composite'; - - // traa - - const traaPass = traa(compositePass, scenePassDepth, scenePassVelocity, camera); - renderPipeline.outputNode = traaPass; - - // Cornell Box inspired scene - - // Walls - const wallGeometry = new THREE.PlaneGeometry(1, 1); - - // Left wall - red - const redWallMaterial = new THREE.MeshPhysicalMaterial({ color: '#ff0000' }); - const leftWall = new THREE.Mesh(wallGeometry, redWallMaterial); - leftWall.scale.set(20, 15, 1); - leftWall.rotation.y = Math.PI * 0.5; - leftWall.position.set(-10, 7.5, 0); - leftWall.receiveShadow = true; - scene.add(leftWall); - - // Right wall - green - const greenWallMaterial = new THREE.MeshPhysicalMaterial({ color: '#00ff00' }); - const rightWall = new THREE.Mesh(wallGeometry, greenWallMaterial); - rightWall.scale.set(20, 15, 1); - rightWall.rotation.y = Math.PI * -0.5; - rightWall.position.set(10, 7.5, 0); - rightWall.receiveShadow = true; - scene.add(rightWall); - - // White walls and boxes - const whiteMaterial = new THREE.MeshPhysicalMaterial({ color: '#fff' }); - - // Floor - const floor = new THREE.Mesh(wallGeometry, whiteMaterial); - floor.scale.set(20, 20, 1); - floor.rotation.x = Math.PI * -0.5; - floor.receiveShadow = true; - scene.add(floor); - - // Back wall - const backWall = new THREE.Mesh(wallGeometry, whiteMaterial); - backWall.scale.set(15, 20, 1); - backWall.rotation.z = Math.PI * -0.5; - backWall.position.set(0, 7.5, -10); - backWall.receiveShadow = true; - scene.add(backWall); - - // Ceiling - const ceiling = new THREE.Mesh(wallGeometry, whiteMaterial); - ceiling.scale.set(20, 20, 1); - ceiling.rotation.x = Math.PI * 0.5; - ceiling.position.set(0, 15, 0); - ceiling.receiveShadow = true; - scene.add(ceiling); - - // Boxes - const tallBoxGeometry = new THREE.BoxGeometry(5, 7, 5); - const tallBox = new THREE.Mesh(tallBoxGeometry, whiteMaterial); - tallBox.rotation.y = Math.PI * 0.25; - tallBox.position.set(-3, 3.5, -2); - tallBox.castShadow = true; - tallBox.receiveShadow = true; - scene.add(tallBox); - - const shortBoxGeometry = new THREE.BoxGeometry(4, 4, 4); - const shortBox = new THREE.Mesh(shortBoxGeometry, whiteMaterial); - shortBox.rotation.y = Math.PI * -0.1; - shortBox.position.set(4, 2, 4); - shortBox.castShadow = true; - shortBox.receiveShadow = true; - scene.add(shortBox); - - // Light source geometry - const lightSourceGeometry = new THREE.CylinderGeometry(2.5, 2.5, 1, 64); - const lightSourceMaterial = new THREE.MeshBasicMaterial(); - const lightSource = new THREE.Mesh(lightSourceGeometry, lightSourceMaterial); - lightSource.position.y = 15; - scene.add(lightSource); - - // Point light - const pointLight = new THREE.PointLight('#ffffff', 100); - pointLight.position.set(0, 13, 0); - pointLight.distance = 100; - pointLight.castShadow = true; - pointLight.shadow.mapSize.width = 1024; - pointLight.shadow.mapSize.height = 1024; - scene.add(pointLight); - - // Ambient light - const ambientLight = new THREE.AmbientLight('#0c0c0c'); - scene.add(ambientLight); - - window.addEventListener('resize', onWindowResize); - - // - - const params = { - output: 0, - }; - - const types = { Combined: 0, Direct: 3, AO: 1, GI: 2 }; - - const gui = renderer.inspector.createParameters('SSGI settings'); - gui.add(params, 'output', types).onChange(updatePostprocessing); - gui.add(giPass.sliceCount, 'value', 1, 4, 1).name('slice count'); - gui.add(giPass.stepCount, 'value', 1, 32, 1).name('step count'); - gui.add(giPass.radius, 'value', 1, 25).name('radius'); - gui.add(giPass.expFactor, 'value', 1, 3).name('exp factor'); - gui.add(giPass.thickness, 'value', 0.01, 10).name('thickness'); - gui.add(giPass.backfaceLighting, 'value', 0, 1).name('backface lighting'); - gui.add(giPass.aoIntensity, 'value', 0, 4).name('AO intensity'); - gui.add(giPass.giIntensity, 'value', 0, 100).name('GI intensity'); - gui.add(giPass.useLinearThickness, 'value').name('use linear thickness'); - gui.add(giPass.useScreenSpaceSampling, 'value').name('screen-space sampling'); - gui.add(giPass, 'useTemporalFiltering').name('temporal filtering').onChange(updatePostprocessing); - - function updatePostprocessing(value) { - if (value === 1) { - renderPipeline.outputNode = vec4(vec3(ao), 1); - } else if (value === 2) { - renderPipeline.outputNode = vec4(gi, 1); - } else if (value === 3) { - renderPipeline.outputNode = scenePassColor; - } else { - renderPipeline.outputNode = giPass.useTemporalFiltering ? traaPass : compositePass; - } - - renderPipeline.needsUpdate = true; - } -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts b/examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts deleted file mode 100644 index 9670ab3d3..000000000 --- a/examples-testing/examples/webgpu_postprocessing_ssgi_ballpool.ts +++ /dev/null @@ -1,416 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - pass, - mrt, - output, - normalView, - diffuseColor, - velocity, - add, - vec4, - packNormalToRGB, - unpackRGBToNormal, - sample, -} from 'three/tsl'; -import { ssgi } from 'three/addons/tsl/display/SSGINode.js'; -import { traa } from 'three/addons/tsl/display/TRAANode.js'; -import { World } from '@perplexdotgg/bounce'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const BALL_RADIUS = 0.4; -const FILL_RATIO = 0.4; -const PACKING = 0.6; -const BOX_HEIGHT = 6; -const BOX_DEPTH = 8; -const WALL_THICKNESS = 0.5; -const CAM_FOV = 45; -const EASE_SPEED = 8; - -let camera, scene, renderer, renderPipeline; -let raycaster, pointer; -let mouseLight; - -let world; -let ballCount = 0; -let bodies = []; -let ballsMesh = null; -let wallMeshes = []; -const boxSize = { w: 8, h: BOX_HEIGHT, d: BOX_DEPTH }; - -const mouseRayOrigin = new THREE.Vector3(); -const mouseRayDir = new THREE.Vector3(); -let mouseMoving = false; -let mouseStopTimer = 0; -let pointerDown = false; -const activePointers = new Set(); -const mouseLightTarget = new THREE.Vector3(0, BOX_HEIGHT / 2, BOX_DEPTH / 2); -const mouseRayOriginTarget = new THREE.Vector3(); -const mouseRayDirTarget = new THREE.Vector3(); - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(CAM_FOV, window.innerWidth / window.innerHeight, 0.1, 100); - - scene = new THREE.Scene(); - - renderer = new THREE.WebGPURenderer({ antialias: false }); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.5; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - scenePass.setMRT( - mrt({ - output: output, - diffuseColor: diffuseColor, - normal: packNormalToRGB(normalView), - velocity: velocity, - }), - ); - - const scenePassColor = scenePass.getTextureNode('output'); - const scenePassDiffuse = scenePass.getTextureNode('diffuseColor'); - const scenePassDepth = scenePass.getTextureNode('depth'); - const scenePassNormal = scenePass.getTextureNode('normal'); - const scenePassVelocity = scenePass.getTextureNode('velocity'); - - // bandwidth optimization - - const diffuseTexture = scenePass.getTexture('diffuseColor'); - diffuseTexture.type = THREE.UnsignedByteType; - - const normalTexture = scenePass.getTexture('normal'); - normalTexture.type = THREE.UnsignedByteType; - - const sceneNormal = sample(uv => { - return unpackRGBToNormal(scenePassNormal.sample(uv)); - }); - - // gi - - const giPass = ssgi(scenePassColor, scenePassDepth, sceneNormal, camera); - giPass.sliceCount.value = 2; - giPass.stepCount.value = 8; - - // composite - - const ao = giPass.getAONode().toInspector('SSGI.AO'); - const gi = giPass.getGINode().toInspector('SSGI.GI'); - - const compositePass = vec4(add(scenePassColor.rgb.mul(ao), scenePassDiffuse.rgb.mul(gi.rgb)), scenePassColor.a); - - // traa - - const traaPass = traa(compositePass, scenePassDepth, scenePassVelocity, camera); - renderPipeline.outputNode = traaPass; - - // light - - mouseLight = new THREE.PointLight(0xffffff, 80); - mouseLight.position.set(0, BOX_HEIGHT / 2, BOX_DEPTH / 2); - mouseLight.castShadow = true; - mouseLight.shadow.mapSize.set(1024, 1024); - mouseLight.shadow.radius = 20; - scene.add(mouseLight); - - // - - raycaster = new THREE.Raycaster(); - pointer = new THREE.Vector2(); - - rebuildScene(); - - // - - renderer.domElement.addEventListener('pointerdown', onPointerDown); - renderer.domElement.addEventListener('pointermove', onPointerMove); - renderer.domElement.addEventListener('pointerup', onPointerUp); - renderer.domElement.addEventListener('pointercancel', onPointerUp); - window.addEventListener('resize', onWindowResize); -} - -function getBoxWidth() { - const aspect = window.innerWidth / window.innerHeight; - const vFov = THREE.MathUtils.degToRad(CAM_FOV / 2); - const dist = BOX_HEIGHT / 2 / Math.tan(vFov); - return Math.tan(vFov) * aspect * dist * 2; -} - -function getBallCount() { - const roomVolume = boxSize.w * boxSize.h * boxSize.d; - const ballVolume = (4 / 3) * Math.PI * Math.pow(BALL_RADIUS, 3); - return Math.floor((roomVolume * FILL_RATIO * PACKING) / ballVolume); -} - -function rebuildScene() { - for (const mesh of wallMeshes) { - scene.remove(mesh); - mesh.geometry.dispose(); - } - - wallMeshes = []; - - if (ballsMesh) { - scene.remove(ballsMesh); - ballsMesh.dispose(); - ballsMesh = null; - } - - bodies = []; - - boxSize.w = getBoxWidth(); - ballCount = getBallCount(); - - world = new World({ - gravity: [0, -9.81, 0], - solveVelocityIterations: 6, - solvePositionIterations: 2, - linearDamping: 0.1, - angularDamping: 0.1, - restitution: 0.4, - friction: 0.5, - }); - - fitCameraToBox(); - createBox(); - createBalls(); -} - -function createBox() { - const hw = boxSize.w / 2; - const hh = boxSize.h / 2; - const hd = boxSize.d / 2; - const t = WALL_THICKNESS; - - const whiteMaterial = new THREE.MeshPhysicalMaterial({ - color: 0xeeeeee, - roughness: 0.7, - metalness: 0.0, - }); - - const redMaterial = new THREE.MeshPhysicalMaterial({ - color: 0xff2222, - roughness: 0.7, - metalness: 0.0, - }); - - const greenMaterial = new THREE.MeshPhysicalMaterial({ - color: 0x22ff22, - roughness: 0.7, - metalness: 0.0, - }); - - const walls = [ - { size: [boxSize.w, t, boxSize.d], pos: [0, -t / 2, 0], mat: whiteMaterial }, - { size: [boxSize.w, t, boxSize.d], pos: [0, boxSize.h + t / 2, 0], mat: whiteMaterial }, - { size: [boxSize.w, boxSize.h, t], pos: [0, hh, -hd - t / 2], mat: whiteMaterial }, - { size: [boxSize.w, boxSize.h, t], pos: [0, hh, hd + t / 2], noMesh: true }, - { size: [t, boxSize.h, boxSize.d], pos: [-hw - t / 2, hh, 0], mat: redMaterial }, - { size: [t, boxSize.h, boxSize.d], pos: [hw + t / 2, hh, 0], mat: greenMaterial }, - ]; - - for (const w of walls) { - const shape = world.createBox({ width: w.size[0], height: w.size[1], depth: w.size[2] }); - world.createStaticBody({ shape, position: w.pos }); - - if (!w.noMesh) { - const geo = new THREE.BoxGeometry(w.size[0], w.size[1], w.size[2]); - const mesh = new THREE.Mesh(geo, w.mat); - mesh.position.set(...w.pos); - mesh.receiveShadow = true; - scene.add(mesh); - wallMeshes.push(mesh); - } - } -} - -function createBalls() { - const sphereGeo = new THREE.SphereGeometry(BALL_RADIUS, 32, 16); - const sphereShape = world.createSphere({ radius: BALL_RADIUS }); - - const material = new THREE.MeshPhysicalMaterial({ - roughness: 0.3, - metalness: 0.1, - }); - - ballsMesh = new THREE.InstancedMesh(sphereGeo, material, ballCount); - ballsMesh.castShadow = true; - ballsMesh.receiveShadow = true; - scene.add(ballsMesh); - - const colors = [0xff4444, 0x44ff44, 0x4488ff, 0xffaa00, 0xff44ff, 0x44ffff, 0xffff44, 0xff8844, 0x8844ff, 0x44ff88]; - - const color = new THREE.Color(); - const hw = boxSize.w / 2 - BALL_RADIUS - 0.1; - const hd = boxSize.d / 2 - BALL_RADIUS - 0.1; - - for (let i = 0; i < ballCount; i++) { - color.set(colors[i % colors.length]); - ballsMesh.setColorAt(i, color); - - const x = (Math.random() - 0.5) * 2 * hw; - const y = BALL_RADIUS + Math.random() * (boxSize.h - BALL_RADIUS * 2); - const z = (Math.random() - 0.5) * 2 * hd; - - const body = world.createDynamicBody({ - shape: sphereShape, - position: [x, y, z], - mass: 1, - restitution: 0.5, - friction: 0.4, - }); - - bodies.push(body); - } -} - -function onPointerDown(event) { - activePointers.add(event.pointerId); - - if (event.pointerType === 'touch') { - pointerDown = activePointers.size >= 2; - } else { - pointerDown = true; - } -} - -function onPointerUp(event) { - activePointers.delete(event.pointerId); - - if (event.pointerType === 'touch') { - pointerDown = activePointers.size >= 2; - } else { - pointerDown = false; - } -} - -function onPointerMove(event) { - pointer.x = (event.clientX / window.innerWidth) * 2 - 1; - pointer.y = -(event.clientY / window.innerHeight) * 2 + 1; - - raycaster.setFromCamera(pointer, camera); - - mouseRayOriginTarget.copy(raycaster.ray.origin); - mouseRayDirTarget.copy(raycaster.ray.direction); - mouseMoving = true; - clearTimeout(mouseStopTimer); - mouseStopTimer = setTimeout(() => (mouseMoving = false), 50); - - const frontPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), -boxSize.d / 2); - const hit = new THREE.Vector3(); - if (raycaster.ray.intersectPlane(frontPlane, hit)) { - mouseLightTarget.copy(hit); - } -} - -function respawnBalls() { - const hw = boxSize.w / 2 - BALL_RADIUS - 0.1; - const hd = boxSize.d / 2 - BALL_RADIUS - 0.1; - const count = 5; - - for (let i = 0; i < count; i++) { - const body = bodies[Math.floor(Math.random() * bodies.length)]; - - body.position.set([ - (Math.random() - 0.5) * 2 * hw, - boxSize.h - BALL_RADIUS - Math.random() * 1, - (Math.random() - 0.5) * 2 * hd, - ]); - body.linearVelocity.set([0, 0, 0]); - body.angularVelocity.set([0, 0, 0]); - body.commitChanges(); - } -} - -function fitCameraToBox() { - const vFov = THREE.MathUtils.degToRad(CAM_FOV / 2); - const dist = boxSize.h / 2 / Math.tan(vFov); - - camera.aspect = window.innerWidth / window.innerHeight; - camera.position.set(0, boxSize.h / 2, dist + boxSize.d / 2); - camera.lookAt(0, boxSize.h / 2, 0); - camera.updateProjectionMatrix(); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - rebuildScene(); -} - -const timer = new THREE.Timer(); -const _dummy = new THREE.Object3D(); - -function animate() { - timer.update(); - const dt = Math.min(timer.getDelta(), 1 / 30); - - const easeFactor = 1 - Math.exp(-EASE_SPEED * dt); - mouseRayOrigin.lerp(mouseRayOriginTarget, easeFactor); - mouseRayDir.lerp(mouseRayDirTarget, easeFactor); - mouseLight.position.lerp(mouseLightTarget, easeFactor); - - if (pointerDown) { - respawnBalls(); - } - - if (mouseMoving) { - const pushRadius = 1.5; - const pushStrength = 15; - const _closest = new THREE.Vector3(); - const _ballPos = new THREE.Vector3(); - const _pushDir = new THREE.Vector3(); - - for (const body of bodies) { - const bp = body.position; - _ballPos.set(bp.x, bp.y, bp.z); - - const ray = new THREE.Ray(mouseRayOrigin, mouseRayDir); - ray.closestPointToPoint(_ballPos, _closest); - - const dist = _closest.distanceTo(_ballPos); - - if (dist < pushRadius) { - _pushDir.subVectors(_ballPos, _closest); - if (_pushDir.lengthSq() < 0.001) _pushDir.set(0, 1, 0); - _pushDir.normalize(); - - const strength = pushStrength * (1 - dist / pushRadius); - body.applyLinearImpulse({ - x: _pushDir.x * strength, - y: _pushDir.y * strength, - z: _pushDir.z * strength, - }); - } - } - } - - if (world) { - world.advanceTime(1 / 60, dt); - } - - for (let i = 0; i < bodies.length; i++) { - const body = bodies[i]; - const p = body.position; - const q = body.orientation; - - _dummy.position.set(p.x, p.y, p.z); - _dummy.quaternion.set(q.x, q.y, q.z, q.w); - _dummy.updateMatrix(); - - ballsMesh.setMatrixAt(i, _dummy.matrix); - } - - ballsMesh.instanceMatrix.needsUpdate = true; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_ssr.ts b/examples-testing/examples/webgpu_postprocessing_ssr.ts deleted file mode 100644 index a5db67638..000000000 --- a/examples-testing/examples/webgpu_postprocessing_ssr.ts +++ /dev/null @@ -1,212 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - pass, - mrt, - output, - normalView, - metalness, - roughness, - screenUV, - color, - sample, - packNormalToRGB, - unpackRGBToNormal, - vec2, - colorSpaceToWorking, -} from 'three/tsl'; -import { ssr } from 'three/addons/tsl/display/SSRNode.js'; -import { smaa } from 'three/addons/tsl/display/SMAANode.js'; - -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const params = { - quality: 0.5, - blurQuality: 1, - maxDistance: 1, - intensity: 1, - thickness: 0.03, - binaryRefine: false, - roughness: 1, - enabled: true, -}; - -let camera, scene, model, renderer, renderPipeline, ssrPass; -let controls; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.set(3, 2, 3); - - scene = new THREE.Scene(); - scene.backgroundNode = screenUV.distance(0.5).remap(0, 0.5).mix(color(0x888877), color(0x776666)); - - const dracoLoader = new DRACOLoader(); - - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - loader.load('models/gltf/steampunk_camera.glb', function (gltf) { - model = gltf.scene; - - model.traverse(function (object) { - if (object.material) { - if (object.material.name === 'Lense_Casing') { - object.material.transparent = true; - } - - // Avoid overdrawing - object.material.side = THREE.FrontSide; - } - }); - - model.position.y = 0.1; - scene.add(model); - }); - - // Add a reflective plane under the camera - - const floorGeometry = new THREE.CircleGeometry(2, 64); - const floorMaterial = new THREE.MeshStandardMaterial({ - color: 0xffffff, - metalness: 1, - roughness: 0.5, - }); - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.rotation.x = -Math.PI / 2; - floor.position.y = -0.8; - scene.add(floor); - - // - - renderer = new THREE.WebGPURenderer(); - // renderer.setPixelRatio( window.devicePixelRatio ); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const environment = new RoomEnvironment(); - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene.environment = pmremGenerator.fromScene(environment, 0.04).texture; - scene.environmentIntensity = 1.25; - pmremGenerator.dispose(); - - // - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - scenePass.setMRT( - mrt({ - output: output, - normal: packNormalToRGB(normalView), - metalrough: vec2(metalness, roughness), // pack metalness and roughness into a single attachment - }), - ); - - const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); - const scenePassNormal = scenePass.getTextureNode('normal').toInspector('Normal', node => { - return colorSpaceToWorking(node, THREE.SRGBColorSpace); - }); - const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { - return scenePass.getLinearDepthNode(); - }); - const scenePassMetalRough = scenePass.getTextureNode('metalrough').toInspector('Metalness-Roughness'); - - // optional: optimize bandwidth by reducing the texture precision for normals and metal/roughness - - const normalTexture = scenePass.getTexture('normal'); - normalTexture.type = THREE.UnsignedByteType; - - const metalRoughTexture = scenePass.getTexture('metalrough'); - metalRoughTexture.type = THREE.UnsignedByteType; - - const sceneNormal = sample(uv => { - return unpackRGBToNormal(scenePassNormal.sample(uv)); - }); - - // - - ssrPass = ssr(scenePassColor, scenePassDepth, sceneNormal, { - metalnessNode: scenePassMetalRough.r, - roughnessNode: scenePassMetalRough.g, - }).toInspector('SSR'); - - // blend SSR over beauty (SSR outputs premultiplied color, so use additive blending) - - const outputNode = smaa(scenePassColor.add(ssrPass.rgb)); - - renderPipeline.outputNode = outputNode; - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.update(); - - window.addEventListener('resize', onWindowResize); - - // GUI - - const gui = renderer.inspector.createParameters('Settings'); - const ssrFolder = gui.addFolder('SSR'); - ssrFolder.add(params, 'quality', 0, 1).onChange(updateParameters); - ssrFolder.add(params, 'blurQuality', 1, 3, 1).onChange(updateParameters); - ssrFolder.add(params, 'maxDistance', 0, 1).onChange(updateParameters); - ssrFolder.add(params, 'intensity', 0, 1).onChange(updateParameters); - ssrFolder.add(params, 'thickness', 0, 0.05).onChange(updateParameters); - ssrFolder.add(params, 'binaryRefine').name('binary refine').onChange(updateParameters); - ssrFolder.add(params, 'enabled').onChange(() => { - if (params.enabled === true) { - renderPipeline.outputNode = outputNode; - } else { - renderPipeline.outputNode = scenePass; - } - - renderPipeline.needsUpdate = true; - }); - const modelFolder = gui.addFolder('Model'); - modelFolder.add(params, 'roughness', 0, 1).onChange(value => { - model.traverse(function (object) { - if (object.material) { - object.material.roughness = value; - } - }); - }); - - updateParameters(); -} - -function updateParameters() { - ssrPass.quality.value = params.quality; - // blurQuality is a build-time constant: assigning it recompiles the blur material - // (the setter no-ops when the value is unchanged). - ssrPass.blurQuality = params.blurQuality; - ssrPass.maxDistance.value = params.maxDistance; - ssrPass.intensity.value = params.intensity; - ssrPass.thickness.value = params.thickness; - // build-time constant: assigning it recompiles the SSR material (setter no-ops if unchanged) - ssrPass.binaryRefine = params.binaryRefine; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts b/examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts deleted file mode 100644 index 978c8ed67..000000000 --- a/examples-testing/examples/webgpu_postprocessing_ssr_denoise.ts +++ /dev/null @@ -1,504 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - pass, - mrt, - output, - normalView, - materialMetalness, - materialRoughness, - screenUV, - sample, - packNormalToRGB, - unpackRGBToNormal, - vec2, - velocity, - diffuseColor, - vec3, - vec4, - uniform, - mix, - step, - abs, - float, - renderOutput, - saturation, -} from 'three/tsl'; -import { ssr } from 'three/addons/tsl/display/SSRNode.js'; -import { temporalReproject } from 'three/addons/tsl/display/TemporalReprojectNode.js'; -import { recurrentDenoise } from 'three/addons/tsl/display/RecurrentDenoiseNode.js'; -import { sharpen } from 'three/addons/tsl/display/SharpenNode.js'; -import { traa } from 'three/addons/tsl/display/TRAANode.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -// Disable env map specular (radiance and clearcoat radiance) for every PBR material -// in this scene, since SSR provides the specular reflections instead. Diffuse env -// (irradiance) is left untouched. Equivalent to zeroing EnvironmentNode contributions, -// but scoped to this example rather than modifying the core library. -const _indirectSpecular = THREE.PhysicalLightingModel.prototype.indirectSpecular; -THREE.PhysicalLightingModel.prototype.indirectSpecular = function (builder) { - builder.context.radiance = vec3(0); - - if (this.clearcoatRadiance) { - this.clearcoatRadiance.assign(vec3(0)); - } - - _indirectSpecular.call(this, builder); -}; - -const OUTPUT_COMPARE_DENOISE = 8; -const OUTPUT_COMPARE_SSR = 9; - -const GRADED_OUTPUTS = new Set([0, 1, 3, 4, OUTPUT_COMPARE_DENOISE, OUTPUT_COMPARE_SSR]); - -const compareHint = document.getElementById('compare-hint'); - -function isCompareMode(output) { - return output === OUTPUT_COMPARE_DENOISE || output === OUTPUT_COMPARE_SSR; -} - -function updateCompareHint(output) { - compareHint.hidden = !isCompareMode(output); -} - -const compareSplit = uniform(0.5); -const compareResolution = uniform(new THREE.Vector2(window.innerWidth, window.innerHeight)); - -function buildCompareNode(noisy, denoised) { - const compareColor = mix(noisy, denoised, step(compareSplit, screenUV.x)); - const lineWidth = float(1).div(compareResolution.x); - const onLine = float(1).sub(step(lineWidth, abs(screenUV.x.sub(compareSplit)))); - - return mix(compareColor, vec4(1), onLine); -} - -const params = { - output: 0, - roughness: 0.3, - - ssr: { - resolutionScale: 1, - quality: 0.25, - mirrorBias: 0.5, - maxDistance: 0.4, - intensity: 1, - thickness: 0.1, - maxLuminance: 35, - binaryRefine: false, - stepExponent: 3, - envImportanceSampling: false, - screenEdgeFade: 0.2, - screenEdgeFadeBlack: false, // for indoor scenes, set to true - environmentIntensity: 3.14, // not too sure why exactly, but multiplying by ~PI makes the env map reflections match Blender more - }, - - temporalReproject: { - maxFrames: 16, - clampIntensity: 0.25, - flickerSuppression: 1, - hitPointReprojection: true, - }, - - denoise: { - enabled: true, - lumaPhi: 0.75, - depthPhi: 20, - normalPhi: 0.3, - roughnessPhi: 100, - radius: 1.5, - alphaPhi: 5, - strength: 0.725, - adapt: 0.5, - smoothDisocclusions: true, - flickerSuppression: 1, - adaptiveTrust: 1, - }, - - post: { - grading: { toneMapping: 'AgX', exposure: 1.57, gamma: 0.89, contrast: 1.31, saturation: 1 }, - }, -}; - -let camera, scene, model, renderer, postProcessing, ssrNode, temporalReprojectNode, denoiseNode; -let controls; -let scenePassNode, combinedOutputNode, scenePassDepth, scenePassVelocity; -let gammaUniform, contrastUniform, saturationUniform; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 8); - - camera.position.set(0.9210513838983053, 0.16195074025403253, 0.431687274895316); - - scene = new THREE.Scene(); - - const loader = new GLTFLoader(); - loader.load('models/gltf/dungeon_warkarma.glb', function (gltf) { - gltf.scene.scale.multiplyScalar(0.1); - - gltf.scene.traverse(function (object) { - if (!object.material) return; - - object.castShadow = true; - object.receiveShadow = true; - object.material.roughness = 0.3; - object.material.normalMap = null; - }); - - model = gltf.scene; - scene.add(model); - }); - - renderer = new THREE.WebGPURenderer(); - renderer.inspector = new Inspector(); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.AgXToneMapping; - renderer.toneMappingExposure = params.post.grading.exposure; - renderer.shadowMap.enabled = true; - document.body.appendChild(renderer.domElement); - - const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); - const hdrTexture = await hdrLoader.loadAsync('quarry_01_1k.hdr'); - hdrTexture.mapping = THREE.EquirectangularReflectionMapping; - scene.background = hdrTexture; - scene.environment = hdrTexture; - hdrTexture.generateMipmaps = true; - hdrTexture.needsUpdate = true; - - const directionalLight = new THREE.DirectionalLight('#ffffff', 20); - directionalLight.position.set(-10.9, 2.2, 10.75); - directionalLight.castShadow = true; - directionalLight.shadow.autoUpdate = false; - directionalLight.shadow.needsUpdate = true; - directionalLight.shadow.mapSize.width = 4096; - directionalLight.shadow.mapSize.height = 4096; - directionalLight.shadow.camera.left = -1.75; - directionalLight.shadow.camera.right = 1.75; - directionalLight.shadow.camera.top = 1.75; - directionalLight.shadow.camera.bottom = -1.75; - directionalLight.shadow.camera.near = 0.1; - directionalLight.shadow.camera.far = 50; - directionalLight.shadow.bias = -0.0005; - scene.add(directionalLight); - - await renderer.init(); - - scene.environmentIntensity = 1; - - postProcessing = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - scenePassNode = scenePass; - scenePass.setMRT( - mrt({ - output: output, - // Store base color (albedo) in RGB + metalness in alpha. The albedo is needed for - // metal Fresnel f0; do NOT bake in the (1-metalness) diffuse attenuation here, as - // that zeroes metals and destroys their specular tint (f0 would become 0 → black). - diffuseColor: vec4(diffuseColor.rgb, materialMetalness), - // Pack roughness into normal alpha channel to save MRT bandwidth - normal: vec4(packNormalToRGB(normalView).rgb, materialRoughness), - velocity: velocity, - }), - ); - - const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); - const scenePassNormal = scenePass.getTextureNode('normal').toInspector('Normal'); - scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { - return scenePass.getLinearDepthNode(); - }); - scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); - const scenePassDiffuseColor = scenePass.getTextureNode('diffuseColor').toInspector('Diffuse Color'); - - const normalTexture = scenePass.getTexture('normal'); - normalTexture.type = THREE.UnsignedByteType; - - const diffuseTexture = scenePass.getTexture('diffuseColor'); - diffuseTexture.type = THREE.UnsignedByteType; - - const sceneNormal = sample(uv => unpackRGBToNormal(scenePassNormal.sample(uv).rgb)); - - // metalness in diffuseColor.a, roughness in normal.a (no separate metalrough MRT) - const scenePassMetalRough = sample(uv => - vec2(scenePassDiffuseColor.sample(uv).a, scenePassNormal.sample(uv).a), - ).toInspector('Metalness/Roughness'); - - ssrNode = ssr(scenePassColor, scenePassDepth, sceneNormal, { - stochastic: true, - diffuseNode: scenePassDiffuseColor, - metalnessNode: scenePassDiffuseColor.a, - roughnessNode: scenePassNormal.a, - environmentNode: hdrTexture, - envImportanceSampling: params.ssr.envImportanceSampling, - binaryRefine: params.ssr.binaryRefine, - }); - ssrNode.setEnvMap(hdrTexture); - ssrNode.toInspector('SSR'); - - temporalReprojectNode = temporalReproject(ssrNode, scenePassDepth, scenePassNormal, scenePassVelocity, camera, { - mode: 'specular', - accumulate: false, - }); - temporalReprojectNode.toInspector('Temporal Reproject'); - - denoiseNode = recurrentDenoise(temporalReprojectNode, camera, { - depth: scenePassDepth, - normal: scenePassNormal, - raw: ssrNode, - metalRoughness: scenePassMetalRough, - mode: 'specular', - accumulate: true, - }); - denoiseNode.alphaSource = 'raylength'; // SSR alpha channel contains ray length - denoiseNode.toInspector('Denoise'); - // feed the denoised result + velocity back into SSR for multi-bounce reflections - ssrNode.setHistory(denoiseNode, scenePassVelocity); - temporalReprojectNode.setHistoryTexture(denoiseNode); - - const denoisePassBlend = vec4(denoiseNode.rgb, ssrNode.a.greaterThan(0).toVar()); - - gammaUniform = uniform(params.post.grading.gamma); - contrastUniform = uniform(params.post.grading.contrast); - saturationUniform = uniform(params.post.grading.saturation); - - const litColor = scenePassColor.rgb.add(denoisePassBlend.rgb); - - const outputNode = vec4(litColor, 1); - outputNode.toInspector('Combined SSR'); - combinedOutputNode = outputNode; - - postProcessing.outputNode = applyPostProcessing(combinedOutputNode); - postProcessing.outputColorTransform = false; - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.update(); - - // Initial camera transform - camera.position.set(1.259878548682251, 0.5391287340899181, -0.27217301481427114); - camera.rotation.set(-0.3158233106804791, 0.26820684188431526, 0.08637696823742165); - controls.target.set(1.0258536154689288, 0.2746440590977971, -1.0815876858987743); - - window.addEventListener('resize', onWindowResize); - renderer.domElement.addEventListener('pointermove', onComparePointerMove); - - applyParams(); - applyPost(); - - const outputTypes = { - Combined: 0, - 'Denoised SSR': 4, - 'Compare (Denoise)': OUTPUT_COMPARE_DENOISE, - 'Compare (Reflections)': OUTPUT_COMPARE_SSR, - 'SSR (Raw)': 1, - 'Ray Length': 7, - 'Accumulation Speed (Alpha)': 6, - }; - - const ssrGui = renderer.inspector.createParameters('SSR settings'); - ssrGui.add(params, 'output', outputTypes).onChange(updateOutputNode); - ssrGui.add(params.ssr, 'quality', 0, 1).name('quality').onChange(applyParams); - ssrGui.add(params.ssr, 'mirrorBias', 0, 1).name('mirror bias').onChange(applyParams); - ssrGui.add(params.ssr, 'stepExponent', 1, 4, 0.5).name('step exponent').onChange(applyParams); - ssrGui.add(params.ssr, 'binaryRefine').name('binary refine').onChange(applyParams); - ssrGui.add(params.ssr, 'maxDistance', 0, 5).name('max distance').onChange(applyParams); - ssrGui.add(params.ssr, 'intensity', 0, 4).name('intensity').onChange(applyParams); - ssrGui.add(params.ssr, 'thickness', 0, 0.25).name('thickness').onChange(applyParams); - ssrGui.add(params.ssr, 'environmentIntensity', 0, 10).name('env intensity').onChange(applyParams); - ssrGui.add(params, 'roughness', 0, 1).onChange(value => { - scene.traverse(object => { - if (object.material) object.material.roughness = value; - }); - }); - - const denoiseGui = renderer.inspector.createParameters('Denoise settings'); - denoiseGui.add(params.denoise, 'enabled').name('enabled').onChange(applyParams); - denoiseGui.add(params.denoise, 'lumaPhi', 0, 3).name('luma phi').onChange(applyParams); - denoiseGui.add(params.denoise, 'depthPhi', 0, 50).name('depth phi').onChange(applyParams); - denoiseGui.add(params.denoise, 'normalPhi', 0.01, 1, 0.01).name('normal phi').onChange(applyParams); - - // We have uniform roughness in the scene, so we don't need to adjust the roughness phi - // denoiseGui.add( params.denoise, 'roughnessPhi', 0, 500 ).name( 'roughness phi' ).onChange( applyParams ); - - denoiseGui.add(params.denoise, 'alphaPhi', 0, 15).name('ray length phi').onChange(applyParams); - denoiseGui.add(params.denoise, 'radius', 0, 3).name('radius').onChange(applyParams); - denoiseGui.add(params.denoise, 'strength', 0.5, 0.95).name('strength').onChange(applyParams); - denoiseGui.add(params.denoise, 'adapt', 0, 1).name('adapt').onChange(applyParams); - - // Extra options that are not used in this example - // denoiseGui.add( params.denoise, 'smoothDisocclusions' ).name( 'smooth disocclusions' ).onChange( applyParams ); - // denoiseGui.add( params.denoise, 'flickerSuppression', 0, 1 ).name( 'flicker suppression' ).onChange( applyParams ); - // denoiseGui.add( params.denoise, 'adaptiveTrust', 0, 1 ).name( 'adaptive trust' ).onChange( applyParams ); - - const temporalReprojectGui = renderer.inspector.createParameters('Temporal Reproject settings'); - temporalReprojectGui.add(params.temporalReproject, 'maxFrames', 1, 128, 1).name('max frames').onChange(applyParams); - temporalReprojectGui - .add(params.temporalReproject, 'clampIntensity', 0, 1) - .name('clamp intensity') - .onChange(applyParams); - temporalReprojectGui - .add(params.temporalReproject, 'flickerSuppression', 0, 1) - .name('flicker suppression') - .onChange(applyParams); - temporalReprojectGui - .add(params.temporalReproject, 'hitPointReprojection') - .name('hit point reprojection') - .onChange(applyParams); - temporalReprojectGui.close(); - - // Concise UI for Directional Light controls - const lightGui = renderer.inspector.createParameters('Light').close(); - ['x', 'y', 'z'].forEach(axis => { - lightGui - .add(directionalLight.position, axis, -30, 30) - .name(axis.toUpperCase()) - .onChange(() => (directionalLight.shadow.needsUpdate = true)); - }); - lightGui.add(directionalLight, 'intensity', 0, 50).name('Intensity'); - - updateOutputNode(); - renderer.setAnimationLoop(animate); -} - -function applyParams() { - if (!ssrNode) return; - - ssrNode.resolutionScale = params.ssr.resolutionScale; - ssrNode.quality.value = params.ssr.quality; - ssrNode.mirrorBias.value = params.ssr.mirrorBias; - // stepExponent / screenEdgeFadeBlack / binaryRefine are build-time constants: assigning - // them recompiles the SSR material (the setters no-op when the value is unchanged). - ssrNode.stepExponent = params.ssr.stepExponent; - ssrNode.binaryRefine = params.ssr.binaryRefine; - ssrNode.maxDistance.value = params.ssr.maxDistance; - ssrNode.intensity.value = params.ssr.intensity; - ssrNode.thickness.value = params.ssr.thickness; - ssrNode.maxLuminance.value = params.ssr.maxLuminance; - ssrNode.screenEdgeFade.value = params.ssr.screenEdgeFade; - ssrNode.screenEdgeFadeBlack = params.ssr.screenEdgeFadeBlack; - ssrNode.environmentIntensity.value = params.ssr.environmentIntensity; - - if (temporalReprojectNode) { - temporalReprojectNode.maxFrames.value = params.temporalReproject.maxFrames; - temporalReprojectNode.clampIntensity.value = params.temporalReproject.clampIntensity; - temporalReprojectNode.flickerSuppression.value = params.temporalReproject.flickerSuppression; - temporalReprojectNode.hitPointReprojection.value = params.temporalReproject.hitPointReprojection; - } - - if (denoiseNode) { - denoiseNode.lumaPhi.value = params.denoise.lumaPhi; - denoiseNode.depthPhi.value = params.denoise.depthPhi; - denoiseNode.normalPhi.value = params.denoise.normalPhi; - denoiseNode.roughnessPhi.value = params.denoise.roughnessPhi; - denoiseNode.radius.value = params.denoise.enabled ? params.denoise.radius : 0; - denoiseNode.alphaPhi.value = params.denoise.alphaPhi; - denoiseNode.strength.value = params.denoise.strength; - denoiseNode.adapt.value = params.denoise.adapt; - denoiseNode.smoothDisocclusions.value = params.denoise.smoothDisocclusions; - denoiseNode.flickerSuppression.value = params.denoise.flickerSuppression; - denoiseNode.adaptiveTrust.value = params.denoise.adaptiveTrust; - } -} - -function applyGrading(source) { - let rgb = source.rgb; - - rgb = renderOutput(vec4(rgb, 1), THREE.AgXToneMapping, THREE.SRGBColorSpace).rgb; - rgb = rgb.sub(0.5).mul(contrastUniform).add(0.5); - rgb = saturation(rgb, saturationUniform); - rgb = rgb.max(0.0).pow(float(1).div(gammaUniform)); - - return vec4(rgb, 1); -} - -function applyPostProcessing(source) { - return sharpen(traa(applyGrading(source), scenePassDepth, scenePassVelocity, camera), 0); -} - -function applyPost() { - const g = params.post.grading; - gammaUniform.value = g.gamma; - contrastUniform.value = g.contrast; - saturationUniform.value = g.saturation; - - renderer.toneMapping = THREE.AgXToneMapping; - renderer.toneMappingExposure = g.exposure; -} - -function updateOutputNode() { - if (!postProcessing) return; - - let node; - - switch (params.output) { - case 0: - node = applyPostProcessing(combinedOutputNode); - break; // Combined - case 1: - node = applyPostProcessing(vec4(ssrNode.rgb, 1)); - break; // SSR (Raw) - case 4: - node = applyPostProcessing(vec4(denoiseNode.rgb, 1)); - break; // Denoised SSR - case 6: - node = vec4(denoiseNode.aaa, 1); - break; // Samples (Alpha) - case 7: - node = vec4(ssrNode.aaa, 1); - break; // Ray Length (Raw) - case OUTPUT_COMPARE_DENOISE: { - // Compare (denoised | noisy) - - const noisySSR = applyPostProcessing(vec4(ssrNode.rgb, 1)); - const denoisedSSR = applyPostProcessing(vec4(denoiseNode.rgb, 1)); - node = buildCompareNode(denoisedSSR, noisySSR); - break; - } - - case OUTPUT_COMPARE_SSR: { - // Compare (combined SSR vs. scene only) - - node = buildCompareNode(applyPostProcessing(combinedOutputNode), applyPostProcessing(scenePassNode)); - break; - } - } - - if (!isCompareMode(params.output)) controls.enabled = true; - - updateCompareHint(params.output); - - postProcessing.outputColorTransform = !GRADED_OUTPUTS.has(params.output); - postProcessing.outputNode = node; - postProcessing.needsUpdate = true; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - compareResolution.value.set(window.innerWidth, window.innerHeight); -} - -function onComparePointerMove(event) { - if (!isCompareMode(params.output)) return; - - if (event.shiftKey) { - controls.enabled = false; - - const rect = renderer.domElement.getBoundingClientRect(); - compareSplit.value = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width)); - } else { - controls.enabled = true; - } -} - -function animate() { - controls.update(); - - postProcessing.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_sss.ts b/examples-testing/examples/webgpu_postprocessing_sss.ts deleted file mode 100644 index b79e94375..000000000 --- a/examples-testing/examples/webgpu_postprocessing_sss.ts +++ /dev/null @@ -1,185 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, vec3, vec4, mrt, screenUV, velocity, builtinShadowContext } from 'three/tsl'; -import { sss } from 'three/addons/tsl/display/SSSNode.js'; -import { traa } from 'three/addons/tsl/display/TRAANode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline, controls; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(1, 2.5, -3.5); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xa0a0a0); - scene.fog = new THREE.Fog(0xa0a0a0, 10, 50); - - // lights - - const hemiLight = new THREE.HemisphereLight(0xffffff, 0x8d8d8d, 2); - hemiLight.position.set(0, 20, 0); - scene.add(hemiLight); - - const dirLight = new THREE.DirectionalLight(0xffffff, 3); - dirLight.position.set(-3, 10, -10); - dirLight.castShadow = true; - dirLight.shadow.bias = -0.001; // remove self-shadowing artifacts - dirLight.shadow.camera.top = 4; - dirLight.shadow.radius = 2; - dirLight.shadow.camera.bottom = -4; - dirLight.shadow.camera.left = -4; - dirLight.shadow.camera.right = 4; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = 40; - dirLight.shadow.mapSize.width = 1024; - dirLight.shadow.mapSize.height = 1024; - scene.add(dirLight); - - // scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) ); - - // ground - - const mesh = new THREE.Mesh( - new THREE.PlaneGeometry(100, 100), - new THREE.MeshPhongMaterial({ color: 0xcbcbcb, depthWrite: false }), - ); - mesh.rotation.x = -Math.PI / 2; - mesh.receiveShadow = true; - scene.add(mesh); - - // - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - loader.load('models/gltf/nemetona.glb', function (gltf) { - const model = gltf.scene; - model.rotation.y = Math.PI; - model.scale.setScalar(10); - model.position.y = 0.45; - - scene.add(model); - - model.traverse(function (object) { - if (object.isMesh) { - object.castShadow = true; - object.receiveShadow = true; - object.material.aoMap = null; // remove AO to better see the effect of shadows - } - }); - }); - - // - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // post-processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // pre-pass - - const prePass = pass(scene, camera); - prePass.name = 'Pre-Pass'; - prePass.transparent = false; - - prePass.setMRT( - mrt({ - output: velocity, - }), - ); - - const prePassDepth = prePass.getTextureNode('depth').toInspector('Depth', () => prePass.getLinearDepthNode()); - const prePassVelocity = prePass.getTextureNode('output').toInspector('Velocity'); - - // scene pass - - const scenePass = pass(scene, camera).toInspector('Color'); - - // sss - - const sssPass = sss(prePassDepth, camera, dirLight); - sssPass.maxDistance.value = 0.2; - sssPass.useTemporalFiltering = true; - - // scene context - - const sssSample = sssPass.getTextureNode().sample(screenUV).r; - const sssContext = builtinShadowContext(sssSample, dirLight); - - scenePass.contextNode = sssContext; - - // traa - - const traaPass = traa(scenePass, prePassDepth, prePassVelocity, camera); - renderPipeline.outputNode = traaPass; - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 20; - controls.target.set(0, 2, 0); - controls.enableDamping = true; - controls.update(); - - // - - const params = { - output: 0, - }; - - const types = { 'Scene with Shadow Maps + SSS': 0, 'Scene with Shadow Maps': 1, SSS: 2 }; - - const gui = renderer.inspector.createParameters('SSS settings'); - gui.add(params, 'output', types).onChange(updatePostprocessing); - gui.add(sssPass.shadowIntensity, 'value', 0, 1).name('shadow intensity'); - gui.add(sssPass.maxDistance, 'value', 0.01, 1).name('max ray distance'); - gui.add(sssPass.quality, 'value', 0, 1).name('quality'); - gui.add(sssPass.thickness, 'value', 0.01, 0.1).name('thickness'); - gui.add(sssPass, 'useTemporalFiltering').name('temporal filtering').onChange(updatePostprocessing); - - function updatePostprocessing() { - scenePass.contextNode = params.output !== 1 ? sssContext : null; - - if (params.output === 2) { - renderPipeline.outputNode = vec4(vec3(sssPass.r), 1); - } else { - renderPipeline.outputNode = sssPass.useTemporalFiltering ? traaPass : scenePass; - } - - renderPipeline.needsUpdate = true; - } - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_traa.ts b/examples-testing/examples/webgpu_postprocessing_traa.ts deleted file mode 100644 index 01d17ca17..000000000 --- a/examples-testing/examples/webgpu_postprocessing_traa.ts +++ /dev/null @@ -1,93 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mrt, output, pass, velocity } from 'three/tsl'; -import { traa } from 'three/addons/tsl/display/TRAANode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline; -let index = 0; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.z = 2.5; - - scene = new THREE.Scene(); - - const geometry = new THREE.BoxGeometry(); - const material1 = new THREE.MeshBasicMaterial({ color: 0xffffff, wireframe: true }); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.position.x = -1; - scene.add(mesh1); - - const texture = new THREE.TextureLoader().load('textures/brick_diffuse.jpg'); - texture.minFilter = THREE.NearestFilter; - texture.magFilter = THREE.NearestFilter; - texture.generateMipmaps = false; - texture.colorSpace = THREE.SRGBColorSpace; - - const material2 = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.position.x = 1; - scene.add(mesh2); - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - const scenePass = pass(scene, camera); - scenePass.setMRT( - mrt({ - output: output, - velocity: velocity, - }), - ); - - const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); - const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { - return scenePass.getLinearDepthNode(); - }); - const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); - - const traaNode = traa(scenePassColor, scenePassDepth, scenePassVelocity, camera); - - renderPipeline.outputNode = traaNode; - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - index++; - - if (Math.round(index / 200) % 2 === 0) { - for (let i = 0; i < scene.children.length; i++) { - const child = scene.children[i]; - - child.rotation.x += 0.005; - child.rotation.y += 0.01; - } - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_postprocessing_transition.ts b/examples-testing/examples/webgpu_postprocessing_transition.ts deleted file mode 100644 index 1a5a88fc1..000000000 --- a/examples-testing/examples/webgpu_postprocessing_transition.ts +++ /dev/null @@ -1,207 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import TWEEN from 'three/addons/libs/tween.module.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { uniform, pass } from 'three/tsl'; -import { transition } from 'three/addons/tsl/display/TransitionNode.js'; - -let renderer, renderPipeline, transitionController, transitionPass; - -const textures = []; -const timer = new THREE.Timer(); -timer.connect(document); - -const effectController = { - animateScene: true, - animateTransition: true, - transition: 0, - _transition: uniform(0), - useTexture: true, - _useTexture: uniform(1), - texture: 5, - cycle: true, - threshold: uniform(0.1), -}; - -function generateInstancedMesh(geometry, material, count) { - const mesh = new THREE.InstancedMesh(geometry, material, count); - - const dummy = new THREE.Object3D(); - const color = new THREE.Color(); - - for (let i = 0; i < count; i++) { - dummy.position.x = Math.random() * 100 - 50; - dummy.position.y = Math.random() * 60 - 30; - dummy.position.z = Math.random() * 80 - 40; - - dummy.rotation.x = Math.random() * 2 * Math.PI; - dummy.rotation.y = Math.random() * 2 * Math.PI; - dummy.rotation.z = Math.random() * 2 * Math.PI; - - dummy.scale.x = Math.random() * 2 + 1; - - if (geometry.type === 'BoxGeometry') { - dummy.scale.y = Math.random() * 2 + 1; - dummy.scale.z = Math.random() * 2 + 1; - } else { - dummy.scale.y = dummy.scale.x; - dummy.scale.z = dummy.scale.x; - } - - dummy.updateMatrix(); - - mesh.setMatrixAt(i, dummy.matrix); - mesh.setColorAt(i, color.setScalar(0.1 + 0.9 * Math.random())); - } - - return mesh; -} - -function FXScene(geometry, rotationSpeed, backgroundColor) { - const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.z = 20; - - // Setup scene - const scene = new THREE.Scene(); - scene.background = new THREE.Color(backgroundColor); - scene.add(new THREE.AmbientLight(0xaaaaaa, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 1, 4); - scene.add(light); - - this.rotationSpeed = rotationSpeed; - - const color = geometry.type === 'BoxGeometry' ? 0x0000ff : 0xff0000; - const material = new THREE.MeshPhongNodeMaterial({ color: color, flatShading: true }); - const mesh = generateInstancedMesh(geometry, material, 500); - scene.add(mesh); - - this.scene = scene; - this.camera = camera; - this.mesh = mesh; - - this.update = function (delta) { - if (effectController.animateScene) { - mesh.rotation.x += this.rotationSpeed.x * delta; - mesh.rotation.y += this.rotationSpeed.y * delta; - mesh.rotation.z += this.rotationSpeed.z * delta; - } - }; - - this.resize = function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - }; -} - -const fxSceneA = new FXScene(new THREE.BoxGeometry(2, 2, 2), new THREE.Vector3(0, -0.4, 0), 0xffffff); -const fxSceneB = new FXScene(new THREE.IcosahedronGeometry(1, 1), new THREE.Vector3(0, 0.2, 0.1), 0x000000); - -function init() { - // Initialize textures - - const loader = new THREE.TextureLoader(); - - for (let i = 0; i < 6; i++) { - textures[i] = loader.load('textures/transition/transition' + (i + 1) + '.png'); - } - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.inspector = new Inspector(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePassA = pass(fxSceneA.scene, fxSceneA.camera); - const scenePassB = pass(fxSceneB.scene, fxSceneB.camera); - - transitionPass = transition( - scenePassA, - scenePassB, - new THREE.TextureNode(textures[effectController.texture]), - effectController._transition, - effectController.threshold, - effectController._useTexture, - ); - - renderPipeline.outputNode = transitionPass; - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(effectController, 'animateScene').name('Animate Scene'); - gui.add(effectController, 'animateTransition').name('Animate Transition'); - transitionController = gui - .add(effectController, 'transition', 0, 1, 0.01) - .name('transition') - .onChange(() => { - effectController._transition.value = effectController.transition; - }); - gui.add(effectController, 'useTexture').onChange(() => { - const value = effectController.useTexture ? 1 : 0; - effectController._useTexture.value = value; - }); - gui.add(effectController, 'texture', { Perlin: 0, Squares: 1, Cells: 2, Distort: 3, Gradient: 4, Radial: 5 }); - gui.add(effectController, 'cycle'); - gui.add(effectController.threshold, 'value', 0, 1, 0.01).name('threshold'); -} - -window.addEventListener('resize', onWindowResize); - -function onWindowResize() { - fxSceneA.resize(); - fxSceneB.resize(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -new TWEEN.Tween(effectController) - .to({ transition: 1 }, 1500) - .onUpdate(function () { - transitionController.setValue(effectController.transition); - - // Change the current alpha texture after each transition - if (effectController.cycle) { - if (effectController.transition == 0 || effectController.transition == 1) { - effectController.texture = (effectController.texture + 1) % textures.length; - } - } - }) - .repeat(Infinity) - .delay(2000) - .yoyo(true) - .start(); - -function animate() { - timer.update(); - - if (effectController.animateTransition) TWEEN.update(); - - if (textures[effectController.texture]) { - const mixTexture = textures[effectController.texture]; - transitionPass.mixTextureNode.value = mixTexture; - } - - const delta = timer.getDelta(); - fxSceneA.update(delta); - fxSceneB.update(delta); - - render(); -} - -function render() { - // Prevent render both scenes when it's not necessary - if (effectController.transition === 0) { - renderer.render(fxSceneB.scene, fxSceneB.camera); - } else if (effectController.transition === 1) { - renderer.render(fxSceneA.scene, fxSceneA.camera); - } else { - renderPipeline.render(); - } -} - -init(); diff --git a/examples-testing/examples/webgpu_procedural_texture.ts b/examples-testing/examples/webgpu_procedural_texture.ts deleted file mode 100644 index 21fb4a3c2..000000000 --- a/examples-testing/examples/webgpu_procedural_texture.ts +++ /dev/null @@ -1,75 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { checker, uv, uniform, convertToTexture } from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -init(); - -function init() { - const aspect = window.innerWidth / window.innerHeight; - camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); - camera.position.z = 1; - - scene = new THREE.Scene(); - - // procedural to texture - - const uvScale = uniform(4); - const blurAmount = uniform(0.5); - - const procedural = checker(uv().mul(uvScale)); - const proceduralToTexture = convertToTexture(procedural, 512, 512); // ( node, width, height ) - - const colorNode = gaussianBlur(proceduralToTexture, blurAmount, 20); - - // extra - - //proceduralToTexture.autoUpdate = false; // update just once - //proceduralToTexture.textureNeedsUpdate = true; // manually update - - // scene - - const material = new THREE.MeshBasicNodeMaterial(); - material.colorNode = colorNode; - - const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - scene.add(plane); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - // gui - - const gui = renderer.inspector.createParameters('Procedural Texture'); - gui.add(uvScale, 'value', 1, 10).name('uv scale ( before rtt )'); - gui.add(blurAmount, 'value', 0, 2).name('blur amount ( after rtt )'); - gui.add(proceduralToTexture, 'autoUpdate').name('auto update'); -} - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); - - const aspect = window.innerWidth / window.innerHeight; - - const frustumHeight = camera.top - camera.bottom; - - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - - camera.updateProjectionMatrix(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_reflection.ts b/examples-testing/examples/webgpu_reflection.ts deleted file mode 100644 index d26a86aa2..000000000 --- a/examples-testing/examples/webgpu_reflection.ts +++ /dev/null @@ -1,344 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { - abs, - blendOverlay, - color, - float, - Fn, - instancedBufferAttribute, - max, - normalWorldGeometry, - pass, - positionGeometry, - positionLocal, - pow2, - reflector, - screenUV, - sin, - sub, - texture, - time, - uniform, - uv, - vec2, - vec3, -} from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import TWEEN from 'three/addons/libs/tween.module.js'; - -let camera, scene, renderer; -let renderPipeline; -let controls; - -// below uniforms will be animated via TWEEN.js - -const uniformEffector1 = uniform(-0.2); -const uniformEffector2 = uniform(-0.2); - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); - camera.position.set(4, 2, 4); - - scene = new THREE.Scene(); - scene.fog = new THREE.Fog(0x4195a4, 1, 20); - scene.backgroundNode = normalWorldGeometry.y.mix(color(0x4195a4), color(0x0066ff)); - camera.lookAt(0, 1, 0); - - const sunLight = new THREE.DirectionalLight(0xffe499, 2); - sunLight.position.set(7, 5, 7); - sunLight.castShadow = true; - sunLight.shadow.camera.zoom = 1.5; - sunLight.shadow.mapSize.set(1024, 1024); - sunLight.shadow.bias = -0.0001; // remove self-shadowing artifacts - scene.add(sunLight); - - const backLight = new THREE.DirectionalLight(0x0487e2, 0.5); - backLight.position.set(7, -5, 7); - scene.add(backLight); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const floorColor = await textureLoader.loadAsync('textures/floors/FloorsCheckerboard_S_Diffuse.jpg'); - floorColor.wrapS = THREE.RepeatWrapping; - floorColor.wrapT = THREE.RepeatWrapping; - floorColor.colorSpace = THREE.SRGBColorSpace; - floorColor.repeat.set(15, 15); - - const floorNormal = await textureLoader.loadAsync('textures/floors/FloorsCheckerboard_S_Normal.jpg'); - floorNormal.wrapS = THREE.RepeatWrapping; - floorNormal.wrapT = THREE.RepeatWrapping; - floorNormal.repeat.set(15, 15); - - // tree - - const treeMesh = createTreeMesh(); - treeMesh.castShadow = true; - treeMesh.receiveShadow = true; - scene.add(treeMesh); - - // floor - - const floorUV = uv().mul(15); - const floorNormalOffset = texture(floorNormal, floorUV).xy.mul(2).sub(1).mul(0.02); - - const reflection = reflector({ resolutionScale: 0.2 }); - reflection.target.rotateX(-Math.PI / 2); - reflection.uvNode = reflection.uvNode.add(floorNormalOffset); - scene.add(reflection.target); - - const floorMaterial = new THREE.MeshPhongNodeMaterial(); - floorMaterial.colorNode = texture(floorColor, floorUV); - floorMaterial.emissiveNode = reflection.mul(0.25); - floorMaterial.normalMap = floorNormal; - floorMaterial.normalScale.set(0.2, -0.2); - - const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); - floor.receiveShadow = true; - scene.add(floor); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 10; - controls.maxPolarAngle = Math.PI / 2; - controls.enableDamping = true; - controls.autoRotate = true; - controls.autoRotateSpeed = 1; - controls.target.set(0, 1, 0); - controls.update(); - - // post-processing - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode(); - const scenePassDepth = scenePass.getLinearDepthNode().remapClamp(0.3, 0.7); - - const scenePassColorBlurred = gaussianBlur(scenePassColor); - scenePassColorBlurred.directionNode = scenePassDepth; - - const vignette = screenUV.distance(0.5).mul(1.25).clamp().oneMinus().sub(0.2); - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = blendOverlay(scenePassColorBlurred, vignette); - - // tweens - - new TWEEN.Tween(uniformEffector1) - .to({ value: 1.2 }, 3000) - .delay(800) - .repeat(Infinity) - .easing(TWEEN.Easing.Sinusoidal.InOut) - .start(); - - new TWEEN.Tween(uniformEffector2) - .to({ value: 1.2 }, 3000) - .repeat(Infinity) - .easing(TWEEN.Easing.Sinusoidal.InOut) - .start(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - TWEEN.update(); - - renderPipeline.render(); -} - -function random() { - return (Math.random() - 0.5) * 2.0; -} - -function createTreeMesh() { - const maxSteps = 5; - const lengthMult = 0.8; - - const positions = []; - const normals = []; - const colors = []; - const data = []; // will save seed, size and time - - let instanceCount = 0; - - const newPosition = new THREE.Vector3(); - const position = new THREE.Vector3(); - const normal = new THREE.Vector3(); - const color = new THREE.Color(); - - function createTreePart(angle, x, y, z, length, count) { - if (Math.random() > (maxSteps / count) * 0.25) return; - - if (count < maxSteps) { - const newLength = length * lengthMult; - const newX = x + Math.cos(angle) * length; - const newY = y + Math.sin(angle) * length; - const countSq = Math.min(3.2, count * count); - const newZ = z + (Math.random() * countSq - countSq / 2) * length; - - let size = 30 - count * 8; - if (size > 25) size = 25; - if (size < 10) size = 10; - - size = size / 100; - - const subSteps = 50; - - // below loop generates the instanced data for a tree part - - for (let i = 0; i < subSteps; i++) { - instanceCount++; - - const percent = i / subSteps; - const extra = 1 / maxSteps; - - // position - - newPosition.set(x, y, z).lerp(new THREE.Vector3(newX, newY, newZ), percent); - position.copy(newPosition); - - position.x += random() * size * 3; - position.y += random() * size * 3; - position.z += random() * size * 3; - - positions.push(position.x, position.y, position.z); - - const scale = Math.random() + 5; - - // normal - - normal.copy(position).sub(newPosition).normalize(); - normals.push(normal.x, normal.y, normal.z); - - // color - - color.setHSL((count / maxSteps) * 0.5 + Math.random() * 0.05, 0.75, 0.6 + Math.random() * 0.1); - colors.push(color.r, color.g, color.b); - - // to save vertex buffers, we store the size, time and seed in a single attribute - - const instanceSize = size * scale; - const instanceTime = count / maxSteps + percent * extra; - const instanceSeed = Math.random(); - - data.push(instanceSize, instanceTime, instanceSeed); - } - - createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); - createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); - createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); - createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); - createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); - createTreePart(angle + random(), newX, newY, newZ, newLength + random(), count + 1); - } - } - - const angle = Math.PI * 0.5; - - // the tree is represented as a collection of instances boxes generated with below recursive function - - createTreePart(angle, 0, 0, 0, 16, 0); - - const geometry = new THREE.BoxGeometry(); - const material = new THREE.MeshStandardNodeMaterial(); - const mesh = new THREE.Mesh(geometry, material); - mesh.scale.setScalar(0.05); - mesh.count = instanceCount; - mesh.frustumCulled = false; - - // instanced data - - const attributePosition = new THREE.InstancedBufferAttribute(new Float32Array(positions), 3); - const attributeNormal = new THREE.InstancedBufferAttribute(new Float32Array(normals), 3); - const attributeColor = new THREE.InstancedBufferAttribute(new Float32Array(colors), 3); - const attributeData = new THREE.InstancedBufferAttribute(new Float32Array(data), 3); - - // TSL - - const instancePosition = instancedBufferAttribute(attributePosition); - const instanceNormal = instancedBufferAttribute(attributeNormal); - const instanceColor = instancedBufferAttribute(attributeColor); - const instanceData = instancedBufferAttribute(attributeData); - - material.positionNode = Fn(() => { - const instanceSize = instanceData.x; - const instanceTime = instanceData.y; - const instanceSeed = instanceData.z; - - // effectors (these are responsible for the blob-like scale effects) - - const dif1 = abs(instanceTime.sub(uniformEffector1)).toConst(); - let effect = dif1.lessThanEqual(0.15).select(sub(0.15, dif1).mul(sub(1.7, instanceTime).mul(10)), float(0)); - - const dif2 = abs(instanceTime.sub(uniformEffector2)).toConst(); - effect = dif2.lessThanEqual(0.15).select(sub(0.15, dif2).mul(sub(1.7, instanceTime).mul(10)), effect); - - // accumulate different vertex animations - - let animated = positionLocal.add(instancePosition).toVar(); - const direction = positionGeometry.normalize().toConst(); - - animated = animated.add(direction.mul(effect.add(instanceSize))); - animated = animated.sub(direction.mul(effect)); - animated = animated.add(instanceNormal.mul(effect.mul(1))); - animated = animated.add(instanceNormal.mul(abs(sin(time.add(instanceSeed.mul(2))).mul(1.5)))); - - return animated; - })(); - - const squareEdge = Fn(() => { - const pos = uv().sub(vec2(0.5, 0.5)); - const squareDistance = max(abs(pos.x), abs(pos.y)); - return squareDistance.div(0.5).clamp(0.85, 1).sub(0.5).mul(2.0); - })(); - - material.colorNode = Fn(() => { - return squareEdge.sub(instanceColor); - })(); - - material.emissiveNode = Fn(() => { - const instanceTime = instanceData.y; - - const dif1 = abs(instanceTime.sub(uniformEffector1)).toConst(); - const effect1 = dif1.lessThanEqual(0.15).select(sub(0.15, dif1).mul(sub(1.7, instanceTime).mul(10)), float(0)); - - const dif2 = abs(instanceTime.sub(uniformEffector2)).toConst(); - const effect2 = dif2.lessThanEqual(0.15).select(sub(0.15, dif2).mul(sub(1.7, instanceTime).mul(10)), effect1); - - return pow2(vec3(effect1, 0, effect2)).mul(instanceColor); - })(); - - return mesh; -} diff --git a/examples-testing/examples/webgpu_reflection_roughness.ts b/examples-testing/examples/webgpu_reflection_roughness.ts deleted file mode 100644 index 2b6b4a78d..000000000 --- a/examples-testing/examples/webgpu_reflection_roughness.ts +++ /dev/null @@ -1,121 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { Fn, vec2, vec4, texture, uv, textureBicubic, rangeFogFactor, reflector, time } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let controls; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.25, 30); - camera.position.set(-4, 1, 4); - - scene = new THREE.Scene(); - - const loader = new UltraHDRLoader(); - loader.load('textures/equirectangular/spruit_sunrise_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - texture.needsUpdate = true; - - scene.background = texture; - scene.environment = texture; - }); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const uvMap = textureLoader.load('textures/uv_grid_directx.jpg'); - uvMap.colorSpace = THREE.SRGBColorSpace; - - const perlinMap = textureLoader.load('./textures/noises/perlin/rgb-256x256.png'); - perlinMap.wrapS = THREE.RepeatWrapping; - perlinMap.wrapT = THREE.RepeatWrapping; - perlinMap.colorSpace = THREE.SRGBColorSpace; - - // uv box for debugging - - const mesh = new THREE.Mesh( - new THREE.BoxGeometry(1, 1, 1), - new THREE.MeshStandardNodeMaterial({ - map: uvMap, - roughnessMap: uvMap, - emissiveMap: uvMap, - emissive: 0xffffff, - }), - ); - mesh.position.set(0, 1.25, 0); - mesh.scale.setScalar(2); - scene.add(mesh); - - // reflection - - const reflection = reflector({ resolutionScale: 0.5, bounces: false, generateMipmaps: true }); // 0.5 is half of the rendering view - reflection.target.rotateX(-Math.PI / 2); - scene.add(reflection.target); - - const animatedUV = uv() - .mul(10) - .add(vec2(time.mul(0.1), 0)); - const roughness = texture(perlinMap, animatedUV).r.mul(2).saturate(); - - const floorMaterial = new THREE.MeshStandardNodeMaterial(); - floorMaterial.transparent = true; - floorMaterial.metalness = 1; - floorMaterial.roughnessNode = roughness.mul(0.2); - floorMaterial.colorNode = Fn(() => { - // blur reflection using textureBicubic() - const dirtyReflection = textureBicubic(reflection, roughness.mul(0.9)); - - // falloff opacity by distance like an opacity-fog - const opacity = rangeFogFactor(7, 25).oneMinus(); - - return vec4(dirtyReflection.rgb, opacity); - })(); - - const floor = new THREE.Mesh(new THREE.BoxGeometry(50, 0.001, 50), floorMaterial); - floor.position.set(0, 0, 0); - scene.add(floor); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1.5; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 1; - controls.maxDistance = 10; - controls.maxPolarAngle = Math.PI / 2; - controls.autoRotate = true; - controls.autoRotateSpeed = -0.1; - controls.target.set(0, 0.75, 0); - controls.update(); - - // events - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_refraction.ts b/examples-testing/examples/webgpu_refraction.ts deleted file mode 100644 index d475ed2de..000000000 --- a/examples-testing/examples/webgpu_refraction.ts +++ /dev/null @@ -1,144 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { viewportSafeUV, viewportSharedTexture, screenUV, texture, uv } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; - -let cameraControls; - -let smallSphere; - -init(); - -function init() { - // scene - scene = new THREE.Scene(); - - // camera - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500); - camera.position.set(0, 50, 160); - - // - - const geometry = new THREE.IcosahedronGeometry(5, 0); - const material = new THREE.MeshPhongMaterial({ color: 0xffffff, emissive: 0x7b7b7b, flatShading: true }); - smallSphere = new THREE.Mesh(geometry, material); - scene.add(smallSphere); - - // textures - - const loader = new THREE.TextureLoader(); - - const floorNormal = loader.load('textures/floors/FloorsCheckerboard_S_Normal.jpg'); - floorNormal.wrapS = THREE.RepeatWrapping; - floorNormal.wrapT = THREE.RepeatWrapping; - - // refractor - - const verticalNormalScale = 0.1; - const verticalUVOffset = texture(floorNormal, uv().mul(5)).xy.mul(2).sub(1).mul(verticalNormalScale); - - const refractorUV = screenUV.add(verticalUVOffset); - const verticalRefractor = viewportSharedTexture(viewportSafeUV(refractorUV)).toInspector('Viewport Texture'); - - const planeGeo = new THREE.PlaneGeometry(100.1, 100.1); - - const planeRefractor = new THREE.Mesh( - planeGeo, - new THREE.MeshBasicNodeMaterial({ - backdropNode: verticalRefractor, - }), - ); - planeRefractor.material.transparent = true; - planeRefractor.position.y = 50; - scene.add(planeRefractor); - - // walls - - const planeTop = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeTop.position.y = 100; - planeTop.rotateX(Math.PI / 2); - scene.add(planeTop); - - const planeBottom = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xffffff })); - planeBottom.rotateX(-Math.PI / 2); - scene.add(planeBottom); - - const planeBack = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x7f7fff })); - planeBack.position.z = -50; - planeBack.position.y = 50; - scene.add(planeBack); - - const planeRight = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0x00ff00 })); - planeRight.position.x = 50; - planeRight.position.y = 50; - planeRight.rotateY(-Math.PI / 2); - scene.add(planeRight); - - const planeLeft = new THREE.Mesh(planeGeo, new THREE.MeshPhongMaterial({ color: 0xff0000 })); - planeLeft.position.x = -50; - planeLeft.position.y = 50; - planeLeft.rotateY(Math.PI / 2); - scene.add(planeLeft); - - // lights - - const mainLight = new THREE.PointLight(0xe7e7e7, 2.5, 250, 0); - mainLight.position.y = 60; - scene.add(mainLight); - - const greenLight = new THREE.PointLight(0x00ff00, 0.5, 1000, 0); - greenLight.position.set(550, 50, 0); - scene.add(greenLight); - - const redLight = new THREE.PointLight(0xff0000, 0.5, 1000, 0); - redLight.position.set(-550, 50, 0); - scene.add(redLight); - - const blueLight = new THREE.PointLight(0xbbbbfe, 0.5, 1000, 0); - blueLight.position.set(0, 50, 550); - scene.add(blueLight); - - // renderer - - renderer = new THREE.WebGPURenderer(/*{ antialias: true }*/); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - cameraControls = new OrbitControls(camera, renderer.domElement); - cameraControls.target.set(0, 50, 0); - cameraControls.maxDistance = 400; - cameraControls.minDistance = 10; - cameraControls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const timer = Date.now() * 0.01; - - smallSphere.position.set( - Math.cos(timer * 0.1) * 30, - Math.abs(Math.cos(timer * 0.2)) * 20 + 5, - Math.sin(timer * 0.1) * 30, - ); - smallSphere.rotation.y = Math.PI / 2 - timer * 0.1; - smallSphere.rotation.z = timer * 0.8; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts b/examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts deleted file mode 100644 index 627fd6b18..000000000 --- a/examples-testing/examples/webgpu_rendertarget_2d-array_3d.ts +++ /dev/null @@ -1,237 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { vec2, uniform, screenUV, color, texture, diffuseColor, attribute, vec3, vec4 } from 'three/tsl'; - -import { TextureHelper } from 'three/addons/helpers/TextureHelperGPU.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { unzipSync } from 'three/addons/libs/fflate.module.js'; - -let renderer; -let views = []; - -class View { - constructor(left, top, width, height) { - this.left = left; - this.top = top; - this.width = width; - this.height = height; - - const aspect = (window.innerWidth * width) / (window.innerHeight * height); - - // Set up perspective camera - this.camera = new THREE.PerspectiveCamera(50, aspect, 0.1, 100); - this.camera.position.set(-7, 0, 10); - this.camera.lookAt(0, 0, 0); - this.camera.updateProjectionMatrix(); - - this.scene = new THREE.Scene(); - - const normalizedUV = screenUV.mul(vec2(1, -1)).add(vec2(0, 1)); // Flip Y and offset - - // Calculate viewport center in normalized coordinates - const viewportCenter = vec2( - this.left + this.width * 0.5, - this.top + this.height * 0.5, // Invert Y coordinate for proper alignment - ); - - const distanceEffect = normalizedUV.distance(viewportCenter).smoothstep(0, 0.2); - - const backgroundEffect = color(this.top > 0 ? 0x212121 : 0x616161).sub(distanceEffect.pow(0.3).mul(0.1)); - - this.scene.backgroundNode = backgroundEffect; - } - - // Method to handle viewport resize - updateSize(left, top, width, height) { - this.left = left; - this.top = top; - this.width = width; - this.height = height; - - const aspect = (window.innerWidth * width) / (window.innerHeight * height); - this.camera.aspect = aspect; - this.camera.updateProjectionMatrix(); - } -} - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.autoClear = false; - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - await renderer.init(); - - // Create views after renderer initialization - views = [ - new View(0.0, 0.0, 0.5, 0.5), - new View(0.5, 0.0, 0.5, 0.5), - new View(0.0, 0.5, 0.5, 0.5), - new View(0.5, 0.5, 0.5, 0.5), - ]; - - // Add OrbitControls after views and renderer are created - views.forEach(view => { - view.controls = new OrbitControls(view.camera, renderer.domElement); - view.controls.minDistance = 1; - view.controls.maxDistance = 20; - view.controls.minAzimuthAngle = -Math.PI / 3; - view.controls.maxAzimuthAngle = Math.PI / 3; - view.controls.minPolarAngle = Math.PI / 4; - view.controls.maxPolarAngle = Math.PI / 1.25; - view.controls.enableDamping = true; - }); - - const size = { - width: 256, - height: 256, - depth: 109, - }; - - new THREE.FileLoader().setResponseType('arraybuffer').load('textures/3d/head256x256x109.zip', function (data) { - const zip = unzipSync(new Uint8Array(data)); - const array = new Uint8Array(zip['head256x256x109'].buffer); - - const map3D = new THREE.Data3DTexture(array, size.width, size.height, size.depth); - map3D.name = 'Data3DTexture'; - map3D.format = THREE.RedFormat; - map3D.minFilter = THREE.LinearFilter; - map3D.magFilter = THREE.LinearFilter; - map3D.unpackAlignment = 1; - map3D.needsUpdate = true; - - const depth = size.depth / 20; - - // 3D - const helper3D = new TextureHelper(map3D, 10, 10, depth); - helper3D.material.outputNode = vec4( - vec3(diffuseColor.r.mul(attribute('uvw').z.mul(diffuseColor.r))), - diffuseColor.r.mul(diffuseColor.a), - ); - views[1].scene.add(helper3D); - - const fbo3D = new THREE.RenderTarget3D(size.width, size.height, size.depth, { - depthBuffer: false, - }); - fbo3D.texture.name = 'RenderTarget3D'; - - const fbo3DHelper = new TextureHelper(fbo3D.texture, 10, 10, depth); - fbo3DHelper.material.outputNode = vec4(vec3(diffuseColor.r), diffuseColor.r); - views[3].scene.add(fbo3DHelper); - - // 2D Array - - const mapArray = new THREE.DataArrayTexture(array, size.width, size.height, size.depth); - mapArray.name = 'DataArrayTexture'; - mapArray.format = THREE.RedFormat; - mapArray.minFilter = THREE.LinearFilter; - mapArray.magFilter = THREE.LinearFilter; - mapArray.unpackAlignment = 1; - mapArray.needsUpdate = true; - - const helperArray = new TextureHelper(mapArray, 10, 10, depth); - helperArray.material.outputNode = vec4( - vec3(diffuseColor.r.mul(attribute('uvw').z.div(size.depth).mul(diffuseColor.r))), - diffuseColor.r.mul(diffuseColor.a), - ); - views[0].scene.add(helperArray); - - // Setup render targets - const materialQuad = new THREE.NodeMaterial(); - const uZCoord = uniform(0); - materialQuad.depthTest = false; - materialQuad.outputNode = vec4(texture(mapArray).depth(uZCoord).rgb, 1); - - const fboArray = new THREE.RenderTarget(size.width, size.height, { - depthBuffer: false, - depth: size.depth, - }); - fboArray.texture.name = 'RenderTargetArray'; - - const fboArrayHelper = new TextureHelper(fboArray.texture, 10, 10, depth); - fboArrayHelper.material.outputNode = vec4(vec3(diffuseColor.r), diffuseColor.r); - views[2].scene.add(fboArrayHelper); - - const quadMesh = new THREE.QuadMesh(materialQuad); - - // In WebGPU we need to clear all the layers of the 3D render target before rendering to it (WebGPU limitation?) - if (renderer.backend.isWebGPUBackend) { - const materialClear = new THREE.NodeMaterial(); - materialClear.outputNode = vec4(0); - const clearQuadMesh = new THREE.QuadMesh(materialClear); - for (let i = 0; i < size.depth; i++) { - renderer.setRenderTarget(fbo3D, i); - clearQuadMesh.render(renderer); - } - } - - let j = 0; - - const loop = () => { - if (j === size.depth) { - clearInterval(interval); - return; - } - - // Disable viewport and scissor for FBO rendering - renderer.setViewport(0, 0, size.width, size.height); - renderer.setScissor(0, 0, size.width, size.height); - renderer.setScissorTest(false); - - uZCoord.value = j; - - renderer.setRenderTarget(fboArray, j); - renderer.clear(); - quadMesh.render(renderer); - - renderer.setRenderTarget(fbo3D, j); - renderer.clear(); - quadMesh.render(renderer); - - renderer.setRenderTarget(null); - - j = (j + 1) % size.depth; - }; - - const interval = setInterval(loop, 50); - - loop(); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - renderer.setSize(width, height); - - views.forEach(view => { - view.updateSize(view.left, view.top, view.width, view.height); - }); -} - -function animate() { - views.forEach(view => { - view.controls.update(); - - const left = Math.floor(view.left * window.innerWidth); - const bottom = Math.floor((1 - view.top - view.height) * window.innerHeight); - const width = Math.floor(view.width * window.innerWidth); - const height = Math.floor(view.height * window.innerHeight); - - renderer.setViewport(left, bottom, width, height); - renderer.setScissor(left, bottom, width, height); - renderer.setScissorTest(true); - - renderer.clear(); - renderer.render(view.scene, view.camera); - }); -} - -init(); diff --git a/examples-testing/examples/webgpu_reversed_depth_buffer.ts b/examples-testing/examples/webgpu_reversed_depth_buffer.ts deleted file mode 100644 index d159748f5..000000000 --- a/examples-testing/examples/webgpu_reversed_depth_buffer.ts +++ /dev/null @@ -1,169 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; - -let camera, reversedCamera, scene; -let normalRenderer, logarithmicRenderer, reverseRenderer; -let normalRenderPipeline, logarithmicRenderPipeline, reverseRenderPipeline; -const meshes = []; - -init().then(animate); - -async function init() { - camera = new THREE.PerspectiveCamera(72, (0.33 * window.innerWidth) / window.innerHeight, 5, 9999); - camera.position.z = 12; - - reversedCamera = camera.clone(); - - scene = new THREE.Scene(); - - const xCount = 1; - const yCount = 5; - const numInstances = xCount * yCount; - - const d = 0.0001; // half distance between two planes - const o = 0.5; // half x offset to shift planes so they are only partially overlapping - - const positions = new Float32Array([ - -1 - o, - -1, - d, - 1 - o, - -1, - d, - -1 - o, - 1, - d, - 1 - o, - -1, - d, - 1 - o, - 1, - d, - -1 - o, - 1, - d, - - -1 + o, - -1, - -d, - 1 + o, - -1, - -d, - -1 + o, - 1, - -d, - 1 + o, - -1, - -d, - 1 + o, - 1, - -d, - -1 + o, - 1, - -d, - ]); - - const colors = new Float32Array([ - 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, - - 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, - ]); - - const geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.BufferAttribute(positions, 3)); - geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3)); - - const material = new THREE.MeshBasicMaterial({ vertexColors: true }); - - for (let i = 0; i < numInstances; i++) { - const mesh = new THREE.Mesh(geometry, material); - meshes.push(mesh); - scene.add(mesh); - } - - let i = 0; - for (let x = 0; x < xCount; x++) { - for (let y = 0; y < yCount; y++) { - const z = -800 * i; - const s = 1 + 50 * i; - - const mesh = meshes[i]; - mesh.position.set(x - xCount / 2 + 0.5, (4.0 - 0.2 * z) * (y - yCount / 2 + 1.0), z); - mesh.scale.setScalar(s); - - i++; - } - } - - const normalContainer = document.getElementById('container_normal'); - normalRenderer = new THREE.WebGPURenderer(); - normalRenderer.setPixelRatio(window.devicePixelRatio); - normalRenderer.setSize(0.33 * window.innerWidth, window.innerHeight); - normalRenderer.domElement.style.position = 'relative'; - normalContainer.appendChild(normalRenderer.domElement); - - const logarithmicContainer = document.getElementById('container_logarithmic'); - logarithmicRenderer = new THREE.WebGPURenderer({ logarithmicDepthBuffer: true }); - logarithmicRenderer.setPixelRatio(window.devicePixelRatio); - logarithmicRenderer.setSize(0.33 * window.innerWidth, window.innerHeight); - logarithmicRenderer.domElement.style.position = 'relative'; - logarithmicContainer.appendChild(logarithmicRenderer.domElement); - - const reverseContainer = document.getElementById('container_reverse'); - reverseRenderer = new THREE.WebGPURenderer({ reversedDepthBuffer: true }); - reverseRenderer.setPixelRatio(window.devicePixelRatio); - reverseRenderer.setSize(0.33 * window.innerWidth, window.innerHeight); - reverseRenderer.domElement.style.position = 'relative'; - reverseContainer.appendChild(reverseRenderer.domElement); - - // - - normalRenderPipeline = new THREE.RenderPipeline(normalRenderer); - normalRenderPipeline.outputNode = pass(scene, camera); - - logarithmicRenderPipeline = new THREE.RenderPipeline(logarithmicRenderer); - logarithmicRenderPipeline.outputNode = pass(scene, camera); - - reverseRenderPipeline = new THREE.RenderPipeline(reverseRenderer); - reverseRenderPipeline.outputNode = pass(scene, reversedCamera); - - await Promise.all([normalRenderer.init(), logarithmicRenderer.init(), reverseRenderer.init()]); - - window.addEventListener('resize', onWindowResize); - onWindowResize(); -} - -function animate() { - requestAnimationFrame(animate); - - const now = performance.now() / 1000; - - for (let i = 0; i < meshes.length; i++) { - const angle = THREE.MathUtils.degToRad(30); - const axis = new THREE.Vector3(Math.sin(now), Math.cos(now), 0); - meshes[i].quaternion.setFromAxisAngle(axis, angle); - } - - render(); -} - -function render() { - normalRenderPipeline.render(); - logarithmicRenderPipeline.render(); - reverseRenderPipeline.render(); -} - -function onWindowResize() { - const width = 0.33 * window.innerWidth; - const height = window.innerHeight; - - normalRenderer.setSize(width, height); - logarithmicRenderer.setSize(width, height); - reverseRenderer.setSize(width, height); - - camera.aspect = (0.33 * window.innerWidth) / window.innerHeight; - camera.updateProjectionMatrix(); - - reversedCamera.aspect = (0.33 * window.innerWidth) / window.innerHeight; - reversedCamera.updateProjectionMatrix(); -} diff --git a/examples-testing/examples/webgpu_rtt.ts b/examples-testing/examples/webgpu_rtt.ts deleted file mode 100644 index fa7577ea8..000000000 --- a/examples-testing/examples/webgpu_rtt.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture, uniform, saturation, hue } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -const mouse = new THREE.Vector2(); - -let quadMesh, renderTarget; - -let box; - -const dpr = window.devicePixelRatio; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.z = 3; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x0066ff); - - // textured mesh - - const loader = new THREE.TextureLoader(); - const uvTexture = loader.load('./textures/uv_grid_opengl.jpg'); - - const geometryBox = new THREE.BoxGeometry(); - const materialBox = new THREE.MeshBasicNodeMaterial(); - materialBox.colorNode = texture(uvTexture); - - // - - box = new THREE.Mesh(geometryBox, materialBox); - scene.add(box); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(dpr); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderer.inspector = new Inspector(); - - renderTarget = new THREE.RenderTarget(window.innerWidth * dpr, window.innerHeight * dpr); - - window.addEventListener('mousemove', onWindowMouseMove); - window.addEventListener('resize', onWindowResize); - - // FX - - // modulate the final color based on the mouse position - - const screenFXNode = uniform(mouse); - - const materialFX = new THREE.MeshBasicNodeMaterial(); - - const scenePassTexture = texture(renderTarget.texture).toInspector('Scene Pass'); - materialFX.colorNode = hue(saturation(scenePassTexture.rgb, screenFXNode.x.oneMinus()), screenFXNode.y); - - quadMesh = new THREE.QuadMesh(materialFX); - quadMesh.name = 'Post-Processing'; -} - -function onWindowMouseMove(e) { - mouse.x = e.offsetX / window.innerWidth; - mouse.y = e.offsetY / window.innerHeight; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); - renderTarget.setSize(window.innerWidth * dpr, window.innerHeight * dpr); -} - -function animate() { - box.rotation.x += 0.01; - box.rotation.y += 0.02; - - renderer.setRenderTarget(renderTarget); - renderer.render(scene, camera); - - renderer.setRenderTarget(null); - quadMesh.render(renderer); -} diff --git a/examples-testing/examples/webgpu_shadow_contact.ts b/examples-testing/examples/webgpu_shadow_contact.ts deleted file mode 100644 index ac3e4fbd8..000000000 --- a/examples-testing/examples/webgpu_shadow_contact.ts +++ /dev/null @@ -1,205 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { vec3, uniform, texture, depth, float } from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let shadowCamera, shadowGroup; -let renderTarget; -let plane, fillPlane, cameraHelper; -let depthMaterial, shadowPlaneMaterial, fillPlaneMaterial; - -const meshes = []; - -const PLANE_WIDTH = 2.5; -const PLANE_HEIGHT = 2.5; -const CAMERA_HEIGHT = 0.3; - -const state = { - shadow: { blur: 3.5, darkness: 1.0, opacity: 1.0 }, - plane: { color: '#ffffff', opacity: 1.0 }, - showWireframe: false, -}; - -const uBlur = uniform(state.shadow.blur); -const uDarkness = uniform(state.shadow.darkness); -const uShadowOpacity = uniform(state.shadow.opacity); -const uPlaneOpacity = uniform(state.plane.opacity); -const uPlaneColor = uniform(new THREE.Color(state.plane.color)); -const uPlaneY = uniform(-0.3); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0.5, 1, 2); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - window.addEventListener('resize', onWindowResize); - - const geometries = [ - new THREE.BoxGeometry(0.4, 0.4, 0.4), - new THREE.IcosahedronGeometry(0.3), - new THREE.TorusKnotGeometry(0.4, 0.05, 256, 24, 1, 3), - ]; - - const material = new THREE.MeshNormalMaterial(); - - for (let i = 0, l = geometries.length; i < l; i++) { - const angle = (i / l) * Math.PI * 2; - const mesh = new THREE.Mesh(geometries[i], material); - mesh.position.y = 0.1; - mesh.position.x = Math.cos(angle) / 2.0; - mesh.position.z = Math.sin(angle) / 2.0; - scene.add(mesh); - meshes.push(mesh); - } - - shadowGroup = new THREE.Group(); - shadowGroup.position.y = uPlaneY.value; - scene.add(shadowGroup); - - renderTarget = new THREE.RenderTarget(512, 512, { depthBuffer: true }); - renderTarget.texture.generateMipmaps = false; - - const planeGeometry = new THREE.PlaneGeometry(PLANE_WIDTH, PLANE_HEIGHT).rotateX(Math.PI / 2); - - depthMaterial = new THREE.NodeMaterial(); - - const alphaDepth = float(1).sub(depth).mul(uDarkness); - - depthMaterial.colorNode = vec3(0); - depthMaterial.opacityNode = alphaDepth; - depthMaterial.depthTest = false; - depthMaterial.depthWrite = false; - - shadowPlaneMaterial = new THREE.NodeMaterial(); - shadowPlaneMaterial.transparent = true; - shadowPlaneMaterial.depthWrite = false; - - if (!renderTarget.texture.image) renderTarget.texture.image = { width: 512, height: 512 }; - - const blurredShadow = gaussianBlur(texture(renderTarget.texture), uBlur, 4, { premultipliedAlpha: false }); - shadowPlaneMaterial.colorNode = vec3(0); - shadowPlaneMaterial.opacityNode = blurredShadow.a.mul(uShadowOpacity); - - plane = new THREE.Mesh(planeGeometry, shadowPlaneMaterial); - plane.renderOrder = 1; - plane.scale.y = -1; - plane.scale.z = -1; - shadowGroup.add(plane); - - fillPlaneMaterial = new THREE.NodeMaterial(); - fillPlaneMaterial.transparent = true; - fillPlaneMaterial.depthWrite = false; - fillPlaneMaterial.colorNode = uPlaneColor; - fillPlaneMaterial.opacityNode = uPlaneOpacity; - fillPlane = new THREE.Mesh(planeGeometry, fillPlaneMaterial); - fillPlane.rotateX(Math.PI); - shadowGroup.add(fillPlane); - - shadowCamera = new THREE.OrthographicCamera( - -PLANE_WIDTH / 2, - PLANE_WIDTH / 2, - PLANE_HEIGHT / 2, - -PLANE_HEIGHT / 2, - 0, - CAMERA_HEIGHT, - ); - shadowCamera.rotation.x = Math.PI / 2; - shadowGroup.add(shadowCamera); - - cameraHelper = new THREE.CameraHelper(shadowCamera); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - renderer.inspector = new Inspector(); - - const params = { - shadowBlur: state.shadow.blur, - shadowDarkness: state.shadow.darkness, - shadowOpacity: state.shadow.opacity, - planeColor: state.plane.color, - planeOpacity: state.plane.opacity, - showWireframe: state.showWireframe, - }; - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(params, 'shadowBlur', 0, 15, 0.1).onChange(() => { - state.shadow.blur = params.shadowBlur; - uBlur.value = state.shadow.blur; - }); - - gui.add(params, 'shadowDarkness', 0.1, 5, 0.1).onChange(() => { - state.shadow.darkness = params.shadowDarkness; - uDarkness.value = state.shadow.darkness; - }); - - gui.add(params, 'shadowOpacity', 0, 1, 0.01).onChange(() => { - state.shadow.opacity = params.shadowOpacity; - uShadowOpacity.value = state.shadow.opacity; - }); - - gui.addColor(params, 'planeColor').onChange(() => { - state.plane.color = params.planeColor; - uPlaneColor.value.set(state.plane.color); - }); - - gui.add(params, 'planeOpacity', 0, 1, 0.01).onChange(() => { - state.plane.opacity = params.planeOpacity; - uPlaneOpacity.value = state.plane.opacity; - }); - - gui.add(params, 'showWireframe').onChange(() => { - if (params.showWireframe) scene.add(cameraHelper); - else scene.remove(cameraHelper); - }); - - new OrbitControls(camera, renderer.domElement); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - meshes.forEach(m => { - m.rotation.x += 0.01; - m.rotation.y += 0.02; - }); - - const initialBackground = scene.background; - scene.background = null; - - const prevOverride = scene.overrideMaterial; - const prevHelperVisible = cameraHelper.visible; - cameraHelper.visible = false; - scene.overrideMaterial = depthMaterial; - const initialAutoClear = renderer.autoClear; - renderer.autoClear = true; - const initialClearAlpha = renderer.getClearAlpha ? renderer.getClearAlpha() : undefined; - if (initialClearAlpha !== undefined) renderer.setClearAlpha(0); - - renderer.setRenderTarget(renderTarget); - renderer.clear(); - renderer.render(scene, shadowCamera); - - scene.overrideMaterial = prevOverride; - renderer.setRenderTarget(null); - renderer.autoClear = initialAutoClear; - if (initialClearAlpha !== undefined) renderer.setClearAlpha(initialClearAlpha); - scene.background = initialBackground; - cameraHelper.visible = prevHelperVisible; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_shadowmap.ts b/examples-testing/examples/webgpu_shadowmap.ts deleted file mode 100644 index f6edec750..000000000 --- a/examples-testing/examples/webgpu_shadowmap.ts +++ /dev/null @@ -1,166 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mx_fractal_noise_float, mx_fractal_noise_vec3, positionLocal, positionWorld, Fn, color } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, timer; -let dirLight, spotLight; -let torusKnot, dirGroup; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 10, 20); - - scene = new THREE.Scene(); - scene.backgroundNode = color(0x222244); - scene.fog = new THREE.Fog(0x222244, 50, 100); - - // lights - - scene.add(new THREE.AmbientLight(0x444444, 2)); - - spotLight = new THREE.SpotLight(0xff8888, 400); - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.3; - spotLight.position.set(8, 10, 5); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 8; - spotLight.shadow.camera.far = 200; - spotLight.shadow.mapSize.width = 2048; - spotLight.shadow.mapSize.height = 2048; - spotLight.shadow.radius = 4; - scene.add(spotLight); - - dirLight = new THREE.DirectionalLight(0x8888ff, 3); - dirLight.position.set(3, 12, 17); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = 500; - dirLight.shadow.camera.right = 17; - dirLight.shadow.camera.left = -17; - dirLight.shadow.camera.top = 17; - dirLight.shadow.camera.bottom = -17; - dirLight.shadow.mapSize.width = 2048; - dirLight.shadow.mapSize.height = 2048; - dirLight.shadow.radius = 4; - - dirGroup = new THREE.Group(); - dirGroup.add(dirLight); - scene.add(dirGroup); - - // geometry - - const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 80); - const material = new THREE.MeshPhongNodeMaterial({ - color: 0x999999, - shininess: 0, - specular: 0x222222, - }); - - const materialCustomShadow = material.clone(); - materialCustomShadow.transparent = true; - - const discardNode = mx_fractal_noise_float(positionLocal.mul(0.1)).x.greaterThan(0.0); - - materialCustomShadow.maskNode = discardNode; - - torusKnot = new THREE.Mesh(geometry, materialCustomShadow); - torusKnot.scale.multiplyScalar(1 / 18); - torusKnot.position.y = 3; - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); - - const pillar1 = new THREE.Mesh(cylinderGeometry, material); - pillar1.position.set(8, 3.5, 8); - pillar1.castShadow = true; - - const pillar2 = pillar1.clone(); - pillar2.position.set(8, 3.5, -8); - const pillar3 = pillar1.clone(); - pillar3.position.set(-8, 3.5, 8); - const pillar4 = pillar1.clone(); - pillar4.position.set(-8, 3.5, -8); - - scene.add(pillar1); - scene.add(pillar2); - scene.add(pillar3); - scene.add(pillar4); - - const planeGeometry = new THREE.PlaneGeometry(200, 200); - - const planeMaterial = new THREE.MeshPhongNodeMaterial(); - planeMaterial.color.setHex(0x999999); - planeMaterial.shininess = 0; - planeMaterial.specular.setHex(0x111111); - - planeMaterial.receivedShadowPositionNode = Fn(() => { - const pos = positionWorld.toVar(); - pos.xz.addAssign(mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().xz); - return pos; - })(); - - planeMaterial.colorNode = Fn(() => { - const pos = positionWorld.toVar(); - pos.xz.addAssign(mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().xz); - return mx_fractal_noise_vec3(positionWorld.mul(2)).saturate().zzz.mul(0.2).add(0.5); - })(); - - const ground = new THREE.Mesh(planeGeometry, planeMaterial); - ground.rotation.x = -Math.PI / 2; - ground.scale.multiplyScalar(3); - ground.castShadow = true; - ground.receiveShadow = true; - scene.add(ground); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // Mouse control - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2, 0); - controls.minDistance = 7; - controls.maxDistance = 40; - controls.update(); - - timer = new THREE.Timer(); - timer.connect(document); - - window.addEventListener('resize', resize); -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(time) { - timer.update(); - - const delta = timer.getDelta(); - - torusKnot.rotation.x += 0.25 * delta; - torusKnot.rotation.y += 0.5 * delta; - torusKnot.rotation.z += 1 * delta; - - dirGroup.rotation.y += 0.7 * delta; - dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_shadowmap_array.ts b/examples-testing/examples/webgpu_shadowmap_array.ts deleted file mode 100644 index 03c7f2a45..000000000 --- a/examples-testing/examples/webgpu_shadowmap_array.ts +++ /dev/null @@ -1,329 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mx_fractal_noise_vec3, positionWorld, Fn, color } from 'three/tsl'; - -import { TileShadowNode } from 'three/addons/tsl/shadows/TileShadowNode.js'; -import { TileShadowNodeHelper } from 'three/addons/tsl/shadows/TileShadowNodeHelper.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, timer; -let dirLight; -let torusKnot, dirGroup; -let tsmHelper; - -init(); - -async function init() { - // Renderer setup - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - renderer.inspector = new Inspector(); - - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.BasicShadowMap; - - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.2; - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(45, 60, 100); - - scene = new THREE.Scene(); - scene.backgroundNode = color(0xccccff); // Brighter blue sky - scene.fog = new THREE.Fog(0xccccff, 700, 1000); - - // Enhanced lighting for a brighter scene - scene.add(new THREE.AmbientLight(0xccccff, 3)); - - // Main directional light (sun) - dirLight = new THREE.DirectionalLight(0xffffaa, 5); - dirLight.position.set(0, 80, 30); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 1; - dirLight.shadow.camera.far = 200; - dirLight.shadow.camera.right = 180; - dirLight.shadow.camera.left = -180; - dirLight.shadow.camera.top = 180; - dirLight.shadow.camera.bottom = -160; - dirLight.shadow.mapSize.width = 1024 * 4; - dirLight.shadow.mapSize.height = 1024 * 4; - dirLight.shadow.radius = 1; - - // Set up the tile shadow mapping - const tsm = new TileShadowNode(dirLight, { - tilesX: 2, - tilesY: 2, - }); - - dirLight.shadow.shadowNode = tsm; - scene.add(dirLight); - - tsmHelper = new TileShadowNodeHelper(tsm); - scene.add(tsmHelper); - - dirGroup = new THREE.Group(); - dirGroup.add(dirLight); - scene.add(dirGroup); - - // Create the ground with enhanced texture - const planeGeometry = new THREE.PlaneGeometry(1500, 1500, 2, 2); - const planeMaterial = new THREE.MeshPhongMaterial({ - color: 0x88aa44, - shininess: 5, - specular: 0x222222, - }); - - planeMaterial.colorNode = Fn(() => { - const noise = mx_fractal_noise_vec3(positionWorld.mul(0.05)).saturate(); - // Mix of greens and browns for a more natural ground - const green = color(0.4, 0.7, 0.3); - const brown = color(0.6, 0.5, 0.3); - return noise.x.mix(green, brown); - })(); - - const ground = new THREE.Mesh(planeGeometry, planeMaterial); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - // Spread various objects across the scene - createScenery(); - - // Camera controls - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 5, 0); - controls.minDistance = 0.01; - controls.maxDistance = 400; - controls.maxPolarAngle = Math.PI / 2 - 0.1; // Prevent camera from going below ground - controls.update(); - - timer = new THREE.Timer(); - timer.connect(document); - - window.addEventListener('resize', resize); -} - -function createScenery() { - // 1. Columns using instanced mesh - const columnGeometry = new THREE.CylinderGeometry(0.8, 1, 1, 16); - const columnMaterial = new THREE.MeshPhongMaterial({ - color: 0xdddddd, - shininess: 20, - }); - - const columnPositions = []; - const columnScales = []; - - for (let x = -100; x <= 100; x += 40) { - for (let z = -100; z <= 100; z += 40) { - if (Math.random() > 0.3) { - const height = 5 + Math.random() * 10; - const posX = x + (Math.random() * 10 - 5); - const posY = height / 2; - const posZ = z + (Math.random() * 10 - 5); - - columnPositions.push(posX, posY, posZ); - columnScales.push(1, height, 1); // Only scale Y to match height - } - } - } - - const columnCount = columnPositions.length / 3; - const columnInstancedMesh = new THREE.InstancedMesh(columnGeometry, columnMaterial, columnCount); - - const matrix = new THREE.Matrix4(); - for (let i = 0; i < columnCount; i++) { - const x = columnPositions[i * 3]; - const y = columnPositions[i * 3 + 1]; - const z = columnPositions[i * 3 + 2]; - const scaleY = columnScales[i * 3 + 1]; - - matrix.makeScale(1, scaleY, 1); - matrix.setPosition(x, y, z); - columnInstancedMesh.setMatrixAt(i, matrix); - } - - columnInstancedMesh.castShadow = true; - columnInstancedMesh.receiveShadow = true; - scene.add(columnInstancedMesh); - - // 2. Add a central feature - the torus knot (kept as regular mesh for animation) - const torusKnotGeometry = new THREE.TorusKnotGeometry(25, 8, 100, 30); - const torusKnotMaterial = new THREE.MeshPhongNodeMaterial({ - color: 0xff6347, // Tomato color - shininess: 30, - }); - - torusKnot = new THREE.Mesh(torusKnotGeometry, torusKnotMaterial); - torusKnot.scale.multiplyScalar(1 / 18); - torusKnot.position.x = 5; - torusKnot.position.y = 5; - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - // 3. Cubes using instanced mesh - const cubeGeometry = new THREE.BoxGeometry(3, 3, 3); - const cubeMaterials = [ - new THREE.MeshPhongMaterial({ color: 0x6699cc, shininess: 20 }), - new THREE.MeshPhongMaterial({ color: 0xcc6666, shininess: 20 }), - new THREE.MeshPhongMaterial({ color: 0xcccc66, shininess: 20 }), - ]; - - const cubeCount = 10; - const cubeInstances = cubeMaterials.map(material => { - return new THREE.InstancedMesh(cubeGeometry, material, cubeCount); - }); - - for (let i = 0; i < 30; i++) { - const materialIndex = i % 3; - const instanceIndex = Math.floor(i / 3); - - const x = Math.random() * 300 - 150; - const y = 1.5; - const z = Math.random() * 300 - 150; - const rotY = Math.random() * Math.PI * 2; - - matrix.makeRotationY(rotY); - matrix.setPosition(x, y, z); - - cubeInstances[materialIndex].setMatrixAt(instanceIndex, matrix); - } - - cubeInstances.forEach(instance => { - instance.castShadow = true; - instance.receiveShadow = true; - scene.add(instance); - }); - - // 4. Spheres using instanced mesh - const sphereGeometry = new THREE.SphereGeometry(2, 32, 32); - const sphereMaterial = new THREE.MeshPhongMaterial({ - color: 0x88ccaa, - shininess: 40, - }); - - const sphereCount = 25; - const sphereInstancedMesh = new THREE.InstancedMesh(sphereGeometry, sphereMaterial, sphereCount); - - for (let i = 0; i < sphereCount; i++) { - const x = Math.random() * 180 - 90; - const y = 2; - const z = Math.random() * 180 - 90; - - matrix.makeScale(1, 1, 1); - matrix.setPosition(x, y, z); - sphereInstancedMesh.setMatrixAt(i, matrix); - } - - sphereInstancedMesh.castShadow = true; - sphereInstancedMesh.receiveShadow = true; - scene.add(sphereInstancedMesh); - - // 5. Trees using instanced mesh for trunks and tops separately - const trunkGeometry = new THREE.CylinderGeometry(0.5, 0.5, 2, 8); - const topGeometry = new THREE.ConeGeometry(2, 8, 8); - const treeMaterial = new THREE.MeshPhongMaterial({ - vertexColors: true, - shininess: 5, - }); - - const treeCount = 40; - const totalInstanceCount = treeCount * 2; - - const trunkVertexCount = trunkGeometry.attributes.position.count; - const trunkIndexCount = trunkGeometry.index ? trunkGeometry.index.count : 0; - const topVertexCount = topGeometry.attributes.position.count; - const topIndexCount = topGeometry.index ? topGeometry.index.count : 0; - - const totalVertexCount = (trunkVertexCount + topVertexCount) * 2; // Multiple for safety - const totalIndexCount = (trunkIndexCount + topIndexCount) * 2; - const treeBatchedMesh = new THREE.BatchedMesh(totalInstanceCount, totalVertexCount, totalIndexCount, treeMaterial); - treeBatchedMesh.castShadow = true; - treeBatchedMesh.perObjectFrustumCulled = false; - const trunkGeometryId = treeBatchedMesh.addGeometry(trunkGeometry); - const topGeometryId = treeBatchedMesh.addGeometry(topGeometry); - - const trunkColor = new THREE.Color(0x8b4513); - const topColor = new THREE.Color(0x336633); - - for (let i = 0; i < treeCount; i++) { - const x = Math.random() * 300 - 150; - const z = Math.random() * 300 - 150; - - const trunkId = treeBatchedMesh.addInstance(trunkGeometryId); - matrix.makeScale(1, 1, 1); - matrix.setPosition(x, 1, z); - treeBatchedMesh.setMatrixAt(trunkId, matrix); - treeBatchedMesh.setColorAt(trunkId, trunkColor); - - const topId = treeBatchedMesh.addInstance(topGeometryId); - matrix.makeScale(1, 1, 1); - matrix.setPosition(x, 6, z); - treeBatchedMesh.setMatrixAt(topId, matrix); - treeBatchedMesh.setColorAt(topId, topColor); - } - - scene.add(treeBatchedMesh); - - // 6. Torus shapes using instanced mesh - const torusGeometry = new THREE.TorusGeometry(3, 1, 16, 50); - const torusMaterial = new THREE.MeshPhongMaterial({ - color: 0xff99cc, - shininess: 30, - }); - - const torusCount = 15; - const torusInstancedMesh = new THREE.InstancedMesh(torusGeometry, torusMaterial, torusCount); - - for (let i = 0; i < torusCount; i++) { - const x = Math.random() * 320 - 160; - const y = 2; - const z = Math.random() * 320 - 160; - const rotZ = Math.random() * Math.PI * 2; - - // Apply rotation (PI/2 on X-axis and random on Z-axis) - matrix.makeRotationX(Math.PI / 2); - const rotMatrix = new THREE.Matrix4().makeRotationZ(rotZ); - matrix.multiply(rotMatrix); - matrix.setPosition(x, y, z); - - torusInstancedMesh.setMatrixAt(i, matrix); - } - - torusInstancedMesh.castShadow = true; - torusInstancedMesh.receiveShadow = true; - scene.add(torusInstancedMesh); -} - -function resize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate(time) { - timer.update(); - - const delta = timer.getDelta(); - - // Rotate the central torus knot - torusKnot.rotation.x += 0.25 * delta; - torusKnot.rotation.y += 0.5 * delta; - torusKnot.rotation.z += 1 * delta; - - dirLight.position.x = Math.sin(time * 0.0001) * 30; - dirLight.position.z = Math.cos(time * 0.0001) * 30; - - renderer.render(scene, camera); - - tsmHelper.update(); -} diff --git a/examples-testing/examples/webgpu_shadowmap_csm.ts b/examples-testing/examples/webgpu_shadowmap_csm.ts deleted file mode 100644 index 34c38a16b..000000000 --- a/examples-testing/examples/webgpu_shadowmap_csm.ts +++ /dev/null @@ -1,267 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { CSMShadowNode } from 'three/addons/csm/CSMShadowNode.js'; -import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; - -let renderer, scene, camera, orthoCamera, controls, csm, csmHelper, csmDirectionalLight; - -const params = { - orthographic: false, - fade: false, - shadows: true, - maxFar: 1000, - mode: 'practical', - lightX: -1, - lightY: -1, - lightZ: -1, - margin: 100, - shadowNear: 1, - shadowFar: 2000, - autoUpdateHelper: true, - updateHelper: function () { - csmHelper.update(); - }, -}; - -init(); - -function updateOrthoCamera() { - const size = controls.target.distanceTo(camera.position); - const aspect = camera.aspect; - - orthoCamera.left = (size * aspect) / -2; - orthoCamera.right = (size * aspect) / 2; - - orthoCamera.top = size / 2; - orthoCamera.bottom = size / -2; - orthoCamera.position.copy(camera.position); - orthoCamera.rotation.copy(camera.rotation); - orthoCamera.updateProjectionMatrix(); -} - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color('#454e61'); - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 5000); - orthoCamera = new THREE.OrthographicCamera(); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - - renderer.shadowMap.enabled = params.shadows; - - renderer.inspector = new Inspector(); - - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI / 2; - camera.position.set(60, 60, 0); - controls.target = new THREE.Vector3(-100, 10, 0); - controls.update(); - - const ambientLight = new THREE.AmbientLight(0xffffff, 1.5); - scene.add(ambientLight); - - const additionalDirectionalLight = new THREE.DirectionalLight(0x000020, 1.5); - additionalDirectionalLight.position - .set(params.lightX, params.lightY, params.lightZ) - .normalize() - .multiplyScalar(-200); - scene.add(additionalDirectionalLight); - - csmDirectionalLight = new THREE.DirectionalLight(0xffffff, 3.0); - - csmDirectionalLight.castShadow = true; - csmDirectionalLight.shadow.mapSize.width = 2048; - csmDirectionalLight.shadow.mapSize.height = 2048; - csmDirectionalLight.shadow.camera.near = params.shadowNear; - csmDirectionalLight.shadow.camera.far = params.shadowFar; - csmDirectionalLight.shadow.camera.top = 1000; - csmDirectionalLight.shadow.camera.bottom = -1000; - csmDirectionalLight.shadow.camera.left = -1000; - csmDirectionalLight.shadow.camera.right = 1000; - - csm = new CSMShadowNode(csmDirectionalLight, { cascades: 4, maxFar: params.maxFar, mode: params.mode }); - - csmDirectionalLight.position.set(params.lightX, params.lightY, params.lightZ).normalize().multiplyScalar(-200); - - csmDirectionalLight.shadow.shadowNode = csm; - - scene.add(csmDirectionalLight); - - csmHelper = new CSMHelper(csm); - csmHelper.visible = false; - scene.add(csmHelper); - - const floorMaterial = new THREE.MeshPhongMaterial({ color: '#252a34' }); - - const floor = new THREE.Mesh(new THREE.PlaneGeometry(10000, 10000, 8, 8), floorMaterial); - floor.rotation.x = -Math.PI / 2; - floor.castShadow = true; - floor.receiveShadow = true; - scene.add(floor); - - const material1 = new THREE.MeshPhongMaterial({ color: '#08d9d6' }); - - const material2 = new THREE.MeshPhongMaterial({ color: '#ff2e63' }); - - const geometry = new THREE.BoxGeometry(10, 10, 10); - - for (let i = 0; i < 40; i++) { - const cube1 = new THREE.Mesh(geometry, i % 2 === 0 ? material1 : material2); - cube1.castShadow = true; - cube1.receiveShadow = true; - scene.add(cube1); - cube1.position.set(-i * 25, 20, 30); - cube1.scale.y = Math.random() * 2 + 6; - - const cube2 = new THREE.Mesh(geometry, i % 2 === 0 ? material2 : material1); - cube2.castShadow = true; - cube2.receiveShadow = true; - scene.add(cube2); - cube2.position.set(-i * 25, 20, -30); - cube2.scale.y = Math.random() * 2 + 6; - } - - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(params, 'orthographic').onChange(function (value) { - csm.camera = value ? orthoCamera : camera; - csm.updateFrustums(); - }); - - // gui.add( params, 'fade' ).onChange( function ( value ) { - - // csm.fade = value; - // csm.updateFrustums(); - // TODO: Changing "fade" requires toggling shadows right now - - // } ); - - gui.add(params, 'shadows').onChange(function (value) { - csmDirectionalLight.castShadow = value; - }); - - gui.add(params, 'maxFar', 1, 5000, 1) - .name('max shadow far') - .onChange(function (value) { - csm.maxFar = value; - csm.updateFrustums(); - }); - - gui.add(params, 'mode', ['uniform', 'logarithmic', 'practical']) - .name('frustum split mode') - .onChange(function (value) { - csm.mode = value; - csm.updateFrustums(); - }); - - gui.add(params, 'lightX', -1, 1) - .name('light direction x') - .onChange(function () { - csmDirectionalLight.position - .set(params.lightX, params.lightY, params.lightZ) - .normalize() - .multiplyScalar(-200); - }); - - gui.add(params, 'lightY', -1, 1) - .name('light direction y') - .onChange(function () { - csmDirectionalLight.position - .set(params.lightX, params.lightY, params.lightZ) - .normalize() - .multiplyScalar(-200); - }); - - gui.add(params, 'lightZ', -1, 1) - .name('light direction z') - .onChange(function () { - csmDirectionalLight.position - .set(params.lightX, params.lightY, params.lightZ) - .normalize() - .multiplyScalar(-200); - }); - - gui.add(params, 'margin', 0, 200) - .name('light margin') - .onChange(function (value) { - csm.lightMargin = value; - }); - - gui.add(params, 'shadowNear', 1, 10000) - .name('shadow near') - .onChange(function (value) { - for (let i = 0; i < csm.lights.length; i++) { - csm.lights[i].shadow.camera.near = value; - csm.lights[i].shadow.camera.updateProjectionMatrix(); - } - }); - - gui.add(params, 'shadowFar', 1, 10000) - .name('shadow far') - .onChange(function (value) { - for (let i = 0; i < csm.lights.length; i++) { - csm.lights[i].shadow.camera.far = value; - csm.lights[i].shadow.camera.updateProjectionMatrix(); - } - }); - - const helperFolder = gui.addFolder('helper'); - - helperFolder.add(csmHelper, 'visible'); - - helperFolder.add(csmHelper, 'displayFrustum').onChange(function () { - csmHelper.updateVisibility(); - }); - - helperFolder.add(csmHelper, 'displayPlanes').onChange(function () { - csmHelper.updateVisibility(); - }); - - helperFolder.add(csmHelper, 'displayShadowBounds').onChange(function () { - csmHelper.updateVisibility(); - }); - - helperFolder.add(params, 'autoUpdateHelper').name('auto update'); - - helperFolder.add(params, 'updateHelper').name('update'); - - window.addEventListener('resize', function () { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - updateOrthoCamera(); - csm.updateFrustums(); - - renderer.setSize(window.innerWidth, window.innerHeight); - }); -} - -function animate() { - camera.updateMatrixWorld(); - controls.update(); - - if (params.orthographic) { - updateOrthoCamera(); - csm.updateFrustums(); - - if (params.autoUpdateHelper) { - csmHelper.update(); - } - - renderer.render(scene, orthoCamera); - } else { - if (params.autoUpdateHelper) { - csmHelper.update(); - } - - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgpu_shadowmap_opacity.ts b/examples-testing/examples/webgpu_shadowmap_opacity.ts deleted file mode 100644 index e508e1039..000000000 --- a/examples-testing/examples/webgpu_shadowmap_opacity.ts +++ /dev/null @@ -1,117 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { Fn, mix } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 40); - camera.position.set(-4, 2, 6); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - renderer.toneMapping = THREE.AgXToneMapping; - renderer.toneMappingExposure = 1.5; - renderer.shadowMap.enabled = true; - renderer.shadowMap.transmitted = true; - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x9e9eff); - - // light + shadow - - const hemi = new THREE.AmbientLight(0xffffff, 0.5); - scene.add(hemi); - - const dirLight = new THREE.DirectionalLight(0x6666ff, 10); - dirLight.position.set(3, 5, 17); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = 50; - dirLight.shadow.camera.right = 5; - dirLight.shadow.camera.left = -5; - dirLight.shadow.camera.top = 5; - dirLight.shadow.camera.bottom = -5; - dirLight.shadow.mapSize.width = 2048; - dirLight.shadow.mapSize.height = 2048; - dirLight.shadow.radius = 4; - - dirLight.shadow.autoUpdate = false; - dirLight.shadow.needsUpdate = true; - - scene.add(dirLight); - - // - - const loader = new GLTFLoader(); - const gltf = await loader.loadAsync('models/gltf/DragonAttenuation.glb'); - gltf.scene.position.set(0, 0, -0.5); - - const floor = gltf.scene.children[0]; - floor.scale.x += 4; - floor.scale.y += 4; - - const dragon = gltf.scene.children[1]; - dragon.position.set(-1.5, -0.8, 1); - - const dragon2 = dragon.clone(); - dragon2.material = dragon.material.clone(); - dragon2.material.attenuationColor = new THREE.Color(0xff0000); - dragon2.position.x += 4; - gltf.scene.add(dragon2); - - // shadow node - - const customShadow = Fn(([color, opacity = 1]) => { - //return vec4( color, opacity ); // opacity by blending - return mix(1, color, opacity); // opacity by color - }); - - // apply shadow - - floor.receiveShadow = true; - - dragon.castShadow = dragon2.castShadow = true; - dragon.receiveShadow = dragon2.receiveShadow = true; - - dragon.material.castShadowNode = customShadow(dragon.material.attenuationColor); - dragon2.material.castShadowNode = customShadow(dragon2.material.attenuationColor); - - // - - scene.add(gltf.scene); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 0.1; - controls.maxDistance = 10; - controls.target.set(0, 0, 0); - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_shadowmap_pointlight.ts b/examples-testing/examples/webgpu_shadowmap_pointlight.ts deleted file mode 100644 index a528d261c..000000000 --- a/examples-testing/examples/webgpu_shadowmap_pointlight.ts +++ /dev/null @@ -1,139 +0,0 @@ -import * as THREE from 'three'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer; -let pointLight, pointLight2; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 10, 40); - - scene = new THREE.Scene(); - scene.add(new THREE.AmbientLight(0x111122, 3)); - - // lights - - function createLight(color) { - const intensity = 200; - - const light = new THREE.PointLight(color, intensity, 20); - light.castShadow = true; - light.shadow.bias = -0.005; // reduces self-shadowing on double-sided objects - light.shadow.mapSize.setScalar(128); - light.shadow.radius = 10; - - let geometry = new THREE.SphereGeometry(0.3, 12, 6); - let material = new THREE.MeshBasicMaterial({ color: color }); - material.color.multiplyScalar(intensity); - let sphere = new THREE.Mesh(geometry, material); - light.add(sphere); - - const texture = new THREE.CanvasTexture(generateTexture()); - texture.magFilter = THREE.NearestFilter; - texture.wrapT = THREE.RepeatWrapping; - texture.wrapS = THREE.RepeatWrapping; - texture.repeat.set(1, 4.5); - - geometry = new THREE.SphereGeometry(2, 32, 8); - material = new THREE.MeshPhongNodeMaterial({ - side: THREE.DoubleSide, - alphaMap: texture, - alphaTest: 0.5, - }); - - sphere = new THREE.Mesh(geometry, material); - sphere.castShadow = true; - sphere.receiveShadow = true; - light.add(sphere); - - return light; - } - - pointLight = createLight(0x0088ff); - scene.add(pointLight); - - pointLight2 = createLight(0xff8888); - scene.add(pointLight2); - // - - const geometry = new THREE.BoxGeometry(30, 30, 30); - - const material = new THREE.MeshPhongNodeMaterial({ - color: 0xa0adaf, - shininess: 10, - specular: 0x111111, - side: THREE.BackSide, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.position.y = 10; - mesh.receiveShadow = true; - scene.add(mesh); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - // renderer.shadowMap.type = THREE.BasicShadowMap; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 10, 0); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function generateTexture() { - const canvas = document.createElement('canvas'); - canvas.width = 2; - canvas.height = 2; - - const context = canvas.getContext('2d'); - context.fillStyle = 'white'; - context.fillRect(0, 1, 2, 1); - - return canvas; -} - -function animate() { - let time = performance.now() * 0.001; - - pointLight.position.x = Math.sin(time * 0.6) * 9; - pointLight.position.y = Math.sin(time * 0.7) * 9 + 6; - pointLight.position.z = Math.sin(time * 0.8) * 9; - - pointLight.rotation.x = time; - pointLight.rotation.z = time; - - time += 10000; - - pointLight2.position.x = Math.sin(time * 0.6) * 9; - pointLight2.position.y = Math.sin(time * 0.7) * 9 + 6; - pointLight2.position.z = Math.sin(time * 0.8) * 9; - - pointLight2.rotation.x = time; - pointLight2.rotation.z = time; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_shadowmap_progressive.ts b/examples-testing/examples/webgpu_shadowmap_progressive.ts deleted file mode 100644 index ca5ee0f72..000000000 --- a/examples-testing/examples/webgpu_shadowmap_progressive.ts +++ /dev/null @@ -1,203 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { TransformControls } from 'three/addons/controls/TransformControls.js'; -import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMapGPU.js'; - -// ShadowMap + LightMap Res and Number of Directional Lights -const shadowMapRes = 1024, - lightMapRes = 1024, - lightCount = 4; -let camera, - scene, - renderer, - controls, - control, - control2, - object = new THREE.Mesh(), - lightOrigin = null, - progressiveSurfacemap; -const dirLights = [], - lightmapObjects = []; -const params = { - Enable: true, - 'Blur Edges': true, - 'Blend Window': 200, - 'Light Radius': 50, - 'Ambient Weight': 0.5, - 'Debug Lightmap': false, -}; -init(); -createGUI(); - -function init() { - // renderer - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // camera - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 100, 200); - camera.name = 'Camera'; - - // scene - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x949494); - scene.fog = new THREE.Fog(0x949494, 1000, 3000); - - // progressive lightmap - progressiveSurfacemap = new ProgressiveLightMap(renderer, lightMapRes); - - // directional lighting "origin" - lightOrigin = new THREE.Group(); - lightOrigin.position.set(60, 150, 100); - scene.add(lightOrigin); - - // transform gizmo - control = new TransformControls(camera, renderer.domElement); - control.addEventListener('dragging-changed', event => { - controls.enabled = !event.value; - }); - control.attach(lightOrigin); - scene.add(control.getHelper()); - - // create 8 directional lights to speed up the convergence - for (let l = 0; l < lightCount; l++) { - const dirLight = new THREE.DirectionalLight(0xffffff, Math.PI / lightCount); - dirLight.name = 'Dir. Light ' + l; - dirLight.position.set(200, 200, 200); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 100; - dirLight.shadow.camera.far = 5000; - dirLight.shadow.camera.right = 150; - dirLight.shadow.camera.left = -150; - dirLight.shadow.camera.top = 150; - dirLight.shadow.camera.bottom = -150; - dirLight.shadow.mapSize.width = shadowMapRes; - dirLight.shadow.mapSize.height = shadowMapRes; - lightmapObjects.push(dirLight); - dirLights.push(dirLight); - } - - // ground - const groundMesh = new THREE.Mesh( - new THREE.PlaneGeometry(600, 600), - new THREE.MeshPhongMaterial({ color: 0xffffff, depthWrite: true }), - ); - groundMesh.position.y = -0.1; - groundMesh.rotation.x = -Math.PI / 2; - groundMesh.name = 'Ground Mesh'; - lightmapObjects.push(groundMesh); - scene.add(groundMesh); - - // model - function loadModel() { - object.traverse(function (child) { - if (child.isMesh) { - child.name = 'Loaded Mesh'; - child.castShadow = true; - child.receiveShadow = true; - child.material = new THREE.MeshPhongMaterial(); - - // This adds the model to the lightmap - lightmapObjects.push(child); - progressiveSurfacemap.addObjectsToLightMap(lightmapObjects); - } else { - child.layers.disableAll(); // Disable Rendering for this - } - }); - scene.add(object); - object.scale.set(2, 2, 2); - object.position.set(0, -16, 0); - control2 = new TransformControls(camera, renderer.domElement); - control2.addEventListener('dragging-changed', event => { - controls.enabled = !event.value; - }); - control2.attach(object); - scene.add(control2.getHelper()); - const lightTarget = new THREE.Group(); - lightTarget.position.set(0, 20, 0); - for (let l = 0; l < dirLights.length; l++) { - dirLights[l].target = lightTarget; - } - - object.add(lightTarget); - } - - const manager = new THREE.LoadingManager(loadModel); - const loader = new GLTFLoader(manager); - loader.load('models/gltf/ShadowmappableMesh.glb', function (obj) { - object = obj.scene.children[0]; - }); - - // controls - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; // an animation loop is required when either damping or auto-rotation are enabled - controls.dampingFactor = 0.05; - controls.screenSpacePanning = true; - controls.minDistance = 100; - controls.maxDistance = 500; - controls.maxPolarAngle = Math.PI / 1.5; - controls.target.set(0, 100, 0); - - window.addEventListener('resize', onWindowResize); -} - -function createGUI() { - const gui = renderer.inspector.createParameters('Accumulation Settings'); - gui.add(params, 'Enable'); - gui.add(params, 'Blur Edges'); - gui.add(params, 'Blend Window', 1, 500, 1); - gui.add(params, 'Light Radius', 0, 200, 10); - gui.add(params, 'Ambient Weight', 0, 1, 0.1); - gui.add(params, 'Debug Lightmap').onChange(value => progressiveSurfacemap.showDebugLightmap(value)); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - // Update the inertia on the orbit controls - controls.update(); - - // Accumulate Surface Maps - if (params['Enable']) { - progressiveSurfacemap.update(camera, params['Blend Window'], params['Blur Edges']); - } - - // Manually Update the Directional Lights - for (let l = 0; l < dirLights.length; l++) { - // Sometimes they will be sampled from the target direction - // Sometimes they will be uniformly sampled from the upper hemisphere - if (Math.random() > params['Ambient Weight']) { - dirLights[l].position.set( - lightOrigin.position.x + Math.random() * params['Light Radius'], - lightOrigin.position.y + Math.random() * params['Light Radius'], - lightOrigin.position.z + Math.random() * params['Light Radius'], - ); - } else { - // Uniform Hemispherical Surface Distribution for Ambient Occlusion - const lambda = Math.acos(2 * Math.random() - 1) - 3.14159 / 2.0; - const phi = 2 * 3.14159 * Math.random(); - dirLights[l].position.set( - Math.cos(lambda) * Math.cos(phi) * 300 + object.position.x, - Math.abs(Math.cos(lambda) * Math.sin(phi) * 300) + object.position.y + 20, - Math.sin(lambda) * 300 + object.position.z, - ); - } - } - - // Render Scene - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_shadowmap_vsm.ts b/examples-testing/examples/webgpu_shadowmap_vsm.ts deleted file mode 100644 index edaf4fd9e..000000000 --- a/examples-testing/examples/webgpu_shadowmap_vsm.ts +++ /dev/null @@ -1,197 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, timer; -let dirLight, spotLight; -let torusKnot, dirGroup; - -const config = { - spotlightRadius: 4, - spotlightSamples: 8, - dirlightRadius: 4, - dirlightSamples: 8, - animate: true, -}; - -init(); - -function init() { - initScene(); - initMisc(); - - // Init gui - const gui = renderer.inspector.createParameters('Settings'); - - const spotlightFolder = gui.addFolder('Spotlight'); - spotlightFolder - .add(config, 'spotlightRadius', 0, 25) - .name('radius') - .onChange(function (value) { - spotLight.shadow.radius = value; - }); - - spotlightFolder - .add(config, 'spotlightSamples', 1, 25, 1) - .name('samples') - .onChange(function (value) { - spotLight.shadow.blurSamples = value; - }); - - const dirlightFolder = gui.addFolder('Directional Light'); - dirlightFolder - .add(config, 'dirlightRadius', 0, 25) - .name('radius') - .onChange(function (value) { - dirLight.shadow.radius = value; - }); - - dirlightFolder - .add(config, 'dirlightSamples', 1, 25, 1) - .name('samples') - .onChange(function (value) { - dirLight.shadow.blurSamples = value; - }); - - gui.add(config, 'animate'); - - document.body.appendChild(renderer.domElement); - window.addEventListener('resize', onWindowResize); -} - -function initScene() { - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 1000); - camera.position.set(0, 10, 30); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x222244); - scene.fog = new THREE.Fog(0x222244, 50, 100); - - // Lights - - scene.add(new THREE.AmbientLight(0x444444)); - - spotLight = new THREE.SpotLight(0xff8888, 400); - spotLight.angle = Math.PI / 5; - spotLight.penumbra = 0.3; - spotLight.position.set(8, 10, 5); - spotLight.castShadow = true; - spotLight.shadow.camera.near = 8; - spotLight.shadow.camera.far = 200; - spotLight.shadow.mapSize.width = 256; - spotLight.shadow.mapSize.height = 256; - spotLight.shadow.bias = -0.002; - spotLight.shadow.radius = 4; - scene.add(spotLight); - - dirLight = new THREE.DirectionalLight(0x8888ff, 3); - dirLight.position.set(3, 12, 17); - dirLight.castShadow = true; - dirLight.shadow.camera.near = 0.1; - dirLight.shadow.camera.far = 500; - dirLight.shadow.camera.right = 17; - dirLight.shadow.camera.left = -17; - dirLight.shadow.camera.top = 17; - dirLight.shadow.camera.bottom = -17; - dirLight.shadow.mapSize.width = 512; - dirLight.shadow.mapSize.height = 512; - dirLight.shadow.radius = 4; - dirLight.shadow.bias = -0.0005; - - dirGroup = new THREE.Group(); - dirGroup.add(dirLight); - scene.add(dirGroup); - - // Geometry - - const geometry = new THREE.TorusKnotGeometry(25, 8, 75, 20); - const material = new THREE.MeshPhongMaterial({ - color: 0x999999, - shininess: 0, - specular: 0x222222, - }); - - torusKnot = new THREE.Mesh(geometry, material); - torusKnot.scale.multiplyScalar(1 / 18); - torusKnot.position.y = 3; - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - const cylinderGeometry = new THREE.CylinderGeometry(0.75, 0.75, 7, 32); - - const pillar1 = new THREE.Mesh(cylinderGeometry, material); - pillar1.position.set(8, 3.5, 8); - pillar1.castShadow = true; - pillar1.receiveShadow = true; - - const pillar2 = pillar1.clone(); - pillar2.position.set(8, 3.5, -8); - const pillar3 = pillar1.clone(); - pillar3.position.set(-8, 3.5, 8); - const pillar4 = pillar1.clone(); - pillar4.position.set(-8, 3.5, -8); - - scene.add(pillar1); - scene.add(pillar2); - scene.add(pillar3); - scene.add(pillar4); - - const planeGeometry = new THREE.PlaneGeometry(200, 200); - const planeMaterial = new THREE.MeshPhongMaterial({ - color: 0x999999, - shininess: 0, - specular: 0x111111, - }); - - const ground = new THREE.Mesh(planeGeometry, planeMaterial); - ground.rotation.x = -Math.PI / 2; - ground.scale.multiplyScalar(3); - ground.castShadow = true; - ground.receiveShadow = true; - scene.add(ground); -} - -function initMisc() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.VSMShadowMap; - - // Mouse control - const controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 2, 0); - controls.update(); - - timer = new THREE.Timer(); - timer.connect(document); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate(time) { - timer.update(); - - const delta = timer.getDelta(); - - if (config.animate === true) { - torusKnot.rotation.x += 0.25 * delta; - torusKnot.rotation.y += 0.5 * delta; - torusKnot.rotation.z += 1 * delta; - - dirGroup.rotation.y += 0.7 * delta; - dirLight.position.z = 17 + Math.sin(time * 0.001) * 5; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_skinning.ts b/examples-testing/examples/webgpu_skinning.ts deleted file mode 100644 index 36669a5d4..000000000 --- a/examples-testing/examples/webgpu_skinning.ts +++ /dev/null @@ -1,72 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color, screenUV } from 'three/tsl'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer; - -let mixer, timer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 100); - camera.position.set(1, 2, 3); - - scene = new THREE.Scene(); - scene.backgroundNode = screenUV.y.mix(color(0x66bbff), color(0x4466ff)); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - //lights - - const light = new THREE.PointLight(0xffffff, 1, 100); - light.power = 2500; - camera.add(light); - scene.add(camera); - - const ambient = new THREE.AmbientLight(0x4466ff, 1); - scene.add(ambient); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Michelle.glb', function (gltf) { - const object = gltf.scene; - mixer = new THREE.AnimationMixer(object); - - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - scene.add(object); - }); - - //renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.LinearToneMapping; - renderer.toneMappingExposure = 0.4; - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_skinning_instancing.ts b/examples-testing/examples/webgpu_skinning_instancing.ts deleted file mode 100644 index 877ee46cb..000000000 --- a/examples-testing/examples/webgpu_skinning_instancing.ts +++ /dev/null @@ -1,128 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, mix, range, color, oscSine, time } from 'three/tsl'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer; -let renderPipeline; - -let mixer, timer; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.01, 40); - camera.position.set(1, 2, 3); - - scene = new THREE.Scene(); - camera.lookAt(0, 1, 0); - - timer = new THREE.Timer(); - timer.connect(document); - - // lights - - const centerLight = new THREE.PointLight(0xff9900, 1, 100); - centerLight.position.y = 4.5; - centerLight.position.z = -2; - centerLight.power = 400; - scene.add(centerLight); - - const cameraLight = new THREE.PointLight(0x0099ff, 1, 100); - cameraLight.power = 400; - camera.add(cameraLight); - scene.add(camera); - - const geometry = new THREE.PlaneGeometry(1000, 1000); - geometry.rotateX(-Math.PI / 2); - - const plane = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({ color: 0x000000, visible: true })); - scene.add(plane); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Michelle.glb', function (gltf) { - const object = gltf.scene; - - mixer = new THREE.AnimationMixer(object); - - const action = mixer.clipAction(gltf.animations[0]); - action.play(); - - const instanceCount = 30; - const dummy = new THREE.Object3D(); - - object.traverse(child => { - if (child.isMesh) { - const oscNode = oscSine(time.mul(0.1)); - - // random colors between instances from 0x000000 to 0xFFFFFF - const randomColors = range(new THREE.Color(0x000000), new THREE.Color(0xffffff)); - - // random [ 0, 1 ] values between instances - const randomMetalness = range(0, 1); - - child.material = new THREE.MeshStandardNodeMaterial(); - child.material.roughness = 0.1; - child.material.metalnessNode = mix(0.0, randomMetalness, oscNode); - child.material.colorNode = mix(color(0xffffff), randomColors, oscNode); - - child.isInstancedMesh = true; - child.instanceMatrix = new THREE.InstancedBufferAttribute(new Float32Array(instanceCount * 16), 16); - child.count = instanceCount; - - for (let i = 0; i < instanceCount; i++) { - dummy.position.x = -200 + (i % 5) * 70; - dummy.position.y = Math.floor(i / 5) * -200; - - dummy.updateMatrix(); - - dummy.matrix.toArray(child.instanceMatrix.array, i * 16); - } - } - }); - - scene.add(object); - }); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // post processing - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode(); - const scenePassDepth = scenePass.getLinearDepthNode().remapClamp(0.15, 0.3); - - const scenePassColorBlurred = gaussianBlur(scenePassColor); - scenePassColorBlurred.directionNode = scenePassDepth; - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputNode = scenePassColorBlurred; - - // events - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) mixer.update(delta); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_skinning_instancing_individual.ts b/examples-testing/examples/webgpu_skinning_instancing_individual.ts deleted file mode 100644 index 2abb7022e..000000000 --- a/examples-testing/examples/webgpu_skinning_instancing_individual.ts +++ /dev/null @@ -1,431 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - Fn, - add, - attributeArray, - color, - instanceIndex, - screenUV, - storage, - transformNormal, - transformNormalToView, - uint, - uniform, - vec4, - vertexIndex, - mat3, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let camera, scene, renderer, controls; -let mixer, timer, animatedObject, proportionBones, referenceMesh, footBones, groundFoot, dummy; -let instanceMatrices, instanceMatricesNode, bellyWeightsNode; -let computeSkinning; - -const skeletonStates = new Map(); -const timeOffsets = []; -const variations = []; -const leftFoot = new THREE.Vector3(); -const rightFoot = new THREE.Vector3(); - -init(); - -function createSourceVertexAttribute(geometry) { - const position = geometry.getAttribute('position'); - const normal = geometry.getAttribute('normal'); - const bellyPosition = position.clone(); - const data = new Float32Array(position.count * 12); - - for (let i = 0; i < position.count; i++) { - const amount = Math.max(0, 1 - Math.abs(position.getY(i) - 0.94) / 0.3) * 0.8; - - bellyPosition.setXYZ(i, position.getX(i) * amount, 0, position.getZ(i) * amount); - - const offset = i * 12; - - data[offset + 0] = position.getX(i); - data[offset + 1] = position.getY(i); - data[offset + 2] = position.getZ(i); - data[offset + 4] = normal.getX(i); - data[offset + 5] = normal.getY(i); - data[offset + 6] = normal.getZ(i); - data[offset + 8] = bellyPosition.getX(i); - data[offset + 9] = bellyPosition.getY(i); - data[offset + 10] = bellyPosition.getZ(i); - } - - return new THREE.StorageBufferAttribute(data, 4); -} - -function getSkeletonState(skeleton, instanceCount) { - let state = skeletonStates.get(skeleton); - - if (state === undefined) { - const boneCount = skeleton.bones.length; - const boneMatrices = new THREE.StorageBufferAttribute(instanceCount * boneCount, 16); - - state = { - skeleton, - boneCount, - boneMatrices, - boneMatricesNode: storage(boneMatrices, 'mat4', boneMatrices.count).toReadOnly(), - }; - - skeletonStates.set(skeleton, state); - } - - return state; -} - -function createComputedMesh(source, instanceCount) { - const geometry = source.geometry.clone(); - const material = source.material.clone(); - const vertexCount = geometry.getAttribute('position').count; - const skeletonState = getSkeletonState(source.skeleton, instanceCount); - - const sourceVertices = storage(createSourceVertexAttribute(geometry), 'vec4', vertexCount * 3).toReadOnly(); - const skinIndices = storage( - new THREE.StorageBufferAttribute(new Uint32Array(geometry.getAttribute('skinIndex').array), 4), - 'uvec4', - vertexCount, - ).toReadOnly(); - const skinWeights = storage( - new THREE.StorageBufferAttribute(geometry.getAttribute('skinWeight').array, 4), - 'vec4', - vertexCount, - ).toReadOnly(); - const bindMatrix = uniform(source.bindMatrix, 'mat4'); - const bindMatrixInverse = uniform(source.bindMatrixInverse, 'mat4'); - const vertices = attributeArray(instanceCount * vertexCount * 2, 'vec4'); - - computeSkinning = Fn(() => { - const sourceVertex = instanceIndex.mod(uint(vertexCount)); - const meshInstance = instanceIndex.div(uint(vertexCount)); - const sourceOffset = sourceVertex.mul(uint(3)); - const targetOffset = instanceIndex.mul(uint(2)); - const boneOffset = meshInstance.mul(uint(skeletonState.boneCount)); - const skinIndex = skinIndices.element(sourceVertex); - const skinWeight = skinWeights.element(sourceVertex); - const morphPosition = sourceVertices - .element(sourceOffset) - .xyz.add(sourceVertices.element(sourceOffset.add(uint(2))).xyz.mul(bellyWeightsNode.element(meshInstance))); - const skinVertex = bindMatrix.mul(morphPosition); - const boneMatX = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.x)); - const boneMatY = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.y)); - const boneMatZ = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.z)); - const boneMatW = skeletonState.boneMatricesNode.element(boneOffset.add(skinIndex.w)); - const skinMatrix = add( - skinWeight.x.mul(boneMatX), - skinWeight.y.mul(boneMatY), - skinWeight.z.mul(boneMatZ), - skinWeight.w.mul(boneMatW), - ); - const skinPosition = bindMatrixInverse.mul( - add( - boneMatX.mul(skinWeight.x).mul(skinVertex), - boneMatY.mul(skinWeight.y).mul(skinVertex), - boneMatZ.mul(skinWeight.z).mul(skinVertex), - boneMatW.mul(skinWeight.w).mul(skinVertex), - ), - ).xyz; - - const skinMatrix3 = mat3(bindMatrixInverse.mul(skinMatrix).mul(bindMatrix)); - const skinNormal = skinMatrix3.mul(sourceVertices.element(sourceOffset.add(uint(1))).xyz); - const instanceMatrix = instanceMatricesNode.element(meshInstance); - - vertices.element(targetOffset).assign(vec4(instanceMatrix.mul(skinPosition).xyz, 1)); - vertices.element(targetOffset.add(uint(1))).assign(vec4(transformNormal(skinNormal, instanceMatrix), 0)); - })() - .compute(instanceCount * vertexCount) - .setName('Compute Instanced Skinning'); - - const meshVertex = instanceIndex.mul(uint(vertexCount)).add(vertexIndex).mul(uint(2)); - - material.positionNode = vertices.element(meshVertex).xyz; - material.normalNode = transformNormalToView(vertices.element(meshVertex.add(uint(1))).xyz).toVarying(); - - const mesh = new THREE.Mesh(geometry, material); - mesh.count = instanceCount; - mesh.castShadow = true; - mesh.frustumCulled = false; - - source.parent.add(mesh); - source.visible = false; -} - -async function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 60); - camera.position.set(4.6, 3.3, 6.2); - - scene = new THREE.Scene(); - scene.backgroundNode = screenUV.y.mix(color(0x8f989c), color(0xe7eaeb)); - - timer = new THREE.Timer(); - timer.connect(document); - - scene.add(new THREE.HemisphereLight(0xffffff, 0x939b9e, 1.2)); - - const directionalLight = new THREE.DirectionalLight(0xfffbf4, 2.8); - directionalLight.position.set(-4, 10, 8); - directionalLight.castShadow = true; - directionalLight.shadow.mapSize.set(2048, 2048); - directionalLight.shadow.camera.left = -5; - directionalLight.shadow.camera.right = 5; - directionalLight.shadow.camera.top = 5; - directionalLight.shadow.camera.bottom = -5; - directionalLight.shadow.camera.near = 0.1; - directionalLight.shadow.camera.far = 30; - directionalLight.shadow.camera.updateProjectionMatrix(); - scene.add(directionalLight); - - const rimLight = new THREE.DirectionalLight(0xe8f4ff, 0.85); - rimLight.position.set(7, 5, -5); - scene.add(rimLight); - - const ground = new THREE.Mesh( - new THREE.PlaneGeometry(400, 400), - new THREE.ShadowMaterial({ color: 0x5d6568, opacity: 0.3 }), - ); - - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - new GLTFLoader().load('models/gltf/Michelle.glb', function (gltf) { - const object = gltf.scene; - const instanceCount = 30; - const duration = gltf.animations[0].duration; - const skinnedMeshes = []; - - dummy = new THREE.Object3D(); - animatedObject = object; - mixer = new THREE.AnimationMixer(object); - mixer.clipAction(gltf.animations[0]).play(); - - object.traverse(child => { - if (child.isSkinnedMesh === true) skinnedMeshes.push(child); - }); - - referenceMesh = skinnedMeshes[0]; - const skeleton = referenceMesh.skeleton; - const getBone = name => skeleton.bones.find(bone => bone.name.endsWith(name)); - const proportionTargets = [ - getBone('Head'), - getBone('Spine'), - getBone('Spine2'), - getBone('LeftArm'), - getBone('RightArm'), - getBone('LeftForeArm'), - getBone('RightForeArm'), - getBone('LeftUpLeg'), - getBone('RightUpLeg'), - getBone('LeftLeg'), - getBone('RightLeg'), - ]; - - proportionBones = { - head: proportionTargets[0], - belly: proportionTargets[1], - chest: proportionTargets[2], - arms: proportionTargets.slice(3, 7), - legs: proportionTargets.slice(7), - baseScales: proportionTargets.map(bone => bone.scale.clone()), - }; - footBones = [getBone('LeftFoot'), getBone('RightFoot')]; - - const bodyTypes = [ - { - width: 0.92, - height: 1.09, - depth: 0.92, - belly: 0, - headScale: 0.96, - bellyWidth: 0.98, - chestWidth: 0.98, - armLength: 1.03, - legLength: 1.04, - }, - { - width: 1.0, - height: 1.05, - depth: 0.99, - belly: 0, - headScale: 0.98, - bellyWidth: 1.0, - chestWidth: 1.03, - armLength: 1.02, - legLength: 1.02, - }, - { - width: 1.0, - height: 1.0, - depth: 1.0, - belly: 0, - headScale: 1.0, - bellyWidth: 1.0, - chestWidth: 1.0, - armLength: 1.0, - legLength: 1.0, - }, - { - width: 1.08, - height: 0.9, - depth: 1.1, - belly: 0.75, - headScale: 1.06, - bellyWidth: 1.12, - chestWidth: 1.0, - armLength: 0.9, - legLength: 0.9, - }, - { - width: 1.2, - height: 0.8, - depth: 1.22, - belly: 1.6, - headScale: 1.12, - bellyWidth: 1.24, - chestWidth: 1.04, - armLength: 0.72, - legLength: 0.7, - }, - ]; - - const bellyWeights = new THREE.StorageBufferAttribute(instanceCount, 1); - instanceMatrices = new THREE.StorageBufferAttribute(instanceCount, 16); - bellyWeightsNode = storage(bellyWeights, 'float', instanceCount).toReadOnly(); - instanceMatricesNode = storage(instanceMatrices, 'mat4', instanceCount).toReadOnly(); - - for (let i = 0; i < instanceCount; i++) { - const bodyType = bodyTypes[i % bodyTypes.length]; - const isChild = i % 2 === 0; - const size = isChild ? (i % 4 === 0 ? 0.68 : 0.78) : 1; - const innerRing = i < 10; - const ringIndex = innerRing ? i : i - 10; - const ringCount = innerRing ? 10 : 20; - const angle = (ringIndex / ringCount) * Math.PI * 2; - const radius = innerRing ? 175 : 340; - - timeOffsets.push((duration * i) / instanceCount); - variations.push({ - ...bodyType, - size, - x: Math.sin(angle) * radius, - y: Math.cos(angle) * radius, - }); - bellyWeights.array[i] = bodyType.belly; - } - - bellyWeights.needsUpdate = true; - animatedObject.updateMatrixWorld(true); - skeleton.update(); - groundFoot = getFootCoordinate(); - - for (const child of skinnedMeshes) createComputedMesh(child, instanceCount); - - scene.add(object); - }); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 0.96; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - await renderer.init(); - scene.environment = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture; - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0.75, 0); - controls.enableDamping = true; - controls.minDistance = 3; - controls.maxDistance = 25; - controls.maxPolarAngle = Math.PI / 2; - controls.update(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function applyProportions(variation) { - const { head, belly, chest, arms, legs, baseScales } = proportionBones; - const bones = [head, belly, chest, ...arms, ...legs]; - - for (let i = 0; i < bones.length; i++) bones[i].scale.copy(baseScales[i]); - - head.scale.multiplyScalar(variation.headScale); - belly.scale.x *= variation.bellyWidth; - belly.scale.z *= variation.bellyWidth; - chest.scale.x *= variation.chestWidth; - chest.scale.z *= variation.chestWidth; - - for (const bone of arms) bone.scale.y *= variation.armLength; - for (const bone of legs) bone.scale.y *= variation.legLength; -} - -function getFootCoordinate() { - footBones[0].getWorldPosition(leftFoot); - footBones[1].getWorldPosition(rightFoot); - referenceMesh.worldToLocal(leftFoot); - referenceMesh.worldToLocal(rightFoot); - - return Math.max(leftFoot.z, rightFoot.z); -} - -function updateInstanceMatrix(index, variation) { - const foot = getFootCoordinate(); - - dummy.position.set(variation.x, variation.y, groundFoot - foot * variation.height * variation.size); - dummy.scale.set(variation.width, variation.depth, variation.height).multiplyScalar(variation.size); - dummy.updateMatrix(); - dummy.matrix.toArray(instanceMatrices.array, index * 16); -} - -function animate() { - timer.update(); - controls.update(); - - if (mixer) { - const elapsed = timer.getElapsed(); - - for (let i = 0; i < timeOffsets.length; i++) { - mixer.setTime(elapsed + timeOffsets[i]); - applyProportions(variations[i]); - animatedObject.updateMatrixWorld(true); - - for (const state of skeletonStates.values()) { - state.skeleton.update(); - state.boneMatrices.array.set(state.skeleton.boneMatrices, i * state.boneCount * 16); - } - - updateInstanceMatrix(i, variations[i]); - } - - for (const state of skeletonStates.values()) state.boneMatrices.needsUpdate = true; - instanceMatrices.needsUpdate = true; - renderer.compute(computeSkinning); - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_sprites.ts b/examples-testing/examples/webgpu_sprites.ts deleted file mode 100644 index 1c2f7995c..000000000 --- a/examples-testing/examples/webgpu_sprites.ts +++ /dev/null @@ -1,103 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture, uv, userData, fog, rangeFogFactor, color } from 'three/tsl'; - -let camera, scene, renderer; - -let map; - -let group; - -let imageWidth = 1, - imageHeight = 1; - -init(); - -function init() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera = new THREE.PerspectiveCamera(60, width / height, 1, 2100); - camera.position.z = 1500; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - scene.fogNode = fog(color(0x0000ff), rangeFogFactor(1500, 2100)); - - // create sprites - - const amount = 200; - const radius = 500; - - const textureLoader = new THREE.TextureLoader(); - - map = textureLoader.load('textures/sprite1.png', map => { - imageWidth = map.image.width; - imageHeight = map.image.height; - }); - - group = new THREE.Group(); - - const textureNode = texture(map); - - const material = new THREE.SpriteNodeMaterial(); - material.colorNode = textureNode.mul(uv()).mul(2).saturate(); - material.opacityNode = textureNode.a; - material.rotationNode = userData('rotation', 'float'); // get value of: sprite.userData.rotation - - for (let a = 0; a < amount; a++) { - const x = Math.random() - 0.5; - const y = Math.random() - 0.5; - const z = Math.random() - 0.5; - - const sprite = new THREE.Sprite(material); - - sprite.position.set(x, y, z); - sprite.position.normalize(); - sprite.position.multiplyScalar(radius); - - // individual rotation per sprite - sprite.userData.rotation = 0; - - group.add(sprite); - } - - scene.add(group); - - // - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - const time = Date.now() / 1000; - - for (let i = 0, l = group.children.length; i < l; i++) { - const sprite = group.children[i]; - const scale = Math.sin(time + sprite.position.x * 0.01) * 0.3 + 1.0; - - sprite.userData.rotation += 0.1 * (i / l); - sprite.scale.set(scale * imageWidth, scale * imageHeight, 1.0); - } - - group.rotation.x = time * 0.5; - group.rotation.y = time * 0.75; - group.rotation.z = time * 1.0; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_storage_buffer.ts b/examples-testing/examples/webgpu_storage_buffer.ts deleted file mode 100644 index 1b4461d33..000000000 --- a/examples-testing/examples/webgpu_storage_buffer.ts +++ /dev/null @@ -1,169 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { storage, If, vec3, uv, uint, float, Fn, instanceIndex, workgroupBarrier } from 'three/tsl'; - -const timestamps = { - webgpu: document.getElementById('timestamps'), - webgl: document.getElementById('timestamps_webgl'), -}; - -// WebGPU Backend -init(); - -// WebGL Backend -init(true); - -async function init(forceWebGL = false) { - const aspect = window.innerWidth / 2 / window.innerHeight; - const camera = new THREE.OrthographicCamera(-aspect, aspect, 1, -1, 0, 2); - camera.position.z = 1; - - const scene = new THREE.Scene(); - - // texture - - const size = 32; // non power of two buffer size is not well supported in WebGPU - const barCount = 32; - - const type = ['float', 'vec2', 'vec3', 'vec4']; - - const arrayBufferNodes = []; - - for (let i = 0; i < type.length; i++) { - const typeSize = i + 1; - const array = new Array(size * typeSize).fill(0); - - const arrayBuffer = new THREE.StorageInstancedBufferAttribute(new Float32Array(array), typeSize); - - arrayBufferNodes.push(storage(arrayBuffer, type[i], size).setPBO(true)); - } - - const computeInitOrder = Fn(() => { - for (let i = 0; i < type.length; i++) { - arrayBufferNodes[i].element(instanceIndex).assign(instanceIndex); - } - }); - - const computeInvertOrder = Fn(() => { - for (let i = 0; i < type.length; i++) { - const invertIndex = arrayBufferNodes[i].element(uint(size - 1).sub(instanceIndex)).toVar(); - workgroupBarrier(); - arrayBufferNodes[i].element(instanceIndex).assign(invertIndex); - } - }); - - // compute - - const computeInit = computeInitOrder().compute(size); - - const compute = computeInvertOrder().compute(size); - - const material = new THREE.MeshBasicNodeMaterial({ color: 0x00ff00 }); - - material.colorNode = Fn(() => { - const index = uint(uv().x.mul(size).floor()).toVar(); - - If(index.greaterThanEqual(size), () => { - index.assign(uint(size).sub(1)); - }); - - const color = vec3(0, 0, 0).toVar(); - - If(uv().y.greaterThan(0.0), () => { - const indexValue = arrayBufferNodes[0].element(index).toVar(); - const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); - - color.assign(vec3(value, 0, 0)); - }); - - If(uv().y.greaterThan(0.25), () => { - const indexValue = arrayBufferNodes[1].element(index).toVar(); - const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); - - color.assign(vec3(0, value, 0)); - }); - - If(uv().y.greaterThan(0.5), () => { - const indexValue = arrayBufferNodes[2].element(index).toVar(); - const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); - - color.assign(vec3(0, 0, value)); - }); - - If(uv().y.greaterThan(0.75), () => { - const indexValue = arrayBufferNodes[3].element(index).toVar(); - const value = float(indexValue).div(float(size)).mul(barCount).floor().div(barCount); - - color.assign(vec3(value, value, value)); - }); - - return color; - })(); - - // - - const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - scene.add(plane); - - const renderer = new THREE.WebGPURenderer({ antialias: false, forceWebGL: forceWebGL, trackTimestamp: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth / 2, window.innerHeight); - - await renderer.init(); - - document.body.appendChild(renderer.domElement); - renderer.domElement.style.position = 'absolute'; - renderer.domElement.style.top = '0'; - renderer.domElement.style.left = '0'; - renderer.domElement.style.width = '50%'; - renderer.domElement.style.height = '100%'; - - if (forceWebGL) { - renderer.domElement.style.left = '50%'; - - scene.background = new THREE.Color(0x212121); - } else { - scene.background = new THREE.Color(0x313131); - } - - renderer.compute(computeInit); - - // - - renderer.info.autoReset = false; - - const stepAnimation = async function () { - renderer.info.reset(); - - renderer.compute(compute); - renderer.render(scene, camera); - - renderer.resolveTimestampsAsync(THREE.TimestampQuery.COMPUTE); - renderer.resolveTimestampsAsync(THREE.TimestampQuery.RENDER); - - timestamps[forceWebGL ? 'webgl' : 'webgpu'].innerHTML = ` - - Compute ${renderer.info.compute.frameCalls} pass in ${renderer.info.compute.timestamp.toFixed(6)}ms
- Draw ${renderer.info.render.drawCalls} pass in ${renderer.info.render.timestamp.toFixed(6)}ms`; - - setTimeout(stepAnimation, 1000); - }; - - stepAnimation(); - - window.addEventListener('resize', onWindowResize); - - function onWindowResize() { - renderer.setSize(window.innerWidth / 2, window.innerHeight); - - const aspect = window.innerWidth / 2 / window.innerHeight; - - const frustumHeight = camera.top - camera.bottom; - - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - - camera.updateProjectionMatrix(); - - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgpu_struct_drawindirect.ts b/examples-testing/examples/webgpu_struct_drawindirect.ts deleted file mode 100644 index b0d1139db..000000000 --- a/examples-testing/examples/webgpu_struct_drawindirect.ts +++ /dev/null @@ -1,212 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - struct, - storage, - sin, - cross, - normalize, - abs, - mix, - Fn, - vec4, - max, - pow, - time, - varyingProperty, - attribute, - uint, - atomicStore, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); -} - -const renderer = new THREE.WebGPURenderer({ antialias: true }); -renderer.outputColorSpace = THREE.SRGBColorSpace; -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setClearColor(0x000000); -renderer.setClearAlpha(0); -document.body.appendChild(renderer.domElement); - -const aspect = window.innerWidth / window.innerHeight; - -const camera = new THREE.PerspectiveCamera(50.0, aspect, 0.1, 10000); -const scene = new THREE.Scene(); - -scene.background = new THREE.Color(0x00001f); -camera.position.set(1, 1, 1); -const controls = new OrbitControls(camera, renderer.domElement); - -let computeDrawBuffer, computeInitDrawBuffer; - -init(); - -async function init() { - await renderer.init(); - - // geometry - - const vector = new THREE.Vector4(); - - const instances = 100000; - - const positions = []; - const offsets = []; - const colors = []; - const orientationsStart = []; - const orientationsEnd = []; - - positions.push(0.025, -0.025, 0); - positions.push(-0.025, 0.025, 0); - positions.push(0, 0, 0.025); - - // instanced attributes - - for (let i = 0; i < instances; i++) { - // offsets - - offsets.push(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5); - - // colors - - colors.push(Math.random(), Math.random(), Math.random(), Math.random()); - - // orientation start - - vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); - vector.normalize(); - - orientationsStart.push(vector.x, vector.y, vector.z, vector.w); - - // orientation end - - vector.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random() * 2 - 1); - vector.normalize(); - - orientationsEnd.push(vector.x, vector.y, vector.z, vector.w); - } - - const geometry = new THREE.InstancedBufferGeometry(); - geometry.instanceCount = instances; - - geometry.setAttribute('position', new THREE.Float32BufferAttribute(positions, 3)); - geometry.setAttribute('offset', new THREE.InstancedBufferAttribute(new Float32Array(offsets), 3)); - geometry.setAttribute('color', new THREE.InstancedBufferAttribute(new Float32Array(colors), 4)); - geometry.setAttribute( - 'orientationStart', - new THREE.InstancedBufferAttribute(new Float32Array(orientationsStart), 4), - ); - geometry.setAttribute('orientationEnd', new THREE.InstancedBufferAttribute(new Float32Array(orientationsEnd), 4)); - - const drawBuffer = new THREE.IndirectStorageBufferAttribute(new Uint32Array(5), 5); - geometry.setIndirect(drawBuffer); - - const drawBufferStruct = struct( - { - vertexCount: 'uint', - instanceCount: { type: 'uint', atomic: true }, - firstVertex: 'uint', - firstInstance: 'uint', - offset: 'uint', - }, - 'DrawBuffer', - ); - - const drawStorage = storage(drawBuffer, drawBufferStruct, drawBuffer.count); - - computeDrawBuffer = Fn(() => { - const halfTime = sin(time.mul(0.5)); - - const instanceCount = max(pow(halfTime.add(1), 4.0).mul(instances), 100).toVar('instanceCount'); - atomicStore(drawStorage.get('instanceCount'), instanceCount); - })().compute(instances); - - computeInitDrawBuffer = Fn(() => { - const drawInfo = drawStorage; - - drawInfo.get('vertexCount').assign(3); - atomicStore(drawInfo.get('instanceCount'), uint(0)); - drawInfo.get('firstVertex').assign(0); - drawInfo.get('firstInstance').assign(0); - drawInfo.get('offset').assign(0); - })().compute(1); - - const vPosition = varyingProperty('vec3', 'vPosition'); - const vColor = varyingProperty('vec4', 'vColor'); - - const positionShaderParams = { - position: attribute('position'), - offset: attribute('offset'), - color: attribute('color'), - orientationStart: attribute('orientationStart'), - orientationEnd: attribute('orientationEnd'), - time: time, - }; - - const positionFn = Fn(() => { - const { position, offset, color, orientationStart, orientationEnd } = positionShaderParams; - - const halfTime = sin(time.mul(0.5)); - - // Convert slowed sign range of (-1 to 1) to range of (1 -> 0 / 0.5 -> 3) - const oscilationRange = max(abs(halfTime.mul(2.0).add(1.0)), 0.5); - - const sphereOscilation = offset.mul(oscilationRange).add(position).toVar(); - - const orientation = normalize(mix(orientationStart, orientationEnd, halfTime)); - const vcV = cross(orientation.xyz, sphereOscilation); - const crossvcV = cross(orientation.xyz, vcV); - - vPosition.assign(vcV.mul(orientation.w.mul(2.0)).add(crossvcV.mul(2.0).add(sphereOscilation))); - vColor.assign(color); - - return vPosition; - })(); - - const fragmentFn = Fn(() => { - const color = vec4(vColor).toVar(); - - color.r.addAssign(sin(vPosition.x.mul(10.0).add(time)).mul(0.5)); - - return color; - })(); - - const material = new THREE.MeshBasicNodeMaterial({ - side: THREE.DoubleSide, - forceSinglePass: true, - transparent: true, - }); - - material.positionNode = positionFn; - material.fragmentNode = fragmentFn; - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - renderer.setAnimationLoop(render); - - window.addEventListener('resize', onWindowResize, false); -} - -function render() { - controls.update(); - - renderer.render(scene, camera); - - renderer.compute(computeInitDrawBuffer); - renderer.compute(computeDrawBuffer); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} diff --git a/examples-testing/examples/webgpu_test_memory.ts b/examples-testing/examples/webgpu_test_memory.ts deleted file mode 100644 index 0c7248fbf..000000000 --- a/examples-testing/examples/webgpu_test_memory.ts +++ /dev/null @@ -1,223 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass, mrt, packNormalToRGB, normalView, screenUV, context, sample, unpackRGBToNormal } from 'three/tsl'; -import { outline } from 'three/addons/tsl/display/OutlineNode.js'; -import { ao } from 'three/addons/tsl/display/GTAONode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, light; -let generateMeshes = true; -let mesh; -let renderPipeline; -let aoNode, outlineNode, scenePass, prePass; -const selectedObjects = []; - -const params = { - castShadow: true, - enablePP: false, - enableOutline: true, - enableAO: true, - recreateLight: () => { - // Remove existing light - if (light) { - scene.remove(light); - light.dispose(); - light = null; - } - - // Create new directional light - light = new THREE.DirectionalLight(0xffffff, 1); - light.position.set(Math.random() * 200 - 100, 100, Math.random() * 200 - 100); - light.castShadow = params.castShadow; - scene.add(light); - }, - start: () => { - generateMeshes = true; - }, - stop: () => { - generateMeshes = false; - }, -}; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 1, 10000); - camera.position.z = 200; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - renderer = new THREE.WebGPURenderer(); - renderer.shadowMap.enabled = true; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - container.appendChild(renderer.domElement); - - await renderer.init(); - - light = new THREE.DirectionalLight(0xffffff, 1); - light.position.set(0, 100, 0); - light.castShadow = true; - scene.add(light); - - const planeGeometry = new THREE.PlaneGeometry(1000, 1000); - const planeMaterial = new THREE.MeshLambertMaterial({ color: 0xcccccc }); - const plane = new THREE.Mesh(planeGeometry, planeMaterial); - plane.rotation.x = -Math.PI / 2; - plane.position.y = -100; - plane.receiveShadow = true; - scene.add(plane); - - // Inspector UI - const gui = renderer.inspector.createParameters('Settings'); - - gui.add(params, 'castShadow') - .name('Cast Shadow') - .onChange(value => { - if (light) light.castShadow = value; - }); - - const ppFolder = gui.addFolder('Post Processing'); - ppFolder.add(params, 'enablePP').name('Enable').onChange(updatePostProcessing); - ppFolder.add(params, 'enableOutline').name('Outline').onChange(updatePostProcessing); - ppFolder.add(params, 'enableAO').name('AO').onChange(updatePostProcessing); - - gui.add(params, 'recreateLight').name('Recreate Directional Light'); - gui.add(params, 'start').name('Start Creating Meshes'); - gui.add(params, 'stop').name('Stop Creating Meshes'); - - window.addEventListener('resize', onWindowResize); -} - -function updatePostProcessing() { - if (renderPipeline) { - renderPipeline.dispose(); - renderPipeline = null; - } - - if (scenePass) { - scenePass.dispose(); - scenePass = null; - } - - if (prePass) { - prePass.dispose(); - prePass = null; - } - - if (aoNode) { - aoNode.dispose(); - aoNode = null; - } - - if (outlineNode) { - outlineNode.dispose(); - outlineNode = null; - } - - if (params.enablePP) { - renderPipeline = new THREE.RenderPipeline(renderer); - - scenePass = pass(scene, camera); - let colorNode = scenePass; - - if (params.enableAO) { - prePass = pass(scene, camera); - prePass.setMRT( - mrt({ - output: packNormalToRGB(normalView), - }), - ); - - const prePassNormal = sample(uv => { - return unpackRGBToNormal(prePass.getTextureNode().sample(uv)); - }); - const prePassDepth = prePass.getTextureNode('depth'); - - aoNode = ao(prePassDepth, prePassNormal, camera); - - scenePass.contextNode = context({ - ao: aoNode.getTextureNode().sample(screenUV).r, - }); - } - - if (params.enableOutline) { - outlineNode = outline(scene, camera, { - selectedObjects: selectedObjects, - }); - colorNode = colorNode.add(outlineNode); - } - - renderPipeline.outputNode = colorNode; - } -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function createImage() { - const canvas = document.createElement('canvas'); - canvas.width = 256; - canvas.height = 256; - - const canvas2DContext = canvas.getContext('2d'); - canvas2DContext.fillStyle = - 'rgb(' + - Math.floor(Math.random() * 256) + - ',' + - Math.floor(Math.random() * 256) + - ',' + - Math.floor(Math.random() * 256) + - ')'; - canvas2DContext.fillRect(0, 0, 256, 256); - - return canvas; -} - -// - -function animate() { - if (generateMeshes) { - if (mesh) { - scene.remove(mesh); - - mesh.geometry.dispose(); - mesh.material.map.dispose(); - mesh.material.dispose(); - } - - const geometry = new THREE.SphereGeometry(50, Math.random() * 64, Math.random() * 32); - - const texture = new THREE.CanvasTexture(createImage()); - - const material = new THREE.MeshLambertMaterial({ map: texture }); - - mesh = new THREE.Mesh(geometry, material); - mesh.castShadow = true; - - scene.add(mesh); - - if (outlineNode) { - selectedObjects[0] = mesh; - } - } - - if (renderPipeline) { - renderPipeline.render(); - } else { - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgpu_texturegather.ts b/examples-testing/examples/webgpu_texturegather.ts deleted file mode 100644 index 0487eda9e..000000000 --- a/examples-testing/examples/webgpu_texturegather.ts +++ /dev/null @@ -1,120 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { If, vec4, uv, ivec2, texture, Fn } from 'three/tsl'; - -// WebGPU Backend -init(); - -// WebGL Backend -init(true); - -async function init(forceWebGL = false) { - const aspect = window.innerWidth / 2 / window.innerHeight; - const camera = new THREE.OrthographicCamera(-aspect, aspect); - camera.position.z = 2; - - const scene = new THREE.Scene(); - - // texture - - const material = new THREE.MeshBasicNodeMaterial({ color: 0xffffff }); - - const colorNode = texture(); - const depthNode = texture(); - - material.colorNode = Fn(() => { - const color = vec4(1).toVar(); - - const vuv = uv().toVar(); - - If(vuv.y.greaterThan(0.5), () => { - color.assign(colorNode.sample(vuv.mul(10)).offset(ivec2(0, 7)).gather(0)); - }).Else(() => { - color.assign(depthNode.sample(vuv).offset(ivec2(0, 7)).gather(0).compare(1)); - }); - - return color; - })(); - - // - - const plane = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - scene.add(plane); - - const renderer = new THREE.WebGPURenderer({ antialias: false, forceWebGL: forceWebGL }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth / 2, window.innerHeight); - renderer.setAnimationLoop(animate); - await renderer.init(); - - document.body.appendChild(renderer.domElement); - renderer.domElement.style.position = 'absolute'; - renderer.domElement.style.top = '0'; - renderer.domElement.style.left = '0'; - renderer.domElement.style.width = '50%'; - renderer.domElement.style.height = '100%'; - - if (forceWebGL) { - renderer.domElement.style.left = '50%'; - - scene.background = new THREE.Color(0x212121); - } else { - scene.background = new THREE.Color(0x313131); - } - - // - - const depthTexture = new THREE.DepthTexture(); - depthTexture.compareFunction = THREE.LessEqualCompare; - const rt = new THREE.RenderTarget(100, 100, { - depthTexture, - generateMipmaps: true, - minFilter: THREE.LinearMipmapLinearFilter, - }); - rt.texture.wrapS = THREE.RepeatWrapping; - rt.texture.wrapT = THREE.RepeatWrapping; - - const cameraZ = 2.5; - const rtScene = new THREE.Scene(); - rtScene.background = new THREE.Color(0x808080); - const rtCamera = new THREE.PerspectiveCamera(50, 1, cameraZ - 0.5 * Math.sqrt(3), cameraZ + 0.5 * Math.sqrt(3)); - rtCamera.position.z = cameraZ; - - const dirLight = new THREE.DirectionalLight(); - dirLight.position.set(1, 1, 0); - rtScene.add(dirLight); - rtScene.add(new THREE.AmbientLight(0xffffff, 0.1)); - - const box = new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshStandardNodeMaterial({ color: 0xff0000 })); - box.rotation.set(Math.PI / 4, Math.PI / 4, 0); - rtScene.add(box); - - renderer.setRenderTarget(rt); - renderer.render(rtScene, rtCamera); - renderer.setRenderTarget(null); - - colorNode.value = rt.texture; - depthNode.value = rt.depthTexture; - - // - - function animate() { - renderer.render(scene, camera); - } - - window.addEventListener('resize', onWindowResize); - - function onWindowResize() { - renderer.setSize(window.innerWidth / 2, window.innerHeight); - - const aspect = window.innerWidth / 2 / window.innerHeight; - - const frustumHeight = camera.top - camera.bottom; - - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - - camera.updateProjectionMatrix(); - - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgpu_texturegrad.ts b/examples-testing/examples/webgpu_texturegrad.ts deleted file mode 100644 index da07b4d31..000000000 --- a/examples-testing/examples/webgpu_texturegrad.ts +++ /dev/null @@ -1,116 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { If, vec4, float, time, cos, pow, vec2, uv, texture, Fn } from 'three/tsl'; - -// WebGPU Backend -init(); - -// WebGL Backend -init(true); - -async function init(forceWebGL = false) { - const aspect = window.innerWidth / 2 / window.innerHeight; - const camera = new THREE.OrthographicCamera(-aspect, aspect); - camera.position.z = 2; - - const scene = new THREE.Scene(); - - // texture - - const material = new THREE.MeshBasicNodeMaterial({ color: 0xffffff }); - - // load async brick_diffuse - const map = await new THREE.TextureLoader().loadAsync('textures/uv_grid_opengl.jpg'); - - material.colorNode = Fn(() => { - const color = vec4(1).toVar(); - - const vuv = uv().toVar(); - const blur = pow( - float(0.0625) - .sub(cos(vuv.x.mul(20.0).add(time))) - .mul(0.0625), - 2.0, - ); - - const grad = vec2(blur).toVar(); - - If(vuv.y.greaterThan(0.5), () => { - grad.assign(0); - }); - - color.assign( - texture(map, vuv.add(vec2(blur, blur).mul(0.5))) - .grad(grad, grad) - .mul(0.25) - .add( - texture(map, vuv.add(vec2(blur, blur.negate()).mul(0.5))) - .grad(grad, grad) - .mul(0.25), - ) - .add( - texture(map, vuv.add(vec2(blur.negate(), blur).mul(0.5))) - .grad(grad, grad) - .mul(0.25), - ) - .add( - texture(map, vuv.add(vec2(blur.negate(), blur.negate()).mul(0.5))) - .grad(grad, grad) - .mul(0.25), - ), - ); - - If(vuv.y.greaterThan(0.497).and(vuv.y.lessThan(0.503)), () => { - color.assign(1); - }); - - return color; - })(); - - // - - const box = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material); - scene.add(box); - - const renderer = new THREE.WebGPURenderer({ antialias: false, forceWebGL: forceWebGL }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth / 2, window.innerHeight); - renderer.setAnimationLoop(animate); - - document.body.appendChild(renderer.domElement); - renderer.domElement.style.position = 'absolute'; - renderer.domElement.style.top = '0'; - renderer.domElement.style.left = '0'; - renderer.domElement.style.width = '50%'; - renderer.domElement.style.height = '100%'; - - if (forceWebGL) { - renderer.domElement.style.left = '50%'; - - scene.background = new THREE.Color(0x212121); - } else { - scene.background = new THREE.Color(0x313131); - } - - // - - function animate() { - renderer.render(scene, camera); - } - - window.addEventListener('resize', onWindowResize); - - function onWindowResize() { - renderer.setSize(window.innerWidth / 2, window.innerHeight); - - const aspect = window.innerWidth / 2 / window.innerHeight; - - const frustumHeight = camera.top - camera.bottom; - - camera.left = (-frustumHeight * aspect) / 2; - camera.right = (frustumHeight * aspect) / 2; - - camera.updateProjectionMatrix(); - - renderer.render(scene, camera); - } -} diff --git a/examples-testing/examples/webgpu_textures_2d-array.ts b/examples-testing/examples/webgpu_textures_2d-array.ts deleted file mode 100644 index a1a354ff7..000000000 --- a/examples-testing/examples/webgpu_textures_2d-array.ts +++ /dev/null @@ -1,69 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { texture, uv, time, oscTriangle } from 'three/tsl'; - -import { unzipSync } from 'three/addons/libs/fflate.module.js'; - -// - -let camera, scene, mesh, renderer; - -const planeWidth = 50; -const planeHeight = 50; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); - camera.position.z = 70; - - scene = new THREE.Scene(); - - // width 256, height 256, depth 109, 8-bit, zip archived raw data - - new THREE.FileLoader().setResponseType('arraybuffer').load('textures/3d/head256x256x109.zip', function (data) { - const zip = unzipSync(new Uint8Array(data)); - const array = new Uint8Array(zip['head256x256x109'].buffer); - - const map = new THREE.DataArrayTexture(array, 256, 256, 109); - map.format = THREE.RedFormat; - map.needsUpdate = true; - - let coord = uv(); - coord = coord.setY(coord.y.oneMinus()); // flip y - - let oscLayers = oscTriangle(time.mul(0.5)); // [ /\/ ] triangle osc animation - oscLayers = oscLayers.add(1).mul(0.5); // convert osc range of [ -1, 1 ] to [ 0, 1 ] - oscLayers = oscLayers.mul(map.image.depth); // scale osc range to texture depth - - const material = new THREE.MeshBasicNodeMaterial(); - material.colorNode = texture(map, coord).depth(oscLayers).r.remap(0, 1, -0.1, 1.8); // remap to make it more visible - - const geometry = new THREE.PlaneGeometry(planeWidth, planeHeight); - - mesh = new THREE.Mesh(geometry, material); - - scene.add(mesh); - }); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(render); - container.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_textures_2d-array_compressed.ts b/examples-testing/examples/webgpu_textures_2d-array_compressed.ts deleted file mode 100644 index 1a44e04c4..000000000 --- a/examples-testing/examples/webgpu_textures_2d-array_compressed.ts +++ /dev/null @@ -1,85 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { texture, uniform, uv } from 'three/tsl'; - -import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; - -// - -let camera, scene, mesh, renderer, timer; - -const depth = uniform(0); - -const planeWidth = 50; -const planeHeight = 25; - -let depthStep = 1; - -init(); - -async function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 2000); - camera.position.z = 70; - - scene = new THREE.Scene(); - - // - timer = new THREE.Timer(); - timer.connect(document); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - await renderer.init(); - - // - - const ktx2Loader = new KTX2Loader(); - ktx2Loader.detectSupport(renderer); - - ktx2Loader.load('textures/spiritedaway.ktx2', function (texturearray) { - const material = new THREE.NodeMaterial(); - - material.colorNode = texture(texturearray, uv().flipY()).depth(depth); - const geometry = new THREE.PlaneGeometry(planeWidth, planeHeight); - - mesh = new THREE.Mesh(geometry, material); - - scene.add(mesh); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - if (mesh) { - const delta = timer.getDelta() * 10; - - depthStep += delta; - - const value = depthStep % 5; - - depth.value = value; - } - - render(); -} - -function render() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_textures_anisotropy.ts b/examples-testing/examples/webgpu_textures_anisotropy.ts deleted file mode 100644 index 0444823f5..000000000 --- a/examples-testing/examples/webgpu_textures_anisotropy.ts +++ /dev/null @@ -1,145 +0,0 @@ -import * as THREE from 'three/webgpu'; - -let container; - -let camera, scene1, scene2, renderer; - -let mouseX = 0, - mouseY = 0; - -init(); - -function init() { - const SCREEN_WIDTH = window.innerWidth; - const SCREEN_HEIGHT = window.innerHeight; - - container = document.createElement('div'); - document.body.appendChild(container); - - renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL: false }); - - // RENDERER - - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT); - renderer.setAnimationLoop(render); - renderer.autoClear = false; - - renderer.domElement.style.position = 'relative'; - container.appendChild(renderer.domElement); - - // - - camera = new THREE.PerspectiveCamera(35, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 25000); - camera.position.z = 1500; - - scene1 = new THREE.Scene(); - scene1.fog = new THREE.Fog(0xf2f7ff, 1, 25000); - - scene2 = new THREE.Scene(); - scene2.fog = new THREE.Fog(0xf2f7ff, 1, 25000); - - scene1.add(new THREE.AmbientLight(0xeef0ff, 3)); - scene2.add(new THREE.AmbientLight(0xeef0ff, 3)); - - const light1 = new THREE.DirectionalLight(0xffffff, 6); - light1.position.set(1, 1, 1); - scene1.add(light1); - - const light2 = new THREE.DirectionalLight(0xffffff, 6); - light2.position.set(1, 1, 1); - scene2.add(light2); - - // GROUND - - const textureLoader = new THREE.TextureLoader(); - - const maxAnisotropy = renderer.getMaxAnisotropy(); - - const texture1 = textureLoader.load('textures/crate.gif'); - const material1 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture1 }); - - texture1.colorSpace = THREE.SRGBColorSpace; - texture1.anisotropy = renderer.getMaxAnisotropy(); - texture1.wrapS = texture1.wrapT = THREE.RepeatWrapping; - texture1.repeat.set(512, 512); - - const texture2 = textureLoader.load('textures/crate.gif'); - const material2 = new THREE.MeshPhongMaterial({ color: 0xffffff, map: texture2 }); - - texture2.colorSpace = THREE.SRGBColorSpace; - texture2.anisotropy = 1; - texture2.wrapS = texture2.wrapT = THREE.RepeatWrapping; - texture2.repeat.set(512, 512); - - if (maxAnisotropy > 0) { - document.getElementById('val_left').innerHTML = texture1.anisotropy; - document.getElementById('val_right').innerHTML = texture2.anisotropy; - } else { - document.getElementById('val_left').innerHTML = 'not supported'; - document.getElementById('val_right').innerHTML = 'not supported'; - } - - // - - const geometry = new THREE.PlaneGeometry(100, 100); - - const mesh1 = new THREE.Mesh(geometry, material1); - mesh1.rotation.x = -Math.PI / 2; - mesh1.scale.set(1000, 1000, 1000); - - const mesh2 = new THREE.Mesh(geometry, material2); - mesh2.rotation.x = -Math.PI / 2; - mesh2.scale.set(1000, 1000, 1000); - - scene1.add(mesh1); - scene2.add(mesh2); - - // - - document.addEventListener('mousemove', onDocumentMouseMove); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onDocumentMouseMove(event) { - const windowHalfX = window.innerWidth / 2; - const windowHalfY = window.innerHeight / 2; - - mouseX = event.clientX - windowHalfX; - mouseY = event.clientY - windowHalfY; -} - -function render() { - const SCREEN_WIDTH = window.innerWidth; - const SCREEN_HEIGHT = window.innerHeight; - - camera.position.x += (mouseX - camera.position.x) * 0.05; - camera.position.y = THREE.MathUtils.clamp( - camera.position.y + (-(mouseY - 200) - camera.position.y) * 0.05, - 50, - 1000, - ); - - camera.lookAt(scene1.position); - renderer.clear(); - - renderer.setScissorTest(true); - - renderer.setScissor(0, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene1, camera); - - renderer.setScissorTest(true); - - renderer.setScissor(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH / 2 - 2, SCREEN_HEIGHT); - renderer.render(scene2, camera); - - renderer.setScissorTest(false); -} diff --git a/examples-testing/examples/webgpu_textures_partialupdate.ts b/examples-testing/examples/webgpu_textures_partialupdate.ts deleted file mode 100644 index d893a041d..000000000 --- a/examples-testing/examples/webgpu_textures_partialupdate.ts +++ /dev/null @@ -1,105 +0,0 @@ -import * as THREE from 'three/webgpu'; - -let camera, scene, renderer, timer, dataTexture, diffuseMap; - -let last = 0; -const position = new THREE.Vector2(); -const color = new THREE.Color(); - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.z = 2; - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - const loader = new THREE.TextureLoader(); - diffuseMap = loader.load('textures/carbon/Carbon.png'); - diffuseMap.colorSpace = THREE.SRGBColorSpace; - diffuseMap.minFilter = THREE.LinearFilter; - diffuseMap.generateMipmaps = false; - - const geometry = new THREE.PlaneGeometry(2, 2); - const material = new THREE.MeshBasicMaterial({ map: diffuseMap }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // - - const width = 32; - const height = 32; - - const data = new Uint8Array(width * height * 4); - dataTexture = new THREE.DataTexture(data, width, height); - dataTexture.colorSpace = THREE.SRGBColorSpace; - - // - - renderer = new THREE.WebGPURenderer({ antialias: true, forceWebGL: false }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const elapsedTime = timer.getElapsed(); - - renderer.render(scene, camera); - - if (elapsedTime - last > 0.1) { - last = elapsedTime; - - position.x = 32 * THREE.MathUtils.randInt(1, 16) - 32; - position.y = 32 * THREE.MathUtils.randInt(1, 16) - 32; - - // generate new color data - updateDataTexture(dataTexture); - - // perform copy from src to dest texture to a random position - - renderer.copyTextureToTexture(dataTexture, diffuseMap, null, position); - } -} - -function updateDataTexture(texture) { - const size = texture.image.width * texture.image.height; - const data = texture.image.data; - - // generate a random color and update texture data - - color.setHex(Math.random() * 0xffffff); - - const r = Math.floor(color.r * 255); - const g = Math.floor(color.g * 255); - const b = Math.floor(color.b * 255); - - for (let i = 0; i < size; i++) { - const stride = i * 4; - - data[stride] = r; - data[stride + 1] = g; - data[stride + 2] = b; - data[stride + 3] = 1; - } - - texture.needsUpdate = true; -} diff --git a/examples-testing/examples/webgpu_tonemapping.ts b/examples-testing/examples/webgpu_tonemapping.ts deleted file mode 100644 index 9c2161578..000000000 --- a/examples-testing/examples/webgpu_tonemapping.ts +++ /dev/null @@ -1,141 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let renderer, scene, camera, controls; -let gui; - -const params = { - exposure: 1.0, - toneMapping: 'Neutral', - blurriness: 0.3, - intensity: 1.0, -}; - -const toneMappingOptions = { - None: THREE.NoToneMapping, - Linear: THREE.LinearToneMapping, - Reinhard: THREE.ReinhardToneMapping, - Cineon: THREE.CineonToneMapping, - ACESFilmic: THREE.ACESFilmicToneMapping, - AgX: THREE.AgXToneMapping, - Neutral: THREE.NeutralToneMapping, -}; - -init().catch(function (err) { - console.error(err); -}); - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - renderer.toneMapping = toneMappingOptions[params.toneMapping]; - renderer.toneMappingExposure = params.exposure; - - scene = new THREE.Scene(); - scene.backgroundBlurriness = params.blurriness; - - const light = new THREE.DirectionalLight(0xfff3ee, 3); // simulate sun - light.position.set(1, 0.05, 0.7); - scene.add(light); - - // scene.add( new THREE.DirectionalLightHelper( light, 1, 0x000000 ) ); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.01, 10); - camera.position.set(-0.02, 0.03, 0.05); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enablePan = false; - controls.enableDamping = true; - controls.minDistance = 0.03; - controls.maxDistance = 0.2; - controls.target.set(0, 0.03, 0); - controls.update(); - - const hdrLoader = new HDRLoader().setPath('textures/equirectangular/'); - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const gltfLoader = new GLTFLoader(); - gltfLoader.setDRACOLoader(dracoLoader); - gltfLoader.setPath('models/gltf/'); - - const [texture, gltf] = await Promise.all([ - hdrLoader.loadAsync('venice_sunset_1k.hdr'), - gltfLoader.loadAsync('venice_mask.glb'), - ]); - - // environment - - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - - // model - - scene.add(gltf.scene); - - window.addEventListener('resize', onWindowResize); - - // - - gui = renderer.inspector.createParameters('Settings'); - const toneMappingFolder = gui.addFolder('Tone Mapping'); - - toneMappingFolder - .add(params, 'toneMapping', Object.keys(toneMappingOptions)) - - .name('type') - .onChange(function () { - renderer.toneMapping = toneMappingOptions[params.toneMapping]; - }); - - toneMappingFolder - .add(params, 'exposure', 0, 2) - - .onChange(function (value) { - renderer.toneMappingExposure = value; - }); - - const backgroundFolder = gui.addFolder('Background'); - - backgroundFolder - .add(params, 'blurriness', 0, 1) - - .onChange(function (value) { - scene.backgroundBlurriness = value; - }); - - backgroundFolder - .add(params, 'intensity', 0, 1) - - .onChange(function (value) { - scene.backgroundIntensity = value; - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_angular_slicing.ts b/examples-testing/examples/webgpu_tsl_angular_slicing.ts deleted file mode 100644 index cf503b783..000000000 --- a/examples-testing/examples/webgpu_tsl_angular_slicing.ts +++ /dev/null @@ -1,174 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { If, TWO_PI, atan, color, frontFacing, output, positionLocal, Fn, uniform, vec4 } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-5, 5, 12); - - scene = new THREE.Scene(); - - // environment - - const hdrLoader = new UltraHDRLoader(); - hdrLoader.load('textures/equirectangular/royal_esplanade_2k.hdr.jpg', environmentMap => { - environmentMap.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = environmentMap; - scene.environment = environmentMap; - }); - - // lights - - const directionalLight = new THREE.DirectionalLight('#ffffff', 4); - directionalLight.position.set(6.25, 3, 4); - directionalLight.castShadow = true; - directionalLight.shadow.mapSize.set(2048, 2048); - directionalLight.shadow.camera.near = 0.1; - directionalLight.shadow.camera.far = 30; - directionalLight.shadow.camera.top = 8; - directionalLight.shadow.camera.right = 8; - directionalLight.shadow.camera.bottom = -8; - directionalLight.shadow.camera.left = -8; - directionalLight.shadow.normalBias = 0.05; - scene.add(directionalLight); - - // TSL functions - - const inAngle = Fn(([position, angleStart, angleArc]) => { - const angle = atan(position.y, position.x).sub(angleStart).mod(TWO_PI).toVar(); - return angle.greaterThan(0).and(angle.lessThan(angleArc)); - }); - - // materials - - const defaultMaterial = new THREE.MeshPhysicalNodeMaterial({ - metalness: 0.5, - roughness: 0.25, - envMapIntensity: 0.5, - color: '#858080', - }); - - const slicedMaterial = new THREE.MeshPhysicalNodeMaterial({ - metalness: 0.5, - roughness: 0.25, - envMapIntensity: 0.5, - color: '#858080', - side: THREE.DoubleSide, - }); - - // uniforms - - const sliceStart = uniform(1.75); - const sliceArc = uniform(1.25); - const sliceColor = uniform(color('#b62f58')); - - // mask - - const mask = inAngle(positionLocal.xy, sliceStart, sliceArc).not(); - - slicedMaterial.maskNode = mask; - //slicedMaterial.maskShadowNode = mask; // optional: custom mask shadows - - // output - - slicedMaterial.outputNode = Fn(() => { - // backface color - - const finalOutput = output; - If(frontFacing.not(), () => { - finalOutput.assign(vec4(sliceColor, 1)); - }); - - return finalOutput; - })(); - - // model - - const dracoLoader = new DRACOLoader(); - - const gltfLoader = new GLTFLoader(); - gltfLoader.setDRACOLoader(dracoLoader); - - gltfLoader.load('./models/gltf/gears.glb', gltf => { - const model = gltf.scene; - - model.traverse(child => { - if (child.isMesh) { - if (child.name === 'outerHull') child.material = slicedMaterial; - else child.material = defaultMaterial; - - child.castShadow = true; - child.receiveShadow = true; - } - }); - - scene.add(model); - }); - - // plane - - const plane = new THREE.Mesh( - new THREE.PlaneGeometry(10, 10, 10), - new THREE.MeshStandardMaterial({ color: '#aaaaaa' }), - ); - plane.receiveShadow = true; - plane.position.set(-4, -3, -4); - plane.lookAt(new THREE.Vector3(0, 0, 0)); - scene.add(plane); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - // events - - window.addEventListener('resize', onWindowResize); - - // debug - - const gui = renderer.inspector.createParameters('Parameters'); - gui.add(sliceStart, 'value', -Math.PI, Math.PI, 0.001).name('sliceStart'); - gui.add(sliceArc, 'value', 0, Math.PI * 2, 0.001).name('sliceArc'); - gui.addColor({ color: sliceColor.value.getHexString(THREE.SRGBColorSpace) }, 'color').onChange(value => - sliceColor.value.set(value), - ); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_earth.ts b/examples-testing/examples/webgpu_tsl_earth.ts deleted file mode 100644 index 7530c7eba..000000000 --- a/examples-testing/examples/webgpu_tsl_earth.ts +++ /dev/null @@ -1,175 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - step, - normalWorldGeometry, - output, - texture, - vec3, - vec4, - normalize, - positionWorld, - bumpMap, - cameraPosition, - color, - uniform, - mix, - uv, - max, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls, globe, timer; - -init(); - -function init() { - timer = new THREE.Timer(); - timer.connect(document); - - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(4.5, 2, 3); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x000000); - - // sun - - const sun = new THREE.DirectionalLight('#ffffff', 2); - sun.position.set(0, 0, 3); - scene.add(sun); - - // uniforms - - const atmosphereDayColor = uniform(color('#4db2ff')); - const atmosphereTwilightColor = uniform(color('#bc490b')); - const roughnessLow = uniform(0.25); - const roughnessHigh = uniform(0.35); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const dayTexture = textureLoader.load('./textures/planets/earth_day_4096.jpg'); - dayTexture.colorSpace = THREE.SRGBColorSpace; - dayTexture.anisotropy = 8; - - const nightTexture = textureLoader.load('./textures/planets/earth_night_4096.jpg'); - nightTexture.colorSpace = THREE.SRGBColorSpace; - nightTexture.anisotropy = 8; - - const bumpRoughnessCloudsTexture = textureLoader.load('./textures/planets/earth_bump_roughness_clouds_4096.jpg'); - bumpRoughnessCloudsTexture.anisotropy = 8; - - // fresnel - - const viewDirection = positionWorld.sub(cameraPosition).normalize(); - const fresnel = viewDirection.dot(normalWorldGeometry).abs().oneMinus().toVar(); - - // sun orientation - - const sunOrientation = normalWorldGeometry.dot(normalize(sun.position)).toVar(); - - // atmosphere color - - const atmosphereColor = mix(atmosphereTwilightColor, atmosphereDayColor, sunOrientation.smoothstep(-0.25, 0.75)); - - // globe - - const globeMaterial = new THREE.MeshStandardNodeMaterial(); - - const cloudsStrength = texture(bumpRoughnessCloudsTexture, uv()).b.smoothstep(0.2, 1); - - globeMaterial.colorNode = mix(texture(dayTexture), vec3(1), cloudsStrength.mul(2)); - - const roughness = max(texture(bumpRoughnessCloudsTexture).g, step(0.01, cloudsStrength)); - globeMaterial.roughnessNode = roughness.remap(0, 1, roughnessLow, roughnessHigh); - - const night = texture(nightTexture); - const dayStrength = sunOrientation.smoothstep(-0.25, 0.5); - - const atmosphereDayStrength = sunOrientation.smoothstep(-0.5, 1); - const atmosphereMix = atmosphereDayStrength.mul(fresnel.pow(2)).clamp(0, 1); - - let finalOutput = mix(night.rgb, output.rgb, dayStrength); - finalOutput = mix(finalOutput, atmosphereColor, atmosphereMix); - - globeMaterial.outputNode = vec4(finalOutput, output.a); - - const bumpElevation = max(texture(bumpRoughnessCloudsTexture).r, cloudsStrength); - globeMaterial.normalNode = bumpMap(bumpElevation); - - const sphereGeometry = new THREE.SphereGeometry(1, 64, 64); - globe = new THREE.Mesh(sphereGeometry, globeMaterial); - scene.add(globe); - - // atmosphere - - const atmosphereMaterial = new THREE.MeshBasicNodeMaterial({ side: THREE.BackSide, transparent: true }); - let alpha = fresnel.remap(0.73, 1, 1, 0).pow(3); - alpha = alpha.mul(sunOrientation.smoothstep(-0.5, 1)); - atmosphereMaterial.outputNode = vec4(atmosphereColor, alpha); - - const atmosphere = new THREE.Mesh(sphereGeometry, atmosphereMaterial); - atmosphere.scale.setScalar(1.04); - scene.add(atmosphere); - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - // events - - window.addEventListener('resize', onWindowResize); - - // debug - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.addColor({ color: atmosphereDayColor.value.getHex(THREE.SRGBColorSpace) }, 'color') - .onChange(value => { - atmosphereDayColor.value.set(value); - }) - .name('atmosphereDayColor'); - - gui.addColor({ color: atmosphereTwilightColor.value.getHex(THREE.SRGBColorSpace) }, 'color') - .onChange(value => { - atmosphereTwilightColor.value.set(value); - }) - .name('atmosphereTwilightColor'); - - gui.add(roughnessLow, 'value', 0, 1, 0.001).name('roughnessLow'); - gui.add(roughnessHigh, 'value', 0, 1, 0.001).name('roughnessHigh'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - timer.update(); - - const delta = timer.getDelta(); - globe.rotation.y += delta * 0.025; - - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_galaxy.ts b/examples-testing/examples/webgpu_tsl_galaxy.ts deleted file mode 100644 index 739138504..000000000 --- a/examples-testing/examples/webgpu_tsl_galaxy.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color, cos, float, mix, range, sin, time, uniform, uv, vec3, vec4, TWO_PI } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -let camera, scene, renderer, controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(4, 2, 5); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x201919); - - // galaxy - - const material = new THREE.SpriteNodeMaterial({ - depthWrite: false, - blending: THREE.AdditiveBlending, - }); - - const size = uniform(0.08); - material.scaleNode = range(0, 1).mul(size); - - const radiusRatio = range(0, 1); - const radius = radiusRatio.pow(1.5).mul(5).toVar(); - - const branches = 3; - const branchAngle = range(0, branches).floor().mul(TWO_PI.div(branches)); - const angle = branchAngle.add(time.mul(radiusRatio.oneMinus())); - - const position = vec3(cos(angle), 0, sin(angle)).mul(radius); - - const randomOffset = range(vec3(-1), vec3(1)).pow3().mul(radiusRatio).add(0.2); - - material.positionNode = position.add(randomOffset); - - const colorInside = uniform(color('#ffa575')); - const colorOutside = uniform(color('#311599')); - const colorFinal = mix(colorInside, colorOutside, radiusRatio.oneMinus().pow(2).oneMinus()); - const alpha = float(0.1).div(uv().sub(0.5).length()).sub(0.2); - material.colorNode = vec4(colorFinal, alpha); - - const mesh = new THREE.InstancedMesh(new THREE.PlaneGeometry(1, 1), material, 20000); - scene.add(mesh); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - // events - - window.addEventListener('resize', onWindowResize); - - // debug - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.add(size, 'value', 0, 1, 0.001).name('size'); - - gui.addColor({ color: colorInside.value.getHex(THREE.SRGBColorSpace) }, 'color') - .name('colorInside') - .onChange(function (value) { - colorInside.value.set(value); - }); - - gui.addColor({ color: colorOutside.value.getHex(THREE.SRGBColorSpace) }, 'color') - .name('colorOutside') - .onChange(function (value) { - colorOutside.value.set(value); - }); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_graph.ts b/examples-testing/examples/webgpu_tsl_graph.ts deleted file mode 100644 index cdde58a9a..000000000 --- a/examples-testing/examples/webgpu_tsl_graph.ts +++ /dev/null @@ -1,228 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { Fn, abs, fract, fwidth, length, max, saturate, smoothstep, vec3, vec4, positionWorld, float } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { TSLGraphLoader } from 'three/addons/inspector/extensions/tsl-graph/TSLGraphLoader.js'; - -let camera, scene, renderer; -let controls; -let prefab; - -init(); - -async function initTSLGraph() { - // Create Materials - - const m1 = new THREE.MeshPhysicalNodeMaterial(); - m1.userData.graphId = 'mat_1-physical'; - - const m2 = new THREE.MeshStandardNodeMaterial(); - m2.userData.graphId = 'mat_2-standard'; - - const m3 = new THREE.MeshPhongNodeMaterial(); - m3.userData.graphId = 'mat_3-phong'; - - const m4 = new THREE.MeshBasicNodeMaterial(); - m4.userData.graphId = 'mat_4-basic'; - - const materials = [m1, m2, m3, m4]; - - for (let i = 0; i < materials.length; i++) { - createShaderBall(materials[i], new THREE.Vector3((i & 1) * 4 - 2, 0, (i & 2) * 2 - 2)); - } - - // TSL Graph Editor - - renderer.inspector.onExtension('TSL Graph', async tslGraph => { - renderer.inspector.setActiveTab(tslGraph); - - // Apply TSL Graph from Local Storage if exists - // Every time a TSL Graph is changed, it will be stored in the local storage - - if (tslGraph.hasGraphs) { - tslGraph.apply(scene); - } else { - // Load a TSL Graph from a file - // Use it for production - - const tslLoader = new TSLGraphLoader(); - const applier = await tslLoader.setPath('./shaders/').loadAsync('tsl-graphs.json'); - - applier.apply(scene); - } - }); - - // Active TSL Graph Editor - // Only is needed if you don't activate it from the GUI - - renderer.inspector.setActiveExtension('TSL Graph', true); -} - -async function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 0.9; - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.25, 200); - camera.position.set(3, 5, 8); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x444444); - - await renderer.init(); - - // Ground plane - - const plane = new THREE.Mesh(new THREE.CircleGeometry(40), createGroudMaterial()); - plane.rotation.x = -Math.PI / 2; - plane.renderOrder = -1; - scene.add(plane); - - // - - controls = new OrbitControls(camera); - controls.connect(renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 2; - controls.maxDistance = 40; - - // - - const environment = await new HDRLoader() - .setPath('textures/equirectangular/') - .loadAsync('monochrome_studio_02_1k.hdr'); - environment.mapping = THREE.EquirectangularReflectionMapping; - - const light = new THREE.DirectionalLight(0xffffff, 1); - light.position.set(1, 1, 1); - scene.add(light); - - scene.environment = environment; - - prefab = (await new GLTFLoader().loadAsync('./models/gltf/ShaderBall.glb')).scene; - - await initTSLGraph(); - - initGUI(); - - // Events - - resize(); - - window.addEventListener('resize', resize); - renderer.inspector.addEventListener('resize', resize); -} - -async function createShaderBall(material, position = new THREE.Vector3()) { - const model = prefab.clone(); - model.position.copy(position); - scene.add(model); - - // - - const calibrationMesh = model.getObjectByName('Calibration_Mesh'); - calibrationMesh.material = material; - - const previewMesh = model.getObjectByName('Preview_Mesh'); - previewMesh.material = material; - - calibrationMesh.renderOrder = 1; - previewMesh.renderOrder = 2; -} - -function initGUI() { - const gui = renderer.inspector.createParameters('Shader Ball'); - - const API = { - showCalibrationMesh: true, - showPreviewMesh: true, - }; - - gui.add(API, 'showCalibrationMesh') - .name('Calibration Mesh') - .onChange(function (value) { - setVisibility('Calibration_Mesh', value); - }); - - gui.add(API, 'showPreviewMesh') - .name('Preview Mesh') - .onChange(function (value) { - setVisibility('Preview_Mesh', value); - }); - - renderer.inspector.hide(); -} - -function resize() { - const size = renderer.inspector.getSize(); - const width = window.innerWidth - size.width; - const height = window.innerHeight - size.height; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function render() { - if (controls) controls.update(); - - renderer.render(scene, camera); -} - -// - -function setVisibility(name, visible) { - scene.traverse(function (node) { - if (node.isMesh) { - if (node.name == name) node.visible = visible; - } - }); -} - -function createGroudMaterial() { - const material = new THREE.MeshBasicNodeMaterial(); - - const grid = Fn(([coord, lineWidth = float(0.01), dotSize = float(0.03)]) => { - // https://bgolus.medium.com/the-best-darn-grid-shader-yet-727f9278b9d8 - - const g = fract(coord); - const fw = fwidth(coord); - const gx = abs(g.x.sub(0.5)); - const gy = abs(g.y.sub(0.5)); - - const lineX = saturate(lineWidth.sub(gx).div(fw.x).add(0.5)); - const lineY = saturate(lineWidth.sub(gy).div(fw.y).add(0.5)); - const lines = max(lineX, lineY); - - const squareDist = max(gx, gy); - const aa = max(fw.x, fw.y); - const dots = smoothstep(dotSize.add(aa), dotSize.sub(aa), squareDist); - - return max(dots, lines); - }); - - const fade = Fn(([radius = float(10.0), falloff = float(1.0)]) => { - return smoothstep(radius, radius.sub(falloff), length(positionWorld)); - }); - - const gridColor = vec4(vec3(0.2), 1.0); - const baseColor = vec4(vec3(0.4), 0.0); - - material.colorNode = grid(positionWorld.xz, 0.007, 0.03).mix(baseColor, gridColor).mul(fade(30.0, 20.0)); - material.transparent = true; - - return material; -} diff --git a/examples-testing/examples/webgpu_tsl_halftone.ts b/examples-testing/examples/webgpu_tsl_halftone.ts deleted file mode 100644 index 682e1df64..000000000 --- a/examples-testing/examples/webgpu_tsl_halftone.ts +++ /dev/null @@ -1,214 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { color, mix, normalWorld, output, Fn, uniform, vec4, rotate, screenCoordinate, screenSize } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let camera, scene, renderer, controls, timer, halftoneSettings; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(6, 3, 10); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.setClearColor('#000000'); - document.body.appendChild(renderer.domElement); - - // inspector/gui - - renderer.inspector = new Inspector(); - - const gui = renderer.inspector.createParameters('Parameters'); - - // lights - - const ambientLight = new THREE.AmbientLight('#ffffff', 3); - scene.add(ambientLight); - - const directionalLight = new THREE.DirectionalLight('#ffffff', 8); - directionalLight.position.set(4, 3, 1); - scene.add(directionalLight); - - const lightsFolder = gui.addFolder('💡 lights'); - lightsFolder.add(ambientLight, 'intensity', 0, 10, 0.001).name('ambient intensity'); - lightsFolder.add(directionalLight, 'intensity', 0, 20, 0.001).name('directional intensity'); - - // halftone settings - - halftoneSettings = [ - // purple shade - - { - count: 140, - color: '#fb00ff', - direction: new THREE.Vector3(-0.4, -1, 0.5), - start: 1, - end: 0, - mixLow: 0, - mixHigh: 0.5, - radius: 0.8, - }, - - // cyan highlight - - { - count: 180, - color: '#94ffd1', - direction: new THREE.Vector3(0.5, 0.5, -0.2), - start: 0.55, - end: 0.2, - mixLow: 0.5, - mixHigh: 1, - radius: 0.8, - }, - ]; - - for (const index in halftoneSettings) { - const settings = halftoneSettings[index]; - - // uniforms - - const uniforms = {}; - - uniforms.count = uniform(settings.count); - uniforms.color = uniform(color(settings.color)); - uniforms.direction = uniform(settings.direction); - uniforms.start = uniform(settings.start); - uniforms.end = uniform(settings.end); - uniforms.mixLow = uniform(settings.mixLow); - uniforms.mixHigh = uniform(settings.mixHigh); - uniforms.radius = uniform(settings.radius); - - settings.uniforms = uniforms; - - // debug - - const folder = gui.addFolder(`⚪️ halftone ${index}`); - - folder.addColor({ color: uniforms.color.value }, 'color'); - folder.add(uniforms.count, 'value', 1, 200, 1).name('count'); - folder.add(uniforms.direction.value, 'x', -1, 1, 0.01).listen(); - folder.add(uniforms.direction.value, 'y', -1, 1, 0.01).listen(); - folder.add(uniforms.direction.value, 'z', -1, 1, 0.01).listen(); - folder.add(uniforms.start, 'value', -1, 1, 0.01).name('start'); - folder.add(uniforms.end, 'value', -1, 1, 0.01).name('end'); - folder.add(uniforms.mixLow, 'value', 0, 1, 0.01).name('mix low'); - folder.add(uniforms.mixHigh, 'value', 0, 1, 0.01).name('mix high'); - folder.add(uniforms.radius, 'value', 0, 1, 0.01).name('radius'); - } - - // halftone functions - - const halftone = Fn(([count, color, direction, start, end, radius, mixLow, mixHigh]) => { - // grid pattern - - let gridUv = screenCoordinate.xy.div(screenSize.yy).mul(count); - gridUv = rotate(gridUv, Math.PI * 0.25).mod(1); - - // orientation strength - - const orientationStrength = normalWorld.dot(direction.normalize()).remapClamp(end, start, 0, 1); - - // mask - - const mask = orientationStrength - .mul(radius) - .mul(0.5) - .step(gridUv.sub(0.5).length()) - .mul(mix(mixLow, mixHigh, orientationStrength)); - - return vec4(color, mask); - }); - - const halftones = Fn(([input]) => { - const halftonesOutput = input; - - for (const settings of halftoneSettings) { - const halfToneOutput = halftone( - settings.uniforms.count, - settings.uniforms.color, - settings.uniforms.direction, - settings.uniforms.start, - settings.uniforms.end, - settings.uniforms.radius, - settings.uniforms.mixLow, - settings.uniforms.mixHigh, - ); - halftonesOutput.rgb.assign(mix(halftonesOutput.rgb, halfToneOutput.rgb, halfToneOutput.a)); - } - - return halftonesOutput; - }); - - // default material - - const defaultMaterial = new THREE.MeshStandardNodeMaterial({ color: '#ff622e' }); - defaultMaterial.outputNode = halftones(output); - - const folder = gui.addFolder('🎨 default material'); - folder.addColor({ color: defaultMaterial.color }, 'color'); - - // objects - - const torusKnot = new THREE.Mesh(new THREE.TorusKnotGeometry(0.6, 0.25, 128, 32), defaultMaterial); - torusKnot.position.x = 3; - scene.add(torusKnot); - - const sphere = new THREE.Mesh(new THREE.SphereGeometry(1, 64, 64), defaultMaterial); - sphere.position.x = -3; - scene.add(sphere); - - const gltfLoader = new GLTFLoader(); - gltfLoader.load('./models/gltf/Michelle.glb', gltf => { - const model = gltf.scene; - model.position.y = -2; - model.scale.setScalar(2.5); - model.traverse(child => { - if (child.isMesh) child.material.outputNode = halftones(output); - }); - - scene.add(model); - }); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - timer.update(); - - controls.update(); - - const time = timer.getElapsed(); - halftoneSettings[1].uniforms.direction.value.x = Math.cos(time); - halftoneSettings[1].uniforms.direction.value.y = Math.sin(time); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_interoperability.ts b/examples-testing/examples/webgpu_tsl_interoperability.ts deleted file mode 100644 index e57c66eeb..000000000 --- a/examples-testing/examples/webgpu_tsl_interoperability.ts +++ /dev/null @@ -1,263 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - Fn, - attribute, - varyingProperty, - time, - uniform, - wgslFn, - texture, - sampler, - uv, - clamp, - float, - vec2, - vec3, - fract, - floor, - positionGeometry, - sin, -} from 'three/tsl'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let renderer, camera, scene; -const dpr = window.devicePixelRatio; - -const crtWidthUniform = uniform(1608); -const crtHeightUniform = uniform(1608); - -const canvas = document.getElementById('c'); - -function onWindowResize() { - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} - -function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - const vUv = varyingProperty('vec2', 'vUv'); - - // In WGSL, access varying properties from the varying struct - const wgslVertexShader = wgslFn( - ` - fn crtVertex( - position: vec3f, - uv: vec2f - ) -> vec3 { - varyings.vUv = uv; - return position; - } - `, - [vUv], - ); - - // Only wgsl vertex shaders take varyings arguments when defined. - // For a wgsl fragment shader, pass the varyingProperty node to the - // fragment shader's constructor to access the varying value computed - // by the vertex shader. - const wgslFragmentShader = wgslFn(` - fn crtFragment( - vUv: vec2f, - tex: texture_2d, - texSampler: sampler, - crtWidth: f32, - crtHeight: f32, - cellOffset: f32, - cellSize: f32, - borderMask: f32, - time: f32, - speed: f32, - pulseIntensity: f32, - pulseWidth: f32, - pulseRate: f32 - ) -> vec3 { - // Convert uv into map of pixels - var pixel = ( vUv * 0.5 + 0.5 ) * vec2( - crtWidth, - crtHeight - ); - // Coordinate for each cell in the pixel map - let coord = pixel / cellSize; - // Three color values for each cell (r, g, b) - let subcoord = coord * vec2f( 3.0, 1.0 ); - let offset = vec2( 0, fract( floor( coord.x ) * cellOffset ) ); - - let maskCoord = floor( coord + offset ) * cellSize; - - var samplePoint = maskCoord / vec2(crtWidth, crtHeight); - samplePoint.x += fract( time * speed / 20 ); - - var color = textureSample( - tex, - texSampler, - samplePoint - ).xyz; - - // Current implementation does not give an even amount of space to each r, g, b unit of a cell - // Fix/hack this by multiplying subCoord.x by cellSize at cellSizes below 6 - let ind = floor( subcoord.x ) % 3; - - var maskColor = vec3( - f32( ind == 0.0 ), - f32( ind == 1.0 ), - f32( ind == 2.0 ) - ) * 3.0; - - let cellUV = fract( subcoord + offset ) * 2.0 - 1.0; - var border: vec2 = 1.0 - cellUV * cellUV * borderMask; - - maskColor *= vec3f( clamp( border.x, 0.0, 1.0 ) * clamp( border.y, 0.0, 1.0) ); - - color *= maskColor; - - color.r *= 1.0 + pulseIntensity * sin( pixel.y / pulseWidth + time * pulseRate ); - color.b *= 1.0 + pulseIntensity * sin( pixel.y / pulseWidth + time * pulseRate ); - color.g *= 1.0 + pulseIntensity * sin( pixel.y / pulseWidth + time * pulseRate ); - - return color; - } - `); - - const textureLoader = new THREE.TextureLoader(); - const planetTexture = textureLoader.load('textures/planets/earth_lights_2048.png'); - planetTexture.wrapS = THREE.RepeatWrapping; - planetTexture.wrapT = THREE.RepeatWrapping; - - // Node Uniforms: - // Passed to WGSL Functions. - // Manipulated directly in TSL Functions. - const cellOffsetUniform = uniform(0.5); - const cellSizeUniform = uniform(6); - const borderMaskUniform = uniform(1); - const pulseIntensityUniform = uniform(0.06); - const pulseWidthUniform = uniform(60); - const pulseRateUniform = uniform(20); - const wgslShaderSpeedUniform = uniform(1.0); - const tslShaderSpeedUniform = uniform(1.0); - - // - - const wgslShaderMaterial = new THREE.MeshBasicNodeMaterial(); - - // Accessed attributes correspond to a Mesh or BufferGeometry's setAttribute() calls. - wgslShaderMaterial.positionNode = wgslVertexShader({ - position: attribute('position'), - uv: attribute('uv'), - }); - - wgslShaderMaterial.fragmentNode = wgslFragmentShader({ - vUv: vUv, - tex: texture(planetTexture), - texSampler: sampler(planetTexture), - crtWidth: crtWidthUniform, - crtHeight: crtHeightUniform, - cellOffset: cellOffsetUniform, - cellSize: cellSizeUniform, - borderMask: borderMaskUniform, - time: time, - speed: wgslShaderSpeedUniform, - pulseIntensity: pulseIntensityUniform, - pulseWidth: pulseWidthUniform, - pulseRate: pulseRateUniform, - }); - - // - - const tslVertexShader = Fn(() => { - vUv.assign(uv()); - return positionGeometry; - }); - - const tslFragmentShader = Fn(() => { - const dimensions = vec2(crtWidthUniform, crtHeightUniform); - const translatedUV = vUv.mul(0.5).add(0.5); - const pixel = translatedUV.mul(dimensions); - - const coord = pixel.div(cellSizeUniform); - const subCoord = coord.mul(vec2(3.0, 1.0)); - - const cellOffset = vec2(0.0, fract(floor(coord.x).mul(cellOffsetUniform))); - - const maskCoord = floor(coord.add(cellOffset)).mul(cellSizeUniform); - const samplePoint = maskCoord.div(dimensions); - const scaledTime = time.mul(tslShaderSpeedUniform); - samplePoint.x = samplePoint.x.add(fract(scaledTime.div(20))); - samplePoint.y = samplePoint.y.sub(1.5); - - let color = texture(planetTexture, samplePoint); - - const ind = floor(subCoord.x).mod(3); - - let maskColor = vec3(ind.equal(0.0), ind.equal(1.0), ind.equal(2.0)).mul(3.0); - - const subCoordOffset = fract(subCoord.add(cellOffset)); - let cellUV = subCoordOffset.mul(2.0); - cellUV = cellUV.sub(1.0); - - const border = float(1.0).sub(cellUV.mul(cellUV).mul(borderMaskUniform)); - - const clampX = clamp(border.x, 0.0, 1.0); - const clampY = clamp(border.y, 0.0, 1.0); - const borderClamp = clampX.mul(clampY); - maskColor = maskColor.mul(borderClamp); - - color = color.mul(maskColor); - - const pixelDampen = pixel.y.div(pulseWidthUniform); - let pulse = sin(pixelDampen.add(time.mul(pulseRateUniform))); - pulse = pulse.mul(pulseIntensityUniform); - color = color.mul(float(1.0).add(pulse)); - - return color; - }); - - const tslShaderMaterial = new THREE.MeshBasicNodeMaterial(); - tslShaderMaterial.positionNode = tslVertexShader(); - tslShaderMaterial.colorNode = tslFragmentShader(); - - camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); - scene = new THREE.Scene(); - - const geometry = new THREE.PlaneGeometry(2, 1); - - const wgslQuad = new THREE.Mesh(geometry, wgslShaderMaterial); - wgslQuad.position.y += 0.5; - scene.add(wgslQuad); - - const tslQuad = new THREE.Mesh(geometry, tslShaderMaterial); - tslQuad.position.y -= 0.5; - scene.add(tslQuad); - - renderer = new THREE.WebGPURenderer({ antialias: true, canvas: canvas }); - renderer.setPixelRatio(dpr); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.outputColorSpace = THREE.LinearSRGBColorSpace; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - window.addEventListener('resize', onWindowResize); - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.add(cellSizeUniform, 'value', 6, 50, 1).name('Cell Size'); - gui.add(cellOffsetUniform, 'value', 0, 1, 0.1).name('Cell Offset'); - gui.add(borderMaskUniform, 'value', 0, 5, 0.1).name('Border Mask'); - gui.add(pulseIntensityUniform, 'value', 0, 0.5, 0.01).name('Pulse Intensity'); - gui.add(pulseWidthUniform, 'value', 10, 100, 5).name('Pulse Width'); - gui.add(wgslShaderSpeedUniform, 'value', 1, 10).name('WGSL Shader Speed'); - gui.add(tslShaderSpeedUniform, 'value', 1, 10).name('TSL Shader Speed'); -} - -init(); diff --git a/examples-testing/examples/webgpu_tsl_procedural_terrain.ts b/examples-testing/examples/webgpu_tsl_procedural_terrain.ts deleted file mode 100644 index 5630137b8..000000000 --- a/examples-testing/examples/webgpu_tsl_procedural_terrain.ts +++ /dev/null @@ -1,318 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - mx_noise_float, - color, - cross, - dot, - float, - transformNormalToView, - positionLocal, - sign, - step, - Fn, - uniform, - varying, - vec2, - vec3, - Loop, -} from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; - -let camera, scene, renderer, controls, drag; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(35, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-10, 8, -2.2); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x201919); - - // environment - - const hdrLoader = new HDRLoader(); - hdrLoader.load('./textures/equirectangular/pedestrian_overpass_1k.hdr', environmentMap => { - environmentMap.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = environmentMap; - scene.backgroundBlurriness = 0.5; - scene.environment = environmentMap; - }); - - // lights - - const directionalLight = new THREE.DirectionalLight('#ffffff', 2); - directionalLight.position.set(6.25, 3, 4); - directionalLight.castShadow = true; - directionalLight.shadow.mapSize.set(1024, 1024); - directionalLight.shadow.camera.near = 0.1; - directionalLight.shadow.camera.far = 30; - directionalLight.shadow.camera.top = 8; - directionalLight.shadow.camera.right = 8; - directionalLight.shadow.camera.bottom = -8; - directionalLight.shadow.camera.left = -8; - directionalLight.shadow.normalBias = 0.05; - scene.add(directionalLight); - - // terrain - - const material = new THREE.MeshStandardNodeMaterial({ - metalness: 0, - roughness: 0.5, - color: '#85d534', - }); - - const noiseIterations = uniform(3); - const positionFrequency = uniform(0.175); - const warpFrequency = uniform(6); - const warpStrength = uniform(1); - const strength = uniform(10); - const offset = uniform(vec2(0, 0)); - const normalLookUpShift = uniform(0.01); - const colorSand = uniform(color('#ffe894')); - const colorGrass = uniform(color('#85d534')); - const colorSnow = uniform(color('#ffffff')); - const colorRock = uniform(color('#bfbd8d')); - - const vNormal = varying(vec3()); - const vPosition = varying(vec3()); - - const terrainElevation = Fn(([position]) => { - const warpedPosition = position.add(offset).toVar(); - warpedPosition.addAssign( - mx_noise_float(warpedPosition.mul(positionFrequency).mul(warpFrequency), 1, 0).mul(warpStrength), - ); - - const elevation = float(0).toVar(); - Loop({ type: 'float', start: float(1), end: noiseIterations.toFloat(), condition: '<=' }, ({ i }) => { - const noiseInput = warpedPosition.mul(positionFrequency).mul(i.mul(2)).add(i.mul(987)); - const noise = mx_noise_float(noiseInput, 1, 0).div(i.add(1).mul(2)); - elevation.addAssign(noise); - }); - - const elevationSign = sign(elevation); - elevation.assign(elevation.abs().pow(2).mul(elevationSign).mul(strength)); - - return elevation; - }); - - material.positionNode = Fn(() => { - // neighbours positions - - const neighbourA = positionLocal.xyz.add(vec3(normalLookUpShift, 0.0, 0.0)).toVar(); - const neighbourB = positionLocal.xyz.add(vec3(0.0, 0.0, normalLookUpShift.negate())).toVar(); - - // elevations - - const position = positionLocal.xyz.toVar(); - const elevation = terrainElevation(positionLocal.xz); - position.y.addAssign(elevation); - - neighbourA.y.addAssign(terrainElevation(neighbourA.xz)); - neighbourB.y.addAssign(terrainElevation(neighbourB.xz)); - - // compute normal - - const toA = neighbourA.sub(position).normalize(); - const toB = neighbourB.sub(position).normalize(); - vNormal.assign(cross(toA, toB)); - - // varyings - - vPosition.assign(position.add(vec3(offset.x, 0, offset.y))); - - return position; - })(); - - material.normalNode = transformNormalToView(vNormal); - - material.colorNode = Fn(() => { - const finalColor = colorSand.toVar(); - - // grass - - const grassMix = step(-0.06, vPosition.y); - finalColor.assign(grassMix.mix(finalColor, colorGrass)); - - // rock - - const rockMix = step(0.5, dot(vNormal, vec3(0, 1, 0))) - .oneMinus() - .mul(step(-0.06, vPosition.y)); - finalColor.assign(rockMix.mix(finalColor, colorRock)); - - // snow - - const snowThreshold = mx_noise_float(vPosition.xz.mul(25), 1, 0).mul(0.1).add(0.45); - const snowMix = step(snowThreshold, vPosition.y); - finalColor.assign(snowMix.mix(finalColor, colorSnow)); - - return finalColor; - })(); - - const geometry = new THREE.PlaneGeometry(10, 10, 500, 500); - geometry.deleteAttribute('uv'); - geometry.deleteAttribute('normal'); - geometry.rotateX(-Math.PI * 0.5); - - const terrain = new THREE.Mesh(geometry, material); - terrain.receiveShadow = true; - terrain.castShadow = true; - scene.add(terrain); - - // water - - const water = new THREE.Mesh( - new THREE.PlaneGeometry(10, 10, 1, 1), - new THREE.MeshPhysicalMaterial({ - transmission: 1, - roughness: 0.5, - ior: 1.333, - color: '#4db2ff', - }), - ); - water.rotation.x = -Math.PI * 0.5; - water.position.y = -0.1; - scene.add(water); - - // drag - - drag = {}; - drag.screenCoords = new THREE.Vector2(); - drag.prevWorldCoords = new THREE.Vector3(); - drag.worldCoords = new THREE.Vector3(); - drag.raycaster = new THREE.Raycaster(); - drag.down = false; - drag.hover = false; - - drag.object = new THREE.Mesh(new THREE.PlaneGeometry(10, 10, 1, 1), new THREE.MeshBasicMaterial()); - drag.object.rotation.x = -Math.PI * 0.5; - drag.object.visible = false; - scene.add(drag.object); - - drag.getIntersect = () => { - drag.raycaster.setFromCamera(drag.screenCoords, camera); - const intersects = drag.raycaster.intersectObject(drag.object); - if (intersects.length) return intersects[0]; - - return null; - }; - - drag.update = () => { - const intersect = drag.getIntersect(); - - if (intersect) { - drag.hover = true; - - if (!drag.down) renderer.domElement.style.cursor = 'grab'; - } else { - drag.hover = false; - renderer.domElement.style.cursor = 'default'; - } - - if (drag.hover && drag.down) { - drag.worldCoords.copy(intersect.point); - const delta = drag.prevWorldCoords.sub(drag.worldCoords); - - offset.value.x += delta.x; - offset.value.y += delta.z; - } - - drag.prevWorldCoords.copy(drag.worldCoords); - }; - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.shadowMap.enabled = true; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // inspector - - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.inspector.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.maxPolarAngle = Math.PI * 0.45; - controls.target.y = -0.5; - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - // debug - - const gui = renderer.inspector.createParameters('Parameters'); - - const terrainGui = gui.addFolder('🏔️ terrain'); - - terrainGui.add(noiseIterations, 'value', 0, 10, 1).name('noiseIterations'); - terrainGui.add(positionFrequency, 'value', 0, 1, 0.001).name('positionFrequency'); - terrainGui.add(strength, 'value', 0, 20, 0.001).name('strength'); - terrainGui.add(warpFrequency, 'value', 0, 20, 0.001).name('warpFrequency'); - terrainGui.add(warpStrength, 'value', 0, 2, 0.001).name('warpStrength'); - - terrainGui.addColor({ color: colorSand.value }, 'color').name('colorSand'); - terrainGui.addColor({ color: colorGrass.value }, 'color').name('colorGrass'); - terrainGui.addColor({ color: colorSnow.value }, 'color').name('colorSnow'); - terrainGui.addColor({ color: colorRock.value }, 'color').name('colorRock'); - - const waterGui = gui.addFolder('💧 water'); - - waterGui.add(water.material, 'roughness', 0, 1, 0.01); - waterGui.add(water.material, 'ior', 1, 2, 0.001); - waterGui.addColor({ color: water.material.color }, 'color').name('color'); - - // events - - window.addEventListener('pointermove', event => { - drag.screenCoords.x = (event.clientX / window.innerWidth - 0.5) * 2; - drag.screenCoords.y = -(event.clientY / window.innerHeight - 0.5) * 2; - }); - - renderer.domElement.addEventListener('pointerdown', () => { - if (drag.hover) { - renderer.domElement.style.cursor = 'grabbing'; - controls.enabled = false; - drag.down = true; - drag.object.scale.setScalar(10); - - const intersect = drag.getIntersect(); - drag.prevWorldCoords.copy(intersect.point); - drag.worldCoords.copy(intersect.point); - } - }); - - window.addEventListener('pointerup', () => { - drag.down = false; - controls.enabled = true; - drag.object.scale.setScalar(1); - }); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - controls.update(); - - drag.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_raging_sea.ts b/examples-testing/examples/webgpu_tsl_raging_sea.ts deleted file mode 100644 index cb513d075..000000000 --- a/examples-testing/examples/webgpu_tsl_raging_sea.ts +++ /dev/null @@ -1,178 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - float, - mx_noise_float, - Loop, - color, - positionLocal, - sin, - vec2, - vec3, - mul, - time, - uniform, - Fn, - transformNormalToView, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(1.25, 1.25, 1.25); - - scene = new THREE.Scene(); - - // lights - - const directionalLight = new THREE.DirectionalLight('#ffffff', 3); - directionalLight.position.set(-4, 2, 0); - scene.add(directionalLight); - - // material - - const material = new THREE.MeshStandardNodeMaterial({ color: '#271442', roughness: 0.15 }); - - const emissiveColor = uniform(color('#ff0a81')); - const emissiveLow = uniform(-0.25); - const emissiveHigh = uniform(0.2); - const emissivePower = uniform(7); - const largeWavesFrequency = uniform(vec2(3, 1)); - const largeWavesSpeed = uniform(1.25); - const largeWavesMultiplier = uniform(0.15); - const smallWavesIterations = uniform(3); - const smallWavesFrequency = uniform(2); - const smallWavesSpeed = uniform(0.3); - const smallWavesMultiplier = uniform(0.18); - const normalComputeShift = uniform(0.01); - - // TSL functions - - const wavesElevation = Fn(([position]) => { - // large waves - - const elevation = mul( - sin(position.x.mul(largeWavesFrequency.x).add(time.mul(largeWavesSpeed))), - sin(position.z.mul(largeWavesFrequency.y).add(time.mul(largeWavesSpeed))), - largeWavesMultiplier, - ).toVar(); - - Loop({ start: float(1), end: smallWavesIterations.add(1) }, ({ i }) => { - const noiseInput = vec3( - position.xz - .add(2) // avoids a-hole pattern - .mul(smallWavesFrequency) - .mul(i), - time.mul(smallWavesSpeed), - ); - - const wave = mx_noise_float(noiseInput, 1, 0).mul(smallWavesMultiplier).div(i).abs(); - - elevation.subAssign(wave); - }); - - return elevation; - }); - - // position - - const elevation = wavesElevation(positionLocal); - const position = positionLocal.add(vec3(0, elevation, 0)); - - material.positionNode = position; - - // normals - - let positionA = positionLocal.add(vec3(normalComputeShift, 0, 0)); - let positionB = positionLocal.add(vec3(0, 0, normalComputeShift.negate())); - - positionA = positionA.add(vec3(0, wavesElevation(positionA), 0)); - positionB = positionB.add(vec3(0, wavesElevation(positionB), 0)); - - const toA = positionA.sub(position).normalize(); - const toB = positionB.sub(position).normalize(); - const normal = toA.cross(toB); - - material.normalNode = transformNormalToView(normal); - - // emissive - - const emissive = elevation.remap(emissiveHigh, emissiveLow).pow(emissivePower); - material.emissiveNode = emissiveColor.mul(emissive); - - // mesh - - const geometry = new THREE.PlaneGeometry(2, 2, 256, 256); - geometry.rotateX(-Math.PI * 0.5); - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.y = -0.25; - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - // debug - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.addColor({ color: material.color.getHex(THREE.SRGBColorSpace) }, 'color') - .name('color') - .onChange(value => material.color.set(value)); - gui.add(material, 'roughness', 0, 1, 0.001); - - const colorGui = gui.addFolder('emissive'); - colorGui - .addColor({ color: emissiveColor.value.getHex(THREE.SRGBColorSpace) }, 'color') - .name('color') - .onChange(value => emissiveColor.value.set(value)); - colorGui.add(emissiveLow, 'value', -1, 0, 0.001).name('low'); - colorGui.add(emissiveHigh, 'value', 0, 1, 0.001).name('high'); - colorGui.add(emissivePower, 'value', 1, 10, 1).name('power'); - - const wavesGui = gui.addFolder('waves'); - wavesGui.add(largeWavesSpeed, 'value', 0, 5).name('largeSpeed'); - wavesGui.add(largeWavesMultiplier, 'value', 0, 1).name('largeMultiplier'); - wavesGui.add(largeWavesFrequency.value, 'x', 0, 10).name('largeFrequencyX'); - wavesGui.add(largeWavesFrequency.value, 'y', 0, 10).name('largeFrequencyY'); - wavesGui.add(smallWavesIterations, 'value', 0, 5, 1).name('smallIterations'); - wavesGui.add(smallWavesFrequency, 'value', 0, 10).name('smallFrequency'); - wavesGui.add(smallWavesSpeed, 'value', 0, 1).name('smallSpeed'); - wavesGui.add(smallWavesMultiplier, 'value', 0, 1).name('smallMultiplier'); - wavesGui.add(normalComputeShift, 'value', 0, 0.1, 0.0001).name('normalComputeShift'); - - // events - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_vfx_flames.ts b/examples-testing/examples/webgpu_tsl_vfx_flames.ts deleted file mode 100644 index 61a142400..000000000 --- a/examples-testing/examples/webgpu_tsl_vfx_flames.ts +++ /dev/null @@ -1,203 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - TWO_PI, - oneMinus, - spherizeUV, - sin, - step, - texture, - time, - Fn, - uv, - vec2, - vec3, - vec4, - mix, - billboarding, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(1, 1, 3); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x201919); - - // textures - - const textureLoader = new THREE.TextureLoader(); - - const cellularTexture = textureLoader.load('./textures/noises/voronoi/grayscale-256x256.png'); - const perlinTexture = textureLoader.load('./textures/noises/perlin/rgb-256x256.png'); - - // gradient canvas - - const gradient = {}; - gradient.element = document.createElement('canvas'); - gradient.element.width = 128; - gradient.element.height = 1; - gradient.context = gradient.element.getContext('2d'); - - gradient.colors = ['#090033', '#5f1f93', '#e02e96', '#ffbd80', '#fff0db']; - - gradient.texture = new THREE.CanvasTexture(gradient.element); - gradient.texture.colorSpace = THREE.SRGBColorSpace; - - gradient.update = () => { - const fillGradient = gradient.context.createLinearGradient(0, 0, gradient.element.width, 0); - - for (let i = 0; i < gradient.colors.length; i++) { - const progress = i / (gradient.colors.length - 1); - const color = gradient.colors[i]; - fillGradient.addColorStop(progress, color); - } - - gradient.context.fillStyle = fillGradient; - gradient.context.fillRect(0, 0, gradient.element.width, gradient.element.height); - - gradient.texture.needsUpdate = true; - }; - - gradient.update(); - - // flame 1 material - - const flame1Material = new THREE.SpriteNodeMaterial({ side: THREE.DoubleSide }); - - flame1Material.colorNode = Fn(() => { - // main UV - const mainUv = uv().toVar(); - mainUv.assign(spherizeUV(mainUv, 10).mul(0.6).add(0.2)); // spherize - mainUv.assign(mainUv.pow(vec2(1, 2))); // stretch - mainUv.assign(mainUv.mul(2, 1).sub(vec2(0.5, 0))); // scale - - // gradients - const gradient1 = sin(time.mul(10).sub(mainUv.y.mul(TWO_PI).mul(2))).toVar(); - const gradient2 = mainUv.y.smoothstep(0, 1).toVar(); - mainUv.x.addAssign(gradient1.mul(gradient2).mul(0.2)); - - // cellular noise - const cellularUv = mainUv - .mul(0.5) - .add(vec2(0, time.negate().mul(0.5))) - .mod(1); - const cellularNoise = texture(cellularTexture, cellularUv, 0).r.oneMinus().smoothstep(0, 0.5).oneMinus(); - cellularNoise.mulAssign(gradient2); - - // shape - const shape = mainUv.sub(0.5).mul(vec2(3, 2)).length().oneMinus().toVar(); - shape.assign(shape.sub(cellularNoise)); - - // gradient color - const gradientColor = texture(gradient.texture, vec2(shape.remap(0, 1, 0, 1), 0)); - - // output - const color = mix(gradientColor, vec3(1), shape.step(0.8)); - const alpha = shape.smoothstep(0, 0.3); - return vec4(color.rgb, alpha); - })(); - - // flame 2 material - - const flame2Material = new THREE.SpriteNodeMaterial({ side: THREE.DoubleSide }); - - flame2Material.colorNode = Fn(() => { - // main UV - const mainUv = uv().toVar(); - mainUv.assign(spherizeUV(mainUv, 10).mul(0.6).add(0.2)); // spherize - mainUv.assign(mainUv.abs().pow(vec2(1, 3)).mul(mainUv.sign())); // stretch - mainUv.assign(mainUv.mul(2, 1).sub(vec2(0.5, 0))); // scale - - // perlin noise - const perlinUv = mainUv.add(vec2(0, time.negate().mul(1))).mod(1); - const perlinNoise = texture(perlinTexture, perlinUv, 0).sub(0.5).mul(1); - mainUv.x.addAssign(perlinNoise.x.mul(0.5)); - - // gradients - const gradient1 = sin(time.mul(10).sub(mainUv.y.mul(TWO_PI).mul(2))); - const gradient2 = mainUv.y.smoothstep(0, 1); - const gradient3 = oneMinus(mainUv.y).smoothstep(0, 0.3); - mainUv.x.addAssign(gradient1.mul(gradient2).mul(0.2)); - - // displaced perlin noise - const displacementPerlinUv = mainUv - .mul(0.5) - .add(vec2(0, time.negate().mul(0.25))) - .mod(1); - const displacementPerlinNoise = texture(perlinTexture, displacementPerlinUv, 0).sub(0.5).mul(1); - const displacedPerlinUv = mainUv - .add(vec2(0, time.negate().mul(0.5))) - .add(displacementPerlinNoise) - .mod(1); - const displacedPerlinNoise = texture(perlinTexture, displacedPerlinUv, 0).sub(0.5).mul(1); - mainUv.x.addAssign(displacedPerlinNoise.mul(0.5)); - - // cellular noise - const cellularUv = mainUv.add(vec2(0, time.negate().mul(1.5))).mod(1); - const cellularNoise = texture(cellularTexture, cellularUv, 0).r.oneMinus().smoothstep(0.25, 1); - - // shape - const shape = step(mainUv.sub(0.5).mul(vec2(6, 1)).length(), 0.5); - shape.assign(shape.mul(cellularNoise)); - shape.mulAssign(gradient3); - shape.assign(step(0.01, shape)); - - // output - return vec4(vec3(1), shape); - })(); - - // billboarding - follow the camera rotation only horizontally - - flame1Material.vertexNode = billboarding({ horizontalRotation: true }); - flame2Material.vertexNode = billboarding({ horizontalRotation: true }); - - // meshes - - const flame1 = new THREE.Sprite(flame1Material); - flame1.center.set(0.5, 0); - flame1.scale.x = 0.5; // optional - flame1.position.x = -0.5; - scene.add(flame1); - - const flame2 = new THREE.Sprite(flame2Material); - flame2.center.set(0.5, 0); - flame2.position.x = 0.5; - scene.add(flame2); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - controls.update(); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts b/examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts deleted file mode 100644 index e220c164b..000000000 --- a/examples-testing/examples/webgpu_tsl_vfx_linkedparticles.ts +++ /dev/null @@ -1,445 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - atan, - cos, - float, - max, - min, - mix, - PI, - TWO_PI, - sin, - vec2, - vec3, - color, - Fn, - hash, - hue, - If, - instanceIndex, - Loop, - mx_fractal_noise_float, - mx_fractal_noise_vec3, - pass, - pcurve, - storage, - deltaTime, - time, - uv, - uniform, - step, -} from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -let camera, scene, renderer, renderPipeline, controls, timer, light; - -let updateParticles, spawnParticles; // TSL compute nodes -let getInstanceColor; // TSL function - -const screenPointer = new THREE.Vector2(); -const scenePointer = new THREE.Vector3(); -const raycastPlane = new THREE.Plane(new THREE.Vector3(0, 0, 1), 0); -const raycaster = new THREE.Raycaster(); - -const nbParticles = Math.pow(2, 13); - -const timeScale = uniform(1.0); -const particleLifetime = uniform(0.5); -const particleSize = uniform(1.0); -const linksWidth = uniform(0.005); - -const colorOffset = uniform(0.0); -const colorVariance = uniform(2.0); -const colorRotationSpeed = uniform(1.0); - -const spawnIndex = uniform(0); -const nbToSpawn = uniform(5); -const spawnPosition = uniform(vec3(0.0)); -const previousSpawnPosition = uniform(vec3(0.0)); - -const turbFrequency = uniform(0.5); -const turbAmplitude = uniform(0.5); -const turbOctaves = uniform(2); -const turbLacunarity = uniform(2.0); -const turbGain = uniform(0.5); -const turbFriction = uniform(0.01); - -init(); - -async function init() { - if (WebGPU.isAvailable() === false) { - document.body.appendChild(WebGPU.getErrorMessage()); - - throw new Error('No WebGPU support'); - } - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 200); - camera.position.set(0, 0, 10); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setClearColor(0x14171a); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - // TSL function - // current color from index - getInstanceColor = Fn(([i]) => { - return hue( - color(0x0000ff), - colorOffset.add(mx_fractal_noise_float(i.toFloat().mul(0.1), 2, 2.0, 0.5, colorVariance)), - ); - }); - - // Particles - // storage buffers - const particlePositions = storage(new THREE.StorageInstancedBufferAttribute(nbParticles, 4), 'vec4', nbParticles); - const particleVelocities = storage(new THREE.StorageInstancedBufferAttribute(nbParticles, 4), 'vec4', nbParticles); - - // init particles buffers - renderer.compute( - Fn(() => { - particlePositions.element(instanceIndex).xyz.assign(vec3(10000.0)); - particlePositions.element(instanceIndex).w.assign(vec3(-1.0)); // life is stored in w component; x<0 means dead - })().compute(nbParticles), - ); - - // particles output - const particleQuadSize = 0.05; - const particleGeom = new THREE.PlaneGeometry(particleQuadSize, particleQuadSize); - - const particleMaterial = new THREE.SpriteNodeMaterial(); - particleMaterial.blending = THREE.AdditiveBlending; - particleMaterial.depthWrite = false; - particleMaterial.positionNode = particlePositions.toAttribute(); - particleMaterial.scaleNode = vec2(particleSize); - particleMaterial.rotationNode = atan(particleVelocities.toAttribute().y, particleVelocities.toAttribute().x); - - particleMaterial.colorNode = Fn(() => { - const life = particlePositions.toAttribute().w; - const modLife = pcurve(life.oneMinus(), 8.0, 1.0); - const pulse = pcurve( - sin(hash(instanceIndex).mul(TWO_PI).add(time.mul(0.5).mul(TWO_PI))) - .mul(0.5) - .add(0.5), - 0.25, - 0.25, - ) - .mul(10.0) - .add(1.0); - - return getInstanceColor(instanceIndex).mul(pulse.mul(modLife)); - })(); - - particleMaterial.opacityNode = Fn(() => { - const circle = step(uv().xy.sub(0.5).length(), 0.5); - const life = particlePositions.toAttribute().w; - - return circle.mul(life); - })(); - - const particleMesh = new THREE.InstancedMesh(particleGeom, particleMaterial, nbParticles); - particleMesh.instanceMatrix.setUsage(THREE.DynamicDrawUsage); - particleMesh.frustumCulled = false; - - scene.add(particleMesh); - - // Links between particles - // first, we define the indices for the links, 2 quads per particle, the indexation is fixed - const linksIndices = []; - for (let i = 0; i < nbParticles; i++) { - const baseIndex = i * 8; - for (let j = 0; j < 2; j++) { - const offset = baseIndex + j * 4; - linksIndices.push(offset, offset + 1, offset + 2, offset, offset + 2, offset + 3); - } - } - - // storage buffers attributes for the links - const nbVertices = nbParticles * 8; - const linksVerticesSBA = new THREE.StorageBufferAttribute(nbVertices, 4); - const linksColorsSBA = new THREE.StorageBufferAttribute(nbVertices, 4); - - // links output - const linksGeom = new THREE.BufferGeometry(); - linksGeom.setAttribute('position', linksVerticesSBA); - linksGeom.setAttribute('color', linksColorsSBA); - linksGeom.setIndex(linksIndices); - - const linksMaterial = new THREE.MeshBasicNodeMaterial(); - linksMaterial.vertexColors = true; - linksMaterial.side = THREE.DoubleSide; - linksMaterial.transparent = true; - linksMaterial.depthWrite = false; - linksMaterial.depthTest = false; - linksMaterial.blending = THREE.AdditiveBlending; - linksMaterial.opacityNode = storage(linksColorsSBA, 'vec4', linksColorsSBA.count).toAttribute().w; - - const linksMesh = new THREE.Mesh(linksGeom, linksMaterial); - linksMesh.frustumCulled = false; - scene.add(linksMesh); - - // compute nodes - updateParticles = Fn(() => { - const position = particlePositions.element(instanceIndex).xyz; - const life = particlePositions.element(instanceIndex).w; - const velocity = particleVelocities.element(instanceIndex).xyz; - const dt = deltaTime.mul(0.1).mul(timeScale); - - If(life.greaterThan(0.0), () => { - // first we update the particles positions and velocities - // velocity comes from a turbulence field, and is multiplied by the particle lifetime so that it slows down over time - const localVel = mx_fractal_noise_vec3( - position.mul(turbFrequency), - turbOctaves, - turbLacunarity, - turbGain, - turbAmplitude, - ).mul(life.add(0.01)); - velocity.addAssign(localVel); - velocity.mulAssign(turbFriction.oneMinus()); - position.addAssign(velocity.mul(dt)); - - // then we decrease the lifetime - life.subAssign(dt.mul(particleLifetime.reciprocal())); - - // then we find the two closest particles and set a quad to each of them - const closestDist1 = float(10000.0).toVar(); - const closestPos1 = vec3(0.0).toVar(); - const closestLife1 = float(0.0).toVar(); - const closestDist2 = float(10000.0).toVar(); - const closestPos2 = vec3(0.0).toVar(); - const closestLife2 = float(0.0).toVar(); - - Loop(nbParticles, ({ i }) => { - const otherPart = particlePositions.element(i); - - If(i.notEqual(instanceIndex).and(otherPart.w.greaterThan(0.0)), () => { - // if not self and other particle is alive - - const otherPosition = otherPart.xyz; - const dist = position.sub(otherPosition).lengthSq(); - const moreThanZero = dist.greaterThan(0.0); - - If(dist.lessThan(closestDist1).and(moreThanZero), () => { - closestDist1.assign(dist); - closestPos1.assign(otherPosition.xyz); - closestLife1.assign(otherPart.w); - }).ElseIf(dist.lessThan(closestDist2).and(moreThanZero), () => { - closestDist2.assign(dist); - closestPos2.assign(otherPosition.xyz); - closestLife2.assign(otherPart.w); - }); - }); - }); - - // then we update the links correspondingly - const linksPositions = storage(linksVerticesSBA, 'vec4', linksVerticesSBA.count); - const linksColors = storage(linksColorsSBA, 'vec4', linksColorsSBA.count); - const firstLinkIndex = instanceIndex.mul(8); - const secondLinkIndex = firstLinkIndex.add(4); - - // positions link 1 - linksPositions.element(firstLinkIndex).xyz.assign(position); - linksPositions.element(firstLinkIndex).y.addAssign(linksWidth); - linksPositions.element(firstLinkIndex.add(1)).xyz.assign(position); - linksPositions.element(firstLinkIndex.add(1)).y.addAssign(linksWidth.negate()); - linksPositions.element(firstLinkIndex.add(2)).xyz.assign(closestPos1); - linksPositions.element(firstLinkIndex.add(2)).y.addAssign(linksWidth.negate()); - linksPositions.element(firstLinkIndex.add(3)).xyz.assign(closestPos1); - linksPositions.element(firstLinkIndex.add(3)).y.addAssign(linksWidth); - - // positions link 2 - linksPositions.element(secondLinkIndex).xyz.assign(position); - linksPositions.element(secondLinkIndex).y.addAssign(linksWidth); - linksPositions.element(secondLinkIndex.add(1)).xyz.assign(position); - linksPositions.element(secondLinkIndex.add(1)).y.addAssign(linksWidth.negate()); - linksPositions.element(secondLinkIndex.add(2)).xyz.assign(closestPos2); - linksPositions.element(secondLinkIndex.add(2)).y.addAssign(linksWidth.negate()); - linksPositions.element(secondLinkIndex.add(3)).xyz.assign(closestPos2); - linksPositions.element(secondLinkIndex.add(3)).y.addAssign(linksWidth); - - // colors are the same for all vertices of both quads - const linkColor = getInstanceColor(instanceIndex); - - // store the minimum lifetime of the closest particles in the w component of colors - const l1 = max(0.0, min(closestLife1, life)).pow(0.8); // pow is here to apply a slight curve to the opacity - const l2 = max(0.0, min(closestLife2, life)).pow(0.8); - - Loop(4, ({ i }) => { - linksColors.element(firstLinkIndex.add(i)).xyz.assign(linkColor); - linksColors.element(firstLinkIndex.add(i)).w.assign(l1); - linksColors.element(secondLinkIndex.add(i)).xyz.assign(linkColor); - linksColors.element(secondLinkIndex.add(i)).w.assign(l2); - }); - }); - })() - .compute(nbParticles) - .setName('Update Particles'); - - spawnParticles = Fn(() => { - const particleIndex = spawnIndex.add(instanceIndex).mod(nbParticles).toInt(); - const position = particlePositions.element(particleIndex).xyz; - const life = particlePositions.element(particleIndex).w; - const velocity = particleVelocities.element(particleIndex).xyz; - - life.assign(1.0); // sets it alive - - // random spherical direction - const rRange = float(0.01); - const rTheta = hash(particleIndex).mul(TWO_PI); - const rPhi = hash(particleIndex.add(1)).mul(PI); - const rx = sin(rTheta).mul(cos(rPhi)); - const ry = sin(rTheta).mul(sin(rPhi)); - const rz = cos(rTheta); - const rDir = vec3(rx, ry, rz); - - // position is interpolated between the previous cursor position and the current one over the number of particles spawned - const pos = mix( - previousSpawnPosition, - spawnPosition, - instanceIndex.toFloat().div(nbToSpawn.sub(1).toFloat()).clamp(), - ); - position.assign(pos.add(rDir.mul(rRange))); - - // start in that direction - velocity.assign(rDir.mul(5.0)); - })() - .compute(nbToSpawn.value) - .setName('Spawn Particles'); - - // background , an inverted icosahedron - const backgroundGeom = new THREE.IcosahedronGeometry(100, 5).applyMatrix4(new THREE.Matrix4().makeScale(-1, 1, 1)); - const backgroundMaterial = new THREE.MeshStandardNodeMaterial(); - backgroundMaterial.roughness = 0.4; - backgroundMaterial.metalness = 0.9; - backgroundMaterial.flatShading = true; - backgroundMaterial.colorNode = color(0x0); - - const backgroundMesh = new THREE.Mesh(backgroundGeom, backgroundMaterial); - scene.add(backgroundMesh); - - // light for the background - light = new THREE.PointLight(0xffffff, 3000); - scene.add(light); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode('output'); - - const bloomPass = bloom(scenePassColor, 0.75, 0.1, 0.5); - - renderPipeline.outputNode = scenePassColor.add(bloomPass); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.autoRotate = true; - controls.maxDistance = 75; - window.addEventListener('resize', onWindowResize); - - // pointer handling - - window.addEventListener('pointermove', onPointerMove); - - // GUI - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.add(controls, 'autoRotate').name('Auto Rotate'); - gui.add(controls, 'autoRotateSpeed', -10.0, 10.0, 0.01).name('Auto Rotate Speed'); - - const partFolder = gui.addFolder('Particles'); - partFolder.add(timeScale, 'value', 0.0, 4.0, 0.01).name('timeScale'); - partFolder.add(nbToSpawn, 'value', 1, 100, 1).name('Spawn rate'); - partFolder.add(particleSize, 'value', 0.01, 3.0, 0.01).name('Size'); - partFolder.add(particleLifetime, 'value', 0.01, 2.0, 0.01).name('Lifetime'); - partFolder.add(linksWidth, 'value', 0.001, 0.1, 0.001).name('Links width'); - partFolder.add(colorVariance, 'value', 0.0, 10.0, 0.01).name('Color variance'); - partFolder.add(colorRotationSpeed, 'value', 0.0, 5.0, 0.01).name('Color rotation speed'); - - const turbFolder = gui.addFolder('Turbulence'); - turbFolder.add(turbFriction, 'value', 0.0, 0.3, 0.01).name('Friction'); - turbFolder.add(turbFrequency, 'value', 0.0, 1.0, 0.01).name('Frequency'); - turbFolder.add(turbAmplitude, 'value', 0.0, 10.0, 0.01).name('Amplitude'); - turbFolder.add(turbOctaves, 'value', 1, 9, 1).name('Octaves'); - turbFolder.add(turbLacunarity, 'value', 1.0, 5.0, 0.01).name('Lacunarity'); - turbFolder.add(turbGain, 'value', 0.0, 1.0, 0.01).name('Gain'); - - const bloomFolder = gui.addFolder('bloom'); - bloomFolder.add(bloomPass.threshold, 'value', 0, 2.0, 0.01).name('Threshold'); - bloomFolder.add(bloomPass.strength, 'value', 0, 10, 0.01).name('Strength'); - bloomFolder.add(bloomPass.radius, 'value', 0, 1, 0.01).name('Radius'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerMove(e) { - screenPointer.x = (e.clientX / window.innerWidth) * 2 - 1; - screenPointer.y = -(e.clientY / window.innerHeight) * 2 + 1; -} - -function updatePointer() { - raycaster.setFromCamera(screenPointer, camera); - raycaster.ray.intersectPlane(raycastPlane, scenePointer); -} - -function animate() { - timer.update(); - - // compute particles - renderer.compute(updateParticles); - renderer.compute(spawnParticles); - - // update particle index for next spawn - spawnIndex.value = (spawnIndex.value + nbToSpawn.value) % nbParticles; - - // update raycast plane to face camera - raycastPlane.normal.applyEuler(camera.rotation); - updatePointer(); - - // lerping spawn position - previousSpawnPosition.value.copy(spawnPosition.value); - spawnPosition.value.lerp(scenePointer, 0.1); - - // rotating colors - colorOffset.value += timer.getDelta() * colorRotationSpeed.value * timeScale.value; - - const elapsedTime = timer.getElapsed(); - light.position.set( - Math.sin(elapsedTime * 0.5) * 30, - Math.cos(elapsedTime * 0.3) * 30, - Math.sin(elapsedTime * 0.2) * 30, - ); - - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_tsl_vfx_tornado.ts b/examples-testing/examples/webgpu_tsl_vfx_tornado.ts deleted file mode 100644 index 625a9d209..000000000 --- a/examples-testing/examples/webgpu_tsl_vfx_tornado.ts +++ /dev/null @@ -1,289 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - luminance, - cos, - min, - time, - atan, - uniform, - pass, - PI, - TWO_PI, - color, - positionLocal, - sin, - texture, - Fn, - uv, - vec2, - vec3, - vec4, -} from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let camera, scene, renderer, renderPipeline, controls; - -init(); - -function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 50); - camera.position.set(1, 1, 3); - - scene = new THREE.Scene(); - - // textures - - const textureLoader = new THREE.TextureLoader(); - const perlinTexture = textureLoader.load('./textures/noises/perlin/rgb-256x256.png'); - perlinTexture.wrapS = THREE.RepeatWrapping; - perlinTexture.wrapT = THREE.RepeatWrapping; - - // TSL functions - - const toRadialUv = Fn(([uv, multiplier, rotation, offset]) => { - const centeredUv = uv.sub(0.5).toVar(); - const distanceToCenter = centeredUv.length(); - const angle = atan(centeredUv.y, centeredUv.x); - const radialUv = vec2(angle.add(PI).div(TWO_PI), distanceToCenter).toVar(); - radialUv.mulAssign(multiplier); - radialUv.x.addAssign(rotation); - radialUv.y.addAssign(offset); - - return radialUv; - }); - - const toSkewedUv = Fn(([uv, skew]) => { - return vec2(uv.x.add(uv.y.mul(skew.x)), uv.y.add(uv.x.mul(skew.y))); - }); - - const twistedCylinder = Fn(([position, parabolStrength, parabolOffset, parabolAmplitude, time]) => { - const angle = atan(position.z, position.x).toVar(); - const elevation = position.y; - - // parabol - const radius = parabolStrength.mul(position.y.sub(parabolOffset)).pow(2).add(parabolAmplitude).toVar(); - - // turbulences - radius.addAssign(sin(elevation.sub(time).mul(20).add(angle.mul(2))).mul(0.05)); - - const twistedPosition = vec3(cos(angle).mul(radius), elevation, sin(angle).mul(radius)); - - return twistedPosition; - }); - - // uniforms - - const emissiveColor = uniform(color('#ff8b4d')); - const timeScale = uniform(0.2); - const parabolStrength = uniform(1); - const parabolOffset = uniform(0.3); - const parabolAmplitude = uniform(0.2); - - // tornado floor - - const floorMaterial = new THREE.MeshBasicNodeMaterial({ transparent: true, wireframe: false }); - - floorMaterial.outputNode = Fn(() => { - const scaledTime = time.mul(timeScale); - - // noise 1 - const noise1Uv = toRadialUv(uv(), vec2(0.5, 0.5), scaledTime, scaledTime); - noise1Uv.assign(toSkewedUv(noise1Uv, vec2(-1, 0))); - noise1Uv.mulAssign(vec2(4, 1)); - const noise1 = texture(perlinTexture, noise1Uv, 1).r.remap(0.45, 0.7); - - // noise 2 - const noise2Uv = toRadialUv(uv(), vec2(2, 8), scaledTime.mul(2), scaledTime.mul(8)); - noise2Uv.assign(toSkewedUv(noise2Uv, vec2(-0.25, 0))); - noise2Uv.mulAssign(vec2(2, 0.25)); - const noise2 = texture(perlinTexture, noise2Uv, 1).b.remap(0.45, 0.7); - - // outer fade - const distanceToCenter = uv().sub(0.5).toVar(); - const outerFade = min( - distanceToCenter.length().oneMinus().smoothstep(0.5, 0.9), - distanceToCenter.length().smoothstep(0, 0.2), - ); - - // effect - const effect = noise1.mul(noise2).mul(outerFade).toVar(); - - // output - return vec4( - emissiveColor.mul(effect.step(0.2)).mul(3), // Emissive - effect.smoothstep(0, 0.01), // Alpha - ); - })(); - - const floor = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), floorMaterial); - floor.rotation.x = -Math.PI * 0.5; - scene.add(floor); - - // tornado cylinder geometry - - const cylinderGeometry = new THREE.CylinderGeometry(1, 1, 1, 20, 20, true); - cylinderGeometry.translate(0, 0.5, 0); - - // tornado emissive cylinder - - const emissiveMaterial = new THREE.MeshBasicNodeMaterial({ - transparent: true, - side: THREE.DoubleSide, - wireframe: false, - }); - - emissiveMaterial.positionNode = twistedCylinder( - positionLocal, - parabolStrength, - parabolOffset, - parabolAmplitude.sub(0.05), - time.mul(timeScale), - ); - - emissiveMaterial.outputNode = Fn(() => { - const scaledTime = time.mul(timeScale); - - // noise 1 - const noise1Uv = uv().add(vec2(scaledTime, scaledTime.negate())).toVar(); - noise1Uv.assign(toSkewedUv(noise1Uv, vec2(-1, 0))); - noise1Uv.mulAssign(vec2(2, 0.25)); - const noise1 = texture(perlinTexture, noise1Uv, 1).r.remap(0.45, 0.7); - - // noise 2 - const noise2Uv = uv() - .add(vec2(scaledTime.mul(0.5), scaledTime.negate())) - .toVar(); - noise2Uv.assign(toSkewedUv(noise2Uv, vec2(-1, 0))); - noise2Uv.mulAssign(vec2(5, 1)); - const noise2 = texture(perlinTexture, noise2Uv, 1).g.remap(0.45, 0.7); - - // outer fade - const outerFade = min(uv().y.smoothstep(0, 0.1), uv().y.oneMinus().smoothstep(0, 0.4)); - - // effect - const effect = noise1.mul(noise2).mul(outerFade); - - const emissiveColorLuminance = luminance(emissiveColor); - - // output - return vec4( - emissiveColor.mul(1.2).div(emissiveColorLuminance), // emissive - effect.smoothstep(0, 0.1), // alpha - ); - })(); - - const emissive = new THREE.Mesh(cylinderGeometry, emissiveMaterial); - emissive.scale.set(1, 1, 1); - scene.add(emissive); - - // tornado dark cylinder - - const darkMaterial = new THREE.MeshBasicNodeMaterial({ - transparent: true, - side: THREE.DoubleSide, - wireframe: false, - }); - - darkMaterial.positionNode = twistedCylinder( - positionLocal, - parabolStrength, - parabolOffset, - parabolAmplitude, - time.mul(timeScale), - ); - - darkMaterial.outputNode = Fn(() => { - const scaledTime = time.mul(timeScale).add(123.4); - - // noise 1 - const noise1Uv = uv().add(vec2(scaledTime, scaledTime.negate())).toVar(); - noise1Uv.assign(toSkewedUv(noise1Uv, vec2(-1, 0))); - noise1Uv.mulAssign(vec2(2, 0.25)); - const noise1 = texture(perlinTexture, noise1Uv, 1).g.remap(0.45, 0.7); - - // noise 2 - const noise2Uv = uv() - .add(vec2(scaledTime.mul(0.5), scaledTime.negate())) - .toVar(); - noise2Uv.assign(toSkewedUv(noise2Uv, vec2(-1, 0))); - noise2Uv.mulAssign(vec2(5, 1)); - const noise2 = texture(perlinTexture, noise2Uv, 1).b.remap(0.45, 0.7); - - // outer fade - const outerFade = min(uv().y.smoothstep(0, 0.2), uv().y.oneMinus().smoothstep(0, 0.4)); - - // effect - const effect = noise1.mul(noise2).mul(outerFade); - - return vec4(vec3(0), effect.smoothstep(0, 0.01)); - })(); - - const dark = new THREE.Mesh(cylinderGeometry, darkMaterial); - dark.scale.set(1, 1, 1); - scene.add(dark); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setClearColor(0x201919); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // post processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera); - const scenePassColor = scenePass.getTextureNode('output'); - - const bloomPass = bloom(scenePassColor, 1, 0.1, 1); - - renderPipeline.outputNode = scenePassColor.add(bloomPass); - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.y = 0.4; - controls.enableDamping = true; - controls.minDistance = 0.1; - controls.maxDistance = 50; - - window.addEventListener('resize', onWindowResize); - - // debug - - const gui = renderer.inspector.createParameters('Parameters'); - - gui.addColor({ color: emissiveColor.value.getHexString(THREE.SRGBColorSpace) }, 'color') - .onChange(value => emissiveColor.value.set(value)) - .name('emissiveColor'); - gui.add(timeScale, 'value', -1, 1, 0.01).name('timeScale'); - gui.add(parabolStrength, 'value', 0, 2, 0.01).name('parabolStrength'); - gui.add(parabolOffset, 'value', 0, 1, 0.01).name('parabolOffset'); - gui.add(parabolAmplitude, 'value', 0, 2, 0.01).name('parabolAmplitude'); - - const bloomGui = gui.addFolder('bloom'); - bloomGui.add(bloomPass.strength, 'value', 0, 10, 0.01).name('strength'); - bloomGui.add(bloomPass.radius, 'value', 0, 1, 0.01).name('radius'); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -async function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_tsl_wood.ts b/examples-testing/examples/webgpu_tsl_wood.ts deleted file mode 100644 index 5a4e06502..000000000 --- a/examples-testing/examples/webgpu_tsl_wood.ts +++ /dev/null @@ -1,249 +0,0 @@ -import * as THREE from 'three'; -import * as TSL from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import WebGPU from 'three/addons/capabilities/WebGPU.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { FontLoader } from 'three/addons/loaders/FontLoader.js'; -import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; - -import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; -import { WoodNodeMaterial, WoodGenuses, Finishes } from 'three/addons/materials/WoodNodeMaterial.js'; - -let scene, base, camera, renderer, controls, font, blockGeometry, gui; - -// Helper function to get grid position -function getGridPosition(woodIndex, finishIndex) { - return { - x: 0, - y: (finishIndex - Finishes.length / 2) * 1.0, - z: (woodIndex - WoodGenuses.length / 2 + 0.45) * 1.0, - }; -} - -// Helper function to create the grid plane -function createGridPlane() { - const material = new THREE.MeshBasicNodeMaterial(); - - const gridXZ = TSL.Fn(([gridSize = TSL.float(1.0), dotWidth = TSL.float(0.1), lineWidth = TSL.float(0.02)]) => { - const coord = TSL.positionWorld.xz.div(gridSize); - const grid = TSL.fract(coord); - - // Screen-space derivative for automatic antialiasing - const fw = TSL.fwidth(coord); - const smoothing = TSL.max(fw.x, fw.y).mul(0.5); - - // Create squares at cell centers - const squareDist = TSL.max(TSL.abs(grid.x.sub(0.5)), TSL.abs(grid.y.sub(0.5))); - const dots = TSL.smoothstep(dotWidth.add(smoothing), dotWidth.sub(smoothing), squareDist); - - // Create grid lines - const lineX = TSL.smoothstep(lineWidth.add(smoothing), lineWidth.sub(smoothing), TSL.abs(grid.x.sub(0.5))); - const lineZ = TSL.smoothstep(lineWidth.add(smoothing), lineWidth.sub(smoothing), TSL.abs(grid.y.sub(0.5))); - const lines = TSL.max(lineX, lineZ); - - return TSL.max(dots, lines); - }); - - const radialGradient = TSL.Fn(([radius = TSL.float(10.0), falloff = TSL.float(1.0)]) => { - return TSL.smoothstep(radius, radius.sub(falloff), TSL.length(TSL.positionWorld)); - }); - - // Create grid pattern - const gridPattern = gridXZ(1.0, 0.03, 0.005); - const baseColor = TSL.vec4(1.0, 1.0, 1.0, 0.0); - const gridColor = TSL.vec4(0.5, 0.5, 0.5, 1.0); - - // Mix base color with grid lines - material.colorNode = gridPattern.mix(baseColor, gridColor).mul(radialGradient(30.0, 20.0)); - material.transparent = true; - - const plane = new THREE.Mesh(new THREE.CircleGeometry(40), material); - plane.rotation.x = -Math.PI / 2; - plane.renderOrder = -1; - - return plane; -} - -// Helper function to create and position labels -function createLabel(text, font, material, position) { - const txt_geo = new TextGeometry(text, { - font: font, - size: 0.1, - depth: 0.001, - curveSegments: 12, - bevelEnabled: false, - }); - - txt_geo.computeBoundingBox(); - const offx = -0.5 * (txt_geo.boundingBox.max.x - txt_geo.boundingBox.min.x); - const offy = -0.5 * (txt_geo.boundingBox.max.y - txt_geo.boundingBox.min.y); - const offz = -0.5 * (txt_geo.boundingBox.max.z - txt_geo.boundingBox.min.z); - txt_geo.translate(offx, offy, offz); - - const label = new THREE.Group(); - const mesh = new THREE.Mesh(txt_geo); - label.add(mesh); - - // Apply default rotation for labels - label.rotateY(-Math.PI / 2); - - label.children[0].material = material; - label.position.copy(position); - base.add(label); -} - -async function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xffffff); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); - camera.position.set(-0.1, 5, 0.548); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(1.0); // important for performance - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 1.0; - renderer.inspector = new Inspector(); - renderer.setAnimationLoop(render); - document.body.appendChild(renderer.domElement); - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.set(0, 0, 0.548); - - gui = renderer.inspector.createParameters('Parameters'); - - font = await new FontLoader().loadAsync('./fonts/helvetiker_regular.typeface.json'); - - // Create shared block geometry - blockGeometry = new RoundedBoxGeometry(0.125, 0.9, 0.9, 10, 0.02); - - base = new THREE.Group(); - base.rotation.set(0, 0, -Math.PI / 2); - base.position.set(0, 0, 0.548); - scene.add(base); - - const text_mat = new THREE.MeshStandardMaterial(); - text_mat.colorNode = TSL.color('#000000'); - - // Create finish labels (using negative wood index for left column) - for (let y = 0; y < Finishes.length; y++) { - createLabel(Finishes[y], font, text_mat, getGridPosition(-1, y)); - } - - // Create and add the grid plane - const plane = createGridPlane(); - scene.add(plane); - - await new HDRLoader() - .setPath('textures/equirectangular/') - .loadAsync('san_giuseppe_bridge_2k.hdr') - .then(texture => { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.environment = texture; - scene.environmentIntensity = 2; - }); - - // Create wood labels (using negative finish index for top row) - for (let x = 0; x < WoodGenuses.length; x++) { - createLabel(WoodGenuses[x], font, text_mat, getGridPosition(x, -1)); - } - - // Create wood blocks - for (let x = 0; x < WoodGenuses.length; x++) { - for (let y = 0; y < Finishes.length; y++) { - const material = WoodNodeMaterial.fromPreset(WoodGenuses[x], Finishes[y]); - const cube = new THREE.Mesh(blockGeometry, material); - - cube.position.copy(getGridPosition(x, y)); - material.transformationMatrix = new THREE.Matrix4().setPosition(new THREE.Vector3(-0.1, 0, Math.random())); - base.add(cube); - - await new Promise(resolve => setTimeout(resolve, 0)); - } - } - - add_custom_wood(text_mat); -} - -function render() { - controls.update(); - - renderer.render(scene, camera); -} - -window.addEventListener('resize', () => { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -}); - -if (WebGPU.isAvailable()) { - init(); -} else { - document.body.appendChild(WebGPU.getErrorMessage()); -} - -function add_custom_wood(text_mat) { - // Add "Custom" label (positioned at the end of the grid) - createLabel('custom', font, text_mat, getGridPosition(Math.round(WoodGenuses.length / 2 - 1), 5)); - - // Create custom wood material with unique parameters - const customMaterial = new WoodNodeMaterial({ - centerSize: 1.11, - largeWarpScale: 0.32, - largeGrainStretch: 0.24, - smallWarpStrength: 0.059, - smallWarpScale: 2, - fineWarpStrength: 0.006, - fineWarpScale: 32.8, - ringThickness: 1 / 34, - ringBias: 0.03, - ringSizeVariance: 0.03, - ringVarianceScale: 4.4, - barkThickness: 0.3, - splotchScale: 0.2, - splotchIntensity: 0.541, - cellScale: 910, - cellSize: 0.1, - darkGrainColor: new THREE.Color('#0c0504'), - lightGrainColor: new THREE.Color('#926c50'), - clearcoat: 1, - clearcoatRoughness: 0.2, - }); - - gui.add(customMaterial, 'centerSize', 0.0, 2.0, 0.01).name('centerSize'); - gui.add(customMaterial, 'largeWarpScale', 0.0, 1.0, 0.001).name('largeWarpScale'); - gui.add(customMaterial, 'largeGrainStretch', 0.0, 1.0, 0.001).name('largeGrainStretch'); - gui.add(customMaterial, 'smallWarpStrength', 0.0, 0.2, 0.001).name('smallWarpStrength'); - gui.add(customMaterial, 'smallWarpScale', 0.0, 5.0, 0.01).name('smallWarpScale'); - gui.add(customMaterial, 'fineWarpStrength', 0.0, 0.05, 0.001).name('fineWarpStrength'); - gui.add(customMaterial, 'fineWarpScale', 0.0, 50.0, 0.1).name('fineWarpScale'); - gui.add(customMaterial, 'ringThickness', 0.0, 0.1, 0.001).name('ringThickness'); - gui.add(customMaterial, 'ringBias', -0.2, 0.2, 0.001).name('ringBias'); - gui.add(customMaterial, 'ringSizeVariance', 0.0, 0.2, 0.001).name('ringSizeVariance'); - gui.add(customMaterial, 'ringVarianceScale', 0.0, 10.0, 0.1).name('ringVarianceScale'); - gui.add(customMaterial, 'barkThickness', 0.0, 1.0, 0.01).name('barkThickness'); - gui.add(customMaterial, 'splotchScale', 0.0, 1.0, 0.01).name('splotchScale'); - gui.add(customMaterial, 'splotchIntensity', 0.0, 1.0, 0.01).name('splotchIntensity'); - gui.add(customMaterial, 'cellScale', 100, 2000, 1).name('cellScale'); - gui.add(customMaterial, 'cellSize', 0.01, 0.5, 0.001).name('cellSize'); - gui.addColor({ darkGrainColor: '#0c0504' }, 'darkGrainColor').onChange(v => customMaterial.darkGrainColor.set(v)); - gui.addColor({ lightGrainColor: '#926c50' }, 'lightGrainColor').onChange(v => - customMaterial.lightGrainColor.set(v), - ); - gui.add(customMaterial, 'clearcoat', 0.0, 1.0, 0.01).name('clearcoat'); - gui.add(customMaterial, 'clearcoatRoughness', 0.0, 1.0, 0.01).name('clearcoatRoughness'); - - const cube = new THREE.Mesh(blockGeometry, customMaterial); - - customMaterial.transformationMatrix = new THREE.Matrix4().setPosition(new THREE.Vector3(-0.1, 0, Math.random())); - cube.position.copy(getGridPosition(Math.round(WoodGenuses.length / 2), 5)); - - base.add(cube); -} diff --git a/examples-testing/examples/webgpu_upscaling_fsr1.ts b/examples-testing/examples/webgpu_upscaling_fsr1.ts deleted file mode 100644 index c4a749307..000000000 --- a/examples-testing/examples/webgpu_upscaling_fsr1.ts +++ /dev/null @@ -1,122 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { pass } from 'three/tsl'; -import { fsr1 } from 'three/addons/tsl/display/FSR1Node.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; - -const params = { - upscaleMethod: 'FSR1', - resolutionScale: 0.5, -}; - -let camera, scene, renderer, renderPipeline, controls, mixer, timer; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-0.5, 0, 12); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // model - - const dracoLoader = new DRACOLoader(); - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - - loader.load('models/gltf/LittlestTokyo.glb', function (gltf) { - const model = gltf.scene; - model.scale.set(0.01, 0.01, 0.01); - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - mixer.clipAction(gltf.animations[0]).play(); - }); - - // renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfe3dd); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target.set(-0.5, 0, 0); - - // render pipeline - - renderPipeline = new THREE.RenderPipeline(renderer); - - const scenePass = pass(scene, camera).toInspector('Color'); - scenePass.setResolutionScale(params.resolutionScale); - - // FSR 1 - - const fsr1Node = fsr1(scenePass).toInspector('FSR1'); - - // - - function updatePipeline() { - if (params.upscaleMethod === 'FSR1') { - renderPipeline.outputNode = fsr1Node; - } else { - renderPipeline.outputNode = scenePass; - } - - renderPipeline.needsUpdate = true; - } - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'upscaleMethod', ['Bilinear', 'FSR1']).onChange(updatePipeline); - gui.add(params, 'resolutionScale', 0.25, 1.0, 0.25).onChange(value => { - scenePass.setResolutionScale(value); - }); - - updatePipeline(); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) { - mixer.update(delta); - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_upscaling_taau.ts b/examples-testing/examples/webgpu_upscaling_taau.ts deleted file mode 100644 index d4169bafa..000000000 --- a/examples-testing/examples/webgpu_upscaling_taau.ts +++ /dev/null @@ -1,142 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { mrt, output, pass, velocity } from 'three/tsl'; -import { taau } from 'three/addons/tsl/display/TAAUNode.js'; -import { sharpen } from 'three/addons/tsl/display/SharpenNode.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { Inspector } from 'three/addons/inspector/Inspector.js'; -import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; - -const params = { - upscaleMethod: 'TAAU', - resolutionScale: 0.5, - sharpening: true, - sharpness: 0.2, -}; - -let camera, scene, renderer, renderPipeline, controls, mixer, timer; - -init(); - -async function init() { - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-0.5, 0, 12); - - scene = new THREE.Scene(); - - timer = new THREE.Timer(); - timer.connect(document); - - // model - - const dracoLoader = new DRACOLoader(); - const loader = new GLTFLoader(); - loader.setDRACOLoader(dracoLoader); - - loader.load('models/gltf/LittlestTokyo.glb', function (gltf) { - const model = gltf.scene; - model.scale.set(0.01, 0.01, 0.01); - scene.add(model); - - mixer = new THREE.AnimationMixer(model); - mixer.clipAction(gltf.animations[0]).play(); - }); - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - await renderer.init(); - - const pmremGenerator = new THREE.PMREMGenerator(renderer); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0xbfe3dd); - scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.04).texture; - - // controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target.set(-0.5, 0, 0); - - // render pipeline - - renderPipeline = new THREE.RenderPipeline(renderer); - const scenePass = pass(scene, camera); - scenePass.setResolutionScale(params.resolutionScale); - scenePass.setMRT( - mrt({ - output: output, - velocity: velocity, - }), - ); - - const scenePassColor = scenePass.getTextureNode('output').toInspector('Color'); - const scenePassDepth = scenePass.getTextureNode('depth').toInspector('Depth', () => { - return scenePass.getLinearDepthNode(); - }); - const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); - - const taauNode = taau(scenePassColor, scenePassDepth, scenePassVelocity, camera); - const sharpenNode = sharpen(taauNode.getTextureNode(), params.sharpness); - - function updatePipeline() { - if (params.upscaleMethod === 'TAAU') { - renderPipeline.outputNode = params.sharpening ? sharpenNode : taauNode; - } else { - renderPipeline.outputNode = scenePass; - } - - renderPipeline.needsUpdate = true; - } - - // gui - - const gui = renderer.inspector.createParameters('Settings'); - gui.add(params, 'upscaleMethod', ['Bilinear', 'TAAU']).onChange(updatePipeline); - gui.add(params, 'resolutionScale', 0.25, 1.0, 0.25).onChange(value => { - scenePass.setResolutionScale(value); - }); - gui.add(params, 'sharpening').onChange(updatePipeline); - gui.add(params, 'sharpness', 0, 2, 0.05).onChange(value => { - sharpenNode.sharpness.value = value; - }); - - updatePipeline(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - const width = window.innerWidth; - const height = window.innerHeight; - - camera.aspect = width / height; - camera.updateProjectionMatrix(); - - renderer.setSize(width, height); -} - -function animate() { - controls.update(); - - timer.update(); - - const delta = timer.getDelta(); - - if (mixer) { - mixer.update(delta); - } - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_video_panorama.ts b/examples-testing/examples/webgpu_video_panorama.ts deleted file mode 100644 index f52b15ffe..000000000 --- a/examples-testing/examples/webgpu_video_panorama.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as THREE from 'three/webgpu'; - -let camera, scene, renderer; - -let isUserInteracting = false, - lon = 0, - lat = 0, - phi = 0, - theta = 0, - onPointerDownPointerX = 0, - onPointerDownPointerY = 0, - onPointerDownLon = 0, - onPointerDownLat = 0; - -const distance = 0.5; - -init(); - -function init() { - const container = document.getElementById('container'); - - camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.25, 10); - - scene = new THREE.Scene(); - - const geometry = new THREE.SphereGeometry(5, 60, 40); - // invert the geometry on the x-axis so that all of the faces point inward - geometry.scale(-1, 1, 1); - - const video = document.getElementById('video'); - video.play(); - - const texture = new THREE.VideoTexture(video); - texture.colorSpace = THREE.SRGBColorSpace; - const material = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh = new THREE.Mesh(geometry, material); - scene.add(mesh); - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - container.appendChild(renderer.domElement); - - document.addEventListener('pointerdown', onPointerDown); - document.addEventListener('pointermove', onPointerMove); - document.addEventListener('pointerup', onPointerUp); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onPointerDown(event) { - isUserInteracting = true; - - onPointerDownPointerX = event.clientX; - onPointerDownPointerY = event.clientY; - - onPointerDownLon = lon; - onPointerDownLat = lat; -} - -function onPointerMove(event) { - if (isUserInteracting === true) { - lon = (onPointerDownPointerX - event.clientX) * 0.1 + onPointerDownLon; - lat = (onPointerDownPointerY - event.clientY) * 0.1 + onPointerDownLat; - } -} - -function onPointerUp() { - isUserInteracting = false; -} - -function animate() { - update(); -} - -function update() { - lat = Math.max(-85, Math.min(85, lat)); - phi = THREE.MathUtils.degToRad(90 - lat); - theta = THREE.MathUtils.degToRad(lon); - - camera.position.x = distance * Math.sin(phi) * Math.cos(theta); - camera.position.y = distance * Math.cos(phi); - camera.position.z = distance * Math.sin(phi) * Math.sin(theta); - - camera.lookAt(0, 0, 0); - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_volume_caustics.ts b/examples-testing/examples/webgpu_volume_caustics.ts deleted file mode 100644 index d4a68aa74..000000000 --- a/examples-testing/examples/webgpu_volume_caustics.ts +++ /dev/null @@ -1,302 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { - uniform, - refract, - div, - frameId, - lightViewPosition, - float, - positionView, - positionViewDirection, - screenUV, - pass, - texture3D, - time, - screenCoordinate, - normalView, - texture, - Fn, - vec2, - vec3, -} from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; - -let camera, scene, renderer, controls; -let renderPipeline; -let gltf; - -init(); - -async function init() { - const LAYER_VOLUMETRIC_LIGHTING = 10; - - camera = new THREE.PerspectiveCamera(25, window.innerWidth / window.innerHeight, 0.025, 5); - camera.position.set(-0.7, 0.2, 0.2); - - scene = new THREE.Scene(); - - // Light - - const spotLight = new THREE.SpotLight(0xffffff, 1); - spotLight.position.set(0.2, 0.3, 0.2); - spotLight.castShadow = true; - spotLight.angle = Math.PI / 6; - spotLight.penumbra = 1; - spotLight.decay = 2; - spotLight.distance = 0; - spotLight.shadow.mapType = THREE.HalfFloatType; // For HDR Caustics - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - spotLight.shadow.camera.near = 0.1; - spotLight.shadow.camera.far = 1; - spotLight.shadow.intensity = 0.95; - spotLight.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - scene.add(spotLight); - - // Model / Textures - - const dracoLoader = new DRACOLoader(); - - gltf = (await new GLTFLoader().setDRACOLoader(dracoLoader).loadAsync('./models/gltf/duck.glb')).scene; - gltf.scale.setScalar(0.5); - scene.add(gltf); - - const causticMap = new THREE.TextureLoader().load('./textures/opengameart/Caustic_Free.jpg'); - causticMap.wrapS = causticMap.wrapT = THREE.RepeatWrapping; - causticMap.colorSpace = THREE.SRGBColorSpace; - - // Material - - const duck = gltf.children[0]; - duck.material = new THREE.MeshPhysicalNodeMaterial(); - duck.material.side = THREE.DoubleSide; - duck.material.transparent = true; - duck.material.color = new THREE.Color(0xffd700); - duck.material.transmission = 1; - duck.material.thickness = 0.25; - duck.material.ior = 1.5; - duck.material.metalness = 0; - duck.material.roughness = 0.1; - duck.castShadow = true; - - // TSL Shader - - const causticOcclusion = uniform(1); - - const causticEffect = Fn(() => { - const refractionVector = refract( - positionViewDirection.negate(), - normalView, - div(1.0, duck.material.ior), - ).normalize(); - const viewZ = normalView.z.pow(causticOcclusion); - - const textureUV = refractionVector.xy.mul(0.6); - - const causticColor = uniform(duck.material.color); - const chromaticAberrationOffset = normalView.z.pow(-0.9).mul(0.004); - - const causticProjection = vec3( - texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset.negate(), 0))).r, - texture(causticMap, textureUV.add(vec2(0, chromaticAberrationOffset.negate()))).g, - texture(causticMap, textureUV.add(vec2(chromaticAberrationOffset, chromaticAberrationOffset))).b, - ); - - return causticProjection.mul(viewZ.mul(60)).add(viewZ).mul(causticColor); - })().toVar(); - - duck.material.castShadowNode = causticEffect; - - duck.material.emissiveNode = Fn(() => { - // Custom emissive for illuminating backside of the mesh based on the caustic effect and light direction - - const thicknessPowerNode = float(3.0); - - const scatteringHalf = lightViewPosition(spotLight).sub(positionView).normalize(); - const scatteringDot = float( - positionViewDirection.dot(scatteringHalf.negate()).saturate().pow(thicknessPowerNode), - ); - - return causticEffect.mul(scatteringDot.add(0.1)).mul(0.02); - })(); - - // Ground - - const textureLoader = new THREE.TextureLoader(); - const map = textureLoader.load('textures/hardwood2_diffuse.jpg'); - map.wrapS = map.wrapT = THREE.RepeatWrapping; - map.repeat.set(10, 10); - - const geometry = new THREE.PlaneGeometry(2, 2); - const material = new THREE.MeshStandardMaterial({ color: 0 }); - - const ground = new THREE.Mesh(geometry, material); - ground.rotation.x = -Math.PI / 2; - ground.receiveShadow = true; - scene.add(ground); - - // Renderer - - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.shadowMap.enabled = true; - renderer.shadowMap.transmitted = true; - renderer.inspector = new Inspector(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - document.body.appendChild(renderer.domElement); - - // GUI - - const gui = renderer.inspector.createParameters('Volumetric Caustics'); - gui.add(causticOcclusion, 'value', 0, 20).name('caustic occlusion'); - gui.addColor(duck.material, 'color').name('material color'); - - // Post-Processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // Layers - - const volumetricLightingIntensity = uniform(0.7); - - const volumetricLayer = new THREE.Layers(); - volumetricLayer.disableAll(); - volumetricLayer.enable(LAYER_VOLUMETRIC_LIGHTING); - - // Volumetric Fog Area - - function createTexture3D() { - let i = 0; - - const size = 128; - const data = new Uint8Array(size * size * size); - - const scale = 10; - const perlin = new ImprovedNoise(); - - const repeatFactor = 5.0; - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - const nx = (x / size) * repeatFactor; - const ny = (y / size) * repeatFactor; - const nz = (z / size) * repeatFactor; - - const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); - - data[i] = 128 + 128 * noiseValue; - - i++; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - return texture; - } - - const noiseTexture3D = createTexture3D(); - - const smokeAmount = uniform(3); - - const volumetricMaterial = new THREE.VolumeNodeMaterial(); - volumetricMaterial.steps = 20; - volumetricMaterial.offsetNode = bayer16(screenCoordinate.add(frameId)); // Add dithering to reduce banding - volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { - // Return the amount of fog based on the noise texture - - const timeScaled = vec3(time.mul(0.01), 0, time.mul(0.03)); - - const sampleGrain = (scale, timeScale = 1) => - texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); - - let density = sampleGrain(1); - density = density.mul(sampleGrain(0.5, 1)); - density = density.mul(sampleGrain(0.2, 2)); - - return smokeAmount.mix(1, density); - }); - - const volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(1.5, 0.5, 1.5), volumetricMaterial); - volumetricMesh.receiveShadow = true; - volumetricMesh.position.y = 0.25; - volumetricMesh.layers.disableAll(); - volumetricMesh.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - scene.add(volumetricMesh); - - // Scene Pass - - const scenePass = pass(scene, camera).toInspector(); - scenePass.name = 'Scene'; - - const sceneDepth = scenePass.getTextureNode('depth'); - sceneDepth.name = 'Scene Depth'; - - // Material - Apply occlusion depth of volumetric lighting based on the scene depth - - volumetricMaterial.depthNode = sceneDepth.sample(screenUV); - - // Volumetric Lighting Pass - - const volumetricPass = pass(scene, camera, { depthBuffer: false, samples: 0 }).toInspector( - 'Volumetric Lighting / Raw', - ); - volumetricPass.name = 'Volumetric Lighting'; - volumetricPass.setLayers(volumetricLayer); - volumetricPass.setResolutionScale(0.5); - - // Compose and Denoise - - const bloomPass = bloom(volumetricPass, 1, 1, 0).toInspector('Volumetric Lighting / Mip-Chain Gaussian Blur'); - bloomPass.name = 'Bloom'; - - const scenePassColor = scenePass.add(bloomPass.mul(volumetricLightingIntensity)); - - renderPipeline.outputNode = scenePassColor; - - // Controls - - controls = new OrbitControls(camera, renderer.domElement); - controls.target.z = -0.05; - controls.target.y = 0.02; - controls.maxDistance = 1; - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - for (const mesh of gltf.children) { - mesh.rotation.y -= 0.01; - } - - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_volume_cloud.ts b/examples-testing/examples/webgpu_volume_cloud.ts deleted file mode 100644 index 1d46c3543..000000000 --- a/examples-testing/examples/webgpu_volume_cloud.ts +++ /dev/null @@ -1,165 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { float, vec3, vec4, If, Break, Fn, smoothstep, texture3D, uniform } from 'three/tsl'; - -import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -let renderer, scene, camera; -let mesh; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 1.5); - - new OrbitControls(camera, renderer.domElement); - - // Sky - - const canvas = document.createElement('canvas'); - canvas.width = 1; - canvas.height = 32; - - const context = canvas.getContext('2d'); - const gradient = context.createLinearGradient(0, 0, 0, 32); - gradient.addColorStop(0.0, '#014a84'); - gradient.addColorStop(0.5, '#0561a0'); - gradient.addColorStop(1.0, '#437ab6'); - context.fillStyle = gradient; - context.fillRect(0, 0, 1, 32); - - const skyMap = new THREE.CanvasTexture(canvas); - skyMap.colorSpace = THREE.SRGBColorSpace; - - const sky = new THREE.Mesh( - new THREE.SphereGeometry(10), - new THREE.MeshBasicNodeMaterial({ map: skyMap, side: THREE.BackSide }), - ); - scene.add(sky); - - // Texture - - const size = 128; - const data = new Uint8Array(size * size * size); - - let i = 0; - const scale = 0.05; - const perlin = new ImprovedNoise(); - const vector = new THREE.Vector3(); - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - const d = - 1.0 - - vector - .set(x, y, z) - .subScalar(size / 2) - .divideScalar(size) - .length(); - data[i] = (128 + 128 * perlin.noise((x * scale) / 1.5, y * scale, (z * scale) / 1.5)) * d * d; - i++; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - // Shader - - const transparentRaymarchingTexture = Fn( - ({ texture, range = float(0.1), threshold = float(0.25), opacity = float(0.25), steps = float(100) }) => { - const finalColor = vec4(0).toVar(); - - RaymarchingBox(steps, ({ positionRay }) => { - const mapValue = float(texture.sample(positionRay.add(0.5)).r).toVar(); - - mapValue.assign(smoothstep(threshold.sub(range), threshold.add(range), mapValue).mul(opacity)); - - const shading = texture - .sample(positionRay.add(vec3(-0.01))) - .r.sub(texture.sample(positionRay.add(vec3(0.01))).r); - - const col = shading.mul(3.0).add(positionRay.x.add(positionRay.y).mul(0.25)).add(0.2); - - finalColor.rgb.addAssign(finalColor.a.oneMinus().mul(mapValue).mul(col)); - - finalColor.a.addAssign(finalColor.a.oneMinus().mul(mapValue)); - - If(finalColor.a.greaterThanEqual(0.95), () => { - Break(); - }); - }); - - return finalColor; - }, - ); - - // Material - - const baseColor = uniform(new THREE.Color(0x798aa0)); - const range = uniform(0.1); - const threshold = uniform(0.25); - const opacity = uniform(0.25); - const steps = uniform(100); - - const cloud3d = transparentRaymarchingTexture({ - texture: texture3D(texture, null, 0), - range, - threshold, - opacity, - steps, - }); - - const finalCloud = cloud3d.setRGB(cloud3d.rgb.add(baseColor)); - - const material = new THREE.NodeMaterial(); - material.colorNode = finalCloud; - material.side = THREE.BackSide; - material.transparent = true; - - mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), material); - scene.add(mesh); - - // - - const gui = renderer.inspector.createParameters('Parameters'); - gui.add(threshold, 'value', 0, 1, 0.01).name('threshold'); - gui.add(opacity, 'value', 0, 1, 0.01).name('opacity'); - gui.add(range, 'value', 0, 1, 0.01).name('range'); - gui.add(steps, 'value', 0, 200, 1).name('steps'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - mesh.rotation.y = -performance.now() / 7500; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_volume_lighting.ts b/examples-testing/examples/webgpu_volume_lighting.ts deleted file mode 100644 index 38099c6a5..000000000 --- a/examples-testing/examples/webgpu_volume_lighting.ts +++ /dev/null @@ -1,248 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { vec3, Fn, time, texture3D, screenUV, uniform, screenCoordinate, pass } from 'three/tsl'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; -import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - -import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -let renderer, scene, camera; -let volumetricMesh, teapot, pointLight, spotLight; -let renderPipeline; - -init(); - -function createTexture3D() { - let i = 0; - - const size = 128; - const data = new Uint8Array(size * size * size); - - const scale = 10; - const perlin = new ImprovedNoise(); - - const repeatFactor = 5.0; - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - const nx = (x / size) * repeatFactor; - const ny = (y / size) * repeatFactor; - const nz = (z / size) * repeatFactor; - - const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); - - data[i] = 128 + 128 * noiseValue; - - i++; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - return texture; -} - -function init() { - const LAYER_VOLUMETRIC_LIGHTING = 10; - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 2; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-8, 1, -6); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.maxDistance = 40; - controls.minDistance = 2; - - // Volumetric Fog Area - - const noiseTexture3D = createTexture3D(); - - const smokeAmount = uniform(2); - - const volumetricMaterial = new THREE.VolumeNodeMaterial(); - volumetricMaterial.steps = 12; - volumetricMaterial.offsetNode = bayer16(screenCoordinate); // Add dithering to reduce banding - volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { - // Return the amount of fog based on the noise texture - - const timeScaled = vec3(time, 0, time.mul(0.3)); - - const sampleGrain = (scale, timeScale = 1) => - texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); - - let density = sampleGrain(0.1); - density = density.mul(sampleGrain(0.05, 1)); - density = density.mul(sampleGrain(0.02, 2)); - - return smokeAmount.mix(1, density); - }); - - volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(20, 10, 20), volumetricMaterial); - volumetricMesh.receiveShadow = true; - volumetricMesh.position.y = 2; - volumetricMesh.layers.disableAll(); - volumetricMesh.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - scene.add(volumetricMesh); - - // Objects - - teapot = new THREE.Mesh( - new TeapotGeometry(0.8, 18), - new THREE.MeshStandardMaterial({ color: 0xffffff, side: THREE.DoubleSide }), - ); - teapot.castShadow = true; - scene.add(teapot); - - const floor = new THREE.Mesh( - new THREE.PlaneGeometry(100, 100), - new THREE.MeshStandardMaterial({ color: 0xffffff }), - ); - floor.rotation.x = -Math.PI / 2; - floor.position.y = -3; - floor.receiveShadow = true; - scene.add(floor); - - // Lights - - pointLight = new THREE.PointLight(0xf9bb50, 3, 100); - pointLight.castShadow = true; - pointLight.position.set(0, 1.4, 0); - pointLight.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - //lightBase.add( new THREE.Mesh( new THREE.SphereGeometry( 0.1, 16, 16 ), new THREE.MeshBasicMaterial( { color: 0xf9bb50 } ) ) ); - scene.add(pointLight); - - spotLight = new THREE.SpotLight(0xffffff, 100); - spotLight.position.set(2.5, 5, 2.5); - spotLight.angle = Math.PI / 6; - spotLight.penumbra = 1; - spotLight.decay = 2; - spotLight.distance = 0; - spotLight.map = new THREE.TextureLoader().setPath('textures/').load('colors.png'); - spotLight.castShadow = true; - spotLight.shadow.intensity = 0.98; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - spotLight.shadow.camera.near = 1; - spotLight.shadow.camera.far = 15; - spotLight.shadow.focus = 1; - spotLight.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - //sunLight.add( new THREE.Mesh( new THREE.SphereGeometry( 0.1, 16, 16 ), new THREE.MeshBasicMaterial( { color: 0xffffff } ) ) ); - scene.add(spotLight); - - // Post-Processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // Layers - - const volumetricLightingIntensity = uniform(1); - - const volumetricLayer = new THREE.Layers(); - volumetricLayer.disableAll(); - volumetricLayer.enable(LAYER_VOLUMETRIC_LIGHTING); - - // Scene Pass - - const scenePass = pass(scene, camera); - const sceneDepth = scenePass.getTextureNode('depth'); - - // Material - Apply occlusion depth of volumetric lighting based on the scene depth - - volumetricMaterial.depthNode = sceneDepth.sample(screenUV); - - // Volumetric Lighting Pass - - const volumetricPass = pass(scene, camera, { depthBuffer: false }); - volumetricPass.name = 'Volumetric Lighting'; - volumetricPass.setLayers(volumetricLayer); - volumetricPass.setResolutionScale(0.25); - - // Compose and Denoise - - const denoiseStrength = uniform(0.6); - - const blurredVolumetricPass = gaussianBlur(volumetricPass, denoiseStrength); - - const scenePassColor = scenePass.add(blurredVolumetricPass.mul(volumetricLightingIntensity)); - - renderPipeline.outputNode = scenePassColor; - - // GUI - - const params = { - resolution: volumetricPass.getResolutionScale(), - denoise: true, - }; - - const gui = renderer.inspector.createParameters('Volumetric Lighting'); - - const rayMarching = gui.addFolder('Ray Marching'); - rayMarching.add(params, 'resolution', 0.1, 1).onChange(resolution => { - volumetricPass.setResolutionScale(resolution); - }); - rayMarching.add(volumetricMaterial, 'steps', 2, 16).name('step count'); - rayMarching.add(denoiseStrength, 'value', 0, 1).name('denoise strength'); - rayMarching.add(params, 'denoise').onChange(denoise => { - const volumetric = denoise ? blurredVolumetricPass : volumetricPass; - - const scenePassColor = scenePass.add(volumetric.mul(volumetricLightingIntensity)); - - renderPipeline.outputNode = scenePassColor; - renderPipeline.needsUpdate = true; - }); - - const lighting = gui.addFolder('Lighting / Scene'); - lighting.add(pointLight, 'intensity', 0, 6).name('light intensity'); - lighting.add(spotLight, 'intensity', 0, 200).name('spot intensity'); - lighting.add(volumetricLightingIntensity, 'value', 0, 2).name('fog intensity'); - lighting.add(smokeAmount, 'value', 0, 3).name('smoke amount'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now() * 0.001; - const scale = 2.4; - - pointLight.position.x = Math.sin(time * 0.7) * scale; - pointLight.position.y = Math.cos(time * 0.5) * scale; - pointLight.position.z = Math.cos(time * 0.3) * scale; - - spotLight.position.x = Math.cos(time * 0.3) * scale; - spotLight.lookAt(0, 0, 0); - - teapot.rotation.y = time * 0.2; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_volume_lighting_rectarea.ts b/examples-testing/examples/webgpu_volume_lighting_rectarea.ts deleted file mode 100644 index 47c82841c..000000000 --- a/examples-testing/examples/webgpu_volume_lighting_rectarea.ts +++ /dev/null @@ -1,256 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { vec3, Fn, time, texture3D, screenUV, uniform, screenCoordinate, pass, checker, uv } from 'three/tsl'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; -import { RectAreaLightTexturesLib } from 'three/addons/lights/RectAreaLightTexturesLib.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; -import { gaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; - -let renderer, scene, camera; -let volumetricMesh; -let rectLight1, rectLight2, rectLight3; -let timer; -let renderPipeline; - -init(); - -function createTexture3D() { - let i = 0; - - const size = 128; - const data = new Uint8Array(size * size * size); - - const scale = 10; - const perlin = new ImprovedNoise(); - - const repeatFactor = 5.0; - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - const nx = (x / size) * repeatFactor; - const ny = (y / size) * repeatFactor; - const nz = (z / size) * repeatFactor; - - const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); - - data[i] = 128 + 128 * noiseValue; - - i++; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - return texture; -} - -function init() { - THREE.RectAreaLightNode.setLTC(RectAreaLightTexturesLib.init()); - - const LAYER_VOLUMETRIC_LIGHTING = 10; - - timer = new THREE.Timer(); - - renderer = new THREE.WebGPURenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 2; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 250); - camera.position.set(0, 5, -15); - - // Volumetric Fog Area - - const noiseTexture3D = createTexture3D(); - - const smokeAmount = uniform(2); - - const volumetricMaterial = new THREE.VolumeNodeMaterial(); - volumetricMaterial.steps = 12; - volumetricMaterial.offsetNode = bayer16(screenCoordinate); // Add dithering to reduce banding - volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { - // Return the amount of fog based on the noise texture - - const timeScaled = vec3(time, 0, time.mul(0.3)); - - const sampleGrain = (scale, timeScale = 1) => - texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); - - let density = sampleGrain(0.1); - density = density.mul(sampleGrain(0.05, 1)); - density = density.mul(sampleGrain(0.02, 2)); - - return smokeAmount.mix(1, density); - }); - - volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(50, 40, 50), volumetricMaterial); - volumetricMesh.receiveShadow = true; - volumetricMesh.position.y = 20; - volumetricMesh.layers.disableAll(); - volumetricMesh.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - scene.add(volumetricMesh); - - // Objects - - rectLight1 = new THREE.RectAreaLight(0xff0000, 5, 4, 10); - rectLight1.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - rectLight1.position.set(-5, 6, 5); - scene.add(rectLight1); - - rectLight2 = new THREE.RectAreaLight(0x00ff00, 5, 4, 10); - rectLight2.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - rectLight2.position.set(0, 6, 5); - scene.add(rectLight2); - - rectLight3 = new THREE.RectAreaLight(0x0000ff, 5, 4, 10); - rectLight3.layers.enable(LAYER_VOLUMETRIC_LIGHTING); - rectLight3.position.set(5, 6, 5); - scene.add(rectLight3); - - // - - const createRectLightMesh = rectLight => { - const geometry = new THREE.PlaneGeometry(4, 10); - const frontMaterial = new THREE.MeshBasicMaterial({ color: rectLight.color, side: THREE.BackSide }); - const backMaterial = new THREE.MeshStandardMaterial({ color: 0x111111 }); - - const backSide = new THREE.Mesh(geometry, backMaterial); - backSide.position.set(0, 0, 0.08); - - const frontSide = new THREE.Mesh(geometry, frontMaterial); - frontSide.position.set(0, 0, 0.01); - - rectLight.add(backSide); - rectLight.add(frontSide); - }; - - createRectLightMesh(rectLight1); - createRectLightMesh(rectLight2); - createRectLightMesh(rectLight3); - - // - - const geoFloor = new THREE.BoxGeometry(2000, 0.1, 2000); - const matStdFloor = new THREE.MeshStandardMaterial({ color: 0x444444 }); - matStdFloor.roughnessNode = checker(uv().mul(400)); - const mshStdFloor = new THREE.Mesh(geoFloor, matStdFloor); - scene.add(mshStdFloor); - - const geoKnot = new THREE.TorusKnotGeometry(1.5, 0.5, 200, 16); - const matKnot = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0, metalness: 0 }); - const meshKnot = new THREE.Mesh(geoKnot, matKnot); - meshKnot.position.set(0, 5.5, 0); - scene.add(meshKnot); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.minDistance = 5; - controls.maxDistance = 200; - controls.target.copy(meshKnot.position); - controls.update(); - - // Post-Processing - - renderPipeline = new THREE.RenderPipeline(renderer); - - // Layers - - const volumetricLightingIntensity = uniform(1); - - const volumetricLayer = new THREE.Layers(); - volumetricLayer.disableAll(); - volumetricLayer.enable(LAYER_VOLUMETRIC_LIGHTING); - - // Scene Pass - - const scenePass = pass(scene, camera); - const sceneDepth = scenePass.getTextureNode('depth'); - - // Material - Apply occlusion depth of volumetric lighting based on the scene depth - - volumetricMaterial.depthNode = sceneDepth.sample(screenUV); - - // Volumetric Lighting Pass - - const volumetricPass = pass(scene, camera, { depthBuffer: false }); - volumetricPass.setLayers(volumetricLayer); - volumetricPass.setResolutionScale(0.25); - - // Compose and Denoise - - const denoiseStrength = uniform(0.6); - - const blurredVolumetricPass = gaussianBlur(volumetricPass, denoiseStrength); - - const scenePassColor = scenePass.add(blurredVolumetricPass.mul(volumetricLightingIntensity)); - - renderPipeline.outputNode = scenePassColor; - - // GUI - - const params = { - resolution: volumetricPass.getResolutionScale(), - denoise: true, - }; - - const gui = renderer.inspector.createParameters('Volumetric Lighting'); - - const rayMarching = gui.addFolder('Ray Marching'); - rayMarching.add(params, 'resolution', 0.1, 1).onChange(resolution => { - volumetricPass.setResolutionScale(resolution); - }); - rayMarching.add(volumetricMaterial, 'steps', 2, 16).name('step count'); - rayMarching.add(denoiseStrength, 'value', 0, 1).name('denoise strength'); - rayMarching.add(params, 'denoise').onChange(denoise => { - const volumetric = denoise ? blurredVolumetricPass : volumetricPass; - - const scenePassColor = scenePass.add(volumetric.mul(volumetricLightingIntensity)); - - renderPipeline.outputNode = scenePassColor; - renderPipeline.needsUpdate = true; - }); - - const lighting = gui.addFolder('Lighting / Scene'); - lighting.add(volumetricLightingIntensity, 'value', 0, 2).name('fog intensity'); - lighting.add(smokeAmount, 'value', 0, 3).name('smoke amount'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const delta = timer.getDelta(); - - rectLight1.rotation.y += -delta; - rectLight2.rotation.y += delta * 0.5; - rectLight3.rotation.y += delta; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_volume_lighting_traa.ts b/examples-testing/examples/webgpu_volume_lighting_traa.ts deleted file mode 100644 index c5cc55e71..000000000 --- a/examples-testing/examples/webgpu_volume_lighting_traa.ts +++ /dev/null @@ -1,298 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { - vec2, - vec3, - Fn, - texture3D, - screenUV, - uniform, - screenCoordinate, - pass, - depthPass, - mrt, - output, - velocity, - fract, - interleavedGradientNoise, -} from 'three/tsl'; - -import { traa } from 'three/addons/tsl/display/TRAANode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; -import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; - -// Halton sequence for temporal offset - matches TRAA's 32-sample Halton jitter -// This creates optimal low-discrepancy distribution that accumulates well with TRAA -function halton(index, base) { - let result = 0; - let f = 1; - - while (index > 0) { - f /= base; - result += f * (index % base); - index = Math.floor(index / base); - } - - return result; -} - -// Generate 32 Halton offsets (base 2, 3) - same length as TRAA -const _haltonOffsets = Array.from({ length: 32 }, (_, i) => [halton(i + 1, 2), halton(i + 1, 3)]); - -let renderer, scene, camera; -let volumetricMesh, teapot, pointLight, spotLight; -let renderPipeline; -let temporalOffset, temporalRotation, shaderTime; -let params; - -init(); - -function createTexture3D() { - let i = 0; - - const size = 128; - const data = new Uint8Array(size * size * size); - - const scale = 10; - const perlin = new ImprovedNoise(); - - const repeatFactor = 5.0; - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - const nx = (x / size) * repeatFactor; - const ny = (y / size) * repeatFactor; - const nz = (z / size) * repeatFactor; - - const noiseValue = perlin.noise(nx * scale, ny * scale, nz * scale); - - data[i] = 128 + 128 * noiseValue; - - i++; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.wrapS = THREE.RepeatWrapping; - texture.wrapT = THREE.RepeatWrapping; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - return texture; -} - -function init() { - renderer = new THREE.WebGPURenderer(); - // renderer.setPixelRatio( window.devicePixelRatio ); // Disable DPR for performance - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.NeutralToneMapping; - renderer.toneMappingExposure = 2; - renderer.shadowMap.enabled = true; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(-8, 1, -6); - - const controls = new OrbitControls(camera, renderer.domElement); - controls.maxDistance = 40; - controls.minDistance = 2; - - // Volumetric Fog Area - - const noiseTexture3D = createTexture3D(); - - const smokeAmount = uniform(2); - - const volumetricMaterial = new THREE.VolumeNodeMaterial(); - volumetricMaterial.steps = 12; - volumetricMaterial.transparent = true; - volumetricMaterial.blending = THREE.AdditiveBlending; - - // Temporal dithering using Interleaved Gradient Noise (IGN) + Halton sequence - temporalOffset = uniform(0); - temporalRotation = uniform(0); - shaderTime = uniform(0); - - const temporalJitter2D = vec2(temporalOffset, temporalRotation); - volumetricMaterial.offsetNode = fract( - interleavedGradientNoise(screenCoordinate.add(temporalJitter2D.mul(100))).add(temporalOffset), - ); - volumetricMaterial.scatteringNode = Fn(({ positionRay }) => { - const timeScaled = vec3(shaderTime, 0, shaderTime.mul(0.3)); - - const sampleGrain = (scale, timeScale = 1) => - texture3D(noiseTexture3D, positionRay.add(timeScaled.mul(timeScale)).mul(scale).mod(1), 0).r.add(0.5); - - let density = sampleGrain(0.1); - density = density.mul(sampleGrain(0.05, 1)); - density = density.mul(sampleGrain(0.02, 2)); - - return smokeAmount.mix(1, density); - }); - - volumetricMesh = new THREE.Mesh(new THREE.BoxGeometry(20, 10, 20), volumetricMaterial); - volumetricMesh.receiveShadow = true; - volumetricMesh.position.y = 2; - scene.add(volumetricMesh); - - // Objects - - teapot = new THREE.Mesh( - new TeapotGeometry(0.8, 18), - new THREE.MeshStandardMaterial({ color: 0xffffff, side: THREE.DoubleSide }), - ); - teapot.castShadow = true; - scene.add(teapot); - - const floor = new THREE.Mesh( - new THREE.PlaneGeometry(100, 100), - new THREE.MeshStandardMaterial({ color: 0xffffff }), - ); - floor.rotation.x = -Math.PI / 2; - floor.position.y = -3; - floor.receiveShadow = true; - scene.add(floor); - - // Lights - - pointLight = new THREE.PointLight(0xf9bb50, 3, 100); - pointLight.castShadow = true; - pointLight.position.set(0, 1.4, 0); - scene.add(pointLight); - - spotLight = new THREE.SpotLight(0xffffff, 100); - spotLight.position.set(2.5, 5, 2.5); - spotLight.angle = Math.PI / 6; - spotLight.penumbra = 1; - spotLight.decay = 2; - spotLight.distance = 0; - spotLight.map = new THREE.TextureLoader().setPath('textures/').load('colors.png'); - spotLight.castShadow = true; - spotLight.shadow.intensity = 0.98; - spotLight.shadow.mapSize.width = 1024; - spotLight.shadow.mapSize.height = 1024; - spotLight.shadow.camera.near = 1; - spotLight.shadow.camera.far = 15; - spotLight.shadow.focus = 1; - scene.add(spotLight); - - // Render Pipeline - - renderPipeline = new THREE.RenderPipeline(renderer); - - const volumetricIntensity = uniform(1); - - // Pre-Pass: Opaque objects only (volumetric is transparent, excluded automatically) - - const prePass = depthPass(scene, camera); - prePass.name = 'Pre Pass'; - prePass.transparent = false; - - const prePassDepth = prePass.getTextureNode('depth').toInspector('Depth', () => prePass.getLinearDepthNode()); - - // Apply depth to volumetric material for proper occlusion - - volumetricMaterial.depthNode = prePassDepth.sample(screenUV); - - // Scene Pass: Full scene including volumetric with MRT - - const scenePass = pass(scene, camera).toInspector('Scene'); - scenePass.name = 'Scene Pass'; - scenePass.setMRT( - mrt({ - output: output, - velocity: velocity, - }), - ); - - const scenePassColor = scenePass.getTextureNode().toInspector('Output'); - const scenePassVelocity = scenePass.getTextureNode('velocity').toInspector('Velocity'); - - // TRAA with scene pass depth/velocity (includes volumetric) - - const traaPass = traa(scenePassColor, prePassDepth, scenePassVelocity, camera); - - renderPipeline.outputNode = traaPass; - - // GUI - - params = { - traa: true, - animated: true, - }; - - const gui = renderer.inspector.createParameters('Volumetric Lighting'); - - gui.add(params, 'animated'); - gui.add(params, 'traa').name('TRAA').onChange(updatePostProcessing); - - const rayMarching = gui.addFolder('Ray Marching'); - rayMarching.add(volumetricMaterial, 'steps', 2, 16, 1).name('step count'); - - function updatePostProcessing() { - renderPipeline.outputNode = params.traa ? traaPass : scenePassColor; - renderPipeline.needsUpdate = true; - } - - const lighting = gui.addFolder('Lighting / Scene'); - lighting.add(pointLight, 'intensity', 0, 6).name('light intensity'); - lighting.add(spotLight, 'intensity', 0, 200).name('spot intensity'); - lighting.add(volumetricIntensity, 'value', 0, 2).name('volumetric intensity'); - lighting.add(smokeAmount, 'value', 0, 3).name('smoke amount'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -let frameCount = 0; -let animationTime = 0; -let lastTime = performance.now(); - -function animate() { - const currentTime = performance.now(); - const delta = (currentTime - lastTime) * 0.001; - lastTime = currentTime; - - // Update temporal uniforms - synced with TRAA's Halton sequence for optimal accumulation - const haltonIndex = frameCount % 32; - temporalOffset.value = _haltonOffsets[haltonIndex][0]; - temporalRotation.value = _haltonOffsets[haltonIndex][1]; - frameCount++; - - if (params.animated) { - animationTime += delta; - } - - shaderTime.value = animationTime; - - const scale = 2.4; - - pointLight.position.x = Math.sin(animationTime * 0.7) * scale; - pointLight.position.y = Math.cos(animationTime * 0.5) * scale; - pointLight.position.z = Math.cos(animationTime * 0.3) * scale; - - spotLight.position.x = Math.cos(animationTime * 0.3) * scale; - spotLight.lookAt(0, 0, 0); - - teapot.rotation.y = animationTime * 0.2; - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_volume_perlin.ts b/examples-testing/examples/webgpu_volume_perlin.ts deleted file mode 100644 index eed45c392..000000000 --- a/examples-testing/examples/webgpu_volume_perlin.ts +++ /dev/null @@ -1,148 +0,0 @@ -import * as THREE from 'three/webgpu'; -import { Break, If, Loop, select, bool, vec3, vec4, texture3D, uniform, Fn } from 'three/tsl'; - -import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -const REFINEMENT_STEPS = 4; - -let renderer, scene, camera; -let mesh; - -init(); - -function init() { - renderer = new THREE.WebGPURenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 100); - camera.position.set(0, 0, 2); - - new OrbitControls(camera, renderer.domElement); - - // Texture - - const size = 128; - const data = new Uint8Array(size * size * size); - - let i = 0; - const perlin = new ImprovedNoise(); - const vector = new THREE.Vector3(); - - for (let z = 0; z < size; z++) { - for (let y = 0; y < size; y++) { - for (let x = 0; x < size; x++) { - vector.set(x, y, z).divideScalar(size); - - const d = perlin.noise(vector.x * 6.5, vector.y * 6.5, vector.z * 6.5); - - data[i++] = d * 128 + 128; - } - } - } - - const texture = new THREE.Data3DTexture(data, size, size, size); - texture.format = THREE.RedFormat; - texture.minFilter = THREE.LinearFilter; - texture.magFilter = THREE.LinearFilter; - texture.unpackAlignment = 1; - texture.needsUpdate = true; - - // Shader - - const opaqueRaymarchingTexture = Fn(({ texture, steps, threshold, refine }) => { - const finalColor = vec4(0).toVar(); - - const positionPrev = vec3(0).toVar(); - const hasPrev = bool(false).toVar(); - - RaymarchingBox(steps, ({ positionRay }) => { - const mapValue = texture.sample(positionRay.add(0.5)).r.toVar(); - - If(mapValue.greaterThan(threshold), () => { - const surfacePos = positionRay.toVar(); - - If(refine.and(hasPrev), () => { - // The surface lies between the previous sample (below the threshold) - // and the current one (above it). Bisect that interval to localize - // the crossing precisely. - - const p0 = positionPrev.toVar(); - const p1 = positionRay.toVar(); - - Loop(REFINEMENT_STEPS, () => { - const pm = p0.add(p1).mul(0.5).toConst(); - const dm = texture.sample(pm.add(0.5)).r.toConst(); - - const isGreater = dm.greaterThan(threshold); - - p1.assign(select(isGreater, pm, p1).uniformFlow()); - p0.assign(select(isGreater, p0, pm).uniformFlow()); - }); - - surfacePos.assign(p1); - }); - - const p = vec3(surfacePos).add(0.5); - - finalColor.rgb.assign(texture.normal(p).mul(0.5).add(surfacePos.mul(1.5).add(0.25))); - finalColor.a.assign(1); - Break(); - }); - - positionPrev.assign(positionRay); - hasPrev.assign(true); - }); - - return finalColor; - }); - - // - - const threshold = uniform(0.6); - const steps = uniform(200); - const refine = uniform(true); - - const material = new THREE.NodeMaterial(); - material.colorNode = opaqueRaymarchingTexture({ - texture: texture3D(texture, null, 0), - steps, - threshold, - refine, - }); - material.side = THREE.BackSide; - material.transparent = true; - - mesh = new THREE.Mesh(new THREE.BoxGeometry(1, 1, 1), material); - scene.add(mesh); - - // - - const gui = renderer.inspector.createParameters('Parameters'); - gui.add(threshold, 'value', 0, 1, 0.01).name('threshold'); - gui.add(steps, 'value', 0, 300, 1).name('steps'); - gui.add(refine, 'value').name('refine'); - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_water.ts b/examples-testing/examples/webgpu_water.ts deleted file mode 100644 index 7a6556618..000000000 --- a/examples-testing/examples/webgpu_water.ts +++ /dev/null @@ -1,199 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { pass, mrt, output, emissive, renderOutput } from 'three/tsl'; -import { bloom } from 'three/addons/tsl/display/BloomNode.js'; -import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; - -import { Inspector } from 'three/addons/inspector/Inspector.js'; - -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; - -import { WaterMesh } from 'three/addons/objects/Water2Mesh.js'; -import { DRACOLoader, DRACO_GLTF_CONFIG } from 'three/addons/loaders/DRACOLoader.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; - -let scene, camera, renderer, water, renderPipeline, controls; - -const params = { - color: '#99e0ff', - scale: 2, - flowX: 1, - flowY: 1, -}; - -init(); - -async function init() { - scene = new THREE.Scene(); - - const loader = new UltraHDRLoader(); - loader.load('textures/equirectangular/moonless_golf_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - texture.needsUpdate = true; - - scene.background = texture; - scene.environment = texture; - }); - - // camera - - camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 200); - camera.position.set(-20, 6, -30); - - // asset loading - - const dracoLoader = new DRACOLoader(); - dracoLoader.setDecoderPath(DRACO_GLTF_CONFIG); - - const gltfLoader = new GLTFLoader(); - gltfLoader.setDRACOLoader(dracoLoader); - - const textureLoader = new THREE.TextureLoader(); - - const [gltf, normalMap0, normalMap1] = await Promise.all([ - gltfLoader.loadAsync('models/gltf/pool.glb'), - textureLoader.loadAsync('textures/water/Water_1_M_Normal.jpg'), - textureLoader.loadAsync('textures/water/Water_2_M_Normal.jpg'), - ]); - - gltf.scene.position.z = 2; - gltf.scene.scale.setScalar(0.1); - scene.add(gltf.scene); - - // water - - normalMap0.wrapS = normalMap0.wrapT = THREE.RepeatWrapping; - normalMap1.wrapS = normalMap1.wrapT = THREE.RepeatWrapping; - - const waterGeometry = new THREE.PlaneGeometry(30, 40); - - water = new WaterMesh(waterGeometry, { - color: params.color, - scale: params.scale, - flowDirection: new THREE.Vector2(params.flowX, params.flowY), - normalMap0: normalMap0, - normalMap1: normalMap1, - }); - - water.position.set(0, 0.2, -2); - water.rotation.x = Math.PI * -0.5; - water.renderOrder = Infinity; - scene.add(water); - - // floor - - const floorGeometry = new THREE.PlaneGeometry(1, 1); - floorGeometry.rotateX(-Math.PI * 0.5); - const floorMaterial = new THREE.MeshStandardMaterial({ - color: 0x444444, - roughness: 1, - metalness: 0, - side: THREE.DoubleSide, - }); - - { - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.position.set(20, 0, 0); - floor.scale.set(15, 1, 80); - scene.add(floor); - } - - { - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.position.set(-20, 0, 0); - floor.scale.set(15, 1, 80); - scene.add(floor); - } - - { - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.position.set(0, 0, 30); - floor.scale.set(30, 1, 20); - scene.add(floor); - } - - { - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.position.set(0, 0, -30); - floor.scale.set(30, 1, 20); - scene.add(floor); - } - - // renderer - - renderer = new THREE.WebGPURenderer(); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setAnimationLoop(animate); - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 0.5; - renderer.inspector = new Inspector(); - document.body.appendChild(renderer.domElement); - - // postprocessing - - renderPipeline = new THREE.RenderPipeline(renderer); - renderPipeline.outputColorTransform = false; - - const scenePass = pass(scene, camera); - scenePass.setMRT( - mrt({ - output, - emissive, - }), - ); - - const beautyPass = scenePass.getTextureNode(); - const emissivePass = scenePass.getTextureNode('emissive'); - - const bloomPass = bloom(emissivePass, 2); - - const outputPass = renderOutput(beautyPass.add(bloomPass)); - - const fxaaPass = fxaa(outputPass); - renderPipeline.outputNode = fxaaPass; - - // gui - - const gui = renderer.inspector.createParameters('Water'); - const waterNode = water.material.colorNode; - - gui.addColor(params, 'color').onChange(function (value) { - waterNode.color.value.set(value); - }); - gui.add(params, 'scale', 1, 10).onChange(function (value) { - waterNode.scale.value = value; - }); - gui.add(params, 'flowX', -1, 1, 0.01).onChange(function (value) { - waterNode.flowDirection.value.x = value; - waterNode.flowDirection.value.normalize(); - }); - gui.add(params, 'flowY', -1, 1, 0.01).onChange(function (value) { - waterNode.flowDirection.value.y = value; - waterNode.flowDirection.value.normalize(); - }); - - // - - controls = new OrbitControls(camera, renderer.domElement); - controls.enableDamping = true; - controls.target.set(0, 0, -5); - controls.update(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - controls.update(); - - renderPipeline.render(); -} diff --git a/examples-testing/examples/webgpu_xr_cubes.ts b/examples-testing/examples/webgpu_xr_cubes.ts deleted file mode 100644 index c6d89c154..000000000 --- a/examples-testing/examples/webgpu_xr_cubes.ts +++ /dev/null @@ -1,242 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; -import { XRButton } from 'three/addons/webxr/XRButton.js'; -import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; -import { setupWebGLXRFallback } from 'three/addons/webxr/WebGLXRFallback.js'; - -const timer = new THREE.Timer(); -timer.connect(document); - -const rendererParameters = { antialias: true, outputBufferType: THREE.UnsignedByteType, multiview: true }; -const controllerModelFactory = new XRControllerModelFactory(); - -let container; -let camera, scene, raycaster, renderer, renderPipeline; - -let room; - -let controller, controllerGrip; -let INTERSECTED; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x505050); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(0, 1.6, 3); - scene.add(camera); - - room = new THREE.LineSegments( - new BoxLineGeometry(6, 6, 6, 10, 10, 10).translate(0, 3, 0), - new THREE.LineBasicMaterial({ color: 0xbcbcbc }), - ); - scene.add(room); - - scene.add(new THREE.HemisphereLight(0xa5a5a5, 0x898989, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(1, 1, 1).normalize(); - scene.add(light); - - const geometry = new THREE.BoxGeometry(0.15, 0.15, 0.15); - - for (let i = 0; i < 200; i++) { - const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); - - object.position.x = Math.random() * 4 - 2; - object.position.y = Math.random() * 4; - object.position.z = Math.random() * 4 - 2; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.x = Math.random() + 0.5; - object.scale.y = Math.random() + 0.5; - object.scale.z = Math.random() + 0.5; - - object.userData.velocity = new THREE.Vector3(); - object.userData.velocity.x = Math.random() * 0.01 - 0.005; - object.userData.velocity.y = Math.random() * 0.01 - 0.005; - object.userData.velocity.z = Math.random() * 0.01 - 0.005; - - room.add(object); - } - - raycaster = new THREE.Raycaster(); - - renderer = createRenderer(); - setRenderer(renderer); - setupWebGLXRFallback(renderer, () => createRenderer(true), setRenderer); - - // - - window.addEventListener('resize', onWindowResize); - - // - - document.body.appendChild(XRButton.createButton(renderer, { optionalFeatures: ['webgpu'] })); -} - -function createRenderer(forceWebGL = false) { - const parameters = { ...rendererParameters }; - - if (forceWebGL === true) parameters.forceWebGL = true; - - const renderer = new THREE.WebGPURenderer(parameters); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - - return renderer; -} - -function setRenderer(newRenderer, oldRenderer = null) { - if (controller !== undefined) scene.remove(controller); - if (controllerGrip !== undefined) scene.remove(controllerGrip); - - if (oldRenderer === null) { - container.appendChild(newRenderer.domElement); - } else { - container.replaceChild(newRenderer.domElement, oldRenderer.domElement); - oldRenderer.dispose(); - } - - renderer = newRenderer; - renderPipeline = new THREE.DirectRenderPipeline(renderer); - setupControllers(); -} - -function setupControllers() { - controller = renderer.xr.getController(0); - controller.addEventListener('selectstart', onSelectStart); - controller.addEventListener('selectend', onSelectEnd); - controller.addEventListener('connected', function (event) { - const targetRayMode = event.data.targetRayMode; - - if (targetRayMode === 'tracked-pointer' || targetRayMode === 'gaze') { - this.add(buildController(event.data)); - } - }); - controller.addEventListener('disconnected', function () { - this.remove(this.children[0]); - }); - scene.add(controller); - - controllerGrip = renderer.xr.getControllerGrip(0); - controllerGrip.add(controllerModelFactory.createControllerModel(controllerGrip)); - scene.add(controllerGrip); -} - -function onSelectStart() { - this.userData.isSelecting = true; -} - -function onSelectEnd() { - this.userData.isSelecting = false; -} - -function buildController(data) { - let geometry, material; - - switch (data.targetRayMode) { - case 'tracked-pointer': - geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 0, 0, -1], 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute([0.5, 0.5, 0.5, 0, 0, 0], 3)); - - material = new THREE.LineBasicMaterial({ vertexColors: true, blending: THREE.AdditiveBlending }); - - return new THREE.Line(geometry, material); - - case 'gaze': - geometry = new THREE.RingGeometry(0.02, 0.04, 32).translate(0, 0, -1); - material = new THREE.MeshBasicMaterial({ opacity: 0.5, transparent: true }); - return new THREE.Mesh(geometry, material); - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - timer.update(); - - const delta = timer.getDelta() * 60; - - if (controller.userData.isSelecting === true) { - const cube = room.children[0]; - room.remove(cube); - - cube.position.copy(controller.position); - cube.userData.velocity.x = (Math.random() - 0.5) * 0.02 * delta; - cube.userData.velocity.y = (Math.random() - 0.5) * 0.02 * delta; - cube.userData.velocity.z = (Math.random() * 0.01 - 0.05) * delta; - cube.userData.velocity.applyQuaternion(controller.quaternion); - room.add(cube); - } - - // find intersections - - raycaster.setFromXRController(controller); - - const intersects = raycaster.intersectObjects(room.children, false); - - if (intersects.length > 0) { - if (INTERSECTED != intersects[0].object) { - if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); - - INTERSECTED = intersects[0].object; - INTERSECTED.currentHex = INTERSECTED.material.emissive.getHex(); - INTERSECTED.material.emissive.setHex(0xff0000); - } - } else { - if (INTERSECTED) INTERSECTED.material.emissive.setHex(INTERSECTED.currentHex); - - INTERSECTED = undefined; - } - - // Keep cubes inside room - - for (let i = 0; i < room.children.length; i++) { - const cube = room.children[i]; - - cube.userData.velocity.multiplyScalar(1 - 0.001 * delta); - - cube.position.add(cube.userData.velocity); - - if (cube.position.x < -3 || cube.position.x > 3) { - cube.position.x = THREE.MathUtils.clamp(cube.position.x, -3, 3); - cube.userData.velocity.x = -cube.userData.velocity.x; - } - - if (cube.position.y < 0 || cube.position.y > 6) { - cube.position.y = THREE.MathUtils.clamp(cube.position.y, 0, 6); - cube.userData.velocity.y = -cube.userData.velocity.y; - } - - if (cube.position.z < -3 || cube.position.z > 3) { - cube.position.z = THREE.MathUtils.clamp(cube.position.z, -3, 3); - cube.userData.velocity.z = -cube.userData.velocity.z; - } - - cube.rotation.x += cube.userData.velocity.x * 2 * delta; - cube.rotation.y += cube.userData.velocity.y * 2 * delta; - cube.rotation.z += cube.userData.velocity.z * 2 * delta; - } - - renderPipeline.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_xr_native_layers.ts b/examples-testing/examples/webgpu_xr_native_layers.ts deleted file mode 100644 index a93accfc8..000000000 --- a/examples-testing/examples/webgpu_xr_native_layers.ts +++ /dev/null @@ -1,637 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; -import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; -import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js'; -import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; -import { - RollerCoasterGeometry, - RollerCoasterShadowGeometry, - RollerCoasterLiftersGeometry, - TreesGeometry, - SkyGeometry, -} from 'three/addons/misc/RollerCoaster.js'; -import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; - -let camera, scene, renderer, renderPipeline; -let controller1, controller2; -let controllerGrip1, controllerGrip2; - -let room; - -let count = 0; -const radius = 0.08; -let normal = new THREE.Vector3(); -const relativeVelocity = new THREE.Vector3(); - -const timer = new THREE.Timer(); -timer.connect(document); -const funfairs = []; -const train = new THREE.Object3D(); -const rcdelta = timer.getDelta() * 0.8; // slow down simulation -const PI2 = Math.PI * 2; -let rccamera = null; -let rcscene = null; - -const tempMatrix = new THREE.Matrix4(); -let raycaster = null; - -const curve = (function () { - const vector = new THREE.Vector3(); - const vector2 = new THREE.Vector3(); - - return { - getPointAt: function (t) { - t = t * PI2; - - const x = Math.sin(t * 3) * Math.cos(t * 4) * 50; - const y = Math.sin(t * 10) * 2 + Math.cos(t * 17) * 2 + 5; - const z = Math.sin(t) * Math.sin(t * 4) * 50; - - return vector.set(x, y, z).multiplyScalar(2); - }, - - getTangentAt: function (t) { - const delta = 0.0001; - const t1 = Math.max(0, t - delta); - const t2 = Math.min(1, t + delta); - - return vector2.copy(this.getPointAt(t2)).sub(this.getPointAt(t1)).normalize(); - }, - }; -})(); - -let horseCamera = null; -let horseScene = null; -let horseMixer = null; -let horseTheta = 0; -let horseMesh = null; -const horseRadius = 600; - -let guiScene = null; -let guiCamera = null; -let guiGroup = null; - -let rollercoasterLayer = null; -let horseLayer = null; -let guiLayer = null; - -const parameters = { - radius: 0.6, - tube: 0.2, - tubularSegments: 150, - radialSegments: 20, - p: 2, - q: 3, - thickness: 0.5, -}; - -init(); - -function getIntersections(controller) { - tempMatrix.identity().extractRotation(controller.matrixWorld); - - raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld); - raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix); - - return raycaster.intersectObjects(scene.children, false); -} - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x505050); - - raycaster = new THREE.Raycaster(); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(0, 1.6, 3); - - room = new THREE.LineSegments( - new BoxLineGeometry(6, 6, 6, 10, 10, 10), - new THREE.LineBasicMaterial({ color: 0x808080 }), - ); - room.geometry.translate(0, 3, 0); - scene.add(room); - - scene.add(new THREE.HemisphereLight(0x606060, 0x404040)); - - const light = new THREE.DirectionalLight(0xffffff); - light.position.set(1, 1, 1).normalize(); - scene.add(light); - - const geometry = new THREE.IcosahedronGeometry(radius, 3); - - for (let i = 0; i < 200; i++) { - const object = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial({ color: Math.random() * 0xffffff })); - - object.position.x = Math.random() * 4 - 2; - object.position.y = Math.random() * 4; - object.position.z = Math.random() * 4 - 2; - - object.userData.velocity = new THREE.Vector3(); - object.userData.velocity.x = Math.random() * 0.01 - 0.005; - object.userData.velocity.y = Math.random() * 0.01 - 0.005; - object.userData.velocity.z = Math.random() * 0.01 - 0.005; - - room.add(object); - } - - // - - renderer = new THREE.WebGPURenderer({ - antialias: true, - forceWebGL: true, - outputBufferType: THREE.UnsignedByteType, - multiview: true, - }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - document.body.appendChild(renderer.domElement); - renderer.setAnimationLoop(render); - renderer.xr.enabled = true; - renderPipeline = new THREE.DirectRenderPipeline(renderer); - - // - - document.body.appendChild(VRButton.createButton(renderer)); - - // controllers - - function onSqueezeStart() { - this.userData.isSelecting = true; - } - - function onSqueezeEnd() { - this.userData.isSelecting = false; - } - - function onSelectStart(event) { - const controller = event.target; - - const intersections = getIntersections(controller); - let hadSelection = false; - - for (let x = 0; x < intersections.length; x++) { - if (intersections[x].object == horseLayer) { - horseLayer.visible = false; - hadSelection = true; - } - - if (intersections[x].object == rollercoasterLayer) { - controller.attach(rollercoasterLayer); - hadSelection = true; - } - - if (intersections[x].object == guiLayer) { - const uv = intersections[x].uv; - guiGroup.children[0].dispatchEvent({ - type: 'mousedown', - data: { x: uv.x, y: 1 - uv.y }, - target: guiGroup, - }); - hadSelection = true; - } - } - - this.userData.isSelecting = hadSelection === false; - } - - function onSelectEnd() { - horseLayer.visible = true; - scene.attach(rollercoasterLayer); - guiGroup.children[0].dispatchEvent({ type: 'mouseup', data: { x: 0, y: 0 }, target: guiGroup }); - this.userData.isSelecting = false; - } - - controller1 = renderer.xr.getController(0); - controller1.addEventListener('selectstart', onSelectStart); - controller1.addEventListener('selectend', onSelectEnd); - controller1.addEventListener('squeezestart', onSqueezeStart); - controller1.addEventListener('squeezeend', onSqueezeEnd); - controller1.addEventListener('connected', function (event) { - this.add(buildController(event.data)); - }); - controller1.addEventListener('disconnected', function () { - this.remove(this.children[0]); - }); - scene.add(controller1); - - controller2 = renderer.xr.getController(1); - controller2.addEventListener('selectstart', onSelectStart); - controller2.addEventListener('selectend', onSelectEnd); - controller2.addEventListener('squeezestart', onSqueezeStart); - controller2.addEventListener('squeezeend', onSqueezeEnd); - controller2.addEventListener('connected', function (event) { - this.add(buildController(event.data)); - }); - controller2.addEventListener('disconnected', function () { - this.remove(this.children[0]); - }); - scene.add(controller2); - - // The XRControllerModelFactory will automatically fetch controller models - // that match what the user is holding as closely as possible. The models - // should be attached to the object returned from getControllerGrip in - // order to match the orientation of the held device. - - const controllerModelFactory = new XRControllerModelFactory(); - - controllerGrip1 = renderer.xr.getControllerGrip(0); - controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); - scene.add(controllerGrip1); - - controllerGrip2 = renderer.xr.getControllerGrip(1); - controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); - scene.add(controllerGrip2); - - // - - window.addEventListener('resize', onWindowResize); - - // set up rollercoaster - rollercoasterLayer = renderer.xr.createCylinderLayer( - 1, - Math.PI / 2, - 2, - new THREE.Vector3(0, 1.5, -0.5), - new THREE.Quaternion(), - 1500, - 1000, - renderRollercoaster, - ); - scene.add(rollercoasterLayer); - - rcscene = new THREE.Scene(); - rcscene.background = new THREE.Color(0xf0f0ff); - - const rclight = new THREE.HemisphereLight(0xfff0f0, 0x606066); - rclight.position.set(1, 1, 1); - rcscene.add(rclight); - - rcscene.add(train); - - rccamera = new THREE.PerspectiveCamera(50, 1, 0.1, 500); - train.add(rccamera); - - // environment - - let rcgeometry = new THREE.PlaneGeometry(500, 500, 15, 15); - rcgeometry.rotateX(-Math.PI / 2); - - const positions = rcgeometry.attributes.position.array; - const vertex = new THREE.Vector3(); - - for (let i = 0; i < positions.length; i += 3) { - vertex.fromArray(positions, i); - - vertex.x += Math.random() * 10 - 5; - vertex.z += Math.random() * 10 - 5; - - const distance = vertex.distanceTo(scene.position) / 5 - 25; - vertex.y = Math.random() * Math.max(0, distance); - - vertex.toArray(positions, i); - } - - rcgeometry.computeVertexNormals(); - - let rcmaterial = new THREE.MeshLambertMaterial({ - color: 0x407000, - }); - - let rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcscene.add(rcmesh); - - rcgeometry = new TreesGeometry(rcmesh); - rcmaterial = new THREE.MeshBasicMaterial({ - side: THREE.DoubleSide, - vertexColors: true, - }); - rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcscene.add(rcmesh); - - rcgeometry = new SkyGeometry(); - rcmaterial = new THREE.MeshBasicMaterial({ color: 0xffffff }); - rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcscene.add(rcmesh); - - // - - rcgeometry = new RollerCoasterGeometry(curve, 1500); - rcmaterial = new THREE.MeshPhongMaterial({ - vertexColors: true, - }); - rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcscene.add(rcmesh); - - rcgeometry = new RollerCoasterLiftersGeometry(curve, 100); - rcmaterial = new THREE.MeshPhongMaterial(); - rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcmesh.position.y = 0.1; - rcscene.add(rcmesh); - - rcgeometry = new RollerCoasterShadowGeometry(curve, 500); - rcmaterial = new THREE.MeshBasicMaterial({ - color: 0x305000, - depthWrite: false, - transparent: true, - }); - rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcmesh.position.y = 0.1; - rcscene.add(rcmesh); - - // - - rcgeometry = new THREE.CylinderGeometry(10, 10, 5, 15); - rcmaterial = new THREE.MeshLambertMaterial({ - color: 0xff8080, - }); - rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcmesh.position.set(-80, 10, -70); - rcmesh.rotation.x = Math.PI / 2; - rcscene.add(rcmesh); - - funfairs.push(rcmesh); - - rcgeometry = new THREE.CylinderGeometry(5, 6, 4, 10); - rcmaterial = new THREE.MeshLambertMaterial({ - color: 0x8080ff, - }); - rcmesh = new THREE.Mesh(rcgeometry, rcmaterial); - rcmesh.position.set(50, 2, 30); - rcscene.add(rcmesh); - - funfairs.push(rcmesh); - - // set up horse animation - horseLayer = renderer.xr.createQuadLayer( - 1, - 1, - new THREE.Vector3(-1.5, 1.5, -1.5), - new THREE.Quaternion(), - 800, - 800, - renderQuad, - ); - scene.add(horseLayer); - - horseLayer.geometry = new THREE.CircleGeometry(0.5, 64); - - horseCamera = new THREE.PerspectiveCamera(50, 1, 1, 10000); - horseCamera.position.y = 300; - - horseScene = new THREE.Scene(); - horseScene.background = new THREE.Color(0xf0f0f0); - - // - - const light1 = new THREE.DirectionalLight(0xefefff, 1.5); - light1.position.set(1, 1, 1).normalize(); - horseScene.add(light1); - - const light2 = new THREE.DirectionalLight(0xffefef, 1.5); - light2.position.set(-1, -1, -1).normalize(); - horseScene.add(light2); - - const loader = new GLTFLoader(); - loader.load('models/gltf/Horse.glb', function (gltf) { - horseMesh = gltf.scene.children[0]; - horseMesh.scale.set(1.5, 1.5, 1.5); - horseScene.add(horseMesh); - - horseMixer = new THREE.AnimationMixer(horseMesh); - - horseMixer.clipAction(gltf.animations[0]).setDuration(1).play(); - }); - - function onChange() {} - - function onThicknessChange() {} - - // set up ui - guiScene = new THREE.Scene(); - guiScene.background = new THREE.Color(0x0); - - guiCamera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1); - guiScene.add(guiCamera); - - const gui = new GUI({ width: 300 }); - gui.add(parameters, 'radius', 0.0, 1.0).onChange(onChange); - gui.add(parameters, 'tube', 0.0, 1.0).onChange(onChange); - gui.add(parameters, 'tubularSegments', 10, 150, 1).onChange(onChange); - gui.add(parameters, 'radialSegments', 2, 20, 1).onChange(onChange); - gui.add(parameters, 'p', 1, 10, 1).onChange(onChange); - gui.add(parameters, 'q', 0, 10, 1).onChange(onChange); - gui.add(parameters, 'thickness', 0, 1).onChange(onThicknessChange); - gui.domElement.style.visibility = 'hidden'; - - guiGroup = new InteractiveGroup(); - guiScene.add(guiGroup); - - const mesh = new HTMLMesh(gui.domElement); - guiGroup.add(mesh); - - const bbox = new THREE.Box3().setFromObject(guiScene); - - guiLayer = renderer.xr.createQuadLayer( - 1.2, - 0.8, - new THREE.Vector3(1.5, 1.5, -1.5), - new THREE.Quaternion(), - 1280, - 800, - renderGui, - ); - scene.add(guiLayer); - - guiCamera.left = bbox.min.x; - guiCamera.right = bbox.max.x; - guiCamera.top = bbox.max.y; - guiCamera.bottom = bbox.min.y; - guiCamera.updateProjectionMatrix(); -} - -function renderGui() { - renderer.render(guiScene, guiCamera); -} - -function renderQuad() { - horseTheta += 0.1; - - horseCamera.position.x = horseRadius * Math.sin(THREE.MathUtils.degToRad(horseTheta)); - horseCamera.position.z = horseRadius * Math.cos(THREE.MathUtils.degToRad(horseTheta)); - - horseCamera.lookAt(0, 150, 0); - - if (horseMixer) { - const time = Date.now(); - - horseMixer.update((time - prevTime) * 0.001); - - prevTime = time; - } - - renderer.render(horseScene, horseCamera); -} - -const rcposition = new THREE.Vector3(); -const tangent = new THREE.Vector3(); - -const lookAt = new THREE.Vector3(); - -let rcvelocity = 0; -let progress = 0; - -let prevTime = performance.now(); - -function renderRollercoaster() { - const time = performance.now(); - for (let i = 0; i < funfairs.length; i++) { - funfairs[i].rotation.y = time * 0.0004; - } - - // - - progress += rcvelocity; - progress = progress % 1; - - rcposition.copy(curve.getPointAt(progress)); - rcposition.y += 0.3; - - train.position.copy(rcposition); - - tangent.copy(curve.getTangentAt(progress)); - - rcvelocity -= tangent.y * 0.0000001 * rcdelta; - rcvelocity = Math.max(0.00004, Math.min(0.0002, rcvelocity)); - - train.lookAt(lookAt.copy(rcposition).sub(tangent)); - - // - - renderer.render(rcscene, rccamera); -} - -function buildController(data) { - let geometry, material; - - switch (data.targetRayMode) { - case 'tracked-pointer': - geometry = new THREE.BufferGeometry(); - geometry.setAttribute('position', new THREE.Float32BufferAttribute([0, 0, 0, 0, 0, -1], 3)); - geometry.setAttribute('color', new THREE.Float32BufferAttribute([0.5, 0.5, 0.5, 0, 0, 0], 3)); - - material = new THREE.LineBasicMaterial({ vertexColors: true, blending: THREE.AdditiveBlending }); - - return new THREE.Line(geometry, material); - - case 'gaze': - geometry = new THREE.RingGeometry(0.02, 0.04, 32).translate(0, 0, -1); - material = new THREE.MeshBasicMaterial({ opacity: 0.5, transparent: true }); - return new THREE.Mesh(geometry, material); - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function handleController(controller) { - if (controller.userData.isSelecting) { - const object = room.children[count++]; - - object.position.copy(controller.position); - object.userData.velocity.x = (Math.random() - 0.5) * 3; - object.userData.velocity.y = (Math.random() - 0.5) * 3; - object.userData.velocity.z = Math.random() - 9; - object.userData.velocity.applyQuaternion(controller.quaternion); - - if (count === room.children.length) count = 0; - } - - const intersections = getIntersections(controller); - for (let x = 0; x < intersections.length; x++) { - if (intersections[x].object == guiLayer) { - const uv = intersections[x].uv; - guiGroup.children[0].dispatchEvent({ type: 'mousemove', data: { x: uv.x, y: 1 - uv.y }, target: guiGroup }); - } - } -} - -// - -function render() { - timer.update(); - - handleController(controller1); - handleController(controller2); - - // rotate horse - horseLayer.rotation.y -= 0.02; - - // - const delta = timer.getDelta() * 0.8; - - const range = 3 - radius; - - for (let i = 0; i < room.children.length; i++) { - const object = room.children[i]; - - object.position.x += object.userData.velocity.x * delta; - object.position.y += object.userData.velocity.y * delta; - object.position.z += object.userData.velocity.z * delta; - - // keep objects inside room - - if (object.position.x < -range || object.position.x > range) { - object.position.x = THREE.MathUtils.clamp(object.position.x, -range, range); - object.userData.velocity.x = -object.userData.velocity.x; - } - - if (object.position.y < radius || object.position.y > 6) { - object.position.y = Math.max(object.position.y, radius); - - object.userData.velocity.x *= 0.98; - object.userData.velocity.y = -object.userData.velocity.y * 0.8; - object.userData.velocity.z *= 0.98; - } - - if (object.position.z < -range || object.position.z > range) { - object.position.z = THREE.MathUtils.clamp(object.position.z, -range, range); - object.userData.velocity.z = -object.userData.velocity.z; - } - - for (let j = i + 1; j < room.children.length; j++) { - const object2 = room.children[j]; - - normal.copy(object.position).sub(object2.position); - - const distance = normal.length(); - - if (distance < 2 * radius) { - normal.multiplyScalar(0.5 * distance - radius); - - object.position.sub(normal); - object2.position.add(normal); - - normal.normalize(); - - relativeVelocity.copy(object.userData.velocity).sub(object2.userData.velocity); - - normal = normal.multiplyScalar(relativeVelocity.dot(normal)); - - object.userData.velocity.sub(normal); - object2.userData.velocity.add(normal); - } - } - - object.userData.velocity.y -= 9.8 * delta; - } - - renderPipeline.render(scene, camera); -} diff --git a/examples-testing/examples/webgpu_xr_rollercoaster.ts b/examples-testing/examples/webgpu_xr_rollercoaster.ts deleted file mode 100644 index 4c4998ce1..000000000 --- a/examples-testing/examples/webgpu_xr_rollercoaster.ts +++ /dev/null @@ -1,259 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { - RollerCoasterGeometry, - RollerCoasterShadowGeometry, - RollerCoasterLiftersGeometry, - TreesGeometry, - SkyGeometry, -} from 'three/addons/misc/RollerCoaster.js'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; -import { setupWebGLXRFallback } from 'three/addons/webxr/WebGLXRFallback.js'; - -let mesh, material, geometry; -let renderer, renderPipeline; - -const rendererParameters = { antialias: true, outputBufferType: THREE.UnsignedByteType, multiview: false }; - -renderer = createRenderer(); -setRenderer(renderer); -setupWebGLXRFallback(renderer, () => createRenderer(true), setRenderer); - -document.body.appendChild(VRButton.createButton(renderer, { optionalFeatures: ['webgpu'] })); - -// - -function createRenderer(forceWebGL = false) { - const parameters = { ...rendererParameters }; - - if (forceWebGL === true) parameters.forceWebGL = true; - - const renderer = new THREE.WebGPURenderer(parameters); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - renderer.xr.setReferenceSpaceType('local'); - - return renderer; -} - -function setRenderer(newRenderer, oldRenderer = null) { - if (oldRenderer === null) { - document.body.appendChild(newRenderer.domElement); - } else { - document.body.replaceChild(newRenderer.domElement, oldRenderer.domElement); - oldRenderer.dispose(); - } - - renderer = newRenderer; - renderPipeline = new THREE.DirectRenderPipeline(renderer); -} - -const scene = new THREE.Scene(); -scene.background = new THREE.Color(0xf0f0ff); - -const light = new THREE.HemisphereLight(0xfff0f0, 0x60606, 3); -light.position.set(1, 1, 1); -scene.add(light); - -const train = new THREE.Object3D(); -scene.add(train); - -const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 500); -train.add(camera); - -// environment - -geometry = new THREE.PlaneGeometry(500, 500, 15, 15); -geometry.rotateX(-Math.PI / 2); - -const positions = geometry.attributes.position.array; -const vertex = new THREE.Vector3(); - -for (let i = 0; i < positions.length; i += 3) { - vertex.fromArray(positions, i); - - vertex.x += Math.random() * 10 - 5; - vertex.z += Math.random() * 10 - 5; - - const distance = vertex.distanceTo(scene.position) / 5 - 25; - vertex.y = Math.random() * Math.max(0, distance); - - vertex.toArray(positions, i); -} - -geometry.computeVertexNormals(); - -material = new THREE.MeshLambertMaterial({ - color: 0x407000, -}); - -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -geometry = new TreesGeometry(mesh); -material = new THREE.MeshBasicMaterial({ - side: THREE.DoubleSide, - vertexColors: true, -}); -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -geometry = new SkyGeometry(); -material = new THREE.MeshBasicMaterial({ color: 0xffffff }); -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -// - -const PI2 = Math.PI * 2; - -const curve = (function () { - const vector = new THREE.Vector3(); - const vector2 = new THREE.Vector3(); - - return { - getPointAt: function (t) { - t = t * PI2; - - const x = Math.sin(t * 3) * Math.cos(t * 4) * 50; - const y = Math.sin(t * 10) * 2 + Math.cos(t * 17) * 2 + 5; - const z = Math.sin(t) * Math.sin(t * 4) * 50; - - return vector.set(x, y, z).multiplyScalar(2); - }, - - getTangentAt: function (t) { - const delta = 0.0001; - const t1 = Math.max(0, t - delta); - const t2 = Math.min(1, t + delta); - - return vector2.copy(this.getPointAt(t2)).sub(this.getPointAt(t1)).normalize(); - }, - }; -})(); - -geometry = new RollerCoasterGeometry(curve, 1500); -material = new THREE.MeshPhongMaterial({ - vertexColors: true, -}); -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -geometry = new RollerCoasterLiftersGeometry(curve, 100); -material = new THREE.MeshPhongMaterial(); -mesh = new THREE.Mesh(geometry, material); -mesh.position.y = 0.1; -scene.add(mesh); - -geometry = new RollerCoasterShadowGeometry(curve, 500); -material = new THREE.MeshBasicMaterial({ - color: 0x305000, - depthWrite: false, - transparent: true, -}); -mesh = new THREE.Mesh(geometry, material); -mesh.position.y = 0.1; -scene.add(mesh); - -const funfairs = []; - -// - -geometry = new THREE.CylinderGeometry(10, 10, 5, 15); -material = new THREE.MeshLambertMaterial({ - color: 0xff8080, -}); -mesh = new THREE.Mesh(geometry, material); -mesh.position.set(-80, 10, -70); -mesh.rotation.x = Math.PI / 2; -scene.add(mesh); - -funfairs.push(mesh); - -geometry = new THREE.CylinderGeometry(5, 6, 4, 10); -material = new THREE.MeshLambertMaterial({ - color: 0x8080ff, -}); -mesh = new THREE.Mesh(geometry, material); -mesh.position.set(50, 2, 30); -scene.add(mesh); - -funfairs.push(mesh); - -// - -window.addEventListener('resize', onWindowResize); - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -const position = new THREE.Vector3(); -const tangent = new THREE.Vector3(); - -const lookAt = new THREE.Vector3(); - -const tangent1 = new THREE.Vector3(); -const tangent2 = new THREE.Vector3(); -const bankQuaternion = new THREE.Quaternion(); - -let velocity = 0; -let progress = 0; - -let prevTime = performance.now(); - -function animate() { - const time = performance.now(); - const delta = time - prevTime; - - for (let i = 0; i < funfairs.length; i++) { - funfairs[i].rotation.y = time * 0.0004; - } - - // - - progress += velocity; - progress = progress % 1; - - position.copy(curve.getPointAt(progress)); - position.y += 0.3; - - train.position.copy(position); - - tangent.copy(curve.getTangentAt(progress)); - - velocity -= tangent.y * 0.0000001 * delta; - velocity = Math.max(0.00004, Math.min(0.0002, velocity)); - - // banking - - const bankDelta = 0.01; - const t1 = (((progress - bankDelta) % 1) + 1) % 1; - const t2 = (progress + bankDelta) % 1; - - tangent1.copy(curve.getTangentAt(t1)); - tangent2.copy(curve.getTangentAt(t2)); - - let headingChange = Math.atan2(tangent2.x, tangent2.z) - Math.atan2(tangent1.x, tangent1.z); - if (headingChange > Math.PI) headingChange -= Math.PI * 2; - if (headingChange < -Math.PI) headingChange += Math.PI * 2; - - train.up.set(0, 1, 0); - bankQuaternion.setFromAxisAngle(tangent, -Math.atan(headingChange * 8) * 0.5); - train.up.applyQuaternion(bankQuaternion); - - train.lookAt(lookAt.copy(position).sub(tangent)); - - // - - renderPipeline.render(scene, camera); - - prevTime = time; -} diff --git a/examples-testing/examples/webgpu_xr_shadows.ts b/examples-testing/examples/webgpu_xr_shadows.ts deleted file mode 100644 index c3d948e33..000000000 --- a/examples-testing/examples/webgpu_xr_shadows.ts +++ /dev/null @@ -1,195 +0,0 @@ -import * as THREE from 'three/webgpu'; - -import { VRButton } from 'three/addons/webxr/VRButton.js'; -import { setupWebGLXRFallback } from 'three/addons/webxr/WebGLXRFallback.js'; - -const rendererParameters = { antialias: true, outputBufferType: THREE.UnsignedByteType, multiview: false }; -const timer = new THREE.Timer(); -timer.connect(document); - -let camera, cameraRig, scene, renderer; -let directionalLight, torusKnot, box, icosahedron, cone, glass; - -init(); - -function init() { - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x24282f); - scene.fog = new THREE.Fog(0x24282f, 8, 16); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 30); - camera.position.y = 1.6; - - cameraRig = new THREE.Group(); - cameraRig.position.z = 4; - cameraRig.add(camera); - scene.add(cameraRig); - - // lights - - scene.add(new THREE.HemisphereLight(0xb8c5df, 0x3c3028, 1.5)); - - directionalLight = new THREE.DirectionalLight(0xfff1d6, 4); - directionalLight.position.set(-4, 6, 2); - directionalLight.castShadow = true; - directionalLight.shadow.camera.near = 0.1; - directionalLight.shadow.camera.far = 15; - directionalLight.shadow.camera.left = -5; - directionalLight.shadow.camera.right = 5; - directionalLight.shadow.camera.top = 5; - directionalLight.shadow.camera.bottom = -5; - directionalLight.shadow.mapSize.set(2048, 2048); - directionalLight.shadow.bias = -0.0005; - scene.add(directionalLight); - scene.add(directionalLight.target); - - // environment - - const floor = new THREE.Mesh( - new THREE.PlaneGeometry(14, 14), - new THREE.MeshStandardMaterial({ color: 0x73786f, roughness: 0.9 }), - ); - floor.rotation.x = -Math.PI / 2; - floor.receiveShadow = true; - scene.add(floor); - - const platform = new THREE.Mesh( - new THREE.CylinderGeometry(1.25, 1.4, 0.3, 64), - new THREE.MeshStandardMaterial({ color: 0x40464d, roughness: 0.6, metalness: 0.2 }), - ); - platform.position.y = 0.15; - platform.castShadow = true; - platform.receiveShadow = true; - scene.add(platform); - - // shadow casters - - torusKnot = new THREE.Mesh( - new THREE.TorusKnotGeometry(0.55, 0.18, 128, 24), - new THREE.MeshStandardMaterial({ color: 0xe7ad52, roughness: 0.25, metalness: 0.35 }), - ); - torusKnot.position.y = 1.35; - torusKnot.castShadow = true; - torusKnot.receiveShadow = true; - scene.add(torusKnot); - - box = new THREE.Mesh( - new THREE.BoxGeometry(0.7, 0.7, 0.7), - new THREE.MeshStandardMaterial({ color: 0xd85f50, roughness: 0.5 }), - ); - box.position.set(-1.8, 0.6, 0.25); - box.rotation.set(0.2, 0.4, 0.1); - box.castShadow = true; - box.receiveShadow = true; - scene.add(box); - - icosahedron = new THREE.Mesh( - new THREE.IcosahedronGeometry(0.5, 2), - new THREE.MeshStandardMaterial({ color: 0x4f91b8, roughness: 0.35, metalness: 0.15 }), - ); - icosahedron.position.set(1.8, 0.7, 0.1); - icosahedron.castShadow = true; - icosahedron.receiveShadow = true; - scene.add(icosahedron); - - cone = new THREE.Mesh( - new THREE.ConeGeometry(0.5, 1.1, 48), - new THREE.MeshStandardMaterial({ color: 0x68a66b, roughness: 0.65 }), - ); - cone.position.set(0, 0.55, -2); - cone.castShadow = true; - cone.receiveShadow = true; - scene.add(cone); - - // transmission - - glass = new THREE.Mesh( - new THREE.IcosahedronGeometry(0.65, 4), - new THREE.MeshPhysicalMaterial({ - color: 0xb9e7ff, - roughness: 0.05, - metalness: 0, - transmission: 1, - thickness: 0.9, - ior: 1.45, - attenuationColor: 0x72b5d4, - attenuationDistance: 3, - specularIntensity: 1, - side: THREE.DoubleSide, - }), - ); - glass.position.set(0.9, 1.15, 1.2); - glass.castShadow = true; - glass.receiveShadow = true; - scene.add(glass); - - // renderer - - renderer = createRenderer(); - setRenderer(renderer); - setupWebGLXRFallback(renderer, () => createRenderer(true), setRenderer); - - document.body.appendChild(VRButton.createButton(renderer, { optionalFeatures: ['webgpu'] })); - - window.addEventListener('resize', onWindowResize); -} - -function createRenderer(forceWebGL = false) { - const parameters = { ...rendererParameters }; - - if (forceWebGL === true) parameters.forceWebGL = true; - - const renderer = new THREE.WebGPURenderer(parameters); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.shadowMap.type = THREE.PCFShadowMap; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1.2; - renderer.xr.enabled = true; - - return renderer; -} - -function setRenderer(newRenderer, oldRenderer = null) { - if (oldRenderer === null) { - document.body.appendChild(newRenderer.domElement); - } else { - document.body.replaceChild(newRenderer.domElement, oldRenderer.domElement); - oldRenderer.dispose(); - } - - renderer = newRenderer; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - const elapsed = timer.getElapsed(); - const delta = timer.getDelta(); - - torusKnot.position.y = 1.35 + Math.sin(elapsed * 1.5) * 0.15; - torusKnot.rotation.x += delta * 0.35; - torusKnot.rotation.y += delta * 0.7; - - box.rotation.y += delta * 0.4; - icosahedron.rotation.x += delta * 0.3; - icosahedron.rotation.y -= delta * 0.5; - cone.rotation.y -= delta * 0.35; - glass.position.y = 1.15 + Math.sin(elapsed * 1.1) * 0.08; - glass.rotation.x -= delta * 0.2; - glass.rotation.y += delta * 0.3; - - directionalLight.position.x = Math.cos(elapsed * 0.25) * 4; - directionalLight.position.z = Math.sin(elapsed * 0.25) * 4; - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_ar_cones.ts b/examples-testing/examples/webxr_ar_cones.ts deleted file mode 100644 index 95eb34393..000000000 --- a/examples-testing/examples/webxr_ar_cones.ts +++ /dev/null @@ -1,66 +0,0 @@ -import * as THREE from 'three'; -import { ARButton } from 'three/addons/webxr/ARButton.js'; - -let camera, scene, renderer; -let controller; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); - - const light = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 3); - light.position.set(0.5, 1, 0.25); - scene.add(light); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - container.appendChild(renderer.domElement); - - // - - document.body.appendChild(ARButton.createButton(renderer)); - - // - - const geometry = new THREE.CylinderGeometry(0, 0.05, 0.2, 32).rotateX(Math.PI / 2); - - function onSelect() { - const material = new THREE.MeshPhongMaterial({ color: 0xffffff * Math.random() }); - const mesh = new THREE.Mesh(geometry, material); - mesh.position.set(0, 0, -0.3).applyMatrix4(controller.matrixWorld); - mesh.quaternion.setFromRotationMatrix(controller.matrixWorld); - scene.add(mesh); - } - - controller = renderer.xr.getController(0); - controller.addEventListener('select', onSelect); - scene.add(controller); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_ar_hittest.ts b/examples-testing/examples/webxr_ar_hittest.ts deleted file mode 100644 index 009b4b976..000000000 --- a/examples-testing/examples/webxr_ar_hittest.ts +++ /dev/null @@ -1,119 +0,0 @@ -import * as THREE from 'three'; -import { ARButton } from 'three/addons/webxr/ARButton.js'; - -let container; -let camera, scene, renderer; -let controller1, controller2; - -let reticle; - -let hitTestSource = null; -let hitTestSourceRequested = false; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); - - const light = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 3); - light.position.set(0.5, 1, 0.25); - scene.add(light); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - container.appendChild(renderer.domElement); - - // - - document.body.appendChild(ARButton.createButton(renderer, { requiredFeatures: ['hit-test'] })); - - // - - const geometry = new THREE.CylinderGeometry(0.1, 0.1, 0.2, 32).translate(0, 0.1, 0); - - function onSelect() { - if (reticle.visible) { - const material = new THREE.MeshPhongMaterial({ color: 0xffffff * Math.random() }); - const mesh = new THREE.Mesh(geometry, material); - reticle.matrix.decompose(mesh.position, mesh.quaternion, mesh.scale); - mesh.scale.y = Math.random() * 2 + 1; - scene.add(mesh); - } - } - - controller1 = renderer.xr.getController(0); - controller1.addEventListener('select', onSelect); - scene.add(controller1); - - controller2 = renderer.xr.getController(1); - controller2.addEventListener('select', onSelect); - scene.add(controller2); - - reticle = new THREE.Mesh( - new THREE.RingGeometry(0.15, 0.2, 32).rotateX(-Math.PI / 2), - new THREE.MeshBasicMaterial(), - ); - reticle.matrixAutoUpdate = false; - reticle.visible = false; - scene.add(reticle); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate(timestamp, frame) { - if (frame) { - const referenceSpace = renderer.xr.getReferenceSpace(); - const session = renderer.xr.getSession(); - - if (hitTestSourceRequested === false) { - session.requestReferenceSpace('viewer').then(function (referenceSpace) { - session.requestHitTestSource({ space: referenceSpace }).then(function (source) { - hitTestSource = source; - }); - }); - - session.addEventListener('end', function () { - hitTestSourceRequested = false; - hitTestSource = null; - }); - - hitTestSourceRequested = true; - } - - if (hitTestSource) { - const hitTestResults = frame.getHitTestResults(hitTestSource); - - if (hitTestResults.length) { - const hit = hitTestResults[0]; - - reticle.visible = true; - reticle.matrix.fromArray(hit.getPose(referenceSpace).transform.matrix); - } else { - reticle.visible = false; - } - } - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_ar_lighting.ts b/examples-testing/examples/webxr_ar_lighting.ts deleted file mode 100644 index 10f49f0bf..000000000 --- a/examples-testing/examples/webxr_ar_lighting.ts +++ /dev/null @@ -1,124 +0,0 @@ -import * as THREE from 'three'; -import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; -import { ARButton } from 'three/addons/webxr/ARButton.js'; -import { XREstimatedLight } from 'three/addons/webxr/XREstimatedLight.js'; - -let camera, scene, renderer; -let controller; -let defaultEnvironment; - -init(); - -function init() { - const container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); - - const defaultLight = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 1); - defaultLight.position.set(0.5, 1, 0.25); - scene.add(defaultLight); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - container.appendChild(renderer.domElement); - - // Don't add the XREstimatedLight to the scene initially. - // It doesn't have any estimated lighting values until an AR session starts. - - const xrLight = new XREstimatedLight(renderer); - - xrLight.addEventListener('estimationstart', () => { - // Swap the default light out for the estimated one once we start getting some estimated values. - scene.add(xrLight); - scene.remove(defaultLight); - - // The estimated lighting also provides an environment cubemap, which we can apply here. - if (xrLight.environment) { - scene.environment = xrLight.environment; - } - }); - - xrLight.addEventListener('estimationend', () => { - // Swap the lights back when we stop receiving estimated values. - scene.add(defaultLight); - scene.remove(xrLight); - - // Revert back to the default environment. - scene.environment = defaultEnvironment; - }); - - // - - new UltraHDRLoader().setPath('textures/equirectangular/').load('royal_esplanade_2k.hdr.jpg', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - defaultEnvironment = texture; - - scene.environment = defaultEnvironment; - }); - - // - - // In order for lighting estimation to work, 'light-estimation' must be included as either an optional or required feature. - document.body.appendChild(ARButton.createButton(renderer, { optionalFeatures: ['light-estimation'] })); - - // - - const ballGeometry = new THREE.SphereGeometry(0.175, 32, 32); - const ballGroup = new THREE.Group(); - ballGroup.position.z = -2; - - const rows = 3; - const cols = 3; - - for (let i = 0; i < rows; i++) { - for (let j = 0; j < cols; j++) { - const ballMaterial = new THREE.MeshStandardMaterial({ - color: 0xdddddd, - roughness: i / rows, - metalness: j / cols, - }); - const ballMesh = new THREE.Mesh(ballGeometry, ballMaterial); - ballMesh.position.set((i + 0.5 - rows * 0.5) * 0.4, (j + 0.5 - cols * 0.5) * 0.4, 0); - ballGroup.add(ballMesh); - } - } - - scene.add(ballGroup); - - // - - function onSelect() { - ballGroup.position.set(0, 0, -2).applyMatrix4(controller.matrixWorld); - ballGroup.quaternion.setFromRotationMatrix(controller.matrixWorld); - } - - controller = renderer.xr.getController(0); - controller.addEventListener('select', onSelect); - scene.add(controller); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_ar_plane_detection.ts b/examples-testing/examples/webxr_ar_plane_detection.ts deleted file mode 100644 index 841b6b04b..000000000 --- a/examples-testing/examples/webxr_ar_plane_detection.ts +++ /dev/null @@ -1,46 +0,0 @@ -import * as THREE from 'three'; -import { ARButton } from 'three/addons/webxr/ARButton.js'; -import { XRPlanes } from 'three/addons/webxr/XRPlanes.js'; - -// - -const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setAnimationLoop(animate); -renderer.xr.enabled = true; -document.body.appendChild(renderer.domElement); - -document.body.appendChild( - ARButton.createButton(renderer, { - requiredFeatures: ['plane-detection'], - }), -); - -window.addEventListener('resize', onWindowResize); - -// - -const scene = new THREE.Scene(); - -const planes = new XRPlanes(renderer); -scene.add(planes); - -const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20); - -const light = new THREE.HemisphereLight(0xffffff, 0xbbbbff, 3); -light.position.set(0.5, 1, 0.25); -scene.add(light); - -// - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_vr_handinput.ts b/examples-testing/examples/webxr_vr_handinput.ts deleted file mode 100644 index d746e4582..000000000 --- a/examples-testing/examples/webxr_vr_handinput.ts +++ /dev/null @@ -1,126 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; -import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; -import { XRHandModelFactory } from 'three/addons/webxr/XRHandModelFactory.js'; - -let container; -let camera, scene, renderer; -let hand1, hand2; -let controller1, controller2; -let controllerGrip1, controllerGrip2; - -let controls; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x444444); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(0, 1.6, 3); - - controls = new OrbitControls(camera, container); - controls.target.set(0, 1.6, 0); - controls.update(); - - const floorGeometry = new THREE.PlaneGeometry(4, 4); - const floorMaterial = new THREE.MeshStandardMaterial({ color: 0x666666 }); - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.rotation.x = -Math.PI / 2; - floor.receiveShadow = true; - scene.add(floor); - - scene.add(new THREE.HemisphereLight(0xbcbcbc, 0xa5a5a5, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 6, 0); - light.castShadow = true; - light.shadow.camera.top = 2; - light.shadow.camera.bottom = -2; - light.shadow.camera.right = 2; - light.shadow.camera.left = -2; - light.shadow.mapSize.set(4096, 4096); - scene.add(light); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.xr.enabled = true; - - container.appendChild(renderer.domElement); - - const sessionInit = { - requiredFeatures: ['hand-tracking'], - }; - - document.body.appendChild(VRButton.createButton(renderer, sessionInit)); - - // controllers - - controller1 = renderer.xr.getController(0); - scene.add(controller1); - - controller2 = renderer.xr.getController(1); - scene.add(controller2); - - const controllerModelFactory = new XRControllerModelFactory(); - const handModelFactory = new XRHandModelFactory(); - - // Hand 1 - controllerGrip1 = renderer.xr.getControllerGrip(0); - controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); - scene.add(controllerGrip1); - - hand1 = renderer.xr.getHand(0); - hand1.add(handModelFactory.createHandModel(hand1)); - - scene.add(hand1); - - // Hand 2 - controllerGrip2 = renderer.xr.getControllerGrip(1); - controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); - scene.add(controllerGrip2); - - hand2 = renderer.xr.getHand(1); - hand2.add(handModelFactory.createHandModel(hand2)); - scene.add(hand2); - - // - - const geometry = new THREE.BufferGeometry().setFromPoints([ - new THREE.Vector3(0, 0, 0), - new THREE.Vector3(0, 0, -1), - ]); - - const line = new THREE.Line(geometry); - line.name = 'line'; - line.scale.z = 5; - - controller1.add(line.clone()); - controller2.add(line.clone()); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} -// - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_vr_panorama.ts b/examples-testing/examples/webxr_vr_panorama.ts deleted file mode 100644 index 535e1c937..000000000 --- a/examples-testing/examples/webxr_vr_panorama.ts +++ /dev/null @@ -1,92 +0,0 @@ -import * as THREE from 'three'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; - -let camera; -let renderer; -let scene; - -init(); - -function init() { - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - renderer.xr.setReferenceSpaceType('local'); - document.body.appendChild(renderer.domElement); - - document.body.appendChild(VRButton.createButton(renderer)); - - // - - scene = new THREE.Scene(); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000); - camera.layers.enable(1); - - const geometry = new THREE.BoxGeometry(100, 100, 100); - geometry.scale(1, 1, -1); - - const textures = getTexturesFromAtlasFile('textures/cube/sun_temple_stripe_stereo.jpg', 12); - - const materials = []; - - for (let i = 0; i < 6; i++) { - materials.push(new THREE.MeshBasicMaterial({ map: textures[i] })); - } - - const skyBox = new THREE.Mesh(geometry, materials); - skyBox.layers.set(1); - scene.add(skyBox); - - const materialsR = []; - - for (let i = 6; i < 12; i++) { - materialsR.push(new THREE.MeshBasicMaterial({ map: textures[i] })); - } - - const skyBoxR = new THREE.Mesh(geometry, materialsR); - skyBoxR.layers.set(2); - scene.add(skyBoxR); - - window.addEventListener('resize', onWindowResize); -} - -function getTexturesFromAtlasFile(atlasImgUrl, tilesNum) { - const textures = []; - - for (let i = 0; i < tilesNum; i++) { - textures[i] = new THREE.Texture(); - } - - const loader = new THREE.ImageLoader(); - loader.load(atlasImgUrl, function (imageObj) { - let canvas, context; - const tileWidth = imageObj.height; - - for (let i = 0; i < textures.length; i++) { - canvas = document.createElement('canvas'); - context = canvas.getContext('2d'); - canvas.height = tileWidth; - canvas.width = tileWidth; - context.drawImage(imageObj, tileWidth * i, 0, tileWidth, tileWidth, 0, 0, tileWidth, tileWidth); - textures[i].colorSpace = THREE.SRGBColorSpace; - textures[i].image = canvas; - textures[i].needsUpdate = true; - } - }); - - return textures; -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_vr_panorama_depth.ts b/examples-testing/examples/webxr_vr_panorama_depth.ts deleted file mode 100644 index ea3d76199..000000000 --- a/examples-testing/examples/webxr_vr_panorama_depth.ts +++ /dev/null @@ -1,93 +0,0 @@ -import * as THREE from 'three'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; - -let camera, scene, renderer, sphere, timer; - -init(); - -function init() { - const container = document.getElementById('container'); - - timer = new THREE.Timer(); - timer.connect(document); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x101010); - - const light = new THREE.AmbientLight(0xffffff, 3); - scene.add(light); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 2000); - scene.add(camera); - - // Create the panoramic sphere geometry - const panoSphereGeo = new THREE.SphereGeometry(6, 256, 256); - - // Create the panoramic sphere material - const panoSphereMat = new THREE.MeshStandardMaterial({ - side: THREE.BackSide, - displacementScale: -4.0, - }); - - // Create the panoramic sphere mesh - sphere = new THREE.Mesh(panoSphereGeo, panoSphereMat); - - // Load and assign the texture and depth map - const manager = new THREE.LoadingManager(); - const loader = new THREE.TextureLoader(manager); - - loader.load('./textures/kandao3.jpg', function (texture) { - texture.colorSpace = THREE.SRGBColorSpace; - texture.minFilter = THREE.NearestFilter; - texture.generateMipmaps = false; - sphere.material.map = texture; - }); - - loader.load('./textures/kandao3_depthmap.jpg', function (depth) { - depth.minFilter = THREE.NearestFilter; - depth.generateMipmaps = false; - sphere.material.displacementMap = depth; - }); - - // On load complete add the panoramic sphere to the scene - manager.onLoad = function () { - scene.add(sphere); - }; - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - renderer.xr.setReferenceSpaceType('local'); - container.appendChild(renderer.domElement); - - document.body.appendChild(VRButton.createButton(renderer)); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - timer.update(); - - // If we are not presenting move the camera a little so the effect is visible - - if (renderer.xr.isPresenting === false) { - const time = timer.getElapsed(); - - sphere.rotation.y += 0.001; - sphere.position.x = Math.sin(time) * 0.2; - sphere.position.z = Math.cos(time) * 0.2; - } - - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_vr_rollercoaster.ts b/examples-testing/examples/webxr_vr_rollercoaster.ts deleted file mode 100644 index 50baf50f8..000000000 --- a/examples-testing/examples/webxr_vr_rollercoaster.ts +++ /dev/null @@ -1,232 +0,0 @@ -import * as THREE from 'three'; - -import { - RollerCoasterGeometry, - RollerCoasterShadowGeometry, - RollerCoasterLiftersGeometry, - TreesGeometry, - SkyGeometry, -} from 'three/addons/misc/RollerCoaster.js'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; - -let mesh, material, geometry; - -const renderer = new THREE.WebGLRenderer({ antialias: true }); -renderer.setPixelRatio(window.devicePixelRatio); -renderer.setSize(window.innerWidth, window.innerHeight); -renderer.setAnimationLoop(animate); -renderer.xr.enabled = true; -renderer.xr.setReferenceSpaceType('local'); -document.body.appendChild(renderer.domElement); - -document.body.appendChild(VRButton.createButton(renderer)); - -// - -const scene = new THREE.Scene(); -scene.background = new THREE.Color(0xf0f0ff); - -const light = new THREE.HemisphereLight(0xfff0f0, 0x60606, 3); -light.position.set(1, 1, 1); -scene.add(light); - -const train = new THREE.Object3D(); -scene.add(train); - -const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 500); -train.add(camera); - -// environment - -geometry = new THREE.PlaneGeometry(500, 500, 15, 15); -geometry.rotateX(-Math.PI / 2); - -const positions = geometry.attributes.position.array; -const vertex = new THREE.Vector3(); - -for (let i = 0; i < positions.length; i += 3) { - vertex.fromArray(positions, i); - - vertex.x += Math.random() * 10 - 5; - vertex.z += Math.random() * 10 - 5; - - const distance = vertex.distanceTo(scene.position) / 5 - 25; - vertex.y = Math.random() * Math.max(0, distance); - - vertex.toArray(positions, i); -} - -geometry.computeVertexNormals(); - -material = new THREE.MeshLambertMaterial({ - color: 0x407000, -}); - -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -geometry = new TreesGeometry(mesh); -material = new THREE.MeshBasicMaterial({ - side: THREE.DoubleSide, - vertexColors: true, -}); -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -geometry = new SkyGeometry(); -material = new THREE.MeshBasicMaterial({ color: 0xffffff }); -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -// - -const PI2 = Math.PI * 2; - -const curve = (function () { - const vector = new THREE.Vector3(); - const vector2 = new THREE.Vector3(); - - return { - getPointAt: function (t) { - t = t * PI2; - - const x = Math.sin(t * 3) * Math.cos(t * 4) * 50; - const y = Math.sin(t * 10) * 2 + Math.cos(t * 17) * 2 + 5; - const z = Math.sin(t) * Math.sin(t * 4) * 50; - - return vector.set(x, y, z).multiplyScalar(2); - }, - - getTangentAt: function (t) { - const delta = 0.0001; - const t1 = Math.max(0, t - delta); - const t2 = Math.min(1, t + delta); - - return vector2.copy(this.getPointAt(t2)).sub(this.getPointAt(t1)).normalize(); - }, - }; -})(); - -geometry = new RollerCoasterGeometry(curve, 1500); -material = new THREE.MeshPhongMaterial({ - vertexColors: true, -}); -mesh = new THREE.Mesh(geometry, material); -scene.add(mesh); - -geometry = new RollerCoasterLiftersGeometry(curve, 100); -material = new THREE.MeshPhongMaterial(); -mesh = new THREE.Mesh(geometry, material); -mesh.position.y = 0.1; -scene.add(mesh); - -geometry = new RollerCoasterShadowGeometry(curve, 500); -material = new THREE.MeshBasicMaterial({ - color: 0x305000, - depthWrite: false, - transparent: true, -}); -mesh = new THREE.Mesh(geometry, material); -mesh.position.y = 0.1; -scene.add(mesh); - -const funfairs = []; - -// - -geometry = new THREE.CylinderGeometry(10, 10, 5, 15); -material = new THREE.MeshLambertMaterial({ - color: 0xff8080, -}); -mesh = new THREE.Mesh(geometry, material); -mesh.position.set(-80, 10, -70); -mesh.rotation.x = Math.PI / 2; -scene.add(mesh); - -funfairs.push(mesh); - -geometry = new THREE.CylinderGeometry(5, 6, 4, 10); -material = new THREE.MeshLambertMaterial({ - color: 0x8080ff, -}); -mesh = new THREE.Mesh(geometry, material); -mesh.position.set(50, 2, 30); -scene.add(mesh); - -funfairs.push(mesh); - -// - -window.addEventListener('resize', onWindowResize); - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -const position = new THREE.Vector3(); -const tangent = new THREE.Vector3(); - -const lookAt = new THREE.Vector3(); - -const tangent1 = new THREE.Vector3(); -const tangent2 = new THREE.Vector3(); -const bankQuaternion = new THREE.Quaternion(); - -let velocity = 0; -let progress = 0; - -let prevTime = performance.now(); - -function animate() { - const time = performance.now(); - const delta = time - prevTime; - - for (let i = 0; i < funfairs.length; i++) { - funfairs[i].rotation.y = time * 0.0004; - } - - // - - progress += velocity; - progress = progress % 1; - - position.copy(curve.getPointAt(progress)); - position.y += 0.3; - - train.position.copy(position); - - tangent.copy(curve.getTangentAt(progress)); - - velocity -= tangent.y * 0.0000001 * delta; - velocity = Math.max(0.00004, Math.min(0.0002, velocity)); - - // banking - - const bankDelta = 0.01; - const t1 = (((progress - bankDelta) % 1) + 1) % 1; - const t2 = (progress + bankDelta) % 1; - - tangent1.copy(curve.getTangentAt(t1)); - tangent2.copy(curve.getTangentAt(t2)); - - let headingChange = Math.atan2(tangent2.x, tangent2.z) - Math.atan2(tangent1.x, tangent1.z); - if (headingChange > Math.PI) headingChange -= Math.PI * 2; - if (headingChange < -Math.PI) headingChange += Math.PI * 2; - - train.up.set(0, 1, 0); - bankQuaternion.setFromAxisAngle(tangent, -Math.atan(headingChange * 8) * 0.5); - train.up.applyQuaternion(bankQuaternion); - - train.lookAt(lookAt.copy(position).sub(tangent)); - - // - - renderer.render(scene, camera); - - prevTime = time; -} diff --git a/examples-testing/examples/webxr_vr_sandbox.ts b/examples-testing/examples/webxr_vr_sandbox.ts deleted file mode 100644 index 19108d589..000000000 --- a/examples-testing/examples/webxr_vr_sandbox.ts +++ /dev/null @@ -1,192 +0,0 @@ -import * as THREE from 'three'; - -import { HDRLoader } from 'three/addons/loaders/HDRLoader.js'; -import { Reflector } from 'three/addons/objects/Reflector.js'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; - -import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; -import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; -import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; - -import { GUI } from 'three/addons/libs/lil-gui.module.min.js'; -import Stats from 'three/addons/libs/stats.module.js'; - -let camera, scene, renderer; -let reflector; -let stats, statsMesh; - -const parameters = { - radius: 0.6, - tube: 0.2, - tubularSegments: 150, - radialSegments: 20, - p: 2, - q: 3, - thickness: 0.5, -}; - -init(); - -function init() { - scene = new THREE.Scene(); - - new HDRLoader().setPath('textures/equirectangular/').load('moonless_golf_1k.hdr', function (texture) { - texture.mapping = THREE.EquirectangularReflectionMapping; - - scene.background = texture; - scene.environment = texture; - }); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(0, 1.6, 1.5); - - // - - const torusGeometry = new THREE.TorusKnotGeometry(...Object.values(parameters)); - const torusMaterial = new THREE.MeshPhysicalMaterial({ - transmission: 1.0, - roughness: 0, - metalness: 0.25, - thickness: 0.5, - side: THREE.DoubleSide, - }); - const torus = new THREE.Mesh(torusGeometry, torusMaterial); - torus.name = 'torus'; - torus.position.y = 1.5; - torus.position.z = -2; - scene.add(torus); - - const cylinderGeometry = new THREE.CylinderGeometry(1, 1, 0.1, 50); - const cylinderMaterial = new THREE.MeshLambertMaterial(); - const cylinder = new THREE.Mesh(cylinderGeometry, cylinderMaterial); - cylinder.position.z = -2; - scene.add(cylinder); - - // - - reflector = new Reflector(new THREE.PlaneGeometry(2, 2), { - textureWidth: window.innerWidth, - textureHeight: window.innerHeight, - }); - reflector.position.x = 1; - reflector.position.y = 1.5; - reflector.position.z = -3; - reflector.rotation.y = -Math.PI / 4; - scene.add(reflector); - - const frameGeometry = new THREE.BoxGeometry(2.1, 2.1, 0.1); - const frameMaterial = new THREE.MeshLambertMaterial({ color: 0x888888 }); - const frame = new THREE.Mesh(frameGeometry, frameMaterial); - frame.position.z = -0.07; - reflector.add(frame); - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.autoClear = false; - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.toneMappingExposure = 1; - document.body.appendChild(renderer.domElement); - - document.body.appendChild(VRButton.createButton(renderer)); - - window.addEventListener('resize', onWindowResize); - - // - - const geometry = new THREE.BufferGeometry(); - geometry.setFromPoints([new THREE.Vector3(0, 0, 0), new THREE.Vector3(0, 0, -5)]); - - const controller1 = renderer.xr.getController(0); - controller1.add(new THREE.Line(geometry)); - scene.add(controller1); - - const controller2 = renderer.xr.getController(1); - controller2.add(new THREE.Line(geometry)); - scene.add(controller2); - - // - - const controllerModelFactory = new XRControllerModelFactory(); - - const controllerGrip1 = renderer.xr.getControllerGrip(0); - controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); - scene.add(controllerGrip1); - - const controllerGrip2 = renderer.xr.getControllerGrip(1); - controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); - scene.add(controllerGrip2); - - // GUI - - function onChange() { - torus.geometry.dispose(); - torus.geometry = new THREE.TorusKnotGeometry(...Object.values(parameters)); - } - - function onThicknessChange() { - torus.material.thickness = parameters.thickness; - } - - const gui = new GUI({ width: 300 }); - gui.add(parameters, 'radius', 0.0, 1.0).onChange(onChange); - gui.add(parameters, 'tube', 0.0, 1.0).onChange(onChange); - gui.add(parameters, 'tubularSegments', 10, 150, 1).onChange(onChange); - gui.add(parameters, 'radialSegments', 2, 20, 1).onChange(onChange); - gui.add(parameters, 'p', 1, 10, 1).onChange(onChange); - gui.add(parameters, 'q', 0, 10, 1).onChange(onChange); - gui.add(parameters, 'thickness', 0, 1).onChange(onThicknessChange); - gui.domElement.style.visibility = 'hidden'; - - const group = new InteractiveGroup(); - group.listenToPointerEvents(renderer, camera); - group.listenToXRControllerEvents(controller1); - group.listenToXRControllerEvents(controller2); - scene.add(group); - - const mesh = new HTMLMesh(gui.domElement); - mesh.position.x = -0.75; - mesh.position.y = 1.5; - mesh.position.z = -0.5; - mesh.rotation.y = Math.PI / 4; - mesh.scale.setScalar(2); - group.add(mesh); - - // Add stats.js - stats = new Stats(); - stats.dom.style.width = '80px'; - stats.dom.style.height = '48px'; - document.body.appendChild(stats.dom); - - statsMesh = new HTMLMesh(stats.dom); - statsMesh.position.x = -0.75; - statsMesh.position.y = 2; - statsMesh.position.z = -0.6; - statsMesh.rotation.y = Math.PI / 4; - statsMesh.scale.setScalar(2.5); - group.add(statsMesh); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - const time = performance.now() * 0.0002; - const torus = scene.getObjectByName('torus'); - torus.rotation.x = time * 0.4; - torus.rotation.y = time; - - renderer.render(scene, camera); - stats.update(); - - // Canvas elements doesn't trigger DOM updates, so we have to update the texture - statsMesh.material.map.update(); -} diff --git a/examples-testing/examples/webxr_vr_video.ts b/examples-testing/examples/webxr_vr_video.ts deleted file mode 100644 index 50a990412..000000000 --- a/examples-testing/examples/webxr_vr_video.ts +++ /dev/null @@ -1,92 +0,0 @@ -import * as THREE from 'three'; -import { VRButton } from 'three/addons/webxr/VRButton.js'; - -let camera, scene, renderer; - -init(); - -function init() { - const container = document.getElementById('container'); - container.addEventListener('click', function () { - video.play(); - }); - - camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 2000); - camera.layers.enable(1); // render left view when no stereo available - - // video - - const video = document.getElementById('video'); - video.play(); - - const texture = new THREE.VideoTexture(video); - texture.colorSpace = THREE.SRGBColorSpace; - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x101010); - - // left - - const geometry1 = new THREE.SphereGeometry(500, 60, 40); - // invert the geometry on the x-axis so that all of the faces point inward - geometry1.scale(-1, 1, 1); - - const uvs1 = geometry1.attributes.uv.array; - - for (let i = 0; i < uvs1.length; i += 2) { - uvs1[i] *= 0.5; - } - - const material1 = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh1 = new THREE.Mesh(geometry1, material1); - mesh1.rotation.y = -Math.PI / 2; - mesh1.layers.set(1); // display in left eye only - scene.add(mesh1); - - // right - - const geometry2 = new THREE.SphereGeometry(500, 60, 40); - geometry2.scale(-1, 1, 1); - - const uvs2 = geometry2.attributes.uv.array; - - for (let i = 0; i < uvs2.length; i += 2) { - uvs2[i] *= 0.5; - uvs2[i] += 0.5; - } - - const material2 = new THREE.MeshBasicMaterial({ map: texture }); - - const mesh2 = new THREE.Mesh(geometry2, material2); - mesh2.rotation.y = -Math.PI / 2; - mesh2.layers.set(2); // display in right eye only - scene.add(mesh2); - - // - - renderer = new THREE.WebGLRenderer(); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.xr.enabled = true; - renderer.xr.setReferenceSpaceType('local'); - container.appendChild(renderer.domElement); - - document.body.appendChild(VRButton.createButton(renderer)); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_xr_controls_transform.ts b/examples-testing/examples/webxr_xr_controls_transform.ts deleted file mode 100644 index cd9b1290d..000000000 --- a/examples-testing/examples/webxr_xr_controls_transform.ts +++ /dev/null @@ -1,218 +0,0 @@ -import * as THREE from 'three'; -import { TransformControls } from 'three/addons/controls/TransformControls.js'; -import { XRButton } from 'three/addons/webxr/XRButton.js'; -import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; -import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; - -let container; -let camera, scene, renderer; -let bloomPass; -let controller1, controller2, line; -let controllerGrip1, controllerGrip2; - -let raycaster; - -let controls, group; - -init(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x808080); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(0, 1.6, 0); - - const floorGeometry = new THREE.PlaneGeometry(6, 6); - const floorMaterial = new THREE.ShadowMaterial({ - opacity: 0.25, - blending: THREE.CustomBlending, - transparent: false, - }); - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.rotation.x = -Math.PI / 2; - floor.receiveShadow = true; - scene.add(floor); - - scene.add(new THREE.HemisphereLight(0xbcbcbc, 0xa5a5a5, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 6, 0); - light.castShadow = true; - light.shadow.camera.top = 3; - light.shadow.camera.bottom = -3; - light.shadow.camera.right = 3; - light.shadow.camera.left = -3; - light.shadow.mapSize.set(4096, 4096); - scene.add(light); - - group = new THREE.Group(); - scene.add(group); - - const geometries = [ - new THREE.BoxGeometry(0.2, 0.2, 0.2), - new THREE.ConeGeometry(0.2, 0.4, 64), - new THREE.CylinderGeometry(0.2, 0.2, 0.2, 64), - new THREE.IcosahedronGeometry(0.2, 8), - new THREE.TorusGeometry(0.2, 0.04, 64, 32), - ]; - - for (let i = 0; i < 16; i++) { - const geometry = geometries[Math.floor(Math.random() * geometries.length)]; - const material = new THREE.MeshStandardMaterial({ - color: Math.random() * 0xffffff, - roughness: 0.7, - metalness: 0.0, - }); - - const object = new THREE.Mesh(geometry, material); - - object.position.x = Math.random() - 0.5; - object.position.y = Math.random() * 2 + 0.5; - object.position.z = Math.random() - 2.5; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.setScalar(Math.random() + 0.5); - - object.castShadow = true; - object.receiveShadow = true; - - group.add(object); - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true, outputBufferType: THREE.HalfFloatType }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.setAnimationLoop(animate); - renderer.shadowMap.enabled = true; - renderer.toneMapping = THREE.ACESFilmicToneMapping; - renderer.xr.enabled = true; - container.appendChild(renderer.domElement); - - // post-processing - - bloomPass = new UnrealBloomPass(new THREE.Vector2(window.innerWidth, window.innerHeight), 1.5, 0.4, 0.85); - renderer.setEffects([bloomPass]); - - document.body.appendChild(XRButton.createButton(renderer)); - - // controllers - - controller1 = renderer.xr.getController(0); - controller1.addEventListener('select', onSelect); - controller1.addEventListener('selectstart', onControllerEvent); - controller1.addEventListener('selectend', onControllerEvent); - controller1.addEventListener('move', onControllerEvent); - controller1.userData.active = false; - scene.add(controller1); - - controller2 = renderer.xr.getController(1); - controller2.addEventListener('select', onSelect); - controller2.addEventListener('selectstart', onControllerEvent); - controller2.addEventListener('selectend', onControllerEvent); - controller2.addEventListener('move', onControllerEvent); - controller2.userData.active = true; - scene.add(controller2); - - const controllerModelFactory = new XRControllerModelFactory(); - - controllerGrip1 = renderer.xr.getControllerGrip(0); - controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); - scene.add(controllerGrip1); - - controllerGrip2 = renderer.xr.getControllerGrip(1); - controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); - scene.add(controllerGrip2); - - // - - const geometry = new THREE.BufferGeometry().setFromPoints([ - new THREE.Vector3(0, 0, 0), - new THREE.Vector3(0, 0, -1), - ]); - - line = new THREE.Line(geometry); - line.name = 'line'; - line.scale.z = 5; - - raycaster = new THREE.Raycaster(); - - // controls - - controls = new TransformControls(camera, renderer.domElement); - controls.attach(group.children[0]); - scene.add(controls.getHelper()); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onSelect(event) { - const controller = event.target; - - controller1.userData.active = false; - controller2.userData.active = false; - - if (controller === controller1) { - controller1.userData.active = true; - controller1.add(line); - } - - if (controller === controller2) { - controller2.userData.active = true; - controller2.add(line); - } - - raycaster.setFromXRController(controller); - - const intersects = raycaster.intersectObjects(group.children); - - if (intersects.length > 0) { - controls.attach(intersects[0].object); - } -} - -function onControllerEvent(event) { - const controller = event.target; - - if (controller.userData.active === false) return; - - controls.getRaycaster().setFromXRController(controller); - - switch (event.type) { - case 'selectstart': - controls.pointerDown(null); - break; - - case 'selectend': - controls.pointerUp(null); - break; - - case 'move': - controls.pointerHover(null); - controls.pointerMove(null); - break; - } -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -// - -function animate() { - renderer.render(scene, camera); -} diff --git a/examples-testing/examples/webxr_xr_dragging_custom_depth.ts b/examples-testing/examples/webxr_xr_dragging_custom_depth.ts deleted file mode 100644 index 2cd50ba4c..000000000 --- a/examples-testing/examples/webxr_xr_dragging_custom_depth.ts +++ /dev/null @@ -1,395 +0,0 @@ -import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { XRButton } from 'three/addons/webxr/XRButton.js'; -import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; - -let container; -let camera, scene, renderer; -let controller1, controller2; -let controllerGrip1, controllerGrip2; -let isDepthSupplied = false; - -let raycaster; - -const intersected = []; -const tempMatrix = new THREE.Matrix4(); - -let controls, group; - -init(); -animate(); - -function init() { - container = document.createElement('div'); - document.body.appendChild(container); - - scene = new THREE.Scene(); - scene.background = new THREE.Color(0x808080); - - camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 10); - camera.position.set(0, 1.6, 3); - - controls = new OrbitControls(camera, container); - controls.target.set(0, 1.6, 0); - controls.update(); - - const floorGeometry = new THREE.PlaneGeometry(6, 6); - const floorMaterial = new THREE.ShadowMaterial({ - opacity: 0.25, - blending: THREE.CustomBlending, - transparent: false, - }); - const floor = new THREE.Mesh(floorGeometry, floorMaterial); - floor.rotation.x = -Math.PI / 2; - floor.receiveShadow = true; - scene.add(floor); - - scene.add(new THREE.HemisphereLight(0xbcbcbc, 0xa5a5a5, 3)); - - const light = new THREE.DirectionalLight(0xffffff, 3); - light.position.set(0, 6, 0); - light.castShadow = true; - light.shadow.camera.top = 3; - light.shadow.camera.bottom = -3; - light.shadow.camera.right = 3; - light.shadow.camera.left = -3; - light.shadow.mapSize.set(4096, 4096); - scene.add(light); - - group = new THREE.Group(); - scene.add(group); - - const geometries = [ - new THREE.BoxGeometry(0.2, 0.2, 0.2), - new THREE.ConeGeometry(0.2, 0.2, 64), - new THREE.CylinderGeometry(0.2, 0.2, 0.2, 64), - new THREE.IcosahedronGeometry(0.2, 8), - new THREE.TorusGeometry(0.2, 0.04, 64, 32), - ]; - - for (let i = 0; i < 50; i++) { - const geometry = geometries[Math.floor(Math.random() * geometries.length)]; - const material = new THREE.ShaderMaterial({ - vertexShader: /* glsl */ ` - varying vec3 vNormal; - varying vec2 vUv; - void main() { - vNormal = normalize(normalMatrix * normal); - vUv = uv; - gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); - } - `, - - fragmentShader: /* glsl */ ` - uniform vec3 diffuseColor; - uniform float roughness; - uniform float metalness; - uniform float emissive; - varying vec3 vNormal; - varying vec2 vUv; - uniform sampler2DArray depthColor; - uniform float depthWidth; - uniform float depthHeight; - #define saturate( a ) clamp( a, 0.0, 1.0 ) - float Depth_GetCameraDepthInMeters(const sampler2DArray depthTexture, - const vec2 depthUv, int arrayIndex) { - return texture(depthColor, vec3(depthUv.x, depthUv.y, arrayIndex)).r; - } - float Depth_GetOcclusion(const sampler2DArray depthTexture, const vec2 depthUv, float assetDepthM, int arrayIndex) { - float depthMm = Depth_GetCameraDepthInMeters(depthTexture, depthUv, arrayIndex); - const float kDepthTolerancePerM = 0.001; - return clamp(1.0 - - 0.5 * (depthMm - assetDepthM) / - (kDepthTolerancePerM * assetDepthM) + - 0.5, 0.0, 1.0); - } - float Depth_GetBlurredOcclusionAroundUV(const sampler2DArray depthTexture, const vec2 uv, float assetDepthM, int arrayIndex) { - // Kernel used: - // 0 4 7 4 0 - // 4 16 26 16 4 - // 7 26 41 26 7 - // 4 16 26 16 4 - // 0 4 7 4 0 - const float kKernelTotalWeights = 269.0; - float sum = 0.0; - const float kOcclusionBlurAmount = 0.0005; - vec2 blurriness = - vec2(kOcclusionBlurAmount, kOcclusionBlurAmount /** u_DepthAspectRatio*/); - float current = 0.0; - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-1.0, -2.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+1.0, -2.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-1.0, +2.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+1.0, +2.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-2.0, +1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+2.0, +1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-2.0, -1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+2.0, -1.0) * blurriness, assetDepthM, arrayIndex); - sum += current * 4.0; - current = 0.0; - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-2.0, -0.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+2.0, +0.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+0.0, +2.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-0.0, -2.0) * blurriness, assetDepthM, arrayIndex); - sum += current * 7.0; - current = 0.0; - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-1.0, -1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+1.0, -1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-1.0, +1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+1.0, +1.0) * blurriness, assetDepthM, arrayIndex); - sum += current * 16.0; - current = 0.0; - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+0.0, +1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-0.0, -1.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(-1.0, -0.0) * blurriness, assetDepthM, arrayIndex); - current += Depth_GetOcclusion( - depthTexture, uv + vec2(+1.0, +0.0) * blurriness, assetDepthM, arrayIndex); - sum += current * 26.0; - sum += Depth_GetOcclusion(depthTexture, uv, assetDepthM, arrayIndex) * 41.0; - return sum / kKernelTotalWeights; - } - void main() { - vec3 normal = normalize(vNormal); - vec3 diffuse = diffuseColor; - float specularIntensity = pow(max(dot(normal, normalize(vec3(0, 0, 1))), 0.0), 64.0); - vec3 specular = vec3(specularIntensity) * mix(vec3(0.04), diffuse, metalness); - gl_FragColor = vec4(diffuse * (1.0 - specular) + specular, 1.0) * (1.0 + emissive); - - if (depthWidth > 0.0) { - int arrayIndex = 0; - vec2 depthUv; - if (gl_FragCoord.x>=depthWidth) { - arrayIndex = 1; - depthUv = vec2((gl_FragCoord.x-depthWidth)/depthWidth, gl_FragCoord.y/depthHeight); - } else { - depthUv = vec2(gl_FragCoord.x/depthWidth, gl_FragCoord.y/depthHeight); - } - float assetDepthM = gl_FragCoord.z; - - float occlusion = Depth_GetBlurredOcclusionAroundUV(depthColor, depthUv, assetDepthM, arrayIndex); - float depthMm = Depth_GetCameraDepthInMeters(depthColor, depthUv, arrayIndex); - - float absDistance = abs(assetDepthM - depthMm); - float v = 0.0025; - absDistance = saturate(v - absDistance) / v; - - gl_FragColor.rgb += vec3(absDistance * 2.0, absDistance * 2.0, absDistance * 12.0); - gl_FragColor = mix(gl_FragColor, vec4(0.0, 0.0, 0.0, 0.0), occlusion * 0.7); - } - } - `, - - uniforms: { - diffuseColor: { value: new THREE.Color(Math.random() * 0xffffff) }, - roughness: { value: 0.7 }, - metalness: { value: 0.0 }, - emissive: { value: 0.0 }, - depthWidth: { value: 0.0 }, - depthHeight: { value: 0.0 }, - depthColor: { value: new THREE.Texture() }, - }, - }); - - const object = new THREE.Mesh(geometry, material); - - object.position.x = Math.random() * 4 - 2; - object.position.y = Math.random() * 2; - object.position.z = Math.random() * 4 - 2; - - object.rotation.x = Math.random() * 2 * Math.PI; - object.rotation.y = Math.random() * 2 * Math.PI; - object.rotation.z = Math.random() * 2 * Math.PI; - - object.scale.setScalar(Math.random() + 0.5); - - group.add(object); - } - - // - - renderer = new THREE.WebGLRenderer({ antialias: true }); - renderer.setPixelRatio(window.devicePixelRatio); - renderer.setSize(window.innerWidth, window.innerHeight); - renderer.shadowMap.enabled = true; - renderer.xr.enabled = true; - container.appendChild(renderer.domElement); - - document.body.appendChild( - XRButton.createButton(renderer, { - optionalFeatures: ['depth-sensing'], - depthSensing: { usagePreference: ['gpu-optimized'], dataFormatPreference: [] }, - }), - ); - - // controllers - - controller1 = renderer.xr.getController(0); - controller1.addEventListener('selectstart', onSelectStart); - controller1.addEventListener('selectend', onSelectEnd); - scene.add(controller1); - - controller2 = renderer.xr.getController(1); - controller2.addEventListener('selectstart', onSelectStart); - controller2.addEventListener('selectend', onSelectEnd); - scene.add(controller2); - - const controllerModelFactory = new XRControllerModelFactory(); - - controllerGrip1 = renderer.xr.getControllerGrip(0); - controllerGrip1.add(controllerModelFactory.createControllerModel(controllerGrip1)); - scene.add(controllerGrip1); - - controllerGrip2 = renderer.xr.getControllerGrip(1); - controllerGrip2.add(controllerModelFactory.createControllerModel(controllerGrip2)); - scene.add(controllerGrip2); - - // - - const geometry = new THREE.BufferGeometry().setFromPoints([ - new THREE.Vector3(0, 0, 0), - new THREE.Vector3(0, 0, -1), - ]); - - const line = new THREE.Line(geometry); - line.name = 'line'; - line.scale.z = 5; - - controller1.add(line.clone()); - controller2.add(line.clone()); - - raycaster = new THREE.Raycaster(); - - // - - window.addEventListener('resize', onWindowResize); -} - -function onWindowResize() { - camera.aspect = window.innerWidth / window.innerHeight; - camera.updateProjectionMatrix(); - - renderer.setSize(window.innerWidth, window.innerHeight); -} - -function onSelectStart(event) { - const controller = event.target; - - const intersections = getIntersections(controller); - - if (intersections.length > 0) { - const intersection = intersections[0]; - - const object = intersection.object; - object.material.uniforms.emissive.value = 1; - controller.attach(object); - - controller.userData.selected = object; - } - - controller.userData.targetRayMode = event.data.targetRayMode; -} - -function onSelectEnd(event) { - const controller = event.target; - - if (controller.userData.selected !== undefined) { - const object = controller.userData.selected; - object.material.uniforms.emissive.value = 0; - group.attach(object); - - controller.userData.selected = undefined; - } -} - -function getIntersections(controller) { - controller.updateMatrixWorld(); - - tempMatrix.identity().extractRotation(controller.matrixWorld); - - raycaster.ray.origin.setFromMatrixPosition(controller.matrixWorld); - raycaster.ray.direction.set(0, 0, -1).applyMatrix4(tempMatrix); - - return raycaster.intersectObjects(group.children, false); -} - -function intersectObjects(controller) { - // Do not highlight in mobile-ar - - if (controller.userData.targetRayMode === 'screen') return; - - // Do not highlight when already selected - - if (controller.userData.selected !== undefined) return; - - const line = controller.getObjectByName('line'); - const intersections = getIntersections(controller); - - if (intersections.length > 0) { - const intersection = intersections[0]; - - const object = intersection.object; - object.material.uniforms.emissive.value = 1; - intersected.push(object); - - line.scale.z = intersection.distance; - } else { - line.scale.z = 5; - } -} - -function cleanIntersected() { - while (intersected.length) { - const object = intersected.pop(); - object.material.uniforms.emissive.value = 0; - } -} - -// - -function animate() { - renderer.setAnimationLoop(render); -} - -function render() { - if (renderer.xr.hasDepthSensing() && !isDepthSupplied) { - group.children.forEach(child => { - child.material.uniforms.depthColor.value = renderer.xr.getDepthTexture(); - child.material.uniforms.depthWidth.value = 1680; - child.material.uniforms.depthHeight.value = 1760; - - isDepthSupplied = true; - }); - } else if (!renderer.xr.hasDepthSensing() && isDepthSupplied) { - group.children.forEach(child => { - child.material.uniforms.depthWidth.value = 0; - child.material.uniforms.depthHeight.value = 0; - - isDepthSupplied = false; - }); - } - - cleanIntersected(); - - intersectObjects(controller1); - intersectObjects(controller2); - - renderer.render(scene, camera); -}